@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
|
@@ -3,6 +3,7 @@ import { History, Location } from '@tarojs/runtime/dist/runtime.esm'
|
|
|
3
3
|
|
|
4
4
|
import { TaroEventTarget } from '../dom/eventTarget'
|
|
5
5
|
import { getComputedStyle } from './getComputedStyle'
|
|
6
|
+
import { nav } from './navigator'
|
|
6
7
|
|
|
7
8
|
import type { TaroDocument } from '../dom/document'
|
|
8
9
|
|
|
@@ -13,6 +14,7 @@ class Window extends TaroEventTarget {
|
|
|
13
14
|
|
|
14
15
|
public location: any
|
|
15
16
|
public history: any
|
|
17
|
+
public navigator = nav
|
|
16
18
|
public getComputedStyle = getComputedStyle
|
|
17
19
|
|
|
18
20
|
constructor () {
|
|
@@ -6,7 +6,7 @@ import { initComponentNodeInfo, triggerAttributesCallback } from '../../utils/in
|
|
|
6
6
|
import { bindAnimation } from '../bind'
|
|
7
7
|
import { ClassList } from '../class-list'
|
|
8
8
|
import { NodeType, TaroNode } from '../node'
|
|
9
|
-
import StyleSheet from '../stylesheet'
|
|
9
|
+
import StyleSheet, { HarmonyStyle } from '../stylesheet'
|
|
10
10
|
|
|
11
11
|
import type { StandardProps } from '@tarojs/components/types'
|
|
12
12
|
import type { TaroAny } from '../../utils'
|
|
@@ -26,9 +26,6 @@ export class TaroElement<T extends StandardProps = StandardProps> extends TaroNo
|
|
|
26
26
|
public readonly tagName: string
|
|
27
27
|
public _attrs: T & TaroExtraProps = {} as T & TaroExtraProps
|
|
28
28
|
|
|
29
|
-
_client?: Area
|
|
30
|
-
_scroll?: Area
|
|
31
|
-
|
|
32
29
|
constructor(tagName: string) {
|
|
33
30
|
super(tagName.replace(new RegExp('(?<=.)([A-Z])', 'g'), '-$1').toUpperCase(), NodeType.ELEMENT_NODE)
|
|
34
31
|
this.tagName = this.nodeName
|
|
@@ -159,4 +156,44 @@ export class TaroElement<T extends StandardProps = StandardProps> extends TaroNo
|
|
|
159
156
|
public get style (): ICSSStyleDeclaration | null {
|
|
160
157
|
return this._style
|
|
161
158
|
}
|
|
159
|
+
|
|
160
|
+
// 伪类,不存在style动态设置,均已被转换为鸿蒙样式
|
|
161
|
+
// TODO:可根据实际情况,迁移到具体的组件中,如View、ScrollView中,Text\Image其实是不需要的
|
|
162
|
+
public _pseudo_before: StyleSheet | null
|
|
163
|
+
|
|
164
|
+
public get pseudo_before () {
|
|
165
|
+
return this._pseudo_before?.hmStyle
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
public set_pseudo_before (value: HarmonyStyle | null) {
|
|
169
|
+
if (value) {
|
|
170
|
+
if (!this._pseudo_before) {
|
|
171
|
+
this._pseudo_before = new StyleSheet()
|
|
172
|
+
}
|
|
173
|
+
Object.keys(value).forEach(key => {
|
|
174
|
+
this._pseudo_before![key] = value[key]
|
|
175
|
+
})
|
|
176
|
+
} else {
|
|
177
|
+
this._pseudo_before = null
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
public _pseudo_after: StyleSheet | null
|
|
182
|
+
|
|
183
|
+
public get pseudo_after () {
|
|
184
|
+
return this._pseudo_after?.hmStyle
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
public set_pseudo_after (value: HarmonyStyle | null) {
|
|
188
|
+
if (value) {
|
|
189
|
+
if (!this._pseudo_after) {
|
|
190
|
+
this._pseudo_after = new StyleSheet()
|
|
191
|
+
}
|
|
192
|
+
Object.keys(value).forEach(key => {
|
|
193
|
+
this._pseudo_after![key] = value[key]
|
|
194
|
+
})
|
|
195
|
+
} else {
|
|
196
|
+
this._pseudo_after = null
|
|
197
|
+
}
|
|
198
|
+
}
|
|
162
199
|
}
|
|
@@ -15,6 +15,7 @@ export const WEB_STYLE_MAP = {
|
|
|
15
15
|
marginRight: ['_marginRight'],
|
|
16
16
|
marginBottom: ['_marginBottom'],
|
|
17
17
|
marginLeft: ['_marginLeft'],
|
|
18
|
+
position: ['_position'],
|
|
18
19
|
top: ['_top'],
|
|
19
20
|
left: ['_left'],
|
|
20
21
|
flex: ['_flexGrow', '_flexShrink', '_flexBasis'],
|
|
@@ -74,7 +75,8 @@ export const WEB_STYLE_MAP = {
|
|
|
74
75
|
textDecoration: ['_textDecoration'],
|
|
75
76
|
textOverflow: ['_textOverflow'],
|
|
76
77
|
WebkitLineClamp: ['_WebkitLineClamp'],
|
|
77
|
-
transform: ['_transform']
|
|
78
|
+
transform: ['_transform'],
|
|
79
|
+
display: ['_display']
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
// 将web端的style转换为hm端的style
|
|
@@ -458,6 +460,27 @@ export default function convertWebStyle2HmStyle(webStyle: CSSProperties) {
|
|
|
458
460
|
hmStyle._transform = parseTransform(value)
|
|
459
461
|
break
|
|
460
462
|
}
|
|
463
|
+
case 'position': {
|
|
464
|
+
hmStyle._position = value
|
|
465
|
+
break
|
|
466
|
+
}
|
|
467
|
+
case 'display': {
|
|
468
|
+
hmStyle._display = value
|
|
469
|
+
break
|
|
470
|
+
}
|
|
471
|
+
case 'zIndex': {
|
|
472
|
+
hmStyle._zIndex = Number(value)
|
|
473
|
+
break
|
|
474
|
+
}
|
|
475
|
+
case 'opacity': {
|
|
476
|
+
const val = Number(value)
|
|
477
|
+
hmStyle._opacity = Number.isNaN(val) ? 1 : val
|
|
478
|
+
break
|
|
479
|
+
}
|
|
480
|
+
case 'overflow': {
|
|
481
|
+
hmStyle._overflow = value === 'hidden'
|
|
482
|
+
break
|
|
483
|
+
}
|
|
461
484
|
default: {
|
|
462
485
|
hmStyle[key] = value
|
|
463
486
|
break
|
|
@@ -472,9 +495,9 @@ function setBackgroundImage(hmStyle, value) {
|
|
|
472
495
|
// 如果包含 url(),则说明是 background-image 属性
|
|
473
496
|
const match = value.match(new RegExp('url\\([\'"]?(.*?)[\'"]?\\)'))
|
|
474
497
|
if (match) {
|
|
475
|
-
hmStyle._backgroundImage =
|
|
498
|
+
hmStyle._backgroundImage = {
|
|
476
499
|
src: match[1]
|
|
477
|
-
}
|
|
500
|
+
}
|
|
478
501
|
}
|
|
479
502
|
}
|
|
480
503
|
}
|
|
@@ -482,10 +505,10 @@ function setBackgroundImage(hmStyle, value) {
|
|
|
482
505
|
function setBackgroundRepeat(hmStyle, value) {
|
|
483
506
|
if (typeof value === 'string') {
|
|
484
507
|
switch (value) {
|
|
485
|
-
case 'repeat-x': hmStyle._backgroundRepeat =
|
|
486
|
-
case 'repeat-y': hmStyle._backgroundRepeat =
|
|
487
|
-
case 'no-repeat': hmStyle._backgroundRepeat =
|
|
488
|
-
default: hmStyle._backgroundRepeat =
|
|
508
|
+
case 'repeat-x': hmStyle._backgroundRepeat = ImageRepeat.X; break
|
|
509
|
+
case 'repeat-y': hmStyle._backgroundRepeat = ImageRepeat.Y; break
|
|
510
|
+
case 'no-repeat': hmStyle._backgroundRepeat = ImageRepeat.NoRepeat; break
|
|
511
|
+
default: hmStyle._backgroundRepeat = ImageRepeat.XY; break
|
|
489
512
|
}
|
|
490
513
|
}
|
|
491
514
|
}
|
|
@@ -494,9 +517,9 @@ function setBackgroundSize(hmStyle, value) {
|
|
|
494
517
|
if (typeof value === 'string') {
|
|
495
518
|
const sizes = value.split(' ')
|
|
496
519
|
if (sizes.length === 1) {
|
|
497
|
-
hmStyle._backgroundSize =
|
|
520
|
+
hmStyle._backgroundSize = { width: getUnit(sizes[0]) }
|
|
498
521
|
} else if (sizes.length === 2) {
|
|
499
|
-
hmStyle._backgroundSize =
|
|
522
|
+
hmStyle._backgroundSize = { width: getUnit(sizes[0]), height: getUnit(sizes[1]) }
|
|
500
523
|
}
|
|
501
524
|
}
|
|
502
525
|
}
|
|
@@ -508,28 +531,28 @@ function setBackgroundPosistion (hmStyle, value) {
|
|
|
508
531
|
const vertical = positions[1].toLowerCase() || 'top'
|
|
509
532
|
|
|
510
533
|
if (horizontal === 'left' && vertical === 'top') {
|
|
511
|
-
hmStyle._backgroundPosition =
|
|
534
|
+
hmStyle._backgroundPosition = Alignment.TopStart
|
|
512
535
|
} else if (horizontal === 'center' && vertical === 'top') {
|
|
513
|
-
hmStyle._backgroundPosition =
|
|
536
|
+
hmStyle._backgroundPosition = Alignment.Top
|
|
514
537
|
} else if (horizontal === 'right' && vertical === 'top') {
|
|
515
|
-
hmStyle._backgroundPosition =
|
|
538
|
+
hmStyle._backgroundPosition = Alignment.TopEnd
|
|
516
539
|
} else if (horizontal === 'left' && vertical === 'center') {
|
|
517
|
-
hmStyle._backgroundPosition =
|
|
540
|
+
hmStyle._backgroundPosition = Alignment.Start
|
|
518
541
|
} else if (horizontal === 'center' && vertical === 'center') {
|
|
519
|
-
hmStyle._backgroundPosition =
|
|
542
|
+
hmStyle._backgroundPosition = Alignment.Center
|
|
520
543
|
} else if (horizontal === 'right' && vertical === 'center') {
|
|
521
|
-
hmStyle._backgroundPosition =
|
|
544
|
+
hmStyle._backgroundPosition = Alignment.End
|
|
522
545
|
} else if (horizontal === 'left' && vertical === 'bottom') {
|
|
523
|
-
hmStyle._backgroundPosition =
|
|
546
|
+
hmStyle._backgroundPosition = Alignment.BottomStart
|
|
524
547
|
} else if (horizontal === 'center' && vertical === 'bottom') {
|
|
525
|
-
hmStyle._backgroundPosition =
|
|
548
|
+
hmStyle._backgroundPosition = Alignment.Bottom
|
|
526
549
|
} else if (horizontal === 'right' && vertical === 'bottom') {
|
|
527
|
-
hmStyle._backgroundPosition =
|
|
550
|
+
hmStyle._backgroundPosition = Alignment.BottomEnd
|
|
528
551
|
} else {
|
|
529
552
|
if (/^\d+(\.\d+)?(px|%|vw|vh)$/.test(horizontal)) {
|
|
530
|
-
hmStyle._backgroundPosition =
|
|
553
|
+
hmStyle._backgroundPosition = { x: getUnit(horizontal) }
|
|
531
554
|
if (/^\d+(\.\d+)?(px|%|vw|vh)$/.test(vertical)) {
|
|
532
|
-
hmStyle._backgroundPosition =
|
|
555
|
+
hmStyle._backgroundPosition = { x: getUnit(horizontal), y: getUnit(vertical) }
|
|
533
556
|
}
|
|
534
557
|
}
|
|
535
558
|
}
|
|
@@ -15,7 +15,7 @@ export default class StyleSheet {
|
|
|
15
15
|
return this.hmStyle.display
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
set
|
|
18
|
+
set _display (value: string) {
|
|
19
19
|
this.hmStyle.display = value
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ export default class StyleSheet {
|
|
|
23
23
|
return this.hmStyle.position
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
set
|
|
26
|
+
set _position (value: string) {
|
|
27
27
|
this.hmStyle.position = value
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -245,17 +245,17 @@ export default class StyleSheet {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
set _background (value: TaroAny) {
|
|
248
|
-
const _backgroundImage: HarmonyType.Background.backgroundImage = value?.image
|
|
248
|
+
const _backgroundImage: HarmonyType.Background.backgroundImage = value?.image
|
|
249
249
|
if (_backgroundImage) {
|
|
250
250
|
this.hmStyle.backgroundImage = _backgroundImage.src
|
|
251
251
|
if (_backgroundImage.repeat) {
|
|
252
252
|
this.hmStyle.backgroundRepeat = _backgroundImage.repeat
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
this.hmStyle.backgroundImageSize = value?.size
|
|
255
|
+
this.hmStyle.backgroundImageSize = value?.size
|
|
256
256
|
this.hmStyle.backgroundColor = this.hmStyle.backgroundImage ? null : value?.color
|
|
257
257
|
|
|
258
|
-
const _backgroundPosition: HarmonyType.Background.backgroundImagePosition = value?.position
|
|
258
|
+
const _backgroundPosition: HarmonyType.Background.backgroundImagePosition = value?.position
|
|
259
259
|
this.hmStyle.backgroundImagePosition = _backgroundPosition
|
|
260
260
|
}
|
|
261
261
|
|
|
@@ -272,7 +272,7 @@ export default class StyleSheet {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
set _backgroundImage (value) {
|
|
275
|
-
this.hmStyle.backgroundImage = value
|
|
275
|
+
this.hmStyle.backgroundImage = value
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
get backgroundRepeat () {
|
|
@@ -287,7 +287,7 @@ export default class StyleSheet {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
set _backgroundRepeat (value: ImageRepeat[]) {
|
|
290
|
-
this.hmStyle.backgroundRepeat = value
|
|
290
|
+
this.hmStyle.backgroundRepeat = value
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
get backgroundSize () {
|
|
@@ -297,7 +297,7 @@ export default class StyleSheet {
|
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
set _backgroundSize (value: HarmonyType.Background.backgroundImageSize[]) {
|
|
300
|
-
this.hmStyle.backgroundSize = value
|
|
300
|
+
this.hmStyle.backgroundSize = value
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
get backgroundPosition () {
|
|
@@ -322,7 +322,7 @@ export default class StyleSheet {
|
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
set _backgroundPosition (value: HarmonyType.Background.backgroundImagePosition[]) {
|
|
325
|
-
this.hmStyle.backgroundPosition = value
|
|
325
|
+
this.hmStyle.backgroundPosition = value
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
get border () {
|
|
@@ -493,7 +493,7 @@ export default class StyleSheet {
|
|
|
493
493
|
return Number(this.hmStyle.zIndex)
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
-
set
|
|
496
|
+
set _zIndex (value: string) {
|
|
497
497
|
this.hmStyle.zIndex = Number(value)
|
|
498
498
|
}
|
|
499
499
|
|
|
@@ -501,16 +501,15 @@ export default class StyleSheet {
|
|
|
501
501
|
return this.hmStyle.opacity
|
|
502
502
|
}
|
|
503
503
|
|
|
504
|
-
set
|
|
505
|
-
|
|
506
|
-
this.hmStyle.opacity = Number.isNaN(val) ? 1 : val
|
|
504
|
+
set _opacity (value: number) {
|
|
505
|
+
this.hmStyle.opacity = value
|
|
507
506
|
}
|
|
508
507
|
|
|
509
508
|
get overflow () {
|
|
510
509
|
return this.hmStyle.overflow ? 'hidden' : 'visible'
|
|
511
510
|
}
|
|
512
511
|
|
|
513
|
-
set
|
|
512
|
+
set _overflow (value: string) {
|
|
514
513
|
this.hmStyle.overflow = value === 'hidden'
|
|
515
514
|
}
|
|
516
515
|
|
|
@@ -658,5 +657,13 @@ export default class StyleSheet {
|
|
|
658
657
|
set _transformOrigin(value) {
|
|
659
658
|
this.hmStyle.transformOrigin = value
|
|
660
659
|
}
|
|
660
|
+
|
|
661
|
+
get content () {
|
|
662
|
+
return this.hmStyle._content
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
set _content (value) {
|
|
666
|
+
this.hmStyle.content = value
|
|
667
|
+
}
|
|
661
668
|
}
|
|
662
669
|
|
|
@@ -80,7 +80,11 @@ function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
|
|
|
80
80
|
|
|
81
81
|
componentDidMount () {
|
|
82
82
|
if (isDefaultEntryDom) {
|
|
83
|
-
Current.app
|
|
83
|
+
if (Current.app) {
|
|
84
|
+
Current.app = Object.assign(this, Current.app)
|
|
85
|
+
} else {
|
|
86
|
+
Current.app = this
|
|
87
|
+
}
|
|
84
88
|
} else {
|
|
85
89
|
nativeComponentApp = this
|
|
86
90
|
}
|
|
@@ -184,6 +184,7 @@ export function createPageConfig (component: any, pageName?: string, pageConfig?
|
|
|
184
184
|
safeExecute(this.$taroPath, ON_READY)
|
|
185
185
|
// 通过事件触发子组件的生命周期
|
|
186
186
|
requestAnimationFrame(() => eventCenter.trigger(getOnReadyEventKey(id)))
|
|
187
|
+
this.onReady.called = true
|
|
187
188
|
})
|
|
188
189
|
},
|
|
189
190
|
[ONSHOW] (options = {}) {
|
package/dist/runtime-utils.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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, 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;
|