@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.0 → 4.0.0-alpha.11

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 (139) hide show
  1. package/dist/apis/base/system.ts +73 -20
  2. package/dist/apis/canvas/index.ts +10 -1
  3. package/dist/apis/device/clipboard.ts +16 -8
  4. package/dist/apis/device/memory.ts +10 -3
  5. package/dist/apis/framework/index.ts +1 -5
  6. package/dist/apis/index.ts +27 -17
  7. package/dist/apis/media/image/index.ts +1 -1
  8. package/dist/apis/media/video/VideoContext.ts +56 -7
  9. package/dist/apis/media/video/index.ts +3 -2
  10. package/dist/apis/network/request.ts +5 -5
  11. package/dist/apis/route/index.ts +15 -0
  12. package/dist/apis/storage/index.ts +146 -78
  13. package/dist/apis/ui/animation/animation.ts +71 -29
  14. package/dist/apis/ui/background.ts +2 -1
  15. package/dist/apis/ui/interaction/index.ts +42 -59
  16. package/dist/apis/ui/navigation-bar/index.ts +1 -1
  17. package/dist/apis/ui/pull-down-refresh.ts +9 -3
  18. package/dist/apis/ui/scroll/index.ts +5 -5
  19. package/dist/apis/ui/tab-bar.ts +3 -3
  20. package/dist/apis/utils/index.ts +1 -1
  21. package/dist/apis/wxml/IntersectionObserver.ts +18 -10
  22. package/dist/apis/wxml/index.ts +2 -0
  23. package/dist/apis/wxml/selectorQuery.ts +26 -13
  24. package/dist/components-harmony-ets/button.ets +68 -68
  25. package/dist/components-harmony-ets/canvas.ets +51 -0
  26. package/dist/components-harmony-ets/checkbox.ets +81 -102
  27. package/dist/components-harmony-ets/form.ets +54 -45
  28. package/dist/components-harmony-ets/icon.ets +34 -50
  29. package/dist/components-harmony-ets/image.ets +35 -45
  30. package/dist/components-harmony-ets/index.ets +92 -0
  31. package/dist/components-harmony-ets/innerHtml.ets +11 -6
  32. package/dist/components-harmony-ets/input.ets +51 -67
  33. package/dist/components-harmony-ets/label.ets +73 -53
  34. package/dist/components-harmony-ets/listView.ets +26 -0
  35. package/dist/components-harmony-ets/movableArea.ets +124 -0
  36. package/dist/components-harmony-ets/movableView.ets +93 -0
  37. package/dist/components-harmony-ets/navigationBar.ets +65 -0
  38. package/dist/components-harmony-ets/pageMeta.ets +94 -0
  39. package/dist/components-harmony-ets/picker.ets +74 -77
  40. package/dist/components-harmony-ets/progress.ets +52 -0
  41. package/dist/components-harmony-ets/pseudo.ets +80 -0
  42. package/dist/components-harmony-ets/radio.ets +82 -104
  43. package/dist/components-harmony-ets/richText.ets +20 -68
  44. package/dist/components-harmony-ets/scrollList.ets +94 -0
  45. package/dist/components-harmony-ets/scrollView.ets +67 -103
  46. package/dist/components-harmony-ets/slider.ets +23 -47
  47. package/dist/components-harmony-ets/stickySection.ets +42 -0
  48. package/dist/components-harmony-ets/style.ets +396 -0
  49. package/dist/components-harmony-ets/swiper.ets +64 -53
  50. package/dist/components-harmony-ets/switch.ets +44 -55
  51. package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
  52. package/dist/components-harmony-ets/text.ets +134 -75
  53. package/dist/components-harmony-ets/textArea.ets +54 -62
  54. package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
  55. package/dist/components-harmony-ets/utils/DynamicCenter.ts +4 -13
  56. package/dist/components-harmony-ets/utils/flexManager.ets +76 -8
  57. package/dist/components-harmony-ets/utils/helper.ets +20 -7
  58. package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
  59. package/dist/components-harmony-ets/utils/htmlParser/index.ts +1 -1
  60. package/dist/components-harmony-ets/utils/index.ts +54 -50
  61. package/dist/components-harmony-ets/utils/styles.ets +178 -63
  62. package/dist/components-harmony-ets/video.ets +37 -54
  63. package/dist/components-harmony-ets/view.ets +63 -94
  64. package/dist/components-harmony-ets/webView.ets +56 -0
  65. package/dist/index.d.ts +152 -0
  66. package/dist/index.js +199 -58
  67. package/dist/index.js.map +1 -1
  68. package/dist/runtime-ets/bom/document.ts +6 -4
  69. package/dist/runtime-ets/bom/getComputedStyle.ts +2 -2
  70. package/dist/runtime-ets/bom/window.ts +9 -2
  71. package/dist/runtime-ets/current.ts +3 -0
  72. package/dist/runtime-ets/dom/bind.ts +28 -12
  73. package/dist/runtime-ets/dom/class-list.ts +2 -2
  74. package/dist/runtime-ets/dom/cssNesting.ts +409 -0
  75. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +29 -19
  76. package/dist/runtime-ets/dom/document.ts +22 -8
  77. package/dist/runtime-ets/dom/element/canvas.ts +136 -0
  78. package/dist/runtime-ets/dom/element/element.ts +334 -57
  79. package/dist/runtime-ets/dom/element/form.ts +32 -26
  80. package/dist/runtime-ets/dom/element/index.ts +33 -2
  81. package/dist/runtime-ets/dom/element/movableArea.ts +11 -0
  82. package/dist/runtime-ets/dom/element/movableView.ts +242 -0
  83. package/dist/runtime-ets/dom/element/normal.ts +36 -8
  84. package/dist/runtime-ets/dom/element/progress.ts +11 -0
  85. package/dist/runtime-ets/dom/element/scrollView.ts +1 -0
  86. package/dist/runtime-ets/dom/element/text.ts +1 -8
  87. package/dist/runtime-ets/dom/element/video.ts +5 -4
  88. package/dist/runtime-ets/dom/element/webView.ts +68 -0
  89. package/dist/runtime-ets/dom/event.ts +2 -4
  90. package/dist/runtime-ets/dom/eventTarget.ts +2 -3
  91. package/dist/runtime-ets/dom/node.ts +62 -27
  92. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +805 -0
  93. package/dist/runtime-ets/dom/stylesheet/index.ts +98 -518
  94. package/dist/runtime-ets/dom/stylesheet/type.ts +92 -17
  95. package/dist/runtime-ets/dom/stylesheet/util.ts +74 -16
  96. package/dist/runtime-ets/index.ts +2 -2
  97. package/dist/runtime-ets/interface/event.ts +3 -2
  98. package/dist/runtime-ets/utils/index.ts +77 -12
  99. package/dist/runtime-ets/utils/info.ts +4 -2
  100. package/dist/runtime-framework/react/app.ts +17 -22
  101. package/dist/runtime-framework/react/hooks.ts +3 -4
  102. package/dist/runtime-framework/react/index.ts +1 -2
  103. package/dist/runtime-framework/react/native-page.ts +421 -0
  104. package/dist/runtime-framework/react/page.ts +4 -9
  105. package/dist/runtime-framework/solid/app.ts +25 -45
  106. package/dist/runtime-framework/solid/connect.ts +21 -3
  107. package/dist/runtime-framework/solid/hooks.ts +17 -12
  108. package/dist/runtime-framework/solid/index.ts +6 -2
  109. package/dist/runtime-framework/solid/page.ts +84 -30
  110. package/dist/runtime-framework/solid/reconciler/props.ts +70 -25
  111. package/dist/runtime-framework/solid/reconciler/render.ts +16 -6
  112. package/dist/runtime-framework/solid/reconciler/use.ts +0 -1
  113. package/dist/runtime-framework/solid/utils/index.ts +0 -2
  114. package/dist/runtime-utils.d.ts +827 -0
  115. package/dist/runtime-utils.js +510 -237
  116. package/dist/runtime-utils.js.map +1 -1
  117. package/dist/runtime.d.ts +1 -0
  118. package/dist/runtime.js +510 -237
  119. package/dist/runtime.js.map +1 -1
  120. package/index.js +3 -1
  121. package/package.json +14 -15
  122. package/static/media/cancel.svg +1 -0
  123. package/static/media/circle.svg +1 -0
  124. package/static/media/clear.svg +1 -0
  125. package/static/media/download.svg +1 -0
  126. package/static/media/info.svg +1 -0
  127. package/static/media/info_circle.svg +1 -0
  128. package/static/media/search.svg +1 -0
  129. package/static/media/success.svg +1 -0
  130. package/static/media/success_no_circle.svg +1 -0
  131. package/static/media/taro_arrow_left.svg +1 -0
  132. package/static/media/taro_home.svg +1 -0
  133. package/static/media/waiting.svg +1 -0
  134. package/static/media/warn.svg +1 -0
  135. package/types/harmony.d.ts +4 -0
  136. package/types/index.d.ts +4 -0
  137. package/types/runtime.d.ts +3 -1
  138. package/dist/runtime-ets/utils/bind.ts +0 -24
  139. /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
@@ -1,14 +1,15 @@
1
1
  import { isFunction, isString, isArray, isObject, isNull, isNumber, isUndefined, queryToJson, PLATFORM_TYPE, singleQuote, internalComponents } from '@tarojs/shared';
2
2
  import _display from '@ohos.display';
3
- import { Current, window, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, hooks } from '@tarojs/runtime';
3
+ import { Current, window, eventSource, hooks, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, getCurrentInstance } from '@tarojs/runtime';
4
4
  import { eventCenter, Events, History } from '@tarojs/runtime/dist/runtime.esm';
5
+ import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
5
6
  import deviceInfo from '@ohos.deviceInfo';
6
7
  import i18n from '@ohos.i18n';
7
- import deviceMethod from '@system.device';
8
8
  import errorManager from '@ohos.app.ability.errorManager';
9
9
  import sensor from '@ohos.sensor';
10
10
  import batteryInfo, { BatteryChargeState } from '@ohos.batteryInfo';
11
11
  import pasteboard from '@ohos.pasteboard';
12
+ import promptAction from '@ohos.promptAction';
12
13
  import inputMethodEngine from '@ohos.inputMethodEngine';
13
14
  import network from '@system.network';
14
15
  import call from '@ohos.telephony.call';
@@ -28,11 +29,9 @@ import http from '@ohos.net.http';
28
29
  import webSocket from '@ohos.net.webSocket';
29
30
  import router from '@ohos.router';
30
31
  import bundleManager from '@ohos.bundle.bundleManager';
31
- import dataPreferences from '@ohos.data.preferences';
32
- import hilog from '@ohos.hilog';
32
+ import distributedKVStore from '@ohos.data.distributedKVStore';
33
33
  import matrix4 from '@ohos.matrix4';
34
- import prompt from '@ohos.prompt';
35
- import { pxTransformHelper } from '@tarojs/taro';
34
+ import { pxTransformHelper as pxTransformHelper$1 } from '@tarojs/taro';
36
35
 
37
36
  class MethodHandler {
38
37
  constructor({ name, success, fail, complete }) {
@@ -186,7 +185,7 @@ function temporarilyNotSupport(name, recommended) {
186
185
  return (option = {}, ...args) => {
187
186
  const { success, fail, complete } = option;
188
187
  const handle = new MethodHandler({ name, success, fail, complete });
189
- let errMsg = '暂时不支持 API';
188
+ let errMsg = `暂时不支持 API ${name}`;
190
189
  if (recommended) {
191
190
  errMsg += `, 请使用 ${recommended}`;
192
191
  }
@@ -266,16 +265,63 @@ const preloadWebview = /* @__PURE__ */ temporarilyNotSupport('preloadWebview');
266
265
  const preloadSkylineView = /* @__PURE__ */ temporarilyNotSupport('preloadSkylineView');
267
266
  const preloadAssets = /* @__PURE__ */ temporarilyNotSupport('preloadAssets');
268
267
 
269
- // 设备信息,从 API Version 6 开始支持
270
- const display = _display.getDefaultDisplaySync();
271
- let device;
272
- deviceMethod.getInfo({
273
- success: data => {
274
- device = data;
275
- }
268
+ let display$1;
269
+ let navigationIndicatorRect;
270
+ let safeArea = null;
271
+ let statusBarHeight;
272
+ let windowRect;
273
+ Current.contextPromise.then((context) => {
274
+ const win = window.__ohos.getLastWindow(context);
275
+ win.then(mainWindow => {
276
+ const topRect = mainWindow.getWindowAvoidArea(window.__ohos.AvoidAreaType.TYPE_SYSTEM).topRect;
277
+ navigationIndicatorRect = mainWindow.getWindowAvoidArea(window.__ohos.AvoidAreaType.TYPE_NAVIGATION_INDICATOR).bottomRect;
278
+ statusBarHeight = topRect.top + topRect.height;
279
+ windowRect = mainWindow.getWindowProperties().windowRect;
280
+ try {
281
+ display$1 = _display.getDefaultDisplaySync();
282
+ setSafeArea({
283
+ top: statusBarHeight,
284
+ left: 0,
285
+ right: display$1.width,
286
+ bottom: navigationIndicatorRect === null || navigationIndicatorRect === void 0 ? void 0 : navigationIndicatorRect.top
287
+ });
288
+ // @ts-ignore
289
+ display$1.getCutoutInfo((err, { boundingRects = [], waterfallDisplayAreaRects = {} } = {}) => {
290
+ var _a, _b, _c, _d, _e, _f;
291
+ if (err === null || err === void 0 ? void 0 : err.code) {
292
+ console.error('Failed to get cutout info', JSON.stringify(err));
293
+ return;
294
+ }
295
+ const top = Math.max(...boundingRects.map(rect => rect.top + rect.height), ((_a = waterfallDisplayAreaRects.top) === null || _a === void 0 ? void 0 : _a.top) + ((_b = waterfallDisplayAreaRects.top) === null || _b === void 0 ? void 0 : _b.height), statusBarHeight);
296
+ const bottom = Math.min(display$1.height - ((_c = waterfallDisplayAreaRects.bottom) === null || _c === void 0 ? void 0 : _c.top), navigationIndicatorRect === null || navigationIndicatorRect === void 0 ? void 0 : navigationIndicatorRect.top);
297
+ const left = ((_d = waterfallDisplayAreaRects.left) === null || _d === void 0 ? void 0 : _d.left) + ((_e = waterfallDisplayAreaRects.left) === null || _e === void 0 ? void 0 : _e.width);
298
+ const right = display$1.width - ((_f = waterfallDisplayAreaRects.right) === null || _f === void 0 ? void 0 : _f.left);
299
+ setSafeArea({
300
+ top,
301
+ left,
302
+ right,
303
+ bottom
304
+ });
305
+ });
306
+ }
307
+ catch (e) {
308
+ console.error('Failed to get display', e);
309
+ }
310
+ });
276
311
  });
312
+ function setSafeArea({ top, left, right, bottom }) {
313
+ safeArea = {
314
+ top,
315
+ bottom,
316
+ left,
317
+ right,
318
+ height: bottom - top,
319
+ width: right - left,
320
+ };
321
+ }
277
322
  /* 同步版本 */
278
323
  const getSystemInfoSync = function () {
324
+ var _a, _b;
279
325
  const res = {};
280
326
  res.SDKVersion = deviceInfo && deviceInfo.sdkApiVersion; // 客户端基础库版本 string
281
327
  res.albumAuthorized = false; // 允许使用相册的开关(仅 iOS 有效) boolean
@@ -285,7 +331,7 @@ const getSystemInfoSync = function () {
285
331
  res.cameraAuthorized = null; // 允许使用摄像头的开关 boolean
286
332
  res.enableDebug = null; // 是否已打开调试 boolean
287
333
  res.fontSizeSetting = null; // 用户字体大小(单位px) number
288
- res.language = i18n && i18n.getSystemLanguage && i18n.getSystemLanguage(); // string
334
+ res.language = (_a = i18n === null || i18n === void 0 ? void 0 : i18n.getSystemLanguage) === null || _a === void 0 ? void 0 : _a.call(i18n); // string
289
335
  res.locationAuthorized = null; // 定位的开关 boolean
290
336
  res.locationEnabled = null; // 地理位置的系统开关 boolean
291
337
  res.microphoneAuthorized = null; // 麦克风的开关 boolean
@@ -296,17 +342,18 @@ const getSystemInfoSync = function () {
296
342
  res.notificationSoundAuthorized = false; // 通知带有声音的开关(仅 iOS 有效)boolean
297
343
  res.phoneCalendarAuthorized = null; // 使用日历的开关 boolean
298
344
  res.wifiEnabled = false; // Wi-Fi 的系统开关 boolean
299
- res.pixelRatio = null; // 设备像素比,number
300
- res.platform = 'android'; // 客户端平台 string
301
- res.safeArea = null; // 在竖屏正方向下的安全区域 General.SafeAreaResult
302
- res.screenHeight = display && display.height; // 屏幕高度,单位px number
303
- res.screenWidth = display && display.width; // 屏幕宽度,单位px number
304
- res.statusBarHeight = null; // 状态栏的高度,单位px number
305
- res.system = deviceInfo && deviceInfo.osFullName; // 操作系统及版本 string
306
- res.theme = null; // 系统当前主题,取值为light或dark 'light' | 'dark'
307
- res.windowWidth = device && device.windowWidth; // 可使用窗口宽度,单位px number
308
- res.windowHeight = device && device.windowHeight; // 可使用窗口高度,单位px number
309
- res.version = deviceInfo && deviceInfo.displayVersion; // 版本号 string
345
+ res.pixelRatio = display$1 && display$1.densityPixels; // 设备像素比,number
346
+ res.platform = 'harmony'; // 客户端平台 string
347
+ res.safeArea = safeArea; // 在竖屏正方向下的安全区域 General.SafeAreaResult
348
+ res.screenHeight = display$1 === null || display$1 === void 0 ? void 0 : display$1.height; // 屏幕高度,单位px number
349
+ res.screenWidth = display$1 === null || display$1 === void 0 ? void 0 : display$1.width; // 屏幕宽度,单位px number
350
+ res.statusBarHeight = statusBarHeight; // 状态栏的高度,单位px number
351
+ res.system = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.osFullName; // 操作系统及版本 string
352
+ // Note: 更新配置时才能记录
353
+ res.theme = ((_b = AppStorage.get('__TARO_APP_CONFIG')) === null || _b === void 0 ? void 0 : _b.colorMode) === ConfigurationConstant.ColorMode.COLOR_MODE_DARK ? 'dark' : 'light'; // 系统当前主题,取值为light或dark 'light' | 'dark'
354
+ res.windowHeight = windowRect === null || windowRect === void 0 ? void 0 : windowRect.height; // 可使用窗口高度,单位px number
355
+ res.windowWidth = windowRect === null || windowRect === void 0 ? void 0 : windowRect.width; // 可使用窗口宽度,单位px number
356
+ res.version = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.displayVersion; // 版本号 string
310
357
  return res;
311
358
  };
312
359
  /* 异步版本 */
@@ -412,7 +459,13 @@ const base64ToArrayBuffer = /* @__PURE__ */ temporarilyNotSupport('base64ToArray
412
459
  /** 创建离屏 canvas 实例 */
413
460
  const createOffscreenCanvas = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas');
414
461
  /** 创建 canvas 的绘图上下文 CanvasContext 对象 */
415
- const createCanvasContext = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas');
462
+ // export const createCanvasContext = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas')
463
+ const createCanvasContext = (canvasId) => {
464
+ const dom = eventSource.get(`canvasId-${canvasId}`);
465
+ // return dom as TaroCanvasElement
466
+ if (dom)
467
+ return dom.context;
468
+ };
416
469
  /** 把当前画布指定区域的内容导出生成指定大小的图片 */
417
470
  const canvasToTempFilePath = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas');
418
471
  /** 将像素数据绘制到画布 */
@@ -509,7 +562,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
509
562
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
510
563
  PERFORMANCE OF THIS SOFTWARE.
511
564
  ***************************************************************************** */
512
- /* global Reflect, Promise */
565
+ /* global Reflect, Promise, SuppressedError, Symbol */
513
566
 
514
567
 
515
568
  function __awaiter(thisArg, _arguments, P, generator) {
@@ -520,7 +573,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
520
573
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
521
574
  step((generator = generator.apply(thisArg, _arguments || [])).next());
522
575
  });
523
- }
576
+ }
577
+
578
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
579
+ var e = new Error(message);
580
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
581
+ };
524
582
 
525
583
  // 电量
526
584
  const getBatteryInfoSync = () => ({
@@ -528,7 +586,7 @@ const getBatteryInfoSync = () => ({
528
586
  isCharging: [BatteryChargeState.ENABLE, BatteryChargeState.FULL].includes(batteryInfo.chargingStatus),
529
587
  level: batteryInfo.batterySOC
530
588
  });
531
- const getBatteryInfo = ({ success, fail, complete } = {}) => __awaiter(void 0, void 0, void 0, function* () {
589
+ const getBatteryInfo = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* ({ success, fail, complete } = {}) {
532
590
  const handle = new MethodHandler({ name: 'getBatteryInfo', success, fail, complete });
533
591
  try {
534
592
  return handle.success(getBatteryInfoSync());
@@ -601,8 +659,20 @@ const setClipboardData = function (options) {
601
659
  }
602
660
  return new Promise((resolve, reject) => {
603
661
  const systemPasteboard = pasteboard.getSystemPasteboard();
604
- const pasteData = pasteboard.createPlainTextData(data);
605
- systemPasteboard.setPasteData(pasteData, (error, data) => {
662
+ const pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, data);
663
+ try {
664
+ systemPasteboard.setDataSync(pasteData);
665
+ promptAction.showToast({
666
+ message: '内容已复制',
667
+ duration: 1500,
668
+ bottom: '50%',
669
+ showMode: 1 // 设置弹窗显示模式,显示在应用之上。
670
+ });
671
+ return handle.success({
672
+ data,
673
+ }, { resolve, reject });
674
+ }
675
+ catch (error) {
606
676
  if (error) {
607
677
  console.error('Failed to set PasteData. Cause: ' + JSON.stringify(error));
608
678
  res = {
@@ -611,12 +681,7 @@ const setClipboardData = function (options) {
611
681
  };
612
682
  callAsyncFail(reject, res, options);
613
683
  }
614
- else {
615
- return handle.success({
616
- data,
617
- }, { resolve, reject });
618
- }
619
- });
684
+ }
620
685
  });
621
686
  };
622
687
  /**
@@ -627,7 +692,7 @@ const getClipboardData = function (options) {
627
692
  const handle = new MethodHandler({ name: 'getClipboardData', success, fail, complete });
628
693
  return new Promise((resolve, reject) => {
629
694
  const systemPasteboard = pasteboard.getSystemPasteboard();
630
- systemPasteboard.getPasteData((error, pasteData) => {
695
+ systemPasteboard.getData((error, pasteData) => {
631
696
  if (error) {
632
697
  console.error('Failed to obtain PasteData. Cause: ' + JSON.stringify(error));
633
698
  return handle.fail({
@@ -731,8 +796,14 @@ const hideKeyboard = function (options) {
731
796
  };
732
797
  const getSelectedTextRange = /* @__PURE__ */ temporarilyNotSupport('getSelectedTextRange');
733
798
 
734
- const onMemoryWarning = temporarilyNotSupport('onMemoryWarning');
735
- const offMemoryWarning = temporarilyNotSupport('offMemoryWarning');
799
+ const onMemoryWarning = (listener) => {
800
+ hooks.tap('getMemoryLevel', (res) => {
801
+ listener(res);
802
+ });
803
+ };
804
+ const offMemoryWarning = (listener) => {
805
+ hooks.off('getMemoryLevel', listener);
806
+ };
736
807
 
737
808
  const stopDeviceMotionListening = temporarilyNotSupport('stopDeviceMotionListening');
738
809
  const startDeviceMotionListening = temporarilyNotSupport('startDeviceMotionListening');
@@ -760,7 +831,7 @@ const getNetworkType = (options = {}) => {
760
831
  });
761
832
  };
762
833
  const networkStatusManager = new CallbackManager();
763
- const networkStatusListener = (data, code = 0) => __awaiter(void 0, void 0, void 0, function* () {
834
+ const networkStatusListener = (data_1, ...args_1) => __awaiter(void 0, [data_1, ...args_1], void 0, function* (data, code = 0) {
764
835
  if (code > 0) {
765
836
  return networkStatusManager.trigger({ isConnected: false, networkType: 'none' });
766
837
  }
@@ -1973,7 +2044,6 @@ function getEnv() {
1973
2044
  }
1974
2045
  // TODO
1975
2046
  const getCurrentPages = () => [];
1976
- const getCurrentInstance = () => Current;
1977
2047
  const requirePlugin$1 = temporarilyNotSupport('requirePlugin');
1978
2048
 
1979
2049
  // @ts-nocheck
@@ -2003,7 +2073,7 @@ function formatLocation(location) {
2003
2073
  altitude: location.altitude,
2004
2074
  accuracy: location.accuracy,
2005
2075
  speed: location.speed,
2006
- verticalAccuracy: 0,
2076
+ verticalAccuracy: 0, // OHOS 不支持返回此参数,直接设置为默认值
2007
2077
  horizontalAccuracy: 0 // OHOS 不支持返回此参数,直接设置为默认值
2008
2078
  };
2009
2079
  return wxLocate;
@@ -2282,7 +2352,7 @@ const chooseImage = function (options) {
2282
2352
  photoSelectOptions.maxSelectNumber = count; // 选择媒体文件的最大数目
2283
2353
  photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型为IMAGE
2284
2354
  photoViewPicker.select(photoSelectOptions).then((photoSelectResult) => {
2285
- callAsyncSuccess(resolve, { tempFilePaths: photoSelectResult.photoUris });
2355
+ callAsyncSuccess(resolve, { tempFilePaths: photoSelectResult.photoUris }, options);
2286
2356
  }).catch((error) => {
2287
2357
  callAsyncFail(reject, error, options);
2288
2358
  });
@@ -2306,21 +2376,51 @@ const stopRecord = /* @__PURE__ */ temporarilyNotSupport('stopRecord');
2306
2376
  const startRecord = /* @__PURE__ */ temporarilyNotSupport('startRecord');
2307
2377
  const getRecorderManager = /* @__PURE__ */ temporarilyNotSupport('getRecorderManager');
2308
2378
 
2379
+ // @ts-nocheck
2309
2380
  class VideoContext {
2310
- constructor() {
2381
+ constructor(id) {
2382
+ this.requestBackgroundPlayback = temporarilyNotSupport('VideoContext.requestBackgroundPlayback');
2311
2383
  this.exitBackgroundPlayback = temporarilyNotSupport('VideoContext.exitBackgroundPlayback');
2312
- this.exitFullScreen = temporarilyNotSupport('VideoContext.exitFullScreen');
2313
2384
  this.exitPictureInPicture = temporarilyNotSupport('VideoContext.exitPictureInPicture');
2314
2385
  this.hideStatusBar = temporarilyNotSupport('VideoContext.hideStatusBar');
2315
- this.pause = temporarilyNotSupport('VideoContext.pause');
2316
- this.play = temporarilyNotSupport('VideoContext.play');
2317
2386
  this.playbackRate = temporarilyNotSupport('VideoContext.playbackRate');
2318
- this.requestBackgroundPlayback = temporarilyNotSupport('VideoContext.requestBackgroundPlayback');
2319
- this.requestFullScreen = temporarilyNotSupport('VideoContext.requestFullScreen');
2320
- this.seek = temporarilyNotSupport('VideoContext.seek');
2321
2387
  this.sendDanmu = temporarilyNotSupport('VideoContext.sendDanmu');
2322
2388
  this.showStatusBar = temporarilyNotSupport('VideoContext.showStatusBar');
2323
- this.stop = temporarilyNotSupport('VideoContext.stop');
2389
+ this.id = id;
2390
+ this.video = document$1.getElementById(id);
2391
+ if (this.video) {
2392
+ this.controller = this.video.controller;
2393
+ }
2394
+ }
2395
+ play() {
2396
+ if (!this.controller)
2397
+ return;
2398
+ this.controller.play();
2399
+ }
2400
+ pause() {
2401
+ if (!this.controller)
2402
+ return;
2403
+ this.controller.pause();
2404
+ }
2405
+ stop() {
2406
+ if (!this.controller)
2407
+ return;
2408
+ this.controller.stop();
2409
+ }
2410
+ seek(position) {
2411
+ if (!this.controller)
2412
+ return;
2413
+ this.controller.setCurrentTime(position);
2414
+ }
2415
+ requestFullScreen() {
2416
+ if (!this.controller)
2417
+ return;
2418
+ this.controller.requestFullscreen(true);
2419
+ }
2420
+ exitFullScreen() {
2421
+ if (!this.controller)
2422
+ return;
2423
+ this.controller.exitFullscreen();
2324
2424
  }
2325
2425
  }
2326
2426
 
@@ -2349,8 +2449,8 @@ class VideoContext {
2349
2449
  const saveVideoToPhotosAlbumSchema = {
2350
2450
  filePath: 'String'
2351
2451
  };
2352
- const createVideoContext = () => {
2353
- return new VideoContext();
2452
+ const createVideoContext = (id, _) => {
2453
+ return new VideoContext(id);
2354
2454
  };
2355
2455
  // TODO: 1.返回属性补全
2356
2456
  // TODO: 2.只支持从相册选择,补充摄像头拍摄功能,需要HarmonyOS提供选择组件
@@ -2570,10 +2670,10 @@ const request = function (options) {
2570
2670
  header['Content-Type'] = 'application/json';
2571
2671
  }
2572
2672
  // 检查 Header 是否有 Referer
2573
- if (isUndefined(header.Referer)) {
2574
- const error = { errMsg: 'request fail parameter error: the header doesn‘t support Referer property' };
2575
- callAsyncFail(reject, error, options);
2576
- }
2673
+ // if (isUndefined(header.Referer)) {
2674
+ // const error = { errMsg: 'request fail parameter error: the header doesn‘t support Referer property' }
2675
+ // callAsyncFail(reject, error, options)
2676
+ // }
2577
2677
  // 检查 method 是否正确
2578
2678
  if (method) {
2579
2679
  if (!METHOD.includes(method)) {
@@ -3019,6 +3119,19 @@ function parseURL(raw = '') {
3019
3119
  const [urlStr, queryStr = ''] = raw.split('?');
3020
3120
  const query = queryToJson(queryStr);
3021
3121
  let url = urlStr.replace(/^\//, '');
3122
+ // 处理相对路径
3123
+ if (url.indexOf('.') === 0) {
3124
+ const page = router.getState();
3125
+ const parts = page.path.split('/');
3126
+ parts.pop();
3127
+ url.split('/').forEach((item) => {
3128
+ if (item === '.') {
3129
+ return;
3130
+ }
3131
+ item === '..' ? parts.pop() : parts.push(item);
3132
+ });
3133
+ url = parts.join('/');
3134
+ }
3022
3135
  if (isTabPage(url)) {
3023
3136
  query.$page = url;
3024
3137
  url = TARO_TABBAR_PAGE_PATH;
@@ -3136,113 +3249,172 @@ const getBackgroundFetchData = /* @__PURE__ */ temporarilyNotSupport('getBackgro
3136
3249
  // 周期性更新
3137
3250
  const createCacheManager = /* @__PURE__ */ temporarilyNotSupport('createCacheManager');
3138
3251
 
3139
- const preferencesPromise = Current.contextPromise
3140
- .then((context) => {
3141
- return bundleManager
3142
- .getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
3143
- .then(data => {
3144
- return dataPreferences
3145
- .getPreferences(context, `${data.appInfo.uid}Store`);
3146
- });
3147
- })
3148
- .catch((error) => {
3149
- hilog.error(0x0000, 'TaroFailedTag', 'Failed to load the storage. Cause: %{public}s', error.code ? JSON.stringify(error) : error.message || error);
3252
+ /**
3253
+ * 从API Version 6开始,该模块不再维护,可以使用模块@ohos.data.storage。在API Version 9后,推荐使用新模块@ohos.data.preferences。
3254
+ * https://developer.harmonyos.com/cn/docs/documentation/doc-references-V3/js-apis-data-preferences-0000001427745052-V3
3255
+ */
3256
+ let context;
3257
+ let kvManager;
3258
+ let kvStore;
3259
+ let kvStorePromise;
3260
+ Current.contextPromise.then((ctx) => {
3261
+ context = ctx;
3262
+ const kvManagerConfig = {
3263
+ context: context,
3264
+ bundleName: 'com.example.taro'
3265
+ };
3266
+ try {
3267
+ // 创建KVManager实例
3268
+ kvManager = distributedKVStore.createKVManager(kvManagerConfig);
3269
+ // 继续创建获取数据库
3270
+ const options = {
3271
+ createIfMissing: true,
3272
+ encrypt: false,
3273
+ backup: false,
3274
+ autoSync: false,
3275
+ // kvStoreType不填时,默认创建多设备协同数据库
3276
+ kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION,
3277
+ // 多设备协同数据库:kvStoreType: distributedKVStore.KVStoreType.DEVICE_COLLABORATION,
3278
+ securityLevel: distributedKVStore.SecurityLevel.S1
3279
+ };
3280
+ const data = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
3281
+ kvStorePromise = new Promise(resolve => {
3282
+ kvManager.getKVStore(`${data.appInfo.uid}Store`, options, (err, store) => {
3283
+ if (err) {
3284
+ console.error(`Failed to get KVStore: Code:${err.code},message:${err.message}`);
3285
+ return;
3286
+ }
3287
+ kvStore = store;
3288
+ // 请确保获取到键值数据库实例后,再进行相关数据操作
3289
+ resolve();
3290
+ });
3291
+ });
3292
+ }
3293
+ catch (e) {
3294
+ console.error(`Failed to create KVManager. Code:${e.code},message:${e.message}`);
3295
+ }
3296
+ return context;
3150
3297
  });
3151
- function getItem(key) {
3152
- return __awaiter(this, void 0, void 0, function* () {
3153
- try {
3154
- const preferences = yield preferencesPromise;
3155
- const item = yield preferences.get(key, null);
3156
- return { result: true, data: item };
3157
- }
3158
- catch (error) {
3159
- return { result: false };
3160
- }
3161
- });
3162
- }
3163
3298
  const storageSchema = {
3164
3299
  key: 'String'
3165
3300
  };
3166
- function getStorage(options) {
3167
- return new Promise((resolve, reject) => {
3168
- try {
3169
- validateParams('getStorage', options, storageSchema);
3301
+ function checkContextExist(api, isAsync = false) {
3302
+ if (!context) {
3303
+ const message = `${api} 调用失败,Taro 不支持过早地调用 ${api},请确保页面已经渲染完成再调用此 API`;
3304
+ if (isAsync) {
3305
+ return {
3306
+ isExist: false,
3307
+ error: Promise.reject(new Error(message))
3308
+ };
3170
3309
  }
3171
- catch (error) {
3172
- const res = { errMsg: error.message };
3173
- return callAsyncFail(reject, res, options);
3310
+ else {
3311
+ console.warn(message);
3312
+ return {
3313
+ isExist: false,
3314
+ };
3174
3315
  }
3175
- getItem(options.key).then(({ result, data }) => {
3176
- const res = { errMsg: 'getStorage:ok' };
3177
- if (result) {
3178
- res.data = data;
3179
- callAsyncSuccess(resolve, res, options);
3316
+ }
3317
+ return {
3318
+ isExist: true,
3319
+ };
3320
+ }
3321
+ function getStorage(options) {
3322
+ const name = 'getStorage';
3323
+ const { isExist, error } = checkContextExist(name, true);
3324
+ if (!isExist) {
3325
+ return error;
3326
+ }
3327
+ const { key, success, fail, complete } = options || {};
3328
+ const handle = new MethodHandler({ name, success, fail, complete });
3329
+ return new Promise((resolve, reject) => {
3330
+ kvStorePromise.then(() => {
3331
+ try {
3332
+ validateParams(name, options, storageSchema);
3180
3333
  }
3181
- else {
3182
- res.errMsg = 'getStorage:fail data not found';
3183
- callAsyncFail(reject, res, options);
3334
+ catch (error) {
3335
+ const res = { errMsg: error.message };
3336
+ return handle.fail(res, { resolve, reject });
3184
3337
  }
3338
+ kvStore = kvStore;
3339
+ kvStore.get(key, (err, data) => {
3340
+ if (err) {
3341
+ handle.fail({ errMsg: `Failed to get data. Code:${err.code},message:${err.message}` }, { resolve, reject });
3342
+ return;
3343
+ }
3344
+ handle.success({ data }, { resolve, reject });
3345
+ });
3185
3346
  });
3186
3347
  });
3187
3348
  }
3188
3349
  function setStorage(options) {
3350
+ const name = 'setStorage';
3351
+ const { isExist, error } = checkContextExist(name, true);
3352
+ if (!isExist) {
3353
+ return error;
3354
+ }
3355
+ const { key, data, success, fail, complete } = options || {};
3356
+ const handle = new MethodHandler({ name, success, fail, complete });
3189
3357
  return new Promise((resolve, reject) => {
3190
- try {
3191
- validateParams('setStorage', options, storageSchema);
3192
- }
3193
- catch (error) {
3194
- const res = { errMsg: error.message };
3195
- return callAsyncFail(reject, res, options);
3196
- }
3197
- const { key, data } = options;
3198
- const res = { errMsg: 'setStorage:ok' };
3199
- preferencesPromise.then((preferences) => __awaiter(this, void 0, void 0, function* () {
3200
- yield preferences.put(key, data);
3201
- yield preferences.flush();
3202
- callAsyncSuccess(resolve, res, options);
3203
- }));
3358
+ kvStorePromise.then(() => {
3359
+ try {
3360
+ validateParams(name, options, storageSchema);
3361
+ }
3362
+ catch (error) {
3363
+ const res = { errMsg: error.message };
3364
+ return handle.fail(res, { resolve, reject });
3365
+ }
3366
+ kvStore = kvStore;
3367
+ kvStore.put(key, data, (err) => {
3368
+ if (err) {
3369
+ handle.fail({ errMsg: `Failed to put data. Code:${err.code},message:${err.message}` }, { resolve, reject });
3370
+ return;
3371
+ }
3372
+ handle.success({}, { resolve, reject });
3373
+ });
3374
+ });
3204
3375
  });
3205
3376
  }
3206
3377
  function removeStorage(options) {
3378
+ const name = 'removeStorage';
3379
+ const { isExist, error } = checkContextExist(name, true);
3380
+ if (!isExist) {
3381
+ return error;
3382
+ }
3383
+ const { key, success, fail, complete } = options || {};
3384
+ const handle = new MethodHandler({ name, success, fail, complete });
3207
3385
  return new Promise((resolve, reject) => {
3208
- try {
3209
- validateParams('removeStorage', options, storageSchema);
3210
- }
3211
- catch (error) {
3212
- const res = { errMsg: error.message };
3213
- return callAsyncFail(reject, res, options);
3214
- }
3215
- const { key } = options;
3216
- preferencesPromise.then((preferences) => __awaiter(this, void 0, void 0, function* () {
3217
- yield preferences.delete(key);
3218
- yield preferences.flush();
3219
- const res = { errMsg: 'removeStorage:ok' };
3220
- callAsyncSuccess(resolve, res, options);
3221
- }));
3222
- });
3223
- }
3224
- function clearStorage(options) {
3225
- return new Promise(resolve => {
3226
- preferencesPromise.then((preferences) => __awaiter(this, void 0, void 0, function* () {
3227
- yield preferences.clear();
3228
- yield preferences.flush();
3229
- const res = { errMsg: 'clearStorage:ok' };
3230
- callAsyncSuccess(resolve, res, options);
3231
- }));
3386
+ kvStorePromise.then(() => {
3387
+ try {
3388
+ validateParams(name, options, storageSchema);
3389
+ }
3390
+ catch (error) {
3391
+ const res = { errMsg: error.message };
3392
+ return handle.fail(res, { resolve, reject });
3393
+ }
3394
+ kvStore = kvStore;
3395
+ kvStore.delete(key, (err) => {
3396
+ if (err) {
3397
+ handle.fail({ errMsg: `Failed to delete data. Code:${err.code},message:${err.message}` }, { resolve, reject });
3398
+ return;
3399
+ }
3400
+ handle.success({}, { resolve, reject });
3401
+ });
3402
+ });
3232
3403
  });
3233
3404
  }
3234
3405
  const getStorageInfoSync = temporarilyNotSupport('getStorageInfoSync');
3235
3406
  const getStorageInfo = temporarilyNotSupport('getStorageInfo');
3236
- const getStorageSync = temporarilyNotSupport('getStorageSync', 'getStorage');
3237
- const setStorageSync = temporarilyNotSupport('setStorageSync', 'setStorage');
3238
- const clearStorageSync = temporarilyNotSupport('clearStorageSync', 'clearStorage');
3239
- const removeStorageSync = temporarilyNotSupport('removeStorageSync', 'removeStorage');
3240
3407
  const createBufferURL = /* @__PURE__ */ temporarilyNotSupport('createBufferURL');
3241
3408
  const revokeBufferURL = /* @__PURE__ */ temporarilyNotSupport('revokeBufferURL');
3242
3409
  const batchSetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchSetStorageSync');
3243
3410
  const batchSetStorage = /* @__PURE__ */ temporarilyNotSupport('batchSetStorage');
3244
3411
  const batchGetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchGetStorageSync');
3245
3412
  const batchGetStorage = /* @__PURE__ */ temporarilyNotSupport('batchGetStorage');
3413
+ const clearStorage = temporarilyNotSupport('clearStorage');
3414
+ const getStorageSync = temporarilyNotSupport('getStorageSync', 'getStorage');
3415
+ const setStorageSync = temporarilyNotSupport('setStorageSync', 'setStorage');
3416
+ const clearStorageSync = temporarilyNotSupport('clearStorageSync', 'clearStorage');
3417
+ const removeStorageSync = temporarilyNotSupport('removeStorageSync', 'removeStorage');
3246
3418
 
3247
3419
  class Animation {
3248
3420
  constructor({ duration = 400, delay = 0, timingFunction = 'linear', transformOrigin = '50% 50% 0', unit = 'px' } = {}) {
@@ -3275,6 +3447,9 @@ class Animation {
3275
3447
  transformOrigin,
3276
3448
  rule: Object.assign({}, this.rule)
3277
3449
  });
3450
+ if (this.rule.transform) {
3451
+ this.rule.transform = Object.assign({}, this.rule.transform);
3452
+ }
3278
3453
  return this;
3279
3454
  }
3280
3455
  matrix(a, b, c, d, tx, ty) {
@@ -3286,75 +3461,120 @@ class Animation {
3286
3461
  return this;
3287
3462
  }
3288
3463
  rotate(angle) {
3289
- this.rule.rotate = { x: 0, y: 0, z: 1, angle };
3464
+ if (!this.rule.transform) {
3465
+ this.rule.transform = {};
3466
+ }
3467
+ this.rule.transform.Rotate = { x: 0, y: 0, z: 1, angle };
3290
3468
  return this;
3291
3469
  }
3292
3470
  rotate3d(x, y, z, angle) {
3293
- this.rule.rotate = { x, y, z, angle };
3471
+ if (!this.rule.transform) {
3472
+ this.rule.transform = {};
3473
+ }
3474
+ this.rule.transform.Rotate = { x, y, z, angle };
3294
3475
  return this;
3295
3476
  }
3296
3477
  rotateX(angle) {
3297
- this.rule.rotate = { x: 1, y: 0, z: 0, angle };
3478
+ if (!this.rule.transform) {
3479
+ this.rule.transform = {};
3480
+ }
3481
+ this.rule.transform.Rotate = { x: 1, y: 0, z: 0, angle };
3298
3482
  return this;
3299
3483
  }
3300
3484
  rotateY(angle) {
3301
- this.rule.rotate = { x: 0, y: 1, z: 0, angle };
3485
+ if (!this.rule.transform) {
3486
+ this.rule.transform = {};
3487
+ }
3488
+ this.rule.transform.Rotate = { x: 0, y: 1, z: 0, angle };
3302
3489
  return this;
3303
3490
  }
3304
3491
  rotateZ(angle) {
3305
- this.rule.rotate = { x: 0, y: 0, z: 1, angle };
3492
+ if (!this.rule.transform) {
3493
+ this.rule.transform = {};
3494
+ }
3495
+ this.rule.transform.Rotate = { x: 0, y: 0, z: 1, angle };
3306
3496
  return this;
3307
3497
  }
3308
3498
  scale(sx, sy) {
3309
- this.rule.scale = { x: sx, y: sy };
3499
+ if (!this.rule.transform) {
3500
+ this.rule.transform = {};
3501
+ }
3502
+ this.rule.transform.Scale = { x: sx, y: isUndefined(sy) ? sx : sy };
3310
3503
  return this;
3311
3504
  }
3312
3505
  scale3d(sx, sy, sz) {
3313
- this.rule.scale = { x: sx, y: sy, z: sz };
3506
+ if (!this.rule.transform) {
3507
+ this.rule.transform = {};
3508
+ }
3509
+ this.rule.transform.Scale = { x: sx, y: sy, z: sz };
3314
3510
  return this;
3315
3511
  }
3316
3512
  scaleX(scale) {
3317
- this.rule.scale = { x: scale };
3513
+ if (!this.rule.transform) {
3514
+ this.rule.transform = {};
3515
+ }
3516
+ this.rule.transform.Scale = { x: scale };
3318
3517
  return this;
3319
3518
  }
3320
3519
  scaleY(scale) {
3321
- this.rule.scale = { y: scale };
3520
+ if (!this.rule.transform) {
3521
+ this.rule.transform = {};
3522
+ }
3523
+ this.rule.transform.Scale = { y: scale };
3322
3524
  return this;
3323
3525
  }
3324
3526
  scaleZ(scale) {
3325
- this.rule.scale = { z: scale };
3527
+ if (!this.rule.transform) {
3528
+ this.rule.transform = {};
3529
+ }
3530
+ this.rule.transform.Scale = { z: scale };
3326
3531
  return this;
3327
3532
  }
3328
3533
  skew(ax, ay) {
3329
- this.rule.skew = { x: ax, y: ay };
3534
+ temporarilyNotSupport('animation.skew:' + `${ax}, ${ay}`)(ax, ay);
3330
3535
  return this;
3331
3536
  }
3332
3537
  skewX(angle) {
3333
- this.rule.skew = { x: angle };
3538
+ temporarilyNotSupport('animation.skewX:' + angle)(angle);
3334
3539
  return this;
3335
3540
  }
3336
3541
  skewY(angle) {
3337
- this.rule.skew = { y: angle };
3542
+ temporarilyNotSupport('animation.skewY:' + angle)(angle);
3338
3543
  return this;
3339
3544
  }
3340
3545
  translate(tx, ty) {
3341
- this.rule.translate = { x: tx, y: ty };
3546
+ if (!this.rule.transform) {
3547
+ this.rule.transform = {};
3548
+ }
3549
+ this.rule.transform.Translate = { x: tx, y: ty };
3342
3550
  return this;
3343
3551
  }
3344
3552
  translate3d(tx, ty, tz) {
3345
- this.rule.translate = { x: tx, y: ty, z: tz };
3553
+ if (!this.rule.transform) {
3554
+ this.rule.transform = {};
3555
+ }
3556
+ this.rule.transform.Translate = { x: tx, y: ty, z: tz };
3346
3557
  return this;
3347
3558
  }
3348
3559
  translateX(translation) {
3349
- this.rule.translate = { x: translation };
3560
+ if (!this.rule.transform) {
3561
+ this.rule.transform = {};
3562
+ }
3563
+ this.rule.transform.Translate = { x: translation };
3350
3564
  return this;
3351
3565
  }
3352
3566
  translateY(translation) {
3353
- this.rule.translate = { y: translation };
3567
+ if (!this.rule.transform) {
3568
+ this.rule.transform = {};
3569
+ }
3570
+ this.rule.transform.Translate = { y: translation };
3354
3571
  return this;
3355
3572
  }
3356
3573
  translateZ(translation) {
3357
- this.rule.translate = { z: translation };
3574
+ if (!this.rule.transform) {
3575
+ this.rule.transform = {};
3576
+ }
3577
+ this.rule.transform.Translate = { z: translation };
3358
3578
  return this;
3359
3579
  }
3360
3580
  opacity(value) {
@@ -3366,15 +3586,15 @@ class Animation {
3366
3586
  return this;
3367
3587
  }
3368
3588
  width(value) {
3369
- this.rule.size = Object.assign(Object.assign({}, this.rule.size), { width: value });
3589
+ this.rule.width = value;
3370
3590
  return this;
3371
3591
  }
3372
3592
  height(value) {
3373
- this.rule.size = Object.assign(Object.assign({}, this.rule.size), { height: value });
3593
+ this.rule.height = value;
3374
3594
  return this;
3375
3595
  }
3376
3596
  left(value) {
3377
- temporarilyNotSupport('animation.left:' + value)(value);
3597
+ this.rule.left = value;
3378
3598
  return this;
3379
3599
  }
3380
3600
  right(value) {
@@ -3382,7 +3602,7 @@ class Animation {
3382
3602
  return this;
3383
3603
  }
3384
3604
  top(value) {
3385
- temporarilyNotSupport('animation.top:' + value)(value);
3605
+ this.rule.top = value;
3386
3606
  return this;
3387
3607
  }
3388
3608
  bottom(value) {
@@ -3401,7 +3621,8 @@ function setBackgroundColor(options) {
3401
3621
  const handle = new MethodHandler({ name: 'setBackgroundColor', success, fail, complete });
3402
3622
  return new Promise((resolve, reject) => {
3403
3623
  eventCenter.trigger('__taroPageStyle', {
3404
- backgroundColor: options.backgroundColor || options.backgroundColorTop || options.backgroundColorBottom,
3624
+ backgroundColor: options.backgroundColorBottom || options.backgroundColor,
3625
+ backgroundColorContext: options.backgroundColorTop || options.backgroundColor
3405
3626
  });
3406
3627
  return handle.success({}, { resolve, reject });
3407
3628
  });
@@ -3440,10 +3661,11 @@ function showToast(options) {
3440
3661
  const res = { errMsg: error.message };
3441
3662
  return callAsyncFail(reject, res, options);
3442
3663
  }
3443
- prompt.showToast({
3664
+ promptAction.showToast({
3444
3665
  message: options.title,
3445
3666
  duration: options.duration,
3446
- bottom: options.bottom
3667
+ bottom: options.bottom,
3668
+ showMode: 1 // 设置弹窗显示模式,显示在应用之上。
3447
3669
  });
3448
3670
  callAsyncSuccess(resolve, resCallback('showToast'), options);
3449
3671
  });
@@ -3473,25 +3695,24 @@ function showModal(options) {
3473
3695
  color: confirmColor
3474
3696
  });
3475
3697
  }
3476
- return new Promise(resolve => {
3698
+ return new Promise((resolve, reject) => {
3477
3699
  const modalOptions = {
3478
3700
  title,
3479
3701
  message: content,
3480
3702
  buttons: buttons,
3481
- success: (data) => {
3482
- if (data.index === 1 || !showCancel) {
3483
- callAsyncSuccess(resolve, Object.assign(Object.assign({}, resCallback('showModal')), { confirm: true, cancel: false, content: null }), options);
3484
- }
3485
- else {
3486
- callAsyncSuccess(resolve, Object.assign(Object.assign({}, resCallback('showModal')), { confirm: false, cancel: true }), options);
3487
- }
3488
- },
3489
- // 鸿蒙没有失败方法,只有取消
3490
- cancel: (_) => {
3703
+ };
3704
+ promptAction.showDialog(modalOptions, (error, data) => {
3705
+ if (error) {
3706
+ const res = { errMsg: error };
3707
+ callAsyncFail(reject, res, options);
3708
+ }
3709
+ if (data.index === 0 && showCancel) {
3491
3710
  callAsyncSuccess(resolve, Object.assign(Object.assign({}, resCallback('showModal')), { confirm: false, cancel: true }), options);
3492
3711
  }
3493
- };
3494
- prompt.showDialog(modalOptions);
3712
+ else {
3713
+ callAsyncSuccess(resolve, Object.assign(Object.assign({}, resCallback('showModal')), { confirm: true, cancel: false, content: null }), options);
3714
+ }
3715
+ });
3495
3716
  });
3496
3717
  }
3497
3718
  const showActionSheetSchema = {
@@ -3522,28 +3743,18 @@ function showActionSheet(options) {
3522
3743
  });
3523
3744
  const actionSheetOptions = {
3524
3745
  title,
3525
- buttons,
3526
- success: (data) => {
3527
- callAsyncSuccess(resolve, Object.assign(Object.assign({}, data), resCallback('showActionSheet')), options);
3528
- },
3529
- // 取消方法,并非失败
3530
- fail: (data) => {
3531
- callAsyncFail(reject, Object.assign(Object.assign({}, data), { errMsg: data.errMsg.replace('showActionMenu', 'showActionSheet') }), options);
3532
- }
3746
+ buttons
3533
3747
  };
3534
- prompt.showActionMenu(actionSheetOptions);
3535
- });
3536
- }
3537
- function hideToast(options) {
3538
- return new Promise(resolve => {
3539
- prompt.showToast({
3540
- message: '关闭中',
3541
- duration: 10,
3542
- bottom: '9999px'
3748
+ promptAction.showActionMenu(actionSheetOptions, (error, data) => {
3749
+ var _a;
3750
+ if (error) {
3751
+ callAsyncFail(reject, Object.assign(Object.assign({}, data), { errMsg: (_a = data.errMsg) === null || _a === void 0 ? void 0 : _a.replace('showActionMenu', 'showActionSheet') }), options);
3752
+ }
3753
+ callAsyncSuccess(resolve, Object.assign(Object.assign({}, data), resCallback('showActionSheet')), options);
3543
3754
  });
3544
- callAsyncSuccess(resolve, resCallback('hideToast'), options);
3545
3755
  });
3546
3756
  }
3757
+ const hideToast = /* @__PURE__ */ temporarilyNotSupport('hideToast');
3547
3758
  const showLoading = temporarilyNotSupport('showLoading');
3548
3759
  const hideLoading = temporarilyNotSupport('hideLoading');
3549
3760
  const enableAlertBeforeUnload = /* @__PURE__ */ temporarilyNotSupport('enableAlertBeforeUnload');
@@ -3564,7 +3775,7 @@ const setNavigationBarTitle = function (options) {
3564
3775
  };
3565
3776
  const setNavigationBarColor = function (options) {
3566
3777
  const { success, fail, complete } = options || {};
3567
- const handle = new MethodHandler({ name: 'setNavigationBarTitle', success, fail, complete });
3778
+ const handle = new MethodHandler({ name: 'setNavigationBarColor', success, fail, complete });
3568
3779
  return new Promise((resolve, reject) => {
3569
3780
  eventCenter.trigger('__taroNavigationStyle', {
3570
3781
  animation: options.animation,
@@ -3606,10 +3817,13 @@ const hideHomeButton = function (options) {
3606
3817
  };
3607
3818
 
3608
3819
  const startPullDownRefresh = function (options) {
3609
- return new Promise(resolve => {
3820
+ return new Promise((resolve, reject) => {
3610
3821
  var _a;
3611
3822
  const taro = Current.taro;
3612
3823
  const page = taro.getCurrentInstance().page;
3824
+ if (!page) {
3825
+ return callAsyncFail(reject, { errMsg: 'stopPullDownRefresh:fail' }, options);
3826
+ }
3613
3827
  if (page.isRefreshing instanceof Array) {
3614
3828
  const index = page.tabBarCurrentIndex || 0;
3615
3829
  page.isRefreshing[index] = true;
@@ -3623,10 +3837,13 @@ const startPullDownRefresh = function (options) {
3623
3837
  });
3624
3838
  };
3625
3839
  const stopPullDownRefresh = function (options) {
3626
- return new Promise(resolve => {
3840
+ return new Promise((resolve, reject) => {
3627
3841
  var _a;
3628
3842
  const taro = Current.taro;
3629
3843
  const page = taro.getCurrentInstance().page;
3844
+ if (!page) {
3845
+ return callAsyncFail(reject, { errMsg: 'stopPullDownRefresh:fail' }, options);
3846
+ }
3630
3847
  if (page.isRefreshing instanceof Array) {
3631
3848
  const index = page.tabBarCurrentIndex || 0;
3632
3849
  page.isRefreshing[index] = false;
@@ -3659,8 +3876,8 @@ const pageScrollTo = (options) => {
3659
3876
  const taro = Current.taro;
3660
3877
  const page = taro.getCurrentInstance().page;
3661
3878
  let scrollValue = -1;
3662
- let scroller = page.scroller;
3663
- const currentPageNode = getPageScrollerOrNode(page.node, page);
3879
+ let scroller = getPageScrollerOrNode(page === null || page === void 0 ? void 0 : page.scroller, page);
3880
+ const currentPageNode = getPageScrollerOrNode(page === null || page === void 0 ? void 0 : page.node, page);
3664
3881
  if (scrollTop || typeof scrollTop === 'number') {
3665
3882
  scrollValue = scrollTop;
3666
3883
  }
@@ -3682,15 +3899,15 @@ const pageScrollTo = (options) => {
3682
3899
  scroller = getPageScrollerOrNode(scroller, page);
3683
3900
  const { yOffset } = scroller.currentOffset();
3684
3901
  if (areaInfo) {
3685
- scrollValue = areaInfo.globalPosition.y + yOffset + pxTransformHelper(offsetTop, 'px', true);
3902
+ scrollValue = areaInfo.globalPosition.y + yOffset + pxTransformHelper$1(offsetTop, 'px', true);
3686
3903
  }
3687
3904
  }
3688
- const { xOffset } = scroller.currentOffset();
3689
- if (scrollValue === -1) {
3905
+ if (!scroller || scrollValue === -1) {
3690
3906
  return handle.fail({
3691
3907
  errMsg: '请检查传入的 scrollTop 或 selector 是否合法'
3692
3908
  }, { resolve, reject });
3693
3909
  }
3910
+ const { xOffset } = scroller.currentOffset();
3694
3911
  try {
3695
3912
  scroller.scrollTo({
3696
3913
  xOffset,
@@ -3722,7 +3939,7 @@ const toggleTabBar = function (type) {
3722
3939
  var _a, _b;
3723
3940
  const taro = Current.taro;
3724
3941
  const page = taro.getCurrentInstance().page;
3725
- const currentData = ((_a = page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || page.tabBar;
3942
+ const currentData = ((_a = page === null || page === void 0 ? void 0 : page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || (page === null || page === void 0 ? void 0 : page.tabBar);
3726
3943
  const res = { errMsg: `${type}TabBar:ok` };
3727
3944
  const error = { errMsg: `${type}TabBar:fail not TabBar page` };
3728
3945
  if (!currentData) {
@@ -3747,7 +3964,7 @@ const setTabBarStyle = function (options = {}) {
3747
3964
  var _a, _b;
3748
3965
  const taro = Current.taro;
3749
3966
  const page = taro.getCurrentInstance().page;
3750
- const currentData = ((_a = page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || page.tabBar;
3967
+ const currentData = ((_a = page === null || page === void 0 ? void 0 : page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || (page === null || page === void 0 ? void 0 : page.tabBar);
3751
3968
  const res = { errMsg: 'setTabBarStyle:ok' };
3752
3969
  const error = { errMsg: 'setTabBarStyle:fail not TabBar page' };
3753
3970
  if (!currentData) {
@@ -3774,7 +3991,7 @@ const setTabBarItem = function (options) {
3774
3991
  var _a, _b;
3775
3992
  const taro = Current.taro;
3776
3993
  const page = taro.getCurrentInstance().page;
3777
- const currentData = ((_a = page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || page.tabBar;
3994
+ const currentData = ((_a = page === null || page === void 0 ? void 0 : page._data) === null || _a === void 0 ? void 0 : _a.taroTabBar) || (page === null || page === void 0 ? void 0 : page.tabBar);
3778
3995
  const res = { errMsg: 'setTabBarItem:ok' };
3779
3996
  const error = { errMsg: 'setTabBarItem:fail not TabBar page' };
3780
3997
  if (!currentData) {
@@ -3867,19 +4084,16 @@ class IntersectionObserver {
3867
4084
  };
3868
4085
  const taro = Current.taro;
3869
4086
  const page = taro.getCurrentInstance().page;
3870
- const currentPage = getPageScrollerOrNode(page.node, page);
3871
- this._component = component || currentPage;
4087
+ this._component = component || getPageScrollerOrNode(page === null || page === void 0 ? void 0 : page.node, page);
3872
4088
  Object.assign(this._options, options);
3873
4089
  }
3874
4090
  disconnect() {
3875
- var _a;
3876
- if (this._observerNodes) {
4091
+ if (this._observerNodes && this._component) {
3877
4092
  if (this._observerNodes instanceof Array) {
3878
4093
  this._observerNodes.forEach((n) => {
3879
- var _a;
3880
4094
  disconnectEvent(n, VISIBLE_CHANGE_EVENT_NAME);
3881
4095
  // @ts-ignore
3882
- (_a = n._nodeInfo) === null || _a === void 0 ? void 0 : _a.thresholds = null;
4096
+ n._nodeInfo.thresholds = null;
3883
4097
  });
3884
4098
  }
3885
4099
  else {
@@ -3887,35 +4101,40 @@ class IntersectionObserver {
3887
4101
  // @ts-ignore
3888
4102
  if (this._observerNodes._nodeInfo) {
3889
4103
  // @ts-ignore
3890
- (_a = this._observerNodes._nodeInfo) === null || _a === void 0 ? void 0 : _a.thresholds = null;
4104
+ this._observerNodes._nodeInfo.thresholds = null;
3891
4105
  }
3892
4106
  }
3893
4107
  }
3894
4108
  }
3895
4109
  observe(targetSelector, callback) {
3896
- var _a;
4110
+ if (!this._component)
4111
+ return;
3897
4112
  const { observeAll, thresholds } = this._options;
3898
4113
  const node = findChildNodeWithDFS(this._component, targetSelector, observeAll);
3899
4114
  this._observerNodes = node;
3900
4115
  if (node) {
3901
4116
  if (node instanceof Array) {
3902
4117
  node.forEach(n => {
3903
- var _a;
3904
4118
  // @ts-ignore
3905
- (_a = n._nodeInfo) === null || _a === void 0 ? void 0 : _a.thresholds = thresholds;
4119
+ n._nodeInfo.thresholds = thresholds;
3906
4120
  setNodeEventCallbackAndTriggerComponentUpdate(n, VISIBLE_CHANGE_EVENT_NAME, (isVisible, currentRatio) => {
3907
- callback(this.handleResult(isVisible, currentRatio));
4121
+ callback(this.handleResult(isVisible, currentRatio, n));
3908
4122
  });
3909
4123
  });
3910
4124
  }
3911
4125
  else {
3912
4126
  // @ts-ignore
3913
- (_a = node._nodeInfo) === null || _a === void 0 ? void 0 : _a.thresholds = thresholds;
4127
+ node._nodeInfo.thresholds = thresholds;
3914
4128
  setNodeEventCallbackAndTriggerComponentUpdate(node, VISIBLE_CHANGE_EVENT_NAME, (isVisible, currentRatio) => {
3915
- callback(this.handleResult(isVisible, currentRatio));
4129
+ callback(this.handleResult(isVisible, currentRatio, node));
3916
4130
  });
3917
4131
  }
3918
4132
  }
4133
+ else {
4134
+ callback({
4135
+ errMsg: 'IntersectionObserver.observe:fail cannot find the node for selector.'
4136
+ });
4137
+ }
3919
4138
  }
3920
4139
  relativeTo() {
3921
4140
  temporarilyNotSupport('relativeTo')();
@@ -3926,8 +4145,10 @@ class IntersectionObserver {
3926
4145
  return this;
3927
4146
  }
3928
4147
  // @ts-ignore
3929
- handleResult(isVisible, currentRatio) {
4148
+ handleResult(isVisible, currentRatio, node) {
3930
4149
  const result = {
4150
+ id: node.id,
4151
+ dataset: node.dataset,
3931
4152
  intersectionRatio: currentRatio,
3932
4153
  // TODO 未做,等待能拿到element的info信息
3933
4154
  boundingClientRect: {
@@ -4135,32 +4356,45 @@ function filter(fields, dom) {
4135
4356
  }
4136
4357
  function querySelector(selector, selectAll) {
4137
4358
  if (typeof selector === 'string') {
4138
- return parseHandler(selector, selectAll);
4359
+ return selector.split(',').reduce((prev, current) => {
4360
+ const item = current.trim();
4361
+ return prev.concat(parseHandler(item, selectAll));
4362
+ }, []);
4139
4363
  }
4140
- return null;
4364
+ return [];
4141
4365
  }
4142
4366
  function queryBat(queue, cb) {
4143
4367
  const result = [];
4144
4368
  const taro = Current.taro;
4145
4369
  const page = taro.getCurrentInstance().page;
4146
- const element = getPageScrollerOrNode(page.node, page);
4147
- if (element == null)
4370
+ const element = getPageScrollerOrNode(page === null || page === void 0 ? void 0 : page.node, page);
4371
+ if (!element)
4148
4372
  return null;
4149
4373
  arr = [];
4150
4374
  traversalDFSDom(element);
4151
- queue.forEach(item => {
4375
+ queue.forEach((item) => {
4152
4376
  const { selector, single, fields } = item;
4153
- const nodeList = querySelector(selector, !single);
4154
- result.push(nodeList.map(dom => {
4377
+ if (single) {
4378
+ const dom = querySelector(selector, !single)[0];
4155
4379
  // eslint-disable-next-line no-async-promise-executor
4156
- return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
4380
+ result.push(new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
4157
4381
  yield setNodeEventCallbackAndTriggerComponentUpdate(dom, AREA_CHANGE_EVENT_NAME, null, true);
4158
4382
  resolve(filter(fields, dom));
4383
+ })));
4384
+ }
4385
+ else {
4386
+ const nodeList = querySelector(selector, !single);
4387
+ result.push(nodeList.map(dom => {
4388
+ // eslint-disable-next-line no-async-promise-executor
4389
+ return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
4390
+ yield setNodeEventCallbackAndTriggerComponentUpdate(dom, AREA_CHANGE_EVENT_NAME, null, true);
4391
+ resolve(filter(fields, dom));
4392
+ }));
4159
4393
  }));
4160
- }));
4394
+ }
4161
4395
  });
4162
4396
  Promise.all(result.map(item => {
4163
- return Promise.all(item);
4397
+ return item instanceof Array ? Promise.all(item) : item;
4164
4398
  })).then(data => {
4165
4399
  cb(data);
4166
4400
  });
@@ -4239,6 +4473,7 @@ var apis = /*#__PURE__*/Object.freeze({
4239
4473
  ENV_TYPE: ENV_TYPE,
4240
4474
  Events: Events,
4241
4475
  History: History,
4476
+ IntersectionObserver: IntersectionObserver,
4242
4477
  addCard: addCard,
4243
4478
  addFileToFavorites: addFileToFavorites,
4244
4479
  addPhoneCalendar: addPhoneCalendar,
@@ -4628,7 +4863,7 @@ var apis = /*#__PURE__*/Object.freeze({
4628
4863
  writeBLECharacteristicValue: writeBLECharacteristicValue
4629
4864
  });
4630
4865
 
4631
- Object.assign({}, apis);
4866
+ const taro = Object.assign({}, apis);
4632
4867
  const requirePlugin = /* @__PURE__ */ permanentlyNotSupport('requirePlugin');
4633
4868
  function initNativeApi(taro) {
4634
4869
  Current.taro = taro;
@@ -4652,7 +4887,7 @@ const defaultBaseFontSize = 20;
4652
4887
  const defaultUnitPrecision = 5;
4653
4888
  const defaultTargetUnit = 'vp';
4654
4889
  function getApp$1() {
4655
- return Current.app;
4890
+ return Current.app || {};
4656
4891
  }
4657
4892
  function initPxTransform({ designWidth = defaultDesignWidth, deviceRatio = defaultDesignRatio, baseFontSize = defaultBaseFontSize, unitPrecision = defaultUnitPrecision, targetUnit = defaultTargetUnit }) {
4658
4893
  const taro = Current.taro;
@@ -4666,19 +4901,56 @@ function initPxTransform({ designWidth = defaultDesignWidth, deviceRatio = defau
4666
4901
  config.unitPrecision = unitPrecision;
4667
4902
  }
4668
4903
  }
4669
- _display.getDefaultDisplaySync();
4904
+ const display = _display.getDefaultDisplaySync();
4905
+ let displayWidth = display.width;
4906
+ let ratioCache = false;
4907
+ let designWidthFunc;
4908
+ let designWidth = defaultDesignWidth;
4909
+ function getRatio(value) {
4910
+ var _a;
4911
+ // Note: 提前调用 display 可能无法获取正确值
4912
+ if (ratioCache === false || displayWidth !== display.width) {
4913
+ const config = ((_a = Current.taro) === null || _a === void 0 ? void 0 : _a.config) || {};
4914
+ if (!isFunction(designWidthFunc)) {
4915
+ designWidthFunc = isFunction(config.designWidth)
4916
+ ? config.designWidth
4917
+ : () => config.designWidth;
4918
+ designWidth = designWidthFunc(value) || defaultDesignWidth;
4919
+ }
4920
+ displayWidth = display.width;
4921
+ ratioCache = Math.min(display.width, display.height) / designWidth;
4922
+ }
4923
+ return ratioCache;
4924
+ }
4925
+ // Note: 设置为 style 单位时会自动完成设计稿转换,设计开发者调用 API 时也许抹平差异,例如 pageScrollTo[option.offsetTop]
4926
+ function pxTransformHelper(size, unit, isNumber = false) {
4927
+ var _a;
4928
+ const config = ((_a = Current.taro) === null || _a === void 0 ? void 0 : _a.config) || {};
4929
+ const targetUnit = unit || config.targetUnit || defaultTargetUnit;
4930
+ if (targetUnit === 'PX') {
4931
+ return px2vp(size * display.scaledDensity) + 'vp';
4932
+ }
4933
+ const ratio = getRatio(size);
4934
+ let val = size * ratio;
4935
+ switch (targetUnit) {
4936
+ case 'vp':
4937
+ // Note: 在应用创建前调用无效
4938
+ val = px2vp(val);
4939
+ break;
4940
+ }
4941
+ return isNumber ? val : val + targetUnit;
4942
+ }
4670
4943
  function pxTransform(size) {
4671
4944
  var _a;
4672
4945
  const config = ((_a = Current.taro) === null || _a === void 0 ? void 0 : _a.config) || {};
4673
4946
  const targetUnit = config.targetUnit || defaultTargetUnit;
4674
- let val = size;
4947
+ const val = size;
4675
4948
  switch (targetUnit) {
4676
4949
  case 'vp':
4677
- val = px2vp(size);
4678
- break;
4950
+ return pxTransformHelper(size, 'px');
4679
4951
  // NOTE: 鸿蒙环境下 style 会自动完成设计稿转换,无需在方法内二次调整
4680
4952
  }
4681
- return val + config.targetUnit;
4953
+ return val + targetUnit;
4682
4954
  }
4683
4955
  function canIUseWebp() {
4684
4956
  return true;
@@ -4692,6 +4964,7 @@ function getAppInfo() {
4692
4964
  designWidth: config === null || config === void 0 ? void 0 : config.designWidth,
4693
4965
  };
4694
4966
  }
4967
+ initNativeApi(taro);
4695
4968
 
4696
4969
  const components = {
4697
4970
  Checkbox: {