Commit Graph

196 Commits

Author SHA1 Message Date
Jackliu 42a99d28ae
chore: typo (#1113) 2020-05-04 10:30:24 +02:00
Evan You 6be2b73f8a fix(reactivity): check own property for existing proxy of target
fix #1107
2020-05-03 15:36:19 -04:00
XinPing Wang 8bab78b648 test: reactive proto 2020-05-03 15:36:19 -04:00
Evan You 0c48558f4c chore: remove commented stale code [ci skip] 2020-05-02 17:08:54 -04:00
Evan You 0dc44a6a86 release: v3.0.0-beta.7 2020-05-02 17:06:16 -04:00
Evan You d901b6bea8 refactor(reactivity): use more efficient reactive checks
WeakSets and WeakMaps shows degrading performance as the amount of
observed objects increases. Using hidden keys result in better
performance especially when repeatedly creating large amounts of
reactive proxies.

This also makes it possible to more efficiently declare non-reactive
objects in userland.
2020-05-02 16:58:17 -04:00
Evan You b570287dfe release: v3.0.0-beta.6 2020-05-01 18:56:53 -04:00
Evan You b40fcbc4c6 fix(types): augment ref unwrap bail types in appropriate packages
Packages can now augment the ref unwrap bail types in their own `d.ts`.
Also updated the build script to auto concat any files in a package's
`types` directory to the final generated `d.ts`.

- `@vue/reactivity` should no longer require `libs: ["DOM"]` in tsconfig
- Properly bail on `VNode` and `ComponentPublicInstance` in runtime-core
2020-05-01 16:14:30 -04:00
HiiTea 22717772dd
chore: fix typos (#1090) 2020-05-01 09:42:58 -04:00
Evan You c9bf7ded2e refactor(types): mark internal API exports and exclude from d.ts
BREAKING CHANGE: Internal APIs are now excluded from type decalrations.
2020-04-30 17:04:35 -04:00
Evan You a5bb1d02b7 release: v3.0.0-beta.5 2020-04-30 16:20:25 -04:00
Evan You 352c369704 chore: remove stale _isVue checks 2020-04-30 14:45:25 -04:00
Evan You d29aefcf99 release: v3.0.0-beta.4 2020-04-24 16:20:20 -04:00
Carlos Rodrigues 28b4c317b4
feat(types): expose `ToRefs` type (#1037) 2020-04-24 13:10:16 -04:00
susiwen8 ad2b940c17
chore: remove unnecessary export (#1044) [ci skip] 2020-04-24 13:02:44 -04:00
Evan You 2acf3e84b9 feat(reactivity): add triggerRef API
Also make shallowRef assignment behavior consistent with normal ref
2020-04-22 18:00:10 -04:00
Evan You b0d4df9743 perf(reactivity): ref should not trigger if value did not change
Note: shallowRef will always trigger on assignment because it does not
account for deep mutations

close #1012
2020-04-22 15:11:01 -04:00
Carlos Rodrigues 0bdd889156
fix(types): fix ref(false) type to Ref<boolean> (#1028) 2020-04-22 11:54:54 -04:00
Evan You 6fefeafe98 release: v3.0.0-beta.3 2020-04-20 17:00:26 -04:00
limichange fa40d1ef3a
refactor(reactivity): simplify if condition (#1002) 2020-04-20 13:39:35 -04:00
Evan You 218e6e1667 build: adjust build formats
- Rename `esm` to `esm-browser`
- Add runtime-only build for `esm-browser`
- Add default CDN alias for jsdelivr
2020-04-19 18:43:21 -04:00
Evan You c1a85cb124 release: v3.0.0-beta.2 2020-04-17 11:01:01 -04:00
Evan You ca6912554c release: v3.0.0-beta.1 2020-04-16 15:45:04 -04:00
Cédric Exbrayat 4d014dc3d3
fix(reactivity): remove Symbol.observable (#968)
* chore: add @types/node as an explicit dependency

As `tsconfig.json` references it, it should be listed in the dependencies.
It currently uses an older version: this commit also bumps to the latest v12 version, and fixes a typing issue.

* fix(reactivity): remove Symbol.observable

`Symbol.observable` is brought by `@types/node@12` and is not a "well-known" typescript symbol https://www.typescriptlang.org/docs/handbook/symbols.html that can be find in lib.es20xx like the others. It has been removed in `@types/node@v13`.
It means that an application using vue@3.0.0-alpha.13 does not compile unless it explicitely adds `@types/node@v12` as a dependency and `node` in its own tsconfig types.
2020-04-16 09:33:30 -04:00
Carlos Rodrigues d7ae1d0244
test(reactivity): add tests for object with symbols (#969) 2020-04-16 09:24:46 -04:00
Evan You 09b4202a22 refactor(reactivity): adjust APIs
BREAKING CHANGE: Reactivity APIs adjustments:

- `readonly` is now non-tracking if called on plain objects.
  `lock` and `unlock` have been removed. A `readonly` proxy can no
  longer be directly mutated. However, it can still wrap an already
  reactive object and track changes to the source reactive object.

- `isReactive` now only returns true for proxies created by `reactive`,
   or a `readonly` proxy that wraps a `reactive` proxy.

- A new utility `isProxy` is introduced, which returns true for both
  reactive or readonly proxies.

- `markNonReactive` has been renamed to `markRaw`.
2020-04-15 16:45:20 -04:00
Evan You 11654a6e50 release: v3.0.0-alpha.13 2020-04-15 12:46:26 -04:00
pikax 8a74260b70 types: remove tuple check and add type check for tuple 2020-04-15 16:22:44 +01:00
Carlos Rodrigues 70b55d797f
Apply suggestions from code review
Co-Authored-By: Evan You <yyx990803@gmail.com>
2020-04-15 16:07:07 +01:00
pikax dcb5985c00 Merge remote-tracking branch 'github/master' into changing_unwrap_ref 2020-04-15 15:54:26 +01:00
Evan You 3178504273 refactor(reactivity): make readonly non-tracking 2020-04-14 23:49:46 -04:00
Evan You 09b44e07cb refactor(reactivity): move array ref handling into getter 2020-04-14 22:18:58 -04:00
Evan You 486dc188fe feat(reactivity): add support for `toRef` API 2020-04-14 20:49:18 -04:00
Evan You b83c580131 feat(reactivity): add support for `customRef` API 2020-04-14 20:45:46 -04:00
Evan You 78977c3997 fix(scheduler): sort jobs before flushing
This fixes the case where a child component is added to the queue before
its parent, but should be invalidated by its parent's update. Same logic
was present in Vue 2.

Properly fixes #910
ref: https://github.com/vuejs/vue-next/issues/910#issuecomment-613097539
2020-04-14 17:31:35 -04:00
Evan You e8a866ec99 refactor(reactivity): remove stale API `markReadonly`
BREAKING CHANGE: `markReadonly` has been removed.
2020-04-13 17:39:48 -04:00
pikax 6a66b7b60a Merge remote-tracking branch 'github/master' into changing_unwrap_ref 2020-04-13 18:32:14 +01:00
Thorsten Lünborg 33ccfc0a8b
fix(types): UnwrapRef should bail on DOM element types (#952)
fix #951
2020-04-13 11:51:32 -04:00
pikax c20d8af8c0 types: add symbolExtract to extract all known symbols
#951
2020-04-12 11:45:56 +01:00
Evan You 1d9f8fc979 release: v3.0.0-alpha.12 2020-04-08 18:59:49 -04:00
pikax ab9add4f78 types: bring back my changes 2020-04-08 21:34:00 +01:00
ysj16 667e42065d
chore: typo (#928) 2020-04-06 09:09:44 -04:00
Evan You 5dcc645fc0 fix(reactivity): track reactive keys in raw collection types
Also warn against presence of both raw and reactive versions of the
same object in a collection as keys.

fix #919
2020-04-04 12:57:22 -04:00
Evan You 7402951d94 release: v3.0.0-alpha.11 2020-04-03 21:45:50 -04:00
Evan You f3b6559408 fix(types/reactivity): add generics constraint for markNonReactive
fix #917
2020-04-03 21:06:03 -04:00
Evan You 0764c33d3d fix(reactivity): scheduled effect should not execute if stopped
fix #910
2020-04-02 19:50:48 -04:00
Evan You de81faf00a release: v3.0.0-alpha.10 2020-03-24 18:33:40 -04:00
Evan You 45ba06ac5f fix(reactivity): should not trigger map keys iteration when keys did not change
fix #877
2020-03-24 12:43:06 -04:00
Evan You 1b2149dbb2 fix(reactivity): should not observe frozen objects
fix #867
2020-03-23 11:28:20 -04:00
Evan You b8c1be18f3 refactor(types): use stricter settings
fix #847
2020-03-23 11:08:22 -04:00