ripple 0.2.211 → 0.2.212

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.
@@ -0,0 +1,406 @@
1
+ import * as _$_ from 'ripple/internal/client';
2
+
3
+ var root_1 = _$_.template(`<div class="content"><!></div>`, 0);
4
+ var root = _$_.template(`<div class="container"><div role="button" class="header">Toggle</div><!></div>`, 0);
5
+ var root_2 = _$_.template(`<div class="item"> </div>`, 0);
6
+ var root_4 = _$_.template(`<!><!>`, 1);
7
+ var root_3 = _$_.template(`<!>`, 1);
8
+ var root_6 = _$_.template(`<div class="content"><span>Static child 1</span><span>Static child 2</span></div>`, 0);
9
+ var root_5 = _$_.template(`<div class="container"><div role="button" class="header">Toggle</div><!></div>`, 0);
10
+ var root_8 = _$_.template(`<div class="items"><!></div>`, 0);
11
+ 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);
12
+ var root_10 = _$_.template(`<!><!>`, 1);
13
+ var root_9 = _$_.template(`<!>`, 1);
14
+ var root_12 = _$_.template(`<div class="conditional">Conditional content</div>`, 0);
15
+ 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);
16
+ var root_14 = _$_.template(`<footer class="footer">Footer</footer>`, 0);
17
+ 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);
18
+ var root_16 = _$_.template(`<pre class="code">const x = 1;</pre>`, 0);
19
+ var root_17 = _$_.template(`<div class="preview">Preview content</div>`, 0);
20
+ 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);
21
+ 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);
22
+ 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);
23
+
24
+ import { track } from 'ripple';
25
+
26
+ export function IfWithChildren(__anchor, __props, __block) {
27
+ _$_.push_component();
28
+
29
+ let expanded = track(true, void 0, void 0, __block);
30
+ var div_1 = root();
31
+
32
+ {
33
+ var div_2 = _$_.child(div_1);
34
+
35
+ div_2.__click = () => _$_.set(expanded, !_$_.get(expanded));
36
+
37
+ var node = _$_.sibling(div_2);
38
+
39
+ {
40
+ var consequent = (__anchor) => {
41
+ var div_3 = root_1();
42
+
43
+ {
44
+ var node_1 = _$_.child(div_3);
45
+
46
+ _$_.composite(() => __props.children, node_1, {});
47
+ _$_.pop(div_3);
48
+ }
49
+
50
+ _$_.append(__anchor, div_3);
51
+ };
52
+
53
+ _$_.if(node, (__render) => {
54
+ if (_$_.get(expanded)) __render(consequent);
55
+ });
56
+ }
57
+
58
+ _$_.pop(div_1);
59
+ }
60
+
61
+ _$_.append(__anchor, div_1);
62
+ _$_.pop_component();
63
+ }
64
+
65
+ export function ChildItem(__anchor, __props, __block) {
66
+ _$_.push_component();
67
+
68
+ var div_4 = root_2();
69
+
70
+ {
71
+ var text_1 = _$_.child(div_4, true);
72
+
73
+ _$_.pop(div_4);
74
+ }
75
+
76
+ _$_.render(() => {
77
+ _$_.set_text(text_1, __props.text);
78
+ });
79
+
80
+ _$_.append(__anchor, div_4);
81
+ _$_.pop_component();
82
+ }
83
+
84
+ export function TestIfWithChildren(__anchor, _, __block) {
85
+ _$_.push_component();
86
+
87
+ var fragment = root_3();
88
+ var node_2 = _$_.first_child_frag(fragment);
89
+
90
+ IfWithChildren(
91
+ node_2,
92
+ {
93
+ children(__anchor, _, __block) {
94
+ _$_.push_component();
95
+
96
+ var fragment_1 = root_4();
97
+ var node_3 = _$_.first_child_frag(fragment_1);
98
+
99
+ ChildItem(node_3, { text: "Item 1" }, _$_.active_block);
100
+
101
+ var node_4 = _$_.sibling(node_3);
102
+
103
+ ChildItem(node_4, { text: "Item 2" }, _$_.active_block);
104
+ _$_.append(__anchor, fragment_1);
105
+ _$_.pop_component();
106
+ }
107
+ },
108
+ _$_.active_block
109
+ );
110
+
111
+ _$_.append(__anchor, fragment);
112
+ _$_.pop_component();
113
+ }
114
+
115
+ export function IfWithStaticChildren(__anchor, _, __block) {
116
+ _$_.push_component();
117
+
118
+ let expanded = track(true, void 0, void 0, __block);
119
+ var div_5 = root_5();
120
+
121
+ {
122
+ var div_6 = _$_.child(div_5);
123
+
124
+ div_6.__click = () => _$_.set(expanded, !_$_.get(expanded));
125
+
126
+ var node_5 = _$_.sibling(div_6);
127
+
128
+ {
129
+ var consequent_1 = (__anchor) => {
130
+ var div_7 = root_6();
131
+
132
+ _$_.append(__anchor, div_7);
133
+ };
134
+
135
+ _$_.if(node_5, (__render) => {
136
+ if (_$_.get(expanded)) __render(consequent_1);
137
+ });
138
+ }
139
+
140
+ _$_.pop(div_5);
141
+ }
142
+
143
+ _$_.append(__anchor, div_5);
144
+ _$_.pop_component();
145
+ }
146
+
147
+ export function IfWithSiblingsAndChildren(__anchor, __props, __block) {
148
+ _$_.push_component();
149
+
150
+ let expanded = track(true, void 0, void 0, __block);
151
+ var section_1 = root_7();
152
+
153
+ {
154
+ var div_8 = _$_.child(section_1);
155
+
156
+ div_8.__click = () => _$_.set(expanded, !_$_.get(expanded));
157
+ _$_.pop(div_8);
158
+
159
+ var node_6 = _$_.sibling(div_8);
160
+
161
+ {
162
+ var consequent_2 = (__anchor) => {
163
+ var div_9 = root_8();
164
+
165
+ {
166
+ var node_7 = _$_.child(div_9);
167
+
168
+ _$_.composite(() => __props.children, node_7, {});
169
+ _$_.pop(div_9);
170
+ }
171
+
172
+ _$_.append(__anchor, div_9);
173
+ };
174
+
175
+ _$_.if(node_6, (__render) => {
176
+ if (_$_.get(expanded)) __render(consequent_2);
177
+ });
178
+ }
179
+
180
+ _$_.pop(section_1);
181
+ }
182
+
183
+ _$_.append(__anchor, section_1);
184
+ _$_.pop_component();
185
+ }
186
+
187
+ export function TestIfWithSiblingsAndChildren(__anchor, _, __block) {
188
+ _$_.push_component();
189
+
190
+ var fragment_2 = root_9();
191
+ var node_8 = _$_.first_child_frag(fragment_2);
192
+
193
+ IfWithSiblingsAndChildren(
194
+ node_8,
195
+ {
196
+ children(__anchor, _, __block) {
197
+ _$_.push_component();
198
+
199
+ var fragment_3 = root_10();
200
+ var node_9 = _$_.first_child_frag(fragment_3);
201
+
202
+ ChildItem(node_9, { text: "Item A" }, _$_.active_block);
203
+
204
+ var node_10 = _$_.sibling(node_9);
205
+
206
+ ChildItem(node_10, { text: "Item B" }, _$_.active_block);
207
+ _$_.append(__anchor, fragment_3);
208
+ _$_.pop_component();
209
+ }
210
+ },
211
+ _$_.active_block
212
+ );
213
+
214
+ _$_.append(__anchor, fragment_2);
215
+ _$_.pop_component();
216
+ }
217
+
218
+ export function ElementWithChildrenThenIf(__anchor, _, __block) {
219
+ _$_.push_component();
220
+
221
+ let show = track(true, void 0, void 0, __block);
222
+ var fragment_4 = root_11();
223
+ var div_11 = _$_.first_child_frag(fragment_4);
224
+
225
+ {
226
+ var div_10 = _$_.child(div_11);
227
+
228
+ _$_.pop(div_10);
229
+
230
+ var node_11 = _$_.sibling(div_10);
231
+
232
+ {
233
+ var consequent_3 = (__anchor) => {
234
+ var div_12 = root_12();
235
+
236
+ _$_.append(__anchor, div_12);
237
+ };
238
+
239
+ _$_.if(node_11, (__render) => {
240
+ if (_$_.get(show)) __render(consequent_3);
241
+ });
242
+ }
243
+
244
+ _$_.pop(div_11);
245
+ }
246
+
247
+ var button_1 = _$_.sibling(div_11);
248
+
249
+ button_1.__click = () => _$_.set(show, !_$_.get(show));
250
+ _$_.next();
251
+ _$_.append(__anchor, fragment_4, true);
252
+ _$_.pop_component();
253
+ }
254
+
255
+ export function DeepNestingThenIf(__anchor, _, __block) {
256
+ _$_.push_component();
257
+
258
+ let visible = track(true, void 0, void 0, __block);
259
+ var fragment_5 = root_13();
260
+ var section_2 = _$_.first_child_frag(fragment_5);
261
+
262
+ {
263
+ var article_1 = _$_.child(section_2);
264
+
265
+ _$_.pop(article_1);
266
+
267
+ var node_12 = _$_.sibling(article_1);
268
+
269
+ {
270
+ var consequent_4 = (__anchor) => {
271
+ var footer_1 = root_14();
272
+
273
+ _$_.append(__anchor, footer_1);
274
+ };
275
+
276
+ _$_.if(node_12, (__render) => {
277
+ if (_$_.get(visible)) __render(consequent_4);
278
+ });
279
+ }
280
+
281
+ _$_.pop(section_2);
282
+ }
283
+
284
+ var button_2 = _$_.sibling(section_2);
285
+
286
+ button_2.__click = () => _$_.set(visible, !_$_.get(visible));
287
+ _$_.next();
288
+ _$_.append(__anchor, fragment_5, true);
289
+ _$_.pop_component();
290
+ }
291
+
292
+ export function DomElementChildrenThenSibling(__anchor, _, __block) {
293
+ _$_.push_component();
294
+
295
+ let activeTab = track('code', void 0, void 0, __block);
296
+ var div_13 = root_15();
297
+
298
+ {
299
+ var div_14 = _$_.child(div_13);
300
+
301
+ {
302
+ var button_3 = _$_.child(div_14);
303
+
304
+ button_3.__click = () => _$_.set(activeTab, 'code');
305
+
306
+ var button_4 = _$_.sibling(button_3);
307
+
308
+ button_4.__click = () => _$_.set(activeTab, 'preview');
309
+ }
310
+
311
+ _$_.pop(div_14);
312
+
313
+ var div_15 = _$_.sibling(div_14);
314
+
315
+ {
316
+ var node_13 = _$_.child(div_15);
317
+
318
+ {
319
+ var consequent_5 = (__anchor) => {
320
+ var pre_1 = root_16();
321
+
322
+ _$_.append(__anchor, pre_1);
323
+ };
324
+
325
+ var alternate = (__anchor) => {
326
+ var div_16 = root_17();
327
+
328
+ _$_.append(__anchor, div_16);
329
+ };
330
+
331
+ _$_.if(node_13, (__render) => {
332
+ if (_$_.get(activeTab) === 'code') __render(consequent_5); else __render(alternate, false);
333
+ });
334
+ }
335
+
336
+ _$_.pop(div_15);
337
+ }
338
+ }
339
+
340
+ _$_.render(
341
+ (__prev) => {
342
+ var __a = _$_.get(activeTab) === 'code' ? 'true' : 'false';
343
+
344
+ if (__prev.a !== __a) {
345
+ _$_.set_attribute(button_3, 'aria-selected', __prev.a = __a);
346
+ }
347
+
348
+ var __b = _$_.get(activeTab) === 'preview' ? 'true' : 'false';
349
+
350
+ if (__prev.b !== __b) {
351
+ _$_.set_attribute(button_4, 'aria-selected', __prev.b = __b);
352
+ }
353
+ },
354
+ { a: void 0, b: void 0 }
355
+ );
356
+
357
+ _$_.append(__anchor, div_13);
358
+ _$_.pop_component();
359
+ }
360
+
361
+ export function DomChildrenThenStaticSiblings(__anchor, _, __block) {
362
+ _$_.push_component();
363
+
364
+ let count = track(0, void 0, void 0, __block);
365
+ var fragment_6 = root_18();
366
+ var div_17 = _$_.first_child_frag(fragment_6);
367
+
368
+ {
369
+ var ul_1 = _$_.child(div_17);
370
+
371
+ {
372
+ var li_1 = _$_.child(ul_1);
373
+
374
+ {
375
+ var text_2 = _$_.child(li_1, true);
376
+
377
+ _$_.pop(li_1);
378
+ }
379
+ }
380
+ }
381
+
382
+ _$_.pop(div_17);
383
+
384
+ var button_5 = _$_.sibling(div_17);
385
+
386
+ button_5.__click = () => _$_.update(count);
387
+ _$_.next();
388
+
389
+ _$_.render(() => {
390
+ _$_.set_text(text_2, 'Item count: ' + _$_.with_scope(__block, () => String(_$_.get(count))));
391
+ });
392
+
393
+ _$_.append(__anchor, fragment_6, true);
394
+ _$_.pop_component();
395
+ }
396
+
397
+ export function StaticListThenStaticSiblings(__anchor, _, __block) {
398
+ _$_.push_component();
399
+
400
+ var div_18 = root_19();
401
+
402
+ _$_.append(__anchor, div_18);
403
+ _$_.pop_component();
404
+ }
405
+
406
+ _$_.delegate(['click']);
@@ -141,6 +141,9 @@ export function NestedContentWithPortal(__anchor, _, __block) {
141
141
 
142
142
  {
143
143
  var div_9 = _$_.child(div_8);
144
+
145
+ _$_.pop(div_9);
146
+
144
147
  var node_4 = _$_.sibling(div_9);
145
148
 
146
149
  Portal(
@@ -469,5 +469,111 @@ export function WebsiteIndex(__output) {
469
469
  comp(...args);
470
470
  }
471
471
 
472
+ _$_.pop_component();
473
+ }
474
+
475
+ function LastChild(__output) {
476
+ _$_.push_component();
477
+ __output.push('<footer');
478
+ __output.push(' class="last-child"');
479
+ __output.push('>');
480
+
481
+ {
482
+ __output.push('I am the last child');
483
+ }
484
+
485
+ __output.push('</footer>');
486
+ _$_.pop_component();
487
+ }
488
+
489
+ export function ComponentAsLastSibling(__output) {
490
+ _$_.push_component();
491
+ __output.push('<div');
492
+ __output.push(' class="wrapper"');
493
+ __output.push('>');
494
+
495
+ {
496
+ __output.push('<h1');
497
+ __output.push('>');
498
+
499
+ {
500
+ __output.push('Header');
501
+ }
502
+
503
+ __output.push('</h1>');
504
+ __output.push('<p');
505
+ __output.push('>');
506
+
507
+ {
508
+ __output.push('Some content');
509
+ }
510
+
511
+ __output.push('</p>');
512
+
513
+ {
514
+ const comp = LastChild;
515
+ const args = [__output, {}];
516
+
517
+ comp(...args);
518
+ }
519
+ }
520
+
521
+ __output.push('</div>');
522
+ _$_.pop_component();
523
+ }
524
+
525
+ function InnerContent(__output) {
526
+ _$_.push_component();
527
+ __output.push('<div');
528
+ __output.push(' class="inner"');
529
+ __output.push('>');
530
+
531
+ {
532
+ __output.push('<span');
533
+ __output.push('>');
534
+
535
+ {
536
+ __output.push('Inner text');
537
+ }
538
+
539
+ __output.push('</span>');
540
+
541
+ {
542
+ const comp = LastChild;
543
+ const args = [__output, {}];
544
+
545
+ comp(...args);
546
+ }
547
+ }
548
+
549
+ __output.push('</div>');
550
+ _$_.pop_component();
551
+ }
552
+
553
+ export function NestedComponentAsLastSibling(__output) {
554
+ _$_.push_component();
555
+ __output.push('<section');
556
+ __output.push(' class="outer"');
557
+ __output.push('>');
558
+
559
+ {
560
+ __output.push('<h2');
561
+ __output.push('>');
562
+
563
+ {
564
+ __output.push('Section title');
565
+ }
566
+
567
+ __output.push('</h2>');
568
+
569
+ {
570
+ const comp = InnerContent;
571
+ const args = [__output, {}];
572
+
573
+ comp(...args);
574
+ }
575
+ }
576
+
577
+ __output.push('</section>');
472
578
  _$_.pop_component();
473
579
  }