@tarojs/shared 3.3.14 → 3.5.0-canary.0

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.
@@ -24,298 +24,254 @@ function isBooleanStringLiteral(o) {
24
24
  }
25
25
  const isArray = Array.isArray;
26
26
 
27
- const styles = {
28
- style: `i.${"st" /* Style */}`,
29
- class: `i.${"cl" /* Class */}`
30
- };
31
- const events = {
32
- bindtap: 'eh'
33
- };
27
+ const DEFAULT_EMPTY_ARRAY = '[]';
28
+ const NO_DEFAULT_VALUE = '';
29
+ const DEFAULT_TRUE = 'true';
30
+ const DEFAULT_FALSE = 'false';
34
31
  const touchEvents = {
35
- bindTouchStart: '',
36
- bindTouchMove: '',
37
- bindTouchEnd: '',
38
- bindTouchCancel: '',
39
- bindLongTap: ''
40
- };
41
- const animationEvents = {
42
- bindAnimationStart: '',
43
- bindAnimationIteration: '',
44
- bindAnimationEnd: '',
45
- bindTransitionEnd: ''
32
+ bindTouchStart: NO_DEFAULT_VALUE,
33
+ bindTouchMove: NO_DEFAULT_VALUE,
34
+ bindTouchEnd: NO_DEFAULT_VALUE,
35
+ bindTouchCancel: NO_DEFAULT_VALUE,
36
+ bindLongTap: NO_DEFAULT_VALUE
37
+ };
38
+ const animation = {
39
+ animation: NO_DEFAULT_VALUE,
40
+ bindAnimationStart: NO_DEFAULT_VALUE,
41
+ bindAnimationIteration: NO_DEFAULT_VALUE,
42
+ bindAnimationEnd: NO_DEFAULT_VALUE,
43
+ bindTransitionEnd: NO_DEFAULT_VALUE
46
44
  };
47
45
  function singleQuote(s) {
48
46
  return `'${s}'`;
49
47
  }
50
- 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);
48
+ 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);
51
49
  const Icon = {
52
- type: '',
50
+ type: NO_DEFAULT_VALUE,
53
51
  size: '23',
54
- color: ''
52
+ color: NO_DEFAULT_VALUE
55
53
  };
56
- 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);
54
+ 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);
57
55
  const Progress = {
58
- percent: '',
56
+ percent: NO_DEFAULT_VALUE,
59
57
  'stroke-width': '6',
60
58
  color: singleQuote('#09BB07'),
61
59
  activeColor: singleQuote('#09BB07'),
62
60
  backgroundColor: singleQuote('#EBEBEB'),
63
- active: 'false',
61
+ active: DEFAULT_FALSE,
64
62
  'active-mode': singleQuote('backwards'),
65
- 'show-info': 'false'
63
+ 'show-info': DEFAULT_FALSE
66
64
  };
67
65
  const RichText = {
68
- nodes: '[]'
66
+ nodes: DEFAULT_EMPTY_ARRAY
69
67
  };
70
68
  const Text = {
71
- selectable: 'false',
72
- space: '',
73
- decode: 'false'
69
+ selectable: DEFAULT_FALSE,
70
+ space: NO_DEFAULT_VALUE,
71
+ decode: DEFAULT_FALSE
74
72
  };
75
- 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);
73
+ 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);
76
74
  const Checkbox = {
77
- value: '',
78
- disabled: '',
79
- checked: 'false',
75
+ value: NO_DEFAULT_VALUE,
76
+ disabled: NO_DEFAULT_VALUE,
77
+ checked: DEFAULT_FALSE,
80
78
  color: singleQuote('#09BB07'),
81
- name: ''
79
+ name: NO_DEFAULT_VALUE
82
80
  };
83
81
  const CheckboxGroup = {
84
- bindChange: '',
85
- name: ''
82
+ bindChange: NO_DEFAULT_VALUE,
83
+ name: NO_DEFAULT_VALUE
86
84
  };
87
85
  const Form = {
88
- 'report-submit': 'false',
89
- bindSubmit: '',
90
- bindReset: '',
91
- name: ''
86
+ 'report-submit': DEFAULT_FALSE,
87
+ bindSubmit: NO_DEFAULT_VALUE,
88
+ bindReset: NO_DEFAULT_VALUE,
89
+ name: NO_DEFAULT_VALUE
92
90
  };
93
91
  const Input = {
94
- value: '',
95
- type: singleQuote(''),
96
- password: 'false',
97
- placeholder: '',
98
- 'placeholder-style': '',
92
+ value: NO_DEFAULT_VALUE,
93
+ type: singleQuote(NO_DEFAULT_VALUE),
94
+ password: DEFAULT_FALSE,
95
+ placeholder: NO_DEFAULT_VALUE,
96
+ 'placeholder-style': NO_DEFAULT_VALUE,
99
97
  'placeholder-class': singleQuote('input-placeholder'),
100
- disabled: '',
98
+ disabled: NO_DEFAULT_VALUE,
101
99
  maxlength: '140',
102
100
  'cursor-spacing': '0',
103
- focus: 'false',
101
+ focus: DEFAULT_FALSE,
104
102
  'confirm-type': singleQuote('done'),
105
- 'confirm-hold': 'false',
103
+ 'confirm-hold': DEFAULT_FALSE,
106
104
  cursor: 'i.value.length',
107
105
  'selection-start': '-1',
108
106
  'selection-end': '-1',
109
- bindInput: '',
110
- bindFocus: '',
111
- bindBlur: '',
112
- bindConfirm: '',
113
- name: ''
107
+ bindInput: NO_DEFAULT_VALUE,
108
+ bindFocus: NO_DEFAULT_VALUE,
109
+ bindBlur: NO_DEFAULT_VALUE,
110
+ bindConfirm: NO_DEFAULT_VALUE,
111
+ name: NO_DEFAULT_VALUE
114
112
  };
115
113
  const Label = {
116
- for: '',
117
- name: ''
114
+ for: NO_DEFAULT_VALUE,
115
+ name: NO_DEFAULT_VALUE
118
116
  };
119
117
  const Picker = {
120
118
  mode: singleQuote('selector'),
121
- disabled: '',
122
- range: '',
123
- 'range-key': '',
124
- value: '',
125
- start: '',
126
- end: '',
119
+ disabled: NO_DEFAULT_VALUE,
120
+ range: NO_DEFAULT_VALUE,
121
+ 'range-key': NO_DEFAULT_VALUE,
122
+ value: NO_DEFAULT_VALUE,
123
+ start: NO_DEFAULT_VALUE,
124
+ end: NO_DEFAULT_VALUE,
127
125
  fields: singleQuote('day'),
128
- 'custom-item': '',
129
- name: '',
130
- bindCancel: '',
131
- bindChange: '',
132
- bindColumnChange: ''
126
+ 'custom-item': NO_DEFAULT_VALUE,
127
+ name: NO_DEFAULT_VALUE,
128
+ bindCancel: NO_DEFAULT_VALUE,
129
+ bindChange: NO_DEFAULT_VALUE,
130
+ bindColumnChange: NO_DEFAULT_VALUE
133
131
  };
134
132
  const PickerView = {
135
- value: '',
136
- 'indicator-style': '',
137
- 'indicator-class': '',
138
- 'mask-style': '',
139
- 'mask-class': '',
140
- bindChange: '',
141
- name: ''
133
+ value: NO_DEFAULT_VALUE,
134
+ 'indicator-style': NO_DEFAULT_VALUE,
135
+ 'indicator-class': NO_DEFAULT_VALUE,
136
+ 'mask-style': NO_DEFAULT_VALUE,
137
+ 'mask-class': NO_DEFAULT_VALUE,
138
+ bindChange: NO_DEFAULT_VALUE,
139
+ name: NO_DEFAULT_VALUE
142
140
  };
143
141
  const PickerViewColumn = {
144
- name: ''
142
+ name: NO_DEFAULT_VALUE
145
143
  };
146
144
  const Radio = {
147
- value: '',
148
- checked: 'false',
149
- disabled: '',
145
+ value: NO_DEFAULT_VALUE,
146
+ checked: DEFAULT_FALSE,
147
+ disabled: NO_DEFAULT_VALUE,
150
148
  color: singleQuote('#09BB07'),
151
- name: ''
149
+ name: NO_DEFAULT_VALUE
152
150
  };
153
151
  const RadioGroup = {
154
- bindChange: '',
155
- name: ''
152
+ bindChange: NO_DEFAULT_VALUE,
153
+ name: NO_DEFAULT_VALUE
156
154
  };
157
155
  const Slider = {
158
156
  min: '0',
159
157
  max: '100',
160
158
  step: '1',
161
- disabled: '',
159
+ disabled: NO_DEFAULT_VALUE,
162
160
  value: '0',
163
161
  activeColor: singleQuote('#1aad19'),
164
162
  backgroundColor: singleQuote('#e9e9e9'),
165
163
  'block-size': '28',
166
164
  'block-color': singleQuote('#ffffff'),
167
- 'show-value': 'false',
168
- bindChange: '',
169
- bindChanging: '',
170
- name: ''
165
+ 'show-value': DEFAULT_FALSE,
166
+ bindChange: NO_DEFAULT_VALUE,
167
+ bindChanging: NO_DEFAULT_VALUE,
168
+ name: NO_DEFAULT_VALUE
171
169
  };
172
170
  const Switch = {
173
- checked: 'false',
174
- disabled: '',
171
+ checked: DEFAULT_FALSE,
172
+ disabled: NO_DEFAULT_VALUE,
175
173
  type: singleQuote('switch'),
176
174
  color: singleQuote('#04BE02'),
177
- bindChange: '',
178
- name: ''
175
+ bindChange: NO_DEFAULT_VALUE,
176
+ name: NO_DEFAULT_VALUE
179
177
  };
180
178
  const Textarea = {
181
- value: '',
182
- placeholder: '',
183
- 'placeholder-style': '',
179
+ value: NO_DEFAULT_VALUE,
180
+ placeholder: NO_DEFAULT_VALUE,
181
+ 'placeholder-style': NO_DEFAULT_VALUE,
184
182
  'placeholder-class': singleQuote('textarea-placeholder'),
185
- disabled: '',
183
+ disabled: NO_DEFAULT_VALUE,
186
184
  maxlength: '140',
187
- 'auto-focus': 'false',
188
- focus: 'false',
189
- 'auto-height': 'false',
190
- fixed: 'false',
185
+ 'auto-focus': DEFAULT_FALSE,
186
+ focus: DEFAULT_FALSE,
187
+ 'auto-height': DEFAULT_FALSE,
188
+ fixed: DEFAULT_FALSE,
191
189
  'cursor-spacing': '0',
192
190
  cursor: '-1',
193
191
  'selection-start': '-1',
194
192
  'selection-end': '-1',
195
- bindFocus: '',
196
- bindBlur: '',
197
- bindLineChange: '',
198
- bindInput: '',
199
- bindConfirm: '',
200
- name: ''
193
+ bindFocus: NO_DEFAULT_VALUE,
194
+ bindBlur: NO_DEFAULT_VALUE,
195
+ bindLineChange: NO_DEFAULT_VALUE,
196
+ bindInput: NO_DEFAULT_VALUE,
197
+ bindConfirm: NO_DEFAULT_VALUE,
198
+ name: NO_DEFAULT_VALUE
201
199
  };
202
200
  const CoverImage = {
203
- src: '',
201
+ src: NO_DEFAULT_VALUE,
204
202
  bindLoad: 'eh',
205
203
  bindError: 'eh'
206
204
  };
207
- const CoverView = Object.assign({ 'scroll-top': 'false' }, touchEvents);
205
+ const CoverView = Object.assign({ 'scroll-top': DEFAULT_FALSE }, touchEvents);
208
206
  const MovableArea = {
209
- 'scale-area': 'false'
207
+ 'scale-area': DEFAULT_FALSE
210
208
  };
211
- 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);
212
- 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);
213
- 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);
209
+ 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);
210
+ 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);
211
+ 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);
214
212
  const SwiperItem = {
215
- 'item-id': ''
213
+ 'item-id': NO_DEFAULT_VALUE
216
214
  };
217
215
  const Navigator = {
218
- url: '',
216
+ url: NO_DEFAULT_VALUE,
219
217
  'open-type': singleQuote('navigate'),
220
218
  delta: '1',
221
219
  'hover-class': singleQuote('navigator-hover'),
222
- 'hover-stop-propagation': 'false',
220
+ 'hover-stop-propagation': DEFAULT_FALSE,
223
221
  'hover-start-time': '50',
224
222
  'hover-stay-time': '600',
225
- bindSuccess: '',
226
- bindFail: '',
227
- bindComplete: ''
223
+ bindSuccess: NO_DEFAULT_VALUE,
224
+ bindFail: NO_DEFAULT_VALUE,
225
+ bindComplete: NO_DEFAULT_VALUE
228
226
  };
229
227
  const Audio = {
230
- id: '',
231
- src: '',
232
- loop: 'false',
233
- controls: 'false',
234
- poster: '',
235
- name: '',
236
- author: '',
237
- bindError: '',
238
- bindPlay: '',
239
- bindPause: '',
240
- bindTimeUpdate: '',
241
- bindEnded: ''
228
+ id: NO_DEFAULT_VALUE,
229
+ src: NO_DEFAULT_VALUE,
230
+ loop: DEFAULT_FALSE,
231
+ controls: DEFAULT_FALSE,
232
+ poster: NO_DEFAULT_VALUE,
233
+ name: NO_DEFAULT_VALUE,
234
+ author: NO_DEFAULT_VALUE,
235
+ bindError: NO_DEFAULT_VALUE,
236
+ bindPlay: NO_DEFAULT_VALUE,
237
+ bindPause: NO_DEFAULT_VALUE,
238
+ bindTimeUpdate: NO_DEFAULT_VALUE,
239
+ bindEnded: NO_DEFAULT_VALUE
242
240
  };
243
241
  const Camera = {
244
242
  'device-position': singleQuote('back'),
245
243
  flash: singleQuote('auto'),
246
- bindStop: '',
247
- bindError: ''
248
- };
249
- const Image = Object.assign({ src: '', mode: singleQuote('scaleToFill'), 'lazy-load': 'false', bindError: '', bindLoad: '' }, touchEvents);
250
- const LivePlayer = {
251
- src: '',
252
- autoplay: 'false',
253
- muted: 'false',
254
- orientation: singleQuote('vertical'),
255
- 'object-fit': singleQuote('contain'),
256
- 'background-mute': 'false',
257
- 'min-cache': '1',
258
- 'max-cache': '3',
259
- animation: '',
260
- bindStateChange: '',
261
- bindFullScreenChange: '',
262
- bindNetStatus: ''
263
- };
264
- const Video = {
265
- src: '',
266
- duration: '',
267
- controls: 'true',
268
- 'danmu-list': '',
269
- 'danmu-btn': '',
270
- 'enable-danmu': '',
271
- autoplay: 'false',
272
- loop: 'false',
273
- muted: 'false',
274
- 'initial-time': '0',
275
- 'page-gesture': 'false',
276
- direction: '',
277
- 'show-progress': 'true',
278
- 'show-fullscreen-btn': 'true',
279
- 'show-play-btn': 'true',
280
- 'show-center-play-btn': 'true',
281
- 'enable-progress-gesture': 'true',
282
- 'object-fit': singleQuote('contain'),
283
- poster: '',
284
- 'show-mute-btn': 'false',
285
- animation: '',
286
- bindPlay: '',
287
- bindPause: '',
288
- bindEnded: '',
289
- bindTimeUpdate: '',
290
- bindFullScreenChange: '',
291
- bindWaiting: '',
292
- bindError: ''
244
+ bindStop: NO_DEFAULT_VALUE,
245
+ bindError: NO_DEFAULT_VALUE
293
246
  };
294
- const Canvas = Object.assign({ 'canvas-id': '', 'disable-scroll': 'false', bindError: '' }, touchEvents);
247
+ const Image = Object.assign({ src: NO_DEFAULT_VALUE, mode: singleQuote('scaleToFill'), 'lazy-load': DEFAULT_FALSE, bindError: NO_DEFAULT_VALUE, bindLoad: NO_DEFAULT_VALUE }, touchEvents);
248
+ 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);
249
+ 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);
250
+ const Canvas = Object.assign({ 'canvas-id': NO_DEFAULT_VALUE, 'disable-scroll': DEFAULT_FALSE, bindError: NO_DEFAULT_VALUE }, touchEvents);
295
251
  const Ad = {
296
- 'unit-id': '',
297
- 'ad-intervals': '',
298
- bindLoad: '',
299
- bindError: '',
300
- bindClose: ''
252
+ 'unit-id': NO_DEFAULT_VALUE,
253
+ 'ad-intervals': NO_DEFAULT_VALUE,
254
+ bindLoad: NO_DEFAULT_VALUE,
255
+ bindError: NO_DEFAULT_VALUE,
256
+ bindClose: NO_DEFAULT_VALUE
301
257
  };
302
258
  const WebView = {
303
- src: '',
304
- bindMessage: '',
305
- bindLoad: '',
306
- bindError: ''
259
+ src: NO_DEFAULT_VALUE,
260
+ bindMessage: NO_DEFAULT_VALUE,
261
+ bindLoad: NO_DEFAULT_VALUE,
262
+ bindError: NO_DEFAULT_VALUE
307
263
  };
308
264
  const Block = {};
309
265
  // For Vue,因为 slot 标签被 vue 占用了
310
266
  const SlotView = {
311
- name: ''
267
+ name: NO_DEFAULT_VALUE
312
268
  };
313
269
  // For React
314
270
  // Slot 和 SlotView 最终都会编译成 <view slot={{ i.name }} />
315
271
  // 因为 <slot name="{{ i.name }}" /> 适用性没有前者高(无法添加类和样式)
316
272
  // 不给 View 直接加 slot 属性的原因是性能损耗
317
273
  const Slot = {
318
- name: ''
274
+ name: NO_DEFAULT_VALUE
319
275
  };
320
276
  const internalComponents = {
321
277
  View,
@@ -449,7 +405,6 @@ function capitalize(s) {
449
405
  }
450
406
  const hasOwnProperty = Object.prototype.hasOwnProperty;
451
407
  const hasOwn = (val, key) => hasOwnProperty.call(val, key);
452
- const reportIssue = '如有疑问,请提交 issue 至:https://github.com/nervjs/taro/issues';
453
408
  /**
454
409
  * ensure takes a condition and throw a error if the condition fails,
455
410
  * like failure::ensure: https://docs.rs/failure/0.1.1/failure/macro.ensure.html
@@ -458,7 +413,13 @@ const reportIssue = '如有疑问,请提交 issue 至:https://github.com/ner
458
413
  */
459
414
  function ensure(condition, msg) {
460
415
  if (!condition) {
461
- throw new Error(msg + '\n' + reportIssue);
416
+ if (process.env.NODE_ENV !== 'production') {
417
+ const reportIssue = '\n如有疑问,请提交 issue 至:https://github.com/nervjs/taro/issues';
418
+ throw new Error(msg + reportIssue);
419
+ }
420
+ else {
421
+ throw new Error(msg);
422
+ }
462
423
  }
463
424
  }
464
425
  function warn(condition, msg) {
@@ -530,17 +491,11 @@ function mergeReconciler(hostConfig) {
530
491
  Object.keys(hostConfig).forEach(key => {
531
492
  const value = hostConfig[key];
532
493
  const raw = defaultReconciler[key];
533
- if (!raw) {
534
- defaultReconciler[key] = value;
535
- }
536
- else {
537
- if (isArray(raw)) {
538
- defaultReconciler[key] = raw.push(value);
539
- }
540
- else {
541
- defaultReconciler[key] = [raw, value];
542
- }
543
- }
494
+ defaultReconciler[key] = !raw
495
+ ? value
496
+ : (isArray(raw)
497
+ ? raw.concat(value)
498
+ : [raw, value]);
544
499
  });
545
500
  }
546
501
  function unsupport(api) {
@@ -695,11 +650,15 @@ const needPromiseApis = new Set([
695
650
  ]);
696
651
  function getCanIUseWebp(taro) {
697
652
  return function () {
698
- if (typeof taro.getSystemInfoSync !== 'function') {
699
- console.error('不支持 API canIUseWebp');
653
+ var _a;
654
+ const res = (_a = taro.getSystemInfoSync) === null || _a === void 0 ? void 0 : _a.call(taro);
655
+ if (!res) {
656
+ if (process.env.NODE_ENV !== 'production') {
657
+ console.error('不支持 API canIUseWebp');
658
+ }
700
659
  return false;
701
660
  }
702
- const { platform } = taro.getSystemInfoSync();
661
+ const { platform } = res;
703
662
  const platformLower = platform.toLowerCase();
704
663
  if (platformLower === 'android' || platformLower === 'devtools') {
705
664
  return true;
@@ -709,12 +668,11 @@ function getCanIUseWebp(taro) {
709
668
  }
710
669
  function getNormalRequest(global) {
711
670
  return function request(options) {
712
- options = options || {};
713
- if (typeof options === 'string') {
714
- options = {
715
- url: options
716
- };
717
- }
671
+ options = options
672
+ ? (isString(options)
673
+ ? { url: options }
674
+ : options)
675
+ : {};
718
676
  const originSuccess = options.success;
719
677
  const originFail = options.fail;
720
678
  const originComplete = options.complete;
@@ -760,7 +718,7 @@ function processApis(taro, global, config = {}) {
760
718
  ];
761
719
  const apis = new Set(!config.isOnlyPromisify
762
720
  ? Object.keys(global).filter(api => preserved.indexOf(api) === -1)
763
- : new Set(patchNeedPromiseApis));
721
+ : patchNeedPromiseApis);
764
722
  if (config.modifyApis) {
765
723
  config.modifyApis(apis);
766
724
  }
@@ -845,7 +803,7 @@ function processApis(taro, global, config = {}) {
845
803
  taro[key] = unsupport(key);
846
804
  return;
847
805
  }
848
- if (typeof global[key] === 'function') {
806
+ if (isFunction(global[key])) {
849
807
  taro[key] = (...args) => {
850
808
  if (config.handleSyncApis) {
851
809
  return config.handleSyncApis(key, global, args);
@@ -879,7 +837,7 @@ function equipCommonApis(taro, global, apis = {}) {
879
837
  taro.requirePlugin = unsupport('requirePlugin');
880
838
  }
881
839
  // request & interceptors
882
- const request = apis.request ? apis.request : getNormalRequest(global);
840
+ const request = apis.request || getNormalRequest(global);
883
841
  function taroInterceptor(chain) {
884
842
  return request(chain.requestParams);
885
843
  }
@@ -890,5 +848,5 @@ function equipCommonApis(taro, global, apis = {}) {
890
848
  taro.miniGlobal = taro.options.miniGlobal = global;
891
849
  }
892
850
 
893
- export { EMPTY_ARR, EMPTY_OBJ, animationEvents, box, cacheDataGet, cacheDataHas, cacheDataSet, capitalize, controlledComponent, defaultReconciler, ensure, events, focusComponents, getUniqueKey, hasOwn, indent, internalComponents, isArray, isBoolean, isBooleanStringLiteral, isFunction, isNull, isNumber, isObject, isString, isUndefined, mergeInternalComponents, mergeReconciler, nestElements, noop, processApis, queryToJson, setUniqueKeyToRoute, singleQuote, styles, toCamelCase, toDashed, toKebabCase, touchEvents, unbox, unsupport, voidElements, warn };
851
+ export { EMPTY_ARR, EMPTY_OBJ, animation, box, cacheDataGet, cacheDataHas, cacheDataSet, capitalize, controlledComponent, defaultReconciler, ensure, focusComponents, getUniqueKey, hasOwn, indent, internalComponents, isArray, isBoolean, isBooleanStringLiteral, isFunction, isNull, isNumber, isObject, isString, isUndefined, mergeInternalComponents, mergeReconciler, nestElements, noop, processApis, queryToJson, setUniqueKeyToRoute, singleQuote, toCamelCase, toDashed, toKebabCase, touchEvents, unbox, unsupport, voidElements, warn };
894
852
  //# sourceMappingURL=shared.esm.js.map