@arach/arc 0.4.2 → 0.4.4
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 +82 -10
- package/lib/arc.es.js +38 -32804
- package/lib/arc.umd.js +276 -145
- package/lib/index.d.ts +713 -111
- package/package.json +8 -3
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,125 @@ 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
|
+
/** Node silhouette when nodeRadius is not set explicitly. */
|
|
167
|
+
nodeShape?: 'rounded' | 'square' | 'chamfer' | 'pill';
|
|
168
|
+
/** Overall node opacity (0–1). */
|
|
169
|
+
nodeOpacity?: number;
|
|
170
|
+
/** Frosted glass backdrop on nodes. */
|
|
171
|
+
nodeGlass?: boolean;
|
|
172
|
+
/** Colored accent stripe on the node shell. */
|
|
173
|
+
accentBar?: 'left' | 'top' | 'none';
|
|
174
|
+
/** Soft bloom on connector strokes. */
|
|
175
|
+
connectorGlow?: boolean;
|
|
176
|
+
}
|
|
84
177
|
|
|
85
|
-
export
|
|
178
|
+
export declare interface ColorPalette {
|
|
179
|
+
violet: {
|
|
180
|
+
border: string;
|
|
181
|
+
bg: string;
|
|
182
|
+
icon: string;
|
|
183
|
+
stroke: string;
|
|
184
|
+
};
|
|
185
|
+
emerald: {
|
|
186
|
+
border: string;
|
|
187
|
+
bg: string;
|
|
188
|
+
icon: string;
|
|
189
|
+
stroke: string;
|
|
190
|
+
};
|
|
191
|
+
blue: {
|
|
192
|
+
border: string;
|
|
193
|
+
bg: string;
|
|
194
|
+
icon: string;
|
|
195
|
+
stroke: string;
|
|
196
|
+
};
|
|
197
|
+
amber: {
|
|
198
|
+
border: string;
|
|
199
|
+
bg: string;
|
|
200
|
+
icon: string;
|
|
201
|
+
stroke: string;
|
|
202
|
+
};
|
|
203
|
+
sky: {
|
|
204
|
+
border: string;
|
|
205
|
+
bg: string;
|
|
206
|
+
icon: string;
|
|
207
|
+
stroke: string;
|
|
208
|
+
};
|
|
209
|
+
zinc: {
|
|
210
|
+
border: string;
|
|
211
|
+
bg: string;
|
|
212
|
+
icon: string;
|
|
213
|
+
stroke: string;
|
|
214
|
+
};
|
|
215
|
+
rose: {
|
|
216
|
+
border: string;
|
|
217
|
+
bg: string;
|
|
218
|
+
icon: string;
|
|
219
|
+
stroke: string;
|
|
220
|
+
};
|
|
221
|
+
orange: {
|
|
222
|
+
border: string;
|
|
223
|
+
bg: string;
|
|
224
|
+
icon: string;
|
|
225
|
+
stroke: string;
|
|
226
|
+
};
|
|
227
|
+
}
|
|
86
228
|
|
|
87
|
-
|
|
229
|
+
/**
|
|
230
|
+
* Convert a DiagramConfig back to YAML string
|
|
231
|
+
*/
|
|
232
|
+
export declare function configToYaml(config: DiagramConfig_2): string;
|
|
233
|
+
|
|
234
|
+
declare interface Connector {
|
|
235
|
+
from: string;
|
|
236
|
+
to: string;
|
|
237
|
+
fromAnchor: AnchorPosition_2;
|
|
238
|
+
toAnchor: AnchorPosition_2;
|
|
239
|
+
style: string;
|
|
240
|
+
curve?: 'natural' | 'step';
|
|
241
|
+
}
|
|
88
242
|
|
|
89
243
|
export declare interface ConnectorStyle {
|
|
90
244
|
color: string;
|
|
@@ -97,15 +251,40 @@ export declare interface ConnectorStyle {
|
|
|
97
251
|
showEndpoints?: boolean;
|
|
98
252
|
}
|
|
99
253
|
|
|
100
|
-
|
|
254
|
+
declare interface ConnectorStyle_2 {
|
|
255
|
+
color: DiagramColor_2;
|
|
256
|
+
strokeWidth: number;
|
|
257
|
+
label?: string;
|
|
258
|
+
dashed?: boolean;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export declare function createAutoLayout(input: AutoDiagramInput): ArcDiagramData_2;
|
|
101
262
|
|
|
102
|
-
|
|
263
|
+
/** Delete a diagram session */
|
|
264
|
+
export declare function deleteDiagramSession(id: string): void;
|
|
103
265
|
|
|
104
|
-
|
|
266
|
+
/** Derive a URL-safe session ID from a diagram's source path or ID */
|
|
267
|
+
export declare function deriveSessionId(source: string): string;
|
|
105
268
|
|
|
106
|
-
export
|
|
269
|
+
export declare function DiagramCanvas({ onViewportChange, embedConfig, zoomConfig, themeOverride, isDark }: DiagramCanvasProps): JSX.Element;
|
|
107
270
|
|
|
108
|
-
|
|
271
|
+
declare interface DiagramCanvasProps {
|
|
272
|
+
onViewportChange?: (bounds: {
|
|
273
|
+
x: number;
|
|
274
|
+
y: number;
|
|
275
|
+
width: number;
|
|
276
|
+
height: number;
|
|
277
|
+
}) => void;
|
|
278
|
+
embedConfig?: EmbedConfig;
|
|
279
|
+
zoomConfig?: ZoomConfig;
|
|
280
|
+
/** Override canvas background with an Arc theme. */
|
|
281
|
+
themeOverride?: string;
|
|
282
|
+
isDark?: boolean;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export declare type DiagramColor = 'violet' | 'emerald' | 'blue' | 'amber' | 'sky' | 'zinc' | 'rose' | 'orange';
|
|
286
|
+
|
|
287
|
+
declare type DiagramColor_2 = 'violet' | 'emerald' | 'blue' | 'amber' | 'sky' | 'zinc' | 'rose' | 'orange';
|
|
109
288
|
|
|
110
289
|
export declare interface DiagramConfig {
|
|
111
290
|
id?: string;
|
|
@@ -135,9 +314,50 @@ export declare interface DiagramConfig {
|
|
|
135
314
|
}[];
|
|
136
315
|
}
|
|
137
316
|
|
|
138
|
-
|
|
317
|
+
declare interface DiagramConfig_2 {
|
|
318
|
+
title: string;
|
|
319
|
+
description: string;
|
|
320
|
+
theme: 'dark' | 'light';
|
|
321
|
+
canvas: {
|
|
322
|
+
width: number;
|
|
323
|
+
height: number;
|
|
324
|
+
};
|
|
325
|
+
origin: {
|
|
326
|
+
x: number;
|
|
327
|
+
y: number;
|
|
328
|
+
};
|
|
329
|
+
cornerRadius?: number;
|
|
330
|
+
tiers: TierConfig_2[];
|
|
331
|
+
floorSize: {
|
|
332
|
+
width: number;
|
|
333
|
+
depth: number;
|
|
334
|
+
};
|
|
335
|
+
nodes: DiagramNode_2[];
|
|
336
|
+
pillars?: {
|
|
337
|
+
x: number;
|
|
338
|
+
y: number;
|
|
339
|
+
fromTier: number;
|
|
340
|
+
toTier: number;
|
|
341
|
+
}[];
|
|
342
|
+
}
|
|
139
343
|
|
|
140
|
-
export {
|
|
344
|
+
export declare function DiagramEditor({ initialData, themeId, colorMode, sessionId, initialDiagramMeta, }: {
|
|
345
|
+
initialData?: any;
|
|
346
|
+
themeId?: string | null;
|
|
347
|
+
colorMode?: 'light' | 'dark';
|
|
348
|
+
sessionId?: string | null;
|
|
349
|
+
initialDiagramMeta?: Record<string, any>;
|
|
350
|
+
}): JSX.Element;
|
|
351
|
+
|
|
352
|
+
export declare interface DiagramLayout {
|
|
353
|
+
width: number;
|
|
354
|
+
height: number;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
declare interface DiagramLayout_2 {
|
|
358
|
+
width: number;
|
|
359
|
+
height: number;
|
|
360
|
+
}
|
|
141
361
|
|
|
142
362
|
export declare interface DiagramMeta {
|
|
143
363
|
themeId?: string | null;
|
|
@@ -149,7 +369,7 @@ export declare interface DiagramMeta {
|
|
|
149
369
|
sourceUrl?: string;
|
|
150
370
|
}
|
|
151
371
|
|
|
152
|
-
export
|
|
372
|
+
export declare type DiagramMode = 'dark' | 'light';
|
|
153
373
|
|
|
154
374
|
export declare interface DiagramNode {
|
|
155
375
|
tier: number;
|
|
@@ -163,11 +383,47 @@ export declare interface DiagramNode {
|
|
|
163
383
|
opacity?: number;
|
|
164
384
|
blur?: number;
|
|
165
385
|
translucent?: boolean;
|
|
386
|
+
/** Optional link target; clicking the node surfaces this (declarative click hook). */
|
|
387
|
+
link?: string;
|
|
166
388
|
}
|
|
167
389
|
|
|
168
|
-
|
|
390
|
+
declare interface DiagramNode_2 {
|
|
391
|
+
tier: number;
|
|
392
|
+
x: number;
|
|
393
|
+
y: number;
|
|
394
|
+
width: number;
|
|
395
|
+
depth: number;
|
|
396
|
+
height: number;
|
|
397
|
+
color: string;
|
|
398
|
+
label: string;
|
|
399
|
+
opacity?: number;
|
|
400
|
+
blur?: number;
|
|
401
|
+
translucent?: boolean;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export declare interface DiagramSession {
|
|
405
|
+
diagram: any;
|
|
406
|
+
themeId: string | null;
|
|
407
|
+
colorMode: 'light' | 'dark';
|
|
408
|
+
diagramMeta: Record<string, any>;
|
|
409
|
+
updatedAt: number;
|
|
410
|
+
name?: string;
|
|
411
|
+
originalDiagram?: any;
|
|
412
|
+
}
|
|
169
413
|
|
|
170
|
-
|
|
414
|
+
declare interface EditorContextType {
|
|
415
|
+
state: typeof initialState;
|
|
416
|
+
dispatch: React.Dispatch<any>;
|
|
417
|
+
actions: Record<string, (...args: any[]) => void>;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export declare function EditorProvider({ children, initialDiagram, initialThemeId, initialColorMode, initialDiagramMeta }: {
|
|
421
|
+
children: React.ReactNode;
|
|
422
|
+
initialDiagram?: any;
|
|
423
|
+
initialThemeId?: string | null;
|
|
424
|
+
initialColorMode?: 'light' | 'dark';
|
|
425
|
+
initialDiagramMeta?: Record<string, any>;
|
|
426
|
+
}): JSX.Element;
|
|
171
427
|
|
|
172
428
|
export declare interface EmbedConfig {
|
|
173
429
|
defaultViewMode?: ViewMode;
|
|
@@ -181,32 +437,198 @@ export declare interface EmbedConfig {
|
|
|
181
437
|
showGrid?: boolean;
|
|
182
438
|
}
|
|
183
439
|
|
|
184
|
-
|
|
440
|
+
/** Generate a short session ID (first 8 hex chars of a UUID for brevity in URLs) */
|
|
441
|
+
export declare function generateSessionId(): string;
|
|
185
442
|
|
|
186
|
-
|
|
443
|
+
/** Shading for a named preset color (falls back to `slate` when unknown). */
|
|
444
|
+
export declare function getColorShading(colorName: string): IsoShadingResult;
|
|
187
445
|
|
|
188
|
-
export
|
|
446
|
+
export declare function getTheme(id: ThemeId): Theme;
|
|
189
447
|
|
|
190
|
-
export
|
|
448
|
+
export declare function getThemeList(): {
|
|
449
|
+
id: ThemeId;
|
|
450
|
+
name: string;
|
|
451
|
+
description: string;
|
|
452
|
+
}[];
|
|
453
|
+
|
|
454
|
+
declare interface HoverEffectsConfig {
|
|
455
|
+
/** Dim unrelated nodes/connectors. Default: true */
|
|
456
|
+
dim?: boolean;
|
|
457
|
+
/** 0–1 opacity for dimmed nodes. Connectors dim to ~56% of this. Default: 0.45 */
|
|
458
|
+
dimOpacity?: number;
|
|
459
|
+
/** Lift hovered node up 2px. Default: true */
|
|
460
|
+
lift?: boolean;
|
|
461
|
+
/** Colored glow shadow on hover. Default: true */
|
|
462
|
+
glow?: boolean;
|
|
463
|
+
/** Thicken connected edges. Default: true */
|
|
464
|
+
highlightEdges?: boolean;
|
|
465
|
+
}
|
|
191
466
|
|
|
192
|
-
|
|
467
|
+
declare const initialState: {
|
|
468
|
+
diagram: {
|
|
469
|
+
layout: {
|
|
470
|
+
width: number;
|
|
471
|
+
height: number;
|
|
472
|
+
};
|
|
473
|
+
grid: {
|
|
474
|
+
enabled: boolean;
|
|
475
|
+
size: number;
|
|
476
|
+
color: string;
|
|
477
|
+
opacity: number;
|
|
478
|
+
type: "dots" | "lines";
|
|
479
|
+
};
|
|
480
|
+
nodes: {};
|
|
481
|
+
nodeData: {};
|
|
482
|
+
connectors: any[];
|
|
483
|
+
connectorStyles: {
|
|
484
|
+
[x: string]: ConnectorStyle;
|
|
485
|
+
};
|
|
486
|
+
groups: any[];
|
|
487
|
+
images: any[];
|
|
488
|
+
exportZone: any;
|
|
489
|
+
};
|
|
490
|
+
editor: {
|
|
491
|
+
selectedNodeIds: any[];
|
|
492
|
+
selectedConnectorIndex: any;
|
|
493
|
+
selectedGroupId: any;
|
|
494
|
+
selectedImageId: any;
|
|
495
|
+
mode: string;
|
|
496
|
+
pendingConnector: any;
|
|
497
|
+
pendingGroup: any;
|
|
498
|
+
isDragging: boolean;
|
|
499
|
+
dragOffset: {
|
|
500
|
+
x: number;
|
|
501
|
+
y: number;
|
|
502
|
+
};
|
|
503
|
+
dragNodeOffsets: {};
|
|
504
|
+
template: string;
|
|
505
|
+
zoom: number;
|
|
506
|
+
viewMode: string;
|
|
507
|
+
themeId: string;
|
|
508
|
+
colorMode: string;
|
|
509
|
+
};
|
|
510
|
+
meta: {
|
|
511
|
+
filename: any;
|
|
512
|
+
isDirty: boolean;
|
|
513
|
+
lastSaved: any;
|
|
514
|
+
diagramMeta: {};
|
|
515
|
+
};
|
|
516
|
+
history: {
|
|
517
|
+
past: any[];
|
|
518
|
+
future: any[];
|
|
519
|
+
};
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
/** Preset HSL palettes matching Arc's diagram colors. */
|
|
523
|
+
export declare const ISO_COLORS: {
|
|
524
|
+
violet: IsoColorDef;
|
|
525
|
+
blue: IsoColorDef;
|
|
526
|
+
cyan: IsoColorDef;
|
|
527
|
+
emerald: IsoColorDef;
|
|
528
|
+
amber: IsoColorDef;
|
|
529
|
+
rose: IsoColorDef;
|
|
530
|
+
slate: IsoColorDef;
|
|
531
|
+
zinc: IsoColorDef;
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
/** Screen-space bounding box of an isometric box. */
|
|
535
|
+
export declare function isoBoundingBox(width: number, depth: number, height: number, originX?: number, originY?: number): IsoBoundingBoxResult;
|
|
536
|
+
|
|
537
|
+
/** Screen-space bounding box of an isometric box. */
|
|
538
|
+
declare interface IsoBoundingBoxResult {
|
|
539
|
+
minX: number;
|
|
540
|
+
minY: number;
|
|
541
|
+
maxX: number;
|
|
542
|
+
maxY: number;
|
|
543
|
+
width: number;
|
|
544
|
+
height: number;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/** SVG path strings for an isometric box (cuboid) with its visible faces. */
|
|
548
|
+
export declare function isoBox(width: number, depth: number, height: number, originX?: number, originY?: number, radius?: number): IsoBoxPaths;
|
|
549
|
+
|
|
550
|
+
/** The SVG paths that draw an isometric box: flat faces (path strings), rounded
|
|
551
|
+
* corners (arrays of shaded segments, empty when `radius` is 0), and outline. */
|
|
552
|
+
declare interface IsoBoxPaths {
|
|
553
|
+
top: string;
|
|
554
|
+
left: string;
|
|
555
|
+
right: string;
|
|
556
|
+
cornerFrontLeft: IsoBoxSegment[];
|
|
557
|
+
cornerFrontRight: IsoBoxSegment[];
|
|
558
|
+
cornerBackLeft: IsoBoxSegment[];
|
|
559
|
+
cornerBackRight: IsoBoxSegment[];
|
|
560
|
+
outline: string;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/** One shaded segment of a rounded box corner. */
|
|
564
|
+
declare interface IsoBoxSegment {
|
|
565
|
+
path: string;
|
|
566
|
+
intensity: number;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/** HSL preset for a named diagram color. */
|
|
570
|
+
declare interface IsoColorDef {
|
|
571
|
+
hue: number;
|
|
572
|
+
saturation: number;
|
|
573
|
+
lightness: number;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/** 2D screen point produced by the iso projection. */
|
|
577
|
+
declare interface IsoScreenPoint {
|
|
578
|
+
screenX: number;
|
|
579
|
+
screenY: number;
|
|
580
|
+
}
|
|
193
581
|
|
|
194
|
-
|
|
582
|
+
/** Standard iso face shading derived from a base HSL hue (or color name). */
|
|
583
|
+
export declare function isoShading(baseHue: number | string, saturation?: number, baseLightness?: number): IsoShadingResult;
|
|
195
584
|
|
|
196
|
-
|
|
585
|
+
/** Per-face shading colors (CSS color strings). */
|
|
586
|
+
declare interface IsoShadingResult {
|
|
587
|
+
top: string;
|
|
588
|
+
right: string;
|
|
589
|
+
left: string;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/** Convert 3D isometric coordinates to 2D screen coordinates. */
|
|
593
|
+
export declare function isoToScreen(x: number, y: number, z?: number): IsoScreenPoint;
|
|
594
|
+
|
|
595
|
+
declare type LabelAlign = 'left' | 'right' | 'center';
|
|
197
596
|
|
|
198
|
-
|
|
597
|
+
declare type LabelCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
199
598
|
|
|
200
|
-
|
|
599
|
+
declare interface LayoutOptions {
|
|
600
|
+
/** Horizontal gap between columns */
|
|
601
|
+
columnGap?: number;
|
|
602
|
+
/** Vertical gap between nodes within a column */
|
|
603
|
+
nodeGap?: number;
|
|
604
|
+
/** Vertical gap between wrapped rows */
|
|
605
|
+
rowGap?: number;
|
|
606
|
+
/** Padding around the entire diagram */
|
|
607
|
+
padding?: number;
|
|
608
|
+
}
|
|
201
609
|
|
|
202
|
-
|
|
610
|
+
/** List all saved diagram sessions, sorted by most recent */
|
|
611
|
+
export declare function listDiagramSessions(): Array<{
|
|
612
|
+
id: string;
|
|
613
|
+
name?: string;
|
|
614
|
+
updatedAt: number;
|
|
615
|
+
}>;
|
|
203
616
|
|
|
204
|
-
|
|
617
|
+
/** Load a diagram session from localStorage */
|
|
618
|
+
export declare function loadDiagramSession(id: string): DiagramSession | null;
|
|
619
|
+
|
|
620
|
+
declare interface NodeData {
|
|
621
|
+
icon: string;
|
|
622
|
+
name: string;
|
|
623
|
+
subtitle?: string;
|
|
624
|
+
description?: string;
|
|
625
|
+
color: DiagramColor_2;
|
|
626
|
+
}
|
|
205
627
|
|
|
206
628
|
export declare interface NodePosition {
|
|
207
629
|
x: number;
|
|
208
630
|
y: number;
|
|
209
|
-
size:
|
|
631
|
+
size: NodeSize_3;
|
|
210
632
|
width?: number;
|
|
211
633
|
height?: number;
|
|
212
634
|
z?: number;
|
|
@@ -214,27 +636,118 @@ export declare interface NodePosition {
|
|
|
214
636
|
isoDepth?: number;
|
|
215
637
|
}
|
|
216
638
|
|
|
217
|
-
|
|
639
|
+
declare interface NodePosition_2 {
|
|
640
|
+
x: number;
|
|
641
|
+
y: number;
|
|
642
|
+
size: NodeSize_2;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export declare type NodeSize = 'xs' | 's' | 'm' | 'l';
|
|
218
646
|
|
|
219
|
-
declare type NodeSize_2 = '
|
|
647
|
+
declare type NodeSize_2 = 's' | 'm' | 'l';
|
|
220
648
|
|
|
221
|
-
|
|
649
|
+
declare type NodeSize_3 = 'large' | 'normal' | 'small';
|
|
222
650
|
|
|
223
|
-
|
|
651
|
+
/**
|
|
652
|
+
* Parse YAML config into DiagramConfig
|
|
653
|
+
*
|
|
654
|
+
* Supported format:
|
|
655
|
+
* ```yaml
|
|
656
|
+
* title: Data Platform
|
|
657
|
+
* description: Domain-driven architecture
|
|
658
|
+
* theme: light
|
|
659
|
+
* canvas: 1100x720
|
|
660
|
+
* floor: 460x280
|
|
661
|
+
* corner: 14
|
|
662
|
+
*
|
|
663
|
+
* colors:
|
|
664
|
+
* db: &db blue
|
|
665
|
+
* svc: &svc violet
|
|
666
|
+
*
|
|
667
|
+
* tiers:
|
|
668
|
+
* - Data @ 0
|
|
669
|
+
* - Services @ 150
|
|
670
|
+
* - Domains @ 300
|
|
671
|
+
*
|
|
672
|
+
* nodes:
|
|
673
|
+
* 0: # Tier 0
|
|
674
|
+
* - SQL *db 25,25 120x90x34
|
|
675
|
+
* - NoSQL *db 165,25 120x90x34
|
|
676
|
+
* 1: # Tier 1
|
|
677
|
+
* - Ingest *svc 20,20 100x80x40 { opacity=0.8 }
|
|
678
|
+
* ```
|
|
679
|
+
*/
|
|
680
|
+
export declare function parseYamlConfig(yamlStr: string): DiagramConfig_2;
|
|
681
|
+
|
|
682
|
+
declare interface PlayerOptions {
|
|
683
|
+
/** Enable hover effects */
|
|
684
|
+
interactive?: boolean;
|
|
685
|
+
/** Enable zoom/pan */
|
|
686
|
+
zoomable?: boolean;
|
|
687
|
+
/** Show tier labels */
|
|
688
|
+
showLabels?: boolean;
|
|
689
|
+
/** Animation on load */
|
|
690
|
+
animate?: boolean;
|
|
691
|
+
/** On hover, lift the hovered layer out of the stack (default: true when interactive) */
|
|
692
|
+
expandOnHover?: boolean;
|
|
693
|
+
}
|
|
224
694
|
|
|
225
|
-
export
|
|
695
|
+
export declare function renderAscii(data: ArcDiagramData, options?: AsciiOptions): string;
|
|
226
696
|
|
|
227
|
-
|
|
697
|
+
/**
|
|
698
|
+
* Render diagram to a DOM element
|
|
699
|
+
*/
|
|
700
|
+
export declare function renderToElement(container: HTMLElement, config: DiagramConfig): void;
|
|
228
701
|
|
|
229
|
-
|
|
702
|
+
/**
|
|
703
|
+
* Render diagram to SVG string (for SSR or static export)
|
|
704
|
+
*/
|
|
705
|
+
export declare function renderToString(config: DiagramConfig): string;
|
|
230
706
|
|
|
231
|
-
|
|
707
|
+
/** Save a diagram session to localStorage */
|
|
708
|
+
export declare function saveDiagramSession(id: string, data: Omit<DiagramSession, 'updatedAt'>): void;
|
|
232
709
|
|
|
233
|
-
|
|
710
|
+
/** Convert 2D screen coordinates to the isometric floor position (z = 0). */
|
|
711
|
+
export declare function screenToIsoFloor(screenX: number, screenY: number): { x: number; y: number };
|
|
234
712
|
|
|
235
|
-
export
|
|
713
|
+
export declare interface Theme {
|
|
714
|
+
id: ThemeId;
|
|
715
|
+
name: string;
|
|
716
|
+
description: string;
|
|
717
|
+
light: {
|
|
718
|
+
palette: ColorPalette;
|
|
719
|
+
background: ThemeBackground;
|
|
720
|
+
text: {
|
|
721
|
+
primary: string;
|
|
722
|
+
secondary: string;
|
|
723
|
+
muted: string;
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
dark: {
|
|
727
|
+
palette: ColorPalette;
|
|
728
|
+
background: ThemeBackground;
|
|
729
|
+
text: {
|
|
730
|
+
primary: string;
|
|
731
|
+
secondary: string;
|
|
732
|
+
muted: string;
|
|
733
|
+
};
|
|
734
|
+
};
|
|
735
|
+
/** Optional brand design language (typography, node shape, arrows). */
|
|
736
|
+
brand?: BrandSpec;
|
|
737
|
+
}
|
|
236
738
|
|
|
237
|
-
|
|
739
|
+
declare interface ThemeBackground {
|
|
740
|
+
container: string;
|
|
741
|
+
grid: {
|
|
742
|
+
color: string;
|
|
743
|
+
opacity: number;
|
|
744
|
+
size: number;
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
export declare type ThemeId = 'default' | 'warm' | 'cool' | 'mono' | 'engineering' | 'workbench' | 'tactical' | 'command';
|
|
749
|
+
|
|
750
|
+
export declare const THEMES: Record<ThemeId, Theme>;
|
|
238
751
|
|
|
239
752
|
/**
|
|
240
753
|
* Arc Isometric Types
|
|
@@ -247,24 +760,113 @@ export declare interface TierConfig {
|
|
|
247
760
|
borderColor?: string;
|
|
248
761
|
nodeOpacity?: number;
|
|
249
762
|
blur?: number;
|
|
763
|
+
/** Projected (screen-space) offset applied to the whole layer AFTER isometric projection.
|
|
764
|
+
* Staggers layers in the picture plane — e.g. { x: 0, y: -40 } lifts a layer up the projected
|
|
765
|
+
* Y axis; { x: -60, y: 0 } pushes one left on −X. Purely declarative; default = no offset. */
|
|
766
|
+
offset?: {
|
|
767
|
+
x: number;
|
|
768
|
+
y: number;
|
|
769
|
+
};
|
|
250
770
|
}
|
|
251
771
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
772
|
+
declare interface TierConfig_2 {
|
|
773
|
+
name: string;
|
|
774
|
+
elevation: number;
|
|
775
|
+
floorColor?: string;
|
|
776
|
+
floorOpacity?: number;
|
|
777
|
+
borderColor?: string;
|
|
778
|
+
nodeOpacity?: number;
|
|
779
|
+
blur?: number;
|
|
780
|
+
}
|
|
257
781
|
|
|
258
|
-
|
|
782
|
+
/** Content for the engineering-drawing title block (Engineering theme). */
|
|
783
|
+
declare interface TitleBlockInfo {
|
|
784
|
+
/** Project / drawing title shown in the top strip. */
|
|
785
|
+
title?: string;
|
|
786
|
+
/** Drawing number. Defaults to the diagram label (data.id). */
|
|
787
|
+
drawing?: string;
|
|
788
|
+
/** Scale field. Default 'NTS'. */
|
|
789
|
+
scale?: string;
|
|
790
|
+
/** Revision field. Default 'A'. */
|
|
791
|
+
rev?: string;
|
|
792
|
+
/** Sheet field. Default '1 / 1'. */
|
|
793
|
+
sheet?: string;
|
|
794
|
+
}
|
|
259
795
|
|
|
260
|
-
export
|
|
796
|
+
export declare function useColorMode(): string;
|
|
261
797
|
|
|
262
|
-
export
|
|
798
|
+
export declare function useDiagram(): {
|
|
799
|
+
layout: {
|
|
800
|
+
width: number;
|
|
801
|
+
height: number;
|
|
802
|
+
};
|
|
803
|
+
grid: {
|
|
804
|
+
enabled: boolean;
|
|
805
|
+
size: number;
|
|
806
|
+
color: string;
|
|
807
|
+
opacity: number;
|
|
808
|
+
type: "dots" | "lines";
|
|
809
|
+
};
|
|
810
|
+
nodes: {};
|
|
811
|
+
nodeData: {};
|
|
812
|
+
connectors: any[];
|
|
813
|
+
connectorStyles: {
|
|
814
|
+
[x: string]: ConnectorStyle;
|
|
815
|
+
};
|
|
816
|
+
groups: any[];
|
|
817
|
+
images: any[];
|
|
818
|
+
exportZone: any;
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
export declare function useDiagramMeta(): {};
|
|
822
|
+
|
|
823
|
+
export declare function useEditor(): EditorContextType;
|
|
824
|
+
|
|
825
|
+
export declare function useEditorState(): {
|
|
826
|
+
selectedNodeIds: any[];
|
|
827
|
+
selectedConnectorIndex: any;
|
|
828
|
+
selectedGroupId: any;
|
|
829
|
+
selectedImageId: any;
|
|
830
|
+
mode: string;
|
|
831
|
+
pendingConnector: any;
|
|
832
|
+
pendingGroup: any;
|
|
833
|
+
isDragging: boolean;
|
|
834
|
+
dragOffset: {
|
|
835
|
+
x: number;
|
|
836
|
+
y: number;
|
|
837
|
+
};
|
|
838
|
+
dragNodeOffsets: {};
|
|
839
|
+
template: string;
|
|
840
|
+
zoom: number;
|
|
841
|
+
viewMode: string;
|
|
842
|
+
themeId: string;
|
|
843
|
+
colorMode: string;
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
/** Returns the active theme's brand spec (typography, node shape, connector treatment). */
|
|
847
|
+
export declare function useResolvedBrand(): BrandSpec;
|
|
848
|
+
|
|
849
|
+
/** Returns the resolved theme palette (light or dark) for the current theme and color mode. */
|
|
850
|
+
export declare function useResolvedTheme(): {
|
|
851
|
+
palette: ColorPalette;
|
|
852
|
+
background: ThemeBackground;
|
|
853
|
+
text: {
|
|
854
|
+
primary: string;
|
|
855
|
+
secondary: string;
|
|
856
|
+
muted: string;
|
|
857
|
+
};
|
|
858
|
+
};
|
|
263
859
|
|
|
264
|
-
export
|
|
860
|
+
export declare function useThemeId(): string;
|
|
265
861
|
|
|
266
|
-
export
|
|
862
|
+
export declare function useViewMode(): string;
|
|
267
863
|
|
|
268
864
|
export declare type ViewMode = '2d' | 'isometric';
|
|
269
865
|
|
|
866
|
+
declare interface ZoomConfig {
|
|
867
|
+
defaultZoom?: number | 'fit';
|
|
868
|
+
zoomLevels?: number[];
|
|
869
|
+
zoomStep?: number;
|
|
870
|
+
}
|
|
871
|
+
|
|
270
872
|
export { }
|