@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.43 → 4.0.0-alpha.45

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 (75) hide show
  1. package/dist/apis/base/weapp/life-cycle.ts +1 -1
  2. package/dist/apis/device/clipboard.ts +9 -2
  3. package/dist/apis/framework/index.ts +1 -1
  4. package/dist/apis/media/image/index.ts +124 -135
  5. package/dist/apis/route/index.ts +1 -2
  6. package/dist/apis/ui/background.ts +1 -1
  7. package/dist/apis/ui/interaction/index.ts +20 -4
  8. package/dist/apis/ui/navigation-bar/index.ts +1 -1
  9. package/dist/apis/ui/scroll/index.ts +1 -1
  10. package/dist/apis/ui/tab-bar.ts +1 -2
  11. package/dist/components-harmony-ets/button.ets +1 -1
  12. package/dist/components-harmony-ets/checkbox.ets +1 -2
  13. package/dist/components-harmony-ets/form.ets +0 -1
  14. package/dist/components-harmony-ets/index.ets +37 -90
  15. package/dist/components-harmony-ets/input.ets +11 -7
  16. package/dist/components-harmony-ets/label.ets +1 -2
  17. package/dist/components-harmony-ets/listView.ets +3 -2
  18. package/dist/components-harmony-ets/movableArea.ets +3 -3
  19. package/dist/components-harmony-ets/navigationBar.ets +1 -1
  20. package/dist/components-harmony-ets/pageMeta.ets +1 -1
  21. package/dist/components-harmony-ets/pseudo.ets +1 -1
  22. package/dist/components-harmony-ets/radio.ets +2 -3
  23. package/dist/components-harmony-ets/scrollList.ets +7 -2
  24. package/dist/components-harmony-ets/scrollView.ets +6 -1
  25. package/dist/components-harmony-ets/slider.ets +1 -1
  26. package/dist/components-harmony-ets/stickySection.ets +2 -2
  27. package/dist/components-harmony-ets/style.ets +7 -6
  28. package/dist/components-harmony-ets/swiper.ets +1 -1
  29. package/dist/components-harmony-ets/switch.ets +1 -1
  30. package/dist/components-harmony-ets/text.ets +2 -2
  31. package/dist/components-harmony-ets/utils/helper.ets +2 -2
  32. package/dist/components-harmony-ets/utils/styles.ets +5 -6
  33. package/dist/components-harmony-ets/video.ets +1 -1
  34. package/dist/components-harmony-ets/view.ets +1 -2
  35. package/dist/components-harmony-ets/webView.ets +1 -1
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.js +4 -1
  38. package/dist/index.js.map +1 -1
  39. package/dist/runtime-ets/bom/URL.ts +2 -0
  40. package/dist/runtime-ets/bom/document.ts +1 -2
  41. package/dist/runtime-ets/bom/getComputedStyle.ts +1 -2
  42. package/dist/runtime-ets/bom/history.ts +1 -0
  43. package/dist/runtime-ets/bom/location.ts +1 -0
  44. package/dist/runtime-ets/bom/navigator.ts +1 -21
  45. package/dist/runtime-ets/bom/raf.ts +1 -37
  46. package/dist/runtime-ets/bom/window.ts +4 -5
  47. package/dist/runtime-ets/constant.ts +17 -10
  48. package/dist/runtime-ets/current.ts +0 -1
  49. package/dist/runtime-ets/dom/document.ts +1 -1
  50. package/dist/runtime-ets/dom/element/canvas.ts +3 -2
  51. package/dist/runtime-ets/dom/element/element.ts +6 -5
  52. package/dist/runtime-ets/dom/element/form.ts +6 -0
  53. package/dist/runtime-ets/dom/element/movableView.ts +12 -8
  54. package/dist/runtime-ets/dom/event-source.ts +1 -0
  55. package/dist/runtime-ets/dom/eventTarget.ts +1 -1
  56. package/dist/runtime-ets/dom/node.ts +3 -4
  57. package/dist/runtime-ets/emitter/emitter.ts +1 -0
  58. package/dist/runtime-ets/env.ts +1 -0
  59. package/dist/runtime-ets/index.ts +22 -7
  60. package/dist/runtime-ets/interface/index.ts +6 -0
  61. package/dist/runtime-ets/utils/index.ts +4 -6
  62. package/dist/runtime-ets/utils/router.ts +9 -0
  63. package/dist/runtime-framework/react/app.ts +1 -2
  64. package/dist/runtime-framework/react/hooks.ts +1 -1
  65. package/dist/runtime-framework/react/native-page.ts +44 -15
  66. package/dist/runtime-framework/react/page.ts +1 -2
  67. package/dist/runtime-framework/solid/app.ts +1 -2
  68. package/dist/runtime-framework/solid/hooks.ts +1 -1
  69. package/dist/runtime-framework/solid/page.ts +1 -2
  70. package/dist/runtime-framework/solid/reconciler/props.ts +9 -10
  71. package/dist/runtime-utils.js +160 -173
  72. package/dist/runtime-utils.js.map +1 -1
  73. package/dist/runtime.js +160 -173
  74. package/dist/runtime.js.map +1 -1
  75. package/package.json +9 -9
package/dist/runtime.js CHANGED
@@ -1,16 +1,14 @@
1
1
  import { isFunction, isString, isArray, isObject, isNull, isNumber, isUndefined, queryToJson, PLATFORM_TYPE, singleQuote, internalComponents, mergeReconciler, mergeInternalComponents } from '@tarojs/shared';
2
2
  import _display from '@ohos.display';
3
- import { Current, eventCenter, window, eventSource, hooks, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, getCurrentInstance } from '@tarojs/runtime';
4
- import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
3
+ import { eventCenter, Current, window, eventSource, hooks, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, Events, History, getCurrentInstance } from '@tarojs/runtime';
4
+ import '@ohos.abilityAccessCtrl';
5
5
  import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
6
6
  import deviceInfo from '@ohos.deviceInfo';
7
7
  import i18n from '@ohos.i18n';
8
8
  import errorManager from '@ohos.app.ability.errorManager';
9
- import { eventCenter as eventCenter$1, Events, History } from '@tarojs/runtime/dist/runtime.esm';
10
9
  import sensor from '@ohos.sensor';
11
10
  import batteryInfo, { BatteryChargeState } from '@ohos.batteryInfo';
12
11
  import pasteboard from '@ohos.pasteboard';
13
- import promptAction from '@ohos.promptAction';
14
12
  import inputMethodEngine from '@ohos.inputMethodEngine';
15
13
  import network from '@system.network';
16
14
  import call from '@ohos.telephony.call';
@@ -33,7 +31,6 @@ import router from '@ohos.router';
33
31
  import bundleManager from '@ohos.bundle.bundleManager';
34
32
  import distributedKVStore from '@ohos.data.distributedKVStore';
35
33
  import matrix4 from '@ohos.matrix4';
36
- import { pxTransformHelper as pxTransformHelper$1 } from '@tarojs/taro';
37
34
 
38
35
  class MethodHandler {
39
36
  constructor({ name, success, fail, complete }) {
@@ -176,21 +173,6 @@ const validateParams = function (name, params, schema) {
176
173
  }
177
174
  };
178
175
 
179
- function requestPermissions(permissions) {
180
- return new Promise((resolve, reject) => {
181
- const context = getContext(Current === null || Current === void 0 ? void 0 : Current.page);
182
- const atManager = abilityAccessCtrl.createAtManager();
183
- atManager.requestPermissionsFromUser(context, permissions, (err, _) => {
184
- if (err) {
185
- // eslint-disable-next-line prefer-promise-reject-errors
186
- reject(`[Taro] 请求用户授权 ${permissions.join('、')} 失败:${JSON.stringify(err)}`);
187
- }
188
- else {
189
- resolve();
190
- }
191
- });
192
- });
193
- }
194
176
  function object2String(obj) {
195
177
  let str = '';
196
178
  for (const item in obj) {
@@ -463,7 +445,7 @@ const launchOptions = {
463
445
  function initLaunchOptions(options = {}) {
464
446
  Object.assign(launchOptions, options);
465
447
  }
466
- eventCenter$1.once('__taroRouterLaunch', initLaunchOptions);
448
+ eventCenter.once('__taroRouterLaunch', initLaunchOptions);
467
449
  // 生命周期
468
450
  const getLaunchOptionsSync = () => launchOptions;
469
451
  const getEnterOptionsSync = () => launchOptions;
@@ -675,11 +657,16 @@ const setClipboardData = function (options) {
675
657
  });
676
658
  }
677
659
  return new Promise((resolve, reject) => {
660
+ var _a, _b;
678
661
  const systemPasteboard = pasteboard.getSystemPasteboard();
679
662
  const pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, data);
680
663
  try {
681
664
  systemPasteboard.setDataSync(pasteData);
682
- promptAction.showToast({
665
+ // @ts-ignore
666
+ const uiContext = (_b = (_a = Current === null || Current === void 0 ? void 0 : Current.page) === null || _a === void 0 ? void 0 : _a.getUIContext) === null || _b === void 0 ? void 0 : _b.call(_a);
667
+ if (!uiContext)
668
+ return;
669
+ uiContext.getPromptAction().showToast({
683
670
  message: '内容已复制',
684
671
  duration: 1500,
685
672
  bottom: '50%',
@@ -2279,12 +2266,6 @@ const chooseMedia = function (options) {
2279
2266
  });
2280
2267
  };
2281
2268
 
2282
- const READ_IMAGEVIDEO_PERMISSIONS = 'ohos.permission.READ_IMAGEVIDEO';
2283
- const READ_MEDIA_PERMISSIONS = 'ohos.permission.READ_MEDIA';
2284
- const WRITE_MEDIA_PERMISSIONS = 'ohos.permission.WRITE_MEDIA';
2285
- const MEDIA_LOCATION_PERMISSIONS = 'ohos.permission.MEDIA_LOCATION';
2286
- const IMAGE_PERMISSION = [READ_IMAGEVIDEO_PERMISSIONS, READ_MEDIA_PERMISSIONS, WRITE_MEDIA_PERMISSIONS, MEDIA_LOCATION_PERMISSIONS];
2287
-
2288
2269
  // HarmonyOS 图片模块首批接口从API version 7开始支持。
2289
2270
  // HarmonyOS 文档链接:https://developer.harmonyos.com/cn/docs/documentation/doc-references/js-apis-image-0000001122977382
2290
2271
  // WX 文档链接:https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html
@@ -2360,153 +2341,143 @@ function saveImage(compressedImageData, compressedImageUri) {
2360
2341
  }
2361
2342
  const compressImage = function (options) {
2362
2343
  return new Promise((resolve, reject) => {
2363
- requestPermissions(IMAGE_PERMISSION).then(() => {
2364
- try {
2365
- validateParams('compressImage', options, compressImageSchema);
2366
- }
2367
- catch (error) {
2368
- const res = { errMsg: error.message };
2369
- return callAsyncFail(reject, res, options);
2370
- }
2371
- const { src, quality = 80, compressedWidth, compressedHeight } = options;
2372
- const srcAfterCompress = src.includes('_after_compress') ? src : src.split('.').join('_after_compress.');
2373
- const file = fs.openSync(src, fs.OpenMode.READ_ONLY);
2374
- // const stat = fs.statSync(file.fd)
2375
- // console.log('[Taro] 压缩前图片的大小为:', stat.size)
2376
- const source = image.createImageSource(file.fd);
2377
- if (isNull(source)) {
2378
- const createImageSourceError = { errMsg: 'compressImage fail: createImageSource has failed.' };
2379
- callAsyncFail(reject, createImageSourceError, options);
2380
- return;
2381
- }
2382
- const width = source.getImageInfoSync().size.width;
2383
- const height = source.getImageInfoSync().size.height;
2384
- let wantWidth = compressedWidth || compressedHeight || 0;
2385
- let wantHeight = compressedHeight || compressedWidth || 0;
2386
- if (width > wantWidth || height > wantHeight) {
2387
- const heightRatio = height / wantHeight;
2388
- const widthRatio = width / wantWidth;
2389
- const finalRatio = heightRatio < widthRatio ? heightRatio : widthRatio;
2390
- wantWidth = Math.round(width / finalRatio);
2391
- wantHeight = Math.round(height / finalRatio);
2344
+ try {
2345
+ validateParams('compressImage', options, compressImageSchema);
2346
+ }
2347
+ catch (error) {
2348
+ const res = { errMsg: error.message };
2349
+ return callAsyncFail(reject, res, options);
2350
+ }
2351
+ const { src, quality = 80, compressedWidth, compressedHeight } = options;
2352
+ const srcAfterCompress = src.includes('_after_compress') ? src : src.split('.').join('_after_compress.');
2353
+ const file = fs.openSync(src, fs.OpenMode.READ_ONLY);
2354
+ // const stat = fs.statSync(file.fd)
2355
+ // console.log('[Taro] 压缩前图片的大小为:', stat.size)
2356
+ const source = image.createImageSource(file.fd);
2357
+ if (isNull(source)) {
2358
+ const createImageSourceError = { errMsg: 'compressImage fail: createImageSource has failed.' };
2359
+ callAsyncFail(reject, createImageSourceError, options);
2360
+ return;
2361
+ }
2362
+ const width = source.getImageInfoSync().size.width;
2363
+ const height = source.getImageInfoSync().size.height;
2364
+ let wantWidth = compressedWidth || compressedHeight || 0;
2365
+ let wantHeight = compressedHeight || compressedWidth || 0;
2366
+ if (width > wantWidth || height > wantHeight) {
2367
+ const heightRatio = height / wantHeight;
2368
+ const widthRatio = width / wantWidth;
2369
+ const finalRatio = heightRatio < widthRatio ? heightRatio : widthRatio;
2370
+ wantWidth = Math.round(width / finalRatio);
2371
+ wantHeight = Math.round(height / finalRatio);
2372
+ }
2373
+ const decodingOptions = {
2374
+ editable: true,
2375
+ desiredPixelFormat: image.PixelMapFormat.RGBA_8888,
2376
+ desiredSize: { width: wantWidth, height: wantHeight }
2377
+ };
2378
+ source.createPixelMap(decodingOptions, (error, pixelMap) => {
2379
+ if (error !== undefined) {
2380
+ fs.closeSync(file);
2381
+ const res = { errMsg: error };
2382
+ callAsyncFail(reject, res, options);
2392
2383
  }
2393
- const decodingOptions = {
2394
- editable: true,
2395
- desiredPixelFormat: image.PixelMapFormat.RGBA_8888,
2396
- desiredSize: { width: wantWidth, height: wantHeight }
2397
- };
2398
- source.createPixelMap(decodingOptions, (error, pixelMap) => {
2399
- if (error !== undefined) {
2384
+ else {
2385
+ const packer = image.createImagePacker(file.fd);
2386
+ if (isNull(packer)) {
2400
2387
  fs.closeSync(file);
2401
- const res = { errMsg: error };
2402
- callAsyncFail(reject, res, options);
2388
+ const createImagePackerError = { errMsg: 'compressImage fail: createImagePacker has failed.' };
2389
+ callAsyncFail(reject, createImagePackerError, options);
2390
+ return;
2403
2391
  }
2404
- else {
2405
- const packer = image.createImagePacker(file.fd);
2406
- if (isNull(packer)) {
2407
- fs.closeSync(file);
2408
- const createImagePackerError = { errMsg: 'compressImage fail: createImagePacker has failed.' };
2409
- callAsyncFail(reject, createImagePackerError, options);
2410
- return;
2411
- }
2412
- const isPNG = src.endsWith('.png');
2413
- const packingOptionsOHOS = {
2414
- format: isPNG ? 'image/png' : 'image/jpeg',
2415
- quality: quality
2416
- };
2417
- packer.packing(pixelMap, packingOptionsOHOS).then((value) => {
2418
- fs.closeSync(file);
2419
- saveImage(value, srcAfterCompress).then(result => {
2420
- callAsyncSuccess(resolve, { tempFilePath: result.imageUri }, options);
2421
- });
2422
- }).catch((error) => {
2423
- fs.closeSync(file);
2424
- callAsyncFail(reject, error, options);
2392
+ const isPNG = src.endsWith('.png');
2393
+ const packingOptionsOHOS = {
2394
+ format: isPNG ? 'image/png' : 'image/jpeg',
2395
+ quality: quality
2396
+ };
2397
+ packer.packing(pixelMap, packingOptionsOHOS).then((value) => {
2398
+ fs.closeSync(file);
2399
+ saveImage(value, srcAfterCompress).then(result => {
2400
+ callAsyncSuccess(resolve, { tempFilePath: result.imageUri }, options);
2425
2401
  });
2426
- }
2427
- });
2428
- }, (error) => {
2429
- const res = { errMsg: error };
2430
- return callAsyncFail(reject, res, options);
2402
+ }).catch((error) => {
2403
+ fs.closeSync(file);
2404
+ callAsyncFail(reject, error, options);
2405
+ });
2406
+ }
2431
2407
  });
2432
2408
  });
2433
2409
  };
2434
2410
  const chooseImage = function (options) {
2435
2411
  return new Promise((resolve, reject) => {
2436
- requestPermissions(IMAGE_PERMISSION).then(() => {
2437
- try {
2438
- validateParams('chooseImage', options, chooseImageSchema);
2439
- }
2440
- catch (error) {
2441
- const res = { errMsg: error.message };
2442
- return callAsyncFail(reject, res, options);
2443
- }
2444
- const { count = 9 } = options;
2445
- const photoViewPicker = new picker.PhotoViewPicker();
2446
- let sizeType = options.sizeType;
2447
- if (!sizeType || !sizeType.length) {
2448
- sizeType = ['compressed', 'original'];
2412
+ try {
2413
+ validateParams('chooseImage', options, chooseImageSchema);
2414
+ }
2415
+ catch (error) {
2416
+ const res = { errMsg: error.message };
2417
+ return callAsyncFail(reject, res, options);
2418
+ }
2419
+ const { count = 9 } = options;
2420
+ const photoViewPicker = new picker.PhotoViewPicker();
2421
+ let sizeType = options.sizeType;
2422
+ if (!sizeType || !sizeType.length) {
2423
+ sizeType = ['compressed', 'original'];
2424
+ }
2425
+ photoSelectOptions.maxSelectNumber = count; // 选择媒体文件的最大数目
2426
+ photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型为IMAGE
2427
+ photoViewPicker.select(photoSelectOptions).then((photoSelectResult) => {
2428
+ const result = {};
2429
+ const isOrigin = photoSelectResult.isOriginalPhoto;
2430
+ if (isOrigin) {
2431
+ const tempFilePaths = [];
2432
+ const tempFiles = photoSelectResult.photoUris.map(uri => {
2433
+ const file = fs.openSync(uri, fs.OpenMode.READ_ONLY);
2434
+ const stat = fs.statSync(file.fd);
2435
+ const size = stat.size;
2436
+ fs.closeSync(file);
2437
+ tempFilePaths.push(uri);
2438
+ return {
2439
+ size,
2440
+ path: uri,
2441
+ };
2442
+ });
2443
+ result.tempFiles = tempFiles;
2444
+ result.tempFilePaths = tempFilePaths;
2445
+ callAsyncSuccess(resolve, result, options);
2449
2446
  }
2450
- photoSelectOptions.maxSelectNumber = count; // 选择媒体文件的最大数目
2451
- photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型为IMAGE
2452
- photoViewPicker.select(photoSelectOptions).then((photoSelectResult) => {
2453
- const result = {};
2454
- const isOrigin = photoSelectResult.isOriginalPhoto;
2455
- if (isOrigin) {
2456
- const tempFilePaths = [];
2457
- const tempFiles = photoSelectResult.photoUris.map(uri => {
2447
+ else {
2448
+ const actions = photoSelectResult.photoUris.map(uri => {
2449
+ return new Promise(resolve => {
2450
+ compressImage({
2451
+ src: uri,
2452
+ compressedWidth: getSystemInfoSync().screenWidth / 2,
2453
+ compressedHeight: getSystemInfoSync().screenHeight / 2,
2454
+ success: (compressResult) => {
2455
+ resolve(compressResult.tempFilePath);
2456
+ }
2457
+ });
2458
+ });
2459
+ });
2460
+ Promise.all(actions).then(tempFilePaths => {
2461
+ const tempFiles = tempFilePaths.map(uri => {
2458
2462
  const file = fs.openSync(uri, fs.OpenMode.READ_ONLY);
2459
2463
  const stat = fs.statSync(file.fd);
2460
2464
  const size = stat.size;
2461
2465
  fs.closeSync(file);
2462
- tempFilePaths.push(uri);
2463
2466
  return {
2464
2467
  size,
2465
2468
  path: uri,
2466
2469
  };
2467
2470
  });
2468
- result.tempFiles = tempFiles;
2469
2471
  result.tempFilePaths = tempFilePaths;
2472
+ result.tempFiles = tempFiles;
2470
2473
  callAsyncSuccess(resolve, result, options);
2471
- }
2472
- else {
2473
- const actions = photoSelectResult.photoUris.map(uri => {
2474
- return new Promise(resolve => {
2475
- compressImage({
2476
- src: uri,
2477
- compressedWidth: getSystemInfoSync().screenWidth / 2,
2478
- compressedHeight: getSystemInfoSync().screenHeight / 2,
2479
- success: (compressResult) => {
2480
- resolve(compressResult.tempFilePath);
2481
- }
2482
- });
2483
- });
2484
- });
2485
- Promise.all(actions).then(tempFilePaths => {
2486
- const tempFiles = tempFilePaths.map(uri => {
2487
- const file = fs.openSync(uri, fs.OpenMode.READ_ONLY);
2488
- const stat = fs.statSync(file.fd);
2489
- const size = stat.size;
2490
- fs.closeSync(file);
2491
- return {
2492
- size,
2493
- path: uri,
2494
- };
2495
- });
2496
- result.tempFilePaths = tempFilePaths;
2497
- result.tempFiles = tempFiles;
2498
- callAsyncSuccess(resolve, result, options);
2499
- }).catch(error => {
2500
- const res = { errMsg: error };
2501
- return callAsyncFail(reject, res, options);
2502
- });
2503
- }
2504
- }).catch((error) => {
2505
- callAsyncFail(reject, error, options);
2506
- });
2507
- }, (error) => {
2508
- const res = { errMsg: error };
2509
- return callAsyncFail(reject, res, options);
2474
+ }).catch(error => {
2475
+ const res = { errMsg: error };
2476
+ return callAsyncFail(reject, res, options);
2477
+ });
2478
+ }
2479
+ }).catch((error) => {
2480
+ callAsyncFail(reject, error, options);
2510
2481
  });
2511
2482
  });
2512
2483
  };
@@ -3347,7 +3318,7 @@ const switchTab = (options) => {
3347
3318
  }
3348
3319
  if (((_a = stack[stack.length - 1]) === null || _a === void 0 ? void 0 : _a.path) === url) {
3349
3320
  // Note: 当前为 Tab 页时,触发 switch 事件
3350
- eventCenter$1.trigger('__taroSwitchTab', { url, params });
3321
+ eventCenter.trigger('__taroSwitchTab', { url, params });
3351
3322
  router.getLength() > 1 && router.clear();
3352
3323
  }
3353
3324
  else if (stack.some(item => item.path === url)) {
@@ -3772,7 +3743,7 @@ function setBackgroundColor(options) {
3772
3743
  const { success, fail, complete } = options || {};
3773
3744
  const handle = new MethodHandler({ name: 'setBackgroundColor', success, fail, complete });
3774
3745
  return new Promise((resolve, reject) => {
3775
- eventCenter$1.trigger('__taroPageStyle', {
3746
+ eventCenter.trigger('__taroPageStyle', {
3776
3747
  backgroundColor: options.backgroundColorBottom || options.backgroundColor,
3777
3748
  backgroundColorContext: options.backgroundColorTop || options.backgroundColor
3778
3749
  });
@@ -3790,6 +3761,7 @@ const nextTick = (cb, ctx) => {
3790
3761
  // 字体
3791
3762
  const loadFontFace = /* @__PURE__ */ temporarilyNotSupport('getMenuButtonBoundingClientRect');
3792
3763
 
3764
+ // @ts-ignore
3793
3765
  const resCallback = (res) => {
3794
3766
  return { errMsg: `${res}:ok` };
3795
3767
  };
@@ -3800,6 +3772,7 @@ const showToastSchema = {
3800
3772
  };
3801
3773
  function showToast(options) {
3802
3774
  return new Promise((resolve, reject) => {
3775
+ var _a, _b;
3803
3776
  const _default = {
3804
3777
  title: '',
3805
3778
  duration: 1500,
@@ -3813,7 +3786,11 @@ function showToast(options) {
3813
3786
  const res = { errMsg: error.message };
3814
3787
  return callAsyncFail(reject, res, options);
3815
3788
  }
3816
- promptAction.showToast({
3789
+ // @ts-ignore
3790
+ const uiContext = (_b = (_a = Current === null || Current === void 0 ? void 0 : Current.page) === null || _a === void 0 ? void 0 : _a.getUIContext) === null || _b === void 0 ? void 0 : _b.call(_a);
3791
+ if (!uiContext)
3792
+ return;
3793
+ uiContext.getPromptAction().showToast({
3817
3794
  message: options.title,
3818
3795
  duration: options.duration,
3819
3796
  bottom: options.bottom,
@@ -3848,12 +3825,17 @@ function showModal(options) {
3848
3825
  });
3849
3826
  }
3850
3827
  return new Promise((resolve, reject) => {
3828
+ var _a, _b;
3851
3829
  const modalOptions = {
3852
3830
  title,
3853
3831
  message: content,
3854
3832
  buttons: buttons,
3855
3833
  };
3856
- promptAction.showDialog(modalOptions, (error, data) => {
3834
+ // @ts-ignore
3835
+ const uiContext = (_b = (_a = Current === null || Current === void 0 ? void 0 : Current.page) === null || _a === void 0 ? void 0 : _a.getUIContext) === null || _b === void 0 ? void 0 : _b.call(_a);
3836
+ if (!uiContext)
3837
+ return;
3838
+ uiContext.getPromptAction().showDialog(modalOptions, (error, data) => {
3857
3839
  if (error) {
3858
3840
  const res = { errMsg: error };
3859
3841
  callAsyncFail(reject, res, options);
@@ -3873,6 +3855,7 @@ const showActionSheetSchema = {
3873
3855
  };
3874
3856
  function showActionSheet(options) {
3875
3857
  return new Promise((resolve, reject) => {
3858
+ var _a, _b;
3876
3859
  const _default = {
3877
3860
  title: '',
3878
3861
  itemList: [],
@@ -3897,7 +3880,11 @@ function showActionSheet(options) {
3897
3880
  title,
3898
3881
  buttons
3899
3882
  };
3900
- promptAction.showActionMenu(actionSheetOptions, (error, data) => {
3883
+ // @ts-ignore
3884
+ const uiContext = (_b = (_a = Current === null || Current === void 0 ? void 0 : Current.page) === null || _a === void 0 ? void 0 : _a.getUIContext) === null || _b === void 0 ? void 0 : _b.call(_a);
3885
+ if (!uiContext)
3886
+ return;
3887
+ uiContext.getPromptAction().showActionMenu(actionSheetOptions, (error, data) => {
3901
3888
  var _a;
3902
3889
  if (error) {
3903
3890
  callAsyncFail(reject, Object.assign(Object.assign({}, data), { errMsg: (_a = data.errMsg) === null || _a === void 0 ? void 0 : _a.replace('showActionMenu', 'showActionSheet') }), options);
@@ -3919,7 +3906,7 @@ const setNavigationBarTitle = function (options) {
3919
3906
  const { success, fail, complete } = options || {};
3920
3907
  const handle = new MethodHandler({ name: 'setNavigationBarTitle', success, fail, complete });
3921
3908
  return new Promise((resolve, reject) => {
3922
- eventCenter$1.trigger('__taroNavigationStyle', {
3909
+ eventCenter.trigger('__taroNavigationStyle', {
3923
3910
  title: options.title,
3924
3911
  });
3925
3912
  return handle.success({}, { resolve, reject });
@@ -3929,7 +3916,7 @@ const setNavigationBarColor = function (options) {
3929
3916
  const { success, fail, complete } = options || {};
3930
3917
  const handle = new MethodHandler({ name: 'setNavigationBarColor', success, fail, complete });
3931
3918
  return new Promise((resolve, reject) => {
3932
- eventCenter$1.trigger('__taroNavigationStyle', {
3919
+ eventCenter.trigger('__taroNavigationStyle', {
3933
3920
  animation: options.animation,
3934
3921
  backgroundColor: options.backgroundColor,
3935
3922
  frontColor: options.frontColor,
@@ -3941,7 +3928,7 @@ const showNavigationBarLoading = function (options) {
3941
3928
  const { success, fail, complete } = options || {};
3942
3929
  const handle = new MethodHandler({ name: 'showNavigationBarLoading', success, fail, complete });
3943
3930
  return new Promise((resolve, reject) => {
3944
- eventCenter$1.trigger('__taroNavigationStyle', {
3931
+ eventCenter.trigger('__taroNavigationStyle', {
3945
3932
  loading: true,
3946
3933
  });
3947
3934
  return handle.success({}, { resolve, reject });
@@ -3951,7 +3938,7 @@ const hideNavigationBarLoading = function (options) {
3951
3938
  const { success, fail, complete } = options || {};
3952
3939
  const handle = new MethodHandler({ name: 'hideNavigationBarLoading', success, fail, complete });
3953
3940
  return new Promise((resolve, reject) => {
3954
- eventCenter$1.trigger('__taroNavigationStyle', {
3941
+ eventCenter.trigger('__taroNavigationStyle', {
3955
3942
  loading: false,
3956
3943
  });
3957
3944
  return handle.success({}, { resolve, reject });
@@ -3961,7 +3948,7 @@ const hideHomeButton = function (options) {
3961
3948
  const { success, fail, complete } = options || {};
3962
3949
  const handle = new MethodHandler({ name: 'hideHomeButton', success, fail, complete });
3963
3950
  return new Promise((resolve, reject) => {
3964
- eventCenter$1.trigger('__taroNavigationStyle', {
3951
+ eventCenter.trigger('__taroNavigationStyle', {
3965
3952
  home: false,
3966
3953
  });
3967
3954
  return handle.success({}, { resolve, reject });
@@ -4051,7 +4038,7 @@ const pageScrollTo = (options) => {
4051
4038
  scroller = getPageScrollerOrNode(scroller, page);
4052
4039
  const { yOffset } = scroller.currentOffset();
4053
4040
  if (areaInfo) {
4054
- scrollValue = areaInfo.globalPosition.y + yOffset + pxTransformHelper$1(offsetTop, 'px', true);
4041
+ scrollValue = areaInfo.globalPosition.y + yOffset + pxTransformHelper(offsetTop, 'px', true);
4055
4042
  }
4056
4043
  }
4057
4044
  if (!scroller || scrollValue === -1) {
@@ -4100,7 +4087,7 @@ const toggleTabBar = function (type) {
4100
4087
  else {
4101
4088
  const isShow = type === 'show';
4102
4089
  const event = isShow ? '__taroShowTabBar' : '__taroHideTabBar';
4103
- eventCenter$1.trigger(event, {
4090
+ eventCenter.trigger(event, {
4104
4091
  animation: options === null || options === void 0 ? void 0 : options.animation,
4105
4092
  });
4106
4093
  (_b = page.$set) === null || _b === void 0 ? void 0 : _b.call(page, 'isShowTaroTabBar', isShow);
@@ -4132,7 +4119,7 @@ const setTabBarStyle = function (options = {}) {
4132
4119
  data.backgroundColor = options.backgroundColor;
4133
4120
  if (options.borderStyle)
4134
4121
  data.borderStyle = options.borderStyle;
4135
- eventCenter$1.trigger('__taroSetTabBarStyle', options);
4122
+ eventCenter.trigger('__taroSetTabBarStyle', options);
4136
4123
  (_b = page.$set) === null || _b === void 0 ? void 0 : _b.call(page, 'taroTabBar', data);
4137
4124
  callAsyncSuccess(resolve, res, options);
4138
4125
  }
@@ -4164,7 +4151,7 @@ const setTabBarItem = function (options) {
4164
4151
  ...currentData.list.slice(index + 1)
4165
4152
  ];
4166
4153
  const data = Object.assign({}, currentData, { list });
4167
- eventCenter$1.trigger('__taroSetTabBarItem', options);
4154
+ eventCenter.trigger('__taroSetTabBarItem', options);
4168
4155
  (_b = page.$set) === null || _b === void 0 ? void 0 : _b.call(page, 'taroTabBar', data);
4169
4156
  callAsyncSuccess(resolve, res, options);
4170
4157
  }
@@ -4173,7 +4160,7 @@ const setTabBarItem = function (options) {
4173
4160
  function showTabBarRedDot(options) {
4174
4161
  const res = { errMsg: 'showTabBarRedDot:ok' };
4175
4162
  return new Promise((resolve) => {
4176
- eventCenter$1.trigger('__taroShowTabBarRedDotHandler', {
4163
+ eventCenter.trigger('__taroShowTabBarRedDotHandler', {
4177
4164
  index: (options === null || options === void 0 ? void 0 : options.index) || 0,
4178
4165
  });
4179
4166
  callAsyncSuccess(resolve, res, options);
@@ -4182,7 +4169,7 @@ function showTabBarRedDot(options) {
4182
4169
  function hideTabBarRedDot(options) {
4183
4170
  const res = { errMsg: 'hideTabBarRedDot:ok' };
4184
4171
  return new Promise((resolve) => {
4185
- eventCenter$1.trigger('__taroHideTabBarRedDotHandler', {
4172
+ eventCenter.trigger('__taroHideTabBarRedDotHandler', {
4186
4173
  index: (options === null || options === void 0 ? void 0 : options.index) || 0,
4187
4174
  });
4188
4175
  callAsyncSuccess(resolve, res, options);
@@ -4192,7 +4179,7 @@ function setTabBarBadge(options) {
4192
4179
  const res = { errMsg: 'setTabBarBadge:ok' };
4193
4180
  return new Promise((resolve) => {
4194
4181
  const text = (options === null || options === void 0 ? void 0 : options.text) || '';
4195
- eventCenter$1.trigger('__taroSetTabBarBadge', {
4182
+ eventCenter.trigger('__taroSetTabBarBadge', {
4196
4183
  index: (options === null || options === void 0 ? void 0 : options.index) || 0,
4197
4184
  text: text.replace(/[\u0391-\uFFE5]/g, 'aa').length > 4 ? '...' : text,
4198
4185
  });
@@ -4202,7 +4189,7 @@ function setTabBarBadge(options) {
4202
4189
  function removeTabBarBadge(options) {
4203
4190
  const res = { errMsg: 'removeTabBarBadge:ok' };
4204
4191
  return new Promise((resolve) => {
4205
- eventCenter$1.trigger('__taroRemoveTabBarBadge', {
4192
+ eventCenter.trigger('__taroRemoveTabBarBadge', {
4206
4193
  index: (options === null || options === void 0 ? void 0 : options.index) || 0,
4207
4194
  });
4208
4195
  callAsyncSuccess(resolve, res, options);
@@ -4698,7 +4685,7 @@ var apis = /*#__PURE__*/Object.freeze({
4698
4685
  disableAlertBeforeUnload: disableAlertBeforeUnload,
4699
4686
  downloadFile: downloadFile,
4700
4687
  enableAlertBeforeUnload: enableAlertBeforeUnload,
4701
- eventCenter: eventCenter$1,
4688
+ eventCenter: eventCenter,
4702
4689
  exitMiniProgram: exitMiniProgram,
4703
4690
  exitVoIPChat: exitVoIPChat,
4704
4691
  faceVerifyForPay: faceVerifyForPay,