ripple 0.4.3 → 0.4.4

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 (38) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/package.json +3 -3
  3. package/src/constants.js +6 -0
  4. package/src/runtime/internal/client/attributes.js +251 -125
  5. package/src/runtime/internal/client/blocks.js +16 -6
  6. package/src/runtime/internal/client/composite.js +292 -100
  7. package/src/runtime/internal/client/constants.js +8 -0
  8. package/src/runtime/internal/client/expression.js +4 -4
  9. package/src/runtime/internal/client/for.js +13 -38
  10. package/src/runtime/internal/client/if.js +56 -1
  11. package/src/runtime/internal/client/index.js +6 -6
  12. package/src/runtime/internal/client/runtime.js +73 -11
  13. package/src/runtime/internal/client/template-ns.js +45 -4
  14. package/src/runtime/internal/client/template.js +56 -0
  15. package/tests/client/composite/composite.dynamic-components.test.tsrx +40 -0
  16. package/tests/client/css/scoped-styles.test.tsrx +3 -1
  17. package/tests/client/svg.test.tsrx +273 -1
  18. package/tests/hydration/compiled/client/basic.js +36 -35
  19. package/tests/hydration/compiled/client/composite.js +11 -2
  20. package/tests/hydration/compiled/client/events.js +1 -1
  21. package/tests/hydration/compiled/client/for.js +73 -62
  22. package/tests/hydration/compiled/client/fragment-cursor.js +182 -115
  23. package/tests/hydration/compiled/client/head.js +10 -10
  24. package/tests/hydration/compiled/client/hmr.js +11 -2
  25. package/tests/hydration/compiled/client/html-in-template.js +1 -1
  26. package/tests/hydration/compiled/client/html.js +78 -50
  27. package/tests/hydration/compiled/client/if-children.js +94 -26
  28. package/tests/hydration/compiled/client/if-fragment-controlflow.js +34 -14
  29. package/tests/hydration/compiled/client/if.js +65 -17
  30. package/tests/hydration/compiled/client/mixed-control-flow.js +50 -20
  31. package/tests/hydration/compiled/client/nested-control-flow.js +188 -97
  32. package/tests/hydration/compiled/client/portal.js +14 -5
  33. package/tests/hydration/compiled/client/reactivity.js +3 -3
  34. package/tests/hydration/compiled/client/streaming.js +17 -17
  35. package/tests/hydration/compiled/client/switch.js +17 -17
  36. package/tests/hydration/compiled/client/track-async-serialization.js +19 -19
  37. package/tests/hydration/compiled/client/try.js +9 -9
  38. package/tests/hydration/compiled/client/typed-text.js +3 -2
@@ -22,6 +22,14 @@ function if_1({ a: expanded, b: children }) {
22
22
 
23
23
  var root = _$_.template(`<div class=container><div role=button class=header>Toggle`);
24
24
 
25
+ function render(__prev) {
26
+ var __a = if_1({ a: __prev._a, b: __prev._b });
27
+
28
+ if (__prev.a !== __a) {
29
+ _$_.if_update(__prev._c, __prev.a = __a);
30
+ }
31
+ }
32
+
25
33
  function IfWithChildren_render(__anchor, __block, { children }) {
26
34
  const expanded = _$_.track(true, __block, '1j0jg6p');
27
35
  var div = root();
@@ -32,17 +40,18 @@ function IfWithChildren_render(__anchor, __block, { children }) {
32
40
  div_1.__click = () => expanded.value = !expanded.value;
33
41
 
34
42
  var node = _$_.hydrating ? _$_.hydrate_sibling() : _$_.append_into(div, true);
43
+ var ifs = _$_.if_static(node, if_1, 0, { a: expanded, b: children });
35
44
 
36
- _$_.if(node, if_1, false, { a: expanded, b: children });
37
45
  _$_.hydrating && _$_.pop(div);
38
46
  }
39
47
 
48
+ _$_.render(render, { a: _$_.UNINITIALIZED, _a: expanded, _b: children, _c: ifs });
40
49
  _$_.append(__anchor, div);
41
50
  }
42
51
 
43
52
  IfWithChildren[_$_.$r] = IfWithChildren_render;
44
53
 
45
- var root_2 = _$_.template(`<div class=item>`);
54
+ var root_2 = _$_.template_el('div', ['class', 'item']);
46
55
 
47
56
  function ChildItem_render(__anchor, __block, { text: label }) {
48
57
  var div_3 = root_2();
@@ -90,6 +99,14 @@ function if_2(expanded) {
90
99
 
91
100
  var root_4 = _$_.template(`<div class=container><div role=button class=header>Toggle`);
92
101
 
102
+ function render_1(__prev) {
103
+ var __a = if_2(__prev._a);
104
+
105
+ if (__prev.a !== __a) {
106
+ _$_.if_update(__prev._b, __prev.a = __a);
107
+ }
108
+ }
109
+
93
110
  function IfWithStaticChildren_render(__anchor, __block) {
94
111
  const expanded = _$_.track(true, __block, 'gkm3jr');
95
112
  var div_4 = root_4();
@@ -100,11 +117,12 @@ function IfWithStaticChildren_render(__anchor, __block) {
100
117
  div_5.__click = () => expanded.value = !expanded.value;
101
118
 
102
119
  var node_3 = _$_.hydrating ? _$_.hydrate_sibling() : _$_.append_into(div_4, true);
120
+ var ifs_1 = _$_.if_static(node_3, if_2, 0, expanded);
103
121
 
104
- _$_.if(node_3, if_2, false, expanded);
105
122
  _$_.hydrating && _$_.pop(div_4);
106
123
  }
107
124
 
125
+ _$_.render(render_1, { a: _$_.UNINITIALIZED, _a: expanded, _b: ifs_1 });
108
126
  _$_.append(__anchor, div_4);
109
127
  }
110
128
 
@@ -131,6 +149,14 @@ function if_3({ a: expanded, b: children }) {
131
149
 
132
150
  var root_6 = _$_.template(`<section class=group><div role=button class=item><div class=indicator></div><h2 class=text>Title</h2><div class=caret><svg xmlns=http://www.w3.org/2000/svg width=18 height=18 viewBox="0 0 24 24"><path d="m9 18 6-6-6-6">`);
133
151
 
152
+ function render_2(__prev) {
153
+ var __a = if_3({ a: __prev._a, b: __prev._b });
154
+
155
+ if (__prev.a !== __a) {
156
+ _$_.if_update(__prev._c, __prev.a = __a);
157
+ }
158
+ }
159
+
134
160
  function IfWithSiblingsAndChildren_render(__anchor, __block, { children }) {
135
161
  const expanded = _$_.track(true, __block, '18vegr0');
136
162
  var section = root_6();
@@ -145,10 +171,12 @@ function IfWithSiblingsAndChildren_render(__anchor, __block, { children }) {
145
171
  ? _$_.hydrate_sibling()
146
172
  : _$_.append_into(section, true);
147
173
 
148
- _$_.if(node_4, if_3, false, { a: expanded, b: children });
174
+ var ifs_2 = _$_.if_static(node_4, if_3, 0, { a: expanded, b: children });
175
+
149
176
  _$_.hydrating && _$_.pop(section);
150
177
  }
151
178
 
179
+ _$_.render(render_2, { a: _$_.UNINITIALIZED, _a: expanded, _b: children, _c: ifs_2 });
152
180
  _$_.append(__anchor, section);
153
181
  }
154
182
 
@@ -174,7 +202,7 @@ function TestIfWithSiblingsAndChildren_render(__anchor, __block) {
174
202
 
175
203
  TestIfWithSiblingsAndChildren[_$_.$r] = TestIfWithSiblingsAndChildren_render;
176
204
 
177
- var root_11 = _$_.template(`<div class=conditional>Conditional content`);
205
+ var root_11 = _$_.template_el('div', ['class', 'conditional'], 'Conditional content');
178
206
 
179
207
  function consequent_3(__anchor, show) {
180
208
  var div_11 = root_11();
@@ -187,6 +215,15 @@ function if_4(show) {
187
215
  }
188
216
 
189
217
  var root_10 = _$_.template(`<div class=wrapper><div class=nested-parent><div class=nested-child><span class=deep>Deep content</span></div></div></div><button class=toggle>Toggle`, 1, 2);
218
+
219
+ function render_3(__prev) {
220
+ var __a = if_4(__prev._a);
221
+
222
+ if (__prev.a !== __a) {
223
+ _$_.if_update(__prev._b, __prev.a = __a);
224
+ }
225
+ }
226
+
190
227
  var root_9 = _$_.template(`<!>`, 1, 1);
191
228
 
192
229
  function ElementWithChildrenThenIf_render(__anchor, __block) {
@@ -201,14 +238,15 @@ function ElementWithChildrenThenIf_render(__anchor, __block) {
201
238
  {
202
239
  var div_10 = _$_.hydrating ? _$_.hydrate_child() : div_9.firstChild;
203
240
  var node_7 = _$_.hydrating ? _$_.hydrate_sibling() : _$_.append_into(div_9, true);
241
+ var ifs_3 = _$_.if_static(node_7, if_4, 0, show);
204
242
 
205
- _$_.if(node_7, if_4, false, show);
206
243
  _$_.hydrating && _$_.pop(div_9);
207
244
  }
208
245
 
209
246
  var button = _$_.hydrating ? _$_.hydrate_sibling() : div_9.nextSibling;
210
247
 
211
248
  button.__click = () => show.value = !show.value;
249
+ _$_.render(render_3, { a: _$_.UNINITIALIZED, _a: show, _b: ifs_3 });
212
250
  _$_.append(__anchor, fragment_3);
213
251
  }));
214
252
 
@@ -217,7 +255,7 @@ function ElementWithChildrenThenIf_render(__anchor, __block) {
217
255
 
218
256
  ElementWithChildrenThenIf[_$_.$r] = ElementWithChildrenThenIf_render;
219
257
 
220
- var root_14 = _$_.template(`<footer class=footer>Footer`);
258
+ var root_14 = _$_.template_el('footer', ['class', 'footer'], 'Footer');
221
259
 
222
260
  function consequent_4(__anchor, visible) {
223
261
  var footer = root_14();
@@ -230,6 +268,15 @@ function if_5(visible) {
230
268
  }
231
269
 
232
270
  var root_13 = _$_.template(`<section class=outer><article class=middle><div class=inner><p class=leaf><strong>Bold</strong><em>Italic</em></p></div></article></section><button class=btn>Toggle`, 1, 2);
271
+
272
+ function render_4(__prev) {
273
+ var __a = if_5(__prev._a);
274
+
275
+ if (__prev.a !== __a) {
276
+ _$_.if_update(__prev._b, __prev.a = __a);
277
+ }
278
+ }
279
+
233
280
  var root_12 = _$_.template(`<!>`, 1, 1);
234
281
 
235
282
  function DeepNestingThenIf_render(__anchor, __block) {
@@ -248,13 +295,15 @@ function DeepNestingThenIf_render(__anchor, __block) {
248
295
  ? _$_.hydrate_sibling()
249
296
  : _$_.append_into(section_1, true);
250
297
 
251
- _$_.if(node_9, if_5, false, visible);
298
+ var ifs_4 = _$_.if_static(node_9, if_5, 0, visible);
299
+
252
300
  _$_.hydrating && _$_.pop(section_1);
253
301
  }
254
302
 
255
303
  var button_1 = _$_.hydrating ? _$_.hydrate_sibling() : section_1.nextSibling;
256
304
 
257
305
  button_1.__click = () => visible.value = !visible.value;
306
+ _$_.render(render_4, { a: _$_.UNINITIALIZED, _a: visible, _b: ifs_4 });
258
307
  _$_.append(__anchor, fragment_5);
259
308
  }));
260
309
 
@@ -264,7 +313,7 @@ function DeepNestingThenIf_render(__anchor, __block) {
264
313
  DeepNestingThenIf[_$_.$r] = DeepNestingThenIf_render;
265
314
 
266
315
  var root_16 = _$_.template(`<pre class=code>const x = 1;`);
267
- var root_17 = _$_.template(`<div class=preview>Preview content`);
316
+ var root_17 = _$_.template_el('div', ['class', 'preview'], 'Preview content');
268
317
 
269
318
  function consequent_5(__anchor, activeTab) {
270
319
  var pre = root_16();
@@ -284,17 +333,24 @@ function if_6(activeTab) {
284
333
 
285
334
  var root_15 = _$_.template(`<div class=tabs><div class=tab-list><button class=tab>Code</button><button class=tab>Preview</button></div><div class=panel><!>`);
286
335
 
287
- function render(__prev) {
288
- var __a = __prev._a.value === 'code' ? 'true' : 'false';
336
+ function render_5(__prev) {
337
+ var __activeTab_value = __prev._a.value;
338
+ var __a = __activeTab_value === 'code' ? 'true' : 'false';
289
339
 
290
340
  if (__prev.a !== __a) {
291
- _$_.set_attribute(__prev._b, 'aria-selected', __prev.a = __a);
341
+ __prev._b.setAttribute('aria-selected', __prev.a = __a);
292
342
  }
293
343
 
294
- var __b = __prev._a.value === 'preview' ? 'true' : 'false';
344
+ var __b = __activeTab_value === 'preview' ? 'true' : 'false';
295
345
 
296
346
  if (__prev.b !== __b) {
297
- _$_.set_attribute(__prev._c, 'aria-selected', __prev.b = __b);
347
+ __prev._c.setAttribute('aria-selected', __prev.b = __b);
348
+ }
349
+
350
+ var __c = if_6(__prev._a);
351
+
352
+ if (__prev.c !== __c) {
353
+ _$_.if_update(__prev._d, __prev.c = __c);
298
354
  }
299
355
  }
300
356
 
@@ -321,18 +377,20 @@ function DomElementChildrenThenSibling_render(__anchor, __block) {
321
377
 
322
378
  {
323
379
  var node_11 = _$_.hydrating ? _$_.hydrate_child() : div_14.firstChild;
380
+ var ifs_5 = _$_.if_static(node_11, if_6, 0, activeTab);
324
381
 
325
- _$_.if(node_11, if_6, false, activeTab);
326
382
  _$_.hydrating && _$_.pop(div_14);
327
383
  }
328
384
  }
329
385
 
330
- _$_.render(render, {
386
+ _$_.render(render_5, {
331
387
  a: void 0,
332
388
  b: void 0,
389
+ c: _$_.UNINITIALIZED,
333
390
  _a: activeTab,
334
391
  _b: button_2,
335
- _c: button_3
392
+ _c: button_3,
393
+ _d: ifs_5
336
394
  });
337
395
 
338
396
  _$_.append(__anchor, div_12);
@@ -342,7 +400,7 @@ DomElementChildrenThenSibling[_$_.$r] = DomElementChildrenThenSibling_render;
342
400
 
343
401
  var root_19 = _$_.template(`<div class=container><ul class=list><li class=item></li><li class=item>Another item</li></ul><h2 class=heading>Static Heading</h2><p class=para>Static paragraph</p></div><button class=inc>Increment`, 1, 2);
344
402
 
345
- function render_1(__prev) {
403
+ function render_6(__prev) {
346
404
  var __a = 'Item count: ' + String(__prev._a.value ?? '');
347
405
 
348
406
  if (__prev.a !== __a) {
@@ -377,7 +435,7 @@ function DomChildrenThenStaticSiblings_render(__anchor, __block) {
377
435
  var button_4 = _$_.hydrating ? _$_.hydrate_sibling() : div_16.nextSibling;
378
436
 
379
437
  button_4.__click = () => count.value++;
380
- _$_.render(render_1, { a: '', _a: count, _b: li });
438
+ _$_.render(render_6, { a: '', _a: count, _b: li });
381
439
  _$_.append(__anchor, fragment_7);
382
440
  }));
383
441
 
@@ -396,8 +454,8 @@ function StaticListThenStaticSiblings_render(__anchor, __block) {
396
454
 
397
455
  StaticListThenStaticSiblings[_$_.$r] = StaticListThenStaticSiblings_render;
398
456
 
399
- var root_21 = _$_.template(`<span class=root-if>on`);
400
- var root_22 = _$_.template(`<span class=root-if>off`);
457
+ var root_21 = _$_.template_el('span', ['class', 'root-if'], 'on');
458
+ var root_22 = _$_.template_el('span', ['class', 'root-if'], 'off');
401
459
 
402
460
  function consequent_6(__anchor, props) {
403
461
  var span = root_21();
@@ -415,15 +473,25 @@ function if_7(props) {
415
473
  if (props.on.value) return consequent_6; else return alternate_1;
416
474
  }
417
475
 
476
+ function render_7(__prev) {
477
+ var __a = if_7(__prev._a);
478
+
479
+ if (__prev.a !== __a) {
480
+ _$_.if_update(__prev._b, __prev.a = __a);
481
+ }
482
+ }
483
+
418
484
  function RootIfChild_render(__anchor, __block, props) {
419
- _$_.if(__anchor, if_7, true, props);
485
+ var ifs_6 = _$_.if_static(__anchor, if_7, 1, props);
486
+
487
+ _$_.render(render_7, { a: _$_.UNINITIALIZED, _a: props, _b: ifs_6 });
420
488
  }
421
489
 
422
490
  RootIfChild[_$_.$r] = RootIfChild_render;
423
491
 
424
- var root_23 = _$_.template(`<span class=root-for>`);
492
+ var root_23 = _$_.template_el('span', ['class', 'root-for']);
425
493
 
426
- function render_2(__prev) {
494
+ function render_8(__prev) {
427
495
  var __a = __prev.$item;
428
496
 
429
497
  if (__prev.a !== __a) {
@@ -446,13 +514,13 @@ function RootForChild_render(__anchor, __block, props) {
446
514
  void 0,
447
515
  void 0,
448
516
  void 0,
449
- render_2
517
+ render_8
450
518
  );
451
519
  }
452
520
 
453
521
  RootForChild[_$_.$r] = RootForChild_render;
454
522
 
455
- var root_24 = _$_.template(`<span class=trailing>end`);
523
+ var root_24 = _$_.template_el('span', ['class', 'trailing'], 'end');
456
524
 
457
525
  function TrailingChild_render(__anchor, __block) {
458
526
  var span_3 = root_24();
@@ -1,7 +1,7 @@
1
1
  // @ts-nocheck
2
2
  import * as _$_ from 'ripple/internal/client';
3
3
 
4
- var root_2 = _$_.template(`<p class=muze> `);
4
+ var root_2 = _$_.template_el('p', ['class', 'muze'], ' ');
5
5
  var root_1 = _$_.template(`<!><span class=after>after`, 1, 2);
6
6
 
7
7
  function consequent(__anchor, { a: hasLoaded, b: muzes }) {
@@ -54,8 +54,8 @@ function IfFragmentForElement_render(__anchor, __block) {
54
54
 
55
55
  IfFragmentForElement[_$_.$r] = IfFragmentForElement_render;
56
56
 
57
- var root_5 = _$_.template(`<p class=muze> `);
58
- var root_6 = _$_.template(`<span class=has-items>has items`);
57
+ var root_5 = _$_.template_el('p', ['class', 'muze'], ' ');
58
+ var root_6 = _$_.template_el('span', ['class', 'has-items'], 'has items');
59
59
 
60
60
  function consequent_1(__anchor, muzes) {
61
61
  var span = root_6();
@@ -67,7 +67,7 @@ function if_2(muzes) {
67
67
  if (muzes.length > 0) return consequent_1;
68
68
  }
69
69
 
70
- var root_7 = _$_.template(`<span class=empty>empty`);
70
+ var root_7 = _$_.template_el('span', ['class', 'empty'], 'empty');
71
71
 
72
72
  function consequent_2(__anchor, muzes) {
73
73
  var span_1 = root_7();
@@ -81,6 +81,20 @@ function if_3(muzes) {
81
81
 
82
82
  var root_4 = _$_.template(`<!><!><!>`, 1, 3);
83
83
 
84
+ function render(__prev) {
85
+ var __a = if_2(__prev._a);
86
+
87
+ if (__prev.a !== __a) {
88
+ _$_.if_update(__prev._b, __prev.a = __a);
89
+ }
90
+
91
+ var __b = if_3(__prev._a);
92
+
93
+ if (__prev.b !== __b) {
94
+ _$_.if_update(__prev._c, __prev.b = __b);
95
+ }
96
+ }
97
+
84
98
  function consequent_3(__anchor, { a: hasLoaded, b: muzes }) {
85
99
  var fragment_1 = root_4();
86
100
  var node_3 = _$_.first_child_frag(fragment_1);
@@ -105,12 +119,18 @@ function consequent_3(__anchor, { a: hasLoaded, b: muzes }) {
105
119
  );
106
120
 
107
121
  var node_4 = _$_.hydrating ? _$_.hydrate_sibling() : node_3.nextSibling;
108
-
109
- _$_.if(node_4, if_2, false, muzes);
110
-
122
+ var ifs = _$_.if_static(node_4, if_2, 0, muzes);
111
123
  var node_5 = _$_.hydrating ? _$_.hydrate_sibling() : node_4.nextSibling;
124
+ var ifs_1 = _$_.if_static(node_5, if_3, 0, muzes);
125
+
126
+ _$_.render(render, {
127
+ a: _$_.UNINITIALIZED,
128
+ b: _$_.UNINITIALIZED,
129
+ _a: muzes,
130
+ _b: ifs,
131
+ _c: ifs_1
132
+ });
112
133
 
113
- _$_.if(node_5, if_3, false, muzes);
114
134
  _$_.append(__anchor, fragment_1);
115
135
  }
116
136
 
@@ -168,7 +188,7 @@ function IfFragmentElements_render(__anchor, __block) {
168
188
 
169
189
  IfFragmentElements[_$_.$r] = IfFragmentElements_render;
170
190
 
171
- var root_12 = _$_.template(`<p class=muze> `);
191
+ var root_12 = _$_.template_el('p', ['class', 'muze'], ' ');
172
192
  var root_11 = _$_.template(`<!><span class=after>after`, 1, 2);
173
193
  var root_10 = _$_.template(`<!>`, 1, 1);
174
194
 
@@ -209,7 +229,7 @@ function ComponentBodyFragmentControlFlow_render(__anchor, __block) {
209
229
 
210
230
  ComponentBodyFragmentControlFlow[_$_.$r] = ComponentBodyFragmentControlFlow_render;
211
231
 
212
- var root_14 = _$_.template(`<p class=muze> `);
232
+ var root_14 = _$_.template_el('p', ['class', 'muze'], ' ');
213
233
  var root_15 = _$_.template(`<!><span class=after>after`, 1, 2);
214
234
  var root_13 = _$_.template(`<!>`, 1, 1);
215
235
 
@@ -254,7 +274,7 @@ function ComponentBodyCodeBlockControlFlow_render(__anchor, __block) {
254
274
 
255
275
  ComponentBodyCodeBlockControlFlow[_$_.$r] = ComponentBodyCodeBlockControlFlow_render;
256
276
 
257
- var root_17 = _$_.template(`<p class=muze> `);
277
+ var root_17 = _$_.template_el('p', ['class', 'muze'], ' ');
258
278
  var root_18 = _$_.template(`<!><span class=after>after`, 1, 2);
259
279
 
260
280
  function consequent_5(__anchor, { a: hasLoaded, b: muzes }) {
@@ -311,8 +331,8 @@ function IfCodeBlockControlFlow_render(__anchor, __block) {
311
331
 
312
332
  IfCodeBlockControlFlow[_$_.$r] = IfCodeBlockControlFlow_render;
313
333
 
314
- var root_20 = _$_.template(`<span class=loading>loading`);
315
- var root_22 = _$_.template(`<p class=muze> `);
334
+ var root_20 = _$_.template_el('span', ['class', 'loading'], 'loading');
335
+ var root_22 = _$_.template_el('p', ['class', 'muze'], ' ');
316
336
  var root_21 = _$_.template(`<!><span class=after>after`, 1, 2);
317
337
 
318
338
  function consequent_6(__anchor, { a: hasLoaded, b: muzes }) {
@@ -371,7 +391,7 @@ function IfElseFragment_render(__anchor, __block) {
371
391
 
372
392
  IfElseFragment[_$_.$r] = IfElseFragment_render;
373
393
 
374
- var root_25 = _$_.template(`<p class=muze> `);
394
+ var root_25 = _$_.template_el('p', ['class', 'muze'], ' ');
375
395
  var root_24 = _$_.template(`<section><span class=after>after`);
376
396
 
377
397
  function consequent_7(__anchor, { a: hasLoaded, b: muzes }) {
@@ -1,7 +1,7 @@
1
1
  // @ts-nocheck
2
2
  import * as _$_ from 'ripple/internal/client';
3
3
 
4
- var root = _$_.template(`<div class=shown>Visible`);
4
+ var root = _$_.template_el('div', ['class', 'shown'], 'Visible');
5
5
 
6
6
  function consequent(__anchor, show) {
7
7
  var div = root();
@@ -21,7 +21,7 @@ function IfTruthy_render(__anchor, __block) {
21
21
 
22
22
  IfTruthy[_$_.$r] = IfTruthy_render;
23
23
 
24
- var root_1 = _$_.template(`<div class=shown>Visible`);
24
+ var root_1 = _$_.template_el('div', ['class', 'shown'], 'Visible');
25
25
 
26
26
  function consequent_1(__anchor, show) {
27
27
  var div_1 = root_1();
@@ -41,8 +41,8 @@ function IfFalsy_render(__anchor, __block) {
41
41
 
42
42
  IfFalsy[_$_.$r] = IfFalsy_render;
43
43
 
44
- var root_2 = _$_.template(`<div class=logged-in>Welcome back!`);
45
- var root_3 = _$_.template(`<div class=logged-out>Please log in`);
44
+ var root_2 = _$_.template_el('div', ['class', 'logged-in'], 'Welcome back!');
45
+ var root_3 = _$_.template_el('div', ['class', 'logged-out'], 'Please log in');
46
46
 
47
47
  function consequent_2(__anchor, isLoggedIn) {
48
48
  var div_2 = root_2();
@@ -68,7 +68,7 @@ function IfElse_render(__anchor, __block) {
68
68
 
69
69
  IfElse[_$_.$r] = IfElse_render;
70
70
 
71
- var root_6 = _$_.template(`<div class=content>Content visible`);
71
+ var root_6 = _$_.template_el('div', ['class', 'content'], 'Content visible');
72
72
 
73
73
  function consequent_3(__anchor, show) {
74
74
  var div_4 = root_6();
@@ -81,6 +81,15 @@ function if_4(show) {
81
81
  }
82
82
 
83
83
  var root_5 = _$_.template(`<button class=toggle>Toggle</button><!>`, 1, 2);
84
+
85
+ function render(__prev) {
86
+ var __a = if_4(__prev._a);
87
+
88
+ if (__prev.a !== __a) {
89
+ _$_.if_update(__prev._b, __prev.a = __a);
90
+ }
91
+ }
92
+
84
93
  var root_4 = _$_.template(`<!>`, 1, 1);
85
94
 
86
95
  function ReactiveIf_render(__anchor, __block) {
@@ -97,8 +106,9 @@ function ReactiveIf_render(__anchor, __block) {
97
106
  };
98
107
 
99
108
  var node = _$_.hydrating ? _$_.hydrate_sibling() : button.nextSibling;
109
+ var ifs = _$_.if_static(node, if_4, 0, show);
100
110
 
101
- _$_.if(node, if_4, false, show);
111
+ _$_.render(render, { a: _$_.UNINITIALIZED, _a: show, _b: ifs });
102
112
  _$_.append(__anchor, fragment_1);
103
113
  }));
104
114
 
@@ -107,8 +117,8 @@ function ReactiveIf_render(__anchor, __block) {
107
117
 
108
118
  ReactiveIf[_$_.$r] = ReactiveIf_render;
109
119
 
110
- var root_9 = _$_.template(`<div class=on>ON`);
111
- var root_10 = _$_.template(`<div class=off>OFF`);
120
+ var root_9 = _$_.template_el('div', ['class', 'on'], 'ON');
121
+ var root_10 = _$_.template_el('div', ['class', 'off'], 'OFF');
112
122
 
113
123
  function consequent_4(__anchor, isOn) {
114
124
  var div_5 = root_9();
@@ -127,6 +137,15 @@ function if_5(isOn) {
127
137
  }
128
138
 
129
139
  var root_8 = _$_.template(`<button class=toggle>Toggle</button><!>`, 1, 2);
140
+
141
+ function render_1(__prev) {
142
+ var __a = if_5(__prev._a);
143
+
144
+ if (__prev.a !== __a) {
145
+ _$_.if_update(__prev._b, __prev.a = __a);
146
+ }
147
+ }
148
+
130
149
  var root_7 = _$_.template(`<!>`, 1, 1);
131
150
 
132
151
  function ReactiveIfElse_render(__anchor, __block) {
@@ -143,8 +162,9 @@ function ReactiveIfElse_render(__anchor, __block) {
143
162
  };
144
163
 
145
164
  var node_2 = _$_.hydrating ? _$_.hydrate_sibling() : button_1.nextSibling;
165
+ var ifs_1 = _$_.if_static(node_2, if_5, 0, isOn);
146
166
 
147
- _$_.if(node_2, if_5, false, isOn);
167
+ _$_.render(render_1, { a: _$_.UNINITIALIZED, _a: isOn, _b: ifs_1 });
148
168
  _$_.append(__anchor, fragment_3);
149
169
  }));
150
170
 
@@ -153,7 +173,7 @@ function ReactiveIfElse_render(__anchor, __block) {
153
173
 
154
174
  ReactiveIfElse[_$_.$r] = ReactiveIfElse_render;
155
175
 
156
- var root_14 = _$_.template(`<span class=inner-content>Inner`);
176
+ var root_14 = _$_.template_el('span', ['class', 'inner-content'], 'Inner');
157
177
 
158
178
  function consequent_5(__anchor, inner) {
159
179
  var span = root_14();
@@ -165,7 +185,15 @@ function if_6(inner) {
165
185
  if (inner.value) return consequent_5;
166
186
  }
167
187
 
168
- var root_13 = _$_.template(`<div class=outer-content>Outer`);
188
+ var root_13 = _$_.template_el('div', ['class', 'outer-content'], 'Outer');
189
+
190
+ function render_2(__prev) {
191
+ var __a = if_6(__prev._a);
192
+
193
+ if (__prev.a !== __a) {
194
+ _$_.if_update(__prev._b, __prev.a = __a);
195
+ }
196
+ }
169
197
 
170
198
  function consequent_6(__anchor, { a: outer, b: inner }) {
171
199
  var div_7 = root_13();
@@ -173,11 +201,12 @@ function consequent_6(__anchor, { a: outer, b: inner }) {
173
201
  {
174
202
  var expression = _$_.hydrating ? _$_.hydrate_child() : div_7.firstChild;
175
203
  var node_5 = _$_.hydrating ? _$_.hydrate_sibling() : _$_.append_into(div_7, true);
204
+ var ifs_2 = _$_.if_static(node_5, if_6, 0, inner);
176
205
 
177
- _$_.if(node_5, if_6, false, inner);
178
206
  _$_.hydrating && _$_.pop(div_7);
179
207
  }
180
208
 
209
+ _$_.render(render_2, { a: _$_.UNINITIALIZED, _a: inner, _b: ifs_2 });
181
210
  _$_.append(__anchor, div_7);
182
211
  }
183
212
 
@@ -186,6 +215,15 @@ function if_7({ a: outer, b: inner }) {
186
215
  }
187
216
 
188
217
  var root_12 = _$_.template(`<button class=outer-toggle>Outer</button><button class=inner-toggle>Inner</button><!>`, 1, 3);
218
+
219
+ function render_3(__prev) {
220
+ var __a = if_7({ a: __prev._a, b: __prev._b });
221
+
222
+ if (__prev.a !== __a) {
223
+ _$_.if_update(__prev._c, __prev.a = __a);
224
+ }
225
+ }
226
+
189
227
  var root_11 = _$_.template(`<!>`, 1, 1);
190
228
 
191
229
  function NestedIf_render(__anchor, __block) {
@@ -209,8 +247,9 @@ function NestedIf_render(__anchor, __block) {
209
247
  };
210
248
 
211
249
  var node_4 = _$_.hydrating ? _$_.hydrate_sibling() : button_3.nextSibling;
250
+ var ifs_3 = _$_.if_static(node_4, if_7, 0, { a: outer, b: inner });
212
251
 
213
- _$_.if(node_4, if_7, false, { a: outer, b: inner });
252
+ _$_.render(render_3, { a: _$_.UNINITIALIZED, _a: outer, _b: inner, _c: ifs_3 });
214
253
  _$_.append(__anchor, fragment_5);
215
254
  }));
216
255
 
@@ -219,9 +258,9 @@ function NestedIf_render(__anchor, __block) {
219
258
 
220
259
  NestedIf[_$_.$r] = NestedIf_render;
221
260
 
222
- var root_16 = _$_.template(`<div class=state>Loading...`);
223
- var root_17 = _$_.template(`<div class=state>Success!`);
224
- var root_18 = _$_.template(`<div class=state>Error occurred`);
261
+ var root_16 = _$_.template_el('div', ['class', 'state'], 'Loading...');
262
+ var root_17 = _$_.template_el('div', ['class', 'state'], 'Success!');
263
+ var root_18 = _$_.template_el('div', ['class', 'state'], 'Error occurred');
225
264
 
226
265
  function consequent_7(__anchor, status) {
227
266
  var div_9 = root_16();
@@ -247,6 +286,14 @@ function if_8(status) {
247
286
 
248
287
  var root_15 = _$_.template(`<div><button class=success>Success</button><button class=error>Error</button><button class=loading>Loading`);
249
288
 
289
+ function render_4(__prev) {
290
+ var __a = if_8(__prev._a);
291
+
292
+ if (__prev.a !== __a) {
293
+ _$_.if_update(__prev._b, __prev.a = __a);
294
+ }
295
+ }
296
+
250
297
  function IfElseIfChain_render(__anchor, __block) {
251
298
  const status = _$_.track('loading', __block, 'l79qh6');
252
299
  var div_8 = root_15();
@@ -271,11 +318,12 @@ function IfElseIfChain_render(__anchor, __block) {
271
318
  };
272
319
 
273
320
  var node_7 = _$_.hydrating ? _$_.hydrate_sibling() : _$_.append_into(div_8, true);
321
+ var ifs_4 = _$_.if_static(node_7, if_8, 0, status);
274
322
 
275
- _$_.if(node_7, if_8, false, status);
276
323
  _$_.hydrating && _$_.pop(div_8);
277
324
  }
278
325
 
326
+ _$_.render(render_4, { a: _$_.UNINITIALIZED, _a: status, _b: ifs_4 });
279
327
  _$_.append(__anchor, div_8);
280
328
  }
281
329