@tarojs/taro-h5 3.7.0-alpha.12 → 3.7.0-alpha.13

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.
@@ -63,7 +63,7 @@ declare class CanvasContext implements Taro.CanvasContext {
63
63
  clearRect(...args: any[]): void;
64
64
  clip(...args: any[]): void;
65
65
  closePath(...args: any[]): void;
66
- createPattern(image: string, repetition: keyof Taro.CanvasContext.Repetition): void;
66
+ createPattern(imageResource: string, repetition: keyof Taro.CanvasContext.Repetition): CanvasPattern | null | Promise<CanvasPattern | null>;
67
67
  /**
68
68
  * 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
69
69
  * @todo 每次 draw 都会读取 width 和 height
@@ -76,8 +76,19 @@ class CanvasContext {
76
76
  clearRect(...args) { return this.enqueueActions(this.ctx.clearRect, ...args); }
77
77
  clip(...args) { return this.enqueueActions(this.ctx.clip, ...args); }
78
78
  closePath(...args) { return this.enqueueActions(this.ctx.closePath, ...args); }
79
- createPattern(image, repetition) {
80
- return this.createPattern(image, repetition);
79
+ createPattern(imageResource, repetition) {
80
+ // 需要转换为 Image
81
+ if (typeof imageResource === 'string') {
82
+ const img = new Image();
83
+ img.src = imageResource;
84
+ return new Promise((resolve, reject) => {
85
+ img.onload = () => {
86
+ resolve(this.ctx.createPattern(img, repetition));
87
+ };
88
+ img.onerror = reject;
89
+ });
90
+ }
91
+ return this.ctx.createPattern(imageResource, repetition);
81
92
  }
82
93
  /**
83
94
  * 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
@@ -1 +1 @@
1
- {"version":3,"file":"CanvasContext.js","sources":["../../../src/api/canvas/CanvasContext.ts"],"sourcesContent":["import Taro, { CanvasGradient } from '@tarojs/api'\n\ninterface IAction {\n func: (...arr: any[]) => void\n args: any[]\n}\n\nconst TextBaseLineMap: Record<keyof Taro.CanvasContext.TextBaseline, CanvasTextBaseline> = {\n top: 'top',\n bottom: 'bottom',\n middle: 'middle',\n normal: 'alphabetic'\n}\n\nexport class CanvasContext implements Taro.CanvasContext {\n __raw__: CanvasRenderingContext2D\n actions: IAction[] = []\n\n constructor (canvas, ctx) {\n this.canvas = canvas\n this.ctx = ctx\n }\n\n set ctx (e: CanvasRenderingContext2D) {\n this.__raw__ = e\n }\n\n get ctx () {\n return this.__raw__ || {}\n }\n\n canvas: HTMLCanvasElement\n\n protected emptyActions () {\n this.actions.length = 0\n }\n\n protected enqueueActions (func: IAction['func'], ...args) {\n this.actions.push({\n func,\n args\n })\n }\n\n set fillStyle (e) { this.enqueueActions(() => { this.ctx.fillStyle = e }) }\n get fillStyle () { return this.ctx.fillStyle as string }\n set font (e) { this.ctx.font = e }\n get font () { return this.ctx.font }\n set globalAlpha (e) { this.enqueueActions(() => { this.ctx.globalAlpha = e }) }\n get globalAlpha () { return this.ctx.globalAlpha }\n set globalCompositeOperation (e) { this.enqueueActions(() => { this.ctx.globalCompositeOperation = e }) }\n get globalCompositeOperation () { return this.ctx.globalCompositeOperation }\n set lineCap (e) { this.enqueueActions(() => { this.ctx.lineCap = e }) }\n get lineCap () { return this.ctx.lineCap }\n set lineDashOffset (e) { this.enqueueActions(() => { this.ctx.lineDashOffset = e }) }\n get lineDashOffset () { return this.ctx.lineDashOffset }\n set lineJoin (e) { this.enqueueActions(() => { this.ctx.lineJoin = e }) }\n get lineJoin () { return this.ctx.lineJoin }\n set lineWidth (e) { this.enqueueActions(() => { this.ctx.lineWidth = e }) }\n get lineWidth () { return this.ctx.lineWidth }\n set miterLimit (e) { this.enqueueActions(() => { this.ctx.miterLimit = e }) }\n get miterLimit () { return this.ctx.miterLimit }\n set shadowBlur (e) { this.enqueueActions(() => { this.ctx.shadowBlur = e }) }\n get shadowBlur () { return this.ctx.shadowBlur }\n set shadowColor (e) { this.enqueueActions(() => { this.ctx.shadowColor = e }) }\n get shadowColor () { return this.ctx.shadowColor }\n set shadowOffsetX (e) { this.enqueueActions(() => { this.ctx.shadowOffsetX = e }) }\n get shadowOffsetX () { return this.ctx.shadowOffsetX }\n set shadowOffsetY (e) { this.enqueueActions(() => { this.ctx.shadowOffsetY = e }) }\n get shadowOffsetY () { return this.ctx.shadowOffsetY }\n set strokeStyle (e) { this.enqueueActions(() => { this.ctx.strokeStyle = e }) }\n get strokeStyle () { return this.ctx.strokeStyle as string }\n /** 小程序文档中不包括 ↓↓↓ */\n set textAlign (e) { this.ctx.textAlign = e }\n get textAlign () { return this.ctx.textAlign }\n set textBaseline (e) { this.ctx.textBaseline = e }\n get textBaseline () { return this.ctx.textBaseline }\n set direction (e) { this.ctx.direction = e }\n get direction () { return this.ctx.direction }\n set imageSmoothingEnabled (e) { this.enqueueActions(() => { this.ctx.imageSmoothingEnabled = e }) }\n get imageSmoothingEnabled () { return this.ctx.imageSmoothingEnabled }\n set imageSmoothingQuality (e) { this.enqueueActions(() => { this.ctx.imageSmoothingQuality = e }) }\n get imageSmoothingQuality () { return this.ctx.imageSmoothingQuality }\n set filter (e) { this.enqueueActions(() => { this.ctx.filter = e }) }\n get filter () { return this.ctx.filter }\n /** 小程序文档中不包括 ↑↑↑ */\n\n arc (...args) { return this.enqueueActions(this.ctx.arc, ...args) }\n arcTo (...args) { return this.enqueueActions(this.ctx.arcTo, ...args) }\n beginPath (...args) { return this.enqueueActions(this.ctx.beginPath, ...args) }\n bezierCurveTo (...args) { return this.enqueueActions(this.ctx.bezierCurveTo, ...args) }\n clearRect (...args) { return this.enqueueActions(this.ctx.clearRect, ...args) }\n clip (...args) { return this.enqueueActions(this.ctx.clip, ...args) }\n closePath (...args) { return this.enqueueActions(this.ctx.closePath, ...args) }\n\n createPattern (image: string, repetition: keyof Taro.CanvasContext.Repetition): void {\n return this.createPattern(image, repetition)\n }\n\n /**\n * 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。\n * @todo 每次 draw 都会读取 width 和 height\n */\n async draw (reserve?: boolean, callback?: (...args: any[]) => any): Promise<void> {\n try {\n if (!reserve) {\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)\n }\n\n // 部分 action 是异步的\n for (const { func, args } of this.actions) {\n await func.apply(this.ctx, args)\n }\n\n this.emptyActions()\n callback && callback()\n } catch (e) {\n /* eslint-disable no-throw-literal */\n throw {\n errMsg: e.message\n }\n }\n }\n\n drawImage (imageResource: string, ...extra: any[]): void {\n type TExtra = [number, number]\n this.enqueueActions(() => {\n // 需要转换为 Image\n if (typeof imageResource === 'string') {\n const img = new Image()\n img.src = imageResource\n return new Promise<void>((resolve, reject) => {\n img.onload = () => {\n this.ctx.drawImage(img, ...extra as TExtra)\n resolve()\n }\n img.onerror = reject\n })\n }\n\n this.ctx.drawImage(imageResource, ...extra as TExtra)\n })\n }\n\n fill (...args) { return this.enqueueActions(this.ctx.fill, ...args) }\n fillRect (...args) { return this.enqueueActions(this.ctx.fillRect, ...args) }\n fillText (...args) { return this.enqueueActions(this.ctx.fillText, ...args) }\n lineTo (...args) { return this.enqueueActions(this.ctx.lineTo, ...args) }\n moveTo (...args) { return this.enqueueActions(this.ctx.moveTo, ...args) }\n quadraticCurveTo (...args) { return this.enqueueActions(this.ctx.quadraticCurveTo, ...args) }\n rect (...args) { return this.enqueueActions(this.ctx.rect, ...args) }\n restore (...args) { return this.enqueueActions(this.ctx.restore, ...args) }\n rotate (...args) { return this.enqueueActions(this.ctx.rotate, ...args) }\n save (...args) { return this.enqueueActions(this.ctx.save, ...args) }\n scale (...args) { return this.enqueueActions(this.ctx.scale, ...args) }\n\n setFillStyle (color: string | CanvasGradient): void {\n this.enqueueActions(() => { this.ctx.fillStyle = color })\n }\n\n setFontSize (fontSize: number): void {\n this.font = `${fontSize}px`\n }\n\n setGlobalAlpha (alpha: number): void {\n this.globalAlpha = alpha\n }\n\n setLineCap (lineCap: keyof Taro.CanvasContext.LineCap): void {\n this.lineCap = lineCap\n }\n\n setLineDash (pattern: number[], offset: number): void {\n this.enqueueActions(() => {\n this.ctx.setLineDash(pattern)\n this.ctx.lineDashOffset = offset\n })\n }\n\n setLineJoin (lineJoin: keyof Taro.CanvasContext.LineJoin): void {\n this.lineJoin = lineJoin\n }\n\n setLineWidth (lineWidth: number): void {\n this.lineWidth = lineWidth\n }\n\n setMiterLimit (miterLimit: number): void {\n this.miterLimit = miterLimit\n }\n\n setShadow (offsetX: number, offsetY: number, blur: number, color: string): void {\n this.enqueueActions(() => {\n this.ctx.shadowOffsetX = offsetX\n this.ctx.shadowOffsetY = offsetY\n this.ctx.shadowColor = color\n this.ctx.shadowBlur = blur\n })\n }\n\n setStrokeStyle (color: string | CanvasGradient): void {\n this.enqueueActions(() => { this.ctx.strokeStyle = color })\n }\n\n setTextAlign (align: keyof Taro.CanvasContext.Align): void {\n this.textAlign = align\n }\n\n setTextBaseline (textBaseline: keyof Taro.CanvasContext.TextBaseline): void {\n this.textBaseline = TextBaseLineMap[textBaseline] || 'alphabetic'\n }\n\n setTransform (...args) { return this.enqueueActions(this.ctx.setTransform, ...args) }\n stroke (...args) { return this.enqueueActions(this.ctx.stroke, ...args) }\n strokeRect (...args) { return this.enqueueActions(this.ctx.strokeRect, ...args) }\n strokeText (...args) { return this.enqueueActions(this.ctx.strokeText, ...args) }\n transform (...args) { return this.enqueueActions(this.ctx.transform, ...args) }\n translate (...args) { return this.enqueueActions(this.ctx.translate, ...args) }\n\n measureText (text: string): TextMetrics {\n return this.ctx.measureText(text)\n }\n\n createCircularGradient (x: number, y: number, r: number): CanvasGradient {\n const radialGradient = this.ctx.createRadialGradient(x, y, 0, x, y, r)\n\n return radialGradient\n }\n\n createLinearGradient (x0: number, y0: number, x1: number, y1: number): CanvasGradient {\n return this.ctx.createLinearGradient(x0, y0, x1, y1)\n }\n}\n"],"names":[],"mappings":";;AAOA,MAAM,eAAe,GAAsE;AACzF,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,MAAM,EAAE,YAAY;CACrB,CAAA;MAEY,aAAa,CAAA;IAIxB,WAAa,CAAA,MAA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U,EAAE,GAAG,IAAI,CAAC,CAAA,EAAE;IACjF,UAAU,CAAE,GAAG,IAAI,EAAA,EAAI,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,CAAA,EAAE;IACjF,SAAS,CAAE,GAAG,IAAI,EAAA,EAAI,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAA,EAAE;IAC/E,SAAS,CAAE,GAAG,IAAI,EAAA,EAAI,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAA,EAAE;AAE/E,IAAA,WAAW,CAAE,IAAY,EAAA;QACvB,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;KAClC;AAED,IAAA,sBAAsB,CAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAA;QACrD,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AAEtE,QAAA,OAAO,cAAc,CAAA;KACtB;AAED,IAAA,oBAAoB,CAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAA;AAClE,QAAA,OAAO,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;KACrD;AACF;;;;"}
1
+ {"version":3,"file":"CanvasContext.js","sources":["../../../src/api/canvas/CanvasContext.ts"],"sourcesContent":["import Taro, { CanvasGradient } from '@tarojs/api'\n\ninterface IAction {\n func: (...arr: any[]) => void\n args: any[]\n}\n\nconst TextBaseLineMap: Record<keyof Taro.CanvasContext.TextBaseline, CanvasTextBaseline> = {\n top: 'top',\n bottom: 'bottom',\n middle: 'middle',\n normal: 'alphabetic'\n}\n\nexport class CanvasContext implements Taro.CanvasContext {\n __raw__: CanvasRenderingContext2D\n actions: IAction[] = []\n\n constructor (canvas, ctx) {\n this.canvas = canvas\n this.ctx = ctx\n }\n\n set ctx (e: CanvasRenderingContext2D) {\n this.__raw__ = e\n }\n\n get ctx () {\n return this.__raw__ || {}\n }\n\n canvas: HTMLCanvasElement\n\n protected emptyActions () {\n this.actions.length = 0\n }\n\n protected enqueueActions (func: IAction['func'], ...args) {\n this.actions.push({\n func,\n args\n })\n }\n\n set fillStyle (e) { this.enqueueActions(() => { this.ctx.fillStyle = e }) }\n get fillStyle () { return this.ctx.fillStyle as string }\n set font (e) { this.ctx.font = e }\n get font () { return this.ctx.font }\n set globalAlpha (e) { this.enqueueActions(() => { this.ctx.globalAlpha = e }) }\n get globalAlpha () { return this.ctx.globalAlpha }\n set globalCompositeOperation (e) { this.enqueueActions(() => { this.ctx.globalCompositeOperation = e }) }\n get globalCompositeOperation () { return this.ctx.globalCompositeOperation }\n set lineCap (e) { this.enqueueActions(() => { this.ctx.lineCap = e }) }\n get lineCap () { return this.ctx.lineCap }\n set lineDashOffset (e) { this.enqueueActions(() => { this.ctx.lineDashOffset = e }) }\n get lineDashOffset () { return this.ctx.lineDashOffset }\n set lineJoin (e) { this.enqueueActions(() => { this.ctx.lineJoin = e }) }\n get lineJoin () { return this.ctx.lineJoin }\n set lineWidth (e) { this.enqueueActions(() => { this.ctx.lineWidth = e }) }\n get lineWidth () { return this.ctx.lineWidth }\n set miterLimit (e) { this.enqueueActions(() => { this.ctx.miterLimit = e }) }\n get miterLimit () { return this.ctx.miterLimit }\n set shadowBlur (e) { this.enqueueActions(() => { this.ctx.shadowBlur = e }) }\n get shadowBlur () { return this.ctx.shadowBlur }\n set shadowColor (e) { this.enqueueActions(() => { this.ctx.shadowColor = e }) }\n get shadowColor () { return this.ctx.shadowColor }\n set shadowOffsetX (e) { this.enqueueActions(() => { this.ctx.shadowOffsetX = e }) }\n get shadowOffsetX () { return this.ctx.shadowOffsetX }\n set shadowOffsetY (e) { this.enqueueActions(() => { this.ctx.shadowOffsetY = e }) }\n get shadowOffsetY () { return this.ctx.shadowOffsetY }\n set strokeStyle (e) { this.enqueueActions(() => { this.ctx.strokeStyle = e }) }\n get strokeStyle () { return this.ctx.strokeStyle as string }\n /** 小程序文档中不包括 ↓↓↓ */\n set textAlign (e) { this.ctx.textAlign = e }\n get textAlign () { return this.ctx.textAlign }\n set textBaseline (e) { this.ctx.textBaseline = e }\n get textBaseline () { return this.ctx.textBaseline }\n set direction (e) { this.ctx.direction = e }\n get direction () { return this.ctx.direction }\n set imageSmoothingEnabled (e) { this.enqueueActions(() => { this.ctx.imageSmoothingEnabled = e }) }\n get imageSmoothingEnabled () { return this.ctx.imageSmoothingEnabled }\n set imageSmoothingQuality (e) { this.enqueueActions(() => { this.ctx.imageSmoothingQuality = e }) }\n get imageSmoothingQuality () { return this.ctx.imageSmoothingQuality }\n set filter (e) { this.enqueueActions(() => { this.ctx.filter = e }) }\n get filter () { return this.ctx.filter }\n /** 小程序文档中不包括 ↑↑↑ */\n\n arc (...args) { return this.enqueueActions(this.ctx.arc, ...args) }\n arcTo (...args) { return this.enqueueActions(this.ctx.arcTo, ...args) }\n beginPath (...args) { return this.enqueueActions(this.ctx.beginPath, ...args) }\n bezierCurveTo (...args) { return this.enqueueActions(this.ctx.bezierCurveTo, ...args) }\n clearRect (...args) { return this.enqueueActions(this.ctx.clearRect, ...args) }\n clip (...args) { return this.enqueueActions(this.ctx.clip, ...args) }\n closePath (...args) { return this.enqueueActions(this.ctx.closePath, ...args) }\n\n createPattern (imageResource: string, repetition: keyof Taro.CanvasContext.Repetition): CanvasPattern | null | Promise<CanvasPattern | null> {\n // 需要转换为 Image\n if (typeof imageResource === 'string') {\n const img = new Image()\n img.src = imageResource\n return new Promise<CanvasPattern | null>((resolve, reject) => {\n img.onload = () => {\n resolve(this.ctx.createPattern(img, repetition))\n }\n img.onerror = reject\n })\n }\n\n return this.ctx.createPattern(imageResource, repetition)\n }\n\n /**\n * 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。\n * @todo 每次 draw 都会读取 width 和 height\n */\n async draw (reserve?: boolean, callback?: (...args: any[]) => any): Promise<void> {\n try {\n if (!reserve) {\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)\n }\n\n // 部分 action 是异步的\n for (const { func, args } of this.actions) {\n await func.apply(this.ctx, args)\n }\n\n this.emptyActions()\n callback && callback()\n } catch (e) {\n /* eslint-disable no-throw-literal */\n throw {\n errMsg: e.message\n }\n }\n }\n\n drawImage (imageResource: string, ...extra: any[]): void {\n type TExtra = [number, number]\n this.enqueueActions(() => {\n // 需要转换为 Image\n if (typeof imageResource === 'string') {\n const img = new Image()\n img.src = imageResource\n return new Promise<void>((resolve, reject) => {\n img.onload = () => {\n this.ctx.drawImage(img, ...extra as TExtra)\n resolve()\n }\n img.onerror = reject\n })\n }\n\n this.ctx.drawImage(imageResource, ...extra as TExtra)\n })\n }\n\n fill (...args) { return this.enqueueActions(this.ctx.fill, ...args) }\n fillRect (...args) { return this.enqueueActions(this.ctx.fillRect, ...args) }\n fillText (...args) { return this.enqueueActions(this.ctx.fillText, ...args) }\n lineTo (...args) { return this.enqueueActions(this.ctx.lineTo, ...args) }\n moveTo (...args) { return this.enqueueActions(this.ctx.moveTo, ...args) }\n quadraticCurveTo (...args) { return this.enqueueActions(this.ctx.quadraticCurveTo, ...args) }\n rect (...args) { return this.enqueueActions(this.ctx.rect, ...args) }\n restore (...args) { return this.enqueueActions(this.ctx.restore, ...args) }\n rotate (...args) { return this.enqueueActions(this.ctx.rotate, ...args) }\n save (...args) { return this.enqueueActions(this.ctx.save, ...args) }\n scale (...args) { return this.enqueueActions(this.ctx.scale, ...args) }\n\n setFillStyle (color: string | CanvasGradient): void {\n this.enqueueActions(() => { this.ctx.fillStyle = color })\n }\n\n setFontSize (fontSize: number): void {\n this.font = `${fontSize}px`\n }\n\n setGlobalAlpha (alpha: number): void {\n this.globalAlpha = alpha\n }\n\n setLineCap (lineCap: keyof Taro.CanvasContext.LineCap): void {\n this.lineCap = lineCap\n }\n\n setLineDash (pattern: number[], offset: number): void {\n this.enqueueActions(() => {\n this.ctx.setLineDash(pattern)\n this.ctx.lineDashOffset = offset\n })\n }\n\n setLineJoin (lineJoin: keyof Taro.CanvasContext.LineJoin): void {\n this.lineJoin = lineJoin\n }\n\n setLineWidth (lineWidth: number): void {\n this.lineWidth = lineWidth\n }\n\n setMiterLimit (miterLimit: number): void {\n this.miterLimit = miterLimit\n }\n\n setShadow (offsetX: number, offsetY: number, blur: number, color: string): void {\n this.enqueueActions(() => {\n this.ctx.shadowOffsetX = offsetX\n this.ctx.shadowOffsetY = offsetY\n this.ctx.shadowColor = color\n this.ctx.shadowBlur = blur\n })\n }\n\n setStrokeStyle (color: string | CanvasGradient): void {\n this.enqueueActions(() => { this.ctx.strokeStyle = color })\n }\n\n setTextAlign (align: keyof Taro.CanvasContext.Align): void {\n this.textAlign = align\n }\n\n setTextBaseline (textBaseline: keyof Taro.CanvasContext.TextBaseline): void {\n this.textBaseline = TextBaseLineMap[textBaseline] || 'alphabetic'\n }\n\n setTransform (...args) { return this.enqueueActions(this.ctx.setTransform, ...args) }\n stroke (...args) { return this.enqueueActions(this.ctx.stroke, ...args) }\n strokeRect (...args) { return this.enqueueActions(this.ctx.strokeRect, ...args) }\n strokeText (...args) { return this.enqueueActions(this.ctx.strokeText, ...args) }\n transform (...args) { return this.enqueueActions(this.ctx.transform, ...args) }\n translate (...args) { return this.enqueueActions(this.ctx.translate, ...args) }\n\n measureText (text: string): TextMetrics {\n return this.ctx.measureText(text)\n }\n\n createCircularGradient (x: number, y: number, r: number): CanvasGradient {\n const radialGradient = this.ctx.createRadialGradient(x, y, 0, x, y, r)\n\n return radialGradient\n }\n\n createLinearGradient (x0: number, y0: number, x1: number, y1: number): CanvasGradient {\n return this.ctx.createLinearGradient(x0, y0, x1, y1)\n }\n}\n"],"names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,CAAA;KAClC;AAED,IAAA,sBAAsB,CAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAA;QACrD,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AAEtE,QAAA,OAAO,cAAc,CAAA;KACtB;AAED,IAAA,oBAAoB,CAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAA;AAClE,QAAA,OAAO,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;KACrD;AACF;;;;"}
package/dist/api/index.js CHANGED
@@ -99,11 +99,13 @@ export { getChannelsLiveInfo, getChannelsLiveNoticeInfo, getChannelsShareKey, op
99
99
  export { openCustomerServiceChat } from './open-api/customer-service.js';
100
100
  export { getDeviceVoIPList, requestDeviceVoIP } from './open-api/device-voip.js';
101
101
  export { checkIsSupportFacialRecognition, faceVerifyForPay, startFacialRecognitionVerify, startFacialRecognitionVerifyAndUploadVideo } from './open-api/facial.js';
102
- export { addFileToFavorites, addVideoToFavorites, checkIsAddedToMyMiniProgram } from './open-api/favorites.js';
102
+ export { addFileToFavorites, addVideoToFavorites } from './open-api/favorites.js';
103
103
  export { getGroupEnterInfo } from './open-api/group.js';
104
104
  export { chooseInvoice, chooseInvoiceTitle } from './open-api/invoice.js';
105
105
  export { chooseLicensePlate } from './open-api/license-plate.js';
106
106
  export { checkSession, login, pluginLogin } from './open-api/login.js';
107
+ export { checkIsAddedToMyMiniProgram } from './open-api/my-miniprogram.js';
108
+ export { getPrivacySetting, onNeedPrivacyAuthorization, openPrivacyContract, requirePrivacyAuthorize } from './open-api/privacy.js';
107
109
  export { showRedPackage } from './open-api/red-package.js';
108
110
  export { getSetting, openSetting } from './open-api/settings.js';
109
111
  export { checkIsSoterEnrolledInDevice, checkIsSupportSoterAuthentication, startSoterAuthentication } from './open-api/soter.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,3 @@
1
1
  declare const addVideoToFavorites: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
2
2
  declare const addFileToFavorites: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
3
- declare const checkIsAddedToMyMiniProgram: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
4
- export { addVideoToFavorites, addFileToFavorites, checkIsAddedToMyMiniProgram };
3
+ export { addVideoToFavorites, addFileToFavorites };
@@ -3,7 +3,6 @@ import { temporarilyNotSupport } from '../../utils/index.js';
3
3
  // 收藏
4
4
  const addVideoToFavorites = /* @__PURE__ */ temporarilyNotSupport('addVideoToFavorites');
5
5
  const addFileToFavorites = /* @__PURE__ */ temporarilyNotSupport('addFileToFavorites');
6
- const checkIsAddedToMyMiniProgram = /* @__PURE__ */ temporarilyNotSupport('checkIsAddedToMyMiniProgram');
7
6
 
8
- export { addFileToFavorites, addVideoToFavorites, checkIsAddedToMyMiniProgram };
7
+ export { addFileToFavorites, addVideoToFavorites };
9
8
  //# sourceMappingURL=favorites.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"favorites.js","sources":["../../../src/api/open-api/favorites.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 收藏\nexport const addVideoToFavorites = /* @__PURE__ */ temporarilyNotSupport('addVideoToFavorites')\nexport const addFileToFavorites = /* @__PURE__ */ temporarilyNotSupport('addFileToFavorites')\nexport const checkIsAddedToMyMiniProgram = /* @__PURE__ */ temporarilyNotSupport('checkIsAddedToMyMiniProgram')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,mBAAmB,mBAAmB,qBAAqB,CAAC,qBAAqB,EAAC;AAClF,MAAA,kBAAkB,mBAAmB,qBAAqB,CAAC,oBAAoB,EAAC;AAChF,MAAA,2BAA2B,mBAAmB,qBAAqB,CAAC,6BAA6B;;;;"}
1
+ {"version":3,"file":"favorites.js","sources":["../../../src/api/open-api/favorites.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 收藏\nexport const addVideoToFavorites = /* @__PURE__ */ temporarilyNotSupport('addVideoToFavorites')\nexport const addFileToFavorites = /* @__PURE__ */ temporarilyNotSupport('addFileToFavorites')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,mBAAmB,mBAAmB,qBAAqB,CAAC,qBAAqB,EAAC;AAClF,MAAA,kBAAkB,mBAAmB,qBAAqB,CAAC,oBAAoB;;;;"}
@@ -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,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;AAEK,MAAA,eAAe,GAAG,UAAU,EAChC,WAAW,GAAG,GAAG,EACjB,WAAW,GAAG;IACZ,GAAG,EAAE,IAAI,GAAG,CAAC;AACb,IAAA,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,IAAI,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;"}
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;IAC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,IAAA,IAAI,aAAa,IAAI,CAAC,IAAI,aAAa,IAAI,GAAG,EAAE;;QAE9C,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAA;AACzC,KAAA;IACD,OAAO,GAAG,GAAG,UAAU,CAAA;AACzB,EAAC;AAED,MAAM,WAAW,GAAG,YAAA;IAClB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;AAC/C,IAAA,OAAO,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;AACxE,EAAC;AAED,MAAM,UAAU,GAAG,YAAA;IACjB,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,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;;;;"}
@@ -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 中。
@@ -5500,7 +5511,6 @@ const faceVerifyForPay = /* @__PURE__ */ temporarilyNotSupport('faceVerifyForPay
5500
5511
  // 收藏
5501
5512
  const addVideoToFavorites = /* @__PURE__ */ temporarilyNotSupport('addVideoToFavorites');
5502
5513
  const addFileToFavorites = /* @__PURE__ */ temporarilyNotSupport('addFileToFavorites');
5503
- const checkIsAddedToMyMiniProgram = /* @__PURE__ */ temporarilyNotSupport('checkIsAddedToMyMiniProgram');
5504
5514
 
5505
5515
  // 微信群
5506
5516
  const getGroupEnterInfo = /* @__PURE__ */ temporarilyNotSupport('getGroupEnterInfo');
@@ -5517,6 +5527,15 @@ const pluginLogin = /* @__PURE__ */ temporarilyNotSupport('pluginLogin');
5517
5527
  const login = /* @__PURE__ */ temporarilyNotSupport('login');
5518
5528
  const checkSession = /* @__PURE__ */ temporarilyNotSupport('checkSession');
5519
5529
 
5530
+ // 我的小程序
5531
+ const checkIsAddedToMyMiniProgram = /* @__PURE__ */ temporarilyNotSupport('checkIsAddedToMyMiniProgram');
5532
+
5533
+ // 隐私信息授权
5534
+ const requirePrivacyAuthorize = /* @__PURE__ */ temporarilyNotSupport('requirePrivacyAuthorize');
5535
+ const openPrivacyContract = /* @__PURE__ */ temporarilyNotSupport('openPrivacyContract');
5536
+ const onNeedPrivacyAuthorization = /* @__PURE__ */ temporarilyNotSupport('onNeedPrivacyAuthorization');
5537
+ const getPrivacySetting = /* @__PURE__ */ temporarilyNotSupport('getPrivacySetting');
5538
+
5520
5539
  // 微信红包
5521
5540
  const showRedPackage = /* @__PURE__ */ temporarilyNotSupport('showRedPackage');
5522
5541
 
@@ -6050,11 +6069,16 @@ function getConfig() {
6050
6069
  return this.pxTransformConfig;
6051
6070
  return ((_a = taro).config || (_a.config = {}));
6052
6071
  }
6053
- const initPxTransform = function ({ designWidth = 750, deviceRatio = {
6072
+ const defaultDesignWidth = 750;
6073
+ const defaultDesignRatio = {
6054
6074
  640: 2.34 / 2,
6055
6075
  750: 1,
6056
6076
  828: 1.81 / 2
6057
- }, baseFontSize = 20, unitPrecision = 5, targetUnit = 'rem' }) {
6077
+ };
6078
+ const defaultBaseFontSize = 20;
6079
+ const defaultUnitPrecision = 5;
6080
+ const defaultTargetUnit = 'rem';
6081
+ const initPxTransform = function ({ designWidth = defaultDesignWidth, deviceRatio = defaultDesignRatio, baseFontSize = defaultBaseFontSize, unitPrecision = defaultUnitPrecision, targetUnit = defaultTargetUnit }) {
6058
6082
  const config = getConfig.call(this);
6059
6083
  config.designWidth = designWidth;
6060
6084
  config.deviceRatio = deviceRatio;
@@ -6064,16 +6088,19 @@ const initPxTransform = function ({ designWidth = 750, deviceRatio = {
6064
6088
  };
6065
6089
  const pxTransform = function (size = 0) {
6066
6090
  const config = getConfig.call(this);
6067
- const baseFontSize = config.baseFontSize || 20;
6091
+ const baseFontSize = config.baseFontSize || defaultBaseFontSize;
6092
+ const deviceRatio = config.deviceRatio || defaultDesignRatio;
6068
6093
  const designWidth = (((input = 0) => shared.isFunction(config.designWidth)
6069
6094
  ? config.designWidth(input)
6070
6095
  : config.designWidth))(size);
6071
6096
  if (!(designWidth in config.deviceRatio)) {
6072
6097
  throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`);
6073
6098
  }
6099
+ const targetUnit = config.targetUnit || defaultTargetUnit;
6100
+ const unitPrecision = config.unitPrecision || defaultUnitPrecision;
6074
6101
  const formatSize = ~~size;
6075
- let rootValue = 1 / config.deviceRatio[designWidth];
6076
- switch (config === null || config === void 0 ? void 0 : config.targetUnit) {
6102
+ let rootValue = 1 / deviceRatio[designWidth];
6103
+ switch (targetUnit) {
6077
6104
  case 'vw':
6078
6105
  rootValue = designWidth / 100;
6079
6106
  break;
@@ -6085,11 +6112,11 @@ const pxTransform = function (size = 0) {
6085
6112
  rootValue *= baseFontSize * 2;
6086
6113
  }
6087
6114
  let val = formatSize / rootValue;
6088
- if (config.unitPrecision >= 0 && config.unitPrecision <= 100) {
6115
+ if (unitPrecision >= 0 && unitPrecision <= 100) {
6089
6116
  // Number(val): 0.50000 => 0.5
6090
- val = Number(val.toFixed(config.unitPrecision));
6117
+ val = Number(val.toFixed(unitPrecision));
6091
6118
  }
6092
- return val + (config === null || config === void 0 ? void 0 : config.targetUnit);
6119
+ return val + targetUnit;
6093
6120
  };
6094
6121
  const canIUseWebp = function () {
6095
6122
  const canvas = document.createElement('canvas');
@@ -6285,6 +6312,7 @@ exports.getNFCAdapter = getNFCAdapter;
6285
6312
  exports.getNetworkType = getNetworkType;
6286
6313
  exports.getOpenUserInfo = getOpenUserInfo;
6287
6314
  exports.getPerformance = getPerformance;
6315
+ exports.getPrivacySetting = getPrivacySetting;
6288
6316
  exports.getRandomValues = getRandomValues;
6289
6317
  exports.getRealtimeLogManager = getRealtimeLogManager;
6290
6318
  exports.getRecorderManager = getRecorderManager;
@@ -6427,6 +6455,7 @@ exports.onLocalServiceResolveFail = onLocalServiceResolveFail;
6427
6455
  exports.onLocationChange = onLocationChange;
6428
6456
  exports.onLocationChangeError = onLocationChangeError;
6429
6457
  exports.onMemoryWarning = onMemoryWarning;
6458
+ exports.onNeedPrivacyAuthorization = onNeedPrivacyAuthorization;
6430
6459
  exports.onNetworkStatusChange = onNetworkStatusChange;
6431
6460
  exports.onNetworkWeakChange = onNetworkWeakChange;
6432
6461
  exports.onPageNotFound = onPageNotFound;
@@ -6458,6 +6487,7 @@ exports.openCustomerServiceChat = openCustomerServiceChat;
6458
6487
  exports.openDocument = openDocument;
6459
6488
  exports.openEmbeddedMiniProgram = openEmbeddedMiniProgram;
6460
6489
  exports.openLocation = openLocation;
6490
+ exports.openPrivacyContract = openPrivacyContract;
6461
6491
  exports.openQzonePublish = openQzonePublish;
6462
6492
  exports.openSetting = openSetting;
6463
6493
  exports.openSystemBluetoothSetting = openSystemBluetoothSetting;
@@ -6496,6 +6526,7 @@ exports.requestPolymerPayment = requestPolymerPayment;
6496
6526
  exports.requestSubscribeDeviceMessage = requestSubscribeDeviceMessage;
6497
6527
  exports.requestSubscribeMessage = requestSubscribeMessage;
6498
6528
  exports.requirePlugin = requirePlugin;
6529
+ exports.requirePrivacyAuthorize = requirePrivacyAuthorize;
6499
6530
  exports.reserveChannelsLive = reserveChannelsLive;
6500
6531
  exports.revokeBufferURL = revokeBufferURL;
6501
6532
  exports.saveFile = saveFile;