@hirokisakabe/pom 0.1.10 → 0.1.11
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 +196 -177
- package/dist/inputSchema.d.ts +8 -0
- package/dist/inputSchema.d.ts.map +1 -1
- package/dist/inputSchema.js +3 -1
- package/dist/renderPptx/renderPptx.d.ts.map +1 -1
- package/dist/renderPptx/renderPptx.js +4 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +11 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
# pom
|
|
2
2
|
|
|
3
|
-
**pom (PowerPoint Object Model)**
|
|
3
|
+
**pom (PowerPoint Object Model)** is a library for declaratively describing PowerPoint presentations (pptx) in TypeScript. It is designed for use cases where JSON in POM format generated by AI is converted into PowerPoint files.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Requirements
|
|
6
6
|
|
|
7
|
-
- Node.js 18
|
|
7
|
+
- Node.js 18 or higher
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> PPTX
|
|
10
|
+
> The PPTX generation feature (`buildPptx`) only works in Node.js environments. However, if you only need the input schema, you can import it from `@hirokisakabe/pom/schema` for use in browser environments.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Table of Contents
|
|
13
13
|
|
|
14
|
-
- [
|
|
15
|
-
- [
|
|
16
|
-
- [
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
21
|
-
- [LLM
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
14
|
+
- [Requirements](#requirements)
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [Quick Start](#quick-start)
|
|
17
|
+
- [Features](#features)
|
|
18
|
+
- [Nodes](#nodes)
|
|
19
|
+
- [Master Slide](#master-slide)
|
|
20
|
+
- [Serverless Environments](#serverless-environments)
|
|
21
|
+
- [LLM Integration](#llm-integration)
|
|
22
|
+
- [Input Validation in Browser Environments](#input-validation-in-browser-environments)
|
|
23
|
+
- [License](#license)
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## Installation
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
28
|
npm install @hirokisakabe/pom
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## Quick Start
|
|
32
32
|
|
|
33
33
|
```typescript
|
|
34
34
|
import { buildPptx, POMNode } from "@hirokisakabe/pom";
|
|
@@ -43,13 +43,13 @@ const slide: POMNode = {
|
|
|
43
43
|
children: [
|
|
44
44
|
{
|
|
45
45
|
type: "text",
|
|
46
|
-
text: "
|
|
46
|
+
text: "Presentation Title",
|
|
47
47
|
fontPx: 48,
|
|
48
48
|
bold: true,
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
type: "text",
|
|
52
|
-
text: "
|
|
52
|
+
text: "Subtitle",
|
|
53
53
|
fontPx: 24,
|
|
54
54
|
color: "666666",
|
|
55
55
|
},
|
|
@@ -60,21 +60,21 @@ const pptx = await buildPptx([slide], { w: 1280, h: 720 });
|
|
|
60
60
|
await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
##
|
|
63
|
+
## Features
|
|
64
64
|
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
- **PowerPoint
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
- **AI
|
|
65
|
+
- **Type-safe**: Strict type definitions with TypeScript
|
|
66
|
+
- **Declarative**: Describe slides with JSON-like objects
|
|
67
|
+
- **PowerPoint First**: Native support for Shape features
|
|
68
|
+
- **Flexible Layout**: Automatic layout with VStack/HStack/Box
|
|
69
|
+
- **Pixel Units**: Intuitive pixel-based sizing (internally converted to inches)
|
|
70
|
+
- **Master Slide**: Automatically insert common headers, footers, and page numbers across all pages
|
|
71
|
+
- **AI Friendly**: Simple structure that makes it easy for LLMs to generate code
|
|
72
72
|
|
|
73
|
-
##
|
|
73
|
+
## Nodes
|
|
74
74
|
|
|
75
|
-
###
|
|
75
|
+
### Common Properties
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
Layout attributes that all nodes can have.
|
|
78
78
|
|
|
79
79
|
```typescript
|
|
80
80
|
{
|
|
@@ -94,14 +94,14 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
94
94
|
}
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
- `backgroundColor`
|
|
98
|
-
- `border.width`
|
|
97
|
+
- `backgroundColor` applies a fill to the entire node (e.g., `"F8F9FA"`).
|
|
98
|
+
- `border.width` is specified in px and can be combined with color and `dashType` to control the border.
|
|
99
99
|
|
|
100
|
-
###
|
|
100
|
+
### Node List
|
|
101
101
|
|
|
102
102
|
#### 1. Text
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
A node for displaying text.
|
|
105
105
|
|
|
106
106
|
```typescript
|
|
107
107
|
{
|
|
@@ -115,79 +115,79 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
115
115
|
lineSpacingMultiple?: number;
|
|
116
116
|
bullet?: boolean | BulletOptions;
|
|
117
117
|
|
|
118
|
-
//
|
|
118
|
+
// Common properties
|
|
119
119
|
w?: number | "max" | `${number}%`;
|
|
120
120
|
h?: number | "max" | `${number}%`;
|
|
121
121
|
...
|
|
122
122
|
}
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
- `color`
|
|
126
|
-
- `bold`
|
|
127
|
-
- `fontFamily`
|
|
128
|
-
- `lineSpacingMultiple`
|
|
129
|
-
- `bullet`
|
|
125
|
+
- `color` specifies the text color as a hex color code (e.g., `"FF0000"`).
|
|
126
|
+
- `bold` enables bold text.
|
|
127
|
+
- `fontFamily` specifies the font family (default: `"Noto Sans JP"`).
|
|
128
|
+
- `lineSpacingMultiple` specifies the line spacing multiplier (default: `1.3`).
|
|
129
|
+
- `bullet` enables bullet points. Use `true` for default bullets, or an object for detailed settings.
|
|
130
130
|
|
|
131
131
|
**BulletOptions:**
|
|
132
132
|
|
|
133
133
|
```typescript
|
|
134
134
|
{
|
|
135
|
-
type?: "bullet" | "number"; // "bullet":
|
|
136
|
-
indent?: number; //
|
|
135
|
+
type?: "bullet" | "number"; // "bullet": symbol, "number": numbered
|
|
136
|
+
indent?: number; // Indent level
|
|
137
137
|
numberType?: "alphaLcParenBoth" | "alphaLcParenR" | "alphaLcPeriod" |
|
|
138
138
|
"alphaUcParenBoth" | "alphaUcParenR" | "alphaUcPeriod" |
|
|
139
139
|
"arabicParenBoth" | "arabicParenR" | "arabicPeriod" | "arabicPlain" |
|
|
140
140
|
"romanLcParenBoth" | "romanLcParenR" | "romanLcPeriod" |
|
|
141
141
|
"romanUcParenBoth" | "romanUcParenR" | "romanUcPeriod";
|
|
142
|
-
numberStartAt?: number; //
|
|
142
|
+
numberStartAt?: number; // Starting number
|
|
143
143
|
}
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
**Usage Examples:**
|
|
147
147
|
|
|
148
148
|
```typescript
|
|
149
|
-
//
|
|
149
|
+
// Simple bullet list
|
|
150
150
|
{
|
|
151
151
|
type: "text",
|
|
152
|
-
text: "
|
|
152
|
+
text: "Item 1\nItem 2\nItem 3",
|
|
153
153
|
bullet: true,
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
//
|
|
156
|
+
// Numbered list
|
|
157
157
|
{
|
|
158
158
|
type: "text",
|
|
159
|
-
text: "
|
|
159
|
+
text: "Step 1\nStep 2\nStep 3",
|
|
160
160
|
bullet: { type: "number" },
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
//
|
|
163
|
+
// Lowercase alphabet (a. b. c.)
|
|
164
164
|
{
|
|
165
165
|
type: "text",
|
|
166
|
-
text: "
|
|
166
|
+
text: "Item A\nItem B\nItem C",
|
|
167
167
|
bullet: { type: "number", numberType: "alphaLcPeriod" },
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
// 5
|
|
170
|
+
// Numbered list starting from 5
|
|
171
171
|
{
|
|
172
172
|
type: "text",
|
|
173
|
-
text: "
|
|
173
|
+
text: "Fifth\nSixth\nSeventh",
|
|
174
174
|
bullet: { type: "number", numberStartAt: 5 },
|
|
175
175
|
}
|
|
176
176
|
```
|
|
177
177
|
|
|
178
178
|
#### 2. Image
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
A node for displaying images.
|
|
181
181
|
|
|
182
|
-
- `w`
|
|
183
|
-
-
|
|
182
|
+
- If `w` and `h` are not specified, the actual image size is automatically used
|
|
183
|
+
- If size is specified, the image is displayed at that size (aspect ratio is not preserved)
|
|
184
184
|
|
|
185
185
|
```typescript
|
|
186
186
|
{
|
|
187
187
|
type: "image";
|
|
188
|
-
src: string; //
|
|
188
|
+
src: string; // Image path (local path, URL, or base64 data)
|
|
189
189
|
|
|
190
|
-
//
|
|
190
|
+
// Common properties
|
|
191
191
|
w?: number | "max" | `${number}%`;
|
|
192
192
|
h?: number | "max" | `${number}%`;
|
|
193
193
|
...
|
|
@@ -196,7 +196,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
196
196
|
|
|
197
197
|
#### 3. Table
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
A node for drawing tables. Column widths and row heights are declared in px, with fine-grained control over cell decoration.
|
|
200
200
|
|
|
201
201
|
```typescript
|
|
202
202
|
{
|
|
@@ -215,27 +215,27 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
215
215
|
}[];
|
|
216
216
|
defaultRowHeight?: number;
|
|
217
217
|
|
|
218
|
-
//
|
|
218
|
+
// Common properties
|
|
219
219
|
w?: number | "max" | `${number}%`;
|
|
220
220
|
h?: number | "max" | `${number}%`;
|
|
221
221
|
...
|
|
222
222
|
}
|
|
223
223
|
```
|
|
224
224
|
|
|
225
|
-
- `columns[].width`
|
|
226
|
-
- `columns`
|
|
227
|
-
- `rows`
|
|
228
|
-
-
|
|
225
|
+
- If `columns[].width` is omitted, columns are evenly distributed across the table width.
|
|
226
|
+
- The sum of `columns` becomes the natural width of the table (can be overridden with `w` if needed).
|
|
227
|
+
- If `rows` `height` is omitted, `defaultRowHeight` is applied (32px if unspecified).
|
|
228
|
+
- Cell background and font decoration can be specified individually for each element in `cells`.
|
|
229
229
|
|
|
230
230
|
#### 4. Shape
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
A node for drawing shapes. Different representations are possible with or without text, supporting complex visual effects.
|
|
233
233
|
|
|
234
234
|
```typescript
|
|
235
235
|
{
|
|
236
236
|
type: "shape";
|
|
237
|
-
shapeType: PptxGenJS.SHAPE_NAME; //
|
|
238
|
-
text?: string; //
|
|
237
|
+
shapeType: PptxGenJS.SHAPE_NAME; // e.g., "roundRect", "ellipse", "cloud", "star5"
|
|
238
|
+
text?: string; // Text to display inside the shape (optional)
|
|
239
239
|
fill?: {
|
|
240
240
|
color?: string;
|
|
241
241
|
transparency?: number;
|
|
@@ -257,36 +257,36 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
257
257
|
color?: string;
|
|
258
258
|
alignText?: "left" | "center" | "right";
|
|
259
259
|
|
|
260
|
-
//
|
|
260
|
+
// Common properties
|
|
261
261
|
w?: number | "max" | `${number}%`;
|
|
262
262
|
h?: number | "max" | `${number}%`;
|
|
263
263
|
...
|
|
264
264
|
}
|
|
265
265
|
```
|
|
266
266
|
|
|
267
|
-
|
|
267
|
+
**Common Shape Types:**
|
|
268
268
|
|
|
269
|
-
- `roundRect`:
|
|
270
|
-
- `ellipse`:
|
|
271
|
-
- `cloud`:
|
|
272
|
-
- `wedgeRectCallout`:
|
|
273
|
-
- `cloudCallout`:
|
|
274
|
-
- `star5`: 5
|
|
275
|
-
- `downArrow`:
|
|
269
|
+
- `roundRect`: Rounded rectangle (title boxes, category displays)
|
|
270
|
+
- `ellipse`: Ellipse/circle (step numbers, badges)
|
|
271
|
+
- `cloud`: Cloud shape (comments, key points)
|
|
272
|
+
- `wedgeRectCallout`: Callout with arrow (annotations)
|
|
273
|
+
- `cloudCallout`: Cloud callout (comments)
|
|
274
|
+
- `star5`: 5-pointed star (emphasis, decoration)
|
|
275
|
+
- `downArrow`: Down arrow (flow diagrams)
|
|
276
276
|
|
|
277
277
|
#### 5. Box
|
|
278
278
|
|
|
279
|
-
|
|
279
|
+
A generic container that wraps a single child element.
|
|
280
280
|
|
|
281
|
-
-
|
|
282
|
-
- padding
|
|
281
|
+
- Only **one** child element
|
|
282
|
+
- Used for grouping with padding or fixed size
|
|
283
283
|
|
|
284
284
|
```typescript
|
|
285
285
|
{
|
|
286
286
|
type: "box";
|
|
287
287
|
children: POMNode;
|
|
288
288
|
|
|
289
|
-
//
|
|
289
|
+
// Common properties
|
|
290
290
|
w?: number | "max" | `${number}%`;
|
|
291
291
|
h?: number | "max" | `${number}%`;
|
|
292
292
|
...
|
|
@@ -295,7 +295,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
295
295
|
|
|
296
296
|
#### 6. VStack
|
|
297
297
|
|
|
298
|
-
|
|
298
|
+
Arranges child elements **vertically**.
|
|
299
299
|
|
|
300
300
|
```typescript
|
|
301
301
|
{
|
|
@@ -305,7 +305,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
305
305
|
justifyContent: "start" | "center" | "end" | "spaceBetween";
|
|
306
306
|
gap?: number;
|
|
307
307
|
|
|
308
|
-
//
|
|
308
|
+
// Common properties
|
|
309
309
|
w?: number | "max" | `${number}%`;
|
|
310
310
|
h?: number | "max" | `${number}%`;
|
|
311
311
|
...
|
|
@@ -314,7 +314,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
314
314
|
|
|
315
315
|
#### 7. HStack
|
|
316
316
|
|
|
317
|
-
|
|
317
|
+
Arranges child elements **horizontally**.
|
|
318
318
|
|
|
319
319
|
```typescript
|
|
320
320
|
{
|
|
@@ -324,7 +324,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
324
324
|
justifyContent: "start" | "center" | "end" | "spaceBetween";
|
|
325
325
|
gap?: number;
|
|
326
326
|
|
|
327
|
-
//
|
|
327
|
+
// Common properties
|
|
328
328
|
w?: number | "max" | `${number}%`;
|
|
329
329
|
h?: number | "max" | `${number}%`;
|
|
330
330
|
...
|
|
@@ -333,33 +333,34 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
333
333
|
|
|
334
334
|
#### 8. Chart
|
|
335
335
|
|
|
336
|
-
|
|
336
|
+
A node for drawing charts. Supports bar charts, line charts, pie charts, area charts, doughnut charts, and radar charts.
|
|
337
337
|
|
|
338
338
|
```typescript
|
|
339
339
|
{
|
|
340
340
|
type: "chart";
|
|
341
|
-
chartType: "bar" | "line" | "pie";
|
|
341
|
+
chartType: "bar" | "line" | "pie" | "area" | "doughnut" | "radar";
|
|
342
342
|
data: {
|
|
343
|
-
name?: string; //
|
|
344
|
-
labels: string[]; //
|
|
345
|
-
values: number[]; //
|
|
343
|
+
name?: string; // Series name
|
|
344
|
+
labels: string[]; // Category labels
|
|
345
|
+
values: number[]; // Values
|
|
346
346
|
}[];
|
|
347
|
-
showLegend?: boolean; //
|
|
348
|
-
showTitle?: boolean; //
|
|
349
|
-
title?: string; //
|
|
350
|
-
chartColors?: string[]; //
|
|
347
|
+
showLegend?: boolean; // Show legend (default: false)
|
|
348
|
+
showTitle?: boolean; // Show title (default: false)
|
|
349
|
+
title?: string; // Title string
|
|
350
|
+
chartColors?: string[]; // Data color array (hex color codes)
|
|
351
|
+
radarStyle?: "standard" | "marker" | "filled"; // Radar-only: chart style
|
|
351
352
|
|
|
352
|
-
//
|
|
353
|
+
// Common properties
|
|
353
354
|
w?: number | "max" | `${number}%`;
|
|
354
355
|
h?: number | "max" | `${number}%`;
|
|
355
356
|
...
|
|
356
357
|
}
|
|
357
358
|
```
|
|
358
359
|
|
|
359
|
-
|
|
360
|
+
**Usage Examples:**
|
|
360
361
|
|
|
361
362
|
```typescript
|
|
362
|
-
//
|
|
363
|
+
// Bar chart
|
|
363
364
|
{
|
|
364
365
|
type: "chart",
|
|
365
366
|
chartType: "bar",
|
|
@@ -367,23 +368,23 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
367
368
|
h: 400,
|
|
368
369
|
data: [
|
|
369
370
|
{
|
|
370
|
-
name: "
|
|
371
|
-
labels: ["
|
|
371
|
+
name: "Sales",
|
|
372
|
+
labels: ["Jan", "Feb", "Mar", "Apr"],
|
|
372
373
|
values: [100, 200, 150, 300],
|
|
373
374
|
},
|
|
374
375
|
{
|
|
375
|
-
name: "
|
|
376
|
-
labels: ["
|
|
376
|
+
name: "Profit",
|
|
377
|
+
labels: ["Jan", "Feb", "Mar", "Apr"],
|
|
377
378
|
values: [30, 60, 45, 90],
|
|
378
379
|
},
|
|
379
380
|
],
|
|
380
381
|
showLegend: true,
|
|
381
382
|
showTitle: true,
|
|
382
|
-
title: "
|
|
383
|
+
title: "Monthly Sales & Profit",
|
|
383
384
|
chartColors: ["0088CC", "00AA00"],
|
|
384
385
|
}
|
|
385
386
|
|
|
386
|
-
//
|
|
387
|
+
// Pie chart
|
|
387
388
|
{
|
|
388
389
|
type: "chart",
|
|
389
390
|
chartType: "pie",
|
|
@@ -391,21 +392,39 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
391
392
|
h: 300,
|
|
392
393
|
data: [
|
|
393
394
|
{
|
|
394
|
-
name: "
|
|
395
|
-
labels: ["
|
|
395
|
+
name: "Market Share",
|
|
396
|
+
labels: ["Product A", "Product B", "Product C", "Others"],
|
|
396
397
|
values: [40, 30, 20, 10],
|
|
397
398
|
},
|
|
398
399
|
],
|
|
399
400
|
showLegend: true,
|
|
400
401
|
chartColors: ["0088CC", "00AA00", "FF6600", "888888"],
|
|
401
402
|
}
|
|
403
|
+
|
|
404
|
+
// Radar chart
|
|
405
|
+
{
|
|
406
|
+
type: "chart",
|
|
407
|
+
chartType: "radar",
|
|
408
|
+
w: 400,
|
|
409
|
+
h: 300,
|
|
410
|
+
data: [
|
|
411
|
+
{
|
|
412
|
+
name: "Skill Assessment",
|
|
413
|
+
labels: ["Technical", "Design", "PM", "Sales", "Support"],
|
|
414
|
+
values: [80, 60, 70, 50, 90],
|
|
415
|
+
},
|
|
416
|
+
],
|
|
417
|
+
showLegend: true,
|
|
418
|
+
radarStyle: "filled",
|
|
419
|
+
chartColors: ["0088CC"],
|
|
420
|
+
}
|
|
402
421
|
```
|
|
403
422
|
|
|
404
|
-
##
|
|
423
|
+
## Master Slide
|
|
405
424
|
|
|
406
|
-
|
|
425
|
+
You can automatically insert common headers, footers, and page numbers across all pages.
|
|
407
426
|
|
|
408
|
-
###
|
|
427
|
+
### Basic Usage
|
|
409
428
|
|
|
410
429
|
```typescript
|
|
411
430
|
import { buildPptx } from "@hirokisakabe/pom";
|
|
@@ -425,7 +444,7 @@ const pptx = await buildPptx(
|
|
|
425
444
|
children: [
|
|
426
445
|
{
|
|
427
446
|
type: "text",
|
|
428
|
-
text: "
|
|
447
|
+
text: "Company Name",
|
|
429
448
|
fontPx: 14,
|
|
430
449
|
color: "FFFFFF",
|
|
431
450
|
},
|
|
@@ -460,50 +479,50 @@ const pptx = await buildPptx(
|
|
|
460
479
|
],
|
|
461
480
|
},
|
|
462
481
|
date: {
|
|
463
|
-
format: "YYYY/MM/DD", //
|
|
482
|
+
format: "YYYY/MM/DD", // or "locale"
|
|
464
483
|
},
|
|
465
484
|
},
|
|
466
485
|
},
|
|
467
486
|
);
|
|
468
487
|
```
|
|
469
488
|
|
|
470
|
-
###
|
|
489
|
+
### Master Slide Options
|
|
471
490
|
|
|
472
491
|
```typescript
|
|
473
492
|
type MasterSlideOptions = {
|
|
474
|
-
header?: POMNode; //
|
|
475
|
-
footer?: POMNode; //
|
|
493
|
+
header?: POMNode; // Header (any POMNode can be specified)
|
|
494
|
+
footer?: POMNode; // Footer (any POMNode can be specified)
|
|
476
495
|
pageNumber?: {
|
|
477
|
-
position: "left" | "center" | "right"; //
|
|
496
|
+
position: "left" | "center" | "right"; // Page number position
|
|
478
497
|
};
|
|
479
498
|
date?: {
|
|
480
|
-
format: "YYYY/MM/DD" | "locale"; //
|
|
499
|
+
format: "YYYY/MM/DD" | "locale"; // Date format
|
|
481
500
|
};
|
|
482
501
|
};
|
|
483
502
|
```
|
|
484
503
|
|
|
485
|
-
###
|
|
504
|
+
### Placeholders
|
|
486
505
|
|
|
487
|
-
|
|
506
|
+
The following placeholders can be used in text within headers and footers:
|
|
488
507
|
|
|
489
|
-
- `{{page}}`:
|
|
490
|
-
- `{{totalPages}}`:
|
|
491
|
-
- `{{date}}`:
|
|
508
|
+
- `{{page}}`: Current page number
|
|
509
|
+
- `{{totalPages}}`: Total number of pages
|
|
510
|
+
- `{{date}}`: Date (in the format specified by `date.format`)
|
|
492
511
|
|
|
493
|
-
###
|
|
512
|
+
### Features
|
|
494
513
|
|
|
495
|
-
-
|
|
496
|
-
-
|
|
497
|
-
-
|
|
498
|
-
-
|
|
514
|
+
- **Flexibility**: Headers and footers can use any POMNode (VStack, HStack, Box, etc.)
|
|
515
|
+
- **Automatic Composition**: Headers and footers are automatically added to each page's content
|
|
516
|
+
- **Dynamic Replacement**: Placeholders are automatically replaced per page
|
|
517
|
+
- **Backward Compatibility**: The master option is optional and has no impact on existing code
|
|
499
518
|
|
|
500
|
-
##
|
|
519
|
+
## Serverless Environments
|
|
501
520
|
|
|
502
|
-
pom
|
|
521
|
+
pom uses the `canvas` package by default to measure text width and determine line break positions. However, in serverless environments like Vercel or AWS Lambda, Japanese fonts (such as Noto Sans JP) are not installed, which may cause text line breaks to be misaligned.
|
|
503
522
|
|
|
504
|
-
|
|
523
|
+
To address this issue, you can specify the text measurement method using the `textMeasurement` option.
|
|
505
524
|
|
|
506
|
-
### textMeasurement
|
|
525
|
+
### textMeasurement Option
|
|
507
526
|
|
|
508
527
|
```typescript
|
|
509
528
|
const pptx = await buildPptx(
|
|
@@ -515,48 +534,48 @@ const pptx = await buildPptx(
|
|
|
515
534
|
);
|
|
516
535
|
```
|
|
517
536
|
|
|
518
|
-
|
|
|
519
|
-
| ------------ |
|
|
520
|
-
| `"canvas"` |
|
|
521
|
-
| `"fallback"` |
|
|
522
|
-
| `"auto"` |
|
|
537
|
+
| Value | Description |
|
|
538
|
+
| ------------ | -------------------------------------------------------------------------------------- |
|
|
539
|
+
| `"canvas"` | Always use canvas for text width measurement (for environments with fonts installed) |
|
|
540
|
+
| `"fallback"` | Always use fallback calculation (CJK characters = 1em, alphanumeric = 0.5em estimated) |
|
|
541
|
+
| `"auto"` | Auto-detect font availability and fall back if unavailable (default) |
|
|
523
542
|
|
|
524
|
-
###
|
|
543
|
+
### Recommended Settings
|
|
525
544
|
|
|
526
|
-
-
|
|
527
|
-
-
|
|
528
|
-
-
|
|
545
|
+
- **Local development / Docker**: Default (`"auto"`) works fine
|
|
546
|
+
- **Serverless environments**: Default `"auto"` will automatically fall back
|
|
547
|
+
- **Environments with fonts installed**: Explicitly specifying `"canvas"` enables more accurate measurement
|
|
529
548
|
|
|
530
|
-
## LLM
|
|
549
|
+
## LLM Integration
|
|
531
550
|
|
|
532
|
-
pom
|
|
551
|
+
pom supports use cases where slides are created from JSON generated by LLMs (GPT-4o, Claude, etc.).
|
|
533
552
|
|
|
534
|
-
### LLM
|
|
553
|
+
### LLM Specification Guide
|
|
535
554
|
|
|
536
|
-
[`llm-guide.md`](./llm-guide.md)
|
|
555
|
+
[`llm-guide.md`](./llm-guide.md) is a compact specification document for having LLMs generate JSON in pom format. Include it in your system prompt.
|
|
537
556
|
|
|
538
|
-
|
|
557
|
+
**Contents:**
|
|
539
558
|
|
|
540
|
-
-
|
|
541
|
-
-
|
|
542
|
-
-
|
|
543
|
-
-
|
|
559
|
+
- Node list and main properties
|
|
560
|
+
- Standard settings (slide size, padding, gap, font size guidelines)
|
|
561
|
+
- Pattern examples (basic structure, 2-column, table, shapes, charts, etc.)
|
|
562
|
+
- Common mistakes and correct usage
|
|
544
563
|
|
|
545
|
-
###
|
|
564
|
+
### Input Schema
|
|
546
565
|
|
|
547
|
-
`inputPomNodeSchema`
|
|
566
|
+
Use `inputPomNodeSchema` to validate JSON generated by LLMs.
|
|
548
567
|
|
|
549
568
|
```typescript
|
|
550
569
|
import { inputPomNodeSchema, buildPptx, InputPOMNode } from "@hirokisakabe/pom";
|
|
551
570
|
|
|
552
|
-
// LLM
|
|
571
|
+
// Validate JSON output from LLM
|
|
553
572
|
const jsonFromLLM = `{
|
|
554
573
|
"type": "vstack",
|
|
555
574
|
"padding": 48,
|
|
556
575
|
"gap": 24,
|
|
557
576
|
"children": [
|
|
558
|
-
{ "type": "text", "text": "
|
|
559
|
-
{ "type": "text", "text": "
|
|
577
|
+
{ "type": "text", "text": "Title", "fontPx": 32, "bold": true },
|
|
578
|
+
{ "type": "text", "text": "Body text", "fontPx": 16 }
|
|
560
579
|
]
|
|
561
580
|
}`;
|
|
562
581
|
|
|
@@ -564,61 +583,61 @@ const parsed = JSON.parse(jsonFromLLM);
|
|
|
564
583
|
const result = inputPomNodeSchema.safeParse(parsed);
|
|
565
584
|
|
|
566
585
|
if (result.success) {
|
|
567
|
-
//
|
|
586
|
+
// Validation successful - generate PPTX
|
|
568
587
|
const pptx = await buildPptx([result.data], { w: 1280, h: 720 });
|
|
569
588
|
await pptx.writeFile({ fileName: "output.pptx" });
|
|
570
589
|
} else {
|
|
571
|
-
//
|
|
590
|
+
// Validation failed - check error details
|
|
572
591
|
console.error("Validation failed:", result.error.format());
|
|
573
592
|
}
|
|
574
593
|
```
|
|
575
594
|
|
|
576
|
-
###
|
|
595
|
+
### Available Input Schemas
|
|
577
596
|
|
|
578
|
-
|
|
|
579
|
-
| ------------------------------- |
|
|
580
|
-
| `inputPomNodeSchema` |
|
|
581
|
-
| `inputTextNodeSchema` |
|
|
582
|
-
| `inputImageNodeSchema` |
|
|
583
|
-
| `inputTableNodeSchema` |
|
|
584
|
-
| `inputShapeNodeSchema` |
|
|
585
|
-
| `inputChartNodeSchema` |
|
|
586
|
-
| `inputBoxNodeSchema` | Box
|
|
587
|
-
| `inputVStackNodeSchema` | VStack
|
|
588
|
-
| `inputHStackNodeSchema` | HStack
|
|
589
|
-
| `inputMasterSlideOptionsSchema` |
|
|
597
|
+
| Schema | Description |
|
|
598
|
+
| ------------------------------- | ------------------------------------------ |
|
|
599
|
+
| `inputPomNodeSchema` | Main node schema (includes all node types) |
|
|
600
|
+
| `inputTextNodeSchema` | For text nodes |
|
|
601
|
+
| `inputImageNodeSchema` | For image nodes |
|
|
602
|
+
| `inputTableNodeSchema` | For table nodes |
|
|
603
|
+
| `inputShapeNodeSchema` | For shape nodes |
|
|
604
|
+
| `inputChartNodeSchema` | For chart nodes |
|
|
605
|
+
| `inputBoxNodeSchema` | For Box nodes |
|
|
606
|
+
| `inputVStackNodeSchema` | For VStack nodes |
|
|
607
|
+
| `inputHStackNodeSchema` | For HStack nodes |
|
|
608
|
+
| `inputMasterSlideOptionsSchema` | For master slide settings |
|
|
590
609
|
|
|
591
|
-
###
|
|
610
|
+
### Input Validation in Browser Environments
|
|
592
611
|
|
|
593
|
-
|
|
612
|
+
If you want to validate LLM output in browser environments (SPAs like React, Vue, Svelte), you can import schemas from `@hirokisakabe/pom/schema`. This subpath exports only schemas without Node.js dependencies, so it works in browsers.
|
|
594
613
|
|
|
595
614
|
```typescript
|
|
596
|
-
//
|
|
615
|
+
// Available in browser environments
|
|
597
616
|
import { inputPomNodeSchema } from "@hirokisakabe/pom/schema";
|
|
598
617
|
|
|
599
|
-
// LLM
|
|
618
|
+
// Validate response from LLM
|
|
600
619
|
const result = inputPomNodeSchema.safeParse(llmResponse);
|
|
601
620
|
|
|
602
621
|
if (result.success) {
|
|
603
|
-
//
|
|
622
|
+
// Validation successful - send to server for PPTX generation
|
|
604
623
|
await fetch("/api/generate-pptx", {
|
|
605
624
|
method: "POST",
|
|
606
625
|
headers: { "Content-Type": "application/json" },
|
|
607
626
|
body: JSON.stringify(result.data),
|
|
608
627
|
});
|
|
609
628
|
} else {
|
|
610
|
-
//
|
|
629
|
+
// Validation failed - show error to user
|
|
611
630
|
console.error("Validation failed:", result.error.format());
|
|
612
631
|
}
|
|
613
632
|
```
|
|
614
633
|
|
|
615
|
-
|
|
634
|
+
**Difference between `@hirokisakabe/pom` and `@hirokisakabe/pom/schema`:**
|
|
616
635
|
|
|
617
|
-
|
|
|
618
|
-
| -------------------------- |
|
|
619
|
-
| `@hirokisakabe/pom` | Node.js
|
|
620
|
-
| `@hirokisakabe/pom/schema` |
|
|
636
|
+
| Import Path | Environment | Included Features |
|
|
637
|
+
| -------------------------- | --------------- | -------------------------------------------- |
|
|
638
|
+
| `@hirokisakabe/pom` | Node.js | Everything (PPTX generation, schemas, types) |
|
|
639
|
+
| `@hirokisakabe/pom/schema` | Browser-capable | Schemas and types only (no PPTX generation) |
|
|
621
640
|
|
|
622
|
-
##
|
|
641
|
+
## License
|
|
623
642
|
|
|
624
643
|
MIT
|
package/dist/inputSchema.d.ts
CHANGED
|
@@ -475,6 +475,9 @@ export declare const inputChartNodeSchema: z.ZodObject<{
|
|
|
475
475
|
line: "line";
|
|
476
476
|
pie: "pie";
|
|
477
477
|
bar: "bar";
|
|
478
|
+
area: "area";
|
|
479
|
+
doughnut: "doughnut";
|
|
480
|
+
radar: "radar";
|
|
478
481
|
}>;
|
|
479
482
|
data: z.ZodArray<z.ZodObject<{
|
|
480
483
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -485,6 +488,11 @@ export declare const inputChartNodeSchema: z.ZodObject<{
|
|
|
485
488
|
showTitle: z.ZodOptional<z.ZodBoolean>;
|
|
486
489
|
title: z.ZodOptional<z.ZodString>;
|
|
487
490
|
chartColors: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
491
|
+
radarStyle: z.ZodOptional<z.ZodEnum<{
|
|
492
|
+
standard: "standard";
|
|
493
|
+
marker: "marker";
|
|
494
|
+
filled: "filled";
|
|
495
|
+
}>>;
|
|
488
496
|
}, z.core.$strip>;
|
|
489
497
|
export type InputTextNode = z.infer<typeof inputTextNodeSchema>;
|
|
490
498
|
export type InputImageNode = z.infer<typeof inputImageNodeSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../src/inputSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../src/inputSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAgBL,KAAK,UAAU,EACf,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU9B,CAAC;AAEH,KAAK,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGzD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU9B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,GACd,cAAc,CAAC;AAwBnB,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CACJ,CAAC;AACpD,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CACJ,CAAC;AAC1D,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CACJ,CAAC;AAE1D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAW3B,CAAC;AAG7B,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;iBAaxC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC"}
|
package/dist/inputSchema.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
import { z } from "zod";
|
|
20
|
-
import { lengthSchema, paddingSchema, borderStyleSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, tableColumnSchema, tableRowSchema, pageNumberPositionSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, } from "./types";
|
|
20
|
+
import { lengthSchema, paddingSchema, borderStyleSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, tableColumnSchema, tableRowSchema, pageNumberPositionSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, radarStyleSchema, } from "./types";
|
|
21
21
|
// ===== Base Node Schema =====
|
|
22
22
|
export const inputBaseNodeSchema = z.object({
|
|
23
23
|
w: lengthSchema.optional(),
|
|
@@ -71,6 +71,8 @@ export const inputChartNodeSchema = inputBaseNodeSchema.extend({
|
|
|
71
71
|
showTitle: z.boolean().optional(),
|
|
72
72
|
title: z.string().optional(),
|
|
73
73
|
chartColors: z.array(z.string()).optional(),
|
|
74
|
+
// radar専用オプション
|
|
75
|
+
radarStyle: radarStyleSchema.optional(),
|
|
74
76
|
});
|
|
75
77
|
// ===== Recursive Node Schemas =====
|
|
76
78
|
const inputBoxNodeSchemaBase = inputBaseNodeSchema.extend({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderPptx.d.ts","sourceRoot":"","sources":["../../src/renderPptx/renderPptx.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,aAAa,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK/C,KAAK,OAAO,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"renderPptx.d.ts","sourceRoot":"","sources":["../../src/renderPptx/renderPptx.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,aAAa,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK/C,KAAK,OAAO,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,OAAO,iBA0NnE"}
|
|
@@ -185,6 +185,10 @@ export function renderPptx(pages, slidePx) {
|
|
|
185
185
|
title: node.title,
|
|
186
186
|
chartColors: node.chartColors,
|
|
187
187
|
};
|
|
188
|
+
// radar専用オプション
|
|
189
|
+
if (node.chartType === "radar" && node.radarStyle) {
|
|
190
|
+
chartOptions.radarStyle = node.radarStyle;
|
|
191
|
+
}
|
|
188
192
|
slide.addChart(node.chartType, chartData, chartOptions);
|
|
189
193
|
break;
|
|
190
194
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -764,6 +764,14 @@ export declare const chartTypeSchema: z.ZodEnum<{
|
|
|
764
764
|
line: "line";
|
|
765
765
|
pie: "pie";
|
|
766
766
|
bar: "bar";
|
|
767
|
+
area: "area";
|
|
768
|
+
doughnut: "doughnut";
|
|
769
|
+
radar: "radar";
|
|
770
|
+
}>;
|
|
771
|
+
export declare const radarStyleSchema: z.ZodEnum<{
|
|
772
|
+
standard: "standard";
|
|
773
|
+
marker: "marker";
|
|
774
|
+
filled: "filled";
|
|
767
775
|
}>;
|
|
768
776
|
export declare const chartDataSchema: z.ZodObject<{
|
|
769
777
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -804,6 +812,9 @@ export declare const chartNodeSchema: z.ZodObject<{
|
|
|
804
812
|
line: "line";
|
|
805
813
|
pie: "pie";
|
|
806
814
|
bar: "bar";
|
|
815
|
+
area: "area";
|
|
816
|
+
doughnut: "doughnut";
|
|
817
|
+
radar: "radar";
|
|
807
818
|
}>;
|
|
808
819
|
data: z.ZodArray<z.ZodObject<{
|
|
809
820
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -814,6 +825,11 @@ export declare const chartNodeSchema: z.ZodObject<{
|
|
|
814
825
|
showTitle: z.ZodOptional<z.ZodBoolean>;
|
|
815
826
|
title: z.ZodOptional<z.ZodString>;
|
|
816
827
|
chartColors: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
828
|
+
radarStyle: z.ZodOptional<z.ZodEnum<{
|
|
829
|
+
standard: "standard";
|
|
830
|
+
marker: "marker";
|
|
831
|
+
filled: "filled";
|
|
832
|
+
}>>;
|
|
817
833
|
}, z.core.$strip>;
|
|
818
834
|
export type TextNode = z.infer<typeof textNodeSchema>;
|
|
819
835
|
export type ImageNode = z.infer<typeof imageNodeSchema>;
|
|
@@ -825,6 +841,7 @@ export type ShapeNode = z.infer<typeof shapeNodeSchema>;
|
|
|
825
841
|
export type ChartType = z.infer<typeof chartTypeSchema>;
|
|
826
842
|
export type ChartData = z.infer<typeof chartDataSchema>;
|
|
827
843
|
export type ChartNode = z.infer<typeof chartNodeSchema>;
|
|
844
|
+
export type RadarStyle = z.infer<typeof radarStyleSchema>;
|
|
828
845
|
export type BoxNode = BasePOMNode & {
|
|
829
846
|
type: "box";
|
|
830
847
|
children: POMNode;
|
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,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,YAAY,sEAIvB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;mBAQxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;EAS3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;iBAI5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;iBAG1B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;iBAO5B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;EAiBjC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;iBAK9B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;EAAgD,CAAC;AAE9E,eAAO,MAAM,oBAAoB;;;;;;;EAO/B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;EAA4B,CAAC;AAE7D,eAAO,MAAM,eAAe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SAAS,GAAG,cAAc,CAAC,GAC5B,CAAC,OAAO,GAAG,cAAc,GAAG;IAAE,QAAQ,EAAE,cAAc,CAAA;CAAE,CAAC,GACzD,CAAC,UAAU,GAAG,cAAc,GAAG;IAAE,QAAQ,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC,GAC9D,CAAC,UAAU,GAAG,cAAc,GAAG;IAAE,QAAQ,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC,GAC9D,CAAC,SAAS,GAAG,cAAc,CAAC,GAC5B,CAAC,SAAS,GAAG,cAAc,CAAC,CAAC;AAEjC,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAmB7B,CAAC;AAG/B,eAAO,MAAM,wBAAwB;;;;EAAsC,CAAC;AAE5E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;iBAanC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -317,7 +317,15 @@ export const shapeNodeSchema = basePOMNodeSchema.extend({
|
|
|
317
317
|
alignText: z.enum(["left", "center", "right"]).optional(),
|
|
318
318
|
bold: z.boolean().optional(),
|
|
319
319
|
});
|
|
320
|
-
export const chartTypeSchema = z.enum([
|
|
320
|
+
export const chartTypeSchema = z.enum([
|
|
321
|
+
"bar",
|
|
322
|
+
"line",
|
|
323
|
+
"pie",
|
|
324
|
+
"area",
|
|
325
|
+
"doughnut",
|
|
326
|
+
"radar",
|
|
327
|
+
]);
|
|
328
|
+
export const radarStyleSchema = z.enum(["standard", "marker", "filled"]);
|
|
321
329
|
export const chartDataSchema = z.object({
|
|
322
330
|
name: z.string().optional(),
|
|
323
331
|
labels: z.array(z.string()),
|
|
@@ -331,6 +339,8 @@ export const chartNodeSchema = basePOMNodeSchema.extend({
|
|
|
331
339
|
showTitle: z.boolean().optional(),
|
|
332
340
|
title: z.string().optional(),
|
|
333
341
|
chartColors: z.array(z.string()).optional(),
|
|
342
|
+
// radar専用オプション
|
|
343
|
+
radarStyle: radarStyleSchema.optional(),
|
|
334
344
|
});
|
|
335
345
|
// Define schemas using passthrough to maintain type safety
|
|
336
346
|
const boxNodeSchemaBase = basePOMNodeSchema.extend({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hirokisakabe/pom",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "PowerPoint Object Model - A declarative TypeScript library for creating PowerPoint presentations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"test:run": "vitest run",
|
|
57
57
|
"vrt": "tsx vrt/runVrt.ts",
|
|
58
58
|
"vrt:update": "tsx vrt/runVrt.ts --update",
|
|
59
|
-
"vrt:docker": "docker compose run --rm vrt",
|
|
60
|
-
"vrt:docker:update": "docker compose run --rm vrt-update",
|
|
59
|
+
"vrt:docker": "docker compose build vrt && docker compose run --rm vrt",
|
|
60
|
+
"vrt:docker:update": "docker compose build vrt-update && docker compose run --rm vrt-update",
|
|
61
61
|
"preview": "tsx preview/lib/previewPptx.ts",
|
|
62
|
-
"preview:docker": "docker compose run --rm preview"
|
|
62
|
+
"preview:docker": "docker compose build preview && docker compose run --rm preview"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@eslint/js": "^9.39.1",
|