@tarojs/taro-h5 3.7.0-alpha.8 → 3.7.0-beta.3

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 (38) hide show
  1. package/dist/api/canvas/CanvasContext.d.ts +5 -3
  2. package/dist/api/canvas/CanvasContext.js +23 -5
  3. package/dist/api/canvas/CanvasContext.js.map +1 -1
  4. package/dist/api/index.js +3 -1
  5. package/dist/api/index.js.map +1 -1
  6. package/dist/api/media/audio/InnerAudioContext.d.ts +20 -20
  7. package/dist/api/media/audio/InnerAudioContext.js +11 -1
  8. package/dist/api/media/audio/InnerAudioContext.js.map +1 -1
  9. package/dist/api/media/background-audio/BackgroundAudioManager.js +11 -1
  10. package/dist/api/media/background-audio/BackgroundAudioManager.js.map +1 -1
  11. package/dist/api/network/download.js +10 -8
  12. package/dist/api/network/download.js.map +1 -1
  13. package/dist/api/network/upload.js +10 -8
  14. package/dist/api/network/upload.js.map +1 -1
  15. package/dist/api/open-api/favorites.d.ts +1 -2
  16. package/dist/api/open-api/favorites.js +1 -2
  17. package/dist/api/open-api/favorites.js.map +1 -1
  18. package/dist/api/open-api/index.d.ts +2 -0
  19. package/dist/api/open-api/index.js +3 -1
  20. package/dist/api/open-api/index.js.map +1 -1
  21. package/dist/api/open-api/my-miniprogram.d.ts +2 -0
  22. package/dist/api/open-api/my-miniprogram.js +7 -0
  23. package/dist/api/open-api/my-miniprogram.js.map +1 -0
  24. package/dist/api/open-api/privacy.d.ts +5 -0
  25. package/dist/api/open-api/privacy.js +10 -0
  26. package/dist/api/open-api/privacy.js.map +1 -0
  27. package/dist/api/taro.js +16 -8
  28. package/dist/api/taro.js.map +1 -1
  29. package/dist/index.cjs.d.ts +8 -2
  30. package/dist/index.cjs.js +94 -32
  31. package/dist/index.cjs.js.map +1 -1
  32. package/dist/index.esm.d.ts +8 -2
  33. package/dist/index.esm.js +91 -33
  34. package/dist/index.esm.js.map +1 -1
  35. package/dist/index.js +3 -1
  36. package/dist/index.js.map +1 -1
  37. package/package.json +7 -8
  38. package/types/overlay.d.ts +5 -5
@@ -11,6 +11,8 @@ export * from "./group.js";
11
11
  export * from "./invoice.js";
12
12
  export * from "./license-plate.js";
13
13
  export * from "./login.js";
14
+ export * from "./my-miniprogram.js";
15
+ export * from "./privacy.js";
14
16
  export * from "./red-package.js";
15
17
  export * from "./settings.js";
16
18
  export * from "./soter.js";
@@ -6,11 +6,13 @@ export { getChannelsLiveInfo, getChannelsLiveNoticeInfo, getChannelsShareKey, op
6
6
  export { openCustomerServiceChat } from './customer-service.js';
7
7
  export { getDeviceVoIPList, requestDeviceVoIP } from './device-voip.js';
8
8
  export { checkIsSupportFacialRecognition, faceVerifyForPay, startFacialRecognitionVerify, startFacialRecognitionVerifyAndUploadVideo } from './facial.js';
9
- export { addFileToFavorites, addVideoToFavorites, checkIsAddedToMyMiniProgram } from './favorites.js';
9
+ export { addFileToFavorites, addVideoToFavorites } from './favorites.js';
10
10
  export { getGroupEnterInfo } from './group.js';
11
11
  export { chooseInvoice, chooseInvoiceTitle } from './invoice.js';
12
12
  export { chooseLicensePlate } from './license-plate.js';
13
13
  export { checkSession, login, pluginLogin } from './login.js';
14
+ export { checkIsAddedToMyMiniProgram } from './my-miniprogram.js';
15
+ export { getPrivacySetting, onNeedPrivacyAuthorization, openPrivacyContract, requirePrivacyAuthorize } from './privacy.js';
14
16
  export { showRedPackage } from './red-package.js';
15
17
  export { getSetting, openSetting } from './settings.js';
16
18
  export { checkIsSoterEnrolledInDevice, checkIsSupportSoterAuthentication, startSoterAuthentication } from './soter.js';
@@ -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,2 @@
1
+ declare const checkIsAddedToMyMiniProgram: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
2
+ export { checkIsAddedToMyMiniProgram };
@@ -0,0 +1,7 @@
1
+ import { temporarilyNotSupport } from '../../utils/index.js';
2
+
3
+ // 我的小程序
4
+ const checkIsAddedToMyMiniProgram = /* @__PURE__ */ temporarilyNotSupport('checkIsAddedToMyMiniProgram');
5
+
6
+ export { checkIsAddedToMyMiniProgram };
7
+ //# sourceMappingURL=my-miniprogram.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"my-miniprogram.js","sources":["../../../src/api/open-api/my-miniprogram.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 我的小程序\nexport const checkIsAddedToMyMiniProgram = /* @__PURE__ */ temporarilyNotSupport('checkIsAddedToMyMiniProgram')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,2BAA2B,mBAAmB,qBAAqB,CAAC,6BAA6B;;;;"}
@@ -0,0 +1,5 @@
1
+ declare const requirePrivacyAuthorize: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
2
+ declare const openPrivacyContract: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
3
+ declare const onNeedPrivacyAuthorization: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
4
+ declare const getPrivacySetting: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
5
+ export { requirePrivacyAuthorize, openPrivacyContract, onNeedPrivacyAuthorization, getPrivacySetting };
@@ -0,0 +1,10 @@
1
+ import { temporarilyNotSupport } from '../../utils/index.js';
2
+
3
+ // 隐私信息授权
4
+ const requirePrivacyAuthorize = /* @__PURE__ */ temporarilyNotSupport('requirePrivacyAuthorize');
5
+ const openPrivacyContract = /* @__PURE__ */ temporarilyNotSupport('openPrivacyContract');
6
+ const onNeedPrivacyAuthorization = /* @__PURE__ */ temporarilyNotSupport('onNeedPrivacyAuthorization');
7
+ const getPrivacySetting = /* @__PURE__ */ temporarilyNotSupport('getPrivacySetting');
8
+
9
+ export { getPrivacySetting, onNeedPrivacyAuthorization, openPrivacyContract, requirePrivacyAuthorize };
10
+ //# sourceMappingURL=privacy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy.js","sources":["../../../src/api/open-api/privacy.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 隐私信息授权\nexport const requirePrivacyAuthorize = /* @__PURE__ */ temporarilyNotSupport('requirePrivacyAuthorize')\nexport const openPrivacyContract = /* @__PURE__ */ temporarilyNotSupport('openPrivacyContract')\nexport const onNeedPrivacyAuthorization = /* @__PURE__ */ temporarilyNotSupport('onNeedPrivacyAuthorization')\nexport const getPrivacySetting = /* @__PURE__ */ temporarilyNotSupport('getPrivacySetting')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,uBAAuB,mBAAmB,qBAAqB,CAAC,yBAAyB,EAAC;AAC1F,MAAA,mBAAmB,mBAAmB,qBAAqB,CAAC,qBAAqB,EAAC;AAClF,MAAA,0BAA0B,mBAAmB,qBAAqB,CAAC,4BAA4B,EAAC;AAChG,MAAA,iBAAiB,mBAAmB,qBAAqB,CAAC,mBAAmB;;;;"}
package/dist/api/taro.js CHANGED
@@ -38,11 +38,16 @@ function getConfig() {
38
38
  return this.pxTransformConfig;
39
39
  return ((_a = taro).config || (_a.config = {}));
40
40
  }
41
- const initPxTransform = function ({ designWidth = 750, deviceRatio = {
41
+ const defaultDesignWidth = 750;
42
+ const defaultDesignRatio = {
42
43
  640: 2.34 / 2,
43
44
  750: 1,
44
45
  828: 1.81 / 2
45
- }, baseFontSize = 20, unitPrecision = 5, targetUnit = 'rem' }) {
46
+ };
47
+ const defaultBaseFontSize = 20;
48
+ const defaultUnitPrecision = 5;
49
+ const defaultTargetUnit = 'rem';
50
+ const initPxTransform = function ({ designWidth = defaultDesignWidth, deviceRatio = defaultDesignRatio, baseFontSize = defaultBaseFontSize, unitPrecision = defaultUnitPrecision, targetUnit = defaultTargetUnit }) {
46
51
  const config = getConfig.call(this);
47
52
  config.designWidth = designWidth;
48
53
  config.deviceRatio = deviceRatio;
@@ -52,16 +57,19 @@ const initPxTransform = function ({ designWidth = 750, deviceRatio = {
52
57
  };
53
58
  const pxTransform = function (size = 0) {
54
59
  const config = getConfig.call(this);
55
- const baseFontSize = config.baseFontSize || 20;
60
+ const baseFontSize = config.baseFontSize || defaultBaseFontSize;
61
+ const deviceRatio = config.deviceRatio || defaultDesignRatio;
56
62
  const designWidth = (((input = 0) => isFunction(config.designWidth)
57
63
  ? config.designWidth(input)
58
64
  : config.designWidth))(size);
59
65
  if (!(designWidth in config.deviceRatio)) {
60
66
  throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`);
61
67
  }
68
+ const targetUnit = config.targetUnit || defaultTargetUnit;
69
+ const unitPrecision = config.unitPrecision || defaultUnitPrecision;
62
70
  const formatSize = ~~size;
63
- let rootValue = 1 / config.deviceRatio[designWidth];
64
- switch (config === null || config === void 0 ? void 0 : config.targetUnit) {
71
+ let rootValue = 1 / deviceRatio[designWidth];
72
+ switch (targetUnit) {
65
73
  case 'vw':
66
74
  rootValue = designWidth / 100;
67
75
  break;
@@ -73,11 +81,11 @@ const pxTransform = function (size = 0) {
73
81
  rootValue *= baseFontSize * 2;
74
82
  }
75
83
  let val = formatSize / rootValue;
76
- if (config.unitPrecision >= 0 && config.unitPrecision <= 100) {
84
+ if (unitPrecision >= 0 && unitPrecision <= 100) {
77
85
  // Number(val): 0.50000 => 0.5
78
- val = Number(val.toFixed(config.unitPrecision));
86
+ val = Number(val.toFixed(unitPrecision));
79
87
  }
80
- return val + (config === null || config === void 0 ? void 0 : config.targetUnit);
88
+ return val + targetUnit;
81
89
  };
82
90
  const canIUseWebp = function () {
83
91
  const canvas = document.createElement('canvas');
@@ -1 +1 @@
1
- {"version":3,"file":"taro.js","sources":["../../src/api/taro.ts"],"sourcesContent":["import Taro from '@tarojs/api'\nimport { history } from '@tarojs/router'\nimport { isFunction, PLATFORM_TYPE } from '@tarojs/shared'\n\nimport { getApp, getCurrentInstance, getCurrentPages, navigateBack, navigateTo, nextTick, redirectTo, reLaunch, switchTab } from '../api'\nimport { permanentlyNotSupport } from '../utils'\n\nconst {\n Behavior,\n getEnv,\n ENV_TYPE,\n Link,\n interceptors,\n interceptorify,\n Current,\n options,\n eventCenter,\n Events,\n preload\n} = Taro as any\n\nconst taro: typeof Taro = {\n // @ts-ignore\n Behavior,\n getEnv,\n ENV_TYPE,\n Link,\n interceptors,\n interceptorify,\n Current,\n getCurrentInstance,\n options,\n nextTick,\n eventCenter,\n Events,\n preload,\n history,\n navigateBack,\n navigateTo,\n reLaunch,\n redirectTo,\n getCurrentPages,\n switchTab\n}\n\nconst requirePlugin = /* @__PURE__ */ permanentlyNotSupport('requirePlugin')\n\nfunction getConfig (): Record<string, any> {\n if (this?.pxTransformConfig) return this.pxTransformConfig\n return ((taro as any).config ||= {})\n}\n\nconst initPxTransform = function ({\n designWidth = 750,\n deviceRatio = {\n 640: 2.34 / 2,\n 750: 1,\n 828: 1.81 / 2\n } as TaroGeneral.TDeviceRatio,\n baseFontSize = 20,\n unitPrecision = 5,\n targetUnit = 'rem'\n}) {\n const config = getConfig.call(this)\n config.designWidth = designWidth\n config.deviceRatio = deviceRatio\n config.baseFontSize = baseFontSize\n config.targetUnit = targetUnit\n config.unitPrecision = unitPrecision\n}\n\nconst pxTransform = function (size = 0) {\n const config = getConfig.call(this)\n const baseFontSize = config.baseFontSize || 20\n const designWidth = (((input = 0) => isFunction(config.designWidth)\n ? config.designWidth(input)\n : config.designWidth))(size)\n if (!(designWidth in config.deviceRatio)) {\n throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`)\n }\n const formatSize = ~~size\n let rootValue = 1 / config.deviceRatio[designWidth]\n switch (config?.targetUnit) {\n case 'vw':\n rootValue = designWidth / 100\n break\n case 'px':\n rootValue *= 2\n break\n default:\n // rem\n rootValue *= baseFontSize * 2\n }\n let val: number | string = formatSize / rootValue\n if (config.unitPrecision >= 0 && config.unitPrecision <= 100) {\n // Number(val): 0.50000 => 0.5\n val = Number(val.toFixed(config.unitPrecision))\n }\n return val + config?.targetUnit\n}\n\nconst canIUseWebp = function () {\n const canvas = document.createElement('canvas')\n return canvas.toDataURL('image/webp').indexOf('data:image/webp') === 0\n}\n\nconst getAppInfo = function () {\n const config = getConfig.call(this)\n return {\n platform: process.env.TARO_PLATFORM || PLATFORM_TYPE.WEB,\n taroVersion: process.env.TARO_VERSION || 'unknown',\n designWidth: config.designWidth,\n }\n}\n\ntaro.requirePlugin = requirePlugin\ntaro.getApp = getApp\ntaro.pxTransform = pxTransform\ntaro.initPxTransform = initPxTransform\ntaro.canIUseWebp = canIUseWebp\n\nexport default taro\n\nexport {\n Behavior,\n canIUseWebp,\n Current,\n ENV_TYPE,\n eventCenter,\n Events,\n getAppInfo,\n getEnv,\n history,\n initPxTransform,\n interceptorify,\n interceptors,\n Link,\n options,\n preload,\n pxTransform,\n requirePlugin\n}\n"],"names":[],"mappings":";;;;;;;;;AAOM,MAAA,EACJ,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,OAAO,EACR,GAAG,KAAW;AAEf,MAAM,IAAI,GAAgB;;IAExB,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,IAAI;IACJ,YAAY;IACZ,cAAc;IACd,OAAO;IACP,kBAAkB;IAClB,OAAO;IACP,QAAQ;IACR,WAAW;IACX,MAAM;IACN,OAAO;IACP,OAAO;IACP,YAAY;IACZ,UAAU;IACV,QAAQ;IACR,UAAU;IACV,eAAe;IACf,SAAS;EACV;AAEK,MAAA,aAAa,mBAAmB,qBAAqB,CAAC,eAAe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I,CAAC,IAAI,CAAC,CAAA;IACnC,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,aAAa,CAAC,GAAG;AACxD,QAAA,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,SAAS;QAClD,WAAW,EAAE,MAAM,CAAC,WAAW;KAChC,CAAA;AACH,EAAC;AAED,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;AAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;AACpB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;AAC9B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;AACtC,IAAI,CAAC,WAAW,GAAG,WAAW;;;;"}
1
+ {"version":3,"file":"taro.js","sources":["../../src/api/taro.ts"],"sourcesContent":["import Taro from '@tarojs/api'\nimport { history } from '@tarojs/router'\nimport { isFunction, PLATFORM_TYPE } from '@tarojs/shared'\n\nimport { getApp, getCurrentInstance, getCurrentPages, navigateBack, navigateTo, nextTick, redirectTo, reLaunch, switchTab } from '../api'\nimport { permanentlyNotSupport } from '../utils'\n\nconst {\n Behavior,\n getEnv,\n ENV_TYPE,\n Link,\n interceptors,\n interceptorify,\n Current,\n options,\n eventCenter,\n Events,\n preload\n} = Taro as any\n\nconst taro: typeof Taro = {\n // @ts-ignore\n Behavior,\n getEnv,\n ENV_TYPE,\n Link,\n interceptors,\n interceptorify,\n Current,\n getCurrentInstance,\n options,\n nextTick,\n eventCenter,\n Events,\n preload,\n history,\n navigateBack,\n navigateTo,\n reLaunch,\n redirectTo,\n getCurrentPages,\n switchTab\n}\n\nconst requirePlugin = /* @__PURE__ */ permanentlyNotSupport('requirePlugin')\n\nfunction getConfig (): Record<string, any> {\n if (this?.pxTransformConfig) return this.pxTransformConfig\n return ((taro as any).config ||= {})\n}\n\nconst defaultDesignWidth = 750\nconst defaultDesignRatio: TaroGeneral.TDeviceRatio = {\n 640: 2.34 / 2,\n 750: 1,\n 828: 1.81 / 2\n}\nconst defaultBaseFontSize = 20\nconst defaultUnitPrecision = 5\nconst defaultTargetUnit = 'rem'\n\nconst initPxTransform = function ({\n designWidth = defaultDesignWidth,\n deviceRatio = defaultDesignRatio,\n baseFontSize = defaultBaseFontSize,\n unitPrecision = defaultUnitPrecision,\n targetUnit = defaultTargetUnit\n}) {\n const config = getConfig.call(this)\n config.designWidth = designWidth\n config.deviceRatio = deviceRatio\n config.baseFontSize = baseFontSize\n config.targetUnit = targetUnit\n config.unitPrecision = unitPrecision\n}\n\nconst pxTransform = function (size = 0) {\n const config = getConfig.call(this)\n const baseFontSize = config.baseFontSize || defaultBaseFontSize\n const deviceRatio = config.deviceRatio || defaultDesignRatio\n const designWidth = (((input = 0) => isFunction(config.designWidth)\n ? config.designWidth(input)\n : config.designWidth))(size)\n if (!(designWidth in config.deviceRatio)) {\n throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`)\n }\n const targetUnit = config.targetUnit || defaultTargetUnit\n const unitPrecision = config.unitPrecision || defaultUnitPrecision\n const formatSize = ~~size\n let rootValue = 1 / deviceRatio[designWidth]\n switch (targetUnit) {\n case 'vw':\n rootValue = designWidth / 100\n break\n case 'px':\n rootValue *= 2\n break\n default:\n // rem\n rootValue *= baseFontSize * 2\n }\n let val: number | string = formatSize / rootValue\n if (unitPrecision >= 0 && unitPrecision <= 100) {\n // Number(val): 0.50000 => 0.5\n val = Number(val.toFixed(unitPrecision))\n }\n return val + targetUnit\n}\n\nconst canIUseWebp = function () {\n const canvas = document.createElement('canvas')\n return canvas.toDataURL('image/webp').indexOf('data:image/webp') === 0\n}\n\nconst getAppInfo = function () {\n const config = getConfig.call(this)\n return {\n platform: process.env.TARO_PLATFORM || PLATFORM_TYPE.WEB,\n taroVersion: process.env.TARO_VERSION || 'unknown',\n designWidth: config.designWidth,\n }\n}\n\ntaro.requirePlugin = requirePlugin\ntaro.getApp = getApp\ntaro.pxTransform = pxTransform\ntaro.initPxTransform = initPxTransform\ntaro.canIUseWebp = canIUseWebp\n\nexport default taro\n\nexport {\n Behavior,\n canIUseWebp,\n Current,\n ENV_TYPE,\n eventCenter,\n Events,\n getAppInfo,\n getEnv,\n history,\n initPxTransform,\n interceptorify,\n interceptors,\n Link,\n options,\n preload,\n pxTransform,\n requirePlugin\n}\n"],"names":[],"mappings":";;;;;;;;;AAOM,MAAA,EACJ,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,OAAO,EACR,GAAG,KAAW;AAEf,MAAM,IAAI,GAAgB;;IAExB,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,IAAI;IACJ,YAAY;IACZ,cAAc;IACd,OAAO;IACP,kBAAkB;IAClB,OAAO;IACP,QAAQ;IACR,WAAW;IACX,MAAM;IACN,OAAO;IACP,OAAO;IACP,YAAY;IACZ,UAAU;IACV,QAAQ;IACR,UAAU;IACV,eAAe;IACf,SAAS;EACV;AAEK,MAAA,aAAa,mBAAmB,qBAAqB,CAAC,eAAe,EAAC;AAE5E,SAAS,SAAS,GAAA;;AAChB,IAAA,IAAI,IAAI,KAAJ,IAAA,IAAA,IAAI,KAAJ,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,IAAI,CAAE,iBAAiB;QAAE,OAAO,IAAI,CAAC,iBAAiB,CAAA;IAC1D,QAAO,CAAA,EAAA,GAAE,IAAY,EAAC,MAAM,QAAN,MAAM,GAAK,EAAE,CAAA,EAAC;AACtC,CAAC;AAED,MAAM,kBAAkB,GAAG,GAAG,CAAA;AAC9B,MAAM,kBAAkB,GAA6B;IACnD,GAAG,EAAE,IAAI,GAAG,CAAC;AACb,IAAA,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,IAAI,GAAG,CAAC;CACd,CAAA;AACD,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAC9B,MAAM,oBAAoB,GAAG,CAAC,CAAA;AAC9B,MAAM,iBAAiB,GAAG,KAAK,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G,MAAM,CAAA;AACpB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;AAC9B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;AACtC,IAAI,CAAC,WAAW,GAAG,WAAW;;;;"}
@@ -616,7 +616,6 @@ declare const faceVerifyForPay: (option?: {}, ...args: any[]) => Promise<Partial
616
616
  // 收藏
617
617
  declare const addVideoToFavorites: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
618
618
  declare const addFileToFavorites: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
619
- declare const checkIsAddedToMyMiniProgram: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
620
619
  // 微信群
621
620
  declare const getGroupEnterInfo: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
622
621
  // 发票
@@ -628,6 +627,13 @@ declare const chooseLicensePlate: (option?: {}, ...args: any[]) => Promise<Parti
628
627
  declare const pluginLogin: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
629
628
  declare const login: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
630
629
  declare const checkSession: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
630
+ // 我的小程序
631
+ declare const checkIsAddedToMyMiniProgram: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
632
+ // 隐私信息授权
633
+ declare const requirePrivacyAuthorize: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
634
+ declare const openPrivacyContract: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
635
+ declare const onNeedPrivacyAuthorization: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
636
+ declare const getPrivacySetting: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
631
637
  // 微信红包
632
638
  declare const showRedPackage: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
633
639
  // 设置
@@ -816,5 +822,5 @@ declare const createWorker: (option?: {}, ...args: any[]) => Promise<Partial<Tar
816
822
  declare const createSelectorQuery: typeof Taro.createSelectorQuery;
817
823
  declare const createIntersectionObserver: typeof Taro.createIntersectionObserver;
818
824
  declare const createMediaQueryObserver: typeof Taro.createMediaQueryObserver;
819
- export { taro as default, taro, createRewardedVideoAd, createInterstitialAd, stopFaceDetect, initFaceDetect, faceDetect, getInferenceEnvInfo, createInferenceSession, isVKSupport, createVKSession, getOpenUserInfo, tradePay, env, arrayBufferToBase64, base64ToArrayBuffer, getUserCryptoManager, setEnableDebug, getRealtimeLogManager, getLogManager, reportPerformance, getPerformance, preloadWebview, preloadSkylineView, preloadAssets, openSystemBluetoothSetting, openAppAuthorizeSetting, getWindowInfo, getSystemSetting, getDeviceInfo, getAppBaseInfo, getAppAuthorizeSetting, getSystemInfoSync, getSystemInfoAsync, getSystemInfo, getSkylineInfoSync, getSkylineInfo, getRendererUserAgent, updateWeChatApp, getUpdateManager, onUnhandledRejection, onThemeChange, onPageNotFound, onLazyLoadError, onError, onAudioInterruptionEnd, onAudioInterruptionBegin, onAppShow, onAppHide, offUnhandledRejection, offThemeChange, offPageNotFound, offLazyLoadError, offError, offAudioInterruptionEnd, offAudioInterruptionBegin, offAppShow, offAppHide, getLaunchOptionsSync, getEnterOptionsSync, createOffscreenCanvas, createCanvasContext, canvasToTempFilePath, canvasPutImageData, canvasGetImageData, cloud, reportMonitor, reportAnalytics, reportEvent, getExptInfoSync, stopAccelerometer, startAccelerometer, onAccelerometerChange, offAccelerometerChange, checkIsOpenAccessibility, getBatteryInfoSync, getBatteryInfo, stopBluetoothDevicesDiscovery, startBluetoothDevicesDiscovery, openBluetoothAdapter, onBluetoothDeviceFound, onBluetoothAdapterStateChange, offBluetoothDeviceFound, offBluetoothAdapterStateChange, makeBluetoothPair, isBluetoothDevicePaired, getConnectedBluetoothDevices, getBluetoothDevices, getBluetoothAdapterState, closeBluetoothAdapter, writeBLECharacteristicValue, setBLEMTU, readBLECharacteristicValue, onBLEMTUChange, onBLEConnectionStateChange, onBLECharacteristicValueChange, offBLEMTUChange, offBLEConnectionStateChange, offBLECharacteristicValueChange, notifyBLECharacteristicValueChange, getBLEMTU, getBLEDeviceServices, getBLEDeviceRSSI, getBLEDeviceCharacteristics, createBLEConnection, closeBLEConnection, onBLEPeripheralConnectionStateChanged, offBLEPeripheralConnectionStateChanged, createBLEPeripheralServer, addPhoneRepeatCalendar, addPhoneCalendar, setClipboardData, getClipboardData, stopCompass, startCompass, onCompassChange, offCompassChange, chooseContact, addPhoneContact, getRandomValues, stopGyroscope, startGyroscope, onGyroscopeChange, offGyroscopeChange, stopBeaconDiscovery, startBeaconDiscovery, onBeaconUpdate, onBeaconServiceChange, offBeaconUpdate, offBeaconServiceChange, getBeacons, onKeyboardHeightChange, offKeyboardHeightChange, hideKeyboard, getSelectedTextRange, onMemoryWarning, offMemoryWarning, stopDeviceMotionListening, startDeviceMotionListening, onDeviceMotionChange, offDeviceMotionChange, getNetworkType, onNetworkWeakChange, onNetworkStatusChange, offNetworkWeakChange, offNetworkStatusChange, getLocalIPAddress, stopHCE, startHCE, sendHCEMessage, onHCEMessage, offHCEMessage, getNFCAdapter, getHCEState, makePhoneCall, scanCode, setVisualEffectOnCapture, setScreenBrightness, setKeepScreenOn, onUserCaptureScreen, offUserCaptureScreen, getScreenBrightness, onScreenRecordingStateChanged, offScreenRecordingStateChanged, getScreenRecordingState, sendSms, vibrateShort, vibrateLong, stopWifi, startWifi, setWifiList, onWifiConnectedWithPartialInfo, onWifiConnected, onGetWifiList, offWifiConnectedWithPartialInfo, offWifiConnected, offGetWifiList, getWifiList, getConnectedWifi, connectWifi, getExtConfigSync, getExtConfig, saveFileToDisk, saveFile, removeSavedFile, openDocument, getSavedFileList, getSavedFileInfo, getFileSystemManager, getFileInfo, getApp, getCurrentInstance, stopLocationUpdate, startLocationUpdateBackground, startLocationUpdate, openLocation, onLocationChangeError, onLocationChange, offLocationChangeError, offLocationChange, getLocation, choosePoi, getFuzzyLocation, chooseLocation, stopVoice, setInnerAudioOption, playVoice, pauseVoice, getAvailableAudioSources, createWebAudioContext, createMediaAudioPlayer, createInnerAudioContext, createAudioContext, stopBackgroundAudio, seekBackgroundAudio, playBackgroundAudio, pauseBackgroundAudio, onBackgroundAudioStop, onBackgroundAudioPlay, onBackgroundAudioPause, getBackgroundAudioPlayerState, getBackgroundAudioManager, createCameraContext, saveImageToPhotosAlbum, previewMedia, getImageInfo, previewImage, compressImage, chooseMessageFile, chooseImage, editImage, cropImage, createLivePusherContext, createLivePlayerContext, createMapContext, createMediaRecorder, stopRecord, startRecord, getRecorderManager, saveVideoToPhotosAlbum, openVideoEditor, getVideoInfo, createVideoContext, compressVideo, chooseMedia, chooseVideo, createVideoDecoder, createMediaContainer, updateVoIPChatMuteConfig, subscribeVoIPVideoMembers, setEnable1v1Chat, onVoIPVideoMembersChanged, onVoIPChatStateChanged, onVoIPChatSpeakersChanged, onVoIPChatMembersChanged, onVoIPChatInterrupted, offVoIPChatSpeakersChanged, offVoIPVideoMembersChanged, offVoIPChatStateChanged, offVoIPChatMembersChanged, offVoIPChatInterrupted, joinVoIPChat, join1v1Chat, exitVoIPChat, openEmbeddedMiniProgram, navigateToMiniProgram, navigateBackMiniProgram, exitMiniProgram, openBusinessView, downloadFile, stopLocalServiceDiscovery, startLocalServiceDiscovery, onLocalServiceResolveFail, onLocalServiceLost, onLocalServiceFound, onLocalServiceDiscoveryStop, offLocalServiceResolveFail, offLocalServiceLost, offLocalServiceFound, offLocalServiceDiscoveryStop, request, addInterceptor, cleanInterceptors, createTCPSocket, createUDPSocket, uploadFile, sendSocketMessage, onSocketOpen, onSocketMessage, onSocketError, onSocketClose, connectSocket, closeSocket, getAccountInfoSync, chooseAddress, authorizeForMiniProgram, authorize, openCard, addCard, reserveChannelsLive, openChannelsUserProfile, openChannelsLive, openChannelsEvent, openChannelsActivity, getChannelsShareKey, getChannelsLiveNoticeInfo, getChannelsLiveInfo, openCustomerServiceChat, requestDeviceVoIP, getDeviceVoIPList, checkIsSupportFacialRecognition, startFacialRecognitionVerify, startFacialRecognitionVerifyAndUploadVideo, faceVerifyForPay, addVideoToFavorites, addFileToFavorites, checkIsAddedToMyMiniProgram, getGroupEnterInfo, chooseInvoiceTitle, chooseInvoice, chooseLicensePlate, pluginLogin, login, checkSession, showRedPackage, openSetting, getSetting, startSoterAuthentication, checkIsSupportSoterAuthentication, checkIsSoterEnrolledInDevice, requestSubscribeMessage, requestSubscribeDeviceMessage, getUserProfile, getUserInfo, shareToWeRun, getWeRunData, requestPayment, requestPluginPayment, requestOrderPayment, openQzonePublish, updateShareMenu, showShareMenu, showShareImageMenu, shareVideoMessage, shareFileMessage, onCopyUrl, offCopyUrl, hideShareMenu, getShareInfo, authPrivateMessage, setStorageSync, setStorage, revokeBufferURL, removeStorageSync, removeStorage, getStorageSync, getStorageInfoSync, getStorageInfo, getStorage, createBufferURL, clearStorageSync, clearStorage, batchSetStorageSync, batchSetStorage, batchGetStorageSync, batchGetStorage, setBackgroundFetchToken, onBackgroundFetchData, getBackgroundFetchToken, getBackgroundFetchData, createCacheManager, setPageInfo, ocrIdCard, ocrBankCard, ocrDrivingLicense, ocrVehicleLicense, textReview, textToAudio, imageAudit, advancedGeneralIdentify, objectDetectIdentify, carClassify, dishClassify, logoClassify, animalClassify, plantClassify, getSwanId, requestPolymerPayment, navigateToSmartGameProgram, navigateToSmartProgram, navigateBackSmartProgram, preloadSubPackage, createAnimation, setBackgroundTextStyle, setBackgroundColor, nextTick, loadFontFace, disableAlertBeforeUnload, enableAlertBeforeUnload, hideLoading, hideToast, showActionSheet, showLoading, showModal, showToast, getMenuButtonBoundingClientRect, showNavigationBarLoading, setNavigationBarTitle, setNavigationBarColor, hideNavigationBarLoading, hideHomeButton, startPullDownRefresh, stopPullDownRefresh, pageScrollTo, setTopBarText, initTabBarApis, showTabBarRedDot, showTabBar, setTabBarStyle, setTabBarItem, setTabBarBadge, removeTabBarBadge, hideTabBarRedDot, hideTabBar, setWindowSize, onWindowResize, offWindowResize, checkIsPictureInPictureActive, createWorker, createSelectorQuery, createIntersectionObserver, createMediaQueryObserver, Behavior, canIUseWebp, Current, ENV_TYPE, eventCenter, Events, getAppInfo, getEnv, history, initPxTransform, interceptorify, interceptors, Link, options, preload, pxTransform, requirePlugin };
825
+ export { taro as default, taro, createRewardedVideoAd, createInterstitialAd, stopFaceDetect, initFaceDetect, faceDetect, getInferenceEnvInfo, createInferenceSession, isVKSupport, createVKSession, getOpenUserInfo, tradePay, env, arrayBufferToBase64, base64ToArrayBuffer, getUserCryptoManager, setEnableDebug, getRealtimeLogManager, getLogManager, reportPerformance, getPerformance, preloadWebview, preloadSkylineView, preloadAssets, openSystemBluetoothSetting, openAppAuthorizeSetting, getWindowInfo, getSystemSetting, getDeviceInfo, getAppBaseInfo, getAppAuthorizeSetting, getSystemInfoSync, getSystemInfoAsync, getSystemInfo, getSkylineInfoSync, getSkylineInfo, getRendererUserAgent, updateWeChatApp, getUpdateManager, onUnhandledRejection, onThemeChange, onPageNotFound, onLazyLoadError, onError, onAudioInterruptionEnd, onAudioInterruptionBegin, onAppShow, onAppHide, offUnhandledRejection, offThemeChange, offPageNotFound, offLazyLoadError, offError, offAudioInterruptionEnd, offAudioInterruptionBegin, offAppShow, offAppHide, getLaunchOptionsSync, getEnterOptionsSync, createOffscreenCanvas, createCanvasContext, canvasToTempFilePath, canvasPutImageData, canvasGetImageData, cloud, reportMonitor, reportAnalytics, reportEvent, getExptInfoSync, stopAccelerometer, startAccelerometer, onAccelerometerChange, offAccelerometerChange, checkIsOpenAccessibility, getBatteryInfoSync, getBatteryInfo, stopBluetoothDevicesDiscovery, startBluetoothDevicesDiscovery, openBluetoothAdapter, onBluetoothDeviceFound, onBluetoothAdapterStateChange, offBluetoothDeviceFound, offBluetoothAdapterStateChange, makeBluetoothPair, isBluetoothDevicePaired, getConnectedBluetoothDevices, getBluetoothDevices, getBluetoothAdapterState, closeBluetoothAdapter, writeBLECharacteristicValue, setBLEMTU, readBLECharacteristicValue, onBLEMTUChange, onBLEConnectionStateChange, onBLECharacteristicValueChange, offBLEMTUChange, offBLEConnectionStateChange, offBLECharacteristicValueChange, notifyBLECharacteristicValueChange, getBLEMTU, getBLEDeviceServices, getBLEDeviceRSSI, getBLEDeviceCharacteristics, createBLEConnection, closeBLEConnection, onBLEPeripheralConnectionStateChanged, offBLEPeripheralConnectionStateChanged, createBLEPeripheralServer, addPhoneRepeatCalendar, addPhoneCalendar, setClipboardData, getClipboardData, stopCompass, startCompass, onCompassChange, offCompassChange, chooseContact, addPhoneContact, getRandomValues, stopGyroscope, startGyroscope, onGyroscopeChange, offGyroscopeChange, stopBeaconDiscovery, startBeaconDiscovery, onBeaconUpdate, onBeaconServiceChange, offBeaconUpdate, offBeaconServiceChange, getBeacons, onKeyboardHeightChange, offKeyboardHeightChange, hideKeyboard, getSelectedTextRange, onMemoryWarning, offMemoryWarning, stopDeviceMotionListening, startDeviceMotionListening, onDeviceMotionChange, offDeviceMotionChange, getNetworkType, onNetworkWeakChange, onNetworkStatusChange, offNetworkWeakChange, offNetworkStatusChange, getLocalIPAddress, stopHCE, startHCE, sendHCEMessage, onHCEMessage, offHCEMessage, getNFCAdapter, getHCEState, makePhoneCall, scanCode, setVisualEffectOnCapture, setScreenBrightness, setKeepScreenOn, onUserCaptureScreen, offUserCaptureScreen, getScreenBrightness, onScreenRecordingStateChanged, offScreenRecordingStateChanged, getScreenRecordingState, sendSms, vibrateShort, vibrateLong, stopWifi, startWifi, setWifiList, onWifiConnectedWithPartialInfo, onWifiConnected, onGetWifiList, offWifiConnectedWithPartialInfo, offWifiConnected, offGetWifiList, getWifiList, getConnectedWifi, connectWifi, getExtConfigSync, getExtConfig, saveFileToDisk, saveFile, removeSavedFile, openDocument, getSavedFileList, getSavedFileInfo, getFileSystemManager, getFileInfo, getApp, getCurrentInstance, stopLocationUpdate, startLocationUpdateBackground, startLocationUpdate, openLocation, onLocationChangeError, onLocationChange, offLocationChangeError, offLocationChange, getLocation, choosePoi, getFuzzyLocation, chooseLocation, stopVoice, setInnerAudioOption, playVoice, pauseVoice, getAvailableAudioSources, createWebAudioContext, createMediaAudioPlayer, createInnerAudioContext, createAudioContext, stopBackgroundAudio, seekBackgroundAudio, playBackgroundAudio, pauseBackgroundAudio, onBackgroundAudioStop, onBackgroundAudioPlay, onBackgroundAudioPause, getBackgroundAudioPlayerState, getBackgroundAudioManager, createCameraContext, saveImageToPhotosAlbum, previewMedia, getImageInfo, previewImage, compressImage, chooseMessageFile, chooseImage, editImage, cropImage, createLivePusherContext, createLivePlayerContext, createMapContext, createMediaRecorder, stopRecord, startRecord, getRecorderManager, saveVideoToPhotosAlbum, openVideoEditor, getVideoInfo, createVideoContext, compressVideo, chooseMedia, chooseVideo, createVideoDecoder, createMediaContainer, updateVoIPChatMuteConfig, subscribeVoIPVideoMembers, setEnable1v1Chat, onVoIPVideoMembersChanged, onVoIPChatStateChanged, onVoIPChatSpeakersChanged, onVoIPChatMembersChanged, onVoIPChatInterrupted, offVoIPChatSpeakersChanged, offVoIPVideoMembersChanged, offVoIPChatStateChanged, offVoIPChatMembersChanged, offVoIPChatInterrupted, joinVoIPChat, join1v1Chat, exitVoIPChat, openEmbeddedMiniProgram, navigateToMiniProgram, navigateBackMiniProgram, exitMiniProgram, openBusinessView, downloadFile, stopLocalServiceDiscovery, startLocalServiceDiscovery, onLocalServiceResolveFail, onLocalServiceLost, onLocalServiceFound, onLocalServiceDiscoveryStop, offLocalServiceResolveFail, offLocalServiceLost, offLocalServiceFound, offLocalServiceDiscoveryStop, request, addInterceptor, cleanInterceptors, createTCPSocket, createUDPSocket, uploadFile, sendSocketMessage, onSocketOpen, onSocketMessage, onSocketError, onSocketClose, connectSocket, closeSocket, getAccountInfoSync, chooseAddress, authorizeForMiniProgram, authorize, openCard, addCard, reserveChannelsLive, openChannelsUserProfile, openChannelsLive, openChannelsEvent, openChannelsActivity, getChannelsShareKey, getChannelsLiveNoticeInfo, getChannelsLiveInfo, openCustomerServiceChat, requestDeviceVoIP, getDeviceVoIPList, checkIsSupportFacialRecognition, startFacialRecognitionVerify, startFacialRecognitionVerifyAndUploadVideo, faceVerifyForPay, addVideoToFavorites, addFileToFavorites, getGroupEnterInfo, chooseInvoiceTitle, chooseInvoice, chooseLicensePlate, pluginLogin, login, checkSession, checkIsAddedToMyMiniProgram, requirePrivacyAuthorize, openPrivacyContract, onNeedPrivacyAuthorization, getPrivacySetting, showRedPackage, openSetting, getSetting, startSoterAuthentication, checkIsSupportSoterAuthentication, checkIsSoterEnrolledInDevice, requestSubscribeMessage, requestSubscribeDeviceMessage, getUserProfile, getUserInfo, shareToWeRun, getWeRunData, requestPayment, requestPluginPayment, requestOrderPayment, openQzonePublish, updateShareMenu, showShareMenu, showShareImageMenu, shareVideoMessage, shareFileMessage, onCopyUrl, offCopyUrl, hideShareMenu, getShareInfo, authPrivateMessage, setStorageSync, setStorage, revokeBufferURL, removeStorageSync, removeStorage, getStorageSync, getStorageInfoSync, getStorageInfo, getStorage, createBufferURL, clearStorageSync, clearStorage, batchSetStorageSync, batchSetStorage, batchGetStorageSync, batchGetStorage, setBackgroundFetchToken, onBackgroundFetchData, getBackgroundFetchToken, getBackgroundFetchData, createCacheManager, setPageInfo, ocrIdCard, ocrBankCard, ocrDrivingLicense, ocrVehicleLicense, textReview, textToAudio, imageAudit, advancedGeneralIdentify, objectDetectIdentify, carClassify, dishClassify, logoClassify, animalClassify, plantClassify, getSwanId, requestPolymerPayment, navigateToSmartGameProgram, navigateToSmartProgram, navigateBackSmartProgram, preloadSubPackage, createAnimation, setBackgroundTextStyle, setBackgroundColor, nextTick, loadFontFace, disableAlertBeforeUnload, enableAlertBeforeUnload, hideLoading, hideToast, showActionSheet, showLoading, showModal, showToast, getMenuButtonBoundingClientRect, showNavigationBarLoading, setNavigationBarTitle, setNavigationBarColor, hideNavigationBarLoading, hideHomeButton, startPullDownRefresh, stopPullDownRefresh, pageScrollTo, setTopBarText, initTabBarApis, showTabBarRedDot, showTabBar, setTabBarStyle, setTabBarItem, setTabBarBadge, removeTabBarBadge, hideTabBarRedDot, hideTabBar, setWindowSize, onWindowResize, offWindowResize, checkIsPictureInPictureActive, createWorker, createSelectorQuery, createIntersectionObserver, createMediaQueryObserver, Behavior, canIUseWebp, Current, ENV_TYPE, eventCenter, Events, getAppInfo, getEnv, history, initPxTransform, interceptorify, interceptors, Link, options, preload, pxTransform, requirePlugin };
820
826
  export { getCurrentPages, navigateBack, navigateTo, redirectTo, reLaunch, switchTab } from "@tarojs/router";
package/dist/index.cjs.js CHANGED
@@ -1073,8 +1073,19 @@ class CanvasContext {
1073
1073
  clearRect(...args) { return this.enqueueActions(this.ctx.clearRect, ...args); }
1074
1074
  clip(...args) { return this.enqueueActions(this.ctx.clip, ...args); }
1075
1075
  closePath(...args) { return this.enqueueActions(this.ctx.closePath, ...args); }
1076
- createPattern(image, repetition) {
1077
- return this.createPattern(image, repetition);
1076
+ createPattern(imageResource, repetition) {
1077
+ // 需要转换为 Image
1078
+ if (typeof imageResource === 'string') {
1079
+ const img = new Image();
1080
+ img.src = imageResource;
1081
+ return new Promise((resolve, reject) => {
1082
+ img.onload = () => {
1083
+ resolve(this.ctx.createPattern(img, repetition));
1084
+ };
1085
+ img.onerror = reject;
1086
+ });
1087
+ }
1088
+ return this.ctx.createPattern(imageResource, repetition);
1078
1089
  }
1079
1090
  /**
1080
1091
  * 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
@@ -1125,15 +1136,22 @@ class CanvasContext {
1125
1136
  moveTo(...args) { return this.enqueueActions(this.ctx.moveTo, ...args); }
1126
1137
  quadraticCurveTo(...args) { return this.enqueueActions(this.ctx.quadraticCurveTo, ...args); }
1127
1138
  rect(...args) { return this.enqueueActions(this.ctx.rect, ...args); }
1128
- restore(...args) { return this.enqueueActions(this.ctx.restore, ...args); }
1139
+ // @ts-ignore
1140
+ reset() { return this.ctx.reset(); }
1141
+ restore() { return this.ctx.restore(); }
1129
1142
  rotate(...args) { return this.enqueueActions(this.ctx.rotate, ...args); }
1130
- save(...args) { return this.enqueueActions(this.ctx.save, ...args); }
1143
+ save() { return this.ctx.save(); }
1131
1144
  scale(...args) { return this.enqueueActions(this.ctx.scale, ...args); }
1132
1145
  setFillStyle(color) {
1133
1146
  this.enqueueActions(() => { this.ctx.fillStyle = color; });
1134
1147
  }
1135
1148
  setFontSize(fontSize) {
1136
- this.font = `${fontSize}px`;
1149
+ const arr = this.font.split(/\s/);
1150
+ const idx = arr.findIndex(e => /^\d+px$/.test(e));
1151
+ if (idx !== -1) {
1152
+ arr[idx] = `${fontSize}px`;
1153
+ this.font = arr.join(' ');
1154
+ }
1137
1155
  }
1138
1156
  setGlobalAlpha(alpha) {
1139
1157
  this.globalAlpha = alpha;
@@ -2455,7 +2473,17 @@ class InnerAudioContext {
2455
2473
  }
2456
2474
  set autoplay(e) { this.setProperty('autoplay', e); }
2457
2475
  get autoplay() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.autoplay) || false; }
2458
- get buffered() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.buffered.length) || 0; }
2476
+ get buffered() {
2477
+ const { currentTime = 0, buffered: timeRange } = this.Instance || {};
2478
+ if (timeRange) {
2479
+ for (let i = 0; i < timeRange.length; i++) {
2480
+ if (timeRange.start(i) <= currentTime && timeRange.end(i) >= currentTime) {
2481
+ return timeRange.end(i);
2482
+ }
2483
+ }
2484
+ }
2485
+ return 0;
2486
+ }
2459
2487
  get currentTime() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.currentTime) || 0; }
2460
2488
  set currentTime(e) { this.seek(e); }
2461
2489
  get duration() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.duration) || 0; }
@@ -2566,7 +2594,17 @@ class BackgroundAudioManager {
2566
2594
  get duration() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.duration) || 0; }
2567
2595
  get currentTime() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.currentTime) || 0; }
2568
2596
  get paused() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.paused) || false; }
2569
- get buffered() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.buffered.length) || 0; }
2597
+ get buffered() {
2598
+ const { currentTime = 0, buffered: timeRange } = this.Instance || {};
2599
+ if (timeRange) {
2600
+ for (let i = 0; i < timeRange.length; i++) {
2601
+ if (timeRange.start(i) <= currentTime && timeRange.end(i) >= currentTime) {
2602
+ return timeRange.end(i);
2603
+ }
2604
+ }
2605
+ }
2606
+ return 0;
2607
+ }
2570
2608
  set referrerPolicy(e) { var _a; (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.setAttribute('referrerpolicy', e); }
2571
2609
  get referrerPolicy() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.getAttribute('referrerpolicy')) || 'origin'; }
2572
2610
  setProperty(key, value) {
@@ -4994,15 +5032,17 @@ const downloadFile = ({ url, header, withCredentials, timeout, success, fail, co
4994
5032
  }
4995
5033
  });
4996
5034
  });
4997
- result.headersReceive = task.onHeadersReceived;
4998
- result.progress = task.onProgressUpdate;
4999
- return new Proxy(result, {
5000
- get(target, prop) {
5001
- const object = prop in task ? task : target;
5002
- const value = object[prop];
5003
- return typeof value === 'function' ? value.bind(object) : value;
5004
- },
5035
+ result.headersReceive = task.onHeadersReceived.bind(task);
5036
+ result.progress = task.onProgressUpdate.bind(task);
5037
+ const properties = {};
5038
+ Object.keys(task).forEach(key => {
5039
+ properties[key] = {
5040
+ get() {
5041
+ return typeof task[key] === 'function' ? task[key].bind(task) : task[key];
5042
+ }
5043
+ };
5005
5044
  });
5045
+ return Object.defineProperties(result, properties);
5006
5046
  };
5007
5047
 
5008
5048
  // mDNS
@@ -5313,15 +5353,17 @@ const uploadFile = ({ url, filePath, name, header, formData, timeout, fileName,
5313
5353
  }
5314
5354
  });
5315
5355
  });
5316
- result.headersReceive = task.onHeadersReceived;
5317
- result.progress = task.onProgressUpdate;
5318
- return new Proxy(result, {
5319
- get(target, prop) {
5320
- const object = prop in task ? task : target;
5321
- const value = object[prop];
5322
- return typeof value === 'function' ? value.bind(object) : value;
5323
- },
5356
+ result.headersReceive = task.onHeadersReceived.bind(task);
5357
+ result.progress = task.onProgressUpdate.bind(task);
5358
+ const properties = {};
5359
+ Object.keys(task).forEach(key => {
5360
+ properties[key] = {
5361
+ get() {
5362
+ return typeof task[key] === 'function' ? task[key].bind(task) : task[key];
5363
+ }
5364
+ };
5324
5365
  });
5366
+ return Object.defineProperties(result, properties);
5325
5367
  };
5326
5368
 
5327
5369
  class SocketTask {
@@ -5496,7 +5538,6 @@ const faceVerifyForPay = /* @__PURE__ */ temporarilyNotSupport('faceVerifyForPay
5496
5538
  // 收藏
5497
5539
  const addVideoToFavorites = /* @__PURE__ */ temporarilyNotSupport('addVideoToFavorites');
5498
5540
  const addFileToFavorites = /* @__PURE__ */ temporarilyNotSupport('addFileToFavorites');
5499
- const checkIsAddedToMyMiniProgram = /* @__PURE__ */ temporarilyNotSupport('checkIsAddedToMyMiniProgram');
5500
5541
 
5501
5542
  // 微信群
5502
5543
  const getGroupEnterInfo = /* @__PURE__ */ temporarilyNotSupport('getGroupEnterInfo');
@@ -5513,6 +5554,15 @@ const pluginLogin = /* @__PURE__ */ temporarilyNotSupport('pluginLogin');
5513
5554
  const login = /* @__PURE__ */ temporarilyNotSupport('login');
5514
5555
  const checkSession = /* @__PURE__ */ temporarilyNotSupport('checkSession');
5515
5556
 
5557
+ // 我的小程序
5558
+ const checkIsAddedToMyMiniProgram = /* @__PURE__ */ temporarilyNotSupport('checkIsAddedToMyMiniProgram');
5559
+
5560
+ // 隐私信息授权
5561
+ const requirePrivacyAuthorize = /* @__PURE__ */ temporarilyNotSupport('requirePrivacyAuthorize');
5562
+ const openPrivacyContract = /* @__PURE__ */ temporarilyNotSupport('openPrivacyContract');
5563
+ const onNeedPrivacyAuthorization = /* @__PURE__ */ temporarilyNotSupport('onNeedPrivacyAuthorization');
5564
+ const getPrivacySetting = /* @__PURE__ */ temporarilyNotSupport('getPrivacySetting');
5565
+
5516
5566
  // 微信红包
5517
5567
  const showRedPackage = /* @__PURE__ */ temporarilyNotSupport('showRedPackage');
5518
5568
 
@@ -6046,11 +6096,16 @@ function getConfig() {
6046
6096
  return this.pxTransformConfig;
6047
6097
  return ((_a = taro).config || (_a.config = {}));
6048
6098
  }
6049
- const initPxTransform = function ({ designWidth = 750, deviceRatio = {
6099
+ const defaultDesignWidth = 750;
6100
+ const defaultDesignRatio = {
6050
6101
  640: 2.34 / 2,
6051
6102
  750: 1,
6052
6103
  828: 1.81 / 2
6053
- }, baseFontSize = 20, unitPrecision = 5, targetUnit = 'rem' }) {
6104
+ };
6105
+ const defaultBaseFontSize = 20;
6106
+ const defaultUnitPrecision = 5;
6107
+ const defaultTargetUnit = 'rem';
6108
+ const initPxTransform = function ({ designWidth = defaultDesignWidth, deviceRatio = defaultDesignRatio, baseFontSize = defaultBaseFontSize, unitPrecision = defaultUnitPrecision, targetUnit = defaultTargetUnit }) {
6054
6109
  const config = getConfig.call(this);
6055
6110
  config.designWidth = designWidth;
6056
6111
  config.deviceRatio = deviceRatio;
@@ -6060,16 +6115,19 @@ const initPxTransform = function ({ designWidth = 750, deviceRatio = {
6060
6115
  };
6061
6116
  const pxTransform = function (size = 0) {
6062
6117
  const config = getConfig.call(this);
6063
- const baseFontSize = config.baseFontSize || 20;
6118
+ const baseFontSize = config.baseFontSize || defaultBaseFontSize;
6119
+ const deviceRatio = config.deviceRatio || defaultDesignRatio;
6064
6120
  const designWidth = (((input = 0) => shared.isFunction(config.designWidth)
6065
6121
  ? config.designWidth(input)
6066
6122
  : config.designWidth))(size);
6067
6123
  if (!(designWidth in config.deviceRatio)) {
6068
6124
  throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`);
6069
6125
  }
6126
+ const targetUnit = config.targetUnit || defaultTargetUnit;
6127
+ const unitPrecision = config.unitPrecision || defaultUnitPrecision;
6070
6128
  const formatSize = ~~size;
6071
- let rootValue = 1 / config.deviceRatio[designWidth];
6072
- switch (config === null || config === void 0 ? void 0 : config.targetUnit) {
6129
+ let rootValue = 1 / deviceRatio[designWidth];
6130
+ switch (targetUnit) {
6073
6131
  case 'vw':
6074
6132
  rootValue = designWidth / 100;
6075
6133
  break;
@@ -6081,11 +6139,11 @@ const pxTransform = function (size = 0) {
6081
6139
  rootValue *= baseFontSize * 2;
6082
6140
  }
6083
6141
  let val = formatSize / rootValue;
6084
- if (config.unitPrecision >= 0 && config.unitPrecision <= 100) {
6142
+ if (unitPrecision >= 0 && unitPrecision <= 100) {
6085
6143
  // Number(val): 0.50000 => 0.5
6086
- val = Number(val.toFixed(config.unitPrecision));
6144
+ val = Number(val.toFixed(unitPrecision));
6087
6145
  }
6088
- return val + (config === null || config === void 0 ? void 0 : config.targetUnit);
6146
+ return val + targetUnit;
6089
6147
  };
6090
6148
  const canIUseWebp = function () {
6091
6149
  const canvas = document.createElement('canvas');
@@ -6281,6 +6339,7 @@ exports.getNFCAdapter = getNFCAdapter;
6281
6339
  exports.getNetworkType = getNetworkType;
6282
6340
  exports.getOpenUserInfo = getOpenUserInfo;
6283
6341
  exports.getPerformance = getPerformance;
6342
+ exports.getPrivacySetting = getPrivacySetting;
6284
6343
  exports.getRandomValues = getRandomValues;
6285
6344
  exports.getRealtimeLogManager = getRealtimeLogManager;
6286
6345
  exports.getRecorderManager = getRecorderManager;
@@ -6423,6 +6482,7 @@ exports.onLocalServiceResolveFail = onLocalServiceResolveFail;
6423
6482
  exports.onLocationChange = onLocationChange;
6424
6483
  exports.onLocationChangeError = onLocationChangeError;
6425
6484
  exports.onMemoryWarning = onMemoryWarning;
6485
+ exports.onNeedPrivacyAuthorization = onNeedPrivacyAuthorization;
6426
6486
  exports.onNetworkStatusChange = onNetworkStatusChange;
6427
6487
  exports.onNetworkWeakChange = onNetworkWeakChange;
6428
6488
  exports.onPageNotFound = onPageNotFound;
@@ -6454,6 +6514,7 @@ exports.openCustomerServiceChat = openCustomerServiceChat;
6454
6514
  exports.openDocument = openDocument;
6455
6515
  exports.openEmbeddedMiniProgram = openEmbeddedMiniProgram;
6456
6516
  exports.openLocation = openLocation;
6517
+ exports.openPrivacyContract = openPrivacyContract;
6457
6518
  exports.openQzonePublish = openQzonePublish;
6458
6519
  exports.openSetting = openSetting;
6459
6520
  exports.openSystemBluetoothSetting = openSystemBluetoothSetting;
@@ -6492,6 +6553,7 @@ exports.requestPolymerPayment = requestPolymerPayment;
6492
6553
  exports.requestSubscribeDeviceMessage = requestSubscribeDeviceMessage;
6493
6554
  exports.requestSubscribeMessage = requestSubscribeMessage;
6494
6555
  exports.requirePlugin = requirePlugin;
6556
+ exports.requirePrivacyAuthorize = requirePrivacyAuthorize;
6495
6557
  exports.reserveChannelsLive = reserveChannelsLive;
6496
6558
  exports.revokeBufferURL = revokeBufferURL;
6497
6559
  exports.saveFile = saveFile;