@tarojs/helper 4.0.0-beta.0 → 4.0.0-canary.1

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