@tarojs/taro-h5 3.4.0-beta.1 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/api/ad/index.js +4 -0
  2. package/dist/api/ai/facial.js +5 -0
  3. package/dist/api/ai/index.js +2 -0
  4. package/dist/api/ai/visual.js +3 -0
  5. package/dist/api/alipay/index.js +3 -0
  6. package/dist/api/base/crypto.js +3 -0
  7. package/dist/api/base/debug.js +4 -0
  8. package/dist/api/base/index.js +17 -0
  9. package/dist/api/base/performance.js +4 -0
  10. package/dist/api/base/system/index.js +2 -0
  11. package/dist/api/base/system/info.js +57 -0
  12. package/dist/api/base/system/network.js +63 -0
  13. package/dist/api/base/update.js +4 -0
  14. package/dist/api/base/weapp/app-event.js +18 -0
  15. package/dist/api/base/weapp/life-cycle.js +4 -0
  16. package/dist/api/canvas/CanvasContext.js +191 -0
  17. package/dist/api/canvas/canvasGetImageData.js +25 -0
  18. package/dist/api/canvas/canvasPutImageData.js +22 -0
  19. package/dist/api/canvas/canvasToTempFilePath.js +22 -0
  20. package/dist/api/canvas/createCanvasContext.js +16 -0
  21. package/dist/api/canvas/index.js +8 -0
  22. package/dist/api/cloud/index.js +21 -0
  23. package/dist/api/data-analysis/index.js +5 -0
  24. package/dist/api/device/accelerometer.js +83 -0
  25. package/dist/api/device/accessibility.js +3 -0
  26. package/dist/api/device/battery.js +4 -0
  27. package/dist/api/device/bluetooth-ble.js +18 -0
  28. package/dist/api/device/bluetooth-peripheral.js +5 -0
  29. package/dist/api/device/bluetooth.js +15 -0
  30. package/dist/api/device/calendar.js +4 -0
  31. package/dist/api/device/clipboard.js +65 -0
  32. package/dist/api/device/compass.js +64 -0
  33. package/dist/api/device/contact.js +4 -0
  34. package/dist/api/device/crypto.js +3 -0
  35. package/dist/api/device/gyroscope.js +6 -0
  36. package/dist/api/device/iBeacon.js +9 -0
  37. package/dist/api/device/index.js +22 -0
  38. package/dist/api/device/keyboard.js +6 -0
  39. package/dist/api/device/memory.js +4 -0
  40. package/dist/api/device/motion.js +81 -0
  41. package/dist/api/device/nfc.js +9 -0
  42. package/dist/api/device/phone.js +24 -0
  43. package/dist/api/device/scan.js +6 -0
  44. package/dist/api/device/screen.js +8 -0
  45. package/dist/api/device/vibrate.js +35 -0
  46. package/dist/api/device/wifi.js +12 -0
  47. package/dist/api/ext/index.js +4 -0
  48. package/dist/api/files/index.js +10 -0
  49. package/dist/api/framework/index.js +7 -0
  50. package/dist/api/index.js +24 -0
  51. package/dist/api/location/chooseLocation.js +93 -0
  52. package/dist/api/location/index.js +13 -0
  53. package/dist/api/location/style.css +79 -0
  54. package/dist/api/media/EditorContext.js +18 -0
  55. package/dist/api/media/audio/InnerAudioContext.js +84 -0
  56. package/dist/api/media/audio/index.js +15 -0
  57. package/dist/api/media/background-audio/BackgroundAudioManager.js +86 -0
  58. package/dist/api/media/background-audio/index.js +15 -0
  59. package/dist/api/media/camera.js +3 -0
  60. package/dist/api/media/image/chooseImage.js +74 -0
  61. package/dist/api/media/image/getImageInfo.js +31 -0
  62. package/dist/api/media/image/index.js +9 -0
  63. package/dist/api/media/image/previewImage.js +67 -0
  64. package/dist/api/media/index.js +12 -0
  65. package/dist/api/media/live.js +4 -0
  66. package/dist/api/media/map.js +3 -0
  67. package/dist/api/media/media-recorder.js +3 -0
  68. package/dist/api/media/recorder.js +5 -0
  69. package/dist/api/media/video/index.js +74 -0
  70. package/dist/api/media/video-decoder.js +3 -0
  71. package/dist/api/media/video-processing.js +3 -0
  72. package/dist/api/media/voip.js +16 -0
  73. package/dist/api/navigate/index.js +6 -0
  74. package/dist/api/network/download.js +124 -0
  75. package/dist/api/network/index.js +7 -0
  76. package/dist/api/network/mdns.js +12 -0
  77. package/dist/api/network/request/index.js +125 -0
  78. package/dist/api/network/tcp.js +3 -0
  79. package/dist/api/network/udp.js +3 -0
  80. package/dist/api/network/upload.js +151 -0
  81. package/dist/api/network/utils.js +65 -0
  82. package/dist/api/network/websocket/index.js +70 -0
  83. package/dist/api/network/websocket/socketTask.js +63 -0
  84. package/dist/api/open-api/account.js +3 -0
  85. package/dist/api/open-api/address.js +3 -0
  86. package/dist/api/open-api/authorize.js +4 -0
  87. package/dist/api/open-api/card.js +4 -0
  88. package/dist/api/open-api/channels-live.js +8 -0
  89. package/dist/api/open-api/customer-service.js +3 -0
  90. package/dist/api/open-api/facial.js +6 -0
  91. package/dist/api/open-api/favorites.js +4 -0
  92. package/dist/api/open-api/group.js +3 -0
  93. package/dist/api/open-api/index.js +18 -0
  94. package/dist/api/open-api/invoice.js +4 -0
  95. package/dist/api/open-api/license-plate.js +3 -0
  96. package/dist/api/open-api/login.js +5 -0
  97. package/dist/api/open-api/red-package.js +3 -0
  98. package/dist/api/open-api/settings.js +4 -0
  99. package/dist/api/open-api/soter.js +5 -0
  100. package/dist/api/open-api/subscribe-message.js +3 -0
  101. package/dist/api/open-api/user-info.js +4 -0
  102. package/dist/api/open-api/werun.js +4 -0
  103. package/dist/api/payment/index.js +4 -0
  104. package/dist/api/route/index.js +3 -0
  105. package/dist/api/share/index.js +12 -0
  106. package/dist/api/storage/background-fetch.js +6 -0
  107. package/dist/api/storage/index.js +157 -0
  108. package/dist/api/swan/index.js +26 -0
  109. package/dist/api/taro.js +47 -0
  110. package/dist/api/ui/animation/index.js +288 -0
  111. package/dist/api/ui/background.js +4 -0
  112. package/dist/api/ui/custom-component.js +3 -0
  113. package/dist/api/ui/fonts.js +3 -0
  114. package/dist/api/ui/index.js +12 -0
  115. package/dist/api/ui/interaction/actionSheet.js +188 -0
  116. package/dist/api/ui/interaction/index.js +268 -0
  117. package/dist/api/ui/interaction/modal.js +207 -0
  118. package/dist/api/ui/interaction/toast.js +195 -0
  119. package/dist/api/ui/menu.js +3 -0
  120. package/dist/api/ui/navigation-bar/index.js +42 -0
  121. package/dist/api/ui/pull-down-refresh.js +26 -0
  122. package/dist/api/ui/scroll/index.js +83 -0
  123. package/dist/api/ui/sticky.js +3 -0
  124. package/dist/api/ui/tab-bar.js +282 -0
  125. package/dist/api/ui/window.js +31 -0
  126. package/dist/api/utils/handler.js +80 -0
  127. package/dist/api/utils/index.js +172 -0
  128. package/dist/api/worker/index.js +3 -0
  129. package/dist/api/wxml/index.js +6 -0
  130. package/dist/api/wxml/nodesRef.js +42 -0
  131. package/dist/api/wxml/selectorQuery.js +201 -0
  132. package/dist/index.cjs.js +4756 -6934
  133. package/dist/index.js +4 -10767
  134. package/dist/taroApis.js +1 -1
  135. package/dist/types/type.js +2 -0
  136. package/package.json +11 -13
  137. package/src/api/canvas/CanvasContext.ts +36 -33
  138. package/src/api/canvas/createCanvasContext.ts +2 -2
  139. package/src/api/cloud/index.ts +4 -0
  140. package/src/api/location/chooseLocation.ts +2 -2
  141. package/src/api/media/{editor.ts → EditorContext.ts} +0 -0
  142. package/src/api/media/audio/InnerAudioContext.ts +98 -0
  143. package/src/api/media/audio/index.ts +1 -86
  144. package/src/api/media/background-audio/BackgroundAudioManager.ts +103 -0
  145. package/src/api/media/{background-audio.ts → background-audio/index.ts} +7 -2
  146. package/src/api/media/image/previewImage.ts +4 -25
  147. package/src/api/media/index.ts +0 -1
  148. package/src/api/network/download.ts +5 -5
  149. package/src/api/network/upload.ts +6 -6
  150. package/src/api/network/websocket/index.ts +1 -1
  151. package/src/api/ui/animation/index.ts +11 -12
  152. package/src/api/ui/interaction/index.ts +12 -10
  153. package/src/api/ui/navigation-bar/index.ts +2 -2
  154. package/src/api/ui/scroll/index.ts +3 -3
  155. package/src/api/utils/index.ts +34 -13
  156. package/src/api/wxml/nodesRef.ts +10 -3
  157. package/src/api/wxml/selectorQuery.ts +68 -23
  158. package/src/index.ts +2 -2
package/dist/taroApis.js CHANGED
@@ -1 +1 @@
1
- module.exports = new Set(["EditorContext","addCard","addFileToFavorites","addInterceptor","addPhoneCalendar","addPhoneContact","addPhoneRepeatCalendar","addVideoToFavorites","advancedGeneralIdentify","animalClassify","arrayBufferToBase64","authPrivateMessage","authorize","authorizeForMiniProgram","base64ToArrayBuffer","canIUse","canvasGetImageData","canvasPutImageData","canvasToTempFilePath","carClassify","checkIsOpenAccessibility","checkIsSoterEnrolledInDevice","checkIsSupportFacialRecognition","checkIsSupportSoterAuthentication","checkSession","chooseAddress","chooseContact","chooseImage","chooseInvoice","chooseInvoiceTitle","chooseLicensePlate","chooseLocation","chooseMedia","chooseMessageFile","choosePoi","chooseVideo","clearStorage","clearStorageSync","closeBLEConnection","closeBluetoothAdapter","closeSocket","cloud","compressImage","compressVideo","connectSocket","connectWifi","createAnimation","createAudioContext","createBLEConnection","createBLEPeripheralServer","createBufferURL","createCameraContext","createCanvasContext","createInnerAudioContext","createIntersectionObserver","createInterstitialAd","createLivePlayerContext","createLivePusherContext","createMapContext","createMediaAudioPlayer","createMediaContainer","createMediaRecorder","createOffscreenCanvas","createRewardedVideoAd","createSelectorQuery","createTCPSocket","createUDPSocket","createVKSession","createVideoContext","createVideoDecoder","createWebAudioContext","createWorker","disableAlertBeforeUnload","dishClassify","downloadFile","drawCanvas","enableAlertBeforeUnload","exitMiniProgram","exitVoIPChat","faceDetect","faceVerifyForPay","getAccountInfoSync","getApp","getAvailableAudioSources","getBLEDeviceCharacteristics","getBLEDeviceRSSI","getBLEDeviceServices","getBLEMTU","getBackgroundAudioManager","getBackgroundAudioPlayerState","getBackgroundFetchData","getBackgroundFetchToken","getBatteryInfo","getBatteryInfoSync","getBeacons","getBluetoothAdapterState","getBluetoothDevices","getChannelsLiveInfo","getChannelsLiveNoticeInfo","getClipboardData","getConnectedBluetoothDevices","getConnectedWifi","getCurrentInstance","getCurrentPages","getEnterOptionsSync","getExptInfoSync","getExtConfig","getExtConfigSync","getFileInfo","getFileSystemManager","getGroupEnterInfo","getHCEState","getImageInfo","getLaunchOptionsSync","getLocalIPAddress","getLocation","getLogManager","getMenuButtonBoundingClientRect","getNFCAdapter","getNetworkType","getOpenUserInfo","getPerformance","getRandomValues","getRealtimeLogManager","getRecorderManager","getSavedFileInfo","getSavedFileList","getScreenBrightness","getSelectedTextRange","getSetting","getShareInfo","getStorage","getStorageInfo","getStorageInfoSync","getStorageSync","getSwanId","getSystemInfo","getSystemInfoSync","getUpdateManager","getUserCryptoManager","getUserInfo","getUserProfile","getVideoInfo","getWeRunData","getWifiList","hideHomeButton","hideKeyboard","hideLoading","hideNavigationBarLoading","hideShareMenu","hideTabBar","hideTabBarRedDot","hideToast","imageAudit","initFaceDetect","initTabBarApis","isBluetoothDevicePaired","joinVoIPChat","loadFontFace","login","logoClassify","makeBluetoothPair","makePhoneCall","navigateBack","navigateBackMiniProgram","navigateBackSmartProgram","navigateTo","navigateToMiniProgram","navigateToSmartGameProgram","navigateToSmartProgram","nextTick","notifyBLECharacteristicValueChange","objectDetectIdentify","ocrBankCard","ocrDrivingLicense","ocrIdCard","ocrVehicleLicense","offAccelerometerChange","offAppHide","offAppShow","offAudioInterruptionBegin","offAudioInterruptionEnd","offBLECharacteristicValueChange","offBLEConnectionStateChange","offBLEMTUChange","offBLEPeripheralConnectionStateChanged","offBeaconServiceChange","offBeaconUpdate","offBluetoothAdapterStateChange","offBluetoothDeviceFound","offCompassChange","offCopyUrl","offDeviceMotionChange","offError","offGetWifiList","offGyroscopeChange","offHCEMessage","offKeyboardHeightChange","offLocalServiceDiscoveryStop","offLocalServiceFound","offLocalServiceLost","offLocalServiceResolveFail","offLocationChange","offLocationChangeError","offMemoryWarning","offNetworkStatusChange","offPageNotFound","offThemeChange","offUnhandledRejection","offUserCaptureScreen","offVoIPChatInterrupted","offVoIPChatMembersChanged","offVoIPChatStateChanged","offVoIPVideoMembersChanged","offWifiConnected","offWindowResize","onAccelerometerChange","onAppHide","onAppShow","onAudioInterruptionBegin","onAudioInterruptionEnd","onBLECharacteristicValueChange","onBLEConnectionStateChange","onBLEMTUChange","onBLEPeripheralConnectionStateChanged","onBackgroundAudioPause","onBackgroundAudioPlay","onBackgroundAudioStop","onBackgroundFetchData","onBeaconServiceChange","onBeaconUpdate","onBluetoothAdapterStateChange","onBluetoothDeviceFound","onCompassChange","onCopyUrl","onDeviceMotionChange","onError","onGetWifiList","onGyroscopeChange","onHCEMessage","onKeyboardHeightChange","onLocalServiceDiscoveryStop","onLocalServiceFound","onLocalServiceLost","onLocalServiceResolveFail","onLocationChange","onLocationChangeError","onMemoryWarning","onNetworkStatusChange","onPageNotFound","onSocketClose","onSocketError","onSocketMessage","onSocketOpen","onThemeChange","onUnhandledRejection","onUserCaptureScreen","onVoIPChatInterrupted","onVoIPChatMembersChanged","onVoIPChatSpeakersChanged","onVoIPChatStateChanged","onVoIPVideoMembersChanged","onWifiConnected","onWindowResize","openBluetoothAdapter","openCard","openChannelsActivity","openChannelsEvent","openChannelsLive","openCustomerServiceChat","openDocument","openEmbeddedMiniProgram","openLocation","openSetting","openVideoEditor","pageScrollTo","pauseBackgroundAudio","pauseVoice","plantClassify","playBackgroundAudio","playVoice","pluginLogin","preloadSubPackage","previewImage","previewMedia","reLaunch","readBLECharacteristicValue","redirectTo","removeSavedFile","removeStorage","removeStorageSync","removeTabBarBadge","reportAnalytics","reportEvent","reportMonitor","reportPerformance","request","requestOrderPayment","requestPayment","requestPolymerPayment","requestSubscribeMessage","reserveChannelsLive","revokeBufferURL","saveFile","saveFileToDisk","saveImageToPhotosAlbum","saveVideoToPhotosAlbum","scanCode","seekBackgroundAudio","sendHCEMessage","sendSocketMessage","setBLEMTU","setBackgroundColor","setBackgroundFetchToken","setBackgroundTextStyle","setClipboardData","setEnable1v1Chat","setEnableDebug","setInnerAudioOption","setKeepScreenOn","setNavigationBarColor","setNavigationBarTitle","setPageInfo","setScreenBrightness","setStorage","setStorageSync","setTabBarBadge","setTabBarItem","setTabBarStyle","setTopBarText","setVisualEffectOnCapture","setWifiList","setWindowSize","shareFileMessage","shareToWeRun","shareVideoMessage","showActionSheet","showLoading","showModal","showNavigationBarLoading","showRedPackage","showShareImageMenu","showShareMenu","showTabBar","showTabBarRedDot","showToast","startAccelerometer","startBeaconDiscovery","startBluetoothDevicesDiscovery","startCompass","startDeviceMotionListening","startFacialRecognitionVerify","startFacialRecognitionVerifyAndUploadVideo","startGyroscope","startHCE","startLocalServiceDiscovery","startLocationUpdate","startLocationUpdateBackground","startPullDownRefresh","startRecord","startSoterAuthentication","startWifi","stopAccelerometer","stopBackgroundAudio","stopBeaconDiscovery","stopBluetoothDevicesDiscovery","stopCompass","stopDeviceMotionListening","stopFaceDetect","stopGyroscope","stopHCE","stopLocalServiceDiscovery","stopLocationUpdate","stopPullDownRefresh","stopRecord","stopVoice","stopWifi","subscribeVoIPVideoMembers","switchTab","textReview","textToAudio","updateShareMenu","updateVoIPChatMuteConfig","updateWeChatApp","uploadFile","vibrateLong","vibrateShort","writeBLECharacteristicValue"])
1
+ module.exports = new Set(["addCard","addFileToFavorites","addInterceptor","addPhoneCalendar","addPhoneContact","addPhoneRepeatCalendar","addVideoToFavorites","advancedGeneralIdentify","animalClassify","arrayBufferToBase64","authPrivateMessage","authorize","authorizeForMiniProgram","base64ToArrayBuffer","canIUse","canvasGetImageData","canvasPutImageData","canvasToTempFilePath","carClassify","checkIsOpenAccessibility","checkIsSoterEnrolledInDevice","checkIsSupportFacialRecognition","checkIsSupportSoterAuthentication","checkSession","chooseAddress","chooseContact","chooseImage","chooseInvoice","chooseInvoiceTitle","chooseLicensePlate","chooseLocation","chooseMedia","chooseMessageFile","choosePoi","chooseVideo","clearStorage","clearStorageSync","closeBLEConnection","closeBluetoothAdapter","closeSocket","cloud","compressImage","compressVideo","connectSocket","connectWifi","createAnimation","createAudioContext","createBLEConnection","createBLEPeripheralServer","createBufferURL","createCameraContext","createCanvasContext","createInnerAudioContext","createIntersectionObserver","createInterstitialAd","createLivePlayerContext","createLivePusherContext","createMapContext","createMediaAudioPlayer","createMediaContainer","createMediaRecorder","createOffscreenCanvas","createRewardedVideoAd","createSelectorQuery","createTCPSocket","createUDPSocket","createVKSession","createVideoContext","createVideoDecoder","createWebAudioContext","createWorker","disableAlertBeforeUnload","dishClassify","downloadFile","drawCanvas","enableAlertBeforeUnload","exitMiniProgram","exitVoIPChat","faceDetect","faceVerifyForPay","getAccountInfoSync","getApp","getAvailableAudioSources","getBLEDeviceCharacteristics","getBLEDeviceRSSI","getBLEDeviceServices","getBLEMTU","getBackgroundAudioManager","getBackgroundAudioPlayerState","getBackgroundFetchData","getBackgroundFetchToken","getBatteryInfo","getBatteryInfoSync","getBeacons","getBluetoothAdapterState","getBluetoothDevices","getChannelsLiveInfo","getChannelsLiveNoticeInfo","getClipboardData","getConnectedBluetoothDevices","getConnectedWifi","getCurrentInstance","getCurrentPages","getEnterOptionsSync","getExptInfoSync","getExtConfig","getExtConfigSync","getFileInfo","getFileSystemManager","getGroupEnterInfo","getHCEState","getImageInfo","getLaunchOptionsSync","getLocalIPAddress","getLocation","getLogManager","getMenuButtonBoundingClientRect","getNFCAdapter","getNetworkType","getOpenUserInfo","getPerformance","getRandomValues","getRealtimeLogManager","getRecorderManager","getSavedFileInfo","getSavedFileList","getScreenBrightness","getSelectedTextRange","getSetting","getShareInfo","getStorage","getStorageInfo","getStorageInfoSync","getStorageSync","getSwanId","getSystemInfo","getSystemInfoSync","getUpdateManager","getUserCryptoManager","getUserInfo","getUserProfile","getVideoInfo","getWeRunData","getWifiList","hideHomeButton","hideKeyboard","hideLoading","hideNavigationBarLoading","hideShareMenu","hideTabBar","hideTabBarRedDot","hideToast","imageAudit","initFaceDetect","initTabBarApis","isBluetoothDevicePaired","joinVoIPChat","loadFontFace","login","logoClassify","makeBluetoothPair","makePhoneCall","navigateBack","navigateBackMiniProgram","navigateBackSmartProgram","navigateTo","navigateToMiniProgram","navigateToSmartGameProgram","navigateToSmartProgram","nextTick","notifyBLECharacteristicValueChange","objectDetectIdentify","ocrBankCard","ocrDrivingLicense","ocrIdCard","ocrVehicleLicense","offAccelerometerChange","offAppHide","offAppShow","offAudioInterruptionBegin","offAudioInterruptionEnd","offBLECharacteristicValueChange","offBLEConnectionStateChange","offBLEMTUChange","offBLEPeripheralConnectionStateChanged","offBeaconServiceChange","offBeaconUpdate","offBluetoothAdapterStateChange","offBluetoothDeviceFound","offCompassChange","offCopyUrl","offDeviceMotionChange","offError","offGetWifiList","offGyroscopeChange","offHCEMessage","offKeyboardHeightChange","offLocalServiceDiscoveryStop","offLocalServiceFound","offLocalServiceLost","offLocalServiceResolveFail","offLocationChange","offLocationChangeError","offMemoryWarning","offNetworkStatusChange","offPageNotFound","offThemeChange","offUnhandledRejection","offUserCaptureScreen","offVoIPChatInterrupted","offVoIPChatMembersChanged","offVoIPChatStateChanged","offVoIPVideoMembersChanged","offWifiConnected","offWindowResize","onAccelerometerChange","onAppHide","onAppShow","onAudioInterruptionBegin","onAudioInterruptionEnd","onBLECharacteristicValueChange","onBLEConnectionStateChange","onBLEMTUChange","onBLEPeripheralConnectionStateChanged","onBackgroundAudioPause","onBackgroundAudioPlay","onBackgroundAudioStop","onBackgroundFetchData","onBeaconServiceChange","onBeaconUpdate","onBluetoothAdapterStateChange","onBluetoothDeviceFound","onCompassChange","onCopyUrl","onDeviceMotionChange","onError","onGetWifiList","onGyroscopeChange","onHCEMessage","onKeyboardHeightChange","onLocalServiceDiscoveryStop","onLocalServiceFound","onLocalServiceLost","onLocalServiceResolveFail","onLocationChange","onLocationChangeError","onMemoryWarning","onNetworkStatusChange","onPageNotFound","onSocketClose","onSocketError","onSocketMessage","onSocketOpen","onThemeChange","onUnhandledRejection","onUserCaptureScreen","onVoIPChatInterrupted","onVoIPChatMembersChanged","onVoIPChatSpeakersChanged","onVoIPChatStateChanged","onVoIPVideoMembersChanged","onWifiConnected","onWindowResize","openBluetoothAdapter","openCard","openChannelsActivity","openChannelsEvent","openChannelsLive","openCustomerServiceChat","openDocument","openEmbeddedMiniProgram","openLocation","openSetting","openVideoEditor","pageScrollTo","pauseBackgroundAudio","pauseVoice","plantClassify","playBackgroundAudio","playVoice","pluginLogin","preloadSubPackage","previewImage","previewMedia","reLaunch","readBLECharacteristicValue","redirectTo","removeSavedFile","removeStorage","removeStorageSync","removeTabBarBadge","reportAnalytics","reportEvent","reportMonitor","reportPerformance","request","requestOrderPayment","requestPayment","requestPolymerPayment","requestSubscribeMessage","reserveChannelsLive","revokeBufferURL","saveFile","saveFileToDisk","saveImageToPhotosAlbum","saveVideoToPhotosAlbum","scanCode","seekBackgroundAudio","sendHCEMessage","sendSocketMessage","setBLEMTU","setBackgroundColor","setBackgroundFetchToken","setBackgroundTextStyle","setClipboardData","setEnable1v1Chat","setEnableDebug","setInnerAudioOption","setKeepScreenOn","setNavigationBarColor","setNavigationBarTitle","setPageInfo","setScreenBrightness","setStorage","setStorageSync","setTabBarBadge","setTabBarItem","setTabBarStyle","setTopBarText","setVisualEffectOnCapture","setWifiList","setWindowSize","shareFileMessage","shareToWeRun","shareVideoMessage","showActionSheet","showLoading","showModal","showNavigationBarLoading","showRedPackage","showShareImageMenu","showShareMenu","showTabBar","showTabBarRedDot","showToast","startAccelerometer","startBeaconDiscovery","startBluetoothDevicesDiscovery","startCompass","startDeviceMotionListening","startFacialRecognitionVerify","startFacialRecognitionVerifyAndUploadVideo","startGyroscope","startHCE","startLocalServiceDiscovery","startLocationUpdate","startLocationUpdateBackground","startPullDownRefresh","startRecord","startSoterAuthentication","startWifi","stopAccelerometer","stopBackgroundAudio","stopBeaconDiscovery","stopBluetoothDevicesDiscovery","stopCompass","stopDeviceMotionListening","stopFaceDetect","stopGyroscope","stopHCE","stopLocalServiceDiscovery","stopLocationUpdate","stopPullDownRefresh","stopRecord","stopVoice","stopWifi","subscribeVoIPVideoMembers","switchTab","textReview","textToAudio","updateShareMenu","updateVoIPChatMuteConfig","updateWeChatApp","uploadFile","vibrateLong","vibrateShort","writeBLECharacteristicValue"])
@@ -0,0 +1,2 @@
1
+ const TaroH5 = {};
2
+ export default TaroH5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro-h5",
3
- "version": "3.4.0-beta.1",
3
+ "version": "3.4.1",
4
4
  "description": "Taro h5 framework",
5
5
  "main:h5": "dist/index.js",
6
6
  "main": "dist/index.cjs.js",
@@ -10,17 +10,15 @@
10
10
  "src",
11
11
  "index.js"
12
12
  ],
13
- "sideEffects": [
14
- "*.scss",
15
- "*.css",
16
- "./src/taro/index.js"
17
- ],
13
+ "sideEffects": false,
18
14
  "scripts": {
19
15
  "test": "jest",
16
+ "test:ci": "jest -i --coverage false",
20
17
  "test:dev": "jest --watch",
21
18
  "test:coverage": "jest --coverage",
22
- "build": "rollup -c",
23
- "dev": "rollup -cw"
19
+ "copy:assets": "copy src/**/*.css dist",
20
+ "build": "rollup -c && npm run copy:assets && tsc",
21
+ "dev": "tsc -w & npm run copy:assets"
24
22
  },
25
23
  "repository": {
26
24
  "type": "git",
@@ -32,14 +30,14 @@
32
30
  "author": "O2Team",
33
31
  "license": "MIT",
34
32
  "dependencies": {
35
- "@tarojs/api": "3.4.0-beta.1",
36
- "@tarojs/router": "3.4.0-beta.1",
37
- "@tarojs/runtime": "3.4.0-beta.1",
38
- "@tarojs/taro": "3.4.0-beta.1",
33
+ "@tarojs/api": "3.4.1",
34
+ "@tarojs/router": "3.4.1",
35
+ "@tarojs/runtime": "3.4.1",
36
+ "@tarojs/taro": "3.4.1",
39
37
  "base64-js": "^1.3.0",
40
38
  "jsonp-retry": "^1.0.3",
41
39
  "mobile-detect": "^1.4.2",
42
40
  "whatwg-fetch": "^3.4.0"
43
41
  },
44
- "gitHead": "bd7b3674278d22f71e2658b530cc0be24bf9964e"
42
+ "gitHead": "a2437215b1966fd0b6dd09311bcb4fd894a871d0"
45
43
  }
@@ -16,12 +16,17 @@ export class CanvasContext implements Taro.CanvasContext {
16
16
  __raw__: CanvasRenderingContext2D
17
17
  actions: IAction[] = []
18
18
 
19
+ constructor (canvas, ctx) {
20
+ this.canvas = canvas
21
+ this.ctx = ctx
22
+ }
23
+
19
24
  set ctx (e: CanvasRenderingContext2D) {
20
25
  this.__raw__ = e
21
26
  }
22
27
 
23
28
  get ctx () {
24
- return this.__raw__
29
+ return this.__raw__ || {}
25
30
  }
26
31
 
27
32
  canvas: HTMLCanvasElement
@@ -30,13 +35,11 @@ export class CanvasContext implements Taro.CanvasContext {
30
35
  this.actions.length = 0
31
36
  }
32
37
 
33
- protected enqueueActions (func: IAction['func']) {
34
- return (...args) => {
35
- this.actions.push({
36
- func,
37
- args
38
- })
39
- }
38
+ protected enqueueActions (func: IAction['func'], ...args) {
39
+ this.actions.push({
40
+ func,
41
+ args
42
+ })
40
43
  }
41
44
 
42
45
  set fillStyle (e) { this.enqueueActions(() => { this.ctx.fillStyle = e }) }
@@ -82,13 +85,13 @@ export class CanvasContext implements Taro.CanvasContext {
82
85
  get filter () { return this.ctx.filter }
83
86
  /** 小程序文档中不包括 ↑↑↑ */
84
87
 
85
- arc = this.enqueueActions(this.ctx.arc)
86
- arcTo = this.enqueueActions(this.ctx.arcTo)
87
- beginPath = this.enqueueActions(this.ctx.beginPath)
88
- bezierCurveTo = this.enqueueActions(this.ctx.bezierCurveTo)
89
- clearRect = this.enqueueActions(this.ctx.clearRect)
90
- clip = this.enqueueActions(this.ctx.clip)
91
- closePath = this.enqueueActions(this.ctx.closePath)
88
+ arc (...args) { return this.enqueueActions(this.ctx.arc, ...args) }
89
+ arcTo (...args) { return this.enqueueActions(this.ctx.arcTo, ...args) }
90
+ beginPath (...args) { return this.enqueueActions(this.ctx.beginPath, ...args) }
91
+ bezierCurveTo (...args) { return this.enqueueActions(this.ctx.bezierCurveTo, ...args) }
92
+ clearRect (...args) { return this.enqueueActions(this.ctx.clearRect, ...args) }
93
+ clip (...args) { return this.enqueueActions(this.ctx.clip, ...args) }
94
+ closePath (...args) { return this.enqueueActions(this.ctx.closePath, ...args) }
92
95
 
93
96
  createPattern (image: string, repetition: keyof Taro.CanvasContext.repetition): void {
94
97
  return this.createPattern(image, repetition)
@@ -139,17 +142,17 @@ export class CanvasContext implements Taro.CanvasContext {
139
142
  })
140
143
  }
141
144
 
142
- fill = this.enqueueActions(this.ctx.fill)
143
- fillRect = this.enqueueActions(this.ctx.fillRect)
144
- fillText = this.enqueueActions(this.ctx.fillText)
145
- lineTo = this.enqueueActions(this.ctx.lineTo)
146
- moveTo = this.enqueueActions(this.ctx.moveTo)
147
- quadraticCurveTo = this.enqueueActions(this.ctx.quadraticCurveTo)
148
- rect = this.enqueueActions(this.ctx.rect)
149
- restore = this.enqueueActions(this.ctx.restore)
150
- rotate = this.enqueueActions(this.ctx.rotate)
151
- save = this.enqueueActions(this.ctx.save)
152
- scale = this.enqueueActions(this.ctx.scale)
145
+ fill (...args) { return this.enqueueActions(this.ctx.fill, ...args) }
146
+ fillRect (...args) { return this.enqueueActions(this.ctx.fillRect, ...args) }
147
+ fillText (...args) { return this.enqueueActions(this.ctx.fillText, ...args) }
148
+ lineTo (...args) { return this.enqueueActions(this.ctx.lineTo, ...args) }
149
+ moveTo (...args) { return this.enqueueActions(this.ctx.moveTo, ...args) }
150
+ quadraticCurveTo (...args) { return this.enqueueActions(this.ctx.quadraticCurveTo, ...args) }
151
+ rect (...args) { return this.enqueueActions(this.ctx.rect, ...args) }
152
+ restore (...args) { return this.enqueueActions(this.ctx.restore, ...args) }
153
+ rotate (...args) { return this.enqueueActions(this.ctx.rotate, ...args) }
154
+ save (...args) { return this.enqueueActions(this.ctx.save, ...args) }
155
+ scale (...args) { return this.enqueueActions(this.ctx.scale, ...args) }
153
156
 
154
157
  setFillStyle (color: string | CanvasGradient): void {
155
158
  this.enqueueActions(() => { this.ctx.fillStyle = color })
@@ -207,15 +210,15 @@ export class CanvasContext implements Taro.CanvasContext {
207
210
  this.textBaseline = TextBaseLineMap[textBaseline] || 'alphabetic'
208
211
  }
209
212
 
210
- setTransform = this.enqueueActions(this.ctx.setTransform)
211
- stroke = this.enqueueActions(this.ctx.stroke)
212
- strokeRect = this.enqueueActions(this.ctx.strokeRect)
213
- strokeText = this.enqueueActions(this.ctx.strokeText)
214
- transform = this.enqueueActions(this.ctx.transform)
215
- translate = this.enqueueActions(this.ctx.translate)
213
+ setTransform (...args) { return this.enqueueActions(this.ctx.setTransform, ...args) }
214
+ stroke (...args) { return this.enqueueActions(this.ctx.stroke, ...args) }
215
+ strokeRect (...args) { return this.enqueueActions(this.ctx.strokeRect, ...args) }
216
+ strokeText (...args) { return this.enqueueActions(this.ctx.strokeText, ...args) }
217
+ transform (...args) { return this.enqueueActions(this.ctx.transform, ...args) }
218
+ translate (...args) { return this.enqueueActions(this.ctx.translate, ...args) }
216
219
 
217
220
  measureText (text: string): TextMetrics {
218
- return this.measureText(text)
221
+ return this.ctx.measureText(text)
219
222
  }
220
223
 
221
224
  createCircularGradient (x: number, y: number, r: number): CanvasGradient {
@@ -6,10 +6,10 @@ import { CanvasContext } from './CanvasContext'
6
6
  * 创建 canvas 的绘图上下文 CanvasContext 对象
7
7
  */
8
8
  export const createCanvasContext: typeof Taro.createCanvasContext = (canvasId, inst) => {
9
- const context = new CanvasContext()
10
9
  const el = findDOM(inst) as HTMLElement
11
10
  const canvas = el?.querySelector(`canvas[canvas-id="${canvasId}"]`) as HTMLCanvasElement
12
- const ctx = canvas?.getContext('2d')
11
+ const ctx = canvas?.getContext('2d') as CanvasRenderingContext2D
12
+ const context = new CanvasContext(canvas, ctx)
13
13
  if (!ctx) return context
14
14
  context.canvas = canvas
15
15
  context.ctx = ctx
@@ -8,6 +8,7 @@ export class cloud implements Taro.cloud {
8
8
 
9
9
  CloudID = temporarilyNotSupport('cloud.CloudID')
10
10
 
11
+ // @ts-ignore
11
12
  callFunction = temporarilyNotSupport('cloud.callFunction')
12
13
 
13
14
  // @ts-ignore
@@ -16,12 +17,15 @@ export class cloud implements Taro.cloud {
16
17
  // @ts-ignore
17
18
  downloadFile = temporarilyNotSupport('cloud.downloadFile')
18
19
 
20
+ // @ts-ignore
19
21
  getTempFileURL = temporarilyNotSupport('cloud.getTempFileURL')
20
22
 
23
+ // @ts-ignore
21
24
  deleteFile = temporarilyNotSupport('cloud.deleteFile')
22
25
 
23
26
  // @ts-ignore
24
27
  database = temporarilyNotSupport('cloud.database')
25
28
 
29
+ // @ts-ignore
26
30
  callContainer = temporarilyNotSupport('cloud.callContainer')
27
31
  }
@@ -28,13 +28,13 @@ function createLocationChooser (handler, key = LOCATION_APIKEY) {
28
28
  }
29
29
 
30
30
  function back () {
31
- handler({ errMsg: 'cancel' })
32
31
  hide()
32
+ handler({ errMsg: 'cancel' })
33
33
  }
34
34
 
35
35
  function submit () {
36
- handler()
37
36
  hide()
37
+ handler()
38
38
  }
39
39
 
40
40
  function remove () {
File without changes
@@ -0,0 +1,98 @@
1
+ import Taro from '@tarojs/api'
2
+ import { permanentlyNotSupport } from '../../utils'
3
+ import { CallbackManager } from '../../utils/handler'
4
+
5
+ export class InnerAudioContext implements Taro.InnerAudioContext {
6
+ Instance?: HTMLAudioElement
7
+ errorStack: CallbackManager
8
+ stopStack: CallbackManager
9
+ __startTime = 0
10
+
11
+ constructor () {
12
+ this.Instance = new Audio()
13
+ this.errorStack = new CallbackManager()
14
+ this.stopStack = new CallbackManager()
15
+
16
+ Taro.eventCenter.on('__taroRouterChange', () => { this.stop() })
17
+ this.onPlay(() => {
18
+ if (this.currentTime !== this.startTime) {
19
+ this.seek(this.startTime)
20
+ }
21
+ })
22
+ }
23
+
24
+ set autoplay (e) { this.setProperty('autoplay', e) }
25
+ get autoplay () { return this.Instance?.autoplay || false }
26
+ get buffered () { return this.Instance?.buffered.length || 0 }
27
+ get currentTime () { return this.Instance?.currentTime || 0 }
28
+ get duration () { return this.Instance?.duration || 0 }
29
+ set loop (e) { this.setProperty('loop', e) }
30
+ get loop () { return this.Instance?.loop || false }
31
+ get paused () { return this.Instance?.paused || true }
32
+ set src (e) { this.setProperty('src', e) }
33
+ get src () { return this.Instance?.src || '' }
34
+ set volume (e) { this.setProperty('volume', e) }
35
+ get volume () { return this.Instance?.volume || 0 }
36
+ set playbackRate (e) { this.setProperty('playbackRate', e) }
37
+ get playbackRate () { return this.Instance?.playbackRate || 0 }
38
+ set obeyMuteSwitch (_e) { permanentlyNotSupport('InnerAudioContext.obeyMuteSwitch')() }
39
+ get obeyMuteSwitch () { return true }
40
+ set startTime (e) { this.__startTime = e }
41
+ get startTime () { return this.__startTime || 0 }
42
+ set referrerPolicy (e) { this.Instance?.setAttribute('referrerpolicy', e) }
43
+ get referrerPolicy () { return this.Instance?.getAttribute('referrerpolicy') || 'origin' }
44
+
45
+ private setProperty (key: string, value: unknown) {
46
+ if (this.Instance) {
47
+ this.Instance[key] = value
48
+ }
49
+ }
50
+
51
+ play = () => this.Instance?.play()
52
+
53
+ pause = () => this.Instance?.pause()
54
+
55
+ stop = () => {
56
+ this.pause()
57
+ this.seek(0)
58
+ this.stopStack.trigger()
59
+ }
60
+
61
+ seek = (position: number) => {
62
+ if (this.Instance) {
63
+ this.Instance.currentTime = position
64
+ }
65
+ }
66
+
67
+ /**
68
+ * @TODO destroy得并不干净
69
+ */
70
+ destroy = () => {
71
+ this.stop()
72
+ if (this.Instance) {
73
+ document.body.removeChild(this.Instance)
74
+ this.Instance = undefined
75
+ }
76
+ }
77
+
78
+ onCanplay = (callback = () => {}) => this.Instance?.addEventListener('canplay', callback)
79
+ onPlay = (callback = () => {}) => this.Instance?.addEventListener('play', callback)
80
+ onPause = (callback = () => {}) => this.Instance?.addEventListener('pause', callback)
81
+ onStop = (callback = () => {}) => this.stopStack.add(callback)
82
+ onEnded = (callback = () => {}) => this.Instance?.addEventListener('ended', callback)
83
+ onTimeUpdate = (callback = () => {}) => this.Instance?.addEventListener('timeupdate', callback)
84
+ onError = (callback?: ((res: Taro.InnerAudioContext.onErrorDetail) => void)) => this.errorStack.add(callback)
85
+ onWaiting = (callback = () => {}) => this.Instance?.addEventListener('waiting', callback)
86
+ onSeeking = (callback = () => {}) => this.Instance?.addEventListener('seeking', callback)
87
+ onSeeked = (callback = () => {}) => this.Instance?.addEventListener('seeked', callback)
88
+ offCanplay = (callback = () => {}) => this.Instance?.removeEventListener('canplay', callback)
89
+ offPlay = (callback = () => {}) => this.Instance?.removeEventListener('play', callback)
90
+ offPause = (callback = () => {}) => this.Instance?.removeEventListener('pause', callback)
91
+ offStop = (callback = () => {}) => this.stopStack.remove(callback)
92
+ offEnded = (callback = () => {}) => this.Instance?.removeEventListener('ended', callback)
93
+ offTimeUpdate = (callback = () => {}) => this.Instance?.removeEventListener('timeupdate', callback)
94
+ offError = (callback = () => {}) => this.errorStack.remove(callback)
95
+ offWaiting = (callback = () => {}) => this.Instance?.removeEventListener('waiting', callback)
96
+ offSeeking = (callback = () => {}) => this.Instance?.removeEventListener('seeking', callback)
97
+ offSeeked = (callback = () => {}) => this.Instance?.removeEventListener('seeked', callback)
98
+ }
@@ -1,93 +1,8 @@
1
1
  import Taro from '@tarojs/api'
2
2
  import { temporarilyNotSupport } from '../../utils'
3
- import { CallbackManager } from '../../utils/handler'
3
+ import { InnerAudioContext } from './InnerAudioContext'
4
4
 
5
5
  // 音频
6
- class InnerAudioContext implements Taro.InnerAudioContext {
7
- Instance?: HTMLAudioElement
8
- errorStack: CallbackManager
9
- stopStack: CallbackManager
10
-
11
- constructor () {
12
- this.Instance = new Audio()
13
- this.errorStack = new CallbackManager()
14
- this.stopStack = new CallbackManager()
15
-
16
- Taro.eventCenter.on('__taroRouterChange', () => { this.stop() })
17
- }
18
-
19
- set autoplay (e) { this.setProperty('autoplay', e) }
20
- get autoplay () { return this.Instance?.autoplay || false }
21
- get buffered () { return this.Instance?.buffered.length || 0 }
22
- get currentTime () { return this.Instance?.currentTime || 0 }
23
- get duration () { return this.Instance?.duration || 0 }
24
- set loop (e) { this.setProperty('loop', e) }
25
- get loop () { return this.Instance?.loop || false }
26
- get paused () { return this.Instance?.paused || true }
27
- set src (e) { this.setProperty('src', e) }
28
- get src () { return this.Instance?.src || '' }
29
- set volume (e) { this.setProperty('volume', e) }
30
- get volume () { return this.Instance?.volume || 0 }
31
- set playbackRate (e) { this.setProperty('playbackRate', e) }
32
- get playbackRate () { return this.Instance?.volume || 0 }
33
- get obeyMuteSwitch () { return true }
34
- set startTime (e) { this.setProperty('startTime', e) }
35
- get startTime () { return this.Instance?.volume || 0 }
36
-
37
- private setProperty (key: string, value: unknown) {
38
- if (this.Instance) {
39
- this.Instance[key] = value
40
- }
41
- }
42
-
43
- play = () => this.Instance?.play()
44
-
45
- pause = () => this.Instance?.pause()
46
-
47
- stop = () => {
48
- this.pause()
49
- this.seek(0)
50
- this.stopStack.trigger()
51
- }
52
-
53
- seek = (position: number) => {
54
- if (this.Instance) {
55
- this.Instance.currentTime = position
56
- }
57
- }
58
-
59
- /**
60
- * @TODO destroy得并不干净
61
- */
62
- destroy = () => {
63
- this.stop()
64
- if (this.Instance) {
65
- document.body.removeChild(this.Instance)
66
- this.Instance = undefined
67
- }
68
- }
69
-
70
- onCanplay = (callback = () => {}) => this.Instance?.addEventListener('oncanplay', callback)
71
- onPlay = (callback = () => {}) => this.Instance?.addEventListener('onplay', callback)
72
- onPause = (callback = () => {}) => this.Instance?.addEventListener('onpause', callback)
73
- onStop = (callback = () => {}) => this.stopStack.add(callback)
74
- onEnded = (callback = () => {}) => this.Instance?.addEventListener('onended', callback)
75
- onTimeUpdate = (callback = () => {}) => this.Instance?.addEventListener('ontimeUpdate', callback)
76
- onError = (callback?: ((res: Taro.InnerAudioContext.onErrorDetail) => void)) => this.errorStack.add(callback)
77
- onWaiting = (callback = () => {}) => this.Instance?.addEventListener('onwaiting', callback)
78
- onSeeking = (callback = () => {}) => this.Instance?.addEventListener('onseeking', callback)
79
- onSeeked = (callback = () => {}) => this.Instance?.addEventListener('onseeked', callback)
80
- offCanplay = (callback = () => {}) => this.Instance?.removeEventListener('offcanplay', callback)
81
- offPlay = (callback = () => {}) => this.Instance?.removeEventListener('offplay', callback)
82
- offPause = (callback = () => {}) => this.Instance?.removeEventListener('offpause', callback)
83
- offStop = (callback = () => {}) => this.stopStack.remove(callback)
84
- offEnded = (callback = () => {}) => this.Instance?.removeEventListener('offended', callback)
85
- offTimeUpdate = (callback = () => {}) => this.Instance?.removeEventListener('offtimeUpdate', callback)
86
- offError = (callback = () => {}) => this.errorStack.remove(callback)
87
- offWaiting = (callback = () => {}) => this.Instance?.removeEventListener('offwaiting', callback)
88
- offSeeking = (callback = () => {}) => this.Instance?.removeEventListener('offseeking', callback)
89
- offSeeked = (callback = () => {}) => this.Instance?.removeEventListener('offseeked', callback)
90
- }
91
6
 
92
7
  export const stopVoice = temporarilyNotSupport('stopVoice')
93
8
  export const setInnerAudioOption = temporarilyNotSupport('setInnerAudioOption')
@@ -0,0 +1,103 @@
1
+ import Taro from '@tarojs/api'
2
+ import { permanentlyNotSupport } from '../../utils'
3
+ import { CallbackManager } from '../../utils/handler'
4
+
5
+ export class BackgroundAudioManager implements Taro.BackgroundAudioManager {
6
+ Instance?: HTMLAudioElement
7
+ errorStack: CallbackManager
8
+ stopStack: CallbackManager
9
+ __startTime = 0
10
+
11
+ constructor () {
12
+ this.Instance = new Audio()
13
+ this.errorStack = new CallbackManager()
14
+ this.stopStack = new CallbackManager()
15
+ this.Instance.autoplay = true
16
+ this.onPlay(() => {
17
+ if (this.currentTime !== this.startTime) {
18
+ this.seek(this.startTime)
19
+ }
20
+ })
21
+ }
22
+
23
+ set src (e) { this.setProperty('src', e) }
24
+ get src () { return this.Instance?.src || '' }
25
+ set startTime (e) { this.__startTime = e }
26
+ get startTime () { return this.__startTime || 0 }
27
+ set title (e) { this.dataset('title', e) }
28
+ get title () { return this.Instance?.dataset.title || '' }
29
+ set epname (e) { this.dataset('epname', e) }
30
+ get epname () { return this.Instance?.dataset.epname || '' }
31
+ set singer (e) { this.dataset('singer', e) }
32
+ get singer () { return this.Instance?.dataset.singer || '' }
33
+ set coverImgUrl (e) { this.dataset('coverImgUrl', e) }
34
+ get coverImgUrl () { return this.Instance?.dataset.coverImgUrl || '' }
35
+ set webUrl (e) { this.dataset('webUrl', e) }
36
+ get webUrl () { return this.Instance?.dataset.webUrl || '' }
37
+ set protocol (e) { this.dataset('protocol', e) }
38
+ get protocol () { return this.Instance?.dataset.protocol || '' }
39
+ set playbackRate (e) { this.setProperty('playbackRate', e) }
40
+ get playbackRate () { return this.Instance?.playbackRate || 0 }
41
+ get duration () { return this.Instance?.duration || 0 }
42
+ get currentTime () { return this.Instance?.currentTime || 0 }
43
+ get paused () { return this.Instance?.paused || false }
44
+ get buffered () { return this.Instance?.buffered.length || 0 }
45
+ set referrerPolicy (e) { this.Instance?.setAttribute('referrerpolicy', e) }
46
+ get referrerPolicy () { return this.Instance?.getAttribute('referrerpolicy') || 'origin' }
47
+
48
+ private setProperty (key: string, value: unknown) {
49
+ if (this.Instance) {
50
+ this.Instance[key] = value
51
+ }
52
+ }
53
+
54
+ private dataset (key: string, value: string) {
55
+ if (this.Instance) {
56
+ this.Instance.dataset[key] = value
57
+ }
58
+ }
59
+
60
+ play = () => this.Instance?.play()
61
+
62
+ pause = () => this.Instance?.pause()
63
+
64
+ seek = (position: number) => {
65
+ if (this.Instance) {
66
+ this.Instance.currentTime = position
67
+ }
68
+ }
69
+
70
+ stop = () => {
71
+ this.pause()
72
+ this.seek(0)
73
+ this.stopStack.trigger()
74
+ }
75
+
76
+ onCanplay = (callback = () => {}) => this.Instance?.addEventListener('canplay', callback)
77
+ onWaiting = (callback = () => {}) => this.Instance?.addEventListener('waiting', callback)
78
+ onError = (callback?: ((res: Taro.InnerAudioContext.onErrorDetail) => void)) => this.errorStack.add(callback)
79
+ onPlay = (callback = () => {}) => this.Instance?.addEventListener('play', callback)
80
+ onPause = (callback = () => {}) => this.Instance?.addEventListener('pause', callback)
81
+ onSeeking = (callback = () => {}) => this.Instance?.addEventListener('seeking', callback)
82
+ onSeeked = (callback = () => {}) => this.Instance?.addEventListener('seeked', callback)
83
+
84
+ onEnded = (callback = () => {}) => this.Instance?.addEventListener('ended', callback)
85
+ onStop = (callback = () => {}) => this.stopStack.add(callback)
86
+ onTimeUpdate = (callback = () => {}) => this.Instance?.addEventListener('timeupdate', callback)
87
+ onPrev = permanentlyNotSupport('BackgroundAudioManager.onPrev')
88
+ onNext = permanentlyNotSupport('BackgroundAudioManager.onNext')
89
+
90
+ offCanplay = (callback = () => {}) => this.Instance?.removeEventListener('canplay', callback)
91
+ offWaiting = (callback = () => {}) => this.Instance?.removeEventListener('waiting', callback)
92
+ offError = (callback = () => {}) => this.errorStack.remove(callback)
93
+ offPlay = (callback = () => {}) => this.Instance?.removeEventListener('play', callback)
94
+ offPause = (callback = () => {}) => this.Instance?.removeEventListener('pause', callback)
95
+ offSeeking = (callback = () => {}) => this.Instance?.removeEventListener('seeking', callback)
96
+ offSeeked = (callback = () => {}) => this.Instance?.removeEventListener('seeked', callback)
97
+
98
+ offEnded = (callback = () => {}) => this.Instance?.removeEventListener('ended', callback)
99
+ offStop = (callback = () => {}) => this.stopStack.remove(callback)
100
+ offTimeUpdate = (callback = () => {}) => this.Instance?.removeEventListener('timeupdate', callback)
101
+ offPrev = permanentlyNotSupport('BackgroundAudioManager.offPrev')
102
+ offNext = permanentlyNotSupport('BackgroundAudioManager.offNext')
103
+ }
@@ -1,4 +1,5 @@
1
- import { temporarilyNotSupport } from '../utils'
1
+ import { temporarilyNotSupport } from '../../utils'
2
+ import { BackgroundAudioManager } from './BackgroundAudioManager'
2
3
 
3
4
  // 背景音频
4
5
  export const stopBackgroundAudio = temporarilyNotSupport('stopBackgroundAudio')
@@ -9,4 +10,8 @@ export const onBackgroundAudioStop = temporarilyNotSupport('onBackgroundAudioSto
9
10
  export const onBackgroundAudioPlay = temporarilyNotSupport('onBackgroundAudioPlay')
10
11
  export const onBackgroundAudioPause = temporarilyNotSupport('onBackgroundAudioPause')
11
12
  export const getBackgroundAudioPlayerState = temporarilyNotSupport('getBackgroundAudioPlayerState')
12
- export const getBackgroundAudioManager = temporarilyNotSupport('getBackgroundAudioManager')
13
+
14
+ /**
15
+ * 获取全局唯一的背景音频管理器
16
+ */
17
+ export const getBackgroundAudioManager = () => new BackgroundAudioManager()
@@ -1,4 +1,4 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/api'
2
2
 
3
3
  import { shouldBeObject } from '../../utils'
4
4
  import { MethodHandler } from '../../utils/handler'
@@ -14,23 +14,12 @@ export const previewImage: typeof Taro.previewImage = async (options) => {
14
14
  function loadImage (url: string, loadFail: typeof fail): Promise<Node> {
15
15
  return new Promise((resolve) => {
16
16
  const item = document.createElement('taro-swiper-item-core')
17
- item.style.cssText = `
18
- display: flex;
19
- align-items: start;
20
- justify-content: center;
21
- overflow-y: scroll;
22
- `
17
+ item.style.cssText = 'display:flex;align-items:start;justify-content:center;overflow-y:scroll;'
23
18
  const image = new Image()
24
19
  image.style.maxWidth = '100%'
25
20
  image.src = url
26
21
  const div = document.createElement('div')
27
- div.style.cssText = `
28
- display: flex;
29
- align-items: center;
30
- justify-content: center;
31
- max-width: 100%;
32
- min-height: 100%;
33
- `
22
+ div.style.cssText = 'display:flex;align-items:center;justify-content:center;max-width:100%;min-height:100%;'
34
23
  div.appendChild(image)
35
24
  item.appendChild(div)
36
25
  // Note: 等待图片加载完后返回,会导致轮播被卡住
@@ -55,17 +44,7 @@ export const previewImage: typeof Taro.previewImage = async (options) => {
55
44
  const handle = new MethodHandler({ name: 'previewImage', success, fail, complete })
56
45
  const container = document.createElement('div')
57
46
  container.classList.add('preview-image')
58
- container.style.cssText = `
59
- position: fixed;
60
- top: 0;
61
- left: 0;
62
- z-index: 1050;
63
- width: 100%;
64
- height: 100%;
65
- overflow: hidden;
66
- outline: 0;
67
- background-color: #111;
68
- `
47
+ container.style.cssText = 'position:fixed;top:0;left:0;z-index:1050;width:100%;height:100%;overflow:hidden;outline:0;background-color:#111;'
69
48
  container.addEventListener('click', () => {
70
49
  container.remove()
71
50
  })
@@ -1,7 +1,6 @@
1
1
  export * from './audio'
2
2
  export * from './background-audio'
3
3
  export * from './camera'
4
- export * from './editor'
5
4
  export * from './image'
6
5
  export * from './live'
7
6
  export * from './map'