@diagrammo/dgmo 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -515,12 +515,17 @@ interface SequenceMessage {
515
515
  /**
516
516
  * A conditional or loop block in the sequence diagram.
517
517
  */
518
+ interface ElseIfBranch {
519
+ label: string;
520
+ children: SequenceElement[];
521
+ }
518
522
  interface SequenceBlock {
519
523
  kind: 'block';
520
524
  type: 'if' | 'loop' | 'parallel';
521
525
  label: string;
522
526
  children: SequenceElement[];
523
527
  elseChildren: SequenceElement[];
528
+ elseIfBranches?: ElseIfBranch[];
524
529
  lineNumber: number;
525
530
  }
526
531
  /**
@@ -532,8 +537,19 @@ interface SequenceSection {
532
537
  color?: string;
533
538
  lineNumber: number;
534
539
  }
535
- type SequenceElement = SequenceMessage | SequenceBlock | SequenceSection;
540
+ /**
541
+ * An annotation attached to a message, rendered as a folded-corner box.
542
+ */
543
+ interface SequenceNote {
544
+ kind: 'note';
545
+ text: string;
546
+ position: 'right' | 'left';
547
+ participantId: string;
548
+ lineNumber: number;
549
+ }
550
+ type SequenceElement = SequenceMessage | SequenceBlock | SequenceSection | SequenceNote;
536
551
  declare function isSequenceBlock(el: SequenceElement): el is SequenceBlock;
552
+ declare function isSequenceNote(el: SequenceElement): el is SequenceNote;
537
553
  /**
538
554
  * A named group of participants rendered as a labeled box.
539
555
  */
@@ -617,6 +633,95 @@ declare function buildMermaidQuadrant(parsed: ParsedQuadrant, options?: {
617
633
  mutedTextColor?: string;
618
634
  }): string;
619
635
 
636
+ type GraphShape = 'terminal' | 'process' | 'decision' | 'io' | 'subroutine' | 'document';
637
+ type GraphDirection = 'TB' | 'LR';
638
+ interface GraphNode {
639
+ id: string;
640
+ label: string;
641
+ shape: GraphShape;
642
+ color?: string;
643
+ group?: string;
644
+ lineNumber: number;
645
+ }
646
+ interface GraphEdge {
647
+ source: string;
648
+ target: string;
649
+ label?: string;
650
+ color?: string;
651
+ lineNumber: number;
652
+ }
653
+ interface GraphGroup {
654
+ id: string;
655
+ label: string;
656
+ color?: string;
657
+ nodeIds: string[];
658
+ lineNumber: number;
659
+ }
660
+ interface ParsedGraph {
661
+ type: 'flowchart';
662
+ title?: string;
663
+ direction: GraphDirection;
664
+ nodes: GraphNode[];
665
+ edges: GraphEdge[];
666
+ groups?: GraphGroup[];
667
+ error?: string;
668
+ }
669
+
670
+ declare function parseFlowchart(content: string, palette?: PaletteColors): ParsedGraph;
671
+ /**
672
+ * Detect if content looks like a flowchart (without explicit `chart: flowchart` header).
673
+ * Checks for shape delimiters combined with `->` arrows.
674
+ * Avoids false-positives on sequence diagrams (which use bare names with `->`)
675
+ */
676
+ declare function looksLikeFlowchart(content: string): boolean;
677
+
678
+ interface LayoutNode {
679
+ id: string;
680
+ label: string;
681
+ shape: GraphShape;
682
+ color?: string;
683
+ group?: string;
684
+ lineNumber: number;
685
+ x: number;
686
+ y: number;
687
+ width: number;
688
+ height: number;
689
+ }
690
+ interface LayoutEdge {
691
+ source: string;
692
+ target: string;
693
+ points: {
694
+ x: number;
695
+ y: number;
696
+ }[];
697
+ label?: string;
698
+ color?: string;
699
+ lineNumber: number;
700
+ }
701
+ interface LayoutGroup {
702
+ id: string;
703
+ label: string;
704
+ color?: string;
705
+ x: number;
706
+ y: number;
707
+ width: number;
708
+ height: number;
709
+ }
710
+ interface LayoutResult {
711
+ nodes: LayoutNode[];
712
+ edges: LayoutEdge[];
713
+ groups: LayoutGroup[];
714
+ width: number;
715
+ height: number;
716
+ }
717
+ declare function layoutGraph(graph: ParsedGraph): LayoutResult;
718
+
719
+ declare function renderFlowchart(container: HTMLDivElement, graph: ParsedGraph, layout: LayoutResult, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
720
+ width?: number;
721
+ height?: number;
722
+ }): void;
723
+ declare function renderFlowchartForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
724
+
620
725
  interface SectionMessageGroup {
621
726
  section: SequenceSection;
622
727
  messageIndices: number[];
@@ -705,4 +810,4 @@ declare function resolveColor(color: string, palette?: {
705
810
  /** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
706
811
  declare const seriesColors: string[];
707
812
 
708
- export { type Activation, type ArcLink, type ArcNodeGroup, type ChartDataPoint, type ChartType, type D3ChartType, type D3ExportDimensions, DGMO_CHART_TYPE_MAP, type DgmoFramework, type EChartsChartType, type PaletteColors, type PaletteConfig, type ParsedChart, type ParsedD3, type ParsedEChart, type ParsedQuadrant, type ParsedSequenceDgmo, type ParticipantType, RULE_COUNT, type RenderStep, type SectionMessageGroup, type SequenceBlock, type SequenceElement, type SequenceGroup, type SequenceMessage, type SequenceParticipant, type SequenceRenderOptions, type SequenceSection, addDurationToDate, applyGroupOrdering, applyPositionOverrides, boldPalette, buildEChartsOption, buildEChartsOptionFromChart, buildMermaidQuadrant, buildMermaidThemeVars, buildRenderSequence, buildThemeCSS, catppuccinPalette, colorNames, computeActivations, computeTimeTicks, contrastText, formatDateLabel, getAvailablePalettes, getDgmoFramework, getPalette, getSeriesColors, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, isSequenceBlock, isValidHex, looksLikeSequence, mute, nord, nordPalette, oneDarkPalette, orderArcNodes, parseChart, parseD3, parseDgmoChartType, parseEChart, parseQuadrant, parseSequenceDgmo, parseTimelineDate, registerPalette, renderArcDiagram, renderD3ForExport, renderEChartsForExport, renderQuadrant, renderSequenceDiagram, renderSlopeChart, renderTimeline, renderVenn, renderWordCloud, resolveColor, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette };
813
+ export { type Activation, type ArcLink, type ArcNodeGroup, type ChartDataPoint, type ChartType, type D3ChartType, type D3ExportDimensions, DGMO_CHART_TYPE_MAP, type DgmoFramework, type EChartsChartType, type ElseIfBranch, type GraphDirection, type GraphEdge, type GraphGroup, type GraphNode, type GraphShape, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutResult, type PaletteColors, type PaletteConfig, type ParsedChart, type ParsedD3, type ParsedEChart, type ParsedGraph, type ParsedQuadrant, type ParsedSequenceDgmo, type ParticipantType, RULE_COUNT, type RenderStep, type SectionMessageGroup, type SequenceBlock, type SequenceElement, type SequenceGroup, type SequenceMessage, type SequenceNote, type SequenceParticipant, type SequenceRenderOptions, type SequenceSection, addDurationToDate, applyGroupOrdering, applyPositionOverrides, boldPalette, buildEChartsOption, buildEChartsOptionFromChart, buildMermaidQuadrant, buildMermaidThemeVars, buildRenderSequence, buildThemeCSS, catppuccinPalette, colorNames, computeActivations, computeTimeTicks, contrastText, formatDateLabel, getAvailablePalettes, getDgmoFramework, getPalette, getSeriesColors, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, isSequenceBlock, isSequenceNote, isValidHex, layoutGraph, looksLikeFlowchart, looksLikeSequence, mute, nord, nordPalette, oneDarkPalette, orderArcNodes, parseChart, parseD3, parseDgmoChartType, parseEChart, parseFlowchart, parseQuadrant, parseSequenceDgmo, parseTimelineDate, registerPalette, renderArcDiagram, renderD3ForExport, renderEChartsForExport, renderFlowchart, renderFlowchartForExport, renderQuadrant, renderSequenceDiagram, renderSlopeChart, renderTimeline, renderVenn, renderWordCloud, resolveColor, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette };
package/dist/index.d.ts CHANGED
@@ -515,12 +515,17 @@ interface SequenceMessage {
515
515
  /**
516
516
  * A conditional or loop block in the sequence diagram.
517
517
  */
518
+ interface ElseIfBranch {
519
+ label: string;
520
+ children: SequenceElement[];
521
+ }
518
522
  interface SequenceBlock {
519
523
  kind: 'block';
520
524
  type: 'if' | 'loop' | 'parallel';
521
525
  label: string;
522
526
  children: SequenceElement[];
523
527
  elseChildren: SequenceElement[];
528
+ elseIfBranches?: ElseIfBranch[];
524
529
  lineNumber: number;
525
530
  }
526
531
  /**
@@ -532,8 +537,19 @@ interface SequenceSection {
532
537
  color?: string;
533
538
  lineNumber: number;
534
539
  }
535
- type SequenceElement = SequenceMessage | SequenceBlock | SequenceSection;
540
+ /**
541
+ * An annotation attached to a message, rendered as a folded-corner box.
542
+ */
543
+ interface SequenceNote {
544
+ kind: 'note';
545
+ text: string;
546
+ position: 'right' | 'left';
547
+ participantId: string;
548
+ lineNumber: number;
549
+ }
550
+ type SequenceElement = SequenceMessage | SequenceBlock | SequenceSection | SequenceNote;
536
551
  declare function isSequenceBlock(el: SequenceElement): el is SequenceBlock;
552
+ declare function isSequenceNote(el: SequenceElement): el is SequenceNote;
537
553
  /**
538
554
  * A named group of participants rendered as a labeled box.
539
555
  */
@@ -617,6 +633,95 @@ declare function buildMermaidQuadrant(parsed: ParsedQuadrant, options?: {
617
633
  mutedTextColor?: string;
618
634
  }): string;
619
635
 
636
+ type GraphShape = 'terminal' | 'process' | 'decision' | 'io' | 'subroutine' | 'document';
637
+ type GraphDirection = 'TB' | 'LR';
638
+ interface GraphNode {
639
+ id: string;
640
+ label: string;
641
+ shape: GraphShape;
642
+ color?: string;
643
+ group?: string;
644
+ lineNumber: number;
645
+ }
646
+ interface GraphEdge {
647
+ source: string;
648
+ target: string;
649
+ label?: string;
650
+ color?: string;
651
+ lineNumber: number;
652
+ }
653
+ interface GraphGroup {
654
+ id: string;
655
+ label: string;
656
+ color?: string;
657
+ nodeIds: string[];
658
+ lineNumber: number;
659
+ }
660
+ interface ParsedGraph {
661
+ type: 'flowchart';
662
+ title?: string;
663
+ direction: GraphDirection;
664
+ nodes: GraphNode[];
665
+ edges: GraphEdge[];
666
+ groups?: GraphGroup[];
667
+ error?: string;
668
+ }
669
+
670
+ declare function parseFlowchart(content: string, palette?: PaletteColors): ParsedGraph;
671
+ /**
672
+ * Detect if content looks like a flowchart (without explicit `chart: flowchart` header).
673
+ * Checks for shape delimiters combined with `->` arrows.
674
+ * Avoids false-positives on sequence diagrams (which use bare names with `->`)
675
+ */
676
+ declare function looksLikeFlowchart(content: string): boolean;
677
+
678
+ interface LayoutNode {
679
+ id: string;
680
+ label: string;
681
+ shape: GraphShape;
682
+ color?: string;
683
+ group?: string;
684
+ lineNumber: number;
685
+ x: number;
686
+ y: number;
687
+ width: number;
688
+ height: number;
689
+ }
690
+ interface LayoutEdge {
691
+ source: string;
692
+ target: string;
693
+ points: {
694
+ x: number;
695
+ y: number;
696
+ }[];
697
+ label?: string;
698
+ color?: string;
699
+ lineNumber: number;
700
+ }
701
+ interface LayoutGroup {
702
+ id: string;
703
+ label: string;
704
+ color?: string;
705
+ x: number;
706
+ y: number;
707
+ width: number;
708
+ height: number;
709
+ }
710
+ interface LayoutResult {
711
+ nodes: LayoutNode[];
712
+ edges: LayoutEdge[];
713
+ groups: LayoutGroup[];
714
+ width: number;
715
+ height: number;
716
+ }
717
+ declare function layoutGraph(graph: ParsedGraph): LayoutResult;
718
+
719
+ declare function renderFlowchart(container: HTMLDivElement, graph: ParsedGraph, layout: LayoutResult, palette: PaletteColors, isDark: boolean, onClickItem?: (lineNumber: number) => void, exportDims?: {
720
+ width?: number;
721
+ height?: number;
722
+ }): void;
723
+ declare function renderFlowchartForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette: PaletteColors): string;
724
+
620
725
  interface SectionMessageGroup {
621
726
  section: SequenceSection;
622
727
  messageIndices: number[];
@@ -705,4 +810,4 @@ declare function resolveColor(color: string, palette?: {
705
810
  /** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
706
811
  declare const seriesColors: string[];
707
812
 
708
- export { type Activation, type ArcLink, type ArcNodeGroup, type ChartDataPoint, type ChartType, type D3ChartType, type D3ExportDimensions, DGMO_CHART_TYPE_MAP, type DgmoFramework, type EChartsChartType, type PaletteColors, type PaletteConfig, type ParsedChart, type ParsedD3, type ParsedEChart, type ParsedQuadrant, type ParsedSequenceDgmo, type ParticipantType, RULE_COUNT, type RenderStep, type SectionMessageGroup, type SequenceBlock, type SequenceElement, type SequenceGroup, type SequenceMessage, type SequenceParticipant, type SequenceRenderOptions, type SequenceSection, addDurationToDate, applyGroupOrdering, applyPositionOverrides, boldPalette, buildEChartsOption, buildEChartsOptionFromChart, buildMermaidQuadrant, buildMermaidThemeVars, buildRenderSequence, buildThemeCSS, catppuccinPalette, colorNames, computeActivations, computeTimeTicks, contrastText, formatDateLabel, getAvailablePalettes, getDgmoFramework, getPalette, getSeriesColors, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, isSequenceBlock, isValidHex, looksLikeSequence, mute, nord, nordPalette, oneDarkPalette, orderArcNodes, parseChart, parseD3, parseDgmoChartType, parseEChart, parseQuadrant, parseSequenceDgmo, parseTimelineDate, registerPalette, renderArcDiagram, renderD3ForExport, renderEChartsForExport, renderQuadrant, renderSequenceDiagram, renderSlopeChart, renderTimeline, renderVenn, renderWordCloud, resolveColor, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette };
813
+ export { type Activation, type ArcLink, type ArcNodeGroup, type ChartDataPoint, type ChartType, type D3ChartType, type D3ExportDimensions, DGMO_CHART_TYPE_MAP, type DgmoFramework, type EChartsChartType, type ElseIfBranch, type GraphDirection, type GraphEdge, type GraphGroup, type GraphNode, type GraphShape, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutResult, type PaletteColors, type PaletteConfig, type ParsedChart, type ParsedD3, type ParsedEChart, type ParsedGraph, type ParsedQuadrant, type ParsedSequenceDgmo, type ParticipantType, RULE_COUNT, type RenderStep, type SectionMessageGroup, type SequenceBlock, type SequenceElement, type SequenceGroup, type SequenceMessage, type SequenceNote, type SequenceParticipant, type SequenceRenderOptions, type SequenceSection, addDurationToDate, applyGroupOrdering, applyPositionOverrides, boldPalette, buildEChartsOption, buildEChartsOptionFromChart, buildMermaidQuadrant, buildMermaidThemeVars, buildRenderSequence, buildThemeCSS, catppuccinPalette, colorNames, computeActivations, computeTimeTicks, contrastText, formatDateLabel, getAvailablePalettes, getDgmoFramework, getPalette, getSeriesColors, groupMessagesBySection, gruvboxPalette, hexToHSL, hexToHSLString, hslToHex, inferParticipantType, isSequenceBlock, isSequenceNote, isValidHex, layoutGraph, looksLikeFlowchart, looksLikeSequence, mute, nord, nordPalette, oneDarkPalette, orderArcNodes, parseChart, parseD3, parseDgmoChartType, parseEChart, parseFlowchart, parseQuadrant, parseSequenceDgmo, parseTimelineDate, registerPalette, renderArcDiagram, renderD3ForExport, renderEChartsForExport, renderFlowchart, renderFlowchartForExport, renderQuadrant, renderSequenceDiagram, renderSlopeChart, renderTimeline, renderVenn, renderWordCloud, resolveColor, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette };