@solidtv/solid 1.5.0 → 1.5.1
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/README.md +6 -1
- package/dist/src/core/dom-renderer/domRenderer.js +15 -5
- package/dist/src/core/dom-renderer/domRenderer.js.map +1 -1
- package/dist/src/core/dom-renderer/domRendererUtils.js +0 -2
- package/dist/src/core/dom-renderer/domRendererUtils.js.map +1 -1
- package/dist/src/core/elementNode.d.ts +50 -50
- package/dist/src/core/elementNode.js +3 -3
- package/dist/src/core/elementNode.js.map +1 -1
- package/dist/src/primitives/KeepAlive.d.ts +1 -0
- package/dist/src/primitives/KeepAlive.jsx +9 -2
- package/dist/src/primitives/KeepAlive.jsx.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core/dom-renderer/domRenderer.ts +14 -5
- package/src/core/dom-renderer/domRendererUtils.ts +0 -1
- package/src/core/elementNode.ts +51 -51
- package/src/primitives/KeepAlive.tsx +14 -3
package/package.json
CHANGED
|
@@ -800,10 +800,14 @@ function updateNodeStyles(node: DOMNode | DOMText) {
|
|
|
800
800
|
let bgLayerStyle =
|
|
801
801
|
'position: absolute; top:0; left:0; right:0; bottom:0; z-index: -1; pointer-events: none;';
|
|
802
802
|
// overflow:hidden clips the transformed imgEl to prevent sprite bleed-through
|
|
803
|
-
// for non-tinted subtextures
|
|
804
|
-
//
|
|
803
|
+
// for non-tinted subtextures, and to enforce borderRadius clipping on the
|
|
804
|
+
// <img> itself: older WebKit engines (e.g. PS4) don't clip a replaced
|
|
805
|
+
// element's (img) own content via border-radius, only its background/border,
|
|
806
|
+
// so relying on radiusStyle alone leaves the image square on that platform.
|
|
807
|
+
// NOT applied when hasDivBgTint because overflow:hidden + CSS mask-image
|
|
808
|
+
// causes a 1px white border artifact on WebKit.
|
|
805
809
|
// Tinted nodes use mask-image for visual clipping, so overflow:hidden is unnecessary.
|
|
806
|
-
if (srcPos !== null && !hasDivBgTint) {
|
|
810
|
+
if ((srcPos !== null || radiusStyle !== '') && !hasDivBgTint) {
|
|
807
811
|
bgLayerStyle += 'overflow: hidden;';
|
|
808
812
|
}
|
|
809
813
|
if (bgStyle) {
|
|
@@ -822,7 +826,6 @@ function updateNodeStyles(node: DOMNode | DOMText) {
|
|
|
822
826
|
if (!node.imgEl) {
|
|
823
827
|
node.imgEl = document.createElement('img');
|
|
824
828
|
node.imgEl.alt = '';
|
|
825
|
-
node.imgEl.crossOrigin = 'anonymous';
|
|
826
829
|
node.imgEl.setAttribute('aria-hidden', 'true');
|
|
827
830
|
node.imgEl.setAttribute('loading', 'lazy');
|
|
828
831
|
node.imgEl.removeAttribute('src');
|
|
@@ -944,7 +947,6 @@ function updateNodeStyles(node: DOMNode | DOMText) {
|
|
|
944
947
|
if (!node.imgEl) {
|
|
945
948
|
node.imgEl = document.createElement('img');
|
|
946
949
|
node.imgEl.alt = '';
|
|
947
|
-
node.imgEl.crossOrigin = 'anonymous';
|
|
948
950
|
node.imgEl.setAttribute('aria-hidden', 'true');
|
|
949
951
|
node.imgEl.setAttribute('loading', 'lazy');
|
|
950
952
|
node.imgEl.removeAttribute('src');
|
|
@@ -1472,6 +1474,13 @@ export class DOMNode extends EventEmitter implements IRendererNode {
|
|
|
1472
1474
|
this.hideMaskedBackgroundLayer();
|
|
1473
1475
|
this.imgEl.style.display = '';
|
|
1474
1476
|
this.imgEl.dataset.pendingSrc = pendingSrc;
|
|
1477
|
+
// crossOrigin + data: URI fails to load on old WebKit engines (e.g. PS4 WebMAF) —
|
|
1478
|
+
// only request CORS for real network sources, never for inlined base64 images.
|
|
1479
|
+
if (pendingSrc.startsWith('data:')) {
|
|
1480
|
+
this.imgEl.removeAttribute('crossorigin');
|
|
1481
|
+
} else {
|
|
1482
|
+
this.imgEl.crossOrigin = 'anonymous';
|
|
1483
|
+
}
|
|
1475
1484
|
this.imgEl.src = pendingSrc;
|
|
1476
1485
|
this.imgEl.dataset.rawSrc = pendingSrc;
|
|
1477
1486
|
this.imgEl.dataset.pendingSrc = '';
|
|
@@ -120,7 +120,6 @@ export function applySubTextureScaling(
|
|
|
120
120
|
if (!regionW || !regionH) return;
|
|
121
121
|
const targetW = node.props.w || regionW;
|
|
122
122
|
const targetH = node.props.h || regionH;
|
|
123
|
-
if (targetW === regionW && targetH === regionH) return;
|
|
124
123
|
const naturalW = img.naturalWidth || regionW;
|
|
125
124
|
const naturalH = img.naturalHeight || regionH;
|
|
126
125
|
const scaleX = targetW / regionW;
|
package/src/core/elementNode.ts
CHANGED
|
@@ -362,7 +362,7 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
362
362
|
* The distance from the bottom edge of the parent element.
|
|
363
363
|
* When `bottom` is set, `mountY` is automatically set to 1.
|
|
364
364
|
*
|
|
365
|
-
* @see https://
|
|
365
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
366
366
|
*/
|
|
367
367
|
bottom?: number;
|
|
368
368
|
/**
|
|
@@ -376,13 +376,13 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
376
376
|
/**
|
|
377
377
|
* Specifies how much a flex item should grow relative to the rest of the flex items.
|
|
378
378
|
*
|
|
379
|
-
* @see https://
|
|
379
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=flex-grow
|
|
380
380
|
*/
|
|
381
381
|
flexGrow?: number;
|
|
382
382
|
/**
|
|
383
383
|
* Specifies whether flex items are forced onto one line or can wrap onto multiple lines.
|
|
384
384
|
*
|
|
385
|
-
* @see https://
|
|
385
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=flex
|
|
386
386
|
*/
|
|
387
387
|
flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
388
388
|
/**
|
|
@@ -393,7 +393,7 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
393
393
|
/**
|
|
394
394
|
* Specifies the order of a flex item relative to the rest of the flex items.
|
|
395
395
|
*
|
|
396
|
-
* @see https://
|
|
396
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=flex
|
|
397
397
|
*/
|
|
398
398
|
flexOrder?: number;
|
|
399
399
|
/**
|
|
@@ -410,13 +410,13 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
410
410
|
/**
|
|
411
411
|
* Forwards focus to a child element. It can be a numeric index of the child or a handler function.
|
|
412
412
|
*
|
|
413
|
-
* @see https://
|
|
413
|
+
* @see https://solid-tv.github.io/solid/#/essentials/focus?id=forwardfocus
|
|
414
414
|
*/
|
|
415
415
|
forwardFocus?: number | ForwardFocusHandler;
|
|
416
416
|
/**
|
|
417
417
|
* If `true`, the states of this node will be propagated to its children.
|
|
418
418
|
*
|
|
419
|
-
* @see https://
|
|
419
|
+
* @see https://solid-tv.github.io/solid/#/essentials/states?id=forwardstates
|
|
420
420
|
*/
|
|
421
421
|
forwardStates?: boolean;
|
|
422
422
|
/**
|
|
@@ -443,7 +443,7 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
443
443
|
* The distance from the right edge of the parent element.
|
|
444
444
|
* When `right` is set, `mountX` is automatically set to 1.
|
|
445
445
|
*
|
|
446
|
-
* @see https://
|
|
446
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=layout-and-positioning-elements
|
|
447
447
|
*/
|
|
448
448
|
right?: number;
|
|
449
449
|
/**
|
|
@@ -465,115 +465,115 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
465
465
|
/**
|
|
466
466
|
* Aligns flex items along the cross axis of the current line of the flex container.
|
|
467
467
|
*
|
|
468
|
-
* @see https://
|
|
468
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=flex-properties
|
|
469
469
|
*/
|
|
470
470
|
alignItems?: 'flexStart' | 'flexEnd' | 'center';
|
|
471
471
|
/**
|
|
472
472
|
* Aligns a flex item along the cross axis, overriding the `alignItems` value of the flex container.
|
|
473
473
|
*
|
|
474
|
-
* @see https://
|
|
474
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=flex-properties
|
|
475
475
|
*/
|
|
476
476
|
alignSelf?: 'flexStart' | 'flexEnd' | 'center';
|
|
477
477
|
/**
|
|
478
478
|
* The border style for all sides of the element. Takes an object with width and color properties.
|
|
479
479
|
*
|
|
480
|
-
* @see https://
|
|
480
|
+
* @see https://solid-tv.github.io/solid/#/essentials/effects?id=border-and-borderradius
|
|
481
481
|
*/
|
|
482
482
|
border?: BorderStyle;
|
|
483
483
|
/**
|
|
484
484
|
* The border style for the bottom side of the element.
|
|
485
485
|
*
|
|
486
|
-
* @see https://
|
|
486
|
+
* @see https://solid-tv.github.io/solid/#/essentials/effects?id=border-and-borderradius
|
|
487
487
|
*/
|
|
488
488
|
borderBottom?: SingleBorderStyle;
|
|
489
489
|
/**
|
|
490
490
|
* The border style for the left side of the element.
|
|
491
491
|
*
|
|
492
|
-
* @see https://
|
|
492
|
+
* @see https://solid-tv.github.io/solid/#/essentials/effects?id=border-and-borderradius
|
|
493
493
|
*/
|
|
494
494
|
borderLeft?: SingleBorderStyle;
|
|
495
495
|
/**
|
|
496
496
|
* The radius of the element's corners.
|
|
497
497
|
*
|
|
498
|
-
* @see https://
|
|
498
|
+
* @see https://solid-tv.github.io/solid/#/essentials/effects?id=border-and-borderradius
|
|
499
499
|
*/
|
|
500
500
|
borderRadius?: BorderRadius;
|
|
501
501
|
/**
|
|
502
502
|
* The border style for the right side of the element.
|
|
503
503
|
*
|
|
504
|
-
* @see https://
|
|
504
|
+
* @see https://solid-tv.github.io/solid/#/essentials/effects?id=border-and-borderradius
|
|
505
505
|
*/
|
|
506
506
|
borderRight?: SingleBorderStyle;
|
|
507
507
|
/**
|
|
508
508
|
* The border style for the top side of the element.
|
|
509
509
|
*
|
|
510
|
-
* @see https://
|
|
510
|
+
* @see https://solid-tv.github.io/solid/#/essentials/effects?id=border-and-borderradius
|
|
511
511
|
*/
|
|
512
512
|
borderTop?: SingleBorderStyle;
|
|
513
513
|
/**
|
|
514
514
|
* A shorthand to set both `centerX` and `centerY` to true.
|
|
515
515
|
*
|
|
516
|
-
* @see https://
|
|
516
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=layout-and-positioning-elements
|
|
517
517
|
*/
|
|
518
518
|
center?: boolean;
|
|
519
519
|
/**
|
|
520
520
|
* If `true`, centers the element horizontally within its parent.
|
|
521
521
|
*
|
|
522
|
-
* @see https://
|
|
522
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=layout-and-positioning-elements
|
|
523
523
|
*/
|
|
524
524
|
centerX?: boolean;
|
|
525
525
|
/**
|
|
526
526
|
* If `true`, centers the element vertically within its parent.
|
|
527
527
|
*
|
|
528
|
-
* @see https://
|
|
528
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=layout-and-positioning-elements
|
|
529
529
|
*/
|
|
530
530
|
centerY?: boolean;
|
|
531
531
|
/**
|
|
532
532
|
* Specifies the direction of the flex items.
|
|
533
533
|
*
|
|
534
|
-
* @see https://
|
|
534
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=flex
|
|
535
535
|
*/
|
|
536
536
|
direction?: 'ltr' | 'rtl';
|
|
537
537
|
/**
|
|
538
538
|
* Defines how the flex container's size is determined. 'contain' allows it to grow with its content, 'fixed' keeps it at its specified size.
|
|
539
539
|
*
|
|
540
|
-
* @see https://
|
|
540
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=flex
|
|
541
541
|
*/
|
|
542
542
|
flexBoundary?: 'contain' | 'fixed';
|
|
543
543
|
/**
|
|
544
544
|
* Defines how the flex container's cross-axis size is determined. 'fixed' keeps it at its specified size. Default is 'contain'.
|
|
545
545
|
*
|
|
546
|
-
* @see https://
|
|
546
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=flex
|
|
547
547
|
*/
|
|
548
548
|
flexCrossBoundary?: 'fixed'; // default is contain
|
|
549
549
|
/**
|
|
550
550
|
* Specifies the direction of the main axis for flex items.
|
|
551
551
|
*
|
|
552
|
-
* @see https://
|
|
552
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=flex
|
|
553
553
|
*/
|
|
554
554
|
flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
555
555
|
/**
|
|
556
556
|
* The gap between flex items.
|
|
557
557
|
*
|
|
558
|
-
* @see @see https://
|
|
558
|
+
* @see @see https://solid-tv.github.io/solid/#/flow/layout?id=flex
|
|
559
559
|
*/
|
|
560
560
|
gap?: number;
|
|
561
561
|
/**
|
|
562
562
|
* The gap between flex rows.
|
|
563
563
|
*
|
|
564
|
-
* @see @see https://
|
|
564
|
+
* @see @see https://solid-tv.github.io/solid/#/flow/layout?id=flex
|
|
565
565
|
*/
|
|
566
566
|
rowGap?: number;
|
|
567
567
|
/**
|
|
568
568
|
* The gap between flex columns.
|
|
569
569
|
*
|
|
570
|
-
* @see @see https://
|
|
570
|
+
* @see @see https://solid-tv.github.io/solid/#/flow/layout?id=flex
|
|
571
571
|
*/
|
|
572
572
|
columnGap?: number;
|
|
573
573
|
/**
|
|
574
574
|
* Defines the alignment of flex items along the main axis.
|
|
575
575
|
*
|
|
576
|
-
* @see @see https://
|
|
576
|
+
* @see @see https://solid-tv.github.io/solid/#/flow/layout?id=flex
|
|
577
577
|
*/
|
|
578
578
|
justifyContent?:
|
|
579
579
|
| 'flexStart'
|
|
@@ -585,43 +585,43 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
585
585
|
/**
|
|
586
586
|
* Applies a linear gradient effect to the element.
|
|
587
587
|
*
|
|
588
|
-
* @see https://
|
|
588
|
+
* @see https://solid-tv.github.io/solid/#/essentials/effects
|
|
589
589
|
*/
|
|
590
590
|
linearGradient?: LinearGradientProps;
|
|
591
591
|
/**
|
|
592
592
|
* Applies a radial gradient effect to the element.
|
|
593
593
|
*
|
|
594
|
-
* @see https://
|
|
594
|
+
* @see https://solid-tv.github.io/solid/#/essentials/effects
|
|
595
595
|
*/
|
|
596
596
|
radialGradient?: RadialGradientProps;
|
|
597
597
|
/**
|
|
598
598
|
* The margin on the bottom side of the element for a flexItem.
|
|
599
599
|
*
|
|
600
|
-
* @see https://
|
|
600
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
601
601
|
*/
|
|
602
602
|
marginBottom?: number;
|
|
603
603
|
/**
|
|
604
604
|
* The margin on the left side of the element for a flexItem.
|
|
605
605
|
*
|
|
606
|
-
* @see https://
|
|
606
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
607
607
|
*/
|
|
608
608
|
marginLeft?: number;
|
|
609
609
|
/**
|
|
610
610
|
* The margin on the right side of the element for a flexItem.
|
|
611
611
|
*
|
|
612
|
-
* @see https://
|
|
612
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
613
613
|
*/
|
|
614
614
|
marginRight?: number;
|
|
615
615
|
/**
|
|
616
616
|
* The margin on the top side of the element for a flexItem.
|
|
617
617
|
*
|
|
618
|
-
* @see https://
|
|
618
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
619
619
|
*/
|
|
620
620
|
marginTop?: number;
|
|
621
621
|
/**
|
|
622
622
|
* The padding on all sides of the flex element, or an array defining [Top, Right, Bottom, Left] padding.
|
|
623
623
|
*
|
|
624
|
-
* @see https://
|
|
624
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
625
625
|
*/
|
|
626
626
|
padding?:
|
|
627
627
|
| number
|
|
@@ -631,7 +631,7 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
631
631
|
/**
|
|
632
632
|
* The margin on all sides of the flex element, or an array defining [Top, Right, Bottom, Left] margins.
|
|
633
633
|
*
|
|
634
|
-
* @see https://
|
|
634
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
635
635
|
*/
|
|
636
636
|
margin?:
|
|
637
637
|
| number
|
|
@@ -641,31 +641,31 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
641
641
|
/**
|
|
642
642
|
* The x-coordinate of the element's position.
|
|
643
643
|
*
|
|
644
|
-
* @see https://
|
|
644
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
645
645
|
*/
|
|
646
646
|
x: number;
|
|
647
647
|
/**
|
|
648
648
|
* The y-coordinate of the element's position.
|
|
649
649
|
*
|
|
650
|
-
* @see https://
|
|
650
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
651
651
|
*/
|
|
652
652
|
y: number;
|
|
653
653
|
/**
|
|
654
654
|
* Throttles key press events by the specified number of milliseconds.
|
|
655
655
|
*
|
|
656
|
-
* @see https://
|
|
656
|
+
* @see https://solid-tv.github.io/solid/#/primitives/useFocusManager?id=input-throttling-available-core-212
|
|
657
657
|
*/
|
|
658
658
|
throttleInput?: number;
|
|
659
659
|
/**
|
|
660
660
|
* The width of the element.
|
|
661
661
|
*
|
|
662
|
-
* @see https://
|
|
662
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
663
663
|
*/
|
|
664
664
|
w: number;
|
|
665
665
|
/**
|
|
666
666
|
* The height of the element.
|
|
667
667
|
*
|
|
668
|
-
* @see https://
|
|
668
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
669
669
|
*/
|
|
670
670
|
h: number;
|
|
671
671
|
/**
|
|
@@ -687,13 +687,13 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
687
687
|
/**
|
|
688
688
|
* The z-index of the element, which affects its stacking order.
|
|
689
689
|
*
|
|
690
|
-
* @see https://
|
|
690
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
691
691
|
*/
|
|
692
692
|
zIndex?: number;
|
|
693
693
|
/**
|
|
694
694
|
* Defines transitions for animatable properties.
|
|
695
695
|
*
|
|
696
|
-
* @see https://
|
|
696
|
+
* @see https://solid-tv.github.io/solid/#/essentials/transitions?id=transitions-animations
|
|
697
697
|
*/
|
|
698
698
|
transition?:
|
|
699
699
|
| Record<string, AnimationSettings | undefined | true | false>
|
|
@@ -708,31 +708,31 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
708
708
|
*
|
|
709
709
|
* Each event handler is optional and maps to a corresponding event.
|
|
710
710
|
*
|
|
711
|
-
* @see https://
|
|
711
|
+
* @see https://solid-tv.github.io/solid/#/essentials/transitions?id=animation-callbacks
|
|
712
712
|
*/
|
|
713
713
|
onAnimation?: Partial<Record<AnimationEvents, AnimationEventHandler>>;
|
|
714
714
|
/** Optional handler for when the element is created and rendered.
|
|
715
715
|
*
|
|
716
|
-
* @see https://
|
|
716
|
+
* @see https://solid-tv.github.io/solid/#/flow/ondestroy
|
|
717
717
|
*/
|
|
718
718
|
onCreate?: (this: ElementNode, el: ElementNode) => void;
|
|
719
719
|
/**
|
|
720
720
|
* Optional handler for when the element is destroyed.
|
|
721
721
|
* It can return a promise to wait for the cleanup to finish before the element is destroyed.
|
|
722
722
|
*
|
|
723
|
-
* @see https://
|
|
723
|
+
* @see https://solid-tv.github.io/solid/#/flow/ondestroy
|
|
724
724
|
*/
|
|
725
725
|
onDestroy?: (this: ElementNode, el: ElementNode) => Promise<void> | void;
|
|
726
726
|
/**
|
|
727
727
|
* Optional handlers for when the element is rendered—after creation and when switching parents.
|
|
728
728
|
*
|
|
729
|
-
* @see https://
|
|
729
|
+
* @see https://solid-tv.github.io/solid/#/primitives/KeepAlive
|
|
730
730
|
*/
|
|
731
731
|
onRender?: (this: ElementNode, el: ElementNode) => void;
|
|
732
732
|
/**
|
|
733
733
|
* Optional handlers for when the element is removed from a parent element.
|
|
734
734
|
*
|
|
735
|
-
* @see https://
|
|
735
|
+
* @see https://solid-tv.github.io/solid/#/primitives/KeepAlive
|
|
736
736
|
*/
|
|
737
737
|
onRemove?: (this: ElementNode, el: ElementNode) => void;
|
|
738
738
|
/**
|
|
@@ -753,7 +753,7 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
753
753
|
* @param {Partial<Record<NodeEvents, EventHandler>>} events - An object where the keys are event names from NodeEvents and the values are the respective event handlers.
|
|
754
754
|
* @returns {void}
|
|
755
755
|
*
|
|
756
|
-
* @see https://
|
|
756
|
+
* @see https://solid-tv.github.io/solid/#/essentials/events
|
|
757
757
|
*/
|
|
758
758
|
onEvent?: OnEvent;
|
|
759
759
|
|
|
@@ -772,7 +772,7 @@ export interface ElementNode extends RendererNode, FocusNode {
|
|
|
772
772
|
* `paddingTop`, `paddingRight`, `paddingBottom`, `paddingLeft`.
|
|
773
773
|
* Only in the new flex engine.
|
|
774
774
|
*
|
|
775
|
-
* @see https://
|
|
775
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=flex
|
|
776
776
|
*/
|
|
777
777
|
paddingTop?: number;
|
|
778
778
|
paddingRight?: number;
|
|
@@ -1198,7 +1198,7 @@ export class ElementNode {
|
|
|
1198
1198
|
if (isDev && this._style) {
|
|
1199
1199
|
// Avoid processing style changes again
|
|
1200
1200
|
console.warn(
|
|
1201
|
-
'Style already set: https://
|
|
1201
|
+
'Style already set: https://solid-tv.github.io/solid/#/essentials/styling?id=style-patterns-to-avoid',
|
|
1202
1202
|
);
|
|
1203
1203
|
}
|
|
1204
1204
|
|
|
@@ -1344,7 +1344,7 @@ export class ElementNode {
|
|
|
1344
1344
|
* Specifies the display behavior of an element. 'flex' enables flexbox layout.
|
|
1345
1345
|
*
|
|
1346
1346
|
* @default 'block'
|
|
1347
|
-
* @see https://
|
|
1347
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout?id=flex
|
|
1348
1348
|
*/
|
|
1349
1349
|
get display(): 'flex' | 'block' | undefined {
|
|
1350
1350
|
return this._display;
|
|
@@ -1358,7 +1358,7 @@ export class ElementNode {
|
|
|
1358
1358
|
/**
|
|
1359
1359
|
* Callback run after flex layout is calculated on flex elements.
|
|
1360
1360
|
*
|
|
1361
|
-
* @see https://
|
|
1361
|
+
* @see https://solid-tv.github.io/solid/#/flow/layout
|
|
1362
1362
|
*/
|
|
1363
1363
|
get onLayout():
|
|
1364
1364
|
| ((this: ElementNode, target: ElementNode) => void)
|
|
@@ -14,6 +14,10 @@ export interface KeepAliveElement {
|
|
|
14
14
|
isAlive?: s.Accessor<boolean>;
|
|
15
15
|
setIsAlive?: (v: boolean) => void;
|
|
16
16
|
dispose?: () => void;
|
|
17
|
+
// Focused node captured on route exit so it can be refocused on re-entry.
|
|
18
|
+
// Stored here (rather than in a KeepAliveRoute closure) so it becomes
|
|
19
|
+
// garbage as soon as the entry is dropped from the map.
|
|
20
|
+
savedFocusedElement?: ElementNode;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
const keepAliveElements = new Map<string, KeepAliveElement>();
|
|
@@ -199,8 +203,6 @@ export const KeepAliveRoute = <S extends string>(
|
|
|
199
203
|
return cached;
|
|
200
204
|
}
|
|
201
205
|
|
|
202
|
-
let savedFocusedElement: ElementNode | undefined;
|
|
203
|
-
|
|
204
206
|
const getExisting = (): KeepAliveElement => {
|
|
205
207
|
let existing = keepAliveRouteElements.get(key);
|
|
206
208
|
if (!existing) {
|
|
@@ -212,11 +214,20 @@ export const KeepAliveRoute = <S extends string>(
|
|
|
212
214
|
};
|
|
213
215
|
|
|
214
216
|
const onRemove = chainFunctions(props.onRemove, (elm: ElementNode) => {
|
|
215
|
-
|
|
217
|
+
const existing = keepAliveRouteElements.get(key);
|
|
218
|
+
if (existing) {
|
|
219
|
+
existing.savedFocusedElement = activeElement();
|
|
220
|
+
}
|
|
216
221
|
elm.alpha = 0;
|
|
217
222
|
});
|
|
218
223
|
|
|
219
224
|
const onRender = chainFunctions(props.onRender, (elm: ElementNode) => {
|
|
225
|
+
const existing = keepAliveRouteElements.get(key);
|
|
226
|
+
const savedFocusedElement = existing?.savedFocusedElement;
|
|
227
|
+
if (existing) {
|
|
228
|
+
existing.savedFocusedElement = undefined;
|
|
229
|
+
}
|
|
230
|
+
|
|
220
231
|
let isChild = false;
|
|
221
232
|
let current = savedFocusedElement;
|
|
222
233
|
while (current) {
|