@weasel-js/prefs 1.9.3 → 1.10.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.
- package/README.md +17 -0
- package/dist/chunk-5KB3WBJZ.js +863 -0
- package/dist/chunk-5KB3WBJZ.js.map +1 -0
- package/dist/index.d.ts +351 -42
- package/dist/index.js +283 -338
- package/dist/index.js.map +1 -1
- package/dist/open-BEY-aOGe.d.ts +724 -0
- package/dist/react.d.ts +26 -2
- package/dist/react.js +66 -2
- package/dist/react.js.map +1 -1
- package/package.json +4 -3
- package/dist/store-BU2tRX5H.d.ts +0 -353
package/README.md
CHANGED
|
@@ -18,3 +18,20 @@ repair stored values that no longer fit the schema without writing them back.
|
|
|
18
18
|
`usePref(store, path)` and `usePrefsValues(store)` bind it to React. They
|
|
19
19
|
live in `@weasel-js/prefs/react`, so the main entry never loads React.
|
|
20
20
|
`usePrefsValues` returns the pieces `@weasel-js/ui`'s `PrefsForm` takes.
|
|
21
|
+
|
|
22
|
+
`usePrefsStore(schema, { storage, prefix })` gives a component a store of its
|
|
23
|
+
own: open from its first render, closed with its writes sent when it unmounts.
|
|
24
|
+
It takes an adapter that reads synchronously, and components naming the same
|
|
25
|
+
`storage`, `prefix`, and `schema` share one store. Components naming one
|
|
26
|
+
`storage` and `prefix` with different schemas each get a store over the same
|
|
27
|
+
records.
|
|
28
|
+
|
|
29
|
+
## Ranges
|
|
30
|
+
|
|
31
|
+
A number leaf's range is one scale: the low end is the least of what its label
|
|
32
|
+
names and the high end the most. Do not give zero a second meaning such as
|
|
33
|
+
"no limit" or "automatic" — on a slider it reads as the least, and the form
|
|
34
|
+
draws it there. Put an unlimited setting at the end of the range it is nearest:
|
|
35
|
+
a 0–100% limit is off at 100, and a scale with no such end takes `endless`,
|
|
36
|
+
which adds a stop one step past the range that stores `Infinity` and reads the
|
|
37
|
+
leaf's `infinity` word.
|