ripple 0.3.112 → 0.3.113

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 (31) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/package.json +3 -3
  3. package/tests/client/basic/basic.rendering.test.tsrx +72 -0
  4. package/tests/client/compiler/compiler.basic.test.tsrx +36 -4
  5. package/tests/client/composite/composite.props.test.tsrx +46 -0
  6. package/tests/hydration/basic.test.js +39 -0
  7. package/tests/hydration/compiled/client/basic.js +133 -5
  8. package/tests/hydration/compiled/client/if-fragment-controlflow.js +166 -214
  9. package/tests/hydration/compiled/client/streaming.js +81 -105
  10. package/tests/hydration/compiled/server/basic.js +121 -2
  11. package/tests/hydration/compiled/server/events.js +61 -5
  12. package/tests/hydration/compiled/server/for.js +242 -26
  13. package/tests/hydration/compiled/server/head.js +45 -5
  14. package/tests/hydration/compiled/server/html.js +24 -8
  15. package/tests/hydration/compiled/server/if-fragment-controlflow.js +73 -18
  16. package/tests/hydration/compiled/server/mixed-control-flow.js +9 -1
  17. package/tests/hydration/compiled/server/nested-control-flow.js +9 -1
  18. package/tests/hydration/compiled/server/reactivity.js +43 -3
  19. package/tests/hydration/compiled/server/streaming.js +131 -38
  20. package/tests/hydration/compiled/server/track-async-serialization.js +106 -10
  21. package/tests/hydration/compiled/server/try.js +45 -5
  22. package/tests/hydration/components/basic.tsrx +43 -0
  23. package/tests/server/basic.test.tsrx +30 -0
  24. package/tests/server/compiler.test.tsrx +29 -4
  25. package/tests/server/composite.props.test.tsrx +26 -0
  26. package/tests/server/streaming-ssr.test.tsrx +9 -9
  27. package/tests/server/track-async-serialization.test.tsrx +4 -4
  28. package/tests/types/component-return.ts +48 -0
  29. package/tests/utils/runtime-imports.test.js +5 -1
  30. package/tsconfig.typecheck.json +1 -1
  31. package/types/index.d.ts +10 -1
@@ -12,13 +12,21 @@ export function IfFragmentForElement() {
12
12
  __out += '<div class="feed-c"><!--[-->';
13
13
 
14
14
  if (hasLoaded) {
15
- __out += '<!--[--><!--[-->';
15
+ __out += '<!--[-->';
16
16
 
17
17
  for (const muze of muzes) {
18
- __out += '<p class="muze">' + _$_.escape(muze.muzeId) + '</p>';
18
+ __out += '<p class="muze">';
19
+
20
+ {
21
+ _$_.output_push(__out);
22
+ __out = '';
23
+ _$_.render_expression(muze.muzeId);
24
+ }
25
+
26
+ __out += '</p>';
19
27
  }
20
28
 
21
- __out += '<!--]--><span class="after">after</span><!--]-->';
29
+ __out += '<!--]--><span class="after">after</span>';
22
30
  }
23
31
 
24
32
  __out += '<!--]--></div>';
@@ -38,10 +46,18 @@ export function IfFragmentForIfIf() {
38
46
  __out += '<div class="feed"><!--[-->';
39
47
 
40
48
  if (hasLoaded) {
41
- __out += '<!--[--><!--[-->';
49
+ __out += '<!--[-->';
42
50
 
43
51
  for (const muze of muzes) {
44
- __out += '<p class="muze">' + _$_.escape(muze.muzeId) + '</p>';
52
+ __out += '<p class="muze">';
53
+
54
+ {
55
+ _$_.output_push(__out);
56
+ __out = '';
57
+ _$_.render_expression(muze.muzeId);
58
+ }
59
+
60
+ __out += '</p>';
45
61
  }
46
62
 
47
63
  __out += '<!--]--><!--[-->';
@@ -56,7 +72,7 @@ export function IfFragmentForIfIf() {
56
72
  __out += '<span class="empty">empty</span>';
57
73
  }
58
74
 
59
- __out += '<!--]--><!--]-->';
75
+ __out += '<!--]-->';
60
76
  }
61
77
 
62
78
  __out += '<!--]--></div>';
@@ -75,7 +91,7 @@ export function IfFragmentElements() {
75
91
  __out += '<div class="feed-b"><!--[-->';
76
92
 
77
93
  if (hasLoaded) {
78
- __out += '<!--[--><p class="muze">b</p><p class="muze">c</p><!--]-->';
94
+ __out += '<p class="muze">b</p><p class="muze">c</p>';
79
95
  }
80
96
 
81
97
  __out += '<!--]--></div>';
@@ -94,7 +110,15 @@ export function ComponentBodyFragmentControlFlow() {
94
110
  __out += '<!--[--><!--[-->';
95
111
 
96
112
  for (const muze of muzes) {
97
- __out += '<p class="muze">' + _$_.escape(muze.muzeId) + '</p>';
113
+ __out += '<p class="muze">';
114
+
115
+ {
116
+ _$_.output_push(__out);
117
+ __out = '';
118
+ _$_.render_expression(muze.muzeId);
119
+ }
120
+
121
+ __out += '</p>';
98
122
  }
99
123
 
100
124
  __out += '<!--]--><span class="after">after</span><!--]-->';
@@ -121,7 +145,15 @@ export function ComponentBodyCodeBlockControlFlow() {
121
145
  __out += '<!--[-->';
122
146
 
123
147
  for (const muze of rows) {
124
- __out += '<p class="muze">' + _$_.escape(muze.muzeId) + '</p>';
148
+ __out += '<p class="muze">';
149
+
150
+ {
151
+ _$_.output_push(__out);
152
+ __out = '';
153
+ _$_.render_expression(muze.muzeId);
154
+ }
155
+
156
+ __out += '</p>';
125
157
  }
126
158
 
127
159
  __out += '<!--]-->';
@@ -145,7 +177,6 @@ export function IfCodeBlockControlFlow() {
145
177
  __out += '<div class="feed-f"><!--[-->';
146
178
 
147
179
  if (hasLoaded) {
148
- __out += '<!--[-->';
149
180
  _$_.output_push(__out);
150
181
  __out = '';
151
182
 
@@ -156,14 +187,22 @@ export function IfCodeBlockControlFlow() {
156
187
  __out += '<!--[-->';
157
188
 
158
189
  for (const muze of rows) {
159
- __out += '<p class="muze">' + _$_.escape(muze.muzeId) + '</p>';
190
+ __out += '<p class="muze">';
191
+
192
+ {
193
+ _$_.output_push(__out);
194
+ __out = '';
195
+ _$_.render_expression(muze.muzeId);
196
+ }
197
+
198
+ __out += '</p>';
160
199
  }
161
200
 
162
201
  __out += '<!--]-->';
163
202
  _$_.output_push(__out);
164
203
  }));
165
204
 
166
- __out += '<span class="after">after</span><!--]-->';
205
+ __out += '<span class="after">after</span>';
167
206
  }
168
207
 
169
208
  __out += '<!--]--></div>';
@@ -185,13 +224,21 @@ export function IfElseFragment() {
185
224
  if (hasLoaded) {
186
225
  __out += '<span class="loading">loading</span>';
187
226
  } else {
188
- __out += '<!--[--><!--[-->';
227
+ __out += '<!--[-->';
189
228
 
190
229
  for (const muze of muzes) {
191
- __out += '<p class="muze">' + _$_.escape(muze.muzeId) + '</p>';
230
+ __out += '<p class="muze">';
231
+
232
+ {
233
+ _$_.output_push(__out);
234
+ __out = '';
235
+ _$_.render_expression(muze.muzeId);
236
+ }
237
+
238
+ __out += '</p>';
192
239
  }
193
240
 
194
- __out += '<!--]--><span class="after">after</span><!--]-->';
241
+ __out += '<!--]--><span class="after">after</span>';
195
242
  }
196
243
 
197
244
  __out += '<!--]--></div>';
@@ -211,13 +258,21 @@ export function IfDivFragment() {
211
258
  __out += '<div class="feed-e"><!--[-->';
212
259
 
213
260
  if (hasLoaded) {
214
- __out += '<section><!--[--><!--[-->';
261
+ __out += '<section><!--[-->';
215
262
 
216
263
  for (const muze of muzes) {
217
- __out += '<p class="muze">' + _$_.escape(muze.muzeId) + '</p>';
264
+ __out += '<p class="muze">';
265
+
266
+ {
267
+ _$_.output_push(__out);
268
+ __out = '';
269
+ _$_.render_expression(muze.muzeId);
270
+ }
271
+
272
+ __out += '</p>';
218
273
  }
219
274
 
220
- __out += '<!--]--><span class="after">after</span><!--]--></section>';
275
+ __out += '<!--]--><span class="after">after</span></section>';
221
276
  }
222
277
 
223
278
  __out += '<!--]--></div>';
@@ -219,7 +219,15 @@ function AsyncRow({ label }) {
219
219
  _$_.regular_block(() => {
220
220
  let __out = '';
221
221
 
222
- __out += '<div class="resolved-row">' + _$_.escape(lazy_3.value) + '</div>';
222
+ __out += '<div class="resolved-row">';
223
+
224
+ {
225
+ _$_.output_push(__out);
226
+ __out = '';
227
+ _$_.render_expression(lazy_3.value);
228
+ }
229
+
230
+ __out += '</div>';
223
231
  _$_.output_push(__out);
224
232
  });
225
233
  });
@@ -18,7 +18,15 @@ export function ForIf() {
18
18
  __out += '<!--[-->';
19
19
 
20
20
  if (item.show) {
21
- __out += '<li' + _$_.attr('class', `item item-${item.id}`) + '>' + _$_.escape(item.label) + '</li>';
21
+ __out += '<li' + _$_.attr('class', `item item-${item.id}`) + '>';
22
+
23
+ {
24
+ _$_.output_push(__out);
25
+ __out = '';
26
+ _$_.render_expression(item.label);
27
+ }
28
+
29
+ __out += '</li>';
22
30
  }
23
31
 
24
32
  __out += '<!--]-->';
@@ -10,7 +10,15 @@ export function TrackedState() {
10
10
  _$_.regular_block(() => {
11
11
  let __out = '';
12
12
 
13
- __out += '<div class="count">' + _$_.escape(lazy.value) + '</div>';
13
+ __out += '<div class="count">';
14
+
15
+ {
16
+ _$_.output_push(__out);
17
+ __out = '';
18
+ _$_.render_expression(lazy.value);
19
+ }
20
+
21
+ __out += '</div>';
14
22
  _$_.output_push(__out);
15
23
  });
16
24
  });
@@ -23,7 +31,15 @@ export function CounterWithInitial(props) {
23
31
  _$_.regular_block(() => {
24
32
  let __out = '';
25
33
 
26
- __out += '<div><span class="count">' + _$_.escape(lazy_1.value) + '</span></div>';
34
+ __out += '<div><span class="count">';
35
+
36
+ {
37
+ _$_.output_push(__out);
38
+ __out = '';
39
+ _$_.render_expression(lazy_1.value);
40
+ }
41
+
42
+ __out += '</span></div>';
27
43
  _$_.output_push(__out);
28
44
  });
29
45
  });
@@ -74,7 +90,31 @@ export function MultipleTracked() {
74
90
  _$_.regular_block(() => {
75
91
  let __out = '';
76
92
 
77
- __out += '<div class="multiple-tracked"><div class="x">' + _$_.escape(lazy_4.value) + '</div><div class="y">' + _$_.escape(lazy_5.value) + '</div><div class="z">' + _$_.escape(lazy_6.value) + '</div></div>';
93
+ __out += '<div class="multiple-tracked"><div class="x">';
94
+
95
+ {
96
+ _$_.output_push(__out);
97
+ __out = '';
98
+ _$_.render_expression(lazy_4.value);
99
+ }
100
+
101
+ __out += '</div><div class="y">';
102
+
103
+ {
104
+ _$_.output_push(__out);
105
+ __out = '';
106
+ _$_.render_expression(lazy_5.value);
107
+ }
108
+
109
+ __out += '</div><div class="z">';
110
+
111
+ {
112
+ _$_.output_push(__out);
113
+ __out = '';
114
+ _$_.render_expression(lazy_6.value);
115
+ }
116
+
117
+ __out += '</div></div>';
78
118
  _$_.output_push(__out);
79
119
  });
80
120
  });
@@ -93,7 +93,15 @@ function CatchOnlyContent() {
93
93
  _$_.regular_block(() => {
94
94
  let __out = '';
95
95
 
96
- __out += '<p class="resolved">' + _$_.escape(lazy_2.value) + '</p>';
96
+ __out += '<p class="resolved">';
97
+
98
+ {
99
+ _$_.output_push(__out);
100
+ __out = '';
101
+ _$_.render_expression(lazy_2.value);
102
+ }
103
+
104
+ __out += '</p>';
97
105
  _$_.output_push(__out);
98
106
  });
99
107
  });
@@ -129,7 +137,15 @@ export function StreamCatchOnly() {
129
137
  (e) => {
130
138
  let __out = '';
131
139
 
132
- __out += '<!--[--><em class="caught">' + _$_.escape(e.message) + '</em><!--]-->';
140
+ __out += '<!--[--><em class="caught">';
141
+
142
+ {
143
+ _$_.output_push(__out);
144
+ __out = '';
145
+ _$_.render_expression(e.message);
146
+ }
147
+
148
+ __out += '</em><!--]-->';
133
149
  _$_.output_push(__out);
134
150
  },
135
151
  null
@@ -147,7 +163,15 @@ function RejectContent() {
147
163
  _$_.regular_block(() => {
148
164
  let __out = '';
149
165
 
150
- __out += '<p class="resolved">' + _$_.escape(lazy_3.value) + '</p>';
166
+ __out += '<p class="resolved">';
167
+
168
+ {
169
+ _$_.output_push(__out);
170
+ __out = '';
171
+ _$_.render_expression(lazy_3.value);
172
+ }
173
+
174
+ __out += '</p>';
151
175
  _$_.output_push(__out);
152
176
  });
153
177
  });
@@ -185,7 +209,15 @@ export function StreamRejects() {
185
209
  _$_.regular_block(() => {
186
210
  let __out = '';
187
211
 
188
- __out += '<em class="caught">' + _$_.escape(e.message) + '</em>';
212
+ __out += '<em class="caught">';
213
+
214
+ {
215
+ _$_.output_push(__out);
216
+ __out = '';
217
+ _$_.render_expression(e.message);
218
+ }
219
+
220
+ __out += '</em>';
189
221
  _$_.output_push(__out);
190
222
  });
191
223
 
@@ -220,7 +252,15 @@ function NoCatchContent() {
220
252
  _$_.regular_block(() => {
221
253
  let __out = '';
222
254
 
223
- __out += '<p class="resolved">' + _$_.escape(lazy_4.value) + '</p>';
255
+ __out += '<p class="resolved">';
256
+
257
+ {
258
+ _$_.output_push(__out);
259
+ __out = '';
260
+ _$_.render_expression(lazy_4.value);
261
+ }
262
+
263
+ __out += '</p>';
224
264
  _$_.output_push(__out);
225
265
  });
226
266
  });
@@ -275,7 +315,15 @@ export function RootCatch({ error, reset }) {
275
315
  _$_.regular_block(() => {
276
316
  let __out = '';
277
317
 
278
- __out += '<section class="root-catch">' + _$_.escape(error.message) + '</section>';
318
+ __out += '<section class="root-catch">';
319
+
320
+ {
321
+ _$_.output_push(__out);
322
+ __out = '';
323
+ _$_.render_expression(error.message);
324
+ }
325
+
326
+ __out += '</section>';
279
327
  _$_.output_push(__out);
280
328
  });
281
329
  });
@@ -302,7 +350,15 @@ function HeadContent() {
302
350
  __out += '<!--[--><!--[-->';
303
351
 
304
352
  if (lazy_5.value) {
305
- __out += '<!--[--><p class="head-content">' + _$_.escape(lazy_5.value) + '</p>';
353
+ __out += '<p class="head-content">';
354
+
355
+ {
356
+ _$_.output_push(__out);
357
+ __out = '';
358
+ _$_.render_expression(lazy_5.value);
359
+ }
360
+
361
+ __out += '</p>';
306
362
  _$_.output_push(__out);
307
363
  __out = '';
308
364
  _$_.set_output_target('head');
@@ -310,7 +366,6 @@ function HeadContent() {
310
366
  _$_.output_push(__out);
311
367
  __out = '';
312
368
  _$_.set_output_target(null);
313
- __out += '<!--]-->';
314
369
  }
315
370
 
316
371
  __out += '<!--]--><!--]-->';
@@ -370,7 +425,15 @@ export function StreamRootDirect() {
370
425
  _$_.regular_block(() => {
371
426
  let __out = '';
372
427
 
373
- __out += '<p class="root-async">' + _$_.escape(lazy_6.value) + '</p>';
428
+ __out += '<p class="root-async">';
429
+
430
+ {
431
+ _$_.output_push(__out);
432
+ __out = '';
433
+ _$_.render_expression(lazy_6.value);
434
+ }
435
+
436
+ __out += '</p>';
374
437
  _$_.output_push(__out);
375
438
  });
376
439
  });
@@ -383,7 +446,15 @@ function OuterContent() {
383
446
  _$_.regular_block(() => {
384
447
  let __out = '';
385
448
 
386
- __out += '<p class="outer">' + _$_.escape(lazy_7.value) + '</p>';
449
+ __out += '<p class="outer">';
450
+
451
+ {
452
+ _$_.output_push(__out);
453
+ __out = '';
454
+ _$_.render_expression(lazy_7.value);
455
+ }
456
+
457
+ __out += '</p>';
387
458
  _$_.output_push(__out);
388
459
  });
389
460
  });
@@ -396,7 +467,15 @@ function InnerContent() {
396
467
  _$_.regular_block(() => {
397
468
  let __out = '';
398
469
 
399
- __out += '<p class="inner">' + _$_.escape(lazy_8.value) + '</p>';
470
+ __out += '<p class="inner">';
471
+
472
+ {
473
+ _$_.output_push(__out);
474
+ __out = '';
475
+ _$_.render_expression(lazy_8.value);
476
+ }
477
+
478
+ __out += '</p>';
400
479
  _$_.output_push(__out);
401
480
  });
402
481
  });
@@ -414,41 +493,55 @@ export function StreamNested() {
414
493
 
415
494
  _$_.regular_block(() => {
416
495
  {
417
- {
418
- const comp = OuterContent;
419
- const args = [{}];
420
-
421
- _$_.render_component(comp, ...args);
422
- }
496
+ const comp = OuterContent;
497
+ const args = [{}];
423
498
 
424
- _$_.try_block(
425
- () => {
426
- let __out = '';
499
+ _$_.render_component(comp, ...args);
500
+ }
501
+ });
427
502
 
428
- __out += '<!--[-->';
503
+ _$_.output_push(__out);
504
+ __out = '';
429
505
 
430
- {
431
- const comp = InnerContent;
432
- const args = [{}];
506
+ _$_.try_block(
507
+ () => {
508
+ let __out = '';
433
509
 
434
- _$_.output_push(__out);
435
- __out = '';
436
- _$_.render_component(comp, ...args);
437
- }
510
+ __out += '<!--[-->';
511
+ _$_.output_push(__out);
512
+ __out = '';
438
513
 
439
- __out += '<!--]-->';
440
- _$_.output_push(__out);
441
- },
442
- null,
443
- () => {
444
- let __out = '';
514
+ _$_.regular_block(() => {
515
+ {
516
+ const comp = InnerContent;
517
+ const args = [{}];
445
518
 
446
- __out += '<!--[--><p class="inner-loading">inner-loading</p><!--]-->';
447
- _$_.output_push(__out);
519
+ _$_.render_component(comp, ...args);
448
520
  }
449
- );
521
+ });
522
+
523
+ __out += '<!--]-->';
524
+ _$_.output_push(__out);
525
+ },
526
+ null,
527
+ () => {
528
+ let __out = '';
529
+
530
+ __out += '<!--[-->';
531
+ _$_.output_push(__out);
532
+ __out = '';
533
+
534
+ _$_.regular_block(() => {
535
+ let __out = '';
536
+
537
+ __out += '<p class="inner-loading">inner-loading</p>';
538
+ _$_.output_push(__out);
539
+ });
540
+
541
+ __out += '<!--]-->';
542
+ _$_.output_push(__out);
450
543
  }
451
- });
544
+ );
452
545
 
453
546
  __out += '<!--]-->';
454
547
  _$_.output_push(__out);