ripple 0.3.128 → 0.4.0

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 (192) hide show
  1. package/CHANGELOG.md +267 -0
  2. package/package.json +10 -4
  3. package/src/runtime/element.js +23 -6
  4. package/src/runtime/index-client.js +81 -41
  5. package/src/runtime/index-server.js +1 -0
  6. package/src/runtime/internal/client/blocks.js +173 -91
  7. package/src/runtime/internal/client/component.js +4 -30
  8. package/src/runtime/internal/client/composite.js +12 -13
  9. package/src/runtime/internal/client/constants.js +9 -0
  10. package/src/runtime/internal/client/context.js +12 -19
  11. package/src/runtime/internal/client/css.js +7 -9
  12. package/src/runtime/internal/client/events.js +178 -90
  13. package/src/runtime/internal/client/expression.js +45 -25
  14. package/src/runtime/internal/client/for.js +409 -129
  15. package/src/runtime/internal/client/head.js +10 -5
  16. package/src/runtime/internal/client/html.js +1 -0
  17. package/src/runtime/internal/client/hydration.js +152 -10
  18. package/src/runtime/internal/client/if.js +239 -50
  19. package/src/runtime/internal/client/index.js +4 -12
  20. package/src/runtime/internal/client/operations.js +40 -61
  21. package/src/runtime/internal/client/portal.js +163 -85
  22. package/src/runtime/internal/client/render.js +39 -39
  23. package/src/runtime/internal/client/rpc.js +3 -3
  24. package/src/runtime/internal/client/runtime.js +592 -433
  25. package/src/runtime/internal/client/selector.js +5 -2
  26. package/src/runtime/internal/client/template.js +133 -158
  27. package/src/runtime/internal/client/transport.js +38 -0
  28. package/src/runtime/internal/client/try.js +465 -426
  29. package/src/runtime/internal/client/types.d.ts +56 -23
  30. package/src/runtime/internal/client/utils.js +1 -3
  31. package/src/runtime/internal/server/dynamic.js +20 -21
  32. package/src/runtime/internal/server/index.js +325 -275
  33. package/src/runtime/internal/server/rpc.js +3 -2
  34. package/src/runtime/internal/server/transport.js +16 -0
  35. package/src/runtime/transport.js +21 -0
  36. package/tests/client/__snapshots__/for.test.tsrx.snap +0 -5
  37. package/tests/client/array/array.copy-within.test.tsrx +12 -12
  38. package/tests/client/array/array.derived.test.tsrx +46 -46
  39. package/tests/client/array/array.iteration.test.tsrx +10 -10
  40. package/tests/client/array/array.mutations.test.tsrx +20 -20
  41. package/tests/client/array/array.static.test.tsrx +11 -11
  42. package/tests/client/array/array.to-methods.test.tsrx +6 -6
  43. package/tests/client/async-suspend.test.tsrx +74 -75
  44. package/tests/client/basic/basic.attributes.test.tsrx +86 -83
  45. package/tests/client/basic/basic.collections.test.tsrx +12 -12
  46. package/tests/client/basic/basic.components.test.tsrx +99 -25
  47. package/tests/client/basic/basic.errors.test.tsrx +18 -18
  48. package/tests/client/basic/basic.events.test.tsrx +42 -42
  49. package/tests/client/basic/basic.get-set.test.tsrx +8 -8
  50. package/tests/client/basic/basic.reactivity.test.tsrx +73 -38
  51. package/tests/client/basic/basic.rendering.test.tsrx +25 -25
  52. package/tests/client/basic/basic.utilities.test.tsrx +3 -3
  53. package/tests/client/boundaries.test.tsrx +8 -8
  54. package/tests/client/boxed-locals.test.tsrx +452 -0
  55. package/tests/client/compiler/__snapshots__/compiler.assignments.test.tsrx.snap +6 -6
  56. package/tests/client/compiler/compiler.assignments.test.tsrx +9 -73
  57. package/tests/client/compiler/compiler.attributes.test.tsrx +23 -23
  58. package/tests/client/compiler/compiler.basic.test.tsrx +15 -60
  59. package/tests/client/compiler/compiler.tracked-access.test.tsrx +18 -43
  60. package/tests/client/compiler/compiler.try-in-function.test.tsrx +2 -2
  61. package/tests/client/composite/__snapshots__/composite.render.test.tsrx.snap +0 -1
  62. package/tests/client/composite/composite.dynamic-components.test.tsrx +77 -6
  63. package/tests/client/composite/composite.props.test.tsrx +149 -12
  64. package/tests/client/composite/composite.reactivity.test.tsrx +51 -52
  65. package/tests/client/composite/composite.render.test.tsrx +26 -9
  66. package/tests/client/css/scoped-styles.test.tsrx +8 -8
  67. package/tests/client/date.test.tsrx +42 -42
  68. package/tests/client/derived-release.test.tsrx +370 -0
  69. package/tests/client/dynamic-elements.test.tsrx +45 -45
  70. package/tests/client/events.test.tsrx +97 -71
  71. package/tests/client/for-selector.test.tsrx +14 -14
  72. package/tests/client/for-single-root-items.test.tsrx +118 -3
  73. package/tests/client/for.test.tsrx +332 -31
  74. package/tests/client/head.test.tsrx +19 -19
  75. package/tests/client/html.test.tsrx +11 -9
  76. package/tests/client/if-block.test.tsrx +80 -0
  77. package/tests/client/map.test.tsrx +16 -16
  78. package/tests/client/media-query.test.tsrx +7 -7
  79. package/tests/client/portal.test.tsrx +224 -26
  80. package/tests/client/primitive-text.test.tsrx +50 -0
  81. package/tests/client/prop-kind-switch.test.tsrx +141 -0
  82. package/tests/client/ref.test.tsrx +17 -17
  83. package/tests/client/return.test.tsrx +26 -3
  84. package/tests/client/root-boundary.test.tsrx +42 -0
  85. package/tests/client/scoped-flush.test.tsrx +8 -8
  86. package/tests/client/set.test.tsrx +6 -6
  87. package/tests/client/svg.test.tsrx +11 -11
  88. package/tests/client/switch.test.tsrx +44 -44
  89. package/tests/client/track-async-hydration.test.tsrx +4 -4
  90. package/tests/client/try.test.tsrx +151 -83
  91. package/tests/client/tsx.test.tsrx +43 -40
  92. package/tests/client/url/url.derived.test.tsrx +6 -6
  93. package/tests/client/url-search-params/url-search-params.derived.test.tsrx +8 -8
  94. package/tests/client/url-search-params/url-search-params.iteration.test.tsrx +10 -10
  95. package/tests/client/url-search-params/url-search-params.mutation.test.tsrx +10 -10
  96. package/tests/client/url-search-params/url-search-params.retrieval.test.tsrx +18 -18
  97. package/tests/client/url-search-params/url-search-params.serialization.test.tsrx +2 -2
  98. package/tests/hydration/basic.test.js +74 -1
  99. package/tests/hydration/build-components.js +22 -1
  100. package/tests/hydration/compiled/client/basic.js +1142 -713
  101. package/tests/hydration/compiled/client/composite.js +151 -100
  102. package/tests/hydration/compiled/client/events.js +184 -171
  103. package/tests/hydration/compiled/client/for.js +1472 -1132
  104. package/tests/hydration/compiled/client/fragment-cursor.js +2341 -0
  105. package/tests/hydration/compiled/client/head.js +254 -201
  106. package/tests/hydration/compiled/client/hmr.js +54 -41
  107. package/tests/hydration/compiled/client/html-in-template.js +54 -39
  108. package/tests/hydration/compiled/client/html.js +1633 -1263
  109. package/tests/hydration/compiled/client/if-children.js +420 -270
  110. package/tests/hydration/compiled/client/if-fragment-controlflow.js +363 -317
  111. package/tests/hydration/compiled/client/if.js +229 -219
  112. package/tests/hydration/compiled/client/mixed-control-flow.js +420 -404
  113. package/tests/hydration/compiled/client/nested-control-flow.js +1326 -1277
  114. package/tests/hydration/compiled/client/portal.js +87 -95
  115. package/tests/hydration/compiled/client/reactivity.js +135 -101
  116. package/tests/hydration/compiled/client/return.js +28 -19
  117. package/tests/hydration/compiled/client/streaming.js +390 -306
  118. package/tests/hydration/compiled/client/switch.js +258 -266
  119. package/tests/hydration/compiled/client/track-async-serialization.js +448 -280
  120. package/tests/hydration/compiled/client/try.js +173 -129
  121. package/tests/hydration/compiled/client/typed-text.js +71 -0
  122. package/tests/hydration/compiled/fixtures/money.js +10 -0
  123. package/tests/hydration/compiled/server/basic.js +123 -6
  124. package/tests/hydration/compiled/server/composite.js +16 -30
  125. package/tests/hydration/compiled/server/events.js +66 -18
  126. package/tests/hydration/compiled/server/for.js +117 -41
  127. package/tests/hydration/compiled/server/fragment-cursor.js +1687 -0
  128. package/tests/hydration/compiled/server/head.js +20 -20
  129. package/tests/hydration/compiled/server/hmr.js +2 -2
  130. package/tests/hydration/compiled/server/html.js +70 -238
  131. package/tests/hydration/compiled/server/if-children.js +107 -15
  132. package/tests/hydration/compiled/server/if.js +11 -15
  133. package/tests/hydration/compiled/server/mixed-control-flow.js +8 -8
  134. package/tests/hydration/compiled/server/portal.js +14 -22
  135. package/tests/hydration/compiled/server/reactivity.js +14 -14
  136. package/tests/hydration/compiled/server/streaming.js +19 -19
  137. package/tests/hydration/compiled/server/switch.js +8 -8
  138. package/tests/hydration/compiled/server/track-async-serialization.js +150 -23
  139. package/tests/hydration/compiled/server/try.js +8 -8
  140. package/tests/hydration/compiled/server/typed-text.js +17 -0
  141. package/tests/hydration/components/basic.tsrx +44 -8
  142. package/tests/hydration/components/composite.tsrx +2 -2
  143. package/tests/hydration/components/events.tsrx +25 -25
  144. package/tests/hydration/components/for.tsrx +115 -67
  145. package/tests/hydration/components/fragment-cursor.tsrx +650 -0
  146. package/tests/hydration/components/head.tsrx +16 -16
  147. package/tests/hydration/components/hmr.tsrx +2 -2
  148. package/tests/hydration/components/html.tsrx +7 -7
  149. package/tests/hydration/components/if-children.tsrx +72 -25
  150. package/tests/hydration/components/if.tsrx +18 -18
  151. package/tests/hydration/components/mixed-control-flow.tsrx +11 -11
  152. package/tests/hydration/components/portal.tsrx +3 -3
  153. package/tests/hydration/components/reactivity.tsrx +16 -16
  154. package/tests/hydration/components/streaming.tsrx +20 -20
  155. package/tests/hydration/components/switch.tsrx +20 -20
  156. package/tests/hydration/components/text-types.ts +4 -0
  157. package/tests/hydration/components/track-async-serialization.tsrx +80 -26
  158. package/tests/hydration/components/try.tsrx +8 -8
  159. package/tests/hydration/components/typed-text.tsrx +22 -0
  160. package/tests/hydration/fixtures/money.js +10 -0
  161. package/tests/hydration/for.test.js +36 -0
  162. package/tests/hydration/fragment-cursor.test.js +111 -0
  163. package/tests/hydration/if-children.test.js +24 -0
  164. package/tests/hydration/streaming.test.js +19 -0
  165. package/tests/hydration/track-async-serialization.test.js +87 -2
  166. package/tests/hydration/tsconfig.text-types.json +10 -0
  167. package/tests/hydration/typed-text.test.js +34 -0
  168. package/tests/server/await.test.tsrx +3 -3
  169. package/tests/server/basic.attributes.test.tsrx +42 -42
  170. package/tests/server/basic.components.test.tsrx +64 -8
  171. package/tests/server/basic.test.tsrx +34 -32
  172. package/tests/server/compiler.test.tsrx +1 -70
  173. package/tests/server/composite.props.test.tsrx +6 -6
  174. package/tests/server/dynamic-elements.test.tsrx +31 -8
  175. package/tests/server/for.test.tsrx +94 -0
  176. package/tests/server/head.test.tsrx +11 -11
  177. package/tests/server/scoped-styles.test.tsrx +2 -2
  178. package/tests/server/streaming-ssr.test.tsrx +48 -43
  179. package/tests/server/track-async-serialization.test.tsrx +204 -21
  180. package/tests/server/try.test.tsrx +48 -48
  181. package/tests/types/transport.ts +40 -0
  182. package/tests/utils/vite-plugin-config.test.js +23 -0
  183. package/types/index.d.ts +48 -7
  184. package/types/server.d.ts +3 -0
  185. package/types/transport.d.ts +15 -0
  186. package/src/runtime/internal/client/switch.js +0 -113
  187. package/src/utils/errors.js +0 -13
  188. package/tests/client/lazy-array.test.tsrx +0 -31
  189. package/tests/client/lazy-destructuring.test.tsrx +0 -438
  190. package/tests/client/tracked-index-access.test.tsrx +0 -113
  191. package/tests/server/lazy-destructuring.test.tsrx +0 -595
  192. package/tests/server/tracked-index-access.test.tsrx +0 -76
@@ -1,7 +1,7 @@
1
1
  // @ts-nocheck
2
2
  import * as _$_ from 'ripple/internal/server';
3
3
 
4
- export function Layout(__props) {
4
+ export function Layout({ children }) {
5
5
  return _$_.tsrx_element(() => {
6
6
  _$_.regular_block(() => {
7
7
  let __out = '';
@@ -11,7 +11,7 @@ export function Layout(__props) {
11
11
  {
12
12
  _$_.output_push(__out);
13
13
  __out = '';
14
- _$_.render_expression(__props.children);
14
+ _$_.render_expression(children);
15
15
  }
16
16
 
17
17
  __out += '</div>';
@@ -20,7 +20,7 @@ export function Layout(__props) {
20
20
  });
21
21
  }
22
22
 
23
- export function TextWrappedLayout(__props) {
23
+ export function TextWrappedLayout({ children }) {
24
24
  return _$_.tsrx_element(() => {
25
25
  _$_.regular_block(() => {
26
26
  let __out = '';
@@ -28,7 +28,7 @@ export function TextWrappedLayout(__props) {
28
28
  __out += '<div class="layout">before';
29
29
  _$_.output_push(__out);
30
30
  __out = '';
31
- _$_.render_expression(__props.children);
31
+ _$_.render_expression(children);
32
32
  __out += 'after</div>';
33
33
  _$_.output_push(__out);
34
34
  });
@@ -190,26 +190,17 @@ export function DynamicTagElement() {
190
190
  const Tag = 'section';
191
191
 
192
192
  _$_.regular_block(() => {
193
- {
194
- const comp = _$_.dynamic_element;
195
-
196
- const args = [
197
- {
198
- is: Tag,
199
- class: "host",
200
- children: _$_.tsrx_element(() => {
201
- return _$_.tsrx_element(() => {
202
- let __out = '';
203
-
204
- __out += 'hello';
205
- _$_.output_push(__out);
206
- });
207
- })
208
- }
209
- ];
210
-
211
- _$_.render_component(comp, ...args);
212
- }
193
+ _$_.dynamic_element(Tag, {
194
+ class: "host",
195
+ children: _$_.tsrx_element(() => {
196
+ return _$_.tsrx_element(() => {
197
+ let __out = '';
198
+
199
+ __out += 'hello';
200
+ _$_.output_push(__out);
201
+ });
202
+ })
203
+ });
213
204
  });
214
205
  });
215
206
  }
@@ -226,12 +217,7 @@ export function DynamicTagComponent() {
226
217
  {
227
218
  children: _$_.tsrx_element(() => {
228
219
  return _$_.tsrx_element(() => {
229
- {
230
- const comp = _$_.dynamic_element;
231
- const args = [{ is: Comp }];
232
-
233
- _$_.render_component(comp, ...args);
234
- }
220
+ _$_.dynamic_element(Comp, {});
235
221
  });
236
222
  })
237
223
  }
@@ -5,12 +5,20 @@ import { track } from 'ripple/server';
5
5
 
6
6
  export function ClickCounter() {
7
7
  return _$_.tsrx_element(() => {
8
- let lazy = _$_.track(0, 'a070e3a7');
8
+ const count = _$_.track(0, 'a070e3a7');
9
9
 
10
10
  _$_.regular_block(() => {
11
11
  let __out = '';
12
12
 
13
- __out += '<div><button class="increment">Increment</button><span class="count">' + _$_.escape(lazy.value) + '</span></div>';
13
+ __out += '<div><button class="increment">Increment</button><span class="count">';
14
+
15
+ {
16
+ _$_.output_push(__out);
17
+ __out = '';
18
+ _$_.render_expression(count.value);
19
+ }
20
+
21
+ __out += '</span></div>';
14
22
  _$_.output_push(__out);
15
23
  });
16
24
  });
@@ -18,12 +26,20 @@ export function ClickCounter() {
18
26
 
19
27
  export function IncrementDecrement() {
20
28
  return _$_.tsrx_element(() => {
21
- let lazy_1 = _$_.track(0, '87fcabdd');
29
+ const count = _$_.track(0, '87fcabdd');
22
30
 
23
31
  _$_.regular_block(() => {
24
32
  let __out = '';
25
33
 
26
- __out += '<div><button class="decrement">-</button><span class="count">' + _$_.escape(lazy_1.value) + '</span><button class="increment">+</button></div>';
34
+ __out += '<div><button class="decrement">-</button><span class="count">';
35
+
36
+ {
37
+ _$_.output_push(__out);
38
+ __out = '';
39
+ _$_.render_expression(count.value);
40
+ }
41
+
42
+ __out += '</span><button class="increment">+</button></div>';
27
43
  _$_.output_push(__out);
28
44
  });
29
45
  });
@@ -31,13 +47,29 @@ export function IncrementDecrement() {
31
47
 
32
48
  export function MultipleEvents() {
33
49
  return _$_.tsrx_element(() => {
34
- let lazy_2 = _$_.track(0, '41b9f0b0');
35
- let lazy_3 = _$_.track(0, '72789f75');
50
+ const clicks = _$_.track(0, '41b9f0b0');
51
+ const hovers = _$_.track(0, '72789f75');
36
52
 
37
53
  _$_.regular_block(() => {
38
54
  let __out = '';
39
55
 
40
- __out += '<div><button class="target">Target</button><span class="clicks">' + _$_.escape(lazy_2.value) + '</span><span class="hovers">' + _$_.escape(lazy_3.value) + '</span></div>';
56
+ __out += '<div><button class="target">Target</button><span class="clicks">';
57
+
58
+ {
59
+ _$_.output_push(__out);
60
+ __out = '';
61
+ _$_.render_expression(clicks.value);
62
+ }
63
+
64
+ __out += '</span><span class="hovers">';
65
+
66
+ {
67
+ _$_.output_push(__out);
68
+ __out = '';
69
+ _$_.render_expression(hovers.value);
70
+ }
71
+
72
+ __out += '</span></div>';
41
73
  _$_.output_push(__out);
42
74
  });
43
75
  });
@@ -45,23 +77,31 @@ export function MultipleEvents() {
45
77
 
46
78
  export function MultiStateUpdate() {
47
79
  return _$_.tsrx_element(() => {
48
- let lazy_4 = _$_.track(0, '5a375160');
49
- let lazy_5 = _$_.track('none', '3ceeb88c');
80
+ const count = _$_.track(0, '5a375160');
81
+ const lastAction = _$_.track('none', '3ceeb88c');
50
82
 
51
83
  const handleClick = () => {
52
- _$_.update(lazy_4);
53
- _$_.set(lazy_5, 'increment');
84
+ count.value++;
85
+ lastAction.value = 'increment';
54
86
  };
55
87
 
56
88
  _$_.regular_block(() => {
57
89
  let __out = '';
58
90
 
59
- __out += '<div><button class="btn">Click</button><span class="count">' + _$_.escape(lazy_4.value) + '</span><span class="action">';
91
+ __out += '<div><button class="btn">Click</button><span class="count">';
60
92
 
61
93
  {
62
94
  _$_.output_push(__out);
63
95
  __out = '';
64
- _$_.render_expression(lazy_5.value);
96
+ _$_.render_expression(count.value);
97
+ }
98
+
99
+ __out += '</span><span class="action">';
100
+
101
+ {
102
+ _$_.output_push(__out);
103
+ __out = '';
104
+ _$_.render_expression(lastAction.value);
65
105
  }
66
106
 
67
107
  __out += '</span></div>';
@@ -72,12 +112,12 @@ export function MultiStateUpdate() {
72
112
 
73
113
  export function ToggleButton() {
74
114
  return _$_.tsrx_element(() => {
75
- let lazy_6 = _$_.track(false, 'be823ec7');
115
+ const isOn = _$_.track(false, 'be823ec7');
76
116
 
77
117
  _$_.regular_block(() => {
78
118
  let __out = '';
79
119
 
80
- __out += '<div><button class="toggle">' + _$_.escape(lazy_6.value ? 'ON' : 'OFF') + '</button></div>';
120
+ __out += '<div><button class="toggle">' + _$_.escape(isOn.value ? 'ON' : 'OFF') + '</button></div>';
81
121
  _$_.output_push(__out);
82
122
  });
83
123
  });
@@ -96,7 +136,7 @@ export function ChildButton(props) {
96
136
 
97
137
  export function ParentWithChildButton() {
98
138
  return _$_.tsrx_element(() => {
99
- let lazy_7 = _$_.track(0, 'dcc2e0f9');
139
+ const count = _$_.track(0, 'dcc2e0f9');
100
140
 
101
141
  _$_.regular_block(() => {
102
142
  let __out = '';
@@ -109,7 +149,7 @@ export function ParentWithChildButton() {
109
149
  const args = [
110
150
  {
111
151
  onClick: () => {
112
- _$_.update(lazy_7);
152
+ count.value++;
113
153
  },
114
154
  label: "Click me"
115
155
  }
@@ -120,7 +160,15 @@ export function ParentWithChildButton() {
120
160
  _$_.render_component(comp, ...args);
121
161
  }
122
162
 
123
- __out += '<span class="count">' + _$_.escape(lazy_7.value) + '</span></div>';
163
+ __out += '<span class="count">';
164
+
165
+ {
166
+ _$_.output_push(__out);
167
+ __out = '';
168
+ _$_.render_expression(count.value);
169
+ }
170
+
171
+ __out += '</span></div>';
124
172
  _$_.output_push(__out);
125
173
  });
126
174
  });
@@ -91,14 +91,14 @@ export function KeyedForLoop() {
91
91
 
92
92
  export function ReactiveForLoopAdd() {
93
93
  return _$_.tsrx_element(() => {
94
- let lazy = _$_.track(['A', 'B'], 'e145678a');
94
+ const items = _$_.track(['A', 'B'], 'e145678a');
95
95
 
96
96
  _$_.regular_block(() => {
97
97
  let __out = '';
98
98
 
99
99
  __out += '<button class="add">Add</button><ul><!--[-->';
100
100
 
101
- for (const item of lazy.value) {
101
+ for (const item of items.value) {
102
102
  __out += '<li>';
103
103
 
104
104
  {
@@ -118,14 +118,14 @@ export function ReactiveForLoopAdd() {
118
118
 
119
119
  export function ReactiveForLoopRemove() {
120
120
  return _$_.tsrx_element(() => {
121
- let lazy_1 = _$_.track(['A', 'B', 'C'], 'b4e9bd54');
121
+ const items = _$_.track(['A', 'B', 'C'], 'b4e9bd54');
122
122
 
123
123
  _$_.regular_block(() => {
124
124
  let __out = '';
125
125
 
126
126
  __out += '<button class="remove">Remove</button><ul><!--[-->';
127
127
 
128
- for (const item of lazy_1.value) {
128
+ for (const item of items.value) {
129
129
  __out += '<li>';
130
130
 
131
131
  {
@@ -145,7 +145,7 @@ export function ReactiveForLoopRemove() {
145
145
 
146
146
  export function ForLoopInteractive() {
147
147
  return _$_.tsrx_element(() => {
148
- let lazy_2 = _$_.track([0, 0, 0], '36f563df');
148
+ const counts = _$_.track([0, 0, 0], '36f563df');
149
149
 
150
150
  _$_.regular_block(() => {
151
151
  let __out = '';
@@ -157,7 +157,7 @@ export function ForLoopInteractive() {
157
157
 
158
158
  var i = 0;
159
159
 
160
- for (const count of lazy_2.value) {
160
+ for (const count of counts.value) {
161
161
  __out += '<div' + _$_.attr('class', `item-${i}`) + '><span class="value">';
162
162
 
163
163
  {
@@ -289,7 +289,7 @@ export function ForLoopComplexObjects() {
289
289
 
290
290
  export function KeyedForLoopReorder() {
291
291
  return _$_.tsrx_element(() => {
292
- let lazy_3 = _$_.track(
292
+ const items = _$_.track(
293
293
  [
294
294
  { id: 1, name: 'First' },
295
295
  { id: 2, name: 'Second' },
@@ -303,7 +303,7 @@ export function KeyedForLoopReorder() {
303
303
 
304
304
  __out += '<button class="reorder">Reorder</button><ul><!--[-->';
305
305
 
306
- for (const item of lazy_3.value) {
306
+ for (const item of items.value) {
307
307
  __out += '<li' + _$_.attr('class', `item-${item.id}`) + '>';
308
308
 
309
309
  {
@@ -323,14 +323,14 @@ export function KeyedForLoopReorder() {
323
323
 
324
324
  export function KeyedForLoopUpdate() {
325
325
  return _$_.tsrx_element(() => {
326
- let lazy_4 = _$_.track([{ id: 1, name: 'Item 1' }, { id: 2, name: 'Item 2' }], '7a2c2ada');
326
+ const items = _$_.track([{ id: 1, name: 'Item 1' }, { id: 2, name: 'Item 2' }], '7a2c2ada');
327
327
 
328
328
  _$_.regular_block(() => {
329
329
  let __out = '';
330
330
 
331
331
  __out += '<button class="update">Update</button><ul><!--[-->';
332
332
 
333
- for (const item of lazy_4.value) {
333
+ for (const item of items.value) {
334
334
  __out += '<li' + _$_.attr('class', `item-${item.id}`) + '>';
335
335
 
336
336
  {
@@ -350,14 +350,14 @@ export function KeyedForLoopUpdate() {
350
350
 
351
351
  export function ForLoopMixedOperations() {
352
352
  return _$_.tsrx_element(() => {
353
- let lazy_5 = _$_.track(['A', 'B', 'C', 'D'], '3dd7c7b6');
353
+ const items = _$_.track(['A', 'B', 'C', 'D'], '3dd7c7b6');
354
354
 
355
355
  _$_.regular_block(() => {
356
356
  let __out = '';
357
357
 
358
358
  __out += '<button class="shuffle">Shuffle</button><ul><!--[-->';
359
359
 
360
- for (const item of lazy_5.value) {
360
+ for (const item of items.value) {
361
361
  __out += '<li' + _$_.attr('class', `item-${item}`) + '>';
362
362
 
363
363
  {
@@ -377,18 +377,18 @@ export function ForLoopMixedOperations() {
377
377
 
378
378
  export function ForLoopInsideIf() {
379
379
  return _$_.tsrx_element(() => {
380
- let lazy_6 = _$_.track(true, '0528df30');
381
- let lazy_7 = _$_.track(['X', 'Y', 'Z'], 'bf375103');
380
+ const showList = _$_.track(true, '0528df30');
381
+ const items = _$_.track(['X', 'Y', 'Z'], 'bf375103');
382
382
 
383
383
  _$_.regular_block(() => {
384
384
  let __out = '';
385
385
 
386
386
  __out += '<button class="toggle">Toggle List</button><button class="add">Add Item</button><!--[-->';
387
387
 
388
- if (lazy_6.value) {
388
+ if (showList.value) {
389
389
  __out += '<ul class="list"><!--[-->';
390
390
 
391
- for (const item of lazy_7.value) {
391
+ for (const item of items.value) {
392
392
  __out += '<li>';
393
393
 
394
394
  {
@@ -411,15 +411,23 @@ export function ForLoopInsideIf() {
411
411
 
412
412
  export function ForLoopEmptyToPopulated() {
413
413
  return _$_.tsrx_element(() => {
414
- let lazy_8 = _$_.track([], '525c5dbc');
414
+ const items = _$_.track([], '525c5dbc');
415
415
 
416
416
  _$_.regular_block(() => {
417
417
  let __out = '';
418
418
 
419
419
  __out += '<button class="populate">Populate</button><ul class="list"><!--[-->';
420
420
 
421
- for (const item of lazy_8.value) {
422
- __out += '<li>' + _$_.escape(item) + '</li>';
421
+ for (const item of items.value) {
422
+ __out += '<li>';
423
+
424
+ {
425
+ _$_.output_push(__out);
426
+ __out = '';
427
+ _$_.render_expression(item);
428
+ }
429
+
430
+ __out += '</li>';
423
431
  }
424
432
 
425
433
  __out += '<!--]--></ul>';
@@ -430,14 +438,14 @@ export function ForLoopEmptyToPopulated() {
430
438
 
431
439
  export function ForLoopPopulatedToEmpty() {
432
440
  return _$_.tsrx_element(() => {
433
- let lazy_9 = _$_.track(['One', 'Two', 'Three'], 'ee47f078');
441
+ const items = _$_.track(['One', 'Two', 'Three'], 'ee47f078');
434
442
 
435
443
  _$_.regular_block(() => {
436
444
  let __out = '';
437
445
 
438
446
  __out += '<button class="clear">Clear</button><ul class="list"><!--[-->';
439
447
 
440
- for (const item of lazy_9.value) {
448
+ for (const item of items.value) {
441
449
  __out += '<li>';
442
450
 
443
451
  {
@@ -457,7 +465,7 @@ export function ForLoopPopulatedToEmpty() {
457
465
 
458
466
  export function NestedForLoopReactive() {
459
467
  return _$_.tsrx_element(() => {
460
- let lazy_10 = _$_.track([[1, 2], [3, 4]], 'a2f41fb3');
468
+ const grid = _$_.track([[1, 2], [3, 4]], 'a2f41fb3');
461
469
 
462
470
  _$_.regular_block(() => {
463
471
  let __out = '';
@@ -469,7 +477,7 @@ export function NestedForLoopReactive() {
469
477
 
470
478
  var rowIndex = 0;
471
479
 
472
- for (const row of lazy_10.value) {
480
+ for (const row of grid.value) {
473
481
  __out += '<div' + _$_.attr('class', `row-${rowIndex}`) + '>';
474
482
 
475
483
  {
@@ -578,7 +586,7 @@ export function ForLoopDeeplyNested() {
578
586
 
579
587
  export function ForLoopIndexUpdate() {
580
588
  return _$_.tsrx_element(() => {
581
- let lazy_11 = _$_.track(['First', 'Second', 'Third'], 'f61e31e6');
589
+ const items = _$_.track(['First', 'Second', 'Third'], 'f61e31e6');
582
590
 
583
591
  _$_.regular_block(() => {
584
592
  let __out = '';
@@ -590,7 +598,7 @@ export function ForLoopIndexUpdate() {
590
598
 
591
599
  var i = 0;
592
600
 
593
- for (const item of lazy_11.value) {
601
+ for (const item of items.value) {
594
602
  __out += '<li' + _$_.attr('class', `item-${i}`) + '>' + _$_.escape(`[${i}] ${item}`) + '</li>';
595
603
  i++;
596
604
  }
@@ -606,7 +614,7 @@ export function ForLoopIndexUpdate() {
606
614
 
607
615
  export function KeyedForLoopWithIndex() {
608
616
  return _$_.tsrx_element(() => {
609
- let lazy_12 = _$_.track(
617
+ const items = _$_.track(
610
618
  [
611
619
  { id: 'a', value: 'Alpha' },
612
620
  { id: 'b', value: 'Beta' },
@@ -625,7 +633,7 @@ export function KeyedForLoopWithIndex() {
625
633
 
626
634
  var i = 0;
627
635
 
628
- for (const item of lazy_12.value) {
636
+ for (const item of items.value) {
629
637
  __out += '<li' + _$_.attr('data-index', i, false) + _$_.attr('class', `item-${item.id}`) + '>' + _$_.escape(`[${i}] ${item.id}: ${item.value}`) + '</li>';
630
638
  i++;
631
639
  }
@@ -641,14 +649,14 @@ export function KeyedForLoopWithIndex() {
641
649
 
642
650
  export function ForLoopWithSiblings() {
643
651
  return _$_.tsrx_element(() => {
644
- let lazy_13 = _$_.track(['A', 'B'], '3c7e8152');
652
+ const items = _$_.track(['A', 'B'], '3c7e8152');
645
653
 
646
654
  _$_.regular_block(() => {
647
655
  let __out = '';
648
656
 
649
657
  __out += '<div class="wrapper"><header class="before">Before</header><!--[-->';
650
658
 
651
- for (const item of lazy_13.value) {
659
+ for (const item of items.value) {
652
660
  __out += '<div' + _$_.attr('class', `item-${item}`) + '>';
653
661
 
654
662
  {
@@ -698,12 +706,12 @@ export function ForLoopItemState() {
698
706
 
699
707
  function TodoItem(props) {
700
708
  return _$_.tsrx_element(() => {
701
- let lazy_14 = _$_.track(false, '4f2402a4');
709
+ const done = _$_.track(false, '4f2402a4');
702
710
 
703
711
  _$_.regular_block(() => {
704
712
  let __out = '';
705
713
 
706
- __out += '<div' + _$_.attr('class', `todo-${props.id}`) + '><input type="checkbox"' + _$_.attr('checked', lazy_14.value, true) + ' class="checkbox" /><span' + _$_.attr('class', lazy_14.value ? 'completed' : 'pending') + '>' + _$_.escape(props.text) + '</span></div>';
714
+ __out += '<div' + _$_.attr('class', `todo-${props.id}`) + '><input type="checkbox"' + _$_.attr('checked', done.value, true) + ' class="checkbox" /><span' + _$_.attr('class', done.value ? 'completed' : 'pending') + '>' + _$_.escape(props.text) + '</span></div>';
707
715
  _$_.output_push(__out);
708
716
  });
709
717
  });
@@ -738,14 +746,14 @@ export function ForLoopSingleItem() {
738
746
 
739
747
  export function ForLoopAddAtBeginning() {
740
748
  return _$_.tsrx_element(() => {
741
- let lazy_15 = _$_.track(['B', 'C'], '1561403a');
749
+ const items = _$_.track(['B', 'C'], '1561403a');
742
750
 
743
751
  _$_.regular_block(() => {
744
752
  let __out = '';
745
753
 
746
754
  __out += '<button class="prepend">Prepend A</button><ul><!--[-->';
747
755
 
748
- for (const item of lazy_15.value) {
756
+ for (const item of items.value) {
749
757
  __out += '<li' + _$_.attr('class', `item-${item}`) + '>';
750
758
 
751
759
  {
@@ -765,14 +773,14 @@ export function ForLoopAddAtBeginning() {
765
773
 
766
774
  export function ForLoopAddInMiddle() {
767
775
  return _$_.tsrx_element(() => {
768
- let lazy_16 = _$_.track(['A', 'C'], '1bc60b46');
776
+ const items = _$_.track(['A', 'C'], '1bc60b46');
769
777
 
770
778
  _$_.regular_block(() => {
771
779
  let __out = '';
772
780
 
773
781
  __out += '<button class="insert">Insert B</button><ul><!--[-->';
774
782
 
775
- for (const item of lazy_16.value) {
783
+ for (const item of items.value) {
776
784
  __out += '<li' + _$_.attr('class', `item-${item}`) + '>';
777
785
 
778
786
  {
@@ -792,14 +800,14 @@ export function ForLoopAddInMiddle() {
792
800
 
793
801
  export function ForLoopRemoveFromMiddle() {
794
802
  return _$_.tsrx_element(() => {
795
- let lazy_17 = _$_.track(['A', 'B', 'C'], '1c87f95f');
803
+ const items = _$_.track(['A', 'B', 'C'], '1c87f95f');
796
804
 
797
805
  _$_.regular_block(() => {
798
806
  let __out = '';
799
807
 
800
808
  __out += '<button class="remove-middle">Remove B</button><ul><!--[-->';
801
809
 
802
- for (const item of lazy_17.value) {
810
+ for (const item of items.value) {
803
811
  __out += '<li' + _$_.attr('class', `item-${item}`) + '>';
804
812
 
805
813
  {
@@ -855,14 +863,14 @@ export function ForLoopLargeList() {
855
863
 
856
864
  export function ForLoopSwap() {
857
865
  return _$_.tsrx_element(() => {
858
- let lazy_18 = _$_.track(['A', 'B', 'C', 'D'], '5f8d152f');
866
+ const items = _$_.track(['A', 'B', 'C', 'D'], '5f8d152f');
859
867
 
860
868
  _$_.regular_block(() => {
861
869
  let __out = '';
862
870
 
863
871
  __out += '<button class="swap">Swap First and Last</button><ul><!--[-->';
864
872
 
865
- for (const item of lazy_18.value) {
873
+ for (const item of items.value) {
866
874
  __out += '<li' + _$_.attr('class', `item-${item}`) + '>';
867
875
 
868
876
  {
@@ -882,14 +890,14 @@ export function ForLoopSwap() {
882
890
 
883
891
  export function ForLoopReverse() {
884
892
  return _$_.tsrx_element(() => {
885
- let lazy_19 = _$_.track(['A', 'B', 'C', 'D'], '24602e64');
893
+ const items = _$_.track(['A', 'B', 'C', 'D'], '24602e64');
886
894
 
887
895
  _$_.regular_block(() => {
888
896
  let __out = '';
889
897
 
890
898
  __out += '<button class="reverse">Reverse</button><ul><!--[-->';
891
899
 
892
- for (const item of lazy_19.value) {
900
+ for (const item of items.value) {
893
901
  __out += '<li' + _$_.attr('class', `item-${item}`) + '>';
894
902
 
895
903
  {
@@ -905,4 +913,72 @@ export function ForLoopReverse() {
905
913
  _$_.output_push(__out);
906
914
  });
907
915
  });
916
+ }
917
+
918
+ export function KeyedForLoopAppendAndRotate() {
919
+ return _$_.tsrx_element(() => {
920
+ const items = _$_.track([1, 2, 3], 'a8b41504');
921
+
922
+ _$_.regular_block(() => {
923
+ let __out = '';
924
+
925
+ __out += '<div class="wrapper"><div class="host"><!--[-->';
926
+
927
+ for (const item of items.value) {
928
+ __out += '<span class="item">';
929
+
930
+ {
931
+ _$_.output_push(__out);
932
+ __out = '';
933
+ _$_.render_expression(item);
934
+ }
935
+
936
+ __out += '</span>';
937
+ }
938
+
939
+ __out += '<!--]--><p class="tail">p</p></div><button class="push">Push</button><button class="rotate">Rotate</button></div>';
940
+ _$_.output_push(__out);
941
+ });
942
+ });
943
+ }
944
+
945
+ function RootKeyedList(props) {
946
+ return _$_.tsrx_element(() => {
947
+ _$_.regular_block(() => {
948
+ let __out = '';
949
+
950
+ __out += '<!--[-->';
951
+
952
+ for (const item of props.items.value) {
953
+ __out += '<span class="item">' + _$_.escape(item) + '</span>';
954
+ }
955
+
956
+ __out += '<!--]-->';
957
+ _$_.output_push(__out);
958
+ });
959
+ });
960
+ }
961
+
962
+ export function RootKeyedForLoopAppendAndRotate() {
963
+ return _$_.tsrx_element(() => {
964
+ const items = _$_.track([1, 2, 3], '50a91d60');
965
+
966
+ _$_.regular_block(() => {
967
+ let __out = '';
968
+
969
+ __out += '<div class="wrapper"><div class="host">';
970
+
971
+ {
972
+ const comp = RootKeyedList;
973
+ const args = [{ items }];
974
+
975
+ _$_.output_push(__out);
976
+ __out = '';
977
+ _$_.render_component(comp, ...args);
978
+ }
979
+
980
+ __out += '<p class="tail">p</p></div><button class="push">Push</button><button class="rotate">Rotate</button></div>';
981
+ _$_.output_push(__out);
982
+ });
983
+ });
908
984
  }