@danxbot/ui 6.4.0 → 6.4.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.
- package/dist/index.js +3256 -3241
- package/dist/index.js.map +1 -1
- package/dist/types/lib/persist.d.ts +17 -0
- package/package.json +1 -1
|
@@ -11,6 +11,23 @@ export declare function storageKey(name: string): string;
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function readStored<T>(name: string, isValid: (value: unknown) => value is T): T | undefined;
|
|
13
13
|
export declare function writeStored(name: string, value: unknown): void;
|
|
14
|
+
/**
|
|
15
|
+
* The same guarded read and write, for a value that is stored as a PLAIN
|
|
16
|
+
* STRING rather than as JSON — `preferences.ts`'s three, whose values are one
|
|
17
|
+
* of a few known words and are validated by membership rather than by a
|
|
18
|
+
* predicate. JSON-encoding them would put quotes in storage for no reason and
|
|
19
|
+
* break every entry a person already has.
|
|
20
|
+
*
|
|
21
|
+
* These exist because the guard did not reach that module and the failure was
|
|
22
|
+
* total: all three preferences read in a `useState` INITIALIZER, so the throw
|
|
23
|
+
* propagated out of render and React unmounted the tree — a blank page,
|
|
24
|
+
* because the app wanted to remember a colour scheme. The header above has
|
|
25
|
+
* claimed since it was written that "the namespace and the guarded read/write"
|
|
26
|
+
* were shared with `preferences.ts`; they were not, in either direction, and
|
|
27
|
+
* that sentence is only true now.
|
|
28
|
+
*/
|
|
29
|
+
export declare function readStoredString(name: string): string | null;
|
|
30
|
+
export declare function writeStoredString(name: string, value: string): void;
|
|
14
31
|
export declare function clearStored(name: string): void;
|
|
15
32
|
/** Accepts anything — for callers whose stored shape needs no narrowing. */
|
|
16
33
|
export declare const anyValue: (value: unknown) => value is unknown;
|