@tarojs/plugin-platform-harmony-ets 4.0.0-beta.12 → 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/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/runtime-ets/bom/window.ts +2 -0
- package/dist/runtime-ets/current.ts +2 -0
- package/dist/runtime-ets/dom/element/element.ts +41 -1
- 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 +2 -3
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +2 -3
- package/dist/runtime.js.map +1 -1
- package/package.json +8 -8
|
@@ -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,6 +1,6 @@
|
|
|
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
5
|
import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
|
|
6
6
|
import deviceInfo from '@ohos.deviceInfo';
|
|
@@ -2006,7 +2006,6 @@ function getEnv() {
|
|
|
2006
2006
|
}
|
|
2007
2007
|
// TODO
|
|
2008
2008
|
const getCurrentPages = () => [];
|
|
2009
|
-
const getCurrentInstance = () => Current;
|
|
2010
2009
|
const requirePlugin$1 = temporarilyNotSupport('requirePlugin');
|
|
2011
2010
|
|
|
2012
2011
|
// @ts-nocheck
|
|
@@ -4774,7 +4773,7 @@ const defaultBaseFontSize = 20;
|
|
|
4774
4773
|
const defaultUnitPrecision = 5;
|
|
4775
4774
|
const defaultTargetUnit = 'vp';
|
|
4776
4775
|
function getApp$1() {
|
|
4777
|
-
return Current.app;
|
|
4776
|
+
return Current.app || {};
|
|
4778
4777
|
}
|
|
4779
4778
|
function initPxTransform({ designWidth = defaultDesignWidth, deviceRatio = defaultDesignRatio, baseFontSize = defaultBaseFontSize, unitPrecision = defaultUnitPrecision, targetUnit = defaultTargetUnit }) {
|
|
4780
4779
|
const taro = Current.taro;
|