@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.
Files changed (143) hide show
  1. package/dist/apis/base/system.ts +60 -25
  2. package/dist/apis/base/weapp/life-cycle.ts +1 -1
  3. package/dist/apis/canvas/index.ts +10 -1
  4. package/dist/apis/device/clipboard.ts +23 -8
  5. package/dist/apis/framework/index.ts +2 -6
  6. package/dist/apis/index.ts +25 -17
  7. package/dist/apis/media/image/index.ts +169 -17
  8. package/dist/apis/route/index.ts +1 -2
  9. package/dist/apis/storage/index.ts +135 -131
  10. package/dist/apis/ui/animation/animation.ts +71 -29
  11. package/dist/apis/ui/background.ts +3 -2
  12. package/dist/apis/ui/interaction/index.ts +58 -59
  13. package/dist/apis/ui/navigation-bar/index.ts +2 -2
  14. package/dist/apis/ui/pull-down-refresh.ts +9 -3
  15. package/dist/apis/ui/scroll/index.ts +6 -6
  16. package/dist/apis/ui/tab-bar.ts +4 -5
  17. package/dist/apis/utils/index.ts +20 -2
  18. package/dist/apis/utils/permissions.ts +6 -0
  19. package/dist/apis/wxml/IntersectionObserver.ts +18 -10
  20. package/dist/apis/wxml/selectorQuery.ts +26 -13
  21. package/dist/components-harmony-ets/button.ets +36 -9
  22. package/dist/components-harmony-ets/canvas.ets +51 -0
  23. package/dist/components-harmony-ets/checkbox.ets +69 -60
  24. package/dist/components-harmony-ets/form.ets +33 -15
  25. package/dist/components-harmony-ets/icon.ets +16 -8
  26. package/dist/components-harmony-ets/image.ets +22 -6
  27. package/dist/components-harmony-ets/index.ets +39 -0
  28. package/dist/components-harmony-ets/innerHtml.ets +6 -5
  29. package/dist/components-harmony-ets/input.ets +63 -37
  30. package/dist/components-harmony-ets/label.ets +43 -21
  31. package/dist/components-harmony-ets/listView.ets +32 -0
  32. package/dist/components-harmony-ets/movableArea.ets +110 -51
  33. package/dist/components-harmony-ets/movableView.ets +74 -47
  34. package/dist/components-harmony-ets/navigationBar.ets +65 -0
  35. package/dist/components-harmony-ets/pageMeta.ets +94 -0
  36. package/dist/components-harmony-ets/picker.ets +36 -33
  37. package/dist/components-harmony-ets/progress.ets +31 -24
  38. package/dist/components-harmony-ets/pseudo.ets +80 -0
  39. package/dist/components-harmony-ets/radio.ets +75 -66
  40. package/dist/components-harmony-ets/richText.ets +4 -25
  41. package/dist/components-harmony-ets/scrollList.ets +108 -0
  42. package/dist/components-harmony-ets/scrollView.ets +46 -42
  43. package/dist/components-harmony-ets/slider.ets +19 -15
  44. package/dist/components-harmony-ets/stickySection.ets +42 -0
  45. package/dist/components-harmony-ets/style.ets +386 -129
  46. package/dist/components-harmony-ets/swiper.ets +42 -5
  47. package/dist/components-harmony-ets/switch.ets +36 -32
  48. package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
  49. package/dist/components-harmony-ets/text.ets +102 -46
  50. package/dist/components-harmony-ets/textArea.ets +49 -34
  51. package/dist/components-harmony-ets/utils/AttributeManager.ets +2 -2
  52. package/dist/components-harmony-ets/utils/DynamicCenter.ts +2 -2
  53. package/dist/components-harmony-ets/utils/flexManager.ets +49 -19
  54. package/dist/components-harmony-ets/utils/helper.ets +20 -8
  55. package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
  56. package/dist/components-harmony-ets/utils/htmlParser/index.ts +1 -1
  57. package/dist/components-harmony-ets/utils/index.ts +54 -50
  58. package/dist/components-harmony-ets/utils/styles.ets +169 -91
  59. package/dist/components-harmony-ets/video.ets +28 -20
  60. package/dist/components-harmony-ets/view.ets +45 -39
  61. package/dist/components-harmony-ets/webView.ets +6 -5
  62. package/dist/index.d.ts +152 -0
  63. package/dist/index.js +73 -44
  64. package/dist/index.js.map +1 -1
  65. package/dist/runtime-ets/bom/URL.ts +2 -0
  66. package/dist/runtime-ets/bom/document.ts +5 -4
  67. package/dist/runtime-ets/bom/getComputedStyle.ts +2 -3
  68. package/dist/runtime-ets/bom/history.ts +1 -0
  69. package/dist/runtime-ets/bom/location.ts +1 -0
  70. package/dist/runtime-ets/bom/navigator.ts +1 -21
  71. package/dist/runtime-ets/bom/raf.ts +1 -37
  72. package/dist/runtime-ets/bom/window.ts +10 -4
  73. package/dist/runtime-ets/constant.ts +17 -10
  74. package/dist/runtime-ets/current.ts +5 -2
  75. package/dist/runtime-ets/dom/bind.ts +28 -12
  76. package/dist/runtime-ets/dom/class-list.ts +2 -2
  77. package/dist/runtime-ets/dom/cssNesting.ts +419 -0
  78. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +28 -42
  79. package/dist/runtime-ets/dom/document.ts +9 -12
  80. package/dist/runtime-ets/dom/element/canvas.ts +137 -0
  81. package/dist/runtime-ets/dom/element/element.ts +379 -55
  82. package/dist/runtime-ets/dom/element/form.ts +26 -22
  83. package/dist/runtime-ets/dom/element/index.ts +22 -2
  84. package/dist/runtime-ets/dom/element/movableArea.ts +0 -1
  85. package/dist/runtime-ets/dom/element/movableView.ts +238 -2
  86. package/dist/runtime-ets/dom/element/normal.ts +27 -6
  87. package/dist/runtime-ets/dom/element/progress.ts +0 -2
  88. package/dist/runtime-ets/dom/element/text.ts +0 -8
  89. package/dist/runtime-ets/dom/element/video.ts +4 -4
  90. package/dist/runtime-ets/dom/element/webView.ts +4 -5
  91. package/dist/runtime-ets/dom/event-source.ts +1 -0
  92. package/dist/runtime-ets/dom/event.ts +3 -5
  93. package/dist/runtime-ets/dom/eventTarget.ts +3 -4
  94. package/dist/runtime-ets/dom/node.ts +53 -22
  95. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +418 -237
  96. package/dist/runtime-ets/dom/stylesheet/index.ts +29 -311
  97. package/dist/runtime-ets/dom/stylesheet/type.ts +53 -11
  98. package/dist/runtime-ets/dom/stylesheet/util.ts +33 -27
  99. package/dist/runtime-ets/emitter/emitter.ts +1 -0
  100. package/dist/runtime-ets/env.ts +1 -0
  101. package/dist/runtime-ets/index.ts +23 -7
  102. package/dist/runtime-ets/interface/event.ts +1 -1
  103. package/dist/runtime-ets/interface/index.ts +6 -0
  104. package/dist/runtime-ets/utils/index.ts +78 -19
  105. package/dist/runtime-ets/utils/info.ts +2 -2
  106. package/dist/runtime-ets/utils/router.ts +9 -0
  107. package/dist/runtime-framework/react/app.ts +15 -11
  108. package/dist/runtime-framework/react/hooks.ts +1 -2
  109. package/dist/runtime-framework/react/index.ts +0 -2
  110. package/dist/runtime-framework/react/native-page.ts +217 -81
  111. package/dist/runtime-framework/react/page.ts +4 -10
  112. package/dist/runtime-framework/react/utils/index.ts +3 -3
  113. package/dist/runtime-framework/solid/app.ts +29 -46
  114. package/dist/runtime-framework/solid/connect.ts +21 -3
  115. package/dist/runtime-framework/solid/hooks.ts +16 -11
  116. package/dist/runtime-framework/solid/index.ts +6 -2
  117. package/dist/runtime-framework/solid/page.ts +84 -31
  118. package/dist/runtime-framework/solid/reconciler/props.ts +73 -29
  119. package/dist/runtime-framework/solid/reconciler/render.ts +16 -6
  120. package/dist/runtime-framework/solid/reconciler/use.ts +0 -1
  121. package/dist/runtime-framework/solid/utils/index.ts +3 -5
  122. package/dist/runtime-utils.d.ts +827 -0
  123. package/dist/runtime-utils.js +574 -285
  124. package/dist/runtime-utils.js.map +1 -1
  125. package/dist/runtime.d.ts +1 -0
  126. package/dist/runtime.js +574 -285
  127. package/dist/runtime.js.map +1 -1
  128. package/index.js +3 -1
  129. package/package.json +14 -15
  130. package/static/media/cancel.svg +1 -1
  131. package/static/media/circle.svg +1 -1
  132. package/static/media/clear.svg +1 -1
  133. package/static/media/download.svg +1 -1
  134. package/static/media/info.svg +1 -1
  135. package/static/media/info_circle.svg +1 -1
  136. package/static/media/search.svg +1 -1
  137. package/static/media/success.svg +1 -1
  138. package/static/media/success_no_circle.svg +1 -1
  139. package/static/media/warn.svg +1 -1
  140. package/types/harmony.d.ts +5 -0
  141. package/types/index.d.ts +4 -0
  142. package/types/runtime.d.ts +1 -1
  143. /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
@@ -1,5 +1,6 @@
1
1
  import { Current } from '../../current'
2
2
  import { TaroTextNode } from '../node'
3
+ import { TaroCanvasElement } from './canvas'
3
4
  import { TaroElement } from './element'
4
5
  import {
5
6
  FormElement,
@@ -15,12 +16,15 @@ import {
15
16
  TaroTextAreaElement
16
17
  } from './form'
17
18
  import { TaroMovableAreaElement } from './movableArea'
18
- import { TaroMovableViewElement } from './movableView'
19
+ import { isTaroMovableViewElement, TaroMovableViewElement } from './movableView'
19
20
  import {
20
21
  TaroButtonElement,
21
22
  TaroIconElement,
22
23
  TaroImageElement,
23
24
  TaroLabelElement,
25
+ TaroNavigationBarElement,
26
+ TaroOtherElement,
27
+ TaroPageMetaElement,
24
28
  TaroRichTextElement,
25
29
  TaroSwiperElement,
26
30
  TaroSwiperItemElement,
@@ -39,7 +43,11 @@ export function initHarmonyElement () {
39
43
  case 'image': return new TaroImageElement()
40
44
  case 'text': return new TaroTextElement()
41
45
  case 'button': return new TaroButtonElement()
46
+ case 'movable-area': return new TaroMovableAreaElement()
47
+ case 'movable-view': return new TaroMovableViewElement()
48
+ case 'progress': return new TaroProgressElement()
42
49
  case 'scroll-view': return new TaroScrollViewElement()
50
+ case 'scroll-list': return new TaroScrollViewElement()
43
51
  case 'checkbox-group': return new TaroCheckboxGroupElement()
44
52
  case 'input': return new TaroInputElement()
45
53
  case 'picker': return new TaroPickerElement()
@@ -52,13 +60,16 @@ export function initHarmonyElement () {
52
60
  case 'icon': return new TaroIconElement()
53
61
  case 'label': return new TaroLabelElement()
54
62
  case 'rich-text': return new TaroRichTextElement()
63
+ case 'canvas': return new TaroCanvasElement()
55
64
  case 'swiper': return new TaroSwiperElement()
56
65
  case 'swiper-item': return new TaroSwiperItemElement()
57
66
  case 'textarea': return new TaroTextAreaElement()
58
67
  case 'form': return new TaroFormElement()
59
68
  case 'web-view': return new TaroWebViewElement()
60
69
  case 'inner-html': return new TaroInnerHtmlElement()
61
- default: return new TaroElement(tagName)
70
+ case 'page-meta': return new TaroPageMetaElement()
71
+ case 'navigation-bar': return new TaroNavigationBarElement()
72
+ default: return new TaroOtherElement(tagName)
62
73
  }
63
74
  }
64
75
 
@@ -71,6 +82,7 @@ export function initHarmonyElement () {
71
82
  export {
72
83
  FormElement,
73
84
  TaroButtonElement,
85
+ TaroCanvasElement,
74
86
  TaroCheckboxElement,
75
87
  TaroCheckboxGroupElement,
76
88
  TaroElement,
@@ -82,6 +94,9 @@ export {
82
94
  TaroLabelElement,
83
95
  TaroMovableAreaElement,
84
96
  TaroMovableViewElement,
97
+ TaroNavigationBarElement,
98
+ TaroOtherElement,
99
+ TaroPageMetaElement,
85
100
  TaroPickerElement,
86
101
  TaroProgressElement,
87
102
  TaroRadioElement,
@@ -98,3 +113,8 @@ export {
98
113
  TaroViewElement,
99
114
  TaroWebViewElement
100
115
  }
116
+
117
+
118
+ export {
119
+ isTaroMovableViewElement
120
+ }
@@ -5,7 +5,6 @@ import type { MovableAreaProps } from '@tarojs/components/types'
5
5
 
6
6
  @Observed
7
7
  export class TaroMovableAreaElement extends TaroElement<MovableAreaProps> {
8
-
9
8
  constructor() {
10
9
  super('MovableArea')
11
10
  }
@@ -1,12 +1,248 @@
1
-
2
1
  import { TaroElement } from './element'
3
2
 
4
3
  import type { MovableViewProps } from '@tarojs/components/types'
4
+ import type { TaroAny } from '../../utils'
5
5
 
6
+ type Tsize = {
7
+ w: number
8
+ h: number
9
+ }
10
+ type Tpoint = {
11
+ x: number
12
+ y: number
13
+ }
14
+
15
+ function calcPosition(postion: number, start: number, end: number) {
16
+ if (postion <= end && postion >= start) {
17
+ return postion
18
+ } else if (postion < start) {
19
+ return start
20
+ } else {
21
+ return end
22
+ }
23
+ }
24
+
25
+ export function isTaroMovableViewElement (item: TaroAny): item is TaroMovableViewElement {
26
+ return item instanceof TaroMovableViewElement
27
+ }
6
28
  @Observed
7
- export class TaroMovableViewElement extends TaroElement<MovableViewProps & {'animation': undefined}> {
29
+ export class TaroMovableViewElement extends TaroElement<MovableViewProps & { animation: undefined }> {
30
+ _scaleValue = 1
31
+ _scalevalueTemp = 1
32
+
33
+ // 父级区别的大小
34
+ _area?: Tsize
35
+ // 自己元素的大小
36
+ _selfSize?: Tsize
37
+ _areaInited: false
38
+ _selfSizeInited: false
39
+
40
+ // 元素的位置
41
+ _position: Tpoint = {
42
+ x: 0,
43
+ y: 0,
44
+ }
45
+
46
+ _positionTemp: Tpoint = {
47
+ x: 0,
48
+ y: 0,
49
+ }
8
50
 
9
51
  constructor() {
10
52
  super('MovableView')
11
53
  }
54
+
55
+ get _outOfBounds() {
56
+ if (this.getAttribute('outOfBounds')) {
57
+ return this.selfSize ? this.selfSize.w / 3 : 0
58
+ }
59
+ return 0
60
+ }
61
+
62
+ startScale() {
63
+ this._scalevalueTemp = this._scaleValue
64
+ }
65
+
66
+ doScale(val: number) {
67
+ const scale = this.getAttribute('scale')
68
+
69
+ // 禁止缩放的时候不生效
70
+ if (scale) {
71
+ this.scaleValue = val * this._scalevalueTemp
72
+ }
73
+ }
74
+
75
+ set scaleValue(val: number) {
76
+ if (this.checkScaleValueInBounds(val)) {
77
+ this._scaleValue = val
78
+
79
+ this.checkPositionBoundary(this.position, val)
80
+
81
+ const scaleFns = this?.__listeners?.scale || []
82
+ scaleFns.forEach((fn) => {
83
+ fn({ ...this.position, scale: this.scaleValue })
84
+ })
85
+ }
86
+ }
87
+
88
+ get visibility () {
89
+ return this._areaInited && this._selfSizeInited ? Visibility.Visible : Visibility.Hidden
90
+ }
91
+
92
+ get scaleValue() {
93
+ return this._scaleValue
94
+ }
95
+
96
+ startMove() {
97
+ this._positionTemp = this._position
98
+ }
99
+
100
+ doMove(val: Tpoint) {
101
+ if (!this.area || !this.selfSize) {
102
+ return
103
+ }
104
+ if (this.getAttribute('disabled')) {
105
+ return
106
+ }
107
+ const direction = this.getAttribute('direction')
108
+
109
+ // 容器的宽高终点
110
+ const areaWidthEnd = this.area.w - this.selfSize.w * this.scaleValue
111
+ const areaHeightEnd = this.area.h - this.selfSize.h * this.scaleValue
112
+
113
+ const incrementWidth = (this.scaleValue - 1) * this.selfSize.w
114
+ const incrementHeight = (this.scaleValue - 1) * this.selfSize.h
115
+
116
+ let x = this._positionTemp.x
117
+ let y = this._positionTemp.y
118
+ if (['all', 'horizontal'].includes(direction)) {
119
+ const nextX = this._positionTemp.x + val.x * this.scaleValue
120
+ x = calcPosition(
121
+ nextX,
122
+ incrementWidth * 0.5 - this._outOfBounds,
123
+ areaWidthEnd + incrementWidth * 0.5 + this._outOfBounds
124
+ )
125
+ }
126
+
127
+ if (['all', 'vertical'].includes(direction)) {
128
+ const nextY = this._positionTemp.y + val.y * this.scaleValue
129
+ y = calcPosition(
130
+ nextY,
131
+ incrementHeight * 0.5 - this._outOfBounds,
132
+ areaHeightEnd + incrementHeight * 0.5 + this._outOfBounds
133
+ )
134
+ }
135
+
136
+ const changeFns = this?.__listeners?.change || []
137
+ changeFns.forEach((fn) => {
138
+ fn({ x, y, source: 'touch' })
139
+ })
140
+
141
+ this.position = {
142
+ x: x,
143
+ y: y,
144
+ }
145
+ }
146
+
147
+ get position() {
148
+ return this._position
149
+ }
150
+
151
+ set position(val: Tpoint) {
152
+ this._position = val
153
+ }
154
+
155
+ set area(val: Tsize) {
156
+ if (val.w === this._area?.w && val.h === this._area?.h) return
157
+ this._area = val
158
+ if (!this._areaInited) {
159
+ this._areaInited = true
160
+ this.initPositionFromAttribute()
161
+ }
162
+ }
163
+
164
+ get area(): Tsize | undefined {
165
+ return this._area
166
+ }
167
+
168
+ set selfSize(val: Tsize) {
169
+ if (val.w === this._selfSize?.w && val.h === this._selfSize?.h) return
170
+ this._selfSize = val
171
+ if (!this._selfSizeInited) {
172
+ this._selfSizeInited = true
173
+ this.initPositionFromAttribute()
174
+ }
175
+ }
176
+
177
+ get selfSize(): Tsize | undefined {
178
+ return this._selfSize
179
+ }
180
+
181
+ initPositionFromAttribute () {
182
+ if (!this.area || !this.selfSize) {
183
+ return
184
+ }
185
+ const x = this.getAttribute('x') ? Number(this.getAttribute('x')) : 0
186
+ const y = this.getAttribute('y') ? Number(this.getAttribute('y')) : 0
187
+ this.checkPositionBoundary({ x, y }, this.scaleValue)
188
+ }
189
+
190
+ checkPositionBoundary(position: Tpoint, scale: number) {
191
+ if (!this.area || !this.selfSize) {
192
+ return { x: 0, y: 0 }
193
+ }
194
+
195
+ const areaWidthEnd = this.area.w - this.selfSize.w * scale
196
+ const areaHeightEnd = this.area.h - this.selfSize.h * scale
197
+
198
+ const incrementWidth = (scale - 1) * this.selfSize.w
199
+ const incrementHeight = (scale - 1) * this.selfSize.h
200
+
201
+ this.position = {
202
+ x: calcPosition(position.x, incrementWidth * 0.5, areaWidthEnd + incrementWidth * 0.5),
203
+ y: calcPosition(position.y, incrementHeight * 0.5, areaHeightEnd + incrementHeight * 0.5),
204
+ }
205
+ }
206
+
207
+ checkScaleValueInBounds(currentScale: number) {
208
+ const scaleMin = this.getAttribute('scaleMin')
209
+ const scaleMax = this.getAttribute('scaleMax')
210
+
211
+ if (scaleMin && Number(scaleMin) >= 0.1 && currentScale < Number(scaleMin)) {
212
+ return false
213
+ } else if (scaleMax && Number(scaleMax) >= 0.1 && currentScale > Number(scaleMax)) {
214
+ return false
215
+ }
216
+
217
+ return true
218
+ }
219
+
220
+ public setAttribute(name: string, value: any): void {
221
+ if (name === 'x') {
222
+ this.checkPositionBoundary({ x: value, y: this.position.y }, this.scaleValue)
223
+ }
224
+ if (name === 'y') {
225
+ this.checkPositionBoundary({ x: this.position.x, y: value }, this.scaleValue)
226
+ }
227
+
228
+ super.setAttribute(name, value)
229
+ }
230
+
231
+ public callTouchEventFnFromGesture(eventName: string, gestureEvent: GestureEvent) {
232
+ const touchFns = (this?.__listeners?.[eventName] || []) as Function[]
233
+ touchFns.forEach(fn => {
234
+ try {
235
+ fn({
236
+ _hmEvent: gestureEvent,
237
+ target: this,
238
+ changedTouches: gestureEvent.fingerList.map(finger => ({
239
+ clientX: finger.globalX,
240
+ clientY: finger.globalY
241
+ }))
242
+ })
243
+ } catch (error) {
244
+ console.error(error)
245
+ }
246
+ })
247
+ }
12
248
  }
@@ -6,12 +6,17 @@ import type {
6
6
  IconProps,
7
7
  ImageProps,
8
8
  LabelProps,
9
+ NavigationBarProps,
10
+ PageMetaProps,
9
11
  RichTextProps,
10
12
  SwiperItemProps,
11
13
  SwiperProps,
12
14
  ViewProps
13
15
  } from '@tarojs/components/types'
14
16
 
17
+ @Observed
18
+ class TaroOtherElement extends TaroElement<ViewProps> {}
19
+
15
20
  @Observed
16
21
  class TaroViewElement extends TaroElement<ViewProps> {
17
22
  constructor() {
@@ -34,27 +39,27 @@ class TaroButtonElement extends TaroElement<ButtonProps> {
34
39
  }
35
40
 
36
41
  @Observed
37
- class TaroIconElement extends TaroElement<IconProps>{
42
+ class TaroIconElement extends TaroElement<IconProps> {
38
43
  constructor() {
39
44
  super('Icon')
40
45
  }
41
46
  }
42
47
  @Observed
43
- class TaroLabelElement extends TaroElement<LabelProps>{
48
+ class TaroLabelElement extends TaroElement<LabelProps> {
44
49
  constructor() {
45
50
  super('Label')
46
51
  }
47
52
  }
48
53
 
49
54
  @Observed
50
- class TaroRichTextElement extends TaroElement<RichTextProps>{
55
+ class TaroRichTextElement extends TaroElement<RichTextProps> {
51
56
  constructor() {
52
57
  super('RichText')
53
58
  }
54
59
  }
55
60
 
56
61
  @Observed
57
- class TaroSwiperElement extends TaroElement<SwiperProps>{
62
+ class TaroSwiperElement extends TaroElement<SwiperProps> {
58
63
  controller: SwiperController = new SwiperController()
59
64
 
60
65
  constructor() {
@@ -63,20 +68,36 @@ class TaroSwiperElement extends TaroElement<SwiperProps>{
63
68
  }
64
69
 
65
70
  @Observed
66
- class TaroSwiperItemElement extends TaroElement<SwiperItemProps>{
71
+ class TaroSwiperItemElement extends TaroElement<SwiperItemProps> {
67
72
  constructor() {
68
73
  super('SwiperItem')
69
74
  }
70
75
  }
71
76
 
77
+ @Observed
78
+ class TaroPageMetaElement extends TaroElement<PageMetaProps> {
79
+ constructor() {
80
+ super('PageMeta')
81
+ }
82
+ }
83
+
84
+ @Observed
85
+ class TaroNavigationBarElement extends TaroElement<NavigationBarProps> {
86
+ constructor() {
87
+ super('NavigationBar')
88
+ }
89
+ }
72
90
 
73
91
  export {
74
92
  TaroButtonElement,
75
93
  TaroIconElement,
76
94
  TaroImageElement,
77
95
  TaroLabelElement,
96
+ TaroNavigationBarElement,
97
+ TaroOtherElement,
98
+ TaroPageMetaElement,
78
99
  TaroRichTextElement,
79
100
  TaroSwiperElement,
80
101
  TaroSwiperItemElement,
81
- TaroViewElement,
102
+ TaroViewElement
82
103
  }
@@ -5,9 +5,7 @@ import type { ProgressProps } from '@tarojs/components/types'
5
5
 
6
6
  @Observed
7
7
  export class TaroProgressElement extends TaroElement<ProgressProps> {
8
-
9
8
  constructor() {
10
9
  super('Progress')
11
-
12
10
  }
13
11
  }
@@ -1,4 +1,3 @@
1
- import { TaroNode } from '../node'
2
1
  import { TaroElement } from './element'
3
2
 
4
3
  import type { TextProps } from '@tarojs/components/types'
@@ -8,11 +7,4 @@ export class TaroTextElement extends TaroElement<TextProps> {
8
7
  constructor() {
9
8
  super('Text')
10
9
  }
11
-
12
- public appendChild (child: TaroNode): TaroNode {
13
- super.appendChild(child)
14
-
15
- this.updateComponent()
16
- return child
17
- }
18
10
  }
@@ -4,12 +4,12 @@ import type { VideoProps } from '@tarojs/components/types'
4
4
 
5
5
  @Observed
6
6
  export class TaroVideoElement extends TaroElement<VideoProps> {
7
- _currentTime = 0
8
-
9
7
  controller: VideoController = new VideoController()
10
8
 
11
9
  constructor() {
12
10
  super('Video')
11
+
12
+ this._nodeInfo._currentTime = 0
13
13
  }
14
14
 
15
15
  async play() {
@@ -40,11 +40,11 @@ export class TaroVideoElement extends TaroElement<VideoProps> {
40
40
  }
41
41
 
42
42
  get currentTime() {
43
- return this._currentTime
43
+ return this._nodeInfo._currentTime
44
44
  }
45
45
 
46
46
  set currentTime(val: number) {
47
- this._currentTime = val
47
+ this._nodeInfo._currentTime = val
48
48
  this.controller.setCurrentTime(val)
49
49
  }
50
50
  }
@@ -13,13 +13,13 @@ export class TaroInnerHtmlElement extends TaroElement {
13
13
  }
14
14
 
15
15
  @Observed
16
- export class TaroWebViewElement extends TaroElement<WebViewProps>{
16
+ export class TaroWebViewElement extends TaroElement<WebViewProps> {
17
17
  ports: web_webview.WebMessagePort[] = []
18
18
 
19
19
  nativePort: web_webview.WebMessagePort | null = null
20
20
 
21
21
  message: web_webview.WebMessageExt = new web_webview.WebMessageExt()
22
-
22
+
23
23
  controller: web_webview.WebviewController = new web_webview.WebviewController()
24
24
 
25
25
  constructor() {
@@ -59,10 +59,9 @@ export class TaroWebViewElement extends TaroElement<WebViewProps>{
59
59
  return null
60
60
  }
61
61
  }
62
- }
63
- catch (error) {
62
+ } catch (error) {
64
63
  const e: business_error.BusinessError = error as business_error.BusinessError
65
-
64
+
66
65
  console.error(`ErrorCode: ${e.code}, Message: ${e.message}`)
67
66
  }
68
67
  }
@@ -0,0 +1 @@
1
+ export { eventSource } from '@tarojs/runtime/dist/runtime.esm'
@@ -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
 
@@ -123,7 +121,7 @@ function collectBatchFunction (type: string, dispatch: () => void) {
123
121
  }
124
122
  }
125
123
 
126
- export function eventHandler (event, type: string, node: TaroElement) {
124
+ export function eventHandler (event, type: string, node: TaroElement): void {
127
125
  if (!node) return
128
126
 
129
127
  const isBatchUpdates = hooks.isExist('batchedEventUpdates')
@@ -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)
@@ -1,6 +1,6 @@
1
- import { Events } from '@tarojs/runtime/dist/runtime.esm'
2
1
  import { isArray } from '@tarojs/shared'
3
2
 
3
+ import { Events } from '../emitter/emitter'
4
4
  import { TaroEvent } from './event'
5
5
 
6
6
  import type { EventHandler } from '../interface'
@@ -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 }