@pixerate/editor-svelte 0.172.0 → 0.173.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.
|
@@ -5,7 +5,8 @@ export type CreateCanvasDocumentOptions<TNode extends CanvasNode = CanvasNode, T
|
|
|
5
5
|
* Svelte 5 rune: the save / load / undo contract (kind `canvas`) for nodes and edges held in
|
|
6
6
|
* `$state`, for `createEditorAutosave` or `createDocumentToolProvider`. Reads `getNodes()` /
|
|
7
7
|
* `getEdges()` reactively, so changes the history does not see (a finished drag, an edge
|
|
8
|
-
* removed by Svelte Flow) count too; selection, measuring
|
|
8
|
+
* removed by Svelte Flow) count too; selection, measuring, drag frames, `omitNodeKeys` /
|
|
9
|
+
* `omitEdgeKeys` and the viewport do not. Parity with
|
|
9
10
|
* React's `useCanvasEditorDocument`. Call `destroy()` when done.
|
|
10
11
|
*/
|
|
11
12
|
export declare function createCanvasDocument<TNode extends CanvasNode = CanvasNode, TEdge extends CanvasEdgeLike = CanvasEdge>(options: CreateCanvasDocumentOptions<TNode, TEdge>): EditorDocument<CanvasEditorDocument<TNode, TEdge>>;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { createCanvasEditorDocument } from '@pixerate/editor/canvas';
|
|
2
|
-
const contentKey = (nodes, edges) => JSON.stringify([
|
|
3
|
-
nodes.map(({ selected: _s, dragging: _d, measured: _m, resizing: _r, ...rest }) => rest),
|
|
4
|
-
edges.map(({ selected: _s, ...rest }) => rest)
|
|
5
|
-
]);
|
|
1
|
+
import { canvasDocumentContentKey, createCanvasEditorDocument } from '@pixerate/editor/canvas';
|
|
6
2
|
/**
|
|
7
3
|
* Svelte 5 rune: the save / load / undo contract (kind `canvas`) for nodes and edges held in
|
|
8
4
|
* `$state`, for `createEditorAutosave` or `createDocumentToolProvider`. Reads `getNodes()` /
|
|
9
5
|
* `getEdges()` reactively, so changes the history does not see (a finished drag, an edge
|
|
10
|
-
* removed by Svelte Flow) count too; selection, measuring
|
|
6
|
+
* removed by Svelte Flow) count too; selection, measuring, drag frames, `omitNodeKeys` /
|
|
7
|
+
* `omitEdgeKeys` and the viewport do not. Parity with
|
|
11
8
|
* React's `useCanvasEditorDocument`. Call `destroy()` when done.
|
|
12
9
|
*/
|
|
13
10
|
export function createCanvasDocument(options) {
|
|
@@ -26,7 +23,7 @@ export function createCanvasDocument(options) {
|
|
|
26
23
|
const edges = options.getEdges();
|
|
27
24
|
if (nodes.some((n) => n.dragging))
|
|
28
25
|
return;
|
|
29
|
-
const key =
|
|
26
|
+
const key = canvasDocumentContentKey(nodes, edges, options);
|
|
30
27
|
if (lastKey !== null && key !== lastKey)
|
|
31
28
|
listeners.forEach((listener) => listener());
|
|
32
29
|
lastKey = key;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.173.0",
|
|
4
4
|
"description": "Svelte bindings and prompt/rich-text components for @pixerate/editor",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"**/*.css"
|
|
166
166
|
],
|
|
167
167
|
"dependencies": {
|
|
168
|
-
"@pixerate/editor": "0.
|
|
168
|
+
"@pixerate/editor": "0.234.0"
|
|
169
169
|
},
|
|
170
170
|
"peerDependencies": {
|
|
171
171
|
"@dagrejs/dagre": "^1.1.4",
|