@arach/arc-viewer 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 +101 -0
- package/dist/index.cjs +3062 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +639 -0
- package/dist/index.d.ts +639 -0
- package/dist/index.js +3017 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,639 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode, CSSProperties, ComponentType } from 'react';
|
|
3
|
+
|
|
4
|
+
type ThemeId = 'default' | 'warm' | 'cool' | 'mono';
|
|
5
|
+
interface ColorPalette {
|
|
6
|
+
violet: {
|
|
7
|
+
border: string;
|
|
8
|
+
bg: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
stroke: string;
|
|
11
|
+
};
|
|
12
|
+
emerald: {
|
|
13
|
+
border: string;
|
|
14
|
+
bg: string;
|
|
15
|
+
icon: string;
|
|
16
|
+
stroke: string;
|
|
17
|
+
};
|
|
18
|
+
blue: {
|
|
19
|
+
border: string;
|
|
20
|
+
bg: string;
|
|
21
|
+
icon: string;
|
|
22
|
+
stroke: string;
|
|
23
|
+
};
|
|
24
|
+
amber: {
|
|
25
|
+
border: string;
|
|
26
|
+
bg: string;
|
|
27
|
+
icon: string;
|
|
28
|
+
stroke: string;
|
|
29
|
+
};
|
|
30
|
+
sky: {
|
|
31
|
+
border: string;
|
|
32
|
+
bg: string;
|
|
33
|
+
icon: string;
|
|
34
|
+
stroke: string;
|
|
35
|
+
};
|
|
36
|
+
zinc: {
|
|
37
|
+
border: string;
|
|
38
|
+
bg: string;
|
|
39
|
+
icon: string;
|
|
40
|
+
stroke: string;
|
|
41
|
+
};
|
|
42
|
+
rose: {
|
|
43
|
+
border: string;
|
|
44
|
+
bg: string;
|
|
45
|
+
icon: string;
|
|
46
|
+
stroke: string;
|
|
47
|
+
};
|
|
48
|
+
orange: {
|
|
49
|
+
border: string;
|
|
50
|
+
bg: string;
|
|
51
|
+
icon: string;
|
|
52
|
+
stroke: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
interface ThemeBackground {
|
|
56
|
+
container: string;
|
|
57
|
+
grid: {
|
|
58
|
+
color: string;
|
|
59
|
+
opacity: number;
|
|
60
|
+
size: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
interface Theme {
|
|
64
|
+
id: ThemeId;
|
|
65
|
+
name: string;
|
|
66
|
+
description: string;
|
|
67
|
+
light: {
|
|
68
|
+
palette: ColorPalette;
|
|
69
|
+
background: ThemeBackground;
|
|
70
|
+
text: {
|
|
71
|
+
primary: string;
|
|
72
|
+
secondary: string;
|
|
73
|
+
muted: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
dark: {
|
|
77
|
+
palette: ColorPalette;
|
|
78
|
+
background: ThemeBackground;
|
|
79
|
+
text: {
|
|
80
|
+
primary: string;
|
|
81
|
+
secondary: string;
|
|
82
|
+
muted: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
declare const THEMES: Record<ThemeId, Theme>;
|
|
87
|
+
declare const DEFAULT_THEME: ThemeId;
|
|
88
|
+
declare function getTheme(id: ThemeId): Theme;
|
|
89
|
+
declare function getThemeList(): {
|
|
90
|
+
id: ThemeId;
|
|
91
|
+
name: string;
|
|
92
|
+
description: string;
|
|
93
|
+
}[];
|
|
94
|
+
|
|
95
|
+
type NodeSize = 'xs' | 's' | 'm' | 'l';
|
|
96
|
+
type AnchorPosition = 'left' | 'right' | 'top' | 'bottom' | 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
|
|
97
|
+
type DiagramColor = 'violet' | 'emerald' | 'blue' | 'amber' | 'sky' | 'zinc' | 'rose' | 'orange';
|
|
98
|
+
interface NodePosition {
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
size: NodeSize;
|
|
102
|
+
}
|
|
103
|
+
interface NodeData {
|
|
104
|
+
icon: string;
|
|
105
|
+
name: string;
|
|
106
|
+
subtitle?: string;
|
|
107
|
+
description?: string;
|
|
108
|
+
color: DiagramColor;
|
|
109
|
+
}
|
|
110
|
+
interface Connector {
|
|
111
|
+
from: string;
|
|
112
|
+
to: string;
|
|
113
|
+
fromAnchor: AnchorPosition;
|
|
114
|
+
toAnchor: AnchorPosition;
|
|
115
|
+
style: string;
|
|
116
|
+
curve?: 'natural' | 'step';
|
|
117
|
+
}
|
|
118
|
+
type LabelAlign = 'left' | 'right' | 'center';
|
|
119
|
+
interface ConnectorStyle {
|
|
120
|
+
color: DiagramColor;
|
|
121
|
+
strokeWidth: number;
|
|
122
|
+
label?: string;
|
|
123
|
+
labelAlign?: LabelAlign;
|
|
124
|
+
dashed?: boolean;
|
|
125
|
+
}
|
|
126
|
+
interface DiagramLayout {
|
|
127
|
+
width: number;
|
|
128
|
+
height: number;
|
|
129
|
+
}
|
|
130
|
+
interface ArcDiagramData {
|
|
131
|
+
id?: string;
|
|
132
|
+
layout: DiagramLayout;
|
|
133
|
+
nodes: Record<string, NodePosition>;
|
|
134
|
+
nodeData: Record<string, NodeData>;
|
|
135
|
+
connectors: Connector[];
|
|
136
|
+
connectorStyles: Record<string, ConnectorStyle>;
|
|
137
|
+
}
|
|
138
|
+
interface HoverEffectsConfig {
|
|
139
|
+
/** Dim unrelated nodes/connectors. Default: true */
|
|
140
|
+
dim?: boolean;
|
|
141
|
+
/** 0–1 opacity for dimmed nodes. Connectors dim to ~56% of this. Default: 0.45 */
|
|
142
|
+
dimOpacity?: number;
|
|
143
|
+
/** Lift hovered node up 2px. Default: true */
|
|
144
|
+
lift?: boolean;
|
|
145
|
+
/** Colored glow shadow on hover. Default: true */
|
|
146
|
+
glow?: boolean;
|
|
147
|
+
/** Thicken connected edges. Default: true */
|
|
148
|
+
highlightEdges?: boolean;
|
|
149
|
+
}
|
|
150
|
+
type DiagramMode = 'dark' | 'light';
|
|
151
|
+
|
|
152
|
+
interface ArcDiagramProps {
|
|
153
|
+
data: ArcDiagramData;
|
|
154
|
+
className?: string;
|
|
155
|
+
interactive?: boolean;
|
|
156
|
+
mode?: DiagramMode;
|
|
157
|
+
theme?: ThemeId;
|
|
158
|
+
/** Show the source toggle button. Default: true */
|
|
159
|
+
showArcToggle?: boolean;
|
|
160
|
+
/** Show the auto-layout button. Default: false */
|
|
161
|
+
showAutoLayout?: boolean;
|
|
162
|
+
/** Enable drag-to-reposition nodes. Default: false */
|
|
163
|
+
editable?: boolean;
|
|
164
|
+
/** URL of the Arc editor. When set with editable, shows an "Edit" button. */
|
|
165
|
+
editorUrl?: string;
|
|
166
|
+
/** Metadata to pass to the editor (viewport size, theme, mode). */
|
|
167
|
+
editorMeta?: {
|
|
168
|
+
viewport?: {
|
|
169
|
+
width: number;
|
|
170
|
+
height: number;
|
|
171
|
+
};
|
|
172
|
+
theme?: string;
|
|
173
|
+
mode?: string;
|
|
174
|
+
};
|
|
175
|
+
/** Control hover behavior. true = all effects (default), false = none, object = granular control */
|
|
176
|
+
hoverEffects?: boolean | HoverEffectsConfig;
|
|
177
|
+
/** Called when a node is hovered/clicked (nodeId) or released (null) */
|
|
178
|
+
onNodeHover?: (nodeId: string | null) => void;
|
|
179
|
+
}
|
|
180
|
+
declare function ArcDiagram({ data, className, interactive, mode, theme, showArcToggle, showAutoLayout, editable, editorUrl, editorMeta, hoverEffects, onNodeHover }: ArcDiagramProps): react_jsx_runtime.JSX.Element;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Auto-layout engine for Arc diagrams
|
|
184
|
+
*
|
|
185
|
+
* Layered DAG layout (Sugiyama) with grid-wrapping:
|
|
186
|
+
* when the natural LR layout exceeds the target width,
|
|
187
|
+
* layers wrap into rows — LR within each row, TB between rows.
|
|
188
|
+
* This uses the full 2D canvas instead of a single axis.
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
interface LayoutOptions {
|
|
192
|
+
/** Horizontal gap between columns */
|
|
193
|
+
columnGap?: number;
|
|
194
|
+
/** Vertical gap between nodes within a column */
|
|
195
|
+
nodeGap?: number;
|
|
196
|
+
/** Vertical gap between wrapped rows */
|
|
197
|
+
rowGap?: number;
|
|
198
|
+
/** Padding around the entire diagram */
|
|
199
|
+
padding?: number;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Auto-layout an ArcDiagramData.
|
|
203
|
+
*
|
|
204
|
+
* Uses LR flow within rows. When layers exceed the target width,
|
|
205
|
+
* wraps into multiple rows — combining LR and TB to maximize
|
|
206
|
+
* use of the available 2D space.
|
|
207
|
+
*/
|
|
208
|
+
declare function autoLayout(data: ArcDiagramData, options?: LayoutOptions): ArcDiagramData;
|
|
209
|
+
/**
|
|
210
|
+
* Generate a diagram from minimal input — no positions or anchors needed.
|
|
211
|
+
*/
|
|
212
|
+
interface AutoDiagramInput {
|
|
213
|
+
nodeData: ArcDiagramData['nodeData'];
|
|
214
|
+
connectors: Array<Omit<Connector, 'fromAnchor' | 'toAnchor'> & {
|
|
215
|
+
fromAnchor?: AnchorPosition;
|
|
216
|
+
toAnchor?: AnchorPosition;
|
|
217
|
+
}>;
|
|
218
|
+
connectorStyles: ArcDiagramData['connectorStyles'];
|
|
219
|
+
layout?: LayoutOptions;
|
|
220
|
+
}
|
|
221
|
+
declare function createAutoLayout(input: AutoDiagramInput): ArcDiagramData;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Sequence renderer presentation + extensibility contracts.
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
interface SequenceLayoutMetrics {
|
|
228
|
+
width: number;
|
|
229
|
+
height: number;
|
|
230
|
+
paddingX: number;
|
|
231
|
+
paddingY: number;
|
|
232
|
+
headerHeight: number;
|
|
233
|
+
participantGap: number;
|
|
234
|
+
/** Center X for each participant id */
|
|
235
|
+
participantX: Record<string, number>;
|
|
236
|
+
rowTops: number[];
|
|
237
|
+
rowHeights: number[];
|
|
238
|
+
}
|
|
239
|
+
interface SequenceLaidOutMessage {
|
|
240
|
+
event: SequenceMessageEvent;
|
|
241
|
+
y: number;
|
|
242
|
+
fromX: number;
|
|
243
|
+
toX: number;
|
|
244
|
+
self: boolean;
|
|
245
|
+
}
|
|
246
|
+
interface SequenceLaidOutNote {
|
|
247
|
+
event: SequenceNoteEvent;
|
|
248
|
+
x: number;
|
|
249
|
+
y: number;
|
|
250
|
+
width: number;
|
|
251
|
+
height: number;
|
|
252
|
+
}
|
|
253
|
+
interface SequenceLaidOutFragmentLane {
|
|
254
|
+
label?: string;
|
|
255
|
+
y: number;
|
|
256
|
+
height: number;
|
|
257
|
+
/** Event orders (inclusive) covered by this lane body */
|
|
258
|
+
startOrder: number;
|
|
259
|
+
endOrder: number;
|
|
260
|
+
}
|
|
261
|
+
interface SequenceLaidOutFragment {
|
|
262
|
+
id: string;
|
|
263
|
+
kind: string;
|
|
264
|
+
label?: string;
|
|
265
|
+
x: number;
|
|
266
|
+
y: number;
|
|
267
|
+
width: number;
|
|
268
|
+
height: number;
|
|
269
|
+
depth: number;
|
|
270
|
+
lanes: SequenceLaidOutFragmentLane[];
|
|
271
|
+
}
|
|
272
|
+
interface SequenceLayout {
|
|
273
|
+
metrics: SequenceLayoutMetrics;
|
|
274
|
+
messages: SequenceLaidOutMessage[];
|
|
275
|
+
notes: SequenceLaidOutNote[];
|
|
276
|
+
fragments: SequenceLaidOutFragment[];
|
|
277
|
+
}
|
|
278
|
+
interface SequenceThemeTokens {
|
|
279
|
+
background: string;
|
|
280
|
+
surface: string;
|
|
281
|
+
border: string;
|
|
282
|
+
text: string;
|
|
283
|
+
textSecondary: string;
|
|
284
|
+
textMuted: string;
|
|
285
|
+
lifeline: string;
|
|
286
|
+
messageSolid: string;
|
|
287
|
+
messageDashed: string;
|
|
288
|
+
messageLabel: string;
|
|
289
|
+
actorFill: string;
|
|
290
|
+
actorStroke: string;
|
|
291
|
+
actorText: string;
|
|
292
|
+
participantFill: string;
|
|
293
|
+
participantStroke: string;
|
|
294
|
+
participantText: string;
|
|
295
|
+
noteFill: string;
|
|
296
|
+
noteStroke: string;
|
|
297
|
+
noteText: string;
|
|
298
|
+
/** Cool/green family — local control plane */
|
|
299
|
+
localFill: string;
|
|
300
|
+
localStroke: string;
|
|
301
|
+
localText: string;
|
|
302
|
+
/** Warm/amber family — model inference */
|
|
303
|
+
modelFill: string;
|
|
304
|
+
modelStroke: string;
|
|
305
|
+
modelText: string;
|
|
306
|
+
fragmentFill: string;
|
|
307
|
+
fragmentStroke: string;
|
|
308
|
+
fragmentLabelBg: string;
|
|
309
|
+
fragmentLabelText: string;
|
|
310
|
+
fragmentDivider: string;
|
|
311
|
+
highlight: string;
|
|
312
|
+
dimOpacity: number;
|
|
313
|
+
}
|
|
314
|
+
interface SequencePartContext {
|
|
315
|
+
/** Per-renderer id namespace for SVG markers and accessibility ids. */
|
|
316
|
+
idPrefix: string;
|
|
317
|
+
mode: 'light' | 'dark';
|
|
318
|
+
themeId: ThemeId;
|
|
319
|
+
tokens: SequenceThemeTokens;
|
|
320
|
+
layout: SequenceLayout;
|
|
321
|
+
document: ArcSequenceDocument;
|
|
322
|
+
interactive: boolean;
|
|
323
|
+
highlightedParticipantId: string | null;
|
|
324
|
+
dimmed: boolean;
|
|
325
|
+
noteAccent: (event: SequenceNoteEvent) => 'local' | 'model' | 'default';
|
|
326
|
+
}
|
|
327
|
+
interface ActorHeaderProps {
|
|
328
|
+
participant: SequenceParticipant;
|
|
329
|
+
x: number;
|
|
330
|
+
y: number;
|
|
331
|
+
width: number;
|
|
332
|
+
height: number;
|
|
333
|
+
context: SequencePartContext;
|
|
334
|
+
emphasized: boolean;
|
|
335
|
+
onPointerEnter?: () => void;
|
|
336
|
+
onPointerLeave?: () => void;
|
|
337
|
+
onFocus?: () => void;
|
|
338
|
+
onBlur?: () => void;
|
|
339
|
+
onClick?: () => void;
|
|
340
|
+
}
|
|
341
|
+
interface ParticipantHeaderProps {
|
|
342
|
+
participant: SequenceParticipant;
|
|
343
|
+
x: number;
|
|
344
|
+
y: number;
|
|
345
|
+
width: number;
|
|
346
|
+
height: number;
|
|
347
|
+
context: SequencePartContext;
|
|
348
|
+
emphasized: boolean;
|
|
349
|
+
onPointerEnter?: () => void;
|
|
350
|
+
onPointerLeave?: () => void;
|
|
351
|
+
onFocus?: () => void;
|
|
352
|
+
onBlur?: () => void;
|
|
353
|
+
onClick?: () => void;
|
|
354
|
+
}
|
|
355
|
+
interface LifelineProps {
|
|
356
|
+
participant: SequenceParticipant;
|
|
357
|
+
x: number;
|
|
358
|
+
y1: number;
|
|
359
|
+
y2: number;
|
|
360
|
+
context: SequencePartContext;
|
|
361
|
+
emphasized: boolean;
|
|
362
|
+
}
|
|
363
|
+
interface MessagePartProps {
|
|
364
|
+
laidOut: SequenceLaidOutMessage;
|
|
365
|
+
context: SequencePartContext;
|
|
366
|
+
emphasized: boolean;
|
|
367
|
+
onPointerEnter?: () => void;
|
|
368
|
+
onPointerLeave?: () => void;
|
|
369
|
+
onActivate?: () => void;
|
|
370
|
+
}
|
|
371
|
+
interface NotePartProps {
|
|
372
|
+
laidOut: SequenceLaidOutNote;
|
|
373
|
+
context: SequencePartContext;
|
|
374
|
+
emphasized: boolean;
|
|
375
|
+
}
|
|
376
|
+
interface FragmentPartProps {
|
|
377
|
+
laidOut: SequenceLaidOutFragment;
|
|
378
|
+
context: SequencePartContext;
|
|
379
|
+
}
|
|
380
|
+
/** Pluggable part components for sequence rendering */
|
|
381
|
+
interface SequenceRendererParts {
|
|
382
|
+
ActorHeader?: (props: ActorHeaderProps) => ReactNode;
|
|
383
|
+
ParticipantHeader?: (props: ParticipantHeaderProps) => ReactNode;
|
|
384
|
+
Lifeline?: (props: LifelineProps) => ReactNode;
|
|
385
|
+
Message?: (props: MessagePartProps) => ReactNode;
|
|
386
|
+
Note?: (props: NotePartProps) => ReactNode;
|
|
387
|
+
Fragment?: (props: FragmentPartProps) => ReactNode;
|
|
388
|
+
}
|
|
389
|
+
/** Player / interaction hooks — never required for static export fidelity */
|
|
390
|
+
interface SequencePlayerInteractions {
|
|
391
|
+
onParticipantHover?: (participantId: string | null) => void;
|
|
392
|
+
onParticipantFocus?: (participantId: string | null) => void;
|
|
393
|
+
onParticipantActivate?: (participantId: string) => void;
|
|
394
|
+
onMessageHover?: (messageId: string | null) => void;
|
|
395
|
+
onMessageActivate?: (messageId: string) => void;
|
|
396
|
+
/** Controlled highlight; when omitted, internal hover/focus state is used */
|
|
397
|
+
highlightedParticipantId?: string | null;
|
|
398
|
+
/** Controlled message emphasis used by timeline players. */
|
|
399
|
+
activeMessageId?: string | null;
|
|
400
|
+
/** Dim unrelated lifelines/messages when a participant is highlighted. Default true when interactive */
|
|
401
|
+
dimUnrelated?: boolean;
|
|
402
|
+
}
|
|
403
|
+
interface SequencePresentationOptions {
|
|
404
|
+
/** Target width; height grows with content. Default 960 */
|
|
405
|
+
width?: number;
|
|
406
|
+
/** Visual scale applied after layout. Default 1. */
|
|
407
|
+
scale?: number;
|
|
408
|
+
/** Max message label width before wrap. Default 160 */
|
|
409
|
+
maxLabelWidth?: number;
|
|
410
|
+
/** Override theme tokens partially */
|
|
411
|
+
tokens?: Partial<SequenceThemeTokens>;
|
|
412
|
+
/** Replace individual part renderers */
|
|
413
|
+
parts?: SequenceRendererParts;
|
|
414
|
+
/** Map authored note semantics to a presentation role. Defaults to neutral. */
|
|
415
|
+
noteAccent?: (event: SequenceNoteEvent) => 'local' | 'model' | 'default';
|
|
416
|
+
/** Interaction hooks */
|
|
417
|
+
interactions?: SequencePlayerInteractions;
|
|
418
|
+
/** Inline style on root */
|
|
419
|
+
style?: CSSProperties;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Native Mermaid semantic document model.
|
|
424
|
+
*
|
|
425
|
+
* Sequence diagrams are first-class here — not projected through ArcDiagramData.
|
|
426
|
+
*/
|
|
427
|
+
type MermaidFamily = 'flowchart' | 'sequence' | 'state';
|
|
428
|
+
type MermaidDiagnosticSeverity = 'error' | 'warning' | 'unsupported';
|
|
429
|
+
interface MermaidSourceRange {
|
|
430
|
+
/** 1-based line number in the normalized source */
|
|
431
|
+
startLine: number;
|
|
432
|
+
endLine: number;
|
|
433
|
+
startColumn?: number;
|
|
434
|
+
endColumn?: number;
|
|
435
|
+
}
|
|
436
|
+
interface MermaidDiagnostic {
|
|
437
|
+
severity: MermaidDiagnosticSeverity;
|
|
438
|
+
code: string;
|
|
439
|
+
message: string;
|
|
440
|
+
/** Capability name for unsupported features (de-duplicated in consumers) */
|
|
441
|
+
capability?: string;
|
|
442
|
+
range?: MermaidSourceRange;
|
|
443
|
+
}
|
|
444
|
+
interface ArcMermaidDocumentBase {
|
|
445
|
+
family: MermaidFamily;
|
|
446
|
+
/** Original declaration token, e.g. sequenceDiagram */
|
|
447
|
+
declaration: string;
|
|
448
|
+
}
|
|
449
|
+
type SequenceParticipantKind = 'actor' | 'participant';
|
|
450
|
+
interface SequenceParticipant {
|
|
451
|
+
id: string;
|
|
452
|
+
label: string;
|
|
453
|
+
kind: SequenceParticipantKind;
|
|
454
|
+
/** Source order, 0-based */
|
|
455
|
+
order: number;
|
|
456
|
+
range?: MermaidSourceRange;
|
|
457
|
+
}
|
|
458
|
+
type SequenceMessageLine = 'solid' | 'dashed';
|
|
459
|
+
type SequenceArrowHead = 'filled' | 'open';
|
|
460
|
+
interface SequenceMessageEvent {
|
|
461
|
+
type: 'message';
|
|
462
|
+
id: string;
|
|
463
|
+
from: string;
|
|
464
|
+
to: string;
|
|
465
|
+
/** Structured label lines (from <br> splits) */
|
|
466
|
+
label: string[];
|
|
467
|
+
line: SequenceMessageLine;
|
|
468
|
+
arrow: SequenceArrowHead;
|
|
469
|
+
/** Activation markers present on the arrow (+/-) are recorded but not yet rendered */
|
|
470
|
+
activateTarget?: boolean;
|
|
471
|
+
deactivateTarget?: boolean;
|
|
472
|
+
order: number;
|
|
473
|
+
range?: MermaidSourceRange;
|
|
474
|
+
}
|
|
475
|
+
type SequenceNotePlacement = 'left' | 'right' | 'over';
|
|
476
|
+
interface SequenceNoteEvent {
|
|
477
|
+
type: 'note';
|
|
478
|
+
id: string;
|
|
479
|
+
placement: SequenceNotePlacement;
|
|
480
|
+
/** One or more participant ids; range notes list [from, to] in source order */
|
|
481
|
+
participants: string[];
|
|
482
|
+
/** Structured text lines */
|
|
483
|
+
text: string[];
|
|
484
|
+
order: number;
|
|
485
|
+
range?: MermaidSourceRange;
|
|
486
|
+
}
|
|
487
|
+
/** Supported fragment kinds for the first native slice */
|
|
488
|
+
type SequenceFragmentKind = 'alt' | 'else' | 'opt' | 'loop' | 'par' | 'critical' | 'break' | 'rect';
|
|
489
|
+
interface SequenceFragmentStartEvent {
|
|
490
|
+
type: 'fragmentStart';
|
|
491
|
+
id: string;
|
|
492
|
+
kind: SequenceFragmentKind;
|
|
493
|
+
/** Lane / branch label after the keyword */
|
|
494
|
+
label?: string;
|
|
495
|
+
depth: number;
|
|
496
|
+
order: number;
|
|
497
|
+
range?: MermaidSourceRange;
|
|
498
|
+
}
|
|
499
|
+
interface SequenceFragmentElseEvent {
|
|
500
|
+
type: 'fragmentElse';
|
|
501
|
+
id: string;
|
|
502
|
+
/** Matches the opening fragment id */
|
|
503
|
+
fragmentId: string;
|
|
504
|
+
label?: string;
|
|
505
|
+
depth: number;
|
|
506
|
+
order: number;
|
|
507
|
+
range?: MermaidSourceRange;
|
|
508
|
+
}
|
|
509
|
+
interface SequenceFragmentEndEvent {
|
|
510
|
+
type: 'fragmentEnd';
|
|
511
|
+
id: string;
|
|
512
|
+
fragmentId: string;
|
|
513
|
+
depth: number;
|
|
514
|
+
order: number;
|
|
515
|
+
range?: MermaidSourceRange;
|
|
516
|
+
}
|
|
517
|
+
type SequenceEvent = SequenceMessageEvent | SequenceNoteEvent | SequenceFragmentStartEvent | SequenceFragmentElseEvent | SequenceFragmentEndEvent;
|
|
518
|
+
interface ArcSequenceDocument extends ArcMermaidDocumentBase {
|
|
519
|
+
family: 'sequence';
|
|
520
|
+
participants: SequenceParticipant[];
|
|
521
|
+
events: SequenceEvent[];
|
|
522
|
+
}
|
|
523
|
+
interface ArcFlowchartDocument extends ArcMermaidDocumentBase {
|
|
524
|
+
family: 'flowchart';
|
|
525
|
+
/** Raw declaration body retained for future native rendering */
|
|
526
|
+
raw: string;
|
|
527
|
+
}
|
|
528
|
+
interface ArcStateDocument extends ArcMermaidDocumentBase {
|
|
529
|
+
family: 'state';
|
|
530
|
+
raw: string;
|
|
531
|
+
}
|
|
532
|
+
type ArcMermaidDocument = ArcFlowchartDocument | ArcSequenceDocument | ArcStateDocument;
|
|
533
|
+
interface ArcMermaidParseResult {
|
|
534
|
+
document: ArcMermaidDocument | null;
|
|
535
|
+
diagnostics: MermaidDiagnostic[];
|
|
536
|
+
/** Normalized source (LF line endings) retained for editing */
|
|
537
|
+
source: string;
|
|
538
|
+
}
|
|
539
|
+
interface ArcMermaidProps {
|
|
540
|
+
source?: string;
|
|
541
|
+
document?: ArcMermaidDocument;
|
|
542
|
+
mode?: 'light' | 'dark';
|
|
543
|
+
theme?: ThemeId;
|
|
544
|
+
interactive?: boolean;
|
|
545
|
+
className?: string;
|
|
546
|
+
title?: string;
|
|
547
|
+
description?: string;
|
|
548
|
+
/** Sequence-only presentation overrides */
|
|
549
|
+
sequence?: SequencePresentationOptions;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* parseMermaid — native Mermaid → typed ArcMermaidDocument
|
|
554
|
+
*/
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Parse Mermaid source into a typed native document.
|
|
558
|
+
* Does not project into ArcDiagramData.
|
|
559
|
+
*/
|
|
560
|
+
declare function parseMermaid(source: string): ArcMermaidParseResult;
|
|
561
|
+
|
|
562
|
+
declare function ArcMermaid({ source, document: documentProp, mode, theme, interactive, className, title, description, sequence, }: ArcMermaidProps): react_jsx_runtime.JSX.Element;
|
|
563
|
+
|
|
564
|
+
interface ArcMermaidPlayerProps extends ArcMermaidProps {
|
|
565
|
+
defaultZoom?: number | 'fit';
|
|
566
|
+
minZoom?: number;
|
|
567
|
+
maxZoom?: number;
|
|
568
|
+
zoomStep?: number;
|
|
569
|
+
showControls?: boolean;
|
|
570
|
+
showPlayback?: boolean;
|
|
571
|
+
autoplayMs?: number;
|
|
572
|
+
onStepChange?: (step: number, eventId: string | null) => void;
|
|
573
|
+
}
|
|
574
|
+
declare function ArcMermaidPlayer({ source, document, mode, theme, className, title, description, sequence, defaultZoom, minZoom, maxZoom, zoomStep, showControls, showPlayback, autoplayMs, onStepChange, }: ArcMermaidPlayerProps): react_jsx_runtime.JSX.Element;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Family → renderer registry.
|
|
578
|
+
* Adding a Mermaid family registers here; UI code must not grow type conditionals.
|
|
579
|
+
*/
|
|
580
|
+
|
|
581
|
+
interface MermaidRendererProps {
|
|
582
|
+
document: ArcMermaidDocument;
|
|
583
|
+
mode?: 'light' | 'dark';
|
|
584
|
+
theme?: ThemeId;
|
|
585
|
+
interactive?: boolean;
|
|
586
|
+
className?: string;
|
|
587
|
+
title?: string;
|
|
588
|
+
description?: string;
|
|
589
|
+
sequence?: SequencePresentationOptions;
|
|
590
|
+
}
|
|
591
|
+
type MermaidFamilyRenderer = ComponentType<MermaidRendererProps>;
|
|
592
|
+
declare function registerMermaidRenderer(family: MermaidFamily, renderer: MermaidFamilyRenderer): void;
|
|
593
|
+
declare function getMermaidRenderer(family: MermaidFamily): MermaidFamilyRenderer | undefined;
|
|
594
|
+
declare function listMermaidRenderers(): MermaidFamily[];
|
|
595
|
+
|
|
596
|
+
interface SequenceRendererProps {
|
|
597
|
+
document: ArcSequenceDocument;
|
|
598
|
+
mode?: 'light' | 'dark';
|
|
599
|
+
theme?: ThemeId;
|
|
600
|
+
interactive?: boolean;
|
|
601
|
+
className?: string;
|
|
602
|
+
title?: string;
|
|
603
|
+
description?: string;
|
|
604
|
+
presentation?: SequencePresentationOptions;
|
|
605
|
+
}
|
|
606
|
+
declare function SequenceRenderer({ document, mode, theme, interactive, className, title, description, presentation, }: SequenceRendererProps): react_jsx_runtime.JSX.Element;
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Deterministic sequence layout — pure functions, no DOM measurement.
|
|
610
|
+
* Long labels wrap within maxLabelWidth and grow their row height.
|
|
611
|
+
*/
|
|
612
|
+
|
|
613
|
+
interface SequenceLayoutOptions {
|
|
614
|
+
width?: number;
|
|
615
|
+
maxLabelWidth?: number;
|
|
616
|
+
}
|
|
617
|
+
declare function layoutSequence(document: ArcSequenceDocument, options?: SequenceLayoutOptions): SequenceLayout;
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Native sequenceDiagram parser → ArcSequenceDocument
|
|
621
|
+
*/
|
|
622
|
+
|
|
623
|
+
interface ParseSequenceResult {
|
|
624
|
+
document: ArcSequenceDocument;
|
|
625
|
+
diagnostics: MermaidDiagnostic[];
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Parse a sequenceDiagram body (including the declaration line).
|
|
629
|
+
* `baseLine` is the 1-based line number of the declaration in the full source.
|
|
630
|
+
*/
|
|
631
|
+
declare function parseSequenceSource(source: string, baseLine?: number): ParseSequenceResult;
|
|
632
|
+
|
|
633
|
+
declare function getSequenceThemeTokens(mode: 'light' | 'dark', themeId?: ThemeId): SequenceThemeTokens;
|
|
634
|
+
/** Classify note text for cool (local) vs warm (model) accent */
|
|
635
|
+
declare function classifyNoteAccent(text: string[]): 'local' | 'model' | 'default';
|
|
636
|
+
|
|
637
|
+
declare const defaultSequenceParts: Required<SequenceRendererParts>;
|
|
638
|
+
|
|
639
|
+
export { type ActorHeaderProps, type AnchorPosition, ArcDiagram, type ArcDiagramData, type ArcDiagramProps, type ArcFlowchartDocument, ArcMermaid, type ArcMermaidDocument, type ArcMermaidParseResult, ArcMermaidPlayer, type ArcMermaidPlayerProps, type ArcMermaidProps, type ArcSequenceDocument, type ArcStateDocument, type AutoDiagramInput, type ColorPalette, type Connector, type ConnectorStyle, DEFAULT_THEME, type DiagramColor, type DiagramLayout, type DiagramMode, type FragmentPartProps, type HoverEffectsConfig, type LabelAlign, type LayoutOptions, type LifelineProps, type MermaidDiagnostic, type MermaidDiagnosticSeverity, type MermaidFamily, type MermaidFamilyRenderer, type MermaidRendererProps, type MermaidSourceRange, type MessagePartProps, type NodeData, type NodePosition, type NodeSize, type NotePartProps, type ParticipantHeaderProps, type SequenceArrowHead, type SequenceEvent, type SequenceFragmentElseEvent, type SequenceFragmentEndEvent, type SequenceFragmentKind, type SequenceFragmentStartEvent, type SequenceLayout, type SequenceMessageEvent, type SequenceMessageLine, type SequenceNoteEvent, type SequenceNotePlacement, type SequenceParticipant, type SequenceParticipantKind, type SequencePlayerInteractions, type SequencePresentationOptions, SequenceRenderer, type SequenceRendererParts, type SequenceRendererProps, type SequenceThemeTokens, THEMES, type Theme, type ThemeBackground, type ThemeId, autoLayout, classifyNoteAccent, createAutoLayout, ArcDiagram as default, defaultSequenceParts, getMermaidRenderer, getSequenceThemeTokens, getTheme, getThemeList, layoutSequence, listMermaidRenderers, parseMermaid, parseSequenceSource, registerMermaidRenderer };
|