@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.0 → 4.0.0-alpha.10
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 +73 -20
- package/dist/apis/canvas/index.ts +10 -1
- package/dist/apis/device/clipboard.ts +16 -8
- package/dist/apis/device/memory.ts +10 -3
- package/dist/apis/framework/index.ts +1 -5
- package/dist/apis/index.ts +27 -17
- package/dist/apis/media/image/index.ts +1 -1
- package/dist/apis/media/video/VideoContext.ts +56 -7
- package/dist/apis/media/video/index.ts +3 -2
- package/dist/apis/network/request.ts +5 -5
- package/dist/apis/route/index.ts +15 -0
- package/dist/apis/storage/index.ts +146 -78
- package/dist/apis/ui/animation/animation.ts +71 -29
- package/dist/apis/ui/background.ts +2 -1
- package/dist/apis/ui/interaction/index.ts +42 -59
- package/dist/apis/ui/navigation-bar/index.ts +1 -1
- package/dist/apis/ui/pull-down-refresh.ts +9 -3
- package/dist/apis/ui/scroll/index.ts +5 -5
- package/dist/apis/ui/tab-bar.ts +3 -3
- package/dist/apis/utils/index.ts +1 -1
- package/dist/apis/wxml/IntersectionObserver.ts +18 -10
- package/dist/apis/wxml/index.ts +2 -0
- package/dist/apis/wxml/selectorQuery.ts +26 -13
- package/dist/components-harmony-ets/button.ets +68 -68
- package/dist/components-harmony-ets/canvas.ets +51 -0
- package/dist/components-harmony-ets/checkbox.ets +81 -102
- package/dist/components-harmony-ets/form.ets +54 -45
- package/dist/components-harmony-ets/icon.ets +34 -50
- package/dist/components-harmony-ets/image.ets +35 -45
- package/dist/components-harmony-ets/index.ets +92 -0
- package/dist/components-harmony-ets/innerHtml.ets +11 -6
- package/dist/components-harmony-ets/input.ets +51 -67
- package/dist/components-harmony-ets/label.ets +73 -53
- package/dist/components-harmony-ets/listView.ets +26 -0
- package/dist/components-harmony-ets/movableArea.ets +124 -0
- package/dist/components-harmony-ets/movableView.ets +93 -0
- package/dist/components-harmony-ets/navigationBar.ets +65 -0
- package/dist/components-harmony-ets/pageMeta.ets +94 -0
- package/dist/components-harmony-ets/picker.ets +74 -77
- package/dist/components-harmony-ets/progress.ets +52 -0
- package/dist/components-harmony-ets/pseudo.ets +80 -0
- package/dist/components-harmony-ets/radio.ets +82 -104
- package/dist/components-harmony-ets/richText.ets +20 -68
- package/dist/components-harmony-ets/scrollList.ets +94 -0
- package/dist/components-harmony-ets/scrollView.ets +67 -103
- package/dist/components-harmony-ets/slider.ets +23 -47
- package/dist/components-harmony-ets/stickySection.ets +42 -0
- package/dist/components-harmony-ets/style.ets +396 -0
- package/dist/components-harmony-ets/swiper.ets +64 -53
- package/dist/components-harmony-ets/switch.ets +44 -55
- package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
- package/dist/components-harmony-ets/text.ets +134 -75
- package/dist/components-harmony-ets/textArea.ets +54 -62
- package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +4 -13
- package/dist/components-harmony-ets/utils/flexManager.ets +76 -8
- package/dist/components-harmony-ets/utils/helper.ets +20 -7
- package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
- package/dist/components-harmony-ets/utils/htmlParser/index.ts +1 -1
- package/dist/components-harmony-ets/utils/index.ts +54 -50
- package/dist/components-harmony-ets/utils/styles.ets +178 -63
- package/dist/components-harmony-ets/video.ets +37 -54
- package/dist/components-harmony-ets/view.ets +63 -94
- package/dist/components-harmony-ets/webView.ets +56 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.js +199 -58
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/document.ts +6 -4
- package/dist/runtime-ets/bom/getComputedStyle.ts +2 -2
- package/dist/runtime-ets/bom/window.ts +9 -2
- package/dist/runtime-ets/current.ts +3 -0
- package/dist/runtime-ets/dom/bind.ts +28 -12
- package/dist/runtime-ets/dom/class-list.ts +2 -2
- package/dist/runtime-ets/dom/cssNesting.ts +409 -0
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +29 -19
- package/dist/runtime-ets/dom/document.ts +22 -8
- package/dist/runtime-ets/dom/element/canvas.ts +136 -0
- package/dist/runtime-ets/dom/element/element.ts +334 -57
- package/dist/runtime-ets/dom/element/form.ts +32 -26
- package/dist/runtime-ets/dom/element/index.ts +33 -2
- package/dist/runtime-ets/dom/element/movableArea.ts +11 -0
- package/dist/runtime-ets/dom/element/movableView.ts +242 -0
- package/dist/runtime-ets/dom/element/normal.ts +36 -8
- package/dist/runtime-ets/dom/element/progress.ts +11 -0
- package/dist/runtime-ets/dom/element/scrollView.ts +1 -0
- package/dist/runtime-ets/dom/element/text.ts +1 -8
- package/dist/runtime-ets/dom/element/video.ts +5 -4
- package/dist/runtime-ets/dom/element/webView.ts +68 -0
- package/dist/runtime-ets/dom/event.ts +2 -4
- package/dist/runtime-ets/dom/eventTarget.ts +2 -3
- package/dist/runtime-ets/dom/node.ts +62 -27
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +805 -0
- package/dist/runtime-ets/dom/stylesheet/index.ts +98 -518
- package/dist/runtime-ets/dom/stylesheet/type.ts +92 -17
- package/dist/runtime-ets/dom/stylesheet/util.ts +74 -16
- package/dist/runtime-ets/index.ts +2 -2
- package/dist/runtime-ets/interface/event.ts +3 -2
- package/dist/runtime-ets/utils/index.ts +77 -12
- package/dist/runtime-ets/utils/info.ts +4 -2
- package/dist/runtime-framework/react/app.ts +17 -22
- package/dist/runtime-framework/react/hooks.ts +3 -4
- package/dist/runtime-framework/react/index.ts +1 -2
- package/dist/runtime-framework/react/native-page.ts +421 -0
- package/dist/runtime-framework/react/page.ts +4 -9
- package/dist/runtime-framework/solid/app.ts +25 -45
- package/dist/runtime-framework/solid/connect.ts +21 -3
- package/dist/runtime-framework/solid/hooks.ts +17 -12
- package/dist/runtime-framework/solid/index.ts +6 -2
- package/dist/runtime-framework/solid/page.ts +84 -30
- package/dist/runtime-framework/solid/reconciler/props.ts +70 -25
- package/dist/runtime-framework/solid/reconciler/render.ts +16 -6
- package/dist/runtime-framework/solid/reconciler/use.ts +0 -1
- package/dist/runtime-framework/solid/utils/index.ts +0 -2
- package/dist/runtime-utils.d.ts +827 -0
- package/dist/runtime-utils.js +510 -237
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +510 -237
- package/dist/runtime.js.map +1 -1
- package/index.js +3 -1
- package/package.json +14 -15
- package/static/media/cancel.svg +1 -0
- package/static/media/circle.svg +1 -0
- package/static/media/clear.svg +1 -0
- package/static/media/download.svg +1 -0
- package/static/media/info.svg +1 -0
- package/static/media/info_circle.svg +1 -0
- package/static/media/search.svg +1 -0
- package/static/media/success.svg +1 -0
- package/static/media/success_no_circle.svg +1 -0
- package/static/media/taro_arrow_left.svg +1 -0
- package/static/media/taro_home.svg +1 -0
- package/static/media/waiting.svg +1 -0
- package/static/media/warn.svg +1 -0
- package/types/harmony.d.ts +4 -0
- package/types/index.d.ts +4 -0
- package/types/runtime.d.ts +3 -1
- package/dist/runtime-ets/utils/bind.ts +0 -24
- /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
|
@@ -1,104 +1,73 @@
|
|
|
1
1
|
import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import commonStyleModify, { rowModify, columnModify } from './style'
|
|
4
|
+
import PseduoChildren from './pseudo'
|
|
4
5
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
5
|
-
import { FlexManager } from './utils/
|
|
6
|
-
import { getNodeThresholds,
|
|
6
|
+
import { FlexManager } from './utils/flexManager'
|
|
7
|
+
import { getNodeThresholds, shouldBindEvent } from './utils/helper'
|
|
7
8
|
|
|
8
|
-
import type { TaroViewElement, TaroAny
|
|
9
|
+
import type { TaroViewElement, TaroAny } from '@tarojs/runtime'
|
|
10
|
+
import { isUndefined } from '@tarojs/shared'
|
|
9
11
|
|
|
10
|
-
@
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.flexBasis(style.flexBasis)
|
|
17
|
-
.alignSelf(style.alignSelf)
|
|
18
|
-
.padding(style.padding)
|
|
19
|
-
.margin(style.margin)
|
|
20
|
-
.width(style.width)
|
|
21
|
-
.height(style.height)
|
|
22
|
-
.constraintSize(style.constraintSize)
|
|
23
|
-
.backgroundColor(style.backgroundColor)
|
|
24
|
-
.backgroundImage(style.backgroundImage, style.backgroundRepeat)
|
|
25
|
-
.backgroundImageSize(style.backgroundImageSize)
|
|
26
|
-
.backgroundImagePosition(style.backgroundImagePosition)
|
|
27
|
-
.rotate(style.rotate)
|
|
28
|
-
.scale(style.scale)
|
|
29
|
-
.translate(style.translate)
|
|
30
|
-
.transform(style.transform)
|
|
31
|
-
.borderStyle(style.borderStyle)
|
|
32
|
-
.borderWidth(style.borderWidth)
|
|
33
|
-
.borderColor(style.borderColor)
|
|
34
|
-
.borderRadius(style.borderRadius)
|
|
35
|
-
.linearGradient(style.linearGradient)
|
|
36
|
-
.zIndex(style.zIndex)
|
|
37
|
-
.opacity(style.opacity)
|
|
38
|
-
.clip(style.clip)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
@Extend(Column)
|
|
43
|
-
function columnAttrs (style: TaroStyleType) {
|
|
44
|
-
.id(style.id)
|
|
45
|
-
.key(style.id)
|
|
46
|
-
.flexGrow(style.flexGrow)
|
|
47
|
-
.flexShrink(style.flexShrink)
|
|
48
|
-
.flexBasis(style.flexBasis)
|
|
49
|
-
.alignSelf(style.alignSelf)
|
|
50
|
-
.padding(style.padding)
|
|
51
|
-
.margin(style.margin)
|
|
52
|
-
.width(style.width)
|
|
53
|
-
.height(style.height)
|
|
54
|
-
.constraintSize(style.constraintSize)
|
|
55
|
-
.backgroundColor(style.backgroundColor)
|
|
56
|
-
.backgroundImage(style.backgroundImage, style.backgroundRepeat)
|
|
57
|
-
.backgroundImageSize(style.backgroundImageSize)
|
|
58
|
-
.backgroundImagePosition(style.backgroundImagePosition)
|
|
59
|
-
.rotate(style.rotate)
|
|
60
|
-
.scale(style.scale)
|
|
61
|
-
.translate(style.translate)
|
|
62
|
-
.transform(style.transform)
|
|
63
|
-
.borderStyle(style.borderStyle)
|
|
64
|
-
.borderWidth(style.borderWidth)
|
|
65
|
-
.borderColor(style.borderColor)
|
|
66
|
-
.borderRadius(style.borderRadius)
|
|
67
|
-
.linearGradient(style.linearGradient)
|
|
68
|
-
.zIndex(style.zIndex)
|
|
69
|
-
.opacity(style.opacity)
|
|
70
|
-
.clip(style.clip)
|
|
71
|
-
}
|
|
12
|
+
@Component
|
|
13
|
+
export default struct TaroView {
|
|
14
|
+
@Builder customBuilder() {}
|
|
15
|
+
@BuilderParam createLazyChildren: (node: TaroViewElement) => void = this.customBuilder
|
|
16
|
+
@ObjectLink node: TaroViewElement
|
|
17
|
+
@State overwriteStyle: Record<string, TaroAny> = {}
|
|
72
18
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
@Builder
|
|
78
|
-
export default function TaroView (node: TaroViewElement) {
|
|
79
|
-
if (isFlexNode(node)) {
|
|
80
|
-
Flex(FlexManager.flexOptions(node)) {
|
|
81
|
-
createLazyChildren(node)
|
|
19
|
+
aboutToAppear(): void {
|
|
20
|
+
if (this.node) {
|
|
21
|
+
this.node._instance = this
|
|
82
22
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
build () {
|
|
26
|
+
if (FlexManager.useFlexLayout(this.node)) {
|
|
27
|
+
Flex(FlexManager.flexOptions(this.node)) {
|
|
28
|
+
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
29
|
+
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
30
|
+
} else {
|
|
31
|
+
this.createLazyChildren(this.node)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
35
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
36
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
37
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
38
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
39
|
+
}))
|
|
40
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
41
|
+
} else if (FlexManager.isFlexNode(this.node) && FlexManager.direction(this.node) !== FlexDirection.Column) {
|
|
42
|
+
Row() {
|
|
43
|
+
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
44
|
+
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
45
|
+
} else {
|
|
46
|
+
this.createLazyChildren(this.node)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
.attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
50
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
51
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
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
|
+
} else {
|
|
57
|
+
Column() {
|
|
58
|
+
if (this.node._pseudo_before || this.node._pseudo_after) {
|
|
59
|
+
PseduoChildren({ node: this.node, createLazyChildren: this.createLazyChildren })
|
|
60
|
+
} else {
|
|
61
|
+
this.createLazyChildren(this.node)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
.attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
65
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
66
|
+
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
|
|
67
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
68
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
69
|
+
}))
|
|
70
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
93
71
|
}
|
|
94
|
-
.columnAttrs(getNormalAttributes(node))
|
|
95
|
-
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', node), node, ['click']))
|
|
96
|
-
.onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), node), node, TOUCH_EVENT_MAP.values()))
|
|
97
|
-
.onAreaChange(getComponentEventCallback(node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
98
|
-
node._nodeInfo.areaInfo = res[1]
|
|
99
|
-
}))
|
|
100
|
-
.onVisibleAreaChange(getNodeThresholds(node) || [0.0, 1.0], getComponentEventCallback(node, VISIBLE_CHANGE_EVENT_NAME))
|
|
101
|
-
.alignItems(HorizontalAlign.Start)
|
|
102
|
-
.justifyContent(node.hmStyle.justifyContent)
|
|
103
72
|
}
|
|
104
73
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME, createTaroEvent } from '@tarojs/runtime'
|
|
2
|
+
|
|
3
|
+
import commonStyleModify from './style'
|
|
4
|
+
import { shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
5
|
+
|
|
6
|
+
import type { TaroAny, TaroWebViewElement, TaroEvent } from '@tarojs/runtime'
|
|
7
|
+
|
|
8
|
+
interface IPageLoad {
|
|
9
|
+
url: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface IError {
|
|
13
|
+
request: WebResourceRequest
|
|
14
|
+
error: WebResourceError
|
|
15
|
+
}
|
|
16
|
+
|
|
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
|
+
Web({ src: this.node._attrs.src, controller: this.node.controller })
|
|
25
|
+
.attributeModifier(commonStyleModify.setNode(this.node))
|
|
26
|
+
.onPageEnd((e: IPageLoad) => {
|
|
27
|
+
// 1. 创建消息端口
|
|
28
|
+
this.node.ports = this.node.controller.createWebMessagePorts(true)
|
|
29
|
+
// 2. 发送端口1到HTML5
|
|
30
|
+
this.node.controller.postMessage('init_web_messageport', [this.node.ports[1]], '*');
|
|
31
|
+
// 3. 保存端口0到本地
|
|
32
|
+
this.node.nativePort = this.node.ports[0]
|
|
33
|
+
// 4. 设置回调函数
|
|
34
|
+
this.node.nativePort.onMessageEventExt((result) => {
|
|
35
|
+
const message = this.node.handleMessageFromWeb(result)
|
|
36
|
+
const messageEvent: TaroEvent = createTaroEvent('message', { detail: { data: message } }, this.node)
|
|
37
|
+
|
|
38
|
+
eventHandler(messageEvent, 'message', this.node)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const onLoadEvent: TaroEvent = createTaroEvent('load', { detail: { src: this.node._attrs.src } }, this.node)
|
|
42
|
+
|
|
43
|
+
eventHandler(onLoadEvent, 'load', this.node)
|
|
44
|
+
})
|
|
45
|
+
.onErrorReceive(shouldBindEvent((e: IError) => {
|
|
46
|
+
const event: TaroEvent = createTaroEvent('error', { detail: { url: this.node._attrs.src, fullUrl: e.request.getRequestUrl() } }, this.node)
|
|
47
|
+
|
|
48
|
+
eventHandler(event, 'error', this.node)
|
|
49
|
+
}, this.node, ['error']))
|
|
50
|
+
.onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
|
|
51
|
+
.onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
|
|
52
|
+
this.node._nodeInfo.areaInfo = res[1]
|
|
53
|
+
}))
|
|
54
|
+
.onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
|
|
55
|
+
}
|
|
56
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
apiEntryList: RegExp[];
|
|
53
|
+
constructor(ctx: IPluginContext, config: TConfig);
|
|
54
|
+
get framework(): "solid" | "vue3" | "react" | "preact";
|
|
55
|
+
get aliasFramework(): string;
|
|
56
|
+
get apiLibrary(): string;
|
|
57
|
+
get apiEntry(): RegExp[];
|
|
58
|
+
get componentLibrary(): string;
|
|
59
|
+
get runtimeLibrary(): string;
|
|
60
|
+
get runtimeFrameworkLibrary(): string;
|
|
61
|
+
get defineConstants(): Record<string, string> | undefined;
|
|
62
|
+
extensions: string[];
|
|
63
|
+
excludeLibraries: (string | RegExp)[];
|
|
64
|
+
externalDeps: [
|
|
65
|
+
string,
|
|
66
|
+
RegExp,
|
|
67
|
+
string?
|
|
68
|
+
][];
|
|
69
|
+
harmonyScope: RegExp[];
|
|
70
|
+
indexOfLibraries(lib: string): number;
|
|
71
|
+
removeFromLibraries(lib: string): void;
|
|
72
|
+
moveLibraries(lib: string, target?: string, basedir?: string, sync?: boolean): void;
|
|
73
|
+
replaceDefineValue(code: string, define: Record<string, string>, ext?: string): string;
|
|
74
|
+
/**
|
|
75
|
+
* 修改 Vite 配置
|
|
76
|
+
*/
|
|
77
|
+
modifyViteConfig(): void;
|
|
78
|
+
handleResourceEmit(outDir: string, basedir?: string): void;
|
|
79
|
+
}
|
|
80
|
+
declare module HarmonyWrapper {
|
|
81
|
+
export { Harmony };
|
|
82
|
+
}
|
|
83
|
+
import HarmonyOS_ArkTS = HarmonyWrapper.Harmony;
|
|
84
|
+
declare class Harmony$0 extends TaroPlatformBase {
|
|
85
|
+
platform: string;
|
|
86
|
+
globalObject: string;
|
|
87
|
+
runtimePath: string;
|
|
88
|
+
taroComponentsPath: string;
|
|
89
|
+
fileType: {
|
|
90
|
+
templ: string;
|
|
91
|
+
style: string;
|
|
92
|
+
config: string;
|
|
93
|
+
script: string;
|
|
94
|
+
};
|
|
95
|
+
template: any;
|
|
96
|
+
/**
|
|
97
|
+
* 1. setupTransaction - init
|
|
98
|
+
* 2. setup
|
|
99
|
+
* 3. setupTransaction - close
|
|
100
|
+
* 4. buildTransaction - init
|
|
101
|
+
* 5. build
|
|
102
|
+
* 6. buildTransaction - close
|
|
103
|
+
*/
|
|
104
|
+
constructor(ctx: any, config: any);
|
|
105
|
+
/**
|
|
106
|
+
* 增加组件或修改组件属性
|
|
107
|
+
*/
|
|
108
|
+
modifyComponents(): void;
|
|
109
|
+
/**
|
|
110
|
+
* 不需要转 rpx
|
|
111
|
+
*/
|
|
112
|
+
modifyPostcssConfigs(config: Record<string, any>): void;
|
|
113
|
+
/**
|
|
114
|
+
* 模板自定义组件 js
|
|
115
|
+
* 等鸿蒙支持 template 后需要重构
|
|
116
|
+
*/
|
|
117
|
+
addEntry(): void;
|
|
118
|
+
/**
|
|
119
|
+
* 把 app、pages、自定义组件的 js 改造为鸿蒙的 export default 导出形式
|
|
120
|
+
*/
|
|
121
|
+
modifyTaroExport(): void;
|
|
122
|
+
/**
|
|
123
|
+
* 修改最终的编译产物
|
|
124
|
+
* 1. 生成模板自定义组件的 xml、css 文件
|
|
125
|
+
* 2. 删除多余的文件
|
|
126
|
+
* 3. 把 components-harmony 中被使用到的组件移动到输出目录
|
|
127
|
+
*/
|
|
128
|
+
modifyBuildAssets(ctx: any, config: any): void;
|
|
129
|
+
modifyWebpackConfig(): void;
|
|
130
|
+
modifyHarmonyConfig(pages: any, { projectPath, hapName, name }: {
|
|
131
|
+
projectPath: any;
|
|
132
|
+
hapName: any;
|
|
133
|
+
name: any;
|
|
134
|
+
}): void;
|
|
135
|
+
modifyHostPackage({ projectPath, hapName }: {
|
|
136
|
+
projectPath: any;
|
|
137
|
+
hapName?: string | undefined;
|
|
138
|
+
}): Promise<any>;
|
|
139
|
+
getChunkEntryModule(compilation: any, chunk: any, compiler?: string): any;
|
|
140
|
+
checkMetaType(entryModule: any): boolean;
|
|
141
|
+
isHarmonyRequest(request: string): boolean;
|
|
142
|
+
}
|
|
143
|
+
declare module HarmonyWrapper {
|
|
144
|
+
export { Harmony$0 as Harmony };
|
|
145
|
+
}
|
|
146
|
+
import HarmonyOS_JSUI = HarmonyWrapper.Harmony;
|
|
147
|
+
interface IOptions {
|
|
148
|
+
disableArkTS?: boolean;
|
|
149
|
+
useConfigName?: string;
|
|
150
|
+
}
|
|
151
|
+
declare const _default: (ctx: IPluginContext, options?: IOptions) => void;
|
|
152
|
+
export { _default as default, HarmonyOS_ArkTS, HarmonyOS_JSUI, IOptions };
|