@tarojs/components 3.6.0-canary.10 → 3.6.0-canary.12
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/taro-swiper-core_2.cjs.entry.js +3 -5
- package/dist/cjs/taro-swiper-core_2.cjs.entry.js.map +1 -1
- package/dist/collection/components/swiper/swiper.js +3 -5
- package/dist/collection/components/swiper/swiper.js.map +1 -1
- package/dist/components/helper.js +15 -0
- package/dist/components/helper.js.map +1 -0
- package/dist/components/hls.js +27622 -0
- package/dist/components/hls.js.map +1 -0
- package/dist/components/index.d.ts +97 -0
- package/dist/components/index.js +79 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index2.js +78 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/components/index3.js +33 -0
- package/dist/components/index3.js.map +1 -0
- package/dist/components/intersection-observer.js +728 -0
- package/dist/components/intersection-observer.js.map +1 -0
- package/dist/components/picker-group.js +220 -0
- package/dist/components/picker-group.js.map +1 -0
- package/dist/components/taro-ad-core.d.ts +11 -0
- package/dist/components/taro-ad-core.js +35 -0
- package/dist/components/taro-ad-core.js.map +1 -0
- package/dist/components/taro-ad-custom-core.d.ts +11 -0
- package/dist/components/taro-ad-custom-core.js +35 -0
- package/dist/components/taro-ad-custom-core.js.map +1 -0
- package/dist/components/taro-animation-video-core.d.ts +11 -0
- package/dist/components/taro-animation-video-core.js +35 -0
- package/dist/components/taro-animation-video-core.js.map +1 -0
- package/dist/components/taro-animation-view-core.d.ts +11 -0
- package/dist/components/taro-animation-view-core.js +35 -0
- package/dist/components/taro-animation-view-core.js.map +1 -0
- package/dist/components/taro-ar-camera-core.d.ts +11 -0
- package/dist/components/taro-ar-camera-core.js +35 -0
- package/dist/components/taro-ar-camera-core.js.map +1 -0
- package/dist/components/taro-audio-core.d.ts +11 -0
- package/dist/components/taro-audio-core.js +80 -0
- package/dist/components/taro-audio-core.js.map +1 -0
- package/dist/components/taro-aweme-data-core.d.ts +11 -0
- package/dist/components/taro-aweme-data-core.js +35 -0
- package/dist/components/taro-aweme-data-core.js.map +1 -0
- package/dist/components/taro-block-core.d.ts +11 -0
- package/dist/components/taro-block-core.js +31 -0
- package/dist/components/taro-block-core.js.map +1 -0
- package/dist/components/taro-button-core.d.ts +11 -0
- package/dist/components/taro-button-core.js +102 -0
- package/dist/components/taro-button-core.js.map +1 -0
- package/dist/components/taro-camera-core.d.ts +11 -0
- package/dist/components/taro-camera-core.js +35 -0
- package/dist/components/taro-camera-core.js.map +1 -0
- package/dist/components/taro-canvas-core.d.ts +11 -0
- package/dist/components/taro-canvas-core.js +57 -0
- package/dist/components/taro-canvas-core.js.map +1 -0
- package/dist/components/taro-checkbox-core.d.ts +11 -0
- package/dist/components/taro-checkbox-core.js +81 -0
- package/dist/components/taro-checkbox-core.js.map +1 -0
- package/dist/components/taro-checkbox-group-core.d.ts +11 -0
- package/dist/components/taro-checkbox-group-core.js +71 -0
- package/dist/components/taro-checkbox-group-core.js.map +1 -0
- package/dist/components/taro-comment-detail-core.d.ts +11 -0
- package/dist/components/taro-comment-detail-core.js +35 -0
- package/dist/components/taro-comment-detail-core.js.map +1 -0
- package/dist/components/taro-comment-list-core.d.ts +11 -0
- package/dist/components/taro-comment-list-core.js +35 -0
- package/dist/components/taro-comment-list-core.js.map +1 -0
- package/dist/components/taro-contact-button-core.d.ts +11 -0
- package/dist/components/taro-contact-button-core.js +35 -0
- package/dist/components/taro-contact-button-core.js.map +1 -0
- package/dist/components/taro-cover-image-core.d.ts +11 -0
- package/dist/components/taro-cover-image-core.js +52 -0
- package/dist/components/taro-cover-image-core.js.map +1 -0
- package/dist/components/taro-cover-view-core.d.ts +11 -0
- package/dist/components/taro-cover-view-core.js +89 -0
- package/dist/components/taro-cover-view-core.js.map +1 -0
- package/dist/components/taro-custom-wrapper-core.d.ts +11 -0
- package/dist/components/taro-custom-wrapper-core.js +31 -0
- package/dist/components/taro-custom-wrapper-core.js.map +1 -0
- package/dist/components/taro-editor-core.d.ts +11 -0
- package/dist/components/taro-editor-core.js +35 -0
- package/dist/components/taro-editor-core.js.map +1 -0
- package/dist/components/taro-follow-swan-core.d.ts +11 -0
- package/dist/components/taro-follow-swan-core.js +35 -0
- package/dist/components/taro-follow-swan-core.js.map +1 -0
- package/dist/components/taro-form-core.d.ts +11 -0
- package/dist/components/taro-form-core.js +140 -0
- package/dist/components/taro-form-core.js.map +1 -0
- package/dist/components/taro-functional-page-navigator-core.d.ts +11 -0
- package/dist/components/taro-functional-page-navigator-core.js +35 -0
- package/dist/components/taro-functional-page-navigator-core.js.map +1 -0
- package/dist/components/taro-icon-core.d.ts +11 -0
- package/dist/components/taro-icon-core.js +48 -0
- package/dist/components/taro-icon-core.js.map +1 -0
- package/dist/components/taro-image-core.d.ts +11 -0
- package/dist/components/taro-image-core.js +81 -0
- package/dist/components/taro-image-core.js.map +1 -0
- package/dist/components/taro-inline-payment-panel-core.d.ts +11 -0
- package/dist/components/taro-inline-payment-panel-core.js +35 -0
- package/dist/components/taro-inline-payment-panel-core.js.map +1 -0
- package/dist/components/taro-input-core.d.ts +11 -0
- package/dist/components/taro-input-core.js +246 -0
- package/dist/components/taro-input-core.js.map +1 -0
- package/dist/components/taro-keyboard-accessory-core.d.ts +11 -0
- package/dist/components/taro-keyboard-accessory-core.js +35 -0
- package/dist/components/taro-keyboard-accessory-core.js.map +1 -0
- package/dist/components/taro-label-core.d.ts +11 -0
- package/dist/components/taro-label-core.js +34 -0
- package/dist/components/taro-label-core.js.map +1 -0
- package/dist/components/taro-lifestyle-core.d.ts +11 -0
- package/dist/components/taro-lifestyle-core.js +35 -0
- package/dist/components/taro-lifestyle-core.js.map +1 -0
- package/dist/components/taro-like-core.d.ts +11 -0
- package/dist/components/taro-like-core.js +35 -0
- package/dist/components/taro-like-core.js.map +1 -0
- package/dist/components/taro-live-player-core.d.ts +11 -0
- package/dist/components/taro-live-player-core.js +35 -0
- package/dist/components/taro-live-player-core.js.map +1 -0
- package/dist/components/taro-live-pusher-core.d.ts +11 -0
- package/dist/components/taro-live-pusher-core.js +35 -0
- package/dist/components/taro-live-pusher-core.js.map +1 -0
- package/dist/components/taro-login-core.d.ts +11 -0
- package/dist/components/taro-login-core.js +35 -0
- package/dist/components/taro-login-core.js.map +1 -0
- package/dist/components/taro-lottie-core.d.ts +11 -0
- package/dist/components/taro-lottie-core.js +35 -0
- package/dist/components/taro-lottie-core.js.map +1 -0
- package/dist/components/taro-map-core.d.ts +11 -0
- package/dist/components/taro-map-core.js +35 -0
- package/dist/components/taro-map-core.js.map +1 -0
- package/dist/components/taro-match-media-core.d.ts +11 -0
- package/dist/components/taro-match-media-core.js +35 -0
- package/dist/components/taro-match-media-core.js.map +1 -0
- package/dist/components/taro-movable-area-core.d.ts +11 -0
- package/dist/components/taro-movable-area-core.js +175 -0
- package/dist/components/taro-movable-area-core.js.map +1 -0
- package/dist/components/taro-movable-view-core.d.ts +11 -0
- package/dist/components/taro-movable-view-core.js +361 -0
- package/dist/components/taro-movable-view-core.js.map +1 -0
- package/dist/components/taro-native-slot-core.d.ts +11 -0
- package/dist/components/taro-native-slot-core.js +35 -0
- package/dist/components/taro-native-slot-core.js.map +1 -0
- package/dist/components/taro-navigation-bar-core.d.ts +11 -0
- package/dist/components/taro-navigation-bar-core.js +35 -0
- package/dist/components/taro-navigation-bar-core.js.map +1 -0
- package/dist/components/taro-navigator-core.d.ts +11 -0
- package/dist/components/taro-navigator-core.js +96 -0
- package/dist/components/taro-navigator-core.js.map +1 -0
- package/dist/components/taro-official-account-core.d.ts +11 -0
- package/dist/components/taro-official-account-core.js +35 -0
- package/dist/components/taro-official-account-core.js.map +1 -0
- package/dist/components/taro-open-data-core.d.ts +11 -0
- package/dist/components/taro-open-data-core.js +35 -0
- package/dist/components/taro-open-data-core.js.map +1 -0
- package/dist/components/taro-page-container-core.d.ts +11 -0
- package/dist/components/taro-page-container-core.js +35 -0
- package/dist/components/taro-page-container-core.js.map +1 -0
- package/dist/components/taro-page-meta-core.d.ts +11 -0
- package/dist/components/taro-page-meta-core.js +35 -0
- package/dist/components/taro-page-meta-core.js.map +1 -0
- package/dist/components/taro-picker-core.d.ts +11 -0
- package/dist/components/taro-picker-core.js +538 -0
- package/dist/components/taro-picker-core.js.map +1 -0
- package/dist/components/taro-picker-group.d.ts +11 -0
- package/dist/components/taro-picker-group.js +8 -0
- package/dist/components/taro-picker-group.js.map +1 -0
- package/dist/components/taro-picker-view-column-core.d.ts +11 -0
- package/dist/components/taro-picker-view-column-core.js +115 -0
- package/dist/components/taro-picker-view-column-core.js.map +1 -0
- package/dist/components/taro-picker-view-core.d.ts +11 -0
- package/dist/components/taro-picker-view-core.js +114 -0
- package/dist/components/taro-picker-view-core.js.map +1 -0
- package/dist/components/taro-progress-core.d.ts +11 -0
- package/dist/components/taro-progress-core.js +62 -0
- package/dist/components/taro-progress-core.js.map +1 -0
- package/dist/components/taro-pull-to-refresh.d.ts +11 -0
- package/dist/components/taro-pull-to-refresh.js +284 -0
- package/dist/components/taro-pull-to-refresh.js.map +1 -0
- package/dist/components/taro-radio-core.d.ts +11 -0
- package/dist/components/taro-radio-core.js +83 -0
- package/dist/components/taro-radio-core.js.map +1 -0
- package/dist/components/taro-radio-group-core.d.ts +11 -0
- package/dist/components/taro-radio-group-core.js +82 -0
- package/dist/components/taro-radio-group-core.js.map +1 -0
- package/dist/components/taro-rich-text-core.d.ts +11 -0
- package/dist/components/taro-rich-text-core.js +86 -0
- package/dist/components/taro-rich-text-core.js.map +1 -0
- package/dist/components/taro-root-portal-core.d.ts +11 -0
- package/dist/components/taro-root-portal-core.js +35 -0
- package/dist/components/taro-root-portal-core.js.map +1 -0
- package/dist/components/taro-rtc-room-core.d.ts +11 -0
- package/dist/components/taro-rtc-room-core.js +35 -0
- package/dist/components/taro-rtc-room-core.js.map +1 -0
- package/dist/components/taro-rtc-room-item-core.d.ts +11 -0
- package/dist/components/taro-rtc-room-item-core.js +35 -0
- package/dist/components/taro-rtc-room-item-core.js.map +1 -0
- package/dist/components/taro-scroll-view-core.d.ts +11 -0
- package/dist/components/taro-scroll-view-core.js +184 -0
- package/dist/components/taro-scroll-view-core.js.map +1 -0
- package/dist/components/taro-share-element-core.d.ts +11 -0
- package/dist/components/taro-share-element-core.js +35 -0
- package/dist/components/taro-share-element-core.js.map +1 -0
- package/dist/components/taro-slider-core.d.ts +11 -0
- package/dist/components/taro-slider-core.js +196 -0
- package/dist/components/taro-slider-core.js.map +1 -0
- package/dist/components/taro-slot-core.d.ts +11 -0
- package/dist/components/taro-slot-core.js +35 -0
- package/dist/components/taro-slot-core.js.map +1 -0
- package/dist/components/taro-swiper-core.d.ts +11 -0
- package/dist/components/taro-swiper-core.js +10165 -0
- package/dist/components/taro-swiper-core.js.map +1 -0
- package/dist/components/taro-swiper-item-core.d.ts +11 -0
- package/dist/components/taro-swiper-item-core.js +34 -0
- package/dist/components/taro-swiper-item-core.js.map +1 -0
- package/dist/components/taro-switch-core.d.ts +11 -0
- package/dist/components/taro-switch-core.js +87 -0
- package/dist/components/taro-switch-core.js.map +1 -0
- package/dist/components/taro-tab-item-core.d.ts +11 -0
- package/dist/components/taro-tab-item-core.js +35 -0
- package/dist/components/taro-tab-item-core.js.map +1 -0
- package/dist/components/taro-tabbar.d.ts +11 -0
- package/dist/components/taro-tabbar.js +457 -0
- package/dist/components/taro-tabbar.js.map +1 -0
- package/dist/components/taro-tabs-core.d.ts +11 -0
- package/dist/components/taro-tabs-core.js +35 -0
- package/dist/components/taro-tabs-core.js.map +1 -0
- package/dist/components/taro-text-core.d.ts +11 -0
- package/dist/components/taro-text-core.js +41 -0
- package/dist/components/taro-text-core.js.map +1 -0
- package/dist/components/taro-textarea-core.d.ts +11 -0
- package/dist/components/taro-textarea-core.js +164 -0
- package/dist/components/taro-textarea-core.js.map +1 -0
- package/dist/components/taro-video-control.d.ts +11 -0
- package/dist/components/taro-video-control.js +8 -0
- package/dist/components/taro-video-control.js.map +1 -0
- package/dist/components/taro-video-core.d.ts +11 -0
- package/dist/components/taro-video-core.js +485 -0
- package/dist/components/taro-video-core.js.map +1 -0
- package/dist/components/taro-video-danmu.d.ts +11 -0
- package/dist/components/taro-video-danmu.js +8 -0
- package/dist/components/taro-video-danmu.js.map +1 -0
- package/dist/components/taro-view-core.d.ts +11 -0
- package/dist/components/taro-view-core.js +101 -0
- package/dist/components/taro-view-core.js.map +1 -0
- package/dist/components/taro-voip-room-core.d.ts +11 -0
- package/dist/components/taro-voip-room-core.js +35 -0
- package/dist/components/taro-voip-room-core.js.map +1 -0
- package/dist/components/taro-web-view-core.d.ts +11 -0
- package/dist/components/taro-web-view-core.js +46 -0
- package/dist/components/taro-web-view-core.js.map +1 -0
- package/dist/components/video-control.js +233 -0
- package/dist/components/video-control.js.map +1 -0
- package/dist/components/video-danmu.js +110 -0
- package/dist/components/video-danmu.js.map +1 -0
- package/dist/esm/taro-swiper-core_2.entry.js +3 -5
- package/dist/esm/taro-swiper-core_2.entry.js.map +1 -1
- package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-swiper-core_2.entry.js.map +1 -1
- package/dist/taro-components/{p-d388c097.entry.js → p-22315b9d.entry.js} +2 -2
- package/dist/taro-components/p-22315b9d.entry.js.map +1 -0
- package/dist/taro-components/{p-6831f7b1.system.entry.js → p-c3c37cbb.system.entry.js} +2 -2
- package/dist/taro-components/p-c3c37cbb.system.entry.js.map +1 -0
- package/dist/taro-components/p-cb17d8bd.system.js +1 -1
- package/dist/taro-components/taro-components.esm.js +1 -1
- package/lib/react/components.d.ts +82 -0
- package/lib/react/components.js +85 -0
- package/lib/react/components.js.map +1 -0
- package/lib/react/helper.d.ts +10 -0
- package/lib/react/helper.js +7 -0
- package/lib/react/helper.js.map +1 -0
- package/lib/react/index.d.ts +1 -0
- package/lib/react/index.js +2 -0
- package/lib/react/index.js.map +1 -0
- package/lib/react/interfaces-4f837811.d.ts +30 -0
- package/lib/react/react-component-lib/createComponent.d.ts +10 -0
- package/lib/react/react-component-lib/createComponent.js +70 -0
- package/lib/react/react-component-lib/createComponent.js.map +1 -0
- package/lib/react/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/lib/react/react-component-lib/createOverlayComponent.js +91 -0
- package/lib/react/react-component-lib/createOverlayComponent.js.map +1 -0
- package/lib/react/react-component-lib/index.d.ts +2 -0
- package/lib/react/react-component-lib/index.js +3 -0
- package/lib/react/react-component-lib/index.js.map +1 -0
- package/lib/react/react-component-lib/utils/attachProps.d.ts +13 -0
- package/lib/react/react-component-lib/utils/attachProps.js +101 -0
- package/lib/react/react-component-lib/utils/attachProps.js.map +1 -0
- package/lib/react/react-component-lib/utils/case.d.ts +3 -0
- package/lib/react/react-component-lib/utils/case.js +9 -0
- package/lib/react/react-component-lib/utils/case.js.map +1 -0
- package/lib/react/react-component-lib/utils/index.d.ts +11 -0
- package/lib/react/react-component-lib/utils/index.js +37 -0
- package/lib/react/react-component-lib/utils/index.js.map +1 -0
- package/lib/vue2/components.d.ts +352 -0
- package/lib/vue2/components.js +620 -0
- package/lib/vue2/components.js.map +1 -0
- package/lib/vue2/index.d.ts +3 -0
- package/lib/vue2/index.js +21 -0
- package/lib/vue2/index.js.map +1 -0
- package/lib/vue2/vue-component-lib/utils.d.ts +6 -0
- package/lib/vue2/vue-component-lib/utils.js +32 -0
- package/lib/vue2/vue-component-lib/utils.js.map +1 -0
- package/lib/vue3/components.d.ts +82 -0
- package/lib/vue3/components.js +386 -0
- package/lib/vue3/components.js.map +1 -0
- package/lib/vue3/index.d.ts +3 -0
- package/lib/vue3/index.js +15 -0
- package/lib/vue3/index.js.map +1 -0
- package/lib/vue3/vue-component-lib/utils.d.ts +21 -0
- package/lib/vue3/vue-component-lib/utils.js +163 -0
- package/lib/vue3/vue-component-lib/utils.js.map +1 -0
- package/package.json +9 -7
- package/types/index.vue3.d.ts +4 -4
- package/dist/react/component-lib/index.js +0 -74
- package/dist/react/component-lib/input.js +0 -17
- package/dist/react/component-lib/reactify-wc.js +0 -206
- package/dist/react/components.js +0 -82
- package/dist/react/helper.js +0 -8
- package/dist/react/index.js +0 -1
- package/dist/react/react-component-lib/createComponent.js +0 -99
- package/dist/react/react-component-lib/createOverlayComponent.js +0 -178
- package/dist/react/react-component-lib/index.js +0 -2
- package/dist/react/react-component-lib/interfaces.js +0 -0
- package/dist/react/react-component-lib/utils/attachProps.js +0 -98
- package/dist/react/react-component-lib/utils/case.js +0 -10
- package/dist/react/react-component-lib/utils/dev.js +0 -12
- package/dist/react/react-component-lib/utils/index.js +0 -37
- package/dist/taro-components/p-6831f7b1.system.entry.js.map +0 -1
- package/dist/taro-components/p-d388c097.entry.js.map +0 -1
- package/dist/vue2/component-lib/components.js +0 -71
- package/dist/vue2/component-lib/createComponent.js +0 -21
- package/dist/vue2/component-lib/createFormsComponent.js +0 -53
- package/dist/vue2/component-lib/icon.js +0 -19
- package/dist/vue2/component-lib/image.js +0 -20
- package/dist/vue2/component-lib/index.js +0 -28
- package/dist/vue2/component-lib/mixins/listeners.js +0 -14
- package/dist/vue2/component-lib/mixins/refs.js +0 -44
- package/dist/vue2/component-lib/picker.js +0 -40
- package/dist/vue2/component-lib/scroll-view.js +0 -32
- package/dist/vue2/component-lib/text.js +0 -20
- package/dist/vue2/components.js +0 -542
- package/dist/vue2/index.js +0 -22
- package/dist/vue2/vue-component-lib/utils.js +0 -40
- package/dist/vue3/component-lib/createComponent.js +0 -23
- package/dist/vue3/component-lib/createFormsComponent.js +0 -43
- package/dist/vue3/component-lib/forwardRef.js +0 -9
- package/dist/vue3/component-lib/icon.js +0 -21
- package/dist/vue3/component-lib/image.js +0 -22
- package/dist/vue3/component-lib/index.js +0 -76
- package/dist/vue3/component-lib/scroll-view.js +0 -28
- package/dist/vue3/component-lib/text.js +0 -22
- package/dist/vue3/components.js +0 -80
- package/dist/vue3/index.js +0 -17
- package/dist/vue3/vue-component-lib/utils.js +0 -175
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../taro-components-library-vue3/src/vue-component-lib/utils.ts"],"sourcesContent":["import { VNode, defineComponent, getCurrentInstance, h, inject, ref, Ref } from 'vue';\n\nexport interface InputProps<T> {\n modelValue?: T;\n}\n\nconst UPDATE_VALUE_EVENT = 'update:modelValue';\nconst MODEL_VALUE = 'modelValue';\nconst ROUTER_LINK_VALUE = 'routerLink';\nconst NAV_MANAGER = 'navManager';\nconst ROUTER_PROP_PREFIX = 'router';\n\n/**\n * Starting in Vue 3.1.0, all properties are\n * added as keys to the props object, even if\n * they are not being used. In order to correctly\n * account for both value props and v-model props,\n * we need to check if the key exists for Vue <3.1.0\n * and then check if it is not undefined for Vue >= 3.1.0.\n * See https://github.com/vuejs/vue-next/issues/3889\n */\nconst EMPTY_PROP = Symbol();\nconst DEFAULT_EMPTY_PROP = { default: EMPTY_PROP };\n\ninterface NavManager<T = any> {\n navigate: (options: T) => void;\n}\n\nconst getComponentClasses = (classes: unknown) => {\n return (classes as string)?.split(' ') || [];\n};\n\nconst getElementClasses = (ref: Ref<HTMLElement | undefined>, componentClasses: Set<string>, defaultClasses: string[] = []) => {\n return [ ...Array.from(ref.value?.classList || []), ...defaultClasses ]\n .filter((c: string, i, self) => !componentClasses.has(c) && self.indexOf(c) === i);\n};\n\n/**\n* Create a callback to define a Vue component wrapper around a Web Component.\n*\n* @prop name - The component tag name (i.e. `ion-button`)\n* @prop componentProps - An array of properties on the\n* component. These usually match up with the @Prop definitions\n* in each component's TSX file.\n* @prop customElement - An option custom element instance to pass\n* to customElements.define. Only set if `includeImportCustomElements: true` in your config.\n* @prop modelProp - The prop that v-model binds to (i.e. value)\n* @prop modelUpdateEvent - The event that is fired from your Web Component when the value changes (i.e. ionChange)\n* @prop externalModelUpdateEvent - The external event to fire from your Vue component when modelUpdateEvent fires. This is used for ensuring that v-model references have been\n* correctly updated when a user's event callback fires.\n*/\nexport const defineContainer = <Props, VModelType=string|number|boolean>(\n name: string,\n defineCustomElement: any,\n componentProps: string[] = [],\n modelProp?: string,\n modelUpdateEvent?: string,\n externalModelUpdateEvent?: string\n) => {\n /**\n * Create a Vue component wrapper around a Web Component.\n * Note: The `props` here are not all properties on a component.\n * They refer to whatever properties are set on an instance of a component.\n */\n\n if (defineCustomElement !== undefined) {\n defineCustomElement();\n }\n\n const Container = defineComponent<Props & InputProps<VModelType>>((props: any, { attrs, slots, emit }) => {\n let modelPropValue = props[modelProp];\n const containerRef = ref<HTMLElement>();\n const classes = new Set(getComponentClasses(attrs.class));\n const onVnodeBeforeMount = (vnode: VNode) => {\n // Add a listener to tell Vue to update the v-model\n if (vnode.el) {\n const eventsNames = Array.isArray(modelUpdateEvent) ? modelUpdateEvent : [modelUpdateEvent];\n eventsNames.forEach((eventName: string) => {\n vnode.el!.addEventListener(eventName.toLowerCase(), (e: Event) => {\n modelPropValue = (e?.target as any)[modelProp];\n emit(UPDATE_VALUE_EVENT, modelPropValue);\n\n /**\n * We need to emit the change event here\n * rather than on the web component to ensure\n * that any v-model bindings have been updated.\n * Otherwise, the developer will listen on the\n * native web component, but the v-model will\n * not have been updated yet.\n */\n if (externalModelUpdateEvent) {\n emit(externalModelUpdateEvent, e);\n }\n });\n });\n }\n };\n\n const currentInstance = getCurrentInstance();\n const hasRouter = currentInstance?.appContext?.provides[NAV_MANAGER];\n const navManager: NavManager | undefined = hasRouter ? inject(NAV_MANAGER) : undefined;\n const handleRouterLink = (ev: Event) => {\n const { routerLink } = props;\n if (routerLink === EMPTY_PROP) return;\n\n if (navManager !== undefined) {\n let navigationPayload: any = { event: ev };\n for (const key in props) {\n const value = props[key];\n if (props.hasOwnProperty(key) && key.startsWith(ROUTER_PROP_PREFIX) && value !== EMPTY_PROP) {\n navigationPayload[key] = value;\n }\n }\n\n navManager.navigate(navigationPayload);\n } else {\n console.warn('Tried to navigate, but no router was found. Make sure you have mounted Vue Router.');\n }\n }\n\n return () => {\n modelPropValue = props[modelProp];\n\n getComponentClasses(attrs.class).forEach(value => {\n classes.add(value);\n });\n\n const oldClick = props.onClick;\n const handleClick = (ev: Event) => {\n if (oldClick !== undefined) {\n oldClick(ev);\n }\n if (!ev.defaultPrevented) {\n handleRouterLink(ev);\n }\n }\n\n let propsToAdd: any = {\n ref: containerRef,\n class: getElementClasses(containerRef, classes),\n onClick: handleClick,\n onVnodeBeforeMount: (modelUpdateEvent) ? onVnodeBeforeMount : undefined\n };\n\n /**\n * We can use Object.entries here\n * to avoid the hasOwnProperty check,\n * but that would require 2 iterations\n * where as this only requires 1.\n */\n for (const key in props) {\n const value = props[key];\n if (props.hasOwnProperty(key) && value !== EMPTY_PROP) {\n propsToAdd[key] = value;\n }\n }\n\n if (modelProp) {\n /**\n * If form value property was set using v-model\n * then we should use that value.\n * Otherwise, check to see if form value property\n * was set as a static value (i.e. no v-model).\n */\n if (props[MODEL_VALUE] !== EMPTY_PROP) {\n propsToAdd = {\n ...propsToAdd,\n [modelProp]: props[MODEL_VALUE]\n }\n } else if (modelPropValue !== EMPTY_PROP) {\n propsToAdd = {\n ...propsToAdd,\n [modelProp]: modelPropValue\n }\n }\n }\n\n return h(name, propsToAdd, slots.default && slots.default());\n }\n });\n\n Container.displayName = name;\n\n Container.props = {\n [ROUTER_LINK_VALUE]: DEFAULT_EMPTY_PROP\n };\n\n componentProps.forEach(componentProp => {\n Container.props[componentProp] = DEFAULT_EMPTY_PROP;\n });\n\n if (modelProp) {\n Container.props[MODEL_VALUE] = DEFAULT_EMPTY_PROP;\n Container.emits = [UPDATE_VALUE_EVENT, externalModelUpdateEvent];\n }\n\n return Container;\n};\n"],"names":[],"mappings":";;AAMA,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAC/C,MAAM,WAAW,GAAG,YAAY,CAAC;AACjC,MAAM,iBAAiB,GAAG,YAAY,CAAC;AACvC,MAAM,WAAW,GAAG,YAAY,CAAC;AACjC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAEpC;;;;;;;;AAQG;AACH,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;AAC5B,MAAM,kBAAkB,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;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IAAI,CAAC;IAE7B,SAAS,CAAC,KAAK,GAAG;QAChB,CAAC,iBAAiB,GAAG,kBAAkB;KACxC,CAAC;AAEF,IAAA,cAAc,CAAC,OAAO,CAAC,aAAa,IAAG;AACrC,QAAA,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,kBAAkB,CAAC;AACtD,KAAC,CAAC,CAAC;AAEH,IAAA,IAAI,SAAS,EAAE;AACb,QAAA,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,kBAAkB,CAAC;QAClD,SAAS,CAAC,KAAK,GAAG,CAAC,kBAAkB,EAAE,wBAAwB,CAAC,CAAC;AAClE,KAAA;AAED,IAAA,OAAO,SAAS,CAAC;AACnB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/components",
|
|
3
|
-
"version": "3.6.0-canary.
|
|
3
|
+
"version": "3.6.0-canary.12",
|
|
4
4
|
"description": "Taro 组件库",
|
|
5
5
|
"browser": "dist/index.js",
|
|
6
6
|
"main:h5": "dist/index.js",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
],
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
|
+
"lib",
|
|
16
17
|
"loader",
|
|
17
18
|
"mini",
|
|
18
19
|
"types",
|
|
@@ -35,9 +36,9 @@
|
|
|
35
36
|
"resolve-pathname": "^3.0.0",
|
|
36
37
|
"swiper": "6.8.0",
|
|
37
38
|
"weui": "^1.1.2",
|
|
38
|
-
"@tarojs/components-advanced": "3.6.0-canary.
|
|
39
|
-
"@tarojs/router": "3.6.0-canary.
|
|
40
|
-
"@tarojs/taro": "3.6.0-canary.
|
|
39
|
+
"@tarojs/components-advanced": "3.6.0-canary.12",
|
|
40
|
+
"@tarojs/router": "3.6.0-canary.12",
|
|
41
|
+
"@tarojs/taro": "3.6.0-canary.12"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@babel/generator": "^7.14.5",
|
|
@@ -72,13 +73,14 @@
|
|
|
72
73
|
}
|
|
73
74
|
},
|
|
74
75
|
"scripts": {
|
|
76
|
+
"preinstall": "mkdir -p lib",
|
|
75
77
|
"build": "cross-env NODE_ENV=production run-s build:components build:library",
|
|
76
78
|
"build:components": "stencil build --config stencil.config.ts",
|
|
77
79
|
"build:library": "pnpm --filter @tarojs/components-library-react --filter @tarojs/components-library-vue2 --filter @tarojs/components-library-vue3 run build:ci",
|
|
78
80
|
"dev:components": "cross-env NODE_ENV=development pnpm run build:components --watch",
|
|
79
|
-
"dev:library-react": "cross-env NODE_ENV=development pnpm --filter @tarojs/components-library-react run
|
|
80
|
-
"dev:library-vue2": "cross-env NODE_ENV=development pnpm --filter @tarojs/components-library-vue2 run
|
|
81
|
-
"dev:library-vue3": "cross-env NODE_ENV=development pnpm --filter @tarojs/components-library-vue3 run
|
|
81
|
+
"dev:library-react": "cross-env NODE_ENV=development pnpm --filter @tarojs/components-library-react run dev",
|
|
82
|
+
"dev:library-vue2": "cross-env NODE_ENV=development pnpm --filter @tarojs/components-library-vue2 run dev",
|
|
83
|
+
"dev:library-vue3": "cross-env NODE_ENV=development pnpm --filter @tarojs/components-library-vue3 run dev",
|
|
82
84
|
"test": "cross-env NODE_ENV=test stencil test --spec --e2e",
|
|
83
85
|
"test:ci": "pnpm run test --ci --no-build",
|
|
84
86
|
"test:coverage": "pnpm run test --ci --screenshot --coverage",
|
package/types/index.vue3.d.ts
CHANGED
|
@@ -84,8 +84,8 @@ interface SlimProps {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/** 转换 react 的类型到 vue */
|
|
87
|
-
type RemoveReactAttribute = 'className' | 'style' | 'key' | 'ref' | 'dangerouslySetInnerHTML'
|
|
88
|
-
type TransformReact2VueType<P extends StandardProps = Record<string, never>> = DistributiveOmit<P, RemoveReactAttribute> & SlimProps
|
|
87
|
+
export type RemoveReactAttribute = 'className' | 'style' | 'key' | 'ref' | 'dangerouslySetInnerHTML'
|
|
88
|
+
export type TransformReact2VueType<P extends StandardProps = Record<string, never>> = DistributiveOmit<P, RemoveReactAttribute> & SlimProps
|
|
89
89
|
export type VueComponentType<P = Record<string, never>> = DefineComponent<TransformReact2VueType<P>>
|
|
90
90
|
|
|
91
91
|
export * from './common'
|
|
@@ -156,14 +156,14 @@ export declare const PageMeta: VueComponentType<PageMetaProps>
|
|
|
156
156
|
export declare const CustomWrapper: VueComponentType<CustomWrapperProps>
|
|
157
157
|
export declare const Slot: VueComponentType<SlotProps>
|
|
158
158
|
|
|
159
|
-
type ReservedProps = {
|
|
159
|
+
export type ReservedProps = {
|
|
160
160
|
key?: string | number | symbol
|
|
161
161
|
ref?: VNodeRef
|
|
162
162
|
ref_for?: boolean
|
|
163
163
|
ref_key?: string
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
type ElementAttrs<T> = T & ReservedProps
|
|
166
|
+
export type ElementAttrs<T> = T & ReservedProps
|
|
167
167
|
|
|
168
168
|
declare global {
|
|
169
169
|
namespace JSX {
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Fragment } from 'react';
|
|
2
|
-
import reactifyWc from './reactify-wc';
|
|
3
|
-
|
|
4
|
-
// 视图容器
|
|
5
|
-
export var CoverImage = reactifyWc('taro-cover-image-core');
|
|
6
|
-
export var CoverView = reactifyWc('taro-cover-view-core');
|
|
7
|
-
export var MatchMedia = reactifyWc('taro-match-media-core');
|
|
8
|
-
export var MovableArea = reactifyWc('taro-movable-area-core');
|
|
9
|
-
export var MovableView = reactifyWc('taro-movable-view-core');
|
|
10
|
-
export var PageContainer = reactifyWc('taro-page-container-core');
|
|
11
|
-
export var RootPortal = reactifyWc('taro-root-portal-core');
|
|
12
|
-
export var ScrollView = reactifyWc('taro-scroll-view-core');
|
|
13
|
-
export var ShareElement = reactifyWc('taro-share-element-core');
|
|
14
|
-
export var Swiper = reactifyWc('taro-swiper-core');
|
|
15
|
-
export var SwiperItem = reactifyWc('taro-swiper-item-core');
|
|
16
|
-
export var View = reactifyWc('taro-view-core');
|
|
17
|
-
|
|
18
|
-
// 基础内容
|
|
19
|
-
export var Icon = reactifyWc('taro-icon-core');
|
|
20
|
-
export var Progress = reactifyWc('taro-progress-core');
|
|
21
|
-
export var RichText = reactifyWc('taro-rich-text-core');
|
|
22
|
-
export var Text = reactifyWc('taro-text-core');
|
|
23
|
-
|
|
24
|
-
// 表单组件
|
|
25
|
-
export var Button = reactifyWc('taro-button-core');
|
|
26
|
-
export var Checkbox = reactifyWc('taro-checkbox-core');
|
|
27
|
-
export var CheckboxGroup = reactifyWc('taro-checkbox-group-core');
|
|
28
|
-
export var Editor = reactifyWc('taro-editor-core');
|
|
29
|
-
export var Form = reactifyWc('taro-form-core');
|
|
30
|
-
export { default as Input } from './input';
|
|
31
|
-
export var KeyboardAccessory = reactifyWc('taro-keyboard-accessory-core');
|
|
32
|
-
export var Label = reactifyWc('taro-label-core');
|
|
33
|
-
export var Picker = reactifyWc('taro-picker-core');
|
|
34
|
-
export var PickerView = reactifyWc('taro-picker-view-core');
|
|
35
|
-
export var PickerViewColumn = reactifyWc('taro-picker-view-column-core');
|
|
36
|
-
export var Radio = reactifyWc('taro-radio-core');
|
|
37
|
-
export var RadioGroup = reactifyWc('taro-radio-group-core');
|
|
38
|
-
export var Slider = reactifyWc('taro-slider-core');
|
|
39
|
-
export var Switch = reactifyWc('taro-switch-core');
|
|
40
|
-
export var Textarea = reactifyWc('taro-textarea-core');
|
|
41
|
-
|
|
42
|
-
// 导航
|
|
43
|
-
export var FunctionalPageNavigator = reactifyWc('taro-functional-page-navigator-core');
|
|
44
|
-
export var Navigator = reactifyWc('taro-navigator-core');
|
|
45
|
-
export var NavigationBar = reactifyWc('taro-navigation-bar-core');
|
|
46
|
-
|
|
47
|
-
// 媒体组件
|
|
48
|
-
export var Audio = reactifyWc('taro-audio-core');
|
|
49
|
-
export var Camera = reactifyWc('taro-camera-core');
|
|
50
|
-
export var Image = reactifyWc('taro-image-core');
|
|
51
|
-
export var LivePlayer = reactifyWc('taro-live-player-core');
|
|
52
|
-
export var LivePusher = reactifyWc('taro-live-pusher-core');
|
|
53
|
-
export var Video = reactifyWc('taro-video-core');
|
|
54
|
-
export var VoipRoom = reactifyWc('taro-voip-room-core');
|
|
55
|
-
|
|
56
|
-
// 地图
|
|
57
|
-
export var Map = reactifyWc('taro-map-core');
|
|
58
|
-
|
|
59
|
-
// 画布
|
|
60
|
-
export var Canvas = reactifyWc('taro-canvas-core');
|
|
61
|
-
|
|
62
|
-
// 开放能力
|
|
63
|
-
export var Ad = reactifyWc('taro-ad-core');
|
|
64
|
-
export var AdCustom = reactifyWc('taro-ad-custom-core');
|
|
65
|
-
export var OfficialAccount = reactifyWc('taro-official-account-core');
|
|
66
|
-
export var OpenData = reactifyWc('taro-open-data-core');
|
|
67
|
-
export var WebView = reactifyWc('taro-web-view-core');
|
|
68
|
-
|
|
69
|
-
// 页面属性配置节点
|
|
70
|
-
export var PageMeta = reactifyWc('taro-page-meta-core');
|
|
71
|
-
|
|
72
|
-
// 其他
|
|
73
|
-
export var Block = Fragment;
|
|
74
|
-
export var CustomWrapper = reactifyWc('taro-custom-wrapper-core');
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import reactifyWc from './reactify-wc';
|
|
4
|
-
var Input = reactifyWc('taro-input-core');
|
|
5
|
-
var h = React.createElement;
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line react/display-name
|
|
8
|
-
export default /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
9
|
-
var args = _objectSpread({}, props);
|
|
10
|
-
if (args.hasOwnProperty('focus')) {
|
|
11
|
-
args.autoFocus = Boolean(args.focus);
|
|
12
|
-
delete args.focus;
|
|
13
|
-
}
|
|
14
|
-
return h(Input, _objectSpread(_objectSpread({}, args), {}, {
|
|
15
|
-
ref: ref
|
|
16
|
-
}));
|
|
17
|
-
});
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
4
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
-
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
9
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
10
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
11
|
-
/**
|
|
12
|
-
* https://github.com/BBKolton/reactify-wc/
|
|
13
|
-
* modified event naming
|
|
14
|
-
**/
|
|
15
|
-
import React, { createElement, createRef } from 'react';
|
|
16
|
-
var h = React.createElement;
|
|
17
|
-
var SCROLL_VIEW = 'taro-scroll-view-core';
|
|
18
|
-
var IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
|
|
19
|
-
|
|
20
|
-
// 为了不要覆盖 wc 中 host 内置的 class 和 stencil 加入的 class
|
|
21
|
-
function getClassName(wc, prevProps, props) {
|
|
22
|
-
var classList = Array.from(wc.classList);
|
|
23
|
-
var oldClassNames = (prevProps.className || prevProps.class || '').split(' ');
|
|
24
|
-
var incomingClassNames = (props.className || props.class || '').split(' ');
|
|
25
|
-
var finalClassNames = [];
|
|
26
|
-
classList.forEach(function (classname) {
|
|
27
|
-
if (incomingClassNames.indexOf(classname) > -1) {
|
|
28
|
-
finalClassNames.push(classname);
|
|
29
|
-
incomingClassNames = incomingClassNames.filter(function (name) {
|
|
30
|
-
return name !== classname;
|
|
31
|
-
});
|
|
32
|
-
} else if (oldClassNames.indexOf(classname) === -1) {
|
|
33
|
-
finalClassNames.push(classname);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
finalClassNames = [].concat(_toConsumableArray(finalClassNames), _toConsumableArray(incomingClassNames));
|
|
37
|
-
return finalClassNames.join(' ');
|
|
38
|
-
}
|
|
39
|
-
function updateStyle(dom, key, val) {
|
|
40
|
-
if (/^--/.test(key)) {
|
|
41
|
-
// css variable
|
|
42
|
-
dom.style.setProperty(key, val);
|
|
43
|
-
} else if (typeof val !== 'number' || IS_NON_DIMENSIONAL.test(key)) {
|
|
44
|
-
dom.style[key] = val;
|
|
45
|
-
} else {
|
|
46
|
-
dom.style[key] = val + 'px';
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function updateProp(ctx, comp, propKey, prevProps, props) {
|
|
50
|
-
var dom = ctx.ref.current;
|
|
51
|
-
var val = props[propKey];
|
|
52
|
-
var prevVal = prevProps ? prevProps[propKey] : undefined;
|
|
53
|
-
if (propKey === 'children') {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (propKey.toLowerCase() === 'classname') {
|
|
57
|
-
dom.className = prevProps ? getClassName(dom, prevProps, props) : val;
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (propKey === 'style') {
|
|
61
|
-
if (typeof val === 'string') {
|
|
62
|
-
dom.setAttribute(propKey, val);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (!val) {
|
|
66
|
-
dom.removeAttribute(propKey);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (prevProps) {
|
|
70
|
-
if (typeof prevVal === 'string') {
|
|
71
|
-
dom.style.cssText = '';
|
|
72
|
-
} else {
|
|
73
|
-
for (var styleKey in prevVal) {
|
|
74
|
-
updateStyle(dom, styleKey, '');
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
for (var _styleKey in val) {
|
|
79
|
-
updateStyle(dom, _styleKey, val[_styleKey]);
|
|
80
|
-
}
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (/^data-.+/.test(propKey)) {
|
|
84
|
-
dom.setAttribute(propKey, val);
|
|
85
|
-
}
|
|
86
|
-
if (comp === SCROLL_VIEW) {
|
|
87
|
-
if (propKey === 'scrollTop') {
|
|
88
|
-
dom.mpScrollTop = val;
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (propKey === 'scrollLeft') {
|
|
92
|
-
dom.mpScrollLeft = val;
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (propKey === 'scrollIntoView') {
|
|
96
|
-
dom.mpScrollIntoView = val;
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (typeof val === 'function' && propKey.match(/^on[A-Z]/)) {
|
|
101
|
-
var event = propKey.substr(2).toLowerCase();
|
|
102
|
-
ctx.eventHandlers.push([event, val]);
|
|
103
|
-
return dom.addEventListener(event, val);
|
|
104
|
-
}
|
|
105
|
-
if (typeof val === 'string' || typeof val === 'number') {
|
|
106
|
-
dom.setAttribute(propKey, val);
|
|
107
|
-
dom[propKey] = val;
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
if (typeof val === 'boolean') {
|
|
111
|
-
if (val) {
|
|
112
|
-
dom[propKey] = true;
|
|
113
|
-
return dom.setAttribute(propKey, val);
|
|
114
|
-
}
|
|
115
|
-
dom[propKey] = false;
|
|
116
|
-
return dom.removeAttribute(propKey);
|
|
117
|
-
}
|
|
118
|
-
dom[propKey] = val;
|
|
119
|
-
}
|
|
120
|
-
var reactifyWebComponent = function reactifyWebComponent(WC) {
|
|
121
|
-
var Index = /*#__PURE__*/function (_React$Component) {
|
|
122
|
-
_inherits(Index, _React$Component);
|
|
123
|
-
var _super = _createSuper(Index);
|
|
124
|
-
function Index(props) {
|
|
125
|
-
var _this;
|
|
126
|
-
_classCallCheck(this, Index);
|
|
127
|
-
_this = _super.call(this, props);
|
|
128
|
-
_defineProperty(_assertThisInitialized(_this), "eventHandlers", void 0);
|
|
129
|
-
_defineProperty(_assertThisInitialized(_this), "ref", void 0);
|
|
130
|
-
_this.eventHandlers = [];
|
|
131
|
-
_this.ref = /*#__PURE__*/createRef();
|
|
132
|
-
return _this;
|
|
133
|
-
}
|
|
134
|
-
_createClass(Index, [{
|
|
135
|
-
key: "update",
|
|
136
|
-
value: function update(prevProps) {
|
|
137
|
-
var _this2 = this;
|
|
138
|
-
this.clearEventHandlers();
|
|
139
|
-
if (!this.ref.current) return;
|
|
140
|
-
Object.keys(prevProps || {}).forEach(function (key) {
|
|
141
|
-
if (key !== 'children' && key !== 'key' && !(key in _this2.props)) {
|
|
142
|
-
updateProp(_this2, WC, key, prevProps, _this2.props);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
Object.keys(this.props).forEach(function (key) {
|
|
146
|
-
updateProp(_this2, WC, key, prevProps, _this2.props);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}, {
|
|
150
|
-
key: "componentDidUpdate",
|
|
151
|
-
value: function componentDidUpdate(prevProps) {
|
|
152
|
-
this.update(prevProps);
|
|
153
|
-
}
|
|
154
|
-
}, {
|
|
155
|
-
key: "componentDidMount",
|
|
156
|
-
value: function componentDidMount() {
|
|
157
|
-
var forwardRef = this.props.forwardRef;
|
|
158
|
-
if (typeof forwardRef === 'function') {
|
|
159
|
-
forwardRef(this.ref.current);
|
|
160
|
-
} else if (forwardRef && _typeof(forwardRef) === 'object' && forwardRef.hasOwnProperty('current')) {
|
|
161
|
-
forwardRef.current = this.ref.current;
|
|
162
|
-
} else if (typeof forwardRef === 'string') {
|
|
163
|
-
console.warn('内置组件不支持字符串 ref');
|
|
164
|
-
}
|
|
165
|
-
this.update(undefined);
|
|
166
|
-
}
|
|
167
|
-
}, {
|
|
168
|
-
key: "componentWillUnmount",
|
|
169
|
-
value: function componentWillUnmount() {
|
|
170
|
-
this.clearEventHandlers();
|
|
171
|
-
}
|
|
172
|
-
}, {
|
|
173
|
-
key: "clearEventHandlers",
|
|
174
|
-
value: function clearEventHandlers() {
|
|
175
|
-
var _this3 = this;
|
|
176
|
-
this.eventHandlers.forEach(function (_ref) {
|
|
177
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
178
|
-
event = _ref2[0],
|
|
179
|
-
handler = _ref2[1];
|
|
180
|
-
if (!_this3.ref.current) return;
|
|
181
|
-
_this3.ref.current.removeEventListener(event, handler);
|
|
182
|
-
});
|
|
183
|
-
this.eventHandlers = [];
|
|
184
|
-
}
|
|
185
|
-
}, {
|
|
186
|
-
key: "render",
|
|
187
|
-
value: function render() {
|
|
188
|
-
var _this$props = this.props,
|
|
189
|
-
children = _this$props.children,
|
|
190
|
-
dangerouslySetInnerHTML = _this$props.dangerouslySetInnerHTML;
|
|
191
|
-
var props = {
|
|
192
|
-
ref: this.ref
|
|
193
|
-
};
|
|
194
|
-
if (dangerouslySetInnerHTML) props.dangerouslySetInnerHTML = dangerouslySetInnerHTML;
|
|
195
|
-
return /*#__PURE__*/createElement(WC, props, children);
|
|
196
|
-
}
|
|
197
|
-
}]);
|
|
198
|
-
return Index;
|
|
199
|
-
}(React.Component); // eslint-disable-next-line react/display-name
|
|
200
|
-
return /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
201
|
-
return h(Index, _objectSpread(_objectSpread({}, props), {}, {
|
|
202
|
-
forwardRef: ref
|
|
203
|
-
}));
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
export default reactifyWebComponent;
|
package/dist/react/components.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* tslint:disable */
|
|
3
|
-
/* auto-generated react proxies */
|
|
4
|
-
import { Fragment } from 'react';
|
|
5
|
-
import { manipulatePropsFunction } from './helper';
|
|
6
|
-
import { createReactComponent } from './react-component-lib';
|
|
7
|
-
export var Ad = /*@__PURE__*/createReactComponent('taro-ad-core', undefined, manipulatePropsFunction);
|
|
8
|
-
export var AdCustom = /*@__PURE__*/createReactComponent('taro-ad-custom-core', undefined, manipulatePropsFunction);
|
|
9
|
-
export var AnimationVideo = /*@__PURE__*/createReactComponent('taro-animation-video-core', undefined, manipulatePropsFunction);
|
|
10
|
-
export var AnimationView = /*@__PURE__*/createReactComponent('taro-animation-view-core', undefined, manipulatePropsFunction);
|
|
11
|
-
export var ArCamera = /*@__PURE__*/createReactComponent('taro-ar-camera-core', undefined, manipulatePropsFunction);
|
|
12
|
-
export var Audio = /*@__PURE__*/createReactComponent('taro-audio-core', undefined, manipulatePropsFunction);
|
|
13
|
-
export var AwemeData = /*@__PURE__*/createReactComponent('taro-aweme-data-core', undefined, manipulatePropsFunction);
|
|
14
|
-
export var Block = Fragment;
|
|
15
|
-
export var Button = /*@__PURE__*/createReactComponent('taro-button-core', undefined, manipulatePropsFunction);
|
|
16
|
-
export var Camera = /*@__PURE__*/createReactComponent('taro-camera-core', undefined, manipulatePropsFunction);
|
|
17
|
-
export var Canvas = /*@__PURE__*/createReactComponent('taro-canvas-core', undefined, manipulatePropsFunction);
|
|
18
|
-
export var Checkbox = /*@__PURE__*/createReactComponent('taro-checkbox-core', undefined, manipulatePropsFunction);
|
|
19
|
-
export var CheckboxGroup = /*@__PURE__*/createReactComponent('taro-checkbox-group-core', undefined, manipulatePropsFunction);
|
|
20
|
-
export var CommentDetail = /*@__PURE__*/createReactComponent('taro-comment-detail-core', undefined, manipulatePropsFunction);
|
|
21
|
-
export var CommentList = /*@__PURE__*/createReactComponent('taro-comment-list-core', undefined, manipulatePropsFunction);
|
|
22
|
-
export var ContactButton = /*@__PURE__*/createReactComponent('taro-contact-button-core', undefined, manipulatePropsFunction);
|
|
23
|
-
export var CoverImage = /*@__PURE__*/createReactComponent('taro-cover-image-core', undefined, manipulatePropsFunction);
|
|
24
|
-
export var CoverView = /*@__PURE__*/createReactComponent('taro-cover-view-core', undefined, manipulatePropsFunction);
|
|
25
|
-
export var CustomWrapper = Fragment;
|
|
26
|
-
export var Editor = /*@__PURE__*/createReactComponent('taro-editor-core', undefined, manipulatePropsFunction);
|
|
27
|
-
export var FollowSwan = /*@__PURE__*/createReactComponent('taro-follow-swan-core', undefined, manipulatePropsFunction);
|
|
28
|
-
export var Form = /*@__PURE__*/createReactComponent('taro-form-core', undefined, manipulatePropsFunction);
|
|
29
|
-
export var FunctionalPageNavigator = /*@__PURE__*/createReactComponent('taro-functional-page-navigator-core', undefined, manipulatePropsFunction);
|
|
30
|
-
export var Icon = /*@__PURE__*/createReactComponent('taro-icon-core', undefined, manipulatePropsFunction);
|
|
31
|
-
export var Image = /*@__PURE__*/createReactComponent('taro-image-core', undefined, manipulatePropsFunction);
|
|
32
|
-
export var InlinePaymentPanel = /*@__PURE__*/createReactComponent('taro-inline-payment-panel-core', undefined, manipulatePropsFunction);
|
|
33
|
-
export var Input = /*@__PURE__*/createReactComponent('taro-input-core', undefined, manipulatePropsFunction);
|
|
34
|
-
export var KeyboardAccessory = /*@__PURE__*/createReactComponent('taro-keyboard-accessory-core', undefined, manipulatePropsFunction);
|
|
35
|
-
export var Label = /*@__PURE__*/createReactComponent('taro-label-core', undefined, manipulatePropsFunction);
|
|
36
|
-
export var Lifestyle = /*@__PURE__*/createReactComponent('taro-lifestyle-core', undefined, manipulatePropsFunction);
|
|
37
|
-
export var Like = /*@__PURE__*/createReactComponent('taro-like-core', undefined, manipulatePropsFunction);
|
|
38
|
-
export var LivePlayer = /*@__PURE__*/createReactComponent('taro-live-player-core', undefined, manipulatePropsFunction);
|
|
39
|
-
export var LivePusher = /*@__PURE__*/createReactComponent('taro-live-pusher-core', undefined, manipulatePropsFunction);
|
|
40
|
-
export var Login = /*@__PURE__*/createReactComponent('taro-login-core', undefined, manipulatePropsFunction);
|
|
41
|
-
export var Lottie = /*@__PURE__*/createReactComponent('taro-lottie-core', undefined, manipulatePropsFunction);
|
|
42
|
-
export var Map = /*@__PURE__*/createReactComponent('taro-map-core', undefined, manipulatePropsFunction);
|
|
43
|
-
export var MatchMedia = /*@__PURE__*/createReactComponent('taro-match-media-core', undefined, manipulatePropsFunction);
|
|
44
|
-
export var MovableArea = /*@__PURE__*/createReactComponent('taro-movable-area-core', undefined, manipulatePropsFunction);
|
|
45
|
-
export var MovableView = /*@__PURE__*/createReactComponent('taro-movable-view-core', undefined, manipulatePropsFunction);
|
|
46
|
-
export var NativeSlot = /*@__PURE__*/createReactComponent('taro-native-slot-core', undefined, manipulatePropsFunction);
|
|
47
|
-
export var NavigationBar = /*@__PURE__*/createReactComponent('taro-navigation-bar-core', undefined, manipulatePropsFunction);
|
|
48
|
-
export var Navigator = /*@__PURE__*/createReactComponent('taro-navigator-core', undefined, manipulatePropsFunction);
|
|
49
|
-
export var OfficialAccount = /*@__PURE__*/createReactComponent('taro-official-account-core', undefined, manipulatePropsFunction);
|
|
50
|
-
export var OpenData = /*@__PURE__*/createReactComponent('taro-open-data-core', undefined, manipulatePropsFunction);
|
|
51
|
-
export var PageContainer = /*@__PURE__*/createReactComponent('taro-page-container-core', undefined, manipulatePropsFunction);
|
|
52
|
-
export var PageMeta = /*@__PURE__*/createReactComponent('taro-page-meta-core', undefined, manipulatePropsFunction);
|
|
53
|
-
export var Picker = /*@__PURE__*/createReactComponent('taro-picker-core', undefined, manipulatePropsFunction);
|
|
54
|
-
export var PickerGroup = /*@__PURE__*/createReactComponent('taro-picker-group', undefined, manipulatePropsFunction);
|
|
55
|
-
export var PickerViewColumn = /*@__PURE__*/createReactComponent('taro-picker-view-column-core', undefined, manipulatePropsFunction);
|
|
56
|
-
export var PickerView = /*@__PURE__*/createReactComponent('taro-picker-view-core', undefined, manipulatePropsFunction);
|
|
57
|
-
export var Progress = /*@__PURE__*/createReactComponent('taro-progress-core', undefined, manipulatePropsFunction);
|
|
58
|
-
export var PullToRefresh = /*@__PURE__*/createReactComponent('taro-pull-to-refresh', undefined, manipulatePropsFunction);
|
|
59
|
-
export var Radio = /*@__PURE__*/createReactComponent('taro-radio-core', undefined, manipulatePropsFunction);
|
|
60
|
-
export var RadioGroup = /*@__PURE__*/createReactComponent('taro-radio-group-core', undefined, manipulatePropsFunction);
|
|
61
|
-
export var RichText = /*@__PURE__*/createReactComponent('taro-rich-text-core', undefined, manipulatePropsFunction);
|
|
62
|
-
export var RootPortal = /*@__PURE__*/createReactComponent('taro-root-portal-core', undefined, manipulatePropsFunction);
|
|
63
|
-
export var RtcRoom = /*@__PURE__*/createReactComponent('taro-rtc-room-core', undefined, manipulatePropsFunction);
|
|
64
|
-
export var RtcRoomItem = /*@__PURE__*/createReactComponent('taro-rtc-room-item-core', undefined, manipulatePropsFunction);
|
|
65
|
-
export var ScrollView = /*@__PURE__*/createReactComponent('taro-scroll-view-core', undefined, manipulatePropsFunction);
|
|
66
|
-
export var ShareElement = /*@__PURE__*/createReactComponent('taro-share-element-core', undefined, manipulatePropsFunction);
|
|
67
|
-
export var Slider = /*@__PURE__*/createReactComponent('taro-slider-core', undefined, manipulatePropsFunction);
|
|
68
|
-
export var Slot = /*@__PURE__*/createReactComponent('taro-slot-core', undefined, manipulatePropsFunction);
|
|
69
|
-
export var Swiper = /*@__PURE__*/createReactComponent('taro-swiper-core', undefined, manipulatePropsFunction);
|
|
70
|
-
export var SwiperItem = /*@__PURE__*/createReactComponent('taro-swiper-item-core', undefined, manipulatePropsFunction);
|
|
71
|
-
export var Switch = /*@__PURE__*/createReactComponent('taro-switch-core', undefined, manipulatePropsFunction);
|
|
72
|
-
export var TabItem = /*@__PURE__*/createReactComponent('taro-tab-item-core', undefined, manipulatePropsFunction);
|
|
73
|
-
export var Tabbar = /*@__PURE__*/createReactComponent('taro-tabbar', undefined, manipulatePropsFunction);
|
|
74
|
-
export var Tabs = /*@__PURE__*/createReactComponent('taro-tabs-core', undefined, manipulatePropsFunction);
|
|
75
|
-
export var Text = /*@__PURE__*/createReactComponent('taro-text-core', undefined, manipulatePropsFunction);
|
|
76
|
-
export var Textarea = /*@__PURE__*/createReactComponent('taro-textarea-core', undefined, manipulatePropsFunction);
|
|
77
|
-
export var VideoControl = /*@__PURE__*/createReactComponent('taro-video-control', undefined, manipulatePropsFunction);
|
|
78
|
-
export var Video = /*@__PURE__*/createReactComponent('taro-video-core', undefined, manipulatePropsFunction);
|
|
79
|
-
export var VideoDanmu = /*@__PURE__*/createReactComponent('taro-video-danmu', undefined, manipulatePropsFunction);
|
|
80
|
-
export var View = /*@__PURE__*/createReactComponent('taro-view-core', undefined, manipulatePropsFunction);
|
|
81
|
-
export var VoipRoom = /*@__PURE__*/createReactComponent('taro-voip-room-core', undefined, manipulatePropsFunction);
|
|
82
|
-
export var WebView = /*@__PURE__*/createReactComponent('taro-web-view-core', undefined, manipulatePropsFunction);
|
package/dist/react/helper.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
export var manipulatePropsFunction = function manipulatePropsFunction(originalProps) {
|
|
3
|
-
var propsToPass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4
|
-
var dangerouslySetInnerHTML = originalProps.dangerouslySetInnerHTML;
|
|
5
|
-
return _objectSpread(_objectSpread({}, propsToPass), {}, {
|
|
6
|
-
dangerouslySetInnerHTML: dangerouslySetInnerHTML
|
|
7
|
-
});
|
|
8
|
-
};
|
package/dist/react/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components';
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
-
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
9
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
10
|
-
var _excluded = ["children", "forwardedRef", "style", "className", "ref"];
|
|
11
|
-
import React, { createElement } from 'react';
|
|
12
|
-
import { attachProps, camelToDashCase, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs } from './utils';
|
|
13
|
-
export var createReactComponent = function createReactComponent(tagName, ReactComponentContext, manipulatePropsFunction, defineCustomElement) {
|
|
14
|
-
if (defineCustomElement !== undefined) {
|
|
15
|
-
defineCustomElement();
|
|
16
|
-
}
|
|
17
|
-
var displayName = dashToPascalCase(tagName);
|
|
18
|
-
var ReactComponent = /*#__PURE__*/function (_React$Component) {
|
|
19
|
-
_inherits(ReactComponent, _React$Component);
|
|
20
|
-
var _super = _createSuper(ReactComponent);
|
|
21
|
-
function ReactComponent(props) {
|
|
22
|
-
var _this;
|
|
23
|
-
_classCallCheck(this, ReactComponent);
|
|
24
|
-
_this = _super.call(this, props);
|
|
25
|
-
_defineProperty(_assertThisInitialized(_this), "componentEl", void 0);
|
|
26
|
-
_defineProperty(_assertThisInitialized(_this), "setComponentElRef", function (element) {
|
|
27
|
-
_this.componentEl = element;
|
|
28
|
-
});
|
|
29
|
-
return _this;
|
|
30
|
-
}
|
|
31
|
-
_createClass(ReactComponent, [{
|
|
32
|
-
key: "componentDidMount",
|
|
33
|
-
value: function componentDidMount() {
|
|
34
|
-
this.componentDidUpdate(this.props);
|
|
35
|
-
}
|
|
36
|
-
}, {
|
|
37
|
-
key: "componentDidUpdate",
|
|
38
|
-
value: function componentDidUpdate(prevProps) {
|
|
39
|
-
attachProps(this.componentEl, this.props, prevProps);
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
42
|
-
key: "render",
|
|
43
|
-
value: function render() {
|
|
44
|
-
var _this$props = this.props,
|
|
45
|
-
children = _this$props.children,
|
|
46
|
-
forwardedRef = _this$props.forwardedRef,
|
|
47
|
-
style = _this$props.style,
|
|
48
|
-
className = _this$props.className,
|
|
49
|
-
ref = _this$props.ref,
|
|
50
|
-
cProps = _objectWithoutProperties(_this$props, _excluded);
|
|
51
|
-
var propsToPass = Object.keys(cProps).reduce(function (acc, name) {
|
|
52
|
-
var value = cProps[name];
|
|
53
|
-
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
54
|
-
var eventName = name.substring(2).toLowerCase();
|
|
55
|
-
if (typeof document !== 'undefined' && isCoveredByReact(eventName)) {
|
|
56
|
-
acc[name] = value;
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
// we should only render strings, booleans, and numbers as attrs in html.
|
|
60
|
-
// objects, functions, arrays etc get synced via properties on mount.
|
|
61
|
-
var type = _typeof(value);
|
|
62
|
-
if (type === 'string' || type === 'boolean' || type === 'number') {
|
|
63
|
-
acc[camelToDashCase(name)] = value;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return acc;
|
|
67
|
-
}, {});
|
|
68
|
-
if (manipulatePropsFunction) {
|
|
69
|
-
propsToPass = manipulatePropsFunction(this.props, propsToPass);
|
|
70
|
-
}
|
|
71
|
-
var newProps = _objectSpread(_objectSpread({}, propsToPass), {}, {
|
|
72
|
-
ref: mergeRefs(forwardedRef, this.setComponentElRef),
|
|
73
|
-
style: style
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* We use createElement here instead of
|
|
78
|
-
* React.createElement to work around a
|
|
79
|
-
* bug in Vite (https://github.com/vitejs/vite/issues/6104).
|
|
80
|
-
* React.createElement causes all elements to be rendered
|
|
81
|
-
* as <tagname> instead of the actual Web Component.
|
|
82
|
-
*/
|
|
83
|
-
return /*#__PURE__*/createElement(tagName, newProps, children);
|
|
84
|
-
}
|
|
85
|
-
}], [{
|
|
86
|
-
key: "displayName",
|
|
87
|
-
get: function get() {
|
|
88
|
-
return displayName;
|
|
89
|
-
}
|
|
90
|
-
}]);
|
|
91
|
-
return ReactComponent;
|
|
92
|
-
}(React.Component);
|
|
93
|
-
|
|
94
|
-
// If context was passed to createReactComponent then conditionally add it to the Component Class
|
|
95
|
-
if (ReactComponentContext) {
|
|
96
|
-
ReactComponent.contextType = ReactComponentContext;
|
|
97
|
-
}
|
|
98
|
-
return createForwardRef(ReactComponent, displayName);
|
|
99
|
-
};
|