@bian-womp/spark-workbench 0.2.22 → 0.2.23
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/lib/cjs/index.cjs +146 -47
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/misc/NodeHandles.d.ts.map +1 -1
- package/lib/cjs/src/misc/mapping.d.ts +1 -0
- package/lib/cjs/src/misc/mapping.d.ts.map +1 -1
- package/lib/cjs/src/runtime/LocalGraphRunner.d.ts.map +1 -1
- package/lib/esm/index.js +146 -47
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/misc/NodeHandles.d.ts.map +1 -1
- package/lib/esm/src/misc/mapping.d.ts +1 -0
- package/lib/esm/src/misc/mapping.d.ts.map +1 -1
- package/lib/esm/src/runtime/LocalGraphRunner.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeHandles.d.ts","sourceRoot":"","sources":["../../../../src/misc/NodeHandles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"NodeHandles.d.ts","sourceRoot":"","sources":["../../../../src/misc/NodeHandles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAyD5C,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,aAAa,EACb,cAAyC,EACzC,eAA0C,EAC1C,YAAY,EACZ,WAAW,EACX,cAA4F,GAC7F,EAAE;IACD,IAAI,EAAE,UAAU,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QACpB,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;QACzB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;KAC3B,KAAK,MAAM,GAAG,SAAS,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE;QACnB,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;QACzB,EAAE,EAAE,MAAM,CAAC;KACZ,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,2CAkJA;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../../../src/misc/mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../../../src/misc/mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,eAAe,EAGrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKrD,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,UAAU,GAC5C,UAAU,GACV,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAA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ib/esm/index.js
CHANGED
|
@@ -532,13 +532,19 @@ class LocalGraphRunner extends AbstractGraphRunner {
|
|
|
532
532
|
const def = undefined; // UI will supply def/positions on download for local
|
|
533
533
|
const inputs = this.getInputs(this.runtime
|
|
534
534
|
? {
|
|
535
|
-
nodes: Array.from(this.runtime.getNodeIds()).map((id) => ({
|
|
535
|
+
nodes: Array.from(this.runtime.getNodeIds()).map((id) => ({
|
|
536
|
+
nodeId: id,
|
|
537
|
+
typeId: "",
|
|
538
|
+
})),
|
|
536
539
|
edges: [],
|
|
537
540
|
}
|
|
538
541
|
: { nodes: [], edges: [] });
|
|
539
542
|
const outputs = this.getOutputs(this.runtime
|
|
540
543
|
? {
|
|
541
|
-
nodes: Array.from(this.runtime.getNodeIds()).map((id) => ({
|
|
544
|
+
nodes: Array.from(this.runtime.getNodeIds()).map((id) => ({
|
|
545
|
+
nodeId: id,
|
|
546
|
+
typeId: "",
|
|
547
|
+
})),
|
|
542
548
|
edges: [],
|
|
543
549
|
}
|
|
544
550
|
: { nodes: [], edges: [] });
|
|
@@ -1259,18 +1265,44 @@ function layoutNode(args) {
|
|
|
1259
1265
|
}
|
|
1260
1266
|
|
|
1261
1267
|
function toReactFlow(def, positions, registry, opts) {
|
|
1268
|
+
const EDGE_STYLE_MISSING = { stroke: "#f59e0b", strokeWidth: 2 }; // amber-500
|
|
1262
1269
|
const EDGE_STYLE_ERROR = { stroke: "#ef4444", strokeWidth: 2 };
|
|
1263
1270
|
const EDGE_STYLE_RUNNING = { stroke: "#3b82f6" };
|
|
1264
|
-
|
|
1265
|
-
|
|
1271
|
+
// Build a map of valid handles per node up-front
|
|
1272
|
+
const validHandleMap = {};
|
|
1273
|
+
for (const n of def.nodes) {
|
|
1274
|
+
const { inputs, outputs } = computeEffectiveHandles(n, registry);
|
|
1275
|
+
const inputOrder = Object.keys(inputs).filter((k) => !isInputPrivate(inputs, k));
|
|
1276
|
+
const outputOrder = Object.keys(outputs);
|
|
1277
|
+
validHandleMap[n.nodeId] = {
|
|
1278
|
+
inputs: new Set(inputOrder),
|
|
1279
|
+
outputs: new Set(outputOrder),
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
// Track which inputs are connected (for UI) and which handles are missing (for layout)
|
|
1266
1283
|
const connectedInputs = {};
|
|
1284
|
+
const missingInputsByNode = {};
|
|
1285
|
+
const missingOutputsByNode = {};
|
|
1267
1286
|
for (const e of def.edges) {
|
|
1268
|
-
const
|
|
1269
|
-
const
|
|
1270
|
-
if (!connectedInputs[
|
|
1271
|
-
connectedInputs[
|
|
1272
|
-
connectedInputs[
|
|
1273
|
-
|
|
1287
|
+
const tgtId = e.target.nodeId;
|
|
1288
|
+
const tgtHandle = e.target.handle;
|
|
1289
|
+
if (!connectedInputs[tgtId])
|
|
1290
|
+
connectedInputs[tgtId] = new Set();
|
|
1291
|
+
connectedInputs[tgtId].add(tgtHandle);
|
|
1292
|
+
const tgtValid = !!validHandleMap[tgtId]?.inputs.has(tgtHandle);
|
|
1293
|
+
if (!tgtValid) {
|
|
1294
|
+
(missingInputsByNode[tgtId] || (missingInputsByNode[tgtId] = new Set())).add(tgtHandle);
|
|
1295
|
+
}
|
|
1296
|
+
const srcId = e.source.nodeId;
|
|
1297
|
+
const srcHandle = e.source.handle;
|
|
1298
|
+
const srcValid = !!validHandleMap[srcId]?.outputs.has(srcHandle);
|
|
1299
|
+
if (!srcValid) {
|
|
1300
|
+
(missingOutputsByNode[srcId] || (missingOutputsByNode[srcId] = new Set())).add(srcHandle);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
// This map is still used later for certain checks; align with valid handles
|
|
1304
|
+
const nodeHandleMap = {};
|
|
1305
|
+
Object.assign(nodeHandleMap, validHandleMap);
|
|
1274
1306
|
const nodes = def.nodes.map((n) => {
|
|
1275
1307
|
const { inputs: inputSource, outputs: outputSource } = computeEffectiveHandles(n, registry);
|
|
1276
1308
|
const overrideSize = opts.getDefaultNodeSize?.(n.typeId);
|
|
@@ -1292,11 +1324,61 @@ function toReactFlow(def, positions, registry, opts) {
|
|
|
1292
1324
|
inputs: new Set(inputHandles.map((h) => h.id)),
|
|
1293
1325
|
outputs: new Set(outputHandles.map((h) => h.id)),
|
|
1294
1326
|
};
|
|
1295
|
-
//
|
|
1327
|
+
// Append placeholder entries for any missing handles (below valid ones)
|
|
1328
|
+
const baseLeftCount = geom.inputOrder.length;
|
|
1329
|
+
const baseRightCount = geom.outputOrder.length;
|
|
1330
|
+
const extraInputs = Array.from(missingInputsByNode[n.nodeId] || []);
|
|
1331
|
+
const extraOutputs = Array.from(missingOutputsByNode[n.nodeId] || []);
|
|
1332
|
+
const HEADER = NODE_HEADER_HEIGHT_PX;
|
|
1333
|
+
const ROW = NODE_ROW_HEIGHT_PX;
|
|
1334
|
+
const extraHandleLayoutLeft = extraInputs.map((id, i) => ({
|
|
1335
|
+
id,
|
|
1336
|
+
type: "target",
|
|
1337
|
+
position: Position.Left,
|
|
1338
|
+
y: HEADER + (baseLeftCount + i) * ROW + ROW / 2,
|
|
1339
|
+
missing: true,
|
|
1340
|
+
}));
|
|
1341
|
+
const extraHandleLayoutRight = extraOutputs.map((id, i) => ({
|
|
1342
|
+
id,
|
|
1343
|
+
type: "source",
|
|
1344
|
+
position: Position.Right,
|
|
1345
|
+
y: HEADER + (baseRightCount + i) * ROW + ROW / 2,
|
|
1346
|
+
missing: true,
|
|
1347
|
+
}));
|
|
1348
|
+
const handleLayout = [
|
|
1349
|
+
...geom.handleLayout,
|
|
1350
|
+
...extraHandleLayoutLeft,
|
|
1351
|
+
...extraHandleLayoutRight,
|
|
1352
|
+
];
|
|
1353
|
+
// Precompute handle bounds (including missing) so edges can render immediately
|
|
1354
|
+
const missingBoundsLeft = extraInputs.map((id, i) => ({
|
|
1355
|
+
id,
|
|
1356
|
+
type: "target",
|
|
1357
|
+
position: Position.Left,
|
|
1358
|
+
x: 0,
|
|
1359
|
+
y: HEADER + (baseLeftCount + i) * ROW,
|
|
1360
|
+
width: 1,
|
|
1361
|
+
height: ROW + 2,
|
|
1362
|
+
}));
|
|
1363
|
+
const missingBoundsRight = extraOutputs.map((id, i) => ({
|
|
1364
|
+
id,
|
|
1365
|
+
type: "source",
|
|
1366
|
+
position: Position.Right,
|
|
1367
|
+
x: geom.width - 1,
|
|
1368
|
+
y: HEADER + (baseRightCount + i) * ROW,
|
|
1369
|
+
width: 1,
|
|
1370
|
+
height: ROW + 2,
|
|
1371
|
+
}));
|
|
1372
|
+
const handles = [
|
|
1373
|
+
...geom.handles,
|
|
1374
|
+
...missingBoundsLeft,
|
|
1375
|
+
...missingBoundsRight,
|
|
1376
|
+
];
|
|
1377
|
+
// Adjust node height to accommodate missing handle rows
|
|
1378
|
+
const baseRows = Math.max(baseLeftCount, baseRightCount);
|
|
1379
|
+
const newRows = Math.max(baseLeftCount + extraInputs.length, baseRightCount + extraOutputs.length);
|
|
1296
1380
|
const initialWidth = geom.width;
|
|
1297
|
-
const initialHeight = geom.height;
|
|
1298
|
-
// Precompute handle bounds so edges can render immediately without waiting for measurement
|
|
1299
|
-
const handles = geom.handles;
|
|
1381
|
+
const initialHeight = geom.height + Math.max(0, newRows - baseRows) * ROW;
|
|
1300
1382
|
return {
|
|
1301
1383
|
id: n.nodeId,
|
|
1302
1384
|
data: {
|
|
@@ -1308,7 +1390,7 @@ function toReactFlow(def, positions, registry, opts) {
|
|
|
1308
1390
|
h.id,
|
|
1309
1391
|
!!connectedInputs[n.nodeId]?.has(h.id),
|
|
1310
1392
|
])),
|
|
1311
|
-
handleLayout
|
|
1393
|
+
handleLayout,
|
|
1312
1394
|
showValues: opts.showValues,
|
|
1313
1395
|
renderWidth: initialWidth,
|
|
1314
1396
|
renderHeight: initialHeight,
|
|
@@ -1335,24 +1417,21 @@ function toReactFlow(def, positions, registry, opts) {
|
|
|
1335
1417
|
height: initialHeight,
|
|
1336
1418
|
};
|
|
1337
1419
|
});
|
|
1338
|
-
const edges = def.edges
|
|
1339
|
-
.filter((e) => {
|
|
1340
|
-
const src = nodeHandleMap[e.source.nodeId];
|
|
1341
|
-
const dst = nodeHandleMap[e.target.nodeId];
|
|
1342
|
-
if (!src || !dst)
|
|
1343
|
-
return false;
|
|
1344
|
-
return (src.outputs.has(e.source.handle) && dst.inputs.has(e.target.handle));
|
|
1345
|
-
})
|
|
1346
|
-
.map((e) => {
|
|
1420
|
+
const edges = def.edges.map((e) => {
|
|
1347
1421
|
const st = opts.edgeStatus?.[e.id];
|
|
1348
1422
|
const isRunning = !!st?.activeRuns;
|
|
1349
1423
|
const hasError = !!st?.lastError;
|
|
1350
1424
|
const isInvalidEdge = !!opts.edgeValidation?.[e.id];
|
|
1351
|
-
const
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1425
|
+
const sourceMissing = !validHandleMap[e.source.nodeId]?.outputs.has(e.source.handle);
|
|
1426
|
+
const targetMissing = !validHandleMap[e.target.nodeId]?.inputs.has(e.target.handle);
|
|
1427
|
+
const isMissing = sourceMissing || targetMissing;
|
|
1428
|
+
const style = isMissing
|
|
1429
|
+
? EDGE_STYLE_MISSING
|
|
1430
|
+
: hasError || isInvalidEdge
|
|
1431
|
+
? EDGE_STYLE_ERROR
|
|
1432
|
+
: isRunning
|
|
1433
|
+
? EDGE_STYLE_RUNNING
|
|
1434
|
+
: undefined;
|
|
1356
1435
|
return {
|
|
1357
1436
|
id: e.id,
|
|
1358
1437
|
source: e.source.nodeId,
|
|
@@ -1362,7 +1441,7 @@ function toReactFlow(def, positions, registry, opts) {
|
|
|
1362
1441
|
selected: opts.selectedEdgeIds
|
|
1363
1442
|
? opts.selectedEdgeIds.has(e.id)
|
|
1364
1443
|
: undefined,
|
|
1365
|
-
animated: isRunning,
|
|
1444
|
+
animated: isRunning && !isMissing,
|
|
1366
1445
|
style,
|
|
1367
1446
|
label: e.typeId || undefined,
|
|
1368
1447
|
};
|
|
@@ -2159,6 +2238,17 @@ function Inspector({ debug, autoScroll, hideWorkbench, onAutoScrollChange, onHid
|
|
|
2159
2238
|
}, title: "Delete referenced edge", children: "Delete edge" }))] }, i))) })] }))] })) }), debug && (jsx("div", { className: "mt-3 flex-none min-h-0 h-[50%]", children: jsx(DebugEvents, { autoScroll: !!autoScroll, hideWorkbench: !!hideWorkbench, onAutoScrollChange: onAutoScrollChange, onHideWorkbenchChange: onHideWorkbenchChange }) }))] }));
|
|
2160
2239
|
}
|
|
2161
2240
|
|
|
2241
|
+
function NodeHandleItem({ kind, id, type, position, y, isConnectable, className, labelClassName, renderLabel, }) {
|
|
2242
|
+
return (jsxs(Fragment, { children: [jsx(Handle, { id: id, type: type, position: position, isConnectable: isConnectable, className: className, style: y !== undefined ? { top: y } : undefined }), renderLabel && (jsx("div", { className: labelClassName + (kind === "input" ? " left-2" : " right-2"), style: {
|
|
2243
|
+
top: (y ?? 0) - 8,
|
|
2244
|
+
...(kind === "input"
|
|
2245
|
+
? { right: "50%" }
|
|
2246
|
+
: { left: "50%", textAlign: "right" }),
|
|
2247
|
+
whiteSpace: "nowrap",
|
|
2248
|
+
overflow: "hidden",
|
|
2249
|
+
textOverflow: "ellipsis",
|
|
2250
|
+
}, children: renderLabel({ kind, id }) }))] }));
|
|
2251
|
+
}
|
|
2162
2252
|
function NodeHandles({ data, isConnectable, inputClassName = "!w-2 !h-2 !bg-gray-600", outputClassName = "!w-2 !h-2 !bg-gray-600", getClassName, renderLabel, labelClassName = "absolute text-[11px] text-gray-700 dark:text-gray-300 pointer-events-none", }) {
|
|
2163
2253
|
const layout = data.handleLayout ?? [];
|
|
2164
2254
|
const byId = React.useMemo(() => {
|
|
@@ -2169,40 +2259,49 @@ function NodeHandles({ data, isConnectable, inputClassName = "!w-2 !h-2 !bg-gray
|
|
|
2169
2259
|
position: h.position,
|
|
2170
2260
|
y: h.y,
|
|
2171
2261
|
type: h.type,
|
|
2262
|
+
missing: h.missing,
|
|
2172
2263
|
});
|
|
2173
2264
|
// Back-compat: also store by id-only if not already set
|
|
2174
2265
|
if (!m.has(h.id))
|
|
2175
|
-
m.set(h.id, {
|
|
2266
|
+
m.set(h.id, {
|
|
2267
|
+
position: h.position,
|
|
2268
|
+
y: h.y,
|
|
2269
|
+
type: h.type,
|
|
2270
|
+
missing: h.missing,
|
|
2271
|
+
});
|
|
2176
2272
|
}
|
|
2177
2273
|
return m;
|
|
2178
2274
|
}, [layout]);
|
|
2275
|
+
const inputIds = React.useMemo(() => new Set((data.inputHandles ?? []).map((h) => h.id)), [data.inputHandles]);
|
|
2276
|
+
const outputIds = React.useMemo(() => new Set((data.outputHandles ?? []).map((h) => h.id)), [data.outputHandles]);
|
|
2277
|
+
const missingInputs = React.useMemo(() => (layout || []).filter((h) => h.type === "target" && (!inputIds.has(h.id) || h.missing)), [layout, inputIds]);
|
|
2278
|
+
const missingOutputs = React.useMemo(() => (layout || []).filter((h) => h.type === "source" && (!outputIds.has(h.id) || h.missing)), [layout, outputIds]);
|
|
2179
2279
|
return (jsxs(Fragment, { children: [(data.inputHandles ?? []).map((h) => {
|
|
2180
2280
|
const placed = byId.get(`target:${h.id}`) ?? byId.get(h.id);
|
|
2181
2281
|
const position = placed?.position ?? Position.Left;
|
|
2182
2282
|
const y = placed?.y;
|
|
2183
2283
|
const cls = getClassName?.({ kind: "input", id: h.id, type: "target" }) ??
|
|
2184
2284
|
inputClassName;
|
|
2185
|
-
return (
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2285
|
+
return (jsx(NodeHandleItem, { kind: "input", id: h.id, type: "target", position: position, y: y, isConnectable: isConnectable, className: cls, labelClassName: labelClassName, renderLabel: renderLabel }, h.id));
|
|
2286
|
+
}), missingInputs.map((h) => {
|
|
2287
|
+
const key = `missing-input:${h.id}`;
|
|
2288
|
+
const position = h.position ?? Position.Left;
|
|
2289
|
+
const y = h.y;
|
|
2290
|
+
const cls = "!w-3 !h-3 !bg-amber-400 !border-amber-500";
|
|
2291
|
+
return (jsx(NodeHandleItem, { kind: "input", id: h.id, type: "target", position: position, y: y, isConnectable: false, className: cls, labelClassName: labelClassName, renderLabel: renderLabel }, key));
|
|
2192
2292
|
}), (data.outputHandles ?? []).map((h) => {
|
|
2193
2293
|
const placed = byId.get(`source:${h.id}`) ?? byId.get(h.id);
|
|
2194
2294
|
const position = placed?.position ?? Position.Right;
|
|
2195
2295
|
const y = placed?.y;
|
|
2196
2296
|
const cls = getClassName?.({ kind: "output", id: h.id, type: "source" }) ??
|
|
2197
2297
|
outputClassName;
|
|
2198
|
-
return (
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
}, children: renderLabel({ kind: "output", id: h.id }) }))] }, h.id));
|
|
2298
|
+
return (jsx(NodeHandleItem, { kind: "output", id: h.id, type: "source", position: position, y: y, isConnectable: isConnectable, className: `${cls} wb-nodrag wb-nowheel`, labelClassName: labelClassName, renderLabel: renderLabel }, h.id));
|
|
2299
|
+
}), missingOutputs.map((h) => {
|
|
2300
|
+
const key = `missing-output:${h.id}`;
|
|
2301
|
+
const position = h.position ?? Position.Right;
|
|
2302
|
+
const y = h.y;
|
|
2303
|
+
const cls = "!w-3 !h-3 !bg-amber-400 !border-amber-500 !rounded-none wb-nodrag wb-nowheel";
|
|
2304
|
+
return (jsx(NodeHandleItem, { kind: "output", id: h.id, type: "source", position: position, y: y, isConnectable: false, className: cls, labelClassName: labelClassName, renderLabel: renderLabel }, key));
|
|
2206
2305
|
})] }));
|
|
2207
2306
|
}
|
|
2208
2307
|
|
|
@@ -2295,7 +2394,7 @@ function DefaultNodeContent({ data, isConnectable, }) {
|
|
|
2295
2394
|
const entries = kind === "input" ? inputEntries : outputEntries;
|
|
2296
2395
|
const entry = entries.find((e) => e.id === handleId);
|
|
2297
2396
|
if (!entry)
|
|
2298
|
-
return handleId;
|
|
2397
|
+
return prettyHandle(handleId);
|
|
2299
2398
|
const vIssues = (kind === "input" ? validation.inputs : validation.outputs).filter((v) => v.handle === handleId);
|
|
2300
2399
|
const hasAny = vIssues.length > 0;
|
|
2301
2400
|
const hasErr = vIssues.some((v) => v.level === "error");
|