@jsenv/navi 0.18.8 → 0.18.10
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/dist/jsenv_navi.js +96 -33
- package/dist/jsenv_navi.js.map +16 -12
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -14364,10 +14364,7 @@ const useAutoFocus = (
|
|
|
14364
14364
|
autoFocus,
|
|
14365
14365
|
{ autoFocusVisible, autoSelect } = {},
|
|
14366
14366
|
) => {
|
|
14367
|
-
|
|
14368
|
-
if (!autoFocus) {
|
|
14369
|
-
return null;
|
|
14370
|
-
}
|
|
14367
|
+
const triggerAutofocus = () => {
|
|
14371
14368
|
const activeElement = document.activeElement;
|
|
14372
14369
|
const focusableElement = focusableElementRef.current;
|
|
14373
14370
|
focusableElement.focus({ focusVisible: autoFocusVisible });
|
|
@@ -14418,7 +14415,14 @@ const useAutoFocus = (
|
|
|
14418
14415
|
|
|
14419
14416
|
activeElement.focus();
|
|
14420
14417
|
};
|
|
14421
|
-
}
|
|
14418
|
+
};
|
|
14419
|
+
|
|
14420
|
+
useLayoutEffect(() => {
|
|
14421
|
+
if (!autoFocus) {
|
|
14422
|
+
return null;
|
|
14423
|
+
}
|
|
14424
|
+
return triggerAutofocus();
|
|
14425
|
+
}, [autoFocus]);
|
|
14422
14426
|
|
|
14423
14427
|
useEffect(() => {
|
|
14424
14428
|
if (autoFocus) {
|
|
@@ -14426,6 +14430,8 @@ const useAutoFocus = (
|
|
|
14426
14430
|
focusableElement.scrollIntoView({ inline: "nearest", block: "nearest" });
|
|
14427
14431
|
}
|
|
14428
14432
|
}, []);
|
|
14433
|
+
|
|
14434
|
+
return triggerAutofocus;
|
|
14429
14435
|
};
|
|
14430
14436
|
|
|
14431
14437
|
const CalloutCloseContext = createContext();
|
|
@@ -17738,7 +17744,7 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
17738
17744
|
|
|
17739
17745
|
.navi_text_overflow_wrapper {
|
|
17740
17746
|
display: flex;
|
|
17741
|
-
width:
|
|
17747
|
+
width: 100%;
|
|
17742
17748
|
flex-grow: 1;
|
|
17743
17749
|
gap: 0.3em;
|
|
17744
17750
|
}
|
|
@@ -17940,7 +17946,6 @@ const TextOverflow = ({
|
|
|
17940
17946
|
preLine: rest.as === "p",
|
|
17941
17947
|
...rest,
|
|
17942
17948
|
className: "navi_text_overflow",
|
|
17943
|
-
expandX: true,
|
|
17944
17949
|
spacing: "pre",
|
|
17945
17950
|
children: jsxs("span", {
|
|
17946
17951
|
className: "navi_text_overflow_wrapper",
|
|
@@ -20691,7 +20696,8 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
20691
20696
|
--link-outline-color: var(--navi-focus-outline-color);
|
|
20692
20697
|
--link-loader-color: var(--navi-loader-color);
|
|
20693
20698
|
--link-color: rgb(0, 0, 238);
|
|
20694
|
-
--link-color-visited:
|
|
20699
|
+
--link-color-visited: color-mix(in srgb, var(--link-color), black 40%);
|
|
20700
|
+
|
|
20695
20701
|
--link-color-active: red;
|
|
20696
20702
|
--link-text-decoration: underline;
|
|
20697
20703
|
--link-text-decoration-hover: var(--link-text-decoration);
|
|
@@ -20738,22 +20744,6 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
20738
20744
|
--x-link-color: var(--x-link-color-hover);
|
|
20739
20745
|
--x-link-text-decoration: var(--x-link-text-decoration-hover);
|
|
20740
20746
|
}
|
|
20741
|
-
/* Current */
|
|
20742
|
-
&[data-href-current] {
|
|
20743
|
-
--x-link-color: var(--link-color-current);
|
|
20744
|
-
--x-link-cursor: default;
|
|
20745
|
-
&[data-anchor] {
|
|
20746
|
-
/* For anchor links, we want to keep the pointer cursor to indicate interactivity */
|
|
20747
|
-
/* as anchor link will still scroll to the section even if it's the current page */
|
|
20748
|
-
--x-link-cursor: pointer;
|
|
20749
|
-
}
|
|
20750
|
-
}
|
|
20751
|
-
/* Focus */
|
|
20752
|
-
&[data-focus],
|
|
20753
|
-
&[data-focus-visible] {
|
|
20754
|
-
position: relative;
|
|
20755
|
-
z-index: 1; /* Ensure focus outline is above other elements */
|
|
20756
|
-
}
|
|
20757
20747
|
&[data-focus-visible] {
|
|
20758
20748
|
outline-width: 2px;
|
|
20759
20749
|
}
|
|
@@ -20773,6 +20763,22 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
20773
20763
|
/* Redefine it otherwise [data-visited] prevails */
|
|
20774
20764
|
--x-link-color: var(--x-link-color-active);
|
|
20775
20765
|
}
|
|
20766
|
+
/* Current */
|
|
20767
|
+
&[data-href-current] {
|
|
20768
|
+
--x-link-color: var(--link-color-current);
|
|
20769
|
+
--x-link-cursor: default;
|
|
20770
|
+
&[data-anchor] {
|
|
20771
|
+
/* For anchor links, we want to keep the pointer cursor to indicate interactivity */
|
|
20772
|
+
/* as anchor link will still scroll to the section even if it's the current page */
|
|
20773
|
+
--x-link-cursor: pointer;
|
|
20774
|
+
}
|
|
20775
|
+
}
|
|
20776
|
+
/* Focus */
|
|
20777
|
+
&[data-focus],
|
|
20778
|
+
&[data-focus-visible] {
|
|
20779
|
+
position: relative;
|
|
20780
|
+
z-index: 1; /* Ensure focus outline is above other elements */
|
|
20781
|
+
}
|
|
20776
20782
|
/* Readonly */
|
|
20777
20783
|
&[data-readonly] > * {
|
|
20778
20784
|
opacity: 0.5;
|
|
@@ -24471,8 +24477,21 @@ const Input = props => {
|
|
|
24471
24477
|
|
|
24472
24478
|
installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
24473
24479
|
.navi_editable_wrapper {
|
|
24480
|
+
--inset-top: 0px;
|
|
24481
|
+
--inset-right: 0px;
|
|
24482
|
+
--inset-bottom: 0px;
|
|
24483
|
+
--inset-left: 0px;
|
|
24484
|
+
|
|
24474
24485
|
position: absolute;
|
|
24475
|
-
|
|
24486
|
+
top: var(--inset-top);
|
|
24487
|
+
right: var(--inset-right);
|
|
24488
|
+
bottom: var(--inset-bottom);
|
|
24489
|
+
left: var(--inset-left);
|
|
24490
|
+
|
|
24491
|
+
opacity: 0;
|
|
24492
|
+
&[data-editing] {
|
|
24493
|
+
opacity: 1;
|
|
24494
|
+
}
|
|
24476
24495
|
}
|
|
24477
24496
|
`;
|
|
24478
24497
|
const useEditionController = () => {
|
|
@@ -24562,7 +24581,7 @@ const Editable = props => {
|
|
|
24562
24581
|
name: name,
|
|
24563
24582
|
value: value,
|
|
24564
24583
|
valueSignal: valueSignal,
|
|
24565
|
-
autoFocus:
|
|
24584
|
+
autoFocus: editing,
|
|
24566
24585
|
autoFocusVisible: true,
|
|
24567
24586
|
autoSelect: autoSelect,
|
|
24568
24587
|
cancelOnEscape: true,
|
|
@@ -24607,12 +24626,32 @@ const Editable = props => {
|
|
|
24607
24626
|
});
|
|
24608
24627
|
}
|
|
24609
24628
|
});
|
|
24629
|
+
const wrapperRef = useRef();
|
|
24630
|
+
useLayoutEffect(() => {
|
|
24631
|
+
const wrapper = wrapperRef.current;
|
|
24632
|
+
if (!wrapper) {
|
|
24633
|
+
return;
|
|
24634
|
+
}
|
|
24635
|
+
const parent = wrapper.parentElement;
|
|
24636
|
+
const borderSizes = getBorderSizes(parent);
|
|
24637
|
+
wrapper.style.setProperty("--inset-left", `-${borderSizes.left}px`);
|
|
24638
|
+
wrapper.style.setProperty("--inset-top", `-${borderSizes.top}px`);
|
|
24639
|
+
wrapper.style.setProperty("--inset-right", `-${borderSizes.right}px`);
|
|
24640
|
+
wrapper.style.setProperty("--inset-bottom", `-${borderSizes.bottom}px`);
|
|
24641
|
+
});
|
|
24610
24642
|
return jsxs(Fragment, {
|
|
24611
24643
|
children: [children || jsx("span", {
|
|
24612
24644
|
children: value
|
|
24613
|
-
}),
|
|
24645
|
+
}), jsx(Box, {
|
|
24646
|
+
className: "navi_editable_wrapper",
|
|
24647
|
+
ref: wrapperRef,
|
|
24614
24648
|
...wrapperProps,
|
|
24615
|
-
|
|
24649
|
+
// inert ensure input while not editing that:
|
|
24650
|
+
// - input not focusable (via keyboard or anything)
|
|
24651
|
+
// - cannot be interacted with pointer (click, hover, etc)
|
|
24652
|
+
// - is ignored by screen readers
|
|
24653
|
+
inert: editing ? undefined : "",
|
|
24654
|
+
"data-editing": editing ? "" : undefined,
|
|
24616
24655
|
children: input
|
|
24617
24656
|
})]
|
|
24618
24657
|
});
|
|
@@ -29595,7 +29634,7 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
29595
29634
|
/* Semantic fill colors, matching native meter on Chrome/macOS */
|
|
29596
29635
|
--fill-color-optimum: light-dark(#0f7c0f, #4caf50);
|
|
29597
29636
|
--fill-color-suboptimum: light-dark(#fdb900, #ffc107);
|
|
29598
|
-
--fill-color-
|
|
29637
|
+
--fill-color-even-less-good: light-dark(#d83b01, #f44336);
|
|
29599
29638
|
}
|
|
29600
29639
|
}
|
|
29601
29640
|
|
|
@@ -29681,6 +29720,14 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
|
29681
29720
|
border-color: transparent;
|
|
29682
29721
|
}
|
|
29683
29722
|
}
|
|
29723
|
+
&[data-transition] {
|
|
29724
|
+
.navi_meter_fill {
|
|
29725
|
+
transition: clip-path 0.4s ease;
|
|
29726
|
+
}
|
|
29727
|
+
&[data-fill-round] .navi_meter_fill {
|
|
29728
|
+
transition: width 0.4s ease;
|
|
29729
|
+
}
|
|
29730
|
+
}
|
|
29684
29731
|
}
|
|
29685
29732
|
`;
|
|
29686
29733
|
const MeterStyleCSSVars = {
|
|
@@ -29690,7 +29737,18 @@ const MeterStyleCSSVars = {
|
|
|
29690
29737
|
height: "--height",
|
|
29691
29738
|
width: "--width"
|
|
29692
29739
|
};
|
|
29693
|
-
const MeterPseudoClasses = [":hover", ":active", ":focus", ":focus-visible", ":read-only", ":disabled", ":-navi-loading"];
|
|
29740
|
+
const MeterPseudoClasses = [":hover", ":active", ":focus", ":focus-visible", ":read-only", ":disabled", ":-navi-loading", ":-navi-meter-optimum", ":-navi-meter-suboptimum", ":-navi-meter-even-less-good"];
|
|
29741
|
+
Object.assign(PSEUDO_CLASSES, {
|
|
29742
|
+
":-navi-meter-optimum": {
|
|
29743
|
+
attribute: "data-optimum"
|
|
29744
|
+
},
|
|
29745
|
+
":-navi-meter-suboptimum": {
|
|
29746
|
+
attribute: "data-suboptimum"
|
|
29747
|
+
},
|
|
29748
|
+
":-navi-meter-even-less-good": {
|
|
29749
|
+
attribute: "data-even-less-good"
|
|
29750
|
+
}
|
|
29751
|
+
});
|
|
29694
29752
|
const Meter = ({
|
|
29695
29753
|
value = 0,
|
|
29696
29754
|
min = 0,
|
|
@@ -29706,6 +29764,7 @@ const Meter = ({
|
|
|
29706
29764
|
fillOnly,
|
|
29707
29765
|
fillRound = fillOnly,
|
|
29708
29766
|
borderless,
|
|
29767
|
+
transition,
|
|
29709
29768
|
style,
|
|
29710
29769
|
...props
|
|
29711
29770
|
}) => {
|
|
@@ -29720,7 +29779,7 @@ const Meter = ({
|
|
|
29720
29779
|
});
|
|
29721
29780
|
}
|
|
29722
29781
|
const level = getMeterLevel(clampedValue, min, max, low, high, optimum);
|
|
29723
|
-
const fillColorVar = level === "optimum" ? "var(--fill-color-optimum)" : level === "suboptimum" ? "var(--fill-color-suboptimum)" : "var(--fill-color-
|
|
29782
|
+
const fillColorVar = level === "optimum" ? "var(--fill-color-optimum)" : level === "suboptimum" ? "var(--fill-color-suboptimum)" : "var(--fill-color-even-less-good)";
|
|
29724
29783
|
reportDisabledToLabel(disabled);
|
|
29725
29784
|
reportReadOnlyToLabel(readOnly);
|
|
29726
29785
|
const trackContainerRef = useRef();
|
|
@@ -29755,13 +29814,17 @@ const Meter = ({
|
|
|
29755
29814
|
basePseudoState: {
|
|
29756
29815
|
":read-only": readOnly,
|
|
29757
29816
|
":disabled": disabled,
|
|
29758
|
-
":-navi-loading": loading
|
|
29817
|
+
":-navi-loading": loading,
|
|
29818
|
+
":-navi-meter-optimum": level === "optimum",
|
|
29819
|
+
":-navi-meter-suboptimum": level === "suboptimum",
|
|
29820
|
+
":-navi-meter-even-less-good": level === "even-less-good"
|
|
29759
29821
|
},
|
|
29760
29822
|
pseudoClasses: MeterPseudoClasses,
|
|
29761
29823
|
"data-has-caption": children !== undefined ? "" : undefined,
|
|
29762
29824
|
"data-fill-only": fillOnly ? "" : undefined,
|
|
29763
29825
|
"data-fill-round": fillRound ? "" : undefined,
|
|
29764
29826
|
"data-borderless": borderless ? "" : undefined,
|
|
29827
|
+
"data-transition": transition ? "" : undefined,
|
|
29765
29828
|
style: {
|
|
29766
29829
|
"--x-fill-ratio": fillRatio,
|
|
29767
29830
|
"--x-fill-color": fillColorVar,
|
|
@@ -29805,7 +29868,7 @@ const getMeterLevel = (value, min, max, low, high, optimum) => {
|
|
|
29805
29868
|
const distance = Math.abs(optimumRegion - valueRegion);
|
|
29806
29869
|
if (distance === 0) return "optimum";
|
|
29807
29870
|
if (distance === 1) return "suboptimum";
|
|
29808
|
-
return "
|
|
29871
|
+
return "even-less-good";
|
|
29809
29872
|
};
|
|
29810
29873
|
|
|
29811
29874
|
const Paragraph = props => {
|