Commit Graph

658 Commits

Author SHA1 Message Date
Evan You 3eab143843 fix(template-ref): fix string template refs inside slots 2020-02-25 18:29:51 -05:00
ysj16 8cb0b83088
fix(renderSlot): set slot render as a STABLE_FRAGMENT (#776)
fix #766
2020-02-25 16:41:44 +01:00
Evan You 4a5b91bd1f fix(runtime-core): fix slot fallback + slots typing
fix #773
2020-02-25 09:41:07 -05:00
djy0 19a799c28b
fix(runtime-core): make watchEffect ignore deep option (#765) 2020-02-24 18:03:02 +01:00
djy0 c11905fe36
chore: fix typo (#764) [ci skip] 2020-02-24 18:01:26 +01:00
Evan You 9ab22c7ae6 release: v3.0.0-alpha.6 2020-02-22 08:25:32 +01:00
Evan You 99a2e18c97 feat(runtime-core): add watchEffect API
BREAKING CHANGE: replae `watch(fn, options?)` with `watchEffect`

    The `watch(fn, options?)` signature has been replaced by the new
    `watchEffect` API, which has the same usage and behavior. `watch`
    now only supports the `watch(source, cb, options?)` signautre.
2020-02-22 08:19:10 +01:00
Evan You e9024bf1b7 feat(reactivity): expose unref and shallowRef 2020-02-22 04:39:32 +01:00
Evan You 0c67201942 chore: fix test type 2020-02-22 03:54:20 +01:00
hareku 9547c2b93d
fix(sfc): inherit parent scopeId on child rooot (#756) 2020-02-21 14:44:13 +01:00
Evan You a840e7ddf0 fix(types): update setup binding unwrap types for 6b10f0c
close #738
2020-02-19 18:29:18 +01:00
Evan You 478b4cfb2c release: v3.0.0-alpha.5 2020-02-18 15:00:55 -05:00
Evan You 8383e5450e fix(runtime-core): ensure renderCache always exists 2020-02-18 14:43:12 -05:00
Evan You 583f9468fa refactor: extract remove util 2020-02-18 13:52:59 -05:00
Evan You fd031490fb feat(ssr): useSSRContext 2020-02-18 13:26:15 -05:00
Evan You 86464e8c04 refactor: only run useCssModule code in non-global builds 2020-02-18 13:23:30 -05:00
Evan You 2fb7a63943 fix(computed): support arrow function usage for computed option
fix #733
2020-02-17 23:22:25 -05:00
Evan You 9571ede84b refactor(watch): adjsut watch API behavior
BREAKING CHANGE: `watch` behavior has been adjusted.

    - When using the `watch(source, callback, options?)` signature, the
      callback now fires lazily by default (consistent with 2.x
      behavior).

      Note that the `watch(effect, options?)` signature is still eager,
      since it must invoke the `effect` immediately to collect
      dependencies.

    - The `lazy` option has been replaced by the opposite `immediate`
      option, which defaults to `false`. (It's ignored when using the
      effect signature)

    - Due to the above changes, the `watch` option in Options API now
      behaves exactly the same as 2.x.

    - When using the effect signature or `{ immediate: true }`, the
      intital execution is now performed synchronously instead of
      deferred until the component is mounted. This is necessary for
      certain use cases to work properly with `async setup()` and
      Suspense.

      The side effect of this is the immediate watcher invocation will
      no longer have access to the mounted DOM. However, the watcher can
      be initiated inside `onMounted` to retain previous behavior.
2020-02-17 23:16:58 -05:00
Evan You d9d63f21b1 fix(reactivity): avoid cross-component dependency leaks in setup() 2020-02-17 23:14:07 -05:00
Evan You 0c1fe72dcf build: make watch tree-shakable in lean build 2020-02-17 11:02:15 -05:00
Evan You 77103e1fd7 types: fix tsx dts tests 2020-02-15 21:48:45 -05:00
Evan You 57ee5df364 fix(types): app.component should accept defineComponent return type
fix #730
2020-02-15 21:04:29 -05:00
Evan You 9d2ac6675a refactor: make portal tree-shakeable 2020-02-15 17:44:37 -05:00
夜宴 8a4412077c
chore: remove redundant Non-Null Assertion (#728) 2020-02-15 11:33:22 -05:00
Evan You 70dc3e3ae7 feat(ssr): support portal hydration 2020-02-14 21:04:08 -05:00
Evan You 96605b79a3 types: avoid duplicate type declarations for renderer closure functions 2020-02-14 16:25:41 -05:00
Evan You 80904e92b8 types: cleanup renderer & hydration typing 2020-02-14 12:33:32 -05:00
Evan You 629ee75588 perf: prevent renderer hot functions being inlined by minifiers
Terser will aggressively inline hot functions in renderer.ts in order
to reduce "function" declarations, but the inlining leads to performance
overhead (small, but noticeable in benchmarks).

Since we cannot control user's minifier options, we have to avoid the
deopt in the source code by using arrow functions in hot paths.
2020-02-14 03:27:27 -05:00
Evan You 6df2aca070 refactor(types): move shapeFlags to shared 2020-02-14 01:36:42 -05:00
Evan You 167f8241bd refactor(ssr): make hydration logic tree-shakeable 2020-02-14 01:30:08 -05:00
Evan You 112d8f7d86 refactor: use explicit exports for runtime-core 2020-02-14 00:13:54 -05:00
Evan You 42d80b5888 wip(ssr): component hydration 2020-02-13 23:31:03 -05:00
Evan You 9aaef60ad2 wip(ssr): adjust event hydration flag 2020-02-13 18:28:40 -05:00
Evan You 6b505dcd23 wip(ssr): basic element hydration 2020-02-13 17:47:00 -05:00
Evan You 35d91f4e18 fix(runtime-core): handle component updates with only class/style bindings 2020-02-13 17:27:52 -05:00
Evan You c6a9787941 fix(types): ensure correct oldValue typing based on lazy option
close #719
2020-02-13 12:09:13 -05:00
Evan You 1389d7b88c refactor(compiler-core): use more concise marker for compiled slots 2020-02-12 13:45:35 -05:00
Evan You 175f8aae8d feat(compiler): mark hoisted trees with patchFlag 2020-02-12 13:31:29 -05:00
Evan You 27913e661a feat(compiler-dom/runtime-dom): stringify eligible static trees 2020-02-12 11:56:42 -05:00
Evan You e3988b40d8 refactor(compiler-core): use dedicated node type for element codegen
Previously codegen node for elements and components used raw expressions,
which leads to multiple permutations of AST shapes based on whether the
node is a block or has directives. The complexity is spread across the
entire compiler and occurs whenever a transform needs to deal with
element codegen nodes.

This refactor centralizes the handling of all possible permutations
into the codegen phase, so that all elements/components will have a
consistent node type throughout the transform phase.

The refactor is split into two commits (with test updates in a separate
one) so changes can be easier to inspect.
2020-02-11 18:40:42 -05:00
Yang Mingshan fe9da2d0e4
fix(runtime-core/scheduler): invalidate job (#717) 2020-02-11 07:30:25 -05:00
Evan You 12fcf9ab95 fix(compiler): fix v-for fragment openBlock argument 2020-02-10 18:19:49 -05:00
Evan You 47e984d31f refactor(compiler): provide _ctx and _cache via arguments 2020-02-10 17:29:12 -05:00
Evan You cfadb98011 fix(runtime-core): rework vnode hooks handling
- peroperly support directive on components (e.g. <foo v-show="x">)
- consistently invoke raw vnode hooks on component vnodes (fix #684)
2020-02-10 13:15:36 -05:00
Evan You 8a87074df0 fix(runtime-core/scheduler): avoid duplicate updates of child component 2020-02-10 13:09:15 -05:00
Evan You 778f3a5e88 fix(runtime-core): should not return early on text patchFlag
fix vnode updated hook on elements with dynamic text children
2020-02-10 12:06:36 -05:00
Evan You e308ad99e9 refactor: ensure setup context.emit always point to intenral emit 2020-02-09 21:47:16 -05:00
Evan You 4bc4cb970f fix: remove effect from public API
close #712
2020-02-09 21:43:54 -05:00
jods 21944c4a42
feat(runtime-core/reactivity): expose shallowReactive (#711) 2020-02-09 21:42:34 -05:00
Evan You 0f67aa7da5 fix(runtime-core): fix ShapeFlags tree shaking 2020-02-07 17:18:12 -05:00
Evan You 5b43764eac fix(runtime-core): fix keep-alive tree-shaking 2020-02-07 17:00:39 -05:00
Evan You b7a74d0439 wip(ssr): ssr slot vnode fallback 2020-02-07 01:06:51 -05:00
Evan You ee5ed73361 wip(ssr): basic components 2020-02-05 23:07:23 -05:00
Eduardo San Martin Morote 5742a0b826
fix(runtime-core/watch): trigger watcher with undefined as initial value (#687)
Fix #683
2020-02-04 09:59:04 -05:00
Evan You bd9b690a51 chore: rmeove unused export 2020-01-31 11:07:10 -05:00
Evan You c02e7bc7d6 wip(ssr): should apply app context when rendering app instance 2020-01-30 12:20:23 -05:00
Evan You eaf414f063 test(ssr): test rendering vnode elements 2020-01-29 17:36:06 -05:00
Evan You 8cdaf28515 test(ssr): test for rendering components 2020-01-29 16:46:18 -05:00
Evan You 6e06810add test(ssr): tests for utils and props rendering 2020-01-29 15:10:45 -05:00
Evan You bc07e95ca8 fix(ssr): avoid hard-coded ssr checks in cjs builds 2020-01-29 09:49:17 -05:00
Evan You 6b1ce00621 wip(ssr): renderer support for optimized and manual slots 2020-01-28 22:58:02 -05:00
Evan You a7b0954f14 wip(ssr): move ssr only utils to conditional export 2020-01-28 22:14:43 -05:00
Evan You 6f43c4b516 wip(ssr): vdom serialization 2020-01-28 18:48:27 -05:00
Evan You 27fbfbdb8b fix(runtime-core): render context set should not unwrap reactive values 2020-01-27 18:05:30 -05:00
Evan You 012bc5df9d wip(ssr): restructure 2020-01-27 17:23:42 -05:00
Evan You d293876c34 release: v3.0.0-alpha.4 2020-01-27 16:20:00 -05:00
Evan You 6b10f0cd1d refactor: remove implicit reactive() call on renderContext
reference: https://github.com/vuejs/rfcs/issues/121

BREAKING CHANGE: object returned from `setup()` are no longer implicitly
passed to `reactive()`.

  The renderContext is the object returned by `setup()` (or a new object
  if no setup() is present). Before this change, it was implicitly passed
  to `reactive()` for ref unwrapping. But this has the side effect of
  unnecessary deep reactive conversion on properties that should not be
  made reactive (e.g. computed return values and injected non-reactive
  objects), and can lead to performance issues.

  This change removes the `reactive()` call and instead performs a
  shallow ref unwrapping at the render proxy level. The breaking part is
  when the user returns an object with a plain property from `setup()`,
  e.g. `return { count: 0 }`, this property will no longer trigger
  updates when mutated by a in-template event handler. Instead, explicit
  refs are required.

  This also means that any objects not explicitly made reactive in
  `setup()` will remain non-reactive. This can be desirable when
  exposing heavy external stateful objects on `this`.
2020-01-27 16:00:18 -05:00
Evan You 2884831065 fix(runtime-core): instance should not expose non-declared props 2020-01-27 16:00:18 -05:00
Evan You 066ba82c7f wip(ssr): escape helpers 2020-01-27 16:00:18 -05:00
Evan You 297282a812 perf(ssr): avoid unnecessary async overhead 2020-01-27 16:00:17 -05:00
Evan You 25a0d4a65f wip(ssr): reduce reactivity overhead during ssr 2020-01-27 16:00:17 -05:00
Evan You cee36ad028 wip(ssr): render real components 2020-01-27 16:00:17 -05:00
Evan You da25517377 wip(ssr): initial work on server-renderer 2020-01-27 16:00:17 -05:00
Evan You c07751fd36 refactor: adjust `createApp` related API signatures
BREAKING CHANGE: `createApp` API has been adjusted.

  - `createApp()` now accepts the root component, and optionally a props
  object to pass to the root component.
  - `app.mount()` now accepts a single argument (the root container)
  - `app.unmount()` no longer requires arguments.

  New behavior looks like the following:

  ``` js
  const app = createApp(RootComponent)
  app.mount('#app')
  app.unmount()
  ```
2020-01-27 16:00:17 -05:00
Evan You 2837ce8428 fix(v-model/emit): update:camelCase events should trigger kebab case equivalent
close #656
2020-01-26 14:14:03 -05:00
Evan You b41677bf42 release: v3.0.0-alpha.3 2020-01-22 11:10:30 -05:00
likui ec63623fe8 fix: Suspense should include into dynamic children (#653)
fix #649
2020-01-22 10:45:27 -05:00
Evan You 2569890e31 refactor: move mockWarn utility to @vue/shared
close #652
2020-01-22 09:29:45 -05:00
Evan You 4f06eebc1c fix(dom): fix <svg> and <foreignObject> mount and updates 2020-01-21 11:32:33 -05:00
Evan You 035b6560f7 fix(runtime-core): isSVG check should also apply for patch branch
fix #639
2020-01-20 11:55:18 -05:00
Evan You e81c8a32c7 feat(runtime-core): emit now returns array of return values from all triggered handlers
close #635
2020-01-20 11:24:08 -05:00
Rustin 787ac5f74e test(runtime-core): modify test case to set different value (#620) 2020-01-20 09:43:58 -05:00
Evan You 751d838fb9 fix(runtime-core): should not warn unused attrs when accessed via setup context
close #625
2020-01-16 17:45:08 -05:00
Evan You c35fea3d60 fix(runtime-core): condition for parent node check should be any different nodes
fix #622
2020-01-16 16:21:37 -05:00
likui 04ac6c467a feat(runtime-core): support app.unmount(container) (#601)
close #593
2020-01-16 12:23:47 -05:00
Sören Schwert 1081ef8089 chore: fix error reporting URL to point to vue-next (#624) [ci skip] 2020-01-15 21:50:06 -05:00
Evan You 9f65d811af release: v3.0.0-alpha.2 2020-01-13 17:44:30 -05:00
Evan You 2e9726e6a2 fix(runtime-core/renderer): fix v-if toggle inside blocks
Should check both branches for parent container access.
Fix #604. Close #607.
2020-01-13 17:31:22 -05:00
Cédric Exbrayat 74baea108a fix(types): components options should accept components defined with defineComponent (#602) 2020-01-13 17:12:45 -05:00
Yang Mingshan f465199946 types: fix setup this type (#605) 2020-01-10 11:46:34 -05:00
Kael 8f616a89c5 fix(runtime-core): allow classes to be passed as plugins (#588) 2020-01-08 12:40:24 -05:00
Yang Mingshan 453e6889da fix(watch): remove recorded effect on manual stop (#590) 2020-01-08 12:06:16 -05:00
Evan You bb6a346996 fix(runtime-core): should preserve props casing when component has no declared props
close #583
2020-01-06 15:05:57 -05:00
Evan You 84dc5a6862 fix(runtime-core/vnode): should not render boolean values in vnode children (close #574) 2020-01-06 11:57:19 -05:00
Evan You 1bb1271b5e release: v3.0.0-alpha.1 2020-01-02 18:25:17 -05:00
Evan You bfb0ad5a5e types: refactor watcher types naming 2019-12-30 11:30:12 -05:00
likui a7ef59c4c3 test(vnode): add test for dynamic children (#563) 2019-12-30 11:25:44 -05:00
Yang Mingshan 3980ad65de types: exports watch api types (#562) 2019-12-30 11:19:57 -05:00
Evan You 7df5e70c83 types: accept defineComponent return types in app.mount 2019-12-24 11:04:44 -05:00
宋铄运 4d20981eb0 fix(runtime-core): pass options to plugins (#561) 2019-12-24 10:33:47 -05:00