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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "3.7.0-alpha.12",
3
+ "version": "3.7.0-alpha.13",
4
4
  "description": "Taro framework",
5
5
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
6
6
  "main": "index.js",
@@ -21,11 +21,11 @@
21
21
  "author": "O2Team",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@tarojs/api": "3.7.0-alpha.12",
25
- "@tarojs/runtime": "3.7.0-alpha.12"
24
+ "@tarojs/api": "3.7.0-alpha.13",
25
+ "@tarojs/runtime": "3.7.0-alpha.13"
26
26
  },
27
27
  "devDependencies": {
28
- "@tarojs/helper": "3.7.0-alpha.12"
28
+ "@tarojs/helper": "3.7.0-alpha.13"
29
29
  },
30
30
  "peerDependenciesMeta": {
31
31
  "@types/react": {
@@ -42,6 +42,9 @@
42
42
  },
43
43
  "vue": {
44
44
  "optional": true
45
+ },
46
+ "rollup": {
47
+ "optional": true
45
48
  }
46
49
  },
47
50
  "scripts": {
@@ -242,7 +242,7 @@ declare module '../../index' {
242
242
  * - 绿色: 圆心 (100, 75)
243
243
  * - 红色: 起始弧度 (0)
244
244
  * - 蓝色: 终止弧度 (1.5 * Math.PI)
245
- * @supported weapp
245
+ * @supported weapp, h5
246
246
  * @example
247
247
  * ```tsx
248
248
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -300,7 +300,7 @@ declare module '../../index' {
300
300
  counterclockwise?: boolean,
301
301
  ): void
302
302
  /** 根据控制点和半径绘制圆弧路径。
303
- * @supported weapp
303
+ * @supported weapp, h5
304
304
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arcTo.html
305
305
  */
306
306
  arcTo(
@@ -319,7 +319,7 @@ declare module '../../index' {
319
319
  *
320
320
  * - 在最开始的时候相当于调用了一次 `beginPath`。
321
321
  * - 同一个路径内的多次 `setFillStyle`、`setStrokeStyle`、`setLineWidth`等设置,以最后一次设置为准。
322
- * @supported weapp
322
+ * @supported weapp, h5
323
323
  * @example
324
324
  * ```tsx
325
325
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -349,7 +349,7 @@ declare module '../../index' {
349
349
  * - 红色:起始点(20, 20)
350
350
  * - 蓝色:两个控制点(20, 100) (200, 100)
351
351
  * - 绿色:终止点(200, 20)
352
- * @supported weapp
352
+ * @supported weapp, h5
353
353
  * @example
354
354
  * ```tsx
355
355
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -404,7 +404,7 @@ declare module '../../index' {
404
404
  y: number,
405
405
  ): void
406
406
  /** 清除画布上在该矩形区域内的内容
407
- * @supported weapp
407
+ * @supported weapp, h5
408
408
  * @example
409
409
  * clearRect 并非画一个白色的矩形在地址区域,而是清空,为了有直观感受,对 canvas 加了一层背景色。
410
410
  * ```html
@@ -432,7 +432,7 @@ declare module '../../index' {
432
432
  height: number,
433
433
  ): void
434
434
  /** 从原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内(不能访问画布上的其他区域)。可以在使用 `clip` 方法前通过使用 `save` 方法对当前画布区域进行保存,并在以后的任意时间通过`restore`方法对其进行恢复。
435
- * @supported weapp
435
+ * @supported weapp, h5
436
436
  * @example
437
437
  * ```tsx
438
438
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -453,7 +453,7 @@ declare module '../../index' {
453
453
  */
454
454
  clip(): void
455
455
  /** 关闭一个路径。会连接起点和终点。如果关闭路径后没有调用 `fill` 或者 `stroke` 并开启了新的路径,那之前的路径将不会被渲染。
456
- * @supported weapp
456
+ * @supported weapp, h5
457
457
  * @example
458
458
  * ```tsx
459
459
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -486,7 +486,7 @@ declare module '../../index' {
486
486
  */
487
487
  closePath(): void
488
488
  /** 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](/docs/apis/canvas/CanvasGradient#addcolorstop) 来指定渐变点,至少要两个。
489
- * @supported weapp
489
+ * @supported weapp, h5
490
490
  * @example
491
491
  * ```tsx
492
492
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -510,7 +510,7 @@ declare module '../../index' {
510
510
  r: number,
511
511
  ): CanvasGradient
512
512
  /** 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](/docs/apis/canvas/CanvasGradient#addcolorstop) 来指定渐变点,至少要两个。
513
- * @supported weapp
513
+ * @supported weapp, h5
514
514
  * @example
515
515
  * ```tsx
516
516
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -536,7 +536,7 @@ declare module '../../index' {
536
536
  y1: number,
537
537
  ): CanvasGradient
538
538
  /** 对指定的图像创建模式的方法,可在指定的方向上重复元图像
539
- * @supported weapp
539
+ * @supported weapp, h5
540
540
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createPattern.html
541
541
  */
542
542
  createPattern(
@@ -544,9 +544,10 @@ declare module '../../index' {
544
544
  image: string,
545
545
  /** 如何重复图像 */
546
546
  repetition: keyof CanvasContext.Repetition,
547
- ): void
547
+ ): CanvasPattern | null | Promise<CanvasPattern | null>
548
548
  /** 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
549
- * @supported weapp
549
+ * @supported weapp, h5
550
+ * @h5 第二次调用 draw 前需要等待上一次 draw 调用结束后再调用,否则新的一次 draw 调用栈不会清空而导致结果异常。
550
551
  * @example
551
552
  * 第二次 draw() reserve 为 true。所以保留了上一次的绘制结果,在上下文设置的 fillStyle 'red' 也变成了默认的 'black'。
552
553
  *
@@ -554,9 +555,10 @@ declare module '../../index' {
554
555
  * const ctx = Taro.createCanvasContext('myCanvas')
555
556
  * ctx.setFillStyle('red')
556
557
  * ctx.fillRect(10, 10, 150, 100)
557
- * ctx.draw()
558
- * ctx.fillRect(50, 50, 150, 100)
559
- * ctx.draw(true)
558
+ * ctx.draw(false, () => {
559
+ * ctx.fillRect(50, 50, 150, 100)
560
+ * ctx.draw(true)
561
+ * })
560
562
  * ```
561
563
  * @example
562
564
  * 第二次 draw() reserve 为 false。所以没有保留了上一次的绘制结果和在上下文设置的 fillStyle 'red'。
@@ -565,9 +567,10 @@ declare module '../../index' {
565
567
  * const ctx = Taro.createCanvasContext('myCanvas')
566
568
  * ctx.setFillStyle('red')
567
569
  * ctx.fillRect(10, 10, 150, 100)
568
- * ctx.draw()
569
- * ctx.fillRect(50, 50, 150, 100)
570
- * ctx.draw()
570
+ * ctx.draw(false, () => {
571
+ * ctx.fillRect(50, 50, 150, 100)
572
+ * ctx.draw()
573
+ * })
571
574
  * ```
572
575
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.draw.html
573
576
  */
@@ -576,9 +579,9 @@ declare module '../../index' {
576
579
  reserve?: boolean,
577
580
  /** 绘制完成后执行的回调函数 */
578
581
  callback?: (...args: any[]) => any,
579
- ): void
582
+ ): void | Promise<void>
580
583
  /** 绘制图像到画布
581
- * @supported weapp
584
+ * @supported weapp, h5
582
585
  * @example
583
586
  * 有三个版本的写法:
584
587
  *
@@ -606,7 +609,7 @@ declare module '../../index' {
606
609
  dy: number,
607
610
  ): void
608
611
  /** 绘制图像到画布
609
- * @supported weapp
612
+ * @supported weapp, h5
610
613
  * @example
611
614
  * 有三个版本的写法:
612
615
  *
@@ -638,7 +641,7 @@ declare module '../../index' {
638
641
  dHeight: number,
639
642
  ): void
640
643
  /** 绘制图像到画布
641
- * @supported weapp
644
+ * @supported weapp, h5
642
645
  * @example
643
646
  * 有三个版本的写法:
644
647
  *
@@ -678,7 +681,7 @@ declare module '../../index' {
678
681
  dHeight: number,
679
682
  ): void
680
683
  /** 对当前路径中的内容进行填充。默认的填充色为黑色。
681
- * @supported weapp
684
+ * @supported weapp, h5
682
685
  * @example
683
686
  * 如果当前路径没有闭合,fill() 方法会将起点和终点进行连接,然后填充。
684
687
  *
@@ -715,7 +718,7 @@ declare module '../../index' {
715
718
  */
716
719
  fill(): void
717
720
  /** 填充一个矩形。用 [`setFillStyle`](/docs/apis/canvas/CanvasContext#setfillstyle) 设置矩形的填充色,如果没设置默认是黑色。
718
- * @supported weapp
721
+ * @supported weapp, h5
719
722
  * @example
720
723
  * ```tsx
721
724
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -736,7 +739,7 @@ declare module '../../index' {
736
739
  height: number,
737
740
  ): void
738
741
  /** 在画布上绘制被填充的文本
739
- * @supported weapp
742
+ * @supported weapp, h5
740
743
  * @example
741
744
  * ```tsx
742
745
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -758,7 +761,7 @@ declare module '../../index' {
758
761
  maxWidth?: number,
759
762
  ): void
760
763
  /** 增加一个新点,然后创建一条从上次指定点到目标点的线。用 `stroke` 方法来画线条
761
- * @supported weapp
764
+ * @supported weapp, h5
762
765
  * @example
763
766
  * ```tsx
764
767
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -777,7 +780,7 @@ declare module '../../index' {
777
780
  y: number,
778
781
  ): void
779
782
  /** 测量文本尺寸信息。目前仅返回文本宽度。同步接口。
780
- * @supported weapp
783
+ * @supported weapp, h5
781
784
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html
782
785
  */
783
786
  measureText(
@@ -785,7 +788,7 @@ declare module '../../index' {
785
788
  text: string,
786
789
  ): TextMetrics
787
790
  /** 把路径移动到画布中的指定点,不创建线条。用 `stroke` 方法来画线条
788
- * @supported weapp
791
+ * @supported weapp, h5
789
792
  * @example
790
793
  * ```tsx
791
794
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -811,7 +814,7 @@ declare module '../../index' {
811
814
  * - 红色:起始点(20, 20)
812
815
  * - 蓝色:控制点(20, 100)
813
816
  * - 绿色:终止点(200, 20)
814
- * @supported weapp
817
+ * @supported weapp, h5
815
818
  * @example
816
819
  * ```tsx
817
820
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -858,7 +861,7 @@ declare module '../../index' {
858
861
  y: number,
859
862
  ): void
860
863
  /** 创建一个矩形路径。需要用 [`fill`](/docs/apis/canvas/CanvasContext#fill) 或者 [`stroke`](/docs/apis/canvas/CanvasContext#stroke) 方法将矩形真正的画到 `canvas` 中
861
- * @supported weapp
864
+ * @supported weapp, h5
862
865
  * @example
863
866
  * ```tsx
864
867
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -880,7 +883,7 @@ declare module '../../index' {
880
883
  height: number,
881
884
  ): void
882
885
  /** 恢复之前保存的绘图上下文
883
- * @supported weapp
886
+ * @supported weapp, h5
884
887
  * @example
885
888
  * ```tsx
886
889
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -897,7 +900,7 @@ declare module '../../index' {
897
900
  */
898
901
  restore(): void
899
902
  /** 以原点为中心顺时针旋转当前坐标轴。多次调用旋转的角度会叠加。原点可以用 `translate` 方法修改。
900
- * @supported weapp
903
+ * @supported weapp, h5
901
904
  * @example
902
905
  * ```tsx
903
906
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -915,7 +918,7 @@ declare module '../../index' {
915
918
  rotate: number,
916
919
  ): void
917
920
  /** 保存绘图上下文。
918
- * @supported weapp
921
+ * @supported weapp, h5
919
922
  * @example
920
923
  * ```tsx
921
924
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -932,7 +935,7 @@ declare module '../../index' {
932
935
  */
933
936
  save(): void
934
937
  /** 在调用后,之后创建的路径其横纵坐标会被缩放。多次调用倍数会相乘。
935
- * @supported weapp
938
+ * @supported weapp, h5
936
939
  * @example
937
940
  * ```tsx
938
941
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -952,7 +955,7 @@ declare module '../../index' {
952
955
  scaleHeight: number,
953
956
  ): void
954
957
  /** 设置填充色。
955
- * @supported weapp
958
+ * @supported weapp, h5
956
959
  * @example
957
960
  * ```tsx
958
961
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -967,7 +970,7 @@ declare module '../../index' {
967
970
  color: string | CanvasGradient,
968
971
  ): void
969
972
  /** 设置字体的字号
970
- * @supported weapp
973
+ * @supported weapp, h5
971
974
  * @example
972
975
  * ```tsx
973
976
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -988,7 +991,7 @@ declare module '../../index' {
988
991
  fontSize: number,
989
992
  ): void
990
993
  /** 设置全局画笔透明度。
991
- * @supported weapp
994
+ * @supported weapp, h5
992
995
  * @example
993
996
  * ```tsx
994
997
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -1008,7 +1011,7 @@ declare module '../../index' {
1008
1011
  alpha: number,
1009
1012
  ): void
1010
1013
  /** 设置线条的端点样式
1011
- * @supported weapp
1014
+ * @supported weapp, h5
1012
1015
  * @example
1013
1016
  * ```tsx
1014
1017
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -1043,7 +1046,7 @@ declare module '../../index' {
1043
1046
  lineCap: keyof CanvasContext.LineCap,
1044
1047
  ): void
1045
1048
  /** 设置虚线样式。
1046
- * @supported weapp
1049
+ * @supported weapp, h5
1047
1050
  * @example
1048
1051
  * ```tsx
1049
1052
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -1063,7 +1066,7 @@ declare module '../../index' {
1063
1066
  offset: number,
1064
1067
  ): void
1065
1068
  /** 设置线条的交点样式
1066
- * @supported weapp
1069
+ * @supported weapp, h5
1067
1070
  * @example
1068
1071
  * ```tsx
1069
1072
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -1102,7 +1105,7 @@ declare module '../../index' {
1102
1105
  lineJoin: keyof CanvasContext.LineJoin,
1103
1106
  ): void
1104
1107
  /** 设置线条的宽度
1105
- * @supported weapp
1108
+ * @supported weapp, h5
1106
1109
  * @example
1107
1110
  * ```tsx
1108
1111
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -1134,7 +1137,7 @@ declare module '../../index' {
1134
1137
  lineWidth: number,
1135
1138
  ): void
1136
1139
  /** 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](/docs/apis/canvas/CanvasContext#setlinejoin) 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示。
1137
- * @supported weapp
1140
+ * @supported weapp, h5
1138
1141
  * @example
1139
1142
  * ```tsx
1140
1143
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -1179,7 +1182,7 @@ declare module '../../index' {
1179
1182
  miterLimit: number,
1180
1183
  ): void
1181
1184
  /** 设定阴影样式。
1182
- * @supported weapp
1185
+ * @supported weapp, h5
1183
1186
  * @example
1184
1187
  * ```tsx
1185
1188
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -1201,7 +1204,7 @@ declare module '../../index' {
1201
1204
  color: string,
1202
1205
  ): void
1203
1206
  /** 设置描边颜色。
1204
- * @supported weapp
1207
+ * @supported weapp, h5
1205
1208
  * @example
1206
1209
  * ```tsx
1207
1210
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -1216,7 +1219,7 @@ declare module '../../index' {
1216
1219
  color: string | CanvasGradient,
1217
1220
  ): void
1218
1221
  /** 设置文字的对齐
1219
- * @supported weapp
1222
+ * @supported weapp, h5
1220
1223
  * @example
1221
1224
  * ```tsx
1222
1225
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -1240,7 +1243,7 @@ declare module '../../index' {
1240
1243
  align: keyof CanvasContext.Align,
1241
1244
  ): void
1242
1245
  /** 设置文字的竖直对齐
1243
- * @supported weapp
1246
+ * @supported weapp, h5
1244
1247
  * @example
1245
1248
  * ```tsx
1246
1249
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -1266,7 +1269,7 @@ declare module '../../index' {
1266
1269
  textBaseline: keyof CanvasContext.TextBaseline,
1267
1270
  ): void
1268
1271
  /** 使用矩阵重新设置(覆盖)当前变换的方法
1269
- * @supported weapp
1272
+ * @supported weapp, h5
1270
1273
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTransform.html
1271
1274
  */
1272
1275
  setTransform(
@@ -1284,7 +1287,7 @@ declare module '../../index' {
1284
1287
  translateY: number,
1285
1288
  ): void
1286
1289
  /** 画出当前路径的边框。默认颜色色为黑色。
1287
- * @supported weapp
1290
+ * @supported weapp, h5
1288
1291
  * @example
1289
1292
  * ```tsx
1290
1293
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -1319,7 +1322,7 @@ declare module '../../index' {
1319
1322
  */
1320
1323
  stroke(): void
1321
1324
  /** 画一个矩形(非填充)。 用 [`setStrokeStyle`](/docs/apis/canvas/CanvasContext#setstrokestyle) 设置矩形线条的颜色,如果没设置默认是黑色。
1322
- * @supported weapp
1325
+ * @supported weapp, h5
1323
1326
  * @example
1324
1327
  * ```tsx
1325
1328
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -1340,7 +1343,7 @@ declare module '../../index' {
1340
1343
  height: number,
1341
1344
  ): void
1342
1345
  /** 给定的 (x, y) 位置绘制文本描边的方法
1343
- * @supported weapp
1346
+ * @supported weapp, h5
1344
1347
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeText.html
1345
1348
  */
1346
1349
  strokeText(
@@ -1354,7 +1357,7 @@ declare module '../../index' {
1354
1357
  maxWidth?: number,
1355
1358
  ): void
1356
1359
  /** 使用矩阵多次叠加当前变换的方法
1357
- * @supported weapp
1360
+ * @supported weapp, h5
1358
1361
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.transform.html
1359
1362
  */
1360
1363
  transform(
@@ -1372,7 +1375,7 @@ declare module '../../index' {
1372
1375
  translateY: number,
1373
1376
  ): void
1374
1377
  /** 对当前坐标系的原点 (0, 0) 进行变换。默认的坐标系原点为页面左上角。
1375
- * @supported weapp
1378
+ * @supported weapp, h5
1376
1379
  * @example
1377
1380
  * ```tsx
1378
1381
  * const ctx = Taro.createCanvasContext('myCanvas')
@@ -20,7 +20,7 @@ declare module '../../index' {
20
20
  /** 接口调用失败的回调函数 */
21
21
  fail?: (res: TaroGeneral.CallbackResult) => void
22
22
  /** 接口调用成功的回调函数 */
23
- success?: (result: SuccessCallbackResult) => void
23
+ success?: (result: TaroGeneral.CallbackResult) => void
24
24
  }
25
25
  }
26
26
 
@@ -60,4 +60,4 @@ declare module '../../index' {
60
60
  */
61
61
  getDeviceVoIPList(option: getDeviceVoIPList.Option): Promise<getDeviceVoIPList.SuccessCallbackResult>
62
62
  }
63
- }
63
+ }
@@ -8,7 +8,7 @@ declare module '../../index' {
8
8
  /** 接口调用失败的回调函数 */
9
9
  fail?: (res: TaroGeneral.CallbackResult) => void
10
10
  /** 接口调用成功的回调函数 */
11
- success?: (res: TaroGeneral.CallbackResult) => void
11
+ success?: (res: SuccessCallbackResult) => void
12
12
  }
13
13
 
14
14
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
@@ -23,6 +23,6 @@ declare module '../../index' {
23
23
  * @supported weapp
24
24
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/my-miniprogram/wx.checkIsAddedToMyMiniProgram.html
25
25
  */
26
- checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option):Promise<checkIsAddedToMyMiniProgram.SuccessCallbackResult>
26
+ checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option): void
27
27
  }
28
28
  }
@@ -0,0 +1,99 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace getPrivacySetting {
5
+ interface Option {
6
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
+ complete?: (res: TaroGeneral.CallbackResult) => void
8
+ /** 接口调用失败的回调函数 */
9
+ fail?: (res: TaroGeneral.CallbackResult) => void
10
+ /** 接口调用成功的回调函数 */
11
+ success?: (result: SuccessCallbackResult) => void
12
+ }
13
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
14
+ /** 是否需要用户授权隐私协议(如果开发者没有在[mp后台-设置-服务内容声明-用户隐私保护指引]中声明隐私收集类型则会返回false;如果开发者声明了隐私收集,且用户之前同意过隐私协议则会返回false;如果开发者声明了隐私收集,且用户还没同意过则返回true;如果用户之前同意过、但后来小程序又新增了隐私收集类型也会返回true) */
15
+ needAuthorization: boolean
16
+ /** 隐私授权协议的名称 */
17
+ privacyContractName: string
18
+ }
19
+ }
20
+
21
+ namespace requirePrivacyAuthorize {
22
+ interface Option {
23
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
24
+ complete?: (res: TaroGeneral.CallbackResult) => void
25
+ /** 接口调用失败的回调函数 */
26
+ fail?: (res: TaroGeneral.CallbackResult) => void
27
+ /** 接口调用成功的回调函数 */
28
+ success?: (result: TaroGeneral.CallbackResult) => void
29
+ }
30
+ }
31
+
32
+ namespace openPrivacyContract {
33
+ interface Option {
34
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
35
+ complete?: (res: TaroGeneral.CallbackResult) => void
36
+ /** 接口调用失败的回调函数 */
37
+ fail?: (res: TaroGeneral.CallbackResult) => void
38
+ /** 接口调用成功的回调函数 */
39
+ success?: (result: TaroGeneral.CallbackResult) => void
40
+ }
41
+ }
42
+
43
+ namespace onNeedPrivacyAuthorization {
44
+ /**
45
+ * resolve 是 onNeedPrivacyAuthorization 的回调参数,是一个接口函数。
46
+ * 当触发 needPrivacyAuthorization 事件时,触发该事件的隐私接口或组件会处于 pending 状态。
47
+ * 如果调用 resolve({ buttonId: 'disagree-btn', event:'agree' }),则触发当前 needPrivacyAuthorization 事件的原隐私接口或组件会继续执行。其中 buttonId 为隐私同意授权按钮的id,为确保用户有同意的操作,基础库会检查对应的同意按钮是否被点击过。
48
+ * 如果调用 resolve({ event: 'disagree' }),则触发当前 needPrivacyAuthorization 事件的原隐私接口或组件会失败并返回 API:fail privacy permission is not authorized 的错误信息。
49
+ * 在调用 resolve({ event: 'agree'/'disagree' }) 之前,开发者可以调用 resolve({ event: 'exposureAuthorization' }) 把隐私弹窗曝光告知平台。
50
+ */
51
+ interface ResolveOption {
52
+ /** 用户操作类型 */
53
+ event: 'exposureAuthorization' | 'agree' | 'disagree'
54
+ /** 同意授权按钮的id (仅event=agree时必填) */
55
+ buttonId?: string
56
+ }
57
+ /**
58
+ * 触发本次 onNeedPrivacyAuthorization 事件的关联信息
59
+ */
60
+ interface EventInfo {
61
+ referrer: string
62
+ }
63
+
64
+ /** 隐私授权监听函数 */
65
+ type Listener = (
66
+ /** 事件回调函数 */
67
+ resolve: (option: ResolveOption) => void,
68
+ /** 关联事件信息 */
69
+ eventInfo: EventInfo
70
+ ) => void
71
+ }
72
+
73
+ interface TaroStatic {
74
+ /**
75
+ * 查询隐私授权情况。隐私合规开发指南详情可见《小程序隐私协议开发指南》
76
+ * @supported weapp
77
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.getPrivacySetting.html
78
+ */
79
+ getPrivacySetting(option?: getPrivacySetting.Option): void
80
+ /**
81
+ * 跳转至隐私协议页面。隐私合规开发指南详情可见《小程序隐私协议开发指南》
82
+ * @supported weapp
83
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.openPrivacyContract.html
84
+ */
85
+ openPrivacyContract(option?: openPrivacyContract.Option): void
86
+ /**
87
+ * 模拟隐私接口调用,并触发隐私弹窗逻辑。隐私合规开发指南详情可见《小程序隐私协议开发指南》
88
+ * @supported weapp
89
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.requirePrivacyAuthorize.html
90
+ */
91
+ requirePrivacyAuthorize(option?: requirePrivacyAuthorize.Option): void
92
+ /**
93
+ * 监听隐私接口需要用户授权事件。当需要用户进行隐私授权时会触发。触发该事件时,开发者需要弹出隐私协议说明,并在用户同意或拒绝授权后调用回调接口 resolve 触发原隐私接口或组件继续执行。隐私合规开发指南详情可见《小程序隐私协议开发指南》
94
+ * @supported weapp
95
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.onNeedPrivacyAuthorization.html
96
+ */
97
+ onNeedPrivacyAuthorization(listener: onNeedPrivacyAuthorization.Listener): void
98
+ }
99
+ }
@@ -196,6 +196,7 @@ declare module '../../index' {
196
196
 
197
197
  /** 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages 获取当前的页面栈,决定需要返回几层。
198
198
  * @supported weapp, h5, rn, tt
199
+ * @h5 若入参 delta 大于现有页面数时,返回应用打开的第一个页面(如果想要返回首页请使用 reLaunch 方法)。
199
200
  * @example
200
201
  * ```tsx
201
202
  * // 注意:调用 navigateTo 跳转时,调用该方法的页面会被加入堆栈,而 redirectTo 方法则不会。见下方示例代码
@@ -83,7 +83,7 @@ declare module '../index' {
83
83
  /** 尺寸转换
84
84
  * @supported global
85
85
  */
86
- pxTransform(size: number, designWidth?: number): string
86
+ pxTransform(size: number): string
87
87
 
88
88
  /** 尺寸转换初始化
89
89
  * @supported global
@@ -3,6 +3,7 @@ import type Chain from 'webpack-chain'
3
3
  import type webpackDevServer from 'webpack-dev-server'
4
4
  import type HtmlWebpackPlugin from 'html-webpack-plugin'
5
5
  import type { IOption, IPostcssOption } from './util'
6
+ import type { OutputOptions as RollupOutputOptions } from 'rollup'
6
7
 
7
8
  export interface IH5RouterConfig {
8
9
  /** 配置路由模式 */
@@ -38,6 +39,9 @@ export interface IH5Config {
38
39
  /** 可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/) */
39
40
  output?: Webpack.Configuration['output']
40
41
 
42
+ /** vite 编译模式下,用于修改、扩展 rollup 的 output,配置想参考[官方文档](https://rollupjs.org/configuration-options/) */
43
+ viteOutput?: RollupOutputOptions
44
+
41
45
  /** 路由相关的配置 */
42
46
  router?: IH5RouterConfig
43
47
 
@@ -72,10 +72,12 @@
72
72
  /// <reference path="api/open-api/subscribe-message.d.ts" />
73
73
  /// <reference path="api/open-api/redpackage.d.ts" />
74
74
  /// <reference path="api/open-api/favorites.d.ts" />
75
+ /// <reference path="api/open-api/my-miniprogram.d.ts" />
75
76
  /// <reference path="api/open-api/license-plate.d.ts" />
76
77
  /// <reference path="api/open-api/channels.d.ts" />
77
78
  /// <reference path="api/open-api/device-voip.d.ts" />
78
79
  /// <reference path="api/open-api/group.d.ts" />
80
+ /// <reference path="api/open-api/privacy.d.ts" />
79
81
  /// <reference path="api/open-api/customer-service.d.ts" />
80
82
  /// <reference path="api/device/bluetooth.d.ts" />
81
83
  /// <reference path="api/device/bluetooth-ble.d.ts" />
@@ -90,7 +90,7 @@ declare module './index' {
90
90
  /** 创建一个 SelectorQuery 对象,选择器选取范围为这个组件实例内 */
91
91
  createSelectorQuery?(): SelectorQuery
92
92
  /** 创建一个 IntersectionObserver 对象,选择器选取范围为这个组件实例内 */
93
- createIntersectionObserver?(): IntersectionObserver
93
+ createIntersectionObserver?(options?: createIntersectionObserver.Option): IntersectionObserver
94
94
  /** 创建一个 MediaQueryObserver 对象 */
95
95
  createMediaQueryObserver?(): MediaQueryObserver
96
96
  /** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 wx://component-export 影响) */
@@ -622,6 +622,12 @@ declare module './index' {
622
622
  */
623
623
  useAuthorizePage: boolean
624
624
  }
625
+ /**
626
+ * 在 2023年9月15号之前,在 app.json 中配置 __usePrivacyCheck__: true 后,会启用隐私相关功能,如果不配置或者配置为 false 则不会启用。
627
+ * 在 2023年9月15号之后,不论 app.json 中是否有配置 __usePrivacyCheck__,隐私相关功能都会启用
628
+ * @supported weapp
629
+ */
630
+ __usePrivacyCheck__?: boolean
625
631
  /**
626
632
  * 正常情况下默认所有资源文件都被打包发布到所有平台,可以通过 static 字段配置特定每个目录/文件只能发布到特定的平台(多端场景)
627
633
  * @see https://dev.weixin.qq.com/docs/framework/guideline/devtools/condition-compile.html#%E8%B5%84%E6%BA%90