@tarojs/taro-h5 3.5.0-canary.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/ad/index.d.ts +6 -0
- package/dist/api/ad/index.js +1 -1
- package/dist/api/ai/facial.d.ts +9 -0
- package/dist/api/ai/facial.js +1 -1
- package/dist/api/ai/index.d.ts +2 -0
- package/dist/api/ai/visual.d.ts +6 -0
- package/dist/api/ai/visual.js +3 -1
- package/dist/api/alipay/index.d.ts +3 -0
- package/dist/api/alipay/index.js +1 -1
- package/dist/api/base/crypto.d.ts +3 -0
- package/dist/api/base/crypto.js +1 -1
- package/dist/api/base/debug.d.ts +9 -0
- package/dist/api/base/debug.js +1 -1
- package/dist/api/base/index.d.ts +12 -0
- package/dist/api/base/index.js +5 -5
- package/dist/api/base/performance.d.ts +6 -0
- package/dist/api/base/performance.js +1 -1
- package/dist/api/base/system.d.ts +27 -0
- package/dist/api/base/system.js +191 -0
- package/dist/api/base/update.d.ts +6 -0
- package/dist/api/base/update.js +1 -1
- package/dist/api/base/weapp/app-event.d.ts +41 -0
- package/dist/api/base/weapp/app-event.js +56 -5
- package/dist/api/base/weapp/life-cycle.d.ts +6 -0
- package/dist/api/base/weapp/life-cycle.js +1 -1
- package/dist/api/canvas/CanvasContext.d.ts +104 -0
- package/dist/api/canvas/CanvasContext.js +27 -16
- package/dist/api/canvas/canvasGetImageData.d.ts +5 -0
- package/dist/api/canvas/canvasGetImageData.js +2 -2
- package/dist/api/canvas/canvasPutImageData.d.ts +6 -0
- package/dist/api/canvas/canvasPutImageData.js +2 -2
- package/dist/api/canvas/canvasToTempFilePath.d.ts +6 -0
- package/dist/api/canvas/canvasToTempFilePath.js +2 -2
- package/dist/api/canvas/createCanvasContext.d.ts +5 -0
- package/dist/api/canvas/createCanvasContext.js +1 -1
- package/dist/api/canvas/index.d.ts +12 -0
- package/dist/api/canvas/index.js +6 -2
- package/dist/api/cloud/index.d.ts +31 -0
- package/dist/api/cloud/index.js +1 -1
- package/dist/api/data-analysis/index.d.ts +12 -0
- package/dist/api/data-analysis/index.js +1 -1
- package/dist/api/device/accelerometer.d.ts +17 -0
- package/dist/api/device/accelerometer.js +10 -18
- package/dist/api/device/accessibility.d.ts +3 -0
- package/dist/api/device/accessibility.js +1 -1
- package/dist/api/device/battery.d.ts +5 -0
- package/dist/api/device/battery.js +28 -2
- package/dist/api/device/bluetooth-ble.d.ts +48 -0
- package/dist/api/device/bluetooth-ble.js +1 -1
- package/dist/api/device/bluetooth-peripheral.d.ts +9 -0
- package/dist/api/device/bluetooth-peripheral.js +1 -1
- package/dist/api/device/bluetooth.d.ts +39 -0
- package/dist/api/device/bluetooth.js +1 -1
- package/dist/api/device/calendar.d.ts +6 -0
- package/dist/api/device/calendar.js +1 -1
- package/dist/api/device/clipboard.d.ts +15 -0
- package/dist/api/device/clipboard.js +15 -6
- package/dist/api/device/compass.d.ts +17 -0
- package/dist/api/device/compass.js +33 -19
- package/dist/api/device/contact.d.ts +6 -0
- package/dist/api/device/contact.js +1 -1
- package/dist/api/device/crypto.d.ts +3 -0
- package/dist/api/device/crypto.js +1 -1
- package/dist/api/device/gyroscope.d.ts +12 -0
- package/dist/api/device/gyroscope.js +1 -1
- package/dist/api/device/iBeacon.d.ts +21 -0
- package/dist/api/device/iBeacon.js +1 -1
- package/dist/api/device/index.d.ts +23 -0
- package/dist/api/device/index.js +1 -0
- package/dist/api/device/keyboard.d.ts +12 -0
- package/dist/api/device/keyboard.js +1 -1
- package/dist/api/device/memory.d.ts +6 -0
- package/dist/api/device/memory.js +1 -1
- package/dist/api/device/motion.d.ts +17 -0
- package/dist/api/device/motion.js +9 -18
- package/dist/api/device/network.d.ts +20 -0
- package/dist/api/device/network.js +87 -0
- package/dist/api/device/nfc.d.ts +21 -0
- package/dist/api/device/nfc.js +1 -1
- package/dist/api/device/phone.d.ts +2 -0
- package/dist/api/device/phone.js +2 -2
- package/dist/api/device/scan.d.ts +3 -0
- package/dist/api/device/scan.js +9 -5
- package/dist/api/device/screen.d.ts +18 -0
- package/dist/api/device/screen.js +1 -1
- package/dist/api/device/vibrate.d.ts +9 -0
- package/dist/api/device/vibrate.js +6 -8
- package/dist/api/device/wifi.d.ts +33 -0
- package/dist/api/device/wifi.js +2 -1
- package/dist/api/ext/index.d.ts +6 -0
- package/dist/api/ext/index.js +1 -1
- package/dist/api/files/index.d.ts +24 -0
- package/dist/api/files/index.js +1 -1
- package/dist/api/framework/index.d.ts +4 -0
- package/dist/api/index.d.ts +24 -0
- package/dist/api/index.js +2 -2
- package/dist/api/location/chooseLocation.d.ts +6 -0
- package/dist/api/location/chooseLocation.js +22 -8
- package/dist/api/location/getLocation.d.ts +2 -0
- package/dist/api/location/getLocation.js +64 -0
- package/dist/api/location/index.d.ts +32 -0
- package/dist/api/location/index.js +8 -4
- package/dist/api/media/EditorContext.d.ts +42 -0
- package/dist/api/media/EditorContext.js +2 -1
- package/dist/api/media/audio/InnerAudioContext.d.ts +58 -0
- package/dist/api/media/audio/InnerAudioContext.js +3 -3
- package/dist/api/media/audio/index.d.ts +29 -0
- package/dist/api/media/audio/index.js +1 -1
- package/dist/api/media/background-audio/BackgroundAudioManager.d.ts +71 -0
- package/dist/api/media/background-audio/BackgroundAudioManager.js +2 -2
- package/dist/api/media/background-audio/index.d.ts +29 -0
- package/dist/api/media/background-audio/index.js +1 -1
- package/dist/api/media/camera.d.ts +3 -0
- package/dist/api/media/camera.js +1 -1
- package/dist/api/media/image/chooseImage.d.ts +5 -0
- package/dist/api/media/image/chooseImage.js +14 -3
- package/dist/api/media/image/getImageInfo.d.ts +5 -0
- package/dist/api/media/image/getImageInfo.js +18 -3
- package/dist/api/media/image/index.d.ts +15 -0
- package/dist/api/media/image/index.js +2 -2
- package/dist/api/media/image/previewImage.d.ts +8 -0
- package/dist/api/media/image/previewImage.js +14 -5
- package/dist/api/media/index.d.ts +12 -0
- package/dist/api/media/live.d.ts +6 -0
- package/dist/api/media/live.js +1 -1
- package/dist/api/media/map.d.ts +3 -0
- package/dist/api/media/map.js +1 -1
- package/dist/api/media/media-recorder.d.ts +3 -0
- package/dist/api/media/media-recorder.js +1 -1
- package/dist/api/media/recorder.d.ts +9 -0
- package/dist/api/media/recorder.js +1 -1
- package/dist/api/media/video/index.d.ts +24 -0
- package/dist/api/media/video/index.js +2 -2
- package/dist/api/media/video-decoder.d.ts +3 -0
- package/dist/api/media/video-decoder.js +1 -1
- package/dist/api/media/video-processing.d.ts +3 -0
- package/dist/api/media/video-processing.js +1 -1
- package/dist/api/media/voip.d.ts +42 -0
- package/dist/api/media/voip.js +1 -1
- package/dist/api/navigate/index.d.ts +12 -0
- package/dist/api/navigate/index.js +1 -1
- package/dist/api/network/download.d.ts +6 -0
- package/dist/api/network/download.js +2 -1
- package/dist/api/network/index.d.ts +7 -0
- package/dist/api/network/mdns.d.ts +30 -0
- package/dist/api/network/mdns.js +1 -1
- package/dist/api/network/request/index.d.ts +4 -0
- package/dist/api/network/request/index.js +6 -2
- package/dist/api/network/tcp.d.ts +3 -0
- package/dist/api/network/tcp.js +1 -1
- package/dist/api/network/udp.d.ts +3 -0
- package/dist/api/network/udp.js +1 -1
- package/dist/api/network/upload.d.ts +5 -0
- package/dist/api/network/upload.js +4 -8
- package/{src/api/network/utils.ts → dist/api/network/utils.d.ts} +44 -71
- package/dist/api/network/utils.js +1 -0
- package/dist/api/network/websocket/index.d.ts +7 -0
- package/dist/api/network/websocket/index.js +2 -2
- package/dist/api/network/websocket/socketTask.d.ts +25 -0
- package/dist/api/open-api/account.d.ts +3 -0
- package/dist/api/open-api/account.js +1 -1
- package/dist/api/open-api/address.d.ts +3 -0
- package/dist/api/open-api/address.js +1 -1
- package/dist/api/open-api/authorize.d.ts +6 -0
- package/dist/api/open-api/authorize.js +1 -1
- package/dist/api/open-api/card.d.ts +6 -0
- package/dist/api/open-api/card.js +1 -1
- package/dist/api/open-api/channels-live.d.ts +18 -0
- package/dist/api/open-api/channels-live.js +1 -1
- package/dist/api/open-api/customer-service.d.ts +3 -0
- package/dist/api/open-api/customer-service.js +1 -1
- package/dist/api/open-api/facial.d.ts +12 -0
- package/dist/api/open-api/facial.js +1 -1
- package/dist/api/open-api/favorites.d.ts +6 -0
- package/dist/api/open-api/favorites.js +1 -1
- package/dist/api/open-api/group.d.ts +3 -0
- package/dist/api/open-api/group.js +1 -1
- package/dist/api/open-api/index.d.ts +18 -0
- package/dist/api/open-api/invoice.d.ts +6 -0
- package/dist/api/open-api/invoice.js +1 -1
- package/dist/api/open-api/license-plate.d.ts +3 -0
- package/dist/api/open-api/license-plate.js +1 -1
- package/dist/api/open-api/login.d.ts +9 -0
- package/dist/api/open-api/login.js +1 -1
- package/dist/api/open-api/red-package.d.ts +3 -0
- package/dist/api/open-api/red-package.js +1 -1
- package/dist/api/open-api/settings.d.ts +6 -0
- package/dist/api/open-api/settings.js +1 -1
- package/dist/api/open-api/soter.d.ts +9 -0
- package/dist/api/open-api/soter.js +1 -1
- package/dist/api/open-api/subscribe-message.d.ts +3 -0
- package/dist/api/open-api/subscribe-message.js +1 -1
- package/dist/api/open-api/user-info.d.ts +6 -0
- package/dist/api/open-api/user-info.js +1 -1
- package/dist/api/open-api/werun.d.ts +6 -0
- package/dist/api/open-api/werun.js +1 -1
- package/dist/api/payment/index.d.ts +6 -0
- package/dist/api/payment/index.js +1 -1
- package/dist/api/route/index.d.ts +1 -0
- package/dist/api/route/index.js +1 -1
- package/dist/api/share/index.d.ts +30 -0
- package/dist/api/share/index.js +1 -1
- package/dist/api/storage/background-fetch.d.ts +12 -0
- package/dist/api/storage/background-fetch.js +1 -1
- package/dist/api/storage/index.d.ts +18 -0
- package/dist/api/storage/index.js +2 -2
- package/dist/api/swan/index.d.ts +63 -0
- package/dist/api/swan/index.js +1 -1
- package/dist/api/taro.d.ts +12 -0
- package/dist/api/taro.js +4 -5
- package/dist/api/ui/animation/index.d.ts +2 -0
- package/dist/api/ui/background.d.ts +6 -0
- package/dist/api/ui/background.js +1 -1
- package/dist/api/ui/custom-component.d.ts +1 -0
- package/dist/api/ui/fonts.d.ts +2 -0
- package/dist/api/ui/fonts.js +59 -2
- package/dist/api/ui/index.d.ts +12 -0
- package/dist/api/ui/index.js +1 -1
- package/dist/api/ui/interaction/actionSheet.d.ts +61 -0
- package/dist/api/ui/interaction/actionSheet.js +4 -13
- package/dist/api/ui/interaction/index.d.ts +14 -0
- package/dist/api/ui/interaction/index.js +22 -13
- package/dist/api/ui/interaction/modal.d.ts +69 -0
- package/dist/api/ui/interaction/modal.js +8 -28
- package/dist/api/ui/interaction/toast.d.ts +85 -0
- package/dist/api/ui/interaction/toast.js +15 -41
- package/dist/api/ui/menu.d.ts +3 -0
- package/dist/api/ui/menu.js +1 -1
- package/dist/api/ui/navigation-bar/index.d.ts +15 -0
- package/dist/api/ui/navigation-bar/index.js +4 -5
- package/dist/api/ui/pull-down-refresh.d.ts +9 -0
- package/dist/api/ui/pull-down-refresh.js +1 -1
- package/dist/api/ui/scroll/index.d.ts +5 -0
- package/dist/api/ui/scroll/index.js +2 -2
- package/dist/api/ui/sticky.d.ts +3 -0
- package/dist/api/ui/sticky.js +1 -1
- package/dist/api/ui/tab-bar.d.ts +34 -0
- package/dist/api/ui/tab-bar.js +2 -2
- package/dist/api/ui/window.d.ts +15 -0
- package/dist/api/ui/window.js +2 -2
- package/dist/api/worker/index.d.ts +3 -0
- package/dist/api/worker/index.js +1 -1
- package/dist/api/wxml/index.d.ts +5 -0
- package/dist/api/wxml/index.js +1 -1
- package/dist/api/wxml/nodesRef.d.ts +13 -0
- package/dist/api/wxml/selectorQuery.d.ts +24 -0
- package/dist/api/wxml/selectorQuery.js +2 -2
- package/dist/index.cjs.d.ts +1373 -0
- package/dist/index.cjs.js +5021 -8380
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.d.ts +1373 -0
- package/dist/index.esm.js +5194 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/taroApis.d.ts +1364 -0
- package/dist/taroApis.js +2 -1
- package/dist/taroApis.js.map +1 -0
- package/dist/utils/animation.d.ts +6 -0
- package/dist/utils/animation.js +14 -0
- package/dist/utils/handler.d.ts +48 -0
- package/dist/{api/utils → utils}/handler.js +0 -0
- package/dist/utils/index.d.ts +39 -0
- package/dist/{api/utils → utils}/index.js +36 -53
- package/dist/utils/lodash.d.ts +2 -0
- package/dist/utils/lodash.js +29 -0
- package/dist/utils/valid.d.ts +2 -0
- package/dist/utils/valid.js +7 -0
- package/package.json +21 -20
- package/{src/types → types}/api.d.ts +1 -1
- package/types/define.d.ts +2 -0
- package/types/index.d.ts +33 -0
- package/types/overlay.d.ts +9 -0
- package/LICENSE +0 -21
- package/dist/api/base/system/index.js +0 -2
- package/dist/api/base/system/info.js +0 -57
- package/dist/api/base/system/network.js +0 -63
- package/dist/types/type.js +0 -2
- package/src/api/ad/index.ts +0 -5
- package/src/api/ai/facial.ts +0 -6
- package/src/api/ai/index.ts +0 -2
- package/src/api/ai/visual.ts +0 -4
- package/src/api/alipay/index.ts +0 -4
- package/src/api/base/crypto.ts +0 -4
- package/src/api/base/debug.ts +0 -5
- package/src/api/base/index.ts +0 -23
- package/src/api/base/performance.ts +0 -5
- package/src/api/base/system/index.ts +0 -2
- package/src/api/base/system/info.ts +0 -64
- package/src/api/base/system/network.ts +0 -70
- package/src/api/base/update.ts +0 -5
- package/src/api/base/weapp/app-event.ts +0 -19
- package/src/api/base/weapp/life-cycle.ts +0 -5
- package/src/api/canvas/CanvasContext.ts +0 -233
- package/src/api/canvas/canvasGetImageData.ts +0 -27
- package/src/api/canvas/canvasPutImageData.ts +0 -24
- package/src/api/canvas/canvasToTempFilePath.ts +0 -24
- package/src/api/canvas/createCanvasContext.ts +0 -18
- package/src/api/canvas/index.ts +0 -10
- package/src/api/cloud/index.ts +0 -31
- package/src/api/data-analysis/index.ts +0 -6
- package/src/api/device/accelerometer.ts +0 -87
- package/src/api/device/accessibility.ts +0 -4
- package/src/api/device/battery.ts +0 -5
- package/src/api/device/bluetooth-ble.ts +0 -19
- package/src/api/device/bluetooth-peripheral.ts +0 -6
- package/src/api/device/bluetooth.ts +0 -16
- package/src/api/device/calendar.ts +0 -5
- package/src/api/device/clipboard.ts +0 -67
- package/src/api/device/compass.ts +0 -67
- package/src/api/device/contact.ts +0 -5
- package/src/api/device/crypto.ts +0 -4
- package/src/api/device/gyroscope.ts +0 -7
- package/src/api/device/iBeacon.ts +0 -10
- package/src/api/device/index.ts +0 -22
- package/src/api/device/keyboard.ts +0 -7
- package/src/api/device/memory.ts +0 -5
- package/src/api/device/motion.ts +0 -85
- package/src/api/device/nfc.ts +0 -10
- package/src/api/device/phone.ts +0 -30
- package/src/api/device/scan.ts +0 -7
- package/src/api/device/screen.ts +0 -9
- package/src/api/device/vibrate.ts +0 -36
- package/src/api/device/wifi.ts +0 -13
- package/src/api/ext/index.ts +0 -5
- package/src/api/files/index.ts +0 -11
- package/src/api/framework/index.ts +0 -10
- package/src/api/index.ts +0 -25
- package/src/api/location/chooseLocation.ts +0 -106
- package/src/api/location/index.ts +0 -19
- package/src/api/location/style.css +0 -79
- package/src/api/media/EditorContext.ts +0 -29
- package/src/api/media/audio/InnerAudioContext.ts +0 -98
- package/src/api/media/audio/index.ts +0 -20
- package/src/api/media/background-audio/BackgroundAudioManager.ts +0 -103
- package/src/api/media/background-audio/index.ts +0 -17
- package/src/api/media/camera.ts +0 -4
- package/src/api/media/image/chooseImage.ts +0 -78
- package/src/api/media/image/getImageInfo.ts +0 -35
- package/src/api/media/image/index.ts +0 -13
- package/src/api/media/image/previewImage.ts +0 -80
- package/src/api/media/index.ts +0 -12
- package/src/api/media/live.ts +0 -5
- package/src/api/media/map.ts +0 -4
- package/src/api/media/media-recorder.ts +0 -4
- package/src/api/media/recorder.ts +0 -6
- package/src/api/media/video/index.ts +0 -82
- package/src/api/media/video-decoder.ts +0 -4
- package/src/api/media/video-processing.ts +0 -4
- package/src/api/media/voip.ts +0 -17
- package/src/api/navigate/index.ts +0 -7
- package/src/api/network/download.ts +0 -140
- package/src/api/network/index.ts +0 -7
- package/src/api/network/mdns.ts +0 -13
- package/src/api/network/request/index.ts +0 -130
- package/src/api/network/tcp.ts +0 -4
- package/src/api/network/udp.ts +0 -4
- package/src/api/network/upload.ts +0 -174
- package/src/api/network/websocket/index.ts +0 -88
- package/src/api/network/websocket/socketTask.ts +0 -89
- package/src/api/open-api/account.ts +0 -4
- package/src/api/open-api/address.ts +0 -4
- package/src/api/open-api/authorize.ts +0 -5
- package/src/api/open-api/card.ts +0 -5
- package/src/api/open-api/channels-live.ts +0 -9
- package/src/api/open-api/customer-service.ts +0 -4
- package/src/api/open-api/facial.ts +0 -7
- package/src/api/open-api/favorites.ts +0 -5
- package/src/api/open-api/group.ts +0 -4
- package/src/api/open-api/index.ts +0 -18
- package/src/api/open-api/invoice.ts +0 -5
- package/src/api/open-api/license-plate.ts +0 -4
- package/src/api/open-api/login.ts +0 -6
- package/src/api/open-api/red-package.ts +0 -4
- package/src/api/open-api/settings.ts +0 -5
- package/src/api/open-api/soter.ts +0 -6
- package/src/api/open-api/subscribe-message.ts +0 -4
- package/src/api/open-api/user-info.ts +0 -5
- package/src/api/open-api/werun.ts +0 -5
- package/src/api/payment/index.ts +0 -5
- package/src/api/route/index.ts +0 -10
- package/src/api/share/index.ts +0 -13
- package/src/api/storage/background-fetch.ts +0 -7
- package/src/api/storage/index.ts +0 -181
- package/src/api/swan/index.ts +0 -31
- package/src/api/taro.ts +0 -89
- package/src/api/ui/animation/index.ts +0 -356
- package/src/api/ui/background.ts +0 -5
- package/src/api/ui/custom-component.ts +0 -4
- package/src/api/ui/fonts.ts +0 -4
- package/src/api/ui/index.ts +0 -12
- package/src/api/ui/interaction/actionSheet.ts +0 -212
- package/src/api/ui/interaction/index.ts +0 -301
- package/src/api/ui/interaction/modal.ts +0 -237
- package/src/api/ui/interaction/toast.ts +0 -220
- package/src/api/ui/menu.ts +0 -4
- package/src/api/ui/navigation-bar/index.ts +0 -52
- package/src/api/ui/pull-down-refresh.ts +0 -27
- package/src/api/ui/scroll/index.ts +0 -85
- package/src/api/ui/sticky.ts +0 -4
- package/src/api/ui/tab-bar.ts +0 -326
- package/src/api/ui/window.ts +0 -37
- package/src/api/utils/handler.ts +0 -105
- package/src/api/utils/index.ts +0 -190
- package/src/api/worker/index.ts +0 -4
- package/src/api/wxml/index.ts +0 -9
- package/src/api/wxml/nodesRef.ts +0 -56
- package/src/api/wxml/selectorQuery.ts +0 -219
- package/src/index.ts +0 -6
- package/src/types/define.d.ts +0 -2
- package/src/types/index.d.ts +0 -3
- package/src/types/type.ts +0 -32
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
2
12
|
import './style.css';
|
|
3
|
-
|
|
4
|
-
|
|
13
|
+
import { stringify } from 'query-string';
|
|
14
|
+
import { MethodHandler } from '../../utils/handler';
|
|
15
|
+
function createLocationChooser(handler, key = LOCATION_APIKEY, mapOpt = {}) {
|
|
16
|
+
var _a, _b, _c;
|
|
17
|
+
const { latitude, longitude } = mapOpt, opts = __rest(mapOpt, ["latitude", "longitude"]);
|
|
18
|
+
const query = Object.assign({ key, type: 1, coord: ((_a = mapOpt.coord) !== null && _a !== void 0 ? _a : [latitude, longitude].every(e => Number(e) >= 0)) ? `${latitude},${longitude}` : undefined, referer: 'myapp' }, opts);
|
|
5
19
|
const html = `
|
|
6
20
|
<div class='taro_choose_location'>
|
|
7
21
|
<div class='taro_choose_location_bar'>
|
|
@@ -9,7 +23,7 @@ function createLocationChooser(handler, key = LOCATION_APIKEY) {
|
|
|
9
23
|
<p class='taro_choose_location_title'>位置</p>
|
|
10
24
|
<button class='taro_choose_location_submit'>完成</button>
|
|
11
25
|
</div>
|
|
12
|
-
<iframe class='taro_choose_location_frame' frameborder='0' src=
|
|
26
|
+
<iframe class='taro_choose_location_frame' frameborder='0' src="https://apis.map.qq.com/tools/locpicker?${stringify(query, { arrayFormat: 'comma', skipNull: true })}" />
|
|
13
27
|
</div>
|
|
14
28
|
`;
|
|
15
29
|
const container = document.createElement('div');
|
|
@@ -35,8 +49,8 @@ function createLocationChooser(handler, key = LOCATION_APIKEY) {
|
|
|
35
49
|
container.remove();
|
|
36
50
|
window.removeEventListener('popstate', back);
|
|
37
51
|
}
|
|
38
|
-
(
|
|
39
|
-
(
|
|
52
|
+
(_b = container.querySelector('.taro_choose_location_back')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', back);
|
|
53
|
+
(_c = container.querySelector('.taro_choose_location_submit')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', submit);
|
|
40
54
|
window.addEventListener('popstate', back);
|
|
41
55
|
return {
|
|
42
56
|
show,
|
|
@@ -47,7 +61,7 @@ function createLocationChooser(handler, key = LOCATION_APIKEY) {
|
|
|
47
61
|
/**
|
|
48
62
|
* 打开地图选择位置。
|
|
49
63
|
*/
|
|
50
|
-
export const chooseLocation = ({ success, fail, complete } = {}) => {
|
|
64
|
+
export const chooseLocation = ({ success, fail, complete, mapOpts } = {}) => {
|
|
51
65
|
const key = LOCATION_APIKEY;
|
|
52
66
|
const handle = new MethodHandler({ name: 'chooseLocation', success, fail, complete });
|
|
53
67
|
return new Promise((resolve, reject) => {
|
|
@@ -85,7 +99,7 @@ export const chooseLocation = ({ success, fail, complete } = {}) => {
|
|
|
85
99
|
return handle.fail({}, reject);
|
|
86
100
|
}
|
|
87
101
|
}
|
|
88
|
-
}, key);
|
|
102
|
+
}, key, mapOpts);
|
|
89
103
|
document.body.appendChild(chooser.container);
|
|
90
104
|
window.addEventListener('message', onMessage, false);
|
|
91
105
|
chooser.show();
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { processOpenApi, shouldBeObject } from '../../utils';
|
|
2
|
+
import { MethodHandler } from '../../utils/handler';
|
|
3
|
+
const getLocationByW3CApi = (options) => {
|
|
4
|
+
var _a;
|
|
5
|
+
// 断言 options 必须是 Object
|
|
6
|
+
const isObject = shouldBeObject(options);
|
|
7
|
+
if (!isObject.flag) {
|
|
8
|
+
const res = { errMsg: `getLocation:fail ${isObject.msg}` };
|
|
9
|
+
console.error(res.errMsg);
|
|
10
|
+
return Promise.reject(res);
|
|
11
|
+
}
|
|
12
|
+
// 解构回调函数
|
|
13
|
+
const { success, fail, complete } = options;
|
|
14
|
+
const handle = new MethodHandler({ name: 'getLocation', success, fail, complete });
|
|
15
|
+
// const defaultMaximumAge = 5 * 1000
|
|
16
|
+
const positionOptions = {
|
|
17
|
+
enableHighAccuracy: options.isHighAccuracy || (options.altitude != null),
|
|
18
|
+
// maximumAge: defaultMaximumAge, // 允许取多久以内的缓存位置
|
|
19
|
+
timeout: options.highAccuracyExpireTime // 高精度定位超时时间
|
|
20
|
+
};
|
|
21
|
+
// Web端API实现暂时仅支持GPS坐标系
|
|
22
|
+
if (((_a = options.type) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== 'WGS84') {
|
|
23
|
+
return handle.fail({
|
|
24
|
+
errMsg: 'This coordinate system type is not temporarily supported'
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
// 判断当前浏览器是否支持位置API
|
|
28
|
+
const geolocationSupported = navigator.geolocation;
|
|
29
|
+
if (!geolocationSupported) {
|
|
30
|
+
return handle.fail({
|
|
31
|
+
errMsg: 'The current browser does not support this feature'
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
// 开始获取位置
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
navigator.geolocation.getCurrentPosition((position) => {
|
|
37
|
+
const result = {
|
|
38
|
+
/** 位置的精确度 */
|
|
39
|
+
accuracy: position.coords.accuracy,
|
|
40
|
+
/** 高度,单位 m */
|
|
41
|
+
altitude: position.coords.altitude,
|
|
42
|
+
/** 水平精度,单位 m */
|
|
43
|
+
horizontalAccuracy: position.coords.accuracy,
|
|
44
|
+
/** 纬度,范围为 -90~90,负数表示南纬 */
|
|
45
|
+
latitude: position.coords.latitude,
|
|
46
|
+
/** 经度,范围为 -180~180,负数表示西经 */
|
|
47
|
+
longitude: position.coords.longitude,
|
|
48
|
+
/** 速度,单位 m/s */
|
|
49
|
+
speed: position.coords.speed,
|
|
50
|
+
/** 垂直精度,单位 m(Android 无法获取,返回 0) */
|
|
51
|
+
verticalAccuracy: position.coords.altitudeAccuracy || 0,
|
|
52
|
+
/** 调用结果,自动补充 */
|
|
53
|
+
errMsg: ''
|
|
54
|
+
};
|
|
55
|
+
handle.success(result, resolve);
|
|
56
|
+
}, (error) => {
|
|
57
|
+
handle.fail({ errMsg: error.message }, reject);
|
|
58
|
+
}, positionOptions);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
export const getLocation = processOpenApi({
|
|
62
|
+
name: 'getLocation',
|
|
63
|
+
standardMethod: getLocationByW3CApi
|
|
64
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const stopLocationUpdate: () => Promise<{
|
|
2
|
+
errMsg: string;
|
|
3
|
+
}>;
|
|
4
|
+
export declare const startLocationUpdateBackground: () => Promise<{
|
|
5
|
+
errMsg: string;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const startLocationUpdate: () => Promise<{
|
|
8
|
+
errMsg: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const openLocation: (options?: Partial<{
|
|
11
|
+
scale: number;
|
|
12
|
+
}>) => Promise<any>;
|
|
13
|
+
export declare const onLocationChangeError: () => Promise<{
|
|
14
|
+
errMsg: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const onLocationChange: () => Promise<{
|
|
17
|
+
errMsg: string;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const offLocationChangeError: () => Promise<{
|
|
20
|
+
errMsg: string;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const offLocationChange: () => Promise<{
|
|
23
|
+
errMsg: string;
|
|
24
|
+
}>;
|
|
25
|
+
export { getLocation } from './getLocation';
|
|
26
|
+
export declare const choosePoi: () => Promise<{
|
|
27
|
+
errMsg: string;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const getFuzzyLocation: () => Promise<{
|
|
30
|
+
errMsg: string;
|
|
31
|
+
}>;
|
|
32
|
+
export { chooseLocation } from './chooseLocation';
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { processOpenApi, temporarilyNotSupport } from '
|
|
1
|
+
import { processOpenApi, temporarilyNotSupport } from '../../utils/index';
|
|
2
2
|
// 位置
|
|
3
3
|
export const stopLocationUpdate = temporarilyNotSupport('stopLocationUpdate');
|
|
4
4
|
export const startLocationUpdateBackground = temporarilyNotSupport('startLocationUpdateBackground');
|
|
5
5
|
export const startLocationUpdate = temporarilyNotSupport('startLocationUpdate');
|
|
6
|
-
export const openLocation = processOpenApi(
|
|
6
|
+
export const openLocation = processOpenApi({
|
|
7
|
+
name: 'openLocation',
|
|
8
|
+
defaultOptions: { scale: 18 }
|
|
9
|
+
});
|
|
7
10
|
export const onLocationChangeError = temporarilyNotSupport('onLocationChangeError');
|
|
8
11
|
export const onLocationChange = temporarilyNotSupport('onLocationChange');
|
|
9
12
|
export const offLocationChangeError = temporarilyNotSupport('offLocationChangeError');
|
|
10
13
|
export const offLocationChange = temporarilyNotSupport('offLocationChange');
|
|
11
|
-
export
|
|
14
|
+
export { getLocation } from './getLocation';
|
|
12
15
|
export const choosePoi = temporarilyNotSupport('choosePoi');
|
|
13
|
-
export
|
|
16
|
+
export const getFuzzyLocation = temporarilyNotSupport('getFuzzyLocation');
|
|
17
|
+
export { chooseLocation } from './chooseLocation';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import Taro from '@tarojs/api';
|
|
2
|
+
export declare class EditorContext implements Taro.EditorContext {
|
|
3
|
+
blur: () => Promise<{
|
|
4
|
+
errMsg: string;
|
|
5
|
+
}>;
|
|
6
|
+
clear: () => Promise<{
|
|
7
|
+
errMsg: string;
|
|
8
|
+
}>;
|
|
9
|
+
format: () => Promise<{
|
|
10
|
+
errMsg: string;
|
|
11
|
+
}>;
|
|
12
|
+
getContents: () => Promise<{
|
|
13
|
+
errMsg: string;
|
|
14
|
+
}>;
|
|
15
|
+
getSelectionText: () => Promise<{
|
|
16
|
+
errMsg: string;
|
|
17
|
+
}>;
|
|
18
|
+
insertDivider: () => Promise<{
|
|
19
|
+
errMsg: string;
|
|
20
|
+
}>;
|
|
21
|
+
insertImage: () => Promise<{
|
|
22
|
+
errMsg: string;
|
|
23
|
+
}>;
|
|
24
|
+
insertText: () => Promise<{
|
|
25
|
+
errMsg: string;
|
|
26
|
+
}>;
|
|
27
|
+
redo: () => Promise<{
|
|
28
|
+
errMsg: string;
|
|
29
|
+
}>;
|
|
30
|
+
removeFormat: () => Promise<{
|
|
31
|
+
errMsg: string;
|
|
32
|
+
}>;
|
|
33
|
+
scrollIntoView: () => Promise<{
|
|
34
|
+
errMsg: string;
|
|
35
|
+
}>;
|
|
36
|
+
setContents: () => Promise<{
|
|
37
|
+
errMsg: string;
|
|
38
|
+
}>;
|
|
39
|
+
undo: () => Promise<{
|
|
40
|
+
errMsg: string;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { temporarilyNotSupport } from '
|
|
1
|
+
import { temporarilyNotSupport } from '../../utils';
|
|
2
2
|
// 富文本
|
|
3
3
|
export class EditorContext {
|
|
4
4
|
constructor() {
|
|
@@ -6,6 +6,7 @@ export class EditorContext {
|
|
|
6
6
|
this.clear = temporarilyNotSupport('EditorContext.clear');
|
|
7
7
|
this.format = temporarilyNotSupport('EditorContext.format');
|
|
8
8
|
this.getContents = temporarilyNotSupport('EditorContext.getContents');
|
|
9
|
+
this.getSelectionText = temporarilyNotSupport('EditorContext.getSelectionText');
|
|
9
10
|
this.insertDivider = temporarilyNotSupport('EditorContext.insertDivider');
|
|
10
11
|
this.insertImage = temporarilyNotSupport('EditorContext.insertImage');
|
|
11
12
|
this.insertText = temporarilyNotSupport('EditorContext.insertText');
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import Taro from '@tarojs/api';
|
|
2
|
+
import { CallbackManager } from '../../../utils/handler';
|
|
3
|
+
export declare class InnerAudioContext implements Taro.InnerAudioContext {
|
|
4
|
+
Instance?: HTMLAudioElement;
|
|
5
|
+
errorStack: CallbackManager;
|
|
6
|
+
stopStack: CallbackManager;
|
|
7
|
+
__startTime: number;
|
|
8
|
+
constructor();
|
|
9
|
+
set autoplay(e: boolean);
|
|
10
|
+
get autoplay(): boolean;
|
|
11
|
+
get buffered(): number;
|
|
12
|
+
get currentTime(): number;
|
|
13
|
+
get duration(): number;
|
|
14
|
+
set loop(e: boolean);
|
|
15
|
+
get loop(): boolean;
|
|
16
|
+
get paused(): boolean;
|
|
17
|
+
set src(e: string);
|
|
18
|
+
get src(): string;
|
|
19
|
+
set volume(e: number);
|
|
20
|
+
get volume(): number;
|
|
21
|
+
set playbackRate(e: number);
|
|
22
|
+
get playbackRate(): number;
|
|
23
|
+
set obeyMuteSwitch(_e: boolean);
|
|
24
|
+
get obeyMuteSwitch(): boolean;
|
|
25
|
+
set startTime(e: number);
|
|
26
|
+
get startTime(): number;
|
|
27
|
+
set referrerPolicy(e: string);
|
|
28
|
+
get referrerPolicy(): string;
|
|
29
|
+
private setProperty;
|
|
30
|
+
play: () => Promise<void> | undefined;
|
|
31
|
+
pause: () => void | undefined;
|
|
32
|
+
stop: () => void;
|
|
33
|
+
seek: (position: number) => void;
|
|
34
|
+
/**
|
|
35
|
+
* @TODO destroy得并不干净
|
|
36
|
+
*/
|
|
37
|
+
destroy: () => void;
|
|
38
|
+
onCanplay: (callback?: () => void) => void | undefined;
|
|
39
|
+
onPlay: (callback?: () => void) => void | undefined;
|
|
40
|
+
onPause: (callback?: () => void) => void | undefined;
|
|
41
|
+
onStop: (callback?: () => void) => void;
|
|
42
|
+
onEnded: (callback?: () => void) => void | undefined;
|
|
43
|
+
onTimeUpdate: (callback?: () => void) => void | undefined;
|
|
44
|
+
onError: (callback?: ((res: Taro.InnerAudioContext.onErrorDetail) => void) | undefined) => void;
|
|
45
|
+
onWaiting: (callback?: () => void) => void | undefined;
|
|
46
|
+
onSeeking: (callback?: () => void) => void | undefined;
|
|
47
|
+
onSeeked: (callback?: () => void) => void | undefined;
|
|
48
|
+
offCanplay: (callback?: () => void) => void | undefined;
|
|
49
|
+
offPlay: (callback?: () => void) => void | undefined;
|
|
50
|
+
offPause: (callback?: () => void) => void | undefined;
|
|
51
|
+
offStop: (callback?: () => void) => void;
|
|
52
|
+
offEnded: (callback?: () => void) => void | undefined;
|
|
53
|
+
offTimeUpdate: (callback?: () => void) => void | undefined;
|
|
54
|
+
offError: (callback?: () => void) => void;
|
|
55
|
+
offWaiting: (callback?: () => void) => void | undefined;
|
|
56
|
+
offSeeking: (callback?: () => void) => void | undefined;
|
|
57
|
+
offSeeked: (callback?: () => void) => void | undefined;
|
|
58
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Taro from '@tarojs/api';
|
|
2
|
-
import { permanentlyNotSupport } from '
|
|
3
|
-
import { CallbackManager } from '
|
|
2
|
+
import { permanentlyNotSupport } from '../../../utils';
|
|
3
|
+
import { CallbackManager } from '../../../utils/handler';
|
|
4
4
|
export class InnerAudioContext {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.__startTime = 0;
|
|
@@ -63,7 +63,7 @@ export class InnerAudioContext {
|
|
|
63
63
|
get duration() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.duration) || 0; }
|
|
64
64
|
set loop(e) { this.setProperty('loop', e); }
|
|
65
65
|
get loop() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.loop) || false; }
|
|
66
|
-
get paused() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.paused)
|
|
66
|
+
get paused() { var _a, _b; return (_b = (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.paused) !== null && _b !== void 0 ? _b : true; }
|
|
67
67
|
set src(e) { this.setProperty('src', e); }
|
|
68
68
|
get src() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.src) || ''; }
|
|
69
69
|
set volume(e) { this.setProperty('volume', e); }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Taro from '@tarojs/api';
|
|
2
|
+
export declare const stopVoice: () => Promise<{
|
|
3
|
+
errMsg: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const setInnerAudioOption: () => Promise<{
|
|
6
|
+
errMsg: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const playVoice: () => Promise<{
|
|
9
|
+
errMsg: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const pauseVoice: () => Promise<{
|
|
12
|
+
errMsg: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const getAvailableAudioSources: () => Promise<{
|
|
15
|
+
errMsg: string;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const createWebAudioContext: () => Promise<{
|
|
18
|
+
errMsg: string;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const createMediaAudioPlayer: () => Promise<{
|
|
21
|
+
errMsg: string;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* 创建内部 audio 上下文 InnerAudioContext 对象。
|
|
25
|
+
*/
|
|
26
|
+
export declare const createInnerAudioContext: typeof Taro.createInnerAudioContext;
|
|
27
|
+
export declare const createAudioContext: () => Promise<{
|
|
28
|
+
errMsg: string;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import Taro from '@tarojs/api';
|
|
2
|
+
import { CallbackManager } from '../../../utils/handler';
|
|
3
|
+
export declare class BackgroundAudioManager implements Taro.BackgroundAudioManager {
|
|
4
|
+
Instance?: HTMLAudioElement;
|
|
5
|
+
errorStack: CallbackManager;
|
|
6
|
+
stopStack: CallbackManager;
|
|
7
|
+
__startTime: number;
|
|
8
|
+
constructor();
|
|
9
|
+
set src(e: string);
|
|
10
|
+
get src(): string;
|
|
11
|
+
set startTime(e: number);
|
|
12
|
+
get startTime(): number;
|
|
13
|
+
set title(e: string);
|
|
14
|
+
get title(): string;
|
|
15
|
+
set epname(e: string);
|
|
16
|
+
get epname(): string;
|
|
17
|
+
set singer(e: string);
|
|
18
|
+
get singer(): string;
|
|
19
|
+
set coverImgUrl(e: string);
|
|
20
|
+
get coverImgUrl(): string;
|
|
21
|
+
set webUrl(e: string);
|
|
22
|
+
get webUrl(): string;
|
|
23
|
+
set protocol(e: string);
|
|
24
|
+
get protocol(): string;
|
|
25
|
+
set playbackRate(e: number);
|
|
26
|
+
get playbackRate(): number;
|
|
27
|
+
get duration(): number;
|
|
28
|
+
get currentTime(): number;
|
|
29
|
+
get paused(): boolean;
|
|
30
|
+
get buffered(): number;
|
|
31
|
+
set referrerPolicy(e: string);
|
|
32
|
+
get referrerPolicy(): string;
|
|
33
|
+
private setProperty;
|
|
34
|
+
private dataset;
|
|
35
|
+
play: () => Promise<void> | undefined;
|
|
36
|
+
pause: () => void | undefined;
|
|
37
|
+
seek: (position: number) => void;
|
|
38
|
+
stop: () => void;
|
|
39
|
+
onCanplay: (callback?: () => void) => void | undefined;
|
|
40
|
+
onWaiting: (callback?: () => void) => void | undefined;
|
|
41
|
+
onError: (callback?: ((res: Taro.InnerAudioContext.onErrorDetail) => void) | undefined) => void;
|
|
42
|
+
onPlay: (callback?: () => void) => void | undefined;
|
|
43
|
+
onPause: (callback?: () => void) => void | undefined;
|
|
44
|
+
onSeeking: (callback?: () => void) => void | undefined;
|
|
45
|
+
onSeeked: (callback?: () => void) => void | undefined;
|
|
46
|
+
onEnded: (callback?: () => void) => void | undefined;
|
|
47
|
+
onStop: (callback?: () => void) => void;
|
|
48
|
+
onTimeUpdate: (callback?: () => void) => void | undefined;
|
|
49
|
+
onPrev: () => Promise<{
|
|
50
|
+
errMsg: string;
|
|
51
|
+
}>;
|
|
52
|
+
onNext: () => Promise<{
|
|
53
|
+
errMsg: string;
|
|
54
|
+
}>;
|
|
55
|
+
offCanplay: (callback?: () => void) => void | undefined;
|
|
56
|
+
offWaiting: (callback?: () => void) => void | undefined;
|
|
57
|
+
offError: (callback?: () => void) => void;
|
|
58
|
+
offPlay: (callback?: () => void) => void | undefined;
|
|
59
|
+
offPause: (callback?: () => void) => void | undefined;
|
|
60
|
+
offSeeking: (callback?: () => void) => void | undefined;
|
|
61
|
+
offSeeked: (callback?: () => void) => void | undefined;
|
|
62
|
+
offEnded: (callback?: () => void) => void | undefined;
|
|
63
|
+
offStop: (callback?: () => void) => void;
|
|
64
|
+
offTimeUpdate: (callback?: () => void) => void | undefined;
|
|
65
|
+
offPrev: () => Promise<{
|
|
66
|
+
errMsg: string;
|
|
67
|
+
}>;
|
|
68
|
+
offNext: () => Promise<{
|
|
69
|
+
errMsg: string;
|
|
70
|
+
}>;
|
|
71
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { permanentlyNotSupport } from '
|
|
2
|
-
import { CallbackManager } from '
|
|
1
|
+
import { permanentlyNotSupport } from '../../../utils';
|
|
2
|
+
import { CallbackManager } from '../../../utils/handler';
|
|
3
3
|
export class BackgroundAudioManager {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.__startTime = 0;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BackgroundAudioManager } from './BackgroundAudioManager';
|
|
2
|
+
export declare const stopBackgroundAudio: () => Promise<{
|
|
3
|
+
errMsg: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const seekBackgroundAudio: () => Promise<{
|
|
6
|
+
errMsg: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const playBackgroundAudio: () => Promise<{
|
|
9
|
+
errMsg: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const pauseBackgroundAudio: () => Promise<{
|
|
12
|
+
errMsg: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const onBackgroundAudioStop: () => Promise<{
|
|
15
|
+
errMsg: string;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const onBackgroundAudioPlay: () => Promise<{
|
|
18
|
+
errMsg: string;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const onBackgroundAudioPause: () => Promise<{
|
|
21
|
+
errMsg: string;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const getBackgroundAudioPlayerState: () => Promise<{
|
|
24
|
+
errMsg: string;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* 获取全局唯一的背景音频管理器
|
|
28
|
+
*/
|
|
29
|
+
export declare const getBackgroundAudioManager: () => BackgroundAudioManager;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { temporarilyNotSupport } from '
|
|
1
|
+
import { temporarilyNotSupport } from '../../../utils';
|
|
2
2
|
import { BackgroundAudioManager } from './BackgroundAudioManager';
|
|
3
3
|
// 背景音频
|
|
4
4
|
export const stopBackgroundAudio = temporarilyNotSupport('stopBackgroundAudio');
|
package/dist/api/media/camera.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getParameterError, shouldBeObject } from '../../../utils';
|
|
2
|
+
import { MethodHandler } from '../../../utils/handler';
|
|
3
3
|
/**
|
|
4
4
|
* 从本地相册选择图片或使用相机拍照。
|
|
5
5
|
*/
|
|
@@ -11,12 +11,14 @@ export const chooseImage = function (options) {
|
|
|
11
11
|
console.error(res.errMsg);
|
|
12
12
|
return Promise.reject(res);
|
|
13
13
|
}
|
|
14
|
-
const { count = 1, success, fail, complete, imageId = 'taroChooseImage' } = options;
|
|
14
|
+
const { count = 1, success, fail, complete, imageId = 'taroChooseImage', sourceType = ['album', 'camera'] } = options;
|
|
15
15
|
const handle = new MethodHandler({ name: 'chooseImage', success, fail, complete });
|
|
16
16
|
const res = {
|
|
17
17
|
tempFilePaths: [],
|
|
18
18
|
tempFiles: []
|
|
19
19
|
};
|
|
20
|
+
const sourceTypeString = sourceType && sourceType.toString();
|
|
21
|
+
const acceptableSourceType = ['user', 'environment', 'camera'];
|
|
20
22
|
if (count && typeof count !== 'number') {
|
|
21
23
|
res.errMsg = getParameterError({
|
|
22
24
|
para: 'count',
|
|
@@ -33,6 +35,9 @@ export const chooseImage = function (options) {
|
|
|
33
35
|
if (count > 1) {
|
|
34
36
|
obj.setAttribute('multiple', 'multiple');
|
|
35
37
|
}
|
|
38
|
+
if (acceptableSourceType.indexOf(sourceTypeString) > -1) {
|
|
39
|
+
obj.setAttribute('capture', sourceTypeString);
|
|
40
|
+
}
|
|
36
41
|
obj.setAttribute('accept', 'image/*');
|
|
37
42
|
obj.setAttribute('style', 'position: fixed; top: -4000px; left: -3000px; z-index: -300;');
|
|
38
43
|
document.body.appendChild(obj);
|
|
@@ -45,6 +50,12 @@ export const chooseImage = function (options) {
|
|
|
45
50
|
else {
|
|
46
51
|
el.removeAttribute('multiple');
|
|
47
52
|
}
|
|
53
|
+
if (acceptableSourceType.indexOf(sourceTypeString) > -1) {
|
|
54
|
+
el.setAttribute('capture', sourceTypeString);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
el.removeAttribute('capture');
|
|
58
|
+
}
|
|
48
59
|
}
|
|
49
60
|
return new Promise(resolve => {
|
|
50
61
|
const TaroMouseEvents = document.createEvent('MouseEvents');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { shouldBeObject } from '
|
|
2
|
-
import { MethodHandler } from '
|
|
1
|
+
import { shouldBeObject } from '../../../utils';
|
|
2
|
+
import { MethodHandler } from '../../../utils/handler';
|
|
3
3
|
/**
|
|
4
4
|
* 获取图片信息。网络图片需先配置download域名才能生效。
|
|
5
5
|
*/
|
|
@@ -11,14 +11,29 @@ export const getImageInfo = (options) => {
|
|
|
11
11
|
console.error(res.errMsg);
|
|
12
12
|
return Promise.reject(res);
|
|
13
13
|
}
|
|
14
|
+
const getBase64Image = (image) => {
|
|
15
|
+
try {
|
|
16
|
+
const canvas = document.createElement('canvas');
|
|
17
|
+
canvas.width = image.width;
|
|
18
|
+
canvas.height = image.height;
|
|
19
|
+
const ctx = canvas.getContext('2d');
|
|
20
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(image, 0, 0, image.width, image.height);
|
|
21
|
+
return canvas.toDataURL('image/png');
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
console.error('getImageInfo:get base64 fail', e);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
14
27
|
const { src, success, fail, complete } = options;
|
|
15
28
|
const handle = new MethodHandler({ name: 'getImageInfo', success, fail, complete });
|
|
16
29
|
return new Promise((resolve, reject) => {
|
|
17
30
|
const image = new Image();
|
|
31
|
+
image.crossOrigin = '';
|
|
18
32
|
image.onload = () => {
|
|
19
33
|
handle.success({
|
|
20
34
|
width: image.naturalWidth,
|
|
21
|
-
height: image.naturalHeight
|
|
35
|
+
height: image.naturalHeight,
|
|
36
|
+
path: getBase64Image(image) || src
|
|
22
37
|
}, resolve);
|
|
23
38
|
};
|
|
24
39
|
image.onerror = (e) => {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const saveImageToPhotosAlbum: () => Promise<{
|
|
2
|
+
errMsg: string;
|
|
3
|
+
}>;
|
|
4
|
+
export declare const previewMedia: () => Promise<{
|
|
5
|
+
errMsg: string;
|
|
6
|
+
}>;
|
|
7
|
+
export * from './getImageInfo';
|
|
8
|
+
export * from './previewImage';
|
|
9
|
+
export declare const compressImage: () => Promise<{
|
|
10
|
+
errMsg: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const chooseMessageFile: () => Promise<{
|
|
13
|
+
errMsg: string;
|
|
14
|
+
}>;
|
|
15
|
+
export * from './chooseImage';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { temporarilyNotSupport } from '
|
|
1
|
+
import { temporarilyNotSupport } from '../../../utils';
|
|
2
2
|
// 图片
|
|
3
3
|
export const saveImageToPhotosAlbum = temporarilyNotSupport('saveImageToPhotosAlbum');
|
|
4
4
|
export const previewMedia = temporarilyNotSupport('previewMedia');
|
|
5
|
-
export * from './previewImage';
|
|
6
5
|
export * from './getImageInfo';
|
|
6
|
+
export * from './previewImage';
|
|
7
7
|
export const compressImage = temporarilyNotSupport('compressImage');
|
|
8
8
|
export const chooseMessageFile = temporarilyNotSupport('chooseMessageFile');
|
|
9
9
|
export * from './chooseImage';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Taro from '@tarojs/api';
|
|
2
|
+
/**
|
|
3
|
+
* previewImage api基于开源的React组件[react-wx-images-viewer](https://github.com/react-ld/react-wx-images-viewer)开发,感谢!
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
|
|
7
|
+
*/
|
|
8
|
+
export declare const previewImage: typeof Taro.previewImage;
|