@diagrammo/dgmo 0.94.0 → 0.95.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.
Files changed (67) hide show
  1. package/dist/advanced.d.ts +72 -3
  2. package/dist/advanced.js +49 -32
  3. package/dist/block.d.ts +6 -0
  4. package/dist/block.js +17 -14
  5. package/dist/chart-meta.js +7 -7
  6. package/dist/{chunk-TDAGJJPZ.js → chunk-2J2CWWWK.js} +1 -1
  7. package/dist/{chunk-2XMTZ5JR.js → chunk-4UVCTLRH.js} +1 -1
  8. package/dist/{chunk-DLJJOCIT.js → chunk-5XBYLYYI.js} +1 -1
  9. package/dist/{chunk-XKCRKD2B.js → chunk-62GLKE6Q.js} +3 -3
  10. package/dist/{chunk-VDY2GR6U.js → chunk-67N26CER.js} +2 -2
  11. package/dist/{chunk-I37S3EZE.js → chunk-6EFCOES2.js} +366 -281
  12. package/dist/{chunk-HI6R27YA.js → chunk-7IALGIOI.js} +2 -2
  13. package/dist/{chunk-RESEJSCV.js → chunk-BCV2VJTM.js} +2 -2
  14. package/dist/{chunk-2HSHWPTO.js → chunk-BTP2BMWN.js} +4 -4
  15. package/dist/{chunk-KBHT5XEY.js → chunk-E7F76M3U.js} +138 -31
  16. package/dist/{chunk-JT2BG7LM.js → chunk-EXHXTMVR.js} +3 -3
  17. package/dist/{chunk-7IOZ6JE4.js → chunk-IQN2NGEU.js} +3 -3
  18. package/dist/{chunk-DNM3XZCK.js → chunk-IY62DXT2.js} +1 -1
  19. package/dist/{chunk-B25IWGDH.js → chunk-JJ7RGTAU.js} +2 -2
  20. package/dist/{chunk-7SXV7NUS.js → chunk-KLBTJEIK.js} +1 -1
  21. package/dist/{chunk-DDIOWNHS.js → chunk-L5S32VZJ.js} +3 -3
  22. package/dist/{chunk-AYUSD4Z6.js → chunk-LAXMUSGW.js} +3 -3
  23. package/dist/{chunk-2MS623GW.js → chunk-LJGE43SG.js} +1 -1
  24. package/dist/{chunk-5ZUZZDW5.js → chunk-P5XA627W.js} +7 -7
  25. package/dist/{chunk-DRQSB72S.js → chunk-PGBTUGDB.js} +2 -2
  26. package/dist/{chunk-P7TRFL4P.js → chunk-R46N5KR4.js} +2 -0
  27. package/dist/{chunk-4TEPDQHJ.js → chunk-RQTDUZUH.js} +1 -1
  28. package/dist/{chunk-CIHHTS5B.js → chunk-S4SJ4LLY.js} +1 -1
  29. package/dist/{chunk-5HAYT43L.js → chunk-U6VS3T2M.js} +19 -3
  30. package/dist/{chunk-4SP6OUO7.js → chunk-USE6HIOZ.js} +32 -32
  31. package/dist/{chunk-2FDQEQID.js → chunk-USZLHYEQ.js} +1 -1
  32. package/dist/{chunk-NOQB4KMV.js → chunk-V5D6GDNK.js} +1 -1
  33. package/dist/{chunk-6JCTW74W.js → chunk-VB4VMB2I.js} +1 -1
  34. package/dist/{chunk-G3HZ4PGE.js → chunk-VF7IKIRS.js} +1 -1
  35. package/dist/{chunk-3ZP3QC47.js → chunk-VTESGA5F.js} +2 -2
  36. package/dist/{chunk-3TWBMU7K.js → chunk-XOMIYMQ3.js} +5 -5
  37. package/dist/completion-registry.js +3 -0
  38. package/dist/copy-image.d.ts +34 -0
  39. package/dist/copy-image.js +96 -0
  40. package/dist/{dgmo-router-E5O7RJSW.js → dgmo-router-6YLKM6WU.js} +11 -11
  41. package/dist/{flowchart-parser-NZXASOZG.js → flowchart-parser-J3VWIFWB.js} +3 -3
  42. package/dist/{flowchart-renderer-PTCRIANF.js → flowchart-renderer-FECH5KK5.js} +8 -8
  43. package/dist/index.js +13 -13
  44. package/dist/{layout-IT4ZTV6C.js → layout-5SZ5A64I.js} +6 -6
  45. package/dist/{layout-VC3MXRB4.js → layout-EWXHEXNS.js} +6 -6
  46. package/dist/{layout-U3AH6M7J.js → layout-TIBRMWHL.js} +3 -3
  47. package/dist/{layout-ISSBWBH7.js → layout-YBMT74MG.js} +6 -6
  48. package/dist/{layout-search-BBX2BMEF.js → layout-search-AWPJWBKT.js} +4 -4
  49. package/dist/{parser-R3LPEQIT.js → parser-AR2GON37.js} +2 -2
  50. package/dist/{parser-4RFY7D52.js → parser-BTSTKY5G.js} +3 -3
  51. package/dist/{parser-TAYRTCPR.js → parser-MA7L3XND.js} +3 -3
  52. package/dist/{parser-7QKQ4P4P.js → parser-ZRIZFDZY.js} +3 -3
  53. package/dist/{renderer-LNP23NSM.js → renderer-2QPHDBZY.js} +2 -2
  54. package/dist/{renderer-J3GPDK73.js → renderer-4VGO27EE.js} +8 -8
  55. package/dist/{renderer-JJ4QW3SK.js → renderer-6BDK47V6.js} +1 -1
  56. package/dist/{renderer-FMTLSOCX.js → renderer-ACQQ2JXA.js} +1 -1
  57. package/dist/{renderer-M5DUMITP.js → renderer-IGSHD3OT.js} +2 -2
  58. package/dist/{renderer-53B523PM.js → renderer-IVHD7ENY.js} +2 -2
  59. package/dist/{renderer-OUDHH5MV.js → renderer-P3WR7TKD.js} +8 -8
  60. package/dist/{renderer-XOWDERU2.js → renderer-UGW4N2W5.js} +1 -1
  61. package/dist/{renderer-PHLCYVSN.js → renderer-XDX6S7OV.js} +1 -1
  62. package/dist/{renderer-J7ZSTJUE.js → renderer-Y47EM337.js} +1 -1
  63. package/dist/{renderer-4SE7R22T.js → renderer-ZV6KCLCL.js} +12 -12
  64. package/dist/{state-parser-KPVW5CRI.js → state-parser-PMNHLHLE.js} +3 -3
  65. package/dist/{state-renderer-ZVEI265C.js → state-renderer-JQ5DS66J.js} +8 -8
  66. package/docs/language-reference.md +2 -2
  67. package/package.json +5 -1
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  WHITEBOARD_COLORS,
3
3
  WHITEBOARD_ELEMENT_KEYWORDS,
4
+ WHITEBOARD_LABEL_POSITIONS,
4
5
  WHITEBOARD_NOTE_COLOR,
5
6
  WHITEBOARD_NOTE_HEIGHT,
6
7
  WHITEBOARD_NOTE_WIDTH,
7
8
  isWhiteboardColor,
8
9
  isWhiteboardShapeKind
9
- } from "./chunk-P7TRFL4P.js";
10
+ } from "./chunk-R46N5KR4.js";
10
11
  import {
11
12
  extractPaletteDirective
12
13
  } from "./chunk-CYTFO2LF.js";
@@ -100,7 +101,7 @@ var WHITEBOARD_DIAGNOSTICS = [
100
101
  chartType: "whiteboard",
101
102
  title: "Unknown whiteboard value",
102
103
  message: (p) => `Unknown ${s(p.key)}: "${s(p.value)}" \u2014 ${s(p.fallback)} used instead (valid: ${s(p.valid)})${p.hint ? `. ${s(p.hint)}` : ""}`,
103
- hint: "Shapes take `fill: solid` or `fill: outline`; arrows take `heads: both`; arrows and lines take `bend:` as a whole number.",
104
+ hint: "Shapes take `fill: solid` or `fill: outline`, and `label: top` or `label: middle`; arrows take `heads: both`; arrows and lines take `bend:` as a whole number.",
104
105
  example: "whiteboard\nrectangle at: 0 0, size: 100 60, fill: hatched"
105
106
  },
106
107
  {
@@ -353,8 +354,9 @@ var INK_WIDTH_RE = /^\d+(\.\d+)?$/;
353
354
  var INK_WIDTH_MAX = 200;
354
355
  var WRITTEN_STYLES = ["dashed"];
355
356
  var WRITTEN_FILLS = ["solid", "outline"];
357
+ var labelPart = (p) => p ? { labelPosition: p } : {};
356
358
  var KEYS_BY_KIND = {
357
- shape: ["at", "size", "color", "fill"],
359
+ shape: ["at", "size", "color", "fill", "label"],
358
360
  note: ["at", "size", "color"],
359
361
  arrow: ["from", "to", "color", "style", "heads", "bend"],
360
362
  line: ["from", "to", "color", "style", "bend"],
@@ -480,6 +482,19 @@ function parseWhiteboard(content, _palette) {
480
482
  });
481
483
  return "tint";
482
484
  };
485
+ const readLabelPosition = (raw, line) => {
486
+ if (raw === void 0) return void 0;
487
+ const v = raw.trim().toLowerCase();
488
+ if (v === "top" || v === "middle") return v;
489
+ warn(line, WHITEBOARD_DIAGNOSTIC_CODES.BAD_VALUE, {
490
+ key: "label",
491
+ value: raw,
492
+ fallback: "automatic",
493
+ valid: WHITEBOARD_LABEL_POSITIONS.join(", "),
494
+ hint: suggest(v, WHITEBOARD_LABEL_POSITIONS) ?? ""
495
+ });
496
+ return void 0;
497
+ };
483
498
  const readHeads = (raw, line) => {
484
499
  if (raw === void 0) return "end";
485
500
  const v = raw.trim().toLowerCase();
@@ -684,6 +699,7 @@ function parseWhiteboard(content, _palette) {
684
699
  label: joinLabel(name, body),
685
700
  color: readColor(meta.get("color"), lineNumber),
686
701
  fill: readFill(meta.get("fill"), lineNumber),
702
+ ...labelPart(readLabelPosition(meta.get("label"), lineNumber)),
687
703
  lineNumber
688
704
  });
689
705
  continue;
@@ -12,7 +12,7 @@ import {
12
12
  parseVenn,
13
13
  parseVisualization,
14
14
  parseWordcloud
15
- } from "./chunk-5ZUZZDW5.js";
15
+ } from "./chunk-P5XA627W.js";
16
16
  import {
17
17
  parseChart,
18
18
  parseFunctionChart,
@@ -47,7 +47,7 @@ import {
47
47
  } from "./chunk-WZBZXZ6T.js";
48
48
  import {
49
49
  parseWhiteboard
50
- } from "./chunk-5HAYT43L.js";
50
+ } from "./chunk-U6VS3T2M.js";
51
51
  import {
52
52
  parseSwimlane
53
53
  } from "./chunk-J7Q4AB23.js";
@@ -125,7 +125,7 @@ import {
125
125
  } from "./chunk-JXGSTBW6.js";
126
126
  import {
127
127
  parseBoxesAndLines
128
- } from "./chunk-2XMTZ5JR.js";
128
+ } from "./chunk-4UVCTLRH.js";
129
129
  import {
130
130
  ScaleContext
131
131
  } from "./chunk-24YPR5EH.js";
@@ -159,20 +159,20 @@ import {
159
159
  } from "./chunk-CDM6XMOT.js";
160
160
  import {
161
161
  parseFlowchart
162
- } from "./chunk-DNM3XZCK.js";
162
+ } from "./chunk-IY62DXT2.js";
163
163
  import {
164
164
  parseState
165
- } from "./chunk-2MS623GW.js";
165
+ } from "./chunk-LJGE43SG.js";
166
166
  import {
167
167
  choosePalette,
168
168
  extractPaletteDirective
169
169
  } from "./chunk-CYTFO2LF.js";
170
170
  import {
171
171
  parseERDiagram
172
- } from "./chunk-CIHHTS5B.js";
172
+ } from "./chunk-S4SJ4LLY.js";
173
173
  import {
174
174
  parseClassDiagram
175
- } from "./chunk-DLJJOCIT.js";
175
+ } from "./chunk-5XBYLYYI.js";
176
176
  import {
177
177
  getPalette
178
178
  } from "./chunk-FMAVHTYB.js";
@@ -2120,7 +2120,7 @@ async function exportBody(ctx) {
2120
2120
  // src/boxes-and-lines/export.ts
2121
2121
  async function exportBoxesAndLines(ctx) {
2122
2122
  const { content, theme, palette, viewState, exportMode } = ctx;
2123
- const { parseBoxesAndLines: parseBoxesAndLines2 } = await import("./parser-7QKQ4P4P.js");
2123
+ const { parseBoxesAndLines: parseBoxesAndLines2 } = await import("./parser-ZRIZFDZY.js");
2124
2124
  const effectivePalette = await resolveExportPalette(theme, palette);
2125
2125
  const blParsed = parseBoxesAndLines2(content, effectivePalette);
2126
2126
  if (blParsed.error || blParsed.nodes.length === 0) return "";
@@ -2131,8 +2131,8 @@ async function exportBoxesAndLines(ctx) {
2131
2131
  blHiddenTagValues.set(k, new Set(v));
2132
2132
  }
2133
2133
  }
2134
- const { renderBoxesAndLinesForExport } = await import("./renderer-LNP23NSM.js");
2135
- const { layoutBoxesAndLines } = await import("./layout-U3AH6M7J.js");
2134
+ const { renderBoxesAndLinesForExport } = await import("./renderer-2QPHDBZY.js");
2135
+ const { layoutBoxesAndLines } = await import("./layout-TIBRMWHL.js");
2136
2136
  const blLayout = await layoutBoxesAndLines(blParsed);
2137
2137
  const PADDING = 20;
2138
2138
  const titleOffset = blParsed.title ? 40 : 0;
@@ -2223,9 +2223,9 @@ async function exportC4(ctx) {
2223
2223
  // src/class/export.ts
2224
2224
  async function exportClass(ctx) {
2225
2225
  const { content, theme, palette, exportMode } = ctx;
2226
- const { parseClassDiagram: parseClassDiagram2 } = await import("./parser-TAYRTCPR.js");
2227
- const { layoutClassDiagram } = await import("./layout-IT4ZTV6C.js");
2228
- const { renderClassDiagram } = await import("./renderer-OUDHH5MV.js");
2226
+ const { parseClassDiagram: parseClassDiagram2 } = await import("./parser-MA7L3XND.js");
2227
+ const { layoutClassDiagram } = await import("./layout-5SZ5A64I.js");
2228
+ const { renderClassDiagram } = await import("./renderer-P3WR7TKD.js");
2229
2229
  const effectivePalette = await resolveExportPalette(theme, palette);
2230
2230
  const classParsed = parseClassDiagram2(content, effectivePalette);
2231
2231
  if (classParsed.error || classParsed.classes.length === 0) return "";
@@ -2305,9 +2305,9 @@ async function exportCycle(ctx) {
2305
2305
  // src/er/export.ts
2306
2306
  async function exportEr(ctx) {
2307
2307
  const { content, theme, palette, viewState, exportMode } = ctx;
2308
- const { parseERDiagram: parseERDiagram2 } = await import("./parser-4RFY7D52.js");
2309
- const { layoutERDiagram } = await import("./layout-ISSBWBH7.js");
2310
- const { renderERDiagram } = await import("./renderer-J3GPDK73.js");
2308
+ const { parseERDiagram: parseERDiagram2 } = await import("./parser-BTSTKY5G.js");
2309
+ const { layoutERDiagram } = await import("./layout-YBMT74MG.js");
2310
+ const { renderERDiagram } = await import("./renderer-4VGO27EE.js");
2311
2311
  const effectivePalette = await resolveExportPalette(theme, palette);
2312
2312
  const erParsed = parseERDiagram2(content, effectivePalette);
2313
2313
  if (erParsed.error || erParsed.tables.length === 0) return "";
@@ -2342,7 +2342,7 @@ async function exportEr(ctx) {
2342
2342
  async function exportEventLine(ctx) {
2343
2343
  const { content, theme, palette } = ctx;
2344
2344
  const { parseEventLine: parseEventLine2 } = await import("./parser-YG625J5H.js");
2345
- const { renderEventLineForExport } = await import("./renderer-J7ZSTJUE.js");
2345
+ const { renderEventLineForExport } = await import("./renderer-Y47EM337.js");
2346
2346
  const effectivePalette = await resolveExportPalette(theme, palette);
2347
2347
  const parsed = parseEventLine2(content, effectivePalette);
2348
2348
  if (parsed.error || parsed.events.length === 0) return "";
@@ -2457,9 +2457,9 @@ async function exportGoal(ctx) {
2457
2457
  // src/graph/export.ts
2458
2458
  async function exportFlowchart(ctx) {
2459
2459
  const { content, theme, palette } = ctx;
2460
- const { parseFlowchart: parseFlowchart2 } = await import("./flowchart-parser-NZXASOZG.js");
2461
- const { layoutGraph } = await import("./layout-VC3MXRB4.js");
2462
- const { renderFlowchart } = await import("./flowchart-renderer-PTCRIANF.js");
2460
+ const { parseFlowchart: parseFlowchart2 } = await import("./flowchart-parser-J3VWIFWB.js");
2461
+ const { layoutGraph } = await import("./layout-EWXHEXNS.js");
2462
+ const { renderFlowchart } = await import("./flowchart-renderer-FECH5KK5.js");
2463
2463
  const effectivePalette = await resolveExportPalette(theme, palette);
2464
2464
  const fcParsed = parseFlowchart2(content, effectivePalette);
2465
2465
  if (fcParsed.error || fcParsed.nodes.length === 0) return "";
@@ -2478,9 +2478,9 @@ async function exportFlowchart(ctx) {
2478
2478
  }
2479
2479
  async function exportState(ctx) {
2480
2480
  const { content, theme, palette, viewState } = ctx;
2481
- const { parseState: parseState2 } = await import("./state-parser-KPVW5CRI.js");
2482
- const { layoutGraph } = await import("./layout-VC3MXRB4.js");
2483
- const { renderState } = await import("./state-renderer-ZVEI265C.js");
2481
+ const { parseState: parseState2 } = await import("./state-parser-PMNHLHLE.js");
2482
+ const { layoutGraph } = await import("./layout-EWXHEXNS.js");
2483
+ const { renderState } = await import("./state-renderer-JQ5DS66J.js");
2484
2484
  const { collapseStateGroups } = await import("./state-collapse-SE2G4K4I.js");
2485
2485
  const effectivePalette = await resolveExportPalette(theme, palette);
2486
2486
  const stateParsed = parseState2(content, effectivePalette);
@@ -2572,7 +2572,7 @@ async function exportInfra(ctx) {
2572
2572
  async function exportJourneyMap(ctx) {
2573
2573
  const { content, theme, palette, exportMode } = ctx;
2574
2574
  const { parseJourneyMap: parseJourneyMap2 } = await import("./parser-NL73FSFI.js");
2575
- const { renderJourneyMap } = await import("./renderer-53B523PM.js");
2575
+ const { renderJourneyMap } = await import("./renderer-IVHD7ENY.js");
2576
2576
  const { layoutJourneyMap } = await import("./layout-HFBK5UEG.js");
2577
2577
  const effectivePalette = await resolveExportPalette(theme, palette);
2578
2578
  const jmParsed = parseJourneyMap2(content, effectivePalette);
@@ -2630,7 +2630,7 @@ async function exportKanban(ctx) {
2630
2630
  async function exportLiveLink(ctx) {
2631
2631
  const { content, theme, palette } = ctx;
2632
2632
  const { parseLiveLink: parseLiveLink2 } = await import("./parser-GMQJISZ6.js");
2633
- const { renderLiveLinkCard } = await import("./renderer-4SE7R22T.js");
2633
+ const { renderLiveLinkCard } = await import("./renderer-ZV6KCLCL.js");
2634
2634
  const effectivePalette = await resolveExportPalette(theme, palette);
2635
2635
  return renderLiveLinkCard(parseLiveLink2(content), effectivePalette, theme);
2636
2636
  }
@@ -2688,7 +2688,7 @@ async function exportMindmap(ctx) {
2688
2688
  const { parseMindmap: parseMindmap2 } = await import("./parser-KKF6Y5MM.js");
2689
2689
  const { layoutMindmap } = await import("./layout-RH3N46HP.js");
2690
2690
  const { collapseMindmapTree } = await import("./collapse-BSPH3BFM.js");
2691
- const { renderMindmap } = await import("./renderer-PHLCYVSN.js");
2691
+ const { renderMindmap } = await import("./renderer-XDX6S7OV.js");
2692
2692
  const isDark = ctx.isDark;
2693
2693
  const effectivePalette = await resolveExportPalette(theme, palette);
2694
2694
  const mmParsed = parseMindmap2(content, effectivePalette);
@@ -2743,7 +2743,7 @@ async function exportOrg(ctx) {
2743
2743
  const { parseOrg: parseOrg2, findOrgNodeIdByName } = await import("./parser-BJ7RJNUM.js");
2744
2744
  const { layoutOrg } = await import("./layout-MXHR3P35.js");
2745
2745
  const { collapseOrgTree, focusOrgTree, unionCollapsedOrgNodes } = await import("./collapse-VNYYXMUI.js");
2746
- const { renderOrg, ancestorTrailReserve } = await import("./renderer-JJ4QW3SK.js");
2746
+ const { renderOrg, ancestorTrailReserve } = await import("./renderer-6BDK47V6.js");
2747
2747
  const isDark = ctx.isDark;
2748
2748
  const effectivePalette = await resolveExportPalette(theme, palette);
2749
2749
  const orgParsed = parseOrg2(content, effectivePalette);
@@ -2936,7 +2936,7 @@ async function exportVisualization(ctx) {
2936
2936
  const isDark = ctx.isDark;
2937
2937
  const container = createExportContainer(ctx.width, ctx.height);
2938
2938
  const { parseSequenceDgmo: parseSequenceDgmo2 } = await import("./parser-BT4NI6JY.js");
2939
- const { renderSequenceDiagram } = await import("./renderer-FMTLSOCX.js");
2939
+ const { renderSequenceDiagram } = await import("./renderer-ACQQ2JXA.js");
2940
2940
  const seqParsed = parseSequenceDgmo2(content, effectivePalette);
2941
2941
  if (seqParsed.error || seqParsed.participants.length === 0) return "";
2942
2942
  const collapsedSections = viewState?.cs ? new Set(viewState.cs) : void 0;
@@ -2966,7 +2966,7 @@ async function exportSitemap(ctx) {
2966
2966
  const { parseSitemap: parseSitemap2 } = await import("./parser-6TDWUKM5.js");
2967
2967
  const { layoutSitemap } = await import("./layout-ND26WVX2.js");
2968
2968
  const { collapseSitemapTree } = await import("./collapse-TCVK3RPO.js");
2969
- const { renderSitemap } = await import("./renderer-XOWDERU2.js");
2969
+ const { renderSitemap } = await import("./renderer-UGW4N2W5.js");
2970
2970
  const isDark = ctx.isDark;
2971
2971
  const effectivePalette = await resolveExportPalette(theme, palette);
2972
2972
  const sitemapParsed = parseSitemap2(content, effectivePalette);
@@ -3221,11 +3221,11 @@ async function exportVersionControl(ctx) {
3221
3221
  // src/whiteboard/export.ts
3222
3222
  async function exportWhiteboard(ctx) {
3223
3223
  const { content, theme } = ctx;
3224
- const { parseWhiteboard: parseWhiteboard2 } = await import("./parser-R3LPEQIT.js");
3224
+ const { parseWhiteboard: parseWhiteboard2 } = await import("./parser-AR2GON37.js");
3225
3225
  const effectivePalette = await resolveExportPalette(theme, ctx.palette);
3226
3226
  const parsed = parseWhiteboard2(content, effectivePalette);
3227
3227
  if (parsed.error || parsed.elements.length === 0) return "";
3228
- const { renderWhiteboard } = await import("./renderer-M5DUMITP.js");
3228
+ const { renderWhiteboard } = await import("./renderer-IGSHD3OT.js");
3229
3229
  const container = createExportContainer(1, 1);
3230
3230
  const resolveImage = ctx.options?.resolveImage;
3231
3231
  const showNotes = ctx.options?.showNotes;
@@ -3344,7 +3344,7 @@ function resolveArcChordOverride(content, detectedType, palette) {
3344
3344
  }
3345
3345
  async function renderForExport(content, theme, palette, viewState, options) {
3346
3346
  const exportMode = options?.exportMode ?? false;
3347
- const { parseDgmoChartType } = await import("./dgmo-router-E5O7RJSW.js");
3347
+ const { parseDgmoChartType } = await import("./dgmo-router-6YLKM6WU.js");
3348
3348
  const detectedTypeRaw = parseDgmoChartType(content);
3349
3349
  const override = resolveArcChordOverride(content, detectedTypeRaw, palette);
3350
3350
  const renderContent = override?.content ?? content;
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-6OSGENN5.js";
4
4
  import {
5
5
  parseDgmoChartType
6
- } from "./chunk-2HSHWPTO.js";
6
+ } from "./chunk-BTP2BMWN.js";
7
7
  import {
8
8
  FONT_FAMILY,
9
9
  MONO_FAMILY
@@ -41,7 +41,7 @@ import {
41
41
  renderNoteBadge,
42
42
  renderNoteBox,
43
43
  renderNoteConnector
44
- } from "./chunk-VDY2GR6U.js";
44
+ } from "./chunk-67N26CER.js";
45
45
  import {
46
46
  wrapDescriptionLines
47
47
  } from "./chunk-7WEYXYLC.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VGAMBOOC.js";
5
5
  import {
6
6
  computeNodeSize
7
- } from "./chunk-3ZP3QC47.js";
7
+ } from "./chunk-VTESGA5F.js";
8
8
  import {
9
9
  NODE_HEIGHT,
10
10
  NODE_WIDTH
@@ -25,7 +25,7 @@ import {
25
25
  import {
26
26
  NOTE_BULLET_INDENT,
27
27
  wrapNoteBody
28
- } from "./chunk-VDY2GR6U.js";
28
+ } from "./chunk-67N26CER.js";
29
29
  import {
30
30
  renderInlineText
31
31
  } from "./chunk-QKPOIJBT.js";
@@ -10,7 +10,7 @@ import {
10
10
  buildPlacedNotes,
11
11
  noteCanvasShift,
12
12
  resolveNotes
13
- } from "./chunk-7SXV7NUS.js";
13
+ } from "./chunk-KLBTJEIK.js";
14
14
  import {
15
15
  measureText,
16
16
  wrapTextToWidth
@@ -105,7 +105,7 @@ function computeNodeSize(node, reserveValueRow) {
105
105
  return { width: w, height: Math.max(NODE_HEIGHT, totalHeight) };
106
106
  }
107
107
  async function layoutBoxesAndLines(parsed, collapseInfo, layoutOptions) {
108
- const { layoutBoxesAndLinesSearch } = await import("./layout-search-BBX2BMEF.js");
108
+ const { layoutBoxesAndLinesSearch } = await import("./layout-search-AWPJWBKT.js");
109
109
  const searchOpts = {
110
110
  ...layoutOptions?.hideDescriptions !== void 0 && {
111
111
  hideDescriptions: layoutOptions.hideDescriptions
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-26EVL454.js";
5
5
  import {
6
6
  layoutGraph
7
- } from "./chunk-JT2BG7LM.js";
7
+ } from "./chunk-EXHXTMVR.js";
8
8
  import {
9
9
  appendArrowheadMarkers
10
10
  } from "./chunk-XBJJP2HN.js";
@@ -41,14 +41,14 @@ import {
41
41
  } from "./chunk-JILEYZ2V.js";
42
42
  import {
43
43
  parseState
44
- } from "./chunk-2MS623GW.js";
44
+ } from "./chunk-LJGE43SG.js";
45
45
  import {
46
46
  NOTE_BADGE_RADIUS,
47
47
  noteConnectorPoints,
48
48
  renderNoteBadge,
49
49
  renderNoteBox,
50
50
  renderNoteConnector
51
- } from "./chunk-VDY2GR6U.js";
51
+ } from "./chunk-67N26CER.js";
52
52
  import {
53
53
  FONT_FAMILY
54
54
  } from "./chunk-ICLB27PZ.js";
@@ -235,7 +235,7 @@ function renderState(container, graph, layout, palette, isDark, onClickItem, exp
235
235
  const groupOutline = fillModeFromOptions(graph.options ?? {}) === "outline";
236
236
  const fillColor = groupOutline ? themeBaseBg(palette, isDark) : groupColor ? mix(groupColor, themeBaseBg(palette, isDark), 10) : isDark ? palette.surface : mix(palette.border, palette.bg, 30);
237
237
  const strokeColor = groupColor ?? palette.textMuted;
238
- const groupWrapper = contentG.append("g").attr("class", "st-group-wrapper").attr("data-line-number", String(group.lineNumber)).attr("data-group-id", group.id).attr("data-group-toggle", group.id).attr("tabindex", "0").attr("role", "button").attr("aria-expanded", "true").attr("aria-label", `Collapse group ${group.label}`).style("cursor", "pointer");
238
+ const groupWrapper = contentG.append("g").attr("class", "st-group-wrapper").attr("data-line-number", String(group.lineNumber)).attr("data-group-id", group.id).attr("data-group-toggle", group.id).attr("role", "button").attr("aria-expanded", "true").attr("aria-label", `Collapse group ${group.label}`).style("cursor", "pointer");
239
239
  groupWrapper.append("rect").attr("x", gx).attr("y", gy).attr("width", gw).attr("height", gh).attr("rx", 6).attr("fill", fillColor).attr("stroke", strokeColor).attr("stroke-width", 1).attr("stroke-opacity", 0.5).attr("class", "st-group");
240
240
  groupWrapper.append("text").attr("x", gx + 8).attr("y", gy + sGroupLabelFontSize + 4).attr("fill", strokeColor).attr("font-size", sGroupLabelFontSize).attr("font-weight", "bold").attr("opacity", 0.7).attr("class", "st-group-label").text(group.label);
241
241
  }
@@ -336,7 +336,7 @@ function renderState(container, graph, layout, palette, isDark, onClickItem, exp
336
336
  }
337
337
  }
338
338
  if (isCollapsedGroup) {
339
- nodeG.attr("data-group-toggle", node.id).attr("tabindex", "0").attr("role", "button").attr("aria-expanded", "false").attr("aria-label", `Expand group ${node.label}`);
339
+ nodeG.attr("data-group-toggle", node.id).attr("role", "button").attr("aria-expanded", "false").attr("aria-label", `Expand group ${node.label}`);
340
340
  }
341
341
  if (onClickItem && !isCollapsedGroup) {
342
342
  nodeG.on("click", () => {
@@ -1041,6 +1041,9 @@ var PIPE_METADATA = /* @__PURE__ */ new Map([
1041
1041
  },
1042
1042
  fill: {
1043
1043
  description: "Shape fill: `solid` or `outline` (a pale tint is the default)"
1044
+ },
1045
+ label: {
1046
+ description: "Shape label position: `top` or `middle` (automatic: top on a rectangle holding shapes)"
1044
1047
  }
1045
1048
  }
1046
1049
  }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copy-as-image for the embed toolbar's `.dgmo-copy-image` button — its own
3
+ * zero-import entry (`@diagrammo/dgmo/copy-image`) so every client surface
4
+ * (the auto script, remark-dgmo's `bindDgmo`, the Obsidian plugin) shares ONE
5
+ * rasterizer instead of mirroring it the way copy-source is mirrored.
6
+ *
7
+ * Copies the diagram as it is currently shown — the visible `.dgmo-light` /
8
+ * `.dgmo-dark` half of a dual render, or the single `.dgmo-svg` — as a PNG at
9
+ * `COPY_IMAGE_SCALE`, filled with the wrapper's `data-dgmo-bg` so a transparent
10
+ * embed doesn't paste as dark text on nothing.
11
+ *
12
+ * 🔴 `navigator.clipboard.write` must be CALLED inside the click, before any
13
+ * await: Safari drops the user activation across an await and then refuses the
14
+ * write. Hence the Blob goes in as a Promise and the PNG is drawn inside
15
+ * the ClipboardItem.
16
+ *
17
+ * Fonts: an SVG drawn through `<img>` cannot load web fonts. dgmo draws text in
18
+ * a system font stack, so labels still match; a host font injected by page CSS
19
+ * would not survive.
20
+ */
21
+ /**
22
+ * True when this browser can put a PNG on the clipboard. Hide the button if not.
23
+ * Pass the block's own window for a pop-out (Obsidian): the write is refused
24
+ * unless it goes through the window whose document has focus.
25
+ */
26
+ declare function canCopyDiagramImage(view?: Window | null): boolean;
27
+ /**
28
+ * Copy the diagram in the `.dgmo` block containing `fromButton` to the
29
+ * clipboard as a PNG. Resolves false on any failure (no SVG, a tainted canvas
30
+ * from an external `<image>`, a refused clipboard) — never throws.
31
+ */
32
+ declare function copyDiagramImage(fromButton: Element): Promise<boolean>;
33
+
34
+ export { canCopyDiagramImage, copyDiagramImage };
@@ -0,0 +1,96 @@
1
+ // src/embed/copy-image.ts
2
+ var SVG_NS = "http://www.w3.org/2000/svg";
3
+ var COPY_IMAGE_SCALE = 2;
4
+ function canCopyDiagramImage(view = typeof window === "undefined" ? null : window) {
5
+ return !!view && typeof view.navigator?.clipboard?.write === "function" && typeof view.ClipboardItem !== "undefined";
6
+ }
7
+ function copyDiagramImage(fromButton) {
8
+ const view = fromButton.ownerDocument.defaultView;
9
+ if (!view || !canCopyDiagramImage(view)) return Promise.resolve(false);
10
+ const found = visibleSvg(fromButton);
11
+ if (!found) return Promise.resolve(false);
12
+ try {
13
+ const Item = view.ClipboardItem;
14
+ return view.navigator.clipboard.write([
15
+ new Item({
16
+ "image/png": svgToPngBlob(found.svg, found.background)
17
+ })
18
+ ]).then(
19
+ () => true,
20
+ () => false
21
+ );
22
+ } catch {
23
+ return Promise.resolve(false);
24
+ }
25
+ }
26
+ function visibleSvg(fromButton) {
27
+ const block = fromButton.closest(".dgmo");
28
+ if (!block) return null;
29
+ const view = block.ownerDocument.defaultView ?? window;
30
+ const wrappers = block.querySelectorAll(
31
+ ".dgmo-light, .dgmo-dark, .dgmo-svg"
32
+ );
33
+ for (const w of Array.from(wrappers)) {
34
+ if (view.getComputedStyle(w).display === "none") continue;
35
+ const svg2 = w.querySelector("svg");
36
+ if (svg2) {
37
+ return { svg: svg2, background: w.dataset["dgmoBg"] ?? pageBackground(w) };
38
+ }
39
+ }
40
+ const svg = block.querySelector("svg");
41
+ return svg ? { svg, background: pageBackground(block) } : null;
42
+ }
43
+ function pageBackground(from) {
44
+ const view = from.ownerDocument.defaultView ?? window;
45
+ for (let el = from; el; el = el.parentElement) {
46
+ const bg = view.getComputedStyle(el).backgroundColor;
47
+ if (bg && bg !== "transparent" && !/^rgba\(.*,\s*0\)$/.test(bg)) return bg;
48
+ }
49
+ return void 0;
50
+ }
51
+ function intrinsicSize(svg) {
52
+ const vb = svg.viewBox?.baseVal;
53
+ if (vb && vb.width > 0 && vb.height > 0) {
54
+ return { width: vb.width, height: vb.height };
55
+ }
56
+ const rect = svg.getBoundingClientRect();
57
+ return { width: rect.width, height: rect.height };
58
+ }
59
+ async function svgToPngBlob(svg, background) {
60
+ const { width, height } = intrinsicSize(svg);
61
+ if (!(width > 0 && height > 0)) throw new Error("diagram has no size");
62
+ const clone = svg.cloneNode(true);
63
+ clone.setAttribute("xmlns", SVG_NS);
64
+ clone.setAttribute("width", String(width));
65
+ clone.setAttribute("height", String(height));
66
+ for (const prop of ["width", "height", "max-width", "aspect-ratio"]) {
67
+ clone.style.removeProperty(prop);
68
+ }
69
+ const xml = new XMLSerializer().serializeToString(clone);
70
+ const img = new Image();
71
+ await new Promise((resolve, reject) => {
72
+ img.onload = () => resolve();
73
+ img.onerror = () => reject(new Error("diagram SVG failed to load"));
74
+ img.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(xml)}`;
75
+ });
76
+ const canvas = document.createElement("canvas");
77
+ canvas.width = Math.round(width * COPY_IMAGE_SCALE);
78
+ canvas.height = Math.round(height * COPY_IMAGE_SCALE);
79
+ const ctx = canvas.getContext("2d");
80
+ if (!ctx) throw new Error("no 2d canvas context");
81
+ if (background) {
82
+ ctx.fillStyle = background;
83
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
84
+ }
85
+ ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
86
+ return new Promise((resolve, reject) => {
87
+ canvas.toBlob(
88
+ (blob) => blob ? resolve(blob) : reject(new Error("toBlob failed")),
89
+ "image/png"
90
+ );
91
+ });
92
+ }
93
+ export {
94
+ canCopyDiagramImage,
95
+ copyDiagramImage
96
+ };
@@ -6,7 +6,7 @@ import {
6
6
  isExtendedChartType,
7
7
  knownChartTypeIds,
8
8
  parseDgmo
9
- } from "./chunk-5ZUZZDW5.js";
9
+ } from "./chunk-P5XA627W.js";
10
10
  import "./chunk-H6BT45SN.js";
11
11
  import "./chunk-3PP746YM.js";
12
12
  import "./chunk-NM5V5EKY.js";
@@ -16,8 +16,8 @@ import "./chunk-2ZW4NBYX.js";
16
16
  import "./chunk-AULZD45V.js";
17
17
  import "./chunk-WZBZXZ6T.js";
18
18
  import "./chunk-NWSPPGIE.js";
19
- import "./chunk-5HAYT43L.js";
20
- import "./chunk-P7TRFL4P.js";
19
+ import "./chunk-U6VS3T2M.js";
20
+ import "./chunk-R46N5KR4.js";
21
21
  import "./chunk-J7Q4AB23.js";
22
22
  import "./chunk-XIUGSUE4.js";
23
23
  import "./chunk-EBVVMUAA.js";
@@ -43,12 +43,12 @@ import "./chunk-BRGRIZQB.js";
43
43
  import "./chunk-XSVWUOUZ.js";
44
44
  import "./chunk-JXGSTBW6.js";
45
45
  import "./chunk-H7AXCRO7.js";
46
- import "./chunk-2XMTZ5JR.js";
46
+ import "./chunk-4UVCTLRH.js";
47
47
  import {
48
48
  looksLikeC4,
49
49
  looksLikeGantt,
50
50
  parseDgmoChartType
51
- } from "./chunk-2HSHWPTO.js";
51
+ } from "./chunk-BTP2BMWN.js";
52
52
  import "./chunk-KRPLP5LP.js";
53
53
  import "./chunk-KBDMEOLI.js";
54
54
  import "./chunk-VSAKEMDD.js";
@@ -56,23 +56,23 @@ import "./chunk-5OTA2PUH.js";
56
56
  import "./chunk-ZECJ7Q6C.js";
57
57
  import "./chunk-CDM6XMOT.js";
58
58
  import "./chunk-2SKMEL7V.js";
59
- import "./chunk-DNM3XZCK.js";
59
+ import "./chunk-IY62DXT2.js";
60
60
  import "./chunk-TIVMAITN.js";
61
- import "./chunk-2MS623GW.js";
61
+ import "./chunk-LJGE43SG.js";
62
62
  import "./chunk-NXMESY4J.js";
63
63
  import "./chunk-EQW6HOP4.js";
64
64
  import "./chunk-MKSTL6DR.js";
65
65
  import "./chunk-CYTFO2LF.js";
66
- import "./chunk-CIHHTS5B.js";
66
+ import "./chunk-S4SJ4LLY.js";
67
67
  import "./chunk-C3Z4DX3V.js";
68
68
  import "./chunk-IYULMRBE.js";
69
- import "./chunk-DLJJOCIT.js";
69
+ import "./chunk-5XBYLYYI.js";
70
70
  import "./chunk-GXCDD6NG.js";
71
71
  import "./chunk-FMAVHTYB.js";
72
72
  import "./chunk-N7VMGZCU.js";
73
- import "./chunk-7SXV7NUS.js";
73
+ import "./chunk-KLBTJEIK.js";
74
74
  import "./chunk-NOTA6TEI.js";
75
- import "./chunk-VDY2GR6U.js";
75
+ import "./chunk-67N26CER.js";
76
76
  import "./chunk-7WEYXYLC.js";
77
77
  import "./chunk-QKPOIJBT.js";
78
78
  import "./chunk-ICLB27PZ.js";
@@ -2,13 +2,13 @@ import {
2
2
  extractSymbols,
3
3
  looksLikeFlowchart,
4
4
  parseFlowchart
5
- } from "./chunk-DNM3XZCK.js";
5
+ } from "./chunk-IY62DXT2.js";
6
6
  import "./chunk-TIVMAITN.js";
7
7
  import "./chunk-NXMESY4J.js";
8
8
  import "./chunk-N7VMGZCU.js";
9
- import "./chunk-7SXV7NUS.js";
9
+ import "./chunk-KLBTJEIK.js";
10
10
  import "./chunk-NOTA6TEI.js";
11
- import "./chunk-VDY2GR6U.js";
11
+ import "./chunk-67N26CER.js";
12
12
  import "./chunk-7WEYXYLC.js";
13
13
  import "./chunk-QKPOIJBT.js";
14
14
  import "./chunk-ICLB27PZ.js";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  renderFlowchart,
3
3
  renderFlowchartForExport
4
- } from "./chunk-AYUSD4Z6.js";
4
+ } from "./chunk-LAXMUSGW.js";
5
5
  import "./chunk-26EVL454.js";
6
- import "./chunk-JT2BG7LM.js";
7
- import "./chunk-TDAGJJPZ.js";
6
+ import "./chunk-EXHXTMVR.js";
7
+ import "./chunk-2J2CWWWK.js";
8
8
  import "./chunk-XBJJP2HN.js";
9
- import "./chunk-6JCTW74W.js";
9
+ import "./chunk-VB4VMB2I.js";
10
10
  import "./chunk-VGAMBOOC.js";
11
- import "./chunk-3ZP3QC47.js";
11
+ import "./chunk-VTESGA5F.js";
12
12
  import "./chunk-WTTIODDV.js";
13
13
  import "./chunk-IN7XI6NO.js";
14
14
  import "./chunk-EPDBWATV.js";
@@ -17,13 +17,13 @@ import "./chunk-24YPR5EH.js";
17
17
  import "./chunk-UIEKW4SG.js";
18
18
  import "./chunk-VLC6WNRD.js";
19
19
  import "./chunk-XCKNFFKM.js";
20
- import "./chunk-DNM3XZCK.js";
20
+ import "./chunk-IY62DXT2.js";
21
21
  import "./chunk-TIVMAITN.js";
22
22
  import "./chunk-NXMESY4J.js";
23
23
  import "./chunk-N7VMGZCU.js";
24
- import "./chunk-7SXV7NUS.js";
24
+ import "./chunk-KLBTJEIK.js";
25
25
  import "./chunk-NOTA6TEI.js";
26
- import "./chunk-VDY2GR6U.js";
26
+ import "./chunk-67N26CER.js";
27
27
  import "./chunk-7WEYXYLC.js";
28
28
  import "./chunk-QKPOIJBT.js";
29
29
  import "./chunk-ICLB27PZ.js";