aboutsummaryrefslogtreecommitdiff
path: root/node_modules/vue/src/platforms/weex/compiler/modules
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/vue/src/platforms/weex/compiler/modules
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/vue/src/platforms/weex/compiler/modules')
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/append.js27
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/class.js73
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/index.js13
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/props.js32
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/component-root.js16
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/component.js16
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/index.js60
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/recycle-list.js50
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/text.js23
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-bind.js21
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-for.js33
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-if.js63
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-on.js25
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-once.js19
-rw-r--r--node_modules/vue/src/platforms/weex/compiler/modules/style.js86
15 files changed, 557 insertions, 0 deletions
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/append.js b/node_modules/vue/src/platforms/weex/compiler/modules/append.js
new file mode 100644
index 00000000..6e7be267
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/append.js
@@ -0,0 +1,27 @@
+/* @flow */
+
+import { makeMap } from 'shared/util'
+
+// The "unitary tag" means that the tag node and its children
+// must be sent to the native together.
+const isUnitaryTag = makeMap('cell,header,cell-slot,recycle-list', true)
+
+function preTransformNode (el: ASTElement, options: CompilerOptions) {
+ if (isUnitaryTag(el.tag) && !el.attrsList.some(item => item.name === 'append')) {
+ el.attrsMap.append = 'tree'
+ el.attrsList.push({ name: 'append', value: 'tree' })
+ }
+ if (el.attrsMap.append === 'tree') {
+ el.appendAsTree = true
+ }
+}
+
+function genData (el: ASTElement): string {
+ return el.appendAsTree ? `appendAsTree:true,` : ''
+}
+
+export default {
+ staticKeys: ['appendAsTree'],
+ preTransformNode,
+ genData
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/class.js b/node_modules/vue/src/platforms/weex/compiler/modules/class.js
new file mode 100644
index 00000000..371a08ea
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/class.js
@@ -0,0 +1,73 @@
+/* @flow */
+
+import { parseText } from 'compiler/parser/text-parser'
+import {
+ getAndRemoveAttr,
+ getBindingAttr,
+ baseWarn
+} from 'compiler/helpers'
+
+type StaticClassResult = {
+ dynamic: boolean,
+ classResult: string
+};
+
+function transformNode (el: ASTElement, options: CompilerOptions) {
+ const warn = options.warn || baseWarn
+ const staticClass = getAndRemoveAttr(el, 'class')
+ const { dynamic, classResult } = parseStaticClass(staticClass, options)
+ if (process.env.NODE_ENV !== 'production' && dynamic && staticClass) {
+ warn(
+ `class="${staticClass}": ` +
+ 'Interpolation inside attributes has been deprecated. ' +
+ 'Use v-bind or the colon shorthand instead.'
+ )
+ }
+ if (!dynamic && classResult) {
+ el.staticClass = classResult
+ }
+ const classBinding = getBindingAttr(el, 'class', false /* getStatic */)
+ if (classBinding) {
+ el.classBinding = classBinding
+ } else if (dynamic) {
+ el.classBinding = classResult
+ }
+}
+
+function genData (el: ASTElement): string {
+ let data = ''
+ if (el.staticClass) {
+ data += `staticClass:${el.staticClass},`
+ }
+ if (el.classBinding) {
+ data += `class:${el.classBinding},`
+ }
+ return data
+}
+
+function parseStaticClass (staticClass: ?string, options: CompilerOptions): StaticClassResult {
+ // "a b c" -> ["a", "b", "c"] => staticClass: ["a", "b", "c"]
+ // "a {{x}} c" -> ["a", x, "c"] => classBinding: '["a", x, "c"]'
+ let dynamic = false
+ let classResult = ''
+ if (staticClass) {
+ const classList = staticClass.trim().split(' ').map(name => {
+ const result = parseText(name, options.delimiters)
+ if (result) {
+ dynamic = true
+ return result.expression
+ }
+ return JSON.stringify(name)
+ })
+ if (classList.length) {
+ classResult = '[' + classList.join(',') + ']'
+ }
+ }
+ return { dynamic, classResult }
+}
+
+export default {
+ staticKeys: ['staticClass'],
+ transformNode,
+ genData
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/index.js b/node_modules/vue/src/platforms/weex/compiler/modules/index.js
new file mode 100644
index 00000000..ac17809e
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/index.js
@@ -0,0 +1,13 @@
+import klass from './class'
+import style from './style'
+import props from './props'
+import append from './append'
+import recycleList from './recycle-list/index'
+
+export default [
+ recycleList,
+ klass,
+ style,
+ props,
+ append
+]
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/props.js b/node_modules/vue/src/platforms/weex/compiler/modules/props.js
new file mode 100644
index 00000000..8b0bb5f2
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/props.js
@@ -0,0 +1,32 @@
+/* @flow */
+
+import { cached, camelize } from 'shared/util'
+
+const normalize = cached(camelize)
+
+function normalizeKeyName (str: string): string {
+ if (str.match(/^v\-/)) {
+ return str.replace(/(v-[a-z\-]+\:)([a-z\-]+)$/i, ($, directive, prop) => {
+ return directive + normalize(prop)
+ })
+ }
+ return normalize(str)
+}
+
+function transformNode (el: ASTElement, options: CompilerOptions) {
+ if (Array.isArray(el.attrsList)) {
+ el.attrsList.forEach(attr => {
+ if (attr.name && attr.name.match(/\-/)) {
+ const realName = normalizeKeyName(attr.name)
+ if (el.attrsMap) {
+ el.attrsMap[realName] = el.attrsMap[attr.name]
+ delete el.attrsMap[attr.name]
+ }
+ attr.name = realName
+ }
+ })
+ }
+}
+export default {
+ transformNode
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/component-root.js b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/component-root.js
new file mode 100644
index 00000000..7d9fedea
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/component-root.js
@@ -0,0 +1,16 @@
+/* @flow */
+
+import { addAttr } from 'compiler/helpers'
+
+// mark component root nodes as
+export function postTransformComponentRoot (
+ el: ASTElement,
+ options: WeexCompilerOptions
+) {
+ if (!el.parent) {
+ // component root
+ addAttr(el, '@isComponentRoot', 'true')
+ addAttr(el, '@templateId', '_uid')
+ addAttr(el, '@componentProps', '$props || {}')
+ }
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/component.js b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/component.js
new file mode 100644
index 00000000..36d7dfd5
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/component.js
@@ -0,0 +1,16 @@
+/* @flow */
+
+import { addAttr } from 'compiler/helpers'
+import { RECYCLE_LIST_MARKER } from 'weex/util/index'
+
+// mark components as inside recycle-list so that we know we need to invoke
+// their special @render function instead of render in create-component.js
+export function postTransformComponent (
+ el: ASTElement,
+ options: WeexCompilerOptions
+) {
+ // $flow-disable-line (we know isReservedTag is there)
+ if (!options.isReservedTag(el.tag) && el.tag !== 'cell-slot') {
+ addAttr(el, RECYCLE_LIST_MARKER, 'true')
+ }
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/index.js b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/index.js
new file mode 100644
index 00000000..502cc782
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/index.js
@@ -0,0 +1,60 @@
+/* @flow */
+
+import { preTransformRecycleList } from './recycle-list'
+import { postTransformComponent } from './component'
+import { postTransformComponentRoot } from './component-root'
+import { postTransformText } from './text'
+import { preTransformVBind } from './v-bind'
+import { preTransformVIf } from './v-if'
+import { preTransformVFor } from './v-for'
+import { postTransformVOn } from './v-on'
+import { preTransformVOnce } from './v-once'
+
+let currentRecycleList = null
+
+function shouldCompile (el: ASTElement, options: WeexCompilerOptions) {
+ return options.recyclable ||
+ (currentRecycleList && el !== currentRecycleList)
+}
+
+function preTransformNode (el: ASTElement, options: WeexCompilerOptions) {
+ if (el.tag === 'recycle-list') {
+ preTransformRecycleList(el, options)
+ currentRecycleList = el
+ }
+ if (shouldCompile(el, options)) {
+ preTransformVBind(el, options)
+ preTransformVIf(el, options) // also v-else-if and v-else
+ preTransformVFor(el, options)
+ preTransformVOnce(el, options)
+ }
+}
+
+function transformNode (el: ASTElement, options: WeexCompilerOptions) {
+ if (shouldCompile(el, options)) {
+ // do nothing yet
+ }
+}
+
+function postTransformNode (el: ASTElement, options: WeexCompilerOptions) {
+ if (shouldCompile(el, options)) {
+ // mark child component in parent template
+ postTransformComponent(el, options)
+ // mark root in child component template
+ postTransformComponentRoot(el, options)
+ // <text>: transform children text into value attr
+ if (el.tag === 'text') {
+ postTransformText(el, options)
+ }
+ postTransformVOn(el, options)
+ }
+ if (el === currentRecycleList) {
+ currentRecycleList = null
+ }
+}
+
+export default {
+ preTransformNode,
+ transformNode,
+ postTransformNode
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/recycle-list.js b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/recycle-list.js
new file mode 100644
index 00000000..7fb65167
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/recycle-list.js
@@ -0,0 +1,50 @@
+/* @flow */
+
+import { parseFor } from 'compiler/parser/index'
+import { getAndRemoveAttr, addRawAttr } from 'compiler/helpers'
+
+/**
+ * Map the following syntax to corresponding attrs:
+ *
+ * <recycle-list for="(item, i) in longList" switch="cellType">
+ * <cell-slot case="A"> ... </cell-slot>
+ * <cell-slot case="B"> ... </cell-slot>
+ * </recycle-list>
+ */
+
+export function preTransformRecycleList (
+ el: ASTElement,
+ options: WeexCompilerOptions
+) {
+ const exp = getAndRemoveAttr(el, 'for')
+ if (!exp) {
+ if (options.warn) {
+ options.warn(`Invalid <recycle-list> syntax: missing "for" expression.`)
+ }
+ return
+ }
+
+ const res = parseFor(exp)
+ if (!res) {
+ if (options.warn) {
+ options.warn(`Invalid <recycle-list> syntax: ${exp}.`)
+ }
+ return
+ }
+
+ addRawAttr(el, ':list-data', res.for)
+ addRawAttr(el, 'binding-expression', res.for)
+ addRawAttr(el, 'alias', res.alias)
+ if (res.iterator2) {
+ // (item, key, index) for object iteration
+ // is this even supported?
+ addRawAttr(el, 'index', res.iterator2)
+ } else if (res.iterator1) {
+ addRawAttr(el, 'index', res.iterator1)
+ }
+
+ const switchKey = getAndRemoveAttr(el, 'switch')
+ if (switchKey) {
+ addRawAttr(el, 'switch', switchKey)
+ }
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/text.js b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/text.js
new file mode 100644
index 00000000..575ec7f6
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/text.js
@@ -0,0 +1,23 @@
+/* @flow */
+
+import { addAttr } from 'compiler/helpers'
+
+function genText (node: ASTNode) {
+ const value = node.type === 3
+ ? node.text
+ : node.type === 2
+ ? node.tokens.length === 1
+ ? node.tokens[0]
+ : node.tokens
+ : ''
+ return JSON.stringify(value)
+}
+
+export function postTransformText (el: ASTElement, options: WeexCompilerOptions) {
+ // weex <text> can only contain text, so the parser
+ // always generates a single child.
+ if (el.children.length) {
+ addAttr(el, 'value', genText(el.children[0]))
+ el.children = []
+ }
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-bind.js b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-bind.js
new file mode 100644
index 00000000..effdf351
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-bind.js
@@ -0,0 +1,21 @@
+/* @flow */
+
+import { camelize } from 'shared/util'
+import { generateBinding } from 'weex/util/parser'
+import { bindRE } from 'compiler/parser/index'
+import { getAndRemoveAttr, addRawAttr } from 'compiler/helpers'
+
+function parseAttrName (name: string): string {
+ return camelize(name.replace(bindRE, ''))
+}
+
+export function preTransformVBind (el: ASTElement, options: WeexCompilerOptions) {
+ for (const attr in el.attrsMap) {
+ if (bindRE.test(attr)) {
+ const name: string = parseAttrName(attr)
+ const value = generateBinding(getAndRemoveAttr(el, attr))
+ delete el.attrsMap[attr]
+ addRawAttr(el, name, value)
+ }
+ }
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-for.js b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-for.js
new file mode 100644
index 00000000..9f09e4b4
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-for.js
@@ -0,0 +1,33 @@
+/* @flow */
+
+import { parseFor } from 'compiler/parser/index'
+import { getAndRemoveAttr, addRawAttr } from 'compiler/helpers'
+
+export function preTransformVFor (el: ASTElement, options: WeexCompilerOptions) {
+ const exp = getAndRemoveAttr(el, 'v-for')
+ if (!exp) {
+ return
+ }
+
+ const res = parseFor(exp)
+ if (!res) {
+ if (process.env.NODE_ENV !== 'production' && options.warn) {
+ options.warn(`Invalid v-for expression: ${exp}`)
+ }
+ return
+ }
+
+ const desc: Object = {
+ '@expression': res.for,
+ '@alias': res.alias
+ }
+ if (res.iterator2) {
+ desc['@key'] = res.iterator1
+ desc['@index'] = res.iterator2
+ } else {
+ desc['@index'] = res.iterator1
+ }
+
+ delete el.attrsMap['v-for']
+ addRawAttr(el, '[[repeat]]', desc)
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-if.js b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-if.js
new file mode 100644
index 00000000..d82ba632
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-if.js
@@ -0,0 +1,63 @@
+/* @flow */
+
+import { addIfCondition } from 'compiler/parser/index'
+import { getAndRemoveAttr, addRawAttr } from 'compiler/helpers'
+
+function hasConditionDirective (el: ASTElement): boolean {
+ for (const attr in el.attrsMap) {
+ if (/^v\-if|v\-else|v\-else\-if$/.test(attr)) {
+ return true
+ }
+ }
+ return false
+}
+
+function getPreviousConditions (el: ASTElement): Array<string> {
+ const conditions = []
+ if (el.parent && el.parent.children) {
+ for (let c = 0, n = el.parent.children.length; c < n; ++c) {
+ // $flow-disable-line
+ const ifConditions = el.parent.children[c].ifConditions
+ if (ifConditions) {
+ for (let i = 0, l = ifConditions.length; i < l; ++i) {
+ const condition = ifConditions[i]
+ if (condition && condition.exp) {
+ conditions.push(condition.exp)
+ }
+ }
+ }
+ }
+ }
+ return conditions
+}
+
+export function preTransformVIf (el: ASTElement, options: WeexCompilerOptions) {
+ if (hasConditionDirective(el)) {
+ let exp
+ const ifExp = getAndRemoveAttr(el, 'v-if', true /* remove from attrsMap */)
+ const elseifExp = getAndRemoveAttr(el, 'v-else-if', true)
+ // don't need the value, but remove it to avoid being generated as a
+ // custom directive
+ getAndRemoveAttr(el, 'v-else', true)
+ if (ifExp) {
+ exp = ifExp
+ addIfCondition(el, { exp: ifExp, block: el })
+ } else {
+ elseifExp && addIfCondition(el, { exp: elseifExp, block: el })
+ const prevConditions = getPreviousConditions(el)
+ if (prevConditions.length) {
+ const prevMatch = prevConditions.join(' || ')
+ exp = elseifExp
+ ? `!(${prevMatch}) && (${elseifExp})` // v-else-if
+ : `!(${prevMatch})` // v-else
+ } else if (process.env.NODE_ENV !== 'production' && options.warn) {
+ options.warn(
+ `v-${elseifExp ? ('else-if="' + elseifExp + '"') : 'else'} ` +
+ `used on element <${el.tag}> without corresponding v-if.`
+ )
+ return
+ }
+ }
+ addRawAttr(el, '[[match]]', exp)
+ }
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-on.js b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-on.js
new file mode 100644
index 00000000..b1ba262c
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-on.js
@@ -0,0 +1,25 @@
+/* @flow */
+
+const inlineStatementRE = /^\s*([A-Za-z_$0-9\['\."\]]+)*\s*\(\s*(([A-Za-z_$0-9\['\."\]]+)?(\s*,\s*([A-Za-z_$0-9\['\."\]]+))*)\s*\)$/
+
+function parseHandlerParams (handler: ASTElementHandler) {
+ const res = inlineStatementRE.exec(handler.value)
+ if (res && res[2]) {
+ handler.params = res[2].split(/\s*,\s*/)
+ }
+}
+
+export function postTransformVOn (el: ASTElement, options: WeexCompilerOptions) {
+ const events: ASTElementHandlers | void = el.events
+ if (!events) {
+ return
+ }
+ for (const name in events) {
+ const handler: ASTElementHandler | Array<ASTElementHandler> = events[name]
+ if (Array.isArray(handler)) {
+ handler.map(fn => parseHandlerParams(fn))
+ } else {
+ parseHandlerParams(handler)
+ }
+ }
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-once.js b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-once.js
new file mode 100644
index 00000000..baff838a
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/recycle-list/v-once.js
@@ -0,0 +1,19 @@
+/* @flow */
+
+import { getAndRemoveAttr, addRawAttr } from 'compiler/helpers'
+
+function containVOnce (el: ASTElement): boolean {
+ for (const attr in el.attrsMap) {
+ if (/^v\-once$/i.test(attr)) {
+ return true
+ }
+ }
+ return false
+}
+
+export function preTransformVOnce (el: ASTElement, options: WeexCompilerOptions) {
+ if (containVOnce(el)) {
+ getAndRemoveAttr(el, 'v-once', true)
+ addRawAttr(el, '[[once]]', true)
+ }
+}
diff --git a/node_modules/vue/src/platforms/weex/compiler/modules/style.js b/node_modules/vue/src/platforms/weex/compiler/modules/style.js
new file mode 100644
index 00000000..7bf5027f
--- /dev/null
+++ b/node_modules/vue/src/platforms/weex/compiler/modules/style.js
@@ -0,0 +1,86 @@
+/* @flow */
+
+import { cached, camelize, isPlainObject } from 'shared/util'
+import { parseText } from 'compiler/parser/text-parser'
+import {
+ getAndRemoveAttr,
+ getBindingAttr,
+ baseWarn
+} from 'compiler/helpers'
+
+type StaticStyleResult = {
+ dynamic: boolean,
+ styleResult: string | Object | void
+};
+
+const normalize = cached(camelize)
+
+function transformNode (el: ASTElement, options: CompilerOptions) {
+ const warn = options.warn || baseWarn
+ const staticStyle = getAndRemoveAttr(el, 'style')
+ const { dynamic, styleResult } = parseStaticStyle(staticStyle, options)
+ if (process.env.NODE_ENV !== 'production' && dynamic) {
+ warn(
+ `style="${String(staticStyle)}": ` +
+ 'Interpolation inside attributes has been deprecated. ' +
+ 'Use v-bind or the colon shorthand instead.'
+ )
+ }
+ if (!dynamic && styleResult) {
+ // $flow-disable-line
+ el.staticStyle = styleResult
+ }
+ const styleBinding = getBindingAttr(el, 'style', false /* getStatic */)
+ if (styleBinding) {
+ el.styleBinding = styleBinding
+ } else if (dynamic) {
+ // $flow-disable-line
+ el.styleBinding = styleResult
+ }
+}
+
+function genData (el: ASTElement): string {
+ let data = ''
+ if (el.staticStyle) {
+ data += `staticStyle:${el.staticStyle},`
+ }
+ if (el.styleBinding) {
+ data += `style:${el.styleBinding},`
+ }
+ return data
+}
+
+function parseStaticStyle (staticStyle: ?string, options: CompilerOptions): StaticStyleResult {
+ // "width: 200px; height: 200px;" -> {width: 200, height: 200}
+ // "width: 200px; height: {{y}}" -> {width: 200, height: y}
+ let dynamic = false
+ let styleResult = ''
+ if (typeof staticStyle === 'string') {
+ const styleList = staticStyle.trim().split(';').map(style => {
+ const result = style.trim().split(':')
+ if (result.length !== 2) {
+ return
+ }
+ const key = normalize(result[0].trim())
+ const value = result[1].trim()
+ const dynamicValue = parseText(value, options.delimiters)
+ if (dynamicValue) {
+ dynamic = true
+ return key + ':' + dynamicValue.expression
+ }
+ return key + ':' + JSON.stringify(value)
+ }).filter(result => result)
+ if (styleList.length) {
+ styleResult = '{' + styleList.join(',') + '}'
+ }
+ } else if (isPlainObject(staticStyle)) {
+ styleResult = JSON.stringify(staticStyle) || ''
+ }
+ return { dynamic, styleResult }
+}
+
+export default {
+ staticKeys: ['staticStyle'],
+ transformNode,
+ genData
+}