@hirokisakabe/pom 5.5.1 → 6.0.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 +3 -4
- package/dist/calcYogaLayout/calcYogaLayout.js +3 -15
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/icons/renderIcon.d.ts +5 -0
- package/dist/icons/renderIcon.d.ts.map +1 -1
- package/dist/icons/renderIcon.js +39 -0
- package/dist/parseXml/coercionRules.d.ts.map +1 -1
- package/dist/parseXml/coercionRules.js +0 -4
- package/dist/parseXml/parseXml.d.ts +1 -0
- package/dist/parseXml/parseXml.d.ts.map +1 -1
- package/dist/parseXml/parseXml.js +43 -16
- package/dist/registry/definitions/icon.d.ts.map +1 -1
- package/dist/registry/definitions/icon.js +4 -2
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +0 -2
- package/dist/registry/types.d.ts +1 -1
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/renderPptx/renderPptx.d.ts.map +1 -1
- package/dist/renderPptx/renderPptx.js +0 -5
- package/dist/shared/walkTree.d.ts.map +1 -1
- package/dist/shared/walkTree.js +0 -3
- package/dist/toPositioned/toPositioned.d.ts.map +1 -1
- package/dist/toPositioned/toPositioned.js +0 -11
- package/dist/types.d.ts +5 -11
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -10
- package/package.json +1 -1
- package/dist/registry/definitions/box.d.ts +0 -3
- package/dist/registry/definitions/box.d.ts.map +0 -1
- package/dist/registry/definitions/box.js +0 -6
package/README.md
CHANGED
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
|
|
38
38
|
- **AI Friendly** — Simple XML structure designed for LLM code generation. Include [llm.txt](./website/public/llm.txt) in your system prompt for XML reference. Also available at `https://pom.pptx.app/llm.txt`.
|
|
39
39
|
- **Declarative** — Describe slides as XML. No imperative API calls needed.
|
|
40
|
-
- **Flexible Layout** — Flexbox-style layout with VStack / HStack
|
|
41
|
-
- **Rich Nodes** —
|
|
40
|
+
- **Flexible Layout** — Flexbox-style layout with VStack / HStack, powered by yoga-layout.
|
|
41
|
+
- **Rich Nodes** — 18 built-in node types: charts, flowcharts, tables, timelines, org trees, and more.
|
|
42
42
|
- **Schema-validated** — XML input is validated with Zod schemas at runtime with clear error messages.
|
|
43
43
|
- **PowerPoint Native** — Full access to native PowerPoint shape features (roundRect, ellipse, arrows, etc.).
|
|
44
44
|
- **Pixel Units** — Intuitive pixel-based sizing (internally converted to inches at 96 DPI).
|
|
@@ -86,10 +86,9 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
86
86
|
| Pyramid | Pyramid diagrams for hierarchies |
|
|
87
87
|
| Line | Horizontal / vertical lines |
|
|
88
88
|
| Layer | Absolute-positioned overlay container |
|
|
89
|
-
| Box | Container for single child with padding |
|
|
90
89
|
| VStack | Vertical stack layout |
|
|
91
90
|
| HStack | Horizontal stack layout |
|
|
92
|
-
| Icon | Lucide icons
|
|
91
|
+
| Icon | Lucide icons / inline SVG |
|
|
93
92
|
|
|
94
93
|
For detailed node documentation, see [Nodes](./docs/nodes.md).
|
|
95
94
|
|
|
@@ -56,11 +56,6 @@ function collectImageSources(node) {
|
|
|
56
56
|
}
|
|
57
57
|
// 子要素の再帰
|
|
58
58
|
switch (def.category) {
|
|
59
|
-
case "single-child": {
|
|
60
|
-
const boxNode = n;
|
|
61
|
-
traverse(boxNode.children);
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
59
|
case "multi-child":
|
|
65
60
|
case "absolute-child": {
|
|
66
61
|
const containerNode = n;
|
|
@@ -102,7 +97,7 @@ function nodeHasDefiniteWidth(node, parentNode) {
|
|
|
102
97
|
// 親がいない場合(ルートノード)は確定
|
|
103
98
|
if (!parentNode)
|
|
104
99
|
return true;
|
|
105
|
-
// 親の alignItems を取得(VStack/HStack
|
|
100
|
+
// 親の alignItems を取得(VStack/HStack のみ持つ)
|
|
106
101
|
let parentAlignItems;
|
|
107
102
|
if (parentNode.type === "vstack") {
|
|
108
103
|
parentAlignItems = parentNode.alignItems;
|
|
@@ -110,11 +105,9 @@ function nodeHasDefiniteWidth(node, parentNode) {
|
|
|
110
105
|
else if (parentNode.type === "hstack") {
|
|
111
106
|
parentAlignItems = parentNode.alignItems;
|
|
112
107
|
}
|
|
113
|
-
// VStack
|
|
108
|
+
// VStack(column 方向)の子の場合、交差軸は水平方向
|
|
114
109
|
// alignItems が stretch(デフォルト)なら子は親幅に伸長される
|
|
115
|
-
if (parentNode.type === "vstack" ||
|
|
116
|
-
parentNode.type === "box" ||
|
|
117
|
-
parentNode.type === "layer") {
|
|
110
|
+
if (parentNode.type === "vstack" || parentNode.type === "layer") {
|
|
118
111
|
return parentAlignItems === undefined || parentAlignItems === "stretch";
|
|
119
112
|
}
|
|
120
113
|
// HStack の子の場合、幅は主軸方向で flex により決まるため確定とみなす
|
|
@@ -156,11 +149,6 @@ async function buildPomWithYogaTree(node, parentYoga, ctx, map, parentNode, gran
|
|
|
156
149
|
parentYoga.insertChild(yn, parentYoga.getChildCount());
|
|
157
150
|
const def = getNodeDef(node.type);
|
|
158
151
|
switch (def.category) {
|
|
159
|
-
case "single-child": {
|
|
160
|
-
const boxNode = node;
|
|
161
|
-
await buildPomWithYogaTree(boxNode.children, yn, ctx, map, node, parentNode);
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
152
|
case "multi-child":
|
|
165
153
|
case "absolute-child": {
|
|
166
154
|
const containerNode = node;
|
package/dist/icons/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { rasterizeIcon } from "./renderIcon.ts";
|
|
1
|
+
export { rasterizeIcon, rasterizeSvgContent } from "./renderIcon.ts";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/icons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/icons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/icons/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { rasterizeIcon } from "./renderIcon.js";
|
|
1
|
+
export { rasterizeIcon, rasterizeSvgContent } from "./renderIcon.js";
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export declare function rasterizeIcon(name: string, size: number, color: string, cache: Map<string, string>): string;
|
|
2
|
+
/**
|
|
3
|
+
* インライン SVG 文字列を指定サイズでラスタライズし、base64 PNG を返す。
|
|
4
|
+
* color が指定された場合、SVG ルートに stroke / fill 属性を設定する。
|
|
5
|
+
*/
|
|
6
|
+
export declare function rasterizeSvgContent(svgContent: string, size: number, color: string | undefined, cache: Map<string, string>): string;
|
|
2
7
|
//# sourceMappingURL=renderIcon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderIcon.d.ts","sourceRoot":"","sources":["../../src/icons/renderIcon.ts"],"names":[],"mappings":"AAWA,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACzB,MAAM,CAYR"}
|
|
1
|
+
{"version":3,"file":"renderIcon.d.ts","sourceRoot":"","sources":["../../src/icons/renderIcon.ts"],"names":[],"mappings":"AAWA,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACzB,MAAM,CAYR;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACzB,MAAM,CAuCR"}
|
package/dist/icons/renderIcon.js
CHANGED
|
@@ -20,3 +20,42 @@ export function rasterizeIcon(name, size, color, cache) {
|
|
|
20
20
|
cache.set(key, result);
|
|
21
21
|
return result;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* インライン SVG 文字列を指定サイズでラスタライズし、base64 PNG を返す。
|
|
25
|
+
* color が指定された場合、SVG ルートに stroke / fill 属性を設定する。
|
|
26
|
+
*/
|
|
27
|
+
export function rasterizeSvgContent(svgContent, size, color, cache) {
|
|
28
|
+
const key = `svg:${svgContent}|${size}|${color ?? ""}`;
|
|
29
|
+
const cached = cache.get(key);
|
|
30
|
+
if (cached)
|
|
31
|
+
return cached;
|
|
32
|
+
// SVG に xmlns / width / height を設定し、color があれば stroke / fill を注入
|
|
33
|
+
let svg = svgContent;
|
|
34
|
+
// xmlns が無ければ追加
|
|
35
|
+
if (!svg.includes("xmlns")) {
|
|
36
|
+
svg = svg.replace("<svg", '<svg xmlns="http://www.w3.org/2000/svg"');
|
|
37
|
+
}
|
|
38
|
+
// width / height を上書き
|
|
39
|
+
svg = svg.replace(/<svg([^>]*)>/, (match, attrs) => {
|
|
40
|
+
let newAttrs = attrs
|
|
41
|
+
.replace(/\bwidth\s*=\s*"[^"]*"/g, "")
|
|
42
|
+
.replace(/\bheight\s*=\s*"[^"]*"/g, "");
|
|
43
|
+
newAttrs += ` width="${size}" height="${size}"`;
|
|
44
|
+
// color 指定時は stroke / fill を設定(プリセットアイコンとの一貫性)
|
|
45
|
+
if (color) {
|
|
46
|
+
if (!attrs.includes("stroke=")) {
|
|
47
|
+
newAttrs += ` stroke="${color}"`;
|
|
48
|
+
}
|
|
49
|
+
if (!attrs.includes("fill=")) {
|
|
50
|
+
newAttrs += ` fill="none"`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return `<svg${newAttrs}>`;
|
|
54
|
+
});
|
|
55
|
+
const resvg = new Resvg(svg, { fitTo: { mode: "width", value: size } });
|
|
56
|
+
const pngData = resvg.render();
|
|
57
|
+
const pngBuffer = pngData.asPng();
|
|
58
|
+
const result = `image/png;base64,${Buffer.from(pngBuffer).toString("base64")}`;
|
|
59
|
+
cache.set(key, result);
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
@@ -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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CA8I1E,CAAC;AAGF,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAC7C,MAAM,EACN,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CA6E7B,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;
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { XMLParser } from "fast-xml-parser";
|
|
1
|
+
import { XMLBuilder, XMLParser } from "fast-xml-parser";
|
|
2
2
|
import { textNodeSchema, ulNodeSchema, olNodeSchema, imageNodeSchema, tableNodeSchema, shapeNodeSchema, chartNodeSchema, timelineNodeSchema, matrixNodeSchema, treeNodeSchema, flowNodeSchema, processArrowNodeSchema, pyramidNodeSchema, lineNodeSchema, iconNodeSchema, } from "../types.js";
|
|
3
3
|
import { NODE_COERCION_MAP, CHILD_ELEMENT_COERCION_MAP, coerceWithRule, coerceFallback, getObjectShapeFromRule, isBooleanObjectUnionRule, } from "./coercionRules.js";
|
|
4
4
|
// ===== ParseXmlError =====
|
|
@@ -12,7 +12,7 @@ export class ParseXmlError extends Error {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
// ===== Tag name → POM node type mapping =====
|
|
15
|
-
const TAG_TO_TYPE = {
|
|
15
|
+
export const TAG_TO_TYPE = {
|
|
16
16
|
Text: "text",
|
|
17
17
|
Image: "image",
|
|
18
18
|
Table: "table",
|
|
@@ -27,7 +27,6 @@ const TAG_TO_TYPE = {
|
|
|
27
27
|
Ul: "ul",
|
|
28
28
|
Ol: "ol",
|
|
29
29
|
Line: "line",
|
|
30
|
-
Box: "box",
|
|
31
30
|
VStack: "vstack",
|
|
32
31
|
HStack: "hstack",
|
|
33
32
|
Layer: "layer",
|
|
@@ -35,7 +34,7 @@ const TAG_TO_TYPE = {
|
|
|
35
34
|
};
|
|
36
35
|
// Reverse mapping: node type → tag name
|
|
37
36
|
const TYPE_TO_TAG = Object.fromEntries(Object.entries(TAG_TO_TYPE).map(([tag, type]) => [type, tag]));
|
|
38
|
-
const CONTAINER_TYPES = new Set(["
|
|
37
|
+
const CONTAINER_TYPES = new Set(["vstack", "hstack", "layer"]);
|
|
39
38
|
const TEXT_CONTENT_NODES = new Set(["text", "shape"]);
|
|
40
39
|
// Attributes allowed on any node (e.g., x/y for Layer children positioning)
|
|
41
40
|
const UNIVERSAL_ATTRS = new Set(["x", "y"]);
|
|
@@ -160,6 +159,7 @@ const CHILD_ELEMENT_PROPS = {
|
|
|
160
159
|
tree: new Set(["data"]),
|
|
161
160
|
ul: new Set(["items"]),
|
|
162
161
|
ol: new Set(["items"]),
|
|
162
|
+
icon: new Set(["name", "svgContent"]),
|
|
163
163
|
};
|
|
164
164
|
function validateLeafNode(nodeType, result, errors) {
|
|
165
165
|
const schema = leafNodeValidationSchemas[nodeType];
|
|
@@ -513,6 +513,11 @@ function convertTableChildren(childElements, result, errors) {
|
|
|
513
513
|
if (columns.length > 0) {
|
|
514
514
|
result.columns = columns;
|
|
515
515
|
}
|
|
516
|
+
else if (rows.length > 0) {
|
|
517
|
+
// TableColumn が未指定の場合、行のセル数(colspan 考慮)からデフォルトの columns を自動生成
|
|
518
|
+
const maxCells = Math.max(...rows.map((row) => row.cells.reduce((sum, cell) => sum + (cell.colspan ?? 1), 0)));
|
|
519
|
+
result.columns = Array.from({ length: maxCells }, () => ({}));
|
|
520
|
+
}
|
|
516
521
|
if (rows.length > 0) {
|
|
517
522
|
result.rows = rows;
|
|
518
523
|
}
|
|
@@ -574,6 +579,33 @@ function convertListChildren(parentTag, childElements, result, errors) {
|
|
|
574
579
|
}
|
|
575
580
|
result.items = items;
|
|
576
581
|
}
|
|
582
|
+
// SVG 要素を XML 文字列に再構築する
|
|
583
|
+
const svgBuilder = new XMLBuilder({
|
|
584
|
+
preserveOrder: true,
|
|
585
|
+
ignoreAttributes: false,
|
|
586
|
+
attributeNamePrefix: "@_",
|
|
587
|
+
});
|
|
588
|
+
function serializeSvgElement(svgElement) {
|
|
589
|
+
return String(svgBuilder.build([svgElement]));
|
|
590
|
+
}
|
|
591
|
+
function convertIconChildren(childElements, result, errors) {
|
|
592
|
+
if (childElements.length !== 1) {
|
|
593
|
+
errors.push(`<Icon>: Expected exactly one <svg> child element, but found ${childElements.length} child element(s)`);
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
const child = childElements[0];
|
|
597
|
+
const tag = getTagName(child);
|
|
598
|
+
if (tag !== "svg") {
|
|
599
|
+
errors.push(`<Icon>: Expected <svg> child element, but found <${tag}>`);
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
// name と svg の排他バリデーション
|
|
603
|
+
if (result.name !== undefined) {
|
|
604
|
+
errors.push('<Icon>: Cannot specify both "name" attribute and <svg> child element');
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
result.svgContent = serializeSvgElement(child);
|
|
608
|
+
}
|
|
577
609
|
const CHILD_ELEMENT_CONVERTERS = {
|
|
578
610
|
ul: (childElements, result, errors) => convertListChildren("Ul", childElements, result, errors),
|
|
579
611
|
ol: (childElements, result, errors) => convertListChildren("Ol", childElements, result, errors),
|
|
@@ -585,6 +617,7 @@ const CHILD_ELEMENT_CONVERTERS = {
|
|
|
585
617
|
chart: convertChartChildren,
|
|
586
618
|
table: convertTableChildren,
|
|
587
619
|
tree: convertTreeChildren,
|
|
620
|
+
icon: convertIconChildren,
|
|
588
621
|
};
|
|
589
622
|
// ===== Node conversion =====
|
|
590
623
|
function convertElement(node, errors) {
|
|
@@ -682,17 +715,7 @@ function convertPomNode(nodeType, tagName, attrs, childElements, textContent, er
|
|
|
682
715
|
const convertedChildren = childElements
|
|
683
716
|
.map((child) => convertElement(child, errors))
|
|
684
717
|
.filter((child) => child !== null);
|
|
685
|
-
|
|
686
|
-
if (childElements.length !== 1) {
|
|
687
|
-
errors.push(`<Box> must have exactly 1 child element, but got ${childElements.length}`);
|
|
688
|
-
}
|
|
689
|
-
if (convertedChildren.length > 0) {
|
|
690
|
-
result.children = convertedChildren[0];
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
else {
|
|
694
|
-
result.children = convertedChildren;
|
|
695
|
-
}
|
|
718
|
+
result.children = convertedChildren;
|
|
696
719
|
}
|
|
697
720
|
// Leaf nodes that shouldn't have child elements
|
|
698
721
|
else if (!CONTAINER_TYPES.has(nodeType) &&
|
|
@@ -704,7 +727,7 @@ function convertPomNode(nodeType, tagName, attrs, childElements, textContent, er
|
|
|
704
727
|
if (!CONTAINER_TYPES.has(nodeType)) {
|
|
705
728
|
validateLeafNode(nodeType, result, errors);
|
|
706
729
|
}
|
|
707
|
-
//
|
|
730
|
+
// Icon: normalize color / bgColor and validate name vs svgContent
|
|
708
731
|
if (nodeType === "icon") {
|
|
709
732
|
if (typeof result.color === "string" && !result.color.startsWith("#")) {
|
|
710
733
|
result.color = `#${result.color}`;
|
|
@@ -712,6 +735,10 @@ function convertPomNode(nodeType, tagName, attrs, childElements, textContent, er
|
|
|
712
735
|
if (typeof result.bgColor === "string" && !result.bgColor.startsWith("#")) {
|
|
713
736
|
result.bgColor = `#${result.bgColor}`;
|
|
714
737
|
}
|
|
738
|
+
// name も svgContent もない場合はエラー
|
|
739
|
+
if (result.name === undefined && result.svgContent === undefined) {
|
|
740
|
+
errors.push('<Icon>: Either "name" attribute or <svg> child element is required');
|
|
741
|
+
}
|
|
715
742
|
}
|
|
716
743
|
return result;
|
|
717
744
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/registry/definitions/icon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/registry/definitions/icon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,eAAO,MAAM,WAAW,EAAE,cA4EzB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rasterizeIcon } from "../../icons/index.js";
|
|
1
|
+
import { rasterizeIcon, rasterizeSvgContent } from "../../icons/index.js";
|
|
2
2
|
import { renderIconNode } from "../../renderPptx/nodes/icon.js";
|
|
3
3
|
import { getContentArea } from "../../renderPptx/utils/contentArea.js";
|
|
4
4
|
export const iconNodeDef = {
|
|
@@ -24,7 +24,9 @@ export const iconNodeDef = {
|
|
|
24
24
|
});
|
|
25
25
|
// 実描画サイズに合わせてラスタライズ(不要に大きい PNG を防ぐ)
|
|
26
26
|
const rasterSize = Math.max(Math.ceil(n.variant ? iconSize : Math.min(content.w, content.h)), iconSize);
|
|
27
|
-
const iconImageData =
|
|
27
|
+
const iconImageData = n.svgContent
|
|
28
|
+
? rasterizeSvgContent(n.svgContent, rasterSize, n.color, ctx.iconRasterCache)
|
|
29
|
+
: rasterizeIcon(n.name, rasterSize, n.color ?? "#000000", ctx.iconRasterCache);
|
|
28
30
|
const positioned = {
|
|
29
31
|
...n,
|
|
30
32
|
x: absoluteX,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/registry/index.js
CHANGED
|
@@ -8,7 +8,6 @@ import { chartNodeDef } from "./definitions/chart.js";
|
|
|
8
8
|
import { iconNodeDef } from "./definitions/icon.js";
|
|
9
9
|
import { lineNodeDef } from "./definitions/line.js";
|
|
10
10
|
import { timelineNodeDef, matrixNodeDef, treeNodeDef, flowNodeDef, processArrowNodeDef, pyramidNodeDef, } from "./definitions/compositeNodes.js";
|
|
11
|
-
import { boxNodeDef } from "./definitions/box.js";
|
|
12
11
|
import { vstackNodeDef, hstackNodeDef } from "./definitions/stack.js";
|
|
13
12
|
import { layerNodeDef } from "./definitions/layer.js";
|
|
14
13
|
// 全ノード定義を登録
|
|
@@ -27,7 +26,6 @@ registerNode(treeNodeDef);
|
|
|
27
26
|
registerNode(flowNodeDef);
|
|
28
27
|
registerNode(processArrowNodeDef);
|
|
29
28
|
registerNode(pyramidNodeDef);
|
|
30
|
-
registerNode(boxNodeDef);
|
|
31
29
|
registerNode(vstackNodeDef);
|
|
32
30
|
registerNode(hstackNodeDef);
|
|
33
31
|
registerNode(layerNodeDef);
|
package/dist/registry/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { BuildContext } from "../buildContext.ts";
|
|
|
6
6
|
import type { LayoutResultMap } from "../calcYogaLayout/types.ts";
|
|
7
7
|
export type Yoga = Awaited<ReturnType<typeof loadYoga>>;
|
|
8
8
|
/** ノードのカテゴリ。子要素の扱い方を決定する */
|
|
9
|
-
export type NodeCategory = "leaf" | "
|
|
9
|
+
export type NodeCategory = "leaf" | "multi-child" | "absolute-child";
|
|
10
10
|
export interface NodeDefinition {
|
|
11
11
|
/** ノードタイプ名 */
|
|
12
12
|
type: POMNode["type"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC;AAExD,4BAA4B;AAC5B,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,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A+JxC;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,MAAM,CAAC,EAAE,kBAAkB,+
|
|
1
|
+
{"version":3,"file":"renderPptx.d.ts","sourceRoot":"","sources":["../../src/renderPptx/renderPptx.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAEnB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQvD,KAAK,OAAO,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA+JxC;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,MAAM,CAAC,EAAE,kBAAkB,+BAgI5B"}
|
|
@@ -252,11 +252,6 @@ export function renderPptx(pages, slidePx, buildContext, master) {
|
|
|
252
252
|
}
|
|
253
253
|
def.render(node, ctx);
|
|
254
254
|
break;
|
|
255
|
-
case "single-child": {
|
|
256
|
-
const boxNode = node;
|
|
257
|
-
renderNode(boxNode.children);
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
255
|
case "multi-child":
|
|
261
256
|
case "absolute-child": {
|
|
262
257
|
const containerNode = node;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walkTree.d.ts","sourceRoot":"","sources":["../../src/shared/walkTree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAC/B,IAAI,
|
|
1
|
+
{"version":3,"file":"walkTree.d.ts","sourceRoot":"","sources":["../../src/shared/walkTree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAC/B,IAAI,CAYN"}
|
package/dist/shared/walkTree.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toPositioned.d.ts","sourceRoot":"","sources":["../../src/toPositioned/toPositioned.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,YAAY,EACjB,GAAG,EAAE,eAAe,EACpB,OAAO,SAAI,EACX,OAAO,SAAI,GACV,cAAc,
|
|
1
|
+
{"version":3,"file":"toPositioned.d.ts","sourceRoot":"","sources":["../../src/toPositioned/toPositioned.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,YAAY,EACjB,GAAG,EAAE,eAAe,EACpB,OAAO,SAAI,EACX,OAAO,SAAI,GACV,cAAc,CAiDhB"}
|
|
@@ -30,17 +30,6 @@ export function toPositioned(pom, ctx, map, parentX = 0, parentY = 0) {
|
|
|
30
30
|
w: layout.width,
|
|
31
31
|
h: layout.height,
|
|
32
32
|
};
|
|
33
|
-
case "single-child": {
|
|
34
|
-
const boxNode = pom;
|
|
35
|
-
return {
|
|
36
|
-
...boxNode,
|
|
37
|
-
x: absoluteX,
|
|
38
|
-
y: absoluteY,
|
|
39
|
-
w: layout.width,
|
|
40
|
-
h: layout.height,
|
|
41
|
-
children: toPositioned(boxNode.children, ctx, map, absoluteX, absoluteY),
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
33
|
case "multi-child": {
|
|
45
34
|
const containerNode = pom;
|
|
46
35
|
return {
|
package/dist/types.d.ts
CHANGED
|
@@ -669,9 +669,10 @@ export declare const iconNodeSchema: z.ZodObject<{
|
|
|
669
669
|
stretch: "stretch";
|
|
670
670
|
}>>;
|
|
671
671
|
type: z.ZodLiteral<"icon">;
|
|
672
|
-
name: z.ZodEnum<{
|
|
672
|
+
name: z.ZodOptional<z.ZodEnum<{
|
|
673
673
|
[x: string]: string;
|
|
674
|
-
}
|
|
674
|
+
}>>;
|
|
675
|
+
svgContent: z.ZodOptional<z.ZodString>;
|
|
675
676
|
size: z.ZodOptional<z.ZodNumber>;
|
|
676
677
|
color: z.ZodOptional<z.ZodString>;
|
|
677
678
|
variant: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1819,11 +1820,6 @@ export declare const lineNodeSchema: z.ZodObject<{
|
|
|
1819
1820
|
}, z.core.$strip>;
|
|
1820
1821
|
export type LineArrow = z.infer<typeof lineArrowSchema>;
|
|
1821
1822
|
export type LineNode = z.infer<typeof lineNodeSchema>;
|
|
1822
|
-
export type BoxNode = BasePOMNode & {
|
|
1823
|
-
type: "box";
|
|
1824
|
-
children: POMNode;
|
|
1825
|
-
shadow?: ShadowStyle;
|
|
1826
|
-
};
|
|
1827
1823
|
export type VStackNode = BasePOMNode & {
|
|
1828
1824
|
type: "vstack";
|
|
1829
1825
|
children: POMNode[];
|
|
@@ -1850,7 +1846,7 @@ export type LayerNode = BasePOMNode & {
|
|
|
1850
1846
|
type: "layer";
|
|
1851
1847
|
children: LayerChild[];
|
|
1852
1848
|
};
|
|
1853
|
-
export type POMNode = TextNode | UlNode | OlNode | ImageNode | TableNode |
|
|
1849
|
+
export type POMNode = TextNode | UlNode | OlNode | ImageNode | TableNode | VStackNode | HStackNode | ShapeNode | ChartNode | TimelineNode | MatrixNode | TreeNode | FlowNode | ProcessArrowNode | PyramidNode | LineNode | LayerNode | IconNode;
|
|
1854
1850
|
declare const positionedBaseSchema: z.ZodObject<{
|
|
1855
1851
|
x: z.ZodNumber;
|
|
1856
1852
|
y: z.ZodNumber;
|
|
@@ -1864,9 +1860,7 @@ export type PositionedLayerChild = PositionedNode & {
|
|
|
1864
1860
|
};
|
|
1865
1861
|
export type PositionedNode = (TextNode & PositionedBase) | (UlNode & PositionedBase) | (OlNode & PositionedBase) | (ImageNode & PositionedBase & {
|
|
1866
1862
|
imageData?: string;
|
|
1867
|
-
}) | (TableNode & PositionedBase) | (
|
|
1868
|
-
children: PositionedNode;
|
|
1869
|
-
}) | (VStackNode & PositionedBase & {
|
|
1863
|
+
}) | (TableNode & PositionedBase) | (VStackNode & PositionedBase & {
|
|
1870
1864
|
children: PositionedNode[];
|
|
1871
1865
|
}) | (HStackNode & PositionedBase & {
|
|
1872
1866
|
children: PositionedNode[];
|
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,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;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export const iconNodeSchema = basePOMNodeSchema.extend({
|
|
391
391
|
type: z.literal("icon"),
|
|
392
|
-
name: iconNameSchema,
|
|
392
|
+
name: iconNameSchema.optional(),
|
|
393
|
+
svgContent: z.string().optional(),
|
|
393
394
|
size: z.number().positive().max(1024).optional(),
|
|
394
395
|
color: iconColorSchema,
|
|
395
396
|
variant: iconVariantSchema,
|
|
@@ -633,11 +634,6 @@ export const lineNodeSchema = basePOMNodeSchema.extend({
|
|
|
633
634
|
endArrow: lineArrowSchema.optional(),
|
|
634
635
|
});
|
|
635
636
|
// Define schemas using passthrough to maintain type safety
|
|
636
|
-
const boxNodeSchemaBase = basePOMNodeSchema.extend({
|
|
637
|
-
type: z.literal("box"),
|
|
638
|
-
children: z.lazy(() => pomNodeSchema),
|
|
639
|
-
shadow: shadowStyleSchema.optional(),
|
|
640
|
-
});
|
|
641
637
|
const vStackNodeSchemaBase = basePOMNodeSchema.extend({
|
|
642
638
|
type: z.literal("vstack"),
|
|
643
639
|
children: z.array(z.lazy(() => pomNodeSchema)),
|
|
@@ -670,7 +666,6 @@ const pomNodeSchema = z.lazy(() => z.discriminatedUnion("type", [
|
|
|
670
666
|
olNodeSchema,
|
|
671
667
|
imageNodeSchema,
|
|
672
668
|
tableNodeSchema,
|
|
673
|
-
boxNodeSchemaBase,
|
|
674
669
|
vStackNodeSchemaBase,
|
|
675
670
|
hStackNodeSchemaBase,
|
|
676
671
|
shapeNodeSchema,
|
|
@@ -704,9 +699,6 @@ const positionedNodeSchema = z.lazy(() => z.union([
|
|
|
704
699
|
imageData: z.string().optional(),
|
|
705
700
|
}),
|
|
706
701
|
tableNodeSchema.merge(positionedBaseSchema),
|
|
707
|
-
boxNodeSchemaBase.merge(positionedBaseSchema).extend({
|
|
708
|
-
children: z.lazy(() => positionedNodeSchema),
|
|
709
|
-
}),
|
|
710
702
|
vStackNodeSchemaBase.merge(positionedBaseSchema).extend({
|
|
711
703
|
children: z.array(z.lazy(() => positionedNodeSchema)),
|
|
712
704
|
}),
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../src/registry/definitions/box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,UAAU,EAAE,cAKxB,CAAC"}
|