ripple 0.3.127 → 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 +293 -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 +192 -114
  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 +14 -5
  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 +185 -124
  14. package/src/runtime/internal/client/for.js +616 -264
  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 +9 -13
  20. package/src/runtime/internal/client/operations.js +44 -51
  21. package/src/runtime/internal/client/portal.js +163 -85
  22. package/src/runtime/internal/client/render.js +44 -25
  23. package/src/runtime/internal/client/rpc.js +3 -3
  24. package/src/runtime/internal/client/runtime.js +799 -576
  25. package/src/runtime/internal/client/selector.js +77 -0
  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 +65 -21
  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 +327 -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 +97 -29
  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 +221 -0
  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 +190 -150
  103. package/tests/hydration/compiled/client/for.js +1472 -1126
  104. package/tests/hydration/compiled/client/fragment-cursor.js +2341 -0
  105. package/tests/hydration/compiled/client/head.js +255 -199
  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 -400
  113. package/tests/hydration/compiled/client/nested-control-flow.js +1326 -1255
  114. package/tests/hydration/compiled/client/portal.js +87 -95
  115. package/tests/hydration/compiled/client/reactivity.js +140 -83
  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 +19 -19
  126. package/tests/hydration/compiled/server/for.js +109 -49
  127. package/tests/hydration/compiled/server/fragment-cursor.js +1687 -0
  128. package/tests/hydration/compiled/server/head.js +20 -28
  129. package/tests/hydration/compiled/server/hmr.js +2 -2
  130. package/tests/hydration/compiled/server/html.js +71 -247
  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 -46
  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,7 +5,7 @@ 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 = '';
@@ -15,7 +15,7 @@ export function ClickCounter() {
15
15
  {
16
16
  _$_.output_push(__out);
17
17
  __out = '';
18
- _$_.render_expression(lazy.value);
18
+ _$_.render_expression(count.value);
19
19
  }
20
20
 
21
21
  __out += '</span></div>';
@@ -26,7 +26,7 @@ export function ClickCounter() {
26
26
 
27
27
  export function IncrementDecrement() {
28
28
  return _$_.tsrx_element(() => {
29
- let lazy_1 = _$_.track(0, '87fcabdd');
29
+ const count = _$_.track(0, '87fcabdd');
30
30
 
31
31
  _$_.regular_block(() => {
32
32
  let __out = '';
@@ -36,7 +36,7 @@ export function IncrementDecrement() {
36
36
  {
37
37
  _$_.output_push(__out);
38
38
  __out = '';
39
- _$_.render_expression(lazy_1.value);
39
+ _$_.render_expression(count.value);
40
40
  }
41
41
 
42
42
  __out += '</span><button class="increment">+</button></div>';
@@ -47,8 +47,8 @@ export function IncrementDecrement() {
47
47
 
48
48
  export function MultipleEvents() {
49
49
  return _$_.tsrx_element(() => {
50
- let lazy_2 = _$_.track(0, '41b9f0b0');
51
- let lazy_3 = _$_.track(0, '72789f75');
50
+ const clicks = _$_.track(0, '41b9f0b0');
51
+ const hovers = _$_.track(0, '72789f75');
52
52
 
53
53
  _$_.regular_block(() => {
54
54
  let __out = '';
@@ -58,7 +58,7 @@ export function MultipleEvents() {
58
58
  {
59
59
  _$_.output_push(__out);
60
60
  __out = '';
61
- _$_.render_expression(lazy_2.value);
61
+ _$_.render_expression(clicks.value);
62
62
  }
63
63
 
64
64
  __out += '</span><span class="hovers">';
@@ -66,7 +66,7 @@ export function MultipleEvents() {
66
66
  {
67
67
  _$_.output_push(__out);
68
68
  __out = '';
69
- _$_.render_expression(lazy_3.value);
69
+ _$_.render_expression(hovers.value);
70
70
  }
71
71
 
72
72
  __out += '</span></div>';
@@ -77,12 +77,12 @@ export function MultipleEvents() {
77
77
 
78
78
  export function MultiStateUpdate() {
79
79
  return _$_.tsrx_element(() => {
80
- let lazy_4 = _$_.track(0, '5a375160');
81
- let lazy_5 = _$_.track('none', '3ceeb88c');
80
+ const count = _$_.track(0, '5a375160');
81
+ const lastAction = _$_.track('none', '3ceeb88c');
82
82
 
83
83
  const handleClick = () => {
84
- _$_.update(lazy_4);
85
- _$_.set(lazy_5, 'increment');
84
+ count.value++;
85
+ lastAction.value = 'increment';
86
86
  };
87
87
 
88
88
  _$_.regular_block(() => {
@@ -93,7 +93,7 @@ export function MultiStateUpdate() {
93
93
  {
94
94
  _$_.output_push(__out);
95
95
  __out = '';
96
- _$_.render_expression(lazy_4.value);
96
+ _$_.render_expression(count.value);
97
97
  }
98
98
 
99
99
  __out += '</span><span class="action">';
@@ -101,7 +101,7 @@ export function MultiStateUpdate() {
101
101
  {
102
102
  _$_.output_push(__out);
103
103
  __out = '';
104
- _$_.render_expression(lazy_5.value);
104
+ _$_.render_expression(lastAction.value);
105
105
  }
106
106
 
107
107
  __out += '</span></div>';
@@ -112,12 +112,12 @@ export function MultiStateUpdate() {
112
112
 
113
113
  export function ToggleButton() {
114
114
  return _$_.tsrx_element(() => {
115
- let lazy_6 = _$_.track(false, 'be823ec7');
115
+ const isOn = _$_.track(false, 'be823ec7');
116
116
 
117
117
  _$_.regular_block(() => {
118
118
  let __out = '';
119
119
 
120
- __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>';
121
121
  _$_.output_push(__out);
122
122
  });
123
123
  });
@@ -136,7 +136,7 @@ export function ChildButton(props) {
136
136
 
137
137
  export function ParentWithChildButton() {
138
138
  return _$_.tsrx_element(() => {
139
- let lazy_7 = _$_.track(0, 'dcc2e0f9');
139
+ const count = _$_.track(0, 'dcc2e0f9');
140
140
 
141
141
  _$_.regular_block(() => {
142
142
  let __out = '';
@@ -149,7 +149,7 @@ export function ParentWithChildButton() {
149
149
  const args = [
150
150
  {
151
151
  onClick: () => {
152
- _$_.update(lazy_7);
152
+ count.value++;
153
153
  },
154
154
  label: "Click me"
155
155
  }
@@ -165,7 +165,7 @@ export function ParentWithChildButton() {
165
165
  {
166
166
  _$_.output_push(__out);
167
167
  __out = '';
168
- _$_.render_expression(lazy_7.value);
168
+ _$_.render_expression(count.value);
169
169
  }
170
170
 
171
171
  __out += '</span></div>';
@@ -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
  {
@@ -240,15 +240,7 @@ export function EmptyForLoop() {
240
240
  __out += '<div class="container"><!--[-->';
241
241
 
242
242
  for (const item of items) {
243
- __out += '<span>';
244
-
245
- {
246
- _$_.output_push(__out);
247
- __out = '';
248
- _$_.render_expression(item);
249
- }
250
-
251
- __out += '</span>';
243
+ __out += '<span>' + _$_.escape(item) + '</span>';
252
244
  }
253
245
 
254
246
  __out += '<!--]--></div>';
@@ -297,7 +289,7 @@ export function ForLoopComplexObjects() {
297
289
 
298
290
  export function KeyedForLoopReorder() {
299
291
  return _$_.tsrx_element(() => {
300
- let lazy_3 = _$_.track(
292
+ const items = _$_.track(
301
293
  [
302
294
  { id: 1, name: 'First' },
303
295
  { id: 2, name: 'Second' },
@@ -311,7 +303,7 @@ export function KeyedForLoopReorder() {
311
303
 
312
304
  __out += '<button class="reorder">Reorder</button><ul><!--[-->';
313
305
 
314
- for (const item of lazy_3.value) {
306
+ for (const item of items.value) {
315
307
  __out += '<li' + _$_.attr('class', `item-${item.id}`) + '>';
316
308
 
317
309
  {
@@ -331,14 +323,14 @@ export function KeyedForLoopReorder() {
331
323
 
332
324
  export function KeyedForLoopUpdate() {
333
325
  return _$_.tsrx_element(() => {
334
- 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');
335
327
 
336
328
  _$_.regular_block(() => {
337
329
  let __out = '';
338
330
 
339
331
  __out += '<button class="update">Update</button><ul><!--[-->';
340
332
 
341
- for (const item of lazy_4.value) {
333
+ for (const item of items.value) {
342
334
  __out += '<li' + _$_.attr('class', `item-${item.id}`) + '>';
343
335
 
344
336
  {
@@ -358,14 +350,14 @@ export function KeyedForLoopUpdate() {
358
350
 
359
351
  export function ForLoopMixedOperations() {
360
352
  return _$_.tsrx_element(() => {
361
- let lazy_5 = _$_.track(['A', 'B', 'C', 'D'], '3dd7c7b6');
353
+ const items = _$_.track(['A', 'B', 'C', 'D'], '3dd7c7b6');
362
354
 
363
355
  _$_.regular_block(() => {
364
356
  let __out = '';
365
357
 
366
358
  __out += '<button class="shuffle">Shuffle</button><ul><!--[-->';
367
359
 
368
- for (const item of lazy_5.value) {
360
+ for (const item of items.value) {
369
361
  __out += '<li' + _$_.attr('class', `item-${item}`) + '>';
370
362
 
371
363
  {
@@ -385,18 +377,18 @@ export function ForLoopMixedOperations() {
385
377
 
386
378
  export function ForLoopInsideIf() {
387
379
  return _$_.tsrx_element(() => {
388
- let lazy_6 = _$_.track(true, '0528df30');
389
- let lazy_7 = _$_.track(['X', 'Y', 'Z'], 'bf375103');
380
+ const showList = _$_.track(true, '0528df30');
381
+ const items = _$_.track(['X', 'Y', 'Z'], 'bf375103');
390
382
 
391
383
  _$_.regular_block(() => {
392
384
  let __out = '';
393
385
 
394
386
  __out += '<button class="toggle">Toggle List</button><button class="add">Add Item</button><!--[-->';
395
387
 
396
- if (lazy_6.value) {
388
+ if (showList.value) {
397
389
  __out += '<ul class="list"><!--[-->';
398
390
 
399
- for (const item of lazy_7.value) {
391
+ for (const item of items.value) {
400
392
  __out += '<li>';
401
393
 
402
394
  {
@@ -419,14 +411,14 @@ export function ForLoopInsideIf() {
419
411
 
420
412
  export function ForLoopEmptyToPopulated() {
421
413
  return _$_.tsrx_element(() => {
422
- let lazy_8 = _$_.track([], '525c5dbc');
414
+ const items = _$_.track([], '525c5dbc');
423
415
 
424
416
  _$_.regular_block(() => {
425
417
  let __out = '';
426
418
 
427
419
  __out += '<button class="populate">Populate</button><ul class="list"><!--[-->';
428
420
 
429
- for (const item of lazy_8.value) {
421
+ for (const item of items.value) {
430
422
  __out += '<li>';
431
423
 
432
424
  {
@@ -446,14 +438,14 @@ export function ForLoopEmptyToPopulated() {
446
438
 
447
439
  export function ForLoopPopulatedToEmpty() {
448
440
  return _$_.tsrx_element(() => {
449
- let lazy_9 = _$_.track(['One', 'Two', 'Three'], 'ee47f078');
441
+ const items = _$_.track(['One', 'Two', 'Three'], 'ee47f078');
450
442
 
451
443
  _$_.regular_block(() => {
452
444
  let __out = '';
453
445
 
454
446
  __out += '<button class="clear">Clear</button><ul class="list"><!--[-->';
455
447
 
456
- for (const item of lazy_9.value) {
448
+ for (const item of items.value) {
457
449
  __out += '<li>';
458
450
 
459
451
  {
@@ -473,7 +465,7 @@ export function ForLoopPopulatedToEmpty() {
473
465
 
474
466
  export function NestedForLoopReactive() {
475
467
  return _$_.tsrx_element(() => {
476
- let lazy_10 = _$_.track([[1, 2], [3, 4]], 'a2f41fb3');
468
+ const grid = _$_.track([[1, 2], [3, 4]], 'a2f41fb3');
477
469
 
478
470
  _$_.regular_block(() => {
479
471
  let __out = '';
@@ -485,7 +477,7 @@ export function NestedForLoopReactive() {
485
477
 
486
478
  var rowIndex = 0;
487
479
 
488
- for (const row of lazy_10.value) {
480
+ for (const row of grid.value) {
489
481
  __out += '<div' + _$_.attr('class', `row-${rowIndex}`) + '>';
490
482
 
491
483
  {
@@ -594,7 +586,7 @@ export function ForLoopDeeplyNested() {
594
586
 
595
587
  export function ForLoopIndexUpdate() {
596
588
  return _$_.tsrx_element(() => {
597
- let lazy_11 = _$_.track(['First', 'Second', 'Third'], 'f61e31e6');
589
+ const items = _$_.track(['First', 'Second', 'Third'], 'f61e31e6');
598
590
 
599
591
  _$_.regular_block(() => {
600
592
  let __out = '';
@@ -606,7 +598,7 @@ export function ForLoopIndexUpdate() {
606
598
 
607
599
  var i = 0;
608
600
 
609
- for (const item of lazy_11.value) {
601
+ for (const item of items.value) {
610
602
  __out += '<li' + _$_.attr('class', `item-${i}`) + '>' + _$_.escape(`[${i}] ${item}`) + '</li>';
611
603
  i++;
612
604
  }
@@ -622,7 +614,7 @@ export function ForLoopIndexUpdate() {
622
614
 
623
615
  export function KeyedForLoopWithIndex() {
624
616
  return _$_.tsrx_element(() => {
625
- let lazy_12 = _$_.track(
617
+ const items = _$_.track(
626
618
  [
627
619
  { id: 'a', value: 'Alpha' },
628
620
  { id: 'b', value: 'Beta' },
@@ -641,7 +633,7 @@ export function KeyedForLoopWithIndex() {
641
633
 
642
634
  var i = 0;
643
635
 
644
- for (const item of lazy_12.value) {
636
+ for (const item of items.value) {
645
637
  __out += '<li' + _$_.attr('data-index', i, false) + _$_.attr('class', `item-${item.id}`) + '>' + _$_.escape(`[${i}] ${item.id}: ${item.value}`) + '</li>';
646
638
  i++;
647
639
  }
@@ -657,14 +649,14 @@ export function KeyedForLoopWithIndex() {
657
649
 
658
650
  export function ForLoopWithSiblings() {
659
651
  return _$_.tsrx_element(() => {
660
- let lazy_13 = _$_.track(['A', 'B'], '3c7e8152');
652
+ const items = _$_.track(['A', 'B'], '3c7e8152');
661
653
 
662
654
  _$_.regular_block(() => {
663
655
  let __out = '';
664
656
 
665
657
  __out += '<div class="wrapper"><header class="before">Before</header><!--[-->';
666
658
 
667
- for (const item of lazy_13.value) {
659
+ for (const item of items.value) {
668
660
  __out += '<div' + _$_.attr('class', `item-${item}`) + '>';
669
661
 
670
662
  {
@@ -714,12 +706,12 @@ export function ForLoopItemState() {
714
706
 
715
707
  function TodoItem(props) {
716
708
  return _$_.tsrx_element(() => {
717
- let lazy_14 = _$_.track(false, '4f2402a4');
709
+ const done = _$_.track(false, '4f2402a4');
718
710
 
719
711
  _$_.regular_block(() => {
720
712
  let __out = '';
721
713
 
722
- __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>';
723
715
  _$_.output_push(__out);
724
716
  });
725
717
  });
@@ -754,14 +746,14 @@ export function ForLoopSingleItem() {
754
746
 
755
747
  export function ForLoopAddAtBeginning() {
756
748
  return _$_.tsrx_element(() => {
757
- let lazy_15 = _$_.track(['B', 'C'], '1561403a');
749
+ const items = _$_.track(['B', 'C'], '1561403a');
758
750
 
759
751
  _$_.regular_block(() => {
760
752
  let __out = '';
761
753
 
762
754
  __out += '<button class="prepend">Prepend A</button><ul><!--[-->';
763
755
 
764
- for (const item of lazy_15.value) {
756
+ for (const item of items.value) {
765
757
  __out += '<li' + _$_.attr('class', `item-${item}`) + '>';
766
758
 
767
759
  {
@@ -781,14 +773,14 @@ export function ForLoopAddAtBeginning() {
781
773
 
782
774
  export function ForLoopAddInMiddle() {
783
775
  return _$_.tsrx_element(() => {
784
- let lazy_16 = _$_.track(['A', 'C'], '1bc60b46');
776
+ const items = _$_.track(['A', 'C'], '1bc60b46');
785
777
 
786
778
  _$_.regular_block(() => {
787
779
  let __out = '';
788
780
 
789
781
  __out += '<button class="insert">Insert B</button><ul><!--[-->';
790
782
 
791
- for (const item of lazy_16.value) {
783
+ for (const item of items.value) {
792
784
  __out += '<li' + _$_.attr('class', `item-${item}`) + '>';
793
785
 
794
786
  {
@@ -808,14 +800,14 @@ export function ForLoopAddInMiddle() {
808
800
 
809
801
  export function ForLoopRemoveFromMiddle() {
810
802
  return _$_.tsrx_element(() => {
811
- let lazy_17 = _$_.track(['A', 'B', 'C'], '1c87f95f');
803
+ const items = _$_.track(['A', 'B', 'C'], '1c87f95f');
812
804
 
813
805
  _$_.regular_block(() => {
814
806
  let __out = '';
815
807
 
816
808
  __out += '<button class="remove-middle">Remove B</button><ul><!--[-->';
817
809
 
818
- for (const item of lazy_17.value) {
810
+ for (const item of items.value) {
819
811
  __out += '<li' + _$_.attr('class', `item-${item}`) + '>';
820
812
 
821
813
  {
@@ -871,14 +863,14 @@ export function ForLoopLargeList() {
871
863
 
872
864
  export function ForLoopSwap() {
873
865
  return _$_.tsrx_element(() => {
874
- let lazy_18 = _$_.track(['A', 'B', 'C', 'D'], '5f8d152f');
866
+ const items = _$_.track(['A', 'B', 'C', 'D'], '5f8d152f');
875
867
 
876
868
  _$_.regular_block(() => {
877
869
  let __out = '';
878
870
 
879
871
  __out += '<button class="swap">Swap First and Last</button><ul><!--[-->';
880
872
 
881
- for (const item of lazy_18.value) {
873
+ for (const item of items.value) {
882
874
  __out += '<li' + _$_.attr('class', `item-${item}`) + '>';
883
875
 
884
876
  {
@@ -898,14 +890,14 @@ export function ForLoopSwap() {
898
890
 
899
891
  export function ForLoopReverse() {
900
892
  return _$_.tsrx_element(() => {
901
- let lazy_19 = _$_.track(['A', 'B', 'C', 'D'], '24602e64');
893
+ const items = _$_.track(['A', 'B', 'C', 'D'], '24602e64');
902
894
 
903
895
  _$_.regular_block(() => {
904
896
  let __out = '';
905
897
 
906
898
  __out += '<button class="reverse">Reverse</button><ul><!--[-->';
907
899
 
908
- for (const item of lazy_19.value) {
900
+ for (const item of items.value) {
909
901
  __out += '<li' + _$_.attr('class', `item-${item}`) + '>';
910
902
 
911
903
  {
@@ -921,4 +913,72 @@ export function ForLoopReverse() {
921
913
  _$_.output_push(__out);
922
914
  });
923
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
+ });
924
984
  }