ripple 0.3.7 → 0.3.8

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 (100) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.json +2 -2
  3. package/src/compiler/phases/1-parse/index.js +37 -194
  4. package/src/compiler/phases/2-analyze/index.js +63 -18
  5. package/src/compiler/phases/3-transform/client/index.js +19 -3
  6. package/src/compiler/phases/3-transform/server/index.js +16 -24
  7. package/src/compiler/types/parse.d.ts +0 -8
  8. package/src/runtime/internal/client/composite.js +2 -2
  9. package/tests/client/array/array.copy-within.test.ripple +12 -12
  10. package/tests/client/array/array.derived.test.ripple +46 -46
  11. package/tests/client/array/array.iteration.test.ripple +10 -10
  12. package/tests/client/array/array.mutations.test.ripple +20 -20
  13. package/tests/client/array/array.to-methods.test.ripple +6 -6
  14. package/tests/client/async-suspend.test.ripple +5 -5
  15. package/tests/client/basic/basic.attributes.test.ripple +81 -81
  16. package/tests/client/basic/basic.collections.test.ripple +9 -9
  17. package/tests/client/basic/basic.components.test.ripple +28 -28
  18. package/tests/client/basic/basic.errors.test.ripple +18 -18
  19. package/tests/client/basic/basic.events.test.ripple +37 -37
  20. package/tests/client/basic/basic.get-set.test.ripple +6 -6
  21. package/tests/client/basic/basic.reactivity.test.ripple +68 -68
  22. package/tests/client/basic/basic.rendering.test.ripple +19 -19
  23. package/tests/client/basic/basic.utilities.test.ripple +3 -3
  24. package/tests/client/boundaries.test.ripple +12 -12
  25. package/tests/client/compiler/__snapshots__/compiler.assignments.test.ripple.snap +5 -5
  26. package/tests/client/compiler/compiler.assignments.test.ripple +19 -19
  27. package/tests/client/compiler/compiler.basic.test.ripple +16 -16
  28. package/tests/client/compiler/compiler.tracked-access.test.ripple +2 -2
  29. package/tests/client/composite/composite.dynamic-components.test.ripple +9 -9
  30. package/tests/client/composite/composite.props.test.ripple +11 -11
  31. package/tests/client/composite/composite.reactivity.test.ripple +43 -43
  32. package/tests/client/composite/composite.render.test.ripple +3 -3
  33. package/tests/client/computed-properties.test.ripple +4 -4
  34. package/tests/client/date.test.ripple +42 -42
  35. package/tests/client/dynamic-elements.test.ripple +42 -42
  36. package/tests/client/events.test.ripple +70 -70
  37. package/tests/client/for.test.ripple +25 -25
  38. package/tests/client/head.test.ripple +19 -19
  39. package/tests/client/html.test.ripple +3 -3
  40. package/tests/client/input-value.test.ripple +84 -84
  41. package/tests/client/lazy-destructuring.test.ripple +71 -16
  42. package/tests/client/map.test.ripple +16 -16
  43. package/tests/client/media-query.test.ripple +7 -7
  44. package/tests/client/portal.test.ripple +11 -11
  45. package/tests/client/ref.test.ripple +4 -4
  46. package/tests/client/return.test.ripple +52 -52
  47. package/tests/client/set.test.ripple +6 -6
  48. package/tests/client/svg.test.ripple +5 -5
  49. package/tests/client/switch.test.ripple +44 -44
  50. package/tests/client/try.test.ripple +5 -5
  51. package/tests/client/url/url.derived.test.ripple +6 -6
  52. package/tests/client/url-search-params/url-search-params.derived.test.ripple +8 -8
  53. package/tests/client/url-search-params/url-search-params.iteration.test.ripple +10 -10
  54. package/tests/client/url-search-params/url-search-params.mutation.test.ripple +10 -10
  55. package/tests/client/url-search-params/url-search-params.retrieval.test.ripple +18 -18
  56. package/tests/client/url-search-params/url-search-params.serialization.test.ripple +2 -2
  57. package/tests/hydration/compiled/client/events.js +25 -25
  58. package/tests/hydration/compiled/client/for.js +70 -66
  59. package/tests/hydration/compiled/client/head.js +25 -25
  60. package/tests/hydration/compiled/client/hmr.js +2 -2
  61. package/tests/hydration/compiled/client/html.js +3 -3
  62. package/tests/hydration/compiled/client/if-children.js +24 -24
  63. package/tests/hydration/compiled/client/if.js +18 -18
  64. package/tests/hydration/compiled/client/mixed-control-flow.js +9 -9
  65. package/tests/hydration/compiled/client/portal.js +3 -3
  66. package/tests/hydration/compiled/client/reactivity.js +16 -16
  67. package/tests/hydration/compiled/client/return.js +40 -40
  68. package/tests/hydration/compiled/client/switch.js +12 -12
  69. package/tests/hydration/compiled/server/events.js +19 -19
  70. package/tests/hydration/compiled/server/for.js +41 -41
  71. package/tests/hydration/compiled/server/head.js +26 -26
  72. package/tests/hydration/compiled/server/hmr.js +2 -2
  73. package/tests/hydration/compiled/server/html.js +2 -2
  74. package/tests/hydration/compiled/server/if-children.js +16 -16
  75. package/tests/hydration/compiled/server/if.js +11 -11
  76. package/tests/hydration/compiled/server/mixed-control-flow.js +6 -6
  77. package/tests/hydration/compiled/server/portal.js +2 -2
  78. package/tests/hydration/compiled/server/reactivity.js +16 -16
  79. package/tests/hydration/compiled/server/return.js +25 -25
  80. package/tests/hydration/compiled/server/switch.js +8 -8
  81. package/tests/hydration/components/events.ripple +25 -25
  82. package/tests/hydration/components/for.ripple +66 -66
  83. package/tests/hydration/components/head.ripple +16 -16
  84. package/tests/hydration/components/hmr.ripple +2 -2
  85. package/tests/hydration/components/html.ripple +3 -3
  86. package/tests/hydration/components/if-children.ripple +24 -24
  87. package/tests/hydration/components/if.ripple +18 -18
  88. package/tests/hydration/components/mixed-control-flow.ripple +9 -9
  89. package/tests/hydration/components/portal.ripple +3 -3
  90. package/tests/hydration/components/reactivity.ripple +16 -16
  91. package/tests/hydration/components/return.ripple +40 -40
  92. package/tests/hydration/components/switch.ripple +20 -20
  93. package/tests/server/await.test.ripple +3 -3
  94. package/tests/server/basic.attributes.test.ripple +34 -34
  95. package/tests/server/basic.components.test.ripple +10 -10
  96. package/tests/server/basic.test.ripple +38 -40
  97. package/tests/server/composite.props.test.ripple +9 -9
  98. package/tests/server/dynamic-elements.test.ripple +13 -12
  99. package/tests/server/head.test.ripple +11 -11
  100. package/tests/server/lazy-destructuring.test.ripple +27 -4
@@ -60,10 +60,10 @@ describe('RippleSet', () => {
60
60
  it('handles has operation', () => {
61
61
  component SetTest() {
62
62
  let items = new RippleSet([1, 2, 3]);
63
- let hasValue = track(() => items.has(2));
63
+ let &[hasValue] = track(() => items.has(2));
64
64
 
65
65
  <button onClick={() => items.delete(2)}>{'delete'}</button>
66
- <pre>{@hasValue}</pre>
66
+ <pre>{hasValue}</pre>
67
67
  }
68
68
 
69
69
  render(SetTest);
@@ -100,11 +100,11 @@ describe('RippleSet', () => {
100
100
  it('creates RippleSet with initial values using RippleSet() shorthand syntax', () => {
101
101
  component SetTest() {
102
102
  let items = RippleSet([1, 2, 3, 4]);
103
- let hasValue = track(() => items.has(3));
103
+ let &[hasValue] = track(() => items.has(3));
104
104
 
105
105
  <button onClick={() => items.delete(3)}>{'delete'}</button>
106
106
  <pre>{items.size}</pre>
107
- <pre>{@hasValue}</pre>
107
+ <pre>{hasValue}</pre>
108
108
  }
109
109
 
110
110
  render(SetTest);
@@ -123,13 +123,13 @@ describe('RippleSet', () => {
123
123
  it('handles all operations with RippleSet() shorthand syntax', () => {
124
124
  component SetTest() {
125
125
  let items = RippleSet([10, 20, 30]);
126
- let values = track(() => Array.from(items.values()));
126
+ let &[values] = track(() => Array.from(items.values()));
127
127
 
128
128
  <button onClick={() => items.add(40)}>{'add'}</button>
129
129
  <button onClick={() => items.delete(20)}>{'delete'}</button>
130
130
  <button onClick={() => items.clear()}>{'clear'}</button>
131
131
 
132
- <pre>{JSON.stringify(@values)}</pre>
132
+ <pre>{JSON.stringify(values)}</pre>
133
133
  <pre>{items.size}</pre>
134
134
  }
135
135
 
@@ -290,7 +290,7 @@ describe('SVG namespace handling', () => {
290
290
  }
291
291
 
292
292
  component App() {
293
- let dynTag = track('polygon');
293
+ let &[dynTag] = track('polygon');
294
294
  <SVG>
295
295
  <@dynTag points="0,0 30,0 15,10" />
296
296
  </SVG>
@@ -317,7 +317,7 @@ describe('SVG namespace handling', () => {
317
317
  }
318
318
 
319
319
  component App() {
320
- let Component = track(() => Polygon);
320
+ let &[Component] = track(() => Polygon);
321
321
  <SVG>
322
322
  <@Component points="0,0 30,0 15,10" />
323
323
  </SVG>
@@ -334,19 +334,19 @@ describe('SVG namespace handling', () => {
334
334
 
335
335
  it('should render SVG as a dynamic top element with any dynamic children elements', () => {
336
336
  component SVG({ children }: PropsWithChildren<{}>) {
337
- const tag = track('svg');
337
+ let &[tag] = track('svg');
338
338
  <@tag width={100} height={50} fill="red" viewBox="0 0 30 10" preserveAspectRatio="none">
339
339
  <children />
340
340
  </@tag>
341
341
  }
342
342
 
343
343
  component Polygon({ points }: PropsWithExtras<{ points: string }>) {
344
- let dynTag = track('polygon');
344
+ let &[dynTag] = track('polygon');
345
345
  <@dynTag {points} />
346
346
  }
347
347
 
348
348
  component App() {
349
- let Component = track(() => Polygon);
349
+ let &[Component] = track(() => Polygon);
350
350
  <SVG>
351
351
  <@Component points="0,0 30,0 15,10" />
352
352
  </SVG>
@@ -3,12 +3,12 @@ import { flushSync, track } from 'ripple';
3
3
  describe('switch statements', () => {
4
4
  it('renders simple switch with literal cases', () => {
5
5
  component App() {
6
- let value = track('b');
6
+ let &[value] = track('b');
7
7
 
8
- <button onClick={() => (@value = 'c')}>{'Change to C'}</button>
9
- <button onClick={() => (@value = 'a')}>{'Change to A'}</button>
8
+ <button onClick={() => (value = 'c')}>{'Change to C'}</button>
9
+ <button onClick={() => (value = 'a')}>{'Change to A'}</button>
10
10
 
11
- switch (@value) {
11
+ switch (value) {
12
12
  case 'a':
13
13
  <div>{'Case A'}</div>
14
14
  break;
@@ -38,11 +38,11 @@ describe('switch statements', () => {
38
38
 
39
39
  it('renders switch with reactive discriminant', () => {
40
40
  component App() {
41
- let count = track(1);
41
+ let &[count] = track(1);
42
42
 
43
- <button onClick={() => @count++}>{'Increment'}</button>
43
+ <button onClick={() => count++}>{'Increment'}</button>
44
44
 
45
- switch (@count) {
45
+ switch (count) {
46
46
  case 1:
47
47
  <div>{'Count is 1'}</div>
48
48
  break;
@@ -70,13 +70,13 @@ describe('switch statements', () => {
70
70
 
71
71
  it('renders switch with default clause only', () => {
72
72
  component App() {
73
- let value = track('x');
73
+ let &[value] = track('x');
74
74
 
75
- <button onClick={() => (@value = 'y')}>{'Change Value'}</button>
75
+ <button onClick={() => (value = 'y')}>{'Change Value'}</button>
76
76
 
77
- switch (@value) {
77
+ switch (value) {
78
78
  default:
79
- <div>{'Default for ' + @value}</div>
79
+ <div>{'Default for ' + value}</div>
80
80
  }
81
81
  }
82
82
 
@@ -91,12 +91,12 @@ describe('switch statements', () => {
91
91
 
92
92
  it('renders switch using empty case fall-through', () => {
93
93
  component App() {
94
- let value = track('a');
94
+ let &[value] = track('a');
95
95
 
96
- <button onClick={() => (@value = 'b')}>{'Change to B'}</button>
97
- <button onClick={() => (@value = 'c')}>{'Change to C'}</button>
96
+ <button onClick={() => (value = 'b')}>{'Change to B'}</button>
97
+ <button onClick={() => (value = 'c')}>{'Change to C'}</button>
98
98
 
99
- switch (@value) {
99
+ switch (value) {
100
100
  case 'a':
101
101
  <div>{'Case A'}</div>
102
102
  break;
@@ -133,29 +133,29 @@ describe('switch statements', () => {
133
133
 
134
134
  it('renders switch with template content and reacts to tracked changes', () => {
135
135
  component App() {
136
- let status = track('active');
137
- let message = track('');
136
+ let &[status] = track('active');
137
+ let &[message] = track('');
138
138
 
139
- <button onClick={() => (@status = 'pending')}>{'Pending'}</button>
140
- <button onClick={() => (@status = 'completed')}>{'Completed'}</button>
141
- <button onClick={() => (@status = 'error')}>{'Error'}</button>
139
+ <button onClick={() => (status = 'pending')}>{'Pending'}</button>
140
+ <button onClick={() => (status = 'completed')}>{'Completed'}</button>
141
+ <button onClick={() => (status = 'error')}>{'Error'}</button>
142
142
 
143
- switch (@status) {
143
+ switch (status) {
144
144
  case 'active':
145
- @message = 'Currently active.';
146
- <div>{'Status: ' + @message}</div>
145
+ message = 'Currently active.';
146
+ <div>{'Status: ' + message}</div>
147
147
  break;
148
148
  case 'pending':
149
- @message = 'Waiting for completion.';
150
- <div>{'Status: ' + @message}</div>
149
+ message = 'Waiting for completion.';
150
+ <div>{'Status: ' + message}</div>
151
151
  break;
152
152
  case 'completed':
153
- @message = 'Task finished!';
154
- <div class="success">{'Status: ' + @message}</div>
153
+ message = 'Task finished!';
154
+ <div class="success">{'Status: ' + message}</div>
155
155
  break;
156
156
  default:
157
- @message = 'An error occurred.';
158
- <div class="error">{'Status: ' + @message}</div>
157
+ message = 'An error occurred.';
158
+ <div class="error">{'Status: ' + message}</div>
159
159
  }
160
160
  }
161
161
 
@@ -185,9 +185,9 @@ describe('switch statements', () => {
185
185
  'renders switch with multiple non-empty fall-through cases and reacts to tracked changes without recreating DOM unnecessarily',
186
186
  () => {
187
187
  component App() {
188
- let status = track(0);
188
+ let &[status] = track(0);
189
189
  <div>
190
- switch (@status) {
190
+ switch (status) {
191
191
  case -1:
192
192
  case 0:
193
193
  <p>{' Idle'}</p>
@@ -208,7 +208,7 @@ describe('switch statements', () => {
208
208
  </div>
209
209
  <button
210
210
  onClick={() => {
211
- @status = (@status + 1) % 5;
211
+ status = (status + 1) % 5;
212
212
  }}
213
213
  >
214
214
  {'Next Status'}
@@ -253,15 +253,15 @@ describe('switch statements', () => {
253
253
  'renders a fall-through default in the middle of switch cases and reacts to changes without recreating DOM unnecessarily',
254
254
  () => {
255
255
  component App() {
256
- let value = track('x');
256
+ let &[value] = track('x');
257
257
 
258
- <button onClick={() => (@value = 'a')}>{'Set A'}</button>
259
- <button onClick={() => (@value = 'b')}>{'Set B'}</button>
260
- <button onClick={() => (@value = 'c')}>{'Set C'}</button>
261
- <button onClick={() => (@value = 'x')}>{'Set X'}</button>
258
+ <button onClick={() => (value = 'a')}>{'Set A'}</button>
259
+ <button onClick={() => (value = 'b')}>{'Set B'}</button>
260
+ <button onClick={() => (value = 'c')}>{'Set C'}</button>
261
+ <button onClick={() => (value = 'x')}>{'Set X'}</button>
262
262
 
263
263
  <div>
264
- switch (@value) {
264
+ switch (value) {
265
265
  case 'a':
266
266
  <div>{' Case A'}</div>
267
267
  break;
@@ -271,7 +271,7 @@ describe('switch statements', () => {
271
271
  // The browser works correctly.
272
272
  // So, we're just using a defined case in the middle to simulate default.
273
273
  case 'x':
274
- <div>{' Default Case for ' + @value}</div>
274
+ <div>{' Default Case for ' + value}</div>
275
275
  case 'b':
276
276
  <div>{' Case B'}</div>
277
277
  break;
@@ -359,19 +359,19 @@ describe('switch statements', () => {
359
359
 
360
360
  it('renders switch with block-scoped cases and break inside blocks', () => {
361
361
  component App() {
362
- let level = track(1);
362
+ let &[level] = track(1);
363
363
 
364
364
  <button
365
365
  onClick={() => {
366
- if (@level === 1) @level = 2;
367
- else if (@level === 2) @level = 3;
368
- else @level = 1;
366
+ if (level === 1) level = 2;
367
+ else if (level === 2) level = 3;
368
+ else level = 1;
369
369
  }}
370
370
  >
371
371
  {'Toggle'}
372
372
  </button>
373
373
 
374
- switch (@level) {
374
+ switch (level) {
375
375
  case 1: {
376
376
  <div class="level">{'Level 1'}</div>
377
377
  break;
@@ -88,10 +88,10 @@ describe('try block', () => {
88
88
  }
89
89
 
90
90
  component Child() {
91
- let value = track(1);
92
- await Promise.resolve(@value + 1);
91
+ let &[value, valueTracked] = track(1);
92
+ await Promise.resolve(value + 1);
93
93
 
94
- <input type="number" {ref bindValue(value)} />
94
+ <input type="number" {ref bindValue(valueTracked)} />
95
95
  }
96
96
 
97
97
  render(App);
@@ -152,10 +152,10 @@ describe('try block', () => {
152
152
  component FilteredList({ query }: { query: any }) {
153
153
  let items = await Promise.resolve(['apple', 'banana', 'cherry']);
154
154
  let list = RippleArray.from(items);
155
- let filtered = track(() => list.filter((item: string) => item.includes(@query)));
155
+ let &[filtered] = track(() => list.filter((item: string) => item.includes(query.value)));
156
156
 
157
157
  <ul>
158
- for (let item of @filtered) {
158
+ for (let item of filtered) {
159
159
  <li>{item}</li>
160
160
  }
161
161
  </ul>
@@ -4,13 +4,13 @@ describe('RippleURL > derived', () => {
4
4
  it('handles reactive computed properties based on URL', () => {
5
5
  component URLTest() {
6
6
  const url = RippleURL('https://example.com/users/123?tab=profile');
7
- let userId = track(() => url.pathname.split('/').pop());
8
- let activeTab = track(() => url.searchParams.get('tab'));
7
+ let &[userId] = track(() => url.pathname.split('/').pop());
8
+ let &[activeTab] = track(() => url.searchParams.get('tab'));
9
9
 
10
10
  <button onClick={() => (url.pathname = '/users/456')}>{'Change User'}</button>
11
11
  <button onClick={() => url.searchParams.set('tab', 'settings')}>{'Change Tab'}</button>
12
- <pre>{`User ID: ${@userId}`}</pre>
13
- <pre>{`Active Tab: ${@activeTab}`}</pre>
12
+ <pre>{`User ID: ${userId}`}</pre>
13
+ <pre>{`Active Tab: ${activeTab}`}</pre>
14
14
  }
15
15
 
16
16
  render(URLTest);
@@ -57,10 +57,10 @@ describe('RippleURL > derived', () => {
57
57
  }
58
58
 
59
59
  component ChildB({ url }: { url: RippleURL }) {
60
- let count = track(() => url.searchParams.get('count'));
60
+ let &[count] = track(() => url.searchParams.get('count'));
61
61
 
62
62
  <pre>{url.href}</pre>
63
- <pre>{@count}</pre>
63
+ <pre>{count}</pre>
64
64
  }
65
65
 
66
66
  render(ParentTest);
@@ -4,15 +4,15 @@ describe('RippleURLSearchParams > derived', () => {
4
4
  it('handles reactive computed properties based on search params', () => {
5
5
  component URLTest() {
6
6
  const params = RippleURLSearchParams('page=1&limit=10');
7
- let page = track(() => parseInt(params.get('page') || '1', 10));
8
- let limit = track(() => parseInt(params.get('limit') || '10', 10));
9
- let offset = track(() => (@page - 1) * @limit);
7
+ let &[page] = track(() => parseInt(params.get('page') || '1', 10));
8
+ let &[limit] = track(() => parseInt(params.get('limit') || '10', 10));
9
+ let &[offset] = track(() => (page - 1) * limit);
10
10
 
11
11
  <button onClick={() => params.set('page', '2')}>{'next page'}</button>
12
12
  <button onClick={() => params.set('page', '1')}>{'first page'}</button>
13
- <pre>{`Page: ${@page}`}</pre>
14
- <pre>{`Limit: ${@limit}`}</pre>
15
- <pre>{`Offset: ${@offset}`}</pre>
13
+ <pre>{`Page: ${page}`}</pre>
14
+ <pre>{`Limit: ${limit}`}</pre>
15
+ <pre>{`Offset: ${offset}`}</pre>
16
16
  }
17
17
 
18
18
  render(URLTest);
@@ -62,9 +62,9 @@ describe('RippleURLSearchParams > derived', () => {
62
62
  }
63
63
 
64
64
  component ChildB({ params }: { params: RippleURLSearchParams }) {
65
- let count = track(() => params.get('count'));
65
+ let &[count] = track(() => params.get('count'));
66
66
 
67
- <pre>{@count}</pre>
67
+ <pre>{count}</pre>
68
68
  }
69
69
 
70
70
  render(ParentTest);
@@ -4,10 +4,10 @@ describe('RippleURLSearchParams > iteration', () => {
4
4
  it('handles keys method with reactivity', () => {
5
5
  component URLTest() {
6
6
  const params = RippleURLSearchParams('foo=bar&baz=qux');
7
- let keys = track(() => Array.from(params.keys()));
7
+ let &[keys] = track(() => Array.from(params.keys()));
8
8
 
9
9
  <button onClick={() => params.append('new', 'value')}>{'add param'}</button>
10
- <pre>{JSON.stringify(@keys)}</pre>
10
+ <pre>{JSON.stringify(keys)}</pre>
11
11
  }
12
12
 
13
13
  render(URLTest);
@@ -27,10 +27,10 @@ describe('RippleURLSearchParams > iteration', () => {
27
27
  it('handles values method with reactivity', () => {
28
28
  component URLTest() {
29
29
  const params = RippleURLSearchParams('foo=bar&baz=qux');
30
- let values = track(() => Array.from(params.values()));
30
+ let &[values] = track(() => Array.from(params.values()));
31
31
 
32
32
  <button onClick={() => params.set('foo', 'updated')}>{'update foo'}</button>
33
- <pre>{JSON.stringify(@values)}</pre>
33
+ <pre>{JSON.stringify(values)}</pre>
34
34
  }
35
35
 
36
36
  render(URLTest);
@@ -50,10 +50,10 @@ describe('RippleURLSearchParams > iteration', () => {
50
50
  it('handles entries method with reactivity', () => {
51
51
  component URLTest() {
52
52
  const params = RippleURLSearchParams('foo=bar&baz=qux');
53
- let entries = track(() => Array.from(params.entries()));
53
+ let &[entries] = track(() => Array.from(params.entries()));
54
54
 
55
55
  <button onClick={() => params.append('new', 'value')}>{'add param'}</button>
56
- <pre>{JSON.stringify(@entries)}</pre>
56
+ <pre>{JSON.stringify(entries)}</pre>
57
57
  }
58
58
 
59
59
  render(URLTest);
@@ -75,10 +75,10 @@ describe('RippleURLSearchParams > iteration', () => {
75
75
  it('handles Symbol.iterator with reactivity', () => {
76
76
  component URLTest() {
77
77
  const params = RippleURLSearchParams('foo=bar&baz=qux');
78
- let entries = track(() => Array.from(params));
78
+ let &[entries] = track(() => Array.from(params));
79
79
 
80
80
  <button onClick={() => params.delete('foo')}>{'delete foo'}</button>
81
- <pre>{JSON.stringify(@entries)}</pre>
81
+ <pre>{JSON.stringify(entries)}</pre>
82
82
  }
83
83
 
84
84
  render(URLTest);
@@ -126,7 +126,7 @@ describe('RippleURLSearchParams > iteration', () => {
126
126
  it('handles forEach iteration', () => {
127
127
  component URLTest() {
128
128
  const params = RippleURLSearchParams('a=1&b=2&c=3');
129
- let sum = track(() => {
129
+ let &[sum] = track(() => {
130
130
  let total = 0;
131
131
  // Access the params reactively through entries
132
132
  for (const [key, value] of params.entries()) {
@@ -136,7 +136,7 @@ describe('RippleURLSearchParams > iteration', () => {
136
136
  });
137
137
 
138
138
  <button onClick={() => params.append('d', '4')}>{'add d=4'}</button>
139
- <pre>{@sum}</pre>
139
+ <pre>{sum}</pre>
140
140
  }
141
141
 
142
142
  render(URLTest);
@@ -29,11 +29,11 @@ describe('RippleURLSearchParams > mutation', () => {
29
29
  it('handles append with multiple values for same key', () => {
30
30
  component URLTest() {
31
31
  const params = RippleURLSearchParams('foo=bar');
32
- let allFoo = track(() => params.getAll('foo'));
32
+ let &[allFoo] = track(() => params.getAll('foo'));
33
33
 
34
34
  <button onClick={() => params.append('foo', 'baz')}>{'append foo'}</button>
35
35
  <pre>{params.toString()}</pre>
36
- <pre>{JSON.stringify(@allFoo)}</pre>
36
+ <pre>{JSON.stringify(allFoo)}</pre>
37
37
  }
38
38
 
39
39
  render(URLTest);
@@ -108,11 +108,11 @@ describe('RippleURLSearchParams > mutation', () => {
108
108
  it('handles delete when key does not exist', () => {
109
109
  component URLTest() {
110
110
  const params = RippleURLSearchParams('foo=bar');
111
- let reactiveSize = track(() => params.size);
111
+ let &[reactiveSize] = track(() => params.size);
112
112
 
113
113
  <button onClick={() => params.delete('nonexistent')}>{'delete nonexistent'}</button>
114
114
  <pre>{params.toString()}</pre>
115
- <pre>{@reactiveSize}</pre>
115
+ <pre>{reactiveSize}</pre>
116
116
  }
117
117
 
118
118
  render(URLTest);
@@ -168,11 +168,11 @@ describe('RippleURLSearchParams > mutation', () => {
168
168
  it('handles set with multiple existing values', () => {
169
169
  component URLTest() {
170
170
  const params = RippleURLSearchParams('foo=bar&foo=baz&foo=qux');
171
- let allFoo = track(() => params.getAll('foo'));
171
+ let &[allFoo] = track(() => params.getAll('foo'));
172
172
 
173
173
  <button onClick={() => params.set('foo', 'single')}>{'set foo'}</button>
174
174
  <pre>{params.toString()}</pre>
175
- <pre>{JSON.stringify(@allFoo)}</pre>
175
+ <pre>{JSON.stringify(allFoo)}</pre>
176
176
  }
177
177
 
178
178
  render(URLTest);
@@ -194,10 +194,10 @@ describe('RippleURLSearchParams > mutation', () => {
194
194
  it('handles set when value is the same', () => {
195
195
  component URLTest() {
196
196
  const params = RippleURLSearchParams('foo=bar');
197
- let reactiveString = track(() => params.toString());
197
+ let &[reactiveString] = track(() => params.toString());
198
198
 
199
199
  <button onClick={() => params.set('foo', 'bar')}>{'set same value'}</button>
200
- <pre>{@reactiveString}</pre>
200
+ <pre>{reactiveString}</pre>
201
201
  <pre>{params.size}</pre>
202
202
  }
203
203
 
@@ -312,12 +312,12 @@ describe('RippleURLSearchParams > mutation', () => {
312
312
  it('handles duplicate keys with different values', () => {
313
313
  component URLTest() {
314
314
  const params = RippleURLSearchParams();
315
- let tags = track(() => params.getAll('tag'));
315
+ let &[tags] = track(() => params.getAll('tag'));
316
316
 
317
317
  <button onClick={() => params.append('tag', 'javascript')}>{'add js'}</button>
318
318
  <button onClick={() => params.append('tag', 'typescript')}>{'add ts'}</button>
319
319
  <button onClick={() => params.append('tag', 'ripple')}>{'add ripple'}</button>
320
- <pre>{JSON.stringify(@tags)}</pre>
320
+ <pre>{JSON.stringify(tags)}</pre>
321
321
  <pre>{params.size}</pre>
322
322
  }
323
323
 
@@ -4,12 +4,12 @@ describe('RippleURLSearchParams > retrieval', () => {
4
4
  it('handles get operation with reactivity', () => {
5
5
  component URLTest() {
6
6
  const params = RippleURLSearchParams('foo=bar&baz=qux');
7
- let foo = track(() => params.get('foo'));
8
- let baz = track(() => params.get('baz'));
7
+ let &[foo] = track(() => params.get('foo'));
8
+ let &[baz] = track(() => params.get('baz'));
9
9
 
10
10
  <button onClick={() => params.set('foo', 'updated')}>{'update foo'}</button>
11
- <pre>{@foo}</pre>
12
- <pre>{@baz}</pre>
11
+ <pre>{foo}</pre>
12
+ <pre>{baz}</pre>
13
13
  }
14
14
 
15
15
  render(URLTest);
@@ -31,9 +31,9 @@ describe('RippleURLSearchParams > retrieval', () => {
31
31
  it('handles get for nonexistent key', () => {
32
32
  component URLTest() {
33
33
  const params = RippleURLSearchParams('foo=bar');
34
- let nonexistent = track(() => params.get('nonexistent'));
34
+ let &[nonexistent] = track(() => params.get('nonexistent'));
35
35
 
36
- <pre>{String(@nonexistent)}</pre>
36
+ <pre>{String(nonexistent)}</pre>
37
37
  }
38
38
 
39
39
  render(URLTest);
@@ -44,10 +44,10 @@ describe('RippleURLSearchParams > retrieval', () => {
44
44
  it('handles getAll operation with reactivity', () => {
45
45
  component URLTest() {
46
46
  const params = RippleURLSearchParams('foo=bar&foo=baz');
47
- let allFoo = track(() => params.getAll('foo'));
47
+ let &[allFoo] = track(() => params.getAll('foo'));
48
48
 
49
49
  <button onClick={() => params.append('foo', 'qux')}>{'append foo'}</button>
50
- <pre>{JSON.stringify(@allFoo)}</pre>
50
+ <pre>{JSON.stringify(allFoo)}</pre>
51
51
  }
52
52
 
53
53
  render(URLTest);
@@ -67,13 +67,13 @@ describe('RippleURLSearchParams > retrieval', () => {
67
67
  it('handles has operation with reactivity', () => {
68
68
  component URLTest() {
69
69
  const params = RippleURLSearchParams('foo=bar');
70
- let hasFoo = track(() => params.has('foo'));
71
- let hasBaz = track(() => params.has('baz'));
70
+ let &[hasFoo] = track(() => params.has('foo'));
71
+ let &[hasBaz] = track(() => params.has('baz'));
72
72
 
73
73
  <button onClick={() => params.append('baz', 'qux')}>{'add baz'}</button>
74
74
  <button onClick={() => params.delete('foo')}>{'delete foo'}</button>
75
- <pre>{@hasFoo.toString()}</pre>
76
- <pre>{@hasBaz.toString()}</pre>
75
+ <pre>{hasFoo.toString()}</pre>
76
+ <pre>{hasBaz.toString()}</pre>
77
77
  }
78
78
 
79
79
  render(URLTest);
@@ -103,12 +103,12 @@ describe('RippleURLSearchParams > retrieval', () => {
103
103
  it('handles has with specific value', () => {
104
104
  component URLTest() {
105
105
  const params = RippleURLSearchParams('foo=bar&foo=baz');
106
- let hasBarValue = track(() => params.has('foo', 'bar'));
107
- let hasQuxValue = track(() => params.has('foo', 'qux'));
106
+ let &[hasBarValue] = track(() => params.has('foo', 'bar'));
107
+ let &[hasQuxValue] = track(() => params.has('foo', 'qux'));
108
108
 
109
109
  <button onClick={() => params.append('foo', 'qux')}>{'add qux'}</button>
110
- <pre>{@hasBarValue.toString()}</pre>
111
- <pre>{@hasQuxValue.toString()}</pre>
110
+ <pre>{hasBarValue.toString()}</pre>
111
+ <pre>{hasQuxValue.toString()}</pre>
112
112
  }
113
113
 
114
114
  render(URLTest);
@@ -130,11 +130,11 @@ describe('RippleURLSearchParams > retrieval', () => {
130
130
  it('handles size property with reactivity', () => {
131
131
  component URLTest() {
132
132
  const params = RippleURLSearchParams('foo=bar');
133
- let size = track(() => params.size);
133
+ let &[size] = track(() => params.size);
134
134
 
135
135
  <button onClick={() => params.append('baz', 'qux')}>{'add'}</button>
136
136
  <button onClick={() => params.delete('foo')}>{'delete'}</button>
137
- <pre>{@size}</pre>
137
+ <pre>{size}</pre>
138
138
  }
139
139
 
140
140
  render(URLTest);
@@ -4,10 +4,10 @@ describe('RippleURLSearchParams > serialization', () => {
4
4
  it('handles toString method with reactivity', () => {
5
5
  component URLTest() {
6
6
  const params = RippleURLSearchParams('foo=bar');
7
- let string = track(() => params.toString());
7
+ let &[string] = track(() => params.toString());
8
8
 
9
9
  <button onClick={() => params.append('baz', 'qux')}>{'add'}</button>
10
- <pre>{@string}</pre>
10
+ <pre>{string}</pre>
11
11
  }
12
12
 
13
13
  render(URLTest);