@tarojs/plugin-platform-harmony-ets 4.0.0-beta.43 → 4.0.0-beta.45
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 +1 -1
- package/dist/components-harmony-ets/pseudo.ets +1 -1
- package/dist/components-harmony-ets/style.ets +49 -49
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/dom/bind.ts +11 -7
- package/dist/runtime-ets/dom/element/element.ts +76 -1
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +8 -4
- package/dist/runtime-ets/dom/stylesheet/type.ts +3 -1
- package/dist/runtime-ets/utils/index.ts +1 -1
- package/dist/runtime-framework/react/native-page.ts +10 -2
- package/dist/runtime-utils.js +1 -1
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
package/dist/apis/base/system.ts
CHANGED
|
@@ -35,7 +35,7 @@ let windowRect
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const top = Math.max(...boundingRects.map(rect => rect.top + rect.height), waterfallDisplayAreaRects.top?.top + waterfallDisplayAreaRects.top?.height, statusBarHeight)
|
|
38
|
-
const bottom = display.height -
|
|
38
|
+
const bottom = Math.min(display.height - waterfallDisplayAreaRects.bottom?.top, navigationIndicatorRect?.top)
|
|
39
39
|
const left = waterfallDisplayAreaRects.left?.left + waterfallDisplayAreaRects.left?.width
|
|
40
40
|
const right = display.width - waterfallDisplayAreaRects.right?.left
|
|
41
41
|
safeArea = {
|
|
@@ -25,7 +25,7 @@ function textNormalFontStyle (style: TaroStyleType) {
|
|
|
25
25
|
.fontStyle(style.fontStyle)
|
|
26
26
|
.fontFamily(style.fontFamily)
|
|
27
27
|
.decoration({
|
|
28
|
-
type: style.textDecoration,
|
|
28
|
+
type: style.textDecoration?.type || TextDecorationType.None,
|
|
29
29
|
color: style.color
|
|
30
30
|
})
|
|
31
31
|
}
|
|
@@ -151,26 +151,26 @@ class ColumnStyleModify extends CommonStyleModify {
|
|
|
151
151
|
|
|
152
152
|
export function setAnimationAttributeIntoInstance(instance: CommonAttribute, overwriteStyle: Record<string, TaroAny>, style: TaroStyleType) {
|
|
153
153
|
// Animation 需要提前和 @State 变量绑定才能产生动画效果,因此不能做 if else 判断
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
154
|
+
instance.translate({
|
|
155
|
+
x: overwriteStyle.transform?.Translate?.x || style.transform?.Translate?.x,
|
|
156
|
+
y: overwriteStyle.transform?.Translate?.y || style.transform?.Translate?.y,
|
|
157
|
+
z: overwriteStyle.transform?.Translate?.z || style.transform?.Translate?.z,
|
|
158
|
+
})
|
|
159
|
+
instance.scale({
|
|
160
|
+
x: overwriteStyle.transform?.Scale?.x || style.transform?.Scale?.x,
|
|
161
|
+
y: overwriteStyle.transform?.Scale?.y || style.transform?.Scale?.y,
|
|
162
|
+
z: overwriteStyle.transform?.Scale?.z || style.transform?.Scale?.z,
|
|
163
|
+
centerX: overwriteStyle.transformOrigin?.x || style.transformOrigin?.x || 0,
|
|
164
|
+
centerY: overwriteStyle.transformOrigin?.y || style.transformOrigin?.y || 0,
|
|
165
|
+
})
|
|
166
|
+
instance.rotate({
|
|
167
|
+
x: overwriteStyle.transform?.Rotate?.x || style.transform?.Rotate?.x,
|
|
168
|
+
y: overwriteStyle.transform?.Rotate?.y || style.transform?.Rotate?.y,
|
|
169
|
+
z: overwriteStyle.transform?.Rotate?.z || style.transform?.Rotate?.z,
|
|
170
|
+
centerX: overwriteStyle.transformOrigin?.x || style.transformOrigin?.x || 0,
|
|
171
|
+
centerY: overwriteStyle.transformOrigin?.y || style.transformOrigin?.y || 0,
|
|
172
|
+
angle: overwriteStyle.transform?.Rotate?.angle || style.transform?.Rotate?.angle || 0,
|
|
173
|
+
})
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
export function setNormalTextAttributeIntoInstance(instance: TextAttribute | SpanAttribute, style: HarmonyStyle, node?: TaroTextElement | null) {
|
|
@@ -191,7 +191,7 @@ export function setNormalTextAttributeIntoInstance(instance: TextAttribute | Spa
|
|
|
191
191
|
}
|
|
192
192
|
if (!isUndefined(style.textDecoration)) {
|
|
193
193
|
instance.decoration({
|
|
194
|
-
type: style.textDecoration,
|
|
194
|
+
type: style.textDecoration.type,
|
|
195
195
|
color: style.color
|
|
196
196
|
})
|
|
197
197
|
}
|
|
@@ -366,34 +366,34 @@ export function setNormalAttributeIntoInstance(instance: CommonAttribute, style:
|
|
|
366
366
|
// 为了适应position不设置z-index也能高于同层级组件,估且让设置了z-index的会更高一级
|
|
367
367
|
instance.zIndex(style.zIndex + 1)
|
|
368
368
|
}
|
|
369
|
-
if (!isUndefined(style.transform)) {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
369
|
+
// if (!isUndefined(style.transform)) {
|
|
370
|
+
// if (style.transform.Translate) {
|
|
371
|
+
// instance.translate({
|
|
372
|
+
// x: style.transform.Translate.x || 0,
|
|
373
|
+
// y: style.transform.Translate.y || 0,
|
|
374
|
+
// z: style.transform.Translate.z || 0,
|
|
375
|
+
// })
|
|
376
|
+
// }
|
|
377
|
+
// if (style.transform.Scale) {
|
|
378
|
+
// instance.scale({
|
|
379
|
+
// x: style.transform.Scale.x || 0,
|
|
380
|
+
// y: style.transform.Scale.y || 0,
|
|
381
|
+
// z: style.transform.Scale.z || 0,
|
|
382
|
+
// centerX: style.transformOrigin?.x || 0,
|
|
383
|
+
// centerY: style.transformOrigin?.y || 0,
|
|
384
|
+
// })
|
|
385
|
+
// }
|
|
386
|
+
// if (style.transform.Rotate) {
|
|
387
|
+
// instance.rotate({
|
|
388
|
+
// x: style.transform.Rotate.x || 0,
|
|
389
|
+
// y: style.transform.Rotate.y || 0,
|
|
390
|
+
// z: style.transform.Rotate.z || 0,
|
|
391
|
+
// centerX: style.transformOrigin?.x || 0,
|
|
392
|
+
// centerY: style.transformOrigin?.y || 0,
|
|
393
|
+
// angle: style.transform.Rotate.angle
|
|
394
|
+
// })
|
|
395
|
+
// }
|
|
396
|
+
// }
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
export const pseudoModify = new PseudoStyleModify()
|
package/dist/index.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ declare class Harmony extends TaroPlatformHarmony {
|
|
|
70
70
|
indexOfLibraries(lib: string): number;
|
|
71
71
|
removeFromLibraries(lib: string): void;
|
|
72
72
|
moveLibraries(lib: string, target?: string, basedir?: string, sync?: boolean): void;
|
|
73
|
-
replaceDefineValue(code: string, define: Record<string, string
|
|
73
|
+
replaceDefineValue(code: string, define: Record<string, string>, ext?: string): string;
|
|
74
74
|
/**
|
|
75
75
|
* 修改 Vite 配置
|
|
76
76
|
*/
|
package/dist/index.js
CHANGED
|
@@ -506,8 +506,10 @@ let Harmony$1 = class Harmony extends TaroPlatformHarmony {
|
|
|
506
506
|
if ([/(@tarojs[\\/]runtime|taro-runtime)[\\/]dist/].some(e => e.test(lib))) {
|
|
507
507
|
define.global = 'globalThis';
|
|
508
508
|
}
|
|
509
|
-
code = this.replaceDefineValue(code, define);
|
|
510
509
|
const ext = path__namespace.extname(target);
|
|
510
|
+
if (![/d\.e?tsx?$/, /\.(json|md)$/].some(e => e.test(target))) {
|
|
511
|
+
code = this.replaceDefineValue(code, define, ext);
|
|
512
|
+
}
|
|
511
513
|
if (['.ts'].includes(ext)) {
|
|
512
514
|
code = '// @ts-nocheck\n' + code;
|
|
513
515
|
}
|
|
@@ -556,9 +558,13 @@ declare global {
|
|
|
556
558
|
this.moveLibraries(realPath, target, basedir);
|
|
557
559
|
}
|
|
558
560
|
}
|
|
559
|
-
replaceDefineValue(code, define) {
|
|
561
|
+
replaceDefineValue(code, define, ext = '.js') {
|
|
560
562
|
Object.keys(define).forEach(key => {
|
|
561
|
-
|
|
563
|
+
let value = define[key];
|
|
564
|
+
if (/^['"`].*['"`]$/.test(value) && ['.ts', '.tsx', '.ets'].includes(ext)) {
|
|
565
|
+
value = `(${value} as string)`;
|
|
566
|
+
}
|
|
567
|
+
code = code.replace(new RegExp(`\\b${key}\\b`, 'g'), value);
|
|
562
568
|
});
|
|
563
569
|
return code;
|
|
564
570
|
}
|