@jsenv/navi 0.25.10 → 0.26.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.
@@ -6287,6 +6287,7 @@ const FLOW_PROPS = {
6287
6287
  flex: () => {},
6288
6288
  grid: () => {},
6289
6289
  gridTemplateColumns: PASS_THROUGH,
6290
+ display: PASS_THROUGH, // in case people write "display: none" (even if hidden prop is recommended)
6290
6291
  row: () => {},
6291
6292
  column: () => {},
6292
6293
  };
@@ -8223,6 +8224,19 @@ import.meta.css = [/* css */`
8223
8224
  grid-auto-flow: unset;
8224
8225
  }
8225
8226
  }
8227
+ /*
8228
+
8229
+ It's very common to declare a display on component as follow
8230
+ .component_class { display: component_display; }
8231
+
8232
+ This kill the default behavior of [hidden] attribute and we need to explicitly handle it with:
8233
+ .component_class[hidden] { display: none; }
8234
+
8235
+ To avoid this extra work and potential mistakes we force the default behavior of [hidden] attribute.
8236
+ */
8237
+ [hidden] {
8238
+ display: none !important;
8239
+ }
8226
8240
  `, "@jsenv/navi/src/box/box.jsx"];
8227
8241
  const PSEUDO_CLASSES_DEFAULT = [];
8228
8242
  const PSEUDO_ELEMENTS_DEFAULT = [];
@@ -27212,9 +27226,6 @@ const css$l = /* css */`
27212
27226
  cursor: not-allowed;
27213
27227
  pointer-events: none;
27214
27228
  }
27215
- &[hidden] {
27216
- display: none;
27217
- }
27218
27229
  }
27219
27230
 
27220
27231
  .navi_list_container {
@@ -27290,9 +27301,6 @@ const css$l = /* css */`
27290
27301
  text-align: center;
27291
27302
  user-select: none;
27292
27303
  }
27293
- &[hidden] {
27294
- display: none;
27295
- }
27296
27304
  }
27297
27305
  [navi-virtual-filler="bottom"] {
27298
27306
  /* for some reason preact ends up puttin this element before the list items in some scenarios
@@ -30974,7 +30982,7 @@ installImportMetaCssBuild(import.meta);const css$f = /* css */`
30974
30982
 
30975
30983
  &[hidden] {
30976
30984
  /* We keep placeholder in the dom in case it dictates the select width, this way select wont shrink once a value is selected */
30977
- display: inline-block;
30985
+ display: inline-block !important;
30978
30986
  height: 0;
30979
30987
  padding-block: 0;
30980
30988
  visibility: hidden;
@@ -36398,6 +36406,100 @@ const CodeBox = ({
36398
36406
  });
36399
36407
  };
36400
36408
 
36409
+ /*
36410
+ * Technical note: although the component is named Interpolate and its primary
36411
+ * use-case is text, it can render any mix of strings and JSX elements — 99% of
36412
+ * the time it is used for text though.
36413
+ *
36414
+ * Why use Interpolate instead of plain JSX?
36415
+ *
36416
+ * Without Interpolate, the sentence is scattered across JSX expressions:
36417
+ *
36418
+ * ```jsx
36419
+ * // harder to read — the full sentence is not visible at once
36420
+ * // cannot be used as an i18n key
36421
+ * Données limitées à <Text bold>{radius} km</Text> autour de
36422
+ * {zoneName || "votre zone"}.
36423
+ * ```
36424
+ *
36425
+ * With Interpolate, the full sentence is visible in one place:
36426
+ *
36427
+ * ```jsx
36428
+ * // readable — the sentence reads as prose
36429
+ * // i18n-ready — the template string is a plain JS-free key
36430
+ * <Interpolate radiusKm={<Text bold>{radius} km</Text>} zoneName={zoneName || "votre zone"}>
36431
+ * Données limitées à [radiusKm] autour de [zoneName].
36432
+ * </Interpolate>
36433
+ * ```
36434
+ *
36435
+ * Why [key] syntax was chosen for placeholders:
36436
+ *
36437
+ * {} / ${} / {{}} — interpreted by JSX; using them would force wrapping the
36438
+ * whole string in an expression, defeating the readability
36439
+ * goal.
36440
+ *
36441
+ * %key% — common in sprintf-style libraries, but the doubled %% hurts
36442
+ * readability. It also carries the implicit expectation of
36443
+ * format specifiers (cast to string/number, padding…) that
36444
+ * this component does not support, which would mislead readers.
36445
+ *
36446
+ * :key: — visually clean, but the colon conflicts with punctuation.
36447
+ * Compare: "Hello :name:. How are you?"
36448
+ * vs "Hello [name]. How are you?"
36449
+ * The period after :name: is ambiguous at a glance.
36450
+ *
36451
+ * <key> — not possible; JSX treats it as an opening tag.
36452
+ */
36453
+
36454
+ /**
36455
+ * Renders a template string with [key] placeholders replaced by props.
36456
+ * Replacement values can be strings or JSX elements.
36457
+ * Returns a plain string when all replacements are strings, a fragment otherwise.
36458
+ *
36459
+ * Keeps the full sentence readable in one place and makes the string
36460
+ * i18n-ready, since the template contains no JSX expressions.
36461
+ *
36462
+ * @example
36463
+ * <Interpolate radiusKm={<Text bold>50 km</Text>} zoneName="votre zone">
36464
+ * Données limitées à [radiusKm] autour de [zoneName].
36465
+ * </Interpolate>
36466
+ */
36467
+ const Interpolate = ({
36468
+ children,
36469
+ ...replacements
36470
+ }) => {
36471
+ return interpolateText(children, replacements);
36472
+ };
36473
+
36474
+ /**
36475
+ * Interpolates a template string, replacing [key] placeholders with values.
36476
+ * Values can be strings or JSX elements. Returns a plain string when all
36477
+ * replacements are strings, or a JSX fragment otherwise.
36478
+ */
36479
+ const interpolateText = (template, replacements) => {
36480
+ const parts = template.split(/(\[[^\]]+\])/);
36481
+ let hasVnode = false;
36482
+ const resolved = [];
36483
+ for (const part of parts) {
36484
+ const match = part.match(/^\[([^\]]+)\]$/);
36485
+ if (!match) {
36486
+ resolved.push(part);
36487
+ continue;
36488
+ }
36489
+ const value = replacements[match[1]] ?? part;
36490
+ if (value !== null && typeof value === "object") {
36491
+ hasVnode = true;
36492
+ }
36493
+ resolved.push(value);
36494
+ }
36495
+ if (!hasVnode) {
36496
+ return resolved.join("");
36497
+ }
36498
+ return jsx(Fragment, {
36499
+ children: resolved
36500
+ });
36501
+ };
36502
+
36401
36503
  const navigator = typeof window === "undefined" ? undefined : window.navigator;
36402
36504
  const browserLang =
36403
36505
  typeof navigator !== "undefined"
@@ -37547,5 +37649,5 @@ const UserSvg = () => jsx("svg", {
37547
37649
  })
37548
37650
  });
37549
37651
 
37550
- export { ActionRenderer, ActiveKeyboardShortcuts, Address, Badge, BadgeCount, Box, Button, ButtonCopyToClipboard, Caption, CheckSvg, Checkbox, CheckboxList, CloseSvg, Code, Col, Colgroup, ConstructionSvg, Details, Dialog, DialogLayout, Editable, ErrorBoundary, ErrorBoundaryContext, ExclamationSvg, EyeClosedSvg, EyeSvg, Form, Group, Head, HeartSvg, HomeSvg, Icon, Image, Input, Label, Link, LinkAnchorSvg, LinkBlankTargetSvg, LinkCurrentSvg, List, ListItem, ListItemFooter, ListItemGroup, ListItemHeader, Loading, MessageBox, Meter, Nav, NaviDebug, Paragraph, Popover, Quantity, QuantityIntl, Radio, RadioList, Route, RowNumberCol, RowNumberTableCell, SVGMaskOverlay, SearchSvg, Select, SelectionContext, Separator, SettingsSvg, SidePanel, StarSvg, SummaryMarker, Svg, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, UserSvg, ViewportLayout, actionIntegratedVia, actionRunEffect, addCustomMessage, applySearch, arraySignalMembership, compareTwoJsValues, createAction, createAvailableConstraint, createIntl, createRequestCanceller, createSearch, createSelectionKeyboardShortcuts, enableDebugActions, enableDebugOnDocumentLoading, filterTableSelection, forwardActionRequested, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, localStorageSignal, navBack, navForward, navTo, openCallout, rawUrlPart, reload, removeCustomMessage, requestAction, requestListClose, requestListOpen, rerunActions, resource, route, routeAction, setBaseUrl, setupRoutes, stateSignal, stopLoad, stringifyTableSelectionValue, syncOwnedResourceToSignals, syncResourceToSignals, updateActions, useActionStatus, useArraySignalMembership, useAsyncData, useCalloutClose, useCancelPrevious, useCellGridFromRows, useConstraintValidityState, useDependenciesDiff, useDisplayedLayoutEffect, useDocumentResource, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useOrderedColumns, useRouteStatus, useRunOnMount, useSearchText, useSelectRequestClose, useSelectableElement, useSelectionController, useSidePanelClose, useSignalSync, useStateArray, useTitleLevel, useUrlSearchParam, valueInLocalStorage, windowWidthSignal };
37652
+ export { ActionRenderer, ActiveKeyboardShortcuts, Address, Badge, BadgeCount, Box, Button, ButtonCopyToClipboard, Caption, CheckSvg, Checkbox, CheckboxList, CloseSvg, Code, Col, Colgroup, ConstructionSvg, Details, Dialog, DialogLayout, Editable, ErrorBoundary, ErrorBoundaryContext, ExclamationSvg, EyeClosedSvg, EyeSvg, Form, Group, Head, HeartSvg, HomeSvg, Icon, Image, Input, Interpolate, Label, Link, LinkAnchorSvg, LinkBlankTargetSvg, LinkCurrentSvg, List, ListItem, ListItemFooter, ListItemGroup, ListItemHeader, Loading, MessageBox, Meter, Nav, NaviDebug, Paragraph, Popover, Quantity, QuantityIntl, Radio, RadioList, Route, RowNumberCol, RowNumberTableCell, SVGMaskOverlay, SearchSvg, Select, SelectionContext, Separator, SettingsSvg, SidePanel, StarSvg, SummaryMarker, Svg, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, UserSvg, ViewportLayout, actionIntegratedVia, actionRunEffect, addCustomMessage, applySearch, arraySignalMembership, compareTwoJsValues, createAction, createAvailableConstraint, createIntl, createRequestCanceller, createSearch, createSelectionKeyboardShortcuts, enableDebugActions, enableDebugOnDocumentLoading, filterTableSelection, forwardActionRequested, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, localStorageSignal, navBack, navForward, navTo, openCallout, rawUrlPart, reload, removeCustomMessage, requestAction, requestListClose, requestListOpen, rerunActions, resource, route, routeAction, setBaseUrl, setupRoutes, stateSignal, stopLoad, stringifyTableSelectionValue, syncOwnedResourceToSignals, syncResourceToSignals, updateActions, useActionStatus, useArraySignalMembership, useAsyncData, useCalloutClose, useCancelPrevious, useCellGridFromRows, useConstraintValidityState, useDependenciesDiff, useDisplayedLayoutEffect, useDocumentResource, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useOrderedColumns, useRouteStatus, useRunOnMount, useSearchText, useSelectRequestClose, useSelectableElement, useSelectionController, useSidePanelClose, useSignalSync, useStateArray, useTitleLevel, useUrlSearchParam, valueInLocalStorage, windowWidthSignal };
37551
37653
  //# sourceMappingURL=jsenv_navi.js.map