taro-plugin-qd 1.0.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.
@@ -0,0 +1 @@
1
+ export { Ad, AdCustom, Audio, Block, Button, Camera, Canvas, Checkbox, CheckboxGroup, CoverImage, CoverView, Editor, Form, FunctionalPageNavigator, GridView, Icon, Image, Input, Label, ListView, LivePlayer, LivePusher, Map, MatchMedia, MovableArea, MovableView, NavigationBar, Navigator, OfficialAccount, OpenData, PageContainer, PageMeta, Picker, PickerView, PickerViewColumn, Progress, Radio, RadioGroup, RichText, RootPortal, ScrollView, ShareElement, Slider, StickyHeader, StickySection, Swiper, SwiperItem, Switch, Text, Textarea, Video, View, VoipRoom, WebView } from '@tarojs/components/mini';
package/dist/index.js ADDED
@@ -0,0 +1,616 @@
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
+ class Template extends template.UnRecursiveTemplate {
9
+ constructor(pluginOptions) {
10
+ super();
11
+ this.supportXS = true;
12
+ this.Adapter = {
13
+ if: 'wx:if',
14
+ else: 'wx:else',
15
+ elseif: 'wx:elif',
16
+ for: 'wx:for',
17
+ forItem: 'wx:for-item',
18
+ forIndex: 'wx:for-index',
19
+ key: 'wx:key',
20
+ xs: 'qds',
21
+ type: 'weapp'
22
+ };
23
+ this.modifyTemplateResult = (res, _nodeName, _level, _children) => {
24
+ return res;
25
+ };
26
+ this.buildPageTemplate = (baseTempPath, page) => {
27
+ const pagePath = typeof page === 'string' ? page : (page === null || page === void 0 ? void 0 : page.path) || '';
28
+ const template = this.buildBaseComponentTemplate(pagePath);
29
+ const transferComp = Object.keys(this.transferComponents || {})
30
+ .map(name => {
31
+ const comp = this.transferComponents[name];
32
+ if (!comp)
33
+ return '';
34
+ return this.buildComponentTemplate({ nodeName: name, nodeAlias: name, attributes: comp }, pagePath);
35
+ })
36
+ .join('\n');
37
+ return `<import src="${baseTempPath}" />\n${transferComp}\n${template}`;
38
+ };
39
+ this.pluginOptions = pluginOptions || {};
40
+ this.nestElements.set('root-portal', 3);
41
+ }
42
+ buildXsTemplate(filePath = './utils') {
43
+ return `<qds module="xs" src="${filePath}.qds" />`;
44
+ }
45
+ replacePropName(name, value, componentName, _componentAlias) {
46
+ if (value === 'eh') {
47
+ const nameLowerCase = name.toLowerCase();
48
+ if (nameLowerCase === 'bindlongtap' && componentName !== 'canvas') {
49
+ return 'bindlongpress';
50
+ }
51
+ return nameLowerCase;
52
+ }
53
+ return name;
54
+ }
55
+ createMiniComponents(components) {
56
+ const result = super.createMiniComponents(components);
57
+ this.transferComponents = this.transferComponents || {};
58
+ this.transferComponents['page-meta'] = result['page-meta'];
59
+ this.transferComponents['navigation-bar'] = result['navigation-bar'];
60
+ delete result['page-meta'];
61
+ delete result['navigation-bar'];
62
+ return result;
63
+ }
64
+ }
65
+
66
+ const components = {
67
+ // 基础内容
68
+ Progress: {
69
+ 'border-radius': '0',
70
+ 'font-size': '16',
71
+ duration: '30',
72
+ bindActiveEnd: ''
73
+ },
74
+ RichText: {
75
+ space: '',
76
+ 'user-select': 'false'
77
+ },
78
+ Text: {
79
+ 'user-select': 'false'
80
+ },
81
+ // 表单组件
82
+ Input: {
83
+ 'always-embed': 'false',
84
+ 'adjust-position': 'true',
85
+ 'hold-keyboard': 'false',
86
+ 'safe-password-cert-path': '',
87
+ 'safe-password-length': '',
88
+ 'safe-password-time-stamp': '',
89
+ 'safe-password-nonce': '',
90
+ 'safe-password-salt': '',
91
+ 'safe-password-custom-hash': '',
92
+ bindKeyboardHeightChange: '',
93
+ bindNicknameReview: ''
94
+ },
95
+ Button: {
96
+ lang: 'en',
97
+ 'session-from': '',
98
+ 'send-message-title': '',
99
+ 'send-message-path': '',
100
+ 'send-message-img': '',
101
+ 'app-parameter': '',
102
+ 'show-message-card': 'false',
103
+ 'phone-number-no-quota-toast': 'true',
104
+ bindGetUserInfo: '',
105
+ bindContact: '',
106
+ bindGetPhoneNumber: '',
107
+ bindGetRealTimePhoneNumber: '',
108
+ bindChooseAvatar: '',
109
+ bindError: '',
110
+ bindOpenSetting: '',
111
+ bindLaunchApp: '',
112
+ bindAgreeprivacyauthorization: '',
113
+ bindSubmit: ''
114
+ },
115
+ Checkbox: {
116
+ color: "'#09BB07'"
117
+ },
118
+ CheckboxGroup: {
119
+ bindChange: ''
120
+ },
121
+ Editor: {
122
+ 'read-only': 'false',
123
+ placeholder: '',
124
+ 'show-img-size': 'false',
125
+ 'show-img-toolbar': 'false',
126
+ 'show-img-resize': 'false',
127
+ bindReady: '',
128
+ bindFocus: '',
129
+ bindBlur: '',
130
+ bindInput: '',
131
+ bindStatusChange: ''
132
+ },
133
+ Form: {
134
+ 'report-submit': 'false',
135
+ 'report-submit-timeout': '0',
136
+ bindSubmit: '',
137
+ bindReset: ''
138
+ },
139
+ Label: {
140
+ for: ''
141
+ },
142
+ Picker: {
143
+ 'header-text': '',
144
+ bindCancel: ''
145
+ },
146
+ PickerView: {
147
+ 'mask-style': '',
148
+ 'mask-class': '',
149
+ 'indicator-style': '',
150
+ 'indicator-class': '',
151
+ bindPickStart: '',
152
+ bindPickEnd: ''
153
+ },
154
+ Radio: {
155
+ color: "'#09BB07'"
156
+ },
157
+ RadioGroup: {
158
+ bindChange: ''
159
+ },
160
+ Slider: {
161
+ color: "'#e9e9e9'",
162
+ 'selected-color': "'#1aad19'",
163
+ 'block-size': '28',
164
+ 'block-color': "'#ffffff'"
165
+ },
166
+ Switch: {
167
+ type: "'switch'",
168
+ color: "'#04BE02'"
169
+ },
170
+ Textarea: {
171
+ 'show-confirm-bar': 'true',
172
+ 'adjust-position': 'true',
173
+ 'hold-keyboard': 'false',
174
+ 'disable-default-padding': 'false',
175
+ 'confirm-type': "'return'",
176
+ 'confirm-hold': 'false',
177
+ bindKeyboardHeightChange: ''
178
+ },
179
+ // 导航
180
+ Navigator: {
181
+ target: "'self'",
182
+ 'open-type': "'navigate'",
183
+ delta: '1',
184
+ 'app-id': '',
185
+ path: '',
186
+ 'extra-data': '',
187
+ version: "'release'",
188
+ 'hover-stop-propagation': 'false',
189
+ bindSuccess: '',
190
+ bindFail: '',
191
+ bindComplete: ''
192
+ },
193
+ // 媒体组件
194
+ Audio: {
195
+ id: '',
196
+ src: '',
197
+ loop: 'false',
198
+ controls: 'false',
199
+ poster: '',
200
+ name: '',
201
+ author: '',
202
+ bindError: '',
203
+ bindPlay: '',
204
+ bindPause: '',
205
+ bindTimeUpdate: '',
206
+ bindEnded: ''
207
+ },
208
+ Camera: {
209
+ mode: "'normal'",
210
+ 'device-position': "'back'",
211
+ flash: "'auto'",
212
+ 'frame-size': "'medium'",
213
+ bindStop: '',
214
+ bindError: '',
215
+ bindInitDone: '',
216
+ bindScanCode: ''
217
+ },
218
+ Image: {
219
+ 'webp': 'false',
220
+ 'show-menu-by-longpress': 'false',
221
+ bindLoad: '',
222
+ bindError: ''
223
+ },
224
+ Video: {
225
+ 'show-mute-btn': 'false',
226
+ title: '',
227
+ 'play-btn-position': "'bottom'",
228
+ 'enable-play-gesture': 'false',
229
+ 'auto-pause-if-navigate': 'true',
230
+ 'auto-pause-if-open-native': 'true',
231
+ 'vslide-gesture': 'false',
232
+ 'vslide-gesture-in-fullscreen': 'true',
233
+ 'ad-unit-id': '',
234
+ 'poster-for-crawler': '',
235
+ 'show-casting-button': 'false',
236
+ 'picture-in-picture-mode': '',
237
+ 'picture-in-picture-show-progress': 'false',
238
+ 'enable-auto-rotation': 'false',
239
+ 'show-screen-lock-button': 'false',
240
+ 'show-snapshot-button': 'false',
241
+ 'show-background-playback-button': 'false',
242
+ 'background-poster': '',
243
+ 'referrer-policy': "'origin'",
244
+ 'is-drm': 'false',
245
+ 'provision-url': '',
246
+ 'certificate-url': '',
247
+ 'license-url': '',
248
+ bindProgress: '',
249
+ bindLoadedMetaData: '',
250
+ bindControlsToggle: '',
251
+ bindEnterPictureInPicture: '',
252
+ bindLeavePictureInPicture: '',
253
+ bindSeekComplete: '',
254
+ bindAdLoad: '',
255
+ bindAdError: '',
256
+ bindAdClose: '',
257
+ bindAdPlay: '',
258
+ bindCastingUserSelect: '',
259
+ bindCastingStateChange: '',
260
+ bindCastingInterrupt: ''
261
+ },
262
+ LivePlayer: {
263
+ mode: "'live'",
264
+ 'sound-mode': "'speaker'",
265
+ 'auto-pause-if-navigate': 'true',
266
+ 'auto-pause-if-open-native': 'true',
267
+ 'picture-in-picture-mode': '',
268
+ 'referrer-policy': "'no-referrer'",
269
+ bindStateChange: '',
270
+ bindFullScreenChange: '',
271
+ bindNetStatus: '',
272
+ bindAudioVolumeNotify: '',
273
+ bindEnterPictureInPicture: '',
274
+ bindLeavePictureInPicture: ''
275
+ },
276
+ LivePusher: {
277
+ url: '',
278
+ mode: "'RTC'",
279
+ autopush: 'false',
280
+ muted: 'false',
281
+ 'enable-camera': 'true',
282
+ 'auto-focus': 'true',
283
+ orientation: "'vertical'",
284
+ beauty: '0',
285
+ whiteness: '0',
286
+ aspect: "'9:16'",
287
+ 'min-bitrate': '200',
288
+ 'max-bitrate': '1000',
289
+ 'audio-quality': "'high'",
290
+ 'waiting-image': '',
291
+ 'waiting-image-hash': '',
292
+ zoom: 'false',
293
+ 'device-position': "'front'",
294
+ 'background-mute': 'false',
295
+ mirror: 'false',
296
+ 'remote-mirror': 'false',
297
+ 'local-mirror': "'auto'",
298
+ 'audio-reverb-type': '0',
299
+ 'enable-mic': 'true',
300
+ 'enable-agc': 'false',
301
+ 'enable-ans': 'false',
302
+ 'audio-volume-type': "'voicecall'",
303
+ 'video-width': '360',
304
+ 'video-height': '640',
305
+ 'beauty-style': "'smooth'",
306
+ filter: "'standard'",
307
+ 'picture-in-picture-mode': '',
308
+ bindStateChange: '',
309
+ bindNetStatus: '',
310
+ bindBgmStart: '',
311
+ bindBgmProgress: '',
312
+ bindBgmComplete: '',
313
+ bindAudioVolumeNotify: '',
314
+ bindEnterPictureInPicture: '',
315
+ bindLeavePictureInPicture: ''
316
+ },
317
+ // 地图
318
+ Map: {
319
+ 'show-location': '',
320
+ polygons: '[]',
321
+ subkey: '',
322
+ 'layer-style': '1',
323
+ rotate: '0',
324
+ skew: '0',
325
+ 'enable-3D': 'false',
326
+ 'show-compass': 'false',
327
+ 'show-scale': 'false',
328
+ 'enable-overlooking': 'false',
329
+ 'enable-zoom': 'true',
330
+ 'enable-scroll': 'true',
331
+ 'enable-rotate': 'false',
332
+ 'enable-satellite': 'false',
333
+ 'enable-traffic': 'false',
334
+ 'enable-poi': 'true',
335
+ 'enable-building': '',
336
+ setting: '[]',
337
+ bindMarkerTap: '',
338
+ bindLabelTap: '',
339
+ bindControlTap: '',
340
+ bindCalloutTap: '',
341
+ bindUpdated: '',
342
+ bindRegionChange: '',
343
+ bindPoiTap: '',
344
+ bindAnchorPointTap: ''
345
+ },
346
+ // 画布
347
+ Canvas: {
348
+ type: '',
349
+ bindTouchStart: '',
350
+ bindTouchMove: '',
351
+ bindTouchEnd: '',
352
+ bindTouchCancel: '',
353
+ bindLongTap: '',
354
+ bindError: ''
355
+ },
356
+ // 开放能力
357
+ WebView: {
358
+ src: '',
359
+ bindMessage: '',
360
+ bindLoad: '',
361
+ bindError: ''
362
+ },
363
+ Ad: {
364
+ 'unit-id': '',
365
+ 'ad-intervals': '',
366
+ 'ad-type': "'banner'",
367
+ 'ad-theme': "'white'",
368
+ bindLoad: '',
369
+ bindError: '',
370
+ bindClose: ''
371
+ },
372
+ AdCustom: {
373
+ 'unit-id': '',
374
+ 'ad-intervals': '',
375
+ bindLoad: '',
376
+ bindError: '',
377
+ bindClose: ''
378
+ },
379
+ OfficialAccount: {
380
+ bindLoad: '',
381
+ bindError: ''
382
+ },
383
+ OpenData: {
384
+ type: '',
385
+ 'open-gid': '',
386
+ lang: "'en'",
387
+ 'default-text': '',
388
+ 'default-avatar': '',
389
+ bindError: ''
390
+ },
391
+ // 页面属性
392
+ PageMeta: {
393
+ 'background-text-style': '',
394
+ 'background-color': '',
395
+ 'background-color-top': '',
396
+ 'background-color-bottom': '',
397
+ 'scroll-top': "''",
398
+ 'scroll-duration': '300',
399
+ 'page-style': "''",
400
+ 'root-font-size': "''",
401
+ 'page-font-size': "''",
402
+ bindResize: '',
403
+ bindScroll: '',
404
+ bindScrollDone: ''
405
+ },
406
+ NavigationBar: {
407
+ title: "''",
408
+ loading: "'false'",
409
+ 'front-color': "''",
410
+ 'background-color': "''",
411
+ 'color-animation-duration': "'0'",
412
+ 'color-animation-timing-func': "'linear'"
413
+ },
414
+ // 视图容器 (补充)
415
+ ScrollView: {
416
+ 'enable-flex': 'false',
417
+ 'scroll-anchoring': 'false',
418
+ enhanced: 'false',
419
+ 'refresher-enabled': 'false',
420
+ 'refresher-threshold': '45',
421
+ 'refresher-default-style': "'black'",
422
+ 'refresher-background': "'#FFF'",
423
+ 'refresher-triggered': 'false',
424
+ bounces: 'true',
425
+ 'show-scrollbar': 'true',
426
+ 'paging-enabled': 'false',
427
+ 'fast-deceleration': 'false',
428
+ 'scroll-with-animation': 'false',
429
+ 'enable-back-to-top': 'false',
430
+ 'enable-passive': 'false',
431
+ 'scroll-into-view-alignment': "'start'",
432
+ type: "'list'",
433
+ reverse: 'false',
434
+ 'cache-extent': '',
435
+ padding: '',
436
+ bindDragStart: '',
437
+ bindDragging: '',
438
+ bindDragEnd: '',
439
+ bindRefresherPulling: '',
440
+ bindRefresherRefresh: '',
441
+ bindRefresherRestore: '',
442
+ bindRefresherAbort: '',
443
+ bindScrollStart: '',
444
+ bindScrollEnd: ''
445
+ },
446
+ Swiper: {
447
+ 'indicator-dots': 'false',
448
+ 'indicator-color': "'rgba(0, 0, 0, .3)'",
449
+ 'indicator-active-color': "'#000000'",
450
+ autoplay: 'false',
451
+ current: '0',
452
+ interval: '5000',
453
+ duration: '500',
454
+ circular: 'false',
455
+ vertical: 'false',
456
+ 'previous-margin': "'0px'",
457
+ 'next-margin': "'0px'",
458
+ 'snap-to-edge': 'false',
459
+ 'display-multiple-items': '1',
460
+ 'easing-function': "'default'",
461
+ bindChange: '',
462
+ bindTransition: '',
463
+ bindAnimationFinish: ''
464
+ },
465
+ SwiperItem: {
466
+ 'item-id': ''
467
+ },
468
+ MovableArea: {
469
+ 'scale-area': 'false'
470
+ },
471
+ MovableView: {
472
+ direction: "'none'",
473
+ inertia: 'false',
474
+ 'out-of-bounds': 'false',
475
+ x: '',
476
+ y: '',
477
+ damping: '20',
478
+ friction: '2',
479
+ disabled: 'false',
480
+ scale: 'false',
481
+ 'scale-min': '0.5',
482
+ 'scale-max': '10',
483
+ 'scale-value': '1',
484
+ animation: 'true',
485
+ bindChange: '',
486
+ bindScale: '',
487
+ bindHTouchMove: '',
488
+ bindVTouchMove: ''
489
+ },
490
+ MatchMedia: {
491
+ 'min-width': '',
492
+ 'max-width': '',
493
+ width: '',
494
+ 'min-height': '',
495
+ 'max-height': '',
496
+ height: '',
497
+ orientation: ''
498
+ },
499
+ ShareElement: {
500
+ key: '',
501
+ transform: 'false',
502
+ duration: '300',
503
+ 'easing-function': "'ease-out'"
504
+ },
505
+ PageContainer: {
506
+ show: 'false',
507
+ duration: '300',
508
+ 'z-index': '100',
509
+ overlay: 'true',
510
+ position: "'bottom'",
511
+ round: 'false',
512
+ 'close-on-slide-down': 'false',
513
+ 'overlay-style': '',
514
+ 'custom-style': '',
515
+ bindBeforeEnter: '',
516
+ bindEnter: '',
517
+ bindAfterEnter: '',
518
+ bindBeforeLeave: '',
519
+ bindLeave: '',
520
+ bindAfterLeave: '',
521
+ bindClickOverlay: ''
522
+ },
523
+ RootPortal: {},
524
+ VoipRoom: {
525
+ openid: '',
526
+ mode: "'camera'",
527
+ 'device-position': "'front'",
528
+ bindError: ''
529
+ },
530
+ // Skyline 组件
531
+ GridView: {
532
+ type: "'aligned'",
533
+ 'cross-axis-count': '2',
534
+ 'main-axis-gap': '0',
535
+ 'cross-axis-gap': '0',
536
+ 'max-cross-axis-extent': '0',
537
+ padding: "'0'"
538
+ },
539
+ ListView: {
540
+ 'scroll-y': '',
541
+ 'scroll-into-view': '',
542
+ 'scroll-with-animation': '',
543
+ padding: '',
544
+ 'upper-threshold': '',
545
+ 'lower-threshold': '',
546
+ bindScrollToUpper: '',
547
+ bindScrollToLower: '',
548
+ bindScroll: ''
549
+ },
550
+ StickyHeader: {
551
+ padding: ''
552
+ },
553
+ StickySection: {
554
+ padding: '',
555
+ 'push-pinned-header': "'false'"
556
+ }
557
+ };
558
+
559
+ const PACKAGE_NAME = 'taro-plugin-qd';
560
+ class QD extends service.TaroPlatformBase {
561
+ constructor(ctx, config, pluginOptions) {
562
+ super(ctx, config);
563
+ this.platform = 'qd';
564
+ this.globalObject = 'qd';
565
+ this.projectConfigJson = 'project.config.json';
566
+ this.runtimePath = `${PACKAGE_NAME}/dist/runtime`;
567
+ this.taroComponentsPath = `${PACKAGE_NAME}/dist/components-react`;
568
+ this.fileType = {
569
+ templ: '.qdml',
570
+ style: '.qdss',
571
+ config: '.json',
572
+ script: '.js',
573
+ xs: '.qds'
574
+ };
575
+ this.template = new Template(pluginOptions);
576
+ this.setupTransaction.addWrapper({
577
+ close: () => {
578
+ this.modifyTemplate(pluginOptions);
579
+ this.modifyWebpackConfig();
580
+ }
581
+ });
582
+ }
583
+ modifyTemplate(pluginOptions) {
584
+ const template = this.template;
585
+ template.mergeComponents(this.ctx, components);
586
+ template.voidElements.add('voip-room');
587
+ template.voidElements.add('native-slot');
588
+ template.focusComponents.add('editor');
589
+ if (pluginOptions === null || pluginOptions === void 0 ? void 0 : pluginOptions.enablekeyboardAccessory) {
590
+ template.voidElements.delete('input');
591
+ template.voidElements.delete('textarea');
592
+ }
593
+ }
594
+ modifyWebpackConfig() {
595
+ this.ctx.modifyWebpackChain(({ chain }) => {
596
+ chain.output.devtoolModuleFilenameTemplate((info) => {
597
+ const resourcePath = info.resourcePath.replace(/[/\\]/g, '_');
598
+ return `webpack://${info.namespace}/${resourcePath}`;
599
+ });
600
+ });
601
+ }
602
+ }
603
+
604
+ var index = (ctx, options) => {
605
+ ctx.registerPlatform({
606
+ name: 'qd',
607
+ useConfigName: 'mini',
608
+ async fn({ config }) {
609
+ const program = new QD(ctx, config, options || {});
610
+ await program.start();
611
+ }
612
+ });
613
+ };
614
+
615
+ exports.QD = QD;
616
+ exports.default = index;