ripple 0.3.10 → 0.3.11

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 (39) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/package.json +2 -2
  3. package/src/compiler/errors.js +1 -1
  4. package/src/compiler/index.d.ts +3 -1
  5. package/src/compiler/phases/1-parse/index.js +170 -8
  6. package/src/compiler/phases/2-analyze/index.js +231 -20
  7. package/src/compiler/phases/3-transform/client/index.js +169 -77
  8. package/src/compiler/phases/3-transform/server/index.js +46 -3
  9. package/src/compiler/types/index.d.ts +19 -2
  10. package/src/compiler/types/parse.d.ts +1 -1
  11. package/src/compiler/utils.js +174 -0
  12. package/src/runtime/index-client.js +14 -4
  13. package/src/runtime/internal/client/composite.js +2 -2
  14. package/src/runtime/internal/client/expression.js +64 -2
  15. package/src/runtime/internal/client/portal.js +1 -1
  16. package/src/utils/builders.js +30 -0
  17. package/tests/client/basic/__snapshots__/basic.rendering.test.ripple.snap +1 -0
  18. package/tests/client/basic/basic.rendering.test.ripple +4 -2
  19. package/tests/client/composite/composite.render.test.ripple +46 -0
  20. package/tests/client/return.test.ripple +101 -0
  21. package/tests/client/tsx.test.ripple +486 -0
  22. package/tests/hydration/compiled/client/basic.js +8 -24
  23. package/tests/hydration/compiled/client/composite.js +6 -24
  24. package/tests/hydration/compiled/client/events.js +9 -54
  25. package/tests/hydration/compiled/client/for.js +59 -152
  26. package/tests/hydration/compiled/client/head.js +5 -20
  27. package/tests/hydration/compiled/client/hmr.js +2 -8
  28. package/tests/hydration/compiled/client/html.js +59 -226
  29. package/tests/hydration/compiled/client/if-children.js +6 -22
  30. package/tests/hydration/compiled/client/mixed-control-flow.js +18 -66
  31. package/tests/hydration/compiled/client/nested-control-flow.js +92 -368
  32. package/tests/hydration/compiled/client/portal.js +4 -16
  33. package/tests/hydration/compiled/client/reactivity.js +7 -40
  34. package/tests/hydration/compiled/client/return.js +1 -4
  35. package/tests/hydration/compiled/client/try.js +2 -2
  36. package/tests/utils/compiler-compat-config.test.js +38 -0
  37. package/tests/utils/vite-plugin-config.test.js +113 -0
  38. package/tsconfig.typecheck.json +2 -1
  39. package/types/index.d.ts +2 -12
@@ -44,13 +44,10 @@ export function IfWithChildren(__anchor, { children }, __block) {
44
44
  {
45
45
  var expression = _$_.child(div_3);
46
46
 
47
+ _$_.expression(expression, () => children);
47
48
  _$_.pop(div_3);
48
49
  }
49
50
 
50
- _$_.render(() => {
51
- _$_.expression(expression, () => children);
52
- });
53
-
54
51
  _$_.append(__anchor, div_3);
55
52
  };
56
53
 
@@ -74,7 +71,7 @@ export function ChildItem(__anchor, { text: label }, __block) {
74
71
  {
75
72
  var expression_1 = _$_.child(div_4, true);
76
73
 
77
- expression_1.nodeValue = label;
74
+ _$_.expression(expression_1, () => label);
78
75
  _$_.pop(div_4);
79
76
  }
80
77
 
@@ -91,9 +88,7 @@ export function TestIfWithChildren(__anchor, _, __block) {
91
88
  IfWithChildren(
92
89
  node_1,
93
90
  {
94
- children: _$_.ripple_element(function render_children(__anchor, _, __block) {
95
- _$_.push_component();
96
-
91
+ children: _$_.ripple_element(function render_children(__anchor, __block) {
97
92
  var fragment_1 = root_4();
98
93
  var node_2 = _$_.first_child_frag(fragment_1);
99
94
 
@@ -103,7 +98,6 @@ export function TestIfWithChildren(__anchor, _, __block) {
103
98
 
104
99
  ChildItem(node_3, { text: "Item 2" }, _$_.active_block);
105
100
  _$_.append(__anchor, fragment_1);
106
- _$_.pop_component();
107
101
  })
108
102
  },
109
103
  _$_.active_block
@@ -166,13 +160,10 @@ export function IfWithSiblingsAndChildren(__anchor, { children }, __block) {
166
160
  {
167
161
  var expression_2 = _$_.child(div_9);
168
162
 
163
+ _$_.expression(expression_2, () => children);
169
164
  _$_.pop(div_9);
170
165
  }
171
166
 
172
- _$_.render(() => {
173
- _$_.expression(expression_2, () => children);
174
- });
175
-
176
167
  _$_.append(__anchor, div_9);
177
168
  };
178
169
 
@@ -197,9 +188,7 @@ export function TestIfWithSiblingsAndChildren(__anchor, _, __block) {
197
188
  IfWithSiblingsAndChildren(
198
189
  node_6,
199
190
  {
200
- children: _$_.ripple_element(function render_children(__anchor, _, __block) {
201
- _$_.push_component();
202
-
191
+ children: _$_.ripple_element(function render_children(__anchor, __block) {
203
192
  var fragment_3 = root_10();
204
193
  var node_7 = _$_.first_child_frag(fragment_3);
205
194
 
@@ -209,7 +198,6 @@ export function TestIfWithSiblingsAndChildren(__anchor, _, __block) {
209
198
 
210
199
  ChildItem(node_8, { text: "Item B" }, _$_.active_block);
211
200
  _$_.append(__anchor, fragment_3);
212
- _$_.pop_component();
213
201
  })
214
202
  },
215
203
  _$_.active_block
@@ -378,6 +366,7 @@ export function DomChildrenThenStaticSiblings(__anchor, _, __block) {
378
366
  {
379
367
  var expression_3 = _$_.child(li_1, true);
380
368
 
369
+ _$_.expression(expression_3, () => 'Item count: ' + _$_.with_scope(__block, () => String(_$_.get(lazy_6))));
381
370
  _$_.pop(li_1);
382
371
  }
383
372
  }
@@ -389,11 +378,6 @@ export function DomChildrenThenStaticSiblings(__anchor, _, __block) {
389
378
 
390
379
  button_5.__click = () => _$_.update(lazy_6);
391
380
  _$_.next();
392
-
393
- _$_.render(() => {
394
- _$_.set_text(expression_3, 'Item count: ' + _$_.with_scope(__block, () => String(_$_.get(lazy_6))));
395
- });
396
-
397
381
  _$_.append(__anchor, fragment_6, true);
398
382
  _$_.pop_component();
399
383
  }
@@ -68,25 +68,13 @@ export function MixedControlFlowStatic(__anchor, _, __block) {
68
68
  {
69
69
  var expression = _$_.child(div_1, true);
70
70
 
71
+ _$_.expression(expression, () => `A-${_$_.get(pattern).id}`);
71
72
  _$_.pop(div_1);
72
73
  }
73
74
 
74
- _$_.render(
75
- (__prev) => {
76
- var __a = `A-${_$_.get(pattern).id}`;
77
-
78
- if (__prev.a !== __a) {
79
- _$_.set_text(expression, __prev.a = __a);
80
- }
81
-
82
- var __b = `row row-${_$_.get(pattern).id} kind-a`;
83
-
84
- if (__prev.b !== __b) {
85
- _$_.set_class(div_1, __prev.b = __b, void 0, true);
86
- }
87
- },
88
- { a: ' ', b: Symbol() }
89
- );
75
+ _$_.render(() => {
76
+ _$_.set_class(div_1, `row row-${_$_.get(pattern).id} kind-a`, void 0, true);
77
+ });
90
78
 
91
79
  _$_.append(__anchor, div_1);
92
80
  });
@@ -119,25 +107,13 @@ export function MixedControlFlowStatic(__anchor, _, __block) {
119
107
  {
120
108
  var expression_1 = _$_.child(div_3, true);
121
109
 
110
+ _$_.expression(expression_1, () => `B-${_$_.get(pattern).id}`);
122
111
  _$_.pop(div_3);
123
112
  }
124
113
 
125
- _$_.render(
126
- (__prev) => {
127
- var __a = `B-${_$_.get(pattern).id}`;
128
-
129
- if (__prev.a !== __a) {
130
- _$_.set_text(expression_1, __prev.a = __a);
131
- }
132
-
133
- var __b = `row row-${_$_.get(pattern).id} kind-b`;
134
-
135
- if (__prev.b !== __b) {
136
- _$_.set_class(div_3, __prev.b = __b, void 0, true);
137
- }
138
- },
139
- { a: ' ', b: Symbol() }
140
- );
114
+ _$_.render(() => {
115
+ _$_.set_class(div_3, `row row-${_$_.get(pattern).id} kind-b`, void 0, true);
116
+ });
141
117
 
142
118
  _$_.append(__anchor, div_3);
143
119
  });
@@ -246,25 +222,13 @@ export function MixedControlFlowReactive(__anchor, _, __block) {
246
222
  {
247
223
  var expression_2 = _$_.child(p_1, true);
248
224
 
225
+ _$_.expression(expression_2, () => `A:${_$_.get(pattern_1).label}`);
249
226
  _$_.pop(p_1);
250
227
  }
251
228
 
252
- _$_.render(
253
- (__prev) => {
254
- var __a = `A:${_$_.get(pattern_1).label}`;
255
-
256
- if (__prev.a !== __a) {
257
- _$_.set_text(expression_2, __prev.a = __a);
258
- }
259
-
260
- var __b = `item item-${_$_.get(pattern_1).id}`;
261
-
262
- if (__prev.b !== __b) {
263
- _$_.set_class(p_1, __prev.b = __b, void 0, true);
264
- }
265
- },
266
- { a: ' ', b: Symbol() }
267
- );
229
+ _$_.render(() => {
230
+ _$_.set_class(p_1, `item item-${_$_.get(pattern_1).id}`, void 0, true);
231
+ });
268
232
 
269
233
  _$_.append(__anchor, p_1);
270
234
  });
@@ -293,25 +257,13 @@ export function MixedControlFlowReactive(__anchor, _, __block) {
293
257
  {
294
258
  var expression_3 = _$_.child(p_3, true);
295
259
 
260
+ _$_.expression(expression_3, () => `B:${_$_.get(pattern_1).label}`);
296
261
  _$_.pop(p_3);
297
262
  }
298
263
 
299
- _$_.render(
300
- (__prev) => {
301
- var __a = `B:${_$_.get(pattern_1).label}`;
302
-
303
- if (__prev.a !== __a) {
304
- _$_.set_text(expression_3, __prev.a = __a);
305
- }
306
-
307
- var __b = `item item-${_$_.get(pattern_1).id}`;
308
-
309
- if (__prev.b !== __b) {
310
- _$_.set_class(p_3, __prev.b = __b, void 0, true);
311
- }
312
- },
313
- { a: ' ', b: Symbol() }
314
- );
264
+ _$_.render(() => {
265
+ _$_.set_class(p_3, `item item-${_$_.get(pattern_1).id}`, void 0, true);
266
+ });
315
267
 
316
268
  _$_.append(__anchor, p_3);
317
269
  });
@@ -409,7 +361,7 @@ export function MixedControlFlowAsyncPending(__anchor, _, __block) {
409
361
  {
410
362
  var expression_4 = _$_.child(div_7, true);
411
363
 
412
- expression_4.nodeValue = `pending ${row}`;
364
+ _$_.expression(expression_4, () => `pending ${row}`);
413
365
  _$_.pop(div_7);
414
366
  }
415
367
 
@@ -471,7 +423,7 @@ function AsyncRow(__anchor, { label }, __block) {
471
423
  {
472
424
  var expression_5 = _$_.child(div_9, true);
473
425
 
474
- expression_5.nodeValue = value;
426
+ _$_.expression(expression_5, () => value);
475
427
  _$_.pop(div_9);
476
428
  }
477
429