@diagrammo/dgmo 0.5.4 → 0.6.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.cjs CHANGED
@@ -3662,9 +3662,11 @@ var init_parser3 = __esm({
3662
3662
  // src/chart.ts
3663
3663
  function parseChart(content, palette) {
3664
3664
  const lines = content.split("\n");
3665
+ const parsedEras = [];
3665
3666
  const result = {
3666
3667
  type: "bar",
3667
3668
  data: [],
3669
+ eras: parsedEras,
3668
3670
  diagnostics: [],
3669
3671
  error: null
3670
3672
  };
@@ -3683,6 +3685,16 @@ function parseChart(content, palette) {
3683
3685
  continue;
3684
3686
  }
3685
3687
  if (trimmed.startsWith("//")) continue;
3688
+ const eraMatch = trimmed.match(/^era\s+(.+?)\s*->\s*(.+?)\s*:\s*(.+?)(?:\s*\(([^)]+)\))?\s*$/);
3689
+ if (eraMatch) {
3690
+ parsedEras.push({
3691
+ start: eraMatch[1].trim(),
3692
+ end: eraMatch[2].trim(),
3693
+ label: eraMatch[3].trim(),
3694
+ color: eraMatch[4] ? resolveColor(eraMatch[4].trim(), palette) : null
3695
+ });
3696
+ continue;
3697
+ }
3686
3698
  const colonIndex = trimmed.indexOf(":");
3687
3699
  if (colonIndex === -1) continue;
3688
3700
  const key = trimmed.substring(0, colonIndex).trim().toLowerCase();
@@ -3761,6 +3773,9 @@ function parseChart(content, palette) {
3761
3773
  });
3762
3774
  }
3763
3775
  }
3776
+ if (result.type !== "line" && result.type !== "area") {
3777
+ result.eras = void 0;
3778
+ }
3764
3779
  const setChartError = (line10, message) => {
3765
3780
  const diag = makeDgmoError(line10, message);
3766
3781
  result.diagnostics.push(diag);
@@ -3814,7 +3829,7 @@ var init_chart = __esm({
3814
3829
  });
3815
3830
 
3816
3831
  // src/echarts.ts
3817
- function parseEChart(content, palette) {
3832
+ function parseExtendedChart(content, palette) {
3818
3833
  const lines = content.split("\n");
3819
3834
  const result = {
3820
3835
  type: "scatter",
@@ -4083,7 +4098,7 @@ function buildChartCommons(parsed, palette, isDark) {
4083
4098
  const tooltipTheme = { backgroundColor: palette.surface, borderColor: palette.border, textStyle: { color: palette.text } };
4084
4099
  return { textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, tooltipTheme };
4085
4100
  }
4086
- function buildEChartsOption(parsed, palette, isDark) {
4101
+ function buildExtendedChartOption(parsed, palette, isDark) {
4087
4102
  if (parsed.error) {
4088
4103
  return {};
4089
4104
  }
@@ -4755,7 +4770,7 @@ function resolveAxisLabels(parsed) {
4755
4770
  yLabel: parsed.ylabel ?? (isHorizontal ? void 0 : parsed.label)
4756
4771
  };
4757
4772
  }
4758
- function makeGridAxis(type, textColor, axisLineColor, splitLineColor, gridOpacity, label, data, nameGapOverride, chartWidthHint) {
4773
+ function makeGridAxis(type, textColor, axisLineColor, splitLineColor, gridOpacity, label, data, nameGapOverride, chartWidthHint, intervalOverride) {
4759
4774
  const defaultGap = type === "value" ? 75 : 40;
4760
4775
  let catFontSize = 16;
4761
4776
  let catLabelExtras = {};
@@ -4782,7 +4797,7 @@ function makeGridAxis(type, textColor, axisLineColor, splitLineColor, gridOpacit
4782
4797
  fontSize: type === "category" && data ? catFontSize : 16,
4783
4798
  fontFamily: FONT_FAMILY,
4784
4799
  ...type === "category" && {
4785
- interval: 0,
4800
+ interval: intervalOverride ?? 0,
4786
4801
  formatter: (value) => value.replace(/([a-z])([A-Z])/g, "$1\n$2"),
4787
4802
  ...catLabelExtras
4788
4803
  }
@@ -4796,7 +4811,7 @@ function makeGridAxis(type, textColor, axisLineColor, splitLineColor, gridOpacit
4796
4811
  }
4797
4812
  };
4798
4813
  }
4799
- function buildEChartsOptionFromChart(parsed, palette, isDark, chartWidth) {
4814
+ function buildSimpleChartOption(parsed, palette, isDark, chartWidth) {
4800
4815
  if (parsed.error) return {};
4801
4816
  const { textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, tooltipTheme } = buildChartCommons(parsed, palette, isDark);
4802
4817
  switch (parsed.type) {
@@ -4805,7 +4820,7 @@ function buildEChartsOptionFromChart(parsed, palette, isDark, chartWidth) {
4805
4820
  case "bar-stacked":
4806
4821
  return buildBarStackedOption(parsed, textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, tooltipTheme, chartWidth);
4807
4822
  case "line":
4808
- return parsed.seriesNames ? buildMultiLineOption(parsed, textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, tooltipTheme, chartWidth) : buildLineOption(parsed, palette, textColor, axisLineColor, splitLineColor, gridOpacity, titleConfig, tooltipTheme, chartWidth);
4823
+ return parsed.seriesNames ? buildMultiLineOption(parsed, palette, textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, tooltipTheme, chartWidth) : buildLineOption(parsed, palette, textColor, axisLineColor, splitLineColor, gridOpacity, titleConfig, tooltipTheme, chartWidth);
4809
4824
  case "area":
4810
4825
  return buildAreaOption(parsed, palette, textColor, axisLineColor, splitLineColor, gridOpacity, titleConfig, tooltipTheme, chartWidth);
4811
4826
  case "pie":
@@ -4858,11 +4873,57 @@ function buildBarOption(parsed, textColor, axisLineColor, splitLineColor, gridOp
4858
4873
  ]
4859
4874
  };
4860
4875
  }
4876
+ function buildIntervalCallback(labels, eras) {
4877
+ const count = labels.length;
4878
+ if (count <= 8) return () => true;
4879
+ const snapSteps = [1, 2, 4, 5, 10, 20, 25, 50];
4880
+ const raw = Math.ceil(count / 8);
4881
+ const N = [...snapSteps].reverse().find((s) => s <= raw) ?? 1;
4882
+ const pinned = /* @__PURE__ */ new Set();
4883
+ for (let i = 0; i < count; i += N) pinned.add(i);
4884
+ for (const era of eras) {
4885
+ const si = labels.indexOf(era.start);
4886
+ const ei = labels.indexOf(era.end);
4887
+ if (si >= 0) pinned.add(si);
4888
+ if (ei >= 0) pinned.add(ei);
4889
+ }
4890
+ return (index) => pinned.has(index);
4891
+ }
4892
+ function buildMarkArea(eras, labels, textColor, defaultColor) {
4893
+ if (eras.length === 0) return void 0;
4894
+ return {
4895
+ silent: false,
4896
+ tooltip: { show: true },
4897
+ data: eras.map((era) => {
4898
+ const startIdx = labels.indexOf(era.start);
4899
+ const endIdx = labels.indexOf(era.end);
4900
+ const bandSlots = startIdx >= 0 && endIdx >= 0 ? endIdx - startIdx : Infinity;
4901
+ const color = era.color ?? defaultColor;
4902
+ return [
4903
+ {
4904
+ name: era.label,
4905
+ xAxis: era.start,
4906
+ itemStyle: { color, opacity: 0.15 },
4907
+ label: {
4908
+ show: bandSlots >= 3,
4909
+ position: "insideTop",
4910
+ fontSize: 11,
4911
+ color: textColor
4912
+ }
4913
+ },
4914
+ { xAxis: era.end }
4915
+ ];
4916
+ })
4917
+ };
4918
+ }
4861
4919
  function buildLineOption(parsed, palette, textColor, axisLineColor, splitLineColor, gridOpacity, titleConfig, tooltipTheme, chartWidth) {
4862
4920
  const { xLabel, yLabel } = resolveAxisLabels(parsed);
4863
4921
  const lineColor = parsed.color ?? parsed.seriesNameColors?.[0] ?? palette.primary;
4864
4922
  const labels = parsed.data.map((d) => d.label);
4865
4923
  const values = parsed.data.map((d) => d.value);
4924
+ const eras = parsed.eras ?? [];
4925
+ const interval = buildIntervalCallback(labels, eras);
4926
+ const markArea = buildMarkArea(eras, labels, textColor, palette.colors.blue);
4866
4927
  return {
4867
4928
  ...CHART_BASE,
4868
4929
  title: titleConfig,
@@ -4872,7 +4933,7 @@ function buildLineOption(parsed, palette, textColor, axisLineColor, splitLineCol
4872
4933
  axisPointer: { type: "line" }
4873
4934
  },
4874
4935
  grid: makeChartGrid({ xLabel, yLabel, hasTitle: !!parsed.title }),
4875
- xAxis: makeGridAxis("category", textColor, axisLineColor, splitLineColor, gridOpacity, xLabel, labels, void 0, chartWidth),
4936
+ xAxis: makeGridAxis("category", textColor, axisLineColor, splitLineColor, gridOpacity, xLabel, labels, void 0, chartWidth, interval),
4876
4937
  yAxis: makeGridAxis("value", textColor, axisLineColor, splitLineColor, gridOpacity, yLabel),
4877
4938
  series: [
4878
4939
  {
@@ -4882,15 +4943,19 @@ function buildLineOption(parsed, palette, textColor, axisLineColor, splitLineCol
4882
4943
  symbolSize: 8,
4883
4944
  lineStyle: { color: lineColor, width: 3 },
4884
4945
  itemStyle: { color: lineColor },
4885
- emphasis: EMPHASIS_SELF
4946
+ emphasis: EMPHASIS_SELF,
4947
+ ...markArea && { markArea }
4886
4948
  }
4887
4949
  ]
4888
4950
  };
4889
4951
  }
4890
- function buildMultiLineOption(parsed, textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, tooltipTheme, chartWidth) {
4952
+ function buildMultiLineOption(parsed, palette, textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, tooltipTheme, chartWidth) {
4891
4953
  const { xLabel, yLabel } = resolveAxisLabels(parsed);
4892
4954
  const seriesNames = parsed.seriesNames ?? [];
4893
4955
  const labels = parsed.data.map((d) => d.label);
4956
+ const eras = parsed.eras ?? [];
4957
+ const interval = buildIntervalCallback(labels, eras);
4958
+ const markArea = buildMarkArea(eras, labels, textColor, palette.colors.blue);
4894
4959
  const series = seriesNames.map((name, idx) => {
4895
4960
  const color = parsed.seriesNameColors?.[idx] ?? colors[idx % colors.length];
4896
4961
  const data = parsed.data.map(
@@ -4904,7 +4969,8 @@ function buildMultiLineOption(parsed, textColor, axisLineColor, splitLineColor,
4904
4969
  symbolSize: 8,
4905
4970
  lineStyle: { color, width: 3 },
4906
4971
  itemStyle: { color },
4907
- emphasis: EMPHASIS_SELF
4972
+ emphasis: EMPHASIS_SELF,
4973
+ ...idx === 0 && markArea && { markArea }
4908
4974
  };
4909
4975
  });
4910
4976
  return {
@@ -4921,7 +4987,7 @@ function buildMultiLineOption(parsed, textColor, axisLineColor, splitLineColor,
4921
4987
  textStyle: { color: textColor }
4922
4988
  },
4923
4989
  grid: makeChartGrid({ xLabel, yLabel, hasTitle: !!parsed.title, hasLegend: true }),
4924
- xAxis: makeGridAxis("category", textColor, axisLineColor, splitLineColor, gridOpacity, xLabel, labels, void 0, chartWidth),
4990
+ xAxis: makeGridAxis("category", textColor, axisLineColor, splitLineColor, gridOpacity, xLabel, labels, void 0, chartWidth, interval),
4925
4991
  yAxis: makeGridAxis("value", textColor, axisLineColor, splitLineColor, gridOpacity, yLabel),
4926
4992
  series
4927
4993
  };
@@ -4931,6 +4997,9 @@ function buildAreaOption(parsed, palette, textColor, axisLineColor, splitLineCol
4931
4997
  const lineColor = parsed.color ?? parsed.seriesNameColors?.[0] ?? palette.primary;
4932
4998
  const labels = parsed.data.map((d) => d.label);
4933
4999
  const values = parsed.data.map((d) => d.value);
5000
+ const eras = parsed.eras ?? [];
5001
+ const interval = buildIntervalCallback(labels, eras);
5002
+ const markArea = buildMarkArea(eras, labels, textColor, palette.colors.blue);
4934
5003
  return {
4935
5004
  ...CHART_BASE,
4936
5005
  title: titleConfig,
@@ -4940,7 +5009,7 @@ function buildAreaOption(parsed, palette, textColor, axisLineColor, splitLineCol
4940
5009
  axisPointer: { type: "line" }
4941
5010
  },
4942
5011
  grid: makeChartGrid({ xLabel, yLabel, hasTitle: !!parsed.title }),
4943
- xAxis: makeGridAxis("category", textColor, axisLineColor, splitLineColor, gridOpacity, xLabel, labels, void 0, chartWidth),
5012
+ xAxis: makeGridAxis("category", textColor, axisLineColor, splitLineColor, gridOpacity, xLabel, labels, void 0, chartWidth, interval),
4944
5013
  yAxis: makeGridAxis("value", textColor, axisLineColor, splitLineColor, gridOpacity, yLabel),
4945
5014
  series: [
4946
5015
  {
@@ -4951,7 +5020,8 @@ function buildAreaOption(parsed, palette, textColor, axisLineColor, splitLineCol
4951
5020
  lineStyle: { color: lineColor, width: 3 },
4952
5021
  itemStyle: { color: lineColor },
4953
5022
  areaStyle: { opacity: 0.25 },
4954
- emphasis: EMPHASIS_SELF
5023
+ emphasis: EMPHASIS_SELF,
5024
+ ...markArea && { markArea }
4955
5025
  }
4956
5026
  ]
4957
5027
  };
@@ -5136,7 +5206,7 @@ function buildBarStackedOption(parsed, textColor, axisLineColor, splitLineColor,
5136
5206
  series
5137
5207
  };
5138
5208
  }
5139
- async function renderEChartsForExport(content, theme, palette, options) {
5209
+ async function renderExtendedChartForExport(content, theme, palette, options) {
5140
5210
  const isDark = theme === "dark";
5141
5211
  const { getPalette: getPalette2 } = await Promise.resolve().then(() => (init_palettes(), palettes_exports));
5142
5212
  const effectivePalette = palette ?? (isDark ? getPalette2("nord").dark : getPalette2("nord").light);
@@ -5146,11 +5216,11 @@ async function renderEChartsForExport(content, theme, palette, options) {
5146
5216
  if (chartType && STANDARD_CHART_TYPES.has(chartType)) {
5147
5217
  const parsed = parseChart(content, effectivePalette);
5148
5218
  if (parsed.error) return "";
5149
- option = buildEChartsOptionFromChart(parsed, effectivePalette, isDark, ECHART_EXPORT_WIDTH);
5219
+ option = buildSimpleChartOption(parsed, effectivePalette, isDark, ECHART_EXPORT_WIDTH);
5150
5220
  } else {
5151
- const parsed = parseEChart(content, effectivePalette);
5221
+ const parsed = parseExtendedChart(content, effectivePalette);
5152
5222
  if (parsed.error) return "";
5153
- option = buildEChartsOption(parsed, effectivePalette, isDark);
5223
+ option = buildExtendedChartOption(parsed, effectivePalette, isDark);
5154
5224
  }
5155
5225
  if (!option || Object.keys(option).length === 0) return "";
5156
5226
  const chart = echarts.init(null, null, {
@@ -5177,7 +5247,7 @@ async function renderEChartsForExport(content, theme, palette, options) {
5177
5247
  chart.dispose();
5178
5248
  }
5179
5249
  }
5180
- var echarts, EMPHASIS_SELF, CHART_BASE, ECHART_EXPORT_WIDTH, ECHART_EXPORT_HEIGHT;
5250
+ var echarts, EMPHASIS_SELF, CHART_BASE, ECHART_EXPORT_WIDTH, ECHART_EXPORT_HEIGHT, STANDARD_CHART_TYPES;
5181
5251
  var init_echarts = __esm({
5182
5252
  "src/echarts.ts"() {
5183
5253
  "use strict";
@@ -5189,11 +5259,21 @@ var init_echarts = __esm({
5189
5259
  init_diagnostics();
5190
5260
  init_colors();
5191
5261
  init_parsing();
5192
- init_dgmo_router();
5193
5262
  EMPHASIS_SELF = { focus: "self", blurScope: "global" };
5194
5263
  CHART_BASE = { backgroundColor: "transparent", animation: false };
5195
5264
  ECHART_EXPORT_WIDTH = 1200;
5196
5265
  ECHART_EXPORT_HEIGHT = 800;
5266
+ STANDARD_CHART_TYPES = /* @__PURE__ */ new Set([
5267
+ "bar",
5268
+ "line",
5269
+ "multi-line",
5270
+ "area",
5271
+ "pie",
5272
+ "doughnut",
5273
+ "radar",
5274
+ "polar-area",
5275
+ "bar-stacked"
5276
+ ]);
5197
5277
  }
5198
5278
  });
5199
5279
 
@@ -7351,15 +7431,12 @@ var init_parser9 = __esm({
7351
7431
  // src/dgmo-router.ts
7352
7432
  var dgmo_router_exports = {};
7353
7433
  __export(dgmo_router_exports, {
7354
- DGMO_CHART_TYPE_MAP: () => DGMO_CHART_TYPE_MAP,
7355
- STANDARD_CHART_TYPES: () => STANDARD_CHART_TYPES,
7356
- getDgmoFramework: () => getDgmoFramework,
7434
+ getAllChartTypes: () => getAllChartTypes,
7435
+ getRenderCategory: () => getRenderCategory,
7436
+ isExtendedChartType: () => isExtendedChartType,
7357
7437
  parseDgmo: () => parseDgmo,
7358
7438
  parseDgmoChartType: () => parseDgmoChartType
7359
7439
  });
7360
- function getDgmoFramework(chartType) {
7361
- return DGMO_CHART_TYPE_MAP[chartType.toLowerCase()] ?? null;
7362
- }
7363
7440
  function parseDgmoChartType(content) {
7364
7441
  const lines = content.split("\n");
7365
7442
  for (const line10 of lines) {
@@ -7379,22 +7456,39 @@ function parseDgmoChartType(content) {
7379
7456
  if (looksLikeOrg(content)) return "org";
7380
7457
  return null;
7381
7458
  }
7459
+ function getRenderCategory(chartType) {
7460
+ const type = chartType.toLowerCase();
7461
+ if (DATA_CHART_TYPES.has(type)) return "data-chart";
7462
+ if (VISUALIZATION_TYPES.has(type)) return "visualization";
7463
+ if (DIAGRAM_TYPES.has(type)) return "diagram";
7464
+ return null;
7465
+ }
7466
+ function isExtendedChartType(chartType) {
7467
+ return EXTENDED_CHART_TYPES.has(chartType.toLowerCase());
7468
+ }
7469
+ function getAllChartTypes() {
7470
+ return [
7471
+ ...DATA_CHART_TYPES,
7472
+ ...VISUALIZATION_TYPES,
7473
+ ...DIAGRAM_TYPES
7474
+ ];
7475
+ }
7382
7476
  function parseDgmo(content) {
7383
7477
  const chartType = parseDgmoChartType(content);
7384
7478
  if (!chartType) {
7385
- return { diagnostics: parseD3(content).diagnostics };
7479
+ return { diagnostics: parseVisualization(content).diagnostics };
7386
7480
  }
7387
7481
  const directParser = PARSE_DISPATCH.get(chartType);
7388
7482
  if (directParser) return { diagnostics: directParser(content).diagnostics };
7389
- if (STANDARD_CHART_TYPES.has(chartType)) {
7483
+ if (STANDARD_CHART_TYPES2.has(chartType)) {
7390
7484
  return { diagnostics: parseChart(content).diagnostics };
7391
7485
  }
7392
7486
  if (ECHART_TYPES.has(chartType)) {
7393
- return { diagnostics: parseEChart(content).diagnostics };
7487
+ return { diagnostics: parseExtendedChart(content).diagnostics };
7394
7488
  }
7395
- return { diagnostics: parseD3(content).diagnostics };
7489
+ return { diagnostics: parseVisualization(content).diagnostics };
7396
7490
  }
7397
- var DGMO_CHART_TYPE_MAP, STANDARD_CHART_TYPES, ECHART_TYPES, PARSE_DISPATCH;
7491
+ var DATA_CHART_TYPES, VISUALIZATION_TYPES, DIAGRAM_TYPES, EXTENDED_CHART_TYPES, STANDARD_CHART_TYPES2, ECHART_TYPES, PARSE_DISPATCH;
7398
7492
  var init_dgmo_router = __esm({
7399
7493
  "src/dgmo-router.ts"() {
7400
7494
  "use strict";
@@ -7412,44 +7506,53 @@ var init_dgmo_router = __esm({
7412
7506
  init_parser7();
7413
7507
  init_parser8();
7414
7508
  init_parser9();
7415
- DGMO_CHART_TYPE_MAP = {
7416
- // Standard charts (via ECharts)
7417
- bar: "echart",
7418
- line: "echart",
7419
- "multi-line": "echart",
7420
- area: "echart",
7421
- pie: "echart",
7422
- doughnut: "echart",
7423
- radar: "echart",
7424
- "polar-area": "echart",
7425
- "bar-stacked": "echart",
7426
- // ECharts
7427
- scatter: "echart",
7428
- sankey: "echart",
7429
- chord: "echart",
7430
- function: "echart",
7431
- heatmap: "echart",
7432
- funnel: "echart",
7433
- // D3
7434
- slope: "d3",
7435
- wordcloud: "d3",
7436
- arc: "d3",
7437
- timeline: "d3",
7438
- venn: "d3",
7439
- quadrant: "d3",
7440
- sequence: "d3",
7441
- flowchart: "d3",
7442
- class: "d3",
7443
- er: "d3",
7444
- org: "d3",
7445
- kanban: "d3",
7446
- c4: "d3",
7447
- "initiative-status": "d3",
7448
- state: "d3",
7449
- sitemap: "d3",
7450
- infra: "d3"
7451
- };
7452
- STANDARD_CHART_TYPES = /* @__PURE__ */ new Set([
7509
+ DATA_CHART_TYPES = /* @__PURE__ */ new Set([
7510
+ "bar",
7511
+ "line",
7512
+ "pie",
7513
+ "doughnut",
7514
+ "area",
7515
+ "polar-area",
7516
+ "radar",
7517
+ "bar-stacked",
7518
+ "multi-line",
7519
+ "scatter",
7520
+ "sankey",
7521
+ "chord",
7522
+ "function",
7523
+ "heatmap",
7524
+ "funnel"
7525
+ ]);
7526
+ VISUALIZATION_TYPES = /* @__PURE__ */ new Set([
7527
+ "slope",
7528
+ "wordcloud",
7529
+ "arc",
7530
+ "timeline",
7531
+ "venn",
7532
+ "quadrant"
7533
+ ]);
7534
+ DIAGRAM_TYPES = /* @__PURE__ */ new Set([
7535
+ "sequence",
7536
+ "flowchart",
7537
+ "class",
7538
+ "er",
7539
+ "org",
7540
+ "kanban",
7541
+ "c4",
7542
+ "initiative-status",
7543
+ "state",
7544
+ "sitemap",
7545
+ "infra"
7546
+ ]);
7547
+ EXTENDED_CHART_TYPES = /* @__PURE__ */ new Set([
7548
+ "scatter",
7549
+ "sankey",
7550
+ "chord",
7551
+ "function",
7552
+ "heatmap",
7553
+ "funnel"
7554
+ ]);
7555
+ STANDARD_CHART_TYPES2 = /* @__PURE__ */ new Set([
7453
7556
  "bar",
7454
7557
  "line",
7455
7558
  "multi-line",
@@ -18522,7 +18625,7 @@ function addDurationToDate(startDate, amount, unit) {
18522
18625
  return `${endYear}-${endMonth}-${endDay}`;
18523
18626
  }
18524
18627
  }
18525
- function parseD3(content, palette) {
18628
+ function parseVisualization(content, palette) {
18526
18629
  const result = {
18527
18630
  type: null,
18528
18631
  title: null,
@@ -20968,7 +21071,7 @@ function renderVenn(container, parsed, palette, isDark, onClickItem, exportDims)
20968
21071
  const circleEls = [];
20969
21072
  const circleGroup = svg.append("g");
20970
21073
  circles.forEach((c, i) => {
20971
- const el = circleGroup.append("circle").attr("cx", c.x).attr("cy", c.y).attr("r", c.r).attr("fill", setColors[i]).attr("fill-opacity", 0.35).attr("stroke", setColors[i]).attr("stroke-width", 2).attr("class", "venn-fill-circle").attr("data-line-number", String(vennSets[i].lineNumber)).style("pointer-events", "none");
21074
+ const el = circleGroup.append("circle").attr("cx", c.x).attr("cy", c.y).attr("r", c.r).attr("fill", setColors[i]).attr("fill-opacity", 0.35).attr("stroke", setColors[i]).attr("stroke-width", 2).style("pointer-events", "none");
20972
21075
  circleEls.push(el);
20973
21076
  });
20974
21077
  const defs = svg.append("defs");
@@ -21003,10 +21106,7 @@ function renderVenn(container, parsed, palette, isDark, onClickItem, exportDims)
21003
21106
  );
21004
21107
  regionLineNumber = ov?.lineNumber ?? null;
21005
21108
  }
21006
- const el = overlayGroup.append("rect").attr("x", 0).attr("y", 0).attr("width", width).attr("height", height).attr("fill", "white").attr("fill-opacity", 0).attr("class", "venn-region-overlay").attr("clip-path", `url(#${clipId})`);
21007
- if (regionLineNumber != null) {
21008
- el.attr("data-line-number", String(regionLineNumber));
21009
- }
21109
+ const el = overlayGroup.append("rect").attr("x", 0).attr("y", 0).attr("width", width).attr("height", height).attr("fill", "white").attr("fill-opacity", 0).attr("class", "venn-region-overlay").attr("data-line-number", regionLineNumber != null ? String(regionLineNumber) : "0").attr("clip-path", `url(#${clipId})`);
21010
21110
  if (excluded.length > 0) {
21011
21111
  const maskId = `vvm-${key}`;
21012
21112
  const mask = defs.append("mask").attr("id", maskId);
@@ -21020,7 +21120,7 @@ function renderVenn(container, parsed, palette, isDark, onClickItem, exportDims)
21020
21120
  }
21021
21121
  const showRegionOverlay = (idxs) => {
21022
21122
  const key = [...idxs].sort((a, b) => a - b).join("-");
21023
- overlayEls.forEach((el, k) => el.attr("fill-opacity", k === key ? 0.3 : 0));
21123
+ overlayEls.forEach((el, k) => el.attr("fill-opacity", k === key ? 0 : 0.55));
21024
21124
  };
21025
21125
  const hideAllOverlays = () => {
21026
21126
  overlayEls.forEach((el) => el.attr("fill-opacity", 0));
@@ -21479,7 +21579,7 @@ function finalizeSvgExport(container, theme, palette, options) {
21479
21579
  }
21480
21580
  return svgHtml;
21481
21581
  }
21482
- async function renderD3ForExport(content, theme, palette, orgExportState, options) {
21582
+ async function renderForExport(content, theme, palette, orgExportState, options) {
21483
21583
  const { parseDgmoChartType: parseDgmoChartType2 } = await Promise.resolve().then(() => (init_dgmo_router(), dgmo_router_exports));
21484
21584
  const detectedType = parseDgmoChartType2(content);
21485
21585
  if (detectedType === "org") {
@@ -21670,7 +21770,7 @@ async function renderD3ForExport(content, theme, palette, orgExportState, option
21670
21770
  renderState2(container2, stateParsed, layout, effectivePalette2, theme === "dark", void 0, { width: EXPORT_WIDTH, height: EXPORT_HEIGHT });
21671
21771
  return finalizeSvgExport(container2, theme, effectivePalette2, options);
21672
21772
  }
21673
- const parsed = parseD3(content, palette);
21773
+ const parsed = parseVisualization(content, palette);
21674
21774
  if (parsed.error && parsed.type !== "sequence") {
21675
21775
  const looksLikeSequence2 = /->|~>|<-/.test(content);
21676
21776
  if (!looksLikeSequence2) return "";
@@ -21880,20 +21980,18 @@ var init_d3 = __esm({
21880
21980
  // src/index.ts
21881
21981
  var index_exports = {};
21882
21982
  __export(index_exports, {
21883
- DGMO_CHART_TYPE_MAP: () => DGMO_CHART_TYPE_MAP,
21884
21983
  INFRA_BEHAVIOR_KEYS: () => INFRA_BEHAVIOR_KEYS,
21885
21984
  RULE_COUNT: () => RULE_COUNT,
21886
- STANDARD_CHART_TYPES: () => STANDARD_CHART_TYPES,
21887
21985
  addDurationToDate: () => addDurationToDate,
21888
21986
  applyGroupOrdering: () => applyGroupOrdering,
21889
21987
  applyPositionOverrides: () => applyPositionOverrides,
21890
21988
  boldPalette: () => boldPalette,
21891
- buildEChartsOption: () => buildEChartsOption,
21892
- buildEChartsOptionFromChart: () => buildEChartsOptionFromChart,
21989
+ buildExtendedChartOption: () => buildExtendedChartOption,
21893
21990
  buildMermaidQuadrant: () => buildMermaidQuadrant,
21894
21991
  buildMermaidThemeVars: () => buildMermaidThemeVars,
21895
21992
  buildNoteMessageMap: () => buildNoteMessageMap,
21896
21993
  buildRenderSequence: () => buildRenderSequence,
21994
+ buildSimpleChartOption: () => buildSimpleChartOption,
21897
21995
  buildThemeCSS: () => buildThemeCSS,
21898
21996
  catppuccinPalette: () => catppuccinPalette,
21899
21997
  collapseInitiativeStatus: () => collapseInitiativeStatus,
@@ -21913,8 +22011,8 @@ __export(index_exports, {
21913
22011
  formatDateLabel: () => formatDateLabel,
21914
22012
  formatDgmoError: () => formatDgmoError,
21915
22013
  getAvailablePalettes: () => getAvailablePalettes,
21916
- getDgmoFramework: () => getDgmoFramework,
21917
22014
  getPalette: () => getPalette,
22015
+ getRenderCategory: () => getRenderCategory,
21918
22016
  getSeriesColors: () => getSeriesColors,
21919
22017
  groupMessagesBySection: () => groupMessagesBySection,
21920
22018
  gruvboxPalette: () => gruvboxPalette,
@@ -21925,6 +22023,7 @@ __export(index_exports, {
21925
22023
  inferRoles: () => inferRoles,
21926
22024
  injectBranding: () => injectBranding,
21927
22025
  isArchiveColumn: () => isArchiveColumn,
22026
+ isExtendedChartType: () => isExtendedChartType,
21928
22027
  isSequenceBlock: () => isSequenceBlock,
21929
22028
  isSequenceNote: () => isSequenceNote,
21930
22029
  isValidHex: () => isValidHex,
@@ -21956,11 +22055,10 @@ __export(index_exports, {
21956
22055
  parseC4: () => parseC4,
21957
22056
  parseChart: () => parseChart,
21958
22057
  parseClassDiagram: () => parseClassDiagram,
21959
- parseD3: () => parseD3,
21960
22058
  parseDgmo: () => parseDgmo,
21961
22059
  parseDgmoChartType: () => parseDgmoChartType,
21962
- parseEChart: () => parseEChart,
21963
22060
  parseERDiagram: () => parseERDiagram,
22061
+ parseExtendedChart: () => parseExtendedChart,
21964
22062
  parseFlowchart: () => parseFlowchart,
21965
22063
  parseInfra: () => parseInfra,
21966
22064
  parseInitiativeStatus: () => parseInitiativeStatus,
@@ -21972,6 +22070,7 @@ __export(index_exports, {
21972
22070
  parseSitemap: () => parseSitemap,
21973
22071
  parseState: () => parseState,
21974
22072
  parseTimelineDate: () => parseTimelineDate,
22073
+ parseVisualization: () => parseVisualization,
21975
22074
  registerPalette: () => registerPalette,
21976
22075
  render: () => render,
21977
22076
  renderArcDiagram: () => renderArcDiagram,
@@ -21984,12 +22083,12 @@ __export(index_exports, {
21984
22083
  renderC4DeploymentForExport: () => renderC4DeploymentForExport,
21985
22084
  renderClassDiagram: () => renderClassDiagram,
21986
22085
  renderClassDiagramForExport: () => renderClassDiagramForExport,
21987
- renderD3ForExport: () => renderD3ForExport,
21988
- renderEChartsForExport: () => renderEChartsForExport,
21989
22086
  renderERDiagram: () => renderERDiagram,
21990
22087
  renderERDiagramForExport: () => renderERDiagramForExport,
22088
+ renderExtendedChartForExport: () => renderExtendedChartForExport,
21991
22089
  renderFlowchart: () => renderFlowchart,
21992
22090
  renderFlowchartForExport: () => renderFlowchartForExport,
22091
+ renderForExport: () => renderForExport,
21993
22092
  renderInfra: () => renderInfra,
21994
22093
  renderInitiativeStatus: () => renderInitiativeStatus,
21995
22094
  renderInitiativeStatusForExport: () => renderInitiativeStatusForExport,
@@ -22045,12 +22144,12 @@ async function render(content, options) {
22045
22144
  const branding = options?.branding ?? true;
22046
22145
  const paletteColors = getPalette(paletteName)[theme === "dark" ? "dark" : "light"];
22047
22146
  const chartType = parseDgmoChartType(content);
22048
- const framework = chartType ? getDgmoFramework(chartType) : null;
22049
- if (framework === "echart") {
22050
- return renderEChartsForExport(content, theme, paletteColors, { branding });
22147
+ const category = chartType ? getRenderCategory(chartType) : null;
22148
+ if (category === "data-chart") {
22149
+ return renderExtendedChartForExport(content, theme, paletteColors, { branding });
22051
22150
  }
22052
22151
  await ensureDom();
22053
- return renderD3ForExport(content, theme, paletteColors, void 0, {
22152
+ return renderForExport(content, theme, paletteColors, void 0, {
22054
22153
  branding,
22055
22154
  c4Level: options?.c4Level,
22056
22155
  c4System: options?.c4System,
@@ -22829,20 +22928,18 @@ function decodeDiagramUrl(hash) {
22829
22928
  init_branding();
22830
22929
  // Annotate the CommonJS export names for ESM import in node:
22831
22930
  0 && (module.exports = {
22832
- DGMO_CHART_TYPE_MAP,
22833
22931
  INFRA_BEHAVIOR_KEYS,
22834
22932
  RULE_COUNT,
22835
- STANDARD_CHART_TYPES,
22836
22933
  addDurationToDate,
22837
22934
  applyGroupOrdering,
22838
22935
  applyPositionOverrides,
22839
22936
  boldPalette,
22840
- buildEChartsOption,
22841
- buildEChartsOptionFromChart,
22937
+ buildExtendedChartOption,
22842
22938
  buildMermaidQuadrant,
22843
22939
  buildMermaidThemeVars,
22844
22940
  buildNoteMessageMap,
22845
22941
  buildRenderSequence,
22942
+ buildSimpleChartOption,
22846
22943
  buildThemeCSS,
22847
22944
  catppuccinPalette,
22848
22945
  collapseInitiativeStatus,
@@ -22862,8 +22959,8 @@ init_branding();
22862
22959
  formatDateLabel,
22863
22960
  formatDgmoError,
22864
22961
  getAvailablePalettes,
22865
- getDgmoFramework,
22866
22962
  getPalette,
22963
+ getRenderCategory,
22867
22964
  getSeriesColors,
22868
22965
  groupMessagesBySection,
22869
22966
  gruvboxPalette,
@@ -22874,6 +22971,7 @@ init_branding();
22874
22971
  inferRoles,
22875
22972
  injectBranding,
22876
22973
  isArchiveColumn,
22974
+ isExtendedChartType,
22877
22975
  isSequenceBlock,
22878
22976
  isSequenceNote,
22879
22977
  isValidHex,
@@ -22905,11 +23003,10 @@ init_branding();
22905
23003
  parseC4,
22906
23004
  parseChart,
22907
23005
  parseClassDiagram,
22908
- parseD3,
22909
23006
  parseDgmo,
22910
23007
  parseDgmoChartType,
22911
- parseEChart,
22912
23008
  parseERDiagram,
23009
+ parseExtendedChart,
22913
23010
  parseFlowchart,
22914
23011
  parseInfra,
22915
23012
  parseInitiativeStatus,
@@ -22921,6 +23018,7 @@ init_branding();
22921
23018
  parseSitemap,
22922
23019
  parseState,
22923
23020
  parseTimelineDate,
23021
+ parseVisualization,
22924
23022
  registerPalette,
22925
23023
  render,
22926
23024
  renderArcDiagram,
@@ -22933,12 +23031,12 @@ init_branding();
22933
23031
  renderC4DeploymentForExport,
22934
23032
  renderClassDiagram,
22935
23033
  renderClassDiagramForExport,
22936
- renderD3ForExport,
22937
- renderEChartsForExport,
22938
23034
  renderERDiagram,
22939
23035
  renderERDiagramForExport,
23036
+ renderExtendedChartForExport,
22940
23037
  renderFlowchart,
22941
23038
  renderFlowchartForExport,
23039
+ renderForExport,
22942
23040
  renderInfra,
22943
23041
  renderInitiativeStatus,
22944
23042
  renderInitiativeStatusForExport,