@tarojs/shared 4.1.12-alpha.4 → 4.1.12-alpha.6

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.
@@ -28,3 +28,6 @@ export declare const PLATFORM_CONFIG_MAP: {
28
28
  type: PLATFORM_TYPE;
29
29
  };
30
30
  };
31
+ export declare const TT_SPECIFIC_COMPONENTS: Set<string>;
32
+ export declare const DEFAULT_COMPONENTS: Set<string>;
33
+ export declare const UNITLESS_PROPERTIES_SET: Set<string>;
package/dist/constants.js CHANGED
@@ -29,6 +29,117 @@ const PLATFORM_CONFIG_MAP = {
29
29
  type: PLATFORM_TYPE.QUICK
30
30
  },
31
31
  };
32
+ const TT_SPECIFIC_COMPONENTS = new Set([
33
+ 'page-container',
34
+ 'slot',
35
+ 'custom-wrapper',
36
+ 'clue-order-form',
37
+ 'aweme-group',
38
+ 'pay-button',
39
+ 'address-area',
40
+ 'consume-card',
41
+ 'aweme-data',
42
+ 'rate-button',
43
+ 'store-area',
44
+ 'inline-payment-panel',
45
+ 'aweme-user-card',
46
+ 'aweme-live-book',
47
+ 'draw-ad',
48
+ 'lynx-view',
49
+ 'flow-ad',
50
+ 'ai-agent-chat',
51
+ 'component'
52
+ ]);
53
+ const DEFAULT_COMPONENTS = new Set([
54
+ 'view',
55
+ 'scroll-view',
56
+ 'swiper',
57
+ 'cover-view',
58
+ 'cover-image',
59
+ 'icon',
60
+ 'text',
61
+ 'rich-text',
62
+ 'progress',
63
+ 'button',
64
+ 'checkbox',
65
+ 'form',
66
+ 'input',
67
+ 'label',
68
+ 'picker',
69
+ 'picker-view',
70
+ 'picker-view-column',
71
+ 'radio',
72
+ 'radio-group',
73
+ 'checkbox-group',
74
+ 'slider',
75
+ 'switch',
76
+ 'textarea',
77
+ 'navigator',
78
+ 'audio',
79
+ 'image',
80
+ 'video',
81
+ 'camera',
82
+ 'live-player',
83
+ 'live-pusher',
84
+ 'map',
85
+ 'canvas',
86
+ 'open-data',
87
+ 'web-view',
88
+ 'swiper-item',
89
+ 'movable-area',
90
+ 'movable-view',
91
+ 'functional-page-navigator',
92
+ 'ad',
93
+ 'block',
94
+ 'import',
95
+ 'official-account',
96
+ 'editor'
97
+ ]);
98
+ const UNITLESS_PROPERTIES_SET = new Set([
99
+ 'animation-iteration-count',
100
+ 'border-image-outset',
101
+ 'border-image-slice',
102
+ 'border-image-width',
103
+ 'box-flex',
104
+ 'box-flex-group',
105
+ 'box-ordinal-group',
106
+ 'column-count',
107
+ 'columns',
108
+ 'flex',
109
+ 'flex-grow',
110
+ 'flex-positive',
111
+ 'flex-shrink',
112
+ 'flex-negative',
113
+ 'flex-order',
114
+ 'grid-area',
115
+ 'grid-row',
116
+ 'grid-row-end',
117
+ 'grid-row-span',
118
+ 'grid-row-start',
119
+ 'grid-column',
120
+ 'grid-column-end',
121
+ 'grid-column-span',
122
+ 'grid-column-start',
123
+ 'font-weight',
124
+ 'line-clamp',
125
+ 'line-height',
126
+ 'opacity',
127
+ 'order',
128
+ 'orphans',
129
+ 'tab-size',
130
+ 'widows',
131
+ 'z-index',
132
+ 'zoom',
133
+ // SVG-related properties
134
+ 'fill-opacity',
135
+ 'flood-opacity',
136
+ 'stop-opacity',
137
+ 'stroke-dasharray',
138
+ 'stroke-dashoffset',
139
+ 'stroke-miterlimit',
140
+ 'stroke-opacity',
141
+ 'stroke-width',
142
+ ]);
32
143
 
33
- export { COMPILE_MODE_IDENTIFIER_PREFIX, COMPILE_MODE_SUB_RENDER_FN, PLATFORM_CONFIG_MAP, PLATFORM_TYPE };
144
+ export { COMPILE_MODE_IDENTIFIER_PREFIX, COMPILE_MODE_SUB_RENDER_FN, DEFAULT_COMPONENTS, PLATFORM_CONFIG_MAP, PLATFORM_TYPE, TT_SPECIFIC_COMPONENTS, UNITLESS_PROPERTIES_SET };
34
145
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export enum PLATFORM_TYPE {\n MINI = 'mini',\n ASCF = 'ascf',\n WEB = 'web',\n RN = 'rn',\n HARMONY = 'harmony',\n QUICK = 'quickapp',\n}\n\nexport const COMPILE_MODE_IDENTIFIER_PREFIX = 'f'\n\nexport const COMPILE_MODE_SUB_RENDER_FN = 'subRenderFn'\n\nexport const PLATFORM_CONFIG_MAP = {\n h5: {\n type: PLATFORM_TYPE.WEB\n },\n harmony: {\n type: PLATFORM_TYPE.HARMONY\n },\n ascf: {\n type: PLATFORM_TYPE.ASCF\n },\n mini: {\n type: PLATFORM_TYPE.MINI\n },\n rn: {\n type: PLATFORM_TYPE.RN\n },\n quickapp: {\n type: PLATFORM_TYPE.QUICK\n },\n}\n"],"names":[],"mappings":"IAAY;AAAZ,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,aAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,aAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,aAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,aAAA,CAAA,OAAA,CAAA,GAAA,UAAkB;AACpB,CAAC,EAPW,aAAa,KAAb,aAAa,GAOxB,EAAA,CAAA,CAAA;AAEM,MAAM,8BAA8B,GAAG;AAEvC,MAAM,0BAA0B,GAAG;AAE7B,MAAA,mBAAmB,GAAG;AACjC,IAAA,EAAE,EAAE;QACF,IAAI,EAAE,aAAa,CAAC;AACrB,KAAA;AACD,IAAA,OAAO,EAAE;QACP,IAAI,EAAE,aAAa,CAAC;AACrB,KAAA;AACD,IAAA,IAAI,EAAE;QACJ,IAAI,EAAE,aAAa,CAAC;AACrB,KAAA;AACD,IAAA,IAAI,EAAE;QACJ,IAAI,EAAE,aAAa,CAAC;AACrB,KAAA;AACD,IAAA,EAAE,EAAE;QACF,IAAI,EAAE,aAAa,CAAC;AACrB,KAAA;AACD,IAAA,QAAQ,EAAE;QACR,IAAI,EAAE,aAAa,CAAC;AACrB,KAAA;;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export enum PLATFORM_TYPE {\n MINI = 'mini',\n ASCF = 'ascf',\n WEB = 'web',\n RN = 'rn',\n HARMONY = 'harmony',\n QUICK = 'quickapp',\n}\n\nexport const COMPILE_MODE_IDENTIFIER_PREFIX = 'f'\n\nexport const COMPILE_MODE_SUB_RENDER_FN = 'subRenderFn'\n\nexport const PLATFORM_CONFIG_MAP = {\n h5: {\n type: PLATFORM_TYPE.WEB\n },\n harmony: {\n type: PLATFORM_TYPE.HARMONY\n },\n ascf: {\n type: PLATFORM_TYPE.ASCF\n },\n mini: {\n type: PLATFORM_TYPE.MINI\n },\n rn: {\n type: PLATFORM_TYPE.RN\n },\n quickapp: {\n type: PLATFORM_TYPE.QUICK\n },\n}\n\nexport const TT_SPECIFIC_COMPONENTS = new Set([\n 'page-container',\n 'slot',\n 'custom-wrapper',\n 'clue-order-form',\n 'aweme-group',\n 'pay-button',\n 'address-area',\n 'consume-card',\n 'aweme-data',\n 'rate-button',\n 'store-area',\n 'inline-payment-panel',\n 'aweme-user-card',\n 'aweme-live-book',\n 'draw-ad',\n 'lynx-view',\n 'flow-ad',\n 'ai-agent-chat',\n 'component'\n])\n\nexport const DEFAULT_COMPONENTS = new Set<string>([\n 'view',\n 'scroll-view',\n 'swiper',\n 'cover-view',\n 'cover-image',\n 'icon',\n 'text',\n 'rich-text',\n 'progress',\n 'button',\n 'checkbox',\n 'form',\n 'input',\n 'label',\n 'picker',\n 'picker-view',\n 'picker-view-column',\n 'radio',\n 'radio-group',\n 'checkbox-group',\n 'slider',\n 'switch',\n 'textarea',\n 'navigator',\n 'audio',\n 'image',\n 'video',\n 'camera',\n 'live-player',\n 'live-pusher',\n 'map',\n 'canvas',\n 'open-data',\n 'web-view',\n 'swiper-item',\n 'movable-area',\n 'movable-view',\n 'functional-page-navigator',\n 'ad',\n 'block',\n 'import',\n 'official-account',\n 'editor'\n])\n\nexport const UNITLESS_PROPERTIES_SET = new Set([\n 'animation-iteration-count',\n 'border-image-outset',\n 'border-image-slice',\n 'border-image-width',\n 'box-flex',\n 'box-flex-group',\n 'box-ordinal-group',\n 'column-count',\n 'columns',\n 'flex',\n 'flex-grow',\n 'flex-positive',\n 'flex-shrink',\n 'flex-negative',\n 'flex-order',\n 'grid-area',\n 'grid-row',\n 'grid-row-end',\n 'grid-row-span',\n 'grid-row-start',\n 'grid-column',\n 'grid-column-end',\n 'grid-column-span',\n 'grid-column-start',\n 'font-weight',\n 'line-clamp',\n 'line-height',\n 'opacity',\n 'order',\n 'orphans',\n 'tab-size',\n 'widows',\n 'z-index',\n 'zoom',\n // SVG-related properties\n 'fill-opacity',\n 'flood-opacity',\n 'stop-opacity',\n 'stroke-dasharray',\n 'stroke-dashoffset',\n 'stroke-miterlimit',\n 'stroke-opacity',\n 'stroke-width',\n])\n"],"names":[],"mappings":"IAAY;AAAZ,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,aAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,aAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,aAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,aAAA,CAAA,OAAA,CAAA,GAAA,UAAkB;AACpB,CAAC,EAPW,aAAa,KAAb,aAAa,GAOxB,EAAA,CAAA,CAAA;AAEM,MAAM,8BAA8B,GAAG;AAEvC,MAAM,0BAA0B,GAAG;AAE7B,MAAA,mBAAmB,GAAG;AACjC,IAAA,EAAE,EAAE;QACF,IAAI,EAAE,aAAa,CAAC;AACrB,KAAA;AACD,IAAA,OAAO,EAAE;QACP,IAAI,EAAE,aAAa,CAAC;AACrB,KAAA;AACD,IAAA,IAAI,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AAS;IACT,MAAM;IACN,WAAW;IACX,eAAe;IACf,aAAa;IACb,eAAe;IACf,YAAY;IACZ,WAAW;IACX,UAAU;IACV,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,iBAAiB;IACjB,kBAAkB;IAClB,mBAAmB;IACnB,aAAa;IACb,YAAY;IACZ,aAAa;IACb,SAAS;IACT,OAAO;IACP,SAAS;IACT,UAAU;IACV,QAAQ;IACR,SAAS;IACT,MAAM;;IAEN,cAAc;IACd,eAAe;IACf,cAAc;IACd,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,gBAAgB;IAChB,cAAc;AACf,CAAA;;;;"}
package/dist/index.cjs.js CHANGED
@@ -367,6 +367,117 @@ const PLATFORM_CONFIG_MAP = {
367
367
  type: exports.PLATFORM_TYPE.QUICK
368
368
  },
369
369
  };
370
+ const TT_SPECIFIC_COMPONENTS = new Set([
371
+ 'page-container',
372
+ 'slot',
373
+ 'custom-wrapper',
374
+ 'clue-order-form',
375
+ 'aweme-group',
376
+ 'pay-button',
377
+ 'address-area',
378
+ 'consume-card',
379
+ 'aweme-data',
380
+ 'rate-button',
381
+ 'store-area',
382
+ 'inline-payment-panel',
383
+ 'aweme-user-card',
384
+ 'aweme-live-book',
385
+ 'draw-ad',
386
+ 'lynx-view',
387
+ 'flow-ad',
388
+ 'ai-agent-chat',
389
+ 'component'
390
+ ]);
391
+ const DEFAULT_COMPONENTS = new Set([
392
+ 'view',
393
+ 'scroll-view',
394
+ 'swiper',
395
+ 'cover-view',
396
+ 'cover-image',
397
+ 'icon',
398
+ 'text',
399
+ 'rich-text',
400
+ 'progress',
401
+ 'button',
402
+ 'checkbox',
403
+ 'form',
404
+ 'input',
405
+ 'label',
406
+ 'picker',
407
+ 'picker-view',
408
+ 'picker-view-column',
409
+ 'radio',
410
+ 'radio-group',
411
+ 'checkbox-group',
412
+ 'slider',
413
+ 'switch',
414
+ 'textarea',
415
+ 'navigator',
416
+ 'audio',
417
+ 'image',
418
+ 'video',
419
+ 'camera',
420
+ 'live-player',
421
+ 'live-pusher',
422
+ 'map',
423
+ 'canvas',
424
+ 'open-data',
425
+ 'web-view',
426
+ 'swiper-item',
427
+ 'movable-area',
428
+ 'movable-view',
429
+ 'functional-page-navigator',
430
+ 'ad',
431
+ 'block',
432
+ 'import',
433
+ 'official-account',
434
+ 'editor'
435
+ ]);
436
+ const UNITLESS_PROPERTIES_SET = new Set([
437
+ 'animation-iteration-count',
438
+ 'border-image-outset',
439
+ 'border-image-slice',
440
+ 'border-image-width',
441
+ 'box-flex',
442
+ 'box-flex-group',
443
+ 'box-ordinal-group',
444
+ 'column-count',
445
+ 'columns',
446
+ 'flex',
447
+ 'flex-grow',
448
+ 'flex-positive',
449
+ 'flex-shrink',
450
+ 'flex-negative',
451
+ 'flex-order',
452
+ 'grid-area',
453
+ 'grid-row',
454
+ 'grid-row-end',
455
+ 'grid-row-span',
456
+ 'grid-row-start',
457
+ 'grid-column',
458
+ 'grid-column-end',
459
+ 'grid-column-span',
460
+ 'grid-column-start',
461
+ 'font-weight',
462
+ 'line-clamp',
463
+ 'line-height',
464
+ 'opacity',
465
+ 'order',
466
+ 'orphans',
467
+ 'tab-size',
468
+ 'widows',
469
+ 'z-index',
470
+ 'zoom',
471
+ // SVG-related properties
472
+ 'fill-opacity',
473
+ 'flood-opacity',
474
+ 'stop-opacity',
475
+ 'stroke-dasharray',
476
+ 'stroke-dashoffset',
477
+ 'stroke-miterlimit',
478
+ 'stroke-opacity',
479
+ 'stroke-width',
480
+ ]);
370
481
 
371
482
  class Events {
372
483
  constructor(opts) {
@@ -928,6 +1039,23 @@ function indent(str, size) {
928
1039
  })
929
1040
  .join('\n');
930
1041
  }
1042
+ exports.TTRenderType = void 0;
1043
+ (function (TTRenderType) {
1044
+ TTRenderType[TTRenderType["V1"] = 1] = "V1";
1045
+ TTRenderType[TTRenderType["V2"] = 2] = "V2";
1046
+ })(exports.TTRenderType || (exports.TTRenderType = {}));
1047
+ let ttUseV2TTDom;
1048
+ function isEnableTTDom() {
1049
+ // 目前仅对于 react 支持 ttdom
1050
+ if (process.env.TARO_ENV !== 'tt' || process.env.FRAMEWORK !== 'react' || typeof tt === 'undefined') {
1051
+ return false;
1052
+ }
1053
+ if (ttUseV2TTDom !== undefined)
1054
+ return ttUseV2TTDom;
1055
+ const ttMode = tt.getRenderMode ? tt.getRenderMode() : exports.TTRenderType.V1;
1056
+ ttMode === exports.TTRenderType.V2 && tt.__$enableTTDom$__ ? (ttUseV2TTDom = true) : (ttUseV2TTDom = false);
1057
+ return ttUseV2TTDom;
1058
+ }
931
1059
 
932
1060
  const needPromiseApis = new Set([
933
1061
  'addPhoneContact',
@@ -1303,13 +1431,16 @@ exports.Shortcuts = void 0;
1303
1431
 
1304
1432
  exports.COMPILE_MODE_IDENTIFIER_PREFIX = COMPILE_MODE_IDENTIFIER_PREFIX;
1305
1433
  exports.COMPILE_MODE_SUB_RENDER_FN = COMPILE_MODE_SUB_RENDER_FN;
1434
+ exports.DEFAULT_COMPONENTS = DEFAULT_COMPONENTS;
1306
1435
  exports.EMPTY_ARR = EMPTY_ARR;
1307
1436
  exports.EMPTY_OBJ = EMPTY_OBJ;
1308
1437
  exports.EventChannel = EventChannel;
1309
1438
  exports.Events = Events;
1310
1439
  exports.PLATFORM_CONFIG_MAP = PLATFORM_CONFIG_MAP;
1440
+ exports.TT_SPECIFIC_COMPONENTS = TT_SPECIFIC_COMPONENTS;
1311
1441
  exports.TaroHook = TaroHook;
1312
1442
  exports.TaroHooks = TaroHooks;
1443
+ exports.UNITLESS_PROPERTIES_SET = UNITLESS_PROPERTIES_SET;
1313
1444
  exports.animation = animation;
1314
1445
  exports.box = box;
1315
1446
  exports.cacheDataGet = cacheDataGet;
@@ -1329,6 +1460,7 @@ exports.internalComponents = internalComponents;
1329
1460
  exports.isArray = isArray;
1330
1461
  exports.isBoolean = isBoolean;
1331
1462
  exports.isBooleanStringLiteral = isBooleanStringLiteral;
1463
+ exports.isEnableTTDom = isEnableTTDom;
1332
1464
  exports.isFunction = isFunction;
1333
1465
  exports.isNull = isNull;
1334
1466
  exports.isNumber = isNumber;