@jsenv/navi 0.12.6 → 0.12.7

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.
@@ -8555,6 +8555,27 @@ const useNavStateBasic = (id, initialValue, { debug } = {}) => {
8555
8555
 
8556
8556
  const useNavState = useNavStateBasic;
8557
8557
 
8558
+ const NEVER_SET = {};
8559
+ const useUrlSearchParam = (paramName) => {
8560
+ const documentUrl = documentUrlSignal.value;
8561
+ const searchParam = new URL(documentUrl).searchParams.get(paramName);
8562
+ const valueRef = useRef(NEVER_SET);
8563
+ const [value, setValue] = useState();
8564
+ if (valueRef.current !== searchParam) {
8565
+ valueRef.current = searchParam;
8566
+ setValue(searchParam);
8567
+ }
8568
+
8569
+ const setSearchParamValue = (newValue, { replace = true } = {}) => {
8570
+ const newUrlObject = new URL(window.location.href);
8571
+ newUrlObject.searchParams.set(paramName, newValue);
8572
+ const newUrl = newUrlObject.href;
8573
+ goTo(newUrl, { replace });
8574
+ };
8575
+
8576
+ return [value, setSearchParamValue];
8577
+ };
8578
+
8558
8579
  /**
8559
8580
  * UITransition
8560
8581
  *
@@ -20550,5 +20571,5 @@ const useDependenciesDiff = (inputs) => {
20550
20571
  return diffRef.current;
20551
20572
  };
20552
20573
 
20553
- export { ActionRenderer, ActiveKeyboardShortcuts, Box, Button, CharSlot, Checkbox, CheckboxList, Code, Col, Colgroup, Count, Details, Editable, ErrorBoundaryContext, FontSizedSvg, Form, Icon, IconAndText, Image, Input, Label, Layout, Link, LinkWithIcon, MessageBox, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, Select, SelectionContext, SummaryMarker, Svg, Tab, TabList, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, 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, useCellsAndColumns, useDependenciesDiff, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, valueInLocalStorage };
20574
+ export { ActionRenderer, ActiveKeyboardShortcuts, Box, Button, CharSlot, Checkbox, CheckboxList, Code, Col, Colgroup, Count, Details, Editable, ErrorBoundaryContext, FontSizedSvg, Form, Icon, IconAndText, Image, Input, Label, Layout, Link, LinkWithIcon, MessageBox, Paragraph, Radio, RadioList, Route, RouteLink, Routes, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, Select, SelectionContext, SummaryMarker, Svg, Tab, TabList, Table, TableCell, Tbody, Text, Thead, Title, Tr, UITransition, 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, useCellsAndColumns, useDependenciesDiff, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, useUrlSearchParam, valueInLocalStorage };
20554
20575
  //# sourceMappingURL=jsenv_navi.js.map