@tarojs/plugin-platform-weapp 3.5.0-beta.4 → 3.5.0-beta.7

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/index.js CHANGED
@@ -6,93 +6,434 @@ var service = require('@tarojs/service');
6
6
  var template = require('@tarojs/shared/dist/template');
7
7
 
8
8
  /*! *****************************************************************************
9
- Copyright (c) Microsoft Corporation. All rights reserved.
10
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
11
- this file except in compliance with the License. You may obtain a copy of the
12
- License at http://www.apache.org/licenses/LICENSE-2.0
9
+ Copyright (c) Microsoft Corporation.
13
10
 
14
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17
- MERCHANTABLITY OR NON-INFRINGEMENT.
11
+ Permission to use, copy, modify, and/or distribute this software for any
12
+ purpose with or without fee is hereby granted.
18
13
 
19
- See the Apache Version 2.0 License for specific language governing permissions
20
- and limitations under the License.
14
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
+ PERFORMANCE OF THIS SOFTWARE.
21
21
  ***************************************************************************** */
22
22
 
23
23
  function __awaiter(thisArg, _arguments, P, generator) {
24
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
24
25
  return new (P || (P = Promise))(function (resolve, reject) {
25
26
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
26
27
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
27
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
28
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
28
29
  step((generator = generator.apply(thisArg, _arguments || [])).next());
29
30
  });
30
31
  }
31
32
 
32
- class Template extends template.UnRecursiveTemplate {
33
- constructor(pluginOptions) {
34
- super();
35
- this.supportXS = true;
36
- this.Adapter = {
37
- if: 'wx:if',
38
- else: 'wx:else',
39
- elseif: 'wx:elif',
40
- for: 'wx:for',
41
- forItem: 'wx:for-item',
42
- forIndex: 'wx:for-index',
43
- key: 'wx:key',
44
- xs: 'wxs',
45
- type: 'weapp'
46
- };
47
- this.modifyTemplateResult = (res, nodeName, _level, children) => {
48
- if (nodeName === 'keyboard-accessory')
49
- return '';
50
- if ((nodeName === 'textarea' || nodeName === 'input') && this.pluginOptions.enablekeyboardAccessory) {
51
- const list = res.split('</template>');
52
- const componentAlias = this.componentsAlias[nodeName];
53
- const nodeNameAlias = componentAlias._num;
33
+ const _true = 'true';
34
+ const _false = 'false';
35
+ const _empty = '';
36
+ const _zero = '0';
37
+ const components = {
38
+ // ======== 调整属性 ========
39
+ Progress: {
40
+ 'border-radius': _zero,
41
+ 'font-size': '16',
42
+ duration: '30',
43
+ bindActiveEnd: _empty
44
+ },
45
+ RichText: {
46
+ space: _empty,
47
+ 'user-select': _false
48
+ },
49
+ Text: {
50
+ 'user-select': _false
51
+ },
52
+ Map: {
53
+ polygons: '[]',
54
+ subkey: _empty,
55
+ rotate: _zero,
56
+ skew: _zero,
57
+ 'max-scale': '20',
58
+ 'min-scale': '3',
59
+ 'enable-3D': _false,
60
+ 'show-compass': _false,
61
+ 'show-scale': _false,
62
+ 'enable-overlooking': _false,
63
+ 'enable-zoom': _true,
64
+ 'enable-scroll': _true,
65
+ 'enable-rotate': _false,
66
+ 'enable-satellite': _false,
67
+ 'enable-traffic': _false,
68
+ setting: '[]',
69
+ bindLabelTap: _empty,
70
+ bindRegionChange: _empty,
71
+ bindPoiTap: _empty
72
+ },
73
+ Button: {
74
+ lang: 'en',
75
+ 'session-from': _empty,
76
+ 'send-message-title': _empty,
77
+ 'send-message-path': _empty,
78
+ 'send-message-img': _empty,
79
+ 'app-parameter': _empty,
80
+ 'show-message-card': _false,
81
+ 'business-id': _empty,
82
+ bindGetUserInfo: _empty,
83
+ bindContact: _empty,
84
+ bindGetPhoneNumber: _empty,
85
+ bindChooseAvatar: _empty,
86
+ bindError: _empty,
87
+ bindOpenSetting: _empty,
88
+ bindLaunchApp: _empty
89
+ },
90
+ Form: {
91
+ 'report-submit-timeout': _zero
92
+ },
93
+ Input: {
94
+ 'always-embed': _false,
95
+ 'adjust-position': _true,
96
+ 'hold-keyboard': _false,
97
+ 'safe-password-cert-path': '',
98
+ 'safe-password-length': '',
99
+ 'safe-password-time-stamp': '',
100
+ 'safe-password-nonce': '',
101
+ 'safe-password-salt': '',
102
+ 'safe-password-custom-hash': '',
103
+ 'auto-fill': _empty,
104
+ bindKeyboardHeightChange: _empty
105
+ },
106
+ Picker: {
107
+ 'header-text': _empty
108
+ },
109
+ PickerView: {
110
+ 'immediate-change': _false,
111
+ bindPickStart: _empty,
112
+ bindPickEnd: _empty
113
+ },
114
+ Slider: {
115
+ color: "'#e9e9e9'",
116
+ 'selected-color': "'#1aad19'"
117
+ },
118
+ Textarea: {
119
+ 'show-confirm-bar': _true,
120
+ 'adjust-position': _true,
121
+ 'hold-keyboard': _false,
122
+ 'disable-default-padding': _false,
123
+ 'confirm-type': "'return'",
124
+ 'confirm-hold': _false,
125
+ bindKeyboardHeightChange: _empty
126
+ },
127
+ ScrollView: {
128
+ 'enable-flex': _false,
129
+ 'scroll-anchoring': _false,
130
+ 'refresher-enabled': _false,
131
+ 'refresher-threshold': '45',
132
+ 'refresher-default-style': "'black'",
133
+ 'refresher-background': "'#FFF'",
134
+ 'refresher-triggered': _false,
135
+ enhanced: _false,
136
+ bounces: _true,
137
+ 'show-scrollbar': _true,
138
+ 'paging-enabled': _false,
139
+ 'fast-deceleration': _false,
140
+ bindDragStart: _empty,
141
+ bindDragging: _empty,
142
+ bindDragEnd: _empty,
143
+ bindRefresherPulling: _empty,
144
+ bindRefresherRefresh: _empty,
145
+ bindRefresherRestore: _empty,
146
+ bindRefresherAbort: _empty
147
+ },
148
+ Swiper: {
149
+ 'snap-to-edge': _false,
150
+ 'easing-function': "'default'"
151
+ },
152
+ SwiperItem: {
153
+ 'skip-hidden-item-layout': _false
154
+ },
155
+ Navigator: {
156
+ target: "'self'",
157
+ 'app-id': _empty,
158
+ path: _empty,
159
+ 'extra-data': _empty,
160
+ version: "'version'"
161
+ },
162
+ Camera: {
163
+ mode: "'normal'",
164
+ resolution: "'medium'",
165
+ 'frame-size': "'medium'",
166
+ bindInitDone: _empty,
167
+ bindScanCode: _empty
168
+ },
169
+ Image: {
170
+ webp: _false,
171
+ 'show-menu-by-longpress': _false
172
+ },
173
+ LivePlayer: {
174
+ mode: "'live'",
175
+ 'sound-mode': "'speaker'",
176
+ 'auto-pause-if-navigate': _true,
177
+ 'auto-pause-if-open-native': _true,
178
+ 'picture-in-picture-mode': '[]',
179
+ bindstatechange: _empty,
180
+ bindfullscreenchange: _empty,
181
+ bindnetstatus: _empty,
182
+ bindAudioVolumeNotify: _empty,
183
+ bindEnterPictureInPicture: _empty,
184
+ bindLeavePictureInPicture: _empty
185
+ },
186
+ Video: {
187
+ title: _empty,
188
+ 'play-btn-position': "'bottom'",
189
+ 'enable-play-gesture': _false,
190
+ 'auto-pause-if-navigate': _true,
191
+ 'auto-pause-if-open-native': _true,
192
+ 'vslide-gesture': _false,
193
+ 'vslide-gesture-in-fullscreen': _true,
194
+ 'ad-unit-id': _empty,
195
+ 'poster-for-crawler': _empty,
196
+ 'show-casting-button': _false,
197
+ 'picture-in-picture-mode': '[]',
198
+ // picture-in-picture-show-progress 属性先注释掉的原因如下:
199
+ // 该属性超过了 wxml 属性的长度限制,实际无法使用且导致编译报错。可等微信官方修复后再放开。
200
+ // 参考1:https://developers.weixin.qq.com/community/develop/doc/000a429beb87f0eac07acc0fc5b400
201
+ // 参考2: https://developers.weixin.qq.com/community/develop/doc/0006883619c48054286a4308258c00?_at=vyxqpllafi
202
+ // 'picture-in-picture-show-progress': 'false',
203
+ 'enable-auto-rotation': _false,
204
+ 'show-screen-lock-button': _false,
205
+ 'show-snapshot-button': _false,
206
+ 'show-background-playback-button': _false,
207
+ 'background-poster': _empty,
208
+ bindProgress: _empty,
209
+ bindLoadedMetadata: _empty,
210
+ bindControlsToggle: _empty,
211
+ bindEnterPictureInPicture: _empty,
212
+ bindLeavePictureInPicture: _empty,
213
+ bindSeekComplete: _empty,
214
+ bindAdLoad: _empty,
215
+ bindAdError: _empty,
216
+ bindAdClose: _empty,
217
+ bindAdPlay: _empty
218
+ },
219
+ Canvas: {
220
+ type: _empty
221
+ },
222
+ Ad: {
223
+ 'ad-type': "'banner'",
224
+ 'ad-theme': "'white'"
225
+ },
226
+ CoverView: {
227
+ 'marker-id': _empty,
228
+ slot: _empty
229
+ },
230
+ // ======== 额外组件 ========
231
+ Editor: {
232
+ 'read-only': _false,
233
+ placeholder: _empty,
234
+ 'show-img-size': _false,
235
+ 'show-img-toolbar': _false,
236
+ 'show-img-resize': _false,
237
+ focus: _false,
238
+ bindReady: _empty,
239
+ bindFocus: _empty,
240
+ bindBlur: _empty,
241
+ bindInput: _empty,
242
+ bindStatusChange: _empty,
243
+ name: _empty
244
+ },
245
+ MatchMedia: {
246
+ 'min-width': _empty,
247
+ 'max-width': _empty,
248
+ width: _empty,
249
+ 'min-height': _empty,
250
+ 'max-height': _empty,
251
+ height: _empty,
252
+ orientation: _empty
253
+ },
254
+ FunctionalPageNavigator: {
255
+ version: "'release'",
256
+ name: _empty,
257
+ args: _empty,
258
+ bindSuccess: _empty,
259
+ bindFail: _empty,
260
+ bindCancel: _empty
261
+ },
262
+ LivePusher: {
263
+ url: _empty,
264
+ mode: "'RTC'",
265
+ autopush: _false,
266
+ muted: _false,
267
+ 'enable-camera': _true,
268
+ 'auto-focus': _true,
269
+ orientation: "'vertical'",
270
+ beauty: _zero,
271
+ whiteness: _zero,
272
+ aspect: "'9:16'",
273
+ 'min-bitrate': '200',
274
+ 'max-bitrate': '1000',
275
+ 'audio-quality': "'high'",
276
+ 'waiting-image': _empty,
277
+ 'waiting-image-hash': _empty,
278
+ zoom: _false,
279
+ 'device-position': "'front'",
280
+ 'background-mute': _false,
281
+ mirror: _false,
282
+ 'remote-mirror': _false,
283
+ 'local-mirror': _false,
284
+ 'audio-reverb-type': _zero,
285
+ 'enable-mic': _true,
286
+ 'enable-agc': _false,
287
+ 'enable-ans': _false,
288
+ 'audio-volume-type': "'voicecall'",
289
+ 'video-width': '360',
290
+ 'video-height': '640',
291
+ 'beauty-style': "'smooth'",
292
+ filter: "'standard'",
293
+ animation: _empty,
294
+ bindStateChange: _empty,
295
+ bindNetStatus: _empty,
296
+ bindBgmStart: _empty,
297
+ bindBgmProgress: _empty,
298
+ bindBgmComplete: _empty,
299
+ bindAudioVolumeNotify: _empty
300
+ },
301
+ OfficialAccount: {
302
+ bindLoad: _empty,
303
+ bindError: _empty
304
+ },
305
+ OpenData: {
306
+ type: _empty,
307
+ 'open-gid': _empty,
308
+ lang: "'en'",
309
+ 'default-text': _empty,
310
+ 'default-avatar': _empty,
311
+ bindError: _empty
312
+ },
313
+ NavigationBar: {
314
+ title: _empty,
315
+ loading: _false,
316
+ 'front-color': _empty,
317
+ 'background-color': _empty,
318
+ 'color-animation-duration': _zero,
319
+ 'color-animation-timing-func': "'linear'"
320
+ },
321
+ PageMeta: {
322
+ 'background-text-style': _empty,
323
+ 'background-color': _empty,
324
+ 'background-color-top': _empty,
325
+ 'background-color-bottom': _empty,
326
+ 'scroll-top': "''",
327
+ 'scroll-duration': '300',
328
+ 'page-style': "''",
329
+ 'root-font-size': "''",
330
+ bindResize: _empty,
331
+ bindScroll: _empty,
332
+ bindScrollDone: _empty
333
+ },
334
+ VoipRoom: {
335
+ openid: _empty,
336
+ mode: "'camera'",
337
+ 'device-position': "'front'",
338
+ bindError: _empty
339
+ },
340
+ AdCustom: {
341
+ 'unit-id': _empty,
342
+ 'ad-intervals': _empty,
343
+ bindLoad: _empty,
344
+ bindError: _empty
345
+ },
346
+ PageContainer: {
347
+ show: _false,
348
+ duration: '300',
349
+ 'z-index': '100',
350
+ overlay: _true,
351
+ position: "'bottom'",
352
+ round: _false,
353
+ 'close-on-slideDown': _false,
354
+ 'overlay-style': _empty,
355
+ 'custom-style': _empty,
356
+ bindBeforeEnter: _empty,
357
+ bindEnter: _empty,
358
+ bindAfterEnter: _empty,
359
+ bindBeforeLeave: _empty,
360
+ bindLeave: _empty,
361
+ bindAfterLeave: _empty,
362
+ bindClickOverlay: _empty
363
+ },
364
+ ShareElement: {
365
+ mapkey: _empty,
366
+ transform: _false,
367
+ duration: '300',
368
+ 'easing-function': "'ease-out'"
369
+ },
370
+ KeyboardAccessory: {}
371
+ };
372
+
373
+ class Template extends template.UnRecursiveTemplate {
374
+ constructor(pluginOptions) {
375
+ super();
376
+ this.supportXS = true;
377
+ this.Adapter = {
378
+ if: 'wx:if',
379
+ else: 'wx:else',
380
+ elseif: 'wx:elif',
381
+ for: 'wx:for',
382
+ forItem: 'wx:for-item',
383
+ forIndex: 'wx:for-index',
384
+ key: 'wx:key',
385
+ xs: 'wxs',
386
+ type: 'weapp'
387
+ };
388
+ this.modifyTemplateResult = (res, nodeName, _level, children) => {
389
+ if (nodeName === 'keyboard-accessory')
390
+ return '';
391
+ if ((nodeName === 'textarea' || nodeName === 'input') && this.pluginOptions.enablekeyboardAccessory) {
392
+ const list = res.split('</template>');
393
+ const componentAlias = this.componentsAlias[nodeName];
394
+ const nodeNameAlias = componentAlias._num;
54
395
  const target = `
55
396
  <keyboard-accessory style="{{i.cn[0].st}}" class="{{i.cn[0].cl}}" bindtap="eh" id="{{i.cn[0].uid||i.cn[0].sid}}" data-sid="{{i.cn[0].sid}}">
56
397
  <block wx:for="{{i.cn[0].cn}}" wx:key="sid">
57
398
  <template is="{{xs.e(cid+1)}}" data="{{i:item,l:l}}" />
58
399
  </block>
59
400
  </keyboard-accessory>
60
- `;
61
- const templateFocus = list[1]
62
- .replace(children, target)
63
- .replace(`_${nodeNameAlias}_focus`, `_${nodeNameAlias}_focus_ka`);
64
- const templateBlur = list[2]
65
- .replace(children, target)
66
- .replace(`_${nodeNameAlias}_blur`, `_${nodeNameAlias}_blur_ka`);
67
- list.splice(3, 0, templateFocus, templateBlur);
68
- return list.join('</template>');
69
- }
70
- return res;
71
- };
72
- this.pluginOptions = pluginOptions || {};
73
- }
74
- buildXsTemplate() {
75
- return '<wxs module="xs" src="./utils.wxs" />';
76
- }
77
- replacePropName(name, value, componentName, componentAlias) {
78
- if (value === 'eh') {
79
- const nameLowerCase = name.toLowerCase();
80
- if (nameLowerCase === 'bindlongtap' && componentName !== 'canvas')
81
- return 'bindlongpress';
82
- return nameLowerCase;
83
- }
84
- if (componentName === 'share-element') {
85
- const mapKeyAlias = componentAlias.mapkey;
86
- if (value === `i.${mapKeyAlias}`)
87
- return 'key';
88
- }
89
- return name;
90
- }
91
- buildXSTepFocus(nn) {
92
- if (this.pluginOptions.enablekeyboardAccessory) {
93
- const textarea = this.componentsAlias.textarea._num;
94
- const input = this.componentsAlias.input._num;
95
- const ka = this.componentsAlias['keyboard-accessory']._num;
401
+ `;
402
+ const templateFocus = list[1]
403
+ .replace(children, target)
404
+ .replace(`_${nodeNameAlias}_focus`, `_${nodeNameAlias}_focus_ka`);
405
+ const templateBlur = list[2]
406
+ .replace(children, target)
407
+ .replace(`_${nodeNameAlias}_blur`, `_${nodeNameAlias}_blur_ka`);
408
+ list.splice(3, 0, templateFocus, templateBlur);
409
+ return list.join('</template>');
410
+ }
411
+ return res;
412
+ };
413
+ this.pluginOptions = pluginOptions || {};
414
+ }
415
+ buildXsTemplate() {
416
+ return '<wxs module="xs" src="./utils.wxs" />';
417
+ }
418
+ replacePropName(name, value, componentName, componentAlias) {
419
+ if (value === 'eh') {
420
+ const nameLowerCase = name.toLowerCase();
421
+ if (nameLowerCase === 'bindlongtap' && componentName !== 'canvas')
422
+ return 'bindlongpress';
423
+ return nameLowerCase;
424
+ }
425
+ if (componentName === 'share-element') {
426
+ const mapKeyAlias = componentAlias.mapkey;
427
+ if (value === `i.${mapKeyAlias}`)
428
+ return 'key';
429
+ }
430
+ return name;
431
+ }
432
+ buildXSTepFocus(nn) {
433
+ if (this.pluginOptions.enablekeyboardAccessory) {
434
+ const textarea = this.componentsAlias.textarea._num;
435
+ const input = this.componentsAlias.input._num;
436
+ const ka = this.componentsAlias['keyboard-accessory']._num;
96
437
  return `function(i, prefix) {
97
438
  var s = i.focus !== undefined ? 'focus' : 'blur'
98
439
  var r = prefix + i.${nn} + '_' + s
@@ -100,424 +441,84 @@ class Template extends template.UnRecursiveTemplate {
100
441
  r = r + '_ka'
101
442
  }
102
443
  return r
103
- }`;
104
- }
105
- else {
106
- return super.buildXSTepFocus(nn);
107
- }
108
- }
444
+ }`;
445
+ }
446
+ else {
447
+ return super.buildXSTepFocus(nn);
448
+ }
449
+ }
109
450
  }
110
451
 
111
- const _true = 'true';
112
- const _false = 'false';
113
- const _empty = '';
114
- const _zero = '0';
115
- const components = {
116
- // ======== 调整属性 ========
117
- Progress: {
118
- 'border-radius': _zero,
119
- 'font-size': '16',
120
- duration: '30',
121
- bindActiveEnd: _empty
122
- },
123
- RichText: {
124
- space: _empty,
125
- 'user-select': _false
126
- },
127
- Text: {
128
- 'user-select': _false
129
- },
130
- Map: {
131
- polygons: '[]',
132
- subkey: _empty,
133
- rotate: _zero,
134
- skew: _zero,
135
- 'max-scale': '20',
136
- 'min-scale': '3',
137
- 'enable-3D': _false,
138
- 'show-compass': _false,
139
- 'show-scale': _false,
140
- 'enable-overlooking': _false,
141
- 'enable-zoom': _true,
142
- 'enable-scroll': _true,
143
- 'enable-rotate': _false,
144
- 'enable-satellite': _false,
145
- 'enable-traffic': _false,
146
- setting: '[]',
147
- bindLabelTap: _empty,
148
- bindRegionChange: _empty,
149
- bindPoiTap: _empty
150
- },
151
- Button: {
152
- lang: 'en',
153
- 'session-from': _empty,
154
- 'send-message-title': _empty,
155
- 'send-message-path': _empty,
156
- 'send-message-img': _empty,
157
- 'app-parameter': _empty,
158
- 'show-message-card': _false,
159
- 'business-id': _empty,
160
- bindGetUserInfo: _empty,
161
- bindContact: _empty,
162
- bindGetPhoneNumber: _empty,
163
- bindChooseAvatar: _empty,
164
- bindError: _empty,
165
- bindOpenSetting: _empty,
166
- bindLaunchApp: _empty
167
- },
168
- Form: {
169
- 'report-submit-timeout': _zero
170
- },
171
- Input: {
172
- 'always-embed': _false,
173
- 'adjust-position': _true,
174
- 'hold-keyboard': _false,
175
- 'safe-password-cert-path': '',
176
- 'safe-password-length': '',
177
- 'safe-password-time-stamp': '',
178
- 'safe-password-nonce': '',
179
- 'safe-password-salt': '',
180
- 'safe-password-custom-hash': '',
181
- 'auto-fill': _empty,
182
- bindKeyboardHeightChange: _empty
183
- },
184
- Picker: {
185
- 'header-text': _empty
186
- },
187
- PickerView: {
188
- 'immediate-change': _false,
189
- bindPickStart: _empty,
190
- bindPickEnd: _empty
191
- },
192
- Slider: {
193
- color: "'#e9e9e9'",
194
- 'selected-color': "'#1aad19'"
195
- },
196
- Textarea: {
197
- 'show-confirm-bar': _true,
198
- 'adjust-position': _true,
199
- 'hold-keyboard': _false,
200
- 'disable-default-padding': _false,
201
- 'confirm-type': "'return'",
202
- 'confirm-hold': _false,
203
- bindKeyboardHeightChange: _empty
204
- },
205
- ScrollView: {
206
- 'enable-flex': _false,
207
- 'scroll-anchoring': _false,
208
- 'refresher-enabled': _false,
209
- 'refresher-threshold': '45',
210
- 'refresher-default-style': "'black'",
211
- 'refresher-background': "'#FFF'",
212
- 'refresher-triggered': _false,
213
- enhanced: _false,
214
- bounces: _true,
215
- 'show-scrollbar': _true,
216
- 'paging-enabled': _false,
217
- 'fast-deceleration': _false,
218
- bindDragStart: _empty,
219
- bindDragging: _empty,
220
- bindDragEnd: _empty,
221
- bindRefresherPulling: _empty,
222
- bindRefresherRefresh: _empty,
223
- bindRefresherRestore: _empty,
224
- bindRefresherAbort: _empty
225
- },
226
- Swiper: {
227
- 'snap-to-edge': _false,
228
- 'easing-function': "'default'"
229
- },
230
- SwiperItem: {
231
- 'skip-hidden-item-layout': _false
232
- },
233
- Navigator: {
234
- target: "'self'",
235
- 'app-id': _empty,
236
- path: _empty,
237
- 'extra-data': _empty,
238
- version: "'version'"
239
- },
240
- Camera: {
241
- mode: "'normal'",
242
- resolution: "'medium'",
243
- 'frame-size': "'medium'",
244
- bindInitDone: _empty,
245
- bindScanCode: _empty
246
- },
247
- Image: {
248
- webp: _false,
249
- 'show-menu-by-longpress': _false
250
- },
251
- LivePlayer: {
252
- mode: "'live'",
253
- 'sound-mode': "'speaker'",
254
- 'auto-pause-if-navigate': _true,
255
- 'auto-pause-if-open-native': _true,
256
- 'picture-in-picture-mode': '[]',
257
- bindstatechange: _empty,
258
- bindfullscreenchange: _empty,
259
- bindnetstatus: _empty,
260
- bindAudioVolumeNotify: _empty,
261
- bindEnterPictureInPicture: _empty,
262
- bindLeavePictureInPicture: _empty
263
- },
264
- Video: {
265
- title: _empty,
266
- 'play-btn-position': "'bottom'",
267
- 'enable-play-gesture': _false,
268
- 'auto-pause-if-navigate': _true,
269
- 'auto-pause-if-open-native': _true,
270
- 'vslide-gesture': _false,
271
- 'vslide-gesture-in-fullscreen': _true,
272
- 'ad-unit-id': _empty,
273
- 'poster-for-crawler': _empty,
274
- 'show-casting-button': _false,
275
- 'picture-in-picture-mode': '[]',
276
- // picture-in-picture-show-progress 属性先注释掉的原因如下:
277
- // 该属性超过了 wxml 属性的长度限制,实际无法使用且导致编译报错。可等微信官方修复后再放开。
278
- // 参考1:https://developers.weixin.qq.com/community/develop/doc/000a429beb87f0eac07acc0fc5b400
279
- // 参考2: https://developers.weixin.qq.com/community/develop/doc/0006883619c48054286a4308258c00?_at=vyxqpllafi
280
- // 'picture-in-picture-show-progress': 'false',
281
- 'enable-auto-rotation': _false,
282
- 'show-screen-lock-button': _false,
283
- 'show-snapshot-button': _false,
284
- 'show-background-playback-button': _false,
285
- 'background-poster': _empty,
286
- bindProgress: _empty,
287
- bindLoadedMetadata: _empty,
288
- bindControlsToggle: _empty,
289
- bindEnterPictureInPicture: _empty,
290
- bindLeavePictureInPicture: _empty,
291
- bindSeekComplete: _empty,
292
- bindAdLoad: _empty,
293
- bindAdError: _empty,
294
- bindAdClose: _empty,
295
- bindAdPlay: _empty
296
- },
297
- Canvas: {
298
- type: _empty
299
- },
300
- Ad: {
301
- 'ad-type': "'banner'",
302
- 'ad-theme': "'white'"
303
- },
304
- CoverView: {
305
- 'marker-id': _empty,
306
- slot: _empty
307
- },
308
- // ======== 额外组件 ========
309
- Editor: {
310
- 'read-only': _false,
311
- placeholder: _empty,
312
- 'show-img-size': _false,
313
- 'show-img-toolbar': _false,
314
- 'show-img-resize': _false,
315
- focus: _false,
316
- bindReady: _empty,
317
- bindFocus: _empty,
318
- bindBlur: _empty,
319
- bindInput: _empty,
320
- bindStatusChange: _empty,
321
- name: _empty
322
- },
323
- MatchMedia: {
324
- 'min-width': _empty,
325
- 'max-width': _empty,
326
- width: _empty,
327
- 'min-height': _empty,
328
- 'max-height': _empty,
329
- height: _empty,
330
- orientation: _empty
331
- },
332
- FunctionalPageNavigator: {
333
- version: "'release'",
334
- name: _empty,
335
- args: _empty,
336
- bindSuccess: _empty,
337
- bindFail: _empty,
338
- bindCancel: _empty
339
- },
340
- LivePusher: {
341
- url: _empty,
342
- mode: "'RTC'",
343
- autopush: _false,
344
- muted: _false,
345
- 'enable-camera': _true,
346
- 'auto-focus': _true,
347
- orientation: "'vertical'",
348
- beauty: _zero,
349
- whiteness: _zero,
350
- aspect: "'9:16'",
351
- 'min-bitrate': '200',
352
- 'max-bitrate': '1000',
353
- 'audio-quality': "'high'",
354
- 'waiting-image': _empty,
355
- 'waiting-image-hash': _empty,
356
- zoom: _false,
357
- 'device-position': "'front'",
358
- 'background-mute': _false,
359
- mirror: _false,
360
- 'remote-mirror': _false,
361
- 'local-mirror': _false,
362
- 'audio-reverb-type': _zero,
363
- 'enable-mic': _true,
364
- 'enable-agc': _false,
365
- 'enable-ans': _false,
366
- 'audio-volume-type': "'voicecall'",
367
- 'video-width': '360',
368
- 'video-height': '640',
369
- 'beauty-style': "'smooth'",
370
- filter: "'standard'",
371
- animation: _empty,
372
- bindStateChange: _empty,
373
- bindNetStatus: _empty,
374
- bindBgmStart: _empty,
375
- bindBgmProgress: _empty,
376
- bindBgmComplete: _empty,
377
- bindAudioVolumeNotify: _empty
378
- },
379
- OfficialAccount: {
380
- bindLoad: _empty,
381
- bindError: _empty
382
- },
383
- OpenData: {
384
- type: _empty,
385
- 'open-gid': _empty,
386
- lang: "'en'",
387
- 'default-text': _empty,
388
- 'default-avatar': _empty,
389
- bindError: _empty
390
- },
391
- NavigationBar: {
392
- title: _empty,
393
- loading: _false,
394
- 'front-color': _empty,
395
- 'background-color': _empty,
396
- 'color-animation-duration': _zero,
397
- 'color-animation-timing-func': "'linear'"
398
- },
399
- PageMeta: {
400
- 'background-text-style': _empty,
401
- 'background-color': _empty,
402
- 'background-color-top': _empty,
403
- 'background-color-bottom': _empty,
404
- 'scroll-top': "''",
405
- 'scroll-duration': '300',
406
- 'page-style': "''",
407
- 'root-font-size': "''",
408
- bindResize: _empty,
409
- bindScroll: _empty,
410
- bindScrollDone: _empty
411
- },
412
- VoipRoom: {
413
- openid: _empty,
414
- mode: "'camera'",
415
- 'device-position': "'front'",
416
- bindError: _empty
417
- },
418
- AdCustom: {
419
- 'unit-id': _empty,
420
- 'ad-intervals': _empty,
421
- bindLoad: _empty,
422
- bindError: _empty
423
- },
424
- PageContainer: {
425
- show: _false,
426
- duration: '300',
427
- 'z-index': '100',
428
- overlay: _true,
429
- position: "'bottom'",
430
- round: _false,
431
- 'close-on-slideDown': _false,
432
- 'overlay-style': _empty,
433
- 'custom-style': _empty,
434
- bindBeforeEnter: _empty,
435
- bindEnter: _empty,
436
- bindAfterEnter: _empty,
437
- bindBeforeLeave: _empty,
438
- bindLeave: _empty,
439
- bindAfterLeave: _empty,
440
- bindClickOverlay: _empty
441
- },
442
- ShareElement: {
443
- mapkey: _empty,
444
- transform: _false,
445
- duration: '300',
446
- 'easing-function': "'ease-out'"
447
- },
448
- KeyboardAccessory: {}
449
- };
450
-
451
- const PACKAGE_NAME = '@tarojs/plugin-platform-weapp';
452
- class Weapp extends service.TaroPlatformBase {
453
- /**
454
- * 1. setupTransaction - init
455
- * 2. setup
456
- * 3. setupTransaction - close
457
- * 4. buildTransaction - init
458
- * 5. build
459
- * 6. buildTransaction - close
460
- */
461
- constructor(ctx, config, pluginOptions) {
462
- super(ctx, config);
463
- this.platform = 'weapp';
464
- this.globalObject = 'wx';
465
- this.projectConfigJson = this.config.projectConfigName || 'project.config.json';
466
- this.runtimePath = `${PACKAGE_NAME}/dist/runtime`;
467
- this.taroComponentsPath = `${PACKAGE_NAME}/dist/components-react`;
468
- this.fileType = {
469
- templ: '.wxml',
470
- style: '.wxss',
471
- config: '.json',
472
- script: '.js',
473
- xs: '.wxs'
474
- };
475
- this.template = new Template(pluginOptions);
476
- this.setupTransaction.addWrapper({
477
- close() {
478
- this.modifyTemplate(pluginOptions);
479
- this.modifyWebpackConfig();
480
- }
481
- });
482
- }
483
- /**
484
- * 增加组件或修改组件属性
485
- */
486
- modifyTemplate(pluginOptions) {
487
- const template = this.template;
488
- template.mergeComponents(this.ctx, components);
489
- template.voidElements.add('voip-room');
490
- template.focusComponents.add('editor');
491
- if (pluginOptions === null || pluginOptions === void 0 ? void 0 : pluginOptions.enablekeyboardAccessory) {
492
- template.voidElements.delete('input');
493
- template.voidElements.delete('textarea');
494
- }
495
- }
496
- /**
497
- * 修改 Webpack 配置
498
- */
499
- modifyWebpackConfig() {
500
- this.ctx.modifyWebpackChain(({ chain }) => {
501
- // 解决微信小程序 sourcemap 映射失败的问题,#9412
502
- chain.output.devtoolModuleFilenameTemplate((info) => {
503
- const resourcePath = info.resourcePath.replace(/[/\\]/g, '_');
504
- return `webpack://${info.namespace}/${resourcePath}`;
505
- });
506
- });
507
- }
452
+ const PACKAGE_NAME = '@tarojs/plugin-platform-weapp';
453
+ class Weapp extends service.TaroPlatformBase {
454
+ /**
455
+ * 1. setupTransaction - init
456
+ * 2. setup
457
+ * 3. setupTransaction - close
458
+ * 4. buildTransaction - init
459
+ * 5. build
460
+ * 6. buildTransaction - close
461
+ */
462
+ constructor(ctx, config, pluginOptions) {
463
+ super(ctx, config);
464
+ this.platform = 'weapp';
465
+ this.globalObject = 'wx';
466
+ this.projectConfigJson = this.config.projectConfigName || 'project.config.json';
467
+ this.runtimePath = `${PACKAGE_NAME}/dist/runtime`;
468
+ this.taroComponentsPath = `${PACKAGE_NAME}/dist/components-react`;
469
+ this.fileType = {
470
+ templ: '.wxml',
471
+ style: '.wxss',
472
+ config: '.json',
473
+ script: '.js',
474
+ xs: '.wxs'
475
+ };
476
+ this.template = new Template(pluginOptions);
477
+ this.setupTransaction.addWrapper({
478
+ close() {
479
+ this.modifyTemplate(pluginOptions);
480
+ this.modifyWebpackConfig();
481
+ }
482
+ });
483
+ }
484
+ /**
485
+ * 增加组件或修改组件属性
486
+ */
487
+ modifyTemplate(pluginOptions) {
488
+ const template = this.template;
489
+ template.mergeComponents(this.ctx, components);
490
+ template.voidElements.add('voip-room');
491
+ template.focusComponents.add('editor');
492
+ if (pluginOptions === null || pluginOptions === void 0 ? void 0 : pluginOptions.enablekeyboardAccessory) {
493
+ template.voidElements.delete('input');
494
+ template.voidElements.delete('textarea');
495
+ }
496
+ }
497
+ /**
498
+ * 修改 Webpack 配置
499
+ */
500
+ modifyWebpackConfig() {
501
+ this.ctx.modifyWebpackChain(({ chain }) => {
502
+ // 解决微信小程序 sourcemap 映射失败的问题,#9412
503
+ chain.output.devtoolModuleFilenameTemplate((info) => {
504
+ const resourcePath = info.resourcePath.replace(/[/\\]/g, '_');
505
+ return `webpack://${info.namespace}/${resourcePath}`;
506
+ });
507
+ });
508
+ }
508
509
  }
509
510
 
510
- var index = (ctx, options) => {
511
- ctx.registerPlatform({
512
- name: 'weapp',
513
- useConfigName: 'mini',
514
- fn({ config }) {
515
- return __awaiter(this, void 0, void 0, function* () {
516
- const program = new Weapp(ctx, config, options || {});
517
- yield program.start();
518
- });
519
- }
520
- });
511
+ var index = (ctx, options) => {
512
+ ctx.registerPlatform({
513
+ name: 'weapp',
514
+ useConfigName: 'mini',
515
+ fn({ config }) {
516
+ return __awaiter(this, void 0, void 0, function* () {
517
+ const program = new Weapp(ctx, config, options || {});
518
+ yield program.start();
519
+ });
520
+ }
521
+ });
521
522
  };
522
523
 
523
524
  exports.Weapp = Weapp;