@diagrammo/dgmo 0.2.9 → 0.2.10
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/README.md +29 -1
- package/dist/cli.cjs +105 -105
- package/dist/index.cjs +7484 -7270
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +7439 -7229
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/chart.ts +9 -0
- package/src/cli.ts +14 -34
- package/src/d3.ts +42 -6
- package/src/echarts.ts +54 -2
- package/src/index.ts +7 -0
- package/src/render.ts +68 -0
- package/src/sequence/renderer.ts +305 -126
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { EChartsOption } from 'echarts';
|
|
2
2
|
import * as d3Scale from 'd3-scale';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Render DGMO source to an SVG string.
|
|
6
|
+
*
|
|
7
|
+
* Automatically detects the chart type, selects the appropriate renderer,
|
|
8
|
+
* and returns a complete SVG document string.
|
|
9
|
+
*
|
|
10
|
+
* @param content - DGMO source text
|
|
11
|
+
* @param options - Optional theme and palette settings
|
|
12
|
+
* @returns SVG string, or empty string on error
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { render } from '@diagrammo/dgmo';
|
|
17
|
+
*
|
|
18
|
+
* const svg = await render(`chart: pie
|
|
19
|
+
* title: Languages
|
|
20
|
+
* TypeScript: 45
|
|
21
|
+
* Python: 30
|
|
22
|
+
* Rust: 25`);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function render(content: string, options?: {
|
|
26
|
+
theme?: 'light' | 'dark' | 'transparent';
|
|
27
|
+
palette?: string;
|
|
28
|
+
}): Promise<string>;
|
|
29
|
+
|
|
4
30
|
/**
|
|
5
31
|
* Framework identifiers used by the .dgmo router.
|
|
6
32
|
* Maps to the existing preview components and export paths.
|
|
@@ -180,6 +206,7 @@ interface ParsedChart {
|
|
|
180
206
|
orientation?: 'horizontal' | 'vertical';
|
|
181
207
|
color?: string;
|
|
182
208
|
label?: string;
|
|
209
|
+
labels?: 'name' | 'value' | 'percent' | 'full';
|
|
183
210
|
data: ChartDataPoint[];
|
|
184
211
|
error?: string;
|
|
185
212
|
}
|
|
@@ -734,6 +761,7 @@ interface SectionMessageGroup {
|
|
|
734
761
|
}
|
|
735
762
|
interface SequenceRenderOptions {
|
|
736
763
|
collapsedSections?: Set<number>;
|
|
764
|
+
expandedNoteLines?: Set<number>;
|
|
737
765
|
exportWidth?: number;
|
|
738
766
|
}
|
|
739
767
|
/**
|
|
@@ -782,6 +810,12 @@ declare function applyGroupOrdering(participants: SequenceParticipant[], groups:
|
|
|
782
810
|
* Render a sequence diagram into the given container element.
|
|
783
811
|
*/
|
|
784
812
|
declare function renderSequenceDiagram(container: HTMLDivElement, parsed: ParsedSequenceDgmo, palette: PaletteColors, isDark: boolean, _onNavigateToLine?: (line: number) => void, options?: SequenceRenderOptions): void;
|
|
813
|
+
/**
|
|
814
|
+
* Build a mapping from each note's lineNumber to the lineNumber of its
|
|
815
|
+
* associated message (the last message before the note in document order).
|
|
816
|
+
* Used by the app to expand notes when cursor is on the associated message.
|
|
817
|
+
*/
|
|
818
|
+
declare function buildNoteMessageMap(elements: SequenceElement[]): Map<number, number>;
|
|
785
819
|
|
|
786
820
|
/** Complete 16-entry Nord palette. */
|
|
787
821
|
declare const nord: {
|
|
@@ -816,4 +850,4 @@ declare function resolveColor(color: string, palette?: {
|
|
|
816
850
|
/** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
|
|
817
851
|
declare const seriesColors: string[];
|
|
818
852
|
|
|
819
|
-
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 };
|
|
853
|
+
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, buildNoteMessageMap, 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, render, renderArcDiagram, renderD3ForExport, renderEChartsForExport, renderFlowchart, renderFlowchartForExport, renderQuadrant, renderSequenceDiagram, renderSlopeChart, renderTimeline, renderVenn, renderWordCloud, resolveColor, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { EChartsOption } from 'echarts';
|
|
2
2
|
import * as d3Scale from 'd3-scale';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Render DGMO source to an SVG string.
|
|
6
|
+
*
|
|
7
|
+
* Automatically detects the chart type, selects the appropriate renderer,
|
|
8
|
+
* and returns a complete SVG document string.
|
|
9
|
+
*
|
|
10
|
+
* @param content - DGMO source text
|
|
11
|
+
* @param options - Optional theme and palette settings
|
|
12
|
+
* @returns SVG string, or empty string on error
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { render } from '@diagrammo/dgmo';
|
|
17
|
+
*
|
|
18
|
+
* const svg = await render(`chart: pie
|
|
19
|
+
* title: Languages
|
|
20
|
+
* TypeScript: 45
|
|
21
|
+
* Python: 30
|
|
22
|
+
* Rust: 25`);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function render(content: string, options?: {
|
|
26
|
+
theme?: 'light' | 'dark' | 'transparent';
|
|
27
|
+
palette?: string;
|
|
28
|
+
}): Promise<string>;
|
|
29
|
+
|
|
4
30
|
/**
|
|
5
31
|
* Framework identifiers used by the .dgmo router.
|
|
6
32
|
* Maps to the existing preview components and export paths.
|
|
@@ -180,6 +206,7 @@ interface ParsedChart {
|
|
|
180
206
|
orientation?: 'horizontal' | 'vertical';
|
|
181
207
|
color?: string;
|
|
182
208
|
label?: string;
|
|
209
|
+
labels?: 'name' | 'value' | 'percent' | 'full';
|
|
183
210
|
data: ChartDataPoint[];
|
|
184
211
|
error?: string;
|
|
185
212
|
}
|
|
@@ -734,6 +761,7 @@ interface SectionMessageGroup {
|
|
|
734
761
|
}
|
|
735
762
|
interface SequenceRenderOptions {
|
|
736
763
|
collapsedSections?: Set<number>;
|
|
764
|
+
expandedNoteLines?: Set<number>;
|
|
737
765
|
exportWidth?: number;
|
|
738
766
|
}
|
|
739
767
|
/**
|
|
@@ -782,6 +810,12 @@ declare function applyGroupOrdering(participants: SequenceParticipant[], groups:
|
|
|
782
810
|
* Render a sequence diagram into the given container element.
|
|
783
811
|
*/
|
|
784
812
|
declare function renderSequenceDiagram(container: HTMLDivElement, parsed: ParsedSequenceDgmo, palette: PaletteColors, isDark: boolean, _onNavigateToLine?: (line: number) => void, options?: SequenceRenderOptions): void;
|
|
813
|
+
/**
|
|
814
|
+
* Build a mapping from each note's lineNumber to the lineNumber of its
|
|
815
|
+
* associated message (the last message before the note in document order).
|
|
816
|
+
* Used by the app to expand notes when cursor is on the associated message.
|
|
817
|
+
*/
|
|
818
|
+
declare function buildNoteMessageMap(elements: SequenceElement[]): Map<number, number>;
|
|
785
819
|
|
|
786
820
|
/** Complete 16-entry Nord palette. */
|
|
787
821
|
declare const nord: {
|
|
@@ -816,4 +850,4 @@ declare function resolveColor(color: string, palette?: {
|
|
|
816
850
|
/** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
|
|
817
851
|
declare const seriesColors: string[];
|
|
818
852
|
|
|
819
|
-
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 };
|
|
853
|
+
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, buildNoteMessageMap, 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, render, renderArcDiagram, renderD3ForExport, renderEChartsForExport, renderFlowchart, renderFlowchartForExport, renderQuadrant, renderSequenceDiagram, renderSlopeChart, renderTimeline, renderVenn, renderWordCloud, resolveColor, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette };
|