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