@tarojs/plugin-platform-ascf 4.1.2

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 ADDED
@@ -0,0 +1,744 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var service = require('@tarojs/service');
6
+ var template = require('@tarojs/shared/dist/template');
7
+
8
+ /******************************************************************************
9
+ Copyright (c) Microsoft Corporation.
10
+
11
+ Permission to use, copy, modify, and/or distribute this software for any
12
+ purpose with or without fee is hereby granted.
13
+
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
+ ***************************************************************************** */
22
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
23
+
24
+
25
+ function __awaiter(thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ }
34
+
35
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
36
+ var e = new Error(message);
37
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
38
+ };
39
+
40
+ const _true = 'true';
41
+ const _false = 'false';
42
+ const _empty = '';
43
+ const _zero = '0';
44
+ const _object = '{}';
45
+ const components = {
46
+ // ======== 调整属性 ========
47
+ Progress: {
48
+ 'border-radius': _zero,
49
+ 'font-size': '16',
50
+ duration: '30',
51
+ bindActiveEnd: _empty
52
+ },
53
+ RichText: {
54
+ space: _empty,
55
+ 'user-select': _false,
56
+ mode: "'default'"
57
+ },
58
+ Text: {
59
+ 'user-select': _false,
60
+ overflow: 'visible',
61
+ 'max-lines': ''
62
+ },
63
+ Map: {
64
+ polygons: '[]',
65
+ subkey: _empty,
66
+ rotate: _zero,
67
+ skew: _zero,
68
+ 'max-scale': '20',
69
+ 'min-scale': '3',
70
+ 'enable-3D': _false,
71
+ 'show-compass': _false,
72
+ 'show-scale': _false,
73
+ 'enable-overlooking': _false,
74
+ 'enable-auto-max-overlooking': _false,
75
+ 'enable-zoom': _true,
76
+ 'enable-scroll': _true,
77
+ 'enable-rotate': _false,
78
+ 'enable-satellite': _false,
79
+ 'enable-traffic': _false,
80
+ 'enable-poi': _true,
81
+ 'enable-building': _true,
82
+ setting: _object,
83
+ bindLabelTap: _empty,
84
+ bindRegionChange: _empty,
85
+ bindPoiTap: _empty,
86
+ bindPolylineTap: _empty,
87
+ bindAbilitySuccess: _empty,
88
+ bindAbilityFailed: _empty,
89
+ bindAuthSuccess: _empty,
90
+ bindInterpolatePoint: _empty,
91
+ bindError: _empty,
92
+ bindAnchorPointTap: _empty
93
+ },
94
+ Button: {
95
+ lang: 'en',
96
+ 'session-from': _empty,
97
+ 'send-message-title': _empty,
98
+ 'send-message-path': _empty,
99
+ 'send-message-img': _empty,
100
+ 'app-parameter': _empty,
101
+ 'show-message-card': _false,
102
+ 'business-id': _empty,
103
+ bindGetUserInfo: _empty,
104
+ bindContact: _empty,
105
+ bindGetPhoneNumber: _empty,
106
+ bindGetRealTimePhoneNumber: _empty,
107
+ bindChooseAvatar: _empty,
108
+ bindError: _empty,
109
+ bindOpenSetting: _empty,
110
+ bindLaunchApp: _empty,
111
+ bindAgreePrivacyAuthorization: _empty
112
+ },
113
+ Form: {
114
+ 'report-submit-timeout': _zero
115
+ },
116
+ Input: {
117
+ 'always-embed': _false,
118
+ 'adjust-position': _true,
119
+ 'hold-keyboard': _false,
120
+ 'safe-password-cert-path': '',
121
+ 'safe-password-length': '',
122
+ 'safe-password-time-stamp': '',
123
+ 'safe-password-nonce': '',
124
+ 'safe-password-salt': '',
125
+ 'safe-password-custom-hash': '',
126
+ 'auto-fill': _empty,
127
+ 'cursor-color': '',
128
+ bindKeyboardHeightChange: _empty,
129
+ bindNicknameReview: _empty,
130
+ bindSelectionChange: _empty,
131
+ bindKeyboardCompositionStart: _empty,
132
+ bindKeyboardCompositionUpdate: _empty,
133
+ bindKeyboardCompositionEnd: _empty,
134
+ },
135
+ Picker: {
136
+ 'header-text': _empty,
137
+ level: 'region'
138
+ },
139
+ PickerView: {
140
+ 'immediate-change': _false,
141
+ bindPickStart: _empty,
142
+ bindPickEnd: _empty
143
+ },
144
+ Slider: {
145
+ color: "'#e9e9e9'",
146
+ 'selected-color': "'#1aad19'"
147
+ },
148
+ Textarea: {
149
+ 'show-confirm-bar': _true,
150
+ 'adjust-position': _true,
151
+ 'hold-keyboard': _false,
152
+ 'disable-default-padding': _false,
153
+ 'confirm-type': "'return'",
154
+ 'confirm-hold': _false,
155
+ 'adjust-keyboard-to': "'cursor'",
156
+ bindKeyboardHeightChange: _empty,
157
+ bindSelectionChange: _empty,
158
+ bindKeyboardCompositionStart: _empty,
159
+ bindKeyboardCompositionUpdate: _empty,
160
+ bindKeyboardCompositionEnd: _empty,
161
+ },
162
+ ScrollView: {
163
+ 'enable-flex': _false,
164
+ 'scroll-anchoring': _false,
165
+ enhanced: _false,
166
+ 'using-sticky': _false,
167
+ 'paging-enabled': _false,
168
+ 'enable-passive': _false,
169
+ 'refresher-enabled': _false,
170
+ 'refresher-threshold': '45',
171
+ 'refresher-default-style': "'black'",
172
+ 'refresher-background': "'#FFF'",
173
+ 'refresher-triggered': _false,
174
+ bounces: _true,
175
+ 'show-scrollbar': _true,
176
+ 'fast-deceleration': _false,
177
+ type: "'list'",
178
+ 'associative-container': "''",
179
+ reverse: _false,
180
+ clip: _true,
181
+ 'enable-back-to-top': _false,
182
+ 'cache-extent': _empty,
183
+ 'min-drag-distance': '18',
184
+ 'scroll-into-view-within-extent': _false,
185
+ 'scroll-into-view-alignment': "'start'",
186
+ padding: '[0,0,0,0]',
187
+ 'refresher-two-level-enabled': _false,
188
+ 'refresher-two-level-triggered': _false,
189
+ 'refresher-two-level-threshold': '150',
190
+ 'refresher-two-level-close-threshold': '80',
191
+ 'refresher-two-level-scroll-enabled': _false,
192
+ 'refresher-ballistic-refresh-enabled': _false,
193
+ 'refresher-two-level-pinned': _false,
194
+ bindDragStart: _empty,
195
+ bindDragging: _empty,
196
+ bindDragEnd: _empty,
197
+ bindRefresherPulling: _empty,
198
+ bindRefresherRefresh: _empty,
199
+ bindRefresherRestore: _empty,
200
+ bindRefresherAbort: _empty,
201
+ bindScrollStart: _empty,
202
+ bindScrollEnd: _empty,
203
+ bindRefresherWillRefresh: _empty,
204
+ bindRefresherStatusChange: _empty
205
+ },
206
+ StickySection: {
207
+ 'push-pinned-header': _true,
208
+ padding: '[0, 0, 0, 0]'
209
+ },
210
+ GridView: {
211
+ type: "'aligned'",
212
+ 'cross-axis-count': '2',
213
+ 'max-cross-axis-extent': _zero,
214
+ 'main-axis-gap': _zero,
215
+ 'cross-axis-gap': _zero,
216
+ padding: '[0, 0, 0, 0]'
217
+ },
218
+ GridBuilder: {
219
+ type: "'aligned'",
220
+ list: '[]',
221
+ 'cross-axis-count': '2',
222
+ 'max-cross-axis-extent': _zero,
223
+ 'main-axis-gap': _zero,
224
+ 'cross-axis-gap': _zero,
225
+ padding: '[0, 0, 0, 0]',
226
+ bindItemBuild: _empty,
227
+ bindItemDispose: _empty
228
+ },
229
+ ListView: {
230
+ padding: '[0, 0, 0, 0]'
231
+ },
232
+ ListBuilder: {
233
+ list: '[]',
234
+ type: 'static',
235
+ padding: '[0, 0, 0, 0]',
236
+ 'child-count': _empty,
237
+ 'child-height': _empty,
238
+ bindItemBuild: _empty,
239
+ bindItemDispose: _empty
240
+ },
241
+ StickyHeader: {
242
+ 'offset-top': '0',
243
+ padding: '[0, 0, 0, 0]'
244
+ },
245
+ Swiper: {
246
+ 'snap-to-edge': _false,
247
+ 'easing-function': "'default'",
248
+ 'layout-type': "'normal'",
249
+ 'transformer-type': "'scaleAndFade'",
250
+ 'indicator-type': "'normal'",
251
+ 'indicator-margin': '10',
252
+ 'indicator-spacing': '4',
253
+ 'indicator-radius': '4',
254
+ 'indicator-width': '8',
255
+ 'indicator-height': '8',
256
+ 'indicator-alignment': "'auto'",
257
+ 'indicator-offset': '[0, 0]',
258
+ 'scroll-with-animation': _true,
259
+ 'cache-extent': '0',
260
+ },
261
+ SwiperItem: {
262
+ 'skip-hidden-item-layout': _false
263
+ },
264
+ Navigator: {
265
+ target: "'self'",
266
+ 'app-id': _empty,
267
+ path: _empty,
268
+ 'extra-data': _empty,
269
+ version: "'version'"
270
+ },
271
+ Camera: {
272
+ mode: "'normal'",
273
+ resolution: "'medium'",
274
+ 'frame-size': "'medium'",
275
+ bindInitDone: _empty,
276
+ bindScanCode: _empty
277
+ },
278
+ Image: {
279
+ webp: _false,
280
+ 'show-menu-by-longpress': _false,
281
+ 'fade-in': _false
282
+ },
283
+ LivePlayer: {
284
+ mode: "'live'",
285
+ 'sound-mode': "'speaker'",
286
+ 'auto-pause-if-navigate': _true,
287
+ 'auto-pause-if-open-native': _true,
288
+ 'picture-in-picture-mode': '[]',
289
+ 'enable-auto-rotation': _false,
290
+ 'referrer-policy': "'no-referrer'",
291
+ 'enable-casting': _false,
292
+ bindstatechange: _empty,
293
+ bindfullscreenchange: _empty,
294
+ bindnetstatus: _empty,
295
+ bindAudioVolumeNotify: _empty,
296
+ bindEnterPictureInPicture: _empty,
297
+ bindLeavePictureInPicture: _empty,
298
+ bindCastingUserSelect: _empty,
299
+ bindCastingStateChange: _empty,
300
+ bindCastingInterrupt: _empty
301
+ },
302
+ Video: {
303
+ title: _empty,
304
+ 'play-btn-position': "'bottom'",
305
+ 'enable-play-gesture': _false,
306
+ 'auto-pause-if-navigate': _true,
307
+ 'auto-pause-if-open-native': _true,
308
+ 'vslide-gesture': _false,
309
+ 'vslide-gesture-in-fullscreen': _true,
310
+ 'show-bottom-progress': _true,
311
+ 'ad-unit-id': _empty,
312
+ 'poster-for-crawler': _empty,
313
+ 'show-casting-button': _false,
314
+ 'picture-in-picture-mode': '[]',
315
+ // picture-in-picture-show-progress 属性先注释掉的原因如下:
316
+ // 该属性超过了 hxml 属性的长度限制,实际无法使用且导致编译报错。可等微信官方修复后再放开。
317
+ // 参考1:https://developers.weixin.qq.com/community/develop/doc/000a429beb87f0eac07acc0fc5b400
318
+ // 参考2: https://developers.weixin.qq.com/community/develop/doc/0006883619c48054286a4308258c00?_at=vyxqpllafi
319
+ // 'picture-in-picture-show-progress': 'false',
320
+ 'enable-auto-rotation': _false,
321
+ 'show-screen-lock-button': _false,
322
+ 'show-snapshot-button': _false,
323
+ 'show-background-playback-button': _false,
324
+ 'background-poster': _empty,
325
+ 'referrer-policy': "'no-referrer'",
326
+ 'is-drm': _false,
327
+ 'is-live': _false,
328
+ 'provision-url': _empty,
329
+ 'certificate-url': _empty,
330
+ 'license-url': _empty,
331
+ 'preferred-peak-bit-rate': _empty,
332
+ bindProgress: _empty,
333
+ bindLoadedMetadata: _empty,
334
+ bindControlsToggle: _empty,
335
+ bindEnterPictureInPicture: _empty,
336
+ bindLeavePictureInPicture: _empty,
337
+ bindSeekComplete: _empty,
338
+ bindCastingUserSelect: _empty,
339
+ bindCastingStateChange: _empty,
340
+ bindCastingInterrupt: _empty,
341
+ bindAdLoad: _empty,
342
+ bindAdError: _empty,
343
+ bindAdClose: _empty,
344
+ bindAdPlay: _empty
345
+ },
346
+ Canvas: {
347
+ type: _empty
348
+ },
349
+ Ad: {
350
+ 'ad-type': "'banner'",
351
+ 'ad-theme': "'white'"
352
+ },
353
+ CoverView: {
354
+ 'marker-id': _empty,
355
+ slot: _empty
356
+ },
357
+ // ======== 额外组件 ========
358
+ Editor: {
359
+ 'read-only': _false,
360
+ placeholder: _empty,
361
+ 'show-img-size': _false,
362
+ 'show-img-toolbar': _false,
363
+ 'show-img-resize': _false,
364
+ focus: _false,
365
+ bindReady: _empty,
366
+ bindFocus: _empty,
367
+ bindBlur: _empty,
368
+ bindInput: _empty,
369
+ bindStatusChange: _empty,
370
+ name: _empty
371
+ },
372
+ MatchMedia: {
373
+ 'min-width': _empty,
374
+ 'max-width': _empty,
375
+ width: _empty,
376
+ 'min-height': _empty,
377
+ 'max-height': _empty,
378
+ height: _empty,
379
+ orientation: _empty
380
+ },
381
+ FunctionalPageNavigator: {
382
+ version: "'release'",
383
+ name: _empty,
384
+ args: _empty,
385
+ bindSuccess: _empty,
386
+ bindFail: _empty,
387
+ bindCancel: _empty
388
+ },
389
+ LivePusher: {
390
+ url: _empty,
391
+ mode: "'RTC'",
392
+ autopush: _false,
393
+ muted: _false,
394
+ 'enable-camera': _true,
395
+ 'auto-focus': _true,
396
+ orientation: "'vertical'",
397
+ beauty: _zero,
398
+ whiteness: _zero,
399
+ aspect: "'9:16'",
400
+ 'min-bitrate': '200',
401
+ 'max-bitrate': '1000',
402
+ 'audio-quality': "'high'",
403
+ 'waiting-image': _empty,
404
+ 'waiting-image-hash': _empty,
405
+ zoom: _false,
406
+ 'device-position': "'front'",
407
+ 'background-mute': _false,
408
+ mirror: _false,
409
+ 'remote-mirror': _false,
410
+ 'local-mirror': _false,
411
+ 'audio-reverb-type': _zero,
412
+ 'enable-mic': _true,
413
+ 'enable-agc': _false,
414
+ 'enable-ans': _false,
415
+ 'audio-volume-type': "'voicecall'",
416
+ 'video-width': '360',
417
+ 'video-height': '640',
418
+ 'beauty-style': "'smooth'",
419
+ filter: "'standard'",
420
+ 'picture-in-picture-mode': '[]',
421
+ animation: _empty,
422
+ bindStateChange: _empty,
423
+ bindNetStatus: _empty,
424
+ bindBgmStart: _empty,
425
+ bindBgmProgress: _empty,
426
+ bindBgmComplete: _empty,
427
+ bindAudioVolumeNotify: _empty
428
+ },
429
+ OfficialAccount: {
430
+ bindLoad: _empty,
431
+ bindError: _empty
432
+ },
433
+ OpenData: {
434
+ type: _empty,
435
+ 'open-gid': _empty,
436
+ lang: "'en'",
437
+ 'default-text': _empty,
438
+ 'default-avatar': _empty,
439
+ bindError: _empty
440
+ },
441
+ NavigationBar: {
442
+ title: _empty,
443
+ loading: _false,
444
+ 'front-color': "'#000000'",
445
+ 'background-color': _empty,
446
+ 'color-animation-duration': _zero,
447
+ 'color-animation-timing-func': "'linear'"
448
+ },
449
+ PageMeta: {
450
+ 'background-text-style': _empty,
451
+ 'background-color': _empty,
452
+ 'background-color-top': _empty,
453
+ 'background-color-bottom': _empty,
454
+ 'root-background-color': _empty,
455
+ 'scroll-top': "''",
456
+ 'scroll-duration': '300',
457
+ 'page-style': "''",
458
+ 'root-font-size': "''",
459
+ 'page-orientation': "''",
460
+ bindResize: _empty,
461
+ bindScroll: _empty,
462
+ bindScrollDone: _empty
463
+ },
464
+ VoipRoom: {
465
+ openid: _empty,
466
+ mode: "'camera'",
467
+ 'device-position': "'front'",
468
+ bindError: _empty
469
+ },
470
+ AdCustom: {
471
+ 'unit-id': _empty,
472
+ 'ad-intervals': _empty,
473
+ bindLoad: _empty,
474
+ bindError: _empty
475
+ },
476
+ PageContainer: {
477
+ show: _false,
478
+ duration: '300',
479
+ 'z-index': '100',
480
+ overlay: _true,
481
+ position: "'bottom'",
482
+ round: _false,
483
+ 'close-on-slide-down': _false,
484
+ 'overlay-style': _empty,
485
+ 'custom-style': _empty,
486
+ bindBeforeEnter: _empty,
487
+ bindEnter: _empty,
488
+ bindAfterEnter: _empty,
489
+ bindBeforeLeave: _empty,
490
+ bindLeave: _empty,
491
+ bindAfterLeave: _empty,
492
+ bindClickOverlay: _empty
493
+ },
494
+ ShareElement: {
495
+ mapkey: _empty,
496
+ transform: _false,
497
+ duration: '300',
498
+ 'easing-function': "'ease-out'",
499
+ 'transition-on-gesture': _false,
500
+ 'shuttle-on-push': "'to'",
501
+ 'shuttle-on-pop': "'to'",
502
+ 'rect-tween-type': "'materialRectArc'"
503
+ },
504
+ KeyboardAccessory: {},
505
+ RootPortal: {
506
+ enable: _true
507
+ },
508
+ ChannelLive: {
509
+ 'feed-id': _empty,
510
+ 'finder-user-name': _empty
511
+ },
512
+ ChannelVideo: {
513
+ 'feed-id': _empty,
514
+ 'finder-user-name': _empty,
515
+ 'feed-token': _empty,
516
+ autoplay: _false,
517
+ loop: _false,
518
+ muted: _false,
519
+ 'object-fit': "'contain'",
520
+ bindError: _empty
521
+ },
522
+ Snapshot: {
523
+ mode: "'view'",
524
+ },
525
+ Span: {},
526
+ OpenContainer: {
527
+ transitionType: "'fade'",
528
+ transitionDuration: '300',
529
+ closedColor: "'white'",
530
+ closedElevation: _zero,
531
+ closeBorderRadius: _zero,
532
+ middleColor: _empty,
533
+ openColor: "'white'",
534
+ openElevation: _zero,
535
+ openBorderRadius: _zero
536
+ },
537
+ DraggableSheet: {
538
+ initialChildSize: '0.5',
539
+ minChildSize: '0.25',
540
+ maxChildSize: '1.0',
541
+ snap: _false,
542
+ snapSizes: '[]'
543
+ },
544
+ NestedScrollHeader: {},
545
+ NestedScrollBody: {},
546
+ // skyline手势组件
547
+ DoubleTapGestureHandler: {},
548
+ ForcePressGestureHandler: {},
549
+ HorizontalDragGestureHandler: {},
550
+ LongPressGestureHandler: {},
551
+ PanGestureHandler: {},
552
+ ScaleGestureHandler: {},
553
+ TapGestureHandler: {},
554
+ VerticalDragGestureHandler: {},
555
+ };
556
+
557
+ class Template extends template.UnRecursiveTemplate {
558
+ constructor(pluginOptions) {
559
+ super();
560
+ this.supportXS = true;
561
+ this.Adapter = {
562
+ if: 'has:if',
563
+ else: 'has:else',
564
+ elseif: 'has:elif',
565
+ for: 'has:for',
566
+ forItem: 'has:for-item',
567
+ forIndex: 'has:for-index',
568
+ key: 'has:key',
569
+ xs: 'hjs',
570
+ type: 'ascf'
571
+ };
572
+ this.transferComponents = {};
573
+ this.modifyTemplateResult = (res, nodeName, _, children) => {
574
+ if (nodeName === 'keyboard-accessory')
575
+ return '';
576
+ if ((nodeName === 'textarea' || nodeName === 'input') && this.pluginOptions.enablekeyboardAccessory) {
577
+ const list = res.split('</template>');
578
+ const componentAlias = this.componentsAlias[nodeName];
579
+ const nodeNameAlias = componentAlias._num;
580
+ const xs = `xs.a(c, item.${"nn" /* Shortcuts.NodeName */}, l)`;
581
+ const target = `
582
+ <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}}">
583
+ <block has:for="{{i.cn[0].cn}}" has:key="sid">
584
+ <template is="{{${xs}}}" data="{{i:item,c:c+1,l:xs.f(l,item.${"nn" /* Shortcuts.NodeName */})}}" />
585
+ </block>
586
+ </keyboard-accessory>
587
+ `;
588
+ const templateFocus = list[1]
589
+ .replace(children, target)
590
+ .replace(`_${nodeNameAlias}_focus`, `_${nodeNameAlias}_focus_ka`);
591
+ const templateBlur = list[2]
592
+ .replace(children, target)
593
+ .replace(`_${nodeNameAlias}_blur`, `_${nodeNameAlias}_blur_ka`);
594
+ list.splice(3, 0, templateFocus, templateBlur);
595
+ return list.join('</template>');
596
+ }
597
+ return res;
598
+ };
599
+ this.buildPageTemplate = (baseTempPath, page) => {
600
+ let pageMetaTemplate = '';
601
+ const pageConfig = page === null || page === void 0 ? void 0 : page.content;
602
+ if (pageConfig === null || pageConfig === void 0 ? void 0 : pageConfig.enablePageMeta) {
603
+ const getComponentAttrs = (componentName, dataPath) => {
604
+ return Object.entries(this.transferComponents[componentName]).reduce((sum, [key, value]) => {
605
+ sum += `${key}="${value === 'eh' ? value : `{{${value.replace('i.', dataPath)}}}`}" `;
606
+ return sum;
607
+ }, '');
608
+ };
609
+ const pageMetaAttrs = getComponentAttrs('page-meta', 'pageMeta.');
610
+ const navigationBarAttrs = getComponentAttrs('navigation-bar', 'navigationBar.');
611
+ pageMetaTemplate = `
612
+ <hjs module="xs" src="${baseTempPath.replace('base.hxml', 'utils.hjs')}" />
613
+ <page-meta data-sid="{{pageMeta.sid}}" ${pageMetaAttrs}>
614
+ <navigation-bar ${navigationBarAttrs}/>
615
+ </page-meta>`;
616
+ }
617
+ const template = `<import src="${baseTempPath}"/>${pageMetaTemplate}
618
+ <template is="taro_tmpl" data="{{${this.dataKeymap('root:root')}}}" />`;
619
+ return template;
620
+ };
621
+ this.pluginOptions = pluginOptions || {};
622
+ this.nestElements.set('root-portal', 3);
623
+ }
624
+ buildXsTemplate(filePath = './utils') {
625
+ return `<hjs module="xs" src="${filePath}.hjs" />`;
626
+ }
627
+ createMiniComponents(components) {
628
+ const result = super.createMiniComponents(components);
629
+ // PageMeta & NavigationBar
630
+ this.transferComponents['page-meta'] = result['page-meta'];
631
+ this.transferComponents['navigation-bar'] = result['navigation-bar'];
632
+ delete result['page-meta'];
633
+ delete result['navigation-bar'];
634
+ return result;
635
+ }
636
+ replacePropName(name, value, componentName, componentAlias) {
637
+ if (value === 'eh') {
638
+ const nameLowerCase = name.toLowerCase();
639
+ if (nameLowerCase === 'bindlongtap' && componentName !== 'canvas')
640
+ return 'bindlongpress';
641
+ return nameLowerCase;
642
+ }
643
+ if (componentName === 'share-element') {
644
+ const mapKeyAlias = componentAlias.mapkey;
645
+ if (value === `i.${mapKeyAlias}`)
646
+ return 'key';
647
+ }
648
+ return name;
649
+ }
650
+ buildXSTepFocus(nn) {
651
+ if (this.pluginOptions.enablekeyboardAccessory) {
652
+ const textarea = this.componentsAlias.textarea._num;
653
+ const input = this.componentsAlias.input._num;
654
+ const ka = this.componentsAlias['keyboard-accessory']._num;
655
+ return `function(i, prefix) {
656
+ var s = i.focus !== undefined ? 'focus' : 'blur'
657
+ var r = prefix + i.${nn} + '_' + s
658
+ if ((i.nn === '${textarea}' || i.nn === '${input}') && i.cn[0] && i.cn[0].nn === '${ka}') {
659
+ r = r + '_ka'
660
+ }
661
+ return r
662
+ }`;
663
+ }
664
+ else {
665
+ return super.buildXSTepFocus(nn);
666
+ }
667
+ }
668
+ }
669
+
670
+ const PACKAGE_NAME = '@tarojs/plugin-platform-ascf';
671
+ class AscfApp extends service.TaroPlatformBase {
672
+ /**
673
+ * 1. setupTransaction - init
674
+ * 2. setup
675
+ * 3. setupTransaction - close
676
+ * 4. buildTransaction - init
677
+ * 5. build
678
+ * 6. buildTransaction - close
679
+ */
680
+ constructor(ctx, config, pluginOptions) {
681
+ super(ctx, config);
682
+ this.platform = 'ascf';
683
+ this.globalObject = 'has';
684
+ this.projectConfigJson = this.config.projectConfigName || 'ascf.config.json';
685
+ this.runtimePath = `${PACKAGE_NAME}/dist/runtime`;
686
+ this.taroComponentsPath = `${PACKAGE_NAME}/dist/components-react`;
687
+ this.fileType = {
688
+ templ: '.hxml',
689
+ style: '.css',
690
+ config: '.json',
691
+ script: '.js',
692
+ xs: '.hjs'
693
+ };
694
+ this.template = new Template(pluginOptions);
695
+ this.setupTransaction.addWrapper({
696
+ close() {
697
+ this.modifyTemplate(pluginOptions);
698
+ this.modifyWebpackConfig();
699
+ }
700
+ });
701
+ }
702
+ /**
703
+ * 增加组件或修改组件属性
704
+ */
705
+ modifyTemplate(pluginOptions) {
706
+ const template = this.template;
707
+ template.mergeComponents(this.ctx, components);
708
+ template.voidElements.add('voip-room');
709
+ template.focusComponents.add('editor');
710
+ if (pluginOptions === null || pluginOptions === void 0 ? void 0 : pluginOptions.enablekeyboardAccessory) {
711
+ template.voidElements.delete('input');
712
+ template.voidElements.delete('textarea');
713
+ }
714
+ }
715
+ /**
716
+ * 修改 Webpack 配置
717
+ */
718
+ modifyWebpackConfig() {
719
+ this.ctx.modifyWebpackChain(({ chain }) => {
720
+ // 解决微信小程序 sourcemap 映射失败的问题,#9412
721
+ chain.output.devtoolModuleFilenameTemplate((info) => {
722
+ const resourcePath = info.resourcePath.replace(/[/\\]/g, '_');
723
+ return `webpack://${info.namespace}/${resourcePath}`;
724
+ });
725
+ });
726
+ }
727
+ }
728
+
729
+ var index = (ctx, options) => {
730
+ ctx.registerPlatform({
731
+ name: 'ascf',
732
+ useConfigName: 'mini',
733
+ fn(_a) {
734
+ return __awaiter(this, arguments, void 0, function* ({ config }) {
735
+ const program = new AscfApp(ctx, config, options || {});
736
+ yield program.start();
737
+ });
738
+ }
739
+ });
740
+ };
741
+
742
+ exports.AscfApp = AscfApp;
743
+ exports.default = index;
744
+ //# sourceMappingURL=index.js.map