@hirokisakabe/pom 6.0.3 → 6.1.0

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/README.md CHANGED
@@ -69,26 +69,26 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
69
69
 
70
70
  ## Available Nodes
71
71
 
72
- | Node | Description |
73
- | ------------ | ---------------------------------------------- |
74
- | Text | Text with font styling and decoration |
75
- | Ul | Unordered (bullet) list with Li items |
76
- | Ol | Ordered (numbered) list with Li items |
77
- | Image | Images from file path, URL, or base64 |
78
- | Table | Tables with customizable columns and rows |
79
- | Shape | PowerPoint shapes (roundRect, ellipse, etc.) |
80
- | Chart | Charts (bar, line, pie, area, doughnut, radar) |
81
- | Timeline | Timeline / roadmap visualizations |
82
- | Matrix | 2x2 positioning maps |
83
- | Tree | Organization charts and decision trees |
84
- | Flow | Flowcharts with nodes and edges |
85
- | ProcessArrow | Chevron-style process diagrams |
86
- | Pyramid | Pyramid diagrams for hierarchies |
87
- | Line | Horizontal / vertical lines |
88
- | Layer | Absolute-positioned overlay container |
89
- | VStack | Vertical stack layout |
90
- | HStack | Horizontal stack layout |
91
- | Icon | Lucide icons / inline SVG |
72
+ | Node | Description |
73
+ | ------------ | ---------------------------------------------------------- |
74
+ | Text | Text with font styling, decoration, and inline bold/italic |
75
+ | Ul | Unordered (bullet) list with Li items |
76
+ | Ol | Ordered (numbered) list with Li items |
77
+ | Image | Images from file path, URL, or base64 |
78
+ | Table | Tables with customizable columns and rows |
79
+ | Shape | PowerPoint shapes (roundRect, ellipse, etc.) |
80
+ | Chart | Charts (bar, line, pie, area, doughnut, radar) |
81
+ | Timeline | Timeline / roadmap visualizations |
82
+ | Matrix | 2x2 positioning maps |
83
+ | Tree | Organization charts and decision trees |
84
+ | Flow | Flowcharts with nodes and edges |
85
+ | ProcessArrow | Chevron-style process diagrams |
86
+ | Pyramid | Pyramid diagrams for hierarchies |
87
+ | Line | Horizontal / vertical lines |
88
+ | Layer | Absolute-positioned overlay container |
89
+ | VStack | Vertical stack layout |
90
+ | HStack | Horizontal stack layout |
91
+ | Icon | Lucide icons / inline SVG |
92
92
 
93
93
  For detailed node documentation, see [Nodes](./docs/nodes.md).
94
94
 
@@ -1 +1 @@
1
- {"version":3,"file":"coercionRules.d.ts","sourceRoot":"","sources":["../../src/parseXml/coercionRules.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,MAAM,GACN;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,YAAY,EAAE,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;CAAE,CAAC;AAI5D,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,YAAY,GACjB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAyD1C;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,EAAE,GACtB,OAAO,CAuCT;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAarD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,YAAY,GACjB,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,SAAS,CAY1C;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAQpE;AA8HD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CA0I1E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,CAC7C,MAAM,EACN,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CA+E7B,CAAC"}
@@ -469,4 +469,6 @@ export const CHILD_ELEMENT_COERCION_MAP = {
469
469
  fontSize: "number",
470
470
  fontFamily: "string",
471
471
  },
472
+ B: {},
473
+ I: {},
472
474
  };
@@ -1 +1 @@
1
- {"version":3,"file":"parseXml.d.ts","sourceRoot":"","sources":["../../src/parseXml/parseXml.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,OAAO,EAgBb,MAAM,aAAa,CAAC;AAYrB,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,MAAM,EAAE,MAAM,EAAE,CAAC;gBACrB,MAAM,EAAE,MAAM,EAAE;CAM7B;AAGD,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmB9C,CAAC;AA67BF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,CAiCrD"}
1
+ {"version":3,"file":"parseXml.d.ts","sourceRoot":"","sources":["../../src/parseXml/parseXml.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,OAAO,EAgBb,MAAM,aAAa,CAAC;AAYrB,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,MAAM,EAAE,MAAM,EAAE,CAAC;gBACrB,MAAM,EAAE,MAAM,EAAE;CAM7B;AAGD,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmB9C,CAAC;AA2hCF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,CAiCrD"}
@@ -284,6 +284,48 @@ function getTextContent(node) {
284
284
  }
285
285
  return textParts.length > 0 ? textParts.join("") : undefined;
286
286
  }
287
+ function getRawChildren(node) {
288
+ const tagName = getTagName(node);
289
+ return node[tagName] ?? [];
290
+ }
291
+ const INLINE_FORMAT_TAGS = new Set(["B", "I"]);
292
+ function hasInlineFormatChildren(childElements) {
293
+ return (childElements.length > 0 &&
294
+ childElements.every((el) => INLINE_FORMAT_TAGS.has(getTagName(el))));
295
+ }
296
+ function extractTextRuns(children, inheritBold, inheritItalic) {
297
+ const runs = [];
298
+ for (const child of children) {
299
+ if (isTextNode(child)) {
300
+ const run = { text: child["#text"] };
301
+ if (inheritBold)
302
+ run.bold = true;
303
+ if (inheritItalic)
304
+ run.italic = true;
305
+ runs.push(run);
306
+ }
307
+ else {
308
+ const tag = getTagName(child);
309
+ const innerChildren = getRawChildren(child);
310
+ if (tag === "B") {
311
+ runs.push(...extractTextRuns(innerChildren, true, inheritItalic));
312
+ }
313
+ else if (tag === "I") {
314
+ runs.push(...extractTextRuns(innerChildren, inheritBold, true));
315
+ }
316
+ }
317
+ }
318
+ return runs;
319
+ }
320
+ function buildRunsAndText(node) {
321
+ const rawChildren = getRawChildren(node);
322
+ const childElements = rawChildren.filter((c) => !isTextNode(c));
323
+ if (!hasInlineFormatChildren(childElements))
324
+ return null;
325
+ const runs = extractTextRuns(rawChildren);
326
+ const text = runs.map((r) => r.text).join("");
327
+ return { runs, text };
328
+ }
287
329
  function coerceChildAttrs(parentTagName, tagName, attrs, errors) {
288
330
  const rules = CHILD_ELEMENT_COERCION_MAP[tagName];
289
331
  const result = {};
@@ -487,9 +529,16 @@ function convertTableChildren(childElements, result, errors) {
487
529
  continue;
488
530
  }
489
531
  const cellAttrs = coerceChildAttrs("TableRow", cellTag, getAttributes(cellEl), errors);
490
- const cellText = getTextContent(cellEl);
491
- if (cellText !== undefined && !("text" in cellAttrs)) {
492
- cellAttrs.text = cellText;
532
+ const runsResult = buildRunsAndText(cellEl);
533
+ if (runsResult) {
534
+ cellAttrs.runs = runsResult.runs;
535
+ cellAttrs.text = runsResult.text;
536
+ }
537
+ else {
538
+ const cellText = getTextContent(cellEl);
539
+ if (cellText !== undefined && !("text" in cellAttrs)) {
540
+ cellAttrs.text = cellText;
541
+ }
493
542
  }
494
543
  cells.push(cellAttrs);
495
544
  }
@@ -571,9 +620,16 @@ function convertListChildren(parentTag, childElements, result, errors) {
571
620
  continue;
572
621
  }
573
622
  const attrs = coerceChildAttrs(parentTag, tag, getAttributes(child), errors);
574
- const textContent = getTextContent(child);
575
- if (textContent !== undefined && !("text" in attrs)) {
576
- attrs.text = textContent;
623
+ const runsResult = buildRunsAndText(child);
624
+ if (runsResult) {
625
+ attrs.runs = runsResult.runs;
626
+ attrs.text = runsResult.text;
627
+ }
628
+ else {
629
+ const textContent = getTextContent(child);
630
+ if (textContent !== undefined && !("text" in attrs)) {
631
+ attrs.text = textContent;
632
+ }
577
633
  }
578
634
  items.push(attrs);
579
635
  }
@@ -606,7 +662,25 @@ function convertIconChildren(childElements, result, errors) {
606
662
  }
607
663
  result.svgContent = serializeSvgElement(child);
608
664
  }
665
+ function convertTextInlineChildren(childElements, result, errors, node) {
666
+ // B/I 以外の子要素がある場合はエラー
667
+ for (const el of childElements) {
668
+ const tag = getTagName(el);
669
+ if (!INLINE_FORMAT_TAGS.has(tag)) {
670
+ errors.push(`<Text>: Unexpected child element <${tag}>. Only <B> and <I> are allowed inside <Text>`);
671
+ return;
672
+ }
673
+ }
674
+ if (!node || childElements.length === 0)
675
+ return;
676
+ const runsResult = buildRunsAndText(node);
677
+ if (runsResult) {
678
+ result.runs = runsResult.runs;
679
+ result.text = runsResult.text;
680
+ }
681
+ }
609
682
  const CHILD_ELEMENT_CONVERTERS = {
683
+ text: convertTextInlineChildren,
610
684
  ul: (childElements, result, errors) => convertListChildren("Ul", childElements, result, errors),
611
685
  ol: (childElements, result, errors) => convertListChildren("Ol", childElements, result, errors),
612
686
  processArrow: convertProcessArrowChildren,
@@ -627,14 +701,14 @@ function convertElement(node, errors) {
627
701
  const childElements = getChildElements(node);
628
702
  const textContent = getTextContent(node);
629
703
  if (nodeType) {
630
- return convertPomNode(nodeType, tagName, attrs, childElements, textContent, errors);
704
+ return convertPomNode(nodeType, tagName, attrs, childElements, textContent, errors, node);
631
705
  }
632
706
  else {
633
707
  errors.push(`Unknown tag: <${tagName}>`);
634
708
  return null;
635
709
  }
636
710
  }
637
- function convertPomNode(nodeType, tagName, attrs, childElements, textContent, errors) {
711
+ function convertPomNode(nodeType, tagName, attrs, childElements, textContent, errors, xmlNode) {
638
712
  const result = { type: nodeType };
639
713
  // Expand dot-notation attributes (e.g., fill.color="hex" → { fill: { color: "hex" } })
640
714
  const { regular: regularAttrs, dotGroups } = expandDotNotation(attrs);
@@ -708,7 +782,7 @@ function convertPomNode(nodeType, tagName, attrs, childElements, textContent, er
708
782
  // Child element notation for complex properties
709
783
  const childConverter = CHILD_ELEMENT_CONVERTERS[nodeType];
710
784
  if (childConverter && childElements.length > 0) {
711
- childConverter(childElements, result, errors);
785
+ childConverter(childElements, result, errors, xmlNode);
712
786
  }
713
787
  // Children for container nodes
714
788
  else if (CONTAINER_TYPES.has(nodeType) && childElements.length > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAU,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,KAAK,gBAAgB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAChE,KAAK,gBAAgB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AA6BhE,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CA4D7E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAkE7E"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAU,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,KAAK,gBAAgB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAChE,KAAK,gBAAgB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AAgFhE,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CA4C7E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAkD7E"}
@@ -13,6 +13,52 @@ function resolveStyle(li, parent) {
13
13
  fontFamily: li.fontFamily ?? parent.fontFamily ?? "Noto Sans JP",
14
14
  };
15
15
  }
16
+ function buildListTextItems(items, parent, bullet) {
17
+ const textItems = [];
18
+ for (let i = 0; i < items.length; i++) {
19
+ const li = items[i];
20
+ const style = resolveStyle(li, parent);
21
+ const isLast = i === items.length - 1;
22
+ const baseOptions = {
23
+ fontSize: pxToPt(style.fontSize),
24
+ fontFace: style.fontFamily,
25
+ color: style.color,
26
+ underline: convertUnderline(style.underline),
27
+ strike: convertStrike(style.strike),
28
+ highlight: style.highlight,
29
+ };
30
+ if (li.runs && li.runs.length > 0) {
31
+ for (let j = 0; j < li.runs.length; j++) {
32
+ const run = li.runs[j];
33
+ const isLastRun = j === li.runs.length - 1;
34
+ let text = run.text;
35
+ if (isLastRun && !isLast)
36
+ text += "\n";
37
+ textItems.push({
38
+ text,
39
+ options: {
40
+ ...baseOptions,
41
+ bold: run.bold ?? style.bold,
42
+ italic: run.italic ?? style.italic,
43
+ bullet: j === 0 ? bullet : false,
44
+ },
45
+ });
46
+ }
47
+ }
48
+ else {
49
+ textItems.push({
50
+ text: isLast ? li.text : li.text + "\n",
51
+ options: {
52
+ ...baseOptions,
53
+ bold: style.bold,
54
+ italic: style.italic,
55
+ bullet,
56
+ },
57
+ });
58
+ }
59
+ }
60
+ return textItems;
61
+ }
16
62
  function hasItemStyleOverride(items) {
17
63
  return items.some((li) => li.fontSize !== undefined ||
18
64
  li.color !== undefined ||
@@ -21,7 +67,8 @@ function hasItemStyleOverride(items) {
21
67
  li.underline !== undefined ||
22
68
  li.strike !== undefined ||
23
69
  li.highlight !== undefined ||
24
- li.fontFamily !== undefined);
70
+ li.fontFamily !== undefined ||
71
+ li.runs !== undefined);
25
72
  }
26
73
  export function renderUlNode(node, ctx) {
27
74
  const fontSizePx = node.fontSize ?? 24;
@@ -30,23 +77,7 @@ export function renderUlNode(node, ctx) {
30
77
  const content = getContentArea(node);
31
78
  if (hasItemStyleOverride(node.items)) {
32
79
  // Li に個別スタイルがある場合は配列形式を使用
33
- const textItems = node.items.map((li, i) => {
34
- const style = resolveStyle(li, node);
35
- return {
36
- text: i < node.items.length - 1 ? li.text + "\n" : li.text,
37
- options: {
38
- fontSize: pxToPt(style.fontSize),
39
- fontFace: style.fontFamily,
40
- color: style.color,
41
- bold: style.bold,
42
- italic: style.italic,
43
- underline: convertUnderline(style.underline),
44
- strike: convertStrike(style.strike),
45
- highlight: style.highlight,
46
- bullet: true,
47
- },
48
- };
49
- });
80
+ const textItems = buildListTextItems(node.items, node, true);
50
81
  ctx.slide.addText(textItems, {
51
82
  x: pxToIn(content.x),
52
83
  y: pxToIn(content.y),
@@ -95,23 +126,7 @@ export function renderOlNode(node, ctx) {
95
126
  bulletOptions.numberStartAt = node.numberStartAt;
96
127
  }
97
128
  if (hasItemStyleOverride(node.items)) {
98
- const textItems = node.items.map((li, i) => {
99
- const style = resolveStyle(li, node);
100
- return {
101
- text: i < node.items.length - 1 ? li.text + "\n" : li.text,
102
- options: {
103
- fontSize: pxToPt(style.fontSize),
104
- fontFace: style.fontFamily,
105
- color: style.color,
106
- bold: style.bold,
107
- italic: style.italic,
108
- underline: convertUnderline(style.underline),
109
- strike: convertStrike(style.strike),
110
- highlight: style.highlight,
111
- bullet: bulletOptions,
112
- },
113
- };
114
- });
129
+ const textItems = buildListTextItems(node.items, node, bulletOptions);
115
130
  ctx.slide.addText(textItems, {
116
131
  x: pxToIn(content.x),
117
132
  y: pxToIn(content.y),
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AASjD,KAAK,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,aAAa,GACjB,IAAI,CAsCN"}
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AASjD,KAAK,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtE,wBAAgB,eAAe,CAC7B,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,aAAa,GACjB,IAAI,CAgEN"}
@@ -19,6 +19,31 @@ export function renderTableNode(node, ctx) {
19
19
  colspan: cell.colspan,
20
20
  rowspan: cell.rowspan,
21
21
  };
22
+ if (cell.runs && cell.runs.length > 0) {
23
+ const textItems = cell.runs.map((run) => ({
24
+ text: run.text,
25
+ options: {
26
+ fontSize: pxToPt(cell.fontSize ?? 18),
27
+ color: cell.color,
28
+ bold: run.bold ?? cell.bold,
29
+ italic: run.italic ?? cell.italic,
30
+ underline: convertUnderline(cell.underline),
31
+ strike: convertStrike(cell.strike),
32
+ highlight: cell.highlight,
33
+ },
34
+ }));
35
+ return {
36
+ text: textItems,
37
+ options: {
38
+ align: cell.textAlign ?? "left",
39
+ fill: cell.backgroundColor
40
+ ? { color: cell.backgroundColor }
41
+ : undefined,
42
+ colspan: cell.colspan,
43
+ rowspan: cell.rowspan,
44
+ },
45
+ };
46
+ }
22
47
  return {
23
48
  text: cell.text,
24
49
  options: cellOptions,
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,KAAK,kBAAkB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEpE,wBAAgB,cAAc,CAC5B,IAAI,EAAE,kBAAkB,EACxB,GAAG,EAAE,aAAa,GACjB,IAAI,CAGN"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQjD,KAAK,kBAAkB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEpE,wBAAgB,cAAc,CAC5B,IAAI,EAAE,kBAAkB,EACxB,GAAG,EAAE,aAAa,GACjB,IAAI,CAgCN"}
@@ -1,5 +1,35 @@
1
- import { createTextOptions } from "../textOptions.js";
1
+ import { createTextOptions, convertUnderline, convertStrike, } from "../textOptions.js";
2
+ import { pxToPt } from "../units.js";
2
3
  export function renderTextNode(node, ctx) {
3
4
  const textOptions = createTextOptions(node);
4
- ctx.slide.addText(node.text ?? "", textOptions);
5
+ if (node.runs && node.runs.length > 0) {
6
+ const fontSizePx = node.fontSize ?? 24;
7
+ const fontFamily = node.fontFamily ?? "Noto Sans JP";
8
+ const textItems = node.runs.map((run) => ({
9
+ text: run.text,
10
+ options: {
11
+ fontSize: pxToPt(fontSizePx),
12
+ fontFace: fontFamily,
13
+ color: node.color,
14
+ bold: run.bold ?? node.bold,
15
+ italic: run.italic ?? node.italic,
16
+ underline: convertUnderline(node.underline),
17
+ strike: convertStrike(node.strike),
18
+ highlight: node.highlight,
19
+ },
20
+ }));
21
+ ctx.slide.addText(textItems, {
22
+ x: textOptions.x,
23
+ y: textOptions.y,
24
+ w: textOptions.w,
25
+ h: textOptions.h,
26
+ align: textOptions.align,
27
+ valign: textOptions.valign,
28
+ margin: textOptions.margin,
29
+ lineSpacingMultiple: textOptions.lineSpacingMultiple,
30
+ });
31
+ }
32
+ else {
33
+ ctx.slide.addText(node.text ?? "", textOptions);
34
+ }
5
35
  }
package/dist/types.d.ts CHANGED
@@ -216,6 +216,11 @@ export declare const textNodeSchema: z.ZodObject<{
216
216
  }, z.core.$strip>>;
217
217
  type: z.ZodLiteral<"text">;
218
218
  text: z.ZodString;
219
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
220
+ text: z.ZodString;
221
+ bold: z.ZodOptional<z.ZodBoolean>;
222
+ italic: z.ZodOptional<z.ZodBoolean>;
223
+ }, z.core.$strip>>>;
219
224
  fontSize: z.ZodOptional<z.ZodNumber>;
220
225
  color: z.ZodOptional<z.ZodString>;
221
226
  textAlign: z.ZodOptional<z.ZodEnum<{
@@ -252,6 +257,11 @@ export declare const textNodeSchema: z.ZodObject<{
252
257
  }, z.core.$strip>;
253
258
  export declare const liNodeSchema: z.ZodObject<{
254
259
  text: z.ZodString;
260
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
261
+ text: z.ZodString;
262
+ bold: z.ZodOptional<z.ZodBoolean>;
263
+ italic: z.ZodOptional<z.ZodBoolean>;
264
+ }, z.core.$strip>>>;
255
265
  bold: z.ZodOptional<z.ZodBoolean>;
256
266
  italic: z.ZodOptional<z.ZodBoolean>;
257
267
  underline: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
@@ -353,6 +363,11 @@ export declare const ulNodeSchema: z.ZodObject<{
353
363
  type: z.ZodLiteral<"ul">;
354
364
  items: z.ZodArray<z.ZodObject<{
355
365
  text: z.ZodString;
366
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
367
+ text: z.ZodString;
368
+ bold: z.ZodOptional<z.ZodBoolean>;
369
+ italic: z.ZodOptional<z.ZodBoolean>;
370
+ }, z.core.$strip>>>;
356
371
  bold: z.ZodOptional<z.ZodBoolean>;
357
372
  italic: z.ZodOptional<z.ZodBoolean>;
358
373
  underline: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
@@ -488,6 +503,11 @@ export declare const olNodeSchema: z.ZodObject<{
488
503
  type: z.ZodLiteral<"ol">;
489
504
  items: z.ZodArray<z.ZodObject<{
490
505
  text: z.ZodString;
506
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
507
+ text: z.ZodString;
508
+ bold: z.ZodOptional<z.ZodBoolean>;
509
+ italic: z.ZodOptional<z.ZodBoolean>;
510
+ }, z.core.$strip>>>;
491
511
  bold: z.ZodOptional<z.ZodBoolean>;
492
512
  italic: z.ZodOptional<z.ZodBoolean>;
493
513
  underline: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
@@ -816,6 +836,11 @@ export declare const tableNodeSchema: z.ZodObject<{
816
836
  rows: z.ZodArray<z.ZodObject<{
817
837
  cells: z.ZodArray<z.ZodObject<{
818
838
  text: z.ZodString;
839
+ runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
840
+ text: z.ZodString;
841
+ bold: z.ZodOptional<z.ZodBoolean>;
842
+ italic: z.ZodOptional<z.ZodBoolean>;
843
+ }, z.core.$strip>>>;
819
844
  fontSize: z.ZodOptional<z.ZodNumber>;
820
845
  color: z.ZodOptional<z.ZodString>;
821
846
  bold: z.ZodOptional<z.ZodBoolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0CxB,eAAO,MAAM,iBAAiB;;;;;;;;;;iBAO5B,CAAC;AAqBH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;EAgB/B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;mBAM1B,CAAC;AAEH,QAAA,MAAM,gBAAgB;;;;;EAAgD,CAAC;AAMvE,QAAA,MAAM,cAAc;;;;EAA4C,CAAC;AAEjE,QAAA,MAAM,oBAAoB;;;;;;;EAOxB,CAAC;AAwLH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAWxD,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsB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;AAEH,QAAA,MAAM,uBAAuB;;;;;mBAQ3B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMnC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
package/dist/types.js CHANGED
@@ -306,10 +306,17 @@ const basePOMNodeSchema = z.object({
306
306
  alignSelf: alignSelfSchema.optional(),
307
307
  shadow: shadowStyleSchema.optional(),
308
308
  });
309
+ // ===== Inline text run (partial bold/italic within a text node) =====
310
+ const textRunSchema = z.object({
311
+ text: z.string(),
312
+ bold: z.boolean().optional(),
313
+ italic: z.boolean().optional(),
314
+ });
309
315
  // ===== Non-recursive Node Types =====
310
316
  export const textNodeSchema = basePOMNodeSchema.extend({
311
317
  type: z.literal("text"),
312
318
  text: z.string(),
319
+ runs: z.array(textRunSchema).optional(),
313
320
  fontSize: z.number().optional(),
314
321
  color: z.string().optional(),
315
322
  textAlign: z.enum(["left", "center", "right"]).optional(),
@@ -323,6 +330,7 @@ export const textNodeSchema = basePOMNodeSchema.extend({
323
330
  });
324
331
  export const liNodeSchema = z.object({
325
332
  text: z.string(),
333
+ runs: z.array(textRunSchema).optional(),
326
334
  bold: z.boolean().optional(),
327
335
  italic: z.boolean().optional(),
328
336
  underline: underlineSchema.optional(),
@@ -398,6 +406,7 @@ export const iconNodeSchema = basePOMNodeSchema.extend({
398
406
  });
399
407
  const tableCellSchema = z.object({
400
408
  text: z.string(),
409
+ runs: z.array(textRunSchema).optional(),
401
410
  fontSize: z.number().optional(),
402
411
  color: z.string().optional(),
403
412
  bold: z.boolean().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hirokisakabe/pom",
3
- "version": "6.0.3",
3
+ "version": "6.1.0",
4
4
  "description": "AI-friendly PowerPoint generation with a Flexbox layout engine.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -51,7 +51,6 @@
51
51
  "@types/pngjs": "6.0.5",
52
52
  "@vitest/coverage-v8": "^4.1.0",
53
53
  "@vitest/ui": "^4.1.0",
54
- "knip": "^5.85.0",
55
54
  "lucide-static": "^0.577.0",
56
55
  "pixelmatch": "7.1.0",
57
56
  "pngjs": "7.0.0",