@jsenv/navi 0.18.12 → 0.18.15

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.
@@ -2472,8 +2472,9 @@ const useArraySignalMembership = (...args) => {
2472
2472
  }
2473
2473
 
2474
2474
  return useMemo(() => {
2475
- const [isMember, add, remove] = arraySignalMembership(...args);
2476
- return [isMember(), add, remove];
2475
+ const [useIsMember, add, remove] = arraySignalMembership(...args);
2476
+ const isMember = useIsMember();
2477
+ return [isMember, add, remove];
2477
2478
  }, args);
2478
2479
  };
2479
2480
 
@@ -2485,10 +2486,10 @@ const arraySignalMembership = (...args) => {
2485
2486
  }
2486
2487
  const [arraySignal, id] = args;
2487
2488
 
2488
- const isMember = () => {
2489
- const array = arraySignal.peek();
2490
- const is = array.includes(id);
2491
- return is;
2489
+ const useIsMember = () => {
2490
+ const array = arraySignal.value; // use value to subscribe to signal changes
2491
+ const idFoundInArray = array.includes(id);
2492
+ return idFoundInArray;
2492
2493
  };
2493
2494
 
2494
2495
  const add = () => {
@@ -2503,7 +2504,7 @@ const arraySignalMembership = (...args) => {
2503
2504
  return arrayWithoutId;
2504
2505
  };
2505
2506
 
2506
- return [isMember, add, remove];
2507
+ return [useIsMember, add, remove];
2507
2508
  };
2508
2509
 
2509
2510
  const localStorageSignal = (key) => {
@@ -29520,31 +29521,31 @@ const CodeBox = ({
29520
29521
 
29521
29522
  installImportMetaCss(import.meta);import.meta.css = /* css */`
29522
29523
  @layer navi {
29523
- .navi_stat {
29524
+ .navi_quantity {
29524
29525
  --unit-color: color-mix(in srgb, currentColor 50%, white);
29525
29526
  --unit-size-ratio: 0.7;
29526
29527
  }
29527
29528
  }
29528
29529
 
29529
- .navi_stat {
29530
+ .navi_quantity {
29530
29531
  display: inline-flex;
29531
29532
  flex-direction: column;
29532
29533
  align-items: flex-start;
29533
29534
  gap: 0.3em;
29534
29535
  line-height: 1;
29535
29536
 
29536
- .navi_stat_label {
29537
+ .navi_quantity_label {
29537
29538
  font-weight: 600;
29538
29539
  font-size: 0.75em;
29539
29540
  text-transform: uppercase;
29540
29541
  line-height: 1;
29541
29542
  letter-spacing: 0.06em;
29542
29543
  }
29543
- .navi_stat_body {
29544
- .navi_stat_value {
29544
+ .navi_quantity_body {
29545
+ .navi_quantity_value {
29545
29546
  font-weight: bold;
29546
29547
  }
29547
- .navi_stat_unit {
29548
+ .navi_quantity_unit {
29548
29549
  color: var(--unit-color);
29549
29550
  font-weight: normal;
29550
29551
  font-size: calc(var(--unit-size-ratio) * 1em);
@@ -29563,13 +29564,13 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
29563
29564
  }
29564
29565
 
29565
29566
  &[data-unit-bottom] {
29566
- .navi_stat_value {
29567
+ .navi_quantity_value {
29567
29568
  display: inline-block;
29568
29569
  width: 100%;
29569
29570
  text-align: center;
29570
29571
  }
29571
- .navi_stat_body {
29572
- .navi_stat_unit {
29572
+ .navi_quantity_body {
29573
+ .navi_quantity_unit {
29573
29574
  display: inline-block;
29574
29575
  width: 100%;
29575
29576
  text-align: center;
@@ -29578,8 +29579,8 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
29578
29579
  }
29579
29580
  }
29580
29581
  `;
29581
- const StatPseudoClasses = [":hover", ":active", ":read-only", ":disabled", ":-navi-loading"];
29582
- const Stat = ({
29582
+ const QuantityPseudoClasses = [":hover", ":active", ":read-only", ":disabled", ":-navi-loading"];
29583
+ const Quantity = ({
29583
29584
  children,
29584
29585
  unit,
29585
29586
  unitPosition = "right",
@@ -29593,38 +29594,38 @@ const Stat = ({
29593
29594
  disabled,
29594
29595
  ...props
29595
29596
  }) => {
29596
- const value = parseStatValue(children);
29597
+ const value = parseQuantityValue(children);
29597
29598
  const valueRounded = integer && typeof value === "number" ? Math.round(value) : value;
29598
29599
  const valueFormatted = typeof valueRounded === "number" ? formatNumber(valueRounded, {
29599
29600
  lang
29600
29601
  }) : valueRounded;
29601
29602
  const unitBottom = unitPosition === "bottom";
29602
29603
  return jsxs(Text, {
29603
- baseClassName: "navi_stat",
29604
+ baseClassName: "navi_quantity",
29604
29605
  "data-unit-bottom": unitBottom ? "" : undefined,
29605
29606
  basePseudoState: {
29606
29607
  ":read-only": readOnly,
29607
29608
  ":disabled": disabled,
29608
29609
  ":-navi-loading": loading
29609
29610
  },
29610
- pseudoClasses: StatPseudoClasses,
29611
+ pseudoClasses: QuantityPseudoClasses,
29611
29612
  spacing: "pre",
29612
29613
  ...props,
29613
29614
  children: [label && jsx("span", {
29614
- className: "navi_stat_label",
29615
+ className: "navi_quantity_label",
29615
29616
  children: label
29616
29617
  }), jsxs(Text, {
29617
- className: "navi_stat_body",
29618
+ className: "navi_quantity_body",
29618
29619
  size: size,
29619
29620
  spacing: unitBottom ? jsx("br", {}) : undefined,
29620
29621
  children: [jsx("span", {
29621
- className: "navi_stat_value",
29622
+ className: "navi_quantity_value",
29622
29623
  children: loading ? jsx(Icon, {
29623
29624
  flowInline: true,
29624
29625
  children: jsx(LoadingDots, {})
29625
29626
  }) : valueFormatted
29626
29627
  }), unit && jsx("span", {
29627
- className: "navi_stat_unit",
29628
+ className: "navi_quantity_unit",
29628
29629
  style: {
29629
29630
  ...(unitSizeRatio === undefined ? {} : {
29630
29631
  "--unit-size-ratio": unitSizeRatio
@@ -29635,7 +29636,7 @@ const Stat = ({
29635
29636
  })]
29636
29637
  });
29637
29638
  };
29638
- const parseStatValue = children => {
29639
+ const parseQuantityValue = children => {
29639
29640
  if (typeof children !== "string") {
29640
29641
  return children;
29641
29642
  }
@@ -29795,7 +29796,7 @@ const Meter = ({
29795
29796
  const fillRatio = max === min ? 0 : (clampedValue - min) / (max - min);
29796
29797
  let children = caption;
29797
29798
  if (children === undefined && percentage) {
29798
- children = jsx(Stat, {
29799
+ children = jsx(Quantity, {
29799
29800
  unit: "%",
29800
29801
  unitSizeRatio: "1",
29801
29802
  children: Math.round(fillRatio * 100)
@@ -30317,5 +30318,5 @@ const UserSvg = () => jsx("svg", {
30317
30318
  })
30318
30319
  });
30319
30320
 
30320
- export { ActionRenderer, ActiveKeyboardShortcuts, Address, BadgeCount, Box, Button, ButtonCopyToClipboard, Caption, CheckSvg, Checkbox, CheckboxList, Code, Col, Colgroup, ConstructionSvg, Details, DialogLayout, Editable, ErrorBoundaryContext, ExclamationSvg, EyeClosedSvg, EyeSvg, Form, Group, HeartSvg, HomeSvg, Icon, Image, Input, Label, Link, LinkAnchorSvg, LinkBlankTargetSvg, MessageBox, Meter, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, SearchSvg, Select, SelectionContext, Separator, SettingsSvg, StarSvg, Stat, SummaryMarker, Svg, Tab, TabList, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, UserSvg, ViewportLayout, actionIntegratedVia, actionRunEffect, addCustomMessage, arraySignalMembership, compareTwoJsValues, createAction, createAvailableConstraint, createRequestCanceller, createSelectionKeyboardShortcuts, enableDebugActions, enableDebugOnDocumentLoading, forwardActionRequested, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, localStorageSignal, navBack, navForward, navTo, openCallout, rawUrlPart, reload, removeCustomMessage, requestAction, rerunActions, resource, route, routeAction, setBaseUrl, setupRoutes, stateSignal, stopLoad, stringifyTableSelectionValue, updateActions, useActionData, useActionStatus, useArraySignalMembership, useCalloutClose, useCancelPrevious, useCellsAndColumns, useConstraintValidityState, useDependenciesDiff, useDocumentResource, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useMatchingRouteInfo, useNavState$1 as useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, useTitleLevel, useUrlSearchParam, valueInLocalStorage };
30321
+ export { ActionRenderer, ActiveKeyboardShortcuts, Address, BadgeCount, Box, Button, ButtonCopyToClipboard, Caption, CheckSvg, Checkbox, CheckboxList, Code, Col, Colgroup, ConstructionSvg, Details, DialogLayout, Editable, ErrorBoundaryContext, ExclamationSvg, EyeClosedSvg, EyeSvg, Form, Group, HeartSvg, HomeSvg, Icon, Image, Input, Label, Link, LinkAnchorSvg, LinkBlankTargetSvg, MessageBox, Meter, Paragraph, Quantity, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, SearchSvg, Select, SelectionContext, Separator, SettingsSvg, StarSvg, SummaryMarker, Svg, Tab, TabList, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, UserSvg, ViewportLayout, actionIntegratedVia, actionRunEffect, addCustomMessage, arraySignalMembership, compareTwoJsValues, createAction, createAvailableConstraint, createRequestCanceller, createSelectionKeyboardShortcuts, enableDebugActions, enableDebugOnDocumentLoading, forwardActionRequested, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, localStorageSignal, navBack, navForward, navTo, openCallout, rawUrlPart, reload, removeCustomMessage, requestAction, rerunActions, resource, route, routeAction, setBaseUrl, setupRoutes, stateSignal, stopLoad, stringifyTableSelectionValue, updateActions, useActionData, useActionStatus, useArraySignalMembership, useCalloutClose, useCancelPrevious, useCellsAndColumns, useConstraintValidityState, useDependenciesDiff, useDocumentResource, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useMatchingRouteInfo, useNavState$1 as useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, useTitleLevel, useUrlSearchParam, valueInLocalStorage };
30321
30322
  //# sourceMappingURL=jsenv_navi.js.map