@tarojs/components 3.5.6 → 3.5.7-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/helper-db78e01a.js +19 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/taro-ad-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-ad-custom-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-camera-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-components.cjs.js +1 -1
- package/dist/cjs/taro-editor-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-functional-page-navigator-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-keyboard-accessory-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-live-player-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-live-pusher-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-map-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-match-media-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-movable-area-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-movable-view-core.cjs.entry.js +2 -2
- package/dist/cjs/taro-navigation-bar-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-official-account-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-open-data-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-page-container-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-page-meta-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-root-portal-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-share-element-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-slot-core.cjs.entry.js +3 -1
- package/dist/cjs/taro-voip-room-core.cjs.entry.js +3 -1
- package/dist/collection/components/ad/ad.js +2 -2
- package/dist/collection/components/ad-custom/ad-custom.js +2 -2
- package/dist/collection/components/camera/camera.js +2 -2
- package/dist/collection/components/editor/editor.js +2 -2
- package/dist/collection/components/functional-page-navigator/functional-page-navigator.js +2 -2
- package/dist/collection/components/keyboard-accessory/keyboard-accessory.js +2 -2
- package/dist/collection/components/live-player/live-player.js +2 -2
- package/dist/collection/components/live-pusher/live-pusher.js +2 -2
- package/dist/collection/components/map/map.js +2 -2
- package/dist/collection/components/match-media/match-media.js +2 -2
- package/dist/collection/components/movable-area/area.css +2 -2
- package/dist/collection/components/movable-area/movable-view.js +2 -4
- package/dist/collection/components/navigation-bar/navigation-bar.js +2 -2
- package/dist/collection/components/official-account/official-account.js +2 -2
- package/dist/collection/components/open-data/open-data.js +2 -2
- package/dist/collection/components/page-container/page-container.js +2 -2
- package/dist/collection/components/page-meta/page-meta.js +2 -2
- package/dist/collection/components/root-portal/root-portal.js +2 -2
- package/dist/collection/components/share-element/share-element.js +2 -2
- package/dist/collection/components/slot/slot.js +2 -2
- package/dist/collection/components/voip-room/voip-room.js +2 -2
- package/dist/collection/utils/helper.js +10 -0
- package/dist/collection/utils/index.js +1 -0
- package/dist/esm/helper-3d0ecf0f.js +13 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/taro-ad-core.entry.js +3 -1
- package/dist/esm/taro-ad-custom-core.entry.js +3 -1
- package/dist/esm/taro-camera-core.entry.js +3 -1
- package/dist/esm/taro-components.js +1 -1
- package/dist/esm/taro-editor-core.entry.js +3 -1
- package/dist/esm/taro-functional-page-navigator-core.entry.js +3 -1
- package/dist/esm/taro-keyboard-accessory-core.entry.js +3 -1
- package/dist/esm/taro-live-player-core.entry.js +3 -1
- package/dist/esm/taro-live-pusher-core.entry.js +3 -1
- package/dist/esm/taro-map-core.entry.js +3 -1
- package/dist/esm/taro-match-media-core.entry.js +3 -1
- package/dist/esm/taro-movable-area-core.entry.js +1 -1
- package/dist/esm/taro-movable-view-core.entry.js +3 -3
- package/dist/esm/taro-navigation-bar-core.entry.js +3 -1
- package/dist/esm/taro-official-account-core.entry.js +3 -1
- package/dist/esm/taro-open-data-core.entry.js +3 -1
- package/dist/esm/taro-page-container-core.entry.js +3 -1
- package/dist/esm/taro-page-meta-core.entry.js +3 -1
- package/dist/esm/taro-root-portal-core.entry.js +3 -1
- package/dist/esm/taro-share-element-core.entry.js +3 -1
- package/dist/esm/taro-slot-core.entry.js +3 -1
- package/dist/esm/taro-voip-room-core.entry.js +3 -1
- package/dist/esm-es5/helper-3d0ecf0f.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/taro-ad-core.entry.js +1 -1
- package/dist/esm-es5/taro-ad-custom-core.entry.js +1 -1
- package/dist/esm-es5/taro-camera-core.entry.js +1 -1
- package/dist/esm-es5/taro-components.js +1 -1
- package/dist/esm-es5/taro-editor-core.entry.js +1 -1
- package/dist/esm-es5/taro-functional-page-navigator-core.entry.js +1 -1
- package/dist/esm-es5/taro-keyboard-accessory-core.entry.js +1 -1
- package/dist/esm-es5/taro-live-player-core.entry.js +1 -1
- package/dist/esm-es5/taro-live-pusher-core.entry.js +1 -1
- package/dist/esm-es5/taro-map-core.entry.js +1 -1
- package/dist/esm-es5/taro-match-media-core.entry.js +1 -1
- package/dist/esm-es5/taro-movable-area-core.entry.js +1 -1
- package/dist/esm-es5/taro-movable-view-core.entry.js +1 -1
- package/dist/esm-es5/taro-navigation-bar-core.entry.js +1 -1
- package/dist/esm-es5/taro-official-account-core.entry.js +1 -1
- package/dist/esm-es5/taro-open-data-core.entry.js +1 -1
- package/dist/esm-es5/taro-page-container-core.entry.js +1 -1
- package/dist/esm-es5/taro-page-meta-core.entry.js +1 -1
- package/dist/esm-es5/taro-root-portal-core.entry.js +1 -1
- package/dist/esm-es5/taro-share-element-core.entry.js +1 -1
- package/dist/esm-es5/taro-slot-core.entry.js +1 -1
- package/dist/esm-es5/taro-voip-room-core.entry.js +1 -1
- package/dist/taro-components/p-028e2728.entry.js +1 -0
- package/dist/taro-components/p-0380841f.system.js +1 -1
- package/dist/taro-components/p-06178a0c.entry.js +1 -0
- package/dist/taro-components/p-07294134.system.entry.js +1 -0
- package/dist/taro-components/p-075458e5.system.entry.js +1 -0
- package/dist/taro-components/p-15e45ed6.system.js +1 -0
- package/dist/taro-components/p-2ec47545.entry.js +1 -0
- package/dist/taro-components/p-3e11c8cc.system.entry.js +1 -0
- package/dist/taro-components/{p-f8b9c4b0.entry.js → p-42630f45.entry.js} +1 -1
- package/dist/taro-components/p-4cf436f9.entry.js +1 -0
- package/dist/taro-components/p-4d826fb7.entry.js +1 -0
- package/dist/taro-components/p-55266a1f.entry.js +1 -0
- package/dist/taro-components/p-57a2a441.entry.js +1 -0
- package/dist/taro-components/p-59d93770.entry.js +1 -0
- package/dist/taro-components/p-5a374cb9.entry.js +1 -0
- package/dist/taro-components/p-62fc514e.entry.js +1 -0
- package/dist/taro-components/p-6800ac6f.entry.js +1 -0
- package/dist/taro-components/p-6a96da58.js +1 -0
- package/dist/taro-components/p-6aa557f0.entry.js +1 -0
- package/dist/taro-components/p-6ad59489.system.entry.js +1 -0
- package/dist/taro-components/p-733cc64a.system.entry.js +1 -0
- package/dist/taro-components/p-7374537f.entry.js +1 -0
- package/dist/taro-components/p-7d329ab0.entry.js +1 -0
- package/dist/taro-components/p-7e960ac3.system.entry.js +1 -0
- package/dist/taro-components/p-8e2b048e.system.entry.js +1 -0
- package/dist/taro-components/p-9234cc1d.entry.js +1 -0
- package/dist/taro-components/p-93eed5d7.system.entry.js +1 -0
- package/dist/taro-components/p-9e1572c5.system.entry.js +1 -0
- package/dist/taro-components/p-afbcd093.entry.js +1 -0
- package/dist/taro-components/p-b11aaf69.system.entry.js +1 -0
- package/dist/taro-components/p-b1ae9401.entry.js +1 -0
- package/dist/taro-components/p-b60820b4.entry.js +1 -0
- package/dist/taro-components/p-b7681c76.system.entry.js +1 -0
- package/dist/taro-components/p-c5fd5c7f.system.entry.js +1 -0
- package/dist/taro-components/p-c92bafb6.system.entry.js +1 -0
- package/dist/taro-components/p-c93bb915.system.entry.js +1 -0
- package/dist/taro-components/p-cf048af9.entry.js +1 -0
- package/dist/taro-components/p-d075934f.system.entry.js +1 -0
- package/dist/taro-components/p-d4da725f.system.entry.js +1 -0
- package/dist/taro-components/p-d5f3080c.entry.js +1 -0
- package/dist/taro-components/p-d6662ab3.system.entry.js +1 -0
- package/dist/taro-components/p-f2803c2e.system.entry.js +1 -0
- package/dist/taro-components/p-f4ea8a56.system.entry.js +1 -0
- package/dist/taro-components/{p-1c775a11.system.entry.js → p-f5f1c3b7.system.entry.js} +1 -1
- package/dist/taro-components/p-f7c80795.system.entry.js +1 -0
- package/dist/taro-components/taro-components.esm.js +1 -1
- package/dist/types/components/ad/ad.d.ts +2 -1
- package/dist/types/components/ad-custom/ad-custom.d.ts +2 -1
- package/dist/types/components/camera/camera.d.ts +2 -1
- package/dist/types/components/editor/editor.d.ts +2 -1
- package/dist/types/components/functional-page-navigator/functional-page-navigator.d.ts +2 -1
- package/dist/types/components/keyboard-accessory/keyboard-accessory.d.ts +2 -1
- package/dist/types/components/live-player/live-player.d.ts +2 -1
- package/dist/types/components/live-pusher/live-pusher.d.ts +2 -1
- package/dist/types/components/map/map.d.ts +2 -1
- package/dist/types/components/match-media/match-media.d.ts +2 -1
- package/dist/types/components/navigation-bar/navigation-bar.d.ts +2 -1
- package/dist/types/components/official-account/official-account.d.ts +2 -1
- package/dist/types/components/open-data/open-data.d.ts +2 -1
- package/dist/types/components/page-container/page-container.d.ts +2 -1
- package/dist/types/components/page-meta/page-meta.d.ts +2 -1
- package/dist/types/components/root-portal/root-portal.d.ts +2 -1
- package/dist/types/components/share-element/share-element.d.ts +2 -1
- package/dist/types/components/slot/slot.d.ts +2 -1
- package/dist/types/components/voip-room/voip-room.d.ts +2 -1
- package/dist/types/utils/helper.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/mini/index.js +1 -0
- package/package.json +8 -7
- package/types/Ad.d.ts +20 -21
- package/types/Audio.d.ts +5 -5
- package/types/Button.d.ts +67 -71
- package/types/Camera.d.ts +39 -8
- package/types/Canvas.d.ts +22 -38
- package/types/Checkbox.d.ts +7 -7
- package/types/CoverImage.d.ts +15 -16
- package/types/CoverView.d.ts +5 -6
- package/types/Form.d.ts +10 -10
- package/types/Image.d.ts +20 -31
- package/types/Input.d.ts +23 -24
- package/types/LivePlayer.d.ts +31 -25
- package/types/LivePusher.d.ts +5 -5
- package/types/Map.d.ts +66 -99
- package/types/MovableView.d.ts +21 -33
- package/types/NavigationBar.d.ts +1 -1
- package/types/Navigator.d.ts +10 -10
- package/types/OpenData.d.ts +5 -5
- package/types/PageContainer.d.ts +7 -10
- package/types/PageMeta.d.ts +14 -14
- package/types/Picker.d.ts +1 -5
- package/types/PickerView.d.ts +11 -23
- package/types/Progress.d.ts +5 -5
- package/types/RadioGroup.d.ts +5 -5
- package/types/RichText.d.ts +17 -17
- package/types/ScrollView.d.ts +46 -48
- package/types/Slider.d.ts +10 -10
- package/types/Swiper.d.ts +20 -29
- package/types/Switch.d.ts +5 -6
- package/types/Textarea.d.ts +32 -34
- package/types/Video.d.ts +119 -123
- package/types/View.d.ts +13 -32
- package/types/VoipRoom.d.ts +5 -5
- package/types/WebView.d.ts +11 -5
- package/dist/collection/utils/json-schema-to-types.js +0 -224
- package/dist/taro-components/p-0414632d.system.entry.js +0 -1
- package/dist/taro-components/p-10e5df98.system.entry.js +0 -1
- package/dist/taro-components/p-14058364.system.entry.js +0 -1
- package/dist/taro-components/p-1a638246.system.entry.js +0 -1
- package/dist/taro-components/p-1e530acd.entry.js +0 -1
- package/dist/taro-components/p-22e33350.entry.js +0 -1
- package/dist/taro-components/p-24a66088.system.entry.js +0 -1
- package/dist/taro-components/p-2fd0250d.system.entry.js +0 -1
- package/dist/taro-components/p-3c7cdf6f.entry.js +0 -1
- package/dist/taro-components/p-410d449f.entry.js +0 -1
- package/dist/taro-components/p-443fb8b0.entry.js +0 -1
- package/dist/taro-components/p-44fa48b9.system.entry.js +0 -1
- package/dist/taro-components/p-481a8bc1.system.entry.js +0 -1
- package/dist/taro-components/p-49b64020.entry.js +0 -1
- package/dist/taro-components/p-4e8d4a72.system.entry.js +0 -1
- package/dist/taro-components/p-4f0e98c0.system.entry.js +0 -1
- package/dist/taro-components/p-4f805045.entry.js +0 -1
- package/dist/taro-components/p-5e3bd0db.system.entry.js +0 -1
- package/dist/taro-components/p-6da73376.entry.js +0 -1
- package/dist/taro-components/p-7325d380.entry.js +0 -1
- package/dist/taro-components/p-77ad7941.entry.js +0 -1
- package/dist/taro-components/p-7ab91097.entry.js +0 -1
- package/dist/taro-components/p-7b96cec3.system.entry.js +0 -1
- package/dist/taro-components/p-7e23b551.entry.js +0 -1
- package/dist/taro-components/p-7f0a12a9.entry.js +0 -1
- package/dist/taro-components/p-840ef0c3.system.entry.js +0 -1
- package/dist/taro-components/p-89c876a6.system.entry.js +0 -1
- package/dist/taro-components/p-90a6c15a.entry.js +0 -1
- package/dist/taro-components/p-95a36917.entry.js +0 -1
- package/dist/taro-components/p-9965cf11.system.entry.js +0 -1
- package/dist/taro-components/p-9fcb40a3.entry.js +0 -1
- package/dist/taro-components/p-a8c9b126.system.entry.js +0 -1
- package/dist/taro-components/p-aa5d45de.system.entry.js +0 -1
- package/dist/taro-components/p-b3693ca2.system.entry.js +0 -1
- package/dist/taro-components/p-b83c3eca.system.entry.js +0 -1
- package/dist/taro-components/p-c0c8b2be.entry.js +0 -1
- package/dist/taro-components/p-c8da5c10.entry.js +0 -1
- package/dist/taro-components/p-d72075ef.system.entry.js +0 -1
- package/dist/taro-components/p-db1f2db7.entry.js +0 -1
- package/dist/taro-components/p-e3f39099.entry.js +0 -1
- package/dist/types/utils/json-schema-to-types.d.ts +0 -25
package/types/Video.d.ts
CHANGED
|
@@ -221,71 +221,6 @@ interface VideoProps extends StandardProps {
|
|
|
221
221
|
*/
|
|
222
222
|
backgroundPoster?: string
|
|
223
223
|
|
|
224
|
-
/** 当开始/继续播放时触发 play 事件
|
|
225
|
-
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
226
|
-
*/
|
|
227
|
-
onPlay?: CommonEventFunction
|
|
228
|
-
|
|
229
|
-
/** 当暂停播放时触发 pause 事件
|
|
230
|
-
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
231
|
-
*/
|
|
232
|
-
onPause?: CommonEventFunction
|
|
233
|
-
|
|
234
|
-
/** 当播放到末尾时触发 ended 事件
|
|
235
|
-
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
236
|
-
*/
|
|
237
|
-
onEnded?: CommonEventFunction
|
|
238
|
-
|
|
239
|
-
/** 播放进度变化时触发, 触发频率 250ms 一次
|
|
240
|
-
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
241
|
-
*/
|
|
242
|
-
onTimeUpdate?: CommonEventFunction<VideoProps.onTimeUpdateEventDetail>
|
|
243
|
-
|
|
244
|
-
/** 当视频进入和退出全屏时触发
|
|
245
|
-
*
|
|
246
|
-
* @supported h5, rn
|
|
247
|
-
*/
|
|
248
|
-
onFullscreenChange?: CommonEventFunction<VideoProps.onFullscreenChangeEventDetail>
|
|
249
|
-
|
|
250
|
-
/** 视频出现缓冲时触发
|
|
251
|
-
*
|
|
252
|
-
* @supported weapp, swan, tt, qq, jd
|
|
253
|
-
*/
|
|
254
|
-
onWaiting?: CommonEventFunction<VideoProps.onWaitingEventDetail>
|
|
255
|
-
|
|
256
|
-
/** 视频播放出错时触发
|
|
257
|
-
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
258
|
-
*/
|
|
259
|
-
onError?: CommonEventFunction
|
|
260
|
-
|
|
261
|
-
/** 加载进度变化时触发,只支持一段加载
|
|
262
|
-
* @supported weapp, tt, qq, h5
|
|
263
|
-
*/
|
|
264
|
-
onProgress?: CommonEventFunction<VideoProps.onProgressEventDetail>
|
|
265
|
-
|
|
266
|
-
/** 视频元数据加载完成时触发
|
|
267
|
-
* @supported weapp, swan, tt, jd, rn
|
|
268
|
-
*/
|
|
269
|
-
onLoadedMetaData?: CommonEventFunction<VideoProps.onLoadedMetaDataEventDetail>
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* 播放器进入小窗
|
|
273
|
-
* @supported weapp
|
|
274
|
-
*/
|
|
275
|
-
onEnterPictureInPicture?: CommonEventFunction
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* 播放器退出小窗
|
|
279
|
-
* @supported weapp
|
|
280
|
-
*/
|
|
281
|
-
onLeavePictureInPicture?: CommonEventFunction
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* seek 完成时触发
|
|
285
|
-
* @supported weapp, tt
|
|
286
|
-
*/
|
|
287
|
-
onSeekComplete?: CommonEventFunction
|
|
288
|
-
|
|
289
224
|
/** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
|
|
290
225
|
* @supported h5
|
|
291
226
|
*/
|
|
@@ -326,33 +261,12 @@ interface VideoProps extends StandardProps {
|
|
|
326
261
|
*/
|
|
327
262
|
licenseUrl?: string
|
|
328
263
|
|
|
329
|
-
/** 视频进入和退出全屏时触发
|
|
330
|
-
* @supported weapp, alipay, swan, tt, qq, jd
|
|
331
|
-
*/
|
|
332
|
-
onFullScreenChange?: CommonEventFunction<VideoProps.onFullscreenChangeEventDetail>
|
|
333
|
-
|
|
334
|
-
/** 切换 controls 显示隐藏时触发。
|
|
335
|
-
* @supported weapp
|
|
336
|
-
*/
|
|
337
|
-
onControlsToggle?: CommonEventFunction<VideoProps.onControlsToggleEventDetail>
|
|
338
|
-
|
|
339
|
-
/** 内联样式。
|
|
340
|
-
* @supported alipay
|
|
341
|
-
*/
|
|
342
|
-
style?: string
|
|
343
|
-
|
|
344
|
-
/** 外部样式名。
|
|
345
|
-
* @supported alipay
|
|
346
|
-
*/
|
|
347
|
-
class?: string
|
|
348
|
-
|
|
349
264
|
/** 当 poster 高宽比跟视频高宽不匹配时,如何显示 poster,设置规则同 background-size 一致。
|
|
350
265
|
* @supported alipay
|
|
351
266
|
*/
|
|
352
267
|
posterSize?: string
|
|
353
268
|
|
|
354
269
|
/** 当底部工具条隐藏时,是否显示细进度条(controls=false 时设置无效)。
|
|
355
|
-
* 版本要求: 基础库 1.15.0 及以上
|
|
356
270
|
* @supported alipay
|
|
357
271
|
*/
|
|
358
272
|
showThinProgressBar?: string
|
|
@@ -364,44 +278,15 @@ interface VideoProps extends StandardProps {
|
|
|
364
278
|
* 2 - 阻塞提醒(无消耗流量大小)
|
|
365
279
|
* 3 - 阻塞提醒(有消耗流量大小提醒)
|
|
366
280
|
*
|
|
367
|
-
* 版本要求: 基础库 1.13.0 及以上
|
|
368
281
|
* @supported alipay, jd
|
|
369
282
|
*/
|
|
370
283
|
mobilenetHintType?: string
|
|
371
284
|
|
|
372
|
-
/** 视频出现缓冲时触发。
|
|
373
|
-
* @supported alipay
|
|
374
|
-
*/
|
|
375
|
-
onLoading?: CommonEventFunction
|
|
376
|
-
|
|
377
|
-
/** 点击视频 view 时触发
|
|
378
|
-
* @supported alipay
|
|
379
|
-
*/
|
|
380
|
-
onTap?: CommonEventFunction<VideoProps.onTapEventDetail>
|
|
381
|
-
|
|
382
|
-
/** 用户操作事件
|
|
383
|
-
* @supported alipay
|
|
384
|
-
*/
|
|
385
|
-
onUserAction?: CommonEventFunction<VideoProps.onUserActionEventDetail>
|
|
386
|
-
|
|
387
|
-
/** 视频播放终止。
|
|
388
|
-
* 版本要求: 基础库 1.9.0 及以上
|
|
389
|
-
* @supported alipay
|
|
390
|
-
*/
|
|
391
|
-
onStop?: CommonEventFunction
|
|
392
|
-
|
|
393
|
-
/** 当视频加载完真正开始播放时触发。
|
|
394
|
-
* 版本要求: 基础库 1.13.6 及以上
|
|
395
|
-
* @supported alipay
|
|
396
|
-
*/
|
|
397
|
-
onRenderStart?: CommonEventFunction
|
|
398
|
-
|
|
399
285
|
/** 浮窗设置。暂时不支持全局浮窗。
|
|
400
286
|
* 可选值:
|
|
401
287
|
*
|
|
402
288
|
* none:无浮窗。
|
|
403
289
|
* page:页面内浮窗。
|
|
404
|
-
* 版本要求:基础库 1.24.6 及以上
|
|
405
290
|
* @supported alipay
|
|
406
291
|
*/
|
|
407
292
|
floatingMode?: string
|
|
@@ -456,6 +341,111 @@ interface VideoProps extends StandardProps {
|
|
|
456
341
|
*/
|
|
457
342
|
signature?: string
|
|
458
343
|
|
|
344
|
+
/** 指定码率上界,单位为比特每秒
|
|
345
|
+
* @supported weapp
|
|
346
|
+
*/
|
|
347
|
+
preferredPeakBitRate?: number
|
|
348
|
+
|
|
349
|
+
/** 当开始/继续播放时触发 play 事件
|
|
350
|
+
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
351
|
+
*/
|
|
352
|
+
onPlay?: CommonEventFunction
|
|
353
|
+
|
|
354
|
+
/** 当暂停播放时触发 pause 事件
|
|
355
|
+
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
356
|
+
*/
|
|
357
|
+
onPause?: CommonEventFunction
|
|
358
|
+
|
|
359
|
+
/** 当播放到末尾时触发 ended 事件
|
|
360
|
+
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
361
|
+
*/
|
|
362
|
+
onEnded?: CommonEventFunction
|
|
363
|
+
|
|
364
|
+
/** 播放进度变化时触发, 触发频率 250ms 一次
|
|
365
|
+
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
366
|
+
*/
|
|
367
|
+
onTimeUpdate?: CommonEventFunction<VideoProps.onTimeUpdateEventDetail>
|
|
368
|
+
|
|
369
|
+
/** 当视频进入和退出全屏时触发
|
|
370
|
+
*
|
|
371
|
+
* @supported h5, rn
|
|
372
|
+
*/
|
|
373
|
+
onFullscreenChange?: CommonEventFunction<VideoProps.onFullscreenChangeEventDetail>
|
|
374
|
+
|
|
375
|
+
/** 视频出现缓冲时触发
|
|
376
|
+
*
|
|
377
|
+
* @supported weapp, swan, tt, qq, jd
|
|
378
|
+
*/
|
|
379
|
+
onWaiting?: CommonEventFunction<VideoProps.onWaitingEventDetail>
|
|
380
|
+
|
|
381
|
+
/** 视频播放出错时触发
|
|
382
|
+
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
383
|
+
*/
|
|
384
|
+
onError?: CommonEventFunction
|
|
385
|
+
|
|
386
|
+
/** 加载进度变化时触发,只支持一段加载
|
|
387
|
+
* @supported weapp, tt, qq, h5
|
|
388
|
+
*/
|
|
389
|
+
onProgress?: CommonEventFunction<VideoProps.onProgressEventDetail>
|
|
390
|
+
|
|
391
|
+
/** 视频元数据加载完成时触发
|
|
392
|
+
* @supported weapp, swan, tt, jd, rn
|
|
393
|
+
*/
|
|
394
|
+
onLoadedMetaData?: CommonEventFunction<VideoProps.onLoadedMetaDataEventDetail>
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* 播放器进入小窗
|
|
398
|
+
* @supported weapp
|
|
399
|
+
*/
|
|
400
|
+
onEnterPictureInPicture?: CommonEventFunction
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* 播放器退出小窗
|
|
404
|
+
* @supported weapp
|
|
405
|
+
*/
|
|
406
|
+
onLeavePictureInPicture?: CommonEventFunction
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* seek 完成时触发
|
|
410
|
+
* @supported weapp, tt
|
|
411
|
+
*/
|
|
412
|
+
onSeekComplete?: CommonEventFunction
|
|
413
|
+
|
|
414
|
+
/** 视频进入和退出全屏时触发
|
|
415
|
+
* @supported weapp, alipay, swan, tt, qq, jd
|
|
416
|
+
*/
|
|
417
|
+
onFullScreenChange?: CommonEventFunction<VideoProps.onFullscreenChangeEventDetail>
|
|
418
|
+
|
|
419
|
+
/** 切换 controls 显示隐藏时触发。
|
|
420
|
+
* @supported weapp
|
|
421
|
+
*/
|
|
422
|
+
onControlsToggle?: CommonEventFunction<VideoProps.onControlsToggleEventDetail>
|
|
423
|
+
|
|
424
|
+
/** 视频出现缓冲时触发。
|
|
425
|
+
* @supported alipay
|
|
426
|
+
*/
|
|
427
|
+
onLoading?: CommonEventFunction
|
|
428
|
+
|
|
429
|
+
/** 点击视频 view 时触发
|
|
430
|
+
* @supported alipay
|
|
431
|
+
*/
|
|
432
|
+
onTap?: CommonEventFunction<VideoProps.onTapEventDetail>
|
|
433
|
+
|
|
434
|
+
/** 用户操作事件
|
|
435
|
+
* @supported alipay
|
|
436
|
+
*/
|
|
437
|
+
onUserAction?: CommonEventFunction<VideoProps.onUserActionEventDetail>
|
|
438
|
+
|
|
439
|
+
/** 视频播放终止。
|
|
440
|
+
* @supported alipay
|
|
441
|
+
*/
|
|
442
|
+
onStop?: CommonEventFunction
|
|
443
|
+
|
|
444
|
+
/** 当视频加载完真正开始播放时触发。
|
|
445
|
+
* @supported alipay
|
|
446
|
+
*/
|
|
447
|
+
onRenderStart?: CommonEventFunction
|
|
448
|
+
|
|
459
449
|
/** 贴片广告开始播放时触发
|
|
460
450
|
* @supported tt
|
|
461
451
|
*/
|
|
@@ -479,17 +469,23 @@ interface VideoProps extends StandardProps {
|
|
|
479
469
|
/** 视频倍速改变完成时触发。返回改变后的倍速值
|
|
480
470
|
* @supported tt
|
|
481
471
|
*/
|
|
482
|
-
onPlayBackRateChange?: CommonEventFunction<{
|
|
472
|
+
onPlayBackRateChange?: CommonEventFunction<{
|
|
473
|
+
playbackRate: string
|
|
474
|
+
}>
|
|
483
475
|
|
|
484
476
|
/** 静音状态改变完成时触发。返回当前是否静音
|
|
485
477
|
* @supported tt
|
|
486
478
|
*/
|
|
487
|
-
onMuteChange?: CommonEventFunction<{
|
|
479
|
+
onMuteChange?: CommonEventFunction<{
|
|
480
|
+
isMuted: boolean
|
|
481
|
+
}>
|
|
488
482
|
|
|
489
483
|
/** 点击控件时触发。返回当前点击的控件类型
|
|
490
484
|
* @supported tt
|
|
491
485
|
*/
|
|
492
|
-
onControlTap?: CommonEventFunction<{
|
|
486
|
+
onControlTap?: CommonEventFunction<{
|
|
487
|
+
controlType
|
|
488
|
+
}>
|
|
493
489
|
|
|
494
490
|
/** 进入小窗播放时触发
|
|
495
491
|
* @supported tt
|
|
@@ -526,11 +522,6 @@ interface VideoProps extends StandardProps {
|
|
|
526
522
|
*/
|
|
527
523
|
onSeeking?: CommonEventFunction
|
|
528
524
|
|
|
529
|
-
/** 指定码率上界,单位为比特每秒
|
|
530
|
-
* @supported weapp
|
|
531
|
-
*/
|
|
532
|
-
preferredPeakBitRate?: number
|
|
533
|
-
|
|
534
525
|
/** 贴片广告加载成功时触发,event.detail = { adType: 'preRollAd' | 'postRollAd' }
|
|
535
526
|
* @supported tt
|
|
536
527
|
*/
|
|
@@ -622,14 +613,19 @@ declare namespace VideoProps {
|
|
|
622
613
|
interface UserActionTag {
|
|
623
614
|
/** 底部播放按钮 */
|
|
624
615
|
play
|
|
616
|
+
|
|
625
617
|
/** 中心播放按钮 */
|
|
626
618
|
centerplay
|
|
619
|
+
|
|
627
620
|
/** 静音按钮 */
|
|
628
621
|
mute
|
|
622
|
+
|
|
629
623
|
/** 全屏按钮 */
|
|
630
624
|
fullscreen
|
|
625
|
+
|
|
631
626
|
/** 重试按钮 */
|
|
632
627
|
retry
|
|
628
|
+
|
|
633
629
|
/** 网络提醒的播放按钮 */
|
|
634
630
|
mobilenetplay
|
|
635
631
|
}
|
package/types/View.d.ts
CHANGED
|
@@ -34,7 +34,6 @@ interface ViewProps extends StandardProps {
|
|
|
34
34
|
hoverStayTime?: number
|
|
35
35
|
|
|
36
36
|
/** 是否阻止区域内滚动页面。
|
|
37
|
-
* 默认值: false
|
|
38
37
|
* 说明: 如果 view 中嵌套 view,外层 view 设置 disable-scroll 为 true 时禁止内部的滚动。
|
|
39
38
|
* @supported alipay
|
|
40
39
|
* @default false
|
|
@@ -42,27 +41,31 @@ interface ViewProps extends StandardProps {
|
|
|
42
41
|
disableScroll?: string
|
|
43
42
|
|
|
44
43
|
/** 是否隐藏。
|
|
45
|
-
* 默认值: false
|
|
46
44
|
* @supported alipay
|
|
47
45
|
* @default false
|
|
48
46
|
*/
|
|
49
47
|
hidden?: boolean
|
|
50
48
|
|
|
51
|
-
/**
|
|
49
|
+
/** 用于动画,详见 my.createAnimation 。使用 my.createAnimation 生成的动画是通过过渡(Transition)实现的,只会触发 onTransitionEnd,不会触发 onAnimationStart, onAnimationIteration, onAnimationEnd。
|
|
52
50
|
* @supported alipay
|
|
51
|
+
* @default {}
|
|
53
52
|
*/
|
|
54
|
-
|
|
53
|
+
animation?: TaroGeneral.IAnyObject
|
|
55
54
|
|
|
56
|
-
/**
|
|
55
|
+
/** 表示组件的语义角色。设置为 img 时,组件聚焦后读屏软件会朗读出 图像 ;设置为 button 时,聚焦后读屏软件会朗读出 按钮 。详情请参见 aria-component。
|
|
57
56
|
* @supported alipay
|
|
58
57
|
*/
|
|
59
|
-
|
|
58
|
+
role?: string
|
|
60
59
|
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* @supported alipay
|
|
60
|
+
/** 无障碍访问,(角色)标识元素的作用
|
|
61
|
+
* @supported qq
|
|
64
62
|
*/
|
|
65
|
-
|
|
63
|
+
ariaRole?: string
|
|
64
|
+
|
|
65
|
+
/** 无障碍访问,(属性)元素的额外描述
|
|
66
|
+
* @supported qq
|
|
67
|
+
*/
|
|
68
|
+
ariaLabel?: string
|
|
66
69
|
|
|
67
70
|
/** 点击。
|
|
68
71
|
* @supported alipay
|
|
@@ -95,61 +98,39 @@ interface ViewProps extends StandardProps {
|
|
|
95
98
|
onLongTap?: CommonEventFunction
|
|
96
99
|
|
|
97
100
|
/** 过渡(Transition)结束时触发。
|
|
98
|
-
* 版本要求: 基础库 1.8.0 及以上
|
|
99
101
|
* @supported alipay
|
|
100
102
|
*/
|
|
101
103
|
onTransitionEnd?: CommonEventFunction
|
|
102
104
|
|
|
103
105
|
/** 每开启一次新的动画过程时触发。(第一次不触发)
|
|
104
|
-
* 版本要求: 基础库 1.8.0 及以上
|
|
105
106
|
* @supported alipay
|
|
106
107
|
*/
|
|
107
108
|
onAnimationIteration?: CommonEventFunction
|
|
108
109
|
|
|
109
110
|
/** 动画开始时触发。
|
|
110
|
-
* 版本要求: 基础库 1.8.0 及以上
|
|
111
111
|
* @supported alipay
|
|
112
112
|
*/
|
|
113
113
|
onAnimationStart?: CommonEventFunction
|
|
114
114
|
|
|
115
115
|
/** 动画结束时触发。
|
|
116
|
-
* 版本要求: 基础库 1.8.0 及以上
|
|
117
116
|
* @supported alipay
|
|
118
117
|
*/
|
|
119
118
|
onAnimationEnd?: CommonEventFunction
|
|
120
119
|
|
|
121
120
|
/** 当前元素可见面积超过50%时触发。
|
|
122
|
-
* 版本要求: 基础库 1.9.0 及以上
|
|
123
121
|
* @supported alipay
|
|
124
122
|
*/
|
|
125
123
|
onAppear?: CommonEventFunction
|
|
126
124
|
|
|
127
125
|
/** 当前元素不可见面积超过50%时触发。
|
|
128
|
-
* 版本要求: 基础库 1.9.0 及以上
|
|
129
126
|
* @supported alipay
|
|
130
127
|
*/
|
|
131
128
|
onDisappear?: CommonEventFunction
|
|
132
129
|
|
|
133
130
|
/** 当前元素首次可见面积达到50%时触发。
|
|
134
|
-
* 版本要求: 基础库 1.9.4 及以上
|
|
135
131
|
* @supported alipay
|
|
136
132
|
*/
|
|
137
133
|
onFirstAppear?: CommonEventFunction
|
|
138
|
-
|
|
139
|
-
/** 表示组件的语义角色。设置为 img 时,组件聚焦后读屏软件会朗读出 图像 ;设置为 button 时,聚焦后读屏软件会朗读出 按钮 。详情请参见 aria-component。
|
|
140
|
-
* @supported alipay
|
|
141
|
-
*/
|
|
142
|
-
role?: string
|
|
143
|
-
|
|
144
|
-
/** 无障碍访问,(角色)标识元素的作用
|
|
145
|
-
* @supported qq
|
|
146
|
-
*/
|
|
147
|
-
ariaRole?: string
|
|
148
|
-
|
|
149
|
-
/** 无障碍访问,(属性)元素的额外描述
|
|
150
|
-
* @supported qq
|
|
151
|
-
*/
|
|
152
|
-
ariaLabel?: string
|
|
153
134
|
}
|
|
154
135
|
|
|
155
136
|
/** 视图容器
|
package/types/VoipRoom.d.ts
CHANGED
|
@@ -13,16 +13,16 @@ interface VoipRoomProps extends StandardProps {
|
|
|
13
13
|
*/
|
|
14
14
|
devicePosition?: keyof VoipRoomProps.DevicePosition
|
|
15
15
|
|
|
16
|
-
/**
|
|
16
|
+
/** 进入房间用户的 openid
|
|
17
|
+
* @default none
|
|
17
18
|
* @supported weapp
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
+
openId?: string
|
|
20
21
|
|
|
21
|
-
/**
|
|
22
|
-
* @default none
|
|
22
|
+
/** 创建对话窗口失败时触发
|
|
23
23
|
* @supported weapp
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
onError?: CommonEventFunction
|
|
26
26
|
}
|
|
27
27
|
declare namespace VoipRoomProps {
|
|
28
28
|
/** 对话窗口类型 */
|
package/types/WebView.d.ts
CHANGED
|
@@ -6,6 +6,17 @@ interface WebViewProps extends StandardProps {
|
|
|
6
6
|
*/
|
|
7
7
|
src: string
|
|
8
8
|
|
|
9
|
+
/** webview 的进度条颜色
|
|
10
|
+
* @supported tt
|
|
11
|
+
*/
|
|
12
|
+
progressbarColor?: string
|
|
13
|
+
|
|
14
|
+
/** 若使用web-view组件引入第三方客服,必须填写type="im"
|
|
15
|
+
* @supported tt
|
|
16
|
+
* @default default
|
|
17
|
+
*/
|
|
18
|
+
type?: string
|
|
19
|
+
|
|
9
20
|
/** 网页向小程序 postMessage 时,会在特定时机(小程序后退、组件销毁、分享)触发并收到消息。e.detail = { data }
|
|
10
21
|
* @supported weapp, alipay, swan, tt, qq, jd
|
|
11
22
|
*/
|
|
@@ -20,11 +31,6 @@ interface WebViewProps extends StandardProps {
|
|
|
20
31
|
* @supported weapp, alipay, tt, qq, h5, rn
|
|
21
32
|
*/
|
|
22
33
|
onError?: CommonEventFunction<WebViewProps.onErrorEventDetail>
|
|
23
|
-
|
|
24
|
-
/** webview 的进度条颜色
|
|
25
|
-
* @supported tt
|
|
26
|
-
*/
|
|
27
|
-
progressbarColor?: string
|
|
28
34
|
}
|
|
29
35
|
declare namespace WebViewProps {
|
|
30
36
|
interface onMessageEventDetail {
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import generator from '@babel/generator';
|
|
2
|
-
import * as parser from '@babel/parser';
|
|
3
|
-
import traverse from '@babel/traverse';
|
|
4
|
-
import * as t from '@babel/types';
|
|
5
|
-
import * as fs from 'fs';
|
|
6
|
-
import * as humps from 'humps';
|
|
7
|
-
import { flattenDeep, isEmpty, toArray, xorWith } from 'lodash';
|
|
8
|
-
import * as path from 'path';
|
|
9
|
-
import { format as prettify } from 'prettier';
|
|
10
|
-
const MINI_APP_TYPES = ['weapp', 'alipay', 'swan', 'tt', 'qq', 'jd'];
|
|
11
|
-
const OMIT_PROPS = ['generic:simple-component'];
|
|
12
|
-
class GenerateTypes {
|
|
13
|
-
constructor(componentName) {
|
|
14
|
-
this.jsonSchemas = {};
|
|
15
|
-
this.componentName = componentName;
|
|
16
|
-
MINI_APP_TYPES.forEach((type) => {
|
|
17
|
-
try {
|
|
18
|
-
const json = require(`miniapp-types/dist/schema/${type}/${componentName === 'AD' ? 'ad' : humps.decamelize(componentName, { separator: '-' })}.json`);
|
|
19
|
-
if (!json) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (!this.jsonSchemas[componentName]) {
|
|
23
|
-
this.jsonSchemas[componentName] = {};
|
|
24
|
-
}
|
|
25
|
-
this.jsonSchemas[componentName][type] = json;
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
// console.log(error)
|
|
29
|
-
if (!this.jsonSchemas[componentName]) {
|
|
30
|
-
this.jsonSchemas[componentName] = {};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
// 获取不存在的属性
|
|
36
|
-
getMissingProps(props) {
|
|
37
|
-
const obj = {};
|
|
38
|
-
const jsonSchema = this.jsonSchemas[this.componentName];
|
|
39
|
-
if (!jsonSchema) {
|
|
40
|
-
return obj;
|
|
41
|
-
}
|
|
42
|
-
Object.keys(this.jsonSchemas[this.componentName]).forEach((key) => {
|
|
43
|
-
const filteredList = xorWith(props[key], Object.keys(this.jsonSchemas[this.componentName][key].properties));
|
|
44
|
-
if (filteredList.length > 0) {
|
|
45
|
-
obj[key] = filteredList.map((item) => item.match(/^bind/) ? humps.camelize(item.replace(/^bind/, 'on')) : item);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
return obj;
|
|
49
|
-
}
|
|
50
|
-
// 转换不存在的属性,便于添加到已有的类型声明中
|
|
51
|
-
convertProps(props) {
|
|
52
|
-
const array = [...new Set(flattenDeep(toArray(props)))];
|
|
53
|
-
const reverseProps = {};
|
|
54
|
-
array.forEach((prop) => {
|
|
55
|
-
reverseProps[prop] = Object.keys(props).filter((key) => props[key].includes(prop));
|
|
56
|
-
});
|
|
57
|
-
return reverseProps;
|
|
58
|
-
}
|
|
59
|
-
updateComment(ast) {
|
|
60
|
-
const componentName = this.componentName;
|
|
61
|
-
const jsonSchemas = this.jsonSchemas[this.componentName];
|
|
62
|
-
const existProps = {};
|
|
63
|
-
traverse(ast, {
|
|
64
|
-
TSInterfaceDeclaration(astPath) {
|
|
65
|
-
if (astPath.node.id.name !== `${componentName}Props`) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
astPath.traverse({
|
|
69
|
-
TSPropertySignature(astPath) {
|
|
70
|
-
var _a, _b, _c, _d;
|
|
71
|
-
const { name } = astPath.node.key;
|
|
72
|
-
if (!name) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const supportedPlatforms = [];
|
|
76
|
-
const covertedName = name.match(/^on/)
|
|
77
|
-
? name.replace(/^on/, 'bind')
|
|
78
|
-
: humps.decamelize(name, { separator: '-' });
|
|
79
|
-
MINI_APP_TYPES.forEach((type) => {
|
|
80
|
-
var _a, _b, _c, _d;
|
|
81
|
-
if ((_a = jsonSchemas[type]) === null || _a === void 0 ? void 0 : _a.properties[name]) {
|
|
82
|
-
if (isEmpty(existProps[type])) {
|
|
83
|
-
existProps[type] = [name];
|
|
84
|
-
}
|
|
85
|
-
(_b = existProps[type]) === null || _b === void 0 ? void 0 : _b.push(name);
|
|
86
|
-
supportedPlatforms.push(type);
|
|
87
|
-
}
|
|
88
|
-
if (name !== covertedName && ((_c = jsonSchemas[type]) === null || _c === void 0 ? void 0 : _c.properties[covertedName])) {
|
|
89
|
-
if (isEmpty(existProps[type])) {
|
|
90
|
-
existProps[type] = [covertedName];
|
|
91
|
-
}
|
|
92
|
-
(_d = existProps[type]) === null || _d === void 0 ? void 0 : _d.push(covertedName);
|
|
93
|
-
supportedPlatforms.push(type);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
if (isEmpty(astPath.node.leadingComments) || !((_b = (_a = astPath.node.leadingComments) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.value)) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const value = (_d = (_c = astPath.node.leadingComments) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.value;
|
|
100
|
-
// 保留原有 h5 类型
|
|
101
|
-
if (value.toLowerCase().indexOf('h5') > -1) {
|
|
102
|
-
supportedPlatforms.push('h5');
|
|
103
|
-
}
|
|
104
|
-
// 保留原有 rn 类型
|
|
105
|
-
if (value.toLowerCase().indexOf('rn') > -1) {
|
|
106
|
-
supportedPlatforms.push('rn');
|
|
107
|
-
}
|
|
108
|
-
if (isEmpty(supportedPlatforms)) {
|
|
109
|
-
astPath.remove();
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
astPath.node.leadingComments[0].value = value.replace(/@supported .*?\n/, `@supported ${supportedPlatforms.join(', ')}\n`);
|
|
113
|
-
if (value.match(/@deprecated/)) {
|
|
114
|
-
astPath.node.leadingComments[0].value = value.replace(/\* @deprecated.*?\n/, '');
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
return {
|
|
122
|
-
existProps,
|
|
123
|
-
ast,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
// 添加不存在的属性
|
|
127
|
-
addProps(ast, props) {
|
|
128
|
-
const componentName = this.componentName;
|
|
129
|
-
const jsonSchemas = this.jsonSchemas[this.componentName];
|
|
130
|
-
traverse(ast, {
|
|
131
|
-
TSInterfaceDeclaration(astPath) {
|
|
132
|
-
if (astPath.node.id.name !== `${componentName}Props`) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
const addedProps = [];
|
|
136
|
-
astPath.traverse({
|
|
137
|
-
TSInterfaceBody(astPath) {
|
|
138
|
-
Object.keys(props).forEach((prop) => {
|
|
139
|
-
var _a, _b, _c;
|
|
140
|
-
if (OMIT_PROPS.includes(prop)) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
const node = t.cloneNode(astPath.node.body[0]);
|
|
144
|
-
node.key = t.identifier(humps.camelize(prop, { separator: '-' }));
|
|
145
|
-
const platform = props[prop][0];
|
|
146
|
-
const json = jsonSchemas[platform];
|
|
147
|
-
const propSchema = json.properties[prop] || json.properties[prop.replace(/^on/, 'bind')];
|
|
148
|
-
const { type, tsType, enum: enumArray } = propSchema;
|
|
149
|
-
let value;
|
|
150
|
-
if (type === 'string') {
|
|
151
|
-
if (!enumArray) {
|
|
152
|
-
value = t.tsTypeReference(t.identifier(type));
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
value = t.tsUnionType(enumArray.map((item) => t.tsLiteralType(t.stringLiteral(item))));
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
else if (type instanceof Array) {
|
|
159
|
-
value = t.tsTypeReference(t.identifier(type.join('|')));
|
|
160
|
-
}
|
|
161
|
-
else if (tsType === '() => void') {
|
|
162
|
-
value = t.tsTypeReference(t.identifier('CommonEventFunction'));
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
value = t.tsTypeReference(t.identifier('string'));
|
|
166
|
-
}
|
|
167
|
-
node.typeAnnotation = t.tsTypeAnnotation(value);
|
|
168
|
-
node.optional = !((_a = json.required) === null || _a === void 0 ? void 0 : _a[prop]) || !((_b = json.required) === null || _b === void 0 ? void 0 : _b[prop.replace(/^on/, 'bind')]);
|
|
169
|
-
if (node.leadingComments) {
|
|
170
|
-
let commentValue = `* ${(_c = propSchema.description) === null || _c === void 0 ? void 0 : _c.replace(/\n/g, '\n * ')} \n`;
|
|
171
|
-
commentValue += `* @supported ${props[prop].join(', ')}\n`;
|
|
172
|
-
const defaultValue = propSchema.defaultValue;
|
|
173
|
-
if (defaultValue) {
|
|
174
|
-
if (defaultValue instanceof Array) {
|
|
175
|
-
commentValue += `* @default ${propSchema.defaultValue.join(',')}\n`;
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
commentValue += `* @default ${propSchema.defaultValue}\n`;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
node.leadingComments[0].value = commentValue;
|
|
182
|
-
}
|
|
183
|
-
astPath.node.body.push(node);
|
|
184
|
-
addedProps.push(prop);
|
|
185
|
-
});
|
|
186
|
-
},
|
|
187
|
-
});
|
|
188
|
-
},
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
formatJSDoc(ast) {
|
|
192
|
-
traverse(ast, {
|
|
193
|
-
enter(astPath) {
|
|
194
|
-
if (astPath.node.trailingComments) {
|
|
195
|
-
astPath.node.trailingComments = [];
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
exec() {
|
|
201
|
-
const filePath = path.join(process.cwd(), 'types', `${this.componentName}.d.ts`);
|
|
202
|
-
const codeStr = fs.readFileSync(filePath, 'utf8');
|
|
203
|
-
const ast = parser.parse(codeStr, {
|
|
204
|
-
sourceType: 'module',
|
|
205
|
-
strictMode: false,
|
|
206
|
-
plugins: ['typescript'],
|
|
207
|
-
});
|
|
208
|
-
const { existProps } = this.updateComment(ast);
|
|
209
|
-
const missingProps = this.getMissingProps(existProps);
|
|
210
|
-
const props = this.convertProps(missingProps);
|
|
211
|
-
this.addProps(ast, props);
|
|
212
|
-
this.formatJSDoc(ast);
|
|
213
|
-
const result = generator(ast);
|
|
214
|
-
const code = prettify(result.code, { parser: 'typescript', singleQuote: true, semi: false });
|
|
215
|
-
fs.writeFileSync(filePath, code);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
const typesFiles = fs.readdirSync(path.join(process.cwd(), 'types'));
|
|
219
|
-
typesFiles.forEach((fileName) => {
|
|
220
|
-
const componentName = fileName.replace(/\.d\.ts$/, '');
|
|
221
|
-
const generateTypes = new GenerateTypes(componentName);
|
|
222
|
-
generateTypes.exec();
|
|
223
|
-
});
|
|
224
|
-
export default GenerateTypes;
|