@jsenv/navi 0.18.3 → 0.18.6
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 +140 -121
- package/dist/jsenv_navi.js.map +14 -12
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -5374,6 +5374,11 @@ const POSITION_PROPS = {
|
|
|
5374
5374
|
// only the first item will be positioned as expected because subsequent items
|
|
5375
5375
|
// will be positioned relative to the previous item's margins, not the container edge.
|
|
5376
5376
|
selfAlignX: (value, { parentBoxFlow }) => {
|
|
5377
|
+
const inGridFlow = parentBoxFlow === "grid";
|
|
5378
|
+
if (inGridFlow) {
|
|
5379
|
+
return { justifySelf: value };
|
|
5380
|
+
}
|
|
5381
|
+
|
|
5377
5382
|
const inRowFlow = parentBoxFlow === "row" || parentBoxFlow === "inline-row";
|
|
5378
5383
|
|
|
5379
5384
|
if (value === "start") {
|
|
@@ -5400,6 +5405,11 @@ const POSITION_PROPS = {
|
|
|
5400
5405
|
return undefined;
|
|
5401
5406
|
},
|
|
5402
5407
|
selfAlignY: (value, { parentBoxFlow }) => {
|
|
5408
|
+
const inGridFlow = parentBoxFlow === "grid";
|
|
5409
|
+
if (inGridFlow) {
|
|
5410
|
+
return { alignSelf: value };
|
|
5411
|
+
}
|
|
5412
|
+
|
|
5403
5413
|
const inColumnFlow =
|
|
5404
5414
|
parentBoxFlow === "column" || parentBoxFlow === "inline-column";
|
|
5405
5415
|
|
|
@@ -29446,6 +29456,131 @@ const CodeBox = ({
|
|
|
29446
29456
|
});
|
|
29447
29457
|
};
|
|
29448
29458
|
|
|
29459
|
+
installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
29460
|
+
@layer navi {
|
|
29461
|
+
.navi_stat {
|
|
29462
|
+
--unit-color: color-mix(in srgb, currentColor 50%, white);
|
|
29463
|
+
--unit-ratio: 0.7;
|
|
29464
|
+
}
|
|
29465
|
+
}
|
|
29466
|
+
|
|
29467
|
+
.navi_stat {
|
|
29468
|
+
display: inline-flex;
|
|
29469
|
+
flex-direction: column;
|
|
29470
|
+
align-items: flex-start;
|
|
29471
|
+
gap: 0.3em;
|
|
29472
|
+
line-height: 1;
|
|
29473
|
+
|
|
29474
|
+
.navi_stat_label {
|
|
29475
|
+
font-weight: 600;
|
|
29476
|
+
font-size: 0.75em;
|
|
29477
|
+
text-transform: uppercase;
|
|
29478
|
+
line-height: 1;
|
|
29479
|
+
letter-spacing: 0.06em;
|
|
29480
|
+
}
|
|
29481
|
+
.navi_stat_body {
|
|
29482
|
+
.navi_stat_value {
|
|
29483
|
+
font-weight: bold;
|
|
29484
|
+
}
|
|
29485
|
+
.navi_stat_unit {
|
|
29486
|
+
color: var(--unit-color);
|
|
29487
|
+
font-weight: normal;
|
|
29488
|
+
font-size: calc(var(--unit-ratio) * 1em);
|
|
29489
|
+
}
|
|
29490
|
+
}
|
|
29491
|
+
|
|
29492
|
+
&[data-readonly] {
|
|
29493
|
+
opacity: 0.7;
|
|
29494
|
+
cursor: default;
|
|
29495
|
+
}
|
|
29496
|
+
|
|
29497
|
+
&[data-disabled] {
|
|
29498
|
+
opacity: 0.4;
|
|
29499
|
+
cursor: not-allowed;
|
|
29500
|
+
user-select: none;
|
|
29501
|
+
}
|
|
29502
|
+
|
|
29503
|
+
&[data-unit-bottom] {
|
|
29504
|
+
.navi_stat_value {
|
|
29505
|
+
display: inline-block;
|
|
29506
|
+
width: 100%;
|
|
29507
|
+
text-align: center;
|
|
29508
|
+
}
|
|
29509
|
+
.navi_stat_body {
|
|
29510
|
+
.navi_stat_unit {
|
|
29511
|
+
display: inline-block;
|
|
29512
|
+
width: 100%;
|
|
29513
|
+
text-align: center;
|
|
29514
|
+
}
|
|
29515
|
+
}
|
|
29516
|
+
}
|
|
29517
|
+
}
|
|
29518
|
+
`;
|
|
29519
|
+
const StatPseudoClasses = [":hover", ":active", ":read-only", ":disabled", ":-navi-loading"];
|
|
29520
|
+
const Stat = ({
|
|
29521
|
+
children,
|
|
29522
|
+
unit,
|
|
29523
|
+
unitPosition = "right",
|
|
29524
|
+
unitRatio,
|
|
29525
|
+
label,
|
|
29526
|
+
size,
|
|
29527
|
+
lang,
|
|
29528
|
+
integer,
|
|
29529
|
+
loading,
|
|
29530
|
+
readOnly,
|
|
29531
|
+
disabled,
|
|
29532
|
+
...props
|
|
29533
|
+
}) => {
|
|
29534
|
+
const value = parseStatValue(children);
|
|
29535
|
+
const valueRounded = integer && typeof value === "number" ? Math.round(value) : value;
|
|
29536
|
+
const valueFormatted = typeof valueRounded === "number" ? formatNumber(valueRounded, {
|
|
29537
|
+
lang
|
|
29538
|
+
}) : valueRounded;
|
|
29539
|
+
const unitBottom = unitPosition === "bottom";
|
|
29540
|
+
return jsxs(Text, {
|
|
29541
|
+
baseClassName: "navi_stat",
|
|
29542
|
+
"data-unit-bottom": unitBottom ? "" : undefined,
|
|
29543
|
+
basePseudoState: {
|
|
29544
|
+
":read-only": readOnly,
|
|
29545
|
+
":disabled": disabled,
|
|
29546
|
+
":-navi-loading": loading
|
|
29547
|
+
},
|
|
29548
|
+
pseudoClasses: StatPseudoClasses,
|
|
29549
|
+
spacing: "pre",
|
|
29550
|
+
...props,
|
|
29551
|
+
children: [label && jsx("span", {
|
|
29552
|
+
className: "navi_stat_label",
|
|
29553
|
+
children: label
|
|
29554
|
+
}), jsxs(Text, {
|
|
29555
|
+
className: "navi_stat_body",
|
|
29556
|
+
size: size,
|
|
29557
|
+
spacing: unitBottom ? jsx("br", {}) : undefined,
|
|
29558
|
+
children: [jsx("span", {
|
|
29559
|
+
className: "navi_stat_value",
|
|
29560
|
+
children: loading ? jsx(Icon, {
|
|
29561
|
+
flowInline: true,
|
|
29562
|
+
children: jsx(LoadingDots, {})
|
|
29563
|
+
}) : valueFormatted
|
|
29564
|
+
}), unit && jsx("span", {
|
|
29565
|
+
className: "navi_stat_unit",
|
|
29566
|
+
style: {
|
|
29567
|
+
...(unitRatio === undefined ? {} : {
|
|
29568
|
+
"--unit-ratio": unitRatio
|
|
29569
|
+
})
|
|
29570
|
+
},
|
|
29571
|
+
children: unit
|
|
29572
|
+
})]
|
|
29573
|
+
})]
|
|
29574
|
+
});
|
|
29575
|
+
};
|
|
29576
|
+
const parseStatValue = children => {
|
|
29577
|
+
if (typeof children !== "string") {
|
|
29578
|
+
return children;
|
|
29579
|
+
}
|
|
29580
|
+
const parsed = Number(children);
|
|
29581
|
+
return Number.isNaN(parsed) ? children : parsed;
|
|
29582
|
+
};
|
|
29583
|
+
|
|
29449
29584
|
installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
29450
29585
|
@layer navi {
|
|
29451
29586
|
.navi_meter {
|
|
@@ -29577,7 +29712,11 @@ const Meter = ({
|
|
|
29577
29712
|
const clampedValue = value < min ? min : value > max ? max : value;
|
|
29578
29713
|
const fillRatio = max === min ? 0 : (clampedValue - min) / (max - min);
|
|
29579
29714
|
if (children === undefined && percentage) {
|
|
29580
|
-
children =
|
|
29715
|
+
children = jsx(Stat, {
|
|
29716
|
+
unit: "%",
|
|
29717
|
+
unitRatio: "1",
|
|
29718
|
+
children: Math.round(fillRatio * 100)
|
|
29719
|
+
});
|
|
29581
29720
|
}
|
|
29582
29721
|
const level = getMeterLevel(clampedValue, min, max, low, high, optimum);
|
|
29583
29722
|
const fillColorVar = level === "optimum" ? "var(--fill-color-optimum)" : level === "suboptimum" ? "var(--fill-color-suboptimum)" : "var(--fill-color-subsuboptimum)";
|
|
@@ -29675,126 +29814,6 @@ const Paragraph = props => {
|
|
|
29675
29814
|
});
|
|
29676
29815
|
};
|
|
29677
29816
|
|
|
29678
|
-
installImportMetaCss(import.meta);import.meta.css = /* css */`
|
|
29679
|
-
@layer navi {
|
|
29680
|
-
.navi_stat {
|
|
29681
|
-
--unit-color: #6b7280;
|
|
29682
|
-
}
|
|
29683
|
-
|
|
29684
|
-
@media (prefers-color-scheme: dark) {
|
|
29685
|
-
.navi_stat {
|
|
29686
|
-
--unit-color: rgb(129, 134, 140);
|
|
29687
|
-
}
|
|
29688
|
-
}
|
|
29689
|
-
}
|
|
29690
|
-
|
|
29691
|
-
.navi_stat {
|
|
29692
|
-
display: inline-flex;
|
|
29693
|
-
flex-direction: column;
|
|
29694
|
-
align-items: flex-start;
|
|
29695
|
-
gap: 0.3em;
|
|
29696
|
-
line-height: 1;
|
|
29697
|
-
|
|
29698
|
-
.navi_stat_label {
|
|
29699
|
-
font-weight: 600;
|
|
29700
|
-
font-size: 0.75em;
|
|
29701
|
-
text-transform: uppercase;
|
|
29702
|
-
line-height: 1;
|
|
29703
|
-
letter-spacing: 0.06em;
|
|
29704
|
-
}
|
|
29705
|
-
.navi_stat_body {
|
|
29706
|
-
.navi_stat_value {
|
|
29707
|
-
font-weight: bold;
|
|
29708
|
-
}
|
|
29709
|
-
.navi_stat_unit {
|
|
29710
|
-
color: var(--unit-color);
|
|
29711
|
-
font-weight: normal;
|
|
29712
|
-
font-size: 0.7em;
|
|
29713
|
-
}
|
|
29714
|
-
}
|
|
29715
|
-
|
|
29716
|
-
&[data-readonly] {
|
|
29717
|
-
opacity: 0.7;
|
|
29718
|
-
cursor: default;
|
|
29719
|
-
}
|
|
29720
|
-
|
|
29721
|
-
&[data-disabled] {
|
|
29722
|
-
opacity: 0.4;
|
|
29723
|
-
cursor: not-allowed;
|
|
29724
|
-
user-select: none;
|
|
29725
|
-
}
|
|
29726
|
-
|
|
29727
|
-
&[data-unit-bottom] {
|
|
29728
|
-
.navi_stat_value {
|
|
29729
|
-
display: inline-block;
|
|
29730
|
-
width: 100%;
|
|
29731
|
-
text-align: center;
|
|
29732
|
-
}
|
|
29733
|
-
.navi_stat_body {
|
|
29734
|
-
.navi_stat_unit {
|
|
29735
|
-
display: inline-block;
|
|
29736
|
-
width: 100%;
|
|
29737
|
-
text-align: center;
|
|
29738
|
-
}
|
|
29739
|
-
}
|
|
29740
|
-
}
|
|
29741
|
-
}
|
|
29742
|
-
`;
|
|
29743
|
-
const StatPseudoClasses = [":hover", ":active", ":read-only", ":disabled", ":-navi-loading"];
|
|
29744
|
-
const Stat = ({
|
|
29745
|
-
children,
|
|
29746
|
-
unit,
|
|
29747
|
-
unitPosition = "right",
|
|
29748
|
-
label,
|
|
29749
|
-
size,
|
|
29750
|
-
lang,
|
|
29751
|
-
loading,
|
|
29752
|
-
readOnly,
|
|
29753
|
-
disabled,
|
|
29754
|
-
...props
|
|
29755
|
-
}) => {
|
|
29756
|
-
const value = parseStatValue(children);
|
|
29757
|
-
const valueFormatted = typeof value === "number" ? formatNumber(value, {
|
|
29758
|
-
lang
|
|
29759
|
-
}) : value;
|
|
29760
|
-
const unitBottom = unitPosition === "bottom";
|
|
29761
|
-
return jsxs(Text, {
|
|
29762
|
-
baseClassName: "navi_stat",
|
|
29763
|
-
"data-unit-bottom": unitBottom ? "" : undefined,
|
|
29764
|
-
basePseudoState: {
|
|
29765
|
-
":read-only": readOnly,
|
|
29766
|
-
":disabled": disabled,
|
|
29767
|
-
":-navi-loading": loading
|
|
29768
|
-
},
|
|
29769
|
-
pseudoClasses: StatPseudoClasses,
|
|
29770
|
-
spacing: "pre",
|
|
29771
|
-
...props,
|
|
29772
|
-
children: [label && jsx("span", {
|
|
29773
|
-
className: "navi_stat_label",
|
|
29774
|
-
children: label
|
|
29775
|
-
}), jsxs(Text, {
|
|
29776
|
-
className: "navi_stat_body",
|
|
29777
|
-
size: size,
|
|
29778
|
-
spacing: unitBottom ? jsx("br", {}) : undefined,
|
|
29779
|
-
children: [jsx("span", {
|
|
29780
|
-
className: "navi_stat_value",
|
|
29781
|
-
children: loading ? jsx(Icon, {
|
|
29782
|
-
flowInline: true,
|
|
29783
|
-
children: jsx(LoadingDots, {})
|
|
29784
|
-
}) : valueFormatted
|
|
29785
|
-
}), unit && jsx("span", {
|
|
29786
|
-
className: "navi_stat_unit",
|
|
29787
|
-
children: unit
|
|
29788
|
-
})]
|
|
29789
|
-
})]
|
|
29790
|
-
});
|
|
29791
|
-
};
|
|
29792
|
-
const parseStatValue = children => {
|
|
29793
|
-
if (typeof children !== "string") return children;
|
|
29794
|
-
const parsed = Number(children);
|
|
29795
|
-
return Number.isNaN(parsed) ? children : parsed;
|
|
29796
|
-
};
|
|
29797
|
-
|
|
29798
29817
|
const Image = props => {
|
|
29799
29818
|
return jsx(Box, {
|
|
29800
29819
|
...props,
|