ripple 0.3.83 → 0.3.85

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 (58) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/package.json +3 -3
  3. package/src/constants.js +4 -0
  4. package/src/runtime/index-client.js +2 -0
  5. package/src/runtime/index-server.js +13 -0
  6. package/src/runtime/internal/client/component.js +3 -3
  7. package/src/runtime/internal/client/constants.js +4 -0
  8. package/src/runtime/internal/client/for.js +22 -1
  9. package/src/runtime/internal/client/if.js +18 -2
  10. package/src/runtime/internal/client/index.js +1 -0
  11. package/src/runtime/internal/client/operations.js +25 -0
  12. package/src/runtime/internal/client/runtime.js +62 -10
  13. package/src/runtime/internal/client/switch.js +16 -2
  14. package/src/runtime/internal/client/template.js +10 -2
  15. package/src/runtime/internal/client/try.js +12 -2
  16. package/src/runtime/internal/client/types.d.ts +4 -0
  17. package/src/runtime/proxy.js +17 -1
  18. package/tests/client/__snapshots__/for.test.tsrx.snap +0 -2
  19. package/tests/client/compiler/compiler.basic.test.tsrx +5 -2
  20. package/tests/client/composite/__snapshots__/composite.render.test.tsrx.snap +0 -4
  21. package/tests/client/object.test.tsrx +47 -1
  22. package/tests/client/scoped-flush.test.tsrx +105 -0
  23. package/tests/hydration/compiled/client/basic.js +198 -214
  24. package/tests/hydration/compiled/client/composite.js +23 -72
  25. package/tests/hydration/compiled/client/for.js +66 -72
  26. package/tests/hydration/compiled/client/hmr.js +2 -13
  27. package/tests/hydration/compiled/client/html.js +619 -479
  28. package/tests/hydration/compiled/client/if-children.js +72 -84
  29. package/tests/hydration/compiled/client/if.js +87 -92
  30. package/tests/hydration/compiled/client/mixed-control-flow.js +120 -160
  31. package/tests/hydration/compiled/client/nested-control-flow.js +288 -360
  32. package/tests/hydration/compiled/client/portal.js +15 -21
  33. package/tests/hydration/compiled/client/reactivity.js +7 -12
  34. package/tests/hydration/compiled/client/switch.js +113 -115
  35. package/tests/hydration/compiled/client/track-async-serialization.js +71 -122
  36. package/tests/hydration/compiled/client/try.js +26 -41
  37. package/tests/hydration/compiled/server/basic.js +268 -556
  38. package/tests/hydration/compiled/server/composite.js +31 -50
  39. package/tests/hydration/compiled/server/events.js +37 -173
  40. package/tests/hydration/compiled/server/for.js +236 -847
  41. package/tests/hydration/compiled/server/head.js +110 -241
  42. package/tests/hydration/compiled/server/hmr.js +14 -41
  43. package/tests/hydration/compiled/server/html-in-template.js +14 -38
  44. package/tests/hydration/compiled/server/html.js +951 -1176
  45. package/tests/hydration/compiled/server/if-children.js +59 -493
  46. package/tests/hydration/compiled/server/if.js +57 -209
  47. package/tests/hydration/compiled/server/mixed-control-flow.js +144 -250
  48. package/tests/hydration/compiled/server/nested-control-flow.js +309 -559
  49. package/tests/hydration/compiled/server/portal.js +94 -156
  50. package/tests/hydration/compiled/server/reactivity.js +23 -65
  51. package/tests/hydration/compiled/server/return.js +6 -16
  52. package/tests/hydration/compiled/server/switch.js +91 -219
  53. package/tests/hydration/compiled/server/track-async-serialization.js +211 -256
  54. package/tests/hydration/compiled/server/try.js +67 -126
  55. package/tests/hydration/components/html.tsrx +75 -0
  56. package/tests/hydration/html.test.js +50 -0
  57. package/tests/server/compiler.test.tsrx +6 -2
  58. package/types/index.d.ts +2 -0
@@ -8,41 +8,26 @@ export function SwitchStatic() {
8
8
  const status = 'success';
9
9
 
10
10
  _$_.regular_block(() => {
11
- _$_.output_push('<!--[-->');
11
+ let __out = '';
12
+
13
+ __out += '<!--[-->';
12
14
 
13
15
  switch (status) {
14
16
  case 'success':
15
- _$_.output_push('<div');
16
- _$_.output_push(' class="status-success"');
17
- _$_.output_push('>');
18
- {
19
- _$_.output_push('Success');
20
- }
21
- _$_.output_push('</div>');
17
+ __out += '<div class="status-success">Success</div>';
22
18
  break;
23
19
 
24
20
  case 'error':
25
- _$_.output_push('<div');
26
- _$_.output_push(' class="status-error"');
27
- _$_.output_push('>');
28
- {
29
- _$_.output_push('Error');
30
- }
31
- _$_.output_push('</div>');
21
+ __out += '<div class="status-error">Error</div>';
32
22
  break;
33
23
 
34
24
  default:
35
- _$_.output_push('<div');
36
- _$_.output_push(' class="status-unknown"');
37
- _$_.output_push('>');
38
- {
39
- _$_.output_push('Unknown');
40
- }
41
- _$_.output_push('</div>');
25
+ __out += '<div class="status-unknown">Unknown</div>';
42
26
  break;
43
27
  }
44
28
 
45
- _$_.output_push('<!--]-->');
29
+ __out += '<!--]-->';
30
+ _$_.output_push(__out);
46
31
  });
47
32
  });
48
33
  }
@@ -52,52 +37,26 @@ export function SwitchReactive() {
52
37
  let lazy = _$_.track('a', '9b34d955');
53
38
 
54
39
  _$_.regular_block(() => {
55
- {
56
- _$_.output_push('<button');
57
- _$_.output_push(' class="toggle"');
58
- _$_.output_push('>');
59
-
60
- {
61
- _$_.output_push('Toggle');
62
- }
63
-
64
- _$_.output_push('</button>');
65
- _$_.output_push('<!--[-->');
66
-
67
- switch (lazy.value) {
68
- case 'a':
69
- _$_.output_push('<div');
70
- _$_.output_push(' class="case-a"');
71
- _$_.output_push('>');
72
- {
73
- _$_.output_push('Case A');
74
- }
75
- _$_.output_push('</div>');
76
- break;
77
-
78
- case 'b':
79
- _$_.output_push('<div');
80
- _$_.output_push(' class="case-b"');
81
- _$_.output_push('>');
82
- {
83
- _$_.output_push('Case B');
84
- }
85
- _$_.output_push('</div>');
86
- break;
87
-
88
- default:
89
- _$_.output_push('<div');
90
- _$_.output_push(' class="case-c"');
91
- _$_.output_push('>');
92
- {
93
- _$_.output_push('Case C');
94
- }
95
- _$_.output_push('</div>');
96
- break;
97
- }
98
-
99
- _$_.output_push('<!--]-->');
40
+ let __out = '';
41
+
42
+ __out += '<button class="toggle">Toggle</button><!--[-->';
43
+
44
+ switch (lazy.value) {
45
+ case 'a':
46
+ __out += '<div class="case-a">Case A</div>';
47
+ break;
48
+
49
+ case 'b':
50
+ __out += '<div class="case-b">Case B</div>';
51
+ break;
52
+
53
+ default:
54
+ __out += '<div class="case-c">Case C</div>';
55
+ break;
100
56
  }
57
+
58
+ __out += '<!--]-->';
59
+ _$_.output_push(__out);
101
60
  });
102
61
  });
103
62
  }
@@ -107,34 +66,25 @@ export function SwitchFallthrough() {
107
66
  const val = 1;
108
67
 
109
68
  _$_.regular_block(() => {
110
- _$_.output_push('<!--[-->');
69
+ let __out = '';
70
+
71
+ __out += '<!--[-->';
111
72
 
112
73
  switch (val) {
113
74
  case 1:
114
75
  break;
115
76
 
116
77
  case 2:
117
- _$_.output_push('<div');
118
- _$_.output_push(' class="case-1-2"');
119
- _$_.output_push('>');
120
- {
121
- _$_.output_push('1 or 2');
122
- }
123
- _$_.output_push('</div>');
78
+ __out += '<div class="case-1-2">1 or 2</div>';
124
79
  break;
125
80
 
126
81
  default:
127
- _$_.output_push('<div');
128
- _$_.output_push(' class="case-other"');
129
- _$_.output_push('>');
130
- {
131
- _$_.output_push('Other');
132
- }
133
- _$_.output_push('</div>');
82
+ __out += '<div class="case-other">Other</div>';
134
83
  break;
135
84
  }
136
85
 
137
- _$_.output_push('<!--]-->');
86
+ __out += '<!--]-->';
87
+ _$_.output_push(__out);
138
88
  });
139
89
  });
140
90
  }
@@ -144,52 +94,26 @@ export function SwitchNumericLevels() {
144
94
  let lazy_1 = _$_.track(1, '7581a7ab');
145
95
 
146
96
  _$_.regular_block(() => {
147
- {
148
- _$_.output_push('<button');
149
- _$_.output_push(' class="level-toggle"');
150
- _$_.output_push('>');
151
-
152
- {
153
- _$_.output_push('Toggle Level');
154
- }
155
-
156
- _$_.output_push('</button>');
157
- _$_.output_push('<!--[-->');
158
-
159
- switch (lazy_1.value) {
160
- case 1:
161
- _$_.output_push('<div');
162
- _$_.output_push(' class="level-1"');
163
- _$_.output_push('>');
164
- {
165
- _$_.output_push('Level 1');
166
- }
167
- _$_.output_push('</div>');
168
- break;
169
-
170
- case 2:
171
- _$_.output_push('<div');
172
- _$_.output_push(' class="level-2"');
173
- _$_.output_push('>');
174
- {
175
- _$_.output_push('Level 2');
176
- }
177
- _$_.output_push('</div>');
178
- break;
179
-
180
- case 3:
181
- _$_.output_push('<div');
182
- _$_.output_push(' class="level-3"');
183
- _$_.output_push('>');
184
- {
185
- _$_.output_push('Level 3');
186
- }
187
- _$_.output_push('</div>');
188
- break;
189
- }
190
-
191
- _$_.output_push('<!--]-->');
97
+ let __out = '';
98
+
99
+ __out += '<button class="level-toggle">Toggle Level</button><!--[-->';
100
+
101
+ switch (lazy_1.value) {
102
+ case 1:
103
+ __out += '<div class="level-1">Level 1</div>';
104
+ break;
105
+
106
+ case 2:
107
+ __out += '<div class="level-2">Level 2</div>';
108
+ break;
109
+
110
+ case 3:
111
+ __out += '<div class="level-3">Level 3</div>';
112
+ break;
192
113
  }
114
+
115
+ __out += '<!--]-->';
116
+ _$_.output_push(__out);
193
117
  });
194
118
  });
195
119
  }
@@ -199,52 +123,26 @@ export function SwitchBlockScoped() {
199
123
  let lazy_2 = _$_.track(1, 'ca9f9852');
200
124
 
201
125
  _$_.regular_block(() => {
202
- {
203
- _$_.output_push('<button');
204
- _$_.output_push(' class="block-toggle"');
205
- _$_.output_push('>');
206
-
207
- {
208
- _$_.output_push('Toggle');
209
- }
210
-
211
- _$_.output_push('</button>');
212
- _$_.output_push('<!--[-->');
213
-
214
- switch (lazy_2.value) {
215
- case 1:
216
- _$_.output_push('<div');
217
- _$_.output_push(' class="block-1"');
218
- _$_.output_push('>');
219
- {
220
- _$_.output_push('Block 1');
221
- }
222
- _$_.output_push('</div>');
223
- break;
224
-
225
- case 2:
226
- _$_.output_push('<div');
227
- _$_.output_push(' class="block-2"');
228
- _$_.output_push('>');
229
- {
230
- _$_.output_push('Block 2');
231
- }
232
- _$_.output_push('</div>');
233
- break;
234
-
235
- case 3:
236
- _$_.output_push('<div');
237
- _$_.output_push(' class="block-3"');
238
- _$_.output_push('>');
239
- {
240
- _$_.output_push('Block 3');
241
- }
242
- _$_.output_push('</div>');
243
- break;
244
- }
245
-
246
- _$_.output_push('<!--]-->');
126
+ let __out = '';
127
+
128
+ __out += '<button class="block-toggle">Toggle</button><!--[-->';
129
+
130
+ switch (lazy_2.value) {
131
+ case 1:
132
+ __out += '<div class="block-1">Block 1</div>';
133
+ break;
134
+
135
+ case 2:
136
+ __out += '<div class="block-2">Block 2</div>';
137
+ break;
138
+
139
+ case 3:
140
+ __out += '<div class="block-3">Block 3</div>';
141
+ break;
247
142
  }
143
+
144
+ __out += '<!--]-->';
145
+ _$_.output_push(__out);
248
146
  });
249
147
  });
250
148
  }
@@ -254,52 +152,26 @@ export function SwitchNoBreak() {
254
152
  let lazy_3 = _$_.track(1, '6b7cb0ea');
255
153
 
256
154
  _$_.regular_block(() => {
257
- {
258
- _$_.output_push('<button');
259
- _$_.output_push(' class="nobreak-toggle"');
260
- _$_.output_push('>');
261
-
262
- {
263
- _$_.output_push('Toggle');
264
- }
265
-
266
- _$_.output_push('</button>');
267
- _$_.output_push('<!--[-->');
268
-
269
- switch (lazy_3.value) {
270
- case 1:
271
- _$_.output_push('<div');
272
- _$_.output_push(' class="nobreak-1"');
273
- _$_.output_push('>');
274
- {
275
- _$_.output_push('NoBreak 1');
276
- }
277
- _$_.output_push('</div>');
278
- break;
279
-
280
- case 2:
281
- _$_.output_push('<div');
282
- _$_.output_push(' class="nobreak-2"');
283
- _$_.output_push('>');
284
- {
285
- _$_.output_push('NoBreak 2');
286
- }
287
- _$_.output_push('</div>');
288
- break;
289
-
290
- case 3:
291
- _$_.output_push('<div');
292
- _$_.output_push(' class="nobreak-3"');
293
- _$_.output_push('>');
294
- {
295
- _$_.output_push('NoBreak 3');
296
- }
297
- _$_.output_push('</div>');
298
- break;
299
- }
300
-
301
- _$_.output_push('<!--]-->');
155
+ let __out = '';
156
+
157
+ __out += '<button class="nobreak-toggle">Toggle</button><!--[-->';
158
+
159
+ switch (lazy_3.value) {
160
+ case 1:
161
+ __out += '<div class="nobreak-1">NoBreak 1</div>';
162
+ break;
163
+
164
+ case 2:
165
+ __out += '<div class="nobreak-2">NoBreak 2</div>';
166
+ break;
167
+
168
+ case 3:
169
+ __out += '<div class="nobreak-3">NoBreak 3</div>';
170
+ break;
302
171
  }
172
+
173
+ __out += '<!--]-->';
174
+ _$_.output_push(__out);
303
175
  });
304
176
  });
305
177
  }