@diagrammo/dgmo 0.8.18 → 0.8.20
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/dist/cli.cjs +89 -130
- package/dist/index.cjs +1202 -993
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +216 -114
- package/dist/index.d.ts +216 -114
- package/dist/index.js +1211 -985
- package/dist/index.js.map +1 -1
- package/docs/language-reference.md +73 -0
- package/package.json +22 -9
- package/src/boxes-and-lines/parser.ts +8 -3
- package/src/c4/parser.ts +8 -7
- package/src/class/parser.ts +6 -0
- package/src/cli.ts +1 -9
- package/src/d3.ts +16 -234
- package/src/dgmo-router.ts +97 -5
- package/src/diagnostics.ts +16 -6
- package/src/echarts.ts +43 -10
- package/src/er/parser.ts +22 -2
- package/src/gantt/renderer.ts +153 -91
- package/src/graph/flowchart-parser.ts +89 -52
- package/src/graph/state-parser.ts +60 -35
- package/src/index.ts +23 -18
- package/src/infra/parser.ts +9 -2
- package/src/kanban/renderer.ts +2 -2
- package/src/palettes/color-utils.ts +4 -12
- package/src/palettes/index.ts +0 -4
- package/src/render.ts +30 -16
- package/src/sequence/collapse.ts +169 -0
- package/src/sequence/parser.ts +21 -4
- package/src/sequence/renderer.ts +198 -52
- package/src/sharing.ts +86 -49
- package/src/sitemap/renderer.ts +1 -6
- package/src/utils/arrows.ts +180 -11
- package/src/utils/d3-types.ts +4 -0
- package/src/utils/legend-constants.ts +11 -4
- package/src/utils/legend-d3.ts +171 -0
- package/src/utils/legend-layout.ts +140 -13
- package/src/utils/legend-types.ts +45 -0
- package/src/utils/time-ticks.ts +213 -0
- package/src/branding.ts +0 -67
- package/src/dgmo-mermaid.ts +0 -262
- package/src/palettes/mermaid-bridge.ts +0 -220
package/dist/index.d.ts
CHANGED
|
@@ -8,10 +8,86 @@ interface DgmoError {
|
|
|
8
8
|
column?: number;
|
|
9
9
|
message: string;
|
|
10
10
|
severity: DgmoSeverity;
|
|
11
|
+
/**
|
|
12
|
+
* Optional stable diagnostic code (e.g. 'E_ARROW_SUBSTRING_IN_LABEL').
|
|
13
|
+
* Additive; pre-existing diagnostics omit this field and existing
|
|
14
|
+
* substring-on-`.message` assertions keep working unchanged.
|
|
15
|
+
*/
|
|
16
|
+
code?: string;
|
|
11
17
|
}
|
|
12
|
-
declare function makeDgmoError(line: number, message: string, severity?: DgmoSeverity): DgmoError;
|
|
18
|
+
declare function makeDgmoError(line: number, message: string, severity?: DgmoSeverity, code?: string): DgmoError;
|
|
13
19
|
declare function formatDgmoError(err: DgmoError): string;
|
|
14
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Stable diagnostic codes for in-arrow label parsing errors.
|
|
23
|
+
*
|
|
24
|
+
* **Active codes** — emitted by the parser pipeline today:
|
|
25
|
+
* - `ARROW_SUBSTRING_IN_LABEL` (TD-13)
|
|
26
|
+
* - `CONTROL_CHAR_IN_LABEL` (TD-14)
|
|
27
|
+
*
|
|
28
|
+
* **Reserved codes** — declared but NOT currently emitted. These are
|
|
29
|
+
* placeholders for future tightening of the arrow-tokenization rules
|
|
30
|
+
* described in TD-9. Today's chart parsers catch these cases through
|
|
31
|
+
* their own regex machinery with different diagnostics. A follow-up
|
|
32
|
+
* spec that introduces a dedicated tokenizer can start emitting them
|
|
33
|
+
* without changing the public code shape:
|
|
34
|
+
* - `TRAILING_ARROW_TEXT` — extra `->`/`~>` after the primary arrow
|
|
35
|
+
* - `MIXED_ARROW_DELIMITERS` — opening delim type doesn't match arrow
|
|
36
|
+
*
|
|
37
|
+
* See `docs/dgmo-language-spec-decisions.md` → TD-16 for the rationale.
|
|
38
|
+
*/
|
|
39
|
+
declare const ARROW_DIAGNOSTIC_CODES: {
|
|
40
|
+
/** Active: label contains `->` or `~>` substring (TD-13). */
|
|
41
|
+
readonly ARROW_SUBSTRING_IN_LABEL: "E_ARROW_SUBSTRING_IN_LABEL";
|
|
42
|
+
/** Active: label contains a forbidden control character (TD-14). */
|
|
43
|
+
readonly CONTROL_CHAR_IN_LABEL: "E_CONTROL_CHAR_IN_LABEL";
|
|
44
|
+
/** Reserved: not currently emitted by any parser. See JSDoc above. */
|
|
45
|
+
readonly TRAILING_ARROW_TEXT: "E_TRAILING_ARROW_TEXT";
|
|
46
|
+
/** Reserved: not currently emitted by any parser. See JSDoc above. */
|
|
47
|
+
readonly MIXED_ARROW_DELIMITERS: "E_MIXED_ARROW_DELIMITERS";
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Validate an in-arrow label against the TD-13 and TD-14 character-set
|
|
51
|
+
* contract. Returns diagnostics (possibly empty). Does NOT mutate the label —
|
|
52
|
+
* callers that want a normalized label should trim before calling.
|
|
53
|
+
*
|
|
54
|
+
* TD-13: label must not contain the substrings "->" or "~>".
|
|
55
|
+
* TD-14: label must not contain C0 control chars other than tab, and no DEL.
|
|
56
|
+
*/
|
|
57
|
+
declare function validateLabelCharacters(label: string, lineNumber: number): DgmoError[];
|
|
58
|
+
interface ParseInArrowLabelResult {
|
|
59
|
+
/** Cleaned label (trimmed; `undefined` if empty after trim per TD-10). */
|
|
60
|
+
label: string | undefined;
|
|
61
|
+
diagnostics: DgmoError[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Normalize and validate a raw in-arrow label.
|
|
65
|
+
*
|
|
66
|
+
* Behavior:
|
|
67
|
+
* - Trims leading/trailing whitespace (TD-8: internal whitespace preserved).
|
|
68
|
+
* - Empty-after-trim → `{ label: undefined }` (TD-10 normalization).
|
|
69
|
+
* - TD-13: emits `E_ARROW_SUBSTRING_IN_LABEL` if `->` or `~>` is present.
|
|
70
|
+
* - TD-14: emits `E_CONTROL_CHAR_IN_LABEL` for forbidden control chars.
|
|
71
|
+
*
|
|
72
|
+
* This helper is intentionally chart-agnostic: it operates on an already
|
|
73
|
+
* extracted label string, leaving each chart's existing arrow-finding
|
|
74
|
+
* tokenization in place. TD-11 color-parens is handled inside the
|
|
75
|
+
* flowchart and state `parseArrowToken` functions because those are the
|
|
76
|
+
* only charts that interpret `-(color)->` as a colored edge; they use
|
|
77
|
+
* `matchColorParens()` from this module for the shared lookup.
|
|
78
|
+
*/
|
|
79
|
+
declare function parseInArrowLabel(rawLabel: string, lineNumber: number): ParseInArrowLabelResult;
|
|
80
|
+
/**
|
|
81
|
+
* Test whether a string matches the TD-11 color-parens form `(colorName)`
|
|
82
|
+
* where `colorName` is one of the 11 recognized palette color names from
|
|
83
|
+
* `src/colors.ts:RECOGNIZED_COLOR_NAMES`. Returns the lowercase color name
|
|
84
|
+
* on a match, or `null` on fall-through (whole string becomes a label).
|
|
85
|
+
*
|
|
86
|
+
* Used by flowchart and state parsers to keep the color-parens recognition
|
|
87
|
+
* rule in one place — do NOT re-implement the regex in chart parsers.
|
|
88
|
+
*/
|
|
89
|
+
declare function matchColorParens(content: string): string | null;
|
|
90
|
+
|
|
15
91
|
/**
|
|
16
92
|
* Render DGMO source to an SVG string.
|
|
17
93
|
*
|
|
@@ -20,13 +96,13 @@ declare function formatDgmoError(err: DgmoError): string;
|
|
|
20
96
|
*
|
|
21
97
|
* @param content - DGMO source text
|
|
22
98
|
* @param options - Optional theme and palette settings
|
|
23
|
-
* @returns SVG string,
|
|
99
|
+
* @returns Object with `svg` (SVG string, empty on error) and `diagnostics` (parse errors/warnings)
|
|
24
100
|
*
|
|
25
101
|
* @example
|
|
26
102
|
* ```ts
|
|
27
103
|
* import { render } from '@diagrammo/dgmo';
|
|
28
104
|
*
|
|
29
|
-
* const svg = await render(`pie Languages
|
|
105
|
+
* const { svg, diagnostics } = await render(`pie Languages
|
|
30
106
|
* TypeScript: 45
|
|
31
107
|
* Python: 30
|
|
32
108
|
* Rust: 25`);
|
|
@@ -35,7 +111,6 @@ declare function formatDgmoError(err: DgmoError): string;
|
|
|
35
111
|
declare function render(content: string, options?: {
|
|
36
112
|
theme?: 'light' | 'dark' | 'transparent';
|
|
37
113
|
palette?: string;
|
|
38
|
-
branding?: boolean;
|
|
39
114
|
c4Level?: 'context' | 'containers' | 'components' | 'deployment';
|
|
40
115
|
c4System?: string;
|
|
41
116
|
c4Container?: string;
|
|
@@ -45,7 +120,10 @@ declare function render(content: string, options?: {
|
|
|
45
120
|
activeGroup?: string;
|
|
46
121
|
hiddenAttributes?: string[];
|
|
47
122
|
};
|
|
48
|
-
}): Promise<
|
|
123
|
+
}): Promise<{
|
|
124
|
+
svg: string;
|
|
125
|
+
diagnostics: DgmoError[];
|
|
126
|
+
}>;
|
|
49
127
|
|
|
50
128
|
/**
|
|
51
129
|
* Extracts the chart type from raw file content.
|
|
@@ -156,13 +234,6 @@ declare function hexToHSL(hex: string): {
|
|
|
156
234
|
declare function hslToHex(h: number, s: number, l: number): string;
|
|
157
235
|
/** Convert hex to "H S% L%" string for CSS custom properties. */
|
|
158
236
|
declare function hexToHSLString(hex: string): string;
|
|
159
|
-
/**
|
|
160
|
-
* Derive a muted (desaturated, darkened) variant of a color.
|
|
161
|
-
* Used by the Mermaid theme generator for dark-mode fills.
|
|
162
|
-
*
|
|
163
|
-
* Algorithm: cap saturation at 35% and lightness at 36%.
|
|
164
|
-
*/
|
|
165
|
-
declare function mute(hex: string): string;
|
|
166
237
|
/**
|
|
167
238
|
* Blend a color toward white (light mode quadrant fills).
|
|
168
239
|
* amount: 0 = original, 1 = white
|
|
@@ -203,20 +274,6 @@ declare const draculaPalette: PaletteConfig;
|
|
|
203
274
|
|
|
204
275
|
declare const monokaiPalette: PaletteConfig;
|
|
205
276
|
|
|
206
|
-
/**
|
|
207
|
-
* Generates ~121 Mermaid theme variables from palette tokens.
|
|
208
|
-
* Replaces the hardcoded lightThemeVars/darkThemeVars objects.
|
|
209
|
-
*
|
|
210
|
-
* Dark mode fills use `mute()` to derive desaturated variants
|
|
211
|
-
* that are readable with light text.
|
|
212
|
-
*/
|
|
213
|
-
declare function buildMermaidThemeVars(colors: PaletteColors, isDark: boolean): Record<string, string>;
|
|
214
|
-
/**
|
|
215
|
-
* Generates custom CSS overrides for Mermaid SVGs.
|
|
216
|
-
* Handles git graph label backgrounds and dark-mode text readability.
|
|
217
|
-
*/
|
|
218
|
-
declare function buildThemeCSS(palette: PaletteColors, isDark: boolean): string;
|
|
219
|
-
|
|
220
277
|
type ChartType$1 = 'bar' | 'line' | 'pie' | 'doughnut' | 'area' | 'polar-area' | 'radar' | 'bar-stacked';
|
|
221
278
|
interface ChartDataPoint {
|
|
222
279
|
label: string;
|
|
@@ -298,6 +355,7 @@ declare function parseDataRowValues(line: string, options?: {
|
|
|
298
355
|
interface LegendState {
|
|
299
356
|
activeGroup: string | null;
|
|
300
357
|
hiddenAttributes?: Set<string>;
|
|
358
|
+
controlsExpanded?: boolean;
|
|
301
359
|
}
|
|
302
360
|
interface LegendCallbacks {
|
|
303
361
|
onGroupToggle?: (groupName: string) => void;
|
|
@@ -307,6 +365,10 @@ interface LegendCallbacks {
|
|
|
307
365
|
onEntryHover?: (groupName: string, entryValue: string | null) => void;
|
|
308
366
|
/** Called after each group <g> is rendered — lets chart renderers inject custom elements (swimlane icons, etc.) */
|
|
309
367
|
onGroupRendered?: (groupName: string, groupEl: D3Sel, isActive: boolean) => void;
|
|
368
|
+
/** Called when the controls group gear pill is clicked (expand/collapse) */
|
|
369
|
+
onControlsExpand?: () => void;
|
|
370
|
+
/** Called when a controls group toggle entry is clicked */
|
|
371
|
+
onControlsToggle?: (toggleId: string, active: boolean) => void;
|
|
310
372
|
}
|
|
311
373
|
interface LegendPosition {
|
|
312
374
|
placement: 'top-center';
|
|
@@ -329,10 +391,22 @@ interface LegendControlEntry {
|
|
|
329
391
|
isActive?: boolean;
|
|
330
392
|
onClick?: () => void;
|
|
331
393
|
}
|
|
394
|
+
interface ControlsGroupToggle {
|
|
395
|
+
id: string;
|
|
396
|
+
/** Only 'toggle' is implemented in v1. 'select' and 'action' future-proof for Infra playback etc. */
|
|
397
|
+
type: 'toggle' | 'select' | 'action';
|
|
398
|
+
label: string;
|
|
399
|
+
active: boolean;
|
|
400
|
+
onToggle: (active: boolean) => void;
|
|
401
|
+
}
|
|
402
|
+
interface ControlsGroupConfig {
|
|
403
|
+
toggles: ControlsGroupToggle[];
|
|
404
|
+
}
|
|
332
405
|
interface LegendConfig {
|
|
333
406
|
groups: LegendGroupData[];
|
|
334
407
|
position: LegendPosition;
|
|
335
408
|
controls?: LegendControl[];
|
|
409
|
+
controlsGroup?: ControlsGroupConfig;
|
|
336
410
|
mode: LegendMode;
|
|
337
411
|
/** Title width in pixels — used for inline-with-title computation */
|
|
338
412
|
titleWidth?: number;
|
|
@@ -397,6 +471,31 @@ interface LegendControlLayout {
|
|
|
397
471
|
isActive?: boolean;
|
|
398
472
|
}>;
|
|
399
473
|
}
|
|
474
|
+
interface ControlsGroupToggleLayout {
|
|
475
|
+
id: string;
|
|
476
|
+
label: string;
|
|
477
|
+
active: boolean;
|
|
478
|
+
dotCx: number;
|
|
479
|
+
dotCy: number;
|
|
480
|
+
textX: number;
|
|
481
|
+
textY: number;
|
|
482
|
+
}
|
|
483
|
+
interface ControlsGroupLayout {
|
|
484
|
+
x: number;
|
|
485
|
+
y: number;
|
|
486
|
+
width: number;
|
|
487
|
+
height: number;
|
|
488
|
+
expanded: boolean;
|
|
489
|
+
/** The gear pill layout (collapsed or inside capsule) */
|
|
490
|
+
pill: {
|
|
491
|
+
x: number;
|
|
492
|
+
y: number;
|
|
493
|
+
width: number;
|
|
494
|
+
height: number;
|
|
495
|
+
};
|
|
496
|
+
/** Toggle entries (only present when expanded) */
|
|
497
|
+
toggles: ControlsGroupToggleLayout[];
|
|
498
|
+
}
|
|
400
499
|
interface LegendRowLayout {
|
|
401
500
|
y: number;
|
|
402
501
|
items: Array<LegendPillLayout | LegendCapsuleLayout | LegendControlLayout>;
|
|
@@ -414,6 +513,8 @@ interface LegendLayout {
|
|
|
414
513
|
controls: LegendControlLayout[];
|
|
415
514
|
/** All pill layouts (collapsed groups) */
|
|
416
515
|
pills: LegendPillLayout[];
|
|
516
|
+
/** Controls group layout (gear pill / capsule) */
|
|
517
|
+
controlsGroup?: ControlsGroupLayout;
|
|
417
518
|
}
|
|
418
519
|
interface LegendHandle {
|
|
419
520
|
setState: (state: LegendState) => void;
|
|
@@ -584,9 +685,12 @@ declare function buildSimpleChartOption(parsed: ParsedChart, palette: PaletteCol
|
|
|
584
685
|
* Renders an extended chart (scatter, sankey, chord, function, heatmap, funnel) to SVG using server-side rendering.
|
|
585
686
|
* Mirrors the `renderForExport` API — returns an SVG string or empty string on failure.
|
|
586
687
|
*/
|
|
587
|
-
declare function renderExtendedChartForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette?: PaletteColors
|
|
588
|
-
|
|
589
|
-
|
|
688
|
+
declare function renderExtendedChartForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette?: PaletteColors): Promise<string>;
|
|
689
|
+
|
|
690
|
+
interface D3ExportDimensions {
|
|
691
|
+
width?: number;
|
|
692
|
+
height?: number;
|
|
693
|
+
}
|
|
590
694
|
|
|
591
695
|
/** A single entry inside a tag group: `Value(color)` */
|
|
592
696
|
interface TagEntry {
|
|
@@ -676,7 +780,7 @@ interface VennOverlap {
|
|
|
676
780
|
label: string | null;
|
|
677
781
|
lineNumber: number;
|
|
678
782
|
}
|
|
679
|
-
interface QuadrantLabel
|
|
783
|
+
interface QuadrantLabel {
|
|
680
784
|
text: string;
|
|
681
785
|
color: string | null;
|
|
682
786
|
lineNumber: number;
|
|
@@ -688,16 +792,12 @@ interface QuadrantPoint {
|
|
|
688
792
|
lineNumber: number;
|
|
689
793
|
}
|
|
690
794
|
interface QuadrantLabels {
|
|
691
|
-
topRight: QuadrantLabel
|
|
692
|
-
topLeft: QuadrantLabel
|
|
693
|
-
bottomLeft: QuadrantLabel
|
|
694
|
-
bottomRight: QuadrantLabel
|
|
695
|
-
}
|
|
696
|
-
/** Optional explicit dimensions for CLI/export rendering (bypasses DOM layout). */
|
|
697
|
-
interface D3ExportDimensions {
|
|
698
|
-
width?: number;
|
|
699
|
-
height?: number;
|
|
795
|
+
topRight: QuadrantLabel | null;
|
|
796
|
+
topLeft: QuadrantLabel | null;
|
|
797
|
+
bottomLeft: QuadrantLabel | null;
|
|
798
|
+
bottomRight: QuadrantLabel | null;
|
|
700
799
|
}
|
|
800
|
+
|
|
701
801
|
interface ParsedVisualization {
|
|
702
802
|
type: VisualizationType | null;
|
|
703
803
|
title: string | null;
|
|
@@ -767,20 +867,6 @@ declare function renderArcDiagram(container: HTMLDivElement, parsed: ParsedVisua
|
|
|
767
867
|
* '2024-06-15 14:30' → 'Jun 15, 2024 14:30'
|
|
768
868
|
*/
|
|
769
869
|
declare function formatDateLabel(dateStr: string): string;
|
|
770
|
-
/**
|
|
771
|
-
* Computes adaptive tick marks for a timeline scale.
|
|
772
|
-
* - Multi-year spans → year ticks
|
|
773
|
-
* - Within ~1 year → month ticks
|
|
774
|
-
* - Within ~3 months → week ticks (1st, 8th, 15th, 22nd)
|
|
775
|
-
*
|
|
776
|
-
* Optional boundary parameters add ticks at exact data start/end:
|
|
777
|
-
* - boundaryStart/boundaryEnd: numeric date values
|
|
778
|
-
* - boundaryStartLabel/boundaryEndLabel: formatted labels for those dates
|
|
779
|
-
*/
|
|
780
|
-
declare function computeTimeTicks(domainMin: number, domainMax: number, scale: d3Scale.ScaleLinear<number, number>, boundaryStart?: number, boundaryEnd?: number, boundaryStartLabel?: string, boundaryEndLabel?: string): {
|
|
781
|
-
pos: number;
|
|
782
|
-
label: string;
|
|
783
|
-
}[];
|
|
784
870
|
/**
|
|
785
871
|
* Renders a timeline chart into the given container using D3.
|
|
786
872
|
* Supports horizontal (default) and vertical orientation.
|
|
@@ -806,13 +892,26 @@ declare function renderForExport(content: string, theme: 'light' | 'dark' | 'tra
|
|
|
806
892
|
hiddenAttributes?: Set<string>;
|
|
807
893
|
swimlaneTagGroup?: string | null;
|
|
808
894
|
}, options?: {
|
|
809
|
-
branding?: boolean;
|
|
810
895
|
c4Level?: 'context' | 'containers' | 'components' | 'deployment';
|
|
811
896
|
c4System?: string;
|
|
812
897
|
c4Container?: string;
|
|
813
898
|
tagGroup?: string;
|
|
814
899
|
}): Promise<string>;
|
|
815
900
|
|
|
901
|
+
/**
|
|
902
|
+
* Generates adaptive tick marks along a time axis.
|
|
903
|
+
* Picks the right granularity (years, months, weeks, days, hours, minutes)
|
|
904
|
+
* based on the domain span.
|
|
905
|
+
*
|
|
906
|
+
* Optional boundary parameters add ticks at exact data start/end:
|
|
907
|
+
* - boundaryStart/boundaryEnd: numeric date values
|
|
908
|
+
* - boundaryStartLabel/boundaryEndLabel: formatted labels for those dates
|
|
909
|
+
*/
|
|
910
|
+
declare function computeTimeTicks(domainMin: number, domainMax: number, scale: d3Scale.ScaleLinear<number, number>, boundaryStart?: number, boundaryEnd?: number, boundaryStartLabel?: string, boundaryEndLabel?: string): {
|
|
911
|
+
pos: number;
|
|
912
|
+
label: string;
|
|
913
|
+
}[];
|
|
914
|
+
|
|
816
915
|
/**
|
|
817
916
|
* Participant types that can be declared via "Name is a type" syntax.
|
|
818
917
|
*/
|
|
@@ -895,6 +994,8 @@ interface SequenceGroup {
|
|
|
895
994
|
lineNumber: number;
|
|
896
995
|
/** Pipe-delimited tag metadata (e.g. `[Backend | t: Product]`) */
|
|
897
996
|
metadata?: Record<string, string>;
|
|
997
|
+
/** Whether this group is collapsed by default */
|
|
998
|
+
collapsed?: boolean;
|
|
898
999
|
}
|
|
899
1000
|
/**
|
|
900
1001
|
* Parsed result from a .dgmo sequence diagram.
|
|
@@ -932,48 +1033,6 @@ declare function inferParticipantType(name: string): ParticipantType;
|
|
|
932
1033
|
*/
|
|
933
1034
|
declare const RULE_COUNT: number;
|
|
934
1035
|
|
|
935
|
-
interface QuadrantLabel {
|
|
936
|
-
text: string;
|
|
937
|
-
color: string | null;
|
|
938
|
-
lineNumber: number;
|
|
939
|
-
}
|
|
940
|
-
interface ParsedQuadrant {
|
|
941
|
-
title: string | null;
|
|
942
|
-
titleLineNumber: number | null;
|
|
943
|
-
xAxis: [string, string] | null;
|
|
944
|
-
xAxisLineNumber: number | null;
|
|
945
|
-
yAxis: [string, string] | null;
|
|
946
|
-
yAxisLineNumber: number | null;
|
|
947
|
-
quadrants: {
|
|
948
|
-
topRight: QuadrantLabel | null;
|
|
949
|
-
topLeft: QuadrantLabel | null;
|
|
950
|
-
bottomLeft: QuadrantLabel | null;
|
|
951
|
-
bottomRight: QuadrantLabel | null;
|
|
952
|
-
};
|
|
953
|
-
points: {
|
|
954
|
-
label: string;
|
|
955
|
-
x: number;
|
|
956
|
-
y: number;
|
|
957
|
-
lineNumber: number;
|
|
958
|
-
}[];
|
|
959
|
-
diagnostics: DgmoError[];
|
|
960
|
-
error: string | null;
|
|
961
|
-
}
|
|
962
|
-
/**
|
|
963
|
-
* Parses a .dgmo quadrant document into a structured object.
|
|
964
|
-
* Lines are processed sequentially; unknown lines are silently skipped.
|
|
965
|
-
*/
|
|
966
|
-
declare function parseQuadrant(content: string): ParsedQuadrant;
|
|
967
|
-
/**
|
|
968
|
-
* Generates valid Mermaid quadrantChart syntax from a parsed quadrant.
|
|
969
|
-
* Returns a string ready for the Mermaid renderer.
|
|
970
|
-
*/
|
|
971
|
-
declare function buildMermaidQuadrant(parsed: ParsedQuadrant, options?: {
|
|
972
|
-
isDark?: boolean;
|
|
973
|
-
textColor?: string;
|
|
974
|
-
mutedTextColor?: string;
|
|
975
|
-
}): string;
|
|
976
|
-
|
|
977
1036
|
type GraphShape = 'terminal' | 'process' | 'decision' | 'io' | 'subroutine' | 'document' | 'state' | 'pseudostate';
|
|
978
1037
|
type GraphDirection = 'TB' | 'LR';
|
|
979
1038
|
interface GraphNode {
|
|
@@ -2456,6 +2515,7 @@ interface SectionMessageGroup {
|
|
|
2456
2515
|
}
|
|
2457
2516
|
interface SequenceRenderOptions {
|
|
2458
2517
|
collapsedSections?: Set<number>;
|
|
2518
|
+
collapsedGroups?: Set<number>;
|
|
2459
2519
|
expandedNoteLines?: Set<number>;
|
|
2460
2520
|
exportWidth?: number;
|
|
2461
2521
|
activeTagGroup?: string | null;
|
|
@@ -2518,6 +2578,23 @@ declare function renderSequenceDiagram(container: HTMLDivElement, parsed: Parsed
|
|
|
2518
2578
|
*/
|
|
2519
2579
|
declare function buildNoteMessageMap(elements: SequenceElement[]): Map<number, number>;
|
|
2520
2580
|
|
|
2581
|
+
interface CollapsedView {
|
|
2582
|
+
participants: SequenceParticipant[];
|
|
2583
|
+
messages: SequenceMessage[];
|
|
2584
|
+
elements: SequenceElement[];
|
|
2585
|
+
groups: SequenceGroup[];
|
|
2586
|
+
/** Maps member participant ID → collapsed group name */
|
|
2587
|
+
collapsedGroupIds: Map<string, string>;
|
|
2588
|
+
}
|
|
2589
|
+
/**
|
|
2590
|
+
* Project a parsed sequence diagram into a collapsed view.
|
|
2591
|
+
*
|
|
2592
|
+
* @param parsed - The immutable parsed sequence diagram
|
|
2593
|
+
* @param collapsedGroups - Set of group lineNumbers that should be collapsed
|
|
2594
|
+
* @returns A new CollapsedView with remapped participants, messages, elements, and groups
|
|
2595
|
+
*/
|
|
2596
|
+
declare function applyCollapseProjection(parsed: ParsedSequenceDgmo, collapsedGroups: Set<number>): CollapsedView;
|
|
2597
|
+
|
|
2521
2598
|
/** Complete 16-entry Nord palette. */
|
|
2522
2599
|
declare const nord: {
|
|
2523
2600
|
nord0: string;
|
|
@@ -2572,22 +2649,43 @@ declare function resolveColorWithDiagnostic(color: string, line: number, diagnos
|
|
|
2572
2649
|
/** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
|
|
2573
2650
|
declare const seriesColors: string[];
|
|
2574
2651
|
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2652
|
+
/**
|
|
2653
|
+
* Compact view state schema (ADR-6).
|
|
2654
|
+
* All fields optional. Only non-default values are encoded.
|
|
2655
|
+
* `tag: null` means "user chose none"; absent `tag` means "use DSL default" (ADR-5).
|
|
2656
|
+
*/
|
|
2657
|
+
interface CompactViewState {
|
|
2658
|
+
tag?: string | null;
|
|
2659
|
+
cs?: number[];
|
|
2660
|
+
cg?: string[];
|
|
2661
|
+
swim?: string | null;
|
|
2662
|
+
cl?: string[];
|
|
2663
|
+
cc?: string[];
|
|
2664
|
+
rm?: string;
|
|
2665
|
+
htv?: Record<string, string[]>;
|
|
2666
|
+
ha?: string[];
|
|
2667
|
+
enl?: number[];
|
|
2668
|
+
sem?: boolean;
|
|
2669
|
+
cm?: boolean;
|
|
2670
|
+
c4l?: string;
|
|
2671
|
+
c4s?: string;
|
|
2672
|
+
c4c?: string;
|
|
2673
|
+
rps?: number;
|
|
2674
|
+
spd?: number;
|
|
2675
|
+
io?: Record<string, number>;
|
|
2582
2676
|
}
|
|
2583
2677
|
interface DecodedDiagramUrl {
|
|
2584
2678
|
dsl: string;
|
|
2585
|
-
viewState:
|
|
2679
|
+
viewState: CompactViewState;
|
|
2680
|
+
palette?: string;
|
|
2681
|
+
theme?: 'light' | 'dark';
|
|
2586
2682
|
filename?: string;
|
|
2587
2683
|
}
|
|
2588
2684
|
interface EncodeDiagramUrlOptions {
|
|
2589
2685
|
baseUrl?: string;
|
|
2590
|
-
viewState?:
|
|
2686
|
+
viewState?: CompactViewState;
|
|
2687
|
+
palette?: string;
|
|
2688
|
+
theme?: 'light' | 'dark';
|
|
2591
2689
|
filename?: string;
|
|
2592
2690
|
}
|
|
2593
2691
|
type EncodeDiagramUrlResult = {
|
|
@@ -2599,6 +2697,16 @@ type EncodeDiagramUrlResult = {
|
|
|
2599
2697
|
compressedSize: number;
|
|
2600
2698
|
limit: number;
|
|
2601
2699
|
};
|
|
2700
|
+
/**
|
|
2701
|
+
* Encode a CompactViewState to a compressed string for URL embedding.
|
|
2702
|
+
* Returns empty string if state has no keys (ADR-4).
|
|
2703
|
+
*/
|
|
2704
|
+
declare function encodeViewState(state: CompactViewState): string;
|
|
2705
|
+
/**
|
|
2706
|
+
* Decode a compressed view state string back to CompactViewState.
|
|
2707
|
+
* Returns empty object on failure (no crash).
|
|
2708
|
+
*/
|
|
2709
|
+
declare function decodeViewState(encoded: string): CompactViewState;
|
|
2602
2710
|
/**
|
|
2603
2711
|
* Compress a DGMO DSL string into a shareable URL.
|
|
2604
2712
|
* Returns `{ url }` on success, or `{ error: 'too-large', compressedSize, limit }` if the
|
|
@@ -2608,8 +2716,8 @@ declare function encodeDiagramUrl(dsl: string, options?: EncodeDiagramUrlOptions
|
|
|
2608
2716
|
/**
|
|
2609
2717
|
* Decode a DGMO DSL string and view state from a URL query string or hash.
|
|
2610
2718
|
* Accepts any of:
|
|
2611
|
-
* - `?dgmo=<payload>&
|
|
2612
|
-
* - `#dgmo=<payload>&
|
|
2719
|
+
* - `?dgmo=<payload>&vs=<state>`
|
|
2720
|
+
* - `#dgmo=<payload>&vs=<state>` (backwards compat)
|
|
2613
2721
|
* - `dgmo=<payload>`
|
|
2614
2722
|
* - `<bare payload>`
|
|
2615
2723
|
*
|
|
@@ -2636,10 +2744,4 @@ declare function parseFirstLine(line: string): {
|
|
|
2636
2744
|
title: string | undefined;
|
|
2637
2745
|
} | null;
|
|
2638
2746
|
|
|
2639
|
-
|
|
2640
|
-
* Injects `diagrammo.app` branding text into an SVG string.
|
|
2641
|
-
* Extends the SVG height by 20px and places the text at the bottom-right.
|
|
2642
|
-
*/
|
|
2643
|
-
declare function injectBranding(svgHtml: string, mutedColor: string): string;
|
|
2644
|
-
|
|
2645
|
-
export { ALL_CHART_TYPES, type Activation, type ArcLink, type ArcNodeGroup, type BLCollapseResult, type BLEdge, type BLGroup, type BLLayoutEdge, type BLLayoutGroup, type BLLayoutNode, type BLLayoutResult, type BLNode, type C4ArrowType, type C4DeploymentNode, type C4Element, type C4ElementType, type C4Group, type C4LayoutBoundary, type C4LayoutEdge, type C4LayoutNode, type C4LayoutResult, type C4LegendEntry, type C4LegendGroup, type C4Relationship, type C4Shape, type C4TagEntry, type C4TagGroup, CHART_TYPES, COMPLETION_REGISTRY, type ChartDataPoint, type ChartEra, type ChartType$1 as ChartType, type ClassLayoutEdge, type ClassLayoutNode, type ClassLayoutResult, type ClassMember, type ClassModifier, type ClassNode, type ClassRelationship, type CollapsedOrgResult, type CollapsedSitemapResult, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, type D3ExportDimensions, type DecodedDiagramUrl, type DgmoError, type DgmoSeverity, type DiagramSymbols, type DiagramViewState, type DirectiveSpec, type DirectiveValueSpec, type Duration, type DurationUnit, ENTITY_TYPES, type ERCardinality, type ERColumn, type ERConstraint, type ERLayoutEdge, type ERLayoutNode, type ERLayoutResult, type ERRelationship, type ERTable, type ElseIfBranch, type EncodeDiagramUrlOptions, type EncodeDiagramUrlResult, type ExtendedChartType, type ExtractFn, type GanttDependency, type GanttEra, type GanttGroup, type GroupRow as GanttGroupRow, type GanttHolidays, type GanttInteractiveOptions, type LaneHeaderRow as GanttLaneHeaderRow, type GanttMarker, type GanttNode, type GanttOptions, type GanttParallelBlock, type Row as GanttRow, type GanttTask, type TaskRow as GanttTaskRow, type GraphDirection, type GraphEdge, type GraphGroup, type GraphNode, type GraphShape, INFRA_BEHAVIOR_KEYS, type ImportSource, type InfraAvailabilityPercentiles, type InfraBehaviorKey, type InfraCbState, type InfraComputeParams, type InfraDiagnostic, type InfraEdge, type InfraGroup, type InfraLatencyPercentiles, type InfraLayoutEdge, type InfraLayoutGroup, type InfraLayoutNode, type InfraLayoutResult, type InfraLegendGroup, type InfraNode, type InfraPlaybackState, type InfraProperty, type InfraRole, type InfraTagGroup, type InlineSpan, type KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, LEGEND_HEIGHT, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutResult, type LegendCallbacks, type LegendConfig, type LegendControl, type LegendGroupData, type LegendHandle, type LegendLayout, type LegendMode, type LegendPalette, type LegendPosition, type LegendState, METADATA_KEY_SET, type MemberVisibility, type OrgContainerBounds, type OrgLayoutEdge, type OrgLayoutNode, type OrgLayoutResult, type OrgNode, PIPE_METADATA, type PaletteColors, type PaletteConfig, type ParsedBoxesAndLines, type ParsedC4, type ParsedChart, type ParsedClassDiagram, type ParsedERDiagram, type ParsedExtendedChart, type ParsedGantt, type ParsedGraph, type ParsedInfra, type ParsedKanban, type ParsedOrg, type ParsedQuadrant, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedVisualization, type ParticipantType, type PipeKeySpec, RECOGNIZED_COLOR_NAMES, RULE_COUNT, type ReadFileFn, type RelationshipType, type RenderCategory, type RenderStep, type ResolveImportsResult, type ResolvedGroup, type ResolvedSchedule, type ResolvedTask, type ScatterLabelPoint, type SectionMessageGroup, type SequenceBlock, type SequenceElement, type SequenceGroup, type SequenceMessage, type SequenceNote, type SequenceParticipant, type SequenceRenderOptions, type SequenceSection, type SitemapContainerBounds, type SitemapDirection, type SitemapEdge, type SitemapLayoutEdge, type SitemapLayoutNode, type SitemapLayoutResult, type SitemapLegendEntry, type SitemapLegendGroup, type SitemapNode, type TagEntry, type TagGroup, type VisualizationType, addDurationToDate, applyGroupOrdering, applyPositionOverrides, boldPalette, buildExtendedChartOption, buildMermaidQuadrant, buildMermaidThemeVars, buildNoteMessageMap, buildRenderSequence, buildSimpleChartOption, buildTagLaneRowList, buildThemeCSS, calculateSchedule, catppuccinPalette, collapseBoxesAndLines, collapseOrgTree, collapseSitemapTree, collectDiagramRoles, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeInfra, computeInfraLegendGroups, computeLegendLayout, computeScatterLabelGraphics, computeTimeTicks, contrastText, decodeDiagramUrl, draculaPalette, encodeDiagramUrl, extractDiagramSymbols, extractTagDeclarations, formatDateLabel, formatDgmoError, getAvailablePalettes, getExtendedChartLegendGroups, getLegendReservedHeight, getPalette, getRenderCategory, getSeriesColors, getSimpleChartLegendGroups, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, inferRoles, injectBranding, isArchiveColumn, isExtendedChartType, isRecognizedColorName, isSequenceBlock, isSequenceNote, isValidHex, layoutBoxesAndLines, layoutC4Components, layoutC4Containers, layoutC4Context, layoutC4Deployment, layoutClassDiagram, layoutERDiagram, layoutGraph, layoutInfra, layoutOrg, layoutSitemap, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikeSequence, looksLikeSitemap, looksLikeState, makeDgmoError, monokaiPalette, mute, nord, nordPalette, oneDarkPalette, orderArcNodes, parseAndLayoutInfra, parseBoxesAndLines, parseC4, parseChart, parseClassDiagram, parseDataRowValues, parseDgmo, parseDgmoChartType, parseERDiagram, parseExtendedChart, parseFirstLine, parseFlowchart, parseGantt, parseInfra, parseInlineMarkdown, parseKanban, parseOrg, parseQuadrant, parseSequenceDgmo, parseSitemap, parseState, parseTimelineDate, parseVisualization, registerExtractor, registerPalette, render, renderArcDiagram, renderBoxesAndLines, renderBoxesAndLinesForExport, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderERDiagram, renderERDiagramForExport, renderExtendedChartForExport, renderFlowchart, renderFlowchartForExport, renderForExport, renderGantt, renderInfra, renderKanban, renderKanbanForExport, renderLegendD3, renderLegendSvg, renderLegendSvgFromConfig, renderOrg, renderOrgForExport, renderQuadrant, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSlopeChart, renderState, renderStateForExport, renderTimeline, renderVenn, renderWordCloud, resolveColor, resolveColorWithDiagnostic, resolveOrgImports, resolveTaskName, rollUpContextRelationships, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette, truncateBareUrl, validateComputed, validateInfra };
|
|
2747
|
+
export { ALL_CHART_TYPES, ARROW_DIAGNOSTIC_CODES, type Activation, type ArcLink, type ArcNodeGroup, type BLCollapseResult, type BLEdge, type BLGroup, type BLLayoutEdge, type BLLayoutGroup, type BLLayoutNode, type BLLayoutResult, type BLNode, type C4ArrowType, type C4DeploymentNode, type C4Element, type C4ElementType, type C4Group, type C4LayoutBoundary, type C4LayoutEdge, type C4LayoutNode, type C4LayoutResult, type C4LegendEntry, type C4LegendGroup, type C4Relationship, type C4Shape, type C4TagEntry, type C4TagGroup, CHART_TYPES, COMPLETION_REGISTRY, type ChartDataPoint, type ChartEra, type ChartType$1 as ChartType, type ClassLayoutEdge, type ClassLayoutNode, type ClassLayoutResult, type ClassMember, type ClassModifier, type ClassNode, type ClassRelationship, type CollapsedOrgResult, type CollapsedSitemapResult, type CollapsedView, type CompactViewState, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, type D3ExportDimensions, type DecodedDiagramUrl, type DgmoError, type DgmoSeverity, type DiagramSymbols, type DirectiveSpec, type DirectiveValueSpec, type Duration, type DurationUnit, ENTITY_TYPES, type ERCardinality, type ERColumn, type ERConstraint, type ERLayoutEdge, type ERLayoutNode, type ERLayoutResult, type ERRelationship, type ERTable, type ElseIfBranch, type EncodeDiagramUrlOptions, type EncodeDiagramUrlResult, type ExtendedChartType, type ExtractFn, type GanttDependency, type GanttEra, type GanttGroup, type GroupRow as GanttGroupRow, type GanttHolidays, type GanttInteractiveOptions, type LaneHeaderRow as GanttLaneHeaderRow, type GanttMarker, type GanttNode, type GanttOptions, type GanttParallelBlock, type Row as GanttRow, type GanttTask, type TaskRow as GanttTaskRow, type GraphDirection, type GraphEdge, type GraphGroup, type GraphNode, type GraphShape, INFRA_BEHAVIOR_KEYS, type ImportSource, type InfraAvailabilityPercentiles, type InfraBehaviorKey, type InfraCbState, type InfraComputeParams, type InfraDiagnostic, type InfraEdge, type InfraGroup, type InfraLatencyPercentiles, type InfraLayoutEdge, type InfraLayoutGroup, type InfraLayoutNode, type InfraLayoutResult, type InfraLegendGroup, type InfraNode, type InfraPlaybackState, type InfraProperty, type InfraRole, type InfraTagGroup, type InlineSpan, type KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, LEGEND_HEIGHT, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutResult, type LegendCallbacks, type LegendConfig, type LegendControl, type LegendGroupData, type LegendHandle, type LegendLayout, type LegendMode, type LegendPalette, type LegendPosition, type LegendState, METADATA_KEY_SET, type MemberVisibility, type OrgContainerBounds, type OrgLayoutEdge, type OrgLayoutNode, type OrgLayoutResult, type OrgNode, PIPE_METADATA, type PaletteColors, type PaletteConfig, type ParseInArrowLabelResult, type ParsedBoxesAndLines, type ParsedC4, type ParsedChart, type ParsedClassDiagram, type ParsedERDiagram, type ParsedExtendedChart, type ParsedGantt, type ParsedGraph, type ParsedInfra, type ParsedKanban, type ParsedOrg, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedVisualization, type ParticipantType, type PipeKeySpec, RECOGNIZED_COLOR_NAMES, RULE_COUNT, type ReadFileFn, type RelationshipType, type RenderCategory, type RenderStep, type ResolveImportsResult, type ResolvedGroup, type ResolvedSchedule, type ResolvedTask, type ScatterLabelPoint, type SectionMessageGroup, type SequenceBlock, type SequenceElement, type SequenceGroup, type SequenceMessage, type SequenceNote, type SequenceParticipant, type SequenceRenderOptions, type SequenceSection, type SitemapContainerBounds, type SitemapDirection, type SitemapEdge, type SitemapLayoutEdge, type SitemapLayoutNode, type SitemapLayoutResult, type SitemapLegendEntry, type SitemapLegendGroup, type SitemapNode, type TagEntry, type TagGroup, type VisualizationType, addDurationToDate, applyCollapseProjection, applyGroupOrdering, applyPositionOverrides, boldPalette, buildExtendedChartOption, buildNoteMessageMap, buildRenderSequence, buildSimpleChartOption, buildTagLaneRowList, calculateSchedule, catppuccinPalette, collapseBoxesAndLines, collapseOrgTree, collapseSitemapTree, collectDiagramRoles, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeInfra, computeInfraLegendGroups, computeLegendLayout, computeScatterLabelGraphics, computeTimeTicks, contrastText, decodeDiagramUrl, decodeViewState, draculaPalette, encodeDiagramUrl, encodeViewState, extractDiagramSymbols, extractTagDeclarations, formatDateLabel, formatDgmoError, getAvailablePalettes, getExtendedChartLegendGroups, getLegendReservedHeight, getPalette, getRenderCategory, getSeriesColors, getSimpleChartLegendGroups, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, inferRoles, isArchiveColumn, isExtendedChartType, isRecognizedColorName, isSequenceBlock, isSequenceNote, isValidHex, layoutBoxesAndLines, layoutC4Components, layoutC4Containers, layoutC4Context, layoutC4Deployment, layoutClassDiagram, layoutERDiagram, layoutGraph, layoutInfra, layoutOrg, layoutSitemap, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikeSequence, looksLikeSitemap, looksLikeState, makeDgmoError, matchColorParens, monokaiPalette, nord, nordPalette, oneDarkPalette, orderArcNodes, parseAndLayoutInfra, parseBoxesAndLines, parseC4, parseChart, parseClassDiagram, parseDataRowValues, parseDgmo, parseDgmoChartType, parseERDiagram, parseExtendedChart, parseFirstLine, parseFlowchart, parseGantt, parseInArrowLabel, parseInfra, parseInlineMarkdown, parseKanban, parseOrg, parseSequenceDgmo, parseSitemap, parseState, parseTimelineDate, parseVisualization, registerExtractor, registerPalette, render, renderArcDiagram, renderBoxesAndLines, renderBoxesAndLinesForExport, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderERDiagram, renderERDiagramForExport, renderExtendedChartForExport, renderFlowchart, renderFlowchartForExport, renderForExport, renderGantt, renderInfra, renderKanban, renderKanbanForExport, renderLegendD3, renderLegendSvg, renderLegendSvgFromConfig, renderOrg, renderOrgForExport, renderQuadrant, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSlopeChart, renderState, renderStateForExport, renderTimeline, renderVenn, renderWordCloud, resolveColor, resolveColorWithDiagnostic, resolveOrgImports, resolveTaskName, rollUpContextRelationships, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette, truncateBareUrl, validateComputed, validateInfra, validateLabelCharacters };
|