ripple 0.4.2 → 0.4.4
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 +164 -0
- package/package.json +10 -4
- package/src/constants.js +6 -0
- package/src/jsx-runtime.d.ts +2 -1
- package/src/runtime/array.js +15 -9
- package/src/runtime/index-client.js +25 -7
- package/src/runtime/index-server.js +1 -0
- package/src/runtime/internal/client/attributes.js +439 -0
- package/src/runtime/internal/client/blocks.js +20 -20
- package/src/runtime/internal/client/component.js +2 -5
- package/src/runtime/internal/client/composite.js +295 -95
- package/src/runtime/internal/client/constants.js +14 -6
- package/src/runtime/internal/client/context.js +3 -2
- package/src/runtime/internal/client/css.js +11 -26
- package/src/runtime/internal/client/errors.js +188 -0
- package/src/runtime/internal/client/events.js +79 -34
- package/src/runtime/internal/client/expression.js +25 -120
- package/src/runtime/internal/client/for.js +113 -262
- package/src/runtime/internal/client/head.js +4 -3
- package/src/runtime/internal/client/html.js +5 -3
- package/src/runtime/internal/client/hydrate.js +484 -0
- package/src/runtime/internal/client/hydration-enabled.js +7 -0
- package/src/runtime/internal/client/hydration.js +16 -81
- package/src/runtime/internal/client/if.js +69 -10
- package/src/runtime/internal/client/index.js +18 -10
- package/src/runtime/internal/client/operations.js +11 -7
- package/src/runtime/internal/client/portal.js +3 -2
- package/src/runtime/internal/client/render.js +42 -325
- package/src/runtime/internal/client/root-boundary-enabled.js +7 -0
- package/src/runtime/internal/client/runtime.js +157 -371
- package/src/runtime/internal/client/template-ns.js +88 -0
- package/src/runtime/internal/client/template.js +118 -139
- package/src/runtime/internal/client/track-async.js +356 -0
- package/src/runtime/internal/client/try.js +133 -319
- package/src/runtime/internal/client/types.d.ts +48 -24
- package/src/runtime/internal/server/index.js +31 -29
- package/src/runtime/internal/server/prerender.js +27 -0
- package/src/server/index.js +1 -0
- package/src/utils/class-name.js +28 -0
- package/tests/client/basic/basic.errors.test.tsrx +3 -3
- package/tests/client/compiler/__snapshots__/compiler.typescript.test.tsrx.snap +0 -2
- package/tests/client/compiler/compiler.basic.test.tsrx +2 -2
- package/tests/client/compiler/compiler.tracked-access.test.tsrx +3 -3
- package/tests/client/composite/composite.dynamic-components.test.tsrx +40 -0
- package/tests/client/composite/composite.props.test.tsrx +10 -10
- package/tests/client/css/scoped-styles.test.tsrx +3 -1
- package/tests/client/derived-release.test.tsrx +3 -3
- package/tests/client/for-item.test.tsrx +39 -0
- package/tests/client/for-selector.test.tsrx +95 -0
- package/tests/client/svg.test.tsrx +273 -1
- package/tests/hydration/compiled/client/basic.js +88 -87
- package/tests/hydration/compiled/client/composite.js +15 -6
- package/tests/hydration/compiled/client/events.js +40 -48
- package/tests/hydration/compiled/client/for.js +191 -199
- package/tests/hydration/compiled/client/fragment-cursor.js +633 -334
- package/tests/hydration/compiled/client/head.js +22 -22
- package/tests/hydration/compiled/client/hmr.js +14 -5
- package/tests/hydration/compiled/client/html-in-template.js +5 -5
- package/tests/hydration/compiled/client/html.js +195 -177
- package/tests/hydration/compiled/client/if-children.js +136 -63
- package/tests/hydration/compiled/client/if-fragment-controlflow.js +63 -43
- package/tests/hydration/compiled/client/if.js +78 -30
- package/tests/hydration/compiled/client/mixed-control-flow.js +90 -72
- package/tests/hydration/compiled/client/nested-control-flow.js +266 -307
- package/tests/hydration/compiled/client/portal.js +20 -11
- package/tests/hydration/compiled/client/reactivity.js +29 -29
- package/tests/hydration/compiled/client/return.js +2 -2
- package/tests/hydration/compiled/client/streaming.js +33 -35
- package/tests/hydration/compiled/client/switch.js +25 -25
- package/tests/hydration/compiled/client/track-async-serialization.js +41 -41
- package/tests/hydration/compiled/client/try.js +15 -15
- package/tests/hydration/compiled/client/typed-text.js +8 -7
- package/tests/hydration/compiled/server/basic.js +6 -6
- package/tests/hydration/compiled/server/events.js +8 -8
- package/tests/hydration/compiled/server/for.js +22 -22
- package/tests/hydration/compiled/server/fragment-cursor.js +188 -52
- package/tests/hydration/compiled/server/head.js +6 -6
- package/tests/hydration/compiled/server/hmr.js +1 -1
- package/tests/hydration/compiled/server/html.js +1 -1
- package/tests/hydration/compiled/server/if-children.js +9 -9
- package/tests/hydration/compiled/server/if.js +5 -5
- package/tests/hydration/compiled/server/mixed-control-flow.js +4 -4
- package/tests/hydration/compiled/server/portal.js +1 -1
- package/tests/hydration/compiled/server/reactivity.js +9 -9
- package/tests/hydration/compiled/server/streaming.js +9 -9
- package/tests/hydration/compiled/server/switch.js +4 -4
- package/tests/hydration/compiled/server/track-async-serialization.js +16 -16
- package/tests/hydration/compiled/server/try.js +4 -4
- package/tests/hydration/compiled/server/typed-text.js +1 -1
- package/tests/hydration/components/fragment-cursor.tsrx +60 -0
- package/tests/hydration/components/track-async-serialization.tsrx +2 -2
- package/tests/hydration/fragment-cursor.test.js +34 -1
- package/tests/hydration/track-async-serialization.test.js +1 -1
- package/tests/server/basic.components.test.tsrx +3 -3
- package/tests/server/track-async-serialization.test.tsrx +6 -6
- package/tests/utils/tracked-types.test.js +3 -3
- package/types/index.d.ts +8 -8
- package/types/server.d.ts +17 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as _$_ from 'ripple/internal/client';
|
|
3
3
|
|
|
4
|
-
var root_1 = _$_.
|
|
4
|
+
var root_1 = _$_.template_el('div', null, 'Content');
|
|
5
5
|
var root = _$_.template(`<!>`, 1, 1);
|
|
6
6
|
|
|
7
7
|
function StaticTitle_render(__anchor, __block) {
|
|
@@ -23,11 +23,11 @@ function StaticTitle_render(__anchor, __block) {
|
|
|
23
23
|
|
|
24
24
|
StaticTitle[_$_.$r] = StaticTitle_render;
|
|
25
25
|
|
|
26
|
-
var root_3 = _$_.template(`<div><span>
|
|
26
|
+
var root_3 = _$_.template(`<div><span> `);
|
|
27
27
|
var root_2 = _$_.template(`<!>`, 1, 1);
|
|
28
28
|
|
|
29
29
|
function ReactiveTitle_render(__anchor, __block) {
|
|
30
|
-
const title = _$_.track('Initial Title', __block, '
|
|
30
|
+
const title = _$_.track('Initial Title', __block, '1kjlv4z');
|
|
31
31
|
var fragment_1 = root_2();
|
|
32
32
|
var node_1 = _$_.first_child_frag(fragment_1);
|
|
33
33
|
|
|
@@ -59,8 +59,8 @@ function ReactiveTitle_render(__anchor, __block) {
|
|
|
59
59
|
|
|
60
60
|
ReactiveTitle[_$_.$r] = ReactiveTitle_render;
|
|
61
61
|
|
|
62
|
-
var root_6 = _$_.template(`<meta name=
|
|
63
|
-
var root_5 = _$_.
|
|
62
|
+
var root_6 = _$_.template(`<meta name=description content="Page description"><link rel=stylesheet href=/styles.css>`, 1, 2);
|
|
63
|
+
var root_5 = _$_.template_el('div', null, 'Page content');
|
|
64
64
|
var root_4 = _$_.template(`<!>`, 1, 1);
|
|
65
65
|
|
|
66
66
|
function MultipleHeadElements_render(__anchor, __block) {
|
|
@@ -86,12 +86,12 @@ function MultipleHeadElements_render(__anchor, __block) {
|
|
|
86
86
|
|
|
87
87
|
MultipleHeadElements[_$_.$r] = MultipleHeadElements_render;
|
|
88
88
|
|
|
89
|
-
var root_9 = _$_.
|
|
90
|
-
var root_8 = _$_.
|
|
89
|
+
var root_9 = _$_.template_el('meta', ['name', 'description']);
|
|
90
|
+
var root_8 = _$_.template_el('div', null, ' ');
|
|
91
91
|
var root_7 = _$_.template(`<!>`, 1, 1);
|
|
92
92
|
|
|
93
93
|
function ReactiveMetaTags_render(__anchor, __block) {
|
|
94
|
-
const description = _$_.track('Initial description', __block, '
|
|
94
|
+
const description = _$_.track('Initial description', __block, 'fqug8i');
|
|
95
95
|
var fragment_4 = root_7();
|
|
96
96
|
var node_3 = _$_.first_child_frag(fragment_4);
|
|
97
97
|
|
|
@@ -121,11 +121,11 @@ function ReactiveMetaTags_render(__anchor, __block) {
|
|
|
121
121
|
|
|
122
122
|
ReactiveMetaTags[_$_.$r] = ReactiveMetaTags_render;
|
|
123
123
|
|
|
124
|
-
var root_11 = _$_.
|
|
124
|
+
var root_11 = _$_.template_el('div', null, ' ');
|
|
125
125
|
var root_10 = _$_.template(`<!>`, 1, 1);
|
|
126
126
|
|
|
127
127
|
function TitleWithTemplate_render(__anchor, __block) {
|
|
128
|
-
const name = _$_.track('World', __block, '
|
|
128
|
+
const name = _$_.track('World', __block, '1vkyx91');
|
|
129
129
|
var fragment_5 = root_10();
|
|
130
130
|
var node_4 = _$_.first_child_frag(fragment_5);
|
|
131
131
|
|
|
@@ -153,7 +153,7 @@ function TitleWithTemplate_render(__anchor, __block) {
|
|
|
153
153
|
|
|
154
154
|
TitleWithTemplate[_$_.$r] = TitleWithTemplate_render;
|
|
155
155
|
|
|
156
|
-
var root_13 = _$_.
|
|
156
|
+
var root_13 = _$_.template_el('div', null, 'Empty title test');
|
|
157
157
|
var root_12 = _$_.template(`<!>`, 1, 1);
|
|
158
158
|
|
|
159
159
|
function EmptyTitle_render(__anchor, __block) {
|
|
@@ -175,12 +175,12 @@ function EmptyTitle_render(__anchor, __block) {
|
|
|
175
175
|
|
|
176
176
|
EmptyTitle[_$_.$r] = EmptyTitle_render;
|
|
177
177
|
|
|
178
|
-
var root_15 = _$_.
|
|
178
|
+
var root_15 = _$_.template_el('div', null, ' ');
|
|
179
179
|
var root_14 = _$_.template(`<!>`, 1, 1);
|
|
180
180
|
|
|
181
181
|
function ConditionalTitle_render(__anchor, __block) {
|
|
182
|
-
const showPrefix = _$_.track(true, __block, '
|
|
183
|
-
const title = _$_.track('Main Page', __block, '
|
|
182
|
+
const showPrefix = _$_.track(true, __block, '1yvk8in');
|
|
183
|
+
const title = _$_.track('Main Page', __block, 'yn0twx');
|
|
184
184
|
var fragment_7 = root_14();
|
|
185
185
|
var node_6 = _$_.first_child_frag(fragment_7);
|
|
186
186
|
|
|
@@ -208,13 +208,13 @@ function ConditionalTitle_render(__anchor, __block) {
|
|
|
208
208
|
|
|
209
209
|
ConditionalTitle[_$_.$r] = ConditionalTitle_render;
|
|
210
210
|
|
|
211
|
-
var root_17 = _$_.template(`<div><span
|
|
211
|
+
var root_17 = _$_.template(`<div><span>`);
|
|
212
212
|
|
|
213
213
|
function render(__prev) {
|
|
214
|
-
var __a = __prev.
|
|
214
|
+
var __a = __prev._a.value;
|
|
215
215
|
|
|
216
216
|
if (__prev.a !== __a) {
|
|
217
|
-
_$_.set_text_content(__prev.
|
|
217
|
+
_$_.set_text_content(__prev._b, __a, __prev.a);
|
|
218
218
|
__prev.a = __a;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
@@ -222,7 +222,7 @@ function render(__prev) {
|
|
|
222
222
|
var root_16 = _$_.template(`<!>`, 1, 1);
|
|
223
223
|
|
|
224
224
|
function ComputedTitle_render(__anchor, __block) {
|
|
225
|
-
const count = _$_.track(0, __block, '
|
|
225
|
+
const count = _$_.track(0, __block, '1eod79s');
|
|
226
226
|
let prefix = 'Count: ';
|
|
227
227
|
var fragment_8 = root_16();
|
|
228
228
|
var node_7 = _$_.first_child_frag(fragment_8);
|
|
@@ -240,7 +240,7 @@ function ComputedTitle_render(__anchor, __block) {
|
|
|
240
240
|
});
|
|
241
241
|
});
|
|
242
242
|
|
|
243
|
-
_$_.render(render, { a: '',
|
|
243
|
+
_$_.render(render, { a: '', _a: count, _b: span_1 });
|
|
244
244
|
_$_.append(__anchor, div_7);
|
|
245
245
|
}));
|
|
246
246
|
|
|
@@ -249,8 +249,8 @@ function ComputedTitle_render(__anchor, __block) {
|
|
|
249
249
|
|
|
250
250
|
ComputedTitle[_$_.$r] = ComputedTitle_render;
|
|
251
251
|
|
|
252
|
-
var root_20 = _$_.
|
|
253
|
-
var root_19 = _$_.
|
|
252
|
+
var root_20 = _$_.template_el('meta', ['name', 'author', 'content', 'Test Author']);
|
|
253
|
+
var root_19 = _$_.template_el('div', null, 'Content');
|
|
254
254
|
var root_18 = _$_.template(`<!>`, 1, 1);
|
|
255
255
|
|
|
256
256
|
function MultipleHeadBlocks_render(__anchor, __block) {
|
|
@@ -278,7 +278,7 @@ function MultipleHeadBlocks_render(__anchor, __block) {
|
|
|
278
278
|
|
|
279
279
|
MultipleHeadBlocks[_$_.$r] = MultipleHeadBlocks_render;
|
|
280
280
|
|
|
281
|
-
var root_22 = _$_.
|
|
281
|
+
var root_22 = _$_.template_el('div', null, 'Styled content');
|
|
282
282
|
var root_21 = _$_.template(`<!>`, 1, 1);
|
|
283
283
|
|
|
284
284
|
function HeadWithStyle_render(__anchor, __block) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as _$_ from 'ripple/internal/client';
|
|
3
3
|
|
|
4
|
-
var root = _$_.template(`<div class=
|
|
4
|
+
var root = _$_.template(`<div class=layout><nav class=nav>Navigation</nav><main class=main><!>`);
|
|
5
5
|
|
|
6
6
|
function Layout_render(__anchor, __block, { children }) {
|
|
7
7
|
var div = root();
|
|
@@ -23,7 +23,7 @@ function Layout_render(__anchor, __block, { children }) {
|
|
|
23
23
|
|
|
24
24
|
Layout[_$_.$r] = Layout_render;
|
|
25
25
|
|
|
26
|
-
var root_2 = _$_.
|
|
26
|
+
var root_2 = _$_.template_el('p', ['class', 'text'], 'Hello world');
|
|
27
27
|
|
|
28
28
|
function consequent(__anchor, visible) {
|
|
29
29
|
var p = root_2();
|
|
@@ -35,19 +35,28 @@ function if_1(visible) {
|
|
|
35
35
|
if (visible.value) return consequent;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
var root_1 = _$_.template(`<div class=
|
|
38
|
+
var root_1 = _$_.template(`<div class=content><!>`);
|
|
39
|
+
|
|
40
|
+
function render(__prev) {
|
|
41
|
+
var __a = if_1(__prev._a);
|
|
42
|
+
|
|
43
|
+
if (__prev.a !== __a) {
|
|
44
|
+
_$_.if_update(__prev._b, __prev.a = __a);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
39
47
|
|
|
40
48
|
function Content_render(__anchor, __block) {
|
|
41
|
-
const visible = _$_.track(true, __block, '
|
|
49
|
+
const visible = _$_.track(true, __block, '3af9q8');
|
|
42
50
|
var div_1 = root_1();
|
|
43
51
|
|
|
44
52
|
{
|
|
45
53
|
var node = _$_.hydrating ? _$_.hydrate_child() : div_1.firstChild;
|
|
54
|
+
var ifs = _$_.if_static(node, if_1, 0, visible);
|
|
46
55
|
|
|
47
|
-
_$_.if(node, if_1, false, visible);
|
|
48
56
|
_$_.hydrating && _$_.pop(div_1);
|
|
49
57
|
}
|
|
50
58
|
|
|
59
|
+
_$_.render(render, { a: _$_.UNINITIALIZED, _a: visible, _b: ifs });
|
|
51
60
|
_$_.append(__anchor, div_1);
|
|
52
61
|
}
|
|
53
62
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as _$_ from 'ripple/internal/client';
|
|
3
3
|
|
|
4
|
-
var root = _$_.template(`<template id=
|
|
4
|
+
var root = _$_.template(`<template id=data1>`);
|
|
5
5
|
|
|
6
6
|
function SimpleTemplateHtml_render(__anchor, __block) {
|
|
7
7
|
const data = 'test data';
|
|
@@ -13,7 +13,7 @@ function SimpleTemplateHtml_render(__anchor, __block) {
|
|
|
13
13
|
|
|
14
14
|
SimpleTemplateHtml[_$_.$r] = SimpleTemplateHtml_render;
|
|
15
15
|
|
|
16
|
-
var root_1 = _$_.template(`<template id=
|
|
16
|
+
var root_1 = _$_.template(`<template id=data2>`);
|
|
17
17
|
|
|
18
18
|
function TemplateWithJSON_render(__anchor, __block) {
|
|
19
19
|
const jsonData = _$_.with_scope(__block, () => JSON.stringify({ message: 'hello', count: 42 }));
|
|
@@ -25,7 +25,7 @@ function TemplateWithJSON_render(__anchor, __block) {
|
|
|
25
25
|
|
|
26
26
|
TemplateWithJSON[_$_.$r] = TemplateWithJSON_render;
|
|
27
27
|
|
|
28
|
-
var root_3 = _$_.
|
|
28
|
+
var root_3 = _$_.template_el('span', ['class', 'inside'], 'inside');
|
|
29
29
|
|
|
30
30
|
function consequent(__anchor, show) {
|
|
31
31
|
var span = root_3();
|
|
@@ -37,7 +37,7 @@ function if_1(show) {
|
|
|
37
37
|
if (show) return consequent;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
var root_2 = _$_.template(`<div><template id=
|
|
40
|
+
var root_2 = _$_.template(`<div><template id=before></template><template id=after>`);
|
|
41
41
|
|
|
42
42
|
function TemplateAroundIfBlock_render(__anchor, __block) {
|
|
43
43
|
const show = true;
|
|
@@ -52,7 +52,7 @@ function TemplateAroundIfBlock_render(__anchor, __block) {
|
|
|
52
52
|
|
|
53
53
|
_$_.if(node, if_1, false, show);
|
|
54
54
|
|
|
55
|
-
var template_3 = _$_.hydrating ? _$_.hydrate_sibling() : node
|
|
55
|
+
var template_3 = _$_.hydrating ? _$_.hydrate_sibling() : node;
|
|
56
56
|
|
|
57
57
|
template_3.innerHTML = "after" ?? template_3.innerHTML;
|
|
58
58
|
_$_.hydrating && _$_.pop(div);
|