ripple 0.2.216 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/package.json +16 -7
  3. package/src/compiler/errors.js +1 -1
  4. package/src/compiler/identifier-utils.js +2 -0
  5. package/src/compiler/index.d.ts +2 -6
  6. package/src/compiler/phases/1-parse/index.js +171 -233
  7. package/src/compiler/phases/2-analyze/index.js +192 -16
  8. package/src/compiler/phases/2-analyze/prune.js +2 -2
  9. package/src/compiler/phases/3-transform/client/index.js +308 -91
  10. package/src/compiler/phases/3-transform/segments.js +43 -15
  11. package/src/compiler/phases/3-transform/server/index.js +71 -21
  12. package/src/compiler/scope.js +31 -12
  13. package/src/compiler/source-map-utils.js +4 -6
  14. package/src/compiler/types/acorn.d.ts +11 -0
  15. package/src/compiler/types/estree-jsx.d.ts +11 -0
  16. package/src/compiler/types/estree.d.ts +11 -0
  17. package/src/compiler/types/import.d.ts +32 -18
  18. package/src/compiler/types/index.d.ts +75 -23
  19. package/src/compiler/types/parse.d.ts +7 -10
  20. package/src/compiler/utils.js +48 -0
  21. package/src/runtime/array.js +53 -22
  22. package/src/runtime/date.js +15 -5
  23. package/src/runtime/index-client.js +41 -7
  24. package/src/runtime/index-server.js +7 -7
  25. package/src/runtime/internal/client/bindings.js +2 -2
  26. package/src/runtime/internal/client/blocks.js +40 -1
  27. package/src/runtime/internal/client/context.js +8 -0
  28. package/src/runtime/internal/client/for.js +3 -3
  29. package/src/runtime/internal/client/index.js +27 -5
  30. package/src/runtime/internal/client/render.js +20 -8
  31. package/src/runtime/internal/client/runtime.js +9 -7
  32. package/src/runtime/internal/client/try.js +15 -22
  33. package/src/runtime/internal/client/utils.js +1 -1
  34. package/src/runtime/internal/server/context.js +8 -0
  35. package/src/runtime/internal/server/index.js +99 -6
  36. package/src/runtime/map.js +7 -7
  37. package/src/runtime/media-query.js +10 -1
  38. package/src/runtime/object.js +6 -6
  39. package/src/runtime/proxy.js +6 -6
  40. package/src/runtime/set.js +11 -11
  41. package/src/runtime/url-search-params.js +13 -2
  42. package/src/runtime/url.js +15 -5
  43. package/src/utils/builders.js +13 -3
  44. package/tests/client/array/array.copy-within.test.ripple +11 -11
  45. package/tests/client/array/array.derived.test.ripple +42 -42
  46. package/tests/client/array/array.iteration.test.ripple +12 -12
  47. package/tests/client/array/array.mutations.test.ripple +25 -25
  48. package/tests/client/array/array.static.test.ripple +103 -106
  49. package/tests/client/array/array.to-methods.test.ripple +8 -8
  50. package/tests/client/async-suspend.test.ripple +94 -0
  51. package/tests/client/basic/basic.attributes.test.ripple +31 -31
  52. package/tests/client/basic/basic.collections.test.ripple +7 -7
  53. package/tests/client/basic/basic.components.test.ripple +48 -10
  54. package/tests/client/basic/basic.errors.test.ripple +46 -31
  55. package/tests/client/basic/basic.events.test.ripple +11 -11
  56. package/tests/client/basic/basic.get-set.test.ripple +18 -18
  57. package/tests/client/basic/basic.reactivity.test.ripple +47 -42
  58. package/tests/client/basic/basic.rendering.test.ripple +7 -7
  59. package/tests/client/basic/basic.utilities.test.ripple +4 -4
  60. package/tests/client/boundaries.test.ripple +7 -7
  61. package/tests/client/compiler/__snapshots__/compiler.assignments.test.ripple.snap +2 -2
  62. package/tests/client/compiler/compiler.assignments.test.ripple +21 -21
  63. package/tests/client/compiler/compiler.basic.test.ripple +223 -82
  64. package/tests/client/compiler/compiler.tracked-access.test.ripple +8 -9
  65. package/tests/client/composite/composite.dynamic-components.test.ripple +8 -8
  66. package/tests/client/composite/composite.generics.test.ripple +4 -4
  67. package/tests/client/composite/composite.props.test.ripple +9 -9
  68. package/tests/client/composite/composite.reactivity.test.ripple +32 -26
  69. package/tests/client/composite/composite.render.test.ripple +13 -4
  70. package/tests/client/computed-properties.test.ripple +3 -3
  71. package/tests/client/context.test.ripple +3 -3
  72. package/tests/client/css/global-additional-cases.test.ripple +4 -4
  73. package/tests/client/css/style-identifier.test.ripple +49 -41
  74. package/tests/client/date.test.ripple +40 -40
  75. package/tests/client/dynamic-elements.test.ripple +165 -30
  76. package/tests/client/events.test.ripple +25 -25
  77. package/tests/client/for.test.ripple +76 -8
  78. package/tests/client/function-overload.test.ripple +0 -1
  79. package/tests/client/head.test.ripple +7 -7
  80. package/tests/client/html.test.ripple +2 -2
  81. package/tests/client/input-value.test.ripple +174 -176
  82. package/tests/client/map.test.ripple +21 -21
  83. package/tests/client/media-query.test.ripple +4 -4
  84. package/tests/client/object.test.ripple +12 -12
  85. package/tests/client/portal.test.ripple +4 -4
  86. package/tests/client/ref.test.ripple +5 -5
  87. package/tests/client/return.test.ripple +17 -17
  88. package/tests/client/set.test.ripple +16 -16
  89. package/tests/client/svg.test.ripple +6 -7
  90. package/tests/client/switch.test.ripple +10 -10
  91. package/tests/client/tracked-expression.test.ripple +1 -3
  92. package/tests/client/try.test.ripple +33 -4
  93. package/tests/client/url/url.derived.test.ripple +10 -9
  94. package/tests/client/url/url.parsing.test.ripple +10 -10
  95. package/tests/client/url/url.partial-removal.test.ripple +10 -10
  96. package/tests/client/url/url.reactivity.test.ripple +17 -17
  97. package/tests/client/url/url.serialization.test.ripple +4 -4
  98. package/tests/client/url-search-params/url-search-params.derived.test.ripple +11 -10
  99. package/tests/client/url-search-params/url-search-params.initialization.test.ripple +5 -7
  100. package/tests/client/url-search-params/url-search-params.iteration.test.ripple +13 -13
  101. package/tests/client/url-search-params/url-search-params.mutation.test.ripple +19 -19
  102. package/tests/client/url-search-params/url-search-params.retrieval.test.ripple +17 -17
  103. package/tests/client/url-search-params/url-search-params.serialization.test.ripple +5 -5
  104. package/tests/client/url-search-params/url-search-params.tracked-url.test.ripple +5 -5
  105. package/tests/hydration/compiled/client/events.js +8 -11
  106. package/tests/hydration/compiled/client/for.js +20 -23
  107. package/tests/hydration/compiled/client/head.js +17 -19
  108. package/tests/hydration/compiled/client/hmr.js +1 -3
  109. package/tests/hydration/compiled/client/html.js +1 -15
  110. package/tests/hydration/compiled/client/if-children.js +7 -9
  111. package/tests/hydration/compiled/client/if.js +5 -7
  112. package/tests/hydration/compiled/client/mixed-control-flow.js +3 -5
  113. package/tests/hydration/compiled/client/portal.js +1 -1
  114. package/tests/hydration/compiled/client/reactivity.js +9 -11
  115. package/tests/hydration/compiled/client/return.js +11 -13
  116. package/tests/hydration/compiled/client/switch.js +4 -6
  117. package/tests/hydration/compiled/server/basic.js +0 -1
  118. package/tests/hydration/compiled/server/composite.js +0 -3
  119. package/tests/hydration/compiled/server/events.js +8 -12
  120. package/tests/hydration/compiled/server/for.js +20 -23
  121. package/tests/hydration/compiled/server/head.js +17 -19
  122. package/tests/hydration/compiled/server/hmr.js +1 -4
  123. package/tests/hydration/compiled/server/html.js +1 -35
  124. package/tests/hydration/compiled/server/if-children.js +7 -11
  125. package/tests/hydration/compiled/server/if.js +5 -7
  126. package/tests/hydration/compiled/server/mixed-control-flow.js +3 -5
  127. package/tests/hydration/compiled/server/portal.js +1 -9
  128. package/tests/hydration/compiled/server/reactivity.js +9 -11
  129. package/tests/hydration/compiled/server/return.js +11 -13
  130. package/tests/hydration/compiled/server/switch.js +4 -6
  131. package/tests/hydration/components/events.ripple +8 -9
  132. package/tests/hydration/components/for.ripple +20 -21
  133. package/tests/hydration/components/head.ripple +6 -8
  134. package/tests/hydration/components/hmr.ripple +1 -2
  135. package/tests/hydration/components/html.ripple +1 -3
  136. package/tests/hydration/components/if-children.ripple +7 -8
  137. package/tests/hydration/components/if.ripple +5 -6
  138. package/tests/hydration/components/mixed-control-flow.ripple +4 -6
  139. package/tests/hydration/components/portal.ripple +1 -1
  140. package/tests/hydration/components/reactivity.ripple +9 -10
  141. package/tests/hydration/components/return.ripple +11 -12
  142. package/tests/hydration/components/switch.ripple +6 -8
  143. package/tests/server/await.test.ripple +2 -2
  144. package/tests/server/basic.attributes.test.ripple +19 -21
  145. package/tests/server/basic.components.test.ripple +13 -7
  146. package/tests/server/basic.test.ripple +20 -21
  147. package/tests/server/compiler.test.ripple +5 -5
  148. package/tests/server/composite.props.test.ripple +6 -7
  149. package/tests/server/composite.test.ripple +4 -4
  150. package/tests/server/context.test.ripple +1 -3
  151. package/tests/server/dynamic-elements.test.ripple +24 -24
  152. package/tests/server/head.test.ripple +5 -7
  153. package/tests/server/style-identifier.test.ripple +16 -17
  154. package/types/index.d.ts +266 -62
  155. package/types/server.d.ts +6 -6
@@ -1,13 +1,13 @@
1
- import { track, flushSync } from 'ripple';
1
+ import { flushSync } from 'ripple';
2
2
 
3
3
  describe('composite > dynamic components', () => {
4
- it('supports rendering compositie components using <@component> syntax', () => {
4
+ it('supports rendering composite components using <@component> syntax', () => {
5
5
  component App() {
6
6
  component basic() {
7
7
  <div>{'Basic Component'}</div>
8
8
  }
9
9
 
10
- const tracked_basic = track(() => basic);
10
+ const tracked_basic = #ripple.track(() => basic);
11
11
 
12
12
  <@tracked_basic />
13
13
  }
@@ -24,7 +24,7 @@ describe('composite > dynamic components', () => {
24
24
  <div>{'Basic Component'}</div>
25
25
  }
26
26
 
27
- const tracked_basic = track(() => basic);
27
+ const tracked_basic = #ripple.track(() => basic);
28
28
 
29
29
  const obj = {
30
30
  tracked_basic,
@@ -45,15 +45,15 @@ describe('composite > dynamic components', () => {
45
45
  <div>{'Basic Component'}</div>
46
46
  }
47
47
 
48
- const tracked_basic = track(() => basic);
48
+ const tracked_basic = #ripple.track(() => basic);
49
49
 
50
50
  const obj = {
51
51
  tracked_basic,
52
52
  };
53
53
 
54
- const tracked_object = track(obj);
54
+ const ripple_object = #ripple.track(obj);
55
55
 
56
- <@tracked_object.@tracked_basic />
56
+ <@ripple_object.@tracked_basic />
57
57
  }
58
58
 
59
59
  render(App);
@@ -72,7 +72,7 @@ describe('composite > dynamic components', () => {
72
72
  }
73
73
 
74
74
  component App() {
75
- let thing = track(() => Child1);
75
+ let thing = #ripple.track(() => Child1);
76
76
 
77
77
  <div id="container">
78
78
  <@thing />
@@ -1,4 +1,4 @@
1
- import { TrackedArray, TrackedMap } from 'ripple';
1
+ import { RippleArray, RippleMap } from 'ripple';
2
2
 
3
3
  describe('composite > generics', () => {
4
4
  it('handles advanced generic ambiguity and edge cases', () => {
@@ -143,10 +143,10 @@ describe('composite > generics', () => {
143
143
  const s = flag ? new Box<number>(1) : new Box<string>('string');
144
144
 
145
145
  // 20. Generic inside template expression
146
- const t = `length=${new TrackedArray<number>().length}`;
146
+ const t = `length=${new RippleArray<number>().length}`;
147
147
 
148
148
  // 21. Optional chaining + generic + property access
149
- const registry = new TrackedMap<string, number>();
149
+ const registry = new RippleMap<string, number>();
150
150
  const u = registry.get('id')?.toString();
151
151
 
152
152
  // 22. Generic call used as callee for another call
@@ -208,7 +208,7 @@ describe('composite > generics', () => {
208
208
  >();
209
209
 
210
210
  // 33. Map of generic instance as key
211
- const mm = new Map<TrackedArray<number>, TrackedArray<string>>();
211
+ const mm = new Map<RippleArray<number>, RippleArray<string>>();
212
212
  }
213
213
 
214
214
  render(App);
@@ -1,5 +1,5 @@
1
1
  import type { Tracked, Props } from 'ripple';
2
- import { track, trackSplit, effect, flushSync } from 'ripple';
2
+ import { flushSync } from 'ripple';
3
3
 
4
4
  describe('composite > props', () => {
5
5
  it('correctly handles default prop values', () => {
@@ -8,7 +8,7 @@ describe('composite > props', () => {
8
8
  }
9
9
 
10
10
  component App() {
11
- let foo = track(123);
11
+ let foo = #ripple.track(123);
12
12
 
13
13
  <Child />
14
14
  <Child {@foo} />
@@ -44,7 +44,7 @@ describe('composite > props', () => {
44
44
  }
45
45
 
46
46
  component App() {
47
- let foo = track(123);
47
+ let foo = #ripple.track(123);
48
48
 
49
49
  <Child />
50
50
  <Child {foo} />
@@ -62,7 +62,7 @@ describe('composite > props', () => {
62
62
  }
63
63
 
64
64
  component App() {
65
- let foo = track(123);
65
+ let foo = #ripple.track(123);
66
66
 
67
67
  <Child />
68
68
  <Child {@foo} />
@@ -78,7 +78,7 @@ describe('composite > props', () => {
78
78
  const logs: number[] = [];
79
79
 
80
80
  component Counter({ count }: { count: Tracked<number> }) {
81
- effect(() => {
81
+ #ripple.effect(() => {
82
82
  logs.push(@count);
83
83
  });
84
84
 
@@ -86,7 +86,7 @@ describe('composite > props', () => {
86
86
  }
87
87
 
88
88
  component App() {
89
- const count = track(0);
89
+ const count = #ripple.track(0);
90
90
 
91
91
  <div>
92
92
  <Counter {count} />
@@ -107,7 +107,7 @@ describe('composite > props', () => {
107
107
 
108
108
  it('correctly retains prop accessors and reactivity when using rest props', () => {
109
109
  component Button(props: Props) {
110
- const [children, rest] = trackSplit(props, ['children']);
110
+ const [children, rest] = #ripple.trackSplit(props, ['children']);
111
111
  <button {...@rest}>
112
112
  <@children />
113
113
  </button>
@@ -122,14 +122,14 @@ describe('composite > props', () => {
122
122
  }
123
123
 
124
124
  component Toggle(props: { pressed: Tracked<boolean> }) {
125
- const [pressed, rest] = trackSplit(props, ['pressed']);
125
+ const [pressed, rest] = #ripple.trackSplit(props, ['pressed']);
126
126
  const onClick = () => (@pressed = !@pressed);
127
127
  <Button {...@rest} class={@pressed ? 'on' : 'off'} {onClick}>{'button 1'}</Button>
128
128
  <Button class={@pressed ? 'on' : 'off'} {onClick}>{'button 2'}</Button>
129
129
  }
130
130
 
131
131
  component App() {
132
- const pressed = track(true);
132
+ const pressed = #ripple.track(true);
133
133
  <Toggle {pressed} />
134
134
  }
135
135
 
@@ -1,5 +1,5 @@
1
- import type { Tracked } from 'ripple';
2
- import { track, trackSplit, flushSync, effect } from 'ripple';
1
+ import type { Props, Tracked } from 'ripple';
2
+ import { flushSync } from 'ripple';
3
3
 
4
4
  describe('composite > reactivity', () => {
5
5
  it('renders composite components with object state', () => {
@@ -17,7 +17,7 @@ describe('composite > reactivity', () => {
17
17
  component App() {
18
18
  <div>
19
19
  let obj = {
20
- count: track(0),
20
+ count: #ripple.track(0),
21
21
  };
22
22
 
23
23
  <span class="count">{obj.@count}</span>
@@ -55,7 +55,7 @@ describe('composite > reactivity', () => {
55
55
  component App() {
56
56
  <div>
57
57
  let obj = {
58
- count: track(0),
58
+ count: #ripple.track(0),
59
59
  };
60
60
 
61
61
  <span class="count">{obj.@count}</span>
@@ -84,7 +84,7 @@ describe('composite > reactivity', () => {
84
84
 
85
85
  it('parents and children have isolated state', () => {
86
86
  component Button(props: { count: number }) {
87
- let count = track(() => props.count);
87
+ let count = #ripple.track(() => props.count);
88
88
  <button
89
89
  onClick={() => {
90
90
  @count++;
@@ -96,7 +96,7 @@ describe('composite > reactivity', () => {
96
96
 
97
97
  component App() {
98
98
  <div>
99
- let count = track(0);
99
+ let count = #ripple.track(0);
100
100
 
101
101
  <button
102
102
  onClick={() => {
@@ -131,7 +131,7 @@ describe('composite > reactivity', () => {
131
131
 
132
132
  it('parents and children have isolated connected state (destructured props)', () => {
133
133
  component Button({ count }: { count: number }) {
134
- let local_count = track(() => count);
134
+ let local_count = #ripple.track(() => count);
135
135
  <button
136
136
  onClick={() => {
137
137
  @local_count++;
@@ -143,7 +143,7 @@ describe('composite > reactivity', () => {
143
143
 
144
144
  component App() {
145
145
  <div>
146
- let count = track(0);
146
+ let count = #ripple.track(0);
147
147
 
148
148
  <button
149
149
  onClick={() => {
@@ -180,11 +180,11 @@ describe('composite > reactivity', () => {
180
180
  let logs: string[] = [];
181
181
 
182
182
  component App() {
183
- const a = track(1);
184
- const b = track(2);
185
- const c = track(3);
183
+ const a = #ripple.track(1);
184
+ const b = #ripple.track(2);
185
+ const c = #ripple.track(3);
186
186
 
187
- const obj = track(
187
+ const obj = #ripple.track(
188
188
  () => ({
189
189
  @a,
190
190
  @b,
@@ -206,7 +206,7 @@ describe('composite > reactivity', () => {
206
206
  }
207
207
 
208
208
  component Child({ a, b, c }: { a: number; b: number; c: number }) {
209
- effect(() => {
209
+ #ripple.effect(() => {
210
210
  logs.push(`Child effect: ${a}, ${b}, ${c}`);
211
211
  });
212
212
 
@@ -228,21 +228,21 @@ describe('composite > reactivity', () => {
228
228
  });
229
229
 
230
230
  it(
231
- 'keeps reactivity for spread props via intermediate components and usage of trackSplit()',
231
+ 'keeps reactivity for spread props via intermediate components and usage of #ripple.trackSplit()',
232
232
  () => {
233
233
  component App() {
234
- const count = track(0);
234
+ const count = #ripple.track(0);
235
235
  <CounterWrapper {@count} up={() => @count++} down={() => @count--} />
236
236
  }
237
237
 
238
- component CounterWrapper(props) {
238
+ component CounterWrapper(props: Props) {
239
239
  <div>
240
240
  <Counter {...props} />
241
241
  </div>
242
242
  }
243
243
 
244
- component Counter(props) {
245
- const [count, up, down, rest] = trackSplit(props, ['count', 'up', 'down']);
244
+ component Counter(props: Props) {
245
+ const [count, up, down, rest] = #ripple.trackSplit(props, ['count', 'up', 'down']);
246
246
  <button onClick={() => @up()}>{'UP'}</button>
247
247
  <button onClick={() => @down()}>{'DOWN'}</button>
248
248
  <span {...@rest}>{`Counter: ${@count}`}</span>
@@ -270,18 +270,18 @@ describe('composite > reactivity', () => {
270
270
 
271
271
  it('keeps reactivity on elements for element spreads and adds / removes dynamic props', () => {
272
272
  component App() {
273
- const count = track(0);
273
+ const count = #ripple.track(0);
274
274
  <CounterWrapper {@count} up={() => @count++} />
275
275
  }
276
276
 
277
- component CounterWrapper(props) {
278
- const more = #{
279
- double: track(() => props.@count * 2),
280
- another: track(0),
277
+ component CounterWrapper(props: { count: number; up: () => void }) {
278
+ const more: { double: Tracked<number>; another?: number; extra: number } = #ripple{
279
+ double: #ripple.track(() => props.count * 2),
280
+ another: 0,
281
281
  extra: 100,
282
282
  };
283
283
 
284
- effect(() => {
284
+ #ripple.effect(() => {
285
285
  props.count;
286
286
  if (props.count === 1) {
287
287
  delete more.another;
@@ -295,8 +295,14 @@ describe('composite > reactivity', () => {
295
295
  </div>
296
296
  }
297
297
 
298
- component Counter(props) {
299
- const [count, up, rest] = trackSplit(props, ['count', 'up']);
298
+ component Counter(props: {
299
+ count: number;
300
+ up: () => void;
301
+ double: Tracked<number>;
302
+ another?: number;
303
+ extra: number;
304
+ }) {
305
+ const [count, up, rest] = #ripple.trackSplit(props, ['count', 'up']);
300
306
  <div {...@rest}>{`Counter: ${@count} Double: ${props.@double}`}</div>
301
307
  <button onClick={() => @up()}>{'UP'}</button>
302
308
  }
@@ -1,4 +1,4 @@
1
- import { track, flushSync, TrackedArray } from 'ripple';
1
+ import { flushSync, RippleArray, type Component } from 'ripple';
2
2
 
3
3
  describe('composite > render', () => {
4
4
  it('renders composite components', () => {
@@ -7,7 +7,7 @@ describe('composite > render', () => {
7
7
  }
8
8
 
9
9
  component App() {
10
- let count = track(0);
10
+ let count = #ripple.track(0);
11
11
 
12
12
  <button onClick={() => @count++}>{'Increment'}</button>
13
13
  <Button {@count} />
@@ -73,7 +73,7 @@ describe('composite > render', () => {
73
73
 
74
74
  it('handles generics', () => {
75
75
  component ArrayTest() {
76
- let items = new TrackedArray<number>();
76
+ let items = new RippleArray<number>();
77
77
  items.push.apply(items, [1, 2, 3, 4, 5]);
78
78
 
79
79
  <pre>{items ? JSON.stringify(items) : 'Loading...'}</pre>
@@ -83,9 +83,18 @@ describe('composite > render', () => {
83
83
  });
84
84
 
85
85
  it('should not render <undefined> tag when a passed in component is undefined', () => {
86
- component Child({ children, NonExistent, ...props }) {
86
+ component Child({
87
+ children,
88
+ NonExistent,
89
+ ...props
90
+ }: {
91
+ children?: Component;
92
+ NonExistent?: Component;
93
+ [key: string]: any;
94
+ }) {
87
95
  <div {...props}>
88
96
  <children />
97
+ // @ts-expect-error - intentionally testing behavior when a component is undefined
89
98
  <NonExistent />
90
99
  </div>
91
100
  }
@@ -1,10 +1,10 @@
1
- import { flushSync, track } from 'ripple';
1
+ import { flushSync } from 'ripple';
2
2
 
3
3
  describe('computed tracked properties', () => {
4
4
  it('should update a property using assignment', () => {
5
5
  component App() {
6
6
  let obj = {
7
- [0]: track(0),
7
+ [0]: #ripple.track(0),
8
8
  };
9
9
 
10
10
  <div>{obj.@[0]}</div>
@@ -31,7 +31,7 @@ describe('computed tracked properties', () => {
31
31
  it('should update a property using update expressions', () => {
32
32
  component App() {
33
33
  let obj = {
34
- [0]: track(0),
34
+ [0]: #ripple.track(0),
35
35
  };
36
36
 
37
37
  <div>{obj.@[0]}</div>
@@ -1,9 +1,9 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { Context, flushSync } from 'ripple';
2
+ import { flushSync } from 'ripple';
3
3
 
4
4
  describe('context', () => {
5
5
  it('creates a reactive ref with initial value', () => {
6
- const MyContext = new Context<string | null>(null);
6
+ const MyContext = #ripple.context<string | null>(null);
7
7
 
8
8
  component Child() {
9
9
  const value = MyContext.get();
@@ -25,7 +25,7 @@ describe('context', () => {
25
25
  });
26
26
 
27
27
  it('handles context captured inside a computed tracked', () => {
28
- const MyContext = new Context<number | null>(null);
28
+ const MyContext = #ripple.context<number | null>(null);
29
29
 
30
30
  const doubleContext = () => {
31
31
  const value = MyContext.get() as number;
@@ -428,9 +428,9 @@ component Child1() {
428
428
  'handles sibling combinators with dynamic component and :global before scoped elements',
429
429
  () => {
430
430
  const source = `
431
- import { track } from 'ripple';
431
+
432
432
  export component Test({ children }) {
433
- const DynamicComponent = track(() => Child1);
433
+ const DynamicComponent = #ripple.track(() => Child1);
434
434
  <div>
435
435
  <p class="before">{'before'}</p>
436
436
 
@@ -474,9 +474,9 @@ component Child1() {
474
474
  'handles sibling combinators with dynamic element or regular element and :global before scoped elements',
475
475
  () => {
476
476
  const source = `
477
- import { track } from 'ripple';
477
+
478
478
  export component Test({ children, classes }) {
479
- const dynamicElement = track('div');
479
+ const dynamicElement = #ripple.track('div');
480
480
  <div>
481
481
  <p class="before">{'before'}</p>
482
482
  // Use Dynamic Element but it's the same with a regular one