@tarojs/helper 4.0.0-beta.0 → 4.0.0-beta.2

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