@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.2 → 4.0.0-alpha.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.
- 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/framework/index.ts +1 -5
- package/dist/apis/index.ts +25 -17
- package/dist/apis/media/image/index.ts +1 -1
- 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 +2 -1
- package/dist/apis/wxml/IntersectionObserver.ts +18 -10
- package/dist/apis/wxml/selectorQuery.ts +26 -13
- package/dist/components-harmony-ets/button.ets +64 -34
- package/dist/components-harmony-ets/canvas.ets +51 -0
- package/dist/components-harmony-ets/checkbox.ets +72 -61
- package/dist/components-harmony-ets/form.ets +51 -29
- package/dist/components-harmony-ets/icon.ets +31 -19
- package/dist/components-harmony-ets/image.ets +34 -14
- 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 +49 -41
- package/dist/components-harmony-ets/label.ets +71 -44
- package/dist/components-harmony-ets/listView.ets +26 -0
- package/dist/components-harmony-ets/movableArea.ets +126 -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 +42 -38
- 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 +74 -64
- package/dist/components-harmony-ets/richText.ets +14 -30
- package/dist/components-harmony-ets/scrollList.ets +94 -0
- package/dist/components-harmony-ets/scrollView.ets +61 -57
- package/dist/components-harmony-ets/slider.ets +18 -14
- package/dist/components-harmony-ets/stickySection.ets +42 -0
- package/dist/components-harmony-ets/style.ets +381 -130
- package/dist/components-harmony-ets/swiper.ets +61 -20
- package/dist/components-harmony-ets/switch.ets +36 -32
- package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
- package/dist/components-harmony-ets/text.ets +135 -49
- package/dist/components-harmony-ets/textArea.ets +50 -35
- package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +2 -2
- package/dist/components-harmony-ets/utils/flexManager.ets +49 -19
- package/dist/components-harmony-ets/utils/helper.ets +18 -5
- 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 +170 -93
- package/dist/components-harmony-ets/video.ets +34 -21
- package/dist/components-harmony-ets/view.ets +63 -52
- package/dist/components-harmony-ets/webView.ets +40 -34
- package/dist/index.d.ts +152 -0
- package/dist/index.js +99 -55
- 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 +7 -0
- 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 +419 -0
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +28 -42
- package/dist/runtime-ets/dom/document.ts +8 -11
- package/dist/runtime-ets/dom/element/canvas.ts +136 -0
- package/dist/runtime-ets/dom/element/element.ts +348 -57
- package/dist/runtime-ets/dom/element/form.ts +31 -26
- package/dist/runtime-ets/dom/element/index.ts +30 -2
- package/dist/runtime-ets/dom/element/movableArea.ts +11 -0
- package/dist/runtime-ets/dom/element/movableView.ts +244 -0
- package/dist/runtime-ets/dom/element/normal.ts +35 -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 +12 -5
- 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 +54 -29
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +416 -235
- package/dist/runtime-ets/dom/stylesheet/index.ts +29 -311
- package/dist/runtime-ets/dom/stylesheet/type.ts +51 -9
- package/dist/runtime-ets/dom/stylesheet/util.ts +33 -27
- package/dist/runtime-ets/index.ts +2 -1
- package/dist/runtime-ets/interface/event.ts +1 -1
- package/dist/runtime-ets/utils/index.ts +73 -13
- package/dist/runtime-ets/utils/info.ts +2 -2
- package/dist/runtime-framework/react/app.ts +9 -4
- package/dist/runtime-framework/react/hooks.ts +0 -1
- package/dist/runtime-framework/react/index.ts +0 -2
- package/dist/runtime-framework/react/native-page.ts +154 -77
- package/dist/runtime-framework/react/page.ts +3 -8
- 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 +16 -11
- 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 +435 -218
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +435 -218
- package/dist/runtime.js.map +1 -1
- package/index.js +3 -1
- package/package.json +14 -15
- package/static/media/cancel.svg +1 -1
- package/static/media/circle.svg +1 -1
- package/static/media/clear.svg +1 -1
- package/static/media/download.svg +1 -1
- package/static/media/info.svg +1 -1
- package/static/media/info_circle.svg +1 -1
- package/static/media/search.svg +1 -1
- package/static/media/success.svg +1 -1
- package/static/media/success_no_circle.svg +1 -1
- package/static/media/warn.svg +1 -1
- package/types/harmony.d.ts +4 -0
- package/types/index.d.ts +4 -0
- package/types/runtime.d.ts +1 -1
- /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
|
@@ -2,13 +2,14 @@ import { TaroElement } from './element'
|
|
|
2
2
|
|
|
3
3
|
import type { VideoProps } from '@tarojs/components/types'
|
|
4
4
|
|
|
5
|
+
@Observed
|
|
5
6
|
export class TaroVideoElement extends TaroElement<VideoProps> {
|
|
6
|
-
_currentTime = 0
|
|
7
|
-
|
|
8
7
|
controller: VideoController = new VideoController()
|
|
9
8
|
|
|
10
9
|
constructor() {
|
|
11
10
|
super('Video')
|
|
11
|
+
|
|
12
|
+
this._nodeInfo._currentTime = 0
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
async play() {
|
|
@@ -39,11 +40,11 @@ export class TaroVideoElement extends TaroElement<VideoProps> {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
get currentTime() {
|
|
42
|
-
return this._currentTime
|
|
43
|
+
return this._nodeInfo._currentTime
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
set currentTime(val: number) {
|
|
46
|
-
this._currentTime = val
|
|
47
|
+
this._nodeInfo._currentTime = val
|
|
47
48
|
this.controller.setCurrentTime(val)
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -5,13 +5,21 @@ import { TaroElement } from './element'
|
|
|
5
5
|
|
|
6
6
|
import type { WebViewProps } from '@tarojs/components/types'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
@Observed
|
|
9
|
+
export class TaroInnerHtmlElement extends TaroElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super('InnerHtml')
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@Observed
|
|
16
|
+
export class TaroWebViewElement extends TaroElement<WebViewProps> {
|
|
9
17
|
ports: web_webview.WebMessagePort[] = []
|
|
10
18
|
|
|
11
19
|
nativePort: web_webview.WebMessagePort | null = null
|
|
12
20
|
|
|
13
21
|
message: web_webview.WebMessageExt = new web_webview.WebMessageExt()
|
|
14
|
-
|
|
22
|
+
|
|
15
23
|
controller: web_webview.WebviewController = new web_webview.WebviewController()
|
|
16
24
|
|
|
17
25
|
constructor() {
|
|
@@ -51,10 +59,9 @@ export class TaroWebViewElement extends TaroElement<WebViewProps>{
|
|
|
51
59
|
return null
|
|
52
60
|
}
|
|
53
61
|
}
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
62
|
+
} catch (error) {
|
|
56
63
|
const e: business_error.BusinessError = error as business_error.BusinessError
|
|
57
|
-
|
|
64
|
+
|
|
58
65
|
console.error(`ErrorCode: ${e.code}, Message: ${e.message}`)
|
|
59
66
|
}
|
|
60
67
|
}
|
|
@@ -55,7 +55,6 @@ export class TaroEvent<T = any> {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
58
|
export function createEvent (event: TaroEvent | string, type?: string, node?: TaroElement) {
|
|
60
59
|
if (typeof event === 'string') {
|
|
61
60
|
// For Vue3 using document.createEvent
|
|
@@ -87,7 +86,6 @@ function stopOrTriggerPropagation (event: TaroEvent, node: TaroElement) {
|
|
|
87
86
|
|
|
88
87
|
// eslint-disable-next-line no-unmodified-loop-condition
|
|
89
88
|
while ((target = target.parentNode as TaroElement)) {
|
|
90
|
-
event.currentTarget = target
|
|
91
89
|
const listeners = target.__listeners[event.type]
|
|
92
90
|
|
|
93
91
|
if (!Array.isArray(listeners) || target._attrs?.disabled) {
|
|
@@ -111,7 +109,7 @@ const BUBBLE_EVENTS = new Set([
|
|
|
111
109
|
'longTap',
|
|
112
110
|
'change',
|
|
113
111
|
'submit',
|
|
114
|
-
'submit-btn',
|
|
112
|
+
'submit-btn',
|
|
115
113
|
'reset-btn'
|
|
116
114
|
])
|
|
117
115
|
|
|
@@ -144,7 +142,7 @@ export function eventHandler (event, type: string, node: TaroElement) {
|
|
|
144
142
|
|
|
145
143
|
// hooks.call('dispatchTaroEventFinish', e, node)
|
|
146
144
|
}
|
|
147
|
-
|
|
145
|
+
|
|
148
146
|
dispatch()
|
|
149
147
|
if (isBatchUpdates) {
|
|
150
148
|
// collectBatchFunction(type, dispatch)
|
|
@@ -43,6 +43,8 @@ class TaroEventTarget extends Events {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
public dispatchEvent (event: TaroEvent) {
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
event.currentTarget = this
|
|
46
48
|
const cancelable = event.cancelable
|
|
47
49
|
const listeners = this.__listeners[event.type]
|
|
48
50
|
|
|
@@ -68,12 +70,10 @@ class TaroEventTarget extends Events {
|
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
|
|
72
73
|
if (event._stop) {
|
|
73
74
|
this._stopPropagation(event)
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
|
|
77
77
|
return listeners != null
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -95,5 +95,4 @@ class TaroEventTarget extends Events {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
|
|
99
98
|
export { TaroEventTarget }
|
|
@@ -32,6 +32,7 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
32
32
|
public parentNode: TaroNode | null = null
|
|
33
33
|
public _nid: string = genId()
|
|
34
34
|
public _doc: TaroDocument | null = null
|
|
35
|
+
public _instance?: TaroAny
|
|
35
36
|
|
|
36
37
|
private _textContent = ''
|
|
37
38
|
|
|
@@ -43,6 +44,9 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
43
44
|
// 是否为半编译模板下拥有自主更新权的节点
|
|
44
45
|
public _isDynamicNode = false
|
|
45
46
|
|
|
47
|
+
// 以下属性为原生混写组件才有意义的属性
|
|
48
|
+
public _nativeUpdateTrigger = 0
|
|
49
|
+
|
|
46
50
|
constructor(nodeName: string, nodeType = NodeType.ELEMENT_NODE) {
|
|
47
51
|
super()
|
|
48
52
|
|
|
@@ -59,35 +63,38 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
59
63
|
return this.childNodes[index] as TaroElement
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
public findIndex (refChild
|
|
63
|
-
return this.childNodes.findIndex(node => node._nid === refChild
|
|
66
|
+
public findIndex (refChild?: TaroNode): number {
|
|
67
|
+
return this.childNodes.findIndex(node => node._nid === refChild?._nid)
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (
|
|
70
|
+
public updateTextNode () {
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
if (this.childNodes.length <= 0 || this.tagName !== 'VIEW') return
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
// TextNode 不具备 props 更新能力,需要由父节点来进行触发
|
|
75
|
+
this.childNodes.forEach(item => {
|
|
76
|
+
if (item.nodeType !== NodeType.TEXT_NODE) return
|
|
71
77
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
item._updateTrigger++
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 更新对应的 ArkUI 组件
|
|
83
|
+
public updateComponent () {
|
|
84
|
+
// 非半编译模式或者半编译模式下拥有自主更新权力的节点走 @State 的更新模式
|
|
85
|
+
if (this._isDynamicNode || (!this._isCompileMode && this._instance)) {
|
|
86
|
+
this._updateTrigger++
|
|
79
87
|
} else {
|
|
80
|
-
|
|
81
|
-
if (idx >= 0) {
|
|
82
|
-
this._updateTrigger++
|
|
83
|
-
this.parentNode.notifyDataChange(idx)
|
|
84
|
-
} else {
|
|
85
|
-
this.parentNode.notifyDataReload()
|
|
86
|
-
}
|
|
88
|
+
this.parentNode?.updateComponent()
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
// 提供唯一标识,方便与小程序一致,能根据uid获取到对应的节点
|
|
93
|
+
public get uid (): string {
|
|
94
|
+
return this._nid
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public get firstChild (): TaroNode | null {
|
|
91
98
|
return this.childNodes[0] || null
|
|
92
99
|
}
|
|
93
100
|
|
|
@@ -128,11 +135,15 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
128
135
|
public set textContent (value: string) {
|
|
129
136
|
if (this.nodeType === NodeType.TEXT_NODE) {
|
|
130
137
|
this._textContent = value
|
|
131
|
-
this.
|
|
138
|
+
if (!this._instance) {
|
|
139
|
+
this.updateComponent()
|
|
140
|
+
}
|
|
132
141
|
} else if (this.nodeType === NodeType.ELEMENT_NODE) {
|
|
133
142
|
const node = new TaroTextNode(value)
|
|
134
143
|
node._doc = this.ownerDocument
|
|
135
|
-
|
|
144
|
+
node.parentNode = this
|
|
145
|
+
this.childNodes.length = 0
|
|
146
|
+
this.childNodes.push(node)
|
|
136
147
|
}
|
|
137
148
|
}
|
|
138
149
|
|
|
@@ -150,7 +161,6 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
150
161
|
public set nodeValue (value: string | null) {
|
|
151
162
|
if (this.nodeType === NodeType.TEXT_NODE && value) {
|
|
152
163
|
this.textContent = value
|
|
153
|
-
this.parentNode?.updateComponent()
|
|
154
164
|
}
|
|
155
165
|
}
|
|
156
166
|
|
|
@@ -163,28 +173,37 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
163
173
|
}
|
|
164
174
|
|
|
165
175
|
// TODO cloneNode()、contains()
|
|
166
|
-
|
|
167
|
-
public appendChild (child: TaroNode): TaroNode {
|
|
176
|
+
public connectParentNode (child: TaroNode) {
|
|
168
177
|
child.parentNode?.removeChild(child)
|
|
169
178
|
child.parentNode = this
|
|
179
|
+
}
|
|
170
180
|
|
|
181
|
+
public appendChild (child: TaroNode): TaroNode {
|
|
182
|
+
this.connectParentNode(child)
|
|
171
183
|
this.childNodes.push(child)
|
|
172
184
|
this.notifyDataAdd(this.childNodes.length - 1)
|
|
173
185
|
|
|
186
|
+
// @ts-ignore
|
|
187
|
+
child.toggleLayer?.(true)
|
|
188
|
+
|
|
174
189
|
checkIsCompileModeAndInstallAfterDOMAction(child, this)
|
|
175
190
|
return child
|
|
176
191
|
}
|
|
177
192
|
|
|
178
|
-
public insertBefore (newNode: TaroNode, referenceNode
|
|
193
|
+
public insertBefore (newNode: TaroNode, referenceNode?: TaroNode): TaroNode {
|
|
179
194
|
newNode.parentNode?.removeChild(newNode)
|
|
180
195
|
|
|
181
|
-
if (referenceNode
|
|
196
|
+
if (!referenceNode) {
|
|
182
197
|
this.appendChild(newNode)
|
|
183
198
|
} else {
|
|
184
199
|
const idxOfRef = this.findIndex(referenceNode)
|
|
185
200
|
this.childNodes.splice(idxOfRef, 0, newNode)
|
|
201
|
+
this.connectParentNode(newNode)
|
|
186
202
|
// TODO: 优化
|
|
187
203
|
this.notifyDataReload()
|
|
204
|
+
|
|
205
|
+
// @ts-ignore
|
|
206
|
+
newNode.toggleLayer?.(true)
|
|
188
207
|
}
|
|
189
208
|
|
|
190
209
|
checkIsCompileModeAndInstallAfterDOMAction(newNode, this)
|
|
@@ -203,6 +222,7 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
203
222
|
oldChild.dispose()
|
|
204
223
|
this.notifyDataChange(idxOfRef)
|
|
205
224
|
|
|
225
|
+
checkIsCompileModeAndUninstallAfterDOMAction(oldChild)
|
|
206
226
|
checkIsCompileModeAndInstallAfterDOMAction(newChild, this)
|
|
207
227
|
|
|
208
228
|
return oldChild
|
|
@@ -224,11 +244,16 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
224
244
|
}
|
|
225
245
|
|
|
226
246
|
public dispose () {
|
|
247
|
+
// 渲染,层级大于0的节点需要让其回到正常层级,然后删掉
|
|
248
|
+
// @ts-ignore
|
|
249
|
+
this.toggleLayer?.(false)
|
|
250
|
+
|
|
227
251
|
this.parentNode = null
|
|
228
252
|
this.childNodes = []
|
|
229
253
|
}
|
|
230
254
|
}
|
|
231
255
|
|
|
256
|
+
@Observed
|
|
232
257
|
export class TaroTextNode extends TaroNode {
|
|
233
258
|
constructor(value = '', nodeName = '#text', nodeType: NodeType = NodeType.TEXT_NODE) {
|
|
234
259
|
super(nodeName, nodeType)
|
|
@@ -252,7 +277,7 @@ function checkIsCompileModeAndInstallAfterDOMAction (node: TaroNode, parentNode:
|
|
|
252
277
|
}
|
|
253
278
|
|
|
254
279
|
function checkIsCompileModeAndUninstallAfterDOMAction (node: TaroNode) {
|
|
255
|
-
if (!node._isCompileMode || !
|
|
280
|
+
if (!node._isCompileMode || !node?._instance) return
|
|
256
281
|
|
|
257
282
|
node._instance.dynamicCenter?.uninstall?.(node)
|
|
258
283
|
}
|