@yakocloud/state-vocab 1.0.2 → 1.0.4
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/README.md +3 -3
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Most state managers treat persistence as an afterthought — you manage state fi
|
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
// declare once — works everywhere
|
|
13
|
-
const storage =
|
|
13
|
+
const storage = setupStorage({
|
|
14
14
|
theme: defineState({ storage: localStorage, defaultValue: 'Dark' }),
|
|
15
15
|
session: defineState({ storage: sessionStorage }),
|
|
16
16
|
inMemory: defineState({ defaultValue: 0 }),
|
|
@@ -61,7 +61,7 @@ const [birthday, setBirthday] = storage.personal.birthday.useState()
|
|
|
61
61
|
// ^? Date | null
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
If you rename or restructure a node in `
|
|
64
|
+
If you rename or restructure a node in `setupStorage`, TypeScript immediately flags every broken reference across the codebase.
|
|
65
65
|
|
|
66
66
|
**Custom serialization per node.** Dates, Maps, class instances — define `serialize`/`deserialize` once and the hook handles the rest transparently.
|
|
67
67
|
|
|
@@ -72,7 +72,7 @@ defineState({
|
|
|
72
72
|
})
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
**Minimal API surface.** Three exports: `defineState`, `
|
|
75
|
+
**Minimal API surface.** Three exports: `defineState`, `setupStorage`, `StorageProvider`. No actions, reducers, selectors, or stores to configure.
|
|
76
76
|
|
|
77
77
|
## Installation
|
|
78
78
|
|
package/package.json
CHANGED