@tarojs/shared 3.3.16 → 3.4.0-beta.1

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/template.js CHANGED
@@ -2,298 +2,254 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const styles = {
6
- style: `i.${"st" /* Style */}`,
7
- class: `i.${"cl" /* Class */}`
8
- };
9
- const events = {
10
- bindtap: 'eh'
11
- };
5
+ const DEFAULT_EMPTY_ARRAY = '[]';
6
+ const NO_DEFAULT_VALUE = '';
7
+ const DEFAULT_TRUE = 'true';
8
+ const DEFAULT_FALSE = 'false';
12
9
  const touchEvents = {
13
- bindTouchStart: '',
14
- bindTouchMove: '',
15
- bindTouchEnd: '',
16
- bindTouchCancel: '',
17
- bindLongTap: ''
18
- };
19
- const animationEvents = {
20
- bindAnimationStart: '',
21
- bindAnimationIteration: '',
22
- bindAnimationEnd: '',
23
- bindTransitionEnd: ''
10
+ bindTouchStart: NO_DEFAULT_VALUE,
11
+ bindTouchMove: NO_DEFAULT_VALUE,
12
+ bindTouchEnd: NO_DEFAULT_VALUE,
13
+ bindTouchCancel: NO_DEFAULT_VALUE,
14
+ bindLongTap: NO_DEFAULT_VALUE
15
+ };
16
+ const animation = {
17
+ animation: NO_DEFAULT_VALUE,
18
+ bindAnimationStart: NO_DEFAULT_VALUE,
19
+ bindAnimationIteration: NO_DEFAULT_VALUE,
20
+ bindAnimationEnd: NO_DEFAULT_VALUE,
21
+ bindTransitionEnd: NO_DEFAULT_VALUE
24
22
  };
25
23
  function singleQuote(s) {
26
24
  return `'${s}'`;
27
25
  }
28
- const View = Object.assign(Object.assign({ 'hover-class': singleQuote('none'), 'hover-stop-propagation': 'false', 'hover-start-time': '50', 'hover-stay-time': '400', animation: '' }, touchEvents), animationEvents);
26
+ const View = Object.assign(Object.assign({ 'hover-class': singleQuote('none'), 'hover-stop-propagation': DEFAULT_FALSE, 'hover-start-time': '50', 'hover-stay-time': '400' }, touchEvents), animation);
29
27
  const Icon = {
30
- type: '',
28
+ type: NO_DEFAULT_VALUE,
31
29
  size: '23',
32
- color: ''
30
+ color: NO_DEFAULT_VALUE
33
31
  };
34
- const MapComp = Object.assign({ longitude: '', latitude: '', scale: '16', markers: '[]', covers: '', polyline: '[]', circles: '[]', controls: '[]', 'include-points': '[]', 'show-location': '', 'layer-style': '1', bindMarkerTap: '', bindControlTap: '', bindCalloutTap: '', bindUpdated: '' }, touchEvents);
32
+ const MapComp = Object.assign({ longitude: NO_DEFAULT_VALUE, latitude: NO_DEFAULT_VALUE, scale: '16', markers: DEFAULT_EMPTY_ARRAY, covers: NO_DEFAULT_VALUE, polyline: DEFAULT_EMPTY_ARRAY, circles: DEFAULT_EMPTY_ARRAY, controls: DEFAULT_EMPTY_ARRAY, 'include-points': DEFAULT_EMPTY_ARRAY, 'show-location': NO_DEFAULT_VALUE, 'layer-style': '1', bindMarkerTap: NO_DEFAULT_VALUE, bindControlTap: NO_DEFAULT_VALUE, bindCalloutTap: NO_DEFAULT_VALUE, bindUpdated: NO_DEFAULT_VALUE }, touchEvents);
35
33
  const Progress = {
36
- percent: '',
34
+ percent: NO_DEFAULT_VALUE,
37
35
  'stroke-width': '6',
38
36
  color: singleQuote('#09BB07'),
39
37
  activeColor: singleQuote('#09BB07'),
40
38
  backgroundColor: singleQuote('#EBEBEB'),
41
- active: 'false',
39
+ active: DEFAULT_FALSE,
42
40
  'active-mode': singleQuote('backwards'),
43
- 'show-info': 'false'
41
+ 'show-info': DEFAULT_FALSE
44
42
  };
45
43
  const RichText = {
46
- nodes: '[]'
44
+ nodes: DEFAULT_EMPTY_ARRAY
47
45
  };
48
46
  const Text = {
49
- selectable: 'false',
50
- space: '',
51
- decode: 'false'
47
+ selectable: DEFAULT_FALSE,
48
+ space: NO_DEFAULT_VALUE,
49
+ decode: DEFAULT_FALSE
52
50
  };
53
- const Button = Object.assign({ size: singleQuote('default'), type: '', plain: 'false', disabled: '', loading: 'false', 'form-type': '', 'open-type': '', 'hover-class': singleQuote('button-hover'), 'hover-stop-propagation': 'false', 'hover-start-time': '20', 'hover-stay-time': '70', name: '' }, touchEvents);
51
+ const Button = Object.assign({ size: singleQuote('default'), type: NO_DEFAULT_VALUE, plain: DEFAULT_FALSE, disabled: NO_DEFAULT_VALUE, loading: DEFAULT_FALSE, 'form-type': NO_DEFAULT_VALUE, 'open-type': NO_DEFAULT_VALUE, 'hover-class': singleQuote('button-hover'), 'hover-stop-propagation': DEFAULT_FALSE, 'hover-start-time': '20', 'hover-stay-time': '70', name: NO_DEFAULT_VALUE }, touchEvents);
54
52
  const Checkbox = {
55
- value: '',
56
- disabled: '',
57
- checked: 'false',
53
+ value: NO_DEFAULT_VALUE,
54
+ disabled: NO_DEFAULT_VALUE,
55
+ checked: DEFAULT_FALSE,
58
56
  color: singleQuote('#09BB07'),
59
- name: ''
57
+ name: NO_DEFAULT_VALUE
60
58
  };
61
59
  const CheckboxGroup = {
62
- bindChange: '',
63
- name: ''
60
+ bindChange: NO_DEFAULT_VALUE,
61
+ name: NO_DEFAULT_VALUE
64
62
  };
65
63
  const Form = {
66
- 'report-submit': 'false',
67
- bindSubmit: '',
68
- bindReset: '',
69
- name: ''
64
+ 'report-submit': DEFAULT_FALSE,
65
+ bindSubmit: NO_DEFAULT_VALUE,
66
+ bindReset: NO_DEFAULT_VALUE,
67
+ name: NO_DEFAULT_VALUE
70
68
  };
71
69
  const Input = {
72
- value: '',
73
- type: singleQuote(''),
74
- password: 'false',
75
- placeholder: '',
76
- 'placeholder-style': '',
70
+ value: NO_DEFAULT_VALUE,
71
+ type: singleQuote(NO_DEFAULT_VALUE),
72
+ password: DEFAULT_FALSE,
73
+ placeholder: NO_DEFAULT_VALUE,
74
+ 'placeholder-style': NO_DEFAULT_VALUE,
77
75
  'placeholder-class': singleQuote('input-placeholder'),
78
- disabled: '',
76
+ disabled: NO_DEFAULT_VALUE,
79
77
  maxlength: '140',
80
78
  'cursor-spacing': '0',
81
- focus: 'false',
79
+ focus: DEFAULT_FALSE,
82
80
  'confirm-type': singleQuote('done'),
83
- 'confirm-hold': 'false',
81
+ 'confirm-hold': DEFAULT_FALSE,
84
82
  cursor: 'i.value.length',
85
83
  'selection-start': '-1',
86
84
  'selection-end': '-1',
87
- bindInput: '',
88
- bindFocus: '',
89
- bindBlur: '',
90
- bindConfirm: '',
91
- name: ''
85
+ bindInput: NO_DEFAULT_VALUE,
86
+ bindFocus: NO_DEFAULT_VALUE,
87
+ bindBlur: NO_DEFAULT_VALUE,
88
+ bindConfirm: NO_DEFAULT_VALUE,
89
+ name: NO_DEFAULT_VALUE
92
90
  };
93
91
  const Label = {
94
- for: '',
95
- name: ''
92
+ for: NO_DEFAULT_VALUE,
93
+ name: NO_DEFAULT_VALUE
96
94
  };
97
95
  const Picker = {
98
96
  mode: singleQuote('selector'),
99
- disabled: '',
100
- range: '',
101
- 'range-key': '',
102
- value: '',
103
- start: '',
104
- end: '',
97
+ disabled: NO_DEFAULT_VALUE,
98
+ range: NO_DEFAULT_VALUE,
99
+ 'range-key': NO_DEFAULT_VALUE,
100
+ value: NO_DEFAULT_VALUE,
101
+ start: NO_DEFAULT_VALUE,
102
+ end: NO_DEFAULT_VALUE,
105
103
  fields: singleQuote('day'),
106
- 'custom-item': '',
107
- name: '',
108
- bindCancel: '',
109
- bindChange: '',
110
- bindColumnChange: ''
104
+ 'custom-item': NO_DEFAULT_VALUE,
105
+ name: NO_DEFAULT_VALUE,
106
+ bindCancel: NO_DEFAULT_VALUE,
107
+ bindChange: NO_DEFAULT_VALUE,
108
+ bindColumnChange: NO_DEFAULT_VALUE
111
109
  };
112
110
  const PickerView = {
113
- value: '',
114
- 'indicator-style': '',
115
- 'indicator-class': '',
116
- 'mask-style': '',
117
- 'mask-class': '',
118
- bindChange: '',
119
- name: ''
111
+ value: NO_DEFAULT_VALUE,
112
+ 'indicator-style': NO_DEFAULT_VALUE,
113
+ 'indicator-class': NO_DEFAULT_VALUE,
114
+ 'mask-style': NO_DEFAULT_VALUE,
115
+ 'mask-class': NO_DEFAULT_VALUE,
116
+ bindChange: NO_DEFAULT_VALUE,
117
+ name: NO_DEFAULT_VALUE
120
118
  };
121
119
  const PickerViewColumn = {
122
- name: ''
120
+ name: NO_DEFAULT_VALUE
123
121
  };
124
122
  const Radio = {
125
- value: '',
126
- checked: 'false',
127
- disabled: '',
123
+ value: NO_DEFAULT_VALUE,
124
+ checked: DEFAULT_FALSE,
125
+ disabled: NO_DEFAULT_VALUE,
128
126
  color: singleQuote('#09BB07'),
129
- name: ''
127
+ name: NO_DEFAULT_VALUE
130
128
  };
131
129
  const RadioGroup = {
132
- bindChange: '',
133
- name: ''
130
+ bindChange: NO_DEFAULT_VALUE,
131
+ name: NO_DEFAULT_VALUE
134
132
  };
135
133
  const Slider = {
136
134
  min: '0',
137
135
  max: '100',
138
136
  step: '1',
139
- disabled: '',
137
+ disabled: NO_DEFAULT_VALUE,
140
138
  value: '0',
141
139
  activeColor: singleQuote('#1aad19'),
142
140
  backgroundColor: singleQuote('#e9e9e9'),
143
141
  'block-size': '28',
144
142
  'block-color': singleQuote('#ffffff'),
145
- 'show-value': 'false',
146
- bindChange: '',
147
- bindChanging: '',
148
- name: ''
143
+ 'show-value': DEFAULT_FALSE,
144
+ bindChange: NO_DEFAULT_VALUE,
145
+ bindChanging: NO_DEFAULT_VALUE,
146
+ name: NO_DEFAULT_VALUE
149
147
  };
150
148
  const Switch = {
151
- checked: 'false',
152
- disabled: '',
149
+ checked: DEFAULT_FALSE,
150
+ disabled: NO_DEFAULT_VALUE,
153
151
  type: singleQuote('switch'),
154
152
  color: singleQuote('#04BE02'),
155
- bindChange: '',
156
- name: ''
153
+ bindChange: NO_DEFAULT_VALUE,
154
+ name: NO_DEFAULT_VALUE
157
155
  };
158
156
  const Textarea = {
159
- value: '',
160
- placeholder: '',
161
- 'placeholder-style': '',
157
+ value: NO_DEFAULT_VALUE,
158
+ placeholder: NO_DEFAULT_VALUE,
159
+ 'placeholder-style': NO_DEFAULT_VALUE,
162
160
  'placeholder-class': singleQuote('textarea-placeholder'),
163
- disabled: '',
161
+ disabled: NO_DEFAULT_VALUE,
164
162
  maxlength: '140',
165
- 'auto-focus': 'false',
166
- focus: 'false',
167
- 'auto-height': 'false',
168
- fixed: 'false',
163
+ 'auto-focus': DEFAULT_FALSE,
164
+ focus: DEFAULT_FALSE,
165
+ 'auto-height': DEFAULT_FALSE,
166
+ fixed: DEFAULT_FALSE,
169
167
  'cursor-spacing': '0',
170
168
  cursor: '-1',
171
169
  'selection-start': '-1',
172
170
  'selection-end': '-1',
173
- bindFocus: '',
174
- bindBlur: '',
175
- bindLineChange: '',
176
- bindInput: '',
177
- bindConfirm: '',
178
- name: ''
171
+ bindFocus: NO_DEFAULT_VALUE,
172
+ bindBlur: NO_DEFAULT_VALUE,
173
+ bindLineChange: NO_DEFAULT_VALUE,
174
+ bindInput: NO_DEFAULT_VALUE,
175
+ bindConfirm: NO_DEFAULT_VALUE,
176
+ name: NO_DEFAULT_VALUE
179
177
  };
180
178
  const CoverImage = {
181
- src: '',
179
+ src: NO_DEFAULT_VALUE,
182
180
  bindLoad: 'eh',
183
181
  bindError: 'eh'
184
182
  };
185
- const CoverView = Object.assign({ 'scroll-top': 'false' }, touchEvents);
183
+ const CoverView = Object.assign({ 'scroll-top': DEFAULT_FALSE }, touchEvents);
186
184
  const MovableArea = {
187
- 'scale-area': 'false'
185
+ 'scale-area': DEFAULT_FALSE
188
186
  };
189
- const MovableView = Object.assign(Object.assign({ direction: 'none', inertia: 'false', 'out-of-bounds': 'false', x: '', y: '', damping: '20', friction: '2', disabled: '', scale: 'false', 'scale-min': '0.5', 'scale-max': '10', 'scale-value': '1', animation: 'true', bindChange: '', bindScale: '', bindHTouchMove: '', bindVTouchMove: '', width: singleQuote('10px'), height: singleQuote('10px') }, touchEvents), animationEvents);
190
- const ScrollView = Object.assign(Object.assign({ 'scroll-x': 'false', 'scroll-y': 'false', 'upper-threshold': '50', 'lower-threshold': '50', 'scroll-top': '', 'scroll-left': '', 'scroll-into-view': '', 'scroll-with-animation': 'false', 'enable-back-to-top': 'false', bindScrollToUpper: '', bindScrollToLower: '', bindScroll: '' }, touchEvents), animationEvents);
191
- const Swiper = Object.assign({ 'indicator-dots': 'false', 'indicator-color': singleQuote('rgba(0, 0, 0, .3)'), 'indicator-active-color': singleQuote('#000000'), autoplay: 'false', current: '0', interval: '5000', duration: '500', circular: 'false', vertical: 'false', 'previous-margin': '\'0px\'', 'next-margin': '\'0px\'', 'display-multiple-items': '1', bindChange: '', bindTransition: '', bindAnimationFinish: '' }, touchEvents);
187
+ const MovableView = Object.assign(Object.assign({ direction: 'none', inertia: DEFAULT_FALSE, 'out-of-bounds': DEFAULT_FALSE, x: NO_DEFAULT_VALUE, y: NO_DEFAULT_VALUE, damping: '20', friction: '2', disabled: NO_DEFAULT_VALUE, scale: DEFAULT_FALSE, 'scale-min': '0.5', 'scale-max': '10', 'scale-value': '1', bindChange: NO_DEFAULT_VALUE, bindScale: NO_DEFAULT_VALUE, bindHTouchMove: NO_DEFAULT_VALUE, bindVTouchMove: NO_DEFAULT_VALUE, width: singleQuote('10px'), height: singleQuote('10px') }, touchEvents), animation);
188
+ const ScrollView = Object.assign(Object.assign({ 'scroll-x': DEFAULT_FALSE, 'scroll-y': DEFAULT_FALSE, 'upper-threshold': '50', 'lower-threshold': '50', 'scroll-top': NO_DEFAULT_VALUE, 'scroll-left': NO_DEFAULT_VALUE, 'scroll-into-view': NO_DEFAULT_VALUE, 'scroll-with-animation': DEFAULT_FALSE, 'enable-back-to-top': DEFAULT_FALSE, bindScrollToUpper: NO_DEFAULT_VALUE, bindScrollToLower: NO_DEFAULT_VALUE, bindScroll: NO_DEFAULT_VALUE }, touchEvents), animation);
189
+ const Swiper = Object.assign({ 'indicator-dots': DEFAULT_FALSE, 'indicator-color': singleQuote('rgba(0, 0, 0, .3)'), 'indicator-active-color': singleQuote('#000000'), autoplay: DEFAULT_FALSE, current: '0', interval: '5000', duration: '500', circular: DEFAULT_FALSE, vertical: DEFAULT_FALSE, 'previous-margin': singleQuote('0px'), 'next-margin': singleQuote('0px'), 'display-multiple-items': '1', bindChange: NO_DEFAULT_VALUE, bindTransition: NO_DEFAULT_VALUE, bindAnimationFinish: NO_DEFAULT_VALUE }, touchEvents);
192
190
  const SwiperItem = {
193
- 'item-id': ''
191
+ 'item-id': NO_DEFAULT_VALUE
194
192
  };
195
193
  const Navigator = {
196
- url: '',
194
+ url: NO_DEFAULT_VALUE,
197
195
  'open-type': singleQuote('navigate'),
198
196
  delta: '1',
199
197
  'hover-class': singleQuote('navigator-hover'),
200
- 'hover-stop-propagation': 'false',
198
+ 'hover-stop-propagation': DEFAULT_FALSE,
201
199
  'hover-start-time': '50',
202
200
  'hover-stay-time': '600',
203
- bindSuccess: '',
204
- bindFail: '',
205
- bindComplete: ''
201
+ bindSuccess: NO_DEFAULT_VALUE,
202
+ bindFail: NO_DEFAULT_VALUE,
203
+ bindComplete: NO_DEFAULT_VALUE
206
204
  };
207
205
  const Audio = {
208
- id: '',
209
- src: '',
210
- loop: 'false',
211
- controls: 'false',
212
- poster: '',
213
- name: '',
214
- author: '',
215
- bindError: '',
216
- bindPlay: '',
217
- bindPause: '',
218
- bindTimeUpdate: '',
219
- bindEnded: ''
206
+ id: NO_DEFAULT_VALUE,
207
+ src: NO_DEFAULT_VALUE,
208
+ loop: DEFAULT_FALSE,
209
+ controls: DEFAULT_FALSE,
210
+ poster: NO_DEFAULT_VALUE,
211
+ name: NO_DEFAULT_VALUE,
212
+ author: NO_DEFAULT_VALUE,
213
+ bindError: NO_DEFAULT_VALUE,
214
+ bindPlay: NO_DEFAULT_VALUE,
215
+ bindPause: NO_DEFAULT_VALUE,
216
+ bindTimeUpdate: NO_DEFAULT_VALUE,
217
+ bindEnded: NO_DEFAULT_VALUE
220
218
  };
221
219
  const Camera = {
222
220
  'device-position': singleQuote('back'),
223
221
  flash: singleQuote('auto'),
224
- bindStop: '',
225
- bindError: ''
226
- };
227
- const Image = Object.assign({ src: '', mode: singleQuote('scaleToFill'), 'lazy-load': 'false', bindError: '', bindLoad: '' }, touchEvents);
228
- const LivePlayer = {
229
- src: '',
230
- autoplay: 'false',
231
- muted: 'false',
232
- orientation: singleQuote('vertical'),
233
- 'object-fit': singleQuote('contain'),
234
- 'background-mute': 'false',
235
- 'min-cache': '1',
236
- 'max-cache': '3',
237
- animation: '',
238
- bindStateChange: '',
239
- bindFullScreenChange: '',
240
- bindNetStatus: ''
241
- };
242
- const Video = {
243
- src: '',
244
- duration: '',
245
- controls: 'true',
246
- 'danmu-list': '',
247
- 'danmu-btn': '',
248
- 'enable-danmu': '',
249
- autoplay: 'false',
250
- loop: 'false',
251
- muted: 'false',
252
- 'initial-time': '0',
253
- 'page-gesture': 'false',
254
- direction: '',
255
- 'show-progress': 'true',
256
- 'show-fullscreen-btn': 'true',
257
- 'show-play-btn': 'true',
258
- 'show-center-play-btn': 'true',
259
- 'enable-progress-gesture': 'true',
260
- 'object-fit': singleQuote('contain'),
261
- poster: '',
262
- 'show-mute-btn': 'false',
263
- animation: '',
264
- bindPlay: '',
265
- bindPause: '',
266
- bindEnded: '',
267
- bindTimeUpdate: '',
268
- bindFullScreenChange: '',
269
- bindWaiting: '',
270
- bindError: ''
271
- };
272
- const Canvas = Object.assign({ 'canvas-id': '', 'disable-scroll': 'false', bindError: '' }, touchEvents);
222
+ bindStop: NO_DEFAULT_VALUE,
223
+ bindError: NO_DEFAULT_VALUE
224
+ };
225
+ const Image = Object.assign({ src: NO_DEFAULT_VALUE, mode: singleQuote('scaleToFill'), 'lazy-load': DEFAULT_FALSE, bindError: NO_DEFAULT_VALUE, bindLoad: NO_DEFAULT_VALUE }, touchEvents);
226
+ const LivePlayer = Object.assign({ src: NO_DEFAULT_VALUE, autoplay: DEFAULT_FALSE, muted: DEFAULT_FALSE, orientation: singleQuote('vertical'), 'object-fit': singleQuote('contain'), 'background-mute': DEFAULT_FALSE, 'min-cache': '1', 'max-cache': '3', bindStateChange: NO_DEFAULT_VALUE, bindFullScreenChange: NO_DEFAULT_VALUE, bindNetStatus: NO_DEFAULT_VALUE }, animation);
227
+ const Video = Object.assign({ src: NO_DEFAULT_VALUE, duration: NO_DEFAULT_VALUE, controls: DEFAULT_TRUE, 'danmu-list': NO_DEFAULT_VALUE, 'danmu-btn': NO_DEFAULT_VALUE, 'enable-danmu': NO_DEFAULT_VALUE, autoplay: DEFAULT_FALSE, loop: DEFAULT_FALSE, muted: DEFAULT_FALSE, 'initial-time': '0', 'page-gesture': DEFAULT_FALSE, direction: NO_DEFAULT_VALUE, 'show-progress': DEFAULT_TRUE, 'show-fullscreen-btn': DEFAULT_TRUE, 'show-play-btn': DEFAULT_TRUE, 'show-center-play-btn': DEFAULT_TRUE, 'enable-progress-gesture': DEFAULT_TRUE, 'object-fit': singleQuote('contain'), poster: NO_DEFAULT_VALUE, 'show-mute-btn': DEFAULT_FALSE, bindPlay: NO_DEFAULT_VALUE, bindPause: NO_DEFAULT_VALUE, bindEnded: NO_DEFAULT_VALUE, bindTimeUpdate: NO_DEFAULT_VALUE, bindFullScreenChange: NO_DEFAULT_VALUE, bindWaiting: NO_DEFAULT_VALUE, bindError: NO_DEFAULT_VALUE }, animation);
228
+ const Canvas = Object.assign({ 'canvas-id': NO_DEFAULT_VALUE, 'disable-scroll': DEFAULT_FALSE, bindError: NO_DEFAULT_VALUE }, touchEvents);
273
229
  const Ad = {
274
- 'unit-id': '',
275
- 'ad-intervals': '',
276
- bindLoad: '',
277
- bindError: '',
278
- bindClose: ''
230
+ 'unit-id': NO_DEFAULT_VALUE,
231
+ 'ad-intervals': NO_DEFAULT_VALUE,
232
+ bindLoad: NO_DEFAULT_VALUE,
233
+ bindError: NO_DEFAULT_VALUE,
234
+ bindClose: NO_DEFAULT_VALUE
279
235
  };
280
236
  const WebView = {
281
- src: '',
282
- bindMessage: '',
283
- bindLoad: '',
284
- bindError: ''
237
+ src: NO_DEFAULT_VALUE,
238
+ bindMessage: NO_DEFAULT_VALUE,
239
+ bindLoad: NO_DEFAULT_VALUE,
240
+ bindError: NO_DEFAULT_VALUE
285
241
  };
286
242
  const Block = {};
287
243
  // For Vue,因为 slot 标签被 vue 占用了
288
244
  const SlotView = {
289
- name: ''
245
+ name: NO_DEFAULT_VALUE
290
246
  };
291
247
  // For React
292
248
  // Slot 和 SlotView 最终都会编译成 <view slot={{ i.name }} />
293
249
  // 因为 <slot name="{{ i.name }}" /> 适用性没有前者高(无法添加类和样式)
294
250
  // 不给 View 直接加 slot 属性的原因是性能损耗
295
251
  const Slot = {
296
- name: ''
252
+ name: NO_DEFAULT_VALUE
297
253
  };
298
254
  const internalComponents = {
299
255
  View,
@@ -407,7 +363,7 @@ function capitalize(s) {
407
363
  }
408
364
  const hasOwnProperty = Object.prototype.hasOwnProperty;
409
365
  const hasOwn = (val, key) => hasOwnProperty.call(val, key);
410
- const _loadTime = (new Date()).getTime().toString();
366
+ (new Date()).getTime().toString();
411
367
  function indent(str, size) {
412
368
  return str.split('\n')
413
369
  .map((line, index) => {
@@ -430,6 +386,13 @@ function indent(str, size) {
430
386
  *
431
387
  * ^1: packages/taro-runtime/src/hydrate.ts
432
388
  */
389
+ const styles = {
390
+ style: `i.${"st" /* Style */}`,
391
+ class: `i.${"cl" /* Class */}`
392
+ };
393
+ const events = {
394
+ bindtap: 'eh'
395
+ };
433
396
  const weixinAdapter = {
434
397
  if: 'wx:if',
435
398
  else: 'wx:else',
@@ -472,7 +435,7 @@ class BaseTemplate {
472
435
  ? `${this.dataKeymap('i:item,l:\'\'')}`
473
436
  : this.dataKeymap('i:item');
474
437
  return `<import src="./base${ext}" />
475
- <block ${Adapter.for}="{{i.${"cn" /* Childnodes */}}}" ${Adapter.key}="uid">
438
+ <block ${Adapter.for}="{{i.${"cn" /* Childnodes */}}}" ${Adapter.key}="sid">
476
439
  <template is="tmpl_0_container" data="{{${data}}}" />
477
440
  </block>`;
478
441
  };
@@ -586,7 +549,7 @@ class BaseTemplate {
586
549
  : this.dataKeymap('i:item');
587
550
  return `${this.buildXsTemplate()}
588
551
  <template name="taro_tmpl">
589
- <block ${Adapter.for}="{{root.cn}}" ${Adapter.key}="uid">
552
+ <block ${Adapter.for}="{{root.cn}}" ${Adapter.key}="sid">
590
553
  <template is="tmpl_0_${"container" /* Container */}" data="{{${data}}}" />
591
554
  </block>
592
555
  </template>
@@ -614,6 +577,9 @@ class BaseTemplate {
614
577
  }
615
578
  return str + `bind${value}="eh" `;
616
579
  }
580
+ else if (attr === 'class') {
581
+ return str + `class="{{i.${"cl" /* Class */}}}" `;
582
+ }
617
583
  return str + `${attr}="{{i.${toCamelCase(attr)}}}" `;
618
584
  }, '');
619
585
  }
@@ -637,7 +603,7 @@ class BaseTemplate {
637
603
  let children = this.voidElements.has(comp.nodeName)
638
604
  ? ''
639
605
  : `
640
- <block ${Adapter.for}="{{i.${"cn" /* Childnodes */}}}" ${Adapter.key}="uid">
606
+ <block ${Adapter.for}="{{i.${"cn" /* Childnodes */}}}" ${Adapter.key}="sid">
641
607
  ${indent(child, 6)}
642
608
  </block>
643
609
  `;
@@ -659,11 +625,11 @@ class BaseTemplate {
659
625
  </template>
660
626
 
661
627
  <template name="tmpl_${level}_${comp.nodeName}_focus">
662
- <${comp.nodeName} ${this.buildAttribute(comp.attributes, comp.nodeName)} id="{{i.uid}}">${children}</${comp.nodeName}>
628
+ <${comp.nodeName} ${this.buildAttribute(comp.attributes, comp.nodeName)} id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">${children}</${comp.nodeName}>
663
629
  </template>
664
630
 
665
631
  <template name="tmpl_${level}_${comp.nodeName}_blur">
666
- <${comp.nodeName} ${this.buildAttribute(attrs, comp.nodeName)} id="{{i.uid}}">${children}</${comp.nodeName}>
632
+ <${comp.nodeName} ${this.buildAttribute(attrs, comp.nodeName)} id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">${children}</${comp.nodeName}>
667
633
  </template>
668
634
  `;
669
635
  if (isFunction(this.modifyTemplateResult)) {
@@ -694,7 +660,7 @@ class BaseTemplate {
694
660
  }
695
661
  let res = `
696
662
  <template name="tmpl_${level}_${comp.nodeName}">
697
- <${nodeName} ${this.buildAttribute(comp.attributes, comp.nodeName)} id="{{i.uid}}">${children}</${nodeName}>
663
+ <${nodeName} ${this.buildAttribute(comp.attributes, comp.nodeName)} id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">${children}</${nodeName}>
698
664
  </template>
699
665
  `;
700
666
  if (isFunction(this.modifyTemplateResult)) {
@@ -704,7 +670,7 @@ class BaseTemplate {
704
670
  }
705
671
  buildPlainTextTemplate(level) {
706
672
  return `
707
- <template name="tmpl_${level}_#text" data="{{${this.dataKeymap('i:i')}}}">
673
+ <template name="tmpl_${level}_#text">
708
674
  <block>{{i.${"v" /* Text */}}}</block>
709
675
  </template>
710
676
  `;
@@ -720,7 +686,7 @@ class BaseTemplate {
720
686
  if (compName === 'custom-wrapper') {
721
687
  template += `
722
688
  <template name="tmpl_${level}_${compName}">
723
- <${compName} i="{{i}}" l="{{l}}" id="{{i.uid}}">
689
+ <${compName} i="{{i}}" l="{{l}}" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">
724
690
  </${compName}>
725
691
  </template>
726
692
  `;
@@ -728,13 +694,16 @@ class BaseTemplate {
728
694
  else {
729
695
  if (!isSupportRecursive && supportXS && nestElements.has(compName) && level + 1 > nestElements.get(compName))
730
696
  return;
731
- const child = supportXS
697
+ let child = supportXS
732
698
  ? `<template is="{{xs.e(${isSupportRecursive ? 0 : 'cid+1'})}}" data="{{${data}}}" />`
733
699
  : `<template is="tmpl_${nextLevel}_${"container" /* Container */}" data="{{${data}}}" />`;
700
+ if (isFunction(this.modifyThirdPartyLoopBody)) {
701
+ child = this.modifyThirdPartyLoopBody(child, compName);
702
+ }
734
703
  template += `
735
704
  <template name="tmpl_${level}_${compName}">
736
- <${compName} ${this.buildThirdPartyAttr(attrs)} id="{{i.uid}}">
737
- <block ${Adapter.for}="{{i.${"cn" /* Childnodes */}}}" ${Adapter.key}="uid">
705
+ <${compName} ${this.buildThirdPartyAttr(attrs)} id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">
706
+ <block ${Adapter.for}="{{i.${"cn" /* Childnodes */}}}" ${Adapter.key}="sid">
738
707
  ${child}
739
708
  </block>
740
709
  </${compName}>
@@ -942,6 +911,8 @@ exports.BaseTemplate = BaseTemplate;
942
911
  exports.RecursiveTemplate = RecursiveTemplate;
943
912
  exports.UnRecursiveTemplate = UnRecursiveTemplate;
944
913
  exports.capitalize = capitalize;
914
+ exports.events = events;
945
915
  exports.internalComponents = internalComponents;
916
+ exports.styles = styles;
946
917
  exports.toCamelCase = toCamelCase;
947
918
  //# sourceMappingURL=template.js.map