@particle-academy/fancy-flow 0.5.2 → 0.5.4
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/README.md +51 -1
- package/dist/{chunk-35OXF6W3.js → chunk-M2XKGQQL.js} +3 -3
- package/dist/{chunk-35OXF6W3.js.map → chunk-M2XKGQQL.js.map} +1 -1
- package/dist/{chunk-2BZ6OE5H.js → chunk-NF6NPY5N.js} +61 -30
- package/dist/chunk-NF6NPY5N.js.map +1 -0
- package/dist/{chunk-DW66NGU5.js → chunk-NVULCEDX.js} +4 -4
- package/dist/{chunk-DW66NGU5.js.map → chunk-NVULCEDX.js.map} +1 -1
- package/dist/{chunk-4PZQRN5Y.js → chunk-QSSQRQN4.js} +4 -4
- package/dist/{chunk-4PZQRN5Y.js.map → chunk-QSSQRQN4.js.map} +1 -1
- package/dist/engine.cjs +2 -2
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.js +1 -1
- package/dist/index.cjs +61 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -6
- package/dist/registry.cjs +59 -28
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.js +2 -2
- package/dist/runtime.cjs +61 -30
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +3 -3
- package/package.json +8 -3
- package/dist/chunk-2BZ6OE5H.js.map +0 -1
package/dist/registry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { BUILTIN_KINDS, RegistryNode, buildNodeTypes, registerBuiltinKinds } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { BUILTIN_KINDS, RegistryNode, buildNodeTypes, registerBuiltinKinds } from './chunk-M2XKGQQL.js';
|
|
2
|
+
import './chunk-NF6NPY5N.js';
|
|
3
3
|
export { categoryAccent, defaultConfigFor, getNodeKind, listNodeKinds, onNodeKindsChanged, registerNodeKind, validateConfig } from './chunk-WNVBXXOL.js';
|
|
4
4
|
//# sourceMappingURL=registry.js.map
|
|
5
5
|
//# sourceMappingURL=registry.js.map
|
package/dist/runtime.cjs
CHANGED
|
@@ -31,8 +31,8 @@ async function runFlow(graph, executors, onEvent = () => {
|
|
|
31
31
|
if (errors.length) break;
|
|
32
32
|
const incoming = incomingByNode.get(node.id) ?? [];
|
|
33
33
|
if (incoming.length > 0) {
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
34
|
+
const anyActive = incoming.some((e) => portValues.has(`${e.source}:${e.sourceHandle ?? "out"}`));
|
|
35
|
+
if (!anyActive) {
|
|
36
36
|
onEvent({ type: "node-status", nodeId: node.id, status: "idle", text: "skipped" });
|
|
37
37
|
continue;
|
|
38
38
|
}
|
|
@@ -3183,7 +3183,7 @@ function zoom_default2() {
|
|
|
3183
3183
|
|
|
3184
3184
|
// node_modules/@xyflow/system/dist/esm/index.js
|
|
3185
3185
|
var errorMessages = {
|
|
3186
|
-
error001: (lib = "react") => `Seems like you have not used
|
|
3186
|
+
error001: (lib = "react") => `Seems like you have not used ${lib === "svelte" ? "SvelteFlowProvider" : "ReactFlowProvider"} as an ancestor. Help: https://${lib}flow.dev/error#001`,
|
|
3187
3187
|
error002: () => "It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",
|
|
3188
3188
|
error003: (nodeType) => `Node type "${nodeType}" not found. Using fallback type "default".`,
|
|
3189
3189
|
error004: () => "The parent container needs a width and a height to render the graph.",
|
|
@@ -3322,21 +3322,21 @@ var getInternalNodesBounds = (nodeLookup, params = {}) => {
|
|
|
3322
3322
|
return hasVisibleNodes ? boxToRect(box) : { x: 0, y: 0, width: 0, height: 0 };
|
|
3323
3323
|
};
|
|
3324
3324
|
var getNodesInside = (nodes, rect, [tx, ty, tScale] = [0, 0, 1], partially = false, excludeNonSelectableNodes = false) => {
|
|
3325
|
-
const
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
};
|
|
3325
|
+
const paneX = (rect.x - tx) / tScale;
|
|
3326
|
+
const paneY = (rect.y - ty) / tScale;
|
|
3327
|
+
const paneWidth = rect.width / tScale;
|
|
3328
|
+
const paneHeight = rect.height / tScale;
|
|
3330
3329
|
const visibleNodes = [];
|
|
3331
3330
|
for (const node of nodes.values()) {
|
|
3332
3331
|
const { measured, selectable = true, hidden = false } = node;
|
|
3333
3332
|
if (excludeNonSelectableNodes && !selectable || hidden) {
|
|
3334
3333
|
continue;
|
|
3335
3334
|
}
|
|
3336
|
-
const width = measured.width ?? node.width ?? node.initialWidth ??
|
|
3337
|
-
const height = measured.height ?? node.height ?? node.initialHeight ??
|
|
3338
|
-
const
|
|
3339
|
-
const
|
|
3335
|
+
const width = measured.width ?? node.width ?? node.initialWidth ?? 0;
|
|
3336
|
+
const height = measured.height ?? node.height ?? node.initialHeight ?? 0;
|
|
3337
|
+
const { x, y } = node.internals.positionAbsolute;
|
|
3338
|
+
const overlappingArea = getRectsOverlappingArea(paneX, paneY, paneWidth, paneHeight, x, y, width, height);
|
|
3339
|
+
const area = width * height;
|
|
3340
3340
|
const partiallyVisible = partially && overlappingArea > 0;
|
|
3341
3341
|
const forceInitialRender = !node.internals.handleBounds;
|
|
3342
3342
|
const isVisible = forceInitialRender || partiallyVisible || overlappingArea >= area;
|
|
@@ -3516,11 +3516,12 @@ var nodeToBox = (node, nodeOrigin = [0, 0]) => {
|
|
|
3516
3516
|
};
|
|
3517
3517
|
};
|
|
3518
3518
|
var getBoundsOfRects = (rect1, rect2) => boxToRect(getBoundsOfBoxes(rectToBox(rect1), rectToBox(rect2)));
|
|
3519
|
-
var
|
|
3520
|
-
const xOverlap = Math.max(0, Math.min(
|
|
3521
|
-
const yOverlap = Math.max(0, Math.min(
|
|
3519
|
+
var getRectsOverlappingArea = (aX, aY, aWidth, aHeight, bX, bY, bWidth, bHeight) => {
|
|
3520
|
+
const xOverlap = Math.max(0, Math.min(aX + aWidth, bX + bWidth) - Math.max(aX, bX));
|
|
3521
|
+
const yOverlap = Math.max(0, Math.min(aY + aHeight, bY + bHeight) - Math.max(aY, bY));
|
|
3522
3522
|
return Math.ceil(xOverlap * yOverlap);
|
|
3523
3523
|
};
|
|
3524
|
+
var getOverlappingArea = (rectA, rectB) => getRectsOverlappingArea(rectA.x, rectA.y, rectA.width, rectA.height, rectB.x, rectB.y, rectB.width, rectB.height);
|
|
3524
3525
|
var isRectObject = (obj) => isNumeric(obj.width) && isNumeric(obj.height) && isNumeric(obj.x) && isNumeric(obj.y);
|
|
3525
3526
|
var isNumeric = (n) => !isNaN(n) && isFinite(n);
|
|
3526
3527
|
var createDevWarn = (lib, helpUrl) => (id2, message) => {
|
|
@@ -5982,11 +5983,12 @@ var Panel = ReactExports.forwardRef(({ position = "top-left", children: children
|
|
|
5982
5983
|
return jsxRuntime.jsx("div", { className: cc(["react-flow__panel", className, ...positionClasses]), style: style2, ref, ...rest, children: children2 });
|
|
5983
5984
|
});
|
|
5984
5985
|
Panel.displayName = "Panel";
|
|
5986
|
+
var link = `https://reactflow.dev${process.env.NODE_ENV === "production" ? "?utm_source=attribution" : "/attribution"}`;
|
|
5985
5987
|
function Attribution({ proOptions, position = "bottom-right" }) {
|
|
5986
5988
|
if (proOptions?.hideAttribution) {
|
|
5987
5989
|
return null;
|
|
5988
5990
|
}
|
|
5989
|
-
return jsxRuntime.jsx(Panel, { position, className: "react-flow__attribution", "data-message":
|
|
5991
|
+
return jsxRuntime.jsx(Panel, { position, className: "react-flow__attribution", "data-message": `Please only hide this attribution when you are subscribed to React Flow Pro: ${link}`, children: jsxRuntime.jsx("a", { href: link, target: "_blank", rel: "noopener noreferrer", "aria-label": "React Flow attribution", children: "React Flow" }) });
|
|
5990
5992
|
}
|
|
5991
5993
|
var selector$m = (s) => {
|
|
5992
5994
|
const selectedNodes = [];
|
|
@@ -6913,7 +6915,6 @@ var wrapHandler = (handler, containerRef) => {
|
|
|
6913
6915
|
var selector$h = (s) => ({
|
|
6914
6916
|
userSelectionActive: s.userSelectionActive,
|
|
6915
6917
|
elementsSelectable: s.elementsSelectable,
|
|
6916
|
-
connectionInProgress: s.connection.inProgress,
|
|
6917
6918
|
dragging: s.paneDragging,
|
|
6918
6919
|
panBy: s.panBy,
|
|
6919
6920
|
autoPanSpeed: s.autoPanSpeed
|
|
@@ -6921,18 +6922,20 @@ var selector$h = (s) => ({
|
|
|
6921
6922
|
function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, autoPanOnSelection, paneClickDistance, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children: children2 }) {
|
|
6922
6923
|
const autoPanId = ReactExports.useRef(0);
|
|
6923
6924
|
const store = useStoreApi();
|
|
6924
|
-
const { userSelectionActive, elementsSelectable, dragging,
|
|
6925
|
+
const { userSelectionActive, elementsSelectable, dragging, panBy: panBy2, autoPanSpeed } = useStore(selector$h, shallow$1);
|
|
6925
6926
|
const isSelectionEnabled = elementsSelectable && (isSelecting || userSelectionActive);
|
|
6926
6927
|
const container = ReactExports.useRef(null);
|
|
6927
6928
|
const containerBounds = ReactExports.useRef();
|
|
6928
6929
|
const selectedNodeIds = ReactExports.useRef(/* @__PURE__ */ new Set());
|
|
6929
6930
|
const selectedEdgeIds = ReactExports.useRef(/* @__PURE__ */ new Set());
|
|
6931
|
+
const connectionEndedOnPane = ReactExports.useRef(false);
|
|
6930
6932
|
const selectionInProgress = ReactExports.useRef(false);
|
|
6931
6933
|
const position = ReactExports.useRef({ x: 0, y: 0 });
|
|
6932
6934
|
const autoPanStarted = ReactExports.useRef(false);
|
|
6933
6935
|
const onClick = (event) => {
|
|
6934
|
-
if (selectionInProgress.current ||
|
|
6936
|
+
if (selectionInProgress.current || connectionEndedOnPane.current || store.getState().connection.inProgress) {
|
|
6935
6937
|
selectionInProgress.current = false;
|
|
6938
|
+
connectionEndedOnPane.current = false;
|
|
6936
6939
|
return;
|
|
6937
6940
|
}
|
|
6938
6941
|
onPaneClick?.(event);
|
|
@@ -7077,6 +7080,12 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
7077
7080
|
commitUserSelectionRect(mouseX, mouseY);
|
|
7078
7081
|
};
|
|
7079
7082
|
const onPointerUp = (event) => {
|
|
7083
|
+
if (!isSelectionEnabled) {
|
|
7084
|
+
if (event.target === container.current && store.getState().connection.inProgress) {
|
|
7085
|
+
connectionEndedOnPane.current = true;
|
|
7086
|
+
}
|
|
7087
|
+
return;
|
|
7088
|
+
}
|
|
7080
7089
|
if (event.button !== 0) {
|
|
7081
7090
|
return;
|
|
7082
7091
|
}
|
|
@@ -7101,7 +7110,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
|
|
|
7101
7110
|
cleanupAutoPan();
|
|
7102
7111
|
};
|
|
7103
7112
|
const draggable = panOnDrag === true || Array.isArray(panOnDrag) && panOnDrag.includes(0);
|
|
7104
|
-
return jsxRuntime.jsxs("div", { className: cc(["react-flow__pane", { draggable, dragging, selection: isSelecting }]), onClick: isSelectionEnabled ? void 0 : wrapHandler(onClick, container), onContextMenu: wrapHandler(onContextMenu, container), onWheel: wrapHandler(onWheel, container), onPointerEnter: isSelectionEnabled ? void 0 : onPaneMouseEnter, onPointerMove: isSelectionEnabled ? onPointerMove : onPaneMouseMove, onPointerUp
|
|
7113
|
+
return jsxRuntime.jsxs("div", { className: cc(["react-flow__pane", { draggable, dragging, selection: isSelecting }]), onClick: isSelectionEnabled ? void 0 : wrapHandler(onClick, container), onContextMenu: wrapHandler(onContextMenu, container), onWheel: wrapHandler(onWheel, container), onPointerEnter: isSelectionEnabled ? void 0 : onPaneMouseEnter, onPointerMove: isSelectionEnabled ? onPointerMove : onPaneMouseMove, onPointerUp, onPointerCancel: isSelectionEnabled ? onPointerCancel : void 0, onPointerDownCapture: isSelectionEnabled ? onPointerDownCapture : void 0, onClickCapture: isSelectionEnabled ? onClickCapture : void 0, onPointerLeave: onPaneMouseLeave, ref: container, style: containerStyle, children: [children2, jsxRuntime.jsx(UserSelection, {})] });
|
|
7105
7114
|
}
|
|
7106
7115
|
function handleNodeClick({ id: id2, store, unselect = false, nodeRef }) {
|
|
7107
7116
|
const { addSelectedNodes, unselectNodesAndEdges, multiSelectionActive, nodeLookup, onError } = store.getState();
|
|
@@ -7208,9 +7217,33 @@ var selector$g = (s) => ({
|
|
|
7208
7217
|
noPanClassName: s.noPanClassName,
|
|
7209
7218
|
rfId: s.rfId
|
|
7210
7219
|
});
|
|
7220
|
+
var HandleConfigContext = ReactExports.createContext(null);
|
|
7221
|
+
function HandleConfigProvider({ children: children2 }) {
|
|
7222
|
+
const config = useStore(selector$g, shallow$1);
|
|
7223
|
+
return jsxRuntime.jsx(HandleConfigContext.Provider, { value: config, children: children2 });
|
|
7224
|
+
}
|
|
7225
|
+
function useHandleConfig() {
|
|
7226
|
+
const config = ReactExports.useContext(HandleConfigContext);
|
|
7227
|
+
if (!config) {
|
|
7228
|
+
throw new Error("useHandleConfig must be used within a HandleConfigProvider");
|
|
7229
|
+
}
|
|
7230
|
+
return config;
|
|
7231
|
+
}
|
|
7232
|
+
var idleConnectingState = {
|
|
7233
|
+
connectingFrom: false,
|
|
7234
|
+
connectingTo: false,
|
|
7235
|
+
clickConnecting: false,
|
|
7236
|
+
isPossibleEndHandle: true,
|
|
7237
|
+
connectionInProcess: false,
|
|
7238
|
+
clickConnectionInProcess: false,
|
|
7239
|
+
valid: false
|
|
7240
|
+
};
|
|
7211
7241
|
var connectingSelector = (nodeId, handleId, type) => (state) => {
|
|
7212
7242
|
const { connectionClickStartHandle: clickHandle, connectionMode, connection } = state;
|
|
7213
7243
|
const { fromHandle, toHandle, isValid } = connection;
|
|
7244
|
+
if (!fromHandle && !clickHandle) {
|
|
7245
|
+
return idleConnectingState;
|
|
7246
|
+
}
|
|
7214
7247
|
const connectingTo = toHandle?.nodeId === nodeId && toHandle?.id === handleId && toHandle?.type === type;
|
|
7215
7248
|
return {
|
|
7216
7249
|
connectingFrom: fromHandle?.nodeId === nodeId && fromHandle?.id === handleId && fromHandle?.type === type,
|
|
@@ -7227,7 +7260,7 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
|
|
|
7227
7260
|
const isTarget = type === "target";
|
|
7228
7261
|
const store = useStoreApi();
|
|
7229
7262
|
const nodeId = useNodeId();
|
|
7230
|
-
const { connectOnClick, noPanClassName, rfId } =
|
|
7263
|
+
const { connectOnClick, noPanClassName, rfId } = useHandleConfig();
|
|
7231
7264
|
const { connectingFrom, connectingTo, clickConnecting, isPossibleEndHandle, connectionInProcess, clickConnectionInProcess, valid } = useStore(connectingSelector(nodeId, handleId, type), shallow$1);
|
|
7232
7265
|
if (!nodeId) {
|
|
7233
7266
|
store.getState().onError?.("010", errorMessages["error010"]());
|
|
@@ -7930,7 +7963,8 @@ var nullPosition = {
|
|
|
7930
7963
|
targetX: null,
|
|
7931
7964
|
targetY: null,
|
|
7932
7965
|
sourcePosition: null,
|
|
7933
|
-
targetPosition: null
|
|
7966
|
+
targetPosition: null,
|
|
7967
|
+
zIndex: void 0
|
|
7934
7968
|
};
|
|
7935
7969
|
var shiftX = (x, shift, position) => {
|
|
7936
7970
|
if (position === Position.Left)
|
|
@@ -8018,14 +8052,11 @@ function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSele
|
|
|
8018
8052
|
const [updateHover, setUpdateHover] = ReactExports.useState(false);
|
|
8019
8053
|
const [reconnecting, setReconnecting] = ReactExports.useState(false);
|
|
8020
8054
|
const store = useStoreApi();
|
|
8021
|
-
const { zIndex, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition } = useStore(ReactExports.useCallback((store2) => {
|
|
8055
|
+
const { zIndex = edge.zIndex, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition } = useStore(ReactExports.useCallback((store2) => {
|
|
8022
8056
|
const sourceNode = store2.nodeLookup.get(edge.source);
|
|
8023
8057
|
const targetNode = store2.nodeLookup.get(edge.target);
|
|
8024
8058
|
if (!sourceNode || !targetNode) {
|
|
8025
|
-
return
|
|
8026
|
-
zIndex: edge.zIndex,
|
|
8027
|
-
...nullPosition
|
|
8028
|
-
};
|
|
8059
|
+
return nullPosition;
|
|
8029
8060
|
}
|
|
8030
8061
|
const edgePosition = getEdgePosition({
|
|
8031
8062
|
id: id2,
|
|
@@ -8045,8 +8076,8 @@ function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSele
|
|
|
8045
8076
|
zIndexMode: store2.zIndexMode
|
|
8046
8077
|
});
|
|
8047
8078
|
return {
|
|
8048
|
-
|
|
8049
|
-
|
|
8079
|
+
...edgePosition || nullPosition,
|
|
8080
|
+
zIndex: zIndex2
|
|
8050
8081
|
};
|
|
8051
8082
|
}, [edge.source, edge.target, edge.sourceHandle, edge.targetHandle, edge.selected, edge.zIndex]), shallow$1);
|
|
8052
8083
|
const markerStartUrl = ReactExports.useMemo(() => edge.markerStart ? `url('#${getMarkerId(edge.markerStart, rfId)}')` : void 0, [edge.markerStart, rfId]);
|
|
@@ -8644,7 +8675,7 @@ function ReactFlowProvider({ initialNodes: nodes, initialEdges: edges, defaultNo
|
|
|
8644
8675
|
nodeExtent,
|
|
8645
8676
|
zIndexMode
|
|
8646
8677
|
}));
|
|
8647
|
-
return jsxRuntime.jsx(Provider$1, { value: store, children: jsxRuntime.jsx(BatchProvider, { children: children2 }) });
|
|
8678
|
+
return jsxRuntime.jsx(Provider$1, { value: store, children: jsxRuntime.jsx(BatchProvider, { children: jsxRuntime.jsx(HandleConfigProvider, { children: children2 }) }) });
|
|
8648
8679
|
}
|
|
8649
8680
|
function Wrapper({ children: children2, nodes, edges, defaultNodes, defaultEdges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, zIndexMode }) {
|
|
8650
8681
|
const isWrapped = ReactExports.useContext(StoreContext);
|