@mp70/react-networks 0.1.7-alpha → 0.1.8-beta
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 +27 -27
- package/dist/index.css +114 -8
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +63 -7
- package/dist/index.d.ts +63 -7
- 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/dist/index.d.ts
CHANGED
|
@@ -15,13 +15,18 @@ declare enum Width {
|
|
|
15
15
|
* Port configuration for network devices
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
18
|
+
/**
|
|
19
|
+
* Port type enumeration
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
type PortType = 'ethernet' | 'fiber' | 'console' | 'mgmt' | 'usb' | 'power_ac' | 'power_c13' | 'power_c19';
|
|
18
23
|
interface Port {
|
|
19
24
|
/** Display label for the port */
|
|
20
25
|
label: string;
|
|
21
26
|
/** Whether the port is currently connected */
|
|
22
27
|
connected: boolean;
|
|
23
28
|
/** Type of port for styling and validation */
|
|
24
|
-
type?:
|
|
29
|
+
type?: PortType;
|
|
25
30
|
/** Cable type for connection validation */
|
|
26
31
|
cableType?: 'smf' | 'cat6' | 'om3' | 'om4' | 'om5' | 'cat5e' | 'cat6a' | 'cat7' | 'fiber' | 'ethernet';
|
|
27
32
|
}
|
|
@@ -39,7 +44,7 @@ interface PortBlock {
|
|
|
39
44
|
* Network node types supported by the diagram
|
|
40
45
|
* @public
|
|
41
46
|
*/
|
|
42
|
-
type NetworkNodeType = 'rack' | 'switch' | 'router' | 'server' | 'fiber' | 'patch-panel' | 'device' | 'vertical-pdu' | 'splice' | 'splice-tray' | 'tube' | 'cable' | 'coupler' | 'closure';
|
|
47
|
+
type NetworkNodeType = 'rack' | 'switch' | 'router' | 'server' | 'fiber' | 'patch-panel' | 'device' | 'vertical-pdu' | 'splice' | 'splice-tray' | 'tube' | 'cable' | 'multi-tube-cable' | 'coupler' | 'closure' | 'fibre-split';
|
|
43
48
|
/**
|
|
44
49
|
* Device status states
|
|
45
50
|
* @public
|
|
@@ -136,12 +141,20 @@ interface NetworkNode {
|
|
|
136
141
|
panelWidth?: number;
|
|
137
142
|
/** Height override for container nodes (patch-panel, closure) */
|
|
138
143
|
panelHeight?: number;
|
|
144
|
+
/** Optional rack width in pixels (for rack nodes, default: 300px) */
|
|
145
|
+
rackWidthPx?: number;
|
|
139
146
|
/** Number of rows for container nodes (patch-panel, closure) */
|
|
140
147
|
rows?: number;
|
|
141
148
|
/** Number of columns for container nodes (patch-panel, closure) */
|
|
142
149
|
cols?: number;
|
|
143
150
|
/** Header text for container nodes */
|
|
144
151
|
header?: string;
|
|
152
|
+
/** Type of fibre splitter: 'splitter' or 'WDM' (default: 'splitter') */
|
|
153
|
+
splitterType?: 'splitter' | 'WDM';
|
|
154
|
+
/** Number of input fibers on the left (1 or 2, default: 1) */
|
|
155
|
+
inputCount?: number;
|
|
156
|
+
/** Number of output fibers on the right (1-64, default: 8) */
|
|
157
|
+
outputCount?: number;
|
|
145
158
|
/** Additional custom properties */
|
|
146
159
|
[key: string]: any;
|
|
147
160
|
};
|
|
@@ -178,6 +191,18 @@ interface NetworkEdge {
|
|
|
178
191
|
color?: string;
|
|
179
192
|
/** Edge kind for styling/validation */
|
|
180
193
|
kind?: 'fiber' | 'power' | 'network';
|
|
194
|
+
/** Whether this edge represents a ribbon fiber connection */
|
|
195
|
+
isRibbon?: boolean;
|
|
196
|
+
/** Array of fiber IDs for ribbon mode (6-12 fibers) */
|
|
197
|
+
ribbonFiberIds?: number[];
|
|
198
|
+
/** Highlight edge with a pulsing stroke */
|
|
199
|
+
highlight?: boolean;
|
|
200
|
+
/** Override highlight color (defaults to edge color) */
|
|
201
|
+
highlightColor?: string;
|
|
202
|
+
/** Override highlight max stroke width */
|
|
203
|
+
highlightWidth?: number;
|
|
204
|
+
/** Optional tag for grouping edges in demos */
|
|
205
|
+
traceTag?: string;
|
|
181
206
|
/** Additional custom properties */
|
|
182
207
|
[key: string]: any;
|
|
183
208
|
};
|
|
@@ -209,6 +234,8 @@ interface RackConfig {
|
|
|
209
234
|
customHeaderText?: string;
|
|
210
235
|
/** Devices mounted in the rack */
|
|
211
236
|
devices: RackDevice[];
|
|
237
|
+
/** Optional rack width in pixels (default: 300px which represents standard 48.26cm/19" rack) */
|
|
238
|
+
rackWidthPx?: number;
|
|
212
239
|
}
|
|
213
240
|
/**
|
|
214
241
|
* Device mounted in a rack
|
|
@@ -279,6 +306,10 @@ interface SpliceConfig {
|
|
|
279
306
|
holder: number;
|
|
280
307
|
/** Loss value in dB */
|
|
281
308
|
lossDb?: number;
|
|
309
|
+
/** Splice mode: 'single' for individual fiber, 'ribbon' for ribbon splices */
|
|
310
|
+
mode?: 'single' | 'ribbon';
|
|
311
|
+
/** For ribbon mode: array of fiber IDs (6-12) in the ribbon */
|
|
312
|
+
ribbonFiberIds?: number[];
|
|
282
313
|
}
|
|
283
314
|
/**
|
|
284
315
|
* Splice tray configuration structure
|
|
@@ -343,6 +374,9 @@ interface NetworkDiagramProps {
|
|
|
343
374
|
setNodes: (nodes: any[]) => void;
|
|
344
375
|
setEdges: (edges: any[]) => void;
|
|
345
376
|
toImage: (options?: any) => Promise<string>;
|
|
377
|
+
getNodes: () => any[];
|
|
378
|
+
getEdges: () => any[];
|
|
379
|
+
fitView: (options?: any) => void;
|
|
346
380
|
}) => void;
|
|
347
381
|
/** Show download button */
|
|
348
382
|
showDownloadButton?: boolean;
|
|
@@ -352,12 +386,16 @@ interface NetworkDiagramProps {
|
|
|
352
386
|
downloadButtonText?: string;
|
|
353
387
|
/** Download button styling options */
|
|
354
388
|
downloadButtonStyle?: React.CSSProperties;
|
|
355
|
-
/** Allow reconnecting existing edges from either end */
|
|
356
|
-
allowReconnectExisting?: boolean;
|
|
357
389
|
/** Use smoothstep edges for tube connections (both tube-to-cable and cable-to-tube). Default is fiber. */
|
|
358
390
|
useSmoothstepEdgesForTubes?: boolean;
|
|
359
391
|
/** Enable connecting edges by clicking on handles. When true, increases handle sizes for better touch targets. Default is true. */
|
|
360
392
|
connectOnClick?: boolean;
|
|
393
|
+
/** Disable panning on drag. Default is false. */
|
|
394
|
+
panOnDrag?: boolean;
|
|
395
|
+
/** Disable panning on scroll. Default is true. */
|
|
396
|
+
panOnScroll?: boolean;
|
|
397
|
+
/** Disable zooming on scroll. Default is true. */
|
|
398
|
+
zoomOnScroll?: boolean;
|
|
361
399
|
}
|
|
362
400
|
|
|
363
401
|
declare const NetworkDiagram: React$1.FC<NetworkDiagramProps>;
|
|
@@ -399,18 +437,34 @@ declare const TubeNode: React$1.FC<NodeProps<NetworkNode['data']>>;
|
|
|
399
437
|
|
|
400
438
|
/**
|
|
401
439
|
* CableNode
|
|
402
|
-
* -
|
|
403
|
-
* - Each colored handle corresponds to a
|
|
440
|
+
* - Represents a multi-fiber cable (1-24 fibers)
|
|
441
|
+
* - Each colored handle corresponds to a single fiber
|
|
404
442
|
* - Displays cable summary text (fiber count + cable identifier)
|
|
405
443
|
*/
|
|
406
444
|
declare const CableNode: React$1.FC<NodeProps<NetworkNode['data']>>;
|
|
407
445
|
|
|
446
|
+
/**
|
|
447
|
+
* MultiTubeCableNode
|
|
448
|
+
* - Represents a multi-tube cable (1-24 tubes)
|
|
449
|
+
* - Each colored handle corresponds to a tube within the cable
|
|
450
|
+
* - Displays cable summary text (fiber count + cable identifier)
|
|
451
|
+
*/
|
|
452
|
+
declare const MultiTubeCableNode: React$1.FC<NodeProps<NetworkNode['data']>>;
|
|
453
|
+
|
|
408
454
|
declare const CouplerNode: React$1.FC<NodeProps<NetworkNode['data']>>;
|
|
409
455
|
|
|
410
456
|
declare const PatchPanelNode: React$1.FC<NodeProps<NetworkNode['data']>>;
|
|
411
457
|
|
|
412
458
|
declare const ClosureNode: React$1.FC<NodeProps<NetworkNode['data']>>;
|
|
413
459
|
|
|
460
|
+
/**
|
|
461
|
+
* FibreSplitNode component for rendering fiber splitters and WDM devices
|
|
462
|
+
* Uses a trapezoid shape pointing right (narrow input on left, wider outputs on right)
|
|
463
|
+
*
|
|
464
|
+
* @public
|
|
465
|
+
*/
|
|
466
|
+
declare const FibreSplitNode: React$1.FC<NodeProps<NetworkNode['data']>>;
|
|
467
|
+
|
|
414
468
|
interface InventoryRackDTO {
|
|
415
469
|
id: string | number;
|
|
416
470
|
name: string;
|
|
@@ -571,6 +625,8 @@ declare const snapToSplicePosition: (splice: NetworkNode, tray: NetworkNode, new
|
|
|
571
625
|
declare const findNextAvailableHolderPosition: (tray: NetworkNode, splice: NetworkNode, allNodes: NetworkNode[], startFrom?: number) => number;
|
|
572
626
|
/**
|
|
573
627
|
* Calculate splice position based on holder number within a tray
|
|
628
|
+
* Note: This function doesn't have access to splice data, so it uses single mode spacing
|
|
629
|
+
* For ribbon splices, use calculateSplicePositionFromNumberWithData instead
|
|
574
630
|
*/
|
|
575
631
|
declare const calculateSplicePositionFromNumber: (tray: NetworkNode, holderPosition: number) => {
|
|
576
632
|
x: number;
|
|
@@ -998,4 +1054,4 @@ declare function useNetworkDiagram(store: NetworkDiagramStore): NetworkDiagramSt
|
|
|
998
1054
|
declare function useNodes(store: NetworkDiagramStore): NetworkNode[];
|
|
999
1055
|
declare function useEdges(store: NetworkDiagramStore): NetworkEdge[];
|
|
1000
1056
|
|
|
1001
|
-
export { COUPLERS_PER_PANEL, COUPLER_SLOT_HEIGHT_PX, COUPLER_WIDTH_PX, CableNode, ClosureNode, CouplerNode, DeviceNode, DevicePlacementError, type DevicePlacementValidation, FIBER_COLORS_12, type FiberCable, type FiberColorId, FiberEdge, FiberNode, 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, PowerEdge, type RackConfig, type RackDevice, RackNode, type RackSchemaOptions, type ReplaceEdgeOptions, type SpliceConfig, SpliceNode, SplicePlacementError, type SplicePlacementValidation, type SpliceSchemaOptions, type SpliceTrayConfig, SpliceTrayNode, TubeNode, 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 };
|
|
1057
|
+
export { COUPLERS_PER_PANEL, COUPLER_SLOT_HEIGHT_PX, COUPLER_WIDTH_PX, CableNode, ClosureNode, CouplerNode, DeviceNode, DevicePlacementError, type DevicePlacementValidation, FIBER_COLORS_12, type FiberCable, type FiberColorId, FiberEdge, FiberNode, FibreSplitNode, 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, type RackConfig, type RackDevice, RackNode, type RackSchemaOptions, type ReplaceEdgeOptions, type SpliceConfig, SpliceNode, SplicePlacementError, type SplicePlacementValidation, type SpliceSchemaOptions, type SpliceTrayConfig, SpliceTrayNode, TubeNode, 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 };
|