@tarojs/plugin-platform-harmony-ets 4.0.0-beta.19 → 4.0.0-beta.20
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/wxml/IntersectionObserver.ts +5 -3
- package/dist/components-harmony-ets/button.ets +3 -2
- package/dist/components-harmony-ets/checkbox.ets +6 -3
- package/dist/components-harmony-ets/form.ets +5 -4
- package/dist/components-harmony-ets/icon.ets +8 -4
- package/dist/components-harmony-ets/image.ets +2 -0
- package/dist/components-harmony-ets/innerHtml.ets +5 -4
- package/dist/components-harmony-ets/input.ets +6 -4
- package/dist/components-harmony-ets/label.ets +5 -4
- package/dist/components-harmony-ets/movableArea.ets +8 -31
- package/dist/components-harmony-ets/movableView.ets +8 -31
- package/dist/components-harmony-ets/picker.ets +21 -16
- package/dist/components-harmony-ets/progress.ets +2 -0
- package/dist/components-harmony-ets/pseudo.ets +38 -31
- package/dist/components-harmony-ets/radio.ets +6 -3
- package/dist/components-harmony-ets/richText.ets +3 -1
- package/dist/components-harmony-ets/scrollView.ets +15 -36
- package/dist/components-harmony-ets/slider.ets +4 -2
- package/dist/components-harmony-ets/style.ets +62 -27
- package/dist/components-harmony-ets/swiper.ets +3 -2
- package/dist/components-harmony-ets/switch.ets +3 -1
- package/dist/components-harmony-ets/text.ets +10 -8
- package/dist/components-harmony-ets/textArea.ets +6 -4
- package/dist/components-harmony-ets/utils/helper.ets +3 -2
- package/dist/components-harmony-ets/utils/styles.ets +25 -93
- package/dist/components-harmony-ets/video.ets +2 -0
- package/dist/components-harmony-ets/view.ets +11 -32
- package/dist/components-harmony-ets/webView.ets +3 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/dom/cssNesting.ts +36 -10
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +15 -40
- package/dist/runtime-ets/dom/document.ts +0 -3
- package/dist/runtime-ets/dom/element/element.ts +6 -5
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +152 -217
- package/dist/runtime-ets/dom/stylesheet/index.ts +17 -315
- package/dist/runtime-ets/dom/stylesheet/type.ts +6 -2
- package/dist/runtime-ets/index.ts +1 -1
- package/dist/runtime-ets/utils/index.ts +24 -8
- package/dist/runtime-framework/react/native-page.ts +6 -4
- package/dist/runtime-utils.js +4 -3
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +4 -3
- package/dist/runtime.js.map +1 -1
- package/package.json +8 -8
|
@@ -1,36 +1,17 @@
|
|
|
1
1
|
import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { rowModify, columnModify } from './style'
|
|
4
4
|
import PseduoChildren from './pseudo'
|
|
5
|
-
import { createLazyChildren } from './render'
|
|
6
5
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
7
6
|
import { FlexManager } from './utils/flexManager'
|
|
8
|
-
import { getNodeThresholds,
|
|
7
|
+
import { getNodeThresholds, shouldBindEvent } from './utils/helper'
|
|
9
8
|
|
|
10
|
-
import type { TaroViewElement,
|
|
11
|
-
|
|
12
|
-
@Extend(Row)
|
|
13
|
-
function rowAttrs (style: TaroStyleType) {
|
|
14
|
-
.constraintSize({
|
|
15
|
-
minWidth: style.minWidth || style.width,
|
|
16
|
-
maxWidth: style.maxWidth,
|
|
17
|
-
minHeight: style.minHeight,
|
|
18
|
-
maxHeight: style.maxHeight
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@Extend(Column)
|
|
23
|
-
function columnAttrs (style: TaroStyleType) {
|
|
24
|
-
.constraintSize({
|
|
25
|
-
minWidth: style.minWidth,
|
|
26
|
-
maxWidth: style.maxWidth,
|
|
27
|
-
minHeight: style.minHeight || style.height,
|
|
28
|
-
maxHeight: style.maxHeight
|
|
29
|
-
})
|
|
30
|
-
}
|
|
9
|
+
import type { TaroViewElement, TaroAny } from '@tarojs/runtime'
|
|
31
10
|
|
|
32
11
|
@Component
|
|
33
12
|
export default struct TaroView {
|
|
13
|
+
@Builder customBuilder() {}
|
|
14
|
+
@BuilderParam createLazyChildren: (node: TaroViewElement) => void = this.customBuilder
|
|
34
15
|
@ObjectLink node: TaroViewElement
|
|
35
16
|
|
|
36
17
|
build () {
|
|
@@ -38,13 +19,12 @@ export default struct TaroView {
|
|
|
38
19
|
if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
|
|
39
20
|
Row() {
|
|
40
21
|
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
41
|
-
PseduoChildren(this.node)
|
|
22
|
+
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
42
23
|
} else {
|
|
43
|
-
createLazyChildren(this.node)
|
|
24
|
+
this.createLazyChildren(this.node)
|
|
44
25
|
}
|
|
45
26
|
}
|
|
46
|
-
.attributeModifier(
|
|
47
|
-
.rowAttrs(getNormalAttributes(this.node))
|
|
27
|
+
.attributeModifier(rowModify.setNode(this.node))
|
|
48
28
|
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
49
29
|
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
50
30
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
@@ -56,13 +36,12 @@ export default struct TaroView {
|
|
|
56
36
|
} else {
|
|
57
37
|
Column() {
|
|
58
38
|
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
59
|
-
PseduoChildren(this.node)
|
|
39
|
+
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
60
40
|
} else {
|
|
61
|
-
createLazyChildren(this.node)
|
|
41
|
+
this.createLazyChildren(this.node)
|
|
62
42
|
}
|
|
63
43
|
}
|
|
64
|
-
.attributeModifier(
|
|
65
|
-
.columnAttrs(getNormalAttributes(this.node))
|
|
44
|
+
.attributeModifier(columnModify.setNode(this.node))
|
|
66
45
|
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
67
46
|
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
68
47
|
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
@@ -16,6 +16,8 @@ interface IError {
|
|
|
16
16
|
|
|
17
17
|
@Component
|
|
18
18
|
export default struct TaroWebView {
|
|
19
|
+
@Builder customBuilder() {}
|
|
20
|
+
@BuilderParam createLazyChildren: (node: TaroWebViewElement) => void = this.customBuilder
|
|
19
21
|
@ObjectLink node: TaroWebViewElement
|
|
20
22
|
|
|
21
23
|
build () {
|
|
@@ -43,7 +45,7 @@ export default struct TaroWebView {
|
|
|
43
45
|
})
|
|
44
46
|
.onErrorReceive(shouldBindEvent((e: IError) => {
|
|
45
47
|
const event: TaroEvent = createTaroEvent('error', { detail: { url: this.node._attrs.src, fullUrl: e.request.getRequestUrl() } }, this.node)
|
|
46
|
-
|
|
48
|
+
|
|
47
49
|
eventHandler(event, 'error', this.node)
|
|
48
50
|
}, this.node, ['error']))
|
|
49
51
|
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ declare class Harmony extends TaroPlatformHarmony {
|
|
|
53
53
|
get framework(): "vue3" | "react" | "preact" | "nerv" | "vue";
|
|
54
54
|
get aliasFramework(): string;
|
|
55
55
|
get apiLibrary(): string;
|
|
56
|
+
get apiEntry(): RegExp[];
|
|
56
57
|
get componentLibrary(): string;
|
|
57
58
|
get runtimeLibrary(): string;
|
|
58
59
|
get runtimeFrameworkLibrary(): string;
|
|
@@ -64,6 +65,7 @@ declare class Harmony extends TaroPlatformHarmony {
|
|
|
64
65
|
RegExp,
|
|
65
66
|
string?
|
|
66
67
|
][];
|
|
68
|
+
harmonyScope: RegExp[];
|
|
67
69
|
indexOfLibraries(lib: string): number;
|
|
68
70
|
removeFromLibraries(lib: string): void;
|
|
69
71
|
moveLibraries(lib: string, target?: string, basedir?: string, sync?: boolean): void;
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var helper = require('@tarojs/helper');
|
|
6
6
|
var path = require('node:path');
|
|
7
7
|
var runnerUtils = require('@tarojs/runner-utils');
|
|
8
|
-
var shared = require('@tarojs/shared');
|
|
9
8
|
var service = require('@tarojs/service');
|
|
10
9
|
var _package = require('@tarojs/service/dist/utils/package');
|
|
10
|
+
var shared = require('@tarojs/shared');
|
|
11
11
|
var webpackSources = require('webpack-sources');
|
|
12
12
|
var template = require('@tarojs/shared/dist/template');
|
|
13
13
|
|
|
@@ -317,6 +317,7 @@ let Harmony$1 = class Harmony extends TaroPlatformHarmony {
|
|
|
317
317
|
['react', /^react$|react[\\/]cjs/],
|
|
318
318
|
['react/jsx-runtime', /^react[\\/]jsx-runtime$/], // Note: React 环境下自动注入,避免重复
|
|
319
319
|
];
|
|
320
|
+
this.harmonyScope = [...HARMONY_SCOPES];
|
|
320
321
|
const that = this;
|
|
321
322
|
this.setupTransaction.addWrapper({
|
|
322
323
|
close() {
|
|
@@ -337,6 +338,11 @@ let Harmony$1 = class Harmony extends TaroPlatformHarmony {
|
|
|
337
338
|
get apiLibrary() {
|
|
338
339
|
return path__namespace.resolve(__dirname, './apis');
|
|
339
340
|
}
|
|
341
|
+
get apiEntry() {
|
|
342
|
+
return [
|
|
343
|
+
/(@tarojs[\\/]plugin-platform-harmony-ets|taro-platform-harmony)[\\/]dist[\\/]apis[\\/]index\.ts/,
|
|
344
|
+
];
|
|
345
|
+
}
|
|
340
346
|
get componentLibrary() {
|
|
341
347
|
return path__namespace.resolve(__dirname, './components-harmony-ets');
|
|
342
348
|
}
|
|
@@ -475,8 +481,7 @@ let Harmony$1 = class Harmony extends TaroPlatformHarmony {
|
|
|
475
481
|
}
|
|
476
482
|
else if (stat.isFile()) {
|
|
477
483
|
let code = helper.fs.readFileSync(lib, { encoding: 'utf8' });
|
|
478
|
-
|
|
479
|
-
if ([/(@tarojs[\\/]plugin-platform-harmony-ets|taro-platform-harmony)[\\/]dist[\\/]apis[\\/]index\.ts/].some(e => e.test(lib))) {
|
|
484
|
+
if (this.apiEntry.some(e => e.test(lib))) {
|
|
480
485
|
code = apiLoader(code);
|
|
481
486
|
}
|
|
482
487
|
if (this.extensions.includes(path__namespace.extname(lib))) {
|
|
@@ -485,7 +490,7 @@ let Harmony$1 = class Harmony extends TaroPlatformHarmony {
|
|
|
485
490
|
const { outputRoot } = this.ctx.runOpts.config;
|
|
486
491
|
const targetPath = path__namespace.join(outputRoot, helper.NODE_MODULES, p1);
|
|
487
492
|
const relativePath = parseRelativePath(path__namespace.dirname(target), targetPath);
|
|
488
|
-
if (
|
|
493
|
+
if (this.harmonyScope.every(e => !e.test(p1))) {
|
|
489
494
|
if (this.indexOfLibraries(p1) === -1 && !/\.(d\.ts|flow\.js)$/.test(lib)) {
|
|
490
495
|
this.externalDeps.push([p1, new RegExp(`^${p1.replace(/([-\\/$])/g, '\\$1')}$`)]);
|
|
491
496
|
this.moveLibraries(p1, targetPath, path__namespace.dirname(lib), true);
|
|
@@ -579,7 +584,7 @@ declare global {
|
|
|
579
584
|
]);
|
|
580
585
|
}
|
|
581
586
|
const externals = Object.keys(ohPackage.dependencies || []).concat(Object.keys(ohPackage.devDependencies || []));
|
|
582
|
-
function modifyResolveId({ source = '',
|
|
587
|
+
function modifyResolveId({ source = '', name = 'modifyResolveId' }) {
|
|
583
588
|
if (externals.includes(source)) {
|
|
584
589
|
return {
|
|
585
590
|
external: true,
|
|
@@ -594,11 +599,6 @@ declare global {
|
|
|
594
599
|
resolvedBy: name,
|
|
595
600
|
};
|
|
596
601
|
}
|
|
597
|
-
if (shared.isFunction(resolve)) {
|
|
598
|
-
if (source === that.runtimePath || that.runtimePath.includes(source)) {
|
|
599
|
-
return resolve('@tarojs/runtime', importer, options);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
602
|
// Note: 映射 Taro 相关依赖到注入 taro 目录
|
|
603
603
|
if (that.indexOfLibraries(source) > -1) {
|
|
604
604
|
return {
|