ripple 0.3.61 → 0.3.63
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 +51 -0
- package/package.json +6 -13
- package/src/jsx-runtime.d.ts +10 -9
- package/src/runtime/internal/client/expression.js +98 -4
- package/src/runtime/internal/client/template.js +45 -0
- package/src/runtime/internal/server/index.js +21 -1
- package/tests/client/basic/basic.collections.test.tsrx +120 -0
- package/tests/client/compiler/compiler.basic.test.tsrx +82 -0
- package/tests/client/tsx.test.tsrx +102 -0
- package/tests/hydration/basic.test.js +127 -0
- package/tests/hydration/compiled/client/basic.js +591 -94
- package/tests/hydration/compiled/client/events.js +9 -9
- package/tests/hydration/compiled/client/for.js +31 -31
- package/tests/hydration/compiled/client/head.js +5 -5
- package/tests/hydration/compiled/client/html.js +8 -8
- package/tests/hydration/compiled/client/if-children.js +2 -2
- package/tests/hydration/compiled/client/mixed-control-flow.js +6 -6
- package/tests/hydration/compiled/client/nested-control-flow.js +23 -23
- package/tests/hydration/compiled/client/reactivity.js +7 -7
- package/tests/hydration/compiled/client/return.js +1 -1
- package/tests/hydration/compiled/client/track-async-serialization.js +12 -12
- package/tests/hydration/compiled/client/try.js +2 -2
- package/tests/hydration/compiled/server/basic.js +504 -2
- package/tests/hydration/components/basic.tsrx +187 -0
- package/tests/server/basic.test.tsrx +143 -0
- package/tests/server/compiler.test.tsrx +42 -0
|
@@ -283,6 +283,508 @@ export function ExpressionContent() {
|
|
|
283
283
|
_$_.pop_component();
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
function makeNestedTsxTsrxFragment(label) {
|
|
287
|
+
return _$_.tsrx_element(function render_children() {
|
|
288
|
+
_$_.output_push('<span');
|
|
289
|
+
_$_.output_push(' class="label"');
|
|
290
|
+
_$_.output_push('>');
|
|
291
|
+
|
|
292
|
+
{
|
|
293
|
+
_$_.output_push(_$_.escape(label));
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
_$_.output_push('</span>');
|
|
297
|
+
|
|
298
|
+
const test = _$_.tsrx_element(function render_children() {
|
|
299
|
+
_$_.render_expression([1, 2, 3, 4].map((item) => _$_.tsrx_element(function render_children() {
|
|
300
|
+
{
|
|
301
|
+
_$_.render_expression(_$_.tsrx_element(function render_children() {
|
|
302
|
+
_$_.output_push('<div');
|
|
303
|
+
_$_.output_push(' class="helper-item"');
|
|
304
|
+
_$_.output_push('>');
|
|
305
|
+
|
|
306
|
+
{
|
|
307
|
+
_$_.output_push(_$_.escape(item));
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
_$_.output_push('</div>');
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
313
|
+
})));
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
_$_.render_expression(test);
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export function NestedTsxTsrxExpressionValues() {
|
|
321
|
+
_$_.push_component();
|
|
322
|
+
|
|
323
|
+
_$_.regular_block(() => {
|
|
324
|
+
_$_.render_expression(_$_.tsrx_element(function render_children() {
|
|
325
|
+
_$_.render_expression([1, 2, 3].map((item) => _$_.tsrx_element(function render_children() {
|
|
326
|
+
_$_.output_push('<div');
|
|
327
|
+
_$_.output_push(' class="app-item"');
|
|
328
|
+
_$_.output_push('>');
|
|
329
|
+
|
|
330
|
+
{
|
|
331
|
+
_$_.output_push(_$_.escape(item));
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
_$_.output_push('</div>');
|
|
335
|
+
})));
|
|
336
|
+
}));
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
_$_.regular_block(() => {
|
|
340
|
+
_$_.render_expression(makeNestedTsxTsrxFragment('from helper'));
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
_$_.pop_component();
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export function MixedTsrxCollectionText() {
|
|
347
|
+
_$_.push_component();
|
|
348
|
+
|
|
349
|
+
const content = _$_.tsrx_element(function render_children() {
|
|
350
|
+
_$_.regular_block(() => {
|
|
351
|
+
_$_.render_expression([
|
|
352
|
+
'alpha ',
|
|
353
|
+
_$_.tsrx_element(function render_children() {
|
|
354
|
+
_$_.output_push('<strong');
|
|
355
|
+
_$_.output_push(' class="middle"');
|
|
356
|
+
_$_.output_push('>');
|
|
357
|
+
|
|
358
|
+
{
|
|
359
|
+
_$_.output_push('beta');
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
_$_.output_push('</strong>');
|
|
363
|
+
}),
|
|
364
|
+
' gamma ',
|
|
365
|
+
[
|
|
366
|
+
'delta ',
|
|
367
|
+
_$_.tsrx_element(function render_children() {
|
|
368
|
+
_$_.output_push('<em');
|
|
369
|
+
_$_.output_push(' class="tail"');
|
|
370
|
+
_$_.output_push('>');
|
|
371
|
+
|
|
372
|
+
{
|
|
373
|
+
_$_.output_push('epsilon');
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
_$_.output_push('</em>');
|
|
377
|
+
}),
|
|
378
|
+
' zeta'
|
|
379
|
+
]
|
|
380
|
+
]);
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
_$_.regular_block(() => {
|
|
385
|
+
_$_.output_push('<div');
|
|
386
|
+
_$_.output_push(' class="mixed-collection"');
|
|
387
|
+
_$_.output_push('>');
|
|
388
|
+
|
|
389
|
+
{
|
|
390
|
+
_$_.render_expression(content);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
_$_.output_push('</div>');
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
_$_.pop_component();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export function MixedTsrxCollectionSplitServerText() {
|
|
400
|
+
_$_.push_component();
|
|
401
|
+
|
|
402
|
+
const content = _$_.tsrx_element(function render_children() {
|
|
403
|
+
_$_.regular_block(() => {
|
|
404
|
+
_$_.render_expression([
|
|
405
|
+
'alpha ',
|
|
406
|
+
_$_.tsrx_element(function render_children() {
|
|
407
|
+
_$_.output_push('<strong');
|
|
408
|
+
_$_.output_push(' class="middle"');
|
|
409
|
+
_$_.output_push('>');
|
|
410
|
+
|
|
411
|
+
{
|
|
412
|
+
_$_.output_push('beta');
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
_$_.output_push('</strong>');
|
|
416
|
+
}),
|
|
417
|
+
' gamma ',
|
|
418
|
+
[
|
|
419
|
+
'delta ',
|
|
420
|
+
_$_.tsrx_element(function render_children() {
|
|
421
|
+
_$_.output_push('<em');
|
|
422
|
+
_$_.output_push(' class="tail"');
|
|
423
|
+
_$_.output_push('>');
|
|
424
|
+
|
|
425
|
+
{
|
|
426
|
+
_$_.output_push('epsilon');
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
_$_.output_push('</em>');
|
|
430
|
+
}),
|
|
431
|
+
' zeta'
|
|
432
|
+
]
|
|
433
|
+
]);
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
_$_.regular_block(() => {
|
|
438
|
+
_$_.output_push('<div');
|
|
439
|
+
_$_.output_push(' class="mixed-collection-split"');
|
|
440
|
+
_$_.output_push('>');
|
|
441
|
+
|
|
442
|
+
{
|
|
443
|
+
_$_.render_expression(content);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
_$_.output_push('</div>');
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
_$_.pop_component();
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export function MixedTsrxCollectionSplitClientText() {
|
|
453
|
+
_$_.push_component();
|
|
454
|
+
|
|
455
|
+
const content = _$_.tsrx_element(function render_children() {
|
|
456
|
+
_$_.regular_block(() => {
|
|
457
|
+
_$_.render_expression([
|
|
458
|
+
'alpha ',
|
|
459
|
+
_$_.tsrx_element(function render_children() {
|
|
460
|
+
_$_.output_push('<strong');
|
|
461
|
+
_$_.output_push(' class="middle"');
|
|
462
|
+
_$_.output_push('>');
|
|
463
|
+
|
|
464
|
+
{
|
|
465
|
+
_$_.output_push('beta');
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
_$_.output_push('</strong>');
|
|
469
|
+
}),
|
|
470
|
+
' gamma ',
|
|
471
|
+
[
|
|
472
|
+
'changed ',
|
|
473
|
+
_$_.tsrx_element(function render_children() {
|
|
474
|
+
_$_.output_push('<em');
|
|
475
|
+
_$_.output_push(' class="tail"');
|
|
476
|
+
_$_.output_push('>');
|
|
477
|
+
|
|
478
|
+
{
|
|
479
|
+
_$_.output_push('epsilon');
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
_$_.output_push('</em>');
|
|
483
|
+
}),
|
|
484
|
+
' zeta'
|
|
485
|
+
]
|
|
486
|
+
]);
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
_$_.regular_block(() => {
|
|
491
|
+
_$_.output_push('<div');
|
|
492
|
+
_$_.output_push(' class="mixed-collection-split"');
|
|
493
|
+
_$_.output_push('>');
|
|
494
|
+
|
|
495
|
+
{
|
|
496
|
+
_$_.render_expression(content);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
_$_.output_push('</div>');
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
_$_.pop_component();
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export function MixedTsrxCollectionPrimitiveServerText() {
|
|
506
|
+
_$_.push_component();
|
|
507
|
+
|
|
508
|
+
const content = _$_.tsrx_element(function render_children() {
|
|
509
|
+
_$_.regular_block(() => {
|
|
510
|
+
_$_.render_expression([
|
|
511
|
+
'count: ',
|
|
512
|
+
1,
|
|
513
|
+
' / ',
|
|
514
|
+
true,
|
|
515
|
+
_$_.tsrx_element(function render_children() {
|
|
516
|
+
_$_.output_push('<span');
|
|
517
|
+
_$_.output_push(' class="primitive-tail"');
|
|
518
|
+
_$_.output_push('>');
|
|
519
|
+
|
|
520
|
+
{
|
|
521
|
+
_$_.output_push(' ok');
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
_$_.output_push('</span>');
|
|
525
|
+
})
|
|
526
|
+
]);
|
|
527
|
+
});
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
_$_.regular_block(() => {
|
|
531
|
+
_$_.output_push('<div');
|
|
532
|
+
_$_.output_push(' class="mixed-collection-primitive"');
|
|
533
|
+
_$_.output_push('>');
|
|
534
|
+
|
|
535
|
+
{
|
|
536
|
+
_$_.render_expression(content);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
_$_.output_push('</div>');
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
_$_.pop_component();
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export function MixedTsrxCollectionPrimitiveClientText() {
|
|
546
|
+
_$_.push_component();
|
|
547
|
+
|
|
548
|
+
const content = _$_.tsrx_element(function render_children() {
|
|
549
|
+
_$_.regular_block(() => {
|
|
550
|
+
_$_.render_expression([
|
|
551
|
+
'count: ',
|
|
552
|
+
2,
|
|
553
|
+
' / ',
|
|
554
|
+
false,
|
|
555
|
+
_$_.tsrx_element(function render_children() {
|
|
556
|
+
_$_.output_push('<span');
|
|
557
|
+
_$_.output_push(' class="primitive-tail"');
|
|
558
|
+
_$_.output_push('>');
|
|
559
|
+
|
|
560
|
+
{
|
|
561
|
+
_$_.output_push(' ok');
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
_$_.output_push('</span>');
|
|
565
|
+
})
|
|
566
|
+
]);
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
_$_.regular_block(() => {
|
|
571
|
+
_$_.output_push('<div');
|
|
572
|
+
_$_.output_push(' class="mixed-collection-primitive"');
|
|
573
|
+
_$_.output_push('>');
|
|
574
|
+
|
|
575
|
+
{
|
|
576
|
+
_$_.render_expression(content);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
_$_.output_push('</div>');
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
_$_.pop_component();
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function createPrimitiveItems() {
|
|
586
|
+
return ['start:', ['one', 2], true, null, false, ':end'];
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
export function DynamicArrayFromCall() {
|
|
590
|
+
_$_.push_component();
|
|
591
|
+
|
|
592
|
+
const items = createPrimitiveItems();
|
|
593
|
+
|
|
594
|
+
_$_.regular_block(() => {
|
|
595
|
+
_$_.output_push('<div');
|
|
596
|
+
_$_.output_push(' class="dynamic-array-call"');
|
|
597
|
+
_$_.output_push('>');
|
|
598
|
+
|
|
599
|
+
{
|
|
600
|
+
_$_.render_expression(items);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
_$_.output_push('</div>');
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
_$_.pop_component();
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export function DynamicArrayFromTrack() {
|
|
610
|
+
_$_.push_component();
|
|
611
|
+
|
|
612
|
+
let lazy = _$_.track(['start:', ['one', 2], true, null, false, ':end'], 'b5de6402');
|
|
613
|
+
|
|
614
|
+
_$_.regular_block(() => {
|
|
615
|
+
_$_.output_push('<div');
|
|
616
|
+
_$_.output_push(' class="dynamic-array-track"');
|
|
617
|
+
_$_.output_push('>');
|
|
618
|
+
|
|
619
|
+
{
|
|
620
|
+
_$_.render_expression(_$_.get(lazy));
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
_$_.output_push('</div>');
|
|
624
|
+
});
|
|
625
|
+
|
|
626
|
+
_$_.pop_component();
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export function DynamicArrayFromConditional() {
|
|
630
|
+
_$_.push_component();
|
|
631
|
+
|
|
632
|
+
const condition = true;
|
|
633
|
+
|
|
634
|
+
const items = condition
|
|
635
|
+
? ['start:', ['one', 2], true, null, false, ':end']
|
|
636
|
+
: ['fallback'];
|
|
637
|
+
|
|
638
|
+
_$_.regular_block(() => {
|
|
639
|
+
_$_.output_push('<div');
|
|
640
|
+
_$_.output_push(' class="dynamic-array-conditional"');
|
|
641
|
+
_$_.output_push('>');
|
|
642
|
+
|
|
643
|
+
{
|
|
644
|
+
_$_.render_expression(items);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
_$_.output_push('</div>');
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
_$_.pop_component();
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export function DynamicArrayFromLogical() {
|
|
654
|
+
_$_.push_component();
|
|
655
|
+
|
|
656
|
+
const condition = true;
|
|
657
|
+
const items = condition && ['start:', ['one', 2], true, null, false, ':end'];
|
|
658
|
+
|
|
659
|
+
_$_.regular_block(() => {
|
|
660
|
+
_$_.output_push('<div');
|
|
661
|
+
_$_.output_push(' class="dynamic-array-logical"');
|
|
662
|
+
_$_.output_push('>');
|
|
663
|
+
|
|
664
|
+
{
|
|
665
|
+
_$_.render_expression(items);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
_$_.output_push('</div>');
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
_$_.pop_component();
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
export function NestedTsrxInsideTopLevelTsxExpression() {
|
|
675
|
+
_$_.push_component();
|
|
676
|
+
|
|
677
|
+
const content = _$_.tsrx_element(function render_children() {
|
|
678
|
+
_$_.regular_block(() => {
|
|
679
|
+
_$_.output_push('<section');
|
|
680
|
+
_$_.output_push(' class="outer"');
|
|
681
|
+
_$_.output_push('>');
|
|
682
|
+
|
|
683
|
+
{
|
|
684
|
+
_$_.render_expression(_$_.tsrx_element(function render_children() {
|
|
685
|
+
_$_.output_push('<div');
|
|
686
|
+
_$_.output_push(' class="inner"');
|
|
687
|
+
_$_.output_push('>');
|
|
688
|
+
|
|
689
|
+
{
|
|
690
|
+
_$_.output_push('from tsrx');
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
_$_.output_push('</div>');
|
|
694
|
+
}));
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
_$_.output_push('</section>');
|
|
698
|
+
});
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
_$_.regular_block(() => {
|
|
702
|
+
_$_.render_expression(content);
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
_$_.pop_component();
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
export function NestedTsrxElementsInsideTopLevelTsxValue() {
|
|
709
|
+
_$_.push_component();
|
|
710
|
+
|
|
711
|
+
const content = _$_.tsrx_element(function render_children() {
|
|
712
|
+
_$_.regular_block(() => {
|
|
713
|
+
_$_.output_push('<div');
|
|
714
|
+
_$_.output_push(' class="wrapper"');
|
|
715
|
+
_$_.output_push('>');
|
|
716
|
+
|
|
717
|
+
{
|
|
718
|
+
_$_.render_expression(_$_.tsrx_element(function render_children() {
|
|
719
|
+
_$_.output_push('<section');
|
|
720
|
+
_$_.output_push(' class="native"');
|
|
721
|
+
_$_.output_push('>');
|
|
722
|
+
|
|
723
|
+
{
|
|
724
|
+
_$_.output_push('<span');
|
|
725
|
+
_$_.output_push(' class="nested-tsrx"');
|
|
726
|
+
_$_.output_push('>');
|
|
727
|
+
|
|
728
|
+
{
|
|
729
|
+
_$_.output_push('inside nested tsrx');
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
_$_.output_push('</span>');
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
_$_.output_push('</section>');
|
|
736
|
+
}));
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
_$_.output_push('</div>');
|
|
740
|
+
});
|
|
741
|
+
});
|
|
742
|
+
|
|
743
|
+
_$_.regular_block(() => {
|
|
744
|
+
_$_.render_expression(content);
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
_$_.pop_component();
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
export function TsxDeclaredInsideNestedTsrxFromTopLevelTsx() {
|
|
751
|
+
_$_.push_component();
|
|
752
|
+
|
|
753
|
+
const content = _$_.tsrx_element(function render_children() {
|
|
754
|
+
_$_.regular_block(() => {
|
|
755
|
+
_$_.render_expression(_$_.tsrx_element(function render_children() {
|
|
756
|
+
const nested = _$_.tsrx_element(function render_children() {
|
|
757
|
+
_$_.output_push('<span');
|
|
758
|
+
_$_.output_push(' class="nested-tsx"');
|
|
759
|
+
_$_.output_push('>');
|
|
760
|
+
|
|
761
|
+
{
|
|
762
|
+
_$_.output_push('inside nested tsx');
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
_$_.output_push('</span>');
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
_$_.output_push('<div');
|
|
769
|
+
_$_.output_push(' class="native"');
|
|
770
|
+
_$_.output_push('>');
|
|
771
|
+
|
|
772
|
+
{
|
|
773
|
+
_$_.render_expression(nested);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
_$_.output_push('</div>');
|
|
777
|
+
}));
|
|
778
|
+
});
|
|
779
|
+
});
|
|
780
|
+
|
|
781
|
+
_$_.regular_block(() => {
|
|
782
|
+
_$_.render_expression(content);
|
|
783
|
+
});
|
|
784
|
+
|
|
785
|
+
_$_.pop_component();
|
|
786
|
+
}
|
|
787
|
+
|
|
286
788
|
function TextProp(__props) {
|
|
287
789
|
_$_.push_component();
|
|
288
790
|
|
|
@@ -304,7 +806,7 @@ function TextProp(__props) {
|
|
|
304
806
|
export function TextPropWithToggle() {
|
|
305
807
|
_$_.push_component();
|
|
306
808
|
|
|
307
|
-
let
|
|
809
|
+
let lazy_1 = _$_.track(false, '1ba81c3b');
|
|
308
810
|
|
|
309
811
|
_$_.regular_block(() => {
|
|
310
812
|
{
|
|
@@ -312,7 +814,7 @@ export function TextPropWithToggle() {
|
|
|
312
814
|
|
|
313
815
|
const args = [
|
|
314
816
|
{
|
|
315
|
-
children: _$_.normalize_children(_$_.get(
|
|
817
|
+
children: _$_.normalize_children(_$_.get(lazy_1) ? 'hello' : '')
|
|
316
818
|
}
|
|
317
819
|
];
|
|
318
820
|
|
|
@@ -66,6 +66,193 @@ export component ExpressionContent() {
|
|
|
66
66
|
<span>{label.toUpperCase()}</span>
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
function makeNestedTsxTsrxFragment(label: string) {
|
|
70
|
+
return <tsrx>
|
|
71
|
+
<span class="label">{label}</span>
|
|
72
|
+
const test = <tsx>
|
|
73
|
+
{[1, 2, 3, 4].map(
|
|
74
|
+
(item) => <tsx>
|
|
75
|
+
{<tsrx>
|
|
76
|
+
<div class="helper-item">{item}</div>
|
|
77
|
+
</tsrx>}
|
|
78
|
+
</tsx>,
|
|
79
|
+
)}
|
|
80
|
+
</tsx>;
|
|
81
|
+
{test}
|
|
82
|
+
</tsrx>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export component NestedTsxTsrxExpressionValues() {
|
|
86
|
+
{<tsx>{[1, 2, 3].map((item) => <div class="app-item">{item}</div>)}</tsx>}
|
|
87
|
+
{makeNestedTsxTsrxFragment('from helper')}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export component MixedTsrxCollectionText() {
|
|
91
|
+
const content = <tsx>
|
|
92
|
+
{[
|
|
93
|
+
'alpha ',
|
|
94
|
+
<strong class="middle">
|
|
95
|
+
{'beta'}
|
|
96
|
+
</strong>,
|
|
97
|
+
' gamma ',
|
|
98
|
+
[
|
|
99
|
+
'delta ',
|
|
100
|
+
<em class="tail">
|
|
101
|
+
{'epsilon'}
|
|
102
|
+
</em>,
|
|
103
|
+
' zeta',
|
|
104
|
+
],
|
|
105
|
+
]}
|
|
106
|
+
</tsx>;
|
|
107
|
+
|
|
108
|
+
<div class="mixed-collection">{content}</div>
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export component MixedTsrxCollectionSplitServerText() {
|
|
112
|
+
const content = <tsx>
|
|
113
|
+
{[
|
|
114
|
+
'alpha ',
|
|
115
|
+
<strong class="middle">
|
|
116
|
+
{'beta'}
|
|
117
|
+
</strong>,
|
|
118
|
+
' gamma ',
|
|
119
|
+
[
|
|
120
|
+
'delta ',
|
|
121
|
+
<em class="tail">
|
|
122
|
+
{'epsilon'}
|
|
123
|
+
</em>,
|
|
124
|
+
' zeta',
|
|
125
|
+
],
|
|
126
|
+
]}
|
|
127
|
+
</tsx>;
|
|
128
|
+
|
|
129
|
+
<div class="mixed-collection-split">{content}</div>
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export component MixedTsrxCollectionSplitClientText() {
|
|
133
|
+
const content = <tsx>
|
|
134
|
+
{[
|
|
135
|
+
'alpha ',
|
|
136
|
+
<strong class="middle">
|
|
137
|
+
{'beta'}
|
|
138
|
+
</strong>,
|
|
139
|
+
' gamma ',
|
|
140
|
+
[
|
|
141
|
+
'changed ',
|
|
142
|
+
<em class="tail">
|
|
143
|
+
{'epsilon'}
|
|
144
|
+
</em>,
|
|
145
|
+
' zeta',
|
|
146
|
+
],
|
|
147
|
+
]}
|
|
148
|
+
</tsx>;
|
|
149
|
+
|
|
150
|
+
<div class="mixed-collection-split">{content}</div>
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export component MixedTsrxCollectionPrimitiveServerText() {
|
|
154
|
+
const content = <tsx>
|
|
155
|
+
{[
|
|
156
|
+
'count: ',
|
|
157
|
+
1,
|
|
158
|
+
' / ',
|
|
159
|
+
true,
|
|
160
|
+
<span class="primitive-tail">
|
|
161
|
+
{' ok'}
|
|
162
|
+
</span>,
|
|
163
|
+
]}
|
|
164
|
+
</tsx>;
|
|
165
|
+
|
|
166
|
+
<div class="mixed-collection-primitive">{content}</div>
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export component MixedTsrxCollectionPrimitiveClientText() {
|
|
170
|
+
const content = <tsx>
|
|
171
|
+
{[
|
|
172
|
+
'count: ',
|
|
173
|
+
2,
|
|
174
|
+
' / ',
|
|
175
|
+
false,
|
|
176
|
+
<span class="primitive-tail">
|
|
177
|
+
{' ok'}
|
|
178
|
+
</span>,
|
|
179
|
+
]}
|
|
180
|
+
</tsx>;
|
|
181
|
+
|
|
182
|
+
<div class="mixed-collection-primitive">{content}</div>
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function createPrimitiveItems() {
|
|
186
|
+
return ['start:', ['one', 2], true, null, false, ':end'];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export component DynamicArrayFromCall() {
|
|
190
|
+
const items = createPrimitiveItems();
|
|
191
|
+
|
|
192
|
+
<div class="dynamic-array-call">{items}</div>
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export component DynamicArrayFromTrack() {
|
|
196
|
+
let &[items] = track(['start:', ['one', 2], true, null, false, ':end']);
|
|
197
|
+
|
|
198
|
+
<div class="dynamic-array-track">{items}</div>
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export component DynamicArrayFromConditional() {
|
|
202
|
+
const condition = true;
|
|
203
|
+
const items = condition ? ['start:', ['one', 2], true, null, false, ':end'] : ['fallback'];
|
|
204
|
+
|
|
205
|
+
<div class="dynamic-array-conditional">{items}</div>
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export component DynamicArrayFromLogical() {
|
|
209
|
+
const condition = true;
|
|
210
|
+
const items = condition && ['start:', ['one', 2], true, null, false, ':end'];
|
|
211
|
+
|
|
212
|
+
<div class="dynamic-array-logical">{items}</div>
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export component NestedTsrxInsideTopLevelTsxExpression() {
|
|
216
|
+
const content = <tsx>
|
|
217
|
+
<section class="outer">
|
|
218
|
+
{<tsrx>
|
|
219
|
+
<div class="inner">{'from tsrx'}</div>
|
|
220
|
+
</tsrx>}
|
|
221
|
+
</section>
|
|
222
|
+
</tsx>;
|
|
223
|
+
|
|
224
|
+
{content}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export component NestedTsrxElementsInsideTopLevelTsxValue() {
|
|
228
|
+
const content = <tsx>
|
|
229
|
+
<div class="wrapper">
|
|
230
|
+
{<tsrx>
|
|
231
|
+
<section class="native">
|
|
232
|
+
<span class="nested-tsrx">{'inside nested tsrx'}</span>
|
|
233
|
+
</section>
|
|
234
|
+
</tsrx>}
|
|
235
|
+
</div>
|
|
236
|
+
</tsx>;
|
|
237
|
+
|
|
238
|
+
{content}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export component TsxDeclaredInsideNestedTsrxFromTopLevelTsx() {
|
|
242
|
+
const content = <tsx>
|
|
243
|
+
{<tsrx>
|
|
244
|
+
const nested = <tsx>
|
|
245
|
+
<span class="nested-tsx">
|
|
246
|
+
{'inside nested tsx'}
|
|
247
|
+
</span>
|
|
248
|
+
</tsx>;
|
|
249
|
+
<div class="native">{nested}</div>
|
|
250
|
+
</tsrx>}
|
|
251
|
+
</tsx>;
|
|
252
|
+
|
|
253
|
+
{content}
|
|
254
|
+
}
|
|
255
|
+
|
|
69
256
|
component TextProp(&{ children }: { children: string }) {
|
|
70
257
|
<div class="text-prop">{children}</div>
|
|
71
258
|
}
|