@octaviaflow/core 3.0.18-beta.11 → 3.0.18-beta.12
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/chunk-6QCJK7H7.js +2991 -0
- package/dist/chunk-6QCJK7H7.js.map +1 -0
- package/dist/chunk-76TP67ED.js +2984 -0
- package/dist/chunk-76TP67ED.js.map +1 -0
- package/dist/chunk-ECIHUVU7.js +2986 -0
- package/dist/chunk-ECIHUVU7.js.map +1 -0
- package/dist/chunk-MXJL3EPE.js +2986 -0
- package/dist/chunk-MXJL3EPE.js.map +1 -0
- package/dist/chunk-Q6ERDPQR.js +2981 -0
- package/dist/chunk-Q6ERDPQR.js.map +1 -0
- package/dist/chunk-UQBPYONV.js +2991 -0
- package/dist/chunk-UQBPYONV.js.map +1 -0
- package/dist/index.cjs +49 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/workflow/components/FlowCanvas/FlowCanvas.d.ts.map +1 -1
- package/dist/workflow/components/Handle/Handle.d.ts.map +1 -1
- package/dist/workflow/components/Handle/handleRegistry.d.ts +9 -0
- package/dist/workflow/components/Handle/handleRegistry.d.ts.map +1 -1
- package/dist/workflow.cjs +49 -39
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -29797,6 +29797,9 @@ function createHandleRegistry() {
|
|
|
29797
29797
|
resolve(nodeId, type, handleId) {
|
|
29798
29798
|
return map.get(key(nodeId, type, handleId));
|
|
29799
29799
|
},
|
|
29800
|
+
all() {
|
|
29801
|
+
return Array.from(map.values());
|
|
29802
|
+
},
|
|
29800
29803
|
subscribe(listener) {
|
|
29801
29804
|
listeners.add(listener);
|
|
29802
29805
|
return () => {
|
|
@@ -30192,10 +30195,12 @@ function Handle({
|
|
|
30192
30195
|
type,
|
|
30193
30196
|
side: position,
|
|
30194
30197
|
index,
|
|
30195
|
-
total
|
|
30198
|
+
total,
|
|
30199
|
+
canStart,
|
|
30200
|
+
canEnd
|
|
30196
30201
|
});
|
|
30197
30202
|
return dispose;
|
|
30198
|
-
}, [registry, node.id, id, type, position, index, total]);
|
|
30203
|
+
}, [registry, node.id, id, type, position, index, total, canStart, canEnd]);
|
|
30199
30204
|
const handlePointerDown = (e) => {
|
|
30200
30205
|
if (!canStart) return;
|
|
30201
30206
|
e.stopPropagation();
|
|
@@ -31331,49 +31336,54 @@ function FlowCanvas2(props) {
|
|
|
31331
31336
|
}
|
|
31332
31337
|
const c = connRef.current;
|
|
31333
31338
|
if (c && c.pointerId === e.pointerId) {
|
|
31334
|
-
|
|
31335
|
-
|
|
31336
|
-
|
|
31337
|
-
|
|
31338
|
-
|
|
31339
|
-
|
|
31340
|
-
|
|
31341
|
-
|
|
31342
|
-
|
|
31343
|
-
|
|
31344
|
-
|
|
31339
|
+
const rect = containerRef.current?.getBoundingClientRect();
|
|
31340
|
+
const flowPos = rect ? screenToFlow({ x: e.clientX - rect.left, y: e.clientY - rect.top }, vp) : { x: 0, y: 0 };
|
|
31341
|
+
const snapRadius = 26 / Math.max(0.1, vp.zoom);
|
|
31342
|
+
let bestDesc = null;
|
|
31343
|
+
let bestDist = snapRadius;
|
|
31344
|
+
for (const desc of handleRegistry.all()) {
|
|
31345
|
+
if (desc.nodeId === c.from.nodeId) continue;
|
|
31346
|
+
if (desc.type === c.from.handleType) continue;
|
|
31347
|
+
if (!desc.canEnd) continue;
|
|
31348
|
+
const targetNode = nodesRef.current.find((n) => n.id === desc.nodeId);
|
|
31349
|
+
if (!targetNode || targetNode.hidden) continue;
|
|
31350
|
+
const centre = handleCentre(targetNode, desc.side, desc.index, desc.total);
|
|
31351
|
+
const dist = Math.hypot(centre.x - flowPos.x, centre.y - flowPos.y);
|
|
31352
|
+
if (dist < bestDist) {
|
|
31353
|
+
bestDist = dist;
|
|
31354
|
+
bestDesc = desc;
|
|
31345
31355
|
}
|
|
31346
31356
|
}
|
|
31347
31357
|
let connection = null;
|
|
31348
31358
|
let connectedTo;
|
|
31349
|
-
if (
|
|
31350
|
-
const
|
|
31351
|
-
|
|
31352
|
-
|
|
31353
|
-
|
|
31354
|
-
|
|
31355
|
-
|
|
31356
|
-
|
|
31357
|
-
|
|
31358
|
-
|
|
31359
|
-
|
|
31360
|
-
|
|
31361
|
-
|
|
31362
|
-
|
|
31363
|
-
|
|
31364
|
-
|
|
31365
|
-
|
|
31366
|
-
|
|
31367
|
-
|
|
31368
|
-
|
|
31369
|
-
|
|
31370
|
-
|
|
31371
|
-
|
|
31372
|
-
|
|
31359
|
+
if (bestDesc) {
|
|
31360
|
+
const source = c.from.handleType === "source" ? c.from : {
|
|
31361
|
+
nodeId: bestDesc.nodeId,
|
|
31362
|
+
handleId: bestDesc.handleId,
|
|
31363
|
+
handleType: "source"
|
|
31364
|
+
};
|
|
31365
|
+
const target2 = c.from.handleType === "target" ? c.from : {
|
|
31366
|
+
nodeId: bestDesc.nodeId,
|
|
31367
|
+
handleId: bestDesc.handleId,
|
|
31368
|
+
handleType: "target"
|
|
31369
|
+
};
|
|
31370
|
+
connection = {
|
|
31371
|
+
source: source.nodeId,
|
|
31372
|
+
sourceHandle: source.handleId,
|
|
31373
|
+
target: target2.nodeId,
|
|
31374
|
+
targetHandle: target2.handleId
|
|
31375
|
+
};
|
|
31376
|
+
connectedTo = {
|
|
31377
|
+
nodeId: bestDesc.nodeId,
|
|
31378
|
+
handleId: bestDesc.handleId,
|
|
31379
|
+
handleType: bestDesc.type
|
|
31380
|
+
};
|
|
31381
|
+
const validator = isValidConnectionRef.current;
|
|
31382
|
+
if (validator && !validator(connection)) {
|
|
31383
|
+
connection = null;
|
|
31384
|
+
connectedTo = void 0;
|
|
31373
31385
|
}
|
|
31374
31386
|
}
|
|
31375
|
-
const rect = containerRef.current?.getBoundingClientRect();
|
|
31376
|
-
const flowPos = rect ? screenToFlow({ x: e.clientX - rect.left, y: e.clientY - rect.top }, vp) : { x: 0, y: 0 };
|
|
31377
31387
|
const endState = {
|
|
31378
31388
|
cancelled: !connection,
|
|
31379
31389
|
position: { x: e.clientX, y: e.clientY },
|