@diagrammo/dgmo 0.8.19 → 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 +681 -872
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +110 -103
- package/dist/index.d.ts +110 -103
- package/dist/index.js +693 -864
- 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 +2 -2
- package/src/graph/flowchart-parser.ts +89 -52
- package/src/graph/state-parser.ts +60 -35
- package/src/index.ts +13 -16
- 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/parser.ts +7 -2
- package/src/sequence/renderer.ts +12 -3
- 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 +0 -4
- 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.cts
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;
|
|
@@ -628,9 +685,12 @@ declare function buildSimpleChartOption(parsed: ParsedChart, palette: PaletteCol
|
|
|
628
685
|
* Renders an extended chart (scatter, sankey, chord, function, heatmap, funnel) to SVG using server-side rendering.
|
|
629
686
|
* Mirrors the `renderForExport` API — returns an SVG string or empty string on failure.
|
|
630
687
|
*/
|
|
631
|
-
declare function renderExtendedChartForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette?: PaletteColors
|
|
632
|
-
|
|
633
|
-
|
|
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
|
+
}
|
|
634
694
|
|
|
635
695
|
/** A single entry inside a tag group: `Value(color)` */
|
|
636
696
|
interface TagEntry {
|
|
@@ -720,7 +780,7 @@ interface VennOverlap {
|
|
|
720
780
|
label: string | null;
|
|
721
781
|
lineNumber: number;
|
|
722
782
|
}
|
|
723
|
-
interface QuadrantLabel
|
|
783
|
+
interface QuadrantLabel {
|
|
724
784
|
text: string;
|
|
725
785
|
color: string | null;
|
|
726
786
|
lineNumber: number;
|
|
@@ -732,16 +792,12 @@ interface QuadrantPoint {
|
|
|
732
792
|
lineNumber: number;
|
|
733
793
|
}
|
|
734
794
|
interface QuadrantLabels {
|
|
735
|
-
topRight: QuadrantLabel
|
|
736
|
-
topLeft: QuadrantLabel
|
|
737
|
-
bottomLeft: QuadrantLabel
|
|
738
|
-
bottomRight: QuadrantLabel
|
|
739
|
-
}
|
|
740
|
-
/** Optional explicit dimensions for CLI/export rendering (bypasses DOM layout). */
|
|
741
|
-
interface D3ExportDimensions {
|
|
742
|
-
width?: number;
|
|
743
|
-
height?: number;
|
|
795
|
+
topRight: QuadrantLabel | null;
|
|
796
|
+
topLeft: QuadrantLabel | null;
|
|
797
|
+
bottomLeft: QuadrantLabel | null;
|
|
798
|
+
bottomRight: QuadrantLabel | null;
|
|
744
799
|
}
|
|
800
|
+
|
|
745
801
|
interface ParsedVisualization {
|
|
746
802
|
type: VisualizationType | null;
|
|
747
803
|
title: string | null;
|
|
@@ -811,20 +867,6 @@ declare function renderArcDiagram(container: HTMLDivElement, parsed: ParsedVisua
|
|
|
811
867
|
* '2024-06-15 14:30' → 'Jun 15, 2024 14:30'
|
|
812
868
|
*/
|
|
813
869
|
declare function formatDateLabel(dateStr: string): string;
|
|
814
|
-
/**
|
|
815
|
-
* Computes adaptive tick marks for a timeline scale.
|
|
816
|
-
* - Multi-year spans → year ticks
|
|
817
|
-
* - Within ~1 year → month ticks
|
|
818
|
-
* - Within ~3 months → week ticks (1st, 8th, 15th, 22nd)
|
|
819
|
-
*
|
|
820
|
-
* Optional boundary parameters add ticks at exact data start/end:
|
|
821
|
-
* - boundaryStart/boundaryEnd: numeric date values
|
|
822
|
-
* - boundaryStartLabel/boundaryEndLabel: formatted labels for those dates
|
|
823
|
-
*/
|
|
824
|
-
declare function computeTimeTicks(domainMin: number, domainMax: number, scale: d3Scale.ScaleLinear<number, number>, boundaryStart?: number, boundaryEnd?: number, boundaryStartLabel?: string, boundaryEndLabel?: string): {
|
|
825
|
-
pos: number;
|
|
826
|
-
label: string;
|
|
827
|
-
}[];
|
|
828
870
|
/**
|
|
829
871
|
* Renders a timeline chart into the given container using D3.
|
|
830
872
|
* Supports horizontal (default) and vertical orientation.
|
|
@@ -850,13 +892,26 @@ declare function renderForExport(content: string, theme: 'light' | 'dark' | 'tra
|
|
|
850
892
|
hiddenAttributes?: Set<string>;
|
|
851
893
|
swimlaneTagGroup?: string | null;
|
|
852
894
|
}, options?: {
|
|
853
|
-
branding?: boolean;
|
|
854
895
|
c4Level?: 'context' | 'containers' | 'components' | 'deployment';
|
|
855
896
|
c4System?: string;
|
|
856
897
|
c4Container?: string;
|
|
857
898
|
tagGroup?: string;
|
|
858
899
|
}): Promise<string>;
|
|
859
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
|
+
|
|
860
915
|
/**
|
|
861
916
|
* Participant types that can be declared via "Name is a type" syntax.
|
|
862
917
|
*/
|
|
@@ -978,48 +1033,6 @@ declare function inferParticipantType(name: string): ParticipantType;
|
|
|
978
1033
|
*/
|
|
979
1034
|
declare const RULE_COUNT: number;
|
|
980
1035
|
|
|
981
|
-
interface QuadrantLabel {
|
|
982
|
-
text: string;
|
|
983
|
-
color: string | null;
|
|
984
|
-
lineNumber: number;
|
|
985
|
-
}
|
|
986
|
-
interface ParsedQuadrant {
|
|
987
|
-
title: string | null;
|
|
988
|
-
titleLineNumber: number | null;
|
|
989
|
-
xAxis: [string, string] | null;
|
|
990
|
-
xAxisLineNumber: number | null;
|
|
991
|
-
yAxis: [string, string] | null;
|
|
992
|
-
yAxisLineNumber: number | null;
|
|
993
|
-
quadrants: {
|
|
994
|
-
topRight: QuadrantLabel | null;
|
|
995
|
-
topLeft: QuadrantLabel | null;
|
|
996
|
-
bottomLeft: QuadrantLabel | null;
|
|
997
|
-
bottomRight: QuadrantLabel | null;
|
|
998
|
-
};
|
|
999
|
-
points: {
|
|
1000
|
-
label: string;
|
|
1001
|
-
x: number;
|
|
1002
|
-
y: number;
|
|
1003
|
-
lineNumber: number;
|
|
1004
|
-
}[];
|
|
1005
|
-
diagnostics: DgmoError[];
|
|
1006
|
-
error: string | null;
|
|
1007
|
-
}
|
|
1008
|
-
/**
|
|
1009
|
-
* Parses a .dgmo quadrant document into a structured object.
|
|
1010
|
-
* Lines are processed sequentially; unknown lines are silently skipped.
|
|
1011
|
-
*/
|
|
1012
|
-
declare function parseQuadrant(content: string): ParsedQuadrant;
|
|
1013
|
-
/**
|
|
1014
|
-
* Generates valid Mermaid quadrantChart syntax from a parsed quadrant.
|
|
1015
|
-
* Returns a string ready for the Mermaid renderer.
|
|
1016
|
-
*/
|
|
1017
|
-
declare function buildMermaidQuadrant(parsed: ParsedQuadrant, options?: {
|
|
1018
|
-
isDark?: boolean;
|
|
1019
|
-
textColor?: string;
|
|
1020
|
-
mutedTextColor?: string;
|
|
1021
|
-
}): string;
|
|
1022
|
-
|
|
1023
1036
|
type GraphShape = 'terminal' | 'process' | 'decision' | 'io' | 'subroutine' | 'document' | 'state' | 'pseudostate';
|
|
1024
1037
|
type GraphDirection = 'TB' | 'LR';
|
|
1025
1038
|
interface GraphNode {
|
|
@@ -2731,10 +2744,4 @@ declare function parseFirstLine(line: string): {
|
|
|
2731
2744
|
title: string | undefined;
|
|
2732
2745
|
} | null;
|
|
2733
2746
|
|
|
2734
|
-
|
|
2735
|
-
* Injects `diagrammo.app` branding text into an SVG string.
|
|
2736
|
-
* Extends the SVG height by 20px and places the text at the bottom-right.
|
|
2737
|
-
*/
|
|
2738
|
-
declare function injectBranding(svgHtml: string, mutedColor: string): string;
|
|
2739
|
-
|
|
2740
|
-
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 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 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, applyCollapseProjection, 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, decodeViewState, draculaPalette, encodeDiagramUrl, encodeViewState, 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 };
|
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;
|
|
@@ -628,9 +685,12 @@ declare function buildSimpleChartOption(parsed: ParsedChart, palette: PaletteCol
|
|
|
628
685
|
* Renders an extended chart (scatter, sankey, chord, function, heatmap, funnel) to SVG using server-side rendering.
|
|
629
686
|
* Mirrors the `renderForExport` API — returns an SVG string or empty string on failure.
|
|
630
687
|
*/
|
|
631
|
-
declare function renderExtendedChartForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette?: PaletteColors
|
|
632
|
-
|
|
633
|
-
|
|
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
|
+
}
|
|
634
694
|
|
|
635
695
|
/** A single entry inside a tag group: `Value(color)` */
|
|
636
696
|
interface TagEntry {
|
|
@@ -720,7 +780,7 @@ interface VennOverlap {
|
|
|
720
780
|
label: string | null;
|
|
721
781
|
lineNumber: number;
|
|
722
782
|
}
|
|
723
|
-
interface QuadrantLabel
|
|
783
|
+
interface QuadrantLabel {
|
|
724
784
|
text: string;
|
|
725
785
|
color: string | null;
|
|
726
786
|
lineNumber: number;
|
|
@@ -732,16 +792,12 @@ interface QuadrantPoint {
|
|
|
732
792
|
lineNumber: number;
|
|
733
793
|
}
|
|
734
794
|
interface QuadrantLabels {
|
|
735
|
-
topRight: QuadrantLabel
|
|
736
|
-
topLeft: QuadrantLabel
|
|
737
|
-
bottomLeft: QuadrantLabel
|
|
738
|
-
bottomRight: QuadrantLabel
|
|
739
|
-
}
|
|
740
|
-
/** Optional explicit dimensions for CLI/export rendering (bypasses DOM layout). */
|
|
741
|
-
interface D3ExportDimensions {
|
|
742
|
-
width?: number;
|
|
743
|
-
height?: number;
|
|
795
|
+
topRight: QuadrantLabel | null;
|
|
796
|
+
topLeft: QuadrantLabel | null;
|
|
797
|
+
bottomLeft: QuadrantLabel | null;
|
|
798
|
+
bottomRight: QuadrantLabel | null;
|
|
744
799
|
}
|
|
800
|
+
|
|
745
801
|
interface ParsedVisualization {
|
|
746
802
|
type: VisualizationType | null;
|
|
747
803
|
title: string | null;
|
|
@@ -811,20 +867,6 @@ declare function renderArcDiagram(container: HTMLDivElement, parsed: ParsedVisua
|
|
|
811
867
|
* '2024-06-15 14:30' → 'Jun 15, 2024 14:30'
|
|
812
868
|
*/
|
|
813
869
|
declare function formatDateLabel(dateStr: string): string;
|
|
814
|
-
/**
|
|
815
|
-
* Computes adaptive tick marks for a timeline scale.
|
|
816
|
-
* - Multi-year spans → year ticks
|
|
817
|
-
* - Within ~1 year → month ticks
|
|
818
|
-
* - Within ~3 months → week ticks (1st, 8th, 15th, 22nd)
|
|
819
|
-
*
|
|
820
|
-
* Optional boundary parameters add ticks at exact data start/end:
|
|
821
|
-
* - boundaryStart/boundaryEnd: numeric date values
|
|
822
|
-
* - boundaryStartLabel/boundaryEndLabel: formatted labels for those dates
|
|
823
|
-
*/
|
|
824
|
-
declare function computeTimeTicks(domainMin: number, domainMax: number, scale: d3Scale.ScaleLinear<number, number>, boundaryStart?: number, boundaryEnd?: number, boundaryStartLabel?: string, boundaryEndLabel?: string): {
|
|
825
|
-
pos: number;
|
|
826
|
-
label: string;
|
|
827
|
-
}[];
|
|
828
870
|
/**
|
|
829
871
|
* Renders a timeline chart into the given container using D3.
|
|
830
872
|
* Supports horizontal (default) and vertical orientation.
|
|
@@ -850,13 +892,26 @@ declare function renderForExport(content: string, theme: 'light' | 'dark' | 'tra
|
|
|
850
892
|
hiddenAttributes?: Set<string>;
|
|
851
893
|
swimlaneTagGroup?: string | null;
|
|
852
894
|
}, options?: {
|
|
853
|
-
branding?: boolean;
|
|
854
895
|
c4Level?: 'context' | 'containers' | 'components' | 'deployment';
|
|
855
896
|
c4System?: string;
|
|
856
897
|
c4Container?: string;
|
|
857
898
|
tagGroup?: string;
|
|
858
899
|
}): Promise<string>;
|
|
859
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
|
+
|
|
860
915
|
/**
|
|
861
916
|
* Participant types that can be declared via "Name is a type" syntax.
|
|
862
917
|
*/
|
|
@@ -978,48 +1033,6 @@ declare function inferParticipantType(name: string): ParticipantType;
|
|
|
978
1033
|
*/
|
|
979
1034
|
declare const RULE_COUNT: number;
|
|
980
1035
|
|
|
981
|
-
interface QuadrantLabel {
|
|
982
|
-
text: string;
|
|
983
|
-
color: string | null;
|
|
984
|
-
lineNumber: number;
|
|
985
|
-
}
|
|
986
|
-
interface ParsedQuadrant {
|
|
987
|
-
title: string | null;
|
|
988
|
-
titleLineNumber: number | null;
|
|
989
|
-
xAxis: [string, string] | null;
|
|
990
|
-
xAxisLineNumber: number | null;
|
|
991
|
-
yAxis: [string, string] | null;
|
|
992
|
-
yAxisLineNumber: number | null;
|
|
993
|
-
quadrants: {
|
|
994
|
-
topRight: QuadrantLabel | null;
|
|
995
|
-
topLeft: QuadrantLabel | null;
|
|
996
|
-
bottomLeft: QuadrantLabel | null;
|
|
997
|
-
bottomRight: QuadrantLabel | null;
|
|
998
|
-
};
|
|
999
|
-
points: {
|
|
1000
|
-
label: string;
|
|
1001
|
-
x: number;
|
|
1002
|
-
y: number;
|
|
1003
|
-
lineNumber: number;
|
|
1004
|
-
}[];
|
|
1005
|
-
diagnostics: DgmoError[];
|
|
1006
|
-
error: string | null;
|
|
1007
|
-
}
|
|
1008
|
-
/**
|
|
1009
|
-
* Parses a .dgmo quadrant document into a structured object.
|
|
1010
|
-
* Lines are processed sequentially; unknown lines are silently skipped.
|
|
1011
|
-
*/
|
|
1012
|
-
declare function parseQuadrant(content: string): ParsedQuadrant;
|
|
1013
|
-
/**
|
|
1014
|
-
* Generates valid Mermaid quadrantChart syntax from a parsed quadrant.
|
|
1015
|
-
* Returns a string ready for the Mermaid renderer.
|
|
1016
|
-
*/
|
|
1017
|
-
declare function buildMermaidQuadrant(parsed: ParsedQuadrant, options?: {
|
|
1018
|
-
isDark?: boolean;
|
|
1019
|
-
textColor?: string;
|
|
1020
|
-
mutedTextColor?: string;
|
|
1021
|
-
}): string;
|
|
1022
|
-
|
|
1023
1036
|
type GraphShape = 'terminal' | 'process' | 'decision' | 'io' | 'subroutine' | 'document' | 'state' | 'pseudostate';
|
|
1024
1037
|
type GraphDirection = 'TB' | 'LR';
|
|
1025
1038
|
interface GraphNode {
|
|
@@ -2731,10 +2744,4 @@ declare function parseFirstLine(line: string): {
|
|
|
2731
2744
|
title: string | undefined;
|
|
2732
2745
|
} | null;
|
|
2733
2746
|
|
|
2734
|
-
|
|
2735
|
-
* Injects `diagrammo.app` branding text into an SVG string.
|
|
2736
|
-
* Extends the SVG height by 20px and places the text at the bottom-right.
|
|
2737
|
-
*/
|
|
2738
|
-
declare function injectBranding(svgHtml: string, mutedColor: string): string;
|
|
2739
|
-
|
|
2740
|
-
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 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 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, applyCollapseProjection, 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, decodeViewState, draculaPalette, encodeDiagramUrl, encodeViewState, 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 };
|