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
package/types/vue.d.ts CHANGED
@@ -10,123 +10,327 @@ import {
10
10
  RecordPropsDefinition,
11
11
  ThisTypedComponentOptionsWithArrayProps,
12
12
  ThisTypedComponentOptionsWithRecordProps,
13
- WatchOptions,
14
- } from "./options";
15
- import { VNode, VNodeData, VNodeChildren, NormalizedScopedSlot } from "./vnode";
16
- import { PluginFunction, PluginObject } from "./plugin";
13
+ WatchOptions
14
+ } from './options'
15
+ import { VNode, VNodeData, VNodeChildren, NormalizedScopedSlot } from './vnode'
16
+ import { PluginFunction, PluginObject } from './plugin'
17
17
 
18
18
  export interface CreateElement {
19
- (tag?: string | Component<any, any, any, any> | AsyncComponent<any, any, any, any> | (() => Component), children?: VNodeChildren): VNode;
20
- (tag?: string | Component<any, any, any, any> | AsyncComponent<any, any, any, any> | (() => Component), data?: VNodeData, children?: VNodeChildren): VNode;
19
+ (
20
+ tag?:
21
+ | string
22
+ | Component<any, any, any, any>
23
+ | AsyncComponent<any, any, any, any>
24
+ | (() => Component),
25
+ children?: VNodeChildren
26
+ ): VNode
27
+ (
28
+ tag?:
29
+ | string
30
+ | Component<any, any, any, any>
31
+ | AsyncComponent<any, any, any, any>
32
+ | (() => Component),
33
+ data?: VNodeData,
34
+ children?: VNodeChildren
35
+ ): VNode
21
36
  }
22
37
 
23
38
  export interface Vue {
24
- readonly $el: Element;
25
- readonly $options: ComponentOptions<Vue>;
26
- readonly $parent: Vue;
27
- readonly $root: Vue;
28
- readonly $children: Vue[];
29
- readonly $refs: { [key: string]: Vue | Element | (Vue | Element)[] | undefined };
30
- readonly $slots: { [key: string]: VNode[] | undefined };
31
- readonly $scopedSlots: { [key: string]: NormalizedScopedSlot | undefined };
32
- readonly $isServer: boolean;
33
- readonly $data: Record<string, any>;
34
- readonly $props: Record<string, any>;
35
- readonly $ssrContext: any;
36
- readonly $vnode: VNode;
37
- readonly $attrs: Record<string, string>;
38
- readonly $listeners: Record<string, Function | Function[]>;
39
-
40
- $mount(elementOrSelector?: Element | string, hydrating?: boolean): this;
41
- $forceUpdate(): void;
42
- $destroy(): void;
43
- $set: typeof Vue.set;
44
- $delete: typeof Vue.delete;
39
+ readonly $el: Element
40
+ readonly $options: ComponentOptions<Vue>
41
+ readonly $parent: Vue
42
+ readonly $root: Vue
43
+ readonly $children: Vue[]
44
+ readonly $refs: {
45
+ [key: string]: Vue | Element | (Vue | Element)[] | undefined
46
+ }
47
+ readonly $slots: { [key: string]: VNode[] | undefined }
48
+ readonly $scopedSlots: { [key: string]: NormalizedScopedSlot | undefined }
49
+ readonly $isServer: boolean
50
+ readonly $data: Record<string, any>
51
+ readonly $props: Record<string, any>
52
+ readonly $ssrContext: any
53
+ readonly $vnode: VNode
54
+ readonly $attrs: Record<string, string>
55
+ readonly $listeners: Record<string, Function | Function[]>
56
+
57
+ $mount(elementOrSelector?: Element | string, hydrating?: boolean): this
58
+ $forceUpdate(): void
59
+ $destroy(): void
60
+ $set: typeof Vue.set
61
+ $delete: typeof Vue.delete
45
62
  $watch(
46
63
  expOrFn: string,
47
64
  callback: (this: this, n: any, o: any) => void,
48
65
  options?: WatchOptions
49
- ): (() => void);
66
+ ): () => void
50
67
  $watch<T>(
51
68
  expOrFn: (this: this) => T,
52
69
  callback: (this: this, n: T, o: T) => void,
53
70
  options?: WatchOptions
54
- ): (() => void);
55
- $on(event: string | string[], callback: Function): this;
56
- $once(event: string | string[], callback: Function): this;
57
- $off(event?: string | string[], callback?: Function): this;
58
- $emit(event: string, ...args: any[]): this;
59
- $nextTick(callback: (this: this) => void): void;
60
- $nextTick(): Promise<void>;
61
- $createElement: CreateElement;
71
+ ): () => void
72
+ $on(event: string | string[], callback: Function): this
73
+ $once(event: string | string[], callback: Function): this
74
+ $off(event?: string | string[], callback?: Function): this
75
+ $emit(event: string, ...args: any[]): this
76
+ $nextTick(callback: (this: this) => void): void
77
+ $nextTick(): Promise<void>
78
+ $createElement: CreateElement
62
79
  }
63
80
 
64
- export type CombinedVueInstance<Instance extends Vue, Data, Methods, Computed, Props> = Data & Methods & Computed & Props & Instance;
65
- export type ExtendedVue<Instance extends Vue, Data, Methods, Computed, Props> = VueConstructor<CombinedVueInstance<Instance, Data, Methods, Computed, Props> & Vue>;
81
+ export type CombinedVueInstance<
82
+ Instance extends Vue,
83
+ Data,
84
+ Methods,
85
+ Computed,
86
+ Props,
87
+ SetupBindings
88
+ > = Data & Methods & Computed & Props & Instance & SetupBindings
89
+
90
+ export type ExtendedVue<
91
+ Instance extends Vue,
92
+ Data,
93
+ Methods,
94
+ Computed,
95
+ Props,
96
+ SetupBindings
97
+ > = VueConstructor<
98
+ CombinedVueInstance<Instance, Data, Methods, Computed, Props, SetupBindings> &
99
+ Vue
100
+ >
66
101
 
67
102
  export interface VueConfiguration {
68
- silent: boolean;
69
- optionMergeStrategies: any;
70
- devtools: boolean;
71
- productionTip: boolean;
72
- performance: boolean;
73
- errorHandler(err: Error, vm: Vue, info: string): void;
74
- warnHandler(msg: string, vm: Vue, trace: string): void;
75
- ignoredElements: (string | RegExp)[];
76
- keyCodes: { [key: string]: number | number[] };
77
- async: boolean;
103
+ silent: boolean
104
+ optionMergeStrategies: any
105
+ devtools: boolean
106
+ productionTip: boolean
107
+ performance: boolean
108
+ errorHandler(err: Error, vm: Vue, info: string): void
109
+ warnHandler(msg: string, vm: Vue, trace: string): void
110
+ ignoredElements: (string | RegExp)[]
111
+ keyCodes: { [key: string]: number | number[] }
112
+ async: boolean
78
113
  }
79
114
 
80
115
  export interface VueConstructor<V extends Vue = Vue> {
81
- new <Data = object, Methods = object, Computed = object, PropNames extends string = never>(options?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames>): CombinedVueInstance<V, Data, Methods, Computed, Record<PropNames, any>>;
82
- // ideally, the return type should just contain Props, not Record<keyof Props, any>. But TS requires to have Base constructors with the same return type.
83
- new <Data = object, Methods = object, Computed = object, Props = object>(options?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props>): CombinedVueInstance<V, Data, Methods, Computed, Record<keyof Props, any>>;
84
- new (options?: ComponentOptions<V>): CombinedVueInstance<V, object, object, object, Record<keyof object, any>>;
85
-
86
- extend<Data, Methods, Computed, PropNames extends string = never>(options?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames>): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>;
87
- extend<Data, Methods, Computed, Props>(options?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
88
- extend<PropNames extends string = never>(definition: FunctionalComponentOptions<Record<PropNames, any>, PropNames[]>): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>>;
89
- extend<Props>(definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>>): ExtendedVue<V, {}, {}, {}, Props>;
90
- extend(options?: ComponentOptions<V>): ExtendedVue<V, {}, {}, {}, {}>;
91
-
92
- nextTick<T>(callback: (this: T) => void, context?: T): void;
116
+ /**
117
+ * new with array props
118
+ */
119
+ new <
120
+ Data = object,
121
+ Methods = object,
122
+ Computed = object,
123
+ PropNames extends string = never,
124
+ SetupBindings = {}
125
+ >(
126
+ options?: ThisTypedComponentOptionsWithArrayProps<
127
+ V,
128
+ Data,
129
+ Methods,
130
+ Computed,
131
+ PropNames,
132
+ SetupBindings
133
+ >
134
+ ): CombinedVueInstance<
135
+ V,
136
+ Data,
137
+ Methods,
138
+ Computed,
139
+ Record<PropNames, any>,
140
+ SetupBindings
141
+ >
142
+
143
+ /**
144
+ * new with object props
145
+ * ideally, the return type should just contain Props,
146
+ * not Record<keyof Props, any>. But TS requires to have Base constructors
147
+ * with the same return type.
148
+ */
149
+ new <
150
+ Data = object,
151
+ Methods = object,
152
+ Computed = object,
153
+ Props = object,
154
+ SetupBindings = {}
155
+ >(
156
+ options?: ThisTypedComponentOptionsWithRecordProps<
157
+ V,
158
+ Data,
159
+ Methods,
160
+ Computed,
161
+ Props,
162
+ SetupBindings
163
+ >
164
+ ): CombinedVueInstance<
165
+ V,
166
+ Data,
167
+ Methods,
168
+ Computed,
169
+ Record<keyof Props, any>,
170
+ SetupBindings
171
+ >
172
+
173
+ /**
174
+ * new with no props
175
+ */
176
+ new (options?: ComponentOptions<V>): CombinedVueInstance<
177
+ V,
178
+ object,
179
+ object,
180
+ object,
181
+ Record<keyof object, any>,
182
+ {}
183
+ >
184
+
185
+ /**
186
+ * extend with array props
187
+ */
188
+ extend<
189
+ Data,
190
+ Methods,
191
+ Computed,
192
+ PropNames extends string = never,
193
+ SetupBindings = {}
194
+ >(
195
+ options?: ThisTypedComponentOptionsWithArrayProps<
196
+ V,
197
+ Data,
198
+ Methods,
199
+ Computed,
200
+ PropNames,
201
+ SetupBindings
202
+ >
203
+ ): ExtendedVue<
204
+ V,
205
+ Data,
206
+ Methods,
207
+ Computed,
208
+ Record<PropNames, any>,
209
+ SetupBindings
210
+ >
211
+
212
+ /**
213
+ * extend with object props
214
+ */
215
+ extend<Data, Methods, Computed, Props, SetupBindings = {}>(
216
+ options?: ThisTypedComponentOptionsWithRecordProps<
217
+ V,
218
+ Data,
219
+ Methods,
220
+ Computed,
221
+ Props,
222
+ SetupBindings
223
+ >
224
+ ): ExtendedVue<V, Data, Methods, Computed, Props, SetupBindings>
225
+
226
+ /**
227
+ * extend with functional + array props
228
+ */
229
+ extend<PropNames extends string = never>(
230
+ definition: FunctionalComponentOptions<Record<PropNames, any>, PropNames[]>
231
+ ): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>, {}>
232
+
233
+ /**
234
+ * extend with functional + object props
235
+ */
236
+ extend<Props>(
237
+ definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>>
238
+ ): ExtendedVue<V, {}, {}, {}, Props, {}>
239
+
240
+ /**
241
+ * extend with no props
242
+ */
243
+ extend(options?: ComponentOptions<V>): ExtendedVue<V, {}, {}, {}, {}, {}>
244
+
245
+ nextTick<T>(callback: (this: T) => void, context?: T): void
93
246
  nextTick(): Promise<void>
94
- set<T>(object: object, key: string | number, value: T): T;
95
- set<T>(array: T[], key: number, value: T): T;
96
- delete(object: object, key: string | number): void;
97
- delete<T>(array: T[], key: number): void;
247
+ set<T>(object: object, key: string | number, value: T): T
248
+ set<T>(array: T[], key: number, value: T): T
249
+ delete(object: object, key: string | number): void
250
+ delete<T>(array: T[], key: number): void
98
251
 
99
252
  directive(
100
253
  id: string,
101
254
  definition?: DirectiveOptions | DirectiveFunction
102
- ): DirectiveOptions;
103
- filter(id: string, definition?: Function): Function;
104
-
105
- component(id: string): VueConstructor;
106
- component<VC extends VueConstructor>(id: string, constructor: VC): VC;
107
- component<Data, Methods, Computed, Props>(id: string, definition: AsyncComponent<Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
108
- component<Data, Methods, Computed, PropNames extends string = never>(id: string, definition?: ThisTypedComponentOptionsWithArrayProps<V, Data, Methods, Computed, PropNames>): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>;
109
- component<Data, Methods, Computed, Props>(id: string, definition?: ThisTypedComponentOptionsWithRecordProps<V, Data, Methods, Computed, Props>): ExtendedVue<V, Data, Methods, Computed, Props>;
110
- component<PropNames extends string>(id: string, definition: FunctionalComponentOptions<Record<PropNames, any>, PropNames[]>): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>>;
111
- component<Props>(id: string, definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>>): ExtendedVue<V, {}, {}, {}, Props>;
112
- component(id: string, definition?: ComponentOptions<V>): ExtendedVue<V, {}, {}, {}, {}>;
113
-
114
- use<T>(plugin: PluginObject<T> | PluginFunction<T>, options?: T): VueConstructor<V>;
115
- use(plugin: PluginObject<any> | PluginFunction<any>, ...options: any[]): VueConstructor<V>;
116
- mixin(mixin: VueConstructor | ComponentOptions<Vue>): VueConstructor<V>;
255
+ ): DirectiveOptions
256
+ filter(id: string, definition?: Function): Function
257
+
258
+ component(id: string): VueConstructor
259
+ component<VC extends VueConstructor>(id: string, constructor: VC): VC
260
+ component<Data, Methods, Computed, Props, SetupBindings>(
261
+ id: string,
262
+ definition: AsyncComponent<Data, Methods, Computed, Props>
263
+ ): ExtendedVue<V, Data, Methods, Computed, Props, SetupBindings>
264
+ component<
265
+ Data,
266
+ Methods,
267
+ Computed,
268
+ PropNames extends string = never,
269
+ SetupBindings = {}
270
+ >(
271
+ id: string,
272
+ definition?: ThisTypedComponentOptionsWithArrayProps<
273
+ V,
274
+ Data,
275
+ Methods,
276
+ Computed,
277
+ PropNames,
278
+ SetupBindings
279
+ >
280
+ ): ExtendedVue<
281
+ V,
282
+ Data,
283
+ Methods,
284
+ Computed,
285
+ Record<PropNames, any>,
286
+ SetupBindings
287
+ >
288
+ component<Data, Methods, Computed, Props, SetupBindings>(
289
+ id: string,
290
+ definition?: ThisTypedComponentOptionsWithRecordProps<
291
+ V,
292
+ Data,
293
+ Methods,
294
+ Computed,
295
+ Props,
296
+ SetupBindings
297
+ >
298
+ ): ExtendedVue<V, Data, Methods, Computed, Props, SetupBindings>
299
+ component<PropNames extends string>(
300
+ id: string,
301
+ definition: FunctionalComponentOptions<Record<PropNames, any>, PropNames[]>
302
+ ): ExtendedVue<V, {}, {}, {}, Record<PropNames, any>, {}>
303
+ component<Props>(
304
+ id: string,
305
+ definition: FunctionalComponentOptions<Props, RecordPropsDefinition<Props>>
306
+ ): ExtendedVue<V, {}, {}, {}, Props, {}>
307
+ component(
308
+ id: string,
309
+ definition?: ComponentOptions<V>
310
+ ): ExtendedVue<V, {}, {}, {}, {}, {}>
311
+
312
+ use<T>(
313
+ plugin: PluginObject<T> | PluginFunction<T>,
314
+ options?: T
315
+ ): VueConstructor<V>
316
+ use(
317
+ plugin: PluginObject<any> | PluginFunction<any>,
318
+ ...options: any[]
319
+ ): VueConstructor<V>
320
+ mixin(mixin: VueConstructor | ComponentOptions<Vue>): VueConstructor<V>
117
321
  compile(template: string): {
118
- render(createElement: typeof Vue.prototype.$createElement): VNode;
119
- staticRenderFns: (() => VNode)[];
120
- };
322
+ render(createElement: typeof Vue.prototype.$createElement): VNode
323
+ staticRenderFns: (() => VNode)[]
324
+ }
121
325
 
122
- observable<T>(obj: T): T;
326
+ observable<T>(obj: T): T
123
327
 
124
328
  util: {
125
- warn(msg: string, vm?: InstanceType<VueConstructor>): void;
126
- };
329
+ warn(msg: string, vm?: InstanceType<VueConstructor>): void
330
+ }
127
331
 
128
- config: VueConfiguration;
129
- version: string;
332
+ config: VueConfiguration
333
+ version: string
130
334
  }
131
335
 
132
- export const Vue: VueConstructor;
336
+ export const Vue: VueConstructor
package/dist/README.md DELETED
@@ -1,122 +0,0 @@
1
- ## Explanation of Build Files
2
-
3
- | | UMD | CommonJS | ES Module |
4
- | --- | --- | --- | --- |
5
- | **Full** | vue.js | vue.common.js | vue.esm.js |
6
- | **Runtime-only** | vue.runtime.js | vue.runtime.common.js | vue.runtime.esm.js |
7
- | **Full (production)** | vue.min.js | | |
8
- | **Runtime-only (production)** | vue.runtime.min.js | | |
9
-
10
- ### Terms
11
-
12
- - **Full**: builds that contain both the compiler and the runtime.
13
-
14
- - **Compiler**: code that is responsible for compiling template strings into JavaScript render functions.
15
-
16
- - **Runtime**: code that is responsible for creating Vue instances, rendering and patching virtual DOM, etc. Basically everything minus the compiler.
17
-
18
- - **[UMD](https://github.com/umdjs/umd)**: UMD builds can be used directly in the browser via a `<script>` tag. The default file from Unpkg CDN at [https://unpkg.com/vue](https://unpkg.com/vue) is the Runtime + Compiler UMD build (`vue.js`).
19
-
20
- - **[CommonJS](http://wiki.commonjs.org/wiki/Modules/1.1)**: CommonJS builds are intended for use with older bundlers like [browserify](http://browserify.org/) or [webpack 1](https://webpack.github.io). The default file for these bundlers (`pkg.main`) is the Runtime only CommonJS build (`vue.runtime.common.js`).
21
-
22
- - **[ES Module](http://exploringjs.com/es6/ch_modules.html)**: ES module builds are intended for use with modern bundlers like [webpack 2](https://webpack.js.org) or [rollup](http://rollupjs.org/). The default file for these bundlers (`pkg.module`) is the Runtime only ES Module build (`vue.runtime.esm.js`).
23
-
24
- ### Runtime + Compiler vs. Runtime-only
25
-
26
- If you need to compile templates on the fly (e.g. passing a string to the `template` option, or mounting to an element using its in-DOM HTML as the template), you will need the compiler and thus the full build.
27
-
28
- When using `vue-loader` or `vueify`, templates inside `*.vue` files are compiled into JavaScript at build time. You don't really need the compiler in the final bundle, and can therefore, use the runtime-only build.
29
-
30
- Since the runtime-only builds are roughly 30% lighter-weight than their full-build counterparts, you should use it whenever you can. If you wish to use the full build instead, you need to configure an alias in your bundler.
31
-
32
- #### Webpack
33
-
34
- ``` js
35
- module.exports = {
36
- // ...
37
- resolve: {
38
- alias: {
39
- 'vue$': 'vue/dist/vue.esm.js' // 'vue/dist/vue.common.js' for webpack 1
40
- }
41
- }
42
- }
43
- ```
44
-
45
- #### Rollup
46
-
47
- ``` js
48
- const alias = require('rollup-plugin-alias')
49
-
50
- rollup({
51
- // ...
52
- plugins: [
53
- alias({
54
- 'vue': 'vue/dist/vue.esm.js'
55
- })
56
- ]
57
- })
58
- ```
59
-
60
- #### Browserify
61
-
62
- Add to your project's `package.json`:
63
-
64
- ``` js
65
- {
66
- // ...
67
- "browser": {
68
- "vue": "vue/dist/vue.common.js"
69
- }
70
- }
71
- ```
72
-
73
- ### Development vs. Production Mode
74
-
75
- Development/production modes are hard-coded for the UMD builds: the un-minified files are for development, and the minified files are for production.
76
-
77
- CommonJS and ES Module builds are intended for bundlers, therefore we don't provide minified versions for them. You will be responsible for minifying the final bundle yourself.
78
-
79
- CommonJS and ES Module builds also preserve raw checks for `process.env.NODE_ENV` to determine the mode they should run in. You should use appropriate bundler configurations to replace these environment variables in order to control which mode Vue will run in. Replacing `process.env.NODE_ENV` with string literals also allows minifiers like UglifyJS to completely drop the development-only code blocks, reducing final file size.
80
-
81
- #### Webpack
82
-
83
- Use Webpack's [DefinePlugin](https://webpack.js.org/plugins/define-plugin/):
84
-
85
- ``` js
86
- var webpack = require('webpack')
87
-
88
- module.exports = {
89
- // ...
90
- plugins: [
91
- // ...
92
- new webpack.DefinePlugin({
93
- 'process.env.NODE_ENV': JSON.stringify('production')
94
- })
95
- ]
96
- }
97
- ```
98
-
99
- #### Rollup
100
-
101
- Use [rollup-plugin-replace](https://github.com/rollup/rollup-plugin-replace):
102
-
103
- ``` js
104
- const replace = require('rollup-plugin-replace')
105
-
106
- rollup({
107
- // ...
108
- plugins: [
109
- replace({
110
- 'process.env.NODE_ENV': JSON.stringify('production')
111
- })
112
- ]
113
- }).then(...)
114
- ```
115
-
116
- #### Browserify
117
-
118
- Apply a global [envify](https://github.com/hughsk/envify) transform to your bundle.
119
-
120
- ``` bash
121
- NODE_ENV=production browserify -g envify -e main.js | uglifyjs -c -m > build.js
122
- ```
@@ -1,11 +0,0 @@
1
- /* @flow */
2
-
3
- export default function bind (el: ASTElement, dir: ASTDirective) {
4
- el.wrapData = (code: string) => {
5
- return `_b(${code},'${el.tag}',${dir.value},${
6
- dir.modifiers && dir.modifiers.prop ? 'true' : 'false'
7
- }${
8
- dir.modifiers && dir.modifiers.sync ? ',true' : ''
9
- })`
10
- }
11
- }
@@ -1,23 +0,0 @@
1
- /* @flow */
2
-
3
- import { toArray } from '../util/index'
4
-
5
- export function initUse (Vue: GlobalAPI) {
6
- Vue.use = function (plugin: Function | Object) {
7
- const installedPlugins = (this._installedPlugins || (this._installedPlugins = []))
8
- if (installedPlugins.indexOf(plugin) > -1) {
9
- return this
10
- }
11
-
12
- // additional parameters
13
- const args = toArray(arguments, 1)
14
- args.unshift(this)
15
- if (typeof plugin.install === 'function') {
16
- plugin.install.apply(plugin, args)
17
- } else if (typeof plugin === 'function') {
18
- plugin.apply(null, args)
19
- }
20
- installedPlugins.push(plugin)
21
- return this
22
- }
23
- }
@@ -1,73 +0,0 @@
1
- /* @flow */
2
-
3
- import { hasOwn } from 'shared/util'
4
- import { warn, hasSymbol } from '../util/index'
5
- import { defineReactive, toggleObserving } from '../observer/index'
6
-
7
- export function initProvide (vm: Component) {
8
- const provide = vm.$options.provide
9
- if (provide) {
10
- vm._provided = typeof provide === 'function'
11
- ? provide.call(vm)
12
- : provide
13
- }
14
- }
15
-
16
- export function initInjections (vm: Component) {
17
- const result = resolveInject(vm.$options.inject, vm)
18
- if (result) {
19
- toggleObserving(false)
20
- Object.keys(result).forEach(key => {
21
- /* istanbul ignore else */
22
- if (process.env.NODE_ENV !== 'production') {
23
- defineReactive(vm, key, result[key], () => {
24
- warn(
25
- `Avoid mutating an injected value directly since the changes will be ` +
26
- `overwritten whenever the provided component re-renders. ` +
27
- `injection being mutated: "${key}"`,
28
- vm
29
- )
30
- })
31
- } else {
32
- defineReactive(vm, key, result[key])
33
- }
34
- })
35
- toggleObserving(true)
36
- }
37
- }
38
-
39
- export function resolveInject (inject: any, vm: Component): ?Object {
40
- if (inject) {
41
- // inject is :any because flow is not smart enough to figure out cached
42
- const result = Object.create(null)
43
- const keys = hasSymbol
44
- ? Reflect.ownKeys(inject)
45
- : Object.keys(inject)
46
-
47
- for (let i = 0; i < keys.length; i++) {
48
- const key = keys[i]
49
- // #6574 in case the inject object is observed...
50
- if (key === '__ob__') continue
51
- const provideKey = inject[key].from
52
- let source = vm
53
- while (source) {
54
- if (source._provided && hasOwn(source._provided, provideKey)) {
55
- result[key] = source._provided[provideKey]
56
- break
57
- }
58
- source = source.$parent
59
- }
60
- if (!source) {
61
- if ('default' in inject[key]) {
62
- const provideDefault = inject[key].default
63
- result[key] = typeof provideDefault === 'function'
64
- ? provideDefault.call(vm)
65
- : provideDefault
66
- } else if (process.env.NODE_ENV !== 'production') {
67
- warn(`Injection "${key}" not found`, vm)
68
- }
69
- }
70
- }
71
- return result
72
- }
73
- }
@@ -1,5 +0,0 @@
1
- /* @flow */
2
-
3
- export function isAsyncPlaceholder (node: VNode): boolean {
4
- return node.isComment && node.asyncFactory
5
- }