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
@@ -1,7 +1,7 @@
1
1
  // @ts-nocheck
2
2
  import * as _$_ from 'ripple/internal/client';
3
3
 
4
- var root = _$_.template(`<div>Hello World`);
4
+ var root = _$_.template_el('div', null, 'Hello World');
5
5
 
6
6
  function StaticText_render(__anchor, __block) {
7
7
  var div = root();
@@ -59,7 +59,7 @@ function WithAttributes_render(__anchor, __block) {
59
59
 
60
60
  WithAttributes[_$_.$r] = WithAttributes_render;
61
61
 
62
- var root_6 = _$_.template(`<span class=child>Child content`);
62
+ var root_6 = _$_.template_el('span', ['class', 'child'], 'Child content');
63
63
 
64
64
  function ChildComponent_render(__anchor, __block) {
65
65
  var span = root_6();
@@ -69,7 +69,7 @@ function ChildComponent_render(__anchor, __block) {
69
69
 
70
70
  ChildComponent[_$_.$r] = ChildComponent_render;
71
71
 
72
- var root_7 = _$_.template(`<div class=parent>`);
72
+ var root_7 = _$_.template_el('div', ['class', 'parent']);
73
73
 
74
74
  function ParentWithChild_render(__anchor, __block) {
75
75
  var div_2 = root_7();
@@ -86,7 +86,7 @@ function ParentWithChild_render(__anchor, __block) {
86
86
 
87
87
  ParentWithChild[_$_.$r] = ParentWithChild_render;
88
88
 
89
- var root_8 = _$_.template(`<div class=first>First`);
89
+ var root_8 = _$_.template_el('div', ['class', 'first'], 'First');
90
90
 
91
91
  function FirstSibling_render(__anchor, __block) {
92
92
  var div_3 = root_8();
@@ -96,7 +96,7 @@ function FirstSibling_render(__anchor, __block) {
96
96
 
97
97
  FirstSibling[_$_.$r] = FirstSibling_render;
98
98
 
99
- var root_9 = _$_.template(`<div class=second>Second`);
99
+ var root_9 = _$_.template_el('div', ['class', 'second'], 'Second');
100
100
 
101
101
  function SecondSibling_render(__anchor, __block) {
102
102
  var div_4 = root_9();
@@ -130,7 +130,7 @@ function SiblingComponents_render(__anchor, __block) {
130
130
 
131
131
  SiblingComponents[_$_.$r] = SiblingComponents_render;
132
132
 
133
- var root_12 = _$_.template(`<div>`);
133
+ var root_12 = _$_.template_el('div');
134
134
 
135
135
  function render(__prev) {
136
136
  var __a = 'Hello ' + __prev._a.name;
@@ -190,7 +190,7 @@ function ExpressionContent_render(__anchor, __block) {
190
190
 
191
191
  ExpressionContent[_$_.$r] = ExpressionContent_render;
192
192
 
193
- var root_15 = _$_.template(`<div class=helper-item>`);
193
+ var root_15 = _$_.template_el('div', ['class', 'helper-item']);
194
194
 
195
195
  function NestedHelperItem_render(__anchor, __block, { item }) {
196
196
  var div_7 = root_15();
@@ -238,7 +238,7 @@ function NestedTsxTsrxFragment_render(__anchor, __block, { label }) {
238
238
 
239
239
  NestedTsxTsrxFragment[_$_.$r] = NestedTsxTsrxFragment_render;
240
240
 
241
- var root_19 = _$_.template(`<div class=app-item> `);
241
+ var root_19 = _$_.template_el('div', ['class', 'app-item'], ' ');
242
242
  var root_18 = _$_.template(`<div class=nested-expression-values><!>`);
243
243
 
244
244
  function NestedTsxTsrxExpressionValues_render(__anchor, __block) {
@@ -276,8 +276,8 @@ function NestedTsxTsrxExpressionValues_render(__anchor, __block) {
276
276
 
277
277
  NestedTsxTsrxExpressionValues[_$_.$r] = NestedTsxTsrxExpressionValues_render;
278
278
 
279
- var root_20 = _$_.template(`<strong class=middle>beta`);
280
- var root_21 = _$_.template(`<em class=tail>epsilon`);
279
+ var root_20 = _$_.template_el('strong', ['class', 'middle'], 'beta');
280
+ var root_21 = _$_.template_el('em', ['class', 'tail'], 'epsilon');
281
281
  var root_22 = _$_.template(` `, 1, 1);
282
282
  var root_23 = _$_.template(`<div class=mixed-collection><!>`);
283
283
 
@@ -322,8 +322,8 @@ function MixedTsrxCollectionText_render(__anchor, __block) {
322
322
 
323
323
  MixedTsrxCollectionText[_$_.$r] = MixedTsrxCollectionText_render;
324
324
 
325
- var root_24 = _$_.template(`<strong class=middle>beta`);
326
- var root_25 = _$_.template(`<em class=tail>epsilon`);
325
+ var root_24 = _$_.template_el('strong', ['class', 'middle'], 'beta');
326
+ var root_25 = _$_.template_el('em', ['class', 'tail'], 'epsilon');
327
327
  var root_26 = _$_.template(` `, 1, 1);
328
328
  var root_27 = _$_.template(`<div class=mixed-collection-split><!>`);
329
329
 
@@ -368,8 +368,8 @@ function MixedTsrxCollectionSplitServerText_render(__anchor, __block) {
368
368
 
369
369
  MixedTsrxCollectionSplitServerText[_$_.$r] = MixedTsrxCollectionSplitServerText_render;
370
370
 
371
- var root_28 = _$_.template(`<strong class=middle>beta`);
372
- var root_29 = _$_.template(`<em class=tail>epsilon`);
371
+ var root_28 = _$_.template_el('strong', ['class', 'middle'], 'beta');
372
+ var root_29 = _$_.template_el('em', ['class', 'tail'], 'epsilon');
373
373
  var root_30 = _$_.template(` `, 1, 1);
374
374
  var root_31 = _$_.template(`<div class=mixed-collection-split><!>`);
375
375
 
@@ -414,7 +414,7 @@ function MixedTsrxCollectionSplitClientText_render(__anchor, __block) {
414
414
 
415
415
  MixedTsrxCollectionSplitClientText[_$_.$r] = MixedTsrxCollectionSplitClientText_render;
416
416
 
417
- var root_32 = _$_.template(`<span class=primitive-tail> ok`);
417
+ var root_32 = _$_.template_el('span', ['class', 'primitive-tail'], ' ok');
418
418
  var root_33 = _$_.template(` `, 1, 1);
419
419
  var root_34 = _$_.template(`<div class=mixed-collection-primitive><!>`);
420
420
 
@@ -452,7 +452,7 @@ function MixedTsrxCollectionPrimitiveServerText_render(__anchor, __block) {
452
452
 
453
453
  MixedTsrxCollectionPrimitiveServerText[_$_.$r] = MixedTsrxCollectionPrimitiveServerText_render;
454
454
 
455
- var root_35 = _$_.template(`<span class=primitive-tail> ok`);
455
+ var root_35 = _$_.template_el('span', ['class', 'primitive-tail'], ' ok');
456
456
  var root_36 = _$_.template(` `, 1, 1);
457
457
  var root_37 = _$_.template(`<div class=mixed-collection-primitive><!>`);
458
458
 
@@ -490,7 +490,7 @@ function MixedTsrxCollectionPrimitiveClientText_render(__anchor, __block) {
490
490
 
491
491
  MixedTsrxCollectionPrimitiveClientText[_$_.$r] = MixedTsrxCollectionPrimitiveClientText_render;
492
492
 
493
- var root_38 = _$_.template(`<div class=dynamic-array-call> `);
493
+ var root_38 = _$_.template_el('div', ['class', 'dynamic-array-call'], ' ');
494
494
 
495
495
  function DynamicArrayFromCall_render(__anchor, __block) {
496
496
  const items = _$_.with_scope(__block, createPrimitiveItems);
@@ -508,7 +508,7 @@ function DynamicArrayFromCall_render(__anchor, __block) {
508
508
 
509
509
  DynamicArrayFromCall[_$_.$r] = DynamicArrayFromCall_render;
510
510
 
511
- var root_39 = _$_.template(`<div class=dynamic-array-track> `);
511
+ var root_39 = _$_.template_el('div', ['class', 'dynamic-array-track'], ' ');
512
512
 
513
513
  function DynamicArrayFromTrack_render(__anchor, __block) {
514
514
  const items = _$_.track(['start:', ['one', 2], true, null, false, ':end'], __block, '1egmw3m');
@@ -526,7 +526,7 @@ function DynamicArrayFromTrack_render(__anchor, __block) {
526
526
 
527
527
  DynamicArrayFromTrack[_$_.$r] = DynamicArrayFromTrack_render;
528
528
 
529
- var root_40 = _$_.template(`<div class=dynamic-array-conditional> `);
529
+ var root_40 = _$_.template_el('div', ['class', 'dynamic-array-conditional'], ' ');
530
530
 
531
531
  function DynamicArrayFromConditional_render(__anchor, __block) {
532
532
  const condition = true;
@@ -549,7 +549,7 @@ function DynamicArrayFromConditional_render(__anchor, __block) {
549
549
 
550
550
  DynamicArrayFromConditional[_$_.$r] = DynamicArrayFromConditional_render;
551
551
 
552
- var root_41 = _$_.template(`<div class=dynamic-array-logical> `);
552
+ var root_41 = _$_.template_el('div', ['class', 'dynamic-array-logical'], ' ');
553
553
 
554
554
  function DynamicArrayFromLogical_render(__anchor, __block) {
555
555
  const condition = true;
@@ -622,8 +622,8 @@ function NestedTsrxElementsInsideTopLevelTsxValue_render(__anchor, __block) {
622
622
 
623
623
  NestedTsrxElementsInsideTopLevelTsxValue[_$_.$r] = NestedTsrxElementsInsideTopLevelTsxValue_render;
624
624
 
625
- var root_48 = _$_.template(`<span class=nested-tsx>inside nested tsx`);
626
- var root_49 = _$_.template(`<div class=native> `);
625
+ var root_48 = _$_.template_el('span', ['class', 'nested-tsx'], 'inside nested tsx');
626
+ var root_49 = _$_.template_el('div', ['class', 'native'], ' ');
627
627
  var root_51 = _$_.template(`<!>`, 1, 1);
628
628
  var root_50 = _$_.template(`<!>`, 1, 1);
629
629
 
@@ -663,7 +663,7 @@ function TsxDeclaredBeforeTopLevelTsx_render(__anchor, __block) {
663
663
 
664
664
  TsxDeclaredBeforeTopLevelTsx[_$_.$r] = TsxDeclaredBeforeTopLevelTsx_render;
665
665
 
666
- var root_52 = _$_.template(`<div class=text-prop> `);
666
+ var root_52 = _$_.template_el('div', ['class', 'text-prop'], ' ');
667
667
 
668
668
  function TextProp_render(__anchor, __block, { children }) {
669
669
  var div_21 = root_52();
@@ -680,7 +680,7 @@ function TextProp_render(__anchor, __block, { children }) {
680
680
 
681
681
  TextProp[_$_.$r] = TextProp_render;
682
682
 
683
- var root_53 = _$_.template(`<div class=text-prop>`);
683
+ var root_53 = _$_.template_el('div', ['class', 'text-prop']);
684
684
 
685
685
  function render_1(__prev) {
686
686
  var __a = __prev._a.value;
@@ -826,7 +826,7 @@ function Header_render(__anchor, __block) {
826
826
 
827
827
  Header[_$_.$r] = Header_render;
828
828
 
829
- var root_65 = _$_.template(`<a href=/playground class=playground-link>Playground`);
829
+ var root_65 = _$_.template_el('a', ['href', '/playground', 'class', 'playground-link'], 'Playground');
830
830
  var root_64 = _$_.template(`<div class=social-links><a href=https://github.com class=github-link>GitHub</a><a href=https://discord.com class=discord-link>Discord</a><!>`);
831
831
 
832
832
  function Actions_render(__anchor, __block, { playgroundVisible = false }) {
@@ -912,7 +912,7 @@ function WebsiteIndex_render(__anchor, __block) {
912
912
 
913
913
  WebsiteIndex[_$_.$r] = WebsiteIndex_render;
914
914
 
915
- var root_69 = _$_.template(`<footer class=last-child>I am the last child`);
915
+ var root_69 = _$_.template_el('footer', ['class', 'last-child'], 'I am the last child');
916
916
 
917
917
  function LastChild_render(__anchor, __block) {
918
918
  var footer = root_69();
@@ -977,7 +977,7 @@ function NestedComponentAsLastSibling_render(__anchor, __block) {
977
977
 
978
978
  NestedComponentAsLastSibling[_$_.$r] = NestedComponentAsLastSibling_render;
979
979
 
980
- var root_73 = _$_.template(`<div>`);
980
+ var root_73 = _$_.template_el('div');
981
981
 
982
982
  function render_2(__prev) {
983
983
  var __a = "label: " + String(_$_.with_scope(__prev._a, fetchLabel));
@@ -997,7 +997,7 @@ function TextTailExpression_render(__anchor, __block) {
997
997
 
998
998
  TextTailExpression[_$_.$r] = TextTailExpression_render;
999
999
 
1000
- var root_74 = _$_.template(`<div>`);
1000
+ var root_74 = _$_.template_el('div');
1001
1001
 
1002
1002
  function render_3(__prev) {
1003
1003
  var __a = 'frag-' + String(_$_.with_scope(__prev._a, fetchLabel));
@@ -1052,7 +1052,7 @@ function OpaqueLead_render(__anchor, __block, props) {
1052
1052
 
1053
1053
  OpaqueLead[_$_.$r] = OpaqueLead_render;
1054
1054
 
1055
- var root_78 = _$_.template(`<div>`);
1055
+ var root_78 = _$_.template_el('div');
1056
1056
 
1057
1057
  function FragmentLeadsWithOpaqueValue_render(__anchor, __block) {
1058
1058
  var div_31 = root_78();
@@ -1099,7 +1099,7 @@ function PrimitiveCallLead_render(__anchor, __block) {
1099
1099
 
1100
1100
  PrimitiveCallLead[_$_.$r] = PrimitiveCallLead_render;
1101
1101
 
1102
- var root_81 = _$_.template(`<div>`);
1102
+ var root_81 = _$_.template_el('div');
1103
1103
 
1104
1104
  function FragmentLeadsWithPrimitiveCall_render(__anchor, __block) {
1105
1105
  var div_32 = root_81();
@@ -1119,7 +1119,8 @@ FragmentLeadsWithPrimitiveCall[_$_.$r] = FragmentLeadsWithPrimitiveCall_render;
1119
1119
  var root_83 = _$_.template(`<div class=primitive-calls></div><button>update`, 1, 2);
1120
1120
 
1121
1121
  function render_5(__prev) {
1122
- var __a = "sum: " + (String(Number(__prev._a.value) + Number(__prev._a.value) ?? '') + ("; big: " + String(_$_.with_scope(__prev._b, () => BigInt(__prev._a.value)) ?? '')));
1122
+ var __count_value = __prev._a.value;
1123
+ var __a = "sum: " + (String(Number(__count_value) + Number(__count_value) ?? '') + ("; big: " + String(_$_.with_scope(__prev._b, () => BigInt(__prev._a.value)) ?? '')));
1123
1124
 
1124
1125
  if (__prev.a !== __a) {
1125
1126
  _$_.set_text_content(__prev._c, __a, __prev.a);
@@ -1149,10 +1150,10 @@ function PrimitiveTextCalls_render(__anchor, __block) {
1149
1150
 
1150
1151
  PrimitiveTextCalls[_$_.$r] = PrimitiveTextCalls_render;
1151
1152
 
1152
- var root_84 = _$_.template(`<b>string`);
1153
- var root_85 = _$_.template(`<b>number`);
1154
- var root_86 = _$_.template(`<b>bigint`);
1155
- var root_87 = _$_.template(`<b>date`);
1153
+ var root_84 = _$_.template_el('b', null, 'string');
1154
+ var root_85 = _$_.template_el('b', null, 'number');
1155
+ var root_86 = _$_.template_el('b', null, 'bigint');
1156
+ var root_87 = _$_.template_el('b', null, 'date');
1156
1157
  var root_89 = _$_.template(`<p>before<!>after</p><p>before<!>after</p><p>before<!>after</p><p>before<!>after`, 1, 4);
1157
1158
  var root_88 = _$_.template(`<!>`, 1, 1);
1158
1159
 
@@ -36,7 +36,7 @@ function TextWrappedLayout_render(__anchor, __block, { children }) {
36
36
 
37
37
  TextWrappedLayout[_$_.$r] = TextWrappedLayout_render;
38
38
 
39
- var root_2 = _$_.template(`<div class=single>single`);
39
+ var root_2 = _$_.template_el('div', ['class', 'single'], 'single');
40
40
 
41
41
  function SingleChild_render(__anchor, __block) {
42
42
  var div_2 = root_2();
@@ -141,6 +141,10 @@ DynamicTagElement[_$_.$r] = DynamicTagElement_render;
141
141
 
142
142
  var root_7 = _$_.template(`<!>`, 1, 1);
143
143
 
144
+ function render(__prev) {
145
+ __prev.a = _$_.dynamic(__prev.a, __prev._a, __prev._b, {});
146
+ }
147
+
144
148
  function DynamicTagComponent_render(__anchor, __block) {
145
149
  const Comp = SingleChild;
146
150
 
@@ -149,7 +153,12 @@ function DynamicTagComponent_render(__anchor, __block) {
149
153
  var fragment_4 = root_7();
150
154
  var node_3 = _$_.first_child_frag(fragment_4);
151
155
 
152
- _$_.composite(() => Comp, node_3, () => ({}));
156
+ _$_.render(render, {
157
+ a: _$_.dynamic_init(node_3, () => Comp, () => ({})),
158
+ _a: node_3,
159
+ _b: Comp
160
+ });
161
+
153
162
  _$_.append(__anchor, fragment_4);
154
163
  })
155
164
  });
@@ -185,7 +185,7 @@ function ToggleButton_render(__anchor, __block) {
185
185
 
186
186
  ToggleButton[_$_.$r] = ToggleButton_render;
187
187
 
188
- var root_5 = _$_.template(`<button class=child-btn>`);
188
+ var root_5 = _$_.template_el('button', ['class', 'child-btn']);
189
189
 
190
190
  function render_5(__prev) {
191
191
  var __a = __prev._a.label;