@hirokisakabe/pom 6.0.3 → 6.2.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 +20 -20
- package/dist/parseXml/coercionRules.d.ts.map +1 -1
- package/dist/parseXml/coercionRules.js +2 -0
- package/dist/parseXml/parseXml.d.ts.map +1 -1
- package/dist/parseXml/parseXml.js +89 -9
- package/dist/renderPptx/nodes/list.d.ts.map +1 -1
- package/dist/renderPptx/nodes/list.js +51 -35
- package/dist/renderPptx/nodes/table.d.ts.map +1 -1
- package/dist/renderPptx/nodes/table.js +26 -0
- package/dist/renderPptx/nodes/text.d.ts.map +1 -1
- package/dist/renderPptx/nodes/text.js +33 -2
- package/dist/types.d.ts +30 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -0
- package/package.json +1 -2
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
|
|
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, inline bold/italic, and hyperlinks |
|
|
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,Y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,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,CAAC;AAGF,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAC7C,MAAM,EACN,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CA+E7B,CAAC"}
|
|
@@ -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;
|
|
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;AA2iCF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,CAiCrD"}
|
|
@@ -284,6 +284,54 @@ 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", "A"]);
|
|
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, inheritHref) {
|
|
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
|
+
if (inheritHref)
|
|
306
|
+
run.href = inheritHref;
|
|
307
|
+
runs.push(run);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
const tag = getTagName(child);
|
|
311
|
+
const innerChildren = getRawChildren(child);
|
|
312
|
+
if (tag === "B") {
|
|
313
|
+
runs.push(...extractTextRuns(innerChildren, true, inheritItalic, inheritHref));
|
|
314
|
+
}
|
|
315
|
+
else if (tag === "I") {
|
|
316
|
+
runs.push(...extractTextRuns(innerChildren, inheritBold, true, inheritHref));
|
|
317
|
+
}
|
|
318
|
+
else if (tag === "A") {
|
|
319
|
+
const href = getAttributes(child).href ?? "";
|
|
320
|
+
runs.push(...extractTextRuns(innerChildren, inheritBold, inheritItalic, href));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return runs;
|
|
325
|
+
}
|
|
326
|
+
function buildRunsAndText(node) {
|
|
327
|
+
const rawChildren = getRawChildren(node);
|
|
328
|
+
const childElements = rawChildren.filter((c) => !isTextNode(c));
|
|
329
|
+
if (!hasInlineFormatChildren(childElements))
|
|
330
|
+
return null;
|
|
331
|
+
const runs = extractTextRuns(rawChildren);
|
|
332
|
+
const text = runs.map((r) => r.text).join("");
|
|
333
|
+
return { runs, text };
|
|
334
|
+
}
|
|
287
335
|
function coerceChildAttrs(parentTagName, tagName, attrs, errors) {
|
|
288
336
|
const rules = CHILD_ELEMENT_COERCION_MAP[tagName];
|
|
289
337
|
const result = {};
|
|
@@ -487,9 +535,16 @@ function convertTableChildren(childElements, result, errors) {
|
|
|
487
535
|
continue;
|
|
488
536
|
}
|
|
489
537
|
const cellAttrs = coerceChildAttrs("TableRow", cellTag, getAttributes(cellEl), errors);
|
|
490
|
-
const
|
|
491
|
-
if (
|
|
492
|
-
cellAttrs.
|
|
538
|
+
const runsResult = buildRunsAndText(cellEl);
|
|
539
|
+
if (runsResult) {
|
|
540
|
+
cellAttrs.runs = runsResult.runs;
|
|
541
|
+
cellAttrs.text = runsResult.text;
|
|
542
|
+
}
|
|
543
|
+
else {
|
|
544
|
+
const cellText = getTextContent(cellEl);
|
|
545
|
+
if (cellText !== undefined && !("text" in cellAttrs)) {
|
|
546
|
+
cellAttrs.text = cellText;
|
|
547
|
+
}
|
|
493
548
|
}
|
|
494
549
|
cells.push(cellAttrs);
|
|
495
550
|
}
|
|
@@ -571,9 +626,16 @@ function convertListChildren(parentTag, childElements, result, errors) {
|
|
|
571
626
|
continue;
|
|
572
627
|
}
|
|
573
628
|
const attrs = coerceChildAttrs(parentTag, tag, getAttributes(child), errors);
|
|
574
|
-
const
|
|
575
|
-
if (
|
|
576
|
-
attrs.
|
|
629
|
+
const runsResult = buildRunsAndText(child);
|
|
630
|
+
if (runsResult) {
|
|
631
|
+
attrs.runs = runsResult.runs;
|
|
632
|
+
attrs.text = runsResult.text;
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
const textContent = getTextContent(child);
|
|
636
|
+
if (textContent !== undefined && !("text" in attrs)) {
|
|
637
|
+
attrs.text = textContent;
|
|
638
|
+
}
|
|
577
639
|
}
|
|
578
640
|
items.push(attrs);
|
|
579
641
|
}
|
|
@@ -606,7 +668,25 @@ function convertIconChildren(childElements, result, errors) {
|
|
|
606
668
|
}
|
|
607
669
|
result.svgContent = serializeSvgElement(child);
|
|
608
670
|
}
|
|
671
|
+
function convertTextInlineChildren(childElements, result, errors, node) {
|
|
672
|
+
// B/I/A 以外の子要素がある場合はエラー
|
|
673
|
+
for (const el of childElements) {
|
|
674
|
+
const tag = getTagName(el);
|
|
675
|
+
if (!INLINE_FORMAT_TAGS.has(tag)) {
|
|
676
|
+
errors.push(`<Text>: Unexpected child element <${tag}>. Only <B>, <I>, and <A> are allowed inside <Text>`);
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
if (!node || childElements.length === 0)
|
|
681
|
+
return;
|
|
682
|
+
const runsResult = buildRunsAndText(node);
|
|
683
|
+
if (runsResult) {
|
|
684
|
+
result.runs = runsResult.runs;
|
|
685
|
+
result.text = runsResult.text;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
609
688
|
const CHILD_ELEMENT_CONVERTERS = {
|
|
689
|
+
text: convertTextInlineChildren,
|
|
610
690
|
ul: (childElements, result, errors) => convertListChildren("Ul", childElements, result, errors),
|
|
611
691
|
ol: (childElements, result, errors) => convertListChildren("Ol", childElements, result, errors),
|
|
612
692
|
processArrow: convertProcessArrowChildren,
|
|
@@ -627,14 +707,14 @@ function convertElement(node, errors) {
|
|
|
627
707
|
const childElements = getChildElements(node);
|
|
628
708
|
const textContent = getTextContent(node);
|
|
629
709
|
if (nodeType) {
|
|
630
|
-
return convertPomNode(nodeType, tagName, attrs, childElements, textContent, errors);
|
|
710
|
+
return convertPomNode(nodeType, tagName, attrs, childElements, textContent, errors, node);
|
|
631
711
|
}
|
|
632
712
|
else {
|
|
633
713
|
errors.push(`Unknown tag: <${tagName}>`);
|
|
634
714
|
return null;
|
|
635
715
|
}
|
|
636
716
|
}
|
|
637
|
-
function convertPomNode(nodeType, tagName, attrs, childElements, textContent, errors) {
|
|
717
|
+
function convertPomNode(nodeType, tagName, attrs, childElements, textContent, errors, xmlNode) {
|
|
638
718
|
const result = { type: nodeType };
|
|
639
719
|
// Expand dot-notation attributes (e.g., fill.color="hex" → { fill: { color: "hex" } })
|
|
640
720
|
const { regular: regularAttrs, dotGroups } = expandDotNotation(attrs);
|
|
@@ -708,7 +788,7 @@ function convertPomNode(nodeType, tagName, attrs, childElements, textContent, er
|
|
|
708
788
|
// Child element notation for complex properties
|
|
709
789
|
const childConverter = CHILD_ELEMENT_CONVERTERS[nodeType];
|
|
710
790
|
if (childConverter && childElements.length > 0) {
|
|
711
|
-
childConverter(childElements, result, errors);
|
|
791
|
+
childConverter(childElements, result, errors, xmlNode);
|
|
712
792
|
}
|
|
713
793
|
// Children for container nodes
|
|
714
794
|
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;
|
|
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;AAiFhE,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,53 @@ 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
|
+
...(run.href ? { hyperlink: { url: run.href } } : {}),
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
textItems.push({
|
|
51
|
+
text: isLast ? li.text : li.text + "\n",
|
|
52
|
+
options: {
|
|
53
|
+
...baseOptions,
|
|
54
|
+
bold: style.bold,
|
|
55
|
+
italic: style.italic,
|
|
56
|
+
bullet,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return textItems;
|
|
62
|
+
}
|
|
16
63
|
function hasItemStyleOverride(items) {
|
|
17
64
|
return items.some((li) => li.fontSize !== undefined ||
|
|
18
65
|
li.color !== undefined ||
|
|
@@ -21,7 +68,8 @@ function hasItemStyleOverride(items) {
|
|
|
21
68
|
li.underline !== undefined ||
|
|
22
69
|
li.strike !== undefined ||
|
|
23
70
|
li.highlight !== undefined ||
|
|
24
|
-
li.fontFamily !== undefined
|
|
71
|
+
li.fontFamily !== undefined ||
|
|
72
|
+
li.runs !== undefined);
|
|
25
73
|
}
|
|
26
74
|
export function renderUlNode(node, ctx) {
|
|
27
75
|
const fontSizePx = node.fontSize ?? 24;
|
|
@@ -30,23 +78,7 @@ export function renderUlNode(node, ctx) {
|
|
|
30
78
|
const content = getContentArea(node);
|
|
31
79
|
if (hasItemStyleOverride(node.items)) {
|
|
32
80
|
// Li に個別スタイルがある場合は配列形式を使用
|
|
33
|
-
const textItems = node.items
|
|
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
|
-
});
|
|
81
|
+
const textItems = buildListTextItems(node.items, node, true);
|
|
50
82
|
ctx.slide.addText(textItems, {
|
|
51
83
|
x: pxToIn(content.x),
|
|
52
84
|
y: pxToIn(content.y),
|
|
@@ -95,23 +127,7 @@ export function renderOlNode(node, ctx) {
|
|
|
95
127
|
bulletOptions.numberStartAt = node.numberStartAt;
|
|
96
128
|
}
|
|
97
129
|
if (hasItemStyleOverride(node.items)) {
|
|
98
|
-
const textItems = node.items
|
|
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
|
-
});
|
|
130
|
+
const textItems = buildListTextItems(node.items, node, bulletOptions);
|
|
115
131
|
ctx.slide.addText(textItems, {
|
|
116
132
|
x: pxToIn(content.x),
|
|
117
133
|
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,
|
|
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,CAiEN"}
|
|
@@ -19,6 +19,32 @@ 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
|
+
...(run.href ? { hyperlink: { url: run.href } } : {}),
|
|
34
|
+
},
|
|
35
|
+
}));
|
|
36
|
+
return {
|
|
37
|
+
text: textItems,
|
|
38
|
+
options: {
|
|
39
|
+
align: cell.textAlign ?? "left",
|
|
40
|
+
fill: cell.backgroundColor
|
|
41
|
+
? { color: cell.backgroundColor }
|
|
42
|
+
: undefined,
|
|
43
|
+
colspan: cell.colspan,
|
|
44
|
+
rowspan: cell.rowspan,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
22
48
|
return {
|
|
23
49
|
text: cell.text,
|
|
24
50
|
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;
|
|
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,CAiCN"}
|
|
@@ -1,5 +1,36 @@
|
|
|
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
|
-
|
|
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
|
+
...(run.href ? { hyperlink: { url: run.href } } : {}),
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
ctx.slide.addText(textItems, {
|
|
23
|
+
x: textOptions.x,
|
|
24
|
+
y: textOptions.y,
|
|
25
|
+
w: textOptions.w,
|
|
26
|
+
h: textOptions.h,
|
|
27
|
+
align: textOptions.align,
|
|
28
|
+
valign: textOptions.valign,
|
|
29
|
+
margin: textOptions.margin,
|
|
30
|
+
lineSpacingMultiple: textOptions.lineSpacingMultiple,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
ctx.slide.addText(node.text ?? "", textOptions);
|
|
35
|
+
}
|
|
5
36
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -216,6 +216,12 @@ 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
|
+
href: z.ZodOptional<z.ZodString>;
|
|
224
|
+
}, z.core.$strip>>>;
|
|
219
225
|
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
220
226
|
color: z.ZodOptional<z.ZodString>;
|
|
221
227
|
textAlign: z.ZodOptional<z.ZodEnum<{
|
|
@@ -252,6 +258,12 @@ export declare const textNodeSchema: z.ZodObject<{
|
|
|
252
258
|
}, z.core.$strip>;
|
|
253
259
|
export declare const liNodeSchema: z.ZodObject<{
|
|
254
260
|
text: z.ZodString;
|
|
261
|
+
runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
262
|
+
text: z.ZodString;
|
|
263
|
+
bold: z.ZodOptional<z.ZodBoolean>;
|
|
264
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
265
|
+
href: z.ZodOptional<z.ZodString>;
|
|
266
|
+
}, z.core.$strip>>>;
|
|
255
267
|
bold: z.ZodOptional<z.ZodBoolean>;
|
|
256
268
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
257
269
|
underline: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
@@ -353,6 +365,12 @@ export declare const ulNodeSchema: z.ZodObject<{
|
|
|
353
365
|
type: z.ZodLiteral<"ul">;
|
|
354
366
|
items: z.ZodArray<z.ZodObject<{
|
|
355
367
|
text: z.ZodString;
|
|
368
|
+
runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
369
|
+
text: z.ZodString;
|
|
370
|
+
bold: z.ZodOptional<z.ZodBoolean>;
|
|
371
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
372
|
+
href: z.ZodOptional<z.ZodString>;
|
|
373
|
+
}, z.core.$strip>>>;
|
|
356
374
|
bold: z.ZodOptional<z.ZodBoolean>;
|
|
357
375
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
358
376
|
underline: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
@@ -488,6 +506,12 @@ export declare const olNodeSchema: z.ZodObject<{
|
|
|
488
506
|
type: z.ZodLiteral<"ol">;
|
|
489
507
|
items: z.ZodArray<z.ZodObject<{
|
|
490
508
|
text: z.ZodString;
|
|
509
|
+
runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
510
|
+
text: z.ZodString;
|
|
511
|
+
bold: z.ZodOptional<z.ZodBoolean>;
|
|
512
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
513
|
+
href: z.ZodOptional<z.ZodString>;
|
|
514
|
+
}, z.core.$strip>>>;
|
|
491
515
|
bold: z.ZodOptional<z.ZodBoolean>;
|
|
492
516
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
493
517
|
underline: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
@@ -816,6 +840,12 @@ export declare const tableNodeSchema: z.ZodObject<{
|
|
|
816
840
|
rows: z.ZodArray<z.ZodObject<{
|
|
817
841
|
cells: z.ZodArray<z.ZodObject<{
|
|
818
842
|
text: z.ZodString;
|
|
843
|
+
runs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
844
|
+
text: z.ZodString;
|
|
845
|
+
bold: z.ZodOptional<z.ZodBoolean>;
|
|
846
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
847
|
+
href: z.ZodOptional<z.ZodString>;
|
|
848
|
+
}, z.core.$strip>>>;
|
|
819
849
|
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
820
850
|
color: z.ZodOptional<z.ZodString>;
|
|
821
851
|
bold: z.ZodOptional<z.ZodBoolean>;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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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,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,18 @@ 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
|
+
href: z.string().optional(),
|
|
315
|
+
});
|
|
309
316
|
// ===== Non-recursive Node Types =====
|
|
310
317
|
export const textNodeSchema = basePOMNodeSchema.extend({
|
|
311
318
|
type: z.literal("text"),
|
|
312
319
|
text: z.string(),
|
|
320
|
+
runs: z.array(textRunSchema).optional(),
|
|
313
321
|
fontSize: z.number().optional(),
|
|
314
322
|
color: z.string().optional(),
|
|
315
323
|
textAlign: z.enum(["left", "center", "right"]).optional(),
|
|
@@ -323,6 +331,7 @@ export const textNodeSchema = basePOMNodeSchema.extend({
|
|
|
323
331
|
});
|
|
324
332
|
export const liNodeSchema = z.object({
|
|
325
333
|
text: z.string(),
|
|
334
|
+
runs: z.array(textRunSchema).optional(),
|
|
326
335
|
bold: z.boolean().optional(),
|
|
327
336
|
italic: z.boolean().optional(),
|
|
328
337
|
underline: underlineSchema.optional(),
|
|
@@ -398,6 +407,7 @@ export const iconNodeSchema = basePOMNodeSchema.extend({
|
|
|
398
407
|
});
|
|
399
408
|
const tableCellSchema = z.object({
|
|
400
409
|
text: z.string(),
|
|
410
|
+
runs: z.array(textRunSchema).optional(),
|
|
401
411
|
fontSize: z.number().optional(),
|
|
402
412
|
color: z.string().optional(),
|
|
403
413
|
bold: z.boolean().optional(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hirokisakabe/pom",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.2.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",
|