ripple 0.3.84 → 0.3.86
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 +81 -0
- package/package.json +3 -3
- package/src/constants.js +4 -0
- package/src/runtime/internal/client/blocks.js +53 -0
- package/src/runtime/internal/client/component.js +3 -3
- package/src/runtime/internal/client/constants.js +4 -0
- package/src/runtime/internal/client/for.js +87 -14
- package/src/runtime/internal/client/if.js +18 -2
- package/src/runtime/internal/client/index.js +1 -0
- package/src/runtime/internal/client/operations.js +25 -0
- package/src/runtime/internal/client/runtime.js +62 -10
- package/src/runtime/internal/client/switch.js +33 -5
- package/src/runtime/internal/client/template.js +10 -2
- package/src/runtime/internal/client/try.js +12 -2
- package/src/runtime/internal/client/types.d.ts +4 -0
- package/tests/client/__snapshots__/for.test.tsrx.snap +0 -2
- package/tests/client/compiler/compiler.basic.test.tsrx +5 -2
- package/tests/client/composite/__snapshots__/composite.render.test.tsrx.snap +0 -4
- package/tests/client/for-single-root-items.test.tsrx +130 -0
- package/tests/client/scoped-flush.test.tsrx +105 -0
- package/tests/hydration/compiled/client/basic.js +198 -214
- package/tests/hydration/compiled/client/composite.js +23 -72
- package/tests/hydration/compiled/client/for.js +66 -72
- package/tests/hydration/compiled/client/hmr.js +2 -13
- package/tests/hydration/compiled/client/html.js +619 -479
- package/tests/hydration/compiled/client/if-children.js +72 -84
- package/tests/hydration/compiled/client/if-fragment-controlflow.js +463 -0
- package/tests/hydration/compiled/client/if.js +87 -92
- package/tests/hydration/compiled/client/mixed-control-flow.js +120 -160
- package/tests/hydration/compiled/client/nested-control-flow.js +288 -360
- package/tests/hydration/compiled/client/portal.js +15 -21
- package/tests/hydration/compiled/client/reactivity.js +7 -12
- package/tests/hydration/compiled/client/switch.js +113 -115
- package/tests/hydration/compiled/client/track-async-serialization.js +71 -122
- package/tests/hydration/compiled/client/try.js +26 -41
- package/tests/hydration/compiled/server/basic.js +295 -556
- package/tests/hydration/compiled/server/composite.js +31 -50
- package/tests/hydration/compiled/server/events.js +37 -173
- package/tests/hydration/compiled/server/for.js +236 -847
- package/tests/hydration/compiled/server/head.js +110 -241
- package/tests/hydration/compiled/server/hmr.js +14 -41
- package/tests/hydration/compiled/server/html-in-template.js +14 -38
- package/tests/hydration/compiled/server/html.js +951 -1176
- package/tests/hydration/compiled/server/if-children.js +59 -493
- package/tests/hydration/compiled/server/if-fragment-controlflow.js +227 -0
- package/tests/hydration/compiled/server/if.js +57 -209
- package/tests/hydration/compiled/server/mixed-control-flow.js +144 -250
- package/tests/hydration/compiled/server/nested-control-flow.js +309 -559
- package/tests/hydration/compiled/server/portal.js +94 -156
- package/tests/hydration/compiled/server/reactivity.js +23 -65
- package/tests/hydration/compiled/server/return.js +6 -16
- package/tests/hydration/compiled/server/switch.js +91 -219
- package/tests/hydration/compiled/server/track-async-serialization.js +211 -256
- package/tests/hydration/compiled/server/try.js +67 -126
- package/tests/hydration/components/html.tsrx +75 -0
- package/tests/hydration/components/if-fragment-controlflow.tsrx +145 -0
- package/tests/hydration/html.test.js +50 -0
- package/tests/hydration/if-fragment-controlflow.test.js +95 -0
- package/tests/server/compiler.test.tsrx +6 -2
|
@@ -12,95 +12,66 @@ export function MixedControlFlowStatic() {
|
|
|
12
12
|
];
|
|
13
13
|
|
|
14
14
|
_$_.regular_block(() => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
_$_.output_push('<!--[-->');
|
|
33
|
-
_$_.output_push('<div');
|
|
34
|
-
_$_.output_push(_$_.attr('class', `row row-${row.id} kind-a`));
|
|
35
|
-
_$_.output_push('>');
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
_$_.output_push(_$_.escape(`A-${row.id}`));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
_$_.output_push('</div>');
|
|
42
|
-
_$_.output_push('<!--]-->');
|
|
43
|
-
},
|
|
44
|
-
null,
|
|
45
|
-
() => {
|
|
46
|
-
_$_.output_push('<!--[-->');
|
|
47
|
-
_$_.output_push('<div');
|
|
48
|
-
_$_.output_push(_$_.attr('class', `pending pending-${row.id}`));
|
|
49
|
-
_$_.output_push('>');
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
_$_.output_push('pending a');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
_$_.output_push('</div>');
|
|
56
|
-
_$_.output_push('<!--]-->');
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
break;
|
|
60
|
-
|
|
61
|
-
default:
|
|
62
|
-
_$_.try_block(
|
|
63
|
-
() => {
|
|
64
|
-
_$_.output_push('<!--[-->');
|
|
65
|
-
_$_.output_push('<div');
|
|
66
|
-
_$_.output_push(_$_.attr('class', `row row-${row.id} kind-b`));
|
|
67
|
-
_$_.output_push('>');
|
|
68
|
-
|
|
69
|
-
{
|
|
70
|
-
_$_.output_push(_$_.escape(`B-${row.id}`));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
_$_.output_push('</div>');
|
|
74
|
-
_$_.output_push('<!--]-->');
|
|
75
|
-
},
|
|
76
|
-
null,
|
|
77
|
-
() => {
|
|
78
|
-
_$_.output_push('<!--[-->');
|
|
79
|
-
_$_.output_push('<div');
|
|
80
|
-
_$_.output_push(_$_.attr('class', `pending pending-${row.id}`));
|
|
81
|
-
_$_.output_push('>');
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
_$_.output_push('pending b');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
_$_.output_push('</div>');
|
|
88
|
-
_$_.output_push('<!--]-->');
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
15
|
+
let __out = '';
|
|
16
|
+
|
|
17
|
+
__out += '<section class="mixed-static"><!--[-->';
|
|
18
|
+
|
|
19
|
+
for (const row of rows) {
|
|
20
|
+
__out += '<!--[-->';
|
|
21
|
+
|
|
22
|
+
if (row.enabled) {
|
|
23
|
+
__out += '<!--[-->';
|
|
24
|
+
|
|
25
|
+
switch (row.kind) {
|
|
26
|
+
case 'a':
|
|
27
|
+
_$_.output_push(__out);
|
|
28
|
+
__out = '';
|
|
29
|
+
_$_.try_block(
|
|
30
|
+
() => {
|
|
31
|
+
let __out = '';
|
|
93
32
|
|
|
94
|
-
|
|
33
|
+
__out += '<!--[--><div' + _$_.attr('class', `row row-${row.id} kind-a`) + '>' + _$_.escape(`A-${row.id}`) + '</div><!--]-->';
|
|
34
|
+
_$_.output_push(__out);
|
|
35
|
+
},
|
|
36
|
+
null,
|
|
37
|
+
() => {
|
|
38
|
+
let __out = '';
|
|
39
|
+
|
|
40
|
+
__out += '<!--[--><div' + _$_.attr('class', `pending pending-${row.id}`) + '>pending a</div><!--]-->';
|
|
41
|
+
_$_.output_push(__out);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
break;
|
|
45
|
+
|
|
46
|
+
default:
|
|
47
|
+
_$_.output_push(__out);
|
|
48
|
+
__out = '';
|
|
49
|
+
_$_.try_block(
|
|
50
|
+
() => {
|
|
51
|
+
let __out = '';
|
|
52
|
+
|
|
53
|
+
__out += '<!--[--><div' + _$_.attr('class', `row row-${row.id} kind-b`) + '>' + _$_.escape(`B-${row.id}`) + '</div><!--]-->';
|
|
54
|
+
_$_.output_push(__out);
|
|
55
|
+
},
|
|
56
|
+
null,
|
|
57
|
+
() => {
|
|
58
|
+
let __out = '';
|
|
59
|
+
|
|
60
|
+
__out += '<!--[--><div' + _$_.attr('class', `pending pending-${row.id}`) + '>pending b</div><!--]-->';
|
|
61
|
+
_$_.output_push(__out);
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
break;
|
|
95
65
|
}
|
|
96
66
|
|
|
97
|
-
|
|
67
|
+
__out += '<!--]-->';
|
|
98
68
|
}
|
|
99
69
|
|
|
100
|
-
|
|
70
|
+
__out += '<!--]-->';
|
|
101
71
|
}
|
|
102
72
|
|
|
103
|
-
|
|
73
|
+
__out += '<!--]--></section>';
|
|
74
|
+
_$_.output_push(__out);
|
|
104
75
|
});
|
|
105
76
|
});
|
|
106
77
|
}
|
|
@@ -112,124 +83,66 @@ export function MixedControlFlowReactive() {
|
|
|
112
83
|
let lazy_2 = _$_.track([{ id: 1, label: 'One' }, { id: 2, label: 'Two' }], '7890dad6');
|
|
113
84
|
|
|
114
85
|
_$_.regular_block(() => {
|
|
115
|
-
|
|
116
|
-
_$_.output_push('<button');
|
|
117
|
-
_$_.output_push(' class="toggle-show"');
|
|
118
|
-
_$_.output_push('>');
|
|
86
|
+
let __out = '';
|
|
119
87
|
|
|
120
|
-
|
|
121
|
-
_$_.output_push('Toggle Show');
|
|
122
|
-
}
|
|
88
|
+
__out += '<button class="toggle-show">Toggle Show</button><button class="toggle-mode">Toggle Mode</button><button class="add-item">Add Item</button><!--[-->';
|
|
123
89
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
_$_.output_push(' class="toggle-mode"');
|
|
127
|
-
_$_.output_push('>');
|
|
90
|
+
if (lazy.value) {
|
|
91
|
+
__out += '<div class="mixed-reactive-list"><!--[-->';
|
|
128
92
|
|
|
129
|
-
{
|
|
130
|
-
|
|
131
|
-
}
|
|
93
|
+
for (const item of lazy_2.value) {
|
|
94
|
+
__out += '<!--[-->';
|
|
132
95
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
96
|
+
switch (lazy_1.value) {
|
|
97
|
+
case 'a':
|
|
98
|
+
_$_.output_push(__out);
|
|
99
|
+
__out = '';
|
|
100
|
+
_$_.try_block(
|
|
101
|
+
() => {
|
|
102
|
+
let __out = '';
|
|
137
103
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
104
|
+
__out += '<!--[--><p' + _$_.attr('class', `item item-${item.id}`) + '>' + _$_.escape(`A:${item.label}`) + '</p><!--]-->';
|
|
105
|
+
_$_.output_push(__out);
|
|
106
|
+
},
|
|
107
|
+
null,
|
|
108
|
+
() => {
|
|
109
|
+
let __out = '';
|
|
141
110
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
_$_.output_push('</p>');
|
|
170
|
-
_$_.output_push('<!--]-->');
|
|
171
|
-
},
|
|
172
|
-
null,
|
|
173
|
-
() => {
|
|
174
|
-
_$_.output_push('<!--[-->');
|
|
175
|
-
_$_.output_push('<p');
|
|
176
|
-
_$_.output_push(' class="pending"');
|
|
177
|
-
_$_.output_push('>');
|
|
178
|
-
|
|
179
|
-
{
|
|
180
|
-
_$_.output_push('pending a');
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
_$_.output_push('</p>');
|
|
184
|
-
_$_.output_push('<!--]-->');
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
break;
|
|
188
|
-
|
|
189
|
-
default:
|
|
190
|
-
_$_.try_block(
|
|
191
|
-
() => {
|
|
192
|
-
_$_.output_push('<!--[-->');
|
|
193
|
-
_$_.output_push('<p');
|
|
194
|
-
_$_.output_push(_$_.attr('class', `item item-${item.id}`));
|
|
195
|
-
_$_.output_push('>');
|
|
196
|
-
|
|
197
|
-
{
|
|
198
|
-
_$_.output_push(_$_.escape(`B:${item.label}`));
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
_$_.output_push('</p>');
|
|
202
|
-
_$_.output_push('<!--]-->');
|
|
203
|
-
},
|
|
204
|
-
null,
|
|
205
|
-
() => {
|
|
206
|
-
_$_.output_push('<!--[-->');
|
|
207
|
-
_$_.output_push('<p');
|
|
208
|
-
_$_.output_push(' class="pending"');
|
|
209
|
-
_$_.output_push('>');
|
|
210
|
-
|
|
211
|
-
{
|
|
212
|
-
_$_.output_push('pending b');
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
_$_.output_push('</p>');
|
|
216
|
-
_$_.output_push('<!--]-->');
|
|
217
|
-
}
|
|
218
|
-
);
|
|
219
|
-
break;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
_$_.output_push('<!--]-->');
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
_$_.output_push('<!--]-->');
|
|
111
|
+
__out += '<!--[--><p class="pending">pending a</p><!--]-->';
|
|
112
|
+
_$_.output_push(__out);
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
break;
|
|
116
|
+
|
|
117
|
+
default:
|
|
118
|
+
_$_.output_push(__out);
|
|
119
|
+
__out = '';
|
|
120
|
+
_$_.try_block(
|
|
121
|
+
() => {
|
|
122
|
+
let __out = '';
|
|
123
|
+
|
|
124
|
+
__out += '<!--[--><p' + _$_.attr('class', `item item-${item.id}`) + '>' + _$_.escape(`B:${item.label}`) + '</p><!--]-->';
|
|
125
|
+
_$_.output_push(__out);
|
|
126
|
+
},
|
|
127
|
+
null,
|
|
128
|
+
() => {
|
|
129
|
+
let __out = '';
|
|
130
|
+
|
|
131
|
+
__out += '<!--[--><p class="pending">pending b</p><!--]-->';
|
|
132
|
+
_$_.output_push(__out);
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
break;
|
|
226
136
|
}
|
|
227
137
|
|
|
228
|
-
|
|
138
|
+
__out += '<!--]-->';
|
|
229
139
|
}
|
|
230
140
|
|
|
231
|
-
|
|
141
|
+
__out += '<!--]--></div>';
|
|
232
142
|
}
|
|
143
|
+
|
|
144
|
+
__out += '<!--]-->';
|
|
145
|
+
_$_.output_push(__out);
|
|
233
146
|
});
|
|
234
147
|
});
|
|
235
148
|
}
|
|
@@ -240,75 +153,61 @@ export function MixedControlFlowAsyncPending() {
|
|
|
240
153
|
const state = 'slow';
|
|
241
154
|
|
|
242
155
|
_$_.regular_block(() => {
|
|
243
|
-
|
|
244
|
-
_$_.output_push('<div');
|
|
245
|
-
_$_.output_push(' class="before"');
|
|
246
|
-
_$_.output_push('>');
|
|
247
|
-
|
|
248
|
-
{
|
|
249
|
-
_$_.output_push('before');
|
|
250
|
-
}
|
|
156
|
+
let __out = '';
|
|
251
157
|
|
|
252
|
-
|
|
253
|
-
_$_.output_push('<!--[-->');
|
|
158
|
+
__out += '<div class="before">before</div><!--[-->';
|
|
254
159
|
|
|
255
|
-
|
|
256
|
-
|
|
160
|
+
for (const row of rows) {
|
|
161
|
+
__out += '<!--[-->';
|
|
257
162
|
|
|
258
|
-
|
|
259
|
-
|
|
163
|
+
if (row === 1) {
|
|
164
|
+
__out += '<!--[-->';
|
|
260
165
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
166
|
+
switch (state) {
|
|
167
|
+
case 'slow':
|
|
168
|
+
_$_.output_push(__out);
|
|
169
|
+
__out = '';
|
|
170
|
+
_$_.try_block(
|
|
171
|
+
() => {
|
|
172
|
+
let __out = '';
|
|
266
173
|
|
|
267
|
-
|
|
268
|
-
const comp = AsyncRow;
|
|
269
|
-
const args = [{ label: `row-${row}` }];
|
|
174
|
+
__out += '<!--[-->';
|
|
270
175
|
|
|
271
|
-
|
|
272
|
-
|
|
176
|
+
{
|
|
177
|
+
const comp = AsyncRow;
|
|
178
|
+
const args = [{ label: `row-${row}` }];
|
|
273
179
|
|
|
274
|
-
_$_.output_push(
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
_$_.output_push('<!--[-->');
|
|
279
|
-
_$_.output_push('<div');
|
|
280
|
-
_$_.output_push(_$_.attr('class', `pending-row pending-row-${row}`));
|
|
281
|
-
_$_.output_push('>');
|
|
180
|
+
_$_.output_push(__out);
|
|
181
|
+
__out = '';
|
|
182
|
+
_$_.render_component(comp, ...args);
|
|
183
|
+
}
|
|
282
184
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
185
|
+
__out += '<!--]-->';
|
|
186
|
+
_$_.output_push(__out);
|
|
187
|
+
},
|
|
188
|
+
null,
|
|
189
|
+
() => {
|
|
190
|
+
let __out = '';
|
|
286
191
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
);
|
|
291
|
-
break;
|
|
292
|
-
|
|
293
|
-
default:
|
|
294
|
-
_$_.output_push('<div');
|
|
295
|
-
_$_.output_push(' class="unexpected"');
|
|
296
|
-
_$_.output_push('>');
|
|
297
|
-
{
|
|
298
|
-
_$_.output_push('unexpected');
|
|
192
|
+
__out += '<!--[--><div' + _$_.attr('class', `pending-row pending-row-${row}`) + '>' + _$_.escape(`pending ${row}`) + '</div><!--]-->';
|
|
193
|
+
_$_.output_push(__out);
|
|
299
194
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
195
|
+
);
|
|
196
|
+
break;
|
|
303
197
|
|
|
304
|
-
|
|
198
|
+
default:
|
|
199
|
+
__out += '<div class="unexpected">unexpected</div>';
|
|
200
|
+
break;
|
|
305
201
|
}
|
|
306
202
|
|
|
307
|
-
|
|
203
|
+
__out += '<!--]-->';
|
|
308
204
|
}
|
|
309
205
|
|
|
310
|
-
|
|
206
|
+
__out += '<!--]-->';
|
|
311
207
|
}
|
|
208
|
+
|
|
209
|
+
__out += '<!--]-->';
|
|
210
|
+
_$_.output_push(__out);
|
|
312
211
|
});
|
|
313
212
|
});
|
|
314
213
|
}
|
|
@@ -318,15 +217,10 @@ function AsyncRow({ label }) {
|
|
|
318
217
|
let lazy_3 = _$_.track_async(() => Promise.resolve(label), '10cc79a0');
|
|
319
218
|
|
|
320
219
|
_$_.regular_block(() => {
|
|
321
|
-
|
|
322
|
-
_$_.output_push(' class="resolved-row"');
|
|
323
|
-
_$_.output_push('>');
|
|
324
|
-
|
|
325
|
-
{
|
|
326
|
-
_$_.output_push(_$_.escape(lazy_3.value));
|
|
327
|
-
}
|
|
220
|
+
let __out = '';
|
|
328
221
|
|
|
329
|
-
_$_.
|
|
222
|
+
__out += '<div class="resolved-row">' + _$_.escape(lazy_3.value) + '</div>';
|
|
223
|
+
_$_.output_push(__out);
|
|
330
224
|
});
|
|
331
225
|
});
|
|
332
226
|
}
|