@d2m/reactflow 11.11.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019-2023 webkid GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,134 @@
1
+ ![readme-header](https://user-images.githubusercontent.com/3797215/156259138-fb9f59f8-52f2-474a-b78c-6570867e4ead.svg#gh-light-mode-only)
2
+
3
+ <div align="center">
4
+
5
+ ![GitHub License MIT](https://img.shields.io/github/license/wbkd/react-flow?color=%23ff0072)
6
+ ![npm downloads](https://img.shields.io/npm/dt/%40d2m%2Freactflow?color=%23FF0072&label=downloads)
7
+ ![GitHub Repo stars](https://img.shields.io/github/stars/wbkd/react-flow?color=%23FF0072)
8
+ ![GitHub release (latest by date)](https://img.shields.io/github/v/release/wbkd/react-flow?color=%23FF0072)
9
+
10
+ A highly customizable React component for building interactive graphs and node-based editors.
11
+
12
+ [🚀 Getting Started](https://reactflow.dev/learn/getting-started/installation) | [📖 Documentation](https://reactflow.dev/learn/react-flow) | [📺 Examples](https://reactflow.dev/examples) | [☎️ Discord](https://discord.gg/RVmnytFmGW) | [💎 React Flow Pro](https://pro.reactflow.dev/pricing)
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ ## 🚨 Upcoming Changes
19
+
20
+ The main branch is the home of @xyflow/svelte and the upcoming @xyflow/react (React Flow v12). The current version is maintained and lives on the [v11 branch](https://github.com/xyflow/xyflow/tree/v11).
21
+
22
+
23
+ ## Key Features
24
+
25
+ - **Easy to use:** Seamless zooming and panning, single- and multi selection of graph elements and keyboard shortcuts are supported out of the box
26
+ - **Customizable:** Different [node](https://reactflow.dev/examples) and [edge types](https://reactflow.dev/examples/edges/edge-types) and support for custom nodes with multiple handles and custom edges
27
+ - **Fast rendering:** Only nodes that have changed are re-rendered
28
+ - **Hooks and Utils:** [Hooks](https://reactflow.dev/api-reference/hooks) for handling nodes, edges and the viewport and graph [helper functions](https://reactflow.dev/api-reference/utils)
29
+ - **Plugin Components:** [Background](https://reactflow.dev/api-reference/components/background), [MiniMap](https://reactflow.dev/api-reference/components/minimap) and [Controls](https://reactflow.dev/api-reference/components/controls)
30
+ - **Reliable**: Written in [Typescript](https://www.typescriptlang.org/) and tested with [cypress](https://www.cypress.io/)
31
+
32
+ ## Commercial Usage
33
+
34
+ **Are you using React Flow for a personal project?** Great! No sponsorship needed, you can support us by reporting any bugs you find, sending us screenshots of your projects, and starring us on Github 🌟
35
+
36
+ **Are you using React Flow at your organization and making money from it?** Awesome! We rely on your support to keep React Flow developed and maintained under an MIT License, just how we like it. You can do that on the [React Flow Pro website](https://reactflow.dev/pro) or through [Github Sponsors](https://github.com/sponsors/xyflow).
37
+
38
+ You can find more information in our [React Flow Pro FAQs](https://reactflow.dev/pro).
39
+
40
+
41
+ ## Installation
42
+
43
+ The easiest way to get the latest version of React Flow is to install it via npm, yarn or pnpm:
44
+
45
+ ```bash
46
+ npm install @d2m/reactflow
47
+ ```
48
+
49
+ ## Quick Start
50
+
51
+ This is only a very basic usage example of React Flow. To see everything that is possible with the library, please refer to the [website](https://reactflow.dev) for [guides](https://reactflow.dev/learn/customization/custom-nodes), [examples](https://reactflow.dev/examples) and the full [API reference](https://reactflow.dev/api-reference/react-flow).
52
+
53
+ ```jsx
54
+ import { useCallback } from 'react';
55
+ import ReactFlow, {
56
+ MiniMap,
57
+ Controls,
58
+ Background,
59
+ useNodesState,
60
+ useEdgesState,
61
+ addEdge,
62
+ } from '@d2m/reactflow';
63
+
64
+ import '@d2m/reactflow/dist/style.css';
65
+
66
+ const initialNodes = [
67
+ { id: '1', position: { x: 0, y: 0 }, data: { label: '1' } },
68
+ { id: '2', position: { x: 0, y: 100 }, data: { label: '2' } },
69
+ ];
70
+
71
+ const initialEdges = [{ id: 'e1-2', source: '1', target: '2' }];
72
+
73
+ function Flow() {
74
+ const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
75
+ const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
76
+
77
+ const onConnect = useCallback((params) => setEdges((eds) => addEdge(params, eds)), [setEdges]);
78
+
79
+ return (
80
+ <ReactFlow
81
+ nodes={nodes}
82
+ edges={edges}
83
+ onNodesChange={onNodesChange}
84
+ onEdgesChange={onEdgesChange}
85
+ onConnect={onConnect}
86
+ >
87
+ <MiniMap />
88
+ <Controls />
89
+ <Background />
90
+ </ReactFlow>
91
+ );
92
+ }
93
+ ```
94
+
95
+ ## Development
96
+
97
+ Before you can start developing please make sure that you have [pnpm](https://pnpm.io/) installed (`npm i -g pnpm`). Then install the dependencies using pnpm: `pnpm install`.
98
+
99
+ For local development, you can use `pnpm dev`.
100
+
101
+ ## Testing
102
+
103
+ Testing is done with cypress. You can find the tests in the [`examples/cypress`](/examples/cypress/) folder. In order to run the tests do:
104
+
105
+ ```sh
106
+ pnpm test
107
+ ```
108
+
109
+ ## Maintainers
110
+
111
+ React Flow is developed and maintained by [webkid](https://webkid.io), a web development agency with focus on data driven applications from Berlin. If you need help or want to talk to us about a collaboration, feel free to contact us:
112
+
113
+ - Moritz Klack • [Twitter](https://twitter.com/moklick) • [Github](https://github.com/moklick)
114
+ - Christopher Möller • [Twitter](https://twitter.com/chrtze) • [Github](https://github.com/chrtze)
115
+
116
+ You can also use our [contact form](https://pro.reactflow.dev/contact) or join the [React Flow Discord Server](https://discord.gg/Bqt6xrs).
117
+
118
+ ## Community Packages
119
+
120
+ - [useUndoable](https://github.com/Infinium8/useUndoable) - Hook for undo/redo functionality with an explicit React Flow example
121
+ - [react-flow-smart-edge](https://github.com/tisoap/react-flow-smart-edge) - Custom edge that doesn't intersect with nodes
122
+ - [Feliz.ReactFlow](https://github.com/tforkmann/Feliz.ReactFlow) - Feliz React Bindings for React Flow
123
+
124
+ ## Credits
125
+
126
+ React Flow was initially developed for [datablocks](https://datablocks.pro), a graph-based editor for transforming, analyzing and visualizing data in the browser. Under the hood, React Flow depends on these great libraries:
127
+
128
+ - [d3-zoom](https://github.com/d3/d3-zoom) - used for zoom, pan and drag interactions with the graph canvas
129
+ - [d3-drag](https://github.com/d3/d3-drag) - used for making the nodes draggable
130
+ - [zustand](https://github.com/pmndrs/zustand) - internal state management
131
+
132
+ ## License
133
+
134
+ React Flow is [MIT licensed](https://github.com/xyflow/xyflow/blob/main/LICENSE).
package/dist/base.css ADDED
@@ -0,0 +1,374 @@
1
+ /* this will be exported as base.css and can be used for a basic styling */
2
+ /* these are the necessary styles for React Flow, they get used by base.css and style.css */
3
+ .react-flow {
4
+ direction: ltr;
5
+ }
6
+ .react-flow__container {
7
+ position: absolute;
8
+ width: 100%;
9
+ height: 100%;
10
+ top: 0;
11
+ left: 0;
12
+ }
13
+ .react-flow__pane {
14
+ z-index: 1;
15
+ cursor: -webkit-grab;
16
+ cursor: grab;
17
+ }
18
+ .react-flow__pane.selection {
19
+ cursor: pointer;
20
+ }
21
+ .react-flow__pane.dragging {
22
+ cursor: -webkit-grabbing;
23
+ cursor: grabbing;
24
+ }
25
+ .react-flow__viewport {
26
+ transform-origin: 0 0;
27
+ z-index: 2;
28
+ pointer-events: none;
29
+ }
30
+ .react-flow__renderer {
31
+ z-index: 4;
32
+ }
33
+ .react-flow__selection {
34
+ z-index: 6;
35
+ }
36
+ .react-flow__nodesselection-rect:focus,
37
+ .react-flow__nodesselection-rect:focus-visible {
38
+ outline: none;
39
+ }
40
+ .react-flow .react-flow__edges {
41
+ pointer-events: none;
42
+ overflow: visible;
43
+ }
44
+ .react-flow__edge-path,
45
+ .react-flow__connection-path {
46
+ stroke: #b1b1b7;
47
+ stroke-width: 1;
48
+ fill: none;
49
+ }
50
+ .react-flow__edge {
51
+ pointer-events: visibleStroke;
52
+ cursor: pointer;
53
+ }
54
+ .react-flow__edge.animated path {
55
+ stroke-dasharray: 5;
56
+ -webkit-animation: dashdraw 0.5s linear infinite;
57
+ animation: dashdraw 0.5s linear infinite;
58
+ }
59
+ .react-flow__edge.animated path.react-flow__edge-interaction {
60
+ stroke-dasharray: none;
61
+ -webkit-animation: none;
62
+ animation: none;
63
+ }
64
+ .react-flow__edge.inactive {
65
+ pointer-events: none;
66
+ }
67
+ .react-flow__edge.selected,
68
+ .react-flow__edge:focus,
69
+ .react-flow__edge:focus-visible {
70
+ outline: none;
71
+ }
72
+ .react-flow__edge.selected .react-flow__edge-path,
73
+ .react-flow__edge:focus .react-flow__edge-path,
74
+ .react-flow__edge:focus-visible .react-flow__edge-path {
75
+ stroke: #555;
76
+ }
77
+ .react-flow__edge-textwrapper {
78
+ pointer-events: all;
79
+ }
80
+ .react-flow__edge-textbg {
81
+ fill: white;
82
+ }
83
+ .react-flow__edge .react-flow__edge-text {
84
+ pointer-events: none;
85
+ -webkit-user-select: none;
86
+ -moz-user-select: none;
87
+ user-select: none;
88
+ }
89
+ .react-flow__connection {
90
+ pointer-events: none;
91
+ }
92
+ .react-flow__connection .animated {
93
+ stroke-dasharray: 5;
94
+ -webkit-animation: dashdraw 0.5s linear infinite;
95
+ animation: dashdraw 0.5s linear infinite;
96
+ }
97
+ .react-flow__connectionline {
98
+ z-index: 1001;
99
+ }
100
+ .react-flow__nodes {
101
+ pointer-events: none;
102
+ transform-origin: 0 0;
103
+ }
104
+ .react-flow__node {
105
+ position: absolute;
106
+ -webkit-user-select: none;
107
+ -moz-user-select: none;
108
+ user-select: none;
109
+ pointer-events: all;
110
+ transform-origin: 0 0;
111
+ box-sizing: border-box;
112
+ cursor: -webkit-grab;
113
+ cursor: grab;
114
+ }
115
+ .react-flow__node.dragging {
116
+ cursor: -webkit-grabbing;
117
+ cursor: grabbing;
118
+ }
119
+ .react-flow__nodesselection {
120
+ z-index: 3;
121
+ transform-origin: left top;
122
+ pointer-events: none;
123
+ }
124
+ .react-flow__nodesselection-rect {
125
+ position: absolute;
126
+ pointer-events: all;
127
+ cursor: -webkit-grab;
128
+ cursor: grab;
129
+ }
130
+ .react-flow__handle {
131
+ position: absolute;
132
+ pointer-events: none;
133
+ min-width: 5px;
134
+ min-height: 5px;
135
+ background-color: #333;
136
+ }
137
+ .react-flow__handle.connectionindicator {
138
+ pointer-events: all;
139
+ cursor: crosshair;
140
+ }
141
+ .react-flow__handle-bottom {
142
+ top: auto;
143
+ left: 50%;
144
+ bottom: -4px;
145
+ transform: translate(-50%, 0);
146
+ }
147
+ .react-flow__handle-top {
148
+ left: 50%;
149
+ top: -4px;
150
+ transform: translate(-50%, 0);
151
+ }
152
+ .react-flow__handle-left {
153
+ top: 50%;
154
+ left: -4px;
155
+ transform: translate(0, -50%);
156
+ }
157
+ .react-flow__handle-right {
158
+ right: -4px;
159
+ top: 50%;
160
+ transform: translate(0, -50%);
161
+ }
162
+ .react-flow__edgeupdater {
163
+ cursor: move;
164
+ pointer-events: all;
165
+ }
166
+ .react-flow__panel {
167
+ position: absolute;
168
+ z-index: 5;
169
+ margin: 15px;
170
+ }
171
+ .react-flow__panel.top {
172
+ top: 0;
173
+ }
174
+ .react-flow__panel.bottom {
175
+ bottom: 0;
176
+ }
177
+ .react-flow__panel.left {
178
+ left: 0;
179
+ }
180
+ .react-flow__panel.right {
181
+ right: 0;
182
+ }
183
+ .react-flow__panel.center {
184
+ left: 50%;
185
+ transform: translateX(-50%);
186
+ }
187
+ .react-flow__attribution {
188
+ font-size: 10px;
189
+ background: rgba(255, 255, 255, 0.5);
190
+ padding: 2px 3px;
191
+ margin: 0;
192
+ }
193
+ .react-flow__attribution a {
194
+ text-decoration: none;
195
+ color: #999;
196
+ }
197
+ @-webkit-keyframes dashdraw {
198
+ from {
199
+ stroke-dashoffset: 10;
200
+ }
201
+ }
202
+ @keyframes dashdraw {
203
+ from {
204
+ stroke-dashoffset: 10;
205
+ }
206
+ }
207
+ .react-flow__edgelabel-renderer {
208
+ position: absolute;
209
+ width: 100%;
210
+ height: 100%;
211
+ pointer-events: none;
212
+ -webkit-user-select: none;
213
+ -moz-user-select: none;
214
+ user-select: none;
215
+ }
216
+ .react-flow__node-default,
217
+ .react-flow__node-input,
218
+ .react-flow__node-output,
219
+ .react-flow__node-group {
220
+ border-width: 1px;
221
+ border-style: solid;
222
+ border-color: #bbb;
223
+ }
224
+ .react-flow__node-default.selected,
225
+ .react-flow__node-default:focus,
226
+ .react-flow__node-default:focus-visible,
227
+ .react-flow__node-input.selected,
228
+ .react-flow__node-input:focus,
229
+ .react-flow__node-input:focus-visible,
230
+ .react-flow__node-output.selected,
231
+ .react-flow__node-output:focus,
232
+ .react-flow__node-output:focus-visible,
233
+ .react-flow__node-group.selected,
234
+ .react-flow__node-group:focus,
235
+ .react-flow__node-group:focus-visible {
236
+ outline: none;
237
+ border: 1px solid #555;
238
+ }
239
+ .react-flow__nodesselection-rect,
240
+ .react-flow__selection {
241
+ background: rgba(150, 150, 180, 0.1);
242
+ border: 1px dotted rgba(155, 155, 155, 0.8);
243
+ }
244
+ .react-flow__controls {
245
+ box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.08);
246
+ }
247
+ .react-flow__controls-button {
248
+ border: none;
249
+ background: #fefefe;
250
+ border-bottom: 1px solid #eee;
251
+ box-sizing: content-box;
252
+ display: flex;
253
+ justify-content: center;
254
+ align-items: center;
255
+ width: 16px;
256
+ height: 16px;
257
+ cursor: pointer;
258
+ -webkit-user-select: none;
259
+ -moz-user-select: none;
260
+ user-select: none;
261
+ padding: 5px;
262
+ }
263
+ .react-flow__controls-button:hover {
264
+ background: #f4f4f4;
265
+ }
266
+ .react-flow__controls-button svg {
267
+ width: 100%;
268
+ max-width: 12px;
269
+ max-height: 12px;
270
+ }
271
+ .react-flow__controls-button:disabled {
272
+ pointer-events: none;
273
+ }
274
+ .react-flow__controls-button:disabled svg {
275
+ fill-opacity: 0.4;
276
+ }
277
+ .react-flow__minimap {
278
+ background-color: #fff;
279
+ }
280
+ .react-flow__minimap svg {
281
+ display: block;
282
+ }
283
+ .react-flow__resize-control {
284
+ position: absolute;
285
+ }
286
+ .react-flow__resize-control.left,
287
+ .react-flow__resize-control.right {
288
+ cursor: ew-resize;
289
+ }
290
+ .react-flow__resize-control.top,
291
+ .react-flow__resize-control.bottom {
292
+ cursor: ns-resize;
293
+ }
294
+ .react-flow__resize-control.top.left,
295
+ .react-flow__resize-control.bottom.right {
296
+ cursor: nwse-resize;
297
+ }
298
+ .react-flow__resize-control.bottom.left,
299
+ .react-flow__resize-control.top.right {
300
+ cursor: nesw-resize;
301
+ }
302
+ /* handle styles */
303
+ .react-flow__resize-control.handle {
304
+ width: 4px;
305
+ height: 4px;
306
+ border: 1px solid #fff;
307
+ border-radius: 1px;
308
+ background-color: #3367d9;
309
+ transform: translate(-50%, -50%);
310
+ }
311
+ .react-flow__resize-control.handle.left {
312
+ left: 0;
313
+ top: 50%;
314
+ }
315
+ .react-flow__resize-control.handle.right {
316
+ left: 100%;
317
+ top: 50%;
318
+ }
319
+ .react-flow__resize-control.handle.top {
320
+ left: 50%;
321
+ top: 0;
322
+ }
323
+ .react-flow__resize-control.handle.bottom {
324
+ left: 50%;
325
+ top: 100%;
326
+ }
327
+ .react-flow__resize-control.handle.top.left {
328
+ left: 0;
329
+ }
330
+ .react-flow__resize-control.handle.bottom.left {
331
+ left: 0;
332
+ }
333
+ .react-flow__resize-control.handle.top.right {
334
+ left: 100%;
335
+ }
336
+ .react-flow__resize-control.handle.bottom.right {
337
+ left: 100%;
338
+ }
339
+ /* line styles */
340
+ .react-flow__resize-control.line {
341
+ border-color: #3367d9;
342
+ border-width: 0;
343
+ border-style: solid;
344
+ }
345
+ .react-flow__resize-control.line.left,
346
+ .react-flow__resize-control.line.right {
347
+ width: 1px;
348
+ transform: translate(-50%, 0);
349
+ top: 0;
350
+ height: 100%;
351
+ }
352
+ .react-flow__resize-control.line.left {
353
+ left: 0;
354
+ border-left-width: 1px;
355
+ }
356
+ .react-flow__resize-control.line.right {
357
+ left: 100%;
358
+ border-right-width: 1px;
359
+ }
360
+ .react-flow__resize-control.line.top,
361
+ .react-flow__resize-control.line.bottom {
362
+ height: 1px;
363
+ transform: translate(0, -50%);
364
+ left: 0;
365
+ width: 100%;
366
+ }
367
+ .react-flow__resize-control.line.top {
368
+ top: 0;
369
+ border-top-width: 1px;
370
+ }
371
+ .react-flow__resize-control.line.bottom {
372
+ border-bottom-width: 1px;
373
+ top: 100%;
374
+ }
@@ -0,0 +1,8 @@
1
+ export * from '@d2m/reactflow-core';
2
+ export * from '@d2m/reactflow-minimap';
3
+ export * from '@d2m/reactflow-controls';
4
+ export * from '@d2m/reactflow-background';
5
+ export * from '@d2m/reactflow-node-toolbar';
6
+ export * from '@d2m/reactflow-node-resizer';
7
+ export { ReactFlow as default } from '@d2m/reactflow-core';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/reactflow/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from '@d2m/reactflow-core';
2
+ export { ReactFlow as default } from '@d2m/reactflow-core';
3
+ export * from '@d2m/reactflow-minimap';
4
+ export * from '@d2m/reactflow-controls';
5
+ export * from '@d2m/reactflow-background';
6
+ export * from '@d2m/reactflow-node-toolbar';
7
+ export * from '@d2m/reactflow-node-resizer';
@@ -0,0 +1,7 @@
1
+ export * from '@d2m/reactflow-core';
2
+ export { ReactFlow as default } from '@d2m/reactflow-core';
3
+ export * from '@d2m/reactflow-minimap';
4
+ export * from '@d2m/reactflow-controls';
5
+ export * from '@d2m/reactflow-background';
6
+ export * from '@d2m/reactflow-node-toolbar';
7
+ export * from '@d2m/reactflow-node-resizer';