@octaviaflow/core 3.0.18-beta.32 → 3.0.18-beta.33
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-KOE4VS4I.js +2945 -0
- package/dist/chunk-KOE4VS4I.js.map +1 -0
- package/dist/chunk-M2QXKYL2.js +2945 -0
- package/dist/chunk-M2QXKYL2.js.map +1 -0
- package/dist/components/FlowMinimap/FlowMinimap.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/index.cjs +710 -665
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +59 -10
- package/dist/index.js.map +1 -1
- package/dist/workflow.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,11 +2,13 @@ import {
|
|
|
2
2
|
FlowCanvas,
|
|
3
3
|
FlowInstanceContext,
|
|
4
4
|
FlowStoreContext,
|
|
5
|
+
HandleRegistryContext,
|
|
5
6
|
applyEdgeChanges,
|
|
6
7
|
applyNodeChanges,
|
|
7
8
|
buildEdgePath,
|
|
9
|
+
handleCentre,
|
|
8
10
|
useViewportOrNull
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KOE4VS4I.js";
|
|
10
12
|
import {
|
|
11
13
|
__export,
|
|
12
14
|
cn
|
|
@@ -4858,6 +4860,20 @@ var Select = forwardRef14(function Select2({
|
|
|
4858
4860
|
};
|
|
4859
4861
|
}, [state.isOpen, state.close, closeOnOutsideClick]);
|
|
4860
4862
|
const selectedOption = options.find((o) => o.value === String(state.selectedKey ?? ""));
|
|
4863
|
+
const wasOpenBeforePressRef = useRef8(false);
|
|
4864
|
+
const handleTriggerPointerDown = (e) => {
|
|
4865
|
+
wasOpenBeforePressRef.current = state.isOpen;
|
|
4866
|
+
const baseHandler = buttonProps.onPointerDown;
|
|
4867
|
+
baseHandler?.(e);
|
|
4868
|
+
};
|
|
4869
|
+
const handleTriggerClick = (e) => {
|
|
4870
|
+
const baseHandler = buttonProps.onClick;
|
|
4871
|
+
baseHandler?.(e);
|
|
4872
|
+
if (wasOpenBeforePressRef.current && state.isOpen) {
|
|
4873
|
+
state.close();
|
|
4874
|
+
}
|
|
4875
|
+
wasOpenBeforePressRef.current = false;
|
|
4876
|
+
};
|
|
4861
4877
|
return /* @__PURE__ */ jsxs15(
|
|
4862
4878
|
"div",
|
|
4863
4879
|
{
|
|
@@ -4875,6 +4891,8 @@ var Select = forwardRef14(function Select2({
|
|
|
4875
4891
|
"button",
|
|
4876
4892
|
{
|
|
4877
4893
|
...buttonProps,
|
|
4894
|
+
onPointerDown: handleTriggerPointerDown,
|
|
4895
|
+
onClick: handleTriggerClick,
|
|
4878
4896
|
ref: setTriggerRef,
|
|
4879
4897
|
id: baseId,
|
|
4880
4898
|
form,
|
|
@@ -14323,11 +14341,17 @@ function FlowMinimap(props) {
|
|
|
14323
14341
|
} = props;
|
|
14324
14342
|
const store = useContext(FlowStoreContext);
|
|
14325
14343
|
const instance = useContext(FlowInstanceContext);
|
|
14344
|
+
const handleRegistry = useContext(HandleRegistryContext);
|
|
14326
14345
|
const { sub, snap } = useMemo16(
|
|
14327
14346
|
() => store ? { sub: store.subscribe, snap: () => store.getSnapshot() } : { sub: NO_STORE_SUBSCRIBE, snap: NO_STORE_SNAPSHOT },
|
|
14328
14347
|
[store]
|
|
14329
14348
|
);
|
|
14330
14349
|
const liveSnapshot = useSyncExternalStore(sub, snap, snap);
|
|
14350
|
+
const [registryVersion, setRegistryVersion] = useState26(0);
|
|
14351
|
+
useEffect22(() => {
|
|
14352
|
+
if (!handleRegistry) return;
|
|
14353
|
+
return handleRegistry.subscribe(() => setRegistryVersion((v) => v + 1));
|
|
14354
|
+
}, [handleRegistry]);
|
|
14331
14355
|
const resolvedNodes = useMemo16(() => {
|
|
14332
14356
|
if (nodesProp) return nodesProp;
|
|
14333
14357
|
if (!liveSnapshot) return [];
|
|
@@ -14342,19 +14366,41 @@ function FlowMinimap(props) {
|
|
|
14342
14366
|
const resolvedEdges = useMemo16(() => {
|
|
14343
14367
|
if (edgesProp) return edgesProp;
|
|
14344
14368
|
if (!liveSnapshot) return [];
|
|
14345
|
-
const nodeIndex = new Map(
|
|
14369
|
+
const nodeIndex = new Map(
|
|
14370
|
+
liveSnapshot.nodes.filter((n) => !n.hidden).map((n) => [n.id, n])
|
|
14371
|
+
);
|
|
14372
|
+
const centreOf = (n) => {
|
|
14373
|
+
const w = n.width ?? DEFAULT_NODE_WIDTH2;
|
|
14374
|
+
const h = n.height ?? DEFAULT_NODE_HEIGHT2;
|
|
14375
|
+
return { x: n.position.x + w / 2, y: n.position.y + h / 2 };
|
|
14376
|
+
};
|
|
14346
14377
|
return liveSnapshot.edges.flatMap((e) => {
|
|
14378
|
+
if (e.hidden) return [];
|
|
14347
14379
|
const s = nodeIndex.get(e.source);
|
|
14348
14380
|
const t = nodeIndex.get(e.target);
|
|
14349
14381
|
if (!s || !t) return [];
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14382
|
+
const srcDesc = handleRegistry?.resolve(
|
|
14383
|
+
s.id,
|
|
14384
|
+
"source",
|
|
14385
|
+
e.sourceHandle ?? "default"
|
|
14386
|
+
);
|
|
14387
|
+
const tgtDesc = handleRegistry?.resolve(
|
|
14388
|
+
t.id,
|
|
14389
|
+
"target",
|
|
14390
|
+
e.targetHandle ?? "default"
|
|
14391
|
+
);
|
|
14392
|
+
const from = srcDesc ? handleCentre(s, srcDesc.side, srcDesc.index, srcDesc.total) : (
|
|
14393
|
+
// Fallback: source defaults to bottom centre (matches the
|
|
14394
|
+
// canvas's source default before any Handle registers).
|
|
14395
|
+
s.sourcePosition ? handleCentre(s, s.sourcePosition, 0, 1) : centreOf(s)
|
|
14396
|
+
);
|
|
14397
|
+
const to = tgtDesc ? handleCentre(t, tgtDesc.side, tgtDesc.index, tgtDesc.total) : (
|
|
14398
|
+
// Fallback: target defaults to top centre.
|
|
14399
|
+
t.targetPosition ? handleCentre(t, t.targetPosition, 0, 1) : centreOf(t)
|
|
14400
|
+
);
|
|
14401
|
+
return [{ from, to }];
|
|
14356
14402
|
});
|
|
14357
|
-
}, [edgesProp, liveSnapshot,
|
|
14403
|
+
}, [edgesProp, liveSnapshot, handleRegistry, registryVersion]);
|
|
14358
14404
|
const minimapRef = useRef27(null);
|
|
14359
14405
|
const [canvasSize, setCanvasSize] = useState26(null);
|
|
14360
14406
|
useEffect22(() => {
|
|
@@ -18325,7 +18371,10 @@ var MultiSelect = forwardRef60(
|
|
|
18325
18371
|
"aria-label": labelId ? void 0 : ariaLabel ?? placeholder,
|
|
18326
18372
|
"aria-disabled": disabled,
|
|
18327
18373
|
tabIndex: disabled ? -1 : 0,
|
|
18328
|
-
onClick: () =>
|
|
18374
|
+
onClick: () => {
|
|
18375
|
+
if (disabled) return;
|
|
18376
|
+
setOpen((prev) => !prev);
|
|
18377
|
+
},
|
|
18329
18378
|
onKeyDown: (e) => {
|
|
18330
18379
|
if (disabled) return;
|
|
18331
18380
|
if (!open && (e.key === "Enter" || e.key === " " || e.key === "ArrowDown")) {
|