yumiamd 0.1.35 → 0.1.37

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "./chunk-FUQWTKHG.js";
4
+ } from "./chunk-D2QBFJPO.js";
5
5
 
6
6
  // src/bin.ts
7
7
  var result = await runCli(process.argv);
@@ -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 + 0.25,
6533
+ x: rect.x + titleOffset,
6517
6534
  y: rect.y + 0.12,
6518
- w: rect.w - 0.5,
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 + 0.2,
6750
+ x: rect.x + titleOffset,
6719
6751
  y: rect.y + 0.16,
6720
- w: rect.w - 0.4,
6752
+ w: rect.w - titleOffset - 0.2,
6721
6753
  h: 0.3,
6722
6754
  fontSize: 13,
6723
6755
  bold: true,
@@ -8541,8 +8573,9 @@ var HtmlRenderer = class {
8541
8573
  .yumia-timeline {
8542
8574
  display: flex;
8543
8575
  gap: 16px;
8544
- margin: 1.2rem 0;
8576
+ margin: 1.5rem 0 1.8rem 0;
8545
8577
  width: 100%;
8578
+ box-sizing: border-box;
8546
8579
  }
8547
8580
  .yumia-timeline.layout-horizontal {
8548
8581
  flex-direction: row;
@@ -8567,6 +8600,7 @@ var HtmlRenderer = class {
8567
8600
  align-items: center;
8568
8601
  text-align: center;
8569
8602
  flex: 1;
8603
+ padding: 0 10px;
8570
8604
  }
8571
8605
  .yumia-timeline-dot {
8572
8606
  width: 14px;
@@ -8594,6 +8628,7 @@ var HtmlRenderer = class {
8594
8628
  font-size: 0.85rem;
8595
8629
  color: var(--yumia-muted);
8596
8630
  line-height: 1.4;
8631
+ max-width: 240px;
8597
8632
  }
8598
8633
 
8599
8634
  /* Compare Directive */
@@ -9685,7 +9720,9 @@ var HtmlRenderer = class {
9685
9720
  const c = element;
9686
9721
  const sev = c.severity || "info";
9687
9722
  const colorVar = sev === "warning" ? "var(--yumia-warning)" : sev === "danger" ? "var(--yumia-danger)" : sev === "success" ? "var(--yumia-success)" : "var(--yumia-info)";
9688
- const titleHtml = c.title ? `<div style="font-weight:700; font-size:1.05rem; color:${colorVar}; margin-bottom:4px;">${this.formatInline(c.title)}</div>` : "";
9723
+ const iconSvg = c.icon ? defaultIconResolver.toSvg(c.icon, 20, colorVar, "yumia-callout-icon") : "";
9724
+ const iconSpan = iconSvg ? `<span style="display:inline-flex; align-items:center; margin-right:8px; vertical-align:middle;">${iconSvg}</span>` : "";
9725
+ 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
9726
  return `
9690
9727
  <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
9728
  ${titleHtml}
@@ -9860,7 +9897,9 @@ var HtmlRenderer = class {
9860
9897
  case "card": {
9861
9898
  const card = element;
9862
9899
  const variant = card.variant || "default";
9863
- const titleHtml = card.title ? `<div class="yumia-card-title">${this.escapeHtml(card.title)}</div>` : "";
9900
+ const iconSvg = card.icon ? defaultIconResolver.toSvg(card.icon, 20, "currentColor", "yumia-card-icon") : "";
9901
+ const iconHtml = iconSvg ? `<span class="yumia-card-icon" style="display:inline-flex; align-items:center; vertical-align:middle;">${iconSvg}</span>` : "";
9902
+ 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
9903
  const innerHtml = card.elements ? card.elements.map((child) => this.renderElement(child, theme)).join("\n") : "";
9865
9904
  return `
9866
9905
  <div class="yumia-card" data-variant="${variant}">
@@ -10930,9 +10969,20 @@ var PdfRenderer = class {
10930
10969
  doc.roundedRect(x, y, width, totalH, 6).fill(theme.colors.surface || "#151522");
10931
10970
  doc.rect(x, y, 4, totalH).fill(sevColor);
10932
10971
  let curY = y + 8;
10972
+ let titleOffset = 16;
10973
+ if (c.icon) {
10974
+ try {
10975
+ const raster = rasterizeIcon(c.icon, 18, sevColor);
10976
+ doc.image(raster.png, x + 16, curY - 1, { width: 16, height: 16 });
10977
+ titleOffset = 38;
10978
+ } catch {
10979
+ }
10980
+ }
10933
10981
  if (c.title) {
10934
10982
  doc.font(this.getPdfFont(theme, "bold")).fontSize(12).fillColor(sevColor);
10935
- doc.text(this.stripFormatting(c.title), x + 16, curY, { width: width - 26 });
10983
+ doc.text(this.stripFormatting(c.title), x + titleOffset, curY, {
10984
+ width: width - titleOffset - 10
10985
+ });
10936
10986
  curY += 18;
10937
10987
  }
10938
10988
  doc.font(this.getPdfFont(theme, "regular")).fontSize(12).fillColor(theme.colors.text);
@@ -11112,11 +11162,22 @@ var PdfRenderer = class {
11112
11162
  doc.roundedRect(x, y, width, totalCardHeight, 8).lineWidth(1.5).strokeColor(variantColor).stroke();
11113
11163
  doc.restore();
11114
11164
  let renderTop = y + cardPad;
11165
+ let titleOffset = cardPad;
11166
+ if (card.icon) {
11167
+ try {
11168
+ const raster = rasterizeIcon(card.icon, 20, variantColor);
11169
+ doc.image(raster.png, x + cardPad, renderTop - 1, { width: 16, height: 16 });
11170
+ titleOffset = cardPad + 22;
11171
+ } catch {
11172
+ }
11173
+ }
11115
11174
  if (card.title) {
11116
- doc.font(this.getPdfFont(theme, "bold")).fontSize(15).fillColor(variantColor).text(this.stripFormatting(card.title), x + cardPad, renderTop, {
11117
- width: width - cardPad * 2
11175
+ doc.font(this.getPdfFont(theme, "bold")).fontSize(15).fillColor(variantColor).text(this.stripFormatting(card.title), x + titleOffset, renderTop, {
11176
+ width: width - cardPad - titleOffset
11118
11177
  });
11119
- renderTop += doc.heightOfString(this.stripFormatting(card.title), { width: width - cardPad * 2 }) + 8;
11178
+ renderTop += doc.heightOfString(this.stripFormatting(card.title), {
11179
+ width: width - cardPad - titleOffset
11180
+ }) + 8;
11120
11181
  }
11121
11182
  if (card.elements) {
11122
11183
  for (const child of card.elements) {
@@ -12059,7 +12120,7 @@ function startDevServer(filePath, options = {}) {
12059
12120
  // src/cli.ts
12060
12121
  import { mkdirSync, readFileSync as readFileSync3, watch as fsWatch, writeFileSync } from "fs";
12061
12122
  import { basename, dirname, extname, join, resolve as resolve3 } from "path";
12062
- var VERSION = "0.1.35";
12123
+ var VERSION = "0.1.37";
12063
12124
  function printHelp() {
12064
12125
  return `
12065
12126
  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.35";
12
+ declare const VERSION = "0.1.37";
13
13
  declare function printHelp(): string;
14
14
  declare function runCli(argv: string[]): Promise<{
15
15
  exitCode: number;
package/dist/index.js CHANGED
@@ -92,7 +92,7 @@ import {
92
92
  themeSizeToPptxPoints,
93
93
  tokyoNightTheme,
94
94
  validate
95
- } from "./chunk-FUQWTKHG.js";
95
+ } from "./chunk-D2QBFJPO.js";
96
96
  export {
97
97
  DEFAULT_VIEWPORT,
98
98
  DefaultLayoutEngine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yumiamd",
3
- "version": "0.1.35",
3
+ "version": "0.1.37",
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.35",
26
- "@yumiamd/core": "0.1.35",
27
- "@yumiamd/renderer-html": "0.1.35",
28
- "@yumiamd/parser": "0.1.35",
29
- "@yumiamd/renderer": "0.1.35",
30
- "@yumiamd/renderer-pptx": "0.1.35",
31
- "@yumiamd/renderer-pdf": "0.1.35",
32
- "@yumiamd/layout": "0.1.35",
33
- "@yumiamd/theme": "0.1.35"
25
+ "@yumiamd/ast": "0.1.37",
26
+ "@yumiamd/layout": "0.1.37",
27
+ "@yumiamd/parser": "0.1.37",
28
+ "@yumiamd/renderer-html": "0.1.37",
29
+ "@yumiamd/renderer-pdf": "0.1.37",
30
+ "@yumiamd/renderer-pptx": "0.1.37",
31
+ "@yumiamd/theme": "0.1.37",
32
+ "@yumiamd/core": "0.1.37",
33
+ "@yumiamd/renderer": "0.1.37"
34
34
  },
35
35
  "keywords": [
36
36
  "yumia",