ripple 0.3.72 → 0.3.76

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 (172) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/package.json +3 -3
  3. package/src/jsx-runtime.d.ts +4 -10
  4. package/src/runtime/dynamic-client.js +33 -0
  5. package/src/runtime/dynamic-server.js +80 -0
  6. package/src/runtime/index-client.js +5 -13
  7. package/src/runtime/index-server.js +2 -0
  8. package/src/runtime/internal/client/blocks.js +6 -27
  9. package/src/runtime/internal/client/composite.js +11 -6
  10. package/src/runtime/internal/client/for.js +80 -5
  11. package/src/runtime/internal/client/index.js +0 -2
  12. package/src/runtime/internal/client/render.js +5 -2
  13. package/src/runtime/internal/client/types.d.ts +0 -10
  14. package/src/runtime/internal/server/index.js +8 -1
  15. package/tests/client/__snapshots__/computed-properties.test.tsrx.snap +8 -0
  16. package/tests/client/__snapshots__/for.test.tsrx.snap +22 -0
  17. package/tests/client/__snapshots__/html.test.tsrx.snap +4 -0
  18. package/tests/client/array/array.copy-within.test.tsrx +19 -19
  19. package/tests/client/array/array.derived.test.tsrx +97 -109
  20. package/tests/client/array/array.iteration.test.tsrx +28 -28
  21. package/tests/client/array/array.mutations.test.tsrx +68 -68
  22. package/tests/client/array/array.static.test.tsrx +82 -92
  23. package/tests/client/array/array.to-methods.test.tsrx +15 -15
  24. package/tests/client/async-suspend.test.tsrx +180 -179
  25. package/tests/client/basic/__snapshots__/basic.attributes.test.tsrx.snap +2 -0
  26. package/tests/client/basic/__snapshots__/basic.rendering.test.tsrx.snap +4 -0
  27. package/tests/client/basic/basic.attributes.test.tsrx +273 -317
  28. package/tests/client/basic/basic.collections.test.tsrx +55 -61
  29. package/tests/client/basic/basic.components.test.tsrx +198 -220
  30. package/tests/client/basic/basic.errors.test.tsrx +70 -76
  31. package/tests/client/basic/basic.events.test.tsrx +80 -85
  32. package/tests/client/basic/basic.get-set.test.tsrx +54 -64
  33. package/tests/client/basic/basic.hmr.test.tsrx +15 -19
  34. package/tests/client/basic/basic.reactivity.test.tsrx +121 -135
  35. package/tests/client/basic/basic.rendering.test.tsrx +273 -178
  36. package/tests/client/basic/basic.styling.test.tsrx +16 -14
  37. package/tests/client/basic/basic.utilities.test.tsrx +8 -10
  38. package/tests/client/boundaries.test.tsrx +18 -18
  39. package/tests/client/compiler/compiler.assignments.test.tsrx +77 -76
  40. package/tests/client/compiler/compiler.attributes.test.tsrx +18 -14
  41. package/tests/client/compiler/compiler.basic.test.tsrx +357 -288
  42. package/tests/client/compiler/compiler.regex.test.tsrx +40 -44
  43. package/tests/client/compiler/compiler.tracked-access.test.tsrx +57 -38
  44. package/tests/client/compiler/compiler.try-in-function.test.tsrx +16 -16
  45. package/tests/client/compiler/compiler.typescript.test.tsrx +4 -3
  46. package/tests/client/composite/composite.dynamic-components.test.tsrx +62 -47
  47. package/tests/client/composite/composite.generics.test.tsrx +165 -167
  48. package/tests/client/composite/composite.props.test.tsrx +66 -74
  49. package/tests/client/composite/composite.reactivity.test.tsrx +132 -166
  50. package/tests/client/composite/composite.render.test.tsrx +92 -101
  51. package/tests/client/computed-properties.test.tsrx +14 -18
  52. package/tests/client/context.test.tsrx +14 -18
  53. package/tests/client/css/global-additional-cases.test.tsrx +493 -439
  54. package/tests/client/css/global-advanced-selectors.test.tsrx +169 -153
  55. package/tests/client/css/global-at-rules.test.tsrx +71 -66
  56. package/tests/client/css/global-basic.test.tsrx +105 -98
  57. package/tests/client/css/global-classes-ids.test.tsrx +128 -114
  58. package/tests/client/css/global-combinators.test.tsrx +83 -78
  59. package/tests/client/css/global-complex-nesting.test.tsrx +134 -120
  60. package/tests/client/css/global-edge-cases.test.tsrx +138 -120
  61. package/tests/client/css/global-keyframes.test.tsrx +108 -96
  62. package/tests/client/css/global-nested.test.tsrx +88 -78
  63. package/tests/client/css/global-pseudo.test.tsrx +104 -98
  64. package/tests/client/css/global-scoping.test.tsrx +145 -125
  65. package/tests/client/css/style-identifier.test.tsrx +65 -72
  66. package/tests/client/date.test.tsrx +83 -83
  67. package/tests/client/dynamic-elements.test.tsrx +318 -299
  68. package/tests/client/events.test.tsrx +252 -266
  69. package/tests/client/for.test.tsrx +120 -127
  70. package/tests/client/head.test.tsrx +74 -48
  71. package/tests/client/html.test.tsrx +37 -49
  72. package/tests/client/input-value.test.tsrx +1125 -1354
  73. package/tests/client/lazy-array.test.tsrx +10 -16
  74. package/tests/client/lazy-destructuring.test.tsrx +169 -221
  75. package/tests/client/map.test.tsrx +39 -41
  76. package/tests/client/media-query.test.tsrx +15 -19
  77. package/tests/client/object.test.tsrx +46 -56
  78. package/tests/client/portal.test.tsrx +31 -37
  79. package/tests/client/ref.test.tsrx +173 -193
  80. package/tests/client/return.test.tsrx +62 -37
  81. package/tests/client/set.test.tsrx +33 -33
  82. package/tests/client/svg.test.tsrx +197 -216
  83. package/tests/client/switch.test.tsrx +201 -191
  84. package/tests/client/track-async-hydration.test.tsrx +14 -18
  85. package/tests/client/tracked-index-access.test.tsrx +18 -28
  86. package/tests/client/try.test.tsrx +494 -619
  87. package/tests/client/tsx.test.tsrx +286 -292
  88. package/tests/client/typescript-generics.test.tsrx +121 -129
  89. package/tests/client/url/url.derived.test.tsrx +21 -25
  90. package/tests/client/url/url.parsing.test.tsrx +35 -35
  91. package/tests/client/url/url.partial-removal.test.tsrx +32 -32
  92. package/tests/client/url/url.reactivity.test.tsrx +68 -72
  93. package/tests/client/url/url.serialization.test.tsrx +8 -8
  94. package/tests/client/url-search-params/url-search-params.derived.test.tsrx +21 -27
  95. package/tests/client/url-search-params/url-search-params.initialization.test.tsrx +16 -16
  96. package/tests/client/url-search-params/url-search-params.iteration.test.tsrx +37 -37
  97. package/tests/client/url-search-params/url-search-params.mutation.test.tsrx +56 -60
  98. package/tests/client/url-search-params/url-search-params.retrieval.test.tsrx +32 -34
  99. package/tests/client/url-search-params/url-search-params.serialization.test.tsrx +9 -9
  100. package/tests/client/url-search-params/url-search-params.tracked-url.test.tsrx +10 -10
  101. package/tests/hydration/compiled/client/basic.js +390 -319
  102. package/tests/hydration/compiled/client/composite.js +52 -44
  103. package/tests/hydration/compiled/client/for.js +734 -604
  104. package/tests/hydration/compiled/client/head.js +183 -103
  105. package/tests/hydration/compiled/client/html.js +93 -86
  106. package/tests/hydration/compiled/client/if-children.js +95 -71
  107. package/tests/hydration/compiled/client/if.js +113 -89
  108. package/tests/hydration/compiled/client/mixed-control-flow.js +225 -209
  109. package/tests/hydration/compiled/client/nested-control-flow.js +94 -98
  110. package/tests/hydration/compiled/client/reactivity.js +26 -24
  111. package/tests/hydration/compiled/client/return.js +8 -42
  112. package/tests/hydration/compiled/client/switch.js +208 -173
  113. package/tests/hydration/compiled/client/track-async-serialization.js +176 -128
  114. package/tests/hydration/compiled/client/try.js +29 -21
  115. package/tests/hydration/compiled/server/basic.js +210 -221
  116. package/tests/hydration/compiled/server/composite.js +13 -14
  117. package/tests/hydration/compiled/server/for.js +427 -444
  118. package/tests/hydration/compiled/server/head.js +199 -189
  119. package/tests/hydration/compiled/server/html.js +33 -41
  120. package/tests/hydration/compiled/server/if-children.js +114 -117
  121. package/tests/hydration/compiled/server/if.js +77 -83
  122. package/tests/hydration/compiled/server/mixed-control-flow.js +145 -150
  123. package/tests/hydration/compiled/server/nested-control-flow.js +10 -0
  124. package/tests/hydration/compiled/server/reactivity.js +24 -22
  125. package/tests/hydration/compiled/server/return.js +6 -18
  126. package/tests/hydration/compiled/server/switch.js +179 -176
  127. package/tests/hydration/compiled/server/track-async-serialization.js +88 -70
  128. package/tests/hydration/compiled/server/try.js +31 -35
  129. package/tests/hydration/components/basic.tsrx +216 -258
  130. package/tests/hydration/components/composite.tsrx +32 -42
  131. package/tests/hydration/components/events.tsrx +81 -101
  132. package/tests/hydration/components/for.tsrx +270 -336
  133. package/tests/hydration/components/head.tsrx +43 -39
  134. package/tests/hydration/components/hmr.tsrx +16 -22
  135. package/tests/hydration/components/html-in-template.tsrx +15 -21
  136. package/tests/hydration/components/html.tsrx +442 -526
  137. package/tests/hydration/components/if-children.tsrx +107 -125
  138. package/tests/hydration/components/if.tsrx +68 -90
  139. package/tests/hydration/components/mixed-control-flow.tsrx +65 -72
  140. package/tests/hydration/components/nested-control-flow.tsrx +202 -216
  141. package/tests/hydration/components/portal.tsrx +33 -41
  142. package/tests/hydration/components/reactivity.tsrx +26 -34
  143. package/tests/hydration/components/return.tsrx +4 -6
  144. package/tests/hydration/components/switch.tsrx +73 -78
  145. package/tests/hydration/components/track-async-serialization.tsrx +83 -93
  146. package/tests/hydration/components/try.tsrx +37 -51
  147. package/tests/hydration/switch.test.js +8 -8
  148. package/tests/server/await.test.tsrx +3 -3
  149. package/tests/server/basic.attributes.test.tsrx +117 -162
  150. package/tests/server/basic.components.test.tsrx +164 -194
  151. package/tests/server/basic.test.tsrx +299 -199
  152. package/tests/server/compiler.test.tsrx +142 -72
  153. package/tests/server/composite.props.test.tsrx +54 -58
  154. package/tests/server/composite.test.tsrx +165 -167
  155. package/tests/server/context.test.tsrx +13 -17
  156. package/tests/server/dynamic-elements.test.tsrx +147 -148
  157. package/tests/server/for.test.tsrx +115 -84
  158. package/tests/server/head.test.tsrx +54 -31
  159. package/tests/server/html-nesting-validation.test.tsrx +16 -8
  160. package/tests/server/if.test.tsrx +49 -59
  161. package/tests/server/lazy-destructuring.test.tsrx +288 -366
  162. package/tests/server/return.test.tsrx +58 -36
  163. package/tests/server/streaming-ssr.test.tsrx +4 -4
  164. package/tests/server/style-identifier.test.tsrx +61 -69
  165. package/tests/server/switch.test.tsrx +89 -97
  166. package/tests/server/track-async-serialization.test.tsrx +85 -103
  167. package/tests/server/try.test.tsrx +275 -360
  168. package/tests/utils/ref-types.test.js +72 -0
  169. package/tests/utils/vite-plugin-config.test.js +41 -74
  170. package/types/index.d.ts +29 -4
  171. package/src/runtime/internal/client/compat.js +0 -40
  172. package/tests/utils/compiler-compat-config.test.js +0 -38
@@ -2,13 +2,13 @@ import { RippleURL, RippleURLSearchParams, flushSync, track } from 'ripple';
2
2
 
3
3
  describe('RippleURLSearchParams > iteration', () => {
4
4
  it('handles keys method with reactivity', () => {
5
- function URLTest() {
6
- return <>
7
- const params = RippleURLSearchParams('foo=bar&baz=qux');
8
- let &[keys] = track(() => Array.from(params.keys()));
5
+ function URLTest() @{
6
+ const params = RippleURLSearchParams('foo=bar&baz=qux');
7
+ let &[keys] = track(() => Array.from(params.keys()));
8
+ <>
9
9
  <button onClick={() => params.append('new', 'value')}>{'add param'}</button>
10
10
  <pre>{JSON.stringify(keys)}</pre>
11
- </>;
11
+ </>
12
12
  }
13
13
 
14
14
  render(URLTest);
@@ -26,13 +26,13 @@ describe('RippleURLSearchParams > iteration', () => {
26
26
  });
27
27
 
28
28
  it('handles values method with reactivity', () => {
29
- function URLTest() {
30
- return <>
31
- const params = RippleURLSearchParams('foo=bar&baz=qux');
32
- let &[values] = track(() => Array.from(params.values()));
29
+ function URLTest() @{
30
+ const params = RippleURLSearchParams('foo=bar&baz=qux');
31
+ let &[values] = track(() => Array.from(params.values()));
32
+ <>
33
33
  <button onClick={() => params.set('foo', 'updated')}>{'update foo'}</button>
34
34
  <pre>{JSON.stringify(values)}</pre>
35
- </>;
35
+ </>
36
36
  }
37
37
 
38
38
  render(URLTest);
@@ -50,13 +50,13 @@ describe('RippleURLSearchParams > iteration', () => {
50
50
  });
51
51
 
52
52
  it('handles entries method with reactivity', () => {
53
- function URLTest() {
54
- return <>
55
- const params = RippleURLSearchParams('foo=bar&baz=qux');
56
- let &[entries] = track(() => Array.from(params.entries()));
53
+ function URLTest() @{
54
+ const params = RippleURLSearchParams('foo=bar&baz=qux');
55
+ let &[entries] = track(() => Array.from(params.entries()));
56
+ <>
57
57
  <button onClick={() => params.append('new', 'value')}>{'add param'}</button>
58
58
  <pre>{JSON.stringify(entries)}</pre>
59
- </>;
59
+ </>
60
60
  }
61
61
 
62
62
  render(URLTest);
@@ -76,13 +76,13 @@ describe('RippleURLSearchParams > iteration', () => {
76
76
  });
77
77
 
78
78
  it('handles Symbol.iterator with reactivity', () => {
79
- function URLTest() {
80
- return <>
81
- const params = RippleURLSearchParams('foo=bar&baz=qux');
82
- let &[entries] = track(() => Array.from(params));
79
+ function URLTest() @{
80
+ const params = RippleURLSearchParams('foo=bar&baz=qux');
81
+ let &[entries] = track(() => Array.from(params));
82
+ <>
83
83
  <button onClick={() => params.delete('foo')}>{'delete foo'}</button>
84
84
  <pre>{JSON.stringify(entries)}</pre>
85
- </>;
85
+ </>
86
86
  }
87
87
 
88
88
  render(URLTest);
@@ -100,14 +100,14 @@ describe('RippleURLSearchParams > iteration', () => {
100
100
  });
101
101
 
102
102
  it('handles iteration with for...of', () => {
103
- function URLTest() {
104
- return <>
105
- const params = RippleURLSearchParams('foo=bar&baz=qux');
103
+ function URLTest() @{
104
+ const params = RippleURLSearchParams('foo=bar&baz=qux');
105
+ <>
106
106
  <button onClick={() => params.append('new', 'value')}>{'add param'}</button>
107
- for (const [key, value] of params) {
107
+ @for (const [key, value] of params) {
108
108
  <pre>{`${key}=${value}`}</pre>
109
109
  }
110
- </>;
110
+ </>
111
111
  }
112
112
 
113
113
  render(URLTest);
@@ -128,20 +128,20 @@ describe('RippleURLSearchParams > iteration', () => {
128
128
  });
129
129
 
130
130
  it('handles forEach iteration', () => {
131
- function URLTest() {
132
- return <>
133
- const params = RippleURLSearchParams('a=1&b=2&c=3');
134
- let &[sum] = track(() => {
135
- let total = 0;
136
- // Access the params reactively through entries
137
- for (const [key, value] of params.entries()) {
138
- total += parseInt(value, 10);
139
- }
140
- return total;
141
- });
131
+ function URLTest() @{
132
+ const params = RippleURLSearchParams('a=1&b=2&c=3');
133
+ let &[sum] = track(() => {
134
+ let total = 0;
135
+ // Access the params reactively through entries
136
+ for (const [key, value] of params.entries()) {
137
+ total += parseInt(value, 10);
138
+ }
139
+ return total;
140
+ });
141
+ <>
142
142
  <button onClick={() => params.append('d', '4')}>{'add d=4'}</button>
143
143
  <pre>{sum}</pre>
144
- </>;
144
+ </>
145
145
  }
146
146
 
147
147
  render(URLTest);
@@ -2,13 +2,13 @@ import { RippleURL, RippleURLSearchParams, flushSync, track } from 'ripple';
2
2
 
3
3
  describe('RippleURLSearchParams > mutation', () => {
4
4
  it('handles append operation with reactivity', () => {
5
- function URLTest() {
6
- return <>
7
- const params = RippleURLSearchParams('foo=bar');
5
+ function URLTest() @{
6
+ const params = RippleURLSearchParams('foo=bar');
7
+ <>
8
8
  <button onClick={() => params.append('baz', 'qux')}>{'append'}</button>
9
9
  <pre>{params.toString()}</pre>
10
10
  <pre>{params.size}</pre>
11
- </>;
11
+ </>
12
12
  }
13
13
 
14
14
  render(URLTest);
@@ -28,14 +28,14 @@ describe('RippleURLSearchParams > mutation', () => {
28
28
  });
29
29
 
30
30
  it('handles append with multiple values for same key', () => {
31
- function URLTest() {
32
- return <>
33
- const params = RippleURLSearchParams('foo=bar');
34
- let &[allFoo] = track(() => params.getAll('foo'));
31
+ function URLTest() @{
32
+ const params = RippleURLSearchParams('foo=bar');
33
+ let &[allFoo] = track(() => params.getAll('foo'));
34
+ <>
35
35
  <button onClick={() => params.append('foo', 'baz')}>{'append foo'}</button>
36
36
  <pre>{params.toString()}</pre>
37
37
  <pre>{JSON.stringify(allFoo)}</pre>
38
- </>;
38
+ </>
39
39
  }
40
40
 
41
41
  render(URLTest);
@@ -55,14 +55,14 @@ describe('RippleURLSearchParams > mutation', () => {
55
55
  });
56
56
 
57
57
  it('handles delete operation with reactivity', () => {
58
- function URLTest() {
59
- return <>
60
- const params = RippleURLSearchParams('foo=bar&baz=qux');
58
+ function URLTest() @{
59
+ const params = RippleURLSearchParams('foo=bar&baz=qux');
60
+ <>
61
61
  <button onClick={() => params.delete('foo')}>{'delete foo'}</button>
62
62
  <pre>{params.toString()}</pre>
63
63
  <pre>{params.size}</pre>
64
64
  <pre>{params.has('foo').toString()}</pre>
65
- </>;
65
+ </>
66
66
  }
67
67
 
68
68
  render(URLTest);
@@ -84,13 +84,13 @@ describe('RippleURLSearchParams > mutation', () => {
84
84
  });
85
85
 
86
86
  it('handles delete with specific value', () => {
87
- function URLTest() {
88
- return <>
89
- const params = RippleURLSearchParams('foo=bar&foo=baz&foo=qux');
87
+ function URLTest() @{
88
+ const params = RippleURLSearchParams('foo=bar&foo=baz&foo=qux');
89
+ <>
90
90
  <button onClick={() => params.delete('foo', 'baz')}>{'delete foo=baz'}</button>
91
91
  <pre>{params.toString()}</pre>
92
92
  <pre>{params.size}</pre>
93
- </>;
93
+ </>
94
94
  }
95
95
 
96
96
  render(URLTest);
@@ -110,14 +110,14 @@ describe('RippleURLSearchParams > mutation', () => {
110
110
  });
111
111
 
112
112
  it('handles delete when key does not exist', () => {
113
- function URLTest() {
114
- return <>
115
- const params = RippleURLSearchParams('foo=bar');
116
- let &[reactiveSize] = track(() => params.size);
113
+ function URLTest() @{
114
+ const params = RippleURLSearchParams('foo=bar');
115
+ let &[reactiveSize] = track(() => params.size);
116
+ <>
117
117
  <button onClick={() => params.delete('nonexistent')}>{'delete nonexistent'}</button>
118
118
  <pre>{params.toString()}</pre>
119
119
  <pre>{reactiveSize}</pre>
120
- </>;
120
+ </>
121
121
  }
122
122
 
123
123
  render(URLTest);
@@ -137,14 +137,14 @@ describe('RippleURLSearchParams > mutation', () => {
137
137
  });
138
138
 
139
139
  it('handles set operation with reactivity', () => {
140
- function URLTest() {
141
- return <>
142
- const params = RippleURLSearchParams('foo=bar');
140
+ function URLTest() @{
141
+ const params = RippleURLSearchParams('foo=bar');
142
+ <>
143
143
  <button onClick={() => params.set('foo', 'updated')}>{'update foo'}</button>
144
144
  <button onClick={() => params.set('baz', 'qux')}>{'add baz'}</button>
145
145
  <pre>{params.toString()}</pre>
146
146
  <pre>{params.size}</pre>
147
- </>;
147
+ </>
148
148
  }
149
149
 
150
150
  render(URLTest);
@@ -172,14 +172,14 @@ describe('RippleURLSearchParams > mutation', () => {
172
172
  });
173
173
 
174
174
  it('handles set with multiple existing values', () => {
175
- function URLTest() {
176
- return <>
177
- const params = RippleURLSearchParams('foo=bar&foo=baz&foo=qux');
178
- let &[allFoo] = track(() => params.getAll('foo'));
175
+ function URLTest() @{
176
+ const params = RippleURLSearchParams('foo=bar&foo=baz&foo=qux');
177
+ let &[allFoo] = track(() => params.getAll('foo'));
178
+ <>
179
179
  <button onClick={() => params.set('foo', 'single')}>{'set foo'}</button>
180
180
  <pre>{params.toString()}</pre>
181
181
  <pre>{JSON.stringify(allFoo)}</pre>
182
- </>;
182
+ </>
183
183
  }
184
184
 
185
185
  render(URLTest);
@@ -199,14 +199,14 @@ describe('RippleURLSearchParams > mutation', () => {
199
199
  });
200
200
 
201
201
  it('handles set when value is the same', () => {
202
- function URLTest() {
203
- return <>
204
- const params = RippleURLSearchParams('foo=bar');
205
- let &[reactiveString] = track(() => params.toString());
202
+ function URLTest() @{
203
+ const params = RippleURLSearchParams('foo=bar');
204
+ let &[reactiveString] = track(() => params.toString());
205
+ <>
206
206
  <button onClick={() => params.set('foo', 'bar')}>{'set same value'}</button>
207
207
  <pre>{reactiveString}</pre>
208
208
  <pre>{params.size}</pre>
209
- </>;
209
+ </>
210
210
  }
211
211
 
212
212
  render(URLTest);
@@ -225,12 +225,12 @@ describe('RippleURLSearchParams > mutation', () => {
225
225
  });
226
226
 
227
227
  it('handles sort operation with reactivity', () => {
228
- function URLTest() {
229
- return <>
230
- const params = RippleURLSearchParams('z=last&a=first&m=middle');
228
+ function URLTest() @{
229
+ const params = RippleURLSearchParams('z=last&a=first&m=middle');
230
+ <>
231
231
  <button onClick={() => params.sort()}>{'sort'}</button>
232
232
  <pre>{params.toString()}</pre>
233
- </>;
233
+ </>
234
234
  }
235
235
 
236
236
  render(URLTest);
@@ -248,21 +248,19 @@ describe('RippleURLSearchParams > mutation', () => {
248
248
  });
249
249
 
250
250
  it('handles clearing all params via delete', () => {
251
- function URLTest() {
252
- return <>
253
- const url = RippleURL('https://example.com?foo=bar&baz=qux');
254
- const params = url.searchParams;
251
+ function URLTest() @{
252
+ const url = RippleURL('https://example.com?foo=bar&baz=qux');
253
+ const params = url.searchParams;
254
+ <>
255
255
  <button
256
256
  onClick={() => {
257
257
  params.delete('foo');
258
258
  params.delete('baz');
259
259
  }}
260
- >
261
- {'clear all'}
262
- </button>
260
+ >{'clear all'}</button>
263
261
  <pre>{url.href}</pre>
264
262
  <pre>{params.size}</pre>
265
- </>;
263
+ </>
266
264
  }
267
265
 
268
266
  render(URLTest);
@@ -284,9 +282,9 @@ describe('RippleURLSearchParams > mutation', () => {
284
282
  });
285
283
 
286
284
  it('handles multiple operations in sequence', () => {
287
- function URLTest() {
288
- return <>
289
- const params = RippleURLSearchParams();
285
+ function URLTest() @{
286
+ const params = RippleURLSearchParams();
287
+ <>
290
288
  <button
291
289
  onClick={() => {
292
290
  params.append('a', '1');
@@ -296,12 +294,10 @@ describe('RippleURLSearchParams > mutation', () => {
296
294
  params.append('c', '3');
297
295
  params.sort();
298
296
  }}
299
- >
300
- {'complex operations'}
301
- </button>
297
+ >{'complex operations'}</button>
302
298
  <pre>{params.toString()}</pre>
303
299
  <pre>{params.size}</pre>
304
- </>;
300
+ </>
305
301
  }
306
302
 
307
303
  render(URLTest);
@@ -321,16 +317,16 @@ describe('RippleURLSearchParams > mutation', () => {
321
317
  });
322
318
 
323
319
  it('handles duplicate keys with different values', () => {
324
- function URLTest() {
325
- return <>
326
- const params = RippleURLSearchParams();
327
- let &[tags] = track(() => params.getAll('tag'));
320
+ function URLTest() @{
321
+ const params = RippleURLSearchParams();
322
+ let &[tags] = track(() => params.getAll('tag'));
323
+ <>
328
324
  <button onClick={() => params.append('tag', 'javascript')}>{'add js'}</button>
329
325
  <button onClick={() => params.append('tag', 'typescript')}>{'add ts'}</button>
330
326
  <button onClick={() => params.append('tag', 'ripple')}>{'add ripple'}</button>
331
327
  <pre>{JSON.stringify(tags)}</pre>
332
328
  <pre>{params.size}</pre>
333
- </>;
329
+ </>
334
330
  }
335
331
 
336
332
  render(URLTest);
@@ -2,15 +2,15 @@ import { RippleURL, RippleURLSearchParams, flushSync, track } from 'ripple';
2
2
 
3
3
  describe('RippleURLSearchParams > retrieval', () => {
4
4
  it('handles get operation with reactivity', () => {
5
- function URLTest() {
6
- return <>
7
- const params = RippleURLSearchParams('foo=bar&baz=qux');
8
- let &[foo] = track(() => params.get('foo'));
9
- let &[baz] = track(() => params.get('baz'));
5
+ function URLTest() @{
6
+ const params = RippleURLSearchParams('foo=bar&baz=qux');
7
+ let &[foo] = track(() => params.get('foo'));
8
+ let &[baz] = track(() => params.get('baz'));
9
+ <>
10
10
  <button onClick={() => params.set('foo', 'updated')}>{'update foo'}</button>
11
11
  <pre>{foo}</pre>
12
12
  <pre>{baz}</pre>
13
- </>;
13
+ </>
14
14
  }
15
15
 
16
16
  render(URLTest);
@@ -30,12 +30,10 @@ describe('RippleURLSearchParams > retrieval', () => {
30
30
  });
31
31
 
32
32
  it('handles get for nonexistent key', () => {
33
- function URLTest() {
34
- return <>
35
- const params = RippleURLSearchParams('foo=bar');
36
- let &[nonexistent] = track(() => params.get('nonexistent'));
37
- <pre>{String(nonexistent)}</pre>
38
- </>;
33
+ function URLTest() @{
34
+ const params = RippleURLSearchParams('foo=bar');
35
+ let &[nonexistent] = track(() => params.get('nonexistent'));
36
+ <pre>{String(nonexistent)}</pre>
39
37
  }
40
38
 
41
39
  render(URLTest);
@@ -44,13 +42,13 @@ describe('RippleURLSearchParams > retrieval', () => {
44
42
  });
45
43
 
46
44
  it('handles getAll operation with reactivity', () => {
47
- function URLTest() {
48
- return <>
49
- const params = RippleURLSearchParams('foo=bar&foo=baz');
50
- let &[allFoo] = track(() => params.getAll('foo'));
45
+ function URLTest() @{
46
+ const params = RippleURLSearchParams('foo=bar&foo=baz');
47
+ let &[allFoo] = track(() => params.getAll('foo'));
48
+ <>
51
49
  <button onClick={() => params.append('foo', 'qux')}>{'append foo'}</button>
52
50
  <pre>{JSON.stringify(allFoo)}</pre>
53
- </>;
51
+ </>
54
52
  }
55
53
 
56
54
  render(URLTest);
@@ -68,16 +66,16 @@ describe('RippleURLSearchParams > retrieval', () => {
68
66
  });
69
67
 
70
68
  it('handles has operation with reactivity', () => {
71
- function URLTest() {
72
- return <>
73
- const params = RippleURLSearchParams('foo=bar');
74
- let &[hasFoo] = track(() => params.has('foo'));
75
- let &[hasBaz] = track(() => params.has('baz'));
69
+ function URLTest() @{
70
+ const params = RippleURLSearchParams('foo=bar');
71
+ let &[hasFoo] = track(() => params.has('foo'));
72
+ let &[hasBaz] = track(() => params.has('baz'));
73
+ <>
76
74
  <button onClick={() => params.append('baz', 'qux')}>{'add baz'}</button>
77
75
  <button onClick={() => params.delete('foo')}>{'delete foo'}</button>
78
76
  <pre>{hasFoo.toString()}</pre>
79
77
  <pre>{hasBaz.toString()}</pre>
80
- </>;
78
+ </>
81
79
  }
82
80
 
83
81
  render(URLTest);
@@ -105,15 +103,15 @@ describe('RippleURLSearchParams > retrieval', () => {
105
103
  });
106
104
 
107
105
  it('handles has with specific value', () => {
108
- function URLTest() {
109
- return <>
110
- const params = RippleURLSearchParams('foo=bar&foo=baz');
111
- let &[hasBarValue] = track(() => params.has('foo', 'bar'));
112
- let &[hasQuxValue] = track(() => params.has('foo', 'qux'));
106
+ function URLTest() @{
107
+ const params = RippleURLSearchParams('foo=bar&foo=baz');
108
+ let &[hasBarValue] = track(() => params.has('foo', 'bar'));
109
+ let &[hasQuxValue] = track(() => params.has('foo', 'qux'));
110
+ <>
113
111
  <button onClick={() => params.append('foo', 'qux')}>{'add qux'}</button>
114
112
  <pre>{hasBarValue.toString()}</pre>
115
113
  <pre>{hasQuxValue.toString()}</pre>
116
- </>;
114
+ </>
117
115
  }
118
116
 
119
117
  render(URLTest);
@@ -133,14 +131,14 @@ describe('RippleURLSearchParams > retrieval', () => {
133
131
  });
134
132
 
135
133
  it('handles size property with reactivity', () => {
136
- function URLTest() {
137
- return <>
138
- const params = RippleURLSearchParams('foo=bar');
139
- let &[size] = track(() => params.size);
134
+ function URLTest() @{
135
+ const params = RippleURLSearchParams('foo=bar');
136
+ let &[size] = track(() => params.size);
137
+ <>
140
138
  <button onClick={() => params.append('baz', 'qux')}>{'add'}</button>
141
139
  <button onClick={() => params.delete('foo')}>{'delete'}</button>
142
140
  <pre>{size}</pre>
143
- </>;
141
+ </>
144
142
  }
145
143
 
146
144
  render(URLTest);
@@ -2,13 +2,13 @@ import { RippleURL, RippleURLSearchParams, flushSync, track } from 'ripple';
2
2
 
3
3
  describe('RippleURLSearchParams > serialization', () => {
4
4
  it('handles toString method with reactivity', () => {
5
- function URLTest() {
6
- return <>
7
- const params = RippleURLSearchParams('foo=bar');
8
- let &[string] = track(() => params.toString());
5
+ function URLTest() @{
6
+ const params = RippleURLSearchParams('foo=bar');
7
+ let &[string] = track(() => params.toString());
8
+ <>
9
9
  <button onClick={() => params.append('baz', 'qux')}>{'add'}</button>
10
10
  <pre>{string}</pre>
11
- </>;
11
+ </>
12
12
  }
13
13
 
14
14
  render(URLTest);
@@ -26,13 +26,13 @@ describe('RippleURLSearchParams > serialization', () => {
26
26
  });
27
27
 
28
28
  it('handles special characters encoding', () => {
29
- function URLTest() {
30
- return <>
31
- const params = RippleURLSearchParams();
29
+ function URLTest() @{
30
+ const params = RippleURLSearchParams();
31
+ <>
32
32
  <button onClick={() => params.set('key', 'value with spaces')}>{'add spaces'}</button>
33
33
  <button onClick={() => params.set('special', '!@#$%^&*()')}>{'add special'}</button>
34
34
  <pre>{params.toString()}</pre>
35
- </>;
35
+ </>
36
36
  }
37
37
 
38
38
  render(URLTest);
@@ -2,14 +2,14 @@ import { RippleURL, flushSync } from 'ripple';
2
2
 
3
3
  describe('RippleURLSearchParams > RippleURL integration', () => {
4
4
  it('integrates with RippleURL', () => {
5
- function URLTest() {
6
- return <>
7
- const url = RippleURL('https://example.com?foo=bar');
8
- const params = url.searchParams;
5
+ function URLTest() @{
6
+ const url = RippleURL('https://example.com?foo=bar');
7
+ const params = url.searchParams;
8
+ <>
9
9
  <button onClick={() => params.append('baz', 'qux')}>{'add param'}</button>
10
10
  <pre>{url.href}</pre>
11
11
  <pre>{params.toString()}</pre>
12
- </>;
12
+ </>
13
13
  }
14
14
 
15
15
  render(URLTest);
@@ -31,14 +31,14 @@ describe('RippleURLSearchParams > RippleURL integration', () => {
31
31
  });
32
32
 
33
33
  it('handles empty search string in URL', () => {
34
- function URLTest() {
35
- return <>
36
- const url = RippleURL('https://example.com');
37
- const params = url.searchParams;
34
+ function URLTest() @{
35
+ const url = RippleURL('https://example.com');
36
+ const params = url.searchParams;
37
+ <>
38
38
  <button onClick={() => params.append('foo', 'bar')}>{'add first param'}</button>
39
39
  <pre>{url.href}</pre>
40
40
  <pre>{params.size}</pre>
41
- </>;
41
+ </>
42
42
  }
43
43
 
44
44
  render(URLTest);