ripple 0.4.0 → 0.4.2
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 +82 -0
- package/package.json +3 -2
- package/src/constants.js +4 -0
- package/src/jsx-runtime.d.ts +12 -2
- package/src/runtime/internal/client/constants.js +6 -0
- package/src/runtime/internal/client/for.js +224 -50
- package/src/runtime/internal/client/hydration.js +0 -16
- package/src/runtime/internal/client/index.js +2 -2
- package/src/runtime/internal/client/operations.js +1 -2
- package/src/runtime/internal/client/render.js +42 -4
- package/src/runtime/internal/client/runtime.js +45 -2
- package/src/runtime/internal/server/index.js +11 -6
- package/tests/client/basic/basic.attributes.test.tsrx +37 -0
- package/tests/client/compiler/compiler.basic.test.tsrx +2 -2
- package/tests/client/for-item.test.tsrx +404 -0
- package/tests/hydration/compiled/client/basic.js +29 -55
- package/tests/hydration/compiled/client/events.js +80 -67
- package/tests/hydration/compiled/client/for.js +95 -80
- package/tests/hydration/compiled/client/fragment-cursor.js +412 -344
- package/tests/hydration/compiled/client/head.js +4 -7
- package/tests/hydration/compiled/client/html.js +40 -64
- package/tests/hydration/compiled/client/if-children.js +30 -34
- package/tests/hydration/compiled/client/if-fragment-controlflow.js +7 -7
- package/tests/hydration/compiled/client/if.js +4 -4
- package/tests/hydration/compiled/client/mixed-control-flow.js +20 -50
- package/tests/hydration/compiled/client/nested-control-flow.js +97 -185
- package/tests/hydration/compiled/client/portal.js +2 -2
- package/tests/hydration/compiled/client/reactivity.js +17 -31
- package/tests/hydration/compiled/client/streaming.js +4 -8
- package/tests/hydration/compiled/client/typed-text.js +4 -15
- package/tests/hydration/compiled/server/events.js +5 -53
- package/tests/hydration/compiled/server/for.js +1 -9
- package/tests/hydration/compiled/server/fragment-cursor.js +36 -324
- package/tests/server/basic.attributes.test.tsrx +28 -0
- package/tests/server/basic.test.tsrx +23 -0
- package/tests/utils/jsx-runtime-types.test.js +67 -2
- package/tests/utils/tracked-types.test.js +117 -0
- package/types/index.d.ts +7 -8
- package/tests/client/compiler/__snapshots__/compiler.assignments.test.rsrx.snap +0 -12
- package/tests/client/compiler/__snapshots__/compiler.typescript.test.rsrx.snap +0 -46
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as _$_ from 'ripple/internal/client';
|
|
3
3
|
|
|
4
|
-
var root_1 = _$_.template(`<div
|
|
4
|
+
var root_1 = _$_.template(`<div></div>`, 0);
|
|
5
5
|
|
|
6
6
|
function render(__prev) {
|
|
7
7
|
var __pattern = _$_.get(__prev._pattern);
|
|
8
8
|
var __a = `A-${__pattern.id}`;
|
|
9
9
|
|
|
10
10
|
if (__prev.a !== __a) {
|
|
11
|
-
_$_.
|
|
11
|
+
_$_.set_text_content(__prev._div, __a, __prev.a);
|
|
12
|
+
__prev.a = __a;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
var __b = `row row-${__pattern.id} kind-a`;
|
|
@@ -28,14 +29,15 @@ function render_1(__prev) {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
var root_3 = _$_.template(`<div
|
|
32
|
+
var root_3 = _$_.template(`<div></div>`, 0);
|
|
32
33
|
|
|
33
34
|
function render_2(__prev) {
|
|
34
35
|
var __pattern_1 = _$_.get(__prev._pattern);
|
|
35
36
|
var __a = `B-${__pattern_1.id}`;
|
|
36
37
|
|
|
37
38
|
if (__prev.a !== __a) {
|
|
38
|
-
_$_.
|
|
39
|
+
_$_.set_text_content(__prev._div_2, __a, __prev.a);
|
|
40
|
+
__prev.a = __a;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
var __b = `row row-${__pattern_1.id} kind-b`;
|
|
@@ -61,18 +63,7 @@ function switch_case_0(__anchor, pattern) {
|
|
|
61
63
|
(__anchor) => {
|
|
62
64
|
var div = root_1();
|
|
63
65
|
|
|
64
|
-
{
|
|
65
|
-
var expression = _$_.hydrating ? _$_.hydrate_text() : div.firstChild;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
_$_.render(render, {
|
|
69
|
-
a: ' ',
|
|
70
|
-
b: _$_.UNINITIALIZED,
|
|
71
|
-
_pattern: pattern,
|
|
72
|
-
_expression: expression,
|
|
73
|
-
_div: div
|
|
74
|
-
});
|
|
75
|
-
|
|
66
|
+
_$_.render(render, { a: '', b: _$_.UNINITIALIZED, _pattern: pattern, _div: div });
|
|
76
67
|
_$_.append(__anchor, div);
|
|
77
68
|
},
|
|
78
69
|
null,
|
|
@@ -92,15 +83,10 @@ function switch_case_default(__anchor, pattern) {
|
|
|
92
83
|
(__anchor) => {
|
|
93
84
|
var div_2 = root_3();
|
|
94
85
|
|
|
95
|
-
{
|
|
96
|
-
var expression_1 = _$_.hydrating ? _$_.hydrate_text() : div_2.firstChild;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
86
|
_$_.render(render_2, {
|
|
100
|
-
a: '
|
|
87
|
+
a: '',
|
|
101
88
|
b: _$_.UNINITIALIZED,
|
|
102
89
|
_pattern: pattern,
|
|
103
|
-
_expression_1: expression_1,
|
|
104
90
|
_div_2: div_2
|
|
105
91
|
});
|
|
106
92
|
|
|
@@ -154,7 +140,7 @@ function MixedControlFlowStatic_render(__anchor, __block) {
|
|
|
154
140
|
_$_.if(__anchor, if_1, true, pattern);
|
|
155
141
|
},
|
|
156
142
|
4,
|
|
157
|
-
(pattern) =>
|
|
143
|
+
(pattern) => pattern.id
|
|
158
144
|
);
|
|
159
145
|
|
|
160
146
|
_$_.hydrating && _$_.pop(section);
|
|
@@ -165,14 +151,15 @@ function MixedControlFlowStatic_render(__anchor, __block) {
|
|
|
165
151
|
|
|
166
152
|
MixedControlFlowStatic[_$_.$r] = MixedControlFlowStatic_render;
|
|
167
153
|
|
|
168
|
-
var root_8 = _$_.template(`<p
|
|
154
|
+
var root_8 = _$_.template(`<p></p>`, 0);
|
|
169
155
|
|
|
170
156
|
function render_4(__prev) {
|
|
171
157
|
var __pattern_1_1 = _$_.get(__prev._pattern_1);
|
|
172
158
|
var __a = `A:${__pattern_1_1.label}`;
|
|
173
159
|
|
|
174
160
|
if (__prev.a !== __a) {
|
|
175
|
-
_$_.
|
|
161
|
+
_$_.set_text_content(__prev._p, __a, __prev.a);
|
|
162
|
+
__prev.a = __a;
|
|
176
163
|
}
|
|
177
164
|
|
|
178
165
|
var __b = `item item-${__pattern_1_1.id}`;
|
|
@@ -183,14 +170,15 @@ function render_4(__prev) {
|
|
|
183
170
|
}
|
|
184
171
|
|
|
185
172
|
var root_9 = _$_.template(`<p class="pending">pending a</p>`, 0);
|
|
186
|
-
var root_10 = _$_.template(`<p
|
|
173
|
+
var root_10 = _$_.template(`<p></p>`, 0);
|
|
187
174
|
|
|
188
175
|
function render_5(__prev) {
|
|
189
176
|
var __pattern_1_2 = _$_.get(__prev._pattern_1);
|
|
190
177
|
var __a = `B:${__pattern_1_2.label}`;
|
|
191
178
|
|
|
192
179
|
if (__prev.a !== __a) {
|
|
193
|
-
_$_.
|
|
180
|
+
_$_.set_text_content(__prev._p_2, __a, __prev.a);
|
|
181
|
+
__prev.a = __a;
|
|
194
182
|
}
|
|
195
183
|
|
|
196
184
|
var __b = `item item-${__pattern_1_2.id}`;
|
|
@@ -208,18 +196,7 @@ function switch_case_0_1(__anchor, { mode, pattern_1 }) {
|
|
|
208
196
|
(__anchor) => {
|
|
209
197
|
var p = root_8();
|
|
210
198
|
|
|
211
|
-
{
|
|
212
|
-
var expression_2 = _$_.hydrating ? _$_.hydrate_text() : p.firstChild;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
_$_.render(render_4, {
|
|
216
|
-
a: ' ',
|
|
217
|
-
b: _$_.UNINITIALIZED,
|
|
218
|
-
_pattern_1: pattern_1,
|
|
219
|
-
_expression_2: expression_2,
|
|
220
|
-
_p: p
|
|
221
|
-
});
|
|
222
|
-
|
|
199
|
+
_$_.render(render_4, { a: '', b: _$_.UNINITIALIZED, _pattern_1: pattern_1, _p: p });
|
|
223
200
|
_$_.append(__anchor, p);
|
|
224
201
|
},
|
|
225
202
|
null,
|
|
@@ -238,15 +215,10 @@ function switch_case_default_1(__anchor, { mode, pattern_1 }) {
|
|
|
238
215
|
(__anchor) => {
|
|
239
216
|
var p_2 = root_10();
|
|
240
217
|
|
|
241
|
-
{
|
|
242
|
-
var expression_3 = _$_.hydrating ? _$_.hydrate_text() : p_2.firstChild;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
218
|
_$_.render(render_5, {
|
|
246
|
-
a: '
|
|
219
|
+
a: '',
|
|
247
220
|
b: _$_.UNINITIALIZED,
|
|
248
221
|
_pattern_1: pattern_1,
|
|
249
|
-
_expression_3: expression_3,
|
|
250
222
|
_p_2: p_2
|
|
251
223
|
});
|
|
252
224
|
|
|
@@ -285,7 +257,7 @@ function consequent_1(__anchor, { show, items, mode }) {
|
|
|
285
257
|
_$_.switch(__anchor, switch_2, true, { mode, pattern_1 });
|
|
286
258
|
},
|
|
287
259
|
4,
|
|
288
|
-
(pattern_1) =>
|
|
260
|
+
(pattern_1) => pattern_1.id
|
|
289
261
|
);
|
|
290
262
|
|
|
291
263
|
_$_.hydrating && _$_.pop(div_4);
|
|
@@ -339,7 +311,7 @@ function MixedControlFlowReactive_render(__anchor, __block) {
|
|
|
339
311
|
|
|
340
312
|
MixedControlFlowReactive[_$_.$r] = MixedControlFlowReactive_render;
|
|
341
313
|
|
|
342
|
-
var root_14 = _$_.template(`<div
|
|
314
|
+
var root_14 = _$_.template(`<div></div>`, 0);
|
|
343
315
|
var root_15 = _$_.template(`<div class="unexpected">unexpected</div>`, 0);
|
|
344
316
|
|
|
345
317
|
function switch_case_0_2(__anchor, { state, row }) {
|
|
@@ -355,9 +327,7 @@ function switch_case_0_2(__anchor, { state, row }) {
|
|
|
355
327
|
_$_.set_class(div_6, `pending-row pending-row-${row}`, void 0, true);
|
|
356
328
|
|
|
357
329
|
{
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
expression_4.nodeValue = `pending ${row}`;
|
|
330
|
+
div_6.textContent = `pending ${row}`;
|
|
361
331
|
}
|
|
362
332
|
|
|
363
333
|
_$_.append(__anchor, div_6);
|