@diagrammo/dgmo 0.1.7 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- import { ChartConfiguration } from 'chart.js';
2
1
  import { EChartsOption } from 'echarts';
3
2
  import * as d3Scale from 'd3-scale';
4
3
 
@@ -6,12 +5,11 @@ import * as d3Scale from 'd3-scale';
6
5
  * Framework identifiers used by the .dgmo router.
7
6
  * Maps to the existing preview components and export paths.
8
7
  */
9
- type DgmoFramework = 'chartjs' | 'echart' | 'd3' | 'mermaid';
8
+ type DgmoFramework = 'echart' | 'd3' | 'mermaid';
10
9
  /**
11
10
  * Maps every supported chart type string to its backing framework.
12
11
  *
13
- * Chart.js: standard chart types (bar, line, pie, etc.)
14
- * ECharts: scatter, flow/relationship diagrams, math, heatmap
12
+ * ECharts: standard chart types (bar, line, pie, etc.), scatter, flow/relationship diagrams, math, heatmap
15
13
  * D3: slope, wordcloud, arc diagram, timeline
16
14
  */
17
15
  declare const DGMO_CHART_TYPE_MAP: Record<string, DgmoFramework>;
@@ -162,16 +160,16 @@ declare function buildMermaidThemeVars(colors: PaletteColors, isDark: boolean):
162
160
  */
163
161
  declare function buildThemeCSS(palette: PaletteColors, isDark: boolean): string;
164
162
 
165
- type ChartJsChartType = 'bar' | 'line' | 'pie' | 'doughnut' | 'area' | 'polar-area' | 'radar' | 'bar-stacked';
166
- interface ChartJsDataPoint {
163
+ type ChartType = 'bar' | 'line' | 'pie' | 'doughnut' | 'area' | 'polar-area' | 'radar' | 'bar-stacked';
164
+ interface ChartDataPoint {
167
165
  label: string;
168
166
  value: number;
169
167
  extraValues?: number[];
170
168
  color?: string;
171
169
  lineNumber: number;
172
170
  }
173
- interface ParsedChartJs {
174
- type: ChartJsChartType;
171
+ interface ParsedChart {
172
+ type: ChartType;
175
173
  title?: string;
176
174
  series?: string;
177
175
  xlabel?: string;
@@ -181,12 +179,12 @@ interface ParsedChartJs {
181
179
  orientation?: 'horizontal' | 'vertical';
182
180
  color?: string;
183
181
  label?: string;
184
- data: ChartJsDataPoint[];
182
+ data: ChartDataPoint[];
185
183
  error?: string;
186
184
  }
187
185
 
188
186
  /**
189
- * Parses the simple chartjs text format into a structured object.
187
+ * Parses the simple chart text format into a structured object.
190
188
  *
191
189
  * Format:
192
190
  * ```
@@ -199,11 +197,7 @@ interface ParsedChartJs {
199
197
  * Mar: 150
200
198
  * ```
201
199
  */
202
- declare function parseChartJs(content: string, palette?: PaletteColors): ParsedChartJs;
203
- /**
204
- * Converts parsed chartjs data to a Chart.js configuration object.
205
- */
206
- declare function buildChartJsConfig(parsed: ParsedChartJs, palette: PaletteColors, _isDark: boolean): ChartConfiguration;
200
+ declare function parseChart(content: string, palette?: PaletteColors): ParsedChart;
207
201
 
208
202
  type EChartsChartType = 'sankey' | 'chord' | 'function' | 'scatter' | 'heatmap' | 'funnel';
209
203
  interface EChartsDataPoint {
@@ -282,6 +276,16 @@ declare function parseEChart(content: string, palette?: PaletteColors): ParsedEC
282
276
  * Converts parsed echart data to ECharts option object.
283
277
  */
284
278
  declare function buildEChartsOption(parsed: ParsedEChart, palette: PaletteColors, _isDark: boolean): EChartsOption;
279
+ /**
280
+ * Converts a ParsedChart into an EChartsOption.
281
+ * Renders standard chart types (bar, line, pie, etc.) with ECharts.
282
+ */
283
+ declare function buildEChartsOptionFromChart(parsed: ParsedChart, palette: PaletteColors, _isDark: boolean): EChartsOption;
284
+ /**
285
+ * Renders an ECharts diagram to SVG using server-side rendering.
286
+ * Mirrors the `renderD3ForExport` API — returns an SVG string or empty string on failure.
287
+ */
288
+ declare function renderEChartsForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette?: PaletteColors): Promise<string>;
285
289
 
286
290
  type D3ChartType = 'slope' | 'wordcloud' | 'arc' | 'timeline' | 'venn' | 'quadrant' | 'sequence';
287
291
  interface D3DataItem {
@@ -695,4 +699,4 @@ declare function resolveColor(color: string, palette?: {
695
699
  /** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
696
700
  declare const seriesColors: string[];
697
701
 
698
- export { type Activation, type ArcLink, type ArcNodeGroup, type ChartJsChartType, type ChartJsDataPoint, type D3ChartType, DGMO_CHART_TYPE_MAP, type DgmoFramework, type EChartsChartType, type PaletteColors, type PaletteConfig, type ParsedChartJs, 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, buildChartJsConfig, buildEChartsOption, 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, parseChartJs, parseD3, parseDgmoChartType, parseEChart, parseQuadrant, parseSequenceDgmo, parseTimelineDate, registerPalette, renderArcDiagram, renderD3ForExport, renderQuadrant, renderSequenceDiagram, renderSlopeChart, renderTimeline, renderVenn, renderWordCloud, resolveColor, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette };
702
+ export { type Activation, type ArcLink, type ArcNodeGroup, type ChartDataPoint, type ChartType, type D3ChartType, 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 };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { ChartConfiguration } from 'chart.js';
2
1
  import { EChartsOption } from 'echarts';
3
2
  import * as d3Scale from 'd3-scale';
4
3
 
@@ -6,12 +5,11 @@ import * as d3Scale from 'd3-scale';
6
5
  * Framework identifiers used by the .dgmo router.
7
6
  * Maps to the existing preview components and export paths.
8
7
  */
9
- type DgmoFramework = 'chartjs' | 'echart' | 'd3' | 'mermaid';
8
+ type DgmoFramework = 'echart' | 'd3' | 'mermaid';
10
9
  /**
11
10
  * Maps every supported chart type string to its backing framework.
12
11
  *
13
- * Chart.js: standard chart types (bar, line, pie, etc.)
14
- * ECharts: scatter, flow/relationship diagrams, math, heatmap
12
+ * ECharts: standard chart types (bar, line, pie, etc.), scatter, flow/relationship diagrams, math, heatmap
15
13
  * D3: slope, wordcloud, arc diagram, timeline
16
14
  */
17
15
  declare const DGMO_CHART_TYPE_MAP: Record<string, DgmoFramework>;
@@ -162,16 +160,16 @@ declare function buildMermaidThemeVars(colors: PaletteColors, isDark: boolean):
162
160
  */
163
161
  declare function buildThemeCSS(palette: PaletteColors, isDark: boolean): string;
164
162
 
165
- type ChartJsChartType = 'bar' | 'line' | 'pie' | 'doughnut' | 'area' | 'polar-area' | 'radar' | 'bar-stacked';
166
- interface ChartJsDataPoint {
163
+ type ChartType = 'bar' | 'line' | 'pie' | 'doughnut' | 'area' | 'polar-area' | 'radar' | 'bar-stacked';
164
+ interface ChartDataPoint {
167
165
  label: string;
168
166
  value: number;
169
167
  extraValues?: number[];
170
168
  color?: string;
171
169
  lineNumber: number;
172
170
  }
173
- interface ParsedChartJs {
174
- type: ChartJsChartType;
171
+ interface ParsedChart {
172
+ type: ChartType;
175
173
  title?: string;
176
174
  series?: string;
177
175
  xlabel?: string;
@@ -181,12 +179,12 @@ interface ParsedChartJs {
181
179
  orientation?: 'horizontal' | 'vertical';
182
180
  color?: string;
183
181
  label?: string;
184
- data: ChartJsDataPoint[];
182
+ data: ChartDataPoint[];
185
183
  error?: string;
186
184
  }
187
185
 
188
186
  /**
189
- * Parses the simple chartjs text format into a structured object.
187
+ * Parses the simple chart text format into a structured object.
190
188
  *
191
189
  * Format:
192
190
  * ```
@@ -199,11 +197,7 @@ interface ParsedChartJs {
199
197
  * Mar: 150
200
198
  * ```
201
199
  */
202
- declare function parseChartJs(content: string, palette?: PaletteColors): ParsedChartJs;
203
- /**
204
- * Converts parsed chartjs data to a Chart.js configuration object.
205
- */
206
- declare function buildChartJsConfig(parsed: ParsedChartJs, palette: PaletteColors, _isDark: boolean): ChartConfiguration;
200
+ declare function parseChart(content: string, palette?: PaletteColors): ParsedChart;
207
201
 
208
202
  type EChartsChartType = 'sankey' | 'chord' | 'function' | 'scatter' | 'heatmap' | 'funnel';
209
203
  interface EChartsDataPoint {
@@ -282,6 +276,16 @@ declare function parseEChart(content: string, palette?: PaletteColors): ParsedEC
282
276
  * Converts parsed echart data to ECharts option object.
283
277
  */
284
278
  declare function buildEChartsOption(parsed: ParsedEChart, palette: PaletteColors, _isDark: boolean): EChartsOption;
279
+ /**
280
+ * Converts a ParsedChart into an EChartsOption.
281
+ * Renders standard chart types (bar, line, pie, etc.) with ECharts.
282
+ */
283
+ declare function buildEChartsOptionFromChart(parsed: ParsedChart, palette: PaletteColors, _isDark: boolean): EChartsOption;
284
+ /**
285
+ * Renders an ECharts diagram to SVG using server-side rendering.
286
+ * Mirrors the `renderD3ForExport` API — returns an SVG string or empty string on failure.
287
+ */
288
+ declare function renderEChartsForExport(content: string, theme: 'light' | 'dark' | 'transparent', palette?: PaletteColors): Promise<string>;
285
289
 
286
290
  type D3ChartType = 'slope' | 'wordcloud' | 'arc' | 'timeline' | 'venn' | 'quadrant' | 'sequence';
287
291
  interface D3DataItem {
@@ -695,4 +699,4 @@ declare function resolveColor(color: string, palette?: {
695
699
  /** @deprecated Use getSeriesColors(palette) from '@/lib/palettes' instead. */
696
700
  declare const seriesColors: string[];
697
701
 
698
- export { type Activation, type ArcLink, type ArcNodeGroup, type ChartJsChartType, type ChartJsDataPoint, type D3ChartType, DGMO_CHART_TYPE_MAP, type DgmoFramework, type EChartsChartType, type PaletteColors, type PaletteConfig, type ParsedChartJs, 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, buildChartJsConfig, buildEChartsOption, 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, parseChartJs, parseD3, parseDgmoChartType, parseEChart, parseQuadrant, parseSequenceDgmo, parseTimelineDate, registerPalette, renderArcDiagram, renderD3ForExport, renderQuadrant, renderSequenceDiagram, renderSlopeChart, renderTimeline, renderVenn, renderWordCloud, resolveColor, rosePinePalette, seriesColors, shade, solarizedPalette, tint, tokyoNightPalette };
702
+ export { type Activation, type ArcLink, type ArcNodeGroup, type ChartDataPoint, type ChartType, type D3ChartType, 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 };