@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,209 +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(Image)
12
- function attrsImage (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
-
42
- function getImageMode (mode: string): ImageFit {
43
- switch (mode) {
44
- case 'aspectFit': return ImageFit.Contain
45
- case 'aspectFill': return ImageFit.Cover
46
- case 'scaleToFill': return ImageFit.Fill
47
- case 'widthFix': return ImageFit.Auto
48
- case 'heightFix': return ImageFit.Auto
49
- default: return ImageFit.Contain
50
- }
51
- }
52
- @Component
53
- export default struct TARO_TEMPLATES_f0t0 {
54
- nodeInfoMap: TaroAny = {}
55
- dynamicCenter: DynamicCenter = new DynamicCenter()
56
- @ObjectLink node: TaroViewElement
57
-
58
- aboutToAppear () {
59
- this.dynamicCenter.bindComponentToNodeWithDFS(this.node, this)
60
- }
61
-
62
- @State node0: TaroElement = new TaroIgnoreElement()
63
-
64
- build() {
65
- Image((this.node0 as TaroElement).getAttribute('src'))
66
- .objectFit(getImageMode((this.node0 as TaroElement).getAttribute('mode')))
67
- .attrsImage(getNormalAttributes(this.node0 as TaroElement))
68
- .onVisibleAreaChange(getNodeThresholds(this.node0 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
69
- .onAreaChange(getComponentEventCallback(this.node0 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
70
- const eventResult: TaroAny = res.eventResult
71
- this.nodeInfoMap[this.node0._nid].areaInfo = eventResult[1]
72
- }))
73
- }
74
- }
75
- `;
76
- const TARO_TEMPLATES_f0t1 = `import { createNode } from '../render'
77
- import { FlexManager } from '../utils/FlexManager'
78
- import { TOUCH_EVENT_MAP } from '../utils/constant/event'
79
- import { getNodeThresholds, getNormalAttributes, getFontAttributes } from '../utils/helper'
80
- import { TaroIgnoreElement, eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBLE_CHANGE_EVENT_NAME } from '../../runtime'
81
- import { DynamicCenter } from '../utils/DynamicCenter'
82
-
83
- import type { TaroViewElement } from '../element'
84
- import type { TaroElement, TaroAny, TaroStyleType, TaroTextStyleType } from '../../runtime'
85
-
86
- @Extend(Flex)
87
- function attrs (style: TaroStyleType) {
88
- .id(style.id)
89
- .key(style.id)
90
- .padding(style.padding)
91
- .margin(style.margin)
92
- .width(style.width)
93
- .height(style.height)
94
- .constraintSize(style.constraintSize)
95
- .flexGrow(style.flexGrow)
96
- .flexShrink(style.flexShrink)
97
- .flexBasis(style.flexBasis)
98
- .alignSelf(style.alignSelf)
99
- .backgroundColor(style.backgroundColor)
100
- .backgroundImage(style.backgroundImage, style.backgroundRepeat)
101
- .backgroundImageSize(style.backgroundImageSize)
102
- .backgroundImagePosition(style.backgroundImagePosition)
103
- .rotate(style.rotate)
104
- .scale(style.scale)
105
- .translate(style.translate)
106
- .transform(style.transform)
107
- .borderStyle(style.borderStyle)
108
- .borderWidth(style.borderWidth)
109
- .borderColor(style.borderColor)
110
- .borderRadius(style.borderRadius)
111
- .linearGradient(style.linearGradient)
112
- .zIndex(style.zIndex)
113
- .opacity(style.opacity)
114
- .clip(style.clip)
115
- }
116
- @Extend(Text)
117
- function textStyle (style: TaroStyleType) {
118
- .id(style.id)
119
- .key(style.id)
120
- .padding(style.padding)
121
- .margin(style.margin)
122
- .width(style.width)
123
- .height(style.height)
124
- .constraintSize(style.constraintSize)
125
- .flexGrow(style.flexGrow)
126
- .flexShrink(style.flexShrink)
127
- .flexBasis(style.flexBasis)
128
- .alignSelf(style.alignSelf)
129
- .backgroundColor(style.backgroundColor)
130
- .backgroundImage(style.backgroundImage, style.backgroundRepeat)
131
- .backgroundImageSize(style.backgroundImageSize)
132
- .backgroundImagePosition(style.backgroundImagePosition)
133
- .rotate(style.rotate)
134
- .scale(style.scale)
135
- .translate(style.translate)
136
- .transform(style.transform)
137
- .borderStyle(style.borderStyle)
138
- .borderWidth(style.borderWidth)
139
- .borderColor(style.borderColor)
140
- .borderRadius(style.borderRadius)
141
- .linearGradient(style.linearGradient)
142
- .zIndex(style.zIndex)
143
- .opacity(style.opacity)
144
- .clip(style.clip)
145
- .fontColor(style.color)
146
- .fontSize(style.fontSize)
147
- .fontWeight(style.fontWeight)
148
- .fontStyle(style.fontStyle)
149
- .fontFamily(style.fontFamily)
150
- .lineHeight(style.lineHeight)
151
- .decoration({
152
- type: style.decoration,
153
- color: style.color
154
- })
155
- }
156
-
157
- @Extend(Text)
158
- function textAttr(attr: TaroTextStyleType) {
159
- .textAlign(attr.textAlign)
160
- .textOverflow(attr.textOverflow)
161
- .maxLines(attr.maxLines)
162
- .letterSpacing(attr.letterSpacing)
163
- }
164
- @Component
165
- export default struct TARO_TEMPLATES_f0t1 {
166
- nodeInfoMap: TaroAny = {}
167
- dynamicCenter: DynamicCenter = new DynamicCenter()
168
- @ObjectLink node: TaroViewElement
169
-
170
- aboutToAppear () {
171
- this.dynamicCenter.bindComponentToNodeWithDFS(this.node, this)
172
- }
173
-
174
- @State node0: TaroElement = new TaroIgnoreElement()
175
- @State node1: TaroElement = new TaroIgnoreElement()
176
-
177
- build() {
178
- Flex(FlexManager.flexOptions(this.node0 as TaroElement)) {
179
- Text(this.node1.textContent)
180
- .textStyle(getNormalAttributes(this.node1 as TaroElement))
181
- .textAttr(getFontAttributes(this.node1 as TaroElement))
182
- .onVisibleAreaChange(getNodeThresholds(this.node1 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node1 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
183
- .onAreaChange(getComponentEventCallback(this.node1 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
184
- const eventResult: TaroAny = res.eventResult
185
- this.nodeInfoMap[this.node1._nid].areaInfo = eventResult[1]
186
- }))
187
- }
188
- .attrs(getNormalAttributes(this.node0 as TaroElement))
189
- .onVisibleAreaChange(getNodeThresholds(this.node0 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
190
- .onAreaChange(getComponentEventCallback(this.node0 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
191
- const eventResult: TaroAny = res.eventResult
192
- this.nodeInfoMap[this.node0._nid].areaInfo = eventResult[1]
193
- }))
194
- }
195
- }
196
- `;
197
- function Index() {
198
- return <View>
199
-
200
- <Image src={mySrc} compileMode="f0t0" _dynamicID="node0"/>
201
-
202
- <View compileMode="f0t1" _dynamicID="node0">
203
-
204
- <Text _dynamicID="node1">{myText}</Text>
205
-
206
- </View>
207
-
208
- </View>;
209
- }
@@ -1,66 +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
- .attrs(getNormalAttributes(this.node0 as TaroElement))
56
- .onVisibleAreaChange(getNodeThresholds(this.node0 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
57
- .onAreaChange(getComponentEventCallback(this.node0 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
58
- const eventResult: TaroAny = res.eventResult
59
- this.nodeInfoMap[this.node0._nid].areaInfo = eventResult[1]
60
- }))
61
- }
62
- }
63
- `;
64
- function Index() {
65
- return <View compileMode="f0t0" _dynamicID="node0"></View>;
66
- }
@@ -1,76 +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
- ForEach(this.node0.childNodes, (item: TaroElement) => {
56
- createNode(item)
57
- }, (item: TaroElement) => item._nid)
58
- }
59
- .attrs(getNormalAttributes(this.node0 as TaroElement))
60
- .onVisibleAreaChange(getNodeThresholds(this.node0 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
61
- .onAreaChange(getComponentEventCallback(this.node0 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
62
- const eventResult: TaroAny = res.eventResult
63
- this.nodeInfoMap[this.node0._nid].areaInfo = eventResult[1]
64
- }))
65
- }
66
- }
67
- `;
68
- function Index() {
69
- return <View compileMode="f0t0" _dynamicID="node0">
70
-
71
- {list.map((item)=>{
72
- return <View>{item}</View>;
73
- })}
74
-
75
- </View>;
76
- }
@@ -1,89 +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
- @State node1: TaroElement = new TaroIgnoreElement()
53
-
54
- build() {
55
- Flex(FlexManager.flexOptions(this.node0 as TaroElement)) {
56
- Flex(FlexManager.flexOptions(this.node1 as TaroElement)) {
57
- ForEach(this.node1.childNodes, (item: TaroElement) => {
58
- createNode(item)
59
- }, (item: TaroElement) => item._nid)
60
- }
61
- .attrs(getNormalAttributes(this.node1 as TaroElement))
62
- .onVisibleAreaChange(getNodeThresholds(this.node1 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node1 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
63
- .onAreaChange(getComponentEventCallback(this.node1 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
64
- const eventResult: TaroAny = res.eventResult
65
- this.nodeInfoMap[this.node1._nid].areaInfo = eventResult[1]
66
- }))
67
- }
68
- .attrs(getNormalAttributes(this.node0 as TaroElement))
69
- .onVisibleAreaChange(getNodeThresholds(this.node0 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
70
- .onAreaChange(getComponentEventCallback(this.node0 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
71
- const eventResult: TaroAny = res.eventResult
72
- this.nodeInfoMap[this.node0._nid].areaInfo = eventResult[1]
73
- }))
74
- }
75
- }
76
- `;
77
- function Index() {
78
- return <View compileMode="f0t0" _dynamicID="node0">
79
-
80
- <View _dynamicID="node1">
81
-
82
- {list.map((item)=>{
83
- return <View>{item}</View>;
84
- })}
85
-
86
- </View>
87
-
88
- </View>;
89
- }
@@ -1,86 +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
- ForEach(this.node0.childNodes, (item: TaroElement) => {
56
- createNode(item)
57
- }, (item: TaroElement) => item._nid)
58
- }
59
- .attrs(getNormalAttributes(this.node0 as TaroElement))
60
- .onVisibleAreaChange(getNodeThresholds(this.node0 as TaroElement) || [0.0, 1.0], getComponentEventCallback(this.node0 as TaroElement, VISIBLE_CHANGE_EVENT_NAME))
61
- .onAreaChange(getComponentEventCallback(this.node0 as TaroElement, AREA_CHANGE_EVENT_NAME, res => {
62
- const eventResult: TaroAny = res.eventResult
63
- this.nodeInfoMap[this.node0._nid].areaInfo = eventResult[1]
64
- }))
65
- }
66
- }
67
- `;
68
- function Index() {
69
- return <View compileMode="f0t0" _dynamicID="node0">
70
-
71
- {list.map(function(item, index) {
72
- return <View hoverClass={myClass}>
73
-
74
- <Text>index:</Text>
75
-
76
- <Text>{index}</Text>
77
-
78
- <Text>item:</Text>
79
-
80
- <Text>{item}</Text>
81
-
82
- </View>;
83
- })}
84
-
85
- </View>;
86
- }
@@ -1,8 +0,0 @@
1
- const TARO_TEMPLATES_f0t0 = '<template name="tmpl_0_f0t0"><view><view wx:for="{{i.cn}}" wx:key="sid">{{item.cn[0].v}}</view></view></template>';
2
- function Index() {
3
- return <View compileMode="f0t0">
4
- {list.map(item => {
5
- return <View>{item}</View>
6
- })}
7
- </View>;
8
- }
@@ -1,6 +0,0 @@
1
- const TARO_TEMPLATES_f0t0 = '<template name="tmpl_0_f0t0"><view><view wx:for="{{i.cn}}" wx:key="sid">{{item.cn[0].v}}</view></view></template>';
2
- function Index () {
3
- return <View compileMode="f0t0">
4
- {list.map(item => <View>{item}</View>)}
5
- </View>;
6
- }
@@ -1,20 +0,0 @@
1
- const TARO_TEMPLATES_f0t0 = '<template name="tmpl_0_f0t0"><view><view hover-class="{{xs.b(item.p1,\'none\')}}" wx:for="{{i.cn}}" wx:key="sid"><text>index:</text><text>{{item.cn[0].cn[0].v}}</text><text>item:</text><text>{{item.cn[1].cn[0].v}}</text></view></view></template>';
2
- function Index() {
3
- return <View compileMode="f0t0">
4
-
5
- {list.map(function(item, index) {
6
- return <View hoverClass={myClass}>
7
-
8
-
9
-
10
- <Text>{index}</Text>
11
-
12
-
13
-
14
- <Text>{item}</Text>
15
-
16
- </View>;
17
- })}
18
-
19
- </View>;
20
- }
@@ -1,15 +0,0 @@
1
- const TARO_TEMPLATES_f0t0 = '<template name="tmpl_0_f0t0"><view><view hover-class="{{xs.b(item.p1,\'none\')}}" wx:for="{{i.cn}}" wx:key="sid"><view>title: {{item.cn[0].cn[0].v}}</view><view><text selectable="{{xs.b(item.p1,!1)}}" wx:for="{{item.cn[1].cn}}" wx:key="sid">content: {{item.cn[0].v}}</text></view></view></view></template>';
2
- function Index() {
3
- return <View compileMode="f0t0">
4
- {list.map(function(item, index) {
5
- return <View hoverClass={myClass} key={index}>
6
- <View>{item}</View>
7
- <View>
8
- {sublist.map(function(c) {
9
- return <Text selectable={isSelectable}>{c}</Text>
10
- })}
11
- </View>
12
- </View>
13
- })}
14
- </View>;
15
- }
@@ -1,20 +0,0 @@
1
- const TARO_TEMPLATES_f0t0 = '<template name="tmpl_0_f0t0"><view><text>Hello World!</text><text>Hello{{i.cn[0].cn[0].v}}World{{i.cn[0].cn[1].v}}!</text><view><text></text></view><view hover-stop-propagation="true" style="color: red"><text>Hello World!</text></view><view style="{{i.cn[1].st}}"><text>Hello World!</text></view></view></template>';
2
- function Index() {
3
- return <View compileMode="f0t0">
4
-
5
-
6
-
7
- <Text>{T1}{T2}</Text>
8
-
9
-
10
-
11
-
12
-
13
- <View style={myStyle}>
14
-
15
-
16
-
17
- </View>
18
-
19
- </View>;
20
- }
@@ -1,5 +0,0 @@
1
- # These command aliases are not final, may change
2
- [alias]
3
- # Alias to build actual plugin binary for the specified target.
4
- build-wasi = "build --target wasm32-wasi"
5
- build-wasm32 = "build --target wasm32-unknown-unknown"