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,84 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
import { extend, cached, camelize } from 'shared/util'
|
|
4
|
-
|
|
5
|
-
const normalize = cached(camelize)
|
|
6
|
-
|
|
7
|
-
function createStyle (oldVnode: VNodeWithData, vnode: VNodeWithData) {
|
|
8
|
-
if (!vnode.data.staticStyle) {
|
|
9
|
-
updateStyle(oldVnode, vnode)
|
|
10
|
-
return
|
|
11
|
-
}
|
|
12
|
-
const elm = vnode.elm
|
|
13
|
-
const staticStyle = vnode.data.staticStyle
|
|
14
|
-
const supportBatchUpdate = typeof elm.setStyles === 'function'
|
|
15
|
-
const batchedStyles = {}
|
|
16
|
-
for (const name in staticStyle) {
|
|
17
|
-
if (staticStyle[name]) {
|
|
18
|
-
supportBatchUpdate
|
|
19
|
-
? (batchedStyles[normalize(name)] = staticStyle[name])
|
|
20
|
-
: elm.setStyle(normalize(name), staticStyle[name])
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
if (supportBatchUpdate) {
|
|
24
|
-
elm.setStyles(batchedStyles)
|
|
25
|
-
}
|
|
26
|
-
updateStyle(oldVnode, vnode)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function updateStyle (oldVnode: VNodeWithData, vnode: VNodeWithData) {
|
|
30
|
-
if (!oldVnode.data.style && !vnode.data.style) {
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
let cur, name
|
|
34
|
-
const elm = vnode.elm
|
|
35
|
-
const oldStyle: any = oldVnode.data.style || {}
|
|
36
|
-
let style: any = vnode.data.style || {}
|
|
37
|
-
|
|
38
|
-
const needClone = style.__ob__
|
|
39
|
-
|
|
40
|
-
// handle array syntax
|
|
41
|
-
if (Array.isArray(style)) {
|
|
42
|
-
style = vnode.data.style = toObject(style)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// clone the style for future updates,
|
|
46
|
-
// in case the user mutates the style object in-place.
|
|
47
|
-
if (needClone) {
|
|
48
|
-
style = vnode.data.style = extend({}, style)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const supportBatchUpdate = typeof elm.setStyles === 'function'
|
|
52
|
-
const batchedStyles = {}
|
|
53
|
-
for (name in oldStyle) {
|
|
54
|
-
if (!style[name]) {
|
|
55
|
-
supportBatchUpdate
|
|
56
|
-
? (batchedStyles[normalize(name)] = '')
|
|
57
|
-
: elm.setStyle(normalize(name), '')
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
for (name in style) {
|
|
61
|
-
cur = style[name]
|
|
62
|
-
supportBatchUpdate
|
|
63
|
-
? (batchedStyles[normalize(name)] = cur)
|
|
64
|
-
: elm.setStyle(normalize(name), cur)
|
|
65
|
-
}
|
|
66
|
-
if (supportBatchUpdate) {
|
|
67
|
-
elm.setStyles(batchedStyles)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function toObject (arr) {
|
|
72
|
-
const res = {}
|
|
73
|
-
for (let i = 0; i < arr.length; i++) {
|
|
74
|
-
if (arr[i]) {
|
|
75
|
-
extend(res, arr[i])
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return res
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default {
|
|
82
|
-
create: createStyle,
|
|
83
|
-
update: updateStyle
|
|
84
|
-
}
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import { warn } from 'core/util/debug'
|
|
2
|
-
import { extend, once, noop } from 'shared/util'
|
|
3
|
-
import { activeInstance } from 'core/instance/lifecycle'
|
|
4
|
-
import { resolveTransition } from 'web/runtime/transition-util'
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
create: enter,
|
|
8
|
-
activate: enter,
|
|
9
|
-
remove: leave
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function enter (_, vnode) {
|
|
13
|
-
const el = vnode.elm
|
|
14
|
-
|
|
15
|
-
// call leave callback now
|
|
16
|
-
if (el._leaveCb) {
|
|
17
|
-
el._leaveCb.cancelled = true
|
|
18
|
-
el._leaveCb()
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const data = resolveTransition(vnode.data.transition)
|
|
22
|
-
if (!data) {
|
|
23
|
-
return
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/* istanbul ignore if */
|
|
27
|
-
if (el._enterCb) {
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const {
|
|
32
|
-
enterClass,
|
|
33
|
-
enterToClass,
|
|
34
|
-
enterActiveClass,
|
|
35
|
-
appearClass,
|
|
36
|
-
appearToClass,
|
|
37
|
-
appearActiveClass,
|
|
38
|
-
beforeEnter,
|
|
39
|
-
enter,
|
|
40
|
-
afterEnter,
|
|
41
|
-
enterCancelled,
|
|
42
|
-
beforeAppear,
|
|
43
|
-
appear,
|
|
44
|
-
afterAppear,
|
|
45
|
-
appearCancelled
|
|
46
|
-
} = data
|
|
47
|
-
|
|
48
|
-
let context = activeInstance
|
|
49
|
-
let transitionNode = activeInstance.$vnode
|
|
50
|
-
while (transitionNode && transitionNode.parent) {
|
|
51
|
-
transitionNode = transitionNode.parent
|
|
52
|
-
context = transitionNode.context
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const isAppear = !context._isMounted || !vnode.isRootInsert
|
|
56
|
-
|
|
57
|
-
if (isAppear && !appear && appear !== '') {
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const startClass = isAppear ? appearClass : enterClass
|
|
62
|
-
const toClass = isAppear ? appearToClass : enterToClass
|
|
63
|
-
const activeClass = isAppear ? appearActiveClass : enterActiveClass
|
|
64
|
-
const beforeEnterHook = isAppear ? (beforeAppear || beforeEnter) : beforeEnter
|
|
65
|
-
const enterHook = isAppear ? (typeof appear === 'function' ? appear : enter) : enter
|
|
66
|
-
const afterEnterHook = isAppear ? (afterAppear || afterEnter) : afterEnter
|
|
67
|
-
const enterCancelledHook = isAppear ? (appearCancelled || enterCancelled) : enterCancelled
|
|
68
|
-
|
|
69
|
-
const userWantsControl =
|
|
70
|
-
enterHook &&
|
|
71
|
-
// enterHook may be a bound method which exposes
|
|
72
|
-
// the length of original fn as _length
|
|
73
|
-
(enterHook._length || enterHook.length) > 1
|
|
74
|
-
|
|
75
|
-
const stylesheet = vnode.context.$options.style || {}
|
|
76
|
-
const startState = stylesheet[startClass]
|
|
77
|
-
const transitionProperties = (stylesheet['@TRANSITION'] && stylesheet['@TRANSITION'][activeClass]) || {}
|
|
78
|
-
const endState = getEnterTargetState(el, stylesheet, startClass, toClass, activeClass)
|
|
79
|
-
const needAnimation = Object.keys(endState).length > 0
|
|
80
|
-
|
|
81
|
-
const cb = el._enterCb = once(() => {
|
|
82
|
-
if (cb.cancelled) {
|
|
83
|
-
enterCancelledHook && enterCancelledHook(el)
|
|
84
|
-
} else {
|
|
85
|
-
afterEnterHook && afterEnterHook(el)
|
|
86
|
-
}
|
|
87
|
-
el._enterCb = null
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
// We need to wait until the native element has been inserted, but currently
|
|
91
|
-
// there's no API to do that. So we have to wait "one frame" - not entirely
|
|
92
|
-
// sure if this is guaranteed to be enough (e.g. on slow devices?)
|
|
93
|
-
setTimeout(() => {
|
|
94
|
-
const parent = el.parentNode
|
|
95
|
-
const pendingNode = parent && parent._pending && parent._pending[vnode.key]
|
|
96
|
-
if (pendingNode &&
|
|
97
|
-
pendingNode.context === vnode.context &&
|
|
98
|
-
pendingNode.tag === vnode.tag &&
|
|
99
|
-
pendingNode.elm._leaveCb
|
|
100
|
-
) {
|
|
101
|
-
pendingNode.elm._leaveCb()
|
|
102
|
-
}
|
|
103
|
-
enterHook && enterHook(el, cb)
|
|
104
|
-
|
|
105
|
-
if (needAnimation) {
|
|
106
|
-
const animation = vnode.context.$requireWeexModule('animation')
|
|
107
|
-
animation.transition(el.ref, {
|
|
108
|
-
styles: endState,
|
|
109
|
-
duration: transitionProperties.duration || 0,
|
|
110
|
-
delay: transitionProperties.delay || 0,
|
|
111
|
-
timingFunction: transitionProperties.timingFunction || 'linear'
|
|
112
|
-
}, userWantsControl ? noop : cb)
|
|
113
|
-
} else if (!userWantsControl) {
|
|
114
|
-
cb()
|
|
115
|
-
}
|
|
116
|
-
}, 16)
|
|
117
|
-
|
|
118
|
-
// start enter transition
|
|
119
|
-
beforeEnterHook && beforeEnterHook(el)
|
|
120
|
-
|
|
121
|
-
if (startState) {
|
|
122
|
-
if (typeof el.setStyles === 'function') {
|
|
123
|
-
el.setStyles(startState)
|
|
124
|
-
} else {
|
|
125
|
-
for (const key in startState) {
|
|
126
|
-
el.setStyle(key, startState[key])
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (!needAnimation && !userWantsControl) {
|
|
132
|
-
cb()
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function leave (vnode, rm) {
|
|
137
|
-
const el = vnode.elm
|
|
138
|
-
|
|
139
|
-
// call enter callback now
|
|
140
|
-
if (el._enterCb) {
|
|
141
|
-
el._enterCb.cancelled = true
|
|
142
|
-
el._enterCb()
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const data = resolveTransition(vnode.data.transition)
|
|
146
|
-
if (!data) {
|
|
147
|
-
return rm()
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (el._leaveCb) {
|
|
151
|
-
return
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const {
|
|
155
|
-
leaveClass,
|
|
156
|
-
leaveToClass,
|
|
157
|
-
leaveActiveClass,
|
|
158
|
-
beforeLeave,
|
|
159
|
-
leave,
|
|
160
|
-
afterLeave,
|
|
161
|
-
leaveCancelled,
|
|
162
|
-
delayLeave
|
|
163
|
-
} = data
|
|
164
|
-
|
|
165
|
-
const userWantsControl =
|
|
166
|
-
leave &&
|
|
167
|
-
// leave hook may be a bound method which exposes
|
|
168
|
-
// the length of original fn as _length
|
|
169
|
-
(leave._length || leave.length) > 1
|
|
170
|
-
|
|
171
|
-
const stylesheet = vnode.context.$options.style || {}
|
|
172
|
-
const startState = stylesheet[leaveClass]
|
|
173
|
-
const endState = stylesheet[leaveToClass] || stylesheet[leaveActiveClass]
|
|
174
|
-
const transitionProperties = (stylesheet['@TRANSITION'] && stylesheet['@TRANSITION'][leaveActiveClass]) || {}
|
|
175
|
-
|
|
176
|
-
const cb = el._leaveCb = once(() => {
|
|
177
|
-
if (el.parentNode && el.parentNode._pending) {
|
|
178
|
-
el.parentNode._pending[vnode.key] = null
|
|
179
|
-
}
|
|
180
|
-
if (cb.cancelled) {
|
|
181
|
-
leaveCancelled && leaveCancelled(el)
|
|
182
|
-
} else {
|
|
183
|
-
rm()
|
|
184
|
-
afterLeave && afterLeave(el)
|
|
185
|
-
}
|
|
186
|
-
el._leaveCb = null
|
|
187
|
-
})
|
|
188
|
-
|
|
189
|
-
if (delayLeave) {
|
|
190
|
-
delayLeave(performLeave)
|
|
191
|
-
} else {
|
|
192
|
-
performLeave()
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function performLeave () {
|
|
196
|
-
const animation = vnode.context.$requireWeexModule('animation')
|
|
197
|
-
// the delayed leave may have already been cancelled
|
|
198
|
-
if (cb.cancelled) {
|
|
199
|
-
return
|
|
200
|
-
}
|
|
201
|
-
// record leaving element
|
|
202
|
-
if (!vnode.data.show) {
|
|
203
|
-
(el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode
|
|
204
|
-
}
|
|
205
|
-
beforeLeave && beforeLeave(el)
|
|
206
|
-
|
|
207
|
-
if (startState) {
|
|
208
|
-
animation.transition(el.ref, {
|
|
209
|
-
styles: startState
|
|
210
|
-
}, next)
|
|
211
|
-
} else {
|
|
212
|
-
next()
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function next () {
|
|
216
|
-
animation.transition(el.ref, {
|
|
217
|
-
styles: endState,
|
|
218
|
-
duration: transitionProperties.duration || 0,
|
|
219
|
-
delay: transitionProperties.delay || 0,
|
|
220
|
-
timingFunction: transitionProperties.timingFunction || 'linear'
|
|
221
|
-
}, userWantsControl ? noop : cb)
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
leave && leave(el, cb)
|
|
225
|
-
if (!endState && !userWantsControl) {
|
|
226
|
-
cb()
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// determine the target animation style for an entering transition.
|
|
232
|
-
function getEnterTargetState (el, stylesheet, startClass, endClass, activeClass) {
|
|
233
|
-
const targetState = {}
|
|
234
|
-
const startState = stylesheet[startClass]
|
|
235
|
-
const endState = stylesheet[endClass]
|
|
236
|
-
const activeState = stylesheet[activeClass]
|
|
237
|
-
// 1. fallback to element's default styling
|
|
238
|
-
if (startState) {
|
|
239
|
-
for (const key in startState) {
|
|
240
|
-
targetState[key] = el.style[key]
|
|
241
|
-
if (
|
|
242
|
-
process.env.NODE_ENV !== 'production' &&
|
|
243
|
-
targetState[key] == null &&
|
|
244
|
-
(!activeState || activeState[key] == null) &&
|
|
245
|
-
(!endState || endState[key] == null)
|
|
246
|
-
) {
|
|
247
|
-
warn(
|
|
248
|
-
`transition property "${key}" is declared in enter starting class (.${startClass}), ` +
|
|
249
|
-
`but not declared anywhere in enter ending class (.${endClass}), ` +
|
|
250
|
-
`enter active cass (.${activeClass}) or the element's default styling. ` +
|
|
251
|
-
`Note in Weex, CSS properties need explicit values to be transitionable.`
|
|
252
|
-
)
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
// 2. if state is mixed in active state, extract them while excluding
|
|
257
|
-
// transition properties
|
|
258
|
-
if (activeState) {
|
|
259
|
-
for (const key in activeState) {
|
|
260
|
-
if (key.indexOf('transition') !== 0) {
|
|
261
|
-
targetState[key] = activeState[key]
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
// 3. explicit endState has highest priority
|
|
266
|
-
if (endState) {
|
|
267
|
-
extend(targetState, endState)
|
|
268
|
-
}
|
|
269
|
-
return targetState
|
|
270
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
declare var document: WeexDocument;
|
|
3
|
-
|
|
4
|
-
import TextNode from 'weex/runtime/text-node'
|
|
5
|
-
|
|
6
|
-
export const namespaceMap = {}
|
|
7
|
-
|
|
8
|
-
export function createElement (tagName: string): WeexElement {
|
|
9
|
-
return document.createElement(tagName)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function createElementNS (namespace: string, tagName: string): WeexElement {
|
|
13
|
-
return document.createElement(namespace + ':' + tagName)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function createTextNode (text: string) {
|
|
17
|
-
return new TextNode(text)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function createComment (text: string) {
|
|
21
|
-
return document.createComment(text)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function insertBefore (
|
|
25
|
-
node: WeexElement,
|
|
26
|
-
target: WeexElement,
|
|
27
|
-
before: WeexElement
|
|
28
|
-
) {
|
|
29
|
-
if (target.nodeType === 3) {
|
|
30
|
-
if (node.type === 'text') {
|
|
31
|
-
node.setAttr('value', target.text)
|
|
32
|
-
target.parentNode = node
|
|
33
|
-
} else {
|
|
34
|
-
const text = createElement('text')
|
|
35
|
-
text.setAttr('value', target.text)
|
|
36
|
-
node.insertBefore(text, before)
|
|
37
|
-
}
|
|
38
|
-
return
|
|
39
|
-
}
|
|
40
|
-
node.insertBefore(target, before)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function removeChild (node: WeexElement, child: WeexElement) {
|
|
44
|
-
if (child.nodeType === 3) {
|
|
45
|
-
node.setAttr('value', '')
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
node.removeChild(child)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function appendChild (node: WeexElement, child: WeexElement) {
|
|
52
|
-
if (child.nodeType === 3) {
|
|
53
|
-
if (node.type === 'text') {
|
|
54
|
-
node.setAttr('value', child.text)
|
|
55
|
-
child.parentNode = node
|
|
56
|
-
} else {
|
|
57
|
-
const text = createElement('text')
|
|
58
|
-
text.setAttr('value', child.text)
|
|
59
|
-
node.appendChild(text)
|
|
60
|
-
}
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
node.appendChild(child)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function parentNode (node: WeexElement): WeexElement | void {
|
|
68
|
-
return node.parentNode
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function nextSibling (node: WeexElement): WeexElement | void {
|
|
72
|
-
return node.nextSibling
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function tagName (node: WeexElement): string {
|
|
76
|
-
return node.type
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function setTextContent (node: WeexElement, text: string) {
|
|
80
|
-
if (node.parentNode) {
|
|
81
|
-
node.parentNode.setAttr('value', text)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function setAttribute (node: WeexElement, key: string, val: any) {
|
|
86
|
-
node.setAttr(key, val)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export function setStyleScope (node: WeexElement, scopeId: string) {
|
|
90
|
-
node.setAttr('@styleScope', scopeId)
|
|
91
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
import * as nodeOps from 'weex/runtime/node-ops'
|
|
4
|
-
import { createPatchFunction } from 'core/vdom/patch'
|
|
5
|
-
import baseModules from 'core/vdom/modules/index'
|
|
6
|
-
import platformModules from 'weex/runtime/modules/index'
|
|
7
|
-
|
|
8
|
-
// the directive module should be applied last, after all
|
|
9
|
-
// built-in modules have been applied.
|
|
10
|
-
const modules = platformModules.concat(baseModules)
|
|
11
|
-
|
|
12
|
-
export const patch: Function = createPatchFunction({
|
|
13
|
-
nodeOps,
|
|
14
|
-
modules,
|
|
15
|
-
LONG_LIST_THRESHOLD: 10
|
|
16
|
-
})
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
import { warn } from 'core/util/debug'
|
|
4
|
-
import { handleError } from 'core/util/error'
|
|
5
|
-
import { RECYCLE_LIST_MARKER } from 'weex/util/index'
|
|
6
|
-
import { createComponentInstanceForVnode } from 'core/vdom/create-component'
|
|
7
|
-
import { resolveVirtualComponent } from './virtual-component'
|
|
8
|
-
|
|
9
|
-
export function isRecyclableComponent (vnode: VNodeWithData): boolean {
|
|
10
|
-
return vnode.data.attrs
|
|
11
|
-
? (RECYCLE_LIST_MARKER in vnode.data.attrs)
|
|
12
|
-
: false
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function renderRecyclableComponentTemplate (vnode: MountedComponentVNode): VNode {
|
|
16
|
-
// $flow-disable-line
|
|
17
|
-
delete vnode.data.attrs[RECYCLE_LIST_MARKER]
|
|
18
|
-
resolveVirtualComponent(vnode)
|
|
19
|
-
const vm = createComponentInstanceForVnode(vnode)
|
|
20
|
-
const render = (vm.$options: any)['@render']
|
|
21
|
-
if (render) {
|
|
22
|
-
try {
|
|
23
|
-
return render.call(vm)
|
|
24
|
-
} catch (err) {
|
|
25
|
-
handleError(err, vm, `@render`)
|
|
26
|
-
}
|
|
27
|
-
} else {
|
|
28
|
-
warn(
|
|
29
|
-
`@render function not defined on component used in <recycle-list>. ` +
|
|
30
|
-
`Make sure to declare \`recyclable="true"\` on the component's template.`,
|
|
31
|
-
vm
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
// https://github.com/Hanks10100/weex-native-directive/tree/master/component
|
|
4
|
-
|
|
5
|
-
import { mergeOptions, isPlainObject, noop } from 'core/util/index'
|
|
6
|
-
import Watcher from 'core/observer/watcher'
|
|
7
|
-
import { initProxy } from 'core/instance/proxy'
|
|
8
|
-
import { initState, getData } from 'core/instance/state'
|
|
9
|
-
import { initRender } from 'core/instance/render'
|
|
10
|
-
import { initEvents } from 'core/instance/events'
|
|
11
|
-
import { initProvide, initInjections } from 'core/instance/inject'
|
|
12
|
-
import { initLifecycle, callHook } from 'core/instance/lifecycle'
|
|
13
|
-
import { initInternalComponent, resolveConstructorOptions } from 'core/instance/init'
|
|
14
|
-
import { registerComponentHook, updateComponentData } from '../../util/index'
|
|
15
|
-
|
|
16
|
-
let uid = 0
|
|
17
|
-
|
|
18
|
-
// override Vue.prototype._init
|
|
19
|
-
function initVirtualComponent (options: Object = {}) {
|
|
20
|
-
const vm: Component = this
|
|
21
|
-
const componentId = options.componentId
|
|
22
|
-
|
|
23
|
-
// virtual component uid
|
|
24
|
-
vm._uid = `virtual-component-${uid++}`
|
|
25
|
-
|
|
26
|
-
// a flag to avoid this being observed
|
|
27
|
-
vm._isVue = true
|
|
28
|
-
// merge options
|
|
29
|
-
if (options && options._isComponent) {
|
|
30
|
-
// optimize internal component instantiation
|
|
31
|
-
// since dynamic options merging is pretty slow, and none of the
|
|
32
|
-
// internal component options needs special treatment.
|
|
33
|
-
initInternalComponent(vm, options)
|
|
34
|
-
} else {
|
|
35
|
-
vm.$options = mergeOptions(
|
|
36
|
-
resolveConstructorOptions(vm.constructor),
|
|
37
|
-
options || {},
|
|
38
|
-
vm
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/* istanbul ignore else */
|
|
43
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
44
|
-
initProxy(vm)
|
|
45
|
-
} else {
|
|
46
|
-
vm._renderProxy = vm
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
vm._self = vm
|
|
50
|
-
initLifecycle(vm)
|
|
51
|
-
initEvents(vm)
|
|
52
|
-
initRender(vm)
|
|
53
|
-
callHook(vm, 'beforeCreate')
|
|
54
|
-
initInjections(vm) // resolve injections before data/props
|
|
55
|
-
initState(vm)
|
|
56
|
-
initProvide(vm) // resolve provide after data/props
|
|
57
|
-
callHook(vm, 'created')
|
|
58
|
-
|
|
59
|
-
// send initial data to native
|
|
60
|
-
const data = vm.$options.data
|
|
61
|
-
const params = typeof data === 'function'
|
|
62
|
-
? getData(data, vm)
|
|
63
|
-
: data || {}
|
|
64
|
-
if (isPlainObject(params)) {
|
|
65
|
-
updateComponentData(componentId, params)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
registerComponentHook(componentId, 'lifecycle', 'attach', () => {
|
|
69
|
-
callHook(vm, 'beforeMount')
|
|
70
|
-
|
|
71
|
-
const updateComponent = () => {
|
|
72
|
-
vm._update(vm._vnode, false)
|
|
73
|
-
}
|
|
74
|
-
new Watcher(vm, updateComponent, noop, null, true)
|
|
75
|
-
|
|
76
|
-
vm._isMounted = true
|
|
77
|
-
callHook(vm, 'mounted')
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
registerComponentHook(componentId, 'lifecycle', 'detach', () => {
|
|
81
|
-
vm.$destroy()
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// override Vue.prototype._update
|
|
86
|
-
function updateVirtualComponent (vnode?: VNode) {
|
|
87
|
-
const vm: Component = this
|
|
88
|
-
const componentId = vm.$options.componentId
|
|
89
|
-
if (vm._isMounted) {
|
|
90
|
-
callHook(vm, 'beforeUpdate')
|
|
91
|
-
}
|
|
92
|
-
vm._vnode = vnode
|
|
93
|
-
if (vm._isMounted && componentId) {
|
|
94
|
-
// TODO: data should be filtered and without bindings
|
|
95
|
-
const data = Object.assign({}, vm._data)
|
|
96
|
-
updateComponentData(componentId, data, () => {
|
|
97
|
-
callHook(vm, 'updated')
|
|
98
|
-
})
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// listening on native callback
|
|
103
|
-
export function resolveVirtualComponent (vnode: MountedComponentVNode): VNode {
|
|
104
|
-
const BaseCtor = vnode.componentOptions.Ctor
|
|
105
|
-
const VirtualComponent = BaseCtor.extend({})
|
|
106
|
-
const cid = VirtualComponent.cid
|
|
107
|
-
VirtualComponent.prototype._init = initVirtualComponent
|
|
108
|
-
VirtualComponent.prototype._update = updateVirtualComponent
|
|
109
|
-
|
|
110
|
-
vnode.componentOptions.Ctor = BaseCtor.extend({
|
|
111
|
-
beforeCreate () {
|
|
112
|
-
// const vm: Component = this
|
|
113
|
-
|
|
114
|
-
// TODO: listen on all events and dispatch them to the
|
|
115
|
-
// corresponding virtual components according to the componentId.
|
|
116
|
-
// vm._virtualComponents = {}
|
|
117
|
-
const createVirtualComponent = (componentId, propsData) => {
|
|
118
|
-
// create virtual component
|
|
119
|
-
// const subVm =
|
|
120
|
-
new VirtualComponent({
|
|
121
|
-
componentId,
|
|
122
|
-
propsData
|
|
123
|
-
})
|
|
124
|
-
// if (vm._virtualComponents) {
|
|
125
|
-
// vm._virtualComponents[componentId] = subVm
|
|
126
|
-
// }
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
registerComponentHook(cid, 'lifecycle', 'create', createVirtualComponent)
|
|
130
|
-
},
|
|
131
|
-
beforeDestroy () {
|
|
132
|
-
delete this._virtualComponents
|
|
133
|
-
}
|
|
134
|
-
})
|
|
135
|
-
}
|
|
136
|
-
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
// These util functions are split into its own file because Rollup cannot drop
|
|
4
|
-
// makeMap() due to potential side effects, so these variables end up
|
|
5
|
-
// bloating the web builds.
|
|
6
|
-
|
|
7
|
-
import { makeMap, noop } from 'shared/util'
|
|
8
|
-
|
|
9
|
-
export const isReservedTag = makeMap(
|
|
10
|
-
'template,script,style,element,content,slot,link,meta,svg,view,' +
|
|
11
|
-
'a,div,img,image,text,span,input,switch,textarea,spinner,select,' +
|
|
12
|
-
'slider,slider-neighbor,indicator,canvas,' +
|
|
13
|
-
'list,cell,header,loading,loading-indicator,refresh,scrollable,scroller,' +
|
|
14
|
-
'video,web,embed,tabbar,tabheader,datepicker,timepicker,marquee,countdown',
|
|
15
|
-
true
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
// Elements that you can, intentionally, leave open (and which close themselves)
|
|
19
|
-
// more flexible than web
|
|
20
|
-
export const canBeLeftOpenTag = makeMap(
|
|
21
|
-
'web,spinner,switch,video,textarea,canvas,' +
|
|
22
|
-
'indicator,marquee,countdown',
|
|
23
|
-
true
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
export const isRuntimeComponent = makeMap(
|
|
27
|
-
'richtext,transition,transition-group',
|
|
28
|
-
true
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
export const isUnaryTag = makeMap(
|
|
32
|
-
'embed,img,image,input,link,meta',
|
|
33
|
-
true
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
export function mustUseProp (): boolean {
|
|
37
|
-
return false
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function getTagNamespace (): void { }
|
|
41
|
-
|
|
42
|
-
export function isUnknownElement (): boolean {
|
|
43
|
-
return false
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function query (el: string | Element, document: Object) {
|
|
47
|
-
// document is injected by weex factory wrapper
|
|
48
|
-
const placeholder = document.createComment('root')
|
|
49
|
-
placeholder.hasAttribute = placeholder.removeAttribute = noop // hack for patch
|
|
50
|
-
document.documentElement.appendChild(placeholder)
|
|
51
|
-
return placeholder
|
|
52
|
-
}
|