@sqlrooms/layout-config 0.27.0 → 0.28.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 +33 -34
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,59 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
## Features
|
|
4
|
-
|
|
5
|
-
- 📝 **Layout Configuration**: Define and manage room layout configuration schemas for Mosaic layouts
|
|
6
|
-
- 🔍 **Type Safety**: Strong TypeScript typing for layout configuration objects
|
|
7
|
-
- ✅ **Validation**: Zod schemas for runtime validation of layout configurations
|
|
1
|
+
Zod schemas and types for SQLRooms layout configuration (Mosaic layout).
|
|
8
2
|
|
|
9
3
|
## Installation
|
|
10
4
|
|
|
11
5
|
```bash
|
|
12
6
|
npm install @sqlrooms/layout-config
|
|
13
|
-
# or
|
|
14
|
-
yarn add @sqlrooms/layout-config
|
|
15
7
|
```
|
|
16
8
|
|
|
17
|
-
##
|
|
9
|
+
## Main exports
|
|
10
|
+
|
|
11
|
+
- `MAIN_VIEW`
|
|
12
|
+
- `LayoutTypes`
|
|
13
|
+
- `MosaicLayoutConfig`, `LayoutConfig`
|
|
14
|
+
- `MosaicLayoutNode`, `MosaicLayoutParent`, `isMosaicLayoutParent`
|
|
15
|
+
- `createDefaultMosaicLayout()`, `DEFAULT_MOSAIC_LAYOUT`
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
## Basic usage
|
|
20
18
|
|
|
21
|
-
```
|
|
19
|
+
```ts
|
|
22
20
|
import {
|
|
23
|
-
MosaicLayoutConfig,
|
|
24
21
|
LayoutConfig,
|
|
25
22
|
MAIN_VIEW,
|
|
23
|
+
MosaicLayoutConfig,
|
|
24
|
+
createDefaultMosaicLayout,
|
|
26
25
|
} from '@sqlrooms/layout-config';
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const minimalLayout = createDefaultMosaicLayout();
|
|
28
|
+
|
|
29
|
+
const twoPaneLayout: MosaicLayoutConfig = {
|
|
30
30
|
type: 'mosaic',
|
|
31
31
|
nodes: {
|
|
32
32
|
direction: 'row',
|
|
33
|
-
first:
|
|
34
|
-
second:
|
|
35
|
-
|
|
36
|
-
first: 'files',
|
|
37
|
-
second: 'tables',
|
|
38
|
-
},
|
|
33
|
+
first: 'data',
|
|
34
|
+
second: MAIN_VIEW,
|
|
35
|
+
splitPercentage: 30,
|
|
39
36
|
},
|
|
40
37
|
};
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// ... other properties
|
|
45
|
-
layout: LayoutConfig;
|
|
46
|
-
}
|
|
39
|
+
const validatedMinimal: LayoutConfig = LayoutConfig.parse(minimalLayout);
|
|
40
|
+
const validated: LayoutConfig = LayoutConfig.parse(twoPaneLayout);
|
|
47
41
|
```
|
|
48
42
|
|
|
49
|
-
##
|
|
50
|
-
|
|
51
|
-
- **Schema Extensions**: Extend base schemas for custom room types
|
|
52
|
-
- **Configuration Validation**: Validate configurations at runtime
|
|
53
|
-
- **Serialization**: Convert configurations to/from JSON for storage
|
|
54
|
-
|
|
55
|
-
For more information, visit the SQLRooms documentation.
|
|
43
|
+
## Typical integration
|
|
56
44
|
|
|
57
|
-
```
|
|
45
|
+
```ts
|
|
46
|
+
import {createRoomShellSlice} from '@sqlrooms/room-shell';
|
|
47
|
+
// `DataPanel` and `MainPanel` are app-level React components in your project.
|
|
58
48
|
|
|
49
|
+
createRoomShellSlice({
|
|
50
|
+
layout: {
|
|
51
|
+
config: twoPaneLayout,
|
|
52
|
+
panels: {
|
|
53
|
+
data: {title: 'Data', component: DataPanel, placement: 'sidebar'},
|
|
54
|
+
main: {title: 'Main', component: MainPanel, placement: 'main'},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
59
58
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/layout-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"typecheck": "tsc --noEmit",
|
|
29
29
|
"typedoc": "typedoc"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "dcac54f8adf77240e293c93d224a0ce9fd8142a9"
|
|
32
32
|
}
|