@tarojs/plugin-platform-harmony-ets 4.0.0-beta.11 → 4.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apis/base/system.ts +40 -22
- package/dist/apis/framework/index.ts +1 -5
- package/dist/apis/index.ts +1 -1
- package/dist/components-harmony-ets/checkbox.ets +2 -2
- package/dist/components-harmony-ets/form.ets +1 -1
- package/dist/components-harmony-ets/label.ets +1 -1
- package/dist/components-harmony-ets/movableArea.ets +1 -1
- package/dist/components-harmony-ets/movableView.ets +1 -1
- package/dist/components-harmony-ets/picker.ets +5 -5
- package/dist/components-harmony-ets/pseudo.ets +72 -0
- package/dist/components-harmony-ets/radio.ets +3 -3
- package/dist/components-harmony-ets/scrollView.ets +8 -7
- 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 +33 -16
- package/dist/components-harmony-ets/view.ets +4 -4
- package/dist/index.js +1 -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 +41 -4
- 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 +45 -24
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +45 -24
- package/dist/runtime.js.map +1 -1
- package/package.json +8 -8
package/dist/runtime.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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
|
+
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';
|
|
@@ -266,16 +266,37 @@ const preloadWebview = /* @__PURE__ */ temporarilyNotSupport('preloadWebview');
|
|
|
266
266
|
const preloadSkylineView = /* @__PURE__ */ temporarilyNotSupport('preloadSkylineView');
|
|
267
267
|
const preloadAssets = /* @__PURE__ */ temporarilyNotSupport('preloadAssets');
|
|
268
268
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
269
|
+
let display;
|
|
270
|
+
let safeArea = null;
|
|
271
|
+
try {
|
|
272
|
+
display = _display.getDefaultDisplaySync();
|
|
273
|
+
// @ts-ignore
|
|
274
|
+
display.getCutoutInfo((err, { boundingRects = [], waterfallDisplayAreaRects = {} } = {}) => {
|
|
275
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
276
|
+
if (err === null || err === void 0 ? void 0 : err.code) {
|
|
277
|
+
console.error('Failed to get cutout info', JSON.stringify(err));
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
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
|
+
});
|
|
293
|
+
}
|
|
294
|
+
catch (e) {
|
|
295
|
+
console.error('Failed to get display', e);
|
|
296
|
+
}
|
|
277
297
|
/* 同步版本 */
|
|
278
298
|
const getSystemInfoSync = function () {
|
|
299
|
+
var _a, _b;
|
|
279
300
|
const res = {};
|
|
280
301
|
res.SDKVersion = deviceInfo && deviceInfo.sdkApiVersion; // 客户端基础库版本 string
|
|
281
302
|
res.albumAuthorized = false; // 允许使用相册的开关(仅 iOS 有效) boolean
|
|
@@ -285,7 +306,7 @@ const getSystemInfoSync = function () {
|
|
|
285
306
|
res.cameraAuthorized = null; // 允许使用摄像头的开关 boolean
|
|
286
307
|
res.enableDebug = null; // 是否已打开调试 boolean
|
|
287
308
|
res.fontSizeSetting = null; // 用户字体大小(单位px) number
|
|
288
|
-
res.language = i18n
|
|
309
|
+
res.language = (_a = i18n === null || i18n === void 0 ? void 0 : i18n.getSystemLanguage) === null || _a === void 0 ? void 0 : _a.call(i18n); // string
|
|
289
310
|
res.locationAuthorized = null; // 定位的开关 boolean
|
|
290
311
|
res.locationEnabled = null; // 地理位置的系统开关 boolean
|
|
291
312
|
res.microphoneAuthorized = null; // 麦克风的开关 boolean
|
|
@@ -296,17 +317,18 @@ const getSystemInfoSync = function () {
|
|
|
296
317
|
res.notificationSoundAuthorized = false; // 通知带有声音的开关(仅 iOS 有效)boolean
|
|
297
318
|
res.phoneCalendarAuthorized = null; // 使用日历的开关 boolean
|
|
298
319
|
res.wifiEnabled = false; // Wi-Fi 的系统开关 boolean
|
|
299
|
-
res.pixelRatio =
|
|
300
|
-
res.platform = '
|
|
301
|
-
res.safeArea =
|
|
302
|
-
res.screenHeight = display
|
|
303
|
-
res.screenWidth = display
|
|
304
|
-
res.statusBarHeight = null; // 状态栏的高度,单位px number
|
|
305
|
-
res.system = deviceInfo
|
|
306
|
-
|
|
307
|
-
res.
|
|
308
|
-
res.windowHeight =
|
|
309
|
-
res.
|
|
320
|
+
res.pixelRatio = display && (Math.round(display.xDPI / display.width * 100) / 100); // 设备像素比,number
|
|
321
|
+
res.platform = 'harmony'; // 客户端平台 string
|
|
322
|
+
res.safeArea = safeArea; // 在竖屏正方向下的安全区域 General.SafeAreaResult
|
|
323
|
+
res.screenHeight = display === null || display === void 0 ? void 0 : display.height; // 屏幕高度,单位px number
|
|
324
|
+
res.screenWidth = display === null || display === void 0 ? void 0 : display.width; // 屏幕宽度,单位px number
|
|
325
|
+
res.statusBarHeight = safeArea === null || safeArea === void 0 ? void 0 : safeArea.top; // 状态栏的高度,单位px number
|
|
326
|
+
res.system = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.osFullName; // 操作系统及版本 string
|
|
327
|
+
// Note: 更新配置时才能记录
|
|
328
|
+
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 = display === null || display === void 0 ? void 0 : display.height; // 可使用窗口高度,单位px number
|
|
330
|
+
res.windowWidth = display === null || display === void 0 ? void 0 : display.width; // 可使用窗口宽度,单位px number
|
|
331
|
+
res.version = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.displayVersion; // 版本号 string
|
|
310
332
|
return res;
|
|
311
333
|
};
|
|
312
334
|
/* 异步版本 */
|
|
@@ -1984,7 +2006,6 @@ function getEnv() {
|
|
|
1984
2006
|
}
|
|
1985
2007
|
// TODO
|
|
1986
2008
|
const getCurrentPages = () => [];
|
|
1987
|
-
const getCurrentInstance = () => Current;
|
|
1988
2009
|
const requirePlugin$1 = temporarilyNotSupport('requirePlugin');
|
|
1989
2010
|
|
|
1990
2011
|
// @ts-nocheck
|
|
@@ -4752,7 +4773,7 @@ const defaultBaseFontSize = 20;
|
|
|
4752
4773
|
const defaultUnitPrecision = 5;
|
|
4753
4774
|
const defaultTargetUnit = 'vp';
|
|
4754
4775
|
function getApp$1() {
|
|
4755
|
-
return Current.app;
|
|
4776
|
+
return Current.app || {};
|
|
4756
4777
|
}
|
|
4757
4778
|
function initPxTransform({ designWidth = defaultDesignWidth, deviceRatio = defaultDesignRatio, baseFontSize = defaultBaseFontSize, unitPrecision = defaultUnitPrecision, targetUnit = defaultTargetUnit }) {
|
|
4758
4779
|
const taro = Current.taro;
|