@diagrammo/dgmo 0.7.2 → 0.8.0

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.
Files changed (62) hide show
  1. package/AGENTS.md +15 -20
  2. package/README.md +56 -58
  3. package/dist/cli.cjs +188 -181
  4. package/dist/index.cjs +3529 -1061
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +196 -43
  7. package/dist/index.d.ts +196 -43
  8. package/dist/index.js +3516 -1061
  9. package/dist/index.js.map +1 -1
  10. package/docs/language-reference.md +629 -289
  11. package/package.json +1 -1
  12. package/src/c4/layout.ts +6 -9
  13. package/src/c4/parser.ts +189 -83
  14. package/src/c4/renderer.ts +8 -9
  15. package/src/chart.ts +296 -83
  16. package/src/class/parser.ts +54 -37
  17. package/src/class/renderer.ts +8 -8
  18. package/src/cli.ts +8 -8
  19. package/src/colors.ts +4 -1
  20. package/src/completion.ts +757 -10
  21. package/src/d3.ts +312 -73
  22. package/src/dgmo-router.ts +63 -8
  23. package/src/echarts.ts +726 -231
  24. package/src/er/parser.ts +94 -76
  25. package/src/er/renderer.ts +6 -5
  26. package/src/gantt/parser.ts +144 -69
  27. package/src/gantt/renderer.ts +50 -14
  28. package/src/gantt/types.ts +3 -3
  29. package/src/graph/flowchart-parser.ts +97 -37
  30. package/src/graph/flowchart-renderer.ts +4 -3
  31. package/src/graph/state-parser.ts +50 -31
  32. package/src/graph/state-renderer.ts +4 -3
  33. package/src/index.ts +14 -5
  34. package/src/infra/compute.ts +1 -0
  35. package/src/infra/layout.ts +3 -0
  36. package/src/infra/parser.ts +291 -92
  37. package/src/infra/renderer.ts +172 -30
  38. package/src/infra/types.ts +5 -0
  39. package/src/initiative-status/layout.ts +1 -1
  40. package/src/initiative-status/parser.ts +121 -47
  41. package/src/initiative-status/renderer.ts +82 -31
  42. package/src/initiative-status/types.ts +10 -2
  43. package/src/kanban/parser.ts +60 -37
  44. package/src/kanban/renderer.ts +2 -2
  45. package/src/kanban/types.ts +1 -0
  46. package/src/org/layout.ts +9 -9
  47. package/src/org/parser.ts +39 -40
  48. package/src/org/renderer.ts +5 -6
  49. package/src/org/resolver.ts +26 -19
  50. package/src/render.ts +1 -1
  51. package/src/sequence/parser.ts +304 -95
  52. package/src/sequence/renderer.ts +9 -9
  53. package/src/sitemap/layout.ts +3 -4
  54. package/src/sitemap/parser.ts +57 -49
  55. package/src/sitemap/renderer.ts +6 -7
  56. package/src/utils/arrows.ts +25 -6
  57. package/src/utils/duration.ts +43 -7
  58. package/src/utils/legend-constants.ts +26 -0
  59. package/src/utils/legend-svg.ts +167 -0
  60. package/src/utils/parsing.ts +247 -7
  61. package/src/utils/tag-groups.ts +160 -15
  62. package/src/utils/title-constants.ts +9 -0
package/dist/index.d.cts CHANGED
@@ -43,9 +43,10 @@ declare function render(content: string, options?: {
43
43
  }): Promise<string>;
44
44
 
45
45
  /**
46
- * Extracts the `chart:` type value from raw file content.
47
- * Falls back to inference when no explicit `chart:` line is found
48
- * (e.g. content containing `->` is inferred as `sequence`).
46
+ * Extracts the chart type from raw file content.
47
+ * First tries the first non-empty, non-comment line as a bare chart type name
48
+ * (e.g., `gantt Product Launch`). Falls back to old `chart: type` syntax.
49
+ * Falls back to inference when no explicit chart type is found.
49
50
  */
50
51
  declare function parseDgmoChartType(content: string): string | null;
51
52
  /** User-visible rendering category for dispatch and routing. */
@@ -218,6 +219,7 @@ interface ChartEra {
218
219
  end: string;
219
220
  label: string;
220
221
  color: string | null;
222
+ lineNumber: number;
221
223
  }
222
224
 
223
225
  interface ParsedChart {
@@ -225,9 +227,13 @@ interface ParsedChart {
225
227
  title?: string;
226
228
  titleLineNumber?: number;
227
229
  series?: string;
230
+ seriesLineNumber?: number;
228
231
  xlabel?: string;
232
+ xlabelLineNumber?: number;
229
233
  ylabel?: string;
234
+ ylabelLineNumber?: number;
230
235
  seriesNames?: string[];
236
+ seriesNameLineNumbers?: number[];
231
237
  seriesNameColors?: (string | undefined)[];
232
238
  orientation?: 'horizontal' | 'vertical';
233
239
  color?: string;
@@ -242,19 +248,49 @@ interface ParsedChart {
242
248
  /**
243
249
  * Parses the simple chart text format into a structured object.
244
250
  *
245
- * Format:
251
+ * Format (colon-free):
246
252
  * ```
247
- * chart: bar
248
- * title: My Chart
249
- * series: Revenue
253
+ * bar My Chart
254
+ * series Revenue
250
255
  *
251
- * Jan: 120
252
- * Feb: 200
253
- * Mar: 150
256
+ * Jan 120
257
+ * Feb 200
258
+ * Mar 150
254
259
  * ```
255
260
  */
256
261
  declare function parseChart(content: string, palette?: PaletteColors): ParsedChart;
257
262
 
263
+ interface LegendGroupData {
264
+ name: string;
265
+ entries: Array<{
266
+ value: string;
267
+ color: string;
268
+ }>;
269
+ }
270
+ interface LegendRenderOptions {
271
+ palette: {
272
+ bg: string;
273
+ surface: string;
274
+ text: string;
275
+ textMuted: string;
276
+ };
277
+ isDark: boolean;
278
+ containerWidth: number;
279
+ /** Grid left offset as percentage (e.g. 12 for '12%'). Centers legend over plot area. */
280
+ gridLeftPct?: number;
281
+ /** Grid right offset as percentage (e.g. 4 for '4%'). Centers legend over plot area. */
282
+ gridRightPct?: number;
283
+ activeGroup?: string | null;
284
+ className?: string;
285
+ }
286
+ interface LegendRenderResult {
287
+ svg: string;
288
+ height: number;
289
+ /** Natural content width (px). Callers can use this for CSS-based centering. */
290
+ width: number;
291
+ }
292
+ declare function renderLegendSvg(groups: LegendGroupData[], options: LegendRenderOptions): LegendRenderResult;
293
+
258
294
  type ExtendedChartType = 'sankey' | 'chord' | 'function' | 'scatter' | 'heatmap' | 'funnel';
259
295
  interface ExtendedChartDataPoint {
260
296
  label: string;
@@ -267,6 +303,7 @@ interface ParsedSankeyLink {
267
303
  target: string;
268
304
  value: number;
269
305
  color?: string;
306
+ directed?: boolean;
270
307
  lineNumber: number;
271
308
  }
272
309
  interface ParsedFunction {
@@ -295,7 +332,9 @@ interface ParsedExtendedChart {
295
332
  title?: string;
296
333
  titleLineNumber?: number;
297
334
  series?: string;
335
+ seriesLineNumber?: number;
298
336
  seriesNames?: string[];
337
+ seriesNameLineNumbers?: number[];
299
338
  seriesNameColors?: (string | undefined)[];
300
339
  data: ExtendedChartDataPoint[];
301
340
  links?: ParsedSankeyLink[];
@@ -309,10 +348,13 @@ interface ParsedExtendedChart {
309
348
  max: number;
310
349
  };
311
350
  xlabel?: string;
351
+ xlabelLineNumber?: number;
312
352
  ylabel?: string;
353
+ ylabelLineNumber?: number;
313
354
  sizelabel?: string;
314
355
  showLabels?: boolean;
315
356
  categoryColors?: Record<string, string>;
357
+ categoryLineNumbers?: Record<string, number>;
316
358
  nodeColors?: Record<string, string>;
317
359
  diagnostics: DgmoError[];
318
360
  error: string | null;
@@ -321,15 +363,13 @@ interface ParsedExtendedChart {
321
363
  /**
322
364
  * Parses extended chart content into a structured object.
323
365
  *
324
- * Format:
366
+ * Format (colon-free):
325
367
  * ```
326
- * chart: bar
327
- * title: My Chart
328
- * series: Revenue
368
+ * scatter My Chart
369
+ * xlabel Weight
329
370
  *
330
- * Jan: 120
331
- * Feb: 200
332
- * Mar: 150
371
+ * Alice 165, 60
372
+ * Bob 180, 85
333
373
  * ```
334
374
  */
335
375
  declare function parseExtendedChart(content: string, palette?: PaletteColors): ParsedExtendedChart;
@@ -339,6 +379,34 @@ declare function parseExtendedChart(content: string, palette?: PaletteColors): P
339
379
  * @param parsed - Result of parseExtendedChart()
340
380
  */
341
381
  declare function buildExtendedChartOption(parsed: ParsedExtendedChart, palette: PaletteColors, isDark: boolean): EChartsOption;
382
+ /**
383
+ * Extracts legend group data from standard chart types (multi-line, bar-stacked).
384
+ * Returns empty array if chart has no multi-series legend.
385
+ */
386
+ declare function getSimpleChartLegendGroups(parsed: ParsedChart, colors: string[]): LegendGroupData[];
387
+ /**
388
+ * Extracts legend group data from extended chart types.
389
+ * Supports scatter (categories), chord (nodes), and function (series).
390
+ */
391
+ declare function getExtendedChartLegendGroups(parsed: ParsedExtendedChart, colors: string[]): LegendGroupData[];
392
+ interface ScatterLabelPoint {
393
+ name: string;
394
+ px: number;
395
+ py: number;
396
+ color: string;
397
+ size?: number;
398
+ }
399
+ /**
400
+ * Greedy label placement for scatter charts.
401
+ * Returns ECharts `graphic` elements (text + background rects + optional connector lines).
402
+ * Pure function — no ECharts instance dependency.
403
+ *
404
+ * @param bg - chart background color, used for label background rects that mask connector lines
405
+ */
406
+ declare function computeScatterLabelGraphics(points: ScatterLabelPoint[], chartBounds: {
407
+ top: number;
408
+ bottom: number;
409
+ }, fontSize: number, symbolSize: number, bg?: string): Record<string, unknown>[];
342
410
  /**
343
411
  * Converts a ParsedChart into an EChartsOption.
344
412
  * Handles standard chart types: bar, line, area, pie, doughnut, radar, polar-area, bar-stacked, multi-line.
@@ -364,7 +432,7 @@ interface TagGroup {
364
432
  name: string;
365
433
  alias?: string;
366
434
  entries: TagEntry[];
367
- /** Value of the entry marked `default` (nodes without metadata get this) */
435
+ /** First value in the tag declaration is the default (nodes without metadata get this) */
368
436
  defaultValue?: string;
369
437
  lineNumber: number;
370
438
  }
@@ -422,6 +490,7 @@ interface TimelineEra {
422
490
  endDate: string;
423
491
  label: string;
424
492
  color: string | null;
493
+ lineNumber: number;
425
494
  }
426
495
  interface TimelineMarker {
427
496
  date: string;
@@ -497,16 +566,16 @@ interface ParsedVisualization {
497
566
  }
498
567
 
499
568
  /**
500
- * Converts a date string (YYYY, YYYY-MM, YYYY-MM-DD) to a fractional year number.
569
+ * Converts a date string (YYYY, YYYY-MM, YYYY-MM-DD, or YYYY-MM-DD HH:MM) to a fractional year number.
501
570
  */
502
571
  declare function parseTimelineDate(s: string): number;
503
572
  /**
504
573
  * Adds a duration to a date string and returns the resulting date string.
505
- * Supports: d (days), w (weeks), m (months), y (years)
574
+ * Supports: d (days), w (weeks), m (months), y (years), h (hours), min (minutes)
506
575
  * Supports decimals up to 2 places (e.g., 1.25y = 1 year 3 months)
507
- * Preserves the precision of the input date (YYYY, YYYY-MM, or YYYY-MM-DD).
576
+ * Preserves the precision of the input date (YYYY, YYYY-MM, YYYY-MM-DD, or YYYY-MM-DD HH:MM).
508
577
  */
509
- declare function addDurationToDate(startDate: string, amount: number, unit: 'd' | 'w' | 'm' | 'y'): string;
578
+ declare function addDurationToDate(startDate: string, amount: number, unit: 'd' | 'w' | 'm' | 'y' | 'h' | 'min'): string;
510
579
  /**
511
580
  * Parses D3 chart text format into structured data.
512
581
  */
@@ -524,10 +593,11 @@ declare function orderArcNodes(links: ArcLink[], order: ArcOrder, groups: ArcNod
524
593
  */
525
594
  declare function renderArcDiagram(container: HTMLDivElement, parsed: ParsedVisualization, palette: PaletteColors, _isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions): void;
526
595
  /**
527
- * Converts a DSL date string (YYYY, YYYY-MM, YYYY-MM-DD) to a human-readable label.
528
- * '1718' → '1718'
529
- * '1718-05' → 'May 1718'
530
- * '1718-05-22' → 'May 22, 1718'
596
+ * Converts a DSL date string (YYYY, YYYY-MM, YYYY-MM-DD, or YYYY-MM-DD HH:MM) to a human-readable label.
597
+ * '1718' → '1718'
598
+ * '1718-05' → 'May 1718'
599
+ * '1718-05-22' → 'May 22, 1718'
600
+ * '2024-06-15 14:30' → 'Jun 15, 2024 14:30'
531
601
  */
532
602
  declare function formatDateLabel(dateStr: string): string;
533
603
  /**
@@ -774,9 +844,14 @@ interface ParsedGraph {
774
844
  }
775
845
 
776
846
  /**
777
- * Diagram symbol extraction API.
847
+ * Diagram symbol extraction API + completion registry.
848
+ *
849
+ * Provides:
850
+ * - DiagramSymbols interface + extractDiagramSymbols() dispatch
851
+ * - COMPLETION_REGISTRY: chart-type → directives map (for editor autocomplete)
852
+ * - CHART_TYPES: array of { name, description } for chart type completion
853
+ * - METADATA_KEY_SET: derived set of all known directive keys
778
854
  *
779
- * Provides DiagramSymbols interface + extractDiagramSymbols() dispatch.
780
855
  * Each diagram type registers its own extractor via registerExtractor().
781
856
  * All built-in extractors are registered at module init below.
782
857
  */
@@ -793,6 +868,53 @@ declare function registerExtractor(kind: ChartType, fn: ExtractFn): void;
793
868
  * Returns null if the chart type is unknown or has no registered extractor.
794
869
  */
795
870
  declare function extractDiagramSymbols(docText: string): DiagramSymbols | null;
871
+ /** Specification for a single directive: description + optional enumerated values. */
872
+ interface DirectiveValueSpec {
873
+ description: string;
874
+ values?: string[];
875
+ }
876
+ /** Specification for a chart type's directives. */
877
+ interface DirectiveSpec {
878
+ directives: Record<string, DirectiveValueSpec>;
879
+ }
880
+ /** Chart-type → directive specifications. Every chart type has at least palette + theme. */
881
+ declare const COMPLETION_REGISTRY: Map<string, DirectiveSpec>;
882
+ /** All chart types with descriptions, for chart type autocomplete. Excludes `multi-line` alias. */
883
+ declare const CHART_TYPES: ReadonlyArray<{
884
+ name: string;
885
+ description: string;
886
+ }>;
887
+ /**
888
+ * Entity types for `Name is a <type>` declarations, keyed by chart type.
889
+ * Values are sourced from parser constants (VALID_PARTICIPANT_TYPES,
890
+ * VALID_NODE_TYPES, C4_IS_A_RE).
891
+ */
892
+ declare const ENTITY_TYPES: Map<string, string[]>;
893
+ /** Specification for a single pipe metadata key. */
894
+ interface PipeKeySpec {
895
+ description: string;
896
+ values?: string[];
897
+ }
898
+ /**
899
+ * Pipe metadata keys for inline `| key value` on data lines.
900
+ * Keyed by chart type → { node: ..., edge: ... }.
901
+ *
902
+ * IMPORTANT: NEVER add 'sequence' here. The `|` character in sequence
903
+ * diagrams separates display names from identifiers and tag metadata.
904
+ * Adding sequence would trigger false pipe-metadata completions on every `|`.
905
+ */
906
+ declare const PIPE_METADATA: Map<string, {
907
+ node: Record<string, PipeKeySpec>;
908
+ edge: Record<string, PipeKeySpec>;
909
+ }>;
910
+ /** All known directive keys, derived from COMPLETION_REGISTRY. Includes implicit keys. */
911
+ declare const METADATA_KEY_SET: ReadonlySet<string>;
912
+ /**
913
+ * Extract tag declarations from document text.
914
+ * Returns a map of alias (or full name) → array of tag values.
915
+ * Keys preserve original case for display; use case-insensitive lookup.
916
+ */
917
+ declare function extractTagDeclarations(docText: string): Map<string, string[]>;
796
918
 
797
919
  declare function parseFlowchart(content: string, palette?: PaletteColors): ParsedGraph;
798
920
  /**
@@ -979,8 +1101,8 @@ interface ParsedERDiagram {
979
1101
 
980
1102
  declare function parseERDiagram(content: string, palette?: PaletteColors): ParsedERDiagram;
981
1103
  /**
982
- * Detect if content looks like an ER diagram without explicit `chart: er`.
983
- * Looks for indented lines with [pk] or [fk] constraint patterns.
1104
+ * Detect if content looks like an ER diagram without explicit `er` first line.
1105
+ * Looks for indented lines with pk or fk constraint keywords.
984
1106
  */
985
1107
  declare function looksLikeERDiagram(content: string): boolean;
986
1108
 
@@ -1032,10 +1154,6 @@ interface InlineSpan {
1032
1154
  declare function parseInlineMarkdown(text: string): InlineSpan[];
1033
1155
  declare function truncateBareUrl(url: string): string;
1034
1156
 
1035
- /** @deprecated Use `TagEntry` from `utils/tag-groups` */
1036
- type OrgTagEntry = TagEntry;
1037
- /** @deprecated Use `TagGroup` from `utils/tag-groups` */
1038
- type OrgTagGroup = TagGroup;
1039
1157
  interface OrgNode {
1040
1158
  id: string;
1041
1159
  label: string;
@@ -1050,7 +1168,7 @@ interface ParsedOrg {
1050
1168
  title: string | null;
1051
1169
  titleLineNumber: number | null;
1052
1170
  roots: OrgNode[];
1053
- tagGroups: OrgTagGroup[];
1171
+ tagGroups: TagGroup[];
1054
1172
  options: Record<string, string>;
1055
1173
  diagnostics: DgmoError[];
1056
1174
  error: string | null;
@@ -1146,6 +1264,7 @@ interface KanbanColumn {
1146
1264
  name: string;
1147
1265
  wipLimit?: number;
1148
1266
  color?: string;
1267
+ metadata?: Record<string, string>;
1149
1268
  cards: KanbanCard[];
1150
1269
  lineNumber: number;
1151
1270
  }
@@ -1366,7 +1485,7 @@ declare function renderC4Deployment(container: HTMLDivElement, parsed: ParsedC4,
1366
1485
  */
1367
1486
  declare function renderC4DeploymentForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
1368
1487
 
1369
- type InitiativeStatus = 'done' | 'wip' | 'todo' | 'na' | null;
1488
+ type InitiativeStatus = 'done' | 'doing' | 'blocked' | 'todo' | 'na' | null;
1370
1489
  interface ISNode {
1371
1490
  label: string;
1372
1491
  status: InitiativeStatus;
@@ -1386,6 +1505,7 @@ interface ISGroup {
1386
1505
  label: string;
1387
1506
  nodeLabels: string[];
1388
1507
  lineNumber: number;
1508
+ metadata?: Record<string, string>;
1389
1509
  }
1390
1510
  interface ParsedInitiativeStatus {
1391
1511
  type: 'initiative-status';
@@ -1625,6 +1745,7 @@ interface InfraNode {
1625
1745
  groupId: string | null;
1626
1746
  tags: Record<string, string>;
1627
1747
  isEdge: boolean;
1748
+ nodeType?: string;
1628
1749
  description?: string;
1629
1750
  lineNumber: number;
1630
1751
  }
@@ -1632,6 +1753,7 @@ interface InfraEdge {
1632
1753
  sourceId: string;
1633
1754
  targetId: string;
1634
1755
  label: string;
1756
+ async: boolean;
1635
1757
  split: number | null;
1636
1758
  fanout: number | null;
1637
1759
  lineNumber: number;
@@ -1643,6 +1765,8 @@ interface InfraGroup {
1643
1765
  instances?: number | string;
1644
1766
  /** Whether this group should be collapsed by default in the source. */
1645
1767
  collapsed?: boolean;
1768
+ /** Pipe metadata on the group header, cascaded to children. */
1769
+ metadata?: Record<string, string>;
1646
1770
  lineNumber: number;
1647
1771
  }
1648
1772
  interface InfraTagValue {
@@ -1725,6 +1849,7 @@ interface ComputedInfraEdge {
1725
1849
  sourceId: string;
1726
1850
  targetId: string;
1727
1851
  label: string;
1852
+ async: boolean;
1728
1853
  computedRps: number;
1729
1854
  split: number;
1730
1855
  fanout: number | null;
@@ -1805,6 +1930,7 @@ interface InfraLayoutEdge {
1805
1930
  sourceId: string;
1806
1931
  targetId: string;
1807
1932
  label: string;
1933
+ async: boolean;
1808
1934
  computedRps: number;
1809
1935
  split: number;
1810
1936
  fanout: number | null;
@@ -1867,7 +1993,13 @@ interface InfraLegendGroup {
1867
1993
  }
1868
1994
  /** Build legend groups from roles + tags. */
1869
1995
  declare function computeInfraLegendGroups(nodes: InfraLayoutNode[], tagGroups: InfraTagGroup[], palette: PaletteColors, edges?: InfraLayoutEdge[]): InfraLegendGroup[];
1870
- declare function renderInfra(container: HTMLDivElement, layout: InfraLayoutResult, palette: PaletteColors, isDark: boolean, title: string | null, titleLineNumber: number | null, tagGroups?: InfraTagGroup[], activeGroup?: string | null, animate?: boolean, _playback?: unknown, expandedNodeIds?: Set<string> | null, exportMode?: boolean, collapsedNodes?: Set<string> | null): void;
1996
+ interface InfraPlaybackState {
1997
+ expanded: boolean;
1998
+ paused: boolean;
1999
+ speed: number;
2000
+ speedOptions: readonly number[];
2001
+ }
2002
+ declare function renderInfra(container: HTMLDivElement, layout: InfraLayoutResult, palette: PaletteColors, isDark: boolean, title: string | null, titleLineNumber: number | null, tagGroups?: InfraTagGroup[], activeGroup?: string | null, animate?: boolean, playback?: InfraPlaybackState | null, expandedNodeIds?: Set<string> | null, exportMode?: boolean, collapsedNodes?: Set<string> | null): void;
1871
2003
  declare function parseAndLayoutInfra(content: string): {
1872
2004
  parsed: ParsedInfra;
1873
2005
  computed: null;
@@ -1878,8 +2010,8 @@ declare function parseAndLayoutInfra(content: string): {
1878
2010
  layout: InfraLayoutResult;
1879
2011
  };
1880
2012
 
1881
- /** Calendar units: d (days), w (weeks), m (months), q (quarters), y (years). bd = business days. */
1882
- type DurationUnit = 'd' | 'bd' | 'w' | 'm' | 'q' | 'y';
2013
+ /** Calendar units: d (days), w (weeks), m (months), q (quarters), y (years), h (hours), min (minutes). bd = business days. */
2014
+ type DurationUnit = 'd' | 'bd' | 'w' | 'm' | 'q' | 'y' | 'h' | 'min';
1883
2015
  interface Duration {
1884
2016
  amount: number;
1885
2017
  unit: DurationUnit;
@@ -1890,6 +2022,7 @@ interface Offset {
1890
2022
  }
1891
2023
  interface GanttDependency {
1892
2024
  targetName: string;
2025
+ label?: string;
1893
2026
  offset?: Offset;
1894
2027
  lineNumber: number;
1895
2028
  }
@@ -1959,7 +2092,6 @@ interface GanttOptions {
1959
2092
  start: string | null;
1960
2093
  title: string | null;
1961
2094
  titleLineNumber: number | null;
1962
- orientation: 'horizontal' | 'vertical';
1963
2095
  todayMarker: 'off' | 'on' | string;
1964
2096
  criticalPath: boolean;
1965
2097
  dependencies: boolean;
@@ -2106,7 +2238,7 @@ interface ResolveImportsResult {
2106
2238
  importSourceMap: (ImportSource | null)[];
2107
2239
  }
2108
2240
  /**
2109
- * Pre-processes org chart content, resolving `tags:` and `import:` directives.
2241
+ * Pre-processes org chart content, resolving `tags` and `import` directives.
2110
2242
  *
2111
2243
  * @param content - Raw .dgmo file content
2112
2244
  * @param filePath - Absolute path of the file (for relative path resolution)
@@ -2121,6 +2253,8 @@ declare function renderFlowchart(container: HTMLDivElement, graph: ParsedGraph,
2121
2253
  }): void;
2122
2254
  declare function renderFlowchartForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
2123
2255
 
2256
+ declare const LEGEND_HEIGHT = 28;
2257
+
2124
2258
  interface SectionMessageGroup {
2125
2259
  section: SequenceSection;
2126
2260
  messageIndices: number[];
@@ -2218,7 +2352,7 @@ declare const colorNames: Record<string, string>;
2218
2352
  */
2219
2353
  declare function resolveColor(color: string, palette?: {
2220
2354
  colors: Record<string, string>;
2221
- }): string;
2355
+ }): string | null;
2222
2356
  /** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
2223
2357
  declare const seriesColors: string[];
2224
2358
 
@@ -2265,10 +2399,29 @@ declare function encodeDiagramUrl(dsl: string, options?: EncodeDiagramUrlOptions
2265
2399
  */
2266
2400
  declare function decodeDiagramUrl(hash: string): DecodedDiagramUrl;
2267
2401
 
2402
+ /**
2403
+ * Shared parser utilities — extracted from individual parsers to eliminate
2404
+ * duplication of measureIndent, extractColor, header regexes, and
2405
+ * pipe-metadata parsing.
2406
+ */
2407
+
2408
+ /** Complete set of recognized chart type identifiers. */
2409
+ declare const ALL_CHART_TYPES: Set<string>;
2410
+ /**
2411
+ * Parse the first non-empty, non-comment line to extract chart type and optional title.
2412
+ * The first token is matched against `ALL_CHART_TYPES`; the remainder is the title.
2413
+ *
2414
+ * Returns `null` if the first token is not a recognized chart type.
2415
+ */
2416
+ declare function parseFirstLine(line: string): {
2417
+ chartType: string;
2418
+ title: string | undefined;
2419
+ } | null;
2420
+
2268
2421
  /**
2269
2422
  * Injects `diagrammo.app` branding text into an SVG string.
2270
2423
  * Extends the SVG height by 20px and places the text at the bottom-right.
2271
2424
  */
2272
2425
  declare function injectBranding(svgHtml: string, mutedColor: string): string;
2273
2426
 
2274
- export { type Activation, type ArcLink, type ArcNodeGroup, 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, type ChartDataPoint, type ChartEra, type ChartType$1 as ChartType, type ClassLayoutEdge, type ClassLayoutNode, type ClassLayoutResult, type ClassMember, type ClassModifier, type ClassNode, type ClassRelationship, type CollapseResult, 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 Duration, type DurationUnit, 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 ISEdge, type ISGroup, type ISLayoutEdge, type ISLayoutGroup, type ISLayoutNode, type ISLayoutResult, type ISNode, type ISRenderOptions, 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 InfraProperty, type InfraRole, type InfraTagGroup, type InitiativeStatus, type InlineSpan, type KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutResult, type MemberVisibility, type OrgContainerBounds, type OrgLayoutEdge, type OrgLayoutNode, type OrgLayoutResult, type OrgNode, type OrgTagEntry, type OrgTagGroup, type PaletteColors, type PaletteConfig, type ParsedC4, type ParsedChart, type ParsedClassDiagram, type ParsedERDiagram, type ParsedExtendedChart, type ParsedGantt, type ParsedGraph, type ParsedInfra, type ParsedInitiativeStatus, type ParsedKanban, type ParsedOrg, type ParsedQuadrant, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedVisualization, type ParticipantType, RULE_COUNT, type ReadFileFn, type RelationshipType, type RenderCategory, type RenderStep, type ResolveImportsResult, type ResolvedGroup, type ResolvedSchedule, type ResolvedTask, 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, collapseInitiativeStatus, collapseOrgTree, collapseSitemapTree, collectDiagramRoles, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeInfra, computeInfraLegendGroups, computeTimeTicks, contrastText, decodeDiagramUrl, encodeDiagramUrl, extractDiagramSymbols, filterInitiativeStatusByTags, formatDateLabel, formatDgmoError, getAvailablePalettes, getPalette, getRenderCategory, getSeriesColors, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, inferRoles, injectBranding, isArchiveColumn, isExtendedChartType, isSequenceBlock, isSequenceNote, isValidHex, layoutC4Components, layoutC4Containers, layoutC4Context, layoutC4Deployment, layoutClassDiagram, layoutERDiagram, layoutGraph, layoutInfra, layoutInitiativeStatus, layoutOrg, layoutSitemap, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikeInitiativeStatus, looksLikeSequence, looksLikeSitemap, looksLikeState, makeDgmoError, mute, nord, nordPalette, oneDarkPalette, orderArcNodes, parseAndLayoutInfra, parseC4, parseChart, parseClassDiagram, parseDgmo, parseDgmoChartType, parseERDiagram, parseExtendedChart, parseFlowchart, parseGantt, parseInfra, parseInitiativeStatus, parseInlineMarkdown, parseKanban, parseOrg, parseQuadrant, parseSequenceDgmo, parseSitemap, parseState, parseTimelineDate, parseVisualization, registerExtractor, registerPalette, render, renderArcDiagram, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderERDiagram, renderERDiagramForExport, renderExtendedChartForExport, renderFlowchart, renderFlowchartForExport, renderForExport, renderGantt, renderInfra, renderInitiativeStatus, renderInitiativeStatusForExport, renderKanban, renderKanbanForExport, renderOrg, renderOrgForExport, renderQuadrant, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSlopeChart, renderState, renderStateForExport, renderTimeline, renderVenn, renderWordCloud, resolveColor, resolveOrgImports, resolveTaskName, rollUpContextRelationships, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette, truncateBareUrl, validateComputed, validateInfra };
2427
+ export { ALL_CHART_TYPES, type Activation, type ArcLink, type ArcNodeGroup, 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 CollapseResult, 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 ISEdge, type ISGroup, type ISLayoutEdge, type ISLayoutGroup, type ISLayoutNode, type ISLayoutResult, type ISNode, type ISRenderOptions, 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 InitiativeStatus, type InlineSpan, type KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, LEGEND_HEIGHT, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutResult, type LegendGroupData, METADATA_KEY_SET, type MemberVisibility, type OrgContainerBounds, type OrgLayoutEdge, type OrgLayoutNode, type OrgLayoutResult, type OrgNode, PIPE_METADATA, type PaletteColors, type PaletteConfig, type ParsedC4, type ParsedChart, type ParsedClassDiagram, type ParsedERDiagram, type ParsedExtendedChart, type ParsedGantt, type ParsedGraph, type ParsedInfra, type ParsedInitiativeStatus, type ParsedKanban, type ParsedOrg, type ParsedQuadrant, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedVisualization, type ParticipantType, type PipeKeySpec, 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, collapseInitiativeStatus, collapseOrgTree, collapseSitemapTree, collectDiagramRoles, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeInfra, computeInfraLegendGroups, computeScatterLabelGraphics, computeTimeTicks, contrastText, decodeDiagramUrl, encodeDiagramUrl, extractDiagramSymbols, extractTagDeclarations, filterInitiativeStatusByTags, formatDateLabel, formatDgmoError, getAvailablePalettes, getExtendedChartLegendGroups, getPalette, getRenderCategory, getSeriesColors, getSimpleChartLegendGroups, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, inferRoles, injectBranding, isArchiveColumn, isExtendedChartType, isSequenceBlock, isSequenceNote, isValidHex, layoutC4Components, layoutC4Containers, layoutC4Context, layoutC4Deployment, layoutClassDiagram, layoutERDiagram, layoutGraph, layoutInfra, layoutInitiativeStatus, layoutOrg, layoutSitemap, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikeInitiativeStatus, looksLikeSequence, looksLikeSitemap, looksLikeState, makeDgmoError, mute, nord, nordPalette, oneDarkPalette, orderArcNodes, parseAndLayoutInfra, parseC4, parseChart, parseClassDiagram, parseDgmo, parseDgmoChartType, parseERDiagram, parseExtendedChart, parseFirstLine, parseFlowchart, parseGantt, parseInfra, parseInitiativeStatus, parseInlineMarkdown, parseKanban, parseOrg, parseQuadrant, parseSequenceDgmo, parseSitemap, parseState, parseTimelineDate, parseVisualization, registerExtractor, registerPalette, render, renderArcDiagram, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderERDiagram, renderERDiagramForExport, renderExtendedChartForExport, renderFlowchart, renderFlowchartForExport, renderForExport, renderGantt, renderInfra, renderInitiativeStatus, renderInitiativeStatusForExport, renderKanban, renderKanbanForExport, renderLegendSvg, renderOrg, renderOrgForExport, renderQuadrant, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSlopeChart, renderState, renderStateForExport, renderTimeline, renderVenn, renderWordCloud, resolveColor, resolveOrgImports, resolveTaskName, rollUpContextRelationships, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette, truncateBareUrl, validateComputed, validateInfra };