@tarojs/plugin-platform-harmony-ets 4.0.0-beta.8 → 4.0.0-beta.80
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/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/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 +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 +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 +372 -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 +87 -43
- 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 +409 -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 +334 -58
- package/dist/runtime-ets/dom/element/form.ts +23 -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 +51 -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 +49 -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 +7 -2
- 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 +449 -219
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +449 -219
- package/dist/runtime.js.map +1 -1
- package/index.js +3 -1
- package/package.json +13 -13
- 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/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
|
|
|
@@ -59,35 +60,38 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
59
60
|
return this.childNodes[index] as TaroElement
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
public findIndex (refChild
|
|
63
|
-
return this.childNodes.findIndex(node => node._nid === refChild
|
|
63
|
+
public findIndex (refChild?: TaroNode): number {
|
|
64
|
+
return this.childNodes.findIndex(node => node._nid === refChild?._nid)
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (
|
|
67
|
+
public updateTextNode () {
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
if (this.childNodes.length <= 0 || this.tagName !== 'VIEW') return
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
// TextNode 不具备 props 更新能力,需要由父节点来进行触发
|
|
72
|
+
this.childNodes.forEach(item => {
|
|
73
|
+
if (item.nodeType !== NodeType.TEXT_NODE) return
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
item._updateTrigger++
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 更新对应的 ArkUI 组件
|
|
80
|
+
public updateComponent () {
|
|
81
|
+
// 非半编译模式或者半编译模式下拥有自主更新权力的节点走 @State 的更新模式
|
|
82
|
+
if (this._isDynamicNode || (!this._isCompileMode && this._instance)) {
|
|
83
|
+
this._updateTrigger++
|
|
79
84
|
} else {
|
|
80
|
-
|
|
81
|
-
if (idx >= 0) {
|
|
82
|
-
this._updateTrigger++
|
|
83
|
-
this.parentNode.notifyDataChange(idx)
|
|
84
|
-
} else {
|
|
85
|
-
this.parentNode.notifyDataReload()
|
|
86
|
-
}
|
|
85
|
+
this.parentNode?.updateComponent()
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
|
|
89
|
+
// 提供唯一标识,方便与小程序一致,能根据uid获取到对应的节点
|
|
90
|
+
public get uid (): string {
|
|
91
|
+
return this._nid
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public get firstChild (): TaroNode | null {
|
|
91
95
|
return this.childNodes[0] || null
|
|
92
96
|
}
|
|
93
97
|
|
|
@@ -128,11 +132,15 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
128
132
|
public set textContent (value: string) {
|
|
129
133
|
if (this.nodeType === NodeType.TEXT_NODE) {
|
|
130
134
|
this._textContent = value
|
|
131
|
-
this.
|
|
135
|
+
if (!this._instance) {
|
|
136
|
+
this.updateComponent()
|
|
137
|
+
}
|
|
132
138
|
} else if (this.nodeType === NodeType.ELEMENT_NODE) {
|
|
133
139
|
const node = new TaroTextNode(value)
|
|
134
140
|
node._doc = this.ownerDocument
|
|
135
|
-
|
|
141
|
+
node.parentNode = this
|
|
142
|
+
this.childNodes.length = 0
|
|
143
|
+
this.childNodes.push(node)
|
|
136
144
|
}
|
|
137
145
|
}
|
|
138
146
|
|
|
@@ -150,7 +158,6 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
150
158
|
public set nodeValue (value: string | null) {
|
|
151
159
|
if (this.nodeType === NodeType.TEXT_NODE && value) {
|
|
152
160
|
this.textContent = value
|
|
153
|
-
this.parentNode?.updateComponent()
|
|
154
161
|
}
|
|
155
162
|
}
|
|
156
163
|
|
|
@@ -163,28 +170,37 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
163
170
|
}
|
|
164
171
|
|
|
165
172
|
// TODO cloneNode()、contains()
|
|
166
|
-
|
|
167
|
-
public appendChild (child: TaroNode): TaroNode {
|
|
173
|
+
public connectParentNode (child: TaroNode) {
|
|
168
174
|
child.parentNode?.removeChild(child)
|
|
169
175
|
child.parentNode = this
|
|
176
|
+
}
|
|
170
177
|
|
|
178
|
+
public appendChild (child: TaroNode): TaroNode {
|
|
179
|
+
this.connectParentNode(child)
|
|
171
180
|
this.childNodes.push(child)
|
|
172
181
|
this.notifyDataAdd(this.childNodes.length - 1)
|
|
173
182
|
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
child.toggleLayer?.(true)
|
|
185
|
+
|
|
174
186
|
checkIsCompileModeAndInstallAfterDOMAction(child, this)
|
|
175
187
|
return child
|
|
176
188
|
}
|
|
177
189
|
|
|
178
|
-
public insertBefore (newNode: TaroNode, referenceNode
|
|
190
|
+
public insertBefore (newNode: TaroNode, referenceNode?: TaroNode): TaroNode {
|
|
179
191
|
newNode.parentNode?.removeChild(newNode)
|
|
180
192
|
|
|
181
|
-
if (referenceNode
|
|
193
|
+
if (!referenceNode) {
|
|
182
194
|
this.appendChild(newNode)
|
|
183
195
|
} else {
|
|
184
196
|
const idxOfRef = this.findIndex(referenceNode)
|
|
185
197
|
this.childNodes.splice(idxOfRef, 0, newNode)
|
|
198
|
+
this.connectParentNode(newNode)
|
|
186
199
|
// TODO: 优化
|
|
187
200
|
this.notifyDataReload()
|
|
201
|
+
|
|
202
|
+
// @ts-ignore
|
|
203
|
+
newNode.toggleLayer?.(true)
|
|
188
204
|
}
|
|
189
205
|
|
|
190
206
|
checkIsCompileModeAndInstallAfterDOMAction(newNode, this)
|
|
@@ -203,6 +219,7 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
203
219
|
oldChild.dispose()
|
|
204
220
|
this.notifyDataChange(idxOfRef)
|
|
205
221
|
|
|
222
|
+
checkIsCompileModeAndUninstallAfterDOMAction(oldChild)
|
|
206
223
|
checkIsCompileModeAndInstallAfterDOMAction(newChild, this)
|
|
207
224
|
|
|
208
225
|
return oldChild
|
|
@@ -224,11 +241,16 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
224
241
|
}
|
|
225
242
|
|
|
226
243
|
public dispose () {
|
|
244
|
+
// 渲染,层级大于0的节点需要让其回到正常层级,然后删掉
|
|
245
|
+
// @ts-ignore
|
|
246
|
+
this.toggleLayer?.(false)
|
|
247
|
+
|
|
227
248
|
this.parentNode = null
|
|
228
249
|
this.childNodes = []
|
|
229
250
|
}
|
|
230
251
|
}
|
|
231
252
|
|
|
253
|
+
@Observed
|
|
232
254
|
export class TaroTextNode extends TaroNode {
|
|
233
255
|
constructor(value = '', nodeName = '#text', nodeType: NodeType = NodeType.TEXT_NODE) {
|
|
234
256
|
super(nodeName, nodeType)
|
|
@@ -252,7 +274,7 @@ function checkIsCompileModeAndInstallAfterDOMAction (node: TaroNode, parentNode:
|
|
|
252
274
|
}
|
|
253
275
|
|
|
254
276
|
function checkIsCompileModeAndUninstallAfterDOMAction (node: TaroNode) {
|
|
255
|
-
if (!node._isCompileMode || !
|
|
277
|
+
if (!node._isCompileMode || !node?._instance) return
|
|
256
278
|
|
|
257
279
|
node._instance.dynamicCenter?.uninstall?.(node)
|
|
258
280
|
}
|