@tarojs/plugin-platform-harmony-ets 4.0.0-beta.12 → 4.0.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apis/base/system.ts +40 -25
- package/dist/apis/framework/index.ts +1 -5
- package/dist/apis/index.ts +1 -1
- package/dist/components-harmony-ets/pseudo.ets +72 -0
- package/dist/components-harmony-ets/scrollView.ets +4 -4
- package/dist/components-harmony-ets/style.ets +144 -123
- package/dist/components-harmony-ets/utils/flexManager.ets +6 -6
- package/dist/components-harmony-ets/utils/helper.ets +2 -2
- package/dist/components-harmony-ets/utils/styles.ets +31 -14
- package/dist/components-harmony-ets/view.ets +3 -3
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/window.ts +2 -0
- package/dist/runtime-ets/current.ts +2 -0
- package/dist/runtime-ets/dom/element/element.ts +58 -3
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +43 -20
- package/dist/runtime-ets/dom/stylesheet/index.ts +21 -14
- package/dist/runtime-ets/dom/stylesheet/type.ts +1 -0
- package/dist/runtime-framework/react/app.ts +5 -1
- package/dist/runtime-framework/react/native-page.ts +5 -1
- package/dist/runtime-framework/react/page.ts +1 -0
- package/dist/runtime-utils.js +41 -30
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +41 -30
- package/dist/runtime.js.map +1 -1
- package/package.json +8 -8
package/dist/runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, window, hooks, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime';
|
|
3
|
+
import { Current, window, 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
5
|
import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
|
|
6
6
|
import deviceInfo from '@ohos.deviceInfo';
|
|
@@ -267,33 +267,45 @@ const preloadSkylineView = /* @__PURE__ */ temporarilyNotSupport('preloadSkyline
|
|
|
267
267
|
const preloadAssets = /* @__PURE__ */ temporarilyNotSupport('preloadAssets');
|
|
268
268
|
|
|
269
269
|
let display;
|
|
270
|
+
let navigationIndicatorRect;
|
|
270
271
|
let safeArea = null;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
272
|
+
let statusBarHeight;
|
|
273
|
+
let windowRect;
|
|
274
|
+
Current.contextPromise.then((context) => {
|
|
275
|
+
const win = window.__ohos.getLastWindow(context);
|
|
276
|
+
win.then(mainWindow => {
|
|
277
|
+
const topRect = mainWindow.getWindowAvoidArea(window.__ohos.AvoidAreaType.TYPE_SYSTEM).topRect;
|
|
278
|
+
navigationIndicatorRect = mainWindow.getWindowAvoidArea(window.__ohos.AvoidAreaType.TYPE_NAVIGATION_INDICATOR).bottomRect;
|
|
279
|
+
statusBarHeight = topRect.top + topRect.height;
|
|
280
|
+
windowRect = mainWindow.getWindowProperties().windowRect;
|
|
281
|
+
try {
|
|
282
|
+
display = _display.getDefaultDisplaySync();
|
|
283
|
+
// @ts-ignore
|
|
284
|
+
display.getCutoutInfo((err, { boundingRects = [], waterfallDisplayAreaRects = {} } = {}) => {
|
|
285
|
+
var _a, _b, _c, _d, _e, _f;
|
|
286
|
+
if (err === null || err === void 0 ? void 0 : err.code) {
|
|
287
|
+
console.error('Failed to get cutout info', JSON.stringify(err));
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
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);
|
|
291
|
+
const bottom = display.height - Math.min((_c = waterfallDisplayAreaRects.bottom) === null || _c === void 0 ? void 0 : _c.top, navigationIndicatorRect === null || navigationIndicatorRect === void 0 ? void 0 : navigationIndicatorRect.top);
|
|
292
|
+
const left = ((_d = waterfallDisplayAreaRects.left) === null || _d === void 0 ? void 0 : _d.left) + ((_e = waterfallDisplayAreaRects.left) === null || _e === void 0 ? void 0 : _e.width);
|
|
293
|
+
const right = display.width - ((_f = waterfallDisplayAreaRects.right) === null || _f === void 0 ? void 0 : _f.left);
|
|
294
|
+
safeArea = {
|
|
295
|
+
top,
|
|
296
|
+
bottom,
|
|
297
|
+
left,
|
|
298
|
+
right,
|
|
299
|
+
height: bottom - top,
|
|
300
|
+
width: right - left,
|
|
301
|
+
};
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
catch (e) {
|
|
305
|
+
console.error('Failed to get display', e);
|
|
279
306
|
}
|
|
280
|
-
const top = Math.max(...boundingRects.map(rect => rect.top * 2 + rect.height), ((_a = waterfallDisplayAreaRects.top) === null || _a === void 0 ? void 0 : _a.top) + ((_b = waterfallDisplayAreaRects.top) === null || _b === void 0 ? void 0 : _b.height));
|
|
281
|
-
const bottom = (((_c = waterfallDisplayAreaRects.bottom) === null || _c === void 0 ? void 0 : _c.top) + ((_d = waterfallDisplayAreaRects.bottom) === null || _d === void 0 ? void 0 : _d.height)) || display.height;
|
|
282
|
-
const left = ((_e = waterfallDisplayAreaRects.left) === null || _e === void 0 ? void 0 : _e.left) + ((_f = waterfallDisplayAreaRects.left) === null || _f === void 0 ? void 0 : _f.width);
|
|
283
|
-
const right = (((_g = waterfallDisplayAreaRects.right) === null || _g === void 0 ? void 0 : _g.left) + ((_h = waterfallDisplayAreaRects.right) === null || _h === void 0 ? void 0 : _h.width)) || display.width;
|
|
284
|
-
safeArea = {
|
|
285
|
-
top,
|
|
286
|
-
bottom,
|
|
287
|
-
left,
|
|
288
|
-
right,
|
|
289
|
-
height: bottom - top,
|
|
290
|
-
width: right - left,
|
|
291
|
-
};
|
|
292
307
|
});
|
|
293
|
-
}
|
|
294
|
-
catch (e) {
|
|
295
|
-
console.error('Failed to get display', e);
|
|
296
|
-
}
|
|
308
|
+
});
|
|
297
309
|
/* 同步版本 */
|
|
298
310
|
const getSystemInfoSync = function () {
|
|
299
311
|
var _a, _b;
|
|
@@ -322,12 +334,12 @@ const getSystemInfoSync = function () {
|
|
|
322
334
|
res.safeArea = safeArea; // 在竖屏正方向下的安全区域 General.SafeAreaResult
|
|
323
335
|
res.screenHeight = display === null || display === void 0 ? void 0 : display.height; // 屏幕高度,单位px number
|
|
324
336
|
res.screenWidth = display === null || display === void 0 ? void 0 : display.width; // 屏幕宽度,单位px number
|
|
325
|
-
res.statusBarHeight =
|
|
337
|
+
res.statusBarHeight = statusBarHeight; // 状态栏的高度,单位px number
|
|
326
338
|
res.system = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.osFullName; // 操作系统及版本 string
|
|
327
339
|
// Note: 更新配置时才能记录
|
|
328
340
|
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'
|
|
329
|
-
res.windowHeight =
|
|
330
|
-
res.windowWidth =
|
|
341
|
+
res.windowHeight = windowRect === null || windowRect === void 0 ? void 0 : windowRect.height; // 可使用窗口高度,单位px number
|
|
342
|
+
res.windowWidth = windowRect === null || windowRect === void 0 ? void 0 : windowRect.width; // 可使用窗口宽度,单位px number
|
|
331
343
|
res.version = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.displayVersion; // 版本号 string
|
|
332
344
|
return res;
|
|
333
345
|
};
|
|
@@ -2006,7 +2018,6 @@ function getEnv() {
|
|
|
2006
2018
|
}
|
|
2007
2019
|
// TODO
|
|
2008
2020
|
const getCurrentPages = () => [];
|
|
2009
|
-
const getCurrentInstance = () => Current;
|
|
2010
2021
|
const requirePlugin$1 = temporarilyNotSupport('requirePlugin');
|
|
2011
2022
|
|
|
2012
2023
|
// @ts-nocheck
|
|
@@ -4774,7 +4785,7 @@ const defaultBaseFontSize = 20;
|
|
|
4774
4785
|
const defaultUnitPrecision = 5;
|
|
4775
4786
|
const defaultTargetUnit = 'vp';
|
|
4776
4787
|
function getApp$1() {
|
|
4777
|
-
return Current.app;
|
|
4788
|
+
return Current.app || {};
|
|
4778
4789
|
}
|
|
4779
4790
|
function initPxTransform({ designWidth = defaultDesignWidth, deviceRatio = defaultDesignRatio, baseFontSize = defaultBaseFontSize, unitPrecision = defaultUnitPrecision, targetUnit = defaultTargetUnit }) {
|
|
4780
4791
|
const taro = Current.taro;
|