@nodish/core 0.3.0 → 0.3.1
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/dist/index.css +1 -1
- package/dist/index.d.ts +38 -2
- package/dist/index.js +719 -609
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, nextTick as c, normalizeClass as l, normalizeStyle as u, onMounted as d, onUnmounted as f, openBlock as p, ref as m, renderList as h, renderSlot as g, resolveDynamicComponent as _, toDisplayString as v, unref as y, useCssVars as b, vModelText as x, watch as
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, nextTick as c, normalizeClass as l, normalizeStyle as u, onMounted as d, onUnmounted as f, openBlock as p, ref as m, renderList as h, renderSlot as g, resolveDynamicComponent as _, toDisplayString as v, unref as y, useCssVars as b, vModelText as x, watch as S, withCtx as C, withDirectives as w, withModifiers as T } from "vue";
|
|
2
2
|
import './index.css';//#region src/store/graph/pruneConnections.ts
|
|
3
|
-
function
|
|
3
|
+
function E(e, t) {
|
|
4
4
|
e.graph.connections = e.graph.connections.filter((e) => !(e.from.node === t.id && !t.outputs[e.from.port] || e.to.node === t.id && !t.inputs[e.to.port]));
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/store/graph/dynamicPorts.ts
|
|
8
|
-
function
|
|
8
|
+
function D(e, t) {
|
|
9
9
|
return e.resolvePorts ? e.resolvePorts(t) : {
|
|
10
10
|
inputs: e.inputs,
|
|
11
11
|
outputs: e.outputs
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function O(e) {
|
|
15
15
|
let t = {};
|
|
16
16
|
for (let n of Object.values(e.inputs)) n.userOnly && (t[n.name] = n.value);
|
|
17
17
|
return t;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function ee(e) {
|
|
20
20
|
let t = {};
|
|
21
21
|
for (let n of Object.values(e.inputs)) n.userOnly && (t[n.name] = n.defaultValue);
|
|
22
22
|
return t;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function k(e, t, n) {
|
|
25
25
|
let r = {};
|
|
26
26
|
for (let t of Object.values(e)) r[t.name] = t;
|
|
27
27
|
let i = {};
|
|
28
28
|
for (let e of Object.values(t)) {
|
|
29
29
|
let t = r[e.name];
|
|
30
|
-
if (t) t.type = e.type, t.types = e.types, t.userOnly = e.userOnly, t.multi = e.multi, t.widgetId = e.widgetId, t.customProps = e.customProps, i[t.id] = t;
|
|
30
|
+
if (t) t.type = e.type, t.types = e.types, t.userOnly = e.userOnly, t.multi = e.multi, t.widgetId = e.widgetId, t.connectionOnly = e.connectionOnly, t.customProps = e.customProps, i[t.id] = t;
|
|
31
31
|
else {
|
|
32
32
|
let t = crypto.randomUUID();
|
|
33
33
|
i[t] = {
|
|
@@ -40,21 +40,22 @@ function O(e, t, n) {
|
|
|
40
40
|
userOnly: e.userOnly,
|
|
41
41
|
multi: e.multi,
|
|
42
42
|
widgetId: e.widgetId,
|
|
43
|
+
connectionOnly: e.connectionOnly,
|
|
43
44
|
customProps: e.customProps
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
return i;
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function A(e, t) {
|
|
50
51
|
let n = e.nodeTypes[t.typeId];
|
|
51
52
|
if (!n?.resolvePorts) return;
|
|
52
|
-
let r =
|
|
53
|
-
t.inputs =
|
|
53
|
+
let r = D(n, O(t));
|
|
54
|
+
t.inputs = k(t.inputs, r.inputs, "input"), t.outputs = k(t.outputs, r.outputs, "output"), E(e, t);
|
|
54
55
|
}
|
|
55
56
|
//#endregion
|
|
56
57
|
//#region src/store/graph/expandIO.ts
|
|
57
|
-
function
|
|
58
|
+
function j(e) {
|
|
58
59
|
let t = {};
|
|
59
60
|
for (let [n, r] of Object.entries(e ?? {})) t[n] = {
|
|
60
61
|
name: n,
|
|
@@ -64,39 +65,39 @@ function A(e) {
|
|
|
64
65
|
}
|
|
65
66
|
//#endregion
|
|
66
67
|
//#region src/store/model.ts
|
|
67
|
-
var
|
|
68
|
+
var M = {
|
|
68
69
|
parameters: {},
|
|
69
70
|
returns: {}
|
|
70
71
|
};
|
|
71
72
|
//#endregion
|
|
72
73
|
//#region src/store/registry/defineNode.ts
|
|
73
|
-
function
|
|
74
|
+
function N(e) {
|
|
74
75
|
return {
|
|
75
76
|
typeId: e.typeId,
|
|
76
77
|
displayName: e.displayName,
|
|
77
78
|
color: e.color ?? "#3a3f4b",
|
|
78
79
|
description: e.description ?? "",
|
|
79
80
|
group: e.group ?? [],
|
|
80
|
-
inputs:
|
|
81
|
-
outputs:
|
|
81
|
+
inputs: j(e.inputs),
|
|
82
|
+
outputs: j(e.outputs),
|
|
82
83
|
execute: e.execute,
|
|
83
84
|
graph: e.graph,
|
|
84
85
|
resolvePorts: e.resolvePorts ? (t) => {
|
|
85
86
|
let n = e.resolvePorts(t);
|
|
86
87
|
return {
|
|
87
|
-
inputs:
|
|
88
|
-
outputs:
|
|
88
|
+
inputs: j(n.inputs),
|
|
89
|
+
outputs: j(n.outputs)
|
|
89
90
|
};
|
|
90
91
|
} : void 0
|
|
91
92
|
};
|
|
92
93
|
}
|
|
93
94
|
//#endregion
|
|
94
95
|
//#region src/store/registry/index.ts
|
|
95
|
-
function
|
|
96
|
+
function te(e, t) {
|
|
96
97
|
Object.assign(e.types, t);
|
|
97
98
|
}
|
|
98
99
|
function P(e, t) {
|
|
99
|
-
for (let [n, r] of Object.entries(t)) e.nodeTypes[n] =
|
|
100
|
+
for (let [n, r] of Object.entries(t)) e.nodeTypes[n] = N(r);
|
|
100
101
|
}
|
|
101
102
|
function F(e, t) {
|
|
102
103
|
e.extensions.includes(t.id) || e.extensions.push(t.id);
|
|
@@ -117,13 +118,14 @@ function I(e, t) {
|
|
|
117
118
|
userOnly: r.userOnly,
|
|
118
119
|
multi: r.multi,
|
|
119
120
|
widgetId: r.widgetId,
|
|
121
|
+
connectionOnly: r.connectionOnly,
|
|
120
122
|
customProps: r.customProps
|
|
121
123
|
};
|
|
122
124
|
}
|
|
123
125
|
return n;
|
|
124
126
|
}
|
|
125
127
|
function L(e, t) {
|
|
126
|
-
let { inputs: n, outputs: r } =
|
|
128
|
+
let { inputs: n, outputs: r } = D(e, ee(e));
|
|
127
129
|
return {
|
|
128
130
|
id: crypto.randomUUID(),
|
|
129
131
|
typeId: e.typeId,
|
|
@@ -140,7 +142,7 @@ function R(e) {
|
|
|
140
142
|
//#endregion
|
|
141
143
|
//#region src/store/interface/graphInterface.ts
|
|
142
144
|
var ne = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
143
|
-
function
|
|
145
|
+
function re(e, t) {
|
|
144
146
|
let n = [], r = (t, r) => {
|
|
145
147
|
let i = /* @__PURE__ */ new Set();
|
|
146
148
|
for (let [a, o] of Object.entries(t ?? {})) ne.test(a) || n.push(`${r}: invalid port name "${a}"`), i.has(a) && n.push(`${r}: duplicate port name "${a}"`), i.add(a), e.types[o.type] || n.push(`${r}: unknown type "${o.type}" on port "${a}"`);
|
|
@@ -149,7 +151,7 @@ function z(e, t) {
|
|
|
149
151
|
}
|
|
150
152
|
//#endregion
|
|
151
153
|
//#region src/store/nodes/io.ts
|
|
152
|
-
var
|
|
154
|
+
var z = "io/input", B = "io/output", ie = {
|
|
153
155
|
input: {
|
|
154
156
|
x: 40,
|
|
155
157
|
y: 120
|
|
@@ -159,10 +161,10 @@ var B = "io/input", V = "io/output", re = {
|
|
|
159
161
|
y: 130
|
|
160
162
|
}
|
|
161
163
|
};
|
|
162
|
-
function
|
|
164
|
+
function ae(e = {}) {
|
|
163
165
|
return {
|
|
164
166
|
input: {
|
|
165
|
-
typeId:
|
|
167
|
+
typeId: z,
|
|
166
168
|
displayName: "Input",
|
|
167
169
|
color: "#7a5a3a",
|
|
168
170
|
description: "Graph inputs (function parameters).",
|
|
@@ -170,7 +172,7 @@ function ie(e = {}) {
|
|
|
170
172
|
outputs: e.parameters
|
|
171
173
|
},
|
|
172
174
|
output: {
|
|
173
|
-
typeId:
|
|
175
|
+
typeId: B,
|
|
174
176
|
displayName: "Output",
|
|
175
177
|
color: "#7a3a5a",
|
|
176
178
|
description: "Graph outputs (function return values).",
|
|
@@ -179,59 +181,59 @@ function ie(e = {}) {
|
|
|
179
181
|
}
|
|
180
182
|
};
|
|
181
183
|
}
|
|
182
|
-
function
|
|
184
|
+
function V(e, t) {
|
|
183
185
|
e.graphInterface = t;
|
|
184
|
-
let n =
|
|
186
|
+
let n = ae(t);
|
|
185
187
|
P(e, {
|
|
186
188
|
[n.input.typeId]: n.input,
|
|
187
189
|
[n.output.typeId]: n.output
|
|
188
190
|
});
|
|
189
191
|
}
|
|
190
192
|
function oe(e) {
|
|
191
|
-
let t = e.graph.nodes.filter((e) => e.typeId ===
|
|
193
|
+
let t = e.graph.nodes.filter((e) => e.typeId === z), n = e.graph.nodes.filter((e) => e.typeId === B);
|
|
192
194
|
if (t.length !== 1 || n.length !== 1) throw Error(`graph must have exactly one Input and one Output node (found ${t.length} input, ${n.length} output)`);
|
|
193
195
|
return {
|
|
194
196
|
input: t[0],
|
|
195
197
|
output: n[0]
|
|
196
198
|
};
|
|
197
199
|
}
|
|
198
|
-
function se(e, t =
|
|
199
|
-
let n = e.graph.nodes.filter((e) => e.typeId ===
|
|
200
|
+
function se(e, t = ie) {
|
|
201
|
+
let n = e.graph.nodes.filter((e) => e.typeId === z), r = e.graph.nodes.filter((e) => e.typeId === B);
|
|
200
202
|
if (n.length > 1 || r.length > 1) throw Error(`graph must have exactly one Input and one Output node (found ${n.length} input, ${r.length} output)`);
|
|
201
|
-
let i = n[0], a = r[0], o =
|
|
202
|
-
return i || (i = L(
|
|
203
|
+
let i = n[0], a = r[0], o = ae(e.graphInterface);
|
|
204
|
+
return i || (i = L(N(o.input), t.input), e.graph.nodes.push(i)), a || (a = L(N(o.output), t.output), e.graph.nodes.push(a)), {
|
|
203
205
|
input: i,
|
|
204
206
|
output: a
|
|
205
207
|
};
|
|
206
208
|
}
|
|
207
|
-
function
|
|
208
|
-
let n =
|
|
209
|
+
function ce(e, t) {
|
|
210
|
+
let n = re(e, t);
|
|
209
211
|
if (n.length) return n;
|
|
210
|
-
|
|
212
|
+
V(e, t);
|
|
211
213
|
let { input: r, output: i } = oe(e);
|
|
212
|
-
r.outputs =
|
|
214
|
+
r.outputs = k(r.outputs, j(t.parameters), "output");
|
|
213
215
|
for (let n of Object.values(r.outputs)) {
|
|
214
216
|
let r = t.parameters?.[n.name];
|
|
215
217
|
if (!r) continue;
|
|
216
218
|
let i = e.types[r.type];
|
|
217
219
|
r.defaultValue === void 0 ? i && !i.validate(n.value) && (n.value = i.defaultValue) : n.value = r.defaultValue;
|
|
218
220
|
}
|
|
219
|
-
return i.inputs =
|
|
221
|
+
return i.inputs = k(i.inputs, j(t.returns), "input"), E(e, r), E(e, i), [];
|
|
220
222
|
}
|
|
221
|
-
function
|
|
222
|
-
let t = [], n = e.graph.nodes.filter((e) => e.typeId ===
|
|
223
|
+
function le(e) {
|
|
224
|
+
let t = [], n = e.graph.nodes.filter((e) => e.typeId === z).length, r = e.graph.nodes.filter((e) => e.typeId === B).length;
|
|
223
225
|
return n === 0 ? t.push("graph has no Input node") : n > 1 && t.push("graph has multiple Input nodes"), r === 0 ? t.push("graph has no Output node") : r > 1 && t.push("graph has multiple Output nodes"), t;
|
|
224
226
|
}
|
|
225
227
|
//#endregion
|
|
226
228
|
//#region src/store/composite/index.ts
|
|
227
|
-
var
|
|
228
|
-
typeId:
|
|
229
|
+
var H = "composite/group", ue = {
|
|
230
|
+
typeId: H,
|
|
229
231
|
displayName: "Group",
|
|
230
232
|
color: "#4a5a6a",
|
|
231
233
|
description: "A nested subgraph with its own inputs and outputs.",
|
|
232
234
|
group: ["Custom nodes"]
|
|
233
235
|
};
|
|
234
|
-
function
|
|
236
|
+
function U(e, t) {
|
|
235
237
|
let n = t.composite;
|
|
236
238
|
if (!n) throw Error("node has no composite state");
|
|
237
239
|
let r = {
|
|
@@ -243,23 +245,23 @@ function W(e, t) {
|
|
|
243
245
|
registrationMeta: e.registrationMeta,
|
|
244
246
|
loadPack: (t) => e.loadPack(t)
|
|
245
247
|
};
|
|
246
|
-
return
|
|
248
|
+
return V(r, n.interface), r;
|
|
247
249
|
}
|
|
248
|
-
function
|
|
249
|
-
let n = t.composite?.interface ??
|
|
250
|
-
t.inputs =
|
|
250
|
+
function de(e, t) {
|
|
251
|
+
let n = t.composite?.interface ?? M;
|
|
252
|
+
t.inputs = k(t.inputs, j(n.parameters), "input"), t.outputs = k(t.outputs, j(n.returns), "output"), E(e, t);
|
|
251
253
|
}
|
|
252
|
-
function
|
|
253
|
-
let r =
|
|
254
|
+
function W(e, t, n = {}) {
|
|
255
|
+
let r = ce(e, t);
|
|
254
256
|
if (r.length) return r;
|
|
255
257
|
let i = n.ownerComposite;
|
|
256
|
-
return i?.composite && n.parentMap ? (i.composite.interface = t,
|
|
258
|
+
return i?.composite && n.parentMap ? (i.composite.interface = t, de(n.parentMap, i)) : e.graphInterface = t, [];
|
|
257
259
|
}
|
|
258
260
|
function fe(e) {
|
|
259
261
|
let t = {};
|
|
260
262
|
return {
|
|
261
|
-
inputs:
|
|
262
|
-
outputs:
|
|
263
|
+
inputs: k(t, j(e.parameters), "input"),
|
|
264
|
+
outputs: k(t, j(e.returns), "output")
|
|
263
265
|
};
|
|
264
266
|
}
|
|
265
267
|
function pe(e, t) {
|
|
@@ -275,17 +277,17 @@ function pe(e, t) {
|
|
|
275
277
|
registrationMeta: e.registrationMeta,
|
|
276
278
|
loadPack: (t) => e.loadPack(t)
|
|
277
279
|
};
|
|
278
|
-
return
|
|
280
|
+
return V(n, n.graphInterface), se(n, ie), {
|
|
279
281
|
graph: R(n.graph),
|
|
280
282
|
interface: R(n.graphInterface)
|
|
281
283
|
};
|
|
282
284
|
}
|
|
283
285
|
function me(e, t) {
|
|
284
|
-
e.nodeTypes["composite/group"] || P(e, { [
|
|
285
|
-
let n = R(
|
|
286
|
+
e.nodeTypes["composite/group"] || P(e, { [H]: ue });
|
|
287
|
+
let n = R(M), r = pe(e, n), { inputs: i, outputs: a } = fe(n);
|
|
286
288
|
return {
|
|
287
289
|
id: crypto.randomUUID(),
|
|
288
|
-
typeId:
|
|
290
|
+
typeId: H,
|
|
289
291
|
location: t,
|
|
290
292
|
inputs: i,
|
|
291
293
|
outputs: a,
|
|
@@ -296,22 +298,69 @@ function he(e) {
|
|
|
296
298
|
return e.typeId === "composite/group" && !!e.composite;
|
|
297
299
|
}
|
|
298
300
|
//#endregion
|
|
301
|
+
//#region src/store/types/effectiveWidget.ts
|
|
302
|
+
function G(e, t) {
|
|
303
|
+
let n = e?.[t];
|
|
304
|
+
return typeof n == "number" ? n : void 0;
|
|
305
|
+
}
|
|
306
|
+
function ge(e, t) {
|
|
307
|
+
if (!(!e || e.id !== t.type)) return e;
|
|
308
|
+
}
|
|
309
|
+
function K(e, t) {
|
|
310
|
+
let n = t.widgetId ?? e.defaultWidget ?? "default";
|
|
311
|
+
return e.widgets?.[n] || (e.widgets?.default ? e.widgets.default : e.widget);
|
|
312
|
+
}
|
|
313
|
+
function _e(e, t) {
|
|
314
|
+
let n = ge(e, t), r = n ? K(n, t) : void 0, i = t.customProps;
|
|
315
|
+
if (!(!r && !i)) return r ? r.kind === "none" ? {
|
|
316
|
+
kind: "none",
|
|
317
|
+
rowHeight: G(i, "rowHeight") ?? r.rowHeight
|
|
318
|
+
} : r.kind === "number" ? {
|
|
319
|
+
kind: "number",
|
|
320
|
+
min: G(i, "min") ?? r.min,
|
|
321
|
+
max: G(i, "max") ?? r.max,
|
|
322
|
+
step: G(i, "step") ?? r.step,
|
|
323
|
+
rowHeight: G(i, "rowHeight") ?? r.rowHeight
|
|
324
|
+
} : r.kind === "text" ? {
|
|
325
|
+
kind: "text",
|
|
326
|
+
rows: G(i, "rows") ?? r.rows,
|
|
327
|
+
rowHeight: G(i, "rowHeight") ?? r.rowHeight
|
|
328
|
+
} : {
|
|
329
|
+
kind: "custom",
|
|
330
|
+
componentId: r.componentId,
|
|
331
|
+
rowHeight: G(i, "rowHeight") ?? r.rowHeight
|
|
332
|
+
} : i?.min !== void 0 || i?.max !== void 0 || G(i, "rowHeight") !== void 0 ? {
|
|
333
|
+
kind: "number",
|
|
334
|
+
min: G(i, "min"),
|
|
335
|
+
max: G(i, "max"),
|
|
336
|
+
step: G(i, "step"),
|
|
337
|
+
rowHeight: G(i, "rowHeight")
|
|
338
|
+
} : G(i, "rows") !== void 0 || G(i, "rowHeight") !== void 0 ? {
|
|
339
|
+
kind: "text",
|
|
340
|
+
rows: G(i, "rows"),
|
|
341
|
+
rowHeight: G(i, "rowHeight")
|
|
342
|
+
} : void 0;
|
|
343
|
+
}
|
|
344
|
+
function q(e, t) {
|
|
345
|
+
return e ? e.rowHeight === void 0 ? e.kind === "text" ? (e.rows ?? 1) * t : t : e.rowHeight : t;
|
|
346
|
+
}
|
|
347
|
+
//#endregion
|
|
299
348
|
//#region src/store/graph/portTypes.ts
|
|
300
|
-
function
|
|
349
|
+
function ve(e) {
|
|
301
350
|
return e.types ?? [e.type];
|
|
302
351
|
}
|
|
303
|
-
function
|
|
304
|
-
return
|
|
352
|
+
function ye(e) {
|
|
353
|
+
return ve(e).length > 1;
|
|
305
354
|
}
|
|
306
|
-
function
|
|
307
|
-
return
|
|
355
|
+
function J(e, t) {
|
|
356
|
+
return !!(e.connectionOnly || ye(e) || t && _e(t, e)?.kind === "none");
|
|
308
357
|
}
|
|
309
358
|
//#endregion
|
|
310
359
|
//#region src/store/graph/evaluate.ts
|
|
311
|
-
function
|
|
360
|
+
function Y(e) {
|
|
312
361
|
return e instanceof Error ? e.message : String(e);
|
|
313
362
|
}
|
|
314
|
-
function
|
|
363
|
+
function be(e, t = {}) {
|
|
315
364
|
let n = {};
|
|
316
365
|
for (let t of e.graph.nodes) n[t.id] = t;
|
|
317
366
|
let r = /* @__PURE__ */ new Map();
|
|
@@ -321,7 +370,7 @@ function ve(e, t = {}) {
|
|
|
321
370
|
}
|
|
322
371
|
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = {};
|
|
323
372
|
function s(e, t) {
|
|
324
|
-
e.id in o || (o[e.id] =
|
|
373
|
+
e.id in o || (o[e.id] = Y(t));
|
|
325
374
|
}
|
|
326
375
|
function c(e) {
|
|
327
376
|
let t = n[e.node], r = t?.outputs[e.port];
|
|
@@ -333,7 +382,7 @@ function ve(e, t = {}) {
|
|
|
333
382
|
let o = r.get(`${t.id}:${n.id}`) ?? [];
|
|
334
383
|
if (n.multi) a[n.name] = o.map(c);
|
|
335
384
|
else if (o.length) a[n.name] = c(o[0]);
|
|
336
|
-
else if (
|
|
385
|
+
else if (J(n, e.types[n.type])) a[n.name] = void 0;
|
|
337
386
|
else {
|
|
338
387
|
let t = n.value;
|
|
339
388
|
t === void 0 && i && (t = e.types[n.type]?.defaultValue);
|
|
@@ -353,7 +402,7 @@ function ve(e, t = {}) {
|
|
|
353
402
|
o = {};
|
|
354
403
|
for (let e of Object.values(n.outputs)) o[e.name] = e.name in t ? t[e.name] : e.value;
|
|
355
404
|
} else if (he(n)) {
|
|
356
|
-
let t =
|
|
405
|
+
let t = be(U(e, n), l(n));
|
|
357
406
|
for (let e of Object.values(t.errors)) {
|
|
358
407
|
s(n, Error(e));
|
|
359
408
|
break;
|
|
@@ -370,7 +419,7 @@ function ve(e, t = {}) {
|
|
|
370
419
|
}
|
|
371
420
|
return a.delete(n.id), i.set(n.id, o), o;
|
|
372
421
|
}
|
|
373
|
-
let d = e.graph.nodes.find((e) => e.typeId ===
|
|
422
|
+
let d = e.graph.nodes.find((e) => e.typeId === B);
|
|
374
423
|
return {
|
|
375
424
|
values: d ? l(d, { useDefaults: !1 }) : {},
|
|
376
425
|
errors: o
|
|
@@ -378,14 +427,14 @@ function ve(e, t = {}) {
|
|
|
378
427
|
}
|
|
379
428
|
//#endregion
|
|
380
429
|
//#region src/store/graph/connect.ts
|
|
381
|
-
function
|
|
430
|
+
function xe(e, t, n) {
|
|
382
431
|
let r = e.types[n];
|
|
383
432
|
return r && r.accepts ? r.accepts(t) : t === n;
|
|
384
433
|
}
|
|
385
|
-
function
|
|
386
|
-
return
|
|
434
|
+
function Se(e, t, n) {
|
|
435
|
+
return ve(n).some((n) => xe(e, t, n));
|
|
387
436
|
}
|
|
388
|
-
function
|
|
437
|
+
function Ce(e, t) {
|
|
389
438
|
let n = /* @__PURE__ */ new Map();
|
|
390
439
|
for (let t of e.graph.connections) {
|
|
391
440
|
let e = n.get(t.to.node) ?? [];
|
|
@@ -401,7 +450,7 @@ function be(e, t) {
|
|
|
401
450
|
}
|
|
402
451
|
return [...r];
|
|
403
452
|
}
|
|
404
|
-
function
|
|
453
|
+
function we(e, t) {
|
|
405
454
|
let n = /* @__PURE__ */ new Map();
|
|
406
455
|
for (let t of e.graph.connections) {
|
|
407
456
|
let e = n.get(t.from.node) ?? [];
|
|
@@ -417,16 +466,16 @@ function xe(e, t) {
|
|
|
417
466
|
}
|
|
418
467
|
return [...r];
|
|
419
468
|
}
|
|
420
|
-
function
|
|
421
|
-
return
|
|
469
|
+
function Te(e, t, n) {
|
|
470
|
+
return we(e, n.node).includes(t.node);
|
|
422
471
|
}
|
|
423
|
-
function
|
|
472
|
+
function Ee(e, t, n) {
|
|
424
473
|
if (t.node === n.node) return !1;
|
|
425
474
|
let r = e.graph.nodes.find((e) => e.id === t.node), i = e.graph.nodes.find((e) => e.id === n.node), a = r?.outputs[t.port], o = i?.inputs[n.port];
|
|
426
|
-
return !a || !o || o.userOnly ||
|
|
475
|
+
return !a || !o || o.userOnly || Te(e, t, n) ? !1 : Se(e, a.type, o);
|
|
427
476
|
}
|
|
428
|
-
function
|
|
429
|
-
if (!
|
|
477
|
+
function De(e, t, n) {
|
|
478
|
+
if (!Ee(e, t, n)) return null;
|
|
430
479
|
let r = e.graph.connections.find((e) => e.from.node === t.node && e.from.port === t.port && e.to.node === n.node && e.to.port === n.port);
|
|
431
480
|
if (r) return r;
|
|
432
481
|
e.graph.nodes.find((e) => e.id === n.node)?.inputs[n.port]?.multi || (e.graph.connections = e.graph.connections.filter((e) => !(e.to.node === n.node && e.to.port === n.port)));
|
|
@@ -437,26 +486,106 @@ function Ce(e, t, n) {
|
|
|
437
486
|
};
|
|
438
487
|
return e.graph.connections.push(i), i;
|
|
439
488
|
}
|
|
440
|
-
function
|
|
489
|
+
function Oe(e, t) {
|
|
441
490
|
e.graph.connections = e.graph.connections.filter((e) => e.id !== t);
|
|
442
491
|
}
|
|
443
492
|
//#endregion
|
|
444
493
|
//#region src/store/graph/removeNode.ts
|
|
445
|
-
function
|
|
494
|
+
function ke(e, t) {
|
|
446
495
|
let n = e.graph.nodes.find((e) => e.id === t);
|
|
447
496
|
return n ? n.typeId !== "io/input" && n.typeId !== "io/output" : !1;
|
|
448
497
|
}
|
|
449
|
-
function
|
|
450
|
-
|
|
498
|
+
function Ae(e, t) {
|
|
499
|
+
ke(e, t) && (e.graph.nodes = e.graph.nodes.filter((e) => e.id !== t), e.graph.connections = e.graph.connections.filter((e) => e.from.node !== t && e.to.node !== t));
|
|
500
|
+
}
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region src/store/graph/duplicateSelection.ts
|
|
503
|
+
function je(e) {
|
|
504
|
+
return e.typeId !== "io/input" && e.typeId !== "io/output";
|
|
505
|
+
}
|
|
506
|
+
function Me(e, t) {
|
|
507
|
+
return `${e}:${t}`;
|
|
508
|
+
}
|
|
509
|
+
function Ne(e, t, n) {
|
|
510
|
+
let r = {};
|
|
511
|
+
for (let [i, a] of Object.entries(e)) {
|
|
512
|
+
let e = crypto.randomUUID();
|
|
513
|
+
n.set(Me(t, i), e), r[e] = {
|
|
514
|
+
...a,
|
|
515
|
+
id: e
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
return r;
|
|
519
|
+
}
|
|
520
|
+
function Pe(e, t, n) {
|
|
521
|
+
return {
|
|
522
|
+
nodes: e.nodes.map((e) => Fe(e, t, n, null)),
|
|
523
|
+
connections: e.connections.map((e) => X(e, t, n))
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
function X(e, t, n) {
|
|
527
|
+
return {
|
|
528
|
+
id: crypto.randomUUID(),
|
|
529
|
+
from: {
|
|
530
|
+
node: t.get(e.from.node),
|
|
531
|
+
port: n.get(Me(e.from.node, e.from.port))
|
|
532
|
+
},
|
|
533
|
+
to: {
|
|
534
|
+
node: t.get(e.to.node),
|
|
535
|
+
port: n.get(Me(e.to.node, e.to.port))
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
function Fe(e, t, n, r) {
|
|
540
|
+
let i = e.id, a = crypto.randomUUID();
|
|
541
|
+
t.set(i, a);
|
|
542
|
+
let o = R(e), s = {
|
|
543
|
+
...o,
|
|
544
|
+
id: a,
|
|
545
|
+
location: r ?? o.location,
|
|
546
|
+
inputs: Ne(o.inputs, i, n),
|
|
547
|
+
outputs: Ne(o.outputs, i, n),
|
|
548
|
+
z: void 0
|
|
549
|
+
};
|
|
550
|
+
return o.composite && (s.composite = {
|
|
551
|
+
interface: R(o.composite.interface),
|
|
552
|
+
graph: Pe(o.composite.graph, t, n)
|
|
553
|
+
}), s;
|
|
554
|
+
}
|
|
555
|
+
function Ie(e, t, n) {
|
|
556
|
+
let r = e.filter(je);
|
|
557
|
+
if (!r.length) return null;
|
|
558
|
+
let i = new Set(r.map((e) => e.id)), a = t.filter((e) => i.has(e.from.node) && i.has(e.to.node)), o = {};
|
|
559
|
+
return {
|
|
560
|
+
nodes: r.map((e) => (o[e.id] = {
|
|
561
|
+
x: e.location.x - n.x,
|
|
562
|
+
y: e.location.y - n.y
|
|
563
|
+
}, R(e))),
|
|
564
|
+
connections: R(a),
|
|
565
|
+
offsets: o
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
function Le(e, t, n) {
|
|
569
|
+
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = t.nodes.map((e) => {
|
|
570
|
+
let a = t.offsets[e.id] ?? {
|
|
571
|
+
x: 0,
|
|
572
|
+
y: 0
|
|
573
|
+
};
|
|
574
|
+
return Fe(e, r, i, {
|
|
575
|
+
x: n.x + a.x,
|
|
576
|
+
y: n.y + a.y
|
|
577
|
+
});
|
|
578
|
+
}), o = t.connections.map((e) => X(e, r, i));
|
|
579
|
+
return e.graph.nodes.push(...a), e.graph.connections.push(...o), a.map((e) => e.id);
|
|
451
580
|
}
|
|
452
581
|
//#endregion
|
|
453
582
|
//#region src/store/graph/stacking.ts
|
|
454
|
-
function
|
|
583
|
+
function Re(e) {
|
|
455
584
|
let t = 0;
|
|
456
585
|
for (let n of e.graph.nodes) t = Math.max(t, n.z ?? 0);
|
|
457
586
|
return t;
|
|
458
587
|
}
|
|
459
|
-
function
|
|
588
|
+
function ze(e) {
|
|
460
589
|
e.graph.nodes.map((e, t) => ({
|
|
461
590
|
n: e,
|
|
462
591
|
i: t
|
|
@@ -464,21 +593,21 @@ function Oe(e) {
|
|
|
464
593
|
e.n.z = t + 1;
|
|
465
594
|
});
|
|
466
595
|
}
|
|
467
|
-
function
|
|
596
|
+
function Be(e) {
|
|
468
597
|
if (e.graph.nodes.length === 0) return;
|
|
469
598
|
let t = !1;
|
|
470
599
|
for (let n of e.graph.nodes) n.z === void 0 && (n.z = Math.random(), t = !0);
|
|
471
|
-
t &&
|
|
600
|
+
t && ze(e);
|
|
472
601
|
}
|
|
473
|
-
function
|
|
602
|
+
function Ve(e, t) {
|
|
474
603
|
let n = e.graph.nodes.find((e) => e.id === t);
|
|
475
604
|
if (!n) return;
|
|
476
|
-
let r =
|
|
605
|
+
let r = Re(e);
|
|
477
606
|
(n.z ?? 0) >= r || (n.z = r + 1);
|
|
478
607
|
}
|
|
479
608
|
//#endregion
|
|
480
609
|
//#region src/store/composite/editContext.ts
|
|
481
|
-
function
|
|
610
|
+
function He(e, t, n) {
|
|
482
611
|
let r = e;
|
|
483
612
|
for (let i = 0; i <= n; i++) {
|
|
484
613
|
let a = t[i];
|
|
@@ -487,23 +616,23 @@ function je(e, t, n) {
|
|
|
487
616
|
if (!o) return null;
|
|
488
617
|
if (i === n) return o;
|
|
489
618
|
if (!o.composite) return null;
|
|
490
|
-
r =
|
|
619
|
+
r = U(e, o);
|
|
491
620
|
}
|
|
492
621
|
return null;
|
|
493
622
|
}
|
|
494
|
-
function
|
|
495
|
-
return t.length ?
|
|
623
|
+
function Ue(e, t) {
|
|
624
|
+
return t.length ? He(e, t, t.length - 1) : null;
|
|
496
625
|
}
|
|
497
|
-
function
|
|
626
|
+
function We(e, t) {
|
|
498
627
|
if (!t.length) return { activeMap: e };
|
|
499
628
|
let n = e, r;
|
|
500
629
|
for (let i = 0; i < t.length; i++) {
|
|
501
630
|
let a = t[i];
|
|
502
631
|
if (r = n.graph.nodes.find((e) => e.id === a.compositeNodeId), !r?.composite) return { activeMap: e };
|
|
503
|
-
i < t.length - 1 && (n =
|
|
632
|
+
i < t.length - 1 && (n = U(e, r));
|
|
504
633
|
}
|
|
505
634
|
return {
|
|
506
|
-
activeMap:
|
|
635
|
+
activeMap: U(e, r),
|
|
507
636
|
interfaceOptions: {
|
|
508
637
|
ownerComposite: r,
|
|
509
638
|
parentMap: n
|
|
@@ -512,112 +641,68 @@ function Ne(e, t) {
|
|
|
512
641
|
}
|
|
513
642
|
//#endregion
|
|
514
643
|
//#region src/store/interface/editor.ts
|
|
515
|
-
function
|
|
644
|
+
function Ge(e, t) {
|
|
516
645
|
if (!t.length) return e.graphInterface;
|
|
517
|
-
let n =
|
|
646
|
+
let n = Ue(e, t);
|
|
518
647
|
return n?.composite ? n.composite.interface : e.graphInterface;
|
|
519
648
|
}
|
|
520
|
-
function
|
|
521
|
-
let r =
|
|
649
|
+
function Ke(e, t, n) {
|
|
650
|
+
let r = Ge(e, t);
|
|
522
651
|
n(r);
|
|
523
|
-
let i =
|
|
524
|
-
return
|
|
652
|
+
let i = We(e, t);
|
|
653
|
+
return W(i.activeMap, r, i.interfaceOptions ?? {});
|
|
525
654
|
}
|
|
526
655
|
//#endregion
|
|
527
656
|
//#region src/store/composite/guards.ts
|
|
528
|
-
function
|
|
529
|
-
for (let r of e.nodes) if (r.id === t || n && r.composite?.graph &&
|
|
657
|
+
function Z(e, t, n) {
|
|
658
|
+
for (let r of e.nodes) if (r.id === t || n && r.composite?.graph && Z(r.composite.graph, t, !0)) return !0;
|
|
530
659
|
return !1;
|
|
531
660
|
}
|
|
532
|
-
function
|
|
661
|
+
function qe(e) {
|
|
533
662
|
return e.map((e) => e.compositeNodeId);
|
|
534
663
|
}
|
|
535
|
-
function
|
|
536
|
-
let n = new Set(
|
|
664
|
+
function Je(e, t) {
|
|
665
|
+
let n = new Set(qe(t)), r = Ue(e, t);
|
|
537
666
|
return r && n.add(r.id), n;
|
|
538
667
|
}
|
|
539
|
-
function
|
|
540
|
-
for (let r of
|
|
668
|
+
function Ye(e, t, n) {
|
|
669
|
+
for (let r of Je(e, t)) if (Z(n, r, !0)) return "A group cannot be placed inside itself";
|
|
541
670
|
return null;
|
|
542
671
|
}
|
|
543
|
-
function
|
|
672
|
+
function Xe(e, t, n) {
|
|
544
673
|
if (!he(n)) return "Not a group node";
|
|
545
674
|
if (t.some((e) => e.compositeNodeId === n.id)) return "Already editing this group";
|
|
546
|
-
let r =
|
|
675
|
+
let r = Je(e, t);
|
|
547
676
|
if (r.add(n.id), n.composite?.graph) {
|
|
548
|
-
for (let e of r) if (
|
|
677
|
+
for (let e of r) if (Z(n.composite.graph, e, !0)) return "Cannot open a group that contains an ancestor";
|
|
549
678
|
}
|
|
550
679
|
return null;
|
|
551
680
|
}
|
|
552
|
-
function
|
|
681
|
+
function Ze(e, t, n, r) {
|
|
553
682
|
if (!he(n) || !n.composite) return null;
|
|
554
|
-
let i =
|
|
683
|
+
let i = Je(e, t);
|
|
555
684
|
if (i.has(n.id)) return "A group cannot be placed inside itself";
|
|
556
|
-
for (let e of i) if (
|
|
685
|
+
for (let e of i) if (Z(r, e, !1)) return "A group cannot be placed inside itself";
|
|
557
686
|
for (let r = 0; r < t.length; r++) {
|
|
558
|
-
let i =
|
|
687
|
+
let i = He(e, t, r);
|
|
559
688
|
if (i?.composite?.graph === n.composite.graph) return "A group cannot share the same interior as an ancestor";
|
|
560
689
|
if (i && n.composite.graph === i.composite?.graph) return "A group cannot be placed inside itself";
|
|
561
690
|
}
|
|
562
|
-
if (
|
|
563
|
-
for (let e of i) if (
|
|
564
|
-
let a =
|
|
565
|
-
return a?.composite && n.composite.graph === a.composite.graph ? "A group cannot be placed inside itself" :
|
|
566
|
-
}
|
|
567
|
-
//#endregion
|
|
568
|
-
//#region src/store/types/effectiveWidget.ts
|
|
569
|
-
function X(e, t) {
|
|
570
|
-
let n = e?.[t];
|
|
571
|
-
return typeof n == "number" ? n : void 0;
|
|
572
|
-
}
|
|
573
|
-
function Z(e, t) {
|
|
574
|
-
if (!(!e || e.id !== t.type)) return e;
|
|
575
|
-
}
|
|
576
|
-
function Ve(e, t) {
|
|
577
|
-
let n = t.widgetId ?? e.defaultWidget ?? "default";
|
|
578
|
-
return e.widgets?.[n] || (e.widgets?.default ? e.widgets.default : e.widget);
|
|
579
|
-
}
|
|
580
|
-
function He(e, t) {
|
|
581
|
-
let n = Z(e, t), r = n ? Ve(n, t) : void 0, i = t.customProps;
|
|
582
|
-
if (!(!r && !i)) return r ? r.kind === "number" ? {
|
|
583
|
-
kind: "number",
|
|
584
|
-
min: X(i, "min") ?? r.min,
|
|
585
|
-
max: X(i, "max") ?? r.max,
|
|
586
|
-
step: X(i, "step") ?? r.step,
|
|
587
|
-
rowHeight: X(i, "rowHeight") ?? r.rowHeight
|
|
588
|
-
} : r.kind === "text" ? {
|
|
589
|
-
kind: "text",
|
|
590
|
-
rows: X(i, "rows") ?? r.rows,
|
|
591
|
-
rowHeight: X(i, "rowHeight") ?? r.rowHeight
|
|
592
|
-
} : {
|
|
593
|
-
kind: "custom",
|
|
594
|
-
componentId: r.componentId,
|
|
595
|
-
rowHeight: X(i, "rowHeight") ?? r.rowHeight
|
|
596
|
-
} : i?.min !== void 0 || i?.max !== void 0 || X(i, "rowHeight") !== void 0 ? {
|
|
597
|
-
kind: "number",
|
|
598
|
-
min: X(i, "min"),
|
|
599
|
-
max: X(i, "max"),
|
|
600
|
-
step: X(i, "step"),
|
|
601
|
-
rowHeight: X(i, "rowHeight")
|
|
602
|
-
} : X(i, "rows") !== void 0 || X(i, "rowHeight") !== void 0 ? {
|
|
603
|
-
kind: "text",
|
|
604
|
-
rows: X(i, "rows"),
|
|
605
|
-
rowHeight: X(i, "rowHeight")
|
|
606
|
-
} : void 0;
|
|
607
|
-
}
|
|
608
|
-
function Ue(e, t) {
|
|
609
|
-
return e ? e.rowHeight === void 0 ? e.kind === "text" ? (e.rows ?? 1) * t : t : e.rowHeight : t;
|
|
691
|
+
if (Z(n.composite.graph, n.id, !0)) return "A group cannot contain itself";
|
|
692
|
+
for (let e of i) if (Z(n.composite.graph, e, !0)) return "A group cannot contain an ancestor";
|
|
693
|
+
let a = Ue(e, t);
|
|
694
|
+
return a?.composite && n.composite.graph === a.composite.graph ? "A group cannot be placed inside itself" : Ye(e, t, r);
|
|
610
695
|
}
|
|
611
696
|
//#endregion
|
|
612
697
|
//#region src/components/types/NumberWidget.vue?vue&type=script&setup=true&lang.ts
|
|
613
|
-
var
|
|
698
|
+
var Qe = [
|
|
614
699
|
"value",
|
|
615
700
|
"placeholder",
|
|
616
701
|
"title",
|
|
617
702
|
"min",
|
|
618
703
|
"max",
|
|
619
704
|
"step"
|
|
620
|
-
],
|
|
705
|
+
], $e = /*@__PURE__*/ s({
|
|
621
706
|
__name: "NumberWidget",
|
|
622
707
|
props: {
|
|
623
708
|
port: {},
|
|
@@ -655,14 +740,14 @@ var We = [
|
|
|
655
740
|
step: y(o).kind === "number" ? y(o).step : void 0,
|
|
656
741
|
onInput: c,
|
|
657
742
|
onChange: l,
|
|
658
|
-
onPointerdown: n[0] ||=
|
|
659
|
-
}, null, 40,
|
|
743
|
+
onPointerdown: n[0] ||= T(() => {}, ["stop"])
|
|
744
|
+
}, null, 40, Qe));
|
|
660
745
|
}
|
|
661
746
|
}), Q = (e, t) => {
|
|
662
747
|
let n = e.__vccOpts || e;
|
|
663
748
|
for (let [e, r] of t) n[e] = r;
|
|
664
749
|
return n;
|
|
665
|
-
},
|
|
750
|
+
}, et = /*#__PURE__*/ Q($e, [["__scopeId", "data-v-4459e34d"]]), tt = ["title"], nt = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
666
751
|
__name: "ReadonlyWidget",
|
|
667
752
|
props: {
|
|
668
753
|
port: {},
|
|
@@ -678,14 +763,14 @@ var We = [
|
|
|
678
763
|
return (t, n) => (p(), i("span", {
|
|
679
764
|
class: "field readonly",
|
|
680
765
|
title: e.port.name
|
|
681
|
-
}, v(r.value), 9,
|
|
766
|
+
}, v(r.value), 9, tt));
|
|
682
767
|
}
|
|
683
|
-
}), [["__scopeId", "data-v-0d93d0ea"]]),
|
|
768
|
+
}), [["__scopeId", "data-v-0d93d0ea"]]), rt = [
|
|
684
769
|
"value",
|
|
685
770
|
"placeholder",
|
|
686
771
|
"title",
|
|
687
772
|
"rows"
|
|
688
|
-
],
|
|
773
|
+
], it = [
|
|
689
774
|
"value",
|
|
690
775
|
"placeholder",
|
|
691
776
|
"title"
|
|
@@ -719,8 +804,8 @@ var We = [
|
|
|
719
804
|
rows: c.value,
|
|
720
805
|
onInput: l,
|
|
721
806
|
onChange: u,
|
|
722
|
-
onPointerdown: n[0] ||=
|
|
723
|
-
}, null, 40,
|
|
807
|
+
onPointerdown: n[0] ||= T(() => {}, ["stop"])
|
|
808
|
+
}, null, 40, rt)) : (p(), i("input", {
|
|
724
809
|
key: 1,
|
|
725
810
|
class: "field",
|
|
726
811
|
type: "text",
|
|
@@ -729,39 +814,39 @@ var We = [
|
|
|
729
814
|
title: e.port.name,
|
|
730
815
|
onInput: l,
|
|
731
816
|
onChange: u,
|
|
732
|
-
onPointerdown: n[1] ||=
|
|
733
|
-
}, null, 40,
|
|
817
|
+
onPointerdown: n[1] ||= T(() => {}, ["stop"])
|
|
818
|
+
}, null, 40, it));
|
|
734
819
|
}
|
|
735
|
-
}), [["__scopeId", "data-v-bf7ff881"]]),
|
|
736
|
-
number:
|
|
820
|
+
}), [["__scopeId", "data-v-bf7ff881"]]), at = /* @__PURE__ */ new Map(), ot = /* @__PURE__ */ new Map(), st = {
|
|
821
|
+
number: et,
|
|
737
822
|
text: $,
|
|
738
823
|
custom: $
|
|
739
824
|
};
|
|
740
|
-
function
|
|
741
|
-
let t =
|
|
742
|
-
return t || (t = /* @__PURE__ */ new Map(),
|
|
825
|
+
function ct(e) {
|
|
826
|
+
let t = at.get(e);
|
|
827
|
+
return t || (t = /* @__PURE__ */ new Map(), at.set(e, t)), t;
|
|
743
828
|
}
|
|
744
|
-
function
|
|
829
|
+
function lt(e, t) {
|
|
745
830
|
return t?.widgetId ?? e?.defaultWidget ?? "default";
|
|
746
831
|
}
|
|
747
|
-
function
|
|
832
|
+
function ut(e, t, n) {
|
|
748
833
|
if (typeof t == "string") {
|
|
749
|
-
|
|
834
|
+
ct(e).set(t, n);
|
|
750
835
|
return;
|
|
751
836
|
}
|
|
752
|
-
|
|
837
|
+
ct(e).set("default", t);
|
|
753
838
|
}
|
|
754
|
-
function
|
|
755
|
-
|
|
839
|
+
function dt(e, t) {
|
|
840
|
+
ot.set(e, t);
|
|
756
841
|
}
|
|
757
|
-
function
|
|
758
|
-
if (n === "readonly") return
|
|
759
|
-
let i = r?.type ?? e?.id, a = e && e.id === i ? e : void 0, o =
|
|
760
|
-
return s?.has(o) ? s.get(o) : s?.has("default") ? s.get("default") : t?.kind === "custom" ?
|
|
842
|
+
function ft(e, t, n, r) {
|
|
843
|
+
if (n === "readonly") return nt;
|
|
844
|
+
let i = r?.type ?? e?.id, a = e && e.id === i ? e : void 0, o = lt(a, r), s = i ? at.get(i) : void 0;
|
|
845
|
+
return s?.has(o) ? s.get(o) : s?.has("default") ? s.get("default") : t?.kind === "none" ? $ : t?.kind === "custom" ? ot.get(t.componentId) ?? $ : t?.kind === "number" || t?.kind === "text" ? st[t.kind] ?? $ : a?.widget?.kind === "custom" ? ot.get(a.widget.componentId) ?? $ : a?.widget?.kind && a.widget.kind !== "none" ? st[a.widget.kind] ?? $ : $;
|
|
761
846
|
}
|
|
762
847
|
//#endregion
|
|
763
848
|
//#region src/components/types/PortValueWidget.vue
|
|
764
|
-
var
|
|
849
|
+
var pt = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
765
850
|
__name: "PortValueWidget",
|
|
766
851
|
props: {
|
|
767
852
|
port: {},
|
|
@@ -773,7 +858,7 @@ var at = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
|
773
858
|
},
|
|
774
859
|
emits: ["update:value", "commit"],
|
|
775
860
|
setup(e, { emit: r }) {
|
|
776
|
-
let i = e, a = r, o = t(() =>
|
|
861
|
+
let i = e, a = r, o = t(() => _e(i.typeDef, i.port)), s = t(() => ft(i.typeDef, o.value, i.mode, i.port)), c = t(() => {
|
|
777
862
|
let e = o.value, t = i.port.type, n = i.port.widgetId ?? "default";
|
|
778
863
|
return i.mode === "readonly" ? `readonly:${t}` : e?.kind === "custom" ? `${t}:${n}:custom:${e.componentId}` : `${t}:${n}:${e?.kind ?? "text"}`;
|
|
779
864
|
});
|
|
@@ -796,47 +881,47 @@ var at = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
|
796
881
|
]));
|
|
797
882
|
}
|
|
798
883
|
}), [["__scopeId", "data-v-b4dc9bc0"]]);
|
|
799
|
-
function
|
|
884
|
+
function mt(e) {
|
|
800
885
|
return Math.max(20, Math.min(240, e));
|
|
801
886
|
}
|
|
802
|
-
function
|
|
887
|
+
function ht(e, t) {
|
|
803
888
|
let n = e.customProps?.rowHeight;
|
|
804
|
-
return
|
|
889
|
+
return mt(typeof n == "number" && n > 0 ? n : q(_e(t, e), 20));
|
|
805
890
|
}
|
|
806
|
-
function
|
|
891
|
+
function gt(e, t) {
|
|
807
892
|
let n = 0;
|
|
808
|
-
for (let r of e) n +=
|
|
893
|
+
for (let r of e) n += ht(r, t?.(r));
|
|
809
894
|
return n;
|
|
810
895
|
}
|
|
811
|
-
function
|
|
896
|
+
function _t(e) {
|
|
812
897
|
return e.width ?? 100;
|
|
813
898
|
}
|
|
814
|
-
function
|
|
815
|
-
let n =
|
|
899
|
+
function vt(e, t) {
|
|
900
|
+
let n = gt(Object.values(e.inputs), t), r = gt(Object.values(e.outputs), t);
|
|
816
901
|
return 20 + Math.max(n, r);
|
|
817
902
|
}
|
|
818
|
-
function
|
|
903
|
+
function yt(e, t, n) {
|
|
819
904
|
let r = 20;
|
|
820
905
|
for (let i of e) {
|
|
821
|
-
let e =
|
|
906
|
+
let e = ht(i, n?.(i));
|
|
822
907
|
if (i.id === t) return r + e / 2;
|
|
823
908
|
r += e;
|
|
824
909
|
}
|
|
825
910
|
return null;
|
|
826
911
|
}
|
|
827
|
-
function
|
|
828
|
-
let r =
|
|
912
|
+
function bt(e, t, n) {
|
|
913
|
+
let r = yt(Object.values(e.inputs), t, n);
|
|
829
914
|
if (r !== null) return {
|
|
830
915
|
x: e.location.x,
|
|
831
916
|
y: e.location.y + r
|
|
832
917
|
};
|
|
833
|
-
let i =
|
|
918
|
+
let i = yt(Object.values(e.outputs), t, n);
|
|
834
919
|
return i === null ? null : {
|
|
835
|
-
x: e.location.x +
|
|
920
|
+
x: e.location.x + _t(e),
|
|
836
921
|
y: e.location.y + i
|
|
837
922
|
};
|
|
838
923
|
}
|
|
839
|
-
function
|
|
924
|
+
function xt(e, t) {
|
|
840
925
|
let n = Math.max(40, Math.abs(t.x - e.x) * .5);
|
|
841
926
|
return [{
|
|
842
927
|
x: e.x + n,
|
|
@@ -846,12 +931,12 @@ function pt(e, t) {
|
|
|
846
931
|
y: t.y
|
|
847
932
|
}];
|
|
848
933
|
}
|
|
849
|
-
function
|
|
850
|
-
let [n, r] =
|
|
934
|
+
function St(e, t) {
|
|
935
|
+
let [n, r] = xt(e, t);
|
|
851
936
|
return `M ${e.x} ${e.y} C ${n.x} ${n.y}, ${r.x} ${r.y}, ${t.x} ${t.y}`;
|
|
852
937
|
}
|
|
853
|
-
function
|
|
854
|
-
let [r, i] =
|
|
938
|
+
function Ct(e, t, n = 16) {
|
|
939
|
+
let [r, i] = xt(e, t), a = [];
|
|
855
940
|
for (let o = 0; o <= n; o++) {
|
|
856
941
|
let s = o / n, c = 1 - s, l = c * c * c * e.x + 3 * c * c * s * r.x + 3 * c * s * s * i.x + s * s * s * t.x, u = c * c * c * e.y + 3 * c * c * s * r.y + 3 * c * s * s * i.y + s * s * s * t.y;
|
|
857
942
|
a.push({
|
|
@@ -861,7 +946,7 @@ function ht(e, t, n = 16) {
|
|
|
861
946
|
}
|
|
862
947
|
return a;
|
|
863
948
|
}
|
|
864
|
-
function
|
|
949
|
+
function wt(e, t, n, r) {
|
|
865
950
|
let i = t.x - e.x, a = t.y - e.y, o = r.x - n.x, s = r.y - n.y, c = i * s - a * o;
|
|
866
951
|
if (c === 0) return !1;
|
|
867
952
|
let l = n.x - e.x, u = n.y - e.y, d = (l * s - u * o) / c, f = (l * a - u * i) / c;
|
|
@@ -869,10 +954,10 @@ function gt(e, t, n, r) {
|
|
|
869
954
|
}
|
|
870
955
|
//#endregion
|
|
871
956
|
//#region src/components/NodePort.vue?vue&type=script&setup=true&lang.ts
|
|
872
|
-
var
|
|
957
|
+
var Tt = ["title"], Et = {
|
|
873
958
|
key: 2,
|
|
874
959
|
class: "label"
|
|
875
|
-
},
|
|
960
|
+
}, Dt = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
876
961
|
__name: "NodePort",
|
|
877
962
|
props: {
|
|
878
963
|
port: {},
|
|
@@ -888,19 +973,19 @@ var _t = ["title"], vt = {
|
|
|
888
973
|
},
|
|
889
974
|
emits: ["connectStart", "valueChange"],
|
|
890
975
|
setup(e, { emit: a }) {
|
|
891
|
-
b((e) => ({
|
|
976
|
+
b((e) => ({ v3fd6b92b: o }));
|
|
892
977
|
let o = "11px", s = e, c = a;
|
|
893
978
|
function d(e) {
|
|
894
979
|
e.button === 0 && c("connectStart", s.port, e);
|
|
895
980
|
}
|
|
896
|
-
let f = t(() =>
|
|
981
|
+
let f = t(() => ht(s.port, s.typeDef)), m = t(() => _e(s.typeDef, s.port)), h = t(() => {
|
|
897
982
|
let e = s.typeDef?.label ?? s.port.type;
|
|
898
983
|
return `${s.port.name} (${e})`;
|
|
899
|
-
}), g = t(() => !
|
|
900
|
-
function
|
|
984
|
+
}), g = t(() => !J(s.port, s.typeDef) && (s.widgetMode === "editable" || s.side === "in" && !!s.port.userOnly || s.widgetMode === "auto" && s.side === "in" && !s.connected && !s.port.multi)), _ = t(() => s.widgetMode === "readonly"), y = t(() => s.side === "in" && !s.port.userOnly), x = t(() => g.value || _.value), S = t(() => _.value ? "readonly" : "editable");
|
|
985
|
+
function C(e) {
|
|
901
986
|
s.port.value = e, c("valueChange", s.port);
|
|
902
987
|
}
|
|
903
|
-
function
|
|
988
|
+
function w() {
|
|
904
989
|
s.typeDef?.coerce && (s.port.value = s.typeDef.coerce(s.port.value), c("valueChange", s.port));
|
|
905
990
|
}
|
|
906
991
|
return (t, a) => (p(), i("div", {
|
|
@@ -915,18 +1000,18 @@ var _t = ["title"], vt = {
|
|
|
915
1000
|
class: l(["socket", { multi: e.port.multi }]),
|
|
916
1001
|
style: u({ background: e.color }),
|
|
917
1002
|
title: e.port.multi ? `${e.port.name} (accepts many)` : e.port.name,
|
|
918
|
-
onPointerdown:
|
|
919
|
-
}, null, 46,
|
|
920
|
-
x.value ? (p(), n(
|
|
1003
|
+
onPointerdown: T(d, ["stop"])
|
|
1004
|
+
}, null, 46, Tt)) : r("", !0),
|
|
1005
|
+
x.value ? (p(), n(pt, {
|
|
921
1006
|
key: `${e.port.id}-${e.port.type}`,
|
|
922
1007
|
port: e.port,
|
|
923
1008
|
"type-def": e.typeDef,
|
|
924
1009
|
"effective-widget": m.value,
|
|
925
|
-
mode:
|
|
1010
|
+
mode: S.value,
|
|
926
1011
|
"display-value": e.displayValue,
|
|
927
1012
|
placeholder: h.value,
|
|
928
|
-
"onUpdate:value":
|
|
929
|
-
onCommit:
|
|
1013
|
+
"onUpdate:value": C,
|
|
1014
|
+
onCommit: w
|
|
930
1015
|
}, null, 8, [
|
|
931
1016
|
"port",
|
|
932
1017
|
"type-def",
|
|
@@ -934,22 +1019,22 @@ var _t = ["title"], vt = {
|
|
|
934
1019
|
"mode",
|
|
935
1020
|
"display-value",
|
|
936
1021
|
"placeholder"
|
|
937
|
-
])) : (p(), i("span",
|
|
1022
|
+
])) : (p(), i("span", Et, v(e.port.name), 1)),
|
|
938
1023
|
e.side === "out" ? (p(), i("span", {
|
|
939
1024
|
key: 3,
|
|
940
1025
|
class: "socket",
|
|
941
1026
|
style: u({ background: e.color }),
|
|
942
|
-
onPointerdown:
|
|
1027
|
+
onPointerdown: T(d, ["stop"])
|
|
943
1028
|
}, null, 36)) : r("", !0)
|
|
944
1029
|
], 6));
|
|
945
1030
|
}
|
|
946
|
-
}), [["__scopeId", "data-v-
|
|
1031
|
+
}), [["__scopeId", "data-v-15071e28"]]), Ot = ["title"], kt = { class: "title" }, At = {
|
|
947
1032
|
class: "grip",
|
|
948
1033
|
title: "Drag"
|
|
949
|
-
},
|
|
1034
|
+
}, jt = { class: "body" }, Mt = {
|
|
950
1035
|
key: 0,
|
|
951
1036
|
class: "col input"
|
|
952
|
-
},
|
|
1037
|
+
}, Nt = 4, Pt = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
953
1038
|
__name: "GraphNode",
|
|
954
1039
|
props: {
|
|
955
1040
|
node: {},
|
|
@@ -985,26 +1070,26 @@ var _t = ["title"], vt = {
|
|
|
985
1070
|
}, e, t);
|
|
986
1071
|
}
|
|
987
1072
|
function x(e) {
|
|
988
|
-
e.userOnly &&
|
|
1073
|
+
e.userOnly && A(m.map, m.node);
|
|
989
1074
|
}
|
|
990
|
-
function
|
|
1075
|
+
function S(e) {
|
|
991
1076
|
e.stopPropagation(), he(m.node) && g("drillIn", m.node.id);
|
|
992
1077
|
}
|
|
993
|
-
function
|
|
1078
|
+
function C(e) {
|
|
994
1079
|
e.button === 0 && (e.stopPropagation(), g("select", m.node.id, e.shiftKey));
|
|
995
1080
|
}
|
|
996
|
-
let
|
|
1081
|
+
let w = t(() => m.map.nodeTypes[m.node.typeId]), T = t(() => m.node.label || w.value?.displayName || m.node.typeId), E = t(() => m.node.color ?? w.value?.color ?? "#3a3f4b"), D = t(() => _t(m.node)), O = t(() => Object.values(m.node.inputs)), ee = t(() => Object.values(m.node.outputs)), k = t(() => m.ioWidgets && m.node.typeId === "io/input"), j = t(() => {
|
|
997
1082
|
let e = /* @__PURE__ */ new Set();
|
|
998
1083
|
for (let t of m.map.graph.connections) t.to.node === m.node.id && e.add(t.to.port);
|
|
999
1084
|
return e;
|
|
1000
1085
|
});
|
|
1001
|
-
function
|
|
1086
|
+
function M(e) {
|
|
1002
1087
|
return m.map.types[e]?.color ?? "#888";
|
|
1003
1088
|
}
|
|
1004
|
-
function
|
|
1089
|
+
function N(e) {
|
|
1005
1090
|
return m.map.types[e.type];
|
|
1006
1091
|
}
|
|
1007
|
-
let
|
|
1092
|
+
let te = (e) => m.map.types[e.type], P = t(() => vt(m.node, te));
|
|
1008
1093
|
function F(e) {
|
|
1009
1094
|
return m.ioWidgets ? m.node.typeId === "io/input" && e === "out" ? "editable" : m.node.typeId === "io/output" && e === "in" ? "readonly" : "auto" : "auto";
|
|
1010
1095
|
}
|
|
@@ -1024,7 +1109,7 @@ var _t = ["title"], vt = {
|
|
|
1024
1109
|
function l(e) {
|
|
1025
1110
|
if (!a) {
|
|
1026
1111
|
let r = e.clientX - t, i = e.clientY - n;
|
|
1027
|
-
if (Math.hypot(r, i) <
|
|
1112
|
+
if (Math.hypot(r, i) < Nt) return;
|
|
1028
1113
|
a = !0, s();
|
|
1029
1114
|
return;
|
|
1030
1115
|
}
|
|
@@ -1045,36 +1130,36 @@ var _t = ["title"], vt = {
|
|
|
1045
1130
|
style: u({
|
|
1046
1131
|
left: o.node.location.x + "px",
|
|
1047
1132
|
top: o.node.location.y + "px",
|
|
1048
|
-
width:
|
|
1133
|
+
width: D.value + "px",
|
|
1049
1134
|
height: P.value + "px",
|
|
1050
1135
|
zIndex: o.node.z ?? 0
|
|
1051
1136
|
}),
|
|
1052
|
-
onPointerdown:
|
|
1137
|
+
onPointerdown: C
|
|
1053
1138
|
}, [
|
|
1054
1139
|
o.error ? (p(), i("div", {
|
|
1055
1140
|
key: 0,
|
|
1056
1141
|
class: "error-ring",
|
|
1057
1142
|
title: o.error
|
|
1058
|
-
}, null, 8,
|
|
1143
|
+
}, null, 8, Ot)) : r("", !0),
|
|
1059
1144
|
a("div", {
|
|
1060
1145
|
class: "header",
|
|
1061
1146
|
style: u({
|
|
1062
|
-
background:
|
|
1147
|
+
background: E.value,
|
|
1063
1148
|
height: y(20) + "px"
|
|
1064
1149
|
}),
|
|
1065
1150
|
onPointerdown: I,
|
|
1066
|
-
onDblclick:
|
|
1067
|
-
}, [a("span",
|
|
1151
|
+
onDblclick: S
|
|
1152
|
+
}, [a("span", kt, v(T.value), 1), a("div", At, [(p(), i(e, null, h(6, (e) => a("span", {
|
|
1068
1153
|
key: e,
|
|
1069
1154
|
class: "dot"
|
|
1070
1155
|
})), 64))])], 36),
|
|
1071
|
-
a("div",
|
|
1156
|
+
a("div", jt, [O.value.length ? (p(), i("div", Mt, [(p(!0), i(e, null, h(O.value, (e) => (p(), n(Dt, {
|
|
1072
1157
|
key: e.id,
|
|
1073
1158
|
port: e,
|
|
1074
|
-
"type-def":
|
|
1075
|
-
color:
|
|
1159
|
+
"type-def": N(e),
|
|
1160
|
+
color: M(e.type),
|
|
1076
1161
|
side: "in",
|
|
1077
|
-
connected:
|
|
1162
|
+
connected: j.value.has(e.id),
|
|
1078
1163
|
"widget-mode": F("in"),
|
|
1079
1164
|
"display-value": o.ioResults?.[e.name],
|
|
1080
1165
|
onConnectStart: _,
|
|
@@ -1086,14 +1171,14 @@ var _t = ["title"], vt = {
|
|
|
1086
1171
|
"connected",
|
|
1087
1172
|
"widget-mode",
|
|
1088
1173
|
"display-value"
|
|
1089
|
-
]))), 128))])) : r("", !0),
|
|
1174
|
+
]))), 128))])) : r("", !0), ee.value.length ? (p(), i("div", {
|
|
1090
1175
|
key: 1,
|
|
1091
|
-
class: l(["col output", { wide:
|
|
1092
|
-
}, [(p(!0), i(e, null, h(
|
|
1176
|
+
class: l(["col output", { wide: k.value }])
|
|
1177
|
+
}, [(p(!0), i(e, null, h(ee.value, (e) => (p(), n(Dt, {
|
|
1093
1178
|
key: `${e.id}-${e.type}`,
|
|
1094
1179
|
port: e,
|
|
1095
|
-
"type-def":
|
|
1096
|
-
color:
|
|
1180
|
+
"type-def": N(e),
|
|
1181
|
+
color: M(e.type),
|
|
1097
1182
|
side: "out",
|
|
1098
1183
|
"widget-mode": F("out"),
|
|
1099
1184
|
onConnectStart: _
|
|
@@ -1105,7 +1190,7 @@ var _t = ["title"], vt = {
|
|
|
1105
1190
|
]))), 128))], 2)) : r("", !0)])
|
|
1106
1191
|
], 38));
|
|
1107
1192
|
}
|
|
1108
|
-
}), [["__scopeId", "data-v-24b182cb"]]),
|
|
1193
|
+
}), [["__scopeId", "data-v-24b182cb"]]), Ft = { class: "wires" }, It = ["d"], Lt = ["d"], Rt = ["d"], zt = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1109
1194
|
__name: "WireLayer",
|
|
1110
1195
|
props: {
|
|
1111
1196
|
map: {},
|
|
@@ -1120,30 +1205,30 @@ var _t = ["title"], vt = {
|
|
|
1120
1205
|
}), c = t(() => a.map.graph.connections.map((e) => {
|
|
1121
1206
|
let t = s.value[e.from.node], n = s.value[e.to.node];
|
|
1122
1207
|
if (!t || !n) return null;
|
|
1123
|
-
let r =
|
|
1208
|
+
let r = bt(t, e.from.port, o), i = bt(n, e.to.port, o);
|
|
1124
1209
|
return !r || !i ? null : {
|
|
1125
1210
|
id: e.id,
|
|
1126
|
-
d:
|
|
1211
|
+
d: St(r, i)
|
|
1127
1212
|
};
|
|
1128
1213
|
}).filter((e) => e !== null));
|
|
1129
|
-
return (t, a) => (p(), i("svg",
|
|
1214
|
+
return (t, a) => (p(), i("svg", Ft, [
|
|
1130
1215
|
(p(!0), i(e, null, h(c.value, (e) => (p(), i("path", {
|
|
1131
1216
|
key: e.id,
|
|
1132
1217
|
d: e.d
|
|
1133
|
-
}, null, 8,
|
|
1218
|
+
}, null, 8, It))), 128)),
|
|
1134
1219
|
n.pendingPath ? (p(), i("path", {
|
|
1135
1220
|
key: 0,
|
|
1136
1221
|
class: "pending",
|
|
1137
1222
|
d: n.pendingPath
|
|
1138
|
-
}, null, 8,
|
|
1223
|
+
}, null, 8, Lt)) : r("", !0),
|
|
1139
1224
|
n.slicePath ? (p(), i("path", {
|
|
1140
1225
|
key: 1,
|
|
1141
1226
|
class: "slice",
|
|
1142
1227
|
d: n.slicePath
|
|
1143
|
-
}, null, 8,
|
|
1228
|
+
}, null, 8, Rt)) : r("", !0)
|
|
1144
1229
|
]));
|
|
1145
1230
|
}
|
|
1146
|
-
}), [["__scopeId", "data-v-682ffd13"]]),
|
|
1231
|
+
}), [["__scopeId", "data-v-682ffd13"]]), Bt = { class: "inspector-section-header" }, Vt = { class: "inspector-section-title" }, Ht = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1147
1232
|
__name: "InspectorSection",
|
|
1148
1233
|
props: {
|
|
1149
1234
|
title: {},
|
|
@@ -1153,25 +1238,25 @@ var _t = ["title"], vt = {
|
|
|
1153
1238
|
}
|
|
1154
1239
|
},
|
|
1155
1240
|
setup(e) {
|
|
1156
|
-
return (t, n) => (p(), i("div", { class: l(["inspector-section", { divided: e.divided }]) }, [a("div",
|
|
1241
|
+
return (t, n) => (p(), i("div", { class: l(["inspector-section", { divided: e.divided }]) }, [a("div", Bt, [a("span", Vt, v(e.title), 1), g(t.$slots, "actions", {}, void 0, !0)]), g(t.$slots, "default", {}, void 0, !0)], 2));
|
|
1157
1242
|
}
|
|
1158
|
-
}), [["__scopeId", "data-v-5e38007a"]]),
|
|
1243
|
+
}), [["__scopeId", "data-v-5e38007a"]]), Ut = {
|
|
1159
1244
|
key: 0,
|
|
1160
1245
|
class: "iface-grid iface-head",
|
|
1161
1246
|
"aria-hidden": "true"
|
|
1162
|
-
},
|
|
1247
|
+
}, Wt = {
|
|
1163
1248
|
key: 1,
|
|
1164
1249
|
class: "iface-rows"
|
|
1165
|
-
},
|
|
1250
|
+
}, Gt = { class: "iface-grid iface-row" }, Kt = ["value", "onChange"], qt = ["value", "onChange"], Jt = ["value"], Yt = ["onClick"], Xt = {
|
|
1166
1251
|
key: 0,
|
|
1167
1252
|
class: "iface-default-row"
|
|
1168
|
-
},
|
|
1253
|
+
}, Zt = {
|
|
1169
1254
|
key: 2,
|
|
1170
1255
|
class: "iface-empty"
|
|
1171
|
-
},
|
|
1256
|
+
}, Qt = {
|
|
1172
1257
|
key: 3,
|
|
1173
1258
|
class: "iface-error"
|
|
1174
|
-
},
|
|
1259
|
+
}, $t = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1175
1260
|
__name: "GraphInterfacePanel",
|
|
1176
1261
|
props: {
|
|
1177
1262
|
graphInterface: {},
|
|
@@ -1205,9 +1290,9 @@ var _t = ["title"], vt = {
|
|
|
1205
1290
|
for (let { name: t, spec: n } of g.value) e[t] = y(t, n);
|
|
1206
1291
|
l.value = e;
|
|
1207
1292
|
}
|
|
1208
|
-
|
|
1293
|
+
S(() => s.revision, () => {
|
|
1209
1294
|
c.value = "", b();
|
|
1210
|
-
}),
|
|
1295
|
+
}), S(f, b, { immediate: !0 });
|
|
1211
1296
|
function x(e) {
|
|
1212
1297
|
c.value = "";
|
|
1213
1298
|
try {
|
|
@@ -1217,7 +1302,7 @@ var _t = ["title"], vt = {
|
|
|
1217
1302
|
c.value = e instanceof Error ? e.message : String(e);
|
|
1218
1303
|
}
|
|
1219
1304
|
}
|
|
1220
|
-
function
|
|
1305
|
+
function w(e, t) {
|
|
1221
1306
|
return {
|
|
1222
1307
|
id: `iface-default-${e}`,
|
|
1223
1308
|
name: e,
|
|
@@ -1226,13 +1311,13 @@ var _t = ["title"], vt = {
|
|
|
1226
1311
|
value: l.value[e] ?? y(e, t)
|
|
1227
1312
|
};
|
|
1228
1313
|
}
|
|
1229
|
-
function
|
|
1314
|
+
function E(e, t) {
|
|
1230
1315
|
l.value = {
|
|
1231
1316
|
...l.value,
|
|
1232
1317
|
[e]: t
|
|
1233
1318
|
};
|
|
1234
1319
|
}
|
|
1235
|
-
function
|
|
1320
|
+
function D(e) {
|
|
1236
1321
|
if (!s.graphInterface.parameters?.[e]) return;
|
|
1237
1322
|
let t = l.value[e];
|
|
1238
1323
|
x((n) => {
|
|
@@ -1248,7 +1333,7 @@ var _t = ["title"], vt = {
|
|
|
1248
1333
|
};
|
|
1249
1334
|
});
|
|
1250
1335
|
}
|
|
1251
|
-
function
|
|
1336
|
+
function O() {
|
|
1252
1337
|
x((e) => {
|
|
1253
1338
|
let t = f.value ? e.parameters : e.returns, n = new Set(Object.keys(t ?? {})), r = f.value ? "input" : "output";
|
|
1254
1339
|
if (n.has(r)) {
|
|
@@ -1269,7 +1354,7 @@ var _t = ["title"], vt = {
|
|
|
1269
1354
|
};
|
|
1270
1355
|
});
|
|
1271
1356
|
}
|
|
1272
|
-
function
|
|
1357
|
+
function ee(e) {
|
|
1273
1358
|
x((t) => {
|
|
1274
1359
|
if (f.value) {
|
|
1275
1360
|
if (!t.parameters) return;
|
|
@@ -1282,7 +1367,7 @@ var _t = ["title"], vt = {
|
|
|
1282
1367
|
}
|
|
1283
1368
|
});
|
|
1284
1369
|
}
|
|
1285
|
-
function
|
|
1370
|
+
function k(e, t) {
|
|
1286
1371
|
if (!t || !ne.test(t)) {
|
|
1287
1372
|
c.value = `Invalid port name "${t}"`;
|
|
1288
1373
|
return;
|
|
@@ -1304,7 +1389,7 @@ var _t = ["title"], vt = {
|
|
|
1304
1389
|
}
|
|
1305
1390
|
});
|
|
1306
1391
|
}
|
|
1307
|
-
function
|
|
1392
|
+
function A(e, t) {
|
|
1308
1393
|
x((n) => {
|
|
1309
1394
|
if (f.value) {
|
|
1310
1395
|
let r = n.parameters?.[e];
|
|
@@ -1334,72 +1419,72 @@ var _t = ["title"], vt = {
|
|
|
1334
1419
|
}
|
|
1335
1420
|
});
|
|
1336
1421
|
}
|
|
1337
|
-
return (t, s) => (p(), n(
|
|
1338
|
-
actions:
|
|
1422
|
+
return (t, s) => (p(), n(Ht, { title: d.value }, {
|
|
1423
|
+
actions: C(() => [a("button", {
|
|
1339
1424
|
class: "inspector-icon-btn",
|
|
1340
1425
|
type: "button",
|
|
1341
1426
|
title: "Add port",
|
|
1342
|
-
onClick:
|
|
1427
|
+
onClick: T(O, ["stop", "prevent"])
|
|
1343
1428
|
}, " + ")]),
|
|
1344
|
-
default:
|
|
1345
|
-
g.value.length ? (p(), i("div",
|
|
1429
|
+
default: C(() => [
|
|
1430
|
+
g.value.length ? (p(), i("div", Ut, [...s[0] ||= [
|
|
1346
1431
|
a("span", null, "Name", -1),
|
|
1347
1432
|
a("span", null, "Type", -1),
|
|
1348
1433
|
a("span", null, null, -1)
|
|
1349
1434
|
]])) : r("", !0),
|
|
1350
|
-
g.value.length ? (p(), i("div",
|
|
1435
|
+
g.value.length ? (p(), i("div", Wt, [(p(!0), i(e, null, h(g.value, (t) => (p(), i("div", {
|
|
1351
1436
|
key: t.name,
|
|
1352
1437
|
class: "iface-entry"
|
|
1353
|
-
}, [a("div",
|
|
1438
|
+
}, [a("div", Gt, [
|
|
1354
1439
|
a("input", {
|
|
1355
1440
|
class: "iface-field iface-name",
|
|
1356
1441
|
type: "text",
|
|
1357
1442
|
value: t.name,
|
|
1358
|
-
onChange: (e) =>
|
|
1359
|
-
}, null, 40,
|
|
1443
|
+
onChange: (e) => k(t.name, e.target.value.trim())
|
|
1444
|
+
}, null, 40, Kt),
|
|
1360
1445
|
a("select", {
|
|
1361
1446
|
class: "iface-field iface-select",
|
|
1362
1447
|
value: t.spec.type,
|
|
1363
|
-
onChange: (e) =>
|
|
1448
|
+
onChange: (e) => A(t.name, e.target.value)
|
|
1364
1449
|
}, [(p(!0), i(e, null, h(o.typeIds, (e) => (p(), i("option", {
|
|
1365
1450
|
key: e,
|
|
1366
1451
|
value: e
|
|
1367
|
-
}, v(e), 9,
|
|
1452
|
+
}, v(e), 9, Jt))), 128))], 40, qt),
|
|
1368
1453
|
a("button", {
|
|
1369
1454
|
class: "iface-remove",
|
|
1370
1455
|
type: "button",
|
|
1371
1456
|
title: "Remove port",
|
|
1372
|
-
onClick:
|
|
1373
|
-
}, " × ", 8,
|
|
1374
|
-
]), f.value ? (p(), i("div",
|
|
1457
|
+
onClick: T((e) => ee(t.name), ["stop", "prevent"])
|
|
1458
|
+
}, " × ", 8, Yt)
|
|
1459
|
+
]), f.value ? (p(), i("div", Xt, [s[1] ||= a("span", { class: "iface-default-label" }, "Default", -1), (p(), n(pt, {
|
|
1375
1460
|
key: `${t.name}-${t.spec.type}`,
|
|
1376
1461
|
class: "iface-default-widget",
|
|
1377
|
-
port:
|
|
1462
|
+
port: w(t.name, t.spec),
|
|
1378
1463
|
"type-def": o.types[t.spec.type],
|
|
1379
1464
|
mode: "editable",
|
|
1380
1465
|
placeholder: t.name,
|
|
1381
|
-
"onUpdate:value": (e) =>
|
|
1382
|
-
onCommit: (e) =>
|
|
1466
|
+
"onUpdate:value": (e) => E(t.name, e),
|
|
1467
|
+
onCommit: (e) => D(t.name)
|
|
1383
1468
|
}, null, 8, [
|
|
1384
1469
|
"port",
|
|
1385
1470
|
"type-def",
|
|
1386
1471
|
"placeholder",
|
|
1387
1472
|
"onUpdate:value",
|
|
1388
1473
|
"onCommit"
|
|
1389
|
-
]))])) : r("", !0)]))), 128))])) : (p(), i("div",
|
|
1390
|
-
u.value ? (p(), i("p",
|
|
1474
|
+
]))])) : r("", !0)]))), 128))])) : (p(), i("div", Zt, "No ports")),
|
|
1475
|
+
u.value ? (p(), i("p", Qt, v(u.value), 1)) : r("", !0)
|
|
1391
1476
|
]),
|
|
1392
1477
|
_: 1
|
|
1393
1478
|
}, 8, ["title"]));
|
|
1394
1479
|
}
|
|
1395
|
-
}), [["__scopeId", "data-v-8f895443"]]),
|
|
1480
|
+
}), [["__scopeId", "data-v-8f895443"]]), en = {
|
|
1396
1481
|
key: 0,
|
|
1397
1482
|
class: "inspector-title static"
|
|
1398
|
-
},
|
|
1483
|
+
}, tn = [
|
|
1399
1484
|
"value",
|
|
1400
1485
|
"placeholder",
|
|
1401
1486
|
"title"
|
|
1402
|
-
],
|
|
1487
|
+
], nn = { class: "inspector-header-actions" }, rn = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1403
1488
|
__name: "InspectorPanel",
|
|
1404
1489
|
props: {
|
|
1405
1490
|
title: {},
|
|
@@ -1436,7 +1521,7 @@ var _t = ["title"], vt = {
|
|
|
1436
1521
|
return (t, o) => (p(), i("div", { class: l(["inspector-panel", { fill: e.fill }]) }, [a("div", {
|
|
1437
1522
|
class: "inspector-header",
|
|
1438
1523
|
style: u({ background: e.headerColor })
|
|
1439
|
-
}, [g(t.$slots, "title", {}, () => [e.staticTitle ? (p(), i("span",
|
|
1524
|
+
}, [g(t.$slots, "title", {}, () => [e.staticTitle ? (p(), i("span", en, v(e.title), 1)) : (p(), i("input", {
|
|
1440
1525
|
key: 1,
|
|
1441
1526
|
class: "inspector-title",
|
|
1442
1527
|
type: "text",
|
|
@@ -1444,7 +1529,7 @@ var _t = ["title"], vt = {
|
|
|
1444
1529
|
placeholder: e.titlePlaceholder,
|
|
1445
1530
|
title: e.title,
|
|
1446
1531
|
onInput: d
|
|
1447
|
-
}, null, 40,
|
|
1532
|
+
}, null, 40, tn))], !0), a("div", nn, [g(t.$slots, "header-actions", {}, void 0, !0), e.showUp ? (p(), i("button", {
|
|
1448
1533
|
key: 0,
|
|
1449
1534
|
class: "inspector-icon-btn",
|
|
1450
1535
|
type: "button",
|
|
@@ -1452,7 +1537,7 @@ var _t = ["title"], vt = {
|
|
|
1452
1537
|
onClick: o[0] ||= (e) => n("up")
|
|
1453
1538
|
}, " ↩ ")) : r("", !0)])], 4), a("div", { class: l(["inspector-body", { flush: e.flush }]) }, [g(t.$slots, "default", {}, void 0, !0)], 2)], 2));
|
|
1454
1539
|
}
|
|
1455
|
-
}), [["__scopeId", "data-v-78844099"]]),
|
|
1540
|
+
}), [["__scopeId", "data-v-78844099"]]), an = { class: "inspector-row" }, on = { class: "inspector-key" }, sn = ["value"], cn = /* @__PURE__ */ s({
|
|
1456
1541
|
__name: "InspectorColorField",
|
|
1457
1542
|
props: {
|
|
1458
1543
|
modelValue: {},
|
|
@@ -1464,20 +1549,20 @@ var _t = ["title"], vt = {
|
|
|
1464
1549
|
function r(e) {
|
|
1465
1550
|
n("update:modelValue", e.target.value);
|
|
1466
1551
|
}
|
|
1467
|
-
return (t, n) => (p(), i("label",
|
|
1552
|
+
return (t, n) => (p(), i("label", an, [a("span", on, v(e.label), 1), a("input", {
|
|
1468
1553
|
class: "inspector-swatch",
|
|
1469
1554
|
type: "color",
|
|
1470
1555
|
value: e.modelValue,
|
|
1471
1556
|
onInput: r
|
|
1472
|
-
}, null, 40,
|
|
1557
|
+
}, null, 40, sn)]));
|
|
1473
1558
|
}
|
|
1474
|
-
}),
|
|
1559
|
+
}), ln = { class: "inspector-error" }, un = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1475
1560
|
__name: "InspectorError",
|
|
1476
1561
|
props: { message: {} },
|
|
1477
1562
|
setup(e) {
|
|
1478
|
-
return (t, n) => (p(), i("p",
|
|
1563
|
+
return (t, n) => (p(), i("p", ln, v(e.message), 1));
|
|
1479
1564
|
}
|
|
1480
|
-
}), [["__scopeId", "data-v-a863f513"]]),
|
|
1565
|
+
}), [["__scopeId", "data-v-a863f513"]]), dn = { class: "inspector-row pair" }, fn = ["value"], pn = ["value"], mn = /* @__PURE__ */ s({
|
|
1481
1566
|
__name: "InspectorPositionField",
|
|
1482
1567
|
props: {
|
|
1483
1568
|
x: {},
|
|
@@ -1489,23 +1574,23 @@ var _t = ["title"], vt = {
|
|
|
1489
1574
|
function r(e) {
|
|
1490
1575
|
return Number(e.target.value);
|
|
1491
1576
|
}
|
|
1492
|
-
return (t, o) => (p(), i("div",
|
|
1577
|
+
return (t, o) => (p(), i("div", dn, [a("label", null, [o[2] ||= a("span", { class: "inspector-key" }, "X", -1), a("input", {
|
|
1493
1578
|
class: "inspector-field",
|
|
1494
1579
|
type: "number",
|
|
1495
1580
|
value: e.x,
|
|
1496
1581
|
onInput: o[0] ||= (e) => n("update:x", r(e))
|
|
1497
|
-
}, null, 40,
|
|
1582
|
+
}, null, 40, fn)]), a("label", null, [o[3] ||= a("span", { class: "inspector-key" }, "Y", -1), a("input", {
|
|
1498
1583
|
class: "inspector-field",
|
|
1499
1584
|
type: "number",
|
|
1500
1585
|
value: e.y,
|
|
1501
1586
|
onInput: o[1] ||= (e) => n("update:y", r(e))
|
|
1502
|
-
}, null, 40,
|
|
1587
|
+
}, null, 40, pn)])]));
|
|
1503
1588
|
}
|
|
1504
|
-
}),
|
|
1589
|
+
}), hn = { class: "inspector-row" }, gn = [
|
|
1505
1590
|
"min",
|
|
1506
1591
|
"max",
|
|
1507
1592
|
"value"
|
|
1508
|
-
],
|
|
1593
|
+
], _n = { class: "inspector-slider-value" }, vn = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1509
1594
|
__name: "InspectorWidthField",
|
|
1510
1595
|
props: {
|
|
1511
1596
|
modelValue: {},
|
|
@@ -1519,7 +1604,7 @@ var _t = ["title"], vt = {
|
|
|
1519
1604
|
function r(e) {
|
|
1520
1605
|
n("update:modelValue", Number(e.target.value));
|
|
1521
1606
|
}
|
|
1522
|
-
return (t, n) => (p(), i("label",
|
|
1607
|
+
return (t, n) => (p(), i("label", hn, [
|
|
1523
1608
|
n[0] ||= a("span", { class: "inspector-key" }, "Width", -1),
|
|
1524
1609
|
a("input", {
|
|
1525
1610
|
class: "inspector-slider",
|
|
@@ -1530,11 +1615,11 @@ var _t = ["title"], vt = {
|
|
|
1530
1615
|
value: e.modelValue,
|
|
1531
1616
|
style: u({ accentColor: e.accentColor }),
|
|
1532
1617
|
onInput: r
|
|
1533
|
-
}, null, 44,
|
|
1534
|
-
a("span",
|
|
1618
|
+
}, null, 44, gn),
|
|
1619
|
+
a("span", _n, v(e.modelValue), 1)
|
|
1535
1620
|
]));
|
|
1536
1621
|
}
|
|
1537
|
-
}), [["__scopeId", "data-v-472135f4"]]),
|
|
1622
|
+
}), [["__scopeId", "data-v-472135f4"]]), yn = "#3a3f4b", bn = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1538
1623
|
__name: "NodePanel",
|
|
1539
1624
|
props: {
|
|
1540
1625
|
map: {},
|
|
@@ -1572,57 +1657,57 @@ var _t = ["title"], vt = {
|
|
|
1572
1657
|
let t = l.value;
|
|
1573
1658
|
t && (t.color = e);
|
|
1574
1659
|
}
|
|
1575
|
-
function
|
|
1660
|
+
function S(e) {
|
|
1576
1661
|
let t = l.value;
|
|
1577
1662
|
t && (t.width = e);
|
|
1578
1663
|
}
|
|
1579
|
-
function
|
|
1664
|
+
function w(e) {
|
|
1580
1665
|
let t = e - _.value;
|
|
1581
1666
|
for (let e of a.nodes) e.location.x += t;
|
|
1582
1667
|
}
|
|
1583
|
-
function
|
|
1668
|
+
function T(e) {
|
|
1584
1669
|
let t = e - v.value;
|
|
1585
1670
|
for (let e of a.nodes) e.location.y += t;
|
|
1586
1671
|
}
|
|
1587
|
-
return (t, i) => l.value ? (p(), n(
|
|
1672
|
+
return (t, i) => l.value ? (p(), n(rn, {
|
|
1588
1673
|
key: 0,
|
|
1589
1674
|
class: "node-panel",
|
|
1590
1675
|
title: m.value,
|
|
1591
1676
|
"title-placeholder": f.value,
|
|
1592
|
-
"header-color":
|
|
1677
|
+
"header-color": yn,
|
|
1593
1678
|
"static-title": c.value,
|
|
1594
1679
|
"onUpdate:title": b
|
|
1595
1680
|
}, {
|
|
1596
|
-
default:
|
|
1597
|
-
c.value ? r("", !0) : (p(), n(
|
|
1681
|
+
default: C(() => [
|
|
1682
|
+
c.value ? r("", !0) : (p(), n(cn, {
|
|
1598
1683
|
key: 0,
|
|
1599
1684
|
"model-value": h.value,
|
|
1600
1685
|
"onUpdate:modelValue": x
|
|
1601
1686
|
}, null, 8, ["model-value"])),
|
|
1602
|
-
o(
|
|
1687
|
+
o(mn, {
|
|
1603
1688
|
x: _.value,
|
|
1604
1689
|
y: v.value,
|
|
1605
|
-
"onUpdate:x":
|
|
1606
|
-
"onUpdate:y":
|
|
1690
|
+
"onUpdate:x": w,
|
|
1691
|
+
"onUpdate:y": T
|
|
1607
1692
|
}, null, 8, ["x", "y"]),
|
|
1608
|
-
c.value ? r("", !0) : (p(), n(
|
|
1693
|
+
c.value ? r("", !0) : (p(), n(vn, {
|
|
1609
1694
|
key: 1,
|
|
1610
1695
|
"model-value": g.value,
|
|
1611
1696
|
min: y(60),
|
|
1612
1697
|
max: y(320),
|
|
1613
1698
|
"accent-color": h.value,
|
|
1614
|
-
"onUpdate:modelValue":
|
|
1699
|
+
"onUpdate:modelValue": S
|
|
1615
1700
|
}, null, 8, [
|
|
1616
1701
|
"model-value",
|
|
1617
1702
|
"min",
|
|
1618
1703
|
"max",
|
|
1619
1704
|
"accent-color"
|
|
1620
1705
|
])),
|
|
1621
|
-
e.error && !c.value ? (p(), n(
|
|
1706
|
+
e.error && !c.value ? (p(), n(un, {
|
|
1622
1707
|
key: 2,
|
|
1623
1708
|
message: e.error
|
|
1624
1709
|
}, null, 8, ["message"])) : r("", !0),
|
|
1625
|
-
u.value ? (p(), n(
|
|
1710
|
+
u.value ? (p(), n($t, {
|
|
1626
1711
|
key: 3,
|
|
1627
1712
|
"graph-interface": e.graphInterface,
|
|
1628
1713
|
mode: u.value,
|
|
@@ -1648,7 +1733,7 @@ var _t = ["title"], vt = {
|
|
|
1648
1733
|
"static-title"
|
|
1649
1734
|
])) : r("", !0);
|
|
1650
1735
|
}
|
|
1651
|
-
}), [["__scopeId", "data-v-51945220"]]),
|
|
1736
|
+
}), [["__scopeId", "data-v-51945220"]]), xn = { class: "inspector-row inspector-check" }, Sn = { class: "inspector-key" }, Cn = ["checked"], wn = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1652
1737
|
__name: "InspectorCheckboxField",
|
|
1653
1738
|
props: {
|
|
1654
1739
|
modelValue: { type: Boolean },
|
|
@@ -1660,13 +1745,13 @@ var _t = ["title"], vt = {
|
|
|
1660
1745
|
function r(e) {
|
|
1661
1746
|
n("update:modelValue", e.target.checked);
|
|
1662
1747
|
}
|
|
1663
|
-
return (t, n) => (p(), i("label",
|
|
1748
|
+
return (t, n) => (p(), i("label", xn, [a("span", Sn, v(e.label), 1), a("input", {
|
|
1664
1749
|
type: "checkbox",
|
|
1665
1750
|
checked: e.modelValue,
|
|
1666
1751
|
onChange: r
|
|
1667
|
-
}, null, 40,
|
|
1752
|
+
}, null, 40, Cn)]));
|
|
1668
1753
|
}
|
|
1669
|
-
}), [["__scopeId", "data-v-7b38cfa2"]]),
|
|
1754
|
+
}), [["__scopeId", "data-v-7b38cfa2"]]), Tn = "#3a3f4b", En = /* @__PURE__ */ s({
|
|
1670
1755
|
__name: "GroupPanel",
|
|
1671
1756
|
props: {
|
|
1672
1757
|
composite: {},
|
|
@@ -1674,7 +1759,7 @@ var _t = ["title"], vt = {
|
|
|
1674
1759
|
},
|
|
1675
1760
|
emits: ["up", "update:ioWidgets"],
|
|
1676
1761
|
setup(e, { emit: i }) {
|
|
1677
|
-
let a = e, s = i, c = t(() =>
|
|
1762
|
+
let a = e, s = i, c = t(() => ue.displayName), l = t(() => a.composite?.label || ue.displayName), u = t(() => a.composite?.color ?? ue.color ?? Tn);
|
|
1678
1763
|
function d(e) {
|
|
1679
1764
|
let t = a.composite;
|
|
1680
1765
|
t && (t.label = e);
|
|
@@ -1683,19 +1768,19 @@ var _t = ["title"], vt = {
|
|
|
1683
1768
|
let t = a.composite;
|
|
1684
1769
|
t && (t.color = e);
|
|
1685
1770
|
}
|
|
1686
|
-
return (t, i) => e.composite ? (p(), n(
|
|
1771
|
+
return (t, i) => e.composite ? (p(), n(rn, {
|
|
1687
1772
|
key: 0,
|
|
1688
1773
|
title: l.value,
|
|
1689
1774
|
"title-placeholder": c.value,
|
|
1690
|
-
"header-color":
|
|
1775
|
+
"header-color": Tn,
|
|
1691
1776
|
"show-up": "",
|
|
1692
1777
|
"onUpdate:title": d,
|
|
1693
1778
|
onUp: i[1] ||= (e) => s("up")
|
|
1694
1779
|
}, {
|
|
1695
|
-
default:
|
|
1780
|
+
default: C(() => [o(cn, {
|
|
1696
1781
|
"model-value": u.value,
|
|
1697
1782
|
"onUpdate:modelValue": f
|
|
1698
|
-
}, null, 8, ["model-value"]), o(
|
|
1783
|
+
}, null, 8, ["model-value"]), o(wn, {
|
|
1699
1784
|
label: "IO test",
|
|
1700
1785
|
"model-value": e.ioWidgets,
|
|
1701
1786
|
"onUpdate:modelValue": i[0] ||= (e) => s("update:ioWidgets", e)
|
|
@@ -1706,7 +1791,7 @@ var _t = ["title"], vt = {
|
|
|
1706
1791
|
});
|
|
1707
1792
|
//#endregion
|
|
1708
1793
|
//#region src/store/registry/groups.ts
|
|
1709
|
-
function
|
|
1794
|
+
function Dn(e, t) {
|
|
1710
1795
|
return {
|
|
1711
1796
|
name: e,
|
|
1712
1797
|
path: t,
|
|
@@ -1714,37 +1799,37 @@ function yn(e, t) {
|
|
|
1714
1799
|
nodes: []
|
|
1715
1800
|
};
|
|
1716
1801
|
}
|
|
1717
|
-
function
|
|
1718
|
-
let n =
|
|
1802
|
+
function On(e, t) {
|
|
1803
|
+
let n = Dn("", []);
|
|
1719
1804
|
for (let r of Object.values(e)) {
|
|
1720
1805
|
if (t && !t(r)) continue;
|
|
1721
1806
|
let e = n, i = [];
|
|
1722
1807
|
for (let t of r.group ?? []) {
|
|
1723
1808
|
i.push(t);
|
|
1724
1809
|
let n = e.subgroups.find((e) => e.name === t);
|
|
1725
|
-
n || (n =
|
|
1810
|
+
n || (n = Dn(t, [...i]), e.subgroups.push(n)), e = n;
|
|
1726
1811
|
}
|
|
1727
1812
|
e.nodes.push(r);
|
|
1728
1813
|
}
|
|
1729
1814
|
return n;
|
|
1730
1815
|
}
|
|
1731
|
-
function
|
|
1816
|
+
function kn(e) {
|
|
1732
1817
|
e.subgroups.sort((e, t) => e.name.localeCompare(t.name)), e.nodes.sort((e, t) => e.displayName.localeCompare(t.displayName));
|
|
1733
|
-
for (let t of e.subgroups)
|
|
1818
|
+
for (let t of e.subgroups) kn(t);
|
|
1734
1819
|
return e;
|
|
1735
1820
|
}
|
|
1736
1821
|
//#endregion
|
|
1737
1822
|
//#region src/components/AddNodePanel.vue?vue&type=script&setup=true&lang.ts
|
|
1738
|
-
var
|
|
1823
|
+
var An = ["title"], jn = { class: "picker-body" }, Mn = { class: "list" }, Nn = ["title", "onClick"], Pn = { class: "name" }, Fn = { class: "path" }, In = {
|
|
1739
1824
|
key: 0,
|
|
1740
1825
|
class: "path-sep"
|
|
1741
|
-
},
|
|
1826
|
+
}, Ln = { class: "path-seg" }, Rn = {
|
|
1742
1827
|
key: 0,
|
|
1743
1828
|
class: "empty"
|
|
1744
|
-
},
|
|
1829
|
+
}, zn = ["onClick"], Bn = { class: "name" }, Vn = ["title", "onClick"], Hn = { class: "name" }, Un = {
|
|
1745
1830
|
key: 1,
|
|
1746
1831
|
class: "empty"
|
|
1747
|
-
},
|
|
1832
|
+
}, Wn = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1748
1833
|
__name: "AddNodePanel",
|
|
1749
1834
|
props: {
|
|
1750
1835
|
map: {},
|
|
@@ -1761,125 +1846,125 @@ var Sn = ["title"], Cn = { class: "picker-body" }, wn = { class: "list" }, Tn =
|
|
|
1761
1846
|
ae7fef7e: y,
|
|
1762
1847
|
v113015c7: _
|
|
1763
1848
|
}));
|
|
1764
|
-
let c = n, f = s, g = "11px", _ = "6px", y = "20px",
|
|
1765
|
-
d(() =>
|
|
1766
|
-
let
|
|
1767
|
-
let e =
|
|
1768
|
-
for (let t of
|
|
1849
|
+
let c = n, f = s, g = "11px", _ = "6px", y = "20px", E = m(""), D = m(null);
|
|
1850
|
+
d(() => D.value?.focus());
|
|
1851
|
+
let O = (e) => e.typeId !== "io/input" && e.typeId !== "io/output" && e.typeId !== "composite/group", ee = t(() => kn(On(c.map.nodeTypes, O))), k = m([]), A = t(() => {
|
|
1852
|
+
let e = ee.value;
|
|
1853
|
+
for (let t of k.value) {
|
|
1769
1854
|
let n = e.subgroups.find((e) => e.name === t);
|
|
1770
1855
|
if (!n) break;
|
|
1771
1856
|
e = n;
|
|
1772
1857
|
}
|
|
1773
1858
|
return e;
|
|
1774
|
-
}),
|
|
1775
|
-
function
|
|
1859
|
+
}), j = t(() => k.value.length ? k.value.join(" › ") : "Add Node"), M = t(() => k.value.length ? k.value : null);
|
|
1860
|
+
function N(e) {
|
|
1776
1861
|
return e.group ?? [];
|
|
1777
1862
|
}
|
|
1778
|
-
function
|
|
1779
|
-
|
|
1863
|
+
function te(e) {
|
|
1864
|
+
k.value = [...k.value, e];
|
|
1780
1865
|
}
|
|
1781
1866
|
function P() {
|
|
1782
|
-
|
|
1867
|
+
k.value = k.value.slice(0, -1);
|
|
1783
1868
|
}
|
|
1784
1869
|
let F = t(() => {
|
|
1785
|
-
let e =
|
|
1786
|
-
return e ? Object.values(c.map.nodeTypes).filter(
|
|
1870
|
+
let e = E.value.trim().toLowerCase();
|
|
1871
|
+
return e ? Object.values(c.map.nodeTypes).filter(O).filter((t) => t.displayName.toLowerCase().includes(e)).sort((e, t) => e.displayName.localeCompare(t.displayName)) : null;
|
|
1787
1872
|
});
|
|
1788
1873
|
function I(e) {
|
|
1789
1874
|
f("select", e.typeId);
|
|
1790
1875
|
}
|
|
1791
|
-
let L = t(() => F.value ? F.value :
|
|
1792
|
-
|
|
1876
|
+
let L = t(() => F.value ? F.value : A.value.nodes), R = m(0);
|
|
1877
|
+
S(L, () => {
|
|
1793
1878
|
R.value = 0;
|
|
1794
1879
|
});
|
|
1795
1880
|
function ne() {
|
|
1796
1881
|
let e = L.value;
|
|
1797
1882
|
e.length && I(e[R.value] ?? e[0]);
|
|
1798
1883
|
}
|
|
1799
|
-
function
|
|
1884
|
+
function re(e) {
|
|
1800
1885
|
let t = L.value;
|
|
1801
1886
|
t.length && (e.key === "ArrowDown" ? (e.preventDefault(), R.value = (R.value + 1) % t.length) : e.key === "ArrowUp" ? (e.preventDefault(), R.value = (R.value - 1 + t.length) % t.length) : e.key === "Enter" && (e.preventDefault(), ne()));
|
|
1802
1887
|
}
|
|
1803
|
-
function
|
|
1888
|
+
function z(e, t) {
|
|
1804
1889
|
R.value = t, I(e);
|
|
1805
1890
|
}
|
|
1806
|
-
function
|
|
1891
|
+
function B(e) {
|
|
1807
1892
|
e.stopPropagation(), f("close");
|
|
1808
1893
|
}
|
|
1809
1894
|
return (t, s) => (p(), i("div", {
|
|
1810
1895
|
class: "backdrop",
|
|
1811
|
-
onPointerdown:
|
|
1812
|
-
onContextmenu: s[4] ||=
|
|
1896
|
+
onPointerdown: B,
|
|
1897
|
+
onContextmenu: s[4] ||= T(() => {}, ["prevent"])
|
|
1813
1898
|
}, [a("div", {
|
|
1814
1899
|
class: "anchor",
|
|
1815
1900
|
style: u({
|
|
1816
1901
|
left: n.screen.x + "px",
|
|
1817
1902
|
top: n.screen.y + "px"
|
|
1818
1903
|
}),
|
|
1819
|
-
onPointerdown: s[2] ||=
|
|
1820
|
-
onContextmenu: s[3] ||=
|
|
1821
|
-
}, [o(
|
|
1904
|
+
onPointerdown: s[2] ||= T(() => {}, ["stop"]),
|
|
1905
|
+
onContextmenu: s[3] ||= T(() => {}, ["prevent"])
|
|
1906
|
+
}, [o(rn, {
|
|
1822
1907
|
title: "Add Node",
|
|
1823
1908
|
"static-title": "",
|
|
1824
1909
|
fill: "",
|
|
1825
1910
|
flush: ""
|
|
1826
1911
|
}, {
|
|
1827
|
-
title:
|
|
1912
|
+
title: C(() => [a("nav", {
|
|
1828
1913
|
class: "crumbs",
|
|
1829
|
-
title:
|
|
1830
|
-
}, [a("span", { class: l(["crumb", { current: !
|
|
1831
|
-
"header-actions":
|
|
1914
|
+
title: j.value
|
|
1915
|
+
}, [a("span", { class: l(["crumb", { current: !M.value }]) }, " Add Node ", 2), M.value ? (p(!0), i(e, { key: 0 }, h(M.value, (t, n) => (p(), i(e, { key: `${n}-${t}` }, [s[5] ||= a("span", { class: "crumb-sep" }, "›", -1), a("span", { class: l(["crumb", { current: n === M.value.length - 1 }]) }, v(t), 3)], 64))), 128)) : r("", !0)], 8, An)]),
|
|
1916
|
+
"header-actions": C(() => [a("button", {
|
|
1832
1917
|
class: "inspector-icon-btn",
|
|
1833
1918
|
type: "button",
|
|
1834
1919
|
title: "Add composite",
|
|
1835
1920
|
onClick: s[0] ||= (e) => f("addComposite")
|
|
1836
1921
|
}, " + ")]),
|
|
1837
|
-
default:
|
|
1922
|
+
default: C(() => [a("div", jn, [w(a("input", {
|
|
1838
1923
|
ref_key: "searchEl",
|
|
1839
|
-
ref:
|
|
1840
|
-
"onUpdate:modelValue": s[1] ||= (e) =>
|
|
1924
|
+
ref: D,
|
|
1925
|
+
"onUpdate:modelValue": s[1] ||= (e) => E.value = e,
|
|
1841
1926
|
class: "search",
|
|
1842
1927
|
type: "text",
|
|
1843
1928
|
placeholder: "Search nodes…",
|
|
1844
|
-
onKeydown:
|
|
1845
|
-
}, null, 544), [[x,
|
|
1929
|
+
onKeydown: re
|
|
1930
|
+
}, null, 544), [[x, E.value]]), a("div", Mn, [F.value ? (p(), i(e, { key: 0 }, [(p(!0), i(e, null, h(F.value, (t, n) => (p(), i("button", {
|
|
1846
1931
|
key: t.typeId,
|
|
1847
1932
|
class: l(["row node", { active: n === R.value }]),
|
|
1848
1933
|
title: t.description,
|
|
1849
|
-
onClick: (e) =>
|
|
1934
|
+
onClick: (e) => z(t, n)
|
|
1850
1935
|
}, [
|
|
1851
1936
|
a("span", {
|
|
1852
1937
|
class: "dot",
|
|
1853
1938
|
style: u({ background: t.color })
|
|
1854
1939
|
}, null, 4),
|
|
1855
|
-
a("span",
|
|
1856
|
-
a("span",
|
|
1857
|
-
], 10,
|
|
1858
|
-
|
|
1940
|
+
a("span", Pn, v(t.displayName), 1),
|
|
1941
|
+
a("span", Fn, [(p(!0), i(e, null, h(N(t), (n, o) => (p(), i(e, { key: `${t.typeId}-${o}-${n}` }, [o > 0 ? (p(), i("span", In, "›")) : r("", !0), a("span", Ln, v(n), 1)], 64))), 128))])
|
|
1942
|
+
], 10, Nn))), 128)), F.value.length ? r("", !0) : (p(), i("div", Rn, "No matches"))], 64)) : (p(), i(e, { key: 1 }, [
|
|
1943
|
+
k.value.length ? (p(), i("button", {
|
|
1859
1944
|
key: 0,
|
|
1860
1945
|
class: "row up",
|
|
1861
1946
|
onClick: P
|
|
1862
1947
|
}, [...s[6] ||= [a("span", { class: "icon" }, "↩", -1), a("span", { class: "name" }, "..", -1)]])) : r("", !0),
|
|
1863
|
-
(p(!0), i(e, null, h(
|
|
1948
|
+
(p(!0), i(e, null, h(A.value.subgroups, (e) => (p(), i("button", {
|
|
1864
1949
|
key: e.name,
|
|
1865
1950
|
class: "row folder",
|
|
1866
|
-
onClick: (t) =>
|
|
1867
|
-
}, [a("span",
|
|
1868
|
-
(p(!0), i(e, null, h(
|
|
1951
|
+
onClick: (t) => te(e.name)
|
|
1952
|
+
}, [a("span", Bn, v(e.name), 1), s[7] ||= a("span", { class: "chev" }, "›", -1)], 8, zn))), 128)),
|
|
1953
|
+
(p(!0), i(e, null, h(A.value.nodes, (e, t) => (p(), i("button", {
|
|
1869
1954
|
key: e.typeId,
|
|
1870
1955
|
class: l(["row node", { active: t === R.value }]),
|
|
1871
1956
|
title: e.description,
|
|
1872
|
-
onClick: (n) =>
|
|
1957
|
+
onClick: (n) => z(e, t)
|
|
1873
1958
|
}, [a("span", {
|
|
1874
1959
|
class: "dot",
|
|
1875
1960
|
style: u({ background: e.color })
|
|
1876
|
-
}, null, 4), a("span",
|
|
1877
|
-
!
|
|
1961
|
+
}, null, 4), a("span", Hn, v(e.displayName), 1)], 10, Vn))), 128)),
|
|
1962
|
+
!A.value.subgroups.length && !A.value.nodes.length ? (p(), i("div", Un, " Empty ")) : r("", !0)
|
|
1878
1963
|
], 64))])])]),
|
|
1879
1964
|
_: 1
|
|
1880
1965
|
})], 36)], 32));
|
|
1881
1966
|
}
|
|
1882
|
-
}), [["__scopeId", "data-v-999f2b7d"]]),
|
|
1967
|
+
}), [["__scopeId", "data-v-999f2b7d"]]), Gn = 4, Kn = .25, qn = 2, Jn = .001, Yn = 4, Xn = 120 * 1e3, Zn = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1883
1968
|
__name: "NodeViewer",
|
|
1884
1969
|
props: {
|
|
1885
1970
|
map: {},
|
|
@@ -1892,67 +1977,70 @@ var Sn = ["title"], Cn = { class: "picker-body" }, wn = { class: "list" }, Tn =
|
|
|
1892
1977
|
function g(e) {
|
|
1893
1978
|
return b.value.types[e.type];
|
|
1894
1979
|
}
|
|
1895
|
-
let _ = s, v = m([]), y = t(() =>
|
|
1896
|
-
function
|
|
1897
|
-
v.value.length && (v.value = v.value.slice(0, -1), H(),
|
|
1980
|
+
let _ = s, v = m([]), y = t(() => We(_.map, v.value)), b = t(() => y.value.activeMap), x = t(() => Ge(_.map, v.value)), C = m(0), w = m(""), E = t(() => Ue(_.map, v.value)), D = m(!1), O = t(() => v.value.length ? D.value : _.ioWidgets);
|
|
1981
|
+
function ee() {
|
|
1982
|
+
v.value.length && (v.value = v.value.slice(0, -1), H(), q.value = null);
|
|
1898
1983
|
}
|
|
1899
|
-
function
|
|
1900
|
-
|
|
1984
|
+
function k(e) {
|
|
1985
|
+
w.value = "";
|
|
1901
1986
|
try {
|
|
1902
|
-
let t =
|
|
1903
|
-
return t.length ? (
|
|
1987
|
+
let t = Ke(_.map, v.value, e);
|
|
1988
|
+
return t.length ? (w.value = t[0] ?? "Unknown error", t) : (C.value++, []);
|
|
1904
1989
|
} catch (e) {
|
|
1905
|
-
return
|
|
1990
|
+
return w.value = e instanceof Error ? e.message : String(e), [w.value];
|
|
1906
1991
|
}
|
|
1907
1992
|
}
|
|
1908
|
-
function
|
|
1993
|
+
function A(e) {
|
|
1909
1994
|
let t = b.value.graph.nodes.find((t) => t.id === e);
|
|
1910
1995
|
if (!t || !he(t)) return;
|
|
1911
|
-
let n =
|
|
1996
|
+
let n = Xe(_.map, v.value, t);
|
|
1912
1997
|
if (n) {
|
|
1913
1998
|
console.warn(`[Group] ${n}`);
|
|
1914
1999
|
return;
|
|
1915
2000
|
}
|
|
1916
|
-
v.value.push({ compositeNodeId: e }), H(),
|
|
2001
|
+
v.value.push({ compositeNodeId: e }), H(), q.value = null;
|
|
1917
2002
|
}
|
|
1918
|
-
let
|
|
1919
|
-
|
|
2003
|
+
let j = t(() => be(b.value)), M = t(() => O.value ? j.value.values : void 0), N = t(() => j.value.errors), te = m({});
|
|
2004
|
+
S(N, (e) => {
|
|
1920
2005
|
for (let [t, n] of Object.entries(e)) {
|
|
1921
|
-
if (
|
|
2006
|
+
if (te.value[t] === n) continue;
|
|
1922
2007
|
let e = b.value.graph.nodes.find((e) => e.id === t), r = e ? b.value.nodeTypes[e.typeId] : void 0, i = e?.label || r?.displayName || e?.typeId || t;
|
|
1923
|
-
console.error(`[${i}] ${n}`),
|
|
2008
|
+
console.error(`[${i}] ${n}`), te.value[t] = n;
|
|
1924
2009
|
}
|
|
1925
|
-
for (let t of Object.keys(
|
|
2010
|
+
for (let t of Object.keys(te.value)) t in e || delete te.value[t];
|
|
1926
2011
|
});
|
|
1927
|
-
let P = m(null), F = m(0), I = m(0), R = m(1), ne = m(!1),
|
|
1928
|
-
|
|
1929
|
-
|
|
2012
|
+
let P = m(null), F = m(0), I = m(0), R = m(1), ne = m(!1), re = m({
|
|
2013
|
+
x: 0,
|
|
2014
|
+
y: 0
|
|
2015
|
+
}), z = m(null), B = m([]), ie = t(() => new Set(B.value)), ae = t(() => b.value.graph.nodes.filter((e) => ie.value.has(e.id))), V = t(() => ae.value[0] ?? null), oe = t(() => V.value ? b.value.nodeTypes[V.value.typeId] ?? null : null);
|
|
2016
|
+
function se(e) {
|
|
2017
|
+
B.value = [e], Ve(b.value, e);
|
|
1930
2018
|
}
|
|
1931
|
-
function
|
|
1932
|
-
|
|
2019
|
+
function ce(e) {
|
|
2020
|
+
B.value.indexOf(e) >= 0 ? B.value = B.value.filter((t) => t !== e) : (B.value = [...B.value, e], Ve(b.value, e));
|
|
1933
2021
|
}
|
|
1934
|
-
function
|
|
2022
|
+
function le(e, t) {
|
|
1935
2023
|
if (t) {
|
|
1936
|
-
|
|
2024
|
+
ce(e);
|
|
1937
2025
|
return;
|
|
1938
2026
|
}
|
|
1939
|
-
if (
|
|
1940
|
-
|
|
2027
|
+
if (ie.value.has(e) && B.value.length > 1) {
|
|
2028
|
+
Ve(b.value, e);
|
|
1941
2029
|
return;
|
|
1942
2030
|
}
|
|
1943
|
-
|
|
2031
|
+
se(e);
|
|
1944
2032
|
}
|
|
1945
2033
|
function H() {
|
|
1946
|
-
|
|
2034
|
+
B.value = [];
|
|
1947
2035
|
}
|
|
1948
|
-
function
|
|
2036
|
+
function ue(e, t) {
|
|
1949
2037
|
let n = Math.min(e.x, t.x), r = Math.max(e.x, t.x), i = Math.min(e.y, t.y), a = Math.max(e.y, t.y);
|
|
1950
2038
|
return b.value.graph.nodes.filter((e) => {
|
|
1951
|
-
let t =
|
|
2039
|
+
let t = _t(e), o = vt(e, g);
|
|
1952
2040
|
return e.location.x < r && e.location.x + t > n && e.location.y < a && e.location.y + o > i;
|
|
1953
2041
|
}).map((e) => e.id);
|
|
1954
2042
|
}
|
|
1955
|
-
let U = m(null),
|
|
2043
|
+
let U = m(null), de = t(() => {
|
|
1956
2044
|
let e = U.value;
|
|
1957
2045
|
if (!e) return null;
|
|
1958
2046
|
let t = Math.min(e.start.x, e.cur.x), n = Math.min(e.start.y, e.cur.y);
|
|
@@ -1962,107 +2050,107 @@ var Sn = ["title"], Cn = { class: "picker-body" }, wn = { class: "list" }, Tn =
|
|
|
1962
2050
|
width: `${Math.abs(e.cur.x - e.start.x)}px`,
|
|
1963
2051
|
height: `${Math.abs(e.cur.y - e.start.y)}px`
|
|
1964
2052
|
};
|
|
1965
|
-
}), W = null,
|
|
1966
|
-
function
|
|
2053
|
+
}), W = null, fe = !1;
|
|
2054
|
+
function pe(e) {
|
|
1967
2055
|
if (W) {
|
|
1968
|
-
if (!
|
|
2056
|
+
if (!fe) {
|
|
1969
2057
|
let t = e.clientX - W.clientX, n = e.clientY - W.clientY;
|
|
1970
|
-
if (Math.hypot(t, n) <
|
|
1971
|
-
|
|
2058
|
+
if (Math.hypot(t, n) < Gn) return;
|
|
2059
|
+
fe = !0;
|
|
1972
2060
|
}
|
|
1973
2061
|
U.value = {
|
|
1974
2062
|
start: W.world,
|
|
1975
|
-
cur:
|
|
2063
|
+
cur: K(e.clientX, e.clientY)
|
|
1976
2064
|
};
|
|
1977
2065
|
}
|
|
1978
2066
|
}
|
|
1979
|
-
function
|
|
1980
|
-
window.removeEventListener("pointermove",
|
|
2067
|
+
function G() {
|
|
2068
|
+
window.removeEventListener("pointermove", pe), window.removeEventListener("pointerup", G), fe && U.value ? B.value = ue(U.value.start, U.value.cur) : W && (H(), q.value = null), U.value = null, W = null, fe = !1;
|
|
1981
2069
|
}
|
|
1982
|
-
let
|
|
1983
|
-
function
|
|
2070
|
+
let ge = t(() => ({ transform: `translate(${F.value}px, ${I.value}px) scale(${R.value})` }));
|
|
2071
|
+
function K(e, t) {
|
|
1984
2072
|
let n = P.value?.getBoundingClientRect(), r = n?.left ?? 0, i = n?.top ?? 0;
|
|
1985
2073
|
return {
|
|
1986
2074
|
x: (e - r - F.value) / R.value,
|
|
1987
2075
|
y: (t - i - I.value) / R.value
|
|
1988
2076
|
};
|
|
1989
2077
|
}
|
|
1990
|
-
function
|
|
2078
|
+
function _e(e, t) {
|
|
1991
2079
|
let n = P.value?.getBoundingClientRect();
|
|
1992
2080
|
return {
|
|
1993
2081
|
x: e - (n?.left ?? 0),
|
|
1994
2082
|
y: t - (n?.top ?? 0)
|
|
1995
2083
|
};
|
|
1996
2084
|
}
|
|
1997
|
-
let
|
|
1998
|
-
function
|
|
2085
|
+
let q = m(null);
|
|
2086
|
+
function ve(e) {
|
|
1999
2087
|
if (e === "composite/group") {
|
|
2000
2088
|
ye();
|
|
2001
2089
|
return;
|
|
2002
2090
|
}
|
|
2003
2091
|
let t = b.value.nodeTypes[e];
|
|
2004
2092
|
if (t) {
|
|
2005
|
-
let e =
|
|
2093
|
+
let e = q.value?.world ?? {
|
|
2006
2094
|
x: 0,
|
|
2007
2095
|
y: 0
|
|
2008
2096
|
}, n = L(t, {
|
|
2009
2097
|
x: e.x,
|
|
2010
2098
|
y: e.y
|
|
2011
2099
|
});
|
|
2012
|
-
b.value.graph.nodes.push(n),
|
|
2100
|
+
b.value.graph.nodes.push(n), Be(b.value), le(n.id, !1);
|
|
2013
2101
|
}
|
|
2014
|
-
|
|
2102
|
+
q.value = null;
|
|
2015
2103
|
}
|
|
2016
2104
|
function ye() {
|
|
2017
|
-
let e =
|
|
2105
|
+
let e = q.value?.world ?? {
|
|
2018
2106
|
x: 0,
|
|
2019
2107
|
y: 0
|
|
2020
2108
|
}, t = b.value.graph, n = me(_.map, {
|
|
2021
2109
|
x: e.x,
|
|
2022
2110
|
y: e.y
|
|
2023
|
-
}), r =
|
|
2111
|
+
}), r = Ze(_.map, v.value, n, t);
|
|
2024
2112
|
if (r) {
|
|
2025
|
-
console.warn(`[Group] ${r}`),
|
|
2113
|
+
console.warn(`[Group] ${r}`), q.value = null;
|
|
2026
2114
|
return;
|
|
2027
2115
|
}
|
|
2028
|
-
t.nodes.push(n),
|
|
2116
|
+
t.nodes.push(n), Be(b.value), le(n.id, !1), q.value = null;
|
|
2029
2117
|
}
|
|
2030
|
-
let
|
|
2031
|
-
let e =
|
|
2118
|
+
let J = m(null), Y = m(null), xe = m(null), Se = t(() => {
|
|
2119
|
+
let e = J.value, t = Y.value;
|
|
2032
2120
|
if (!e || !t) return null;
|
|
2033
|
-
let n =
|
|
2121
|
+
let n = Me(t, e.dir === "output" ? "input" : "output", e.ref.node, xe.value);
|
|
2034
2122
|
if (!n) return null;
|
|
2035
2123
|
let r = b.value.graph.nodes.find((e) => e.id === n.node);
|
|
2036
|
-
return r ?
|
|
2037
|
-
}),
|
|
2038
|
-
let e =
|
|
2124
|
+
return r ? bt(r, n.port, g) : null;
|
|
2125
|
+
}), Te = t(() => {
|
|
2126
|
+
let e = J.value, t = Y.value;
|
|
2039
2127
|
if (!e || !t) return null;
|
|
2040
|
-
let n =
|
|
2041
|
-
return e.dir === "output" ?
|
|
2128
|
+
let n = Se.value ?? t;
|
|
2129
|
+
return e.dir === "output" ? St(e.pos, n) : St(n, e.pos);
|
|
2042
2130
|
});
|
|
2043
|
-
function
|
|
2044
|
-
let r = b.value.graph.nodes.find((t) => t.id === e.node), i = r ?
|
|
2045
|
-
i && (
|
|
2131
|
+
function Ee(e, t, n) {
|
|
2132
|
+
let r = b.value.graph.nodes.find((t) => t.id === e.node), i = r ? bt(r, e.port, g) : null;
|
|
2133
|
+
i && (J.value = {
|
|
2046
2134
|
ref: e,
|
|
2047
2135
|
dir: t.direction,
|
|
2048
2136
|
pos: i
|
|
2049
|
-
},
|
|
2137
|
+
}, Y.value = K(n.clientX, n.clientY), xe.value = new Set(t.direction === "output" ? Ce(b.value, e.node) : we(b.value, e.node)), window.addEventListener("pointermove", je), window.addEventListener("pointerup", Ne));
|
|
2050
2138
|
}
|
|
2051
|
-
function
|
|
2052
|
-
|
|
2139
|
+
function je(e) {
|
|
2140
|
+
Y.value = K(e.clientX, e.clientY);
|
|
2053
2141
|
}
|
|
2054
|
-
function
|
|
2142
|
+
function Me(e, t, n, r) {
|
|
2055
2143
|
let i = null, a = Infinity;
|
|
2056
2144
|
for (let o of b.value.graph.nodes) {
|
|
2057
2145
|
if (o.id === n || r?.has(o.id)) continue;
|
|
2058
|
-
let s = o.location.x - 20, c = o.location.x +
|
|
2146
|
+
let s = o.location.x - 20, c = o.location.x + _t(o) + 20;
|
|
2059
2147
|
if (e.x < s || e.x > c) continue;
|
|
2060
2148
|
let l = t === "input" ? o.inputs : o.outputs;
|
|
2061
2149
|
for (let t of Object.values(l)) {
|
|
2062
2150
|
if (t.userOnly) continue;
|
|
2063
|
-
let n = g(t), r =
|
|
2151
|
+
let n = g(t), r = bt(o, t.id, g);
|
|
2064
2152
|
if (!r) continue;
|
|
2065
|
-
let s =
|
|
2153
|
+
let s = ht(t, n) / 2;
|
|
2066
2154
|
if (e.y < r.y - s || e.y > r.y + s) continue;
|
|
2067
2155
|
let c = Math.hypot(r.x - e.x, r.y - e.y);
|
|
2068
2156
|
c < a && (a = c, i = {
|
|
@@ -2073,90 +2161,110 @@ var Sn = ["title"], Cn = { class: "picker-body" }, wn = { class: "list" }, Tn =
|
|
|
2073
2161
|
}
|
|
2074
2162
|
return i;
|
|
2075
2163
|
}
|
|
2076
|
-
function
|
|
2077
|
-
let e =
|
|
2164
|
+
function Ne() {
|
|
2165
|
+
let e = J.value, t = Y.value;
|
|
2078
2166
|
if (e && t) {
|
|
2079
|
-
let n =
|
|
2167
|
+
let n = Me(t, e.dir === "output" ? "input" : "output", e.ref.node, xe.value);
|
|
2080
2168
|
if (n) {
|
|
2081
2169
|
let t = e.dir === "output" ? e.ref : n, r = e.dir === "output" ? n : e.ref;
|
|
2082
|
-
|
|
2170
|
+
De(b.value, t, r);
|
|
2083
2171
|
}
|
|
2084
2172
|
}
|
|
2085
|
-
|
|
2173
|
+
J.value = null, Y.value = null, xe.value = null, window.removeEventListener("pointermove", je), window.removeEventListener("pointerup", Ne);
|
|
2086
2174
|
}
|
|
2087
|
-
let
|
|
2088
|
-
let e =
|
|
2175
|
+
let Pe = m([]), X = null, Fe = !1, Re = t(() => {
|
|
2176
|
+
let e = Pe.value;
|
|
2089
2177
|
return e.length < 2 ? null : "M " + e.map((e) => `${e.x} ${e.y}`).join(" L ");
|
|
2090
2178
|
});
|
|
2091
|
-
function
|
|
2179
|
+
function He(e) {
|
|
2092
2180
|
e.preventDefault();
|
|
2093
2181
|
let t = e.target;
|
|
2094
|
-
|
|
2182
|
+
X = {
|
|
2095
2183
|
clientX: e.clientX,
|
|
2096
2184
|
clientY: e.clientY,
|
|
2097
|
-
world:
|
|
2098
|
-
screen:
|
|
2185
|
+
world: K(e.clientX, e.clientY),
|
|
2186
|
+
screen: _e(e.clientX, e.clientY),
|
|
2099
2187
|
onBackground: !t?.closest(".node") && !t?.closest(".config-bar")
|
|
2100
|
-
},
|
|
2101
|
-
}
|
|
2102
|
-
function
|
|
2103
|
-
if (!
|
|
2104
|
-
if (!
|
|
2105
|
-
let t = e.clientX -
|
|
2106
|
-
if (Math.hypot(t, n) <
|
|
2107
|
-
|
|
2188
|
+
}, Fe = !1, Pe.value = [X.world], window.addEventListener("pointermove", Z), window.addEventListener("pointerup", Je);
|
|
2189
|
+
}
|
|
2190
|
+
function Z(e) {
|
|
2191
|
+
if (!X) return;
|
|
2192
|
+
if (!Fe) {
|
|
2193
|
+
let t = e.clientX - X.clientX, n = e.clientY - X.clientY;
|
|
2194
|
+
if (Math.hypot(t, n) < Yn) return;
|
|
2195
|
+
Fe = !0;
|
|
2108
2196
|
}
|
|
2109
|
-
let t =
|
|
2110
|
-
n.push(t), r &&
|
|
2197
|
+
let t = K(e.clientX, e.clientY), n = Pe.value, r = n[n.length - 1];
|
|
2198
|
+
n.push(t), r && qe(r, t);
|
|
2111
2199
|
}
|
|
2112
|
-
function
|
|
2200
|
+
function qe(e, t) {
|
|
2113
2201
|
for (let n of [...b.value.graph.connections]) {
|
|
2114
2202
|
let r = b.value.graph.nodes.find((e) => e.id === n.from.node), i = b.value.graph.nodes.find((e) => e.id === n.to.node);
|
|
2115
2203
|
if (!r || !i) continue;
|
|
2116
|
-
let a =
|
|
2204
|
+
let a = bt(r, n.from.port, g), o = bt(i, n.to.port, g);
|
|
2117
2205
|
if (!a || !o) continue;
|
|
2118
|
-
let s =
|
|
2119
|
-
for (let r = 0; r < s.length - 1; r++) if (
|
|
2120
|
-
|
|
2206
|
+
let s = Ct(a, o);
|
|
2207
|
+
for (let r = 0; r < s.length - 1; r++) if (wt(e, t, s[r], s[r + 1])) {
|
|
2208
|
+
Oe(b.value, n.id);
|
|
2121
2209
|
break;
|
|
2122
2210
|
}
|
|
2123
2211
|
}
|
|
2124
2212
|
}
|
|
2125
|
-
function
|
|
2126
|
-
window.removeEventListener("pointermove",
|
|
2127
|
-
let e =
|
|
2128
|
-
|
|
2213
|
+
function Je() {
|
|
2214
|
+
window.removeEventListener("pointermove", Z), window.removeEventListener("pointerup", Je);
|
|
2215
|
+
let e = X, t = Fe;
|
|
2216
|
+
Pe.value = [], X = null, Fe = !1, !t && e && e.onBackground && (q.value = {
|
|
2129
2217
|
screen: e.screen,
|
|
2130
2218
|
world: e.world
|
|
2131
2219
|
});
|
|
2132
2220
|
}
|
|
2133
|
-
function
|
|
2221
|
+
function Ye() {
|
|
2134
2222
|
F.value = 0, I.value = 0, R.value = 1;
|
|
2135
2223
|
}
|
|
2136
|
-
function
|
|
2137
|
-
v.value = [], H(),
|
|
2224
|
+
function Qe() {
|
|
2225
|
+
v.value = [], H(), q.value = null, C.value++;
|
|
2226
|
+
}
|
|
2227
|
+
c({ resetView: Qe });
|
|
2228
|
+
function $e(e) {
|
|
2229
|
+
let t = e.target;
|
|
2230
|
+
return t instanceof HTMLElement && !!t.closest("input, textarea, select");
|
|
2231
|
+
}
|
|
2232
|
+
function Q(e) {
|
|
2233
|
+
re.value = K(e.clientX, e.clientY);
|
|
2138
2234
|
}
|
|
2139
|
-
|
|
2140
|
-
function Je(e) {
|
|
2235
|
+
function et(e) {
|
|
2141
2236
|
if (e.key === "Escape") {
|
|
2142
|
-
|
|
2237
|
+
q.value ? q.value = null : v.value.length ? ee() : B.value.length ? H() : Ye();
|
|
2143
2238
|
return;
|
|
2144
2239
|
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2240
|
+
let t = e.ctrlKey || e.metaKey;
|
|
2241
|
+
if (t && e.key === "c") {
|
|
2242
|
+
if ($e(e)) return;
|
|
2243
|
+
let t = Ie(ae.value, b.value.graph.connections, re.value);
|
|
2244
|
+
t && (z.value = t), e.preventDefault();
|
|
2245
|
+
return;
|
|
2246
|
+
}
|
|
2247
|
+
if (t && e.key === "v") {
|
|
2248
|
+
if ($e(e) || !z.value) return;
|
|
2249
|
+
let t = Le(b.value, z.value, re.value);
|
|
2250
|
+
Be(b.value);
|
|
2251
|
+
for (let e of t) Ve(b.value, e);
|
|
2252
|
+
B.value = t, e.preventDefault();
|
|
2253
|
+
return;
|
|
2254
|
+
}
|
|
2255
|
+
if (!(e.key !== "Delete" && e.key !== "Backspace") && !$e(e) && B.value.length) {
|
|
2256
|
+
for (let e of B.value) ke(b.value, e) && Ae(b.value, e);
|
|
2149
2257
|
H(), e.preventDefault();
|
|
2150
2258
|
}
|
|
2151
2259
|
}
|
|
2152
|
-
function
|
|
2260
|
+
function tt(e) {
|
|
2153
2261
|
e.preventDefault();
|
|
2154
2262
|
let t = P.value;
|
|
2155
2263
|
if (!t) return;
|
|
2156
|
-
let n = t.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top, a = (r - F.value) / R.value, o = (i - I.value) / R.value, s = Math.min(
|
|
2264
|
+
let n = t.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top, a = (r - F.value) / R.value, o = (i - I.value) / R.value, s = Math.min(qn, Math.max(Kn, R.value * (1 - e.deltaY * Jn)));
|
|
2157
2265
|
F.value = r - a * s, I.value = i - o * s, R.value = s;
|
|
2158
2266
|
}
|
|
2159
|
-
function
|
|
2267
|
+
function nt(e) {
|
|
2160
2268
|
let t = e.clientX, n = e.clientY, r = F.value, i = I.value;
|
|
2161
2269
|
ne.value = !0;
|
|
2162
2270
|
function a(e) {
|
|
@@ -2167,49 +2275,50 @@ var Sn = ["title"], Cn = { class: "picker-body" }, wn = { class: "list" }, Tn =
|
|
|
2167
2275
|
}
|
|
2168
2276
|
window.addEventListener("pointermove", a), window.addEventListener("pointerup", o);
|
|
2169
2277
|
}
|
|
2170
|
-
function
|
|
2278
|
+
function rt(e) {
|
|
2171
2279
|
e.button === 0 && (e.stopPropagation(), W = {
|
|
2172
2280
|
clientX: e.clientX,
|
|
2173
2281
|
clientY: e.clientY,
|
|
2174
|
-
world:
|
|
2175
|
-
},
|
|
2282
|
+
world: K(e.clientX, e.clientY)
|
|
2283
|
+
}, fe = !1, window.addEventListener("pointermove", pe), window.addEventListener("pointerup", G));
|
|
2176
2284
|
}
|
|
2177
|
-
function
|
|
2178
|
-
e.button === 1 ? (e.preventDefault(),
|
|
2285
|
+
function it(e) {
|
|
2286
|
+
e.button === 1 ? (e.preventDefault(), nt(e)) : e.button === 2 && He(e);
|
|
2179
2287
|
}
|
|
2180
|
-
let
|
|
2288
|
+
let $;
|
|
2181
2289
|
return d(() => {
|
|
2182
|
-
window.addEventListener("keydown",
|
|
2290
|
+
window.addEventListener("keydown", et), Be(b.value), $ = window.setInterval(() => ze(b.value), Xn);
|
|
2183
2291
|
}), f(() => {
|
|
2184
|
-
window.removeEventListener("keydown",
|
|
2292
|
+
window.removeEventListener("keydown", et), $ !== void 0 && window.clearInterval($);
|
|
2185
2293
|
}), (t, s) => (p(), i("div", {
|
|
2186
2294
|
ref_key: "viewerEl",
|
|
2187
2295
|
ref: P,
|
|
2188
2296
|
class: l(["viewer", { panning: ne.value }]),
|
|
2189
|
-
onWheel:
|
|
2190
|
-
onPointerdown:
|
|
2191
|
-
|
|
2297
|
+
onWheel: tt,
|
|
2298
|
+
onPointerdown: it,
|
|
2299
|
+
onPointermove: Q,
|
|
2300
|
+
onContextmenu: s[3] ||= T(() => {}, ["prevent"])
|
|
2192
2301
|
}, [
|
|
2193
2302
|
a("div", {
|
|
2194
2303
|
class: "top-right-stack",
|
|
2195
|
-
onPointerdown: s[1] ||=
|
|
2196
|
-
}, [v.value.length ? (p(), n(
|
|
2304
|
+
onPointerdown: s[1] ||= T(() => {}, ["stop"])
|
|
2305
|
+
}, [v.value.length ? (p(), n(En, {
|
|
2197
2306
|
key: 0,
|
|
2198
|
-
composite:
|
|
2199
|
-
"io-widgets":
|
|
2200
|
-
onUp:
|
|
2201
|
-
"onUpdate:ioWidgets": s[0] ||= (e) =>
|
|
2202
|
-
}, null, 8, ["composite", "io-widgets"])) : r("", !0),
|
|
2307
|
+
composite: E.value,
|
|
2308
|
+
"io-widgets": D.value,
|
|
2309
|
+
onUp: ee,
|
|
2310
|
+
"onUpdate:ioWidgets": s[0] ||= (e) => D.value = e
|
|
2311
|
+
}, null, 8, ["composite", "io-widgets"])) : r("", !0), V.value ? (p(), n(bn, {
|
|
2203
2312
|
key: 1,
|
|
2204
2313
|
class: "stacked-panel",
|
|
2205
2314
|
map: b.value,
|
|
2206
|
-
nodes:
|
|
2207
|
-
def:
|
|
2315
|
+
nodes: ae.value,
|
|
2316
|
+
def: oe.value,
|
|
2208
2317
|
"graph-interface": x.value,
|
|
2209
|
-
"interface-revision":
|
|
2210
|
-
"interface-commit-error":
|
|
2211
|
-
"apply-interface-mutation":
|
|
2212
|
-
error:
|
|
2318
|
+
"interface-revision": C.value,
|
|
2319
|
+
"interface-commit-error": w.value,
|
|
2320
|
+
"apply-interface-mutation": k,
|
|
2321
|
+
error: ae.value.length === 1 ? N.value[V.value.id] : void 0
|
|
2213
2322
|
}, null, 8, [
|
|
2214
2323
|
"map",
|
|
2215
2324
|
"nodes",
|
|
@@ -2221,39 +2330,39 @@ var Sn = ["title"], Cn = { class: "picker-body" }, wn = { class: "list" }, Tn =
|
|
|
2221
2330
|
])) : r("", !0)], 32),
|
|
2222
2331
|
a("div", {
|
|
2223
2332
|
class: "viewport",
|
|
2224
|
-
style: u(
|
|
2333
|
+
style: u(ge.value)
|
|
2225
2334
|
}, [
|
|
2226
2335
|
a("div", {
|
|
2227
2336
|
class: "canvas-bg",
|
|
2228
|
-
onPointerdown:
|
|
2337
|
+
onPointerdown: rt
|
|
2229
2338
|
}, null, 32),
|
|
2230
|
-
o(
|
|
2339
|
+
o(zt, {
|
|
2231
2340
|
map: b.value,
|
|
2232
|
-
"pending-path":
|
|
2233
|
-
"slice-path":
|
|
2341
|
+
"pending-path": Te.value,
|
|
2342
|
+
"slice-path": Re.value
|
|
2234
2343
|
}, null, 8, [
|
|
2235
2344
|
"map",
|
|
2236
2345
|
"pending-path",
|
|
2237
2346
|
"slice-path"
|
|
2238
2347
|
]),
|
|
2239
|
-
|
|
2348
|
+
de.value ? (p(), i("div", {
|
|
2240
2349
|
key: 0,
|
|
2241
2350
|
class: "marquee",
|
|
2242
|
-
style: u(
|
|
2351
|
+
style: u(de.value)
|
|
2243
2352
|
}, null, 4)) : r("", !0),
|
|
2244
|
-
(p(!0), i(e, null, h(b.value.graph.nodes, (e) => (p(), n(
|
|
2353
|
+
(p(!0), i(e, null, h(b.value.graph.nodes, (e) => (p(), n(Pt, {
|
|
2245
2354
|
key: e.id,
|
|
2246
2355
|
node: e,
|
|
2247
2356
|
map: b.value,
|
|
2248
2357
|
zoom: R.value,
|
|
2249
|
-
"io-widgets":
|
|
2250
|
-
"io-results":
|
|
2251
|
-
selected:
|
|
2252
|
-
"selected-ids":
|
|
2253
|
-
error:
|
|
2254
|
-
onConnectStart:
|
|
2255
|
-
onSelect:
|
|
2256
|
-
onDrillIn:
|
|
2358
|
+
"io-widgets": O.value,
|
|
2359
|
+
"io-results": M.value,
|
|
2360
|
+
selected: B.value.includes(e.id),
|
|
2361
|
+
"selected-ids": ie.value,
|
|
2362
|
+
error: N.value[e.id],
|
|
2363
|
+
onConnectStart: Ee,
|
|
2364
|
+
onSelect: le,
|
|
2365
|
+
onDrillIn: A
|
|
2257
2366
|
}, null, 8, [
|
|
2258
2367
|
"node",
|
|
2259
2368
|
"map",
|
|
@@ -2265,25 +2374,25 @@ var Sn = ["title"], Cn = { class: "picker-body" }, wn = { class: "list" }, Tn =
|
|
|
2265
2374
|
"error"
|
|
2266
2375
|
]))), 128))
|
|
2267
2376
|
], 4),
|
|
2268
|
-
|
|
2377
|
+
q.value ? (p(), n(Wn, {
|
|
2269
2378
|
key: 0,
|
|
2270
2379
|
map: b.value,
|
|
2271
|
-
screen:
|
|
2272
|
-
onSelect:
|
|
2380
|
+
screen: q.value.screen,
|
|
2381
|
+
onSelect: ve,
|
|
2273
2382
|
onAddComposite: ye,
|
|
2274
|
-
onClose: s[2] ||= (e) =>
|
|
2383
|
+
onClose: s[2] ||= (e) => q.value = null
|
|
2275
2384
|
}, null, 8, ["map", "screen"])) : r("", !0)
|
|
2276
2385
|
], 34));
|
|
2277
2386
|
}
|
|
2278
|
-
}), [["__scopeId", "data-v-
|
|
2387
|
+
}), [["__scopeId", "data-v-0d57969f"]]);
|
|
2279
2388
|
//#endregion
|
|
2280
2389
|
//#region src/components/types/registerDefaultTypeWidgets.ts
|
|
2281
|
-
function
|
|
2282
|
-
|
|
2390
|
+
function Qn() {
|
|
2391
|
+
ut("number", et), ut("string", $);
|
|
2283
2392
|
}
|
|
2284
2393
|
//#endregion
|
|
2285
2394
|
//#region src/store/graph/createNodeMap.ts
|
|
2286
|
-
function
|
|
2395
|
+
function $n(e = {}) {
|
|
2287
2396
|
let t = {
|
|
2288
2397
|
graph: e.graph ?? {
|
|
2289
2398
|
nodes: [],
|
|
@@ -2292,116 +2401,116 @@ function Gn(e = {}) {
|
|
|
2292
2401
|
types: {},
|
|
2293
2402
|
nodeTypes: {},
|
|
2294
2403
|
extensions: e.extensions ? [...e.extensions] : [],
|
|
2295
|
-
graphInterface: R(e.graphInterface ??
|
|
2404
|
+
graphInterface: R(e.graphInterface ?? M),
|
|
2296
2405
|
registrationMeta: {
|
|
2297
2406
|
types: {},
|
|
2298
2407
|
nodeTypes: {}
|
|
2299
2408
|
},
|
|
2300
2409
|
loadPack: () => []
|
|
2301
2410
|
};
|
|
2302
|
-
return e.types &&
|
|
2411
|
+
return e.types && te(t, e.types), e.nodeTypes && P(t, e.nodeTypes), V(t, t.graphInterface), se(t), t;
|
|
2303
2412
|
}
|
|
2304
2413
|
//#endregion
|
|
2305
2414
|
//#region src/store/packs/installPack.ts
|
|
2306
|
-
function
|
|
2415
|
+
function er(e, t) {
|
|
2307
2416
|
return t ?? e.priority ?? 0;
|
|
2308
2417
|
}
|
|
2309
|
-
function
|
|
2418
|
+
function tr(e, t) {
|
|
2310
2419
|
return e.registrationMeta.types[t]?.priority ?? 0;
|
|
2311
2420
|
}
|
|
2312
|
-
function
|
|
2421
|
+
function nr(e, t) {
|
|
2313
2422
|
return e.registrationMeta.types[t]?.packId ?? "unknown";
|
|
2314
2423
|
}
|
|
2315
|
-
function
|
|
2424
|
+
function rr(e, t) {
|
|
2316
2425
|
return e.registrationMeta.nodeTypes[t]?.priority ?? 0;
|
|
2317
2426
|
}
|
|
2318
|
-
function
|
|
2427
|
+
function ir(e, t) {
|
|
2319
2428
|
return e.registrationMeta.nodeTypes[t]?.packId ?? "unknown";
|
|
2320
2429
|
}
|
|
2321
|
-
function
|
|
2430
|
+
function ar(e, t, n, r, i) {
|
|
2322
2431
|
if (!e.types[r]) return e.types[r] = i, e.registrationMeta.types[r] = {
|
|
2323
2432
|
packId: t,
|
|
2324
2433
|
priority: n
|
|
2325
2434
|
}, null;
|
|
2326
|
-
let a =
|
|
2435
|
+
let a = tr(e, r);
|
|
2327
2436
|
return n > a ? (e.types[r] = i, e.registrationMeta.types[r] = {
|
|
2328
2437
|
packId: t,
|
|
2329
2438
|
priority: n
|
|
2330
|
-
}, null) : n < a ? null : `type "${r}" already registered by pack "${
|
|
2439
|
+
}, null) : n < a ? null : `type "${r}" already registered by pack "${nr(e, r)}" with priority ${a}`;
|
|
2331
2440
|
}
|
|
2332
|
-
function
|
|
2333
|
-
if (!e.nodeTypes[r]) return e.nodeTypes[r] =
|
|
2441
|
+
function or(e, t, n, r, i) {
|
|
2442
|
+
if (!e.nodeTypes[r]) return e.nodeTypes[r] = N(i), e.registrationMeta.nodeTypes[r] = {
|
|
2334
2443
|
packId: t,
|
|
2335
2444
|
priority: n
|
|
2336
2445
|
}, null;
|
|
2337
|
-
let a =
|
|
2338
|
-
return n > a ? (e.nodeTypes[r] =
|
|
2446
|
+
let a = rr(e, r);
|
|
2447
|
+
return n > a ? (e.nodeTypes[r] = N(i), e.registrationMeta.nodeTypes[r] = {
|
|
2339
2448
|
packId: t,
|
|
2340
2449
|
priority: n
|
|
2341
|
-
}, null) : n < a ? null : `node type "${r}" already registered by pack "${
|
|
2450
|
+
}, null) : n < a ? null : `node type "${r}" already registered by pack "${ir(e, r)}" with priority ${a}`;
|
|
2342
2451
|
}
|
|
2343
|
-
function
|
|
2452
|
+
function sr(e, t, n) {
|
|
2344
2453
|
if (e.extensions.includes(t.id)) return [];
|
|
2345
2454
|
let r = [];
|
|
2346
2455
|
if (t.types) for (let [n, i] of Object.entries(t.types)) {
|
|
2347
|
-
let a =
|
|
2456
|
+
let a = ar(e, t.id, er(t, i.priority), n, i);
|
|
2348
2457
|
a && r.push(a);
|
|
2349
2458
|
}
|
|
2350
2459
|
if (t.nodeTypes) for (let [n, i] of Object.entries(t.nodeTypes)) {
|
|
2351
|
-
let a =
|
|
2460
|
+
let a = or(e, t.id, er(t, i.priority), n, i);
|
|
2352
2461
|
a && r.push(a);
|
|
2353
2462
|
}
|
|
2354
2463
|
return r.length ? r : (F(e, t), n && t.setup?.(n), []);
|
|
2355
2464
|
}
|
|
2356
2465
|
//#endregion
|
|
2357
2466
|
//#region src/vue/attachLoadPack.ts
|
|
2358
|
-
function
|
|
2467
|
+
function cr() {
|
|
2359
2468
|
return {
|
|
2360
|
-
registerTypeWidget:
|
|
2361
|
-
registerComponentWidget:
|
|
2469
|
+
registerTypeWidget: ut,
|
|
2470
|
+
registerComponentWidget: dt
|
|
2362
2471
|
};
|
|
2363
2472
|
}
|
|
2364
|
-
function
|
|
2365
|
-
e.loadPack = (t) =>
|
|
2473
|
+
function lr(e) {
|
|
2474
|
+
e.loadPack = (t) => sr(e, t, cr());
|
|
2366
2475
|
}
|
|
2367
2476
|
//#endregion
|
|
2368
2477
|
//#region src/vue/createNodeMap.ts
|
|
2369
|
-
var
|
|
2370
|
-
function
|
|
2371
|
-
|
|
2372
|
-
let t =
|
|
2373
|
-
|
|
2478
|
+
var ur = !1;
|
|
2479
|
+
function dr(e = {}) {
|
|
2480
|
+
ur ||= (Qn(), !0);
|
|
2481
|
+
let t = $n(e);
|
|
2482
|
+
lr(t);
|
|
2374
2483
|
for (let n of e.packs ?? []) t.loadPack(n);
|
|
2375
2484
|
return t;
|
|
2376
2485
|
}
|
|
2377
2486
|
//#endregion
|
|
2378
2487
|
//#region src/store/graph/validateGraphTypes.ts
|
|
2379
|
-
function
|
|
2380
|
-
for (let a of
|
|
2488
|
+
function fr(e, t, n, r, i) {
|
|
2489
|
+
for (let a of ve(n)) e.types[a] || i.push(`node "${t.label ?? t.typeId}" (${t.id}): unknown ${r} port type "${a}" on port "${n.name}"`);
|
|
2381
2490
|
}
|
|
2382
|
-
function
|
|
2491
|
+
function pr(e, t, n) {
|
|
2383
2492
|
e.nodeTypes[t.typeId] || n.push(`node "${t.label ?? t.id}": unknown typeId "${t.typeId}"`);
|
|
2384
|
-
for (let r of Object.values(t.inputs))
|
|
2385
|
-
for (let r of Object.values(t.outputs))
|
|
2386
|
-
t.composite?.graph &&
|
|
2493
|
+
for (let r of Object.values(t.inputs)) fr(e, t, r, "input", n);
|
|
2494
|
+
for (let r of Object.values(t.outputs)) fr(e, t, r, "output", n);
|
|
2495
|
+
t.composite?.graph && mr(e, t.composite.graph, n);
|
|
2387
2496
|
}
|
|
2388
|
-
function
|
|
2389
|
-
for (let r of t.nodes)
|
|
2497
|
+
function mr(e, t, n = []) {
|
|
2498
|
+
for (let r of t.nodes) pr(e, r, n);
|
|
2390
2499
|
return n;
|
|
2391
2500
|
}
|
|
2392
2501
|
//#endregion
|
|
2393
2502
|
//#region src/store/graph/document.ts
|
|
2394
|
-
function
|
|
2503
|
+
function hr(e) {
|
|
2395
2504
|
return {
|
|
2396
2505
|
graph: R(e.graph),
|
|
2397
2506
|
interface: R(e.graphInterface),
|
|
2398
2507
|
extensions: e.extensions.length ? [...e.extensions] : void 0
|
|
2399
2508
|
};
|
|
2400
2509
|
}
|
|
2401
|
-
function
|
|
2402
|
-
return
|
|
2510
|
+
function gr(e) {
|
|
2511
|
+
return hr(e);
|
|
2403
2512
|
}
|
|
2404
|
-
function
|
|
2513
|
+
function _r(e) {
|
|
2405
2514
|
let t;
|
|
2406
2515
|
try {
|
|
2407
2516
|
t = JSON.parse(e);
|
|
@@ -2417,26 +2526,26 @@ function lr(e) {
|
|
|
2417
2526
|
if (n.extensions !== void 0 && (!Array.isArray(n.extensions) || n.extensions.some((e) => typeof e != "string"))) throw Error("extensions must be an array of strings");
|
|
2418
2527
|
return n;
|
|
2419
2528
|
}
|
|
2420
|
-
function
|
|
2529
|
+
function vr(e, t) {
|
|
2421
2530
|
return t?.length ? t.filter((t) => !e.extensions.includes(t)).map((e) => `missing pack "${e}" (call map.loadPack() before import)`) : [];
|
|
2422
2531
|
}
|
|
2423
|
-
function
|
|
2532
|
+
function yr(e, t) {
|
|
2424
2533
|
let n = [];
|
|
2425
|
-
return n.push(...
|
|
2534
|
+
return n.push(...vr(e, t.extensions)), n.push(...le({
|
|
2426
2535
|
...e,
|
|
2427
2536
|
graph: t.graph
|
|
2428
|
-
})), n.push(...
|
|
2537
|
+
})), n.push(...re(e, t.interface)), n.push(...mr(e, t.graph)), n;
|
|
2429
2538
|
}
|
|
2430
|
-
function
|
|
2431
|
-
let n =
|
|
2432
|
-
return n.length ? n : (e.graph = R(t.graph), e.graphInterface = R(t.interface),
|
|
2539
|
+
function br(e, t) {
|
|
2540
|
+
let n = vr(e, t.extensions);
|
|
2541
|
+
return n.length ? n : (e.graph = R(t.graph), e.graphInterface = R(t.interface), V(e, e.graphInterface), se(e), n.push(...yr(e, t)), n);
|
|
2433
2542
|
}
|
|
2434
|
-
function
|
|
2435
|
-
return
|
|
2543
|
+
function xr(e, t) {
|
|
2544
|
+
return br(e, t);
|
|
2436
2545
|
}
|
|
2437
2546
|
//#endregion
|
|
2438
2547
|
//#region src/store/registry/defineType.ts
|
|
2439
|
-
function
|
|
2548
|
+
function Sr(e) {
|
|
2440
2549
|
if (e.widgets) {
|
|
2441
2550
|
let t = Object.keys(e.widgets), n = e.defaultWidget ?? (t.length === 1 ? t[0] : "default");
|
|
2442
2551
|
return {
|
|
@@ -2451,11 +2560,11 @@ function mr(e) {
|
|
|
2451
2560
|
widget: e.widget
|
|
2452
2561
|
} : {};
|
|
2453
2562
|
}
|
|
2454
|
-
function
|
|
2455
|
-
let t =
|
|
2563
|
+
function Cr(e) {
|
|
2564
|
+
let t = Sr(e), n = t.widget, r = Er(n);
|
|
2456
2565
|
return {
|
|
2457
2566
|
id: e.id,
|
|
2458
|
-
label: e.label ??
|
|
2567
|
+
label: e.label ?? wr(e.id),
|
|
2459
2568
|
color: e.color ?? "#888",
|
|
2460
2569
|
validate: e.validate,
|
|
2461
2570
|
accepts: e.accepts,
|
|
@@ -2467,14 +2576,14 @@ function hr(e) {
|
|
|
2467
2576
|
coerce: e.coerce ?? r.coerce
|
|
2468
2577
|
};
|
|
2469
2578
|
}
|
|
2470
|
-
function
|
|
2579
|
+
function wr(e) {
|
|
2471
2580
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
2472
2581
|
}
|
|
2473
|
-
function
|
|
2582
|
+
function Tr(e, t, n) {
|
|
2474
2583
|
let r = Number(e);
|
|
2475
2584
|
return Number.isNaN(r) && (r = 0), t !== void 0 && (r = Math.max(t, r)), n !== void 0 && (r = Math.min(n, r)), r;
|
|
2476
2585
|
}
|
|
2477
|
-
function
|
|
2586
|
+
function Er(e) {
|
|
2478
2587
|
if (!e) return {
|
|
2479
2588
|
parse: (e) => e,
|
|
2480
2589
|
format: (e) => e == null ? "" : String(e)
|
|
@@ -2483,14 +2592,15 @@ function vr(e) {
|
|
|
2483
2592
|
case "number": return {
|
|
2484
2593
|
parse: (e) => Number(e),
|
|
2485
2594
|
format: (e) => e == null ? "" : String(e),
|
|
2486
|
-
coerce: (t) =>
|
|
2595
|
+
coerce: (t) => Tr(t, e.min, e.max)
|
|
2487
2596
|
};
|
|
2488
2597
|
case "text": return {
|
|
2489
2598
|
parse: (e) => e,
|
|
2490
2599
|
format: (e) => e == null ? "" : String(e)
|
|
2491
2600
|
};
|
|
2492
2601
|
case "custom": return { format: (e) => e == null ? "" : String(e) };
|
|
2602
|
+
case "none": return { format: (e) => e == null ? "" : String(e) };
|
|
2493
2603
|
}
|
|
2494
2604
|
}
|
|
2495
2605
|
//#endregion
|
|
2496
|
-
export {
|
|
2606
|
+
export { z as INPUT_TYPE, Zn as NodeViewer, B as OUTPUT_TYPE, br as applyDocument, xe as assignable, oe as boundaryNodes, Ie as buildClipboard, dr as createNodeMap, Cr as defineType, gr as exportGraph, xr as importGraph, L as instantiate, J as isConnectionOnly, ye as isUnionPort, _r as parseGraphDocument, Le as pasteClipboard, Se as portAccepts, ve as portTypes, dt as registerComponentWidget, Qn as registerDefaultTypeWidgets, ut as registerTypeWidget, be as runGraph, hr as serializeDocument, yr as validateDocument };
|