@mp70/react-networks 0.2.0-beta.1 → 0.2.0-rc.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 +67 -7
- package/dist/index.css +75 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +700 -209
- package/dist/index.d.ts +700 -209
- 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 +5 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,182 @@
|
|
|
1
1
|
import React$1, { Component, ReactNode, ErrorInfo } from 'react';
|
|
2
|
-
import { NodeTypes, EdgeTypes, Connection, Edge, ConnectionMode, FitViewOptions, NodeProps, EdgeProps } from 'reactflow';
|
|
2
|
+
import { Node, NodeTypes, EdgeTypes, Connection, Edge, ConnectionMode, ReactFlowInstance, Viewport, FitViewOptions, NodeProps, EdgeProps } from 'reactflow';
|
|
3
|
+
|
|
4
|
+
type FibreFlowCableKind = 'simple' | 'tube';
|
|
5
|
+
interface FibreFlowEndpoint {
|
|
6
|
+
tube?: number;
|
|
7
|
+
fiber: number;
|
|
8
|
+
}
|
|
9
|
+
interface FibreFlowSplice {
|
|
10
|
+
id: string;
|
|
11
|
+
from: FibreFlowEndpoint;
|
|
12
|
+
to: FibreFlowEndpoint;
|
|
13
|
+
lossDb?: number;
|
|
14
|
+
circuitId?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
color?: string;
|
|
17
|
+
}
|
|
18
|
+
interface FibreFlowCable {
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
kind?: FibreFlowCableKind;
|
|
22
|
+
fiberCount?: number;
|
|
23
|
+
tubeCount?: number;
|
|
24
|
+
fibersPerTube?: number;
|
|
25
|
+
tubeStartIndex?: number;
|
|
26
|
+
fiberStartIndex?: number;
|
|
27
|
+
tubeColorMap?: Record<number, string>;
|
|
28
|
+
jacketColor?: string;
|
|
29
|
+
distanceLabel?: string;
|
|
30
|
+
distanceMeters?: number;
|
|
31
|
+
}
|
|
32
|
+
interface FibreFlowClosure {
|
|
33
|
+
id: string;
|
|
34
|
+
chamberId?: string;
|
|
35
|
+
leftCable: FibreFlowCable;
|
|
36
|
+
rightCable: FibreFlowCable;
|
|
37
|
+
splices: FibreFlowSplice[];
|
|
38
|
+
}
|
|
39
|
+
interface FibreFlowCircuit {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
color?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface NetBoxDevice {
|
|
46
|
+
id: number;
|
|
47
|
+
name: string;
|
|
48
|
+
device_type: {
|
|
49
|
+
id: number;
|
|
50
|
+
model: string;
|
|
51
|
+
manufacturer: {
|
|
52
|
+
name: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
device_role: {
|
|
56
|
+
name: string;
|
|
57
|
+
color: string;
|
|
58
|
+
};
|
|
59
|
+
site: {
|
|
60
|
+
name: string;
|
|
61
|
+
};
|
|
62
|
+
rack: {
|
|
63
|
+
id: number;
|
|
64
|
+
name: string;
|
|
65
|
+
} | null;
|
|
66
|
+
position: number | null;
|
|
67
|
+
face: 'front' | 'rear' | null;
|
|
68
|
+
status: {
|
|
69
|
+
label: string;
|
|
70
|
+
value: string;
|
|
71
|
+
color: string;
|
|
72
|
+
};
|
|
73
|
+
primary_ip4?: {
|
|
74
|
+
address: string;
|
|
75
|
+
};
|
|
76
|
+
primary_ip6?: {
|
|
77
|
+
address: string;
|
|
78
|
+
};
|
|
79
|
+
interfaces: NetBoxInterface[];
|
|
80
|
+
}
|
|
81
|
+
interface NetBoxInterface {
|
|
82
|
+
id: number;
|
|
83
|
+
name: string;
|
|
84
|
+
type: {
|
|
85
|
+
label: string;
|
|
86
|
+
value: string;
|
|
87
|
+
};
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
mac_address: string | null;
|
|
90
|
+
mtu: number | null;
|
|
91
|
+
connected_endpoint_type: string | null;
|
|
92
|
+
connected_endpoint: {
|
|
93
|
+
device: {
|
|
94
|
+
id?: number;
|
|
95
|
+
name: string;
|
|
96
|
+
};
|
|
97
|
+
name: string;
|
|
98
|
+
} | null;
|
|
99
|
+
cable: {
|
|
100
|
+
id: number;
|
|
101
|
+
label: string;
|
|
102
|
+
type: string;
|
|
103
|
+
color: string;
|
|
104
|
+
} | null;
|
|
105
|
+
}
|
|
106
|
+
interface NetBoxRack {
|
|
107
|
+
id: number;
|
|
108
|
+
name: string;
|
|
109
|
+
site: {
|
|
110
|
+
name: string;
|
|
111
|
+
};
|
|
112
|
+
group: {
|
|
113
|
+
name: string;
|
|
114
|
+
} | null;
|
|
115
|
+
tenant: {
|
|
116
|
+
name: string;
|
|
117
|
+
} | null;
|
|
118
|
+
role: {
|
|
119
|
+
name: string;
|
|
120
|
+
color: string;
|
|
121
|
+
} | null;
|
|
122
|
+
status: {
|
|
123
|
+
label: string;
|
|
124
|
+
value: string;
|
|
125
|
+
color: string;
|
|
126
|
+
};
|
|
127
|
+
facility_id: string | null;
|
|
128
|
+
serial: string | null;
|
|
129
|
+
asset_tag: string | null;
|
|
130
|
+
type: {
|
|
131
|
+
label: string;
|
|
132
|
+
value: string;
|
|
133
|
+
};
|
|
134
|
+
width: {
|
|
135
|
+
label: string;
|
|
136
|
+
value: number;
|
|
137
|
+
};
|
|
138
|
+
u_height: number;
|
|
139
|
+
desc_units: boolean;
|
|
140
|
+
outer_width: number | null;
|
|
141
|
+
outer_depth: number | null;
|
|
142
|
+
weight: number | null;
|
|
143
|
+
max_weight: number | null;
|
|
144
|
+
weight_unit: string;
|
|
145
|
+
mounting_depth: number | null;
|
|
146
|
+
devices: NetBoxDevice[];
|
|
147
|
+
}
|
|
148
|
+
interface NetBoxCable {
|
|
149
|
+
id: number;
|
|
150
|
+
label: string;
|
|
151
|
+
type: {
|
|
152
|
+
label: string;
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
155
|
+
status: {
|
|
156
|
+
label: string;
|
|
157
|
+
value: string;
|
|
158
|
+
color: string;
|
|
159
|
+
};
|
|
160
|
+
color: string;
|
|
161
|
+
length: number | null;
|
|
162
|
+
length_unit: string;
|
|
163
|
+
termination_a_type: string;
|
|
164
|
+
termination_a: {
|
|
165
|
+
device: {
|
|
166
|
+
id?: number;
|
|
167
|
+
name: string;
|
|
168
|
+
};
|
|
169
|
+
name: string;
|
|
170
|
+
};
|
|
171
|
+
termination_b_type: string;
|
|
172
|
+
termination_b: {
|
|
173
|
+
device: {
|
|
174
|
+
id?: number;
|
|
175
|
+
name: string;
|
|
176
|
+
};
|
|
177
|
+
name: string;
|
|
178
|
+
};
|
|
179
|
+
}
|
|
3
180
|
|
|
4
181
|
/**
|
|
5
182
|
* Rack device width configuration
|
|
@@ -21,6 +198,47 @@ declare enum Width {
|
|
|
21
198
|
* @public
|
|
22
199
|
*/
|
|
23
200
|
type PortType = 'ethernet' | 'fiber' | 'console' | 'mgmt' | 'usb' | 'power_ac' | 'power_c13' | 'power_c19';
|
|
201
|
+
/**
|
|
202
|
+
* Cable types used for connected network ports.
|
|
203
|
+
* @public
|
|
204
|
+
*/
|
|
205
|
+
type PortCableType = 'smf' | 'cat6' | 'om3' | 'om4' | 'om5' | 'cat5e' | 'cat6a' | 'cat7' | 'fiber' | 'ethernet';
|
|
206
|
+
/**
|
|
207
|
+
* Device image fit options.
|
|
208
|
+
*
|
|
209
|
+
* Values mirror object-fit terms for API ergonomics and are mapped to valid
|
|
210
|
+
* background-size values by renderers where needed.
|
|
211
|
+
*
|
|
212
|
+
* @public
|
|
213
|
+
*/
|
|
214
|
+
type DeviceImageFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
215
|
+
/**
|
|
216
|
+
* Device image repeat options.
|
|
217
|
+
* @public
|
|
218
|
+
*/
|
|
219
|
+
type DeviceImageRepeat = 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y';
|
|
220
|
+
/**
|
|
221
|
+
* Shared image configuration for rack-mounted devices and device nodes.
|
|
222
|
+
* @public
|
|
223
|
+
*/
|
|
224
|
+
interface DeviceImageOptions {
|
|
225
|
+
/** Optional front image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
226
|
+
frontImageUrl?: string;
|
|
227
|
+
/** Optional rear image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
228
|
+
rearImageUrl?: string;
|
|
229
|
+
/** Optional attribution URL for front image (e.g. source/license link) */
|
|
230
|
+
frontImageAttribution?: string;
|
|
231
|
+
/** Optional attribution URL for rear image (e.g. source/license link) */
|
|
232
|
+
rearImageAttribution?: string;
|
|
233
|
+
/** Optional background sizing for device images */
|
|
234
|
+
imageFit?: DeviceImageFit;
|
|
235
|
+
/** Optional background position for device images */
|
|
236
|
+
imagePosition?: string;
|
|
237
|
+
/** Optional background repeat for device images */
|
|
238
|
+
imageRepeat?: DeviceImageRepeat;
|
|
239
|
+
/** When true, stretch device image to fill the device bounds (overrides imageFit) */
|
|
240
|
+
stretchToFit?: boolean;
|
|
241
|
+
}
|
|
24
242
|
interface Port {
|
|
25
243
|
/** Display label for the port */
|
|
26
244
|
label: string;
|
|
@@ -29,7 +247,7 @@ interface Port {
|
|
|
29
247
|
/** Type of port for styling and validation */
|
|
30
248
|
type?: PortType;
|
|
31
249
|
/** Cable type for connection validation */
|
|
32
|
-
cableType?:
|
|
250
|
+
cableType?: PortCableType;
|
|
33
251
|
}
|
|
34
252
|
/**
|
|
35
253
|
* Group of related ports on a device
|
|
@@ -67,125 +285,287 @@ type PowerSide = 'left' | 'right';
|
|
|
67
285
|
*/
|
|
68
286
|
type UNumberingDirection = 'bottom-up' | 'top-down';
|
|
69
287
|
/**
|
|
70
|
-
*
|
|
288
|
+
* Shared node data fields available across node types.
|
|
289
|
+
* Specific node kinds can narrow these fields via `NetworkNodeDataByType`.
|
|
71
290
|
* @public
|
|
72
291
|
*/
|
|
73
|
-
interface
|
|
74
|
-
/**
|
|
75
|
-
|
|
292
|
+
interface NetworkNodeDataBase extends DeviceImageOptions {
|
|
293
|
+
/** Display label for the node */
|
|
294
|
+
label: string;
|
|
295
|
+
/** Current status of the node/device */
|
|
296
|
+
status?: DeviceStatus | string;
|
|
297
|
+
/** Port configurations for device-like nodes */
|
|
298
|
+
ports?: PortBlock[] | number;
|
|
299
|
+
/** Rear port configurations */
|
|
300
|
+
rearPorts?: PortBlock[];
|
|
301
|
+
/** List of connected node IDs */
|
|
302
|
+
connections?: string[];
|
|
303
|
+
/** NetBox integration ID */
|
|
304
|
+
netboxId?: number | string;
|
|
305
|
+
/** NetBox object type */
|
|
306
|
+
netboxType?: 'device' | 'rack' | 'interface' | 'cable' | string;
|
|
307
|
+
/** Inventory integration ID */
|
|
308
|
+
inventoryId?: number | string;
|
|
309
|
+
/** Inventory object type */
|
|
310
|
+
inventoryType?: 'device' | 'rack' | 'interface' | 'cable' | string;
|
|
311
|
+
/** Rack height in U units */
|
|
312
|
+
uHeight?: number;
|
|
313
|
+
/** Device position within rack in U units */
|
|
314
|
+
uPosition?: number;
|
|
315
|
+
/** Current front/rear view orientation */
|
|
316
|
+
view?: DeviceView;
|
|
317
|
+
/** Rack face orientation */
|
|
318
|
+
face?: DeviceView;
|
|
319
|
+
/** Device type specification */
|
|
320
|
+
deviceType?: string;
|
|
321
|
+
/** Device manufacturer */
|
|
322
|
+
manufacturer?: string;
|
|
323
|
+
/** Device role in network */
|
|
324
|
+
role?: string;
|
|
325
|
+
/** Device width configuration */
|
|
326
|
+
width?: Width | number;
|
|
327
|
+
/** Power port side for rear view */
|
|
328
|
+
powerSide?: PowerSide;
|
|
329
|
+
/** Vertical PDU height in centimeters */
|
|
330
|
+
heightCm?: number;
|
|
331
|
+
/** Number of AC power ports */
|
|
332
|
+
powerPorts?: number;
|
|
333
|
+
/** Vertical PDU width in pixels */
|
|
334
|
+
widthPx?: number;
|
|
335
|
+
/** Optional management unit position for vertical PDUs */
|
|
336
|
+
mgmt_unit?: 'top' | 'middle' | 'bottom';
|
|
337
|
+
/** U numbering direction for rack nodes */
|
|
338
|
+
uNumberingDirection?: UNumberingDirection;
|
|
339
|
+
/** Custom header text for rack nodes */
|
|
340
|
+
customHeaderText?: string;
|
|
341
|
+
/** Rack UI marker visibility */
|
|
342
|
+
showUMarkers?: boolean;
|
|
343
|
+
/** Holder position within tray (1-12) for splice nodes */
|
|
344
|
+
holderPosition?: number;
|
|
345
|
+
/** Loss value in dB for splice nodes */
|
|
346
|
+
lossDb?: number;
|
|
347
|
+
/** Splice mode */
|
|
348
|
+
mode?: 'single' | 'ribbon';
|
|
349
|
+
/** Legacy ribbon flag */
|
|
350
|
+
ribbon?: boolean;
|
|
351
|
+
/** Ribbon fiber IDs */
|
|
352
|
+
ribbonFiberIds?: number[];
|
|
353
|
+
/** Connector type for coupler nodes */
|
|
354
|
+
connector?: 'SC' | 'LC';
|
|
355
|
+
/** Number of fibers for coupler nodes (1, 2, or 4) */
|
|
356
|
+
couplerFiberCount?: 1 | 2 | 4;
|
|
357
|
+
/** Optional port labels for left side of coupler */
|
|
358
|
+
portLabelsLeft?: string[];
|
|
359
|
+
/** Optional port labels for right side of coupler */
|
|
360
|
+
portLabelsRight?: string[];
|
|
361
|
+
/** Slot position for couplers inside panels (1-based, vertical slots aligned to right edge) */
|
|
362
|
+
slotPosition?: number;
|
|
363
|
+
/** Width override for panel-like container nodes */
|
|
364
|
+
panelWidth?: number;
|
|
365
|
+
/** Height override for panel-like container nodes */
|
|
366
|
+
panelHeight?: number;
|
|
367
|
+
/** Width override for closure nodes */
|
|
368
|
+
closureWidth?: number;
|
|
369
|
+
/** Height override for closure nodes */
|
|
370
|
+
closureHeight?: number;
|
|
371
|
+
/** Optional rack width in pixels (for rack nodes, default: 300px) */
|
|
372
|
+
rackWidthPx?: number;
|
|
373
|
+
/** Number of rows for container nodes (patch-panel, closure) */
|
|
374
|
+
rows?: number;
|
|
375
|
+
/** Number of columns for container nodes (patch-panel, closure) */
|
|
376
|
+
cols?: number;
|
|
377
|
+
/** Number of trays for closure nodes */
|
|
378
|
+
trayCount?: number;
|
|
379
|
+
/** Header text for container nodes */
|
|
380
|
+
header?: string;
|
|
381
|
+
/** Type of fibre splitter: 'splitter' or 'WDM' (default: 'splitter') */
|
|
382
|
+
splitterType?: 'splitter' | 'WDM';
|
|
383
|
+
/** Number of input fibers on the left (1 or 2, default: 1) */
|
|
384
|
+
inputCount?: number;
|
|
385
|
+
/** Number of output fibers on the right (1-64, default: 8) */
|
|
386
|
+
outputCount?: number;
|
|
387
|
+
/** Tube index (1-based) */
|
|
388
|
+
tubeIndex?: number;
|
|
389
|
+
/** Tube count for multi-tube cables */
|
|
390
|
+
tubeCount?: number;
|
|
391
|
+
/** Tube start index for multi-tube cables */
|
|
392
|
+
tubeStartIndex?: number;
|
|
393
|
+
/** Number of fibers per tube */
|
|
394
|
+
fibersPerTube?: number;
|
|
395
|
+
/** Total fiber count for cables */
|
|
396
|
+
fiberCount?: number;
|
|
397
|
+
/** Cable identifier */
|
|
398
|
+
cableId?: string;
|
|
399
|
+
/** Primary node color override */
|
|
400
|
+
color?: string;
|
|
401
|
+
/** Rotation in degrees for rotatable nodes */
|
|
402
|
+
rotation?: number;
|
|
403
|
+
/** Tube handle orientation */
|
|
404
|
+
startOn?: 'left-center' | 'left' | 'right';
|
|
405
|
+
/** Rack metadata for integrations */
|
|
406
|
+
facilityId?: string | number | null;
|
|
407
|
+
/** Rack serial metadata */
|
|
408
|
+
serial?: string | null;
|
|
409
|
+
/** Asset tag metadata */
|
|
410
|
+
assetTag?: string | null;
|
|
411
|
+
/** Site metadata */
|
|
412
|
+
site?: string;
|
|
413
|
+
/** Tenant metadata */
|
|
414
|
+
tenant?: string;
|
|
415
|
+
/** Primary IPv4 metadata */
|
|
416
|
+
primaryIp4?: string;
|
|
417
|
+
/** Primary IPv6 metadata */
|
|
418
|
+
primaryIp6?: string;
|
|
419
|
+
/** Rack name metadata */
|
|
420
|
+
rack?: string | number | null;
|
|
421
|
+
/** Optional arrays used by inventory/netbox transforms */
|
|
422
|
+
racks?: unknown[];
|
|
423
|
+
devices?: unknown[];
|
|
424
|
+
cables?: unknown[];
|
|
425
|
+
/** UI color mode metadata */
|
|
426
|
+
colorMode?: 'light' | 'dark' | 'system';
|
|
427
|
+
/** Generic dimensions used by some helpers */
|
|
428
|
+
height?: number;
|
|
429
|
+
headerHeight?: number;
|
|
430
|
+
/** Optional precomputed map for handle-to-face resolution */
|
|
431
|
+
handleSideMap?: Record<string, DeviceView>;
|
|
432
|
+
/** Additional extension metadata */
|
|
433
|
+
metadata?: Record<string, unknown>;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Rack node data.
|
|
437
|
+
* @public
|
|
438
|
+
*/
|
|
439
|
+
interface RackNodeData extends NetworkNodeDataBase {
|
|
440
|
+
ports?: number | PortBlock[];
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Device-like node data (servers/switches/routers/generic device).
|
|
444
|
+
* @public
|
|
445
|
+
*/
|
|
446
|
+
interface DeviceNodeData extends NetworkNodeDataBase {
|
|
447
|
+
ports?: PortBlock[] | number;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Fibre flow cable node data.
|
|
451
|
+
* @public
|
|
452
|
+
*/
|
|
453
|
+
interface FibreFlowCableNodeData extends NetworkNodeDataBase {
|
|
454
|
+
cable: FibreFlowCable;
|
|
455
|
+
side: 'left' | 'right';
|
|
456
|
+
rowHeight: number;
|
|
457
|
+
columnWidth: number;
|
|
458
|
+
showTubeLabels: boolean;
|
|
459
|
+
showFiberNumbers: boolean;
|
|
460
|
+
layout: unknown;
|
|
461
|
+
colorMode?: 'dark' | 'light';
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Fibre flow closure node data.
|
|
465
|
+
* @public
|
|
466
|
+
*/
|
|
467
|
+
interface FibreFlowClosureNodeData extends NetworkNodeDataBase {
|
|
468
|
+
width?: number;
|
|
469
|
+
height?: number;
|
|
470
|
+
headerHeight?: number;
|
|
471
|
+
colorMode?: 'dark' | 'light';
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Mapping from node type to corresponding data type.
|
|
475
|
+
* @public
|
|
476
|
+
*/
|
|
477
|
+
interface NetworkNodeDataByType {
|
|
478
|
+
rack: RackNodeData;
|
|
479
|
+
switch: DeviceNodeData;
|
|
480
|
+
router: DeviceNodeData;
|
|
481
|
+
server: DeviceNodeData;
|
|
482
|
+
fiber: NetworkNodeDataBase;
|
|
483
|
+
'patch-panel': NetworkNodeDataBase;
|
|
484
|
+
device: DeviceNodeData;
|
|
485
|
+
'vertical-pdu': NetworkNodeDataBase;
|
|
486
|
+
splice: NetworkNodeDataBase;
|
|
487
|
+
'splice-tray': NetworkNodeDataBase;
|
|
488
|
+
tube: NetworkNodeDataBase;
|
|
489
|
+
cable: NetworkNodeDataBase;
|
|
490
|
+
'multi-tube-cable': NetworkNodeDataBase;
|
|
491
|
+
coupler: NetworkNodeDataBase;
|
|
492
|
+
closure: NetworkNodeDataBase;
|
|
493
|
+
'fibre-split': NetworkNodeDataBase;
|
|
494
|
+
'fibre-flow-cable': FibreFlowCableNodeData;
|
|
495
|
+
'fibre-flow-closure': FibreFlowClosureNodeData;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Union of all node data variants.
|
|
499
|
+
* @public
|
|
500
|
+
*/
|
|
501
|
+
type NetworkNodeData = NetworkNodeDataByType[NetworkNodeType];
|
|
502
|
+
/**
|
|
503
|
+
* Network node structure with data discriminated by `type`.
|
|
504
|
+
* @public
|
|
505
|
+
*/
|
|
506
|
+
type NetworkNode<TType extends NetworkNodeType = NetworkNodeType, TExtra = unknown> = TType extends NetworkNodeType ? Node<NetworkNodeDataByType[TType] & TExtra, TType> & {
|
|
76
507
|
/** Type of network node */
|
|
77
|
-
type:
|
|
78
|
-
/** Position coordinates in the diagram */
|
|
79
|
-
position: {
|
|
80
|
-
x: number;
|
|
81
|
-
y: number;
|
|
82
|
-
};
|
|
83
|
-
/** Parent node ID for React Flow sub-flows */
|
|
84
|
-
parentId?: string;
|
|
85
|
-
/** Node extent for sub-flows */
|
|
86
|
-
extent?: 'parent' | [[number, number], [number, number]];
|
|
508
|
+
type: TType;
|
|
87
509
|
/** Node data and configuration */
|
|
88
|
-
data:
|
|
89
|
-
|
|
90
|
-
label: string;
|
|
91
|
-
/** Port configurations for the device */
|
|
92
|
-
ports?: PortBlock[];
|
|
93
|
-
/** List of connected node IDs */
|
|
94
|
-
connections?: string[];
|
|
95
|
-
/** Current status of the device */
|
|
96
|
-
status?: DeviceStatus;
|
|
97
|
-
/** NetBox integration ID */
|
|
98
|
-
netboxId?: number;
|
|
99
|
-
/** NetBox object type */
|
|
100
|
-
netboxType?: 'device' | 'rack' | 'interface' | 'cable';
|
|
101
|
-
/** Rack height in U units */
|
|
102
|
-
uHeight?: number;
|
|
103
|
-
/** Device position within rack in U units */
|
|
104
|
-
uPosition?: number;
|
|
105
|
-
/** Current view orientation */
|
|
106
|
-
view?: DeviceView;
|
|
107
|
-
/** Device type specification */
|
|
108
|
-
deviceType?: string;
|
|
109
|
-
/** Device manufacturer */
|
|
110
|
-
manufacturer?: string;
|
|
111
|
-
/** Device role in network */
|
|
112
|
-
role?: string;
|
|
113
|
-
/** Device width configuration */
|
|
114
|
-
width?: Width;
|
|
115
|
-
/** Rear port configurations */
|
|
116
|
-
rearPorts?: PortBlock[];
|
|
117
|
-
/** Power port side for rear view */
|
|
118
|
-
powerSide?: PowerSide;
|
|
119
|
-
/** Optional front image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
120
|
-
frontImageUrl?: string;
|
|
121
|
-
/** Optional rear image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
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;
|
|
127
|
-
/** Optional background sizing for device images */
|
|
128
|
-
imageFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
129
|
-
/** Optional background position for device images */
|
|
130
|
-
imagePosition?: string;
|
|
131
|
-
/** Optional background repeat for device images */
|
|
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;
|
|
135
|
-
/** Vertical PDU height in centimeters */
|
|
136
|
-
heightCm?: number;
|
|
137
|
-
/** Number of AC power ports */
|
|
138
|
-
powerPorts?: number;
|
|
139
|
-
/** U numbering direction for rack nodes */
|
|
140
|
-
uNumberingDirection?: UNumberingDirection;
|
|
141
|
-
/** Custom header text for rack nodes */
|
|
142
|
-
customHeaderText?: string;
|
|
143
|
-
/** Holder position within tray (1-12) for splice nodes */
|
|
144
|
-
holderPosition?: number;
|
|
145
|
-
/** Loss value in dB for splice nodes */
|
|
146
|
-
lossDb?: number;
|
|
147
|
-
/** Connector type for coupler nodes */
|
|
148
|
-
connector?: 'SC' | 'LC';
|
|
149
|
-
/** Number of fibers for coupler nodes (1, 2, or 4) */
|
|
150
|
-
couplerFiberCount?: 1 | 2 | 4;
|
|
151
|
-
/** Optional port labels for left side of coupler */
|
|
152
|
-
portLabelsLeft?: string[];
|
|
153
|
-
/** Optional port labels for right side of coupler */
|
|
154
|
-
portLabelsRight?: string[];
|
|
155
|
-
/** Slot position for couplers inside panels (1-based, vertical slots aligned to right edge) */
|
|
156
|
-
slotPosition?: number;
|
|
157
|
-
/** Width override for container nodes (patch-panel, closure) */
|
|
158
|
-
panelWidth?: number;
|
|
159
|
-
/** Height override for container nodes (patch-panel, closure) */
|
|
160
|
-
panelHeight?: number;
|
|
161
|
-
/** Optional rack width in pixels (for rack nodes, default: 300px) */
|
|
162
|
-
rackWidthPx?: number;
|
|
163
|
-
/** Number of rows for container nodes (patch-panel, closure) */
|
|
164
|
-
rows?: number;
|
|
165
|
-
/** Number of columns for container nodes (patch-panel, closure) */
|
|
166
|
-
cols?: number;
|
|
167
|
-
/** Header text for container nodes */
|
|
168
|
-
header?: string;
|
|
169
|
-
/** Type of fibre splitter: 'splitter' or 'WDM' (default: 'splitter') */
|
|
170
|
-
splitterType?: 'splitter' | 'WDM';
|
|
171
|
-
/** Number of input fibers on the left (1 or 2, default: 1) */
|
|
172
|
-
inputCount?: number;
|
|
173
|
-
/** Number of output fibers on the right (1-64, default: 8) */
|
|
174
|
-
outputCount?: number;
|
|
175
|
-
/** Additional custom properties */
|
|
176
|
-
[key: string]: any;
|
|
177
|
-
};
|
|
178
|
-
}
|
|
510
|
+
data: NetworkNodeDataByType[TType] & TExtra;
|
|
511
|
+
} : never;
|
|
179
512
|
/**
|
|
180
513
|
* Network edge types
|
|
181
514
|
* @public
|
|
182
515
|
*/
|
|
183
516
|
type NetworkEdgeType = 'fiber' | 'ethernet' | 'power' | 'smoothstep' | 'step' | 'thick-cable' | 'fibre-flow' | 'fibre-flow-link';
|
|
517
|
+
/**
|
|
518
|
+
* Edge data payload.
|
|
519
|
+
* @public
|
|
520
|
+
*/
|
|
521
|
+
interface NetworkEdgeData {
|
|
522
|
+
/** Connection bandwidth */
|
|
523
|
+
bandwidth?: string;
|
|
524
|
+
/** Cable length */
|
|
525
|
+
length?: number;
|
|
526
|
+
/** Edge color for styling */
|
|
527
|
+
color?: string;
|
|
528
|
+
/** Edge kind for styling/validation */
|
|
529
|
+
kind?: 'fiber' | 'power' | 'network';
|
|
530
|
+
/** Whether this edge represents a ribbon fiber connection */
|
|
531
|
+
isRibbon?: boolean;
|
|
532
|
+
/** Array of fiber IDs for ribbon mode (6-12 fibers) */
|
|
533
|
+
ribbonFiberIds?: number[];
|
|
534
|
+
/** Highlight edge with a pulsing stroke */
|
|
535
|
+
highlight?: boolean;
|
|
536
|
+
/** Override highlight color (defaults to edge color) */
|
|
537
|
+
highlightColor?: string;
|
|
538
|
+
/** Override highlight max stroke width */
|
|
539
|
+
highlightWidth?: number;
|
|
540
|
+
/** Optional tag for grouping edges in demos */
|
|
541
|
+
traceTag?: string;
|
|
542
|
+
/** Legacy striped edge flag */
|
|
543
|
+
striped?: boolean;
|
|
544
|
+
/** Cable type metadata used by demos/helpers */
|
|
545
|
+
cableType?: PortCableType;
|
|
546
|
+
/** NetBox integration metadata */
|
|
547
|
+
netboxId?: number | string;
|
|
548
|
+
netboxType?: 'device' | 'rack' | 'interface' | 'cable' | string;
|
|
549
|
+
/** Inventory integration metadata */
|
|
550
|
+
inventoryId?: number | string;
|
|
551
|
+
inventoryType?: 'device' | 'rack' | 'interface' | 'cable' | string;
|
|
552
|
+
/** Status metadata */
|
|
553
|
+
status?: string;
|
|
554
|
+
/** Endpoint metadata */
|
|
555
|
+
terminationA?: string;
|
|
556
|
+
terminationB?: string;
|
|
557
|
+
/** Optional display label for the edge */
|
|
558
|
+
label?: string;
|
|
559
|
+
/** Optional opacity for styling (0–1) */
|
|
560
|
+
opacity?: number;
|
|
561
|
+
/** Additional extension metadata */
|
|
562
|
+
metadata?: Record<string, unknown>;
|
|
563
|
+
}
|
|
184
564
|
/**
|
|
185
565
|
* Network edge data structure
|
|
186
566
|
* @public
|
|
187
567
|
*/
|
|
188
|
-
|
|
568
|
+
type NetworkEdge<TData extends NetworkEdgeData = NetworkEdgeData> = {
|
|
189
569
|
/** Unique identifier for the edge */
|
|
190
570
|
id: string;
|
|
191
571
|
/** Source node ID */
|
|
@@ -199,31 +579,8 @@ interface NetworkEdge {
|
|
|
199
579
|
/** Type of network connection */
|
|
200
580
|
type?: NetworkEdgeType;
|
|
201
581
|
/** Edge data and configuration */
|
|
202
|
-
data?:
|
|
203
|
-
|
|
204
|
-
bandwidth?: string;
|
|
205
|
-
/** Cable length */
|
|
206
|
-
length?: number;
|
|
207
|
-
/** Edge color for styling */
|
|
208
|
-
color?: string;
|
|
209
|
-
/** Edge kind for styling/validation */
|
|
210
|
-
kind?: 'fiber' | 'power' | 'network';
|
|
211
|
-
/** Whether this edge represents a ribbon fiber connection */
|
|
212
|
-
isRibbon?: boolean;
|
|
213
|
-
/** Array of fiber IDs for ribbon mode (6-12 fibers) */
|
|
214
|
-
ribbonFiberIds?: number[];
|
|
215
|
-
/** Highlight edge with a pulsing stroke */
|
|
216
|
-
highlight?: boolean;
|
|
217
|
-
/** Override highlight color (defaults to edge color) */
|
|
218
|
-
highlightColor?: string;
|
|
219
|
-
/** Override highlight max stroke width */
|
|
220
|
-
highlightWidth?: number;
|
|
221
|
-
/** Optional tag for grouping edges in demos */
|
|
222
|
-
traceTag?: string;
|
|
223
|
-
/** Additional custom properties */
|
|
224
|
-
[key: string]: any;
|
|
225
|
-
};
|
|
226
|
-
}
|
|
582
|
+
data?: TData;
|
|
583
|
+
};
|
|
227
584
|
/**
|
|
228
585
|
* Rack device types
|
|
229
586
|
* @public
|
|
@@ -258,7 +615,7 @@ interface RackConfig {
|
|
|
258
615
|
* Device mounted in a rack
|
|
259
616
|
* @public
|
|
260
617
|
*/
|
|
261
|
-
interface RackDevice {
|
|
618
|
+
interface RackDevice extends DeviceImageOptions {
|
|
262
619
|
/** Unique device identifier */
|
|
263
620
|
id: string;
|
|
264
621
|
/** Device display name */
|
|
@@ -273,28 +630,14 @@ interface RackDevice {
|
|
|
273
630
|
width?: Width;
|
|
274
631
|
/** Device role in network */
|
|
275
632
|
role?: string;
|
|
633
|
+
/** Current status of the device */
|
|
634
|
+
status?: DeviceStatus | string;
|
|
276
635
|
/** Front port configurations */
|
|
277
636
|
ports?: PortBlock[];
|
|
278
637
|
/** Rear port configurations */
|
|
279
638
|
rearPorts?: PortBlock[];
|
|
280
639
|
/** Power port side for rear view */
|
|
281
640
|
powerSide?: PowerSide;
|
|
282
|
-
/** Optional front image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
283
|
-
frontImageUrl?: string;
|
|
284
|
-
/** Optional rear image URL for device background (PNG, SVG, JPEG, etc.) */
|
|
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;
|
|
290
|
-
/** Optional background sizing for device images */
|
|
291
|
-
imageFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
292
|
-
/** Optional background position for device images */
|
|
293
|
-
imagePosition?: string;
|
|
294
|
-
/** Optional background repeat for device images */
|
|
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;
|
|
298
641
|
/** Connected device IDs */
|
|
299
642
|
connections?: string[];
|
|
300
643
|
}
|
|
@@ -361,6 +704,139 @@ interface SpliceTrayConfig {
|
|
|
361
704
|
/** Splices in this tray */
|
|
362
705
|
splices: SpliceConfig[];
|
|
363
706
|
}
|
|
707
|
+
/**
|
|
708
|
+
* Fine-grained interaction controls for network diagrams.
|
|
709
|
+
* @public
|
|
710
|
+
*/
|
|
711
|
+
interface NetworkDiagramInteractionOptions {
|
|
712
|
+
/** Enable node dragging. */
|
|
713
|
+
nodesDraggable?: boolean;
|
|
714
|
+
/** Enable creating connections from node handles. */
|
|
715
|
+
nodesConnectable?: boolean;
|
|
716
|
+
/** Enable selecting nodes/edges. */
|
|
717
|
+
elementsSelectable?: boolean;
|
|
718
|
+
/** Enable keyboard/mouse focus on edges. */
|
|
719
|
+
edgesFocusable?: boolean;
|
|
720
|
+
/** Enable reconnecting existing edges. */
|
|
721
|
+
edgesReconnectable?: boolean;
|
|
722
|
+
/** Enable click-to-connect behavior on handles. */
|
|
723
|
+
connectOnClick?: boolean;
|
|
724
|
+
/** Enable panning by dragging the canvas. */
|
|
725
|
+
panOnDrag?: boolean;
|
|
726
|
+
/** Enable panning by scrolling. */
|
|
727
|
+
panOnScroll?: boolean;
|
|
728
|
+
/** Enable zoom via mouse wheel/trackpad scroll. */
|
|
729
|
+
zoomOnScroll?: boolean;
|
|
730
|
+
/** Enable pinch-zoom gestures. */
|
|
731
|
+
zoomOnPinch?: boolean;
|
|
732
|
+
/** Enable zoom on double click. */
|
|
733
|
+
zoomOnDoubleClick?: boolean;
|
|
734
|
+
/** Enable deleting selected edges with keyboard keys. */
|
|
735
|
+
allowKeyboardDelete?: boolean;
|
|
736
|
+
/** Show or hide the built-in React Flow controls widget. */
|
|
737
|
+
showControls?: boolean;
|
|
738
|
+
/** Show or hide the minimap. */
|
|
739
|
+
showMiniMap?: boolean;
|
|
740
|
+
/** Show or hide the interactive lock/unlock button in controls. */
|
|
741
|
+
showInteractiveControl?: boolean;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Selection action panel options rendered above selected racks/devices.
|
|
745
|
+
* @public
|
|
746
|
+
*/
|
|
747
|
+
interface NetworkDiagramActionPanelOptions {
|
|
748
|
+
/** Enable or disable the floating action panel entirely. Defaults to true. */
|
|
749
|
+
enabled?: boolean;
|
|
750
|
+
/** Show or hide the front/rear toggle button. Defaults to true. */
|
|
751
|
+
showRearToggle?: boolean;
|
|
752
|
+
/** Show or hide the De-rack button for rack-mounted devices. Defaults to true. */
|
|
753
|
+
showDeRack?: boolean;
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Serializable flow snapshot payload for save/restore helpers.
|
|
757
|
+
* @public
|
|
758
|
+
*/
|
|
759
|
+
interface NetworkDiagramFlowObject {
|
|
760
|
+
/** Snapshot nodes */
|
|
761
|
+
nodes: NetworkNode[];
|
|
762
|
+
/** Snapshot edges */
|
|
763
|
+
edges: NetworkEdge[];
|
|
764
|
+
/** Optional viewport state */
|
|
765
|
+
viewport?: Viewport;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Options for exported diagram images.
|
|
769
|
+
* @public
|
|
770
|
+
*/
|
|
771
|
+
interface NetworkDiagramToImageOptions {
|
|
772
|
+
/** Export width in px (clamped to 1-8192). */
|
|
773
|
+
width?: number;
|
|
774
|
+
/** Export height in px (clamped to 1-8192). */
|
|
775
|
+
height?: number;
|
|
776
|
+
backgroundColor?: string;
|
|
777
|
+
/** Export padding in px (clamped to 0-2048). */
|
|
778
|
+
padding?: number;
|
|
779
|
+
/** Device pixel ratio multiplier (clamped to 0.1-4). */
|
|
780
|
+
pixelRatio?: number;
|
|
781
|
+
/** JPEG/WebP quality (clamped to 0-1 when used). */
|
|
782
|
+
quality?: number;
|
|
783
|
+
filter?: (domNode: HTMLElement) => boolean;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Fit-view options that support targeting node IDs directly.
|
|
787
|
+
* @public
|
|
788
|
+
*/
|
|
789
|
+
interface NetworkDiagramFitViewOptions extends Omit<FitViewOptions, 'nodes'> {
|
|
790
|
+
/** Optional node IDs to fit */
|
|
791
|
+
nodes?: string[];
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Exposed methods for save/restore and export integrations.
|
|
795
|
+
* @public
|
|
796
|
+
*/
|
|
797
|
+
interface NetworkDiagramFlowMethods {
|
|
798
|
+
toObject: () => NetworkDiagramFlowObject;
|
|
799
|
+
setViewport: (viewport: Viewport) => void;
|
|
800
|
+
setNodes: (nodes: NetworkNode[]) => void;
|
|
801
|
+
setEdges: (edges: NetworkEdge[]) => void;
|
|
802
|
+
toImage: (options?: NetworkDiagramToImageOptions) => Promise<string>;
|
|
803
|
+
getNodes: () => NetworkNode[];
|
|
804
|
+
getEdges: () => NetworkEdge[];
|
|
805
|
+
fitView: (options?: NetworkDiagramFitViewOptions) => void;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Store contract accepted by `NetworkDiagram`.
|
|
809
|
+
* @public
|
|
810
|
+
*/
|
|
811
|
+
interface NetworkDiagramStoreApi {
|
|
812
|
+
getState: () => {
|
|
813
|
+
nodes: NetworkNode[];
|
|
814
|
+
edges: NetworkEdge[];
|
|
815
|
+
debug?: boolean;
|
|
816
|
+
};
|
|
817
|
+
setState: (partial: Partial<{
|
|
818
|
+
nodes: NetworkNode[];
|
|
819
|
+
edges: NetworkEdge[];
|
|
820
|
+
debug?: boolean;
|
|
821
|
+
}>) => void;
|
|
822
|
+
subscribe: (listener: (state: {
|
|
823
|
+
nodes: NetworkNode[];
|
|
824
|
+
edges: NetworkEdge[];
|
|
825
|
+
debug?: boolean;
|
|
826
|
+
}) => void) => () => void;
|
|
827
|
+
selectEdgeZIndex: (edge: NetworkEdge) => number;
|
|
828
|
+
validateConnection: (params: {
|
|
829
|
+
source: string | null;
|
|
830
|
+
target: string | null;
|
|
831
|
+
sourceHandle?: string | null;
|
|
832
|
+
targetHandle?: string | null;
|
|
833
|
+
}) => {
|
|
834
|
+
valid: boolean;
|
|
835
|
+
reason?: string;
|
|
836
|
+
};
|
|
837
|
+
selectNodeById: (id: string) => NetworkNode | undefined;
|
|
838
|
+
selectConnectedEdges: (nodeId: string) => NetworkEdge[];
|
|
839
|
+
}
|
|
364
840
|
/**
|
|
365
841
|
* Network diagram component props
|
|
366
842
|
* @public
|
|
@@ -379,7 +855,7 @@ interface NetworkDiagramProps {
|
|
|
379
855
|
/** Initial edges for uncontrolled mode */
|
|
380
856
|
initialEdges?: NetworkEdge[];
|
|
381
857
|
/** Headless store injection */
|
|
382
|
-
store?:
|
|
858
|
+
store?: NetworkDiagramStoreApi;
|
|
383
859
|
/** Enable debug mode */
|
|
384
860
|
debug?: boolean;
|
|
385
861
|
/** Callback when a node is clicked or selection changes (null when deselected) */
|
|
@@ -408,21 +884,14 @@ interface NetworkDiagramProps {
|
|
|
408
884
|
style?: React.CSSProperties;
|
|
409
885
|
/** If true, vertically align rack bottoms to the same baseline */
|
|
410
886
|
alignRacksToBottom?: boolean;
|
|
887
|
+
/** Allow rack-mounted devices to move between racks/ungroup on drag and drop. Defaults to true. */
|
|
888
|
+
reAssignable?: boolean;
|
|
411
889
|
/** Color mode for the diagram */
|
|
412
890
|
colorMode?: 'light' | 'dark' | 'system';
|
|
413
891
|
/** Callback when React Flow instance is initialized */
|
|
414
|
-
onInit?: (instance:
|
|
892
|
+
onInit?: (instance: ReactFlowInstance) => void;
|
|
415
893
|
/** Callback to get React Flow methods for save/restore */
|
|
416
|
-
onFlowMethods?: (methods:
|
|
417
|
-
toObject: () => any;
|
|
418
|
-
setViewport: (viewport: any) => void;
|
|
419
|
-
setNodes: (nodes: any[]) => void;
|
|
420
|
-
setEdges: (edges: any[]) => void;
|
|
421
|
-
toImage: (options?: any) => Promise<string>;
|
|
422
|
-
getNodes: () => any[];
|
|
423
|
-
getEdges: () => any[];
|
|
424
|
-
fitView: (options?: any) => void;
|
|
425
|
-
}) => void;
|
|
894
|
+
onFlowMethods?: (methods: NetworkDiagramFlowMethods) => void;
|
|
426
895
|
/** Show download button */
|
|
427
896
|
showDownloadButton?: boolean;
|
|
428
897
|
/** Download button position */
|
|
@@ -433,6 +902,12 @@ interface NetworkDiagramProps {
|
|
|
433
902
|
downloadButtonStyle?: React.CSSProperties;
|
|
434
903
|
/** Use smoothstep edges for tube connections (both tube-to-cable and cable-to-tube). Default is fiber. */
|
|
435
904
|
useSmoothstepEdgesForTubes?: boolean;
|
|
905
|
+
/** Force read-only behavior for the diagram (no drag/connect/delete/reconnect/pan/zoom edits). */
|
|
906
|
+
readOnly?: boolean;
|
|
907
|
+
/** Centralized interaction options for consistent edit/lock behavior. */
|
|
908
|
+
interaction?: NetworkDiagramInteractionOptions;
|
|
909
|
+
/** Configuration for the floating action panel shown on selected rack/device nodes. */
|
|
910
|
+
actionPanel?: NetworkDiagramActionPanelOptions;
|
|
436
911
|
/** Enable connecting edges by clicking on handles. When true, increases handle sizes for better touch targets. Default is true. */
|
|
437
912
|
connectOnClick?: boolean;
|
|
438
913
|
/** Disable panning on drag. Default is false. */
|
|
@@ -650,47 +1125,6 @@ declare const ClosureNode: React$1.FC<NodeProps<NetworkNode['data']>>;
|
|
|
650
1125
|
*/
|
|
651
1126
|
declare const FibreSplitNode: React$1.FC<NodeProps<NetworkNode['data']>>;
|
|
652
1127
|
|
|
653
|
-
type FibreFlowCableKind = 'simple' | 'tube';
|
|
654
|
-
interface FibreFlowEndpoint {
|
|
655
|
-
tube?: number;
|
|
656
|
-
fiber: number;
|
|
657
|
-
}
|
|
658
|
-
interface FibreFlowSplice {
|
|
659
|
-
id: string;
|
|
660
|
-
from: FibreFlowEndpoint;
|
|
661
|
-
to: FibreFlowEndpoint;
|
|
662
|
-
lossDb?: number;
|
|
663
|
-
circuitId?: string;
|
|
664
|
-
label?: string;
|
|
665
|
-
color?: string;
|
|
666
|
-
}
|
|
667
|
-
interface FibreFlowCable {
|
|
668
|
-
id: string;
|
|
669
|
-
label: string;
|
|
670
|
-
kind?: FibreFlowCableKind;
|
|
671
|
-
fiberCount?: number;
|
|
672
|
-
tubeCount?: number;
|
|
673
|
-
fibersPerTube?: number;
|
|
674
|
-
tubeStartIndex?: number;
|
|
675
|
-
fiberStartIndex?: number;
|
|
676
|
-
tubeColorMap?: Record<number, string>;
|
|
677
|
-
jacketColor?: string;
|
|
678
|
-
distanceLabel?: string;
|
|
679
|
-
distanceMeters?: number;
|
|
680
|
-
}
|
|
681
|
-
interface FibreFlowClosure {
|
|
682
|
-
id: string;
|
|
683
|
-
chamberId?: string;
|
|
684
|
-
leftCable: FibreFlowCable;
|
|
685
|
-
rightCable: FibreFlowCable;
|
|
686
|
-
splices: FibreFlowSplice[];
|
|
687
|
-
}
|
|
688
|
-
interface FibreFlowCircuit {
|
|
689
|
-
id: string;
|
|
690
|
-
label: string;
|
|
691
|
-
color?: string;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
1128
|
type FibreFlowLayoutDirection = 'horizontal' | 'vertical';
|
|
695
1129
|
type FibreFlowColorMode = 'dark' | 'light';
|
|
696
1130
|
interface FibreFlowMapProps {
|
|
@@ -709,6 +1143,7 @@ interface FibreFlowMapProps {
|
|
|
709
1143
|
showCircuitId?: boolean;
|
|
710
1144
|
className?: string;
|
|
711
1145
|
style?: React$1.CSSProperties;
|
|
1146
|
+
readOnly?: boolean;
|
|
712
1147
|
panOnDrag?: boolean;
|
|
713
1148
|
panOnScroll?: boolean;
|
|
714
1149
|
zoomOnScroll?: boolean;
|
|
@@ -857,6 +1292,34 @@ declare const inventoryToNetworkDiagram: (data: {
|
|
|
857
1292
|
*/
|
|
858
1293
|
declare const generateLayout: (nodes: NetworkNode[]) => NetworkNode[];
|
|
859
1294
|
|
|
1295
|
+
/**
|
|
1296
|
+
* Convert NetBox rack data to NetworkNode
|
|
1297
|
+
*/
|
|
1298
|
+
declare const netboxRackToNetworkNode: (rack: NetBoxRack) => NetworkNode;
|
|
1299
|
+
/**
|
|
1300
|
+
* Convert NetBox device data to NetworkNode
|
|
1301
|
+
*/
|
|
1302
|
+
declare const netboxDeviceToNetworkNode: (device: NetBoxDevice) => NetworkNode;
|
|
1303
|
+
/**
|
|
1304
|
+
* Convert NetBox cable data to NetworkEdge
|
|
1305
|
+
*/
|
|
1306
|
+
declare const netboxCableToNetworkEdge: (cable: NetBoxCable) => NetworkEdge;
|
|
1307
|
+
/**
|
|
1308
|
+
* Convert NetBox data to network diagram format
|
|
1309
|
+
*/
|
|
1310
|
+
declare const netboxToNetworkDiagram: (data: {
|
|
1311
|
+
racks: NetBoxRack[];
|
|
1312
|
+
devices: NetBoxDevice[];
|
|
1313
|
+
cables: NetBoxCable[];
|
|
1314
|
+
}) => {
|
|
1315
|
+
nodes: NetworkNode[];
|
|
1316
|
+
edges: NetworkEdge[];
|
|
1317
|
+
};
|
|
1318
|
+
/**
|
|
1319
|
+
* Calculate U position for devices in a rack
|
|
1320
|
+
*/
|
|
1321
|
+
declare const calculateUPositions: (devices: NetBoxDevice[], _rackHeight: number) => Map<number, number>;
|
|
1322
|
+
|
|
860
1323
|
/**
|
|
861
1324
|
* Snap a device position to the nearest U position within a rack
|
|
862
1325
|
*/
|
|
@@ -886,11 +1349,11 @@ declare const calculateDevicePositionFromU: (rack: NetworkNode, uPosition: numbe
|
|
|
886
1349
|
/**
|
|
887
1350
|
* Update device U position and recalculate position
|
|
888
1351
|
*/
|
|
889
|
-
declare const updateDeviceUPosition$1: (device: NetworkNode
|
|
1352
|
+
declare const updateDeviceUPosition$1: (device: NetworkNode<"device" | "server" | "switch" | "router" | "patch-panel" | "vertical-pdu">, rack: NetworkNode, newUPosition: number) => NetworkNode<"device" | "server" | "switch" | "router" | "patch-panel" | "vertical-pdu">;
|
|
890
1353
|
/**
|
|
891
1354
|
* Validate and snap device to valid U position
|
|
892
1355
|
*/
|
|
893
|
-
declare const validateAndSnapDevice: (device: NetworkNode
|
|
1356
|
+
declare const validateAndSnapDevice: (device: NetworkNode<"device" | "server" | "switch" | "router" | "patch-panel" | "vertical-pdu">, rack: NetworkNode) => NetworkNode<"device" | "server" | "switch" | "router" | "patch-panel" | "vertical-pdu">;
|
|
894
1357
|
|
|
895
1358
|
/**
|
|
896
1359
|
* Snap a splice to the nearest holder position within a tray
|
|
@@ -1127,7 +1590,31 @@ declare function calculateCouplerSpacing(numCouplers: number, couplerHeight: num
|
|
|
1127
1590
|
* @public
|
|
1128
1591
|
*/
|
|
1129
1592
|
declare function calculateCouplerSlotSpacing(numCouplers: number, couplerHeight: number, availableHeight: number): number;
|
|
1593
|
+
/**
|
|
1594
|
+
* Calculate closure dimensions based on child nodes
|
|
1595
|
+
*
|
|
1596
|
+
* Automatically calculates the width and height of a closure based on its child nodes.
|
|
1597
|
+
* Supports special layouts for closures with tubes and trays.
|
|
1598
|
+
* Closure layout: [padding] [left tubes] [spacing] [trays] [spacing] [right tubes] [padding]
|
|
1599
|
+
*
|
|
1600
|
+
* @param closureNode - The closure node
|
|
1601
|
+
* @param childNodes - Array of child nodes within the closure
|
|
1602
|
+
* @returns Object with calculated width and height in pixels
|
|
1603
|
+
* @public
|
|
1604
|
+
*
|
|
1605
|
+
* @example
|
|
1606
|
+
* ```ts
|
|
1607
|
+
* const closure = { id: 'closure-1', type: 'closure', data: {} };
|
|
1608
|
+
* const children = [leftTubeNode, trayNode, rightTubeNode];
|
|
1609
|
+
* const dims = calculateClosureDimensions(closure, children);
|
|
1610
|
+
* ```
|
|
1611
|
+
*/
|
|
1612
|
+
declare function calculateClosureDimensions(closureNode: NetworkNode, childNodes: NetworkNode[]): {
|
|
1613
|
+
width: number;
|
|
1614
|
+
height: number;
|
|
1615
|
+
};
|
|
1130
1616
|
|
|
1617
|
+
type RackMountedNodeType = 'device' | 'server' | 'switch' | 'router' | 'patch-panel' | 'vertical-pdu';
|
|
1131
1618
|
/**
|
|
1132
1619
|
* Configuration options for building nodes from rack schema
|
|
1133
1620
|
*/
|
|
@@ -1137,7 +1624,7 @@ interface RackSchemaOptions {
|
|
|
1137
1624
|
/** Whether to validate all placements before creating nodes */
|
|
1138
1625
|
validatePlacements?: boolean;
|
|
1139
1626
|
/** Custom device type mapping from schema to NetworkNode type */
|
|
1140
|
-
deviceTypeMapping?: Record<string,
|
|
1627
|
+
deviceTypeMapping?: Record<string, RackMountedNodeType>;
|
|
1141
1628
|
}
|
|
1142
1629
|
/**
|
|
1143
1630
|
* Error thrown when device placement conflicts occur in strict mode
|
|
@@ -1439,7 +1926,7 @@ declare function fiberSolidOrStriped(id: FiberColorId | number): React$1.CSSProp
|
|
|
1439
1926
|
declare function getFiberColor(id: FiberColorId | number): string;
|
|
1440
1927
|
|
|
1441
1928
|
/**
|
|
1442
|
-
* Calculate the bounding box of a rack node
|
|
1929
|
+
* Calculate the bounding box of a rack node (header + body)
|
|
1443
1930
|
* @param rack - The rack node
|
|
1444
1931
|
* @returns Object with left, right, top, and bottom coordinates
|
|
1445
1932
|
* @public
|
|
@@ -1495,8 +1982,10 @@ interface ReplaceEdgeOptions {
|
|
|
1495
1982
|
edgeType: 'power' | 'fiber' | 'step' | 'smoothstep' | 'thick-cable';
|
|
1496
1983
|
/** Function to calculate zIndex for the edge */
|
|
1497
1984
|
selectEdgeZIndex: (edge: NetworkEdge) => number;
|
|
1498
|
-
/**
|
|
1985
|
+
/** Which end of the connection to use (source or target) for finding the edge */
|
|
1499
1986
|
findBy: 'source' | 'target';
|
|
1987
|
+
/** Which end of the existing edge to match against. Defaults to findBy. Use 'source' when the connection's target handle is on the edge's source (e.g. replacing switch connection when dragging from server to switch) */
|
|
1988
|
+
matchOn?: 'source' | 'target';
|
|
1500
1989
|
/** Optional edge data to set on the new edge */
|
|
1501
1990
|
data?: NetworkEdge['data'];
|
|
1502
1991
|
}
|
|
@@ -1519,6 +2008,8 @@ interface ValidateConnectionParams {
|
|
|
1519
2008
|
target: string | null;
|
|
1520
2009
|
sourceHandle?: string | null;
|
|
1521
2010
|
targetHandle?: string | null;
|
|
2011
|
+
/** Optional edge id to ignore during occupancy checks (used for reconnect). */
|
|
2012
|
+
ignoreEdgeId?: string;
|
|
1522
2013
|
}
|
|
1523
2014
|
interface ValidationResult {
|
|
1524
2015
|
valid: boolean;
|
|
@@ -1542,4 +2033,4 @@ declare function useNetworkDiagram(store: NetworkDiagramStore): NetworkDiagramSt
|
|
|
1542
2033
|
declare function useNodes(store: NetworkDiagramStore): NetworkNode[];
|
|
1543
2034
|
declare function useEdges(store: NetworkDiagramStore): NetworkEdge[];
|
|
1544
2035
|
|
|
1545
|
-
export { COUPLERS_PER_PANEL, COUPLER_SLOT_HEIGHT_PX, COUPLER_WIDTH_PX, CableNode, ClosureNode, CouplerNode, DeviceNode, DevicePlacementError, type DevicePlacementValidation, DiagramErrorBoundary, type DiagramErrorBoundaryProps, FIBER_COLORS_12, type FiberCable, type FiberColorId, FiberEdge, FiberNode, FibreCableWithTubesExpanded, type FibreFlowCable, type FibreFlowCableKind, type FibreFlowCircuit, type FibreFlowClosure, type FibreFlowEndpoint, FibreFlowMap, type FibreFlowMapProps, type FibreFlowSplice, FibreSplitNode, HANDLE_EXTENSION_PX, MultiTubeCableNode, NetworkDiagram, type NetworkDiagramProps, type NetworkEdge, type NetworkNode, PANEL_BORDER_WIDTH, PANEL_HEADER_HEIGHT, PANEL_HEIGHT_PX, PANEL_PADDING, PANEL_TUBE_TRAY_SPACING, PANEL_WIDTH_PX, POWER_CONNECTORS, PatchPanelNode, type Port, type PortBlock, type PortType, PowerEdge, RACK_HEADER_HEIGHT, RACK_WIDTH_PX, type RackConfig, type RackDevice, RackNode, type RackSchemaOptions, type ReplaceEdgeOptions, type SpliceConfig, SpliceNode, SplicePlacementError, type SplicePlacementValidation, type SpliceSchemaOptions, type SpliceTrayConfig, SpliceTrayNode, TubeNode, U_HEIGHT_PX, VerticalPDU, Width, addDeviceToRack, addSpliceToTray, baseColorFor, buildNodesFromRackConfig, buildNodesFromSpliceConfig, calculateCouplerRightX, calculateCouplerSlotSpacing, calculateCouplerSpacing, calculateDevicePositionFromU, calculatePanelDimensions, calculateSlotPositionFromY, calculateSplicePositionFromNumber, calculateYFromSlotPosition, createNetworkDiagramStore, createRackConfigFromNodes, createSpliceConfigFromNodes, fiberSolidOrStriped, findNearestRack, findNextAvailableHolderPosition, findNextAvailableUPosition, generateLayout, getConnectorConfig, getCouplerDimensions, getDeviceConnectorType, getFiberColor, getInnerContentWidth, getPDUPortType, getPanelHeight, getPanelWidth, getPowerPortStyle, getRackBounds, getStatusColor, getTrayDimensions, getTubeDimensions, inventoryCableToNetworkEdge, inventoryDeviceToNetworkNode, inventoryRackToNetworkNode, inventoryToNetworkDiagram, isHighPowerConnector, isPointInRack, isStriped, isUPositionAvailable, removeDeviceFromRack, removeSpliceFromTray, replaceEdge, snapToCouplerPosition, snapToSplicePosition, snapToUPosition, updateDeviceUPosition$1 as updateDeviceUPosition, updateDeviceUPosition as updateDeviceUPositionInSchema, updateSpliceHolderPosition, useEdges as useDiagramEdges, useNodes as useDiagramNodes, useNetworkDiagram, validateAndSnapDevice, validateRackDevicePlacements, validateSplicePlacements };
|
|
2036
|
+
export { COUPLERS_PER_PANEL, COUPLER_SLOT_HEIGHT_PX, COUPLER_WIDTH_PX, CableNode, ClosureNode, CouplerNode, type DeviceImageFit, type DeviceImageOptions, type DeviceImageRepeat, DeviceNode, DevicePlacementError, type DevicePlacementValidation, DiagramErrorBoundary, type DiagramErrorBoundaryProps, FIBER_COLORS_12, type FiberCable, type FiberColorId, FiberEdge, FiberNode, FibreCableWithTubesExpanded, type FibreFlowCable, type FibreFlowCableKind, type FibreFlowCableNodeData, type FibreFlowCircuit, type FibreFlowClosure, type FibreFlowClosureNodeData, type FibreFlowEndpoint, FibreFlowMap, type FibreFlowMapProps, type FibreFlowSplice, FibreSplitNode, HANDLE_EXTENSION_PX, MultiTubeCableNode, NetworkDiagram, type NetworkDiagramFitViewOptions, type NetworkDiagramFlowMethods, type NetworkDiagramFlowObject, type NetworkDiagramOptions, type NetworkDiagramProps, type NetworkDiagramStoreApi, type NetworkDiagramToImageOptions, type NetworkEdge, type NetworkEdgeData, type NetworkNode, type NetworkNodeData, type NetworkNodeDataBase, type NetworkNodeDataByType, PANEL_BORDER_WIDTH, PANEL_HEADER_HEIGHT, PANEL_HEIGHT_PX, PANEL_PADDING, PANEL_TUBE_TRAY_SPACING, PANEL_WIDTH_PX, POWER_CONNECTORS, PatchPanelNode, type Port, type PortBlock, type PortCableType, type PortType, PowerEdge, RACK_HEADER_HEIGHT, RACK_WIDTH_PX, type RackConfig, type RackDevice, RackNode, type RackSchemaOptions, type ReplaceEdgeOptions, type SpliceConfig, SpliceNode, SplicePlacementError, type SplicePlacementValidation, type SpliceSchemaOptions, type SpliceTrayConfig, SpliceTrayNode, TubeNode, U_HEIGHT_PX, type ValidateConnectionParams, type ValidationResult, VerticalPDU, Width, addDeviceToRack, addSpliceToTray, baseColorFor, buildNodesFromRackConfig, buildNodesFromSpliceConfig, calculateClosureDimensions, calculateCouplerRightX, calculateCouplerSlotSpacing, calculateCouplerSpacing, calculateDevicePositionFromU, calculatePanelDimensions, calculateSlotPositionFromY, calculateSplicePositionFromNumber, calculateUPositions, calculateYFromSlotPosition, createNetworkDiagramStore, createRackConfigFromNodes, createSpliceConfigFromNodes, fiberSolidOrStriped, findNearestRack, findNextAvailableHolderPosition, findNextAvailableUPosition, generateLayout, getConnectorConfig, getCouplerDimensions, getDeviceConnectorType, getFiberColor, getInnerContentWidth, getPDUPortType, getPanelHeight, getPanelWidth, getPowerPortStyle, getRackBounds, getStatusColor, getTrayDimensions, getTubeDimensions, inventoryCableToNetworkEdge, inventoryDeviceToNetworkNode, inventoryRackToNetworkNode, inventoryToNetworkDiagram, isHighPowerConnector, isPointInRack, isStriped, isUPositionAvailable, netboxCableToNetworkEdge, netboxDeviceToNetworkNode, netboxRackToNetworkNode, netboxToNetworkDiagram, removeDeviceFromRack, removeSpliceFromTray, replaceEdge, snapToCouplerPosition, snapToSplicePosition, snapToUPosition, updateDeviceUPosition$1 as updateDeviceUPosition, updateDeviceUPosition as updateDeviceUPositionInSchema, updateSpliceHolderPosition, useEdges as useDiagramEdges, useNodes as useDiagramNodes, useNetworkDiagram, validateAndSnapDevice, validateRackDevicePlacements, validateSplicePlacements };
|