@diagrammo/dgmo 0.48.0 → 0.48.2

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 (35) hide show
  1. package/dist/advanced.js +12 -12
  2. package/dist/auto.css +11 -5
  3. package/dist/auto.js +94 -88
  4. package/dist/auto.mjs +101 -22
  5. package/dist/block.css +11 -5
  6. package/dist/block.js +15 -9
  7. package/dist/{chunk-FNB3PNGF.js → chunk-7DTWEFUE.js} +3 -3
  8. package/dist/{chunk-2DXMZRWJ.js → chunk-B65G5DNL.js} +8 -1
  9. package/dist/{chunk-RZCF2VVM.js → chunk-B7JUCQUA.js} +3 -1
  10. package/dist/{chunk-DU7W62N5.js → chunk-FANX6UJR.js} +3 -3
  11. package/dist/{chunk-6FZYCKXB.js → chunk-HSH73DP6.js} +2 -2
  12. package/dist/{chunk-P4RH4OSP.js → chunk-ILKORZ3H.js} +2 -2
  13. package/dist/{chunk-Y5QGVTVC.js → chunk-JTSMEYIZ.js} +7 -3
  14. package/dist/{chunk-RCERWOJR.js → chunk-ODZVHU3R.js} +1 -2
  15. package/dist/{chunk-IH6ZMVQ5.js → chunk-PZMETGLY.js} +30 -12
  16. package/dist/{chunk-DZAQBW35.js → chunk-SGZYXELT.js} +3 -7
  17. package/dist/{chunk-CUVHQHZ7.js → chunk-THXCFRTU.js} +3 -3
  18. package/dist/{chunk-A4VFQH5G.js → chunk-YGJZWZTY.js} +51 -6
  19. package/dist/{chunk-EMS2SK26.js → chunk-ZBWMSD5N.js} +3 -1
  20. package/dist/cli.cjs +110 -110
  21. package/dist/{dgmo-router-DZCIDUO5.js → dgmo-router-X35VLZLM.js} +3 -3
  22. package/dist/element.js +95 -89
  23. package/dist/element.mjs +101 -22
  24. package/dist/{flowchart-renderer-ZAEOL4DX.js → flowchart-renderer-SNDSII4D.js} +2 -2
  25. package/dist/index.d.ts +4 -2
  26. package/dist/index.js +4 -4
  27. package/dist/{parser-FUSKFGZN.js → parser-2EWECDSA.js} +2 -2
  28. package/dist/{renderer-UWA5XS74.js → renderer-4JHRUBE6.js} +3 -3
  29. package/dist/{renderer-WZRREQ2P.js → renderer-5MYBMBYO.js} +2 -2
  30. package/dist/{renderer-TOCOVLHS.js → renderer-B2OMQIQG.js} +3 -3
  31. package/dist/{renderer-2XQQQ6QR.js → renderer-N43WR5GV.js} +3 -3
  32. package/dist/{renderer-ZTR3DER3.js → renderer-UV6MI64M.js} +2 -2
  33. package/dist/{renderer-T7YKC5VP.js → renderer-ZRNG54CW.js} +3 -3
  34. package/dist/{state-renderer-RFYHSP4K.js → state-renderer-B4DQBM6M.js} +2 -2
  35. package/package.json +5 -2
@@ -39,7 +39,7 @@ import {
39
39
  parseVenn,
40
40
  parseVisualization,
41
41
  parseWordcloud
42
- } from "./chunk-6FZYCKXB.js";
42
+ } from "./chunk-HSH73DP6.js";
43
43
  import {
44
44
  getPalette
45
45
  } from "./chunk-R3XI2VC7.js";
@@ -2285,7 +2285,7 @@ function resolveArcChordOverride(content, detectedType, palette) {
2285
2285
  }
2286
2286
  async function renderForExport(content, theme, palette, viewState, options) {
2287
2287
  const exportMode = options?.exportMode ?? false;
2288
- const { parseDgmoChartType } = await import("./dgmo-router-DZCIDUO5.js");
2288
+ const { parseDgmoChartType } = await import("./dgmo-router-X35VLZLM.js");
2289
2289
  const detectedTypeRaw = parseDgmoChartType(content);
2290
2290
  const override = resolveArcChordOverride(content, detectedTypeRaw, palette);
2291
2291
  const renderContent = override?.content ?? content;
@@ -2359,7 +2359,7 @@ async function exportOrg(ctx) {
2359
2359
  const { parseOrg } = await import("./parser-6BTRLKRZ.js");
2360
2360
  const { layoutOrg } = await import("./layout-OB3RI63S.js");
2361
2361
  const { collapseOrgTree } = await import("./collapse-CLPJD2RL.js");
2362
- const { renderOrg } = await import("./renderer-T7YKC5VP.js");
2362
+ const { renderOrg } = await import("./renderer-ZRNG54CW.js");
2363
2363
  const isDark = ctx.isDark;
2364
2364
  const effectivePalette = await resolveExportPalette(theme, palette);
2365
2365
  const orgParsed = parseOrg(content, effectivePalette);
@@ -2486,7 +2486,7 @@ async function exportClass(ctx) {
2486
2486
  const { content, theme, palette, exportMode } = ctx;
2487
2487
  const { parseClassDiagram } = await import("./parser-NRAI6O25.js");
2488
2488
  const { layoutClassDiagram } = await import("./layout-46N4JJYK.js");
2489
- const { renderClassDiagram } = await import("./renderer-TOCOVLHS.js");
2489
+ const { renderClassDiagram } = await import("./renderer-B2OMQIQG.js");
2490
2490
  const effectivePalette = await resolveExportPalette(theme, palette);
2491
2491
  const classParsed = parseClassDiagram(content, effectivePalette);
2492
2492
  if (classParsed.error || classParsed.classes.length === 0) return "";
@@ -2621,7 +2621,7 @@ async function exportMindmap(ctx) {
2621
2621
  const { parseMindmap } = await import("./parser-N5O4IHUN.js");
2622
2622
  const { layoutMindmap } = await import("./layout-UM5F4DJB.js");
2623
2623
  const { collapseMindmapTree } = await import("./collapse-SLINJQW6.js");
2624
- const { renderMindmap } = await import("./renderer-2XQQQ6QR.js");
2624
+ const { renderMindmap } = await import("./renderer-N43WR5GV.js");
2625
2625
  const isDark = ctx.isDark;
2626
2626
  const effectivePalette = await resolveExportPalette(theme, palette);
2627
2627
  const mmParsed = parseMindmap(content, effectivePalette);
@@ -2696,14 +2696,14 @@ async function exportWireframe(ctx) {
2696
2696
  }
2697
2697
  async function exportC4(ctx) {
2698
2698
  const { content, theme, palette, viewState, exportMode } = ctx;
2699
- const { parseC4 } = await import("./parser-FUSKFGZN.js");
2699
+ const { parseC4 } = await import("./parser-2EWECDSA.js");
2700
2700
  const {
2701
2701
  layoutC4Context,
2702
2702
  layoutC4Containers,
2703
2703
  layoutC4Components,
2704
2704
  layoutC4Deployment
2705
2705
  } = await import("./layout-5RA6QWR6.js");
2706
- const { renderC4Context, renderC4Containers } = await import("./renderer-UWA5XS74.js");
2706
+ const { renderC4Context, renderC4Containers } = await import("./renderer-4JHRUBE6.js");
2707
2707
  const effectivePalette = await resolveExportPalette(theme, palette);
2708
2708
  const c4Parsed = parseC4(content, effectivePalette);
2709
2709
  if (c4Parsed.error || c4Parsed.elements.length === 0) return "";
@@ -2739,7 +2739,7 @@ async function exportFlowchart(ctx) {
2739
2739
  const { content, theme, palette } = ctx;
2740
2740
  const { parseFlowchart } = await import("./flowchart-parser-ZNSKIBVR.js");
2741
2741
  const { layoutGraph } = await import("./layout-HWDSRX5E.js");
2742
- const { renderFlowchart } = await import("./flowchart-renderer-ZAEOL4DX.js");
2742
+ const { renderFlowchart } = await import("./flowchart-renderer-SNDSII4D.js");
2743
2743
  const effectivePalette = await resolveExportPalette(theme, palette);
2744
2744
  const fcParsed = parseFlowchart(content, effectivePalette);
2745
2745
  if (fcParsed.error || fcParsed.nodes.length === 0) return "";
@@ -2894,7 +2894,7 @@ async function exportState(ctx) {
2894
2894
  const { content, theme, palette, viewState } = ctx;
2895
2895
  const { parseState } = await import("./state-parser-Z2V23ATR.js");
2896
2896
  const { layoutGraph } = await import("./layout-HWDSRX5E.js");
2897
- const { renderState } = await import("./state-renderer-RFYHSP4K.js");
2897
+ const { renderState } = await import("./state-renderer-B4DQBM6M.js");
2898
2898
  const { collapseStateGroups } = await import("./state-collapse-HCGD6IVJ.js");
2899
2899
  const effectivePalette = await resolveExportPalette(theme, palette);
2900
2900
  const stateParsed = parseState(content, effectivePalette);
@@ -3046,7 +3046,7 @@ async function exportPyramid(ctx) {
3046
3046
  async function exportRing(ctx) {
3047
3047
  const { content, theme, palette } = ctx;
3048
3048
  const { parseRing } = await import("./parser-O5J4VBII.js");
3049
- const { renderRingForExport } = await import("./renderer-ZTR3DER3.js");
3049
+ const { renderRingForExport } = await import("./renderer-UV6MI64M.js");
3050
3050
  const effectivePalette = await resolveExportPalette(theme, palette);
3051
3051
  const ringParsed = parseRing(content);
3052
3052
  if (ringParsed.error || ringParsed.layers.length === 0) return "";
@@ -3103,7 +3103,7 @@ async function exportBlock(ctx) {
3103
3103
  async function exportRaci(ctx) {
3104
3104
  const { content, theme, palette } = ctx;
3105
3105
  const { parseRaci } = await import("./parser-Y6WTBU76.js");
3106
- const { renderRaciForExport } = await import("./renderer-WZRREQ2P.js");
3106
+ const { renderRaciForExport } = await import("./renderer-5MYBMBYO.js");
3107
3107
  const effectivePalette = await resolveExportPalette(theme, palette);
3108
3108
  const raciParsed = parseRaci(content, effectivePalette);
3109
3109
  if (raciParsed.error) return "";
@@ -3363,34 +3363,50 @@ function buildHoverCss(spec, derived = {}, emphasisOverride) {
3363
3363
  return parts.join("");
3364
3364
  }
3365
3365
  var HOVER_SPECS = {
3366
+ // Data-chart family (`.dgmo-datum`): `dim` at 0.18 to MIRROR the app's live
3367
+ // hover (charts-d3/interactions.ts `.dgmo-dim{opacity:.18}` — hover a mark →
3368
+ // every other emph-key drops out). `lift` (saturate/brightness) read as
3369
+ // "nothing happened" on muted fills. Safe to dim: these export renderers set
3370
+ // NO inline `style="opacity"` on datums (only presentation `*-opacity` attrs,
3371
+ // which a `<style>` rule outranks), so no RED-2 inline-defeat.
3366
3372
  pie: {
3367
3373
  markSelector: ".dgmo-datum",
3368
3374
  strategy: "enumerated",
3369
3375
  groupAttr: "data-emph-key",
3376
+ emphasis: "dim",
3377
+ dimOpacity: 0.18,
3370
3378
  legend: true
3371
3379
  },
3372
3380
  bar: {
3373
3381
  markSelector: ".dgmo-datum",
3374
3382
  strategy: "enumerated",
3375
3383
  groupAttr: "data-emph-key",
3384
+ emphasis: "dim",
3385
+ dimOpacity: 0.18,
3376
3386
  legend: true
3377
3387
  },
3378
3388
  funnel: {
3379
3389
  markSelector: ".dgmo-datum",
3380
3390
  strategy: "enumerated",
3381
3391
  groupAttr: "data-emph-key",
3392
+ emphasis: "dim",
3393
+ dimOpacity: 0.18,
3382
3394
  legend: true
3383
3395
  },
3384
3396
  heatmap: {
3385
3397
  markSelector: ".dgmo-datum",
3386
3398
  strategy: "enumerated",
3387
3399
  groupAttr: "data-emph-key",
3400
+ emphasis: "dim",
3401
+ dimOpacity: 0.18,
3388
3402
  legend: true
3389
3403
  },
3390
3404
  "polar-area": {
3391
3405
  markSelector: ".dgmo-datum",
3392
3406
  strategy: "enumerated",
3393
3407
  groupAttr: "data-emph-key",
3408
+ emphasis: "dim",
3409
+ dimOpacity: 0.18,
3394
3410
  legend: true
3395
3411
  },
3396
3412
  // ── CROSS-FREE diagram charts — FIXED-attr keys, DOM-verified (Task 3) ──
@@ -3564,6 +3580,8 @@ var HOVER_SPECS = {
3564
3580
  markSelector: ".dgmo-datum",
3565
3581
  strategy: "enumerated",
3566
3582
  groupAttr: "data-category",
3583
+ emphasis: "dim",
3584
+ dimOpacity: 0.18,
3567
3585
  legend: true
3568
3586
  },
3569
3587
  quadrant: {
@@ -3947,4 +3965,4 @@ export {
3947
3965
  encodeDiagramUrl,
3948
3966
  decodeDiagramUrl
3949
3967
  };
3950
- //# sourceMappingURL=chunk-IH6ZMVQ5.js.map
3968
+ //# sourceMappingURL=chunk-PZMETGLY.js.map
@@ -259,7 +259,7 @@ function renderRaci(container, parsed, palette, isDark, handlers, exportDims) {
259
259
  const colBottomY = cursorY + sColumnBottomPad;
260
260
  const totalHeight = colBottomY + sVMargin;
261
261
  const svgHeight = exportDims ? totalHeight : Math.max(height, totalHeight);
262
- const svg = d3Selection.select(container).append("svg").attr("xmlns", "http://www.w3.org/2000/svg").attr("width", width).attr("height", svgHeight).attr("viewBox", `0 0 ${width} ${svgHeight}`).attr("preserveAspectRatio", "xMidYMin meet").attr("font-family", FONT_FAMILY).style("background", "transparent");
262
+ const svg = d3Selection.select(container).append("svg").attr("xmlns", "http://www.w3.org/2000/svg").attr("width", width).attr("height", svgHeight).attr("viewBox", `0 0 ${width} ${svgHeight}`).attr("preserveAspectRatio", "xMidYMin meet").attr("font-family", FONT_FAMILY);
263
263
  if (ctx.isBelowFloor) {
264
264
  svg.attr("width", "100%");
265
265
  }
@@ -338,11 +338,7 @@ function renderRaci(container, parsed, palette, isDark, handlers, exportDims) {
338
338
  const cw = roleColW - 2 * sColumnInset;
339
339
  const roleColor = parsed.roleColors[i] ?? autoAccent(i, palette);
340
340
  const bodyFill = mix(roleColor, themeBaseBg(palette, isDark), 16);
341
- const headerFill = mix(
342
- roleColor,
343
- themeBaseBg(palette, isDark),
344
- 30
345
- );
341
+ const headerFill = mix(roleColor, themeBaseBg(palette, isDark), 30);
346
342
  const colG = columnsG.append("g").attr("class", "raci-column").attr("data-role-id", roleId);
347
343
  colG.append("rect").attr("class", "raci-column-body").attr("x", cx).attr("y", headerY).attr("width", cw).attr("height", colTotalHeight).attr("rx", sColumnRadius).attr("fill", bodyFill);
348
344
  colG.append("path").attr("class", "raci-column-header").attr(
@@ -748,4 +744,4 @@ export {
748
744
  renderRaci,
749
745
  renderRaciForExport
750
746
  };
751
- //# sourceMappingURL=chunk-DZAQBW35.js.map
747
+ //# sourceMappingURL=chunk-SGZYXELT.js.map
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  extractExportSvg,
10
10
  runInExportContainer
11
- } from "./chunk-Y5QGVTVC.js";
11
+ } from "./chunk-JTSMEYIZ.js";
12
12
  import {
13
13
  COLLAPSE_BAR_HEIGHT,
14
14
  EDGE_STROKE_WIDTH,
@@ -380,7 +380,7 @@ function renderMindmapForExport(content, theme, palette) {
380
380
  void 0,
381
381
  hideDescriptions
382
382
  );
383
- return extractExportSvg(container, theme);
383
+ return extractExportSvg(container, theme, palette);
384
384
  });
385
385
  }
386
386
 
@@ -388,4 +388,4 @@ export {
388
388
  renderMindmap,
389
389
  renderMindmapForExport
390
390
  };
391
- //# sourceMappingURL=chunk-CUVHQHZ7.js.map
391
+ //# sourceMappingURL=chunk-THXCFRTU.js.map
@@ -16,7 +16,8 @@ import {
16
16
  FONT_FAMILY
17
17
  } from "./chunk-6KFWC4CO.js";
18
18
  import {
19
- CHAR_WIDTH_RATIO
19
+ CHAR_WIDTH_RATIO,
20
+ measureText
20
21
  } from "./chunk-WCT3NYCV.js";
21
22
  import {
22
23
  contrastText,
@@ -127,20 +128,35 @@ function renderRing(container, parsed, palette, isDark, onClickItem, exportDims)
127
128
  }
128
129
  if (inBandLabelsVisible) {
129
130
  const labelsG = svg.append("g").attr("class", "ring-labels");
131
+ const labelDefs = labelsG.append("defs");
132
+ let ringLabelSeq = 0;
130
133
  for (let i = 0; i < N; i++) {
131
134
  const layer = parsed.layers[i];
132
135
  const fill = layerFills[i];
133
136
  const isInnermost = i === 0;
134
- const labelY = isInnermost ? cy : cy - (i + 0.5) * thickness;
135
- const fittedFont = labelFont;
136
137
  const textColor = contrastText(
137
138
  fill,
138
139
  palette.textOnFillLight,
139
140
  palette.textOnFillDark
140
141
  );
141
142
  const labelG = labelsG.append("g").attr("class", "ring-label-group").attr("data-line-number", layer.lineNumber);
142
- const label = labelG.append("text").attr("class", "ring-label").attr("x", cx).attr("y", labelY).attr("dy", "0.35em").attr("text-anchor", "middle").attr("fill", textColor).attr("font-family", FONT_FAMILY).attr("font-size", fittedFont).attr("font-weight", 600).style("pointer-events", "none");
143
- renderInlineText(label, layer.label, palette, fittedFont);
143
+ if (isInnermost) {
144
+ const label = labelG.append("text").attr("class", "ring-label").attr("x", cx).attr("y", cy).attr("dy", "0.35em").attr("text-anchor", "middle").attr("fill", textColor).attr("font-family", FONT_FAMILY).attr("font-size", labelFont).attr("font-weight", 600).style("pointer-events", "none");
145
+ renderInlineText(label, layer.label, palette, labelFont);
146
+ continue;
147
+ }
148
+ drawRingCurvedLabel(
149
+ labelG,
150
+ labelDefs,
151
+ `dgmo-ring-lbl-${ringLabelSeq++}`,
152
+ layer.label,
153
+ cx,
154
+ cy,
155
+ (i + 0.5) * thickness,
156
+ labelFont,
157
+ textColor,
158
+ palette
159
+ );
144
160
  }
145
161
  }
146
162
  if (hasAnyDescription || !inBandLabelsVisible) {
@@ -160,6 +176,35 @@ function renderRing(container, parsed, palette, isDark, onClickItem, exportDims)
160
176
  });
161
177
  }
162
178
  }
179
+ var MAX_LABEL_ARC = 1.6 * Math.PI;
180
+ function drawRingCurvedLabel(labelG, defs, pathId, text, cx, cy, rMid, labelFont, textColor, palette) {
181
+ const PAD = 1.18;
182
+ let fs = labelFont;
183
+ let rPath = rMid - fs * 0.32;
184
+ const maxLen = MAX_LABEL_ARC * rPath;
185
+ const wPadded = measureText(text, labelFont) * PAD;
186
+ if (wPadded > maxLen) {
187
+ fs = Math.max(LABEL_FONT_MIN, Math.floor(labelFont * maxLen / wPadded));
188
+ rPath = rMid - fs * 0.32;
189
+ }
190
+ const arcLen = measureText(text, fs) * PAD;
191
+ const halfAngle = Math.min(arcLen / (2 * rPath), MAX_LABEL_ARC / 2);
192
+ const largeArc = halfAngle * 2 > Math.PI ? 1 : 0;
193
+ const p0x = cx - Math.sin(halfAngle) * rPath;
194
+ const p0y = cy - Math.cos(halfAngle) * rPath;
195
+ const p1x = cx + Math.sin(halfAngle) * rPath;
196
+ const p1y = cy - Math.cos(halfAngle) * rPath;
197
+ const d = `M ${p0x.toFixed(2)} ${p0y.toFixed(2)} A ${rPath.toFixed(2)} ${rPath.toFixed(2)} 0 ${largeArc} 1 ${p1x.toFixed(2)} ${p1y.toFixed(2)}`;
198
+ defs.append("path").attr("id", pathId).attr("d", d);
199
+ const label = labelG.append("text").attr("class", "ring-label").attr("fill", textColor).attr("font-family", FONT_FAMILY).attr("font-size", fs).attr("font-weight", 600).style("pointer-events", "none");
200
+ const textPath = label.append("textPath").attr("href", `#${pathId}`).attr("startOffset", "50%").attr("text-anchor", "middle");
201
+ renderInlineText(
202
+ textPath,
203
+ text,
204
+ palette,
205
+ fs
206
+ );
207
+ }
163
208
  function renderRingForExport(container, parsed, palette, isDark, exportDims) {
164
209
  renderRing(container, parsed, palette, isDark, void 0, exportDims);
165
210
  }
@@ -248,4 +293,4 @@ export {
248
293
  renderRing,
249
294
  renderRingForExport
250
295
  };
251
- //# sourceMappingURL=chunk-A4VFQH5G.js.map
296
+ //# sourceMappingURL=chunk-YGJZWZTY.js.map
@@ -360,6 +360,8 @@ function renderStateForExport(content, theme, palette) {
360
360
  if (!svgEl) return "";
361
361
  if (theme === "transparent") {
362
362
  svgEl.style.background = "none";
363
+ } else if (!svgEl.style.background) {
364
+ svgEl.style.background = palette.bg;
363
365
  }
364
366
  svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
365
367
  svgEl.style.fontFamily = FONT_FAMILY;
@@ -373,4 +375,4 @@ export {
373
375
  renderState,
374
376
  renderStateForExport
375
377
  };
376
- //# sourceMappingURL=chunk-EMS2SK26.js.map
378
+ //# sourceMappingURL=chunk-ZBWMSD5N.js.map