@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.
Files changed (244) hide show
  1. package/README.md +5 -0
  2. package/dist/base.css +6 -0
  3. package/dist/components/A11yDescriptions/index.d.ts +8 -0
  4. package/dist/components/A11yDescriptions/index.d.ts.map +1 -0
  5. package/dist/components/BatchProvider/index.d.ts +17 -0
  6. package/dist/components/BatchProvider/index.d.ts.map +1 -0
  7. package/dist/components/BatchProvider/types.d.ts +7 -0
  8. package/dist/components/BatchProvider/types.d.ts.map +1 -0
  9. package/dist/components/BatchProvider/useQueue.d.ts +11 -0
  10. package/dist/components/BatchProvider/useQueue.d.ts.map +1 -0
  11. package/dist/components/EdgeWrapper/EdgeUpdateAnchors.d.ts +17 -0
  12. package/dist/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -0
  13. package/dist/components/EdgeWrapper/index.d.ts +3 -0
  14. package/dist/components/EdgeWrapper/index.d.ts.map +1 -0
  15. package/dist/components/EdgeWrapper/utils.d.ts +11 -0
  16. package/dist/components/EdgeWrapper/utils.d.ts.map +1 -0
  17. package/dist/components/Edges/BaseEdge.d.ts +3 -0
  18. package/dist/components/Edges/BaseEdge.d.ts.map +1 -0
  19. package/dist/components/Edges/BezierEdge.d.ts +5 -0
  20. package/dist/components/Edges/BezierEdge.d.ts.map +1 -0
  21. package/dist/components/Edges/EdgeAnchor.d.ts +14 -0
  22. package/dist/components/Edges/EdgeAnchor.d.ts.map +1 -0
  23. package/dist/components/Edges/EdgeText.d.ts +8 -0
  24. package/dist/components/Edges/EdgeText.d.ts.map +1 -0
  25. package/dist/components/Edges/SimpleBezierEdge.d.ts +21 -0
  26. package/dist/components/Edges/SimpleBezierEdge.d.ts.map +1 -0
  27. package/dist/components/Edges/SmoothStepEdge.d.ts +5 -0
  28. package/dist/components/Edges/SmoothStepEdge.d.ts.map +1 -0
  29. package/dist/components/Edges/StepEdge.d.ts +5 -0
  30. package/dist/components/Edges/StepEdge.d.ts.map +1 -0
  31. package/dist/components/Edges/StraightEdge.d.ts +5 -0
  32. package/dist/components/Edges/StraightEdge.d.ts.map +1 -0
  33. package/dist/components/Edges/index.d.ts +6 -0
  34. package/dist/components/Edges/index.d.ts.map +1 -0
  35. package/dist/components/Handle/index.d.ts +9 -0
  36. package/dist/components/Handle/index.d.ts.map +1 -0
  37. package/dist/components/InkFlowProvider/index.d.ts +14 -0
  38. package/dist/components/InkFlowProvider/index.d.ts.map +1 -0
  39. package/dist/components/NodeWrapper/index.d.ts +3 -0
  40. package/dist/components/NodeWrapper/index.d.ts.map +1 -0
  41. package/dist/components/NodeWrapper/useNodeObserver.d.ts +14 -0
  42. package/dist/components/NodeWrapper/useNodeObserver.d.ts.map +1 -0
  43. package/dist/components/NodeWrapper/utils.d.ts +9 -0
  44. package/dist/components/NodeWrapper/utils.d.ts.map +1 -0
  45. package/dist/components/Nodes/DefaultNode.d.ts +3 -0
  46. package/dist/components/Nodes/DefaultNode.d.ts.map +1 -0
  47. package/dist/components/Nodes/GroupNode.d.ts +2 -0
  48. package/dist/components/Nodes/GroupNode.d.ts.map +1 -0
  49. package/dist/components/Nodes/InputNode.d.ts +4 -0
  50. package/dist/components/Nodes/InputNode.d.ts.map +1 -0
  51. package/dist/components/Nodes/OutputNode.d.ts +3 -0
  52. package/dist/components/Nodes/OutputNode.d.ts.map +1 -0
  53. package/dist/components/Nodes/utils.d.ts +13 -0
  54. package/dist/components/Nodes/utils.d.ts.map +1 -0
  55. package/dist/components/Panel/index.d.ts +11 -0
  56. package/dist/components/Panel/index.d.ts.map +1 -0
  57. package/dist/components/StoreUpdater/index.d.ts +9 -0
  58. package/dist/components/StoreUpdater/index.d.ts.map +1 -0
  59. package/dist/components/UserSelection/index.d.ts +2 -0
  60. package/dist/components/UserSelection/index.d.ts.map +1 -0
  61. package/dist/constants/errorMessages.d.ts +22 -0
  62. package/dist/constants/errorMessages.d.ts.map +1 -0
  63. package/dist/constants/index.d.ts +2 -0
  64. package/dist/constants/index.d.ts.map +1 -0
  65. package/dist/container/EdgeRenderer/MarkerDefinitions.d.ts +10 -0
  66. package/dist/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -0
  67. package/dist/container/EdgeRenderer/MarkerSymbols.d.ts +9 -0
  68. package/dist/container/EdgeRenderer/MarkerSymbols.d.ts.map +1 -0
  69. package/dist/container/EdgeRenderer/index.d.ts +13 -0
  70. package/dist/container/EdgeRenderer/index.d.ts.map +1 -0
  71. package/dist/container/FlowRenderer/index.d.ts +14 -0
  72. package/dist/container/FlowRenderer/index.d.ts.map +1 -0
  73. package/dist/container/GraphView/index.d.ts +11 -0
  74. package/dist/container/GraphView/index.d.ts.map +1 -0
  75. package/dist/container/InkFlow/Wrapper.d.ts +13 -0
  76. package/dist/container/InkFlow/Wrapper.d.ts.map +1 -0
  77. package/dist/container/InkFlow/index.d.ts +4 -0
  78. package/dist/container/InkFlow/index.d.ts.map +1 -0
  79. package/dist/container/InkFlow/init-values.d.ts +4 -0
  80. package/dist/container/InkFlow/init-values.d.ts.map +1 -0
  81. package/dist/container/NodeRenderer/index.d.ts +10 -0
  82. package/dist/container/NodeRenderer/index.d.ts.map +1 -0
  83. package/dist/container/NodeRenderer/useResizeObserver.d.ts +2 -0
  84. package/dist/container/NodeRenderer/useResizeObserver.d.ts.map +1 -0
  85. package/dist/container/Pane/index.d.ts +12 -0
  86. package/dist/container/Pane/index.d.ts.map +1 -0
  87. package/dist/container/Viewport/index.d.ts +7 -0
  88. package/dist/container/Viewport/index.d.ts.map +1 -0
  89. package/dist/container/ZoomPane/index.d.ts +7 -0
  90. package/dist/container/ZoomPane/index.d.ts.map +1 -0
  91. package/dist/contexts/NodeIdContext.d.ts +6 -0
  92. package/dist/contexts/NodeIdContext.d.ts.map +1 -0
  93. package/dist/contexts/StoreContext.d.ts +4 -0
  94. package/dist/contexts/StoreContext.d.ts.map +1 -0
  95. package/dist/hooks/index.d.ts +5 -0
  96. package/dist/hooks/index.d.ts.map +1 -0
  97. package/dist/hooks/useDrag.d.ts +12 -0
  98. package/dist/hooks/useDrag.d.ts.map +1 -0
  99. package/dist/hooks/useEdgesState.d.ts +4 -0
  100. package/dist/hooks/useEdgesState.d.ts.map +1 -0
  101. package/dist/hooks/useGlobalKeyHandler.d.ts +11 -0
  102. package/dist/hooks/useGlobalKeyHandler.d.ts.map +1 -0
  103. package/dist/hooks/useInkFlow.d.ts +10 -0
  104. package/dist/hooks/useInkFlow.d.ts.map +1 -0
  105. package/dist/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
  106. package/dist/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -0
  107. package/dist/hooks/useKeyPress.d.ts +15 -0
  108. package/dist/hooks/useKeyPress.d.ts.map +1 -0
  109. package/dist/hooks/useMoveSelectedNodes.d.ts +12 -0
  110. package/dist/hooks/useMoveSelectedNodes.d.ts.map +1 -0
  111. package/dist/hooks/useNodesState.d.ts +4 -0
  112. package/dist/hooks/useNodesState.d.ts.map +1 -0
  113. package/dist/hooks/useResizeHandler.d.ts +8 -0
  114. package/dist/hooks/useResizeHandler.d.ts.map +1 -0
  115. package/dist/hooks/useStore.d.ts +21 -0
  116. package/dist/hooks/useStore.d.ts.map +1 -0
  117. package/dist/hooks/useViewportHelper.d.ts +10 -0
  118. package/dist/hooks/useViewportHelper.d.ts.map +1 -0
  119. package/dist/hooks/useVisibleEdgeIds.d.ts +9 -0
  120. package/dist/hooks/useVisibleEdgeIds.d.ts.map +1 -0
  121. package/dist/hooks/useVisibleNodeIds.d.ts +9 -0
  122. package/dist/hooks/useVisibleNodeIds.d.ts.map +1 -0
  123. package/dist/index.cjs.js +17 -0
  124. package/dist/index.cjs.js.map +1 -0
  125. package/dist/index.d.ts +8 -0
  126. package/dist/index.d.ts.map +1 -0
  127. package/dist/index.esm.js +17 -0
  128. package/dist/index.esm.js.map +1 -0
  129. package/dist/plugins/Controls/ControlButton.d.ts +3 -0
  130. package/dist/plugins/Controls/ControlButton.d.ts.map +1 -0
  131. package/dist/plugins/Controls/Controls.d.ts +8 -0
  132. package/dist/plugins/Controls/Controls.d.ts.map +1 -0
  133. package/dist/plugins/Controls/Icons/FitView.d.ts +2 -0
  134. package/dist/plugins/Controls/Icons/FitView.d.ts.map +1 -0
  135. package/dist/plugins/Controls/Icons/Lock.d.ts +2 -0
  136. package/dist/plugins/Controls/Icons/Lock.d.ts.map +1 -0
  137. package/dist/plugins/Controls/Icons/Minus.d.ts +2 -0
  138. package/dist/plugins/Controls/Icons/Minus.d.ts.map +1 -0
  139. package/dist/plugins/Controls/Icons/Plus.d.ts +2 -0
  140. package/dist/plugins/Controls/Icons/Plus.d.ts.map +1 -0
  141. package/dist/plugins/Controls/Icons/Unlock.d.ts +2 -0
  142. package/dist/plugins/Controls/Icons/Unlock.d.ts.map +1 -0
  143. package/dist/plugins/Controls/index.d.ts +4 -0
  144. package/dist/plugins/Controls/index.d.ts.map +1 -0
  145. package/dist/plugins/Controls/types.d.ts +35 -0
  146. package/dist/plugins/Controls/types.d.ts.map +1 -0
  147. package/dist/plugins/index.d.ts +2 -0
  148. package/dist/plugins/index.d.ts.map +1 -0
  149. package/dist/store/index.d.ts +12 -0
  150. package/dist/store/index.d.ts.map +1 -0
  151. package/dist/store/initialState.d.ts +12 -0
  152. package/dist/store/initialState.d.ts.map +1 -0
  153. package/dist/style.css +817 -0
  154. package/dist/styles/utils.d.ts +3 -0
  155. package/dist/styles/utils.d.ts.map +1 -0
  156. package/dist/types/edges.d.ts +114 -0
  157. package/dist/types/edges.d.ts.map +1 -0
  158. package/dist/types/general.d.ts +123 -0
  159. package/dist/types/general.d.ts.map +1 -0
  160. package/dist/types/index.d.ts +6 -0
  161. package/dist/types/index.d.ts.map +1 -0
  162. package/dist/types/instance.d.ts +149 -0
  163. package/dist/types/instance.d.ts.map +1 -0
  164. package/dist/types/nodes.d.ts +40 -0
  165. package/dist/types/nodes.d.ts.map +1 -0
  166. package/dist/types/props.d.ts +151 -0
  167. package/dist/types/props.d.ts.map +1 -0
  168. package/dist/types/store.d.ts +105 -0
  169. package/dist/types/store.d.ts.map +1 -0
  170. package/dist/types/system/changes.d.ts +51 -0
  171. package/dist/types/system/changes.d.ts.map +1 -0
  172. package/dist/types/system/edges.d.ts +83 -0
  173. package/dist/types/system/edges.d.ts.map +1 -0
  174. package/dist/types/system/general.d.ts +119 -0
  175. package/dist/types/system/general.d.ts.map +1 -0
  176. package/dist/types/system/handles.d.ts +51 -0
  177. package/dist/types/system/handles.d.ts.map +1 -0
  178. package/dist/types/system/index.d.ts +8 -0
  179. package/dist/types/system/index.d.ts.map +1 -0
  180. package/dist/types/system/nodes.d.ts +126 -0
  181. package/dist/types/system/nodes.d.ts.map +1 -0
  182. package/dist/types/system/panzoom.d.ts +49 -0
  183. package/dist/types/system/panzoom.d.ts.map +1 -0
  184. package/dist/types/system/utils.d.ts +25 -0
  185. package/dist/types/system/utils.d.ts.map +1 -0
  186. package/dist/types/utils/types.d.ts +8 -0
  187. package/dist/types/utils/types.d.ts.map +1 -0
  188. package/dist/utils/bezier-edge.d.ts +59 -0
  189. package/dist/utils/bezier-edge.d.ts.map +1 -0
  190. package/dist/utils/changes.d.ts +16 -0
  191. package/dist/utils/changes.d.ts.map +1 -0
  192. package/dist/utils/dom.d.ts +20 -0
  193. package/dist/utils/dom.d.ts.map +1 -0
  194. package/dist/utils/edges/bezier-edge.d.ts +59 -0
  195. package/dist/utils/edges/bezier-edge.d.ts.map +1 -0
  196. package/dist/utils/edges/general.d.ts +46 -0
  197. package/dist/utils/edges/general.d.ts.map +1 -0
  198. package/dist/utils/edges/index.d.ts +6 -0
  199. package/dist/utils/edges/index.d.ts.map +1 -0
  200. package/dist/utils/edges/positions.d.ts +12 -0
  201. package/dist/utils/edges/positions.d.ts.map +1 -0
  202. package/dist/utils/edges/smoothstep-edge.d.ts +43 -0
  203. package/dist/utils/edges/smoothstep-edge.d.ts.map +1 -0
  204. package/dist/utils/edges/straight-edge.d.ts +28 -0
  205. package/dist/utils/edges/straight-edge.d.ts.map +1 -0
  206. package/dist/utils/edges.d.ts +26 -0
  207. package/dist/utils/edges.d.ts.map +1 -0
  208. package/dist/utils/general.d.ts +61 -0
  209. package/dist/utils/general.d.ts.map +1 -0
  210. package/dist/utils/graph.d.ts +113 -0
  211. package/dist/utils/graph.d.ts.map +1 -0
  212. package/dist/utils/marker.d.ts +9 -0
  213. package/dist/utils/marker.d.ts.map +1 -0
  214. package/dist/utils/positions.d.ts +12 -0
  215. package/dist/utils/positions.d.ts.map +1 -0
  216. package/dist/utils/smoothstep-edge.d.ts +43 -0
  217. package/dist/utils/smoothstep-edge.d.ts.map +1 -0
  218. package/dist/utils/store.d.ts +30 -0
  219. package/dist/utils/store.d.ts.map +1 -0
  220. package/dist/utils/straight-edge.d.ts +34 -0
  221. package/dist/utils/straight-edge.d.ts.map +1 -0
  222. package/dist/utils/xydrag/XYDrag.d.ts +52 -0
  223. package/dist/utils/xydrag/XYDrag.d.ts.map +1 -0
  224. package/dist/utils/xydrag/index.d.ts +2 -0
  225. package/dist/utils/xydrag/index.d.ts.map +1 -0
  226. package/dist/utils/xydrag/utils.d.ts +10 -0
  227. package/dist/utils/xydrag/utils.d.ts.map +1 -0
  228. package/dist/utils/xyhandle/XYHandle.d.ts +49 -0
  229. package/dist/utils/xyhandle/XYHandle.d.ts.map +1 -0
  230. package/dist/utils/xyhandle/index.d.ts +2 -0
  231. package/dist/utils/xyhandle/index.d.ts.map +1 -0
  232. package/dist/utils/xyhandle/utils.d.ts +14 -0
  233. package/dist/utils/xyhandle/utils.d.ts.map +1 -0
  234. package/dist/utils/xypanzoom/XYPanZoom.d.ts +12 -0
  235. package/dist/utils/xypanzoom/XYPanZoom.d.ts.map +1 -0
  236. package/dist/utils/xypanzoom/eventhandler.d.ts +46 -0
  237. package/dist/utils/xypanzoom/eventhandler.d.ts.map +1 -0
  238. package/dist/utils/xypanzoom/filter.d.ts +14 -0
  239. package/dist/utils/xypanzoom/filter.d.ts.map +1 -0
  240. package/dist/utils/xypanzoom/index.d.ts +2 -0
  241. package/dist/utils/xypanzoom/index.d.ts.map +1 -0
  242. package/dist/utils/xypanzoom/utils.d.ts +10 -0
  243. package/dist/utils/xypanzoom/utils.d.ts.map +1 -0
  244. package/package.json +48 -0
@@ -0,0 +1,105 @@
1
+ import type { Edge, Node, OnNodesChange, OnEdgesChange, InternalNode, FitViewOptions, IsValidConnection, OnSelectionChangeFunc, UnselectNodesAndEdgesParams, DefaultEdgeOptions, OnDelete, OnEdgesDelete, OnNodesDelete, OnBeforeDelete } from '.';
2
+ import { ConnectingHandle, ConnectionLookup, ConnectionMode, ConnectionStatus, CoordinateExtent, EdgeChange, EdgeLookup, InternalNodeUpdate, NodeChange, NodeLookup, NodeOrigin, OnConnect, OnConnectEnd, OnConnectStart, OnError, OnMove, OnMoveEnd, OnMoveStart, OnSelectionDrag, OnViewportChange, PanBy, PanZoomInstance, SelectionRect, SnapGrid, Transform, UpdateConnection, UpdateNodePositions, XYPosition } from './system';
3
+ export type InkFlowStore<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
4
+ rfId: string;
5
+ width: number;
6
+ height: number;
7
+ transform: Transform;
8
+ nodes: NodeType[];
9
+ nodeLookup: NodeLookup<InternalNode<NodeType>>;
10
+ parentLookup: Map<string, InternalNode<NodeType>[]>;
11
+ edges: Edge[];
12
+ edgeLookup: EdgeLookup<EdgeType>;
13
+ connectionLookup: ConnectionLookup;
14
+ onNodesChange: OnNodesChange<NodeType> | null;
15
+ onEdgesChange: OnEdgesChange<EdgeType> | null;
16
+ hasDefaultNodes: boolean;
17
+ hasDefaultEdges: boolean;
18
+ domNode: HTMLDivElement | null;
19
+ paneDragging: boolean;
20
+ noPanClassName: string;
21
+ panZoom: PanZoomInstance | null;
22
+ minZoom: number;
23
+ maxZoom: number;
24
+ translateExtent: CoordinateExtent;
25
+ nodeExtent: CoordinateExtent;
26
+ nodeOrigin: NodeOrigin;
27
+ nodeDragThreshold: number;
28
+ nodesSelectionActive: boolean;
29
+ userSelectionActive: boolean;
30
+ userSelectionRect: SelectionRect | null;
31
+ connectionPosition: XYPosition;
32
+ connectionStatus: ConnectionStatus | null;
33
+ connectionMode: ConnectionMode;
34
+ snapToGrid: boolean;
35
+ snapGrid: SnapGrid;
36
+ nodesDraggable: boolean;
37
+ nodesConnectable: boolean;
38
+ nodesFocusable: boolean;
39
+ edgesFocusable: boolean;
40
+ edgesUpdatable: boolean;
41
+ elementsSelectable: boolean;
42
+ elevateNodesOnSelect: boolean;
43
+ elevateEdgesOnSelect: boolean;
44
+ selectNodesOnDrag: boolean;
45
+ multiSelectionActive: boolean;
46
+ connectionStartHandle: ConnectingHandle | null;
47
+ connectionEndHandle: ConnectingHandle | null;
48
+ connectionClickStartHandle: ConnectingHandle | null;
49
+ onSelectionDragStart?: OnSelectionDrag;
50
+ onSelectionDrag?: OnSelectionDrag;
51
+ onSelectionDragStop?: OnSelectionDrag;
52
+ onMoveStart?: OnMoveStart;
53
+ onMove?: OnMove;
54
+ onMoveEnd?: OnMoveEnd;
55
+ onConnect?: OnConnect;
56
+ onConnectStart?: OnConnectStart;
57
+ onConnectEnd?: OnConnectEnd;
58
+ onClickConnectStart?: OnConnectStart;
59
+ onClickConnectEnd?: OnConnectEnd;
60
+ connectOnClick: boolean;
61
+ defaultEdgeOptions?: DefaultEdgeOptions;
62
+ fitViewOnInit: boolean;
63
+ fitViewDone: boolean;
64
+ fitViewOnInitOptions: FitViewOptions | undefined;
65
+ onNodesDelete?: OnNodesDelete<NodeType>;
66
+ onEdgesDelete?: OnEdgesDelete<EdgeType>;
67
+ onDelete?: OnDelete;
68
+ onError?: OnError;
69
+ onViewportChangeStart?: OnViewportChange;
70
+ onViewportChange?: OnViewportChange;
71
+ onViewportChangeEnd?: OnViewportChange;
72
+ onBeforeDelete?: OnBeforeDelete<NodeType, EdgeType>;
73
+ onSelectionChangeHandlers: OnSelectionChangeFunc[];
74
+ ariaLiveMessage: string;
75
+ autoPanOnConnect: boolean;
76
+ autoPanOnNodeDrag: boolean;
77
+ connectionRadius: number;
78
+ isValidConnection?: IsValidConnection<EdgeType>;
79
+ lib: string;
80
+ debug: boolean;
81
+ };
82
+ export type InkFlowActions<NodeType extends Node, EdgeType extends Edge> = {
83
+ setNodes: (nodes: NodeType[]) => void;
84
+ setEdges: (edges: EdgeType[]) => void;
85
+ setDefaultNodesAndEdges: (nodes?: NodeType[], edges?: EdgeType[]) => void;
86
+ updateNodeInternals: (updates: Map<string, InternalNodeUpdate>) => void;
87
+ updateNodePositions: UpdateNodePositions;
88
+ resetSelectedElements: () => void;
89
+ unselectNodesAndEdges: (params?: UnselectNodesAndEdgesParams) => void;
90
+ addSelectedNodes: (nodeIds: string[]) => void;
91
+ addSelectedEdges: (edgeIds: string[]) => void;
92
+ setMinZoom: (minZoom: number) => void;
93
+ setMaxZoom: (maxZoom: number) => void;
94
+ setTranslateExtent: (translateExtent: CoordinateExtent) => void;
95
+ setNodeExtent: (nodeExtent: CoordinateExtent) => void;
96
+ cancelConnection: () => void;
97
+ updateConnection: UpdateConnection;
98
+ reset: () => void;
99
+ triggerNodeChanges: (changes: NodeChange<NodeType>[]) => void;
100
+ triggerEdgeChanges: (changes: EdgeChange<EdgeType>[]) => void;
101
+ panBy: PanBy;
102
+ fitView: (options?: FitViewOptions) => boolean;
103
+ };
104
+ export type InkFlowState<NodeType extends Node = Node, EdgeType extends Edge = Edge> = InkFlowStore<NodeType, EdgeType> & InkFlowActions<NodeType, EdgeType>;
105
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/types/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,aAAa,EAWb,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EAClB,QAAQ,EACR,aAAa,EACb,aAAa,EACb,cAAc,EACf,MAAM,GAAG,CAAC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C,QAAQ,EAAE,QAAQ,CAAC,GAAG,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { XYPosition, Dimensions, NodeBase, EdgeBase } from '.';
2
+ export type NodeDimensionChange = {
3
+ id: string;
4
+ type: 'dimensions';
5
+ dimensions?: Dimensions;
6
+ resizing?: boolean;
7
+ setAttributes?: boolean;
8
+ };
9
+ export type NodePositionChange = {
10
+ id: string;
11
+ type: 'position';
12
+ position?: XYPosition;
13
+ positionAbsolute?: XYPosition;
14
+ dragging?: boolean;
15
+ };
16
+ export type NodeSelectionChange = {
17
+ id: string;
18
+ type: 'select';
19
+ selected: boolean;
20
+ };
21
+ export type NodeRemoveChange = {
22
+ id: string;
23
+ type: 'remove';
24
+ };
25
+ export type NodeAddChange<NodeType extends NodeBase = NodeBase> = {
26
+ item: NodeType;
27
+ type: 'add';
28
+ };
29
+ export type NodeReplaceChange<NodeType extends NodeBase = NodeBase> = {
30
+ id: string;
31
+ item: NodeType;
32
+ type: 'replace';
33
+ };
34
+ /**
35
+ * Union type of all possible node changes.
36
+ * @public
37
+ */
38
+ export type NodeChange<NodeType extends NodeBase = NodeBase> = NodeDimensionChange | NodePositionChange | NodeSelectionChange | NodeRemoveChange | NodeAddChange<NodeType> | NodeReplaceChange<NodeType>;
39
+ export type EdgeSelectionChange = NodeSelectionChange;
40
+ export type EdgeRemoveChange = NodeRemoveChange;
41
+ export type EdgeAddChange<EdgeType extends EdgeBase = EdgeBase> = {
42
+ item: EdgeType;
43
+ type: 'add';
44
+ };
45
+ export type EdgeReplaceChange<EdgeType extends EdgeBase = EdgeBase> = {
46
+ id: string;
47
+ item: EdgeType;
48
+ type: 'replace';
49
+ };
50
+ export type EdgeChange<EdgeType extends EdgeBase = EdgeBase> = EdgeSelectionChange | EdgeRemoveChange | EdgeAddChange<EdgeType> | EdgeReplaceChange<EdgeType>;
51
+ //# sourceMappingURL=changes.d.ts.map
@@ -0,0 +1 @@
1
+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vD,mBAAmB,GACnB,kBAAkB,GAClB,mBAAmB,GACnB,gBAAgB,GAChB,aAAa,CAAC,QAAQ,CAAC,GACvB,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAEhC,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AACtD,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAChD,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,IAAI;IAChE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,KAAK,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,IAAI;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,IACvD,mBAAmB,GACnB,gBAAgB,GAChB,aAAa,CAAC,QAAQ,CAAC,GACvB,iBAAiB,CAAC,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,83 @@
1
+ import { Position } from './utils';
2
+ export type EdgeBase<EdgeData extends Record<string, unknown> = Record<string, unknown>, EdgeType extends string | undefined = string | undefined> = {
3
+ /** Unique id of an edge */
4
+ id: string;
5
+ /** Type of an edge defined in edgeTypes */
6
+ type?: EdgeType;
7
+ /** Id of source node */
8
+ source: string;
9
+ /** Id of target node */
10
+ target: string;
11
+ /** Id of source handle
12
+ * only needed if there are multiple handles per node
13
+ */
14
+ sourceHandle?: string | null;
15
+ /** Id of target handle
16
+ * only needed if there are multiple handles per node
17
+ */
18
+ targetHandle?: string | null;
19
+ animated?: boolean;
20
+ hidden?: boolean;
21
+ deletable?: boolean;
22
+ selectable?: boolean;
23
+ /** Arbitrary data passed to an edge */
24
+ data?: EdgeData;
25
+ selected?: boolean;
26
+ /** Set the marker on the beginning of an edge
27
+ * @example 'arrow', 'arrowclosed' or custom marker
28
+ */
29
+ markerStart?: EdgeMarkerType;
30
+ /** Set the marker on the end of an edge
31
+ * @example 'arrow', 'arrowclosed' or custom marker
32
+ */
33
+ markerEnd?: EdgeMarkerType;
34
+ zIndex?: number;
35
+ ariaLabel?: string;
36
+ /** Padding around the edge where interaction is still possible */
37
+ interactionWidth?: number;
38
+ };
39
+ export type SmoothStepPathOptions = {
40
+ offset?: number;
41
+ borderRadius?: number;
42
+ };
43
+ export type StepPathOptions = {
44
+ offset?: number;
45
+ };
46
+ export type BezierPathOptions = {
47
+ curvature?: number;
48
+ };
49
+ export type DefaultEdgeOptionsBase<EdgeType extends EdgeBase> = Omit<EdgeType, 'id' | 'source' | 'target' | 'sourceHandle' | 'targetHandle' | 'selected'>;
50
+ export declare enum ConnectionLineType {
51
+ Bezier = "default",
52
+ Straight = "straight",
53
+ Step = "step",
54
+ SmoothStep = "smoothstep",
55
+ SimpleBezier = "simplebezier"
56
+ }
57
+ export type EdgeMarker = {
58
+ type: MarkerType;
59
+ color?: string;
60
+ width?: number;
61
+ height?: number;
62
+ markerUnits?: string;
63
+ orient?: string;
64
+ strokeWidth?: number;
65
+ };
66
+ export type EdgeMarkerType = string | EdgeMarker;
67
+ export declare enum MarkerType {
68
+ Arrow = "arrow",
69
+ ArrowClosed = "arrowclosed"
70
+ }
71
+ export type MarkerProps = EdgeMarker & {
72
+ id: string;
73
+ };
74
+ export type EdgePosition = {
75
+ sourceX: number;
76
+ sourceY: number;
77
+ targetX: number;
78
+ targetY: number;
79
+ sourcePosition: Position;
80
+ targetPosition: Position;
81
+ };
82
+ export type EdgeLookup<EdgeType extends EdgeBase = EdgeBase> = Map<string, EdgeType>;
83
+ //# sourceMappingURL=edges.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../../../src/types/system/edges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,MA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import type { InternalNodeBase, NodeBase, NodeDragItem, NodeOrigin } from './nodes';
4
+ import type { ConnectingHandle, HandleType } from './handles';
5
+ import { PanZoomInstance } from './panzoom';
6
+ import { EdgeBase } from '.';
7
+ export type Project = (position: XYPosition) => XYPosition;
8
+ export type OnMove = (event: MouseEvent | TouchEvent | null, viewport: Viewport) => void;
9
+ export type OnMoveStart = OnMove;
10
+ export type OnMoveEnd = OnMove;
11
+ export type ZoomInOut = (options?: ViewportHelperFunctionOptions) => void;
12
+ export type ZoomTo = (zoomLevel: number, options?: ViewportHelperFunctionOptions) => void;
13
+ export type GetZoom = () => number;
14
+ export type GetViewport = () => Viewport;
15
+ export type SetViewport = (viewport: Viewport, options?: ViewportHelperFunctionOptions) => void;
16
+ export type SetCenter = (x: number, y: number, options?: SetCenterOptions) => void;
17
+ export type FitBounds = (bounds: Rect, options?: FitBoundsOptions) => void;
18
+ export type Connection = {
19
+ source: string;
20
+ target: string;
21
+ sourceHandle: string | null;
22
+ targetHandle: string | null;
23
+ };
24
+ export type HandleConnection = Connection & {
25
+ edgeId: string;
26
+ };
27
+ export type ConnectionStatus = 'valid' | 'invalid';
28
+ export declare enum ConnectionMode {
29
+ Strict = "strict",
30
+ Loose = "loose"
31
+ }
32
+ export type OnConnectStartParams = {
33
+ nodeId: string | null;
34
+ handleId: string | null;
35
+ handleType: HandleType | null;
36
+ };
37
+ export type OnConnectStart = (event: MouseEvent | TouchEvent, params: OnConnectStartParams) => void;
38
+ export type OnConnect = (connection: Connection) => void;
39
+ export type OnConnectEnd = (event: MouseEvent | TouchEvent) => void;
40
+ export type IsValidConnection = (edge: EdgeBase | Connection) => boolean;
41
+ export type FitViewParamsBase<NodeType extends NodeBase> = {
42
+ nodeLookup: Map<string, InternalNodeBase<NodeType>>;
43
+ width: number;
44
+ height: number;
45
+ panZoom: PanZoomInstance;
46
+ minZoom: number;
47
+ maxZoom: number;
48
+ nodeOrigin?: NodeOrigin;
49
+ };
50
+ export type FitViewOptionsBase<NodeType extends NodeBase = NodeBase> = {
51
+ padding?: number;
52
+ includeHiddenNodes?: boolean;
53
+ minZoom?: number;
54
+ maxZoom?: number;
55
+ duration?: number;
56
+ nodes?: (NodeType | {
57
+ id: string;
58
+ })[];
59
+ };
60
+ export type Viewport = {
61
+ x: number;
62
+ y: number;
63
+ zoom: number;
64
+ };
65
+ export type KeyCode = string | Array<string>;
66
+ export type SnapGrid = [number, number];
67
+ export declare enum PanOnScrollMode {
68
+ Free = "free",
69
+ Vertical = "vertical",
70
+ Horizontal = "horizontal"
71
+ }
72
+ export type ViewportHelperFunctionOptions = {
73
+ duration?: number;
74
+ };
75
+ export type SetCenterOptions = ViewportHelperFunctionOptions & {
76
+ zoom?: number;
77
+ };
78
+ export type FitBoundsOptions = ViewportHelperFunctionOptions & {
79
+ padding?: number;
80
+ };
81
+ export type OnViewportChange = (viewport: Viewport) => void;
82
+ export type D3ZoomInstance = ZoomBehavior<Element, unknown>;
83
+ export type D3SelectionInstance = D3Selection<Element, unknown, null, undefined>;
84
+ export type D3ZoomHandler = (this: Element, event: any, d: unknown) => void;
85
+ export type UpdateNodeInternals = (nodeId: string | string[]) => void;
86
+ export type PanelPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
87
+ export type ProOptions = {
88
+ account?: string;
89
+ hideAttribution: boolean;
90
+ };
91
+ export type UseDragEvent = D3DragEvent<HTMLDivElement, null, SubjectPosition>;
92
+ export declare enum SelectionMode {
93
+ Partial = "partial",
94
+ Full = "full"
95
+ }
96
+ export type SelectionRect = Rect & {
97
+ startX: number;
98
+ startY: number;
99
+ };
100
+ export type OnError = (id: string, message: string) => void;
101
+ export type UpdateNodePositions = (dragItems: Map<string, NodeDragItem | InternalNodeBase>, dragging?: boolean) => void;
102
+ export type PanBy = (delta: XYPosition) => boolean;
103
+ export type UpdateConnection = (params: {
104
+ connectionPosition: XYPosition | null;
105
+ connectionStatus: ConnectionStatus | null;
106
+ connectionStartHandle: ConnectingHandle | null;
107
+ connectionEndHandle: ConnectingHandle | null;
108
+ }) => void;
109
+ export type ColorModeClass = 'light' | 'dark';
110
+ export type ColorMode = ColorModeClass | 'system';
111
+ export type ConnectionLookup = Map<string, Map<string, HandleConnection>>;
112
+ export type OnBeforeDeleteBase<NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase> = ({ nodes, edges, }: {
113
+ nodes: NodeType[];
114
+ edges: EdgeType[];
115
+ }) => Promise<boolean | {
116
+ nodes: NodeType[];
117
+ edges: EdgeType[];
118
+ }>;
119
+ //# sourceMappingURL=general.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../src/types/system/general.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,IAAI,WAAW,EACxB,eAAe,EACf,YAAY,EACb,MAAM,IAAI,CAAC;AAEZ,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EACV,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,UAAU,EACX,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC;AAE7B,MAAM,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,UAAU,KAAK,UAAU,CAAC;AAE3D,MAAM,MAAM,MAAM,GAAG,CACnB,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,EACrC,QAAQ,EAAE,QAAQ,KACf,IAAI,CAAC;AACV,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AACjC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,EAAE,6BAA6B,KAAK,IAA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Connection } from '.';
2
+ export type HandleType = 'source' | 'target';
3
+ export type HandleElement = {
4
+ id?: string | null;
5
+ x: number;
6
+ y: number;
7
+ width: number;
8
+ height: number;
9
+ position: Position;
10
+ type?: HandleType;
11
+ };
12
+ export type ConnectingHandle = {
13
+ nodeId: string;
14
+ type: HandleType;
15
+ handleId?: string | null;
16
+ };
17
+ export type ConnectionHandle = {
18
+ id: string | null;
19
+ type: HandleType;
20
+ nodeId: string;
21
+ x: number;
22
+ y: number;
23
+ };
24
+ export type HandleProps = {
25
+ /** Type of the handle
26
+ * @example HandleType.Source, HandleType.Target
27
+ */
28
+ type: HandleType;
29
+ /** Position of the handle
30
+ * @example Position.TopLeft, Position.TopRight,
31
+ * Position.BottomLeft, Position.BottomRight
32
+ */
33
+ position: Position;
34
+ /** Should you be able to connect to/from this handle */
35
+ isConnectable?: boolean;
36
+ /** Should you be able to connect from this handle */
37
+ isConnectableStart?: boolean;
38
+ /** Should you be able to connect to this handle */
39
+ isConnectableEnd?: boolean;
40
+ /** Callback called when connection is made */
41
+ onConnect?: OnConnect;
42
+ /** Callback if connection is valid
43
+ * @remarks connection becomes an edge if isValidConnection returns true
44
+ */
45
+ isValidConnection?: IsValidConnection;
46
+ /** Id of the handle
47
+ * @remarks optional if there is only one handle of this type
48
+ */
49
+ id?: string;
50
+ };
51
+ //# sourceMappingURL=handles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../../../src/types/system/handles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,GAAG,CAAC;AAEhE,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7C,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB,wDAAwD;IACxD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qDAAqD;IACrD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mDAAmD;IACnD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,8CAA8C;IAC9C,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from './changes';
2
+ export * from './general';
3
+ export * from './nodes';
4
+ export * from './edges';
5
+ export * from './handles';
6
+ export * from './utils';
7
+ export * from './panzoom';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/system/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,126 @@
1
+ import type { XYPosition, Position, CoordinateExtent, HandleElement } from '.';
2
+ import { Optional } from '../utils/types';
3
+ /**
4
+ * Framework independent node data structure.
5
+ *
6
+ * @typeParam NodeData - type of the node data
7
+ * @typeParam NodeType - type of the node
8
+ */
9
+ export type NodeBase<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string = string> = {
10
+ /** Unique id of a node */
11
+ id: string;
12
+ /** Position of a node on the pane
13
+ * @example { x: 0, y: 0 }
14
+ */
15
+ position: XYPosition;
16
+ /** Arbitrary data passed to a node */
17
+ data: NodeData;
18
+ /** Type of node defined in nodeTypes */
19
+ type?: NodeType;
20
+ /** Only relevant for default, source, target nodeType. controls source position
21
+ * @example 'right', 'left', 'top', 'bottom'
22
+ */
23
+ sourcePosition?: Position;
24
+ /** Only relevant for default, source, target nodeType. controls target position
25
+ * @example 'right', 'left', 'top', 'bottom'
26
+ */
27
+ targetPosition?: Position;
28
+ hidden?: boolean;
29
+ selected?: boolean;
30
+ /** True, if node is being dragged */
31
+ dragging?: boolean;
32
+ draggable?: boolean;
33
+ selectable?: boolean;
34
+ connectable?: boolean;
35
+ deletable?: boolean;
36
+ dragHandle?: string;
37
+ width?: number;
38
+ height?: number;
39
+ initialWidth?: number;
40
+ initialHeight?: number;
41
+ /** Parent node id, used for creating sub-flows */
42
+ parentId?: string;
43
+ zIndex?: number;
44
+ /** Boundary a node can be moved in
45
+ * @example 'parent' or [[0, 0], [100, 100]]
46
+ */
47
+ extent?: 'parent' | CoordinateExtent;
48
+ expandParent?: boolean;
49
+ ariaLabel?: string;
50
+ /** Origin of the node relative to it's position
51
+ * @example
52
+ * [0.5, 0.5] // centers the node
53
+ * [0, 0] // top left
54
+ * [1, 1] // bottom right
55
+ */
56
+ origin?: NodeOrigin;
57
+ handles?: NodeHandle[];
58
+ measured?: {
59
+ width?: number;
60
+ height?: number;
61
+ };
62
+ };
63
+ export type InternalNodeBase<NodeType extends NodeBase = NodeBase> = NodeType & {
64
+ measured: {
65
+ width?: number;
66
+ height?: number;
67
+ };
68
+ internals: {
69
+ positionAbsolute: XYPosition;
70
+ z: number;
71
+ /** Holds a reference to the original node object provided by the user.
72
+ * Used as an optimization to avoid certain operations. */
73
+ userNode: NodeType;
74
+ handleBounds?: NodeHandleBounds;
75
+ };
76
+ };
77
+ /**
78
+ * The node data structure that gets used for the nodes prop.
79
+ *
80
+ * @public
81
+ */
82
+ export type NodeProps<NodeType extends NodeBase> = Pick<NodeType, 'id' | 'data' | 'width' | 'height' | 'sourcePosition' | 'targetPosition' | 'selected' | 'dragHandle'> & Required<Pick<NodeType, 'type' | 'dragging' | 'zIndex'>> & {
83
+ /** whether a node is connectable or not */
84
+ isConnectable: boolean;
85
+ /** position absolute x value */
86
+ positionAbsoluteX: number;
87
+ /** position absolute x value */
88
+ positionAbsoluteY: number;
89
+ };
90
+ export type NodeHandleBounds = {
91
+ source: HandleElement[] | null;
92
+ target: HandleElement[] | null;
93
+ };
94
+ export type InternalNodeUpdate = {
95
+ id: string;
96
+ nodeElement: HTMLDivElement;
97
+ force?: boolean;
98
+ };
99
+ export type NodeBounds = XYPosition & {
100
+ width: number | null;
101
+ height: number | null;
102
+ };
103
+ export type NodeDragItem = {
104
+ id: string;
105
+ position: XYPosition;
106
+ distance: XYPosition;
107
+ measured: {
108
+ width: number;
109
+ height: number;
110
+ };
111
+ internals: {
112
+ positionAbsolute: XYPosition;
113
+ };
114
+ extent?: 'parent' | CoordinateExtent;
115
+ parentId?: string;
116
+ dragging?: boolean;
117
+ origin?: NodeOrigin;
118
+ expandParent?: boolean;
119
+ };
120
+ export type NodeOrigin = [number, number];
121
+ export type OnSelectionDrag = (event: MouseEvent, nodes: NodeBase[]) => void;
122
+ export type NodeHandle = Optional<HandleElement, 'width' | 'height'>;
123
+ export type Align = 'center' | 'start' | 'end';
124
+ export type NodeLookup<NodeType extends InternalNodeBase = InternalNodeBase> = Map<string, NodeType>;
125
+ export type ParentLookup<NodeType extends InternalNodeBase = InternalNodeBase> = Map<string, NodeType[]>;
126
+ //# sourceMappingURL=nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../src/types/system/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,CAClB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,QAAQ,SAAS,MAAM,GAAG,MAAM,IAC9B;IACF,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,QAAQ,EAAE,UAAU,CAAC;IACrB,sCAAsC;IACtC,IAAI,EAAE,QAAQ,CAAC;IACf,wCAAwC;IACxC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;OAEG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B;;OAEG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,C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,aAAa,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC;AAErE,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAE/C,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,gBAAgB,GAAG,gBAAgB,IACzE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACxB,MAAM,MAAM,YAAY,CAAC,QAAQ,SAAS,gBAAgB,GAAG,gBAAgB,IAC3E,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { ZoomTransform } from 'd3-zoom';
2
+ import { PanOnScrollMode, type CoordinateExtent, type Transform, type Viewport } from './';
3
+ export type OnDraggingChange = (dragging: boolean) => void;
4
+ export type OnTransformChange = (transform: Transform) => void;
5
+ export type PanZoomParams = {
6
+ domNode: Element;
7
+ minZoom: number;
8
+ maxZoom: number;
9
+ viewport: Viewport;
10
+ translateExtent: CoordinateExtent;
11
+ onTransformChange: OnTransformChange;
12
+ onDraggingChange: OnDraggingChange;
13
+ onPanZoomStart?: OnPanZoom;
14
+ onPanZoom?: OnPanZoom;
15
+ onPanZoomEnd?: OnPanZoom;
16
+ };
17
+ export type PanZoomTransformOptions = {
18
+ duration?: number;
19
+ };
20
+ export type OnPanZoom = (event: MouseEvent | TouchEvent | null, viewport: Viewport) => void;
21
+ export type PanZoomUpdateOptions = {
22
+ noWheelClassName: string;
23
+ noPanClassName: string;
24
+ onPaneContextMenu?: (event: MouseEvent) => void;
25
+ preventScrolling: boolean;
26
+ panOnScroll: boolean;
27
+ panOnDrag: boolean | number[];
28
+ panOnScrollMode: PanOnScrollMode;
29
+ panOnScrollSpeed: number;
30
+ userSelectionActive: boolean;
31
+ zoomOnPinch: boolean;
32
+ zoomOnScroll: boolean;
33
+ zoomOnDoubleClick: boolean;
34
+ zoomActivationKeyPressed: boolean;
35
+ lib: string;
36
+ };
37
+ export type PanZoomInstance = {
38
+ update: (params: PanZoomUpdateOptions) => void;
39
+ destroy: () => void;
40
+ getViewport: () => Viewport;
41
+ setViewport: (viewport: Viewport, options?: PanZoomTransformOptions) => ZoomTransform | undefined;
42
+ setViewportConstrained: (viewport: Viewport, extent: CoordinateExtent, translateExtent: CoordinateExtent) => ZoomTransform | undefined;
43
+ setScaleExtent: (scaleExtent: [number, number]) => void;
44
+ setTranslateExtent: (translateExtent: CoordinateExtent) => void;
45
+ scaleTo: (scale: number, options?: PanZoomTransformOptions) => void;
46
+ scaleBy: (factor: number, options?: PanZoomTransformOptions) => void;
47
+ syncViewport: (viewport: Viewport) => void;
48
+ };
49
+ //# sourceMappingURL=panzoom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panzoom.d.ts","sourceRoot":"","sources":["../../../src/types/system/panzoom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,IAAI,CAAC;AAE3F,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;AAC3D,MAAM,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;AAE/D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,gBAAgB,CAAC;IAClC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,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