@diagrammo/dgmo 0.8.22 → 0.8.25

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 (90) hide show
  1. package/.claude/commands/dgmo.md +60 -72
  2. package/dist/cli.cjs +123 -116
  3. package/dist/editor.cjs +3 -2
  4. package/dist/editor.cjs.map +1 -1
  5. package/dist/editor.js +3 -2
  6. package/dist/editor.js.map +1 -1
  7. package/dist/highlight.cjs +3 -2
  8. package/dist/highlight.cjs.map +1 -1
  9. package/dist/highlight.js +3 -2
  10. package/dist/highlight.js.map +1 -1
  11. package/dist/index.cjs +1649 -442
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +196 -23
  14. package/dist/index.d.ts +196 -23
  15. package/dist/index.js +1631 -440
  16. package/dist/index.js.map +1 -1
  17. package/dist/internal.cjs +677 -0
  18. package/dist/internal.cjs.map +1 -0
  19. package/dist/internal.d.cts +267 -0
  20. package/dist/internal.d.ts +267 -0
  21. package/dist/internal.js +633 -0
  22. package/dist/internal.js.map +1 -0
  23. package/docs/guide/chart-area.md +17 -17
  24. package/docs/guide/chart-bar-stacked.md +12 -12
  25. package/docs/guide/chart-cycle.md +156 -0
  26. package/docs/guide/chart-doughnut.md +10 -10
  27. package/docs/guide/chart-funnel.md +9 -9
  28. package/docs/guide/chart-heatmap.md +10 -10
  29. package/docs/guide/chart-journey-map.md +179 -0
  30. package/docs/guide/chart-kanban.md +2 -0
  31. package/docs/guide/chart-line.md +19 -19
  32. package/docs/guide/chart-multi-line.md +16 -16
  33. package/docs/guide/chart-pie.md +11 -11
  34. package/docs/guide/chart-polar-area.md +10 -10
  35. package/docs/guide/chart-pyramid.md +111 -0
  36. package/docs/guide/chart-radar.md +9 -9
  37. package/docs/guide/chart-scatter.md +24 -27
  38. package/docs/guide/index.md +3 -3
  39. package/docs/guide/registry.json +5 -0
  40. package/docs/language-reference.md +108 -26
  41. package/fonts/Inter-Bold.ttf +0 -0
  42. package/fonts/Inter-Regular.ttf +0 -0
  43. package/fonts/LICENSE-Inter.txt +92 -0
  44. package/gallery/fixtures/bar-stacked.dgmo +12 -6
  45. package/gallery/fixtures/heatmap.dgmo +12 -6
  46. package/gallery/fixtures/multi-line.dgmo +11 -7
  47. package/gallery/fixtures/pyramid/dikw.dgmo +17 -0
  48. package/gallery/fixtures/pyramid/inverted-funnel.dgmo +16 -0
  49. package/gallery/fixtures/pyramid/minimal.dgmo +5 -0
  50. package/gallery/fixtures/quadrant.dgmo +8 -8
  51. package/gallery/fixtures/scatter.dgmo +12 -12
  52. package/package.json +14 -2
  53. package/src/boxes-and-lines/parser.ts +13 -2
  54. package/src/boxes-and-lines/renderer.ts +22 -13
  55. package/src/chart-type-scoring.ts +162 -0
  56. package/src/chart-types.ts +437 -0
  57. package/src/cli.ts +152 -101
  58. package/src/completion.ts +9 -48
  59. package/src/cycle/layout.ts +19 -28
  60. package/src/cycle/renderer.ts +59 -32
  61. package/src/cycle/types.ts +21 -0
  62. package/src/d3.ts +30 -3
  63. package/src/dgmo-router.ts +98 -73
  64. package/src/echarts.ts +1 -1
  65. package/src/editor/keywords.ts +3 -2
  66. package/src/fonts.ts +3 -2
  67. package/src/gantt/parser.ts +5 -1
  68. package/src/index.ts +37 -3
  69. package/src/infra/parser.ts +3 -3
  70. package/src/internal.ts +20 -0
  71. package/src/journey-map/layout.ts +7 -3
  72. package/src/journey-map/parser.ts +5 -1
  73. package/src/journey-map/renderer.ts +112 -47
  74. package/src/kanban/parser.ts +5 -1
  75. package/src/org/collapse.ts +82 -4
  76. package/src/org/parser.ts +1 -1
  77. package/src/org/renderer.ts +221 -4
  78. package/src/pyramid/parser.ts +172 -0
  79. package/src/pyramid/renderer.ts +684 -0
  80. package/src/pyramid/types.ts +28 -0
  81. package/src/render.ts +2 -8
  82. package/src/sequence/parser.ts +64 -22
  83. package/src/sequence/participant-inference.ts +0 -1
  84. package/src/sequence/renderer.ts +97 -265
  85. package/src/sharing.ts +0 -1
  86. package/src/sitemap/parser.ts +1 -1
  87. package/src/tech-radar/interactive.ts +54 -0
  88. package/src/utils/parsing.ts +1 -0
  89. package/src/utils/tag-groups.ts +35 -5
  90. package/src/wireframe/parser.ts +3 -1
package/dist/index.d.cts CHANGED
@@ -103,7 +103,6 @@ interface CompactViewState {
103
103
  rm?: string;
104
104
  htv?: Record<string, string[]>;
105
105
  ha?: string[];
106
- enl?: number[];
107
106
  sem?: boolean;
108
107
  cm?: boolean;
109
108
  c4l?: string;
@@ -206,6 +205,86 @@ declare function render(content: string, options?: {
206
205
  diagnostics: DgmoError[];
207
206
  }>;
208
207
 
208
+ interface ChartTypeMeta {
209
+ readonly id: string;
210
+ readonly description: string;
211
+ readonly triggers: readonly string[];
212
+ readonly fallback?: true;
213
+ }
214
+ declare const chartTypes: readonly ChartTypeMeta[];
215
+
216
+ /** Normalize a string to lowercase ASCII-ish tokens for matching. */
217
+ declare function normalize(s: string): string[];
218
+ /**
219
+ * True if `triggerTokens` appears as a contiguous slice of `promptTokens`.
220
+ * Token-based (not substring) — prevents "scatter plot" matching "scattered
221
+ * the plot", "ER diagram" matching "water diagram", and similar traps.
222
+ */
223
+ declare function matchesContiguously(promptTokens: readonly string[], triggerTokens: readonly string[]): boolean;
224
+ interface ChartTypeScore {
225
+ readonly type: ChartTypeMeta;
226
+ readonly score: number;
227
+ readonly matched: string[];
228
+ }
229
+ /**
230
+ * Score a single chart type against a prompt.
231
+ *
232
+ * Primary signal: contiguous trigger-phrase matches weighted by token count
233
+ * (longer phrases beat shorter ones). Secondary signal: description-word
234
+ * overlap at 0.25× weight — a tiebreak-only hint that rescues prompts which
235
+ * miss every trigger but touch description vocabulary. Triggers always win
236
+ * over descriptions because any trigger match is ≥1.0 and descriptions
237
+ * contribute ≤0.25 per token.
238
+ */
239
+ declare function scoreChartType(prompt: string, type: ChartTypeMeta): {
240
+ score: number;
241
+ matched: string[];
242
+ };
243
+ /**
244
+ * Minimum trigger-based score for a confident match. A result below this
245
+ * floor means no actual trigger fired — only description-rescue tokens
246
+ * contributed — so the caller should drop to the fallback list instead of
247
+ * returning a confident-looking wrong answer.
248
+ *
249
+ * 1.0 is the weight of a single-token trigger. Anything less came entirely
250
+ * from 0.25× description hits.
251
+ */
252
+ declare const MIN_PRIMARY_SCORE = 1;
253
+ /**
254
+ * Minimum absolute score gap required before calling a match
255
+ * non-ambiguous. 0.5 ≈ two description-rescue tokens' worth, or half a
256
+ * trigger-token difference. Below this, the cliff between "medium" and
257
+ * "ambiguous" is effectively noise.
258
+ */
259
+ declare const AMBIGUITY_THRESHOLD = 0.5;
260
+ type Confidence = 'high' | 'medium' | 'ambiguous';
261
+ /**
262
+ * Confidence from the top two scores. Rules:
263
+ * 1. top < MIN_PRIMARY_SCORE → ambiguous (no real trigger matched)
264
+ * 2. second === 0 → high (nothing competes)
265
+ * 3. top ≥ 2 × second → high (top dominates)
266
+ * 4. top − second < AMBIGUITY_THRESHOLD → ambiguous (gap is noise)
267
+ * 5. otherwise → medium
268
+ */
269
+ declare function confidence(top: number, second: number): Confidence;
270
+ interface SuggestionResult {
271
+ readonly ranked: readonly ChartTypeScore[];
272
+ readonly fallback: readonly ChartTypeMeta[];
273
+ readonly confidence: Confidence;
274
+ readonly fellBack: boolean;
275
+ }
276
+ /**
277
+ * Score every chart type against `prompt` and return a ranked suggestion
278
+ * bundle. Types with score 0 are filtered out. When the top score is below
279
+ * `MIN_PRIMARY_SCORE` (no real trigger fired), the caller should present
280
+ * the fallback list — `fellBack` is set to true in that case.
281
+ *
282
+ * Array order is preserved: scoring iterates `chartTypes` in source order
283
+ * and `.sort` is stable in V8, so ties go to the earlier entry — specialized
284
+ * types beat generic catch-alls by construction.
285
+ */
286
+ declare function suggestChartTypes(prompt: string): SuggestionResult;
287
+
209
288
  /**
210
289
  * Extracts the chart type from raw file content.
211
290
  * First tries the first non-empty, non-comment line as a bare chart type name
@@ -226,12 +305,42 @@ declare function getRenderCategory(chartType: string): RenderCategory | null;
226
305
  * Returns false for standard chart types and all other types.
227
306
  */
228
307
  declare function isExtendedChartType(chartType: string): boolean;
308
+ /**
309
+ * Returns all supported chart type identifiers in canonical (tier) order,
310
+ * derived from `chartTypes`. Consumers that need alphabetical order should
311
+ * call `.sort()` explicitly.
312
+ */
313
+ declare function getAllChartTypes(): string[];
314
+ /**
315
+ * Canonical descriptions for every supported chart type. Derived from
316
+ * `chartTypes` so there is exactly one place to update when adding a new
317
+ * type. Consumed by the CLI `--chart-types` flag, the editor autocomplete
318
+ * popup, and the MCP `list_chart_types` tool.
319
+ */
320
+ declare const CHART_TYPE_DESCRIPTIONS: Record<string, string>;
321
+ type ParseResult = {
322
+ diagnostics: DgmoError[];
323
+ };
324
+ type ParseFn = (content: string) => ParseResult;
325
+ /**
326
+ * Maps every chart-type id to the parser that handles it. Adding a new
327
+ * chart type means:
328
+ * 1. Add an entry here.
329
+ * 2. Add an entry to `chartTypes` in `chart-types.ts`.
330
+ *
331
+ * The `chart-types.test.ts` cross-check asserts both sets are identical;
332
+ * forgetting either side trips the test.
333
+ */
334
+ declare const chartTypeParsers: ReadonlyArray<readonly [string, ParseFn]>;
335
+ /** Ids in the same order as `chartTypeParsers`; used for cross-checks. */
336
+ declare const knownChartTypeIds: readonly string[];
229
337
  /**
230
338
  * Parse DGMO content and return diagnostics without rendering.
231
339
  * Useful for the CLI and editor to surface all errors before attempting render.
232
340
  */
233
341
  declare function parseDgmo(content: string): {
234
342
  diagnostics: DgmoError[];
343
+ chartType: string | null;
235
344
  };
236
345
 
237
346
  /**
@@ -796,7 +905,7 @@ interface TagGroup {
796
905
  lineNumber: number;
797
906
  }
798
907
 
799
- type VisualizationType = 'slope' | 'wordcloud' | 'arc' | 'timeline' | 'venn' | 'quadrant' | 'sequence' | 'tech-radar' | 'cycle';
908
+ type VisualizationType = 'slope' | 'wordcloud' | 'arc' | 'timeline' | 'venn' | 'quadrant' | 'sequence' | 'tech-radar' | 'cycle' | 'pyramid';
800
909
  interface D3DataItem {
801
910
  label: string;
802
911
  values: number[];
@@ -1575,10 +1684,37 @@ interface OrgLayoutResult {
1575
1684
  }
1576
1685
  declare function layoutOrg(parsed: ParsedOrg, hiddenCounts?: Map<string, number>, activeTagGroup?: string | null, hiddenAttributes?: Set<string>, expandAllLegend?: boolean): OrgLayoutResult;
1577
1686
 
1687
+ interface CollapsedOrgResult {
1688
+ /** ParsedOrg with collapsed subtrees pruned (deep-cloned, never mutates original) */
1689
+ parsed: ParsedOrg;
1690
+ /** nodeId → count of hidden descendants */
1691
+ hiddenCounts: Map<string, number>;
1692
+ }
1693
+ interface AncestorInfo {
1694
+ id: string;
1695
+ label: string;
1696
+ lineNumber: number;
1697
+ color?: string;
1698
+ metadata: Record<string, string>;
1699
+ isContainer: boolean;
1700
+ }
1701
+ interface FocusOrgResult {
1702
+ /** ParsedOrg with only the focused subtree as the single root */
1703
+ parsed: ParsedOrg;
1704
+ /** Ancestor path from original root → parent of focused node (top-down order) */
1705
+ ancestorPath: AncestorInfo[];
1706
+ }
1707
+ declare function collapseOrgTree(original: ParsedOrg, collapsedIds: Set<string>): CollapsedOrgResult;
1708
+ /**
1709
+ * Extract a subtree rooted at `focusNodeId`, returning the focused tree
1710
+ * and the ancestor breadcrumb path. Returns null if the node is not found.
1711
+ */
1712
+ declare function focusOrgTree(original: ParsedOrg, focusNodeId: string): FocusOrgResult | null;
1713
+
1578
1714
  declare function renderOrg(container: HTMLDivElement, parsed: ParsedOrg, layout: OrgLayoutResult, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
1579
1715
  width?: number;
1580
1716
  height?: number;
1581
- }, activeTagGroup?: string | null, hiddenAttributes?: Set<string>): void;
1717
+ }, activeTagGroup?: string | null, hiddenAttributes?: Set<string>, ancestorPath?: AncestorInfo[]): void;
1582
1718
  declare function renderOrgForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
1583
1719
 
1584
1720
  /** @deprecated Use `TagEntry` from `utils/tag-groups` */
@@ -2579,14 +2715,6 @@ declare function collectTasks(nodes: GanttNode[]): GanttTask[];
2579
2715
  */
2580
2716
  declare function resolveTaskName(name: string, allTasks: GanttTask[]): ResolverResult;
2581
2717
 
2582
- interface CollapsedOrgResult {
2583
- /** ParsedOrg with collapsed subtrees pruned (deep-cloned, never mutates original) */
2584
- parsed: ParsedOrg;
2585
- /** nodeId → count of hidden descendants */
2586
- hiddenCounts: Map<string, number>;
2587
- }
2588
- declare function collapseOrgTree(original: ParsedOrg, collapsedIds: Set<string>): CollapsedOrgResult;
2589
-
2590
2718
  interface MindmapNode {
2591
2719
  id: string;
2592
2720
  label: string;
@@ -3090,6 +3218,61 @@ interface JourneyMapInteractiveOptions {
3090
3218
  declare function renderJourneyMap(container: HTMLElement, parsed: ParsedJourneyMap, palette: PaletteColors, isDark: boolean, options?: JourneyMapInteractiveOptions): void;
3091
3219
  declare function renderJourneyMapForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
3092
3220
 
3221
+ interface PyramidLayer {
3222
+ label: string;
3223
+ lineNumber: number;
3224
+ /** Optional palette color name (red/green/blue/…). */
3225
+ color?: string;
3226
+ /** Description lines — from bare pipe shorthand or indented body. */
3227
+ description: string[];
3228
+ /** Unconsumed pipe metadata (reserved for future use). */
3229
+ metadata: Record<string, string>;
3230
+ }
3231
+ interface ParsedPyramid {
3232
+ type: 'pyramid';
3233
+ title: string;
3234
+ titleLineNumber: number;
3235
+ layers: PyramidLayer[];
3236
+ /** When true, apex points down instead of up. */
3237
+ inverted: boolean;
3238
+ options: Record<string, string>;
3239
+ diagnostics: DgmoError[];
3240
+ error: string | null;
3241
+ }
3242
+
3243
+ /**
3244
+ * Parse a `.dgmo` pyramid diagram document.
3245
+ *
3246
+ * Top of file = apex of pyramid (reads top-down).
3247
+ *
3248
+ * Syntax:
3249
+ * ```
3250
+ * pyramid Maslow's Hierarchy of Needs
3251
+ *
3252
+ * inverted // optional — flips apex to bottom
3253
+ *
3254
+ * Self-Actualization // indented body = description
3255
+ * Achieving one's full potential.
3256
+ *
3257
+ * Esteem | Respect, recognition // bare pipe shorthand = description
3258
+ *
3259
+ * Love & Belonging | color: blue // structured metadata
3260
+ * Friendship, intimacy, family.
3261
+ *
3262
+ * Physiological | Food, water, rest
3263
+ * ```
3264
+ */
3265
+ declare function parsePyramid(content: string): ParsedPyramid;
3266
+
3267
+ /**
3268
+ * Render a pyramid diagram into the given container.
3269
+ */
3270
+ declare function renderPyramid(container: HTMLDivElement, parsed: ParsedPyramid, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions): void;
3271
+ /**
3272
+ * Render for CLI/export (no click handlers).
3273
+ */
3274
+ declare function renderPyramidForExport(container: HTMLDivElement, parsed: ParsedPyramid, palette: PaletteColors, isDark: boolean, exportDims?: D3ExportDimensions): void;
3275
+
3093
3276
  /**
3094
3277
  * Async or sync file reader. Receives an absolute path, returns content.
3095
3278
  * Throwing means "file not found".
@@ -3140,13 +3323,8 @@ interface SectionMessageGroup {
3140
3323
  interface SequenceRenderOptions {
3141
3324
  collapsedSections?: Set<number>;
3142
3325
  collapsedGroups?: Set<number>;
3143
- expandedNoteLines?: Set<number>;
3144
3326
  exportWidth?: number;
3145
3327
  activeTagGroup?: string | null;
3146
- expandAllNotes?: boolean;
3147
- onExpandAllNotes?: (expand: boolean) => void;
3148
- controlsExpanded?: boolean;
3149
- onToggleControlsExpand?: () => void;
3150
3328
  }
3151
3329
  /**
3152
3330
  * Group messages by the top-level section that precedes them.
@@ -3202,14 +3380,9 @@ declare function renderSequenceDiagram(container: HTMLDivElement, parsed: Parsed
3202
3380
  /**
3203
3381
  * Build a mapping from each note's lineNumber to the lineNumber of its
3204
3382
  * associated message (the last message before the note in document order).
3205
- * Used by the app to expand notes when cursor is on the associated message.
3383
+ * Used by the app to highlight the associated message when cursor is on a note.
3206
3384
  */
3207
3385
  declare function buildNoteMessageMap(elements: SequenceElement[]): Map<number, number>;
3208
- /**
3209
- * Collect all note line numbers from a sequence diagram's elements.
3210
- * Used by the app to compute the "expand all" set.
3211
- */
3212
- declare function collectNoteLineNumbers(elements: SequenceElement[]): number[];
3213
3386
 
3214
3387
  interface CollapsedView {
3215
3388
  participants: SequenceParticipant[];
@@ -3301,4 +3474,4 @@ declare function parseFirstLine(line: string): {
3301
3474
  title: string | undefined;
3302
3475
  } | null;
3303
3476
 
3304
- 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 BlipTrend, 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 CollapsedMindmapResult, type CollapsedOrgResult, type CollapsedSitemapResult, type CollapsedView, type CompactViewState, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, type CycleEdge, type CycleLayoutEdge, type CycleLayoutNode, type CycleLayoutResult, type CycleNode, type CycleRenderOptions, 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 JourneyMapAnnotation, type JourneyMapInteractiveOptions, type JourneyMapLayout, type JourneyMapPersona, type JourneyMapPhase, type JourneyMapStep, type KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, LEGEND_HEIGHT, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutOptions, 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 MindmapLayoutEdge, type MindmapLayoutNode, type MindmapLayoutResult, type MindmapNode, 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 ParsedCycle, type ParsedERDiagram, type ParsedExtendedChart, type ParsedGantt, type ParsedGraph, type ParsedInfra, type ParsedJourneyMap, type ParsedKanban, type ParsedMindmap, type ParsedOrg, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedTechRadar, type ParsedVisualization, type ParsedWireframe, type ParticipantType, type PipeKeySpec, type QuadrantPosition, 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 StateCollapseResult, type TagEntry, type TagGroup, type TechRadarBlip, type TechRadarLayoutPoint, type TechRadarQuadrant, type TechRadarRing, type VisualizationType, type WireframeElement, type WireframeElementType, type WireframeFormFactor, type WireframeLayout, type WireframeLayoutNode, addDurationToDate, applyCollapseProjection, applyGroupOrdering, applyPositionOverrides, boldPalette, buildExtendedChartOption, buildNoteMessageMap, buildRenderSequence, buildSimpleChartOption, buildTagLaneRowList, calculateSchedule, catppuccinPalette, collapseBoxesAndLines, collapseMindmapTree, collapseOrgTree, collapseSitemapTree, collapseStateGroups, collectDiagramRoles, collectNoteLineNumbers, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeCycleLayout, computeInfra, computeInfraLegendGroups, computeLegendLayout, computeRadarLayout, computeScatterLabelGraphics, computeTimeTicks, contrastText, decodeDiagramUrl, decodeViewState, draculaPalette, encodeDiagramUrl, encodeViewState, extractDiagramSymbols, extractTagDeclarations, formatDateLabel, formatDgmoError, getAvailablePalettes, getExtendedChartLegendGroups, getLegendReservedHeight, getPalette, getRadarGeometry, 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, layoutJourneyMap, layoutMindmap, layoutOrg, layoutSitemap, layoutWireframe, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikeSequence, looksLikeSitemap, looksLikeState, makeDgmoError, matchColorParens, mix, monokaiPalette, nord, nordPalette, oneDarkPalette, orderArcNodes, parseAndLayoutInfra, parseBoxesAndLines, parseC4, parseChart, parseClassDiagram, parseCycle, parseDataRowValues, parseDgmo, parseDgmoChartType, parseERDiagram, parseExtendedChart, parseFirstLine, parseFlowchart, parseGantt, parseInArrowLabel, parseInfra, parseInlineMarkdown, parseJourneyMap, parseKanban, parseMindmap, parseOrg, parseSequenceDgmo, parseSitemap, parseState, parseTechRadar, parseTimelineDate, parseVisualization, parseWireframe, registerExtractor, registerPalette, render, renderArcDiagram, renderBoxesAndLines, renderBoxesAndLinesForExport, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderCycle, renderCycleForExport, renderERDiagram, renderERDiagramForExport, renderExtendedChartForExport, renderFlowchart, renderFlowchartForExport, renderForExport, renderGantt, renderInfra, renderJourneyMap, renderJourneyMapForExport, renderKanban, renderKanbanForExport, renderLegendD3, renderLegendSvg, renderLegendSvgFromConfig, renderMindmap, renderMindmapForExport, renderOrg, renderOrgForExport, renderQuadrant, renderQuadrantFocus, renderQuadrantFocusForExport, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSlopeChart, renderState, renderStateForExport, renderTechRadar, renderTechRadarForExport, renderTimeline, renderVenn, renderWireframe, renderWordCloud, resolveColor, resolveColorWithDiagnostic, resolveOrgImports, resolveTaskName, rollUpContextRelationships, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette, truncateBareUrl, validateComputed, validateInfra, validateLabelCharacters };
3477
+ export { ALL_CHART_TYPES, AMBIGUITY_THRESHOLD, ARROW_DIAGNOSTIC_CODES, type Activation, type AncestorInfo, type ArcLink, type ArcNodeGroup, type BLCollapseResult, type BLEdge, type BLGroup, type BLLayoutEdge, type BLLayoutGroup, type BLLayoutNode, type BLLayoutResult, type BLNode, type BlipTrend, 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, CHART_TYPE_DESCRIPTIONS, COMPLETION_REGISTRY, type ChartDataPoint, type ChartEra, type ChartType$1 as ChartType, type Confidence as ChartTypeConfidence, type ChartTypeMeta, type ChartTypeScore, type SuggestionResult as ChartTypeSuggestionResult, type ClassLayoutEdge, type ClassLayoutNode, type ClassLayoutResult, type ClassMember, type ClassModifier, type ClassNode, type ClassRelationship, type CollapsedMindmapResult, type CollapsedOrgResult, type CollapsedSitemapResult, type CollapsedView, type CompactViewState, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, type CycleEdge, type CycleLayoutEdge, type CycleLayoutNode, type CycleLayoutResult, type CycleNode, type CycleRenderOptions, 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 FocusOrgResult, 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 JourneyMapAnnotation, type JourneyMapInteractiveOptions, type JourneyMapLayout, type JourneyMapPersona, type JourneyMapPhase, type JourneyMapStep, type KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, LEGEND_HEIGHT, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutOptions, 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, MIN_PRIMARY_SCORE, type MemberVisibility, type MindmapLayoutEdge, type MindmapLayoutNode, type MindmapLayoutResult, type MindmapNode, 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 ParsedCycle, type ParsedERDiagram, type ParsedExtendedChart, type ParsedGantt, type ParsedGraph, type ParsedInfra, type ParsedJourneyMap, type ParsedKanban, type ParsedMindmap, type ParsedOrg, type ParsedPyramid, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedTechRadar, type ParsedVisualization, type ParsedWireframe, type ParticipantType, type PipeKeySpec, type PyramidLayer, type QuadrantPosition, 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 StateCollapseResult, type TagEntry, type TagGroup, type TechRadarBlip, type TechRadarLayoutPoint, type TechRadarQuadrant, type TechRadarRing, type VisualizationType, type WireframeElement, type WireframeElementType, type WireframeFormFactor, type WireframeLayout, type WireframeLayoutNode, addDurationToDate, applyCollapseProjection, applyGroupOrdering, applyPositionOverrides, boldPalette, buildExtendedChartOption, buildNoteMessageMap, buildRenderSequence, buildSimpleChartOption, buildTagLaneRowList, calculateSchedule, catppuccinPalette, confidence as chartTypeConfidence, chartTypeParsers, chartTypes, collapseBoxesAndLines, collapseMindmapTree, collapseOrgTree, collapseSitemapTree, collapseStateGroups, collectDiagramRoles, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeCycleLayout, computeInfra, computeInfraLegendGroups, computeLegendLayout, computeRadarLayout, computeScatterLabelGraphics, computeTimeTicks, contrastText, decodeDiagramUrl, decodeViewState, draculaPalette, encodeDiagramUrl, encodeViewState, extractDiagramSymbols, extractTagDeclarations, focusOrgTree, formatDateLabel, formatDgmoError, getAllChartTypes, getAvailablePalettes, getExtendedChartLegendGroups, getLegendReservedHeight, getPalette, getRadarGeometry, getRenderCategory, getSeriesColors, getSimpleChartLegendGroups, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, inferRoles, isArchiveColumn, isExtendedChartType, isRecognizedColorName, isSequenceBlock, isSequenceNote, isValidHex, knownChartTypeIds, layoutBoxesAndLines, layoutC4Components, layoutC4Containers, layoutC4Context, layoutC4Deployment, layoutClassDiagram, layoutERDiagram, layoutGraph, layoutInfra, layoutJourneyMap, layoutMindmap, layoutOrg, layoutSitemap, layoutWireframe, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikeSequence, looksLikeSitemap, looksLikeState, makeDgmoError, matchColorParens, matchesContiguously, mix, monokaiPalette, nord, nordPalette, normalize as normalizeChartTypePrompt, oneDarkPalette, orderArcNodes, parseAndLayoutInfra, parseBoxesAndLines, parseC4, parseChart, parseClassDiagram, parseCycle, parseDataRowValues, parseDgmo, parseDgmoChartType, parseERDiagram, parseExtendedChart, parseFirstLine, parseFlowchart, parseGantt, parseInArrowLabel, parseInfra, parseInlineMarkdown, parseJourneyMap, parseKanban, parseMindmap, parseOrg, parsePyramid, parseSequenceDgmo, parseSequenceDgmo as parseSequenceDiagram, parseSitemap, parseState, parseTechRadar, parseTimelineDate, parseVisualization, parseWireframe, registerExtractor, registerPalette, render, renderArcDiagram, renderBoxesAndLines, renderBoxesAndLinesForExport, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderCycle, renderCycleForExport, renderERDiagram, renderERDiagramForExport, renderExtendedChartForExport, renderFlowchart, renderFlowchartForExport, renderForExport, renderGantt, renderInfra, renderJourneyMap, renderJourneyMapForExport, renderKanban, renderKanbanForExport, renderLegendD3, renderLegendSvg, renderLegendSvgFromConfig, renderMindmap, renderMindmapForExport, renderOrg, renderOrgForExport, renderPyramid, renderPyramidForExport, renderQuadrant, renderQuadrantFocus, renderQuadrantFocusForExport, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSlopeChart, renderState, renderStateForExport, renderTechRadar, renderTechRadarForExport, renderTimeline, renderVenn, renderWireframe, renderWordCloud, resolveColor, resolveColorWithDiagnostic, resolveOrgImports, resolveTaskName, rollUpContextRelationships, rosePinePalette, scoreChartType, seriesColors, shade, solarizedPalette, suggestChartTypes, tint, tokyoNightPalette, truncateBareUrl, validateComputed, validateInfra, validateLabelCharacters };
package/dist/index.d.ts CHANGED
@@ -103,7 +103,6 @@ interface CompactViewState {
103
103
  rm?: string;
104
104
  htv?: Record<string, string[]>;
105
105
  ha?: string[];
106
- enl?: number[];
107
106
  sem?: boolean;
108
107
  cm?: boolean;
109
108
  c4l?: string;
@@ -206,6 +205,86 @@ declare function render(content: string, options?: {
206
205
  diagnostics: DgmoError[];
207
206
  }>;
208
207
 
208
+ interface ChartTypeMeta {
209
+ readonly id: string;
210
+ readonly description: string;
211
+ readonly triggers: readonly string[];
212
+ readonly fallback?: true;
213
+ }
214
+ declare const chartTypes: readonly ChartTypeMeta[];
215
+
216
+ /** Normalize a string to lowercase ASCII-ish tokens for matching. */
217
+ declare function normalize(s: string): string[];
218
+ /**
219
+ * True if `triggerTokens` appears as a contiguous slice of `promptTokens`.
220
+ * Token-based (not substring) — prevents "scatter plot" matching "scattered
221
+ * the plot", "ER diagram" matching "water diagram", and similar traps.
222
+ */
223
+ declare function matchesContiguously(promptTokens: readonly string[], triggerTokens: readonly string[]): boolean;
224
+ interface ChartTypeScore {
225
+ readonly type: ChartTypeMeta;
226
+ readonly score: number;
227
+ readonly matched: string[];
228
+ }
229
+ /**
230
+ * Score a single chart type against a prompt.
231
+ *
232
+ * Primary signal: contiguous trigger-phrase matches weighted by token count
233
+ * (longer phrases beat shorter ones). Secondary signal: description-word
234
+ * overlap at 0.25× weight — a tiebreak-only hint that rescues prompts which
235
+ * miss every trigger but touch description vocabulary. Triggers always win
236
+ * over descriptions because any trigger match is ≥1.0 and descriptions
237
+ * contribute ≤0.25 per token.
238
+ */
239
+ declare function scoreChartType(prompt: string, type: ChartTypeMeta): {
240
+ score: number;
241
+ matched: string[];
242
+ };
243
+ /**
244
+ * Minimum trigger-based score for a confident match. A result below this
245
+ * floor means no actual trigger fired — only description-rescue tokens
246
+ * contributed — so the caller should drop to the fallback list instead of
247
+ * returning a confident-looking wrong answer.
248
+ *
249
+ * 1.0 is the weight of a single-token trigger. Anything less came entirely
250
+ * from 0.25× description hits.
251
+ */
252
+ declare const MIN_PRIMARY_SCORE = 1;
253
+ /**
254
+ * Minimum absolute score gap required before calling a match
255
+ * non-ambiguous. 0.5 ≈ two description-rescue tokens' worth, or half a
256
+ * trigger-token difference. Below this, the cliff between "medium" and
257
+ * "ambiguous" is effectively noise.
258
+ */
259
+ declare const AMBIGUITY_THRESHOLD = 0.5;
260
+ type Confidence = 'high' | 'medium' | 'ambiguous';
261
+ /**
262
+ * Confidence from the top two scores. Rules:
263
+ * 1. top < MIN_PRIMARY_SCORE → ambiguous (no real trigger matched)
264
+ * 2. second === 0 → high (nothing competes)
265
+ * 3. top ≥ 2 × second → high (top dominates)
266
+ * 4. top − second < AMBIGUITY_THRESHOLD → ambiguous (gap is noise)
267
+ * 5. otherwise → medium
268
+ */
269
+ declare function confidence(top: number, second: number): Confidence;
270
+ interface SuggestionResult {
271
+ readonly ranked: readonly ChartTypeScore[];
272
+ readonly fallback: readonly ChartTypeMeta[];
273
+ readonly confidence: Confidence;
274
+ readonly fellBack: boolean;
275
+ }
276
+ /**
277
+ * Score every chart type against `prompt` and return a ranked suggestion
278
+ * bundle. Types with score 0 are filtered out. When the top score is below
279
+ * `MIN_PRIMARY_SCORE` (no real trigger fired), the caller should present
280
+ * the fallback list — `fellBack` is set to true in that case.
281
+ *
282
+ * Array order is preserved: scoring iterates `chartTypes` in source order
283
+ * and `.sort` is stable in V8, so ties go to the earlier entry — specialized
284
+ * types beat generic catch-alls by construction.
285
+ */
286
+ declare function suggestChartTypes(prompt: string): SuggestionResult;
287
+
209
288
  /**
210
289
  * Extracts the chart type from raw file content.
211
290
  * First tries the first non-empty, non-comment line as a bare chart type name
@@ -226,12 +305,42 @@ declare function getRenderCategory(chartType: string): RenderCategory | null;
226
305
  * Returns false for standard chart types and all other types.
227
306
  */
228
307
  declare function isExtendedChartType(chartType: string): boolean;
308
+ /**
309
+ * Returns all supported chart type identifiers in canonical (tier) order,
310
+ * derived from `chartTypes`. Consumers that need alphabetical order should
311
+ * call `.sort()` explicitly.
312
+ */
313
+ declare function getAllChartTypes(): string[];
314
+ /**
315
+ * Canonical descriptions for every supported chart type. Derived from
316
+ * `chartTypes` so there is exactly one place to update when adding a new
317
+ * type. Consumed by the CLI `--chart-types` flag, the editor autocomplete
318
+ * popup, and the MCP `list_chart_types` tool.
319
+ */
320
+ declare const CHART_TYPE_DESCRIPTIONS: Record<string, string>;
321
+ type ParseResult = {
322
+ diagnostics: DgmoError[];
323
+ };
324
+ type ParseFn = (content: string) => ParseResult;
325
+ /**
326
+ * Maps every chart-type id to the parser that handles it. Adding a new
327
+ * chart type means:
328
+ * 1. Add an entry here.
329
+ * 2. Add an entry to `chartTypes` in `chart-types.ts`.
330
+ *
331
+ * The `chart-types.test.ts` cross-check asserts both sets are identical;
332
+ * forgetting either side trips the test.
333
+ */
334
+ declare const chartTypeParsers: ReadonlyArray<readonly [string, ParseFn]>;
335
+ /** Ids in the same order as `chartTypeParsers`; used for cross-checks. */
336
+ declare const knownChartTypeIds: readonly string[];
229
337
  /**
230
338
  * Parse DGMO content and return diagnostics without rendering.
231
339
  * Useful for the CLI and editor to surface all errors before attempting render.
232
340
  */
233
341
  declare function parseDgmo(content: string): {
234
342
  diagnostics: DgmoError[];
343
+ chartType: string | null;
235
344
  };
236
345
 
237
346
  /**
@@ -796,7 +905,7 @@ interface TagGroup {
796
905
  lineNumber: number;
797
906
  }
798
907
 
799
- type VisualizationType = 'slope' | 'wordcloud' | 'arc' | 'timeline' | 'venn' | 'quadrant' | 'sequence' | 'tech-radar' | 'cycle';
908
+ type VisualizationType = 'slope' | 'wordcloud' | 'arc' | 'timeline' | 'venn' | 'quadrant' | 'sequence' | 'tech-radar' | 'cycle' | 'pyramid';
800
909
  interface D3DataItem {
801
910
  label: string;
802
911
  values: number[];
@@ -1575,10 +1684,37 @@ interface OrgLayoutResult {
1575
1684
  }
1576
1685
  declare function layoutOrg(parsed: ParsedOrg, hiddenCounts?: Map<string, number>, activeTagGroup?: string | null, hiddenAttributes?: Set<string>, expandAllLegend?: boolean): OrgLayoutResult;
1577
1686
 
1687
+ interface CollapsedOrgResult {
1688
+ /** ParsedOrg with collapsed subtrees pruned (deep-cloned, never mutates original) */
1689
+ parsed: ParsedOrg;
1690
+ /** nodeId → count of hidden descendants */
1691
+ hiddenCounts: Map<string, number>;
1692
+ }
1693
+ interface AncestorInfo {
1694
+ id: string;
1695
+ label: string;
1696
+ lineNumber: number;
1697
+ color?: string;
1698
+ metadata: Record<string, string>;
1699
+ isContainer: boolean;
1700
+ }
1701
+ interface FocusOrgResult {
1702
+ /** ParsedOrg with only the focused subtree as the single root */
1703
+ parsed: ParsedOrg;
1704
+ /** Ancestor path from original root → parent of focused node (top-down order) */
1705
+ ancestorPath: AncestorInfo[];
1706
+ }
1707
+ declare function collapseOrgTree(original: ParsedOrg, collapsedIds: Set<string>): CollapsedOrgResult;
1708
+ /**
1709
+ * Extract a subtree rooted at `focusNodeId`, returning the focused tree
1710
+ * and the ancestor breadcrumb path. Returns null if the node is not found.
1711
+ */
1712
+ declare function focusOrgTree(original: ParsedOrg, focusNodeId: string): FocusOrgResult | null;
1713
+
1578
1714
  declare function renderOrg(container: HTMLDivElement, parsed: ParsedOrg, layout: OrgLayoutResult, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
1579
1715
  width?: number;
1580
1716
  height?: number;
1581
- }, activeTagGroup?: string | null, hiddenAttributes?: Set<string>): void;
1717
+ }, activeTagGroup?: string | null, hiddenAttributes?: Set<string>, ancestorPath?: AncestorInfo[]): void;
1582
1718
  declare function renderOrgForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
1583
1719
 
1584
1720
  /** @deprecated Use `TagEntry` from `utils/tag-groups` */
@@ -2579,14 +2715,6 @@ declare function collectTasks(nodes: GanttNode[]): GanttTask[];
2579
2715
  */
2580
2716
  declare function resolveTaskName(name: string, allTasks: GanttTask[]): ResolverResult;
2581
2717
 
2582
- interface CollapsedOrgResult {
2583
- /** ParsedOrg with collapsed subtrees pruned (deep-cloned, never mutates original) */
2584
- parsed: ParsedOrg;
2585
- /** nodeId → count of hidden descendants */
2586
- hiddenCounts: Map<string, number>;
2587
- }
2588
- declare function collapseOrgTree(original: ParsedOrg, collapsedIds: Set<string>): CollapsedOrgResult;
2589
-
2590
2718
  interface MindmapNode {
2591
2719
  id: string;
2592
2720
  label: string;
@@ -3090,6 +3218,61 @@ interface JourneyMapInteractiveOptions {
3090
3218
  declare function renderJourneyMap(container: HTMLElement, parsed: ParsedJourneyMap, palette: PaletteColors, isDark: boolean, options?: JourneyMapInteractiveOptions): void;
3091
3219
  declare function renderJourneyMapForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
3092
3220
 
3221
+ interface PyramidLayer {
3222
+ label: string;
3223
+ lineNumber: number;
3224
+ /** Optional palette color name (red/green/blue/…). */
3225
+ color?: string;
3226
+ /** Description lines — from bare pipe shorthand or indented body. */
3227
+ description: string[];
3228
+ /** Unconsumed pipe metadata (reserved for future use). */
3229
+ metadata: Record<string, string>;
3230
+ }
3231
+ interface ParsedPyramid {
3232
+ type: 'pyramid';
3233
+ title: string;
3234
+ titleLineNumber: number;
3235
+ layers: PyramidLayer[];
3236
+ /** When true, apex points down instead of up. */
3237
+ inverted: boolean;
3238
+ options: Record<string, string>;
3239
+ diagnostics: DgmoError[];
3240
+ error: string | null;
3241
+ }
3242
+
3243
+ /**
3244
+ * Parse a `.dgmo` pyramid diagram document.
3245
+ *
3246
+ * Top of file = apex of pyramid (reads top-down).
3247
+ *
3248
+ * Syntax:
3249
+ * ```
3250
+ * pyramid Maslow's Hierarchy of Needs
3251
+ *
3252
+ * inverted // optional — flips apex to bottom
3253
+ *
3254
+ * Self-Actualization // indented body = description
3255
+ * Achieving one's full potential.
3256
+ *
3257
+ * Esteem | Respect, recognition // bare pipe shorthand = description
3258
+ *
3259
+ * Love & Belonging | color: blue // structured metadata
3260
+ * Friendship, intimacy, family.
3261
+ *
3262
+ * Physiological | Food, water, rest
3263
+ * ```
3264
+ */
3265
+ declare function parsePyramid(content: string): ParsedPyramid;
3266
+
3267
+ /**
3268
+ * Render a pyramid diagram into the given container.
3269
+ */
3270
+ declare function renderPyramid(container: HTMLDivElement, parsed: ParsedPyramid, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: D3ExportDimensions): void;
3271
+ /**
3272
+ * Render for CLI/export (no click handlers).
3273
+ */
3274
+ declare function renderPyramidForExport(container: HTMLDivElement, parsed: ParsedPyramid, palette: PaletteColors, isDark: boolean, exportDims?: D3ExportDimensions): void;
3275
+
3093
3276
  /**
3094
3277
  * Async or sync file reader. Receives an absolute path, returns content.
3095
3278
  * Throwing means "file not found".
@@ -3140,13 +3323,8 @@ interface SectionMessageGroup {
3140
3323
  interface SequenceRenderOptions {
3141
3324
  collapsedSections?: Set<number>;
3142
3325
  collapsedGroups?: Set<number>;
3143
- expandedNoteLines?: Set<number>;
3144
3326
  exportWidth?: number;
3145
3327
  activeTagGroup?: string | null;
3146
- expandAllNotes?: boolean;
3147
- onExpandAllNotes?: (expand: boolean) => void;
3148
- controlsExpanded?: boolean;
3149
- onToggleControlsExpand?: () => void;
3150
3328
  }
3151
3329
  /**
3152
3330
  * Group messages by the top-level section that precedes them.
@@ -3202,14 +3380,9 @@ declare function renderSequenceDiagram(container: HTMLDivElement, parsed: Parsed
3202
3380
  /**
3203
3381
  * Build a mapping from each note's lineNumber to the lineNumber of its
3204
3382
  * associated message (the last message before the note in document order).
3205
- * Used by the app to expand notes when cursor is on the associated message.
3383
+ * Used by the app to highlight the associated message when cursor is on a note.
3206
3384
  */
3207
3385
  declare function buildNoteMessageMap(elements: SequenceElement[]): Map<number, number>;
3208
- /**
3209
- * Collect all note line numbers from a sequence diagram's elements.
3210
- * Used by the app to compute the "expand all" set.
3211
- */
3212
- declare function collectNoteLineNumbers(elements: SequenceElement[]): number[];
3213
3386
 
3214
3387
  interface CollapsedView {
3215
3388
  participants: SequenceParticipant[];
@@ -3301,4 +3474,4 @@ declare function parseFirstLine(line: string): {
3301
3474
  title: string | undefined;
3302
3475
  } | null;
3303
3476
 
3304
- 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 BlipTrend, 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 CollapsedMindmapResult, type CollapsedOrgResult, type CollapsedSitemapResult, type CollapsedView, type CompactViewState, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, type CycleEdge, type CycleLayoutEdge, type CycleLayoutNode, type CycleLayoutResult, type CycleNode, type CycleRenderOptions, 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 JourneyMapAnnotation, type JourneyMapInteractiveOptions, type JourneyMapLayout, type JourneyMapPersona, type JourneyMapPhase, type JourneyMapStep, type KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, LEGEND_HEIGHT, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutOptions, 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 MindmapLayoutEdge, type MindmapLayoutNode, type MindmapLayoutResult, type MindmapNode, 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 ParsedCycle, type ParsedERDiagram, type ParsedExtendedChart, type ParsedGantt, type ParsedGraph, type ParsedInfra, type ParsedJourneyMap, type ParsedKanban, type ParsedMindmap, type ParsedOrg, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedTechRadar, type ParsedVisualization, type ParsedWireframe, type ParticipantType, type PipeKeySpec, type QuadrantPosition, 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 StateCollapseResult, type TagEntry, type TagGroup, type TechRadarBlip, type TechRadarLayoutPoint, type TechRadarQuadrant, type TechRadarRing, type VisualizationType, type WireframeElement, type WireframeElementType, type WireframeFormFactor, type WireframeLayout, type WireframeLayoutNode, addDurationToDate, applyCollapseProjection, applyGroupOrdering, applyPositionOverrides, boldPalette, buildExtendedChartOption, buildNoteMessageMap, buildRenderSequence, buildSimpleChartOption, buildTagLaneRowList, calculateSchedule, catppuccinPalette, collapseBoxesAndLines, collapseMindmapTree, collapseOrgTree, collapseSitemapTree, collapseStateGroups, collectDiagramRoles, collectNoteLineNumbers, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeCycleLayout, computeInfra, computeInfraLegendGroups, computeLegendLayout, computeRadarLayout, computeScatterLabelGraphics, computeTimeTicks, contrastText, decodeDiagramUrl, decodeViewState, draculaPalette, encodeDiagramUrl, encodeViewState, extractDiagramSymbols, extractTagDeclarations, formatDateLabel, formatDgmoError, getAvailablePalettes, getExtendedChartLegendGroups, getLegendReservedHeight, getPalette, getRadarGeometry, 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, layoutJourneyMap, layoutMindmap, layoutOrg, layoutSitemap, layoutWireframe, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikeSequence, looksLikeSitemap, looksLikeState, makeDgmoError, matchColorParens, mix, monokaiPalette, nord, nordPalette, oneDarkPalette, orderArcNodes, parseAndLayoutInfra, parseBoxesAndLines, parseC4, parseChart, parseClassDiagram, parseCycle, parseDataRowValues, parseDgmo, parseDgmoChartType, parseERDiagram, parseExtendedChart, parseFirstLine, parseFlowchart, parseGantt, parseInArrowLabel, parseInfra, parseInlineMarkdown, parseJourneyMap, parseKanban, parseMindmap, parseOrg, parseSequenceDgmo, parseSitemap, parseState, parseTechRadar, parseTimelineDate, parseVisualization, parseWireframe, registerExtractor, registerPalette, render, renderArcDiagram, renderBoxesAndLines, renderBoxesAndLinesForExport, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderCycle, renderCycleForExport, renderERDiagram, renderERDiagramForExport, renderExtendedChartForExport, renderFlowchart, renderFlowchartForExport, renderForExport, renderGantt, renderInfra, renderJourneyMap, renderJourneyMapForExport, renderKanban, renderKanbanForExport, renderLegendD3, renderLegendSvg, renderLegendSvgFromConfig, renderMindmap, renderMindmapForExport, renderOrg, renderOrgForExport, renderQuadrant, renderQuadrantFocus, renderQuadrantFocusForExport, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSlopeChart, renderState, renderStateForExport, renderTechRadar, renderTechRadarForExport, renderTimeline, renderVenn, renderWireframe, renderWordCloud, resolveColor, resolveColorWithDiagnostic, resolveOrgImports, resolveTaskName, rollUpContextRelationships, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette, truncateBareUrl, validateComputed, validateInfra, validateLabelCharacters };
3477
+ export { ALL_CHART_TYPES, AMBIGUITY_THRESHOLD, ARROW_DIAGNOSTIC_CODES, type Activation, type AncestorInfo, type ArcLink, type ArcNodeGroup, type BLCollapseResult, type BLEdge, type BLGroup, type BLLayoutEdge, type BLLayoutGroup, type BLLayoutNode, type BLLayoutResult, type BLNode, type BlipTrend, 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, CHART_TYPE_DESCRIPTIONS, COMPLETION_REGISTRY, type ChartDataPoint, type ChartEra, type ChartType$1 as ChartType, type Confidence as ChartTypeConfidence, type ChartTypeMeta, type ChartTypeScore, type SuggestionResult as ChartTypeSuggestionResult, type ClassLayoutEdge, type ClassLayoutNode, type ClassLayoutResult, type ClassMember, type ClassModifier, type ClassNode, type ClassRelationship, type CollapsedMindmapResult, type CollapsedOrgResult, type CollapsedSitemapResult, type CollapsedView, type CompactViewState, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, type CycleEdge, type CycleLayoutEdge, type CycleLayoutNode, type CycleLayoutResult, type CycleNode, type CycleRenderOptions, 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 FocusOrgResult, 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 JourneyMapAnnotation, type JourneyMapInteractiveOptions, type JourneyMapLayout, type JourneyMapPersona, type JourneyMapPhase, type JourneyMapStep, type KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, LEGEND_HEIGHT, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutOptions, 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, MIN_PRIMARY_SCORE, type MemberVisibility, type MindmapLayoutEdge, type MindmapLayoutNode, type MindmapLayoutResult, type MindmapNode, 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 ParsedCycle, type ParsedERDiagram, type ParsedExtendedChart, type ParsedGantt, type ParsedGraph, type ParsedInfra, type ParsedJourneyMap, type ParsedKanban, type ParsedMindmap, type ParsedOrg, type ParsedPyramid, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedTechRadar, type ParsedVisualization, type ParsedWireframe, type ParticipantType, type PipeKeySpec, type PyramidLayer, type QuadrantPosition, 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 StateCollapseResult, type TagEntry, type TagGroup, type TechRadarBlip, type TechRadarLayoutPoint, type TechRadarQuadrant, type TechRadarRing, type VisualizationType, type WireframeElement, type WireframeElementType, type WireframeFormFactor, type WireframeLayout, type WireframeLayoutNode, addDurationToDate, applyCollapseProjection, applyGroupOrdering, applyPositionOverrides, boldPalette, buildExtendedChartOption, buildNoteMessageMap, buildRenderSequence, buildSimpleChartOption, buildTagLaneRowList, calculateSchedule, catppuccinPalette, confidence as chartTypeConfidence, chartTypeParsers, chartTypes, collapseBoxesAndLines, collapseMindmapTree, collapseOrgTree, collapseSitemapTree, collapseStateGroups, collectDiagramRoles, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeCycleLayout, computeInfra, computeInfraLegendGroups, computeLegendLayout, computeRadarLayout, computeScatterLabelGraphics, computeTimeTicks, contrastText, decodeDiagramUrl, decodeViewState, draculaPalette, encodeDiagramUrl, encodeViewState, extractDiagramSymbols, extractTagDeclarations, focusOrgTree, formatDateLabel, formatDgmoError, getAllChartTypes, getAvailablePalettes, getExtendedChartLegendGroups, getLegendReservedHeight, getPalette, getRadarGeometry, getRenderCategory, getSeriesColors, getSimpleChartLegendGroups, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, inferRoles, isArchiveColumn, isExtendedChartType, isRecognizedColorName, isSequenceBlock, isSequenceNote, isValidHex, knownChartTypeIds, layoutBoxesAndLines, layoutC4Components, layoutC4Containers, layoutC4Context, layoutC4Deployment, layoutClassDiagram, layoutERDiagram, layoutGraph, layoutInfra, layoutJourneyMap, layoutMindmap, layoutOrg, layoutSitemap, layoutWireframe, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikeSequence, looksLikeSitemap, looksLikeState, makeDgmoError, matchColorParens, matchesContiguously, mix, monokaiPalette, nord, nordPalette, normalize as normalizeChartTypePrompt, oneDarkPalette, orderArcNodes, parseAndLayoutInfra, parseBoxesAndLines, parseC4, parseChart, parseClassDiagram, parseCycle, parseDataRowValues, parseDgmo, parseDgmoChartType, parseERDiagram, parseExtendedChart, parseFirstLine, parseFlowchart, parseGantt, parseInArrowLabel, parseInfra, parseInlineMarkdown, parseJourneyMap, parseKanban, parseMindmap, parseOrg, parsePyramid, parseSequenceDgmo, parseSequenceDgmo as parseSequenceDiagram, parseSitemap, parseState, parseTechRadar, parseTimelineDate, parseVisualization, parseWireframe, registerExtractor, registerPalette, render, renderArcDiagram, renderBoxesAndLines, renderBoxesAndLinesForExport, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderCycle, renderCycleForExport, renderERDiagram, renderERDiagramForExport, renderExtendedChartForExport, renderFlowchart, renderFlowchartForExport, renderForExport, renderGantt, renderInfra, renderJourneyMap, renderJourneyMapForExport, renderKanban, renderKanbanForExport, renderLegendD3, renderLegendSvg, renderLegendSvgFromConfig, renderMindmap, renderMindmapForExport, renderOrg, renderOrgForExport, renderPyramid, renderPyramidForExport, renderQuadrant, renderQuadrantFocus, renderQuadrantFocusForExport, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSlopeChart, renderState, renderStateForExport, renderTechRadar, renderTechRadarForExport, renderTimeline, renderVenn, renderWireframe, renderWordCloud, resolveColor, resolveColorWithDiagnostic, resolveOrgImports, resolveTaskName, rollUpContextRelationships, rosePinePalette, scoreChartType, seriesColors, shade, solarizedPalette, suggestChartTypes, tint, tokyoNightPalette, truncateBareUrl, validateComputed, validateInfra, validateLabelCharacters };