@arach/arc 0.4.2 → 0.4.3
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 +52 -5
- package/lib/arc.es.js +13574 -13405
- package/lib/arc.umd.js +110 -101
- package/lib/index.d.ts +702 -111
- package/package.json +5 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,67 +1,109 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
1
|
+
import { default as default_2 } from 'react';
|
|
2
|
+
import { JSX } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
declare type AnchorPosition = 'left' | 'right' | 'top' | 'bottom' | 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
|
|
5
|
+
|
|
6
|
+
declare type AnchorPosition_2 = 'left' | 'right' | 'top' | 'bottom' | 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
|
|
7
|
+
|
|
8
|
+
export declare interface ArcConnector {
|
|
9
|
+
from: string;
|
|
10
|
+
to: string;
|
|
11
|
+
fromAnchor: AnchorPosition;
|
|
12
|
+
toAnchor: AnchorPosition;
|
|
13
|
+
style: string;
|
|
14
|
+
curve?: 'natural' | 'step';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare interface ArcConnectorStyle {
|
|
18
|
+
color: DiagramColor;
|
|
19
|
+
strokeWidth: number;
|
|
20
|
+
label?: string;
|
|
21
|
+
labelAlign?: LabelAlign;
|
|
22
|
+
dashed?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export declare function ArcDiagram({ data, className, interactive, mode, theme, label, labelPosition, defaultZoom, zoomLevels, showArcToggle, showAutoLayout, showControls, showMinimap, frame, hoverEffects, onNodeHover, titleBlock, maxFitZoom, }: ArcDiagramProps): JSX.Element;
|
|
26
|
+
|
|
27
|
+
export declare interface ArcDiagramData {
|
|
28
|
+
id?: string;
|
|
29
|
+
layout: DiagramLayout;
|
|
30
|
+
nodes: Record<string, ArcNodePosition>;
|
|
31
|
+
nodeData: Record<string, ArcNodeData>;
|
|
32
|
+
connectors: ArcConnector[];
|
|
33
|
+
connectorStyles: Record<string, ArcConnectorStyle>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare interface ArcDiagramData_2 {
|
|
37
|
+
layout: DiagramLayout_2;
|
|
38
|
+
nodes: Record<string, NodePosition_2>;
|
|
39
|
+
nodeData: Record<string, NodeData>;
|
|
40
|
+
connectors: Connector[];
|
|
41
|
+
connectorStyles: Record<string, ConnectorStyle_2>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare function ArcDiagramIsometric({ config, options, className, style, onNodeClick, onLayerClick }: ArcDiagramProps_2): JSX.Element;
|
|
45
|
+
|
|
46
|
+
declare interface ArcDiagramProps {
|
|
47
|
+
data: ArcDiagramData;
|
|
48
|
+
className?: string;
|
|
49
|
+
interactive?: boolean;
|
|
50
|
+
mode?: DiagramMode;
|
|
51
|
+
theme?: ThemeId;
|
|
52
|
+
/** Override the diagram label. Defaults to data.id */
|
|
53
|
+
label?: string;
|
|
54
|
+
/** Which corner the label sits in. Default: 'top-left'. Zoom controls auto-avoid it. */
|
|
55
|
+
labelPosition?: LabelCorner;
|
|
56
|
+
/** Initial zoom level. Use 'fit' to auto-fit content, or a number (e.g., 0.75). Default: 1 */
|
|
57
|
+
defaultZoom?: number | 'fit';
|
|
58
|
+
/** Max zoom when defaultZoom='fit'. E.g., 0.85 caps fit at 85%. Default: 1 */
|
|
59
|
+
maxFitZoom?: number;
|
|
60
|
+
/** Custom zoom level steps. Default: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 2] */
|
|
61
|
+
zoomLevels?: number[];
|
|
62
|
+
/** Show the .arc source toggle button. Default: true */
|
|
63
|
+
showArcToggle?: boolean;
|
|
64
|
+
/** Show the auto-layout button. Default: false */
|
|
65
|
+
showAutoLayout?: boolean;
|
|
66
|
+
/** Show zoom controls even when not interactive (branded reader chrome). Default: follows `interactive` */
|
|
67
|
+
showControls?: boolean;
|
|
68
|
+
/** Show a minimap overview (bottom-left). Default: false */
|
|
69
|
+
showMinimap?: boolean;
|
|
70
|
+
/** Override the edge/frame treatment (else the theme's brand.frame). */
|
|
71
|
+
frame?: BrandSpec['frame'];
|
|
72
|
+
/** Control hover behavior. true = all effects (default), false = none, object = granular control */
|
|
73
|
+
hoverEffects?: boolean | HoverEffectsConfig;
|
|
74
|
+
/** Called when a node is hovered/clicked (nodeId) or released (null) */
|
|
75
|
+
onNodeHover?: (nodeId: string | null) => void;
|
|
76
|
+
/** Override the engineering title-block fields (shown when the theme opts in). */
|
|
77
|
+
titleBlock?: TitleBlockInfo;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
declare interface ArcDiagramProps_2 {
|
|
81
|
+
config: DiagramConfig;
|
|
82
|
+
options?: PlayerOptions;
|
|
83
|
+
className?: string;
|
|
84
|
+
style?: default_2.CSSProperties;
|
|
85
|
+
/** Fired when a node box is clicked (drill-in). */
|
|
86
|
+
onNodeClick?: (node: DiagramNode, meta: {
|
|
87
|
+
tier: number;
|
|
88
|
+
index: number;
|
|
89
|
+
}) => void;
|
|
90
|
+
/** Fired when a layer floor is clicked (solo). */
|
|
91
|
+
onLayerClick?: (tier: number) => void;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export declare interface ArcNodeData {
|
|
95
|
+
icon: string;
|
|
96
|
+
name: string;
|
|
97
|
+
subtitle?: string;
|
|
98
|
+
description?: string;
|
|
99
|
+
color: DiagramColor;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export declare interface ArcNodePosition {
|
|
103
|
+
x: number;
|
|
104
|
+
y: number;
|
|
105
|
+
size: NodeSize;
|
|
106
|
+
}
|
|
65
107
|
|
|
66
108
|
export declare interface AsciiOptions {
|
|
67
109
|
/** Pixels per character horizontally (default: 8) */
|
|
@@ -78,13 +120,115 @@ export declare interface AsciiOptions {
|
|
|
78
120
|
showLabels?: boolean;
|
|
79
121
|
}
|
|
80
122
|
|
|
81
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Generate a diagram from minimal input — no positions or anchors needed.
|
|
125
|
+
*/
|
|
126
|
+
export declare interface AutoDiagramInput {
|
|
127
|
+
nodeData: ArcDiagramData_2['nodeData'];
|
|
128
|
+
connectors: Array<Omit<Connector, 'fromAnchor' | 'toAnchor'> & {
|
|
129
|
+
fromAnchor?: AnchorPosition_2;
|
|
130
|
+
toAnchor?: AnchorPosition_2;
|
|
131
|
+
}>;
|
|
132
|
+
connectorStyles: ArcDiagramData_2['connectorStyles'];
|
|
133
|
+
layout?: LayoutOptions;
|
|
134
|
+
}
|
|
82
135
|
|
|
83
|
-
|
|
136
|
+
/**
|
|
137
|
+
* Auto-layout an ArcDiagramData.
|
|
138
|
+
*
|
|
139
|
+
* Uses LR flow within rows. When layers exceed the target width,
|
|
140
|
+
* wraps into multiple rows — combining LR and TB to maximize
|
|
141
|
+
* use of the available 2D space.
|
|
142
|
+
*/
|
|
143
|
+
export declare function autoLayout(data: ArcDiagramData_2, options?: LayoutOptions): ArcDiagramData_2;
|
|
144
|
+
|
|
145
|
+
declare interface BrandSpec {
|
|
146
|
+
/** Font stack for the whole diagram (node names inherit this). */
|
|
147
|
+
fontFamily?: string;
|
|
148
|
+
/** Monospace stack for subtitles + connector labels. */
|
|
149
|
+
monoFamily?: string;
|
|
150
|
+
/** Stylesheet URL injected once so the families load (e.g. Google Fonts). */
|
|
151
|
+
fontImport?: string;
|
|
152
|
+
/** Node + icon corner radius (CSS length). '0px' = square tiles. */
|
|
153
|
+
nodeRadius?: string;
|
|
154
|
+
/** Node border width (CSS length), overrides the default 2px. */
|
|
155
|
+
nodeBorderWidth?: string;
|
|
156
|
+
/** Uppercase + letter-space the subtitle and connector labels. */
|
|
157
|
+
upperLabels?: boolean;
|
|
158
|
+
/** Arrowhead shape at connector ends. */
|
|
159
|
+
arrowhead?: 'triangle' | 'chevron';
|
|
160
|
+
/** Background grid system. */
|
|
161
|
+
gridType?: 'dots' | 'lines' | 'crosshair' | 'none';
|
|
162
|
+
/** Edge/frame treatment at the diagram boundary. */
|
|
163
|
+
frame?: 'hairline' | 'inset' | 'brackets' | 'ticks' | 'cropmarks' | 'corners' | 'sheet' | 'reticle' | 'none';
|
|
164
|
+
/** Render an engineering-drawing title block in the bottom-right corner. */
|
|
165
|
+
titleBlock?: boolean;
|
|
166
|
+
}
|
|
84
167
|
|
|
85
|
-
export
|
|
168
|
+
export declare interface ColorPalette {
|
|
169
|
+
violet: {
|
|
170
|
+
border: string;
|
|
171
|
+
bg: string;
|
|
172
|
+
icon: string;
|
|
173
|
+
stroke: string;
|
|
174
|
+
};
|
|
175
|
+
emerald: {
|
|
176
|
+
border: string;
|
|
177
|
+
bg: string;
|
|
178
|
+
icon: string;
|
|
179
|
+
stroke: string;
|
|
180
|
+
};
|
|
181
|
+
blue: {
|
|
182
|
+
border: string;
|
|
183
|
+
bg: string;
|
|
184
|
+
icon: string;
|
|
185
|
+
stroke: string;
|
|
186
|
+
};
|
|
187
|
+
amber: {
|
|
188
|
+
border: string;
|
|
189
|
+
bg: string;
|
|
190
|
+
icon: string;
|
|
191
|
+
stroke: string;
|
|
192
|
+
};
|
|
193
|
+
sky: {
|
|
194
|
+
border: string;
|
|
195
|
+
bg: string;
|
|
196
|
+
icon: string;
|
|
197
|
+
stroke: string;
|
|
198
|
+
};
|
|
199
|
+
zinc: {
|
|
200
|
+
border: string;
|
|
201
|
+
bg: string;
|
|
202
|
+
icon: string;
|
|
203
|
+
stroke: string;
|
|
204
|
+
};
|
|
205
|
+
rose: {
|
|
206
|
+
border: string;
|
|
207
|
+
bg: string;
|
|
208
|
+
icon: string;
|
|
209
|
+
stroke: string;
|
|
210
|
+
};
|
|
211
|
+
orange: {
|
|
212
|
+
border: string;
|
|
213
|
+
bg: string;
|
|
214
|
+
icon: string;
|
|
215
|
+
stroke: string;
|
|
216
|
+
};
|
|
217
|
+
}
|
|
86
218
|
|
|
87
|
-
|
|
219
|
+
/**
|
|
220
|
+
* Convert a DiagramConfig back to YAML string
|
|
221
|
+
*/
|
|
222
|
+
export declare function configToYaml(config: DiagramConfig_2): string;
|
|
223
|
+
|
|
224
|
+
declare interface Connector {
|
|
225
|
+
from: string;
|
|
226
|
+
to: string;
|
|
227
|
+
fromAnchor: AnchorPosition_2;
|
|
228
|
+
toAnchor: AnchorPosition_2;
|
|
229
|
+
style: string;
|
|
230
|
+
curve?: 'natural' | 'step';
|
|
231
|
+
}
|
|
88
232
|
|
|
89
233
|
export declare interface ConnectorStyle {
|
|
90
234
|
color: string;
|
|
@@ -97,15 +241,40 @@ export declare interface ConnectorStyle {
|
|
|
97
241
|
showEndpoints?: boolean;
|
|
98
242
|
}
|
|
99
243
|
|
|
100
|
-
|
|
244
|
+
declare interface ConnectorStyle_2 {
|
|
245
|
+
color: DiagramColor_2;
|
|
246
|
+
strokeWidth: number;
|
|
247
|
+
label?: string;
|
|
248
|
+
dashed?: boolean;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export declare function createAutoLayout(input: AutoDiagramInput): ArcDiagramData_2;
|
|
101
252
|
|
|
102
|
-
|
|
253
|
+
/** Delete a diagram session */
|
|
254
|
+
export declare function deleteDiagramSession(id: string): void;
|
|
103
255
|
|
|
104
|
-
|
|
256
|
+
/** Derive a URL-safe session ID from a diagram's source path or ID */
|
|
257
|
+
export declare function deriveSessionId(source: string): string;
|
|
105
258
|
|
|
106
|
-
export
|
|
259
|
+
export declare function DiagramCanvas({ onViewportChange, embedConfig, zoomConfig, themeOverride, isDark }: DiagramCanvasProps): JSX.Element;
|
|
107
260
|
|
|
108
|
-
|
|
261
|
+
declare interface DiagramCanvasProps {
|
|
262
|
+
onViewportChange?: (bounds: {
|
|
263
|
+
x: number;
|
|
264
|
+
y: number;
|
|
265
|
+
width: number;
|
|
266
|
+
height: number;
|
|
267
|
+
}) => void;
|
|
268
|
+
embedConfig?: EmbedConfig;
|
|
269
|
+
zoomConfig?: ZoomConfig;
|
|
270
|
+
/** Override canvas background with an Arc theme. */
|
|
271
|
+
themeOverride?: string;
|
|
272
|
+
isDark?: boolean;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export declare type DiagramColor = 'violet' | 'emerald' | 'blue' | 'amber' | 'sky' | 'zinc' | 'rose' | 'orange';
|
|
276
|
+
|
|
277
|
+
declare type DiagramColor_2 = 'violet' | 'emerald' | 'blue' | 'amber' | 'sky' | 'zinc' | 'rose' | 'orange';
|
|
109
278
|
|
|
110
279
|
export declare interface DiagramConfig {
|
|
111
280
|
id?: string;
|
|
@@ -135,9 +304,52 @@ export declare interface DiagramConfig {
|
|
|
135
304
|
}[];
|
|
136
305
|
}
|
|
137
306
|
|
|
138
|
-
|
|
307
|
+
declare interface DiagramConfig_2 {
|
|
308
|
+
title: string;
|
|
309
|
+
description: string;
|
|
310
|
+
theme: 'dark' | 'light';
|
|
311
|
+
canvas: {
|
|
312
|
+
width: number;
|
|
313
|
+
height: number;
|
|
314
|
+
};
|
|
315
|
+
origin: {
|
|
316
|
+
x: number;
|
|
317
|
+
y: number;
|
|
318
|
+
};
|
|
319
|
+
cornerRadius?: number;
|
|
320
|
+
tiers: TierConfig_2[];
|
|
321
|
+
floorSize: {
|
|
322
|
+
width: number;
|
|
323
|
+
depth: number;
|
|
324
|
+
};
|
|
325
|
+
nodes: DiagramNode_2[];
|
|
326
|
+
pillars?: {
|
|
327
|
+
x: number;
|
|
328
|
+
y: number;
|
|
329
|
+
fromTier: number;
|
|
330
|
+
toTier: number;
|
|
331
|
+
}[];
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export declare function DiagramEditor({ isDark, onToggleTheme, initialData, themeId, colorMode, sessionId, initialDiagramMeta }: {
|
|
335
|
+
isDark: boolean;
|
|
336
|
+
onToggleTheme: () => void;
|
|
337
|
+
initialData?: any;
|
|
338
|
+
themeId?: string | null;
|
|
339
|
+
colorMode?: 'light' | 'dark';
|
|
340
|
+
sessionId?: string | null;
|
|
341
|
+
initialDiagramMeta?: Record<string, any>;
|
|
342
|
+
}): JSX.Element;
|
|
139
343
|
|
|
140
|
-
export
|
|
344
|
+
export declare interface DiagramLayout {
|
|
345
|
+
width: number;
|
|
346
|
+
height: number;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
declare interface DiagramLayout_2 {
|
|
350
|
+
width: number;
|
|
351
|
+
height: number;
|
|
352
|
+
}
|
|
141
353
|
|
|
142
354
|
export declare interface DiagramMeta {
|
|
143
355
|
themeId?: string | null;
|
|
@@ -149,7 +361,7 @@ export declare interface DiagramMeta {
|
|
|
149
361
|
sourceUrl?: string;
|
|
150
362
|
}
|
|
151
363
|
|
|
152
|
-
export
|
|
364
|
+
export declare type DiagramMode = 'dark' | 'light';
|
|
153
365
|
|
|
154
366
|
export declare interface DiagramNode {
|
|
155
367
|
tier: number;
|
|
@@ -163,11 +375,47 @@ export declare interface DiagramNode {
|
|
|
163
375
|
opacity?: number;
|
|
164
376
|
blur?: number;
|
|
165
377
|
translucent?: boolean;
|
|
378
|
+
/** Optional link target; clicking the node surfaces this (declarative click hook). */
|
|
379
|
+
link?: string;
|
|
166
380
|
}
|
|
167
381
|
|
|
168
|
-
|
|
382
|
+
declare interface DiagramNode_2 {
|
|
383
|
+
tier: number;
|
|
384
|
+
x: number;
|
|
385
|
+
y: number;
|
|
386
|
+
width: number;
|
|
387
|
+
depth: number;
|
|
388
|
+
height: number;
|
|
389
|
+
color: string;
|
|
390
|
+
label: string;
|
|
391
|
+
opacity?: number;
|
|
392
|
+
blur?: number;
|
|
393
|
+
translucent?: boolean;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export declare interface DiagramSession {
|
|
397
|
+
diagram: any;
|
|
398
|
+
themeId: string | null;
|
|
399
|
+
colorMode: 'light' | 'dark';
|
|
400
|
+
diagramMeta: Record<string, any>;
|
|
401
|
+
updatedAt: number;
|
|
402
|
+
name?: string;
|
|
403
|
+
originalDiagram?: any;
|
|
404
|
+
}
|
|
169
405
|
|
|
170
|
-
|
|
406
|
+
declare interface EditorContextType {
|
|
407
|
+
state: typeof initialState;
|
|
408
|
+
dispatch: React.Dispatch<any>;
|
|
409
|
+
actions: Record<string, (...args: any[]) => void>;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export declare function EditorProvider({ children, initialDiagram, initialThemeId, initialColorMode, initialDiagramMeta }: {
|
|
413
|
+
children: React.ReactNode;
|
|
414
|
+
initialDiagram?: any;
|
|
415
|
+
initialThemeId?: string | null;
|
|
416
|
+
initialColorMode?: 'light' | 'dark';
|
|
417
|
+
initialDiagramMeta?: Record<string, any>;
|
|
418
|
+
}): JSX.Element;
|
|
171
419
|
|
|
172
420
|
export declare interface EmbedConfig {
|
|
173
421
|
defaultViewMode?: ViewMode;
|
|
@@ -181,32 +429,198 @@ export declare interface EmbedConfig {
|
|
|
181
429
|
showGrid?: boolean;
|
|
182
430
|
}
|
|
183
431
|
|
|
184
|
-
|
|
432
|
+
/** Generate a short session ID (first 8 hex chars of a UUID for brevity in URLs) */
|
|
433
|
+
export declare function generateSessionId(): string;
|
|
185
434
|
|
|
186
|
-
|
|
435
|
+
/** Shading for a named preset color (falls back to `slate` when unknown). */
|
|
436
|
+
export declare function getColorShading(colorName: string): IsoShadingResult;
|
|
187
437
|
|
|
188
|
-
export
|
|
438
|
+
export declare function getTheme(id: ThemeId): Theme;
|
|
189
439
|
|
|
190
|
-
export
|
|
440
|
+
export declare function getThemeList(): {
|
|
441
|
+
id: ThemeId;
|
|
442
|
+
name: string;
|
|
443
|
+
description: string;
|
|
444
|
+
}[];
|
|
445
|
+
|
|
446
|
+
declare interface HoverEffectsConfig {
|
|
447
|
+
/** Dim unrelated nodes/connectors. Default: true */
|
|
448
|
+
dim?: boolean;
|
|
449
|
+
/** 0–1 opacity for dimmed nodes. Connectors dim to ~56% of this. Default: 0.45 */
|
|
450
|
+
dimOpacity?: number;
|
|
451
|
+
/** Lift hovered node up 2px. Default: true */
|
|
452
|
+
lift?: boolean;
|
|
453
|
+
/** Colored glow shadow on hover. Default: true */
|
|
454
|
+
glow?: boolean;
|
|
455
|
+
/** Thicken connected edges. Default: true */
|
|
456
|
+
highlightEdges?: boolean;
|
|
457
|
+
}
|
|
191
458
|
|
|
192
|
-
|
|
459
|
+
declare const initialState: {
|
|
460
|
+
diagram: {
|
|
461
|
+
layout: {
|
|
462
|
+
width: number;
|
|
463
|
+
height: number;
|
|
464
|
+
};
|
|
465
|
+
grid: {
|
|
466
|
+
enabled: boolean;
|
|
467
|
+
size: number;
|
|
468
|
+
color: string;
|
|
469
|
+
opacity: number;
|
|
470
|
+
type: "dots" | "lines";
|
|
471
|
+
};
|
|
472
|
+
nodes: {};
|
|
473
|
+
nodeData: {};
|
|
474
|
+
connectors: any[];
|
|
475
|
+
connectorStyles: {
|
|
476
|
+
[x: string]: ConnectorStyle;
|
|
477
|
+
};
|
|
478
|
+
groups: any[];
|
|
479
|
+
images: any[];
|
|
480
|
+
exportZone: any;
|
|
481
|
+
};
|
|
482
|
+
editor: {
|
|
483
|
+
selectedNodeIds: any[];
|
|
484
|
+
selectedConnectorIndex: any;
|
|
485
|
+
selectedGroupId: any;
|
|
486
|
+
selectedImageId: any;
|
|
487
|
+
mode: string;
|
|
488
|
+
pendingConnector: any;
|
|
489
|
+
pendingGroup: any;
|
|
490
|
+
isDragging: boolean;
|
|
491
|
+
dragOffset: {
|
|
492
|
+
x: number;
|
|
493
|
+
y: number;
|
|
494
|
+
};
|
|
495
|
+
dragNodeOffsets: {};
|
|
496
|
+
template: string;
|
|
497
|
+
zoom: number;
|
|
498
|
+
viewMode: string;
|
|
499
|
+
themeId: any;
|
|
500
|
+
colorMode: string;
|
|
501
|
+
};
|
|
502
|
+
meta: {
|
|
503
|
+
filename: any;
|
|
504
|
+
isDirty: boolean;
|
|
505
|
+
lastSaved: any;
|
|
506
|
+
diagramMeta: {};
|
|
507
|
+
};
|
|
508
|
+
history: {
|
|
509
|
+
past: any[];
|
|
510
|
+
future: any[];
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
/** Preset HSL palettes matching Arc's diagram colors. */
|
|
515
|
+
export declare const ISO_COLORS: {
|
|
516
|
+
violet: IsoColorDef;
|
|
517
|
+
blue: IsoColorDef;
|
|
518
|
+
cyan: IsoColorDef;
|
|
519
|
+
emerald: IsoColorDef;
|
|
520
|
+
amber: IsoColorDef;
|
|
521
|
+
rose: IsoColorDef;
|
|
522
|
+
slate: IsoColorDef;
|
|
523
|
+
zinc: IsoColorDef;
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
/** Screen-space bounding box of an isometric box. */
|
|
527
|
+
export declare function isoBoundingBox(width: number, depth: number, height: number, originX?: number, originY?: number): IsoBoundingBoxResult;
|
|
528
|
+
|
|
529
|
+
/** Screen-space bounding box of an isometric box. */
|
|
530
|
+
declare interface IsoBoundingBoxResult {
|
|
531
|
+
minX: number;
|
|
532
|
+
minY: number;
|
|
533
|
+
maxX: number;
|
|
534
|
+
maxY: number;
|
|
535
|
+
width: number;
|
|
536
|
+
height: number;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/** SVG path strings for an isometric box (cuboid) with its visible faces. */
|
|
540
|
+
export declare function isoBox(width: number, depth: number, height: number, originX?: number, originY?: number, radius?: number): IsoBoxPaths;
|
|
541
|
+
|
|
542
|
+
/** The SVG paths that draw an isometric box: flat faces (path strings), rounded
|
|
543
|
+
* corners (arrays of shaded segments, empty when `radius` is 0), and outline. */
|
|
544
|
+
declare interface IsoBoxPaths {
|
|
545
|
+
top: string;
|
|
546
|
+
left: string;
|
|
547
|
+
right: string;
|
|
548
|
+
cornerFrontLeft: IsoBoxSegment[];
|
|
549
|
+
cornerFrontRight: IsoBoxSegment[];
|
|
550
|
+
cornerBackLeft: IsoBoxSegment[];
|
|
551
|
+
cornerBackRight: IsoBoxSegment[];
|
|
552
|
+
outline: string;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/** One shaded segment of a rounded box corner. */
|
|
556
|
+
declare interface IsoBoxSegment {
|
|
557
|
+
path: string;
|
|
558
|
+
intensity: number;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/** HSL preset for a named diagram color. */
|
|
562
|
+
declare interface IsoColorDef {
|
|
563
|
+
hue: number;
|
|
564
|
+
saturation: number;
|
|
565
|
+
lightness: number;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/** 2D screen point produced by the iso projection. */
|
|
569
|
+
declare interface IsoScreenPoint {
|
|
570
|
+
screenX: number;
|
|
571
|
+
screenY: number;
|
|
572
|
+
}
|
|
193
573
|
|
|
194
|
-
|
|
574
|
+
/** Standard iso face shading derived from a base HSL hue (or color name). */
|
|
575
|
+
export declare function isoShading(baseHue: number | string, saturation?: number, baseLightness?: number): IsoShadingResult;
|
|
195
576
|
|
|
196
|
-
|
|
577
|
+
/** Per-face shading colors (CSS color strings). */
|
|
578
|
+
declare interface IsoShadingResult {
|
|
579
|
+
top: string;
|
|
580
|
+
right: string;
|
|
581
|
+
left: string;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/** Convert 3D isometric coordinates to 2D screen coordinates. */
|
|
585
|
+
export declare function isoToScreen(x: number, y: number, z?: number): IsoScreenPoint;
|
|
586
|
+
|
|
587
|
+
declare type LabelAlign = 'left' | 'right' | 'center';
|
|
197
588
|
|
|
198
|
-
|
|
589
|
+
declare type LabelCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
199
590
|
|
|
200
|
-
|
|
591
|
+
declare interface LayoutOptions {
|
|
592
|
+
/** Horizontal gap between columns */
|
|
593
|
+
columnGap?: number;
|
|
594
|
+
/** Vertical gap between nodes within a column */
|
|
595
|
+
nodeGap?: number;
|
|
596
|
+
/** Vertical gap between wrapped rows */
|
|
597
|
+
rowGap?: number;
|
|
598
|
+
/** Padding around the entire diagram */
|
|
599
|
+
padding?: number;
|
|
600
|
+
}
|
|
201
601
|
|
|
202
|
-
|
|
602
|
+
/** List all saved diagram sessions, sorted by most recent */
|
|
603
|
+
export declare function listDiagramSessions(): Array<{
|
|
604
|
+
id: string;
|
|
605
|
+
name?: string;
|
|
606
|
+
updatedAt: number;
|
|
607
|
+
}>;
|
|
203
608
|
|
|
204
|
-
|
|
609
|
+
/** Load a diagram session from localStorage */
|
|
610
|
+
export declare function loadDiagramSession(id: string): DiagramSession | null;
|
|
611
|
+
|
|
612
|
+
declare interface NodeData {
|
|
613
|
+
icon: string;
|
|
614
|
+
name: string;
|
|
615
|
+
subtitle?: string;
|
|
616
|
+
description?: string;
|
|
617
|
+
color: DiagramColor_2;
|
|
618
|
+
}
|
|
205
619
|
|
|
206
620
|
export declare interface NodePosition {
|
|
207
621
|
x: number;
|
|
208
622
|
y: number;
|
|
209
|
-
size:
|
|
623
|
+
size: NodeSize_3;
|
|
210
624
|
width?: number;
|
|
211
625
|
height?: number;
|
|
212
626
|
z?: number;
|
|
@@ -214,27 +628,118 @@ export declare interface NodePosition {
|
|
|
214
628
|
isoDepth?: number;
|
|
215
629
|
}
|
|
216
630
|
|
|
217
|
-
|
|
631
|
+
declare interface NodePosition_2 {
|
|
632
|
+
x: number;
|
|
633
|
+
y: number;
|
|
634
|
+
size: NodeSize_2;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
export declare type NodeSize = 'xs' | 's' | 'm' | 'l';
|
|
218
638
|
|
|
219
|
-
declare type NodeSize_2 = '
|
|
639
|
+
declare type NodeSize_2 = 's' | 'm' | 'l';
|
|
220
640
|
|
|
221
|
-
|
|
641
|
+
declare type NodeSize_3 = 'large' | 'normal' | 'small';
|
|
222
642
|
|
|
223
|
-
|
|
643
|
+
/**
|
|
644
|
+
* Parse YAML config into DiagramConfig
|
|
645
|
+
*
|
|
646
|
+
* Supported format:
|
|
647
|
+
* ```yaml
|
|
648
|
+
* title: Data Platform
|
|
649
|
+
* description: Domain-driven architecture
|
|
650
|
+
* theme: light
|
|
651
|
+
* canvas: 1100x720
|
|
652
|
+
* floor: 460x280
|
|
653
|
+
* corner: 14
|
|
654
|
+
*
|
|
655
|
+
* colors:
|
|
656
|
+
* db: &db blue
|
|
657
|
+
* svc: &svc violet
|
|
658
|
+
*
|
|
659
|
+
* tiers:
|
|
660
|
+
* - Data @ 0
|
|
661
|
+
* - Services @ 150
|
|
662
|
+
* - Domains @ 300
|
|
663
|
+
*
|
|
664
|
+
* nodes:
|
|
665
|
+
* 0: # Tier 0
|
|
666
|
+
* - SQL *db 25,25 120x90x34
|
|
667
|
+
* - NoSQL *db 165,25 120x90x34
|
|
668
|
+
* 1: # Tier 1
|
|
669
|
+
* - Ingest *svc 20,20 100x80x40 { opacity=0.8 }
|
|
670
|
+
* ```
|
|
671
|
+
*/
|
|
672
|
+
export declare function parseYamlConfig(yamlStr: string): DiagramConfig_2;
|
|
673
|
+
|
|
674
|
+
declare interface PlayerOptions {
|
|
675
|
+
/** Enable hover effects */
|
|
676
|
+
interactive?: boolean;
|
|
677
|
+
/** Enable zoom/pan */
|
|
678
|
+
zoomable?: boolean;
|
|
679
|
+
/** Show tier labels */
|
|
680
|
+
showLabels?: boolean;
|
|
681
|
+
/** Animation on load */
|
|
682
|
+
animate?: boolean;
|
|
683
|
+
/** On hover, lift the hovered layer out of the stack (default: true when interactive) */
|
|
684
|
+
expandOnHover?: boolean;
|
|
685
|
+
}
|
|
224
686
|
|
|
225
|
-
export
|
|
687
|
+
export declare function renderAscii(data: ArcDiagramData, options?: AsciiOptions): string;
|
|
226
688
|
|
|
227
|
-
|
|
689
|
+
/**
|
|
690
|
+
* Render diagram to a DOM element
|
|
691
|
+
*/
|
|
692
|
+
export declare function renderToElement(container: HTMLElement, config: DiagramConfig): void;
|
|
228
693
|
|
|
229
|
-
|
|
694
|
+
/**
|
|
695
|
+
* Render diagram to SVG string (for SSR or static export)
|
|
696
|
+
*/
|
|
697
|
+
export declare function renderToString(config: DiagramConfig): string;
|
|
230
698
|
|
|
231
|
-
|
|
699
|
+
/** Save a diagram session to localStorage */
|
|
700
|
+
export declare function saveDiagramSession(id: string, data: Omit<DiagramSession, 'updatedAt'>): void;
|
|
232
701
|
|
|
233
|
-
|
|
702
|
+
/** Convert 2D screen coordinates to the isometric floor position (z = 0). */
|
|
703
|
+
export declare function screenToIsoFloor(screenX: number, screenY: number): { x: number; y: number };
|
|
234
704
|
|
|
235
|
-
export
|
|
705
|
+
export declare interface Theme {
|
|
706
|
+
id: ThemeId;
|
|
707
|
+
name: string;
|
|
708
|
+
description: string;
|
|
709
|
+
light: {
|
|
710
|
+
palette: ColorPalette;
|
|
711
|
+
background: ThemeBackground;
|
|
712
|
+
text: {
|
|
713
|
+
primary: string;
|
|
714
|
+
secondary: string;
|
|
715
|
+
muted: string;
|
|
716
|
+
};
|
|
717
|
+
};
|
|
718
|
+
dark: {
|
|
719
|
+
palette: ColorPalette;
|
|
720
|
+
background: ThemeBackground;
|
|
721
|
+
text: {
|
|
722
|
+
primary: string;
|
|
723
|
+
secondary: string;
|
|
724
|
+
muted: string;
|
|
725
|
+
};
|
|
726
|
+
};
|
|
727
|
+
/** Optional brand design language (typography, node shape, arrows). */
|
|
728
|
+
brand?: BrandSpec;
|
|
729
|
+
}
|
|
236
730
|
|
|
237
|
-
|
|
731
|
+
declare interface ThemeBackground {
|
|
732
|
+
container: string;
|
|
733
|
+
grid: {
|
|
734
|
+
color: string;
|
|
735
|
+
opacity: number;
|
|
736
|
+
size: number;
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
export declare type ThemeId = 'default' | 'warm' | 'cool' | 'mono' | 'engineering' | 'workbench' | 'tactical';
|
|
741
|
+
|
|
742
|
+
export declare const THEMES: Record<ThemeId, Theme>;
|
|
238
743
|
|
|
239
744
|
/**
|
|
240
745
|
* Arc Isometric Types
|
|
@@ -247,24 +752,110 @@ export declare interface TierConfig {
|
|
|
247
752
|
borderColor?: string;
|
|
248
753
|
nodeOpacity?: number;
|
|
249
754
|
blur?: number;
|
|
755
|
+
/** Projected (screen-space) offset applied to the whole layer AFTER isometric projection.
|
|
756
|
+
* Staggers layers in the picture plane — e.g. { x: 0, y: -40 } lifts a layer up the projected
|
|
757
|
+
* Y axis; { x: -60, y: 0 } pushes one left on −X. Purely declarative; default = no offset. */
|
|
758
|
+
offset?: {
|
|
759
|
+
x: number;
|
|
760
|
+
y: number;
|
|
761
|
+
};
|
|
250
762
|
}
|
|
251
763
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
764
|
+
declare interface TierConfig_2 {
|
|
765
|
+
name: string;
|
|
766
|
+
elevation: number;
|
|
767
|
+
floorColor?: string;
|
|
768
|
+
floorOpacity?: number;
|
|
769
|
+
borderColor?: string;
|
|
770
|
+
nodeOpacity?: number;
|
|
771
|
+
blur?: number;
|
|
772
|
+
}
|
|
257
773
|
|
|
258
|
-
|
|
774
|
+
/** Content for the engineering-drawing title block (Engineering theme). */
|
|
775
|
+
declare interface TitleBlockInfo {
|
|
776
|
+
/** Project / drawing title shown in the top strip. */
|
|
777
|
+
title?: string;
|
|
778
|
+
/** Drawing number. Defaults to the diagram label (data.id). */
|
|
779
|
+
drawing?: string;
|
|
780
|
+
/** Scale field. Default 'NTS'. */
|
|
781
|
+
scale?: string;
|
|
782
|
+
/** Revision field. Default 'A'. */
|
|
783
|
+
rev?: string;
|
|
784
|
+
/** Sheet field. Default '1 / 1'. */
|
|
785
|
+
sheet?: string;
|
|
786
|
+
}
|
|
259
787
|
|
|
260
|
-
export
|
|
788
|
+
export declare function useColorMode(): string;
|
|
261
789
|
|
|
262
|
-
export
|
|
790
|
+
export declare function useDiagram(): {
|
|
791
|
+
layout: {
|
|
792
|
+
width: number;
|
|
793
|
+
height: number;
|
|
794
|
+
};
|
|
795
|
+
grid: {
|
|
796
|
+
enabled: boolean;
|
|
797
|
+
size: number;
|
|
798
|
+
color: string;
|
|
799
|
+
opacity: number;
|
|
800
|
+
type: "dots" | "lines";
|
|
801
|
+
};
|
|
802
|
+
nodes: {};
|
|
803
|
+
nodeData: {};
|
|
804
|
+
connectors: any[];
|
|
805
|
+
connectorStyles: {
|
|
806
|
+
[x: string]: ConnectorStyle;
|
|
807
|
+
};
|
|
808
|
+
groups: any[];
|
|
809
|
+
images: any[];
|
|
810
|
+
exportZone: any;
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
export declare function useDiagramMeta(): {};
|
|
814
|
+
|
|
815
|
+
export declare function useEditor(): EditorContextType;
|
|
816
|
+
|
|
817
|
+
export declare function useEditorState(): {
|
|
818
|
+
selectedNodeIds: any[];
|
|
819
|
+
selectedConnectorIndex: any;
|
|
820
|
+
selectedGroupId: any;
|
|
821
|
+
selectedImageId: any;
|
|
822
|
+
mode: string;
|
|
823
|
+
pendingConnector: any;
|
|
824
|
+
pendingGroup: any;
|
|
825
|
+
isDragging: boolean;
|
|
826
|
+
dragOffset: {
|
|
827
|
+
x: number;
|
|
828
|
+
y: number;
|
|
829
|
+
};
|
|
830
|
+
dragNodeOffsets: {};
|
|
831
|
+
template: string;
|
|
832
|
+
zoom: number;
|
|
833
|
+
viewMode: string;
|
|
834
|
+
themeId: any;
|
|
835
|
+
colorMode: string;
|
|
836
|
+
};
|
|
837
|
+
|
|
838
|
+
/** Returns the resolved theme palette (light or dark) for the current theme and color mode. */
|
|
839
|
+
export declare function useResolvedTheme(): {
|
|
840
|
+
palette: ColorPalette;
|
|
841
|
+
background: ThemeBackground;
|
|
842
|
+
text: {
|
|
843
|
+
primary: string;
|
|
844
|
+
secondary: string;
|
|
845
|
+
muted: string;
|
|
846
|
+
};
|
|
847
|
+
};
|
|
263
848
|
|
|
264
|
-
export
|
|
849
|
+
export declare function useThemeId(): any;
|
|
265
850
|
|
|
266
|
-
export
|
|
851
|
+
export declare function useViewMode(): string;
|
|
267
852
|
|
|
268
853
|
export declare type ViewMode = '2d' | 'isometric';
|
|
269
854
|
|
|
855
|
+
declare interface ZoomConfig {
|
|
856
|
+
defaultZoom?: number | 'fit';
|
|
857
|
+
zoomLevels?: number[];
|
|
858
|
+
zoomStep?: number;
|
|
859
|
+
}
|
|
860
|
+
|
|
270
861
|
export { }
|