@linkdlab/funcnodes_react_flow 0.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.
Files changed (67) hide show
  1. package/README.md +46 -0
  2. package/package copy.json +63 -0
  3. package/package.json +75 -0
  4. package/public/favicon.ico +0 -0
  5. package/public/index.html +43 -0
  6. package/public/logo192.png +0 -0
  7. package/public/logo512.png +0 -0
  8. package/public/manifest.json +25 -0
  9. package/public/robots.txt +3 -0
  10. package/public/worker_manager +1 -0
  11. package/src/App.css +38 -0
  12. package/src/App.test.tsx +9 -0
  13. package/src/App.tsx +22 -0
  14. package/src/frontend/datarenderer/images.tsx +28 -0
  15. package/src/frontend/datarenderer/index.tsx +53 -0
  16. package/src/frontend/datarenderer/plotly.tsx +82 -0
  17. package/src/frontend/dialog.scss +88 -0
  18. package/src/frontend/dialog.tsx +70 -0
  19. package/src/frontend/edge.scss +15 -0
  20. package/src/frontend/edge.tsx +31 -0
  21. package/src/frontend/funcnodesreactflow.scss +63 -0
  22. package/src/frontend/funcnodesreactflow.tsx +283 -0
  23. package/src/frontend/header/header.scss +48 -0
  24. package/src/frontend/header/index.tsx +268 -0
  25. package/src/frontend/index.tsx +4 -0
  26. package/src/frontend/layout/htmlelements.scss +63 -0
  27. package/src/frontend/lib.scss +157 -0
  28. package/src/frontend/lib.tsx +198 -0
  29. package/src/frontend/node/index.tsx +3 -0
  30. package/src/frontend/node/io/default_input_renderer.tsx +327 -0
  31. package/src/frontend/node/io/default_output_render.tsx +26 -0
  32. package/src/frontend/node/io/handle_renderer.tsx +89 -0
  33. package/src/frontend/node/io/index.tsx +4 -0
  34. package/src/frontend/node/io/io.scss +91 -0
  35. package/src/frontend/node/io/io.tsx +114 -0
  36. package/src/frontend/node/io/nodeinput.tsx +125 -0
  37. package/src/frontend/node/io/nodeoutput.tsx +37 -0
  38. package/src/frontend/node/node.scss +265 -0
  39. package/src/frontend/node/node.tsx +208 -0
  40. package/src/frontend/nodecontextmenu.scss +18 -0
  41. package/src/frontend/utils/colorpicker.scss +37 -0
  42. package/src/frontend/utils/colorpicker.tsx +342 -0
  43. package/src/frontend/utils/jsondata.tsx +19 -0
  44. package/src/frontend/utils/table.scss +22 -0
  45. package/src/frontend/utils/table.tsx +159 -0
  46. package/src/funcnodes/funcnodesworker.ts +455 -0
  47. package/src/funcnodes/index.ts +4 -0
  48. package/src/funcnodes/websocketworker.ts +153 -0
  49. package/src/funcnodes/workermanager.ts +229 -0
  50. package/src/index.css +13 -0
  51. package/src/index.tsx +19 -0
  52. package/src/logo.svg +1 -0
  53. package/src/react-app-env.d.ts +1 -0
  54. package/src/reportWebVitals.ts +15 -0
  55. package/src/setupTests.ts +5 -0
  56. package/src/state/edge.ts +35 -0
  57. package/src/state/fnrfzst.ts +440 -0
  58. package/src/state/index.ts +139 -0
  59. package/src/state/lib.ts +26 -0
  60. package/src/state/node.ts +118 -0
  61. package/src/state/nodespace.ts +151 -0
  62. package/src/state/reactflow.ts +65 -0
  63. package/src/types/lib.d.ts +16 -0
  64. package/src/types/node.d.ts +29 -0
  65. package/src/types/nodeio.d.ts +82 -0
  66. package/src/types/worker.d.ts +56 -0
  67. package/tsconfig.json +20 -0
@@ -0,0 +1,440 @@
1
+ import LibZustand, { LibZustandInterface } from "./lib";
2
+ import { FuncNodesWorker } from "../funcnodes";
3
+ import NodeSpaceZustand, { NodeSpaceZustandInterface } from "./nodespace";
4
+ import { NodeStore, createNodeStore } from "./node";
5
+ import { PartialIOType } from "./node";
6
+ import reactflowstore, { RFStore } from "./reactflow";
7
+ import {
8
+ Node as RFNode,
9
+ NodeChange,
10
+ useReactFlow,
11
+ EdgeChange,
12
+ Edge as RFEdge,
13
+ Connection as RFConnection,
14
+ } from "reactflow";
15
+ import { NodeAction } from "./node";
16
+ import { deep_merge } from ".";
17
+ import { EdgeAction, generate_edge_id } from "./edge";
18
+ import WorkerManager from "../funcnodes/workermanager";
19
+ import { UseBoundStore, StoreApi, create } from "zustand";
20
+
21
+ interface WorkerRepresentation {
22
+ uuid: string;
23
+ host: string;
24
+ port: number;
25
+ ssl: boolean;
26
+ active: boolean;
27
+ name: string | null;
28
+ }
29
+ interface WorkersState {
30
+ [key: string]: WorkerRepresentation;
31
+ }
32
+ interface FuncNodesReactFlowZustandInterface {
33
+ lib: LibZustandInterface;
34
+ workermanager: WorkerManager | undefined;
35
+ workers: UseBoundStore<StoreApi<WorkersState>>;
36
+ worker: FuncNodesWorker | undefined;
37
+ nodespace: NodeSpaceZustandInterface;
38
+ useReactFlowStore: RFStore;
39
+ render_options: UseBoundStore<StoreApi<RenderOptions>>;
40
+ progress_state: UseBoundStore<StoreApi<ProgressState>>;
41
+ update_render_options: (options: RenderOptions) => void;
42
+ rf_instance?: ReturnType<typeof useReactFlow>;
43
+ on_node_action: (action: NodeAction) => void;
44
+ on_edge_action: (edge: EdgeAction) => void;
45
+ set_progress: (progress: ProgressState) => void;
46
+ auto_progress: () => void;
47
+ reactflowRef: HTMLDivElement | null;
48
+ clear_all: () => void;
49
+ }
50
+
51
+ const _fill_node_frontend = (
52
+ node: NodeType,
53
+ fnrf_instance?: FuncNodesReactFlowZustandInterface
54
+ ) => {
55
+ const frontend = node.frontend || {};
56
+ if (!frontend.pos) {
57
+ if (
58
+ !fnrf_instance ||
59
+ !fnrf_instance.rf_instance ||
60
+ fnrf_instance.reactflowRef === null
61
+ ) {
62
+ frontend.pos = [0, 0];
63
+ } else {
64
+ const ref = fnrf_instance.reactflowRef;
65
+ const rect = ref.getBoundingClientRect(); // Step 2: Get bounding rectangle
66
+ const centerX = rect.left + rect.width / 2; // Calculate center X
67
+ const centerY = rect.top + rect.height / 2; // Calculate center Y
68
+ const calcpos = fnrf_instance.rf_instance.screenToFlowPosition({
69
+ x: centerX,
70
+ y: centerY,
71
+ });
72
+ frontend.pos = [calcpos.x, calcpos.y];
73
+ }
74
+ }
75
+ if (!frontend.size) {
76
+ frontend.size = [200, 100];
77
+ }
78
+ if (!frontend.collapsed) {
79
+ frontend.collapsed = false;
80
+ }
81
+ node.frontend = frontend;
82
+ };
83
+
84
+ const assert_react_flow_io = (
85
+ io: PartialIOType,
86
+ fnrf_instance?: FuncNodesReactFlowZustandInterface
87
+ ): PartialIOType => {
88
+ if (io.value === "<NoValue>") {
89
+ io.value = undefined;
90
+ }
91
+ if (io.fullvalue === "<NoValue>") {
92
+ io.fullvalue = undefined;
93
+ }
94
+
95
+ if (io.try_get_full_value === undefined) {
96
+ io.try_get_full_value = () => {
97
+ if (!fnrf_instance) {
98
+ return;
99
+ }
100
+ if (io.node === undefined || io.id === undefined) {
101
+ return;
102
+ }
103
+ fnrf_instance.worker?.get_io_full_value({ nid: io.node, ioid: io.id });
104
+ };
105
+ }
106
+
107
+ return io;
108
+ };
109
+ const assert_reactflow_node = (
110
+ node: NodeType,
111
+ store: NodeStore,
112
+ fnrf_instance?: FuncNodesReactFlowZustandInterface
113
+ ): NodeType & RFNode => {
114
+ _fill_node_frontend(node, fnrf_instance);
115
+
116
+ if (node.id === undefined) {
117
+ throw new Error("Node must have an id");
118
+ }
119
+
120
+ for (const io in node.io) {
121
+ node.io[io].node = node.id;
122
+ assert_react_flow_io(node.io[io], fnrf_instance);
123
+ }
124
+
125
+ const extendedNode: NodeType & RFNode = {
126
+ position: {
127
+ x: node.frontend.pos[0],
128
+ y: node.frontend.pos[1],
129
+ },
130
+ data: {
131
+ UseNodeStore: store,
132
+ },
133
+ type: "default",
134
+ ...node,
135
+ };
136
+
137
+ return extendedNode;
138
+ };
139
+
140
+ const FuncNodesReactFlowZustand = (): FuncNodesReactFlowZustandInterface => {
141
+ /*
142
+ function that should be called when the remote node, e.g. in the python worker is performing an action
143
+ */
144
+ const on_node_action = (action: NodeAction) => {
145
+ const rfstate = rfstore.getState();
146
+
147
+ switch (action.type) {
148
+ case "add":
149
+ if (action.from_remote) {
150
+ let store = ns.get_node(action.node.id, false);
151
+
152
+ if (!store) {
153
+ try {
154
+ store = createNodeStore(action.node);
155
+ ns.nodesstates.set(action.node.id, store);
156
+ } catch (e) {
157
+ return;
158
+ }
159
+ }
160
+
161
+ const new_ndoes = [
162
+ ...rfstate.nodes,
163
+ assert_reactflow_node(action.node, store, iterf),
164
+ ];
165
+ rfstore.setState({ nodes: new_ndoes });
166
+ }
167
+ break;
168
+ case "update":
169
+ // some action reset the error, so far trigger does, so errors should remove the in_trigger flag
170
+ if (action.node.in_trigger) {
171
+ action.node.error = undefined;
172
+ }
173
+ if (action.from_remote) {
174
+ const store = ns.get_node(action.id) as NodeStore;
175
+
176
+ if (action.node.io) {
177
+ for (const io in action.node.io) {
178
+ const ioobj = action.node.io[io] as PartialIOType;
179
+ // check if value in io, undefined is a valid value
180
+ if (ioobj.hasOwnProperty("value")) {
181
+ if (ioobj.value === undefined) {
182
+ ioobj.value = null;
183
+ } else if (ioobj.value === "<NoValue>") {
184
+ ioobj.value = undefined;
185
+ }
186
+ }
187
+ }
188
+ }
189
+
190
+ const state = store.getState();
191
+ const { new_obj, change } = deep_merge(state, action.node);
192
+
193
+ if (change) {
194
+ if (action.node.io) {
195
+ for (const io in action.node.io) {
196
+ // if fullvalue is in the update data, set to fullvalue otherwise set to undefined
197
+ new_obj.io[io].fullvalue = action.node.io[io].fullvalue;
198
+ }
199
+ }
200
+
201
+ assert_reactflow_node(new_obj, store, iterf);
202
+
203
+ store.setState(new_obj);
204
+ }
205
+ } else {
206
+ if (iterf.worker) {
207
+ iterf.worker.update_node(action);
208
+ }
209
+ }
210
+ break;
211
+ case "delete":
212
+ if (action.from_remote) {
213
+ rfstore.getState().onNodesChange([
214
+ {
215
+ type: "remove",
216
+ id: action.id,
217
+ },
218
+ ]);
219
+ } else {
220
+ iterf.worker?.remove_node(action.id);
221
+ }
222
+ break;
223
+ case "error":
224
+ console.error("Error", action);
225
+ on_node_action({
226
+ type: "update",
227
+ id: action.id,
228
+ node: {
229
+ in_trigger: false,
230
+ error: action.error,
231
+ },
232
+ from_remote: true,
233
+ });
234
+ break;
235
+
236
+ case "trigger":
237
+ if (action.from_remote) {
238
+ on_node_action({
239
+ type: "update",
240
+ id: action.id,
241
+ node: {
242
+ in_trigger: true,
243
+ error: undefined,
244
+ },
245
+ from_remote: true,
246
+ });
247
+ } else {
248
+ iterf.worker?.trigger_node(action.id);
249
+ }
250
+ break;
251
+ default:
252
+ console.error("Unknown node action", action);
253
+ }
254
+ };
255
+
256
+ const on_edge_action = (action: EdgeAction) => {
257
+ const rfstate = rfstore.getState();
258
+
259
+ switch (action.type) {
260
+ case "add":
261
+ if (action.from_remote) {
262
+ const edges = rfstate.edges;
263
+ const new_edge_id = generate_edge_id(action);
264
+
265
+ //cehck if edge already exists including reversed
266
+ if (edges.some((e) => e.id === new_edge_id)) {
267
+ return;
268
+ }
269
+ const new_edge: RFEdge = {
270
+ id: new_edge_id,
271
+ source: action.src_nid,
272
+ target: action.trg_nid,
273
+ sourceHandle: action.src_ioid,
274
+ targetHandle: action.trg_ioid,
275
+ className: "funcnodes-edge animated",
276
+ };
277
+
278
+ rfstore.setState({ edges: [...edges, new_edge] });
279
+ } else {
280
+ }
281
+ break;
282
+
283
+ case "delete":
284
+ if (action.from_remote) {
285
+ const edges = rfstate.edges;
286
+ const del_edge_id = generate_edge_id(action);
287
+ const new_edges = edges.filter((edge) => edge.id !== del_edge_id);
288
+ rfstore.setState({ edges: new_edges });
289
+ } else {
290
+ }
291
+ break;
292
+ default:
293
+ console.error("Unknown edge action", action);
294
+ }
295
+ };
296
+ /*
297
+ on_node_cahnge is called by react flow when a note change event is fired
298
+ should update the local state if something changed
299
+ */
300
+ const on_node_change = (nodechange: NodeChange[]) => {
301
+ for (const change of nodechange) {
302
+ switch (change.type) {
303
+ case "position":
304
+ if (change.position) {
305
+ on_node_action({
306
+ type: "update",
307
+ id: change.id,
308
+ node: {
309
+ frontend: { pos: [change.position.x, change.position.y] },
310
+ },
311
+ from_remote: false,
312
+ });
313
+ }
314
+ break;
315
+ case "dimensions":
316
+ if (change.dimensions) {
317
+ on_node_action({
318
+ type: "update",
319
+ id: change.id,
320
+ node: {
321
+ frontend: {
322
+ size: [change.dimensions.width, change.dimensions.height],
323
+ },
324
+ },
325
+ from_remote: false,
326
+ });
327
+ }
328
+ break;
329
+ }
330
+ }
331
+ };
332
+
333
+ const on_edge_change = (edgechange: EdgeChange[]) => {};
334
+
335
+ const on_connect = (connection: RFConnection) => {
336
+ if (
337
+ connection.source === null ||
338
+ connection.target === null ||
339
+ connection.sourceHandle === null ||
340
+ connection.targetHandle === null ||
341
+ !iterf.worker
342
+ ) {
343
+ return;
344
+ }
345
+ iterf.worker.add_edge({
346
+ src_nid: connection.source,
347
+ src_ioid: connection.sourceHandle,
348
+ trg_nid: connection.target,
349
+ trg_ioid: connection.targetHandle,
350
+ replace: true,
351
+ });
352
+ };
353
+
354
+ const rfstore = reactflowstore({
355
+ on_node_change,
356
+ on_edge_change,
357
+ on_connect,
358
+ });
359
+ const ns = NodeSpaceZustand({});
360
+ const lib = LibZustand();
361
+
362
+ const clear_all = () => {
363
+ iterf.worker?.disconnect();
364
+ iterf.worker = undefined;
365
+ iterf.workermanager?.setWorker(undefined);
366
+ iterf.lib.libstate.getState().set({ shelves: [] });
367
+ iterf.nodespace.nodesstates.clear();
368
+ iterf.useReactFlowStore.setState({ nodes: [], edges: [] });
369
+ iterf.auto_progress();
370
+ };
371
+ const iterf: FuncNodesReactFlowZustandInterface = {
372
+ lib: lib,
373
+ workermanager: undefined,
374
+ workers: create<WorkersState>((set, get) => ({})),
375
+ render_options: create<RenderOptions>((set, get) => ({})),
376
+ progress_state: create<ProgressState>((set, get) => ({
377
+ message: "please select worker",
378
+ status: "info",
379
+ progress: 0,
380
+ blocking: false,
381
+ })),
382
+ update_render_options: (options: RenderOptions) => {
383
+ const current = iterf.render_options.getState();
384
+ const { new_obj, change } = deep_merge(current, options);
385
+ if (change) {
386
+ iterf.render_options.setState(new_obj);
387
+ }
388
+ },
389
+ worker: undefined,
390
+ nodespace: ns,
391
+ useReactFlowStore: rfstore,
392
+ on_node_action: on_node_action,
393
+ on_edge_action: on_edge_action,
394
+ reactflowRef: null,
395
+ clear_all: clear_all,
396
+ set_progress: (progress: ProgressState) => {
397
+ if (progress.message === "") {
398
+ return iterf.auto_progress();
399
+ }
400
+
401
+ const prev_state = iterf.progress_state.getState();
402
+ const { new_obj, change } = deep_merge<ProgressState>(
403
+ prev_state,
404
+ progress
405
+ );
406
+ if (change) {
407
+ iterf.progress_state.setState(new_obj);
408
+ }
409
+ },
410
+ auto_progress: () => {
411
+ if (iterf.worker === undefined) {
412
+ return iterf.set_progress({
413
+ progress: 0,
414
+ message: "please select worker",
415
+ status: "error",
416
+ blocking: false,
417
+ });
418
+ }
419
+ if (!iterf.worker.is_open) {
420
+ return iterf.set_progress({
421
+ progress: 0,
422
+ message: "connecting to worker",
423
+ status: "info",
424
+ blocking: true,
425
+ });
426
+ }
427
+ iterf.set_progress({
428
+ progress: 1,
429
+ message: "running",
430
+ status: "info",
431
+ blocking: false,
432
+ });
433
+ },
434
+ };
435
+ return iterf;
436
+ };
437
+
438
+ export default FuncNodesReactFlowZustand;
439
+ export { LibZustand, NodeSpaceZustand };
440
+ export type { FuncNodesReactFlowZustandInterface, WorkersState };
@@ -0,0 +1,139 @@
1
+ import LibZustand, { LibZustandInterface } from "./lib";
2
+ import NodeSpaceZustand, { NodeSpaceZustandInterface } from "./nodespace";
3
+ import { FuncNodesReactFlowZustandInterface, WorkersState } from "./fnrfzst";
4
+ import FuncNodesReactFlowZustand from "./fnrfzst";
5
+ export default FuncNodesReactFlowZustand;
6
+ export { LibZustand, NodeSpaceZustand };
7
+ export type { FuncNodesReactFlowZustandInterface, WorkersState };
8
+
9
+ // Type alias for DeepPartial. It makes all properties of T optional and recursive.
10
+ type DeepPartial<T> = T extends object
11
+ ? {
12
+ [P in keyof T]?: DeepPartial<T[P]>;
13
+ }
14
+ : T;
15
+
16
+ /**
17
+ * Checks if the given item is a plain object.
18
+ * @param item The item to check.
19
+ * @returns true if the item is a plain object, false otherwise.
20
+ */
21
+ function isPlainObject(item: any): boolean {
22
+ return Object.prototype.toString.call(item) === "[object Object]";
23
+ }
24
+
25
+ function deep_compare_objects(a: any, b: any): boolean {
26
+ // Check for strict equality first
27
+ if (a === b) return true;
28
+
29
+ // If either is null or not an object, they're not equal (strict equality would have caught `a === b` if both were null)
30
+ if (
31
+ typeof a !== "object" ||
32
+ a === null ||
33
+ typeof b !== "object" ||
34
+ b === null
35
+ )
36
+ return false;
37
+
38
+ // If they're not the same type of object, they're not equal
39
+ if (a.constructor !== b.constructor) return false;
40
+
41
+ if (a.constructor === Object || a.constructor === Array) {
42
+ const keysA = Object.keys(a);
43
+ const keysB = Object.keys(b);
44
+
45
+ // If their property lengths are different, they're different objects
46
+ if (keysA.length !== keysB.length) return false;
47
+
48
+ // Check each key in 'a' to ensure it exists in 'b' and is equal; recurse if value is an object
49
+ for (const key of keysA) {
50
+ if (!keysB.includes(key)) return false;
51
+ if (!deep_compare_objects(a[key], b[key])) return false;
52
+ }
53
+ }
54
+
55
+ // Dates comparison
56
+ if (a instanceof Date && b instanceof Date)
57
+ return a.getTime() === b.getTime();
58
+
59
+ // If we've made it this far, objects must be considered equal
60
+ return true;
61
+ }
62
+
63
+ /**
64
+ *
65
+ * function to deeply merge two objects of type T.
66
+ *
67
+ * @param {T} target - The target object to be merged.
68
+ * @param {DeepPartial<T>} source - The source object to merge into the target. All properties of this object are optional.
69
+ *
70
+ * @returns {T} An object containing the merged object (new_obj) and a boolean indicating if there was a change (change).
71
+ */
72
+ const deep_merge = <T extends {}>(
73
+ target: T,
74
+ source: DeepPartial<T>
75
+ ): {
76
+ new_obj: T;
77
+ change: boolean;
78
+ } => {
79
+ let change = false;
80
+ if (!isPlainObject(target)) {
81
+ throw new Error("Target must be a plain object");
82
+ }
83
+ if (!isPlainObject(source)) {
84
+ throw new Error("Source must be a plain object");
85
+ }
86
+ const new_obj: T = { ...target };
87
+
88
+ Object.keys(source).forEach((key) => {
89
+ // @ts-ignore: Type 'string' cannot be used to index type 'T
90
+ const sourceValue = source[key];
91
+ // @ts-ignore: Type 'string' cannot be used to index type 'T
92
+ const targetValue = target[key];
93
+
94
+ if (isPlainObject(sourceValue) && isPlainObject(targetValue)) {
95
+ // If both the target and source values are plain objects, merge them
96
+ const { new_obj: mergedObj, change: didChange } = deep_merge(
97
+ targetValue,
98
+ sourceValue
99
+ );
100
+ if (didChange) {
101
+ change = true;
102
+ // @ts-ignore: Type 'string' cannot be used to index type 'T
103
+ new_obj[key] = mergedObj;
104
+ }
105
+ } else if (!deep_compare_objects(targetValue, sourceValue)) {
106
+ change = true;
107
+ // @ts-ignore: Type 'string' cannot be used to index type 'T
108
+ new_obj[key] = sourceValue;
109
+ }
110
+ });
111
+
112
+ return { new_obj, change };
113
+
114
+ // for (const key in source) {
115
+ // // @ts-ignore: Type 'string' cannot be used to index type 'T
116
+ // if (typeof source[key] === "object" && target[key]) {
117
+ // const { new_obj: new_obj2, change: change2 } = deep_merge(
118
+ // // @ts-ignore: Type 'string' cannot be used to index type 'T
119
+ // target[key],
120
+ // source[key]
121
+ // );
122
+ // if (change2) {
123
+ // change = true;
124
+ // // @ts-ignore: Type 'string' cannot be used to index type 'T
125
+ // new_obj[key] = new_obj2;
126
+ // }
127
+ // } else {
128
+ // // @ts-ignore: Type 'string' cannot be used to index type 'T'
129
+ // if (target[key] !== source[key]) {
130
+ // change = true;
131
+ // }
132
+ // // @ts-ignore: Type 'string' cannot be used to index type 'T'
133
+ // new_obj[key] = source[key];
134
+ // }
135
+ // }
136
+ // return { new_obj, change };
137
+ };
138
+ export { deep_merge, deep_compare_objects };
139
+ export type { DeepPartial };
@@ -0,0 +1,26 @@
1
+ import { useStore, create, UseBoundStore, StoreApi } from "zustand";
2
+
3
+ interface LibState {
4
+ state: LibType;
5
+ set: (state: LibType) => void;
6
+ get: () => LibType;
7
+ }
8
+
9
+ interface LibZustandInterface {
10
+ libstate: UseBoundStore<StoreApi<LibState>>;
11
+ }
12
+
13
+ const LibZustand = (): LibZustandInterface => {
14
+ return {
15
+ libstate: create<LibState>((set, get) => ({
16
+ state: {
17
+ shelves: [],
18
+ },
19
+ set: (state: LibType) => set({ state: state }),
20
+ get: () => get().state,
21
+ })),
22
+ };
23
+ };
24
+
25
+ export default LibZustand;
26
+ export type { LibZustandInterface, LibState };