@sqlrooms/canvas 0.29.0-rc.12 → 0.29.0-rc.13
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 +61 -2
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
# @sqlrooms/canvas
|
|
2
|
+
|
|
3
|
+
> **Experimental:** This package's API and behavior may change between releases.
|
|
4
|
+
|
|
5
|
+
React Flow-based, artifact-scoped canvas for building SQL and Vega node DAGs in
|
|
6
|
+
SQLRooms apps.
|
|
2
7
|
|
|
3
8
|
This package includes:
|
|
4
9
|
|
|
@@ -7,7 +12,61 @@ This package includes:
|
|
|
7
12
|
- `Canvas` React component, which requires an explicit `artifactId`
|
|
8
13
|
- `CanvasSliceConfig`, `CanvasNodeMeta`, and `CanvasArtifactMeta` schemas/types
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
Canvas uses the canonical cell state from `@sqlrooms/cells`. Compose both
|
|
18
|
+
slices, persist both configs, and initialize backing state for each canvas
|
|
19
|
+
artifact:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import {Canvas, CanvasSliceConfig, createCanvasSlice} from '@sqlrooms/canvas';
|
|
23
|
+
import {
|
|
24
|
+
CellsSliceConfig,
|
|
25
|
+
createCellsSlice,
|
|
26
|
+
createDefaultCellRegistry,
|
|
27
|
+
} from '@sqlrooms/cells';
|
|
28
|
+
import {
|
|
29
|
+
RoomStateProvider,
|
|
30
|
+
createRoomShellSlice,
|
|
31
|
+
createRoomStore,
|
|
32
|
+
persistSliceConfigs,
|
|
33
|
+
} from '@sqlrooms/room-shell';
|
|
34
|
+
|
|
35
|
+
const {roomStore} = createRoomStore(
|
|
36
|
+
persistSliceConfigs(
|
|
37
|
+
{
|
|
38
|
+
name: 'canvas-workspace',
|
|
39
|
+
sliceConfigSchemas: {
|
|
40
|
+
canvas: CanvasSliceConfig,
|
|
41
|
+
cells: CellsSliceConfig,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
(set, get, store) => ({
|
|
45
|
+
...createRoomShellSlice({})(set, get, store),
|
|
46
|
+
...createCellsSlice({
|
|
47
|
+
cellRegistry: createDefaultCellRegistry(),
|
|
48
|
+
})(set, get, store),
|
|
49
|
+
...createCanvasSlice()(set, get, store),
|
|
50
|
+
}),
|
|
51
|
+
),
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
roomStore.getState().canvas.ensureArtifact('analysis-canvas');
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Render the canvas inside a `RoomShell` (or another host that provides the room
|
|
58
|
+
store context):
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<RoomStateProvider roomStore={roomStore}>
|
|
62
|
+
<Canvas artifactId="analysis-canvas" />
|
|
63
|
+
</RoomStateProvider>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
When canvases are top-level workspace entries, connect `ensureArtifact()` and
|
|
67
|
+
`removeArtifact()` to an `@sqlrooms/artifacts` type lifecycle. See the
|
|
68
|
+
[Artifacts guide](https://sqlrooms.org/artifacts) and the
|
|
69
|
+
[Canvas example](https://github.com/sqlrooms/examples/tree/main/canvas).
|
|
11
70
|
|
|
12
71
|
## Stable vs internal imports
|
|
13
72
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/canvas",
|
|
3
|
-
"version": "0.29.0-rc.
|
|
3
|
+
"version": "0.29.0-rc.13",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/sqlrooms/sqlrooms.git"
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@paralleldrive/cuid2": "^3.0.0",
|
|
39
|
-
"@sqlrooms/cells": "0.29.0-rc.
|
|
40
|
-
"@sqlrooms/crdt": "0.29.0-rc.
|
|
41
|
-
"@sqlrooms/duckdb": "0.29.0-rc.
|
|
42
|
-
"@sqlrooms/room-store": "0.29.0-rc.
|
|
43
|
-
"@sqlrooms/ui": "0.29.0-rc.
|
|
44
|
-
"@sqlrooms/utils": "0.29.0-rc.
|
|
39
|
+
"@sqlrooms/cells": "0.29.0-rc.13",
|
|
40
|
+
"@sqlrooms/crdt": "0.29.0-rc.13",
|
|
41
|
+
"@sqlrooms/duckdb": "0.29.0-rc.13",
|
|
42
|
+
"@sqlrooms/room-store": "0.29.0-rc.13",
|
|
43
|
+
"@sqlrooms/ui": "0.29.0-rc.13",
|
|
44
|
+
"@sqlrooms/utils": "0.29.0-rc.13",
|
|
45
45
|
"@xyflow/react": "^12.8.5",
|
|
46
46
|
"immer": "^11.0.1",
|
|
47
47
|
"loro-mirror": "^1.1.2",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "d183fe9164e5f67c23b358328ca03dbf77a035a4"
|
|
59
59
|
}
|