ripple 0.3.126 → 0.3.128
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 +46 -0
- package/package.json +2 -2
- package/src/jsx-runtime.d.ts +1128 -967
- package/src/runtime/internal/client/blocks.js +20 -24
- package/src/runtime/internal/client/constants.js +5 -5
- package/src/runtime/internal/client/expression.js +142 -101
- package/src/runtime/internal/client/for.js +217 -145
- package/src/runtime/internal/client/index.js +5 -1
- package/src/runtime/internal/client/operations.js +24 -10
- package/src/runtime/internal/client/render.js +22 -3
- package/src/runtime/internal/client/runtime.js +246 -182
- package/src/runtime/internal/client/selector.js +74 -0
- package/src/runtime/internal/client/types.d.ts +11 -0
- package/src/runtime/internal/server/index.js +2 -0
- package/tests/client/basic/basic.reactivity.test.tsrx +33 -0
- package/tests/client/for-selector.test.tsrx +221 -0
- package/tests/hydration/compiled/client/basic.js +44 -44
- package/tests/hydration/compiled/client/composite.js +3 -3
- package/tests/hydration/compiled/client/events.js +56 -29
- package/tests/hydration/compiled/client/for.js +76 -70
- package/tests/hydration/compiled/client/head.js +11 -8
- package/tests/hydration/compiled/client/hmr.js +4 -4
- package/tests/hydration/compiled/client/html-in-template.js +3 -3
- package/tests/hydration/compiled/client/html.js +141 -141
- package/tests/hydration/compiled/client/if-children.js +29 -29
- package/tests/hydration/compiled/client/if-fragment-controlflow.js +16 -16
- package/tests/hydration/compiled/client/if.js +10 -10
- package/tests/hydration/compiled/client/mixed-control-flow.js +26 -22
- package/tests/hydration/compiled/client/nested-control-flow.js +114 -92
- package/tests/hydration/compiled/client/portal.js +8 -8
- package/tests/hydration/compiled/client/reactivity.js +38 -15
- package/tests/hydration/compiled/client/streaming.js +16 -16
- package/tests/hydration/compiled/client/switch.js +4 -4
- package/tests/hydration/compiled/client/track-async-serialization.js +18 -18
- package/tests/hydration/compiled/client/try.js +8 -8
- package/tests/hydration/compiled/server/events.js +5 -53
- package/tests/hydration/compiled/server/for.js +2 -18
- package/tests/hydration/compiled/server/head.js +1 -9
- package/tests/hydration/compiled/server/html.js +1 -9
- package/tests/hydration/compiled/server/reactivity.js +2 -34
- package/tests/utils/jsx-runtime-types.test.js +106 -0
|
@@ -17,22 +17,25 @@ export function ClickCounter() {
|
|
|
17
17
|
var div = root();
|
|
18
18
|
|
|
19
19
|
{
|
|
20
|
-
var button = _$_.
|
|
20
|
+
var button = _$_.hydrating ? _$_.hydrate_child() : div.firstChild;
|
|
21
21
|
|
|
22
22
|
button.__click = () => {
|
|
23
23
|
_$_.update(lazy);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
var span = _$_.
|
|
26
|
+
var span = _$_.hydrating ? _$_.hydrate_sibling() : button.nextSibling;
|
|
27
27
|
|
|
28
28
|
{
|
|
29
|
-
var expression = _$_.
|
|
29
|
+
var expression = _$_.hydrating ? _$_.hydrate_child(true) : span.firstChild;
|
|
30
30
|
|
|
31
|
-
_$_.expression(expression, () => lazy.value);
|
|
32
31
|
_$_.pop(span);
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
|
|
35
|
+
_$_.render(() => {
|
|
36
|
+
_$_.set_text(expression, lazy.value);
|
|
37
|
+
});
|
|
38
|
+
|
|
36
39
|
_$_.append(__anchor, div);
|
|
37
40
|
});
|
|
38
41
|
}
|
|
@@ -43,28 +46,31 @@ export function IncrementDecrement() {
|
|
|
43
46
|
var div_1 = root_1();
|
|
44
47
|
|
|
45
48
|
{
|
|
46
|
-
var button_1 = _$_.
|
|
49
|
+
var button_1 = _$_.hydrating ? _$_.hydrate_child() : div_1.firstChild;
|
|
47
50
|
|
|
48
51
|
button_1.__click = () => {
|
|
49
52
|
_$_.update(lazy_1, -1);
|
|
50
53
|
};
|
|
51
54
|
|
|
52
|
-
var span_1 = _$_.
|
|
55
|
+
var span_1 = _$_.hydrating ? _$_.hydrate_sibling() : button_1.nextSibling;
|
|
53
56
|
|
|
54
57
|
{
|
|
55
|
-
var expression_1 = _$_.
|
|
58
|
+
var expression_1 = _$_.hydrating ? _$_.hydrate_child(true) : span_1.firstChild;
|
|
56
59
|
|
|
57
|
-
_$_.expression(expression_1, () => lazy_1.value);
|
|
58
60
|
_$_.pop(span_1);
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
var button_2 = _$_.
|
|
63
|
+
var button_2 = _$_.hydrating ? _$_.hydrate_sibling() : span_1.nextSibling;
|
|
62
64
|
|
|
63
65
|
button_2.__click = () => {
|
|
64
66
|
_$_.update(lazy_1);
|
|
65
67
|
};
|
|
66
68
|
}
|
|
67
69
|
|
|
70
|
+
_$_.render(() => {
|
|
71
|
+
_$_.set_text(expression_1, lazy_1.value);
|
|
72
|
+
});
|
|
73
|
+
|
|
68
74
|
_$_.append(__anchor, div_1);
|
|
69
75
|
});
|
|
70
76
|
}
|
|
@@ -76,7 +82,7 @@ export function MultipleEvents() {
|
|
|
76
82
|
var div_2 = root_2();
|
|
77
83
|
|
|
78
84
|
{
|
|
79
|
-
var button_3 = _$_.
|
|
85
|
+
var button_3 = _$_.hydrating ? _$_.hydrate_child() : div_2.firstChild;
|
|
80
86
|
|
|
81
87
|
button_3.__click = () => {
|
|
82
88
|
_$_.update(lazy_2);
|
|
@@ -86,25 +92,40 @@ export function MultipleEvents() {
|
|
|
86
92
|
_$_.update(lazy_3);
|
|
87
93
|
});
|
|
88
94
|
|
|
89
|
-
var span_2 = _$_.
|
|
95
|
+
var span_2 = _$_.hydrating ? _$_.hydrate_sibling() : button_3.nextSibling;
|
|
90
96
|
|
|
91
97
|
{
|
|
92
|
-
var expression_2 = _$_.
|
|
98
|
+
var expression_2 = _$_.hydrating ? _$_.hydrate_child(true) : span_2.firstChild;
|
|
93
99
|
|
|
94
|
-
_$_.expression(expression_2, () => lazy_2.value);
|
|
95
100
|
_$_.pop(span_2);
|
|
96
101
|
}
|
|
97
102
|
|
|
98
|
-
var span_3 = _$_.
|
|
103
|
+
var span_3 = _$_.hydrating ? _$_.hydrate_sibling() : span_2.nextSibling;
|
|
99
104
|
|
|
100
105
|
{
|
|
101
|
-
var expression_3 = _$_.
|
|
106
|
+
var expression_3 = _$_.hydrating ? _$_.hydrate_child(true) : span_3.firstChild;
|
|
102
107
|
|
|
103
|
-
_$_.expression(expression_3, () => lazy_3.value);
|
|
104
108
|
_$_.pop(span_3);
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
|
|
112
|
+
_$_.render(
|
|
113
|
+
(__prev) => {
|
|
114
|
+
var __a = lazy_2.value;
|
|
115
|
+
|
|
116
|
+
if (__prev.a !== __a) {
|
|
117
|
+
_$_.set_text(expression_2, __prev.a = __a);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
var __b = lazy_3.value;
|
|
121
|
+
|
|
122
|
+
if (__prev.b !== __b) {
|
|
123
|
+
_$_.set_text(expression_3, __prev.b = __b);
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
{ a: ' ', b: ' ' }
|
|
127
|
+
);
|
|
128
|
+
|
|
108
129
|
_$_.append(__anchor, div_2);
|
|
109
130
|
});
|
|
110
131
|
}
|
|
@@ -122,29 +143,32 @@ export function MultiStateUpdate() {
|
|
|
122
143
|
var div_3 = root_3();
|
|
123
144
|
|
|
124
145
|
{
|
|
125
|
-
var button_4 = _$_.
|
|
146
|
+
var button_4 = _$_.hydrating ? _$_.hydrate_child() : div_3.firstChild;
|
|
126
147
|
|
|
127
148
|
button_4.__click = handleClick;
|
|
128
149
|
|
|
129
|
-
var span_4 = _$_.
|
|
150
|
+
var span_4 = _$_.hydrating ? _$_.hydrate_sibling() : button_4.nextSibling;
|
|
130
151
|
|
|
131
152
|
{
|
|
132
|
-
var expression_4 = _$_.
|
|
153
|
+
var expression_4 = _$_.hydrating ? _$_.hydrate_child(true) : span_4.firstChild;
|
|
133
154
|
|
|
134
|
-
_$_.expression(expression_4, () => lazy_4.value);
|
|
135
155
|
_$_.pop(span_4);
|
|
136
156
|
}
|
|
137
157
|
|
|
138
|
-
var span_5 = _$_.
|
|
158
|
+
var span_5 = _$_.hydrating ? _$_.hydrate_sibling() : span_4.nextSibling;
|
|
139
159
|
|
|
140
160
|
{
|
|
141
|
-
var expression_5 = _$_.
|
|
161
|
+
var expression_5 = _$_.hydrating ? _$_.hydrate_child() : span_5.firstChild;
|
|
142
162
|
|
|
143
163
|
_$_.expression(expression_5, () => lazy_5.value);
|
|
144
164
|
_$_.pop(span_5);
|
|
145
165
|
}
|
|
146
166
|
}
|
|
147
167
|
|
|
168
|
+
_$_.render(() => {
|
|
169
|
+
_$_.set_text(expression_4, lazy_4.value);
|
|
170
|
+
});
|
|
171
|
+
|
|
148
172
|
_$_.append(__anchor, div_3);
|
|
149
173
|
});
|
|
150
174
|
}
|
|
@@ -155,14 +179,14 @@ export function ToggleButton() {
|
|
|
155
179
|
var div_4 = root_4();
|
|
156
180
|
|
|
157
181
|
{
|
|
158
|
-
var button_5 = _$_.
|
|
182
|
+
var button_5 = _$_.hydrating ? _$_.hydrate_child() : div_4.firstChild;
|
|
159
183
|
|
|
160
184
|
button_5.__click = () => {
|
|
161
185
|
_$_.set(lazy_6, !lazy_6.value);
|
|
162
186
|
};
|
|
163
187
|
|
|
164
188
|
{
|
|
165
|
-
var expression_6 = _$_.
|
|
189
|
+
var expression_6 = _$_.hydrating ? _$_.hydrate_child(true) : button_5.firstChild;
|
|
166
190
|
|
|
167
191
|
_$_.pop(button_5);
|
|
168
192
|
}
|
|
@@ -183,7 +207,7 @@ export function ChildButton(props) {
|
|
|
183
207
|
_$_.render_event('Click', button_6, () => props.onClick);
|
|
184
208
|
|
|
185
209
|
{
|
|
186
|
-
var expression_7 = _$_.
|
|
210
|
+
var expression_7 = _$_.hydrating ? _$_.hydrate_child(true) : button_6.firstChild;
|
|
187
211
|
|
|
188
212
|
_$_.pop(button_6);
|
|
189
213
|
}
|
|
@@ -202,7 +226,7 @@ export function ParentWithChildButton() {
|
|
|
202
226
|
var div_5 = root_6();
|
|
203
227
|
|
|
204
228
|
{
|
|
205
|
-
var node = _$_.
|
|
229
|
+
var node = _$_.hydrating ? _$_.hydrate_child() : div_5.firstChild;
|
|
206
230
|
|
|
207
231
|
_$_.render_component(ChildButton, node, {
|
|
208
232
|
onClick: () => {
|
|
@@ -211,18 +235,21 @@ export function ParentWithChildButton() {
|
|
|
211
235
|
label: "Click me"
|
|
212
236
|
});
|
|
213
237
|
|
|
214
|
-
var span_6 = _$_.
|
|
238
|
+
var span_6 = _$_.hydrating ? _$_.hydrate_sibling() : node.nextSibling;
|
|
215
239
|
|
|
216
240
|
{
|
|
217
|
-
var expression_8 = _$_.
|
|
241
|
+
var expression_8 = _$_.hydrating ? _$_.hydrate_child(true) : span_6.firstChild;
|
|
218
242
|
|
|
219
|
-
_$_.expression(expression_8, () => lazy_7.value);
|
|
220
243
|
_$_.pop(span_6);
|
|
221
244
|
}
|
|
222
245
|
|
|
223
246
|
_$_.pop(div_5);
|
|
224
247
|
}
|
|
225
248
|
|
|
249
|
+
_$_.render(() => {
|
|
250
|
+
_$_.set_text(expression_8, lazy_7.value);
|
|
251
|
+
});
|
|
252
|
+
|
|
226
253
|
_$_.append(__anchor, div_5);
|
|
227
254
|
});
|
|
228
255
|
}
|