yumiamd 0.1.32 → 0.1.33
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/bin.js +1 -1
- package/dist/{chunk-Y2OWK5OP.js → chunk-IY7SXY6N.js} +55 -20
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +10 -10
package/dist/bin.js
CHANGED
|
@@ -10780,6 +10780,10 @@ var PdfRenderer = class {
|
|
|
10780
10780
|
}
|
|
10781
10781
|
return;
|
|
10782
10782
|
}
|
|
10783
|
+
if (el.type === "diagram") {
|
|
10784
|
+
this.renderDiagram(doc, el, x, y, w, h, theme);
|
|
10785
|
+
return;
|
|
10786
|
+
}
|
|
10783
10787
|
this.renderElement(doc, el, x, y, w, theme, presentation);
|
|
10784
10788
|
}
|
|
10785
10789
|
paintCardFrame(doc, card, x, y, width, height, theme) {
|
|
@@ -11671,7 +11675,7 @@ var PdfRenderer = class {
|
|
|
11671
11675
|
return curY;
|
|
11672
11676
|
}
|
|
11673
11677
|
case "diagram": {
|
|
11674
|
-
return this.renderDiagram(doc, element, x, y, width, theme);
|
|
11678
|
+
return this.renderDiagram(doc, element, x, y, width, void 0, theme);
|
|
11675
11679
|
}
|
|
11676
11680
|
case "sequence": {
|
|
11677
11681
|
return this.renderSequence(doc, element, x, y, width, theme);
|
|
@@ -11683,19 +11687,46 @@ var PdfRenderer = class {
|
|
|
11683
11687
|
return y;
|
|
11684
11688
|
}
|
|
11685
11689
|
}
|
|
11686
|
-
renderDiagram(doc, diagram, x, y, width, theme) {
|
|
11690
|
+
renderDiagram(doc, diagram, x, y, width, height, theme) {
|
|
11687
11691
|
const isLR = (diagram.direction || "LR").toUpperCase() === "LR";
|
|
11688
11692
|
if (diagram.nodes.length === 0)
|
|
11689
11693
|
return y;
|
|
11690
|
-
const layout = computeDiagramLayout(diagram,
|
|
11691
|
-
originX:
|
|
11692
|
-
originY:
|
|
11693
|
-
titleHeight:
|
|
11694
|
+
const layout = computeDiagramLayout(diagram, 1e3, isLR, {
|
|
11695
|
+
originX: 0,
|
|
11696
|
+
originY: diagram.title ? 30 : 0,
|
|
11697
|
+
titleHeight: diagram.title ? 30 : 0
|
|
11694
11698
|
});
|
|
11695
|
-
const { nodeWidth:
|
|
11699
|
+
const { nodeWidth: rawNodeW, nodeHeight: rawNodeH, positions: rawPositions } = layout;
|
|
11700
|
+
let minX = Infinity;
|
|
11701
|
+
let minY = Infinity;
|
|
11702
|
+
let maxX = 0;
|
|
11703
|
+
let maxY = 0;
|
|
11704
|
+
for (const p of Object.values(rawPositions)) {
|
|
11705
|
+
minX = Math.min(minX, p.x);
|
|
11706
|
+
minY = Math.min(minY, p.y);
|
|
11707
|
+
maxX = Math.max(maxX, p.x + rawNodeW);
|
|
11708
|
+
maxY = Math.max(maxY, p.y + rawNodeH);
|
|
11709
|
+
}
|
|
11710
|
+
const contentW = Math.max(1, maxX - minX);
|
|
11711
|
+
const contentH = Math.max(1, maxY - minY);
|
|
11712
|
+
const titleH = diagram.title ? 18 : 0;
|
|
11696
11713
|
if (diagram.title) {
|
|
11697
11714
|
doc.font(this.getPdfFont(theme, "bold")).fontSize(14).fillColor(theme.colors.primary).text(this.stripFormatting(diagram.title), x, y, { width, align: "center" });
|
|
11698
11715
|
}
|
|
11716
|
+
const drawY = y + titleH;
|
|
11717
|
+
const drawH = height !== void 0 ? Math.max(24, height - titleH) : contentH;
|
|
11718
|
+
const scale = Math.min(width / contentW, drawH / contentH, 1);
|
|
11719
|
+
const nodeW = rawNodeW * scale;
|
|
11720
|
+
const nodeH = rawNodeH * scale;
|
|
11721
|
+
const offsetX = x + (width - contentW * scale) / 2;
|
|
11722
|
+
const offsetY = drawY + (drawH - contentH * scale) / 2;
|
|
11723
|
+
const positions = {};
|
|
11724
|
+
for (const [id, p] of Object.entries(rawPositions)) {
|
|
11725
|
+
positions[id] = {
|
|
11726
|
+
x: offsetX + (p.x - minX) * scale,
|
|
11727
|
+
y: offsetY + (p.y - minY) * scale
|
|
11728
|
+
};
|
|
11729
|
+
}
|
|
11699
11730
|
const arrowColor = theme.colors.accent || theme.colors.primary;
|
|
11700
11731
|
diagram.edges.forEach((e) => {
|
|
11701
11732
|
const p1 = positions[e.from];
|
|
@@ -11708,7 +11739,7 @@ var PdfRenderer = class {
|
|
|
11708
11739
|
const last = pts[pts.length - 1];
|
|
11709
11740
|
const prev = pts[pts.length - 2];
|
|
11710
11741
|
doc.save();
|
|
11711
|
-
doc.lineWidth(1.5).strokeColor(arrowColor);
|
|
11742
|
+
doc.lineWidth(Math.max(1, 1.5 * scale)).strokeColor(arrowColor);
|
|
11712
11743
|
if (e.style === "dashed")
|
|
11713
11744
|
doc.dash(4, { space: 3 });
|
|
11714
11745
|
doc.moveTo(pts[0].x, pts[0].y);
|
|
@@ -11717,7 +11748,7 @@ var PdfRenderer = class {
|
|
|
11717
11748
|
doc.stroke();
|
|
11718
11749
|
doc.restore();
|
|
11719
11750
|
const angle = Math.atan2(last.y - prev.y, last.x - prev.x);
|
|
11720
|
-
const headLen = 6;
|
|
11751
|
+
const headLen = Math.max(4, 6 * scale);
|
|
11721
11752
|
doc.save();
|
|
11722
11753
|
doc.fillColor(arrowColor);
|
|
11723
11754
|
doc.moveTo(last.x, last.y).lineTo(last.x - headLen * Math.cos(angle - Math.PI / 6), last.y - headLen * Math.sin(angle - Math.PI / 6)).lineTo(last.x - headLen * Math.cos(angle + Math.PI / 6), last.y - headLen * Math.sin(angle + Math.PI / 6)).fill();
|
|
@@ -11727,15 +11758,19 @@ var PdfRenderer = class {
|
|
|
11727
11758
|
const midX = mid.x;
|
|
11728
11759
|
const midY = mid.y;
|
|
11729
11760
|
const labelText = this.stripFormatting(e.label);
|
|
11730
|
-
const labelW = Math.min(90, Math.max(45, labelText.length * 5.5 + 16));
|
|
11761
|
+
const labelW = Math.min(90 * scale, Math.max(45 * scale, labelText.length * 5.5 * scale + 16));
|
|
11762
|
+
const labelH = Math.max(12, 16 * scale);
|
|
11731
11763
|
doc.save();
|
|
11732
|
-
doc.roundedRect(midX - labelW / 2, midY -
|
|
11733
|
-
doc.roundedRect(midX - labelW / 2, midY -
|
|
11764
|
+
doc.roundedRect(midX - labelW / 2, midY - labelH / 2, labelW, labelH, 4).fill(theme.colors.surface || "#151522");
|
|
11765
|
+
doc.roundedRect(midX - labelW / 2, midY - labelH / 2, labelW, labelH, 4).lineWidth(0.8).strokeColor(theme.colors.border || "#334155").stroke();
|
|
11734
11766
|
doc.restore();
|
|
11735
|
-
doc.font(this.getPdfFont(theme, "bold")).fontSize(7.5).fillColor(theme.colors.muted || "#888888").text(labelText, midX - labelW / 2, midY -
|
|
11767
|
+
doc.font(this.getPdfFont(theme, "bold")).fontSize(Math.max(6, 7.5 * scale)).fillColor(theme.colors.muted || "#888888").text(labelText, midX - labelW / 2, midY - labelH / 2 + 2, {
|
|
11768
|
+
width: labelW,
|
|
11769
|
+
align: "center"
|
|
11770
|
+
});
|
|
11736
11771
|
}
|
|
11737
11772
|
});
|
|
11738
|
-
const maxChars = Math.max(6, Math.floor((nodeW - 10) / 6));
|
|
11773
|
+
const maxChars = Math.max(6, Math.floor((nodeW - 10) / Math.max(4, 6 * scale)));
|
|
11739
11774
|
diagram.nodes.forEach((n) => {
|
|
11740
11775
|
const p = positions[n.id];
|
|
11741
11776
|
if (!p)
|
|
@@ -11753,18 +11788,18 @@ var PdfRenderer = class {
|
|
|
11753
11788
|
else if (variant === "info")
|
|
11754
11789
|
nodeColor = theme.colors.info || theme.colors.primary;
|
|
11755
11790
|
doc.save();
|
|
11756
|
-
doc.roundedRect(p.x, p.y, nodeW, nodeH, 6).fill(theme.colors.surface || "#151522");
|
|
11757
|
-
doc.roundedRect(p.x, p.y, nodeW, nodeH, 6).lineWidth(1.5).strokeColor(nodeColor).stroke();
|
|
11791
|
+
doc.roundedRect(p.x, p.y, nodeW, nodeH, Math.max(3, 6 * scale)).fill(theme.colors.surface || "#151522");
|
|
11792
|
+
doc.roundedRect(p.x, p.y, nodeW, nodeH, Math.max(3, 6 * scale)).lineWidth(Math.max(1, 1.5 * scale)).strokeColor(nodeColor).stroke();
|
|
11758
11793
|
doc.restore();
|
|
11759
11794
|
const label = fitDiagramLabel(this.stripFormatting(n.label), maxChars);
|
|
11760
|
-
doc.font(this.getPdfFont(theme, "bold")).fontSize(Math.min(10, Math.max(
|
|
11795
|
+
doc.font(this.getPdfFont(theme, "bold")).fontSize(Math.min(10, Math.max(6.5, nodeH / 4))).fillColor(theme.colors.text).text(label, p.x + 4, p.y + Math.max(3, nodeH / 2 - 5), {
|
|
11761
11796
|
width: nodeW - 8,
|
|
11762
|
-
height: nodeH -
|
|
11797
|
+
height: nodeH - 6,
|
|
11763
11798
|
align: "center",
|
|
11764
11799
|
ellipsis: true
|
|
11765
11800
|
});
|
|
11766
11801
|
});
|
|
11767
|
-
return y +
|
|
11802
|
+
return height !== void 0 ? y + height : y + titleH + contentH * scale + 8;
|
|
11768
11803
|
}
|
|
11769
11804
|
renderSequence(doc, s, x, y, width, theme) {
|
|
11770
11805
|
const participants = s.participants || [];
|
|
@@ -12017,7 +12052,7 @@ function startDevServer(filePath, options = {}) {
|
|
|
12017
12052
|
// src/cli.ts
|
|
12018
12053
|
import { mkdirSync, readFileSync as readFileSync3, watch as fsWatch, writeFileSync } from "fs";
|
|
12019
12054
|
import { basename, dirname, extname, join, resolve as resolve3 } from "path";
|
|
12020
|
-
var VERSION = "0.1.
|
|
12055
|
+
var VERSION = "0.1.33";
|
|
12021
12056
|
function printHelp() {
|
|
12022
12057
|
return `
|
|
12023
12058
|
YumiaMD \u2014 Markdown-based presentation compiler (v${VERSION})
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export * from '@yumiamd/renderer-pptx';
|
|
|
9
9
|
export * from '@yumiamd/renderer-html';
|
|
10
10
|
export * from '@yumiamd/renderer-pdf';
|
|
11
11
|
|
|
12
|
-
declare const VERSION = "0.1.
|
|
12
|
+
declare const VERSION = "0.1.33";
|
|
13
13
|
declare function printHelp(): string;
|
|
14
14
|
declare function runCli(argv: string[]): Promise<{
|
|
15
15
|
exitCode: number;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yumiamd",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
4
4
|
"description": "Command line interface and compiler for YumiaMD presentations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"tsup": "^8.5.1",
|
|
25
|
-
"@yumiamd/
|
|
26
|
-
"@yumiamd/
|
|
27
|
-
"@yumiamd/
|
|
28
|
-
"@yumiamd/
|
|
29
|
-
"@yumiamd/
|
|
30
|
-
"@yumiamd/theme": "0.1.
|
|
31
|
-
"@yumiamd/renderer-
|
|
32
|
-
"@yumiamd/renderer-pptx": "0.1.
|
|
33
|
-
"@yumiamd/
|
|
25
|
+
"@yumiamd/ast": "0.1.33",
|
|
26
|
+
"@yumiamd/parser": "0.1.33",
|
|
27
|
+
"@yumiamd/layout": "0.1.33",
|
|
28
|
+
"@yumiamd/renderer": "0.1.33",
|
|
29
|
+
"@yumiamd/core": "0.1.33",
|
|
30
|
+
"@yumiamd/theme": "0.1.33",
|
|
31
|
+
"@yumiamd/renderer-pdf": "0.1.33",
|
|
32
|
+
"@yumiamd/renderer-pptx": "0.1.33",
|
|
33
|
+
"@yumiamd/renderer-html": "0.1.33"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
36
36
|
"yumia",
|