vite-plugin-taro-runtime 0.7.0 → 0.7.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -28
- package/dist/api/dist/env.d.ts +15 -0
- package/dist/api/dist/env.js +58 -0
- package/dist/api/dist/env.js.map +1 -0
- package/dist/api/dist/index.d.ts +2 -0
- package/dist/api/dist/index.js +28 -0
- package/dist/api/dist/index.js.map +1 -0
- package/dist/api/dist/interceptor/chain.d.ts +16 -0
- package/dist/api/dist/interceptor/chain.js +30 -0
- package/dist/api/dist/interceptor/chain.js.map +1 -0
- package/dist/api/dist/interceptor/index.d.ts +11 -0
- package/dist/api/dist/interceptor/index.js +30 -0
- package/dist/api/dist/interceptor/index.js.map +1 -0
- package/dist/api/dist/interceptor/interceptors.d.ts +3 -0
- package/dist/api/dist/interceptor/interceptors.js +48 -0
- package/dist/api/dist/interceptor/interceptors.js.map +1 -0
- package/dist/api/dist/tools.d.ts +4 -0
- package/dist/api/dist/tools.js +67 -0
- package/dist/api/dist/tools.js.map +1 -0
- package/dist/components/dist/components/helper.js +24 -0
- package/dist/components/dist/components/index.d.ts +130 -0
- package/dist/components/dist/components/index.js +103 -0
- package/dist/components/dist/components/index2.js +89 -0
- package/dist/components/dist/components/index3.js +39 -0
- package/dist/components/dist/components/picker-group.js +218 -0
- package/dist/components/dist/components/taro-ad-core.d.ts +11 -0
- package/dist/components/dist/components/taro-ad-core.js +33 -0
- package/dist/components/dist/components/taro-ad-custom-core.d.ts +11 -0
- package/dist/components/dist/components/taro-ad-custom-core.js +33 -0
- package/dist/components/dist/components/taro-animation-video-core.d.ts +11 -0
- package/dist/components/dist/components/taro-animation-video-core.js +33 -0
- package/dist/components/dist/components/taro-animation-view-core.d.ts +11 -0
- package/dist/components/dist/components/taro-animation-view-core.js +33 -0
- package/dist/components/dist/components/taro-ar-camera-core.d.ts +11 -0
- package/dist/components/dist/components/taro-ar-camera-core.js +33 -0
- package/dist/components/dist/components/taro-audio-core.d.ts +11 -0
- package/dist/components/dist/components/taro-audio-core.js +78 -0
- package/dist/components/dist/components/taro-aweme-data-core.d.ts +11 -0
- package/dist/components/dist/components/taro-aweme-data-core.js +33 -0
- package/dist/components/dist/components/taro-block-core.d.ts +11 -0
- package/dist/components/dist/components/taro-block-core.js +29 -0
- package/dist/components/dist/components/taro-button-core.d.ts +11 -0
- package/dist/components/dist/components/taro-button-core.js +100 -0
- package/dist/components/dist/components/taro-camera-core.d.ts +11 -0
- package/dist/components/dist/components/taro-camera-core.js +33 -0
- package/dist/components/dist/components/taro-canvas-core.d.ts +11 -0
- package/dist/components/dist/components/taro-canvas-core.js +69 -0
- package/dist/components/dist/components/taro-channel-live-core.d.ts +11 -0
- package/dist/components/dist/components/taro-channel-live-core.js +33 -0
- package/dist/components/dist/components/taro-channel-video-core.d.ts +11 -0
- package/dist/components/dist/components/taro-channel-video-core.js +33 -0
- package/dist/components/dist/components/taro-checkbox-core.d.ts +11 -0
- package/dist/components/dist/components/taro-checkbox-core.js +79 -0
- package/dist/components/dist/components/taro-checkbox-group-core.d.ts +11 -0
- package/dist/components/dist/components/taro-checkbox-group-core.js +88 -0
- package/dist/components/dist/components/taro-comment-detail-core.d.ts +11 -0
- package/dist/components/dist/components/taro-comment-detail-core.js +33 -0
- package/dist/components/dist/components/taro-comment-list-core.d.ts +11 -0
- package/dist/components/dist/components/taro-comment-list-core.js +33 -0
- package/dist/components/dist/components/taro-contact-button-core.d.ts +11 -0
- package/dist/components/dist/components/taro-contact-button-core.js +33 -0
- package/dist/components/dist/components/taro-cover-image-core.d.ts +11 -0
- package/dist/components/dist/components/taro-cover-image-core.js +50 -0
- package/dist/components/dist/components/taro-cover-view-core.d.ts +11 -0
- package/dist/components/dist/components/taro-cover-view-core.js +87 -0
- package/dist/components/dist/components/taro-custom-wrapper-core.d.ts +11 -0
- package/dist/components/dist/components/taro-custom-wrapper-core.js +29 -0
- package/dist/components/dist/components/taro-double-tap-gesture-handler-core.d.ts +11 -0
- package/dist/components/dist/components/taro-double-tap-gesture-handler-core.js +33 -0
- package/dist/components/dist/components/taro-draggable-sheet-core.d.ts +11 -0
- package/dist/components/dist/components/taro-draggable-sheet-core.js +33 -0
- package/dist/components/dist/components/taro-editor-core.d.ts +11 -0
- package/dist/components/dist/components/taro-editor-core.js +33 -0
- package/dist/components/dist/components/taro-follow-swan-core.d.ts +11 -0
- package/dist/components/dist/components/taro-follow-swan-core.js +33 -0
- package/dist/components/dist/components/taro-force-press-gesture-handler-core.d.ts +11 -0
- package/dist/components/dist/components/taro-force-press-gesture-handler-core.js +33 -0
- package/dist/components/dist/components/taro-form-core.d.ts +11 -0
- package/dist/components/dist/components/taro-form-core.js +156 -0
- package/dist/components/dist/components/taro-functional-page-navigator-core.d.ts +11 -0
- package/dist/components/dist/components/taro-functional-page-navigator-core.js +33 -0
- package/dist/components/dist/components/taro-grid-builder-core.d.ts +11 -0
- package/dist/components/dist/components/taro-grid-builder-core.js +33 -0
- package/dist/components/dist/components/taro-grid-view-core.d.ts +11 -0
- package/dist/components/dist/components/taro-grid-view-core.js +33 -0
- package/dist/components/dist/components/taro-horizontal-drag-gesture-handler-core.d.ts +11 -0
- package/dist/components/dist/components/taro-horizontal-drag-gesture-handler-core.js +33 -0
- package/dist/components/dist/components/taro-icon-core.d.ts +11 -0
- package/dist/components/dist/components/taro-icon-core.js +49 -0
- package/dist/components/dist/components/taro-image-core.d.ts +11 -0
- package/dist/components/dist/components/taro-image-core.js +82 -0
- package/dist/components/dist/components/taro-inline-payment-panel-core.d.ts +11 -0
- package/dist/components/dist/components/taro-inline-payment-panel-core.js +33 -0
- package/dist/components/dist/components/taro-input-core.d.ts +11 -0
- package/dist/components/dist/components/taro-input-core.js +241 -0
- package/dist/components/dist/components/taro-keyboard-accessory-core.d.ts +11 -0
- package/dist/components/dist/components/taro-keyboard-accessory-core.js +33 -0
- package/dist/components/dist/components/taro-label-core.d.ts +11 -0
- package/dist/components/dist/components/taro-label-core.js +32 -0
- package/dist/components/dist/components/taro-lifestyle-core.d.ts +11 -0
- package/dist/components/dist/components/taro-lifestyle-core.js +33 -0
- package/dist/components/dist/components/taro-like-core.d.ts +11 -0
- package/dist/components/dist/components/taro-like-core.js +33 -0
- package/dist/components/dist/components/taro-list-builder-core.d.ts +11 -0
- package/dist/components/dist/components/taro-list-builder-core.js +33 -0
- package/dist/components/dist/components/taro-list-view-core.d.ts +11 -0
- package/dist/components/dist/components/taro-list-view-core.js +33 -0
- package/dist/components/dist/components/taro-live-player-core.d.ts +11 -0
- package/dist/components/dist/components/taro-live-player-core.js +33 -0
- package/dist/components/dist/components/taro-live-pusher-core.d.ts +11 -0
- package/dist/components/dist/components/taro-live-pusher-core.js +33 -0
- package/dist/components/dist/components/taro-login-core.d.ts +11 -0
- package/dist/components/dist/components/taro-login-core.js +33 -0
- package/dist/components/dist/components/taro-long-press-gesture-handler-core.d.ts +11 -0
- package/dist/components/dist/components/taro-long-press-gesture-handler-core.js +33 -0
- package/dist/components/dist/components/taro-lottie-core.d.ts +11 -0
- package/dist/components/dist/components/taro-lottie-core.js +33 -0
- package/dist/components/dist/components/taro-map-core.d.ts +11 -0
- package/dist/components/dist/components/taro-map-core.js +1376 -0
- package/dist/components/dist/components/taro-match-media-core.d.ts +11 -0
- package/dist/components/dist/components/taro-match-media-core.js +33 -0
- package/dist/components/dist/components/taro-movable-area-core.d.ts +11 -0
- package/dist/components/dist/components/taro-movable-area-core.js +174 -0
- package/dist/components/dist/components/taro-movable-view-core.d.ts +11 -0
- package/dist/components/dist/components/taro-movable-view-core.js +361 -0
- package/dist/components/dist/components/taro-native-slot-core.d.ts +11 -0
- package/dist/components/dist/components/taro-native-slot-core.js +33 -0
- package/dist/components/dist/components/taro-navigation-bar-core.d.ts +11 -0
- package/dist/components/dist/components/taro-navigation-bar-core.js +33 -0
- package/dist/components/dist/components/taro-navigator-core.d.ts +11 -0
- package/dist/components/dist/components/taro-navigator-core.js +94 -0
- package/dist/components/dist/components/taro-nested-scroll-body-core.d.ts +11 -0
- package/dist/components/dist/components/taro-nested-scroll-body-core.js +33 -0
- package/dist/components/dist/components/taro-nested-scroll-header-core.d.ts +11 -0
- package/dist/components/dist/components/taro-nested-scroll-header-core.js +33 -0
- package/dist/components/dist/components/taro-official-account-core.d.ts +11 -0
- package/dist/components/dist/components/taro-official-account-core.js +33 -0
- package/dist/components/dist/components/taro-open-container-core.d.ts +11 -0
- package/dist/components/dist/components/taro-open-container-core.js +33 -0
- package/dist/components/dist/components/taro-open-data-core.d.ts +11 -0
- package/dist/components/dist/components/taro-open-data-core.js +33 -0
- package/dist/components/dist/components/taro-open-embedded-atomicservice-core.d.ts +11 -0
- package/dist/components/dist/components/taro-open-embedded-atomicservice-core.js +33 -0
- package/dist/components/dist/components/taro-page-container-core.d.ts +11 -0
- package/dist/components/dist/components/taro-page-container-core.js +33 -0
- package/dist/components/dist/components/taro-page-meta-core.d.ts +11 -0
- package/dist/components/dist/components/taro-page-meta-core.js +33 -0
- package/dist/components/dist/components/taro-pan-gesture-handler-core.d.ts +11 -0
- package/dist/components/dist/components/taro-pan-gesture-handler-core.js +33 -0
- package/dist/components/dist/components/taro-picker-core.d.ts +11 -0
- package/dist/components/dist/components/taro-picker-core.js +540 -0
- package/dist/components/dist/components/taro-picker-group.d.ts +11 -0
- package/dist/components/dist/components/taro-picker-group.js +6 -0
- package/dist/components/dist/components/taro-picker-view-column-core.d.ts +11 -0
- package/dist/components/dist/components/taro-picker-view-column-core.js +103 -0
- package/dist/components/dist/components/taro-picker-view-core.d.ts +11 -0
- package/dist/components/dist/components/taro-picker-view-core.js +121 -0
- package/dist/components/dist/components/taro-progress-core.d.ts +11 -0
- package/dist/components/dist/components/taro-progress-core.js +63 -0
- package/dist/components/dist/components/taro-pull-to-refresh-core.d.ts +11 -0
- package/dist/components/dist/components/taro-pull-to-refresh-core.js +287 -0
- package/dist/components/dist/components/taro-radio-core.d.ts +11 -0
- package/dist/components/dist/components/taro-radio-core.js +81 -0
- package/dist/components/dist/components/taro-radio-group-core.d.ts +11 -0
- package/dist/components/dist/components/taro-radio-group-core.js +99 -0
- package/dist/components/dist/components/taro-rich-text-core.d.ts +11 -0
- package/dist/components/dist/components/taro-rich-text-core.js +93 -0
- package/dist/components/dist/components/taro-root-portal-core.d.ts +11 -0
- package/dist/components/dist/components/taro-root-portal-core.js +33 -0
- package/dist/components/dist/components/taro-rtc-room-core.d.ts +11 -0
- package/dist/components/dist/components/taro-rtc-room-core.js +33 -0
- package/dist/components/dist/components/taro-rtc-room-item-core.d.ts +11 -0
- package/dist/components/dist/components/taro-rtc-room-item-core.js +33 -0
- package/dist/components/dist/components/taro-scale-gesture-handler-core.d.ts +11 -0
- package/dist/components/dist/components/taro-scale-gesture-handler-core.js +33 -0
- package/dist/components/dist/components/taro-script-core.d.ts +11 -0
- package/dist/components/dist/components/taro-script-core.js +33 -0
- package/dist/components/dist/components/taro-scroll-view-core.d.ts +11 -0
- package/dist/components/dist/components/taro-scroll-view-core.js +199 -0
- package/dist/components/dist/components/taro-share-element-core.d.ts +11 -0
- package/dist/components/dist/components/taro-share-element-core.js +33 -0
- package/dist/components/dist/components/taro-slider-core.d.ts +11 -0
- package/dist/components/dist/components/taro-slider-core.js +197 -0
- package/dist/components/dist/components/taro-slot-core.d.ts +11 -0
- package/dist/components/dist/components/taro-slot-core.js +33 -0
- package/dist/components/dist/components/taro-snapshot-core.d.ts +11 -0
- package/dist/components/dist/components/taro-snapshot-core.js +33 -0
- package/dist/components/dist/components/taro-span-core.d.ts +11 -0
- package/dist/components/dist/components/taro-span-core.js +33 -0
- package/dist/components/dist/components/taro-sticky-header-core.d.ts +11 -0
- package/dist/components/dist/components/taro-sticky-header-core.js +33 -0
- package/dist/components/dist/components/taro-sticky-section-core.d.ts +11 -0
- package/dist/components/dist/components/taro-sticky-section-core.js +33 -0
- package/dist/components/dist/components/taro-swiper-core.d.ts +11 -0
- package/dist/components/dist/components/taro-swiper-core.js +438 -0
- package/dist/components/dist/components/taro-swiper-item-core.d.ts +11 -0
- package/dist/components/dist/components/taro-swiper-item-core.js +42 -0
- package/dist/components/dist/components/taro-switch-core.d.ts +11 -0
- package/dist/components/dist/components/taro-switch-core.js +85 -0
- package/dist/components/dist/components/taro-tab-item-core.d.ts +11 -0
- package/dist/components/dist/components/taro-tab-item-core.js +33 -0
- package/dist/components/dist/components/taro-tabbar.d.ts +11 -0
- package/dist/components/dist/components/taro-tabbar.js +371 -0
- package/dist/components/dist/components/taro-tabs-core.d.ts +11 -0
- package/dist/components/dist/components/taro-tabs-core.js +33 -0
- package/dist/components/dist/components/taro-tap-gesture-handler-core.d.ts +11 -0
- package/dist/components/dist/components/taro-tap-gesture-handler-core.js +33 -0
- package/dist/components/dist/components/taro-text-core.d.ts +11 -0
- package/dist/components/dist/components/taro-text-core.js +45 -0
- package/dist/components/dist/components/taro-textarea-core.d.ts +11 -0
- package/dist/components/dist/components/taro-textarea-core.js +285 -0
- package/dist/components/dist/components/taro-vertical-drag-gesture-handler-core.d.ts +11 -0
- package/dist/components/dist/components/taro-vertical-drag-gesture-handler-core.js +33 -0
- package/dist/components/dist/components/taro-video-control.d.ts +11 -0
- package/dist/components/dist/components/taro-video-control.js +6 -0
- package/dist/components/dist/components/taro-video-core.d.ts +11 -0
- package/dist/components/dist/components/taro-video-core.js +500 -0
- package/dist/components/dist/components/taro-video-danmu.d.ts +11 -0
- package/dist/components/dist/components/taro-video-danmu.js +6 -0
- package/dist/components/dist/components/taro-view-core.d.ts +11 -0
- package/dist/components/dist/components/taro-view-core.js +92 -0
- package/dist/components/dist/components/taro-voip-room-core.d.ts +11 -0
- package/dist/components/dist/components/taro-voip-room-core.js +33 -0
- package/dist/components/dist/components/taro-web-view-core.d.ts +11 -0
- package/dist/components/dist/components/taro-web-view-core.js +44 -0
- package/dist/components/dist/components/video-control.js +240 -0
- package/dist/components/dist/components/video-danmu.js +108 -0
- package/dist/components/dist/taro-components/taro-components.css +1 -0
- package/dist/components/global.css +1 -0
- package/dist/components/lib/react/component-lib/index.d.ts +54 -0
- package/dist/components/lib/react/component-lib/index.js +68 -0
- package/dist/components/lib/react/component-lib/index.js.map +1 -0
- package/dist/components/lib/react/component-lib/input.d.ts +3 -0
- package/dist/components/lib/react/component-lib/input.js +17 -0
- package/dist/components/lib/react/component-lib/input.js.map +1 -0
- package/dist/components/lib/react/component-lib/reactify-wc.d.ts +7 -0
- package/dist/components/lib/react/component-lib/reactify-wc.js +176 -0
- package/dist/components/lib/react/component-lib/reactify-wc.js.map +1 -0
- package/dist/components/lib/react/components.d.ts +103 -0
- package/dist/components/lib/react/components.js +112 -0
- package/dist/components/lib/react/components.js.map +1 -0
- package/dist/components/lib/react/helper.d.ts +10 -0
- package/dist/components/lib/react/helper.js +10 -0
- package/dist/components/lib/react/helper.js.map +1 -0
- package/dist/components/lib/react/index.d.ts +1 -0
- package/dist/components/lib/react/index.js +2 -0
- package/dist/components/lib/react/index.js.map +1 -0
- package/dist/components/lib/react/node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.39.0_tslib@2.8.1_typescript@5.4.5/node_modules/tslib/tslib.es6.js +405 -0
- package/dist/components/lib/react/node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.39.0_tslib@2.8.1_typescript@5.4.5/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/components/lib/react/react-component-lib/createComponent.d.ts +14 -0
- package/dist/components/lib/react/react-component-lib/createComponent.js +73 -0
- package/dist/components/lib/react/react-component-lib/createComponent.js.map +1 -0
- package/dist/components/lib/react/react-component-lib/createOverlayComponent.d.ts +25 -0
- package/dist/components/lib/react/react-component-lib/createOverlayComponent.js +94 -0
- package/dist/components/lib/react/react-component-lib/createOverlayComponent.js.map +1 -0
- package/dist/components/lib/react/react-component-lib/index.d.ts +2 -0
- package/dist/components/lib/react/react-component-lib/index.js +3 -0
- package/dist/components/lib/react/react-component-lib/index.js.map +1 -0
- package/dist/components/lib/react/react-component-lib/interfaces.d.ts +33 -0
- package/dist/components/lib/react/react-component-lib/utils/attachProps.d.ts +18 -0
- package/dist/components/lib/react/react-component-lib/utils/attachProps.js +182 -0
- package/dist/components/lib/react/react-component-lib/utils/attachProps.js.map +1 -0
- package/dist/components/lib/react/react-component-lib/utils/case.d.ts +6 -0
- package/dist/components/lib/react/react-component-lib/utils/case.js +13 -0
- package/dist/components/lib/react/react-component-lib/utils/case.js.map +1 -0
- package/dist/components/lib/react/react-component-lib/utils/dev.d.ts +6 -0
- package/dist/components/lib/react/react-component-lib/utils/index.d.ts +14 -0
- package/dist/components/lib/react/react-component-lib/utils/index.js +39 -0
- package/dist/components/lib/react/react-component-lib/utils/index.js.map +1 -0
- package/dist/components/types/Ad.d.ts +205 -0
- package/dist/components/types/AdCustom.d.ts +44 -0
- package/dist/components/types/AnimationVideo.d.ts +53 -0
- package/dist/components/types/AnimationView.d.ts +39 -0
- package/dist/components/types/ArCamera.d.ts +43 -0
- package/dist/components/types/Audio.d.ts +135 -0
- package/dist/components/types/AwemeData.d.ts +37 -0
- package/dist/components/types/Block.d.ts +9 -0
- package/dist/components/types/Button.d.ts +740 -0
- package/dist/components/types/Camera.d.ts +128 -0
- package/dist/components/types/Canvas.d.ts +98 -0
- package/dist/components/types/ChannelLive.d.ts +20 -0
- package/dist/components/types/ChannelVideo.d.ts +48 -0
- package/dist/components/types/Checkbox.d.ts +167 -0
- package/dist/components/types/CheckboxGroup.d.ts +81 -0
- package/dist/components/types/CommentDetail.d.ts +66 -0
- package/dist/components/types/CommentList.d.ts +112 -0
- package/dist/components/types/ContactButton.d.ts +46 -0
- package/dist/components/types/CoverImage.d.ts +151 -0
- package/dist/components/types/CoverView.d.ts +219 -0
- package/dist/components/types/CustomWrapper.d.ts +31 -0
- package/dist/components/types/DraggableSheet.d.ts +52 -0
- package/dist/components/types/Editor.d.ts +143 -0
- package/dist/components/types/FollowSwan.d.ts +25 -0
- package/dist/components/types/Form.d.ts +130 -0
- package/dist/components/types/FunctionalPageNavigator.d.ts +56 -0
- package/dist/components/types/GridBuilder.d.ts +72 -0
- package/dist/components/types/GridView.d.ts +51 -0
- package/dist/components/types/Icon.d.ts +97 -0
- package/dist/components/types/Image.d.ts +175 -0
- package/dist/components/types/InlinePaymentPanel.d.ts +49 -0
- package/dist/components/types/Input.d.ts +353 -0
- package/dist/components/types/KeyboardAccessory.d.ts +42 -0
- package/dist/components/types/Label.d.ts +52 -0
- package/dist/components/types/Lifestyle.d.ts +23 -0
- package/dist/components/types/Like.d.ts +90 -0
- package/dist/components/types/List.d.ts +38 -0
- package/dist/components/types/ListBuilder.d.ts +55 -0
- package/dist/components/types/ListItem.d.ts +6 -0
- package/dist/components/types/ListView.d.ts +19 -0
- package/dist/components/types/LivePlayer.d.ts +261 -0
- package/dist/components/types/LivePusher.d.ts +360 -0
- package/dist/components/types/Login.d.ts +40 -0
- package/dist/components/types/Lottie.d.ts +97 -0
- package/dist/components/types/Map.d.ts +732 -0
- package/dist/components/types/MatchMedia.d.ts +70 -0
- package/dist/components/types/MovableArea.d.ts +34 -0
- package/dist/components/types/MovableView.d.ts +180 -0
- package/dist/components/types/NativeSlot.d.ts +35 -0
- package/dist/components/types/NavigationBar.d.ts +44 -0
- package/dist/components/types/Navigator.d.ts +118 -0
- package/dist/components/types/NestedScrollBody.d.ts +15 -0
- package/dist/components/types/NestedScrollHeader.d.ts +15 -0
- package/dist/components/types/OfficialAccount.d.ts +58 -0
- package/dist/components/types/OpenContainer.d.ts +74 -0
- package/dist/components/types/OpenData.d.ts +98 -0
- package/dist/components/types/OpenEmbeddedAtomicservice.d.ts +52 -0
- package/dist/components/types/PageContainer.d.ts +110 -0
- package/dist/components/types/PageMeta.d.ts +133 -0
- package/dist/components/types/Picker.d.ts +452 -0
- package/dist/components/types/PickerView.d.ts +198 -0
- package/dist/components/types/PickerViewColumn.d.ts +12 -0
- package/dist/components/types/Progress.d.ts +105 -0
- package/dist/components/types/PullToRefresh.d.ts +26 -0
- package/dist/components/types/Radio.d.ts +187 -0
- package/dist/components/types/RadioGroup.d.ts +24 -0
- package/dist/components/types/RichText.d.ts +166 -0
- package/dist/components/types/RootPortal.d.ts +40 -0
- package/dist/components/types/RtcRoom.d.ts +88 -0
- package/dist/components/types/RtcRoomItem.d.ts +23 -0
- package/dist/components/types/Script.d.ts +37 -0
- package/dist/components/types/ScrollView.d.ts +510 -0
- package/dist/components/types/ShareElement.d.ts +270 -0
- package/dist/components/types/Slider.d.ts +145 -0
- package/dist/components/types/Slot.d.ts +42 -0
- package/dist/components/types/Snapshot.d.ts +25 -0
- package/dist/components/types/Span.d.ts +14 -0
- package/dist/components/types/StickyHeader.d.ts +31 -0
- package/dist/components/types/StickySection.d.ts +23 -0
- package/dist/components/types/Swiper.d.ts +339 -0
- package/dist/components/types/SwiperItem.d.ts +77 -0
- package/dist/components/types/Switch.d.ts +96 -0
- package/dist/components/types/TabItem.d.ts +31 -0
- package/dist/components/types/Tabs.d.ts +50 -0
- package/dist/components/types/Text.d.ts +146 -0
- package/dist/components/types/Textarea.d.ts +252 -0
- package/dist/components/types/Video.d.ts +604 -0
- package/dist/components/types/View.d.ts +183 -0
- package/dist/components/types/VoipRoom.d.ts +67 -0
- package/dist/components/types/WebView.d.ts +68 -0
- package/dist/components/types/common.d.ts +185 -0
- package/dist/components/types/event.d.ts +7 -0
- package/dist/components/types/gesture/DoubleTapGestureHandler.d.ts +53 -0
- package/dist/components/types/gesture/ForcePressGestureHandler.d.ts +49 -0
- package/dist/components/types/gesture/HorizontalDragGestureHandler.d.ts +53 -0
- package/dist/components/types/gesture/LongPressGestureHandler.d.ts +53 -0
- package/dist/components/types/gesture/PanGestureHandler.d.ts +53 -0
- package/dist/components/types/gesture/ScaleGestureHandler.d.ts +53 -0
- package/dist/components/types/gesture/TapGestureHandler.d.ts +53 -0
- package/dist/components/types/gesture/VerticalDragGestureHandler.d.ts +53 -0
- package/dist/components/types/global.d.ts +4 -0
- package/dist/components/types/index.d.ts +128 -0
- package/dist/components/types/index.solid.d.ts +301 -0
- package/dist/components/types/index.vue3.d.ts +337 -0
- package/dist/components/types/props.d.ts +72 -0
- package/dist/plugin-framework-react/runtime.js +1080 -0
- package/dist/plugin-framework-react/runtime.js.map +1 -0
- package/dist/plugin-platform-alipay/components-react.js +54 -0
- package/dist/plugin-platform-alipay/components-react.js.map +1 -0
- package/dist/plugin-platform-alipay/runtime-utils.js +854 -0
- package/dist/plugin-platform-alipay/runtime-utils.js.map +1 -0
- package/dist/plugin-platform-alipay/runtime.js +864 -0
- package/dist/plugin-platform-alipay/runtime.js.map +1 -0
- package/dist/plugin-platform-alipay/types/apis-list.d.ts +1 -0
- package/dist/plugin-platform-alipay/types/apis.d.ts +9 -0
- package/dist/plugin-platform-alipay/types/components-react.d.ts +10 -0
- package/dist/plugin-platform-alipay/types/components.d.ts +202 -0
- package/dist/plugin-platform-alipay/types/index.d.ts +5 -0
- package/dist/plugin-platform-alipay/types/program.d.ts +51 -0
- package/dist/plugin-platform-alipay/types/runtime-utils.d.ts +19 -0
- package/dist/plugin-platform-alipay/types/runtime.d.ts +1 -0
- package/dist/plugin-platform-alipay/types/template.d.ts +39 -0
- package/dist/plugin-platform-h5/definition.json +2481 -0
- package/dist/plugin-platform-h5/runtime/apis/index.d.ts +5 -0
- package/dist/plugin-platform-h5/runtime/apis/index.js +29 -0
- package/dist/plugin-platform-h5/runtime/apis/index.js.map +1 -0
- package/dist/plugin-platform-h5/runtime/apis/taro-h5.d.ts +1 -0
- package/dist/plugin-platform-h5/runtime/apis/taro-h5.js +2 -0
- package/dist/plugin-platform-h5/runtime/apis/taro-h5.js.map +1 -0
- package/dist/plugin-platform-h5/runtime/apis/taro.d.ts +2 -0
- package/dist/plugin-platform-h5/runtime/apis/taro.js +3 -0
- package/dist/plugin-platform-h5/runtime/apis/taro.js.map +1 -0
- package/dist/plugin-platform-weapp/components-react.js +81 -0
- package/dist/plugin-platform-weapp/components-react.js.map +1 -0
- package/dist/plugin-platform-weapp/runtime-utils.js +613 -0
- package/dist/plugin-platform-weapp/runtime-utils.js.map +1 -0
- package/dist/plugin-platform-weapp/runtime.js +614 -0
- package/dist/plugin-platform-weapp/runtime.js.map +1 -0
- package/dist/plugin-platform-weapp/types/apis-list.d.ts +1 -0
- package/dist/plugin-platform-weapp/types/apis.d.ts +1 -0
- package/dist/plugin-platform-weapp/types/components-react.d.ts +37 -0
- package/dist/plugin-platform-weapp/types/components.d.ts +503 -0
- package/dist/plugin-platform-weapp/types/index.d.ts +8 -0
- package/dist/plugin-platform-weapp/types/program.d.ts +35 -0
- package/dist/plugin-platform-weapp/types/runtime-utils.d.ts +13 -0
- package/dist/plugin-platform-weapp/types/runtime.d.ts +1 -0
- package/dist/plugin-platform-weapp/types/template.d.ts +25 -0
- package/dist/react/componentTree.d.ts +19 -0
- package/dist/react/constant.d.ts +7 -0
- package/dist/react/domInput.d.ts +12 -0
- package/dist/react/event.d.ts +13 -0
- package/dist/react/index.d.ts +33 -0
- package/dist/react/inputValueTracking.d.ts +3 -0
- package/dist/react/props.d.ts +5 -0
- package/dist/react/react.esm.js +1165 -0
- package/dist/react/react.esm.js.map +1 -0
- package/dist/react/reconciler.d.ts +4 -0
- package/dist/react/render.d.ts +25 -0
- package/dist/react/workTags.d.ts +26 -0
- package/dist/router/dist/api.d.ts +7 -0
- package/dist/router/dist/events/resize.d.ts +2 -0
- package/dist/router/dist/events/scroll.d.ts +2 -0
- package/dist/router/dist/history.d.ts +26 -0
- package/dist/router/dist/index.d.ts +9 -0
- package/dist/router/dist/index.esm.js +1755 -0
- package/dist/router/dist/navigationBar.d.ts +2 -0
- package/dist/router/dist/router/index.d.ts +11 -0
- package/dist/router/dist/router/mpa.d.ts +11 -0
- package/dist/router/dist/router/multi-page.d.ts +33 -0
- package/dist/router/dist/router/navigation-bar.d.ts +36 -0
- package/dist/router/dist/router/page.d.ts +53 -0
- package/dist/router/dist/router/spa.d.ts +4 -0
- package/dist/router/dist/router/stack.d.ts +26 -0
- package/dist/router/dist/style.d.ts +13 -0
- package/dist/router/dist/tabbar.d.ts +3 -0
- package/dist/router/dist/utils/index.d.ts +10 -0
- package/dist/router/dist/utils/navigate.d.ts +9 -0
- package/dist/router/types/api.d.ts +18 -0
- package/dist/router/types/component.d.ts +11 -0
- package/dist/router/types/history.d.ts +6 -0
- package/dist/router/types/router.d.ts +32 -0
- package/dist/router/types/taro.d.ts +8 -0
- package/dist/taro/index.js +9 -0
- package/dist/taro/package.json +76 -0
- package/dist/taro/types/api/ad/index.d.ts +197 -0
- package/dist/taro/types/api/ai/face.d.ts +133 -0
- package/dist/taro/types/api/ai/inference.d.ts +129 -0
- package/dist/taro/types/api/ai/visionkit.d.ts +874 -0
- package/dist/taro/types/api/alipay/index.d.ts +69 -0
- package/dist/taro/types/api/base/crypto.d.ts +104 -0
- package/dist/taro/types/api/base/debug.d.ts +329 -0
- package/dist/taro/types/api/base/env.d.ts +19 -0
- package/dist/taro/types/api/base/index.d.ts +102 -0
- package/dist/taro/types/api/base/performance.d.ts +258 -0
- package/dist/taro/types/api/base/system.d.ts +742 -0
- package/dist/taro/types/api/base/update.d.ts +130 -0
- package/dist/taro/types/api/base/weapp/app-event.d.ts +265 -0
- package/dist/taro/types/api/base/weapp/life-cycle.d.ts +155 -0
- package/dist/taro/types/api/canvas/index.d.ts +2162 -0
- package/dist/taro/types/api/cloud/index.d.ts +2622 -0
- package/dist/taro/types/api/data-analysis/index.d.ts +122 -0
- package/dist/taro/types/api/device/accelerometer.d.ts +102 -0
- package/dist/taro/types/api/device/accessibility.d.ts +26 -0
- package/dist/taro/types/api/device/battery.d.ts +46 -0
- package/dist/taro/types/api/device/bluetooth-ble.d.ts +601 -0
- package/dist/taro/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/dist/taro/types/api/device/bluetooth.d.ts +463 -0
- package/dist/taro/types/api/device/calendar.d.ts +98 -0
- package/dist/taro/types/api/device/clipboard.d.ts +81 -0
- package/dist/taro/types/api/device/compass.d.ts +105 -0
- package/dist/taro/types/api/device/contact.d.ts +110 -0
- package/dist/taro/types/api/device/gyroscope.d.ts +85 -0
- package/dist/taro/types/api/device/iBeacon.d.ts +168 -0
- package/dist/taro/types/api/device/keyboard.d.ts +97 -0
- package/dist/taro/types/api/device/memory.d.ts +52 -0
- package/dist/taro/types/api/device/motion.d.ts +88 -0
- package/dist/taro/types/api/device/network.d.ts +172 -0
- package/dist/taro/types/api/device/nfc.d.ts +1238 -0
- package/dist/taro/types/api/device/phone.d.ts +30 -0
- package/dist/taro/types/api/device/scan.d.ts +111 -0
- package/dist/taro/types/api/device/screen.d.ts +217 -0
- package/dist/taro/types/api/device/sms.d.ts +26 -0
- package/dist/taro/types/api/device/vibrate.d.ts +51 -0
- package/dist/taro/types/api/device/wifi.d.ts +301 -0
- package/dist/taro/types/api/ext/index.d.ts +64 -0
- package/dist/taro/types/api/files/index.d.ts +1472 -0
- package/dist/taro/types/api/framework/index.d.ts +51 -0
- package/dist/taro/types/api/location/index.d.ts +517 -0
- package/dist/taro/types/api/media/audio.d.ts +1013 -0
- package/dist/taro/types/api/media/background-audio.d.ts +291 -0
- package/dist/taro/types/api/media/camera.d.ts +207 -0
- package/dist/taro/types/api/media/editor.d.ts +239 -0
- package/dist/taro/types/api/media/image.d.ts +469 -0
- package/dist/taro/types/api/media/live.d.ts +461 -0
- package/dist/taro/types/api/media/map.d.ts +638 -0
- package/dist/taro/types/api/media/media-recorder.d.ts +117 -0
- package/dist/taro/types/api/media/recorder.d.ts +317 -0
- package/dist/taro/types/api/media/video-decoder.d.ts +117 -0
- package/dist/taro/types/api/media/video-processing.d.ts +84 -0
- package/dist/taro/types/api/media/video.d.ts +527 -0
- package/dist/taro/types/api/media/voip.d.ts +393 -0
- package/dist/taro/types/api/navigate/index.d.ts +327 -0
- package/dist/taro/types/api/network/download.d.ts +173 -0
- package/dist/taro/types/api/network/mdns.d.ts +191 -0
- package/dist/taro/types/api/network/request.d.ts +480 -0
- package/dist/taro/types/api/network/tcp.d.ts +181 -0
- package/dist/taro/types/api/network/udp.d.ts +218 -0
- package/dist/taro/types/api/network/upload.d.ts +201 -0
- package/dist/taro/types/api/network/websocket.d.ts +383 -0
- package/dist/taro/types/api/open-api/account.d.ts +51 -0
- package/dist/taro/types/api/open-api/address.d.ts +68 -0
- package/dist/taro/types/api/open-api/authorize.d.ts +80 -0
- package/dist/taro/types/api/open-api/card.d.ts +110 -0
- package/dist/taro/types/api/open-api/channels.d.ts +225 -0
- package/dist/taro/types/api/open-api/customer-service.d.ts +45 -0
- package/dist/taro/types/api/open-api/device-voip.d.ts +103 -0
- package/dist/taro/types/api/open-api/facial.d.ts +98 -0
- package/dist/taro/types/api/open-api/favorites.d.ts +101 -0
- package/dist/taro/types/api/open-api/group.d.ts +59 -0
- package/dist/taro/types/api/open-api/invoice.d.ts +87 -0
- package/dist/taro/types/api/open-api/license-plate.d.ts +27 -0
- package/dist/taro/types/api/open-api/login.d.ts +115 -0
- package/dist/taro/types/api/open-api/my-miniprogram.d.ts +28 -0
- package/dist/taro/types/api/open-api/privacy.d.ts +107 -0
- package/dist/taro/types/api/open-api/redpackage.d.ts +24 -0
- package/dist/taro/types/api/open-api/settings.d.ts +174 -0
- package/dist/taro/types/api/open-api/soter.d.ts +184 -0
- package/dist/taro/types/api/open-api/sticker.d.ts +83 -0
- package/dist/taro/types/api/open-api/subscribe-message.d.ts +305 -0
- package/dist/taro/types/api/open-api/user-info.d.ts +182 -0
- package/dist/taro/types/api/open-api/werun.d.ts +101 -0
- package/dist/taro/types/api/payment/index.d.ts +119 -0
- package/dist/taro/types/api/qq/index.d.ts +354 -0
- package/dist/taro/types/api/route/index.d.ts +324 -0
- package/dist/taro/types/api/share/index.d.ts +354 -0
- package/dist/taro/types/api/skyline/index.d.ts +345 -0
- package/dist/taro/types/api/storage/background-fetch.d.ts +131 -0
- package/dist/taro/types/api/storage/cache-manager.d.ts +249 -0
- package/dist/taro/types/api/storage/index.d.ts +397 -0
- package/dist/taro/types/api/swan/bookshelf.d.ts +307 -0
- package/dist/taro/types/api/swan/download-package.d.ts +80 -0
- package/dist/taro/types/api/swan/index.d.ts +251 -0
- package/dist/taro/types/api/swan/pay.d.ts +139 -0
- package/dist/taro/types/api/taro.extend.d.ts +233 -0
- package/dist/taro/types/api/taro.hooks.d.ts +148 -0
- package/dist/taro/types/api/ui/animation.d.ts +427 -0
- package/dist/taro/types/api/ui/background.d.ts +69 -0
- package/dist/taro/types/api/ui/custom-component.d.ts +23 -0
- package/dist/taro/types/api/ui/fonts.d.ts +77 -0
- package/dist/taro/types/api/ui/interaction.d.ts +281 -0
- package/dist/taro/types/api/ui/menu.d.ts +29 -0
- package/dist/taro/types/api/ui/navigation-bar.d.ts +130 -0
- package/dist/taro/types/api/ui/pull-down-refresh.d.ts +50 -0
- package/dist/taro/types/api/ui/scroll.d.ts +114 -0
- package/dist/taro/types/api/ui/sticky.d.ts +32 -0
- package/dist/taro/types/api/ui/tab-bar.d.ts +196 -0
- package/dist/taro/types/api/ui/window.d.ts +71 -0
- package/dist/taro/types/api/worker/index.d.ts +83 -0
- package/dist/taro/types/api/wxml/index.d.ts +540 -0
- package/dist/taro/types/compile/compiler.d.ts +32 -0
- package/dist/taro/types/compile/config/h5.d.ts +134 -0
- package/dist/taro/types/compile/config/harmony.d.ts +118 -0
- package/dist/taro/types/compile/config/index.d.ts +8 -0
- package/dist/taro/types/compile/config/manifest.d.ts +155 -0
- package/dist/taro/types/compile/config/mini.d.ts +120 -0
- package/dist/taro/types/compile/config/plugin.d.ts +34 -0
- package/dist/taro/types/compile/config/project.d.ts +338 -0
- package/dist/taro/types/compile/config/rn.d.ts +85 -0
- package/dist/taro/types/compile/config/util.d.ts +179 -0
- package/dist/taro/types/compile/hooks.d.ts +13 -0
- package/dist/taro/types/compile/index.d.ts +11 -0
- package/dist/taro/types/compile/viteCompilerContext.d.ts +167 -0
- package/dist/taro/types/global.d.ts +428 -0
- package/dist/taro/types/index.d.ts +196 -0
- package/dist/taro/types/taro.api.d.ts +130 -0
- package/dist/taro/types/taro.component.d.ts +168 -0
- package/dist/taro/types/taro.config.d.ts +712 -0
- package/dist/taro/types/taro.lifecycle.d.ts +220 -0
- package/dist/taro/types/taro.runtime.d.ts +9 -0
- package/dist/taro-h5/dist/api/ad/index.d.ts +2 -0
- package/dist/taro-h5/dist/api/ad/index.js +8 -0
- package/dist/taro-h5/dist/api/ad/index.js.map +1 -0
- package/dist/taro-h5/dist/api/ai/facial.d.ts +3 -0
- package/dist/taro-h5/dist/api/ai/facial.js +9 -0
- package/dist/taro-h5/dist/api/ai/facial.js.map +1 -0
- package/dist/taro-h5/dist/api/ai/index.d.ts +3 -0
- package/dist/taro-h5/dist/api/ai/index.js +4 -0
- package/dist/taro-h5/dist/api/ai/index.js.map +1 -0
- package/dist/taro-h5/dist/api/ai/inference.d.ts +2 -0
- package/dist/taro-h5/dist/api/ai/inference.js +8 -0
- package/dist/taro-h5/dist/api/ai/inference.js.map +1 -0
- package/dist/taro-h5/dist/api/ai/visual.d.ts +2 -0
- package/dist/taro-h5/dist/api/ai/visual.js +9 -0
- package/dist/taro-h5/dist/api/ai/visual.js.map +1 -0
- package/dist/taro-h5/dist/api/alipay/index.d.ts +2 -0
- package/dist/taro-h5/dist/api/alipay/index.js +8 -0
- package/dist/taro-h5/dist/api/alipay/index.js.map +1 -0
- package/dist/taro-h5/dist/api/base/crypto.d.ts +1 -0
- package/dist/taro-h5/dist/api/base/crypto.js +7 -0
- package/dist/taro-h5/dist/api/base/crypto.js.map +1 -0
- package/dist/taro-h5/dist/api/base/debug.d.ts +3 -0
- package/dist/taro-h5/dist/api/base/debug.js +8 -0
- package/dist/taro-h5/dist/api/base/debug.js.map +1 -0
- package/dist/taro-h5/dist/api/base/index.d.ts +15 -0
- package/dist/taro-h5/dist/api/base/index.js +26 -0
- package/dist/taro-h5/dist/api/base/index.js.map +1 -0
- package/dist/taro-h5/dist/api/base/performance.d.ts +5 -0
- package/dist/taro-h5/dist/api/base/performance.js +11 -0
- package/dist/taro-h5/dist/api/base/performance.js.map +1 -0
- package/dist/taro-h5/dist/api/base/system.d.ts +25 -0
- package/dist/taro-h5/dist/api/base/system.js +194 -0
- package/dist/taro-h5/dist/api/base/system.js.map +1 -0
- package/dist/taro-h5/dist/api/base/update.d.ts +2 -0
- package/dist/taro-h5/dist/api/base/update.js +8 -0
- package/dist/taro-h5/dist/api/base/update.js.map +1 -0
- package/dist/taro-h5/dist/api/base/weapp/app-event.d.ts +20 -0
- package/dist/taro-h5/dist/api/base/weapp/app-event.js +143 -0
- package/dist/taro-h5/dist/api/base/weapp/app-event.js.map +1 -0
- package/dist/taro-h5/dist/api/base/weapp/life-cycle.d.ts +4 -0
- package/dist/taro-h5/dist/api/base/weapp/life-cycle.js +19 -0
- package/dist/taro-h5/dist/api/base/weapp/life-cycle.js.map +1 -0
- package/dist/taro-h5/dist/api/canvas/CanvasContext.d.ts +106 -0
- package/dist/taro-h5/dist/api/canvas/CanvasContext.js +219 -0
- package/dist/taro-h5/dist/api/canvas/CanvasContext.js.map +1 -0
- package/dist/taro-h5/dist/api/canvas/canvasGetImageData.d.ts +6 -0
- package/dist/taro-h5/dist/api/canvas/canvasGetImageData.js +29 -0
- package/dist/taro-h5/dist/api/canvas/canvasGetImageData.js.map +1 -0
- package/dist/taro-h5/dist/api/canvas/canvasPutImageData.d.ts +7 -0
- package/dist/taro-h5/dist/api/canvas/canvasPutImageData.js +26 -0
- package/dist/taro-h5/dist/api/canvas/canvasPutImageData.js.map +1 -0
- package/dist/taro-h5/dist/api/canvas/canvasToTempFilePath.d.ts +7 -0
- package/dist/taro-h5/dist/api/canvas/canvasToTempFilePath.js +26 -0
- package/dist/taro-h5/dist/api/canvas/canvasToTempFilePath.js.map +1 -0
- package/dist/taro-h5/dist/api/canvas/createCanvasContext.d.ts +6 -0
- package/dist/taro-h5/dist/api/canvas/createCanvasContext.js +20 -0
- package/dist/taro-h5/dist/api/canvas/createCanvasContext.js.map +1 -0
- package/dist/taro-h5/dist/api/canvas/index.d.ts +10 -0
- package/dist/taro-h5/dist/api/canvas/index.js +12 -0
- package/dist/taro-h5/dist/api/canvas/index.js.map +1 -0
- package/dist/taro-h5/dist/api/cloud/index.d.ts +14 -0
- package/dist/taro-h5/dist/api/cloud/index.js +25 -0
- package/dist/taro-h5/dist/api/cloud/index.js.map +1 -0
- package/dist/taro-h5/dist/api/data-analysis/index.d.ts +4 -0
- package/dist/taro-h5/dist/api/data-analysis/index.js +9 -0
- package/dist/taro-h5/dist/api/data-analysis/index.js.map +1 -0
- package/dist/taro-h5/dist/api/device/accelerometer.d.ts +18 -0
- package/dist/taro-h5/dist/api/device/accelerometer.js +79 -0
- package/dist/taro-h5/dist/api/device/accelerometer.js.map +1 -0
- package/dist/taro-h5/dist/api/device/accessibility.d.ts +1 -0
- package/dist/taro-h5/dist/api/device/accessibility.js +7 -0
- package/dist/taro-h5/dist/api/device/accessibility.js.map +1 -0
- package/dist/taro-h5/dist/api/device/battery.d.ts +4 -0
- package/dist/taro-h5/dist/api/device/battery.js +27 -0
- package/dist/taro-h5/dist/api/device/battery.js.map +1 -0
- package/dist/taro-h5/dist/api/device/bluetooth-ble.d.ts +16 -0
- package/dist/taro-h5/dist/api/device/bluetooth-ble.js +22 -0
- package/dist/taro-h5/dist/api/device/bluetooth-ble.js.map +1 -0
- package/dist/taro-h5/dist/api/device/bluetooth-peripheral.d.ts +3 -0
- package/dist/taro-h5/dist/api/device/bluetooth-peripheral.js +9 -0
- package/dist/taro-h5/dist/api/device/bluetooth-peripheral.js.map +1 -0
- package/dist/taro-h5/dist/api/device/bluetooth.d.ts +13 -0
- package/dist/taro-h5/dist/api/device/bluetooth.js +19 -0
- package/dist/taro-h5/dist/api/device/bluetooth.js.map +1 -0
- package/dist/taro-h5/dist/api/device/calendar.d.ts +4 -0
- package/dist/taro-h5/dist/api/device/calendar.js +147 -0
- package/dist/taro-h5/dist/api/device/calendar.js.map +1 -0
- package/dist/taro-h5/dist/api/device/clipboard.d.ts +16 -0
- package/dist/taro-h5/dist/api/device/clipboard.js +77 -0
- package/dist/taro-h5/dist/api/device/clipboard.js.map +1 -0
- package/dist/taro-h5/dist/api/device/compass.d.ts +18 -0
- package/dist/taro-h5/dist/api/device/compass.js +82 -0
- package/dist/taro-h5/dist/api/device/compass.js.map +1 -0
- package/dist/taro-h5/dist/api/device/contact.d.ts +2 -0
- package/dist/taro-h5/dist/api/device/contact.js +8 -0
- package/dist/taro-h5/dist/api/device/contact.js.map +1 -0
- package/dist/taro-h5/dist/api/device/crypto.d.ts +1 -0
- package/dist/taro-h5/dist/api/device/crypto.js +7 -0
- package/dist/taro-h5/dist/api/device/crypto.js.map +1 -0
- package/dist/taro-h5/dist/api/device/gyroscope.d.ts +4 -0
- package/dist/taro-h5/dist/api/device/gyroscope.js +10 -0
- package/dist/taro-h5/dist/api/device/gyroscope.js.map +1 -0
- package/dist/taro-h5/dist/api/device/iBeacon.d.ts +7 -0
- package/dist/taro-h5/dist/api/device/iBeacon.js +13 -0
- package/dist/taro-h5/dist/api/device/iBeacon.js.map +1 -0
- package/dist/taro-h5/dist/api/device/index.d.ts +24 -0
- package/dist/taro-h5/dist/api/device/index.js +25 -0
- package/dist/taro-h5/dist/api/device/index.js.map +1 -0
- package/dist/taro-h5/dist/api/device/keyboard.d.ts +4 -0
- package/dist/taro-h5/dist/api/device/keyboard.js +10 -0
- package/dist/taro-h5/dist/api/device/keyboard.js.map +1 -0
- package/dist/taro-h5/dist/api/device/memory.d.ts +2 -0
- package/dist/taro-h5/dist/api/device/memory.js +8 -0
- package/dist/taro-h5/dist/api/device/memory.js.map +1 -0
- package/dist/taro-h5/dist/api/device/motion.d.ts +18 -0
- package/dist/taro-h5/dist/api/device/motion.js +76 -0
- package/dist/taro-h5/dist/api/device/motion.js.map +1 -0
- package/dist/taro-h5/dist/api/device/network.d.ts +15 -0
- package/dist/taro-h5/dist/api/device/network.js +83 -0
- package/dist/taro-h5/dist/api/device/network.js.map +1 -0
- package/dist/taro-h5/dist/api/device/nfc.d.ts +7 -0
- package/dist/taro-h5/dist/api/device/nfc.js +13 -0
- package/dist/taro-h5/dist/api/device/nfc.js.map +1 -0
- package/dist/taro-h5/dist/api/device/phone.d.ts +3 -0
- package/dist/taro-h5/dist/api/device/phone.js +28 -0
- package/dist/taro-h5/dist/api/device/phone.js.map +1 -0
- package/dist/taro-h5/dist/api/device/scan.d.ts +3 -0
- package/dist/taro-h5/dist/api/device/scan.js +14 -0
- package/dist/taro-h5/dist/api/device/scan.js.map +1 -0
- package/dist/taro-h5/dist/api/device/screen.d.ts +9 -0
- package/dist/taro-h5/dist/api/device/screen.js +15 -0
- package/dist/taro-h5/dist/api/device/screen.js.map +1 -0
- package/dist/taro-h5/dist/api/device/sms.d.ts +1 -0
- package/dist/taro-h5/dist/api/device/sms.js +7 -0
- package/dist/taro-h5/dist/api/device/sms.js.map +1 -0
- package/dist/taro-h5/dist/api/device/vibrate.d.ts +10 -0
- package/dist/taro-h5/dist/api/device/vibrate.js +44 -0
- package/dist/taro-h5/dist/api/device/vibrate.js.map +1 -0
- package/dist/taro-h5/dist/api/device/wifi.d.ts +12 -0
- package/dist/taro-h5/dist/api/device/wifi.js +18 -0
- package/dist/taro-h5/dist/api/device/wifi.js.map +1 -0
- package/dist/taro-h5/dist/api/ext/index.d.ts +2 -0
- package/dist/taro-h5/dist/api/ext/index.js +8 -0
- package/dist/taro-h5/dist/api/ext/index.js.map +1 -0
- package/dist/taro-h5/dist/api/files/index.d.ts +8 -0
- package/dist/taro-h5/dist/api/files/index.js +14 -0
- package/dist/taro-h5/dist/api/files/index.js.map +1 -0
- package/dist/taro-h5/dist/api/framework/index.d.ts +5 -0
- package/dist/taro-h5/dist/api/framework/index.js +11 -0
- package/dist/taro-h5/dist/api/framework/index.js.map +1 -0
- package/dist/taro-h5/dist/api/index.d.ts +25 -0
- package/dist/taro-h5/dist/api/index.js +133 -0
- package/dist/taro-h5/dist/api/index.js.map +1 -0
- package/dist/taro-h5/dist/api/location/chooseLocation.d.ts +7 -0
- package/dist/taro-h5/dist/api/location/chooseLocation.js +105 -0
- package/dist/taro-h5/dist/api/location/chooseLocation.js.map +1 -0
- package/dist/taro-h5/dist/api/location/getLocation.d.ts +3 -0
- package/dist/taro-h5/dist/api/location/getLocation.js +68 -0
- package/dist/taro-h5/dist/api/location/getLocation.js.map +1 -0
- package/dist/taro-h5/dist/api/location/index.d.ts +9 -0
- package/dist/taro-h5/dist/api/location/index.js +15 -0
- package/dist/taro-h5/dist/api/location/index.js.map +1 -0
- package/dist/taro-h5/dist/api/location/locationChange.d.ts +6 -0
- package/dist/taro-h5/dist/api/location/locationChange.js +130 -0
- package/dist/taro-h5/dist/api/location/locationChange.js.map +1 -0
- package/dist/taro-h5/dist/api/location/style.scss.js +8 -0
- package/dist/taro-h5/dist/api/location/style.scss.js.map +1 -0
- package/dist/taro-h5/dist/api/location/utils.d.ts +1 -0
- package/dist/taro-h5/dist/api/location/utils.js +4 -0
- package/dist/taro-h5/dist/api/location/utils.js.map +1 -0
- package/dist/taro-h5/dist/api/media/EditorContext.d.ts +17 -0
- package/dist/taro-h5/dist/api/media/audio/InnerAudioContext.d.ts +61 -0
- package/dist/taro-h5/dist/api/media/audio/InnerAudioContext.js +101 -0
- package/dist/taro-h5/dist/api/media/audio/InnerAudioContext.js.map +1 -0
- package/dist/taro-h5/dist/api/media/audio/index.d.ts +14 -0
- package/dist/taro-h5/dist/api/media/audio/index.js +19 -0
- package/dist/taro-h5/dist/api/media/audio/index.js.map +1 -0
- package/dist/taro-h5/dist/api/media/background-audio/BackgroundAudioManager.d.ts +64 -0
- package/dist/taro-h5/dist/api/media/background-audio/BackgroundAudioManager.js +101 -0
- package/dist/taro-h5/dist/api/media/background-audio/BackgroundAudioManager.js.map +1 -0
- package/dist/taro-h5/dist/api/media/background-audio/index.d.ts +13 -0
- package/dist/taro-h5/dist/api/media/background-audio/index.js +24 -0
- package/dist/taro-h5/dist/api/media/background-audio/index.js.map +1 -0
- package/dist/taro-h5/dist/api/media/camera.d.ts +1 -0
- package/dist/taro-h5/dist/api/media/camera.js +7 -0
- package/dist/taro-h5/dist/api/media/camera.js.map +1 -0
- package/dist/taro-h5/dist/api/media/image/chooseImage.d.ts +7 -0
- package/dist/taro-h5/dist/api/media/image/chooseImage.js +46 -0
- package/dist/taro-h5/dist/api/media/image/chooseImage.js.map +1 -0
- package/dist/taro-h5/dist/api/media/image/getImageInfo.d.ts +6 -0
- package/dist/taro-h5/dist/api/media/image/getImageInfo.js +50 -0
- package/dist/taro-h5/dist/api/media/image/getImageInfo.js.map +1 -0
- package/dist/taro-h5/dist/api/media/image/index.d.ts +11 -0
- package/dist/taro-h5/dist/api/media/image/index.js +14 -0
- package/dist/taro-h5/dist/api/media/image/index.js.map +1 -0
- package/dist/taro-h5/dist/api/media/image/previewImage.d.ts +9 -0
- package/dist/taro-h5/dist/api/media/image/previewImage.js +85 -0
- package/dist/taro-h5/dist/api/media/image/previewImage.js.map +1 -0
- package/dist/taro-h5/dist/api/media/image/saveImageToPhotosAlbum.d.ts +3 -0
- package/dist/taro-h5/dist/api/media/image/saveImageToPhotosAlbum.js +30 -0
- package/dist/taro-h5/dist/api/media/image/saveImageToPhotosAlbum.js.map +1 -0
- package/dist/taro-h5/dist/api/media/index.d.ts +12 -0
- package/dist/taro-h5/dist/api/media/index.js +13 -0
- package/dist/taro-h5/dist/api/media/index.js.map +1 -0
- package/dist/taro-h5/dist/api/media/live.d.ts +2 -0
- package/dist/taro-h5/dist/api/media/live.js +8 -0
- package/dist/taro-h5/dist/api/media/live.js.map +1 -0
- package/dist/taro-h5/dist/api/media/map.d.ts +1 -0
- package/dist/taro-h5/dist/api/media/map.js +7 -0
- package/dist/taro-h5/dist/api/media/map.js.map +1 -0
- package/dist/taro-h5/dist/api/media/media-recorder.d.ts +1 -0
- package/dist/taro-h5/dist/api/media/media-recorder.js +7 -0
- package/dist/taro-h5/dist/api/media/media-recorder.js.map +1 -0
- package/dist/taro-h5/dist/api/media/recorder.d.ts +3 -0
- package/dist/taro-h5/dist/api/media/recorder.js +9 -0
- package/dist/taro-h5/dist/api/media/recorder.js.map +1 -0
- package/dist/taro-h5/dist/api/media/video/chooseMedia.d.ts +6 -0
- package/dist/taro-h5/dist/api/media/video/chooseMedia.js +210 -0
- package/dist/taro-h5/dist/api/media/video/chooseMedia.js.map +1 -0
- package/dist/taro-h5/dist/api/media/video/chooseVideo.d.ts +7 -0
- package/dist/taro-h5/dist/api/media/video/chooseVideo.js +44 -0
- package/dist/taro-h5/dist/api/media/video/chooseVideo.js.map +1 -0
- package/dist/taro-h5/dist/api/media/video/getVideoInfo.d.ts +4 -0
- package/dist/taro-h5/dist/api/media/video/getVideoInfo.js +63 -0
- package/dist/taro-h5/dist/api/media/video/getVideoInfo.js.map +1 -0
- package/dist/taro-h5/dist/api/media/video/index.d.ts +12 -0
- package/dist/taro-h5/dist/api/media/video/index.js +19 -0
- package/dist/taro-h5/dist/api/media/video/index.js.map +1 -0
- package/dist/taro-h5/dist/api/media/video/saveVideoToPhotosAlbum.d.ts +3 -0
- package/dist/taro-h5/dist/api/media/video/saveVideoToPhotosAlbum.js +30 -0
- package/dist/taro-h5/dist/api/media/video/saveVideoToPhotosAlbum.js.map +1 -0
- package/dist/taro-h5/dist/api/media/video-decoder.d.ts +1 -0
- package/dist/taro-h5/dist/api/media/video-decoder.js +7 -0
- package/dist/taro-h5/dist/api/media/video-decoder.js.map +1 -0
- package/dist/taro-h5/dist/api/media/video-processing.d.ts +1 -0
- package/dist/taro-h5/dist/api/media/video-processing.js +7 -0
- package/dist/taro-h5/dist/api/media/video-processing.js.map +1 -0
- package/dist/taro-h5/dist/api/media/voip.d.ts +16 -0
- package/dist/taro-h5/dist/api/media/voip.js +22 -0
- package/dist/taro-h5/dist/api/media/voip.js.map +1 -0
- package/dist/taro-h5/dist/api/navigate/index.d.ts +5 -0
- package/dist/taro-h5/dist/api/navigate/index.js +11 -0
- package/dist/taro-h5/dist/api/navigate/index.js.map +1 -0
- package/dist/taro-h5/dist/api/network/download.d.ts +7 -0
- package/dist/taro-h5/dist/api/network/download.js +138 -0
- package/dist/taro-h5/dist/api/network/download.js.map +1 -0
- package/dist/taro-h5/dist/api/network/index.d.ts +7 -0
- package/dist/taro-h5/dist/api/network/index.js +8 -0
- package/dist/taro-h5/dist/api/network/index.js.map +1 -0
- package/dist/taro-h5/dist/api/network/mdns.d.ts +10 -0
- package/dist/taro-h5/dist/api/network/mdns.js +16 -0
- package/dist/taro-h5/dist/api/network/mdns.js.map +1 -0
- package/dist/taro-h5/dist/api/network/request/index.d.ts +7 -0
- package/dist/taro-h5/dist/api/network/request/index.js +179 -0
- package/dist/taro-h5/dist/api/network/request/index.js.map +1 -0
- package/dist/taro-h5/dist/api/network/tcp.d.ts +1 -0
- package/dist/taro-h5/dist/api/network/tcp.js +7 -0
- package/dist/taro-h5/dist/api/network/tcp.js.map +1 -0
- package/dist/taro-h5/dist/api/network/udp.d.ts +1 -0
- package/dist/taro-h5/dist/api/network/udp.js +7 -0
- package/dist/taro-h5/dist/api/network/udp.js.map +1 -0
- package/dist/taro-h5/dist/api/network/upload.d.ts +6 -0
- package/dist/taro-h5/dist/api/network/upload.js +159 -0
- package/dist/taro-h5/dist/api/network/upload.js.map +1 -0
- package/dist/taro-h5/dist/api/network/utils.d.ts +44 -0
- package/dist/taro-h5/dist/api/network/utils.js +69 -0
- package/dist/taro-h5/dist/api/network/utils.js.map +1 -0
- package/dist/taro-h5/dist/api/network/websocket/index.d.ts +9 -0
- package/dist/taro-h5/dist/api/network/websocket/index.js +74 -0
- package/dist/taro-h5/dist/api/network/websocket/index.js.map +1 -0
- package/dist/taro-h5/dist/api/network/websocket/socketTask.d.ts +26 -0
- package/dist/taro-h5/dist/api/network/websocket/socketTask.js +68 -0
- package/dist/taro-h5/dist/api/network/websocket/socketTask.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/account.d.ts +1 -0
- package/dist/taro-h5/dist/api/open-api/account.js +7 -0
- package/dist/taro-h5/dist/api/open-api/account.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/address.d.ts +1 -0
- package/dist/taro-h5/dist/api/open-api/address.js +7 -0
- package/dist/taro-h5/dist/api/open-api/address.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/authorize.d.ts +2 -0
- package/dist/taro-h5/dist/api/open-api/authorize.js +8 -0
- package/dist/taro-h5/dist/api/open-api/authorize.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/card.d.ts +2 -0
- package/dist/taro-h5/dist/api/open-api/card.js +8 -0
- package/dist/taro-h5/dist/api/open-api/card.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/channels-live.d.ts +8 -0
- package/dist/taro-h5/dist/api/open-api/channels-live.js +14 -0
- package/dist/taro-h5/dist/api/open-api/channels-live.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/customer-service.d.ts +1 -0
- package/dist/taro-h5/dist/api/open-api/customer-service.js +7 -0
- package/dist/taro-h5/dist/api/open-api/customer-service.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/device-voip.d.ts +2 -0
- package/dist/taro-h5/dist/api/open-api/device-voip.js +8 -0
- package/dist/taro-h5/dist/api/open-api/device-voip.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/facial.d.ts +4 -0
- package/dist/taro-h5/dist/api/open-api/facial.js +10 -0
- package/dist/taro-h5/dist/api/open-api/facial.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/favorites.d.ts +2 -0
- package/dist/taro-h5/dist/api/open-api/favorites.js +8 -0
- package/dist/taro-h5/dist/api/open-api/favorites.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/group.d.ts +1 -0
- package/dist/taro-h5/dist/api/open-api/group.js +7 -0
- package/dist/taro-h5/dist/api/open-api/group.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/index.d.ts +21 -0
- package/dist/taro-h5/dist/api/open-api/index.js +22 -0
- package/dist/taro-h5/dist/api/open-api/index.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/invoice.d.ts +2 -0
- package/dist/taro-h5/dist/api/open-api/invoice.js +8 -0
- package/dist/taro-h5/dist/api/open-api/invoice.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/license-plate.d.ts +1 -0
- package/dist/taro-h5/dist/api/open-api/license-plate.js +7 -0
- package/dist/taro-h5/dist/api/open-api/license-plate.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/login.d.ts +3 -0
- package/dist/taro-h5/dist/api/open-api/login.js +9 -0
- package/dist/taro-h5/dist/api/open-api/login.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/my-miniprogram.d.ts +1 -0
- package/dist/taro-h5/dist/api/open-api/my-miniprogram.js +7 -0
- package/dist/taro-h5/dist/api/open-api/my-miniprogram.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/privacy.d.ts +4 -0
- package/dist/taro-h5/dist/api/open-api/privacy.js +10 -0
- package/dist/taro-h5/dist/api/open-api/privacy.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/red-package.d.ts +1 -0
- package/dist/taro-h5/dist/api/open-api/red-package.js +7 -0
- package/dist/taro-h5/dist/api/open-api/red-package.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/settings.d.ts +2 -0
- package/dist/taro-h5/dist/api/open-api/settings.js +8 -0
- package/dist/taro-h5/dist/api/open-api/settings.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/soter.d.ts +3 -0
- package/dist/taro-h5/dist/api/open-api/soter.js +9 -0
- package/dist/taro-h5/dist/api/open-api/soter.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/subscribe-message.d.ts +2 -0
- package/dist/taro-h5/dist/api/open-api/subscribe-message.js +9 -0
- package/dist/taro-h5/dist/api/open-api/subscribe-message.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/user-info.d.ts +2 -0
- package/dist/taro-h5/dist/api/open-api/user-info.js +8 -0
- package/dist/taro-h5/dist/api/open-api/user-info.js.map +1 -0
- package/dist/taro-h5/dist/api/open-api/werun.d.ts +2 -0
- package/dist/taro-h5/dist/api/open-api/werun.js +8 -0
- package/dist/taro-h5/dist/api/open-api/werun.js.map +1 -0
- package/dist/taro-h5/dist/api/payment/index.d.ts +3 -0
- package/dist/taro-h5/dist/api/payment/index.js +9 -0
- package/dist/taro-h5/dist/api/payment/index.js.map +1 -0
- package/dist/taro-h5/dist/api/qq/index.d.ts +9 -0
- package/dist/taro-h5/dist/api/qq/index.js +15 -0
- package/dist/taro-h5/dist/api/qq/index.js.map +1 -0
- package/dist/taro-h5/dist/api/route/index.d.ts +7 -0
- package/dist/taro-h5/dist/api/route/index.js +12 -0
- package/dist/taro-h5/dist/api/route/index.js.map +1 -0
- package/dist/taro-h5/dist/api/share/index.d.ts +20 -0
- package/dist/taro-h5/dist/api/share/index.js +26 -0
- package/dist/taro-h5/dist/api/share/index.js.map +1 -0
- package/dist/taro-h5/dist/api/storage/background-fetch.d.ts +4 -0
- package/dist/taro-h5/dist/api/storage/background-fetch.js +10 -0
- package/dist/taro-h5/dist/api/storage/background-fetch.js.map +1 -0
- package/dist/taro-h5/dist/api/storage/cache-manager.d.ts +1 -0
- package/dist/taro-h5/dist/api/storage/cache-manager.js +7 -0
- package/dist/taro-h5/dist/api/storage/cache-manager.js.map +1 -0
- package/dist/taro-h5/dist/api/storage/index.d.ts +20 -0
- package/dist/taro-h5/dist/api/storage/index.js +166 -0
- package/dist/taro-h5/dist/api/storage/index.js.map +1 -0
- package/dist/taro-h5/dist/api/swan/index.d.ts +21 -0
- package/dist/taro-h5/dist/api/swan/index.js +30 -0
- package/dist/taro-h5/dist/api/swan/index.js.map +1 -0
- package/dist/taro-h5/dist/api/taro.d.ts +25 -0
- package/dist/taro-h5/dist/api/taro.js +114 -0
- package/dist/taro-h5/dist/api/taro.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/animation/index.d.ts +3 -0
- package/dist/taro-h5/dist/api/ui/animation/index.js +321 -0
- package/dist/taro-h5/dist/api/ui/animation/index.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/animation/worklet.d.ts +2 -0
- package/dist/taro-h5/dist/api/ui/animation/worklet.js +24 -0
- package/dist/taro-h5/dist/api/ui/animation/worklet.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/background.d.ts +2 -0
- package/dist/taro-h5/dist/api/ui/background.js +8 -0
- package/dist/taro-h5/dist/api/ui/background.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/custom-component.d.ts +1 -0
- package/dist/taro-h5/dist/api/ui/custom-component.js +7 -0
- package/dist/taro-h5/dist/api/ui/custom-component.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/fonts.d.ts +3 -0
- package/dist/taro-h5/dist/api/ui/fonts.js +57 -0
- package/dist/taro-h5/dist/api/ui/fonts.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/index.d.ts +13 -0
- package/dist/taro-h5/dist/api/ui/index.js +14 -0
- package/dist/taro-h5/dist/api/ui/index.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/interaction/actionSheet.d.ts +74 -0
- package/dist/taro-h5/dist/api/ui/interaction/actionSheet.js +212 -0
- package/dist/taro-h5/dist/api/ui/interaction/actionSheet.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/interaction/index.d.ts +11 -0
- package/dist/taro-h5/dist/api/ui/interaction/index.js +279 -0
- package/dist/taro-h5/dist/api/ui/interaction/index.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/interaction/modal.d.ts +72 -0
- package/dist/taro-h5/dist/api/ui/interaction/modal.js +207 -0
- package/dist/taro-h5/dist/api/ui/interaction/modal.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/interaction/toast.d.ts +86 -0
- package/dist/taro-h5/dist/api/ui/interaction/toast.js +185 -0
- package/dist/taro-h5/dist/api/ui/interaction/toast.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/menu.d.ts +1 -0
- package/dist/taro-h5/dist/api/ui/menu.js +7 -0
- package/dist/taro-h5/dist/api/ui/menu.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/navigation-bar/index.d.ts +16 -0
- package/dist/taro-h5/dist/api/ui/navigation-bar/index.js +62 -0
- package/dist/taro-h5/dist/api/ui/navigation-bar/index.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/pull-down-refresh.d.ts +10 -0
- package/dist/taro-h5/dist/api/ui/pull-down-refresh.js +30 -0
- package/dist/taro-h5/dist/api/ui/pull-down-refresh.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/scroll/index.d.ts +6 -0
- package/dist/taro-h5/dist/api/ui/scroll/index.js +89 -0
- package/dist/taro-h5/dist/api/ui/scroll/index.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/sticky.d.ts +1 -0
- package/dist/taro-h5/dist/api/ui/sticky.js +7 -0
- package/dist/taro-h5/dist/api/ui/sticky.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/tab-bar.d.ts +35 -0
- package/dist/taro-h5/dist/api/ui/tab-bar.js +287 -0
- package/dist/taro-h5/dist/api/ui/tab-bar.js.map +1 -0
- package/dist/taro-h5/dist/api/ui/window.d.ts +15 -0
- package/dist/taro-h5/dist/api/ui/window.js +36 -0
- package/dist/taro-h5/dist/api/ui/window.js.map +1 -0
- package/dist/taro-h5/dist/api/worker/index.d.ts +1 -0
- package/dist/taro-h5/dist/api/worker/index.js +7 -0
- package/dist/taro-h5/dist/api/worker/index.js.map +1 -0
- package/dist/taro-h5/dist/api/wxml/IntersectionObserver.d.ts +21 -0
- package/dist/taro-h5/dist/api/wxml/IntersectionObserver.js +113 -0
- package/dist/taro-h5/dist/api/wxml/IntersectionObserver.js.map +1 -0
- package/dist/taro-h5/dist/api/wxml/MediaQueryObserver.d.ts +8 -0
- package/dist/taro-h5/dist/api/wxml/MediaQueryObserver.js +55 -0
- package/dist/taro-h5/dist/api/wxml/MediaQueryObserver.js.map +1 -0
- package/dist/taro-h5/dist/api/wxml/index.d.ts +7 -0
- package/dist/taro-h5/dist/api/wxml/index.js +17 -0
- package/dist/taro-h5/dist/api/wxml/index.js.map +1 -0
- package/dist/taro-h5/dist/api/wxml/nodesRef.d.ts +15 -0
- package/dist/taro-h5/dist/api/wxml/nodesRef.js +48 -0
- package/dist/taro-h5/dist/api/wxml/nodesRef.js.map +1 -0
- package/dist/taro-h5/dist/api/wxml/selectorQuery.d.ts +25 -0
- package/dist/taro-h5/dist/api/wxml/selectorQuery.js +214 -0
- package/dist/taro-h5/dist/api/wxml/selectorQuery.js.map +1 -0
- package/dist/taro-h5/dist/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js +29 -0
- package/dist/taro-h5/dist/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js.map +1 -0
- package/dist/taro-h5/dist/utils/animation.d.ts +6 -0
- package/dist/taro-h5/dist/utils/animation.js +17 -0
- package/dist/taro-h5/dist/utils/animation.js.map +1 -0
- package/dist/taro-h5/dist/utils/handler.d.ts +42 -0
- package/dist/taro-h5/dist/utils/handler.js +86 -0
- package/dist/taro-h5/dist/utils/handler.js.map +1 -0
- package/dist/taro-h5/dist/utils/helper.d.ts +1 -0
- package/dist/taro-h5/dist/utils/helper.js +11 -0
- package/dist/taro-h5/dist/utils/helper.js.map +1 -0
- package/dist/taro-h5/dist/utils/index.d.ts +40 -0
- package/dist/taro-h5/dist/utils/index.js +181 -0
- package/dist/taro-h5/dist/utils/index.js.map +1 -0
- package/dist/taro-h5/dist/utils/valid.d.ts +1 -0
- package/dist/taro-h5/dist/utils/valid.js +7 -0
- package/dist/taro-h5/dist/utils/valid.js.map +1 -0
- package/dist/taro-h5/types/api.d.ts +4 -0
- package/dist/taro-h5/types/component.d.ts +6 -0
- package/dist/taro-h5/types/define.d.ts +2 -0
- package/dist/taro-h5/types/global.d.ts +1 -0
- package/dist/taro-h5/types/index.d.ts +33 -0
- package/dist/taro-h5/types/overlay.d.ts +9 -0
- package/package.json +143 -8
- package/dist/index.cjs.d.ts +0 -921
- package/dist/index.cjs.js +0 -5406
- package/dist/index.cjs.js.map +0 -1
- /package/dist/{bom → runtime/bom}/URL.d.ts +0 -0
- /package/dist/{bom → runtime/bom}/URL.js +0 -0
- /package/dist/{bom → runtime/bom}/URL.js.map +0 -0
- /package/dist/{bom → runtime/bom}/URLSearchParams.d.ts +0 -0
- /package/dist/{bom → runtime/bom}/URLSearchParams.js +0 -0
- /package/dist/{bom → runtime/bom}/URLSearchParams.js.map +0 -0
- /package/dist/{bom → runtime/bom}/document.d.ts +0 -0
- /package/dist/{bom → runtime/bom}/document.js +0 -0
- /package/dist/{bom → runtime/bom}/document.js.map +0 -0
- /package/dist/{bom → runtime/bom}/getComputedStyle.d.ts +0 -0
- /package/dist/{bom → runtime/bom}/getComputedStyle.js +0 -0
- /package/dist/{bom → runtime/bom}/getComputedStyle.js.map +0 -0
- /package/dist/{bom → runtime/bom}/history.d.ts +0 -0
- /package/dist/{bom → runtime/bom}/history.js +0 -0
- /package/dist/{bom → runtime/bom}/history.js.map +0 -0
- /package/dist/{bom → runtime/bom}/location.d.ts +0 -0
- /package/dist/{bom → runtime/bom}/location.js +0 -0
- /package/dist/{bom → runtime/bom}/location.js.map +0 -0
- /package/dist/{bom → runtime/bom}/navigator.d.ts +0 -0
- /package/dist/{bom → runtime/bom}/navigator.js +0 -0
- /package/dist/{bom → runtime/bom}/navigator.js.map +0 -0
- /package/dist/{bom → runtime/bom}/raf.d.ts +0 -0
- /package/dist/{bom → runtime/bom}/raf.js +0 -0
- /package/dist/{bom → runtime/bom}/raf.js.map +0 -0
- /package/dist/{bom → runtime/bom}/window.d.ts +0 -0
- /package/dist/{bom → runtime/bom}/window.js +0 -0
- /package/dist/{bom → runtime/bom}/window.js.map +0 -0
- /package/dist/{constants → runtime/constants}/index.d.ts +0 -0
- /package/dist/{constants → runtime/constants}/index.js +0 -0
- /package/dist/{constants → runtime/constants}/index.js.map +0 -0
- /package/dist/{current.d.ts → runtime/current.d.ts} +0 -0
- /package/dist/{current.js → runtime/current.js} +0 -0
- /package/dist/{current.js.map → runtime/current.js.map} +0 -0
- /package/dist/{dom → runtime/dom}/anchor-element.js +0 -0
- /package/dist/{dom → runtime/dom}/anchor-element.js.map +0 -0
- /package/dist/{dom → runtime/dom}/class-list.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/class-list.js +0 -0
- /package/dist/{dom → runtime/dom}/class-list.js.map +0 -0
- /package/dist/{dom → runtime/dom}/document.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/document.js +0 -0
- /package/dist/{dom → runtime/dom}/document.js.map +0 -0
- /package/dist/{dom → runtime/dom}/element.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/element.js +0 -0
- /package/dist/{dom → runtime/dom}/element.js.map +0 -0
- /package/dist/{dom → runtime/dom}/event-source.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/event-source.js +0 -0
- /package/dist/{dom → runtime/dom}/event-source.js.map +0 -0
- /package/dist/{dom → runtime/dom}/event-target.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/event-target.js +0 -0
- /package/dist/{dom → runtime/dom}/event-target.js.map +0 -0
- /package/dist/{dom → runtime/dom}/event.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/event.js +0 -0
- /package/dist/{dom → runtime/dom}/event.js.map +0 -0
- /package/dist/{dom → runtime/dom}/form.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/form.js +0 -0
- /package/dist/{dom → runtime/dom}/form.js.map +0 -0
- /package/dist/{dom → runtime/dom}/node.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/node.js +0 -0
- /package/dist/{dom → runtime/dom}/node.js.map +0 -0
- /package/dist/{dom → runtime/dom}/node_types.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/root.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/root.js +0 -0
- /package/dist/{dom → runtime/dom}/root.js.map +0 -0
- /package/dist/{dom → runtime/dom}/style.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/style.js +0 -0
- /package/dist/{dom → runtime/dom}/style.js.map +0 -0
- /package/dist/{dom → runtime/dom}/style_properties.js +0 -0
- /package/dist/{dom → runtime/dom}/style_properties.js.map +0 -0
- /package/dist/{dom → runtime/dom}/svg.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/svg.js +0 -0
- /package/dist/{dom → runtime/dom}/svg.js.map +0 -0
- /package/dist/{dom → runtime/dom}/text.d.ts +0 -0
- /package/dist/{dom → runtime/dom}/text.js +0 -0
- /package/dist/{dom → runtime/dom}/text.js.map +0 -0
- /package/dist/{dom → runtime/dom}/transfer.js +0 -0
- /package/dist/{dom → runtime/dom}/transfer.js.map +0 -0
- /package/dist/{dom → runtime/dom}/tree.js +0 -0
- /package/dist/{dom → runtime/dom}/tree.js.map +0 -0
- /package/dist/{dom-external → runtime/dom-external}/element.js +0 -0
- /package/dist/{dom-external → runtime/dom-external}/element.js.map +0 -0
- /package/dist/{dom-external → runtime/dom-external}/index.js +0 -0
- /package/dist/{dom-external → runtime/dom-external}/index.js.map +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/html.d.ts +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/html.js +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/html.js.map +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/parser.d.ts +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/parser.js +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/parser.js.map +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/scanner.js +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/scanner.js.map +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/style.js +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/style.js.map +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/tags.js +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/tags.js.map +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/utils.js +0 -0
- /package/dist/{dom-external → runtime/dom-external}/inner-html/utils.js.map +0 -0
- /package/dist/{dom-external → runtime/dom-external}/mutation-observer/implements.d.ts +0 -0
- /package/dist/{dom-external → runtime/dom-external}/mutation-observer/implements.js +0 -0
- /package/dist/{dom-external → runtime/dom-external}/mutation-observer/implements.js.map +0 -0
- /package/dist/{dom-external → runtime/dom-external}/mutation-observer/index.d.ts +0 -0
- /package/dist/{dom-external → runtime/dom-external}/mutation-observer/index.js +0 -0
- /package/dist/{dom-external → runtime/dom-external}/mutation-observer/index.js.map +0 -0
- /package/dist/{dom-external → runtime/dom-external}/mutation-observer/record.d.ts +0 -0
- /package/dist/{dom-external → runtime/dom-external}/node.js +0 -0
- /package/dist/{dom-external → runtime/dom-external}/node.js.map +0 -0
- /package/dist/{dsl → runtime/dsl}/common.d.ts +0 -0
- /package/dist/{dsl → runtime/dsl}/common.js +0 -0
- /package/dist/{dsl → runtime/dsl}/common.js.map +0 -0
- /package/dist/{dsl → runtime/dsl}/instance.d.ts +0 -0
- /package/dist/{emitter → runtime/emitter}/emitter.d.ts +0 -0
- /package/dist/{emitter → runtime/emitter}/emitter.js +0 -0
- /package/dist/{emitter → runtime/emitter}/emitter.js.map +0 -0
- /package/dist/{env.d.ts → runtime/env.d.ts} +0 -0
- /package/dist/{env.js → runtime/env.js} +0 -0
- /package/dist/{env.js.map → runtime/env.js.map} +0 -0
- /package/dist/{hydrate.d.ts → runtime/hydrate.d.ts} +0 -0
- /package/dist/{hydrate.js → runtime/hydrate.js} +0 -0
- /package/dist/{hydrate.js.map → runtime/hydrate.js.map} +0 -0
- /package/dist/{index.d.ts → runtime/index.d.ts} +0 -0
- /package/dist/{index.js → runtime/index.js} +0 -0
- /package/dist/{index.js.map → runtime/index.js.map} +0 -0
- /package/dist/{interface → runtime/interface}/animate.d.ts +0 -0
- /package/dist/{interface → runtime/interface}/element.d.ts +0 -0
- /package/dist/{interface → runtime/interface}/event-target.d.ts +0 -0
- /package/dist/{interface → runtime/interface}/event.d.ts +0 -0
- /package/dist/{interface → runtime/interface}/hydrate.d.ts +0 -0
- /package/dist/{interface → runtime/interface}/node.d.ts +0 -0
- /package/dist/{interface → runtime/interface}/options.d.ts +0 -0
- /package/dist/{interface → runtime/interface}/utils.d.ts +0 -0
- /package/dist/{next-tick.d.ts → runtime/next-tick.d.ts} +0 -0
- /package/dist/{next-tick.js → runtime/next-tick.js} +0 -0
- /package/dist/{next-tick.js.map → runtime/next-tick.js.map} +0 -0
- /package/dist/{options.d.ts → runtime/options.d.ts} +0 -0
- /package/dist/{options.js → runtime/options.js} +0 -0
- /package/dist/{options.js.map → runtime/options.js.map} +0 -0
- /package/dist/{perf.d.ts → runtime/perf.d.ts} +0 -0
- /package/dist/{perf.js → runtime/perf.js} +0 -0
- /package/dist/{perf.js.map → runtime/perf.js.map} +0 -0
- /package/dist/{polyfill → runtime/polyfill}/array.js +0 -0
- /package/dist/{polyfill → runtime/polyfill}/array.js.map +0 -0
- /package/dist/{polyfill → runtime/polyfill}/index.d.ts +0 -0
- /package/dist/{polyfill → runtime/polyfill}/index.js +0 -0
- /package/dist/{polyfill → runtime/polyfill}/index.js.map +0 -0
- /package/dist/{polyfill → runtime/polyfill}/intersection-observer.js +0 -0
- /package/dist/{polyfill → runtime/polyfill}/intersection-observer.js.map +0 -0
- /package/dist/{polyfill → runtime/polyfill}/object.js +0 -0
- /package/dist/{polyfill → runtime/polyfill}/object.js.map +0 -0
- /package/dist/{runtime.esm.d.ts → runtime/runtime.esm.d.ts} +0 -0
- /package/dist/{runtime.esm.js → runtime/runtime.esm.js} +0 -0
- /package/dist/{runtime.esm.js.map → runtime/runtime.esm.js.map} +0 -0
- /package/dist/{utils → runtime/utils}/cache.d.ts +0 -0
- /package/dist/{utils → runtime/utils}/cache.js +0 -0
- /package/dist/{utils → runtime/utils}/cache.js.map +0 -0
- /package/dist/{utils → runtime/utils}/index.d.ts +0 -0
- /package/dist/{utils → runtime/utils}/index.js +0 -0
- /package/dist/{utils → runtime/utils}/index.js.map +0 -0
- /package/dist/{utils → runtime/utils}/lodash.d.ts +0 -0
- /package/dist/{utils → runtime/utils}/lodash.js +0 -0
- /package/dist/{utils → runtime/utils}/lodash.js.map +0 -0
- /package/dist/{utils → runtime/utils}/router.d.ts +0 -0
- /package/dist/{utils → runtime/utils}/router.js +0 -0
- /package/dist/{utils → runtime/utils}/router.js.map +0 -0
|
@@ -0,0 +1,1755 @@
|
|
|
1
|
+
import { defineCustomElementTaroTabbar } from '@tarojs/components/dist/components';
|
|
2
|
+
import { initTabBarApis } from '@tarojs/taro';
|
|
3
|
+
import { __awaiter } from 'tslib';
|
|
4
|
+
import { addLeadingSlash, eventCenter, Current, stripBasename, incrementId, createPageConfig, hooks, stringify, getHomePage, getCurrentPage, stripTrailing, requestAnimationFrame as requestAnimationFrame$1, safeExecute } from '@tarojs/runtime';
|
|
5
|
+
import { EventChannel } from '@tarojs/shared';
|
|
6
|
+
import { createBrowserHistory, createHashHistory, Action, parsePath } from 'history';
|
|
7
|
+
export { createBrowserHistory, createHashHistory } from 'history';
|
|
8
|
+
import queryString from 'query-string';
|
|
9
|
+
import UniversalRouter from 'universal-router';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 插入页面动画需要的样式
|
|
13
|
+
*/
|
|
14
|
+
function loadAnimateStyle(ms = 300) {
|
|
15
|
+
const css = `
|
|
16
|
+
body {
|
|
17
|
+
/* 防止 iOS 页面滚动 */
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
}
|
|
20
|
+
.taro_router > .taro_page {
|
|
21
|
+
position: absolute;
|
|
22
|
+
left: 0;
|
|
23
|
+
top: 0;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
background-color: #fff;
|
|
27
|
+
transform: translate(100%, 0);
|
|
28
|
+
transition: transform ${ms}ms;
|
|
29
|
+
z-index: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.taro_router > .taro_page.taro_tabbar_page,
|
|
33
|
+
.taro_router > .taro_page.taro_page_show.taro_page_stationed {
|
|
34
|
+
transform: none;
|
|
35
|
+
transition: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.taro_router > .taro_page.taro_page_show {
|
|
39
|
+
transform: translate(0, 0);
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
addStyle(css);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 插入路由相关样式
|
|
46
|
+
*/
|
|
47
|
+
function loadRouterStyle(enableTabBar, enableWindowScroll, enhanceAnimation) {
|
|
48
|
+
const css = `
|
|
49
|
+
.taro_router {
|
|
50
|
+
position: relative;
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: 100%;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.taro_page {
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
${enableWindowScroll ? '' : `
|
|
59
|
+
overflow-x: hidden;
|
|
60
|
+
overflow-y: scroll;
|
|
61
|
+
max-height: 100vh;
|
|
62
|
+
`}
|
|
63
|
+
}
|
|
64
|
+
${enableTabBar ? `
|
|
65
|
+
.taro-tabbar__container {
|
|
66
|
+
height:100%;
|
|
67
|
+
}
|
|
68
|
+
.taro-tabbar__panel {
|
|
69
|
+
height: 100%;
|
|
70
|
+
}
|
|
71
|
+
.taro-tabbar__container > .taro-tabbar__panel {
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.taro-tabbar__container > .taro-tabbar__panel > .taro_page.taro_tabbar_page {
|
|
76
|
+
max-height: calc(100vh - var(--taro-tabbar-height) - constant(safe-area-inset-bottom));
|
|
77
|
+
max-height: calc(100vh - var(--taro-tabbar-height) - env(safe-area-inset-bottom));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
` : ''}
|
|
81
|
+
${enhanceAnimation
|
|
82
|
+
? `.taro_page_shade:has(+.taro_page_stationed),
|
|
83
|
+
.taro_page_shade.taro_tabbar_page,
|
|
84
|
+
.taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child):has(+.taro_page_stationed) {
|
|
85
|
+
display: none;
|
|
86
|
+
}` : ` .taro_page_shade,
|
|
87
|
+
.taro_router > .taro_page.taro_page_show.taro_page_stationed:not(.taro_page_shade):not(.taro_tabbar_page):not(:last-child) {
|
|
88
|
+
display: none;
|
|
89
|
+
}`}
|
|
90
|
+
`;
|
|
91
|
+
addStyle(css);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 插入导航栏相关的样式
|
|
95
|
+
*/
|
|
96
|
+
function loadNavigationBarStyle() {
|
|
97
|
+
const css = `
|
|
98
|
+
.taro-navigation-bar-show {
|
|
99
|
+
display: flex;
|
|
100
|
+
background: white;
|
|
101
|
+
position: sticky;
|
|
102
|
+
z-index: 500;
|
|
103
|
+
top: 0;
|
|
104
|
+
padding-bottom: 8px;
|
|
105
|
+
padding-top: calc(env(safe-area-inset-top) + 8px);
|
|
106
|
+
justify-content: center;
|
|
107
|
+
align-items: center;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.taro-navigation-bar-hide {
|
|
111
|
+
display: none;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.taro-navigation-bar-title-wrap {
|
|
115
|
+
display: flex;
|
|
116
|
+
height: 24px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.taro-navigation-bar-title-wrap > .taro-navigation-bar-loading {
|
|
120
|
+
display: none;
|
|
121
|
+
animation: loading 2s linear infinite;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.taro-navigation-bar-title-wrap .taro-navigation-bar-loading.taro-navigation-bar-loading-show {
|
|
125
|
+
display: flex;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.taro-navigation-bar-title-wrap > .taro-navigation-bar-title {
|
|
129
|
+
font-size: 24px;
|
|
130
|
+
height: 24px;
|
|
131
|
+
line-height: 24px;
|
|
132
|
+
max-width: 100px;
|
|
133
|
+
white-space: nowrap;
|
|
134
|
+
overflow: hidden;
|
|
135
|
+
line-height: 24px;
|
|
136
|
+
text-overflow: ellipsis;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@keyframes loading {
|
|
140
|
+
from {
|
|
141
|
+
transform: rotate(0deg);
|
|
142
|
+
}
|
|
143
|
+
to {
|
|
144
|
+
transform: rotate(360deg);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@keyframes loading {
|
|
149
|
+
from {
|
|
150
|
+
transform: rotate(0deg);
|
|
151
|
+
}
|
|
152
|
+
to {
|
|
153
|
+
transform: rotate(360deg);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.taro-navigation-bar-no-icon > .taro-navigation-bar-home {
|
|
158
|
+
display: none;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.taro-navigation-bar-no-icon > .taro-navigation-bar-back {
|
|
162
|
+
display: none;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.taro-navigation-bar-home-icon > .taro-navigation-bar-home {
|
|
166
|
+
display: flex;
|
|
167
|
+
left: 8px;
|
|
168
|
+
position: absolute;
|
|
169
|
+
width: 24px;
|
|
170
|
+
height: 24px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.taro-navigation-bar-back-icon > .taro-navigation-bar-back {
|
|
174
|
+
display: flex;
|
|
175
|
+
left: 8px;
|
|
176
|
+
position: absolute;
|
|
177
|
+
width: 24px;
|
|
178
|
+
height: 24px;
|
|
179
|
+
}
|
|
180
|
+
`;
|
|
181
|
+
addStyle(css);
|
|
182
|
+
}
|
|
183
|
+
function addStyle(css) {
|
|
184
|
+
if (!css)
|
|
185
|
+
return;
|
|
186
|
+
const style = document.createElement('style');
|
|
187
|
+
style.innerHTML = css;
|
|
188
|
+
document.getElementsByTagName('head')[0].appendChild(style);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const home_svg_str = `
|
|
192
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
193
|
+
<path d="M23.8899 12.2737C23.8232 12.3584 23.7237 12.3997 23.6198 12.3974H20.7994V23.5996C20.7994 23.8194 20.6213 24 20.4001 24H14.7994C14.5791 24 14.4002 23.8194 14.4002 23.5996V15.6H9.59963V23.5996C9.59963 23.8194 9.42075 24 9.20033 24H3.59968C3.48981 24 3.38964 23.954 3.31764 23.8811C3.24495 23.8091 3.2004 23.7087 3.2004 23.5996V12.3975H0.398546V12.3967C0.296893 12.396 0.194446 12.3544 0.11579 12.2738C-0.0371146 12.114 -0.0400714 11.864 0.11579 11.7076L11.7201 0.117284C11.8767 -0.0390948 12.1298 -0.0390948 12.2863 0.117284L23.8899 11.7076C24.0465 11.864 24.0265 12.0995 23.8899 12.2737ZM12.0029 0.964625L1.37086 11.5854L3.59968 11.5839V11.5999C3.65537 11.5999 3.70804 11.611 3.75557 11.6307C3.89952 11.692 4.00046 11.8339 4.00046 11.9996V23.1991H8.79955V15.2003C8.79955 14.9789 8.97917 14.8002 9.20033 14.8002H14.7995C15.0207 14.8002 15.2003 14.9789 15.2003 15.2003V23.1991H20.0001V11.9996C20.0001 11.8339 20.1003 11.692 20.2443 11.6307C20.2918 11.611 20.3453 11.5999 20.4001 11.5999V11.5713L22.6193 11.5691L12.0029 0.964625Z" fill="currentColor"/>
|
|
194
|
+
</svg>
|
|
195
|
+
`;
|
|
196
|
+
const back_svg_str = `
|
|
197
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
198
|
+
<path d="M17.8206 22.9016L7.45515 11.8756L17.8206 1.09845C18.0598 0.849741 18.0598 0.435233 17.8206 0.186528C17.5814 -0.0621762 17.1827 -0.0621762 16.9435 0.186528L6.1794 11.4611C5.9402 11.7098 5.9402 12.1244 6.1794 12.3731L16.9435 23.8135C17.1827 24.0622 17.5814 24.0622 17.8206 23.8135C18.0598 23.5648 18.0598 23.1503 17.8206 22.9016Z" fill="currentColor"/>
|
|
199
|
+
</svg>
|
|
200
|
+
`;
|
|
201
|
+
const loading_svg_str = `
|
|
202
|
+
<svg t="1709608074670" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4741" width="24" height="24"><path d="M256 529.066667H85.333333a17.066667 17.066667 0 1 1 0-34.133334h170.666667a17.066667 17.066667 0 0 1 0 34.133334z" opacity=".278" p-id="4742"></path><path d="M99.84 640a17.066667 17.066667 0 0 1-4.437333-33.553067l164.693333-44.373333a17.066667 17.066667 0 1 1 8.891733 32.9728l-164.693333 44.373333a17.544533 17.544533 0 0 1-4.4544 0.580267z" opacity=".322" p-id="4743"></path><path d="M264.533333 462.523733a16.896 16.896 0 0 1-4.369066-0.580266l-164.693334-43.52a17.0496 17.0496 0 1 1 8.721067-32.989867l164.693333 43.52a17.066667 17.066667 0 1 1-4.352 33.570133z" opacity=".239" p-id="4744"></path><path d="M384.017067 307.2a17.032533 17.032533 0 0 1-14.7968-8.533333l-85.333334-147.626667a17.066667 17.066667 0 0 1 29.559467-17.083733l85.333333 147.626666A17.066667 17.066667 0 0 1 384.017067 307.2z" opacity=".122" p-id="4745"></path><path d="M639.982933 307.2a17.0496 17.0496 0 0 1-14.762666-25.6l85.333333-147.626667a17.066667 17.066667 0 1 1 29.559467 17.066667l-85.333334 147.626667a17.032533 17.032533 0 0 1-14.7968 8.533333z" opacity=".922" p-id="4746"></path><path d="M692.906667 347.306667a17.066667 17.066667 0 0 1-12.117334-29.098667l120.337067-121.173333a17.066667 17.066667 0 1 1 24.234667 24.046933l-120.337067 121.173333a17.1008 17.1008 0 0 1-12.117333 5.051734z" opacity=".878" p-id="4747"></path><path d="M733.883733 401.066667a17.066667 17.066667 0 0 1-8.5504-31.8464l147.626667-85.333334a17.0496 17.0496 0 1 1 17.066667 29.5424l-147.626667 85.333334a16.776533 16.776533 0 0 1-8.516267 2.304z" opacity=".839" p-id="4748"></path><path d="M512 273.066667a17.066667 17.066667 0 0 1-17.066667-17.066667V85.333333a17.066667 17.066667 0 0 1 34.133334 0v170.666667a17.066667 17.066667 0 0 1-17.066667 17.066667z" p-id="4749"></path><path d="M578.577067 281.6a17.066667 17.066667 0 0 1-16.520534-21.418667l43.52-164.693333a17.066667 17.066667 0 0 1 33.006934 8.721067l-43.52 164.693333a17.066667 17.066667 0 0 1-16.4864 12.6976z" opacity=".961" p-id="4750"></path><path d="M445.44 282.453333a17.066667 17.066667 0 0 1-16.469333-12.629333l-44.373334-164.693333a17.066667 17.066667 0 0 1 32.955734-8.891734l44.373333 164.693334a17.066667 17.066667 0 0 1-16.4864 21.521066z" opacity=".078" p-id="4751"></path><path d="M924.177067 640c-1.4848 0-2.9696-0.187733-4.4544-0.580267l-164.693334-44.373333a17.066667 17.066667 0 0 1 8.874667-32.9728l164.693333 44.373333a17.066667 17.066667 0 0 1-4.420266 33.553067z" opacity=".722" p-id="4752"></path><path d="M881.476267 742.4a17.015467 17.015467 0 0 1-8.482134-2.269867l-148.48-85.333333a17.0496 17.0496 0 1 1 16.9984-29.5936l148.48 85.333333a17.0496 17.0496 0 0 1-8.516266 31.863467z" opacity=".678" p-id="4753"></path><path d="M813.226667 830.293333a17.015467 17.015467 0 0 1-12.066134-5.000533l-120.337066-120.337067a17.0496 17.0496 0 1 1 24.132266-24.132266l120.337067 120.337066a17.0496 17.0496 0 0 1-12.066133 29.1328z" opacity=".639" p-id="4754"></path><path d="M938.666667 529.066667H768a17.066667 17.066667 0 1 1 0-34.133334h170.666667a17.066667 17.066667 0 1 1 0 34.133334z" opacity=".761" p-id="4755"></path><path d="M401.066667 941.226667a17.066667 17.066667 0 0 1-16.4864-21.504l44.373333-164.693334a17.066667 17.066667 0 1 1 32.955733 8.874667l-44.373333 164.693333a17.066667 17.066667 0 0 1-16.469333 12.629334z" opacity=".478" p-id="4756"></path><path d="M298.6496 898.56a17.066667 17.066667 0 0 1-14.779733-25.565867l85.333333-148.48a17.083733 17.083733 0 0 1 29.5936 16.9984l-85.333333 148.48a17.032533 17.032533 0 0 1-14.813867 8.567467z" opacity=".439" p-id="4757"></path><path d="M512 955.733333a17.066667 17.066667 0 0 1-17.066667-17.066666V768a17.066667 17.066667 0 1 1 34.133334 0v170.666667a17.066667 17.066667 0 0 1-17.066667 17.066666z" opacity=".522" p-id="4758"></path><path d="M725.3504 898.56a17.032533 17.032533 0 0 1-14.7968-8.533333l-85.333333-147.626667a17.066667 17.066667 0 0 1 29.559466-17.066667l85.333334 147.626667a17.066667 17.066667 0 0 1-14.762667 25.6z" opacity=".6" p-id="4759"></path><path d="M622.062933 942.08c-7.509333 0-14.421333-5.0176-16.469333-12.629333l-44.3904-164.693334a17.066667 17.066667 0 1 1 32.9728-8.874666l44.3904 164.693333a17.066667 17.066667 0 0 1-16.503467 21.504z" opacity=".561" p-id="4760"></path><path d="M759.4496 463.36a17.083733 17.083733 0 0 1-4.420267-33.553067l164.693334-44.373333a17.066667 17.066667 0 0 1 8.874666 32.955733l-164.693333 44.373334a16.657067 16.657067 0 0 1-4.4544 0.597333z" opacity=".702" p-id="4761"></path><path d="M330.24 347.306667a17.015467 17.015467 0 0 1-12.066133-5.000534l-120.32-120.32a17.0496 17.0496 0 1 1 24.132266-24.132266l120.32 120.32a17.0496 17.0496 0 0 1-12.066133 29.1328z" opacity=".161" p-id="4762"></path><path d="M290.116267 401.066667a17.032533 17.032533 0 0 1-8.533334-2.286934l-147.626666-85.333333a17.066667 17.066667 0 1 1 17.083733-29.5424l147.626667 85.333333a17.066667 17.066667 0 0 1-8.5504 31.829334z" opacity=".2" p-id="4763"></path><path d="M142.523733 742.4a17.066667 17.066667 0 0 1-8.567466-31.8464l147.626666-85.333333a17.066667 17.066667 0 1 1 17.083734 29.559466l-147.626667 85.333334a16.930133 16.930133 0 0 1-8.516267 2.286933z" opacity=".361" p-id="4764"></path><path d="M209.92 830.293333a17.066667 17.066667 0 0 1-12.117333-29.098666l120.32-121.173334a17.066667 17.066667 0 0 1 24.2176 24.029867l-120.32 121.1904a16.896 16.896 0 0 1-12.100267 5.051733z" opacity=".4" p-id="4765"></path></svg>
|
|
203
|
+
`;
|
|
204
|
+
function initNavigationBar(config, container) {
|
|
205
|
+
if (config.router.mode === 'multi')
|
|
206
|
+
return;
|
|
207
|
+
const navigationBar = document.createElement('div');
|
|
208
|
+
navigationBar.classList.add('taro-navigation-bar-no-icon');
|
|
209
|
+
const navigationBarBackBtn = document.createElement('div');
|
|
210
|
+
navigationBarBackBtn.classList.add('taro-navigation-bar-back');
|
|
211
|
+
const navigationBarHomeBtn = document.createElement('div');
|
|
212
|
+
navigationBarHomeBtn.classList.add('taro-navigation-bar-home');
|
|
213
|
+
navigationBarBackBtn.innerHTML = back_svg_str;
|
|
214
|
+
navigationBarHomeBtn.innerHTML = home_svg_str;
|
|
215
|
+
const navigationBarTitleWrap = document.createElement('div');
|
|
216
|
+
navigationBarTitleWrap.classList.add('taro-navigation-bar-title-wrap');
|
|
217
|
+
const navigationBarLoading = document.createElement('div');
|
|
218
|
+
navigationBarLoading.classList.add('taro-navigation-bar-loading');
|
|
219
|
+
navigationBarLoading.innerHTML = loading_svg_str;
|
|
220
|
+
const navigationBarTitle = document.createElement('div');
|
|
221
|
+
navigationBarTitle.classList.add('taro-navigation-bar-title');
|
|
222
|
+
navigationBarTitleWrap.appendChild(navigationBarLoading);
|
|
223
|
+
navigationBarTitleWrap.appendChild(navigationBarTitle);
|
|
224
|
+
navigationBar.appendChild(navigationBarHomeBtn);
|
|
225
|
+
navigationBar.appendChild(navigationBarBackBtn);
|
|
226
|
+
navigationBar.appendChild(navigationBarTitleWrap);
|
|
227
|
+
navigationBar.id = 'taro-navigation-bar';
|
|
228
|
+
// prepend 不兼容 android6
|
|
229
|
+
container.insertBefore(navigationBar, container.firstChild);
|
|
230
|
+
loadNavigationBarStyle();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function initTabbar(config, history) {
|
|
234
|
+
if (config.tabBar == null || config.tabBar.custom) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
// TODO: custom-tab-bar
|
|
238
|
+
defineCustomElementTaroTabbar();
|
|
239
|
+
const tabbar = document.createElement('taro-tabbar');
|
|
240
|
+
const homePage = config.entryPagePath || (config.pages ? config.pages[0] : '');
|
|
241
|
+
tabbar.conf = config.tabBar;
|
|
242
|
+
tabbar.conf.homePage = history.location.pathname === '/' ? homePage : history.location.pathname;
|
|
243
|
+
const routerConfig = config.router;
|
|
244
|
+
tabbar.conf.mode = routerConfig && routerConfig.mode ? routerConfig.mode : 'hash';
|
|
245
|
+
if (routerConfig.customRoutes) {
|
|
246
|
+
tabbar.conf.custom = true;
|
|
247
|
+
tabbar.conf.customRoutes = routerConfig.customRoutes;
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
tabbar.conf.custom = false;
|
|
251
|
+
tabbar.conf.customRoutes = {};
|
|
252
|
+
}
|
|
253
|
+
if (typeof routerConfig.basename !== 'undefined') {
|
|
254
|
+
tabbar.conf.basename = routerConfig.basename;
|
|
255
|
+
}
|
|
256
|
+
const container = document.getElementById('container');
|
|
257
|
+
container === null || container === void 0 ? void 0 : container.appendChild(tabbar);
|
|
258
|
+
initTabBarApis(config);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
class RouterConfig {
|
|
262
|
+
static set config(e) {
|
|
263
|
+
this.__config = e;
|
|
264
|
+
}
|
|
265
|
+
static get config() {
|
|
266
|
+
return this.__config;
|
|
267
|
+
}
|
|
268
|
+
static get pages() {
|
|
269
|
+
return this.config.pages || [];
|
|
270
|
+
}
|
|
271
|
+
static get router() {
|
|
272
|
+
return this.config.router || {};
|
|
273
|
+
}
|
|
274
|
+
static get mode() {
|
|
275
|
+
return this.router.mode || 'hash';
|
|
276
|
+
}
|
|
277
|
+
static get customRoutes() { return this.router.customRoutes || {}; }
|
|
278
|
+
// 这个方法不考虑 basename 和 customRoutes,只判断原始的 url 是否在 pages 中
|
|
279
|
+
static isPage(url = '') {
|
|
280
|
+
return this.pages.findIndex(e => addLeadingSlash(e) === url) !== -1;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
let history;
|
|
285
|
+
let basename = '/';
|
|
286
|
+
class MpaHistory {
|
|
287
|
+
constructor() {
|
|
288
|
+
this.back = window.history.back;
|
|
289
|
+
this.forward = window.history.forward;
|
|
290
|
+
this.pushState = this.eventState('pushState');
|
|
291
|
+
this.replaceState = this.eventState('replaceState');
|
|
292
|
+
}
|
|
293
|
+
get location() {
|
|
294
|
+
return {
|
|
295
|
+
pathname: window.location.pathname,
|
|
296
|
+
search: window.location.search,
|
|
297
|
+
hash: window.location.hash,
|
|
298
|
+
key: `${window.history.length}`,
|
|
299
|
+
state: window.history.state
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
createHref(_to) {
|
|
303
|
+
throw new Error('Method not implemented.');
|
|
304
|
+
}
|
|
305
|
+
parseUrl(to) {
|
|
306
|
+
let url = to.pathname || '';
|
|
307
|
+
if (RouterConfig.isPage(addLeadingSlash(url))) {
|
|
308
|
+
url += '.html';
|
|
309
|
+
}
|
|
310
|
+
if (to.search) {
|
|
311
|
+
url += `?${to.search}`;
|
|
312
|
+
}
|
|
313
|
+
if (to.hash) {
|
|
314
|
+
url += to.hash.startsWith('#') ? to.hash : `#${to.hash}`;
|
|
315
|
+
}
|
|
316
|
+
return url;
|
|
317
|
+
}
|
|
318
|
+
push(to, _state = {}) {
|
|
319
|
+
window.location.assign(this.parseUrl(to));
|
|
320
|
+
// this.pushState(_state, '', this.parseUrl(to))
|
|
321
|
+
}
|
|
322
|
+
replace(to, _state = {}) {
|
|
323
|
+
window.location.replace(this.parseUrl(to));
|
|
324
|
+
// this.replaceState(_state, '', this.parseUrl(to))
|
|
325
|
+
}
|
|
326
|
+
go(delta) {
|
|
327
|
+
window.history.go(delta);
|
|
328
|
+
}
|
|
329
|
+
listen(listener) {
|
|
330
|
+
function callback(e) {
|
|
331
|
+
if (e.action === 'pushState') {
|
|
332
|
+
listener({ action: Action.Push, location: this.location });
|
|
333
|
+
}
|
|
334
|
+
else if (e.action === 'replaceState') {
|
|
335
|
+
listener({ action: Action.Replace, location: this.location });
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
// NOTE: 这里包括 back、forward、go 三种可能,并非是 POP 事件
|
|
339
|
+
listener({ action: Action.Pop, location: this.location });
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
window.addEventListener('popstate', callback);
|
|
343
|
+
return () => {
|
|
344
|
+
window.removeEventListener('popstate', callback);
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
block(_blocker) {
|
|
348
|
+
throw new Error('Method not implemented.');
|
|
349
|
+
}
|
|
350
|
+
eventState(action) {
|
|
351
|
+
return (data, unused, url) => {
|
|
352
|
+
const wrapper = window.history[action](data, unused, url);
|
|
353
|
+
const evt = new Event(action);
|
|
354
|
+
evt.action = action;
|
|
355
|
+
evt.state = data;
|
|
356
|
+
evt.unused = unused;
|
|
357
|
+
evt.url = url;
|
|
358
|
+
window.dispatchEvent(evt);
|
|
359
|
+
return wrapper;
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
function setHistory(h, base = '/') {
|
|
364
|
+
history = h;
|
|
365
|
+
basename = base;
|
|
366
|
+
}
|
|
367
|
+
function createMpaHistory(_) {
|
|
368
|
+
return new MpaHistory();
|
|
369
|
+
}
|
|
370
|
+
function setHistoryMode(mode, base = '/') {
|
|
371
|
+
const options = {
|
|
372
|
+
window
|
|
373
|
+
};
|
|
374
|
+
basename = base;
|
|
375
|
+
if (mode === 'browser') {
|
|
376
|
+
history = createBrowserHistory(options);
|
|
377
|
+
}
|
|
378
|
+
else if (mode === 'multi') {
|
|
379
|
+
history = createMpaHistory();
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
// default is hash
|
|
383
|
+
history = createHashHistory(options);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
function prependBasename(url = '') {
|
|
387
|
+
return basename.replace(/\/$/, '') + '/' + url.replace(/^\//, '');
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
class Stacks {
|
|
391
|
+
constructor() {
|
|
392
|
+
this.stacks = [];
|
|
393
|
+
this.backDelta = 0;
|
|
394
|
+
this.tabs = {};
|
|
395
|
+
this.methodName = '';
|
|
396
|
+
}
|
|
397
|
+
set delta(delta) {
|
|
398
|
+
if (delta > 0) {
|
|
399
|
+
this.backDelta = delta;
|
|
400
|
+
}
|
|
401
|
+
else if (this.backDelta > 0) {
|
|
402
|
+
--this.backDelta;
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
this.backDelta = 0;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
get delta() {
|
|
409
|
+
return this.backDelta;
|
|
410
|
+
}
|
|
411
|
+
set method(methodName) {
|
|
412
|
+
this.methodName = methodName;
|
|
413
|
+
}
|
|
414
|
+
get method() {
|
|
415
|
+
return this.methodName;
|
|
416
|
+
}
|
|
417
|
+
get length() {
|
|
418
|
+
return this.stacks.length;
|
|
419
|
+
}
|
|
420
|
+
get last() {
|
|
421
|
+
return this.stacks[this.length - 1];
|
|
422
|
+
}
|
|
423
|
+
get() {
|
|
424
|
+
return this.stacks;
|
|
425
|
+
}
|
|
426
|
+
getItem(index) {
|
|
427
|
+
return this.stacks[index];
|
|
428
|
+
}
|
|
429
|
+
getLastIndex(pathname, stateWith = 1) {
|
|
430
|
+
const list = [...this.stacks].reverse();
|
|
431
|
+
return list.findIndex((page, i) => { var _a; return i >= stateWith && ((_a = page.path) === null || _a === void 0 ? void 0 : _a.replace(/\?.*/g, '')) === pathname; });
|
|
432
|
+
}
|
|
433
|
+
getDelta(pathname) {
|
|
434
|
+
if (this.backDelta >= 1) {
|
|
435
|
+
return this.backDelta;
|
|
436
|
+
}
|
|
437
|
+
const index = this.getLastIndex(pathname);
|
|
438
|
+
// NOTE: 此处为了修复浏览器后退多级页面,在大量重复路由状况下可能出现判断错误的情况 (增强判断能力只能考虑在 query 中新增参数来判断,暂时搁置)
|
|
439
|
+
return index > 0 ? index : 1;
|
|
440
|
+
}
|
|
441
|
+
getPrevIndex(pathname, stateWith = 1) {
|
|
442
|
+
const lastIndex = this.getLastIndex(pathname, stateWith);
|
|
443
|
+
if (lastIndex < 0) {
|
|
444
|
+
return -1;
|
|
445
|
+
}
|
|
446
|
+
return this.length - 1 - lastIndex;
|
|
447
|
+
}
|
|
448
|
+
pop() {
|
|
449
|
+
return this.stacks.pop();
|
|
450
|
+
}
|
|
451
|
+
push(page) {
|
|
452
|
+
return this.stacks.push(page);
|
|
453
|
+
}
|
|
454
|
+
getTabs() {
|
|
455
|
+
return this.tabs;
|
|
456
|
+
}
|
|
457
|
+
pushTab(path) {
|
|
458
|
+
this.tabs[path] = this.last;
|
|
459
|
+
this.pop();
|
|
460
|
+
}
|
|
461
|
+
popTab(path) {
|
|
462
|
+
this.push(this.tabs[path]);
|
|
463
|
+
delete this.tabs[path];
|
|
464
|
+
}
|
|
465
|
+
removeTab(path) {
|
|
466
|
+
delete this.tabs[path];
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
const stacks = new Stacks();
|
|
470
|
+
|
|
471
|
+
const isWeixin = () => !!navigator.userAgent.match(/\bMicroMessenger\b/ig);
|
|
472
|
+
const isDingTalk = () => !!navigator.userAgent.match(/\bDingTalk\b/ig);
|
|
473
|
+
let preTitle = document.title;
|
|
474
|
+
let isLoadDdEntry = false;
|
|
475
|
+
function setMpaTitle(title) {
|
|
476
|
+
if (preTitle === title)
|
|
477
|
+
return;
|
|
478
|
+
document.title = title;
|
|
479
|
+
preTitle = title;
|
|
480
|
+
if (process.env.SUPPORT_DINGTALK_NAVIGATE !== 'disabled' && isDingTalk()) {
|
|
481
|
+
if (!isLoadDdEntry) {
|
|
482
|
+
isLoadDdEntry = true;
|
|
483
|
+
require('dingtalk-jsapi/platform');
|
|
484
|
+
}
|
|
485
|
+
const setDingTitle = require('dingtalk-jsapi/api/biz/navigation/setTitle').default;
|
|
486
|
+
setDingTitle({ title });
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
function setTitle(title) {
|
|
490
|
+
eventCenter.trigger('__taroH5SetNavigationBarTitle', title);
|
|
491
|
+
}
|
|
492
|
+
function setNavigationBarStyle(option) {
|
|
493
|
+
eventCenter.trigger('__taroH5setNavigationBarColor', option);
|
|
494
|
+
}
|
|
495
|
+
function setNavigationBarLoading(loading) {
|
|
496
|
+
eventCenter.trigger('__taroH5setNavigationBarLoading', loading);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
class RoutesAlias {
|
|
500
|
+
constructor() {
|
|
501
|
+
this.conf = [];
|
|
502
|
+
this.getConfig = (url = '') => {
|
|
503
|
+
const customRoute = this.conf.filter((arr) => {
|
|
504
|
+
return arr.includes(url);
|
|
505
|
+
});
|
|
506
|
+
return customRoute[0];
|
|
507
|
+
};
|
|
508
|
+
this.getOrigin = (url = '') => {
|
|
509
|
+
var _a;
|
|
510
|
+
return ((_a = this.getConfig(url)) === null || _a === void 0 ? void 0 : _a[0]) || url;
|
|
511
|
+
};
|
|
512
|
+
this.getAlias = (url = '') => {
|
|
513
|
+
var _a;
|
|
514
|
+
return ((_a = this.getConfig(url)) === null || _a === void 0 ? void 0 : _a[1]) || url;
|
|
515
|
+
};
|
|
516
|
+
this.getAll = (url = '') => {
|
|
517
|
+
return this.conf
|
|
518
|
+
.filter((arr) => arr.includes(url))
|
|
519
|
+
.reduceRight((p, a) => {
|
|
520
|
+
p.unshift(a[1]);
|
|
521
|
+
return p;
|
|
522
|
+
}, []);
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
set(customRoutes = {}) {
|
|
526
|
+
for (let key in customRoutes) {
|
|
527
|
+
const path = customRoutes[key];
|
|
528
|
+
key = addLeadingSlash(key);
|
|
529
|
+
if (typeof path === 'string') {
|
|
530
|
+
this.conf.push([key, addLeadingSlash(path)]);
|
|
531
|
+
}
|
|
532
|
+
else if ((path === null || path === void 0 ? void 0 : path.length) > 0) {
|
|
533
|
+
this.conf.push(...path.map(p => [key, addLeadingSlash(p)]));
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
const routesAlias = new RoutesAlias();
|
|
539
|
+
|
|
540
|
+
const routeEvtChannel = EventChannel.routeChannel;
|
|
541
|
+
function processNavigateUrl(option) {
|
|
542
|
+
var _a;
|
|
543
|
+
const pathPieces = parsePath(option.url);
|
|
544
|
+
// 处理相对路径
|
|
545
|
+
if ((_a = pathPieces.pathname) === null || _a === void 0 ? void 0 : _a.includes('./')) {
|
|
546
|
+
const parts = routesAlias.getOrigin(history.location.pathname).split('/');
|
|
547
|
+
parts.pop();
|
|
548
|
+
pathPieces.pathname.split('/').forEach((item) => {
|
|
549
|
+
if (item === '.')
|
|
550
|
+
return;
|
|
551
|
+
item === '..' ? parts.pop() : parts.push(item);
|
|
552
|
+
});
|
|
553
|
+
pathPieces.pathname = parts.join('/');
|
|
554
|
+
}
|
|
555
|
+
// 确保是 / 开头的路径
|
|
556
|
+
pathPieces.pathname = addLeadingSlash(pathPieces.pathname);
|
|
557
|
+
// 处理自定义路由
|
|
558
|
+
pathPieces.pathname = routesAlias.getAlias(addLeadingSlash(pathPieces.pathname));
|
|
559
|
+
// 处理 basename
|
|
560
|
+
pathPieces.pathname = prependBasename(pathPieces.pathname);
|
|
561
|
+
// hack fix history v5 bug: https://github.com/remix-run/history/issues/814
|
|
562
|
+
if (!pathPieces.search)
|
|
563
|
+
pathPieces.search = '';
|
|
564
|
+
return pathPieces;
|
|
565
|
+
}
|
|
566
|
+
function navigate(option, method) {
|
|
567
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
568
|
+
return new Promise((resolve, reject) => {
|
|
569
|
+
stacks.method = method;
|
|
570
|
+
const { success, complete, fail } = option;
|
|
571
|
+
const unListen = history.listen(() => {
|
|
572
|
+
const res = { errMsg: `${method}:ok` };
|
|
573
|
+
if (method === 'navigateTo') {
|
|
574
|
+
res.eventChannel = routeEvtChannel;
|
|
575
|
+
routeEvtChannel.addEvents(option.events);
|
|
576
|
+
}
|
|
577
|
+
success === null || success === void 0 ? void 0 : success(res);
|
|
578
|
+
complete === null || complete === void 0 ? void 0 : complete(res);
|
|
579
|
+
resolve(res);
|
|
580
|
+
unListen();
|
|
581
|
+
});
|
|
582
|
+
try {
|
|
583
|
+
if ('url' in option) {
|
|
584
|
+
const pathPieces = processNavigateUrl(option);
|
|
585
|
+
const state = { timestamp: Date.now() };
|
|
586
|
+
if (method === 'navigateTo') {
|
|
587
|
+
// Note: 由于 spa 会针对弱网情况下,短时间内多次跳转同一个页面跳转加了锁,后续如果有用户反馈返回无效,那可能是这个问题
|
|
588
|
+
history.push(pathPieces, state);
|
|
589
|
+
}
|
|
590
|
+
else if (method === 'redirectTo' || method === 'switchTab') {
|
|
591
|
+
history.replace(pathPieces, state);
|
|
592
|
+
}
|
|
593
|
+
else if (method === 'reLaunch') {
|
|
594
|
+
stacks.delta = stacks.length;
|
|
595
|
+
history.replace(pathPieces, state);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
else if (method === 'navigateBack') {
|
|
599
|
+
stacks.delta = option.delta;
|
|
600
|
+
if (stacks.length > option.delta) {
|
|
601
|
+
history.go(-option.delta);
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
history.go(1 - stacks.length);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
catch (error) {
|
|
609
|
+
const res = { errMsg: `${method}:fail ${error.message || error}` };
|
|
610
|
+
fail === null || fail === void 0 ? void 0 : fail(res);
|
|
611
|
+
complete === null || complete === void 0 ? void 0 : complete(res);
|
|
612
|
+
if (fail || complete) {
|
|
613
|
+
return resolve(res);
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
return reject(res);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
function navigateTo(option) {
|
|
623
|
+
return navigate(option, 'navigateTo');
|
|
624
|
+
}
|
|
625
|
+
function redirectTo(option) {
|
|
626
|
+
return navigate(option, 'redirectTo');
|
|
627
|
+
}
|
|
628
|
+
function navigateBack(option = { delta: 1 }) {
|
|
629
|
+
if (!option.delta || option.delta < 1) {
|
|
630
|
+
option.delta = 1;
|
|
631
|
+
}
|
|
632
|
+
return navigate(option, 'navigateBack');
|
|
633
|
+
}
|
|
634
|
+
function switchTab(option) {
|
|
635
|
+
return navigate(option, 'switchTab');
|
|
636
|
+
}
|
|
637
|
+
function reLaunch(option) {
|
|
638
|
+
return navigate(option, 'reLaunch');
|
|
639
|
+
}
|
|
640
|
+
function getCurrentPages() {
|
|
641
|
+
if (process.env.NODE_ENV !== 'production' && RouterConfig.mode === 'multi') {
|
|
642
|
+
console.warn('多页面路由模式不支持使用 getCurrentPages 方法!');
|
|
643
|
+
}
|
|
644
|
+
const pages = stacks.get();
|
|
645
|
+
return pages.map(e => { var _a; return (Object.assign(Object.assign({}, e), { route: ((_a = e.path) === null || _a === void 0 ? void 0 : _a.replace(/\?.*/g, '')) || '' })); });
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
let pageResizeFn;
|
|
649
|
+
function bindPageResize(page) {
|
|
650
|
+
pageResizeFn && window.removeEventListener('resize', pageResizeFn);
|
|
651
|
+
pageResizeFn = function () {
|
|
652
|
+
if (page.onResize) {
|
|
653
|
+
const mediaQuery = window.matchMedia('(orientation: portrait)');
|
|
654
|
+
page.onResize({
|
|
655
|
+
deviceOrientation: mediaQuery.matches ? 'portrait' : 'landscape',
|
|
656
|
+
size: {
|
|
657
|
+
windowHeight: window.innerHeight,
|
|
658
|
+
windowWidth: window.innerWidth,
|
|
659
|
+
screenHeight: window.screen.height,
|
|
660
|
+
screenWidth: window.screen.width,
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
window.addEventListener('resize', pageResizeFn, false);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
const pageScrollFn = {};
|
|
669
|
+
let pageDOM = window;
|
|
670
|
+
function bindPageScroll(page, scrollEl, distance = 50) {
|
|
671
|
+
var _a;
|
|
672
|
+
const pagePath = (page ? page === null || page === void 0 ? void 0 : page.path : (_a = Current.router) === null || _a === void 0 ? void 0 : _a.path);
|
|
673
|
+
pageScrollFn[pagePath] && scrollEl.removeEventListener('scroll', pageScrollFn[pagePath]);
|
|
674
|
+
pageDOM = scrollEl;
|
|
675
|
+
let isReachBottom = false;
|
|
676
|
+
pageScrollFn[pagePath] = function () {
|
|
677
|
+
var _a;
|
|
678
|
+
(_a = page.onPageScroll) === null || _a === void 0 ? void 0 : _a.call(page, {
|
|
679
|
+
scrollTop: pageDOM instanceof Window ? window.scrollY : pageDOM.scrollTop
|
|
680
|
+
});
|
|
681
|
+
if (isReachBottom && getOffset() > distance) {
|
|
682
|
+
isReachBottom = false;
|
|
683
|
+
}
|
|
684
|
+
if (page.onReachBottom &&
|
|
685
|
+
!isReachBottom &&
|
|
686
|
+
getOffset() < distance) {
|
|
687
|
+
isReachBottom = true;
|
|
688
|
+
page.onReachBottom();
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
pageDOM.addEventListener('scroll', pageScrollFn[pagePath], false);
|
|
692
|
+
}
|
|
693
|
+
function getOffset() {
|
|
694
|
+
if (pageDOM instanceof Window) {
|
|
695
|
+
return document.documentElement.scrollHeight - window.scrollY - window.innerHeight;
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
return pageDOM.scrollHeight - pageDOM.scrollTop - pageDOM.clientHeight;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/* eslint-disable dot-notation */
|
|
703
|
+
class MultiPageHandler {
|
|
704
|
+
constructor(config, history) {
|
|
705
|
+
this.history = history;
|
|
706
|
+
this.config = config;
|
|
707
|
+
this.mount();
|
|
708
|
+
}
|
|
709
|
+
get appId() { return this.config.appId || 'app'; }
|
|
710
|
+
get router() { return this.config.router || {}; }
|
|
711
|
+
get routerMode() { return this.router.mode || 'hash'; }
|
|
712
|
+
get customRoutes() { return this.router.customRoutes || {}; }
|
|
713
|
+
get tabBarList() { var _a; return ((_a = this.config.tabBar) === null || _a === void 0 ? void 0 : _a.list) || []; }
|
|
714
|
+
get PullDownRefresh() { return this.config.PullDownRefresh; }
|
|
715
|
+
set pathname(p) { this.router.pathname = p; }
|
|
716
|
+
get pathname() { return this.router.pathname; }
|
|
717
|
+
get basename() { return this.router.basename || ''; }
|
|
718
|
+
get pageConfig() { return this.config.route; }
|
|
719
|
+
get isTabBar() {
|
|
720
|
+
var _a;
|
|
721
|
+
const routePath = addLeadingSlash(stripBasename(this.pathname, this.basename));
|
|
722
|
+
const pagePath = ((_a = Object.entries(this.customRoutes).find(([, target]) => {
|
|
723
|
+
if (typeof target === 'string') {
|
|
724
|
+
return target === routePath;
|
|
725
|
+
}
|
|
726
|
+
else if ((target === null || target === void 0 ? void 0 : target.length) > 0) {
|
|
727
|
+
return target.includes(routePath);
|
|
728
|
+
}
|
|
729
|
+
return false;
|
|
730
|
+
})) === null || _a === void 0 ? void 0 : _a[0]) || routePath;
|
|
731
|
+
return !!pagePath && this.tabBarList.some(t => t.pagePath === pagePath);
|
|
732
|
+
}
|
|
733
|
+
get search() { return location.search.substr(1); }
|
|
734
|
+
get usingWindowScroll() {
|
|
735
|
+
var _a;
|
|
736
|
+
let usingWindowScroll = true;
|
|
737
|
+
if (typeof ((_a = this.pageConfig) === null || _a === void 0 ? void 0 : _a.usingWindowScroll) === 'boolean') {
|
|
738
|
+
usingWindowScroll = this.pageConfig.usingWindowScroll;
|
|
739
|
+
}
|
|
740
|
+
const win = window;
|
|
741
|
+
win.__taroAppConfig || (win.__taroAppConfig = {});
|
|
742
|
+
win.__taroAppConfig.usingWindowScroll = usingWindowScroll;
|
|
743
|
+
return usingWindowScroll;
|
|
744
|
+
}
|
|
745
|
+
getQuery(search = '', options = {}) {
|
|
746
|
+
search = search ? `${search}&${this.search}` : this.search;
|
|
747
|
+
const query = search
|
|
748
|
+
? queryString.parse(search)
|
|
749
|
+
: {};
|
|
750
|
+
return Object.assign(Object.assign({}, query), options);
|
|
751
|
+
}
|
|
752
|
+
isDefaultNavigationStyle() {
|
|
753
|
+
var _a, _b;
|
|
754
|
+
let style = (_a = this.config.window) === null || _a === void 0 ? void 0 : _a.navigationStyle;
|
|
755
|
+
if (typeof ((_b = this.pageConfig) === null || _b === void 0 ? void 0 : _b.navigationStyle) === 'string') {
|
|
756
|
+
style = this.pageConfig.navigationStyle;
|
|
757
|
+
}
|
|
758
|
+
return style !== 'custom';
|
|
759
|
+
}
|
|
760
|
+
mount() {
|
|
761
|
+
setHistory(this.history, this.basename);
|
|
762
|
+
// Note: 注入页面样式
|
|
763
|
+
loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll);
|
|
764
|
+
}
|
|
765
|
+
onReady(page, onLoad = true) {
|
|
766
|
+
var _a;
|
|
767
|
+
const pageEl = this.getPageContainer(page);
|
|
768
|
+
if (pageEl && !(pageEl === null || pageEl === void 0 ? void 0 : pageEl['__isReady'])) {
|
|
769
|
+
const el = pageEl.firstElementChild;
|
|
770
|
+
const componentOnReady = el === null || el === void 0 ? void 0 : el['componentOnReady'];
|
|
771
|
+
if (componentOnReady) {
|
|
772
|
+
componentOnReady === null || componentOnReady === void 0 ? void 0 : componentOnReady().then(() => {
|
|
773
|
+
requestAnimationFrame(() => {
|
|
774
|
+
var _a;
|
|
775
|
+
(_a = page.onReady) === null || _a === void 0 ? void 0 : _a.call(page);
|
|
776
|
+
pageEl['__isReady'] = true;
|
|
777
|
+
});
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
(_a = page.onReady) === null || _a === void 0 ? void 0 : _a.call(page);
|
|
782
|
+
pageEl['__isReady'] = true;
|
|
783
|
+
}
|
|
784
|
+
onLoad && (pageEl['__page'] = page);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
load(page, pageConfig = {}) {
|
|
788
|
+
var _a;
|
|
789
|
+
if (!page)
|
|
790
|
+
return;
|
|
791
|
+
(_a = page.onLoad) === null || _a === void 0 ? void 0 : _a.call(page, this.getQuery('', page.options), () => {
|
|
792
|
+
var _a;
|
|
793
|
+
const pageEl = this.getPageContainer(page);
|
|
794
|
+
if (this.isTabBar) {
|
|
795
|
+
pageEl === null || pageEl === void 0 ? void 0 : pageEl.classList.add('taro_tabbar_page');
|
|
796
|
+
}
|
|
797
|
+
if (this.isDefaultNavigationStyle()) {
|
|
798
|
+
pageEl === null || pageEl === void 0 ? void 0 : pageEl.classList.add('taro_navigation_page');
|
|
799
|
+
}
|
|
800
|
+
this.onReady(page, true);
|
|
801
|
+
(_a = page.onShow) === null || _a === void 0 ? void 0 : _a.call(page);
|
|
802
|
+
this.bindPageEvents(page, pageConfig);
|
|
803
|
+
this.triggerRouterChange();
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
getPageContainer(page) {
|
|
807
|
+
var _a;
|
|
808
|
+
const path = page ? page === null || page === void 0 ? void 0 : page.path : (_a = Current.page) === null || _a === void 0 ? void 0 : _a.path;
|
|
809
|
+
const id = path === null || path === void 0 ? void 0 : path.replace(/([^a-z0-9\u00a0-\uffff_-])/ig, '\\$1');
|
|
810
|
+
if (page) {
|
|
811
|
+
return document.querySelector(`.taro_page#${id}`);
|
|
812
|
+
}
|
|
813
|
+
const el = (id
|
|
814
|
+
? document.querySelector(`.taro_page#${id}`)
|
|
815
|
+
: document.querySelector('.taro_page') ||
|
|
816
|
+
document.querySelector('.taro_router'));
|
|
817
|
+
return el;
|
|
818
|
+
}
|
|
819
|
+
getScrollingElement(page) {
|
|
820
|
+
if (this.usingWindowScroll)
|
|
821
|
+
return window;
|
|
822
|
+
return this.getPageContainer(page) || window;
|
|
823
|
+
}
|
|
824
|
+
bindPageEvents(page, config = {}) {
|
|
825
|
+
var _a;
|
|
826
|
+
const scrollEl = this.getScrollingElement(page);
|
|
827
|
+
const distance = config.onReachBottomDistance || ((_a = this.config.window) === null || _a === void 0 ? void 0 : _a.onReachBottomDistance) || 50;
|
|
828
|
+
bindPageScroll(page, scrollEl, distance);
|
|
829
|
+
bindPageResize(page);
|
|
830
|
+
}
|
|
831
|
+
triggerRouterChange() {
|
|
832
|
+
/**
|
|
833
|
+
* @tarojs/runtime 中生命周期跑在 promise 中,所以这里需要 setTimeout 延迟事件调用
|
|
834
|
+
* TODO 考虑将生命周期返回 Promise,用于处理相关事件调用顺序
|
|
835
|
+
*/
|
|
836
|
+
setTimeout(() => {
|
|
837
|
+
eventCenter.trigger('__afterTaroRouterChange', {
|
|
838
|
+
toLocation: {
|
|
839
|
+
path: this.pathname
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
}, 0);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
const createStampId$1 = incrementId();
|
|
847
|
+
const launchStampId$1 = createStampId$1();
|
|
848
|
+
// TODO 支持多路由 (APP 生命周期仅触发一次)
|
|
849
|
+
/** Note: 关于多页面应用
|
|
850
|
+
* - 需要配置路由映射(根目录跳转、404 页面……)
|
|
851
|
+
* - app.onPageNotFound 事件不支持
|
|
852
|
+
* - 应用生命周期可能多次触发
|
|
853
|
+
* - TabBar 会多次加载
|
|
854
|
+
* - 不支持路由动画
|
|
855
|
+
*/
|
|
856
|
+
function createMultiRouter(history, app, config, framework) {
|
|
857
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
858
|
+
var _a, _b, _c, _d, _e, _f;
|
|
859
|
+
if (typeof app.onUnhandledRejection === 'function') {
|
|
860
|
+
window.addEventListener('unhandledrejection', app.onUnhandledRejection);
|
|
861
|
+
}
|
|
862
|
+
eventCenter.on('__taroH5SetNavigationBarTitle', setMpaTitle);
|
|
863
|
+
RouterConfig.config = config;
|
|
864
|
+
const handler = new MultiPageHandler(config, history);
|
|
865
|
+
const launchParam = {
|
|
866
|
+
path: config.pageName, // 多页面模式没新开一个页面相当于重启,所以直接使用当前页面路径
|
|
867
|
+
query: handler.getQuery(launchStampId$1),
|
|
868
|
+
scene: 0,
|
|
869
|
+
shareTicket: '',
|
|
870
|
+
referrerInfo: {}
|
|
871
|
+
};
|
|
872
|
+
eventCenter.trigger('__taroRouterLaunch', launchParam);
|
|
873
|
+
(_a = app.onLaunch) === null || _a === void 0 ? void 0 : _a.call(app, launchParam);
|
|
874
|
+
app.onError && window.addEventListener('error', e => { var _a; return (_a = app.onError) === null || _a === void 0 ? void 0 : _a.call(app, e.message); });
|
|
875
|
+
const pathName = config.pageName;
|
|
876
|
+
const pageConfig = handler.pageConfig;
|
|
877
|
+
eventCenter.trigger('__taroRouterChange', {
|
|
878
|
+
toLocation: {
|
|
879
|
+
path: pathName
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
let element;
|
|
883
|
+
try {
|
|
884
|
+
element = yield ((_b = pageConfig.load) === null || _b === void 0 ? void 0 : _b.call(pageConfig));
|
|
885
|
+
if (element instanceof Array) {
|
|
886
|
+
element = element[0];
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
catch (error) {
|
|
890
|
+
throw new Error(error);
|
|
891
|
+
}
|
|
892
|
+
if (!element)
|
|
893
|
+
return;
|
|
894
|
+
let enablePullDownRefresh = ((_c = config === null || config === void 0 ? void 0 : config.window) === null || _c === void 0 ? void 0 : _c.enablePullDownRefresh) || false;
|
|
895
|
+
if (pageConfig) {
|
|
896
|
+
setMpaTitle((_d = pageConfig.navigationBarTitleText) !== null && _d !== void 0 ? _d : document.title);
|
|
897
|
+
if (typeof pageConfig.enablePullDownRefresh === 'boolean') {
|
|
898
|
+
enablePullDownRefresh = pageConfig.enablePullDownRefresh;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
const el = (_e = element.default) !== null && _e !== void 0 ? _e : element;
|
|
902
|
+
const loadConfig = Object.assign({}, pageConfig);
|
|
903
|
+
delete loadConfig['path'];
|
|
904
|
+
delete loadConfig['load'];
|
|
905
|
+
const page = createPageConfig(enablePullDownRefresh ? hooks.call('createPullDownComponent', el, pathName, framework, handler.PullDownRefresh) : el, pathName + stringify(launchParam), {}, loadConfig);
|
|
906
|
+
handler.load(page, pageConfig);
|
|
907
|
+
(_f = app.onShow) === null || _f === void 0 ? void 0 : _f.call(app, launchParam);
|
|
908
|
+
window.addEventListener('visibilitychange', () => {
|
|
909
|
+
var _a, _b, _c;
|
|
910
|
+
const currentPath = ((_a = Current.page) === null || _a === void 0 ? void 0 : _a.path) || '';
|
|
911
|
+
const path = currentPath.substring(0, currentPath.indexOf('?'));
|
|
912
|
+
const param = {};
|
|
913
|
+
// app的 onShow/onHide 生命周期的路径信息为当前页面的路径
|
|
914
|
+
Object.assign(param, launchParam, { path });
|
|
915
|
+
if (document.visibilityState === 'visible') {
|
|
916
|
+
(_b = app.onShow) === null || _b === void 0 ? void 0 : _b.call(app, param);
|
|
917
|
+
}
|
|
918
|
+
else {
|
|
919
|
+
(_c = app.onHide) === null || _c === void 0 ? void 0 : _c.call(app, param);
|
|
920
|
+
}
|
|
921
|
+
});
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
class NavigationBarHandler {
|
|
926
|
+
constructor(pageContext) {
|
|
927
|
+
this.isLoadDdEntry = false;
|
|
928
|
+
this.cache = {};
|
|
929
|
+
this.pageContext = pageContext;
|
|
930
|
+
this.init();
|
|
931
|
+
eventCenter.on('__taroH5SetNavigationBarTitle', (title) => {
|
|
932
|
+
this.setTitle(title);
|
|
933
|
+
});
|
|
934
|
+
eventCenter.on('__taroH5setNavigationBarLoading', (loading) => {
|
|
935
|
+
this.setNavigationLoading(loading);
|
|
936
|
+
});
|
|
937
|
+
eventCenter.on('__taroH5setNavigationBarColor', ({ backgroundColor, frontColor }) => {
|
|
938
|
+
if (typeof backgroundColor === 'string')
|
|
939
|
+
this.setNavigationBarBackground(backgroundColor);
|
|
940
|
+
if (typeof frontColor === 'string')
|
|
941
|
+
this.setNavigationBarTextStyle(frontColor);
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
toHomeFn() {
|
|
945
|
+
reLaunch({ url: this.pageContext.originHomePage });
|
|
946
|
+
}
|
|
947
|
+
backFn() {
|
|
948
|
+
navigateBack();
|
|
949
|
+
}
|
|
950
|
+
get homeBtnElement() {
|
|
951
|
+
var _a;
|
|
952
|
+
if (!this.navigationBarElement)
|
|
953
|
+
return null;
|
|
954
|
+
return (_a = this.navigationBarElement.getElementsByClassName('taro-navigation-bar-home')) === null || _a === void 0 ? void 0 : _a[0];
|
|
955
|
+
}
|
|
956
|
+
get backBtnElement() {
|
|
957
|
+
var _a;
|
|
958
|
+
if (!this.navigationBarElement)
|
|
959
|
+
return null;
|
|
960
|
+
return (_a = this.navigationBarElement.getElementsByClassName('taro-navigation-bar-back')) === null || _a === void 0 ? void 0 : _a[0];
|
|
961
|
+
}
|
|
962
|
+
get titleElement() {
|
|
963
|
+
var _a;
|
|
964
|
+
if (!this.navigationBarElement)
|
|
965
|
+
return null;
|
|
966
|
+
return (_a = this.navigationBarElement.getElementsByClassName('taro-navigation-bar-title')) === null || _a === void 0 ? void 0 : _a[0];
|
|
967
|
+
}
|
|
968
|
+
get loadingElement() {
|
|
969
|
+
if (!this.navigationBarElement)
|
|
970
|
+
return null;
|
|
971
|
+
return this.navigationBarElement.getElementsByClassName('taro-navigation-bar-loading')[0];
|
|
972
|
+
}
|
|
973
|
+
init() {
|
|
974
|
+
var _a, _b;
|
|
975
|
+
this.setNavigationBarElement();
|
|
976
|
+
if (!this.navigationBarElement)
|
|
977
|
+
return;
|
|
978
|
+
(_a = this.homeBtnElement) === null || _a === void 0 ? void 0 : _a.addEventListener('click', this.toHomeFn.bind(this));
|
|
979
|
+
(_b = this.backBtnElement) === null || _b === void 0 ? void 0 : _b.addEventListener('click', this.backFn.bind(this));
|
|
980
|
+
}
|
|
981
|
+
setNavigationBarElement() {
|
|
982
|
+
this.navigationBarElement = document.getElementById('taro-navigation-bar');
|
|
983
|
+
}
|
|
984
|
+
load() {
|
|
985
|
+
this.setCacheValue();
|
|
986
|
+
this.setTitle();
|
|
987
|
+
this.setNavigationBarVisible();
|
|
988
|
+
this.setFnBtnState();
|
|
989
|
+
this.setNavigationBarBackground();
|
|
990
|
+
this.setNavigationBarTextStyle();
|
|
991
|
+
this.setNavigationLoading();
|
|
992
|
+
}
|
|
993
|
+
setCacheValue() {
|
|
994
|
+
const currentPage = this.pageContext.originPathname;
|
|
995
|
+
if (typeof this.cache[currentPage] !== 'object') {
|
|
996
|
+
this.cache[currentPage] = {};
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
setFnBtnState() {
|
|
1000
|
+
const currentRouter = this.pageContext.currentPage;
|
|
1001
|
+
if (this.pageContext.isTabBar(currentRouter) || this.pageContext.homePage === currentRouter) {
|
|
1002
|
+
this.fnBtnToggleToNone();
|
|
1003
|
+
}
|
|
1004
|
+
else if (stacks.length > 1) {
|
|
1005
|
+
this.fnBtnToggleToBack();
|
|
1006
|
+
}
|
|
1007
|
+
else {
|
|
1008
|
+
this.fnBtnToggleToHome();
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
shiftLoadingState(show) {
|
|
1012
|
+
if (!this.loadingElement)
|
|
1013
|
+
return;
|
|
1014
|
+
if (show) {
|
|
1015
|
+
this.loadingElement.classList.add('taro-navigation-bar-loading-show');
|
|
1016
|
+
}
|
|
1017
|
+
else {
|
|
1018
|
+
this.loadingElement.classList.remove('taro-navigation-bar-loading-show');
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
setNavigationLoading(show) {
|
|
1022
|
+
var _a;
|
|
1023
|
+
if (!this.navigationBarElement)
|
|
1024
|
+
return;
|
|
1025
|
+
const currentPage = this.pageContext.originPathname;
|
|
1026
|
+
let isShow;
|
|
1027
|
+
if (typeof show === 'boolean') {
|
|
1028
|
+
isShow = show;
|
|
1029
|
+
this.cache[currentPage] &&
|
|
1030
|
+
(this.cache[currentPage].loading = isShow);
|
|
1031
|
+
}
|
|
1032
|
+
else {
|
|
1033
|
+
const cacheValue = (_a = this.cache[currentPage]) === null || _a === void 0 ? void 0 : _a.loading;
|
|
1034
|
+
if (typeof cacheValue === 'boolean') {
|
|
1035
|
+
isShow = cacheValue;
|
|
1036
|
+
}
|
|
1037
|
+
else {
|
|
1038
|
+
// 默认值为 false
|
|
1039
|
+
isShow = false;
|
|
1040
|
+
this.cache[currentPage] &&
|
|
1041
|
+
(this.cache[currentPage].loading = isShow);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
this.shiftLoadingState(isShow);
|
|
1045
|
+
}
|
|
1046
|
+
setNavigationBarBackground(backgroundColor) {
|
|
1047
|
+
var _a, _b, _c;
|
|
1048
|
+
if (!this.navigationBarElement)
|
|
1049
|
+
return;
|
|
1050
|
+
const currentPage = this.pageContext.originPathname;
|
|
1051
|
+
let color;
|
|
1052
|
+
if (typeof backgroundColor === 'string') {
|
|
1053
|
+
color = backgroundColor;
|
|
1054
|
+
this.cache[currentPage] &&
|
|
1055
|
+
(this.cache[currentPage].backgroundColor = color);
|
|
1056
|
+
}
|
|
1057
|
+
else {
|
|
1058
|
+
const cacheValue = (_a = this.cache[currentPage]) === null || _a === void 0 ? void 0 : _a.backgroundColor;
|
|
1059
|
+
if (typeof cacheValue === 'string') {
|
|
1060
|
+
color = cacheValue;
|
|
1061
|
+
}
|
|
1062
|
+
else {
|
|
1063
|
+
color = ((_c = (_b = this.pageContext.config) === null || _b === void 0 ? void 0 : _b.window) === null || _c === void 0 ? void 0 : _c.navigationBarBackgroundColor) || '#000000';
|
|
1064
|
+
this.cache[currentPage] &&
|
|
1065
|
+
(this.cache[currentPage].backgroundColor = color);
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
this.navigationBarElement.style.background = color;
|
|
1069
|
+
}
|
|
1070
|
+
setNavigationBarTextStyle(fontColor) {
|
|
1071
|
+
var _a, _b, _c;
|
|
1072
|
+
if (!this.navigationBarElement)
|
|
1073
|
+
return;
|
|
1074
|
+
const currentPage = this.pageContext.originPathname;
|
|
1075
|
+
let color;
|
|
1076
|
+
if (typeof fontColor === 'string') {
|
|
1077
|
+
color = fontColor;
|
|
1078
|
+
this.cache[currentPage] &&
|
|
1079
|
+
(this.cache[currentPage].fontColor = color);
|
|
1080
|
+
}
|
|
1081
|
+
else {
|
|
1082
|
+
const cacheValue = (_a = this.cache[currentPage]) === null || _a === void 0 ? void 0 : _a.fontColor;
|
|
1083
|
+
if (typeof cacheValue === 'string') {
|
|
1084
|
+
color = cacheValue;
|
|
1085
|
+
}
|
|
1086
|
+
else {
|
|
1087
|
+
color = ((_c = (_b = this.pageContext.config) === null || _b === void 0 ? void 0 : _b.window) === null || _c === void 0 ? void 0 : _c.navigationBarTextStyle) || 'white';
|
|
1088
|
+
this.cache[currentPage] &&
|
|
1089
|
+
(this.cache[currentPage].fontColor = color);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
this.navigationBarElement.style.color = color;
|
|
1093
|
+
}
|
|
1094
|
+
setTitle(title) {
|
|
1095
|
+
var _a, _b, _c;
|
|
1096
|
+
const currentPage = this.pageContext.originPathname;
|
|
1097
|
+
let proceedTitle;
|
|
1098
|
+
if (typeof title === 'string') {
|
|
1099
|
+
proceedTitle = title;
|
|
1100
|
+
this.cache[currentPage] &&
|
|
1101
|
+
(this.cache[currentPage].title = proceedTitle);
|
|
1102
|
+
}
|
|
1103
|
+
else {
|
|
1104
|
+
const cacheValue = (_a = this.cache[currentPage]) === null || _a === void 0 ? void 0 : _a.title;
|
|
1105
|
+
if (typeof cacheValue === 'string') {
|
|
1106
|
+
proceedTitle = cacheValue;
|
|
1107
|
+
}
|
|
1108
|
+
else {
|
|
1109
|
+
proceedTitle = (_c = (_b = this.pageContext.pageConfig) === null || _b === void 0 ? void 0 : _b.navigationBarTitleText) !== null && _c !== void 0 ? _c : document.title;
|
|
1110
|
+
this.cache[currentPage] &&
|
|
1111
|
+
(this.cache[currentPage].title = proceedTitle);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
if (process.env.SUPPORT_DINGTALK_NAVIGATE !== 'disabled' && isDingTalk()) {
|
|
1115
|
+
if (!this.isLoadDdEntry) {
|
|
1116
|
+
this.isLoadDdEntry = true;
|
|
1117
|
+
require('dingtalk-jsapi/platform');
|
|
1118
|
+
}
|
|
1119
|
+
const setDingTitle = require('dingtalk-jsapi/api/biz/navigation/setTitle').default;
|
|
1120
|
+
setDingTitle({ proceedTitle });
|
|
1121
|
+
}
|
|
1122
|
+
document.title = proceedTitle;
|
|
1123
|
+
if (!this.titleElement)
|
|
1124
|
+
return;
|
|
1125
|
+
this.titleElement.innerHTML = proceedTitle;
|
|
1126
|
+
}
|
|
1127
|
+
fnBtnToggleToHome() {
|
|
1128
|
+
if (!this.navigationBarElement)
|
|
1129
|
+
return;
|
|
1130
|
+
this.navigationBarElement.classList.add('taro-navigation-bar-home-icon');
|
|
1131
|
+
this.navigationBarElement.classList.remove('taro-navigation-bar-back-icon');
|
|
1132
|
+
}
|
|
1133
|
+
fnBtnToggleToBack() {
|
|
1134
|
+
if (!this.navigationBarElement)
|
|
1135
|
+
return;
|
|
1136
|
+
this.navigationBarElement.classList.remove('taro-navigation-bar-home-icon');
|
|
1137
|
+
this.navigationBarElement.classList.add('taro-navigation-bar-back-icon');
|
|
1138
|
+
}
|
|
1139
|
+
fnBtnToggleToNone() {
|
|
1140
|
+
if (!this.navigationBarElement)
|
|
1141
|
+
return;
|
|
1142
|
+
this.navigationBarElement.classList.remove('taro-navigation-bar-home-icon');
|
|
1143
|
+
this.navigationBarElement.classList.remove('taro-navigation-bar-back-icon');
|
|
1144
|
+
}
|
|
1145
|
+
setNavigationBarVisible(show) {
|
|
1146
|
+
var _a, _b;
|
|
1147
|
+
if (!this.navigationBarElement)
|
|
1148
|
+
return;
|
|
1149
|
+
let shouldShow;
|
|
1150
|
+
if (typeof show === 'boolean') {
|
|
1151
|
+
shouldShow = show;
|
|
1152
|
+
}
|
|
1153
|
+
else {
|
|
1154
|
+
shouldShow = (_a = this.pageContext.config.window) === null || _a === void 0 ? void 0 : _a.navigationStyle;
|
|
1155
|
+
if (typeof ((_b = this.pageContext.pageConfig) === null || _b === void 0 ? void 0 : _b.navigationStyle) === 'string') {
|
|
1156
|
+
shouldShow = this.pageContext.pageConfig.navigationStyle;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
if (shouldShow === 'default') {
|
|
1160
|
+
this.navigationBarElement.classList.add('taro-navigation-bar-show');
|
|
1161
|
+
this.navigationBarElement.classList.remove('taro-navigation-bar-hide');
|
|
1162
|
+
}
|
|
1163
|
+
else {
|
|
1164
|
+
this.navigationBarElement.classList.add('taro-navigation-bar-hide');
|
|
1165
|
+
this.navigationBarElement.classList.remove('taro-navigation-bar-show');
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
/* eslint-disable dot-notation */
|
|
1171
|
+
class PageHandler {
|
|
1172
|
+
constructor(config, history) {
|
|
1173
|
+
this.history = history;
|
|
1174
|
+
this.defaultAnimation = { duration: 300, delay: 50 };
|
|
1175
|
+
this.config = config;
|
|
1176
|
+
this.homePage = getHomePage(this.routes[0].path, this.basename, this.customRoutes, this.config.entryPagePath);
|
|
1177
|
+
this.originHomePage = this.config.entryPagePath || this.routes[0].path || this.basename;
|
|
1178
|
+
this.mount();
|
|
1179
|
+
this.navigationBarHandler = new NavigationBarHandler(this);
|
|
1180
|
+
}
|
|
1181
|
+
get currentPage() {
|
|
1182
|
+
const routePath = getCurrentPage(this.routerMode, this.basename);
|
|
1183
|
+
return routePath === '/' ? this.homePage : routePath;
|
|
1184
|
+
}
|
|
1185
|
+
get appId() { return this.config.appId || 'app'; }
|
|
1186
|
+
get router() { return this.config.router || {}; }
|
|
1187
|
+
get routerMode() { return this.router.mode || 'hash'; }
|
|
1188
|
+
get customRoutes() { return this.router.customRoutes || {}; }
|
|
1189
|
+
get routes() { return this.config.routes || []; }
|
|
1190
|
+
get tabBarList() { var _a; return ((_a = this.config.tabBar) === null || _a === void 0 ? void 0 : _a.list) || []; }
|
|
1191
|
+
get PullDownRefresh() { return this.config.PullDownRefresh; }
|
|
1192
|
+
get animation() { var _a, _b; return (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.animation) !== null && _b !== void 0 ? _b : this.defaultAnimation; }
|
|
1193
|
+
get animationDelay() {
|
|
1194
|
+
var _a;
|
|
1195
|
+
return (typeof this.animation === 'object'
|
|
1196
|
+
? this.animation.delay
|
|
1197
|
+
: this.animation
|
|
1198
|
+
? (_a = this.defaultAnimation) === null || _a === void 0 ? void 0 : _a.delay
|
|
1199
|
+
: 0) || 0;
|
|
1200
|
+
}
|
|
1201
|
+
get animationDuration() {
|
|
1202
|
+
var _a;
|
|
1203
|
+
return (typeof this.animation === 'object'
|
|
1204
|
+
? this.animation.duration
|
|
1205
|
+
: this.animation
|
|
1206
|
+
? (_a = this.defaultAnimation) === null || _a === void 0 ? void 0 : _a.duration
|
|
1207
|
+
: 0) || 0;
|
|
1208
|
+
}
|
|
1209
|
+
set pathname(p) { this.router.pathname = p; }
|
|
1210
|
+
get pathname() { return this.router.pathname; }
|
|
1211
|
+
// Note: 把 pathname 转换为原始路径,主要是处理 customRoutes 和 basename
|
|
1212
|
+
get originPathname() { return routesAlias.getOrigin(addLeadingSlash(stripBasename(this.pathname, this.basename))); }
|
|
1213
|
+
get basename() { return this.router.basename || ''; }
|
|
1214
|
+
get pageConfig() {
|
|
1215
|
+
const homePage = addLeadingSlash(this.homePage);
|
|
1216
|
+
return this.routes.find(r => {
|
|
1217
|
+
const pagePath = addLeadingSlash(r.path);
|
|
1218
|
+
return [pagePath, homePage].includes(this.originPathname);
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
isTabBar(pathname) {
|
|
1222
|
+
var _a;
|
|
1223
|
+
const routePath = addLeadingSlash(stripBasename(pathname, this.basename)).split('?')[0];
|
|
1224
|
+
const pagePath = ((_a = Object.entries(this.customRoutes).find(([, target]) => {
|
|
1225
|
+
if (typeof target === 'string') {
|
|
1226
|
+
return target === routePath;
|
|
1227
|
+
}
|
|
1228
|
+
else if ((target === null || target === void 0 ? void 0 : target.length) > 0) {
|
|
1229
|
+
return target.includes(routePath);
|
|
1230
|
+
}
|
|
1231
|
+
return false;
|
|
1232
|
+
})) === null || _a === void 0 ? void 0 : _a[0]) || routePath;
|
|
1233
|
+
// Fix: 这里仍然需要使用 addLeadingSlash 来处理 pagePath,因为 pagePath 可能在未被增加统一前缀 / 的时候就进行比对
|
|
1234
|
+
return !!pagePath && this.tabBarList.some(t => addLeadingSlash(stripTrailing(t.pagePath)) === pagePath);
|
|
1235
|
+
}
|
|
1236
|
+
isDefaultNavigationStyle() {
|
|
1237
|
+
var _a, _b;
|
|
1238
|
+
let style = (_a = this.config.window) === null || _a === void 0 ? void 0 : _a.navigationStyle;
|
|
1239
|
+
if (typeof ((_b = this.pageConfig) === null || _b === void 0 ? void 0 : _b.navigationStyle) === 'string') {
|
|
1240
|
+
style = this.pageConfig.navigationStyle;
|
|
1241
|
+
}
|
|
1242
|
+
return style !== 'custom';
|
|
1243
|
+
}
|
|
1244
|
+
isSamePage(page) {
|
|
1245
|
+
const routePath = stripBasename(this.pathname, this.basename);
|
|
1246
|
+
const pagePath = stripBasename(page === null || page === void 0 ? void 0 : page.path, this.basename);
|
|
1247
|
+
return pagePath.startsWith(routePath + '?');
|
|
1248
|
+
}
|
|
1249
|
+
get search() {
|
|
1250
|
+
let search = '?';
|
|
1251
|
+
if (this.routerMode === 'hash') {
|
|
1252
|
+
const idx = location.hash.indexOf('?');
|
|
1253
|
+
if (idx > -1) {
|
|
1254
|
+
search = location.hash.slice(idx);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
else {
|
|
1258
|
+
search = location.search;
|
|
1259
|
+
}
|
|
1260
|
+
return search.substring(1);
|
|
1261
|
+
}
|
|
1262
|
+
get usingWindowScroll() {
|
|
1263
|
+
var _a;
|
|
1264
|
+
let usingWindowScroll = false;
|
|
1265
|
+
if (typeof ((_a = this.pageConfig) === null || _a === void 0 ? void 0 : _a.usingWindowScroll) === 'boolean') {
|
|
1266
|
+
usingWindowScroll = this.pageConfig.usingWindowScroll;
|
|
1267
|
+
}
|
|
1268
|
+
const win = window;
|
|
1269
|
+
win.__taroAppConfig || (win.__taroAppConfig = {});
|
|
1270
|
+
win.__taroAppConfig.usingWindowScroll = usingWindowScroll;
|
|
1271
|
+
return usingWindowScroll;
|
|
1272
|
+
}
|
|
1273
|
+
getQuery(stamp = '', search = '', options = {}) {
|
|
1274
|
+
search = search ? `${search}&${this.search}` : this.search;
|
|
1275
|
+
const query = search
|
|
1276
|
+
? queryString.parse(search, { decode: false })
|
|
1277
|
+
: {};
|
|
1278
|
+
query.stamp = stamp;
|
|
1279
|
+
return Object.assign(Object.assign({}, query), options);
|
|
1280
|
+
}
|
|
1281
|
+
mount() {
|
|
1282
|
+
setHistory(this.history, this.basename);
|
|
1283
|
+
this.pathname = history.location.pathname;
|
|
1284
|
+
// Note: 注入页面样式
|
|
1285
|
+
this.animation && loadAnimateStyle(this.animationDuration);
|
|
1286
|
+
loadRouterStyle(this.tabBarList.length > 1, this.usingWindowScroll, this.router.enhanceAnimation);
|
|
1287
|
+
}
|
|
1288
|
+
onReady(page, onLoad = true) {
|
|
1289
|
+
var _a;
|
|
1290
|
+
const pageEl = this.getPageContainer(page);
|
|
1291
|
+
if (pageEl && !(pageEl === null || pageEl === void 0 ? void 0 : pageEl['__isReady'])) {
|
|
1292
|
+
const el = pageEl.firstElementChild;
|
|
1293
|
+
const componentOnReady = el === null || el === void 0 ? void 0 : el['componentOnReady'];
|
|
1294
|
+
if (componentOnReady) {
|
|
1295
|
+
componentOnReady === null || componentOnReady === void 0 ? void 0 : componentOnReady().then(() => {
|
|
1296
|
+
requestAnimationFrame$1(() => {
|
|
1297
|
+
var _a;
|
|
1298
|
+
(_a = page.onReady) === null || _a === void 0 ? void 0 : _a.call(page);
|
|
1299
|
+
pageEl['__isReady'] = true;
|
|
1300
|
+
});
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
else {
|
|
1304
|
+
(_a = page.onReady) === null || _a === void 0 ? void 0 : _a.call(page);
|
|
1305
|
+
pageEl['__isReady'] = true;
|
|
1306
|
+
}
|
|
1307
|
+
onLoad && (pageEl['__page'] = page);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
load(page, pageConfig = {}, stampId, pageNo = 0) {
|
|
1311
|
+
var _a, _b;
|
|
1312
|
+
if (!page)
|
|
1313
|
+
return;
|
|
1314
|
+
// NOTE: 页面栈推入太晚可能导致 getCurrentPages 无法获取到当前页面实例
|
|
1315
|
+
stacks.push(page);
|
|
1316
|
+
const param = this.getQuery(stampId, '', page.options);
|
|
1317
|
+
let pageEl = this.getPageContainer(page);
|
|
1318
|
+
if (pageEl) {
|
|
1319
|
+
pageEl.classList.remove('taro_page_shade');
|
|
1320
|
+
this.isTabBar(this.pathname) && pageEl.classList.add('taro_tabbar_page');
|
|
1321
|
+
this.isDefaultNavigationStyle() && pageEl.classList.add('taro_navigation_page');
|
|
1322
|
+
this.addAnimation(pageEl, pageNo === 0);
|
|
1323
|
+
(_a = page.onShow) === null || _a === void 0 ? void 0 : _a.call(page);
|
|
1324
|
+
this.navigationBarHandler.load();
|
|
1325
|
+
this.bindPageEvents(page, pageConfig);
|
|
1326
|
+
this.triggerRouterChange();
|
|
1327
|
+
}
|
|
1328
|
+
else {
|
|
1329
|
+
// FIXME 在 iOS 端快速切换页面时,可能不会执行回调注入对应类名导致 TabBar 白屏
|
|
1330
|
+
(_b = page.onLoad) === null || _b === void 0 ? void 0 : _b.call(page, param, () => {
|
|
1331
|
+
var _a;
|
|
1332
|
+
pageEl = this.getPageContainer(page);
|
|
1333
|
+
this.isTabBar(this.pathname) && (pageEl === null || pageEl === void 0 ? void 0 : pageEl.classList.add('taro_tabbar_page'));
|
|
1334
|
+
this.isDefaultNavigationStyle() && (pageEl === null || pageEl === void 0 ? void 0 : pageEl.classList.add('taro_navigation_page'));
|
|
1335
|
+
this.addAnimation(pageEl, pageNo === 0);
|
|
1336
|
+
(_a = page.onShow) === null || _a === void 0 ? void 0 : _a.call(page);
|
|
1337
|
+
this.navigationBarHandler.load();
|
|
1338
|
+
this.onReady(page, true);
|
|
1339
|
+
this.bindPageEvents(page, pageConfig);
|
|
1340
|
+
this.triggerRouterChange();
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
unload(page, delta = 1, top = false) {
|
|
1345
|
+
var _a, _b, _c;
|
|
1346
|
+
if (!page)
|
|
1347
|
+
return;
|
|
1348
|
+
stacks.delta = --delta;
|
|
1349
|
+
stacks.pop();
|
|
1350
|
+
if (this.animation && top) {
|
|
1351
|
+
if (this.unloadTimer) {
|
|
1352
|
+
clearTimeout(this.unloadTimer);
|
|
1353
|
+
(_b = (_a = this.lastUnloadPage) === null || _a === void 0 ? void 0 : _a.onUnload) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
1354
|
+
this.unloadTimer = null;
|
|
1355
|
+
}
|
|
1356
|
+
this.lastUnloadPage = page;
|
|
1357
|
+
const pageEl = this.getPageContainer(page);
|
|
1358
|
+
pageEl === null || pageEl === void 0 ? void 0 : pageEl.classList.remove('taro_page_stationed');
|
|
1359
|
+
pageEl === null || pageEl === void 0 ? void 0 : pageEl.classList.remove('taro_page_show');
|
|
1360
|
+
if (pageEl) {
|
|
1361
|
+
pageEl.style.zIndex = '1';
|
|
1362
|
+
}
|
|
1363
|
+
this.unloadTimer = setTimeout(() => {
|
|
1364
|
+
var _a, _b;
|
|
1365
|
+
this.unloadTimer = null;
|
|
1366
|
+
(_b = (_a = this.lastUnloadPage) === null || _a === void 0 ? void 0 : _a.onUnload) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
1367
|
+
eventCenter.trigger('__taroPageOnShowAfterDestroyed');
|
|
1368
|
+
}, this.animationDuration);
|
|
1369
|
+
}
|
|
1370
|
+
else {
|
|
1371
|
+
const pageEl = this.getPageContainer(page);
|
|
1372
|
+
pageEl === null || pageEl === void 0 ? void 0 : pageEl.classList.remove('taro_page_stationed');
|
|
1373
|
+
pageEl === null || pageEl === void 0 ? void 0 : pageEl.classList.remove('taro_page_show');
|
|
1374
|
+
(_c = page === null || page === void 0 ? void 0 : page.onUnload) === null || _c === void 0 ? void 0 : _c.call(page);
|
|
1375
|
+
setTimeout(() => {
|
|
1376
|
+
eventCenter.trigger('__taroPageOnShowAfterDestroyed');
|
|
1377
|
+
}, 0);
|
|
1378
|
+
}
|
|
1379
|
+
if (delta >= 1)
|
|
1380
|
+
this.unload(stacks.last, delta);
|
|
1381
|
+
}
|
|
1382
|
+
show(page, pageConfig = {}, pageNo = 0) {
|
|
1383
|
+
var _a, _b;
|
|
1384
|
+
if (!page)
|
|
1385
|
+
return;
|
|
1386
|
+
const param = this.getQuery(page['$taroParams']['stamp'], '', page.options);
|
|
1387
|
+
let pageEl = this.getPageContainer(page);
|
|
1388
|
+
if (pageEl) {
|
|
1389
|
+
pageEl.classList.remove('taro_page_shade');
|
|
1390
|
+
this.addAnimation(pageEl, pageNo === 0);
|
|
1391
|
+
(_a = page.onShow) === null || _a === void 0 ? void 0 : _a.call(page);
|
|
1392
|
+
this.navigationBarHandler.load();
|
|
1393
|
+
this.bindPageEvents(page, pageConfig);
|
|
1394
|
+
this.triggerRouterChange();
|
|
1395
|
+
}
|
|
1396
|
+
else {
|
|
1397
|
+
(_b = page.onLoad) === null || _b === void 0 ? void 0 : _b.call(page, param, () => {
|
|
1398
|
+
var _a;
|
|
1399
|
+
pageEl = this.getPageContainer(page);
|
|
1400
|
+
this.addAnimation(pageEl, pageNo === 0);
|
|
1401
|
+
(_a = page.onShow) === null || _a === void 0 ? void 0 : _a.call(page);
|
|
1402
|
+
this.navigationBarHandler.load();
|
|
1403
|
+
this.onReady(page, false);
|
|
1404
|
+
this.bindPageEvents(page, pageConfig);
|
|
1405
|
+
this.triggerRouterChange();
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
hide(page, animation = false) {
|
|
1410
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1411
|
+
if (!page)
|
|
1412
|
+
return;
|
|
1413
|
+
// NOTE: 修复多页并发问题,此处可能因为路由跳转过快,执行时页面可能还没有创建成功
|
|
1414
|
+
const pageEl = this.getPageContainer(page);
|
|
1415
|
+
if (pageEl) {
|
|
1416
|
+
if (animation) {
|
|
1417
|
+
if (this.hideTimer) {
|
|
1418
|
+
clearTimeout(this.hideTimer);
|
|
1419
|
+
this.hideTimer = null;
|
|
1420
|
+
(_c = (_b = (_a = this.lastHidePage) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.add) === null || _c === void 0 ? void 0 : _c.call(_b, 'taro_page_shade');
|
|
1421
|
+
}
|
|
1422
|
+
this.lastHidePage = pageEl;
|
|
1423
|
+
this.hideTimer = setTimeout(() => {
|
|
1424
|
+
this.hideTimer = null;
|
|
1425
|
+
pageEl.classList.add('taro_page_shade');
|
|
1426
|
+
}, this.animationDuration + this.animationDelay);
|
|
1427
|
+
(_d = page.onHide) === null || _d === void 0 ? void 0 : _d.call(page);
|
|
1428
|
+
}
|
|
1429
|
+
else {
|
|
1430
|
+
if (this.hideTimer) {
|
|
1431
|
+
clearTimeout(this.hideTimer);
|
|
1432
|
+
this.hideTimer = null;
|
|
1433
|
+
(_g = (_f = (_e = this.lastHidePage) === null || _e === void 0 ? void 0 : _e.classList) === null || _f === void 0 ? void 0 : _f.add) === null || _g === void 0 ? void 0 : _g.call(_f, 'taro_page_shade');
|
|
1434
|
+
}
|
|
1435
|
+
(_h = page.onHide) === null || _h === void 0 ? void 0 : _h.call(page);
|
|
1436
|
+
pageEl.classList.add('taro_page_shade');
|
|
1437
|
+
this.lastHidePage = pageEl;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
else {
|
|
1441
|
+
setTimeout(() => this.hide(page), 0);
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
addAnimation(pageEl, first = false) {
|
|
1445
|
+
if (!pageEl)
|
|
1446
|
+
return;
|
|
1447
|
+
if (this.animation && !first) {
|
|
1448
|
+
setTimeout(() => {
|
|
1449
|
+
pageEl.classList.add('taro_page_show');
|
|
1450
|
+
setTimeout(() => {
|
|
1451
|
+
pageEl.classList.add('taro_page_stationed');
|
|
1452
|
+
}, this.animationDuration);
|
|
1453
|
+
}, this.animationDelay);
|
|
1454
|
+
}
|
|
1455
|
+
else {
|
|
1456
|
+
pageEl.classList.add('taro_page_show');
|
|
1457
|
+
pageEl.classList.add('taro_page_stationed');
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
getPageContainer(page) {
|
|
1461
|
+
var _a;
|
|
1462
|
+
const path = page ? page === null || page === void 0 ? void 0 : page.path : (_a = Current.page) === null || _a === void 0 ? void 0 : _a.path;
|
|
1463
|
+
const id = path === null || path === void 0 ? void 0 : path.replace(/([^a-z0-9\u00a0-\uffff_-])/ig, '\\$1');
|
|
1464
|
+
if (page) {
|
|
1465
|
+
return document.querySelector(`.taro_page#${id}`);
|
|
1466
|
+
}
|
|
1467
|
+
const el = (id
|
|
1468
|
+
? document.querySelector(`.taro_page#${id}`)
|
|
1469
|
+
: document.querySelector('.taro_page') ||
|
|
1470
|
+
document.querySelector('.taro_router'));
|
|
1471
|
+
return el;
|
|
1472
|
+
}
|
|
1473
|
+
getScrollingElement(page) {
|
|
1474
|
+
if (this.usingWindowScroll)
|
|
1475
|
+
return window;
|
|
1476
|
+
return this.getPageContainer(page) || window;
|
|
1477
|
+
}
|
|
1478
|
+
bindPageEvents(page, config = {}) {
|
|
1479
|
+
var _a;
|
|
1480
|
+
const scrollEl = this.getScrollingElement(page);
|
|
1481
|
+
const distance = config.onReachBottomDistance || ((_a = this.config.window) === null || _a === void 0 ? void 0 : _a.onReachBottomDistance) || 50;
|
|
1482
|
+
bindPageScroll(page, scrollEl, distance);
|
|
1483
|
+
bindPageResize(page);
|
|
1484
|
+
}
|
|
1485
|
+
triggerRouterChange() {
|
|
1486
|
+
/**
|
|
1487
|
+
* @tarojs/runtime 中生命周期跑在 promise 中,所以这里需要 setTimeout 延迟事件调用
|
|
1488
|
+
* TODO 考虑将生命周期返回 Promise,用于处理相关事件调用顺序
|
|
1489
|
+
*/
|
|
1490
|
+
setTimeout(() => {
|
|
1491
|
+
eventCenter.trigger('__afterTaroRouterChange', {
|
|
1492
|
+
toLocation: {
|
|
1493
|
+
path: this.pathname
|
|
1494
|
+
}
|
|
1495
|
+
});
|
|
1496
|
+
}, 0);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
const createStampId = incrementId();
|
|
1501
|
+
let launchStampId = createStampId();
|
|
1502
|
+
function createRouter(history, app, config, framework) {
|
|
1503
|
+
var _a, _b;
|
|
1504
|
+
if (typeof app.onUnhandledRejection === 'function') {
|
|
1505
|
+
window.addEventListener('unhandledrejection', app.onUnhandledRejection);
|
|
1506
|
+
}
|
|
1507
|
+
RouterConfig.config = config;
|
|
1508
|
+
const handler = new PageHandler(config, history);
|
|
1509
|
+
// Note: 弱网情况下,快速切换 tab,会造成同个页面实例被多次挂在到页面上,原因是资源请求是异步的,短时间内发起多个请求,
|
|
1510
|
+
// 会在资源加载完成后,同时走到挂载的逻辑,造成 pageStampId 更新不及时,两个 page 的Id 相同,后面很多操作是通过 getElementById 来进行的
|
|
1511
|
+
// 所以需要加一个锁来应对这个情况
|
|
1512
|
+
const pageLock = {};
|
|
1513
|
+
routesAlias.set(handler.router.customRoutes);
|
|
1514
|
+
const basename = handler.router.basename;
|
|
1515
|
+
const routes = handler.routes.map(route => {
|
|
1516
|
+
const routePath = addLeadingSlash(route.path);
|
|
1517
|
+
const paths = routesAlias.getAll(routePath);
|
|
1518
|
+
return {
|
|
1519
|
+
path: paths.length < 1 ? routePath : paths,
|
|
1520
|
+
action: route.load
|
|
1521
|
+
};
|
|
1522
|
+
});
|
|
1523
|
+
const router = new UniversalRouter(routes, { baseUrl: basename || '' });
|
|
1524
|
+
const launchParam = {
|
|
1525
|
+
path: handler.currentPage,
|
|
1526
|
+
query: handler.getQuery(launchStampId),
|
|
1527
|
+
scene: 0,
|
|
1528
|
+
shareTicket: '',
|
|
1529
|
+
referrerInfo: {}
|
|
1530
|
+
};
|
|
1531
|
+
eventCenter.trigger('__taroRouterLaunch', launchParam);
|
|
1532
|
+
(_a = app.onLaunch) === null || _a === void 0 ? void 0 : _a.call(app, launchParam);
|
|
1533
|
+
app.onError && window.addEventListener('error', e => { var _a; return (_a = app.onError) === null || _a === void 0 ? void 0 : _a.call(app, e.message); });
|
|
1534
|
+
const render = (_c) => __awaiter(this, [_c], void 0, function* ({ location, action }) {
|
|
1535
|
+
var _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1536
|
+
// Note: 由于下面有异步加载操作 先不要在这里去设置 handler.pathname
|
|
1537
|
+
const currentPathname = decodeURI(location.pathname);
|
|
1538
|
+
if ((_d = window.__taroAppConfig) === null || _d === void 0 ? void 0 : _d.usingWindowScroll)
|
|
1539
|
+
window.scrollTo(0, 0);
|
|
1540
|
+
eventCenter.trigger('__taroRouterChange', {
|
|
1541
|
+
toLocation: {
|
|
1542
|
+
path: currentPathname
|
|
1543
|
+
}
|
|
1544
|
+
});
|
|
1545
|
+
let element, context, params;
|
|
1546
|
+
const routerPath = handler.router.forcePath || currentPathname;
|
|
1547
|
+
pageLock[routerPath] = typeof pageLock[routerPath] === 'number' ? pageLock[routerPath] + 1 : 1;
|
|
1548
|
+
const currentLock = pageLock[routerPath];
|
|
1549
|
+
let postLock;
|
|
1550
|
+
try {
|
|
1551
|
+
const result = yield router.resolve(routerPath);
|
|
1552
|
+
[element, context, params] = yield Promise.all(result);
|
|
1553
|
+
postLock = pageLock[routerPath];
|
|
1554
|
+
}
|
|
1555
|
+
catch (error) {
|
|
1556
|
+
if (error.status === 404) {
|
|
1557
|
+
const notFoundEvent = {
|
|
1558
|
+
isEntryPage: stacks.length === 0,
|
|
1559
|
+
path: currentPathname,
|
|
1560
|
+
query: handler.getQuery(createStampId()),
|
|
1561
|
+
};
|
|
1562
|
+
(_e = app.onPageNotFound) === null || _e === void 0 ? void 0 : _e.call(app, notFoundEvent);
|
|
1563
|
+
eventCenter.trigger('__taroRouterNotFound', notFoundEvent);
|
|
1564
|
+
}
|
|
1565
|
+
else if (/Loading hot update .* failed./.test(error.message)) {
|
|
1566
|
+
// NOTE: webpack5 与 prebundle 搭配使用时,开发环境下初次启动时偶发错误,由于 HMR 加载 chunk hash 错误,导致热更新失败
|
|
1567
|
+
window.location.reload();
|
|
1568
|
+
}
|
|
1569
|
+
else {
|
|
1570
|
+
throw error;
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
if (!element || currentLock !== postLock)
|
|
1574
|
+
return;
|
|
1575
|
+
// Note: 异步结束后,在设置 handler.pathname
|
|
1576
|
+
// context.pathname 在 universal-router 被处理过了,是发起资源请求的时候传入的 pathname,即 await router.resolve(routerPath) 这个 routerPath
|
|
1577
|
+
handler.pathname = context.pathname;
|
|
1578
|
+
const { pathname, pageConfig } = handler;
|
|
1579
|
+
let enablePullDownRefresh = ((_f = config === null || config === void 0 ? void 0 : config.window) === null || _f === void 0 ? void 0 : _f.enablePullDownRefresh) || false;
|
|
1580
|
+
let navigationStyle = ((_g = config === null || config === void 0 ? void 0 : config.window) === null || _g === void 0 ? void 0 : _g.navigationStyle) || 'default';
|
|
1581
|
+
let navigationBarTextStyle = ((_h = config === null || config === void 0 ? void 0 : config.window) === null || _h === void 0 ? void 0 : _h.navigationBarTextStyle) || 'white';
|
|
1582
|
+
let navigationBarBackgroundColor = ((_j = config === null || config === void 0 ? void 0 : config.window) === null || _j === void 0 ? void 0 : _j.navigationBarBackgroundColor) || '#000000';
|
|
1583
|
+
if (pageConfig) {
|
|
1584
|
+
if (typeof pageConfig.enablePullDownRefresh === 'boolean') {
|
|
1585
|
+
enablePullDownRefresh = pageConfig.enablePullDownRefresh;
|
|
1586
|
+
}
|
|
1587
|
+
if (typeof pageConfig.navigationStyle === 'string') {
|
|
1588
|
+
navigationStyle = pageConfig.navigationStyle;
|
|
1589
|
+
}
|
|
1590
|
+
if (typeof pageConfig.navigationBarTextStyle === 'string') {
|
|
1591
|
+
navigationBarTextStyle = pageConfig.navigationBarTextStyle;
|
|
1592
|
+
}
|
|
1593
|
+
if (typeof pageConfig.navigationBarBackgroundColor === 'string') {
|
|
1594
|
+
navigationBarBackgroundColor = pageConfig.navigationBarBackgroundColor;
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
eventCenter.trigger('__taroSetNavigationStyle', navigationStyle, navigationBarTextStyle, navigationBarBackgroundColor);
|
|
1598
|
+
const currentPage = Current.page;
|
|
1599
|
+
const methodName = (_k = stacks.method) !== null && _k !== void 0 ? _k : '';
|
|
1600
|
+
const cacheTabs = stacks.getTabs();
|
|
1601
|
+
let shouldLoad = false;
|
|
1602
|
+
stacks.method = '';
|
|
1603
|
+
if (methodName === 'reLaunch') {
|
|
1604
|
+
handler.unload(currentPage, stacks.length);
|
|
1605
|
+
// NOTE: 同时卸载缓存在tabs里面的页面实例
|
|
1606
|
+
for (const key in cacheTabs) {
|
|
1607
|
+
if (cacheTabs[key]) {
|
|
1608
|
+
handler.unload(cacheTabs[key]);
|
|
1609
|
+
stacks.removeTab(key);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
shouldLoad = true;
|
|
1613
|
+
}
|
|
1614
|
+
else if (currentPage && handler.isTabBar(pathname)) {
|
|
1615
|
+
if (handler.isSamePage(currentPage))
|
|
1616
|
+
return;
|
|
1617
|
+
if (handler.isTabBar(currentPage.path)) {
|
|
1618
|
+
// NOTE: 从 tabBar 页面切换到 tabBar 页面
|
|
1619
|
+
handler.hide(currentPage);
|
|
1620
|
+
stacks.pushTab(currentPage.path.split('?')[0]);
|
|
1621
|
+
}
|
|
1622
|
+
else if (stacks.length > 0) {
|
|
1623
|
+
const firstIns = stacks.getItem(0);
|
|
1624
|
+
if (handler.isTabBar(firstIns.path)) {
|
|
1625
|
+
handler.unload(currentPage, stacks.length - 1, true);
|
|
1626
|
+
stacks.pushTab(firstIns.path.split('?')[0]);
|
|
1627
|
+
}
|
|
1628
|
+
else {
|
|
1629
|
+
handler.unload(currentPage, stacks.length, true);
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
if (cacheTabs[pathname]) {
|
|
1633
|
+
stacks.popTab(pathname);
|
|
1634
|
+
return handler.show(stacks.getItem(0), pageConfig, 0);
|
|
1635
|
+
}
|
|
1636
|
+
shouldLoad = true;
|
|
1637
|
+
}
|
|
1638
|
+
else if (action === 'POP') {
|
|
1639
|
+
// NOTE: 浏览器事件退后多次时,该事件只会被触发一次
|
|
1640
|
+
const prevIndex = stacks.getPrevIndex(pathname);
|
|
1641
|
+
const delta = stacks.getDelta(pathname);
|
|
1642
|
+
// NOTE: Safari 内核浏览器在非应用页面返回上一页时,会触发额外的 POP 事件,此处需避免当前页面被错误卸载
|
|
1643
|
+
if (currentPage !== stacks.getItem(prevIndex)) {
|
|
1644
|
+
handler.unload(currentPage, delta, prevIndex > -1);
|
|
1645
|
+
if (prevIndex > -1) {
|
|
1646
|
+
eventCenter.once('__taroPageOnShowAfterDestroyed', () => {
|
|
1647
|
+
handler.show(stacks.getItem(prevIndex), pageConfig, prevIndex);
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
else {
|
|
1651
|
+
shouldLoad = true;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
else if (action === 'REPLACE') {
|
|
1656
|
+
const delta = stacks.getDelta(pathname);
|
|
1657
|
+
// NOTE: 页面路由记录并不会清空,只是移除掉缓存的 stack 以及页面
|
|
1658
|
+
handler.unload(currentPage, delta);
|
|
1659
|
+
shouldLoad = true;
|
|
1660
|
+
}
|
|
1661
|
+
else if (action === 'PUSH') {
|
|
1662
|
+
handler.hide(currentPage, true);
|
|
1663
|
+
shouldLoad = true;
|
|
1664
|
+
}
|
|
1665
|
+
if (shouldLoad || stacks.length < 1) {
|
|
1666
|
+
const el = (_l = element.default) !== null && _l !== void 0 ? _l : element;
|
|
1667
|
+
const loadConfig = Object.assign({}, pageConfig);
|
|
1668
|
+
const stacksIndex = stacks.length;
|
|
1669
|
+
delete loadConfig['path'];
|
|
1670
|
+
delete loadConfig['load'];
|
|
1671
|
+
let pageStampId = '';
|
|
1672
|
+
if (launchStampId) {
|
|
1673
|
+
pageStampId = launchStampId;
|
|
1674
|
+
launchStampId = '';
|
|
1675
|
+
}
|
|
1676
|
+
else {
|
|
1677
|
+
pageStampId = createStampId();
|
|
1678
|
+
}
|
|
1679
|
+
const page = createPageConfig(enablePullDownRefresh ? hooks.call('createPullDownComponent', el, pathname, framework, handler.PullDownRefresh, pageStampId) : el, pathname + stringify(handler.getQuery(pageStampId)), {}, loadConfig);
|
|
1680
|
+
if (params)
|
|
1681
|
+
page.options = params;
|
|
1682
|
+
handler.load(page, pageConfig, pageStampId, stacksIndex);
|
|
1683
|
+
}
|
|
1684
|
+
});
|
|
1685
|
+
const routePath = addLeadingSlash(stripBasename(history.location.pathname, handler.basename));
|
|
1686
|
+
if (routePath === '/') {
|
|
1687
|
+
history.replace(prependBasename(handler.homePage + history.location.search));
|
|
1688
|
+
}
|
|
1689
|
+
render({ location: history.location, action: Action.Push });
|
|
1690
|
+
(_b = app.onShow) === null || _b === void 0 ? void 0 : _b.call(app, launchParam);
|
|
1691
|
+
window.addEventListener('visibilitychange', () => {
|
|
1692
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1693
|
+
const currentPath = ((_a = Current.page) === null || _a === void 0 ? void 0 : _a.path) || '';
|
|
1694
|
+
const path = currentPath.substring(0, currentPath.indexOf('?'));
|
|
1695
|
+
const param = {};
|
|
1696
|
+
// app的 onShow/onHide 生命周期的路径信息为当前页面的路径
|
|
1697
|
+
Object.assign(param, launchParam, { path });
|
|
1698
|
+
if (document.visibilityState === 'visible') {
|
|
1699
|
+
(_b = app.onShow) === null || _b === void 0 ? void 0 : _b.call(app, param);
|
|
1700
|
+
// 单页面app显示后一刻会触发当前 page.onShow 生命周期函数
|
|
1701
|
+
(_d = (_c = Current.page) === null || _c === void 0 ? void 0 : _c.onShow) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
1702
|
+
}
|
|
1703
|
+
else {
|
|
1704
|
+
// 单页面app隐藏前一刻会触发当前 page.onHide 生命周期函数
|
|
1705
|
+
if ((_e = Current.page) === null || _e === void 0 ? void 0 : _e.path) {
|
|
1706
|
+
safeExecute((_f = Current.page) === null || _f === void 0 ? void 0 : _f.path, 'onHide');
|
|
1707
|
+
}
|
|
1708
|
+
(_g = app.onHide) === null || _g === void 0 ? void 0 : _g.call(app, param);
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
return history.listen(render);
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
function handleAppMount(config, _, appId = config.appId || 'app') {
|
|
1715
|
+
let app = document.getElementById(appId);
|
|
1716
|
+
let isPosition = true;
|
|
1717
|
+
if (!app) {
|
|
1718
|
+
app = document.createElement('div');
|
|
1719
|
+
app.id = appId;
|
|
1720
|
+
isPosition = false;
|
|
1721
|
+
}
|
|
1722
|
+
const appWrapper = ((app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body);
|
|
1723
|
+
app.classList.add('taro_router');
|
|
1724
|
+
if (!isPosition)
|
|
1725
|
+
appWrapper.appendChild(app);
|
|
1726
|
+
initNavigationBar(config, appWrapper);
|
|
1727
|
+
}
|
|
1728
|
+
function handleAppMountWithTabbar(config, history, appId = config.appId || 'app') {
|
|
1729
|
+
let app = document.getElementById(appId);
|
|
1730
|
+
let isPosition = true;
|
|
1731
|
+
if (!app) {
|
|
1732
|
+
app = document.createElement('div');
|
|
1733
|
+
app.id = appId;
|
|
1734
|
+
isPosition = false;
|
|
1735
|
+
}
|
|
1736
|
+
const appWrapper = ((app === null || app === void 0 ? void 0 : app.parentNode) || (app === null || app === void 0 ? void 0 : app.parentElement) || document.body);
|
|
1737
|
+
app.classList.add('taro_router');
|
|
1738
|
+
const container = document.createElement('div');
|
|
1739
|
+
container.classList.add('taro-tabbar__container');
|
|
1740
|
+
container.id = 'container';
|
|
1741
|
+
const panel = document.createElement('div');
|
|
1742
|
+
panel.classList.add('taro-tabbar__panel');
|
|
1743
|
+
panel.appendChild(app.cloneNode(true));
|
|
1744
|
+
container.appendChild(panel);
|
|
1745
|
+
if (!isPosition) {
|
|
1746
|
+
appWrapper.appendChild(container);
|
|
1747
|
+
}
|
|
1748
|
+
else {
|
|
1749
|
+
appWrapper.replaceChild(container, app);
|
|
1750
|
+
}
|
|
1751
|
+
initTabbar(config, history);
|
|
1752
|
+
initNavigationBar(config, container);
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
export { createMpaHistory, createMultiRouter, createRouter, getCurrentPages, handleAppMount, handleAppMountWithTabbar, history, isDingTalk, isWeixin, navigateBack, navigateTo, prependBasename, reLaunch, redirectTo, routesAlias, setHistory, setHistoryMode, setMpaTitle, setNavigationBarLoading, setNavigationBarStyle, setTitle, switchTab };
|