@jsenv/navi 0.18.3 → 0.18.5

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.
@@ -29446,6 +29446,131 @@ const CodeBox = ({
29446
29446
  });
29447
29447
  };
29448
29448
 
29449
+ installImportMetaCss(import.meta);import.meta.css = /* css */`
29450
+ @layer navi {
29451
+ .navi_stat {
29452
+ --unit-color: color-mix(in srgb, currentColor 50%, white);
29453
+ --unit-ratio: 0.7;
29454
+ }
29455
+ }
29456
+
29457
+ .navi_stat {
29458
+ display: inline-flex;
29459
+ flex-direction: column;
29460
+ align-items: flex-start;
29461
+ gap: 0.3em;
29462
+ line-height: 1;
29463
+
29464
+ .navi_stat_label {
29465
+ font-weight: 600;
29466
+ font-size: 0.75em;
29467
+ text-transform: uppercase;
29468
+ line-height: 1;
29469
+ letter-spacing: 0.06em;
29470
+ }
29471
+ .navi_stat_body {
29472
+ .navi_stat_value {
29473
+ font-weight: bold;
29474
+ }
29475
+ .navi_stat_unit {
29476
+ color: var(--unit-color);
29477
+ font-weight: normal;
29478
+ font-size: calc(var(--unit-ratio) * 1em);
29479
+ }
29480
+ }
29481
+
29482
+ &[data-readonly] {
29483
+ opacity: 0.7;
29484
+ cursor: default;
29485
+ }
29486
+
29487
+ &[data-disabled] {
29488
+ opacity: 0.4;
29489
+ cursor: not-allowed;
29490
+ user-select: none;
29491
+ }
29492
+
29493
+ &[data-unit-bottom] {
29494
+ .navi_stat_value {
29495
+ display: inline-block;
29496
+ width: 100%;
29497
+ text-align: center;
29498
+ }
29499
+ .navi_stat_body {
29500
+ .navi_stat_unit {
29501
+ display: inline-block;
29502
+ width: 100%;
29503
+ text-align: center;
29504
+ }
29505
+ }
29506
+ }
29507
+ }
29508
+ `;
29509
+ const StatPseudoClasses = [":hover", ":active", ":read-only", ":disabled", ":-navi-loading"];
29510
+ const Stat = ({
29511
+ children,
29512
+ unit,
29513
+ unitPosition = "right",
29514
+ unitRatio,
29515
+ label,
29516
+ size,
29517
+ lang,
29518
+ integer,
29519
+ loading,
29520
+ readOnly,
29521
+ disabled,
29522
+ ...props
29523
+ }) => {
29524
+ const value = parseStatValue(children);
29525
+ const valueRounded = integer && typeof value === "number" ? Math.round(value) : value;
29526
+ const valueFormatted = typeof valueRounded === "number" ? formatNumber(valueRounded, {
29527
+ lang
29528
+ }) : valueRounded;
29529
+ const unitBottom = unitPosition === "bottom";
29530
+ return jsxs(Text, {
29531
+ baseClassName: "navi_stat",
29532
+ "data-unit-bottom": unitBottom ? "" : undefined,
29533
+ basePseudoState: {
29534
+ ":read-only": readOnly,
29535
+ ":disabled": disabled,
29536
+ ":-navi-loading": loading
29537
+ },
29538
+ pseudoClasses: StatPseudoClasses,
29539
+ spacing: "pre",
29540
+ ...props,
29541
+ children: [label && jsx("span", {
29542
+ className: "navi_stat_label",
29543
+ children: label
29544
+ }), jsxs(Text, {
29545
+ className: "navi_stat_body",
29546
+ size: size,
29547
+ spacing: unitBottom ? jsx("br", {}) : undefined,
29548
+ children: [jsx("span", {
29549
+ className: "navi_stat_value",
29550
+ children: loading ? jsx(Icon, {
29551
+ flowInline: true,
29552
+ children: jsx(LoadingDots, {})
29553
+ }) : valueFormatted
29554
+ }), unit && jsx("span", {
29555
+ className: "navi_stat_unit",
29556
+ style: {
29557
+ ...(unitRatio === undefined ? {} : {
29558
+ "--unit-ratio": unitRatio
29559
+ })
29560
+ },
29561
+ children: unit
29562
+ })]
29563
+ })]
29564
+ });
29565
+ };
29566
+ const parseStatValue = children => {
29567
+ if (typeof children !== "string") {
29568
+ return children;
29569
+ }
29570
+ const parsed = Number(children);
29571
+ return Number.isNaN(parsed) ? children : parsed;
29572
+ };
29573
+
29449
29574
  installImportMetaCss(import.meta);import.meta.css = /* css */`
29450
29575
  @layer navi {
29451
29576
  .navi_meter {
@@ -29577,7 +29702,11 @@ const Meter = ({
29577
29702
  const clampedValue = value < min ? min : value > max ? max : value;
29578
29703
  const fillRatio = max === min ? 0 : (clampedValue - min) / (max - min);
29579
29704
  if (children === undefined && percentage) {
29580
- children = `${Math.round(fillRatio * 100)}%`;
29705
+ children = jsx(Stat, {
29706
+ unit: "%",
29707
+ unitRatio: "1",
29708
+ children: Math.round(fillRatio * 100)
29709
+ });
29581
29710
  }
29582
29711
  const level = getMeterLevel(clampedValue, min, max, low, high, optimum);
29583
29712
  const fillColorVar = level === "optimum" ? "var(--fill-color-optimum)" : level === "suboptimum" ? "var(--fill-color-suboptimum)" : "var(--fill-color-subsuboptimum)";
@@ -29675,126 +29804,6 @@ const Paragraph = props => {
29675
29804
  });
29676
29805
  };
29677
29806
 
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
29807
  const Image = props => {
29799
29808
  return jsx(Box, {
29800
29809
  ...props,