@trackunit/react-components 3.12.4-alpha-10f2d9d2ab3.0 → 4.0.0

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.
Files changed (60) hide show
  1. package/index.cjs.js +104 -959
  2. package/index.esm.js +102 -952
  3. package/migrations/assets/react-router-components/package.json +23 -0
  4. package/migrations/utils/move-named-imports.js +409 -0
  5. package/migrations/utils/package-json-utils.js +73 -0
  6. package/migrations/v4-0-0/move-to-router-components.js +71 -0
  7. package/migrations.json +5 -0
  8. package/package.json +6 -7
  9. package/src/components/ExternalLink/ExternalLink.d.ts +2 -2
  10. package/src/index.d.ts +0 -4
  11. package/translation.cjs.js +0 -1
  12. package/translation.esm.js +0 -1
  13. package/translation10.cjs.js +0 -1
  14. package/translation10.esm.js +0 -1
  15. package/translation11.cjs.js +0 -1
  16. package/translation11.esm.js +0 -1
  17. package/translation12.cjs.js +0 -1
  18. package/translation12.esm.js +0 -1
  19. package/translation13.cjs.js +0 -1
  20. package/translation13.esm.js +0 -1
  21. package/translation14.cjs.js +0 -1
  22. package/translation14.esm.js +0 -1
  23. package/translation15.cjs.js +0 -1
  24. package/translation15.esm.js +0 -1
  25. package/translation16.cjs.js +0 -1
  26. package/translation16.esm.js +0 -1
  27. package/translation17.cjs.js +0 -1
  28. package/translation17.esm.js +0 -1
  29. package/translation2.cjs.js +0 -1
  30. package/translation2.esm.js +0 -1
  31. package/translation3.cjs.js +0 -1
  32. package/translation3.esm.js +0 -1
  33. package/translation4.cjs.js +0 -1
  34. package/translation4.esm.js +0 -1
  35. package/translation5.cjs.js +0 -1
  36. package/translation5.esm.js +0 -1
  37. package/translation6.cjs.js +0 -1
  38. package/translation6.esm.js +0 -1
  39. package/translation7.cjs.js +0 -1
  40. package/translation7.esm.js +0 -1
  41. package/translation8.cjs.js +0 -1
  42. package/translation8.esm.js +0 -1
  43. package/translation9.cjs.js +0 -1
  44. package/translation9.esm.js +0 -1
  45. package/src/components/Breadcrumb/Breadcrumb.d.ts +0 -39
  46. package/src/components/Breadcrumb/Breadcrumb.variant.d.ts +0 -45
  47. package/src/components/Breadcrumb/BreadcrumbContainer.d.ts +0 -8
  48. package/src/components/Breadcrumb/BreadcrumbForLargeScreen.d.ts +0 -6
  49. package/src/components/Breadcrumb/BreadcrumbForMediumScreen.d.ts +0 -6
  50. package/src/components/Breadcrumb/BreadcrumbForSmallScreen.d.ts +0 -6
  51. package/src/components/Breadcrumb/BreadcrumbItem.d.ts +0 -6
  52. package/src/components/Breadcrumb/utils/types.d.ts +0 -28
  53. package/src/components/Breadcrumb/utils/useBreadcrumbItemsToRender.d.ts +0 -6
  54. package/src/hooks/persistence/hashFragment.d.ts +0 -70
  55. package/src/hooks/persistence/readPrimitiveSearchParam.d.ts +0 -8
  56. package/src/hooks/persistence/urlIdentity.d.ts +0 -64
  57. package/src/hooks/persistence/usePersistedState.d.ts +0 -117
  58. package/src/hooks/persistence/useSearchParamSync.d.ts +0 -17
  59. package/src/hooks/persistence/useUrlParamSync.d.ts +0 -71
  60. package/src/hooks/useCursorUrlSync.d.ts +0 -23
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "ausklappen",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "ausklappen",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "rozwiń",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "rozwiń",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "expandir",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "expandir",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "развернуть",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "развернуть",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "extindere",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "extindere",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "expandir",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "expandir",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "expandera",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "expandera",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "展開",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "展開",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "ขยาย",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "ขยาย",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "udvid",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "udvid",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "rozbalit",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "rozbalit",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "uitklappen",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "uitklappen",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "développer",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "développer",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "laajenna",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "laajenna",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "kibontás",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "kibontás",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "espandi",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "espandi",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -2,7 +2,6 @@
2
2
 
3
3
  var translation = {
4
4
  "breadcrumb.backButton": "Back",
5
- "breadcrumb.expandButton": "utvid",
6
5
  "copyableValue.copyValue": "Copy {{value}}",
7
6
  "copyButton.copied": "Copied!",
8
7
  "copyButton.copy": "Copy",
@@ -1,6 +1,5 @@
1
1
  var translation = {
2
2
  "breadcrumb.backButton": "Back",
3
- "breadcrumb.expandButton": "utvid",
4
3
  "copyableValue.copyValue": "Copy {{value}}",
5
4
  "copyButton.copied": "Copied!",
6
5
  "copyButton.copy": "Copy",
@@ -1,39 +0,0 @@
1
- import { ReactElement } from "react";
2
- import { BreadcrumbProps } from "./utils/types";
3
- /**
4
- * The breadcrumb component shows a user's location in a website or application. Breadcrumbs are particularly useful when a large amount of content is organized in a hierarchical manner. They streamline navigation, minimize the steps required to revisit previous pages, and offer contextual insights to the users.
5
- *
6
- * All items except the last are rendered as clickable links. The last item is rendered as plain text representing the current page.
7
- * The component automatically adapts to the screen size: on large screens all items are visible, on medium screens middle items collapse behind an ellipsis button, and on small screens only the current page is shown.
8
- *
9
- * ### When to use
10
- * Use breadcrumbs when deep navigation is available, on apps or pages where users might dive into content and could benefit from a quick way to return to higher levels. Breadcrumbs display the current screen as the final item in the list to make it clear where the user is.
11
- *
12
- * ### When not to use
13
- * Do not use on the first hierarchal level, such as a home page or a main page, as there is no previous step the user can get to.
14
- * Avoid using breadcrumbs to indicate forthcoming steps. For processes with sequential steps, use a wizard flow instead.
15
- *
16
- * @example Basic breadcrumb navigation
17
- * ```tsx
18
- * import { Breadcrumb } from "@trackunit/react-components";
19
- * import { useNavigate } from "@tanstack/react-router";
20
- *
21
- * const AssetDetailBreadcrumb = () => {
22
- * const navigate = useNavigate();
23
- *
24
- * return (
25
- * <Breadcrumb
26
- * breadcrumbItems={[
27
- * { label: "Fleet", to: "/fleet" },
28
- * { label: "Assets", to: "/fleet/assets" },
29
- * { label: "Excavator 001", to: "/fleet/assets/123" },
30
- * ]}
31
- * onClickBack={() => navigate({ to: "/fleet/assets" })}
32
- * />
33
- * );
34
- * };
35
- * ```
36
- * @param {BreadcrumbProps} props - The props for the Breadcrumb component
37
- * @returns {ReactElement} Breadcrumb component
38
- */
39
- export declare const Breadcrumb: ({ className, "data-testid": dataTestId, breadcrumbItems, onClickBack, style, ref, }: BreadcrumbProps) => ReactElement;
@@ -1,45 +0,0 @@
1
- export declare const cvaBreadcrumb: import("cva").CVAComponent<Omit<{
2
- base: string[];
3
- }, "defaultVariants"> & {
4
- variants: unknown;
5
- defaultVariants: Omit<{}, never>;
6
- }, unknown>;
7
- export declare const cvaBreadcrumbItem: import("cva").CVAComponent<Omit<{
8
- base: string[];
9
- }, "defaultVariants"> & {
10
- variants: unknown;
11
- defaultVariants: Omit<{}, never>;
12
- }, unknown>;
13
- export declare const cvaBreadcrumbForLargeScreen: import("cva").CVAComponent<Omit<{
14
- base: string[];
15
- }, "defaultVariants"> & {
16
- variants: unknown;
17
- defaultVariants: Omit<{}, never>;
18
- }, unknown>;
19
- export declare const cvaBreadcrumbForMediumScreen: import("cva").CVAComponent<Omit<{
20
- base: string[];
21
- variants: {
22
- expanded: {
23
- true: string;
24
- false: string;
25
- };
26
- };
27
- defaultVariants: {
28
- expanded: false;
29
- };
30
- }, "defaultVariants"> & {
31
- variants: {
32
- expanded: {
33
- true: string;
34
- false: string;
35
- };
36
- };
37
- defaultVariants: Omit<{}, "expanded"> & {
38
- expanded: false;
39
- };
40
- }, {
41
- expanded: {
42
- true: string;
43
- false: string;
44
- };
45
- }>;
@@ -1,8 +0,0 @@
1
- import { ReactElement } from "react";
2
- import { BreadcrumbContainerProps } from "./utils/types";
3
- /**
4
- * BreadcrumbContainer is a helper component that renders the breadcrumb items based on the screen size.
5
- *
6
- * @param {BreadcrumbContainerProps} props - The props for the BreadcrumbContainer component
7
- */
8
- export declare const BreadcrumbContainer: ({ className, "data-testid": dataTestId, breadcrumbItems, style, ref, }: BreadcrumbContainerProps) => ReactElement;
@@ -1,6 +0,0 @@
1
- import { ReactElement } from "react";
2
- import { BreadcrumbContainerProps } from "./utils/types";
3
- /**
4
- * BreadcrumbForLargeScreen is a helper component that renders the breadcrumb items for large screens.
5
- */
6
- export declare const BreadcrumbForLargeScreen: ({ "data-testid": dataTestId, breadcrumbItems, className, style, }: BreadcrumbContainerProps) => ReactElement;
@@ -1,6 +0,0 @@
1
- import { ReactElement } from "react";
2
- import { BreadcrumbForMediumScreenProps } from "./utils/types";
3
- /**
4
- * BreadcrumbForMediumScreen is a helper component that renders the breadcrumb items for medium screens.
5
- */
6
- export declare const BreadcrumbForMediumScreen: ({ "data-testid": dataTestId, breadcrumbItems, className, style, }: BreadcrumbForMediumScreenProps) => ReactElement;
@@ -1,6 +0,0 @@
1
- import { ReactElement } from "react";
2
- import { BreadcrumbContainerProps } from "./utils/types";
3
- /**
4
- * BreadcrumbForSmallScreen is a helper component that renders the breadcrumb items for small screens.
5
- */
6
- export declare const BreadcrumbForSmallScreen: ({ "data-testid": dataTestId, breadcrumbItems, className, style, }: BreadcrumbContainerProps) => ReactElement;
@@ -1,6 +0,0 @@
1
- import { ReactElement } from "react";
2
- import { BreadcrumbItemRenderProps } from "./utils/types";
3
- /**
4
- * BreadcrumbItem is a helper component that renders the individual breadcrumb item.
5
- */
6
- export declare const BreadcrumbItem: ({ item, "data-testid": dataTestId, className, style, }: BreadcrumbItemRenderProps) => ReactElement;
@@ -1,28 +0,0 @@
1
- import { MouseEventHandler, ReactElement } from "react";
2
- import { CommonProps } from "../../../common/CommonProps";
3
- import { Refable } from "../../../common/Refable";
4
- import type { Styleable } from "../../../common/Styleable";
5
- export interface BreadcrumbItemProps {
6
- /** The display text for this breadcrumb item. */
7
- label: string;
8
- /** The route path this breadcrumb item links to. */
9
- to: string;
10
- }
11
- export interface BreadcrumbProps extends CommonProps, Styleable, Refable<HTMLDivElement> {
12
- /**
13
- * The ordered list of breadcrumb items representing the navigation hierarchy.
14
- * The last item is rendered as plain text (the current page), all preceding items are rendered as clickable links.
15
- */
16
- breadcrumbItems: Array<BreadcrumbItemProps>;
17
- /**
18
- * Click handler for the back arrow button. Typically navigates to the previous breadcrumb item (second-to-last in the list).
19
- */
20
- onClickBack: MouseEventHandler<HTMLButtonElement>;
21
- }
22
- export interface BreadcrumbContainerProps extends CommonProps, Styleable, Refable<HTMLDivElement> {
23
- breadcrumbItems: Array<ReactElement<BreadcrumbItemProps>>;
24
- }
25
- export type BreadcrumbForMediumScreenProps = BreadcrumbContainerProps;
26
- export interface BreadcrumbItemRenderProps extends CommonProps, Styleable {
27
- item: ReactElement<BreadcrumbItemProps>;
28
- }
@@ -1,6 +0,0 @@
1
- import { ReactElement } from "react";
2
- import { BreadcrumbItemProps } from "./types";
3
- /**
4
- * useBreadcrumbItemsToRender is a custom hook that takes an array of BreadcrumbItemProps and returns an array of React.ReactElement
5
- */
6
- export declare const useBreadcrumbItemsToRender: (breadcrumbItems: Array<BreadcrumbItemProps>) => Array<ReactElement<BreadcrumbItemProps>>;
@@ -1,70 +0,0 @@
1
- /**
2
- * Pure utilities for reading and writing single named entries inside a URL
3
- * fragment (the part after `#`).
4
- *
5
- * # Format contract
6
- *
7
- * The fragment body (after the leading `#`) is treated as a sequence of
8
- * `&`-separated tokens. A token may be:
9
- * - **A named entry** — `<key>=<value>` (the first `=` separates key from
10
- * value; later `=` chars are part of the value).
11
- * - **Foreign content** — anything else (bare scroll anchors like
12
- * `section`, hash routes, third-party data, malformed tokens). Foreign
13
- * tokens are preserved byte-for-byte, in their original positions.
14
- *
15
- * # Single-key ownership
16
- *
17
- * Callers operate on **one** named key per invocation. Every token whose
18
- * key does not match the supplied key is foreign — the utility never
19
- * categorises or rewrites it. This mirrors how `useSearchParamSync`
20
- * treats a single named search param.
21
- *
22
- * # Value-encoding invariant
23
- *
24
- * Values passed to {@link writeHashKey} must not contain `&`, `=`, or `#`.
25
- * The standard producer for this codebase is `useCustomEncoding`, whose
26
- * base64url alphabet (`[A-Za-z0-9_-]`) satisfies the invariant by
27
- * construction. Keys are restricted by the existing persistence-key
28
- * schema (camelCase, ≤15 chars), so they are likewise safe.
29
- *
30
- * # Anchor-scroll caveat
31
- *
32
- * Browsers locate scroll targets by matching the entire fragment string
33
- * against element IDs. Appending a named entry to a fragment containing
34
- * a bare anchor (e.g. `#section` becoming `#section&userTableTp=...`)
35
- * therefore breaks anchor scrolling on that page. This is unavoidable
36
- * for any hash-backed shared state. Consumers that rely on scroll
37
- * anchors should not also persist state to the hash on the same route.
38
- */
39
- /**
40
- * Reads the value of a single named entry from a URL fragment.
41
- *
42
- * @param hash - The fragment string, with or without the leading `#`.
43
- * @param key - The entry key to look up.
44
- * @returns {string | undefined} The raw value (everything after the first
45
- * `=` in the matching token), or `undefined` when the key is absent. An
46
- * entry whose token has no `=` is treated as foreign content and ignored.
47
- */
48
- export declare const readHashKey: (hash: string, key: string) => string | undefined;
49
- /**
50
- * Lists the key of every named entry in a URL fragment, in order of first
51
- * appearance. Foreign tokens (no `=`) are skipped and duplicates collapse.
52
- *
53
- * @param hash - The fragment string, with or without the leading `#`.
54
- * @returns {Array<string>} The distinct entry keys.
55
- */
56
- export declare const listHashKeys: (hash: string) => Array<string>;
57
- /**
58
- * Returns a new fragment string with the named entry written, replaced,
59
- * or removed. Foreign tokens are preserved in their original order; the
60
- * named entry retains its position if it already exists, and is appended
61
- * to the end when newly inserted. Empty tokens (e.g. produced by
62
- * consecutive `&`) are dropped on the way out.
63
- *
64
- * @param hash - The current fragment string, with or without the leading `#`.
65
- * @param key - The entry key to write.
66
- * @param value - The value to set, or `undefined` to remove the entry.
67
- * @returns {string} The new fragment string, including a leading `#` when
68
- * non-empty, or an empty string when the result has no tokens left.
69
- */
70
- export declare const writeHashKey: (hash: string, key: string, value: string | undefined) => string;
@@ -1,8 +0,0 @@
1
- /**
2
- * Reads one search param from a TanStack `useSearch({ strict: false })` result.
3
- *
4
- * The registered route tree often has an empty or closed search schema, so a
5
- * string key cannot index that type. Parsing to a string record keeps the
6
- * lookup valid for every app router.
7
- */
8
- export declare const readPrimitiveSearchParam: (search: unknown, key: string) => string | undefined;
@@ -1,64 +0,0 @@
1
- /**
2
- * Pure utilities for stamping a URL-persisted value with the identity that
3
- * wrote it.
4
- *
5
- * A URL (hash or search param) is shared by every account that uses the same
6
- * browser: it survives login redirects, history and bookmarks, and it takes
7
- * precedence over per-user localStorage when a page loads. Without a stamp
8
- * there is no way to tell "a colleague shared this link" from "the previous
9
- * account on this PC left its layout in the address bar" — and the second
10
- * case silently replaces the current user's saved state (GLU-2396).
11
- *
12
- * The stamp is a short, non-reversible fingerprint of `clientSideUserId`.
13
- * It is not a secret and not a security boundary; it only lets a reader
14
- * recognise a value written by a *different* identity on the same device.
15
- */
16
- import { z } from "zod";
17
- /**
18
- * Wire shape of a stamped URL value: `{ o: <fingerprint>, v: <payload> }`.
19
- * Values written before stamping existed are bare payloads and decode as
20
- * unowned (see {@link unwrapUrlOwner}).
21
- */
22
- declare const stampedUrlValueSchema: z.ZodObject<{
23
- o: z.ZodString;
24
- v: z.ZodUnknown;
25
- }, "strip", z.ZodTypeAny, {
26
- o: string;
27
- v?: unknown;
28
- }, {
29
- o: string;
30
- v?: unknown;
31
- }>;
32
- type StampedUrlValue = z.infer<typeof stampedUrlValueSchema>;
33
- /**
34
- * 32-bit FNV-1a of `identity`, rendered in base36 (≤ 7 chars).
35
- *
36
- * Synchronous and dependency-free so it can run inside a `useState`
37
- * initializer. Collisions are possible in theory but irrelevant here: a
38
- * collision can only make a foreign value look like the reader's own, which
39
- * is today's behaviour for every value.
40
- *
41
- * @param identity - The client-side user id to fingerprint.
42
- * @returns {string} A short stable fingerprint of `identity`.
43
- */
44
- export declare const identityFingerprint: (identity: string) => string;
45
- /**
46
- * Wraps a URL payload with the fingerprint of the identity writing it.
47
- *
48
- * @param value - The payload that would otherwise be encoded into the URL.
49
- * @param owner - Fingerprint of the writing identity (see {@link identityFingerprint}).
50
- * @returns {StampedUrlValue} The payload wrapped in its ownership envelope.
51
- */
52
- export declare const wrapUrlOwner: (value: unknown, owner: string) => StampedUrlValue;
53
- /**
54
- * Splits a decoded URL value into its owner fingerprint and payload.
55
- * Bare (pre-stamping) payloads come back with `owner: undefined`.
56
- *
57
- * @param decoded - The decoded URL value, stamped or bare.
58
- * @returns {{ owner: string | undefined; value: unknown }} The owner fingerprint (if any) and the payload.
59
- */
60
- export declare const unwrapUrlOwner: (decoded: unknown) => {
61
- readonly owner: string | undefined;
62
- readonly value: unknown;
63
- };
64
- export {};