@trackunit/react-components 3.8.2-alpha-775ca1816d6.0 → 3.8.2

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.
@@ -1,71 +0,0 @@
1
- /**
2
- * Maximum full URL length after adding one persisted search param before the
3
- * URL write is skipped (localStorage still persists the full state).
4
- *
5
- * Sized to stay safely below the AWS WAF managed-rule default
6
- * `SizeRestrictions_QUERYSTRING` cap of 5000 bytes for the entire
7
- * host + path + query + hash string.
8
- */
9
- export declare const MAX_URL_LENGTH = 5000;
10
- /**
11
- * Maximum length of the URL fragment after adding one persisted entry.
12
- * Oversized new entries are skipped; oversized replacements remove the stale
13
- * entry so localStorage remains authoritative.
14
- *
15
- * The fragment is never sent to the server, so the WAF cap above does not
16
- * apply. 64 KB stays well below typical browser URL limits (Chromium ≳ 100 KB,
17
- * Firefox ≳ 64 KB on the address bar) while leaving generous headroom for any
18
- * realistic table state.
19
- */
20
- export declare const MAX_HASH_LENGTH: number;
21
- /**
22
- * Which part of the URL a persisted value lives in.
23
- *
24
- * - `"search"`: `?<key>=<encoded>`. Subject to the AWS WAF cap
25
- * ({@link MAX_URL_LENGTH}); large states are dropped from the URL.
26
- * - `"hash"`: `#<key>=<encoded>`. Client-only, capped by
27
- * {@link MAX_HASH_LENGTH}.
28
- */
29
- export type UrlParamLocation = "search" | "hash";
30
- export type UseUrlParamSyncOptions = {
31
- readonly key: string;
32
- readonly location: UrlParamLocation;
33
- readonly enabled?: boolean;
34
- readonly onExternalChange?: () => void;
35
- readonly replace?: boolean;
36
- };
37
- export type UseUrlParamSyncReturn = {
38
- /** The raw encoded value currently in the URL slot, or `undefined` when absent or disabled. */
39
- readonly searchValue: string | undefined;
40
- /** Writes `encodedValue` into the URL slot; `undefined` removes the entry. */
41
- readonly updateSearchParam: (encodedValue: string | undefined) => void;
42
- };
43
- /**
44
- * Syncs an encoded string value with a single named entry in the URL — either
45
- * a search param or an entry inside the hash fragment — via Tanstack Router.
46
- *
47
- * Writes go through the application router so other search params and
48
- * foreign fragment content are preserved. Each slot has a size guard
49
- * ({@link MAX_URL_LENGTH} for search, {@link MAX_HASH_LENGTH} for hash); an
50
- * oversized value is dropped from the URL and localStorage stays
51
- * authoritative. External changes to the entry (browser back/forward, a
52
- * pasted link, a foreign router push) fire `onExternalChange`.
53
- *
54
- * Writes are dispatched via a pending-write queue rather than calling
55
- * `navigate` directly. Tanstack Router's `router.state.status === "pending"`
56
- * is common during the first paint of a route (loaders, suspense), and an
57
- * implementation that simply returned in that case lost the write outright.
58
- * `updateSearchParam` stores the latest attempted write and schedules an rAF
59
- * flush; the flush only navigates when the router is idle, and an effect
60
- * retries whenever the router settles. A queued write is dropped on unmount so
61
- * it cannot drain onto the next route.
62
- *
63
- * @param options - Configuration for the URL entry sync.
64
- * @param options.key - The search param name or fragment entry name.
65
- * @param options.location - `"search"` or `"hash"`.
66
- * @param options.enabled - Set to `false` to disable all URL interaction (default `true`).
67
- * @param options.onExternalChange - Called when the entry changes externally.
68
- * @param options.replace - `true` to always use `replaceState`; `false` to always push.
69
- * Default: replace when the entry is being added, push when it already has a value.
70
- */
71
- export declare const useUrlParamSync: ({ key, location: urlLocation, enabled, onExternalChange, replace: replaceOption, }: UseUrlParamSyncOptions) => UseUrlParamSyncReturn;