@molecule/app-react 2.0.1 → 2.1.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 CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-10-26T04:14:39.028Z
6
+ Generated: 2026-10-27T17:48:51.379Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-react
@@ -1171,6 +1171,43 @@ interface UseStorageValueResult<T> {
1171
1171
  }
1172
1172
  ```
1173
1173
 
1174
+ #### `UseStoragePreferenceOptions`
1175
+
1176
+ Options for {@link useStoragePreference}.
1177
+
1178
+ ```typescript
1179
+ interface UseStoragePreferenceOptions<T> {
1180
+ /**
1181
+ * Value reported until the provider supplies one. It is NEVER written to
1182
+ * storage: a default is a display fallback, not a decision the user made.
1183
+ */
1184
+ defaultValue?: T
1185
+ }
1186
+ ```
1187
+
1188
+ #### `UseStoragePreferenceResult`
1189
+
1190
+ Result of {@link useStoragePreference}.
1191
+
1192
+ ```typescript
1193
+ interface UseStoragePreferenceResult<T> {
1194
+ /** The persisted value, or `defaultValue` while none is known. */
1195
+ value: T | undefined
1196
+ /**
1197
+ * Writes the value through the preference store: subscribers update
1198
+ * immediately and persistence is best-effort.
1199
+ */
1200
+ setValue: (next: T | ((previous: T | undefined) => T)) => void
1201
+ /** Removes the key through the preference store. */
1202
+ removeValue: () => void
1203
+ /**
1204
+ * `true` once the store has a definite answer — the synchronous snapshot on
1205
+ * a synchronous provider, or the hydration result on an asynchronous one.
1206
+ */
1207
+ ready: boolean
1208
+ }
1209
+ ```
1210
+
1174
1211
  #### `UseVerifyPaymentReturnOptions`
1175
1212
 
1176
1213
  Options for {@link useVerifyPaymentReturn}.
@@ -2581,6 +2618,33 @@ function useStorageValue<T>(
2581
2618
 
2582
2619
  **Returns:** Storage value state (value, loading, error) and mutators (setValue, removeValue).
2583
2620
 
2621
+ #### `useStoragePreference(key, options)`
2622
+
2623
+ Subscribes React state to ONE persisted preference.
2624
+
2625
+ This is the component-side half of `getPreferenceStore()`: a render-time value
2626
+ is available immediately when the bonded provider can answer synchronously,
2627
+ and an asynchronous provider's hydration CONVERGES onto the same component
2628
+ without a remount. Ordering is the store's: a read that started before a
2629
+ newer write, remove or external change is discarded, so a slow hydration
2630
+ never overwrites an edit the user already made.
2631
+
2632
+ Pass `null` for `key` while the real key is unknown (no project selected
2633
+ yet): the hook then behaves as local state around `defaultValue` and persists
2634
+ nothing.
2635
+
2636
+ ```typescript
2637
+ function useStoragePreference<T = unknown>(
2638
+ key: string | null | undefined,
2639
+ options?: UseStoragePreferenceOptions<T>,
2640
+ ): UseStoragePreferenceResult<T>
2641
+ ```
2642
+
2643
+ - `key` — The storage key, or `null` when there is nothing to persist.
2644
+ - `options` — `defaultValue`, reported until the provider supplies one.
2645
+
2646
+ **Returns:** The current value, its mutators, and whether it is definite yet.
2647
+
2584
2648
  #### `useStorage()`
2585
2649
 
2586
2650
  Hook for simple storage operations without React state sync.
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- import type { StorageProvider } from '@molecule/app-storage';
6
+ import { type StorageProvider } from '@molecule/app-storage';
7
7
  /**
8
8
  * Hook to access the storage provider from context.
9
9
  *
@@ -57,6 +57,64 @@ export interface UseStorageValueResult<T> {
57
57
  * @returns Storage value state (value, loading, error) and mutators (setValue, removeValue).
58
58
  */
59
59
  export declare function useStorageValue<T>(key: string, options?: UseStorageValueOptions<T>): UseStorageValueResult<T>;
60
+ /**
61
+ * Options for {@link useStoragePreference}.
62
+ */
63
+ export interface UseStoragePreferenceOptions<T> {
64
+ /**
65
+ * Value reported until the provider supplies one. It is NEVER written to
66
+ * storage: a default is a display fallback, not a decision the user made.
67
+ */
68
+ defaultValue?: T;
69
+ }
70
+ /**
71
+ * Result of {@link useStoragePreference}.
72
+ */
73
+ export interface UseStoragePreferenceResult<T> {
74
+ /** The persisted value, or `defaultValue` while none is known. */
75
+ value: T | undefined;
76
+ /**
77
+ * Writes the value through the preference store: subscribers update
78
+ * immediately and persistence is best-effort.
79
+ */
80
+ setValue: (next: T | ((previous: T | undefined) => T)) => void;
81
+ /** Removes the key through the preference store. */
82
+ removeValue: () => void;
83
+ /**
84
+ * `true` once the store has a definite answer — the synchronous snapshot on
85
+ * a synchronous provider, or the hydration result on an asynchronous one.
86
+ */
87
+ ready: boolean;
88
+ }
89
+ /**
90
+ * Subscribes React state to ONE persisted preference.
91
+ *
92
+ * This is the component-side half of `getPreferenceStore()`: a render-time value
93
+ * is available immediately when the bonded provider can answer synchronously,
94
+ * and an asynchronous provider's hydration CONVERGES onto the same component
95
+ * without a remount. Ordering is the store's: a read that started before a
96
+ * newer write, remove or external change is discarded, so a slow hydration
97
+ * never overwrites an edit the user already made.
98
+ *
99
+ * Pass `null` for `key` while the real key is unknown (no project selected
100
+ * yet): the hook then behaves as local state around `defaultValue` and persists
101
+ * nothing.
102
+ *
103
+ * @param key - The storage key, or `null` when there is nothing to persist.
104
+ * @param options - `defaultValue`, reported until the provider supplies one.
105
+ * @returns The current value, its mutators, and whether it is definite yet.
106
+ *
107
+ * @example
108
+ * ```tsx
109
+ * const { value: width, setValue: setWidth, ready } = useStoragePreference<number>(key, {
110
+ * defaultValue: 280,
111
+ * })
112
+ * // A drag calls setWidth(320): the UI updates now and the write persists.
113
+ * // `ready` is false until hydration lands, so an effect must not persist the
114
+ * // fallback before then.
115
+ * ```
116
+ */
117
+ export declare function useStoragePreference<T = unknown>(key: string | null | undefined, options?: UseStoragePreferenceOptions<T>): UseStoragePreferenceResult<T>;
60
118
  /**
61
119
  * Hook for simple storage operations without React state sync.
62
120
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useStorage.d.ts","sourceRoot":"","sources":["../../src/hooks/useStor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D,oDAAoD;IACpD,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,OAAO,EAC9C,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9B,OAAO,CAAC,EAAE,2BAA2B,CAAC,CAAC,CAAC,GACvC,0BAA0B,CAAC,CAAC,CAAC,CA8D/B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI;IAC5B,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;IAC1C,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAChD,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;CAC9B,CAoBA"}
@@ -3,8 +3,9 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- import { useCallback, useContext, useEffect, useState } from 'react';
6
+ import { useCallback, useContext, useEffect, useRef, useState } from 'react';
7
7
  import { t } from '@molecule/app-i18n';
8
+ import { getPreferenceStore } from '@molecule/app-storage';
8
9
  import { StorageContext } from '../contexts.js';
9
10
  /**
10
11
  * Hook to access the storage provider from context.
@@ -49,19 +50,26 @@ export function useStorageValue(key, options) {
49
50
  const [value, setValueState] = useState(defaultValue);
50
51
  const [loading, setLoading] = useState(true);
51
52
  const [error, setError] = useState(null);
53
+ /**
54
+ * Incremented by every local write. A read that started before it must not
55
+ * replace the newer value — the user editing before the first read lands is
56
+ * the common case on a slow (native, encrypted) backend.
57
+ */
58
+ const writeVersion = useRef(0);
52
59
  // Load initial value
53
60
  useEffect(() => {
54
61
  let mounted = true;
62
+ const version = writeVersion.current;
55
63
  const loadValue = async () => {
56
64
  try {
57
65
  const stored = await storage.get(key);
58
- if (mounted) {
66
+ if (mounted && writeVersion.current === version) {
59
67
  setValueState(stored ?? defaultValue);
60
68
  setLoading(false);
61
69
  }
62
70
  }
63
71
  catch (err) {
64
- if (mounted) {
72
+ if (mounted && writeVersion.current === version) {
65
73
  setError(err instanceof Error ? err : new Error(String(err)));
66
74
  setLoading(false);
67
75
  }
@@ -72,26 +80,19 @@ export function useStorageValue(key, options) {
72
80
  mounted = false;
73
81
  };
74
82
  }, [key, storage, defaultValue]);
75
- // Sync across tabs if supported
83
+ // Sync across tabs if supported — through the PROVIDER's own subscription, so
84
+ // a non-browser backend (native, encrypted, memory) propagates the same way
85
+ // instead of being limited to the browser `storage` event.
76
86
  useEffect(() => {
77
- if (!sync)
87
+ if (!sync || !storage.subscribe)
78
88
  return;
79
- const handleStorageChange = (event) => {
80
- if (event.key === key && event.newValue !== null) {
81
- try {
82
- const newValue = JSON.parse(event.newValue);
83
- setValueState(newValue);
84
- }
85
- catch (_error) {
86
- // JSON.parse failed on newValue — the cross-tab sync is best-effort and the
87
- // local state already holds the last good value, so ignoring is safe here.
88
- }
89
- }
90
- };
91
- window.addEventListener('storage', handleStorageChange);
92
- return () => window.removeEventListener('storage', handleStorageChange);
93
- }, [key, sync]);
89
+ return storage.subscribe(key, (next) => {
90
+ writeVersion.current += 1;
91
+ setValueState(next === null ? defaultValue : next);
92
+ });
93
+ }, [key, sync, storage, defaultValue]);
94
94
  const setValue = useCallback(async (newValue) => {
95
+ writeVersion.current += 1;
95
96
  try {
96
97
  await storage.set(key, newValue);
97
98
  setValueState(newValue);
@@ -103,6 +104,7 @@ export function useStorageValue(key, options) {
103
104
  }
104
105
  }, [key, storage]);
105
106
  const removeValue = useCallback(async () => {
107
+ writeVersion.current += 1;
106
108
  try {
107
109
  await storage.remove(key);
108
110
  setValueState(defaultValue);
@@ -121,6 +123,92 @@ export function useStorageValue(key, options) {
121
123
  error,
122
124
  };
123
125
  }
126
+ /**
127
+ * Subscribes React state to ONE persisted preference.
128
+ *
129
+ * This is the component-side half of `getPreferenceStore()`: a render-time value
130
+ * is available immediately when the bonded provider can answer synchronously,
131
+ * and an asynchronous provider's hydration CONVERGES onto the same component
132
+ * without a remount. Ordering is the store's: a read that started before a
133
+ * newer write, remove or external change is discarded, so a slow hydration
134
+ * never overwrites an edit the user already made.
135
+ *
136
+ * Pass `null` for `key` while the real key is unknown (no project selected
137
+ * yet): the hook then behaves as local state around `defaultValue` and persists
138
+ * nothing.
139
+ *
140
+ * @param key - The storage key, or `null` when there is nothing to persist.
141
+ * @param options - `defaultValue`, reported until the provider supplies one.
142
+ * @returns The current value, its mutators, and whether it is definite yet.
143
+ *
144
+ * @example
145
+ * ```tsx
146
+ * const { value: width, setValue: setWidth, ready } = useStoragePreference<number>(key, {
147
+ * defaultValue: 280,
148
+ * })
149
+ * // A drag calls setWidth(320): the UI updates now and the write persists.
150
+ * // `ready` is false until hydration lands, so an effect must not persist the
151
+ * // fallback before then.
152
+ * ```
153
+ */
154
+ export function useStoragePreference(key, options) {
155
+ const store = getPreferenceStore();
156
+ const defaultValueRef = useRef(options?.defaultValue);
157
+ defaultValueRef.current = options?.defaultValue;
158
+ const read = useCallback(() => {
159
+ if (!key)
160
+ return defaultValueRef.current;
161
+ const stored = store.get(key);
162
+ return stored === null ? defaultValueRef.current : stored;
163
+ }, [store, key]);
164
+ const [value, setValueState] = useState(read);
165
+ const [ready, setReady] = useState(!key);
166
+ const valueRef = useRef(value);
167
+ valueRef.current = value;
168
+ useEffect(() => {
169
+ if (!key) {
170
+ setReady(true);
171
+ setValueState(defaultValueRef.current);
172
+ return;
173
+ }
174
+ let cancelled = false;
175
+ const sync = () => {
176
+ if (!cancelled)
177
+ setValueState(read());
178
+ };
179
+ // Seed from whatever the store already knows, then let hydration converge
180
+ // it. With a synchronous provider this is a no-op change.
181
+ sync();
182
+ setReady(false);
183
+ const stop = store.subscribe(key, sync);
184
+ void store.hydrate([key]).then(() => {
185
+ if (cancelled)
186
+ return;
187
+ sync();
188
+ setReady(true);
189
+ });
190
+ return () => {
191
+ cancelled = true;
192
+ stop();
193
+ };
194
+ }, [store, key, read]);
195
+ const setValue = useCallback((next) => {
196
+ const resolved = typeof next === 'function'
197
+ ? next(valueRef.current)
198
+ : next;
199
+ valueRef.current = resolved;
200
+ setValueState(resolved);
201
+ if (key)
202
+ store.set(key, resolved);
203
+ }, [store, key]);
204
+ const removeValue = useCallback(() => {
205
+ valueRef.current = defaultValueRef.current;
206
+ setValueState(defaultValueRef.current);
207
+ if (key)
208
+ store.remove(key);
209
+ }, [store, key]);
210
+ return { value, setValue, removeValue, ready };
211
+ }
124
212
  /**
125
213
  * Hook for simple storage operations without React state sync.
126
214
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useStorage.js","sourceRoot":"","sources":["../../src/hooks/useStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEpE,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAGtC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,QAAQ,GAAG,UAAU,CAAC,cAAc,CAAC,CAAA;IAC3C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,CAAC,CAAC,uCAAuC,EAAE,SAAS,EAAE;YACpD,YAAY,EAAE,0DAA0D;SACzE,CAAC,CACH,CAAA;IACH,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AA2BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,eAAe,CA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tC,IAAI,GAAG;YAAE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC5B,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;IAEhB,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,CAAA;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU;IAOxB,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAA;IAEpC,MAAM,GAAG,GAAG,WAAW,CAAC,CAAI,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAI,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAE3E,MAAM,GAAG,GAAG,WAAW,CAAC,CAAI,GAAW,EAAE,KAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAEzF,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAE3E,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAE3D,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAEzD,OAAO;QACL,GAAG;QACH,GAAG;QACH,MAAM;QACN,KAAK;QACL,IAAI;KACL,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-react",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "React framework bindings for molecule.dev",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",