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