vue 2.6.13 → 2.7.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/README.md +17 -295
  2. package/compiler-sfc/index.d.ts +1 -0
  3. package/compiler-sfc/index.js +1 -0
  4. package/compiler-sfc/index.mjs +1 -0
  5. package/compiler-sfc/package.json +5 -0
  6. package/dist/vue.common.dev.js +11481 -11946
  7. package/dist/vue.common.prod.js +8 -3
  8. package/dist/vue.esm.browser.js +11321 -12011
  9. package/dist/vue.esm.browser.min.js +8 -3
  10. package/dist/vue.esm.js +11476 -11984
  11. package/dist/vue.js +11484 -11949
  12. package/dist/vue.min.js +8 -3
  13. package/dist/vue.runtime.common.dev.js +8427 -8421
  14. package/dist/vue.runtime.common.prod.js +8 -3
  15. package/dist/vue.runtime.esm.js +8436 -8454
  16. package/dist/vue.runtime.js +8430 -8424
  17. package/dist/vue.runtime.min.js +8 -3
  18. package/package.json +88 -111
  19. package/packages/compiler-sfc/dist/compiler-sfc.js +7 -0
  20. package/packages/compiler-sfc/node_modules/.bin/parser +17 -0
  21. package/packages/compiler-sfc/node_modules/.bin/sass +17 -0
  22. package/packages/compiler-sfc/package.json +30 -0
  23. package/src/compiler/{codeframe.js → codeframe.ts} +9 -7
  24. package/src/compiler/codegen/{events.js → events.ts} +21 -41
  25. package/src/compiler/codegen/{index.js → index.ts} +146 -136
  26. package/src/compiler/{create-compiler.js → create-compiler.ts} +26 -18
  27. package/src/compiler/directives/bind.ts +9 -0
  28. package/src/compiler/directives/{index.js → index.ts} +0 -2
  29. package/src/compiler/directives/{model.js → model.ts} +15 -18
  30. package/src/compiler/directives/{on.js → on.ts} +3 -4
  31. package/src/compiler/{error-detector.js → error-detector.ts} +61 -31
  32. package/src/compiler/{helpers.js → helpers.ts} +73 -61
  33. package/src/compiler/{index.js → index.ts} +2 -3
  34. package/src/compiler/{optimizer.js → optimizer.ts} +30 -23
  35. package/src/compiler/parser/{entity-decoder.js → entity-decoder.ts} +1 -3
  36. package/src/compiler/parser/{filter-parser.js → filter-parser.ts} +43 -24
  37. package/src/compiler/parser/{html-parser.js → html-parser.ts} +50 -29
  38. package/src/compiler/parser/{index.js → index.ts} +190 -172
  39. package/src/compiler/parser/{text-parser.js → text-parser.ts} +8 -9
  40. package/src/compiler/{to-function.js → to-function.ts} +27 -22
  41. package/src/core/components/{index.js → index.ts} +0 -0
  42. package/src/core/components/{keep-alive.js → keep-alive.ts} +42 -30
  43. package/src/core/{config.js → config.ts} +28 -30
  44. package/src/core/global-api/{assets.js → assets.ts} +8 -7
  45. package/src/core/global-api/{extend.js → extend.ts} +10 -13
  46. package/src/core/global-api/{index.js → index.ts} +4 -5
  47. package/src/core/global-api/{mixin.js → mixin.ts} +2 -3
  48. package/src/core/global-api/use.ts +23 -0
  49. package/src/core/{index.js → index.ts} +1 -1
  50. package/src/core/instance/{events.js → events.ts} +41 -24
  51. package/src/core/instance/{index.js → index.ts} +9 -5
  52. package/src/core/instance/{init.js → init.ts} +26 -15
  53. package/src/core/instance/inject.ts +72 -0
  54. package/src/core/instance/{lifecycle.js → lifecycle.ts} +86 -44
  55. package/src/core/instance/{proxy.js → proxy.ts} +29 -24
  56. package/src/core/instance/render-helpers/{bind-dynamic-keys.js → bind-dynamic-keys.ts} +6 -5
  57. package/src/core/instance/render-helpers/{bind-object-listeners.js → bind-object-listeners.ts} +4 -8
  58. package/src/core/instance/render-helpers/{bind-object-props.js → bind-object-props.ts} +12 -17
  59. package/src/core/instance/render-helpers/{check-keycodes.js → check-keycodes.ts} +5 -7
  60. package/src/core/instance/render-helpers/{index.js → index.ts} +1 -3
  61. package/src/core/instance/render-helpers/{render-list.js → render-list.ts} +12 -13
  62. package/src/core/instance/render-helpers/{render-slot.js → render-slot.ts} +10 -11
  63. package/src/core/instance/render-helpers/{render-static.js → render-static.ts} +7 -10
  64. package/src/core/instance/render-helpers/{resolve-filter.js → resolve-filter.ts} +1 -3
  65. package/src/core/instance/render-helpers/{resolve-scoped-slots.js → resolve-scoped-slots.ts} +11 -8
  66. package/src/core/instance/render-helpers/{resolve-slots.js → resolve-slots.ts} +12 -11
  67. package/src/core/instance/{render.js → render.ts} +66 -29
  68. package/src/core/instance/{state.js → state.ts} +100 -83
  69. package/src/core/observer/{array.js → array.ts} +11 -2
  70. package/src/core/observer/{dep.js → dep.ts} +37 -15
  71. package/src/core/observer/{index.js → index.ts} +137 -71
  72. package/src/core/observer/{scheduler.js → scheduler.ts} +42 -43
  73. package/src/core/observer/{traverse.js → traverse.ts} +10 -7
  74. package/src/core/observer/{watcher.js → watcher.ts} +88 -60
  75. package/src/core/util/{debug.js → debug.ts} +38 -34
  76. package/src/core/util/{env.js → env.ts} +27 -30
  77. package/src/core/util/{error.js → error.ts} +12 -14
  78. package/src/core/util/{index.js → index.ts} +0 -2
  79. package/src/core/util/{lang.js → lang.ts} +6 -7
  80. package/src/core/util/{next-tick.js → next-tick.ts} +16 -10
  81. package/src/core/util/{options.js → options.ts} +119 -114
  82. package/src/core/util/{perf.js → perf.ts} +5 -1
  83. package/src/core/util/{props.js → props.ts} +54 -50
  84. package/src/core/vdom/{create-component.js → create-component.ts} +51 -50
  85. package/src/core/vdom/{create-element.js → create-element.ts} +49 -43
  86. package/src/core/vdom/{create-functional-component.js → create-functional-component.ts} +52 -27
  87. package/src/core/vdom/helpers/{extract-props.js → extract-props.ts} +18 -18
  88. package/src/core/vdom/helpers/{get-first-component-child.js → get-first-component-child.ts} +6 -5
  89. package/src/core/vdom/helpers/{index.js → index.ts} +0 -2
  90. package/src/core/vdom/helpers/is-async-placeholder.ts +6 -0
  91. package/src/core/vdom/helpers/{merge-hook.js → merge-hook.ts} +7 -5
  92. package/src/core/vdom/helpers/{normalize-children.js → normalize-children.ts} +26 -16
  93. package/src/core/vdom/helpers/{normalize-scoped-slots.js → normalize-scoped-slots.ts} +23 -17
  94. package/src/core/vdom/helpers/{resolve-async-component.js → resolve-async-component.ts} +29 -37
  95. package/src/core/vdom/helpers/update-listeners.ts +101 -0
  96. package/src/core/vdom/modules/{directives.js → directives.ts} +20 -14
  97. package/src/core/vdom/modules/index.ts +4 -0
  98. package/src/core/vdom/modules/template-ref.ts +96 -0
  99. package/src/core/vdom/{patch.js → patch.ts} +239 -138
  100. package/src/core/vdom/{vnode.js → vnode.ts} +36 -31
  101. package/src/global.d.ts +15 -0
  102. package/src/platforms/web/compiler/directives/html.ts +8 -0
  103. package/src/platforms/web/compiler/directives/{index.js → index.ts} +0 -0
  104. package/src/platforms/web/compiler/directives/{model.js → model.ts} +47 -41
  105. package/src/platforms/web/compiler/directives/{text.js → text.ts} +2 -3
  106. package/src/platforms/web/compiler/{index.js → index.ts} +0 -2
  107. package/src/platforms/web/compiler/modules/{class.js → class.ts} +10 -15
  108. package/src/platforms/web/compiler/modules/{index.js → index.ts} +1 -5
  109. package/src/platforms/web/compiler/modules/{model.js → model.ts} +6 -11
  110. package/src/platforms/web/compiler/modules/{style.js → style.ts} +9 -14
  111. package/src/platforms/web/compiler/{options.js → options.ts} +1 -2
  112. package/src/platforms/web/compiler/{util.js → util.ts} +5 -7
  113. package/src/platforms/web/entry-compiler-sfc.ts +1 -0
  114. package/src/platforms/web/{entry-compiler.js → entry-compiler.ts} +1 -3
  115. package/src/platforms/web/{entry-runtime.js → entry-runtime-esm.ts} +2 -2
  116. package/src/platforms/web/entry-runtime-with-compiler-esm.ts +5 -0
  117. package/src/platforms/web/entry-runtime-with-compiler.ts +10 -0
  118. package/src/platforms/web/entry-runtime.ts +7 -0
  119. package/src/platforms/web/runtime/{class-util.js → class-util.ts} +2 -4
  120. package/src/platforms/web/runtime/components/{index.js → index.ts} +0 -0
  121. package/src/platforms/web/runtime/components/{transition-group.js → transition-group.ts} +59 -46
  122. package/src/platforms/web/runtime/components/{transition.js → transition.ts} +43 -36
  123. package/src/platforms/web/runtime/directives/{index.js → index.ts} +0 -0
  124. package/src/platforms/web/runtime/directives/{model.js → model.ts} +22 -21
  125. package/src/platforms/web/runtime/directives/{show.js → show.ts} +11 -10
  126. package/src/platforms/web/runtime/{index.js → index.ts} +9 -10
  127. package/src/platforms/web/runtime/modules/{attrs.js → attrs.ts} +12 -16
  128. package/src/platforms/web/runtime/modules/{class.js → class.ts} +7 -18
  129. package/src/platforms/web/runtime/modules/{dom-props.js → dom-props.ts} +24 -17
  130. package/src/platforms/web/runtime/modules/{events.js → events.ts} +22 -15
  131. package/src/platforms/web/runtime/modules/{index.js → index.ts} +1 -8
  132. package/src/platforms/web/runtime/modules/{style.js → style.ts} +24 -13
  133. package/src/platforms/web/runtime/modules/{transition.js → transition.ts} +61 -63
  134. package/src/platforms/web/runtime/node-ops.ts +66 -0
  135. package/src/platforms/web/runtime/{patch.js → patch.ts} +0 -2
  136. package/src/platforms/web/runtime/{transition-util.js → transition-util.ts} +63 -38
  137. package/src/platforms/web/{entry-runtime-with-compiler.js → runtime-with-compiler.ts} +28 -19
  138. package/src/platforms/web/util/{attrs.js → attrs.ts} +18 -14
  139. package/src/platforms/web/util/{class.js → class.ts} +23 -21
  140. package/src/platforms/web/util/{compat.js → compat.ts} +4 -4
  141. package/src/platforms/web/util/{element.js → element.ts} +21 -22
  142. package/src/platforms/web/util/{index.js → index.ts} +2 -6
  143. package/src/platforms/web/util/{style.js → style.ts} +12 -12
  144. package/src/sfc/{parser.js → parser.ts} +18 -15
  145. package/src/shared/{constants.js → constants.ts} +2 -6
  146. package/src/shared/{util.js → util.ts} +78 -55
  147. package/src/types/compiler.ts +224 -0
  148. package/src/types/component.ts +209 -0
  149. package/src/types/global-api.ts +37 -0
  150. package/src/types/modules.d.ts +15 -0
  151. package/src/types/options.ts +120 -0
  152. package/src/types/ssr.ts +27 -0
  153. package/src/types/utils.ts +3 -0
  154. package/src/types/vnode.ts +127 -0
  155. package/src/v3/apiInject.ts +66 -0
  156. package/src/v3/apiLifecycle.ts +53 -0
  157. package/src/v3/apiSetup.ts +161 -0
  158. package/src/v3/apiWatch.ts +355 -0
  159. package/src/v3/currentInstance.ts +23 -0
  160. package/src/v3/debug.ts +21 -0
  161. package/src/v3/h.ts +18 -0
  162. package/src/v3/index.ts +77 -0
  163. package/src/v3/reactivity/computed.ts +100 -0
  164. package/src/v3/reactivity/effect.ts +20 -0
  165. package/src/v3/reactivity/effectScope.ts +134 -0
  166. package/src/v3/reactivity/operations.ts +14 -0
  167. package/src/v3/reactivity/reactive.ts +123 -0
  168. package/src/v3/reactivity/readonly.ts +121 -0
  169. package/src/v3/reactivity/ref.ts +249 -0
  170. package/types/index.d.ts +10 -13
  171. package/types/options.d.ts +265 -132
  172. package/types/plugin.d.ts +4 -4
  173. package/types/umd.d.ts +47 -27
  174. package/types/v3-generated.d.ts +389 -0
  175. package/types/v3.d.ts +16 -0
  176. package/types/vnode.d.ts +70 -57
  177. package/types/vue.d.ts +292 -88
  178. package/dist/README.md +0 -122
  179. package/src/compiler/directives/bind.js +0 -11
  180. package/src/core/global-api/use.js +0 -23
  181. package/src/core/instance/inject.js +0 -73
  182. package/src/core/vdom/helpers/is-async-placeholder.js +0 -5
  183. package/src/core/vdom/helpers/update-listeners.js +0 -95
  184. package/src/core/vdom/modules/index.js +0 -7
  185. package/src/core/vdom/modules/ref.js +0 -45
  186. package/src/platforms/web/compiler/directives/html.js +0 -9
  187. package/src/platforms/web/entry-server-basic-renderer.js +0 -13
  188. package/src/platforms/web/entry-server-renderer.js +0 -27
  189. package/src/platforms/web/runtime/node-ops.js +0 -59
  190. package/src/platforms/web/server/compiler.js +0 -11
  191. package/src/platforms/web/server/directives/index.js +0 -7
  192. package/src/platforms/web/server/directives/model.js +0 -44
  193. package/src/platforms/web/server/directives/show.js +0 -12
  194. package/src/platforms/web/server/modules/attrs.js +0 -67
  195. package/src/platforms/web/server/modules/class.js +0 -11
  196. package/src/platforms/web/server/modules/dom-props.js +0 -50
  197. package/src/platforms/web/server/modules/index.js +0 -11
  198. package/src/platforms/web/server/modules/style.js +0 -41
  199. package/src/platforms/web/server/util.js +0 -101
  200. package/src/platforms/weex/compiler/directives/index.js +0 -5
  201. package/src/platforms/weex/compiler/directives/model.js +0 -33
  202. package/src/platforms/weex/compiler/index.js +0 -52
  203. package/src/platforms/weex/compiler/modules/append.js +0 -27
  204. package/src/platforms/weex/compiler/modules/class.js +0 -74
  205. package/src/platforms/weex/compiler/modules/index.js +0 -13
  206. package/src/platforms/weex/compiler/modules/props.js +0 -37
  207. package/src/platforms/weex/compiler/modules/recycle-list/component-root.js +0 -13
  208. package/src/platforms/weex/compiler/modules/recycle-list/component.js +0 -16
  209. package/src/platforms/weex/compiler/modules/recycle-list/index.js +0 -60
  210. package/src/platforms/weex/compiler/modules/recycle-list/recycle-list.js +0 -50
  211. package/src/platforms/weex/compiler/modules/recycle-list/text.js +0 -23
  212. package/src/platforms/weex/compiler/modules/recycle-list/v-bind.js +0 -21
  213. package/src/platforms/weex/compiler/modules/recycle-list/v-for.js +0 -33
  214. package/src/platforms/weex/compiler/modules/recycle-list/v-if.js +0 -63
  215. package/src/platforms/weex/compiler/modules/recycle-list/v-on.js +0 -25
  216. package/src/platforms/weex/compiler/modules/recycle-list/v-once.js +0 -19
  217. package/src/platforms/weex/compiler/modules/style.js +0 -87
  218. package/src/platforms/weex/entry-compiler.js +0 -2
  219. package/src/platforms/weex/entry-framework.js +0 -187
  220. package/src/platforms/weex/entry-runtime-factory.js +0 -6
  221. package/src/platforms/weex/runtime/components/index.js +0 -9
  222. package/src/platforms/weex/runtime/components/richtext.js +0 -82
  223. package/src/platforms/weex/runtime/components/transition-group.js +0 -148
  224. package/src/platforms/weex/runtime/components/transition.js +0 -9
  225. package/src/platforms/weex/runtime/directives/index.js +0 -2
  226. package/src/platforms/weex/runtime/index.js +0 -42
  227. package/src/platforms/weex/runtime/modules/attrs.js +0 -44
  228. package/src/platforms/weex/runtime/modules/class.js +0 -76
  229. package/src/platforms/weex/runtime/modules/events.js +0 -54
  230. package/src/platforms/weex/runtime/modules/index.js +0 -13
  231. package/src/platforms/weex/runtime/modules/style.js +0 -84
  232. package/src/platforms/weex/runtime/modules/transition.js +0 -270
  233. package/src/platforms/weex/runtime/node-ops.js +0 -91
  234. package/src/platforms/weex/runtime/patch.js +0 -16
  235. package/src/platforms/weex/runtime/recycle-list/render-component-template.js +0 -34
  236. package/src/platforms/weex/runtime/recycle-list/virtual-component.js +0 -136
  237. package/src/platforms/weex/runtime/text-node.js +0 -9
  238. package/src/platforms/weex/util/element.js +0 -52
  239. package/src/platforms/weex/util/index.js +0 -40
  240. package/src/platforms/weex/util/parser.js +0 -60
  241. package/src/server/bundle-renderer/create-bundle-renderer.js +0 -151
  242. package/src/server/bundle-renderer/create-bundle-runner.js +0 -150
  243. package/src/server/bundle-renderer/source-map-support.js +0 -45
  244. package/src/server/create-basic-renderer.js +0 -37
  245. package/src/server/create-renderer.js +0 -152
  246. package/src/server/optimizing-compiler/codegen.js +0 -264
  247. package/src/server/optimizing-compiler/index.js +0 -20
  248. package/src/server/optimizing-compiler/modules.js +0 -124
  249. package/src/server/optimizing-compiler/optimizer.js +0 -141
  250. package/src/server/optimizing-compiler/runtime-helpers.js +0 -150
  251. package/src/server/render-context.js +0 -130
  252. package/src/server/render-stream.js +0 -95
  253. package/src/server/render.js +0 -437
  254. package/src/server/template-renderer/create-async-file-mapper.js +0 -57
  255. package/src/server/template-renderer/index.js +0 -277
  256. package/src/server/template-renderer/parse-template.js +0 -42
  257. package/src/server/template-renderer/template-stream.js +0 -82
  258. package/src/server/util.js +0 -18
  259. package/src/server/webpack-plugin/client.js +0 -65
  260. package/src/server/webpack-plugin/server.js +0 -66
  261. package/src/server/webpack-plugin/util.js +0 -34
  262. package/src/server/write.js +0 -50
@@ -0,0 +1,389 @@
1
+ declare type ASTModifiers = {
2
+ [key: string]: boolean;
3
+ };
4
+
5
+ declare type BaseTypes = string | number | boolean;
6
+
7
+ declare type Builtin = Primitive | Function | Date | Error | RegExp;
8
+
9
+ declare type CollectionTypes = IterableCollections | WeakCollections;
10
+
11
+ /* Excluded from this release type: Component */
12
+
13
+ /* Excluded from this release type: ComponentOptions */
14
+
15
+ export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
16
+
17
+ export declare function computed<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions): WritableComputedRef<T>;
18
+
19
+ export declare type ComputedGetter<T> = (...args: any[]) => T;
20
+
21
+ export declare interface ComputedRef<T = any> extends WritableComputedRef<T> {
22
+ readonly value: T;
23
+ [ComputedRefSymbol]: true;
24
+ }
25
+
26
+ declare const ComputedRefSymbol: unique symbol;
27
+
28
+ export declare type ComputedSetter<T> = (v: T) => void;
29
+
30
+ /* Excluded from this release type: Config */
31
+
32
+ export declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
33
+
34
+ export declare type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
35
+ get: () => T;
36
+ set: (value: T) => void;
37
+ };
38
+
39
+ export declare type DebuggerEvent = {
40
+ /* Excluded from this release type: effect */
41
+ } & DebuggerEventExtraInfo;
42
+
43
+ export declare type DebuggerEventExtraInfo = {
44
+ target: object;
45
+ type: TrackOpTypes | TriggerOpTypes;
46
+ key?: any;
47
+ newValue?: any;
48
+ oldValue?: any;
49
+ };
50
+
51
+ export declare interface DebuggerOptions {
52
+ onTrack?: (event: DebuggerEvent) => void;
53
+ onTrigger?: (event: DebuggerEvent) => void;
54
+ }
55
+
56
+ export declare type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends WeakSet<infer U> ? WeakSet<DeepReadonly<U>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends Ref<infer U> ? Readonly<Ref<DeepReadonly<U>>> : T extends {} ? {
57
+ readonly [K in keyof T]: DeepReadonly<T[K]>;
58
+ } : Readonly<T>;
59
+
60
+ /**
61
+ * Delete a property and trigger change if necessary.
62
+ */
63
+ export declare function del<T>(array: T[], key: number): void;
64
+
65
+ export declare function del(object: object, key: string | number): void;
66
+
67
+ /* Excluded from this release type: Dep */
68
+
69
+ /* Excluded from this release type: DepTarget */
70
+
71
+ export declare class EffectScope {
72
+ /* Excluded from this release type: active */
73
+ /* Excluded from this release type: effects */
74
+ /* Excluded from this release type: cleanups */
75
+ /* Excluded from this release type: parent */
76
+ /* Excluded from this release type: scopes */
77
+ /* Excluded from this release type: index */
78
+ constructor(detached?: boolean);
79
+ run<T>(fn: () => T): T | undefined;
80
+ /* Excluded from this release type: on */
81
+ /* Excluded from this release type: off */
82
+ stop(fromParent?: boolean): void;
83
+ }
84
+
85
+ export declare function effectScope(detached?: boolean): EffectScope;
86
+
87
+ /* Excluded from this release type: getCurrentInstance */
88
+
89
+ export declare function getCurrentScope(): EffectScope | undefined;
90
+
91
+ /* Excluded from this release type: GlobalAPI */
92
+
93
+ /* Excluded from this release type: h */
94
+
95
+ declare type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
96
+
97
+ export declare function inject<T>(key: InjectionKey<T> | string): T | undefined;
98
+
99
+ export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T, treatDefaultAsFactory?: false): T;
100
+
101
+ export declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T | (() => T), treatDefaultAsFactory: true): T;
102
+
103
+ export declare interface InjectionKey<T> extends Symbol {
104
+ }
105
+
106
+ declare type InjectKey = string | Symbol;
107
+
108
+ export declare function isProxy(value: unknown): boolean;
109
+
110
+ export declare function isReactive(value: unknown): boolean;
111
+
112
+ export declare function isReadonly(value: unknown): boolean;
113
+
114
+ export declare function isRef<T>(r: Ref<T> | unknown): r is Ref<T>;
115
+
116
+ export declare function isShallow(value: unknown): boolean;
117
+
118
+ declare type IterableCollections = Map<any, any> | Set<any>;
119
+
120
+ declare type MapSources<T, Immediate> = {
121
+ [K in keyof T]: T[K] extends WatchSource<infer V> ? Immediate extends true ? V | undefined : V : T[K] extends object ? Immediate extends true ? T[K] | undefined : T[K] : never;
122
+ };
123
+
124
+ export declare function markRaw<T extends object>(value: T): T & {
125
+ [RawSymbol]?: true;
126
+ };
127
+
128
+ declare type MultiWatchSources = (WatchSource<unknown> | object)[];
129
+
130
+ export declare function nextTick(): Promise<void>;
131
+
132
+ export declare function nextTick(cb: (...args: any[]) => any, ctx?: object): void;
133
+
134
+ export declare const onActivated: (fn: () => void, target?: any) => void;
135
+
136
+ export declare const onBeforeMount: (fn: () => void, target?: any) => void;
137
+
138
+ export declare const onBeforeUnmount: (fn: () => void, target?: any) => void;
139
+
140
+ export declare const onBeforeUpdate: (fn: () => void, target?: any) => void;
141
+
142
+ declare type OnCleanup = (cleanupFn: () => void) => void;
143
+
144
+ export declare const onDeactivated: (fn: () => void, target?: any) => void;
145
+
146
+ export declare const onErrorCaptured: (fn: () => void, target?: any) => void;
147
+
148
+ export declare const onMounted: (fn: () => void, target?: any) => void;
149
+
150
+ export declare const onRenderTracked: (fn: (e: DebuggerEvent) => any, target?: any) => void;
151
+
152
+ export declare const onRenderTriggered: (fn: (e: DebuggerEvent) => any, target?: any) => void;
153
+
154
+ export declare function onScopeDispose(fn: () => void): void;
155
+
156
+ export declare const onServerPrefetch: (fn: () => void, target?: any) => void;
157
+
158
+ export declare const onUnmounted: (fn: () => void, target?: any) => void;
159
+
160
+ export declare const onUpdated: (fn: () => void, target?: any) => void;
161
+
162
+ declare type Primitive = string | number | boolean | bigint | symbol | undefined | null;
163
+
164
+ declare type PropOptions = {
165
+ type: Function | Array<Function> | null;
166
+ default: any;
167
+ required: boolean | null;
168
+ validator: Function | null;
169
+ };
170
+
171
+ export declare function provide<T>(key: InjectionKey<T> | string | number, value: T): void;
172
+
173
+ declare const RawSymbol: unique symbol;
174
+
175
+ export declare function reactive<T extends object>(target: T): UnwrapNestedRefs<T>;
176
+
177
+ export declare const enum ReactiveFlags {
178
+ SKIP = "__v_skip",
179
+ IS_READONLY = "__v_isReadonly",
180
+ IS_SHALLOW = "__v_isShallow",
181
+ RAW = "__v_raw"
182
+ }
183
+
184
+ export declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>;
185
+
186
+ export declare interface Ref<T = any> {
187
+ value: T;
188
+ /**
189
+ * Type differentiator only.
190
+ * We need this to be in public d.ts but don't want it to show up in IDE
191
+ * autocomplete, so we use a private Symbol instead.
192
+ */
193
+ [RefSymbol]: true;
194
+ /* Excluded from this release type: dep */
195
+ /* Excluded from this release type: __v_isRef */
196
+ }
197
+
198
+ export declare function ref<T extends object>(value: T): [T] extends [Ref] ? T : Ref<UnwrapRef<T>>;
199
+
200
+ export declare function ref<T>(value: T): Ref<UnwrapRef<T>>;
201
+
202
+ export declare function ref<T = any>(): Ref<T | undefined>;
203
+
204
+ /* Excluded from this release type: RefFlag */
205
+
206
+ declare const RefSymbol: unique symbol;
207
+
208
+ /**
209
+ * This is a special exported interface for other packages to declare
210
+ * additional types that should bail out for ref unwrapping. For example
211
+ * \@vue/runtime-dom can declare it like so in its d.ts:
212
+ *
213
+ * ``` ts
214
+ * declare module 'vue' {
215
+ * export interface RefUnwrapBailTypes {
216
+ * runtimeDOMBailTypes: Node | Window
217
+ * }
218
+ * }
219
+ * ```
220
+ *
221
+ * Note that api-extractor somehow refuses to include `declare module`
222
+ * augmentations in its generated d.ts, so we have to manually append them
223
+ * to the final generated d.ts in our build process.
224
+ */
225
+ export declare interface RefUnwrapBailTypes {
226
+ runtimeDOMBailTypes: Node | Window;
227
+ }
228
+
229
+ /* Excluded from this release type: ScopedSlotsData */
230
+
231
+ /**
232
+ * Set a property on an object. Adds the new property and
233
+ * triggers change notification if the property doesn't
234
+ * already exist.
235
+ */
236
+ export declare function set<T>(array: T[], key: number, value: T): T;
237
+
238
+ export declare function set<T>(object: object, key: string | number, value: T): T;
239
+
240
+ /* Excluded from this release type: SetupContext */
241
+
242
+ export declare type ShallowReactive<T> = T & {
243
+ [ShallowReactiveMarker]?: true;
244
+ };
245
+
246
+ /**
247
+ * Return a shallowly-reactive copy of the original object, where only the root
248
+ * level properties are reactive. It also does not auto-unwrap refs (even at the
249
+ * root level).
250
+ */
251
+ export declare function shallowReactive<T extends object>(target: T): ShallowReactive<T>;
252
+
253
+ declare const ShallowReactiveMarker: unique symbol;
254
+
255
+ /**
256
+ * Returns a reactive-copy of the original object, where only the root level
257
+ * properties are readonly, and does NOT unwrap refs nor recursively convert
258
+ * returned properties.
259
+ * This is used for creating the props proxy object for stateful components.
260
+ */
261
+ export declare function shallowReadonly<T extends object>(target: T): Readonly<T>;
262
+
263
+ export declare type ShallowRef<T = any> = Ref<T> & {
264
+ [ShallowRefMarker]?: true;
265
+ };
266
+
267
+ export declare function shallowRef<T extends object>(value: T): T extends Ref ? T : ShallowRef<T>;
268
+
269
+ export declare function shallowRef<T>(value: T): ShallowRef<T>;
270
+
271
+ export declare function shallowRef<T = any>(): ShallowRef<T | undefined>;
272
+
273
+ declare const ShallowRefMarker: unique symbol;
274
+
275
+ export declare type ShallowUnwrapRef<T> = {
276
+ [K in keyof T]: T[K] extends Ref<infer V> ? V : T[K] extends Ref<infer V> | undefined ? unknown extends V ? undefined : V | undefined : T[K];
277
+ };
278
+
279
+ declare interface SimpleSet {
280
+ has(key: string | number): boolean;
281
+ add(key: string | number): any;
282
+ clear(): void;
283
+ }
284
+
285
+ export declare function toRaw<T>(observed: T): T;
286
+
287
+ export declare type ToRef<T> = IfAny<T, Ref<T>, [T] extends [Ref] ? T : Ref<T>>;
288
+
289
+ export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
290
+
291
+ export declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
292
+
293
+ export declare type ToRefs<T = any> = {
294
+ [K in keyof T]: ToRef<T[K]>;
295
+ };
296
+
297
+ export declare function toRefs<T extends object>(object: T): ToRefs<T>;
298
+
299
+ export declare const enum TrackOpTypes {
300
+ GET = "get",
301
+ TOUCH = "touch"
302
+ }
303
+
304
+ export declare const enum TriggerOpTypes {
305
+ SET = "set",
306
+ ADD = "add",
307
+ DELETE = "delete",
308
+ ARRAY_MUTATION = "array mutation"
309
+ }
310
+
311
+ export declare function triggerRef(ref: Ref): void;
312
+
313
+ export declare function unref<T>(ref: T | Ref<T>): T;
314
+
315
+ export declare type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
316
+
317
+ export declare type UnwrapRef<T> = T extends ShallowRef<infer V> ? V : T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
318
+
319
+ declare type UnwrapRefSimple<T> = T extends Function | CollectionTypes | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
320
+ [RawSymbol]?: true;
321
+ } ? T : T extends Array<any> ? {
322
+ [K in keyof T]: UnwrapRefSimple<T[K]>;
323
+ } : T extends object & {
324
+ [ShallowReactiveMarker]?: never;
325
+ } ? {
326
+ [P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
327
+ } : T;
328
+
329
+ /* Excluded from this release type: useAttrs */
330
+
331
+ /* Excluded from this release type: useSlots */
332
+
333
+ /* Excluded from this release type: VNode */
334
+
335
+ /* Excluded from this release type: VNodeChildren */
336
+
337
+ /* Excluded from this release type: VNodeComponentOptions */
338
+
339
+ /* Excluded from this release type: VNodeData */
340
+
341
+ /* Excluded from this release type: VNodeDirective */
342
+
343
+ export declare function watch<T extends MultiWatchSources, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
344
+
345
+ export declare function watch<T extends Readonly<MultiWatchSources>, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
346
+
347
+ export declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
348
+
349
+ export declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
350
+
351
+ export declare type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
352
+
353
+ export declare type WatchEffect = (onCleanup: OnCleanup) => void;
354
+
355
+ export declare function watchEffect(effect: WatchEffect, options?: WatchOptionsBase): WatchStopHandle;
356
+
357
+ /* Excluded from this release type: Watcher */
358
+
359
+ /* Excluded from this release type: WatcherOptions */
360
+
361
+ export declare interface WatchOptions<Immediate = boolean> extends WatchOptionsBase {
362
+ immediate?: Immediate;
363
+ deep?: boolean;
364
+ }
365
+
366
+ export declare interface WatchOptionsBase extends DebuggerOptions {
367
+ flush?: 'pre' | 'post' | 'sync';
368
+ }
369
+
370
+ export declare function watchPostEffect(effect: WatchEffect, options?: DebuggerOptions): WatchStopHandle;
371
+
372
+ export declare type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T);
373
+
374
+ export declare type WatchStopHandle = () => void;
375
+
376
+ export declare function watchSyncEffect(effect: WatchEffect, options?: DebuggerOptions): WatchStopHandle;
377
+
378
+ declare type WeakCollections = WeakMap<any, any> | WeakSet<any>;
379
+
380
+ export declare interface WritableComputedOptions<T> {
381
+ get: ComputedGetter<T>;
382
+ set: ComputedSetter<T>;
383
+ }
384
+
385
+ export declare interface WritableComputedRef<T> extends Ref<T> {
386
+ readonly effect: any;
387
+ }
388
+
389
+ export { }
package/types/v3.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { VNode } from './vnode'
2
+ import { CreateElement, Vue } from './vue'
3
+
4
+ export interface SetupContext {
5
+ attrs: Record<string, any>
6
+ slots: Record<string, (() => VNode[]) | undefined>
7
+ emit: (event: string, ...args: any[]) => any
8
+ }
9
+
10
+ export function getCurrentInstance(): { proxy: Vue } | null
11
+
12
+ export const h: CreateElement
13
+
14
+ export function useAttrs(): SetupContext['attrs']
15
+
16
+ export function useSlots(): SetupContext['slots']
package/types/vnode.d.ts CHANGED
@@ -1,76 +1,89 @@
1
- import { Vue } from "./vue";
1
+ import { Vue } from './vue'
2
2
 
3
- export type ScopedSlot = (props: any) => ScopedSlotReturnValue;
4
- type ScopedSlotReturnValue = VNode | string | boolean | null | undefined | ScopedSlotReturnArray;
3
+ export type ScopedSlot = (props: any) => ScopedSlotReturnValue
4
+ type ScopedSlotReturnValue =
5
+ | VNode
6
+ | string
7
+ | boolean
8
+ | null
9
+ | undefined
10
+ | ScopedSlotReturnArray
5
11
  interface ScopedSlotReturnArray extends Array<ScopedSlotReturnValue> {}
6
12
 
7
13
  // Scoped slots are guaranteed to return Array of VNodes starting in 2.6
8
- export type NormalizedScopedSlot = (props: any) => ScopedSlotChildren;
9
- export type ScopedSlotChildren = VNode[] | undefined;
14
+ export type NormalizedScopedSlot = (props: any) => ScopedSlotChildren
15
+ export type ScopedSlotChildren = VNode[] | undefined
10
16
 
11
17
  // Relaxed type compatible with $createElement
12
- export type VNodeChildren = VNodeChildrenArrayContents | [ScopedSlot] | string | boolean | null | undefined;
13
- export interface VNodeChildrenArrayContents extends Array<VNodeChildren | VNode> {}
18
+ export type VNodeChildren =
19
+ | VNodeChildrenArrayContents
20
+ | [ScopedSlot]
21
+ | string
22
+ | boolean
23
+ | null
24
+ | undefined
25
+ export interface VNodeChildrenArrayContents
26
+ extends Array<VNodeChildren | VNode> {}
14
27
 
15
28
  export interface VNode {
16
- tag?: string;
17
- data?: VNodeData;
18
- children?: VNode[];
19
- text?: string;
20
- elm?: Node;
21
- ns?: string;
22
- context?: Vue;
23
- key?: string | number | symbol | boolean;
24
- componentOptions?: VNodeComponentOptions;
25
- componentInstance?: Vue;
26
- parent?: VNode;
27
- raw?: boolean;
28
- isStatic?: boolean;
29
- isRootInsert: boolean;
30
- isComment: boolean;
29
+ tag?: string
30
+ data?: VNodeData
31
+ children?: VNode[]
32
+ text?: string
33
+ elm?: Node
34
+ ns?: string
35
+ context?: Vue
36
+ key?: string | number | symbol | boolean
37
+ componentOptions?: VNodeComponentOptions
38
+ componentInstance?: Vue
39
+ parent?: VNode
40
+ raw?: boolean
41
+ isStatic?: boolean
42
+ isRootInsert: boolean
43
+ isComment: boolean
31
44
  }
32
45
 
33
46
  export interface VNodeComponentOptions {
34
- Ctor: typeof Vue;
35
- propsData?: object;
36
- listeners?: object;
37
- children?: VNode[];
38
- tag?: string;
47
+ Ctor: typeof Vue
48
+ propsData?: object
49
+ listeners?: object
50
+ children?: VNode[]
51
+ tag?: string
39
52
  }
40
53
 
41
54
  export interface VNodeData {
42
- key?: string | number;
43
- slot?: string;
44
- scopedSlots?: { [key: string]: ScopedSlot | undefined };
45
- ref?: string;
46
- refInFor?: boolean;
47
- tag?: string;
48
- staticClass?: string;
49
- class?: any;
50
- staticStyle?: { [key: string]: any };
51
- style?: string | object[] | object;
52
- props?: { [key: string]: any };
53
- attrs?: { [key: string]: any };
54
- domProps?: { [key: string]: any };
55
- hook?: { [key: string]: Function };
56
- on?: { [key: string]: Function | Function[] };
57
- nativeOn?: { [key: string]: Function | Function[] };
58
- transition?: object;
59
- show?: boolean;
55
+ key?: string | number
56
+ slot?: string
57
+ scopedSlots?: { [key: string]: ScopedSlot | undefined }
58
+ ref?: string
59
+ refInFor?: boolean
60
+ tag?: string
61
+ staticClass?: string
62
+ class?: any
63
+ staticStyle?: { [key: string]: any }
64
+ style?: string | object[] | object
65
+ props?: { [key: string]: any }
66
+ attrs?: { [key: string]: any }
67
+ domProps?: { [key: string]: any }
68
+ hook?: { [key: string]: Function }
69
+ on?: { [key: string]: Function | Function[] }
70
+ nativeOn?: { [key: string]: Function | Function[] }
71
+ transition?: object
72
+ show?: boolean
60
73
  inlineTemplate?: {
61
- render: Function;
62
- staticRenderFns: Function[];
63
- };
64
- directives?: VNodeDirective[];
65
- keepAlive?: boolean;
74
+ render: Function
75
+ staticRenderFns: Function[]
76
+ }
77
+ directives?: VNodeDirective[]
78
+ keepAlive?: boolean
66
79
  }
67
80
 
68
81
  export interface VNodeDirective {
69
- name: string;
70
- value?: any;
71
- oldValue?: any;
72
- expression?: string;
73
- arg?: string;
74
- oldArg?: string;
75
- modifiers?: { [key: string]: boolean };
82
+ name: string
83
+ value?: any
84
+ oldValue?: any
85
+ expression?: string
86
+ arg?: string
87
+ oldArg?: string
88
+ modifiers?: { [key: string]: boolean }
76
89
  }