@tarojs/plugin-platform-harmony-ets 4.0.0-beta.2 → 4.0.0-beta.21

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.
Files changed (87) hide show
  1. package/dist/apis/base/system.ts +53 -20
  2. package/dist/apis/framework/index.ts +1 -5
  3. package/dist/apis/index.ts +3 -1
  4. package/dist/apis/network/request.ts +5 -5
  5. package/dist/apis/route/index.ts +15 -0
  6. package/dist/apis/storage/index.ts +124 -60
  7. package/dist/apis/wxml/IntersectionObserver.ts +5 -3
  8. package/dist/apis/wxml/index.ts +2 -0
  9. package/dist/components-harmony-ets/button.ets +41 -78
  10. package/dist/components-harmony-ets/checkbox.ets +19 -209
  11. package/dist/components-harmony-ets/form.ets +38 -160
  12. package/dist/components-harmony-ets/icon.ets +31 -83
  13. package/dist/components-harmony-ets/image.ets +22 -78
  14. package/dist/components-harmony-ets/innerHtml.ets +11 -6
  15. package/dist/components-harmony-ets/input.ets +10 -67
  16. package/dist/components-harmony-ets/label.ets +52 -173
  17. package/dist/components-harmony-ets/movableArea.ets +89 -0
  18. package/dist/components-harmony-ets/movableView.ets +67 -0
  19. package/dist/components-harmony-ets/picker.ets +32 -147
  20. package/dist/components-harmony-ets/progress.ets +47 -0
  21. package/dist/components-harmony-ets/pseudo.ets +80 -0
  22. package/dist/components-harmony-ets/radio.ets +19 -210
  23. package/dist/components-harmony-ets/richText.ets +22 -102
  24. package/dist/components-harmony-ets/scrollView.ets +66 -169
  25. package/dist/components-harmony-ets/slider.ets +10 -72
  26. package/dist/components-harmony-ets/style.ets +244 -0
  27. package/dist/components-harmony-ets/swiper.ets +30 -87
  28. package/dist/components-harmony-ets/switch.ets +9 -71
  29. package/dist/components-harmony-ets/text.ets +38 -89
  30. package/dist/components-harmony-ets/textArea.ets +10 -67
  31. package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
  32. package/dist/components-harmony-ets/utils/DynamicCenter.ts +1 -1
  33. package/dist/components-harmony-ets/utils/flexManager.ets +8 -7
  34. package/dist/components-harmony-ets/utils/helper.ets +5 -4
  35. package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
  36. package/dist/components-harmony-ets/utils/index.ts +55 -2
  37. package/dist/components-harmony-ets/utils/styles.ets +45 -85
  38. package/dist/components-harmony-ets/video.ets +33 -88
  39. package/dist/components-harmony-ets/view.ets +47 -160
  40. package/dist/components-harmony-ets/webView.ets +44 -99
  41. package/dist/index.d.ts +151 -0
  42. package/dist/index.js +58 -29
  43. package/dist/index.js.map +1 -1
  44. package/dist/runtime-ets/bom/window.ts +4 -2
  45. package/dist/runtime-ets/current.ts +2 -0
  46. package/dist/runtime-ets/dom/bind.ts +0 -1
  47. package/dist/runtime-ets/dom/cssNesting.ts +311 -0
  48. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +15 -40
  49. package/dist/runtime-ets/dom/document.ts +21 -8
  50. package/dist/runtime-ets/dom/element/element.ts +53 -9
  51. package/dist/runtime-ets/dom/element/form.ts +11 -4
  52. package/dist/runtime-ets/dom/element/index.ts +12 -1
  53. package/dist/runtime-ets/dom/element/movableArea.ts +12 -0
  54. package/dist/runtime-ets/dom/element/movableView.ts +193 -0
  55. package/dist/runtime-ets/dom/element/normal.ts +8 -3
  56. package/dist/runtime-ets/dom/element/progress.ts +13 -0
  57. package/dist/runtime-ets/dom/element/scrollView.ts +1 -0
  58. package/dist/runtime-ets/dom/element/text.ts +1 -0
  59. package/dist/runtime-ets/dom/element/video.ts +1 -0
  60. package/dist/runtime-ets/dom/element/webView.ts +8 -0
  61. package/dist/runtime-ets/dom/event.ts +0 -1
  62. package/dist/runtime-ets/dom/eventTarget.ts +0 -3
  63. package/dist/runtime-ets/dom/node.ts +18 -17
  64. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +184 -207
  65. package/dist/runtime-ets/dom/stylesheet/index.ts +28 -308
  66. package/dist/runtime-ets/dom/stylesheet/type.ts +18 -6
  67. package/dist/runtime-ets/dom/stylesheet/util.ts +19 -15
  68. package/dist/runtime-ets/index.ts +2 -2
  69. package/dist/runtime-ets/interface/event.ts +1 -1
  70. package/dist/runtime-ets/utils/index.ts +24 -9
  71. package/dist/runtime-framework/react/app.ts +5 -1
  72. package/dist/runtime-framework/react/hooks.ts +3 -3
  73. package/dist/runtime-framework/react/native-page.ts +14 -9
  74. package/dist/runtime-framework/react/page.ts +1 -0
  75. package/dist/runtime-framework/solid/hooks.ts +3 -3
  76. package/dist/runtime-framework/solid/reconciler/use.ts +0 -1
  77. package/dist/runtime-framework/solid/utils/index.ts +0 -2
  78. package/dist/runtime-utils.d.ts +825 -0
  79. package/dist/runtime-utils.js +185 -91
  80. package/dist/runtime-utils.js.map +1 -1
  81. package/dist/runtime.d.ts +1 -0
  82. package/dist/runtime.js +185 -91
  83. package/dist/runtime.js.map +1 -1
  84. package/index.js +3 -1
  85. package/package.json +10 -10
  86. package/types/index.d.ts +4 -0
  87. package/dist/runtime-ets/utils/bind.ts +0 -24
@@ -1,169 +1,56 @@
1
1
  import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
2
2
 
3
- import { createLazyChildren } from './render'
3
+ import { rowModify, columnModify } from './style'
4
+ import PseduoChildren from './pseudo'
4
5
  import { TOUCH_EVENT_MAP } from './utils/constant/event'
5
- import { FlexManager } from './utils/FlexManager'
6
- import { getNodeThresholds, getNormalAttributes, shouldBindEvent } from './utils/helper'
6
+ import { FlexManager } from './utils/flexManager'
7
+ import { getNodeThresholds, shouldBindEvent } from './utils/helper'
7
8
 
8
- import type { TaroViewElement, TaroAny, TaroStyleType } from '@tarojs/runtime'
9
+ import type { TaroViewElement, TaroAny } from '@tarojs/runtime'
9
10
 
10
- @Extend(Column)
11
- function columnAttrs (style: TaroStyleType) {
12
- .id(style.id)
13
- .key(style.id)
14
- .flexGrow(style.flexGrow)
15
- .flexShrink(style.flexShrink)
16
- .flexBasis(style.flexBasis)
17
- .alignSelf(style.alignSelf)
18
- .padding({
19
- top: style.paddingTop,
20
- right: style.paddingRight,
21
- bottom: style.paddingBottom,
22
- left: style.paddingLeft
23
- })
24
- .margin({
25
- top: style.marginTop,
26
- right: style.marginRight,
27
- bottom: style.marginBottom,
28
- left: style.marginLeft
29
- })
30
- .width(style.width)
31
- .height(style.height)
32
- .constraintSize({
33
- minWidth: style.minWidth,
34
- maxWidth: style.maxWidth,
35
- minHeight: style.minHeight,
36
- maxHeight: style.maxHeight
37
- })
38
- .backgroundColor(style.backgroundColor)
39
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
40
- .backgroundImageSize(style.backgroundSize)
41
- .backgroundImagePosition(style.backgroundPosition)
42
- .borderStyle({
43
- top: style.borderTopStyle,
44
- right: style.borderRightStyle,
45
- bottom: style.borderBottomStyle,
46
- left: style.borderLeftStyle
47
- })
48
- .borderWidth({
49
- top: style.borderTopWidth,
50
- right: style.borderRightWidth,
51
- bottom: style.borderBottomWidth,
52
- left: style.borderLeftWidth
53
- })
54
- .borderColor({
55
- top: style.borderTopColor,
56
- right: style.borderRightColor,
57
- bottom: style.borderBottomColor,
58
- left: style.borderLeftColor
59
- })
60
- .borderRadius({
61
- topLeft: style.borderTopLeftRadius,
62
- topRight: style.borderTopRightRadius,
63
- bottomLeft: style.borderBottomLeftRadius,
64
- bottomRight: style.borderBottomRightRadius
65
- })
66
- .zIndex(style.zIndex)
67
- .opacity(style.opacity)
68
- .linearGradient(style.linearGradient)
69
- .clip(style.overflow)
70
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
71
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
72
- .transform(style.transform)
73
- }
74
-
75
- @Extend(Row)
76
- function rowAttrs (style: TaroStyleType) {
77
- .id(style.id)
78
- .key(style.id)
79
- .flexGrow(style.flexGrow)
80
- .flexShrink(style.flexShrink)
81
- .flexBasis(style.flexBasis)
82
- .alignSelf(style.alignSelf)
83
- .padding({
84
- top: style.paddingTop,
85
- right: style.paddingRight,
86
- bottom: style.paddingBottom,
87
- left: style.paddingLeft
88
- })
89
- .margin({
90
- top: style.marginTop,
91
- right: style.marginRight,
92
- bottom: style.marginBottom,
93
- left: style.marginLeft
94
- })
95
- .width(style.width)
96
- .height(style.height)
97
- .constraintSize({
98
- minWidth: style.minWidth,
99
- maxWidth: style.maxWidth,
100
- minHeight: style.minHeight,
101
- maxHeight: style.maxHeight
102
- })
103
- .backgroundColor(style.backgroundColor)
104
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
105
- .backgroundImageSize(style.backgroundSize)
106
- .backgroundImagePosition(style.backgroundPosition)
107
- .borderStyle({
108
- top: style.borderTopStyle,
109
- right: style.borderRightStyle,
110
- bottom: style.borderBottomStyle,
111
- left: style.borderLeftStyle
112
- })
113
- .borderWidth({
114
- top: style.borderTopWidth,
115
- right: style.borderRightWidth,
116
- bottom: style.borderBottomWidth,
117
- left: style.borderLeftWidth
118
- })
119
- .borderColor({
120
- top: style.borderTopColor,
121
- right: style.borderRightColor,
122
- bottom: style.borderBottomColor,
123
- left: style.borderLeftColor
124
- })
125
- .borderRadius({
126
- topLeft: style.borderTopLeftRadius,
127
- topRight: style.borderTopRightRadius,
128
- bottomLeft: style.borderBottomLeftRadius,
129
- bottomRight: style.borderBottomRightRadius
130
- })
131
- .zIndex(style.zIndex)
132
- .opacity(style.opacity)
133
- .linearGradient(style.linearGradient)
134
- .clip(style.overflow)
135
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
136
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
137
- .transform(style.transform)
138
- }
11
+ @Component
12
+ export default struct TaroView {
13
+ @Builder customBuilder() {}
14
+ @BuilderParam createLazyChildren: (node: TaroViewElement) => void = this.customBuilder
15
+ @ObjectLink node: TaroViewElement
139
16
 
140
- @Builder
141
- export default function TaroView (node: TaroViewElement) {
142
- if (FlexManager.isFlexNode(node) && FlexManager.flexOptions(node).direction !== FlexDirection.Column) {
143
- Row() {
144
- createLazyChildren(node)
145
- }
146
- .rowAttrs(getNormalAttributes(node))
147
- .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
148
- .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
149
- .onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
150
- node._nodeInfo.areaInfo = res[1]
151
- }))
152
- .onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
153
- .alignItems(FlexManager.flexOptions(node).alignItems as VerticalAlign)
154
- .justifyContent(FlexManager.flexOptions(node).justifyContent)
155
- } else {
156
- Column() {
157
- createLazyChildren(node)
17
+ build () {
18
+ if (this.node.hmStyle?.display !== 'none') {
19
+ if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
20
+ Row() {
21
+ if (this.node._pseudo_before || this.node._pseudo_after) {
22
+ PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
23
+ } else {
24
+ this.createLazyChildren(this.node)
25
+ }
26
+ }
27
+ .attributeModifier(rowModify.setNode(this.node))
28
+ .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
29
+ .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
30
+ .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
31
+ this.node._nodeInfo.areaInfo = res[1]
32
+ }))
33
+ .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
34
+ .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
35
+ .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
36
+ } else {
37
+ Column() {
38
+ if (this.node._pseudo_before || this.node._pseudo_after) {
39
+ PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
40
+ } else {
41
+ this.createLazyChildren(this.node)
42
+ }
43
+ }
44
+ .attributeModifier(columnModify.setNode(this.node))
45
+ .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
46
+ .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
47
+ .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
48
+ this.node._nodeInfo.areaInfo = res[1]
49
+ }))
50
+ .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
51
+ .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
52
+ .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
53
+ }
158
54
  }
159
- .columnAttrs(getNormalAttributes(node))
160
- .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
161
- .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
162
- .onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
163
- node._nodeInfo.areaInfo = res[1]
164
- }))
165
- .onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
166
- .alignItems(FlexManager.flexOptions(node).alignItems as HorizontalAlign)
167
- .justifyContent(FlexManager.flexOptions(node).justifyContent)
168
55
  }
169
56
  }
@@ -1,8 +1,9 @@
1
1
  import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME, createTaroEvent } from '@tarojs/runtime'
2
2
 
3
- import { getNormalAttributes, shouldBindEvent, getNodeThresholds } from './utils/helper'
3
+ import commonStyleModify from './style'
4
+ import { shouldBindEvent, getNodeThresholds } from './utils/helper'
4
5
 
5
- import type { TaroAny, TaroWebViewElement, TaroStyleType, TaroEvent } from '@tarojs/runtime'
6
+ import type { TaroAny, TaroWebViewElement, TaroEvent } from '@tarojs/runtime'
6
7
 
7
8
  interface IPageLoad {
8
9
  url: string
@@ -13,101 +14,45 @@ interface IError {
13
14
  error: WebResourceError
14
15
  }
15
16
 
16
- @Extend(Web)
17
- function attrs (style: TaroStyleType) {
18
- .id(style.id)
19
- .key(style.id)
20
- .flexGrow(style.flexGrow)
21
- .flexShrink(style.flexShrink)
22
- .flexBasis(style.flexBasis)
23
- .alignSelf(style.alignSelf)
24
- .padding({
25
- top: style.paddingTop,
26
- right: style.paddingRight,
27
- bottom: style.paddingBottom,
28
- left: style.paddingLeft
29
- })
30
- .margin({
31
- top: style.marginTop,
32
- right: style.marginRight,
33
- bottom: style.marginBottom,
34
- left: style.marginLeft
35
- })
36
- .width(style.width)
37
- .height(style.height)
38
- .constraintSize({
39
- minWidth: style.minWidth,
40
- maxWidth: style.maxWidth,
41
- minHeight: style.minHeight,
42
- maxHeight: style.maxHeight
43
- })
44
- .backgroundColor(style.backgroundColor)
45
- .backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
46
- .backgroundImageSize(style.backgroundSize)
47
- .backgroundImagePosition(style.backgroundPosition)
48
- .borderStyle({
49
- top: style.borderTopStyle,
50
- right: style.borderRightStyle,
51
- bottom: style.borderBottomStyle,
52
- left: style.borderLeftStyle
53
- })
54
- .borderWidth({
55
- top: style.borderTopWidth,
56
- right: style.borderRightWidth,
57
- bottom: style.borderBottomWidth,
58
- left: style.borderLeftWidth
59
- })
60
- .borderColor({
61
- top: style.borderTopColor,
62
- right: style.borderRightColor,
63
- bottom: style.borderBottomColor,
64
- left: style.borderLeftColor
65
- })
66
- .borderRadius({
67
- topLeft: style.borderTopLeftRadius,
68
- topRight: style.borderTopRightRadius,
69
- bottomLeft: style.borderBottomLeftRadius,
70
- bottomRight: style.borderBottomRightRadius
71
- })
72
- .zIndex(style.zIndex)
73
- .opacity(style.opacity)
74
- .clip(style.overflow)
75
- .rotate({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y, angle: 0 })
76
- .scale({ centerX: style.transformOrigin?.x, centerY: style.transformOrigin?.y })
77
- .transform(style.transform)
78
- }
79
-
80
- @Builder
81
- export default function TaroWebView (node: TaroWebViewElement) {
82
- Web({ src: node._attrs.src, controller: node.controller })
83
- .attrs(getNormalAttributes(node))
84
- .onPageEnd((e: IPageLoad) => {
85
- // 1. 创建消息端口
86
- node.ports = node.controller.createWebMessagePorts(true)
87
- // 2. 发送端口1到HTML5
88
- node.controller.postMessage('init_web_messageport', [node.ports[1]], '*');
89
- // 3. 保存端口0到本地
90
- node.nativePort = node.ports[0]
91
- // 4. 设置回调函数
92
- node.nativePort.onMessageEventExt((result) => {
93
- const message = node.handleMessageFromWeb(result)
94
- const messageEvent: TaroEvent = createTaroEvent('message', { detail: { data: message } }, node)
95
-
96
- eventHandler(messageEvent, 'message', node)
97
- })
98
-
99
- const onLoadEvent: TaroEvent = createTaroEvent('load', { detail: { src: node._attrs.src } }, node)
100
-
101
- eventHandler(onLoadEvent, 'load', node)
102
- })
103
- .onErrorReceive(shouldBindEvent((e: IError) => {
104
- const event: TaroEvent = createTaroEvent('error', { detail: { url: node._attrs.src, fullUrl: e.request.getRequestUrl() } }, node)
105
-
106
- eventHandler(event, 'error', node)
107
- }, node, ['error']))
108
- .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
109
- .onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
110
- node._nodeInfo.areaInfo = res[1]
111
- }))
112
- .onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
17
+ @Component
18
+ export default struct TaroWebView {
19
+ @Builder customBuilder() {}
20
+ @BuilderParam createLazyChildren: (node: TaroWebViewElement) => void = this.customBuilder
21
+ @ObjectLink node: TaroWebViewElement
22
+
23
+ build () {
24
+ if (this.node.hmStyle?.display !== 'none') {
25
+ Web({ src: this.node._attrs.src, controller: this.node.controller })
26
+ .attributeModifier(commonStyleModify.setNode(this.node))
27
+ .onPageEnd((e: IPageLoad) => {
28
+ // 1. 创建消息端口
29
+ this.node.ports = this.node.controller.createWebMessagePorts(true)
30
+ // 2. 发送端口1到HTML5
31
+ this.node.controller.postMessage('init_web_messageport', [this.node.ports[1]], '*');
32
+ // 3. 保存端口0到本地
33
+ this.node.nativePort = this.node.ports[0]
34
+ // 4. 设置回调函数
35
+ this.node.nativePort.onMessageEventExt((result) => {
36
+ const message = this.node.handleMessageFromWeb(result)
37
+ const messageEvent: TaroEvent = createTaroEvent('message', { detail: { data: message } }, this.node)
38
+
39
+ eventHandler(messageEvent, 'message', this.node)
40
+ })
41
+
42
+ const onLoadEvent: TaroEvent = createTaroEvent('load', { detail: { src: this.node._attrs.src } }, this.node)
43
+
44
+ eventHandler(onLoadEvent, 'load', this.node)
45
+ })
46
+ .onErrorReceive(shouldBindEvent((e: IError) => {
47
+ const event: TaroEvent = createTaroEvent('error', { detail: { url: this.node._attrs.src, fullUrl: e.request.getRequestUrl() } }, this.node)
48
+
49
+ eventHandler(event, 'error', this.node)
50
+ }, this.node, ['error']))
51
+ .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
52
+ .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
53
+ this.node._nodeInfo.areaInfo = res[1]
54
+ }))
55
+ .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
56
+ }
57
+ }
113
58
  }
@@ -0,0 +1,151 @@
1
+ /* eslint-disable no-console */
2
+ import { IFileType, TConfig, TaroPlatform, IPluginContext, TaroPlatformBase } from "@tarojs/service";
3
+ import { PLATFORM_TYPE } from "@tarojs/shared";
4
+ declare abstract class TaroPlatformHarmony<T extends TConfig = TConfig> extends TaroPlatform<T> {
5
+ platformType: PLATFORM_TYPE;
6
+ globalObject: string;
7
+ abstract fileType: IFileType;
8
+ abstract useETS: boolean;
9
+ abstract useJSON5: boolean;
10
+ taroComponentsPath: string;
11
+ /**
12
+ * 1. 清空 dist 文件夹
13
+ * 2. 输出编译提示
14
+ */
15
+ private setup;
16
+ private setupHarmonyApp;
17
+ protected printDevelopmentTip(): void;
18
+ /**
19
+ * 返回当前项目内的 runner 包
20
+ */
21
+ protected getRunner(): Promise<any>;
22
+ /**
23
+ * 准备 runner 参数
24
+ * @param extraOptions 需要额外合入 Options 的配置项
25
+ */
26
+ protected getOptions(extraOptions?: {}): any;
27
+ /**
28
+ * 调用 runner 开始编译
29
+ * @param extraOptions 需要额外传入 runner 的配置项
30
+ */
31
+ private build;
32
+ private buildHarmonyApp;
33
+ /**
34
+ * 调用 runner 开启编译
35
+ */
36
+ start(): Promise<void>;
37
+ }
38
+ declare class Harmony extends TaroPlatformHarmony {
39
+ #private;
40
+ platform: string;
41
+ globalObject: string;
42
+ fileType: {
43
+ templ: string;
44
+ style: string;
45
+ config: string;
46
+ script: string;
47
+ };
48
+ useETS: boolean;
49
+ useJSON5: boolean;
50
+ runtimePath: string[] | string;
51
+ taroComponentsPath: string;
52
+ constructor(ctx: IPluginContext, config: TConfig);
53
+ get framework(): "vue3" | "react" | "preact" | "nerv" | "vue";
54
+ get aliasFramework(): string;
55
+ get apiLibrary(): string;
56
+ get apiEntry(): RegExp[];
57
+ get componentLibrary(): string;
58
+ get runtimeLibrary(): string;
59
+ get runtimeFrameworkLibrary(): string;
60
+ get defineConstants(): Record<string, string> | undefined;
61
+ extensions: string[];
62
+ excludeLibraries: (string | RegExp)[];
63
+ externalDeps: [
64
+ string,
65
+ RegExp,
66
+ string?
67
+ ][];
68
+ harmonyScope: RegExp[];
69
+ indexOfLibraries(lib: string): number;
70
+ removeFromLibraries(lib: string): void;
71
+ moveLibraries(lib: string, target?: string, basedir?: string, sync?: boolean): void;
72
+ replaceDefineValue(code: string, define: Record<string, string>): string;
73
+ /**
74
+ * 修改 Vite 配置
75
+ */
76
+ modifyViteConfig(): void;
77
+ handleResourceEmit(outDir: string, basedir?: string): void;
78
+ }
79
+ declare module HarmonyWrapper {
80
+ export { Harmony };
81
+ }
82
+ import HarmonyOS_ArkTS = HarmonyWrapper.Harmony;
83
+ declare class Harmony$0 extends TaroPlatformBase {
84
+ platform: string;
85
+ globalObject: string;
86
+ runtimePath: string;
87
+ taroComponentsPath: string;
88
+ fileType: {
89
+ templ: string;
90
+ style: string;
91
+ config: string;
92
+ script: string;
93
+ };
94
+ template: any;
95
+ /**
96
+ * 1. setupTransaction - init
97
+ * 2. setup
98
+ * 3. setupTransaction - close
99
+ * 4. buildTransaction - init
100
+ * 5. build
101
+ * 6. buildTransaction - close
102
+ */
103
+ constructor(ctx: any, config: any);
104
+ /**
105
+ * 增加组件或修改组件属性
106
+ */
107
+ modifyComponents(): void;
108
+ /**
109
+ * 不需要转 rpx
110
+ */
111
+ modifyPostcssConfigs(config: Record<string, any>): void;
112
+ /**
113
+ * 模板自定义组件 js
114
+ * 等鸿蒙支持 template 后需要重构
115
+ */
116
+ addEntry(): void;
117
+ /**
118
+ * 把 app、pages、自定义组件的 js 改造为鸿蒙的 export default 导出形式
119
+ */
120
+ modifyTaroExport(): void;
121
+ /**
122
+ * 修改最终的编译产物
123
+ * 1. 生成模板自定义组件的 xml、css 文件
124
+ * 2. 删除多余的文件
125
+ * 3. 把 components-harmony 中被使用到的组件移动到输出目录
126
+ */
127
+ modifyBuildAssets(ctx: any, config: any): void;
128
+ modifyWebpackConfig(): void;
129
+ modifyHarmonyConfig(pages: any, { projectPath, hapName, name }: {
130
+ projectPath: any;
131
+ hapName: any;
132
+ name: any;
133
+ }): void;
134
+ modifyHostPackage({ projectPath, hapName }: {
135
+ projectPath: any;
136
+ hapName?: string | undefined;
137
+ }): Promise<any>;
138
+ getChunkEntryModule(compilation: any, chunk: any, compiler?: string): any;
139
+ checkMetaType(entryModule: any): boolean;
140
+ isHarmonyRequest(request: string): boolean;
141
+ }
142
+ declare module HarmonyWrapper {
143
+ export { Harmony$0 as Harmony };
144
+ }
145
+ import HarmonyOS_JSUI = HarmonyWrapper.Harmony;
146
+ interface IOptions {
147
+ disableArkTS?: boolean;
148
+ useConfigName?: string;
149
+ }
150
+ declare const _default: (ctx: IPluginContext, options?: IOptions) => void;
151
+ export { _default as default, HarmonyOS_ArkTS, HarmonyOS_JSUI, IOptions };