@octaviaflow/core 3.0.18-beta.10 → 3.0.18-beta.11
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-5ARKSRED.js +2951 -0
- package/dist/chunk-5ARKSRED.js.map +1 -0
- package/dist/chunk-5OSGSJMM.js +2981 -0
- package/dist/chunk-5OSGSJMM.js.map +1 -0
- package/dist/chunk-5YQQMEF3.js +2981 -0
- package/dist/chunk-5YQQMEF3.js.map +1 -0
- package/dist/chunk-A6KMO4JV.js +2949 -0
- package/dist/chunk-A6KMO4JV.js.map +1 -0
- package/dist/chunk-B7FTWSTM.js +2938 -0
- package/dist/chunk-B7FTWSTM.js.map +1 -0
- package/dist/chunk-BCO6M26F.js +2940 -0
- package/dist/chunk-BCO6M26F.js.map +1 -0
- package/dist/chunk-HDOTOZNA.js +2936 -0
- package/dist/chunk-HDOTOZNA.js.map +1 -0
- package/dist/chunk-IUIICQU5.js +2946 -0
- package/dist/chunk-IUIICQU5.js.map +1 -0
- package/dist/chunk-J2UYZI6D.js +2946 -0
- package/dist/chunk-J2UYZI6D.js.map +1 -0
- package/dist/chunk-K2H7JLQW.js +2952 -0
- package/dist/chunk-K2H7JLQW.js.map +1 -0
- package/dist/chunk-KUXYBP66.js +2953 -0
- package/dist/chunk-KUXYBP66.js.map +1 -0
- package/dist/chunk-MMXL343D.js +2974 -0
- package/dist/chunk-MMXL343D.js.map +1 -0
- package/dist/chunk-NTMEYB7B.js +2949 -0
- package/dist/chunk-NTMEYB7B.js.map +1 -0
- package/dist/chunk-SLVDAZSX.js +2946 -0
- package/dist/chunk-SLVDAZSX.js.map +1 -0
- package/dist/chunk-UXMNBS22.js +2955 -0
- package/dist/chunk-UXMNBS22.js.map +1 -0
- package/dist/chunk-ZRAM6FXB.js +2949 -0
- package/dist/chunk-ZRAM6FXB.js.map +1 -0
- package/dist/index.cjs +60 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/workflow/components/FlowCanvas/FlowCanvas.d.ts +8 -0
- package/dist/workflow/components/FlowCanvas/FlowCanvas.d.ts.map +1 -1
- package/dist/workflow/utils/parenting.d.ts +5 -3
- package/dist/workflow/utils/parenting.d.ts.map +1 -1
- package/dist/workflow.cjs +60 -15
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -29749,7 +29749,7 @@ function findContainingGroup(point, nodes, exclude = []) {
|
|
|
29749
29749
|
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
29750
29750
|
const n = nodes[i];
|
|
29751
29751
|
if (exclude.includes(n.id)) continue;
|
|
29752
|
-
if (n.type !== "group") continue;
|
|
29752
|
+
if (n.type !== "group" && n.type !== "forEach") continue;
|
|
29753
29753
|
if (n.data && typeof n.data === "object" && n.data.collapsed) {
|
|
29754
29754
|
continue;
|
|
29755
29755
|
}
|
|
@@ -30920,6 +30920,8 @@ function FlowCanvas2(props) {
|
|
|
30920
30920
|
reparentOnDrag = false,
|
|
30921
30921
|
autoResizeContainers = false,
|
|
30922
30922
|
containerAutoResizePadding = 32,
|
|
30923
|
+
containerMinWidth = 320,
|
|
30924
|
+
containerMinHeight = 200,
|
|
30923
30925
|
height = "100%",
|
|
30924
30926
|
width = "100%",
|
|
30925
30927
|
className,
|
|
@@ -31056,7 +31058,9 @@ function FlowCanvas2(props) {
|
|
|
31056
31058
|
id: d.id,
|
|
31057
31059
|
startPosition: d.position
|
|
31058
31060
|
}));
|
|
31059
|
-
const
|
|
31061
|
+
const evaluateReparent = altKey || reparentOnDragRef.current;
|
|
31062
|
+
const hasParent = !!node.parentId;
|
|
31063
|
+
const skipClamp = altKey || reparentOnDragRef.current && !hasParent;
|
|
31060
31064
|
dragRef.current = {
|
|
31061
31065
|
pointerId,
|
|
31062
31066
|
nodeId,
|
|
@@ -31064,7 +31068,8 @@ function FlowCanvas2(props) {
|
|
|
31064
31068
|
startClientY: clientY,
|
|
31065
31069
|
startPosition: node.position,
|
|
31066
31070
|
descendants: kids,
|
|
31067
|
-
|
|
31071
|
+
skipClamp,
|
|
31072
|
+
evaluateReparent,
|
|
31068
31073
|
rafScheduled: false,
|
|
31069
31074
|
nextDelta: null
|
|
31070
31075
|
};
|
|
@@ -31124,6 +31129,8 @@ function FlowCanvas2(props) {
|
|
|
31124
31129
|
const reparentOnDragRef = (0, import_react154.useRef)(reparentOnDrag);
|
|
31125
31130
|
const autoResizeContainersRef = (0, import_react154.useRef)(autoResizeContainers);
|
|
31126
31131
|
const containerAutoResizePaddingRef = (0, import_react154.useRef)(containerAutoResizePadding);
|
|
31132
|
+
const containerMinWidthRef = (0, import_react154.useRef)(containerMinWidth);
|
|
31133
|
+
const containerMinHeightRef = (0, import_react154.useRef)(containerMinHeight);
|
|
31127
31134
|
(0, import_react154.useEffect)(() => {
|
|
31128
31135
|
edgesRef.current = edges;
|
|
31129
31136
|
}, [edges]);
|
|
@@ -31157,6 +31164,12 @@ function FlowCanvas2(props) {
|
|
|
31157
31164
|
(0, import_react154.useEffect)(() => {
|
|
31158
31165
|
containerAutoResizePaddingRef.current = containerAutoResizePadding;
|
|
31159
31166
|
}, [containerAutoResizePadding]);
|
|
31167
|
+
(0, import_react154.useEffect)(() => {
|
|
31168
|
+
containerMinWidthRef.current = containerMinWidth;
|
|
31169
|
+
}, [containerMinWidth]);
|
|
31170
|
+
(0, import_react154.useEffect)(() => {
|
|
31171
|
+
containerMinHeightRef.current = containerMinHeight;
|
|
31172
|
+
}, [containerMinHeight]);
|
|
31160
31173
|
const onNodesChangeRef = (0, import_react154.useRef)(onNodesChange);
|
|
31161
31174
|
const onConnectRef = (0, import_react154.useRef)(onConnect);
|
|
31162
31175
|
const onConnectEndRef = (0, import_react154.useRef)(onConnectEnd);
|
|
@@ -31201,7 +31214,7 @@ function FlowCanvas2(props) {
|
|
|
31201
31214
|
x: d.startPosition.x + delta.dx,
|
|
31202
31215
|
y: d.startPosition.y + delta.dy
|
|
31203
31216
|
};
|
|
31204
|
-
const clamped = d.
|
|
31217
|
+
const clamped = d.skipClamp ? proposed : clampToParentExtent(dragNode, proposed, nodesRef.current);
|
|
31205
31218
|
const isContainer = dragNode.type === "group" || dragNode.type === "forEach";
|
|
31206
31219
|
const gap = isContainer ? subflowCollisionGapRef.current : nodeCollisionGapRef.current;
|
|
31207
31220
|
const excludeIds = /* @__PURE__ */ new Set([d.nodeId, ...d.descendants.map((kid) => kid.id)]);
|
|
@@ -31253,7 +31266,7 @@ function FlowCanvas2(props) {
|
|
|
31253
31266
|
y: Math.round(proposed.y / g) * g
|
|
31254
31267
|
};
|
|
31255
31268
|
}
|
|
31256
|
-
const clamped = drag.
|
|
31269
|
+
const clamped = drag.skipClamp ? proposed : clampToParentExtent(dragNode, proposed, nodesRef.current);
|
|
31257
31270
|
const isContainer = dragNode.type === "group" || dragNode.type === "forEach";
|
|
31258
31271
|
const gap = isContainer ? subflowCollisionGapRef.current : nodeCollisionGapRef.current;
|
|
31259
31272
|
const excludeIds = /* @__PURE__ */ new Set([
|
|
@@ -31276,7 +31289,7 @@ function FlowCanvas2(props) {
|
|
|
31276
31289
|
)
|
|
31277
31290
|
);
|
|
31278
31291
|
}
|
|
31279
|
-
if (drag.
|
|
31292
|
+
if (drag.evaluateReparent) {
|
|
31280
31293
|
const targetGroup = findContainingGroup(
|
|
31281
31294
|
{
|
|
31282
31295
|
x: finalPos.x + (dragNode.width ?? 0) / 2,
|
|
@@ -31291,8 +31304,10 @@ function FlowCanvas2(props) {
|
|
|
31291
31304
|
...dragNode,
|
|
31292
31305
|
position: finalPos,
|
|
31293
31306
|
parentId: nextParentId,
|
|
31294
|
-
//
|
|
31295
|
-
extent:
|
|
31307
|
+
// Adopting into a container always pins the child with
|
|
31308
|
+
// `extent: 'parent'` so it's clamped from the next drag
|
|
31309
|
+
// on. Detaching clears it.
|
|
31310
|
+
extent: nextParentId ? "parent" : void 0
|
|
31296
31311
|
};
|
|
31297
31312
|
changes.push(change.node.replace(drag.nodeId, updated));
|
|
31298
31313
|
}
|
|
@@ -31303,7 +31318,9 @@ function FlowCanvas2(props) {
|
|
|
31303
31318
|
// Projected children: apply the position + reparent
|
|
31304
31319
|
// changes we just built before measuring bboxes.
|
|
31305
31320
|
changes,
|
|
31306
|
-
containerAutoResizePaddingRef.current
|
|
31321
|
+
containerAutoResizePaddingRef.current,
|
|
31322
|
+
containerMinWidthRef.current,
|
|
31323
|
+
containerMinHeightRef.current
|
|
31307
31324
|
);
|
|
31308
31325
|
for (const c2 of containerChanges) changes.push(c2);
|
|
31309
31326
|
}
|
|
@@ -31389,6 +31406,25 @@ function FlowCanvas2(props) {
|
|
|
31389
31406
|
window.removeEventListener("pointercancel", onPointerCancel);
|
|
31390
31407
|
};
|
|
31391
31408
|
}, [store]);
|
|
31409
|
+
(0, import_react154.useEffect)(() => {
|
|
31410
|
+
if (!autoResizeContainers || draggingId) return;
|
|
31411
|
+
const resizeChanges = computeContainerAutoResize(
|
|
31412
|
+
nodes,
|
|
31413
|
+
[],
|
|
31414
|
+
containerAutoResizePadding,
|
|
31415
|
+
containerMinWidth,
|
|
31416
|
+
containerMinHeight
|
|
31417
|
+
);
|
|
31418
|
+
if (resizeChanges.length > 0) onNodesChange?.(resizeChanges);
|
|
31419
|
+
}, [
|
|
31420
|
+
nodes,
|
|
31421
|
+
draggingId,
|
|
31422
|
+
autoResizeContainers,
|
|
31423
|
+
containerAutoResizePadding,
|
|
31424
|
+
containerMinWidth,
|
|
31425
|
+
containerMinHeight,
|
|
31426
|
+
onNodesChange
|
|
31427
|
+
]);
|
|
31392
31428
|
const panRef = (0, import_react154.useRef)(null);
|
|
31393
31429
|
const onCanvasPointerDown = (e) => {
|
|
31394
31430
|
if (e.button !== 0) return;
|
|
@@ -31851,7 +31887,9 @@ function FlowCanvas2(props) {
|
|
|
31851
31887
|
function onEdgesChangeRef(id, cb) {
|
|
31852
31888
|
cb?.([change.edge.remove(id)]);
|
|
31853
31889
|
}
|
|
31854
|
-
|
|
31890
|
+
var CONTAINER_DROP_HEADROOM_W = 220;
|
|
31891
|
+
var CONTAINER_DROP_HEADROOM_H = 2 * 128;
|
|
31892
|
+
function computeContainerAutoResize(nodes, pending, padding, minWidth, minHeight) {
|
|
31855
31893
|
const projected = /* @__PURE__ */ new Map();
|
|
31856
31894
|
for (const n of nodes) projected.set(n.id, n);
|
|
31857
31895
|
for (const c of pending) {
|
|
@@ -31872,7 +31910,14 @@ function computeContainerAutoResize(nodes, pending, padding) {
|
|
|
31872
31910
|
for (const n of projected.values()) {
|
|
31873
31911
|
if (n.parentId === parent.id) children.push(n);
|
|
31874
31912
|
}
|
|
31875
|
-
if (children.length === 0)
|
|
31913
|
+
if (children.length === 0) {
|
|
31914
|
+
const curW2 = parent.width ?? 480;
|
|
31915
|
+
const curH2 = parent.height ?? 240;
|
|
31916
|
+
if (curW2 !== minWidth || curH2 !== minHeight) {
|
|
31917
|
+
out.push(change.node.dimensions(parent.id, { width: minWidth, height: minHeight }));
|
|
31918
|
+
}
|
|
31919
|
+
continue;
|
|
31920
|
+
}
|
|
31876
31921
|
let minX = Number.POSITIVE_INFINITY;
|
|
31877
31922
|
let minY = Number.POSITIVE_INFINITY;
|
|
31878
31923
|
let maxX = Number.NEGATIVE_INFINITY;
|
|
@@ -31887,12 +31932,12 @@ function computeContainerAutoResize(nodes, pending, padding) {
|
|
|
31887
31932
|
}
|
|
31888
31933
|
const targetX = minX - padding;
|
|
31889
31934
|
const targetY = minY - padding - HEADER;
|
|
31890
|
-
const targetW = maxX - minX + padding * 2;
|
|
31891
|
-
const targetH = maxY - minY + padding * 2 + HEADER;
|
|
31892
31935
|
const curW = parent.width ?? 480;
|
|
31893
31936
|
const curH = parent.height ?? 240;
|
|
31894
|
-
const
|
|
31895
|
-
const
|
|
31937
|
+
const fitW = maxX - minX + padding * 2 + CONTAINER_DROP_HEADROOM_W;
|
|
31938
|
+
const fitH = maxY - minY + padding * 2 + HEADER + CONTAINER_DROP_HEADROOM_H;
|
|
31939
|
+
const nextW = Math.max(minWidth, fitW);
|
|
31940
|
+
const nextH = Math.max(minHeight, fitH);
|
|
31896
31941
|
const positionDirty = parent.position.x !== targetX || parent.position.y !== targetY;
|
|
31897
31942
|
const sizeDirty = curW !== nextW || curH !== nextH;
|
|
31898
31943
|
if (positionDirty) {
|