@mp70/react-networks 0.1.9-beta → 0.2.0-beta.1
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 +17 -28
- package/dist/index.d.mts +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @mp70/react-networks
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@mp70/react-networks)
|
|
4
|
+
[](https://www.npmjs.com/package/@mp70/react-networks)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
6
|
|
|
7
|
-
A
|
|
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.
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
@@ -13,6 +13,7 @@ A production-ready React library for creating interactive network diagrams with
|
|
|
13
13
|
- **Fiber Networks**: Visual representation of fiber connections and patch panels
|
|
14
14
|
- **Power Distribution**: Vertical PDU support with power connections
|
|
15
15
|
- **View Switching**: Front/rear view switching for devices and racks
|
|
16
|
+
- **Device Images**: Front/rear device images supported (PNG, SVG, JPEG, etc.) via `frontImageUrl` / `rearImageUrl`
|
|
16
17
|
- **Rack Alignment**: Align rack bottoms to the same horizontal plane
|
|
17
18
|
- **Inventory Integration**: Built-in helpers to import/export generic inventory/CMDB data
|
|
18
19
|
- **Customizable**: Extensive styling and theming options
|
|
@@ -89,10 +90,8 @@ export default App;
|
|
|
89
90
|
|
|
90
91
|
### Documentation Resources
|
|
91
92
|
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
- 🌐 [Documentation Site](../docs/) - Interactive documentation with live examples
|
|
95
|
-
- 📝 [Contributing Guide](CONTRIBUTING.md) - Development guidelines
|
|
93
|
+
- Main Project README: `../../README.md` - Project overview and quick start
|
|
94
|
+
- Contributing Guide: `CONTRIBUTING.md` - Development guidelines
|
|
96
95
|
|
|
97
96
|
### API Reference
|
|
98
97
|
|
|
@@ -127,7 +126,6 @@ export default App;
|
|
|
127
126
|
- [`removeSpliceFromTray`](#removesplicefromtray) - Remove splice from tray schema
|
|
128
127
|
|
|
129
128
|
**Data Integration:**
|
|
130
|
-
- [`netboxToNetworkDiagram`](#netboxtonetworkdiagram) - Convert NetBox data to diagram
|
|
131
129
|
- [`inventoryToNetworkDiagram`](#inventorytonetworkdiagram) - Convert inventory/CMDB data to diagram
|
|
132
130
|
|
|
133
131
|
**Dimension Calculations:**
|
|
@@ -222,6 +220,8 @@ const rackSchema: RackConfig[] = [
|
|
|
222
220
|
const nodes = buildNodesFromRackConfig(rackSchema);
|
|
223
221
|
```
|
|
224
222
|
|
|
223
|
+
Device images (e.g. server front/rear photos or SVGs) use `frontImageUrl` and `rearImageUrl` on each device; supported formats include PNG, SVG, JPEG, GIF, and WebP.
|
|
224
|
+
|
|
225
225
|
### Inventory Integration
|
|
226
226
|
|
|
227
227
|
```tsx
|
|
@@ -285,13 +285,13 @@ The library supports extensive theming through CSS variables:
|
|
|
285
285
|
|
|
286
286
|
### Prerequisites
|
|
287
287
|
|
|
288
|
-
- Node.js
|
|
288
|
+
- Node.js 22+
|
|
289
289
|
- npm, yarn, or pnpm
|
|
290
290
|
|
|
291
291
|
### Setup
|
|
292
292
|
|
|
293
293
|
```bash
|
|
294
|
-
|
|
294
|
+
Clone the repository, then:
|
|
295
295
|
cd react-networks/packages/network-diagrams
|
|
296
296
|
npm install
|
|
297
297
|
```
|
|
@@ -331,7 +331,7 @@ The library is distributed as:
|
|
|
331
331
|
|
|
332
332
|
## Contributing
|
|
333
333
|
|
|
334
|
-
We welcome contributions!
|
|
334
|
+
We welcome contributions! See `CONTRIBUTING.md` for details.
|
|
335
335
|
|
|
336
336
|
### Development Workflow
|
|
337
337
|
|
|
@@ -346,26 +346,15 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
|
|
|
346
346
|
|
|
347
347
|
Dual-licensed under:
|
|
348
348
|
|
|
349
|
-
- **AGPL-3.0** (Free) - For open source, personal, and educational use. Copyleft applies.
|
|
350
|
-
- **Commercial** (Paid) - For proprietary/commercial use without copyleft obligations.
|
|
351
|
-
|
|
352
|
-
See [LICENSE](../../LICENSE) for details. By installing, you agree to use under either license. Contact us for commercial use.
|
|
353
|
-
|
|
354
|
-
## Support
|
|
349
|
+
- **AGPL-3.0** (Free) - For open source, personal, and educational use. Copyleft applies.
|
|
350
|
+
- **Commercial** (Paid) - For proprietary/commercial use without copyleft obligations.
|
|
355
351
|
|
|
356
|
-
|
|
357
|
-
- 📚 [API Documentation](docs/API.md)
|
|
358
|
-
- 🌐 [Documentation Site](../docs/) - Interactive docs with examples
|
|
359
|
-
- 🐛 [Issue Tracker](https://github.com/MP70/react-networks/issues)
|
|
360
|
-
- 💬 [Discussions](https://github.com/MP70/react-networks/discussions)
|
|
361
|
-
- 📧 [Email Support](mailto:info@serversearcher.com)
|
|
352
|
+
See `../../LICENSE` for details. By installing, you agree to use under either license.
|
|
362
353
|
|
|
363
354
|
## Acknowledgments
|
|
364
355
|
|
|
365
|
-
-
|
|
366
|
-
- Network inventory/CMDB projects for inspiration
|
|
367
|
-
- The open source community for feedback and contributions
|
|
356
|
+
- React Flow for the diagram foundation
|
|
368
357
|
|
|
369
358
|
---
|
|
370
359
|
|
|
371
|
-
Made with love by [
|
|
360
|
+
Made with love by [matt](https://github.com/MP70) from [rackout.net](https://rackout.net)
|
package/dist/index.d.mts
CHANGED
|
@@ -116,16 +116,22 @@ interface NetworkNode {
|
|
|
116
116
|
rearPorts?: PortBlock[];
|
|
117
117
|
/** Power port side for rear view */
|
|
118
118
|
powerSide?: PowerSide;
|
|
119
|
-
/** Optional front image URL for device background */
|
|
119
|
+
/** Optional front image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
120
120
|
frontImageUrl?: string;
|
|
121
|
-
/** Optional rear image URL for device background */
|
|
121
|
+
/** Optional rear image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
122
122
|
rearImageUrl?: string;
|
|
123
|
+
/** Optional attribution URL for front image (e.g. source/license link) */
|
|
124
|
+
frontImageAttribution?: string;
|
|
125
|
+
/** Optional attribution URL for rear image (e.g. source/license link) */
|
|
126
|
+
rearImageAttribution?: string;
|
|
123
127
|
/** Optional background sizing for device images */
|
|
124
128
|
imageFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
125
129
|
/** Optional background position for device images */
|
|
126
130
|
imagePosition?: string;
|
|
127
131
|
/** Optional background repeat for device images */
|
|
128
132
|
imageRepeat?: 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y';
|
|
133
|
+
/** When true, stretch device image to fill the device bounds (overrides imageFit) */
|
|
134
|
+
stretchToFit?: boolean;
|
|
129
135
|
/** Vertical PDU height in centimeters */
|
|
130
136
|
heightCm?: number;
|
|
131
137
|
/** Number of AC power ports */
|
|
@@ -273,16 +279,22 @@ interface RackDevice {
|
|
|
273
279
|
rearPorts?: PortBlock[];
|
|
274
280
|
/** Power port side for rear view */
|
|
275
281
|
powerSide?: PowerSide;
|
|
276
|
-
/** Optional front image URL for device background */
|
|
282
|
+
/** Optional front image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
277
283
|
frontImageUrl?: string;
|
|
278
|
-
/** Optional rear image URL for device background */
|
|
284
|
+
/** Optional rear image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
279
285
|
rearImageUrl?: string;
|
|
286
|
+
/** Optional attribution URL for front image (e.g. source/license link) */
|
|
287
|
+
frontImageAttribution?: string;
|
|
288
|
+
/** Optional attribution URL for rear image (e.g. source/license link) */
|
|
289
|
+
rearImageAttribution?: string;
|
|
280
290
|
/** Optional background sizing for device images */
|
|
281
291
|
imageFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
282
292
|
/** Optional background position for device images */
|
|
283
293
|
imagePosition?: string;
|
|
284
294
|
/** Optional background repeat for device images */
|
|
285
295
|
imageRepeat?: 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y';
|
|
296
|
+
/** When true, stretch device image to fill the device bounds (overrides imageFit) */
|
|
297
|
+
stretchToFit?: boolean;
|
|
286
298
|
/** Connected device IDs */
|
|
287
299
|
connections?: string[];
|
|
288
300
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -116,16 +116,22 @@ interface NetworkNode {
|
|
|
116
116
|
rearPorts?: PortBlock[];
|
|
117
117
|
/** Power port side for rear view */
|
|
118
118
|
powerSide?: PowerSide;
|
|
119
|
-
/** Optional front image URL for device background */
|
|
119
|
+
/** Optional front image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
120
120
|
frontImageUrl?: string;
|
|
121
|
-
/** Optional rear image URL for device background */
|
|
121
|
+
/** Optional rear image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
122
122
|
rearImageUrl?: string;
|
|
123
|
+
/** Optional attribution URL for front image (e.g. source/license link) */
|
|
124
|
+
frontImageAttribution?: string;
|
|
125
|
+
/** Optional attribution URL for rear image (e.g. source/license link) */
|
|
126
|
+
rearImageAttribution?: string;
|
|
123
127
|
/** Optional background sizing for device images */
|
|
124
128
|
imageFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
125
129
|
/** Optional background position for device images */
|
|
126
130
|
imagePosition?: string;
|
|
127
131
|
/** Optional background repeat for device images */
|
|
128
132
|
imageRepeat?: 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y';
|
|
133
|
+
/** When true, stretch device image to fill the device bounds (overrides imageFit) */
|
|
134
|
+
stretchToFit?: boolean;
|
|
129
135
|
/** Vertical PDU height in centimeters */
|
|
130
136
|
heightCm?: number;
|
|
131
137
|
/** Number of AC power ports */
|
|
@@ -273,16 +279,22 @@ interface RackDevice {
|
|
|
273
279
|
rearPorts?: PortBlock[];
|
|
274
280
|
/** Power port side for rear view */
|
|
275
281
|
powerSide?: PowerSide;
|
|
276
|
-
/** Optional front image URL for device background */
|
|
282
|
+
/** Optional front image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
277
283
|
frontImageUrl?: string;
|
|
278
|
-
/** Optional rear image URL for device background */
|
|
284
|
+
/** Optional rear image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
279
285
|
rearImageUrl?: string;
|
|
286
|
+
/** Optional attribution URL for front image (e.g. source/license link) */
|
|
287
|
+
frontImageAttribution?: string;
|
|
288
|
+
/** Optional attribution URL for rear image (e.g. source/license link) */
|
|
289
|
+
rearImageAttribution?: string;
|
|
280
290
|
/** Optional background sizing for device images */
|
|
281
291
|
imageFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
282
292
|
/** Optional background position for device images */
|
|
283
293
|
imagePosition?: string;
|
|
284
294
|
/** Optional background repeat for device images */
|
|
285
295
|
imageRepeat?: 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y';
|
|
296
|
+
/** When true, stretch device image to fill the device bounds (overrides imageFit) */
|
|
297
|
+
stretchToFit?: boolean;
|
|
286
298
|
/** Connected device IDs */
|
|
287
299
|
connections?: string[];
|
|
288
300
|
}
|