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,2162 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace canvasToTempFilePath {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件实例 (canvas type="2d" 时使用该属性)。 */
|
|
7
|
+
canvas?: Canvas
|
|
8
|
+
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件的 canvas-id */
|
|
9
|
+
canvasId?: string
|
|
10
|
+
/** 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 */
|
|
11
|
+
quality?: number
|
|
12
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
13
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
14
|
+
/** 输出的图片的高度 */
|
|
15
|
+
destHeight?: number
|
|
16
|
+
/** 输出的图片的宽度 */
|
|
17
|
+
destWidth?: number
|
|
18
|
+
/** 接口调用失败的回调函数 */
|
|
19
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
20
|
+
/** 目标文件的类型
|
|
21
|
+
* @default "png"
|
|
22
|
+
*/
|
|
23
|
+
fileType?: keyof FileType
|
|
24
|
+
/** 指定的画布区域的高度 */
|
|
25
|
+
height?: number
|
|
26
|
+
/** 接口调用成功的回调函数 */
|
|
27
|
+
success?: (result: SuccessCallbackResult) => void
|
|
28
|
+
/** 指定的画布区域的宽度 */
|
|
29
|
+
width?: number
|
|
30
|
+
/** 指定的画布区域的左上角横坐标 */
|
|
31
|
+
x?: number
|
|
32
|
+
/** 指定的画布区域的左上角纵坐标 */
|
|
33
|
+
y?: number
|
|
34
|
+
}
|
|
35
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
36
|
+
/** 生成文件的临时路径 */
|
|
37
|
+
tempFilePath: string
|
|
38
|
+
/** 图片路径(本地临时文件)。
|
|
39
|
+
* @supported alipay
|
|
40
|
+
*/
|
|
41
|
+
apFilePath?: string
|
|
42
|
+
/** 调用结果 */
|
|
43
|
+
errMsg: string
|
|
44
|
+
}
|
|
45
|
+
interface FileType {
|
|
46
|
+
/** jpg 图片 */
|
|
47
|
+
jpg
|
|
48
|
+
/** png 图片 */
|
|
49
|
+
png
|
|
50
|
+
}
|
|
51
|
+
interface CanvasProps {
|
|
52
|
+
/** 指定 canvas 类型,支持 2d 和 webgl */
|
|
53
|
+
type?: string
|
|
54
|
+
/** canvas 组件的唯一标识符,若指定了 type 则无需再指定该属性 */
|
|
55
|
+
canvasId?: string
|
|
56
|
+
/** 当在 canvas 中移动时且有绑定手势事件时,禁止屏幕滚动以及下拉刷新
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
disableScroll?: boolean
|
|
60
|
+
/** 手指触摸动作开始 */
|
|
61
|
+
onTouchStart?: TaroGeneral.CommonEventFunction
|
|
62
|
+
/** 手指触摸后移动 */
|
|
63
|
+
onTouchMove?: TaroGeneral.CommonEventFunction
|
|
64
|
+
/** 手指触摸动作结束 */
|
|
65
|
+
onTouchEnd?: TaroGeneral.CommonEventFunction
|
|
66
|
+
/** 手指触摸动作被打断,如来电提醒,弹窗 */
|
|
67
|
+
onTouchCancel?: TaroGeneral.CommonEventFunction
|
|
68
|
+
/** 手指长按 500ms 之后触发,触发了长按事件后进行移动不会触发屏幕的滚动 */
|
|
69
|
+
onLongTap?: TaroGeneral.CommonEventFunction
|
|
70
|
+
/** 当发生错误时触发 error 事件,detail = {errMsg: 'something wrong'} */
|
|
71
|
+
onError?: TaroGeneral.CommonEventFunction<CanvasProps.onErrorEventDetail>
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
namespace CanvasProps {
|
|
75
|
+
interface onErrorEventDetail {
|
|
76
|
+
errMsg: string
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
namespace canvasPutImageData {
|
|
81
|
+
interface Option {
|
|
82
|
+
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件的 canvas-id 属性。 */
|
|
83
|
+
canvasId: string
|
|
84
|
+
/** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
|
|
85
|
+
data: Uint8ClampedArray
|
|
86
|
+
/** 源图像数据矩形区域的高度 */
|
|
87
|
+
height: number
|
|
88
|
+
/** 源图像数据矩形区域的宽度 */
|
|
89
|
+
width: number
|
|
90
|
+
/** 源图像数据在目标画布中的位置偏移量(x 轴方向的偏移量) */
|
|
91
|
+
x: number
|
|
92
|
+
/** 源图像数据在目标画布中的位置偏移量(y 轴方向的偏移量) */
|
|
93
|
+
y: number
|
|
94
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
95
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
96
|
+
/** 接口调用失败的回调函数 */
|
|
97
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
98
|
+
/** 接口调用成功的回调函数 */
|
|
99
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
namespace canvasGetImageData {
|
|
103
|
+
interface Option {
|
|
104
|
+
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件的 `canvas-id` 属性。 */
|
|
105
|
+
canvasId: string
|
|
106
|
+
/** 将要被提取的图像数据矩形区域的高度 */
|
|
107
|
+
height: number
|
|
108
|
+
/** 将要被提取的图像数据矩形区域的宽度 */
|
|
109
|
+
width: number
|
|
110
|
+
/** 将要被提取的图像数据矩形区域的左上角横坐标 */
|
|
111
|
+
x: number
|
|
112
|
+
/** 将要被提取的图像数据矩形区域的左上角纵坐标 */
|
|
113
|
+
y: number
|
|
114
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
115
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
116
|
+
/** 接口调用失败的回调函数 */
|
|
117
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
118
|
+
/** 接口调用成功的回调函数 */
|
|
119
|
+
success?: (result: SuccessCallbackResult) => void
|
|
120
|
+
}
|
|
121
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
122
|
+
/** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
|
|
123
|
+
data: Uint8ClampedArray
|
|
124
|
+
/** 图像数据矩形的高度 */
|
|
125
|
+
height: number
|
|
126
|
+
/** 图像数据矩形的宽度 */
|
|
127
|
+
width: number
|
|
128
|
+
/** 调用结果 */
|
|
129
|
+
errMsg: string
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
namespace createOffscreenCanvas {
|
|
134
|
+
interface Option {
|
|
135
|
+
/** 创建的离屏 canvas 类型
|
|
136
|
+
* @default: 'webgl'
|
|
137
|
+
*/
|
|
138
|
+
type?: 'webgl' | '2d'
|
|
139
|
+
/** 画布高度 */
|
|
140
|
+
height?: number
|
|
141
|
+
/** 画布宽度 */
|
|
142
|
+
width?: number
|
|
143
|
+
/** 在自定义组件下,当前组件实例的 this,以操作组件内 [canvas](/docs/components/canvas) 组件 */
|
|
144
|
+
compInst?: TaroGeneral.IAnyObject,
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
namespace toTempFilePath {
|
|
149
|
+
interface Option {
|
|
150
|
+
/** 指定的画布区域的左上角横坐标 */
|
|
151
|
+
x?: number
|
|
152
|
+
/** 指定的画布区域的左上角纵坐标 */
|
|
153
|
+
y?: number
|
|
154
|
+
/** 指定的画布区域的宽度 */
|
|
155
|
+
width?: number
|
|
156
|
+
/** 指定的画布区域的高度 */
|
|
157
|
+
height?: number
|
|
158
|
+
/** 输出的图片的高度 */
|
|
159
|
+
destHeight?: number
|
|
160
|
+
/** 输出的图片的宽度 */
|
|
161
|
+
destWidth?: number
|
|
162
|
+
/** 目标文件的类型
|
|
163
|
+
* @default "png"
|
|
164
|
+
*/
|
|
165
|
+
fileType?: keyof FileType
|
|
166
|
+
/** 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 */
|
|
167
|
+
quality?: number
|
|
168
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
169
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
170
|
+
/** 接口调用失败的回调函数 */
|
|
171
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
172
|
+
/** 接口调用成功的回调函数 */
|
|
173
|
+
success?: (result: SuccessCallbackResult) => void
|
|
174
|
+
}
|
|
175
|
+
interface FileType {
|
|
176
|
+
/** jpg 图片 */
|
|
177
|
+
jpg
|
|
178
|
+
/** png 图片 */
|
|
179
|
+
png
|
|
180
|
+
}
|
|
181
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
182
|
+
/** 生成文件的临时路径 */
|
|
183
|
+
tempFilePath: string
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Canvas 实例,可通过 SelectorQuery 获取。
|
|
188
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.html
|
|
189
|
+
*/
|
|
190
|
+
interface Canvas {
|
|
191
|
+
/** 画布高度 */
|
|
192
|
+
height: number
|
|
193
|
+
/** 画布宽度 */
|
|
194
|
+
width: number
|
|
195
|
+
/** 取消由 requestAnimationFrame 添加到计划中的动画帧请求。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
|
|
196
|
+
* @supported weapp, alipay, tt
|
|
197
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.cancelAnimationFrame.html
|
|
198
|
+
*/
|
|
199
|
+
cancelAnimationFrame(requestID: number): void
|
|
200
|
+
/** 创建一个 ImageData 对象。仅支持在 2D Canvas 中使用。
|
|
201
|
+
* @supported weapp
|
|
202
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImageData.html
|
|
203
|
+
*/
|
|
204
|
+
createImageData(): ImageData
|
|
205
|
+
/** 创建一个图片对象。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
|
|
206
|
+
* @supported weapp, alipay, tt
|
|
207
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImage.html
|
|
208
|
+
*/
|
|
209
|
+
createImage(): Image
|
|
210
|
+
/** 创建 Path2D 对象
|
|
211
|
+
* @supported weapp
|
|
212
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html
|
|
213
|
+
*/
|
|
214
|
+
createPath2D(
|
|
215
|
+
path: Path2D
|
|
216
|
+
): Path2D
|
|
217
|
+
/** 支持获取 2D 和 WebGL 绘图上下文
|
|
218
|
+
* @supported weapp, alipay, tt
|
|
219
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.getContext.html
|
|
220
|
+
*/
|
|
221
|
+
getContext(contextType: string): RenderingContext
|
|
222
|
+
/** 在下次进行重绘时执行。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
|
|
223
|
+
* @supported weapp
|
|
224
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.requestAnimationFrame.html
|
|
225
|
+
*/
|
|
226
|
+
requestAnimationFrame(
|
|
227
|
+
/** 执行的 callback */
|
|
228
|
+
callback: (...args: any[]) => any,
|
|
229
|
+
): number
|
|
230
|
+
/** 返回一个包含图片展示的 data URI 。可以使用 type 参数其类型,默认为 PNG 格式。
|
|
231
|
+
* @supported weapp
|
|
232
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.toDataURL.html
|
|
233
|
+
*/
|
|
234
|
+
toDataURL(
|
|
235
|
+
/** 图片格式,默认为 image/png */
|
|
236
|
+
type: string,
|
|
237
|
+
/** 在指定图片格式为 image/jpeg 或 image/webp的情况下,可以从 0 到 1 的区间内选择图片的质量。如果超出取值范围,将会使用默认值 0.92。其他参数会被忽略。 */
|
|
238
|
+
encoderOptions: number
|
|
239
|
+
): string
|
|
240
|
+
/** 把当前画布指定区域保存为图片
|
|
241
|
+
* @supported alipay
|
|
242
|
+
* @see https://opendocs.alipay.com/mini/api/toTempFilePath?pathHash=e79fe218
|
|
243
|
+
*/
|
|
244
|
+
toTempFilePath(oprion: toTempFilePath.Option): void
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** canvas 组件的绘图上下文
|
|
248
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html
|
|
249
|
+
*/
|
|
250
|
+
interface CanvasContext {
|
|
251
|
+
/** 填充颜色。用法同 [CanvasContext.setFillStyle()]。 */
|
|
252
|
+
fillStyle: string
|
|
253
|
+
/** 边框颜色。用法同 [CanvasContext.setFillStyle()]。 */
|
|
254
|
+
strokeStyle: string
|
|
255
|
+
/** 阴影相对于形状在水平方向的偏移 */
|
|
256
|
+
shadowOffsetX: number
|
|
257
|
+
/** 阴影相对于形状在竖直方向的偏移 */
|
|
258
|
+
shadowOffsetY: number
|
|
259
|
+
/** 阴影的模糊级别 */
|
|
260
|
+
shadowBlur: number
|
|
261
|
+
/** 阴影的颜色 */
|
|
262
|
+
shadowColor: string
|
|
263
|
+
/** 线条的宽度。用法同 [CanvasContext.setLineWidth()]。 */
|
|
264
|
+
lineWidth: number
|
|
265
|
+
/** 线条的端点样式。用法同 [CanvasContext.setLineCap()]。 */
|
|
266
|
+
lineCap: keyof CanvasContext.LineCap
|
|
267
|
+
/** 线条的交点样式。用法同 [CanvasContext.setLineJoin()]。 */
|
|
268
|
+
lineJoin: keyof CanvasContext.LineJoin
|
|
269
|
+
/** 最大斜接长度。用法同 [CanvasContext.setMiterLimit()]。 */
|
|
270
|
+
miterLimit: number
|
|
271
|
+
/** 虚线偏移量,初始值为0 */
|
|
272
|
+
lineDashOffset: number
|
|
273
|
+
/** 当前字体样式的属性。符合 [CSS font 语法](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font) 的 DOMString 字符串,至少需要提供字体大小和字体族名。默认值为 10px sans-serif。 */
|
|
274
|
+
font: string
|
|
275
|
+
/** 全局画笔透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
|
|
276
|
+
globalAlpha: number
|
|
277
|
+
/** 在绘制新形状时应用的合成操作的类型。目前安卓版本只适用于 `fill` 填充块的合成,用于 `stroke` 线段的合成效果都是 `source-over`。
|
|
278
|
+
*
|
|
279
|
+
* 目前支持的操作有
|
|
280
|
+
* - 安卓:xor, source-over, source-atop, destination-out, lighter, overlay, darken, lighten, hard-light
|
|
281
|
+
* - iOS:xor, source-over, source-atop, destination-over, destination-out, lighter, multiply, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, saturation, luminosity */
|
|
282
|
+
globalCompositeOperation: string
|
|
283
|
+
/** 创建一条弧线。
|
|
284
|
+
*
|
|
285
|
+
* - 创建一个圆可以指定起始弧度为 0,终止弧度为 2 * Math.PI。
|
|
286
|
+
* - 用 `stroke` 或者 `fill` 方法来在 `canvas` 中画弧线。
|
|
287
|
+
*
|
|
288
|
+
* 针对 arc(100, 75, 50, 0, 1.5 * Math.PI)的三个关键坐标如下:
|
|
289
|
+
*
|
|
290
|
+
* - 绿色: 圆心 (100, 75)
|
|
291
|
+
* - 红色: 起始弧度 (0)
|
|
292
|
+
* - 蓝色: 终止弧度 (1.5 * Math.PI)
|
|
293
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
294
|
+
* @example
|
|
295
|
+
* ```tsx
|
|
296
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
297
|
+
* // Draw coordinates
|
|
298
|
+
* ctx.arc(100, 75, 50, 0, 2 * Math.PI)
|
|
299
|
+
* ctx.setFillStyle('#EEEEEE')
|
|
300
|
+
* ctx.fill()
|
|
301
|
+
* ctx.beginPath()
|
|
302
|
+
* ctx.moveTo(40, 75)
|
|
303
|
+
* ctx.lineTo(160, 75)
|
|
304
|
+
* ctx.moveTo(100, 15)
|
|
305
|
+
* ctx.lineTo(100, 135)
|
|
306
|
+
* ctx.setStrokeStyle('#AAAAAA')
|
|
307
|
+
* ctx.stroke()
|
|
308
|
+
* ctx.setFontSize(12)
|
|
309
|
+
* ctx.setFillStyle('black')
|
|
310
|
+
* ctx.fillText('0', 165, 78)
|
|
311
|
+
* ctx.fillText('0.5*PI', 83, 145)
|
|
312
|
+
* ctx.fillText('1*PI', 15, 78)
|
|
313
|
+
* ctx.fillText('1.5*PI', 83, 10)
|
|
314
|
+
* // Draw points
|
|
315
|
+
* ctx.beginPath()
|
|
316
|
+
* ctx.arc(100, 75, 2, 0, 2 * Math.PI)
|
|
317
|
+
* ctx.setFillStyle('lightgreen')
|
|
318
|
+
* ctx.fill()
|
|
319
|
+
* ctx.beginPath()
|
|
320
|
+
* ctx.arc(100, 25, 2, 0, 2 * Math.PI)
|
|
321
|
+
* ctx.setFillStyle('blue')
|
|
322
|
+
* ctx.fill()
|
|
323
|
+
* ctx.beginPath()
|
|
324
|
+
* ctx.arc(150, 75, 2, 0, 2 * Math.PI)
|
|
325
|
+
* ctx.setFillStyle('red')
|
|
326
|
+
* ctx.fill()
|
|
327
|
+
* // Draw arc
|
|
328
|
+
* ctx.beginPath()
|
|
329
|
+
* ctx.arc(100, 75, 50, 0, 1.5 * Math.PI)
|
|
330
|
+
* ctx.setStrokeStyle('#333333')
|
|
331
|
+
* ctx.stroke()
|
|
332
|
+
* ctx.draw()
|
|
333
|
+
* ```
|
|
334
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arc.html
|
|
335
|
+
*/
|
|
336
|
+
arc(
|
|
337
|
+
/** 圆心的 x 坐标 */
|
|
338
|
+
x: number,
|
|
339
|
+
/** 圆心的 y 坐标 */
|
|
340
|
+
y: number,
|
|
341
|
+
/** 圆的半径 */
|
|
342
|
+
r: number,
|
|
343
|
+
/** 起始弧度,单位弧度(在3点钟方向) */
|
|
344
|
+
sAngle: number,
|
|
345
|
+
/** 终止弧度 */
|
|
346
|
+
eAngle: number,
|
|
347
|
+
/** 弧度的方向是否是逆时针 */
|
|
348
|
+
counterclockwise?: boolean,
|
|
349
|
+
/** 弧度的方向是否是逆时针
|
|
350
|
+
* @supported tt
|
|
351
|
+
*/
|
|
352
|
+
anticlockwise?: boolean
|
|
353
|
+
): void
|
|
354
|
+
/** 根据控制点和半径绘制圆弧路径。
|
|
355
|
+
* @supported weapp, alipay, jd, qq, h5, harmony_hybrid
|
|
356
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arcTo.html
|
|
357
|
+
*/
|
|
358
|
+
arcTo(
|
|
359
|
+
/** 第一个控制点的 x 轴坐标 */
|
|
360
|
+
x1: number,
|
|
361
|
+
/** 第一个控制点的 y 轴坐标 */
|
|
362
|
+
y1: number,
|
|
363
|
+
/** 第二个控制点的 x 轴坐标 */
|
|
364
|
+
x2: number,
|
|
365
|
+
/** 第二个控制点的 y 轴坐标 */
|
|
366
|
+
y2: number,
|
|
367
|
+
/** 圆弧的半径 */
|
|
368
|
+
radius: number,
|
|
369
|
+
): void
|
|
370
|
+
/** 开始创建一个路径。需要调用 `fill` 或者 `stroke` 才会使用路径进行填充或描边
|
|
371
|
+
*
|
|
372
|
+
* - 在最开始的时候相当于调用了一次 `beginPath`。
|
|
373
|
+
* - 同一个路径内的多次 `setFillStyle`、`setStrokeStyle`、`setLineWidth`等设置,以最后一次设置为准。
|
|
374
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
375
|
+
* @example
|
|
376
|
+
* ```tsx
|
|
377
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
378
|
+
* // begin path
|
|
379
|
+
* ctx.rect(10, 10, 100, 30)
|
|
380
|
+
* ctx.setFillStyle('yellow')
|
|
381
|
+
* ctx.fill()
|
|
382
|
+
* // begin another path
|
|
383
|
+
* ctx.beginPath()
|
|
384
|
+
* ctx.rect(10, 40, 100, 30)
|
|
385
|
+
* // only fill this rect, not in current path
|
|
386
|
+
* ctx.setFillStyle('blue')
|
|
387
|
+
* ctx.fillRect(10, 70, 100, 30)
|
|
388
|
+
* ctx.rect(10, 100, 100, 30)
|
|
389
|
+
* // it will fill current path
|
|
390
|
+
* ctx.setFillStyle('red')
|
|
391
|
+
* ctx.fill()
|
|
392
|
+
* ctx.draw()
|
|
393
|
+
* ```
|
|
394
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.beginPath.html
|
|
395
|
+
*/
|
|
396
|
+
beginPath(): void
|
|
397
|
+
/** 创建三次方贝塞尔曲线路径。曲线的起始点为路径中前一个点。
|
|
398
|
+
*
|
|
399
|
+
* 针对 moveTo(20, 20) bezierCurveTo(20, 100, 200, 100, 200, 20) 的三个关键坐标如下:
|
|
400
|
+
*
|
|
401
|
+
* - 红色:起始点(20, 20)
|
|
402
|
+
* - 蓝色:两个控制点(20, 100) (200, 100)
|
|
403
|
+
* - 绿色:终止点(200, 20)
|
|
404
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
405
|
+
* @example
|
|
406
|
+
* ```tsx
|
|
407
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
408
|
+
* // Draw points
|
|
409
|
+
* ctx.beginPath()
|
|
410
|
+
* ctx.arc(20, 20, 2, 0, 2 * Math.PI)
|
|
411
|
+
* ctx.setFillStyle('red')
|
|
412
|
+
* ctx.fill()
|
|
413
|
+
* ctx.beginPath()
|
|
414
|
+
* ctx.arc(200, 20, 2, 0, 2 * Math.PI)
|
|
415
|
+
* ctx.setFillStyle('lightgreen')
|
|
416
|
+
* ctx.fill()
|
|
417
|
+
* ctx.beginPath()
|
|
418
|
+
* ctx.arc(20, 100, 2, 0, 2 * Math.PI)
|
|
419
|
+
* ctx.arc(200, 100, 2, 0, 2 * Math.PI)
|
|
420
|
+
* ctx.setFillStyle('blue')
|
|
421
|
+
* ctx.fill()
|
|
422
|
+
* ctx.setFillStyle('black')
|
|
423
|
+
* ctx.setFontSize(12)
|
|
424
|
+
* // Draw guides
|
|
425
|
+
* ctx.beginPath()
|
|
426
|
+
* ctx.moveTo(20, 20)
|
|
427
|
+
* ctx.lineTo(20, 100)
|
|
428
|
+
* ctx.lineTo(150, 75)
|
|
429
|
+
* ctx.moveTo(200, 20)
|
|
430
|
+
* ctx.lineTo(200, 100)
|
|
431
|
+
* ctx.lineTo(70, 75)
|
|
432
|
+
* ctx.setStrokeStyle('#AAAAAA')
|
|
433
|
+
* ctx.stroke()
|
|
434
|
+
* // Draw quadratic curve
|
|
435
|
+
* ctx.beginPath()
|
|
436
|
+
* ctx.moveTo(20, 20)
|
|
437
|
+
* ctx.bezierCurveTo(20, 100, 200, 100, 200, 20)
|
|
438
|
+
* ctx.setStrokeStyle('black')
|
|
439
|
+
* ctx.stroke()
|
|
440
|
+
* ctx.draw()
|
|
441
|
+
* ```
|
|
442
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.bezierCurveTo.html
|
|
443
|
+
*/
|
|
444
|
+
bezierCurveTo(
|
|
445
|
+
/** 第一个贝塞尔控制点的 x 坐标 */
|
|
446
|
+
cp1x: number,
|
|
447
|
+
/** 第一个贝塞尔控制点的 y 坐标 */
|
|
448
|
+
cp1y: number,
|
|
449
|
+
/** 第二个贝塞尔控制点的 x 坐标 */
|
|
450
|
+
cp2x: number,
|
|
451
|
+
/** 第二个贝塞尔控制点的 y 坐标 */
|
|
452
|
+
cp2y: number,
|
|
453
|
+
/** 结束点的 x 坐标 */
|
|
454
|
+
x: number,
|
|
455
|
+
/** 结束点的 y 坐标 */
|
|
456
|
+
y: number,
|
|
457
|
+
): void
|
|
458
|
+
/** 清除画布上在该矩形区域内的内容
|
|
459
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
460
|
+
* @example
|
|
461
|
+
* clearRect 并非画一个白色的矩形在地址区域,而是清空,为了有直观感受,对 canvas 加了一层背景色。
|
|
462
|
+
* ```html
|
|
463
|
+
* <canvas canvas-id="myCanvas" style="border: 1px solid; background: #123456;"/>
|
|
464
|
+
* ```
|
|
465
|
+
* ```tsx
|
|
466
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
467
|
+
* ctx.setFillStyle('red')
|
|
468
|
+
* ctx.fillRect(0, 0, 150, 200)
|
|
469
|
+
* ctx.setFillStyle('blue')
|
|
470
|
+
* ctx.fillRect(150, 0, 150, 200)
|
|
471
|
+
* ctx.clearRect(10, 10, 150, 75)
|
|
472
|
+
* ctx.draw()
|
|
473
|
+
* ```
|
|
474
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clearRect.html
|
|
475
|
+
*/
|
|
476
|
+
clearRect(
|
|
477
|
+
/** 矩形路径左上角的横坐标 */
|
|
478
|
+
x: number,
|
|
479
|
+
/** 矩形路径左上角的纵坐标 */
|
|
480
|
+
y: number,
|
|
481
|
+
/** 矩形路径的宽度 */
|
|
482
|
+
width: number,
|
|
483
|
+
/** 矩形路径的高度 */
|
|
484
|
+
height: number,
|
|
485
|
+
): void
|
|
486
|
+
/** 从原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内(不能访问画布上的其他区域)。可以在使用 `clip` 方法前通过使用 `save` 方法对当前画布区域进行保存,并在以后的任意时间通过`restore`方法对其进行恢复。
|
|
487
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
488
|
+
* @example
|
|
489
|
+
* ```tsx
|
|
490
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
491
|
+
* Taro.downloadFile({
|
|
492
|
+
* url: 'http://is5.mzstatic.com/image/thumb/Purple128/v4/75/3b/90/753b907c-b7fb-5877-215a-759bd73691a4/source/50x50bb.jpg',
|
|
493
|
+
* success: function(res) {
|
|
494
|
+
* ctx.save()
|
|
495
|
+
* ctx.beginPath()
|
|
496
|
+
* ctx.arc(50, 50, 25, 0, 2*Math.PI)
|
|
497
|
+
* ctx.clip()
|
|
498
|
+
* ctx.drawImage(res.tempFilePath, 25, 25)
|
|
499
|
+
* ctx.restore()
|
|
500
|
+
* ctx.draw()
|
|
501
|
+
* }
|
|
502
|
+
* })
|
|
503
|
+
* ```
|
|
504
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clip.html
|
|
505
|
+
*/
|
|
506
|
+
clip(): void
|
|
507
|
+
/** 关闭一个路径。会连接起点和终点。如果关闭路径后没有调用 `fill` 或者 `stroke` 并开启了新的路径,那之前的路径将不会被渲染。
|
|
508
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
509
|
+
* @example
|
|
510
|
+
* ```tsx
|
|
511
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
512
|
+
* ctx.moveTo(10, 10)
|
|
513
|
+
* ctx.lineTo(100, 10)
|
|
514
|
+
* ctx.lineTo(100, 100)
|
|
515
|
+
* ctx.closePath()
|
|
516
|
+
* ctx.stroke()
|
|
517
|
+
* ctx.draw()
|
|
518
|
+
* ```
|
|
519
|
+
* @example
|
|
520
|
+
* ```tsx
|
|
521
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
522
|
+
* // begin path
|
|
523
|
+
* ctx.rect(10, 10, 100, 30)
|
|
524
|
+
* ctx.closePath()
|
|
525
|
+
* // begin another path
|
|
526
|
+
* ctx.beginPath()
|
|
527
|
+
* ctx.rect(10, 40, 100, 30)
|
|
528
|
+
* // only fill this rect, not in current path
|
|
529
|
+
* ctx.setFillStyle('blue')
|
|
530
|
+
* ctx.fillRect(10, 70, 100, 30)
|
|
531
|
+
* ctx.rect(10, 100, 100, 30)
|
|
532
|
+
* // it will fill current path
|
|
533
|
+
* ctx.setFillStyle('red')
|
|
534
|
+
* ctx.fill()
|
|
535
|
+
* ctx.draw()
|
|
536
|
+
* ```
|
|
537
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.closePath.html
|
|
538
|
+
*/
|
|
539
|
+
closePath(): void
|
|
540
|
+
/** 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](/docs/apis/canvas/CanvasGradient#addcolorstop) 来指定渐变点,至少要两个。
|
|
541
|
+
* @supported weapp, alipay, swan, jd, qq, h5, harmony_hybrid
|
|
542
|
+
* @example
|
|
543
|
+
* ```tsx
|
|
544
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
545
|
+
* // Create circular gradient
|
|
546
|
+
* const grd = ctx.createCircularGradient(75, 50, 50)
|
|
547
|
+
* grd.addColorStop(0, 'red')
|
|
548
|
+
* grd.addColorStop(1, 'white')
|
|
549
|
+
* // Fill with gradient
|
|
550
|
+
* ctx.setFillStyle(grd)
|
|
551
|
+
* ctx.fillRect(10, 10, 150, 80)
|
|
552
|
+
* ctx.draw()
|
|
553
|
+
* ```
|
|
554
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createCircularGradient.html
|
|
555
|
+
*/
|
|
556
|
+
createCircularGradient(
|
|
557
|
+
/** 圆心的 x 坐标 */
|
|
558
|
+
x: number,
|
|
559
|
+
/** 圆心的 y 坐标 */
|
|
560
|
+
y: number,
|
|
561
|
+
/** 圆的半径 */
|
|
562
|
+
r: number,
|
|
563
|
+
): CanvasGradient
|
|
564
|
+
/** 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](/docs/apis/canvas/CanvasGradient#addcolorstop) 来指定渐变点,至少要两个。
|
|
565
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
566
|
+
* @example
|
|
567
|
+
* ```tsx
|
|
568
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
569
|
+
* // Create linear gradient
|
|
570
|
+
* const grd = ctx.createLinearGradient(0, 0, 200, 0)
|
|
571
|
+
* grd.addColorStop(0, 'red')
|
|
572
|
+
* grd.addColorStop(1, 'white')
|
|
573
|
+
* // Fill with gradient
|
|
574
|
+
* ctx.setFillStyle(grd)
|
|
575
|
+
* ctx.fillRect(10, 10, 150, 80)
|
|
576
|
+
* ctx.draw()
|
|
577
|
+
* ```
|
|
578
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createLinearGradient.html
|
|
579
|
+
*/
|
|
580
|
+
createLinearGradient(
|
|
581
|
+
/** 起点的 x 坐标 */
|
|
582
|
+
x0: number,
|
|
583
|
+
/** 起点的 y 坐标 */
|
|
584
|
+
y0: number,
|
|
585
|
+
/** 终点的 x 坐标 */
|
|
586
|
+
x1: number,
|
|
587
|
+
/** 终点的 y 坐标 */
|
|
588
|
+
y1: number,
|
|
589
|
+
): CanvasGradient
|
|
590
|
+
/** 对指定的图像创建模式的方法,可在指定的方向上重复元图像
|
|
591
|
+
* @supported weapp, alipay, jd, qq, h5, harmony_hybrid
|
|
592
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createPattern.html
|
|
593
|
+
*/
|
|
594
|
+
createPattern(
|
|
595
|
+
/** 重复的图像源,仅支持包内路径和临时路径 */
|
|
596
|
+
image: string,
|
|
597
|
+
/** 如何重复图像 */
|
|
598
|
+
repetition: keyof CanvasContext.Repetition,
|
|
599
|
+
): CanvasPattern | null | Promise<CanvasPattern | null>
|
|
600
|
+
/** 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
|
|
601
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
602
|
+
* @h5 第二次调用 draw 前需要等待上一次 draw 调用结束后再调用,否则新的一次 draw 调用栈不会清空而导致结果异常。
|
|
603
|
+
* @example
|
|
604
|
+
* 第二次 draw() reserve 为 true。所以保留了上一次的绘制结果,在上下文设置的 fillStyle 'red' 也变成了默认的 'black'。
|
|
605
|
+
*
|
|
606
|
+
* ```tsx
|
|
607
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
608
|
+
* ctx.setFillStyle('red')
|
|
609
|
+
* ctx.fillRect(10, 10, 150, 100)
|
|
610
|
+
* ctx.draw(false, () => {
|
|
611
|
+
* ctx.fillRect(50, 50, 150, 100)
|
|
612
|
+
* ctx.draw(true)
|
|
613
|
+
* })
|
|
614
|
+
* ```
|
|
615
|
+
* @example
|
|
616
|
+
* 第二次 draw() reserve 为 false。所以没有保留了上一次的绘制结果和在上下文设置的 fillStyle 'red'。
|
|
617
|
+
*
|
|
618
|
+
* ```tsx
|
|
619
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
620
|
+
* ctx.setFillStyle('red')
|
|
621
|
+
* ctx.fillRect(10, 10, 150, 100)
|
|
622
|
+
* ctx.draw(false, () => {
|
|
623
|
+
* ctx.fillRect(50, 50, 150, 100)
|
|
624
|
+
* ctx.draw()
|
|
625
|
+
* })
|
|
626
|
+
* ```
|
|
627
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.draw.html
|
|
628
|
+
*/
|
|
629
|
+
draw(
|
|
630
|
+
/** 本次绘制是否接着上一次绘制。即 reserve 参数为 false,则在本次调用绘制之前 native 层会先清空画布再继续绘制;若 reserve 参数为 true,则保留当前画布上的内容,本次调用 drawCanvas 绘制的内容覆盖在上面,默认 false。 */
|
|
631
|
+
reserve?: boolean,
|
|
632
|
+
/** 绘制完成后执行的回调函数 */
|
|
633
|
+
callback?: (...args: any[]) => any,
|
|
634
|
+
/** 是否使用硬件加速
|
|
635
|
+
* @supported jd
|
|
636
|
+
*/
|
|
637
|
+
useHardwareAccelerate?: boolean
|
|
638
|
+
): void | Promise<void>
|
|
639
|
+
/** 绘制图像到画布
|
|
640
|
+
* @supported weapp, h5, harmony_hybrid
|
|
641
|
+
* @example
|
|
642
|
+
* 有三个版本的写法:
|
|
643
|
+
*
|
|
644
|
+
* - drawImage(imageResource, dx, dy)
|
|
645
|
+
* - drawImage(imageResource, dx, dy, dWidth, dHeight)
|
|
646
|
+
* - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
|
|
647
|
+
*
|
|
648
|
+
* ```tsx
|
|
649
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
650
|
+
* Taro.chooseImage({
|
|
651
|
+
* success: function(res){
|
|
652
|
+
* ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
|
|
653
|
+
* ctx.draw()
|
|
654
|
+
* }
|
|
655
|
+
* })
|
|
656
|
+
* ```
|
|
657
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html
|
|
658
|
+
*/
|
|
659
|
+
drawImage(
|
|
660
|
+
/** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
|
|
661
|
+
imageResource: string,
|
|
662
|
+
/** imageResource的左上角在目标 canvas 上 x 轴的位置 */
|
|
663
|
+
dx: number,
|
|
664
|
+
/** imageResource的左上角在目标 canvas 上 y 轴的位置 */
|
|
665
|
+
dy: number,
|
|
666
|
+
): void
|
|
667
|
+
/** 绘制图像到画布
|
|
668
|
+
* @supported weapp, alipay, h5, harmony_hybrid
|
|
669
|
+
* @example
|
|
670
|
+
* 有三个版本的写法:
|
|
671
|
+
*
|
|
672
|
+
* - drawImage(imageResource, dx, dy)
|
|
673
|
+
* - drawImage(imageResource, dx, dy, dWidth, dHeight)
|
|
674
|
+
* - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
|
|
675
|
+
*
|
|
676
|
+
* ```tsx
|
|
677
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
678
|
+
* Taro.chooseImage({
|
|
679
|
+
* success: function(res){
|
|
680
|
+
* ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
|
|
681
|
+
* ctx.draw()
|
|
682
|
+
* }
|
|
683
|
+
* })
|
|
684
|
+
* ```
|
|
685
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html
|
|
686
|
+
*/
|
|
687
|
+
drawImage(
|
|
688
|
+
/** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
|
|
689
|
+
imageResource: string,
|
|
690
|
+
/** imageResource的左上角在目标 canvas 上 x 轴的位置 */
|
|
691
|
+
dx: number,
|
|
692
|
+
/** imageResource的左上角在目标 canvas 上 y 轴的位置 */
|
|
693
|
+
dy: number,
|
|
694
|
+
/** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */
|
|
695
|
+
dWidth: number,
|
|
696
|
+
/** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */
|
|
697
|
+
dHeight: number,
|
|
698
|
+
): void
|
|
699
|
+
/** 绘制图像到画布
|
|
700
|
+
* @supported weapp, swan, jd, qq, tt, h5, harmony_hybrid
|
|
701
|
+
* @example
|
|
702
|
+
* 有三个版本的写法:
|
|
703
|
+
*
|
|
704
|
+
* - drawImage(imageResource, dx, dy)
|
|
705
|
+
* - drawImage(imageResource, dx, dy, dWidth, dHeight)
|
|
706
|
+
* - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
|
|
707
|
+
*
|
|
708
|
+
* ```tsx
|
|
709
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
710
|
+
* Taro.chooseImage({
|
|
711
|
+
* success: function(res){
|
|
712
|
+
* ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
|
|
713
|
+
* ctx.draw()
|
|
714
|
+
* }
|
|
715
|
+
* })
|
|
716
|
+
* ```
|
|
717
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html
|
|
718
|
+
*/
|
|
719
|
+
drawImage(
|
|
720
|
+
/** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
|
|
721
|
+
imageResource: string,
|
|
722
|
+
/** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 x 坐标 */
|
|
723
|
+
sx: number,
|
|
724
|
+
/** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 y 坐标 */
|
|
725
|
+
sy: number,
|
|
726
|
+
/** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的宽度 */
|
|
727
|
+
sWidth: number,
|
|
728
|
+
/** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的高度 */
|
|
729
|
+
sHeight: number,
|
|
730
|
+
/** imageResource的左上角在目标 canvas 上 x 轴的位置 */
|
|
731
|
+
dx: number,
|
|
732
|
+
/** imageResource的左上角在目标 canvas 上 y 轴的位置 */
|
|
733
|
+
dy: number,
|
|
734
|
+
/** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */
|
|
735
|
+
dWidth: number,
|
|
736
|
+
/** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */
|
|
737
|
+
dHeight: number,
|
|
738
|
+
): void
|
|
739
|
+
/** 对当前路径中的内容进行填充。默认的填充色为黑色。
|
|
740
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
741
|
+
* @example
|
|
742
|
+
* 如果当前路径没有闭合,fill() 方法会将起点和终点进行连接,然后填充。
|
|
743
|
+
*
|
|
744
|
+
* ```tsx
|
|
745
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
746
|
+
* ctx.moveTo(10, 10)
|
|
747
|
+
* ctx.lineTo(100, 10)
|
|
748
|
+
* ctx.lineTo(100, 100)
|
|
749
|
+
* ctx.fill()
|
|
750
|
+
* ctx.draw()
|
|
751
|
+
* ```
|
|
752
|
+
* @example
|
|
753
|
+
* fill() 填充的的路径是从 beginPath() 开始计算,但是不会将 fillRect() 包含进去。
|
|
754
|
+
*
|
|
755
|
+
* ```tsx
|
|
756
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
757
|
+
* // begin path
|
|
758
|
+
* ctx.rect(10, 10, 100, 30)
|
|
759
|
+
* ctx.setFillStyle('yellow')
|
|
760
|
+
* ctx.fill()
|
|
761
|
+
* // begin another path
|
|
762
|
+
* ctx.beginPath()
|
|
763
|
+
* ctx.rect(10, 40, 100, 30)
|
|
764
|
+
* // only fill this rect, not in current path
|
|
765
|
+
* ctx.setFillStyle('blue')
|
|
766
|
+
* ctx.fillRect(10, 70, 100, 30)
|
|
767
|
+
* ctx.rect(10, 100, 100, 30)
|
|
768
|
+
* // it will fill current path
|
|
769
|
+
* ctx.setFillStyle('red')
|
|
770
|
+
* ctx.fill()
|
|
771
|
+
* ctx.draw()
|
|
772
|
+
* ```
|
|
773
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html
|
|
774
|
+
*/
|
|
775
|
+
fill(): void
|
|
776
|
+
/** 填充一个矩形。用 [`setFillStyle`](/docs/apis/canvas/CanvasContext#setfillstyle) 设置矩形的填充色,如果没设置默认是黑色。
|
|
777
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
778
|
+
* @example
|
|
779
|
+
* ```tsx
|
|
780
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
781
|
+
* ctx.setFillStyle('red')
|
|
782
|
+
* ctx.fillRect(10, 10, 150, 75)
|
|
783
|
+
* ctx.draw()
|
|
784
|
+
* ```
|
|
785
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillRect.html
|
|
786
|
+
*/
|
|
787
|
+
fillRect(
|
|
788
|
+
/** 矩形路径左上角的横坐标 */
|
|
789
|
+
x: number,
|
|
790
|
+
/** 矩形路径左上角的纵坐标 */
|
|
791
|
+
y: number,
|
|
792
|
+
/** 矩形路径的宽度 */
|
|
793
|
+
width: number,
|
|
794
|
+
/** 矩形路径的高度 */
|
|
795
|
+
height: number,
|
|
796
|
+
): void
|
|
797
|
+
/** 在画布上绘制被填充的文本
|
|
798
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
799
|
+
* @example
|
|
800
|
+
* ```tsx
|
|
801
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
802
|
+
* ctx.setFontSize(20)
|
|
803
|
+
* ctx.fillText('Hello', 20, 20)
|
|
804
|
+
* ctx.fillText('MINA', 100, 100)
|
|
805
|
+
* ctx.draw()
|
|
806
|
+
* ```
|
|
807
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillText.html
|
|
808
|
+
*/
|
|
809
|
+
fillText(
|
|
810
|
+
/** 在画布上输出的文本 */
|
|
811
|
+
text: string,
|
|
812
|
+
/** 绘制文本的左上角 x 坐标位置 */
|
|
813
|
+
x: number,
|
|
814
|
+
/** 绘制文本的左上角 y 坐标位置 */
|
|
815
|
+
y: number,
|
|
816
|
+
/** 需要绘制的最大宽度,可选 */
|
|
817
|
+
maxWidth?: number,
|
|
818
|
+
): void
|
|
819
|
+
/** 增加一个新点,然后创建一条从上次指定点到目标点的线。用 `stroke` 方法来画线条
|
|
820
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
821
|
+
|
|
822
|
+
* @example
|
|
823
|
+
* ```tsx
|
|
824
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
825
|
+
* ctx.moveTo(10, 10)
|
|
826
|
+
* ctx.rect(10, 10, 100, 50)
|
|
827
|
+
* ctx.lineTo(110, 60)
|
|
828
|
+
* ctx.stroke()
|
|
829
|
+
* ctx.draw()
|
|
830
|
+
* ```
|
|
831
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.lineTo.html
|
|
832
|
+
*/
|
|
833
|
+
lineTo(
|
|
834
|
+
/** 目标位置的 x 坐标 */
|
|
835
|
+
x: number,
|
|
836
|
+
/** 目标位置的 y 坐标 */
|
|
837
|
+
y: number,
|
|
838
|
+
): void
|
|
839
|
+
/** 测量文本尺寸信息。目前仅返回文本宽度(width)。同步接口。
|
|
840
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
841
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html
|
|
842
|
+
*/
|
|
843
|
+
measureText(
|
|
844
|
+
/** 要测量的文本 */
|
|
845
|
+
text: string,
|
|
846
|
+
): TextMetrics
|
|
847
|
+
/** 把路径移动到画布中的指定点,不创建线条。用 `stroke` 方法来画线条
|
|
848
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
849
|
+
* @example
|
|
850
|
+
* ```tsx
|
|
851
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
852
|
+
* ctx.moveTo(10, 10)
|
|
853
|
+
* ctx.lineTo(100, 10)
|
|
854
|
+
* ctx.moveTo(10, 50)
|
|
855
|
+
* ctx.lineTo(100, 50)
|
|
856
|
+
* ctx.stroke()
|
|
857
|
+
* ctx.draw()
|
|
858
|
+
* ```
|
|
859
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.moveTo.html
|
|
860
|
+
*/
|
|
861
|
+
moveTo(
|
|
862
|
+
/** 目标位置的 x 坐标 */
|
|
863
|
+
x: number,
|
|
864
|
+
/** 目标位置的 y 坐标 */
|
|
865
|
+
y: number,
|
|
866
|
+
): void
|
|
867
|
+
/** 创建二次贝塞尔曲线路径。曲线的起始点为路径中前一个点。
|
|
868
|
+
*
|
|
869
|
+
* 针对 moveTo(20, 20) quadraticCurveTo(20, 100, 200, 20) 的三个关键坐标如下:
|
|
870
|
+
*
|
|
871
|
+
* - 红色:起始点(20, 20)
|
|
872
|
+
* - 蓝色:控制点(20, 100)
|
|
873
|
+
* - 绿色:终止点(200, 20)
|
|
874
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
875
|
+
* @example
|
|
876
|
+
* ```tsx
|
|
877
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
878
|
+
* // Draw points
|
|
879
|
+
* ctx.beginPath()
|
|
880
|
+
* ctx.arc(20, 20, 2, 0, 2 * Math.PI)
|
|
881
|
+
* ctx.setFillStyle('red')
|
|
882
|
+
* ctx.fill()
|
|
883
|
+
* ctx.beginPath()
|
|
884
|
+
* ctx.arc(200, 20, 2, 0, 2 * Math.PI)
|
|
885
|
+
* ctx.setFillStyle('lightgreen')
|
|
886
|
+
* ctx.fill()
|
|
887
|
+
* ctx.beginPath()
|
|
888
|
+
* ctx.arc(20, 100, 2, 0, 2 * Math.PI)
|
|
889
|
+
* ctx.setFillStyle('blue')
|
|
890
|
+
* ctx.fill()
|
|
891
|
+
* ctx.setFillStyle('black')
|
|
892
|
+
* ctx.setFontSize(12)
|
|
893
|
+
* // Draw guides
|
|
894
|
+
* ctx.beginPath()
|
|
895
|
+
* ctx.moveTo(20, 20)
|
|
896
|
+
* ctx.lineTo(20, 100)
|
|
897
|
+
* ctx.lineTo(200, 20)
|
|
898
|
+
* ctx.setStrokeStyle('#AAAAAA')
|
|
899
|
+
* ctx.stroke()
|
|
900
|
+
* // Draw quadratic curve
|
|
901
|
+
* ctx.beginPath()
|
|
902
|
+
* ctx.moveTo(20, 20)
|
|
903
|
+
* ctx.quadraticCurveTo(20, 100, 200, 20)
|
|
904
|
+
* ctx.setStrokeStyle('black')
|
|
905
|
+
* ctx.stroke()
|
|
906
|
+
* ctx.draw()
|
|
907
|
+
* ```
|
|
908
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.quadraticCurveTo.html
|
|
909
|
+
*/
|
|
910
|
+
quadraticCurveTo(
|
|
911
|
+
/** 贝塞尔控制点的 x 坐标 */
|
|
912
|
+
cpx: number,
|
|
913
|
+
/** 贝塞尔控制点的 y 坐标 */
|
|
914
|
+
cpy: number,
|
|
915
|
+
/** 结束点的 x 坐标 */
|
|
916
|
+
x: number,
|
|
917
|
+
/** 结束点的 y 坐标 */
|
|
918
|
+
y: number,
|
|
919
|
+
): void
|
|
920
|
+
/** 创建一个矩形路径。需要用 [`fill`](/docs/apis/canvas/CanvasContext#fill) 或者 [`stroke`](/docs/apis/canvas/CanvasContext#stroke) 方法将矩形真正的画到 `canvas` 中
|
|
921
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
922
|
+
* @example
|
|
923
|
+
* ```tsx
|
|
924
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
925
|
+
* ctx.rect(10, 10, 150, 75)
|
|
926
|
+
* ctx.setFillStyle('red')
|
|
927
|
+
* ctx.fill()
|
|
928
|
+
* ctx.draw()
|
|
929
|
+
* ```
|
|
930
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rect.html
|
|
931
|
+
*/
|
|
932
|
+
rect(
|
|
933
|
+
/** 矩形路径左上角的横坐标 */
|
|
934
|
+
x: number,
|
|
935
|
+
/** 矩形路径左上角的纵坐标 */
|
|
936
|
+
y: number,
|
|
937
|
+
/** 矩形路径的宽度 */
|
|
938
|
+
width: number,
|
|
939
|
+
/** 矩形路径的高度 */
|
|
940
|
+
height: number,
|
|
941
|
+
): void
|
|
942
|
+
/** 重置绘图上下文状态
|
|
943
|
+
* @supported h5, harmony_hybrid
|
|
944
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/reset
|
|
945
|
+
*/
|
|
946
|
+
reset(): void
|
|
947
|
+
/** 恢复之前保存的绘图上下文
|
|
948
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
949
|
+
* @example
|
|
950
|
+
* ```tsx
|
|
951
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
952
|
+
* // save the default fill style
|
|
953
|
+
* ctx.save()
|
|
954
|
+
* ctx.setFillStyle('red')
|
|
955
|
+
* ctx.fillRect(10, 10, 150, 100)
|
|
956
|
+
* // restore to the previous saved state
|
|
957
|
+
* ctx.restore()
|
|
958
|
+
* ctx.fillRect(50, 50, 150, 100)
|
|
959
|
+
* ctx.draw()
|
|
960
|
+
* ```
|
|
961
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.restore.html
|
|
962
|
+
*/
|
|
963
|
+
restore(): void
|
|
964
|
+
/** 以原点为中心顺时针旋转当前坐标轴。多次调用旋转的角度会叠加。原点可以用 `translate` 方法修改。
|
|
965
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
966
|
+
* @example
|
|
967
|
+
* ```tsx
|
|
968
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
969
|
+
* ctx.strokeRect(100, 10, 150, 100)
|
|
970
|
+
* ctx.rotate(20 * Math.PI / 180)
|
|
971
|
+
* ctx.strokeRect(100, 10, 150, 100)
|
|
972
|
+
* ctx.rotate(20 * Math.PI / 180)
|
|
973
|
+
* ctx.strokeRect(100, 10, 150, 100)
|
|
974
|
+
* ctx.draw()
|
|
975
|
+
* ```
|
|
976
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rotate.html
|
|
977
|
+
*/
|
|
978
|
+
rotate(
|
|
979
|
+
/** 旋转角度,以弧度计 degrees * Math.PI/180;degrees 范围为 0-360 */
|
|
980
|
+
rotate: number,
|
|
981
|
+
): void
|
|
982
|
+
/** 保存绘图上下文。
|
|
983
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
984
|
+
* @example
|
|
985
|
+
* ```tsx
|
|
986
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
987
|
+
* // save the default fill style
|
|
988
|
+
* ctx.save()
|
|
989
|
+
* ctx.setFillStyle('red')
|
|
990
|
+
* ctx.fillRect(10, 10, 150, 100)
|
|
991
|
+
* // restore to the previous saved state
|
|
992
|
+
* ctx.restore()
|
|
993
|
+
* ctx.fillRect(50, 50, 150, 100)
|
|
994
|
+
* ctx.draw()
|
|
995
|
+
* ```
|
|
996
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.save.html
|
|
997
|
+
*/
|
|
998
|
+
save(): void
|
|
999
|
+
/** 在调用后,之后创建的路径其横纵坐标会被缩放。多次调用倍数会相乘。
|
|
1000
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1001
|
+
* @example
|
|
1002
|
+
* ```tsx
|
|
1003
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1004
|
+
* ctx.strokeRect(10, 10, 25, 15)
|
|
1005
|
+
* ctx.scale(2, 2)
|
|
1006
|
+
* ctx.strokeRect(10, 10, 25, 15)
|
|
1007
|
+
* ctx.scale(2, 2)
|
|
1008
|
+
* ctx.strokeRect(10, 10, 25, 15)
|
|
1009
|
+
* ctx.draw()
|
|
1010
|
+
* ```
|
|
1011
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.scale.html
|
|
1012
|
+
*/
|
|
1013
|
+
scale(
|
|
1014
|
+
/** 横坐标缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */
|
|
1015
|
+
scaleWidth: number,
|
|
1016
|
+
/** 纵坐标轴缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */
|
|
1017
|
+
scaleHeight: number,
|
|
1018
|
+
): void
|
|
1019
|
+
/** 设置填充色。
|
|
1020
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1021
|
+
* @example
|
|
1022
|
+
* ```tsx
|
|
1023
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1024
|
+
* ctx.setFillStyle('red')
|
|
1025
|
+
* ctx.fillRect(10, 10, 150, 75)
|
|
1026
|
+
* ctx.draw()
|
|
1027
|
+
* ```
|
|
1028
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html
|
|
1029
|
+
*/
|
|
1030
|
+
setFillStyle(
|
|
1031
|
+
/** 填充的颜色,默认颜色为 black。 */
|
|
1032
|
+
color: string | CanvasGradient,
|
|
1033
|
+
): void
|
|
1034
|
+
/** 设置字体的字号
|
|
1035
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1036
|
+
* @example
|
|
1037
|
+
* ```tsx
|
|
1038
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1039
|
+
* ctx.setFontSize(20)
|
|
1040
|
+
* ctx.fillText('20', 20, 20)
|
|
1041
|
+
* ctx.setFontSize(30)
|
|
1042
|
+
* ctx.fillText('30', 40, 40)
|
|
1043
|
+
* ctx.setFontSize(40)
|
|
1044
|
+
* ctx.fillText('40', 60, 60)
|
|
1045
|
+
* ctx.setFontSize(50)
|
|
1046
|
+
* ctx.fillText('50', 90, 90)
|
|
1047
|
+
* ctx.draw()
|
|
1048
|
+
* ```
|
|
1049
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFontSize.html
|
|
1050
|
+
*/
|
|
1051
|
+
setFontSize(
|
|
1052
|
+
/** 字体的字号 */
|
|
1053
|
+
fontSize: number,
|
|
1054
|
+
): void
|
|
1055
|
+
/** 设置全局画笔透明度。
|
|
1056
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1057
|
+
* @example
|
|
1058
|
+
* ```tsx
|
|
1059
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1060
|
+
* ctx.setFillStyle('red')
|
|
1061
|
+
* ctx.fillRect(10, 10, 150, 100)
|
|
1062
|
+
* ctx.setGlobalAlpha(0.2)
|
|
1063
|
+
* ctx.setFillStyle('blue')
|
|
1064
|
+
* ctx.fillRect(50, 50, 150, 100)
|
|
1065
|
+
* ctx.setFillStyle('yellow')
|
|
1066
|
+
* ctx.fillRect(100, 100, 150, 100)
|
|
1067
|
+
* ctx.draw()
|
|
1068
|
+
* ```
|
|
1069
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setGlobalAlpha.html
|
|
1070
|
+
*/
|
|
1071
|
+
setGlobalAlpha(
|
|
1072
|
+
/** 透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
|
|
1073
|
+
alpha: number,
|
|
1074
|
+
): void
|
|
1075
|
+
/** 设置线条的端点样式
|
|
1076
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1077
|
+
* @example
|
|
1078
|
+
* ```tsx
|
|
1079
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1080
|
+
* ctx.beginPath()
|
|
1081
|
+
* ctx.moveTo(10, 10)
|
|
1082
|
+
* ctx.lineTo(150, 10)
|
|
1083
|
+
* ctx.stroke()
|
|
1084
|
+
* ctx.beginPath()
|
|
1085
|
+
* ctx.setLineCap('butt')
|
|
1086
|
+
* ctx.setLineWidth(10)
|
|
1087
|
+
* ctx.moveTo(10, 30)
|
|
1088
|
+
* ctx.lineTo(150, 30)
|
|
1089
|
+
* ctx.stroke()
|
|
1090
|
+
* ctx.beginPath()
|
|
1091
|
+
* ctx.setLineCap('round')
|
|
1092
|
+
* ctx.setLineWidth(10)
|
|
1093
|
+
* ctx.moveTo(10, 50)
|
|
1094
|
+
* ctx.lineTo(150, 50)
|
|
1095
|
+
* ctx.stroke()
|
|
1096
|
+
* ctx.beginPath()
|
|
1097
|
+
* ctx.setLineCap('square')
|
|
1098
|
+
* ctx.setLineWidth(10)
|
|
1099
|
+
* ctx.moveTo(10, 70)
|
|
1100
|
+
* ctx.lineTo(150, 70)
|
|
1101
|
+
* ctx.stroke()
|
|
1102
|
+
* ctx.draw()
|
|
1103
|
+
* ```
|
|
1104
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html
|
|
1105
|
+
*/
|
|
1106
|
+
setLineCap(
|
|
1107
|
+
/** 线条的结束端点样式 */
|
|
1108
|
+
lineCap: keyof CanvasContext.LineCap,
|
|
1109
|
+
): void
|
|
1110
|
+
/** 设置虚线样式。
|
|
1111
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1112
|
+
* @example
|
|
1113
|
+
* ```tsx
|
|
1114
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1115
|
+
* ctx.setLineDash([10, 20], 5);
|
|
1116
|
+
* ctx.beginPath();
|
|
1117
|
+
* ctx.moveTo(0,100);
|
|
1118
|
+
* ctx.lineTo(400, 100);
|
|
1119
|
+
* ctx.stroke();
|
|
1120
|
+
* ctx.draw()
|
|
1121
|
+
* ```
|
|
1122
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineDash.html
|
|
1123
|
+
*/
|
|
1124
|
+
setLineDash(
|
|
1125
|
+
/** 一组描述交替绘制线段和间距(坐标空间单位)长度的数字 */
|
|
1126
|
+
pattern: number[],
|
|
1127
|
+
/** 虚线偏移量 */
|
|
1128
|
+
offset: number,
|
|
1129
|
+
): void
|
|
1130
|
+
/** 设置线条的交点样式
|
|
1131
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1132
|
+
* @example
|
|
1133
|
+
* ```tsx
|
|
1134
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1135
|
+
* ctx.beginPath()
|
|
1136
|
+
* ctx.moveTo(10, 10)
|
|
1137
|
+
* ctx.lineTo(100, 50)
|
|
1138
|
+
* ctx.lineTo(10, 90)
|
|
1139
|
+
* ctx.stroke()
|
|
1140
|
+
* ctx.beginPath()
|
|
1141
|
+
* ctx.setLineJoin('bevel')
|
|
1142
|
+
* ctx.setLineWidth(10)
|
|
1143
|
+
* ctx.moveTo(50, 10)
|
|
1144
|
+
* ctx.lineTo(140, 50)
|
|
1145
|
+
* ctx.lineTo(50, 90)
|
|
1146
|
+
* ctx.stroke()
|
|
1147
|
+
* ctx.beginPath()
|
|
1148
|
+
* ctx.setLineJoin('round')
|
|
1149
|
+
* ctx.setLineWidth(10)
|
|
1150
|
+
* ctx.moveTo(90, 10)
|
|
1151
|
+
* ctx.lineTo(180, 50)
|
|
1152
|
+
* ctx.lineTo(90, 90)
|
|
1153
|
+
* ctx.stroke()
|
|
1154
|
+
* ctx.beginPath()
|
|
1155
|
+
* ctx.setLineJoin('miter')
|
|
1156
|
+
* ctx.setLineWidth(10)
|
|
1157
|
+
* ctx.moveTo(130, 10)
|
|
1158
|
+
* ctx.lineTo(220, 50)
|
|
1159
|
+
* ctx.lineTo(130, 90)
|
|
1160
|
+
* ctx.stroke()
|
|
1161
|
+
* ctx.draw()
|
|
1162
|
+
* ```
|
|
1163
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html
|
|
1164
|
+
*/
|
|
1165
|
+
setLineJoin(
|
|
1166
|
+
/** 线条的结束交点样式 */
|
|
1167
|
+
lineJoin: keyof CanvasContext.LineJoin,
|
|
1168
|
+
): void
|
|
1169
|
+
/** 设置线条的宽度
|
|
1170
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1171
|
+
* @example
|
|
1172
|
+
* ```tsx
|
|
1173
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1174
|
+
* ctx.beginPath()
|
|
1175
|
+
* ctx.moveTo(10, 10)
|
|
1176
|
+
* ctx.lineTo(150, 10)
|
|
1177
|
+
* ctx.stroke()
|
|
1178
|
+
* ctx.beginPath()
|
|
1179
|
+
* ctx.setLineWidth(5)
|
|
1180
|
+
* ctx.moveTo(10, 30)
|
|
1181
|
+
* ctx.lineTo(150, 30)
|
|
1182
|
+
* ctx.stroke()
|
|
1183
|
+
* ctx.beginPath()
|
|
1184
|
+
* ctx.setLineWidth(10)
|
|
1185
|
+
* ctx.moveTo(10, 50)
|
|
1186
|
+
* ctx.lineTo(150, 50)
|
|
1187
|
+
* ctx.stroke()
|
|
1188
|
+
* ctx.beginPath()
|
|
1189
|
+
* ctx.setLineWidth(15)
|
|
1190
|
+
* ctx.moveTo(10, 70)
|
|
1191
|
+
* ctx.lineTo(150, 70)
|
|
1192
|
+
* ctx.stroke()
|
|
1193
|
+
* ctx.draw()
|
|
1194
|
+
* ```
|
|
1195
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html
|
|
1196
|
+
*/
|
|
1197
|
+
setLineWidth(
|
|
1198
|
+
/** 线条的宽度,单位px */
|
|
1199
|
+
lineWidth: number,
|
|
1200
|
+
): void
|
|
1201
|
+
/** 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](/docs/apis/canvas/CanvasContext#setlinejoin) 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示。
|
|
1202
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1203
|
+
* @example
|
|
1204
|
+
* ```tsx
|
|
1205
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1206
|
+
* ctx.beginPath()
|
|
1207
|
+
* ctx.setLineWidth(10)
|
|
1208
|
+
* ctx.setLineJoin('miter')
|
|
1209
|
+
* ctx.setMiterLimit(1)
|
|
1210
|
+
* ctx.moveTo(10, 10)
|
|
1211
|
+
* ctx.lineTo(100, 50)
|
|
1212
|
+
* ctx.lineTo(10, 90)
|
|
1213
|
+
* ctx.stroke()
|
|
1214
|
+
* ctx.beginPath()
|
|
1215
|
+
* ctx.setLineWidth(10)
|
|
1216
|
+
* ctx.setLineJoin('miter')
|
|
1217
|
+
* ctx.setMiterLimit(2)
|
|
1218
|
+
* ctx.moveTo(50, 10)
|
|
1219
|
+
* ctx.lineTo(140, 50)
|
|
1220
|
+
* ctx.lineTo(50, 90)
|
|
1221
|
+
* ctx.stroke()
|
|
1222
|
+
* ctx.beginPath()
|
|
1223
|
+
* ctx.setLineWidth(10)
|
|
1224
|
+
* ctx.setLineJoin('miter')
|
|
1225
|
+
* ctx.setMiterLimit(3)
|
|
1226
|
+
* ctx.moveTo(90, 10)
|
|
1227
|
+
* ctx.lineTo(180, 50)
|
|
1228
|
+
* ctx.lineTo(90, 90)
|
|
1229
|
+
* ctx.stroke()
|
|
1230
|
+
* ctx.beginPath()
|
|
1231
|
+
* ctx.setLineWidth(10)
|
|
1232
|
+
* ctx.setLineJoin('miter')
|
|
1233
|
+
* ctx.setMiterLimit(4)
|
|
1234
|
+
* ctx.moveTo(130, 10)
|
|
1235
|
+
* ctx.lineTo(220, 50)
|
|
1236
|
+
* ctx.lineTo(130, 90)
|
|
1237
|
+
* ctx.stroke()
|
|
1238
|
+
* ctx.draw()
|
|
1239
|
+
* ```
|
|
1240
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html
|
|
1241
|
+
*/
|
|
1242
|
+
setMiterLimit(
|
|
1243
|
+
/** 最大斜接长度 */
|
|
1244
|
+
miterLimit: number,
|
|
1245
|
+
): void
|
|
1246
|
+
/** 设定阴影样式。
|
|
1247
|
+
* @supported weapp, alipay, swan, jd, qq, h5, harmony_hybrid
|
|
1248
|
+
* @example
|
|
1249
|
+
* ```tsx
|
|
1250
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1251
|
+
* ctx.setFillStyle('red')
|
|
1252
|
+
* ctx.setShadow(10, 50, 50, 'blue')
|
|
1253
|
+
* ctx.fillRect(10, 10, 150, 75)
|
|
1254
|
+
* ctx.draw()
|
|
1255
|
+
* ```
|
|
1256
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setShadow.html
|
|
1257
|
+
*/
|
|
1258
|
+
setShadow(
|
|
1259
|
+
/** 阴影相对于形状在水平方向的偏移,默认值为 0。 */
|
|
1260
|
+
offsetX: number,
|
|
1261
|
+
/** 阴影相对于形状在竖直方向的偏移,默认值为 0。 */
|
|
1262
|
+
offsetY: number,
|
|
1263
|
+
/** 阴影的模糊级别,数值越大越模糊。范围 0- 100。,默认值为 0。 */
|
|
1264
|
+
blur: number,
|
|
1265
|
+
/** 阴影的颜色。默认值为 black。 */
|
|
1266
|
+
color: string,
|
|
1267
|
+
): void
|
|
1268
|
+
/** 设置描边颜色。
|
|
1269
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1270
|
+
* @example
|
|
1271
|
+
* ```tsx
|
|
1272
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1273
|
+
* ctx.setStrokeStyle('red')
|
|
1274
|
+
* ctx.strokeRect(10, 10, 150, 75)
|
|
1275
|
+
* ctx.draw()
|
|
1276
|
+
* ```
|
|
1277
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html
|
|
1278
|
+
*/
|
|
1279
|
+
setStrokeStyle(
|
|
1280
|
+
/** 描边的颜色,默认颜色为 black。 */
|
|
1281
|
+
color: string | CanvasGradient,
|
|
1282
|
+
): void
|
|
1283
|
+
/** 设置文字的对齐
|
|
1284
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1285
|
+
* @example
|
|
1286
|
+
* ```tsx
|
|
1287
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1288
|
+
* ctx.setStrokeStyle('red')
|
|
1289
|
+
* ctx.moveTo(150, 20)
|
|
1290
|
+
* ctx.lineTo(150, 170)
|
|
1291
|
+
* ctx.stroke()
|
|
1292
|
+
* ctx.setFontSize(15)
|
|
1293
|
+
* ctx.setTextAlign('left')
|
|
1294
|
+
* ctx.fillText('textAlign=left', 150, 60)
|
|
1295
|
+
* await ctx.draw(true)
|
|
1296
|
+
* ctx.setTextAlign('center')
|
|
1297
|
+
* ctx.fillText('textAlign=center', 150, 80)
|
|
1298
|
+
* await ctx.draw(true)
|
|
1299
|
+
* ctx.setTextAlign('right')
|
|
1300
|
+
* ctx.fillText('textAlign=right', 150, 100)
|
|
1301
|
+
* await ctx.draw(true)
|
|
1302
|
+
* ```
|
|
1303
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextAlign.html
|
|
1304
|
+
*/
|
|
1305
|
+
setTextAlign(
|
|
1306
|
+
/** 文字的对齐方式 */
|
|
1307
|
+
align: keyof CanvasContext.Align,
|
|
1308
|
+
): void
|
|
1309
|
+
/** 设置文字的竖直对齐
|
|
1310
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1311
|
+
* @example
|
|
1312
|
+
* ```tsx
|
|
1313
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1314
|
+
* ctx.setStrokeStyle('red')
|
|
1315
|
+
* ctx.moveTo(5, 75)
|
|
1316
|
+
* ctx.lineTo(295, 75)
|
|
1317
|
+
* ctx.stroke()
|
|
1318
|
+
* ctx.setFontSize(20)
|
|
1319
|
+
* ctx.setTextBaseline('top')
|
|
1320
|
+
* ctx.fillText('top', 5, 75)
|
|
1321
|
+
* await ctx.draw(true)
|
|
1322
|
+
* ctx.setTextBaseline('middle')
|
|
1323
|
+
* ctx.fillText('middle', 50, 75)
|
|
1324
|
+
* await ctx.draw(true)
|
|
1325
|
+
* ctx.setTextBaseline('bottom')
|
|
1326
|
+
* ctx.fillText('bottom', 120, 75)
|
|
1327
|
+
* await ctx.draw(true)
|
|
1328
|
+
* ctx.setTextBaseline('normal')
|
|
1329
|
+
* ctx.fillText('normal', 200, 75)
|
|
1330
|
+
* await ctx.draw(true)
|
|
1331
|
+
* ```
|
|
1332
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextBaseline.html
|
|
1333
|
+
*/
|
|
1334
|
+
setTextBaseline(
|
|
1335
|
+
/** 文字的竖直对齐方式 */
|
|
1336
|
+
textBaseline: keyof CanvasContext.TextBaseline,
|
|
1337
|
+
): void
|
|
1338
|
+
/** 使用矩阵重新设置(覆盖)当前变换的方法
|
|
1339
|
+
* @supported weapp, swan, jd, tt, h5, harmony_hybrid
|
|
1340
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTransform.html
|
|
1341
|
+
*/
|
|
1342
|
+
setTransform(
|
|
1343
|
+
/** 水平缩放 */
|
|
1344
|
+
scaleX: number,
|
|
1345
|
+
/** 水平倾斜 */
|
|
1346
|
+
skewX: number,
|
|
1347
|
+
/** 垂直倾斜 */
|
|
1348
|
+
skewY: number,
|
|
1349
|
+
/** 垂直缩放 */
|
|
1350
|
+
scaleY: number,
|
|
1351
|
+
/** 水平移动 */
|
|
1352
|
+
translateX: number,
|
|
1353
|
+
/** 垂直移动 */
|
|
1354
|
+
translateY: number,
|
|
1355
|
+
): void
|
|
1356
|
+
/** 使用矩阵重新设置(覆盖)当前变换的方法
|
|
1357
|
+
* @supported alipay
|
|
1358
|
+
* @see https://opendocs.alipay.com/mini/api/wt6glg?pathHash=1d428fc1
|
|
1359
|
+
*/
|
|
1360
|
+
setTransform(
|
|
1361
|
+
/** 水平缩放 */
|
|
1362
|
+
scaleX: number,
|
|
1363
|
+
/** 垂直倾斜 */
|
|
1364
|
+
skewY: number,
|
|
1365
|
+
/** 水平倾斜 */
|
|
1366
|
+
skewX: number,
|
|
1367
|
+
/** 垂直缩放 */
|
|
1368
|
+
scaleY: number,
|
|
1369
|
+
/** 水平移动 */
|
|
1370
|
+
translateX: number,
|
|
1371
|
+
/** 垂直移动 */
|
|
1372
|
+
translateY: number,
|
|
1373
|
+
): void
|
|
1374
|
+
/** 使用矩阵重新设置(覆盖)当前变换的方法
|
|
1375
|
+
* @supported qq
|
|
1376
|
+
* @see https://q.qq.com/wiki/develop/miniprogram/API/canvas/canvasContext.html#settransform
|
|
1377
|
+
*/
|
|
1378
|
+
setTransform(
|
|
1379
|
+
/** 水平缩放 */
|
|
1380
|
+
scaleX: number,
|
|
1381
|
+
/** 垂直缩放 */
|
|
1382
|
+
scaleY: number,
|
|
1383
|
+
/** 水平倾斜 */
|
|
1384
|
+
skewX: number,
|
|
1385
|
+
/** 垂直倾斜 */
|
|
1386
|
+
skewY: number,
|
|
1387
|
+
/** 水平移动 */
|
|
1388
|
+
translateX: number,
|
|
1389
|
+
/** 垂直移动 */
|
|
1390
|
+
translateY: number,
|
|
1391
|
+
): void
|
|
1392
|
+
/** 画出当前路径的边框。默认颜色色为黑色。
|
|
1393
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1394
|
+
* @example
|
|
1395
|
+
* ```tsx
|
|
1396
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1397
|
+
* ctx.moveTo(10, 10)
|
|
1398
|
+
* ctx.lineTo(100, 10)
|
|
1399
|
+
* ctx.lineTo(100, 100)
|
|
1400
|
+
* ctx.stroke()
|
|
1401
|
+
* ctx.draw()
|
|
1402
|
+
* ```
|
|
1403
|
+
* @example
|
|
1404
|
+
* stroke() 描绘的的路径是从 beginPath() 开始计算,但是不会将 strokeRect() 包含进去。
|
|
1405
|
+
*
|
|
1406
|
+
* ```tsx
|
|
1407
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1408
|
+
* // begin path
|
|
1409
|
+
* ctx.rect(10, 10, 100, 30)
|
|
1410
|
+
* ctx.setStrokeStyle('yellow')
|
|
1411
|
+
* ctx.stroke()
|
|
1412
|
+
* // begin another path
|
|
1413
|
+
* ctx.beginPath()
|
|
1414
|
+
* ctx.rect(10, 40, 100, 30)
|
|
1415
|
+
* // only stoke this rect, not in current path
|
|
1416
|
+
* ctx.setStrokeStyle('blue')
|
|
1417
|
+
* ctx.strokeRect(10, 70, 100, 30)
|
|
1418
|
+
* ctx.rect(10, 100, 100, 30)
|
|
1419
|
+
* // it will stroke current path
|
|
1420
|
+
* ctx.setStrokeStyle('red')
|
|
1421
|
+
* ctx.stroke()
|
|
1422
|
+
* ctx.draw()
|
|
1423
|
+
* ```
|
|
1424
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html
|
|
1425
|
+
*/
|
|
1426
|
+
stroke(): void
|
|
1427
|
+
/** 画一个矩形(非填充)。 用 [`setStrokeStyle`](/docs/apis/canvas/CanvasContext#setstrokestyle) 设置矩形线条的颜色,如果没设置默认是黑色。
|
|
1428
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1429
|
+
* @example
|
|
1430
|
+
* ```tsx
|
|
1431
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1432
|
+
* ctx.setStrokeStyle('red')
|
|
1433
|
+
* ctx.strokeRect(10, 10, 150, 75)
|
|
1434
|
+
* ctx.draw()
|
|
1435
|
+
* ```
|
|
1436
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeRect.html
|
|
1437
|
+
*/
|
|
1438
|
+
strokeRect(
|
|
1439
|
+
/** 矩形路径左上角的横坐标 */
|
|
1440
|
+
x: number,
|
|
1441
|
+
/** 矩形路径左上角的纵坐标 */
|
|
1442
|
+
y: number,
|
|
1443
|
+
/** 矩形路径的宽度 */
|
|
1444
|
+
width: number,
|
|
1445
|
+
/** 矩形路径的高度 */
|
|
1446
|
+
height: number,
|
|
1447
|
+
): void
|
|
1448
|
+
/** 给定的 (x, y) 位置绘制文本描边的方法
|
|
1449
|
+
* @supported weapp, alipay, swan, jd, qq, h5, harmony_hybrid
|
|
1450
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeText.html
|
|
1451
|
+
*/
|
|
1452
|
+
strokeText(
|
|
1453
|
+
/** 要绘制的文本 */
|
|
1454
|
+
text: string,
|
|
1455
|
+
/** 文本起始点的 x 轴坐标 */
|
|
1456
|
+
x: number,
|
|
1457
|
+
/** 文本起始点的 y 轴坐标 */
|
|
1458
|
+
y: number,
|
|
1459
|
+
/** 需要绘制的最大宽度,可选 */
|
|
1460
|
+
maxWidth?: number,
|
|
1461
|
+
): void
|
|
1462
|
+
/** 使用矩阵多次叠加当前变换的方法
|
|
1463
|
+
* @supported weapp, jd, tt, h5, harmony_hybrid
|
|
1464
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.transform.html
|
|
1465
|
+
*/
|
|
1466
|
+
transform(
|
|
1467
|
+
/** 水平缩放 */
|
|
1468
|
+
scaleX: number,
|
|
1469
|
+
/** 水平倾斜 */
|
|
1470
|
+
skewX: number,
|
|
1471
|
+
/** 垂直倾斜 */
|
|
1472
|
+
skewY: number,
|
|
1473
|
+
/** 垂直缩放 */
|
|
1474
|
+
scaleY: number,
|
|
1475
|
+
/** 水平移动 */
|
|
1476
|
+
translateX: number,
|
|
1477
|
+
/** 垂直移动 */
|
|
1478
|
+
translateY: number,
|
|
1479
|
+
): void
|
|
1480
|
+
/** 使用矩阵叠加当前变换。矩阵由方法的参数进行描述,可以缩放、旋转、移动和倾斜上下文
|
|
1481
|
+
* @supported alipay
|
|
1482
|
+
* @see https://opendocs.alipay.com/mini/api/fv97do?pathHash=42ccd479
|
|
1483
|
+
*/
|
|
1484
|
+
transform(
|
|
1485
|
+
/** 水平缩放 */
|
|
1486
|
+
scaleX: number,
|
|
1487
|
+
/** 垂直倾斜 */
|
|
1488
|
+
skewY: number,
|
|
1489
|
+
/** 水平倾斜 */
|
|
1490
|
+
skewX: number,
|
|
1491
|
+
/** 垂直缩放 */
|
|
1492
|
+
scaleY: number,
|
|
1493
|
+
/** 水平移动 */
|
|
1494
|
+
translateX: number,
|
|
1495
|
+
/** 垂直移动 */
|
|
1496
|
+
translateY: number,
|
|
1497
|
+
): void
|
|
1498
|
+
/** 使用矩阵多次叠加当前变换的方法
|
|
1499
|
+
* @supported qq
|
|
1500
|
+
* @see https://q.qq.com/wiki/develop/miniprogram/API/canvas/canvasContext.html#transform
|
|
1501
|
+
*/
|
|
1502
|
+
transform(
|
|
1503
|
+
/** 水平缩放 */
|
|
1504
|
+
scaleX: number,
|
|
1505
|
+
/** 垂直缩放 */
|
|
1506
|
+
scaleY: number,
|
|
1507
|
+
/** 水平倾斜 */
|
|
1508
|
+
skewX: number,
|
|
1509
|
+
/** 垂直倾斜 */
|
|
1510
|
+
skewY: number,
|
|
1511
|
+
/** 水平移动 */
|
|
1512
|
+
translateX: number,
|
|
1513
|
+
/** 垂直移动 */
|
|
1514
|
+
translateY: number,
|
|
1515
|
+
): void
|
|
1516
|
+
/** 对当前坐标系的原点 (0, 0) 进行变换。默认的坐标系原点为页面左上角。
|
|
1517
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
1518
|
+
* @example
|
|
1519
|
+
* ```tsx
|
|
1520
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1521
|
+
* ctx.strokeRect(10, 10, 150, 100)
|
|
1522
|
+
* ctx.translate(20, 20)
|
|
1523
|
+
* ctx.strokeRect(10, 10, 150, 100)
|
|
1524
|
+
* ctx.translate(20, 20)
|
|
1525
|
+
* ctx.strokeRect(10, 10, 150, 100)
|
|
1526
|
+
* ctx.draw()
|
|
1527
|
+
* ```
|
|
1528
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.translate.html
|
|
1529
|
+
*/
|
|
1530
|
+
translate(
|
|
1531
|
+
/** 水平坐标平移量 */
|
|
1532
|
+
x: number,
|
|
1533
|
+
/** 竖直坐标平移量 */
|
|
1534
|
+
y: number,
|
|
1535
|
+
): void
|
|
1536
|
+
}
|
|
1537
|
+
namespace CanvasContext {
|
|
1538
|
+
/** 参数 repetition 可选值 */
|
|
1539
|
+
interface Repetition {
|
|
1540
|
+
/** 水平竖直方向都重复 */
|
|
1541
|
+
'repeat'
|
|
1542
|
+
/** 水平方向重复 */
|
|
1543
|
+
'repeat-x'
|
|
1544
|
+
/** 竖直方向重复 */
|
|
1545
|
+
'repeat-y'
|
|
1546
|
+
/** 不重复 */
|
|
1547
|
+
'no-repeat'
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
/** 参数 lineCap 可选值 */
|
|
1551
|
+
interface LineCap {
|
|
1552
|
+
/** 向线条的每个末端添加平直的边缘。 */
|
|
1553
|
+
butt
|
|
1554
|
+
/** 向线条的每个末端添加圆形线帽。 */
|
|
1555
|
+
round
|
|
1556
|
+
/** 向线条的每个末端添加正方形线帽。 */
|
|
1557
|
+
square
|
|
1558
|
+
}
|
|
1559
|
+
/** 参数 lineJoin 可选值 */
|
|
1560
|
+
interface LineJoin {
|
|
1561
|
+
/** 斜角 */
|
|
1562
|
+
bevel
|
|
1563
|
+
/** 圆角 */
|
|
1564
|
+
round
|
|
1565
|
+
/** 尖角 */
|
|
1566
|
+
miter
|
|
1567
|
+
}
|
|
1568
|
+
/** 参数 align 可选值 */
|
|
1569
|
+
interface Align {
|
|
1570
|
+
/** 左对齐 */
|
|
1571
|
+
left
|
|
1572
|
+
/** 居中对齐 */
|
|
1573
|
+
center
|
|
1574
|
+
/** 右对齐 */
|
|
1575
|
+
right
|
|
1576
|
+
}
|
|
1577
|
+
/** 参数 textBaseline 可选值 */
|
|
1578
|
+
interface TextBaseline {
|
|
1579
|
+
/** 顶部对齐
|
|
1580
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
1581
|
+
*/
|
|
1582
|
+
top
|
|
1583
|
+
/** 底部对齐
|
|
1584
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
1585
|
+
*/
|
|
1586
|
+
bottom
|
|
1587
|
+
/** 居中对齐
|
|
1588
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
1589
|
+
*/
|
|
1590
|
+
middle
|
|
1591
|
+
/**
|
|
1592
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
1593
|
+
*/
|
|
1594
|
+
normal
|
|
1595
|
+
/** 文本基线为悬挂基线。
|
|
1596
|
+
* @supported alipay, tt, h5
|
|
1597
|
+
*/
|
|
1598
|
+
hanging
|
|
1599
|
+
/** 文本基线是标准的字母基线
|
|
1600
|
+
* @supported alipay, tt, h5
|
|
1601
|
+
*/
|
|
1602
|
+
alphabetic
|
|
1603
|
+
/** 文字基线是表意字基线。如果字符本身超出了alphabetic 基线,那么ideograhpic基线位置在字符本身的底部。
|
|
1604
|
+
* @supported alipay, tt, h5
|
|
1605
|
+
*/
|
|
1606
|
+
ideographic
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
/** 创建 canvas 的绘图上下文 CanvasContext 对象
|
|
1611
|
+
* @supported weapp
|
|
1612
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html
|
|
1613
|
+
*/
|
|
1614
|
+
interface CanvasGradient {
|
|
1615
|
+
/** 添加颜色的渐变点。小于最小 stop 的部分会按最小 stop 的 color 来渲染,大于最大 stop 的部分会按最大 stop 的 color 来渲染
|
|
1616
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
1617
|
+
* @example
|
|
1618
|
+
* ```tsx
|
|
1619
|
+
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
1620
|
+
* // Create circular gradient
|
|
1621
|
+
* const grd = ctx.createLinearGradient(30, 10, 120, 10)
|
|
1622
|
+
* grd.addColorStop(0, 'red')
|
|
1623
|
+
* grd.addColorStop(0.16, 'orange')
|
|
1624
|
+
* grd.addColorStop(0.33, 'yellow')
|
|
1625
|
+
* grd.addColorStop(0.5, 'green')
|
|
1626
|
+
* grd.addColorStop(0.66, 'cyan')
|
|
1627
|
+
* grd.addColorStop(0.83, 'blue')
|
|
1628
|
+
* grd.addColorStop(1, 'purple')
|
|
1629
|
+
* // Fill with gradient
|
|
1630
|
+
* ctx.setFillStyle(grd)
|
|
1631
|
+
* ctx.fillRect(10, 10, 150, 80)
|
|
1632
|
+
* ctx.draw()
|
|
1633
|
+
* ```
|
|
1634
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html
|
|
1635
|
+
*/
|
|
1636
|
+
addColorStop(
|
|
1637
|
+
/** 表示渐变中开始与结束之间的位置,范围 0-1。 */
|
|
1638
|
+
stop: number,
|
|
1639
|
+
/** 渐变点的颜色。 */
|
|
1640
|
+
color: string,
|
|
1641
|
+
): void
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
/** 颜色。可以用以下几种方式来表示 canvas 中使用的颜色:
|
|
1645
|
+
*
|
|
1646
|
+
* - RGB 颜色: 如 `'rgb(255, 0, 0)'`
|
|
1647
|
+
* - RGBA 颜色:如 `'rgba(255, 0, 0, 0.3)'`
|
|
1648
|
+
* - 16 进制颜色: 如 `'#FF0000'`
|
|
1649
|
+
* - 预定义的颜色: 如 `'red'`
|
|
1650
|
+
*
|
|
1651
|
+
* 其中预定义颜色有以下148个:
|
|
1652
|
+
* *注意**: Color Name 大小写不敏感
|
|
1653
|
+
*
|
|
1654
|
+
* | Color Name | HEX |
|
|
1655
|
+
* | -------------------- | ------- |
|
|
1656
|
+
* | AliceBlue | #F0F8FF |
|
|
1657
|
+
* | AntiqueWhite | #FAEBD7 |
|
|
1658
|
+
* | Aqua | #00FFFF |
|
|
1659
|
+
* | Aquamarine | #7FFFD4 |
|
|
1660
|
+
* | Azure | #F0FFFF |
|
|
1661
|
+
* | Beige | #F5F5DC |
|
|
1662
|
+
* | Bisque | #FFE4C4 |
|
|
1663
|
+
* | Black | #000000 |
|
|
1664
|
+
* | BlanchedAlmond | #FFEBCD |
|
|
1665
|
+
* | Blue | #0000FF |
|
|
1666
|
+
* | BlueViolet | #8A2BE2 |
|
|
1667
|
+
* | Brown | #A52A2A |
|
|
1668
|
+
* | BurlyWood | #DEB887 |
|
|
1669
|
+
* | CadetBlue | #5F9EA0 |
|
|
1670
|
+
* | Chartreuse | #7FFF00 |
|
|
1671
|
+
* | Chocolate | #D2691E |
|
|
1672
|
+
* | Coral | #FF7F50 |
|
|
1673
|
+
* | CornflowerBlue | #6495ED |
|
|
1674
|
+
* | Cornsilk | #FFF8DC |
|
|
1675
|
+
* | Crimson | #DC143C |
|
|
1676
|
+
* | Cyan | #00FFFF |
|
|
1677
|
+
* | DarkBlue | #00008B |
|
|
1678
|
+
* | DarkCyan | #008B8B |
|
|
1679
|
+
* | DarkGoldenRod | #B8860B |
|
|
1680
|
+
* | DarkGray | #A9A9A9 |
|
|
1681
|
+
* | DarkGrey | #A9A9A9 |
|
|
1682
|
+
* | DarkGreen | #006400 |
|
|
1683
|
+
* | DarkKhaki | #BDB76B |
|
|
1684
|
+
* | DarkMagenta | #8B008B |
|
|
1685
|
+
* | DarkOliveGreen | #556B2F |
|
|
1686
|
+
* | DarkOrange | #FF8C00 |
|
|
1687
|
+
* | DarkOrchid | #9932CC |
|
|
1688
|
+
* | DarkRed | #8B0000 |
|
|
1689
|
+
* | DarkSalmon | #E9967A |
|
|
1690
|
+
* | DarkSeaGreen | #8FBC8F |
|
|
1691
|
+
* | DarkSlateBlue | #483D8B |
|
|
1692
|
+
* | DarkSlateGray | #2F4F4F |
|
|
1693
|
+
* | DarkSlateGrey | #2F4F4F |
|
|
1694
|
+
* | DarkTurquoise | #00CED1 |
|
|
1695
|
+
* | DarkViolet | #9400D3 |
|
|
1696
|
+
* | DeepPink | #FF1493 |
|
|
1697
|
+
* | DeepSkyBlue | #00BFFF |
|
|
1698
|
+
* | DimGray | #696969 |
|
|
1699
|
+
* | DimGrey | #696969 |
|
|
1700
|
+
* | DodgerBlue | #1E90FF |
|
|
1701
|
+
* | FireBrick | #B22222 |
|
|
1702
|
+
* | FloralWhite | #FFFAF0 |
|
|
1703
|
+
* | ForestGreen | #228B22 |
|
|
1704
|
+
* | Fuchsia | #FF00FF |
|
|
1705
|
+
* | Gainsboro | #DCDCDC |
|
|
1706
|
+
* | GhostWhite | #F8F8FF |
|
|
1707
|
+
* | Gold | #FFD700 |
|
|
1708
|
+
* | GoldenRod | #DAA520 |
|
|
1709
|
+
* | Gray | #808080 |
|
|
1710
|
+
* | Grey | #808080 |
|
|
1711
|
+
* | Green | #008000 |
|
|
1712
|
+
* | GreenYellow | #ADFF2F |
|
|
1713
|
+
* | HoneyDew | #F0FFF0 |
|
|
1714
|
+
* | HotPink | #FF69B4 |
|
|
1715
|
+
* | IndianRed | #CD5C5C |
|
|
1716
|
+
* | Indigo | #4B0082 |
|
|
1717
|
+
* | Ivory | #FFFFF0 |
|
|
1718
|
+
* | Khaki | #F0E68C |
|
|
1719
|
+
* | Lavender | #E6E6FA |
|
|
1720
|
+
* | LavenderBlush | #FFF0F5 |
|
|
1721
|
+
* | LawnGreen | #7CFC00 |
|
|
1722
|
+
* | LemonChiffon | #FFFACD |
|
|
1723
|
+
* | LightBlue | #ADD8E6 |
|
|
1724
|
+
* | LightCoral | #F08080 |
|
|
1725
|
+
* | LightCyan | #E0FFFF |
|
|
1726
|
+
* | LightGoldenRodYellow | #FAFAD2 |
|
|
1727
|
+
* | LightGray | #D3D3D3 |
|
|
1728
|
+
* | LightGrey | #D3D3D3 |
|
|
1729
|
+
* | LightGreen | #90EE90 |
|
|
1730
|
+
* | LightPink | #FFB6C1 |
|
|
1731
|
+
* | LightSalmon | #FFA07A |
|
|
1732
|
+
* | LightSeaGreen | #20B2AA |
|
|
1733
|
+
* | LightSkyBlue | #87CEFA |
|
|
1734
|
+
* | LightSlateGray | #778899 |
|
|
1735
|
+
* | LightSlateGrey | #778899 |
|
|
1736
|
+
* | LightSteelBlue | #B0C4DE |
|
|
1737
|
+
* | LightYellow | #FFFFE0 |
|
|
1738
|
+
* | Lime | #00FF00 |
|
|
1739
|
+
* | LimeGreen | #32CD32 |
|
|
1740
|
+
* | Linen | #FAF0E6 |
|
|
1741
|
+
* | Magenta | #FF00FF |
|
|
1742
|
+
* | Maroon | #800000 |
|
|
1743
|
+
* | MediumAquaMarine | #66CDAA |
|
|
1744
|
+
* | MediumBlue | #0000CD |
|
|
1745
|
+
* | MediumOrchid | #BA55D3 |
|
|
1746
|
+
* | MediumPurple | #9370DB |
|
|
1747
|
+
* | MediumSeaGreen | #3CB371 |
|
|
1748
|
+
* | MediumSlateBlue | #7B68EE |
|
|
1749
|
+
* | MediumSpringGreen | #00FA9A |
|
|
1750
|
+
* | MediumTurquoise | #48D1CC |
|
|
1751
|
+
* | MediumVioletRed | #C71585 |
|
|
1752
|
+
* | MidnightBlue | #191970 |
|
|
1753
|
+
* | MintCream | #F5FFFA |
|
|
1754
|
+
* | MistyRose | #FFE4E1 |
|
|
1755
|
+
* | Moccasin | #FFE4B5 |
|
|
1756
|
+
* | NavajoWhite | #FFDEAD |
|
|
1757
|
+
* | Navy | #000080 |
|
|
1758
|
+
* | OldLace | #FDF5E6 |
|
|
1759
|
+
* | Olive | #808000 |
|
|
1760
|
+
* | OliveDrab | #6B8E23 |
|
|
1761
|
+
* | Orange | #FFA500 |
|
|
1762
|
+
* | OrangeRed | #FF4500 |
|
|
1763
|
+
* | Orchid | #DA70D6 |
|
|
1764
|
+
* | PaleGoldenRod | #EEE8AA |
|
|
1765
|
+
* | PaleGreen | #98FB98 |
|
|
1766
|
+
* | PaleTurquoise | #AFEEEE |
|
|
1767
|
+
* | PaleVioletRed | #DB7093 |
|
|
1768
|
+
* | PapayaWhip | #FFEFD5 |
|
|
1769
|
+
* | PeachPuff | #FFDAB9 |
|
|
1770
|
+
* | Peru | #CD853F |
|
|
1771
|
+
* | Pink | #FFC0CB |
|
|
1772
|
+
* | Plum | #DDA0DD |
|
|
1773
|
+
* | PowderBlue | #B0E0E6 |
|
|
1774
|
+
* | Purple | #800080 |
|
|
1775
|
+
* | RebeccaPurple | #663399 |
|
|
1776
|
+
* | Red | #FF0000 |
|
|
1777
|
+
* | RosyBrown | #BC8F8F |
|
|
1778
|
+
* | RoyalBlue | #4169E1 |
|
|
1779
|
+
* | SaddleBrown | #8B4513 |
|
|
1780
|
+
* | Salmon | #FA8072 |
|
|
1781
|
+
* | SandyBrown | #F4A460 |
|
|
1782
|
+
* | SeaGreen | #2E8B57 |
|
|
1783
|
+
* | SeaShell | #FFF5EE |
|
|
1784
|
+
* | Sienna | #A0522D |
|
|
1785
|
+
* | Silver | #C0C0C0 |
|
|
1786
|
+
* | SkyBlue | #87CEEB |
|
|
1787
|
+
* | SlateBlue | #6A5ACD |
|
|
1788
|
+
* | SlateGray | #708090 |
|
|
1789
|
+
* | SlateGrey | #708090 |
|
|
1790
|
+
* | Snow | #FFFAFA |
|
|
1791
|
+
* | SpringGreen | #00FF7F |
|
|
1792
|
+
* | SteelBlue | #4682B4 |
|
|
1793
|
+
* | Tan | #D2B48C |
|
|
1794
|
+
* | Teal | #008080 |
|
|
1795
|
+
* | Thistle | #D8BFD8 |
|
|
1796
|
+
* | Tomato | #FF6347 |
|
|
1797
|
+
* | Turquoise | #40E0D0 |
|
|
1798
|
+
* | Violet | #EE82EE |
|
|
1799
|
+
* | Wheat | #F5DEB3 |
|
|
1800
|
+
* | White | #FFFFFF |
|
|
1801
|
+
* | WhiteSmoke | #F5F5F5 |
|
|
1802
|
+
* | Yellow | #FFFF00 |
|
|
1803
|
+
* | YellowGreen | #9ACD32 |
|
|
1804
|
+
* @supported weapp
|
|
1805
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Color.html
|
|
1806
|
+
*/
|
|
1807
|
+
interface Color {}
|
|
1808
|
+
|
|
1809
|
+
/** 图片对象
|
|
1810
|
+
* @supported weapp
|
|
1811
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Image.html
|
|
1812
|
+
*/
|
|
1813
|
+
interface Image {
|
|
1814
|
+
/** 图片的 URL */
|
|
1815
|
+
src: string
|
|
1816
|
+
/** 图片的真实高度 */
|
|
1817
|
+
height: number
|
|
1818
|
+
/** 图片的真实宽度 */
|
|
1819
|
+
width: number
|
|
1820
|
+
/** origin: 发送完整的referrer; no-referrer: 不发送。
|
|
1821
|
+
*
|
|
1822
|
+
* 格式固定为 https://servicewechat.com/{appid}/{version}/page-frame.html,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本
|
|
1823
|
+
* @supported weapp
|
|
1824
|
+
*/
|
|
1825
|
+
referrerPolicy: string
|
|
1826
|
+
/** 图片加载发生错误后触发的回调函数 */
|
|
1827
|
+
onerror: (...args: any[]) => any
|
|
1828
|
+
/** 图片加载完成后触发的回调函数 */
|
|
1829
|
+
onload: (...args: any[]) => any
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
/** ImageData 对象
|
|
1833
|
+
* @supported weapp
|
|
1834
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/ImageData.html
|
|
1835
|
+
*/
|
|
1836
|
+
interface ImageData {
|
|
1837
|
+
/** 使用像素描述 ImageData 的实际宽度 */
|
|
1838
|
+
width: number
|
|
1839
|
+
/** 使用像素描述 ImageData 的实际高度 */
|
|
1840
|
+
height: number
|
|
1841
|
+
/** 一维数组,包含以 RGBA 顺序的数据,数据使用 0 至 255(包含)的整数表示 */
|
|
1842
|
+
data: Uint8ClampedArray
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
/** 离屏 canvas 实例,可通过 Taro.createOffscreenCanvas 创建。
|
|
1846
|
+
* @supported weapp
|
|
1847
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html
|
|
1848
|
+
*/
|
|
1849
|
+
interface OffscreenCanvas {
|
|
1850
|
+
/** 画布宽度 */
|
|
1851
|
+
width: number
|
|
1852
|
+
/** 画布高度 */
|
|
1853
|
+
height: number
|
|
1854
|
+
/** 创建一个图片对象。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法
|
|
1855
|
+
*
|
|
1856
|
+
* > 注意不允许混用 webgl 和 2d 画布创建的图片对象,使用时请注意尽量使用 canvas 自身的 createImage 创建图片对象。
|
|
1857
|
+
* @supported weapp
|
|
1858
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.createImage.html
|
|
1859
|
+
*/
|
|
1860
|
+
createImage(): Image
|
|
1861
|
+
/** 该方法返回 OffscreenCanvas 的绘图上下文
|
|
1862
|
+
*
|
|
1863
|
+
* > 当前仅支持获取 WebGL 绘图上下文
|
|
1864
|
+
* @supported weapp, tt
|
|
1865
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.getContext.html
|
|
1866
|
+
*/
|
|
1867
|
+
getContext(contextType: 'webgl' | '2d'): RenderingContext
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
/** Canvas 2D API 的接口 Path2D 用来声明路径,此路径稍后会被CanvasRenderingContext2D 对象使用。CanvasRenderingContext2D 接口的 路径方法 也存在于 Path2D 这个接口中,允许你在 canvas 中根据需要创建可以保留并重用的路径。
|
|
1871
|
+
* @supported weapp
|
|
1872
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html
|
|
1873
|
+
*/
|
|
1874
|
+
interface Path2D {
|
|
1875
|
+
/** 添加路径到当前路径。
|
|
1876
|
+
* @supported weapp
|
|
1877
|
+
*/
|
|
1878
|
+
addPath(
|
|
1879
|
+
/** 添加的 Path2D 路径 */
|
|
1880
|
+
path: Path2D
|
|
1881
|
+
): void
|
|
1882
|
+
/** 添加一段圆弧路径
|
|
1883
|
+
* @supported weapp
|
|
1884
|
+
*/
|
|
1885
|
+
arc(
|
|
1886
|
+
/** 圆心横坐标 */
|
|
1887
|
+
x: number,
|
|
1888
|
+
/** 圆心纵坐标 */
|
|
1889
|
+
y: number,
|
|
1890
|
+
/** 圆形半径,必须为正数 */
|
|
1891
|
+
radius: number,
|
|
1892
|
+
/** 圆弧开始角度 */
|
|
1893
|
+
startAngle: number,
|
|
1894
|
+
/** 圆弧结束角度 */
|
|
1895
|
+
endAngle: number,
|
|
1896
|
+
/** 是否逆时针绘制。如果传 true, 则会从 endAngle 开始绘制到 startAngle */
|
|
1897
|
+
counterclockwise: boolean
|
|
1898
|
+
): void
|
|
1899
|
+
/** 通过给定控制点添加一段圆弧路径
|
|
1900
|
+
* @supported weapp
|
|
1901
|
+
*/
|
|
1902
|
+
arcTo(
|
|
1903
|
+
/** 第一个控制点横坐标 */
|
|
1904
|
+
x1: number,
|
|
1905
|
+
/** 第一个控制点纵坐标 */
|
|
1906
|
+
y1: number,
|
|
1907
|
+
/** 第二个控制点横坐标 */
|
|
1908
|
+
x2: number,
|
|
1909
|
+
/** 第二个控制点纵坐标 */
|
|
1910
|
+
y2: number,
|
|
1911
|
+
/** 圆形半径,必须为非负数 */
|
|
1912
|
+
radius: number
|
|
1913
|
+
): void
|
|
1914
|
+
/** 添加三次贝塞尔曲线路径
|
|
1915
|
+
* @supported weapp
|
|
1916
|
+
*/
|
|
1917
|
+
bezierCurveTo(
|
|
1918
|
+
/** 第一个控制点横坐标 */
|
|
1919
|
+
cp1x: number,
|
|
1920
|
+
/** 第一个控制点纵坐标 */
|
|
1921
|
+
cp1y: number,
|
|
1922
|
+
/** 第二个控制点横坐标 */
|
|
1923
|
+
cp2x: number,
|
|
1924
|
+
/** 第二个控制点纵坐标 */
|
|
1925
|
+
cp2y: number,
|
|
1926
|
+
/** 结束点横坐标 */
|
|
1927
|
+
x: number,
|
|
1928
|
+
/** 结束点纵坐标 */
|
|
1929
|
+
y: number
|
|
1930
|
+
): void
|
|
1931
|
+
/** 闭合路径到起点
|
|
1932
|
+
* @supported weapp
|
|
1933
|
+
*/
|
|
1934
|
+
closePath(): void
|
|
1935
|
+
/** 添加椭圆弧路径
|
|
1936
|
+
* @supported weapp
|
|
1937
|
+
*/
|
|
1938
|
+
ellipse(
|
|
1939
|
+
/** 椭圆圆心横坐标 */
|
|
1940
|
+
x: number,
|
|
1941
|
+
/** 椭圆圆心纵坐标 */
|
|
1942
|
+
y: number,
|
|
1943
|
+
/** 椭圆长轴半径,必须为非负数 */
|
|
1944
|
+
radiusX: number,
|
|
1945
|
+
/** 椭圆短轴半径,必须为非负数 */
|
|
1946
|
+
radiusY: number,
|
|
1947
|
+
/** 椭圆旋转角度 */
|
|
1948
|
+
rotation: number,
|
|
1949
|
+
/** 圆弧开始角度 */
|
|
1950
|
+
startAngle: number,
|
|
1951
|
+
/** 圆弧结束角度 */
|
|
1952
|
+
endAngle: number,
|
|
1953
|
+
/** 是否逆时针绘制。如果传 true, 则会从 endAngle 开始绘制到 startAngle */
|
|
1954
|
+
counterclockwise: boolean
|
|
1955
|
+
): void
|
|
1956
|
+
/** 添加直线路径
|
|
1957
|
+
* @supported weapp
|
|
1958
|
+
*/
|
|
1959
|
+
lineTo(
|
|
1960
|
+
/** 结束点横坐标 */
|
|
1961
|
+
x: number,
|
|
1962
|
+
/** 结束点纵坐标 */
|
|
1963
|
+
y: number
|
|
1964
|
+
): void
|
|
1965
|
+
/** 移动路径开始点
|
|
1966
|
+
* @supported weapp
|
|
1967
|
+
*/
|
|
1968
|
+
moveTo(
|
|
1969
|
+
/** 横坐标 */
|
|
1970
|
+
x: number,
|
|
1971
|
+
/** 纵坐标 */
|
|
1972
|
+
y: number
|
|
1973
|
+
): void
|
|
1974
|
+
/** 添加二次贝塞尔曲线路径
|
|
1975
|
+
* @supported weapp
|
|
1976
|
+
*/
|
|
1977
|
+
quadraticCurveTo(
|
|
1978
|
+
/** 控制点横坐标 */
|
|
1979
|
+
cpx: number,
|
|
1980
|
+
/** 控制点纵坐标 */
|
|
1981
|
+
cpy: number,
|
|
1982
|
+
/** 结束点横坐标 */
|
|
1983
|
+
x: number,
|
|
1984
|
+
/** 结束点纵坐标 */
|
|
1985
|
+
y: number
|
|
1986
|
+
): void
|
|
1987
|
+
/** 添加方形路径
|
|
1988
|
+
* @supported weapp
|
|
1989
|
+
*/
|
|
1990
|
+
rect(
|
|
1991
|
+
/** 开始点横坐标 */
|
|
1992
|
+
x: number,
|
|
1993
|
+
/** 开始点纵坐标 */
|
|
1994
|
+
y: number,
|
|
1995
|
+
/** 方形宽度,正数向右,负数向左 */
|
|
1996
|
+
width: number,
|
|
1997
|
+
/** 方形高度,正数向下,负数向上 */
|
|
1998
|
+
height: number
|
|
1999
|
+
): void
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
/** Canvas 绘图上下文。
|
|
2003
|
+
*
|
|
2004
|
+
* ****
|
|
2005
|
+
*
|
|
2006
|
+
* - 通过 Canvas.getContext('2d') 接口可以获取 CanvasRenderingContext2D 对象,实现了 [HTML Canvas 2D Context](https://www.w3.org/TR/2dcontext/) 定义的属性、方法。
|
|
2007
|
+
* - 通过 Canvas.getContext('webgl') 或 OffscreenCanvas.getContext('webgl') 接口可以获取 WebGLRenderingContext 对象,实现了 [WebGL 1.0](https://www.khronos.org/registry/webgl/specs/latest/1.0/) 定义的所有属性、方法、常量。
|
|
2008
|
+
* - CanvasRenderingContext2D 的 drawImage 方法 2.10.0 起支持传入通过 SelectorQuery 获取的 video 对象,2.29.0 起支持传入开启了自定义渲染的 LivePusherContext 对象。
|
|
2009
|
+
* @supported weapp, alipay, tt
|
|
2010
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html
|
|
2011
|
+
*/
|
|
2012
|
+
interface RenderingContext {}
|
|
2013
|
+
|
|
2014
|
+
interface TaroStatic {
|
|
2015
|
+
/** 创建离屏 canvas 实例
|
|
2016
|
+
* @supported weapp, tt
|
|
2017
|
+
* @example
|
|
2018
|
+
* ```tsx
|
|
2019
|
+
* // 创建离屏 2D canvas 实例
|
|
2020
|
+
* const canvas = Taro.createOffscreenCanvas({type: '2d', width: 300, height: 150})
|
|
2021
|
+
* // 获取 context。注意这里必须要与创建时的 type 一致
|
|
2022
|
+
* const context = canvas.getContext('2d')
|
|
2023
|
+
*
|
|
2024
|
+
* // 创建一个图片
|
|
2025
|
+
* const image = canvas.createImage()
|
|
2026
|
+
* // 等待图片加载
|
|
2027
|
+
* await new Promise(resolve => {
|
|
2028
|
+
* image.onload = resolve
|
|
2029
|
+
* image.src = IMAGE_URL // 要加载的图片 url
|
|
2030
|
+
* })
|
|
2031
|
+
*
|
|
2032
|
+
* // 把图片画到离屏 canvas 上
|
|
2033
|
+
* context.clearRect(0, 0, 300, 150)
|
|
2034
|
+
* context.drawImage(image, 0, 0, 300, 150)
|
|
2035
|
+
*
|
|
2036
|
+
* // 获取画完后的数据
|
|
2037
|
+
* const imgData = context.getImageData(0, 0, 300, 150)
|
|
2038
|
+
* ```
|
|
2039
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html
|
|
2040
|
+
*
|
|
2041
|
+
* 有两个版本的写法:
|
|
2042
|
+
*
|
|
2043
|
+
* - createOffscreenCanvas(options) 从 2.16.1 起支持
|
|
2044
|
+
* - createOffscreenCanvas(width, height, this) 从 2.7.0 起支持
|
|
2045
|
+
*/
|
|
2046
|
+
createOffscreenCanvas(options: createOffscreenCanvas.Option): OffscreenCanvas
|
|
2047
|
+
|
|
2048
|
+
/** 创建 canvas 的绘图上下文 [CanvasContext](/docs/apis/canvas/CanvasContext) 对象
|
|
2049
|
+
*
|
|
2050
|
+
* **Tip**: 需要指定 canvasId,该绘图上下文只作用于对应的 `<canvas/>`;另外,Web 端需要在 `useReady` 回调中执行它,否则会因为底层 canvas 渲染出来之前而去获取 CanvasContext,导致其底层的 context 为 `undefined`,从而不能正常绘图。
|
|
2051
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid, harmony
|
|
2052
|
+
* @example
|
|
2053
|
+
* ```tsx
|
|
2054
|
+
* import { useReady } from 'vite-plugin-taro-runtime/taro'
|
|
2055
|
+
*
|
|
2056
|
+
* useReady(() => {
|
|
2057
|
+
* const context = Taro.createCanvasContext('canvas')
|
|
2058
|
+
* context.setStrokeStyle("#00ff00")
|
|
2059
|
+
* context.setLineWidth(5)
|
|
2060
|
+
* context.rect(0, 0, 200, 200)
|
|
2061
|
+
* context.stroke()
|
|
2062
|
+
* context.setStrokeStyle("#ff0000")
|
|
2063
|
+
* context.setLineWidth(2)
|
|
2064
|
+
* context.moveTo(160, 100)
|
|
2065
|
+
* context.arc(100, 100, 60, 0, 2 * Math.PI, true)
|
|
2066
|
+
* context.moveTo(140, 100)
|
|
2067
|
+
* context.arc(100, 100, 40, 0, Math.PI, false)
|
|
2068
|
+
* context.moveTo(85, 80)
|
|
2069
|
+
* context.arc(80, 80, 5, 0, 2 * Math.PI, true)
|
|
2070
|
+
* context.moveTo(125, 80)
|
|
2071
|
+
* context.arc(120, 80, 5, 0, 2 * Math.PI, true)
|
|
2072
|
+
* context.stroke()
|
|
2073
|
+
* context.draw()
|
|
2074
|
+
* })
|
|
2075
|
+
* ```
|
|
2076
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createCanvasContext.html
|
|
2077
|
+
*/
|
|
2078
|
+
createCanvasContext(
|
|
2079
|
+
/** 要获取上下文的 [canvas](/docs/components/canvas) 组件 canvas-id 属性 */
|
|
2080
|
+
canvasId: string,
|
|
2081
|
+
/** 在自定义组件下,当前组件实例的this,表示在这个自定义组件下查找拥有 canvas-id 的 [canvas](/docs/components/canvas) ,如果省略则不在任何自定义组件内查找 */
|
|
2082
|
+
component?: TaroGeneral.IAnyObject,
|
|
2083
|
+
): CanvasContext
|
|
2084
|
+
|
|
2085
|
+
/** 把当前画布指定区域的内容导出生成指定大小的图片。在 `draw()` 回调里调用该方法才能保证图片导出成功。
|
|
2086
|
+
*
|
|
2087
|
+
* **Bug & Tip:**
|
|
2088
|
+
*
|
|
2089
|
+
* 1. `tip`: 在 `draw` 回调里调用该方法才能保证图片导出成功。
|
|
2090
|
+
* @example
|
|
2091
|
+
* ```tsx
|
|
2092
|
+
* Taro.canvasToTempFilePath({
|
|
2093
|
+
* x: 100,
|
|
2094
|
+
* y: 200,
|
|
2095
|
+
* width: 50,
|
|
2096
|
+
* height: 50,
|
|
2097
|
+
* destWidth: 100,
|
|
2098
|
+
* destHeight: 100,
|
|
2099
|
+
* canvasId: 'myCanvas',
|
|
2100
|
+
* success: function (res) {
|
|
2101
|
+
* console.log(res.tempFilePath)
|
|
2102
|
+
* }
|
|
2103
|
+
* })
|
|
2104
|
+
* ```
|
|
2105
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, harmony_hybrid
|
|
2106
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasToTempFilePath.html
|
|
2107
|
+
*/
|
|
2108
|
+
canvasToTempFilePath(
|
|
2109
|
+
option: canvasToTempFilePath.Option,
|
|
2110
|
+
/** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](/docs/components/canvas) 组件 */
|
|
2111
|
+
component?: TaroGeneral.IAnyObject,
|
|
2112
|
+
): Promise<canvasToTempFilePath.SuccessCallbackResult>
|
|
2113
|
+
|
|
2114
|
+
/** 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内 `<canvas>` 组件
|
|
2115
|
+
* @supported weapp, swan, jd, qq, h5, harmony_hybrid
|
|
2116
|
+
* @example
|
|
2117
|
+
* ```tsx
|
|
2118
|
+
* const data = new Uint8ClampedArray([255, 0, 0, 1])
|
|
2119
|
+
* Taro.canvasPutImageData({
|
|
2120
|
+
* canvasId: 'myCanvas',
|
|
2121
|
+
* x: 0,
|
|
2122
|
+
* y: 0,
|
|
2123
|
+
* width: 1,
|
|
2124
|
+
* data: data,
|
|
2125
|
+
* success: function (res) {}
|
|
2126
|
+
* })
|
|
2127
|
+
* ```
|
|
2128
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasPutImageData.html
|
|
2129
|
+
*/
|
|
2130
|
+
canvasPutImageData(
|
|
2131
|
+
option: canvasPutImageData.Option,
|
|
2132
|
+
/** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](/docs/components/canvas) 组件 */
|
|
2133
|
+
component?: TaroGeneral.IAnyObject,
|
|
2134
|
+
): Promise<TaroGeneral.CallbackResult>
|
|
2135
|
+
|
|
2136
|
+
/** 获取 canvas 区域隐含的像素数据。
|
|
2137
|
+
* @supported weapp, swan, jd, qq, h5, harmony_hybrid
|
|
2138
|
+
* @example
|
|
2139
|
+
* ```tsx
|
|
2140
|
+
* Taro.canvasGetImageData({
|
|
2141
|
+
* canvasId: 'myCanvas',
|
|
2142
|
+
* x: 0,
|
|
2143
|
+
* y: 0,
|
|
2144
|
+
* width: 100,
|
|
2145
|
+
* height: 100,
|
|
2146
|
+
* success: function (res) {
|
|
2147
|
+
* console.log(res.width) // 100
|
|
2148
|
+
* console.log(res.height) // 100
|
|
2149
|
+
* console.log(res.data instanceof Uint8ClampedArray) // true
|
|
2150
|
+
* console.log(res.data.length) // 100 * 100 * 4
|
|
2151
|
+
* }
|
|
2152
|
+
* })
|
|
2153
|
+
* ```
|
|
2154
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasGetImageData.html
|
|
2155
|
+
*/
|
|
2156
|
+
canvasGetImageData(
|
|
2157
|
+
option: canvasGetImageData.Option,
|
|
2158
|
+
/** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](/docs/components/canvas) 组件 */
|
|
2159
|
+
component?: TaroGeneral.IAnyObject,
|
|
2160
|
+
): Promise<canvasGetImageData.SuccessCallbackResult>
|
|
2161
|
+
}
|
|
2162
|
+
}
|