@tarojs/taro-h5 3.7.0-alpha.2 → 3.7.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/ad/index.js +2 -2
- package/dist/api/ad/index.js.map +1 -1
- package/dist/api/ai/facial.js +3 -3
- package/dist/api/ai/facial.js.map +1 -1
- package/dist/api/ai/index.d.ts +3 -2
- package/dist/api/ai/index.js +1 -0
- package/dist/api/ai/index.js.map +1 -1
- package/dist/api/ai/inference.d.ts +3 -0
- package/dist/api/ai/inference.js +8 -0
- package/dist/api/ai/inference.js.map +1 -0
- package/dist/api/ai/visual.js +2 -2
- package/dist/api/ai/visual.js.map +1 -1
- package/dist/api/alipay/index.d.ts +2 -1
- package/dist/api/alipay/index.js +3 -2
- package/dist/api/alipay/index.js.map +1 -1
- package/dist/api/base/crypto.js +1 -1
- package/dist/api/base/crypto.js.map +1 -1
- package/dist/api/base/debug.js +3 -3
- package/dist/api/base/debug.js.map +1 -1
- package/dist/api/base/index.d.ts +8 -9
- package/dist/api/base/index.js +6 -6
- package/dist/api/base/index.js.map +1 -1
- package/dist/api/base/performance.d.ts +4 -1
- package/dist/api/base/performance.js +6 -3
- package/dist/api/base/performance.js.map +1 -1
- package/dist/api/base/system.d.ts +4 -1
- package/dist/api/base/system.js +6 -3
- package/dist/api/base/system.js.map +1 -1
- package/dist/api/base/update.js +2 -2
- package/dist/api/base/update.js.map +1 -1
- package/dist/api/base/weapp/app-event.d.ts +13 -11
- package/dist/api/base/weapp/app-event.js +84 -14
- package/dist/api/base/weapp/app-event.js.map +1 -1
- package/dist/api/canvas/CanvasContext.d.ts +7 -4
- package/dist/api/canvas/CanvasContext.js +23 -5
- package/dist/api/canvas/CanvasContext.js.map +1 -1
- package/dist/api/canvas/index.d.ts +4 -4
- package/dist/api/canvas/index.js +1 -1
- package/dist/api/canvas/index.js.map +1 -1
- package/dist/api/data-analysis/index.js +4 -4
- package/dist/api/data-analysis/index.js.map +1 -1
- package/dist/api/device/accelerometer.js +1 -2
- package/dist/api/device/accelerometer.js.map +1 -1
- package/dist/api/device/accessibility.js +1 -1
- package/dist/api/device/accessibility.js.map +1 -1
- package/dist/api/device/battery.js +1 -1
- package/dist/api/device/battery.js.map +1 -1
- package/dist/api/device/bluetooth-ble.js +16 -16
- package/dist/api/device/bluetooth-ble.js.map +1 -1
- package/dist/api/device/bluetooth-peripheral.js +3 -3
- package/dist/api/device/bluetooth-peripheral.js.map +1 -1
- package/dist/api/device/bluetooth.js +13 -13
- package/dist/api/device/bluetooth.js.map +1 -1
- package/dist/api/device/calendar.d.ts +3 -2
- package/dist/api/device/calendar.js +142 -3
- package/dist/api/device/calendar.js.map +1 -1
- package/dist/api/device/compass.js +1 -2
- package/dist/api/device/compass.js.map +1 -1
- package/dist/api/device/contact.js +2 -2
- package/dist/api/device/contact.js.map +1 -1
- package/dist/api/device/crypto.js +1 -1
- package/dist/api/device/crypto.js.map +1 -1
- package/dist/api/device/gyroscope.js +4 -4
- package/dist/api/device/gyroscope.js.map +1 -1
- package/dist/api/device/iBeacon.js +7 -7
- package/dist/api/device/iBeacon.js.map +1 -1
- package/dist/api/device/index.d.ts +24 -23
- package/dist/api/device/index.js +3 -2
- package/dist/api/device/index.js.map +1 -1
- package/dist/api/device/keyboard.js +4 -4
- package/dist/api/device/keyboard.js.map +1 -1
- package/dist/api/device/memory.js +2 -2
- package/dist/api/device/memory.js.map +1 -1
- package/dist/api/device/motion.js +1 -2
- package/dist/api/device/motion.js.map +1 -1
- package/dist/api/device/network.js +3 -3
- package/dist/api/device/network.js.map +1 -1
- package/dist/api/device/nfc.js +7 -7
- package/dist/api/device/nfc.js.map +1 -1
- package/dist/api/device/scan.js +1 -1
- package/dist/api/device/scan.js.map +1 -1
- package/dist/api/device/screen.d.ts +4 -1
- package/dist/api/device/screen.js +10 -7
- package/dist/api/device/screen.js.map +1 -1
- package/dist/api/device/sms.d.ts +2 -0
- package/dist/api/device/sms.js +7 -0
- package/dist/api/device/sms.js.map +1 -0
- package/dist/api/device/wifi.d.ts +2 -1
- package/dist/api/device/wifi.js +13 -12
- package/dist/api/device/wifi.js.map +1 -1
- package/dist/api/ext/index.js +2 -2
- package/dist/api/ext/index.js.map +1 -1
- package/dist/api/files/index.js +8 -8
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/framework/index.d.ts +1 -1
- package/dist/api/index.d.ts +25 -24
- package/dist/api/index.js +28 -16
- package/dist/api/index.js.map +1 -1
- package/dist/api/location/chooseLocation.js +9 -5
- package/dist/api/location/chooseLocation.js.map +1 -1
- package/dist/api/location/getLocation.js +1 -1
- package/dist/api/location/getLocation.js.map +1 -1
- package/dist/api/location/index.d.ts +2 -2
- package/dist/api/location/index.js +10 -10
- package/dist/api/location/index.js.map +1 -1
- package/dist/api/media/audio/InnerAudioContext.d.ts +23 -21
- package/dist/api/media/audio/InnerAudioContext.js +16 -3
- package/dist/api/media/audio/InnerAudioContext.js.map +1 -1
- package/dist/api/media/audio/index.js +8 -8
- package/dist/api/media/audio/index.js.map +1 -1
- package/dist/api/media/background-audio/BackgroundAudioManager.d.ts +1 -1
- package/dist/api/media/background-audio/BackgroundAudioManager.js +12 -1
- package/dist/api/media/background-audio/BackgroundAudioManager.js.map +1 -1
- package/dist/api/media/background-audio/index.d.ts +1 -1
- package/dist/api/media/background-audio/index.js +8 -8
- package/dist/api/media/background-audio/index.js.map +1 -1
- package/dist/api/media/camera.js +1 -1
- package/dist/api/media/camera.js.map +1 -1
- package/dist/api/media/image/chooseImage.d.ts +1 -0
- package/dist/api/media/image/chooseImage.js +28 -71
- package/dist/api/media/image/chooseImage.js.map +1 -1
- package/dist/api/media/image/index.d.ts +9 -6
- package/dist/api/media/image/index.js +8 -7
- package/dist/api/media/image/index.js.map +1 -1
- package/dist/api/media/image/previewImage.js +13 -8
- package/dist/api/media/image/previewImage.js.map +1 -1
- package/dist/api/media/image/saveImageToPhotosAlbum.d.ts +3 -0
- package/dist/api/media/image/saveImageToPhotosAlbum.js +30 -0
- package/dist/api/media/image/saveImageToPhotosAlbum.js.map +1 -0
- package/dist/api/media/index.d.ts +12 -12
- package/dist/api/media/index.js +3 -3
- package/dist/api/media/live.js +2 -2
- package/dist/api/media/live.js.map +1 -1
- package/dist/api/media/map.js +1 -1
- package/dist/api/media/map.js.map +1 -1
- package/dist/api/media/media-recorder.js +1 -1
- package/dist/api/media/media-recorder.js.map +1 -1
- package/dist/api/media/recorder.js +3 -3
- package/dist/api/media/recorder.js.map +1 -1
- package/dist/api/media/video/chooseMedia.d.ts +6 -0
- package/dist/api/media/video/chooseMedia.js +208 -0
- package/dist/api/media/video/chooseMedia.js.map +1 -0
- package/dist/api/media/video/chooseVideo.d.ts +7 -0
- package/dist/api/media/video/chooseVideo.js +44 -0
- package/dist/api/media/video/chooseVideo.js.map +1 -0
- package/dist/api/media/video/getVideoInfo.d.ts +3 -0
- package/dist/api/media/video/getVideoInfo.js +63 -0
- package/dist/api/media/video/getVideoInfo.js.map +1 -0
- package/dist/api/media/video/index.d.ts +5 -8
- package/dist/api/media/video/index.js +8 -67
- package/dist/api/media/video/index.js.map +1 -1
- package/dist/api/media/video/saveVideoToPhotosAlbum.d.ts +3 -0
- package/dist/api/media/video/saveVideoToPhotosAlbum.js +30 -0
- package/dist/api/media/video/saveVideoToPhotosAlbum.js.map +1 -0
- package/dist/api/media/video-decoder.js +1 -1
- package/dist/api/media/video-decoder.js.map +1 -1
- package/dist/api/media/video-processing.js +1 -1
- package/dist/api/media/video-processing.js.map +1 -1
- package/dist/api/media/voip.d.ts +3 -1
- package/dist/api/media/voip.js +17 -15
- package/dist/api/media/voip.js.map +1 -1
- package/dist/api/navigate/index.js +5 -5
- package/dist/api/navigate/index.js.map +1 -1
- package/dist/api/network/download.js +10 -8
- package/dist/api/network/download.js.map +1 -1
- package/dist/api/network/index.d.ts +7 -7
- package/dist/api/network/mdns.js +10 -10
- package/dist/api/network/mdns.js.map +1 -1
- package/dist/api/network/request/index.d.ts +1 -1
- package/dist/api/network/request/index.js +48 -42
- package/dist/api/network/request/index.js.map +1 -1
- package/dist/api/network/tcp.js +1 -1
- package/dist/api/network/tcp.js.map +1 -1
- package/dist/api/network/udp.js +1 -1
- package/dist/api/network/udp.js.map +1 -1
- package/dist/api/network/upload.js +10 -8
- package/dist/api/network/upload.js.map +1 -1
- package/dist/api/network/websocket/index.js +2 -2
- package/dist/api/network/websocket/index.js.map +1 -1
- package/dist/api/open-api/account.js +1 -1
- package/dist/api/open-api/account.js.map +1 -1
- package/dist/api/open-api/address.js +1 -1
- package/dist/api/open-api/address.js.map +1 -1
- package/dist/api/open-api/authorize.js +2 -2
- package/dist/api/open-api/authorize.js.map +1 -1
- package/dist/api/open-api/card.js +2 -2
- package/dist/api/open-api/card.js.map +1 -1
- package/dist/api/open-api/channels-live.d.ts +3 -1
- package/dist/api/open-api/channels-live.js +9 -7
- package/dist/api/open-api/channels-live.js.map +1 -1
- package/dist/api/open-api/customer-service.js +1 -1
- package/dist/api/open-api/customer-service.js.map +1 -1
- package/dist/api/open-api/device-voip.d.ts +3 -0
- package/dist/api/open-api/device-voip.js +8 -0
- package/dist/api/open-api/device-voip.js.map +1 -0
- package/dist/api/open-api/facial.js +4 -4
- package/dist/api/open-api/facial.js.map +1 -1
- package/dist/api/open-api/favorites.d.ts +1 -2
- package/dist/api/open-api/favorites.js +3 -4
- package/dist/api/open-api/favorites.js.map +1 -1
- package/dist/api/open-api/group.js +1 -1
- package/dist/api/open-api/group.js.map +1 -1
- package/dist/api/open-api/index.d.ts +21 -18
- package/dist/api/open-api/index.js +6 -3
- package/dist/api/open-api/index.js.map +1 -1
- package/dist/api/open-api/invoice.js +2 -2
- package/dist/api/open-api/invoice.js.map +1 -1
- package/dist/api/open-api/license-plate.js +1 -1
- package/dist/api/open-api/license-plate.js.map +1 -1
- package/dist/api/open-api/login.js +3 -3
- package/dist/api/open-api/login.js.map +1 -1
- package/dist/api/open-api/my-miniprogram.d.ts +2 -0
- package/dist/api/open-api/my-miniprogram.js +7 -0
- package/dist/api/open-api/my-miniprogram.js.map +1 -0
- package/dist/api/open-api/privacy.d.ts +5 -0
- package/dist/api/open-api/privacy.js +10 -0
- package/dist/api/open-api/privacy.js.map +1 -0
- package/dist/api/open-api/red-package.js +1 -1
- package/dist/api/open-api/red-package.js.map +1 -1
- package/dist/api/open-api/settings.js +2 -2
- package/dist/api/open-api/settings.js.map +1 -1
- package/dist/api/open-api/soter.js +3 -3
- package/dist/api/open-api/soter.js.map +1 -1
- package/dist/api/open-api/subscribe-message.d.ts +2 -1
- package/dist/api/open-api/subscribe-message.js +4 -2
- package/dist/api/open-api/subscribe-message.js.map +1 -1
- package/dist/api/open-api/user-info.js +2 -2
- package/dist/api/open-api/user-info.js.map +1 -1
- package/dist/api/open-api/werun.js +2 -2
- package/dist/api/open-api/werun.js.map +1 -1
- package/dist/api/payment/index.d.ts +2 -1
- package/dist/api/payment/index.js +4 -3
- package/dist/api/payment/index.js.map +1 -1
- package/dist/api/qq/index.d.ts +2 -0
- package/dist/api/qq/index.js +7 -0
- package/dist/api/qq/index.js.map +1 -0
- package/dist/api/share/index.d.ts +10 -0
- package/dist/api/share/index.js +21 -11
- package/dist/api/share/index.js.map +1 -1
- package/dist/api/storage/background-fetch.js +4 -4
- package/dist/api/storage/background-fetch.js.map +1 -1
- package/dist/api/storage/cache-manager.d.ts +2 -0
- package/dist/api/storage/cache-manager.js +7 -0
- package/dist/api/storage/cache-manager.js.map +1 -0
- package/dist/api/storage/index.d.ts +7 -2
- package/dist/api/storage/index.js +8 -3
- package/dist/api/storage/index.js.map +1 -1
- package/dist/api/swan/index.js +21 -21
- package/dist/api/swan/index.js.map +1 -1
- package/dist/api/taro.d.ts +7 -2
- package/dist/api/taro.js +29 -12
- package/dist/api/taro.js.map +1 -1
- package/dist/api/ui/background.js +2 -2
- package/dist/api/ui/background.js.map +1 -1
- package/dist/api/ui/index.d.ts +12 -12
- package/dist/api/ui/index.js +1 -1
- package/dist/api/ui/interaction/index.d.ts +1 -1
- package/dist/api/ui/interaction/index.js +4 -4
- package/dist/api/ui/interaction/index.js.map +1 -1
- package/dist/api/ui/interaction/modal.js +6 -0
- package/dist/api/ui/interaction/modal.js.map +1 -1
- package/dist/api/ui/interaction/toast.js +4 -0
- package/dist/api/ui/interaction/toast.js.map +1 -1
- package/dist/api/ui/menu.js +1 -1
- package/dist/api/ui/menu.js.map +1 -1
- package/dist/api/ui/navigation-bar/index.js +3 -3
- package/dist/api/ui/navigation-bar/index.js.map +1 -1
- package/dist/api/ui/scroll/index.js +4 -3
- package/dist/api/ui/scroll/index.js.map +1 -1
- package/dist/api/ui/sticky.js +1 -1
- package/dist/api/ui/sticky.js.map +1 -1
- package/dist/api/ui/window.d.ts +2 -1
- package/dist/api/ui/window.js +3 -2
- package/dist/api/ui/window.js.map +1 -1
- package/dist/api/worker/index.js +1 -1
- package/dist/api/worker/index.js.map +1 -1
- package/dist/api/wxml/IntersectionObserver.d.ts +1 -1
- package/dist/api/wxml/IntersectionObserver.js +15 -13
- package/dist/api/wxml/IntersectionObserver.js.map +1 -1
- package/dist/api/wxml/MediaQueryObserver.d.ts +1 -1
- package/dist/api/wxml/MediaQueryObserver.js +1 -2
- package/dist/api/wxml/MediaQueryObserver.js.map +1 -1
- package/dist/api/wxml/nodesRef.d.ts +1 -1
- package/dist/api/wxml/selectorQuery.d.ts +1 -1
- package/dist/api/wxml/selectorQuery.js +9 -6
- package/dist/api/wxml/selectorQuery.js.map +1 -1
- package/dist/index.cjs.d.ts +103 -52
- package/dist/index.cjs.js +2556 -1970
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.d.ts +103 -52
- package/dist/index.esm.js +2496 -1944
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +33 -17
- package/dist/index.js.map +1 -1
- package/dist/utils/handler.d.ts +13 -26
- package/dist/utils/handler.js +4 -16
- package/dist/utils/handler.js.map +1 -1
- package/dist/utils/helper.d.ts +2 -0
- package/dist/utils/helper.js +11 -0
- package/dist/utils/helper.js.map +1 -0
- package/dist/utils/index.d.ts +7 -6
- package/dist/utils/index.js +4 -12
- package/dist/utils/index.js.map +1 -1
- package/package.json +21 -15
- package/dist/utils/lodash.d.ts +0 -3
- package/dist/utils/lodash.js +0 -32
- package/dist/utils/lodash.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Taro from '@tarojs/api';
|
|
2
|
+
import { CanvasGradient } from "@tarojs/api";
|
|
2
3
|
interface IAction {
|
|
3
4
|
func: (...arr: any[]) => void;
|
|
4
5
|
args: any[];
|
|
@@ -62,7 +63,7 @@ declare class CanvasContext implements Taro.CanvasContext {
|
|
|
62
63
|
clearRect(...args: any[]): void;
|
|
63
64
|
clip(...args: any[]): void;
|
|
64
65
|
closePath(...args: any[]): void;
|
|
65
|
-
createPattern(
|
|
66
|
+
createPattern(imageResource: string, repetition: keyof Taro.CanvasContext.Repetition): CanvasPattern | null | Promise<CanvasPattern | null>;
|
|
66
67
|
/**
|
|
67
68
|
* 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
|
|
68
69
|
* @todo 每次 draw 都会读取 width 和 height
|
|
@@ -80,9 +81,11 @@ declare class CanvasContext implements Taro.CanvasContext {
|
|
|
80
81
|
moveTo(...args: any[]): void;
|
|
81
82
|
quadraticCurveTo(...args: any[]): void;
|
|
82
83
|
rect(...args: any[]): void;
|
|
83
|
-
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
reset(): any;
|
|
86
|
+
restore(): void;
|
|
84
87
|
rotate(...args: any[]): void;
|
|
85
|
-
save(
|
|
88
|
+
save(): void;
|
|
86
89
|
scale(...args: any[]): void;
|
|
87
90
|
setFillStyle(color: string | CanvasGradient): void;
|
|
88
91
|
setFontSize(fontSize: number): void;
|
|
@@ -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(
|
|
80
|
-
|
|
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 中。
|
|
@@ -128,15 +139,22 @@ class CanvasContext {
|
|
|
128
139
|
moveTo(...args) { return this.enqueueActions(this.ctx.moveTo, ...args); }
|
|
129
140
|
quadraticCurveTo(...args) { return this.enqueueActions(this.ctx.quadraticCurveTo, ...args); }
|
|
130
141
|
rect(...args) { return this.enqueueActions(this.ctx.rect, ...args); }
|
|
131
|
-
|
|
142
|
+
// @ts-ignore
|
|
143
|
+
reset() { return this.ctx.reset(); }
|
|
144
|
+
restore() { return this.ctx.restore(); }
|
|
132
145
|
rotate(...args) { return this.enqueueActions(this.ctx.rotate, ...args); }
|
|
133
|
-
save(
|
|
146
|
+
save() { return this.ctx.save(); }
|
|
134
147
|
scale(...args) { return this.enqueueActions(this.ctx.scale, ...args); }
|
|
135
148
|
setFillStyle(color) {
|
|
136
149
|
this.enqueueActions(() => { this.ctx.fillStyle = color; });
|
|
137
150
|
}
|
|
138
151
|
setFontSize(fontSize) {
|
|
139
|
-
this.font
|
|
152
|
+
const arr = this.font.split(/\s/);
|
|
153
|
+
const idx = arr.findIndex(e => /^\d+px$/.test(e));
|
|
154
|
+
if (idx !== -1) {
|
|
155
|
+
arr[idx] = `${fontSize}px`;
|
|
156
|
+
this.font = arr.join(' ');
|
|
157
|
+
}
|
|
140
158
|
}
|
|
141
159
|
setGlobalAlpha(alpha) {
|
|
142
160
|
this.globalAlpha = alpha;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasContext.js","sources":["../../../src/api/canvas/CanvasContext.ts"],"sourcesContent":["import { 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,MAAM,EAAE,GAAG,EAAA;QAFxB,IAAO,CAAA,OAAA,GAAc,EAAE,CAAA;AAGrB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;AACpB,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;KACf;IAED,IAAI,GAAG,CAAE,CAA2B,EAAA;AAClC,QAAA,IAAI,CAAC,OAAO,GAAG,CAAC,CAAA;KACjB;AAED,IAAA,IAAI,GAAG,GAAA;AACL,QAAA,OAAO,IAAI,CAAC,OAAO,IAAI,EAAE,CAAA;KAC1B;IAIS,YAAY,GAAA;AACpB,QAAA,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAA;KACxB;AAES,IAAA,cAAc,CAAE,IAAqB,EAAE,GAAG,IAAI,EAAA;AACtD,QAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAChB,IAAI;YACJ,IAAI;AACL,SAAA,CAAC,CAAA;KACH;IAED,IAAI,SAAS,CAAE,CAAC,EAAI,EAAA,IAAI,CAAC,cAAc,CAAC,MAAQ,EAAA,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,CAAC,CAAA,EAAE,CAAC,CAAA,EAAE;IAC3E,IAAI,SAAS,GAAM,EAAA,OAAO,IAAI,CAAC,GAAG,CAAC,SAAmB,CAAA,EAAE;AACxD,IAAA,IAAI,IAA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AAE,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 // @ts-ignore\n reset () { return this.ctx.reset() }\n restore () { return this.ctx.restore() }\n rotate (...args) { return this.enqueueActions(this.ctx.rotate, ...args) }\n save () { return this.ctx.save() }\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 const arr = this.font.split(/\\s/)\n const idx = arr.findIndex(e => /^\\d+px$/.test(e))\n if (idx !== -1) {\n arr[idx] = `${fontSize}px`\n this.font = arr.join(' ')\n }\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,MAAM,EAAE,GAAG,EAAA;QAFxB,IAAO,CAAA,OAAA,GAAc,EAAE,CAAA;AAGrB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;AACpB,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;KACf;IAED,IAAI,GAAG,CAAE,CAA2B,EAAA;AAClC,QAAA,IAAI,CAAC,OAAO,GAAG,CAAC,CAAA;KACjB;AAED,IAAA,IAAI,GAAG,GAAA;AACL,QAAA,OAAO,IAAI,CAAC,OAAO,IAAI,EAAE,CAAA;KAC1B;IAIS,YAAY,GAAA;AACpB,QAAA,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAA;KACxB;AAES,IAAA,cAAc,CAAE,IAAqB,EAAE,GAAG,IAAI,EAAA;AACtD,QAAA,IAAI,CAAC,OAAO,CAAC,IAAI,C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"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
declare const createOffscreenCanvas: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
3
3
|
export { createOffscreenCanvas };
|
|
4
4
|
/** 创建 canvas 的绘图上下文 CanvasContext 对象 */
|
|
5
|
-
export * from "./createCanvasContext";
|
|
5
|
+
export * from "./createCanvasContext.js";
|
|
6
6
|
/** 把当前画布指定区域的内容导出生成指定大小的图片 */
|
|
7
|
-
export * from "./canvasToTempFilePath";
|
|
7
|
+
export * from "./canvasToTempFilePath.js";
|
|
8
8
|
/** 将像素数据绘制到画布 */
|
|
9
|
-
export * from "./canvasPutImageData";
|
|
9
|
+
export * from "./canvasPutImageData.js";
|
|
10
10
|
/** 获取 canvas 区域隐含的像素数据 */
|
|
11
|
-
export * from "./canvasGetImageData";
|
|
11
|
+
export * from "./canvasGetImageData.js";
|
package/dist/api/canvas/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { canvasGetImageData } from './canvasGetImageData.js';
|
|
|
6
6
|
|
|
7
7
|
// 画布
|
|
8
8
|
/** 创建离屏 canvas 实例 */
|
|
9
|
-
const createOffscreenCanvas = temporarilyNotSupport('createOffscreenCanvas');
|
|
9
|
+
const createOffscreenCanvas = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas');
|
|
10
10
|
|
|
11
11
|
export { createOffscreenCanvas };
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/api/canvas/index.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\r\n\r\n// 画布\r\n\r\n/** 创建离屏 canvas 实例 */\r\nexport const createOffscreenCanvas = temporarilyNotSupport('createOffscreenCanvas')\r\n\r\n/** 创建 canvas 的绘图上下文 CanvasContext 对象 */\r\nexport * from './createCanvasContext'\r\n\r\n/** 把当前画布指定区域的内容导出生成指定大小的图片 */\r\nexport * from './canvasToTempFilePath'\r\n\r\n/** 将像素数据绘制到画布 */\r\nexport * from './canvasPutImageData'\r\n\r\n/** 获取 canvas 区域隐含的像素数据 */\r\nexport * from './canvasGetImageData'\r\n"],"names":[],"mappings":";;;;;;AAEA;AAEA;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/api/canvas/index.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\r\n\r\n// 画布\r\n\r\n/** 创建离屏 canvas 实例 */\r\nexport const createOffscreenCanvas = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas')\r\n\r\n/** 创建 canvas 的绘图上下文 CanvasContext 对象 */\r\nexport * from './createCanvasContext'\r\n\r\n/** 把当前画布指定区域的内容导出生成指定大小的图片 */\r\nexport * from './canvasToTempFilePath'\r\n\r\n/** 将像素数据绘制到画布 */\r\nexport * from './canvasPutImageData'\r\n\r\n/** 获取 canvas 区域隐含的像素数据 */\r\nexport * from './canvasGetImageData'\r\n"],"names":[],"mappings":";;;;;;AAEA;AAEA;AACa,MAAA,qBAAqB,mBAAmB,qBAAqB,CAAC,uBAAuB;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { temporarilyNotSupport } from '../../utils/index.js';
|
|
2
2
|
|
|
3
|
-
const reportMonitor = temporarilyNotSupport('reportMonitor');
|
|
4
|
-
const reportAnalytics = temporarilyNotSupport('reportAnalytics');
|
|
5
|
-
const reportEvent = temporarilyNotSupport('reportEvent');
|
|
6
|
-
const getExptInfoSync = temporarilyNotSupport('getExptInfoSync');
|
|
3
|
+
const reportMonitor = /* @__PURE__ */ temporarilyNotSupport('reportMonitor');
|
|
4
|
+
const reportAnalytics = /* @__PURE__ */ temporarilyNotSupport('reportAnalytics');
|
|
5
|
+
const reportEvent = /* @__PURE__ */ temporarilyNotSupport('reportEvent');
|
|
6
|
+
const getExptInfoSync = /* @__PURE__ */ temporarilyNotSupport('getExptInfoSync');
|
|
7
7
|
|
|
8
8
|
export { getExptInfoSync, reportAnalytics, reportEvent, reportMonitor };
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/api/data-analysis/index.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\nexport const reportMonitor = temporarilyNotSupport('reportMonitor')\nexport const reportAnalytics = temporarilyNotSupport('reportAnalytics')\nexport const reportEvent = temporarilyNotSupport('reportEvent')\nexport const getExptInfoSync = temporarilyNotSupport('getExptInfoSync')\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/api/data-analysis/index.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\nexport const reportMonitor = /* @__PURE__ */ temporarilyNotSupport('reportMonitor')\nexport const reportAnalytics = /* @__PURE__ */ temporarilyNotSupport('reportAnalytics')\nexport const reportEvent = /* @__PURE__ */ temporarilyNotSupport('reportEvent')\nexport const getExptInfoSync = /* @__PURE__ */ temporarilyNotSupport('getExptInfoSync')\n"],"names":[],"mappings":";;AAEa,MAAA,aAAa,mBAAmB,qBAAqB,CAAC,eAAe,EAAC;AACtE,MAAA,eAAe,mBAAmB,qBAAqB,CAAC,iBAAiB,EAAC;AAC1E,MAAA,WAAW,mBAAmB,qBAAqB,CAAC,aAAa,EAAC;AAClE,MAAA,eAAe,mBAAmB,qBAAqB,CAAC,iBAAiB;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import throttle from 'lodash-es/throttle';
|
|
2
2
|
import { CallbackManager, MethodHandler } from '../../utils/handler.js';
|
|
3
|
-
import { throttle } from '../../utils/lodash.js';
|
|
4
3
|
|
|
5
4
|
const callbackManager = new CallbackManager();
|
|
6
5
|
let devicemotionListener;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accelerometer.js","sources":["../../../src/api/device/accelerometer.ts"],"sourcesContent":["import Taro from '@tarojs/api'\r\
|
|
1
|
+
{"version":3,"file":"accelerometer.js","sources":["../../../src/api/device/accelerometer.ts"],"sourcesContent":["import Taro from '@tarojs/api'\r\nimport throttle from 'lodash-es/throttle'\r\n\r\nimport { CallbackManager, MethodHandler } from '../../utils/handler'\r\n\r\nconst callbackManager = new CallbackManager()\r\nlet devicemotionListener\r\n\r\n/**\r\n * 停止监听加速度数据。\r\n */\r\nexport const stopAccelerometer: typeof Taro.stopAccelerometer = ({ success, fail, complete } = {}) => {\r\n const res: Partial<TaroGeneral.CallbackResult> = {}\r\n const handle = new MethodHandler({ name: 'stopAccelerometer', success, fail, complete })\r\n try {\r\n window.removeEventListener('devicemotion', devicemotionListener, true)\r\n return handle.success(res)\r\n } catch (e) {\r\n res.errMsg = e.message\r\n return handle.fail(res)\r\n }\r\n}\r\n\r\nconst INTERVAL_MAP = {\r\n game: {\r\n interval: 20,\r\n frequency: 50\r\n },\r\n ui: {\r\n interval: 60,\r\n frequency: 16.67\r\n },\r\n normal: {\r\n interval: 200,\r\n frequency: 5\r\n }\r\n}\r\n\r\n/**\r\n * 开始监听加速度数据。\r\n */\r\nexport const startAccelerometer: typeof Taro.startAccelerometer = ({ interval = 'normal', success, fail, complete } = {}) => {\r\n const handle = new MethodHandler({ name: 'startAccelerometer', success, fail, complete })\r\n try {\r\n if (window.DeviceMotionEvent) {\r\n const intervalObj = INTERVAL_MAP[interval]\r\n if (devicemotionListener) {\r\n stopAccelerometer()\r\n }\r\n devicemotionListener = throttle((evt: DeviceMotionEvent) => {\r\n callbackManager.trigger({\r\n x: evt.acceleration?.x || 0,\r\n y: evt.acceleration?.y || 0,\r\n z: evt.acceleration?.z || 0\r\n })\r\n }, intervalObj.interval)\r\n window.addEventListener('devicemotion', devicemotionListener, true)\r\n } else {\r\n throw new Error('accelerometer is not supported')\r\n }\r\n return handle.success()\r\n } catch (e) {\r\n return handle.fail({ errMsg: e.message })\r\n }\r\n}\r\n\r\n/**\r\n * 监听加速度数据事件。频率根据 Taro.startAccelerometer() 的 interval 参数。可使用 Taro.stopAccelerometer() 停止监听。\r\n */\r\nexport const onAccelerometerChange: typeof Taro.onAccelerometerChange = callback => {\r\n callbackManager.add(callback)\r\n}\r\n\r\n/**\r\n * 取消监听加速度数据事件,参数为空,则取消所有的事件监听\r\n */\r\nexport const offAccelerometerChange: typeof Taro.offAccelerometerChange = callback => {\r\n callbackManager.remove(callback)\r\n}\r\n"],"names":[],"mappings":";;;AAKA,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAA;AAC7C,IAAI,oBAAoB,CAAA;AAExB;;AAEG;AACI,MAAM,iBAAiB,GAAkC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAI;IACnG,MAAM,GAAG,GAAwC,EAAE,CAAA;AACnD,IAAA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;IACxF,IAAI;QACF,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,oBAAoB,EAAE,IAAI,CAAC,CAAA;AACtE,QAAA,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;AAC3B,KAAA;AAAC,IAAA,OAAO,CAAC,EAAE;AACV,QAAA,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,OAAO,CAAA;AACtB,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACxB,KAAA;AACH,EAAC;AAED,MAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE;AACJ,QAAA,QAAQ,EAAE,EAAE;AACZ,QAAA,SAAS,EAAE,EAAE;AACd,KAAA;AACD,IAAA,EAAE,EAAE;AACF,QAAA,QAAQ,EAAE,EAAE;AACZ,QAAA,SAAS,EAAE,KAAK;AACjB,KAAA;AACD,IAAA,MAAM,EAAE;AACN,QAAA,QAAQ,EAAE,GAAG;AACb,QAAA,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AAA;AACL,YAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;AAClD,SAAA;AACD,QAAA,OAAO,MAAM,CAAC,OAAO,EAAE,CAAA;AACxB,KAAA;AAAC,IAAA,OAAO,CAAC,EAAE;AACV,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;AAC1C,KAAA;AACH,EAAC;AAED;;AAEG;AACU,MAAA,qBAAqB,GAAsC,QAAQ,IAAG;AACjF,IAAA,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAC/B,EAAC;AAED;;AAEG;AACU,MAAA,sBAAsB,GAAuC,QAAQ,IAAG;AACnF,IAAA,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AAClC;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { temporarilyNotSupport } from '../../utils/index.js';
|
|
2
2
|
|
|
3
3
|
// 无障碍
|
|
4
|
-
const checkIsOpenAccessibility = temporarilyNotSupport('checkIsOpenAccessibility');
|
|
4
|
+
const checkIsOpenAccessibility = /* @__PURE__ */ temporarilyNotSupport('checkIsOpenAccessibility');
|
|
5
5
|
|
|
6
6
|
export { checkIsOpenAccessibility };
|
|
7
7
|
//# sourceMappingURL=accessibility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessibility.js","sources":["../../../src/api/device/accessibility.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 无障碍\nexport const checkIsOpenAccessibility = temporarilyNotSupport('checkIsOpenAccessibility')\n"],"names":[],"mappings":";;AAEA;
|
|
1
|
+
{"version":3,"file":"accessibility.js","sources":["../../../src/api/device/accessibility.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 无障碍\nexport const checkIsOpenAccessibility = /* @__PURE__ */ temporarilyNotSupport('checkIsOpenAccessibility')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,wBAAwB,mBAAmB,qBAAqB,CAAC,0BAA0B;;;;"}
|
|
@@ -4,7 +4,7 @@ import { MethodHandler } from '../../utils/handler.js';
|
|
|
4
4
|
|
|
5
5
|
// 电量
|
|
6
6
|
// Note: 浏览器标准下不支持,其他实现方案不准确,不建议开发者使用
|
|
7
|
-
const getBatteryInfoSync = permanentlyNotSupport('getBatteryInfoSync');
|
|
7
|
+
const getBatteryInfoSync = /* @__PURE__ */ permanentlyNotSupport('getBatteryInfoSync');
|
|
8
8
|
const getBatteryInfo = ({ success, fail, complete } = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9
9
|
var _a;
|
|
10
10
|
const handle = new MethodHandler({ name: 'getBatteryInfo', success, fail, complete });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"battery.js","sources":["../../../src/api/device/battery.ts"],"sourcesContent":["import Taro from '@tarojs/api'\n\nimport { permanentlyNotSupport } from '../../utils'\nimport { MethodHandler } from '../../utils/handler'\n\n// 电量\n\n// Note: 浏览器标准下不支持,其他实现方案不准确,不建议开发者使用\nexport const getBatteryInfoSync = permanentlyNotSupport('getBatteryInfoSync')\n\nexport const getBatteryInfo: typeof Taro.getBatteryInfo = async ({ success, fail, complete } = {}) => {\n const handle = new MethodHandler({ name: 'getBatteryInfo', success, fail, complete })\n try {\n // @ts-ignore\n const battery = await navigator.getBattery?.()\n return handle.success({\n isCharging: battery.charging,\n level: Number(battery.level || 0) * 100\n })\n } catch (error) {\n return handle.fail({\n errMsg: error?.message || error\n })\n }\n}\n"],"names":[],"mappings":";;;;AAKA;AAEA;
|
|
1
|
+
{"version":3,"file":"battery.js","sources":["../../../src/api/device/battery.ts"],"sourcesContent":["import Taro from '@tarojs/api'\n\nimport { permanentlyNotSupport } from '../../utils'\nimport { MethodHandler } from '../../utils/handler'\n\n// 电量\n\n// Note: 浏览器标准下不支持,其他实现方案不准确,不建议开发者使用\nexport const getBatteryInfoSync = /* @__PURE__ */ permanentlyNotSupport('getBatteryInfoSync')\n\nexport const getBatteryInfo: typeof Taro.getBatteryInfo = async ({ success, fail, complete } = {}) => {\n const handle = new MethodHandler({ name: 'getBatteryInfo', success, fail, complete })\n try {\n // @ts-ignore\n const battery = await navigator.getBattery?.()\n return handle.success({\n isCharging: battery.charging,\n level: Number(battery.level || 0) * 100\n })\n } catch (error) {\n return handle.fail({\n errMsg: error?.message || error\n })\n }\n}\n"],"names":[],"mappings":";;;;AAKA;AAEA;AACa,MAAA,kBAAkB,mBAAmB,qBAAqB,CAAC,oBAAoB,EAAC;AAEtF,MAAM,cAAc,GAA+B,CAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAI,SAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;;AACnG,IAAA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;IACrF,IAAI;;QAEF,MAAM,OAAO,GAAG,OAAM,CAAA,EAAA,GAAA,SAAS,CAAC,UAAU,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,SAAA,CAAA,CAAA,CAAA;QAC9C,OAAO,MAAM,CAAC,OAAO,CAAC;YACpB,UAAU,EAAE,OAAO,CAAC,QAAQ;YAC5B,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,GAAG;AACxC,SAAA,CAAC,CAAA;AACH,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;QACd,OAAO,MAAM,CAAC,IAAI,CAAC;YACjB,MAAM,EAAE,CAAA,KAAK,KAAL,IAAA,IAAA,KAAK,uBAAL,KAAK,CAAE,OAAO,KAAI,KAAK;AAChC,SAAA,CAAC,CAAA;AACH,KAAA;AACH,CAAC;;;;"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { temporarilyNotSupport } from '../../utils/index.js';
|
|
2
2
|
|
|
3
3
|
// 蓝牙-低功耗中心设备
|
|
4
|
-
const writeBLECharacteristicValue = temporarilyNotSupport('writeBLECharacteristicValue');
|
|
5
|
-
const setBLEMTU = temporarilyNotSupport('setBLEMTU');
|
|
6
|
-
const readBLECharacteristicValue = temporarilyNotSupport('readBLECharacteristicValue');
|
|
7
|
-
const onBLEMTUChange = temporarilyNotSupport('onBLEMTUChange');
|
|
8
|
-
const onBLEConnectionStateChange = temporarilyNotSupport('onBLEConnectionStateChange');
|
|
9
|
-
const onBLECharacteristicValueChange = temporarilyNotSupport('onBLECharacteristicValueChange');
|
|
10
|
-
const offBLEMTUChange = temporarilyNotSupport('offBLEMTUChange');
|
|
11
|
-
const offBLEConnectionStateChange = temporarilyNotSupport('offBLEConnectionStateChange');
|
|
12
|
-
const offBLECharacteristicValueChange = temporarilyNotSupport('offBLECharacteristicValueChange');
|
|
13
|
-
const notifyBLECharacteristicValueChange = temporarilyNotSupport('notifyBLECharacteristicValueChange');
|
|
14
|
-
const getBLEMTU = temporarilyNotSupport('getBLEMTU');
|
|
15
|
-
const getBLEDeviceServices = temporarilyNotSupport('getBLEDeviceServices');
|
|
16
|
-
const getBLEDeviceRSSI = temporarilyNotSupport('getBLEDeviceRSSI');
|
|
17
|
-
const getBLEDeviceCharacteristics = temporarilyNotSupport('getBLEDeviceCharacteristics');
|
|
18
|
-
const createBLEConnection = temporarilyNotSupport('createBLEConnection');
|
|
19
|
-
const closeBLEConnection = temporarilyNotSupport('closeBLEConnection');
|
|
4
|
+
const writeBLECharacteristicValue = /* @__PURE__ */ temporarilyNotSupport('writeBLECharacteristicValue');
|
|
5
|
+
const setBLEMTU = /* @__PURE__ */ temporarilyNotSupport('setBLEMTU');
|
|
6
|
+
const readBLECharacteristicValue = /* @__PURE__ */ temporarilyNotSupport('readBLECharacteristicValue');
|
|
7
|
+
const onBLEMTUChange = /* @__PURE__ */ temporarilyNotSupport('onBLEMTUChange');
|
|
8
|
+
const onBLEConnectionStateChange = /* @__PURE__ */ temporarilyNotSupport('onBLEConnectionStateChange');
|
|
9
|
+
const onBLECharacteristicValueChange = /* @__PURE__ */ temporarilyNotSupport('onBLECharacteristicValueChange');
|
|
10
|
+
const offBLEMTUChange = /* @__PURE__ */ temporarilyNotSupport('offBLEMTUChange');
|
|
11
|
+
const offBLEConnectionStateChange = /* @__PURE__ */ temporarilyNotSupport('offBLEConnectionStateChange');
|
|
12
|
+
const offBLECharacteristicValueChange = /* @__PURE__ */ temporarilyNotSupport('offBLECharacteristicValueChange');
|
|
13
|
+
const notifyBLECharacteristicValueChange = /* @__PURE__ */ temporarilyNotSupport('notifyBLECharacteristicValueChange');
|
|
14
|
+
const getBLEMTU = /* @__PURE__ */ temporarilyNotSupport('getBLEMTU');
|
|
15
|
+
const getBLEDeviceServices = /* @__PURE__ */ temporarilyNotSupport('getBLEDeviceServices');
|
|
16
|
+
const getBLEDeviceRSSI = /* @__PURE__ */ temporarilyNotSupport('getBLEDeviceRSSI');
|
|
17
|
+
const getBLEDeviceCharacteristics = /* @__PURE__ */ temporarilyNotSupport('getBLEDeviceCharacteristics');
|
|
18
|
+
const createBLEConnection = /* @__PURE__ */ temporarilyNotSupport('createBLEConnection');
|
|
19
|
+
const closeBLEConnection = /* @__PURE__ */ temporarilyNotSupport('closeBLEConnection');
|
|
20
20
|
|
|
21
21
|
export { closeBLEConnection, createBLEConnection, getBLEDeviceCharacteristics, getBLEDeviceRSSI, getBLEDeviceServices, getBLEMTU, notifyBLECharacteristicValueChange, offBLECharacteristicValueChange, offBLEConnectionStateChange, offBLEMTUChange, onBLECharacteristicValueChange, onBLEConnectionStateChange, onBLEMTUChange, readBLECharacteristicValue, setBLEMTU, writeBLECharacteristicValue };
|
|
22
22
|
//# sourceMappingURL=bluetooth-ble.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bluetooth-ble.js","sources":["../../../src/api/device/bluetooth-ble.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 蓝牙-低功耗中心设备\nexport const writeBLECharacteristicValue = temporarilyNotSupport('writeBLECharacteristicValue')\nexport const setBLEMTU = temporarilyNotSupport('setBLEMTU')\nexport const readBLECharacteristicValue = temporarilyNotSupport('readBLECharacteristicValue')\nexport const onBLEMTUChange = temporarilyNotSupport('onBLEMTUChange')\nexport const onBLEConnectionStateChange = temporarilyNotSupport('onBLEConnectionStateChange')\nexport const onBLECharacteristicValueChange = temporarilyNotSupport('onBLECharacteristicValueChange')\nexport const offBLEMTUChange = temporarilyNotSupport('offBLEMTUChange')\nexport const offBLEConnectionStateChange = temporarilyNotSupport('offBLEConnectionStateChange')\nexport const offBLECharacteristicValueChange = temporarilyNotSupport('offBLECharacteristicValueChange')\nexport const notifyBLECharacteristicValueChange = temporarilyNotSupport('notifyBLECharacteristicValueChange')\nexport const getBLEMTU = temporarilyNotSupport('getBLEMTU')\nexport const getBLEDeviceServices = temporarilyNotSupport('getBLEDeviceServices')\nexport const getBLEDeviceRSSI = temporarilyNotSupport('getBLEDeviceRSSI')\nexport const getBLEDeviceCharacteristics = temporarilyNotSupport('getBLEDeviceCharacteristics')\nexport const createBLEConnection = temporarilyNotSupport('createBLEConnection')\nexport const closeBLEConnection = temporarilyNotSupport('closeBLEConnection')\n"],"names":[],"mappings":";;AAEA;
|
|
1
|
+
{"version":3,"file":"bluetooth-ble.js","sources":["../../../src/api/device/bluetooth-ble.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 蓝牙-低功耗中心设备\nexport const writeBLECharacteristicValue = /* @__PURE__ */ temporarilyNotSupport('writeBLECharacteristicValue')\nexport const setBLEMTU = /* @__PURE__ */ temporarilyNotSupport('setBLEMTU')\nexport const readBLECharacteristicValue = /* @__PURE__ */ temporarilyNotSupport('readBLECharacteristicValue')\nexport const onBLEMTUChange = /* @__PURE__ */ temporarilyNotSupport('onBLEMTUChange')\nexport const onBLEConnectionStateChange = /* @__PURE__ */ temporarilyNotSupport('onBLEConnectionStateChange')\nexport const onBLECharacteristicValueChange = /* @__PURE__ */ temporarilyNotSupport('onBLECharacteristicValueChange')\nexport const offBLEMTUChange = /* @__PURE__ */ temporarilyNotSupport('offBLEMTUChange')\nexport const offBLEConnectionStateChange = /* @__PURE__ */ temporarilyNotSupport('offBLEConnectionStateChange')\nexport const offBLECharacteristicValueChange = /* @__PURE__ */ temporarilyNotSupport('offBLECharacteristicValueChange')\nexport const notifyBLECharacteristicValueChange = /* @__PURE__ */ temporarilyNotSupport('notifyBLECharacteristicValueChange')\nexport const getBLEMTU = /* @__PURE__ */ temporarilyNotSupport('getBLEMTU')\nexport const getBLEDeviceServices = /* @__PURE__ */ temporarilyNotSupport('getBLEDeviceServices')\nexport const getBLEDeviceRSSI = /* @__PURE__ */ temporarilyNotSupport('getBLEDeviceRSSI')\nexport const getBLEDeviceCharacteristics = /* @__PURE__ */ temporarilyNotSupport('getBLEDeviceCharacteristics')\nexport const createBLEConnection = /* @__PURE__ */ temporarilyNotSupport('createBLEConnection')\nexport const closeBLEConnection = /* @__PURE__ */ temporarilyNotSupport('closeBLEConnection')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,2BAA2B,mBAAmB,qBAAqB,CAAC,6BAA6B,EAAC;AAClG,MAAA,SAAS,mBAAmB,qBAAqB,CAAC,WAAW,EAAC;AAC9D,MAAA,0BAA0B,mBAAmB,qBAAqB,CAAC,4BAA4B,EAAC;AAChG,MAAA,cAAc,mBAAmB,qBAAqB,CAAC,gBAAgB,EAAC;AACxE,MAAA,0BAA0B,mBAAmB,qBAAqB,CAAC,4BAA4B,EAAC;AAChG,MAAA,8BAA8B,mBAAmB,qBAAqB,CAAC,gCAAgC,EAAC;AACxG,MAAA,eAAe,mBAAmB,qBAAqB,CAAC,iBAAiB,EAAC;AAC1E,MAAA,2BAA2B,mBAAmB,qBAAqB,CAAC,6BAA6B,EAAC;AAClG,MAAA,+BAA+B,mBAAmB,qBAAqB,CAAC,iCAAiC,EAAC;AAC1G,MAAA,kCAAkC,mBAAmB,qBAAqB,CAAC,oCAAoC,EAAC;AAChH,MAAA,SAAS,mBAAmB,qBAAqB,CAAC,WAAW,EAAC;AAC9D,MAAA,oBAAoB,mBAAmB,qBAAqB,CAAC,sBAAsB,EAAC;AACpF,MAAA,gBAAgB,mBAAmB,qBAAqB,CAAC,kBAAkB,EAAC;AAC5E,MAAA,2BAA2B,mBAAmB,qBAAqB,CAAC,6BAA6B,EAAC;AAClG,MAAA,mBAAmB,mBAAmB,qBAAqB,CAAC,qBAAqB,EAAC;AAClF,MAAA,kBAAkB,mBAAmB,qBAAqB,CAAC,oBAAoB;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { temporarilyNotSupport } from '../../utils/index.js';
|
|
2
2
|
|
|
3
3
|
// 蓝牙-低功耗外围设备
|
|
4
|
-
const onBLEPeripheralConnectionStateChanged = temporarilyNotSupport('onBLEPeripheralConnectionStateChanged');
|
|
5
|
-
const offBLEPeripheralConnectionStateChanged = temporarilyNotSupport('offBLEPeripheralConnectionStateChanged');
|
|
6
|
-
const createBLEPeripheralServer = temporarilyNotSupport('createBLEPeripheralServer');
|
|
4
|
+
const onBLEPeripheralConnectionStateChanged = /* @__PURE__ */ temporarilyNotSupport('onBLEPeripheralConnectionStateChanged');
|
|
5
|
+
const offBLEPeripheralConnectionStateChanged = /* @__PURE__ */ temporarilyNotSupport('offBLEPeripheralConnectionStateChanged');
|
|
6
|
+
const createBLEPeripheralServer = /* @__PURE__ */ temporarilyNotSupport('createBLEPeripheralServer');
|
|
7
7
|
|
|
8
8
|
export { createBLEPeripheralServer, offBLEPeripheralConnectionStateChanged, onBLEPeripheralConnectionStateChanged };
|
|
9
9
|
//# sourceMappingURL=bluetooth-peripheral.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bluetooth-peripheral.js","sources":["../../../src/api/device/bluetooth-peripheral.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 蓝牙-低功耗外围设备\nexport const onBLEPeripheralConnectionStateChanged = temporarilyNotSupport('onBLEPeripheralConnectionStateChanged')\nexport const offBLEPeripheralConnectionStateChanged = temporarilyNotSupport('offBLEPeripheralConnectionStateChanged')\nexport const createBLEPeripheralServer = temporarilyNotSupport('createBLEPeripheralServer')\n"],"names":[],"mappings":";;AAEA;
|
|
1
|
+
{"version":3,"file":"bluetooth-peripheral.js","sources":["../../../src/api/device/bluetooth-peripheral.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 蓝牙-低功耗外围设备\nexport const onBLEPeripheralConnectionStateChanged = /* @__PURE__ */ temporarilyNotSupport('onBLEPeripheralConnectionStateChanged')\nexport const offBLEPeripheralConnectionStateChanged = /* @__PURE__ */ temporarilyNotSupport('offBLEPeripheralConnectionStateChanged')\nexport const createBLEPeripheralServer = /* @__PURE__ */ temporarilyNotSupport('createBLEPeripheralServer')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,qCAAqC,mBAAmB,qBAAqB,CAAC,uCAAuC,EAAC;AACtH,MAAA,sCAAsC,mBAAmB,qBAAqB,CAAC,wCAAwC,EAAC;AACxH,MAAA,yBAAyB,mBAAmB,qBAAqB,CAAC,2BAA2B;;;;"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { temporarilyNotSupport } from '../../utils/index.js';
|
|
2
2
|
|
|
3
3
|
// 蓝牙-通用
|
|
4
|
-
const stopBluetoothDevicesDiscovery = temporarilyNotSupport('stopBluetoothDevicesDiscovery');
|
|
5
|
-
const startBluetoothDevicesDiscovery = temporarilyNotSupport('startBluetoothDevicesDiscovery');
|
|
6
|
-
const openBluetoothAdapter = temporarilyNotSupport('openBluetoothAdapter');
|
|
7
|
-
const onBluetoothDeviceFound = temporarilyNotSupport('onBluetoothDeviceFound');
|
|
8
|
-
const onBluetoothAdapterStateChange = temporarilyNotSupport('onBluetoothAdapterStateChange');
|
|
9
|
-
const offBluetoothDeviceFound = temporarilyNotSupport('offBluetoothDeviceFound');
|
|
10
|
-
const offBluetoothAdapterStateChange = temporarilyNotSupport('offBluetoothAdapterStateChange');
|
|
11
|
-
const makeBluetoothPair = temporarilyNotSupport('makeBluetoothPair');
|
|
12
|
-
const isBluetoothDevicePaired = temporarilyNotSupport('isBluetoothDevicePaired');
|
|
13
|
-
const getConnectedBluetoothDevices = temporarilyNotSupport('getConnectedBluetoothDevices');
|
|
14
|
-
const getBluetoothDevices = temporarilyNotSupport('getBluetoothDevices');
|
|
15
|
-
const getBluetoothAdapterState = temporarilyNotSupport('getBluetoothAdapterState');
|
|
16
|
-
const closeBluetoothAdapter = temporarilyNotSupport('closeBluetoothAdapter');
|
|
4
|
+
const stopBluetoothDevicesDiscovery = /* @__PURE__ */ temporarilyNotSupport('stopBluetoothDevicesDiscovery');
|
|
5
|
+
const startBluetoothDevicesDiscovery = /* @__PURE__ */ temporarilyNotSupport('startBluetoothDevicesDiscovery');
|
|
6
|
+
const openBluetoothAdapter = /* @__PURE__ */ temporarilyNotSupport('openBluetoothAdapter');
|
|
7
|
+
const onBluetoothDeviceFound = /* @__PURE__ */ temporarilyNotSupport('onBluetoothDeviceFound');
|
|
8
|
+
const onBluetoothAdapterStateChange = /* @__PURE__ */ temporarilyNotSupport('onBluetoothAdapterStateChange');
|
|
9
|
+
const offBluetoothDeviceFound = /* @__PURE__ */ temporarilyNotSupport('offBluetoothDeviceFound');
|
|
10
|
+
const offBluetoothAdapterStateChange = /* @__PURE__ */ temporarilyNotSupport('offBluetoothAdapterStateChange');
|
|
11
|
+
const makeBluetoothPair = /* @__PURE__ */ temporarilyNotSupport('makeBluetoothPair');
|
|
12
|
+
const isBluetoothDevicePaired = /* @__PURE__ */ temporarilyNotSupport('isBluetoothDevicePaired');
|
|
13
|
+
const getConnectedBluetoothDevices = /* @__PURE__ */ temporarilyNotSupport('getConnectedBluetoothDevices');
|
|
14
|
+
const getBluetoothDevices = /* @__PURE__ */ temporarilyNotSupport('getBluetoothDevices');
|
|
15
|
+
const getBluetoothAdapterState = /* @__PURE__ */ temporarilyNotSupport('getBluetoothAdapterState');
|
|
16
|
+
const closeBluetoothAdapter = /* @__PURE__ */ temporarilyNotSupport('closeBluetoothAdapter');
|
|
17
17
|
|
|
18
18
|
export { closeBluetoothAdapter, getBluetoothAdapterState, getBluetoothDevices, getConnectedBluetoothDevices, isBluetoothDevicePaired, makeBluetoothPair, offBluetoothAdapterStateChange, offBluetoothDeviceFound, onBluetoothAdapterStateChange, onBluetoothDeviceFound, openBluetoothAdapter, startBluetoothDevicesDiscovery, stopBluetoothDevicesDiscovery };
|
|
19
19
|
//# sourceMappingURL=bluetooth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bluetooth.js","sources":["../../../src/api/device/bluetooth.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 蓝牙-通用\nexport const stopBluetoothDevicesDiscovery = temporarilyNotSupport('stopBluetoothDevicesDiscovery')\nexport const startBluetoothDevicesDiscovery = temporarilyNotSupport('startBluetoothDevicesDiscovery')\nexport const openBluetoothAdapter = temporarilyNotSupport('openBluetoothAdapter')\nexport const onBluetoothDeviceFound = temporarilyNotSupport('onBluetoothDeviceFound')\nexport const onBluetoothAdapterStateChange = temporarilyNotSupport('onBluetoothAdapterStateChange')\nexport const offBluetoothDeviceFound = temporarilyNotSupport('offBluetoothDeviceFound')\nexport const offBluetoothAdapterStateChange = temporarilyNotSupport('offBluetoothAdapterStateChange')\nexport const makeBluetoothPair = temporarilyNotSupport('makeBluetoothPair')\nexport const isBluetoothDevicePaired = temporarilyNotSupport('isBluetoothDevicePaired')\nexport const getConnectedBluetoothDevices = temporarilyNotSupport('getConnectedBluetoothDevices')\nexport const getBluetoothDevices = temporarilyNotSupport('getBluetoothDevices')\nexport const getBluetoothAdapterState = temporarilyNotSupport('getBluetoothAdapterState')\nexport const closeBluetoothAdapter = temporarilyNotSupport('closeBluetoothAdapter')\n"],"names":[],"mappings":";;AAEA;
|
|
1
|
+
{"version":3,"file":"bluetooth.js","sources":["../../../src/api/device/bluetooth.ts"],"sourcesContent":["import { temporarilyNotSupport } from '../../utils'\n\n// 蓝牙-通用\nexport const stopBluetoothDevicesDiscovery = /* @__PURE__ */ temporarilyNotSupport('stopBluetoothDevicesDiscovery')\nexport const startBluetoothDevicesDiscovery = /* @__PURE__ */ temporarilyNotSupport('startBluetoothDevicesDiscovery')\nexport const openBluetoothAdapter = /* @__PURE__ */ temporarilyNotSupport('openBluetoothAdapter')\nexport const onBluetoothDeviceFound = /* @__PURE__ */ temporarilyNotSupport('onBluetoothDeviceFound')\nexport const onBluetoothAdapterStateChange = /* @__PURE__ */ temporarilyNotSupport('onBluetoothAdapterStateChange')\nexport const offBluetoothDeviceFound = /* @__PURE__ */ temporarilyNotSupport('offBluetoothDeviceFound')\nexport const offBluetoothAdapterStateChange = /* @__PURE__ */ temporarilyNotSupport('offBluetoothAdapterStateChange')\nexport const makeBluetoothPair = /* @__PURE__ */ temporarilyNotSupport('makeBluetoothPair')\nexport const isBluetoothDevicePaired = /* @__PURE__ */ temporarilyNotSupport('isBluetoothDevicePaired')\nexport const getConnectedBluetoothDevices = /* @__PURE__ */ temporarilyNotSupport('getConnectedBluetoothDevices')\nexport const getBluetoothDevices = /* @__PURE__ */ temporarilyNotSupport('getBluetoothDevices')\nexport const getBluetoothAdapterState = /* @__PURE__ */ temporarilyNotSupport('getBluetoothAdapterState')\nexport const closeBluetoothAdapter = /* @__PURE__ */ temporarilyNotSupport('closeBluetoothAdapter')\n"],"names":[],"mappings":";;AAEA;AACa,MAAA,6BAA6B,mBAAmB,qBAAqB,CAAC,+BAA+B,EAAC;AACtG,MAAA,8BAA8B,mBAAmB,qBAAqB,CAAC,gCAAgC,EAAC;AACxG,MAAA,oBAAoB,mBAAmB,qBAAqB,CAAC,sBAAsB,EAAC;AACpF,MAAA,sBAAsB,mBAAmB,qBAAqB,CAAC,wBAAwB,EAAC;AACxF,MAAA,6BAA6B,mBAAmB,qBAAqB,CAAC,+BAA+B,EAAC;AACtG,MAAA,uBAAuB,mBAAmB,qBAAqB,CAAC,yBAAyB,EAAC;AAC1F,MAAA,8BAA8B,mBAAmB,qBAAqB,CAAC,gCAAgC,EAAC;AACxG,MAAA,iBAAiB,mBAAmB,qBAAqB,CAAC,mBAAmB,EAAC;AAC9E,MAAA,uBAAuB,mBAAmB,qBAAqB,CAAC,yBAAyB,EAAC;AAC1F,MAAA,4BAA4B,mBAAmB,qBAAqB,CAAC,8BAA8B,EAAC;AACpG,MAAA,mBAAmB,mBAAmB,qBAAqB,CAAC,qBAAqB,EAAC;AAClF,MAAA,wBAAwB,mBAAmB,qBAAqB,CAAC,0BAA0B,EAAC;AAC5F,MAAA,qBAAqB,mBAAmB,qBAAqB,CAAC,uBAAuB;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare const
|
|
1
|
+
import Taro from '@tarojs/api';
|
|
2
|
+
declare const addPhoneRepeatCalendar: typeof Taro.addPhoneRepeatCalendar;
|
|
3
|
+
declare const addPhoneCalendar: typeof Taro.addPhoneCalendar;
|
|
3
4
|
export { addPhoneRepeatCalendar, addPhoneCalendar };
|
|
@@ -1,8 +1,147 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ics from 'ics';
|
|
2
|
+
import { shouldBeObject, getParameterError } from '../../utils/index.js';
|
|
3
|
+
import { MethodHandler } from '../../utils/handler.js';
|
|
4
|
+
import { createDownload } from '../../utils/helper.js';
|
|
2
5
|
|
|
3
6
|
// 日历
|
|
4
|
-
const addPhoneRepeatCalendar =
|
|
5
|
-
const
|
|
7
|
+
const addPhoneRepeatCalendar = (options) => {
|
|
8
|
+
const methodName = 'addPhoneRepeatCalendar';
|
|
9
|
+
// options must be an Object
|
|
10
|
+
const isObject = shouldBeObject(options);
|
|
11
|
+
if (!isObject.flag) {
|
|
12
|
+
const res = { errMsg: `${methodName}:fail ${isObject.msg}` };
|
|
13
|
+
console.error(res.errMsg);
|
|
14
|
+
return Promise.reject(res);
|
|
15
|
+
}
|
|
16
|
+
const { title, startTime = new Date().getTime(), allDay = false, description = '', location = '', endTime, alarm = true, alarmOffset = 0, repeatInterval = 'month', repeatEndTime, success, fail, complete, } = options;
|
|
17
|
+
const handle = new MethodHandler({ name: methodName, success, fail, complete });
|
|
18
|
+
if (typeof title !== 'string') {
|
|
19
|
+
return handle.fail({
|
|
20
|
+
errMsg: getParameterError({
|
|
21
|
+
para: 'title',
|
|
22
|
+
correct: 'String',
|
|
23
|
+
wrong: title
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const start = new Date(startTime);
|
|
28
|
+
const end = new Date(endTime || startTime);
|
|
29
|
+
if (!endTime && allDay) {
|
|
30
|
+
end.setDate(end.getDate() + 1);
|
|
31
|
+
}
|
|
32
|
+
const interval = 1000 * 60 * 60 * 24;
|
|
33
|
+
let days = 1;
|
|
34
|
+
let repeat = 1;
|
|
35
|
+
if (repeatEndTime) {
|
|
36
|
+
const repeatEnd = new Date(repeatEndTime);
|
|
37
|
+
if (repeatEnd < start) {
|
|
38
|
+
return handle.fail({
|
|
39
|
+
errMsg: 'repeatEndTime must be greater than startTime'
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
switch (repeatInterval) {
|
|
43
|
+
case 'week':
|
|
44
|
+
days = 7;
|
|
45
|
+
break;
|
|
46
|
+
case 'month':
|
|
47
|
+
days = 30;
|
|
48
|
+
break;
|
|
49
|
+
case 'year':
|
|
50
|
+
days = 365;
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
}
|
|
54
|
+
repeat = Math.ceil((repeatEnd.getTime() - start.getTime()) / (interval * days));
|
|
55
|
+
}
|
|
56
|
+
const { error, value } = ics.createEvent({
|
|
57
|
+
title,
|
|
58
|
+
start: parseTime2Array(start, allDay),
|
|
59
|
+
description,
|
|
60
|
+
location,
|
|
61
|
+
end: parseTime2Array(end, allDay),
|
|
62
|
+
alarms: alarm ? [{
|
|
63
|
+
action: 'display',
|
|
64
|
+
description,
|
|
65
|
+
trigger: {
|
|
66
|
+
before: true,
|
|
67
|
+
seconds: alarmOffset,
|
|
68
|
+
},
|
|
69
|
+
duration: {
|
|
70
|
+
days,
|
|
71
|
+
},
|
|
72
|
+
repeat,
|
|
73
|
+
}] : [],
|
|
74
|
+
});
|
|
75
|
+
if (error || !value) {
|
|
76
|
+
return handle.fail({
|
|
77
|
+
errMsg: error === null || error === void 0 ? void 0 : error.message
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const url = URL.createObjectURL(new Blob([value]));
|
|
81
|
+
createDownload(url, `${title}.ics`);
|
|
82
|
+
return handle.success();
|
|
83
|
+
};
|
|
84
|
+
const addPhoneCalendar = (options) => {
|
|
85
|
+
const methodName = 'addPhoneCalendar';
|
|
86
|
+
// options must be an Object
|
|
87
|
+
const isObject = shouldBeObject(options);
|
|
88
|
+
if (!isObject.flag) {
|
|
89
|
+
const res = { errMsg: `${methodName}:fail ${isObject.msg}` };
|
|
90
|
+
console.error(res.errMsg);
|
|
91
|
+
return Promise.reject(res);
|
|
92
|
+
}
|
|
93
|
+
const { title, startTime = new Date().getTime(), allDay = false, description = '', location = '', endTime, alarm = true, alarmOffset = 0, success, fail, complete, } = options;
|
|
94
|
+
const handle = new MethodHandler({ name: methodName, success, fail, complete });
|
|
95
|
+
if (typeof title !== 'string') {
|
|
96
|
+
return handle.fail({
|
|
97
|
+
errMsg: getParameterError({
|
|
98
|
+
para: 'title',
|
|
99
|
+
correct: 'String',
|
|
100
|
+
wrong: title
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
const start = new Date(startTime);
|
|
105
|
+
const end = new Date(endTime || startTime);
|
|
106
|
+
if (!endTime && allDay) {
|
|
107
|
+
end.setDate(end.getDate() + 1);
|
|
108
|
+
}
|
|
109
|
+
const { error, value } = ics.createEvent({
|
|
110
|
+
title,
|
|
111
|
+
start: parseTime2Array(start, allDay),
|
|
112
|
+
description,
|
|
113
|
+
location,
|
|
114
|
+
end: parseTime2Array(end, allDay),
|
|
115
|
+
alarms: alarm ? [{
|
|
116
|
+
action: 'display',
|
|
117
|
+
description,
|
|
118
|
+
trigger: {
|
|
119
|
+
before: true,
|
|
120
|
+
seconds: alarmOffset,
|
|
121
|
+
},
|
|
122
|
+
}] : [],
|
|
123
|
+
});
|
|
124
|
+
if (error || !value) {
|
|
125
|
+
return handle.fail({
|
|
126
|
+
errMsg: error === null || error === void 0 ? void 0 : error.message
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
const url = URL.createObjectURL(new Blob([value]));
|
|
130
|
+
createDownload(url, `${title}.ics`);
|
|
131
|
+
return handle.success();
|
|
132
|
+
};
|
|
133
|
+
function parseTime2Array(time, allDay = false) {
|
|
134
|
+
const t = new Date(time);
|
|
135
|
+
const timeArr = [
|
|
136
|
+
t.getFullYear(),
|
|
137
|
+
t.getMonth() + 1,
|
|
138
|
+
t.getDate(),
|
|
139
|
+
];
|
|
140
|
+
if (!allDay) {
|
|
141
|
+
timeArr.push(t.getHours(), t.getMinutes());
|
|
142
|
+
}
|
|
143
|
+
return timeArr;
|
|
144
|
+
}
|
|
6
145
|
|
|
7
146
|
export { addPhoneCalendar, addPhoneRepeatCalendar };
|
|
8
147
|
//# sourceMappingURL=calendar.js.map
|