fractostate 1.0.0 → 1.0.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.
Files changed (52) hide show
  1. package/dist/cjs/index.js +2 -0
  2. package/dist/cjs/package.json +3 -0
  3. package/dist/cjs/src/index.js +66 -0
  4. package/dist/cjs/src/index.js.map +1 -0
  5. package/dist/cjs/src/proxy.js +289 -0
  6. package/dist/cjs/src/proxy.js.map +1 -0
  7. package/dist/cjs/src/store.js +373 -0
  8. package/dist/cjs/src/store.js.map +1 -0
  9. package/dist/esm/index.js +2 -0
  10. package/dist/esm/package.json +3 -0
  11. package/dist/esm/src/index.js +63 -0
  12. package/dist/esm/src/index.js.map +1 -0
  13. package/dist/esm/src/proxy.js +286 -0
  14. package/dist/esm/src/proxy.js.map +1 -0
  15. package/dist/esm/src/store.js +371 -0
  16. package/dist/esm/src/store.js.map +1 -0
  17. package/dist/index.d.ts +124 -0
  18. package/package.json +49 -9
  19. package/docs/api-reference.md +0 -46
  20. package/docs/architecture.md +0 -27
  21. package/docs/getting-started.md +0 -94
  22. package/src/index.ts +0 -82
  23. package/src/proxy.ts +0 -313
  24. package/src/store.ts +0 -324
  25. package/src/types.ts +0 -126
  26. package/test/README.md +0 -73
  27. package/test/eslint.config.js +0 -23
  28. package/test/index.html +0 -13
  29. package/test/package.json +0 -47
  30. package/test/postcss.config.mjs +0 -7
  31. package/test/public/vite.svg +0 -1
  32. package/test/src/App.css +0 -42
  33. package/test/src/App.tsx +0 -44
  34. package/test/src/assets/react.svg +0 -1
  35. package/test/src/components/CartDrawer.tsx +0 -79
  36. package/test/src/components/Navbar.tsx +0 -48
  37. package/test/src/components/Notifications.tsx +0 -27
  38. package/test/src/components/ProductList.tsx +0 -56
  39. package/test/src/flows.ts +0 -7
  40. package/test/src/index.css +0 -33
  41. package/test/src/layout/Layout.tsx +0 -68
  42. package/test/src/layout/ProtectedRoute.tsx +0 -19
  43. package/test/src/main.tsx +0 -10
  44. package/test/src/pages/LoginPage.tsx +0 -86
  45. package/test/src/pages/ProfilePage.tsx +0 -48
  46. package/test/src/pages/ShopPage.tsx +0 -54
  47. package/test/src/store/auth.ts +0 -39
  48. package/test/src/store/flows.ts +0 -74
  49. package/test/tsconfig.app.json +0 -31
  50. package/test/tsconfig.json +0 -7
  51. package/test/tsconfig.node.json +0 -29
  52. package/test/vite.config.ts +0 -16
@@ -0,0 +1,2 @@
1
+ // CommonJS re-export from src directory
2
+ module.exports = require('./src/index.js');
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var store = require('./store.js');
5
+ var proxy = require('./proxy.js');
6
+
7
+ /**
8
+ * Defines a flow in a centralized manner.
9
+ * Allows defining the key, initial state, and options in a single reusable object.
10
+ */
11
+ function defineFlow(key, initial, options) {
12
+ return { key, initial, options };
13
+ }
14
+ /**
15
+ * Unique "All-in-One" hook to create or consume a FractoState flow.
16
+ * - If called with a FlowDefinition or an initial value: initializes the flow if it doesn't exist.
17
+ * - If called with just a key: connects to the existing flow.
18
+ *
19
+ * Returns a 2-element array: [state, toolbox]
20
+ * where toolbox contains { ops, set, undo, redo, history, ... }
21
+ */
22
+ function useFlow(keyOrDef, maybeInitialValue, options = {}) {
23
+ // Argument analysis to unify initialization and consumption
24
+ const isDef = typeof keyOrDef !== "string";
25
+ const key = isDef ? keyOrDef.key : keyOrDef;
26
+ // Initial data comes either from the definition or the direct argument
27
+ const initialValue = isDef ? keyOrDef.initial : maybeInitialValue;
28
+ // Merge options
29
+ const opt = isDef ? { ...keyOrDef.options, ...options } : options;
30
+ // Store access: store.get handles initialization if initialValue is present
31
+ const [state, setState] = react.useState(() => store.store.get(key, initialValue));
32
+ react.useEffect(() => {
33
+ // Subscribe to store changes
34
+ const unsub = store.store.subscribe(key, () => {
35
+ setState(store.store.get(key, initialValue));
36
+ });
37
+ return unsub;
38
+ }, [key, initialValue]);
39
+ const setManual = react.useCallback((val) => {
40
+ const current = store.store.get(key, initialValue);
41
+ const next = typeof val === "function" ? val(current) : val;
42
+ store.store.set(key, next, opt);
43
+ }, [key, initialValue, opt]);
44
+ const toolbox = react.useMemo(() => {
45
+ return {
46
+ ops: {
47
+ get self() {
48
+ return proxy.createDeepProxy(key, [], store.store.get(key, initialValue), opt);
49
+ },
50
+ },
51
+ set: setManual,
52
+ undo: () => store.store.undo(key),
53
+ redo: () => store.store.redo(key),
54
+ history: store.store.getHistory(key),
55
+ canUndo: store.store.getHistory(key).length > 1,
56
+ canRedo: store.store.getRedoStack(key).length > 0,
57
+ reset: () => store.store.reset(key),
58
+ cf: opt,
59
+ };
60
+ }, [key, opt, state, initialValue, setManual]);
61
+ return [state, toolbox];
62
+ }
63
+
64
+ exports.defineFlow = defineFlow;
65
+ exports.useFlow = useFlow;
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/index.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useMemo } from \"react\";\nimport type { FlowOptions, FlowOperations, FlowDefinition } from \"./types\";\nimport { store } from \"./store\";\nimport { createDeepProxy } from \"./proxy\";\n\nexport * from \"./types\";\n\n/**\n * Defines a flow in a centralized manner.\n * Allows defining the key, initial state, and options in a single reusable object.\n */\nexport function defineFlow<T>(\n key: string,\n initial: T,\n options?: FlowOptions<T>,\n): FlowDefinition<T> {\n return { key, initial, options };\n}\n\n/**\n * Unique \"All-in-One\" hook to create or consume a FractoState flow.\n * - If called with a FlowDefinition or an initial value: initializes the flow if it doesn't exist.\n * - If called with just a key: connects to the existing flow.\n *\n * Returns a 2-element array: [state, toolbox]\n * where toolbox contains { ops, set, undo, redo, history, ... }\n */\nexport function useFlow<T>(\n keyOrDef: string | FlowDefinition<T>,\n maybeInitialValue?: T,\n options: FlowOptions<T> = {},\n): [T, FlowOperations<T>] {\n // Argument analysis to unify initialization and consumption\n const isDef = typeof keyOrDef !== \"string\";\n const key = isDef ? keyOrDef.key : keyOrDef;\n\n // Initial data comes either from the definition or the direct argument\n const initialValue = isDef ? keyOrDef.initial : maybeInitialValue;\n\n // Merge options\n const opt = isDef ? { ...keyOrDef.options, ...options } : options;\n\n // Store access: store.get handles initialization if initialValue is present\n const [state, setState] = useState(() => store.get(key, initialValue));\n\n useEffect(() => {\n // Subscribe to store changes\n const unsub = store.subscribe(key, () => {\n setState(store.get(key, initialValue));\n });\n return unsub;\n }, [key, initialValue]);\n\n const setManual = useCallback(\n (val: T | ((prev: T) => T)) => {\n const current = store.get(key, initialValue);\n const next = typeof val === \"function\" ? (val as any)(current) : val;\n store.set(key, next, opt);\n },\n [key, initialValue, opt],\n );\n\n const toolbox = useMemo((): FlowOperations<T> => {\n return {\n ops: {\n get self() {\n return createDeepProxy<T>(key, [], store.get(key, initialValue), opt);\n },\n },\n set: setManual,\n undo: () => store.undo(key),\n redo: () => store.redo(key),\n history: store.getHistory(key),\n canUndo: store.getHistory(key).length > 1,\n canRedo: store.getRedoStack(key).length > 0,\n reset: () => store.reset(key),\n cf: opt,\n };\n }, [key, opt, state, initialValue, setManual]);\n\n return [state, toolbox];\n}\n"],"names":["useState","store","useEffect","useCallback","useMemo","createDeepProxy"],"mappings":";;;;;;AAOA;;;AAGG;SACa,UAAU,CACxB,GAAW,EACX,OAAU,EACV,OAAwB,EAAA;AAExB,IAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE;AAClC;AAEA;;;;;;;AAOG;AACG,SAAU,OAAO,CACrB,QAAoC,EACpC,iBAAqB,EACrB,UAA0B,EAAE,EAAA;;AAG5B,IAAA,MAAM,KAAK,GAAG,OAAO,QAAQ,KAAK,QAAQ;AAC1C,IAAA,MAAM,GAAG,GAAG,KAAK,GAAG,QAAQ,CAAC,GAAG,GAAG,QAAQ;;AAG3C,IAAA,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,CAAC,OAAO,GAAG,iBAAiB;;AAGjE,IAAA,MAAM,GAA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E,MAAMA,WAAK,CAAC,IAAI,CAAC,GAAG,CAAC;AAC3B,YAAA,OAAO,EAAEA,WAAK,CAAC,UAAU,CAAC,GAAG,CAAC;YAC9B,OAAO,EAAEA,WAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC;YACzC,OAAO,EAAEA,WAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC;YAC3C,KAAK,EAAE,MAAMA,WAAK,CAAC,KAAK,CAAC,GAAG,CAAC;AAC7B,YAAA,EAAE,EAAE,GAAG;SACR;AACH,IAAA,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;AAE9C,IAAA,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;AACzB;;;;;"}
@@ -0,0 +1,289 @@
1
+ 'use strict';
2
+
3
+ var store = require('./store.js');
4
+
5
+ /**
6
+ * Creates a deep proxy that provides type-specific atomic operations for a flow.
7
+ * The proxy tracks its path within the state tree and maps access to specific update logic.
8
+ */
9
+ function createDeepProxy(key, path, currentVal, options) {
10
+ return new Proxy(() => { }, {
11
+ get(_target, prop) {
12
+ if (typeof prop === "symbol")
13
+ return undefined;
14
+ const newPath = [...path, prop];
15
+ // --- Meta-Operations ---
16
+ // Generic property replacement
17
+ if (prop === "set") {
18
+ return (val) => {
19
+ try {
20
+ const currentState = store.store.get(key, undefined);
21
+ const newState = setInPath(currentState, path, val);
22
+ store.store.set(key, newState, options);
23
+ }
24
+ catch (error) {
25
+ console.error(`[FlowProxy] Error setting value at path ${path.join(".")}:`, error);
26
+ throw error;
27
+ }
28
+ };
29
+ }
30
+ // --- Type-Specific Atomic Operations ---
31
+ // Number Operations
32
+ if (typeof currentVal === "number") {
33
+ if (prop === "increment")
34
+ return (amount = 1) => {
35
+ if (typeof amount !== "number" || !isFinite(amount)) {
36
+ console.warn(`[FlowProxy] Invalid increment amount: ${amount}`);
37
+ return;
38
+ }
39
+ update(currentVal + amount);
40
+ };
41
+ if (prop === "decrement")
42
+ return (amount = 1) => {
43
+ if (typeof amount !== "number" || !isFinite(amount)) {
44
+ console.warn(`[FlowProxy] Invalid decrement amount: ${amount}`);
45
+ return;
46
+ }
47
+ update(currentVal - amount);
48
+ };
49
+ if (prop === "add")
50
+ return (amount) => {
51
+ if (typeof amount !== "number" || !isFinite(amount)) {
52
+ console.warn(`[FlowProxy] Invalid add amount: ${amount}`);
53
+ return;
54
+ }
55
+ update(currentVal + amount);
56
+ };
57
+ if (prop === "subtract")
58
+ return (amount) => {
59
+ if (typeof amount !== "number" || !isFinite(amount)) {
60
+ console.warn(`[FlowProxy] Invalid subtract amount: ${amount}`);
61
+ return;
62
+ }
63
+ update(currentVal - amount);
64
+ };
65
+ if (prop === "multiply")
66
+ return (amount) => {
67
+ if (typeof amount !== "number" || !isFinite(amount)) {
68
+ console.warn(`[FlowProxy] Invalid multiply amount: ${amount}`);
69
+ return;
70
+ }
71
+ update(currentVal * amount);
72
+ };
73
+ if (prop === "divide")
74
+ return (amount) => {
75
+ if (typeof amount !== "number" || !isFinite(amount)) {
76
+ console.warn(`[FlowProxy] Invalid divide amount: ${amount}`);
77
+ return;
78
+ }
79
+ if (amount === 0) {
80
+ console.error(`[FlowProxy] Cannot divide by zero`);
81
+ return;
82
+ }
83
+ update(currentVal / amount);
84
+ };
85
+ }
86
+ // Array Operations
87
+ if (Array.isArray(currentVal)) {
88
+ if (prop === "push")
89
+ return (item) => update([...currentVal, item]);
90
+ if (prop === "pop")
91
+ return () => {
92
+ if (currentVal.length === 0) {
93
+ console.warn(`[FlowProxy] Cannot pop from empty array`);
94
+ return;
95
+ }
96
+ update(currentVal.slice(0, -1));
97
+ };
98
+ if (prop === "shift")
99
+ return () => {
100
+ if (currentVal.length === 0) {
101
+ console.warn(`[FlowProxy] Cannot shift from empty array`);
102
+ return;
103
+ }
104
+ update(currentVal.slice(1));
105
+ };
106
+ if (prop === "unshift")
107
+ return (item) => update([item, ...currentVal]);
108
+ if (prop === "filter")
109
+ return (fn) => {
110
+ if (typeof fn !== "function") {
111
+ console.error(`[FlowProxy] Filter requires a function`);
112
+ return;
113
+ }
114
+ try {
115
+ update(currentVal.filter(fn));
116
+ }
117
+ catch (error) {
118
+ console.error(`[FlowProxy] Filter function threw error:`, error);
119
+ }
120
+ };
121
+ if (prop === "map")
122
+ return (fn) => {
123
+ if (typeof fn !== "function") {
124
+ console.error(`[FlowProxy] Map requires a function`);
125
+ return;
126
+ }
127
+ try {
128
+ update(currentVal.map(fn));
129
+ }
130
+ catch (error) {
131
+ console.error(`[FlowProxy] Map function threw error:`, error);
132
+ }
133
+ };
134
+ if (prop === "splice")
135
+ return (...args) => {
136
+ try {
137
+ const next = [...currentVal];
138
+ const start = args[0] ?? 0;
139
+ const deleteCount = args[1] ?? 0;
140
+ if (typeof start !== "number" ||
141
+ typeof deleteCount !== "number") {
142
+ console.error(`[FlowProxy] Splice requires numeric arguments`);
143
+ return;
144
+ }
145
+ next.splice(start, deleteCount, ...args.slice(2));
146
+ update(next);
147
+ }
148
+ catch (error) {
149
+ console.error(`[FlowProxy] Splice error:`, error);
150
+ }
151
+ };
152
+ if (prop === "removeAt")
153
+ return (index) => {
154
+ if (typeof index !== "number" ||
155
+ index < 0 ||
156
+ index >= currentVal.length) {
157
+ console.warn(`[FlowProxy] Invalid index: ${index}`);
158
+ return;
159
+ }
160
+ update(currentVal.filter((_, i) => i !== index));
161
+ };
162
+ if (prop === "insertAt")
163
+ return (index, item) => {
164
+ if (typeof index !== "number" ||
165
+ index < 0 ||
166
+ index > currentVal.length) {
167
+ console.warn(`[FlowProxy] Invalid index: ${index}`);
168
+ return;
169
+ }
170
+ const next = [...currentVal];
171
+ next.splice(index, 0, item);
172
+ update(next);
173
+ };
174
+ }
175
+ // String Operations
176
+ if (typeof currentVal === "string") {
177
+ if (prop === "append")
178
+ return (str) => {
179
+ if (typeof str !== "string") {
180
+ console.warn(`[FlowProxy] Append requires a string`);
181
+ return;
182
+ }
183
+ update(currentVal + str);
184
+ };
185
+ if (prop === "prepend")
186
+ return (str) => {
187
+ if (typeof str !== "string") {
188
+ console.warn(`[FlowProxy] Prepend requires a string`);
189
+ return;
190
+ }
191
+ update(str + currentVal);
192
+ };
193
+ if (prop === "uppercase")
194
+ return () => update(currentVal.toUpperCase());
195
+ if (prop === "lowercase")
196
+ return () => update(currentVal.toLowerCase());
197
+ if (prop === "trim")
198
+ return () => update(currentVal.trim());
199
+ if (prop === "replace")
200
+ return (search, replace) => {
201
+ if (typeof replace !== "string") {
202
+ console.warn(`[FlowProxy] Replace requires a string replacement`);
203
+ return;
204
+ }
205
+ try {
206
+ update(currentVal.replace(search, replace));
207
+ }
208
+ catch (error) {
209
+ console.error(`[FlowProxy] Replace error:`, error);
210
+ }
211
+ };
212
+ }
213
+ // Object Operations
214
+ if (currentVal !== null &&
215
+ typeof currentVal === "object" &&
216
+ !Array.isArray(currentVal)) {
217
+ if (prop === "merge")
218
+ return (obj) => {
219
+ if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
220
+ console.warn(`[FlowProxy] Merge requires an object`);
221
+ return;
222
+ }
223
+ update({ ...currentVal, ...obj });
224
+ };
225
+ if (prop === "delete")
226
+ return (keyToDel) => {
227
+ if (typeof keyToDel !== "string") {
228
+ console.warn(`[FlowProxy] Delete requires a string key`);
229
+ return;
230
+ }
231
+ if (!(keyToDel in currentVal)) {
232
+ console.warn(`[FlowProxy] Key "${keyToDel}" does not exist`);
233
+ return;
234
+ }
235
+ const next = { ...currentVal };
236
+ delete next[keyToDel];
237
+ update(next);
238
+ };
239
+ }
240
+ /**
241
+ * Internal helper to commit a value update to the store.
242
+ */
243
+ function update(val) {
244
+ try {
245
+ const currentState = store.store.get(key, undefined);
246
+ const newState = setInPath(currentState, path, val);
247
+ store.store.set(key, newState, options);
248
+ }
249
+ catch (error) {
250
+ console.error(`[FlowProxy] Error updating value at path ${path.join(".")}:`, error);
251
+ throw error;
252
+ }
253
+ }
254
+ // Recursive step: create a new proxy for the child property
255
+ const nextVal = currentVal ? currentVal[prop] : undefined;
256
+ return createDeepProxy(key, newPath, nextVal, options);
257
+ },
258
+ });
259
+ }
260
+ /**
261
+ * Immutable update utility that sets a value at a specific path within an object/array.
262
+ */
263
+ function setInPath(obj, path, value) {
264
+ if (path.length === 0)
265
+ return value;
266
+ const [head, ...tail] = path;
267
+ if (Array.isArray(obj)) {
268
+ const index = parseInt(head, 10);
269
+ if (isNaN(index) || index < 0) {
270
+ throw new Error(`[FlowProxy] Invalid array index: ${head}`);
271
+ }
272
+ const newArr = [...obj];
273
+ if (index >= newArr.length) {
274
+ newArr.length = index + 1;
275
+ }
276
+ newArr[index] = setInPath(newArr[index], tail, value);
277
+ return newArr;
278
+ }
279
+ // Handle nested objects (including null/undefined recovery)
280
+ const currentObj = obj ?? {};
281
+ return {
282
+ ...currentObj,
283
+ [head]: setInPath(currentObj[head], tail, value),
284
+ };
285
+ }
286
+
287
+ exports.createDeepProxy = createDeepProxy;
288
+ exports.setInPath = setInPath;
289
+ //# sourceMappingURL=proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.js","sources":["../../../src/proxy.ts"],"sourcesContent":["import type { FlowOptions, TypeAwareOps } from \"./types\";\nimport { store } from \"./store\";\n\n/**\n * Creates a deep proxy that provides type-specific atomic operations for a flow.\n * The proxy tracks its path within the state tree and maps access to specific update logic.\n */\nexport function createDeepProxy<T = any>(\n key: string,\n path: string[],\n currentVal: any,\n options: FlowOptions<any>,\n): TypeAwareOps<T> {\n return new Proxy(() => {}, {\n get(_target: any, prop: any) {\n if (typeof prop === \"symbol\") return undefined;\n\n const newPath = [...path, prop];\n\n // --- Meta-Operations ---\n\n // Generic property replacement\n if (prop === \"set\") {\n return (val: any) => {\n try {\n const currentState = store.get(key, undefined);\n const newState = setInPath(currentState, path, val);\n store.set(key, newState, options);\n } catch (error) {\n console.error(\n `[FlowProxy] Error setting value at path ${path.join(\".\")}:`,\n error,\n );\n throw error;\n }\n };\n }\n\n // --- Type-Specific Atomic Operations ---\n\n // Number Operations\n if (typeof currentVal === \"number\") {\n if (prop === \"increment\")\n return (amount = 1) => {\n if (typeof amount !== \"number\" || !isFinite(amount)) {\n console.warn(`[FlowProxy] Invalid increment amount: ${amount}`);\n return;\n }\n update(currentVal + amount);\n };\n if (prop === \"decrement\")\n return (amount = 1) => {\n if (typeof amount !== \"number\" || !isFinite(amount)) {\n console.warn(`[FlowProxy] Invalid decrement amount: ${amount}`);\n return;\n }\n update(currentVal - amount);\n };\n if (prop === \"add\")\n return (amount: number) => {\n if (typeof amount !== \"number\" || !isFinite(amount)) {\n console.warn(`[FlowProxy] Invalid add amount: ${amount}`);\n return;\n }\n update(currentVal + amount);\n };\n if (prop === \"subtract\")\n return (amount: number) => {\n if (typeof amount !== \"number\" || !isFinite(amount)) {\n console.warn(`[FlowProxy] Invalid subtract amount: ${amount}`);\n return;\n }\n update(currentVal - amount);\n };\n if (prop === \"multiply\")\n return (amount: number) => {\n if (typeof amount !== \"number\" || !isFinite(amount)) {\n console.warn(`[FlowProxy] Invalid multiply amount: ${amount}`);\n return;\n }\n update(currentVal * amount);\n };\n if (prop === \"divide\")\n return (amount: number) => {\n if (typeof amount !== \"number\" || !isFinite(amount)) {\n console.warn(`[FlowProxy] Invalid divide amount: ${amount}`);\n return;\n }\n if (amount === 0) {\n console.error(`[FlowProxy] Cannot divide by zero`);\n return;\n }\n update(currentVal / amount);\n };\n }\n\n // Array Operations\n if (Array.isArray(currentVal)) {\n if (prop === \"push\")\n return (item: any) => update([...currentVal, item]);\n if (prop === \"pop\")\n return () => {\n if (currentVal.length === 0) {\n console.warn(`[FlowProxy] Cannot pop from empty array`);\n return;\n }\n update(currentVal.slice(0, -1));\n };\n if (prop === \"shift\")\n return () => {\n if (currentVal.length === 0) {\n console.warn(`[FlowProxy] Cannot shift from empty array`);\n return;\n }\n update(currentVal.slice(1));\n };\n if (prop === \"unshift\")\n return (item: any) => update([item, ...currentVal]);\n if (prop === \"filter\")\n return (fn: any) => {\n if (typeof fn !== \"function\") {\n console.error(`[FlowProxy] Filter requires a function`);\n return;\n }\n try {\n update(currentVal.filter(fn));\n } catch (error) {\n console.error(`[FlowProxy] Filter function threw error:`, error);\n }\n };\n if (prop === \"map\")\n return (fn: any) => {\n if (typeof fn !== \"function\") {\n console.error(`[FlowProxy] Map requires a function`);\n return;\n }\n try {\n update(currentVal.map(fn));\n } catch (error) {\n console.error(`[FlowProxy] Map function threw error:`, error);\n }\n };\n if (prop === \"splice\")\n return (...args: any[]) => {\n try {\n const next = [...currentVal];\n const start = args[0] ?? 0;\n const deleteCount = args[1] ?? 0;\n\n if (\n typeof start !== \"number\" ||\n typeof deleteCount !== \"number\"\n ) {\n console.error(`[FlowProxy] Splice requires numeric arguments`);\n return;\n }\n\n next.splice(start, deleteCount, ...args.slice(2));\n update(next);\n } catch (error) {\n console.error(`[FlowProxy] Splice error:`, error);\n }\n };\n if (prop === \"removeAt\")\n return (index: number) => {\n if (\n typeof index !== \"number\" ||\n index < 0 ||\n index >= currentVal.length\n ) {\n console.warn(`[FlowProxy] Invalid index: ${index}`);\n return;\n }\n update(currentVal.filter((_, i) => i !== index));\n };\n if (prop === \"insertAt\")\n return (index: number, item: any) => {\n if (\n typeof index !== \"number\" ||\n index < 0 ||\n index > currentVal.length\n ) {\n console.warn(`[FlowProxy] Invalid index: ${index}`);\n return;\n }\n const next = [...currentVal];\n next.splice(index, 0, item);\n update(next);\n };\n }\n\n // String Operations\n if (typeof currentVal === \"string\") {\n if (prop === \"append\")\n return (str: string) => {\n if (typeof str !== \"string\") {\n console.warn(`[FlowProxy] Append requires a string`);\n return;\n }\n update(currentVal + str);\n };\n if (prop === \"prepend\")\n return (str: string) => {\n if (typeof str !== \"string\") {\n console.warn(`[FlowProxy] Prepend requires a string`);\n return;\n }\n update(str + currentVal);\n };\n if (prop === \"uppercase\") return () => update(currentVal.toUpperCase());\n if (prop === \"lowercase\") return () => update(currentVal.toLowerCase());\n if (prop === \"trim\") return () => update(currentVal.trim());\n if (prop === \"replace\")\n return (search: string | RegExp, replace: string) => {\n if (typeof replace !== \"string\") {\n console.warn(`[FlowProxy] Replace requires a string replacement`);\n return;\n }\n try {\n update(currentVal.replace(search, replace));\n } catch (error) {\n console.error(`[FlowProxy] Replace error:`, error);\n }\n };\n }\n\n // Object Operations\n if (\n currentVal !== null &&\n typeof currentVal === \"object\" &&\n !Array.isArray(currentVal)\n ) {\n if (prop === \"merge\")\n return (obj: any) => {\n if (typeof obj !== \"object\" || obj === null || Array.isArray(obj)) {\n console.warn(`[FlowProxy] Merge requires an object`);\n return;\n }\n update({ ...currentVal, ...obj });\n };\n if (prop === \"delete\")\n return (keyToDel: string) => {\n if (typeof keyToDel !== \"string\") {\n console.warn(`[FlowProxy] Delete requires a string key`);\n return;\n }\n if (!(keyToDel in currentVal)) {\n console.warn(`[FlowProxy] Key \"${keyToDel}\" does not exist`);\n return;\n }\n const next = { ...currentVal };\n delete next[keyToDel];\n update(next);\n };\n }\n\n /**\n * Internal helper to commit a value update to the store.\n */\n function update(val: any) {\n try {\n const currentState = store.get(key, undefined);\n const newState = setInPath(currentState, path, val);\n store.set(key, newState, options);\n } catch (error) {\n console.error(\n `[FlowProxy] Error updating value at path ${path.join(\".\")}:`,\n error,\n );\n throw error;\n }\n }\n\n // Recursive step: create a new proxy for the child property\n const nextVal = currentVal ? currentVal[prop] : undefined;\n return createDeepProxy(key, newPath, nextVal, options);\n },\n }) as unknown as TypeAwareOps<T>;\n}\n\n/**\n * Immutable update utility that sets a value at a specific path within an object/array.\n */\nexport function setInPath(obj: any, path: string[], value: any): any {\n if (path.length === 0) return value;\n\n const [head, ...tail] = path;\n\n if (Array.isArray(obj)) {\n const index = parseInt(head, 10);\n\n if (isNaN(index) || index < 0) {\n throw new Error(`[FlowProxy] Invalid array index: ${head}`);\n }\n\n const newArr = [...obj];\n\n if (index >= newArr.length) {\n newArr.length = index + 1;\n }\n\n newArr[index] = setInPath(newArr[index], tail, value);\n return newArr;\n }\n\n // Handle nested objects (including null/undefined recovery)\n const currentObj = obj ?? {};\n\n return {\n ...currentObj,\n [head]: setInPath(currentObj[head], tail, value),\n };\n}\n"],"names":["store"],"mappings":";;;;AAGA;;;AAGG;AACG,SAAU,eAAe,CAC7B,GAAW,EACX,IAAc,EACd,UAAe,EACf,OAAyB,EAAA;AAEzB,IAAA,OAAO,IAAI,KAAK,CAAC,MAAK,EAAE,CAAC,EAAE;QACzB,GAAG,CAAC,OAAY,EAAE,IAAS,EAAA;YACzB,IAAI,OAAO,IAAI,KAAK,QAAQ;AAAE,gBAAA,OAAO,SAAS;YAE9C,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC;;;AAK/B,YAAA,IAAI,IAAI,KAAK,KAAK,EAAE;gBAClB,OAAO,CAAC,GAAQ,KAAI;AAClB,oBAAA,IAAI;wBACF,MAAM,YAAY,GAAGA,WAAK,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC;wBAC9C,MAAM,QAAQ,GAAG,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,GAAG,CAAC;wBACnDA,WAAK,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC;oBACnC;oBAAE,OAAO,KAAK,EAAE;AACd,wBAAA,OAAO,CAAC,KAAK,CACX,CAAA,wCAAA,EAA2C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAA,CAAG,EAC5D,KAAK,CACN;AACD,wBAAA,MAAM,KAAK;oBACb;AACF,gBAAA,CAAC;YACH;;;AAKA,YAAA,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;gBAClC,IAAI,IAAI,KAAK,WAAW;AACtB,oBAAA,OAAO,CAAC,MAAM,GAAG,CAAC,KAAI;wBACpB,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AACnD,4BAAA,OAAO,CAAC,IAAI,CAAC,yCA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