ripple 0.2.211 → 0.2.213
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 +18 -0
- package/README.md +3 -0
- package/package.json +5 -2
- package/src/compiler/phases/1-parse/index.js +50 -2
- package/src/compiler/phases/2-analyze/index.js +13 -29
- package/src/compiler/phases/3-transform/client/index.js +145 -5
- package/src/compiler/types/index.d.ts +4 -7
- package/src/compiler/types/rpc.d.ts +5 -0
- package/src/runtime/internal/client/hydration.js +4 -0
- package/src/runtime/internal/client/rpc.js +31 -3
- package/src/runtime/internal/client/template.js +4 -2
- package/tests/client/compiler/compiler.basic.test.ripple +24 -0
- package/tests/client/compiler/compiler.try-in-function.test.ripple +159 -0
- package/tests/hydration/basic.test.js +23 -0
- package/tests/hydration/build-components.js +2 -2
- package/tests/hydration/compiled/client/basic.js +67 -1
- package/tests/hydration/compiled/client/composite.js +1 -0
- package/tests/hydration/compiled/client/events.js +1 -0
- package/tests/hydration/compiled/client/for.js +1 -0
- package/tests/hydration/compiled/client/head.js +1 -0
- package/tests/hydration/compiled/client/html.js +1 -0
- package/tests/hydration/compiled/client/if-children.js +407 -0
- package/tests/hydration/compiled/client/if.js +1 -0
- package/tests/hydration/compiled/client/portal.js +4 -0
- package/tests/hydration/compiled/client/reactivity.js +1 -0
- package/tests/hydration/compiled/client/return.js +1 -0
- package/tests/hydration/compiled/client/switch.js +1 -0
- package/tests/hydration/compiled/server/basic.js +108 -1
- package/tests/hydration/compiled/server/composite.js +1 -0
- package/tests/hydration/compiled/server/events.js +1 -0
- package/tests/hydration/compiled/server/for.js +1 -0
- package/tests/hydration/compiled/server/head.js +1 -0
- package/tests/hydration/compiled/server/html.js +1 -0
- package/tests/hydration/compiled/server/if-children.js +686 -0
- package/tests/hydration/compiled/server/if.js +1 -0
- package/tests/hydration/compiled/server/portal.js +1 -0
- package/tests/hydration/compiled/server/reactivity.js +1 -0
- package/tests/hydration/compiled/server/return.js +1 -0
- package/tests/hydration/compiled/server/switch.js +1 -0
- package/tests/hydration/components/basic.ripple +32 -1
- package/tests/hydration/components/composite.ripple +3 -1
- package/tests/hydration/components/if-children.ripple +196 -0
- package/tests/hydration/if-children.test.js +272 -0
- package/tests/hydration/tsconfig.json +12 -0
- package/tests/hydration.d.ts +14 -0
|
@@ -81,4 +81,27 @@ describe('hydration > basic', () => {
|
|
|
81
81
|
expect(container.querySelector('.playground-link')?.textContent).toBe('Playground');
|
|
82
82
|
expect(container.querySelector('.content')).toBeTruthy();
|
|
83
83
|
});
|
|
84
|
+
|
|
85
|
+
// Test for hydrate_advance() in append() - component as last sibling with no following siblings
|
|
86
|
+
it('hydrates component as last sibling (no following siblings)', async () => {
|
|
87
|
+
await hydrateComponent(
|
|
88
|
+
ServerComponents.ComponentAsLastSibling,
|
|
89
|
+
ClientComponents.ComponentAsLastSibling,
|
|
90
|
+
);
|
|
91
|
+
expect(container.querySelector('.wrapper')).toBeTruthy();
|
|
92
|
+
expect(container.querySelector('h1')?.textContent).toBe('Header');
|
|
93
|
+
expect(container.querySelector('p')?.textContent).toBe('Some content');
|
|
94
|
+
expect(container.querySelector('.last-child')?.textContent).toBe('I am the last child');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('hydrates nested component with inner component as last sibling', async () => {
|
|
98
|
+
await hydrateComponent(
|
|
99
|
+
ServerComponents.NestedComponentAsLastSibling,
|
|
100
|
+
ClientComponents.NestedComponentAsLastSibling,
|
|
101
|
+
);
|
|
102
|
+
expect(container.querySelector('.outer')).toBeTruthy();
|
|
103
|
+
expect(container.querySelector('h2')?.textContent).toBe('Section title');
|
|
104
|
+
expect(container.querySelector('.inner span')?.textContent).toBe('Inner text');
|
|
105
|
+
expect(container.querySelector('.inner .last-child')?.textContent).toBe('I am the last child');
|
|
106
|
+
});
|
|
84
107
|
});
|
|
@@ -57,7 +57,7 @@ function buildComponents() {
|
|
|
57
57
|
const clientResult = compile(source, file, {
|
|
58
58
|
mode: 'client',
|
|
59
59
|
});
|
|
60
|
-
writeFileSync(join(clientOutDir, outputName), clientResult.js.code);
|
|
60
|
+
writeFileSync(join(clientOutDir, outputName), '// @ts-nocheck\n' + clientResult.js.code);
|
|
61
61
|
|
|
62
62
|
// Compile for server
|
|
63
63
|
const serverResult = compile(source, file, {
|
|
@@ -65,7 +65,7 @@ function buildComponents() {
|
|
|
65
65
|
});
|
|
66
66
|
// Transform imports to use server runtime
|
|
67
67
|
const serverCode = transformServerImports(serverResult.js.code);
|
|
68
|
-
writeFileSync(join(serverOutDir, outputName), serverCode);
|
|
68
|
+
writeFileSync(join(serverOutDir, outputName), '// @ts-nocheck\n' + serverCode);
|
|
69
69
|
|
|
70
70
|
console.log(`Compiled ${file} -> client & server`);
|
|
71
71
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import * as _$_ from 'ripple/internal/client';
|
|
2
3
|
|
|
3
4
|
var root = _$_.template(`<div>Hello World</div>`, 0);
|
|
@@ -21,6 +22,10 @@ var root_17 = _$_.template(`<main><div class="container"><!></div></main>`, 0);
|
|
|
21
22
|
var root_18 = _$_.template(`<div class="content"><p>Some content here</p></div>`, 0);
|
|
22
23
|
var root_20 = _$_.template(`<!><!><!><!>`, 1);
|
|
23
24
|
var root_19 = _$_.template(`<!>`, 1);
|
|
25
|
+
var root_21 = _$_.template(`<footer class="last-child">I am the last child</footer>`, 0);
|
|
26
|
+
var root_22 = _$_.template(`<div class="wrapper"><h1>Header</h1><p>Some content</p><!></div>`, 0);
|
|
27
|
+
var root_23 = _$_.template(`<div class="inner"><span>Inner text</span><!></div>`, 0);
|
|
28
|
+
var root_24 = _$_.template(`<section class="outer"><h2>Section title</h2><!></section>`, 0);
|
|
24
29
|
|
|
25
30
|
export function StaticText(__anchor, _, __block) {
|
|
26
31
|
_$_.push_component();
|
|
@@ -251,7 +256,7 @@ function Actions(__anchor, __props, __block) {
|
|
|
251
256
|
};
|
|
252
257
|
|
|
253
258
|
_$_.if(node_5, (__render) => {
|
|
254
|
-
if (_$_.
|
|
259
|
+
if (_$_.fallback(__props.playgroundVisible, false)) __render(consequent);
|
|
255
260
|
});
|
|
256
261
|
}
|
|
257
262
|
|
|
@@ -328,4 +333,65 @@ export function WebsiteIndex(__anchor, _, __block) {
|
|
|
328
333
|
|
|
329
334
|
_$_.append(__anchor, fragment_8);
|
|
330
335
|
_$_.pop_component();
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function LastChild(__anchor, _, __block) {
|
|
339
|
+
_$_.push_component();
|
|
340
|
+
|
|
341
|
+
var footer_1 = root_21();
|
|
342
|
+
|
|
343
|
+
_$_.append(__anchor, footer_1);
|
|
344
|
+
_$_.pop_component();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export function ComponentAsLastSibling(__anchor, _, __block) {
|
|
348
|
+
_$_.push_component();
|
|
349
|
+
|
|
350
|
+
var div_11 = root_22();
|
|
351
|
+
|
|
352
|
+
{
|
|
353
|
+
var h1_1 = _$_.child(div_11);
|
|
354
|
+
var p_1 = _$_.sibling(h1_1);
|
|
355
|
+
var node_12 = _$_.sibling(p_1);
|
|
356
|
+
|
|
357
|
+
LastChild(node_12, {}, _$_.active_block);
|
|
358
|
+
_$_.pop(div_11);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
_$_.append(__anchor, div_11);
|
|
362
|
+
_$_.pop_component();
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function InnerContent(__anchor, _, __block) {
|
|
366
|
+
_$_.push_component();
|
|
367
|
+
|
|
368
|
+
var div_12 = root_23();
|
|
369
|
+
|
|
370
|
+
{
|
|
371
|
+
var span_5 = _$_.child(div_12);
|
|
372
|
+
var node_13 = _$_.sibling(span_5);
|
|
373
|
+
|
|
374
|
+
LastChild(node_13, {}, _$_.active_block);
|
|
375
|
+
_$_.pop(div_12);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
_$_.append(__anchor, div_12);
|
|
379
|
+
_$_.pop_component();
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export function NestedComponentAsLastSibling(__anchor, _, __block) {
|
|
383
|
+
_$_.push_component();
|
|
384
|
+
|
|
385
|
+
var section_1 = root_24();
|
|
386
|
+
|
|
387
|
+
{
|
|
388
|
+
var h2_1 = _$_.child(section_1);
|
|
389
|
+
var node_14 = _$_.sibling(h2_1);
|
|
390
|
+
|
|
391
|
+
InnerContent(node_14, {}, _$_.active_block);
|
|
392
|
+
_$_.pop(section_1);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
_$_.append(__anchor, section_1);
|
|
396
|
+
_$_.pop_component();
|
|
331
397
|
}
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import * as _$_ from 'ripple/internal/client';
|
|
3
|
+
|
|
4
|
+
var root_1 = _$_.template(`<div class="content"><!></div>`, 0);
|
|
5
|
+
var root = _$_.template(`<div class="container"><div role="button" class="header">Toggle</div><!></div>`, 0);
|
|
6
|
+
var root_2 = _$_.template(`<div class="item"> </div>`, 0);
|
|
7
|
+
var root_4 = _$_.template(`<!><!>`, 1);
|
|
8
|
+
var root_3 = _$_.template(`<!>`, 1);
|
|
9
|
+
var root_6 = _$_.template(`<div class="content"><span>Static child 1</span><span>Static child 2</span></div>`, 0);
|
|
10
|
+
var root_5 = _$_.template(`<div class="container"><div role="button" class="header">Toggle</div><!></div>`, 0);
|
|
11
|
+
var root_8 = _$_.template(`<div class="items"><!></div>`, 0);
|
|
12
|
+
var root_7 = _$_.template(`<section class="group"><div role="button" class="item"><div class="indicator"></div><h2 class="text">Title</h2><div class="caret"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"></path></svg></div></div><!></section>`, 0);
|
|
13
|
+
var root_10 = _$_.template(`<!><!>`, 1);
|
|
14
|
+
var root_9 = _$_.template(`<!>`, 1);
|
|
15
|
+
var root_12 = _$_.template(`<div class="conditional">Conditional content</div>`, 0);
|
|
16
|
+
var root_11 = _$_.template(`<div class="wrapper"><div class="nested-parent"><div class="nested-child"><span class="deep">Deep content</span></div></div><!></div><button class="toggle">Toggle</button>`, 1);
|
|
17
|
+
var root_14 = _$_.template(`<footer class="footer">Footer</footer>`, 0);
|
|
18
|
+
var root_13 = _$_.template(`<section class="outer"><article class="middle"><div class="inner"><p class="leaf"><strong>Bold</strong><em>Italic</em></p></div></article><!></section><button class="btn">Toggle</button>`, 1);
|
|
19
|
+
var root_16 = _$_.template(`<pre class="code">const x = 1;</pre>`, 0);
|
|
20
|
+
var root_17 = _$_.template(`<div class="preview">Preview content</div>`, 0);
|
|
21
|
+
var root_15 = _$_.template(`<div class="tabs"><div class="tab-list"><button class="tab">Code</button><button class="tab">Preview</button></div><div class="panel"><!></div></div>`, 0);
|
|
22
|
+
var root_18 = _$_.template(`<div class="container"><ul class="list"><li class="item"> </li><li class="item">Another item</li></ul><h2 class="heading">Static Heading</h2><p class="para">Static paragraph</p></div><button class="inc">Increment</button>`, 1);
|
|
23
|
+
var root_19 = _$_.template(`<div class="wrapper"><ul class="features"><li><strong>Feature One</strong>: Description of feature one with <code>code</code> reference</li><li><strong>Feature Two</strong>: Another feature description</li><li><strong>Feature Three</strong>: Third feature</li></ul><h2 class="section-heading">Section Heading</h2><p class="section-content">Static paragraph with <a href="/link">a link</a> and more text.</p></div>`, 0);
|
|
24
|
+
|
|
25
|
+
import { track } from 'ripple';
|
|
26
|
+
|
|
27
|
+
export function IfWithChildren(__anchor, __props, __block) {
|
|
28
|
+
_$_.push_component();
|
|
29
|
+
|
|
30
|
+
let expanded = track(true, void 0, void 0, __block);
|
|
31
|
+
var div_1 = root();
|
|
32
|
+
|
|
33
|
+
{
|
|
34
|
+
var div_2 = _$_.child(div_1);
|
|
35
|
+
|
|
36
|
+
div_2.__click = () => _$_.set(expanded, !_$_.get(expanded));
|
|
37
|
+
|
|
38
|
+
var node = _$_.sibling(div_2);
|
|
39
|
+
|
|
40
|
+
{
|
|
41
|
+
var consequent = (__anchor) => {
|
|
42
|
+
var div_3 = root_1();
|
|
43
|
+
|
|
44
|
+
{
|
|
45
|
+
var node_1 = _$_.child(div_3);
|
|
46
|
+
|
|
47
|
+
_$_.composite(() => __props.children, node_1, {});
|
|
48
|
+
_$_.pop(div_3);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_$_.append(__anchor, div_3);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
_$_.if(node, (__render) => {
|
|
55
|
+
if (_$_.get(expanded)) __render(consequent);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
_$_.pop(div_1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_$_.append(__anchor, div_1);
|
|
63
|
+
_$_.pop_component();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function ChildItem(__anchor, __props, __block) {
|
|
67
|
+
_$_.push_component();
|
|
68
|
+
|
|
69
|
+
var div_4 = root_2();
|
|
70
|
+
|
|
71
|
+
{
|
|
72
|
+
var text_1 = _$_.child(div_4, true);
|
|
73
|
+
|
|
74
|
+
_$_.pop(div_4);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
_$_.render(() => {
|
|
78
|
+
_$_.set_text(text_1, __props.text);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
_$_.append(__anchor, div_4);
|
|
82
|
+
_$_.pop_component();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function TestIfWithChildren(__anchor, _, __block) {
|
|
86
|
+
_$_.push_component();
|
|
87
|
+
|
|
88
|
+
var fragment = root_3();
|
|
89
|
+
var node_2 = _$_.first_child_frag(fragment);
|
|
90
|
+
|
|
91
|
+
IfWithChildren(
|
|
92
|
+
node_2,
|
|
93
|
+
{
|
|
94
|
+
children(__anchor, _, __block) {
|
|
95
|
+
_$_.push_component();
|
|
96
|
+
|
|
97
|
+
var fragment_1 = root_4();
|
|
98
|
+
var node_3 = _$_.first_child_frag(fragment_1);
|
|
99
|
+
|
|
100
|
+
ChildItem(node_3, { text: "Item 1" }, _$_.active_block);
|
|
101
|
+
|
|
102
|
+
var node_4 = _$_.sibling(node_3);
|
|
103
|
+
|
|
104
|
+
ChildItem(node_4, { text: "Item 2" }, _$_.active_block);
|
|
105
|
+
_$_.append(__anchor, fragment_1);
|
|
106
|
+
_$_.pop_component();
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
_$_.active_block
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
_$_.append(__anchor, fragment);
|
|
113
|
+
_$_.pop_component();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function IfWithStaticChildren(__anchor, _, __block) {
|
|
117
|
+
_$_.push_component();
|
|
118
|
+
|
|
119
|
+
let expanded = track(true, void 0, void 0, __block);
|
|
120
|
+
var div_5 = root_5();
|
|
121
|
+
|
|
122
|
+
{
|
|
123
|
+
var div_6 = _$_.child(div_5);
|
|
124
|
+
|
|
125
|
+
div_6.__click = () => _$_.set(expanded, !_$_.get(expanded));
|
|
126
|
+
|
|
127
|
+
var node_5 = _$_.sibling(div_6);
|
|
128
|
+
|
|
129
|
+
{
|
|
130
|
+
var consequent_1 = (__anchor) => {
|
|
131
|
+
var div_7 = root_6();
|
|
132
|
+
|
|
133
|
+
_$_.append(__anchor, div_7);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
_$_.if(node_5, (__render) => {
|
|
137
|
+
if (_$_.get(expanded)) __render(consequent_1);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
_$_.pop(div_5);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
_$_.append(__anchor, div_5);
|
|
145
|
+
_$_.pop_component();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function IfWithSiblingsAndChildren(__anchor, __props, __block) {
|
|
149
|
+
_$_.push_component();
|
|
150
|
+
|
|
151
|
+
let expanded = track(true, void 0, void 0, __block);
|
|
152
|
+
var section_1 = root_7();
|
|
153
|
+
|
|
154
|
+
{
|
|
155
|
+
var div_8 = _$_.child(section_1);
|
|
156
|
+
|
|
157
|
+
div_8.__click = () => _$_.set(expanded, !_$_.get(expanded));
|
|
158
|
+
_$_.pop(div_8);
|
|
159
|
+
|
|
160
|
+
var node_6 = _$_.sibling(div_8);
|
|
161
|
+
|
|
162
|
+
{
|
|
163
|
+
var consequent_2 = (__anchor) => {
|
|
164
|
+
var div_9 = root_8();
|
|
165
|
+
|
|
166
|
+
{
|
|
167
|
+
var node_7 = _$_.child(div_9);
|
|
168
|
+
|
|
169
|
+
_$_.composite(() => __props.children, node_7, {});
|
|
170
|
+
_$_.pop(div_9);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
_$_.append(__anchor, div_9);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
_$_.if(node_6, (__render) => {
|
|
177
|
+
if (_$_.get(expanded)) __render(consequent_2);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
_$_.pop(section_1);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
_$_.append(__anchor, section_1);
|
|
185
|
+
_$_.pop_component();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function TestIfWithSiblingsAndChildren(__anchor, _, __block) {
|
|
189
|
+
_$_.push_component();
|
|
190
|
+
|
|
191
|
+
var fragment_2 = root_9();
|
|
192
|
+
var node_8 = _$_.first_child_frag(fragment_2);
|
|
193
|
+
|
|
194
|
+
IfWithSiblingsAndChildren(
|
|
195
|
+
node_8,
|
|
196
|
+
{
|
|
197
|
+
children(__anchor, _, __block) {
|
|
198
|
+
_$_.push_component();
|
|
199
|
+
|
|
200
|
+
var fragment_3 = root_10();
|
|
201
|
+
var node_9 = _$_.first_child_frag(fragment_3);
|
|
202
|
+
|
|
203
|
+
ChildItem(node_9, { text: "Item A" }, _$_.active_block);
|
|
204
|
+
|
|
205
|
+
var node_10 = _$_.sibling(node_9);
|
|
206
|
+
|
|
207
|
+
ChildItem(node_10, { text: "Item B" }, _$_.active_block);
|
|
208
|
+
_$_.append(__anchor, fragment_3);
|
|
209
|
+
_$_.pop_component();
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
_$_.active_block
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
_$_.append(__anchor, fragment_2);
|
|
216
|
+
_$_.pop_component();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export function ElementWithChildrenThenIf(__anchor, _, __block) {
|
|
220
|
+
_$_.push_component();
|
|
221
|
+
|
|
222
|
+
let show = track(true, void 0, void 0, __block);
|
|
223
|
+
var fragment_4 = root_11();
|
|
224
|
+
var div_11 = _$_.first_child_frag(fragment_4);
|
|
225
|
+
|
|
226
|
+
{
|
|
227
|
+
var div_10 = _$_.child(div_11);
|
|
228
|
+
|
|
229
|
+
_$_.pop(div_10);
|
|
230
|
+
|
|
231
|
+
var node_11 = _$_.sibling(div_10);
|
|
232
|
+
|
|
233
|
+
{
|
|
234
|
+
var consequent_3 = (__anchor) => {
|
|
235
|
+
var div_12 = root_12();
|
|
236
|
+
|
|
237
|
+
_$_.append(__anchor, div_12);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
_$_.if(node_11, (__render) => {
|
|
241
|
+
if (_$_.get(show)) __render(consequent_3);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
_$_.pop(div_11);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
var button_1 = _$_.sibling(div_11);
|
|
249
|
+
|
|
250
|
+
button_1.__click = () => _$_.set(show, !_$_.get(show));
|
|
251
|
+
_$_.next();
|
|
252
|
+
_$_.append(__anchor, fragment_4, true);
|
|
253
|
+
_$_.pop_component();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function DeepNestingThenIf(__anchor, _, __block) {
|
|
257
|
+
_$_.push_component();
|
|
258
|
+
|
|
259
|
+
let visible = track(true, void 0, void 0, __block);
|
|
260
|
+
var fragment_5 = root_13();
|
|
261
|
+
var section_2 = _$_.first_child_frag(fragment_5);
|
|
262
|
+
|
|
263
|
+
{
|
|
264
|
+
var article_1 = _$_.child(section_2);
|
|
265
|
+
|
|
266
|
+
_$_.pop(article_1);
|
|
267
|
+
|
|
268
|
+
var node_12 = _$_.sibling(article_1);
|
|
269
|
+
|
|
270
|
+
{
|
|
271
|
+
var consequent_4 = (__anchor) => {
|
|
272
|
+
var footer_1 = root_14();
|
|
273
|
+
|
|
274
|
+
_$_.append(__anchor, footer_1);
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
_$_.if(node_12, (__render) => {
|
|
278
|
+
if (_$_.get(visible)) __render(consequent_4);
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
_$_.pop(section_2);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
var button_2 = _$_.sibling(section_2);
|
|
286
|
+
|
|
287
|
+
button_2.__click = () => _$_.set(visible, !_$_.get(visible));
|
|
288
|
+
_$_.next();
|
|
289
|
+
_$_.append(__anchor, fragment_5, true);
|
|
290
|
+
_$_.pop_component();
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export function DomElementChildrenThenSibling(__anchor, _, __block) {
|
|
294
|
+
_$_.push_component();
|
|
295
|
+
|
|
296
|
+
let activeTab = track('code', void 0, void 0, __block);
|
|
297
|
+
var div_13 = root_15();
|
|
298
|
+
|
|
299
|
+
{
|
|
300
|
+
var div_14 = _$_.child(div_13);
|
|
301
|
+
|
|
302
|
+
{
|
|
303
|
+
var button_3 = _$_.child(div_14);
|
|
304
|
+
|
|
305
|
+
button_3.__click = () => _$_.set(activeTab, 'code');
|
|
306
|
+
|
|
307
|
+
var button_4 = _$_.sibling(button_3);
|
|
308
|
+
|
|
309
|
+
button_4.__click = () => _$_.set(activeTab, 'preview');
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
_$_.pop(div_14);
|
|
313
|
+
|
|
314
|
+
var div_15 = _$_.sibling(div_14);
|
|
315
|
+
|
|
316
|
+
{
|
|
317
|
+
var node_13 = _$_.child(div_15);
|
|
318
|
+
|
|
319
|
+
{
|
|
320
|
+
var consequent_5 = (__anchor) => {
|
|
321
|
+
var pre_1 = root_16();
|
|
322
|
+
|
|
323
|
+
_$_.append(__anchor, pre_1);
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
var alternate = (__anchor) => {
|
|
327
|
+
var div_16 = root_17();
|
|
328
|
+
|
|
329
|
+
_$_.append(__anchor, div_16);
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
_$_.if(node_13, (__render) => {
|
|
333
|
+
if (_$_.get(activeTab) === 'code') __render(consequent_5); else __render(alternate, false);
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
_$_.pop(div_15);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
_$_.render(
|
|
342
|
+
(__prev) => {
|
|
343
|
+
var __a = _$_.get(activeTab) === 'code' ? 'true' : 'false';
|
|
344
|
+
|
|
345
|
+
if (__prev.a !== __a) {
|
|
346
|
+
_$_.set_attribute(button_3, 'aria-selected', __prev.a = __a);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
var __b = _$_.get(activeTab) === 'preview' ? 'true' : 'false';
|
|
350
|
+
|
|
351
|
+
if (__prev.b !== __b) {
|
|
352
|
+
_$_.set_attribute(button_4, 'aria-selected', __prev.b = __b);
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
{ a: void 0, b: void 0 }
|
|
356
|
+
);
|
|
357
|
+
|
|
358
|
+
_$_.append(__anchor, div_13);
|
|
359
|
+
_$_.pop_component();
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export function DomChildrenThenStaticSiblings(__anchor, _, __block) {
|
|
363
|
+
_$_.push_component();
|
|
364
|
+
|
|
365
|
+
let count = track(0, void 0, void 0, __block);
|
|
366
|
+
var fragment_6 = root_18();
|
|
367
|
+
var div_17 = _$_.first_child_frag(fragment_6);
|
|
368
|
+
|
|
369
|
+
{
|
|
370
|
+
var ul_1 = _$_.child(div_17);
|
|
371
|
+
|
|
372
|
+
{
|
|
373
|
+
var li_1 = _$_.child(ul_1);
|
|
374
|
+
|
|
375
|
+
{
|
|
376
|
+
var text_2 = _$_.child(li_1, true);
|
|
377
|
+
|
|
378
|
+
_$_.pop(li_1);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
_$_.pop(div_17);
|
|
384
|
+
|
|
385
|
+
var button_5 = _$_.sibling(div_17);
|
|
386
|
+
|
|
387
|
+
button_5.__click = () => _$_.update(count);
|
|
388
|
+
_$_.next();
|
|
389
|
+
|
|
390
|
+
_$_.render(() => {
|
|
391
|
+
_$_.set_text(text_2, 'Item count: ' + _$_.with_scope(__block, () => String(_$_.get(count))));
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
_$_.append(__anchor, fragment_6, true);
|
|
395
|
+
_$_.pop_component();
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export function StaticListThenStaticSiblings(__anchor, _, __block) {
|
|
399
|
+
_$_.push_component();
|
|
400
|
+
|
|
401
|
+
var div_18 = root_19();
|
|
402
|
+
|
|
403
|
+
_$_.append(__anchor, div_18);
|
|
404
|
+
_$_.pop_component();
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
_$_.delegate(['click']);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import * as _$_ from 'ripple/internal/client';
|
|
2
3
|
|
|
3
4
|
var root_1 = _$_.template(`<div class="portal-content">Portal content</div>`, 0);
|
|
@@ -141,6 +142,9 @@ export function NestedContentWithPortal(__anchor, _, __block) {
|
|
|
141
142
|
|
|
142
143
|
{
|
|
143
144
|
var div_9 = _$_.child(div_8);
|
|
145
|
+
|
|
146
|
+
_$_.pop(div_9);
|
|
147
|
+
|
|
144
148
|
var node_4 = _$_.sibling(div_9);
|
|
145
149
|
|
|
146
150
|
Portal(
|