yumiamd 0.1.30 → 0.1.31
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-MXMPDHHS.js → chunk-VMBKNPA7.js} +229 -70
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/package.json +10 -10
package/dist/bin.js
CHANGED
|
@@ -2872,6 +2872,28 @@ function computeDiagramLayout(diagram, availableWidth, isLR = (diagram.direction
|
|
|
2872
2872
|
positions
|
|
2873
2873
|
};
|
|
2874
2874
|
}
|
|
2875
|
+
function orthogonalEdgePoints(isLR, p1, p2, nodeW, nodeH) {
|
|
2876
|
+
const x1 = isLR ? p1.x + nodeW : p1.x + nodeW / 2;
|
|
2877
|
+
const y1 = isLR ? p1.y + nodeH / 2 : p1.y + nodeH;
|
|
2878
|
+
const x2 = isLR ? p2.x : p2.x + nodeW / 2;
|
|
2879
|
+
const y2 = isLR ? p2.y + nodeH / 2 : p2.y;
|
|
2880
|
+
if (isLR) {
|
|
2881
|
+
const midX = (x1 + x2) / 2;
|
|
2882
|
+
return [
|
|
2883
|
+
{ x: x1, y: y1 },
|
|
2884
|
+
{ x: midX, y: y1 },
|
|
2885
|
+
{ x: midX, y: y2 },
|
|
2886
|
+
{ x: x2, y: y2 }
|
|
2887
|
+
];
|
|
2888
|
+
}
|
|
2889
|
+
const midY = (y1 + y2) / 2;
|
|
2890
|
+
return [
|
|
2891
|
+
{ x: x1, y: y1 },
|
|
2892
|
+
{ x: x1, y: midY },
|
|
2893
|
+
{ x: x2, y: midY },
|
|
2894
|
+
{ x: x2, y: y2 }
|
|
2895
|
+
];
|
|
2896
|
+
}
|
|
2875
2897
|
function fitDiagramLabel(label, maxChars) {
|
|
2876
2898
|
const clean = label.replace(/\s+/g, " ").trim();
|
|
2877
2899
|
if (clean.length <= maxChars)
|
|
@@ -2934,18 +2956,19 @@ var DefaultLayoutEngine = class {
|
|
|
2934
2956
|
layoutElementList(elements, startX, startY, availableWidth, gap) {
|
|
2935
2957
|
let currentY = startY;
|
|
2936
2958
|
const nodes = [];
|
|
2959
|
+
const compactHero = elements.length > 1 && elements.some((el) => el.type === "hero");
|
|
2937
2960
|
for (const element of elements) {
|
|
2938
|
-
const node = this.layoutSingleElement(element, startX, currentY, availableWidth, gap);
|
|
2961
|
+
const node = this.layoutSingleElement(element, startX, currentY, availableWidth, gap, compactHero);
|
|
2939
2962
|
nodes.push(node);
|
|
2940
2963
|
currentY += node.bounds.height + gap;
|
|
2941
2964
|
}
|
|
2942
2965
|
const totalHeight = elements.length > 0 ? currentY - startY - gap : 0;
|
|
2943
2966
|
return { nodes, totalHeight };
|
|
2944
2967
|
}
|
|
2945
|
-
layoutSingleElement(element, x, y, width, gap) {
|
|
2968
|
+
layoutSingleElement(element, x, y, width, gap, compactHero = false) {
|
|
2946
2969
|
switch (element.type) {
|
|
2947
2970
|
case "hero": {
|
|
2948
|
-
return this.layoutHero(element, x, y, width, gap);
|
|
2971
|
+
return this.layoutHero(element, x, y, width, gap, compactHero);
|
|
2949
2972
|
}
|
|
2950
2973
|
case "heading": {
|
|
2951
2974
|
const height = this.estimateHeadingHeight(element, width);
|
|
@@ -3061,31 +3084,35 @@ var DefaultLayoutEngine = class {
|
|
|
3061
3084
|
}
|
|
3062
3085
|
}
|
|
3063
3086
|
}
|
|
3064
|
-
layoutHero(element, x, y, width, gap) {
|
|
3087
|
+
layoutHero(element, x, y, width, gap, compact = false) {
|
|
3065
3088
|
let curY = y;
|
|
3066
3089
|
if (element.badge || element.tagline) {
|
|
3067
|
-
curY += 52;
|
|
3090
|
+
curY += compact ? 40 : 52;
|
|
3068
3091
|
}
|
|
3069
|
-
const charsPerLineTitle = Math.max(12, Math.floor(width / 28));
|
|
3092
|
+
const charsPerLineTitle = Math.max(12, Math.floor(width / (compact ? 32 : 28)));
|
|
3070
3093
|
const titleLines = Math.max(1, Math.ceil(element.title.length / charsPerLineTitle));
|
|
3071
|
-
const titleHeight = Math.max(100, titleLines * 72 + 24);
|
|
3094
|
+
const titleHeight = compact ? Math.max(56, titleLines * 44 + 12) : Math.max(100, titleLines * 72 + 24);
|
|
3072
3095
|
curY += titleHeight;
|
|
3073
3096
|
if (element.subtitle) {
|
|
3074
|
-
const charsPerLineSub = Math.max(20, Math.floor(width / 18));
|
|
3097
|
+
const charsPerLineSub = Math.max(20, Math.floor(width / (compact ? 20 : 18)));
|
|
3075
3098
|
const subLines = Math.max(1, Math.ceil(element.subtitle.length / charsPerLineSub));
|
|
3076
|
-
const subHeight = Math.max(56, subLines * 36 + 16);
|
|
3099
|
+
const subHeight = compact ? Math.max(36, subLines * 28 + 10) : Math.max(56, subLines * 36 + 16);
|
|
3077
3100
|
curY += subHeight;
|
|
3078
3101
|
}
|
|
3079
|
-
curY += 16;
|
|
3102
|
+
curY += compact ? 10 : 16;
|
|
3080
3103
|
const children = [];
|
|
3081
3104
|
if (element.elements) {
|
|
3082
3105
|
for (const child of element.elements) {
|
|
3083
|
-
const node = this.layoutSingleElement(child, x, curY, width, gap);
|
|
3106
|
+
const node = this.layoutSingleElement(child, x, curY, width, gap, false);
|
|
3084
3107
|
children.push(node);
|
|
3085
3108
|
curY += node.bounds.height + gap;
|
|
3086
3109
|
}
|
|
3087
3110
|
}
|
|
3088
|
-
return {
|
|
3111
|
+
return {
|
|
3112
|
+
element,
|
|
3113
|
+
bounds: { x, y, width, height: Math.max(curY - y, compact ? 120 : 160) },
|
|
3114
|
+
children
|
|
3115
|
+
};
|
|
3089
3116
|
}
|
|
3090
3117
|
layoutGrid(element, x, y, width, gap) {
|
|
3091
3118
|
const colCount = typeof element.columns === "number" ? element.columns : parseInt(String(element.columns), 10) || 2;
|
|
@@ -6349,7 +6376,8 @@ var PptxRenderer = class {
|
|
|
6349
6376
|
x: rect.x,
|
|
6350
6377
|
y: rect.y,
|
|
6351
6378
|
w: rect.w,
|
|
6352
|
-
h: rect.h
|
|
6379
|
+
h: rect.h,
|
|
6380
|
+
sizing: { type: "contain", w: rect.w, h: rect.h }
|
|
6353
6381
|
});
|
|
6354
6382
|
} catch {
|
|
6355
6383
|
drawPlaceholder();
|
|
@@ -6679,7 +6707,8 @@ var PptxRenderer = class {
|
|
|
6679
6707
|
h: node.bounds.height * scaleY
|
|
6680
6708
|
};
|
|
6681
6709
|
const align = hero.align || "center";
|
|
6682
|
-
|
|
6710
|
+
const compact = rect.h < 2.4;
|
|
6711
|
+
let curY = rect.y + (compact ? 0.12 : 0.3);
|
|
6683
6712
|
if (hero.badge) {
|
|
6684
6713
|
const badgeW = Math.min(3.2, Math.max(1.4, hero.badge.length * 0.11 + 0.6));
|
|
6685
6714
|
const badgeX = align === "left" ? rect.x : align === "right" ? rect.x + rect.w - badgeW : rect.x + (rect.w - badgeW) / 2;
|
|
@@ -6687,7 +6716,7 @@ var PptxRenderer = class {
|
|
|
6687
6716
|
x: badgeX,
|
|
6688
6717
|
y: curY,
|
|
6689
6718
|
w: badgeW,
|
|
6690
|
-
h: 0.32,
|
|
6719
|
+
h: compact ? 0.26 : 0.32,
|
|
6691
6720
|
fill: { color: this.cleanHexColor(theme.colors.surface) },
|
|
6692
6721
|
line: { color: this.cleanHexColor(theme.colors.primary), width: 1.5 },
|
|
6693
6722
|
rectRadius: 0.16
|
|
@@ -6696,33 +6725,33 @@ var PptxRenderer = class {
|
|
|
6696
6725
|
x: badgeX,
|
|
6697
6726
|
y: curY,
|
|
6698
6727
|
w: badgeW,
|
|
6699
|
-
h: 0.32,
|
|
6700
|
-
fontSize: 10,
|
|
6728
|
+
h: compact ? 0.26 : 0.32,
|
|
6729
|
+
fontSize: compact ? 9 : 10,
|
|
6701
6730
|
bold: true,
|
|
6702
6731
|
color: this.cleanHexColor(theme.colors.primary),
|
|
6703
6732
|
fontFace: cleanFontFace(theme.typography.headingFont),
|
|
6704
6733
|
align: "center",
|
|
6705
6734
|
valign: "middle"
|
|
6706
6735
|
});
|
|
6707
|
-
curY += 0.48;
|
|
6736
|
+
curY += compact ? 0.36 : 0.48;
|
|
6708
6737
|
} else if (hero.tagline) {
|
|
6709
6738
|
pptxSlide.addText(hero.tagline.toUpperCase(), {
|
|
6710
6739
|
x: rect.x,
|
|
6711
6740
|
y: curY,
|
|
6712
6741
|
w: rect.w,
|
|
6713
6742
|
h: 0.32,
|
|
6714
|
-
fontSize: 11,
|
|
6743
|
+
fontSize: compact ? 10 : 11,
|
|
6715
6744
|
bold: true,
|
|
6716
6745
|
color: this.cleanHexColor(theme.colors.primary),
|
|
6717
6746
|
fontFace: cleanFontFace(theme.typography.headingFont),
|
|
6718
6747
|
align
|
|
6719
6748
|
});
|
|
6720
|
-
curY += 0.42;
|
|
6749
|
+
curY += compact ? 0.34 : 0.42;
|
|
6721
6750
|
}
|
|
6722
|
-
const titleLines = Math.max(1, Math.ceil(hero.title.length / 38));
|
|
6723
|
-
const titleH = Math.max(0.7, titleLines * 0.55 + 0.
|
|
6751
|
+
const titleLines = Math.max(1, Math.ceil(hero.title.length / (compact ? 48 : 38)));
|
|
6752
|
+
const titleH = Math.max(compact ? 0.42 : 0.7, titleLines * (compact ? 0.36 : 0.55) + 0.08);
|
|
6724
6753
|
const displaySize = themeSizeToPptxPoints(theme.typography.sizes?.display, 56);
|
|
6725
|
-
const titleFontSize = titleLines > 2 ? displaySize - 10 : titleLines > 1 ? displaySize - 6 : displaySize;
|
|
6754
|
+
const titleFontSize = compact ? titleLines > 1 ? Math.min(22, displaySize - 14) : Math.min(26, displaySize - 10) : titleLines > 2 ? displaySize - 10 : titleLines > 1 ? displaySize - 6 : displaySize;
|
|
6726
6755
|
pptxSlide.addText(hero.title, {
|
|
6727
6756
|
x: rect.x,
|
|
6728
6757
|
y: curY,
|
|
@@ -6734,12 +6763,12 @@ var PptxRenderer = class {
|
|
|
6734
6763
|
fontFace: cleanFontFace(theme.typography.headingFont),
|
|
6735
6764
|
align
|
|
6736
6765
|
});
|
|
6737
|
-
curY += titleH + 0.08;
|
|
6766
|
+
curY += titleH + (compact ? 0.04 : 0.08);
|
|
6738
6767
|
if (hero.subtitle) {
|
|
6739
|
-
const subLines = Math.max(1, Math.ceil(hero.subtitle.length / 56));
|
|
6740
|
-
const subH = Math.max(0.38, subLines * 0.
|
|
6768
|
+
const subLines = Math.max(1, Math.ceil(hero.subtitle.length / (compact ? 64 : 56)));
|
|
6769
|
+
const subH = Math.max(compact ? 0.28 : 0.38, subLines * 0.28 + 0.06);
|
|
6741
6770
|
const bodySize = themeSizeToPptxPoints(theme.typography.sizes?.body, 18);
|
|
6742
|
-
const subFontSize = subLines > 2 ? bodySize - 1 : bodySize + 1;
|
|
6771
|
+
const subFontSize = compact ? bodySize - 1 : subLines > 2 ? bodySize - 1 : bodySize + 1;
|
|
6743
6772
|
pptxSlide.addText(hero.subtitle, {
|
|
6744
6773
|
x: rect.x,
|
|
6745
6774
|
y: curY,
|
|
@@ -6750,7 +6779,7 @@ var PptxRenderer = class {
|
|
|
6750
6779
|
fontFace: cleanFontFace(theme.typography.bodyFont),
|
|
6751
6780
|
align
|
|
6752
6781
|
});
|
|
6753
|
-
curY += subH + 0.12;
|
|
6782
|
+
curY += subH + (compact ? 0.06 : 0.12);
|
|
6754
6783
|
}
|
|
6755
6784
|
if (hero.tagline && hero.badge) {
|
|
6756
6785
|
pptxSlide.addText(hero.tagline, {
|
|
@@ -7399,33 +7428,36 @@ ${mermaid.code}`, {
|
|
|
7399
7428
|
const p2 = positions[e.to];
|
|
7400
7429
|
if (!p1 || !p2)
|
|
7401
7430
|
return;
|
|
7402
|
-
const
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7431
|
+
const pts = orthogonalEdgePoints(isLR, p1, p2, nodeW, nodeH);
|
|
7432
|
+
if (pts.length < 2)
|
|
7433
|
+
return;
|
|
7434
|
+
for (let i = 0; i < pts.length - 1; i++) {
|
|
7435
|
+
const a = pts[i];
|
|
7436
|
+
const b = pts[i + 1];
|
|
7437
|
+
const segMinX = Math.min(a.x, b.x);
|
|
7438
|
+
const segMinY = Math.min(a.y, b.y);
|
|
7439
|
+
const lineW = Math.max(0.01, Math.abs(b.x - a.x));
|
|
7440
|
+
const lineH = Math.max(0.01, Math.abs(b.y - a.y));
|
|
7441
|
+
const isLast = i === pts.length - 2;
|
|
7442
|
+
pptxSlide.addShape(pptx.ShapeType.line, {
|
|
7443
|
+
x: segMinX,
|
|
7444
|
+
y: segMinY,
|
|
7445
|
+
w: lineW,
|
|
7446
|
+
h: lineH,
|
|
7447
|
+
flipH: b.x < a.x,
|
|
7448
|
+
flipV: b.y < a.y,
|
|
7449
|
+
line: {
|
|
7450
|
+
color: arrowColor,
|
|
7451
|
+
width: 2,
|
|
7452
|
+
endArrowType: isLast ? "triangle" : void 0,
|
|
7453
|
+
dashType: e.style === "dashed" ? "dash" : "solid"
|
|
7454
|
+
}
|
|
7455
|
+
});
|
|
7456
|
+
}
|
|
7426
7457
|
if (e.label) {
|
|
7427
|
-
const
|
|
7428
|
-
const
|
|
7458
|
+
const mid = pts[Math.floor(pts.length / 2)];
|
|
7459
|
+
const midX = mid.x;
|
|
7460
|
+
const midY = mid.y;
|
|
7429
7461
|
const pillW = Math.min(1.4, Math.max(0.7, e.label.length * 0.08 + 0.25));
|
|
7430
7462
|
pptxSlide.addShape(pptx.ShapeType.roundRect, {
|
|
7431
7463
|
x: midX - pillW / 2,
|
|
@@ -10646,12 +10678,7 @@ var PdfRenderer = class {
|
|
|
10646
10678
|
gap: 24
|
|
10647
10679
|
});
|
|
10648
10680
|
for (const node of slideLayout.nodes) {
|
|
10649
|
-
|
|
10650
|
-
const y = node.bounds.y * scaleY;
|
|
10651
|
-
const w = node.bounds.width * scaleX;
|
|
10652
|
-
if (y >= contentBottom - 8)
|
|
10653
|
-
continue;
|
|
10654
|
-
this.renderElement(doc, node.element, x, y, w, theme, presentation);
|
|
10681
|
+
this.paintLayoutNode(doc, node, scaleX, scaleY, theme, presentation, contentBottom);
|
|
10655
10682
|
}
|
|
10656
10683
|
const progressWidth = slideNum / totalSlides * pageWidth;
|
|
10657
10684
|
doc.rect(0, pageHeight - 4, progressWidth, 4).fill(theme.colors.primary);
|
|
@@ -10667,6 +10694,132 @@ var PdfRenderer = class {
|
|
|
10667
10694
|
align: "right"
|
|
10668
10695
|
});
|
|
10669
10696
|
}
|
|
10697
|
+
paintLayoutNode(doc, node, scaleX, scaleY, theme, presentation, contentBottom) {
|
|
10698
|
+
const el = node.element;
|
|
10699
|
+
const x = node.bounds.x * scaleX;
|
|
10700
|
+
const y = node.bounds.y * scaleY;
|
|
10701
|
+
const w = node.bounds.width * scaleX;
|
|
10702
|
+
const h = node.bounds.height * scaleY;
|
|
10703
|
+
if (y >= contentBottom - 8)
|
|
10704
|
+
return;
|
|
10705
|
+
const hasChildren = !!(node.children && node.children.length > 0);
|
|
10706
|
+
if (hasChildren && (el.type === "grid" || el.type === "stack" || el.type === "columns" || el.type === "column")) {
|
|
10707
|
+
for (const child of node.children) {
|
|
10708
|
+
this.paintLayoutNode(doc, child, scaleX, scaleY, theme, presentation, contentBottom);
|
|
10709
|
+
}
|
|
10710
|
+
return;
|
|
10711
|
+
}
|
|
10712
|
+
if (hasChildren && el.type === "card") {
|
|
10713
|
+
this.paintCardFrame(doc, el, x, y, w, h, theme);
|
|
10714
|
+
for (const child of node.children) {
|
|
10715
|
+
this.paintLayoutNode(doc, child, scaleX, scaleY, theme, presentation, contentBottom);
|
|
10716
|
+
}
|
|
10717
|
+
return;
|
|
10718
|
+
}
|
|
10719
|
+
if (hasChildren && el.type === "compare") {
|
|
10720
|
+
this.paintCompareFrame(doc, el, x, y, w, h, theme);
|
|
10721
|
+
for (const child of node.children) {
|
|
10722
|
+
this.paintLayoutNode(doc, child, scaleX, scaleY, theme, presentation, contentBottom);
|
|
10723
|
+
}
|
|
10724
|
+
return;
|
|
10725
|
+
}
|
|
10726
|
+
if (el.type === "hero") {
|
|
10727
|
+
this.paintHeroInBounds(doc, el, x, y, w, h, theme);
|
|
10728
|
+
if (hasChildren) {
|
|
10729
|
+
for (const child of node.children) {
|
|
10730
|
+
this.paintLayoutNode(doc, child, scaleX, scaleY, theme, presentation, contentBottom);
|
|
10731
|
+
}
|
|
10732
|
+
}
|
|
10733
|
+
return;
|
|
10734
|
+
}
|
|
10735
|
+
this.renderElement(doc, el, x, y, w, theme, presentation);
|
|
10736
|
+
}
|
|
10737
|
+
paintCardFrame(doc, card, x, y, width, height, theme) {
|
|
10738
|
+
const variantColor = this.getVariantColor(card.variant, theme);
|
|
10739
|
+
doc.save();
|
|
10740
|
+
doc.roundedRect(x, y, width, height, 8).fill(theme.colors.surface || "rgba(255,255,255,0.06)");
|
|
10741
|
+
doc.roundedRect(x, y, width, height, 8).lineWidth(1.5).strokeColor(variantColor).stroke();
|
|
10742
|
+
doc.restore();
|
|
10743
|
+
if (card.title) {
|
|
10744
|
+
doc.font(this.getPdfFont(theme, "bold")).fontSize(13).fillColor(variantColor).text(this.stripFormatting(card.title), x + 12, y + 10, {
|
|
10745
|
+
width: width - 24,
|
|
10746
|
+
height: 22,
|
|
10747
|
+
ellipsis: true
|
|
10748
|
+
});
|
|
10749
|
+
}
|
|
10750
|
+
}
|
|
10751
|
+
paintCompareFrame(doc, compare, x, y, width, height, theme) {
|
|
10752
|
+
const gap = 16;
|
|
10753
|
+
const colW = (width - gap) / 2;
|
|
10754
|
+
const leftColor = theme.colors.primary;
|
|
10755
|
+
const rightColor = theme.colors.accent || theme.colors.secondary || theme.colors.primary;
|
|
10756
|
+
doc.save();
|
|
10757
|
+
doc.roundedRect(x, y, colW, height, 8).fill(theme.colors.surface || "#151522");
|
|
10758
|
+
doc.roundedRect(x, y, colW, height, 8).lineWidth(1.4).strokeColor(theme.colors.border || "rgba(255,255,255,0.15)").stroke();
|
|
10759
|
+
doc.roundedRect(x + colW + gap, y, colW, height, 8).fill(theme.colors.surface || "#151522");
|
|
10760
|
+
doc.roundedRect(x + colW + gap, y, colW, height, 8).lineWidth(1.4).strokeColor(theme.colors.border || "rgba(255,255,255,0.15)").stroke();
|
|
10761
|
+
doc.restore();
|
|
10762
|
+
const midX = x + colW + gap / 2;
|
|
10763
|
+
const midY = y + height / 2;
|
|
10764
|
+
doc.circle(midX, midY, 14).fill(theme.colors.surface || "#151522");
|
|
10765
|
+
doc.circle(midX, midY, 14).lineWidth(1.2).strokeColor(theme.colors.primary).stroke();
|
|
10766
|
+
doc.font(this.getPdfFont(theme, "bold")).fontSize(9).fillColor(theme.colors.text).text("VS", midX - 12, midY - 4, { width: 24, align: "center" });
|
|
10767
|
+
if (compare.leftTitle) {
|
|
10768
|
+
doc.font(this.getPdfFont(theme, "bold")).fontSize(11).fillColor(leftColor).text(this.stripFormatting(compare.leftTitle), x + 10, y + 10, {
|
|
10769
|
+
width: colW - 20,
|
|
10770
|
+
height: 28,
|
|
10771
|
+
ellipsis: true
|
|
10772
|
+
});
|
|
10773
|
+
}
|
|
10774
|
+
if (compare.rightTitle) {
|
|
10775
|
+
doc.font(this.getPdfFont(theme, "bold")).fontSize(11).fillColor(rightColor).text(this.stripFormatting(compare.rightTitle), x + colW + gap + 10, y + 10, {
|
|
10776
|
+
width: colW - 20,
|
|
10777
|
+
height: 28,
|
|
10778
|
+
ellipsis: true
|
|
10779
|
+
});
|
|
10780
|
+
}
|
|
10781
|
+
}
|
|
10782
|
+
paintHeroInBounds(doc, hero, x, y, width, height, theme) {
|
|
10783
|
+
const align = hero.align || "center";
|
|
10784
|
+
const compact = height < 140;
|
|
10785
|
+
let curY = y;
|
|
10786
|
+
const maxY = y + height - 4;
|
|
10787
|
+
if (hero.badge && curY < maxY) {
|
|
10788
|
+
const label = this.stripFormatting(hero.badge).toUpperCase();
|
|
10789
|
+
doc.font(this.getPdfFont(theme, "bold")).fontSize(compact ? 8 : 9);
|
|
10790
|
+
const labelW = Math.min(width, Math.max(70, doc.widthOfString(label) + 24));
|
|
10791
|
+
const badgeX = align === "left" ? x : align === "right" ? x + width - labelW : x + (width - labelW) / 2;
|
|
10792
|
+
doc.roundedRect(badgeX, curY, labelW, compact ? 16 : 18, 9).lineWidth(1.2).strokeColor(theme.colors.primary).fillColor(theme.colors.surface || "#f8fafc").fillAndStroke();
|
|
10793
|
+
doc.font(this.getPdfFont(theme, "bold")).fontSize(compact ? 8 : 9).fillColor(theme.colors.primary).text(label, badgeX, curY + 3, { width: labelW, align: "center" });
|
|
10794
|
+
curY += compact ? 22 : 28;
|
|
10795
|
+
} else if (hero.tagline && curY < maxY) {
|
|
10796
|
+
doc.font(this.getPdfFont(theme, "bold")).fontSize(compact ? 10 : 11).fillColor(theme.colors.primary);
|
|
10797
|
+
doc.text(this.stripFormatting(hero.tagline).toUpperCase(), x, curY, { width, align });
|
|
10798
|
+
curY += 20;
|
|
10799
|
+
}
|
|
10800
|
+
if (curY < maxY) {
|
|
10801
|
+
const titleSize = compact ? themeSizeToPdfPoints(theme.typography.sizes?.h1, 44) : themeSizeToPdfPoints(theme.typography.sizes?.display, 56);
|
|
10802
|
+
doc.font(this.getPdfFont(theme, "bold")).fontSize(titleSize).fillColor(theme.colors.text);
|
|
10803
|
+
doc.text(this.stripFormatting(hero.title), x, curY, {
|
|
10804
|
+
width,
|
|
10805
|
+
height: Math.max(20, maxY - curY - (hero.subtitle ? 28 : 4)),
|
|
10806
|
+
lineGap: 4,
|
|
10807
|
+
align,
|
|
10808
|
+
ellipsis: true
|
|
10809
|
+
});
|
|
10810
|
+
curY += Math.min(maxY - curY, doc.heightOfString(this.stripFormatting(hero.title), { width }) + 8);
|
|
10811
|
+
}
|
|
10812
|
+
if (hero.subtitle && curY < maxY) {
|
|
10813
|
+
const subSize = themeSizeToPdfPoints(theme.typography.sizes?.body, 18);
|
|
10814
|
+
doc.font(this.getPdfFont(theme, "regular")).fontSize(compact ? subSize - 1 : subSize + 1).fillColor(theme.colors.muted || "#888888");
|
|
10815
|
+
doc.text(this.stripFormatting(hero.subtitle), x, curY, {
|
|
10816
|
+
width,
|
|
10817
|
+
height: Math.max(16, maxY - curY),
|
|
10818
|
+
align,
|
|
10819
|
+
ellipsis: true
|
|
10820
|
+
});
|
|
10821
|
+
}
|
|
10822
|
+
}
|
|
10670
10823
|
renderElement(doc, element, x, y, width, theme, presentation) {
|
|
10671
10824
|
switch (element.type) {
|
|
10672
10825
|
case "hero": {
|
|
@@ -11492,25 +11645,30 @@ var PdfRenderer = class {
|
|
|
11492
11645
|
const p2 = positions[e.to];
|
|
11493
11646
|
if (!p1 || !p2)
|
|
11494
11647
|
return;
|
|
11495
|
-
const
|
|
11496
|
-
|
|
11497
|
-
|
|
11498
|
-
const
|
|
11648
|
+
const pts = orthogonalEdgePoints(isLR, p1, p2, nodeW, nodeH);
|
|
11649
|
+
if (pts.length < 2)
|
|
11650
|
+
return;
|
|
11651
|
+
const last = pts[pts.length - 1];
|
|
11652
|
+
const prev = pts[pts.length - 2];
|
|
11499
11653
|
doc.save();
|
|
11500
11654
|
doc.lineWidth(1.5).strokeColor(arrowColor);
|
|
11501
11655
|
if (e.style === "dashed")
|
|
11502
11656
|
doc.dash(4, { space: 3 });
|
|
11503
|
-
doc.moveTo(
|
|
11657
|
+
doc.moveTo(pts[0].x, pts[0].y);
|
|
11658
|
+
for (let i = 1; i < pts.length; i++)
|
|
11659
|
+
doc.lineTo(pts[i].x, pts[i].y);
|
|
11660
|
+
doc.stroke();
|
|
11504
11661
|
doc.restore();
|
|
11505
|
-
const angle = Math.atan2(
|
|
11662
|
+
const angle = Math.atan2(last.y - prev.y, last.x - prev.x);
|
|
11506
11663
|
const headLen = 6;
|
|
11507
11664
|
doc.save();
|
|
11508
11665
|
doc.fillColor(arrowColor);
|
|
11509
|
-
doc.moveTo(
|
|
11666
|
+
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();
|
|
11510
11667
|
doc.restore();
|
|
11511
11668
|
if (e.label) {
|
|
11512
|
-
const
|
|
11513
|
-
const
|
|
11669
|
+
const mid = pts[Math.floor(pts.length / 2)];
|
|
11670
|
+
const midX = mid.x;
|
|
11671
|
+
const midY = mid.y;
|
|
11514
11672
|
const labelText = this.stripFormatting(e.label);
|
|
11515
11673
|
const labelW = Math.min(90, Math.max(45, labelText.length * 5.5 + 16));
|
|
11516
11674
|
doc.save();
|
|
@@ -11799,7 +11957,7 @@ function startDevServer(filePath, options = {}) {
|
|
|
11799
11957
|
// src/cli.ts
|
|
11800
11958
|
import { mkdirSync, readFileSync as readFileSync3, watch as fsWatch, writeFileSync } from "fs";
|
|
11801
11959
|
import { basename, dirname, extname, join, resolve as resolve3 } from "path";
|
|
11802
|
-
var VERSION = "0.1.
|
|
11960
|
+
var VERSION = "0.1.31";
|
|
11803
11961
|
function printHelp() {
|
|
11804
11962
|
return `
|
|
11805
11963
|
YumiaMD \u2014 Markdown-based presentation compiler (v${VERSION})
|
|
@@ -12443,6 +12601,7 @@ export {
|
|
|
12443
12601
|
parseYumia,
|
|
12444
12602
|
migrateMarkdownToNative,
|
|
12445
12603
|
computeDiagramLayout,
|
|
12604
|
+
orthogonalEdgePoints,
|
|
12446
12605
|
fitDiagramLabel,
|
|
12447
12606
|
estimateDiagramHeight,
|
|
12448
12607
|
longestDiagramLabel,
|
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.31";
|
|
13
13
|
declare function printHelp(): string;
|
|
14
14
|
declare function runCli(argv: string[]): Promise<{
|
|
15
15
|
exitCode: number;
|
package/dist/index.js
CHANGED
|
@@ -71,6 +71,7 @@ import {
|
|
|
71
71
|
nebulaTheme,
|
|
72
72
|
neoBrutalistTheme,
|
|
73
73
|
nordTheme,
|
|
74
|
+
orthogonalEdgePoints,
|
|
74
75
|
parse,
|
|
75
76
|
parseDataString,
|
|
76
77
|
parseHighlightLines,
|
|
@@ -91,7 +92,7 @@ import {
|
|
|
91
92
|
themeSizeToPptxPoints,
|
|
92
93
|
tokyoNightTheme,
|
|
93
94
|
validate
|
|
94
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-VMBKNPA7.js";
|
|
95
96
|
export {
|
|
96
97
|
DEFAULT_VIEWPORT,
|
|
97
98
|
DefaultLayoutEngine,
|
|
@@ -165,6 +166,7 @@ export {
|
|
|
165
166
|
nebulaTheme,
|
|
166
167
|
neoBrutalistTheme,
|
|
167
168
|
nordTheme,
|
|
169
|
+
orthogonalEdgePoints,
|
|
168
170
|
parse,
|
|
169
171
|
parseDataString,
|
|
170
172
|
parseHighlightLines,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yumiamd",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
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/renderer-pptx": "0.1.
|
|
31
|
-
"@yumiamd/
|
|
32
|
-
"@yumiamd/
|
|
33
|
-
"@yumiamd/
|
|
25
|
+
"@yumiamd/parser": "0.1.31",
|
|
26
|
+
"@yumiamd/renderer-pdf": "0.1.31",
|
|
27
|
+
"@yumiamd/core": "0.1.31",
|
|
28
|
+
"@yumiamd/ast": "0.1.31",
|
|
29
|
+
"@yumiamd/layout": "0.1.31",
|
|
30
|
+
"@yumiamd/renderer-pptx": "0.1.31",
|
|
31
|
+
"@yumiamd/renderer": "0.1.31",
|
|
32
|
+
"@yumiamd/theme": "0.1.31",
|
|
33
|
+
"@yumiamd/renderer-html": "0.1.31"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
36
36
|
"yumia",
|