@3plate/graph-vue 0.1.9 → 0.1.12
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 +8 -8
- package/dist/{index.mjs → index.cjs} +51 -23
- package/dist/{index.d.mts → index.d.cts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -51
- package/package.json +12 -4
package/README.md
CHANGED
|
@@ -159,14 +159,14 @@ function addNode() {
|
|
|
159
159
|
|
|
160
160
|
## Props
|
|
161
161
|
|
|
162
|
-
| Prop
|
|
163
|
-
|
|
164
|
-
| `nodes`
|
|
165
|
-
| `edges`
|
|
166
|
-
| `history`
|
|
162
|
+
| Prop | Type | Description |
|
|
163
|
+
|-------------|-------------------|---------------------------------|
|
|
164
|
+
| `nodes` | `N[]` | Array of node objects |
|
|
165
|
+
| `edges` | `E[]` | Array of edge objects |
|
|
166
|
+
| `history` | `Update<N, E>[]` | History updates for time-travel |
|
|
167
167
|
| `ingestion` | `IngestionConfig` | WebSocket or file source config |
|
|
168
|
-
| `options`
|
|
169
|
-
| `events`
|
|
168
|
+
| `options` | `APIOptions` | Graph and canvas options |
|
|
169
|
+
| `events` | `EventsOptions` | Event handlers |
|
|
170
170
|
|
|
171
171
|
### Playground Component
|
|
172
172
|
|
|
@@ -215,7 +215,7 @@ const examples = {
|
|
|
215
215
|
## Features
|
|
216
216
|
|
|
217
217
|
- **Reactive updates** — Props changes are efficiently diffed and applied
|
|
218
|
-
- **Incremental history** — Appended history
|
|
218
|
+
- **Incremental history** — Appended history updates are applied incrementally
|
|
219
219
|
- **Style updates** — Theme and type changes are applied without re-render
|
|
220
220
|
- **Color mode** — Light/dark mode changes are applied instantly
|
|
221
221
|
- **Cleanup** — Resources are properly cleaned up on unmount
|
|
@@ -1,7 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Graph: () => Graph,
|
|
24
|
+
Playground: () => Playground
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
|
|
1
28
|
// src/Graph.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var Graph = defineComponent({
|
|
29
|
+
var import_vue = require("vue");
|
|
30
|
+
var import_graph_core = require("@3plate/graph-core");
|
|
31
|
+
var Graph = (0, import_vue.defineComponent)({
|
|
5
32
|
name: "Graph",
|
|
6
33
|
props: {
|
|
7
34
|
/** Initial nodes */
|
|
@@ -36,13 +63,13 @@ var Graph = defineComponent({
|
|
|
36
63
|
}
|
|
37
64
|
},
|
|
38
65
|
setup(props) {
|
|
39
|
-
const rootRef = ref(null);
|
|
40
|
-
const apiRef = ref(null);
|
|
66
|
+
const rootRef = (0, import_vue.ref)(null);
|
|
67
|
+
const apiRef = (0, import_vue.ref)(null);
|
|
41
68
|
const rootId = `graph-${Math.random().toString(36).slice(2, 11)}`;
|
|
42
|
-
onMounted(async () => {
|
|
69
|
+
(0, import_vue.onMounted)(async () => {
|
|
43
70
|
if (!rootRef.value) return;
|
|
44
71
|
rootRef.value.id = rootId;
|
|
45
|
-
const api = await graph({
|
|
72
|
+
const api = await (0, import_graph_core.graph)({
|
|
46
73
|
root: rootId,
|
|
47
74
|
nodes: props.nodes,
|
|
48
75
|
edges: props.edges,
|
|
@@ -53,7 +80,7 @@ var Graph = defineComponent({
|
|
|
53
80
|
});
|
|
54
81
|
apiRef.value = api;
|
|
55
82
|
});
|
|
56
|
-
onUnmounted(() => {
|
|
83
|
+
(0, import_vue.onUnmounted)(() => {
|
|
57
84
|
if (apiRef.value) {
|
|
58
85
|
apiRef.value.destroy();
|
|
59
86
|
apiRef.value = null;
|
|
@@ -65,7 +92,7 @@ var Graph = defineComponent({
|
|
|
65
92
|
}
|
|
66
93
|
}
|
|
67
94
|
});
|
|
68
|
-
watch(
|
|
95
|
+
(0, import_vue.watch)(
|
|
69
96
|
() => [props.nodes, props.edges, props.history, props.options],
|
|
70
97
|
() => {
|
|
71
98
|
if (!apiRef.value) return;
|
|
@@ -73,7 +100,7 @@ var Graph = defineComponent({
|
|
|
73
100
|
},
|
|
74
101
|
{ deep: true }
|
|
75
102
|
);
|
|
76
|
-
return () => h("div", {
|
|
103
|
+
return () => (0, import_vue.h)("div", {
|
|
77
104
|
ref: rootRef,
|
|
78
105
|
style: { width: "100%", height: "100%" }
|
|
79
106
|
});
|
|
@@ -81,9 +108,9 @@ var Graph = defineComponent({
|
|
|
81
108
|
});
|
|
82
109
|
|
|
83
110
|
// src/Playground.ts
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
var Playground =
|
|
111
|
+
var import_vue2 = require("vue");
|
|
112
|
+
var import_graph_core2 = require("@3plate/graph-core");
|
|
113
|
+
var Playground = (0, import_vue2.defineComponent)({
|
|
87
114
|
name: "Playground",
|
|
88
115
|
props: {
|
|
89
116
|
/** Examples to display */
|
|
@@ -98,14 +125,14 @@ var Playground = defineComponent2({
|
|
|
98
125
|
}
|
|
99
126
|
},
|
|
100
127
|
setup(props) {
|
|
101
|
-
const rootRef =
|
|
102
|
-
const playgroundRef =
|
|
128
|
+
const rootRef = (0, import_vue2.ref)(null);
|
|
129
|
+
const playgroundRef = (0, import_vue2.ref)(null);
|
|
103
130
|
const rootId = `playground-${Math.random().toString(36).slice(2, 11)}`;
|
|
104
|
-
const prevExamples =
|
|
105
|
-
|
|
131
|
+
const prevExamples = (0, import_vue2.ref)({});
|
|
132
|
+
(0, import_vue2.onMounted)(async () => {
|
|
106
133
|
if (!rootRef.value) return;
|
|
107
134
|
rootRef.value.id = rootId;
|
|
108
|
-
const playground = new
|
|
135
|
+
const playground = new import_graph_core2.Playground({
|
|
109
136
|
root: rootId,
|
|
110
137
|
examples: props.examples,
|
|
111
138
|
defaultExample: props.defaultExample
|
|
@@ -114,10 +141,10 @@ var Playground = defineComponent2({
|
|
|
114
141
|
prevExamples.value = { ...props.examples };
|
|
115
142
|
await playground.init();
|
|
116
143
|
});
|
|
117
|
-
|
|
144
|
+
(0, import_vue2.onUnmounted)(() => {
|
|
118
145
|
playgroundRef.value = null;
|
|
119
146
|
});
|
|
120
|
-
|
|
147
|
+
(0, import_vue2.watch)(
|
|
121
148
|
() => props.examples,
|
|
122
149
|
(current) => {
|
|
123
150
|
if (!playgroundRef.value) return;
|
|
@@ -139,7 +166,7 @@ var Playground = defineComponent2({
|
|
|
139
166
|
},
|
|
140
167
|
{ deep: true }
|
|
141
168
|
);
|
|
142
|
-
return () =>
|
|
169
|
+
return () => (0, import_vue2.h)("div", {
|
|
143
170
|
ref: rootRef,
|
|
144
171
|
style: { width: "100%", height: "100%" }
|
|
145
172
|
});
|
|
@@ -181,7 +208,8 @@ function shallowEqualSource(a, b) {
|
|
|
181
208
|
}
|
|
182
209
|
return false;
|
|
183
210
|
}
|
|
184
|
-
export
|
|
211
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
212
|
+
0 && (module.exports = {
|
|
185
213
|
Graph,
|
|
186
214
|
Playground
|
|
187
|
-
};
|
|
215
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _3plate_graph_core from '@3plate/graph-core';
|
|
2
2
|
import { Update, IngestionConfig, APIArguments, PlaygroundOptions } from '@3plate/graph-core';
|
|
3
|
-
export { API, APIArguments, IngestionConfig, Update } from '@3plate/graph-core';
|
|
3
|
+
export { API, APIArguments, APIOptions, CanvasTheme, ColorMode, EdgeProps, EdgeTheme, EventsOptions, HistoryMessage, IngestMessage, IngestionConfig, NewEdge, NewNode, NodeAlign, NodeProps, NodeTheme, Orientation, PortProps, PortStyle, PortTheme, RenderNode, SnapshotMessage, ThemeVars, Update, UpdateMessage, WebSocketStatus, WebSocketStatusListener } from '@3plate/graph-core';
|
|
4
4
|
import * as vue from 'vue';
|
|
5
5
|
import { PropType } from 'vue';
|
|
6
6
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _3plate_graph_core from '@3plate/graph-core';
|
|
2
2
|
import { Update, IngestionConfig, APIArguments, PlaygroundOptions } from '@3plate/graph-core';
|
|
3
|
-
export { API, APIArguments, IngestionConfig, Update } from '@3plate/graph-core';
|
|
3
|
+
export { API, APIArguments, APIOptions, CanvasTheme, ColorMode, EdgeProps, EdgeTheme, EventsOptions, HistoryMessage, IngestMessage, IngestionConfig, NewEdge, NewNode, NodeAlign, NodeProps, NodeTheme, Orientation, PortProps, PortStyle, PortTheme, RenderNode, SnapshotMessage, ThemeVars, Update, UpdateMessage, WebSocketStatus, WebSocketStatusListener } from '@3plate/graph-core';
|
|
4
4
|
import * as vue from 'vue';
|
|
5
5
|
import { PropType } from 'vue';
|
|
6
6
|
|
package/dist/index.js
CHANGED
|
@@ -1,34 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
Graph: () => Graph,
|
|
24
|
-
Playground: () => Playground
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
|
|
28
1
|
// src/Graph.ts
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var Graph =
|
|
2
|
+
import { defineComponent, ref, onMounted, onUnmounted, watch, h } from "vue";
|
|
3
|
+
import { graph } from "@3plate/graph-core";
|
|
4
|
+
var Graph = defineComponent({
|
|
32
5
|
name: "Graph",
|
|
33
6
|
props: {
|
|
34
7
|
/** Initial nodes */
|
|
@@ -63,13 +36,13 @@ var Graph = (0, import_vue.defineComponent)({
|
|
|
63
36
|
}
|
|
64
37
|
},
|
|
65
38
|
setup(props) {
|
|
66
|
-
const rootRef =
|
|
67
|
-
const apiRef =
|
|
39
|
+
const rootRef = ref(null);
|
|
40
|
+
const apiRef = ref(null);
|
|
68
41
|
const rootId = `graph-${Math.random().toString(36).slice(2, 11)}`;
|
|
69
|
-
|
|
42
|
+
onMounted(async () => {
|
|
70
43
|
if (!rootRef.value) return;
|
|
71
44
|
rootRef.value.id = rootId;
|
|
72
|
-
const api = await
|
|
45
|
+
const api = await graph({
|
|
73
46
|
root: rootId,
|
|
74
47
|
nodes: props.nodes,
|
|
75
48
|
edges: props.edges,
|
|
@@ -80,7 +53,7 @@ var Graph = (0, import_vue.defineComponent)({
|
|
|
80
53
|
});
|
|
81
54
|
apiRef.value = api;
|
|
82
55
|
});
|
|
83
|
-
|
|
56
|
+
onUnmounted(() => {
|
|
84
57
|
if (apiRef.value) {
|
|
85
58
|
apiRef.value.destroy();
|
|
86
59
|
apiRef.value = null;
|
|
@@ -92,7 +65,7 @@ var Graph = (0, import_vue.defineComponent)({
|
|
|
92
65
|
}
|
|
93
66
|
}
|
|
94
67
|
});
|
|
95
|
-
|
|
68
|
+
watch(
|
|
96
69
|
() => [props.nodes, props.edges, props.history, props.options],
|
|
97
70
|
() => {
|
|
98
71
|
if (!apiRef.value) return;
|
|
@@ -100,7 +73,7 @@ var Graph = (0, import_vue.defineComponent)({
|
|
|
100
73
|
},
|
|
101
74
|
{ deep: true }
|
|
102
75
|
);
|
|
103
|
-
return () =>
|
|
76
|
+
return () => h("div", {
|
|
104
77
|
ref: rootRef,
|
|
105
78
|
style: { width: "100%", height: "100%" }
|
|
106
79
|
});
|
|
@@ -108,9 +81,9 @@ var Graph = (0, import_vue.defineComponent)({
|
|
|
108
81
|
});
|
|
109
82
|
|
|
110
83
|
// src/Playground.ts
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var Playground = (
|
|
84
|
+
import { defineComponent as defineComponent2, ref as ref2, onMounted as onMounted2, onUnmounted as onUnmounted2, watch as watch2, h as h2 } from "vue";
|
|
85
|
+
import { Playground as PlaygroundClass } from "@3plate/graph-core";
|
|
86
|
+
var Playground = defineComponent2({
|
|
114
87
|
name: "Playground",
|
|
115
88
|
props: {
|
|
116
89
|
/** Examples to display */
|
|
@@ -125,14 +98,14 @@ var Playground = (0, import_vue2.defineComponent)({
|
|
|
125
98
|
}
|
|
126
99
|
},
|
|
127
100
|
setup(props) {
|
|
128
|
-
const rootRef = (
|
|
129
|
-
const playgroundRef = (
|
|
101
|
+
const rootRef = ref2(null);
|
|
102
|
+
const playgroundRef = ref2(null);
|
|
130
103
|
const rootId = `playground-${Math.random().toString(36).slice(2, 11)}`;
|
|
131
|
-
const prevExamples = (
|
|
132
|
-
(
|
|
104
|
+
const prevExamples = ref2({});
|
|
105
|
+
onMounted2(async () => {
|
|
133
106
|
if (!rootRef.value) return;
|
|
134
107
|
rootRef.value.id = rootId;
|
|
135
|
-
const playground = new
|
|
108
|
+
const playground = new PlaygroundClass({
|
|
136
109
|
root: rootId,
|
|
137
110
|
examples: props.examples,
|
|
138
111
|
defaultExample: props.defaultExample
|
|
@@ -141,10 +114,10 @@ var Playground = (0, import_vue2.defineComponent)({
|
|
|
141
114
|
prevExamples.value = { ...props.examples };
|
|
142
115
|
await playground.init();
|
|
143
116
|
});
|
|
144
|
-
(
|
|
117
|
+
onUnmounted2(() => {
|
|
145
118
|
playgroundRef.value = null;
|
|
146
119
|
});
|
|
147
|
-
(
|
|
120
|
+
watch2(
|
|
148
121
|
() => props.examples,
|
|
149
122
|
(current) => {
|
|
150
123
|
if (!playgroundRef.value) return;
|
|
@@ -166,7 +139,7 @@ var Playground = (0, import_vue2.defineComponent)({
|
|
|
166
139
|
},
|
|
167
140
|
{ deep: true }
|
|
168
141
|
);
|
|
169
|
-
return () => (
|
|
142
|
+
return () => h2("div", {
|
|
170
143
|
ref: rootRef,
|
|
171
144
|
style: { width: "100%", height: "100%" }
|
|
172
145
|
});
|
|
@@ -208,8 +181,7 @@ function shallowEqualSource(a, b) {
|
|
|
208
181
|
}
|
|
209
182
|
return false;
|
|
210
183
|
}
|
|
211
|
-
|
|
212
|
-
0 && (module.exports = {
|
|
184
|
+
export {
|
|
213
185
|
Graph,
|
|
214
186
|
Playground
|
|
215
|
-
}
|
|
187
|
+
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3plate/graph-vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"license": "GPL-3.0",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "https://github.com/3plt/graph",
|
|
8
9
|
"directory": "packages/vue"
|
|
9
10
|
},
|
|
10
|
-
"main": "./dist/index.
|
|
11
|
-
"module": "./dist/index.
|
|
11
|
+
"main": "./dist/index.cjs",
|
|
12
|
+
"module": "./dist/index.js",
|
|
12
13
|
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"require": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
13
21
|
"files": [
|
|
14
22
|
"dist"
|
|
15
23
|
],
|
|
@@ -20,7 +28,7 @@
|
|
|
20
28
|
"vue": "^3.3.0"
|
|
21
29
|
},
|
|
22
30
|
"dependencies": {
|
|
23
|
-
"@3plate/graph-core": "0.1.
|
|
31
|
+
"@3plate/graph-core": "0.1.12"
|
|
24
32
|
},
|
|
25
33
|
"devDependencies": {
|
|
26
34
|
"tsup": "^8.5.1",
|