@jsenv/navi 0.12.40 → 0.12.42

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.
@@ -7741,6 +7741,7 @@ const createRoute = (urlPatternInput) => {
7741
7741
  hasRawUrlPartWithInvalidChars,
7742
7742
  };
7743
7743
  };
7744
+ route.buildRelativeUrl = buildRelativeUrl;
7744
7745
 
7745
7746
  /**
7746
7747
  * Builds a complete URL for this route with the given parameters.
@@ -8120,6 +8121,40 @@ const updateDocumentUrl = (value) => {
8120
8121
  documentUrlSignal.value = value;
8121
8122
  };
8122
8123
 
8124
+ const documentResourceSignal = computed(() => {
8125
+ const documentUrl = documentUrlSignal.value;
8126
+ const documentResource = urlToResource(documentUrl);
8127
+ return documentResource;
8128
+ });
8129
+ const useDocumentResource = () => {
8130
+ return documentResourceSignal.value;
8131
+ };
8132
+ const urlToResource = (url) => {
8133
+ const scheme = urlToScheme(url);
8134
+ if (scheme === "file") {
8135
+ const urlAsStringWithoutFileProtocol = String(url).slice("file://".length);
8136
+ return urlAsStringWithoutFileProtocol;
8137
+ }
8138
+ if (scheme === "https" || scheme === "http") {
8139
+ // remove origin
8140
+ const afterProtocol = String(url).slice(scheme.length + "://".length);
8141
+ const pathnameSlashIndex = afterProtocol.indexOf("/", "://".length);
8142
+ const urlAsStringWithoutOrigin = afterProtocol.slice(pathnameSlashIndex);
8143
+ return urlAsStringWithoutOrigin;
8144
+ }
8145
+ const urlAsStringWithoutProtocol = String(url).slice(scheme.length + 1);
8146
+ return urlAsStringWithoutProtocol;
8147
+ };
8148
+ const urlToScheme = (url) => {
8149
+ const urlString = String(url);
8150
+ const colonIndex = urlString.indexOf(":");
8151
+ if (colonIndex === -1) {
8152
+ return "";
8153
+ }
8154
+ const scheme = urlString.slice(0, colonIndex);
8155
+ return scheme;
8156
+ };
8157
+
8123
8158
  const getHrefTargetInfo = (href) => {
8124
8159
  href = String(href);
8125
8160
 
@@ -8340,7 +8375,8 @@ const setupBrowserIntegrationViaHistory = ({
8340
8375
  });
8341
8376
  });
8342
8377
 
8343
- const goTo = async (url, { state = null, replace } = {}) => {
8378
+ const goTo = async (target, { state = null, replace } = {}) => {
8379
+ const url = new URL(target, window.location.href).href;
8344
8380
  const currentUrl = documentUrlSignal.peek();
8345
8381
  if (url === currentUrl) {
8346
8382
  return;
@@ -8566,11 +8602,11 @@ const useNavStateBasic = (id, initialValue, { debug } = {}) => {
8566
8602
  const useNavState = useNavStateBasic;
8567
8603
 
8568
8604
  const NEVER_SET = {};
8569
- const useUrlSearchParam = (paramName) => {
8605
+ const useUrlSearchParam = (paramName, defaultValue) => {
8570
8606
  const documentUrl = documentUrlSignal.value;
8571
8607
  const searchParam = new URL(documentUrl).searchParams.get(paramName);
8572
8608
  const valueRef = useRef(NEVER_SET);
8573
- const [value, setValue] = useState();
8609
+ const [value, setValue] = useState(defaultValue);
8574
8610
  if (valueRef.current !== searchParam) {
8575
8611
  valueRef.current = searchParam;
8576
8612
  setValue(searchParam);
@@ -14669,9 +14705,9 @@ installImportMetaCss(import.meta);import.meta.css = /* css */`
14669
14705
  cursor: default;
14670
14706
  }
14671
14707
  .navi_button[data-disabled] {
14672
- --x-border-color: var(--button-border-color-disabled);
14673
- --x-background-color: var(--button-background-color-disabled);
14674
- --x-color: var(--button-color-disabled);
14708
+ --x-button-border-color: var(--button-border-color-disabled);
14709
+ --x-button-background-color: var(--button-background-color-disabled);
14710
+ --x-button-color: var(--button-color-disabled);
14675
14711
  }
14676
14712
  /* no active effect */
14677
14713
  .navi_button[data-disabled] .navi_button_content {
@@ -14779,7 +14815,7 @@ const ButtonBasic = props => {
14779
14815
  })]
14780
14816
  });
14781
14817
  };
14782
- const renderButtonContentMemoized = useCallback(renderButtonContent, []);
14818
+ const renderButtonContentMemoized = useCallback(renderButtonContent, [children]);
14783
14819
  return jsxs(Box, {
14784
14820
  ...rest,
14785
14821
  as: "button",
@@ -22674,5 +22710,5 @@ const UserSvg = () => jsx("svg", {
22674
22710
  })
22675
22711
  });
22676
22712
 
22677
- export { ActionRenderer, ActiveKeyboardShortcuts, BadgeCount, Box, Button, Caption, CheckSvg, Checkbox, CheckboxList, Code, Col, Colgroup, Details, DialogLayout, Editable, ErrorBoundaryContext, ExclamationSvg, FontSizedSvg, Form, HeartSvg, HomeSvg, Icon, IconAndText, Image, Input, Label, Layout, Link, LinkAnchorSvg, LinkBlankTargetSvg, LinkWithIcon, MessageBox, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, SearchSvg, Select, SelectionContext, SettingsSvg, StarSvg, SummaryMarker, Svg, Tab, TabList, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, UserSvg, ViewportLayout, actionIntegratedVia, addCustomMessage, createAction, createSelectionKeyboardShortcuts, createUniqueValueConstraint, enableDebugActions, enableDebugOnDocumentLoading, forwardActionRequested, goBack, goForward, goTo, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, openCallout, rawUrlPart, reload, removeCustomMessage, rerunActions, resource, setBaseUrl, setupRoutes, stopLoad, stringifyTableSelectionValue, updateActions, useActionData, useActionStatus, useActiveRouteInfo, useCellsAndColumns, useDependenciesDiff, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, useUrlSearchParam, valueInLocalStorage };
22713
+ export { ActionRenderer, ActiveKeyboardShortcuts, BadgeCount, Box, Button, Caption, CheckSvg, Checkbox, CheckboxList, Code, Col, Colgroup, Details, DialogLayout, Editable, ErrorBoundaryContext, ExclamationSvg, FontSizedSvg, Form, HeartSvg, HomeSvg, Icon, IconAndText, Image, Input, Label, Layout, Link, LinkAnchorSvg, LinkBlankTargetSvg, LinkWithIcon, MessageBox, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, SearchSvg, Select, SelectionContext, SettingsSvg, StarSvg, SummaryMarker, Svg, Tab, TabList, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, UserSvg, ViewportLayout, actionIntegratedVia, addCustomMessage, createAction, createSelectionKeyboardShortcuts, createUniqueValueConstraint, enableDebugActions, enableDebugOnDocumentLoading, forwardActionRequested, goBack, goForward, goTo, installCustomConstraintValidation, isCellSelected, isColumnSelected, isRowSelected, openCallout, rawUrlPart, reload, removeCustomMessage, rerunActions, resource, setBaseUrl, setupRoutes, stopLoad, stringifyTableSelectionValue, updateActions, useActionData, useActionStatus, useActiveRouteInfo, useCellsAndColumns, useDependenciesDiff, useDocumentResource, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, useUrlSearchParam, valueInLocalStorage };
22678
22714
  //# sourceMappingURL=jsenv_navi.js.map