@spcsn/taro 0.1.2 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -6
- package/dist/index.js +223 -1
- package/dist/index.js.map +1 -1
- package/package.json +17 -48
- package/types/api/ad/index.d.ts +3 -6
- package/types/api/base/debug.d.ts +8 -8
- package/types/api/base/env.d.ts +3 -3
- package/types/api/base/index.d.ts +3 -3
- package/types/api/base/performance.d.ts +5 -5
- package/types/api/base/system.d.ts +8 -16
- package/types/api/base/update.d.ts +6 -6
- package/types/api/base/weapp/app-event.d.ts +12 -12
- package/types/api/base/weapp/life-cycle.d.ts +1 -1
- package/types/api/canvas/index.d.ts +71 -72
- package/types/api/data-analysis/index.d.ts +1 -1
- package/types/api/device/accelerometer.d.ts +4 -4
- package/types/api/device/accessibility.d.ts +1 -1
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/bluetooth-ble.d.ts +14 -14
- package/types/api/device/bluetooth-peripheral.d.ts +15 -15
- package/types/api/device/bluetooth.d.ts +11 -11
- package/types/api/device/calendar.d.ts +2 -2
- package/types/api/device/clipboard.d.ts +2 -4
- package/types/api/device/compass.d.ts +4 -4
- package/types/api/device/gyroscope.d.ts +4 -4
- package/types/api/device/iBeacon.d.ts +7 -7
- package/types/api/device/keyboard.d.ts +3 -3
- package/types/api/device/memory.d.ts +2 -2
- package/types/api/device/motion.d.ts +4 -4
- package/types/api/device/network.d.ts +5 -20
- package/types/api/device/nfc.d.ts +17 -17
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +6 -6
- package/types/api/device/sms.d.ts +1 -1
- package/types/api/device/vibrate.d.ts +2 -2
- package/types/api/device/wifi.d.ts +10 -10
- package/types/api/ext/index.d.ts +2 -2
- package/types/api/files/index.d.ts +46 -46
- package/types/api/framework/index.d.ts +2 -2
- package/types/api/location/index.d.ts +38 -45
- package/types/api/media/audio.d.ts +30 -30
- package/types/api/media/background-audio.d.ts +1 -1
- package/types/api/media/camera.d.ts +12 -25
- package/types/api/media/image.d.ts +8 -13
- package/types/api/media/map.d.ts +15 -15
- package/types/api/media/recorder.d.ts +11 -11
- package/types/api/media/video.d.ts +19 -21
- package/types/api/navigate/index.d.ts +2 -2
- package/types/api/network/download.d.ts +7 -8
- package/types/api/network/request.d.ts +14 -33
- package/types/api/network/upload.d.ts +7 -9
- package/types/api/network/websocket.d.ts +14 -14
- package/types/api/open-api/account.d.ts +1 -1
- package/types/api/open-api/address.d.ts +5 -5
- package/types/api/open-api/authorize.d.ts +1 -1
- package/types/api/open-api/login.d.ts +5 -5
- package/types/api/open-api/settings.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +15 -15
- package/types/api/open-api/user-info.d.ts +2 -3
- package/types/api/payment/index.d.ts +1 -1
- package/types/api/route/index.d.ts +5 -8
- package/types/api/share/index.d.ts +3 -3
- package/types/api/storage/background-fetch.d.ts +6 -9
- package/types/api/storage/index.d.ts +11 -11
- package/types/api/taro.extend.d.ts +7 -24
- package/types/api/taro.hooks.d.ts +8 -33
- package/types/api/ui/animation.d.ts +33 -36
- package/types/api/ui/background.d.ts +2 -4
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +1 -10
- package/types/api/ui/interaction.d.ts +6 -6
- package/types/api/ui/menu.d.ts +1 -1
- package/types/api/ui/navigation-bar.d.ts +5 -7
- package/types/api/ui/pull-down-refresh.d.ts +2 -3
- package/types/api/ui/scroll.d.ts +3 -4
- package/types/api/ui/tab-bar.d.ts +8 -8
- package/types/api/ui/window.d.ts +2 -2
- package/types/api/wxml/index.d.ts +19 -23
- package/types/compile/compiler.d.ts +4 -10
- package/types/compile/config/index.d.ts +0 -3
- package/types/compile/config/mini.d.ts +17 -39
- package/types/compile/config/plugin.d.ts +14 -4
- package/types/compile/config/project.d.ts +23 -61
- package/types/compile/config/util.d.ts +18 -73
- package/types/compile/index.d.ts +16 -1
- package/types/compile/viteCompilerContext.d.ts +18 -52
- package/types/global.d.ts +1 -12
- package/types/index.d.ts +0 -11
- package/types/taro.api.d.ts +0 -9
- package/types/taro.component.d.ts +0 -2
- package/types/taro.config.d.ts +0 -120
- package/types/taro.runtime.d.ts +7 -3
- package/types/api/alipay/index.d.ts +0 -69
- package/types/api/qq/index.d.ts +0 -354
- package/types/api/swan/bookshelf.d.ts +0 -307
- package/types/api/swan/download-package.d.ts +0 -80
- package/types/api/swan/index.d.ts +0 -251
- package/types/api/swan/pay.d.ts +0 -139
- package/types/compile/config/h5.d.ts +0 -134
- package/types/compile/config/harmony.d.ts +0 -118
- package/types/compile/config/rn.d.ts +0 -85
|
@@ -36,7 +36,7 @@ declare module '../../index' {
|
|
|
36
36
|
/** 生成文件的临时路径 */
|
|
37
37
|
tempFilePath: string
|
|
38
38
|
/** 图片路径(本地临时文件)。
|
|
39
|
-
* @supported
|
|
39
|
+
* @supported weapp
|
|
40
40
|
*/
|
|
41
41
|
apFilePath?: string
|
|
42
42
|
/** 调用结果 */
|
|
@@ -193,7 +193,7 @@ declare module '../../index' {
|
|
|
193
193
|
/** 画布宽度 */
|
|
194
194
|
width: number
|
|
195
195
|
/** 取消由 requestAnimationFrame 添加到计划中的动画帧请求。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
|
|
196
|
-
* @supported weapp
|
|
196
|
+
* @supported weapp
|
|
197
197
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.cancelAnimationFrame.html
|
|
198
198
|
*/
|
|
199
199
|
cancelAnimationFrame(requestID: number): void
|
|
@@ -203,7 +203,7 @@ declare module '../../index' {
|
|
|
203
203
|
*/
|
|
204
204
|
createImageData(): ImageData
|
|
205
205
|
/** 创建一个图片对象。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
|
|
206
|
-
* @supported weapp
|
|
206
|
+
* @supported weapp
|
|
207
207
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImage.html
|
|
208
208
|
*/
|
|
209
209
|
createImage(): Image
|
|
@@ -215,7 +215,7 @@ declare module '../../index' {
|
|
|
215
215
|
path: Path2D
|
|
216
216
|
): Path2D
|
|
217
217
|
/** 支持获取 2D 和 WebGL 绘图上下文
|
|
218
|
-
* @supported weapp
|
|
218
|
+
* @supported weapp
|
|
219
219
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.getContext.html
|
|
220
220
|
*/
|
|
221
221
|
getContext(contextType: string): RenderingContext
|
|
@@ -238,7 +238,7 @@ declare module '../../index' {
|
|
|
238
238
|
encoderOptions: number
|
|
239
239
|
): string
|
|
240
240
|
/** 把当前画布指定区域保存为图片
|
|
241
|
-
* @supported
|
|
241
|
+
* @supported weapp
|
|
242
242
|
* @see https://opendocs.alipay.com/mini/api/toTempFilePath?pathHash=e79fe218
|
|
243
243
|
*/
|
|
244
244
|
toTempFilePath(oprion: toTempFilePath.Option): void
|
|
@@ -290,7 +290,7 @@ declare module '../../index' {
|
|
|
290
290
|
* - 绿色: 圆心 (100, 75)
|
|
291
291
|
* - 红色: 起始弧度 (0)
|
|
292
292
|
* - 蓝色: 终止弧度 (1.5 * Math.PI)
|
|
293
|
-
* @supported weapp
|
|
293
|
+
* @supported weapp
|
|
294
294
|
* @example
|
|
295
295
|
* ```tsx
|
|
296
296
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -347,12 +347,12 @@ declare module '../../index' {
|
|
|
347
347
|
/** 弧度的方向是否是逆时针 */
|
|
348
348
|
counterclockwise?: boolean,
|
|
349
349
|
/** 弧度的方向是否是逆时针
|
|
350
|
-
* @supported
|
|
350
|
+
* @supported weapp
|
|
351
351
|
*/
|
|
352
352
|
anticlockwise?: boolean
|
|
353
353
|
): void
|
|
354
354
|
/** 根据控制点和半径绘制圆弧路径。
|
|
355
|
-
* @supported weapp
|
|
355
|
+
* @supported weapp
|
|
356
356
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arcTo.html
|
|
357
357
|
*/
|
|
358
358
|
arcTo(
|
|
@@ -371,7 +371,7 @@ declare module '../../index' {
|
|
|
371
371
|
*
|
|
372
372
|
* - 在最开始的时候相当于调用了一次 `beginPath`。
|
|
373
373
|
* - 同一个路径内的多次 `setFillStyle`、`setStrokeStyle`、`setLineWidth`等设置,以最后一次设置为准。
|
|
374
|
-
* @supported weapp
|
|
374
|
+
* @supported weapp
|
|
375
375
|
* @example
|
|
376
376
|
* ```tsx
|
|
377
377
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -401,7 +401,7 @@ declare module '../../index' {
|
|
|
401
401
|
* - 红色:起始点(20, 20)
|
|
402
402
|
* - 蓝色:两个控制点(20, 100) (200, 100)
|
|
403
403
|
* - 绿色:终止点(200, 20)
|
|
404
|
-
* @supported weapp
|
|
404
|
+
* @supported weapp
|
|
405
405
|
* @example
|
|
406
406
|
* ```tsx
|
|
407
407
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -456,7 +456,7 @@ declare module '../../index' {
|
|
|
456
456
|
y: number,
|
|
457
457
|
): void
|
|
458
458
|
/** 清除画布上在该矩形区域内的内容
|
|
459
|
-
* @supported weapp
|
|
459
|
+
* @supported weapp
|
|
460
460
|
* @example
|
|
461
461
|
* clearRect 并非画一个白色的矩形在地址区域,而是清空,为了有直观感受,对 canvas 加了一层背景色。
|
|
462
462
|
* ```html
|
|
@@ -484,7 +484,7 @@ declare module '../../index' {
|
|
|
484
484
|
height: number,
|
|
485
485
|
): void
|
|
486
486
|
/** 从原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内(不能访问画布上的其他区域)。可以在使用 `clip` 方法前通过使用 `save` 方法对当前画布区域进行保存,并在以后的任意时间通过`restore`方法对其进行恢复。
|
|
487
|
-
* @supported weapp
|
|
487
|
+
* @supported weapp
|
|
488
488
|
* @example
|
|
489
489
|
* ```tsx
|
|
490
490
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -505,7 +505,7 @@ declare module '../../index' {
|
|
|
505
505
|
*/
|
|
506
506
|
clip(): void
|
|
507
507
|
/** 关闭一个路径。会连接起点和终点。如果关闭路径后没有调用 `fill` 或者 `stroke` 并开启了新的路径,那之前的路径将不会被渲染。
|
|
508
|
-
* @supported weapp
|
|
508
|
+
* @supported weapp
|
|
509
509
|
* @example
|
|
510
510
|
* ```tsx
|
|
511
511
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -538,7 +538,7 @@ declare module '../../index' {
|
|
|
538
538
|
*/
|
|
539
539
|
closePath(): void
|
|
540
540
|
/** 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](/docs/apis/canvas/CanvasGradient#addcolorstop) 来指定渐变点,至少要两个。
|
|
541
|
-
* @supported weapp
|
|
541
|
+
* @supported weapp
|
|
542
542
|
* @example
|
|
543
543
|
* ```tsx
|
|
544
544
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -562,7 +562,7 @@ declare module '../../index' {
|
|
|
562
562
|
r: number,
|
|
563
563
|
): CanvasGradient
|
|
564
564
|
/** 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](/docs/apis/canvas/CanvasGradient#addcolorstop) 来指定渐变点,至少要两个。
|
|
565
|
-
* @supported weapp
|
|
565
|
+
* @supported weapp
|
|
566
566
|
* @example
|
|
567
567
|
* ```tsx
|
|
568
568
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -588,7 +588,7 @@ declare module '../../index' {
|
|
|
588
588
|
y1: number,
|
|
589
589
|
): CanvasGradient
|
|
590
590
|
/** 对指定的图像创建模式的方法,可在指定的方向上重复元图像
|
|
591
|
-
* @supported weapp
|
|
591
|
+
* @supported weapp
|
|
592
592
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createPattern.html
|
|
593
593
|
*/
|
|
594
594
|
createPattern(
|
|
@@ -598,8 +598,7 @@ declare module '../../index' {
|
|
|
598
598
|
repetition: keyof CanvasContext.Repetition,
|
|
599
599
|
): CanvasPattern | null | Promise<CanvasPattern | null>
|
|
600
600
|
/** 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
|
|
601
|
-
* @supported weapp
|
|
602
|
-
* @h5 第二次调用 draw 前需要等待上一次 draw 调用结束后再调用,否则新的一次 draw 调用栈不会清空而导致结果异常。
|
|
601
|
+
* @supported weapp
|
|
603
602
|
* @example
|
|
604
603
|
* 第二次 draw() reserve 为 true。所以保留了上一次的绘制结果,在上下文设置的 fillStyle 'red' 也变成了默认的 'black'。
|
|
605
604
|
*
|
|
@@ -632,12 +631,12 @@ declare module '../../index' {
|
|
|
632
631
|
/** 绘制完成后执行的回调函数 */
|
|
633
632
|
callback?: (...args: any[]) => any,
|
|
634
633
|
/** 是否使用硬件加速
|
|
635
|
-
* @supported
|
|
634
|
+
* @supported weapp
|
|
636
635
|
*/
|
|
637
636
|
useHardwareAccelerate?: boolean
|
|
638
637
|
): void | Promise<void>
|
|
639
638
|
/** 绘制图像到画布
|
|
640
|
-
* @supported weapp
|
|
639
|
+
* @supported weapp
|
|
641
640
|
* @example
|
|
642
641
|
* 有三个版本的写法:
|
|
643
642
|
*
|
|
@@ -665,7 +664,7 @@ declare module '../../index' {
|
|
|
665
664
|
dy: number,
|
|
666
665
|
): void
|
|
667
666
|
/** 绘制图像到画布
|
|
668
|
-
* @supported weapp
|
|
667
|
+
* @supported weapp
|
|
669
668
|
* @example
|
|
670
669
|
* 有三个版本的写法:
|
|
671
670
|
*
|
|
@@ -697,7 +696,7 @@ declare module '../../index' {
|
|
|
697
696
|
dHeight: number,
|
|
698
697
|
): void
|
|
699
698
|
/** 绘制图像到画布
|
|
700
|
-
* @supported weapp
|
|
699
|
+
* @supported weapp
|
|
701
700
|
* @example
|
|
702
701
|
* 有三个版本的写法:
|
|
703
702
|
*
|
|
@@ -737,7 +736,7 @@ declare module '../../index' {
|
|
|
737
736
|
dHeight: number,
|
|
738
737
|
): void
|
|
739
738
|
/** 对当前路径中的内容进行填充。默认的填充色为黑色。
|
|
740
|
-
* @supported weapp
|
|
739
|
+
* @supported weapp
|
|
741
740
|
* @example
|
|
742
741
|
* 如果当前路径没有闭合,fill() 方法会将起点和终点进行连接,然后填充。
|
|
743
742
|
*
|
|
@@ -774,7 +773,7 @@ declare module '../../index' {
|
|
|
774
773
|
*/
|
|
775
774
|
fill(): void
|
|
776
775
|
/** 填充一个矩形。用 [`setFillStyle`](/docs/apis/canvas/CanvasContext#setfillstyle) 设置矩形的填充色,如果没设置默认是黑色。
|
|
777
|
-
* @supported weapp
|
|
776
|
+
* @supported weapp
|
|
778
777
|
* @example
|
|
779
778
|
* ```tsx
|
|
780
779
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -795,7 +794,7 @@ declare module '../../index' {
|
|
|
795
794
|
height: number,
|
|
796
795
|
): void
|
|
797
796
|
/** 在画布上绘制被填充的文本
|
|
798
|
-
* @supported weapp
|
|
797
|
+
* @supported weapp
|
|
799
798
|
* @example
|
|
800
799
|
* ```tsx
|
|
801
800
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -817,7 +816,7 @@ declare module '../../index' {
|
|
|
817
816
|
maxWidth?: number,
|
|
818
817
|
): void
|
|
819
818
|
/** 增加一个新点,然后创建一条从上次指定点到目标点的线。用 `stroke` 方法来画线条
|
|
820
|
-
* @supported weapp
|
|
819
|
+
* @supported weapp
|
|
821
820
|
|
|
822
821
|
* @example
|
|
823
822
|
* ```tsx
|
|
@@ -837,7 +836,7 @@ declare module '../../index' {
|
|
|
837
836
|
y: number,
|
|
838
837
|
): void
|
|
839
838
|
/** 测量文本尺寸信息。目前仅返回文本宽度(width)。同步接口。
|
|
840
|
-
* @supported weapp
|
|
839
|
+
* @supported weapp
|
|
841
840
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html
|
|
842
841
|
*/
|
|
843
842
|
measureText(
|
|
@@ -845,7 +844,7 @@ declare module '../../index' {
|
|
|
845
844
|
text: string,
|
|
846
845
|
): TextMetrics
|
|
847
846
|
/** 把路径移动到画布中的指定点,不创建线条。用 `stroke` 方法来画线条
|
|
848
|
-
* @supported weapp
|
|
847
|
+
* @supported weapp
|
|
849
848
|
* @example
|
|
850
849
|
* ```tsx
|
|
851
850
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -871,7 +870,7 @@ declare module '../../index' {
|
|
|
871
870
|
* - 红色:起始点(20, 20)
|
|
872
871
|
* - 蓝色:控制点(20, 100)
|
|
873
872
|
* - 绿色:终止点(200, 20)
|
|
874
|
-
* @supported weapp
|
|
873
|
+
* @supported weapp
|
|
875
874
|
* @example
|
|
876
875
|
* ```tsx
|
|
877
876
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -918,7 +917,7 @@ declare module '../../index' {
|
|
|
918
917
|
y: number,
|
|
919
918
|
): void
|
|
920
919
|
/** 创建一个矩形路径。需要用 [`fill`](/docs/apis/canvas/CanvasContext#fill) 或者 [`stroke`](/docs/apis/canvas/CanvasContext#stroke) 方法将矩形真正的画到 `canvas` 中
|
|
921
|
-
* @supported weapp
|
|
920
|
+
* @supported weapp
|
|
922
921
|
* @example
|
|
923
922
|
* ```tsx
|
|
924
923
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -940,12 +939,12 @@ declare module '../../index' {
|
|
|
940
939
|
height: number,
|
|
941
940
|
): void
|
|
942
941
|
/** 重置绘图上下文状态
|
|
943
|
-
* @supported
|
|
942
|
+
* @supported weapp
|
|
944
943
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/reset
|
|
945
944
|
*/
|
|
946
945
|
reset(): void
|
|
947
946
|
/** 恢复之前保存的绘图上下文
|
|
948
|
-
* @supported weapp
|
|
947
|
+
* @supported weapp
|
|
949
948
|
* @example
|
|
950
949
|
* ```tsx
|
|
951
950
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -962,7 +961,7 @@ declare module '../../index' {
|
|
|
962
961
|
*/
|
|
963
962
|
restore(): void
|
|
964
963
|
/** 以原点为中心顺时针旋转当前坐标轴。多次调用旋转的角度会叠加。原点可以用 `translate` 方法修改。
|
|
965
|
-
* @supported weapp
|
|
964
|
+
* @supported weapp
|
|
966
965
|
* @example
|
|
967
966
|
* ```tsx
|
|
968
967
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -980,7 +979,7 @@ declare module '../../index' {
|
|
|
980
979
|
rotate: number,
|
|
981
980
|
): void
|
|
982
981
|
/** 保存绘图上下文。
|
|
983
|
-
* @supported weapp
|
|
982
|
+
* @supported weapp
|
|
984
983
|
* @example
|
|
985
984
|
* ```tsx
|
|
986
985
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -997,7 +996,7 @@ declare module '../../index' {
|
|
|
997
996
|
*/
|
|
998
997
|
save(): void
|
|
999
998
|
/** 在调用后,之后创建的路径其横纵坐标会被缩放。多次调用倍数会相乘。
|
|
1000
|
-
* @supported weapp
|
|
999
|
+
* @supported weapp
|
|
1001
1000
|
* @example
|
|
1002
1001
|
* ```tsx
|
|
1003
1002
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1017,7 +1016,7 @@ declare module '../../index' {
|
|
|
1017
1016
|
scaleHeight: number,
|
|
1018
1017
|
): void
|
|
1019
1018
|
/** 设置填充色。
|
|
1020
|
-
* @supported weapp
|
|
1019
|
+
* @supported weapp
|
|
1021
1020
|
* @example
|
|
1022
1021
|
* ```tsx
|
|
1023
1022
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1032,7 +1031,7 @@ declare module '../../index' {
|
|
|
1032
1031
|
color: string | CanvasGradient,
|
|
1033
1032
|
): void
|
|
1034
1033
|
/** 设置字体的字号
|
|
1035
|
-
* @supported weapp
|
|
1034
|
+
* @supported weapp
|
|
1036
1035
|
* @example
|
|
1037
1036
|
* ```tsx
|
|
1038
1037
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1053,7 +1052,7 @@ declare module '../../index' {
|
|
|
1053
1052
|
fontSize: number,
|
|
1054
1053
|
): void
|
|
1055
1054
|
/** 设置全局画笔透明度。
|
|
1056
|
-
* @supported weapp
|
|
1055
|
+
* @supported weapp
|
|
1057
1056
|
* @example
|
|
1058
1057
|
* ```tsx
|
|
1059
1058
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1073,7 +1072,7 @@ declare module '../../index' {
|
|
|
1073
1072
|
alpha: number,
|
|
1074
1073
|
): void
|
|
1075
1074
|
/** 设置线条的端点样式
|
|
1076
|
-
* @supported weapp
|
|
1075
|
+
* @supported weapp
|
|
1077
1076
|
* @example
|
|
1078
1077
|
* ```tsx
|
|
1079
1078
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1108,7 +1107,7 @@ declare module '../../index' {
|
|
|
1108
1107
|
lineCap: keyof CanvasContext.LineCap,
|
|
1109
1108
|
): void
|
|
1110
1109
|
/** 设置虚线样式。
|
|
1111
|
-
* @supported weapp
|
|
1110
|
+
* @supported weapp
|
|
1112
1111
|
* @example
|
|
1113
1112
|
* ```tsx
|
|
1114
1113
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1128,7 +1127,7 @@ declare module '../../index' {
|
|
|
1128
1127
|
offset: number,
|
|
1129
1128
|
): void
|
|
1130
1129
|
/** 设置线条的交点样式
|
|
1131
|
-
* @supported weapp
|
|
1130
|
+
* @supported weapp
|
|
1132
1131
|
* @example
|
|
1133
1132
|
* ```tsx
|
|
1134
1133
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1167,7 +1166,7 @@ declare module '../../index' {
|
|
|
1167
1166
|
lineJoin: keyof CanvasContext.LineJoin,
|
|
1168
1167
|
): void
|
|
1169
1168
|
/** 设置线条的宽度
|
|
1170
|
-
* @supported weapp
|
|
1169
|
+
* @supported weapp
|
|
1171
1170
|
* @example
|
|
1172
1171
|
* ```tsx
|
|
1173
1172
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1199,7 +1198,7 @@ declare module '../../index' {
|
|
|
1199
1198
|
lineWidth: number,
|
|
1200
1199
|
): void
|
|
1201
1200
|
/** 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](/docs/apis/canvas/CanvasContext#setlinejoin) 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示。
|
|
1202
|
-
* @supported weapp
|
|
1201
|
+
* @supported weapp
|
|
1203
1202
|
* @example
|
|
1204
1203
|
* ```tsx
|
|
1205
1204
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1244,7 +1243,7 @@ declare module '../../index' {
|
|
|
1244
1243
|
miterLimit: number,
|
|
1245
1244
|
): void
|
|
1246
1245
|
/** 设定阴影样式。
|
|
1247
|
-
* @supported weapp
|
|
1246
|
+
* @supported weapp
|
|
1248
1247
|
* @example
|
|
1249
1248
|
* ```tsx
|
|
1250
1249
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1266,7 +1265,7 @@ declare module '../../index' {
|
|
|
1266
1265
|
color: string,
|
|
1267
1266
|
): void
|
|
1268
1267
|
/** 设置描边颜色。
|
|
1269
|
-
* @supported weapp
|
|
1268
|
+
* @supported weapp
|
|
1270
1269
|
* @example
|
|
1271
1270
|
* ```tsx
|
|
1272
1271
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1281,7 +1280,7 @@ declare module '../../index' {
|
|
|
1281
1280
|
color: string | CanvasGradient,
|
|
1282
1281
|
): void
|
|
1283
1282
|
/** 设置文字的对齐
|
|
1284
|
-
* @supported weapp
|
|
1283
|
+
* @supported weapp
|
|
1285
1284
|
* @example
|
|
1286
1285
|
* ```tsx
|
|
1287
1286
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1307,7 +1306,7 @@ declare module '../../index' {
|
|
|
1307
1306
|
align: keyof CanvasContext.Align,
|
|
1308
1307
|
): void
|
|
1309
1308
|
/** 设置文字的竖直对齐
|
|
1310
|
-
* @supported weapp
|
|
1309
|
+
* @supported weapp
|
|
1311
1310
|
* @example
|
|
1312
1311
|
* ```tsx
|
|
1313
1312
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1336,7 +1335,7 @@ declare module '../../index' {
|
|
|
1336
1335
|
textBaseline: keyof CanvasContext.TextBaseline,
|
|
1337
1336
|
): void
|
|
1338
1337
|
/** 使用矩阵重新设置(覆盖)当前变换的方法
|
|
1339
|
-
* @supported weapp
|
|
1338
|
+
* @supported weapp
|
|
1340
1339
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTransform.html
|
|
1341
1340
|
*/
|
|
1342
1341
|
setTransform(
|
|
@@ -1354,7 +1353,7 @@ declare module '../../index' {
|
|
|
1354
1353
|
translateY: number,
|
|
1355
1354
|
): void
|
|
1356
1355
|
/** 使用矩阵重新设置(覆盖)当前变换的方法
|
|
1357
|
-
* @supported
|
|
1356
|
+
* @supported weapp
|
|
1358
1357
|
* @see https://opendocs.alipay.com/mini/api/wt6glg?pathHash=1d428fc1
|
|
1359
1358
|
*/
|
|
1360
1359
|
setTransform(
|
|
@@ -1372,7 +1371,7 @@ declare module '../../index' {
|
|
|
1372
1371
|
translateY: number,
|
|
1373
1372
|
): void
|
|
1374
1373
|
/** 使用矩阵重新设置(覆盖)当前变换的方法
|
|
1375
|
-
* @supported
|
|
1374
|
+
* @supported weapp
|
|
1376
1375
|
* @see https://q.qq.com/wiki/develop/miniprogram/API/canvas/canvasContext.html#settransform
|
|
1377
1376
|
*/
|
|
1378
1377
|
setTransform(
|
|
@@ -1390,7 +1389,7 @@ declare module '../../index' {
|
|
|
1390
1389
|
translateY: number,
|
|
1391
1390
|
): void
|
|
1392
1391
|
/** 画出当前路径的边框。默认颜色色为黑色。
|
|
1393
|
-
* @supported weapp
|
|
1392
|
+
* @supported weapp
|
|
1394
1393
|
* @example
|
|
1395
1394
|
* ```tsx
|
|
1396
1395
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1425,7 +1424,7 @@ declare module '../../index' {
|
|
|
1425
1424
|
*/
|
|
1426
1425
|
stroke(): void
|
|
1427
1426
|
/** 画一个矩形(非填充)。 用 [`setStrokeStyle`](/docs/apis/canvas/CanvasContext#setstrokestyle) 设置矩形线条的颜色,如果没设置默认是黑色。
|
|
1428
|
-
* @supported weapp
|
|
1427
|
+
* @supported weapp
|
|
1429
1428
|
* @example
|
|
1430
1429
|
* ```tsx
|
|
1431
1430
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1446,7 +1445,7 @@ declare module '../../index' {
|
|
|
1446
1445
|
height: number,
|
|
1447
1446
|
): void
|
|
1448
1447
|
/** 给定的 (x, y) 位置绘制文本描边的方法
|
|
1449
|
-
* @supported weapp
|
|
1448
|
+
* @supported weapp
|
|
1450
1449
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeText.html
|
|
1451
1450
|
*/
|
|
1452
1451
|
strokeText(
|
|
@@ -1460,7 +1459,7 @@ declare module '../../index' {
|
|
|
1460
1459
|
maxWidth?: number,
|
|
1461
1460
|
): void
|
|
1462
1461
|
/** 使用矩阵多次叠加当前变换的方法
|
|
1463
|
-
* @supported weapp
|
|
1462
|
+
* @supported weapp
|
|
1464
1463
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.transform.html
|
|
1465
1464
|
*/
|
|
1466
1465
|
transform(
|
|
@@ -1478,7 +1477,7 @@ declare module '../../index' {
|
|
|
1478
1477
|
translateY: number,
|
|
1479
1478
|
): void
|
|
1480
1479
|
/** 使用矩阵叠加当前变换。矩阵由方法的参数进行描述,可以缩放、旋转、移动和倾斜上下文
|
|
1481
|
-
* @supported
|
|
1480
|
+
* @supported weapp
|
|
1482
1481
|
* @see https://opendocs.alipay.com/mini/api/fv97do?pathHash=42ccd479
|
|
1483
1482
|
*/
|
|
1484
1483
|
transform(
|
|
@@ -1496,7 +1495,7 @@ declare module '../../index' {
|
|
|
1496
1495
|
translateY: number,
|
|
1497
1496
|
): void
|
|
1498
1497
|
/** 使用矩阵多次叠加当前变换的方法
|
|
1499
|
-
* @supported
|
|
1498
|
+
* @supported weapp
|
|
1500
1499
|
* @see https://q.qq.com/wiki/develop/miniprogram/API/canvas/canvasContext.html#transform
|
|
1501
1500
|
*/
|
|
1502
1501
|
transform(
|
|
@@ -1514,7 +1513,7 @@ declare module '../../index' {
|
|
|
1514
1513
|
translateY: number,
|
|
1515
1514
|
): void
|
|
1516
1515
|
/** 对当前坐标系的原点 (0, 0) 进行变换。默认的坐标系原点为页面左上角。
|
|
1517
|
-
* @supported weapp
|
|
1516
|
+
* @supported weapp
|
|
1518
1517
|
* @example
|
|
1519
1518
|
* ```tsx
|
|
1520
1519
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1577,31 +1576,31 @@ declare module '../../index' {
|
|
|
1577
1576
|
/** 参数 textBaseline 可选值 */
|
|
1578
1577
|
interface TextBaseline {
|
|
1579
1578
|
/** 顶部对齐
|
|
1580
|
-
* @supported weapp
|
|
1579
|
+
* @supported weapp
|
|
1581
1580
|
*/
|
|
1582
1581
|
top
|
|
1583
1582
|
/** 底部对齐
|
|
1584
|
-
* @supported weapp
|
|
1583
|
+
* @supported weapp
|
|
1585
1584
|
*/
|
|
1586
1585
|
bottom
|
|
1587
1586
|
/** 居中对齐
|
|
1588
|
-
* @supported weapp
|
|
1587
|
+
* @supported weapp
|
|
1589
1588
|
*/
|
|
1590
1589
|
middle
|
|
1591
1590
|
/**
|
|
1592
|
-
* @supported weapp
|
|
1591
|
+
* @supported weapp
|
|
1593
1592
|
*/
|
|
1594
1593
|
normal
|
|
1595
1594
|
/** 文本基线为悬挂基线。
|
|
1596
|
-
* @supported
|
|
1595
|
+
* @supported weapp
|
|
1597
1596
|
*/
|
|
1598
1597
|
hanging
|
|
1599
1598
|
/** 文本基线是标准的字母基线
|
|
1600
|
-
* @supported
|
|
1599
|
+
* @supported weapp
|
|
1601
1600
|
*/
|
|
1602
1601
|
alphabetic
|
|
1603
1602
|
/** 文字基线是表意字基线。如果字符本身超出了alphabetic 基线,那么ideograhpic基线位置在字符本身的底部。
|
|
1604
|
-
* @supported
|
|
1603
|
+
* @supported weapp
|
|
1605
1604
|
*/
|
|
1606
1605
|
ideographic
|
|
1607
1606
|
}
|
|
@@ -1613,7 +1612,7 @@ declare module '../../index' {
|
|
|
1613
1612
|
*/
|
|
1614
1613
|
interface CanvasGradient {
|
|
1615
1614
|
/** 添加颜色的渐变点。小于最小 stop 的部分会按最小 stop 的 color 来渲染,大于最大 stop 的部分会按最大 stop 的 color 来渲染
|
|
1616
|
-
* @supported weapp
|
|
1615
|
+
* @supported weapp
|
|
1617
1616
|
* @example
|
|
1618
1617
|
* ```tsx
|
|
1619
1618
|
* const ctx = Taro.createCanvasContext('myCanvas')
|
|
@@ -1861,7 +1860,7 @@ declare module '../../index' {
|
|
|
1861
1860
|
/** 该方法返回 OffscreenCanvas 的绘图上下文
|
|
1862
1861
|
*
|
|
1863
1862
|
* > 当前仅支持获取 WebGL 绘图上下文
|
|
1864
|
-
* @supported weapp
|
|
1863
|
+
* @supported weapp
|
|
1865
1864
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.getContext.html
|
|
1866
1865
|
*/
|
|
1867
1866
|
getContext(contextType: 'webgl' | '2d'): RenderingContext
|
|
@@ -2006,14 +2005,14 @@ declare module '../../index' {
|
|
|
2006
2005
|
* - 通过 Canvas.getContext('2d') 接口可以获取 CanvasRenderingContext2D 对象,实现了 [HTML Canvas 2D Context](https://www.w3.org/TR/2dcontext/) 定义的属性、方法。
|
|
2007
2006
|
* - 通过 Canvas.getContext('webgl') 或 OffscreenCanvas.getContext('webgl') 接口可以获取 WebGLRenderingContext 对象,实现了 [WebGL 1.0](https://www.khronos.org/registry/webgl/specs/latest/1.0/) 定义的所有属性、方法、常量。
|
|
2008
2007
|
* - CanvasRenderingContext2D 的 drawImage 方法 2.10.0 起支持传入通过 SelectorQuery 获取的 video 对象,2.29.0 起支持传入开启了自定义渲染的 LivePusherContext 对象。
|
|
2009
|
-
* @supported weapp
|
|
2008
|
+
* @supported weapp
|
|
2010
2009
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html
|
|
2011
2010
|
*/
|
|
2012
2011
|
interface RenderingContext {}
|
|
2013
2012
|
|
|
2014
2013
|
interface TaroStatic {
|
|
2015
2014
|
/** 创建离屏 canvas 实例
|
|
2016
|
-
* @supported weapp
|
|
2015
|
+
* @supported weapp
|
|
2017
2016
|
* @example
|
|
2018
2017
|
* ```tsx
|
|
2019
2018
|
* // 创建离屏 2D canvas 实例
|
|
@@ -2048,7 +2047,7 @@ declare module '../../index' {
|
|
|
2048
2047
|
/** 创建 canvas 的绘图上下文 [CanvasContext](/docs/apis/canvas/CanvasContext) 对象
|
|
2049
2048
|
*
|
|
2050
2049
|
* **Tip**: 需要指定 canvasId,该绘图上下文只作用于对应的 `<canvas/>`;另外,Web 端需要在 `useReady` 回调中执行它,否则会因为底层 canvas 渲染出来之前而去获取 CanvasContext,导致其底层的 context 为 `undefined`,从而不能正常绘图。
|
|
2051
|
-
* @supported weapp
|
|
2050
|
+
* @supported weapp
|
|
2052
2051
|
* @example
|
|
2053
2052
|
* ```tsx
|
|
2054
2053
|
* import { useReady } from '@spcsn/taro'
|
|
@@ -2102,7 +2101,7 @@ declare module '../../index' {
|
|
|
2102
2101
|
* }
|
|
2103
2102
|
* })
|
|
2104
2103
|
* ```
|
|
2105
|
-
* @supported weapp
|
|
2104
|
+
* @supported weapp
|
|
2106
2105
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasToTempFilePath.html
|
|
2107
2106
|
*/
|
|
2108
2107
|
canvasToTempFilePath(
|
|
@@ -2112,7 +2111,7 @@ declare module '../../index' {
|
|
|
2112
2111
|
): Promise<canvasToTempFilePath.SuccessCallbackResult>
|
|
2113
2112
|
|
|
2114
2113
|
/** 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内 `<canvas>` 组件
|
|
2115
|
-
* @supported weapp
|
|
2114
|
+
* @supported weapp
|
|
2116
2115
|
* @example
|
|
2117
2116
|
* ```tsx
|
|
2118
2117
|
* const data = new Uint8ClampedArray([255, 0, 0, 1])
|
|
@@ -2134,7 +2133,7 @@ declare module '../../index' {
|
|
|
2134
2133
|
): Promise<TaroGeneral.CallbackResult>
|
|
2135
2134
|
|
|
2136
2135
|
/** 获取 canvas 区域隐含的像素数据。
|
|
2137
|
-
* @supported weapp
|
|
2136
|
+
* @supported weapp
|
|
2138
2137
|
* @example
|
|
2139
2138
|
* ```tsx
|
|
2140
2139
|
* Taro.canvasGetImageData({
|
|
@@ -56,7 +56,7 @@ declare module '../../index' {
|
|
|
56
56
|
* ```tsx
|
|
57
57
|
* Taro.startAccelerometer({ interval: 'game' })
|
|
58
58
|
* ```
|
|
59
|
-
* @supported weapp
|
|
59
|
+
* @supported weapp
|
|
60
60
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html
|
|
61
61
|
*/
|
|
62
62
|
startAccelerometer (res?: startAccelerometer.Option): Promise<TaroGeneral.CallbackResult>
|
|
@@ -67,14 +67,14 @@ declare module '../../index' {
|
|
|
67
67
|
* ```tsx
|
|
68
68
|
* Taro.stopAccelerometer()
|
|
69
69
|
* ```
|
|
70
|
-
* @supported weapp
|
|
70
|
+
* @supported weapp
|
|
71
71
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.stopAccelerometer.html
|
|
72
72
|
*/
|
|
73
73
|
stopAccelerometer (res?: stopAccelerometer.Option): Promise<TaroGeneral.CallbackResult>
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* 监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 `Taro.stopAccelerometer` 停止监听。
|
|
77
|
-
* @supported weapp
|
|
77
|
+
* @supported weapp
|
|
78
78
|
* @example
|
|
79
79
|
* ```tsx
|
|
80
80
|
* Taro.onAccelerometerChange(res => {
|
|
@@ -91,7 +91,7 @@ declare module '../../index' {
|
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* 取消监听加速度数据事件,参数为空,则取消所有的事件监听。
|
|
94
|
-
* @supported weapp
|
|
94
|
+
* @supported weapp
|
|
95
95
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.offAccelerometerChange.html
|
|
96
96
|
*/
|
|
97
97
|
offAccelerometerChange(
|
|
@@ -18,7 +18,7 @@ declare module '../../index' {
|
|
|
18
18
|
|
|
19
19
|
interface TaroStatic {
|
|
20
20
|
/** 检测是否开启视觉无障碍功能。
|
|
21
|
-
* @supported weapp
|
|
21
|
+
* @supported weapp
|
|
22
22
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accessibility/wx.checkIsOpenAccessibility.html
|
|
23
23
|
*/
|
|
24
24
|
checkIsOpenAccessibility(option: checkIsOpenAccessibility.Option): Promise<TaroGeneral.CallbackResult>
|
|
@@ -32,13 +32,13 @@ declare module '../../index' {
|
|
|
32
32
|
|
|
33
33
|
interface TaroStatic {
|
|
34
34
|
/** Taro.getBatteryInfo 的同步版本
|
|
35
|
-
* @supported weapp
|
|
35
|
+
* @supported weapp
|
|
36
36
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html
|
|
37
37
|
*/
|
|
38
38
|
getBatteryInfoSync(): getBatteryInfoSync.Result
|
|
39
39
|
|
|
40
40
|
/** 获取设备电量。同步 API Taro.getBatteryInfoSync 在 iOS 上不可用。
|
|
41
|
-
* @supported weapp
|
|
41
|
+
* @supported weapp
|
|
42
42
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html
|
|
43
43
|
*/
|
|
44
44
|
getBatteryInfo(option?: getBatteryInfo.Option): Promise<getBatteryInfo.SuccessCallbackResult>
|