@diagrammo/dgmo 0.1.3 → 0.1.5
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 +40 -11
- package/dist/index.cjs +36 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cli.ts +6 -0
- package/src/d3.ts +6 -4
- package/src/echarts.ts +2 -1
- package/src/fonts.ts +2 -0
- package/src/sequence/renderer.ts +23 -8
package/dist/cli.cjs
CHANGED
|
@@ -30,6 +30,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
mod
|
|
31
31
|
));
|
|
32
32
|
|
|
33
|
+
// src/fonts.ts
|
|
34
|
+
var FONT_FAMILY, DEFAULT_FONT_NAME;
|
|
35
|
+
var init_fonts = __esm({
|
|
36
|
+
"src/fonts.ts"() {
|
|
37
|
+
"use strict";
|
|
38
|
+
FONT_FAMILY = "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif";
|
|
39
|
+
DEFAULT_FONT_NAME = "Helvetica";
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
33
43
|
// src/colors.ts
|
|
34
44
|
function resolveColor(color, palette) {
|
|
35
45
|
const lower = color.toLowerCase();
|
|
@@ -1627,6 +1637,16 @@ __export(renderer_exports, {
|
|
|
1627
1637
|
groupMessagesBySection: () => groupMessagesBySection,
|
|
1628
1638
|
renderSequenceDiagram: () => renderSequenceDiagram
|
|
1629
1639
|
});
|
|
1640
|
+
function mix(a, b, pct) {
|
|
1641
|
+
const parse = (h) => {
|
|
1642
|
+
const r = h.replace("#", "");
|
|
1643
|
+
const f = r.length === 3 ? r[0] + r[0] + r[1] + r[1] + r[2] + r[2] : r;
|
|
1644
|
+
return [parseInt(f.substring(0, 2), 16), parseInt(f.substring(2, 4), 16), parseInt(f.substring(4, 6), 16)];
|
|
1645
|
+
};
|
|
1646
|
+
const [ar, ag, ab] = parse(a), [br, bg, bb] = parse(b), t = pct / 100;
|
|
1647
|
+
const c = (x, y) => Math.round(x * t + y * (1 - t)).toString(16).padStart(2, "0");
|
|
1648
|
+
return `#${c(ar, br)}${c(ag, bg)}${c(ab, bb)}`;
|
|
1649
|
+
}
|
|
1630
1650
|
function renderRectParticipant(g, palette, isDark) {
|
|
1631
1651
|
g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", H).attr("rx", 2).attr("ry", 2).attr("fill", fill(palette, isDark)).attr("stroke", stroke(palette)).attr("stroke-width", SW);
|
|
1632
1652
|
}
|
|
@@ -1916,7 +1936,10 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
1916
1936
|
}
|
|
1917
1937
|
}
|
|
1918
1938
|
const allRenderSteps = buildRenderSequence(messages);
|
|
1919
|
-
|
|
1939
|
+
let renderSteps = hiddenMsgIndices.size > 0 ? allRenderSteps.filter((s) => !hiddenMsgIndices.has(s.messageIndex)) : allRenderSteps;
|
|
1940
|
+
renderSteps = renderSteps.filter(
|
|
1941
|
+
(s) => s.type === "call" || s.label
|
|
1942
|
+
);
|
|
1920
1943
|
const activations = activationsOff ? [] : computeActivations(renderSteps);
|
|
1921
1944
|
const stepSpacing = 35;
|
|
1922
1945
|
const BLOCK_HEADER_SPACE = 30;
|
|
@@ -2111,10 +2134,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
2111
2134
|
participants.forEach((p, i) => {
|
|
2112
2135
|
participantX.set(p.id, offsetX + i * PARTICIPANT_GAP);
|
|
2113
2136
|
});
|
|
2114
|
-
const svg = d3Selection.select(container).append("svg").attr("width", "100%").attr("height", totalHeight).attr("viewBox", `0 0 ${svgWidth} ${totalHeight}`).attr("preserveAspectRatio", "xMidYMin meet").attr("class", "sequence-diagram").style(
|
|
2115
|
-
"font-family",
|
|
2116
|
-
"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif"
|
|
2117
|
-
);
|
|
2137
|
+
const svg = d3Selection.select(container).append("svg").attr("width", "100%").attr("height", totalHeight).attr("viewBox", `0 0 ${svgWidth} ${totalHeight}`).attr("preserveAspectRatio", "xMidYMin meet").attr("class", "sequence-diagram").style("font-family", FONT_FAMILY);
|
|
2118
2138
|
const defs = svg.append("defs");
|
|
2119
2139
|
defs.append("marker").attr("id", "seq-arrowhead").attr("viewBox", `0 0 ${ARROWHEAD_SIZE} ${ARROWHEAD_SIZE}`).attr("refX", ARROWHEAD_SIZE).attr("refY", ARROWHEAD_SIZE / 2).attr("markerWidth", ARROWHEAD_SIZE).attr("markerHeight", ARROWHEAD_SIZE).attr("orient", "auto").append("polygon").attr(
|
|
2120
2140
|
"points",
|
|
@@ -2140,7 +2160,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
2140
2160
|
const boxY = participantStartY - GROUP_PADDING_TOP;
|
|
2141
2161
|
const boxH = PARTICIPANT_BOX_HEIGHT + GROUP_PADDING_TOP + GROUP_PADDING_BOTTOM;
|
|
2142
2162
|
const resolvedGroupColor = group.color ? resolveColor(group.color, palette) : void 0;
|
|
2143
|
-
const fillColor = resolvedGroupColor ?
|
|
2163
|
+
const fillColor = resolvedGroupColor ? mix(resolvedGroupColor, isDark ? palette.surface : palette.bg, 10) : isDark ? palette.surface : palette.bg;
|
|
2144
2164
|
const strokeColor = resolvedGroupColor || palette.textMuted;
|
|
2145
2165
|
svg.append("rect").attr("x", minX).attr("y", boxY).attr("width", maxX - minX).attr("height", boxH).attr("rx", 6).attr("fill", fillColor).attr("stroke", strokeColor).attr("stroke-width", 1).attr("stroke-opacity", 0.5).attr("class", "group-box").attr("data-group-line", String(group.lineNumber));
|
|
2146
2166
|
svg.append("text").attr("x", minX + 8).attr("y", boxY + GROUP_LABEL_SIZE + 4).attr("fill", strokeColor).attr("font-size", GROUP_LABEL_SIZE).attr("font-weight", "bold").attr("opacity", 0.7).attr("class", "group-label").attr("data-group-line", String(group.lineNumber)).text(group.name);
|
|
@@ -2263,7 +2283,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
2263
2283
|
if (msg) coveredLines.push(msg.lineNumber);
|
|
2264
2284
|
}
|
|
2265
2285
|
svg.append("rect").attr("x", x).attr("y", y1).attr("width", ACTIVATION_WIDTH).attr("height", y2 - y1).attr("fill", isDark ? palette.surface : palette.bg);
|
|
2266
|
-
const actFill =
|
|
2286
|
+
const actFill = mix(palette.primary, isDark ? palette.surface : palette.bg, isDark ? 15 : 30);
|
|
2267
2287
|
svg.append("rect").attr("x", x).attr("y", y1).attr("width", ACTIVATION_WIDTH).attr("height", y2 - y1).attr("fill", actFill).attr("stroke", palette.primary).attr("stroke-width", 1).attr("stroke-opacity", 0.5).attr("data-participant-id", act.participantId).attr("data-msg-lines", coveredLines.join(",")).attr("class", "activation");
|
|
2268
2288
|
});
|
|
2269
2289
|
for (const ln of deferredLines) {
|
|
@@ -2436,6 +2456,7 @@ var init_renderer = __esm({
|
|
|
2436
2456
|
"use strict";
|
|
2437
2457
|
d3Selection = __toESM(require("d3-selection"), 1);
|
|
2438
2458
|
init_colors();
|
|
2459
|
+
init_fonts();
|
|
2439
2460
|
init_parser();
|
|
2440
2461
|
PARTICIPANT_GAP = 160;
|
|
2441
2462
|
PARTICIPANT_BOX_WIDTH = 120;
|
|
@@ -2447,7 +2468,7 @@ var init_renderer = __esm({
|
|
|
2447
2468
|
MESSAGE_START_OFFSET = 30;
|
|
2448
2469
|
LIFELINE_TAIL = 30;
|
|
2449
2470
|
ARROWHEAD_SIZE = 8;
|
|
2450
|
-
fill = (palette, isDark) =>
|
|
2471
|
+
fill = (palette, isDark) => mix(palette.primary, isDark ? palette.surface : palette.bg, isDark ? 15 : 30);
|
|
2451
2472
|
stroke = (palette) => palette.textMuted;
|
|
2452
2473
|
SW = 1.5;
|
|
2453
2474
|
W = PARTICIPANT_BOX_WIDTH;
|
|
@@ -2467,6 +2488,7 @@ var d3Selection2 = __toESM(require("d3-selection"), 1);
|
|
|
2467
2488
|
var d3Shape = __toESM(require("d3-shape"), 1);
|
|
2468
2489
|
var d3Array = __toESM(require("d3-array"), 1);
|
|
2469
2490
|
var import_d3_cloud = __toESM(require("d3-cloud"), 1);
|
|
2491
|
+
init_fonts();
|
|
2470
2492
|
init_colors();
|
|
2471
2493
|
init_palettes();
|
|
2472
2494
|
var DEFAULT_CLOUD_OPTIONS = {
|
|
@@ -4432,8 +4454,8 @@ function renderWordCloudAsync(container, parsed, palette, _isDark) {
|
|
|
4432
4454
|
"transform",
|
|
4433
4455
|
`translate(${width / 2},${titleHeight + cloudHeight / 2})`
|
|
4434
4456
|
);
|
|
4435
|
-
(0, import_d3_cloud.default)().size([width, cloudHeight]).words(words.map((w) => ({ ...w, size: fontSize(w.weight) }))).padding(4).rotate(rotateFn).fontSize((d) => d.size).font(
|
|
4436
|
-
g.selectAll("text").data(layoutWords).join("text").style("font-size", (d) => `${d.size}px`).style("font-family",
|
|
4457
|
+
(0, import_d3_cloud.default)().size([width, cloudHeight]).words(words.map((w) => ({ ...w, size: fontSize(w.weight) }))).padding(4).rotate(rotateFn).fontSize((d) => d.size).font(FONT_FAMILY).on("end", (layoutWords) => {
|
|
4458
|
+
g.selectAll("text").data(layoutWords).join("text").style("font-size", (d) => `${d.size}px`).style("font-family", FONT_FAMILY).style("font-weight", "600").style("fill", (_d, i) => colors[i % colors.length]).attr("text-anchor", "middle").attr(
|
|
4437
4459
|
"transform",
|
|
4438
4460
|
(d) => `translate(${d.x},${d.y}) rotate(${d.rotate})`
|
|
4439
4461
|
).text((d) => d.text);
|
|
@@ -5037,6 +5059,7 @@ async function renderD3ForExport(content, theme, palette) {
|
|
|
5037
5059
|
svgEl.style.background = "none";
|
|
5038
5060
|
}
|
|
5039
5061
|
svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
5062
|
+
svgEl.style.fontFamily = FONT_FAMILY;
|
|
5040
5063
|
return svgEl.outerHTML;
|
|
5041
5064
|
} finally {
|
|
5042
5065
|
document.body.removeChild(container);
|
|
@@ -5045,6 +5068,7 @@ async function renderD3ForExport(content, theme, palette) {
|
|
|
5045
5068
|
|
|
5046
5069
|
// src/cli.ts
|
|
5047
5070
|
init_registry();
|
|
5071
|
+
init_fonts();
|
|
5048
5072
|
var PALETTES = [
|
|
5049
5073
|
"nord",
|
|
5050
5074
|
"solarized",
|
|
@@ -5147,7 +5171,12 @@ function inferFormat(outputPath) {
|
|
|
5147
5171
|
function svgToPng(svg, background) {
|
|
5148
5172
|
const resvg = new import_resvg_js.Resvg(svg, {
|
|
5149
5173
|
fitTo: { mode: "zoom", value: 2 },
|
|
5150
|
-
...background ? { background } : {}
|
|
5174
|
+
...background ? { background } : {},
|
|
5175
|
+
font: {
|
|
5176
|
+
loadSystemFonts: true,
|
|
5177
|
+
defaultFontFamily: DEFAULT_FONT_NAME,
|
|
5178
|
+
sansSerifFamily: DEFAULT_FONT_NAME
|
|
5179
|
+
}
|
|
5151
5180
|
});
|
|
5152
5181
|
const rendered = resvg.render();
|
|
5153
5182
|
return rendered.asPng();
|
package/dist/index.cjs
CHANGED
|
@@ -1617,6 +1617,15 @@ var init_palettes = __esm({
|
|
|
1617
1617
|
}
|
|
1618
1618
|
});
|
|
1619
1619
|
|
|
1620
|
+
// src/fonts.ts
|
|
1621
|
+
var FONT_FAMILY;
|
|
1622
|
+
var init_fonts = __esm({
|
|
1623
|
+
"src/fonts.ts"() {
|
|
1624
|
+
"use strict";
|
|
1625
|
+
FONT_FAMILY = "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif";
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
|
|
1620
1629
|
// src/sequence/renderer.ts
|
|
1621
1630
|
var renderer_exports = {};
|
|
1622
1631
|
__export(renderer_exports, {
|
|
@@ -1627,6 +1636,16 @@ __export(renderer_exports, {
|
|
|
1627
1636
|
groupMessagesBySection: () => groupMessagesBySection,
|
|
1628
1637
|
renderSequenceDiagram: () => renderSequenceDiagram
|
|
1629
1638
|
});
|
|
1639
|
+
function mix(a, b, pct) {
|
|
1640
|
+
const parse = (h) => {
|
|
1641
|
+
const r = h.replace("#", "");
|
|
1642
|
+
const f = r.length === 3 ? r[0] + r[0] + r[1] + r[1] + r[2] + r[2] : r;
|
|
1643
|
+
return [parseInt(f.substring(0, 2), 16), parseInt(f.substring(2, 4), 16), parseInt(f.substring(4, 6), 16)];
|
|
1644
|
+
};
|
|
1645
|
+
const [ar, ag, ab] = parse(a), [br, bg, bb] = parse(b), t = pct / 100;
|
|
1646
|
+
const c = (x, y) => Math.round(x * t + y * (1 - t)).toString(16).padStart(2, "0");
|
|
1647
|
+
return `#${c(ar, br)}${c(ag, bg)}${c(ab, bb)}`;
|
|
1648
|
+
}
|
|
1630
1649
|
function renderRectParticipant(g, palette, isDark) {
|
|
1631
1650
|
g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", H).attr("rx", 2).attr("ry", 2).attr("fill", fill(palette, isDark)).attr("stroke", stroke(palette)).attr("stroke-width", SW);
|
|
1632
1651
|
}
|
|
@@ -1916,7 +1935,10 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
1916
1935
|
}
|
|
1917
1936
|
}
|
|
1918
1937
|
const allRenderSteps = buildRenderSequence(messages);
|
|
1919
|
-
|
|
1938
|
+
let renderSteps = hiddenMsgIndices.size > 0 ? allRenderSteps.filter((s) => !hiddenMsgIndices.has(s.messageIndex)) : allRenderSteps;
|
|
1939
|
+
renderSteps = renderSteps.filter(
|
|
1940
|
+
(s) => s.type === "call" || s.label
|
|
1941
|
+
);
|
|
1920
1942
|
const activations = activationsOff ? [] : computeActivations(renderSteps);
|
|
1921
1943
|
const stepSpacing = 35;
|
|
1922
1944
|
const BLOCK_HEADER_SPACE = 30;
|
|
@@ -2111,10 +2133,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
2111
2133
|
participants.forEach((p, i) => {
|
|
2112
2134
|
participantX.set(p.id, offsetX + i * PARTICIPANT_GAP);
|
|
2113
2135
|
});
|
|
2114
|
-
const svg = d3Selection.select(container).append("svg").attr("width", "100%").attr("height", totalHeight).attr("viewBox", `0 0 ${svgWidth} ${totalHeight}`).attr("preserveAspectRatio", "xMidYMin meet").attr("class", "sequence-diagram").style(
|
|
2115
|
-
"font-family",
|
|
2116
|
-
"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif"
|
|
2117
|
-
);
|
|
2136
|
+
const svg = d3Selection.select(container).append("svg").attr("width", "100%").attr("height", totalHeight).attr("viewBox", `0 0 ${svgWidth} ${totalHeight}`).attr("preserveAspectRatio", "xMidYMin meet").attr("class", "sequence-diagram").style("font-family", FONT_FAMILY);
|
|
2118
2137
|
const defs = svg.append("defs");
|
|
2119
2138
|
defs.append("marker").attr("id", "seq-arrowhead").attr("viewBox", `0 0 ${ARROWHEAD_SIZE} ${ARROWHEAD_SIZE}`).attr("refX", ARROWHEAD_SIZE).attr("refY", ARROWHEAD_SIZE / 2).attr("markerWidth", ARROWHEAD_SIZE).attr("markerHeight", ARROWHEAD_SIZE).attr("orient", "auto").append("polygon").attr(
|
|
2120
2139
|
"points",
|
|
@@ -2140,7 +2159,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
2140
2159
|
const boxY = participantStartY - GROUP_PADDING_TOP;
|
|
2141
2160
|
const boxH = PARTICIPANT_BOX_HEIGHT + GROUP_PADDING_TOP + GROUP_PADDING_BOTTOM;
|
|
2142
2161
|
const resolvedGroupColor = group.color ? resolveColor(group.color, palette) : void 0;
|
|
2143
|
-
const fillColor = resolvedGroupColor ?
|
|
2162
|
+
const fillColor = resolvedGroupColor ? mix(resolvedGroupColor, isDark ? palette.surface : palette.bg, 10) : isDark ? palette.surface : palette.bg;
|
|
2144
2163
|
const strokeColor = resolvedGroupColor || palette.textMuted;
|
|
2145
2164
|
svg.append("rect").attr("x", minX).attr("y", boxY).attr("width", maxX - minX).attr("height", boxH).attr("rx", 6).attr("fill", fillColor).attr("stroke", strokeColor).attr("stroke-width", 1).attr("stroke-opacity", 0.5).attr("class", "group-box").attr("data-group-line", String(group.lineNumber));
|
|
2146
2165
|
svg.append("text").attr("x", minX + 8).attr("y", boxY + GROUP_LABEL_SIZE + 4).attr("fill", strokeColor).attr("font-size", GROUP_LABEL_SIZE).attr("font-weight", "bold").attr("opacity", 0.7).attr("class", "group-label").attr("data-group-line", String(group.lineNumber)).text(group.name);
|
|
@@ -2263,7 +2282,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
2263
2282
|
if (msg) coveredLines.push(msg.lineNumber);
|
|
2264
2283
|
}
|
|
2265
2284
|
svg.append("rect").attr("x", x).attr("y", y1).attr("width", ACTIVATION_WIDTH).attr("height", y2 - y1).attr("fill", isDark ? palette.surface : palette.bg);
|
|
2266
|
-
const actFill =
|
|
2285
|
+
const actFill = mix(palette.primary, isDark ? palette.surface : palette.bg, isDark ? 15 : 30);
|
|
2267
2286
|
svg.append("rect").attr("x", x).attr("y", y1).attr("width", ACTIVATION_WIDTH).attr("height", y2 - y1).attr("fill", actFill).attr("stroke", palette.primary).attr("stroke-width", 1).attr("stroke-opacity", 0.5).attr("data-participant-id", act.participantId).attr("data-msg-lines", coveredLines.join(",")).attr("class", "activation");
|
|
2268
2287
|
});
|
|
2269
2288
|
for (const ln of deferredLines) {
|
|
@@ -2436,6 +2455,7 @@ var init_renderer = __esm({
|
|
|
2436
2455
|
"use strict";
|
|
2437
2456
|
d3Selection = __toESM(require("d3-selection"), 1);
|
|
2438
2457
|
init_colors();
|
|
2458
|
+
init_fonts();
|
|
2439
2459
|
init_parser();
|
|
2440
2460
|
PARTICIPANT_GAP = 160;
|
|
2441
2461
|
PARTICIPANT_BOX_WIDTH = 120;
|
|
@@ -2447,7 +2467,7 @@ var init_renderer = __esm({
|
|
|
2447
2467
|
MESSAGE_START_OFFSET = 30;
|
|
2448
2468
|
LIFELINE_TAIL = 30;
|
|
2449
2469
|
ARROWHEAD_SIZE = 8;
|
|
2450
|
-
fill = (palette, isDark) =>
|
|
2470
|
+
fill = (palette, isDark) => mix(palette.primary, isDark ? palette.surface : palette.bg, isDark ? 15 : 30);
|
|
2451
2471
|
stroke = (palette) => palette.textMuted;
|
|
2452
2472
|
SW = 1.5;
|
|
2453
2473
|
W = PARTICIPANT_BOX_WIDTH;
|
|
@@ -3150,6 +3170,7 @@ function buildChartJsConfig(parsed, palette, _isDark) {
|
|
|
3150
3170
|
}
|
|
3151
3171
|
|
|
3152
3172
|
// src/echarts.ts
|
|
3173
|
+
init_fonts();
|
|
3153
3174
|
init_colors();
|
|
3154
3175
|
init_palettes();
|
|
3155
3176
|
function parseEChart(content, palette) {
|
|
@@ -3384,7 +3405,7 @@ function buildEChartsOption(parsed, palette, _isDark) {
|
|
|
3384
3405
|
color: textColor,
|
|
3385
3406
|
fontSize: 18,
|
|
3386
3407
|
fontWeight: "bold",
|
|
3387
|
-
fontFamily:
|
|
3408
|
+
fontFamily: FONT_FAMILY
|
|
3388
3409
|
}
|
|
3389
3410
|
} : void 0;
|
|
3390
3411
|
const tooltipTheme = {
|
|
@@ -4032,6 +4053,7 @@ var d3Selection2 = __toESM(require("d3-selection"), 1);
|
|
|
4032
4053
|
var d3Shape = __toESM(require("d3-shape"), 1);
|
|
4033
4054
|
var d3Array = __toESM(require("d3-array"), 1);
|
|
4034
4055
|
var import_d3_cloud = __toESM(require("d3-cloud"), 1);
|
|
4056
|
+
init_fonts();
|
|
4035
4057
|
init_colors();
|
|
4036
4058
|
init_palettes();
|
|
4037
4059
|
var DEFAULT_CLOUD_OPTIONS = {
|
|
@@ -5990,8 +6012,8 @@ function renderWordCloud(container, parsed, palette, _isDark, onClickItem) {
|
|
|
5990
6012
|
"transform",
|
|
5991
6013
|
`translate(${width / 2},${titleHeight + cloudHeight / 2})`
|
|
5992
6014
|
);
|
|
5993
|
-
(0, import_d3_cloud.default)().size([width, cloudHeight]).words(words.map((w) => ({ ...w, size: fontSize(w.weight) }))).padding(4).rotate(rotateFn).fontSize((d) => d.size).font(
|
|
5994
|
-
g.selectAll("text").data(layoutWords).join("text").style("font-size", (d) => `${d.size}px`).style("font-family",
|
|
6015
|
+
(0, import_d3_cloud.default)().size([width, cloudHeight]).words(words.map((w) => ({ ...w, size: fontSize(w.weight) }))).padding(4).rotate(rotateFn).fontSize((d) => d.size).font(FONT_FAMILY).on("end", (layoutWords) => {
|
|
6016
|
+
g.selectAll("text").data(layoutWords).join("text").style("font-size", (d) => `${d.size}px`).style("font-family", FONT_FAMILY).style("font-weight", "600").style("fill", (_d, i) => colors[i % colors.length]).style(
|
|
5995
6017
|
"cursor",
|
|
5996
6018
|
(d) => onClickItem && d.lineNumber ? "pointer" : "default"
|
|
5997
6019
|
).attr("text-anchor", "middle").attr(
|
|
@@ -6040,8 +6062,8 @@ function renderWordCloudAsync(container, parsed, palette, _isDark) {
|
|
|
6040
6062
|
"transform",
|
|
6041
6063
|
`translate(${width / 2},${titleHeight + cloudHeight / 2})`
|
|
6042
6064
|
);
|
|
6043
|
-
(0, import_d3_cloud.default)().size([width, cloudHeight]).words(words.map((w) => ({ ...w, size: fontSize(w.weight) }))).padding(4).rotate(rotateFn).fontSize((d) => d.size).font(
|
|
6044
|
-
g.selectAll("text").data(layoutWords).join("text").style("font-size", (d) => `${d.size}px`).style("font-family",
|
|
6065
|
+
(0, import_d3_cloud.default)().size([width, cloudHeight]).words(words.map((w) => ({ ...w, size: fontSize(w.weight) }))).padding(4).rotate(rotateFn).fontSize((d) => d.size).font(FONT_FAMILY).on("end", (layoutWords) => {
|
|
6066
|
+
g.selectAll("text").data(layoutWords).join("text").style("font-size", (d) => `${d.size}px`).style("font-family", FONT_FAMILY).style("font-weight", "600").style("fill", (_d, i) => colors[i % colors.length]).attr("text-anchor", "middle").attr(
|
|
6045
6067
|
"transform",
|
|
6046
6068
|
(d) => `translate(${d.x},${d.y}) rotate(${d.rotate})`
|
|
6047
6069
|
).text((d) => d.text);
|
|
@@ -6645,6 +6667,7 @@ async function renderD3ForExport(content, theme, palette) {
|
|
|
6645
6667
|
svgEl.style.background = "none";
|
|
6646
6668
|
}
|
|
6647
6669
|
svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
6670
|
+
svgEl.style.fontFamily = FONT_FAMILY;
|
|
6648
6671
|
return svgEl.outerHTML;
|
|
6649
6672
|
} finally {
|
|
6650
6673
|
document.body.removeChild(container);
|