@diagrammo/dgmo 0.0.1

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.
@@ -0,0 +1,685 @@
1
+ import { ChartConfiguration } from 'chart.js';
2
+ import { EChartsOption } from 'echarts';
3
+ import * as d3Scale from 'd3-scale';
4
+
5
+ /**
6
+ * Framework identifiers used by the .dgmo router.
7
+ * Maps to the existing preview components and export paths.
8
+ */
9
+ type DgmoFramework = 'chartjs' | 'echart' | 'd3' | 'mermaid';
10
+ /**
11
+ * Maps every supported chart type string to its backing framework.
12
+ *
13
+ * Chart.js: standard chart types (bar, line, pie, etc.)
14
+ * ECharts: scatter, flow/relationship diagrams, math, heatmap
15
+ * D3: slope, wordcloud, arc diagram, timeline
16
+ */
17
+ declare const DGMO_CHART_TYPE_MAP: Record<string, DgmoFramework>;
18
+ /**
19
+ * Returns the framework for a given chart type, or `null` if unknown.
20
+ */
21
+ declare function getDgmoFramework(chartType: string): DgmoFramework | null;
22
+ /**
23
+ * Extracts the `chart:` type value from raw file content.
24
+ * Falls back to inference when no explicit `chart:` line is found
25
+ * (e.g. content containing `->` is inferred as `sequence`).
26
+ */
27
+ declare function parseDgmoChartType(content: string): string | null;
28
+
29
+ /**
30
+ * Color definitions for a single mode (light or dark).
31
+ * 10 semantic UI colors + 9 named accent colors = 19 total.
32
+ */
33
+ interface PaletteColors {
34
+ /** Main background (#eceff4 light / #2e3440 dark for Nord) */
35
+ bg: string;
36
+ /** Cards, panels (#e5e9f0 / #3b4252) */
37
+ surface: string;
38
+ /** Popovers, dropdowns (#e5e9f0 / #434c5e) */
39
+ overlay: string;
40
+ /** Borders, dividers, muted (#d8dee9 / #4c566a) */
41
+ border: string;
42
+ /** Primary text (#2e3440 / #eceff4) */
43
+ text: string;
44
+ /** Secondary/diminished text (#4c566a / #d8dee9) */
45
+ textMuted: string;
46
+ /** Primary accent — buttons, links */
47
+ primary: string;
48
+ /** Secondary accent */
49
+ secondary: string;
50
+ /** Tertiary accent */
51
+ accent: string;
52
+ /** Error/danger */
53
+ destructive: string;
54
+ /**
55
+ * Used for: inline annotations (red), pie charts, cScale,
56
+ * series rotation, journey actors, Gantt tasks.
57
+ */
58
+ colors: {
59
+ red: string;
60
+ orange: string;
61
+ yellow: string;
62
+ green: string;
63
+ blue: string;
64
+ purple: string;
65
+ teal: string;
66
+ cyan: string;
67
+ gray: string;
68
+ };
69
+ }
70
+ /**
71
+ * Complete palette definition. One object per color scheme.
72
+ * This is what palette authors create — the single artifact for NFR1.
73
+ */
74
+ interface PaletteConfig {
75
+ /** Registry key: 'nord', 'solarized', 'catppuccin' */
76
+ id: string;
77
+ /** Display name: 'Nord', 'Solarized', 'Catppuccin' */
78
+ name: string;
79
+ /** Light mode color definitions */
80
+ light: PaletteColors;
81
+ /** Dark mode color definitions */
82
+ dark: PaletteColors;
83
+ }
84
+
85
+ /** Validate that a hex string is well-formed (#RGB or #RRGGBB). */
86
+ declare function isValidHex(value: string): boolean;
87
+ /**
88
+ * Register a palette. Called at module initialization.
89
+ * Validates that all 19 color fields per mode are present and valid hex.
90
+ * Throws on malformed palettes to catch errors at startup, not at render time.
91
+ */
92
+ declare function registerPalette(palette: PaletteConfig): void;
93
+ /** Get palette by id. Returns Nord if id is unrecognized (FR10). */
94
+ declare function getPalette(id: string): PaletteConfig;
95
+ /** List all registered palettes (for the selector UI). */
96
+ declare function getAvailablePalettes(): PaletteConfig[];
97
+
98
+ /** Convert hex (#RRGGBB or #RGB) to { h, s, l } with h in degrees, s/l as percentages. */
99
+ declare function hexToHSL(hex: string): {
100
+ h: number;
101
+ s: number;
102
+ l: number;
103
+ };
104
+ /** Convert { h (degrees), s (%), l (%) } back to #RRGGBB hex string. */
105
+ declare function hslToHex(h: number, s: number, l: number): string;
106
+ /** Convert hex to "H S% L%" string for CSS custom properties. */
107
+ declare function hexToHSLString(hex: string): string;
108
+ /**
109
+ * Derive a muted (desaturated, darkened) variant of a color.
110
+ * Used by the Mermaid theme generator for dark-mode fills.
111
+ *
112
+ * Algorithm: cap saturation at 35% and lightness at 36%.
113
+ */
114
+ declare function mute(hex: string): string;
115
+ /**
116
+ * Blend a color toward white (light mode quadrant fills).
117
+ * amount: 0 = original, 1 = white
118
+ */
119
+ declare function tint(hex: string, amount: number): string;
120
+ /**
121
+ * Blend a color toward a dark base (dark mode quadrant fills).
122
+ * amount: 0 = original, 1 = base
123
+ */
124
+ declare function shade(hex: string, base: string, amount: number): string;
125
+ /**
126
+ * Pick a text color that contrasts against `bg`.
127
+ * Returns `darkText` when background is light (luminance > 0.179),
128
+ * `lightText` when background is dark.
129
+ * Threshold 0.179 is the standard WCAG midpoint for the contrast flip.
130
+ */
131
+ declare function contrastText(bg: string, lightText: string, darkText: string): string;
132
+ /** Derive the 8-color series rotation from a palette's named colors. */
133
+ declare function getSeriesColors(palette: PaletteColors): string[];
134
+
135
+ declare const nordPalette: PaletteConfig;
136
+
137
+ declare const solarizedPalette: PaletteConfig;
138
+
139
+ declare const catppuccinPalette: PaletteConfig;
140
+
141
+ declare const rosePinePalette: PaletteConfig;
142
+
143
+ declare const gruvboxPalette: PaletteConfig;
144
+
145
+ declare const tokyoNightPalette: PaletteConfig;
146
+
147
+ declare const oneDarkPalette: PaletteConfig;
148
+
149
+ declare const boldPalette: PaletteConfig;
150
+
151
+ /**
152
+ * Generates ~121 Mermaid theme variables from palette tokens.
153
+ * Replaces the hardcoded lightThemeVars/darkThemeVars objects.
154
+ *
155
+ * Dark mode fills use `mute()` to derive desaturated variants
156
+ * that are readable with light text.
157
+ */
158
+ declare function buildMermaidThemeVars(colors: PaletteColors, isDark: boolean): Record<string, string>;
159
+ /**
160
+ * Generates custom CSS overrides for Mermaid SVGs.
161
+ * Handles git graph label backgrounds and dark-mode text readability.
162
+ */
163
+ declare function buildThemeCSS(palette: PaletteColors, isDark: boolean): string;
164
+
165
+ type ChartJsChartType = 'bar' | 'line' | 'pie' | 'doughnut' | 'area' | 'polar-area' | 'radar' | 'bar-stacked';
166
+ interface ChartJsDataPoint {
167
+ label: string;
168
+ value: number;
169
+ extraValues?: number[];
170
+ color?: string;
171
+ lineNumber: number;
172
+ }
173
+ interface ParsedChartJs {
174
+ type: ChartJsChartType;
175
+ title?: string;
176
+ series?: string;
177
+ xlabel?: string;
178
+ ylabel?: string;
179
+ seriesNames?: string[];
180
+ seriesNameColors?: (string | undefined)[];
181
+ orientation?: 'horizontal' | 'vertical';
182
+ color?: string;
183
+ label?: string;
184
+ data: ChartJsDataPoint[];
185
+ error?: string;
186
+ }
187
+
188
+ /**
189
+ * Parses the simple chartjs text format into a structured object.
190
+ *
191
+ * Format:
192
+ * ```
193
+ * chart: bar
194
+ * title: My Chart
195
+ * series: Revenue
196
+ *
197
+ * Jan: 120
198
+ * Feb: 200
199
+ * Mar: 150
200
+ * ```
201
+ */
202
+ declare function parseChartJs(content: string, palette?: PaletteColors): ParsedChartJs;
203
+ /**
204
+ * Converts parsed chartjs data to a Chart.js configuration object.
205
+ */
206
+ declare function buildChartJsConfig(parsed: ParsedChartJs, palette: PaletteColors, _isDark: boolean): ChartConfiguration;
207
+
208
+ type EChartsChartType = 'sankey' | 'chord' | 'function' | 'scatter' | 'heatmap' | 'funnel';
209
+ interface EChartsDataPoint {
210
+ label: string;
211
+ value: number;
212
+ color?: string;
213
+ lineNumber: number;
214
+ }
215
+ interface ParsedSankeyLink {
216
+ source: string;
217
+ target: string;
218
+ value: number;
219
+ lineNumber: number;
220
+ }
221
+ interface ParsedFunction {
222
+ name: string;
223
+ expression: string;
224
+ color?: string;
225
+ lineNumber: number;
226
+ }
227
+ interface ParsedScatterPoint {
228
+ name: string;
229
+ x: number;
230
+ y: number;
231
+ size?: number;
232
+ color?: string;
233
+ category?: string;
234
+ lineNumber: number;
235
+ }
236
+ interface ParsedHeatmapRow {
237
+ label: string;
238
+ values: number[];
239
+ lineNumber: number;
240
+ }
241
+ interface ParsedEChart {
242
+ type: EChartsChartType;
243
+ title?: string;
244
+ series?: string;
245
+ seriesNames?: string[];
246
+ seriesNameColors?: (string | undefined)[];
247
+ data: EChartsDataPoint[];
248
+ links?: ParsedSankeyLink[];
249
+ functions?: ParsedFunction[];
250
+ scatterPoints?: ParsedScatterPoint[];
251
+ heatmapRows?: ParsedHeatmapRow[];
252
+ columns?: string[];
253
+ rows?: string[];
254
+ xRange?: {
255
+ min: number;
256
+ max: number;
257
+ };
258
+ xlabel?: string;
259
+ ylabel?: string;
260
+ sizelabel?: string;
261
+ showLabels?: boolean;
262
+ categoryColors?: Record<string, string>;
263
+ error?: string;
264
+ }
265
+
266
+ /**
267
+ * Parses the simple echart text format into a structured object.
268
+ *
269
+ * Format:
270
+ * ```
271
+ * chart: bar
272
+ * title: My Chart
273
+ * series: Revenue
274
+ *
275
+ * Jan: 120
276
+ * Feb: 200
277
+ * Mar: 150
278
+ * ```
279
+ */
280
+ declare function parseEChart(content: string, palette?: PaletteColors): ParsedEChart;
281
+ /**
282
+ * Converts parsed echart data to ECharts option object.
283
+ */
284
+ declare function buildEChartsOption(parsed: ParsedEChart, palette: PaletteColors, _isDark: boolean): EChartsOption;
285
+
286
+ type D3ChartType = 'slope' | 'wordcloud' | 'arc' | 'timeline' | 'venn' | 'quadrant' | 'sequence';
287
+ interface D3DataItem {
288
+ label: string;
289
+ values: number[];
290
+ color: string | null;
291
+ lineNumber: number;
292
+ }
293
+ interface WordCloudWord {
294
+ text: string;
295
+ weight: number;
296
+ lineNumber: number;
297
+ }
298
+ type WordCloudRotate = 'none' | 'mixed' | 'angled';
299
+ interface WordCloudOptions {
300
+ rotate: WordCloudRotate;
301
+ max: number;
302
+ minSize: number;
303
+ maxSize: number;
304
+ }
305
+ interface ArcLink {
306
+ source: string;
307
+ target: string;
308
+ value: number;
309
+ color: string | null;
310
+ lineNumber: number;
311
+ }
312
+ type ArcOrder = 'appearance' | 'name' | 'group' | 'degree';
313
+ interface ArcNodeGroup {
314
+ name: string;
315
+ nodes: string[];
316
+ color: string | null;
317
+ lineNumber: number;
318
+ }
319
+ type TimelineSort = 'time' | 'group';
320
+ interface TimelineEvent {
321
+ date: string;
322
+ endDate: string | null;
323
+ label: string;
324
+ group: string | null;
325
+ lineNumber: number;
326
+ uncertain?: boolean;
327
+ }
328
+ interface TimelineGroup {
329
+ name: string;
330
+ color: string | null;
331
+ lineNumber: number;
332
+ }
333
+ interface TimelineEra {
334
+ startDate: string;
335
+ endDate: string;
336
+ label: string;
337
+ color: string | null;
338
+ }
339
+ interface TimelineMarker {
340
+ date: string;
341
+ label: string;
342
+ color: string | null;
343
+ lineNumber: number;
344
+ }
345
+ interface VennSet {
346
+ name: string;
347
+ size: number;
348
+ color: string | null;
349
+ label: string | null;
350
+ lineNumber: number;
351
+ }
352
+ interface VennOverlap {
353
+ sets: string[];
354
+ size: number;
355
+ label: string | null;
356
+ lineNumber: number;
357
+ }
358
+ interface QuadrantLabel$1 {
359
+ text: string;
360
+ color: string | null;
361
+ lineNumber: number;
362
+ }
363
+ interface QuadrantPoint {
364
+ label: string;
365
+ x: number;
366
+ y: number;
367
+ lineNumber: number;
368
+ }
369
+ interface QuadrantLabels {
370
+ topRight: QuadrantLabel$1 | null;
371
+ topLeft: QuadrantLabel$1 | null;
372
+ bottomLeft: QuadrantLabel$1 | null;
373
+ bottomRight: QuadrantLabel$1 | null;
374
+ }
375
+ interface ParsedD3 {
376
+ type: D3ChartType | null;
377
+ title: string | null;
378
+ orientation: 'horizontal' | 'vertical';
379
+ periods: string[];
380
+ data: D3DataItem[];
381
+ words: WordCloudWord[];
382
+ cloudOptions: WordCloudOptions;
383
+ links: ArcLink[];
384
+ arcOrder: ArcOrder;
385
+ arcNodeGroups: ArcNodeGroup[];
386
+ timelineEvents: TimelineEvent[];
387
+ timelineGroups: TimelineGroup[];
388
+ timelineEras: TimelineEra[];
389
+ timelineMarkers: TimelineMarker[];
390
+ timelineSort: TimelineSort;
391
+ timelineScale: boolean;
392
+ timelineSwimlanes: boolean;
393
+ vennSets: VennSet[];
394
+ vennOverlaps: VennOverlap[];
395
+ vennShowValues: boolean;
396
+ quadrantLabels: QuadrantLabels;
397
+ quadrantPoints: QuadrantPoint[];
398
+ quadrantXAxis: [string, string] | null;
399
+ quadrantXAxisLineNumber: number | null;
400
+ quadrantYAxis: [string, string] | null;
401
+ quadrantYAxisLineNumber: number | null;
402
+ quadrantTitleLineNumber: number | null;
403
+ error: string | null;
404
+ }
405
+
406
+ /**
407
+ * Converts a date string (YYYY, YYYY-MM, YYYY-MM-DD) to a fractional year number.
408
+ */
409
+ declare function parseTimelineDate(s: string): number;
410
+ /**
411
+ * Adds a duration to a date string and returns the resulting date string.
412
+ * Supports: d (days), w (weeks), m (months), y (years)
413
+ * Supports decimals up to 2 places (e.g., 1.25y = 1 year 3 months)
414
+ * Preserves the precision of the input date (YYYY, YYYY-MM, or YYYY-MM-DD).
415
+ */
416
+ declare function addDurationToDate(startDate: string, amount: number, unit: 'd' | 'w' | 'm' | 'y'): string;
417
+ /**
418
+ * Parses D3 chart text format into structured data.
419
+ */
420
+ declare function parseD3(content: string, palette?: PaletteColors): ParsedD3;
421
+ /**
422
+ * Renders a slope chart into the given container using D3.
423
+ */
424
+ declare function renderSlopeChart(container: HTMLDivElement, parsed: ParsedD3, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void): void;
425
+ /**
426
+ * Orders arc diagram nodes based on the selected ordering strategy.
427
+ */
428
+ declare function orderArcNodes(links: ArcLink[], order: ArcOrder, groups: ArcNodeGroup[]): string[];
429
+ /**
430
+ * Renders an arc diagram into the given container using D3.
431
+ */
432
+ declare function renderArcDiagram(container: HTMLDivElement, parsed: ParsedD3, palette: PaletteColors, _isDark: boolean, onClickItem?: (lineNumber: number) => void): void;
433
+ /**
434
+ * Converts a DSL date string (YYYY, YYYY-MM, YYYY-MM-DD) to a human-readable label.
435
+ * '1718' → '1718'
436
+ * '1718-05' → 'May 1718'
437
+ * '1718-05-22' → 'May 22, 1718'
438
+ */
439
+ declare function formatDateLabel(dateStr: string): string;
440
+ /**
441
+ * Computes adaptive tick marks for a timeline scale.
442
+ * - Multi-year spans → year ticks
443
+ * - Within ~1 year → month ticks
444
+ * - Within ~3 months → week ticks (1st, 8th, 15th, 22nd)
445
+ *
446
+ * Optional boundary parameters add ticks at exact data start/end:
447
+ * - boundaryStart/boundaryEnd: numeric date values
448
+ * - boundaryStartLabel/boundaryEndLabel: formatted labels for those dates
449
+ */
450
+ declare function computeTimeTicks(domainMin: number, domainMax: number, scale: d3Scale.ScaleLinear<number, number>, boundaryStart?: number, boundaryEnd?: number, boundaryStartLabel?: string, boundaryEndLabel?: string): {
451
+ pos: number;
452
+ label: string;
453
+ }[];
454
+ /**
455
+ * Renders a timeline chart into the given container using D3.
456
+ * Supports horizontal (default) and vertical orientation.
457
+ */
458
+ declare function renderTimeline(container: HTMLDivElement, parsed: ParsedD3, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void): void;
459
+ /**
460
+ * Renders a word cloud into the given container using d3-cloud.
461
+ */
462
+ declare function renderWordCloud(container: HTMLDivElement, parsed: ParsedD3, palette: PaletteColors, _isDark: boolean, onClickItem?: (lineNumber: number) => void): void;
463
+ declare function renderVenn(container: HTMLDivElement, parsed: ParsedD3, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void): void;
464
+ /**
465
+ * Renders a quadrant chart using D3.
466
+ * Displays 4 colored quadrant regions, axis labels, quadrant labels, and data points.
467
+ */
468
+ declare function renderQuadrant(container: HTMLDivElement, parsed: ParsedD3, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void): void;
469
+ /**
470
+ * Renders a D3 chart to an SVG string for export.
471
+ * Creates a detached DOM element, renders into it, extracts the SVG, then cleans up.
472
+ */
473
+ declare function renderD3ForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette?: PaletteColors): Promise<string>;
474
+
475
+ /**
476
+ * Participant types that can be declared via "Name is a type" syntax.
477
+ */
478
+ type ParticipantType = 'default' | 'service' | 'database' | 'actor' | 'queue' | 'cache' | 'gateway' | 'external' | 'networking' | 'frontend';
479
+ /**
480
+ * A declared or inferred participant in the sequence diagram.
481
+ */
482
+ interface SequenceParticipant {
483
+ /** Internal identifier (e.g. "AuthService") */
484
+ id: string;
485
+ /** Display label — uses aka alias if provided, otherwise id */
486
+ label: string;
487
+ /** Participant shape type */
488
+ type: ParticipantType;
489
+ /** Source line number (1-based) */
490
+ lineNumber: number;
491
+ /** Explicit layout position override (0-based from left, negative from right) */
492
+ position?: number;
493
+ }
494
+ /**
495
+ * A message between two participants.
496
+ * Placeholder for future stories — included in the interface now for completeness.
497
+ */
498
+ interface SequenceMessage {
499
+ from: string;
500
+ to: string;
501
+ label: string;
502
+ returnLabel?: string;
503
+ lineNumber: number;
504
+ async?: boolean;
505
+ }
506
+ /**
507
+ * A conditional or loop block in the sequence diagram.
508
+ */
509
+ interface SequenceBlock {
510
+ kind: 'block';
511
+ type: 'if' | 'loop' | 'parallel';
512
+ label: string;
513
+ children: SequenceElement[];
514
+ elseChildren: SequenceElement[];
515
+ lineNumber: number;
516
+ }
517
+ /**
518
+ * A labeled horizontal divider between message phases.
519
+ */
520
+ interface SequenceSection {
521
+ kind: 'section';
522
+ label: string;
523
+ color?: string;
524
+ lineNumber: number;
525
+ }
526
+ type SequenceElement = SequenceMessage | SequenceBlock | SequenceSection;
527
+ declare function isSequenceBlock(el: SequenceElement): el is SequenceBlock;
528
+ /**
529
+ * A named group of participants rendered as a labeled box.
530
+ */
531
+ interface SequenceGroup {
532
+ name: string;
533
+ color?: string;
534
+ participantIds: string[];
535
+ lineNumber: number;
536
+ }
537
+ /**
538
+ * Parsed result from a .dgmo sequence diagram.
539
+ */
540
+ interface ParsedSequenceDgmo {
541
+ title: string | null;
542
+ participants: SequenceParticipant[];
543
+ messages: SequenceMessage[];
544
+ elements: SequenceElement[];
545
+ groups: SequenceGroup[];
546
+ sections: SequenceSection[];
547
+ options: Record<string, string>;
548
+ error: string | null;
549
+ }
550
+ /**
551
+ * Parse a .dgmo file with `chart: sequence` into a structured representation.
552
+ */
553
+ declare function parseSequenceDgmo(content: string): ParsedSequenceDgmo;
554
+ /**
555
+ * Detect whether raw content looks like a sequence diagram.
556
+ * Used by the chart type inference logic.
557
+ */
558
+ declare function looksLikeSequence(content: string): boolean;
559
+
560
+ /**
561
+ * Infer participant type from a name using the ordered rules table.
562
+ * Returns 'default' if no rule matches.
563
+ */
564
+ declare function inferParticipantType(name: string): ParticipantType;
565
+ /**
566
+ * Number of rules in the table. Exported for test assertions.
567
+ */
568
+ declare const RULE_COUNT: number;
569
+
570
+ interface QuadrantLabel {
571
+ text: string;
572
+ color: string | null;
573
+ lineNumber: number;
574
+ }
575
+ interface ParsedQuadrant {
576
+ title: string | null;
577
+ titleLineNumber: number | null;
578
+ xAxis: [string, string] | null;
579
+ xAxisLineNumber: number | null;
580
+ yAxis: [string, string] | null;
581
+ yAxisLineNumber: number | null;
582
+ quadrants: {
583
+ topRight: QuadrantLabel | null;
584
+ topLeft: QuadrantLabel | null;
585
+ bottomLeft: QuadrantLabel | null;
586
+ bottomRight: QuadrantLabel | null;
587
+ };
588
+ points: {
589
+ label: string;
590
+ x: number;
591
+ y: number;
592
+ lineNumber: number;
593
+ }[];
594
+ error: string | null;
595
+ }
596
+ /**
597
+ * Parses a .dgmo quadrant document into a structured object.
598
+ * Lines are processed sequentially; unknown lines are silently skipped.
599
+ */
600
+ declare function parseQuadrant(content: string): ParsedQuadrant;
601
+ /**
602
+ * Generates valid Mermaid quadrantChart syntax from a parsed quadrant.
603
+ * Returns a string ready for the Mermaid renderer.
604
+ */
605
+ declare function buildMermaidQuadrant(parsed: ParsedQuadrant, options?: {
606
+ isDark?: boolean;
607
+ textColor?: string;
608
+ mutedTextColor?: string;
609
+ }): string;
610
+
611
+ interface RenderStep {
612
+ type: 'call' | 'return';
613
+ from: string;
614
+ to: string;
615
+ label: string;
616
+ messageIndex: number;
617
+ async?: boolean;
618
+ }
619
+ /**
620
+ * Build an ordered render sequence from flat messages.
621
+ * Uses a call stack to infer where returns should be placed:
622
+ * returns appear after all nested sub-calls complete.
623
+ */
624
+ declare function buildRenderSequence(messages: SequenceMessage[]): RenderStep[];
625
+ interface Activation {
626
+ participantId: string;
627
+ startStep: number;
628
+ endStep: number;
629
+ depth: number;
630
+ }
631
+ /**
632
+ * Compute activation rectangles from render steps.
633
+ * Each call pushes onto the callee's stack; each return pops it.
634
+ */
635
+ declare function computeActivations(steps: RenderStep[]): Activation[];
636
+ /**
637
+ * Reorder participants based on explicit `position` overrides.
638
+ * Positive positions are 0-based from the left; negative positions count from the right (-1 = last).
639
+ * Unpositioned participants maintain their relative order, filling remaining slots.
640
+ */
641
+ declare function applyPositionOverrides(participants: SequenceParticipant[]): SequenceParticipant[];
642
+ /**
643
+ * Reorder participants so that members of the same group are adjacent.
644
+ * Groups appear in declaration order, followed by ungrouped participants.
645
+ */
646
+ declare function applyGroupOrdering(participants: SequenceParticipant[], groups: SequenceGroup[]): SequenceParticipant[];
647
+ /**
648
+ * Render a sequence diagram into the given container element.
649
+ */
650
+ declare function renderSequenceDiagram(container: HTMLDivElement, parsed: ParsedSequenceDgmo, palette: PaletteColors, isDark: boolean, _onNavigateToLine?: (line: number) => void): void;
651
+
652
+ /** Complete 16-entry Nord palette. */
653
+ declare const nord: {
654
+ nord0: string;
655
+ nord1: string;
656
+ nord2: string;
657
+ nord3: string;
658
+ nord4: string;
659
+ nord5: string;
660
+ nord6: string;
661
+ nord7: string;
662
+ nord8: string;
663
+ nord9: string;
664
+ nord10: string;
665
+ nord11: string;
666
+ nord12: string;
667
+ nord13: string;
668
+ nord14: string;
669
+ nord15: string;
670
+ };
671
+ /** Color name → Nord hex for inline `(color)` annotations. */
672
+ declare const colorNames: Record<string, string>;
673
+ /**
674
+ * Resolves a color name or hex code to a valid CSS color.
675
+ * When a palette is provided, named colors resolve against its color map first.
676
+ * Hex codes (e.g. "#ff0000") are passed through regardless of palette (FR8).
677
+ * Unknown names are returned as-is.
678
+ */
679
+ declare function resolveColor(color: string, palette?: {
680
+ colors: Record<string, string>;
681
+ }): string;
682
+ /** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
683
+ declare const seriesColors: string[];
684
+
685
+ export { type Activation, type ArcLink, type ArcNodeGroup, type ChartJsChartType, type ChartJsDataPoint, type D3ChartType, DGMO_CHART_TYPE_MAP, type DgmoFramework, type EChartsChartType, type PaletteColors, type PaletteConfig, type ParsedChartJs, type ParsedD3, type ParsedEChart, type ParsedQuadrant, type ParsedSequenceDgmo, type ParticipantType, RULE_COUNT, type RenderStep, type SequenceBlock, type SequenceElement, type SequenceGroup, type SequenceMessage, type SequenceParticipant, type SequenceSection, addDurationToDate, applyGroupOrdering, applyPositionOverrides, boldPalette, buildChartJsConfig, buildEChartsOption, buildMermaidQuadrant, buildMermaidThemeVars, buildRenderSequence, buildThemeCSS, catppuccinPalette, colorNames, computeActivations, computeTimeTicks, contrastText, formatDateLabel, getAvailablePalettes, getDgmoFramework, getPalette, getSeriesColors, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, isSequenceBlock, isValidHex, looksLikeSequence, mute, nord, nordPalette, oneDarkPalette, orderArcNodes, parseChartJs, parseD3, parseDgmoChartType, parseEChart, parseQuadrant, parseSequenceDgmo, parseTimelineDate, registerPalette, renderArcDiagram, renderD3ForExport, renderQuadrant, renderSequenceDiagram, renderSlopeChart, renderTimeline, renderVenn, renderWordCloud, resolveColor, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette };