@diagrammo/dgmo 0.61.0 → 0.62.1

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 (82) hide show
  1. package/README.md +1 -1
  2. package/dist/advanced.d.ts +382 -396
  3. package/dist/advanced.js +152 -38
  4. package/dist/auto.js +143 -142
  5. package/dist/block.js +9 -8
  6. package/dist/{chart-meta-gUwAzi7N.d.ts → chart-meta-D98NbYDp.d.ts} +1 -1
  7. package/dist/chart-meta.d.ts +2 -2
  8. package/dist/chart-meta.js +1 -1
  9. package/dist/{charts-d3-MN6QCYKU.js → charts-d3-M76E4TZU.js} +5 -5
  10. package/dist/{chunk-6CWNVQPW.js → chunk-2LN5C6FH.js} +3 -3
  11. package/dist/{chunk-FXLGBUIQ.js → chunk-34HQALZ5.js} +2 -2
  12. package/dist/{chunk-OPBZYISB.js → chunk-37EHGTQ2.js} +2204 -2018
  13. package/dist/{chunk-ZDFIY6WX.js → chunk-3PVUGECM.js} +1 -2
  14. package/dist/{chunk-XJZCXNWR.js → chunk-BGITRLTR.js} +2 -2
  15. package/dist/{chunk-3OLO2MZ6.js → chunk-BPINSP65.js} +2 -2
  16. package/dist/{chunk-VHO3YBTB.js → chunk-CVVICCSB.js} +24 -2
  17. package/dist/{chunk-DZZWR6GT.js → chunk-DUHKYKI7.js} +2 -2
  18. package/dist/{chunk-4B5YISOR.js → chunk-EOYPX6SF.js} +24 -1
  19. package/dist/{chunk-MOT3NXB5.js → chunk-FVYHDZ6Q.js} +2 -2
  20. package/dist/{chunk-7FTGNJQ2.js → chunk-GCVTU64J.js} +17 -5
  21. package/dist/{chunk-S23HOUJS.js → chunk-JU2VMFYC.js} +2 -2
  22. package/dist/{chunk-CQ7Y3O67.js → chunk-KHTKMVKT.js} +2 -2
  23. package/dist/{chunk-7BJQUII6.js → chunk-KK5LQIN7.js} +2 -2
  24. package/dist/{chunk-L43KTQTW.js → chunk-L26ZAPNJ.js} +2 -2
  25. package/dist/{chunk-LRKGF7RN.js → chunk-L4B4GRVS.js} +2 -2
  26. package/dist/{chunk-5PWIV7ZF.js → chunk-LFAQ4BLZ.js} +2 -2
  27. package/dist/{chunk-7QCYHZVO.js → chunk-NQH2Q2RR.js} +2 -2
  28. package/dist/{chunk-PFGJ7SCM.js → chunk-PUFWYDWP.js} +2 -2
  29. package/dist/{chunk-BSJIPMPG.js → chunk-QDPMTFB4.js} +45 -32
  30. package/dist/chunk-RU2HHHYA.js +23 -0
  31. package/dist/{chunk-SMHTYVMK.js → chunk-RZRMSNO7.js} +2 -2
  32. package/dist/{chunk-HJ6TMHQG.js → chunk-SV7F363F.js} +2 -2
  33. package/dist/{chunk-YJCILMEA.js → chunk-U22TKD3L.js} +2 -2
  34. package/dist/{chunk-2WPLOS4Q.js → chunk-USHDV2AF.js} +2 -2
  35. package/dist/{chunk-DNSEG6P2.js → chunk-WMHHNK44.js} +2 -2
  36. package/dist/{chunk-4BEAHH6G.js → chunk-XXDEQSW4.js} +2 -2
  37. package/dist/{chunk-NEV5IW33.js → chunk-YVI3JL3S.js} +2 -2
  38. package/dist/{registry-Ch0Umdi1.d.ts → dgmo-router-Dd5PTjxl.d.ts} +98 -98
  39. package/dist/{dgmo-router-UVYAJCAF.js → dgmo-router-Z5N6QLIC.js} +2 -2
  40. package/dist/{dimensions-QCPOPPKE.js → dimensions-ES6O2T4H.js} +4 -4
  41. package/dist/element.js +144 -143
  42. package/dist/{flowchart-renderer-XFDCX7MZ.js → flowchart-renderer-BCVCIZHF.js} +3 -3
  43. package/dist/index.d.ts +21 -10
  44. package/dist/index.js +13 -23
  45. package/dist/{renderer-CXRSD26Q.js → renderer-4VDSMPYU.js} +4 -4
  46. package/dist/{renderer-62FFDWMY.js → renderer-5HYDLCMX.js} +3 -3
  47. package/dist/{renderer-XSHOMUJQ.js → renderer-726UVOKE.js} +3 -3
  48. package/dist/{renderer-IYMA5W7X.js → renderer-A5GFW2XH.js} +4 -4
  49. package/dist/{renderer-VYMTBSF4.js → renderer-HPQJRSON.js} +3 -3
  50. package/dist/{renderer-GESKWINV.js → renderer-K3TH5PP7.js} +4 -4
  51. package/dist/{renderer-4RQ5PGHY.js → renderer-KHVAM4IY.js} +3 -3
  52. package/dist/{renderer-2PGIIOFN.js → renderer-KKNXTTFE.js} +5 -5
  53. package/dist/{renderer-IG5PQXEM.js → renderer-PKST5W6U.js} +4 -4
  54. package/dist/{renderer-R6OKKSVR.js → renderer-Q2YHQQSN.js} +4 -4
  55. package/dist/{renderer-6QW5OAJG.js → renderer-TTMBG2N6.js} +2 -2
  56. package/dist/{renderer-AS6LLDZM.js → renderer-XDL6PRLN.js} +3 -3
  57. package/dist/{renderer-63MLWS6L.js → renderer-XIJO7DYS.js} +3 -3
  58. package/dist/{resolver-W3WKLWDP.js → resolver-B3TXWNWF.js} +3 -3
  59. package/dist/{state-renderer-GBHDOEXR.js → state-renderer-MCWCZ76U.js} +3 -3
  60. package/dist/{themes-DC6u80yr.d.ts → themes-DiUAG4Bf.d.ts} +37 -2
  61. package/docs/ai-integration.md +5 -5
  62. package/fonts/Inter-Bold.ttf +0 -0
  63. package/fonts/Inter-Bold.woff2 +0 -0
  64. package/fonts/Inter-Regular.ttf +0 -0
  65. package/fonts/Inter-Regular.woff2 +0 -0
  66. package/package.json +8 -23
  67. package/.claude/commands/dgmo-codebase-report.md +0 -172
  68. package/.claude/commands/dgmo-diagram-this.md +0 -60
  69. package/.claude/commands/dgmo-document-project.md +0 -128
  70. package/.claude/commands/dgmo.md +0 -313
  71. package/.cursorrules +0 -587
  72. package/.github/copilot-instructions.md +0 -597
  73. package/.windsurfrules +0 -587
  74. package/SKILL.md +0 -573
  75. package/dist/auto.d.ts +0 -60
  76. package/dist/auto.mjs +0 -88466
  77. package/dist/chunk-6MTWIQVO.js +0 -121
  78. package/dist/chunk-NZ5QVASG.js +0 -20
  79. package/dist/cli.cjs +0 -489
  80. package/dist/element.d.ts +0 -68
  81. package/dist/element.mjs +0 -88332
  82. package/dist/load-data-EHDDZ5ZS.js +0 -8
@@ -2020,7 +2020,6 @@ export {
2020
2020
  parseWordcloud,
2021
2021
  parseVenn,
2022
2022
  parseQuadrant,
2023
- REGISTRY_BY_ID,
2024
2023
  looksLikeGantt,
2025
2024
  looksLikeC4,
2026
2025
  parseDgmoChartType,
@@ -2032,4 +2031,4 @@ export {
2032
2031
  knownChartTypeIds,
2033
2032
  parseDgmo
2034
2033
  };
2035
- //# sourceMappingURL=chunk-ZDFIY6WX.js.map
2034
+ //# sourceMappingURL=chunk-3PVUGECM.js.map
@@ -24,7 +24,7 @@ import {
24
24
  } from "./chunk-YYVTBZZC.js";
25
25
  import {
26
26
  serializeSvg
27
- } from "./chunk-NZ5QVASG.js";
27
+ } from "./chunk-RU2HHHYA.js";
28
28
  import {
29
29
  TITLE_FONT_SIZE,
30
30
  TITLE_FONT_WEIGHT,
@@ -585,4 +585,4 @@ export {
585
585
  renderFlowchart,
586
586
  renderFlowchartForExport
587
587
  };
588
- //# sourceMappingURL=chunk-XJZCXNWR.js.map
588
+ //# sourceMappingURL=chunk-BGITRLTR.js.map
@@ -10,7 +10,7 @@ import {
10
10
  hideTooltip,
11
11
  renderChartTitle,
12
12
  showTooltip
13
- } from "./chunk-CQ7Y3O67.js";
13
+ } from "./chunk-KHTKMVKT.js";
14
14
  import {
15
15
  renderIntegratedLegend
16
16
  } from "./chunk-UKZ7K5GS.js";
@@ -1670,4 +1670,4 @@ export {
1670
1670
  formatDateLabel,
1671
1671
  renderTimeline
1672
1672
  };
1673
- //# sourceMappingURL=chunk-3OLO2MZ6.js.map
1673
+ //# sourceMappingURL=chunk-BPINSP65.js.map
@@ -54,6 +54,28 @@ function segmentsCross(ax, ay, bx, by, cx, cy, dx, dy) {
54
54
  if (o4 === 0 && onSeg(cx, cy, dx, dy, bx, by)) return true;
55
55
  return false;
56
56
  }
57
+ function createLabelPlacement(init) {
58
+ const placed = [...init?.reserved ?? []];
59
+ const leaders = [];
60
+ const obstacles = init?.obstacles ?? [];
61
+ const markers = init?.markers ?? [];
62
+ return {
63
+ hitsPlaced: (rect) => placed.some((p) => rectsOverlap(rect, p)),
64
+ hitsObstacle: (rect) => obstacles.some((o) => rectsOverlap(rect, o)),
65
+ hitsMarker: (rect) => markers.some((m) => rectCircleOverlap(rect, m)),
66
+ leaderCrosses: ([x0, y0, x1, y1]) => leaders.some(
67
+ (l) => segmentsCross(x0, y0, x1, y1, l[0], l[1], l[2], l[3])
68
+ ),
69
+ leaderHitsPlaced: ([x0, y0, x1, y1]) => placed.some((p) => segmentRectOverlap(x0, y0, x1, y1, p)),
70
+ commit: (rect, leader) => {
71
+ placed.push(rect);
72
+ if (leader) leaders.push(leader);
73
+ },
74
+ get placed() {
75
+ return placed;
76
+ }
77
+ };
78
+ }
57
79
  function computeQuadrantPointLabels(points, chartBounds, obstacles, pointRadius, fontSize) {
58
80
  const labelHeight = fontSize + 4;
59
81
  const stepSize = labelHeight + 2;
@@ -218,7 +240,7 @@ export {
218
240
  rectsOverlap,
219
241
  rectCircleOverlap,
220
242
  segmentRectOverlap,
221
- segmentsCross,
243
+ createLabelPlacement,
222
244
  computeQuadrantPointLabels
223
245
  };
224
- //# sourceMappingURL=chunk-VHO3YBTB.js.map
246
+ //# sourceMappingURL=chunk-CVVICCSB.js.map
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  extractExportSvg,
7
7
  runInExportContainer
8
- } from "./chunk-L43KTQTW.js";
8
+ } from "./chunk-L26ZAPNJ.js";
9
9
  import {
10
10
  renderInlineText
11
11
  } from "./chunk-WGC42WJU.js";
@@ -426,4 +426,4 @@ export {
426
426
  renderMindmap,
427
427
  renderMindmapForExport
428
428
  };
429
- //# sourceMappingURL=chunk-DZZWR6GT.js.map
429
+ //# sourceMappingURL=chunk-DUHKYKI7.js.map
@@ -150,6 +150,29 @@ var MAP_DX = {
150
150
  message: (p) => `\`clock: ${p.name ?? ""}\` overrides this city's actual zone (${p.tz ?? ""}) \u2014 using your value. Use a bare \`clock\` to take the city's real zone.`,
151
151
  hint: "A named city derives its own zone \u2014 use a bare `clock` unless you mean to override it.",
152
152
  example: "map\npoi Denver clock"
153
+ },
154
+ DATA_NOT_SUPPLIED: {
155
+ // Runtime severity: 'error' (matches E_ prefix). Emitted by `exportMap()`
156
+ // in d3.ts, not the resolver — the resolve never happens, because there is
157
+ // no basemap to resolve against. `render()` performs no filesystem or
158
+ // network access of its own, so a host must supply the assets: bundled
159
+ // `MapData` (Obsidian, the web app) or the Node `loadMapData` loader from
160
+ // the `/advanced` subpath (CLI, SSR).
161
+ //
162
+ // 🔴 Two different failures land here and they need different sentences.
163
+ // No `reason` means the host passed nothing — a wiring mistake in the
164
+ // embedding code, and the diagram is fine. A `reason` means the host DID
165
+ // pass a loader and the loader threw: the wiring is right and the install
166
+ // is broken, which is what happened when `@diagrammo/dgmo-cli` 0.62.0
167
+ // shipped without its map data (#121). Telling someone to "pass `mapData`"
168
+ // when they already did sends them to the wrong file.
169
+ code: "E_MAP_DATA_NOT_SUPPLIED",
170
+ severity: "error",
171
+ chartType: "map",
172
+ title: "No map data supplied",
173
+ message: (p) => p.reason ? `This map's basemap data could not be loaded, so nothing was drawn. The loader reported: ${p.reason}` : "This map has no basemap data. `render()` reads nothing from disk or the network on its own \u2014 pass `mapData`, either the bundled assets or a loader that returns them.",
174
+ hint: "In Node: `render(src, { mapData: loadMapData })` with `loadMapData` from `@diagrammo/dgmo/advanced`. In a browser or Worker: pass your bundled `MapData`. If you already do, the assets are missing from the installed package rather than from your code.",
175
+ example: "map\nDenver heat: 2"
153
176
  }
154
177
  };
155
178
  var MAP_DIAGNOSTICS = Object.values(MAP_DX);
@@ -158,4 +181,4 @@ export {
158
181
  MAP_DX,
159
182
  MAP_DIAGNOSTICS
160
183
  };
161
- //# sourceMappingURL=chunk-4B5YISOR.js.map
184
+ //# sourceMappingURL=chunk-EOYPX6SF.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MONO_FAMILY
3
- } from "./chunk-5PWIV7ZF.js";
3
+ } from "./chunk-LFAQ4BLZ.js";
4
4
  import {
5
5
  FONT_FAMILY
6
6
  } from "./chunk-6KFWC4CO.js";
@@ -62,4 +62,4 @@ function escapeXml(s) {
62
62
  export {
63
63
  renderLiveLinkCard
64
64
  };
65
- //# sourceMappingURL=chunk-MOT3NXB5.js.map
65
+ //# sourceMappingURL=chunk-FVYHDZ6Q.js.map
@@ -58,9 +58,13 @@ function renderFigureBody(fig, view, parts, partColor, emphKey, form, palette, i
58
58
  const seam = palette.bg;
59
59
  const outlineStroke = palette.textMuted;
60
60
  const gid = `body-skin-${vx}-${vy}`;
61
- defs.push(
62
- `<linearGradient id="${gid}" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${mix(palette.surface, palette.bg, 0.4)}"/><stop offset="1" stop-color="${mix(palette.border, palette.bg, 0.3)}"/></linearGradient>`
63
- );
61
+ defs.push({
62
+ id: gid,
63
+ stops: [
64
+ { offset: "0", color: mix(palette.surface, palette.bg, 0.4) },
65
+ { offset: "1", color: mix(palette.border, palette.bg, 0.3) }
66
+ ]
67
+ });
64
68
  let out = "";
65
69
  if (form === "skin") {
66
70
  out += `<path d="${fig.outline}" fill="url(#${gid})"/>`;
@@ -292,7 +296,15 @@ function renderBody(container, parsed, palette, _isDark, _onClickItem, exportDim
292
296
  "viewBox",
293
297
  `${-PAGE_MARGIN} ${-PAGE_MARGIN} ${(totalW + 2 * PAGE_MARGIN).toFixed(0)} ${(totalH + 2 * PAGE_MARGIN).toFixed(0)}`
294
298
  ).attr("preserveAspectRatio", "xMidYMin meet").attr("xmlns", "http://www.w3.org/2000/svg").style("font-family", FONT_FAMILY);
295
- if (defs.length) svg.append("defs").html(defs.join(""));
299
+ if (defs.length) {
300
+ const defsSel = svg.append("defs");
301
+ for (const def of defs) {
302
+ const grad = defsSel.append("linearGradient").attr("id", def.id).attr("x1", "0").attr("y1", "0").attr("x2", "0").attr("y2", "1");
303
+ for (const stop of def.stops) {
304
+ grad.append("stop").attr("offset", stop.offset).attr("stop-color", stop.color);
305
+ }
306
+ }
307
+ }
296
308
  svg.append("g").html(body);
297
309
  if (parsed.title && !parsed.options.noTitle) {
298
310
  svg.append("text").attr("x", totalW / 2).attr("y", 40).attr("text-anchor", "middle").attr("font-size", 34).attr("font-weight", 700).attr("fill", palette.text).text(parsed.title);
@@ -334,4 +346,4 @@ export {
334
346
  renderBody,
335
347
  renderBodyForExport
336
348
  };
337
- //# sourceMappingURL=chunk-7FTGNJQ2.js.map
349
+ //# sourceMappingURL=chunk-GCVTU64J.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildMapProjection
3
- } from "./chunk-OPBZYISB.js";
3
+ } from "./chunk-37EHGTQ2.js";
4
4
  import {
5
5
  TITLE_FONT_SIZE,
6
6
  TITLE_Y
@@ -51,4 +51,4 @@ export {
51
51
  mapContentAspect,
52
52
  mapExportDimensions
53
53
  };
54
- //# sourceMappingURL=chunk-S23HOUJS.js.map
54
+ //# sourceMappingURL=chunk-JU2VMFYC.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serializeSvg
3
- } from "./chunk-NZ5QVASG.js";
3
+ } from "./chunk-RU2HHHYA.js";
4
4
  import {
5
5
  TITLE_FONT_SIZE,
6
6
  TITLE_FONT_WEIGHT,
@@ -130,4 +130,4 @@ export {
130
130
  createExportContainer,
131
131
  finalizeSvgExport
132
132
  };
133
- //# sourceMappingURL=chunk-CQ7Y3O67.js.map
133
+ //# sourceMappingURL=chunk-KHTKMVKT.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  extractExportSvg,
3
3
  runInExportContainer
4
- } from "./chunk-L43KTQTW.js";
4
+ } from "./chunk-L26ZAPNJ.js";
5
5
  import {
6
6
  layoutOrg
7
7
  } from "./chunk-RKTIIU7Z.js";
@@ -485,4 +485,4 @@ export {
485
485
  renderOrg,
486
486
  renderOrgForExport
487
487
  };
488
- //# sourceMappingURL=chunk-7BJQUII6.js.map
488
+ //# sourceMappingURL=chunk-KK5LQIN7.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serializeSvg
3
- } from "./chunk-NZ5QVASG.js";
3
+ } from "./chunk-RU2HHHYA.js";
4
4
  import {
5
5
  FONT_FAMILY
6
6
  } from "./chunk-6KFWC4CO.js";
@@ -37,4 +37,4 @@ export {
37
37
  runInExportContainer,
38
38
  extractExportSvg
39
39
  };
40
- //# sourceMappingURL=chunk-L43KTQTW.js.map
40
+ //# sourceMappingURL=chunk-L26ZAPNJ.js.map
@@ -28,7 +28,7 @@ import {
28
28
  } from "./chunk-6VJCURWU.js";
29
29
  import {
30
30
  serializeSvg
31
- } from "./chunk-NZ5QVASG.js";
31
+ } from "./chunk-RU2HHHYA.js";
32
32
  import {
33
33
  TITLE_FONT_SIZE,
34
34
  TITLE_FONT_WEIGHT
@@ -500,4 +500,4 @@ export {
500
500
  renderSitemap,
501
501
  renderSitemapForExport
502
502
  };
503
- //# sourceMappingURL=chunk-LRKGF7RN.js.map
503
+ //# sourceMappingURL=chunk-L4B4GRVS.js.map
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-U7VO6JAA.js";
11
11
  import {
12
12
  parseDgmoChartType
13
- } from "./chunk-ZDFIY6WX.js";
13
+ } from "./chunk-3PVUGECM.js";
14
14
  import {
15
15
  chartTypes
16
16
  } from "./chunk-P2PUWV3Y.js";
@@ -204,4 +204,4 @@ export {
204
204
  MONO_FAMILY,
205
205
  renderErrorCard
206
206
  };
207
- //# sourceMappingURL=chunk-5PWIV7ZF.js.map
207
+ //# sourceMappingURL=chunk-LFAQ4BLZ.js.map
@@ -27,7 +27,7 @@ import {
27
27
  } from "./chunk-6VJCURWU.js";
28
28
  import {
29
29
  serializeSvg
30
- } from "./chunk-NZ5QVASG.js";
30
+ } from "./chunk-RU2HHHYA.js";
31
31
  import {
32
32
  TITLE_FONT_SIZE,
33
33
  TITLE_FONT_WEIGHT,
@@ -481,4 +481,4 @@ export {
481
481
  renderState,
482
482
  renderStateForExport
483
483
  };
484
- //# sourceMappingURL=chunk-7QCYHZVO.js.map
484
+ //# sourceMappingURL=chunk-NQH2Q2RR.js.map
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-YYVTBZZC.js";
22
22
  import {
23
23
  serializeSvg
24
- } from "./chunk-NZ5QVASG.js";
24
+ } from "./chunk-RU2HHHYA.js";
25
25
  import {
26
26
  renderIntegratedLegend
27
27
  } from "./chunk-UKZ7K5GS.js";
@@ -871,4 +871,4 @@ export {
871
871
  renderJourneyMap,
872
872
  renderJourneyMapForExport
873
873
  };
874
- //# sourceMappingURL=chunk-PFGJ7SCM.js.map
874
+ //# sourceMappingURL=chunk-PUFWYDWP.js.map
@@ -1,12 +1,15 @@
1
+ import {
2
+ MAP_DX
3
+ } from "./chunk-EOYPX6SF.js";
1
4
  import {
2
5
  renderDataChartD3
3
- } from "./chunk-6CWNVQPW.js";
6
+ } from "./chunk-2LN5C6FH.js";
4
7
  import {
5
8
  computeQuadrantPointLabels
6
- } from "./chunk-VHO3YBTB.js";
9
+ } from "./chunk-CVVICCSB.js";
7
10
  import {
8
11
  renderTimeline
9
- } from "./chunk-3OLO2MZ6.js";
12
+ } from "./chunk-BPINSP65.js";
10
13
  import {
11
14
  ScaleContext
12
15
  } from "./chunk-YYVTBZZC.js";
@@ -21,7 +24,7 @@ import {
21
24
  renderChartTitle,
22
25
  resolveExportPalette,
23
26
  showTooltip
24
- } from "./chunk-CQ7Y3O67.js";
27
+ } from "./chunk-KHTKMVKT.js";
25
28
  import {
26
29
  legendInlineSupported
27
30
  } from "./chunk-6VJCURWU.js";
@@ -42,7 +45,7 @@ import {
42
45
  parseVenn,
43
46
  parseVisualization,
44
47
  parseWordcloud
45
- } from "./chunk-ZDFIY6WX.js";
48
+ } from "./chunk-3PVUGECM.js";
46
49
  import {
47
50
  resolveActiveTagGroup,
48
51
  tagAttrKey
@@ -56,6 +59,7 @@ import {
56
59
  themeBaseBg
57
60
  } from "./chunk-42IT4BG2.js";
58
61
  import {
62
+ emit,
59
63
  makeDgmoError
60
64
  } from "./chunk-OLMWTJVU.js";
61
65
 
@@ -1867,6 +1871,15 @@ function renderQuadrant(container, parsed, palette, isDark, onClickItem, exportD
1867
1871
  }
1868
1872
 
1869
1873
  // src/d3.ts
1874
+ async function resolveMapDataSource(source) {
1875
+ if (source === void 0) return {};
1876
+ if (typeof source !== "function") return { data: source };
1877
+ try {
1878
+ return { data: await source() };
1879
+ } catch (e) {
1880
+ return { reason: e instanceof Error ? e.message : String(e) };
1881
+ }
1882
+ }
1870
1883
  var DIAGRAM_EXPORT_HANDLERS = {
1871
1884
  org: exportOrg,
1872
1885
  sitemap: exportSitemap,
@@ -1929,13 +1942,13 @@ function resolveArcChordOverride(content, detectedType, palette) {
1929
1942
  }
1930
1943
  async function renderForExport(content, theme, palette, viewState, options) {
1931
1944
  const exportMode = options?.exportMode ?? false;
1932
- const { parseDgmoChartType } = await import("./dgmo-router-UVYAJCAF.js");
1945
+ const { parseDgmoChartType } = await import("./dgmo-router-Z5N6QLIC.js");
1933
1946
  const detectedTypeRaw = parseDgmoChartType(content);
1934
1947
  const override = resolveArcChordOverride(content, detectedTypeRaw, palette);
1935
1948
  const renderContent = override?.content ?? content;
1936
1949
  const detectedType = override?.type ?? detectedTypeRaw;
1937
1950
  if (detectedType !== null) {
1938
- const { supportsD3DataChart, renderDataChartD3: renderDataChartD32 } = await import("./charts-d3-MN6QCYKU.js");
1951
+ const { supportsD3DataChart, renderDataChartD3: renderDataChartD32 } = await import("./charts-d3-M76E4TZU.js");
1939
1952
  if (supportsD3DataChart(detectedType)) {
1940
1953
  return renderDataChartD32(renderContent, theme, palette);
1941
1954
  }
@@ -1960,7 +1973,7 @@ function ctxTagOverride(ctx) {
1960
1973
  async function exportEventLine(ctx) {
1961
1974
  const { content, theme, palette } = ctx;
1962
1975
  const { parseEventLine } = await import("./parser-OEBFJHT4.js");
1963
- const { renderEventLineForExport } = await import("./renderer-2PGIIOFN.js");
1976
+ const { renderEventLineForExport } = await import("./renderer-KKNXTTFE.js");
1964
1977
  const effectivePalette = await resolveExportPalette(theme, palette);
1965
1978
  const parsed = parseEventLine(content, effectivePalette);
1966
1979
  if (parsed.error || parsed.events.length === 0) return "";
@@ -1979,7 +1992,7 @@ async function exportEventLine(ctx) {
1979
1992
  async function exportBody(ctx) {
1980
1993
  const { content, theme, palette } = ctx;
1981
1994
  const { parseBody } = await import("./parser-JZPSIWRC.js");
1982
- const { renderBodyForExport } = await import("./renderer-6QW5OAJG.js");
1995
+ const { renderBodyForExport } = await import("./renderer-TTMBG2N6.js");
1983
1996
  const effectivePalette = await resolveExportPalette(theme, palette);
1984
1997
  const parsed = parseBody(content, effectivePalette);
1985
1998
  if (parsed.error) return "";
@@ -2024,7 +2037,7 @@ async function exportOrg(ctx) {
2024
2037
  const { parseOrg } = await import("./parser-AZZHRVJF.js");
2025
2038
  const { layoutOrg } = await import("./layout-OH4VQ3OI.js");
2026
2039
  const { collapseOrgTree } = await import("./collapse-CLPJD2RL.js");
2027
- const { renderOrg } = await import("./renderer-IG5PQXEM.js");
2040
+ const { renderOrg } = await import("./renderer-PKST5W6U.js");
2028
2041
  const isDark = ctx.isDark;
2029
2042
  const effectivePalette = await resolveExportPalette(theme, palette);
2030
2043
  const orgParsed = parseOrg(content, effectivePalette);
@@ -2073,7 +2086,7 @@ async function exportSitemap(ctx) {
2073
2086
  const { parseSitemap } = await import("./parser-3KFNCRLD.js");
2074
2087
  const { layoutSitemap } = await import("./layout-SKQMIXTG.js");
2075
2088
  const { collapseSitemapTree } = await import("./collapse-ZWUFFCK2.js");
2076
- const { renderSitemap } = await import("./renderer-AS6LLDZM.js");
2089
+ const { renderSitemap } = await import("./renderer-XDL6PRLN.js");
2077
2090
  const isDark = ctx.isDark;
2078
2091
  const effectivePalette = await resolveExportPalette(theme, palette);
2079
2092
  const sitemapParsed = parseSitemap(content, effectivePalette);
@@ -2123,7 +2136,7 @@ async function exportSitemap(ctx) {
2123
2136
  async function exportKanban(ctx) {
2124
2137
  const { content, theme, palette, viewState, exportMode } = ctx;
2125
2138
  const { parseKanban } = await import("./parser-6VNVZO5F.js");
2126
- const { renderKanban } = await import("./renderer-62FFDWMY.js");
2139
+ const { renderKanban } = await import("./renderer-5HYDLCMX.js");
2127
2140
  const effectivePalette = await resolveExportPalette(theme, palette);
2128
2141
  const kanbanParsed = parseKanban(content, effectivePalette);
2129
2142
  if (kanbanParsed.error || kanbanParsed.columns.length === 0) return "";
@@ -2156,7 +2169,7 @@ async function exportClass(ctx) {
2156
2169
  const { content, theme, palette, exportMode } = ctx;
2157
2170
  const { parseClassDiagram } = await import("./parser-5ZUEF4WE.js");
2158
2171
  const { layoutClassDiagram } = await import("./layout-W3ZBJOIK.js");
2159
- const { renderClassDiagram } = await import("./renderer-GESKWINV.js");
2172
+ const { renderClassDiagram } = await import("./renderer-K3TH5PP7.js");
2160
2173
  const effectivePalette = await resolveExportPalette(theme, palette);
2161
2174
  const classParsed = parseClassDiagram(content, effectivePalette);
2162
2175
  if (classParsed.error || classParsed.classes.length === 0) return "";
@@ -2183,7 +2196,7 @@ async function exportEr(ctx) {
2183
2196
  const { content, theme, palette, viewState, exportMode } = ctx;
2184
2197
  const { parseERDiagram } = await import("./parser-2BGDJJ2L.js");
2185
2198
  const { layoutERDiagram } = await import("./layout-54P3DAXY.js");
2186
- const { renderERDiagram } = await import("./renderer-VYMTBSF4.js");
2199
+ const { renderERDiagram } = await import("./renderer-HPQJRSON.js");
2187
2200
  const effectivePalette = await resolveExportPalette(theme, palette);
2188
2201
  const erParsed = parseERDiagram(content, effectivePalette);
2189
2202
  if (erParsed.error || erParsed.tables.length === 0) return "";
@@ -2357,7 +2370,7 @@ async function exportMindmap(ctx) {
2357
2370
  const { parseMindmap } = await import("./parser-YO2JBE52.js");
2358
2371
  const { layoutMindmap } = await import("./layout-UU4VJTOP.js");
2359
2372
  const { collapseMindmapTree } = await import("./collapse-SLINJQW6.js");
2360
- const { renderMindmap } = await import("./renderer-CXRSD26Q.js");
2373
+ const { renderMindmap } = await import("./renderer-4VDSMPYU.js");
2361
2374
  const isDark = ctx.isDark;
2362
2375
  const effectivePalette = await resolveExportPalette(theme, palette);
2363
2376
  const mmParsed = parseMindmap(content, effectivePalette);
@@ -2439,7 +2452,7 @@ async function exportC4(ctx) {
2439
2452
  layoutC4Components,
2440
2453
  layoutC4Deployment
2441
2454
  } = await import("./layout-WCOEZPOI.js");
2442
- const { renderC4Context, renderC4Containers } = await import("./renderer-XSHOMUJQ.js");
2455
+ const { renderC4Context, renderC4Containers } = await import("./renderer-726UVOKE.js");
2443
2456
  const effectivePalette = await resolveExportPalette(theme, palette);
2444
2457
  const c4Parsed = parseC4(content, effectivePalette);
2445
2458
  if (c4Parsed.error || c4Parsed.elements.length === 0) return "";
@@ -2475,7 +2488,7 @@ async function exportFlowchart(ctx) {
2475
2488
  const { content, theme, palette } = ctx;
2476
2489
  const { parseFlowchart } = await import("./flowchart-parser-T4XZRSA7.js");
2477
2490
  const { layoutGraph } = await import("./layout-QTZO6CW5.js");
2478
- const { renderFlowchart } = await import("./flowchart-renderer-XFDCX7MZ.js");
2491
+ const { renderFlowchart } = await import("./flowchart-renderer-BCVCIZHF.js");
2479
2492
  const effectivePalette = await resolveExportPalette(theme, palette);
2480
2493
  const fcParsed = parseFlowchart(content, effectivePalette);
2481
2494
  if (fcParsed.error || fcParsed.nodes.length === 0) return "";
@@ -2547,7 +2560,7 @@ async function exportPert(ctx) {
2547
2560
  const { parsePert } = await import("./parser-FTC7FZ6Z.js");
2548
2561
  const { analyzePert } = await import("./analyzer-HQUXKZ5J.js");
2549
2562
  const { layoutPert } = await import("./layout-5E2NQZNM.js");
2550
- const { renderPert, measurePertAnalysisBlock } = await import("./renderer-4RQ5PGHY.js");
2563
+ const { renderPert, measurePertAnalysisBlock } = await import("./renderer-KHVAM4IY.js");
2551
2564
  const effectivePalette = await resolveExportPalette(theme, palette);
2552
2565
  const pertParsed = parsePert(content, { palette: effectivePalette });
2553
2566
  if (pertParsed.error || pertParsed.activities.length === 0) return "";
@@ -2630,7 +2643,7 @@ async function exportState(ctx) {
2630
2643
  const { content, theme, palette, viewState } = ctx;
2631
2644
  const { parseState } = await import("./state-parser-3U4232LJ.js");
2632
2645
  const { layoutGraph } = await import("./layout-QTZO6CW5.js");
2633
- const { renderState } = await import("./state-renderer-GBHDOEXR.js");
2646
+ const { renderState } = await import("./state-renderer-MCWCZ76U.js");
2634
2647
  const { collapseStateGroups } = await import("./state-collapse-HCGD6IVJ.js");
2635
2648
  const effectivePalette = await resolveExportPalette(theme, palette);
2636
2649
  const stateParsed = parseState(content, effectivePalette);
@@ -2689,7 +2702,7 @@ async function exportTechRadar(ctx) {
2689
2702
  async function exportJourneyMap(ctx) {
2690
2703
  const { content, theme, palette, exportMode } = ctx;
2691
2704
  const { parseJourneyMap } = await import("./parser-56746U6W.js");
2692
- const { renderJourneyMap } = await import("./renderer-63MLWS6L.js");
2705
+ const { renderJourneyMap } = await import("./renderer-XIJO7DYS.js");
2693
2706
  const { layoutJourneyMap } = await import("./layout-H4H4OFE4.js");
2694
2707
  const effectivePalette = await resolveExportPalette(theme, palette);
2695
2708
  const jmParsed = parseJourneyMap(content, effectivePalette);
@@ -2730,19 +2743,19 @@ async function exportCycle(ctx) {
2730
2743
  async function exportMap(ctx) {
2731
2744
  const { content, theme, palette, options } = ctx;
2732
2745
  const { parseMap } = await import("./parser-UKQC7N6K.js");
2733
- const { resolveMap } = await import("./resolver-W3WKLWDP.js");
2734
- const { renderMapForExport } = await import("./renderer-R6OKKSVR.js");
2735
- const { mapExportDimensions } = await import("./dimensions-QCPOPPKE.js");
2746
+ const { resolveMap } = await import("./resolver-B3TXWNWF.js");
2747
+ const { renderMapForExport } = await import("./renderer-Q2YHQQSN.js");
2748
+ const { mapExportDimensions } = await import("./dimensions-ES6O2T4H.js");
2736
2749
  const effectivePalette = await resolveExportPalette(theme, palette);
2737
2750
  const mapParsed = parseMap(content, effectivePalette);
2738
- let mapData = options?.mapData;
2751
+ const { data: mapData, reason } = await resolveMapDataSource(
2752
+ options?.mapData
2753
+ );
2739
2754
  if (!mapData) {
2740
- const { loadMapData } = await import("./load-data-EHDDZ5ZS.js");
2741
- try {
2742
- mapData = await loadMapData();
2743
- } catch {
2744
- return "";
2745
- }
2755
+ options?.onMapResolverDiagnostics?.([
2756
+ emit(MAP_DX.DATA_NOT_SUPPLIED, 1, reason !== void 0 ? { reason } : {})
2757
+ ]);
2758
+ return "";
2746
2759
  }
2747
2760
  const mapResolved = resolveMap(mapParsed, mapData);
2748
2761
  options?.onMapResolverDiagnostics?.(mapResolved.diagnostics);
@@ -2826,7 +2839,7 @@ async function exportTreemap(ctx) {
2826
2839
  async function exportLiveLink(ctx) {
2827
2840
  const { content, theme, palette } = ctx;
2828
2841
  const { parseLiveLink } = await import("./parser-KSIYWKYF.js");
2829
- const { renderLiveLinkCard } = await import("./renderer-IYMA5W7X.js");
2842
+ const { renderLiveLinkCard } = await import("./renderer-A5GFW2XH.js");
2830
2843
  const effectivePalette = await resolveExportPalette(theme, palette);
2831
2844
  return renderLiveLinkCard(parseLiveLink(content), effectivePalette, theme);
2832
2845
  }
@@ -3700,4 +3713,4 @@ export {
3700
3713
  renderForExport,
3701
3714
  render
3702
3715
  };
3703
- //# sourceMappingURL=chunk-BSJIPMPG.js.map
3716
+ //# sourceMappingURL=chunk-QDPMTFB4.js.map
@@ -0,0 +1,23 @@
1
+ // src/utils/svg-serialize.ts
2
+ var BARE_AMPERSAND = /&(?![a-zA-Z][a-zA-Z0-9]*;|#\d+;|#[xX][0-9a-fA-F]+;)/g;
3
+ function escapeAttributeMarkupChars(svg) {
4
+ return svg.replace(
5
+ // ` name="value"` / ` xlink:href="value"` — attribute names in SVG may carry
6
+ // a namespace prefix, a dot, or a dash.
7
+ /(\s[\w:.-]+=")([^"]*)"/g,
8
+ (match, prefix, value) => {
9
+ if (!value.includes("<") && !value.includes(">") && !value.includes("&")) {
10
+ return match;
11
+ }
12
+ return `${prefix}${value.replace(BARE_AMPERSAND, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")}"`;
13
+ }
14
+ );
15
+ }
16
+ function serializeSvg(svgEl) {
17
+ return escapeAttributeMarkupChars(svgEl.outerHTML);
18
+ }
19
+
20
+ export {
21
+ serializeSvg
22
+ };
23
+ //# sourceMappingURL=chunk-RU2HHHYA.js.map
@@ -17,7 +17,7 @@ import {
17
17
  } from "./chunk-3CIOJ5YJ.js";
18
18
  import {
19
19
  serializeSvg
20
- } from "./chunk-NZ5QVASG.js";
20
+ } from "./chunk-RU2HHHYA.js";
21
21
  import {
22
22
  TITLE_FONT_SIZE,
23
23
  TITLE_FONT_WEIGHT
@@ -1039,4 +1039,4 @@ export {
1039
1039
  renderC4Deployment,
1040
1040
  renderC4DeploymentForExport
1041
1041
  };
1042
- //# sourceMappingURL=chunk-SMHTYVMK.js.map
1042
+ //# sourceMappingURL=chunk-RZRMSNO7.js.map
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-6VJCURWU.js";
23
23
  import {
24
24
  serializeSvg
25
- } from "./chunk-NZ5QVASG.js";
25
+ } from "./chunk-RU2HHHYA.js";
26
26
  import {
27
27
  CAPTION_BOX_PADDING_X,
28
28
  CAPTION_BOX_PADDING_Y,
@@ -1868,4 +1868,4 @@ export {
1868
1868
  measurePertAnalysisBlock,
1869
1869
  renderPertAnalysisBlock
1870
1870
  };
1871
- //# sourceMappingURL=chunk-HJ6TMHQG.js.map
1871
+ //# sourceMappingURL=chunk-SV7F363F.js.map
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  extractExportSvg,
13
13
  runInExportContainer
14
- } from "./chunk-L43KTQTW.js";
14
+ } from "./chunk-L26ZAPNJ.js";
15
15
  import {
16
16
  EDGE_STROKE_WIDTH,
17
17
  NODE_STROKE_WIDTH
@@ -448,4 +448,4 @@ export {
448
448
  renderClassDiagram,
449
449
  renderClassDiagramForExport
450
450
  };
451
- //# sourceMappingURL=chunk-YJCILMEA.js.map
451
+ //# sourceMappingURL=chunk-U22TKD3L.js.map
@@ -6,7 +6,7 @@ import {
6
6
  mapLegendConfig,
7
7
  mapLegendGroups,
8
8
  parsePathRings
9
- } from "./chunk-OPBZYISB.js";
9
+ } from "./chunk-37EHGTQ2.js";
10
10
  import {
11
11
  TITLE_FONT_SIZE,
12
12
  TITLE_FONT_WEIGHT,
@@ -781,4 +781,4 @@ export {
781
781
  renderMap,
782
782
  renderMapForExport
783
783
  };
784
- //# sourceMappingURL=chunk-2WPLOS4Q.js.map
784
+ //# sourceMappingURL=chunk-USHDV2AF.js.map
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-4QV26TEG.js";
10
10
  import {
11
11
  MAP_DX
12
- } from "./chunk-4B5YISOR.js";
12
+ } from "./chunk-EOYPX6SF.js";
13
13
  import {
14
14
  formatOffsetLabel,
15
15
  isValidZone,
@@ -775,4 +775,4 @@ export {
775
775
  isSubNationalUsExtent,
776
776
  resolveMap
777
777
  };
778
- //# sourceMappingURL=chunk-DNSEG6P2.js.map
778
+ //# sourceMappingURL=chunk-WMHHNK44.js.map