yumiamd 0.1.22 → 0.1.23

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-KNQTEIHN.js";
4
+ } from "./chunk-GKERS3TA.js";
5
5
 
6
6
  // src/bin.ts
7
7
  var result = await runCli(process.argv);
@@ -31,12 +31,13 @@ function createList(items, ordered = false) {
31
31
  items: normalizedItems
32
32
  };
33
33
  }
34
- function createImage(src, alt, caption) {
34
+ function createImage(src, alt, caption, options) {
35
35
  return {
36
36
  type: "image",
37
37
  src,
38
38
  ...alt ? { alt } : {},
39
- ...caption ? { caption } : {}
39
+ ...caption ? { caption } : {},
40
+ ...options || {}
40
41
  };
41
42
  }
42
43
  function createCard(elements, title, variant) {
@@ -1501,6 +1502,147 @@ var NativeYumiaParser = class {
1501
1502
  }
1502
1503
  return { element: createList(items, false), nextIdx };
1503
1504
  }
1505
+ case "image":
1506
+ case "img": {
1507
+ const srcMatch = tok.args.match(/^(?:src=)?["']([^"']+)["']/);
1508
+ const altMatch = tok.args.match(/\balt=["']([^"']+)["']/);
1509
+ const capMatch = tok.args.match(/\bcaption=["']([^"']+)["']/);
1510
+ const fitMatch = tok.args.match(/\bfit=["']?([^"'\s]+)["']?/);
1511
+ const widthMatch = tok.args.match(/\bwidth=["']?([^"'\s]+)["']?/);
1512
+ const heightMatch = tok.args.match(/\bheight=["']?([^"'\s]+)["']?/);
1513
+ const radiusMatch = tok.args.match(/\bradius=["']?([^"'\s]+)["']?/);
1514
+ const aspectMatch = tok.args.match(/\baspect=["']?([^"'\s]+)["']?/);
1515
+ const src = srcMatch ? srcMatch[1] : this.stripQuotes(tok.args);
1516
+ return {
1517
+ element: createImage(src, altMatch ? altMatch[1] : void 0, capMatch ? capMatch[1] : void 0, {
1518
+ fit: fitMatch ? fitMatch[1] : void 0,
1519
+ width: widthMatch ? widthMatch[1] : void 0,
1520
+ height: heightMatch ? heightMatch[1] : void 0,
1521
+ radius: radiusMatch ? radiusMatch[1] : void 0,
1522
+ aspectRatio: aspectMatch ? aspectMatch[1] : void 0
1523
+ }),
1524
+ nextIdx: idx + 1
1525
+ };
1526
+ }
1527
+ case "chart": {
1528
+ const typeMatch = tok.args.match(/type=["']?([^"'\s]+)["']?/);
1529
+ const titleMatch = tok.args.match(/title=["']([^"']+)["']/);
1530
+ const chartType = typeMatch ? typeMatch[1] : "bar";
1531
+ const title = titleMatch ? titleMatch[1] : void 0;
1532
+ const labels = [];
1533
+ const series = [];
1534
+ let nextIdx = idx + 1;
1535
+ while (nextIdx < tokens.length && tokens[nextIdx].indent > baseIndent) {
1536
+ const sub = tokens[nextIdx];
1537
+ if (sub.command === "labels") {
1538
+ const rawLabels = sub.args.split(",").map((l) => this.stripQuotes(l.trim()));
1539
+ labels.push(...rawLabels);
1540
+ } else if (sub.command === "series") {
1541
+ const sNameMatch = sub.args.match(/^["']?([^:"']+):/);
1542
+ const name = sNameMatch ? sNameMatch[1].trim() : "Series";
1543
+ const dataStr = sub.args.replace(/^["']?[^:"']+:?\s*/, "").replace(/["']$/, "");
1544
+ const values = dataStr.split(",").map((v) => parseFloat(v.trim())).filter((v) => !isNaN(v));
1545
+ series.push({ name, values });
1546
+ }
1547
+ nextIdx++;
1548
+ }
1549
+ if (labels.length === 0)
1550
+ labels.push("A", "B", "C");
1551
+ if (series.length === 0)
1552
+ series.push({ name: "Data", values: [10, 20, 30] });
1553
+ return { element: createChart(chartType, labels, series, title), nextIdx };
1554
+ }
1555
+ case "compare": {
1556
+ const leftTitleMatch = tok.args.match(/left(?:Title)?=["']([^"']+)["']/);
1557
+ const rightTitleMatch = tok.args.match(/right(?:Title)?=["']([^"']+)["']/);
1558
+ const leftTitle = leftTitleMatch ? leftTitleMatch[1] : void 0;
1559
+ const rightTitle = rightTitleMatch ? rightTitleMatch[1] : void 0;
1560
+ const leftEls = [];
1561
+ const rightEls = [];
1562
+ let currentSide = "left";
1563
+ let nextIdx = idx + 1;
1564
+ while (nextIdx < tokens.length && tokens[nextIdx].indent > baseIndent) {
1565
+ const sub = tokens[nextIdx];
1566
+ if (sub.command === "left") {
1567
+ currentSide = "left";
1568
+ nextIdx++;
1569
+ continue;
1570
+ } else if (sub.command === "right") {
1571
+ currentSide = "right";
1572
+ nextIdx++;
1573
+ continue;
1574
+ }
1575
+ const childRes = this.parseElement(tokens, nextIdx);
1576
+ if (childRes) {
1577
+ if (currentSide === "left")
1578
+ leftEls.push(childRes.element);
1579
+ else
1580
+ rightEls.push(childRes.element);
1581
+ nextIdx = childRes.nextIdx;
1582
+ } else {
1583
+ nextIdx++;
1584
+ }
1585
+ }
1586
+ return { element: createCompare(leftEls, rightEls, leftTitle, rightTitle), nextIdx };
1587
+ }
1588
+ case "timeline": {
1589
+ const layoutMatch = tok.args.match(/layout=["']?(horizontal|vertical)["']?/);
1590
+ const layout = layoutMatch ? layoutMatch[1] : "horizontal";
1591
+ const items = [];
1592
+ let nextIdx = idx + 1;
1593
+ while (nextIdx < tokens.length && tokens[nextIdx].indent > baseIndent) {
1594
+ const sub = tokens[nextIdx];
1595
+ if (sub.command === "item") {
1596
+ const dateMatch = sub.args.match(/date=["']([^"']+)["']/);
1597
+ const titleMatch = sub.args.match(/title=["']([^"']+)["']/);
1598
+ const descMatch = sub.args.match(/desc(?:ription)?=["']([^"']+)["']/);
1599
+ items.push({
1600
+ date: dateMatch ? dateMatch[1] : "2026",
1601
+ title: titleMatch ? titleMatch[1] : "Milestone",
1602
+ description: descMatch ? descMatch[1] : void 0
1603
+ });
1604
+ }
1605
+ nextIdx++;
1606
+ }
1607
+ return { element: createTimeline(items, layout), nextIdx };
1608
+ }
1609
+ case "mermaid": {
1610
+ const mLines = [];
1611
+ let nextIdx = idx + 1;
1612
+ while (nextIdx < tokens.length && tokens[nextIdx].indent > baseIndent) {
1613
+ mLines.push(tokens[nextIdx].text);
1614
+ nextIdx++;
1615
+ }
1616
+ return { element: createMermaid(mLines.join("\n")), nextIdx };
1617
+ }
1618
+ case "math": {
1619
+ let expr = this.stripQuotes(tok.args);
1620
+ let nextIdx = idx + 1;
1621
+ if (!expr) {
1622
+ const mathLines = [];
1623
+ while (nextIdx < tokens.length && tokens[nextIdx].indent > baseIndent) {
1624
+ mathLines.push(tokens[nextIdx].text);
1625
+ nextIdx++;
1626
+ }
1627
+ expr = mathLines.join("\n");
1628
+ }
1629
+ return { element: createMath(expr), nextIdx };
1630
+ }
1631
+ case "table": {
1632
+ let headers = void 0;
1633
+ const rows = [];
1634
+ let nextIdx = idx + 1;
1635
+ while (nextIdx < tokens.length && tokens[nextIdx].indent > baseIndent) {
1636
+ const sub = tokens[nextIdx];
1637
+ if (sub.command === "headers" || sub.command === "header") {
1638
+ headers = sub.args.split(",").map((h) => this.stripQuotes(h.trim()));
1639
+ } else if (sub.command === "row") {
1640
+ rows.push(sub.args.split(",").map((c) => this.stripQuotes(c.trim())));
1641
+ }
1642
+ nextIdx++;
1643
+ }
1644
+ return { element: createTable(rows, headers), nextIdx };
1645
+ }
1504
1646
  case "quote": {
1505
1647
  const authorMatch = tok.args.match(/\bauthor=["']([^"']+)["']/);
1506
1648
  const textLines = [];
@@ -4798,6 +4940,7 @@ var HtmlRenderer = class {
4798
4940
  <title>${this.escapeHtml(title)}</title>
4799
4941
  <link rel="preconnect" href="https://fonts.googleapis.com">
4800
4942
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
4943
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;900&family=Fira+Code:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:ital,wght@0,400;0,600;0,700;0,800;1,400&family=Orbitron:wght@500;700;900&family=Outfit:wght@400;500;600;700;800;900&family=Playfair+Display:ital,wght@0,500;0,700;0,900;1,400;1,700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@400;600;700&display=swap">
4801
4944
  ${customStyles}
4802
4945
  ${customScripts}
4803
4946
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" crossorigin="anonymous">
@@ -6372,8 +6515,8 @@ var HtmlRenderer = class {
6372
6515
  const transition = slide.transition || "fade";
6373
6516
  const transType = typeof transition === "string" ? transition : transition.type;
6374
6517
  const transClass = `transition-${transType || "fade"}`;
6375
- const isWatermarkEnabled = watermarkOpt !== false;
6376
- const watermarkText = typeof watermarkOpt === "string" && watermarkOpt.trim().length > 0 ? watermarkOpt : "YumiaMD";
6518
+ const isWatermarkEnabled = watermarkOpt !== void 0 && watermarkOpt !== false && watermarkOpt !== "none" && watermarkOpt !== "false" && watermarkOpt !== "off";
6519
+ const watermarkText = typeof watermarkOpt === "string" && watermarkOpt.trim().length > 0 && watermarkOpt !== "true" && watermarkOpt !== "yes" && watermarkOpt !== "on" ? watermarkOpt : "Yumia";
6377
6520
  const watermarkHtml = isWatermarkEnabled ? `<div class="yumia-watermark">${this.escapeHtml(watermarkText)}</div>` : "";
6378
6521
  const elementsHtml = slide.elements.map((el) => this.renderElement(el, theme, presentation)).join("\n");
6379
6522
  return `
@@ -6525,7 +6668,18 @@ var HtmlRenderer = class {
6525
6668
  case "image": {
6526
6669
  const img = element;
6527
6670
  const alt = img.alt ? `alt="${this.escapeHtml(img.alt)}"` : "";
6528
- return `<img src="${this.escapeHtml(img.src)}" ${alt} style="max-width: 100%; border-radius: 8px;">`;
6671
+ const width = img.width ? typeof img.width === "number" ? `${img.width}px` : img.width : "100%";
6672
+ const height = img.height ? typeof img.height === "number" ? `${img.height}px` : img.height : "auto";
6673
+ const fit = img.fit || "cover";
6674
+ const radius = img.radius !== void 0 ? typeof img.radius === "number" ? `${img.radius}px` : img.radius : "var(--yumia-radius-card)";
6675
+ const shadowStyle = img.shadow ? "box-shadow: 0 12px 30px rgba(0,0,0,0.45);" : "";
6676
+ const aspect = img.aspectRatio ? `aspect-ratio: ${img.aspectRatio};` : "";
6677
+ const cap = img.caption ? `<figcaption style="margin-top: 6px; font-size: 0.85rem; color: var(--yumia-muted); text-align: center;">${this.formatInline(img.caption)}</figcaption>` : "";
6678
+ return `
6679
+ <figure class="yumia-image-wrapper" style="margin: 0.4rem 0; width: ${width}; max-width: 100%; display: flex; flex-direction: column; align-items: center;">
6680
+ <img src="${this.escapeHtml(img.src)}" ${alt} style="width: 100%; height: ${height}; object-fit: ${fit}; border-radius: ${radius}; ${aspect} ${shadowStyle} border: 1.5px solid var(--yumia-border);">
6681
+ ${cap}
6682
+ </figure>`;
6529
6683
  }
6530
6684
  case "metric": {
6531
6685
  const m = element;
@@ -7421,7 +7575,7 @@ function startDevServer(filePath, options = {}) {
7421
7575
  // src/cli.ts
7422
7576
  import { mkdirSync, readFileSync as readFileSync2, watch as fsWatch, writeFileSync } from "fs";
7423
7577
  import { basename, dirname, extname, join, resolve as resolve2 } from "path";
7424
- var VERSION = "0.1.22";
7578
+ var VERSION = "0.1.23";
7425
7579
  function printHelp() {
7426
7580
  return `
7427
7581
  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.22";
12
+ declare const VERSION = "0.1.23";
13
13
  declare function printHelp(): string;
14
14
  declare function runCli(argv: string[]): Promise<{
15
15
  exitCode: number;
package/dist/index.js CHANGED
@@ -66,7 +66,7 @@ import {
66
66
  terminalTheme,
67
67
  tokyoNightTheme,
68
68
  validate
69
- } from "./chunk-KNQTEIHN.js";
69
+ } from "./chunk-GKERS3TA.js";
70
70
  export {
71
71
  DEFAULT_VIEWPORT,
72
72
  DefaultLayoutEngine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yumiamd",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Command line interface and compiler for YumiaMD presentations",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,15 +21,15 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "tsup": "^8.5.1",
24
- "@yumiamd/ast": "0.1.22",
25
- "@yumiamd/layout": "0.1.22",
26
- "@yumiamd/renderer-html": "0.1.22",
27
- "@yumiamd/core": "0.1.22",
28
- "@yumiamd/renderer": "0.1.22",
29
- "@yumiamd/renderer-pdf": "0.1.22",
30
- "@yumiamd/parser": "0.1.22",
31
- "@yumiamd/theme": "0.1.22",
32
- "@yumiamd/renderer-pptx": "0.1.22"
24
+ "@yumiamd/ast": "0.1.23",
25
+ "@yumiamd/core": "0.1.23",
26
+ "@yumiamd/parser": "0.1.23",
27
+ "@yumiamd/layout": "0.1.23",
28
+ "@yumiamd/renderer": "0.1.23",
29
+ "@yumiamd/renderer-html": "0.1.23",
30
+ "@yumiamd/renderer-pdf": "0.1.23",
31
+ "@yumiamd/renderer-pptx": "0.1.23",
32
+ "@yumiamd/theme": "0.1.23"
33
33
  },
34
34
  "keywords": [
35
35
  "yumia",