@tarojs/shared
Advanced tools
Comparing version 4.0.7-alpha.0 to 4.0.7-alpha.1
@@ -1281,11 +1281,11 @@ 'use strict'; | ||
Shortcuts["Container"] = "container"; | ||
Shortcuts["Childnodes"] = "c"; | ||
Shortcuts["Childnodes"] = "cn"; | ||
Shortcuts["Text"] = "v"; | ||
Shortcuts["NodeType"] = "nt"; | ||
Shortcuts["NodeName"] = "n"; | ||
Shortcuts["NodeName"] = "nn"; | ||
// Attrtibutes | ||
Shortcuts["Sid"] = "sid"; | ||
Shortcuts["Style"] = "st"; | ||
Shortcuts["Class"] = "l"; | ||
Shortcuts["Class"] = "cl"; | ||
Shortcuts["Src"] = "src"; | ||
Shortcuts["Sid"] = "s"; | ||
})(exports.Shortcuts || (exports.Shortcuts = {})); | ||
@@ -1292,0 +1292,0 @@ |
@@ -39,3 +39,3 @@ import { Events } from './event-emitter'; | ||
uid?: string; | ||
[Shortcuts.Sid]: string; | ||
sid: string; | ||
[key: string]: unknown; | ||
@@ -42,0 +42,0 @@ } |
@@ -1279,11 +1279,11 @@ const DEFAULT_EMPTY_ARRAY = '[]'; | ||
Shortcuts["Container"] = "container"; | ||
Shortcuts["Childnodes"] = "c"; | ||
Shortcuts["Childnodes"] = "cn"; | ||
Shortcuts["Text"] = "v"; | ||
Shortcuts["NodeType"] = "nt"; | ||
Shortcuts["NodeName"] = "n"; | ||
Shortcuts["NodeName"] = "nn"; | ||
// Attrtibutes | ||
Shortcuts["Sid"] = "sid"; | ||
Shortcuts["Style"] = "st"; | ||
Shortcuts["Class"] = "l"; | ||
Shortcuts["Class"] = "cl"; | ||
Shortcuts["Src"] = "src"; | ||
Shortcuts["Sid"] = "s"; | ||
})(Shortcuts || (Shortcuts = {})); | ||
@@ -1290,0 +1290,0 @@ |
export declare const enum Shortcuts { | ||
Container = "container", | ||
Childnodes = "c", | ||
Childnodes = "cn", | ||
Text = "v", | ||
NodeType = "nt", | ||
NodeName = "n", | ||
NodeName = "nn", | ||
Sid = "sid", | ||
Style = "st", | ||
Class = "l", | ||
Src = "src", | ||
Sid = "s" | ||
Class = "cl", | ||
Src = "src" | ||
} |
@@ -5,11 +5,11 @@ // 字符串简写 | ||
Shortcuts["Container"] = "container"; | ||
Shortcuts["Childnodes"] = "c"; | ||
Shortcuts["Childnodes"] = "cn"; | ||
Shortcuts["Text"] = "v"; | ||
Shortcuts["NodeType"] = "nt"; | ||
Shortcuts["NodeName"] = "n"; | ||
Shortcuts["NodeName"] = "nn"; | ||
// Attrtibutes | ||
Shortcuts["Sid"] = "sid"; | ||
Shortcuts["Style"] = "st"; | ||
Shortcuts["Class"] = "l"; | ||
Shortcuts["Class"] = "cl"; | ||
Shortcuts["Src"] = "src"; | ||
Shortcuts["Sid"] = "s"; | ||
})(Shortcuts || (Shortcuts = {})); | ||
@@ -16,0 +16,0 @@ |
@@ -106,3 +106,3 @@ /** | ||
protected buildXSTmplName(): string; | ||
protected buildXSTepFocus(n: string): string; | ||
protected buildXSTepFocus(nn: string): string; | ||
protected buildXSTmpExtra(): string; | ||
@@ -109,0 +109,0 @@ } |
@@ -346,11 +346,11 @@ 'use strict'; | ||
Shortcuts["Container"] = "container"; | ||
Shortcuts["Childnodes"] = "c"; | ||
Shortcuts["Childnodes"] = "cn"; | ||
Shortcuts["Text"] = "v"; | ||
Shortcuts["NodeType"] = "nt"; | ||
Shortcuts["NodeName"] = "n"; | ||
Shortcuts["NodeName"] = "nn"; | ||
// Attrtibutes | ||
Shortcuts["Sid"] = "sid"; | ||
Shortcuts["Style"] = "st"; | ||
Shortcuts["Class"] = "l"; | ||
Shortcuts["Class"] = "cl"; | ||
Shortcuts["Src"] = "src"; | ||
Shortcuts["Sid"] = "s"; | ||
})(exports.Shortcuts || (exports.Shortcuts = {})); | ||
@@ -748,3 +748,3 @@ | ||
style: `i.${"st" /* Shortcuts.Style */}`, | ||
class: `i.${"l" /* Shortcuts.Class */}` | ||
class: `i.${"cl" /* Shortcuts.Class */}` | ||
}; | ||
@@ -789,3 +789,3 @@ const events = { | ||
const data = !this.isSupportRecursive && this.isUseXS | ||
? this.dataKeymap(`i:i,c:1,l:xs.f('',i.${"n" /* Shortcuts.NodeName */})`) | ||
? this.dataKeymap(`i:i,c:1,l:xs.f('',i.${"nn" /* Shortcuts.NodeName */})`) | ||
: this.isSupportRecursive | ||
@@ -796,3 +796,3 @@ ? this.dataKeymap('i:i') | ||
return `<import src="./base${ext}" /> | ||
${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + i.${"n" /* Shortcuts.NodeName */}}}" data="{{${data}}}" />`; | ||
${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + i.${"nn" /* Shortcuts.NodeName */}}}" data="{{${data}}}" />`; | ||
}; | ||
@@ -802,3 +802,3 @@ this.buildCustomComponentTemplate = (ext) => { | ||
const data = !this.isSupportRecursive && this.isUseXS | ||
? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"n" /* Shortcuts.NodeName */})`)}` | ||
? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"nn" /* Shortcuts.NodeName */})`)}` | ||
: this.isSupportRecursive | ||
@@ -809,3 +809,3 @@ ? this.dataKeymap('i:item') | ||
return `<import src="./base${ext}" /> | ||
${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"n" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${Adapter.for}="{{i.${"c" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="${"s" /* Shortcuts.Sid */}" /> | ||
${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${Adapter.for}="{{i.${"cn" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="${"sid" /* Shortcuts.Sid */}" /> | ||
`; | ||
@@ -819,3 +819,3 @@ }; | ||
}, | ||
c: ${this.buildXSTepFocus("n" /* Shortcuts.NodeName */)}, | ||
c: ${this.buildXSTepFocus("nn" /* Shortcuts.NodeName */)}, | ||
e: function (n) { | ||
@@ -948,3 +948,3 @@ return 'tmpl_' + n + '_${"container" /* Shortcuts.Container */}' | ||
const data = !this.isSupportRecursive && this.isUseXS | ||
? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"n" /* Shortcuts.NodeName */})`)}` | ||
? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"nn" /* Shortcuts.NodeName */})`)}` | ||
: this.isSupportRecursive | ||
@@ -955,7 +955,7 @@ ? this.dataKeymap('i:item') | ||
? (this.isSupportRecursive | ||
? `xs.a(0, item.${"n" /* Shortcuts.NodeName */})` | ||
: `xs.a(0, item.${"n" /* Shortcuts.NodeName */}, '')`) | ||
: `'tmpl_0_' + item.${"n" /* Shortcuts.NodeName */}`; | ||
? `xs.a(0, item.${"nn" /* Shortcuts.NodeName */})` | ||
: `xs.a(0, item.${"nn" /* Shortcuts.NodeName */}, '')`) | ||
: `'tmpl_0_' + item.${"nn" /* Shortcuts.NodeName */}`; | ||
return `${this.buildXsImportTemplate()}<template name="taro_tmpl"> | ||
<template is="{{${xs}}}" data="{{${data}}}" ${Adapter.for}="{{root.${"c" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="${"s" /* Shortcuts.Sid */}" /> | ||
<template is="{{${xs}}}" data="{{${data}}}" ${Adapter.for}="{{root.${"cn" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="${"sid" /* Shortcuts.Sid */}" /> | ||
</template> | ||
@@ -987,3 +987,3 @@ `; | ||
else if (attr === 'class') { | ||
return str + ` class="{{i.${"l" /* Shortcuts.Class */}}}"`; | ||
return str + ` class="{{i.${"cl" /* Shortcuts.Class */}}}"`; | ||
} | ||
@@ -1012,3 +1012,3 @@ else if (attr === 'style') { | ||
const isUnRecursiveXs = !this.isSupportRecursive && isUseXS; | ||
const forAttribute = `${Adapter.for}="{{i.${"c" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="${"s" /* Shortcuts.Sid */}"`; | ||
const forAttribute = `${Adapter.for}="{{i.${"cn" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="${"sid" /* Shortcuts.Sid */}"`; | ||
if (isLastRecursiveComp) { | ||
@@ -1028,3 +1028,3 @@ const data = isUnRecursiveXs | ||
// 但目前的监测方法用于所有组件嵌套的总和,应该分开组件计算,单个组件嵌套层级大于 baselevel 时,再进入 comp 组件中进行新的嵌套 | ||
? `${this.dataKeymap(`i:item,c:c+1,l:xs.f(l,item.${"n" /* Shortcuts.NodeName */})`)}` | ||
? `${this.dataKeymap(`i:item,c:c+1,l:xs.f(l,item.${"nn" /* Shortcuts.NodeName */})`)}` | ||
: this.isSupportRecursive | ||
@@ -1034,9 +1034,9 @@ ? `${this.dataKeymap('i:item')}` | ||
const xs = !this.isSupportRecursive | ||
? `xs.a(c, item.${"n" /* Shortcuts.NodeName */}, l)` | ||
: `xs.a(0, item.${"n" /* Shortcuts.NodeName */})`; | ||
? `xs.a(c, item.${"nn" /* Shortcuts.NodeName */}, l)` | ||
: `xs.a(0, item.${"nn" /* Shortcuts.NodeName */})`; | ||
return isUseXS | ||
? `<template is="{{${xs}}}" data="{{${data}}}" ${forAttribute} />` | ||
: isSupportRecursive | ||
? `<template is="{{'tmpl_0_' + item.${"n" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />` | ||
: `<template is="{{'tmpl_' + c + '_' + item.${"n" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />`; | ||
? `<template is="{{'tmpl_0_' + item.${"nn" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />` | ||
: `<template is="{{'tmpl_' + c + '_' + item.${"nn" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />`; | ||
} | ||
@@ -1076,7 +1076,7 @@ } | ||
<template name="tmpl_${level}_${nodeAlias}_focus"> | ||
<${nodeName} ${this.buildAttribute(comp.attributes, nodeName)} id="{{i.uid||i.${"s" /* Shortcuts.Sid */}}}" data-${"s" /* Shortcuts.Sid */}="{{i.${"s" /* Shortcuts.Sid */}}}">${children}</${nodeName}> | ||
<${nodeName} ${this.buildAttribute(comp.attributes, nodeName)} id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">${children}</${nodeName}> | ||
</template> | ||
<template name="tmpl_${level}_${nodeAlias}_blur"> | ||
<${nodeName} ${this.buildAttribute(attrs, nodeName)} id="{{i.uid||i.${"s" /* Shortcuts.Sid */}}}" data-${"s" /* Shortcuts.Sid */}="{{i.${"s" /* Shortcuts.Sid */}}}">${children}</${nodeName}> | ||
<${nodeName} ${this.buildAttribute(attrs, nodeName)} id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">${children}</${nodeName}> | ||
</template> | ||
@@ -1117,3 +1117,3 @@ `; | ||
<template name="tmpl_${level}_${nodeAlias}"> | ||
<${nodeName} ${this.buildAttribute(comp.attributes, comp.nodeName)} id="{{i.uid||i.${"s" /* Shortcuts.Sid */}}}" data-${"s" /* Shortcuts.Sid */}="{{i.${"s" /* Shortcuts.Sid */}}}">${children}</${nodeName}> | ||
<${nodeName} ${this.buildAttribute(comp.attributes, comp.nodeName)} id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">${children}</${nodeName}> | ||
</template> | ||
@@ -1141,3 +1141,3 @@ `; | ||
<template name="tmpl_${level}_${compName}"> | ||
<${compName} i="{{i}}" l="{{l}}" id="{{i.uid||i.${"s" /* Shortcuts.Sid */}}}" data-${"s" /* Shortcuts.Sid */}="{{i.${"s" /* Shortcuts.Sid */}}}"> | ||
<${compName} i="{{i}}" l="{{l}}" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}"> | ||
</${compName}> | ||
@@ -1161,3 +1161,3 @@ </template> | ||
<template name="tmpl_${level}_${compName}"> | ||
<${compName} ${this.buildThirdPartyAttr(attrs, this.thirdPartyPatcher[compName] || {})} id="{{i.uid||i.${"s" /* Shortcuts.Sid */}}}" data-${"s" /* Shortcuts.Sid */}="{{i.${"s" /* Shortcuts.Sid */}}}">${children}</${compName}> | ||
<${compName} ${this.buildThirdPartyAttr(attrs, this.thirdPartyPatcher[compName] || {})} id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">${children}</${compName}> | ||
</template> | ||
@@ -1171,3 +1171,3 @@ `; | ||
buildContainerTemplate(level) { | ||
const tmpl = `<block ${this.Adapter.if}="{{i.${"n" /* Shortcuts.NodeName */} === '${this.componentsAlias['#text']._num}'}}"> | ||
const tmpl = `<block ${this.Adapter.if}="{{i.nn === '${this.componentsAlias['#text']._num}'}}"> | ||
<template is="tmpl_0_${this.componentsAlias['#text']._num}" data="{{${this.dataKeymap('i:i')}}}" /> | ||
@@ -1210,6 +1210,6 @@ </block> | ||
} | ||
buildXSTepFocus(n) { | ||
buildXSTepFocus(nn) { | ||
return `function(i, prefix) { | ||
var s = i.focus !== undefined ? 'focus' : 'blur' | ||
return prefix + i.${n} + '_' + s | ||
return prefix + i.${nn} + '_' + s | ||
}`; | ||
@@ -1216,0 +1216,0 @@ } |
{ | ||
"name": "@tarojs/shared", | ||
"version": "4.0.7-alpha.0", | ||
"version": "4.0.7-alpha.1", | ||
"description": "Taro utils internal use.", | ||
@@ -5,0 +5,0 @@ "author": "O2Team", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
578342