@diagrammo/dgmo 0.7.2 → 0.7.3
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/cli.cjs +78 -78
- package/dist/index.cjs +25 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/d3.ts +2 -0
- package/src/initiative-status/renderer.ts +41 -9
package/dist/index.cjs
CHANGED
|
@@ -13189,6 +13189,9 @@ function renderInitiativeStatus(container, parsed, layout, palette, isDark, opti
|
|
|
13189
13189
|
const pillH = LEGEND_HEIGHT - (isActive ? LEGEND_CAPSULE_PAD * 2 : 0);
|
|
13190
13190
|
const groupW = isActive ? lg.width : pillW;
|
|
13191
13191
|
const gEl = legendRow.append("g").attr("transform", `translate(${cursorX}, 0)`).attr("class", "is-legend-group").attr("data-legend-group", lg.key).style("cursor", "pointer");
|
|
13192
|
+
if (!isActive) {
|
|
13193
|
+
gEl.attr("data-export-ignore", "true");
|
|
13194
|
+
}
|
|
13192
13195
|
if (isActive) {
|
|
13193
13196
|
gEl.append("rect").attr("width", groupW).attr("height", LEGEND_HEIGHT).attr("rx", LEGEND_HEIGHT / 2).attr("fill", groupBg);
|
|
13194
13197
|
}
|
|
@@ -13201,17 +13204,32 @@ function renderInitiativeStatus(container, parsed, layout, palette, isDark, opti
|
|
|
13201
13204
|
gEl.append("text").attr("x", pillXOff + pillW / 2).attr("y", LEGEND_HEIGHT / 2 + LEGEND_PILL_FONT_SIZE / 2 - 2).attr("font-size", LEGEND_PILL_FONT_SIZE).attr("font-weight", "500").attr("fill", isActive ? palette.text : palette.textMuted).attr("text-anchor", "middle").attr("font-family", FONT_FAMILY).text(lg.name);
|
|
13202
13205
|
if (isActive) {
|
|
13203
13206
|
const hiddenSet = !lg.isStatus ? hiddenTagValues?.get(lg.key) : void 0;
|
|
13204
|
-
|
|
13207
|
+
const entryStartX = pillXOff + pillW + 4;
|
|
13208
|
+
const entryData = [];
|
|
13209
|
+
let estimatedX = entryStartX;
|
|
13205
13210
|
for (const entry of lg.entries) {
|
|
13206
13211
|
const isHidden = hiddenSet?.has(entry.value) ?? false;
|
|
13207
|
-
const
|
|
13212
|
+
const estimatedTextW = entry.label.length * LEGEND_ENTRY_FONT_W;
|
|
13213
|
+
const entryG = gEl.append("g").attr("data-legend-entry", entry.value).attr("transform", `translate(${estimatedX}, 0)`).style("cursor", "pointer");
|
|
13214
|
+
const entryW = LEGEND_DOT_R * 2 + LEGEND_ENTRY_DOT_GAP + estimatedTextW + LEGEND_ENTRY_TRAIL;
|
|
13215
|
+
entryG.append("rect").attr("x", -2).attr("y", 0).attr("width", entryW + 4).attr("height", LEGEND_HEIGHT).attr("fill", "transparent");
|
|
13208
13216
|
if (isHidden) {
|
|
13209
|
-
entryG.append("circle").attr("cx",
|
|
13217
|
+
entryG.append("circle").attr("cx", LEGEND_DOT_R).attr("cy", LEGEND_HEIGHT / 2).attr("r", LEGEND_DOT_R).attr("fill", "none").attr("stroke", entry.color).attr("stroke-width", 1.2).attr("opacity", 0.5);
|
|
13210
13218
|
} else {
|
|
13211
|
-
entryG.append("circle").attr("cx",
|
|
13219
|
+
entryG.append("circle").attr("cx", LEGEND_DOT_R).attr("cy", LEGEND_HEIGHT / 2).attr("r", LEGEND_DOT_R).attr("fill", entry.color);
|
|
13212
13220
|
}
|
|
13213
|
-
entryG.append("text").attr("x",
|
|
13214
|
-
|
|
13221
|
+
const textEl = entryG.append("text").attr("x", LEGEND_DOT_R * 2 + LEGEND_ENTRY_DOT_GAP).attr("y", LEGEND_HEIGHT / 2 + LEGEND_ENTRY_FONT_SIZE / 2 - 1).attr("font-size", LEGEND_ENTRY_FONT_SIZE).attr("fill", palette.textMuted).attr("font-family", FONT_FAMILY).attr("opacity", isHidden ? 0.4 : 1).attr("text-decoration", isHidden ? "line-through" : "none").text(entry.label);
|
|
13222
|
+
entryData.push({ g: entryG, textEl: textEl.node(), estimatedW: estimatedTextW });
|
|
13223
|
+
estimatedX += LEGEND_DOT_R * 2 + LEGEND_ENTRY_DOT_GAP + estimatedTextW + LEGEND_ENTRY_TRAIL;
|
|
13224
|
+
}
|
|
13225
|
+
let reflowX = entryStartX;
|
|
13226
|
+
for (const ed of entryData) {
|
|
13227
|
+
const measuredW = ed.textEl.getComputedTextLength?.() ?? 0;
|
|
13228
|
+
const textW = measuredW > 0 ? measuredW : ed.estimatedW;
|
|
13229
|
+
ed.g.attr("transform", `translate(${reflowX}, 0)`);
|
|
13230
|
+
const actualEntryW = LEGEND_DOT_R * 2 + LEGEND_ENTRY_DOT_GAP + textW + LEGEND_ENTRY_TRAIL;
|
|
13231
|
+
ed.g.select("rect").attr("width", actualEntryW + 4);
|
|
13232
|
+
reflowX += actualEntryW;
|
|
13215
13233
|
}
|
|
13216
13234
|
}
|
|
13217
13235
|
cursorX += groupW + LEGEND_GROUP_GAP;
|
|
@@ -25454,6 +25472,7 @@ function finalizeSvgExport(container, theme, palette, options) {
|
|
|
25454
25472
|
}
|
|
25455
25473
|
svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
25456
25474
|
svgEl.style.fontFamily = FONT_FAMILY;
|
|
25475
|
+
svgEl.querySelectorAll("[data-export-ignore]").forEach((el) => el.remove());
|
|
25457
25476
|
const svgHtml = svgEl.outerHTML;
|
|
25458
25477
|
document.body.removeChild(container);
|
|
25459
25478
|
if (options?.branding !== false) {
|