@tarojs/plugin-platform-harmony-ets 4.0.0-beta.0 → 4.0.0-beta.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 (78) hide show
  1. package/dist/apis/device/memory.ts +10 -3
  2. package/dist/apis/index.ts +2 -0
  3. package/dist/apis/media/video/VideoContext.ts +56 -7
  4. package/dist/apis/media/video/index.ts +3 -2
  5. package/dist/apis/network/request.ts +5 -5
  6. package/dist/apis/route/index.ts +15 -0
  7. package/dist/apis/storage/index.ts +124 -60
  8. package/dist/apis/wxml/index.ts +2 -0
  9. package/dist/components-harmony-ets/button.ets +26 -40
  10. package/dist/components-harmony-ets/checkbox.ets +70 -99
  11. package/dist/components-harmony-ets/form.ets +29 -42
  12. package/dist/components-harmony-ets/icon.ets +6 -34
  13. package/dist/components-harmony-ets/image.ets +2 -32
  14. package/dist/components-harmony-ets/innerHtml.ets +2 -2
  15. package/dist/components-harmony-ets/input.ets +7 -27
  16. package/dist/components-harmony-ets/label.ets +40 -47
  17. package/dist/components-harmony-ets/picker.ets +66 -73
  18. package/dist/components-harmony-ets/radio.ets +72 -101
  19. package/dist/components-harmony-ets/richText.ets +4 -36
  20. package/dist/components-harmony-ets/scrollView.ets +34 -74
  21. package/dist/components-harmony-ets/slider.ets +9 -34
  22. package/dist/components-harmony-ets/style.ets +154 -0
  23. package/dist/components-harmony-ets/swiper.ets +4 -34
  24. package/dist/components-harmony-ets/switch.ets +43 -56
  25. package/dist/components-harmony-ets/text.ets +7 -34
  26. package/dist/components-harmony-ets/textArea.ets +8 -28
  27. package/dist/components-harmony-ets/utils/DynamicCenter.ts +2 -11
  28. package/dist/components-harmony-ets/utils/flexManager.ets +45 -7
  29. package/dist/components-harmony-ets/utils/helper.ets +2 -2
  30. package/dist/components-harmony-ets/utils/styles.ets +58 -20
  31. package/dist/components-harmony-ets/video.ets +4 -34
  32. package/dist/components-harmony-ets/view.ets +25 -67
  33. package/dist/components-harmony-ets/webView.ets +50 -0
  34. package/dist/index.js +103 -5
  35. package/dist/index.js.map +1 -1
  36. package/dist/runtime-ets/bom/window.ts +2 -2
  37. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +30 -6
  38. package/dist/runtime-ets/dom/document.ts +21 -4
  39. package/dist/runtime-ets/dom/element/element.ts +1 -0
  40. package/dist/runtime-ets/dom/element/form.ts +11 -2
  41. package/dist/runtime-ets/dom/element/index.ts +4 -1
  42. package/dist/runtime-ets/dom/element/normal.ts +1 -0
  43. package/dist/runtime-ets/dom/element/webView.ts +61 -0
  44. package/dist/runtime-ets/dom/node.ts +29 -16
  45. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +624 -0
  46. package/dist/runtime-ets/dom/stylesheet/index.ts +216 -354
  47. package/dist/runtime-ets/dom/stylesheet/type.ts +46 -11
  48. package/dist/runtime-ets/dom/stylesheet/util.ts +58 -6
  49. package/dist/runtime-ets/index.ts +1 -2
  50. package/dist/runtime-ets/interface/event.ts +2 -1
  51. package/dist/runtime-ets/utils/index.ts +6 -1
  52. package/dist/runtime-ets/utils/info.ts +3 -1
  53. package/dist/runtime-framework/react/app.ts +12 -22
  54. package/dist/runtime-framework/react/hooks.ts +3 -3
  55. package/dist/runtime-framework/react/index.ts +1 -0
  56. package/dist/runtime-framework/react/native-page.ts +344 -0
  57. package/dist/runtime-framework/react/page.ts +2 -2
  58. package/dist/runtime-framework/solid/hooks.ts +3 -3
  59. package/dist/runtime-utils.js +181 -80
  60. package/dist/runtime-utils.js.map +1 -1
  61. package/dist/runtime.js +181 -80
  62. package/dist/runtime.js.map +1 -1
  63. package/package.json +12 -11
  64. package/static/media/cancel.svg +1 -0
  65. package/static/media/circle.svg +1 -0
  66. package/static/media/clear.svg +1 -0
  67. package/static/media/download.svg +1 -0
  68. package/static/media/info.svg +1 -0
  69. package/static/media/info_circle.svg +1 -0
  70. package/static/media/search.svg +1 -0
  71. package/static/media/success.svg +1 -0
  72. package/static/media/success_no_circle.svg +1 -0
  73. package/static/media/taro_arrow_left.svg +1 -0
  74. package/static/media/taro_home.svg +1 -0
  75. package/static/media/waiting.svg +1 -0
  76. package/static/media/warn.svg +1 -0
  77. package/types/runtime.d.ts +2 -0
  78. package/dist/runtime-ets/utils/bind.ts +0 -24
@@ -63,6 +63,7 @@ class TaroSwiperItemElement extends TaroElement<SwiperItemProps>{
63
63
  }
64
64
  }
65
65
 
66
+
66
67
  export {
67
68
  TaroButtonElement,
68
69
  TaroIconElement,
@@ -0,0 +1,61 @@
1
+ import business_error from '@ohos.base'
2
+ import web_webview from '@ohos.web.webview'
3
+
4
+ import { TaroElement } from './element'
5
+
6
+ import type { WebViewProps } from '@tarojs/components/types'
7
+
8
+ export class TaroWebViewElement extends TaroElement<WebViewProps>{
9
+ ports: web_webview.WebMessagePort[] = []
10
+
11
+ nativePort: web_webview.WebMessagePort | null = null
12
+
13
+ message: web_webview.WebMessageExt = new web_webview.WebMessageExt()
14
+
15
+ controller: web_webview.WebviewController = new web_webview.WebviewController()
16
+
17
+ constructor() {
18
+ super('WebView')
19
+ }
20
+
21
+ postMessage (value: string) {
22
+ if (!this.nativePort) return
23
+
24
+ this.message.setString(value)
25
+ this.nativePort.postMessageEventExt(this.message)
26
+ }
27
+
28
+ handleMessageFromWeb (result: web_webview.WebMessageExt) {
29
+ try {
30
+ const type = result.getType()
31
+ switch (type) {
32
+ case web_webview.WebMessageType.STRING: {
33
+ return result.getString()
34
+ }
35
+ case web_webview.WebMessageType.NUMBER: {
36
+ return result.getNumber()
37
+ }
38
+ case web_webview.WebMessageType.BOOLEAN: {
39
+ return result.getBoolean()
40
+ }
41
+ case web_webview.WebMessageType.ARRAY_BUFFER: {
42
+ return result.getArrayBuffer()
43
+ }
44
+ case web_webview.WebMessageType.ARRAY: {
45
+ return result.getArray()
46
+ }
47
+ case web_webview.WebMessageType.ERROR: {
48
+ return result.getError()
49
+ }
50
+ default: {
51
+ return null
52
+ }
53
+ }
54
+ }
55
+ catch (error) {
56
+ const e: business_error.BusinessError = error as business_error.BusinessError
57
+
58
+ console.error(`ErrorCode: ${e.code}, Message: ${e.message}`)
59
+ }
60
+ }
61
+ }
@@ -31,16 +31,18 @@ export class TaroNode extends TaroDataSourceElement {
31
31
  public childNodes: TaroNode[] = []
32
32
  public parentNode: TaroNode | null = null
33
33
  public _nid: string = genId()
34
-
35
34
  public _doc: TaroDocument | null = null
35
+
36
+ private _textContent = ''
37
+
38
+ // 以下属性为半编译模式下才会赋值和使用的属性
39
+ // 半编译节点更新触发器
40
+ public _updateTrigger = 0
36
41
  // 是否为半编译模板下的节点
37
42
  public _isCompileMode = false
38
43
  // 是否为半编译模板下拥有自主更新权的节点
39
44
  public _isDynamicNode = false
40
45
 
41
- public _updateTrigger = 0
42
- private _textContent = ''
43
-
44
46
  constructor(nodeName: string, nodeType = NodeType.ELEMENT_NODE) {
45
47
  super()
46
48
 
@@ -63,15 +65,25 @@ export class TaroNode extends TaroDataSourceElement {
63
65
 
64
66
  // 更新对应的 ArkUI 组件
65
67
  public updateComponent () {
66
- if (!this.parentNode || !this.parentNode.listeners?.length) return
68
+ if (!this._isCompileMode && (!this.parentNode || !this.parentNode.listeners?.length)) return
67
69
 
68
70
  const idx = this.parentNode.findIndex(this)
69
-
70
- if (idx >= 0) {
71
- this._updateTrigger++
72
- this.parentNode.notifyDataChange(idx)
71
+
72
+ if (this._isCompileMode) {
73
+ // 半编译模式下走 @State 的更新模式
74
+ if (this._isDynamicNode) {
75
+ this._updateTrigger++
76
+ } else {
77
+ this.parentNode.updateComponent()
78
+ }
73
79
  } else {
74
- this.parentNode.notifyDataReload()
80
+ // 非半编译模式下走 LazyForEach 的更新模式
81
+ if (idx >= 0) {
82
+ this._updateTrigger++
83
+ this.parentNode.notifyDataChange(idx)
84
+ } else {
85
+ this.parentNode.notifyDataReload()
86
+ }
75
87
  }
76
88
  }
77
89
 
@@ -232,14 +244,15 @@ export class TaroTextNode extends TaroNode {
232
244
  }
233
245
  }
234
246
 
235
- function checkIsCompileModeAndInstallAfterDOMAction (_node: TaroNode, _parentNode: TaroNode) {
236
- // if (!parentNode._isCompileMode) return
247
+ function checkIsCompileModeAndInstallAfterDOMAction (node: TaroNode, parentNode: TaroNode) {
248
+ if (!parentNode._isCompileMode || !parentNode._instance) return
237
249
 
238
- // parentNode._instance?.dynamicCenter?.install?.(node, parentNode)
250
+ parentNode._instance.dynamicCenter?.install?.(node, parentNode)
251
+ node.updateComponent()
239
252
  }
240
253
 
241
- function checkIsCompileModeAndUninstallAfterDOMAction (_node: TaroNode) {
242
- // if (!node._isCompileMode) return
254
+ function checkIsCompileModeAndUninstallAfterDOMAction (node: TaroNode) {
255
+ if (!node._isCompileMode || !parentNode._instance) return
243
256
 
244
- // node._instance?.dynamicCenter?.uninstall?.(node)
257
+ node._instance.dynamicCenter?.uninstall?.(node)
245
258
  }