@nodish/core 0.2.0 → 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/LICENSE +661 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +74 -14
- package/dist/index.js +732 -625
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -16,43 +16,45 @@ function D(e) {
|
|
|
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
52
|
let r = E(n, D(t));
|
|
51
|
-
t.inputs =
|
|
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 j(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 L(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 } = E(e,
|
|
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 V = "io/input", H = "io/output", ne = {
|
|
|
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 re(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 re(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 G(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
|
|
293
|
-
//#region src/store/graph/
|
|
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
|
+
}
|
|
294
306
|
function K(e) {
|
|
307
|
+
return ge(e);
|
|
308
|
+
}
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/store/graph/evaluate.ts
|
|
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 he(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 he(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 he(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 he(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 he(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 _e(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) ?? [];
|
|
@@ -396,16 +417,16 @@ function ve(e, t) {
|
|
|
396
417
|
}
|
|
397
418
|
return [...r];
|
|
398
419
|
}
|
|
399
|
-
function
|
|
400
|
-
return
|
|
420
|
+
function J(e, t, n) {
|
|
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 ||
|
|
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 be(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 Te(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 J(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,47 +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
|
|
553
|
-
|
|
554
|
-
|
|
573
|
+
function Z(e, t) {
|
|
574
|
+
if (!(!e || e.id !== t.type)) return e;
|
|
575
|
+
}
|
|
576
|
+
function Ve(e, t) {
|
|
577
|
+
let n = t.widgetId ?? e.defaultWidget ?? "default";
|
|
578
|
+
return e.widgets?.[n] || (e.widgets?.default ? e.widgets.default : e.widget);
|
|
579
|
+
}
|
|
580
|
+
function He(e, t) {
|
|
581
|
+
let n = Z(e, t), r = n ? Ve(n, t) : void 0, i = t.customProps;
|
|
582
|
+
if (!(!r && !i)) return r ? r.kind === "number" ? {
|
|
555
583
|
kind: "number",
|
|
556
|
-
min: X(
|
|
557
|
-
max: X(
|
|
558
|
-
step: X(
|
|
559
|
-
rowHeight: X(
|
|
560
|
-
} :
|
|
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" ? {
|
|
561
589
|
kind: "text",
|
|
562
|
-
rows: X(
|
|
563
|
-
rowHeight: X(
|
|
590
|
+
rows: X(i, "rows") ?? r.rows,
|
|
591
|
+
rowHeight: X(i, "rowHeight") ?? r.rowHeight
|
|
564
592
|
} : {
|
|
565
593
|
kind: "custom",
|
|
566
|
-
componentId:
|
|
567
|
-
rowHeight: X(
|
|
568
|
-
} :
|
|
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 ? {
|
|
569
597
|
kind: "number",
|
|
570
|
-
min: X(
|
|
571
|
-
max: X(
|
|
572
|
-
step: X(
|
|
573
|
-
rowHeight: X(
|
|
574
|
-
} : 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 ? {
|
|
575
603
|
kind: "text",
|
|
576
|
-
rows: X(
|
|
577
|
-
rowHeight: X(
|
|
604
|
+
rows: X(i, "rows"),
|
|
605
|
+
rowHeight: X(i, "rowHeight")
|
|
578
606
|
} : void 0;
|
|
579
607
|
}
|
|
580
|
-
function
|
|
608
|
+
function Ue(e, t) {
|
|
581
609
|
return e ? e.rowHeight === void 0 ? e.kind === "text" ? (e.rows ?? 1) * t : t : e.rowHeight : t;
|
|
582
610
|
}
|
|
583
611
|
//#endregion
|
|
584
612
|
//#region src/components/types/NumberWidget.vue?vue&type=script&setup=true&lang.ts
|
|
585
|
-
var
|
|
613
|
+
var We = [
|
|
586
614
|
"value",
|
|
587
615
|
"placeholder",
|
|
588
616
|
"title",
|
|
589
617
|
"min",
|
|
590
618
|
"max",
|
|
591
619
|
"step"
|
|
592
|
-
],
|
|
620
|
+
], Ge = /*@__PURE__*/ s({
|
|
593
621
|
__name: "NumberWidget",
|
|
594
622
|
props: {
|
|
595
623
|
port: {},
|
|
@@ -628,13 +656,13 @@ var ze = [
|
|
|
628
656
|
onInput: c,
|
|
629
657
|
onChange: l,
|
|
630
658
|
onPointerdown: n[0] ||= w(() => {}, ["stop"])
|
|
631
|
-
}, null, 40,
|
|
659
|
+
}, null, 40, We));
|
|
632
660
|
}
|
|
633
|
-
}),
|
|
661
|
+
}), Q = (e, t) => {
|
|
634
662
|
let n = e.__vccOpts || e;
|
|
635
663
|
for (let [e, r] of t) n[e] = r;
|
|
636
664
|
return n;
|
|
637
|
-
},
|
|
665
|
+
}, Ke = /*#__PURE__*/ Q(Ge, [["__scopeId", "data-v-4459e34d"]]), qe = ["title"], Je = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
638
666
|
__name: "ReadonlyWidget",
|
|
639
667
|
props: {
|
|
640
668
|
port: {},
|
|
@@ -650,18 +678,18 @@ var ze = [
|
|
|
650
678
|
return (t, n) => (p(), i("span", {
|
|
651
679
|
class: "field readonly",
|
|
652
680
|
title: e.port.name
|
|
653
|
-
}, v(r.value), 9,
|
|
681
|
+
}, v(r.value), 9, qe));
|
|
654
682
|
}
|
|
655
|
-
}), [["__scopeId", "data-v-0d93d0ea"]]),
|
|
683
|
+
}), [["__scopeId", "data-v-0d93d0ea"]]), Ye = [
|
|
656
684
|
"value",
|
|
657
685
|
"placeholder",
|
|
658
686
|
"title",
|
|
659
687
|
"rows"
|
|
660
|
-
],
|
|
688
|
+
], Xe = [
|
|
661
689
|
"value",
|
|
662
690
|
"placeholder",
|
|
663
691
|
"title"
|
|
664
|
-
], $ = /*#__PURE__*/
|
|
692
|
+
], $ = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
665
693
|
__name: "TextWidget",
|
|
666
694
|
props: {
|
|
667
695
|
port: {},
|
|
@@ -692,7 +720,7 @@ var ze = [
|
|
|
692
720
|
onInput: l,
|
|
693
721
|
onChange: u,
|
|
694
722
|
onPointerdown: n[0] ||= w(() => {}, ["stop"])
|
|
695
|
-
}, null, 40,
|
|
723
|
+
}, null, 40, Ye)) : (p(), i("input", {
|
|
696
724
|
key: 1,
|
|
697
725
|
class: "field",
|
|
698
726
|
type: "text",
|
|
@@ -702,25 +730,38 @@ var ze = [
|
|
|
702
730
|
onInput: l,
|
|
703
731
|
onChange: u,
|
|
704
732
|
onPointerdown: n[1] ||= w(() => {}, ["stop"])
|
|
705
|
-
}, null, 40,
|
|
733
|
+
}, null, 40, Xe));
|
|
706
734
|
}
|
|
707
|
-
}), [["__scopeId", "data-v-bf7ff881"]]),
|
|
708
|
-
number:
|
|
735
|
+
}), [["__scopeId", "data-v-bf7ff881"]]), Ze = /* @__PURE__ */ new Map(), Qe = /* @__PURE__ */ new Map(), $e = {
|
|
736
|
+
number: Ke,
|
|
709
737
|
text: $,
|
|
710
738
|
custom: $
|
|
711
739
|
};
|
|
712
|
-
function
|
|
713
|
-
|
|
740
|
+
function et(e) {
|
|
741
|
+
let t = Ze.get(e);
|
|
742
|
+
return t || (t = /* @__PURE__ */ new Map(), Ze.set(e, t)), t;
|
|
714
743
|
}
|
|
715
|
-
function
|
|
716
|
-
|
|
744
|
+
function tt(e, t) {
|
|
745
|
+
return t?.widgetId ?? e?.defaultWidget ?? "default";
|
|
717
746
|
}
|
|
718
|
-
function
|
|
719
|
-
|
|
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);
|
|
753
|
+
}
|
|
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] ?? $ : $;
|
|
720
761
|
}
|
|
721
762
|
//#endregion
|
|
722
763
|
//#region src/components/types/PortValueWidget.vue
|
|
723
|
-
var
|
|
764
|
+
var at = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
724
765
|
__name: "PortValueWidget",
|
|
725
766
|
props: {
|
|
726
767
|
port: {},
|
|
@@ -731,17 +772,21 @@ var Ze = /*#__PURE__*/ Z(/* @__PURE__ */ s({
|
|
|
731
772
|
placeholder: {}
|
|
732
773
|
},
|
|
733
774
|
emits: ["update:value", "commit"],
|
|
734
|
-
setup(e, { emit:
|
|
735
|
-
let
|
|
736
|
-
|
|
775
|
+
setup(e, { emit: r }) {
|
|
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"}`;
|
|
779
|
+
});
|
|
780
|
+
return (t, r) => (p(), n(_(s.value), {
|
|
781
|
+
key: c.value,
|
|
737
782
|
class: "field-widget",
|
|
738
783
|
port: e.port,
|
|
739
784
|
"type-def": e.typeDef,
|
|
740
|
-
"effective-widget":
|
|
785
|
+
"effective-widget": o.value,
|
|
741
786
|
"display-value": e.displayValue,
|
|
742
787
|
placeholder: e.placeholder,
|
|
743
|
-
"onUpdate:value": r[0] ||= (e) =>
|
|
744
|
-
onCommit: r[1] ||= (e) =>
|
|
788
|
+
"onUpdate:value": r[0] ||= (e) => a("update:value", e),
|
|
789
|
+
onCommit: r[1] ||= (e) => a("commit")
|
|
745
790
|
}, null, 40, [
|
|
746
791
|
"port",
|
|
747
792
|
"type-def",
|
|
@@ -750,48 +795,48 @@ var Ze = /*#__PURE__*/ Z(/* @__PURE__ */ s({
|
|
|
750
795
|
"placeholder"
|
|
751
796
|
]));
|
|
752
797
|
}
|
|
753
|
-
}), [["__scopeId", "data-v-
|
|
754
|
-
function
|
|
798
|
+
}), [["__scopeId", "data-v-b4dc9bc0"]]);
|
|
799
|
+
function ot(e) {
|
|
755
800
|
return Math.max(20, Math.min(240, e));
|
|
756
801
|
}
|
|
757
|
-
function
|
|
802
|
+
function st(e, t) {
|
|
758
803
|
let n = e.customProps?.rowHeight;
|
|
759
|
-
return
|
|
804
|
+
return ot(typeof n == "number" && n > 0 ? n : Ue(He(t, e), 20));
|
|
760
805
|
}
|
|
761
|
-
function
|
|
806
|
+
function ct(e, t) {
|
|
762
807
|
let n = 0;
|
|
763
|
-
for (let r of e) n +=
|
|
808
|
+
for (let r of e) n += st(r, t?.(r));
|
|
764
809
|
return n;
|
|
765
810
|
}
|
|
766
|
-
function
|
|
811
|
+
function lt(e) {
|
|
767
812
|
return e.width ?? 100;
|
|
768
813
|
}
|
|
769
|
-
function
|
|
770
|
-
let n =
|
|
814
|
+
function ut(e, t) {
|
|
815
|
+
let n = ct(Object.values(e.inputs), t), r = ct(Object.values(e.outputs), t);
|
|
771
816
|
return 20 + Math.max(n, r);
|
|
772
817
|
}
|
|
773
|
-
function
|
|
818
|
+
function dt(e, t, n) {
|
|
774
819
|
let r = 20;
|
|
775
820
|
for (let i of e) {
|
|
776
|
-
let e =
|
|
821
|
+
let e = st(i, n?.(i));
|
|
777
822
|
if (i.id === t) return r + e / 2;
|
|
778
823
|
r += e;
|
|
779
824
|
}
|
|
780
825
|
return null;
|
|
781
826
|
}
|
|
782
|
-
function
|
|
783
|
-
let r =
|
|
827
|
+
function ft(e, t, n) {
|
|
828
|
+
let r = dt(Object.values(e.inputs), t, n);
|
|
784
829
|
if (r !== null) return {
|
|
785
830
|
x: e.location.x,
|
|
786
831
|
y: e.location.y + r
|
|
787
832
|
};
|
|
788
|
-
let i =
|
|
833
|
+
let i = dt(Object.values(e.outputs), t, n);
|
|
789
834
|
return i === null ? null : {
|
|
790
|
-
x: e.location.x +
|
|
835
|
+
x: e.location.x + lt(e),
|
|
791
836
|
y: e.location.y + i
|
|
792
837
|
};
|
|
793
838
|
}
|
|
794
|
-
function
|
|
839
|
+
function pt(e, t) {
|
|
795
840
|
let n = Math.max(40, Math.abs(t.x - e.x) * .5);
|
|
796
841
|
return [{
|
|
797
842
|
x: e.x + n,
|
|
@@ -801,12 +846,12 @@ function at(e, t) {
|
|
|
801
846
|
y: t.y
|
|
802
847
|
}];
|
|
803
848
|
}
|
|
804
|
-
function
|
|
805
|
-
let [n, r] =
|
|
849
|
+
function mt(e, t) {
|
|
850
|
+
let [n, r] = pt(e, t);
|
|
806
851
|
return `M ${e.x} ${e.y} C ${n.x} ${n.y}, ${r.x} ${r.y}, ${t.x} ${t.y}`;
|
|
807
852
|
}
|
|
808
|
-
function
|
|
809
|
-
let [r, i] =
|
|
853
|
+
function ht(e, t, n = 16) {
|
|
854
|
+
let [r, i] = pt(e, t), a = [];
|
|
810
855
|
for (let o = 0; o <= n; o++) {
|
|
811
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;
|
|
812
857
|
a.push({
|
|
@@ -816,7 +861,7 @@ function st(e, t, n = 16) {
|
|
|
816
861
|
}
|
|
817
862
|
return a;
|
|
818
863
|
}
|
|
819
|
-
function
|
|
864
|
+
function gt(e, t, n, r) {
|
|
820
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;
|
|
821
866
|
if (c === 0) return !1;
|
|
822
867
|
let l = n.x - e.x, u = n.y - e.y, d = (l * s - u * o) / c, f = (l * a - u * i) / c;
|
|
@@ -824,10 +869,10 @@ function ct(e, t, n, r) {
|
|
|
824
869
|
}
|
|
825
870
|
//#endregion
|
|
826
871
|
//#region src/components/NodePort.vue?vue&type=script&setup=true&lang.ts
|
|
827
|
-
var
|
|
872
|
+
var _t = ["title"], vt = {
|
|
828
873
|
key: 2,
|
|
829
874
|
class: "label"
|
|
830
|
-
},
|
|
875
|
+
}, yt = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
831
876
|
__name: "NodePort",
|
|
832
877
|
props: {
|
|
833
878
|
port: {},
|
|
@@ -843,15 +888,15 @@ var lt = ["title"], ut = {
|
|
|
843
888
|
},
|
|
844
889
|
emits: ["connectStart", "valueChange"],
|
|
845
890
|
setup(e, { emit: a }) {
|
|
846
|
-
b((e) => ({
|
|
891
|
+
b((e) => ({ v4929e218: o }));
|
|
847
892
|
let o = "11px", s = e, c = a;
|
|
848
893
|
function d(e) {
|
|
849
894
|
e.button === 0 && c("connectStart", s.port, e);
|
|
850
895
|
}
|
|
851
|
-
let f = t(() =>
|
|
896
|
+
let f = t(() => st(s.port, s.typeDef)), m = t(() => He(s.typeDef, s.port)), h = t(() => {
|
|
852
897
|
let e = s.typeDef?.label ?? s.port.type;
|
|
853
898
|
return `${s.port.name} (${e})`;
|
|
854
|
-
}), 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), ee = t(() => _.value ? "readonly" : "editable");
|
|
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");
|
|
855
900
|
function S(e) {
|
|
856
901
|
s.port.value = e, c("valueChange", s.port);
|
|
857
902
|
}
|
|
@@ -871,9 +916,9 @@ var lt = ["title"], ut = {
|
|
|
871
916
|
style: u({ background: e.color }),
|
|
872
917
|
title: e.port.multi ? `${e.port.name} (accepts many)` : e.port.name,
|
|
873
918
|
onPointerdown: w(d, ["stop"])
|
|
874
|
-
}, null, 46,
|
|
875
|
-
x.value ? (p(), n(
|
|
876
|
-
key:
|
|
919
|
+
}, null, 46, _t)) : r("", !0),
|
|
920
|
+
x.value ? (p(), n(at, {
|
|
921
|
+
key: `${e.port.id}-${e.port.type}`,
|
|
877
922
|
port: e.port,
|
|
878
923
|
"type-def": e.typeDef,
|
|
879
924
|
"effective-widget": m.value,
|
|
@@ -889,7 +934,7 @@ var lt = ["title"], ut = {
|
|
|
889
934
|
"mode",
|
|
890
935
|
"display-value",
|
|
891
936
|
"placeholder"
|
|
892
|
-
])) : (p(), i("span",
|
|
937
|
+
])) : (p(), i("span", vt, v(e.port.name), 1)),
|
|
893
938
|
e.side === "out" ? (p(), i("span", {
|
|
894
939
|
key: 3,
|
|
895
940
|
class: "socket",
|
|
@@ -898,13 +943,13 @@ var lt = ["title"], ut = {
|
|
|
898
943
|
}, null, 36)) : r("", !0)
|
|
899
944
|
], 6));
|
|
900
945
|
}
|
|
901
|
-
}), [["__scopeId", "data-v-
|
|
946
|
+
}), [["__scopeId", "data-v-cadec420"]]), bt = ["title"], xt = { class: "title" }, St = {
|
|
902
947
|
class: "grip",
|
|
903
948
|
title: "Drag"
|
|
904
|
-
},
|
|
949
|
+
}, Ct = { class: "body" }, wt = {
|
|
905
950
|
key: 0,
|
|
906
951
|
class: "col input"
|
|
907
|
-
},
|
|
952
|
+
}, Tt = 4, Et = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
908
953
|
__name: "GraphNode",
|
|
909
954
|
props: {
|
|
910
955
|
node: {},
|
|
@@ -929,8 +974,8 @@ var lt = ["title"], ut = {
|
|
|
929
974
|
],
|
|
930
975
|
setup(o, { emit: s }) {
|
|
931
976
|
b((e) => ({
|
|
932
|
-
|
|
933
|
-
|
|
977
|
+
v8ff1e59c: d,
|
|
978
|
+
v5f589aae: f
|
|
934
979
|
}));
|
|
935
980
|
let d = "11px", f = "6px", m = o, g = s;
|
|
936
981
|
function _(e, t) {
|
|
@@ -940,36 +985,36 @@ var lt = ["title"], ut = {
|
|
|
940
985
|
}, e, t);
|
|
941
986
|
}
|
|
942
987
|
function x(e) {
|
|
943
|
-
e.userOnly &&
|
|
988
|
+
e.userOnly && k(m.map, m.node);
|
|
944
989
|
}
|
|
945
990
|
function ee(e) {
|
|
946
|
-
e.stopPropagation(),
|
|
991
|
+
e.stopPropagation(), he(m.node) && g("drillIn", m.node.id);
|
|
947
992
|
}
|
|
948
993
|
function S(e) {
|
|
949
994
|
e.button === 0 && (e.stopPropagation(), g("select", m.node.id, e.shiftKey));
|
|
950
995
|
}
|
|
951
|
-
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(() =>
|
|
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(() => {
|
|
952
997
|
let e = /* @__PURE__ */ new Set();
|
|
953
998
|
for (let t of m.map.graph.connections) t.to.node === m.node.id && e.add(t.to.port);
|
|
954
999
|
return e;
|
|
955
1000
|
});
|
|
956
|
-
function
|
|
1001
|
+
function j(e) {
|
|
957
1002
|
return m.map.types[e]?.color ?? "#888";
|
|
958
1003
|
}
|
|
959
|
-
function
|
|
1004
|
+
function M(e) {
|
|
960
1005
|
return m.map.types[e.type];
|
|
961
1006
|
}
|
|
962
|
-
let
|
|
963
|
-
function
|
|
1007
|
+
let N = (e) => m.map.types[e.type], P = t(() => ut(m.node, N));
|
|
1008
|
+
function F(e) {
|
|
964
1009
|
return m.ioWidgets ? m.node.typeId === "io/input" && e === "out" ? "editable" : m.node.typeId === "io/output" && e === "in" ? "readonly" : "auto" : "auto";
|
|
965
1010
|
}
|
|
966
|
-
function
|
|
1011
|
+
function I(e) {
|
|
967
1012
|
if (e.button !== 0) return;
|
|
968
1013
|
e.stopPropagation();
|
|
969
1014
|
let t = e.clientX, n = e.clientY, r = e.shiftKey, i = m.zoom, a = !1, o = null;
|
|
970
1015
|
async function s() {
|
|
971
1016
|
!r && !m.selectedIds?.has(m.node.id) && (g("select", m.node.id, !1), await c());
|
|
972
|
-
let e = m.selectedIds ?? new Set([m.node.id]);
|
|
1017
|
+
let e = m.selectedIds ?? /* @__PURE__ */ new Set([m.node.id]);
|
|
973
1018
|
o = (e.size > 1 && e.has(m.node.id) ? m.map.graph.nodes.filter((t) => e.has(t.id)) : [m.node]).map((e) => ({
|
|
974
1019
|
node: e,
|
|
975
1020
|
x: e.location.x,
|
|
@@ -979,7 +1024,7 @@ var lt = ["title"], ut = {
|
|
|
979
1024
|
function l(e) {
|
|
980
1025
|
if (!a) {
|
|
981
1026
|
let r = e.clientX - t, i = e.clientY - n;
|
|
982
|
-
if (Math.hypot(r, i) <
|
|
1027
|
+
if (Math.hypot(r, i) < Tt) return;
|
|
983
1028
|
a = !0, s();
|
|
984
1029
|
return;
|
|
985
1030
|
}
|
|
@@ -1001,7 +1046,7 @@ var lt = ["title"], ut = {
|
|
|
1001
1046
|
left: o.node.location.x + "px",
|
|
1002
1047
|
top: o.node.location.y + "px",
|
|
1003
1048
|
width: E.value + "px",
|
|
1004
|
-
height:
|
|
1049
|
+
height: P.value + "px",
|
|
1005
1050
|
zIndex: o.node.z ?? 0
|
|
1006
1051
|
}),
|
|
1007
1052
|
onPointerdown: S
|
|
@@ -1010,27 +1055,27 @@ var lt = ["title"], ut = {
|
|
|
1010
1055
|
key: 0,
|
|
1011
1056
|
class: "error-ring",
|
|
1012
1057
|
title: o.error
|
|
1013
|
-
}, null, 8,
|
|
1058
|
+
}, null, 8, bt)) : r("", !0),
|
|
1014
1059
|
a("div", {
|
|
1015
1060
|
class: "header",
|
|
1016
1061
|
style: u({
|
|
1017
1062
|
background: T.value,
|
|
1018
1063
|
height: y(20) + "px"
|
|
1019
1064
|
}),
|
|
1020
|
-
onPointerdown:
|
|
1065
|
+
onPointerdown: I,
|
|
1021
1066
|
onDblclick: ee
|
|
1022
|
-
}, [a("span",
|
|
1067
|
+
}, [a("span", xt, v(w.value), 1), a("div", St, [(p(), i(e, null, h(6, (e) => a("span", {
|
|
1023
1068
|
key: e,
|
|
1024
1069
|
class: "dot"
|
|
1025
1070
|
})), 64))])], 36),
|
|
1026
|
-
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, {
|
|
1027
1072
|
key: e.id,
|
|
1028
1073
|
port: e,
|
|
1029
|
-
"type-def":
|
|
1030
|
-
color:
|
|
1074
|
+
"type-def": M(e),
|
|
1075
|
+
color: j(e.type),
|
|
1031
1076
|
side: "in",
|
|
1032
|
-
connected:
|
|
1033
|
-
"widget-mode":
|
|
1077
|
+
connected: A.value.has(e.id),
|
|
1078
|
+
"widget-mode": F("in"),
|
|
1034
1079
|
"display-value": o.ioResults?.[e.name],
|
|
1035
1080
|
onConnectStart: _,
|
|
1036
1081
|
onValueChange: x
|
|
@@ -1041,16 +1086,16 @@ var lt = ["title"], ut = {
|
|
|
1041
1086
|
"connected",
|
|
1042
1087
|
"widget-mode",
|
|
1043
1088
|
"display-value"
|
|
1044
|
-
]))), 128))])) : r("", !0),
|
|
1089
|
+
]))), 128))])) : r("", !0), te.value.length ? (p(), i("div", {
|
|
1045
1090
|
key: 1,
|
|
1046
|
-
class: l(["col output", { wide:
|
|
1047
|
-
}, [(p(!0), i(e, null, h(
|
|
1048
|
-
key: e.id
|
|
1091
|
+
class: l(["col output", { wide: O.value }])
|
|
1092
|
+
}, [(p(!0), i(e, null, h(te.value, (e) => (p(), n(yt, {
|
|
1093
|
+
key: `${e.id}-${e.type}`,
|
|
1049
1094
|
port: e,
|
|
1050
|
-
"type-def":
|
|
1051
|
-
color:
|
|
1095
|
+
"type-def": M(e),
|
|
1096
|
+
color: j(e.type),
|
|
1052
1097
|
side: "out",
|
|
1053
|
-
"widget-mode":
|
|
1098
|
+
"widget-mode": F("out"),
|
|
1054
1099
|
onConnectStart: _
|
|
1055
1100
|
}, null, 8, [
|
|
1056
1101
|
"port",
|
|
@@ -1060,7 +1105,7 @@ var lt = ["title"], ut = {
|
|
|
1060
1105
|
]))), 128))], 2)) : r("", !0)])
|
|
1061
1106
|
], 38));
|
|
1062
1107
|
}
|
|
1063
|
-
}), [["__scopeId", "data-v-
|
|
1108
|
+
}), [["__scopeId", "data-v-24b182cb"]]), Dt = { class: "wires" }, Ot = ["d"], kt = ["d"], At = ["d"], jt = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1064
1109
|
__name: "WireLayer",
|
|
1065
1110
|
props: {
|
|
1066
1111
|
map: {},
|
|
@@ -1075,30 +1120,30 @@ var lt = ["title"], ut = {
|
|
|
1075
1120
|
}), c = t(() => a.map.graph.connections.map((e) => {
|
|
1076
1121
|
let t = s.value[e.from.node], n = s.value[e.to.node];
|
|
1077
1122
|
if (!t || !n) return null;
|
|
1078
|
-
let r =
|
|
1123
|
+
let r = ft(t, e.from.port, o), i = ft(n, e.to.port, o);
|
|
1079
1124
|
return !r || !i ? null : {
|
|
1080
1125
|
id: e.id,
|
|
1081
|
-
d:
|
|
1126
|
+
d: mt(r, i)
|
|
1082
1127
|
};
|
|
1083
1128
|
}).filter((e) => e !== null));
|
|
1084
|
-
return (t, a) => (p(), i("svg",
|
|
1129
|
+
return (t, a) => (p(), i("svg", Dt, [
|
|
1085
1130
|
(p(!0), i(e, null, h(c.value, (e) => (p(), i("path", {
|
|
1086
1131
|
key: e.id,
|
|
1087
1132
|
d: e.d
|
|
1088
|
-
}, null, 8,
|
|
1133
|
+
}, null, 8, Ot))), 128)),
|
|
1089
1134
|
n.pendingPath ? (p(), i("path", {
|
|
1090
1135
|
key: 0,
|
|
1091
1136
|
class: "pending",
|
|
1092
1137
|
d: n.pendingPath
|
|
1093
|
-
}, null, 8,
|
|
1138
|
+
}, null, 8, kt)) : r("", !0),
|
|
1094
1139
|
n.slicePath ? (p(), i("path", {
|
|
1095
1140
|
key: 1,
|
|
1096
1141
|
class: "slice",
|
|
1097
1142
|
d: n.slicePath
|
|
1098
|
-
}, null, 8,
|
|
1143
|
+
}, null, 8, At)) : r("", !0)
|
|
1099
1144
|
]));
|
|
1100
1145
|
}
|
|
1101
|
-
}), [["__scopeId", "data-v-682ffd13"]]),
|
|
1146
|
+
}), [["__scopeId", "data-v-682ffd13"]]), Mt = { class: "inspector-section-header" }, Nt = { class: "inspector-section-title" }, Pt = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1102
1147
|
__name: "InspectorSection",
|
|
1103
1148
|
props: {
|
|
1104
1149
|
title: {},
|
|
@@ -1108,25 +1153,25 @@ var lt = ["title"], ut = {
|
|
|
1108
1153
|
}
|
|
1109
1154
|
},
|
|
1110
1155
|
setup(e) {
|
|
1111
|
-
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));
|
|
1112
1157
|
}
|
|
1113
|
-
}), [["__scopeId", "data-v-5e38007a"]]),
|
|
1158
|
+
}), [["__scopeId", "data-v-5e38007a"]]), Ft = {
|
|
1114
1159
|
key: 0,
|
|
1115
1160
|
class: "iface-grid iface-head",
|
|
1116
1161
|
"aria-hidden": "true"
|
|
1117
|
-
},
|
|
1162
|
+
}, It = {
|
|
1118
1163
|
key: 1,
|
|
1119
1164
|
class: "iface-rows"
|
|
1120
|
-
},
|
|
1165
|
+
}, Lt = { class: "iface-grid iface-row" }, Rt = ["value", "onChange"], zt = ["value", "onChange"], Bt = ["value"], Vt = ["onClick"], Ht = {
|
|
1121
1166
|
key: 0,
|
|
1122
1167
|
class: "iface-default-row"
|
|
1123
|
-
},
|
|
1168
|
+
}, Ut = {
|
|
1124
1169
|
key: 2,
|
|
1125
1170
|
class: "iface-empty"
|
|
1126
|
-
},
|
|
1171
|
+
}, Wt = {
|
|
1127
1172
|
key: 3,
|
|
1128
1173
|
class: "iface-error"
|
|
1129
|
-
},
|
|
1174
|
+
}, Gt = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1130
1175
|
__name: "GraphInterfacePanel",
|
|
1131
1176
|
props: {
|
|
1132
1177
|
graphInterface: {},
|
|
@@ -1137,63 +1182,63 @@ var lt = ["title"], ut = {
|
|
|
1137
1182
|
commitError: {},
|
|
1138
1183
|
applyMutation: { type: Function }
|
|
1139
1184
|
},
|
|
1140
|
-
setup(
|
|
1141
|
-
let
|
|
1142
|
-
let e =
|
|
1185
|
+
setup(o) {
|
|
1186
|
+
let s = o, c = m(""), l = m({}), u = t(() => s.commitError || c.value || ""), d = t(() => s.mode === "parameters" ? "Graph inputs" : "Graph outputs"), f = t(() => s.mode === "parameters"), g = t(() => {
|
|
1187
|
+
let e = f.value ? s.graphInterface.parameters : s.graphInterface.returns;
|
|
1143
1188
|
return Object.entries(e ?? {}).map(([e, t]) => ({
|
|
1144
1189
|
name: e,
|
|
1145
1190
|
spec: t
|
|
1146
1191
|
}));
|
|
1147
1192
|
});
|
|
1148
|
-
function
|
|
1149
|
-
return
|
|
1193
|
+
function _(e) {
|
|
1194
|
+
return s.types[e]?.defaultValue;
|
|
1150
1195
|
}
|
|
1151
|
-
function
|
|
1152
|
-
return t.defaultValue === void 0 ?
|
|
1196
|
+
function y(e, t) {
|
|
1197
|
+
return t.defaultValue === void 0 ? _(t.type) : t.defaultValue;
|
|
1153
1198
|
}
|
|
1154
|
-
function
|
|
1155
|
-
if (!
|
|
1156
|
-
|
|
1199
|
+
function b() {
|
|
1200
|
+
if (!f.value) {
|
|
1201
|
+
l.value = {};
|
|
1157
1202
|
return;
|
|
1158
1203
|
}
|
|
1159
1204
|
let e = {};
|
|
1160
|
-
for (let { name: t, spec: n } of
|
|
1161
|
-
|
|
1162
|
-
}
|
|
1163
|
-
ee(() =>
|
|
1164
|
-
|
|
1165
|
-
}), ee(
|
|
1166
|
-
function
|
|
1167
|
-
|
|
1205
|
+
for (let { name: t, spec: n } of g.value) e[t] = y(t, n);
|
|
1206
|
+
l.value = e;
|
|
1207
|
+
}
|
|
1208
|
+
ee(() => s.revision, () => {
|
|
1209
|
+
c.value = "", b();
|
|
1210
|
+
}), ee(f, b, { immediate: !0 });
|
|
1211
|
+
function x(e) {
|
|
1212
|
+
c.value = "";
|
|
1168
1213
|
try {
|
|
1169
|
-
let t =
|
|
1170
|
-
t.length && (
|
|
1214
|
+
let t = s.applyMutation(e);
|
|
1215
|
+
t.length && (c.value = t[0] ?? "Unknown error");
|
|
1171
1216
|
} catch (e) {
|
|
1172
|
-
|
|
1217
|
+
c.value = e instanceof Error ? e.message : String(e);
|
|
1173
1218
|
}
|
|
1174
1219
|
}
|
|
1175
|
-
function
|
|
1220
|
+
function C(e, t) {
|
|
1176
1221
|
return {
|
|
1177
1222
|
id: `iface-default-${e}`,
|
|
1178
1223
|
name: e,
|
|
1179
1224
|
type: t.type,
|
|
1180
1225
|
direction: "input",
|
|
1181
|
-
value:
|
|
1226
|
+
value: l.value[e] ?? y(e, t)
|
|
1182
1227
|
};
|
|
1183
1228
|
}
|
|
1184
|
-
function
|
|
1185
|
-
|
|
1186
|
-
...
|
|
1229
|
+
function T(e, t) {
|
|
1230
|
+
l.value = {
|
|
1231
|
+
...l.value,
|
|
1187
1232
|
[e]: t
|
|
1188
1233
|
};
|
|
1189
1234
|
}
|
|
1190
|
-
function
|
|
1191
|
-
if (!
|
|
1192
|
-
let t =
|
|
1193
|
-
|
|
1235
|
+
function E(e) {
|
|
1236
|
+
if (!s.graphInterface.parameters?.[e]) return;
|
|
1237
|
+
let t = l.value[e];
|
|
1238
|
+
x((n) => {
|
|
1194
1239
|
let r = n.parameters?.[e];
|
|
1195
1240
|
if (!r) return;
|
|
1196
|
-
let i =
|
|
1241
|
+
let i = s.types[r.type], a = i?.coerce?.(t) ?? (i?.validate(t) ? t : y(e, r));
|
|
1197
1242
|
n.parameters = {
|
|
1198
1243
|
...n.parameters,
|
|
1199
1244
|
[e]: {
|
|
@@ -1203,19 +1248,19 @@ var lt = ["title"], ut = {
|
|
|
1203
1248
|
};
|
|
1204
1249
|
});
|
|
1205
1250
|
}
|
|
1206
|
-
function
|
|
1207
|
-
|
|
1208
|
-
let t =
|
|
1251
|
+
function D() {
|
|
1252
|
+
x((e) => {
|
|
1253
|
+
let t = f.value ? e.parameters : e.returns, n = new Set(Object.keys(t ?? {})), r = f.value ? "input" : "output";
|
|
1209
1254
|
if (n.has(r)) {
|
|
1210
1255
|
let e = 2;
|
|
1211
1256
|
for (; n.has(`${r}${e}`);) e++;
|
|
1212
1257
|
r = `${r}${e}`;
|
|
1213
1258
|
}
|
|
1214
|
-
let i =
|
|
1259
|
+
let i = s.typeIds[0] ?? "number", a = f.value ? {
|
|
1215
1260
|
type: i,
|
|
1216
|
-
defaultValue:
|
|
1261
|
+
defaultValue: _(i)
|
|
1217
1262
|
} : { type: i };
|
|
1218
|
-
|
|
1263
|
+
f.value ? e.parameters = {
|
|
1219
1264
|
...e.parameters,
|
|
1220
1265
|
[r]: a
|
|
1221
1266
|
} : e.returns = {
|
|
@@ -1224,9 +1269,9 @@ var lt = ["title"], ut = {
|
|
|
1224
1269
|
};
|
|
1225
1270
|
});
|
|
1226
1271
|
}
|
|
1227
|
-
function
|
|
1228
|
-
|
|
1229
|
-
if (
|
|
1272
|
+
function te(e) {
|
|
1273
|
+
x((t) => {
|
|
1274
|
+
if (f.value) {
|
|
1230
1275
|
if (!t.parameters) return;
|
|
1231
1276
|
let { [e]: n, ...r } = t.parameters;
|
|
1232
1277
|
t.parameters = Object.keys(r).length ? r : void 0;
|
|
@@ -1237,14 +1282,14 @@ var lt = ["title"], ut = {
|
|
|
1237
1282
|
}
|
|
1238
1283
|
});
|
|
1239
1284
|
}
|
|
1240
|
-
function
|
|
1241
|
-
if (!t || !
|
|
1242
|
-
|
|
1285
|
+
function O(e, t) {
|
|
1286
|
+
if (!t || !ne.test(t)) {
|
|
1287
|
+
c.value = `Invalid port name "${t}"`;
|
|
1243
1288
|
return;
|
|
1244
1289
|
}
|
|
1245
|
-
e !== t &&
|
|
1246
|
-
let r = (
|
|
1247
|
-
if (r) if (
|
|
1290
|
+
e !== t && x((n) => {
|
|
1291
|
+
let r = (f.value ? n.parameters : n.returns)?.[e];
|
|
1292
|
+
if (r) if (f.value) {
|
|
1248
1293
|
let { [e]: i, ...a } = n.parameters ?? {};
|
|
1249
1294
|
n.parameters = {
|
|
1250
1295
|
...a,
|
|
@@ -1259,14 +1304,14 @@ var lt = ["title"], ut = {
|
|
|
1259
1304
|
}
|
|
1260
1305
|
});
|
|
1261
1306
|
}
|
|
1262
|
-
function
|
|
1263
|
-
|
|
1264
|
-
if (
|
|
1307
|
+
function k(e, t) {
|
|
1308
|
+
x((n) => {
|
|
1309
|
+
if (f.value) {
|
|
1265
1310
|
let r = n.parameters?.[e];
|
|
1266
1311
|
if (!r) return;
|
|
1267
|
-
let i =
|
|
1268
|
-
|
|
1269
|
-
...
|
|
1312
|
+
let i = _(t);
|
|
1313
|
+
l.value = {
|
|
1314
|
+
...l.value,
|
|
1270
1315
|
[e]: i
|
|
1271
1316
|
}, n.parameters = {
|
|
1272
1317
|
...n.parameters,
|
|
@@ -1289,73 +1334,72 @@ var lt = ["title"], ut = {
|
|
|
1289
1334
|
}
|
|
1290
1335
|
});
|
|
1291
1336
|
}
|
|
1292
|
-
return (t,
|
|
1337
|
+
return (t, s) => (p(), n(Pt, { title: d.value }, {
|
|
1293
1338
|
actions: S(() => [a("button", {
|
|
1294
1339
|
class: "inspector-icon-btn",
|
|
1295
1340
|
type: "button",
|
|
1296
1341
|
title: "Add port",
|
|
1297
|
-
onClick: w(
|
|
1342
|
+
onClick: w(D, ["stop", "prevent"])
|
|
1298
1343
|
}, " + ")]),
|
|
1299
1344
|
default: S(() => [
|
|
1300
|
-
|
|
1345
|
+
g.value.length ? (p(), i("div", Ft, [...s[0] ||= [
|
|
1301
1346
|
a("span", null, "Name", -1),
|
|
1302
1347
|
a("span", null, "Type", -1),
|
|
1303
1348
|
a("span", null, null, -1)
|
|
1304
1349
|
]])) : r("", !0),
|
|
1305
|
-
|
|
1350
|
+
g.value.length ? (p(), i("div", It, [(p(!0), i(e, null, h(g.value, (t) => (p(), i("div", {
|
|
1306
1351
|
key: t.name,
|
|
1307
1352
|
class: "iface-entry"
|
|
1308
|
-
}, [a("div",
|
|
1353
|
+
}, [a("div", Lt, [
|
|
1309
1354
|
a("input", {
|
|
1310
1355
|
class: "iface-field iface-name",
|
|
1311
1356
|
type: "text",
|
|
1312
1357
|
value: t.name,
|
|
1313
|
-
onChange: (e) =>
|
|
1314
|
-
}, null, 40,
|
|
1358
|
+
onChange: (e) => O(t.name, e.target.value.trim())
|
|
1359
|
+
}, null, 40, Rt),
|
|
1315
1360
|
a("select", {
|
|
1316
1361
|
class: "iface-field iface-select",
|
|
1317
1362
|
value: t.spec.type,
|
|
1318
|
-
onChange: (e) =>
|
|
1319
|
-
}, [(p(!0), i(e, null, h(
|
|
1363
|
+
onChange: (e) => k(t.name, e.target.value)
|
|
1364
|
+
}, [(p(!0), i(e, null, h(o.typeIds, (e) => (p(), i("option", {
|
|
1320
1365
|
key: e,
|
|
1321
1366
|
value: e
|
|
1322
|
-
}, v(e), 9,
|
|
1367
|
+
}, v(e), 9, Bt))), 128))], 40, zt),
|
|
1323
1368
|
a("button", {
|
|
1324
1369
|
class: "iface-remove",
|
|
1325
1370
|
type: "button",
|
|
1326
1371
|
title: "Remove port",
|
|
1327
|
-
onClick: w((e) =>
|
|
1328
|
-
}, " × ", 8,
|
|
1329
|
-
]),
|
|
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, {
|
|
1375
|
+
key: `${t.name}-${t.spec.type}`,
|
|
1330
1376
|
class: "iface-default-widget",
|
|
1331
|
-
port:
|
|
1332
|
-
"type-def":
|
|
1333
|
-
"effective-widget": y(Le)(s.types[t.spec.type], E(t.name, t.spec)),
|
|
1377
|
+
port: C(t.name, t.spec),
|
|
1378
|
+
"type-def": o.types[t.spec.type],
|
|
1334
1379
|
mode: "editable",
|
|
1335
1380
|
placeholder: t.name,
|
|
1336
|
-
"onUpdate:value": (e) =>
|
|
1337
|
-
onCommit: (e) =>
|
|
1381
|
+
"onUpdate:value": (e) => T(t.name, e),
|
|
1382
|
+
onCommit: (e) => E(t.name)
|
|
1338
1383
|
}, null, 8, [
|
|
1339
1384
|
"port",
|
|
1340
1385
|
"type-def",
|
|
1341
|
-
"effective-widget",
|
|
1342
1386
|
"placeholder",
|
|
1343
1387
|
"onUpdate:value",
|
|
1344
1388
|
"onCommit"
|
|
1345
|
-
])])) : r("", !0)]))), 128))])) : (p(), i("div",
|
|
1346
|
-
|
|
1389
|
+
]))])) : r("", !0)]))), 128))])) : (p(), i("div", Ut, "No ports")),
|
|
1390
|
+
u.value ? (p(), i("p", Wt, v(u.value), 1)) : r("", !0)
|
|
1347
1391
|
]),
|
|
1348
1392
|
_: 1
|
|
1349
1393
|
}, 8, ["title"]));
|
|
1350
1394
|
}
|
|
1351
|
-
}), [["__scopeId", "data-v-
|
|
1395
|
+
}), [["__scopeId", "data-v-8f895443"]]), Kt = {
|
|
1352
1396
|
key: 0,
|
|
1353
1397
|
class: "inspector-title static"
|
|
1354
|
-
},
|
|
1398
|
+
}, qt = [
|
|
1355
1399
|
"value",
|
|
1356
1400
|
"placeholder",
|
|
1357
1401
|
"title"
|
|
1358
|
-
],
|
|
1402
|
+
], Jt = { class: "inspector-header-actions" }, Yt = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1359
1403
|
__name: "InspectorPanel",
|
|
1360
1404
|
props: {
|
|
1361
1405
|
title: {},
|
|
@@ -1392,7 +1436,7 @@ var lt = ["title"], ut = {
|
|
|
1392
1436
|
return (t, o) => (p(), i("div", { class: l(["inspector-panel", { fill: e.fill }]) }, [a("div", {
|
|
1393
1437
|
class: "inspector-header",
|
|
1394
1438
|
style: u({ background: e.headerColor })
|
|
1395
|
-
}, [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", {
|
|
1396
1440
|
key: 1,
|
|
1397
1441
|
class: "inspector-title",
|
|
1398
1442
|
type: "text",
|
|
@@ -1400,7 +1444,7 @@ var lt = ["title"], ut = {
|
|
|
1400
1444
|
placeholder: e.titlePlaceholder,
|
|
1401
1445
|
title: e.title,
|
|
1402
1446
|
onInput: d
|
|
1403
|
-
}, null, 40,
|
|
1447
|
+
}, null, 40, qt))], !0), a("div", Jt, [g(t.$slots, "header-actions", {}, void 0, !0), e.showUp ? (p(), i("button", {
|
|
1404
1448
|
key: 0,
|
|
1405
1449
|
class: "inspector-icon-btn",
|
|
1406
1450
|
type: "button",
|
|
@@ -1408,7 +1452,7 @@ var lt = ["title"], ut = {
|
|
|
1408
1452
|
onClick: o[0] ||= (e) => n("up")
|
|
1409
1453
|
}, " ↩ ")) : r("", !0)])], 4), a("div", { class: l(["inspector-body", { flush: e.flush }]) }, [g(t.$slots, "default", {}, void 0, !0)], 2)], 2));
|
|
1410
1454
|
}
|
|
1411
|
-
}), [["__scopeId", "data-v-78844099"]]),
|
|
1455
|
+
}), [["__scopeId", "data-v-78844099"]]), Xt = { class: "inspector-row" }, Zt = { class: "inspector-key" }, Qt = ["value"], $t = /* @__PURE__ */ s({
|
|
1412
1456
|
__name: "InspectorColorField",
|
|
1413
1457
|
props: {
|
|
1414
1458
|
modelValue: {},
|
|
@@ -1420,20 +1464,20 @@ var lt = ["title"], ut = {
|
|
|
1420
1464
|
function r(e) {
|
|
1421
1465
|
n("update:modelValue", e.target.value);
|
|
1422
1466
|
}
|
|
1423
|
-
return (t, n) => (p(), i("label",
|
|
1467
|
+
return (t, n) => (p(), i("label", Xt, [a("span", Zt, v(e.label), 1), a("input", {
|
|
1424
1468
|
class: "inspector-swatch",
|
|
1425
1469
|
type: "color",
|
|
1426
1470
|
value: e.modelValue,
|
|
1427
1471
|
onInput: r
|
|
1428
|
-
}, null, 40,
|
|
1472
|
+
}, null, 40, Qt)]));
|
|
1429
1473
|
}
|
|
1430
|
-
}),
|
|
1474
|
+
}), en = { class: "inspector-error" }, tn = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1431
1475
|
__name: "InspectorError",
|
|
1432
1476
|
props: { message: {} },
|
|
1433
1477
|
setup(e) {
|
|
1434
|
-
return (t, n) => (p(), i("p",
|
|
1478
|
+
return (t, n) => (p(), i("p", en, v(e.message), 1));
|
|
1435
1479
|
}
|
|
1436
|
-
}), [["__scopeId", "data-v-a863f513"]]),
|
|
1480
|
+
}), [["__scopeId", "data-v-a863f513"]]), nn = { class: "inspector-row pair" }, rn = ["value"], an = ["value"], on = /* @__PURE__ */ s({
|
|
1437
1481
|
__name: "InspectorPositionField",
|
|
1438
1482
|
props: {
|
|
1439
1483
|
x: {},
|
|
@@ -1445,23 +1489,23 @@ var lt = ["title"], ut = {
|
|
|
1445
1489
|
function r(e) {
|
|
1446
1490
|
return Number(e.target.value);
|
|
1447
1491
|
}
|
|
1448
|
-
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", {
|
|
1449
1493
|
class: "inspector-field",
|
|
1450
1494
|
type: "number",
|
|
1451
1495
|
value: e.x,
|
|
1452
1496
|
onInput: o[0] ||= (e) => n("update:x", r(e))
|
|
1453
|
-
}, null, 40,
|
|
1497
|
+
}, null, 40, rn)]), a("label", null, [o[3] ||= a("span", { class: "inspector-key" }, "Y", -1), a("input", {
|
|
1454
1498
|
class: "inspector-field",
|
|
1455
1499
|
type: "number",
|
|
1456
1500
|
value: e.y,
|
|
1457
1501
|
onInput: o[1] ||= (e) => n("update:y", r(e))
|
|
1458
|
-
}, null, 40,
|
|
1502
|
+
}, null, 40, an)])]));
|
|
1459
1503
|
}
|
|
1460
|
-
}),
|
|
1504
|
+
}), sn = { class: "inspector-row" }, cn = [
|
|
1461
1505
|
"min",
|
|
1462
1506
|
"max",
|
|
1463
1507
|
"value"
|
|
1464
|
-
],
|
|
1508
|
+
], ln = { class: "inspector-slider-value" }, un = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1465
1509
|
__name: "InspectorWidthField",
|
|
1466
1510
|
props: {
|
|
1467
1511
|
modelValue: {},
|
|
@@ -1475,7 +1519,7 @@ var lt = ["title"], ut = {
|
|
|
1475
1519
|
function r(e) {
|
|
1476
1520
|
n("update:modelValue", Number(e.target.value));
|
|
1477
1521
|
}
|
|
1478
|
-
return (t, n) => (p(), i("label",
|
|
1522
|
+
return (t, n) => (p(), i("label", sn, [
|
|
1479
1523
|
n[0] ||= a("span", { class: "inspector-key" }, "Width", -1),
|
|
1480
1524
|
a("input", {
|
|
1481
1525
|
class: "inspector-slider",
|
|
@@ -1486,11 +1530,11 @@ var lt = ["title"], ut = {
|
|
|
1486
1530
|
value: e.modelValue,
|
|
1487
1531
|
style: u({ accentColor: e.accentColor }),
|
|
1488
1532
|
onInput: r
|
|
1489
|
-
}, null, 44,
|
|
1490
|
-
a("span",
|
|
1533
|
+
}, null, 44, cn),
|
|
1534
|
+
a("span", ln, v(e.modelValue), 1)
|
|
1491
1535
|
]));
|
|
1492
1536
|
}
|
|
1493
|
-
}), [["__scopeId", "data-v-472135f4"]]),
|
|
1537
|
+
}), [["__scopeId", "data-v-472135f4"]]), dn = "#3a3f4b", fn = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1494
1538
|
__name: "NodePanel",
|
|
1495
1539
|
props: {
|
|
1496
1540
|
map: {},
|
|
@@ -1540,28 +1584,28 @@ var lt = ["title"], ut = {
|
|
|
1540
1584
|
let t = e - v.value;
|
|
1541
1585
|
for (let e of a.nodes) e.location.y += t;
|
|
1542
1586
|
}
|
|
1543
|
-
return (t, i) => l.value ? (p(), n(
|
|
1587
|
+
return (t, i) => l.value ? (p(), n(Yt, {
|
|
1544
1588
|
key: 0,
|
|
1545
1589
|
class: "node-panel",
|
|
1546
1590
|
title: m.value,
|
|
1547
1591
|
"title-placeholder": f.value,
|
|
1548
|
-
"header-color":
|
|
1592
|
+
"header-color": dn,
|
|
1549
1593
|
"static-title": c.value,
|
|
1550
1594
|
"onUpdate:title": b
|
|
1551
1595
|
}, {
|
|
1552
1596
|
default: S(() => [
|
|
1553
|
-
c.value ? r("", !0) : (p(), n(
|
|
1597
|
+
c.value ? r("", !0) : (p(), n($t, {
|
|
1554
1598
|
key: 0,
|
|
1555
1599
|
"model-value": h.value,
|
|
1556
1600
|
"onUpdate:modelValue": x
|
|
1557
1601
|
}, null, 8, ["model-value"])),
|
|
1558
|
-
o(
|
|
1602
|
+
o(on, {
|
|
1559
1603
|
x: _.value,
|
|
1560
1604
|
y: v.value,
|
|
1561
1605
|
"onUpdate:x": C,
|
|
1562
1606
|
"onUpdate:y": w
|
|
1563
1607
|
}, null, 8, ["x", "y"]),
|
|
1564
|
-
c.value ? r("", !0) : (p(), n(
|
|
1608
|
+
c.value ? r("", !0) : (p(), n(un, {
|
|
1565
1609
|
key: 1,
|
|
1566
1610
|
"model-value": g.value,
|
|
1567
1611
|
min: y(60),
|
|
@@ -1574,11 +1618,11 @@ var lt = ["title"], ut = {
|
|
|
1574
1618
|
"max",
|
|
1575
1619
|
"accent-color"
|
|
1576
1620
|
])),
|
|
1577
|
-
e.error && !c.value ? (p(), n(
|
|
1621
|
+
e.error && !c.value ? (p(), n(tn, {
|
|
1578
1622
|
key: 2,
|
|
1579
1623
|
message: e.error
|
|
1580
1624
|
}, null, 8, ["message"])) : r("", !0),
|
|
1581
|
-
u.value ? (p(), n(
|
|
1625
|
+
u.value ? (p(), n(Gt, {
|
|
1582
1626
|
key: 3,
|
|
1583
1627
|
"graph-interface": e.graphInterface,
|
|
1584
1628
|
mode: u.value,
|
|
@@ -1604,7 +1648,7 @@ var lt = ["title"], ut = {
|
|
|
1604
1648
|
"static-title"
|
|
1605
1649
|
])) : r("", !0);
|
|
1606
1650
|
}
|
|
1607
|
-
}), [["__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({
|
|
1608
1652
|
__name: "InspectorCheckboxField",
|
|
1609
1653
|
props: {
|
|
1610
1654
|
modelValue: { type: Boolean },
|
|
@@ -1616,13 +1660,13 @@ var lt = ["title"], ut = {
|
|
|
1616
1660
|
function r(e) {
|
|
1617
1661
|
n("update:modelValue", e.target.checked);
|
|
1618
1662
|
}
|
|
1619
|
-
return (t, n) => (p(), i("label",
|
|
1663
|
+
return (t, n) => (p(), i("label", pn, [a("span", mn, v(e.label), 1), a("input", {
|
|
1620
1664
|
type: "checkbox",
|
|
1621
1665
|
checked: e.modelValue,
|
|
1622
1666
|
onChange: r
|
|
1623
|
-
}, null, 40,
|
|
1667
|
+
}, null, 40, hn)]));
|
|
1624
1668
|
}
|
|
1625
|
-
}), [["__scopeId", "data-v-7b38cfa2"]]),
|
|
1669
|
+
}), [["__scopeId", "data-v-7b38cfa2"]]), _n = "#3a3f4b", vn = /* @__PURE__ */ s({
|
|
1626
1670
|
__name: "GroupPanel",
|
|
1627
1671
|
props: {
|
|
1628
1672
|
composite: {},
|
|
@@ -1630,7 +1674,7 @@ var lt = ["title"], ut = {
|
|
|
1630
1674
|
},
|
|
1631
1675
|
emits: ["up", "update:ioWidgets"],
|
|
1632
1676
|
setup(e, { emit: i }) {
|
|
1633
|
-
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);
|
|
1634
1678
|
function d(e) {
|
|
1635
1679
|
let t = a.composite;
|
|
1636
1680
|
t && (t.label = e);
|
|
@@ -1639,19 +1683,19 @@ var lt = ["title"], ut = {
|
|
|
1639
1683
|
let t = a.composite;
|
|
1640
1684
|
t && (t.color = e);
|
|
1641
1685
|
}
|
|
1642
|
-
return (t, i) => e.composite ? (p(), n(
|
|
1686
|
+
return (t, i) => e.composite ? (p(), n(Yt, {
|
|
1643
1687
|
key: 0,
|
|
1644
1688
|
title: l.value,
|
|
1645
1689
|
"title-placeholder": c.value,
|
|
1646
|
-
"header-color":
|
|
1690
|
+
"header-color": _n,
|
|
1647
1691
|
"show-up": "",
|
|
1648
1692
|
"onUpdate:title": d,
|
|
1649
1693
|
onUp: i[1] ||= (e) => s("up")
|
|
1650
1694
|
}, {
|
|
1651
|
-
default: S(() => [o(
|
|
1695
|
+
default: S(() => [o($t, {
|
|
1652
1696
|
"model-value": u.value,
|
|
1653
1697
|
"onUpdate:modelValue": f
|
|
1654
|
-
}, null, 8, ["model-value"]), o(
|
|
1698
|
+
}, null, 8, ["model-value"]), o(gn, {
|
|
1655
1699
|
label: "IO test",
|
|
1656
1700
|
"model-value": e.ioWidgets,
|
|
1657
1701
|
"onUpdate:modelValue": i[0] ||= (e) => s("update:ioWidgets", e)
|
|
@@ -1662,7 +1706,7 @@ var lt = ["title"], ut = {
|
|
|
1662
1706
|
});
|
|
1663
1707
|
//#endregion
|
|
1664
1708
|
//#region src/store/registry/groups.ts
|
|
1665
|
-
function
|
|
1709
|
+
function yn(e, t) {
|
|
1666
1710
|
return {
|
|
1667
1711
|
name: e,
|
|
1668
1712
|
path: t,
|
|
@@ -1670,37 +1714,37 @@ function dn(e, t) {
|
|
|
1670
1714
|
nodes: []
|
|
1671
1715
|
};
|
|
1672
1716
|
}
|
|
1673
|
-
function
|
|
1674
|
-
let n =
|
|
1717
|
+
function bn(e, t) {
|
|
1718
|
+
let n = yn("", []);
|
|
1675
1719
|
for (let r of Object.values(e)) {
|
|
1676
1720
|
if (t && !t(r)) continue;
|
|
1677
1721
|
let e = n, i = [];
|
|
1678
1722
|
for (let t of r.group ?? []) {
|
|
1679
1723
|
i.push(t);
|
|
1680
1724
|
let n = e.subgroups.find((e) => e.name === t);
|
|
1681
|
-
n || (n =
|
|
1725
|
+
n || (n = yn(t, [...i]), e.subgroups.push(n)), e = n;
|
|
1682
1726
|
}
|
|
1683
1727
|
e.nodes.push(r);
|
|
1684
1728
|
}
|
|
1685
1729
|
return n;
|
|
1686
1730
|
}
|
|
1687
|
-
function
|
|
1731
|
+
function xn(e) {
|
|
1688
1732
|
e.subgroups.sort((e, t) => e.name.localeCompare(t.name)), e.nodes.sort((e, t) => e.displayName.localeCompare(t.displayName));
|
|
1689
|
-
for (let t of e.subgroups)
|
|
1733
|
+
for (let t of e.subgroups) xn(t);
|
|
1690
1734
|
return e;
|
|
1691
1735
|
}
|
|
1692
1736
|
//#endregion
|
|
1693
1737
|
//#region src/components/AddNodePanel.vue?vue&type=script&setup=true&lang.ts
|
|
1694
|
-
var
|
|
1738
|
+
var Sn = ["title"], Cn = { class: "picker-body" }, wn = { class: "list" }, Tn = ["title", "onClick"], En = { class: "name" }, Dn = { class: "path" }, On = {
|
|
1695
1739
|
key: 0,
|
|
1696
1740
|
class: "path-sep"
|
|
1697
|
-
},
|
|
1741
|
+
}, kn = { class: "path-seg" }, An = {
|
|
1698
1742
|
key: 0,
|
|
1699
1743
|
class: "empty"
|
|
1700
|
-
},
|
|
1744
|
+
}, jn = ["onClick"], Mn = { class: "name" }, Nn = ["title", "onClick"], Pn = { class: "name" }, Fn = {
|
|
1701
1745
|
key: 1,
|
|
1702
1746
|
class: "empty"
|
|
1703
|
-
},
|
|
1747
|
+
}, In = /*#__PURE__*/ Q(/* @__PURE__ */ s({
|
|
1704
1748
|
__name: "AddNodePanel",
|
|
1705
1749
|
props: {
|
|
1706
1750
|
map: {},
|
|
@@ -1719,52 +1763,52 @@ var mn = ["title"], hn = { class: "picker-body" }, gn = { class: "list" }, _n =
|
|
|
1719
1763
|
}));
|
|
1720
1764
|
let c = n, f = s, g = "11px", _ = "6px", y = "20px", T = m(""), E = m(null);
|
|
1721
1765
|
d(() => E.value?.focus());
|
|
1722
|
-
let D = (e) => e.typeId !== "io/input" && e.typeId !== "io/output" && e.typeId !== "composite/group",
|
|
1723
|
-
let e =
|
|
1724
|
-
for (let t of
|
|
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) {
|
|
1725
1769
|
let n = e.subgroups.find((e) => e.name === t);
|
|
1726
1770
|
if (!n) break;
|
|
1727
1771
|
e = n;
|
|
1728
1772
|
}
|
|
1729
1773
|
return e;
|
|
1730
|
-
}),
|
|
1731
|
-
function
|
|
1774
|
+
}), A = t(() => O.value.length ? O.value.join(" › ") : "Add Node"), j = t(() => O.value.length ? O.value : null);
|
|
1775
|
+
function M(e) {
|
|
1732
1776
|
return e.group ?? [];
|
|
1733
1777
|
}
|
|
1734
|
-
function
|
|
1735
|
-
|
|
1778
|
+
function N(e) {
|
|
1779
|
+
O.value = [...O.value, e];
|
|
1736
1780
|
}
|
|
1737
|
-
function
|
|
1738
|
-
|
|
1781
|
+
function P() {
|
|
1782
|
+
O.value = O.value.slice(0, -1);
|
|
1739
1783
|
}
|
|
1740
|
-
let
|
|
1784
|
+
let F = t(() => {
|
|
1741
1785
|
let e = T.value.trim().toLowerCase();
|
|
1742
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;
|
|
1743
1787
|
});
|
|
1744
|
-
function
|
|
1788
|
+
function I(e) {
|
|
1745
1789
|
f("select", e.typeId);
|
|
1746
1790
|
}
|
|
1747
|
-
let
|
|
1748
|
-
ee(
|
|
1749
|
-
|
|
1791
|
+
let L = t(() => F.value ? F.value : k.value.nodes), R = m(0);
|
|
1792
|
+
ee(L, () => {
|
|
1793
|
+
R.value = 0;
|
|
1750
1794
|
});
|
|
1751
|
-
function
|
|
1752
|
-
let e =
|
|
1753
|
-
e.length &&
|
|
1795
|
+
function ne() {
|
|
1796
|
+
let e = L.value;
|
|
1797
|
+
e.length && I(e[R.value] ?? e[0]);
|
|
1754
1798
|
}
|
|
1755
|
-
function
|
|
1756
|
-
let t =
|
|
1757
|
-
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()));
|
|
1758
1802
|
}
|
|
1759
|
-
function
|
|
1760
|
-
|
|
1803
|
+
function B(e, t) {
|
|
1804
|
+
R.value = t, I(e);
|
|
1761
1805
|
}
|
|
1762
|
-
function
|
|
1806
|
+
function V(e) {
|
|
1763
1807
|
e.stopPropagation(), f("close");
|
|
1764
1808
|
}
|
|
1765
1809
|
return (t, s) => (p(), i("div", {
|
|
1766
1810
|
class: "backdrop",
|
|
1767
|
-
onPointerdown:
|
|
1811
|
+
onPointerdown: V,
|
|
1768
1812
|
onContextmenu: s[4] ||= w(() => {}, ["prevent"])
|
|
1769
1813
|
}, [a("div", {
|
|
1770
1814
|
class: "anchor",
|
|
@@ -1774,7 +1818,7 @@ var mn = ["title"], hn = { class: "picker-body" }, gn = { class: "list" }, _n =
|
|
|
1774
1818
|
}),
|
|
1775
1819
|
onPointerdown: s[2] ||= w(() => {}, ["stop"]),
|
|
1776
1820
|
onContextmenu: s[3] ||= w(() => {}, ["prevent"])
|
|
1777
|
-
}, [o(
|
|
1821
|
+
}, [o(Yt, {
|
|
1778
1822
|
title: "Add Node",
|
|
1779
1823
|
"static-title": "",
|
|
1780
1824
|
fill: "",
|
|
@@ -1782,60 +1826,60 @@ var mn = ["title"], hn = { class: "picker-body" }, gn = { class: "list" }, _n =
|
|
|
1782
1826
|
}, {
|
|
1783
1827
|
title: S(() => [a("nav", {
|
|
1784
1828
|
class: "crumbs",
|
|
1785
|
-
title:
|
|
1786
|
-
}, [a("span", { class: l(["crumb", { current: !
|
|
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)]),
|
|
1787
1831
|
"header-actions": S(() => [a("button", {
|
|
1788
1832
|
class: "inspector-icon-btn",
|
|
1789
1833
|
type: "button",
|
|
1790
1834
|
title: "Add composite",
|
|
1791
1835
|
onClick: s[0] ||= (e) => f("addComposite")
|
|
1792
1836
|
}, " + ")]),
|
|
1793
|
-
default: S(() => [a("div",
|
|
1837
|
+
default: S(() => [a("div", Cn, [C(a("input", {
|
|
1794
1838
|
ref_key: "searchEl",
|
|
1795
1839
|
ref: E,
|
|
1796
1840
|
"onUpdate:modelValue": s[1] ||= (e) => T.value = e,
|
|
1797
1841
|
class: "search",
|
|
1798
1842
|
type: "text",
|
|
1799
1843
|
placeholder: "Search nodes…",
|
|
1800
|
-
onKeydown:
|
|
1801
|
-
}, null, 544), [[x, T.value]]), a("div",
|
|
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", {
|
|
1802
1846
|
key: t.typeId,
|
|
1803
|
-
class: l(["row node", { active: n ===
|
|
1847
|
+
class: l(["row node", { active: n === R.value }]),
|
|
1804
1848
|
title: t.description,
|
|
1805
|
-
onClick: (e) =>
|
|
1849
|
+
onClick: (e) => B(t, n)
|
|
1806
1850
|
}, [
|
|
1807
1851
|
a("span", {
|
|
1808
1852
|
class: "dot",
|
|
1809
1853
|
style: u({ background: t.color })
|
|
1810
1854
|
}, null, 4),
|
|
1811
|
-
a("span",
|
|
1812
|
-
a("span",
|
|
1813
|
-
], 10,
|
|
1814
|
-
|
|
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", {
|
|
1815
1859
|
key: 0,
|
|
1816
1860
|
class: "row up",
|
|
1817
|
-
onClick:
|
|
1861
|
+
onClick: P
|
|
1818
1862
|
}, [...s[6] ||= [a("span", { class: "icon" }, "↩", -1), a("span", { class: "name" }, "..", -1)]])) : r("", !0),
|
|
1819
|
-
(p(!0), i(e, null, h(
|
|
1863
|
+
(p(!0), i(e, null, h(k.value.subgroups, (e) => (p(), i("button", {
|
|
1820
1864
|
key: e.name,
|
|
1821
1865
|
class: "row folder",
|
|
1822
|
-
onClick: (t) =>
|
|
1823
|
-
}, [a("span",
|
|
1824
|
-
(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", {
|
|
1825
1869
|
key: e.typeId,
|
|
1826
|
-
class: l(["row node", { active: t ===
|
|
1870
|
+
class: l(["row node", { active: t === R.value }]),
|
|
1827
1871
|
title: e.description,
|
|
1828
|
-
onClick: (n) =>
|
|
1872
|
+
onClick: (n) => B(e, t)
|
|
1829
1873
|
}, [a("span", {
|
|
1830
1874
|
class: "dot",
|
|
1831
1875
|
style: u({ background: e.color })
|
|
1832
|
-
}, null, 4), a("span",
|
|
1833
|
-
!
|
|
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)
|
|
1834
1878
|
], 64))])])]),
|
|
1835
1879
|
_: 1
|
|
1836
1880
|
})], 36)], 32));
|
|
1837
1881
|
}
|
|
1838
|
-
}), [["__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({
|
|
1839
1883
|
__name: "NodeViewer",
|
|
1840
1884
|
props: {
|
|
1841
1885
|
map: {},
|
|
@@ -1848,68 +1892,68 @@ var mn = ["title"], hn = { class: "picker-body" }, gn = { class: "list" }, _n =
|
|
|
1848
1892
|
function g(e) {
|
|
1849
1893
|
return b.value.types[e.type];
|
|
1850
1894
|
}
|
|
1851
|
-
let _ = s, v = m([]), y = t(() =>
|
|
1852
|
-
function
|
|
1853
|
-
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);
|
|
1854
1898
|
}
|
|
1855
|
-
function
|
|
1899
|
+
function O(e) {
|
|
1856
1900
|
C.value = "";
|
|
1857
1901
|
try {
|
|
1858
|
-
let t =
|
|
1902
|
+
let t = Fe(_.map, v.value, e);
|
|
1859
1903
|
return t.length ? (C.value = t[0] ?? "Unknown error", t) : (S.value++, []);
|
|
1860
1904
|
} catch (e) {
|
|
1861
1905
|
return C.value = e instanceof Error ? e.message : String(e), [C.value];
|
|
1862
1906
|
}
|
|
1863
1907
|
}
|
|
1864
|
-
function
|
|
1908
|
+
function k(e) {
|
|
1865
1909
|
let t = b.value.graph.nodes.find((t) => t.id === e);
|
|
1866
|
-
if (!t || !
|
|
1867
|
-
let n =
|
|
1910
|
+
if (!t || !he(t)) return;
|
|
1911
|
+
let n = ze(_.map, v.value, t);
|
|
1868
1912
|
if (n) {
|
|
1869
1913
|
console.warn(`[Group] ${n}`);
|
|
1870
1914
|
return;
|
|
1871
1915
|
}
|
|
1872
|
-
v.value.push({ compositeNodeId: e }),
|
|
1916
|
+
v.value.push({ compositeNodeId: e }), H(), K.value = null;
|
|
1873
1917
|
}
|
|
1874
|
-
let
|
|
1875
|
-
ee(
|
|
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) => {
|
|
1876
1920
|
for (let [t, n] of Object.entries(e)) {
|
|
1877
|
-
if (
|
|
1921
|
+
if (N.value[t] === n) continue;
|
|
1878
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;
|
|
1879
|
-
console.error(`[${i}] ${n}`),
|
|
1923
|
+
console.error(`[${i}] ${n}`), N.value[t] = n;
|
|
1880
1924
|
}
|
|
1881
|
-
for (let t of Object.keys(
|
|
1925
|
+
for (let t of Object.keys(N.value)) t in e || delete N.value[t];
|
|
1882
1926
|
});
|
|
1883
|
-
let
|
|
1884
|
-
function ie(e) {
|
|
1885
|
-
B.value = [e], De(b.value, e);
|
|
1886
|
-
}
|
|
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);
|
|
1887
1928
|
function ae(e) {
|
|
1888
|
-
|
|
1929
|
+
z.value = [e], Ae(b.value, e);
|
|
1930
|
+
}
|
|
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));
|
|
1889
1933
|
}
|
|
1890
|
-
function
|
|
1934
|
+
function se(e, t) {
|
|
1891
1935
|
if (t) {
|
|
1892
|
-
|
|
1936
|
+
oe(e);
|
|
1893
1937
|
return;
|
|
1894
1938
|
}
|
|
1895
|
-
if (
|
|
1896
|
-
|
|
1939
|
+
if (B.value.has(e) && z.value.length > 1) {
|
|
1940
|
+
Ae(b.value, e);
|
|
1897
1941
|
return;
|
|
1898
1942
|
}
|
|
1899
|
-
|
|
1943
|
+
ae(e);
|
|
1900
1944
|
}
|
|
1901
|
-
function
|
|
1902
|
-
|
|
1945
|
+
function H() {
|
|
1946
|
+
z.value = [];
|
|
1903
1947
|
}
|
|
1904
|
-
function
|
|
1948
|
+
function ce(e, t) {
|
|
1905
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);
|
|
1906
1950
|
return b.value.graph.nodes.filter((e) => {
|
|
1907
|
-
let t =
|
|
1951
|
+
let t = lt(e), o = ut(e, g);
|
|
1908
1952
|
return e.location.x < r && e.location.x + t > n && e.location.y < a && e.location.y + o > i;
|
|
1909
1953
|
}).map((e) => e.id);
|
|
1910
1954
|
}
|
|
1911
|
-
let
|
|
1912
|
-
let e =
|
|
1955
|
+
let U = m(null), le = t(() => {
|
|
1956
|
+
let e = U.value;
|
|
1913
1957
|
if (!e) return null;
|
|
1914
1958
|
let t = Math.min(e.start.x, e.cur.x), n = Math.min(e.start.y, e.cur.y);
|
|
1915
1959
|
return {
|
|
@@ -1918,107 +1962,107 @@ var mn = ["title"], hn = { class: "picker-body" }, gn = { class: "list" }, _n =
|
|
|
1918
1962
|
width: `${Math.abs(e.cur.x - e.start.x)}px`,
|
|
1919
1963
|
height: `${Math.abs(e.cur.y - e.start.y)}px`
|
|
1920
1964
|
};
|
|
1921
|
-
}),
|
|
1922
|
-
function
|
|
1923
|
-
if (
|
|
1924
|
-
if (!
|
|
1925
|
-
let t = e.clientX -
|
|
1926
|
-
if (Math.hypot(t, n) <
|
|
1927
|
-
|
|
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;
|
|
1928
1972
|
}
|
|
1929
|
-
|
|
1930
|
-
start:
|
|
1931
|
-
cur:
|
|
1973
|
+
U.value = {
|
|
1974
|
+
start: W.world,
|
|
1975
|
+
cur: G(e.clientX, e.clientY)
|
|
1932
1976
|
};
|
|
1933
1977
|
}
|
|
1934
1978
|
}
|
|
1935
|
-
function
|
|
1936
|
-
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;
|
|
1937
1981
|
}
|
|
1938
|
-
let
|
|
1939
|
-
function
|
|
1940
|
-
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;
|
|
1941
1985
|
return {
|
|
1942
|
-
x: (e - r -
|
|
1943
|
-
y: (t - i -
|
|
1986
|
+
x: (e - r - F.value) / R.value,
|
|
1987
|
+
y: (t - i - I.value) / R.value
|
|
1944
1988
|
};
|
|
1945
1989
|
}
|
|
1946
1990
|
function ge(e, t) {
|
|
1947
|
-
let n =
|
|
1991
|
+
let n = P.value?.getBoundingClientRect();
|
|
1948
1992
|
return {
|
|
1949
1993
|
x: e - (n?.left ?? 0),
|
|
1950
1994
|
y: t - (n?.top ?? 0)
|
|
1951
1995
|
};
|
|
1952
1996
|
}
|
|
1953
|
-
let
|
|
1954
|
-
function
|
|
1997
|
+
let K = m(null);
|
|
1998
|
+
function _e(e) {
|
|
1955
1999
|
if (e === "composite/group") {
|
|
1956
|
-
|
|
2000
|
+
ye();
|
|
1957
2001
|
return;
|
|
1958
2002
|
}
|
|
1959
2003
|
let t = b.value.nodeTypes[e];
|
|
1960
2004
|
if (t) {
|
|
1961
|
-
let e =
|
|
2005
|
+
let e = K.value?.world ?? {
|
|
1962
2006
|
x: 0,
|
|
1963
2007
|
y: 0
|
|
1964
|
-
}, n =
|
|
2008
|
+
}, n = L(t, {
|
|
1965
2009
|
x: e.x,
|
|
1966
2010
|
y: e.y
|
|
1967
2011
|
});
|
|
1968
|
-
b.value.graph.nodes.push(n),
|
|
2012
|
+
b.value.graph.nodes.push(n), ke(b.value), se(n.id, !1);
|
|
1969
2013
|
}
|
|
1970
|
-
|
|
2014
|
+
K.value = null;
|
|
1971
2015
|
}
|
|
1972
|
-
function
|
|
1973
|
-
let e =
|
|
2016
|
+
function ye() {
|
|
2017
|
+
let e = K.value?.world ?? {
|
|
1974
2018
|
x: 0,
|
|
1975
2019
|
y: 0
|
|
1976
|
-
}, t = b.value.graph, n =
|
|
2020
|
+
}, t = b.value.graph, n = me(_.map, {
|
|
1977
2021
|
x: e.x,
|
|
1978
2022
|
y: e.y
|
|
1979
|
-
}), r =
|
|
2023
|
+
}), r = Be(_.map, v.value, n, t);
|
|
1980
2024
|
if (r) {
|
|
1981
|
-
console.warn(`[Group] ${r}`),
|
|
2025
|
+
console.warn(`[Group] ${r}`), K.value = null;
|
|
1982
2026
|
return;
|
|
1983
2027
|
}
|
|
1984
|
-
t.nodes.push(n),
|
|
2028
|
+
t.nodes.push(n), ke(b.value), se(n.id, !1), K.value = null;
|
|
1985
2029
|
}
|
|
1986
|
-
let
|
|
1987
|
-
let e =
|
|
2030
|
+
let q = m(null), J = m(null), Se = m(null), De = t(() => {
|
|
2031
|
+
let e = q.value, t = J.value;
|
|
1988
2032
|
if (!e || !t) return null;
|
|
1989
|
-
let n =
|
|
2033
|
+
let n = Le(t, e.dir === "output" ? "input" : "output", e.ref.node, Se.value);
|
|
1990
2034
|
if (!n) return null;
|
|
1991
2035
|
let r = b.value.graph.nodes.find((e) => e.id === n.node);
|
|
1992
|
-
return r ?
|
|
1993
|
-
}),
|
|
1994
|
-
let e =
|
|
2036
|
+
return r ? ft(r, n.port, g) : null;
|
|
2037
|
+
}), je = t(() => {
|
|
2038
|
+
let e = q.value, t = J.value;
|
|
1995
2039
|
if (!e || !t) return null;
|
|
1996
|
-
let n =
|
|
1997
|
-
return e.dir === "output" ?
|
|
2040
|
+
let n = De.value ?? t;
|
|
2041
|
+
return e.dir === "output" ? mt(e.pos, n) : mt(n, e.pos);
|
|
1998
2042
|
});
|
|
1999
|
-
function
|
|
2000
|
-
let r = b.value.graph.nodes.find((t) => t.id === e.node), i = r ?
|
|
2001
|
-
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 = {
|
|
2002
2046
|
ref: e,
|
|
2003
2047
|
dir: t.direction,
|
|
2004
2048
|
pos: i
|
|
2005
|
-
},
|
|
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));
|
|
2006
2050
|
}
|
|
2007
|
-
function
|
|
2008
|
-
|
|
2051
|
+
function Ie(e) {
|
|
2052
|
+
J.value = G(e.clientX, e.clientY);
|
|
2009
2053
|
}
|
|
2010
|
-
function
|
|
2054
|
+
function Le(e, t, n, r) {
|
|
2011
2055
|
let i = null, a = Infinity;
|
|
2012
2056
|
for (let o of b.value.graph.nodes) {
|
|
2013
2057
|
if (o.id === n || r?.has(o.id)) continue;
|
|
2014
|
-
let s = o.location.x - 20, c = o.location.x +
|
|
2058
|
+
let s = o.location.x - 20, c = o.location.x + lt(o) + 20;
|
|
2015
2059
|
if (e.x < s || e.x > c) continue;
|
|
2016
2060
|
let l = t === "input" ? o.inputs : o.outputs;
|
|
2017
2061
|
for (let t of Object.values(l)) {
|
|
2018
2062
|
if (t.userOnly) continue;
|
|
2019
|
-
let n = g(t), r =
|
|
2063
|
+
let n = g(t), r = ft(o, t.id, g);
|
|
2020
2064
|
if (!r) continue;
|
|
2021
|
-
let s =
|
|
2065
|
+
let s = st(t, n) / 2;
|
|
2022
2066
|
if (e.y < r.y - s || e.y > r.y + s) continue;
|
|
2023
2067
|
let c = Math.hypot(r.x - e.x, r.y - e.y);
|
|
2024
2068
|
c < a && (a = c, i = {
|
|
@@ -2029,143 +2073,143 @@ var mn = ["title"], hn = { class: "picker-body" }, gn = { class: "list" }, _n =
|
|
|
2029
2073
|
}
|
|
2030
2074
|
return i;
|
|
2031
2075
|
}
|
|
2032
|
-
function
|
|
2033
|
-
let e =
|
|
2076
|
+
function Re() {
|
|
2077
|
+
let e = q.value, t = J.value;
|
|
2034
2078
|
if (e && t) {
|
|
2035
|
-
let n =
|
|
2079
|
+
let n = Le(t, e.dir === "output" ? "input" : "output", e.ref.node, Se.value);
|
|
2036
2080
|
if (n) {
|
|
2037
2081
|
let t = e.dir === "output" ? e.ref : n, r = e.dir === "output" ? n : e.ref;
|
|
2038
|
-
|
|
2082
|
+
Ce(b.value, t, r);
|
|
2039
2083
|
}
|
|
2040
2084
|
}
|
|
2041
|
-
|
|
2085
|
+
q.value = null, J.value = null, Se.value = null, window.removeEventListener("pointermove", Ie), window.removeEventListener("pointerup", Re);
|
|
2042
2086
|
}
|
|
2043
|
-
let
|
|
2044
|
-
let e =
|
|
2087
|
+
let X = m([]), Z = null, Ve = !1, He = t(() => {
|
|
2088
|
+
let e = X.value;
|
|
2045
2089
|
return e.length < 2 ? null : "M " + e.map((e) => `${e.x} ${e.y}`).join(" L ");
|
|
2046
2090
|
});
|
|
2047
|
-
function
|
|
2091
|
+
function Ue(e) {
|
|
2048
2092
|
e.preventDefault();
|
|
2049
2093
|
let t = e.target;
|
|
2050
2094
|
Z = {
|
|
2051
2095
|
clientX: e.clientX,
|
|
2052
2096
|
clientY: e.clientY,
|
|
2053
|
-
world:
|
|
2097
|
+
world: G(e.clientX, e.clientY),
|
|
2054
2098
|
screen: ge(e.clientX, e.clientY),
|
|
2055
2099
|
onBackground: !t?.closest(".node") && !t?.closest(".config-bar")
|
|
2056
|
-
},
|
|
2100
|
+
}, Ve = !1, X.value = [Z.world], window.addEventListener("pointermove", We), window.addEventListener("pointerup", Q);
|
|
2057
2101
|
}
|
|
2058
|
-
function
|
|
2102
|
+
function We(e) {
|
|
2059
2103
|
if (!Z) return;
|
|
2060
|
-
if (!
|
|
2104
|
+
if (!Ve) {
|
|
2061
2105
|
let t = e.clientX - Z.clientX, n = e.clientY - Z.clientY;
|
|
2062
|
-
if (Math.hypot(t, n) <
|
|
2063
|
-
|
|
2106
|
+
if (Math.hypot(t, n) < Vn) return;
|
|
2107
|
+
Ve = !0;
|
|
2064
2108
|
}
|
|
2065
|
-
let t =
|
|
2066
|
-
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);
|
|
2067
2111
|
}
|
|
2068
|
-
function
|
|
2112
|
+
function Ge(e, t) {
|
|
2069
2113
|
for (let n of [...b.value.graph.connections]) {
|
|
2070
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);
|
|
2071
2115
|
if (!r || !i) continue;
|
|
2072
|
-
let a =
|
|
2116
|
+
let a = ft(r, n.from.port, g), o = ft(i, n.to.port, g);
|
|
2073
2117
|
if (!a || !o) continue;
|
|
2074
|
-
let s =
|
|
2075
|
-
for (let r = 0; r < s.length - 1; r++) if (
|
|
2076
|
-
|
|
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);
|
|
2077
2121
|
break;
|
|
2078
2122
|
}
|
|
2079
2123
|
}
|
|
2080
2124
|
}
|
|
2081
|
-
function
|
|
2082
|
-
window.removeEventListener("pointermove",
|
|
2083
|
-
let e = Z, t =
|
|
2084
|
-
|
|
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 = {
|
|
2085
2129
|
screen: e.screen,
|
|
2086
2130
|
world: e.world
|
|
2087
2131
|
});
|
|
2088
2132
|
}
|
|
2089
|
-
function Ge() {
|
|
2090
|
-
I.value = 0, L.value = 0, z.value = 1;
|
|
2091
|
-
}
|
|
2092
2133
|
function Ke() {
|
|
2093
|
-
|
|
2134
|
+
F.value = 0, I.value = 0, R.value = 1;
|
|
2135
|
+
}
|
|
2136
|
+
function qe() {
|
|
2137
|
+
v.value = [], H(), K.value = null, S.value++;
|
|
2094
2138
|
}
|
|
2095
|
-
c({ resetView:
|
|
2096
|
-
function
|
|
2139
|
+
c({ resetView: qe });
|
|
2140
|
+
function Je(e) {
|
|
2097
2141
|
if (e.key === "Escape") {
|
|
2098
|
-
|
|
2142
|
+
K.value ? K.value = null : v.value.length ? te() : z.value.length ? H() : Ke();
|
|
2099
2143
|
return;
|
|
2100
2144
|
}
|
|
2101
2145
|
if (e.key !== "Delete" && e.key !== "Backspace") return;
|
|
2102
2146
|
let t = e.target;
|
|
2103
|
-
if (!(t instanceof HTMLElement && t.closest("input, textarea, select")) &&
|
|
2104
|
-
for (let e of
|
|
2105
|
-
|
|
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();
|
|
2106
2150
|
}
|
|
2107
2151
|
}
|
|
2108
|
-
function
|
|
2152
|
+
function Ye(e) {
|
|
2109
2153
|
e.preventDefault();
|
|
2110
|
-
let t =
|
|
2154
|
+
let t = P.value;
|
|
2111
2155
|
if (!t) return;
|
|
2112
|
-
let n = t.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top, a = (r -
|
|
2113
|
-
|
|
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;
|
|
2114
2158
|
}
|
|
2115
|
-
function
|
|
2116
|
-
let t = e.clientX, n = e.clientY, r =
|
|
2117
|
-
|
|
2159
|
+
function Xe(e) {
|
|
2160
|
+
let t = e.clientX, n = e.clientY, r = F.value, i = I.value;
|
|
2161
|
+
ne.value = !0;
|
|
2118
2162
|
function a(e) {
|
|
2119
|
-
|
|
2163
|
+
F.value = r + (e.clientX - t), I.value = i + (e.clientY - n);
|
|
2120
2164
|
}
|
|
2121
2165
|
function o() {
|
|
2122
|
-
|
|
2166
|
+
ne.value = !1, window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", o);
|
|
2123
2167
|
}
|
|
2124
2168
|
window.addEventListener("pointermove", a), window.addEventListener("pointerup", o);
|
|
2125
2169
|
}
|
|
2126
|
-
function
|
|
2127
|
-
e.button === 0 && (e.stopPropagation(),
|
|
2170
|
+
function $(e) {
|
|
2171
|
+
e.button === 0 && (e.stopPropagation(), W = {
|
|
2128
2172
|
clientX: e.clientX,
|
|
2129
2173
|
clientY: e.clientY,
|
|
2130
|
-
world:
|
|
2131
|
-
},
|
|
2174
|
+
world: G(e.clientX, e.clientY)
|
|
2175
|
+
}, ue = !1, window.addEventListener("pointermove", de), window.addEventListener("pointerup", fe));
|
|
2132
2176
|
}
|
|
2133
2177
|
function Ze(e) {
|
|
2134
|
-
e.button === 1 ? (e.preventDefault(),
|
|
2178
|
+
e.button === 1 ? (e.preventDefault(), Xe(e)) : e.button === 2 && Ue(e);
|
|
2135
2179
|
}
|
|
2136
2180
|
let Qe;
|
|
2137
2181
|
return d(() => {
|
|
2138
|
-
window.addEventListener("keydown",
|
|
2182
|
+
window.addEventListener("keydown", Je), ke(b.value), Qe = window.setInterval(() => Oe(b.value), Hn);
|
|
2139
2183
|
}), f(() => {
|
|
2140
|
-
window.removeEventListener("keydown",
|
|
2184
|
+
window.removeEventListener("keydown", Je), Qe !== void 0 && window.clearInterval(Qe);
|
|
2141
2185
|
}), (t, s) => (p(), i("div", {
|
|
2142
2186
|
ref_key: "viewerEl",
|
|
2143
|
-
ref:
|
|
2144
|
-
class: l(["viewer", { panning:
|
|
2145
|
-
onWheel:
|
|
2187
|
+
ref: P,
|
|
2188
|
+
class: l(["viewer", { panning: ne.value }]),
|
|
2189
|
+
onWheel: Ye,
|
|
2146
2190
|
onPointerdown: Ze,
|
|
2147
2191
|
onContextmenu: s[3] ||= w(() => {}, ["prevent"])
|
|
2148
2192
|
}, [
|
|
2149
2193
|
a("div", {
|
|
2150
2194
|
class: "top-right-stack",
|
|
2151
2195
|
onPointerdown: s[1] ||= w(() => {}, ["stop"])
|
|
2152
|
-
}, [v.value.length ? (p(), n(
|
|
2196
|
+
}, [v.value.length ? (p(), n(vn, {
|
|
2153
2197
|
key: 0,
|
|
2154
2198
|
composite: T.value,
|
|
2155
2199
|
"io-widgets": E.value,
|
|
2156
|
-
onUp:
|
|
2200
|
+
onUp: te,
|
|
2157
2201
|
"onUpdate:ioWidgets": s[0] ||= (e) => E.value = e
|
|
2158
|
-
}, null, 8, ["composite", "io-widgets"])) : r("", !0),
|
|
2202
|
+
}, null, 8, ["composite", "io-widgets"])) : r("", !0), re.value ? (p(), n(fn, {
|
|
2159
2203
|
key: 1,
|
|
2160
2204
|
class: "stacked-panel",
|
|
2161
2205
|
map: b.value,
|
|
2162
|
-
nodes:
|
|
2163
|
-
def:
|
|
2206
|
+
nodes: V.value,
|
|
2207
|
+
def: ie.value,
|
|
2164
2208
|
"graph-interface": x.value,
|
|
2165
2209
|
"interface-revision": S.value,
|
|
2166
2210
|
"interface-commit-error": C.value,
|
|
2167
|
-
"apply-interface-mutation":
|
|
2168
|
-
error:
|
|
2211
|
+
"apply-interface-mutation": O,
|
|
2212
|
+
error: V.value.length === 1 ? M.value[re.value.id] : void 0
|
|
2169
2213
|
}, null, 8, [
|
|
2170
2214
|
"map",
|
|
2171
2215
|
"nodes",
|
|
@@ -2177,39 +2221,39 @@ var mn = ["title"], hn = { class: "picker-body" }, gn = { class: "list" }, _n =
|
|
|
2177
2221
|
])) : r("", !0)], 32),
|
|
2178
2222
|
a("div", {
|
|
2179
2223
|
class: "viewport",
|
|
2180
|
-
style: u(
|
|
2224
|
+
style: u(pe.value)
|
|
2181
2225
|
}, [
|
|
2182
2226
|
a("div", {
|
|
2183
2227
|
class: "canvas-bg",
|
|
2184
|
-
onPointerdown:
|
|
2228
|
+
onPointerdown: $
|
|
2185
2229
|
}, null, 32),
|
|
2186
|
-
o(
|
|
2230
|
+
o(jt, {
|
|
2187
2231
|
map: b.value,
|
|
2188
|
-
"pending-path":
|
|
2189
|
-
"slice-path":
|
|
2232
|
+
"pending-path": je.value,
|
|
2233
|
+
"slice-path": He.value
|
|
2190
2234
|
}, null, 8, [
|
|
2191
2235
|
"map",
|
|
2192
2236
|
"pending-path",
|
|
2193
2237
|
"slice-path"
|
|
2194
2238
|
]),
|
|
2195
|
-
|
|
2239
|
+
le.value ? (p(), i("div", {
|
|
2196
2240
|
key: 0,
|
|
2197
2241
|
class: "marquee",
|
|
2198
|
-
style: u(
|
|
2242
|
+
style: u(le.value)
|
|
2199
2243
|
}, null, 4)) : r("", !0),
|
|
2200
|
-
(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, {
|
|
2201
2245
|
key: e.id,
|
|
2202
2246
|
node: e,
|
|
2203
2247
|
map: b.value,
|
|
2204
|
-
zoom:
|
|
2248
|
+
zoom: R.value,
|
|
2205
2249
|
"io-widgets": D.value,
|
|
2206
|
-
"io-results":
|
|
2207
|
-
selected:
|
|
2208
|
-
"selected-ids":
|
|
2209
|
-
error:
|
|
2210
|
-
onConnectStart:
|
|
2211
|
-
onSelect:
|
|
2212
|
-
onDrillIn:
|
|
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
|
|
2213
2257
|
}, null, 8, [
|
|
2214
2258
|
"node",
|
|
2215
2259
|
"map",
|
|
@@ -2221,25 +2265,25 @@ var mn = ["title"], hn = { class: "picker-body" }, gn = { class: "list" }, _n =
|
|
|
2221
2265
|
"error"
|
|
2222
2266
|
]))), 128))
|
|
2223
2267
|
], 4),
|
|
2224
|
-
|
|
2268
|
+
K.value ? (p(), n(In, {
|
|
2225
2269
|
key: 0,
|
|
2226
2270
|
map: b.value,
|
|
2227
|
-
screen:
|
|
2228
|
-
onSelect:
|
|
2229
|
-
onAddComposite:
|
|
2230
|
-
onClose: s[2] ||= (e) =>
|
|
2271
|
+
screen: K.value.screen,
|
|
2272
|
+
onSelect: _e,
|
|
2273
|
+
onAddComposite: ye,
|
|
2274
|
+
onClose: s[2] ||= (e) => K.value = null
|
|
2231
2275
|
}, null, 8, ["map", "screen"])) : r("", !0)
|
|
2232
2276
|
], 34));
|
|
2233
2277
|
}
|
|
2234
2278
|
}), [["__scopeId", "data-v-ff1ea32f"]]);
|
|
2235
2279
|
//#endregion
|
|
2236
2280
|
//#region src/components/types/registerDefaultTypeWidgets.ts
|
|
2237
|
-
function
|
|
2238
|
-
|
|
2281
|
+
function Wn() {
|
|
2282
|
+
nt("number", Ke), nt("string", $);
|
|
2239
2283
|
}
|
|
2240
2284
|
//#endregion
|
|
2241
2285
|
//#region src/store/graph/createNodeMap.ts
|
|
2242
|
-
function
|
|
2286
|
+
function Gn(e = {}) {
|
|
2243
2287
|
let t = {
|
|
2244
2288
|
graph: e.graph ?? {
|
|
2245
2289
|
nodes: [],
|
|
@@ -2248,69 +2292,116 @@ function Ln(e = {}) {
|
|
|
2248
2292
|
types: {},
|
|
2249
2293
|
nodeTypes: {},
|
|
2250
2294
|
extensions: e.extensions ? [...e.extensions] : [],
|
|
2251
|
-
graphInterface:
|
|
2295
|
+
graphInterface: R(e.graphInterface ?? j),
|
|
2296
|
+
registrationMeta: {
|
|
2297
|
+
types: {},
|
|
2298
|
+
nodeTypes: {}
|
|
2299
|
+
},
|
|
2252
2300
|
loadPack: () => []
|
|
2253
2301
|
};
|
|
2254
|
-
return e.types &&
|
|
2302
|
+
return e.types && N(t, e.types), e.nodeTypes && P(t, e.nodeTypes), ae(t, t.graphInterface), se(t), t;
|
|
2255
2303
|
}
|
|
2256
2304
|
//#endregion
|
|
2257
2305
|
//#region src/store/packs/installPack.ts
|
|
2258
|
-
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) {
|
|
2259
2344
|
if (e.extensions.includes(t.id)) return [];
|
|
2260
2345
|
let r = [];
|
|
2261
|
-
if (t.types) for (let n of Object.
|
|
2262
|
-
|
|
2263
|
-
|
|
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), []);
|
|
2264
2355
|
}
|
|
2265
2356
|
//#endregion
|
|
2266
2357
|
//#region src/vue/attachLoadPack.ts
|
|
2267
|
-
function
|
|
2358
|
+
function er() {
|
|
2268
2359
|
return {
|
|
2269
|
-
registerTypeWidget:
|
|
2270
|
-
registerComponentWidget:
|
|
2360
|
+
registerTypeWidget: nt,
|
|
2361
|
+
registerComponentWidget: rt
|
|
2271
2362
|
};
|
|
2272
2363
|
}
|
|
2273
|
-
function
|
|
2274
|
-
e.loadPack = (t) =>
|
|
2364
|
+
function tr(e) {
|
|
2365
|
+
e.loadPack = (t) => $n(e, t, er());
|
|
2275
2366
|
}
|
|
2276
2367
|
//#endregion
|
|
2277
2368
|
//#region src/vue/createNodeMap.ts
|
|
2278
|
-
var
|
|
2279
|
-
function
|
|
2280
|
-
|
|
2281
|
-
let t =
|
|
2282
|
-
|
|
2369
|
+
var nr = !1;
|
|
2370
|
+
function rr(e = {}) {
|
|
2371
|
+
nr ||= (Wn(), !0);
|
|
2372
|
+
let t = Gn(e);
|
|
2373
|
+
tr(t);
|
|
2283
2374
|
for (let n of e.packs ?? []) t.loadPack(n);
|
|
2284
2375
|
return t;
|
|
2285
2376
|
}
|
|
2286
2377
|
//#endregion
|
|
2287
2378
|
//#region src/store/graph/validateGraphTypes.ts
|
|
2288
|
-
function
|
|
2289
|
-
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}"`);
|
|
2290
2381
|
}
|
|
2291
|
-
function
|
|
2382
|
+
function ar(e, t, n) {
|
|
2292
2383
|
e.nodeTypes[t.typeId] || n.push(`node "${t.label ?? t.id}": unknown typeId "${t.typeId}"`);
|
|
2293
|
-
for (let r of Object.values(t.inputs))
|
|
2294
|
-
for (let r of Object.values(t.outputs))
|
|
2295
|
-
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);
|
|
2296
2387
|
}
|
|
2297
|
-
function
|
|
2298
|
-
for (let r of t.nodes)
|
|
2388
|
+
function or(e, t, n = []) {
|
|
2389
|
+
for (let r of t.nodes) ar(e, r, n);
|
|
2299
2390
|
return n;
|
|
2300
2391
|
}
|
|
2301
2392
|
//#endregion
|
|
2302
2393
|
//#region src/store/graph/document.ts
|
|
2303
|
-
function
|
|
2394
|
+
function sr(e) {
|
|
2304
2395
|
return {
|
|
2305
|
-
graph:
|
|
2306
|
-
interface:
|
|
2396
|
+
graph: R(e.graph),
|
|
2397
|
+
interface: R(e.graphInterface),
|
|
2307
2398
|
extensions: e.extensions.length ? [...e.extensions] : void 0
|
|
2308
2399
|
};
|
|
2309
2400
|
}
|
|
2310
|
-
function
|
|
2311
|
-
return
|
|
2401
|
+
function cr(e) {
|
|
2402
|
+
return sr(e);
|
|
2312
2403
|
}
|
|
2313
|
-
function
|
|
2404
|
+
function lr(e) {
|
|
2314
2405
|
let t;
|
|
2315
2406
|
try {
|
|
2316
2407
|
t = JSON.parse(e);
|
|
@@ -2326,48 +2417,64 @@ function Jn(e) {
|
|
|
2326
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");
|
|
2327
2418
|
return n;
|
|
2328
2419
|
}
|
|
2329
|
-
function
|
|
2420
|
+
function ur(e, t) {
|
|
2330
2421
|
return t?.length ? t.filter((t) => !e.extensions.includes(t)).map((e) => `missing pack "${e}" (call map.loadPack() before import)`) : [];
|
|
2331
2422
|
}
|
|
2332
|
-
function
|
|
2423
|
+
function dr(e, t) {
|
|
2333
2424
|
let n = [];
|
|
2334
|
-
return n.push(...
|
|
2425
|
+
return n.push(...ur(e, t.extensions)), n.push(...ce({
|
|
2335
2426
|
...e,
|
|
2336
2427
|
graph: t.graph
|
|
2337
|
-
})), n.push(...
|
|
2428
|
+
})), n.push(...z(e, t.interface)), n.push(...or(e, t.graph)), n;
|
|
2338
2429
|
}
|
|
2339
|
-
function
|
|
2340
|
-
let n =
|
|
2341
|
-
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);
|
|
2342
2433
|
}
|
|
2343
|
-
function
|
|
2344
|
-
return
|
|
2434
|
+
function pr(e, t) {
|
|
2435
|
+
return fr(e, t);
|
|
2345
2436
|
}
|
|
2346
2437
|
//#endregion
|
|
2347
2438
|
//#region src/store/registry/defineType.ts
|
|
2348
|
-
function
|
|
2349
|
-
|
|
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);
|
|
2350
2456
|
return {
|
|
2351
2457
|
id: e.id,
|
|
2352
|
-
label: e.label ??
|
|
2458
|
+
label: e.label ?? gr(e.id),
|
|
2353
2459
|
color: e.color ?? "#888",
|
|
2354
2460
|
validate: e.validate,
|
|
2355
2461
|
accepts: e.accepts,
|
|
2356
2462
|
defaultValue: e.defaultValue,
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2463
|
+
priority: e.priority,
|
|
2464
|
+
...t,
|
|
2465
|
+
parse: e.parse ?? r.parse,
|
|
2466
|
+
format: e.format ?? r.format,
|
|
2467
|
+
coerce: e.coerce ?? r.coerce
|
|
2361
2468
|
};
|
|
2362
2469
|
}
|
|
2363
|
-
function
|
|
2470
|
+
function gr(e) {
|
|
2364
2471
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
2365
2472
|
}
|
|
2366
|
-
function
|
|
2473
|
+
function _r(e, t, n) {
|
|
2367
2474
|
let r = Number(e);
|
|
2368
2475
|
return Number.isNaN(r) && (r = 0), t !== void 0 && (r = Math.max(t, r)), n !== void 0 && (r = Math.min(n, r)), r;
|
|
2369
2476
|
}
|
|
2370
|
-
function
|
|
2477
|
+
function vr(e) {
|
|
2371
2478
|
if (!e) return {
|
|
2372
2479
|
parse: (e) => e,
|
|
2373
2480
|
format: (e) => e == null ? "" : String(e)
|
|
@@ -2376,7 +2483,7 @@ function nr(e) {
|
|
|
2376
2483
|
case "number": return {
|
|
2377
2484
|
parse: (e) => Number(e),
|
|
2378
2485
|
format: (e) => e == null ? "" : String(e),
|
|
2379
|
-
coerce: (t) =>
|
|
2486
|
+
coerce: (t) => _r(t, e.min, e.max)
|
|
2380
2487
|
};
|
|
2381
2488
|
case "text": return {
|
|
2382
2489
|
parse: (e) => e,
|
|
@@ -2386,4 +2493,4 @@ function nr(e) {
|
|
|
2386
2493
|
}
|
|
2387
2494
|
}
|
|
2388
2495
|
//#endregion
|
|
2389
|
-
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 };
|