@tarojs/plugin-platform-harmony-ets 4.0.0-beta.12 → 4.0.0-beta.121
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 +60 -25
- package/dist/apis/base/weapp/life-cycle.ts +1 -1
- package/dist/apis/canvas/index.ts +10 -1
- package/dist/apis/device/clipboard.ts +23 -8
- package/dist/apis/framework/index.ts +2 -6
- package/dist/apis/index.ts +25 -17
- package/dist/apis/media/image/index.ts +169 -17
- package/dist/apis/route/index.ts +1 -2
- package/dist/apis/storage/index.ts +135 -131
- package/dist/apis/ui/animation/animation.ts +71 -29
- package/dist/apis/ui/background.ts +3 -2
- package/dist/apis/ui/interaction/index.ts +58 -59
- package/dist/apis/ui/navigation-bar/index.ts +2 -2
- package/dist/apis/ui/pull-down-refresh.ts +9 -3
- package/dist/apis/ui/scroll/index.ts +6 -6
- package/dist/apis/ui/tab-bar.ts +4 -5
- package/dist/apis/utils/index.ts +20 -2
- package/dist/apis/utils/permissions.ts +6 -0
- package/dist/apis/wxml/IntersectionObserver.ts +18 -10
- package/dist/apis/wxml/selectorQuery.ts +26 -13
- package/dist/components-harmony-ets/button.ets +36 -9
- package/dist/components-harmony-ets/canvas.ets +51 -0
- package/dist/components-harmony-ets/checkbox.ets +69 -60
- package/dist/components-harmony-ets/form.ets +33 -15
- package/dist/components-harmony-ets/icon.ets +16 -8
- package/dist/components-harmony-ets/image.ets +22 -6
- package/dist/components-harmony-ets/index.ets +39 -0
- package/dist/components-harmony-ets/innerHtml.ets +6 -5
- package/dist/components-harmony-ets/input.ets +63 -37
- package/dist/components-harmony-ets/label.ets +43 -21
- package/dist/components-harmony-ets/listView.ets +32 -0
- package/dist/components-harmony-ets/movableArea.ets +110 -51
- package/dist/components-harmony-ets/movableView.ets +74 -47
- 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 +36 -33
- package/dist/components-harmony-ets/progress.ets +31 -24
- package/dist/components-harmony-ets/pseudo.ets +80 -0
- package/dist/components-harmony-ets/radio.ets +75 -66
- package/dist/components-harmony-ets/richText.ets +4 -25
- package/dist/components-harmony-ets/scrollList.ets +108 -0
- package/dist/components-harmony-ets/scrollView.ets +46 -42
- package/dist/components-harmony-ets/slider.ets +19 -15
- package/dist/components-harmony-ets/stickySection.ets +42 -0
- package/dist/components-harmony-ets/style.ets +386 -129
- package/dist/components-harmony-ets/swiper.ets +42 -5
- 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 +102 -46
- package/dist/components-harmony-ets/textArea.ets +49 -34
- package/dist/components-harmony-ets/utils/AttributeManager.ets +2 -2
- 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 +20 -8
- 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 +169 -91
- package/dist/components-harmony-ets/video.ets +28 -20
- package/dist/components-harmony-ets/view.ets +45 -39
- package/dist/components-harmony-ets/webView.ets +6 -5
- package/dist/index.d.ts +152 -0
- package/dist/index.js +73 -44
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/URL.ts +2 -0
- package/dist/runtime-ets/bom/document.ts +5 -4
- package/dist/runtime-ets/bom/getComputedStyle.ts +2 -3
- package/dist/runtime-ets/bom/history.ts +1 -0
- package/dist/runtime-ets/bom/location.ts +1 -0
- package/dist/runtime-ets/bom/navigator.ts +1 -21
- package/dist/runtime-ets/bom/raf.ts +1 -37
- package/dist/runtime-ets/bom/window.ts +10 -4
- package/dist/runtime-ets/constant.ts +17 -10
- package/dist/runtime-ets/current.ts +5 -2
- 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 +9 -12
- package/dist/runtime-ets/dom/element/canvas.ts +137 -0
- package/dist/runtime-ets/dom/element/element.ts +379 -55
- package/dist/runtime-ets/dom/element/form.ts +26 -22
- package/dist/runtime-ets/dom/element/index.ts +22 -2
- package/dist/runtime-ets/dom/element/movableArea.ts +0 -1
- package/dist/runtime-ets/dom/element/movableView.ts +238 -2
- package/dist/runtime-ets/dom/element/normal.ts +27 -6
- package/dist/runtime-ets/dom/element/progress.ts +0 -2
- package/dist/runtime-ets/dom/element/text.ts +0 -8
- package/dist/runtime-ets/dom/element/video.ts +4 -4
- package/dist/runtime-ets/dom/element/webView.ts +4 -5
- package/dist/runtime-ets/dom/event-source.ts +1 -0
- package/dist/runtime-ets/dom/event.ts +3 -5
- package/dist/runtime-ets/dom/eventTarget.ts +3 -4
- package/dist/runtime-ets/dom/node.ts +53 -22
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +418 -237
- package/dist/runtime-ets/dom/stylesheet/index.ts +29 -311
- package/dist/runtime-ets/dom/stylesheet/type.ts +53 -11
- package/dist/runtime-ets/dom/stylesheet/util.ts +33 -27
- package/dist/runtime-ets/emitter/emitter.ts +1 -0
- package/dist/runtime-ets/env.ts +1 -0
- package/dist/runtime-ets/index.ts +23 -7
- package/dist/runtime-ets/interface/event.ts +1 -1
- package/dist/runtime-ets/interface/index.ts +6 -0
- package/dist/runtime-ets/utils/index.ts +78 -19
- package/dist/runtime-ets/utils/info.ts +2 -2
- package/dist/runtime-ets/utils/router.ts +9 -0
- package/dist/runtime-framework/react/app.ts +15 -11
- package/dist/runtime-framework/react/hooks.ts +1 -2
- package/dist/runtime-framework/react/index.ts +0 -2
- package/dist/runtime-framework/react/native-page.ts +217 -81
- package/dist/runtime-framework/react/page.ts +4 -10
- package/dist/runtime-framework/react/utils/index.ts +3 -3
- package/dist/runtime-framework/solid/app.ts +29 -46
- 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 -31
- package/dist/runtime-framework/solid/reconciler/props.ts +73 -29
- 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 +3 -5
- package/dist/runtime-utils.d.ts +827 -0
- package/dist/runtime-utils.js +574 -285
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +574 -285
- 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 +5 -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
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { eventSource } from '@tarojs/runtime/dist/runtime.esm'
|
|
2
|
-
|
|
3
1
|
import TaroDataSourceElement from './dataSource'
|
|
2
|
+
import { eventSource } from './event-source'
|
|
4
3
|
|
|
5
4
|
import type { StandardProps } from '@tarojs/components/types'
|
|
6
|
-
import type { TaroAny } from '../
|
|
5
|
+
import type { TaroAny } from '../interface'
|
|
7
6
|
import type { TaroDocument } from './document'
|
|
8
7
|
import type { TaroElement } from './element/element'
|
|
9
8
|
|
|
@@ -21,8 +20,8 @@ export enum NodeType {
|
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
let _id = 0
|
|
24
|
-
function genId ():
|
|
25
|
-
return
|
|
23
|
+
function genId (): number {
|
|
24
|
+
return ++_id
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
export class TaroNode extends TaroDataSourceElement {
|
|
@@ -30,8 +29,9 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
30
29
|
public readonly nodeType: NodeType
|
|
31
30
|
public childNodes: TaroNode[] = []
|
|
32
31
|
public parentNode: TaroNode | null = null
|
|
33
|
-
public _nid:
|
|
32
|
+
public _nid: number = genId()
|
|
34
33
|
public _doc: TaroDocument | null = null
|
|
34
|
+
public _instance?: TaroAny
|
|
35
35
|
|
|
36
36
|
private _textContent = ''
|
|
37
37
|
|
|
@@ -43,6 +43,9 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
43
43
|
// 是否为半编译模板下拥有自主更新权的节点
|
|
44
44
|
public _isDynamicNode = false
|
|
45
45
|
|
|
46
|
+
// 以下属性为原生混写组件才有意义的属性
|
|
47
|
+
public _nativeUpdateTrigger = 0
|
|
48
|
+
|
|
46
49
|
constructor(nodeName: string, nodeType = NodeType.ELEMENT_NODE) {
|
|
47
50
|
super()
|
|
48
51
|
|
|
@@ -59,8 +62,16 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
59
62
|
return this.childNodes[index] as TaroElement
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
public
|
|
63
|
-
return this.
|
|
65
|
+
public getStrNid() {
|
|
66
|
+
return `n_${this._nid}`
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public getNumNid(id) {
|
|
70
|
+
return +id.slice(2)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public findIndex (refChild?: TaroNode): number {
|
|
74
|
+
return this.childNodes.findIndex(node => node._nid === refChild?._nid)
|
|
64
75
|
}
|
|
65
76
|
|
|
66
77
|
public updateTextNode () {
|
|
@@ -77,17 +88,20 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
77
88
|
|
|
78
89
|
// 更新对应的 ArkUI 组件
|
|
79
90
|
public updateComponent () {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// 半编译模式下走 @State 的更新模式
|
|
83
|
-
if (this._isDynamicNode) {
|
|
91
|
+
// 非半编译模式或者半编译模式下拥有自主更新权力的节点走 @State 的更新模式
|
|
92
|
+
if (this._isDynamicNode || (!this._isCompileMode && this._instance)) {
|
|
84
93
|
this._updateTrigger++
|
|
85
94
|
} else {
|
|
86
|
-
this.parentNode
|
|
95
|
+
this.parentNode?.updateComponent()
|
|
87
96
|
}
|
|
88
97
|
}
|
|
89
98
|
|
|
90
|
-
|
|
99
|
+
// 提供唯一标识,方便与小程序一致,能根据uid获取到对应的节点
|
|
100
|
+
public get uid (): string {
|
|
101
|
+
return `${this._nid}`
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public get firstChild (): TaroNode | null {
|
|
91
105
|
return this.childNodes[0] || null
|
|
92
106
|
}
|
|
93
107
|
|
|
@@ -128,11 +142,15 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
128
142
|
public set textContent (value: string) {
|
|
129
143
|
if (this.nodeType === NodeType.TEXT_NODE) {
|
|
130
144
|
this._textContent = value
|
|
131
|
-
this.
|
|
145
|
+
if (!this._instance) {
|
|
146
|
+
this.updateComponent()
|
|
147
|
+
}
|
|
132
148
|
} else if (this.nodeType === NodeType.ELEMENT_NODE) {
|
|
133
149
|
const node = new TaroTextNode(value)
|
|
134
150
|
node._doc = this.ownerDocument
|
|
135
|
-
|
|
151
|
+
node.parentNode = this
|
|
152
|
+
this.childNodes.length = 0
|
|
153
|
+
this.childNodes.push(node)
|
|
136
154
|
}
|
|
137
155
|
}
|
|
138
156
|
|
|
@@ -150,7 +168,6 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
150
168
|
public set nodeValue (value: string | null) {
|
|
151
169
|
if (this.nodeType === NodeType.TEXT_NODE && value) {
|
|
152
170
|
this.textContent = value
|
|
153
|
-
this.parentNode?.updateComponent()
|
|
154
171
|
}
|
|
155
172
|
}
|
|
156
173
|
|
|
@@ -163,28 +180,37 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
163
180
|
}
|
|
164
181
|
|
|
165
182
|
// TODO cloneNode()、contains()
|
|
166
|
-
|
|
167
|
-
public appendChild (child: TaroNode): TaroNode {
|
|
183
|
+
public connectParentNode (child: TaroNode) {
|
|
168
184
|
child.parentNode?.removeChild(child)
|
|
169
185
|
child.parentNode = this
|
|
186
|
+
}
|
|
170
187
|
|
|
188
|
+
public appendChild (child: TaroNode): TaroNode {
|
|
189
|
+
this.connectParentNode(child)
|
|
171
190
|
this.childNodes.push(child)
|
|
172
191
|
this.notifyDataAdd(this.childNodes.length - 1)
|
|
173
192
|
|
|
193
|
+
// @ts-ignore
|
|
194
|
+
child.toggleLayer?.(true)
|
|
195
|
+
|
|
174
196
|
checkIsCompileModeAndInstallAfterDOMAction(child, this)
|
|
175
197
|
return child
|
|
176
198
|
}
|
|
177
199
|
|
|
178
|
-
public insertBefore (newNode: TaroNode, referenceNode
|
|
200
|
+
public insertBefore (newNode: TaroNode, referenceNode?: TaroNode): TaroNode {
|
|
179
201
|
newNode.parentNode?.removeChild(newNode)
|
|
180
202
|
|
|
181
|
-
if (referenceNode
|
|
203
|
+
if (!referenceNode) {
|
|
182
204
|
this.appendChild(newNode)
|
|
183
205
|
} else {
|
|
184
206
|
const idxOfRef = this.findIndex(referenceNode)
|
|
185
207
|
this.childNodes.splice(idxOfRef, 0, newNode)
|
|
208
|
+
this.connectParentNode(newNode)
|
|
186
209
|
// TODO: 优化
|
|
187
210
|
this.notifyDataReload()
|
|
211
|
+
|
|
212
|
+
// @ts-ignore
|
|
213
|
+
newNode.toggleLayer?.(true)
|
|
188
214
|
}
|
|
189
215
|
|
|
190
216
|
checkIsCompileModeAndInstallAfterDOMAction(newNode, this)
|
|
@@ -203,6 +229,7 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
203
229
|
oldChild.dispose()
|
|
204
230
|
this.notifyDataChange(idxOfRef)
|
|
205
231
|
|
|
232
|
+
checkIsCompileModeAndUninstallAfterDOMAction(oldChild)
|
|
206
233
|
checkIsCompileModeAndInstallAfterDOMAction(newChild, this)
|
|
207
234
|
|
|
208
235
|
return oldChild
|
|
@@ -224,6 +251,10 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
224
251
|
}
|
|
225
252
|
|
|
226
253
|
public dispose () {
|
|
254
|
+
// 渲染,层级大于0的节点需要让其回到正常层级,然后删掉
|
|
255
|
+
// @ts-ignore
|
|
256
|
+
this.toggleLayer?.(false)
|
|
257
|
+
|
|
227
258
|
this.parentNode = null
|
|
228
259
|
this.childNodes = []
|
|
229
260
|
}
|
|
@@ -253,7 +284,7 @@ function checkIsCompileModeAndInstallAfterDOMAction (node: TaroNode, parentNode:
|
|
|
253
284
|
}
|
|
254
285
|
|
|
255
286
|
function checkIsCompileModeAndUninstallAfterDOMAction (node: TaroNode) {
|
|
256
|
-
if (!node._isCompileMode || !
|
|
287
|
+
if (!node._isCompileMode || !node?._instance) return
|
|
257
288
|
|
|
258
289
|
node._instance.dynamicCenter?.uninstall?.(node)
|
|
259
290
|
}
|