@tarojs/taro-h5 3.6.9-alpha.1 → 3.6.9-alpha.11
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/ai/index.d.ts +1 -0
- package/dist/api/ai/index.js +1 -0
- package/dist/api/ai/index.js.map +1 -1
- package/dist/api/ai/inference.d.ts +3 -0
- package/dist/api/ai/inference.js +8 -0
- package/dist/api/ai/inference.js.map +1 -0
- package/dist/api/alipay/index.d.ts +2 -1
- package/dist/api/alipay/index.js +2 -1
- package/dist/api/alipay/index.js.map +1 -1
- package/dist/api/base/index.js +3 -3
- package/dist/api/base/performance.d.ts +4 -1
- package/dist/api/base/performance.js +4 -1
- package/dist/api/base/performance.js.map +1 -1
- package/dist/api/base/system.d.ts +4 -1
- package/dist/api/base/system.js +4 -1
- package/dist/api/base/system.js.map +1 -1
- package/dist/api/base/weapp/app-event.d.ts +3 -1
- package/dist/api/base/weapp/app-event.js +3 -1
- package/dist/api/base/weapp/app-event.js.map +1 -1
- package/dist/api/device/index.d.ts +1 -0
- package/dist/api/device/index.js +2 -1
- package/dist/api/device/index.js.map +1 -1
- package/dist/api/device/screen.d.ts +4 -1
- package/dist/api/device/screen.js +4 -1
- package/dist/api/device/screen.js.map +1 -1
- package/dist/api/device/sms.d.ts +2 -0
- package/dist/api/device/sms.js +7 -0
- package/dist/api/device/sms.js.map +1 -0
- package/dist/api/index.js +13 -9
- package/dist/api/index.js.map +1 -1
- package/dist/api/media/image/previewImage.js +5 -5
- package/dist/api/media/image/previewImage.js.map +1 -1
- package/dist/api/media/index.js +1 -1
- package/dist/api/media/video/chooseMedia.js +1 -1
- package/dist/api/media/video/chooseMedia.js.map +1 -1
- package/dist/api/media/voip.d.ts +3 -1
- package/dist/api/media/voip.js +3 -1
- package/dist/api/media/voip.js.map +1 -1
- package/dist/api/open-api/channels-live.d.ts +3 -1
- package/dist/api/open-api/channels-live.js +3 -1
- package/dist/api/open-api/channels-live.js.map +1 -1
- package/dist/api/open-api/device-voip.d.ts +3 -0
- package/dist/api/open-api/device-voip.js +8 -0
- package/dist/api/open-api/device-voip.js.map +1 -0
- package/dist/api/open-api/index.d.ts +1 -0
- package/dist/api/open-api/index.js +2 -1
- package/dist/api/open-api/index.js.map +1 -1
- package/dist/api/payment/index.d.ts +2 -1
- package/dist/api/payment/index.js +2 -1
- package/dist/api/payment/index.js.map +1 -1
- package/dist/api/storage/cache-manager.d.ts +2 -0
- package/dist/api/storage/cache-manager.js +7 -0
- package/dist/api/storage/cache-manager.js.map +1 -0
- package/dist/api/storage/index.d.ts +6 -1
- package/dist/api/storage/index.js +6 -1
- package/dist/api/storage/index.js.map +1 -1
- package/dist/index.cjs.d.ts +32 -1
- package/dist/index.cjs.js +68 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.d.ts +32 -1
- package/dist/index.esm.js +42 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/api/ai/index.d.ts
CHANGED
package/dist/api/ai/index.js
CHANGED
package/dist/api/ai/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const getInferenceEnvInfo: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
2
|
+
declare const createInferenceSession: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
3
|
+
export { getInferenceEnvInfo, createInferenceSession };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../../utils/index.js';
|
|
2
|
+
|
|
3
|
+
// AI推理
|
|
4
|
+
const getInferenceEnvInfo = /* @__PURE__ */ temporarilyNotSupport('getInferenceEnvInfo');
|
|
5
|
+
const createInferenceSession = /* @__PURE__ */ temporarilyNotSupport('createInferenceSession');
|
|
6
|
+
|
|
7
|
+
export { createInferenceSession, getInferenceEnvInfo };
|
|
8
|
+
//# sourceMappingURL=inference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inference.js","sources":["../../../src/api/ai/inference.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// AI推理\nexport const getInferenceEnvInfo = /* @__PURE__ */ temporarilyNotSupport('getInferenceEnvInfo')\nexport const createInferenceSession = /* @__PURE__ */ temporarilyNotSupport('createInferenceSession')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,mBAAmB,mBAAmB,qBAAqB,CAAC,qBAAqB,EAAC;AAClF,MAAA,sBAAsB,mBAAmB,qBAAqB,CAAC,wBAAwB;;;;"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
declare const getOpenUserInfo: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
2
|
-
|
|
2
|
+
declare const tradePay: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
3
|
+
export { getOpenUserInfo, tradePay };
|
package/dist/api/alipay/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { temporarilyNotSupport } from '../../utils/index.js';
|
|
|
2
2
|
|
|
3
3
|
// AliPay
|
|
4
4
|
const getOpenUserInfo = /* @__PURE__ */ temporarilyNotSupport('getOpenUserInfo');
|
|
5
|
+
const tradePay = /* @__PURE__ */ temporarilyNotSupport('tradePay');
|
|
5
6
|
|
|
6
|
-
export { getOpenUserInfo };
|
|
7
|
+
export { getOpenUserInfo, tradePay };
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/api/alipay/index.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// AliPay\nexport const getOpenUserInfo = /* @__PURE__ */ temporarilyNotSupport('getOpenUserInfo')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,eAAe,mBAAmB,qBAAqB,CAAC,iBAAiB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/api/alipay/index.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// AliPay\nexport const getOpenUserInfo = /* @__PURE__ */ temporarilyNotSupport('getOpenUserInfo')\nexport const tradePay = /* @__PURE__ */ temporarilyNotSupport('tradePay')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,eAAe,mBAAmB,qBAAqB,CAAC,iBAAiB,EAAC;AAC1E,MAAA,QAAQ,mBAAmB,qBAAqB,CAAC,UAAU;;;;"}
|
package/dist/api/base/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { fromByteArray, toByteArray } from 'base64-js';
|
|
2
2
|
export { getUserCryptoManager } from './crypto.js';
|
|
3
3
|
export { getLogManager, getRealtimeLogManager, setEnableDebug } from './debug.js';
|
|
4
|
-
export { getPerformance, reportPerformance } from './performance.js';
|
|
5
|
-
export { getAppAuthorizeSetting, getAppBaseInfo, getDeviceInfo, getSystemInfo, getSystemInfoAsync, getSystemInfoSync, getSystemSetting, getWindowInfo, openAppAuthorizeSetting, openSystemBluetoothSetting } from './system.js';
|
|
4
|
+
export { getPerformance, preloadAssets, preloadSkylineView, preloadWebview, reportPerformance } from './performance.js';
|
|
5
|
+
export { getAppAuthorizeSetting, getAppBaseInfo, getDeviceInfo, getRendererUserAgent, getSkylineInfo, getSkylineInfoSync, getSystemInfo, getSystemInfoAsync, getSystemInfoSync, getSystemSetting, getWindowInfo, openAppAuthorizeSetting, openSystemBluetoothSetting } from './system.js';
|
|
6
6
|
export { getUpdateManager, updateWeChatApp } from './update.js';
|
|
7
|
-
export { offAppHide, offAppShow, offAudioInterruptionBegin, offAudioInterruptionEnd, offError, offPageNotFound, offThemeChange, offUnhandledRejection, onAppHide, onAppShow, onAudioInterruptionBegin, onAudioInterruptionEnd, onError, onPageNotFound, onThemeChange, onUnhandledRejection } from './weapp/app-event.js';
|
|
7
|
+
export { offAppHide, offAppShow, offAudioInterruptionBegin, offAudioInterruptionEnd, offError, offLazyLoadError, offPageNotFound, offThemeChange, offUnhandledRejection, onAppHide, onAppShow, onAudioInterruptionBegin, onAudioInterruptionEnd, onError, onLazyLoadError, onPageNotFound, onThemeChange, onUnhandledRejection } from './weapp/app-event.js';
|
|
8
8
|
export { getEnterOptionsSync, getLaunchOptionsSync } from './weapp/life-cycle.js';
|
|
9
9
|
|
|
10
10
|
const env = {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
declare const reportPerformance: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
2
2
|
declare const getPerformance: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
3
|
-
|
|
3
|
+
declare const preloadWebview: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
4
|
+
declare const preloadSkylineView: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
5
|
+
declare const preloadAssets: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
6
|
+
export { reportPerformance, getPerformance, preloadWebview, preloadSkylineView, preloadAssets };
|
|
@@ -3,6 +3,9 @@ import { temporarilyNotSupport } from '../../utils/index.js';
|
|
|
3
3
|
// 性能
|
|
4
4
|
const reportPerformance = /* @__PURE__ */ temporarilyNotSupport('reportPerformance');
|
|
5
5
|
const getPerformance = /* @__PURE__ */ temporarilyNotSupport('getPerformance');
|
|
6
|
+
const preloadWebview = /* @__PURE__ */ temporarilyNotSupport('preloadWebview');
|
|
7
|
+
const preloadSkylineView = /* @__PURE__ */ temporarilyNotSupport('preloadSkylineView');
|
|
8
|
+
const preloadAssets = /* @__PURE__ */ temporarilyNotSupport('preloadAssets');
|
|
6
9
|
|
|
7
|
-
export { getPerformance, reportPerformance };
|
|
10
|
+
export { getPerformance, preloadAssets, preloadSkylineView, preloadWebview, reportPerformance };
|
|
8
11
|
//# sourceMappingURL=performance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance.js","sources":["../../../src/api/base/performance.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 性能\nexport const reportPerformance = /* @__PURE__ */ temporarilyNotSupport('reportPerformance')\nexport const getPerformance = /* @__PURE__ */ temporarilyNotSupport('getPerformance')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,iBAAiB,mBAAmB,qBAAqB,CAAC,mBAAmB,EAAC;AAC9E,MAAA,cAAc,mBAAmB,qBAAqB,CAAC,gBAAgB;;;;"}
|
|
1
|
+
{"version":3,"file":"performance.js","sources":["../../../src/api/base/performance.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 性能\nexport const reportPerformance = /* @__PURE__ */ temporarilyNotSupport('reportPerformance')\nexport const getPerformance = /* @__PURE__ */ temporarilyNotSupport('getPerformance')\nexport const preloadWebview = /* @__PURE__ */ temporarilyNotSupport('preloadWebview')\nexport const preloadSkylineView = /* @__PURE__ */ temporarilyNotSupport('preloadSkylineView')\nexport const preloadAssets = /* @__PURE__ */ temporarilyNotSupport('preloadAssets')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,iBAAiB,mBAAmB,qBAAqB,CAAC,mBAAmB,EAAC;AAC9E,MAAA,cAAc,mBAAmB,qBAAqB,CAAC,gBAAgB,EAAC;AACxE,MAAA,cAAc,mBAAmB,qBAAqB,CAAC,gBAAgB,EAAC;AACxE,MAAA,kBAAkB,mBAAmB,qBAAqB,CAAC,oBAAoB,EAAC;AAChF,MAAA,aAAa,mBAAmB,qBAAqB,CAAC,eAAe;;;;"}
|
|
@@ -19,4 +19,7 @@ declare const getSystemInfoSync: typeof Taro.getSystemInfoSync;
|
|
|
19
19
|
declare const getSystemInfoAsync: typeof Taro.getSystemInfoAsync;
|
|
20
20
|
/** 获取系统信息 */
|
|
21
21
|
declare const getSystemInfo: typeof Taro.getSystemInfo;
|
|
22
|
-
|
|
22
|
+
declare const getSkylineInfoSync: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
23
|
+
declare const getSkylineInfo: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
24
|
+
declare const getRendererUserAgent: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
25
|
+
export { openSystemBluetoothSetting, openAppAuthorizeSetting, getWindowInfo, getSystemSetting, getDeviceInfo, getAppBaseInfo, getAppAuthorizeSetting, getSystemInfoSync, getSystemInfoAsync, getSystemInfo, getSkylineInfoSync, getSkylineInfo, getRendererUserAgent };
|
package/dist/api/base/system.js
CHANGED
|
@@ -186,6 +186,9 @@ const getSystemInfo = (options = {}) => __awaiter(void 0, void 0, void 0, functi
|
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
|
+
const getSkylineInfoSync = /* @__PURE__ */ temporarilyNotSupport('getSkylineInfoSync');
|
|
190
|
+
const getSkylineInfo = /* @__PURE__ */ temporarilyNotSupport('getSkylineInfo');
|
|
191
|
+
const getRendererUserAgent = /* @__PURE__ */ temporarilyNotSupport('getRendererUserAgent');
|
|
189
192
|
|
|
190
|
-
export { getAppAuthorizeSetting, getAppBaseInfo, getDeviceInfo, getSystemInfo, getSystemInfoAsync, getSystemInfoSync, getSystemSetting, getWindowInfo, openAppAuthorizeSetting, openSystemBluetoothSetting };
|
|
193
|
+
export { getAppAuthorizeSetting, getAppBaseInfo, getDeviceInfo, getRendererUserAgent, getSkylineInfo, getSkylineInfoSync, getSystemInfo, getSystemInfoAsync, getSystemInfoSync, getSystemSetting, getWindowInfo, openAppAuthorizeSetting, openSystemBluetoothSetting };
|
|
191
194
|
//# sourceMappingURL=system.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.js","sources":["../../../src/api/base/system.ts"],"sourcesContent":["import Taro from '@tarojs/api'\nimport { getMobileDetect } from '@tarojs/router/dist/utils/navigate'\n\nimport { temporarilyNotSupport } from '../../utils'\nimport { MethodHandler } from '../../utils/handler'\n\n/** 跳转系统蓝牙设置页 */\nexport const openSystemBluetoothSetting = /* @__PURE__ */ temporarilyNotSupport('openSystemBluetoothSetting')\n\n/** 跳转系统微信授权管理页 */\nexport const openAppAuthorizeSetting = /* @__PURE__ */ temporarilyNotSupport('openAppAuthorizeSetting')\n\n/** 获取窗口信息 */\nexport const getWindowInfo: typeof Taro.getWindowInfo = () => {\n const info: ReturnType<typeof Taro.getWindowInfo> = {\n /** 设备像素比 */\n pixelRatio: window.devicePixelRatio,\n /** 屏幕宽度,单位px */\n screenWidth: window.screen.width,\n /** 屏幕高度,单位px */\n screenHeight: window.screen.height,\n /** 可使用窗口宽度,单位px */\n windowWidth: document.documentElement.clientWidth,\n /** 可使用窗口高度,单位px */\n windowHeight: document.documentElement.clientHeight,\n /** 状态栏的高度,单位px */\n statusBarHeight: NaN,\n /** 在竖屏正方向下的安全区域 */\n safeArea: {\n bottom: 0,\n height: 0,\n left: 0,\n right: 0,\n top: 0,\n width: 0\n }\n }\n\n return info\n}\n\n/** 获取设备设置 */\nexport const getSystemSetting: typeof Taro.getSystemSetting = () => {\n const isLandscape = window.screen.width >= window.screen.height\n const info: ReturnType<typeof Taro.getSystemSetting> = {\n /** 蓝牙的系统开关 */\n bluetoothEnabled: false,\n /** 地理位置的系统开关 */\n locationEnabled: false,\n /** Wi-Fi 的系统开关 */\n wifiEnabled: false,\n /** 设备方向 */\n deviceOrientation: isLandscape ? 'landscape' : 'portrait'\n }\n\n return info\n}\n\n/** 获取设备设置 */\nexport const getDeviceInfo: typeof Taro.getDeviceInfo = () => {\n const md = getMobileDetect()\n\n const info: ReturnType<typeof Taro.getDeviceInfo> = {\n /** 应用二进制接口类型(仅 Android 支持) */\n abi: '',\n /** 设备二进制接口类型(仅 Android 支持) */\n deviceAbi: '',\n /** 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */\n benchmarkLevel: -1,\n /** 设备品牌 */\n brand: md.mobile() || '',\n /** 设备型号 */\n model: md.mobile() || '',\n /** 操作系统及版本 */\n system: md.os(),\n /** 客户端平台 */\n platform: navigator.platform,\n /** 设备二进制接口类型(仅 Android 支持) */\n CPUType: '',\n }\n\n return info\n}\n\n/** 获取微信APP基础信息 */\nexport const getAppBaseInfo: typeof Taro.getAppBaseInfo = () => {\n let isDarkMode = false\n if (window.matchMedia?.('(prefers-color-scheme: dark)').matches) {\n isDarkMode = true\n }\n\n const info: ReturnType<typeof Taro.getAppBaseInfo> = {\n /** 客户端基础库版本 */\n SDKVersion: '',\n /** 是否已打开调试。可通过右上角菜单或 [Taro.setEnableDebug](/docs/apis/base/debug/setEnableDebug) 打开调试。 */\n enableDebug: process.env.NODE_ENV !== 'production',\n /** 当前小程序运行的宿主环境 */\n // host: { appId: '' },\n /** 微信设置的语言 */\n language: navigator.language,\n /** 微信版本号 */\n version: '',\n /** 系统当前主题,取值为light或dark,全局配置\"darkmode\":true时才能获取,否则为 undefined (不支持小游戏) */\n theme: isDarkMode ? 'dark' : 'light'\n }\n\n return info\n}\n\n/** 获取微信APP授权设置 */\nexport const getAppAuthorizeSetting: typeof Taro.getAppAuthorizeSetting = () => {\n const info: ReturnType<typeof Taro.getAppAuthorizeSetting> = {\n /** 允许微信使用相册的开关(仅 iOS 有效) */\n albumAuthorized: 'not determined',\n /** 允许微信使用蓝牙的开关(仅 iOS 有效) */\n bluetoothAuthorized: 'not determined',\n /** 允许微信使用摄像头的开关 */\n cameraAuthorized: 'not determined',\n /** 允许微信使用定位的开关 */\n locationAuthorized: 'not determined',\n /** 定位准确度。true 表示模糊定位,false 表示精确定位(仅 iOS 有效) */\n locationReducedAccuracy: false,\n /** 允许微信使用麦克风的开关 */\n microphoneAuthorized: 'not determined',\n /** 允许微信通知的开关 */\n notificationAuthorized: 'not determined',\n /** 允许微信通知带有提醒的开关(仅 iOS 有效) */\n notificationAlertAuthorized: 'not determined',\n /** 允许微信通知带有标记的开关(仅 iOS 有效) */\n notificationBadgeAuthorized: 'not determined',\n /** 允许微信通知带有声音的开关(仅 iOS 有效) */\n notificationSoundAuthorized: 'not determined',\n /** 允许微信使用日历的开关 */\n phoneCalendarAuthorized: 'not determined'\n }\n\n return info\n}\n\n/** 获取设备设置 */\nexport const getSystemInfoSync: typeof Taro.getSystemInfoSync = () => {\n const windowInfo = getWindowInfo()\n const systemSetting = getSystemSetting()\n const deviceInfo: Taro.getDeviceInfo.Result = getDeviceInfo()\n const appBaseInfo = getAppBaseInfo()\n const appAuthorizeSetting = getAppAuthorizeSetting()\n delete deviceInfo.abi\n\n const info: ReturnType<typeof Taro.getSystemInfoSync> = {\n ...windowInfo,\n ...systemSetting,\n ...deviceInfo,\n ...appBaseInfo,\n /** 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 */\n fontSizeSetting: NaN,\n /** 允许微信使用相册的开关(仅 iOS 有效) */\n albumAuthorized: appAuthorizeSetting.albumAuthorized === 'authorized',\n /** 允许微信使用摄像头的开关 */\n cameraAuthorized: appAuthorizeSetting.cameraAuthorized === 'authorized',\n /** 允许微信使用定位的开关 */\n locationAuthorized: appAuthorizeSetting.locationAuthorized === 'authorized',\n /** 允许微信使用麦克风的开关 */\n microphoneAuthorized: appAuthorizeSetting.microphoneAuthorized === 'authorized',\n /** 允许微信通知的开关 */\n notificationAuthorized: appAuthorizeSetting.notificationAuthorized === 'authorized',\n /** 允许微信通知带有提醒的开关(仅 iOS 有效) */\n notificationAlertAuthorized: appAuthorizeSetting.notificationAlertAuthorized === 'authorized',\n /** 允许微信通知带有标记的开关(仅 iOS 有效) */\n notificationBadgeAuthorized: appAuthorizeSetting.notificationBadgeAuthorized === 'authorized',\n /** 允许微信通知带有声音的开关(仅 iOS 有效) */\n notificationSoundAuthorized: appAuthorizeSetting.notificationSoundAuthorized === 'authorized',\n /** 允许微信使用日历的开关 */\n phoneCalendarAuthorized: appAuthorizeSetting.phoneCalendarAuthorized === 'authorized',\n /** `true` 表示模糊定位,`false` 表示精确定位,仅 iOS 支持 */\n locationReducedAccuracy: appAuthorizeSetting.locationReducedAccuracy,\n /** 小程序当前运行环境 */\n environment: ''\n }\n\n return info\n}\n\n/** 获取系统信息 */\nexport const getSystemInfoAsync: typeof Taro.getSystemInfoAsync = async (options = {}) => {\n const { success, fail, complete } = options\n const handle = new MethodHandler({ name: 'getSystemInfoAsync', success, fail, complete })\n\n try {\n const info = await getSystemInfoSync()\n return handle.success(info)\n } catch (error) {\n return handle.fail({\n errMsg: error\n })\n }\n}\n\n/** 获取系统信息 */\nexport const getSystemInfo: typeof Taro.getSystemInfo = async (options = {}) => {\n const { success, fail, complete } = options\n const handle = new MethodHandler({ name: 'getSystemInfo', success, fail, complete })\n\n try {\n const info = await getSystemInfoSync()\n return handle.success(info)\n } catch (error) {\n return handle.fail({\n errMsg: error\n })\n }\n}\n"],"names":[],"mappings":";;;;;AAMA;AACa,MAAA,0BAA0B,mBAAmB,qBAAqB,CAAC,4BAA4B,EAAC;AAE7G;AACa,MAAA,uBAAuB,mBAAmB,qBAAqB,CAAC,yBAAyB,EAAC;AAEvG;AACO,MAAM,aAAa,GAA8B,MAAK;A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/base/system.ts"],"sourcesContent":["import Taro from '@tarojs/api'\nimport { getMobileDetect } from '@tarojs/router/dist/utils/navigate'\n\nimport { temporarilyNotSupport } from '../../utils'\nimport { MethodHandler } from '../../utils/handler'\n\n/** 跳转系统蓝牙设置页 */\nexport const openSystemBluetoothSetting = /* @__PURE__ */ temporarilyNotSupport('openSystemBluetoothSetting')\n\n/** 跳转系统微信授权管理页 */\nexport const openAppAuthorizeSetting = /* @__PURE__ */ temporarilyNotSupport('openAppAuthorizeSetting')\n\n/** 获取窗口信息 */\nexport const getWindowInfo: typeof Taro.getWindowInfo = () => {\n const info: ReturnType<typeof Taro.getWindowInfo> = {\n /** 设备像素比 */\n pixelRatio: window.devicePixelRatio,\n /** 屏幕宽度,单位px */\n screenWidth: window.screen.width,\n /** 屏幕高度,单位px */\n screenHeight: window.screen.height,\n /** 可使用窗口宽度,单位px */\n windowWidth: document.documentElement.clientWidth,\n /** 可使用窗口高度,单位px */\n windowHeight: document.documentElement.clientHeight,\n /** 状态栏的高度,单位px */\n statusBarHeight: NaN,\n /** 在竖屏正方向下的安全区域 */\n safeArea: {\n bottom: 0,\n height: 0,\n left: 0,\n right: 0,\n top: 0,\n width: 0\n }\n }\n\n return info\n}\n\n/** 获取设备设置 */\nexport const getSystemSetting: typeof Taro.getSystemSetting = () => {\n const isLandscape = window.screen.width >= window.screen.height\n const info: ReturnType<typeof Taro.getSystemSetting> = {\n /** 蓝牙的系统开关 */\n bluetoothEnabled: false,\n /** 地理位置的系统开关 */\n locationEnabled: false,\n /** Wi-Fi 的系统开关 */\n wifiEnabled: false,\n /** 设备方向 */\n deviceOrientation: isLandscape ? 'landscape' : 'portrait'\n }\n\n return info\n}\n\n/** 获取设备设置 */\nexport const getDeviceInfo: typeof Taro.getDeviceInfo = () => {\n const md = getMobileDetect()\n\n const info: ReturnType<typeof Taro.getDeviceInfo> = {\n /** 应用二进制接口类型(仅 Android 支持) */\n abi: '',\n /** 设备二进制接口类型(仅 Android 支持) */\n deviceAbi: '',\n /** 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */\n benchmarkLevel: -1,\n /** 设备品牌 */\n brand: md.mobile() || '',\n /** 设备型号 */\n model: md.mobile() || '',\n /** 操作系统及版本 */\n system: md.os(),\n /** 客户端平台 */\n platform: navigator.platform,\n /** 设备二进制接口类型(仅 Android 支持) */\n CPUType: '',\n }\n\n return info\n}\n\n/** 获取微信APP基础信息 */\nexport const getAppBaseInfo: typeof Taro.getAppBaseInfo = () => {\n let isDarkMode = false\n if (window.matchMedia?.('(prefers-color-scheme: dark)').matches) {\n isDarkMode = true\n }\n\n const info: ReturnType<typeof Taro.getAppBaseInfo> = {\n /** 客户端基础库版本 */\n SDKVersion: '',\n /** 是否已打开调试。可通过右上角菜单或 [Taro.setEnableDebug](/docs/apis/base/debug/setEnableDebug) 打开调试。 */\n enableDebug: process.env.NODE_ENV !== 'production',\n /** 当前小程序运行的宿主环境 */\n // host: { appId: '' },\n /** 微信设置的语言 */\n language: navigator.language,\n /** 微信版本号 */\n version: '',\n /** 系统当前主题,取值为light或dark,全局配置\"darkmode\":true时才能获取,否则为 undefined (不支持小游戏) */\n theme: isDarkMode ? 'dark' : 'light'\n }\n\n return info\n}\n\n/** 获取微信APP授权设置 */\nexport const getAppAuthorizeSetting: typeof Taro.getAppAuthorizeSetting = () => {\n const info: ReturnType<typeof Taro.getAppAuthorizeSetting> = {\n /** 允许微信使用相册的开关(仅 iOS 有效) */\n albumAuthorized: 'not determined',\n /** 允许微信使用蓝牙的开关(仅 iOS 有效) */\n bluetoothAuthorized: 'not determined',\n /** 允许微信使用摄像头的开关 */\n cameraAuthorized: 'not determined',\n /** 允许微信使用定位的开关 */\n locationAuthorized: 'not determined',\n /** 定位准确度。true 表示模糊定位,false 表示精确定位(仅 iOS 有效) */\n locationReducedAccuracy: false,\n /** 允许微信使用麦克风的开关 */\n microphoneAuthorized: 'not determined',\n /** 允许微信通知的开关 */\n notificationAuthorized: 'not determined',\n /** 允许微信通知带有提醒的开关(仅 iOS 有效) */\n notificationAlertAuthorized: 'not determined',\n /** 允许微信通知带有标记的开关(仅 iOS 有效) */\n notificationBadgeAuthorized: 'not determined',\n /** 允许微信通知带有声音的开关(仅 iOS 有效) */\n notificationSoundAuthorized: 'not determined',\n /** 允许微信使用日历的开关 */\n phoneCalendarAuthorized: 'not determined'\n }\n\n return info\n}\n\n/** 获取设备设置 */\nexport const getSystemInfoSync: typeof Taro.getSystemInfoSync = () => {\n const windowInfo = getWindowInfo()\n const systemSetting = getSystemSetting()\n const deviceInfo: Taro.getDeviceInfo.Result = getDeviceInfo()\n const appBaseInfo = getAppBaseInfo()\n const appAuthorizeSetting = getAppAuthorizeSetting()\n delete deviceInfo.abi\n\n const info: ReturnType<typeof Taro.getSystemInfoSync> = {\n ...windowInfo,\n ...systemSetting,\n ...deviceInfo,\n ...appBaseInfo,\n /** 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 */\n fontSizeSetting: NaN,\n /** 允许微信使用相册的开关(仅 iOS 有效) */\n albumAuthorized: appAuthorizeSetting.albumAuthorized === 'authorized',\n /** 允许微信使用摄像头的开关 */\n cameraAuthorized: appAuthorizeSetting.cameraAuthorized === 'authorized',\n /** 允许微信使用定位的开关 */\n locationAuthorized: appAuthorizeSetting.locationAuthorized === 'authorized',\n /** 允许微信使用麦克风的开关 */\n microphoneAuthorized: appAuthorizeSetting.microphoneAuthorized === 'authorized',\n /** 允许微信通知的开关 */\n notificationAuthorized: appAuthorizeSetting.notificationAuthorized === 'authorized',\n /** 允许微信通知带有提醒的开关(仅 iOS 有效) */\n notificationAlertAuthorized: appAuthorizeSetting.notificationAlertAuthorized === 'authorized',\n /** 允许微信通知带有标记的开关(仅 iOS 有效) */\n notificationBadgeAuthorized: appAuthorizeSetting.notificationBadgeAuthorized === 'authorized',\n /** 允许微信通知带有声音的开关(仅 iOS 有效) */\n notificationSoundAuthorized: appAuthorizeSetting.notificationSoundAuthorized === 'authorized',\n /** 允许微信使用日历的开关 */\n phoneCalendarAuthorized: appAuthorizeSetting.phoneCalendarAuthorized === 'authorized',\n /** `true` 表示模糊定位,`false` 表示精确定位,仅 iOS 支持 */\n locationReducedAccuracy: appAuthorizeSetting.locationReducedAccuracy,\n /** 小程序当前运行环境 */\n environment: ''\n }\n\n return info\n}\n\n/** 获取系统信息 */\nexport const getSystemInfoAsync: typeof Taro.getSystemInfoAsync = async (options = {}) => {\n const { success, fail, complete } = options\n const handle = new MethodHandler({ name: 'getSystemInfoAsync', success, fail, complete })\n\n try {\n const info = await getSystemInfoSync()\n return handle.success(info)\n } catch (error) {\n return handle.fail({\n errMsg: error\n })\n }\n}\n\n/** 获取系统信息 */\nexport const getSystemInfo: typeof Taro.getSystemInfo = async (options = {}) => {\n const { success, fail, complete } = options\n const handle = new MethodHandler({ name: 'getSystemInfo', success, fail, complete })\n\n try {\n const info = await getSystemInfoSync()\n return handle.success(info)\n } catch (error) {\n return handle.fail({\n errMsg: error\n })\n }\n}\n\nexport const getSkylineInfoSync = /* @__PURE__ */ temporarilyNotSupport('getSkylineInfoSync')\n\nexport const getSkylineInfo = /* @__PURE__ */ temporarilyNotSupport('getSkylineInfo')\n\nexport const getRendererUserAgent = /* @__PURE__ */ temporarilyNotSupport('getRendererUserAgent')\n"],"names":[],"mappings":";;;;;AAMA;AACa,MAAA,0BAA0B,mBAAmB,qBAAqB,CAAC,4BAA4B,EAAC;AAE7G;AACa,MAAA,uBAAuB,mBAAmB,qBAAqB,CAAC,yBAAyB,EAAC;AAEvG;AACO,MAAM,aAAa,GAA8B,MAAK;AAC3D,IAAA,MAAM,IAAI,GAA0C;;QAElD,UAAU,EAAE,MAAM,CAAC,gBAAgB;;AAEnC,QAAA,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;;AAEhC,QAAA,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;;AAElC,QAAA,WAAW,EAAE,Q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.onUnhandledRejection;
|
|
3
3
|
declare const onThemeChange: typeof Taro.onThemeChange;
|
|
4
4
|
declare const onPageNotFound: typeof Taro.onPageNotFound;
|
|
5
|
+
declare const onLazyLoadError: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
5
6
|
declare const onError: typeof Taro.onError;
|
|
6
7
|
declare const onAudioInterruptionEnd: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
7
8
|
declare const onAudioInterruptionBegin: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
@@ -10,9 +11,10 @@ declare const onAppHide: typeof Taro.onAppHide;
|
|
|
10
11
|
declare const offUnhandledRejection: typeof Taro.offUnhandledRejection;
|
|
11
12
|
declare const offThemeChange: typeof Taro.offThemeChange;
|
|
12
13
|
declare const offPageNotFound: typeof Taro.offPageNotFound;
|
|
14
|
+
declare const offLazyLoadError: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
13
15
|
declare const offError: typeof Taro.offError;
|
|
14
16
|
declare const offAudioInterruptionEnd: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
15
17
|
declare const offAudioInterruptionBegin: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
16
18
|
declare const offAppShow: typeof Taro.offAppShow;
|
|
17
19
|
declare const offAppHide: typeof Taro.offAppHide;
|
|
18
|
-
export { onUnhandledRejection, onThemeChange, onPageNotFound, onError, onAudioInterruptionEnd, onAudioInterruptionBegin, onAppShow, onAppHide, offUnhandledRejection, offThemeChange, offPageNotFound, offError, offAudioInterruptionEnd, offAudioInterruptionBegin, offAppShow, offAppHide };
|
|
20
|
+
export { onUnhandledRejection, onThemeChange, onPageNotFound, onLazyLoadError, onError, onAudioInterruptionEnd, onAudioInterruptionBegin, onAppShow, onAppHide, offUnhandledRejection, offThemeChange, offPageNotFound, offLazyLoadError, offError, offAudioInterruptionEnd, offAudioInterruptionBegin, offAppShow, offAppHide };
|
|
@@ -74,6 +74,7 @@ const onPageNotFound = callback => {
|
|
|
74
74
|
Taro.eventCenter.on('__taroRouterNotFound', pageNotFoundListener);
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
+
const onLazyLoadError = /* @__PURE__ */ temporarilyNotSupport('onLazyLoadError');
|
|
77
78
|
const onError = callback => {
|
|
78
79
|
errorCallbackManager.add(callback);
|
|
79
80
|
if (errorCallbackManager.count() === 1) {
|
|
@@ -116,6 +117,7 @@ const offPageNotFound = callback => {
|
|
|
116
117
|
Taro.eventCenter.off('__taroRouterNotFound', pageNotFoundListener);
|
|
117
118
|
}
|
|
118
119
|
};
|
|
120
|
+
const offLazyLoadError = /* @__PURE__ */ temporarilyNotSupport('offLazyLoadError');
|
|
119
121
|
const offError = callback => {
|
|
120
122
|
errorCallbackManager.remove(callback);
|
|
121
123
|
if (errorCallbackManager.count() === 0) {
|
|
@@ -137,5 +139,5 @@ const offAppHide = callback => {
|
|
|
137
139
|
}
|
|
138
140
|
};
|
|
139
141
|
|
|
140
|
-
export { offAppHide, offAppShow, offAudioInterruptionBegin, offAudioInterruptionEnd, offError, offPageNotFound, offThemeChange, offUnhandledRejection, onAppHide, onAppShow, onAudioInterruptionBegin, onAudioInterruptionEnd, onError, onPageNotFound, onThemeChange, onUnhandledRejection };
|
|
142
|
+
export { offAppHide, offAppShow, offAudioInterruptionBegin, offAudioInterruptionEnd, offError, offLazyLoadError, offPageNotFound, offThemeChange, offUnhandledRejection, onAppHide, onAppShow, onAudioInterruptionBegin, onAudioInterruptionEnd, onError, onLazyLoadError, onPageNotFound, onThemeChange, onUnhandledRejection };
|
|
141
143
|
//# sourceMappingURL=app-event.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-event.js","sources":["../../../../src/api/base/weapp/app-event.ts"],"sourcesContent":["import Taro from '@tarojs/api'\nimport isNil from 'lodash-es/isNil'\nimport { parse } from 'query-string'\n\nimport { temporarilyNotSupport } from '../../../utils'\nimport { CallbackManager } from '../../../utils/handler'\n\nconst unhandledRejectionCallbackManager = new CallbackManager<[Taro.onUnhandledRejection.Result]>()\nconst themeChangeCallbackManager = new CallbackManager<[Taro.onThemeChange.Result]>()\nconst pageNotFoundCallbackManager = new CallbackManager<[Taro.onPageNotFound.Result]>()\nconst errorCallbackManager = new CallbackManager<Parameters<Taro.onError.Callback>>()\nconst appShowCallbackManager = new CallbackManager<[Taro.onAppShow.CallbackResult]>()\nconst appHideCallbackManager = new CallbackManager<[Taro.onAppShow.CallbackResult]>()\n\nconst unhandledRejectionListener = (res: PromiseRejectionEvent) => {\n unhandledRejectionCallbackManager.trigger(res)\n}\n\nlet themeMatchMedia: MediaQueryList | null = null\nconst themeChangeListener = (res: MediaQueryListEvent) => {\n themeChangeCallbackManager.trigger({\n theme: res.matches ? 'dark' : 'light'\n })\n}\n\nconst pageNotFoundListener = (res: Taro.onPageNotFound.Result) => {\n pageNotFoundCallbackManager.trigger(res)\n}\n\nconst errorListener = (res: ErrorEvent) => {\n // @ts-ignore\n errorCallbackManager.trigger(res.stack || res.message || res)\n}\n\nconst getApp = () => {\n const path = Taro.Current.page?.path\n return {\n /** 小程序切前台的路径 */\n path: path?.substring(0, path.indexOf('?')) || '',\n /** 小程序切前台的 query 参数 */\n query: parse(location.search),\n /** 来源信息。 */\n referrerInfo: {},\n /** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */\n scene: 0,\n /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */\n shareTicket: ''\n }\n}\n\nconst appShowListener = () => {\n if (document.visibilityState !== 'hidden') {\n appShowCallbackManager.trigger(getApp())\n }\n}\n\nconst appHideListener = () => {\n if (document.visibilityState === 'hidden') {\n appHideCallbackManager.trigger(getApp())\n }\n}\n\n// 应用级事件\nexport const onUnhandledRejection: typeof Taro.onUnhandledRejection = callback => {\n unhandledRejectionCallbackManager.add(callback)\n if (unhandledRejectionCallbackManager.count() === 1) {\n window.addEventListener('unhandledrejection', unhandledRejectionListener)\n }\n}\n\nexport const onThemeChange: typeof Taro.onThemeChange = callback => {\n themeChangeCallbackManager.add(callback)\n if (themeChangeCallbackManager.count() === 1) {\n if (isNil(themeMatchMedia)) {\n themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)')\n }\n themeMatchMedia.addEventListener('change', themeChangeListener)\n }\n}\n\nexport const onPageNotFound: typeof Taro.onPageNotFound = callback => {\n pageNotFoundCallbackManager.add(callback)\n if (pageNotFoundCallbackManager.count() === 1) {\n Taro.eventCenter.on('__taroRouterNotFound', pageNotFoundListener)\n }\n}\n\nexport const onError: typeof Taro.onError = callback => {\n errorCallbackManager.add(callback)\n if (errorCallbackManager.count() === 1) {\n window.addEventListener('error', errorListener)\n }\n}\n\nexport const onAudioInterruptionEnd = /* @__PURE__ */ temporarilyNotSupport('onAudioInterruptionEnd')\nexport const onAudioInterruptionBegin = /* @__PURE__ */ temporarilyNotSupport('onAudioInterruptionBegin')\n\nexport const onAppShow: typeof Taro.onAppShow = callback => {\n appShowCallbackManager.add(callback)\n if (appShowCallbackManager.count() === 1) {\n window.addEventListener('visibilitychange', appShowListener)\n }\n}\n\nexport const onAppHide: typeof Taro.onAppHide = callback => {\n appHideCallbackManager.add(callback)\n if (appHideCallbackManager.count() === 1) {\n window.addEventListener('visibilitychange', appHideListener)\n }\n}\n\nexport const offUnhandledRejection: typeof Taro.offUnhandledRejection = callback => {\n unhandledRejectionCallbackManager.remove(callback)\n if (unhandledRejectionCallbackManager.count() === 0) {\n window.removeEventListener('unhandledrejection', unhandledRejectionListener)\n }\n}\n\nexport const offThemeChange: typeof Taro.offThemeChange = callback => {\n themeChangeCallbackManager.remove(callback)\n if (themeChangeCallbackManager.count() === 0) {\n if (isNil(themeMatchMedia)) {\n themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)')\n }\n themeMatchMedia.removeEventListener('change', themeChangeListener)\n themeMatchMedia = null\n }\n}\n\nexport const offPageNotFound: typeof Taro.offPageNotFound = callback => {\n pageNotFoundCallbackManager.remove(callback)\n if (pageNotFoundCallbackManager.count() === 0) {\n Taro.eventCenter.off('__taroRouterNotFound', pageNotFoundListener)\n }\n}\n\nexport const offError: typeof Taro.offError = callback => {\n errorCallbackManager.remove(callback)\n if (errorCallbackManager.count() === 0) {\n window.removeEventListener('error', errorListener)\n }\n}\n\nexport const offAudioInterruptionEnd = /* @__PURE__ */ temporarilyNotSupport('offAudioInterruptionEnd')\nexport const offAudioInterruptionBegin = /* @__PURE__ */ temporarilyNotSupport('offAudioInterruptionBegin')\n\nexport const offAppShow: typeof Taro.offAppShow = callback => {\n appShowCallbackManager.remove(callback)\n if (appShowCallbackManager.count() === 0) {\n window.removeEventListener('visibilitychange', appShowListener)\n }\n}\n\nexport const offAppHide: typeof Taro.offAppHide = callback => {\n appHideCallbackManager.remove(callback)\n if (appHideCallbackManager.count() === 0) {\n window.removeEventListener('visibilitychange', appHideListener)\n }\n}\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,iCAAiC,GAAG,IAAI,eAAe,EAAsC,CAAA;AACnG,MAAM,0BAA0B,GAAG,IAAI,eAAe,EAA+B,CAAA;AACrF,MAAM,2BAA2B,GAAG,IAAI,eAAe,EAAgC,CAAA;AACvF,MAAM,oBAAoB,GAAG,IAAI,eAAe,EAAqC,CAAA;AACrF,MAAM,sBAAsB,GAAG,IAAI,eAAe,EAAmC,CAAA;AACrF,MAAM,sBAAsB,GAAG,IAAI,eAAe,EAAmC,CAAA;AAErF,MAAM,0BAA0B,GAAG,CAAC,GAA0B,KAAI;AAChE,IAAA,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Q,CAAC,CAAA;AACvC,IAAA,IAAI,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;AACxC,QAAA,MAAM,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAA;AAChE,KAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"app-event.js","sources":["../../../../src/api/base/weapp/app-event.ts"],"sourcesContent":["import Taro from '@tarojs/api'\nimport isNil from 'lodash-es/isNil'\nimport { parse } from 'query-string'\n\nimport { temporarilyNotSupport } from '../../../utils'\nimport { CallbackManager } from '../../../utils/handler'\n\nconst unhandledRejectionCallbackManager = new CallbackManager<[Taro.onUnhandledRejection.Result]>()\nconst themeChangeCallbackManager = new CallbackManager<[Taro.onThemeChange.Result]>()\nconst pageNotFoundCallbackManager = new CallbackManager<[Taro.onPageNotFound.Result]>()\nconst errorCallbackManager = new CallbackManager<Parameters<Taro.onError.Callback>>()\nconst appShowCallbackManager = new CallbackManager<[Taro.onAppShow.CallbackResult]>()\nconst appHideCallbackManager = new CallbackManager<[Taro.onAppShow.CallbackResult]>()\n\nconst unhandledRejectionListener = (res: PromiseRejectionEvent) => {\n unhandledRejectionCallbackManager.trigger(res)\n}\n\nlet themeMatchMedia: MediaQueryList | null = null\nconst themeChangeListener = (res: MediaQueryListEvent) => {\n themeChangeCallbackManager.trigger({\n theme: res.matches ? 'dark' : 'light'\n })\n}\n\nconst pageNotFoundListener = (res: Taro.onPageNotFound.Result) => {\n pageNotFoundCallbackManager.trigger(res)\n}\n\nconst errorListener = (res: ErrorEvent) => {\n // @ts-ignore\n errorCallbackManager.trigger(res.stack || res.message || res)\n}\n\nconst getApp = () => {\n const path = Taro.Current.page?.path\n return {\n /** 小程序切前台的路径 */\n path: path?.substring(0, path.indexOf('?')) || '',\n /** 小程序切前台的 query 参数 */\n query: parse(location.search),\n /** 来源信息。 */\n referrerInfo: {},\n /** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */\n scene: 0,\n /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */\n shareTicket: ''\n }\n}\n\nconst appShowListener = () => {\n if (document.visibilityState !== 'hidden') {\n appShowCallbackManager.trigger(getApp())\n }\n}\n\nconst appHideListener = () => {\n if (document.visibilityState === 'hidden') {\n appHideCallbackManager.trigger(getApp())\n }\n}\n\n// 应用级事件\nexport const onUnhandledRejection: typeof Taro.onUnhandledRejection = callback => {\n unhandledRejectionCallbackManager.add(callback)\n if (unhandledRejectionCallbackManager.count() === 1) {\n window.addEventListener('unhandledrejection', unhandledRejectionListener)\n }\n}\n\nexport const onThemeChange: typeof Taro.onThemeChange = callback => {\n themeChangeCallbackManager.add(callback)\n if (themeChangeCallbackManager.count() === 1) {\n if (isNil(themeMatchMedia)) {\n themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)')\n }\n themeMatchMedia.addEventListener('change', themeChangeListener)\n }\n}\n\nexport const onPageNotFound: typeof Taro.onPageNotFound = callback => {\n pageNotFoundCallbackManager.add(callback)\n if (pageNotFoundCallbackManager.count() === 1) {\n Taro.eventCenter.on('__taroRouterNotFound', pageNotFoundListener)\n }\n}\n\nexport const onLazyLoadError = /* @__PURE__ */ temporarilyNotSupport('onLazyLoadError')\n\nexport const onError: typeof Taro.onError = callback => {\n errorCallbackManager.add(callback)\n if (errorCallbackManager.count() === 1) {\n window.addEventListener('error', errorListener)\n }\n}\n\nexport const onAudioInterruptionEnd = /* @__PURE__ */ temporarilyNotSupport('onAudioInterruptionEnd')\nexport const onAudioInterruptionBegin = /* @__PURE__ */ temporarilyNotSupport('onAudioInterruptionBegin')\n\nexport const onAppShow: typeof Taro.onAppShow = callback => {\n appShowCallbackManager.add(callback)\n if (appShowCallbackManager.count() === 1) {\n window.addEventListener('visibilitychange', appShowListener)\n }\n}\n\nexport const onAppHide: typeof Taro.onAppHide = callback => {\n appHideCallbackManager.add(callback)\n if (appHideCallbackManager.count() === 1) {\n window.addEventListener('visibilitychange', appHideListener)\n }\n}\n\nexport const offUnhandledRejection: typeof Taro.offUnhandledRejection = callback => {\n unhandledRejectionCallbackManager.remove(callback)\n if (unhandledRejectionCallbackManager.count() === 0) {\n window.removeEventListener('unhandledrejection', unhandledRejectionListener)\n }\n}\n\nexport const offThemeChange: typeof Taro.offThemeChange = callback => {\n themeChangeCallbackManager.remove(callback)\n if (themeChangeCallbackManager.count() === 0) {\n if (isNil(themeMatchMedia)) {\n themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)')\n }\n themeMatchMedia.removeEventListener('change', themeChangeListener)\n themeMatchMedia = null\n }\n}\n\nexport const offPageNotFound: typeof Taro.offPageNotFound = callback => {\n pageNotFoundCallbackManager.remove(callback)\n if (pageNotFoundCallbackManager.count() === 0) {\n Taro.eventCenter.off('__taroRouterNotFound', pageNotFoundListener)\n }\n}\n\nexport const offLazyLoadError = /* @__PURE__ */ temporarilyNotSupport('offLazyLoadError')\n\nexport const offError: typeof Taro.offError = callback => {\n errorCallbackManager.remove(callback)\n if (errorCallbackManager.count() === 0) {\n window.removeEventListener('error', errorListener)\n }\n}\n\nexport const offAudioInterruptionEnd = /* @__PURE__ */ temporarilyNotSupport('offAudioInterruptionEnd')\nexport const offAudioInterruptionBegin = /* @__PURE__ */ temporarilyNotSupport('offAudioInterruptionBegin')\n\nexport const offAppShow: typeof Taro.offAppShow = callback => {\n appShowCallbackManager.remove(callback)\n if (appShowCallbackManager.count() === 0) {\n window.removeEventListener('visibilitychange', appShowListener)\n }\n}\n\nexport const offAppHide: typeof Taro.offAppHide = callback => {\n appHideCallbackManager.remove(callback)\n if (appHideCallbackManager.count() === 0) {\n window.removeEventListener('visibilitychange', appHideListener)\n }\n}\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,iCAAiC,GAAG,IAAI,eAAe,EAAsC,CAAA;AACnG,MAAM,0BAA0B,GAAG,IAAI,eAAe,EAA+B,CAAA;AACrF,MAAM,2BAA2B,GAAG,IAAI,eAAe,EAAg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AAE9F,MAAA,UAAU,GAA2B,QAAQ,IAAG;AAC3D,IAAA,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACvC,IAAA,IAAI,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;AACxC,QAAA,MAAM,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAA;AAChE,KAAA;AACH,EAAC;AAEY,MAAA,UAAU,GAA2B,QAAQ,IAAG;AAC3D,IAAA,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACvC,IAAA,IAAI,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;AACxC,QAAA,MAAM,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAA;AAChE,KAAA;AACH;;;;"}
|
package/dist/api/device/index.js
CHANGED
|
@@ -18,7 +18,8 @@ export { getLocalIPAddress, getNetworkType, offNetworkStatusChange, offNetworkWe
|
|
|
18
18
|
export { getHCEState, getNFCAdapter, offHCEMessage, onHCEMessage, sendHCEMessage, startHCE, stopHCE } from './nfc.js';
|
|
19
19
|
export { makePhoneCall } from './phone.js';
|
|
20
20
|
export { scanCode } from './scan.js';
|
|
21
|
-
export { getScreenBrightness, offUserCaptureScreen, onUserCaptureScreen, setKeepScreenOn, setScreenBrightness, setVisualEffectOnCapture } from './screen.js';
|
|
21
|
+
export { getScreenBrightness, getScreenRecordingState, offScreenRecordingStateChanged, offUserCaptureScreen, onScreenRecordingStateChanged, onUserCaptureScreen, setKeepScreenOn, setScreenBrightness, setVisualEffectOnCapture } from './screen.js';
|
|
22
|
+
export { sendSms } from './sms.js';
|
|
22
23
|
export { vibrateLong, vibrateShort } from './vibrate.js';
|
|
23
24
|
export { connectWifi, getConnectedWifi, getWifiList, offGetWifiList, offWifiConnected, offWifiConnectedWithPartialInfo, onGetWifiList, onWifiConnected, onWifiConnectedWithPartialInfo, setWifiList, startWifi, stopWifi } from './wifi.js';
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -4,4 +4,7 @@ declare const setKeepScreenOn: (option?: {}, ...args: any[]) => Promise<Partial<
|
|
|
4
4
|
declare const onUserCaptureScreen: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
5
5
|
declare const offUserCaptureScreen: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
6
6
|
declare const getScreenBrightness: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
7
|
-
|
|
7
|
+
declare const onScreenRecordingStateChanged: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
8
|
+
declare const offScreenRecordingStateChanged: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
9
|
+
declare const getScreenRecordingState: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
10
|
+
export { setVisualEffectOnCapture, setScreenBrightness, setKeepScreenOn, onUserCaptureScreen, offUserCaptureScreen, getScreenBrightness, onScreenRecordingStateChanged, offScreenRecordingStateChanged, getScreenRecordingState };
|
|
@@ -7,6 +7,9 @@ const setKeepScreenOn = /* @__PURE__ */ temporarilyNotSupport('setKeepScreenOn')
|
|
|
7
7
|
const onUserCaptureScreen = /* @__PURE__ */ temporarilyNotSupport('onUserCaptureScreen');
|
|
8
8
|
const offUserCaptureScreen = /* @__PURE__ */ temporarilyNotSupport('offUserCaptureScreen');
|
|
9
9
|
const getScreenBrightness = /* @__PURE__ */ temporarilyNotSupport('getScreenBrightness');
|
|
10
|
+
const onScreenRecordingStateChanged = /* @__PURE__ */ temporarilyNotSupport('onScreenRecordingStateChanged');
|
|
11
|
+
const offScreenRecordingStateChanged = /* @__PURE__ */ temporarilyNotSupport('offScreenRecordingStateChanged');
|
|
12
|
+
const getScreenRecordingState = /* @__PURE__ */ temporarilyNotSupport('getScreenRecordingState');
|
|
10
13
|
|
|
11
|
-
export { getScreenBrightness, offUserCaptureScreen, onUserCaptureScreen, setKeepScreenOn, setScreenBrightness, setVisualEffectOnCapture };
|
|
14
|
+
export { getScreenBrightness, getScreenRecordingState, offScreenRecordingStateChanged, offUserCaptureScreen, onScreenRecordingStateChanged, onUserCaptureScreen, setKeepScreenOn, setScreenBrightness, setVisualEffectOnCapture };
|
|
12
15
|
//# sourceMappingURL=screen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen.js","sources":["../../../src/api/device/screen.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 屏幕\nexport const setVisualEffectOnCapture = /* @__PURE__ */ temporarilyNotSupport('setVisualEffectOnCapture')\nexport const setScreenBrightness = /* @__PURE__ */ temporarilyNotSupport('setScreenBrightness')\nexport const setKeepScreenOn = /* @__PURE__ */ temporarilyNotSupport('setKeepScreenOn')\nexport const onUserCaptureScreen = /* @__PURE__ */ temporarilyNotSupport('onUserCaptureScreen')\nexport const offUserCaptureScreen = /* @__PURE__ */ temporarilyNotSupport('offUserCaptureScreen')\nexport const getScreenBrightness = /* @__PURE__ */ temporarilyNotSupport('getScreenBrightness')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,wBAAwB,mBAAmB,qBAAqB,CAAC,0BAA0B,EAAC;AAC5F,MAAA,mBAAmB,mBAAmB,qBAAqB,CAAC,qBAAqB,EAAC;AAClF,MAAA,eAAe,mBAAmB,qBAAqB,CAAC,iBAAiB,EAAC;AAC1E,MAAA,mBAAmB,mBAAmB,qBAAqB,CAAC,qBAAqB,EAAC;AAClF,MAAA,oBAAoB,mBAAmB,qBAAqB,CAAC,sBAAsB,EAAC;AACpF,MAAA,mBAAmB,mBAAmB,qBAAqB,CAAC,qBAAqB;;;;"}
|
|
1
|
+
{"version":3,"file":"screen.js","sources":["../../../src/api/device/screen.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 屏幕\nexport const setVisualEffectOnCapture = /* @__PURE__ */ temporarilyNotSupport('setVisualEffectOnCapture')\nexport const setScreenBrightness = /* @__PURE__ */ temporarilyNotSupport('setScreenBrightness')\nexport const setKeepScreenOn = /* @__PURE__ */ temporarilyNotSupport('setKeepScreenOn')\nexport const onUserCaptureScreen = /* @__PURE__ */ temporarilyNotSupport('onUserCaptureScreen')\nexport const offUserCaptureScreen = /* @__PURE__ */ temporarilyNotSupport('offUserCaptureScreen')\nexport const getScreenBrightness = /* @__PURE__ */ temporarilyNotSupport('getScreenBrightness')\nexport const onScreenRecordingStateChanged = /* @__PURE__ */ temporarilyNotSupport('onScreenRecordingStateChanged')\nexport const offScreenRecordingStateChanged = /* @__PURE__ */ temporarilyNotSupport('offScreenRecordingStateChanged')\nexport const getScreenRecordingState = /* @__PURE__ */ temporarilyNotSupport('getScreenRecordingState')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,wBAAwB,mBAAmB,qBAAqB,CAAC,0BAA0B,EAAC;AAC5F,MAAA,mBAAmB,mBAAmB,qBAAqB,CAAC,qBAAqB,EAAC;AAClF,MAAA,eAAe,mBAAmB,qBAAqB,CAAC,iBAAiB,EAAC;AAC1E,MAAA,mBAAmB,mBAAmB,qBAAqB,CAAC,qBAAqB,EAAC;AAClF,MAAA,oBAAoB,mBAAmB,qBAAqB,CAAC,sBAAsB,EAAC;AACpF,MAAA,mBAAmB,mBAAmB,qBAAqB,CAAC,qBAAqB,EAAC;AAClF,MAAA,6BAA6B,mBAAmB,qBAAqB,CAAC,+BAA+B,EAAC;AACtG,MAAA,8BAA8B,mBAAmB,qBAAqB,CAAC,gCAAgC,EAAC;AACxG,MAAA,uBAAuB,mBAAmB,qBAAqB,CAAC,yBAAyB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sms.js","sources":["../../../src/api/device/sms.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 短信\nexport const sendSms = /* @__PURE__ */ temporarilyNotSupport('sendSms')"],"names":[],"mappings":";;AAEA;AACa,MAAA,OAAO,mBAAmB,qBAAqB,CAAC,SAAS;;;;"}
|
package/dist/api/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createInterstitialAd, createRewardedVideoAd } from './ad/index.js';
|
|
2
2
|
import './ai/index.js';
|
|
3
|
-
export { getOpenUserInfo } from './alipay/index.js';
|
|
3
|
+
export { getOpenUserInfo, tradePay } from './alipay/index.js';
|
|
4
4
|
export { arrayBufferToBase64, base64ToArrayBuffer, env } from './base/index.js';
|
|
5
5
|
export { createOffscreenCanvas } from './canvas/index.js';
|
|
6
6
|
export { cloud } from './cloud/index.js';
|
|
@@ -14,23 +14,24 @@ import './media/index.js';
|
|
|
14
14
|
export { exitMiniProgram, navigateBackMiniProgram, navigateToMiniProgram, openBusinessView, openEmbeddedMiniProgram } from './navigate/index.js';
|
|
15
15
|
import './network/index.js';
|
|
16
16
|
import './open-api/index.js';
|
|
17
|
-
export { requestOrderPayment, requestPayment } from './payment/index.js';
|
|
17
|
+
export { requestOrderPayment, requestPayment, requestPluginPayment } from './payment/index.js';
|
|
18
18
|
export { openQzonePublish } from './qq/index.js';
|
|
19
19
|
import './route/index.js';
|
|
20
20
|
export { authPrivateMessage, getShareInfo, hideShareMenu, offCopyUrl, onCopyUrl, shareFileMessage, shareVideoMessage, showShareImageMenu, showShareMenu, updateShareMenu } from './share/index.js';
|
|
21
|
-
export { clearStorage, clearStorageSync, createBufferURL, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, removeStorage, removeStorageSync, revokeBufferURL, setStorage, setStorageSync } from './storage/index.js';
|
|
21
|
+
export { batchGetStorage, batchGetStorageSync, batchSetStorage, batchSetStorageSync, clearStorage, clearStorageSync, createBufferURL, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, removeStorage, removeStorageSync, revokeBufferURL, setStorage, setStorageSync } from './storage/index.js';
|
|
22
22
|
export { advancedGeneralIdentify, animalClassify, carClassify, dishClassify, getSwanId, imageAudit, logoClassify, navigateBackSmartProgram, navigateToSmartGameProgram, navigateToSmartProgram, objectDetectIdentify, ocrBankCard, ocrDrivingLicense, ocrIdCard, ocrVehicleLicense, plantClassify, preloadSubPackage, requestPolymerPayment, setPageInfo, textReview, textToAudio } from './swan/index.js';
|
|
23
23
|
import './ui/index.js';
|
|
24
24
|
export { createWorker } from './worker/index.js';
|
|
25
25
|
export { createIntersectionObserver, createMediaQueryObserver, createSelectorQuery } from './wxml/index.js';
|
|
26
26
|
export { faceDetect, initFaceDetect, stopFaceDetect } from './ai/facial.js';
|
|
27
|
+
export { createInferenceSession, getInferenceEnvInfo } from './ai/inference.js';
|
|
27
28
|
export { createVKSession, isVKSupport } from './ai/visual.js';
|
|
28
29
|
export { getUserCryptoManager } from './base/crypto.js';
|
|
29
30
|
export { getLogManager, getRealtimeLogManager, setEnableDebug } from './base/debug.js';
|
|
30
|
-
export { getPerformance, reportPerformance } from './base/performance.js';
|
|
31
|
-
export { getAppAuthorizeSetting, getAppBaseInfo, getDeviceInfo, getSystemInfo, getSystemInfoAsync, getSystemInfoSync, getSystemSetting, getWindowInfo, openAppAuthorizeSetting, openSystemBluetoothSetting } from './base/system.js';
|
|
31
|
+
export { getPerformance, preloadAssets, preloadSkylineView, preloadWebview, reportPerformance } from './base/performance.js';
|
|
32
|
+
export { getAppAuthorizeSetting, getAppBaseInfo, getDeviceInfo, getRendererUserAgent, getSkylineInfo, getSkylineInfoSync, getSystemInfo, getSystemInfoAsync, getSystemInfoSync, getSystemSetting, getWindowInfo, openAppAuthorizeSetting, openSystemBluetoothSetting } from './base/system.js';
|
|
32
33
|
export { getUpdateManager, updateWeChatApp } from './base/update.js';
|
|
33
|
-
export { offAppHide, offAppShow, offAudioInterruptionBegin, offAudioInterruptionEnd, offError, offPageNotFound, offThemeChange, offUnhandledRejection, onAppHide, onAppShow, onAudioInterruptionBegin, onAudioInterruptionEnd, onError, onPageNotFound, onThemeChange, onUnhandledRejection } from './base/weapp/app-event.js';
|
|
34
|
+
export { offAppHide, offAppShow, offAudioInterruptionBegin, offAudioInterruptionEnd, offError, offLazyLoadError, offPageNotFound, offThemeChange, offUnhandledRejection, onAppHide, onAppShow, onAudioInterruptionBegin, onAudioInterruptionEnd, onError, onLazyLoadError, onPageNotFound, onThemeChange, onUnhandledRejection } from './base/weapp/app-event.js';
|
|
34
35
|
export { getEnterOptionsSync, getLaunchOptionsSync } from './base/weapp/life-cycle.js';
|
|
35
36
|
export { createCanvasContext } from './canvas/createCanvasContext.js';
|
|
36
37
|
export { canvasToTempFilePath } from './canvas/canvasToTempFilePath.js';
|
|
@@ -56,7 +57,8 @@ export { getLocalIPAddress, getNetworkType, offNetworkStatusChange, offNetworkWe
|
|
|
56
57
|
export { getHCEState, getNFCAdapter, offHCEMessage, onHCEMessage, sendHCEMessage, startHCE, stopHCE } from './device/nfc.js';
|
|
57
58
|
export { makePhoneCall } from './device/phone.js';
|
|
58
59
|
export { scanCode } from './device/scan.js';
|
|
59
|
-
export { getScreenBrightness, offUserCaptureScreen, onUserCaptureScreen, setKeepScreenOn, setScreenBrightness, setVisualEffectOnCapture } from './device/screen.js';
|
|
60
|
+
export { getScreenBrightness, getScreenRecordingState, offScreenRecordingStateChanged, offUserCaptureScreen, onScreenRecordingStateChanged, onUserCaptureScreen, setKeepScreenOn, setScreenBrightness, setVisualEffectOnCapture } from './device/screen.js';
|
|
61
|
+
export { sendSms } from './device/sms.js';
|
|
60
62
|
export { vibrateLong, vibrateShort } from './device/vibrate.js';
|
|
61
63
|
export { connectWifi, getConnectedWifi, getWifiList, offGetWifiList, offWifiConnected, offWifiConnectedWithPartialInfo, onGetWifiList, onWifiConnected, onWifiConnectedWithPartialInfo, setWifiList, startWifi, stopWifi } from './device/wifi.js';
|
|
62
64
|
export { getCurrentPages, navigateBack, navigateTo, reLaunch, redirectTo, switchTab } from '@tarojs/router';
|
|
@@ -81,7 +83,7 @@ export { chooseVideo } from './media/video/chooseVideo.js';
|
|
|
81
83
|
export { compressVideo, createVideoContext, openVideoEditor } from './media/video/index.js';
|
|
82
84
|
export { createVideoDecoder } from './media/video-decoder.js';
|
|
83
85
|
export { createMediaContainer } from './media/video-processing.js';
|
|
84
|
-
export { exitVoIPChat, joinVoIPChat, offVoIPChatInterrupted, offVoIPChatMembersChanged, offVoIPChatStateChanged, offVoIPVideoMembersChanged, onVoIPChatInterrupted, onVoIPChatMembersChanged, onVoIPChatSpeakersChanged, onVoIPChatStateChanged, onVoIPVideoMembersChanged, setEnable1v1Chat, subscribeVoIPVideoMembers, updateVoIPChatMuteConfig } from './media/voip.js';
|
|
86
|
+
export { exitVoIPChat, join1v1Chat, joinVoIPChat, offVoIPChatInterrupted, offVoIPChatMembersChanged, offVoIPChatSpeakersChanged, offVoIPChatStateChanged, offVoIPVideoMembersChanged, onVoIPChatInterrupted, onVoIPChatMembersChanged, onVoIPChatSpeakersChanged, onVoIPChatStateChanged, onVoIPVideoMembersChanged, setEnable1v1Chat, subscribeVoIPVideoMembers, updateVoIPChatMuteConfig } from './media/voip.js';
|
|
85
87
|
export { downloadFile } from './network/download.js';
|
|
86
88
|
export { offLocalServiceDiscoveryStop, offLocalServiceFound, offLocalServiceLost, offLocalServiceResolveFail, onLocalServiceDiscoveryStop, onLocalServiceFound, onLocalServiceLost, onLocalServiceResolveFail, startLocalServiceDiscovery, stopLocalServiceDiscovery } from './network/mdns.js';
|
|
87
89
|
export { addInterceptor, cleanInterceptors, request } from './network/request/index.js';
|
|
@@ -93,8 +95,9 @@ export { getAccountInfoSync } from './open-api/account.js';
|
|
|
93
95
|
export { chooseAddress } from './open-api/address.js';
|
|
94
96
|
export { authorize, authorizeForMiniProgram } from './open-api/authorize.js';
|
|
95
97
|
export { addCard, openCard } from './open-api/card.js';
|
|
96
|
-
export { getChannelsLiveInfo, getChannelsLiveNoticeInfo, openChannelsActivity, openChannelsEvent, openChannelsLive, reserveChannelsLive } from './open-api/channels-live.js';
|
|
98
|
+
export { getChannelsLiveInfo, getChannelsLiveNoticeInfo, getChannelsShareKey, openChannelsActivity, openChannelsEvent, openChannelsLive, openChannelsUserProfile, reserveChannelsLive } from './open-api/channels-live.js';
|
|
97
99
|
export { openCustomerServiceChat } from './open-api/customer-service.js';
|
|
100
|
+
export { getDeviceVoIPList, requestDeviceVoIP } from './open-api/device-voip.js';
|
|
98
101
|
export { checkIsSupportFacialRecognition, faceVerifyForPay, startFacialRecognitionVerify, startFacialRecognitionVerifyAndUploadVideo } from './open-api/facial.js';
|
|
99
102
|
export { addFileToFavorites, addVideoToFavorites, checkIsAddedToMyMiniProgram } from './open-api/favorites.js';
|
|
100
103
|
export { getGroupEnterInfo } from './open-api/group.js';
|
|
@@ -108,6 +111,7 @@ export { requestSubscribeDeviceMessage, requestSubscribeMessage } from './open-a
|
|
|
108
111
|
export { getUserInfo, getUserProfile } from './open-api/user-info.js';
|
|
109
112
|
export { getWeRunData, shareToWeRun } from './open-api/werun.js';
|
|
110
113
|
export { getBackgroundFetchData, getBackgroundFetchToken, onBackgroundFetchData, setBackgroundFetchToken } from './storage/background-fetch.js';
|
|
114
|
+
export { createCacheManager } from './storage/cache-manager.js';
|
|
111
115
|
export { createAnimation } from './ui/animation/index.js';
|
|
112
116
|
export { setBackgroundColor, setBackgroundTextStyle } from './ui/background.js';
|
|
113
117
|
export { nextTick } from './ui/custom-component.js';
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -46,7 +46,8 @@ const previewImage = (options) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
46
46
|
const handle = new MethodHandler({ name: 'previewImage', success, fail, complete });
|
|
47
47
|
const container = document.createElement('div');
|
|
48
48
|
container.classList.add('preview-image');
|
|
49
|
-
container.style.cssText =
|
|
49
|
+
container.style.cssText =
|
|
50
|
+
'position:fixed;top:0;left:0;z-index:1050;width:100%;height:100%;overflow:hidden;outline:0;background-color:#111;';
|
|
50
51
|
container.addEventListener('click', () => {
|
|
51
52
|
container.remove();
|
|
52
53
|
});
|
|
@@ -57,19 +58,18 @@ const previewImage = (options) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
57
58
|
swiper.zoom = true;
|
|
58
59
|
let children = [];
|
|
59
60
|
try {
|
|
60
|
-
children = yield Promise.all(urls.map(e => loadImage(e, fail)));
|
|
61
|
+
children = yield Promise.all(urls.map((e) => loadImage(e, fail)));
|
|
61
62
|
}
|
|
62
63
|
catch (error) {
|
|
63
64
|
return handle.fail({
|
|
64
|
-
errMsg: error
|
|
65
|
+
errMsg: error,
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
68
|
for (let i = 0; i < children.length; i++) {
|
|
68
69
|
const child = children[i];
|
|
69
70
|
swiper.appendChild(child);
|
|
70
71
|
}
|
|
71
|
-
const currentIndex = urls.indexOf(current);
|
|
72
|
-
// @ts-ignore
|
|
72
|
+
const currentIndex = typeof current === 'number' ? current : urls.indexOf(current);
|
|
73
73
|
swiper.current = currentIndex;
|
|
74
74
|
container.appendChild(swiper);
|
|
75
75
|
document.body.appendChild(container);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previewImage.js","sources":["../../../../src/api/media/image/previewImage.ts"],"sourcesContent":["import Taro from '@tarojs/api'\nimport { SwiperProps } from '@tarojs/components'\nimport {
|
|
1
|
+
{"version":3,"file":"previewImage.js","sources":["../../../../src/api/media/image/previewImage.ts"],"sourcesContent":["import Taro from '@tarojs/api'\nimport { SwiperProps } from '@tarojs/components'\nimport {\n defineCustomElementTaroSwiperCore,\n defineCustomElementTaroSwiperItemCore,\n} from '@tarojs/components/dist/components'\nimport { isFunction } from '@tarojs/shared'\n\nimport { shouldBeObject } from '../../../utils'\nimport { MethodHandler } from '../../../utils/handler'\n\n/**\n * previewImage api基于开源的React组件[react-wx-images-viewer](https://github.com/react-ld/react-wx-images-viewer)开发,感谢!\n */\n\n/**\n * 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。\n */\nexport const previewImage: typeof Taro.previewImage = async (options) => {\n // TODO 改为通过 window.__taroAppConfig 获取配置的 Swiper 插件创建节点\n defineCustomElementTaroSwiperCore()\n defineCustomElementTaroSwiperItemCore()\n\n function loadImage (url: string, loadFail: typeof fail): Promise<Node> {\n return new Promise((resolve) => {\n const item = document.createElement('taro-swiper-item-core')\n item.style.cssText = 'display:flex;align-items:start;justify-content:center;overflow-y:scroll;'\n const image = new Image()\n image.style.maxWidth = '100%'\n image.src = url\n const div = document.createElement('div')\n div.classList.add('swiper-zoom-container')\n div.style.cssText = 'display:flex;align-items:center;justify-content:center;max-width:100%;min-height:100%;'\n div.appendChild(image)\n item.appendChild(div)\n // Note: 等待图片加载完后返回,会导致轮播被卡住\n resolve(item)\n if (isFunction(loadFail)) {\n image.addEventListener('error', (err) => {\n loadFail({ errMsg: err.message })\n })\n }\n })\n }\n\n // options must be an Object\n const isObject = shouldBeObject(options)\n if (!isObject.flag) {\n const res = { errMsg: `previewImage:fail ${isObject.msg}` }\n console.error(res.errMsg)\n return Promise.reject(res)\n }\n\n const { urls = [], current = '', success, fail, complete } = options\n const handle = new MethodHandler({ name: 'previewImage', success, fail, complete })\n const container = document.createElement('div')\n container.classList.add('preview-image')\n container.style.cssText =\n 'position:fixed;top:0;left:0;z-index:1050;width:100%;height:100%;overflow:hidden;outline:0;background-color:#111;'\n container.addEventListener('click', () => {\n container.remove()\n })\n\n const swiper: HTMLElement & Omit<SwiperProps, 'style' | 'children'> = document.createElement('taro-swiper-core')\n // @ts-ignore\n swiper.full = true\n // @ts-ignore\n swiper.zoom = true\n\n let children: Node[] = []\n try {\n children = await Promise.all(urls.map((e) => loadImage(e, fail)))\n } catch (error) {\n return handle.fail({\n errMsg: error,\n })\n }\n\n for (let i = 0; i < children.length; i++) {\n const child = children[i]\n swiper.appendChild(child)\n }\n\n const currentIndex = typeof current === 'number' ? current : urls.indexOf(current)\n\n swiper.current = currentIndex\n\n container.appendChild(swiper)\n document.body.appendChild(container)\n\n return handle.success()\n}\n"],"names":[],"mappings":";;;;;;AAWA;;AAEG;AAEH;;AAEG;AACU,MAAA,YAAY,GAA6B,CAAO,OAAO,KAAI,SAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;;AAEtE,IAAA,iCAAiC,EAAE,CAAA;AACnC,IAAA,qCAAqC,EAAE,CAAA;AAEvC,IAAA,SAAS,SAAS,CAAE,GAAW,EAAE,QAAqB,EAAA;AACpD,QAAA,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI;YAC7B,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAA;AAC5D,YAAA,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,0EAA0E,CAAA;AAC/F,YAAA,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAA;AACzB,YAAA,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAA;AAC7B,YAAA,KAAK,CAAC,GAAG,GAAG,GAAG,CAAA;YACf,MAAM,GAAG,GAAG,QAA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AAQ,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;AAEpC,IAAA,OAAO,MAAM,CAAC,OAAO,EAAE,CAAA;AACzB,CAAC;;;;"}
|
package/dist/api/media/index.js
CHANGED
|
@@ -9,5 +9,5 @@ export { getRecorderManager, startRecord, stopRecord } from './recorder.js';
|
|
|
9
9
|
export { compressVideo, createVideoContext, openVideoEditor } from './video/index.js';
|
|
10
10
|
export { createVideoDecoder } from './video-decoder.js';
|
|
11
11
|
export { createMediaContainer } from './video-processing.js';
|
|
12
|
-
export { exitVoIPChat, joinVoIPChat, offVoIPChatInterrupted, offVoIPChatMembersChanged, offVoIPChatStateChanged, offVoIPVideoMembersChanged, onVoIPChatInterrupted, onVoIPChatMembersChanged, onVoIPChatSpeakersChanged, onVoIPChatStateChanged, onVoIPVideoMembersChanged, setEnable1v1Chat, subscribeVoIPVideoMembers, updateVoIPChatMuteConfig } from './voip.js';
|
|
12
|
+
export { exitVoIPChat, join1v1Chat, joinVoIPChat, offVoIPChatInterrupted, offVoIPChatMembersChanged, offVoIPChatSpeakersChanged, offVoIPChatStateChanged, offVoIPVideoMembersChanged, onVoIPChatInterrupted, onVoIPChatMembersChanged, onVoIPChatSpeakersChanged, onVoIPChatStateChanged, onVoIPVideoMembersChanged, setEnable1v1Chat, subscribeVoIPVideoMembers, updateVoIPChatMuteConfig } from './voip.js';
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -58,7 +58,7 @@ const chooseMedia = function (options, methodName = 'chooseMedia') {
|
|
|
58
58
|
const { tapIndex } = yield showActionSheet({
|
|
59
59
|
itemList: ['拍摄', '从相册选择'],
|
|
60
60
|
}, methodName);
|
|
61
|
-
sourceType.splice(0,
|
|
61
|
+
sourceType.splice(0, sourceType.length, tapIndex === 0 ? 'camera' : 'album');
|
|
62
62
|
}
|
|
63
63
|
catch (e) {
|
|
64
64
|
return handle.fail({
|