yumiamd 0.1.35 → 0.1.36
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-FUQWTKHG.js → chunk-EZEUXKPI.js} +72 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +10 -10
package/dist/bin.js
CHANGED
|
@@ -40,12 +40,13 @@ function createImage(src, alt, caption, options) {
|
|
|
40
40
|
...options || {}
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function createCard(elements, title, variant) {
|
|
43
|
+
function createCard(elements, title, variant, icon) {
|
|
44
44
|
return {
|
|
45
45
|
type: "card",
|
|
46
46
|
elements,
|
|
47
47
|
...title ? { title } : {},
|
|
48
|
-
...variant ? { variant } : {}
|
|
48
|
+
...variant ? { variant } : {},
|
|
49
|
+
...icon ? { icon } : {}
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
52
|
function createMetric(value, label, variant, description, unit, change) {
|
|
@@ -1890,6 +1891,7 @@ var NativeYumiaParser = class {
|
|
|
1890
1891
|
case "card": {
|
|
1891
1892
|
const titleVal = this.extractAttr(tok.args, "title");
|
|
1892
1893
|
const variantVal = this.extractAttr(tok.args, "variant");
|
|
1894
|
+
const iconVal = this.extractAttr(tok.args, "icon");
|
|
1893
1895
|
const title = titleVal ?? (this.stripQuotes(tok.args) || void 0);
|
|
1894
1896
|
const variant = variantVal ? variantVal : "default";
|
|
1895
1897
|
const children = [];
|
|
@@ -1903,7 +1905,7 @@ var NativeYumiaParser = class {
|
|
|
1903
1905
|
nextIdx++;
|
|
1904
1906
|
}
|
|
1905
1907
|
}
|
|
1906
|
-
return { element: createCard(children, title, variant), nextIdx };
|
|
1908
|
+
return { element: createCard(children, title, variant, iconVal), nextIdx };
|
|
1907
1909
|
}
|
|
1908
1910
|
case "column": {
|
|
1909
1911
|
const children = [];
|
|
@@ -6511,11 +6513,26 @@ var PptxRenderer = class {
|
|
|
6511
6513
|
fill: { color: borderColor },
|
|
6512
6514
|
rectRadius: 0.03
|
|
6513
6515
|
});
|
|
6516
|
+
let titleOffset = 0.25;
|
|
6517
|
+
if (card.icon) {
|
|
6518
|
+
try {
|
|
6519
|
+
const raster = rasterizeIcon(card.icon, 32, "#" + titleColor);
|
|
6520
|
+
pptxSlide.addImage({
|
|
6521
|
+
data: `image/png;base64,${raster.png.toString("base64")}`,
|
|
6522
|
+
x: rect.x + 0.22,
|
|
6523
|
+
y: rect.y + 0.14,
|
|
6524
|
+
w: 0.24,
|
|
6525
|
+
h: 0.24
|
|
6526
|
+
});
|
|
6527
|
+
titleOffset = 0.52;
|
|
6528
|
+
} catch {
|
|
6529
|
+
}
|
|
6530
|
+
}
|
|
6514
6531
|
if (card.title) {
|
|
6515
6532
|
pptxSlide.addText(card.title, {
|
|
6516
|
-
x: rect.x +
|
|
6533
|
+
x: rect.x + titleOffset,
|
|
6517
6534
|
y: rect.y + 0.12,
|
|
6518
|
-
w: rect.w - 0.
|
|
6535
|
+
w: rect.w - titleOffset - 0.25,
|
|
6519
6536
|
h: 0.3,
|
|
6520
6537
|
fontSize: themeSizeToPptxPoints(theme.typography.sizes?.h4, 22),
|
|
6521
6538
|
bold: true,
|
|
@@ -6712,12 +6729,27 @@ var PptxRenderer = class {
|
|
|
6712
6729
|
line: { color: sevColor, width: 2 },
|
|
6713
6730
|
rectRadius: 0.08
|
|
6714
6731
|
});
|
|
6732
|
+
let titleOffset = 0.2;
|
|
6733
|
+
if (callout.icon) {
|
|
6734
|
+
try {
|
|
6735
|
+
const raster = rasterizeIcon(callout.icon, 32, "#" + sevColor);
|
|
6736
|
+
pptxSlide.addImage({
|
|
6737
|
+
data: `image/png;base64,${raster.png.toString("base64")}`,
|
|
6738
|
+
x: rect.x + 0.2,
|
|
6739
|
+
y: rect.y + 0.16,
|
|
6740
|
+
w: 0.22,
|
|
6741
|
+
h: 0.22
|
|
6742
|
+
});
|
|
6743
|
+
titleOffset = 0.48;
|
|
6744
|
+
} catch {
|
|
6745
|
+
}
|
|
6746
|
+
}
|
|
6715
6747
|
const titleH = callout.title ? 0.38 : 0;
|
|
6716
6748
|
if (callout.title) {
|
|
6717
6749
|
pptxSlide.addText(callout.title, {
|
|
6718
|
-
x: rect.x +
|
|
6750
|
+
x: rect.x + titleOffset,
|
|
6719
6751
|
y: rect.y + 0.16,
|
|
6720
|
-
w: rect.w - 0.
|
|
6752
|
+
w: rect.w - titleOffset - 0.2,
|
|
6721
6753
|
h: 0.3,
|
|
6722
6754
|
fontSize: 13,
|
|
6723
6755
|
bold: true,
|
|
@@ -9685,7 +9717,9 @@ var HtmlRenderer = class {
|
|
|
9685
9717
|
const c = element;
|
|
9686
9718
|
const sev = c.severity || "info";
|
|
9687
9719
|
const colorVar = sev === "warning" ? "var(--yumia-warning)" : sev === "danger" ? "var(--yumia-danger)" : sev === "success" ? "var(--yumia-success)" : "var(--yumia-info)";
|
|
9688
|
-
const
|
|
9720
|
+
const iconSvg = c.icon ? defaultIconResolver.toSvg(c.icon, 20, colorVar, "yumia-callout-icon") : "";
|
|
9721
|
+
const iconSpan = iconSvg ? `<span style="display:inline-flex; align-items:center; margin-right:8px; vertical-align:middle;">${iconSvg}</span>` : "";
|
|
9722
|
+
const titleHtml = c.title ? `<div style="font-weight:700; font-size:1.05rem; color:${colorVar}; margin-bottom:4px; display:flex; align-items:center;">${iconSpan}${this.formatInline(c.title)}</div>` : iconSpan ? `<div style="margin-bottom:4px;">${iconSpan}</div>` : "";
|
|
9689
9723
|
return `
|
|
9690
9724
|
<div class="yumia-callout" data-severity="${sev}" data-yumia-role="callout" style="background:var(--yumia-surface); border-left:4px solid ${colorVar}; border-radius:var(--yumia-radius-card); padding:1rem 1.4rem; margin:0.8rem 0; width:100%; display:flex; flex-direction:column; gap:6px; box-sizing:border-box;">
|
|
9691
9725
|
${titleHtml}
|
|
@@ -9860,7 +9894,9 @@ var HtmlRenderer = class {
|
|
|
9860
9894
|
case "card": {
|
|
9861
9895
|
const card = element;
|
|
9862
9896
|
const variant = card.variant || "default";
|
|
9863
|
-
const
|
|
9897
|
+
const iconSvg = card.icon ? defaultIconResolver.toSvg(card.icon, 20, "currentColor", "yumia-card-icon") : "";
|
|
9898
|
+
const iconHtml = iconSvg ? `<span class="yumia-card-icon" style="display:inline-flex; align-items:center; vertical-align:middle;">${iconSvg}</span>` : "";
|
|
9899
|
+
const titleHtml = card.title ? `<div class="yumia-card-title" style="display:flex; align-items:center; gap:8px;">${iconHtml}<span>${this.escapeHtml(card.title)}</span></div>` : iconHtml ? `<div class="yumia-card-title">${iconHtml}</div>` : "";
|
|
9864
9900
|
const innerHtml = card.elements ? card.elements.map((child) => this.renderElement(child, theme)).join("\n") : "";
|
|
9865
9901
|
return `
|
|
9866
9902
|
<div class="yumia-card" data-variant="${variant}">
|
|
@@ -10930,9 +10966,20 @@ var PdfRenderer = class {
|
|
|
10930
10966
|
doc.roundedRect(x, y, width, totalH, 6).fill(theme.colors.surface || "#151522");
|
|
10931
10967
|
doc.rect(x, y, 4, totalH).fill(sevColor);
|
|
10932
10968
|
let curY = y + 8;
|
|
10969
|
+
let titleOffset = 16;
|
|
10970
|
+
if (c.icon) {
|
|
10971
|
+
try {
|
|
10972
|
+
const raster = rasterizeIcon(c.icon, 18, sevColor);
|
|
10973
|
+
doc.image(raster.png, x + 16, curY - 1, { width: 16, height: 16 });
|
|
10974
|
+
titleOffset = 38;
|
|
10975
|
+
} catch {
|
|
10976
|
+
}
|
|
10977
|
+
}
|
|
10933
10978
|
if (c.title) {
|
|
10934
10979
|
doc.font(this.getPdfFont(theme, "bold")).fontSize(12).fillColor(sevColor);
|
|
10935
|
-
doc.text(this.stripFormatting(c.title), x +
|
|
10980
|
+
doc.text(this.stripFormatting(c.title), x + titleOffset, curY, {
|
|
10981
|
+
width: width - titleOffset - 10
|
|
10982
|
+
});
|
|
10936
10983
|
curY += 18;
|
|
10937
10984
|
}
|
|
10938
10985
|
doc.font(this.getPdfFont(theme, "regular")).fontSize(12).fillColor(theme.colors.text);
|
|
@@ -11112,11 +11159,22 @@ var PdfRenderer = class {
|
|
|
11112
11159
|
doc.roundedRect(x, y, width, totalCardHeight, 8).lineWidth(1.5).strokeColor(variantColor).stroke();
|
|
11113
11160
|
doc.restore();
|
|
11114
11161
|
let renderTop = y + cardPad;
|
|
11162
|
+
let titleOffset = cardPad;
|
|
11163
|
+
if (card.icon) {
|
|
11164
|
+
try {
|
|
11165
|
+
const raster = rasterizeIcon(card.icon, 20, variantColor);
|
|
11166
|
+
doc.image(raster.png, x + cardPad, renderTop - 1, { width: 16, height: 16 });
|
|
11167
|
+
titleOffset = cardPad + 22;
|
|
11168
|
+
} catch {
|
|
11169
|
+
}
|
|
11170
|
+
}
|
|
11115
11171
|
if (card.title) {
|
|
11116
|
-
doc.font(this.getPdfFont(theme, "bold")).fontSize(15).fillColor(variantColor).text(this.stripFormatting(card.title), x +
|
|
11117
|
-
width: width - cardPad
|
|
11172
|
+
doc.font(this.getPdfFont(theme, "bold")).fontSize(15).fillColor(variantColor).text(this.stripFormatting(card.title), x + titleOffset, renderTop, {
|
|
11173
|
+
width: width - cardPad - titleOffset
|
|
11118
11174
|
});
|
|
11119
|
-
renderTop += doc.heightOfString(this.stripFormatting(card.title), {
|
|
11175
|
+
renderTop += doc.heightOfString(this.stripFormatting(card.title), {
|
|
11176
|
+
width: width - cardPad - titleOffset
|
|
11177
|
+
}) + 8;
|
|
11120
11178
|
}
|
|
11121
11179
|
if (card.elements) {
|
|
11122
11180
|
for (const child of card.elements) {
|
|
@@ -12059,7 +12117,7 @@ function startDevServer(filePath, options = {}) {
|
|
|
12059
12117
|
// src/cli.ts
|
|
12060
12118
|
import { mkdirSync, readFileSync as readFileSync3, watch as fsWatch, writeFileSync } from "fs";
|
|
12061
12119
|
import { basename, dirname, extname, join, resolve as resolve3 } from "path";
|
|
12062
|
-
var VERSION = "0.1.
|
|
12120
|
+
var VERSION = "0.1.36";
|
|
12063
12121
|
function printHelp() {
|
|
12064
12122
|
return `
|
|
12065
12123
|
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.36";
|
|
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.36",
|
|
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/ast": "0.1.
|
|
26
|
-
"@yumiamd/
|
|
27
|
-
"@yumiamd/renderer-
|
|
28
|
-
"@yumiamd/
|
|
29
|
-
"@yumiamd/renderer": "0.1.
|
|
30
|
-
"@yumiamd/
|
|
31
|
-
"@yumiamd/renderer-
|
|
32
|
-
"@yumiamd/
|
|
33
|
-
"@yumiamd/theme": "0.1.
|
|
25
|
+
"@yumiamd/ast": "0.1.36",
|
|
26
|
+
"@yumiamd/layout": "0.1.36",
|
|
27
|
+
"@yumiamd/renderer-pdf": "0.1.36",
|
|
28
|
+
"@yumiamd/core": "0.1.36",
|
|
29
|
+
"@yumiamd/renderer": "0.1.36",
|
|
30
|
+
"@yumiamd/parser": "0.1.36",
|
|
31
|
+
"@yumiamd/renderer-pptx": "0.1.36",
|
|
32
|
+
"@yumiamd/renderer-html": "0.1.36",
|
|
33
|
+
"@yumiamd/theme": "0.1.36"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
36
36
|
"yumia",
|