@hirokisakabe/pom 1.4.0 → 3.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.
Files changed (87) hide show
  1. package/README.md +158 -193
  2. package/dist/buildPptx.d.ts +2 -2
  3. package/dist/buildPptx.d.ts.map +1 -1
  4. package/dist/buildPptx.js +3 -1
  5. package/dist/calcYogaLayout/calcYogaLayout.d.ts.map +1 -1
  6. package/dist/calcYogaLayout/calcYogaLayout.js +95 -19
  7. package/dist/calcYogaLayout/fontLoader.d.ts +0 -7
  8. package/dist/calcYogaLayout/fontLoader.d.ts.map +1 -1
  9. package/dist/calcYogaLayout/fontLoader.js +1 -1
  10. package/dist/calcYogaLayout/measureText.d.ts +0 -4
  11. package/dist/calcYogaLayout/measureText.d.ts.map +1 -1
  12. package/dist/calcYogaLayout/measureText.js +0 -6
  13. package/dist/index.d.ts +2 -5
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -4
  16. package/dist/{inputSchema.d.ts → parseXml/inputSchema.d.ts} +254 -460
  17. package/dist/parseXml/inputSchema.d.ts.map +1 -0
  18. package/dist/{inputSchema.js → parseXml/inputSchema.js} +42 -140
  19. package/dist/{parseXml.d.ts → parseXml/parseXml.d.ts} +6 -2
  20. package/dist/parseXml/parseXml.d.ts.map +1 -0
  21. package/dist/parseXml/parseXml.js +823 -0
  22. package/dist/renderPptx/nodes/flow.d.ts.map +1 -1
  23. package/dist/renderPptx/nodes/flow.js +26 -16
  24. package/dist/renderPptx/nodes/index.d.ts +1 -0
  25. package/dist/renderPptx/nodes/index.d.ts.map +1 -1
  26. package/dist/renderPptx/nodes/index.js +1 -0
  27. package/dist/renderPptx/nodes/list.d.ts +12 -0
  28. package/dist/renderPptx/nodes/list.d.ts.map +1 -0
  29. package/dist/renderPptx/nodes/list.js +145 -0
  30. package/dist/renderPptx/nodes/matrix.d.ts.map +1 -1
  31. package/dist/renderPptx/nodes/matrix.js +43 -31
  32. package/dist/renderPptx/nodes/processArrow.d.ts.map +1 -1
  33. package/dist/renderPptx/nodes/processArrow.js +14 -6
  34. package/dist/renderPptx/nodes/shape.js +2 -2
  35. package/dist/renderPptx/nodes/table.d.ts.map +1 -1
  36. package/dist/renderPptx/nodes/table.js +1 -1
  37. package/dist/renderPptx/nodes/timeline.d.ts.map +1 -1
  38. package/dist/renderPptx/nodes/timeline.js +58 -37
  39. package/dist/renderPptx/nodes/tree.d.ts.map +1 -1
  40. package/dist/renderPptx/nodes/tree.js +49 -40
  41. package/dist/renderPptx/renderPptx.d.ts +1 -2
  42. package/dist/renderPptx/renderPptx.d.ts.map +1 -1
  43. package/dist/renderPptx/renderPptx.js +8 -4
  44. package/dist/renderPptx/textOptions.d.ts +1 -29
  45. package/dist/renderPptx/textOptions.d.ts.map +1 -1
  46. package/dist/renderPptx/textOptions.js +1 -27
  47. package/dist/renderPptx/types.d.ts +0 -2
  48. package/dist/renderPptx/types.d.ts.map +1 -1
  49. package/dist/renderPptx/utils/backgroundBorder.js +1 -1
  50. package/dist/renderPptx/utils/scaleToFit.d.ts +8 -0
  51. package/dist/renderPptx/utils/scaleToFit.d.ts.map +1 -0
  52. package/dist/renderPptx/utils/scaleToFit.js +19 -0
  53. package/dist/shared/measureImage.d.ts.map +1 -0
  54. package/dist/{table/utils.d.ts → shared/tableUtils.d.ts} +1 -3
  55. package/dist/shared/tableUtils.d.ts.map +1 -0
  56. package/dist/{table/utils.js → shared/tableUtils.js} +2 -2
  57. package/dist/toPositioned/toPositioned.d.ts.map +1 -1
  58. package/dist/toPositioned/toPositioned.js +4 -2
  59. package/dist/types.d.ts +271 -154
  60. package/dist/types.d.ts.map +1 -1
  61. package/dist/types.js +67 -33
  62. package/package.json +3 -6
  63. package/dist/calcYogaLayout/measureImage.d.ts.map +0 -1
  64. package/dist/component.d.ts +0 -90
  65. package/dist/component.d.ts.map +0 -1
  66. package/dist/component.js +0 -123
  67. package/dist/inputSchema.d.ts.map +0 -1
  68. package/dist/parseXml.d.ts.map +0 -1
  69. package/dist/parseXml.js +0 -332
  70. package/dist/renderPptx/nodes/box.d.ts +0 -2
  71. package/dist/renderPptx/nodes/box.d.ts.map +0 -1
  72. package/dist/renderPptx/nodes/box.js +0 -3
  73. package/dist/renderPptx/utils/index.d.ts +0 -6
  74. package/dist/renderPptx/utils/index.d.ts.map +0 -1
  75. package/dist/renderPptx/utils/index.js +0 -3
  76. package/dist/renderPptx/utils/shapeDrawing.d.ts +0 -27
  77. package/dist/renderPptx/utils/shapeDrawing.d.ts.map +0 -1
  78. package/dist/renderPptx/utils/shapeDrawing.js +0 -36
  79. package/dist/renderPptx/utils/textDrawing.d.ts +0 -25
  80. package/dist/renderPptx/utils/textDrawing.d.ts.map +0 -1
  81. package/dist/renderPptx/utils/textDrawing.js +0 -25
  82. package/dist/schema.d.ts +0 -23
  83. package/dist/schema.d.ts.map +0 -1
  84. package/dist/schema.js +0 -24
  85. package/dist/table/utils.d.ts.map +0 -1
  86. /package/dist/{calcYogaLayout → shared}/measureImage.d.ts +0 -0
  87. /package/dist/{calcYogaLayout → shared}/measureImage.js +0 -0
package/dist/parseXml.js DELETED
@@ -1,332 +0,0 @@
1
- import { XMLParser } from "fast-xml-parser";
2
- import { z } from "zod";
3
- import { inputTextNodeSchema, inputImageNodeSchema, inputTableNodeSchema, inputShapeNodeSchema, inputChartNodeSchema, inputTimelineNodeSchema, inputMatrixNodeSchema, inputTreeNodeSchema, inputFlowNodeSchema, inputProcessArrowNodeSchema, inputLineNodeSchema, inputBaseNodeSchema, } from "./inputSchema.js";
4
- import { alignItemsSchema, justifyContentSchema, shadowStyleSchema, } from "./types.js";
5
- // ===== Tag name → POM node type mapping =====
6
- const TAG_TO_TYPE = {
7
- Text: "text",
8
- Image: "image",
9
- Table: "table",
10
- Shape: "shape",
11
- Chart: "chart",
12
- Timeline: "timeline",
13
- Matrix: "matrix",
14
- Tree: "tree",
15
- Flow: "flow",
16
- ProcessArrow: "processArrow",
17
- Line: "line",
18
- Box: "box",
19
- VStack: "vstack",
20
- HStack: "hstack",
21
- Layer: "layer",
22
- };
23
- function extractShape(schema) {
24
- return schema.shape;
25
- }
26
- const leafNodeShapes = {
27
- text: extractShape(inputTextNodeSchema),
28
- image: extractShape(inputImageNodeSchema),
29
- table: extractShape(inputTableNodeSchema),
30
- shape: extractShape(inputShapeNodeSchema),
31
- chart: extractShape(inputChartNodeSchema),
32
- timeline: extractShape(inputTimelineNodeSchema),
33
- matrix: extractShape(inputMatrixNodeSchema),
34
- tree: extractShape(inputTreeNodeSchema),
35
- flow: extractShape(inputFlowNodeSchema),
36
- processArrow: extractShape(inputProcessArrowNodeSchema),
37
- line: extractShape(inputLineNodeSchema),
38
- };
39
- const containerShapes = {
40
- box: extractShape(inputBaseNodeSchema.extend({ shadow: shadowStyleSchema.optional() })),
41
- vstack: extractShape(inputBaseNodeSchema.extend({
42
- gap: z.number().optional(),
43
- alignItems: alignItemsSchema.optional(),
44
- justifyContent: justifyContentSchema.optional(),
45
- })),
46
- hstack: extractShape(inputBaseNodeSchema.extend({
47
- gap: z.number().optional(),
48
- alignItems: alignItemsSchema.optional(),
49
- justifyContent: justifyContentSchema.optional(),
50
- })),
51
- layer: extractShape(inputBaseNodeSchema),
52
- };
53
- const CONTAINER_TYPES = new Set(["box", "vstack", "hstack", "layer"]);
54
- const TEXT_CONTENT_NODES = new Set(["text", "shape"]);
55
- function getDef(schema) {
56
- return schema._def;
57
- }
58
- function getPropertySchema(nodeType, propertyName) {
59
- const shape = leafNodeShapes[nodeType] ?? containerShapes[nodeType];
60
- if (!shape)
61
- return undefined;
62
- return shape[propertyName];
63
- }
64
- function getZodType(schema) {
65
- const def = getDef(schema);
66
- return (def.type ?? def.typeName ?? "");
67
- }
68
- function unwrapSchema(schema) {
69
- const typeName = getZodType(schema);
70
- const def = getDef(schema);
71
- switch (typeName) {
72
- case "optional":
73
- case "default":
74
- case "nullable":
75
- return unwrapSchema(def.innerType);
76
- case "lazy":
77
- return unwrapSchema(def.getter());
78
- case "pipe":
79
- return unwrapSchema(def.in);
80
- default:
81
- return schema;
82
- }
83
- }
84
- function resolveZodTypeName(schema) {
85
- return getZodType(unwrapSchema(schema));
86
- }
87
- // ===== Value coercion =====
88
- function coerceValue(value, schema) {
89
- const unwrapped = unwrapSchema(schema);
90
- const typeName = getZodType(unwrapped);
91
- const def = getDef(unwrapped);
92
- switch (typeName) {
93
- case "number": {
94
- const num = Number(value);
95
- if (isNaN(num)) {
96
- throw new Error(`Cannot convert "${value}" to number`);
97
- }
98
- return num;
99
- }
100
- case "boolean":
101
- if (value !== "true" && value !== "false") {
102
- throw new Error(`Cannot convert "${value}" to boolean (expected "true" or "false")`);
103
- }
104
- return value === "true";
105
- case "string":
106
- case "enum":
107
- return value;
108
- case "literal": {
109
- const values = def.values;
110
- const singleValue = def.value;
111
- return values?.[0] ?? singleValue;
112
- }
113
- case "array":
114
- case "object":
115
- case "record":
116
- case "tuple":
117
- return JSON.parse(value);
118
- case "union": {
119
- const options = def.options;
120
- return coerceUnionValue(value, options);
121
- }
122
- default:
123
- return coerceFallback(value);
124
- }
125
- }
126
- function coerceUnionValue(value, options) {
127
- const typeNames = options.map((opt) => resolveZodTypeName(opt));
128
- // Try boolean
129
- if ((value === "true" || value === "false") &&
130
- typeNames.includes("boolean")) {
131
- return value === "true";
132
- }
133
- // Try number
134
- if (typeNames.includes("number")) {
135
- const num = Number(value);
136
- if (!isNaN(num) && value !== "") {
137
- return num;
138
- }
139
- }
140
- // Try literal
141
- for (let i = 0; i < options.length; i++) {
142
- if (typeNames[i] === "literal") {
143
- const unwrapped = unwrapSchema(options[i]);
144
- const def = getDef(unwrapped);
145
- const values = def.values;
146
- const singleValue = def.value;
147
- const litVal = values?.[0] ?? singleValue;
148
- if (litVal != null && `${litVal}` === value)
149
- return litVal;
150
- }
151
- }
152
- // Try JSON parse for objects/arrays
153
- if (typeNames.some((t) => ["array", "object", "record", "tuple"].includes(t))) {
154
- if (value.startsWith("{") || value.startsWith("[")) {
155
- try {
156
- return JSON.parse(value);
157
- }
158
- catch {
159
- /* ignore */
160
- }
161
- }
162
- }
163
- // Fallback to string
164
- return value;
165
- }
166
- function coerceFallback(value) {
167
- if (value === "true")
168
- return true;
169
- if (value === "false")
170
- return false;
171
- const num = Number(value);
172
- if (value !== "" && !isNaN(num))
173
- return num;
174
- if (value.startsWith("{") || value.startsWith("[")) {
175
- try {
176
- return JSON.parse(value);
177
- }
178
- catch {
179
- /* ignore */
180
- }
181
- }
182
- return value;
183
- }
184
- // ===== XML node helpers =====
185
- function isTextNode(node) {
186
- return "#text" in node;
187
- }
188
- function getTagName(node) {
189
- for (const key of Object.keys(node)) {
190
- if (key !== ":@")
191
- return key;
192
- }
193
- throw new Error("No tag name found in XML element");
194
- }
195
- function getAttributes(node) {
196
- const attrs = {};
197
- const rawAttrs = node[":@"];
198
- if (rawAttrs) {
199
- for (const [key, value] of Object.entries(rawAttrs)) {
200
- const attrName = key.startsWith("@_") ? key.slice(2) : key;
201
- attrs[attrName] = value;
202
- }
203
- }
204
- return attrs;
205
- }
206
- function getChildElements(node) {
207
- const tagName = getTagName(node);
208
- const children = node[tagName];
209
- if (!children)
210
- return [];
211
- return children.filter((child) => !isTextNode(child));
212
- }
213
- function getTextContent(node) {
214
- const tagName = getTagName(node);
215
- const children = node[tagName];
216
- if (!children)
217
- return undefined;
218
- const textParts = [];
219
- for (const child of children) {
220
- if (isTextNode(child)) {
221
- textParts.push(child["#text"]);
222
- }
223
- }
224
- return textParts.length > 0 ? textParts.join("") : undefined;
225
- }
226
- // ===== Node conversion =====
227
- function convertElement(node) {
228
- const tagName = getTagName(node);
229
- const nodeType = TAG_TO_TYPE[tagName];
230
- const attrs = getAttributes(node);
231
- const childElements = getChildElements(node);
232
- const textContent = getTextContent(node);
233
- if (nodeType) {
234
- return convertPomNode(nodeType, attrs, childElements, textContent);
235
- }
236
- else {
237
- return convertComponentNode(tagName, attrs, childElements, textContent);
238
- }
239
- }
240
- function convertPomNode(nodeType, attrs, childElements, textContent) {
241
- const result = { type: nodeType };
242
- for (const [key, value] of Object.entries(attrs)) {
243
- if (key === "type")
244
- continue;
245
- const propSchema = getPropertySchema(nodeType, key);
246
- if (propSchema) {
247
- result[key] = coerceValue(value, propSchema);
248
- }
249
- else {
250
- result[key] = coerceFallback(value);
251
- }
252
- }
253
- // Text content → text property for nodes that support it
254
- if (textContent !== undefined && TEXT_CONTENT_NODES.has(nodeType)) {
255
- if (!("text" in result)) {
256
- result.text = textContent;
257
- }
258
- }
259
- // Children for container nodes
260
- if (CONTAINER_TYPES.has(nodeType) && childElements.length > 0) {
261
- const convertedChildren = childElements.map(convertElement);
262
- if (nodeType === "box") {
263
- if (childElements.length !== 1) {
264
- throw new Error(`<Box> must have exactly 1 child element, but got ${childElements.length}`);
265
- }
266
- result.children = convertedChildren[0];
267
- }
268
- else {
269
- result.children = convertedChildren;
270
- }
271
- }
272
- return result;
273
- }
274
- function convertComponentNode(tagName, attrs, childElements, textContent) {
275
- const props = {};
276
- for (const [key, value] of Object.entries(attrs)) {
277
- props[key] = coerceFallback(value);
278
- }
279
- if (childElements.length > 0) {
280
- props.children = childElements.map(convertElement);
281
- }
282
- else if (textContent !== undefined) {
283
- props.children = textContent;
284
- }
285
- return {
286
- type: "component",
287
- name: tagName,
288
- props,
289
- };
290
- }
291
- /**
292
- * XML 文字列を POMNode 配列に変換する。
293
- *
294
- * XML タグは POM ノードタイプにマッピングされ、属性値は Zod スキーマを参照して
295
- * 適切な型(number, boolean, array, object)に変換される。
296
- * 組み込みノード以外のタグ名はカスタムコンポーネントとして扱われる。
297
- *
298
- * @example
299
- * ```typescript
300
- * import { parseXml, buildPptx } from "@hirokisakabe/pom";
301
- *
302
- * const xml = `
303
- * <VStack gap="16" padding="32">
304
- * <Text fontPx="32" bold="true">売上レポート</Text>
305
- * </VStack>
306
- * `;
307
- *
308
- * const nodes = parseXml(xml);
309
- * const pptx = await buildPptx(nodes, { w: 1280, h: 720 });
310
- * ```
311
- */
312
- export function parseXml(xmlString) {
313
- if (!xmlString.trim())
314
- return [];
315
- const parser = new XMLParser({
316
- preserveOrder: true,
317
- ignoreAttributes: false,
318
- attributeNamePrefix: "@_",
319
- parseAttributeValue: false,
320
- parseTagValue: false,
321
- trimValues: true,
322
- });
323
- const wrappedXml = `<__root__>${xmlString}</__root__>`;
324
- const parsed = parser.parse(wrappedXml);
325
- if (!parsed || parsed.length === 0)
326
- return [];
327
- const rootElement = parsed[0];
328
- const rootChildren = (rootElement["__root__"] ?? []);
329
- return rootChildren
330
- .filter((child) => !isTextNode(child))
331
- .map((child) => convertElement(child));
332
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=box.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/box.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export {};
2
- // box, vstack, hstack ノードは背景描画のみで、子要素は renderPptx.ts の renderNode() で再帰処理
3
- // このファイルは将来の拡張用に作成するが、現在は特別な処理を必要としない
@@ -1,6 +0,0 @@
1
- export { renderBackgroundAndBorder } from "./backgroundBorder.ts";
2
- export { drawCircle, drawLine } from "./shapeDrawing.ts";
3
- export type { CircleOptions, LineOptions } from "./shapeDrawing.ts";
4
- export { drawSimpleText } from "./textDrawing.ts";
5
- export type { SimpleTextOptions } from "./textDrawing.ts";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,3 +0,0 @@
1
- export { renderBackgroundAndBorder } from "./backgroundBorder.js";
2
- export { drawCircle, drawLine } from "./shapeDrawing.js";
3
- export { drawSimpleText } from "./textDrawing.js";
@@ -1,27 +0,0 @@
1
- import type { RenderContext } from "../types.ts";
2
- export type CircleOptions = {
3
- cx: number;
4
- cy: number;
5
- radius: number;
6
- fillColor: string;
7
- lineColor?: string;
8
- lineWidth?: number;
9
- };
10
- export type LineOptions = {
11
- x1: number;
12
- y1: number;
13
- x2: number;
14
- y2: number;
15
- color: string;
16
- width: number;
17
- endArrowType?: "none" | "arrow" | "diamond" | "oval" | "stealth" | "triangle";
18
- };
19
- /**
20
- * 円を描画する
21
- */
22
- export declare function drawCircle(ctx: RenderContext, options: CircleOptions): void;
23
- /**
24
- * 線を描画する
25
- */
26
- export declare function drawLine(ctx: RenderContext, options: LineOptions): void;
27
- //# sourceMappingURL=shapeDrawing.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shapeDrawing.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/utils/shapeDrawing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;CAC/E,CAAC;AAEF;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAa3E;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAiBvE"}
@@ -1,36 +0,0 @@
1
- import { pxToIn, pxToPt } from "../units.js";
2
- /**
3
- * 円を描画する
4
- */
5
- export function drawCircle(ctx, options) {
6
- const { cx, cy, radius, fillColor, lineColor, lineWidth } = options;
7
- ctx.slide.addShape(ctx.pptx.ShapeType.ellipse, {
8
- x: pxToIn(cx - radius),
9
- y: pxToIn(cy - radius),
10
- w: pxToIn(radius * 2),
11
- h: pxToIn(radius * 2),
12
- fill: { color: fillColor },
13
- line: lineColor
14
- ? { color: lineColor, width: lineWidth ? pxToPt(lineWidth) : undefined }
15
- : { type: "none" },
16
- });
17
- }
18
- /**
19
- * 線を描画する
20
- */
21
- export function drawLine(ctx, options) {
22
- const { x1, y1, x2, y2, color, width, endArrowType } = options;
23
- const isHorizontal = y1 === y2;
24
- const isVertical = x1 === x2;
25
- ctx.slide.addShape(ctx.pptx.ShapeType.line, {
26
- x: pxToIn(Math.min(x1, x2)),
27
- y: pxToIn(Math.min(y1, y2)),
28
- w: isVertical ? 0 : pxToIn(Math.abs(x2 - x1)),
29
- h: isHorizontal ? 0 : pxToIn(Math.abs(y2 - y1)),
30
- line: {
31
- color,
32
- width: pxToPt(width),
33
- endArrowType,
34
- },
35
- });
36
- }
@@ -1,25 +0,0 @@
1
- import type { Underline } from "../../types.ts";
2
- import type { RenderContext } from "../types.ts";
3
- export type SimpleTextOptions = {
4
- x: number;
5
- y: number;
6
- w: number;
7
- h: number;
8
- text: string;
9
- fontSize?: number;
10
- fontFace?: string;
11
- color?: string;
12
- bold?: boolean;
13
- italic?: boolean;
14
- underline?: Underline;
15
- strike?: boolean;
16
- highlight?: string;
17
- align?: "left" | "center" | "right";
18
- valign?: "top" | "middle" | "bottom";
19
- };
20
- /**
21
- * シンプルなテキストを描画する
22
- * timeline, matrix, tree, flow などの複雑ノードで使用
23
- */
24
- export declare function drawSimpleText(ctx: RenderContext, options: SimpleTextOptions): void;
25
- //# sourceMappingURL=textDrawing.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"textDrawing.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/utils/textDrawing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACtC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,iBAAiB,GACzB,IAAI,CAmCN"}
@@ -1,25 +0,0 @@
1
- import { pxToIn, pxToPt } from "../units.js";
2
- import { convertUnderline, convertStrike } from "../textOptions.js";
3
- /**
4
- * シンプルなテキストを描画する
5
- * timeline, matrix, tree, flow などの複雑ノードで使用
6
- */
7
- export function drawSimpleText(ctx, options) {
8
- const { x, y, w, h, text, fontSize = 12, fontFace = "Noto Sans JP", color = "000000", bold, italic, underline, strike, highlight, align = "left", valign = "top", } = options;
9
- ctx.slide.addText(text, {
10
- x: pxToIn(x),
11
- y: pxToIn(y),
12
- w: pxToIn(w),
13
- h: pxToIn(h),
14
- fontSize: pxToPt(fontSize),
15
- fontFace,
16
- color,
17
- bold,
18
- italic,
19
- underline: convertUnderline(underline),
20
- strike: convertStrike(strike),
21
- highlight,
22
- align,
23
- valign,
24
- });
25
- }
package/dist/schema.d.ts DELETED
@@ -1,23 +0,0 @@
1
- /**
2
- * Browser-compatible schema exports
3
- *
4
- * This module exports only the Zod schemas and types without any Node.js dependencies.
5
- * Use this entry point when you need to validate LLM-generated JSON in browser environments.
6
- *
7
- * @example
8
- * ```typescript
9
- * import { inputPomNodeSchema } from "@hirokisakabe/pom/schema";
10
- *
11
- * const result = inputPomNodeSchema.safeParse(llmResponse);
12
- * if (result.success) {
13
- * // Send to server for PPTX generation
14
- * await fetch("/api/generate-pptx", {
15
- * method: "POST",
16
- * body: JSON.stringify(result.data),
17
- * });
18
- * }
19
- * ```
20
- */
21
- export { inputPomNodeSchema, inputTextNodeSchema, inputImageNodeSchema, inputTableNodeSchema, inputBoxNodeSchema, inputVStackNodeSchema, inputHStackNodeSchema, inputShapeNodeSchema, inputChartNodeSchema, inputTimelineNodeSchema, inputMatrixNodeSchema, inputTreeNodeSchema, inputFlowNodeSchema, inputProcessArrowNodeSchema, inputLineNodeSchema, inputLayerNodeSchema, inputSlideMasterOptionsSchema, inputMasterTextObjectSchema, inputMasterImageObjectSchema, inputMasterRectObjectSchema, inputMasterLineObjectSchema, inputMasterObjectSchema, inputSlideNumberOptionsSchema, inputSlideMasterBackgroundSchema, inputSlideMasterMarginSchema, inputBaseNodeSchema, type InputPOMNode, type InputTextNode, type InputImageNode, type InputTableNode, type InputBoxNode, type InputVStackNode, type InputHStackNode, type InputShapeNode, type InputChartNode, type InputTimelineNode, type InputMatrixNode, type InputTreeNode, type InputFlowNode, type InputProcessArrowNode, type InputLineNode, type InputLayerNode, type InputSlideMasterOptions, } from "./inputSchema.ts";
22
- export { lengthSchema, paddingSchema, borderStyleSchema, borderDashSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, bulletNumberTypeSchema, tableColumnSchema, tableRowSchema, tableCellSchema, slideMasterOptionsSchema, masterTextObjectSchema, masterImageObjectSchema, masterRectObjectSchema, masterLineObjectSchema, masterObjectSchema, slideNumberOptionsSchema, slideMasterBackgroundSchema, slideMasterMarginSchema, type Length, type Padding, type BorderStyle, type BorderDash, type FillStyle, type ShadowStyle, type AlignItems, type JustifyContent, type ShapeType, type ChartType, type ChartData, type BulletOptions, type BulletNumberType, type TableColumn, type TableRow, type TableCell, type SlideMasterOptions, type MasterTextObject, type MasterImageObject, type MasterRectObject, type MasterLineObject, type MasterObject, type SlideNumberOptions, type SlideMasterBackground, type SlideMasterMargin, } from "./types.ts";
23
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACpB,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACvB,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,EAC5B,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,uBAAuB,GAC7B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC"}
package/dist/schema.js DELETED
@@ -1,24 +0,0 @@
1
- /**
2
- * Browser-compatible schema exports
3
- *
4
- * This module exports only the Zod schemas and types without any Node.js dependencies.
5
- * Use this entry point when you need to validate LLM-generated JSON in browser environments.
6
- *
7
- * @example
8
- * ```typescript
9
- * import { inputPomNodeSchema } from "@hirokisakabe/pom/schema";
10
- *
11
- * const result = inputPomNodeSchema.safeParse(llmResponse);
12
- * if (result.success) {
13
- * // Send to server for PPTX generation
14
- * await fetch("/api/generate-pptx", {
15
- * method: "POST",
16
- * body: JSON.stringify(result.data),
17
- * });
18
- * }
19
- * ```
20
- */
21
- // Input schemas for LLM/external input validation
22
- export { inputPomNodeSchema, inputTextNodeSchema, inputImageNodeSchema, inputTableNodeSchema, inputBoxNodeSchema, inputVStackNodeSchema, inputHStackNodeSchema, inputShapeNodeSchema, inputChartNodeSchema, inputTimelineNodeSchema, inputMatrixNodeSchema, inputTreeNodeSchema, inputFlowNodeSchema, inputProcessArrowNodeSchema, inputLineNodeSchema, inputLayerNodeSchema, inputSlideMasterOptionsSchema, inputMasterTextObjectSchema, inputMasterImageObjectSchema, inputMasterRectObjectSchema, inputMasterLineObjectSchema, inputMasterObjectSchema, inputSlideNumberOptionsSchema, inputSlideMasterBackgroundSchema, inputSlideMasterMarginSchema, inputBaseNodeSchema, } from "./inputSchema.js";
23
- // Basic type schemas (browser-compatible)
24
- export { lengthSchema, paddingSchema, borderStyleSchema, borderDashSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, bulletNumberTypeSchema, tableColumnSchema, tableRowSchema, tableCellSchema, slideMasterOptionsSchema, masterTextObjectSchema, masterImageObjectSchema, masterRectObjectSchema, masterLineObjectSchema, masterObjectSchema, slideNumberOptionsSchema, slideMasterBackgroundSchema, slideMasterMarginSchema, } from "./types.js";
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/table/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS;;;EAQrD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,YAGhD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,EACf,UAAU,EAAE,MAAM,GACjB,MAAM,EAAE,CAeV"}
File without changes