@aloudata/ink-flow 1.0.0
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 +5 -0
- package/dist/base.css +6 -0
- package/dist/components/A11yDescriptions/index.d.ts +8 -0
- package/dist/components/A11yDescriptions/index.d.ts.map +1 -0
- package/dist/components/BatchProvider/index.d.ts +17 -0
- package/dist/components/BatchProvider/index.d.ts.map +1 -0
- package/dist/components/BatchProvider/types.d.ts +7 -0
- package/dist/components/BatchProvider/types.d.ts.map +1 -0
- package/dist/components/BatchProvider/useQueue.d.ts +11 -0
- package/dist/components/BatchProvider/useQueue.d.ts.map +1 -0
- package/dist/components/EdgeWrapper/EdgeUpdateAnchors.d.ts +17 -0
- package/dist/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -0
- package/dist/components/EdgeWrapper/index.d.ts +3 -0
- package/dist/components/EdgeWrapper/index.d.ts.map +1 -0
- package/dist/components/EdgeWrapper/utils.d.ts +11 -0
- package/dist/components/EdgeWrapper/utils.d.ts.map +1 -0
- package/dist/components/Edges/BaseEdge.d.ts +3 -0
- package/dist/components/Edges/BaseEdge.d.ts.map +1 -0
- package/dist/components/Edges/BezierEdge.d.ts +5 -0
- package/dist/components/Edges/BezierEdge.d.ts.map +1 -0
- package/dist/components/Edges/EdgeAnchor.d.ts +14 -0
- package/dist/components/Edges/EdgeAnchor.d.ts.map +1 -0
- package/dist/components/Edges/EdgeText.d.ts +8 -0
- package/dist/components/Edges/EdgeText.d.ts.map +1 -0
- package/dist/components/Edges/SimpleBezierEdge.d.ts +21 -0
- package/dist/components/Edges/SimpleBezierEdge.d.ts.map +1 -0
- package/dist/components/Edges/SmoothStepEdge.d.ts +5 -0
- package/dist/components/Edges/SmoothStepEdge.d.ts.map +1 -0
- package/dist/components/Edges/StepEdge.d.ts +5 -0
- package/dist/components/Edges/StepEdge.d.ts.map +1 -0
- package/dist/components/Edges/StraightEdge.d.ts +5 -0
- package/dist/components/Edges/StraightEdge.d.ts.map +1 -0
- package/dist/components/Edges/index.d.ts +6 -0
- package/dist/components/Edges/index.d.ts.map +1 -0
- package/dist/components/Handle/index.d.ts +9 -0
- package/dist/components/Handle/index.d.ts.map +1 -0
- package/dist/components/InkFlowProvider/index.d.ts +14 -0
- package/dist/components/InkFlowProvider/index.d.ts.map +1 -0
- package/dist/components/NodeWrapper/index.d.ts +3 -0
- package/dist/components/NodeWrapper/index.d.ts.map +1 -0
- package/dist/components/NodeWrapper/useNodeObserver.d.ts +14 -0
- package/dist/components/NodeWrapper/useNodeObserver.d.ts.map +1 -0
- package/dist/components/NodeWrapper/utils.d.ts +9 -0
- package/dist/components/NodeWrapper/utils.d.ts.map +1 -0
- package/dist/components/Nodes/DefaultNode.d.ts +3 -0
- package/dist/components/Nodes/DefaultNode.d.ts.map +1 -0
- package/dist/components/Nodes/GroupNode.d.ts +2 -0
- package/dist/components/Nodes/GroupNode.d.ts.map +1 -0
- package/dist/components/Nodes/InputNode.d.ts +4 -0
- package/dist/components/Nodes/InputNode.d.ts.map +1 -0
- package/dist/components/Nodes/OutputNode.d.ts +3 -0
- package/dist/components/Nodes/OutputNode.d.ts.map +1 -0
- package/dist/components/Nodes/utils.d.ts +13 -0
- package/dist/components/Nodes/utils.d.ts.map +1 -0
- package/dist/components/Panel/index.d.ts +11 -0
- package/dist/components/Panel/index.d.ts.map +1 -0
- package/dist/components/StoreUpdater/index.d.ts +9 -0
- package/dist/components/StoreUpdater/index.d.ts.map +1 -0
- package/dist/components/UserSelection/index.d.ts +2 -0
- package/dist/components/UserSelection/index.d.ts.map +1 -0
- package/dist/constants/errorMessages.d.ts +22 -0
- package/dist/constants/errorMessages.d.ts.map +1 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/container/EdgeRenderer/MarkerDefinitions.d.ts +10 -0
- package/dist/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -0
- package/dist/container/EdgeRenderer/MarkerSymbols.d.ts +9 -0
- package/dist/container/EdgeRenderer/MarkerSymbols.d.ts.map +1 -0
- package/dist/container/EdgeRenderer/index.d.ts +13 -0
- package/dist/container/EdgeRenderer/index.d.ts.map +1 -0
- package/dist/container/FlowRenderer/index.d.ts +14 -0
- package/dist/container/FlowRenderer/index.d.ts.map +1 -0
- package/dist/container/GraphView/index.d.ts +11 -0
- package/dist/container/GraphView/index.d.ts.map +1 -0
- package/dist/container/InkFlow/Wrapper.d.ts +13 -0
- package/dist/container/InkFlow/Wrapper.d.ts.map +1 -0
- package/dist/container/InkFlow/index.d.ts +4 -0
- package/dist/container/InkFlow/index.d.ts.map +1 -0
- package/dist/container/InkFlow/init-values.d.ts +4 -0
- package/dist/container/InkFlow/init-values.d.ts.map +1 -0
- package/dist/container/NodeRenderer/index.d.ts +10 -0
- package/dist/container/NodeRenderer/index.d.ts.map +1 -0
- package/dist/container/NodeRenderer/useResizeObserver.d.ts +2 -0
- package/dist/container/NodeRenderer/useResizeObserver.d.ts.map +1 -0
- package/dist/container/Pane/index.d.ts +12 -0
- package/dist/container/Pane/index.d.ts.map +1 -0
- package/dist/container/Viewport/index.d.ts +7 -0
- package/dist/container/Viewport/index.d.ts.map +1 -0
- package/dist/container/ZoomPane/index.d.ts +7 -0
- package/dist/container/ZoomPane/index.d.ts.map +1 -0
- package/dist/contexts/NodeIdContext.d.ts +6 -0
- package/dist/contexts/NodeIdContext.d.ts.map +1 -0
- package/dist/contexts/StoreContext.d.ts +4 -0
- package/dist/contexts/StoreContext.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useDrag.d.ts +12 -0
- package/dist/hooks/useDrag.d.ts.map +1 -0
- package/dist/hooks/useEdgesState.d.ts +4 -0
- package/dist/hooks/useEdgesState.d.ts.map +1 -0
- package/dist/hooks/useGlobalKeyHandler.d.ts +11 -0
- package/dist/hooks/useGlobalKeyHandler.d.ts.map +1 -0
- package/dist/hooks/useInkFlow.d.ts +10 -0
- package/dist/hooks/useInkFlow.d.ts.map +1 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/dist/hooks/useKeyPress.d.ts +15 -0
- package/dist/hooks/useKeyPress.d.ts.map +1 -0
- package/dist/hooks/useMoveSelectedNodes.d.ts +12 -0
- package/dist/hooks/useMoveSelectedNodes.d.ts.map +1 -0
- package/dist/hooks/useNodesState.d.ts +4 -0
- package/dist/hooks/useNodesState.d.ts.map +1 -0
- package/dist/hooks/useResizeHandler.d.ts +8 -0
- package/dist/hooks/useResizeHandler.d.ts.map +1 -0
- package/dist/hooks/useStore.d.ts +21 -0
- package/dist/hooks/useStore.d.ts.map +1 -0
- package/dist/hooks/useViewportHelper.d.ts +10 -0
- package/dist/hooks/useViewportHelper.d.ts.map +1 -0
- package/dist/hooks/useVisibleEdgeIds.d.ts +9 -0
- package/dist/hooks/useVisibleEdgeIds.d.ts.map +1 -0
- package/dist/hooks/useVisibleNodeIds.d.ts +9 -0
- package/dist/hooks/useVisibleNodeIds.d.ts.map +1 -0
- package/dist/index.cjs.js +17 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +17 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/plugins/Controls/ControlButton.d.ts +3 -0
- package/dist/plugins/Controls/ControlButton.d.ts.map +1 -0
- package/dist/plugins/Controls/Controls.d.ts +8 -0
- package/dist/plugins/Controls/Controls.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/FitView.d.ts +2 -0
- package/dist/plugins/Controls/Icons/FitView.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/Lock.d.ts +2 -0
- package/dist/plugins/Controls/Icons/Lock.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/Minus.d.ts +2 -0
- package/dist/plugins/Controls/Icons/Minus.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/Plus.d.ts +2 -0
- package/dist/plugins/Controls/Icons/Plus.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/Unlock.d.ts +2 -0
- package/dist/plugins/Controls/Icons/Unlock.d.ts.map +1 -0
- package/dist/plugins/Controls/index.d.ts +4 -0
- package/dist/plugins/Controls/index.d.ts.map +1 -0
- package/dist/plugins/Controls/types.d.ts +35 -0
- package/dist/plugins/Controls/types.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/store/index.d.ts +12 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/initialState.d.ts +12 -0
- package/dist/store/initialState.d.ts.map +1 -0
- package/dist/style.css +817 -0
- package/dist/styles/utils.d.ts +3 -0
- package/dist/styles/utils.d.ts.map +1 -0
- package/dist/types/edges.d.ts +114 -0
- package/dist/types/edges.d.ts.map +1 -0
- package/dist/types/general.d.ts +123 -0
- package/dist/types/general.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/instance.d.ts +149 -0
- package/dist/types/instance.d.ts.map +1 -0
- package/dist/types/nodes.d.ts +40 -0
- package/dist/types/nodes.d.ts.map +1 -0
- package/dist/types/props.d.ts +151 -0
- package/dist/types/props.d.ts.map +1 -0
- package/dist/types/store.d.ts +105 -0
- package/dist/types/store.d.ts.map +1 -0
- package/dist/types/system/changes.d.ts +51 -0
- package/dist/types/system/changes.d.ts.map +1 -0
- package/dist/types/system/edges.d.ts +83 -0
- package/dist/types/system/edges.d.ts.map +1 -0
- package/dist/types/system/general.d.ts +119 -0
- package/dist/types/system/general.d.ts.map +1 -0
- package/dist/types/system/handles.d.ts +51 -0
- package/dist/types/system/handles.d.ts.map +1 -0
- package/dist/types/system/index.d.ts +8 -0
- package/dist/types/system/index.d.ts.map +1 -0
- package/dist/types/system/nodes.d.ts +126 -0
- package/dist/types/system/nodes.d.ts.map +1 -0
- package/dist/types/system/panzoom.d.ts +49 -0
- package/dist/types/system/panzoom.d.ts.map +1 -0
- package/dist/types/system/utils.d.ts +25 -0
- package/dist/types/system/utils.d.ts.map +1 -0
- package/dist/types/utils/types.d.ts +8 -0
- package/dist/types/utils/types.d.ts.map +1 -0
- package/dist/utils/bezier-edge.d.ts +59 -0
- package/dist/utils/bezier-edge.d.ts.map +1 -0
- package/dist/utils/changes.d.ts +16 -0
- package/dist/utils/changes.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +20 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/dist/utils/edges/bezier-edge.d.ts +59 -0
- package/dist/utils/edges/bezier-edge.d.ts.map +1 -0
- package/dist/utils/edges/general.d.ts +46 -0
- package/dist/utils/edges/general.d.ts.map +1 -0
- package/dist/utils/edges/index.d.ts +6 -0
- package/dist/utils/edges/index.d.ts.map +1 -0
- package/dist/utils/edges/positions.d.ts +12 -0
- package/dist/utils/edges/positions.d.ts.map +1 -0
- package/dist/utils/edges/smoothstep-edge.d.ts +43 -0
- package/dist/utils/edges/smoothstep-edge.d.ts.map +1 -0
- package/dist/utils/edges/straight-edge.d.ts +28 -0
- package/dist/utils/edges/straight-edge.d.ts.map +1 -0
- package/dist/utils/edges.d.ts +26 -0
- package/dist/utils/edges.d.ts.map +1 -0
- package/dist/utils/general.d.ts +61 -0
- package/dist/utils/general.d.ts.map +1 -0
- package/dist/utils/graph.d.ts +113 -0
- package/dist/utils/graph.d.ts.map +1 -0
- package/dist/utils/marker.d.ts +9 -0
- package/dist/utils/marker.d.ts.map +1 -0
- package/dist/utils/positions.d.ts +12 -0
- package/dist/utils/positions.d.ts.map +1 -0
- package/dist/utils/smoothstep-edge.d.ts +43 -0
- package/dist/utils/smoothstep-edge.d.ts.map +1 -0
- package/dist/utils/store.d.ts +30 -0
- package/dist/utils/store.d.ts.map +1 -0
- package/dist/utils/straight-edge.d.ts +34 -0
- package/dist/utils/straight-edge.d.ts.map +1 -0
- package/dist/utils/xydrag/XYDrag.d.ts +52 -0
- package/dist/utils/xydrag/XYDrag.d.ts.map +1 -0
- package/dist/utils/xydrag/index.d.ts +2 -0
- package/dist/utils/xydrag/index.d.ts.map +1 -0
- package/dist/utils/xydrag/utils.d.ts +10 -0
- package/dist/utils/xydrag/utils.d.ts.map +1 -0
- package/dist/utils/xyhandle/XYHandle.d.ts +49 -0
- package/dist/utils/xyhandle/XYHandle.d.ts.map +1 -0
- package/dist/utils/xyhandle/index.d.ts +2 -0
- package/dist/utils/xyhandle/index.d.ts.map +1 -0
- package/dist/utils/xyhandle/utils.d.ts +14 -0
- package/dist/utils/xyhandle/utils.d.ts.map +1 -0
- package/dist/utils/xypanzoom/XYPanZoom.d.ts +12 -0
- package/dist/utils/xypanzoom/XYPanZoom.d.ts.map +1 -0
- package/dist/utils/xypanzoom/eventhandler.d.ts +46 -0
- package/dist/utils/xypanzoom/eventhandler.d.ts.map +1 -0
- package/dist/utils/xypanzoom/filter.d.ts +14 -0
- package/dist/utils/xypanzoom/filter.d.ts.map +1 -0
- package/dist/utils/xypanzoom/index.d.ts +2 -0
- package/dist/utils/xypanzoom/index.d.ts.map +1 -0
- package/dist/utils/xypanzoom/utils.d.ts +10 -0
- package/dist/utils/xypanzoom/utils.d.ts.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/styles/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,cAAc,EAAE,aAM5B,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode, MouseEvent as ReactMouseEvent, HTMLAttributes } from 'react';
|
|
2
|
+
import { BezierPathOptions, Connection, DefaultEdgeOptionsBase, EdgeBase, EdgePosition, HandleType, OnError, SmoothStepPathOptions, StepPathOptions } from './system';
|
|
3
|
+
import { EdgeTypes } from './general';
|
|
4
|
+
export type Edge<EdgeData extends Record<string, unknown> = Record<string, unknown>, EdgeType extends string | undefined = string | undefined> = EdgeBase<EdgeData, EdgeType> & EdgeLabelOptions & {
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
className?: string;
|
|
7
|
+
updatable?: EdgeUpdatable;
|
|
8
|
+
focusable?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type EdgeLabelOptions = {
|
|
11
|
+
label?: string | ReactNode;
|
|
12
|
+
labelStyle?: CSSProperties;
|
|
13
|
+
labelShowBg?: boolean;
|
|
14
|
+
labelBgStyle?: CSSProperties;
|
|
15
|
+
labelBgPadding?: [number, number];
|
|
16
|
+
labelBgBorderRadius?: number;
|
|
17
|
+
};
|
|
18
|
+
export type EdgeUpdatable = boolean | HandleType;
|
|
19
|
+
export type OnEdgeUpdateFunc<EdgeType extends Edge = Edge> = (oldEdge: EdgeType, newConnection: Connection) => void;
|
|
20
|
+
export type EdgeMouseHandler<EdgeType extends Edge = Edge> = (event: ReactMouseEvent, edge: EdgeType) => void;
|
|
21
|
+
export type EdgeWrapperProps<EdgeType extends Edge = Edge> = {
|
|
22
|
+
id: string;
|
|
23
|
+
edgesFocusable: boolean;
|
|
24
|
+
edgesUpdatable: boolean;
|
|
25
|
+
elementsSelectable: boolean;
|
|
26
|
+
noPanClassName: string;
|
|
27
|
+
onClick?: EdgeMouseHandler<EdgeType>;
|
|
28
|
+
onDoubleClick?: EdgeMouseHandler<EdgeType>;
|
|
29
|
+
onEdgeUpdate?: OnEdgeUpdateFunc<EdgeType>;
|
|
30
|
+
onContextMenu?: EdgeMouseHandler<EdgeType>;
|
|
31
|
+
onMouseEnter?: EdgeMouseHandler<EdgeType>;
|
|
32
|
+
onMouseMove?: EdgeMouseHandler<EdgeType>;
|
|
33
|
+
onMouseLeave?: EdgeMouseHandler<EdgeType>;
|
|
34
|
+
edgeUpdaterRadius?: number;
|
|
35
|
+
onEdgeUpdateStart?: (event: ReactMouseEvent, edge: EdgeType, handleType: HandleType) => void;
|
|
36
|
+
onEdgeUpdateEnd?: (event: MouseEvent | TouchEvent, edge: EdgeType, handleType: HandleType) => void;
|
|
37
|
+
rfId?: string;
|
|
38
|
+
edgeTypes?: EdgeTypes;
|
|
39
|
+
onError?: OnError;
|
|
40
|
+
disableKeyboardA11y?: boolean;
|
|
41
|
+
};
|
|
42
|
+
export type EdgeProps<EdgeType extends Edge = Edge> = Pick<EdgeType, 'id' | 'animated' | 'data' | 'style' | 'selected' | 'source' | 'target'> & EdgePosition & EdgeLabelOptions & {
|
|
43
|
+
sourceHandleId?: string | null;
|
|
44
|
+
targetHandleId?: string | null;
|
|
45
|
+
markerStart?: string;
|
|
46
|
+
markerEnd?: string;
|
|
47
|
+
pathOptions?: any;
|
|
48
|
+
interactionWidth?: number;
|
|
49
|
+
};
|
|
50
|
+
export type DefaultEdgeOptions = DefaultEdgeOptionsBase<Edge>;
|
|
51
|
+
export type BaseEdgeProps = EdgeLabelOptions & {
|
|
52
|
+
/** Unique id of edge */
|
|
53
|
+
id?: string;
|
|
54
|
+
/** Additional padding where interacting with an edge is still possible */
|
|
55
|
+
interactionWidth?: number;
|
|
56
|
+
className?: string;
|
|
57
|
+
/** The x position of edge label */
|
|
58
|
+
labelX?: number;
|
|
59
|
+
/** The y position of edge label */
|
|
60
|
+
labelY?: number;
|
|
61
|
+
/** Marker at start of edge
|
|
62
|
+
* @example 'url(#arrow)'
|
|
63
|
+
*/
|
|
64
|
+
markerStart?: string;
|
|
65
|
+
/** Marker at end of edge
|
|
66
|
+
* @example 'url(#arrow)'
|
|
67
|
+
*/
|
|
68
|
+
markerEnd?: string;
|
|
69
|
+
/** SVG path of the edge */
|
|
70
|
+
path: string;
|
|
71
|
+
style?: CSSProperties;
|
|
72
|
+
};
|
|
73
|
+
export type EdgeComponentProps = EdgePosition & EdgeLabelOptions & {
|
|
74
|
+
id?: EdgeProps['id'];
|
|
75
|
+
markerStart?: EdgeProps['markerStart'];
|
|
76
|
+
markerEnd?: EdgeProps['markerEnd'];
|
|
77
|
+
interactionWidth?: EdgeProps['interactionWidth'];
|
|
78
|
+
style?: EdgeProps['style'];
|
|
79
|
+
sourceHandleId?: EdgeProps['sourceHandleId'];
|
|
80
|
+
targetHandleId?: EdgeProps['targetHandleId'];
|
|
81
|
+
};
|
|
82
|
+
export type EdgeComponentWithPathOptions<PathOptions> = EdgeComponentProps & {
|
|
83
|
+
pathOptions?: PathOptions;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* BezierEdge component props
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
89
|
+
export type BezierEdgeProps = EdgeComponentWithPathOptions<BezierPathOptions>;
|
|
90
|
+
/**
|
|
91
|
+
* SmoothStepEdge component props
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
export type SmoothStepEdgeProps = EdgeComponentWithPathOptions<SmoothStepPathOptions>;
|
|
95
|
+
/**
|
|
96
|
+
* StepEdge component props
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
export type StepEdgeProps = EdgeComponentWithPathOptions<StepPathOptions>;
|
|
100
|
+
/**
|
|
101
|
+
* StraightEdge component props
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
export type StraightEdgeProps = Omit<EdgeComponentProps, 'sourcePosition' | 'targetPosition'>;
|
|
105
|
+
/**
|
|
106
|
+
* SimpleBezier component props
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
export type SimpleBezierEdgeProps = EdgeComponentProps;
|
|
110
|
+
export type EdgeTextProps = HTMLAttributes<SVGElement> & EdgeLabelOptions & {
|
|
111
|
+
x: number;
|
|
112
|
+
y: number;
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=edges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../../src/types/edges.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,UAAU,IAAI,e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,CAAC;IAC3B,cAAc,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC7C,cAAc,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;CAC9C,CAAC;AAEJ,MAAM,MAAM,4BAA4B,CAAC,WAAW,IAAI,kBAAkB,GAAG;IAC3E,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,4BAA4B,CAAC,iBAAiB,CAAC,CAAC;AAE9E;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAC7B,4BAA4B,CAAC,qBAAqB,CAAC,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,4BAA4B,CAAC,eAAe,CAAC,CAAC;AAE1E;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,kBAAkB,EAClB,gBAAgB,GAAG,gBAAgB,CACpC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,UAAU,CAAC,GACpD,gBAAgB,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { Node, Edge, EdgeProps, NodeProps } from '.';
|
|
3
|
+
import { Connection, EdgeChange, FitBounds, FitViewOptionsBase, FitViewParamsBase, GetViewport, GetZoom, NodeChange, OnBeforeDeleteBase, SetCenter, SetViewport, XYPosition, ZoomInOut, ZoomTo } from './system';
|
|
4
|
+
export type OnNodesChange<NodeType extends Node = Node> = (changes: NodeChange<NodeType>[]) => void;
|
|
5
|
+
export type OnEdgesChange<EdgeType extends Edge = Edge> = (changes: EdgeChange<EdgeType>[]) => void;
|
|
6
|
+
export type OnNodesDelete<NodeType extends Node = Node> = (nodes: NodeType[]) => void;
|
|
7
|
+
export type OnEdgesDelete<EdgeType extends Edge = Edge> = (edges: EdgeType[]) => void;
|
|
8
|
+
export type OnDelete<NodeType extends Node = Node, EdgeType extends Edge = Edge> = (params: {
|
|
9
|
+
nodes: NodeType[];
|
|
10
|
+
edges: EdgeType[];
|
|
11
|
+
}) => void;
|
|
12
|
+
export type FitViewParams<NodeType extends Node = Node> = FitViewParamsBase<NodeType>;
|
|
13
|
+
export type FitViewOptions<NodeType extends Node = Node> = FitViewOptionsBase<NodeType>;
|
|
14
|
+
export type FitView = (fitViewOptions?: FitViewOptions) => boolean;
|
|
15
|
+
export type ViewportHelperFunctions = {
|
|
16
|
+
/**
|
|
17
|
+
* Zooms viewport in by 1.2.
|
|
18
|
+
*
|
|
19
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
20
|
+
*/
|
|
21
|
+
zoomIn: ZoomInOut;
|
|
22
|
+
/**
|
|
23
|
+
* Zooms viewport out by 1 / 1.2.
|
|
24
|
+
*
|
|
25
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
26
|
+
*/
|
|
27
|
+
zoomOut: ZoomInOut;
|
|
28
|
+
/**
|
|
29
|
+
* Sets the current zoom level.
|
|
30
|
+
*
|
|
31
|
+
* @param zoomLevel - the zoom level to set
|
|
32
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
33
|
+
*/
|
|
34
|
+
zoomTo: ZoomTo;
|
|
35
|
+
/**
|
|
36
|
+
* Returns the current zoom level.
|
|
37
|
+
*
|
|
38
|
+
* @returns current zoom as a number
|
|
39
|
+
*/
|
|
40
|
+
getZoom: GetZoom;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the current viewport.
|
|
43
|
+
*
|
|
44
|
+
* @param viewport - the viewport to set
|
|
45
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
46
|
+
*/
|
|
47
|
+
setViewport: SetViewport;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the current viewport.
|
|
50
|
+
*
|
|
51
|
+
* @returns Viewport
|
|
52
|
+
*/
|
|
53
|
+
getViewport: GetViewport;
|
|
54
|
+
/**
|
|
55
|
+
* Fits the view.
|
|
56
|
+
*
|
|
57
|
+
* @param options.padding - optional padding
|
|
58
|
+
* @param options.includeHiddenNodes - optional includeHiddenNodes
|
|
59
|
+
* @param options.minZoom - optional minZoom
|
|
60
|
+
* @param options.maxZoom - optional maxZoom
|
|
61
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
62
|
+
* @param options.nodes - optional nodes to fit the view to
|
|
63
|
+
*/
|
|
64
|
+
fitView: FitView;
|
|
65
|
+
/**
|
|
66
|
+
* Sets the center of the view to the given position.
|
|
67
|
+
*
|
|
68
|
+
* @param x - x position
|
|
69
|
+
* @param y - y position
|
|
70
|
+
* @param options.zoom - optional zoom
|
|
71
|
+
*/
|
|
72
|
+
setCenter: SetCenter;
|
|
73
|
+
/**
|
|
74
|
+
* Fits the view to the given bounds .
|
|
75
|
+
*
|
|
76
|
+
* @param bounds - the bounds ({ x: number, y: number, width: number, height: number }) to fit the view to
|
|
77
|
+
* @param options.padding - optional padding
|
|
78
|
+
*/
|
|
79
|
+
fitBounds: FitBounds;
|
|
80
|
+
/**
|
|
81
|
+
* Converts a screen / client position to a flow position.
|
|
82
|
+
*
|
|
83
|
+
* @param clientPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
|
|
84
|
+
* @param options.snapToGrid - if true, the converted position will be snapped to the grid
|
|
85
|
+
* @returns position as { x: number, y: number }
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* const flowPosition = screenToFlowPosition({ x: event.clientX, y: event.clientY })
|
|
89
|
+
*/
|
|
90
|
+
screenToFlowPosition: (clientPosition: XYPosition, options?: {
|
|
91
|
+
snapToGrid: boolean;
|
|
92
|
+
}) => XYPosition;
|
|
93
|
+
/**
|
|
94
|
+
* Converts a flow position to a screen / client position.
|
|
95
|
+
*
|
|
96
|
+
* @param flowPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
|
|
97
|
+
* @returns position as { x: number, y: number }
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* const clientPosition = flowToScreenPosition({ x: node.position.x, y: node.position.y })
|
|
101
|
+
*/
|
|
102
|
+
flowToScreenPosition: (flowPosition: XYPosition) => XYPosition;
|
|
103
|
+
};
|
|
104
|
+
export type IsValidConnection<EdgeType extends Edge = Edge> = (edge: EdgeType | Connection) => boolean;
|
|
105
|
+
export type OnSelectionChangeParams = {
|
|
106
|
+
nodes: Node[];
|
|
107
|
+
edges: Edge[];
|
|
108
|
+
};
|
|
109
|
+
export type OnSelectionChangeFunc = (params: OnSelectionChangeParams) => void;
|
|
110
|
+
export type NodeTypes = Record<string, ComponentType<NodeProps & {
|
|
111
|
+
data: any;
|
|
112
|
+
type: any;
|
|
113
|
+
}>>;
|
|
114
|
+
export type EdgeTypes = Record<string, ComponentType<EdgeProps & {
|
|
115
|
+
data: any;
|
|
116
|
+
type: any;
|
|
117
|
+
}>>;
|
|
118
|
+
export type UnselectNodesAndEdgesParams = {
|
|
119
|
+
nodes?: Node[];
|
|
120
|
+
edges?: Edge[];
|
|
121
|
+
};
|
|
122
|
+
export type OnBeforeDelete<NodeType extends Node = Node, EdgeType extends Edge = Edge> = OnBeforeDeleteBase<NodeType, EdgeType>;
|
|
123
|
+
//# sourceMappingURL=general.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/types/general.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AACrD,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,WAAW,E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,CAAC,EAAE,IAAI,EAAE,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,CACxB,QAAQ,SAAS,IAAI,GAAG,IAAI,EAC5B,QAAQ,SAAS,IAAI,GAAG,IAAI,IAC1B,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Edge } from './edges';
|
|
2
|
+
import { ViewportHelperFunctions } from './general';
|
|
3
|
+
import { InternalNode } from './nodes';
|
|
4
|
+
import { Rect, Viewport } from './system';
|
|
5
|
+
import { Node } from '.';
|
|
6
|
+
export type InkFlowJsonObject<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
|
|
7
|
+
nodes: NodeType[];
|
|
8
|
+
edges: EdgeType[];
|
|
9
|
+
viewport: Viewport;
|
|
10
|
+
};
|
|
11
|
+
export type DeleteElementsOptions = {
|
|
12
|
+
nodes?: (Node | {
|
|
13
|
+
id: Node['id'];
|
|
14
|
+
})[];
|
|
15
|
+
edges?: (Edge | {
|
|
16
|
+
id: Edge['id'];
|
|
17
|
+
})[];
|
|
18
|
+
};
|
|
19
|
+
export type GeneralHelpers<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
|
|
20
|
+
/**
|
|
21
|
+
* Returns nodes.
|
|
22
|
+
*
|
|
23
|
+
* @returns nodes array
|
|
24
|
+
*/
|
|
25
|
+
getNodes: () => NodeType[];
|
|
26
|
+
/**
|
|
27
|
+
* Sets nodes.
|
|
28
|
+
*
|
|
29
|
+
* @param payload - the nodes to set or a function that receives the current nodes and returns the new nodes
|
|
30
|
+
*/
|
|
31
|
+
setNodes: (payload: NodeType[] | ((nodes: NodeType[]) => NodeType[])) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Adds nodes.
|
|
34
|
+
*
|
|
35
|
+
* @param payload - the nodes to add
|
|
36
|
+
*/
|
|
37
|
+
addNodes: (payload: NodeType[] | NodeType) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Returns a node by id.
|
|
40
|
+
*
|
|
41
|
+
* @param id - the node id
|
|
42
|
+
* @returns the node or undefined if no node was found
|
|
43
|
+
*/
|
|
44
|
+
getNode: (id: string) => NodeType | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Returns an internal node by id.
|
|
47
|
+
*
|
|
48
|
+
* @param id - the node id
|
|
49
|
+
* @returns the internal node or undefined if no node was found
|
|
50
|
+
*/
|
|
51
|
+
getInternalNode: (id: string) => InternalNode<NodeType> | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Returns edges.
|
|
54
|
+
*
|
|
55
|
+
* @returns edges array
|
|
56
|
+
*/
|
|
57
|
+
getEdges: () => EdgeType[];
|
|
58
|
+
/**
|
|
59
|
+
* Sets edges.
|
|
60
|
+
*
|
|
61
|
+
* @param payload - the edges to set or a function that receives the current edges and returns the new edges
|
|
62
|
+
*/
|
|
63
|
+
setEdges: (payload: EdgeType[] | ((edges: EdgeType[]) => EdgeType[])) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Adds edges.
|
|
66
|
+
*
|
|
67
|
+
* @param payload - the edges to add
|
|
68
|
+
*/
|
|
69
|
+
addEdges: (payload: EdgeType[] | EdgeType) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Returns an edge by id.
|
|
72
|
+
*
|
|
73
|
+
* @param id - the edge id
|
|
74
|
+
* @returns the edge or undefined if no edge was found
|
|
75
|
+
*/
|
|
76
|
+
getEdge: (id: string) => EdgeType | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Returns the nodes, edges and the viewport as a JSON object.
|
|
79
|
+
*
|
|
80
|
+
* @returns the nodes, edges and the viewport as a JSON object
|
|
81
|
+
*/
|
|
82
|
+
toObject: () => InkFlowJsonObject<NodeType, EdgeType>;
|
|
83
|
+
/**
|
|
84
|
+
* Deletes nodes and edges.
|
|
85
|
+
*
|
|
86
|
+
* @param params.nodes - optional nodes array to delete
|
|
87
|
+
* @param params.edges - optional edges array to delete
|
|
88
|
+
*
|
|
89
|
+
* @returns a promise that resolves with the deleted nodes and edges
|
|
90
|
+
*/
|
|
91
|
+
deleteElements: (params: DeleteElementsOptions) => Promise<{
|
|
92
|
+
deletedNodes: Node[];
|
|
93
|
+
deletedEdges: Edge[];
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Returns all nodes that intersect with the given node or rect.
|
|
97
|
+
*
|
|
98
|
+
* @param node - the node or rect to check for intersections
|
|
99
|
+
* @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed node or rect
|
|
100
|
+
* @param nodes - optional nodes array to check for intersections
|
|
101
|
+
*
|
|
102
|
+
* @returns an array of intersecting nodes
|
|
103
|
+
*/
|
|
104
|
+
getIntersectingNodes: (node: NodeType | {
|
|
105
|
+
id: Node['id'];
|
|
106
|
+
} | Rect, partially?: boolean, nodes?: NodeType[]) => NodeType[];
|
|
107
|
+
/**
|
|
108
|
+
* Checks if the given node or rect intersects with the passed rect.
|
|
109
|
+
*
|
|
110
|
+
* @param node - the node or rect to check for intersections
|
|
111
|
+
* @param area - the rect to check for intersections
|
|
112
|
+
* @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed react
|
|
113
|
+
*
|
|
114
|
+
* @returns true if the node or rect intersects with the given area
|
|
115
|
+
*/
|
|
116
|
+
isNodeIntersecting: (node: NodeType | {
|
|
117
|
+
id: Node['id'];
|
|
118
|
+
} | Rect, area: Rect, partially?: boolean) => boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Updates a node.
|
|
121
|
+
*
|
|
122
|
+
* @param id - id of the node to update
|
|
123
|
+
* @param nodeUpdate - the node update as an object or a function that receives the current node and returns the node update
|
|
124
|
+
* @param options.replace - if true, the node is replaced with the node update, otherwise the changes get merged
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* updateNode('node-1', (node) => ({ position: { x: node.position.x + 10, y: node.position.y } }));
|
|
128
|
+
*/
|
|
129
|
+
updateNode: (id: string, nodeUpdate: Partial<NodeType> | ((node: NodeType) => Partial<NodeType>), options?: {
|
|
130
|
+
replace: boolean;
|
|
131
|
+
}) => void;
|
|
132
|
+
/**
|
|
133
|
+
* Updates the data attribute of a node.
|
|
134
|
+
*
|
|
135
|
+
* @param id - id of the node to update
|
|
136
|
+
* @param dataUpdate - the data update as an object or a function that receives the current data and returns the data update
|
|
137
|
+
* @param options.replace - if true, the data is replaced with the data update, otherwise the changes get merged
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* updateNodeData('node-1', { label: 'A new label' });
|
|
141
|
+
*/
|
|
142
|
+
updateNodeData: (id: string, dataUpdate: object | ((node: NodeType) => object), options?: {
|
|
143
|
+
replace: boolean;
|
|
144
|
+
}) => void;
|
|
145
|
+
};
|
|
146
|
+
export type InkFlowInstance<NodeType extends Node = Node, EdgeType extends Edge = Edge> = GeneralHelpers<NodeType, EdgeType> & Omit<ViewportHelperFunctions, 'initialized'> & {
|
|
147
|
+
viewportInitialized: boolean;
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=instance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/types/instance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAY,IAAI,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAEzB,MAAM,M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;OASG;IACH,cAAc,EAAE,CACd,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC,EACjD,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAC3B,IAAI,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,eAAe,CACzB,QAAQ,SAAS,IAAI,GAAG,IAAI,EAC5B,QAAQ,SAAS,IAAI,GAAG,IAAI,IAC1B,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,GACpC,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC,GAAG;IAC7C,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CSSProperties, MouseEvent as ReactMouseEvent } from 'react';
|
|
2
|
+
import { CoordinateExtent, InternalNodeBase, NodeBase, NodeOrigin, NodeProps as NodePropsBase, OnError } from './system';
|
|
3
|
+
import { NodeTypes } from './general';
|
|
4
|
+
export type Node<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string = string> = NodeBase<NodeData, NodeType> & {
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
className?: string;
|
|
7
|
+
resizing?: boolean;
|
|
8
|
+
focusable?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type InternalNode<NodeType extends Node = Node> = InternalNodeBase<NodeType>;
|
|
11
|
+
export type NodeMouseHandler<NodeType extends Node = Node> = (event: ReactMouseEvent, node: NodeType) => void;
|
|
12
|
+
export type SelectionDragHandler<NodeType extends Node = Node> = (event: ReactMouseEvent, nodes: NodeType[]) => void;
|
|
13
|
+
export type OnNodeDrag<NodeType extends Node = Node> = (event: ReactMouseEvent, node: NodeType, nodes: NodeType[]) => void;
|
|
14
|
+
export type NodeWrapperProps<NodeType extends Node> = {
|
|
15
|
+
id: string;
|
|
16
|
+
nodesConnectable: boolean;
|
|
17
|
+
elementsSelectable: boolean;
|
|
18
|
+
nodesDraggable: boolean;
|
|
19
|
+
nodesFocusable: boolean;
|
|
20
|
+
onClick?: NodeMouseHandler<NodeType>;
|
|
21
|
+
onDoubleClick?: NodeMouseHandler<NodeType>;
|
|
22
|
+
onMouseEnter?: NodeMouseHandler<NodeType>;
|
|
23
|
+
onMouseMove?: NodeMouseHandler<NodeType>;
|
|
24
|
+
onMouseLeave?: NodeMouseHandler<NodeType>;
|
|
25
|
+
onContextMenu?: NodeMouseHandler<NodeType>;
|
|
26
|
+
resizeObserver: ResizeObserver | null;
|
|
27
|
+
noDragClassName: string;
|
|
28
|
+
noPanClassName: string;
|
|
29
|
+
rfId: string;
|
|
30
|
+
disableKeyboardA11y: boolean;
|
|
31
|
+
nodeTypes?: NodeTypes;
|
|
32
|
+
nodeExtent?: CoordinateExtent;
|
|
33
|
+
nodeOrigin: NodeOrigin;
|
|
34
|
+
onError?: OnError;
|
|
35
|
+
};
|
|
36
|
+
export type NodeProps<NodeType extends Node = Node> = NodePropsBase<NodeType>;
|
|
37
|
+
export type BuiltInNode = Node<{
|
|
38
|
+
label: string;
|
|
39
|
+
}, 'input' | 'output' | 'default'>;
|
|
40
|
+
//# sourceMappingURL=nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/types/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,SAAS,IAAI,aAAa,EAC1B,OAAO,EACR,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,IAAI,CACd,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EA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AAC;IACzC,YAAY,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC3C,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC9E,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EACjB,OAAO,GAAG,QAAQ,GAAG,SAAS,CAC/B,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { HTMLAttributes, MouseEvent as ReactMouseEvent, WheelEvent } from 'react';
|
|
2
|
+
import { DefaultEdgeOptions, Edge, FitViewOptions, Node, NodeTypes, OnEdgeUpdateFunc, OnEdgesChange, OnNodesChange, SelectionDragHandler } from '.';
|
|
3
|
+
import { CoordinateExtent, KeyCode, NodeOrigin, PanOnScrollMode, Viewport } from './system';
|
|
4
|
+
export interface InkFlowProps<NodeType extends Node = Node, EdgeType extends Edge = Edge> extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'> {
|
|
5
|
+
/** An array of nodes to render in a controlled flow.
|
|
6
|
+
* @example
|
|
7
|
+
* const nodes = [
|
|
8
|
+
* {
|
|
9
|
+
* id: 'node-1',
|
|
10
|
+
* type: 'input',
|
|
11
|
+
* data: { label: 'Node 1' },
|
|
12
|
+
* position: { x: 250, y: 50 }
|
|
13
|
+
* }
|
|
14
|
+
* ];
|
|
15
|
+
*/
|
|
16
|
+
nodes?: NodeType[];
|
|
17
|
+
/** An array of edges to render in a controlled flow.
|
|
18
|
+
* @example
|
|
19
|
+
* const edges = [
|
|
20
|
+
* {
|
|
21
|
+
* id: 'edge-1-2',
|
|
22
|
+
* source: 'node-1',
|
|
23
|
+
* target: 'node-2',
|
|
24
|
+
* }
|
|
25
|
+
* ];
|
|
26
|
+
*/
|
|
27
|
+
edges?: EdgeType[];
|
|
28
|
+
/** The initial nodes to render in an uncontrolled flow. */
|
|
29
|
+
defaultNodes?: NodeType[];
|
|
30
|
+
/** The initial edges to render in an uncontrolled flow. */
|
|
31
|
+
defaultEdges?: EdgeType[];
|
|
32
|
+
/** Defaults to be applied to all new edges that are added to the flow.
|
|
33
|
+
*
|
|
34
|
+
* Properties on a new edge will override these defaults if they exist.
|
|
35
|
+
* @example
|
|
36
|
+
* const defaultEdgeOptions = {
|
|
37
|
+
* type: 'customEdgeType',
|
|
38
|
+
* animated: true,
|
|
39
|
+
* interactionWidth: 10,
|
|
40
|
+
* data: { label: 'custom label' },
|
|
41
|
+
* hidden: false,
|
|
42
|
+
* deletable: true,
|
|
43
|
+
* selected: false,
|
|
44
|
+
* focusable: true,
|
|
45
|
+
* markerStart: EdgeMarker.ArrowClosed,
|
|
46
|
+
* markerEnd: EdgeMarker.ArrowClosed,
|
|
47
|
+
* zIndex: 12,
|
|
48
|
+
* ariaLabel: 'custom aria label'
|
|
49
|
+
* }
|
|
50
|
+
*/
|
|
51
|
+
defaultEdgeOptions?: DefaultEdgeOptions;
|
|
52
|
+
onEdgeUpdate?: OnEdgeUpdateFunc<EdgeType>;
|
|
53
|
+
onNodesChange?: OnNodesChange<NodeType>;
|
|
54
|
+
onEdgesChange?: OnEdgesChange<EdgeType>;
|
|
55
|
+
/** This event handler gets called when a Node is deleted */
|
|
56
|
+
/** This event handler gets called when a Edge is deleted */
|
|
57
|
+
/** This event handler gets called when a Node or Edge is deleted */
|
|
58
|
+
/** This event handler gets called when a user starts to drag a selection box */
|
|
59
|
+
onSelectionDragStart?: SelectionDragHandler<NodeType>;
|
|
60
|
+
/** This event handler gets called when a user drags a selection box */
|
|
61
|
+
onSelectionDrag?: SelectionDragHandler<NodeType>;
|
|
62
|
+
/** This event handler gets called when a user stops dragging a selection box */
|
|
63
|
+
onSelectionDragStop?: SelectionDragHandler<NodeType>;
|
|
64
|
+
onSelectionStart?: (event: ReactMouseEvent) => void;
|
|
65
|
+
onSelectionEnd?: (event: ReactMouseEvent) => void;
|
|
66
|
+
onSelectionContextMenu?: (event: ReactMouseEvent, nodes: NodeType[]) => void;
|
|
67
|
+
/** This event handler gets called when user scroll inside the pane */
|
|
68
|
+
onPaneScroll?: (event?: WheelEvent) => void;
|
|
69
|
+
/** This event handler gets called when user clicks inside the pane */
|
|
70
|
+
onPaneClick?: (event: ReactMouseEvent) => void;
|
|
71
|
+
/** This event handler gets called when user right clicks inside the pane */
|
|
72
|
+
onPaneContextMenu?: (event: ReactMouseEvent | MouseEvent) => void;
|
|
73
|
+
/** This event handler gets called when mouse enters the pane */
|
|
74
|
+
onPaneMouseEnter?: (event: ReactMouseEvent) => void;
|
|
75
|
+
/** This event handler gets called when mouse moves over the pane */
|
|
76
|
+
onPaneMouseMove?: (event: ReactMouseEvent) => void;
|
|
77
|
+
/** This event handler gets called when mouse leaves the pane */
|
|
78
|
+
onPaneMouseLeave?: (event: ReactMouseEvent) => void;
|
|
79
|
+
nodeTypes?: NodeTypes;
|
|
80
|
+
deleteKeyCode?: KeyCode | null;
|
|
81
|
+
selectionKeyCode?: KeyCode | null;
|
|
82
|
+
selectionOnDrag?: boolean;
|
|
83
|
+
selectionMode?: SelectionMode;
|
|
84
|
+
panActivationKeyCode?: KeyCode | null;
|
|
85
|
+
multiSelectionKeyCode?: KeyCode | null;
|
|
86
|
+
zoomActivationKeyCode?: KeyCode | null;
|
|
87
|
+
/** Controls if all nodes should be draggable
|
|
88
|
+
* @default true
|
|
89
|
+
*/
|
|
90
|
+
nodesDraggable?: boolean;
|
|
91
|
+
nodeOrigin?: NodeOrigin;
|
|
92
|
+
elementsSelectable?: boolean;
|
|
93
|
+
panOnDrag?: boolean | number[];
|
|
94
|
+
minZoom?: number;
|
|
95
|
+
maxZoom?: number;
|
|
96
|
+
viewport?: Viewport;
|
|
97
|
+
/** Sets the initial position and zoom of the viewport.
|
|
98
|
+
*
|
|
99
|
+
* If a default viewport is provided but fitView is enabled, the default viewport will be ignored.
|
|
100
|
+
* @example
|
|
101
|
+
* const initialViewport = {
|
|
102
|
+
* zoom: 0.5,
|
|
103
|
+
* position: { x: 0, y: 0 }
|
|
104
|
+
* };
|
|
105
|
+
*/
|
|
106
|
+
defaultViewport?: Viewport;
|
|
107
|
+
onViewportChange?: (viewport: Viewport) => void;
|
|
108
|
+
translateExtent?: CoordinateExtent;
|
|
109
|
+
preventScrolling?: boolean;
|
|
110
|
+
/** By default nodes can be placed on an infinite flow. You can use this prop to set a boundary.
|
|
111
|
+
*
|
|
112
|
+
* The first pair of coordinates is the top left boundary and the second pair is the bottom right.
|
|
113
|
+
* @example [[-1000, -10000], [1000, 1000]]
|
|
114
|
+
*/
|
|
115
|
+
nodeExtent?: CoordinateExtent;
|
|
116
|
+
zoomOnScroll?: boolean;
|
|
117
|
+
zoomOnPinch?: boolean;
|
|
118
|
+
panOnScroll?: boolean;
|
|
119
|
+
panOnScrollSpeed?: number;
|
|
120
|
+
panOnScrollMode?: PanOnScrollMode;
|
|
121
|
+
zoomOnDoubleClick?: boolean;
|
|
122
|
+
noDragClassName?: string;
|
|
123
|
+
noWheelClassName?: string;
|
|
124
|
+
noPanClassName?: string;
|
|
125
|
+
/** If set, initial viewport will show all nodes & edges */
|
|
126
|
+
fitView?: boolean;
|
|
127
|
+
/** Options to be used in combination with fitView
|
|
128
|
+
* @example
|
|
129
|
+
* const fitViewOptions = {
|
|
130
|
+
* padding: 0.1,
|
|
131
|
+
* includeHiddenNodes: false,
|
|
132
|
+
* minZoom: 0.1,
|
|
133
|
+
* maxZoom: 1,
|
|
134
|
+
* duration: 200,
|
|
135
|
+
* nodes: [{id: 'node-1'}, {id: 'node-2'}], // nodes to fit
|
|
136
|
+
* };
|
|
137
|
+
*/
|
|
138
|
+
fitViewOptions?: FitViewOptions;
|
|
139
|
+
/**The connectOnClick option lets you click or tap on a source handle to start a connection
|
|
140
|
+
* and then click on a target handle to complete the connection.
|
|
141
|
+
*
|
|
142
|
+
* If you set this option to false, users will need to drag the connection line to the target
|
|
143
|
+
* handle to create a connection.
|
|
144
|
+
*/
|
|
145
|
+
disableKeyboardA11y?: boolean;
|
|
146
|
+
/** Sets a fixed width for the flow */
|
|
147
|
+
width?: number;
|
|
148
|
+
/** Sets a fixed height for the flow */
|
|
149
|
+
height?: number;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/types/props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACd,UAAU,IAAI,eAAe,EAC7B,UAAU,EACX,MAAM,OAAO,CAAC;AACf,OAAO,EACL,kBAAkB,EAClB,IAAI,EACJ,cAAc,EACd,IAAI,EACJ,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,oBAAoB,EACrB,MAAM,GAAG,CAAC;AACX,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,eAAe,EACf,QAAQ,EACT,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,YAAY,CAC3B,QAAQ,SAAS,IAAI,GAAG,IAAI,EAC5B,QAAQ,SAAS,IAAI,GAAG,IAAI,CAC5B,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC;IACvD;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB;;;;;;;;;OASG;IACH,KAAK,CA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