@tarojs/plugin-platform-harmony-ets 3.7.0-alpha.27 → 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.
Files changed (239) hide show
  1. package/dist/apis/apis.ts +6 -2
  2. package/dist/apis/base/crypto.ts +4 -0
  3. package/dist/apis/base/debug.ts +5 -0
  4. package/dist/apis/base/index.ts +9 -1
  5. package/dist/apis/base/performance.ts +8 -0
  6. package/dist/apis/base/system.ts +74 -21
  7. package/dist/apis/base/update.ts +5 -0
  8. package/dist/apis/base/weapp/app-event.ts +75 -0
  9. package/dist/apis/base/weapp/life-cycle.ts +21 -0
  10. package/dist/apis/canvas/index.ts +27 -0
  11. package/dist/apis/data-analysis/index.ts +6 -0
  12. package/dist/apis/device/accelerometer.ts +2 -1
  13. package/dist/apis/device/accessibility.ts +4 -0
  14. package/dist/apis/device/battery.ts +2 -2
  15. package/dist/apis/device/bluetooth-ble.ts +19 -0
  16. package/dist/apis/device/bluetooth-peripheral.ts +6 -0
  17. package/dist/apis/device/bluetooth.ts +16 -0
  18. package/dist/apis/device/calendar.ts +5 -0
  19. package/dist/apis/device/clipboard.ts +17 -9
  20. package/dist/apis/device/compass.ts +21 -0
  21. package/dist/apis/device/contact.ts +5 -0
  22. package/dist/apis/device/crypto.ts +4 -0
  23. package/dist/apis/device/gyroscope.ts +7 -0
  24. package/dist/apis/device/iBeacon.ts +10 -0
  25. package/dist/apis/device/index.ts +15 -0
  26. package/dist/apis/device/keyboard.ts +2 -1
  27. package/dist/apis/device/memory.ts +10 -3
  28. package/dist/apis/device/motion.ts +6 -0
  29. package/dist/apis/device/network.ts +26 -9
  30. package/dist/apis/device/nfc.ts +10 -0
  31. package/dist/apis/device/phone.ts +2 -1
  32. package/dist/apis/device/scan.ts +4 -0
  33. package/dist/apis/device/screen.ts +2 -1
  34. package/dist/apis/device/sms.ts +4 -0
  35. package/dist/apis/device/vibrate.ts +19 -11
  36. package/dist/apis/device/wifi.ts +15 -0
  37. package/dist/apis/ext/index.ts +5 -0
  38. package/dist/apis/files/index.ts +2 -1
  39. package/dist/apis/files/manager.ts +2 -1
  40. package/dist/apis/framework/index.ts +3 -8
  41. package/dist/apis/index.ts +27 -17
  42. package/dist/apis/location/index.ts +61 -68
  43. package/dist/apis/media/EditorContext.ts +32 -0
  44. package/dist/apis/media/audio/index.ts +18 -0
  45. package/dist/apis/media/background-audio/index.ts +16 -0
  46. package/dist/apis/media/camera.ts +16 -0
  47. package/dist/apis/media/common.ts +2 -1
  48. package/dist/apis/media/{image.ts → image/index.ts} +4 -3
  49. package/dist/apis/media/index.ts +10 -0
  50. package/dist/apis/media/live.ts +5 -0
  51. package/dist/apis/media/map.ts +4 -0
  52. package/dist/apis/media/media-recorder.ts +4 -0
  53. package/dist/apis/media/recorder.ts +6 -0
  54. package/dist/apis/media/video/VideoContext.ts +68 -0
  55. package/dist/apis/media/{video.ts → video/index.ts} +13 -2
  56. package/dist/apis/media/video-decoder.ts +4 -0
  57. package/dist/apis/media/video-processing.ts +4 -0
  58. package/dist/apis/media/voip.ts +19 -0
  59. package/dist/apis/network/index.ts +3 -0
  60. package/dist/apis/network/mdns.ts +13 -0
  61. package/dist/apis/network/request.ts +7 -6
  62. package/dist/apis/network/tcp.ts +4 -0
  63. package/dist/apis/network/udp.ts +4 -0
  64. package/dist/apis/network/webSocket.ts +2 -6
  65. package/dist/apis/open-api/account.ts +4 -0
  66. package/dist/apis/open-api/address.ts +4 -0
  67. package/dist/apis/open-api/authorize.ts +5 -0
  68. package/dist/apis/open-api/card.ts +5 -0
  69. package/dist/apis/open-api/channels-live.ts +11 -0
  70. package/dist/apis/open-api/customer-service.ts +4 -0
  71. package/dist/apis/open-api/device-voip.ts +5 -0
  72. package/dist/apis/open-api/facial.ts +7 -0
  73. package/dist/apis/open-api/favorites.ts +5 -0
  74. package/dist/apis/open-api/group.ts +4 -0
  75. package/dist/apis/open-api/index.ts +20 -6
  76. package/dist/apis/open-api/invoice.ts +5 -0
  77. package/dist/apis/open-api/license-plate.ts +4 -0
  78. package/dist/apis/open-api/login.ts +6 -0
  79. package/dist/apis/open-api/my-miniprogram.ts +4 -0
  80. package/dist/apis/open-api/privacy.ts +7 -0
  81. package/dist/apis/open-api/red-package.ts +4 -0
  82. package/dist/apis/open-api/settings.ts +5 -0
  83. package/dist/apis/open-api/soter.ts +6 -0
  84. package/dist/apis/open-api/subscribe-message.ts +6 -0
  85. package/dist/apis/open-api/{user-info/index.ts → user-info.ts} +1 -16
  86. package/dist/apis/open-api/werun.ts +5 -0
  87. package/dist/apis/payment/index.ts +6 -0
  88. package/dist/apis/route/index.ts +19 -28
  89. package/dist/apis/share/index.ts +33 -0
  90. package/dist/apis/storage/background-fetch.ts +7 -0
  91. package/dist/apis/storage/cache-manager.ts +4 -0
  92. package/dist/apis/storage/index.ts +158 -88
  93. package/dist/apis/ui/{animation.ts → animation/animation.ts} +73 -31
  94. package/dist/apis/ui/animation/index.ts +7 -0
  95. package/dist/apis/ui/background.ts +4 -19
  96. package/dist/apis/ui/custom-component.ts +8 -0
  97. package/dist/apis/ui/fonts.ts +4 -0
  98. package/dist/apis/ui/index.ts +8 -10
  99. package/dist/apis/ui/interaction/index.ts +45 -59
  100. package/dist/apis/ui/menu.ts +4 -0
  101. package/dist/apis/ui/navigation-bar/index.ts +60 -21
  102. package/dist/apis/ui/pull-down-refresh.ts +10 -4
  103. package/dist/apis/{page → ui/scroll}/index.ts +32 -27
  104. package/dist/apis/ui/sticky.ts +4 -0
  105. package/dist/apis/{tabbar/index.ts → ui/tab-bar.ts} +6 -8
  106. package/dist/apis/ui/window.ts +20 -0
  107. package/dist/apis/utils/handler.ts +4 -4
  108. package/dist/apis/utils/index.ts +1 -1
  109. package/dist/apis/worker/index.ts +4 -0
  110. package/dist/apis/wxml/IntersectionObserver.ts +24 -25
  111. package/dist/apis/wxml/index.ts +7 -2
  112. package/dist/apis/wxml/nodesRef.ts +2 -2
  113. package/dist/apis/wxml/selectorQuery.ts +29 -17
  114. package/dist/components-harmony-ets/button.ets +106 -80
  115. package/dist/components-harmony-ets/canvas.ets +51 -0
  116. package/dist/components-harmony-ets/checkbox.ets +82 -148
  117. package/dist/components-harmony-ets/form.ets +45 -132
  118. package/dist/components-harmony-ets/icon.ets +66 -69
  119. package/dist/components-harmony-ets/image.ets +26 -61
  120. package/dist/components-harmony-ets/index.ets +92 -0
  121. package/dist/components-harmony-ets/innerHtml.ets +7 -70
  122. package/dist/components-harmony-ets/input.ets +60 -146
  123. package/dist/components-harmony-ets/label.ets +86 -92
  124. package/dist/components-harmony-ets/listView.ets +26 -0
  125. package/dist/components-harmony-ets/movableArea.ets +124 -0
  126. package/dist/components-harmony-ets/movableView.ets +93 -0
  127. package/dist/components-harmony-ets/navigationBar.ets +65 -0
  128. package/dist/components-harmony-ets/pageMeta.ets +94 -0
  129. package/dist/components-harmony-ets/picker.ets +172 -198
  130. package/dist/components-harmony-ets/progress.ets +52 -0
  131. package/dist/components-harmony-ets/pseudo.ets +80 -0
  132. package/dist/components-harmony-ets/radio.ets +85 -155
  133. package/dist/components-harmony-ets/richText.ets +15 -87
  134. package/dist/components-harmony-ets/scrollList.ets +94 -0
  135. package/dist/components-harmony-ets/scrollView.ets +81 -149
  136. package/dist/components-harmony-ets/slider.ets +47 -94
  137. package/dist/components-harmony-ets/stickySection.ets +42 -0
  138. package/dist/components-harmony-ets/style.ets +396 -0
  139. package/dist/components-harmony-ets/swiper.ets +51 -151
  140. package/dist/components-harmony-ets/switch.ets +35 -76
  141. package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
  142. package/dist/components-harmony-ets/text.ets +131 -76
  143. package/dist/components-harmony-ets/textArea.ets +64 -140
  144. package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
  145. package/dist/components-harmony-ets/utils/DynamicCenter.ts +4 -13
  146. package/dist/components-harmony-ets/utils/constant/style.ets +9 -6
  147. package/dist/components-harmony-ets/utils/flexManager.ets +68 -85
  148. package/dist/components-harmony-ets/utils/helper.ets +18 -65
  149. package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
  150. package/dist/components-harmony-ets/utils/htmlParser/index.ts +1 -1
  151. package/dist/components-harmony-ets/utils/index.ts +55 -51
  152. package/dist/components-harmony-ets/utils/styles.ets +177 -65
  153. package/dist/components-harmony-ets/video.ets +70 -116
  154. package/dist/components-harmony-ets/view.ets +58 -64
  155. package/dist/components-harmony-ets/webView.ets +56 -0
  156. package/dist/index.d.ts +152 -0
  157. package/dist/index.js +230 -60
  158. package/dist/index.js.map +1 -1
  159. package/dist/runtime-ets/bom/document.ts +6 -4
  160. package/dist/runtime-ets/bom/getComputedStyle.ts +2 -2
  161. package/dist/runtime-ets/bom/window.ts +9 -2
  162. package/dist/runtime-ets/current.ts +3 -0
  163. package/dist/runtime-ets/dom/bind.ts +96 -0
  164. package/dist/runtime-ets/dom/class-list.ts +4 -6
  165. package/dist/runtime-ets/dom/comment.ts +1 -2
  166. package/dist/runtime-ets/dom/cssNesting.ts +409 -0
  167. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +30 -20
  168. package/dist/runtime-ets/dom/dataSource.ts +64 -0
  169. package/dist/runtime-ets/dom/document.ts +36 -51
  170. package/dist/runtime-ets/dom/element/canvas.ts +136 -0
  171. package/dist/runtime-ets/dom/element/element.ts +439 -0
  172. package/dist/runtime-ets/dom/element/form.ts +403 -0
  173. package/dist/runtime-ets/dom/element/index.ts +120 -0
  174. package/dist/runtime-ets/dom/element/movableArea.ts +11 -0
  175. package/dist/runtime-ets/dom/element/movableView.ts +242 -0
  176. package/dist/runtime-ets/dom/element/normal.ts +103 -0
  177. package/dist/runtime-ets/dom/element/progress.ts +11 -0
  178. package/dist/runtime-ets/dom/element/scrollView.ts +15 -0
  179. package/dist/runtime-ets/dom/element/text.ts +10 -0
  180. package/dist/runtime-ets/dom/element/video.ts +50 -0
  181. package/dist/runtime-ets/dom/element/webView.ts +68 -0
  182. package/dist/runtime-ets/dom/event.ts +26 -5
  183. package/dist/runtime-ets/dom/eventTarget.ts +3 -3
  184. package/dist/runtime-ets/dom/node.ts +114 -49
  185. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +805 -0
  186. package/dist/runtime-ets/dom/stylesheet/index.ts +122 -429
  187. package/dist/runtime-ets/dom/stylesheet/type.ts +93 -17
  188. package/dist/runtime-ets/dom/stylesheet/util.ts +145 -17
  189. package/dist/runtime-ets/index.ts +2 -3
  190. package/dist/runtime-ets/interface/event.ts +3 -2
  191. package/dist/runtime-ets/utils/index.ts +87 -17
  192. package/dist/runtime-ets/utils/info.ts +21 -47
  193. package/dist/runtime-framework/react/app.ts +20 -28
  194. package/dist/runtime-framework/react/hooks.ts +3 -4
  195. package/dist/runtime-framework/react/index.ts +1 -2
  196. package/dist/runtime-framework/react/native-page.ts +421 -0
  197. package/dist/runtime-framework/react/page.ts +5 -17
  198. package/dist/runtime-framework/solid/app.ts +25 -45
  199. package/dist/runtime-framework/solid/connect.ts +21 -3
  200. package/dist/runtime-framework/solid/hooks.ts +17 -12
  201. package/dist/runtime-framework/solid/index.ts +6 -2
  202. package/dist/runtime-framework/solid/page.ts +84 -36
  203. package/dist/runtime-framework/solid/reconciler/props.ts +70 -25
  204. package/dist/runtime-framework/solid/reconciler/render.ts +16 -6
  205. package/dist/runtime-framework/solid/reconciler/use.ts +0 -1
  206. package/dist/runtime-framework/solid/utils/index.ts +0 -2
  207. package/dist/runtime-utils.d.ts +827 -0
  208. package/dist/runtime-utils.js +1633 -549
  209. package/dist/runtime-utils.js.map +1 -1
  210. package/dist/runtime.d.ts +1 -0
  211. package/dist/runtime.js +1633 -549
  212. package/dist/runtime.js.map +1 -1
  213. package/index.js +3 -1
  214. package/package.json +14 -15
  215. package/static/media/cancel.svg +1 -0
  216. package/static/media/circle.svg +1 -0
  217. package/static/media/clear.svg +1 -0
  218. package/static/media/download.svg +1 -0
  219. package/static/media/info.svg +1 -0
  220. package/static/media/info_circle.svg +1 -0
  221. package/static/media/search.svg +1 -0
  222. package/static/media/success.svg +1 -0
  223. package/static/media/success_no_circle.svg +1 -0
  224. package/static/media/taro_arrow_left.svg +1 -0
  225. package/static/media/taro_home.svg +1 -0
  226. package/static/media/waiting.svg +1 -0
  227. package/static/media/warn.svg +1 -0
  228. package/types/harmony.d.ts +4 -0
  229. package/types/index.d.ts +4 -0
  230. package/types/runtime.d.ts +7 -1
  231. package/LICENSE +0 -160
  232. package/dist/components-harmony-ets/base.ets +0 -63
  233. package/dist/components-harmony-ets/element.ets +0 -223
  234. package/dist/components-harmony-ets/utils/constant/icon.ts +0 -19
  235. package/dist/runtime-ets/dom/element.ts +0 -457
  236. package/dist/runtime-ets/dom/text.ts +0 -19
  237. package/dist/runtime-ets/utils/bind.ts +0 -35
  238. package/types/api.d.ts +0 -4
  239. /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
@@ -1,9 +1,11 @@
1
1
  import { eventSource } from '@tarojs/runtime/dist/runtime.esm'
2
2
 
3
- import { TaroEventTarget } from './eventTarget'
3
+ import TaroDataSourceElement from './dataSource'
4
4
 
5
+ import type { StandardProps } from '@tarojs/components/types'
6
+ import type { TaroAny } from '../utils'
5
7
  import type { TaroDocument } from './document'
6
- import type { TaroElement } from './element'
8
+ import type { TaroElement } from './element/element'
7
9
 
8
10
  export enum NodeType {
9
11
  ELEMENT_NODE = 1,
@@ -23,45 +25,73 @@ function genId (): string {
23
25
  return `_n_${_id++}`
24
26
  }
25
27
 
26
- export class TaroNode extends TaroEventTarget {
28
+ export class TaroNode extends TaroDataSourceElement {
27
29
  public readonly nodeName: string
28
30
  public readonly nodeType: NodeType
29
31
  public childNodes: TaroNode[] = []
30
32
  public parentNode: TaroNode | null = null
31
33
  public _nid: string = genId()
34
+ public _doc: TaroDocument | null = null
35
+ public _instance?: TaroAny
32
36
 
33
- public _doc: TaroDocument
37
+ private _textContent = ''
38
+
39
+ // 以下属性为半编译模式下才会赋值和使用的属性
40
+ // 半编译节点更新触发器
41
+ public _updateTrigger = 0
34
42
  // 是否为半编译模板下的节点
35
43
  public _isCompileMode = false
36
44
  // 是否为半编译模板下拥有自主更新权的节点
37
45
  public _isDynamicNode = false
38
- public _instance: any
39
46
 
40
- private _updateTrigger = 0
41
- private _textContent = ''
42
-
43
- constructor(nodeName, nodeType = NodeType.ELEMENT_NODE) {
47
+ constructor(nodeName: string, nodeType = NodeType.ELEMENT_NODE) {
44
48
  super()
49
+
45
50
  this.nodeType = nodeType
46
51
  this.nodeName = nodeName
47
- eventSource.set(this._nid, this as any)
52
+ eventSource.set(this._nid, this as TaroAny)
53
+ }
54
+
55
+ totalCount(): number {
56
+ return this.childNodes?.length || 0
57
+ }
58
+
59
+ getData(index: number): TaroElement<StandardProps> {
60
+ return this.childNodes[index] as TaroElement
48
61
  }
49
62
 
50
- protected findIndex (refChild: TaroNode): number {
51
- // @Observe 会影响 === 判断,只能比较 _nid
52
- return this.childNodes.findIndex(node => node._nid === refChild._nid)
63
+ public findIndex (refChild?: TaroNode): number {
64
+ return this.childNodes.findIndex(node => node._nid === refChild?._nid)
65
+ }
66
+
67
+ public updateTextNode () {
68
+ // @ts-ignore
69
+ if (this.childNodes.length <= 0 || this.tagName !== 'VIEW') return
70
+
71
+ // TextNode 不具备 props 更新能力,需要由父节点来进行触发
72
+ this.childNodes.forEach(item => {
73
+ if (item.nodeType !== NodeType.TEXT_NODE) return
74
+
75
+ item._updateTrigger++
76
+ })
53
77
  }
54
78
 
55
79
  // 更新对应的 ArkUI 组件
56
80
  public updateComponent () {
57
- if (this._isDynamicNode || !this._isCompileMode) {
58
- this._updateTrigger += 1
81
+ // 非半编译模式或者半编译模式下拥有自主更新权力的节点走 @State 的更新模式
82
+ if (this._isDynamicNode || (!this._isCompileMode && this._instance)) {
83
+ this._updateTrigger++
59
84
  } else {
60
85
  this.parentNode?.updateComponent()
61
86
  }
62
87
  }
63
88
 
64
- public get firstChild (): TaroNode | null{
89
+ // 提供唯一标识,方便与小程序一致,能根据uid获取到对应的节点
90
+ public get uid (): string {
91
+ return this._nid
92
+ }
93
+
94
+ public get firstChild (): TaroNode | null {
65
95
  return this.childNodes[0] || null
66
96
  }
67
97
 
@@ -102,15 +132,15 @@ export class TaroNode extends TaroEventTarget {
102
132
  public set textContent (value: string) {
103
133
  if (this.nodeType === NodeType.TEXT_NODE) {
104
134
  this._textContent = value
105
- // if (this.parentNode && this.ownerDocument) {
106
- // const text = this.ownerDocument.createTextNode(value)
107
- // this.parentNode.replaceChild(text, this)
108
- // } else {
109
- // this._textContent = value
110
- // }
135
+ if (!this._instance) {
136
+ this.updateComponent()
137
+ }
111
138
  } else if (this.nodeType === NodeType.ELEMENT_NODE) {
112
- const text = this.ownerDocument.createTextNode(value)
113
- this.childNodes = [text]
139
+ const node = new TaroTextNode(value)
140
+ node._doc = this.ownerDocument
141
+ node.parentNode = this
142
+ this.childNodes.length = 0
143
+ this.childNodes.push(node)
114
144
  }
115
145
  }
116
146
 
@@ -125,13 +155,13 @@ export class TaroNode extends TaroEventTarget {
125
155
  }
126
156
  }
127
157
 
128
- public set nodeValue (value: string) {
129
- if (this.nodeType === NodeType.TEXT_NODE) {
158
+ public set nodeValue (value: string | null) {
159
+ if (this.nodeType === NodeType.TEXT_NODE && value) {
130
160
  this.textContent = value
131
161
  }
132
162
  }
133
163
 
134
- public get ownerDocument (): TaroDocument {
164
+ public get ownerDocument (): TaroDocument | null {
135
165
  return this._doc
136
166
  }
137
167
 
@@ -140,29 +170,37 @@ export class TaroNode extends TaroEventTarget {
140
170
  }
141
171
 
142
172
  // TODO cloneNode()、contains()
143
-
144
- public appendChild (child: TaroNode): TaroNode {
173
+ public connectParentNode (child: TaroNode) {
145
174
  child.parentNode?.removeChild(child)
146
175
  child.parentNode = this
147
- // this.childNodes.push(child)
148
- this.childNodes = [...this.childNodes, child]
176
+ }
177
+
178
+ public appendChild (child: TaroNode): TaroNode {
179
+ this.connectParentNode(child)
180
+ this.childNodes.push(child)
181
+ this.notifyDataAdd(this.childNodes.length - 1)
182
+
183
+ // @ts-ignore
184
+ child.toggleLayer?.(true)
149
185
 
150
186
  checkIsCompileModeAndInstallAfterDOMAction(child, this)
151
187
  return child
152
188
  }
153
189
 
154
- public insertBefore (newNode: TaroNode, referenceNode: TaroNode | null): TaroNode {
190
+ public insertBefore (newNode: TaroNode, referenceNode?: TaroNode): TaroNode {
155
191
  newNode.parentNode?.removeChild(newNode)
156
192
 
157
- if (referenceNode === null) {
193
+ if (!referenceNode) {
158
194
  this.appendChild(newNode)
159
195
  } else {
160
196
  const idxOfRef = this.findIndex(referenceNode)
161
- this.childNodes = [
162
- ...this.childNodes.slice(0, idxOfRef),
163
- newNode,
164
- ...this.childNodes.slice(idxOfRef)
165
- ]
197
+ this.childNodes.splice(idxOfRef, 0, newNode)
198
+ this.connectParentNode(newNode)
199
+ // TODO: 优化
200
+ this.notifyDataReload()
201
+
202
+ // @ts-ignore
203
+ newNode.toggleLayer?.(true)
166
204
  }
167
205
 
168
206
  checkIsCompileModeAndInstallAfterDOMAction(newNode, this)
@@ -177,12 +215,11 @@ export class TaroNode extends TaroEventTarget {
177
215
 
178
216
  if (idxOfRef < 0) throw new Error('TaroNode:replaceChild NotFoundError')
179
217
 
180
- this.childNodes = [
181
- ...this.childNodes.slice(0, idxOfRef),
182
- newChild,
183
- ...this.childNodes.slice(idxOfRef + 1)
184
- ]
218
+ this.childNodes[idxOfRef] = newChild
219
+ oldChild.dispose()
220
+ this.notifyDataChange(idxOfRef)
185
221
 
222
+ checkIsCompileModeAndUninstallAfterDOMAction(oldChild)
186
223
  checkIsCompileModeAndInstallAfterDOMAction(newChild, this)
187
224
 
188
225
  return oldChild
@@ -194,22 +231,50 @@ export class TaroNode extends TaroEventTarget {
194
231
  const idx = this.findIndex(child)
195
232
  if (idx < 0) throw new Error('TaroNode:removeChild NotFoundError')
196
233
 
197
- this.childNodes = this.childNodes.filter((_, index) => index !== idx)
234
+ this.childNodes.splice(idx, 1)
235
+ child.dispose()
236
+ this.notifyDataDelete(idx)
198
237
 
199
238
  checkIsCompileModeAndUninstallAfterDOMAction(child)
200
239
 
201
240
  return child
202
241
  }
242
+
243
+ public dispose () {
244
+ // 渲染,层级大于0的节点需要让其回到正常层级,然后删掉
245
+ // @ts-ignore
246
+ this.toggleLayer?.(false)
247
+
248
+ this.parentNode = null
249
+ this.childNodes = []
250
+ }
251
+ }
252
+
253
+ @Observed
254
+ export class TaroTextNode extends TaroNode {
255
+ constructor(value = '', nodeName = '#text', nodeType: NodeType = NodeType.TEXT_NODE) {
256
+ super(nodeName, nodeType)
257
+ this.textContent = value
258
+ }
259
+
260
+ public get data (): string {
261
+ return this.textContent
262
+ }
263
+
264
+ public set data (value: string) {
265
+ this.textContent = value
266
+ }
203
267
  }
204
268
 
205
269
  function checkIsCompileModeAndInstallAfterDOMAction (node: TaroNode, parentNode: TaroNode) {
206
- if (!parentNode._isCompileMode) return
270
+ if (!parentNode._isCompileMode || !parentNode._instance) return
207
271
 
208
- parentNode._instance?.dynamicCenter?.install?.(node, parentNode)
272
+ parentNode._instance.dynamicCenter?.install?.(node, parentNode)
273
+ node.updateComponent()
209
274
  }
210
275
 
211
276
  function checkIsCompileModeAndUninstallAfterDOMAction (node: TaroNode) {
212
- if (!node._isCompileMode) return
277
+ if (!node._isCompileMode || !node?._instance) return
213
278
 
214
- node._instance?.dynamicCenter?.uninstall?.(node)
215
- }
279
+ node._instance.dynamicCenter?.uninstall?.(node)
280
+ }