@tarojs/plugin-platform-harmony-ets 4.0.8 → 4.0.9-alpha.2
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.
|
@@ -33,14 +33,13 @@ export class TaroElement<
|
|
|
33
33
|
> extends TaroNode {
|
|
34
34
|
public _innerHTML = ''
|
|
35
35
|
public _nodeInfo: TaroAny = {
|
|
36
|
-
layer: 0 // 渲染层级
|
|
36
|
+
layer: 0, // 渲染层级
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
public _hm_instance: TaroAny
|
|
40
40
|
public weak_hm_instance: WeakRef<TaroAny>
|
|
41
41
|
public use_weak_hm_instance: boolean = true
|
|
42
42
|
|
|
43
|
-
|
|
44
43
|
public get hm_instance(): TaroAny {
|
|
45
44
|
if (this.use_weak_hm_instance && this.weak_hm_instance) {
|
|
46
45
|
return this.weak_hm_instance?.deref()
|
|
@@ -56,17 +55,16 @@ export class TaroElement<
|
|
|
56
55
|
this._hm_instance = instance
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
public get _instance () {
|
|
58
|
+
public get _instance() {
|
|
61
59
|
return this.hm_instance
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
public set _instance
|
|
62
|
+
public set _instance(value) {
|
|
65
63
|
this.hm_instance = value
|
|
66
64
|
if (this._nodeInfo.aboutToAppear) {
|
|
67
65
|
let task
|
|
68
66
|
// eslint-disable-next-line no-cond-assign
|
|
69
|
-
while (task = this._nodeInfo.aboutToAppear.shift()) {
|
|
67
|
+
while ((task = this._nodeInfo.aboutToAppear.shift())) {
|
|
70
68
|
task()
|
|
71
69
|
}
|
|
72
70
|
}
|
|
@@ -159,7 +157,7 @@ export class TaroElement<
|
|
|
159
157
|
id: this._nid,
|
|
160
158
|
tagName: this.tagName,
|
|
161
159
|
attribute: name,
|
|
162
|
-
value
|
|
160
|
+
value,
|
|
163
161
|
})
|
|
164
162
|
} else {
|
|
165
163
|
const attributeTriggerValue: TaroAny = ATTRIBUTES_CALLBACK_TRIGGER_MAP[name]
|
|
@@ -266,7 +264,7 @@ export class TaroElement<
|
|
|
266
264
|
if (!this._pseudo_before) {
|
|
267
265
|
this._pseudo_before = new StyleSheet()
|
|
268
266
|
}
|
|
269
|
-
Object.keys(value).forEach(key => {
|
|
267
|
+
Object.keys(value).forEach((key) => {
|
|
270
268
|
this._pseudo_before!.hmStyle[key] = value[key]
|
|
271
269
|
})
|
|
272
270
|
} else {
|
|
@@ -281,7 +279,7 @@ export class TaroElement<
|
|
|
281
279
|
if (!this._pseudo_after) {
|
|
282
280
|
this._pseudo_after = new StyleSheet()
|
|
283
281
|
}
|
|
284
|
-
Object.keys(value).forEach(key => {
|
|
282
|
+
Object.keys(value).forEach((key) => {
|
|
285
283
|
this._pseudo_after!.hmStyle[key] = value[key]
|
|
286
284
|
})
|
|
287
285
|
} else {
|
|
@@ -299,7 +297,7 @@ export class TaroElement<
|
|
|
299
297
|
if (!this._pseudo_class[name]) {
|
|
300
298
|
this._pseudo_class[name] = new StyleSheet()
|
|
301
299
|
}
|
|
302
|
-
Object.keys(value).forEach(key => {
|
|
300
|
+
Object.keys(value).forEach((key) => {
|
|
303
301
|
this._pseudo_class[name]!.hmStyle[key] = value[key]
|
|
304
302
|
})
|
|
305
303
|
} else {
|
|
@@ -307,7 +305,7 @@ export class TaroElement<
|
|
|
307
305
|
}
|
|
308
306
|
}
|
|
309
307
|
|
|
310
|
-
get currentLayerNode
|
|
308
|
+
get currentLayerNode() {
|
|
311
309
|
if (!this._page) return null
|
|
312
310
|
if (typeof this._page.tabBarCurrentIndex !== 'undefined') {
|
|
313
311
|
this._page.layerNode ||= []
|
|
@@ -320,7 +318,7 @@ export class TaroElement<
|
|
|
320
318
|
}
|
|
321
319
|
}
|
|
322
320
|
|
|
323
|
-
get currentLayerParents
|
|
321
|
+
get currentLayerParents() {
|
|
324
322
|
if (!this._page) return null
|
|
325
323
|
if (typeof this._page.tabBarCurrentIndex !== 'undefined') {
|
|
326
324
|
this._page.layerParents ||= {}
|
|
@@ -337,7 +335,7 @@ export class TaroElement<
|
|
|
337
335
|
// 1、appendChild的时候会判断是否需要设置层级
|
|
338
336
|
// 2、taro-react的setProperty,在处理属性变化的时候,会判断是否需要设置层级
|
|
339
337
|
// 3、removeChild的时候,会判断是否需要移除层级
|
|
340
|
-
public setLayer
|
|
338
|
+
public setLayer(value: number) {
|
|
341
339
|
if (!this.parentNode) return // 没有父节点,不需要设置层级关系
|
|
342
340
|
|
|
343
341
|
const currentPage = getPageById(this.getAttribute('__fixed'))
|
|
@@ -359,7 +357,7 @@ export class TaroElement<
|
|
|
359
357
|
generateLayerParentIds(_parentRecord, this)
|
|
360
358
|
currentLayerParents[this.getStrNid()] = _parentRecord
|
|
361
359
|
} else {
|
|
362
|
-
const idx = currentLayerNode.childNodes.findIndex(n => n.getStrNid() === this.getStrNid())
|
|
360
|
+
const idx = currentLayerNode.childNodes.findIndex((n) => n.getStrNid() === this.getStrNid())
|
|
363
361
|
currentLayerNode.childNodes.splice(idx, 1)
|
|
364
362
|
currentLayerNode.notifyDataDelete(idx)
|
|
365
363
|
|
|
@@ -385,7 +383,7 @@ export class TaroElement<
|
|
|
385
383
|
delete currentLayerParents[this.getStrNid()]
|
|
386
384
|
this.setLayer(0)
|
|
387
385
|
} else {
|
|
388
|
-
Object.keys(currentLayerParents).forEach(fixedId => {
|
|
386
|
+
Object.keys(currentLayerParents).forEach((fixedId) => {
|
|
389
387
|
const parentIds = currentLayerParents[fixedId]
|
|
390
388
|
if (parentIds[this.getStrNid()]) {
|
|
391
389
|
// 需要移除fixedId
|
|
@@ -401,7 +399,7 @@ export class TaroElement<
|
|
|
401
399
|
}
|
|
402
400
|
|
|
403
401
|
// 设置动画
|
|
404
|
-
public setAnimation
|
|
402
|
+
public setAnimation(playing) {
|
|
405
403
|
if (!this._instance) {
|
|
406
404
|
if (!this._nodeInfo.aboutToAppear) {
|
|
407
405
|
this._nodeInfo.aboutToAppear = []
|
|
@@ -436,41 +434,50 @@ export class TaroElement<
|
|
|
436
434
|
this.parentNode.notifyDataDelete(idx)
|
|
437
435
|
|
|
438
436
|
// 下一帧播放,等实例被移除掉,再重新插入
|
|
439
|
-
setTimeout(
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
437
|
+
setTimeout(
|
|
438
|
+
() => {
|
|
439
|
+
// insert
|
|
440
|
+
this.parentNode?.childNodes.splice(idx, 0, this)
|
|
441
|
+
this.parentNode?.notifyDataAdd(idx)
|
|
442
|
+
|
|
443
|
+
// 执行动画
|
|
444
|
+
if (playing) {
|
|
445
|
+
this.playAnimation()
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
playing ? 0 : 100
|
|
449
|
+
)
|
|
449
450
|
}
|
|
450
451
|
}
|
|
451
452
|
|
|
452
|
-
private playAnimation
|
|
453
|
+
private playAnimation() {
|
|
453
454
|
const {
|
|
454
|
-
animationDuration = 0,
|
|
455
|
-
|
|
455
|
+
animationDuration = 0,
|
|
456
|
+
animationDelay = 0,
|
|
457
|
+
animationIterationCount = 1,
|
|
458
|
+
animationName: keyframes,
|
|
459
|
+
animationTimingFunction,
|
|
456
460
|
} = this._st.hmStyle
|
|
457
461
|
|
|
458
462
|
if (keyframes) {
|
|
459
463
|
let cur_percentage = 0
|
|
460
|
-
this._instance.getUIContext()?.keyframeAnimateTo(
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
464
|
+
this._instance.getUIContext()?.keyframeAnimateTo(
|
|
465
|
+
{
|
|
466
|
+
delay: animationDelay,
|
|
467
|
+
iterations: animationIterationCount,
|
|
468
|
+
},
|
|
469
|
+
keyframes.map((item) => {
|
|
470
|
+
const duration = (item.percentage - cur_percentage) * animationDuration
|
|
471
|
+
cur_percentage = item.percentage
|
|
472
|
+
return {
|
|
473
|
+
duration: duration,
|
|
474
|
+
curve: item.event.animationTimingFunction || animationTimingFunction,
|
|
475
|
+
event: () => {
|
|
476
|
+
this._instance.overwriteStyle = item.event
|
|
477
|
+
},
|
|
471
478
|
}
|
|
472
|
-
}
|
|
473
|
-
|
|
479
|
+
})
|
|
480
|
+
)
|
|
474
481
|
}
|
|
475
482
|
}
|
|
476
483
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/plugin-platform-harmony-ets",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.9-alpha.2",
|
|
4
4
|
"description": "OpenHarmony & 鸿蒙系统插件",
|
|
5
5
|
"author": "O2Team",
|
|
6
6
|
"homepage": "https://gitee.com/openharmony-sig/taro",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"webpack-sources": "^3.2.3",
|
|
28
28
|
"@babel/preset-react": "^7.24.1",
|
|
29
29
|
"webpack": "5.91.0",
|
|
30
|
-
"@tarojs/
|
|
31
|
-
"@tarojs/
|
|
32
|
-
"@tarojs/runtime": "4.0.
|
|
33
|
-
"@tarojs/service": "4.0.
|
|
34
|
-
"@tarojs/
|
|
35
|
-
"@tarojs/
|
|
36
|
-
"@tarojs/
|
|
30
|
+
"@tarojs/components": "4.0.9-alpha.2",
|
|
31
|
+
"@tarojs/helper": "4.0.9-alpha.2",
|
|
32
|
+
"@tarojs/runtime": "4.0.9-alpha.2",
|
|
33
|
+
"@tarojs/service": "4.0.9-alpha.2",
|
|
34
|
+
"@tarojs/runner-utils": "4.0.9-alpha.2",
|
|
35
|
+
"@tarojs/shared": "4.0.9-alpha.2",
|
|
36
|
+
"@tarojs/taro": "4.0.9-alpha.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"fast-glob": "^3.3.1",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"rollup-plugin-ts": "^3.4.5",
|
|
43
43
|
"solid-js": "^1.8.16",
|
|
44
44
|
"tslib": "^2.4.0",
|
|
45
|
-
"rollup-plugin-copy": "4.0.
|
|
45
|
+
"rollup-plugin-copy": "4.0.9-alpha.2"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"prod": "pnpm run build",
|