ripple 0.2.216 → 0.3.1

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 (155) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/package.json +16 -7
  3. package/src/compiler/errors.js +1 -1
  4. package/src/compiler/identifier-utils.js +2 -0
  5. package/src/compiler/index.d.ts +2 -6
  6. package/src/compiler/phases/1-parse/index.js +171 -233
  7. package/src/compiler/phases/2-analyze/index.js +192 -16
  8. package/src/compiler/phases/2-analyze/prune.js +2 -2
  9. package/src/compiler/phases/3-transform/client/index.js +308 -91
  10. package/src/compiler/phases/3-transform/segments.js +43 -15
  11. package/src/compiler/phases/3-transform/server/index.js +71 -21
  12. package/src/compiler/scope.js +31 -12
  13. package/src/compiler/source-map-utils.js +4 -6
  14. package/src/compiler/types/acorn.d.ts +11 -0
  15. package/src/compiler/types/estree-jsx.d.ts +11 -0
  16. package/src/compiler/types/estree.d.ts +11 -0
  17. package/src/compiler/types/import.d.ts +32 -18
  18. package/src/compiler/types/index.d.ts +75 -23
  19. package/src/compiler/types/parse.d.ts +7 -10
  20. package/src/compiler/utils.js +48 -0
  21. package/src/runtime/array.js +53 -22
  22. package/src/runtime/date.js +15 -5
  23. package/src/runtime/index-client.js +41 -7
  24. package/src/runtime/index-server.js +7 -7
  25. package/src/runtime/internal/client/bindings.js +2 -2
  26. package/src/runtime/internal/client/blocks.js +40 -1
  27. package/src/runtime/internal/client/context.js +8 -0
  28. package/src/runtime/internal/client/for.js +3 -3
  29. package/src/runtime/internal/client/index.js +27 -5
  30. package/src/runtime/internal/client/render.js +20 -8
  31. package/src/runtime/internal/client/runtime.js +9 -7
  32. package/src/runtime/internal/client/try.js +15 -22
  33. package/src/runtime/internal/client/utils.js +1 -1
  34. package/src/runtime/internal/server/context.js +8 -0
  35. package/src/runtime/internal/server/index.js +99 -6
  36. package/src/runtime/map.js +7 -7
  37. package/src/runtime/media-query.js +10 -1
  38. package/src/runtime/object.js +6 -6
  39. package/src/runtime/proxy.js +6 -6
  40. package/src/runtime/set.js +11 -11
  41. package/src/runtime/url-search-params.js +13 -2
  42. package/src/runtime/url.js +15 -5
  43. package/src/utils/builders.js +13 -3
  44. package/tests/client/array/array.copy-within.test.ripple +11 -11
  45. package/tests/client/array/array.derived.test.ripple +42 -42
  46. package/tests/client/array/array.iteration.test.ripple +12 -12
  47. package/tests/client/array/array.mutations.test.ripple +25 -25
  48. package/tests/client/array/array.static.test.ripple +103 -106
  49. package/tests/client/array/array.to-methods.test.ripple +8 -8
  50. package/tests/client/async-suspend.test.ripple +94 -0
  51. package/tests/client/basic/basic.attributes.test.ripple +31 -31
  52. package/tests/client/basic/basic.collections.test.ripple +7 -7
  53. package/tests/client/basic/basic.components.test.ripple +48 -10
  54. package/tests/client/basic/basic.errors.test.ripple +46 -31
  55. package/tests/client/basic/basic.events.test.ripple +11 -11
  56. package/tests/client/basic/basic.get-set.test.ripple +18 -18
  57. package/tests/client/basic/basic.reactivity.test.ripple +47 -42
  58. package/tests/client/basic/basic.rendering.test.ripple +7 -7
  59. package/tests/client/basic/basic.utilities.test.ripple +4 -4
  60. package/tests/client/boundaries.test.ripple +7 -7
  61. package/tests/client/compiler/__snapshots__/compiler.assignments.test.ripple.snap +2 -2
  62. package/tests/client/compiler/compiler.assignments.test.ripple +21 -21
  63. package/tests/client/compiler/compiler.basic.test.ripple +223 -82
  64. package/tests/client/compiler/compiler.tracked-access.test.ripple +8 -9
  65. package/tests/client/composite/composite.dynamic-components.test.ripple +8 -8
  66. package/tests/client/composite/composite.generics.test.ripple +4 -4
  67. package/tests/client/composite/composite.props.test.ripple +9 -9
  68. package/tests/client/composite/composite.reactivity.test.ripple +32 -26
  69. package/tests/client/composite/composite.render.test.ripple +13 -4
  70. package/tests/client/computed-properties.test.ripple +3 -3
  71. package/tests/client/context.test.ripple +3 -3
  72. package/tests/client/css/global-additional-cases.test.ripple +4 -4
  73. package/tests/client/css/style-identifier.test.ripple +49 -41
  74. package/tests/client/date.test.ripple +40 -40
  75. package/tests/client/dynamic-elements.test.ripple +165 -30
  76. package/tests/client/events.test.ripple +25 -25
  77. package/tests/client/for.test.ripple +76 -8
  78. package/tests/client/function-overload.test.ripple +0 -1
  79. package/tests/client/head.test.ripple +7 -7
  80. package/tests/client/html.test.ripple +2 -2
  81. package/tests/client/input-value.test.ripple +174 -176
  82. package/tests/client/map.test.ripple +21 -21
  83. package/tests/client/media-query.test.ripple +4 -4
  84. package/tests/client/object.test.ripple +12 -12
  85. package/tests/client/portal.test.ripple +4 -4
  86. package/tests/client/ref.test.ripple +5 -5
  87. package/tests/client/return.test.ripple +17 -17
  88. package/tests/client/set.test.ripple +16 -16
  89. package/tests/client/svg.test.ripple +6 -7
  90. package/tests/client/switch.test.ripple +10 -10
  91. package/tests/client/tracked-expression.test.ripple +1 -3
  92. package/tests/client/try.test.ripple +33 -4
  93. package/tests/client/url/url.derived.test.ripple +10 -9
  94. package/tests/client/url/url.parsing.test.ripple +10 -10
  95. package/tests/client/url/url.partial-removal.test.ripple +10 -10
  96. package/tests/client/url/url.reactivity.test.ripple +17 -17
  97. package/tests/client/url/url.serialization.test.ripple +4 -4
  98. package/tests/client/url-search-params/url-search-params.derived.test.ripple +11 -10
  99. package/tests/client/url-search-params/url-search-params.initialization.test.ripple +5 -7
  100. package/tests/client/url-search-params/url-search-params.iteration.test.ripple +13 -13
  101. package/tests/client/url-search-params/url-search-params.mutation.test.ripple +19 -19
  102. package/tests/client/url-search-params/url-search-params.retrieval.test.ripple +17 -17
  103. package/tests/client/url-search-params/url-search-params.serialization.test.ripple +5 -5
  104. package/tests/client/url-search-params/url-search-params.tracked-url.test.ripple +5 -5
  105. package/tests/hydration/compiled/client/events.js +8 -11
  106. package/tests/hydration/compiled/client/for.js +20 -23
  107. package/tests/hydration/compiled/client/head.js +17 -19
  108. package/tests/hydration/compiled/client/hmr.js +1 -3
  109. package/tests/hydration/compiled/client/html.js +1 -15
  110. package/tests/hydration/compiled/client/if-children.js +7 -9
  111. package/tests/hydration/compiled/client/if.js +5 -7
  112. package/tests/hydration/compiled/client/mixed-control-flow.js +3 -5
  113. package/tests/hydration/compiled/client/portal.js +1 -1
  114. package/tests/hydration/compiled/client/reactivity.js +9 -11
  115. package/tests/hydration/compiled/client/return.js +11 -13
  116. package/tests/hydration/compiled/client/switch.js +4 -6
  117. package/tests/hydration/compiled/server/basic.js +0 -1
  118. package/tests/hydration/compiled/server/composite.js +0 -3
  119. package/tests/hydration/compiled/server/events.js +8 -12
  120. package/tests/hydration/compiled/server/for.js +20 -23
  121. package/tests/hydration/compiled/server/head.js +17 -19
  122. package/tests/hydration/compiled/server/hmr.js +1 -4
  123. package/tests/hydration/compiled/server/html.js +1 -35
  124. package/tests/hydration/compiled/server/if-children.js +7 -11
  125. package/tests/hydration/compiled/server/if.js +5 -7
  126. package/tests/hydration/compiled/server/mixed-control-flow.js +3 -5
  127. package/tests/hydration/compiled/server/portal.js +1 -9
  128. package/tests/hydration/compiled/server/reactivity.js +9 -11
  129. package/tests/hydration/compiled/server/return.js +11 -13
  130. package/tests/hydration/compiled/server/switch.js +4 -6
  131. package/tests/hydration/components/events.ripple +8 -9
  132. package/tests/hydration/components/for.ripple +20 -21
  133. package/tests/hydration/components/head.ripple +6 -8
  134. package/tests/hydration/components/hmr.ripple +1 -2
  135. package/tests/hydration/components/html.ripple +1 -3
  136. package/tests/hydration/components/if-children.ripple +7 -8
  137. package/tests/hydration/components/if.ripple +5 -6
  138. package/tests/hydration/components/mixed-control-flow.ripple +4 -6
  139. package/tests/hydration/components/portal.ripple +1 -1
  140. package/tests/hydration/components/reactivity.ripple +9 -10
  141. package/tests/hydration/components/return.ripple +11 -12
  142. package/tests/hydration/components/switch.ripple +6 -8
  143. package/tests/server/await.test.ripple +2 -2
  144. package/tests/server/basic.attributes.test.ripple +19 -21
  145. package/tests/server/basic.components.test.ripple +13 -7
  146. package/tests/server/basic.test.ripple +20 -21
  147. package/tests/server/compiler.test.ripple +5 -5
  148. package/tests/server/composite.props.test.ripple +6 -7
  149. package/tests/server/composite.test.ripple +4 -4
  150. package/tests/server/context.test.ripple +1 -3
  151. package/tests/server/dynamic-elements.test.ripple +24 -24
  152. package/tests/server/head.test.ripple +5 -7
  153. package/tests/server/style-identifier.test.ripple +16 -17
  154. package/types/index.d.ts +266 -62
  155. package/types/server.d.ts +6 -6
@@ -1,8 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import * as _$_ from 'ripple/internal/server';
3
3
 
4
- import { track } from 'ripple/server';
5
-
6
4
  export function IfTruthy(__output) {
7
5
  _$_.push_component();
8
6
 
@@ -85,7 +83,7 @@ export function IfElse(__output) {
85
83
  export function ReactiveIf(__output) {
86
84
  _$_.push_component();
87
85
 
88
- let show = track(true);
86
+ let show = _$_.track(true);
89
87
 
90
88
  __output.push('<button');
91
89
  __output.push(' class="toggle"');
@@ -117,7 +115,7 @@ export function ReactiveIf(__output) {
117
115
  export function ReactiveIfElse(__output) {
118
116
  _$_.push_component();
119
117
 
120
- let isOn = track(false);
118
+ let isOn = _$_.track(false);
121
119
 
122
120
  __output.push('<button');
123
121
  __output.push(' class="toggle"');
@@ -159,8 +157,8 @@ export function ReactiveIfElse(__output) {
159
157
  export function NestedIf(__output) {
160
158
  _$_.push_component();
161
159
 
162
- let outer = track(true);
163
- let inner = track(true);
160
+ let outer = _$_.track(true);
161
+ let inner = _$_.track(true);
164
162
 
165
163
  __output.push('<button');
166
164
  __output.push(' class="outer-toggle"');
@@ -216,7 +214,7 @@ export function NestedIf(__output) {
216
214
  export function IfElseIfChain(__output) {
217
215
  _$_.push_component();
218
216
 
219
- let status = track('loading');
217
+ let status = _$_.track('loading');
220
218
 
221
219
  __output.push('<div');
222
220
  __output.push('>');
@@ -1,8 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import * as _$_ from 'ripple/internal/server';
3
3
 
4
- import { track } from 'ripple/server';
5
-
6
4
  export async function MixedControlFlowStatic(__output) {
7
5
  return _$_.async(async () => {
8
6
  _$_.push_component();
@@ -97,9 +95,9 @@ export async function MixedControlFlowReactive(__output) {
97
95
  return _$_.async(async () => {
98
96
  _$_.push_component();
99
97
 
100
- let show = track(true);
101
- let mode = track('a');
102
- let items = track([{ id: 1, label: 'One' }, { id: 2, label: 'Two' }]);
98
+ let show = _$_.track(true);
99
+ let mode = _$_.track('a');
100
+ let items = _$_.track([{ id: 1, label: 'One' }, { id: 2, label: 'Two' }]);
103
101
 
104
102
  __output.push('<button');
105
103
  __output.push(' class="toggle-show"');
@@ -25,10 +25,8 @@ export async function SimplePortal(__output) {
25
25
 
26
26
  const args = [
27
27
  __output,
28
-
29
28
  {
30
29
  target: typeof document !== 'undefined' ? document.body : null,
31
-
32
30
  children: function children(__output) {
33
31
  _$_.push_component();
34
32
  __output.push('<div');
@@ -64,7 +62,7 @@ export async function ConditionalPortal(__output) {
64
62
  return _$_.async(async () => {
65
63
  _$_.push_component();
66
64
 
67
- let show = _$_.get(true);
65
+ let show = _$_.track(true);
68
66
 
69
67
  __output.push('<div');
70
68
  __output.push(' class="container"');
@@ -88,10 +86,8 @@ export async function ConditionalPortal(__output) {
88
86
 
89
87
  const args = [
90
88
  __output,
91
-
92
89
  {
93
90
  target: typeof document !== 'undefined' ? document.body : null,
94
-
95
91
  children: function children(__output) {
96
92
  _$_.push_component();
97
93
  __output.push('<div');
@@ -148,10 +144,8 @@ export async function PortalWithMainContent(__output) {
148
144
 
149
145
  const args = [
150
146
  __output,
151
-
152
147
  {
153
148
  target: typeof document !== 'undefined' ? document.body : null,
154
-
155
149
  children: function children(__output) {
156
150
  _$_.push_component();
157
151
  __output.push('<div');
@@ -223,10 +217,8 @@ export async function NestedContentWithPortal(__output) {
223
217
 
224
218
  const args = [
225
219
  __output,
226
-
227
220
  {
228
221
  target: typeof document !== 'undefined' ? document.body : null,
229
-
230
222
  children: function children(__output) {
231
223
  _$_.push_component();
232
224
  __output.push('<div');
@@ -1,12 +1,10 @@
1
1
  // @ts-nocheck
2
2
  import * as _$_ from 'ripple/internal/server';
3
3
 
4
- import { track } from 'ripple/server';
5
-
6
4
  export function TrackedState(__output) {
7
5
  _$_.push_component();
8
6
 
9
- let count = track(0);
7
+ let count = _$_.track(0);
10
8
 
11
9
  __output.push('<div');
12
10
  __output.push(' class="count"');
@@ -23,7 +21,7 @@ export function TrackedState(__output) {
23
21
  export function CounterWithInitial(__output, props) {
24
22
  _$_.push_component();
25
23
 
26
- let count = track(props.initial);
24
+ let count = _$_.track(props.initial);
27
25
 
28
26
  __output.push('<div');
29
27
  __output.push('>');
@@ -60,8 +58,8 @@ export function CounterWrapper(__output) {
60
58
  export function ComputedValues(__output) {
61
59
  _$_.push_component();
62
60
 
63
- let a = track(2);
64
- let b = track(3);
61
+ let a = _$_.track(2);
62
+ let b = _$_.track(3);
65
63
  const sum = () => _$_.get(a) + _$_.get(b);
66
64
 
67
65
  __output.push('<div');
@@ -79,9 +77,9 @@ export function ComputedValues(__output) {
79
77
  export function MultipleTracked(__output) {
80
78
  _$_.push_component();
81
79
 
82
- let x = track(10);
83
- let y = track(20);
84
- let z = track(30);
80
+ let x = _$_.track(10);
81
+ let y = _$_.track(20);
82
+ let z = _$_.track(30);
85
83
 
86
84
  __output.push('<div');
87
85
  __output.push(' class="x"');
@@ -116,8 +114,8 @@ export function MultipleTracked(__output) {
116
114
  export function DerivedState(__output) {
117
115
  _$_.push_component();
118
116
 
119
- let firstName = track('John');
120
- let lastName = track('Doe');
117
+ let firstName = _$_.track('John');
118
+ let lastName = _$_.track('Doe');
121
119
  const fullName = () => `${_$_.get(firstName)} ${_$_.get(lastName)}`;
122
120
 
123
121
  __output.push('<div');
@@ -1,8 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import * as _$_ from 'ripple/internal/server';
3
3
 
4
- import { track } from 'ripple/server';
5
-
6
4
  export function DirectReturn(__output) {
7
5
  _$_.push_component();
8
6
 
@@ -1034,7 +1032,7 @@ export function ReactiveReturnTrueToFalse(__output) {
1034
1032
  _$_.push_component();
1035
1033
 
1036
1034
  var __r_28 = false;
1037
- let condition = track(true);
1035
+ let condition = _$_.track(true);
1038
1036
 
1039
1037
  __output.push('<button');
1040
1038
  __output.push(' class="toggle"');
@@ -1083,7 +1081,7 @@ export function ReactiveReturnFalseToTrue(__output) {
1083
1081
  _$_.push_component();
1084
1082
 
1085
1083
  var __r_29 = false;
1086
- let condition = track(false);
1084
+ let condition = _$_.track(false);
1087
1085
 
1088
1086
  __output.push('<button');
1089
1087
  __output.push(' class="toggle"');
@@ -1133,7 +1131,7 @@ export function ReactiveNestedReturn(__output) {
1133
1131
 
1134
1132
  var __r_30 = false;
1135
1133
  let a = true;
1136
- let b = track(true);
1134
+ let b = _$_.track(true);
1137
1135
 
1138
1136
  __output.push('<button');
1139
1137
  __output.push(' class="toggle"');
@@ -1507,7 +1505,7 @@ export function ReactiveSiblingReturns(__output) {
1507
1505
 
1508
1506
  var __r_38 = false;
1509
1507
  var __r_39 = false;
1510
- let mode = track('first');
1508
+ let mode = _$_.track('first');
1511
1509
 
1512
1510
  __output.push('<button');
1513
1511
  __output.push(' class="toggle"');
@@ -1578,8 +1576,8 @@ export function ReactiveOuterInnerReturns(__output) {
1578
1576
  _$_.push_component();
1579
1577
 
1580
1578
  var __r_40 = false;
1581
- let a = track(true);
1582
- let b = track(true);
1579
+ let a = _$_.track(true);
1580
+ let b = _$_.track(true);
1583
1581
 
1584
1582
  __output.push('<button');
1585
1583
  __output.push(' class="toggle-a"');
@@ -1653,7 +1651,7 @@ export function ReactiveElseIfReturns(__output) {
1653
1651
 
1654
1652
  var __r_41 = false;
1655
1653
  var __r_42 = false;
1656
- let status = track(0);
1654
+ let status = _$_.track(0);
1657
1655
 
1658
1656
  __output.push('<button');
1659
1657
  __output.push(' class="toggle"');
@@ -1731,10 +1729,10 @@ export function ReactiveDeepNestedIndependentReturns(__output) {
1731
1729
  var __r_44 = false;
1732
1730
  var __r_45 = false;
1733
1731
  var __r_46 = false;
1734
- let c1 = track(false);
1735
- let c2 = track(false);
1736
- let c3 = track(false);
1737
- let c4 = track(false);
1732
+ let c1 = _$_.track(false);
1733
+ let c2 = _$_.track(false);
1734
+ let c3 = _$_.track(false);
1735
+ let c4 = _$_.track(false);
1738
1736
 
1739
1737
  __output.push('<button');
1740
1738
  __output.push(' class="toggle-c1"');
@@ -1,8 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import * as _$_ from 'ripple/internal/server';
3
3
 
4
- import { track } from 'ripple/server';
5
-
6
4
  export function SwitchStatic(__output) {
7
5
  _$_.push_component();
8
6
 
@@ -48,7 +46,7 @@ export function SwitchStatic(__output) {
48
46
  export function SwitchReactive(__output) {
49
47
  _$_.push_component();
50
48
 
51
- let status = track('a');
49
+ let status = _$_.track('a');
52
50
 
53
51
  __output.push('<button');
54
52
  __output.push(' class="toggle"');
@@ -133,7 +131,7 @@ export function SwitchFallthrough(__output) {
133
131
  export function SwitchNumericLevels(__output) {
134
132
  _$_.push_component();
135
133
 
136
- let level = track(1);
134
+ let level = _$_.track(1);
137
135
 
138
136
  __output.push('<button');
139
137
  __output.push(' class="level-toggle"');
@@ -185,7 +183,7 @@ export function SwitchNumericLevels(__output) {
185
183
  export function SwitchBlockScoped(__output) {
186
184
  _$_.push_component();
187
185
 
188
- let level = track(1);
186
+ let level = _$_.track(1);
189
187
 
190
188
  __output.push('<button');
191
189
  __output.push(' class="block-toggle"');
@@ -237,7 +235,7 @@ export function SwitchBlockScoped(__output) {
237
235
  export function SwitchNoBreak(__output) {
238
236
  _$_.push_component();
239
237
 
240
- let level = track(1);
238
+ let level = _$_.track(1);
241
239
 
242
240
  __output.push('<button');
243
241
  __output.push(' class="nobreak-toggle"');
@@ -1,8 +1,7 @@
1
1
  // Event handling components for hydration testing
2
- import { track } from 'ripple';
3
2
 
4
3
  export component ClickCounter() {
5
- let count = track(0);
4
+ let count = #ripple.track(0);
6
5
  <div>
7
6
  <button
8
7
  class="increment"
@@ -17,7 +16,7 @@ export component ClickCounter() {
17
16
  }
18
17
 
19
18
  export component IncrementDecrement() {
20
- let count = track(0);
19
+ let count = #ripple.track(0);
21
20
  <div>
22
21
  <button
23
22
  class="decrement"
@@ -40,8 +39,8 @@ export component IncrementDecrement() {
40
39
  }
41
40
 
42
41
  export component MultipleEvents() {
43
- let clicks = track(0);
44
- let hovers = track(0);
42
+ let clicks = #ripple.track(0);
43
+ let hovers = #ripple.track(0);
45
44
  <div>
46
45
  <button
47
46
  class="target"
@@ -60,8 +59,8 @@ export component MultipleEvents() {
60
59
  }
61
60
 
62
61
  export component MultiStateUpdate() {
63
- let count = track(0);
64
- let lastAction = track('none');
62
+ let count = #ripple.track(0);
63
+ let lastAction = #ripple.track('none');
65
64
 
66
65
  const handleClick = () => {
67
66
  @count++;
@@ -76,7 +75,7 @@ export component MultiStateUpdate() {
76
75
  }
77
76
 
78
77
  export component ToggleButton() {
79
- let isOn = track(false);
78
+ let isOn = #ripple.track(false);
80
79
  <div>
81
80
  <button
82
81
  class="toggle"
@@ -94,7 +93,7 @@ export component ChildButton(props: { onClick: () => void; label: string }) {
94
93
  }
95
94
 
96
95
  export component ParentWithChildButton() {
97
- let count = track(0);
96
+ let count = #ripple.track(0);
98
97
  <div>
99
98
  <ChildButton
100
99
  onClick={() => {
@@ -1,5 +1,4 @@
1
1
  // For loop components for hydration testing
2
- import { track } from 'ripple';
3
2
 
4
3
  export component StaticForLoop() {
5
4
  const items = ['Apple', 'Banana', 'Cherry'];
@@ -33,7 +32,7 @@ export component KeyedForLoop() {
33
32
  }
34
33
 
35
34
  export component ReactiveForLoopAdd() {
36
- let items = track(['A', 'B']);
35
+ let items = #ripple.track(['A', 'B']);
37
36
  <button
38
37
  class="add"
39
38
  onClick={() => {
@@ -50,7 +49,7 @@ export component ReactiveForLoopAdd() {
50
49
  }
51
50
 
52
51
  export component ReactiveForLoopRemove() {
53
- let items = track(['A', 'B', 'C']);
52
+ let items = #ripple.track(['A', 'B', 'C']);
54
53
  <button
55
54
  class="remove"
56
55
  onClick={() => {
@@ -67,7 +66,7 @@ export component ReactiveForLoopRemove() {
67
66
  }
68
67
 
69
68
  export component ForLoopInteractive() {
70
- let counts = track([0, 0, 0]);
69
+ let counts = #ripple.track([0, 0, 0]);
71
70
  <div>
72
71
  for (const count of @counts; index i) {
73
72
  <div class={`item-${i}`}>
@@ -129,7 +128,7 @@ export component ForLoopComplexObjects() {
129
128
 
130
129
  // Test reordering items in a keyed for loop
131
130
  export component KeyedForLoopReorder() {
132
- let items = track([
131
+ let items = #ripple.track([
133
132
  { id: 1, name: 'First' },
134
133
  { id: 2, name: 'Second' },
135
134
  { id: 3, name: 'Third' },
@@ -151,7 +150,7 @@ export component KeyedForLoopReorder() {
151
150
 
152
151
  // Test for loop with item property updates (keyed)
153
152
  export component KeyedForLoopUpdate() {
154
- let items = track([
153
+ let items = #ripple.track([
155
154
  { id: 1, name: 'Item 1' },
156
155
  { id: 2, name: 'Item 2' },
157
156
  ]);
@@ -172,7 +171,7 @@ export component KeyedForLoopUpdate() {
172
171
 
173
172
  // Test for loop with combined add/remove/reorder
174
173
  export component ForLoopMixedOperations() {
175
- let items = track(['A', 'B', 'C', 'D']);
174
+ let items = #ripple.track(['A', 'B', 'C', 'D']);
176
175
  <button
177
176
  class="shuffle"
178
177
  onClick={() => {
@@ -191,8 +190,8 @@ export component ForLoopMixedOperations() {
191
190
 
192
191
  // Test for loop inside if block (combined control flow)
193
192
  export component ForLoopInsideIf() {
194
- let showList = track(true);
195
- let items = track(['X', 'Y', 'Z']);
193
+ let showList = #ripple.track(true);
194
+ let items = #ripple.track(['X', 'Y', 'Z']);
196
195
  <button
197
196
  class="toggle"
198
197
  onClick={() => {
@@ -220,7 +219,7 @@ export component ForLoopInsideIf() {
220
219
 
221
220
  // Test for loop that transitions from empty to populated
222
221
  export component ForLoopEmptyToPopulated() {
223
- let items = track<string[]>([]);
222
+ let items = #ripple.track<string[]>([]);
224
223
  <button
225
224
  class="populate"
226
225
  onClick={() => {
@@ -238,7 +237,7 @@ export component ForLoopEmptyToPopulated() {
238
237
 
239
238
  // Test for loop that transitions from populated to empty
240
239
  export component ForLoopPopulatedToEmpty() {
241
- let items = track(['One', 'Two', 'Three']);
240
+ let items = #ripple.track(['One', 'Two', 'Three']);
242
241
  <button
243
242
  class="clear"
244
243
  onClick={() => {
@@ -256,7 +255,7 @@ export component ForLoopPopulatedToEmpty() {
256
255
 
257
256
  // Test nested for loops with reactivity
258
257
  export component NestedForLoopReactive() {
259
- let grid = track([
258
+ let grid = #ripple.track([
260
259
  [1, 2],
261
260
  [3, 4],
262
261
  ]);
@@ -329,7 +328,7 @@ export component ForLoopDeeplyNested() {
329
328
 
330
329
  // Test for loop with index that gets updated
331
330
  export component ForLoopIndexUpdate() {
332
- let items = track(['First', 'Second', 'Third']);
331
+ let items = #ripple.track(['First', 'Second', 'Third']);
333
332
  <button
334
333
  class="prepend"
335
334
  onClick={() => {
@@ -347,7 +346,7 @@ export component ForLoopIndexUpdate() {
347
346
 
348
347
  // Test keyed for loop with index
349
348
  export component KeyedForLoopWithIndex() {
350
- let items = track([
349
+ let items = #ripple.track([
351
350
  { id: 'a', value: 'Alpha' },
352
351
  { id: 'b', value: 'Beta' },
353
352
  { id: 'c', value: 'Gamma' },
@@ -369,7 +368,7 @@ export component KeyedForLoopWithIndex() {
369
368
 
370
369
  // Test for loop with sibling elements
371
370
  export component ForLoopWithSiblings() {
372
- let items = track(['A', 'B']);
371
+ let items = #ripple.track(['A', 'B']);
373
372
  <div class="wrapper">
374
373
  <header class="before">{'Before'}</header>
375
374
  for (const item of @items) {
@@ -402,7 +401,7 @@ export component ForLoopItemState() {
402
401
  }
403
402
 
404
403
  component TodoItem(props: { id: number; text: string }) {
405
- let done = track(false);
404
+ let done = #ripple.track(false);
406
405
  <div class={`todo-${props.id}`}>
407
406
  <input
408
407
  type="checkbox"
@@ -428,7 +427,7 @@ export component ForLoopSingleItem() {
428
427
 
429
428
  // Test for loop adding at beginning
430
429
  export component ForLoopAddAtBeginning() {
431
- let items = track(['B', 'C']);
430
+ let items = #ripple.track(['B', 'C']);
432
431
  <button
433
432
  class="prepend"
434
433
  onClick={() => {
@@ -446,7 +445,7 @@ export component ForLoopAddAtBeginning() {
446
445
 
447
446
  // Test for loop adding in the middle
448
447
  export component ForLoopAddInMiddle() {
449
- let items = track(['A', 'C']);
448
+ let items = #ripple.track(['A', 'C']);
450
449
  <button
451
450
  class="insert"
452
451
  onClick={() => {
@@ -466,7 +465,7 @@ export component ForLoopAddInMiddle() {
466
465
 
467
466
  // Test for loop removing from the middle
468
467
  export component ForLoopRemoveFromMiddle() {
469
- let items = track(['A', 'B', 'C']);
468
+ let items = #ripple.track(['A', 'B', 'C']);
470
469
  <button
471
470
  class="remove-middle"
472
471
  onClick={() => {
@@ -494,7 +493,7 @@ export component ForLoopLargeList() {
494
493
 
495
494
  // Test for loop with swap operation
496
495
  export component ForLoopSwap() {
497
- let items = track(['A', 'B', 'C', 'D']);
496
+ let items = #ripple.track(['A', 'B', 'C', 'D']);
498
497
  <button
499
498
  class="swap"
500
499
  onClick={() => {
@@ -514,7 +513,7 @@ export component ForLoopSwap() {
514
513
 
515
514
  // Test for loop with reverse operation
516
515
  export component ForLoopReverse() {
517
- let items = track(['A', 'B', 'C', 'D']);
516
+ let items = #ripple.track(['A', 'B', 'C', 'D']);
518
517
  <button
519
518
  class="reverse"
520
519
  onClick={() => {
@@ -1,5 +1,3 @@
1
- import { track } from 'ripple';
2
-
3
1
  // Static title
4
2
  export component StaticTitle() {
5
3
  <head>
@@ -11,7 +9,7 @@ export component StaticTitle() {
11
9
 
12
10
  // Reactive title
13
11
  export component ReactiveTitle() {
14
- let title = track('Initial Title');
12
+ let title = #ripple.track('Initial Title');
15
13
 
16
14
  <head>
17
15
  <title>{@title}</title>
@@ -34,7 +32,7 @@ export component MultipleHeadElements() {
34
32
 
35
33
  // Head with reactive meta tags
36
34
  export component ReactiveMetaTags() {
37
- let description = track('Initial description');
35
+ let description = #ripple.track('Initial description');
38
36
 
39
37
  <head>
40
38
  <title>{'My Page'}</title>
@@ -46,7 +44,7 @@ export component ReactiveMetaTags() {
46
44
 
47
45
  // Title with template literal
48
46
  export component TitleWithTemplate() {
49
- let name = track('World');
47
+ let name = #ripple.track('World');
50
48
 
51
49
  <head>
52
50
  <title>{`Hello ${@name}!`}</title>
@@ -65,8 +63,8 @@ export component EmptyTitle() {
65
63
 
66
64
  // Title with conditional content
67
65
  export component ConditionalTitle() {
68
- let showPrefix = track(true);
69
- let title = track('Main Page');
66
+ let showPrefix = #ripple.track(true);
67
+ let title = #ripple.track('Main Page');
70
68
 
71
69
  <head>
72
70
  <title>{@showPrefix ? 'App - ' + @title : @title}</title>
@@ -77,7 +75,7 @@ export component ConditionalTitle() {
77
75
 
78
76
  // Title with computed value
79
77
  export component ComputedTitle() {
80
- let count = track(0);
78
+ let count = #ripple.track(0);
81
79
  let prefix = 'Count: ';
82
80
 
83
81
  <head>
@@ -3,7 +3,6 @@
3
3
  // that use if/for blocks. After hydration, hydrate_node can be left pointing
4
4
  // deep inside the layout's root element (from nested block processing), which
5
5
  // previously caused branch.s.end to be set incorrectly and target to be null.
6
- import { track } from 'ripple';
7
6
 
8
7
  // A layout component similar to docs-layout: a root div wrapping child components
9
8
  // where the children contain conditional content (if blocks)
@@ -18,7 +17,7 @@ export component Layout({ children }: { children: any }) {
18
17
 
19
18
  // A child component with an if block (the key source of deep hydrate_node)
20
19
  export component Content() {
21
- let visible = track(true);
20
+ let visible = #ripple.track(true);
22
21
 
23
22
  <div class="content">
24
23
  if (@visible) {
@@ -1,5 +1,3 @@
1
- import { track } from 'ripple';
2
-
3
1
  export component StaticHtml() {
4
2
  const html = '<p><strong>Bold</strong> text</p>';
5
3
  <div>{html html}</div>
@@ -229,7 +227,7 @@ component NavItem({
229
227
  }
230
228
 
231
229
  component SidebarSection({ title, children }: { title: string; children: any }) {
232
- let expanded = track(true);
230
+ let expanded = #ripple.track(true);
233
231
  <section class="sidebar-section">
234
232
  <div class="section-header">
235
233
  <h2>{title}</h2>
@@ -1,9 +1,8 @@
1
1
  // Minimal repro for hydration issue with if block containing children
2
2
  // Based on SidebarGroup pattern from website-new
3
- import { track } from 'ripple';
4
3
 
5
4
  export component IfWithChildren({ children }: { children: any }) {
6
- let expanded = track(true);
5
+ let expanded = #ripple.track(true);
7
6
 
8
7
  <div class="container">
9
8
  <div class="header" role="button" onClick={() => (@expanded = !@expanded)}>{'Toggle'}</div>
@@ -28,7 +27,7 @@ export component TestIfWithChildren() {
28
27
 
29
28
  // Simpler variant - if block with static children
30
29
  export component IfWithStaticChildren() {
31
- let expanded = track(true);
30
+ let expanded = #ripple.track(true);
32
31
 
33
32
  <div class="container">
34
33
  <div class="header" role="button" onClick={() => (@expanded = !@expanded)}>{'Toggle'}</div>
@@ -43,7 +42,7 @@ export component IfWithStaticChildren() {
43
42
 
44
43
  // Variant with sibling elements before the if block (like SidebarGroup)
45
44
  export component IfWithSiblingsAndChildren({ children }: { children: any }) {
46
- let expanded = track(true);
45
+ let expanded = #ripple.track(true);
47
46
 
48
47
  <section class="group">
49
48
  <div class="item" role="button" onClick={() => (@expanded = !@expanded)}>
@@ -74,7 +73,7 @@ export component TestIfWithSiblingsAndChildren() {
74
73
  // This tests that hydrate_node is properly restored after processing an element's children
75
74
  // before navigating to a dynamic sibling (if/for/switch)
76
75
  export component ElementWithChildrenThenIf() {
77
- let show = track(true);
76
+ let show = #ripple.track(true);
78
77
 
79
78
  <div class="wrapper">
80
79
  <div class="nested-parent">
@@ -92,7 +91,7 @@ export component ElementWithChildrenThenIf() {
92
91
 
93
92
  // More complex: multiple levels of nesting before if sibling
94
93
  export component DeepNestingThenIf() {
95
- let visible = track(true);
94
+ let visible = #ripple.track(true);
96
95
 
97
96
  <section class="outer">
98
97
  <article class="middle">
@@ -115,7 +114,7 @@ export component DeepNestingThenIf() {
115
114
  // followed by another sibling element. This requires pop() to restore hydrate_node
116
115
  // because we descend into the first element to get the button children.
117
116
  export component DomElementChildrenThenSibling() {
118
- let activeTab = track('code');
117
+ let activeTab = #ripple.track('code');
119
118
 
120
119
  <div class="tabs">
121
120
  <div class="tab-list">
@@ -148,7 +147,7 @@ export component DomElementChildrenThenSibling() {
148
147
  // generate sibling() calls. This was causing incorrect pop() generation before next().
149
148
  // Pattern: <ul> with dynamic <li> children -> static <h2> -> static <p> -> next()
150
149
  export component DomChildrenThenStaticSiblings() {
151
- let count = track(0);
150
+ let count = #ripple.track(0);
152
151
 
153
152
  <div class="container">
154
153
  <ul class="list">