@mp70/react-networks 0.5.1 → 0.7.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/LICENSE ADDED
@@ -0,0 +1,46 @@
1
+ DUAL LICENSE - AGPL-3.0 AND COMMERCIAL
2
+
3
+ Copyright (c) 2024 Matt Pickering. All rights reserved.
4
+
5
+ This software is dual-licensed under the GNU Affero General Public License version 3 (AGPL-3.0) and a commercial license.
6
+
7
+ ## Option 1: GNU Affero General Public License v3.0
8
+
9
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
12
+
13
+ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
14
+
15
+ ## Option 2: Commercial License
16
+
17
+ For organizations that prefer not to use the AGPL-3.0 license, a commercial license is available. The commercial license provides:
18
+
19
+ - No copyleft obligations
20
+ - No requirement to open source derivative works
21
+ - No requirement to provide source code to users
22
+ - Commercial use without AGPL restrictions
23
+ - Priority support and maintenance
24
+ - Custom licensing terms available
25
+
26
+ ### Commercial License Terms
27
+
28
+ Subject to the terms and conditions of the commercial license, Matt Pickering hereby grants you a non-exclusive, non-transferable license to use the Software for commercial purposes without the restrictions of the AGPL-3.0.
29
+
30
+ The commercial license does not grant you the right to:
31
+ 1. Distribute, sublicense, or transfer the Software to any third party without permission
32
+ 2. Remove or alter any proprietary notices or labels on the Software
33
+
34
+ ### Commercial License Inquiries
35
+
36
+ For commercial licensing inquiries, please contact:
37
+ Matt Pickering
38
+ Email: info@rackout.net
39
+
40
+ ## License Choice
41
+
42
+ You may choose to use this software under either:
43
+ - The AGPL-3.0 license (free, with copyleft obligations)
44
+ - A commercial license (paid, without copyleft obligations)
45
+
46
+ If you do not explicitly choose a commercial license, you are automatically bound by the terms of the AGPL-3.0 license.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # react-networks
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@mp70/react-networks.svg)](https://www.npmjs.com/package/@mp70/react-networks)
4
- [![license](https://img.shields.io/npm/l/@mp70/react-networks.svg)](https://www.npmjs.com/package/@mp70/react-networks)
3
+ [![npm version](https://img.shields.io/npm/v/react-networks.svg)](https://www.npmjs.com/package/react-networks)
4
+ [![license](https://img.shields.io/npm/l/react-networks.svg)](https://www.npmjs.com/package/react-networks)
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
6
6
 
7
7
  A React library for creating interactive network diagrams with support for rack management, fiber networks, and power distribution. Built on React Flow with TypeScript support.
@@ -25,19 +25,19 @@ A React library for creating interactive network diagrams with support for rack
25
25
  ### Installation
26
26
 
27
27
  ```bash
28
- npm install @mp70/react-networks react react-dom reactflow
28
+ npm install react-networks react react-dom reactflow
29
29
  # or
30
- yarn add @mp70/react-networks react react-dom reactflow
30
+ yarn add react-networks react react-dom reactflow
31
31
  # or
32
- pnpm add @mp70/react-networks react react-dom reactflow
32
+ pnpm add react-networks react react-dom reactflow
33
33
  ```
34
34
 
35
35
  ### Basic Usage
36
36
 
37
37
  ```tsx
38
38
  import React from 'react';
39
- import { NetworkDiagram, NetworkNode, NetworkEdge } from '@mp70/react-networks';
40
- import '@mp70/react-networks/index.css';
39
+ import { NetworkDiagram, NetworkNode, NetworkEdge } from 'react-networks';
40
+ import 'react-networks/index.css';
41
41
 
42
42
  const nodes: NetworkNode[] = [
43
43
  {
@@ -87,7 +87,7 @@ export default App;
87
87
 
88
88
  ### Data Model
89
89
 
90
- `@mp70/react-networks` supports two control layers:
90
+ `react-networks` supports two control layers:
91
91
 
92
92
  - `document` / `initialDocument` / `onDocumentChange` use `DiagramDocument`, the canonical persisted/editor schema. Prefer this for saved diagrams, import/export, and external integrations.
93
93
  - `nodes` / `edges` remain the lower-level React Flow-shaped control surface when you want direct control of rendered nodes and edges.
@@ -199,6 +199,8 @@ For new code, prefer the document-model props. The graph props and React Flow es
199
199
  | `onEdgeUpdate` | `(oldEdge: ReactFlowEdge, newConnection: Connection) => void` | - | Edge update (reconnect) override |
200
200
  | `isValidConnection` | `(connection: Connection) => boolean` | - | Connection validation override |
201
201
  | `connectionMode` | `ConnectionMode` | - | React Flow connection mode |
202
+ | `connectionRadius` | `number` | React Flow default | Pointer snap distance (px) for handles. Raise to make small ports easier to target; lower to avoid mis-targeting on dense devices |
203
+ | `onConnectRejected` | `(payload: NetworkConnectionRejection) => void` | - | Fired when a connect/reconnect attempt is rejected, so you can surface feedback instead of failing silently |
202
204
  | `reAssignable` | `boolean` | `true` | Allow devices to move between racks / ungroup on drag |
203
205
  | `colorMode` | `'light' \| 'dark' \| 'system'` | - | Diagram color mode |
204
206
  | `onInit` | `(instance: ReactFlowInstance) => void` | - | Called when React Flow is ready |
@@ -292,7 +294,7 @@ type NetworkEdgeType = 'fiber' | 'ethernet' | 'power' | 'smoothstep' | 'step' |
292
294
  ### Rack Configuration
293
295
 
294
296
  ```tsx
295
- import { RackConfig, buildNodesFromRackConfig, Width } from '@mp70/react-networks';
297
+ import { RackConfig, buildNodesFromRackConfig, Width } from 'react-networks';
296
298
 
297
299
  const rackSchema: RackConfig[] = [
298
300
  {
@@ -339,7 +341,7 @@ Device images (e.g. server front/rear photos or SVGs) use `frontImageUrl` and `r
339
341
  ### Inventory Integration
340
342
 
341
343
  ```tsx
342
- import { inventoryToNetworkDiagram } from '@mp70/react-networks';
344
+ import { inventoryToNetworkDiagram } from 'react-networks';
343
345
 
344
346
  const inventoryData = {
345
347
  racks: [...],
@@ -353,7 +355,7 @@ const { nodes, edges } = inventoryToNetworkDiagram(inventoryData);
353
355
  ### Custom Styling
354
356
 
355
357
  ```tsx
356
- import '@mp70/react-networks/index.css';
358
+ import 'react-networks/index.css';
357
359
 
358
360
  // Override CSS variables
359
361
  .network-diagram {