@sqlrooms/room-config 0.26.0-rc.6 → 0.26.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 (2) hide show
  1. package/README.md +22 -11
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -42,21 +42,31 @@ Room configuration is designed to be saved and restored between sessions. Here's
42
42
 
43
43
  ```tsx
44
44
  import {persist} from 'zustand/middleware';
45
- import {createRoomStore, createRoomShellSlice} from '@sqlrooms/room-shell';
45
+ import {
46
+ createRoomStore,
47
+ createRoomShellSlice,
48
+ RoomShellSliceState,
49
+ StateCreator,
50
+ createPersistHelpers,
51
+ LayoutConfig,
52
+ } from '@sqlrooms/room-shell';
46
53
  import {BaseRoomConfig} from '@sqlrooms/room-config';
47
54
 
55
+ type MyRoomState = RoomShellSliceState;
56
+
48
57
  // Create a store with persistence for configuration
49
- const {useRoomStore} = createRoomStore(
58
+ const {useRoomStore} = createRoomStore<MyRoomState>(
50
59
  persist(
51
60
  (set, get, store) => ({
52
61
  ...createRoomShellSlice({
53
- // Config is stored at the root level of state for persisting the app state
54
62
  config: {
55
63
  title: 'My Room',
56
64
  // Other configuration properties
57
65
  },
58
- // Room object contains panels and runtime-only state
59
- room: {
66
+ layout: {
67
+ config: {
68
+ // Layout configuration
69
+ },
60
70
  panels: {
61
71
  // Panel definitions
62
72
  },
@@ -65,18 +75,19 @@ const {useRoomStore} = createRoomStore(
65
75
  }),
66
76
  {
67
77
  name: 'room-config-storage',
68
- // Only persist the configuration part of the state
69
- partialize: (state) => ({
70
- config: state.config,
78
+ // Use helper to persist configuration
79
+ ...createPersistHelpers({
80
+ room: BaseRoomConfig,
81
+ layout: LayoutConfig,
71
82
  }),
72
83
  },
73
- ),
84
+ ) as StateCreator<MyRoomState>,
74
85
  );
75
86
 
76
87
  // Access the config in components
77
88
  function ConfigComponent() {
78
- // Config is accessed directly from state, not from state.room.config
79
- const config = useRoomStore((state) => state.config);
89
+ // Config is accessed from state.room.config
90
+ const config = useRoomStore((state) => state.room.config);
80
91
 
81
92
  return <div>{config.title}</div>;
82
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sqlrooms/room-config",
3
- "version": "0.26.0-rc.6",
3
+ "version": "0.26.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "access": "public"
19
19
  },
20
20
  "dependencies": {
21
- "@sqlrooms/layout-config": "0.26.0-rc.6",
21
+ "@sqlrooms/layout-config": "0.26.0",
22
22
  "zod": "^4.1.8"
23
23
  },
24
24
  "peerDependencies": {
@@ -32,5 +32,5 @@
32
32
  "typecheck": "tsc --noEmit",
33
33
  "typedoc": "typedoc"
34
34
  },
35
- "gitHead": "f7b18280e7d81f653bb437cf81b1e23243809053"
35
+ "gitHead": "3376e76ddfa3c54097b79a20b88a1c37814dca61"
36
36
  }