ripple 0.4.1 → 0.4.3

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 (96) hide show
  1. package/CHANGELOG.md +162 -0
  2. package/package.json +9 -3
  3. package/src/constants.js +4 -0
  4. package/src/jsx-runtime.d.ts +2 -1
  5. package/src/runtime/array.js +15 -9
  6. package/src/runtime/index-client.js +25 -7
  7. package/src/runtime/index-server.js +1 -0
  8. package/src/runtime/internal/client/attributes.js +313 -0
  9. package/src/runtime/internal/client/blocks.js +4 -14
  10. package/src/runtime/internal/client/component.js +2 -5
  11. package/src/runtime/internal/client/composite.js +14 -6
  12. package/src/runtime/internal/client/constants.js +12 -6
  13. package/src/runtime/internal/client/context.js +3 -2
  14. package/src/runtime/internal/client/css.js +11 -26
  15. package/src/runtime/internal/client/errors.js +188 -0
  16. package/src/runtime/internal/client/events.js +79 -34
  17. package/src/runtime/internal/client/expression.js +21 -116
  18. package/src/runtime/internal/client/for.js +272 -222
  19. package/src/runtime/internal/client/head.js +4 -3
  20. package/src/runtime/internal/client/html.js +5 -3
  21. package/src/runtime/internal/client/hydrate.js +484 -0
  22. package/src/runtime/internal/client/hydration-enabled.js +7 -0
  23. package/src/runtime/internal/client/hydration.js +16 -97
  24. package/src/runtime/internal/client/if.js +13 -9
  25. package/src/runtime/internal/client/index.js +16 -8
  26. package/src/runtime/internal/client/operations.js +12 -9
  27. package/src/runtime/internal/client/portal.js +3 -2
  28. package/src/runtime/internal/client/render.js +75 -321
  29. package/src/runtime/internal/client/root-boundary-enabled.js +7 -0
  30. package/src/runtime/internal/client/runtime.js +129 -362
  31. package/src/runtime/internal/client/template-ns.js +47 -0
  32. package/src/runtime/internal/client/template.js +63 -140
  33. package/src/runtime/internal/client/track-async.js +356 -0
  34. package/src/runtime/internal/client/try.js +133 -319
  35. package/src/runtime/internal/client/types.d.ts +48 -24
  36. package/src/runtime/internal/server/index.js +38 -33
  37. package/src/runtime/internal/server/prerender.js +27 -0
  38. package/src/server/index.js +1 -0
  39. package/src/utils/class-name.js +28 -0
  40. package/tests/client/basic/basic.errors.test.tsrx +3 -3
  41. package/tests/client/compiler/__snapshots__/compiler.typescript.test.tsrx.snap +0 -2
  42. package/tests/client/compiler/compiler.basic.test.tsrx +4 -4
  43. package/tests/client/compiler/compiler.tracked-access.test.tsrx +3 -3
  44. package/tests/client/composite/composite.props.test.tsrx +10 -10
  45. package/tests/client/derived-release.test.tsrx +3 -3
  46. package/tests/client/for-item.test.tsrx +443 -0
  47. package/tests/client/for-selector.test.tsrx +95 -0
  48. package/tests/hydration/compiled/client/basic.js +97 -123
  49. package/tests/hydration/compiled/client/composite.js +5 -5
  50. package/tests/hydration/compiled/client/events.js +84 -79
  51. package/tests/hydration/compiled/client/for.js +229 -233
  52. package/tests/hydration/compiled/client/fragment-cursor.js +781 -481
  53. package/tests/hydration/compiled/client/head.js +23 -26
  54. package/tests/hydration/compiled/client/hmr.js +4 -4
  55. package/tests/hydration/compiled/client/html-in-template.js +5 -5
  56. package/tests/hydration/compiled/client/html.js +174 -208
  57. package/tests/hydration/compiled/client/if-children.js +71 -70
  58. package/tests/hydration/compiled/client/if-fragment-controlflow.js +46 -46
  59. package/tests/hydration/compiled/client/if.js +26 -26
  60. package/tests/hydration/compiled/client/mixed-control-flow.js +63 -105
  61. package/tests/hydration/compiled/client/nested-control-flow.js +170 -390
  62. package/tests/hydration/compiled/client/portal.js +10 -10
  63. package/tests/hydration/compiled/client/reactivity.js +36 -50
  64. package/tests/hydration/compiled/client/return.js +2 -2
  65. package/tests/hydration/compiled/client/streaming.js +34 -40
  66. package/tests/hydration/compiled/client/switch.js +25 -25
  67. package/tests/hydration/compiled/client/track-async-serialization.js +41 -41
  68. package/tests/hydration/compiled/client/try.js +15 -15
  69. package/tests/hydration/compiled/client/typed-text.js +8 -19
  70. package/tests/hydration/compiled/server/basic.js +6 -6
  71. package/tests/hydration/compiled/server/events.js +13 -61
  72. package/tests/hydration/compiled/server/for.js +23 -31
  73. package/tests/hydration/compiled/server/fragment-cursor.js +214 -366
  74. package/tests/hydration/compiled/server/head.js +6 -6
  75. package/tests/hydration/compiled/server/hmr.js +1 -1
  76. package/tests/hydration/compiled/server/html.js +1 -1
  77. package/tests/hydration/compiled/server/if-children.js +9 -9
  78. package/tests/hydration/compiled/server/if.js +5 -5
  79. package/tests/hydration/compiled/server/mixed-control-flow.js +4 -4
  80. package/tests/hydration/compiled/server/portal.js +1 -1
  81. package/tests/hydration/compiled/server/reactivity.js +9 -9
  82. package/tests/hydration/compiled/server/streaming.js +9 -9
  83. package/tests/hydration/compiled/server/switch.js +4 -4
  84. package/tests/hydration/compiled/server/track-async-serialization.js +16 -16
  85. package/tests/hydration/compiled/server/try.js +4 -4
  86. package/tests/hydration/compiled/server/typed-text.js +1 -1
  87. package/tests/hydration/components/fragment-cursor.tsrx +60 -0
  88. package/tests/hydration/components/track-async-serialization.tsrx +2 -2
  89. package/tests/hydration/fragment-cursor.test.js +34 -1
  90. package/tests/hydration/track-async-serialization.test.js +1 -1
  91. package/tests/server/basic.components.test.tsrx +3 -3
  92. package/tests/server/basic.test.tsrx +23 -0
  93. package/tests/server/track-async-serialization.test.tsrx +6 -6
  94. package/tests/utils/tracked-types.test.js +3 -3
  95. package/types/index.d.ts +8 -8
  96. package/types/server.d.ts +17 -0
@@ -91,7 +91,7 @@ export function KeyedForLoop() {
91
91
 
92
92
  export function ReactiveForLoopAdd() {
93
93
  return _$_.tsrx_element(() => {
94
- const items = _$_.track(['A', 'B'], 'e145678a');
94
+ const items = _$_.track(['A', 'B'], '1qi64qy');
95
95
 
96
96
  _$_.regular_block(() => {
97
97
  let __out = '';
@@ -118,7 +118,7 @@ export function ReactiveForLoopAdd() {
118
118
 
119
119
  export function ReactiveForLoopRemove() {
120
120
  return _$_.tsrx_element(() => {
121
- const items = _$_.track(['A', 'B', 'C'], 'b4e9bd54');
121
+ const items = _$_.track(['A', 'B', 'C'], '1e738lw');
122
122
 
123
123
  _$_.regular_block(() => {
124
124
  let __out = '';
@@ -145,7 +145,7 @@ export function ReactiveForLoopRemove() {
145
145
 
146
146
  export function ForLoopInteractive() {
147
147
  return _$_.tsrx_element(() => {
148
- const counts = _$_.track([0, 0, 0], '36f563df');
148
+ const counts = _$_.track([0, 0, 0], 'f8yrj3');
149
149
 
150
150
  _$_.regular_block(() => {
151
151
  let __out = '';
@@ -295,7 +295,7 @@ export function KeyedForLoopReorder() {
295
295
  { id: 2, name: 'Second' },
296
296
  { id: 3, name: 'Third' }
297
297
  ],
298
- 'e7abc6a3'
298
+ '1sa3hr7'
299
299
  );
300
300
 
301
301
  _$_.regular_block(() => {
@@ -323,7 +323,7 @@ export function KeyedForLoopReorder() {
323
323
 
324
324
  export function KeyedForLoopUpdate() {
325
325
  return _$_.tsrx_element(() => {
326
- const items = _$_.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' }], 'xwci56');
327
327
 
328
328
  _$_.regular_block(() => {
329
329
  let __out = '';
@@ -350,7 +350,7 @@ export function KeyedForLoopUpdate() {
350
350
 
351
351
  export function ForLoopMixedOperations() {
352
352
  return _$_.tsrx_element(() => {
353
- const items = _$_.track(['A', 'B', 'C', 'D'], '3dd7c7b6');
353
+ const items = _$_.track(['A', 'B', 'C', 'D'], 'h5qbw6');
354
354
 
355
355
  _$_.regular_block(() => {
356
356
  let __out = '';
@@ -377,8 +377,8 @@ export function ForLoopMixedOperations() {
377
377
 
378
378
  export function ForLoopInsideIf() {
379
379
  return _$_.tsrx_element(() => {
380
- const showList = _$_.track(true, '0528df30');
381
- const items = _$_.track(['X', 'Y', 'Z'], 'bf375103');
380
+ const showList = _$_.track(true, '1fjdps');
381
+ const items = _$_.track(['X', 'Y', 'Z'], '1h205c3');
382
382
 
383
383
  _$_.regular_block(() => {
384
384
  let __out = '';
@@ -411,7 +411,7 @@ export function ForLoopInsideIf() {
411
411
 
412
412
  export function ForLoopEmptyToPopulated() {
413
413
  return _$_.tsrx_element(() => {
414
- const items = _$_.track([], '525c5dbc');
414
+ const items = _$_.track([], 'muog58');
415
415
 
416
416
  _$_.regular_block(() => {
417
417
  let __out = '';
@@ -419,15 +419,7 @@ export function ForLoopEmptyToPopulated() {
419
419
  __out += '<button class="populate">Populate</button><ul class="list"><!--[-->';
420
420
 
421
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>';
422
+ __out += '<li>' + _$_.escape(item) + '</li>';
431
423
  }
432
424
 
433
425
  __out += '<!--]--></ul>';
@@ -438,7 +430,7 @@ export function ForLoopEmptyToPopulated() {
438
430
 
439
431
  export function ForLoopPopulatedToEmpty() {
440
432
  return _$_.tsrx_element(() => {
441
- const items = _$_.track(['One', 'Two', 'Three'], 'ee47f078');
433
+ const items = _$_.track(['One', 'Two', 'Three'], '1u44ewo');
442
434
 
443
435
  _$_.regular_block(() => {
444
436
  let __out = '';
@@ -465,7 +457,7 @@ export function ForLoopPopulatedToEmpty() {
465
457
 
466
458
  export function NestedForLoopReactive() {
467
459
  return _$_.tsrx_element(() => {
468
- const grid = _$_.track([[1, 2], [3, 4]], 'a2f41fb3');
460
+ const grid = _$_.track([[1, 2], [3, 4]], '197p4tv');
469
461
 
470
462
  _$_.regular_block(() => {
471
463
  let __out = '';
@@ -586,7 +578,7 @@ export function ForLoopDeeplyNested() {
586
578
 
587
579
  export function ForLoopIndexUpdate() {
588
580
  return _$_.tsrx_element(() => {
589
- const items = _$_.track(['First', 'Second', 'Third'], 'f61e31e6');
581
+ const items = _$_.track(['First', 'Second', 'Third'], '1waej1i');
590
582
 
591
583
  _$_.regular_block(() => {
592
584
  let __out = '';
@@ -620,7 +612,7 @@ export function KeyedForLoopWithIndex() {
620
612
  { id: 'b', value: 'Beta' },
621
613
  { id: 'c', value: 'Gamma' }
622
614
  ],
623
- '3467975a'
615
+ 'ejgeai'
624
616
  );
625
617
 
626
618
  _$_.regular_block(() => {
@@ -649,7 +641,7 @@ export function KeyedForLoopWithIndex() {
649
641
 
650
642
  export function ForLoopWithSiblings() {
651
643
  return _$_.tsrx_element(() => {
652
- const items = _$_.track(['A', 'B'], '3c7e8152');
644
+ const items = _$_.track(['A', 'B'], 'gs9c2a');
653
645
 
654
646
  _$_.regular_block(() => {
655
647
  let __out = '';
@@ -706,7 +698,7 @@ export function ForLoopItemState() {
706
698
 
707
699
  function TodoItem(props) {
708
700
  return _$_.tsrx_element(() => {
709
- const done = _$_.track(false, '4f2402a4');
701
+ const done = _$_.track(false, 'lyii78');
710
702
 
711
703
  _$_.regular_block(() => {
712
704
  let __out = '';
@@ -746,7 +738,7 @@ export function ForLoopSingleItem() {
746
738
 
747
739
  export function ForLoopAddAtBeginning() {
748
740
  return _$_.tsrx_element(() => {
749
- const items = _$_.track(['B', 'C'], '1561403a');
741
+ const items = _$_.track(['B', 'C'], '5xk2t6');
750
742
 
751
743
  _$_.regular_block(() => {
752
744
  let __out = '';
@@ -773,7 +765,7 @@ export function ForLoopAddAtBeginning() {
773
765
 
774
766
  export function ForLoopAddInMiddle() {
775
767
  return _$_.tsrx_element(() => {
776
- const items = _$_.track(['A', 'C'], '1bc60b46');
768
+ const items = _$_.track(['A', 'C'], '7pf806');
777
769
 
778
770
  _$_.regular_block(() => {
779
771
  let __out = '';
@@ -800,7 +792,7 @@ export function ForLoopAddInMiddle() {
800
792
 
801
793
  export function ForLoopRemoveFromMiddle() {
802
794
  return _$_.tsrx_element(() => {
803
- const items = _$_.track(['A', 'B', 'C'], '1c87f95f');
795
+ const items = _$_.track(['A', 'B', 'C'], '7wzmn3');
804
796
 
805
797
  _$_.regular_block(() => {
806
798
  let __out = '';
@@ -863,7 +855,7 @@ export function ForLoopLargeList() {
863
855
 
864
856
  export function ForLoopSwap() {
865
857
  return _$_.tsrx_element(() => {
866
- const items = _$_.track(['A', 'B', 'C', 'D'], '5f8d152f');
858
+ const items = _$_.track(['A', 'B', 'C', 'D'], 'qiflm7');
867
859
 
868
860
  _$_.regular_block(() => {
869
861
  let __out = '';
@@ -890,7 +882,7 @@ export function ForLoopSwap() {
890
882
 
891
883
  export function ForLoopReverse() {
892
884
  return _$_.tsrx_element(() => {
893
- const items = _$_.track(['A', 'B', 'C', 'D'], '24602e64');
885
+ const items = _$_.track(['A', 'B', 'C', 'D'], 'a3chgk');
894
886
 
895
887
  _$_.regular_block(() => {
896
888
  let __out = '';
@@ -917,7 +909,7 @@ export function ForLoopReverse() {
917
909
 
918
910
  export function KeyedForLoopAppendAndRotate() {
919
911
  return _$_.tsrx_element(() => {
920
- const items = _$_.track([1, 2, 3], 'a8b41504');
912
+ const items = _$_.track([1, 2, 3], '1at4qo4');
921
913
 
922
914
  _$_.regular_block(() => {
923
915
  let __out = '';
@@ -961,7 +953,7 @@ function RootKeyedList(props) {
961
953
 
962
954
  export function RootKeyedForLoopAppendAndRotate() {
963
955
  return _$_.tsrx_element(() => {
964
- const items = _$_.track([1, 2, 3], '50a91d60');
956
+ const items = _$_.track([1, 2, 3], 'mdp2e8');
965
957
 
966
958
  _$_.regular_block(() => {
967
959
  let __out = '';