@tarojs/shared 4.0.8-beta.0 → 4.0.8-beta.3
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/dist/components.js +1 -1
- package/dist/components.js.map +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/event-channel.js.map +1 -1
- package/dist/event-emitter.js.map +1 -1
- package/dist/index.cjs.js +8 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/is.js +1 -1
- package/dist/is.js.map +1 -1
- package/dist/native-apis.js.map +1 -1
- package/dist/runtime-hooks.js +1 -0
- package/dist/runtime-hooks.js.map +1 -1
- package/dist/shared.esm.js +8 -3
- package/dist/shared.esm.js.map +1 -1
- package/dist/shortcuts.js +1 -1
- package/dist/shortcuts.js.map +1 -1
- package/dist/template.d.ts +1 -0
- package/dist/template.js +29 -17
- package/dist/template.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +3 -3
package/dist/template.js
CHANGED
|
@@ -310,10 +310,10 @@ const voidElements = new Set([
|
|
|
310
310
|
const nestElements = new Map([
|
|
311
311
|
['view', -1],
|
|
312
312
|
['catch-view', -1],
|
|
313
|
-
['click-view', -1],
|
|
314
313
|
['cover-view', -1],
|
|
315
314
|
['static-view', -1],
|
|
316
315
|
['pure-view', -1],
|
|
316
|
+
['click-view', -1],
|
|
317
317
|
['block', -1],
|
|
318
318
|
['text', -1],
|
|
319
319
|
['static-text', 6],
|
|
@@ -329,6 +329,7 @@ const nestElements = new Map([
|
|
|
329
329
|
var PLATFORM_TYPE;
|
|
330
330
|
(function (PLATFORM_TYPE) {
|
|
331
331
|
PLATFORM_TYPE["MINI"] = "mini";
|
|
332
|
+
PLATFORM_TYPE["ASCF"] = "ascf";
|
|
332
333
|
PLATFORM_TYPE["WEB"] = "web";
|
|
333
334
|
PLATFORM_TYPE["RN"] = "rn";
|
|
334
335
|
PLATFORM_TYPE["HARMONY"] = "harmony";
|
|
@@ -342,6 +343,9 @@ const COMPILE_MODE_IDENTIFIER_PREFIX = 'f';
|
|
|
342
343
|
harmony: {
|
|
343
344
|
type: PLATFORM_TYPE.HARMONY
|
|
344
345
|
},
|
|
346
|
+
ascf: {
|
|
347
|
+
type: PLATFORM_TYPE.ASCF
|
|
348
|
+
},
|
|
345
349
|
mini: {
|
|
346
350
|
type: PLATFORM_TYPE.MINI
|
|
347
351
|
},
|
|
@@ -365,7 +369,7 @@ function isNumber(o) {
|
|
|
365
369
|
return typeof o === 'number';
|
|
366
370
|
}
|
|
367
371
|
function isBooleanStringLiteral(o) {
|
|
368
|
-
return o === 'true' || o === 'false';
|
|
372
|
+
return o === 'true' || o === 'false' || o === '!0' || o === '!1';
|
|
369
373
|
}
|
|
370
374
|
function isObjectStringLiteral(o) {
|
|
371
375
|
return o === '{}';
|
|
@@ -379,7 +383,7 @@ exports.Shortcuts = void 0;
|
|
|
379
383
|
Shortcuts["Text"] = "v";
|
|
380
384
|
Shortcuts["NodeType"] = "nt";
|
|
381
385
|
Shortcuts["NodeName"] = "nn";
|
|
382
|
-
//
|
|
386
|
+
// Attributes
|
|
383
387
|
Shortcuts["Sid"] = "sid";
|
|
384
388
|
Shortcuts["Style"] = "st";
|
|
385
389
|
Shortcuts["Class"] = "cl";
|
|
@@ -507,6 +511,7 @@ const defaultMiniLifecycle = {
|
|
|
507
511
|
'defer:onTabItemTap', // defer: 需要等页面组件挂载后再调用
|
|
508
512
|
'onTitleClick',
|
|
509
513
|
'onOptionMenuClick',
|
|
514
|
+
'events:onKeyboardHeight', // events: 支付宝平台需要挂载到 config.events 上
|
|
510
515
|
'onPopMenuClick',
|
|
511
516
|
'onPullIntercept',
|
|
512
517
|
'onAddToFavorites'
|
|
@@ -879,10 +884,6 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
879
884
|
propValue = `i.${propAlias}`;
|
|
880
885
|
}
|
|
881
886
|
else if (isBooleanStringLiteral(propValue) || isNumber(+propValue)) {
|
|
882
|
-
// cursor 默认取最后输入框最后一位 fix #13809
|
|
883
|
-
if (prop === 'cursor') {
|
|
884
|
-
propValue = `i.${componentAlias.value}?i.${componentAlias.value}.length:-1`;
|
|
885
|
-
}
|
|
886
887
|
propValue = this.isUseXS
|
|
887
888
|
? `xs.b(i.${propAlias},${propValue})`
|
|
888
889
|
: `i.${propAlias}===undefined?${propValue}:i.${propAlias}`;
|
|
@@ -930,11 +931,7 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
930
931
|
style: comp.style,
|
|
931
932
|
class: comp.class
|
|
932
933
|
};
|
|
933
|
-
result['click-view'] = {
|
|
934
|
-
style: comp.style,
|
|
935
|
-
class: comp.class,
|
|
936
|
-
bindtap: 'eh'
|
|
937
|
-
};
|
|
934
|
+
result['click-view'] = Object.assign({ style: comp.style, class: comp.class }, this.getClickEvent());
|
|
938
935
|
}
|
|
939
936
|
}
|
|
940
937
|
if (compName === 'slot' || compName === 'slot-view') {
|
|
@@ -945,6 +942,9 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
945
942
|
name: newComp === null || newComp === void 0 ? void 0 : newComp.name,
|
|
946
943
|
};
|
|
947
944
|
}
|
|
945
|
+
else if (compName === 'list-builder') {
|
|
946
|
+
result[compName] = Object.assign(Object.assign({}, newComp), { list: 'i.cn' });
|
|
947
|
+
}
|
|
948
948
|
else {
|
|
949
949
|
result[compName] = newComp;
|
|
950
950
|
}
|
|
@@ -1019,7 +1019,7 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1019
1019
|
? this.buildFocusComponentTemplate(comp, level)
|
|
1020
1020
|
: this.buildStandardComponentTemplate(comp, level);
|
|
1021
1021
|
}
|
|
1022
|
-
getChildrenTemplate(level) {
|
|
1022
|
+
getChildrenTemplate(level, useSlotItem = false) {
|
|
1023
1023
|
const { isSupportRecursive, isUseXS, Adapter, isUseCompileMode = true } = this;
|
|
1024
1024
|
const isLastRecursiveComp = !isSupportRecursive && level + 1 === this.baseLevel;
|
|
1025
1025
|
const isUnRecursiveXs = !this.isSupportRecursive && isUseXS;
|
|
@@ -1030,9 +1030,13 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1030
1030
|
: this.isSupportRecursive
|
|
1031
1031
|
? this.dataKeymap('i:item')
|
|
1032
1032
|
: this.dataKeymap('i:item,c:c');
|
|
1033
|
-
|
|
1033
|
+
const tmpl = isUseXS
|
|
1034
1034
|
? `<template is="{{xs.e(${level})}}" data="{{${data}}}" ${forAttribute} />`
|
|
1035
1035
|
: `<template is="tmpl_${level}_${"container" /* Shortcuts.Container */}" data="{{${data}}}" ${forAttribute} />`;
|
|
1036
|
+
if (useSlotItem) {
|
|
1037
|
+
return `<block slot:item slot:index>${tmpl.replace(forAttribute, '')}</block>`;
|
|
1038
|
+
}
|
|
1039
|
+
return tmpl;
|
|
1036
1040
|
}
|
|
1037
1041
|
else {
|
|
1038
1042
|
const data = isUnRecursiveXs
|
|
@@ -1045,19 +1049,24 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1045
1049
|
const xs = !this.isSupportRecursive
|
|
1046
1050
|
? `xs.a(c, item.${"nn" /* Shortcuts.NodeName */}, l)`
|
|
1047
1051
|
: `xs.a(0, item.${"nn" /* Shortcuts.NodeName */})`;
|
|
1048
|
-
|
|
1052
|
+
const tmpl = isUseXS
|
|
1049
1053
|
? `<template is="{{${xs}}}" data="{{${data}}}" ${forAttribute} />`
|
|
1050
1054
|
: isSupportRecursive
|
|
1051
1055
|
? `<template is="{{'tmpl_0_' + item.${"nn" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />`
|
|
1052
1056
|
: isUseCompileMode
|
|
1053
1057
|
? `<template is="{{'tmpl_' + (item.${"nn" /* Shortcuts.NodeName */}[0]==='${COMPILE_MODE_IDENTIFIER_PREFIX}' ? 0 : c) + '_' + item.${"nn" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />`
|
|
1054
1058
|
: `<template is="{{'tmpl_' + c + '_' + item.${"nn" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />`;
|
|
1059
|
+
if (useSlotItem) {
|
|
1060
|
+
return `<block slot:item slot:index>${tmpl.replace(forAttribute, '')}</block>`;
|
|
1061
|
+
}
|
|
1062
|
+
return tmpl;
|
|
1055
1063
|
}
|
|
1056
1064
|
}
|
|
1057
1065
|
getChildren(comp, level) {
|
|
1058
1066
|
const { isSupportRecursive } = this;
|
|
1059
1067
|
const nextLevel = isSupportRecursive ? 0 : level + 1;
|
|
1060
|
-
|
|
1068
|
+
const isListBuilder = comp.nodeName === 'list-builder';
|
|
1069
|
+
let child = this.getChildrenTemplate(nextLevel, isListBuilder);
|
|
1061
1070
|
if (isFunction(this.modifyLoopBody)) {
|
|
1062
1071
|
child = this.modifyLoopBody(child, comp.nodeName);
|
|
1063
1072
|
}
|
|
@@ -1106,9 +1115,9 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1106
1115
|
case 'slot':
|
|
1107
1116
|
case 'slot-view':
|
|
1108
1117
|
case 'catch-view':
|
|
1109
|
-
case 'click-view':
|
|
1110
1118
|
case 'static-view':
|
|
1111
1119
|
case 'pure-view':
|
|
1120
|
+
case 'click-view':
|
|
1112
1121
|
nodeName = 'view';
|
|
1113
1122
|
break;
|
|
1114
1123
|
case 'static-text':
|
|
@@ -1195,6 +1204,9 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1195
1204
|
getEvents() {
|
|
1196
1205
|
return events;
|
|
1197
1206
|
}
|
|
1207
|
+
getClickEvent() {
|
|
1208
|
+
return { bindtap: 'eh' };
|
|
1209
|
+
}
|
|
1198
1210
|
getAttrValue(value, _key, _nodeName) {
|
|
1199
1211
|
return `{${value}}`;
|
|
1200
1212
|
}
|