ripple 0.2.215 → 0.3.0
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.
- package/CHANGELOG.md +86 -0
- package/package.json +16 -7
- package/src/compiler/errors.js +1 -1
- package/src/compiler/identifier-utils.js +2 -0
- package/src/compiler/index.d.ts +2 -6
- package/src/compiler/phases/1-parse/index.js +171 -233
- package/src/compiler/phases/2-analyze/index.js +216 -16
- package/src/compiler/phases/2-analyze/prune.js +2 -2
- package/src/compiler/phases/3-transform/client/index.js +326 -94
- package/src/compiler/phases/3-transform/segments.js +43 -15
- package/src/compiler/phases/3-transform/server/index.js +71 -21
- package/src/compiler/scope.js +31 -12
- package/src/compiler/source-map-utils.js +4 -6
- package/src/compiler/types/acorn.d.ts +11 -0
- package/src/compiler/types/estree-jsx.d.ts +11 -0
- package/src/compiler/types/estree.d.ts +11 -0
- package/src/compiler/types/import.d.ts +32 -18
- package/src/compiler/types/index.d.ts +75 -23
- package/src/compiler/types/parse.d.ts +7 -10
- package/src/compiler/utils.js +48 -0
- package/src/runtime/array.js +53 -22
- package/src/runtime/date.js +15 -5
- package/src/runtime/index-client.js +41 -7
- package/src/runtime/index-server.js +7 -7
- package/src/runtime/internal/client/bindings.js +2 -2
- package/src/runtime/internal/client/blocks.js +40 -1
- package/src/runtime/internal/client/context.js +8 -0
- package/src/runtime/internal/client/for.js +3 -3
- package/src/runtime/internal/client/index.js +32 -5
- package/src/runtime/internal/client/render.js +20 -8
- package/src/runtime/internal/client/runtime.js +9 -7
- package/src/runtime/internal/client/template.js +1 -1
- package/src/runtime/internal/client/try.js +15 -22
- package/src/runtime/internal/client/utils.js +1 -1
- package/src/runtime/internal/server/context.js +8 -0
- package/src/runtime/internal/server/index.js +99 -6
- package/src/runtime/map.js +7 -7
- package/src/runtime/media-query.js +10 -1
- package/src/runtime/object.js +6 -6
- package/src/runtime/proxy.js +6 -6
- package/src/runtime/set.js +11 -11
- package/src/runtime/url-search-params.js +13 -2
- package/src/runtime/url.js +15 -5
- package/src/utils/builders.js +13 -3
- package/tests/client/array/array.copy-within.test.ripple +11 -11
- package/tests/client/array/array.derived.test.ripple +42 -42
- package/tests/client/array/array.iteration.test.ripple +12 -12
- package/tests/client/array/array.mutations.test.ripple +25 -25
- package/tests/client/array/array.static.test.ripple +103 -106
- package/tests/client/array/array.to-methods.test.ripple +8 -8
- package/tests/client/async-suspend.test.ripple +94 -0
- package/tests/client/basic/basic.attributes.test.ripple +31 -31
- package/tests/client/basic/basic.collections.test.ripple +7 -7
- package/tests/client/basic/basic.components.test.ripple +48 -10
- package/tests/client/basic/basic.errors.test.ripple +111 -30
- package/tests/client/basic/basic.events.test.ripple +11 -11
- package/tests/client/basic/basic.get-set.test.ripple +18 -18
- package/tests/client/basic/basic.reactivity.test.ripple +47 -42
- package/tests/client/basic/basic.rendering.test.ripple +7 -7
- package/tests/client/basic/basic.utilities.test.ripple +4 -4
- package/tests/client/boundaries.test.ripple +7 -7
- package/tests/client/compiler/__snapshots__/compiler.assignments.test.ripple.snap +2 -2
- package/tests/client/compiler/compiler.assignments.test.ripple +21 -21
- package/tests/client/compiler/compiler.basic.test.ripple +223 -82
- package/tests/client/compiler/compiler.tracked-access.test.ripple +8 -9
- package/tests/client/composite/composite.dynamic-components.test.ripple +8 -8
- package/tests/client/composite/composite.generics.test.ripple +4 -4
- package/tests/client/composite/composite.props.test.ripple +9 -9
- package/tests/client/composite/composite.reactivity.test.ripple +32 -26
- package/tests/client/composite/composite.render.test.ripple +13 -4
- package/tests/client/computed-properties.test.ripple +3 -3
- package/tests/client/context.test.ripple +3 -3
- package/tests/client/css/global-additional-cases.test.ripple +4 -4
- package/tests/client/css/style-identifier.test.ripple +49 -41
- package/tests/client/date.test.ripple +40 -40
- package/tests/client/dynamic-elements.test.ripple +165 -30
- package/tests/client/events.test.ripple +25 -25
- package/tests/client/for.test.ripple +76 -8
- package/tests/client/function-overload.test.ripple +0 -1
- package/tests/client/head.test.ripple +7 -7
- package/tests/client/html.test.ripple +2 -2
- package/tests/client/input-value.test.ripple +174 -176
- package/tests/client/map.test.ripple +21 -21
- package/tests/client/media-query.test.ripple +4 -4
- package/tests/client/object.test.ripple +12 -12
- package/tests/client/portal.test.ripple +4 -4
- package/tests/client/ref.test.ripple +5 -5
- package/tests/client/return.test.ripple +17 -17
- package/tests/client/set.test.ripple +16 -16
- package/tests/client/svg.test.ripple +6 -7
- package/tests/client/switch.test.ripple +10 -10
- package/tests/client/tracked-expression.test.ripple +1 -3
- package/tests/client/try.test.ripple +56 -4
- package/tests/client/url/url.derived.test.ripple +10 -9
- package/tests/client/url/url.parsing.test.ripple +10 -10
- package/tests/client/url/url.partial-removal.test.ripple +10 -10
- package/tests/client/url/url.reactivity.test.ripple +17 -17
- package/tests/client/url/url.serialization.test.ripple +4 -4
- package/tests/client/url-search-params/url-search-params.derived.test.ripple +11 -10
- package/tests/client/url-search-params/url-search-params.initialization.test.ripple +5 -7
- package/tests/client/url-search-params/url-search-params.iteration.test.ripple +13 -13
- package/tests/client/url-search-params/url-search-params.mutation.test.ripple +19 -19
- package/tests/client/url-search-params/url-search-params.retrieval.test.ripple +17 -17
- package/tests/client/url-search-params/url-search-params.serialization.test.ripple +5 -5
- package/tests/client/url-search-params/url-search-params.tracked-url.test.ripple +5 -5
- package/tests/hydration/compiled/client/events.js +8 -11
- package/tests/hydration/compiled/client/for.js +20 -23
- package/tests/hydration/compiled/client/head.js +17 -19
- package/tests/hydration/compiled/client/hmr.js +84 -0
- package/tests/hydration/compiled/client/html.js +1 -15
- package/tests/hydration/compiled/client/if-children.js +7 -9
- package/tests/hydration/compiled/client/if.js +5 -7
- package/tests/hydration/compiled/client/mixed-control-flow.js +3 -5
- package/tests/hydration/compiled/client/portal.js +1 -1
- package/tests/hydration/compiled/client/reactivity.js +9 -11
- package/tests/hydration/compiled/client/return.js +11 -13
- package/tests/hydration/compiled/client/switch.js +4 -6
- package/tests/hydration/compiled/server/basic.js +0 -1
- package/tests/hydration/compiled/server/composite.js +0 -3
- package/tests/hydration/compiled/server/events.js +8 -12
- package/tests/hydration/compiled/server/for.js +20 -23
- package/tests/hydration/compiled/server/head.js +17 -19
- package/tests/hydration/compiled/server/hmr.js +107 -0
- package/tests/hydration/compiled/server/html.js +1 -35
- package/tests/hydration/compiled/server/if-children.js +7 -11
- package/tests/hydration/compiled/server/if.js +5 -7
- package/tests/hydration/compiled/server/mixed-control-flow.js +3 -5
- package/tests/hydration/compiled/server/portal.js +1 -9
- package/tests/hydration/compiled/server/reactivity.js +9 -11
- package/tests/hydration/compiled/server/return.js +11 -13
- package/tests/hydration/compiled/server/switch.js +4 -6
- package/tests/hydration/components/events.ripple +8 -9
- package/tests/hydration/components/for.ripple +20 -21
- package/tests/hydration/components/head.ripple +6 -8
- package/tests/hydration/components/hmr.ripple +34 -0
- package/tests/hydration/components/html.ripple +1 -3
- package/tests/hydration/components/if-children.ripple +7 -8
- package/tests/hydration/components/if.ripple +5 -6
- package/tests/hydration/components/mixed-control-flow.ripple +4 -6
- package/tests/hydration/components/portal.ripple +1 -1
- package/tests/hydration/components/reactivity.ripple +9 -10
- package/tests/hydration/components/return.ripple +11 -12
- package/tests/hydration/components/switch.ripple +6 -8
- package/tests/hydration/hmr.test.js +74 -0
- package/tests/server/await.test.ripple +2 -2
- package/tests/server/basic.attributes.test.ripple +19 -21
- package/tests/server/basic.components.test.ripple +13 -7
- package/tests/server/basic.test.ripple +20 -21
- package/tests/server/compiler.test.ripple +5 -5
- package/tests/server/composite.props.test.ripple +6 -7
- package/tests/server/composite.test.ripple +4 -4
- package/tests/server/context.test.ripple +1 -3
- package/tests/server/dynamic-elements.test.ripple +24 -24
- package/tests/server/head.test.ripple +5 -7
- package/tests/server/style-identifier.test.ripple +16 -17
- package/types/index.d.ts +266 -62
- package/types/server.d.ts +6 -6
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
import type { GetFunction, SetFunction } from 'ripple';
|
|
1
2
|
import {
|
|
2
3
|
flushSync,
|
|
3
|
-
|
|
4
|
-
effect,
|
|
5
|
-
untrack,
|
|
6
|
-
TrackedObject,
|
|
4
|
+
RippleObject,
|
|
7
5
|
bindValue,
|
|
8
6
|
bindChecked,
|
|
9
7
|
bindIndeterminate,
|
|
@@ -104,9 +102,9 @@ describe('use value()', () => {
|
|
|
104
102
|
const logs: string[] = [];
|
|
105
103
|
|
|
106
104
|
component App() {
|
|
107
|
-
const text = track('');
|
|
105
|
+
const text = #ripple.track('');
|
|
108
106
|
|
|
109
|
-
effect(() => {
|
|
107
|
+
#ripple.effect(() => {
|
|
110
108
|
logs.push('text changed', @text);
|
|
111
109
|
});
|
|
112
110
|
|
|
@@ -127,9 +125,9 @@ describe('use value()', () => {
|
|
|
127
125
|
const logs: string[] = [];
|
|
128
126
|
|
|
129
127
|
component App() {
|
|
130
|
-
const text = #{ value: '' };
|
|
128
|
+
const text = #ripple{ value: '' };
|
|
131
129
|
|
|
132
|
-
effect(() => {
|
|
130
|
+
#ripple.effect(() => {
|
|
133
131
|
logs.push('text changed', text.value);
|
|
134
132
|
});
|
|
135
133
|
|
|
@@ -150,9 +148,9 @@ describe('use value()', () => {
|
|
|
150
148
|
const logs: string[] = [];
|
|
151
149
|
|
|
152
150
|
component App() {
|
|
153
|
-
const text = track('foo');
|
|
151
|
+
const text = #ripple.track('foo');
|
|
154
152
|
|
|
155
|
-
effect(() => {
|
|
153
|
+
#ripple.effect(() => {
|
|
156
154
|
logs.push('text changed', @text);
|
|
157
155
|
});
|
|
158
156
|
|
|
@@ -174,8 +172,8 @@ describe('use value()', () => {
|
|
|
174
172
|
const logs: string[] = [];
|
|
175
173
|
|
|
176
174
|
component App() {
|
|
177
|
-
const text = #{ value: 'foo' };
|
|
178
|
-
effect(() => {
|
|
175
|
+
const text = #ripple{ value: 'foo' };
|
|
176
|
+
#ripple.effect(() => {
|
|
179
177
|
logs.push('text changed', text.value);
|
|
180
178
|
});
|
|
181
179
|
|
|
@@ -195,7 +193,7 @@ describe('use value()', () => {
|
|
|
195
193
|
|
|
196
194
|
it('should update text input element when tracked value changes', () => {
|
|
197
195
|
component App() {
|
|
198
|
-
const text = track('initial');
|
|
196
|
+
const text = #ripple.track('initial');
|
|
199
197
|
|
|
200
198
|
<div>
|
|
201
199
|
<input type="text" {ref bindValue(text)} />
|
|
@@ -218,7 +216,7 @@ describe('use value()', () => {
|
|
|
218
216
|
|
|
219
217
|
it('should update text input element when tracked value changes with a getter and setter', () => {
|
|
220
218
|
component App() {
|
|
221
|
-
const text = #{ value: 'initial' };
|
|
219
|
+
const text = #ripple{ value: 'initial' };
|
|
222
220
|
|
|
223
221
|
<div>
|
|
224
222
|
<input type="text" {ref bindValue(() => text.value, (v) => (text.value = v))} />
|
|
@@ -243,9 +241,9 @@ describe('use value()', () => {
|
|
|
243
241
|
const logs: (string | boolean)[] = [];
|
|
244
242
|
|
|
245
243
|
component App() {
|
|
246
|
-
const value = track(false);
|
|
244
|
+
const value = #ripple.track(false);
|
|
247
245
|
|
|
248
|
-
effect(() => {
|
|
246
|
+
#ripple.effect(() => {
|
|
249
247
|
logs.push('checked changed', @value);
|
|
250
248
|
});
|
|
251
249
|
|
|
@@ -267,8 +265,8 @@ describe('use value()', () => {
|
|
|
267
265
|
const logs: (string | boolean)[] = [];
|
|
268
266
|
|
|
269
267
|
component App() {
|
|
270
|
-
const obj = #{ value: false };
|
|
271
|
-
effect(() => {
|
|
268
|
+
const obj = #ripple{ value: false };
|
|
269
|
+
#ripple.effect(() => {
|
|
272
270
|
logs.push('checked changed', obj.value);
|
|
273
271
|
});
|
|
274
272
|
|
|
@@ -288,7 +286,7 @@ describe('use value()', () => {
|
|
|
288
286
|
|
|
289
287
|
it('should update checkbox element when tracked value changes', () => {
|
|
290
288
|
component App() {
|
|
291
|
-
const value = track(false);
|
|
289
|
+
const value = #ripple.track(false);
|
|
292
290
|
|
|
293
291
|
<div>
|
|
294
292
|
<input type="checkbox" {ref bindChecked(value)} />
|
|
@@ -311,7 +309,7 @@ describe('use value()', () => {
|
|
|
311
309
|
|
|
312
310
|
it('should update checkbox element when tracked value changes with a getter and setter', () => {
|
|
313
311
|
component App() {
|
|
314
|
-
const obj = #{ value: false };
|
|
312
|
+
const obj = #ripple{ value: false };
|
|
315
313
|
|
|
316
314
|
<div>
|
|
317
315
|
<input
|
|
@@ -339,9 +337,9 @@ describe('use value()', () => {
|
|
|
339
337
|
const logs: (string | boolean)[] = [];
|
|
340
338
|
|
|
341
339
|
component App() {
|
|
342
|
-
const value = track(false);
|
|
340
|
+
const value = #ripple.track(false);
|
|
343
341
|
|
|
344
|
-
effect(() => {
|
|
342
|
+
#ripple.effect(() => {
|
|
345
343
|
logs.push('indeterminate changed', @value);
|
|
346
344
|
});
|
|
347
345
|
|
|
@@ -365,9 +363,9 @@ describe('use value()', () => {
|
|
|
365
363
|
const logs: (string | boolean)[] = [];
|
|
366
364
|
|
|
367
365
|
component App() {
|
|
368
|
-
const obj = #{ value: false };
|
|
366
|
+
const obj = #ripple{ value: false };
|
|
369
367
|
|
|
370
|
-
effect(() => {
|
|
368
|
+
#ripple.effect(() => {
|
|
371
369
|
logs.push('indeterminate changed', obj.value);
|
|
372
370
|
});
|
|
373
371
|
|
|
@@ -392,7 +390,7 @@ describe('use value()', () => {
|
|
|
392
390
|
|
|
393
391
|
it('should update checkbox indeterminate element when tracked value changes', () => {
|
|
394
392
|
component App() {
|
|
395
|
-
const value = track(false);
|
|
393
|
+
const value = #ripple.track(false);
|
|
396
394
|
|
|
397
395
|
<div>
|
|
398
396
|
<input type="checkbox" {ref bindIndeterminate(value)} />
|
|
@@ -417,7 +415,7 @@ describe('use value()', () => {
|
|
|
417
415
|
'should update checkbox indeterminate element when tracked value changes with a getter and setter',
|
|
418
416
|
() => {
|
|
419
417
|
component App() {
|
|
420
|
-
const obj = #{ value: false };
|
|
418
|
+
const obj = #ripple{ value: false };
|
|
421
419
|
|
|
422
420
|
<div>
|
|
423
421
|
<input
|
|
@@ -446,9 +444,9 @@ describe('use value()', () => {
|
|
|
446
444
|
const logs: string[] = [];
|
|
447
445
|
|
|
448
446
|
component App() {
|
|
449
|
-
const select = track('2');
|
|
447
|
+
const select = #ripple.track('2');
|
|
450
448
|
|
|
451
|
-
effect(() => {
|
|
449
|
+
#ripple.effect(() => {
|
|
452
450
|
logs.push('select changed', @select);
|
|
453
451
|
});
|
|
454
452
|
|
|
@@ -475,8 +473,8 @@ describe('use value()', () => {
|
|
|
475
473
|
const logs: string[] = [];
|
|
476
474
|
|
|
477
475
|
component App() {
|
|
478
|
-
const select = #{ value: '2' };
|
|
479
|
-
effect(() => {
|
|
476
|
+
const select = #ripple{ value: '2' };
|
|
477
|
+
#ripple.effect(() => {
|
|
480
478
|
logs.push('select changed', select.value);
|
|
481
479
|
});
|
|
482
480
|
|
|
@@ -501,7 +499,7 @@ describe('use value()', () => {
|
|
|
501
499
|
|
|
502
500
|
it('should update select element when tracked value changes', () => {
|
|
503
501
|
component App() {
|
|
504
|
-
const select = track('1');
|
|
502
|
+
const select = #ripple.track('1');
|
|
505
503
|
|
|
506
504
|
<div>
|
|
507
505
|
<select {ref bindValue(select)}>
|
|
@@ -529,7 +527,7 @@ describe('use value()', () => {
|
|
|
529
527
|
|
|
530
528
|
it('should update select element when tracked value changes with a getter and setter', () => {
|
|
531
529
|
component App() {
|
|
532
|
-
const select = #{ value: '1' };
|
|
530
|
+
const select = #ripple{ value: '1' };
|
|
533
531
|
|
|
534
532
|
<div>
|
|
535
533
|
<select {ref bindValue(() => select.value, (v) => (select.value = v))}>
|
|
@@ -559,9 +557,9 @@ describe('use value()', () => {
|
|
|
559
557
|
const logs: string[] = [];
|
|
560
558
|
|
|
561
559
|
component App() {
|
|
562
|
-
const selected = track(['b']);
|
|
560
|
+
const selected = #ripple.track(['b']);
|
|
563
561
|
|
|
564
|
-
effect(() => {
|
|
562
|
+
#ripple.effect(() => {
|
|
565
563
|
logs.push('selected changed', JSON.stringify(@selected));
|
|
566
564
|
});
|
|
567
565
|
|
|
@@ -607,9 +605,9 @@ describe('use value()', () => {
|
|
|
607
605
|
const logs: string[] = [];
|
|
608
606
|
|
|
609
607
|
component App() {
|
|
610
|
-
const obj = #{ selected: ['b'] };
|
|
608
|
+
const obj = #ripple{ selected: ['b'] };
|
|
611
609
|
|
|
612
|
-
effect(() => {
|
|
610
|
+
#ripple.effect(() => {
|
|
613
611
|
logs.push('selected changed', JSON.stringify(obj.selected));
|
|
614
612
|
});
|
|
615
613
|
|
|
@@ -667,9 +665,9 @@ describe('use value()', () => {
|
|
|
667
665
|
const logs: string[] = [];
|
|
668
666
|
|
|
669
667
|
component App() {
|
|
670
|
-
const selected = track('b');
|
|
668
|
+
const selected = #ripple.track('b');
|
|
671
669
|
|
|
672
|
-
effect(() => {
|
|
670
|
+
#ripple.effect(() => {
|
|
673
671
|
logs.push('selected changed', @selected);
|
|
674
672
|
});
|
|
675
673
|
|
|
@@ -714,9 +712,9 @@ describe('use value()', () => {
|
|
|
714
712
|
const logs: string[] = [];
|
|
715
713
|
|
|
716
714
|
component App() {
|
|
717
|
-
const selected = #{ value: 'b' };
|
|
715
|
+
const selected = #ripple{ value: 'b' };
|
|
718
716
|
|
|
719
|
-
effect(() => {
|
|
717
|
+
#ripple.effect(() => {
|
|
720
718
|
logs.push('selected changed', selected.value);
|
|
721
719
|
});
|
|
722
720
|
|
|
@@ -774,7 +772,7 @@ describe('use value()', () => {
|
|
|
774
772
|
|
|
775
773
|
it('should update checkbox group from tracked value change', () => {
|
|
776
774
|
component App() {
|
|
777
|
-
const selected = track(['a']);
|
|
775
|
+
const selected = #ripple.track(['a']);
|
|
778
776
|
|
|
779
777
|
<div>
|
|
780
778
|
<input type="checkbox" value="a" {ref bindGroup(selected)} />
|
|
@@ -804,7 +802,7 @@ describe('use value()', () => {
|
|
|
804
802
|
|
|
805
803
|
it('should update checkbox group from tracked value change with a getter and setter', () => {
|
|
806
804
|
component App() {
|
|
807
|
-
const selected = #{ value: ['a'] };
|
|
805
|
+
const selected = #ripple{ value: ['a'] };
|
|
808
806
|
|
|
809
807
|
<div>
|
|
810
808
|
<input
|
|
@@ -846,7 +844,7 @@ describe('use value()', () => {
|
|
|
846
844
|
|
|
847
845
|
it('should update radio group from tracked value change', () => {
|
|
848
846
|
component App() {
|
|
849
|
-
const selected = track('a');
|
|
847
|
+
const selected = #ripple.track('a');
|
|
850
848
|
|
|
851
849
|
<div>
|
|
852
850
|
<input type="radio" name="test" value="a" {ref bindGroup(selected)} />
|
|
@@ -876,7 +874,7 @@ describe('use value()', () => {
|
|
|
876
874
|
|
|
877
875
|
it('should update radio group from tracked value change with a getter and setter', () => {
|
|
878
876
|
component App() {
|
|
879
|
-
const selected = #{ value: 'a' };
|
|
877
|
+
const selected = #ripple{ value: 'a' };
|
|
880
878
|
|
|
881
879
|
<div>
|
|
882
880
|
<input
|
|
@@ -921,7 +919,7 @@ describe('use value()', () => {
|
|
|
921
919
|
|
|
922
920
|
it('should handle checkbox group with initial empty array', () => {
|
|
923
921
|
component App() {
|
|
924
|
-
const selected = track([]);
|
|
922
|
+
const selected = #ripple.track([]);
|
|
925
923
|
|
|
926
924
|
<div>
|
|
927
925
|
<input type="checkbox" value="a" {ref bindGroup(selected)} />
|
|
@@ -947,7 +945,7 @@ describe('use value()', () => {
|
|
|
947
945
|
|
|
948
946
|
it('should handle checkbox group with initial empty array with a getter and setter', () => {
|
|
949
947
|
component App() {
|
|
950
|
-
const selected:
|
|
948
|
+
const selected: RippleObject<{ value: string[] }> = #ripple{ value: [] };
|
|
951
949
|
|
|
952
950
|
<div>
|
|
953
951
|
<input
|
|
@@ -981,7 +979,7 @@ describe('use value()', () => {
|
|
|
981
979
|
|
|
982
980
|
it('should handle number input type', () => {
|
|
983
981
|
component App() {
|
|
984
|
-
const value = track(42);
|
|
982
|
+
const value = #ripple.track(42);
|
|
985
983
|
|
|
986
984
|
<input type="number" {ref bindValue(value)} />
|
|
987
985
|
}
|
|
@@ -1001,7 +999,7 @@ describe('use value()', () => {
|
|
|
1001
999
|
|
|
1002
1000
|
it('should handle number input type with a getter and setter', () => {
|
|
1003
1001
|
component App() {
|
|
1004
|
-
const obj = #{ value: 42 };
|
|
1002
|
+
const obj = #ripple{ value: 42 };
|
|
1005
1003
|
|
|
1006
1004
|
<input type="number" {ref bindValue(() => obj.value, (v) => (obj.value = v))} />
|
|
1007
1005
|
}
|
|
@@ -1021,7 +1019,7 @@ describe('use value()', () => {
|
|
|
1021
1019
|
|
|
1022
1020
|
it('should update number input element when tracked value changes', () => {
|
|
1023
1021
|
component App() {
|
|
1024
|
-
const value = track(10);
|
|
1022
|
+
const value = #ripple.track(10);
|
|
1025
1023
|
|
|
1026
1024
|
<div>
|
|
1027
1025
|
<input type="number" {ref bindValue(value)} />
|
|
@@ -1047,7 +1045,7 @@ describe('use value()', () => {
|
|
|
1047
1045
|
'should update number input element when tracked value changes with a getter and setter',
|
|
1048
1046
|
() => {
|
|
1049
1047
|
component App() {
|
|
1050
|
-
const obj = #{ value: 10 };
|
|
1048
|
+
const obj = #ripple{ value: 10 };
|
|
1051
1049
|
|
|
1052
1050
|
<div>
|
|
1053
1051
|
<input type="number" {ref bindValue(() => obj.value, (v) => (obj.value = v))} />
|
|
@@ -1072,7 +1070,7 @@ describe('use value()', () => {
|
|
|
1072
1070
|
|
|
1073
1071
|
it('should handle range input type', () => {
|
|
1074
1072
|
component App() {
|
|
1075
|
-
const value = track(50);
|
|
1073
|
+
const value = #ripple.track(50);
|
|
1076
1074
|
|
|
1077
1075
|
<input type="range" min="0" max="100" {ref bindValue(value)} />
|
|
1078
1076
|
}
|
|
@@ -1092,7 +1090,7 @@ describe('use value()', () => {
|
|
|
1092
1090
|
|
|
1093
1091
|
it('should handle range input type with a getter and setter', () => {
|
|
1094
1092
|
component App() {
|
|
1095
|
-
const obj = #{ value: 50 };
|
|
1093
|
+
const obj = #ripple{ value: 50 };
|
|
1096
1094
|
|
|
1097
1095
|
<input
|
|
1098
1096
|
type="range"
|
|
@@ -1117,7 +1115,7 @@ describe('use value()', () => {
|
|
|
1117
1115
|
|
|
1118
1116
|
it('should update range input element when tracked value changes', () => {
|
|
1119
1117
|
component App() {
|
|
1120
|
-
const value = track(25);
|
|
1118
|
+
const value = #ripple.track(25);
|
|
1121
1119
|
|
|
1122
1120
|
<div>
|
|
1123
1121
|
<input type="range" min="0" max="100" {ref bindValue(value)} />
|
|
@@ -1143,7 +1141,7 @@ describe('use value()', () => {
|
|
|
1143
1141
|
'should update range input element when tracked value changes with a getter and setter',
|
|
1144
1142
|
() => {
|
|
1145
1143
|
component App() {
|
|
1146
|
-
const obj = #{ value: 25 };
|
|
1144
|
+
const obj = #ripple{ value: 25 };
|
|
1147
1145
|
|
|
1148
1146
|
<div>
|
|
1149
1147
|
<input
|
|
@@ -1173,7 +1171,7 @@ describe('use value()', () => {
|
|
|
1173
1171
|
|
|
1174
1172
|
it('should handle empty number input as null', () => {
|
|
1175
1173
|
component App() {
|
|
1176
|
-
const value = track(null);
|
|
1174
|
+
const value = #ripple.track(null);
|
|
1177
1175
|
|
|
1178
1176
|
<input type="number" {ref bindValue(value)} />
|
|
1179
1177
|
}
|
|
@@ -1193,7 +1191,7 @@ describe('use value()', () => {
|
|
|
1193
1191
|
|
|
1194
1192
|
it('should handle empty number input as null with a getter and setter', () => {
|
|
1195
1193
|
component App() {
|
|
1196
|
-
const obj = #{ value: null };
|
|
1194
|
+
const obj = #ripple{ value: null };
|
|
1197
1195
|
|
|
1198
1196
|
<input type="number" {ref bindValue(() => obj.value, (v) => (obj.value = v))} />
|
|
1199
1197
|
}
|
|
@@ -1213,7 +1211,7 @@ describe('use value()', () => {
|
|
|
1213
1211
|
|
|
1214
1212
|
it('should handle date input type', () => {
|
|
1215
1213
|
component App() {
|
|
1216
|
-
const value = track('2025-11-14');
|
|
1214
|
+
const value = #ripple.track('2025-11-14');
|
|
1217
1215
|
|
|
1218
1216
|
<input type="date" {ref bindValue(value)} />
|
|
1219
1217
|
}
|
|
@@ -1233,7 +1231,7 @@ describe('use value()', () => {
|
|
|
1233
1231
|
|
|
1234
1232
|
it('should handle date input type with a getter and setter', () => {
|
|
1235
1233
|
component App() {
|
|
1236
|
-
const obj = #{ value: '2025-11-14' };
|
|
1234
|
+
const obj = #ripple{ value: '2025-11-14' };
|
|
1237
1235
|
|
|
1238
1236
|
<input type="date" {ref bindValue(() => obj.value, (v) => (obj.value = v))} />
|
|
1239
1237
|
}
|
|
@@ -1253,7 +1251,7 @@ describe('use value()', () => {
|
|
|
1253
1251
|
|
|
1254
1252
|
it('should update date input element when tracked value changes', () => {
|
|
1255
1253
|
component App() {
|
|
1256
|
-
const value = track('2025-01-01');
|
|
1254
|
+
const value = #ripple.track('2025-01-01');
|
|
1257
1255
|
|
|
1258
1256
|
<div>
|
|
1259
1257
|
<input type="date" {ref bindValue(value)} />
|
|
@@ -1277,7 +1275,7 @@ describe('use value()', () => {
|
|
|
1277
1275
|
|
|
1278
1276
|
it('should update date input element when tracked value changes with a getter and setter', () => {
|
|
1279
1277
|
component App() {
|
|
1280
|
-
const obj = #{ value: '2025-01-01' };
|
|
1278
|
+
const obj = #ripple{ value: '2025-01-01' };
|
|
1281
1279
|
|
|
1282
1280
|
<div>
|
|
1283
1281
|
<input type="date" {ref bindValue(() => obj.value, (v) => (obj.value = v))} />
|
|
@@ -1301,7 +1299,7 @@ describe('use value()', () => {
|
|
|
1301
1299
|
|
|
1302
1300
|
it('should handle select with multiple attribute', () => {
|
|
1303
1301
|
component App() {
|
|
1304
|
-
const selected = track(['2', '3']);
|
|
1302
|
+
const selected = #ripple.track(['2', '3']);
|
|
1305
1303
|
|
|
1306
1304
|
<select multiple {ref bindValue(selected)}>
|
|
1307
1305
|
<option value="1">{'One'}</option>
|
|
@@ -1335,7 +1333,7 @@ describe('use value()', () => {
|
|
|
1335
1333
|
|
|
1336
1334
|
it('should handle select with multiple attribute with a getter and setter', () => {
|
|
1337
1335
|
component App() {
|
|
1338
|
-
const selected = track(['2', '3']);
|
|
1336
|
+
const selected = #ripple.track(['2', '3']);
|
|
1339
1337
|
|
|
1340
1338
|
<select multiple {ref bindValue(() => @selected, (v) => (@selected = v))}>
|
|
1341
1339
|
<option value="1">{'One'}</option>
|
|
@@ -1369,7 +1367,7 @@ describe('use value()', () => {
|
|
|
1369
1367
|
|
|
1370
1368
|
it('should update multiple select element when tracked value changes', () => {
|
|
1371
1369
|
component App() {
|
|
1372
|
-
const selected = track(['1']);
|
|
1370
|
+
const selected = #ripple.track(['1']);
|
|
1373
1371
|
|
|
1374
1372
|
<div>
|
|
1375
1373
|
<select multiple {ref bindValue(selected)}>
|
|
@@ -1407,7 +1405,7 @@ describe('use value()', () => {
|
|
|
1407
1405
|
'should update multiple select element when tracked value changes with a getter and setter',
|
|
1408
1406
|
() => {
|
|
1409
1407
|
component App() {
|
|
1410
|
-
const selected = track(['1']);
|
|
1408
|
+
const selected = #ripple.track(['1']);
|
|
1411
1409
|
|
|
1412
1410
|
<div>
|
|
1413
1411
|
<select multiple {ref bindValue(() => @selected, (v) => (@selected = v))}>
|
|
@@ -1444,7 +1442,7 @@ describe('use value()', () => {
|
|
|
1444
1442
|
|
|
1445
1443
|
it('should handle select without initial value and fall back to first option', () => {
|
|
1446
1444
|
component App() {
|
|
1447
|
-
const selected = track(
|
|
1445
|
+
const selected = #ripple.track();
|
|
1448
1446
|
|
|
1449
1447
|
<select {ref bindValue(selected)}>
|
|
1450
1448
|
<option value="1">{'One'}</option>
|
|
@@ -1464,7 +1462,7 @@ describe('use value()', () => {
|
|
|
1464
1462
|
'should handle select without initial value and fall back to first option with a getter and setter',
|
|
1465
1463
|
() => {
|
|
1466
1464
|
component App() {
|
|
1467
|
-
const selected = track(
|
|
1465
|
+
const selected = #ripple.track();
|
|
1468
1466
|
|
|
1469
1467
|
<select {ref bindValue(() => @selected, (v) => (@selected = v))}>
|
|
1470
1468
|
<option value="1">{'One'}</option>
|
|
@@ -1483,7 +1481,7 @@ describe('use value()', () => {
|
|
|
1483
1481
|
|
|
1484
1482
|
it('should handle select with disabled options', () => {
|
|
1485
1483
|
component App() {
|
|
1486
|
-
const selected = track(
|
|
1484
|
+
const selected = #ripple.track();
|
|
1487
1485
|
|
|
1488
1486
|
<select {ref bindValue(selected)}>
|
|
1489
1487
|
<option value="1" disabled>{'One'}</option>
|
|
@@ -1501,7 +1499,7 @@ describe('use value()', () => {
|
|
|
1501
1499
|
|
|
1502
1500
|
it('should handle select with disabled options with a getter and setter', () => {
|
|
1503
1501
|
component App() {
|
|
1504
|
-
const selected = track(
|
|
1502
|
+
const selected = #ripple.track();
|
|
1505
1503
|
|
|
1506
1504
|
<select {ref bindValue(() => @selected, (v) => (@selected = v))}>
|
|
1507
1505
|
<option value="1" disabled>{'One'}</option>
|
|
@@ -1519,7 +1517,7 @@ describe('use value()', () => {
|
|
|
1519
1517
|
|
|
1520
1518
|
it('should accurately reflect values mutated through a tracked setter', () => {
|
|
1521
1519
|
component App() {
|
|
1522
|
-
let value = track(
|
|
1520
|
+
let value = #ripple.track(
|
|
1523
1521
|
'',
|
|
1524
1522
|
(val) => {
|
|
1525
1523
|
return val;
|
|
@@ -1555,7 +1553,7 @@ describe('use value()', () => {
|
|
|
1555
1553
|
|
|
1556
1554
|
it('should accurately reflect values when a getter modifies value', () => {
|
|
1557
1555
|
component App() {
|
|
1558
|
-
let value = track(
|
|
1556
|
+
let value = #ripple.track(
|
|
1559
1557
|
'',
|
|
1560
1558
|
(val) => {
|
|
1561
1559
|
if (val.includes('c')) {
|
|
@@ -1591,7 +1589,7 @@ describe('use value()', () => {
|
|
|
1591
1589
|
|
|
1592
1590
|
it('should always prefer what getter returns even if setter mutates next', () => {
|
|
1593
1591
|
component App() {
|
|
1594
|
-
let value = track(
|
|
1592
|
+
let value = #ripple.track(
|
|
1595
1593
|
'',
|
|
1596
1594
|
(val) => {
|
|
1597
1595
|
return val.replace(/[c,b]+/g, '');
|
|
@@ -1629,7 +1627,7 @@ describe('use value()', () => {
|
|
|
1629
1627
|
'should accurately reflect values mutated through an effect even after a setter mutation',
|
|
1630
1628
|
() => {
|
|
1631
1629
|
component App() {
|
|
1632
|
-
let value = track(
|
|
1630
|
+
let value = #ripple.track(
|
|
1633
1631
|
'',
|
|
1634
1632
|
(val) => {
|
|
1635
1633
|
return val;
|
|
@@ -1642,10 +1640,10 @@ describe('use value()', () => {
|
|
|
1642
1640
|
},
|
|
1643
1641
|
);
|
|
1644
1642
|
|
|
1645
|
-
effect(() => {
|
|
1643
|
+
#ripple.effect(() => {
|
|
1646
1644
|
@value;
|
|
1647
1645
|
|
|
1648
|
-
untrack(() => {
|
|
1646
|
+
#ripple.untrack(() => {
|
|
1649
1647
|
if (@value.includes('a')) {
|
|
1650
1648
|
@value = @value.replace(/a/g, '');
|
|
1651
1649
|
}
|
|
@@ -1675,8 +1673,8 @@ describe('use value()', () => {
|
|
|
1675
1673
|
|
|
1676
1674
|
it('should accurately reflect values mutated through a tracked setter via bind accessors', () => {
|
|
1677
1675
|
component App() {
|
|
1678
|
-
let value = track('');
|
|
1679
|
-
const value_accessors = [
|
|
1676
|
+
let value = #ripple.track('');
|
|
1677
|
+
const value_accessors: [GetFunction<string>, SetFunction<string>] = [
|
|
1680
1678
|
() => {
|
|
1681
1679
|
return @value;
|
|
1682
1680
|
},
|
|
@@ -1707,8 +1705,8 @@ describe('use value()', () => {
|
|
|
1707
1705
|
|
|
1708
1706
|
it('should prefer what getter returns via bind accessors', () => {
|
|
1709
1707
|
component App() {
|
|
1710
|
-
let value = track('');
|
|
1711
|
-
const value_accessors = [
|
|
1708
|
+
let value = #ripple.track('');
|
|
1709
|
+
const value_accessors: [GetFunction<string>, SetFunction<string>] = [
|
|
1712
1710
|
() => {
|
|
1713
1711
|
if (@value.includes('c')) {
|
|
1714
1712
|
return @value.replace(/c/g, '');
|
|
@@ -1741,8 +1739,8 @@ describe('use value()', () => {
|
|
|
1741
1739
|
'should always prefer what getter returns even if setter mutates next via bind accessors',
|
|
1742
1740
|
() => {
|
|
1743
1741
|
component App() {
|
|
1744
|
-
let value = track('');
|
|
1745
|
-
const value_accessors = [
|
|
1742
|
+
let value = #ripple.track('');
|
|
1743
|
+
const value_accessors: [GetFunction<string>, SetFunction<string>] = [
|
|
1746
1744
|
() => {
|
|
1747
1745
|
return @value.replace(/[c,b]+/g, '');
|
|
1748
1746
|
},
|
|
@@ -1776,8 +1774,8 @@ describe('use value()', () => {
|
|
|
1776
1774
|
'should accurately reflect values mutated through an effect even after a setter mutation via bind accessors',
|
|
1777
1775
|
() => {
|
|
1778
1776
|
component App() {
|
|
1779
|
-
let value = track('');
|
|
1780
|
-
const value_accessors = [
|
|
1777
|
+
let value = #ripple.track('');
|
|
1778
|
+
const value_accessors: [GetFunction<string>, SetFunction<string>] = [
|
|
1781
1779
|
() => {
|
|
1782
1780
|
return @value;
|
|
1783
1781
|
},
|
|
@@ -1789,10 +1787,10 @@ describe('use value()', () => {
|
|
|
1789
1787
|
},
|
|
1790
1788
|
];
|
|
1791
1789
|
|
|
1792
|
-
effect(() => {
|
|
1790
|
+
#ripple.effect(() => {
|
|
1793
1791
|
@value;
|
|
1794
1792
|
|
|
1795
|
-
untrack(() => {
|
|
1793
|
+
#ripple.untrack(() => {
|
|
1796
1794
|
if (@value.includes('a')) {
|
|
1797
1795
|
@value = @value.replace(/a/g, '');
|
|
1798
1796
|
}
|
|
@@ -1820,8 +1818,8 @@ describe('use value()', () => {
|
|
|
1820
1818
|
'should keep the input.value unchanged and synced with the tracked when the setter blocks updates to the tracked via bind accessors',
|
|
1821
1819
|
() => {
|
|
1822
1820
|
component App() {
|
|
1823
|
-
let value = track('');
|
|
1824
|
-
const value_accessors = [
|
|
1821
|
+
let value = #ripple.track('');
|
|
1822
|
+
const value_accessors: [GetFunction<string>, SetFunction<string>] = [
|
|
1825
1823
|
() => {
|
|
1826
1824
|
return @value;
|
|
1827
1825
|
},
|
|
@@ -1855,7 +1853,7 @@ describe('use value()', () => {
|
|
|
1855
1853
|
'should keep the input.value unchanged and synced with the tracked when the setter blocks updates to the tracked via track get / set',
|
|
1856
1854
|
() => {
|
|
1857
1855
|
component App() {
|
|
1858
|
-
let value = track(
|
|
1856
|
+
let value = #ripple.track(
|
|
1859
1857
|
'',
|
|
1860
1858
|
(v) => {
|
|
1861
1859
|
return v;
|
|
@@ -1892,9 +1890,9 @@ describe('bindClientWidth and bindClientHeight', () => {
|
|
|
1892
1890
|
const logs: number[] = [];
|
|
1893
1891
|
|
|
1894
1892
|
component App() {
|
|
1895
|
-
const width = track(0);
|
|
1893
|
+
const width = #ripple.track(0);
|
|
1896
1894
|
|
|
1897
|
-
effect(() => {
|
|
1895
|
+
#ripple.effect(() => {
|
|
1898
1896
|
logs.push(@width);
|
|
1899
1897
|
});
|
|
1900
1898
|
|
|
@@ -1923,9 +1921,9 @@ describe('bindClientWidth and bindClientHeight', () => {
|
|
|
1923
1921
|
const logs: number[] = [];
|
|
1924
1922
|
|
|
1925
1923
|
component App() {
|
|
1926
|
-
const width = #{ value: 0 };
|
|
1924
|
+
const width = #ripple{ value: 0 };
|
|
1927
1925
|
|
|
1928
|
-
effect(() => {
|
|
1926
|
+
#ripple.effect(() => {
|
|
1929
1927
|
logs.push(width.value);
|
|
1930
1928
|
});
|
|
1931
1929
|
|
|
@@ -1954,9 +1952,9 @@ describe('bindClientWidth and bindClientHeight', () => {
|
|
|
1954
1952
|
const logs: number[] = [];
|
|
1955
1953
|
|
|
1956
1954
|
component App() {
|
|
1957
|
-
const height = track(0);
|
|
1955
|
+
const height = #ripple.track(0);
|
|
1958
1956
|
|
|
1959
|
-
effect(() => {
|
|
1957
|
+
#ripple.effect(() => {
|
|
1960
1958
|
logs.push(@height);
|
|
1961
1959
|
});
|
|
1962
1960
|
|
|
@@ -1985,8 +1983,8 @@ describe('bindClientWidth and bindClientHeight', () => {
|
|
|
1985
1983
|
const logs: number[] = [];
|
|
1986
1984
|
|
|
1987
1985
|
component App() {
|
|
1988
|
-
const height = #{ value: 0 };
|
|
1989
|
-
effect(() => {
|
|
1986
|
+
const height = #ripple{ value: 0 };
|
|
1987
|
+
#ripple.effect(() => {
|
|
1990
1988
|
logs.push(height.value);
|
|
1991
1989
|
});
|
|
1992
1990
|
|
|
@@ -2017,9 +2015,9 @@ describe('bindOffsetWidth and bindOffsetHeight', () => {
|
|
|
2017
2015
|
const logs: number[] = [];
|
|
2018
2016
|
|
|
2019
2017
|
component App() {
|
|
2020
|
-
const width = track(0);
|
|
2018
|
+
const width = #ripple.track(0);
|
|
2021
2019
|
|
|
2022
|
-
effect(() => {
|
|
2020
|
+
#ripple.effect(() => {
|
|
2023
2021
|
logs.push(@width);
|
|
2024
2022
|
});
|
|
2025
2023
|
|
|
@@ -2048,9 +2046,9 @@ describe('bindOffsetWidth and bindOffsetHeight', () => {
|
|
|
2048
2046
|
const logs: number[] = [];
|
|
2049
2047
|
|
|
2050
2048
|
component App() {
|
|
2051
|
-
const width = #{ value: 0 };
|
|
2049
|
+
const width = #ripple{ value: 0 };
|
|
2052
2050
|
|
|
2053
|
-
effect(() => {
|
|
2051
|
+
#ripple.effect(() => {
|
|
2054
2052
|
logs.push(width.value);
|
|
2055
2053
|
});
|
|
2056
2054
|
|
|
@@ -2079,9 +2077,9 @@ describe('bindOffsetWidth and bindOffsetHeight', () => {
|
|
|
2079
2077
|
const logs: number[] = [];
|
|
2080
2078
|
|
|
2081
2079
|
component App() {
|
|
2082
|
-
const height = track(0);
|
|
2080
|
+
const height = #ripple.track(0);
|
|
2083
2081
|
|
|
2084
|
-
effect(() => {
|
|
2082
|
+
#ripple.effect(() => {
|
|
2085
2083
|
logs.push(@height);
|
|
2086
2084
|
});
|
|
2087
2085
|
|
|
@@ -2110,8 +2108,8 @@ describe('bindOffsetWidth and bindOffsetHeight', () => {
|
|
|
2110
2108
|
const logs: number[] = [];
|
|
2111
2109
|
|
|
2112
2110
|
component App() {
|
|
2113
|
-
const height = #{ value: 0 };
|
|
2114
|
-
effect(() => {
|
|
2111
|
+
const height = #ripple{ value: 0 };
|
|
2112
|
+
#ripple.effect(() => {
|
|
2115
2113
|
logs.push(height.value);
|
|
2116
2114
|
});
|
|
2117
2115
|
|
|
@@ -2142,9 +2140,9 @@ describe('bindContentRect', () => {
|
|
|
2142
2140
|
const logs: DOMRectReadOnly[] = [];
|
|
2143
2141
|
|
|
2144
2142
|
component App() {
|
|
2145
|
-
const rect = track(null);
|
|
2143
|
+
const rect = #ripple.track(null);
|
|
2146
2144
|
|
|
2147
|
-
effect(() => {
|
|
2145
|
+
#ripple.effect(() => {
|
|
2148
2146
|
if (@rect) logs.push(@rect);
|
|
2149
2147
|
});
|
|
2150
2148
|
|
|
@@ -2172,8 +2170,8 @@ describe('bindContentRect', () => {
|
|
|
2172
2170
|
const logs: DOMRectReadOnly[] = [];
|
|
2173
2171
|
|
|
2174
2172
|
component App() {
|
|
2175
|
-
const rect:
|
|
2176
|
-
effect(() => {
|
|
2173
|
+
const rect: RippleObject<{ value: DOMRectReadOnly | null }> = #ripple{ value: null };
|
|
2174
|
+
#ripple.effect(() => {
|
|
2177
2175
|
if (rect.value) logs.push(rect.value);
|
|
2178
2176
|
});
|
|
2179
2177
|
|
|
@@ -2208,9 +2206,9 @@ describe('bindContentBoxSize', () => {
|
|
|
2208
2206
|
const logs: any[] = [];
|
|
2209
2207
|
|
|
2210
2208
|
component App() {
|
|
2211
|
-
const boxSize = track(null);
|
|
2209
|
+
const boxSize = #ripple.track(null);
|
|
2212
2210
|
|
|
2213
|
-
effect(() => {
|
|
2211
|
+
#ripple.effect(() => {
|
|
2214
2212
|
if (@boxSize) logs.push(@boxSize);
|
|
2215
2213
|
});
|
|
2216
2214
|
|
|
@@ -2241,9 +2239,9 @@ describe('bindContentBoxSize', () => {
|
|
|
2241
2239
|
];
|
|
2242
2240
|
|
|
2243
2241
|
component App() {
|
|
2244
|
-
const boxSize:
|
|
2242
|
+
const boxSize: RippleObject<{ value: typeof mockBoxSize | null }> = #ripple{ value: null };
|
|
2245
2243
|
|
|
2246
|
-
effect(() => {
|
|
2244
|
+
#ripple.effect(() => {
|
|
2247
2245
|
if (boxSize.value) logs.push(boxSize.value);
|
|
2248
2246
|
});
|
|
2249
2247
|
|
|
@@ -2275,9 +2273,9 @@ describe('bindBorderBoxSize', () => {
|
|
|
2275
2273
|
const logs: any[] = [];
|
|
2276
2274
|
|
|
2277
2275
|
component App() {
|
|
2278
|
-
const boxSize = track(null);
|
|
2276
|
+
const boxSize = #ripple.track(null);
|
|
2279
2277
|
|
|
2280
|
-
effect(() => {
|
|
2278
|
+
#ripple.effect(() => {
|
|
2281
2279
|
if (@boxSize) logs.push(@boxSize);
|
|
2282
2280
|
});
|
|
2283
2281
|
|
|
@@ -2308,9 +2306,9 @@ describe('bindBorderBoxSize', () => {
|
|
|
2308
2306
|
];
|
|
2309
2307
|
|
|
2310
2308
|
component App() {
|
|
2311
|
-
const boxSize:
|
|
2309
|
+
const boxSize: RippleObject<{ value: typeof mockBoxSize | null }> = #ripple{ value: null };
|
|
2312
2310
|
|
|
2313
|
-
effect(() => {
|
|
2311
|
+
#ripple.effect(() => {
|
|
2314
2312
|
if (boxSize.value) logs.push(boxSize.value);
|
|
2315
2313
|
});
|
|
2316
2314
|
|
|
@@ -2342,9 +2340,9 @@ describe('bindDevicePixelContentBoxSize', () => {
|
|
|
2342
2340
|
const logs: any[] = [];
|
|
2343
2341
|
|
|
2344
2342
|
component App() {
|
|
2345
|
-
const boxSize = track(null);
|
|
2343
|
+
const boxSize = #ripple.track(null);
|
|
2346
2344
|
|
|
2347
|
-
effect(() => {
|
|
2345
|
+
#ripple.effect(() => {
|
|
2348
2346
|
if (@boxSize) logs.push(@boxSize);
|
|
2349
2347
|
});
|
|
2350
2348
|
|
|
@@ -2375,9 +2373,9 @@ describe('bindDevicePixelContentBoxSize', () => {
|
|
|
2375
2373
|
];
|
|
2376
2374
|
|
|
2377
2375
|
component App() {
|
|
2378
|
-
const boxSize:
|
|
2376
|
+
const boxSize: RippleObject<{ value: typeof mockBoxSize | null }> = #ripple{ value: null };
|
|
2379
2377
|
|
|
2380
|
-
effect(() => {
|
|
2378
|
+
#ripple.effect(() => {
|
|
2381
2379
|
if (boxSize.value) logs.push(boxSize.value);
|
|
2382
2380
|
});
|
|
2383
2381
|
|
|
@@ -2409,9 +2407,9 @@ describe('bindInnerHTML', () => {
|
|
|
2409
2407
|
const logs: string[] = [];
|
|
2410
2408
|
|
|
2411
2409
|
component App() {
|
|
2412
|
-
const html = track('<strong>Hello</strong>');
|
|
2410
|
+
const html = #ripple.track('<strong>Hello</strong>');
|
|
2413
2411
|
|
|
2414
|
-
effect(() => {
|
|
2412
|
+
#ripple.effect(() => {
|
|
2415
2413
|
logs.push(@html);
|
|
2416
2414
|
});
|
|
2417
2415
|
|
|
@@ -2435,9 +2433,9 @@ describe('bindInnerHTML', () => {
|
|
|
2435
2433
|
const logs: string[] = [];
|
|
2436
2434
|
|
|
2437
2435
|
component App() {
|
|
2438
|
-
const html = #{ value: '<strong>Hello</strong>' };
|
|
2436
|
+
const html = #ripple{ value: '<strong>Hello</strong>' };
|
|
2439
2437
|
|
|
2440
|
-
effect(() => {
|
|
2438
|
+
#ripple.effect(() => {
|
|
2441
2439
|
logs.push(html.value);
|
|
2442
2440
|
});
|
|
2443
2441
|
|
|
@@ -2462,7 +2460,7 @@ describe('bindInnerHTML', () => {
|
|
|
2462
2460
|
|
|
2463
2461
|
it('should update innerHTML when tracked value changes', () => {
|
|
2464
2462
|
component App() {
|
|
2465
|
-
const html = track('<p>Initial</p>');
|
|
2463
|
+
const html = #ripple.track('<p>Initial</p>');
|
|
2466
2464
|
|
|
2467
2465
|
<div>
|
|
2468
2466
|
<div contenteditable="true" {ref bindInnerHTML(html)} />
|
|
@@ -2486,7 +2484,7 @@ describe('bindInnerHTML', () => {
|
|
|
2486
2484
|
|
|
2487
2485
|
it('should update innerHTML when tracked value changes with a getter and setter', () => {
|
|
2488
2486
|
component App() {
|
|
2489
|
-
const html = #{ value: '<p>Initial</p>' };
|
|
2487
|
+
const html = #ripple{ value: '<p>Initial</p>' };
|
|
2490
2488
|
|
|
2491
2489
|
<div>
|
|
2492
2490
|
<div
|
|
@@ -2513,7 +2511,7 @@ describe('bindInnerHTML', () => {
|
|
|
2513
2511
|
|
|
2514
2512
|
it('should handle null innerHTML value', () => {
|
|
2515
2513
|
component App() {
|
|
2516
|
-
const html = track(null);
|
|
2514
|
+
const html = #ripple.track(null);
|
|
2517
2515
|
|
|
2518
2516
|
<div contenteditable="true" {ref bindInnerHTML(html)} />
|
|
2519
2517
|
}
|
|
@@ -2528,7 +2526,7 @@ describe('bindInnerHTML', () => {
|
|
|
2528
2526
|
|
|
2529
2527
|
it('should handle null innerHTML value with a getter and setter', () => {
|
|
2530
2528
|
component App() {
|
|
2531
|
-
const html:
|
|
2529
|
+
const html: RippleObject<{ value: null | string }> = #ripple{ value: null };
|
|
2532
2530
|
|
|
2533
2531
|
<div
|
|
2534
2532
|
contenteditable="true"
|
|
@@ -2550,9 +2548,9 @@ describe('bindInnerText', () => {
|
|
|
2550
2548
|
const logs: string[] = [];
|
|
2551
2549
|
|
|
2552
2550
|
component App() {
|
|
2553
|
-
const text = track('Hello World');
|
|
2551
|
+
const text = #ripple.track('Hello World');
|
|
2554
2552
|
|
|
2555
|
-
effect(() => {
|
|
2553
|
+
#ripple.effect(() => {
|
|
2556
2554
|
logs.push(@text);
|
|
2557
2555
|
});
|
|
2558
2556
|
|
|
@@ -2576,8 +2574,8 @@ describe('bindInnerText', () => {
|
|
|
2576
2574
|
const logs: string[] = [];
|
|
2577
2575
|
|
|
2578
2576
|
component App() {
|
|
2579
|
-
const text = #{ value: 'Hello World' };
|
|
2580
|
-
effect(() => {
|
|
2577
|
+
const text = #ripple{ value: 'Hello World' };
|
|
2578
|
+
#ripple.effect(() => {
|
|
2581
2579
|
logs.push(text.value);
|
|
2582
2580
|
});
|
|
2583
2581
|
|
|
@@ -2602,7 +2600,7 @@ describe('bindInnerText', () => {
|
|
|
2602
2600
|
|
|
2603
2601
|
it('should update innerText when tracked value changes', () => {
|
|
2604
2602
|
component App() {
|
|
2605
|
-
const text = track('Before');
|
|
2603
|
+
const text = #ripple.track('Before');
|
|
2606
2604
|
|
|
2607
2605
|
<div>
|
|
2608
2606
|
<div contenteditable="true" {ref bindInnerText(text)} />
|
|
@@ -2626,7 +2624,7 @@ describe('bindInnerText', () => {
|
|
|
2626
2624
|
|
|
2627
2625
|
it('should update innerText when tracked value changes with a getter and setter', () => {
|
|
2628
2626
|
component App() {
|
|
2629
|
-
const text = #{ value: 'Before' };
|
|
2627
|
+
const text = #ripple{ value: 'Before' };
|
|
2630
2628
|
|
|
2631
2629
|
<div>
|
|
2632
2630
|
<div
|
|
@@ -2657,9 +2655,9 @@ describe('bindTextContent', () => {
|
|
|
2657
2655
|
const logs: string[] = [];
|
|
2658
2656
|
|
|
2659
2657
|
component App() {
|
|
2660
|
-
const text = track('Sample text');
|
|
2658
|
+
const text = #ripple.track('Sample text');
|
|
2661
2659
|
|
|
2662
|
-
effect(() => {
|
|
2660
|
+
#ripple.effect(() => {
|
|
2663
2661
|
logs.push(@text);
|
|
2664
2662
|
});
|
|
2665
2663
|
|
|
@@ -2683,9 +2681,9 @@ describe('bindTextContent', () => {
|
|
|
2683
2681
|
const logs: string[] = [];
|
|
2684
2682
|
|
|
2685
2683
|
component App() {
|
|
2686
|
-
const text = #{ value: 'Sample text' };
|
|
2684
|
+
const text = #ripple{ value: 'Sample text' };
|
|
2687
2685
|
|
|
2688
|
-
effect(() => {
|
|
2686
|
+
#ripple.effect(() => {
|
|
2689
2687
|
logs.push(text.value);
|
|
2690
2688
|
});
|
|
2691
2689
|
|
|
@@ -2710,7 +2708,7 @@ describe('bindTextContent', () => {
|
|
|
2710
2708
|
|
|
2711
2709
|
it('should update textContent when tracked value changes', () => {
|
|
2712
2710
|
component App() {
|
|
2713
|
-
const text = track('Start');
|
|
2711
|
+
const text = #ripple.track('Start');
|
|
2714
2712
|
|
|
2715
2713
|
<div>
|
|
2716
2714
|
<div contenteditable="true" {ref bindTextContent(text)} />
|
|
@@ -2734,7 +2732,7 @@ describe('bindTextContent', () => {
|
|
|
2734
2732
|
|
|
2735
2733
|
it('should update textContent when tracked value changes with a getter and setter', () => {
|
|
2736
2734
|
component App() {
|
|
2737
|
-
const text = #{ value: 'Start' };
|
|
2735
|
+
const text = #ripple{ value: 'Start' };
|
|
2738
2736
|
|
|
2739
2737
|
<div>
|
|
2740
2738
|
<div
|
|
@@ -2761,7 +2759,7 @@ describe('bindTextContent', () => {
|
|
|
2761
2759
|
|
|
2762
2760
|
it('should handle null textContent value', () => {
|
|
2763
2761
|
component App() {
|
|
2764
|
-
const text = track(null);
|
|
2762
|
+
const text = #ripple.track(null);
|
|
2765
2763
|
|
|
2766
2764
|
<div contenteditable="true" {ref bindTextContent(text)} />
|
|
2767
2765
|
}
|
|
@@ -2776,7 +2774,7 @@ describe('bindTextContent', () => {
|
|
|
2776
2774
|
|
|
2777
2775
|
it('should handle null textContent value with a getter and setter', () => {
|
|
2778
2776
|
component App() {
|
|
2779
|
-
const text:
|
|
2777
|
+
const text: RippleObject<{ value: string | null }> = #ripple{ value: null };
|
|
2780
2778
|
|
|
2781
2779
|
<div
|
|
2782
2780
|
contenteditable="true"
|
|
@@ -2801,9 +2799,9 @@ describe('bindNode', () => {
|
|
|
2801
2799
|
let capturedNode: HTMLElement | null = null;
|
|
2802
2800
|
|
|
2803
2801
|
component App() {
|
|
2804
|
-
const nodeRef = track(null);
|
|
2802
|
+
const nodeRef = #ripple.track(null);
|
|
2805
2803
|
|
|
2806
|
-
effect(() => {
|
|
2804
|
+
#ripple.effect(() => {
|
|
2807
2805
|
capturedNode = @nodeRef;
|
|
2808
2806
|
});
|
|
2809
2807
|
|
|
@@ -2821,9 +2819,9 @@ describe('bindNode', () => {
|
|
|
2821
2819
|
let capturedNode: HTMLElement | null = null;
|
|
2822
2820
|
|
|
2823
2821
|
component App() {
|
|
2824
|
-
const nodeRef:
|
|
2822
|
+
const nodeRef: RippleObject<{ value: HTMLElement | null }> = #ripple{ value: null };
|
|
2825
2823
|
|
|
2826
|
-
effect(() => {
|
|
2824
|
+
#ripple.effect(() => {
|
|
2827
2825
|
capturedNode = nodeRef.value;
|
|
2828
2826
|
});
|
|
2829
2827
|
|
|
@@ -2839,7 +2837,7 @@ describe('bindNode', () => {
|
|
|
2839
2837
|
|
|
2840
2838
|
it('should allow access to bound element', () => {
|
|
2841
2839
|
component App() {
|
|
2842
|
-
const inputRef = track<HTMLInputElement | null>(null);
|
|
2840
|
+
const inputRef = #ripple.track<HTMLInputElement | null>(null);
|
|
2843
2841
|
|
|
2844
2842
|
<div>
|
|
2845
2843
|
<input type="text" {ref bindNode(inputRef)} />
|
|
@@ -2871,7 +2869,7 @@ describe('bindNode', () => {
|
|
|
2871
2869
|
|
|
2872
2870
|
it('should allow access to bound element with a getter and setter', () => {
|
|
2873
2871
|
component App() {
|
|
2874
|
-
const inputRef:
|
|
2872
|
+
const inputRef: RippleObject<{ node: HTMLInputElement | null }> = #ripple{ node: null };
|
|
2875
2873
|
|
|
2876
2874
|
<div>
|
|
2877
2875
|
<input
|
|
@@ -2910,9 +2908,9 @@ describe('bindFiles', () => {
|
|
|
2910
2908
|
const logs: FileList[] = [];
|
|
2911
2909
|
|
|
2912
2910
|
component App() {
|
|
2913
|
-
const files = track(null);
|
|
2911
|
+
const files = #ripple.track(null);
|
|
2914
2912
|
|
|
2915
|
-
effect(() => {
|
|
2913
|
+
#ripple.effect(() => {
|
|
2916
2914
|
@files;
|
|
2917
2915
|
if (@files) logs.push(@files);
|
|
2918
2916
|
});
|
|
@@ -2951,9 +2949,9 @@ describe('bindFiles', () => {
|
|
|
2951
2949
|
const logs: FileList[] = [];
|
|
2952
2950
|
|
|
2953
2951
|
component App() {
|
|
2954
|
-
const files:
|
|
2952
|
+
const files: RippleObject<{ items: FileList | null }> = #ripple{ items: null };
|
|
2955
2953
|
|
|
2956
|
-
effect(() => {
|
|
2954
|
+
#ripple.effect(() => {
|
|
2957
2955
|
files.items;
|
|
2958
2956
|
if (files.items) logs.push(files.items);
|
|
2959
2957
|
});
|
|
@@ -2996,9 +2994,9 @@ describe('bindFiles', () => {
|
|
|
2996
2994
|
let capturedFiles: FileList | null = null;
|
|
2997
2995
|
|
|
2998
2996
|
component App() {
|
|
2999
|
-
const files = track<FileList | null>(null);
|
|
2997
|
+
const files = #ripple.track<FileList | null>(null);
|
|
3000
2998
|
|
|
3001
|
-
effect(() => {
|
|
2999
|
+
#ripple.effect(() => {
|
|
3002
3000
|
capturedFiles = @files;
|
|
3003
3001
|
});
|
|
3004
3002
|
|
|
@@ -3031,9 +3029,9 @@ describe('bindFiles', () => {
|
|
|
3031
3029
|
let capturedFiles: FileList | null = null;
|
|
3032
3030
|
|
|
3033
3031
|
component App() {
|
|
3034
|
-
const files:
|
|
3032
|
+
const files: RippleObject<{ items: FileList | null }> = #ripple{ items: null };
|
|
3035
3033
|
|
|
3036
|
-
effect(() => {
|
|
3034
|
+
#ripple.effect(() => {
|
|
3037
3035
|
capturedFiles = files.items;
|
|
3038
3036
|
});
|
|
3039
3037
|
|
|
@@ -3069,15 +3067,15 @@ describe('bindFiles', () => {
|
|
|
3069
3067
|
let capturedFiles: FileList | null = null;
|
|
3070
3068
|
|
|
3071
3069
|
component App() {
|
|
3072
|
-
const files = track<FileList | null>(null);
|
|
3073
|
-
const input = track<HTMLInputElement | null>(null);
|
|
3070
|
+
const files = #ripple.track<FileList | null>(null);
|
|
3071
|
+
const input = #ripple.track<HTMLInputElement | null>(null);
|
|
3074
3072
|
|
|
3075
|
-
effect(() => {
|
|
3073
|
+
#ripple.effect(() => {
|
|
3076
3074
|
capturedFiles = @files;
|
|
3077
3075
|
});
|
|
3078
3076
|
|
|
3079
3077
|
<div>
|
|
3080
|
-
<input type="file" {ref bindFiles<FileList>(files
|
|
3078
|
+
<input type="file" {ref bindFiles<FileList>(files)} {ref bindNode(input)} />
|
|
3081
3079
|
<button
|
|
3082
3080
|
onClick={() => {
|
|
3083
3081
|
if (@input) {
|
|
@@ -3122,10 +3120,10 @@ describe('bindFiles', () => {
|
|
|
3122
3120
|
let capturedFiles: FileList | null = null;
|
|
3123
3121
|
|
|
3124
3122
|
component App() {
|
|
3125
|
-
const files:
|
|
3126
|
-
const input = track<HTMLInputElement | null>(null);
|
|
3123
|
+
const files: RippleObject<{ items: FileList | null }> = #ripple{ items: null };
|
|
3124
|
+
const input = #ripple.track<HTMLInputElement | null>(null);
|
|
3127
3125
|
|
|
3128
|
-
effect(() => {
|
|
3126
|
+
#ripple.effect(() => {
|
|
3129
3127
|
capturedFiles = files.items;
|
|
3130
3128
|
});
|
|
3131
3129
|
|
|
@@ -3179,9 +3177,9 @@ describe('bindFiles', () => {
|
|
|
3179
3177
|
const fileCounts: number[] = [];
|
|
3180
3178
|
|
|
3181
3179
|
component App() {
|
|
3182
|
-
const files = track<FileList | null>(null);
|
|
3180
|
+
const files = #ripple.track<FileList | null>(null);
|
|
3183
3181
|
|
|
3184
|
-
effect(() => {
|
|
3182
|
+
#ripple.effect(() => {
|
|
3185
3183
|
@files;
|
|
3186
3184
|
if (@files) {
|
|
3187
3185
|
fileCounts.push(@files.length);
|
|
@@ -3228,8 +3226,8 @@ describe('bindFiles', () => {
|
|
|
3228
3226
|
const fileCounts: number[] = [];
|
|
3229
3227
|
|
|
3230
3228
|
component App() {
|
|
3231
|
-
const files:
|
|
3232
|
-
effect(() => {
|
|
3229
|
+
const files: RippleObject<{ items: FileList | null }> = #ripple{ items: null };
|
|
3230
|
+
#ripple.effect(() => {
|
|
3233
3231
|
files.items;
|
|
3234
3232
|
if (files.items) {
|
|
3235
3233
|
fileCounts.push(files.items.length);
|
|
@@ -3280,9 +3278,9 @@ describe('bindFiles', () => {
|
|
|
3280
3278
|
let capturedFile: File | null = null;
|
|
3281
3279
|
|
|
3282
3280
|
component App() {
|
|
3283
|
-
const files = track<FileList | null>(null);
|
|
3281
|
+
const files = #ripple.track<FileList | null>(null);
|
|
3284
3282
|
|
|
3285
|
-
effect(() => {
|
|
3283
|
+
#ripple.effect(() => {
|
|
3286
3284
|
@files;
|
|
3287
3285
|
if (@files && @files.length > 0) {
|
|
3288
3286
|
capturedFile = @files[0];
|
|
@@ -3317,8 +3315,8 @@ describe('bindFiles', () => {
|
|
|
3317
3315
|
let capturedFile: File | null = null;
|
|
3318
3316
|
|
|
3319
3317
|
component App() {
|
|
3320
|
-
const files:
|
|
3321
|
-
effect(() => {
|
|
3318
|
+
const files: RippleObject<{ items: FileList | null }> = #ripple{ items: null };
|
|
3319
|
+
#ripple.effect(() => {
|
|
3322
3320
|
files.items;
|
|
3323
3321
|
if (files.items && files.items.length > 0) {
|
|
3324
3322
|
capturedFile = files.items[0];
|
|
@@ -3356,9 +3354,9 @@ describe('bindFiles', () => {
|
|
|
3356
3354
|
const logs: (FileList | null)[] = [];
|
|
3357
3355
|
|
|
3358
3356
|
component App() {
|
|
3359
|
-
const files = track(null);
|
|
3357
|
+
const files = #ripple.track(null);
|
|
3360
3358
|
|
|
3361
|
-
effect(() => {
|
|
3359
|
+
#ripple.effect(() => {
|
|
3362
3360
|
logs.push(@files);
|
|
3363
3361
|
});
|
|
3364
3362
|
|
|
@@ -3398,8 +3396,8 @@ describe('bindFiles', () => {
|
|
|
3398
3396
|
const logs: (FileList | null)[] = [];
|
|
3399
3397
|
|
|
3400
3398
|
component App() {
|
|
3401
|
-
const files:
|
|
3402
|
-
effect(() => {
|
|
3399
|
+
const files: RippleObject<{ items: FileList | null }> = #ripple{ items: null };
|
|
3400
|
+
#ripple.effect(() => {
|
|
3403
3401
|
logs.push(files.items);
|
|
3404
3402
|
});
|
|
3405
3403
|
|
|
@@ -3613,7 +3611,7 @@ describe('error handling', () => {
|
|
|
3613
3611
|
it('should throw error when bindValue receives a getter but not a setter', () => {
|
|
3614
3612
|
expect(() => {
|
|
3615
3613
|
component App() {
|
|
3616
|
-
const value = track('');
|
|
3614
|
+
const value = #ripple.track('');
|
|
3617
3615
|
<input type="text" {ref bindValue(() => @value)} />
|
|
3618
3616
|
}
|
|
3619
3617
|
render(App);
|
|
@@ -3625,7 +3623,7 @@ describe('error handling', () => {
|
|
|
3625
3623
|
it('should throw error when bindValue receives a getter and setter not a function', () => {
|
|
3626
3624
|
expect(() => {
|
|
3627
3625
|
component App() {
|
|
3628
|
-
const value = track('');
|
|
3626
|
+
const value = #ripple.track('');
|
|
3629
3627
|
// @ts-expect-error invalid argument
|
|
3630
3628
|
<input type="text" {ref bindValue(() => @value, 5)} />
|
|
3631
3629
|
}
|