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.
- package/README.md +17 -295
- package/compiler-sfc/index.d.ts +1 -0
- package/compiler-sfc/index.js +1 -0
- package/compiler-sfc/index.mjs +1 -0
- package/compiler-sfc/package.json +5 -0
- package/dist/vue.common.dev.js +11481 -11946
- package/dist/vue.common.prod.js +8 -3
- package/dist/vue.esm.browser.js +11321 -12011
- package/dist/vue.esm.browser.min.js +8 -3
- package/dist/vue.esm.js +11476 -11984
- package/dist/vue.js +11484 -11949
- package/dist/vue.min.js +8 -3
- package/dist/vue.runtime.common.dev.js +8427 -8421
- package/dist/vue.runtime.common.prod.js +8 -3
- package/dist/vue.runtime.esm.js +8436 -8454
- package/dist/vue.runtime.js +8430 -8424
- package/dist/vue.runtime.min.js +8 -3
- package/package.json +88 -111
- package/packages/compiler-sfc/dist/compiler-sfc.js +7 -0
- package/packages/compiler-sfc/node_modules/.bin/parser +17 -0
- package/packages/compiler-sfc/node_modules/.bin/sass +17 -0
- package/packages/compiler-sfc/package.json +30 -0
- package/src/compiler/{codeframe.js → codeframe.ts} +9 -7
- package/src/compiler/codegen/{events.js → events.ts} +21 -41
- package/src/compiler/codegen/{index.js → index.ts} +146 -136
- package/src/compiler/{create-compiler.js → create-compiler.ts} +26 -18
- package/src/compiler/directives/bind.ts +9 -0
- package/src/compiler/directives/{index.js → index.ts} +0 -2
- package/src/compiler/directives/{model.js → model.ts} +15 -18
- package/src/compiler/directives/{on.js → on.ts} +3 -4
- package/src/compiler/{error-detector.js → error-detector.ts} +61 -31
- package/src/compiler/{helpers.js → helpers.ts} +73 -61
- package/src/compiler/{index.js → index.ts} +2 -3
- package/src/compiler/{optimizer.js → optimizer.ts} +30 -23
- package/src/compiler/parser/{entity-decoder.js → entity-decoder.ts} +1 -3
- package/src/compiler/parser/{filter-parser.js → filter-parser.ts} +43 -24
- package/src/compiler/parser/{html-parser.js → html-parser.ts} +50 -29
- package/src/compiler/parser/{index.js → index.ts} +190 -172
- package/src/compiler/parser/{text-parser.js → text-parser.ts} +8 -9
- package/src/compiler/{to-function.js → to-function.ts} +27 -22
- package/src/core/components/{index.js → index.ts} +0 -0
- package/src/core/components/{keep-alive.js → keep-alive.ts} +42 -30
- package/src/core/{config.js → config.ts} +28 -30
- package/src/core/global-api/{assets.js → assets.ts} +8 -7
- package/src/core/global-api/{extend.js → extend.ts} +10 -13
- package/src/core/global-api/{index.js → index.ts} +4 -5
- package/src/core/global-api/{mixin.js → mixin.ts} +2 -3
- package/src/core/global-api/use.ts +23 -0
- package/src/core/{index.js → index.ts} +1 -1
- package/src/core/instance/{events.js → events.ts} +41 -24
- package/src/core/instance/{index.js → index.ts} +9 -5
- package/src/core/instance/{init.js → init.ts} +26 -15
- package/src/core/instance/inject.ts +72 -0
- package/src/core/instance/{lifecycle.js → lifecycle.ts} +86 -44
- package/src/core/instance/{proxy.js → proxy.ts} +29 -24
- package/src/core/instance/render-helpers/{bind-dynamic-keys.js → bind-dynamic-keys.ts} +6 -5
- package/src/core/instance/render-helpers/{bind-object-listeners.js → bind-object-listeners.ts} +4 -8
- package/src/core/instance/render-helpers/{bind-object-props.js → bind-object-props.ts} +12 -17
- package/src/core/instance/render-helpers/{check-keycodes.js → check-keycodes.ts} +5 -7
- package/src/core/instance/render-helpers/{index.js → index.ts} +1 -3
- package/src/core/instance/render-helpers/{render-list.js → render-list.ts} +12 -13
- package/src/core/instance/render-helpers/{render-slot.js → render-slot.ts} +10 -11
- package/src/core/instance/render-helpers/{render-static.js → render-static.ts} +7 -10
- package/src/core/instance/render-helpers/{resolve-filter.js → resolve-filter.ts} +1 -3
- package/src/core/instance/render-helpers/{resolve-scoped-slots.js → resolve-scoped-slots.ts} +11 -8
- package/src/core/instance/render-helpers/{resolve-slots.js → resolve-slots.ts} +12 -11
- package/src/core/instance/{render.js → render.ts} +66 -29
- package/src/core/instance/{state.js → state.ts} +100 -83
- package/src/core/observer/{array.js → array.ts} +11 -2
- package/src/core/observer/{dep.js → dep.ts} +37 -15
- package/src/core/observer/{index.js → index.ts} +137 -71
- package/src/core/observer/{scheduler.js → scheduler.ts} +42 -43
- package/src/core/observer/{traverse.js → traverse.ts} +10 -7
- package/src/core/observer/{watcher.js → watcher.ts} +88 -60
- package/src/core/util/{debug.js → debug.ts} +38 -34
- package/src/core/util/{env.js → env.ts} +27 -30
- package/src/core/util/{error.js → error.ts} +12 -14
- package/src/core/util/{index.js → index.ts} +0 -2
- package/src/core/util/{lang.js → lang.ts} +6 -7
- package/src/core/util/{next-tick.js → next-tick.ts} +16 -10
- package/src/core/util/{options.js → options.ts} +119 -114
- package/src/core/util/{perf.js → perf.ts} +5 -1
- package/src/core/util/{props.js → props.ts} +54 -50
- package/src/core/vdom/{create-component.js → create-component.ts} +51 -50
- package/src/core/vdom/{create-element.js → create-element.ts} +49 -43
- package/src/core/vdom/{create-functional-component.js → create-functional-component.ts} +52 -27
- package/src/core/vdom/helpers/{extract-props.js → extract-props.ts} +18 -18
- package/src/core/vdom/helpers/{get-first-component-child.js → get-first-component-child.ts} +6 -5
- package/src/core/vdom/helpers/{index.js → index.ts} +0 -2
- package/src/core/vdom/helpers/is-async-placeholder.ts +6 -0
- package/src/core/vdom/helpers/{merge-hook.js → merge-hook.ts} +7 -5
- package/src/core/vdom/helpers/{normalize-children.js → normalize-children.ts} +26 -16
- package/src/core/vdom/helpers/{normalize-scoped-slots.js → normalize-scoped-slots.ts} +23 -17
- package/src/core/vdom/helpers/{resolve-async-component.js → resolve-async-component.ts} +29 -37
- package/src/core/vdom/helpers/update-listeners.ts +101 -0
- package/src/core/vdom/modules/{directives.js → directives.ts} +20 -14
- package/src/core/vdom/modules/index.ts +4 -0
- package/src/core/vdom/modules/template-ref.ts +96 -0
- package/src/core/vdom/{patch.js → patch.ts} +239 -138
- package/src/core/vdom/{vnode.js → vnode.ts} +36 -31
- package/src/global.d.ts +15 -0
- package/src/platforms/web/compiler/directives/html.ts +8 -0
- package/src/platforms/web/compiler/directives/{index.js → index.ts} +0 -0
- package/src/platforms/web/compiler/directives/{model.js → model.ts} +47 -41
- package/src/platforms/web/compiler/directives/{text.js → text.ts} +2 -3
- package/src/platforms/web/compiler/{index.js → index.ts} +0 -2
- package/src/platforms/web/compiler/modules/{class.js → class.ts} +10 -15
- package/src/platforms/web/compiler/modules/{index.js → index.ts} +1 -5
- package/src/platforms/web/compiler/modules/{model.js → model.ts} +6 -11
- package/src/platforms/web/compiler/modules/{style.js → style.ts} +9 -14
- package/src/platforms/web/compiler/{options.js → options.ts} +1 -2
- package/src/platforms/web/compiler/{util.js → util.ts} +5 -7
- package/src/platforms/web/entry-compiler-sfc.ts +1 -0
- package/src/platforms/web/{entry-compiler.js → entry-compiler.ts} +1 -3
- package/src/platforms/web/{entry-runtime.js → entry-runtime-esm.ts} +2 -2
- package/src/platforms/web/entry-runtime-with-compiler-esm.ts +5 -0
- package/src/platforms/web/entry-runtime-with-compiler.ts +10 -0
- package/src/platforms/web/entry-runtime.ts +7 -0
- package/src/platforms/web/runtime/{class-util.js → class-util.ts} +2 -4
- package/src/platforms/web/runtime/components/{index.js → index.ts} +0 -0
- package/src/platforms/web/runtime/components/{transition-group.js → transition-group.ts} +59 -46
- package/src/platforms/web/runtime/components/{transition.js → transition.ts} +43 -36
- package/src/platforms/web/runtime/directives/{index.js → index.ts} +0 -0
- package/src/platforms/web/runtime/directives/{model.js → model.ts} +22 -21
- package/src/platforms/web/runtime/directives/{show.js → show.ts} +11 -10
- package/src/platforms/web/runtime/{index.js → index.ts} +9 -10
- package/src/platforms/web/runtime/modules/{attrs.js → attrs.ts} +12 -16
- package/src/platforms/web/runtime/modules/{class.js → class.ts} +7 -18
- package/src/platforms/web/runtime/modules/{dom-props.js → dom-props.ts} +24 -17
- package/src/platforms/web/runtime/modules/{events.js → events.ts} +22 -15
- package/src/platforms/web/runtime/modules/{index.js → index.ts} +1 -8
- package/src/platforms/web/runtime/modules/{style.js → style.ts} +24 -13
- package/src/platforms/web/runtime/modules/{transition.js → transition.ts} +61 -63
- package/src/platforms/web/runtime/node-ops.ts +66 -0
- package/src/platforms/web/runtime/{patch.js → patch.ts} +0 -2
- package/src/platforms/web/runtime/{transition-util.js → transition-util.ts} +63 -38
- package/src/platforms/web/{entry-runtime-with-compiler.js → runtime-with-compiler.ts} +28 -19
- package/src/platforms/web/util/{attrs.js → attrs.ts} +18 -14
- package/src/platforms/web/util/{class.js → class.ts} +23 -21
- package/src/platforms/web/util/{compat.js → compat.ts} +4 -4
- package/src/platforms/web/util/{element.js → element.ts} +21 -22
- package/src/platforms/web/util/{index.js → index.ts} +2 -6
- package/src/platforms/web/util/{style.js → style.ts} +12 -12
- package/src/sfc/{parser.js → parser.ts} +18 -15
- package/src/shared/{constants.js → constants.ts} +2 -6
- package/src/shared/{util.js → util.ts} +78 -55
- package/src/types/compiler.ts +224 -0
- package/src/types/component.ts +209 -0
- package/src/types/global-api.ts +37 -0
- package/src/types/modules.d.ts +15 -0
- package/src/types/options.ts +120 -0
- package/src/types/ssr.ts +27 -0
- package/src/types/utils.ts +3 -0
- package/src/types/vnode.ts +127 -0
- package/src/v3/apiInject.ts +66 -0
- package/src/v3/apiLifecycle.ts +53 -0
- package/src/v3/apiSetup.ts +161 -0
- package/src/v3/apiWatch.ts +355 -0
- package/src/v3/currentInstance.ts +23 -0
- package/src/v3/debug.ts +21 -0
- package/src/v3/h.ts +18 -0
- package/src/v3/index.ts +77 -0
- package/src/v3/reactivity/computed.ts +100 -0
- package/src/v3/reactivity/effect.ts +20 -0
- package/src/v3/reactivity/effectScope.ts +134 -0
- package/src/v3/reactivity/operations.ts +14 -0
- package/src/v3/reactivity/reactive.ts +123 -0
- package/src/v3/reactivity/readonly.ts +121 -0
- package/src/v3/reactivity/ref.ts +249 -0
- package/types/index.d.ts +10 -13
- package/types/options.d.ts +265 -132
- package/types/plugin.d.ts +4 -4
- package/types/umd.d.ts +47 -27
- package/types/v3-generated.d.ts +389 -0
- package/types/v3.d.ts +16 -0
- package/types/vnode.d.ts +70 -57
- package/types/vue.d.ts +292 -88
- package/dist/README.md +0 -122
- package/src/compiler/directives/bind.js +0 -11
- package/src/core/global-api/use.js +0 -23
- package/src/core/instance/inject.js +0 -73
- package/src/core/vdom/helpers/is-async-placeholder.js +0 -5
- package/src/core/vdom/helpers/update-listeners.js +0 -95
- package/src/core/vdom/modules/index.js +0 -7
- package/src/core/vdom/modules/ref.js +0 -45
- package/src/platforms/web/compiler/directives/html.js +0 -9
- package/src/platforms/web/entry-server-basic-renderer.js +0 -13
- package/src/platforms/web/entry-server-renderer.js +0 -27
- package/src/platforms/web/runtime/node-ops.js +0 -59
- package/src/platforms/web/server/compiler.js +0 -11
- package/src/platforms/web/server/directives/index.js +0 -7
- package/src/platforms/web/server/directives/model.js +0 -44
- package/src/platforms/web/server/directives/show.js +0 -12
- package/src/platforms/web/server/modules/attrs.js +0 -67
- package/src/platforms/web/server/modules/class.js +0 -11
- package/src/platforms/web/server/modules/dom-props.js +0 -50
- package/src/platforms/web/server/modules/index.js +0 -11
- package/src/platforms/web/server/modules/style.js +0 -41
- package/src/platforms/web/server/util.js +0 -101
- package/src/platforms/weex/compiler/directives/index.js +0 -5
- package/src/platforms/weex/compiler/directives/model.js +0 -33
- package/src/platforms/weex/compiler/index.js +0 -52
- package/src/platforms/weex/compiler/modules/append.js +0 -27
- package/src/platforms/weex/compiler/modules/class.js +0 -74
- package/src/platforms/weex/compiler/modules/index.js +0 -13
- package/src/platforms/weex/compiler/modules/props.js +0 -37
- package/src/platforms/weex/compiler/modules/recycle-list/component-root.js +0 -13
- package/src/platforms/weex/compiler/modules/recycle-list/component.js +0 -16
- package/src/platforms/weex/compiler/modules/recycle-list/index.js +0 -60
- package/src/platforms/weex/compiler/modules/recycle-list/recycle-list.js +0 -50
- package/src/platforms/weex/compiler/modules/recycle-list/text.js +0 -23
- package/src/platforms/weex/compiler/modules/recycle-list/v-bind.js +0 -21
- package/src/platforms/weex/compiler/modules/recycle-list/v-for.js +0 -33
- package/src/platforms/weex/compiler/modules/recycle-list/v-if.js +0 -63
- package/src/platforms/weex/compiler/modules/recycle-list/v-on.js +0 -25
- package/src/platforms/weex/compiler/modules/recycle-list/v-once.js +0 -19
- package/src/platforms/weex/compiler/modules/style.js +0 -87
- package/src/platforms/weex/entry-compiler.js +0 -2
- package/src/platforms/weex/entry-framework.js +0 -187
- package/src/platforms/weex/entry-runtime-factory.js +0 -6
- package/src/platforms/weex/runtime/components/index.js +0 -9
- package/src/platforms/weex/runtime/components/richtext.js +0 -82
- package/src/platforms/weex/runtime/components/transition-group.js +0 -148
- package/src/platforms/weex/runtime/components/transition.js +0 -9
- package/src/platforms/weex/runtime/directives/index.js +0 -2
- package/src/platforms/weex/runtime/index.js +0 -42
- package/src/platforms/weex/runtime/modules/attrs.js +0 -44
- package/src/platforms/weex/runtime/modules/class.js +0 -76
- package/src/platforms/weex/runtime/modules/events.js +0 -54
- package/src/platforms/weex/runtime/modules/index.js +0 -13
- package/src/platforms/weex/runtime/modules/style.js +0 -84
- package/src/platforms/weex/runtime/modules/transition.js +0 -270
- package/src/platforms/weex/runtime/node-ops.js +0 -91
- package/src/platforms/weex/runtime/patch.js +0 -16
- package/src/platforms/weex/runtime/recycle-list/render-component-template.js +0 -34
- package/src/platforms/weex/runtime/recycle-list/virtual-component.js +0 -136
- package/src/platforms/weex/runtime/text-node.js +0 -9
- package/src/platforms/weex/util/element.js +0 -52
- package/src/platforms/weex/util/index.js +0 -40
- package/src/platforms/weex/util/parser.js +0 -60
- package/src/server/bundle-renderer/create-bundle-renderer.js +0 -151
- package/src/server/bundle-renderer/create-bundle-runner.js +0 -150
- package/src/server/bundle-renderer/source-map-support.js +0 -45
- package/src/server/create-basic-renderer.js +0 -37
- package/src/server/create-renderer.js +0 -152
- package/src/server/optimizing-compiler/codegen.js +0 -264
- package/src/server/optimizing-compiler/index.js +0 -20
- package/src/server/optimizing-compiler/modules.js +0 -124
- package/src/server/optimizing-compiler/optimizer.js +0 -141
- package/src/server/optimizing-compiler/runtime-helpers.js +0 -150
- package/src/server/render-context.js +0 -130
- package/src/server/render-stream.js +0 -95
- package/src/server/render.js +0 -437
- package/src/server/template-renderer/create-async-file-mapper.js +0 -57
- package/src/server/template-renderer/index.js +0 -277
- package/src/server/template-renderer/parse-template.js +0 -42
- package/src/server/template-renderer/template-stream.js +0 -82
- package/src/server/util.js +0 -18
- package/src/server/webpack-plugin/client.js +0 -65
- package/src/server/webpack-plugin/server.js +0 -66
- package/src/server/webpack-plugin/util.js +0 -34
- package/src/server/write.js +0 -50
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
1
|
import { inBrowser, isIE9 } from 'core/util/index'
|
|
4
|
-
import { addClass, removeClass } from '
|
|
2
|
+
import { addClass, removeClass } from 'web/runtime/class-util'
|
|
5
3
|
import { remove, extend, cached } from 'shared/util'
|
|
6
4
|
|
|
7
|
-
export function resolveTransition
|
|
5
|
+
export function resolveTransition(
|
|
6
|
+
def?: string | Record<string, any>
|
|
7
|
+
): Record<string, any> | undefined {
|
|
8
8
|
if (!def) {
|
|
9
9
|
return
|
|
10
10
|
}
|
|
@@ -43,13 +43,15 @@ export let animationProp = 'animation'
|
|
|
43
43
|
export let animationEndEvent = 'animationend'
|
|
44
44
|
if (hasTransition) {
|
|
45
45
|
/* istanbul ignore if */
|
|
46
|
-
if (
|
|
46
|
+
if (
|
|
47
|
+
window.ontransitionend === undefined &&
|
|
47
48
|
window.onwebkittransitionend !== undefined
|
|
48
49
|
) {
|
|
49
50
|
transitionProp = 'WebkitTransition'
|
|
50
51
|
transitionEndEvent = 'webkitTransitionEnd'
|
|
51
52
|
}
|
|
52
|
-
if (
|
|
53
|
+
if (
|
|
54
|
+
window.onanimationend === undefined &&
|
|
53
55
|
window.onwebkitanimationend !== undefined
|
|
54
56
|
) {
|
|
55
57
|
animationProp = 'WebkitAnimation'
|
|
@@ -64,35 +66,38 @@ const raf = inBrowser
|
|
|
64
66
|
: setTimeout
|
|
65
67
|
: /* istanbul ignore next */ fn => fn()
|
|
66
68
|
|
|
67
|
-
export function nextFrame
|
|
69
|
+
export function nextFrame(fn: Function) {
|
|
68
70
|
raf(() => {
|
|
71
|
+
// @ts-expect-error
|
|
69
72
|
raf(fn)
|
|
70
73
|
})
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
export function addTransitionClass
|
|
74
|
-
const transitionClasses =
|
|
76
|
+
export function addTransitionClass(el: any, cls: string) {
|
|
77
|
+
const transitionClasses =
|
|
78
|
+
el._transitionClasses || (el._transitionClasses = [])
|
|
75
79
|
if (transitionClasses.indexOf(cls) < 0) {
|
|
76
80
|
transitionClasses.push(cls)
|
|
77
81
|
addClass(el, cls)
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
export function removeTransitionClass
|
|
85
|
+
export function removeTransitionClass(el: any, cls: string) {
|
|
82
86
|
if (el._transitionClasses) {
|
|
83
87
|
remove(el._transitionClasses, cls)
|
|
84
88
|
}
|
|
85
89
|
removeClass(el, cls)
|
|
86
90
|
}
|
|
87
91
|
|
|
88
|
-
export function whenTransitionEnds
|
|
92
|
+
export function whenTransitionEnds(
|
|
89
93
|
el: Element,
|
|
90
|
-
expectedType:
|
|
94
|
+
expectedType: string | undefined,
|
|
91
95
|
cb: Function
|
|
92
96
|
) {
|
|
93
97
|
const { type, timeout, propCount } = getTransitionInfo(el, expectedType)
|
|
94
98
|
if (!type) return cb()
|
|
95
|
-
const event: string =
|
|
99
|
+
const event: string =
|
|
100
|
+
type === TRANSITION ? transitionEndEvent : animationEndEvent
|
|
96
101
|
let ended = 0
|
|
97
102
|
const end = () => {
|
|
98
103
|
el.removeEventListener(event, onEnd)
|
|
@@ -115,22 +120,39 @@ export function whenTransitionEnds (
|
|
|
115
120
|
|
|
116
121
|
const transformRE = /\b(transform|all)(,|$)/
|
|
117
122
|
|
|
118
|
-
export function getTransitionInfo
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
export function getTransitionInfo(
|
|
124
|
+
el: Element,
|
|
125
|
+
expectedType?: string
|
|
126
|
+
): {
|
|
127
|
+
type?: string | null
|
|
128
|
+
propCount: number
|
|
129
|
+
timeout: number
|
|
130
|
+
hasTransform: boolean
|
|
123
131
|
} {
|
|
124
132
|
const styles: any = window.getComputedStyle(el)
|
|
125
133
|
// JSDOM may return undefined for transition properties
|
|
126
|
-
const transitionDelays: Array<string> = (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
const transitionDelays: Array<string> = (
|
|
135
|
+
styles[transitionProp + 'Delay'] || ''
|
|
136
|
+
).split(', ')
|
|
137
|
+
const transitionDurations: Array<string> = (
|
|
138
|
+
styles[transitionProp + 'Duration'] || ''
|
|
139
|
+
).split(', ')
|
|
140
|
+
const transitionTimeout: number = getTimeout(
|
|
141
|
+
transitionDelays,
|
|
142
|
+
transitionDurations
|
|
143
|
+
)
|
|
144
|
+
const animationDelays: Array<string> = (
|
|
145
|
+
styles[animationProp + 'Delay'] || ''
|
|
146
|
+
).split(', ')
|
|
147
|
+
const animationDurations: Array<string> = (
|
|
148
|
+
styles[animationProp + 'Duration'] || ''
|
|
149
|
+
).split(', ')
|
|
150
|
+
const animationTimeout: number = getTimeout(
|
|
151
|
+
animationDelays,
|
|
152
|
+
animationDurations
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
let type: string | undefined | null
|
|
134
156
|
let timeout = 0
|
|
135
157
|
let propCount = 0
|
|
136
158
|
/* istanbul ignore if */
|
|
@@ -148,11 +170,12 @@ export function getTransitionInfo (el: Element, expectedType?: ?string): {
|
|
|
148
170
|
}
|
|
149
171
|
} else {
|
|
150
172
|
timeout = Math.max(transitionTimeout, animationTimeout)
|
|
151
|
-
type =
|
|
152
|
-
|
|
153
|
-
?
|
|
154
|
-
|
|
155
|
-
|
|
173
|
+
type =
|
|
174
|
+
timeout > 0
|
|
175
|
+
? transitionTimeout > animationTimeout
|
|
176
|
+
? TRANSITION
|
|
177
|
+
: ANIMATION
|
|
178
|
+
: null
|
|
156
179
|
propCount = type
|
|
157
180
|
? type === TRANSITION
|
|
158
181
|
? transitionDurations.length
|
|
@@ -160,8 +183,7 @@ export function getTransitionInfo (el: Element, expectedType?: ?string): {
|
|
|
160
183
|
: 0
|
|
161
184
|
}
|
|
162
185
|
const hasTransform: boolean =
|
|
163
|
-
type === TRANSITION &&
|
|
164
|
-
transformRE.test(styles[transitionProp + 'Property'])
|
|
186
|
+
type === TRANSITION && transformRE.test(styles[transitionProp + 'Property'])
|
|
165
187
|
return {
|
|
166
188
|
type,
|
|
167
189
|
timeout,
|
|
@@ -170,21 +192,24 @@ export function getTransitionInfo (el: Element, expectedType?: ?string): {
|
|
|
170
192
|
}
|
|
171
193
|
}
|
|
172
194
|
|
|
173
|
-
function getTimeout
|
|
195
|
+
function getTimeout(delays: Array<string>, durations: Array<string>): number {
|
|
174
196
|
/* istanbul ignore next */
|
|
175
197
|
while (delays.length < durations.length) {
|
|
176
198
|
delays = delays.concat(delays)
|
|
177
199
|
}
|
|
178
200
|
|
|
179
|
-
return Math.max.apply(
|
|
180
|
-
|
|
181
|
-
|
|
201
|
+
return Math.max.apply(
|
|
202
|
+
null,
|
|
203
|
+
durations.map((d, i) => {
|
|
204
|
+
return toMs(d) + toMs(delays[i])
|
|
205
|
+
})
|
|
206
|
+
)
|
|
182
207
|
}
|
|
183
208
|
|
|
184
209
|
// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
|
|
185
210
|
// in a locale-dependent way, using a comma instead of a dot.
|
|
186
211
|
// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
|
|
187
212
|
// as a floor function) causing unexpected behaviors
|
|
188
|
-
function toMs
|
|
213
|
+
function toMs(s: string): number {
|
|
189
214
|
return Number(s.slice(0, -1).replace(',', '.')) * 1000
|
|
190
215
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
1
|
import config from 'core/config'
|
|
4
2
|
import { warn, cached } from 'core/util/index'
|
|
5
3
|
import { mark, measure } from 'core/util/perf'
|
|
@@ -7,7 +5,12 @@ import { mark, measure } from 'core/util/perf'
|
|
|
7
5
|
import Vue from './runtime/index'
|
|
8
6
|
import { query } from './util/index'
|
|
9
7
|
import { compileToFunctions } from './compiler/index'
|
|
10
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
shouldDecodeNewlines,
|
|
10
|
+
shouldDecodeNewlinesForHref
|
|
11
|
+
} from './util/compat'
|
|
12
|
+
import type { Component } from 'types/component'
|
|
13
|
+
import type { GlobalAPI } from 'types/global-api'
|
|
11
14
|
|
|
12
15
|
const idToTemplate = cached(id => {
|
|
13
16
|
const el = query(id)
|
|
@@ -23,9 +26,10 @@ Vue.prototype.$mount = function (
|
|
|
23
26
|
|
|
24
27
|
/* istanbul ignore if */
|
|
25
28
|
if (el === document.body || el === document.documentElement) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
__DEV__ &&
|
|
30
|
+
warn(
|
|
31
|
+
`Do not mount Vue to <html> or <body> - mount to normal elements instead.`
|
|
32
|
+
)
|
|
29
33
|
return this
|
|
30
34
|
}
|
|
31
35
|
|
|
@@ -38,7 +42,7 @@ Vue.prototype.$mount = function (
|
|
|
38
42
|
if (template.charAt(0) === '#') {
|
|
39
43
|
template = idToTemplate(template)
|
|
40
44
|
/* istanbul ignore if */
|
|
41
|
-
if (
|
|
45
|
+
if (__DEV__ && !template) {
|
|
42
46
|
warn(
|
|
43
47
|
`Template element not found or is empty: ${options.template}`,
|
|
44
48
|
this
|
|
@@ -48,32 +52,37 @@ Vue.prototype.$mount = function (
|
|
|
48
52
|
} else if (template.nodeType) {
|
|
49
53
|
template = template.innerHTML
|
|
50
54
|
} else {
|
|
51
|
-
if (
|
|
55
|
+
if (__DEV__) {
|
|
52
56
|
warn('invalid template option:' + template, this)
|
|
53
57
|
}
|
|
54
58
|
return this
|
|
55
59
|
}
|
|
56
60
|
} else if (el) {
|
|
61
|
+
// @ts-expect-error
|
|
57
62
|
template = getOuterHTML(el)
|
|
58
63
|
}
|
|
59
64
|
if (template) {
|
|
60
65
|
/* istanbul ignore if */
|
|
61
|
-
if (
|
|
66
|
+
if (__DEV__ && config.performance && mark) {
|
|
62
67
|
mark('compile')
|
|
63
68
|
}
|
|
64
69
|
|
|
65
|
-
const { render, staticRenderFns } = compileToFunctions(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const { render, staticRenderFns } = compileToFunctions(
|
|
71
|
+
template,
|
|
72
|
+
{
|
|
73
|
+
outputSourceRange: __DEV__,
|
|
74
|
+
shouldDecodeNewlines,
|
|
75
|
+
shouldDecodeNewlinesForHref,
|
|
76
|
+
delimiters: options.delimiters,
|
|
77
|
+
comments: options.comments
|
|
78
|
+
},
|
|
79
|
+
this
|
|
80
|
+
)
|
|
72
81
|
options.render = render
|
|
73
82
|
options.staticRenderFns = staticRenderFns
|
|
74
83
|
|
|
75
84
|
/* istanbul ignore if */
|
|
76
|
-
if (
|
|
85
|
+
if (__DEV__ && config.performance && mark) {
|
|
77
86
|
mark('compile end')
|
|
78
87
|
measure(`vue ${this._name} compile`, 'compile', 'compile end')
|
|
79
88
|
}
|
|
@@ -86,7 +95,7 @@ Vue.prototype.$mount = function (
|
|
|
86
95
|
* Get outerHTML of elements, taking care
|
|
87
96
|
* of SVG elements in IE as well.
|
|
88
97
|
*/
|
|
89
|
-
function getOuterHTML
|
|
98
|
+
function getOuterHTML(el: Element): string {
|
|
90
99
|
if (el.outerHTML) {
|
|
91
100
|
return el.outerHTML
|
|
92
101
|
} else {
|
|
@@ -98,4 +107,4 @@ function getOuterHTML (el: Element): string {
|
|
|
98
107
|
|
|
99
108
|
Vue.compile = compileToFunctions
|
|
100
109
|
|
|
101
|
-
export default Vue
|
|
110
|
+
export default Vue as GlobalAPI
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
1
|
import { makeMap } from 'shared/util'
|
|
4
2
|
|
|
5
3
|
// these are reserved for web because they are directly compiled away
|
|
@@ -8,9 +6,13 @@ export const isReservedAttr = makeMap('style,class')
|
|
|
8
6
|
|
|
9
7
|
// attributes that should be using props for binding
|
|
10
8
|
const acceptValue = makeMap('input,textarea,option,select,progress')
|
|
11
|
-
export const mustUseProp = (
|
|
9
|
+
export const mustUseProp = (
|
|
10
|
+
tag: string,
|
|
11
|
+
type?: string | null,
|
|
12
|
+
attr?: string
|
|
13
|
+
): boolean => {
|
|
12
14
|
return (
|
|
13
|
-
(attr === 'value' && acceptValue(tag)
|
|
15
|
+
(attr === 'value' && acceptValue(tag) && type !== 'button') ||
|
|
14
16
|
(attr === 'selected' && tag === 'option') ||
|
|
15
17
|
(attr === 'checked' && tag === 'input') ||
|
|
16
18
|
(attr === 'muted' && tag === 'video')
|
|
@@ -19,24 +21,26 @@ export const mustUseProp = (tag: string, type: ?string, attr: string): boolean =
|
|
|
19
21
|
|
|
20
22
|
export const isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck')
|
|
21
23
|
|
|
22
|
-
const isValidContentEditableValue = makeMap(
|
|
24
|
+
const isValidContentEditableValue = makeMap(
|
|
25
|
+
'events,caret,typing,plaintext-only'
|
|
26
|
+
)
|
|
23
27
|
|
|
24
28
|
export const convertEnumeratedValue = (key: string, value: any) => {
|
|
25
29
|
return isFalsyAttrValue(value) || value === 'false'
|
|
26
30
|
? 'false'
|
|
27
|
-
// allow arbitrary string value for contenteditable
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
: // allow arbitrary string value for contenteditable
|
|
32
|
+
key === 'contenteditable' && isValidContentEditableValue(value)
|
|
33
|
+
? value
|
|
34
|
+
: 'true'
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
export const isBooleanAttr = makeMap(
|
|
34
38
|
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
|
40
|
+
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
|
41
|
+
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
|
42
|
+
'required,reversed,scoped,seamless,selected,sortable,' +
|
|
43
|
+
'truespeed,typemustmatch,visible'
|
|
40
44
|
)
|
|
41
45
|
|
|
42
46
|
export const xlinkNS = 'http://www.w3.org/1999/xlink'
|
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import VNode from 'core/vdom/vnode'
|
|
3
2
|
import { isDef, isObject } from 'shared/util'
|
|
3
|
+
import type { VNodeData, VNodeWithData } from 'types/vnode'
|
|
4
4
|
|
|
5
|
-
export function genClassForVnode
|
|
5
|
+
export function genClassForVnode(vnode: VNodeWithData): string {
|
|
6
6
|
let data = vnode.data
|
|
7
|
-
let parentNode = vnode
|
|
8
|
-
let childNode = vnode
|
|
7
|
+
let parentNode: VNode | VNodeWithData | undefined = vnode
|
|
8
|
+
let childNode: VNode | VNodeWithData = vnode
|
|
9
9
|
while (isDef(childNode.componentInstance)) {
|
|
10
|
-
childNode = childNode.componentInstance._vnode
|
|
10
|
+
childNode = childNode.componentInstance._vnode!
|
|
11
11
|
if (childNode && childNode.data) {
|
|
12
12
|
data = mergeClassData(childNode.data, data)
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
// @ts-expect-error parentNode.parent not VNodeWithData
|
|
16
|
+
while (isDef((parentNode = parentNode.parent))) {
|
|
16
17
|
if (parentNode && parentNode.data) {
|
|
17
18
|
data = mergeClassData(data, parentNode.data)
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
|
-
return renderClass(data.staticClass
|
|
21
|
+
return renderClass(data.staticClass!, data.class)
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
function mergeClassData
|
|
24
|
-
|
|
24
|
+
function mergeClassData(
|
|
25
|
+
child: VNodeData,
|
|
26
|
+
parent: VNodeData
|
|
27
|
+
): {
|
|
28
|
+
staticClass: string
|
|
25
29
|
class: any
|
|
26
30
|
} {
|
|
27
31
|
return {
|
|
28
32
|
staticClass: concat(child.staticClass, parent.staticClass),
|
|
29
|
-
class: isDef(child.class)
|
|
30
|
-
? [child.class, parent.class]
|
|
31
|
-
: parent.class
|
|
33
|
+
class: isDef(child.class) ? [child.class, parent.class] : parent.class
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
export function renderClass
|
|
36
|
-
staticClass:
|
|
37
|
+
export function renderClass(
|
|
38
|
+
staticClass: string | null | undefined,
|
|
37
39
|
dynamicClass: any
|
|
38
40
|
): string {
|
|
39
41
|
if (isDef(staticClass) || isDef(dynamicClass)) {
|
|
@@ -43,11 +45,11 @@ export function renderClass (
|
|
|
43
45
|
return ''
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
export function concat
|
|
47
|
-
return a ? b ?
|
|
48
|
+
export function concat(a?: string | null, b?: string | null): string {
|
|
49
|
+
return a ? (b ? a + ' ' + b : a) : b || ''
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
export function stringifyClass
|
|
52
|
+
export function stringifyClass(value: any): string {
|
|
51
53
|
if (Array.isArray(value)) {
|
|
52
54
|
return stringifyArray(value)
|
|
53
55
|
}
|
|
@@ -61,11 +63,11 @@ export function stringifyClass (value: any): string {
|
|
|
61
63
|
return ''
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
function stringifyArray
|
|
66
|
+
function stringifyArray(value: Array<any>): string {
|
|
65
67
|
let res = ''
|
|
66
68
|
let stringified
|
|
67
69
|
for (let i = 0, l = value.length; i < l; i++) {
|
|
68
|
-
if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
|
|
70
|
+
if (isDef((stringified = stringifyClass(value[i]))) && stringified !== '') {
|
|
69
71
|
if (res) res += ' '
|
|
70
72
|
res += stringified
|
|
71
73
|
}
|
|
@@ -73,7 +75,7 @@ function stringifyArray (value: Array<any>): string {
|
|
|
73
75
|
return res
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
function stringifyObject
|
|
78
|
+
function stringifyObject(value: Object): string {
|
|
77
79
|
let res = ''
|
|
78
80
|
for (const key in value) {
|
|
79
81
|
if (value[key]) {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
1
|
import { inBrowser } from 'core/util/index'
|
|
4
2
|
|
|
5
3
|
// check whether current browser encodes a char inside attribute values
|
|
6
4
|
let div
|
|
7
|
-
function getShouldDecode
|
|
5
|
+
function getShouldDecode(href: boolean): boolean {
|
|
8
6
|
div = div || document.createElement('div')
|
|
9
7
|
div.innerHTML = href ? `<a href="\n"/>` : `<div a="\n"/>`
|
|
10
8
|
return div.innerHTML.indexOf(' ') > 0
|
|
@@ -13,4 +11,6 @@ function getShouldDecode (href: boolean): boolean {
|
|
|
13
11
|
// #3663: IE encodes newlines inside attribute values while other browsers don't
|
|
14
12
|
export const shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false
|
|
15
13
|
// #6828: chrome encodes content in a[href]
|
|
16
|
-
export const shouldDecodeNewlinesForHref = inBrowser
|
|
14
|
+
export const shouldDecodeNewlinesForHref = inBrowser
|
|
15
|
+
? getShouldDecode(true)
|
|
16
|
+
: false
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
1
|
import { inBrowser } from 'core/util/env'
|
|
4
2
|
import { makeMap } from 'shared/util'
|
|
5
3
|
|
|
@@ -10,34 +8,34 @@ export const namespaceMap = {
|
|
|
10
8
|
|
|
11
9
|
export const isHTMLTag = makeMap(
|
|
12
10
|
'html,body,base,head,link,meta,style,title,' +
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
|
|
12
|
+
'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
|
|
13
|
+
'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
|
|
14
|
+
's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
|
|
15
|
+
'embed,object,param,source,canvas,script,noscript,del,ins,' +
|
|
16
|
+
'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
|
|
17
|
+
'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
|
|
18
|
+
'output,progress,select,textarea,' +
|
|
19
|
+
'details,dialog,menu,menuitem,summary,' +
|
|
20
|
+
'content,element,shadow,template,blockquote,iframe,tfoot'
|
|
23
21
|
)
|
|
24
22
|
|
|
25
23
|
// this map is intentionally selective, only covering SVG elements that may
|
|
26
24
|
// contain child elements.
|
|
27
25
|
export const isSVG = makeMap(
|
|
28
26
|
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
|
28
|
+
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
|
31
29
|
true
|
|
32
30
|
)
|
|
33
31
|
|
|
34
|
-
export const isPreTag = (tag
|
|
32
|
+
export const isPreTag = (tag?: string): boolean => tag === 'pre'
|
|
35
33
|
|
|
36
|
-
export const isReservedTag = (tag: string):
|
|
34
|
+
export const isReservedTag = (tag: string): boolean | undefined => {
|
|
37
35
|
return isHTMLTag(tag) || isSVG(tag)
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
export function getTagNamespace
|
|
38
|
+
export function getTagNamespace(tag: string): string | undefined {
|
|
41
39
|
if (isSVG(tag)) {
|
|
42
40
|
return 'svg'
|
|
43
41
|
}
|
|
@@ -49,7 +47,7 @@ export function getTagNamespace (tag: string): ?string {
|
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
const unknownElementCache = Object.create(null)
|
|
52
|
-
export function isUnknownElement
|
|
50
|
+
export function isUnknownElement(tag: string): boolean {
|
|
53
51
|
/* istanbul ignore if */
|
|
54
52
|
if (!inBrowser) {
|
|
55
53
|
return true
|
|
@@ -65,13 +63,14 @@ export function isUnknownElement (tag: string): boolean {
|
|
|
65
63
|
const el = document.createElement(tag)
|
|
66
64
|
if (tag.indexOf('-') > -1) {
|
|
67
65
|
// http://stackoverflow.com/a/28210364/1070244
|
|
68
|
-
return (unknownElementCache[tag] =
|
|
66
|
+
return (unknownElementCache[tag] =
|
|
69
67
|
el.constructor === window.HTMLUnknownElement ||
|
|
70
|
-
el.constructor === window.HTMLElement
|
|
71
|
-
))
|
|
68
|
+
el.constructor === window.HTMLElement)
|
|
72
69
|
} else {
|
|
73
70
|
return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
|
|
74
71
|
}
|
|
75
72
|
}
|
|
76
73
|
|
|
77
|
-
export const isTextInputType = makeMap(
|
|
74
|
+
export const isTextInputType = makeMap(
|
|
75
|
+
'text,number,password,search,email,tel,url'
|
|
76
|
+
)
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
1
|
import { warn } from 'core/util/index'
|
|
4
2
|
|
|
5
3
|
export * from './attrs'
|
|
@@ -9,13 +7,11 @@ export * from './element'
|
|
|
9
7
|
/**
|
|
10
8
|
* Query an element selector if it's not an element already.
|
|
11
9
|
*/
|
|
12
|
-
export function query
|
|
10
|
+
export function query(el: string | Element): Element {
|
|
13
11
|
if (typeof el === 'string') {
|
|
14
12
|
const selected = document.querySelector(el)
|
|
15
13
|
if (!selected) {
|
|
16
|
-
|
|
17
|
-
'Cannot find element: ' + el
|
|
18
|
-
)
|
|
14
|
+
__DEV__ && warn('Cannot find element: ' + el)
|
|
19
15
|
return document.createElement('div')
|
|
20
16
|
}
|
|
21
17
|
return selected
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import VNode from 'core/vdom/vnode'
|
|
3
2
|
import { cached, extend, toObject } from 'shared/util'
|
|
3
|
+
import type { VNodeData, VNodeWithData } from 'types/vnode'
|
|
4
4
|
|
|
5
5
|
export const parseStyleText = cached(function (cssText) {
|
|
6
6
|
const res = {}
|
|
@@ -16,17 +16,15 @@ export const parseStyleText = cached(function (cssText) {
|
|
|
16
16
|
})
|
|
17
17
|
|
|
18
18
|
// merge static and dynamic style data on the same vnode
|
|
19
|
-
function normalizeStyleData
|
|
19
|
+
function normalizeStyleData(data: VNodeData): Record<string, any> {
|
|
20
20
|
const style = normalizeStyleBinding(data.style)
|
|
21
21
|
// static style is pre-processed into an object during compilation
|
|
22
22
|
// and is always a fresh object, so it's safe to merge into it
|
|
23
|
-
return data.staticStyle
|
|
24
|
-
? extend(data.staticStyle, style)
|
|
25
|
-
: style
|
|
23
|
+
return data.staticStyle ? extend(data.staticStyle, style) : style
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
// normalize possible array / string values into Object
|
|
29
|
-
export function normalizeStyleBinding
|
|
27
|
+
export function normalizeStyleBinding(bindingStyle: any): Record<string, any> {
|
|
30
28
|
if (Array.isArray(bindingStyle)) {
|
|
31
29
|
return toObject(bindingStyle)
|
|
32
30
|
}
|
|
@@ -40,16 +38,17 @@ export function normalizeStyleBinding (bindingStyle: any): ?Object {
|
|
|
40
38
|
* parent component style should be after child's
|
|
41
39
|
* so that parent component's style could override it
|
|
42
40
|
*/
|
|
43
|
-
export function getStyle
|
|
41
|
+
export function getStyle(vnode: VNodeWithData, checkChild: boolean): Object {
|
|
44
42
|
const res = {}
|
|
45
43
|
let styleData
|
|
46
44
|
|
|
47
45
|
if (checkChild) {
|
|
48
|
-
let childNode = vnode
|
|
46
|
+
let childNode: VNodeWithData | VNode = vnode
|
|
49
47
|
while (childNode.componentInstance) {
|
|
50
|
-
childNode = childNode.componentInstance._vnode
|
|
48
|
+
childNode = childNode.componentInstance._vnode!
|
|
51
49
|
if (
|
|
52
|
-
childNode &&
|
|
50
|
+
childNode &&
|
|
51
|
+
childNode.data &&
|
|
53
52
|
(styleData = normalizeStyleData(childNode.data))
|
|
54
53
|
) {
|
|
55
54
|
extend(res, styleData)
|
|
@@ -61,7 +60,8 @@ export function getStyle (vnode: VNodeWithData, checkChild: boolean): Object {
|
|
|
61
60
|
extend(res, styleData)
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
let parentNode = vnode
|
|
63
|
+
let parentNode: VNodeWithData | VNode | undefined = vnode
|
|
64
|
+
// @ts-expect-error parentNode.parent not VNodeWithData
|
|
65
65
|
while ((parentNode = parentNode.parent)) {
|
|
66
66
|
if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
|
|
67
67
|
extend(res, styleData)
|