@shumoku/renderer 0.2.3 → 0.2.5

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/src/types.ts CHANGED
@@ -1,125 +1,127 @@
1
- /**
2
- * Renderer Types
3
- * Types for SVG and interactive renderers
4
- */
5
-
6
- /**
7
- * Render mode for SVG output
8
- * - 'static': Pure SVG without interactive data attributes (default)
9
- * - 'interactive': SVG with data attributes for runtime interactivity
10
- */
11
- export type RenderMode = 'static' | 'interactive'
12
-
13
- /**
14
- * Options for data attributes in interactive mode
15
- */
16
- export interface DataAttributeOptions {
17
- /** Include device data attributes (type, vendor, model, etc.) */
18
- device?: boolean
19
- /** Include link data attributes (bandwidth, vlan, endpoints) */
20
- link?: boolean
21
- /** Include full metadata as JSON in data-*-json attributes */
22
- metadata?: boolean
23
- }
24
-
25
- /**
26
- * Device information extracted from data attributes
27
- * Used by interactive runtime
28
- */
29
- export interface DeviceInfo {
30
- id: string
31
- label: string | string[]
32
- type?: string
33
- vendor?: string
34
- model?: string
35
- service?: string
36
- resource?: string
37
- metadata?: Record<string, unknown>
38
- ports?: PortInfo[]
39
- }
40
-
41
- /**
42
- * Port information for device modals
43
- */
44
- export interface PortInfo {
45
- id: string
46
- label: string
47
- deviceId: string
48
- connectedTo?: {
49
- device: string
50
- port?: string
51
- }
52
- }
53
-
54
- /**
55
- * Link endpoint information
56
- */
57
- export interface EndpointInfo {
58
- device: string
59
- port?: string
60
- ip?: string
61
- }
62
-
63
- /**
64
- * Link information extracted from data attributes
65
- * Used by interactive runtime
66
- */
67
- export interface LinkInfo {
68
- id: string
69
- from: EndpointInfo
70
- to: EndpointInfo
71
- bandwidth?: string
72
- vlan?: number[]
73
- redundancy?: string
74
- label?: string | string[]
75
- }
76
-
77
- /**
78
- * Options for initializing interactive features
79
- */
80
- export interface InteractiveOptions {
81
- /** SVG element or selector */
82
- target: SVGElement | Element | string
83
- /** Modal configuration */
84
- modal?: { enabled?: boolean }
85
- /** Tooltip configuration */
86
- tooltip?: { enabled?: boolean }
87
- /** Pan/Zoom configuration */
88
- panZoom?: {
89
- enabled?: boolean
90
- minScale?: number
91
- maxScale?: number
92
- }
93
- }
94
-
95
- /**
96
- * Interactive runtime instance
97
- */
98
- export interface InteractiveInstance {
99
- /** Destroy the instance and clean up event listeners */
100
- destroy: () => void
101
- /** Show modal for a device (placeholder) */
102
- showDeviceModal: (deviceId: string) => void
103
- /** Hide modal (placeholder) */
104
- hideModal: () => void
105
- /** Show tooltip for a link (placeholder) */
106
- showLinkTooltip: (linkId: string, x: number, y: number) => void
107
- /** Hide tooltip */
108
- hideTooltip: () => void
109
- /** Reset view to fit content */
110
- resetView: () => void
111
- /** Get current scale */
112
- getScale: () => number
113
- }
114
-
115
- /**
116
- * Options for HTML renderer
117
- */
118
- export interface HTMLRendererOptions {
119
- /** Page title (defaults to network name or 'Network Diagram') */
120
- title?: string
121
- /** Show branding link (defaults to true) */
122
- branding?: boolean
123
- /** Show toolbar with zoom controls (defaults to true) */
124
- toolbar?: boolean
125
- }
1
+ /**
2
+ * Renderer Types
3
+ * Types for SVG and interactive renderers
4
+ */
5
+
6
+ /**
7
+ * Render mode for SVG output
8
+ * - 'static': Pure SVG without interactive data attributes (default)
9
+ * - 'interactive': SVG with data attributes for runtime interactivity
10
+ */
11
+ export type RenderMode = 'static' | 'interactive'
12
+
13
+ /**
14
+ * Options for data attributes in interactive mode
15
+ */
16
+ export interface DataAttributeOptions {
17
+ /** Include device data attributes (type, vendor, model, etc.) */
18
+ device?: boolean
19
+ /** Include link data attributes (bandwidth, vlan, endpoints) */
20
+ link?: boolean
21
+ /** Include full metadata as JSON in data-*-json attributes */
22
+ metadata?: boolean
23
+ }
24
+
25
+ /**
26
+ * Device information extracted from data attributes
27
+ * Used by interactive runtime
28
+ */
29
+ export interface DeviceInfo {
30
+ id: string
31
+ label: string | string[]
32
+ type?: string
33
+ vendor?: string
34
+ model?: string
35
+ service?: string
36
+ resource?: string
37
+ metadata?: Record<string, unknown>
38
+ ports?: PortInfo[]
39
+ }
40
+
41
+ /**
42
+ * Port information for device modals
43
+ */
44
+ export interface PortInfo {
45
+ id: string
46
+ label: string
47
+ deviceId: string
48
+ connectedTo?: {
49
+ device: string
50
+ port?: string
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Link endpoint information
56
+ */
57
+ export interface EndpointInfo {
58
+ device: string
59
+ port?: string
60
+ ip?: string
61
+ }
62
+
63
+ /**
64
+ * Link information extracted from data attributes
65
+ * Used by interactive runtime
66
+ */
67
+ export interface LinkInfo {
68
+ id: string
69
+ from: EndpointInfo
70
+ to: EndpointInfo
71
+ bandwidth?: string
72
+ vlan?: number[]
73
+ redundancy?: string
74
+ label?: string | string[]
75
+ }
76
+
77
+ /**
78
+ * Options for initializing interactive features
79
+ */
80
+ export interface InteractiveOptions {
81
+ /** SVG element or selector */
82
+ target: SVGElement | Element | string
83
+ /** Modal configuration */
84
+ modal?: { enabled?: boolean }
85
+ /** Tooltip configuration */
86
+ tooltip?: { enabled?: boolean }
87
+ /** Pan/Zoom configuration */
88
+ panZoom?: {
89
+ enabled?: boolean
90
+ minScale?: number
91
+ maxScale?: number
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Interactive runtime instance
97
+ */
98
+ export interface InteractiveInstance {
99
+ /** Destroy the instance and clean up event listeners */
100
+ destroy: () => void
101
+ /** Show modal for a device (placeholder) */
102
+ showDeviceModal: (deviceId: string) => void
103
+ /** Hide modal (placeholder) */
104
+ hideModal: () => void
105
+ /** Show tooltip for a link (placeholder) */
106
+ showLinkTooltip: (linkId: string, x: number, y: number) => void
107
+ /** Hide tooltip */
108
+ hideTooltip: () => void
109
+ /** Reset view to fit content */
110
+ resetView: () => void
111
+ /** Get current scale */
112
+ getScale: () => number
113
+ /** Navigate to a sheet (hierarchical diagrams) */
114
+ navigateToSheet?: (sheetId: string) => void
115
+ }
116
+
117
+ /**
118
+ * Options for HTML renderer
119
+ */
120
+ export interface HTMLRendererOptions {
121
+ /** Page title (defaults to network name or 'Network Diagram') */
122
+ title?: string
123
+ /** Show branding link (defaults to true) */
124
+ branding?: boolean
125
+ /** Show toolbar with zoom controls (defaults to true) */
126
+ toolbar?: boolean
127
+ }