@tarojs/helper 3.7.0-alpha.25 → 3.7.0-alpha.27

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 (80) hide show
  1. package/dist/constants.d.ts +3 -3
  2. package/dist/constants.js +3 -3
  3. package/dist/constants.js.map +1 -1
  4. package/dist/esbuild/index.js +1 -0
  5. package/dist/esbuild/index.js.map +1 -1
  6. package/dist/swcRegister.d.ts +0 -6
  7. package/dist/swcRegister.js +0 -15
  8. package/dist/swcRegister.js.map +1 -1
  9. package/dist/utils.d.ts +8 -2
  10. package/dist/utils.js +12 -3
  11. package/dist/utils.js.map +1 -1
  12. package/package.json +5 -5
  13. package/swc/plugin-compile-mode/.cargo/config +5 -0
  14. package/swc/plugin-compile-mode/.editorconfig +6 -0
  15. package/swc/plugin-compile-mode/.vscode/settings.json +3 -0
  16. package/swc/plugin-compile-mode/Cargo.lock +2021 -0
  17. package/swc/plugin-compile-mode/Cargo.toml +19 -0
  18. package/swc/plugin-compile-mode/package.json +15 -0
  19. package/swc/plugin-compile-mode/src/lib.rs +71 -0
  20. package/swc/plugin-compile-mode/src/tests/attributes.rs +54 -0
  21. package/swc/plugin-compile-mode/src/tests/children.rs +86 -0
  22. package/swc/plugin-compile-mode/src/tests/condition.rs +50 -0
  23. package/swc/plugin-compile-mode/src/tests/entry.rs +20 -0
  24. package/swc/plugin-compile-mode/src/tests/harmony/attributes.rs +45 -0
  25. package/swc/plugin-compile-mode/src/tests/harmony/children.rs +74 -0
  26. package/swc/plugin-compile-mode/src/tests/harmony/condition.rs +79 -0
  27. package/swc/plugin-compile-mode/src/tests/harmony/entry.rs +67 -0
  28. package/swc/plugin-compile-mode/src/tests/harmony/looping.rs +62 -0
  29. package/swc/plugin-compile-mode/src/tests/harmony/mod.rs +45 -0
  30. package/swc/plugin-compile-mode/src/tests/looping.rs +84 -0
  31. package/swc/plugin-compile-mode/src/tests/mod.rs +100 -0
  32. package/swc/plugin-compile-mode/src/tests/shake.rs +27 -0
  33. package/swc/plugin-compile-mode/src/transform.rs +480 -0
  34. package/swc/plugin-compile-mode/src/transform_harmony.rs +526 -0
  35. package/swc/plugin-compile-mode/src/utils/constants.rs +149 -0
  36. package/swc/plugin-compile-mode/src/utils/harmony/components.rs +61 -0
  37. package/swc/plugin-compile-mode/src/utils/harmony/mod.rs +1 -0
  38. package/swc/plugin-compile-mode/src/utils/mod.rs +346 -0
  39. package/swc/plugin-compile-mode/target/wasm32-wasi/release/swc_plugin_compile_mode.wasm +0 -0
  40. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/attributes.rs/should_handle_events.js +8 -0
  41. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/attributes.rs/should_keep_static_attrs_only_in_templates.js +8 -0
  42. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/attributes.rs/should_turn_dynamic_attrs.js +11 -0
  43. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/children.rs/should_render_native_component.js +7 -0
  44. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/children.rs/should_render_react_component.js +7 -0
  45. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/children.rs/should_support_fragment.js +44 -0
  46. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/children.rs/should_support_render_fn.js +8 -0
  47. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/condition.rs/should_support_and_expr.js +14 -0
  48. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/condition.rs/should_support_conditional_expr.js +15 -0
  49. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/entry.rs/should_support_multi_compile_mode.js +10 -0
  50. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/attributes.rs/should_handle_events.js +181 -0
  51. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/attributes.rs/should_turn_dynamic_attrs.js +184 -0
  52. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/children.rs/should_render_react_component.js +75 -0
  53. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/children.rs/should_support_fragment.js +339 -0
  54. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/children.rs/should_support_render_fn.js +184 -0
  55. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/condition.rs/should_support_and_expr.js +209 -0
  56. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/condition.rs/should_support_complex_condition.js +242 -0
  57. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/condition.rs/should_support_conditional_and_unkonw_component.js +137 -0
  58. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/condition.rs/should_support_conditional_expr.js +342 -0
  59. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/entry.rs/should_support_compile_child_node.js +139 -0
  60. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/entry.rs/should_support_component_not_in_config.js +90 -0
  61. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/entry.rs/should_support_multi_compile_mode.js +206 -0
  62. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/entry.rs/should_support_single_compile_mode.js +65 -0
  63. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/looping.rs/should_loop_with_arrow_function_with_blockstmt.js +75 -0
  64. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/looping.rs/should_loop_with_arrow_function_with_blockstmt_and_set_parent_dynamic_id.js +88 -0
  65. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/harmony/looping.rs/should_loop_with_function_expr.js +85 -0
  66. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/looping.rs/should_loop_with_arrow_function_with_blockstmt.js +8 -0
  67. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/looping.rs/should_loop_with_arrow_function_with_expr.js +6 -0
  68. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/looping.rs/should_loop_with_function_expr.js +20 -0
  69. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/looping.rs/should_support_nested_loop.js +15 -0
  70. package/swc/plugin-compile-mode/tests/__swc_snapshots__/src/tests/shake.rs/should_static_jsx_being_shaked.js +20 -0
  71. package/swc/plugin-define-config/.cargo/config +5 -0
  72. package/swc/plugin-define-config/Cargo.lock +582 -506
  73. package/swc/plugin-define-config/Cargo.toml +2 -11
  74. package/swc/plugin-define-config/src/lib.rs +81 -128
  75. package/swc/plugin-define-config/target/wasm32-wasi/release/swc_plugin_define_config.wasm +0 -0
  76. package/swc/plugin-define-config/tests/__swc_snapshots__/src/lib.rs/module_decl_default_app.js +2 -0
  77. package/swc/plugin-define-config/tests/__swc_snapshots__/src/lib.rs/module_decl_default_page.js +2 -0
  78. package/swc/plugin-define-config/tests/__swc_snapshots__/src/lib.rs/module_exports.js +11 -0
  79. package/swc/plugin-define-config/tests/__swc_snapshots__/src/lib.rs/var_decl_app.js +3 -0
  80. package/swc/plugin-define-config/tests/__swc_snapshots__/src/lib.rs/var_decl_page.js +3 -0
@@ -0,0 +1,339 @@
1
+ const TARO_TEMPLATES_f0t0 = `import { createNode } from '../render'
2
+ import { FlexManager } from '../utils/FlexManager'
3
+ import { TOUCH_EVENT_MAP } from '../utils/constant/event'
4
+ import { getNodeThresholds, getNormalAttributes, getFontAttributes } from '../utils/helper'
5
+ import { TaroIgnoreElement, eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '../../runtime'
6
+ import { DynamicCenter } from '../utils/DynamicCenter'
7
+
8
+ import type { TaroViewElement } from '../element'
9
+ import type { TaroElement, TaroAny, TaroStyleType, TaroTextStyleType } from '../../runtime'
10
+
11
+ @Extend(Flex)
12
+ function attrs (style: TaroStyleType) {
13
+ .id(style.id)
14
+ .key(style.id)
15
+ .padding(style.padding)
16
+ .margin(style.margin)
17
+ .width(style.width)
18
+ .height(style.height)
19
+ .constraintSize(style.constraintSize)
20
+ .flexGrow(style.flexGrow)
21
+ .flexShrink(style.flexShrink)
22
+ .flexBasis(style.flexBasis)
23
+ .alignSelf(style.alignSelf)
24
+ .backgroundColor(style.backgroundColor)
25
+ .backgroundImage(style.backgroundImage, style.backgroundRepeat)
26
+ .backgroundImageSize(style.backgroundImageSize)
27
+ .rotate(style.rotate)
28
+ .scale(style.scale)
29
+ .translate(style.translate)
30
+ .transform(style.transform)
31
+ .borderStyle(style.borderStyle)
32
+ .borderWidth(style.borderWidth)
33
+ .borderColor(style.borderColor)
34
+ .borderRadius(style.borderRadius)
35
+ .linearGradient(style.linearGradient)
36
+ .zIndex(style.zIndex)
37
+ .opacity(style.opacity)
38
+ .clip(style.clip)
39
+ }
40
+ @Extend(Text)
41
+ function textStyle (style: TaroStyleType) {
42
+ .id(style.id)
43
+ .key(style.id)
44
+ .padding(style.padding)
45
+ .margin(style.margin)
46
+ .width(style.width)
47
+ .height(style.height)
48
+ .constraintSize(style.constraintSize)
49
+ .flexGrow(style.flexGrow)
50
+ .flexShrink(style.flexShrink)
51
+ .flexBasis(style.flexBasis)
52
+ .alignSelf(style.alignSelf)
53
+ .backgroundColor(style.backgroundColor)
54
+ .backgroundImage(style.backgroundImage, style.backgroundRepeat)
55
+ .backgroundImageSize(style.backgroundImageSize)
56
+ .rotate(style.rotate)
57
+ .scale(style.scale)
58
+ .translate(style.translate)
59
+ .transform(style.transform)
60
+ .borderStyle(style.borderStyle)
61
+ .borderWidth(style.borderWidth)
62
+ .borderColor(style.borderColor)
63
+ .borderRadius(style.borderRadius)
64
+ .linearGradient(style.linearGradient)
65
+ .zIndex(style.zIndex)
66
+ .opacity(style.opacity)
67
+ .clip(style.clip)
68
+ .fontColor(style.color)
69
+ .fontSize(style.fontSize)
70
+ .fontWeight(style.fontWeight)
71
+ .fontStyle(style.fontStyle)
72
+ .fontFamily(style.fontFamily)
73
+ .lineHeight(style.lineHeight)
74
+ .decoration({
75
+ type: style.decoration,
76
+ color: style.color
77
+ })
78
+ }
79
+
80
+ @Extend(Text)
81
+ function textAttr(attr: TaroTextStyleType) {
82
+ .textAlign(attr.textAlign)
83
+ .textOverflow(attr.textOverflow)
84
+ .maxLines(attr.maxLines)
85
+ .letterSpacing(attr.letterSpacing)
86
+ }
87
+ @Component
88
+ export default struct TARO_TEMPLATES_f0t0 {
89
+ nodeInfoMap: TaroAny = {}
90
+ dynamicCenter: DynamicCenter = new DynamicCenter()
91
+ @ObjectLink node: TaroViewElement
92
+
93
+ aboutToAppear () {
94
+ this.dynamicCenter.bindComponentToNodeWithDFS(this.node, this)
95
+ }
96
+
97
+ @State node0: TaroElement = new TaroIgnoreElement()
98
+ @State node1: TaroElement = new TaroIgnoreElement()
99
+ @State node2: TaroElement = new TaroIgnoreElement()
100
+ @State node3: TaroElement = new TaroIgnoreElement()
101
+ @State node4: TaroElement = new TaroIgnoreElement()
102
+ @State node5: TaroElement = new TaroIgnoreElement()
103
+ @State node6: TaroElement = new TaroIgnoreElement()
104
+
105
+ build() {
106
+ Flex(FlexManager.flexOptions(this.node0 as TaroElement)) {
107
+ Text(this.node0.childNodes[0].textContent)
108
+ .textStyle(getNormalAttributes(this.node0.childNodes[0] as TaroElement))
109
+ .textAttr(getFontAttributes(this.node0.childNodes[0] as TaroElement))
110
+ .onVisibleAreaChange(getNodeThresholds(this.node0.childNodes[0] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0.childNodes[0] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
111
+ .onAreaChange(getComponentEventCallback(this.node0.childNodes[0] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
112
+ const eventResult: TaroAny = res.eventResult
113
+ this.nodeInfoMap[this.node0.childNodes[0]._nid].areaInfo = eventResult[1]
114
+ }))
115
+ Flex(FlexManager.flexOptions(this.node1 as TaroElement)) {
116
+ Text(this.node1.childNodes[0].textContent)
117
+ .textStyle(getNormalAttributes(this.node1.childNodes[0] as TaroElement))
118
+ .textAttr(getFontAttributes(this.node1.childNodes[0] as TaroElement))
119
+ .onVisibleAreaChange(getNodeThresholds(this.node1.childNodes[0] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node1.childNodes[0] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
120
+ .onAreaChange(getComponentEventCallback(this.node1.childNodes[0] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
121
+ const eventResult: TaroAny = res.eventResult
122
+ this.nodeInfoMap[this.node1.childNodes[0]._nid].areaInfo = eventResult[1]
123
+ }))
124
+ }
125
+ .attrs(getNormalAttributes(this.node1 as TaroElement))
126
+ .onVisibleAreaChange(getNodeThresholds(this.node1 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node1 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
127
+ .onAreaChange(getComponentEventCallback(this.node1 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
128
+ const eventResult: TaroAny = res.eventResult
129
+ this.nodeInfoMap[this.node1._nid].areaInfo = eventResult[1]
130
+ }))
131
+ Flex(FlexManager.flexOptions(this.node0.childNodes[2] as TaroElement)) {
132
+ Text(this.node0.childNodes[2].childNodes[0].textContent)
133
+ .textStyle(getNormalAttributes(this.node0.childNodes[2].childNodes[0] as TaroElement))
134
+ .textAttr(getFontAttributes(this.node0.childNodes[2].childNodes[0] as TaroElement))
135
+ .onVisibleAreaChange(getNodeThresholds(this.node0.childNodes[2].childNodes[0] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0.childNodes[2].childNodes[0] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
136
+ .onAreaChange(getComponentEventCallback(this.node0.childNodes[2].childNodes[0] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
137
+ const eventResult: TaroAny = res.eventResult
138
+ this.nodeInfoMap[this.node0.childNodes[2].childNodes[0]._nid].areaInfo = eventResult[1]
139
+ }))
140
+ }
141
+ .attrs(getNormalAttributes(this.node0.childNodes[2] as TaroElement))
142
+ .onVisibleAreaChange(getNodeThresholds(this.node0.childNodes[2] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0.childNodes[2] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
143
+ .onAreaChange(getComponentEventCallback(this.node0.childNodes[2] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
144
+ const eventResult: TaroAny = res.eventResult
145
+ this.nodeInfoMap[this.node0.childNodes[2]._nid].areaInfo = eventResult[1]
146
+ }))
147
+ Flex(FlexManager.flexOptions(this.node0.childNodes[3] as TaroElement)) {
148
+ Flex(FlexManager.flexOptions(this.node2 as TaroElement)) {
149
+ Text(this.node2.childNodes[0].textContent)
150
+ .textStyle(getNormalAttributes(this.node2.childNodes[0] as TaroElement))
151
+ .textAttr(getFontAttributes(this.node2.childNodes[0] as TaroElement))
152
+ .onVisibleAreaChange(getNodeThresholds(this.node2.childNodes[0] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node2.childNodes[0] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
153
+ .onAreaChange(getComponentEventCallback(this.node2.childNodes[0] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
154
+ const eventResult: TaroAny = res.eventResult
155
+ this.nodeInfoMap[this.node2.childNodes[0]._nid].areaInfo = eventResult[1]
156
+ }))
157
+ }
158
+ .attrs(getNormalAttributes(this.node2 as TaroElement))
159
+ .onVisibleAreaChange(getNodeThresholds(this.node2 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node2 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
160
+ .onAreaChange(getComponentEventCallback(this.node2 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
161
+ const eventResult: TaroAny = res.eventResult
162
+ this.nodeInfoMap[this.node2._nid].areaInfo = eventResult[1]
163
+ }))
164
+ Flex(FlexManager.flexOptions(this.node0.childNodes[3].childNodes[1] as TaroElement)) {
165
+ Text(this.node0.childNodes[3].childNodes[1].childNodes[0].textContent)
166
+ .textStyle(getNormalAttributes(this.node0.childNodes[3].childNodes[1].childNodes[0] as TaroElement))
167
+ .textAttr(getFontAttributes(this.node0.childNodes[3].childNodes[1].childNodes[0] as TaroElement))
168
+ .onVisibleAreaChange(getNodeThresholds(this.node0.childNodes[3].childNodes[1].childNodes[0] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0.childNodes[3].childNodes[1].childNodes[0] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
169
+ .onAreaChange(getComponentEventCallback(this.node0.childNodes[3].childNodes[1].childNodes[0] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
170
+ const eventResult: TaroAny = res.eventResult
171
+ this.nodeInfoMap[this.node0.childNodes[3].childNodes[1].childNodes[0]._nid].areaInfo = eventResult[1]
172
+ }))
173
+ }
174
+ .attrs(getNormalAttributes(this.node0.childNodes[3].childNodes[1] as TaroElement))
175
+ .onVisibleAreaChange(getNodeThresholds(this.node0.childNodes[3].childNodes[1] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0.childNodes[3].childNodes[1] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
176
+ .onAreaChange(getComponentEventCallback(this.node0.childNodes[3].childNodes[1] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
177
+ const eventResult: TaroAny = res.eventResult
178
+ this.nodeInfoMap[this.node0.childNodes[3].childNodes[1]._nid].areaInfo = eventResult[1]
179
+ }))
180
+ }
181
+ .attrs(getNormalAttributes(this.node0.childNodes[3] as TaroElement))
182
+ .onVisibleAreaChange(getNodeThresholds(this.node0.childNodes[3] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0.childNodes[3] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
183
+ .onAreaChange(getComponentEventCallback(this.node0.childNodes[3] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
184
+ const eventResult: TaroAny = res.eventResult
185
+ this.nodeInfoMap[this.node0.childNodes[3]._nid].areaInfo = eventResult[1]
186
+ }))
187
+ Flex(FlexManager.flexOptions(this.node3 as TaroElement)) {
188
+ Text(this.node3.childNodes[0].textContent)
189
+ .textStyle(getNormalAttributes(this.node3.childNodes[0] as TaroElement))
190
+ .textAttr(getFontAttributes(this.node3.childNodes[0] as TaroElement))
191
+ .onVisibleAreaChange(getNodeThresholds(this.node3.childNodes[0] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node3.childNodes[0] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
192
+ .onAreaChange(getComponentEventCallback(this.node3.childNodes[0] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
193
+ const eventResult: TaroAny = res.eventResult
194
+ this.nodeInfoMap[this.node3.childNodes[0]._nid].areaInfo = eventResult[1]
195
+ }))
196
+ }
197
+ .attrs(getNormalAttributes(this.node3 as TaroElement))
198
+ .onVisibleAreaChange(getNodeThresholds(this.node3 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node3 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
199
+ .onAreaChange(getComponentEventCallback(this.node3 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
200
+ const eventResult: TaroAny = res.eventResult
201
+ this.nodeInfoMap[this.node3._nid].areaInfo = eventResult[1]
202
+ }))
203
+ Flex(FlexManager.flexOptions(this.node4 as TaroElement)) {
204
+ Text(this.node4.childNodes[0].textContent)
205
+ .textStyle(getNormalAttributes(this.node4.childNodes[0] as TaroElement))
206
+ .textAttr(getFontAttributes(this.node4.childNodes[0] as TaroElement))
207
+ .onVisibleAreaChange(getNodeThresholds(this.node4.childNodes[0] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node4.childNodes[0] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
208
+ .onAreaChange(getComponentEventCallback(this.node4.childNodes[0] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
209
+ const eventResult: TaroAny = res.eventResult
210
+ this.nodeInfoMap[this.node4.childNodes[0]._nid].areaInfo = eventResult[1]
211
+ }))
212
+ }
213
+ .attrs(getNormalAttributes(this.node4 as TaroElement))
214
+ .onVisibleAreaChange(getNodeThresholds(this.node4 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node4 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
215
+ .onAreaChange(getComponentEventCallback(this.node4 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
216
+ const eventResult: TaroAny = res.eventResult
217
+ this.nodeInfoMap[this.node4._nid].areaInfo = eventResult[1]
218
+ }))
219
+ Flex(FlexManager.flexOptions(this.node5 as TaroElement)) {
220
+ Text(this.node5.childNodes[0].textContent)
221
+ .textStyle(getNormalAttributes(this.node5.childNodes[0] as TaroElement))
222
+ .textAttr(getFontAttributes(this.node5.childNodes[0] as TaroElement))
223
+ .onVisibleAreaChange(getNodeThresholds(this.node5.childNodes[0] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node5.childNodes[0] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
224
+ .onAreaChange(getComponentEventCallback(this.node5.childNodes[0] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
225
+ const eventResult: TaroAny = res.eventResult
226
+ this.nodeInfoMap[this.node5.childNodes[0]._nid].areaInfo = eventResult[1]
227
+ }))
228
+ }
229
+ .attrs(getNormalAttributes(this.node5 as TaroElement))
230
+ .onVisibleAreaChange(getNodeThresholds(this.node5 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node5 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
231
+ .onAreaChange(getComponentEventCallback(this.node5 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
232
+ const eventResult: TaroAny = res.eventResult
233
+ this.nodeInfoMap[this.node5._nid].areaInfo = eventResult[1]
234
+ }))
235
+ Flex(FlexManager.flexOptions(this.node0.childNodes[7] as TaroElement)) {
236
+ Text(this.node0.childNodes[7].childNodes[0].textContent)
237
+ .textStyle(getNormalAttributes(this.node0.childNodes[7].childNodes[0] as TaroElement))
238
+ .textAttr(getFontAttributes(this.node0.childNodes[7].childNodes[0] as TaroElement))
239
+ .onVisibleAreaChange(getNodeThresholds(this.node0.childNodes[7].childNodes[0] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0.childNodes[7].childNodes[0] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
240
+ .onAreaChange(getComponentEventCallback(this.node0.childNodes[7].childNodes[0] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
241
+ const eventResult: TaroAny = res.eventResult
242
+ this.nodeInfoMap[this.node0.childNodes[7].childNodes[0]._nid].areaInfo = eventResult[1]
243
+ }))
244
+ }
245
+ .attrs(getNormalAttributes(this.node0.childNodes[7] as TaroElement))
246
+ .onVisibleAreaChange(getNodeThresholds(this.node0.childNodes[7] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0.childNodes[7] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
247
+ .onAreaChange(getComponentEventCallback(this.node0.childNodes[7] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
248
+ const eventResult: TaroAny = res.eventResult
249
+ this.nodeInfoMap[this.node0.childNodes[7]._nid].areaInfo = eventResult[1]
250
+ }))
251
+ Flex(FlexManager.flexOptions(this.node0.childNodes[8] as TaroElement)) {
252
+ Text(this.node0.childNodes[8].childNodes[0].textContent)
253
+ .textStyle(getNormalAttributes(this.node0.childNodes[8].childNodes[0] as TaroElement))
254
+ .textAttr(getFontAttributes(this.node0.childNodes[8].childNodes[0] as TaroElement))
255
+ .onVisibleAreaChange(getNodeThresholds(this.node0.childNodes[8].childNodes[0] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0.childNodes[8].childNodes[0] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
256
+ .onAreaChange(getComponentEventCallback(this.node0.childNodes[8].childNodes[0] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
257
+ const eventResult: TaroAny = res.eventResult
258
+ this.nodeInfoMap[this.node0.childNodes[8].childNodes[0]._nid].areaInfo = eventResult[1]
259
+ }))
260
+ }
261
+ .attrs(getNormalAttributes(this.node0.childNodes[8] as TaroElement))
262
+ .onVisibleAreaChange(getNodeThresholds(this.node0.childNodes[8] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0.childNodes[8] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
263
+ .onAreaChange(getComponentEventCallback(this.node0.childNodes[8] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
264
+ const eventResult: TaroAny = res.eventResult
265
+ this.nodeInfoMap[this.node0.childNodes[8]._nid].areaInfo = eventResult[1]
266
+ }))
267
+ Flex(FlexManager.flexOptions(this.node6 as TaroElement)) {
268
+ Text(this.node6.childNodes[0].textContent)
269
+ .textStyle(getNormalAttributes(this.node6.childNodes[0] as TaroElement))
270
+ .textAttr(getFontAttributes(this.node6.childNodes[0] as TaroElement))
271
+ .onVisibleAreaChange(getNodeThresholds(this.node6.childNodes[0] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node6.childNodes[0] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
272
+ .onAreaChange(getComponentEventCallback(this.node6.childNodes[0] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
273
+ const eventResult: TaroAny = res.eventResult
274
+ this.nodeInfoMap[this.node6.childNodes[0]._nid].areaInfo = eventResult[1]
275
+ }))
276
+ }
277
+ .attrs(getNormalAttributes(this.node6 as TaroElement))
278
+ .onVisibleAreaChange(getNodeThresholds(this.node6 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node6 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
279
+ .onAreaChange(getComponentEventCallback(this.node6 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
280
+ const eventResult: TaroAny = res.eventResult
281
+ this.nodeInfoMap[this.node6._nid].areaInfo = eventResult[1]
282
+ }))
283
+ }
284
+ .attrs(getNormalAttributes(this.node0 as TaroElement))
285
+ .onVisibleAreaChange(getNodeThresholds(this.node0 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
286
+ .onAreaChange(getComponentEventCallback(this.node0 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
287
+ const eventResult: TaroAny = res.eventResult
288
+ this.nodeInfoMap[this.node0._nid].areaInfo = eventResult[1]
289
+ }))
290
+ }
291
+ }
292
+ `;
293
+ function Index() {
294
+ return <View compileMode="f0t0" _dynamicID="node0">
295
+
296
+ {content0}
297
+
298
+ <>
299
+
300
+ <View _dynamicID="node1">{content1}</View>
301
+
302
+ <View>hello</View>
303
+
304
+ <View>
305
+
306
+ <>
307
+
308
+ <View _dynamicID="node2">{content2}</View>
309
+
310
+ <View>hello!</View>
311
+
312
+ </>
313
+
314
+ </View>
315
+
316
+ <View _dynamicID="node3">{content3}</View>
317
+
318
+ </>
319
+
320
+ <View _dynamicID="node4">{content4}</View>
321
+
322
+ <>
323
+
324
+ <View _dynamicID="node5">{content5}</View>
325
+
326
+ </>
327
+
328
+ <>
329
+
330
+ <View>hello!!</View>
331
+
332
+ </>
333
+
334
+ <View>hello!!!</View>
335
+
336
+ <View _dynamicID="node6">{content6}</View>
337
+
338
+ </View>;
339
+ }
@@ -0,0 +1,184 @@
1
+ const TARO_TEMPLATES_f0t0 = `import { createNode } from '../render'
2
+ import { FlexManager } from '../utils/FlexManager'
3
+ import { TOUCH_EVENT_MAP } from '../utils/constant/event'
4
+ import { getNodeThresholds, getNormalAttributes, getFontAttributes } from '../utils/helper'
5
+ import { TaroIgnoreElement, eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '../../runtime'
6
+ import { DynamicCenter } from '../utils/DynamicCenter'
7
+
8
+ import type { TaroViewElement } from '../element'
9
+ import type { TaroElement, TaroAny, TaroStyleType, TaroTextStyleType } from '../../runtime'
10
+
11
+ @Extend(Flex)
12
+ function attrs (style: TaroStyleType) {
13
+ .id(style.id)
14
+ .key(style.id)
15
+ .padding(style.padding)
16
+ .margin(style.margin)
17
+ .width(style.width)
18
+ .height(style.height)
19
+ .constraintSize(style.constraintSize)
20
+ .flexGrow(style.flexGrow)
21
+ .flexShrink(style.flexShrink)
22
+ .flexBasis(style.flexBasis)
23
+ .alignSelf(style.alignSelf)
24
+ .backgroundColor(style.backgroundColor)
25
+ .backgroundImage(style.backgroundImage, style.backgroundRepeat)
26
+ .backgroundImageSize(style.backgroundImageSize)
27
+ .rotate(style.rotate)
28
+ .scale(style.scale)
29
+ .translate(style.translate)
30
+ .transform(style.transform)
31
+ .borderStyle(style.borderStyle)
32
+ .borderWidth(style.borderWidth)
33
+ .borderColor(style.borderColor)
34
+ .borderRadius(style.borderRadius)
35
+ .linearGradient(style.linearGradient)
36
+ .zIndex(style.zIndex)
37
+ .opacity(style.opacity)
38
+ .clip(style.clip)
39
+ }
40
+ @Extend(Text)
41
+ function textStyle (style: TaroStyleType) {
42
+ .id(style.id)
43
+ .key(style.id)
44
+ .padding(style.padding)
45
+ .margin(style.margin)
46
+ .width(style.width)
47
+ .height(style.height)
48
+ .constraintSize(style.constraintSize)
49
+ .flexGrow(style.flexGrow)
50
+ .flexShrink(style.flexShrink)
51
+ .flexBasis(style.flexBasis)
52
+ .alignSelf(style.alignSelf)
53
+ .backgroundColor(style.backgroundColor)
54
+ .backgroundImage(style.backgroundImage, style.backgroundRepeat)
55
+ .backgroundImageSize(style.backgroundImageSize)
56
+ .rotate(style.rotate)
57
+ .scale(style.scale)
58
+ .translate(style.translate)
59
+ .transform(style.transform)
60
+ .borderStyle(style.borderStyle)
61
+ .borderWidth(style.borderWidth)
62
+ .borderColor(style.borderColor)
63
+ .borderRadius(style.borderRadius)
64
+ .linearGradient(style.linearGradient)
65
+ .zIndex(style.zIndex)
66
+ .opacity(style.opacity)
67
+ .clip(style.clip)
68
+ .fontColor(style.color)
69
+ .fontSize(style.fontSize)
70
+ .fontWeight(style.fontWeight)
71
+ .fontStyle(style.fontStyle)
72
+ .fontFamily(style.fontFamily)
73
+ .lineHeight(style.lineHeight)
74
+ .decoration({
75
+ type: style.decoration,
76
+ color: style.color
77
+ })
78
+ }
79
+
80
+ @Extend(Text)
81
+ function textAttr(attr: TaroTextStyleType) {
82
+ .textAlign(attr.textAlign)
83
+ .textOverflow(attr.textOverflow)
84
+ .maxLines(attr.maxLines)
85
+ .letterSpacing(attr.letterSpacing)
86
+ }
87
+ @Component
88
+ export default struct TARO_TEMPLATES_f0t0 {
89
+ nodeInfoMap: TaroAny = {}
90
+ dynamicCenter: DynamicCenter = new DynamicCenter()
91
+ @ObjectLink node: TaroViewElement
92
+
93
+ aboutToAppear () {
94
+ this.dynamicCenter.bindComponentToNodeWithDFS(this.node, this)
95
+ }
96
+
97
+ @State node0: TaroElement = new TaroIgnoreElement()
98
+ @State node1: TaroElement = new TaroIgnoreElement()
99
+ @State node2: TaroElement = new TaroIgnoreElement()
100
+ @State node3: TaroElement = new TaroIgnoreElement()
101
+ @State node4: TaroElement = new TaroIgnoreElement()
102
+
103
+ build() {
104
+ Flex(FlexManager.flexOptions(this.node0 as TaroElement)) {
105
+ Flex(FlexManager.flexOptions(this.node1 as TaroElement)) {
106
+ createNode(this.node1.childNodes[0] as TaroElement)
107
+ }
108
+ .attrs(getNormalAttributes(this.node1 as TaroElement))
109
+ .onVisibleAreaChange(getNodeThresholds(this.node1 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node1 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
110
+ .onAreaChange(getComponentEventCallback(this.node1 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
111
+ const eventResult: TaroAny = res.eventResult
112
+ this.nodeInfoMap[this.node1._nid].areaInfo = eventResult[1]
113
+ }))
114
+ Flex(FlexManager.flexOptions(this.node2 as TaroElement)) {
115
+ createNode(this.node2.childNodes[0] as TaroElement)
116
+ Text(this.node2.childNodes[1].textContent)
117
+ .textStyle(getNormalAttributes(this.node2.childNodes[1] as TaroElement))
118
+ .textAttr(getFontAttributes(this.node2.childNodes[1] as TaroElement))
119
+ .onVisibleAreaChange(getNodeThresholds(this.node2.childNodes[1] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node2.childNodes[1] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
120
+ .onAreaChange(getComponentEventCallback(this.node2.childNodes[1] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
121
+ const eventResult: TaroAny = res.eventResult
122
+ this.nodeInfoMap[this.node2.childNodes[1]._nid].areaInfo = eventResult[1]
123
+ }))
124
+ }
125
+ .attrs(getNormalAttributes(this.node2 as TaroElement))
126
+ .onVisibleAreaChange(getNodeThresholds(this.node2 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node2 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
127
+ .onAreaChange(getComponentEventCallback(this.node2 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
128
+ const eventResult: TaroAny = res.eventResult
129
+ this.nodeInfoMap[this.node2._nid].areaInfo = eventResult[1]
130
+ }))
131
+ Flex(FlexManager.flexOptions(this.node3 as TaroElement)) {
132
+ createNode(this.node3.childNodes[0] as TaroElement)
133
+ }
134
+ .attrs(getNormalAttributes(this.node3 as TaroElement))
135
+ .onVisibleAreaChange(getNodeThresholds(this.node3 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node3 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
136
+ .onAreaChange(getComponentEventCallback(this.node3 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
137
+ const eventResult: TaroAny = res.eventResult
138
+ this.nodeInfoMap[this.node3._nid].areaInfo = eventResult[1]
139
+ }))
140
+ Flex(FlexManager.flexOptions(this.node4 as TaroElement)) {
141
+ Text(this.node4.childNodes[0].textContent)
142
+ .textStyle(getNormalAttributes(this.node4.childNodes[0] as TaroElement))
143
+ .textAttr(getFontAttributes(this.node4.childNodes[0] as TaroElement))
144
+ .onVisibleAreaChange(getNodeThresholds(this.node4.childNodes[0] as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node4.childNodes[0] as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
145
+ .onAreaChange(getComponentEventCallback(this.node4.childNodes[0] as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
146
+ const eventResult: TaroAny = res.eventResult
147
+ this.nodeInfoMap[this.node4.childNodes[0]._nid].areaInfo = eventResult[1]
148
+ }))
149
+ }
150
+ .attrs(getNormalAttributes(this.node4 as TaroElement))
151
+ .onVisibleAreaChange(getNodeThresholds(this.node4 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node4 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
152
+ .onAreaChange(getComponentEventCallback(this.node4 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
153
+ const eventResult: TaroAny = res.eventResult
154
+ this.nodeInfoMap[this.node4._nid].areaInfo = eventResult[1]
155
+ }))
156
+ }
157
+ .attrs(getNormalAttributes(this.node0 as TaroElement))
158
+ .onVisibleAreaChange(getNodeThresholds(this.node0 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
159
+ .onAreaChange(getComponentEventCallback(this.node0 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
160
+ const eventResult: TaroAny = res.eventResult
161
+ this.nodeInfoMap[this.node0._nid].areaInfo = eventResult[1]
162
+ }))
163
+ }
164
+ }
165
+ `;
166
+ function Index() {
167
+ return <View compileMode="f0t0" _dynamicID="node0">
168
+
169
+ <View _dynamicID="node1">{renderHeader()}</View>
170
+
171
+ <View _dynamicID="node2">
172
+
173
+ {renderHeader()}
174
+
175
+ {normalFunc()}
176
+
177
+ </View>
178
+
179
+ <View _dynamicID="node3">{this.methods.renderFooter()}</View>
180
+
181
+ <View _dynamicID="node4">{normalFunc()}</View>
182
+
183
+ </View>;
184
+ }