@tarojs/taro-h5 3.4.0 → 3.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/api/ai/visual.js +2 -0
  2. package/dist/api/base/system.js +187 -0
  3. package/dist/api/canvas/CanvasContext.js +1 -1
  4. package/dist/api/canvas/index.js +5 -1
  5. package/dist/api/cloud/index.js +4 -0
  6. package/dist/api/device/battery.js +18 -1
  7. package/dist/api/device/index.js +1 -0
  8. package/dist/api/{base/system → device}/network.js +29 -14
  9. package/dist/api/device/wifi.js +1 -0
  10. package/dist/api/media/{editor.js → EditorContext.js} +1 -0
  11. package/dist/api/media/audio/InnerAudioContext.js +84 -0
  12. package/dist/api/media/audio/index.js +1 -74
  13. package/dist/api/media/background-audio/BackgroundAudioManager.js +86 -0
  14. package/dist/api/media/{background-audio.js → background-audio/index.js} +6 -2
  15. package/dist/api/media/index.js +0 -1
  16. package/dist/api/network/upload.js +2 -7
  17. package/dist/api/ui/animation/index.js +9 -5
  18. package/dist/api/ui/fonts.js +50 -2
  19. package/dist/api/ui/scroll/index.js +3 -3
  20. package/dist/api/utils/handler.js +45 -45
  21. package/dist/api/utils/index.js +36 -12
  22. package/dist/index.cjs.js +517 -188
  23. package/dist/taroApis.js +1 -1
  24. package/package.json +7 -7
  25. package/src/api/ai/visual.ts +3 -0
  26. package/src/api/base/system.ts +207 -0
  27. package/src/api/canvas/CanvasContext.ts +7 -7
  28. package/src/api/canvas/index.ts +10 -2
  29. package/src/api/cloud/index.ts +4 -0
  30. package/src/api/device/battery.ts +18 -1
  31. package/src/api/device/index.ts +1 -0
  32. package/src/api/{base/system → device}/network.ts +35 -15
  33. package/src/api/device/wifi.ts +1 -0
  34. package/src/api/media/{editor.ts → EditorContext.ts} +2 -0
  35. package/src/api/media/audio/InnerAudioContext.ts +98 -0
  36. package/src/api/media/audio/index.ts +1 -86
  37. package/src/api/media/background-audio/BackgroundAudioManager.ts +103 -0
  38. package/src/api/media/{background-audio.ts → background-audio/index.ts} +7 -2
  39. package/src/api/media/index.ts +0 -1
  40. package/src/api/network/upload.ts +2 -8
  41. package/src/api/ui/animation/index.ts +10 -6
  42. package/src/api/ui/fonts.ts +61 -2
  43. package/src/api/ui/scroll/index.ts +3 -3
  44. package/src/api/utils/handler.ts +4 -4
  45. package/src/api/utils/index.ts +33 -12
  46. package/dist/api/base/system/index.js +0 -2
  47. package/dist/api/base/system/info.js +0 -57
  48. package/src/api/base/system/index.ts +0 -2
  49. package/src/api/base/system/info.ts +0 -64
package/dist/index.cjs.js CHANGED
@@ -85,28 +85,52 @@ function serializeParams$1(params) {
85
85
  function temporarilyNotSupport(apiName) {
86
86
  return () => {
87
87
  const errMsg = `暂时不支持 API ${apiName}`;
88
- console.error(errMsg);
89
- return Promise.reject({
90
- errMsg
91
- });
88
+ if (process.env.NODE_ENV !== 'production') {
89
+ console.error(errMsg);
90
+ return Promise.reject({
91
+ errMsg
92
+ });
93
+ }
94
+ else {
95
+ console.warn(errMsg);
96
+ return Promise.resolve({
97
+ errMsg
98
+ });
99
+ }
92
100
  };
93
101
  }
94
102
  function weixinCorpSupport(apiName) {
95
103
  return () => {
96
104
  const errMsg = `h5端仅在微信公众号中支持 API ${apiName}`;
97
- console.error(errMsg);
98
- return Promise.reject({
99
- errMsg
100
- });
105
+ if (process.env.NODE_ENV !== 'production') {
106
+ console.error(errMsg);
107
+ return Promise.reject({
108
+ errMsg
109
+ });
110
+ }
111
+ else {
112
+ console.warn(errMsg);
113
+ return Promise.resolve({
114
+ errMsg
115
+ });
116
+ }
101
117
  };
102
118
  }
103
119
  function permanentlyNotSupport(apiName) {
104
120
  return () => {
105
121
  const errMsg = `不支持 API ${apiName}`;
106
- console.error(errMsg);
107
- return Promise.reject({
108
- errMsg
109
- });
122
+ if (process.env.NODE_ENV !== 'production') {
123
+ console.error(errMsg);
124
+ return Promise.reject({
125
+ errMsg
126
+ });
127
+ }
128
+ else {
129
+ console.warn(errMsg);
130
+ return Promise.resolve({
131
+ errMsg
132
+ });
133
+ }
110
134
  };
111
135
  }
112
136
  function isFunction$1(obj) {
@@ -167,6 +191,8 @@ const stopFaceDetect = temporarilyNotSupport('stopFaceDetect');
167
191
  const initFaceDetect = temporarilyNotSupport('initFaceDetect');
168
192
  const faceDetect = temporarilyNotSupport('faceDetect');
169
193
 
194
+ // 判断支持版本
195
+ const isVKSupport = temporarilyNotSupport('isVKSupport');
170
196
  // 视觉算法
171
197
  const createVKSession = temporarilyNotSupport('createVKSession');
172
198
 
@@ -1301,86 +1327,76 @@ class MethodHandler {
1301
1327
  class CallbackManager {
1302
1328
  constructor() {
1303
1329
  this.callbacks = [];
1304
- }
1305
- /**
1306
- * 添加回调
1307
- * @param {{ callback: function, ctx: any } | function} opt
1308
- */
1309
- add(opt) {
1310
- if (opt)
1311
- this.callbacks.push(opt);
1312
- }
1313
- /**
1314
- * 移除回调
1315
- * @param {{ callback: function, ctx: any } | function} opt
1316
- */
1317
- remove(opt) {
1318
- if (opt) {
1319
- let pos = -1;
1320
- this.callbacks.forEach((callback, k) => {
1321
- if (callback === opt) {
1322
- pos = k;
1330
+ /**
1331
+ * 添加回调
1332
+ * @param {{ callback: function, ctx: any } | function} opt
1333
+ */
1334
+ this.add = (opt) => {
1335
+ if (opt)
1336
+ this.callbacks.push(opt);
1337
+ };
1338
+ /**
1339
+ * 移除回调
1340
+ * @param {{ callback: function, ctx: any } | function} opt
1341
+ */
1342
+ this.remove = (opt) => {
1343
+ if (opt) {
1344
+ let pos = -1;
1345
+ this.callbacks.forEach((callback, k) => {
1346
+ if (callback === opt) {
1347
+ pos = k;
1348
+ }
1349
+ });
1350
+ if (pos > -1) {
1351
+ this.callbacks.splice(pos, 1);
1323
1352
  }
1324
- });
1325
- if (pos > -1) {
1326
- this.callbacks.splice(pos, 1);
1327
- }
1328
- }
1329
- }
1330
- /**
1331
- * 获取回调函数数量
1332
- * @return {number}
1333
- */
1334
- count() {
1335
- return this.callbacks.length;
1336
- }
1337
- /**
1338
- * 触发回调
1339
- * @param {...any} args 回调的调用参数
1340
- */
1341
- trigger(...args) {
1342
- this.callbacks.forEach(opt => {
1343
- if (typeof opt === 'function') {
1344
- opt(...args);
1345
1353
  }
1346
- else {
1347
- const { callback, ctx } = opt;
1348
- typeof callback === 'function' && callback.call(ctx, ...args);
1349
- }
1350
- });
1354
+ };
1355
+ /**
1356
+ * 获取回调函数数量
1357
+ * @return {number}
1358
+ */
1359
+ this.count = () => {
1360
+ return this.callbacks.length;
1361
+ };
1362
+ /**
1363
+ * 触发回调
1364
+ * @param {...any} args 回调的调用参数
1365
+ */
1366
+ this.trigger = (...args) => {
1367
+ this.callbacks.forEach(opt => {
1368
+ if (typeof opt === 'function') {
1369
+ opt(...args);
1370
+ }
1371
+ else {
1372
+ const { callback, ctx } = opt;
1373
+ typeof callback === 'function' && callback.call(ctx, ...args);
1374
+ }
1375
+ });
1376
+ };
1351
1377
  }
1352
1378
  }
1353
1379
 
1354
- const getSystemInfoSync = () => {
1355
- const md = new MobileDetect(navigator.userAgent);
1380
+ /** 跳转系统蓝牙设置页 */
1381
+ const openSystemBluetoothSetting = temporarilyNotSupport('openSystemBluetoothSetting');
1382
+ /** 跳转系统微信授权管理页 */
1383
+ const openAppAuthorizeSetting = temporarilyNotSupport('openAppAuthorizeSetting');
1384
+ /** 获取窗口信息 */
1385
+ const getWindowInfo = () => {
1356
1386
  const info = {
1357
- brand: md.mobile() || '',
1358
- model: md.mobile() || '',
1359
- system: md.os(),
1387
+ /** 设备像素比 */
1360
1388
  pixelRatio: window.devicePixelRatio,
1389
+ /** 屏幕宽度,单位px */
1361
1390
  screenWidth: window.screen.width,
1391
+ /** 屏幕高度,单位px */
1362
1392
  screenHeight: window.screen.height,
1393
+ /** 可使用窗口宽度,单位px */
1363
1394
  windowWidth: document.documentElement.clientWidth,
1395
+ /** 可使用窗口高度,单位px */
1364
1396
  windowHeight: document.documentElement.clientHeight,
1365
- version: '',
1397
+ /** 状态栏的高度,单位px */
1366
1398
  statusBarHeight: NaN,
1367
- platform: navigator.platform,
1368
- language: navigator.language,
1369
- fontSizeSetting: NaN,
1370
- SDKVersion: '',
1371
- // TODO
1372
- albumAuthorized: false,
1373
- benchmarkLevel: 0,
1374
- bluetoothEnabled: false,
1375
- cameraAuthorized: false,
1376
- enableDebug: false,
1377
- locationAuthorized: false,
1378
- locationEnabled: false,
1379
- microphoneAuthorized: false,
1380
- notificationAlertAuthorized: false,
1381
- notificationAuthorized: false,
1382
- notificationBadgeAuthorized: false,
1383
- notificationSoundAuthorized: false,
1399
+ /** 在竖屏正方向下的安全区域 */
1384
1400
  safeArea: {
1385
1401
  bottom: 0,
1386
1402
  height: 0,
@@ -1388,14 +1404,139 @@ const getSystemInfoSync = () => {
1388
1404
  right: 0,
1389
1405
  top: 0,
1390
1406
  width: 0
1391
- },
1392
- wifiEnabled: false
1407
+ }
1393
1408
  };
1394
1409
  return info;
1395
1410
  };
1396
- const getSystemInfo = async (options = {}) => {
1411
+ /** 获取设备设置 */
1412
+ const getSystemSetting = () => {
1413
+ const isLandscape = window.screen.width >= window.screen.height;
1414
+ const info = {
1415
+ /** 蓝牙的系统开关 */
1416
+ bluetoothEnabled: false,
1417
+ /** 地理位置的系统开关 */
1418
+ locationEnabled: false,
1419
+ /** Wi-Fi 的系统开关 */
1420
+ wifiEnabled: false,
1421
+ /** 设备方向 */
1422
+ deviceOrientation: isLandscape ? 'landscape' : 'portrait'
1423
+ };
1424
+ return info;
1425
+ };
1426
+ /** 获取设备设置 */
1427
+ const getDeviceInfo = () => {
1428
+ const md = new MobileDetect(navigator.userAgent);
1429
+ const info = {
1430
+ /** 应用二进制接口类型(仅 Android 支持) */
1431
+ abi: '',
1432
+ /** 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */
1433
+ benchmarkLevel: -1,
1434
+ /** 设备品牌 */
1435
+ brand: md.mobile() || '',
1436
+ /** 设备型号 */
1437
+ model: md.mobile() || '',
1438
+ /** 操作系统及版本 */
1439
+ system: md.os(),
1440
+ /** 客户端平台 */
1441
+ platform: navigator.platform
1442
+ };
1443
+ return info;
1444
+ };
1445
+ /** 获取微信APP基础信息 */
1446
+ const getAppBaseInfo = () => {
1447
+ var _a;
1448
+ let isDarkMode = false;
1449
+ if ((_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, '(prefers-color-scheme: dark)').matches) {
1450
+ isDarkMode = true;
1451
+ }
1452
+ const info = {
1453
+ /** 客户端基础库版本 */
1454
+ SDKVersion: '',
1455
+ /** 是否已打开调试。可通过右上角菜单或 [Taro.setEnableDebug](/docs/apis/base/debug/setEnableDebug) 打开调试。 */
1456
+ enableDebug: process.env.NODE_ENV === 'development',
1457
+ /** 当前小程序运行的宿主环境 */
1458
+ // host: { appId: '' },
1459
+ /** 微信设置的语言 */
1460
+ language: navigator.language,
1461
+ /** 微信版本号 */
1462
+ version: '',
1463
+ /** 系统当前主题,取值为light或dark,全局配置"darkmode":true时才能获取,否则为 undefined (不支持小游戏) */
1464
+ theme: isDarkMode ? 'dark' : 'light'
1465
+ };
1466
+ return info;
1467
+ };
1468
+ /** 获取微信APP授权设置 */
1469
+ const getAppAuthorizeSetting = () => {
1470
+ const info = {
1471
+ /** 允许微信使用相册的开关(仅 iOS 有效) */
1472
+ albumAuthorized: 'not determined',
1473
+ /** 允许微信使用蓝牙的开关(仅 iOS 有效) */
1474
+ bluetoothAuthorized: 'not determined',
1475
+ /** 允许微信使用摄像头的开关 */
1476
+ cameraAuthorized: 'not determined',
1477
+ /** 允许微信使用定位的开关 */
1478
+ locationAuthorized: 'not determined',
1479
+ /** 定位准确度。true 表示模糊定位,false 表示精确定位(仅 iOS 有效) */
1480
+ locationReducedAccuracy: false,
1481
+ /** 允许微信使用麦克风的开关 */
1482
+ microphoneAuthorized: 'not determined',
1483
+ /** 允许微信通知的开关 */
1484
+ notificationAuthorized: 'not determined',
1485
+ /** 允许微信通知带有提醒的开关(仅 iOS 有效) */
1486
+ notificationAlertAuthorized: 'not determined',
1487
+ /** 允许微信通知带有标记的开关(仅 iOS 有效) */
1488
+ notificationBadgeAuthorized: 'not determined',
1489
+ /** 允许微信通知带有声音的开关(仅 iOS 有效) */
1490
+ notificationSoundAuthorized: 'not determined',
1491
+ /** 允许微信使用日历的开关 */
1492
+ phoneCalendarAuthorized: 'not determined'
1493
+ };
1494
+ return info;
1495
+ };
1496
+ /** 获取设备设置 */
1497
+ const getSystemInfoSync = () => {
1498
+ const windowInfo = getWindowInfo();
1499
+ const systemSetting = getSystemSetting();
1500
+ const deviceInfo = getDeviceInfo();
1501
+ const appBaseInfo = getAppBaseInfo();
1502
+ const appAuthorizeSetting = getAppAuthorizeSetting();
1503
+ delete deviceInfo.abi;
1504
+ const info = {
1505
+ ...windowInfo,
1506
+ ...systemSetting,
1507
+ ...deviceInfo,
1508
+ ...appBaseInfo,
1509
+ /** 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 */
1510
+ fontSizeSetting: NaN,
1511
+ /** 允许微信使用相册的开关(仅 iOS 有效) */
1512
+ albumAuthorized: appAuthorizeSetting.albumAuthorized === 'authorized',
1513
+ /** 允许微信使用摄像头的开关 */
1514
+ cameraAuthorized: appAuthorizeSetting.cameraAuthorized === 'authorized',
1515
+ /** 允许微信使用定位的开关 */
1516
+ locationAuthorized: appAuthorizeSetting.locationAuthorized === 'authorized',
1517
+ /** 允许微信使用麦克风的开关 */
1518
+ microphoneAuthorized: appAuthorizeSetting.microphoneAuthorized === 'authorized',
1519
+ /** 允许微信通知的开关 */
1520
+ notificationAuthorized: appAuthorizeSetting.notificationAuthorized === 'authorized',
1521
+ /** 允许微信通知带有提醒的开关(仅 iOS 有效) */
1522
+ notificationAlertAuthorized: appAuthorizeSetting.notificationAlertAuthorized === 'authorized',
1523
+ /** 允许微信通知带有标记的开关(仅 iOS 有效) */
1524
+ notificationBadgeAuthorized: appAuthorizeSetting.notificationBadgeAuthorized === 'authorized',
1525
+ /** 允许微信通知带有声音的开关(仅 iOS 有效) */
1526
+ notificationSoundAuthorized: appAuthorizeSetting.notificationSoundAuthorized === 'authorized',
1527
+ /** 允许微信使用日历的开关 */
1528
+ phoneCalendarAuthorized: appAuthorizeSetting.phoneCalendarAuthorized === 'authorized',
1529
+ /** `true` 表示模糊定位,`false` 表示精确定位,仅 iOS 支持 */
1530
+ locationReducedAccuracy: appAuthorizeSetting.locationReducedAccuracy,
1531
+ /** 小程序当前运行环境 */
1532
+ environment: ''
1533
+ };
1534
+ return info;
1535
+ };
1536
+ /** 获取系统信息 */
1537
+ const getSystemInfoAsync = async (options = {}) => {
1397
1538
  const { success, fail, complete } = options;
1398
- const handle = new MethodHandler({ name: 'getSystemInfo', success, fail, complete });
1539
+ const handle = new MethodHandler({ name: 'getSystemInfoAsync', success, fail, complete });
1399
1540
  try {
1400
1541
  const info = await getSystemInfoSync();
1401
1542
  return handle.success(info);
@@ -1405,69 +1546,21 @@ const getSystemInfo = async (options = {}) => {
1405
1546
  errMsg: error
1406
1547
  });
1407
1548
  }
1408
- };
1409
-
1410
- function getConnection() {
1411
- // @ts-ignore
1412
- return navigator.connection || navigator.mozConnection || navigator.webkitConnection || navigator.msConnection;
1413
- }
1414
- const getNetworkType = (options = {}) => {
1415
- const connection = getConnection();
1549
+ };
1550
+ /** 获取系统信息 */
1551
+ const getSystemInfo = async (options = {}) => {
1416
1552
  const { success, fail, complete } = options;
1417
- const handle = new MethodHandler({ name: 'getNetworkType', success, fail, complete });
1418
- let networkType = 'unknown';
1419
- // 浏览器不支持获取网络状态
1420
- if (!connection) {
1421
- return handle.success({ networkType });
1422
- }
1423
- // Supports only the navigator.connection.type value which doesn't match the latest spec.
1424
- // https://www.davidbcalhoun.com/2010/using-navigator-connection-android/
1425
- if (!isNaN(Number(connection.type))) {
1426
- switch (connection.type) {
1427
- // @ts-ignore
1428
- case connection.WIFI:
1429
- networkType = 'wifi';
1430
- break;
1431
- // @ts-ignore
1432
- case connection.CELL_3G:
1433
- networkType = '3g';
1434
- break;
1435
- // @ts-ignore
1436
- case connection.CELL_2G:
1437
- networkType = '2g';
1438
- break;
1439
- default:
1440
- // ETHERNET, UNKNOWN
1441
- networkType = 'unknown';
1442
- }
1443
- }
1444
- else if (connection.type) {
1445
- // @ts-ignore
1446
- networkType = connection.type; // Only supports the type value.
1447
- // @ts-ignore
1448
- }
1449
- else if (connection.effectiveType) {
1450
- // @ts-ignore
1451
- networkType = connection.effectiveType;
1553
+ const handle = new MethodHandler({ name: 'getSystemInfo', success, fail, complete });
1554
+ try {
1555
+ const info = await getSystemInfoSync();
1556
+ return handle.success(info);
1452
1557
  }
1453
- return handle.success({ networkType });
1454
- };
1455
- const onNetworkStatusChange = (cb) => {
1456
- const connection = getConnection();
1457
- if (connection) {
1458
- connection.addEventListener('change', function () {
1459
- getNetworkType()
1460
- .then(res => {
1461
- const { networkType } = res;
1462
- const isConnected = networkType !== 'none';
1463
- const obj = { isConnected, networkType };
1464
- cb(obj);
1465
- });
1558
+ catch (error) {
1559
+ return handle.fail({
1560
+ errMsg: error
1466
1561
  });
1467
1562
  }
1468
- };
1469
- const offNetworkStatusChange = temporarilyNotSupport('offNetworkStatusChange');
1470
- const getLocalIPAddress = temporarilyNotSupport('getLocalIPAddress');
1563
+ };
1471
1564
 
1472
1565
  // 更新
1473
1566
  const updateWeChatApp = temporarilyNotSupport('updateWeChatApp');
@@ -1696,7 +1789,7 @@ class CanvasContext {
1696
1789
  transform(...args) { return this.enqueueActions(this.ctx.transform, ...args); }
1697
1790
  translate(...args) { return this.enqueueActions(this.ctx.translate, ...args); }
1698
1791
  measureText(text) {
1699
- return this.measureText(text);
1792
+ return this.ctx.measureText(text);
1700
1793
  }
1701
1794
  createCircularGradient(x, y, r) {
1702
1795
  const radialGradient = this.ctx.createRadialGradient(x, y, 0, x, y, r);
@@ -1789,22 +1882,26 @@ const canvasGetImageData = ({ canvasId, success, fail, complete, x, y, width, he
1789
1882
  };
1790
1883
 
1791
1884
  // 画布
1792
- const createOffscreenCanvas = temporarilyNotSupport('createOffscreenCanvas');
1793
- const drawCanvas = temporarilyNotSupport('drawCanvas');
1885
+ /** 创建离屏 canvas 实例 */
1886
+ const createOffscreenCanvas = temporarilyNotSupport('createOffscreenCanvas');
1794
1887
 
1795
1888
  class cloud {
1796
1889
  constructor() {
1797
1890
  this.init = temporarilyNotSupport('cloud.init');
1798
1891
  this.CloudID = temporarilyNotSupport('cloud.CloudID');
1892
+ // @ts-ignore
1799
1893
  this.callFunction = temporarilyNotSupport('cloud.callFunction');
1800
1894
  // @ts-ignore
1801
1895
  this.uploadFile = temporarilyNotSupport('cloud.uploadFile');
1802
1896
  // @ts-ignore
1803
1897
  this.downloadFile = temporarilyNotSupport('cloud.downloadFile');
1898
+ // @ts-ignore
1804
1899
  this.getTempFileURL = temporarilyNotSupport('cloud.getTempFileURL');
1900
+ // @ts-ignore
1805
1901
  this.deleteFile = temporarilyNotSupport('cloud.deleteFile');
1806
1902
  // @ts-ignore
1807
1903
  this.database = temporarilyNotSupport('cloud.database');
1904
+ // @ts-ignore
1808
1905
  this.callContainer = temporarilyNotSupport('cloud.callContainer');
1809
1906
  }
1810
1907
  }
@@ -1902,7 +1999,23 @@ const checkIsOpenAccessibility = temporarilyNotSupport('checkIsOpenAccessibility
1902
1999
 
1903
2000
  // 电量
1904
2001
  const getBatteryInfoSync = temporarilyNotSupport('getBatteryInfoSync');
1905
- const getBatteryInfo = temporarilyNotSupport('getBatteryInfo');
2002
+ const getBatteryInfo = async ({ success, fail, complete } = {}) => {
2003
+ var _a;
2004
+ const handle = new MethodHandler({ name: 'getBatteryInfo', success, fail, complete });
2005
+ try {
2006
+ // @ts-ignore
2007
+ const battery = await ((_a = navigator.getBattery) === null || _a === void 0 ? void 0 : _a.call(navigator));
2008
+ return handle.success({
2009
+ isCharging: battery.charging,
2010
+ level: Number(battery.level || 0) * 100
2011
+ });
2012
+ }
2013
+ catch (error) {
2014
+ return handle.fail({
2015
+ errMsg: (error === null || error === void 0 ? void 0 : error.message) || error
2016
+ });
2017
+ }
2018
+ };
1906
2019
 
1907
2020
  // 蓝牙-通用
1908
2021
  const stopBluetoothDevicesDiscovery = temporarilyNotSupport('stopBluetoothDevicesDiscovery');
@@ -2348,6 +2461,83 @@ const offDeviceMotionChange = callback => {
2348
2461
  callbackManager$1.remove(callback);
2349
2462
  };
2350
2463
 
2464
+ function getConnection() {
2465
+ // @ts-ignore
2466
+ return navigator.connection || navigator.mozConnection || navigator.webkitConnection || navigator.msConnection;
2467
+ }
2468
+ const getNetworkType = (options = {}) => {
2469
+ const connection = getConnection();
2470
+ const { success, fail, complete } = options;
2471
+ const handle = new MethodHandler({ name: 'getNetworkType', success, fail, complete });
2472
+ let networkType = 'unknown';
2473
+ // 浏览器不支持获取网络状态
2474
+ if (!connection) {
2475
+ return handle.success({ networkType });
2476
+ }
2477
+ // Supports only the navigator.connection.type value which doesn't match the latest spec.
2478
+ // https://www.davidbcalhoun.com/2010/using-navigator-connection-android/
2479
+ if (!isNaN(Number(connection.type))) {
2480
+ switch (connection.type) {
2481
+ // @ts-ignore
2482
+ case connection.WIFI:
2483
+ networkType = 'wifi';
2484
+ break;
2485
+ // @ts-ignore
2486
+ case connection.CELL_3G:
2487
+ networkType = '3g';
2488
+ break;
2489
+ // @ts-ignore
2490
+ case connection.CELL_2G:
2491
+ networkType = '2g';
2492
+ break;
2493
+ default:
2494
+ // ETHERNET, UNKNOWN
2495
+ networkType = 'unknown';
2496
+ }
2497
+ }
2498
+ else if (connection.type) {
2499
+ // @ts-ignore
2500
+ networkType = connection.type; // Only supports the type value.
2501
+ // @ts-ignore
2502
+ }
2503
+ else if (connection.effectiveType) {
2504
+ // @ts-ignore
2505
+ networkType = connection.effectiveType;
2506
+ }
2507
+ return handle.success({ networkType });
2508
+ };
2509
+ const networkStatusManager = new CallbackManager();
2510
+ const networkStatusListener = async () => {
2511
+ const { networkType } = await getNetworkType();
2512
+ const isConnected = networkType !== 'none';
2513
+ const obj = { isConnected, networkType };
2514
+ networkStatusManager.trigger(obj);
2515
+ };
2516
+ /**
2517
+ * 在最近的八次网络请求中, 出现下列三个现象之一则判定弱网。
2518
+ * - 出现三次以上连接超时
2519
+ * - 出现三次 rtt 超过 400
2520
+ * - 出现三次以上的丢包
2521
+ * > 弱网事件通知规则是: 弱网状态变化时立即通知, 状态不变时 30s 内最多通知一次。
2522
+ */
2523
+ const onNetworkWeakChange = temporarilyNotSupport('onNetworkWeakChange');
2524
+ const onNetworkStatusChange = callback => {
2525
+ networkStatusManager.add(callback);
2526
+ const connection = getConnection();
2527
+ if (connection && networkStatusManager.count() === 1) {
2528
+ connection.addEventListener('change', networkStatusListener);
2529
+ }
2530
+ };
2531
+ const offNetworkWeakChange = temporarilyNotSupport('offNetworkStatusChange');
2532
+ const offNetworkStatusChange = callback => {
2533
+ networkStatusManager.remove(callback);
2534
+ const connection = getConnection();
2535
+ if (connection && networkStatusManager.count() === 0) {
2536
+ connection.removeEventListener('change', networkStatusListener);
2537
+ }
2538
+ };
2539
+ const getLocalIPAddress = temporarilyNotSupport('getLocalIPAddress');
2540
+
2351
2541
  // NFC
2352
2542
  const stopHCE = temporarilyNotSupport('stopHCE');
2353
2543
  const startHCE = temporarilyNotSupport('startHCE');
@@ -2433,6 +2623,7 @@ const vibrateLong = ({ success, fail, complete } = {}) => {
2433
2623
  const stopWifi = temporarilyNotSupport('stopWifi');
2434
2624
  const startWifi = temporarilyNotSupport('startWifi');
2435
2625
  const setWifiList = temporarilyNotSupport('setWifiList');
2626
+ const onWifiConnectedWithPartialInfo = temporarilyNotSupport('onWifiConnectedWithPartialInfo');
2436
2627
  const onWifiConnected = temporarilyNotSupport('onWifiConnected');
2437
2628
  const onGetWifiList = temporarilyNotSupport('onGetWifiList');
2438
2629
  const offWifiConnected = temporarilyNotSupport('offWifiConnected');
@@ -2598,9 +2789,9 @@ const offLocationChange = temporarilyNotSupport('offLocationChange');
2598
2789
  const getLocation = processOpenApi('getLocation');
2599
2790
  const choosePoi = temporarilyNotSupport('choosePoi');
2600
2791
 
2601
- // 音频
2602
2792
  class InnerAudioContext {
2603
2793
  constructor() {
2794
+ this.__startTime = 0;
2604
2795
  this.play = () => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.play(); };
2605
2796
  this.pause = () => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.pause(); };
2606
2797
  this.stop = () => {
@@ -2647,6 +2838,11 @@ class InnerAudioContext {
2647
2838
  this.errorStack = new CallbackManager();
2648
2839
  this.stopStack = new CallbackManager();
2649
2840
  Taro__default['default'].eventCenter.on('__taroRouterChange', () => { this.stop(); });
2841
+ this.onPlay(() => {
2842
+ if (this.currentTime !== this.startTime) {
2843
+ this.seek(this.startTime);
2844
+ }
2845
+ });
2650
2846
  }
2651
2847
  set autoplay(e) { this.setProperty('autoplay', e); }
2652
2848
  get autoplay() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.autoplay) || false; }
@@ -2661,16 +2857,21 @@ class InnerAudioContext {
2661
2857
  set volume(e) { this.setProperty('volume', e); }
2662
2858
  get volume() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.volume) || 0; }
2663
2859
  set playbackRate(e) { this.setProperty('playbackRate', e); }
2664
- get playbackRate() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.volume) || 0; }
2860
+ get playbackRate() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.playbackRate) || 0; }
2861
+ set obeyMuteSwitch(_e) { permanentlyNotSupport('InnerAudioContext.obeyMuteSwitch')(); }
2665
2862
  get obeyMuteSwitch() { return true; }
2666
- set startTime(e) { this.setProperty('startTime', e); }
2667
- get startTime() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.volume) || 0; }
2863
+ set startTime(e) { this.__startTime = e; }
2864
+ get startTime() { return this.__startTime || 0; }
2865
+ set referrerPolicy(e) { var _a; (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.setAttribute('referrerpolicy', e); }
2866
+ get referrerPolicy() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.getAttribute('referrerpolicy')) || 'origin'; }
2668
2867
  setProperty(key, value) {
2669
2868
  if (this.Instance) {
2670
2869
  this.Instance[key] = value;
2671
2870
  }
2672
2871
  }
2673
- }
2872
+ }
2873
+
2874
+ // 音频
2674
2875
  const stopVoice = temporarilyNotSupport('stopVoice');
2675
2876
  const setInnerAudioOption = temporarilyNotSupport('setInnerAudioOption');
2676
2877
  const playVoice = temporarilyNotSupport('playVoice');
@@ -2684,6 +2885,91 @@ const createMediaAudioPlayer = temporarilyNotSupport('createMediaAudioPlayer');
2684
2885
  const createInnerAudioContext = () => new InnerAudioContext();
2685
2886
  const createAudioContext = temporarilyNotSupport('createAudioContext');
2686
2887
 
2888
+ class BackgroundAudioManager {
2889
+ constructor() {
2890
+ this.__startTime = 0;
2891
+ this.play = () => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.play(); };
2892
+ this.pause = () => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.pause(); };
2893
+ this.seek = (position) => {
2894
+ if (this.Instance) {
2895
+ this.Instance.currentTime = position;
2896
+ }
2897
+ };
2898
+ this.stop = () => {
2899
+ this.pause();
2900
+ this.seek(0);
2901
+ this.stopStack.trigger();
2902
+ };
2903
+ this.onCanplay = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('canplay', callback); };
2904
+ this.onWaiting = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('waiting', callback); };
2905
+ this.onError = (callback) => this.errorStack.add(callback);
2906
+ this.onPlay = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('play', callback); };
2907
+ this.onPause = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('pause', callback); };
2908
+ this.onSeeking = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('seeking', callback); };
2909
+ this.onSeeked = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('seeked', callback); };
2910
+ this.onEnded = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('ended', callback); };
2911
+ this.onStop = (callback = () => { }) => this.stopStack.add(callback);
2912
+ this.onTimeUpdate = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.addEventListener('timeupdate', callback); };
2913
+ this.onPrev = permanentlyNotSupport('BackgroundAudioManager.onPrev');
2914
+ this.onNext = permanentlyNotSupport('BackgroundAudioManager.onNext');
2915
+ this.offCanplay = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', callback); };
2916
+ this.offWaiting = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('waiting', callback); };
2917
+ this.offError = (callback = () => { }) => this.errorStack.remove(callback);
2918
+ this.offPlay = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('play', callback); };
2919
+ this.offPause = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('pause', callback); };
2920
+ this.offSeeking = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('seeking', callback); };
2921
+ this.offSeeked = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('seeked', callback); };
2922
+ this.offEnded = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('ended', callback); };
2923
+ this.offStop = (callback = () => { }) => this.stopStack.remove(callback);
2924
+ this.offTimeUpdate = (callback = () => { }) => { var _a; return (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.removeEventListener('timeupdate', callback); };
2925
+ this.offPrev = permanentlyNotSupport('BackgroundAudioManager.offPrev');
2926
+ this.offNext = permanentlyNotSupport('BackgroundAudioManager.offNext');
2927
+ this.Instance = new Audio();
2928
+ this.errorStack = new CallbackManager();
2929
+ this.stopStack = new CallbackManager();
2930
+ this.Instance.autoplay = true;
2931
+ this.onPlay(() => {
2932
+ if (this.currentTime !== this.startTime) {
2933
+ this.seek(this.startTime);
2934
+ }
2935
+ });
2936
+ }
2937
+ set src(e) { this.setProperty('src', e); }
2938
+ get src() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.src) || ''; }
2939
+ set startTime(e) { this.__startTime = e; }
2940
+ get startTime() { return this.__startTime || 0; }
2941
+ set title(e) { this.dataset('title', e); }
2942
+ get title() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.dataset.title) || ''; }
2943
+ set epname(e) { this.dataset('epname', e); }
2944
+ get epname() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.dataset.epname) || ''; }
2945
+ set singer(e) { this.dataset('singer', e); }
2946
+ get singer() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.dataset.singer) || ''; }
2947
+ set coverImgUrl(e) { this.dataset('coverImgUrl', e); }
2948
+ get coverImgUrl() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.dataset.coverImgUrl) || ''; }
2949
+ set webUrl(e) { this.dataset('webUrl', e); }
2950
+ get webUrl() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.dataset.webUrl) || ''; }
2951
+ set protocol(e) { this.dataset('protocol', e); }
2952
+ get protocol() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.dataset.protocol) || ''; }
2953
+ set playbackRate(e) { this.setProperty('playbackRate', e); }
2954
+ get playbackRate() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.playbackRate) || 0; }
2955
+ get duration() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.duration) || 0; }
2956
+ get currentTime() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.currentTime) || 0; }
2957
+ get paused() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.paused) || false; }
2958
+ get buffered() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.buffered.length) || 0; }
2959
+ set referrerPolicy(e) { var _a; (_a = this.Instance) === null || _a === void 0 ? void 0 : _a.setAttribute('referrerpolicy', e); }
2960
+ get referrerPolicy() { var _a; return ((_a = this.Instance) === null || _a === void 0 ? void 0 : _a.getAttribute('referrerpolicy')) || 'origin'; }
2961
+ setProperty(key, value) {
2962
+ if (this.Instance) {
2963
+ this.Instance[key] = value;
2964
+ }
2965
+ }
2966
+ dataset(key, value) {
2967
+ if (this.Instance) {
2968
+ this.Instance.dataset[key] = value;
2969
+ }
2970
+ }
2971
+ }
2972
+
2687
2973
  // 背景音频
2688
2974
  const stopBackgroundAudio = temporarilyNotSupport('stopBackgroundAudio');
2689
2975
  const seekBackgroundAudio = temporarilyNotSupport('seekBackgroundAudio');
@@ -2693,29 +2979,14 @@ const onBackgroundAudioStop = temporarilyNotSupport('onBackgroundAudioStop');
2693
2979
  const onBackgroundAudioPlay = temporarilyNotSupport('onBackgroundAudioPlay');
2694
2980
  const onBackgroundAudioPause = temporarilyNotSupport('onBackgroundAudioPause');
2695
2981
  const getBackgroundAudioPlayerState = temporarilyNotSupport('getBackgroundAudioPlayerState');
2696
- const getBackgroundAudioManager = temporarilyNotSupport('getBackgroundAudioManager');
2982
+ /**
2983
+ * 获取全局唯一的背景音频管理器
2984
+ */
2985
+ const getBackgroundAudioManager = () => new BackgroundAudioManager();
2697
2986
 
2698
2987
  // 相机
2699
2988
  const createCameraContext = temporarilyNotSupport('createCameraContext');
2700
2989
 
2701
- // 富文本
2702
- class EditorContext {
2703
- constructor() {
2704
- this.blur = temporarilyNotSupport('EditorContext.blur');
2705
- this.clear = temporarilyNotSupport('EditorContext.clear');
2706
- this.format = temporarilyNotSupport('EditorContext.format');
2707
- this.getContents = temporarilyNotSupport('EditorContext.getContents');
2708
- this.insertDivider = temporarilyNotSupport('EditorContext.insertDivider');
2709
- this.insertImage = temporarilyNotSupport('EditorContext.insertImage');
2710
- this.insertText = temporarilyNotSupport('EditorContext.insertText');
2711
- this.redo = temporarilyNotSupport('EditorContext.redo');
2712
- this.removeFormat = temporarilyNotSupport('EditorContext.removeFormat');
2713
- this.scrollIntoView = temporarilyNotSupport('EditorContext.scrollIntoView');
2714
- this.setContents = temporarilyNotSupport('EditorContext.setContents');
2715
- this.undo = temporarilyNotSupport('EditorContext.undo');
2716
- }
2717
- }
2718
-
2719
2990
  /**
2720
2991
  * previewImage api基于开源的React组件[react-wx-images-viewer](https://github.com/react-ld/react-wx-images-viewer)开发,感谢!
2721
2992
  */
@@ -6134,7 +6405,7 @@ const createTCPSocket = temporarilyNotSupport('createTCPSocket');
6134
6405
  // UDP 通信
6135
6406
  const createUDPSocket = temporarilyNotSupport('createUDPSocket');
6136
6407
 
6137
- const createUploadTask = ({ url, filePath, formData, name, header, timeout, fileName, success, error }) => {
6408
+ const createUploadTask = ({ url, filePath, formData = {}, name, header, timeout, fileName, success, error }) => {
6138
6409
  let timeoutInter;
6139
6410
  let formKey;
6140
6411
  const apiName = 'uploadFile';
@@ -6239,16 +6510,12 @@ const createUploadTask = ({ url, filePath, formData, name, header, timeout, file
6239
6510
  * @param {ProgressUpdateCallback} callback HTTP Response Header 事件的回调函数
6240
6511
  */
6241
6512
  const offProgressUpdate = callbackManager.progressUpdate.remove;
6242
- const headersReceived = temporarilyNotSupport('UploadTask.headersReceived');
6243
- const progress = temporarilyNotSupport('UploadTask.progress');
6244
6513
  return {
6245
6514
  abort,
6246
6515
  onHeadersReceived,
6247
6516
  offHeadersReceived,
6248
6517
  onProgressUpdate,
6249
- offProgressUpdate,
6250
- headersReceived,
6251
- progress
6518
+ offProgressUpdate
6252
6519
  };
6253
6520
  };
6254
6521
  /**
@@ -6513,12 +6780,16 @@ const authPrivateMessage = temporarilyNotSupport('authPrivateMessage');
6513
6780
  */
6514
6781
  class StyleSheet {
6515
6782
  constructor() {
6783
+ this.$style = null;
6784
+ this.sheet = null;
6516
6785
  this.appendStyleSheet = () => {
6517
- var _a, _b, _c;
6518
- (_a = this.$style) === null || _a === void 0 ? void 0 : _a.setAttribute('type', 'text/css');
6519
- (_b = this.$style) === null || _b === void 0 ? void 0 : _b.setAttribute('data-type', 'Taro');
6520
- document.getElementsByTagName('head')[0].appendChild(this.$style);
6521
- this.sheet = (_c = this.$style) === null || _c === void 0 ? void 0 : _c.sheet;
6786
+ if (this.$style) {
6787
+ const head = document.getElementsByTagName('head')[0];
6788
+ this.$style.setAttribute('type', 'text/css');
6789
+ this.$style.setAttribute('data-type', 'Taro');
6790
+ head.appendChild(this.$style);
6791
+ this.sheet = this.$style.sheet;
6792
+ }
6522
6793
  if (this.sheet && !('insertRule' in this.sheet)) {
6523
6794
  console.warn('当前浏览器不支持 stylesheet.insertRule 接口');
6524
6795
  }
@@ -6800,7 +7071,55 @@ const setBackgroundColor = temporarilyNotSupport('setBackgroundColor');
6800
7071
  const nextTick = Taro__default['default'].nextTick;
6801
7072
 
6802
7073
  // 字体
6803
- const loadFontFace = temporarilyNotSupport('loadFontFace');
7074
+ const loadFontFace = async (options) => {
7075
+ options = Object.assign({ global: false }, options);
7076
+ const { success, fail, complete, family, source, desc = {} } = options;
7077
+ const handle = new MethodHandler({ name: 'loadFontFace', success, fail, complete });
7078
+ // @ts-ignore
7079
+ const fonts = document.fonts;
7080
+ if (fonts) {
7081
+ // @ts-ignore
7082
+ const fontFace = new FontFace(family, source, desc);
7083
+ try {
7084
+ await fontFace.load();
7085
+ fonts.add(fontFace);
7086
+ return handle.success({});
7087
+ }
7088
+ catch (error) {
7089
+ return handle.fail({
7090
+ errMsg: error.message || error
7091
+ });
7092
+ }
7093
+ }
7094
+ else {
7095
+ const style = document.createElement('style');
7096
+ let innerText = `font-family:"${family}";src:${source};font-style:${desc.style || 'normal'};font-weight:${desc.weight || 'normal'};font-variant:${desc.variant || 'normal'};`;
7097
+ if (desc.ascentOverride) {
7098
+ innerText += `ascent-override:${desc.ascentOverride};`;
7099
+ }
7100
+ if (desc.descentOverride) {
7101
+ innerText += `descent-override:${desc.descentOverride};`;
7102
+ }
7103
+ if (desc.featureSettings) {
7104
+ innerText += `font-feature-settings:${desc.featureSettings};`;
7105
+ }
7106
+ if (desc.lineGapOverride) {
7107
+ innerText += `line-gap-override:${desc.lineGapOverride};`;
7108
+ }
7109
+ if (desc.stretch) {
7110
+ innerText += `font-stretch:${desc.stretch};`;
7111
+ }
7112
+ if (desc.unicodeRange) {
7113
+ innerText += `unicode-range:${desc.unicodeRange};`;
7114
+ }
7115
+ if (desc.variationSettings) {
7116
+ innerText += `font-variation-settings:${desc.variationSettings};`;
7117
+ }
7118
+ style.innerText = `@font-face{${innerText}}`;
7119
+ document.head.appendChild(style);
7120
+ return handle.success();
7121
+ }
7122
+ };
6804
7123
 
6805
7124
  // 菜单
6806
7125
  const getMenuButtonBoundingClientRect = temporarilyNotSupport('getMenuButtonBoundingClientRect');
@@ -6880,16 +7199,16 @@ const pageScrollTo = ({ scrollTop, selector = '', duration = 300, success, fail,
6880
7199
  let scrollFunc;
6881
7200
  const handle = new MethodHandler({ name: 'pageScrollTo', success, fail, complete });
6882
7201
  return new Promise((resolve, reject) => {
6883
- var _a;
7202
+ var _a, _b;
6884
7203
  try {
6885
7204
  if (scrollTop === undefined && !selector) {
6886
7205
  return handle.fail({
6887
7206
  errMsg: 'scrollTop" 或 "selector" 需要其之一'
6888
7207
  }, reject);
6889
7208
  }
6890
- const id = (_a = runtime.Current.page) === null || _a === void 0 ? void 0 : _a.path;
7209
+ const id = (_b = (_a = runtime.Current.page) === null || _a === void 0 ? void 0 : _a.path) === null || _b === void 0 ? void 0 : _b.replace(/([^a-z0-9\u00a0-\uffff_-])/ig, '\\$1');
6891
7210
  const el = (id
6892
- ? document.getElementById(id)
7211
+ ? document.querySelector(`.taro_page#${id}`)
6893
7212
  : document.querySelector('.taro_page') ||
6894
7213
  document.querySelector('.taro_router'));
6895
7214
  if (!scrollFunc) {
@@ -8489,7 +8808,6 @@ Object.defineProperty(exports, 'switchTab', {
8489
8808
  exports.Behavior = Behavior;
8490
8809
  exports.Current = Current;
8491
8810
  exports.ENV_TYPE = ENV_TYPE;
8492
- exports.EditorContext = EditorContext;
8493
8811
  exports.Events = Events;
8494
8812
  exports.Link = Link;
8495
8813
  exports.addCard = addCard;
@@ -8568,7 +8886,6 @@ exports['default'] = taro;
8568
8886
  exports.disableAlertBeforeUnload = disableAlertBeforeUnload;
8569
8887
  exports.dishClassify = dishClassify;
8570
8888
  exports.downloadFile = downloadFile;
8571
- exports.drawCanvas = drawCanvas;
8572
8889
  exports.enableAlertBeforeUnload = enableAlertBeforeUnload;
8573
8890
  exports.eventCenter = eventCenter;
8574
8891
  exports.exitMiniProgram = exitMiniProgram;
@@ -8577,6 +8894,8 @@ exports.faceDetect = faceDetect;
8577
8894
  exports.faceVerifyForPay = faceVerifyForPay;
8578
8895
  exports.getAccountInfoSync = getAccountInfoSync;
8579
8896
  exports.getApp = getApp;
8897
+ exports.getAppAuthorizeSetting = getAppAuthorizeSetting;
8898
+ exports.getAppBaseInfo = getAppBaseInfo;
8580
8899
  exports.getAvailableAudioSources = getAvailableAudioSources;
8581
8900
  exports.getBLEDeviceCharacteristics = getBLEDeviceCharacteristics;
8582
8901
  exports.getBLEDeviceRSSI = getBLEDeviceRSSI;
@@ -8597,6 +8916,7 @@ exports.getClipboardData = getClipboardData;
8597
8916
  exports.getConnectedBluetoothDevices = getConnectedBluetoothDevices;
8598
8917
  exports.getConnectedWifi = getConnectedWifi;
8599
8918
  exports.getCurrentInstance = getCurrentInstance;
8919
+ exports.getDeviceInfo = getDeviceInfo;
8600
8920
  exports.getEnterOptionsSync = getEnterOptionsSync;
8601
8921
  exports.getEnv = getEnv;
8602
8922
  exports.getExptInfoSync = getExptInfoSync;
@@ -8631,7 +8951,9 @@ exports.getStorageInfoSync = getStorageInfoSync;
8631
8951
  exports.getStorageSync = getStorageSync;
8632
8952
  exports.getSwanId = getSwanId;
8633
8953
  exports.getSystemInfo = getSystemInfo;
8954
+ exports.getSystemInfoAsync = getSystemInfoAsync;
8634
8955
  exports.getSystemInfoSync = getSystemInfoSync;
8956
+ exports.getSystemSetting = getSystemSetting;
8635
8957
  exports.getUpdateManager = getUpdateManager;
8636
8958
  exports.getUserCryptoManager = getUserCryptoManager;
8637
8959
  exports.getUserInfo = getUserInfo;
@@ -8639,6 +8961,7 @@ exports.getUserProfile = getUserProfile;
8639
8961
  exports.getVideoInfo = getVideoInfo;
8640
8962
  exports.getWeRunData = getWeRunData;
8641
8963
  exports.getWifiList = getWifiList;
8964
+ exports.getWindowInfo = getWindowInfo;
8642
8965
  exports.hideHomeButton = hideHomeButton;
8643
8966
  exports.hideKeyboard = hideKeyboard;
8644
8967
  exports.hideLoading = hideLoading;
@@ -8653,6 +8976,7 @@ exports.initPxTransform = initPxTransform;
8653
8976
  exports.initTabBarApis = initTabBarApis;
8654
8977
  exports.interceptors = interceptors;
8655
8978
  exports.isBluetoothDevicePaired = isBluetoothDevicePaired;
8979
+ exports.isVKSupport = isVKSupport;
8656
8980
  exports.joinVoIPChat = joinVoIPChat;
8657
8981
  exports.loadFontFace = loadFontFace;
8658
8982
  exports.login = login;
@@ -8700,6 +9024,7 @@ exports.offLocationChange = offLocationChange;
8700
9024
  exports.offLocationChangeError = offLocationChangeError;
8701
9025
  exports.offMemoryWarning = offMemoryWarning;
8702
9026
  exports.offNetworkStatusChange = offNetworkStatusChange;
9027
+ exports.offNetworkWeakChange = offNetworkWeakChange;
8703
9028
  exports.offPageNotFound = offPageNotFound;
8704
9029
  exports.offThemeChange = offThemeChange;
8705
9030
  exports.offUnhandledRejection = offUnhandledRejection;
@@ -8743,6 +9068,7 @@ exports.onLocationChange = onLocationChange;
8743
9068
  exports.onLocationChangeError = onLocationChangeError;
8744
9069
  exports.onMemoryWarning = onMemoryWarning;
8745
9070
  exports.onNetworkStatusChange = onNetworkStatusChange;
9071
+ exports.onNetworkWeakChange = onNetworkWeakChange;
8746
9072
  exports.onPageNotFound = onPageNotFound;
8747
9073
  exports.onSocketClose = onSocketClose;
8748
9074
  exports.onSocketError = onSocketError;
@@ -8757,7 +9083,9 @@ exports.onVoIPChatSpeakersChanged = onVoIPChatSpeakersChanged;
8757
9083
  exports.onVoIPChatStateChanged = onVoIPChatStateChanged;
8758
9084
  exports.onVoIPVideoMembersChanged = onVoIPVideoMembersChanged;
8759
9085
  exports.onWifiConnected = onWifiConnected;
9086
+ exports.onWifiConnectedWithPartialInfo = onWifiConnectedWithPartialInfo;
8760
9087
  exports.onWindowResize = onWindowResize;
9088
+ exports.openAppAuthorizeSetting = openAppAuthorizeSetting;
8761
9089
  exports.openBluetoothAdapter = openBluetoothAdapter;
8762
9090
  exports.openCard = openCard;
8763
9091
  exports.openChannelsActivity = openChannelsActivity;
@@ -8768,6 +9096,7 @@ exports.openDocument = openDocument;
8768
9096
  exports.openEmbeddedMiniProgram = openEmbeddedMiniProgram;
8769
9097
  exports.openLocation = openLocation;
8770
9098
  exports.openSetting = openSetting;
9099
+ exports.openSystemBluetoothSetting = openSystemBluetoothSetting;
8771
9100
  exports.openVideoEditor = openVideoEditor;
8772
9101
  exports.options = options;
8773
9102
  exports.pageScrollTo = pageScrollTo;