@hirokisakabe/pom 0.1.9 → 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 +218 -167
- 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/schema.d.ts +23 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +24 -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 +8 -4
package/README.md
CHANGED
|
@@ -1,33 +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
|
-
>
|
|
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
|
-
- [
|
|
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)
|
|
23
24
|
|
|
24
|
-
##
|
|
25
|
+
## Installation
|
|
25
26
|
|
|
26
27
|
```bash
|
|
27
28
|
npm install @hirokisakabe/pom
|
|
28
29
|
```
|
|
29
30
|
|
|
30
|
-
##
|
|
31
|
+
## Quick Start
|
|
31
32
|
|
|
32
33
|
```typescript
|
|
33
34
|
import { buildPptx, POMNode } from "@hirokisakabe/pom";
|
|
@@ -42,13 +43,13 @@ const slide: POMNode = {
|
|
|
42
43
|
children: [
|
|
43
44
|
{
|
|
44
45
|
type: "text",
|
|
45
|
-
text: "
|
|
46
|
+
text: "Presentation Title",
|
|
46
47
|
fontPx: 48,
|
|
47
48
|
bold: true,
|
|
48
49
|
},
|
|
49
50
|
{
|
|
50
51
|
type: "text",
|
|
51
|
-
text: "
|
|
52
|
+
text: "Subtitle",
|
|
52
53
|
fontPx: 24,
|
|
53
54
|
color: "666666",
|
|
54
55
|
},
|
|
@@ -59,21 +60,21 @@ const pptx = await buildPptx([slide], { w: 1280, h: 720 });
|
|
|
59
60
|
await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
60
61
|
```
|
|
61
62
|
|
|
62
|
-
##
|
|
63
|
+
## Features
|
|
63
64
|
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
- **PowerPoint
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
- **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
|
|
71
72
|
|
|
72
|
-
##
|
|
73
|
+
## Nodes
|
|
73
74
|
|
|
74
|
-
###
|
|
75
|
+
### Common Properties
|
|
75
76
|
|
|
76
|
-
|
|
77
|
+
Layout attributes that all nodes can have.
|
|
77
78
|
|
|
78
79
|
```typescript
|
|
79
80
|
{
|
|
@@ -93,14 +94,14 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
93
94
|
}
|
|
94
95
|
```
|
|
95
96
|
|
|
96
|
-
- `backgroundColor`
|
|
97
|
-
- `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.
|
|
98
99
|
|
|
99
|
-
###
|
|
100
|
+
### Node List
|
|
100
101
|
|
|
101
102
|
#### 1. Text
|
|
102
103
|
|
|
103
|
-
|
|
104
|
+
A node for displaying text.
|
|
104
105
|
|
|
105
106
|
```typescript
|
|
106
107
|
{
|
|
@@ -114,79 +115,79 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
114
115
|
lineSpacingMultiple?: number;
|
|
115
116
|
bullet?: boolean | BulletOptions;
|
|
116
117
|
|
|
117
|
-
//
|
|
118
|
+
// Common properties
|
|
118
119
|
w?: number | "max" | `${number}%`;
|
|
119
120
|
h?: number | "max" | `${number}%`;
|
|
120
121
|
...
|
|
121
122
|
}
|
|
122
123
|
```
|
|
123
124
|
|
|
124
|
-
- `color`
|
|
125
|
-
- `bold`
|
|
126
|
-
- `fontFamily`
|
|
127
|
-
- `lineSpacingMultiple`
|
|
128
|
-
- `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.
|
|
129
130
|
|
|
130
131
|
**BulletOptions:**
|
|
131
132
|
|
|
132
133
|
```typescript
|
|
133
134
|
{
|
|
134
|
-
type?: "bullet" | "number"; // "bullet":
|
|
135
|
-
indent?: number; //
|
|
135
|
+
type?: "bullet" | "number"; // "bullet": symbol, "number": numbered
|
|
136
|
+
indent?: number; // Indent level
|
|
136
137
|
numberType?: "alphaLcParenBoth" | "alphaLcParenR" | "alphaLcPeriod" |
|
|
137
138
|
"alphaUcParenBoth" | "alphaUcParenR" | "alphaUcPeriod" |
|
|
138
139
|
"arabicParenBoth" | "arabicParenR" | "arabicPeriod" | "arabicPlain" |
|
|
139
140
|
"romanLcParenBoth" | "romanLcParenR" | "romanLcPeriod" |
|
|
140
141
|
"romanUcParenBoth" | "romanUcParenR" | "romanUcPeriod";
|
|
141
|
-
numberStartAt?: number; //
|
|
142
|
+
numberStartAt?: number; // Starting number
|
|
142
143
|
}
|
|
143
144
|
```
|
|
144
145
|
|
|
145
|
-
|
|
146
|
+
**Usage Examples:**
|
|
146
147
|
|
|
147
148
|
```typescript
|
|
148
|
-
//
|
|
149
|
+
// Simple bullet list
|
|
149
150
|
{
|
|
150
151
|
type: "text",
|
|
151
|
-
text: "
|
|
152
|
+
text: "Item 1\nItem 2\nItem 3",
|
|
152
153
|
bullet: true,
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
//
|
|
156
|
+
// Numbered list
|
|
156
157
|
{
|
|
157
158
|
type: "text",
|
|
158
|
-
text: "
|
|
159
|
+
text: "Step 1\nStep 2\nStep 3",
|
|
159
160
|
bullet: { type: "number" },
|
|
160
161
|
}
|
|
161
162
|
|
|
162
|
-
//
|
|
163
|
+
// Lowercase alphabet (a. b. c.)
|
|
163
164
|
{
|
|
164
165
|
type: "text",
|
|
165
|
-
text: "
|
|
166
|
+
text: "Item A\nItem B\nItem C",
|
|
166
167
|
bullet: { type: "number", numberType: "alphaLcPeriod" },
|
|
167
168
|
}
|
|
168
169
|
|
|
169
|
-
// 5
|
|
170
|
+
// Numbered list starting from 5
|
|
170
171
|
{
|
|
171
172
|
type: "text",
|
|
172
|
-
text: "
|
|
173
|
+
text: "Fifth\nSixth\nSeventh",
|
|
173
174
|
bullet: { type: "number", numberStartAt: 5 },
|
|
174
175
|
}
|
|
175
176
|
```
|
|
176
177
|
|
|
177
178
|
#### 2. Image
|
|
178
179
|
|
|
179
|
-
|
|
180
|
+
A node for displaying images.
|
|
180
181
|
|
|
181
|
-
- `w`
|
|
182
|
-
-
|
|
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)
|
|
183
184
|
|
|
184
185
|
```typescript
|
|
185
186
|
{
|
|
186
187
|
type: "image";
|
|
187
|
-
src: string; //
|
|
188
|
+
src: string; // Image path (local path, URL, or base64 data)
|
|
188
189
|
|
|
189
|
-
//
|
|
190
|
+
// Common properties
|
|
190
191
|
w?: number | "max" | `${number}%`;
|
|
191
192
|
h?: number | "max" | `${number}%`;
|
|
192
193
|
...
|
|
@@ -195,7 +196,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
195
196
|
|
|
196
197
|
#### 3. Table
|
|
197
198
|
|
|
198
|
-
|
|
199
|
+
A node for drawing tables. Column widths and row heights are declared in px, with fine-grained control over cell decoration.
|
|
199
200
|
|
|
200
201
|
```typescript
|
|
201
202
|
{
|
|
@@ -214,27 +215,27 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
214
215
|
}[];
|
|
215
216
|
defaultRowHeight?: number;
|
|
216
217
|
|
|
217
|
-
//
|
|
218
|
+
// Common properties
|
|
218
219
|
w?: number | "max" | `${number}%`;
|
|
219
220
|
h?: number | "max" | `${number}%`;
|
|
220
221
|
...
|
|
221
222
|
}
|
|
222
223
|
```
|
|
223
224
|
|
|
224
|
-
- `columns[].width`
|
|
225
|
-
- `columns`
|
|
226
|
-
- `rows`
|
|
227
|
-
-
|
|
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`.
|
|
228
229
|
|
|
229
230
|
#### 4. Shape
|
|
230
231
|
|
|
231
|
-
|
|
232
|
+
A node for drawing shapes. Different representations are possible with or without text, supporting complex visual effects.
|
|
232
233
|
|
|
233
234
|
```typescript
|
|
234
235
|
{
|
|
235
236
|
type: "shape";
|
|
236
|
-
shapeType: PptxGenJS.SHAPE_NAME; //
|
|
237
|
-
text?: string; //
|
|
237
|
+
shapeType: PptxGenJS.SHAPE_NAME; // e.g., "roundRect", "ellipse", "cloud", "star5"
|
|
238
|
+
text?: string; // Text to display inside the shape (optional)
|
|
238
239
|
fill?: {
|
|
239
240
|
color?: string;
|
|
240
241
|
transparency?: number;
|
|
@@ -256,36 +257,36 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
256
257
|
color?: string;
|
|
257
258
|
alignText?: "left" | "center" | "right";
|
|
258
259
|
|
|
259
|
-
//
|
|
260
|
+
// Common properties
|
|
260
261
|
w?: number | "max" | `${number}%`;
|
|
261
262
|
h?: number | "max" | `${number}%`;
|
|
262
263
|
...
|
|
263
264
|
}
|
|
264
265
|
```
|
|
265
266
|
|
|
266
|
-
|
|
267
|
+
**Common Shape Types:**
|
|
267
268
|
|
|
268
|
-
- `roundRect`:
|
|
269
|
-
- `ellipse`:
|
|
270
|
-
- `cloud`:
|
|
271
|
-
- `wedgeRectCallout`:
|
|
272
|
-
- `cloudCallout`:
|
|
273
|
-
- `star5`: 5
|
|
274
|
-
- `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)
|
|
275
276
|
|
|
276
277
|
#### 5. Box
|
|
277
278
|
|
|
278
|
-
|
|
279
|
+
A generic container that wraps a single child element.
|
|
279
280
|
|
|
280
|
-
-
|
|
281
|
-
- padding
|
|
281
|
+
- Only **one** child element
|
|
282
|
+
- Used for grouping with padding or fixed size
|
|
282
283
|
|
|
283
284
|
```typescript
|
|
284
285
|
{
|
|
285
286
|
type: "box";
|
|
286
287
|
children: POMNode;
|
|
287
288
|
|
|
288
|
-
//
|
|
289
|
+
// Common properties
|
|
289
290
|
w?: number | "max" | `${number}%`;
|
|
290
291
|
h?: number | "max" | `${number}%`;
|
|
291
292
|
...
|
|
@@ -294,7 +295,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
294
295
|
|
|
295
296
|
#### 6. VStack
|
|
296
297
|
|
|
297
|
-
|
|
298
|
+
Arranges child elements **vertically**.
|
|
298
299
|
|
|
299
300
|
```typescript
|
|
300
301
|
{
|
|
@@ -304,7 +305,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
304
305
|
justifyContent: "start" | "center" | "end" | "spaceBetween";
|
|
305
306
|
gap?: number;
|
|
306
307
|
|
|
307
|
-
//
|
|
308
|
+
// Common properties
|
|
308
309
|
w?: number | "max" | `${number}%`;
|
|
309
310
|
h?: number | "max" | `${number}%`;
|
|
310
311
|
...
|
|
@@ -313,7 +314,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
313
314
|
|
|
314
315
|
#### 7. HStack
|
|
315
316
|
|
|
316
|
-
|
|
317
|
+
Arranges child elements **horizontally**.
|
|
317
318
|
|
|
318
319
|
```typescript
|
|
319
320
|
{
|
|
@@ -323,7 +324,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
323
324
|
justifyContent: "start" | "center" | "end" | "spaceBetween";
|
|
324
325
|
gap?: number;
|
|
325
326
|
|
|
326
|
-
//
|
|
327
|
+
// Common properties
|
|
327
328
|
w?: number | "max" | `${number}%`;
|
|
328
329
|
h?: number | "max" | `${number}%`;
|
|
329
330
|
...
|
|
@@ -332,33 +333,34 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
332
333
|
|
|
333
334
|
#### 8. Chart
|
|
334
335
|
|
|
335
|
-
|
|
336
|
+
A node for drawing charts. Supports bar charts, line charts, pie charts, area charts, doughnut charts, and radar charts.
|
|
336
337
|
|
|
337
338
|
```typescript
|
|
338
339
|
{
|
|
339
340
|
type: "chart";
|
|
340
|
-
chartType: "bar" | "line" | "pie";
|
|
341
|
+
chartType: "bar" | "line" | "pie" | "area" | "doughnut" | "radar";
|
|
341
342
|
data: {
|
|
342
|
-
name?: string; //
|
|
343
|
-
labels: string[]; //
|
|
344
|
-
values: number[]; //
|
|
343
|
+
name?: string; // Series name
|
|
344
|
+
labels: string[]; // Category labels
|
|
345
|
+
values: number[]; // Values
|
|
345
346
|
}[];
|
|
346
|
-
showLegend?: boolean; //
|
|
347
|
-
showTitle?: boolean; //
|
|
348
|
-
title?: string; //
|
|
349
|
-
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
|
|
350
352
|
|
|
351
|
-
//
|
|
353
|
+
// Common properties
|
|
352
354
|
w?: number | "max" | `${number}%`;
|
|
353
355
|
h?: number | "max" | `${number}%`;
|
|
354
356
|
...
|
|
355
357
|
}
|
|
356
358
|
```
|
|
357
359
|
|
|
358
|
-
|
|
360
|
+
**Usage Examples:**
|
|
359
361
|
|
|
360
362
|
```typescript
|
|
361
|
-
//
|
|
363
|
+
// Bar chart
|
|
362
364
|
{
|
|
363
365
|
type: "chart",
|
|
364
366
|
chartType: "bar",
|
|
@@ -366,23 +368,23 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
366
368
|
h: 400,
|
|
367
369
|
data: [
|
|
368
370
|
{
|
|
369
|
-
name: "
|
|
370
|
-
labels: ["
|
|
371
|
+
name: "Sales",
|
|
372
|
+
labels: ["Jan", "Feb", "Mar", "Apr"],
|
|
371
373
|
values: [100, 200, 150, 300],
|
|
372
374
|
},
|
|
373
375
|
{
|
|
374
|
-
name: "
|
|
375
|
-
labels: ["
|
|
376
|
+
name: "Profit",
|
|
377
|
+
labels: ["Jan", "Feb", "Mar", "Apr"],
|
|
376
378
|
values: [30, 60, 45, 90],
|
|
377
379
|
},
|
|
378
380
|
],
|
|
379
381
|
showLegend: true,
|
|
380
382
|
showTitle: true,
|
|
381
|
-
title: "
|
|
383
|
+
title: "Monthly Sales & Profit",
|
|
382
384
|
chartColors: ["0088CC", "00AA00"],
|
|
383
385
|
}
|
|
384
386
|
|
|
385
|
-
//
|
|
387
|
+
// Pie chart
|
|
386
388
|
{
|
|
387
389
|
type: "chart",
|
|
388
390
|
chartType: "pie",
|
|
@@ -390,21 +392,39 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
|
|
|
390
392
|
h: 300,
|
|
391
393
|
data: [
|
|
392
394
|
{
|
|
393
|
-
name: "
|
|
394
|
-
labels: ["
|
|
395
|
+
name: "Market Share",
|
|
396
|
+
labels: ["Product A", "Product B", "Product C", "Others"],
|
|
395
397
|
values: [40, 30, 20, 10],
|
|
396
398
|
},
|
|
397
399
|
],
|
|
398
400
|
showLegend: true,
|
|
399
401
|
chartColors: ["0088CC", "00AA00", "FF6600", "888888"],
|
|
400
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
|
+
}
|
|
401
421
|
```
|
|
402
422
|
|
|
403
|
-
##
|
|
423
|
+
## Master Slide
|
|
404
424
|
|
|
405
|
-
|
|
425
|
+
You can automatically insert common headers, footers, and page numbers across all pages.
|
|
406
426
|
|
|
407
|
-
###
|
|
427
|
+
### Basic Usage
|
|
408
428
|
|
|
409
429
|
```typescript
|
|
410
430
|
import { buildPptx } from "@hirokisakabe/pom";
|
|
@@ -424,7 +444,7 @@ const pptx = await buildPptx(
|
|
|
424
444
|
children: [
|
|
425
445
|
{
|
|
426
446
|
type: "text",
|
|
427
|
-
text: "
|
|
447
|
+
text: "Company Name",
|
|
428
448
|
fontPx: 14,
|
|
429
449
|
color: "FFFFFF",
|
|
430
450
|
},
|
|
@@ -459,50 +479,50 @@ const pptx = await buildPptx(
|
|
|
459
479
|
],
|
|
460
480
|
},
|
|
461
481
|
date: {
|
|
462
|
-
format: "YYYY/MM/DD", //
|
|
482
|
+
format: "YYYY/MM/DD", // or "locale"
|
|
463
483
|
},
|
|
464
484
|
},
|
|
465
485
|
},
|
|
466
486
|
);
|
|
467
487
|
```
|
|
468
488
|
|
|
469
|
-
###
|
|
489
|
+
### Master Slide Options
|
|
470
490
|
|
|
471
491
|
```typescript
|
|
472
492
|
type MasterSlideOptions = {
|
|
473
|
-
header?: POMNode; //
|
|
474
|
-
footer?: POMNode; //
|
|
493
|
+
header?: POMNode; // Header (any POMNode can be specified)
|
|
494
|
+
footer?: POMNode; // Footer (any POMNode can be specified)
|
|
475
495
|
pageNumber?: {
|
|
476
|
-
position: "left" | "center" | "right"; //
|
|
496
|
+
position: "left" | "center" | "right"; // Page number position
|
|
477
497
|
};
|
|
478
498
|
date?: {
|
|
479
|
-
format: "YYYY/MM/DD" | "locale"; //
|
|
499
|
+
format: "YYYY/MM/DD" | "locale"; // Date format
|
|
480
500
|
};
|
|
481
501
|
};
|
|
482
502
|
```
|
|
483
503
|
|
|
484
|
-
###
|
|
504
|
+
### Placeholders
|
|
485
505
|
|
|
486
|
-
|
|
506
|
+
The following placeholders can be used in text within headers and footers:
|
|
487
507
|
|
|
488
|
-
- `{{page}}`:
|
|
489
|
-
- `{{totalPages}}`:
|
|
490
|
-
- `{{date}}`:
|
|
508
|
+
- `{{page}}`: Current page number
|
|
509
|
+
- `{{totalPages}}`: Total number of pages
|
|
510
|
+
- `{{date}}`: Date (in the format specified by `date.format`)
|
|
491
511
|
|
|
492
|
-
###
|
|
512
|
+
### Features
|
|
493
513
|
|
|
494
|
-
-
|
|
495
|
-
-
|
|
496
|
-
-
|
|
497
|
-
-
|
|
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
|
|
498
518
|
|
|
499
|
-
##
|
|
519
|
+
## Serverless Environments
|
|
500
520
|
|
|
501
|
-
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.
|
|
502
522
|
|
|
503
|
-
|
|
523
|
+
To address this issue, you can specify the text measurement method using the `textMeasurement` option.
|
|
504
524
|
|
|
505
|
-
### textMeasurement
|
|
525
|
+
### textMeasurement Option
|
|
506
526
|
|
|
507
527
|
```typescript
|
|
508
528
|
const pptx = await buildPptx(
|
|
@@ -514,48 +534,48 @@ const pptx = await buildPptx(
|
|
|
514
534
|
);
|
|
515
535
|
```
|
|
516
536
|
|
|
517
|
-
|
|
|
518
|
-
| ------------ |
|
|
519
|
-
| `"canvas"` |
|
|
520
|
-
| `"fallback"` |
|
|
521
|
-
| `"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) |
|
|
522
542
|
|
|
523
|
-
###
|
|
543
|
+
### Recommended Settings
|
|
524
544
|
|
|
525
|
-
-
|
|
526
|
-
-
|
|
527
|
-
-
|
|
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
|
|
528
548
|
|
|
529
|
-
## LLM
|
|
549
|
+
## LLM Integration
|
|
530
550
|
|
|
531
|
-
pom
|
|
551
|
+
pom supports use cases where slides are created from JSON generated by LLMs (GPT-4o, Claude, etc.).
|
|
532
552
|
|
|
533
|
-
### LLM
|
|
553
|
+
### LLM Specification Guide
|
|
534
554
|
|
|
535
|
-
[`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.
|
|
536
556
|
|
|
537
|
-
|
|
557
|
+
**Contents:**
|
|
538
558
|
|
|
539
|
-
-
|
|
540
|
-
-
|
|
541
|
-
-
|
|
542
|
-
-
|
|
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
|
|
543
563
|
|
|
544
|
-
###
|
|
564
|
+
### Input Schema
|
|
545
565
|
|
|
546
|
-
`inputPomNodeSchema`
|
|
566
|
+
Use `inputPomNodeSchema` to validate JSON generated by LLMs.
|
|
547
567
|
|
|
548
568
|
```typescript
|
|
549
569
|
import { inputPomNodeSchema, buildPptx, InputPOMNode } from "@hirokisakabe/pom";
|
|
550
570
|
|
|
551
|
-
// LLM
|
|
571
|
+
// Validate JSON output from LLM
|
|
552
572
|
const jsonFromLLM = `{
|
|
553
573
|
"type": "vstack",
|
|
554
574
|
"padding": 48,
|
|
555
575
|
"gap": 24,
|
|
556
576
|
"children": [
|
|
557
|
-
{ "type": "text", "text": "
|
|
558
|
-
{ "type": "text", "text": "
|
|
577
|
+
{ "type": "text", "text": "Title", "fontPx": 32, "bold": true },
|
|
578
|
+
{ "type": "text", "text": "Body text", "fontPx": 16 }
|
|
559
579
|
]
|
|
560
580
|
}`;
|
|
561
581
|
|
|
@@ -563,30 +583,61 @@ const parsed = JSON.parse(jsonFromLLM);
|
|
|
563
583
|
const result = inputPomNodeSchema.safeParse(parsed);
|
|
564
584
|
|
|
565
585
|
if (result.success) {
|
|
566
|
-
//
|
|
586
|
+
// Validation successful - generate PPTX
|
|
567
587
|
const pptx = await buildPptx([result.data], { w: 1280, h: 720 });
|
|
568
588
|
await pptx.writeFile({ fileName: "output.pptx" });
|
|
569
589
|
} else {
|
|
570
|
-
//
|
|
590
|
+
// Validation failed - check error details
|
|
591
|
+
console.error("Validation failed:", result.error.format());
|
|
592
|
+
}
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
### Available Input Schemas
|
|
596
|
+
|
|
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 |
|
|
609
|
+
|
|
610
|
+
### Input Validation in Browser Environments
|
|
611
|
+
|
|
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.
|
|
613
|
+
|
|
614
|
+
```typescript
|
|
615
|
+
// Available in browser environments
|
|
616
|
+
import { inputPomNodeSchema } from "@hirokisakabe/pom/schema";
|
|
617
|
+
|
|
618
|
+
// Validate response from LLM
|
|
619
|
+
const result = inputPomNodeSchema.safeParse(llmResponse);
|
|
620
|
+
|
|
621
|
+
if (result.success) {
|
|
622
|
+
// Validation successful - send to server for PPTX generation
|
|
623
|
+
await fetch("/api/generate-pptx", {
|
|
624
|
+
method: "POST",
|
|
625
|
+
headers: { "Content-Type": "application/json" },
|
|
626
|
+
body: JSON.stringify(result.data),
|
|
627
|
+
});
|
|
628
|
+
} else {
|
|
629
|
+
// Validation failed - show error to user
|
|
571
630
|
console.error("Validation failed:", result.error.format());
|
|
572
631
|
}
|
|
573
632
|
```
|
|
574
633
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
|
578
|
-
|
|
|
579
|
-
| `
|
|
580
|
-
| `
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
| `inputShapeNodeSchema` | 図形ノード用 |
|
|
584
|
-
| `inputChartNodeSchema` | チャートノード用 |
|
|
585
|
-
| `inputBoxNodeSchema` | Boxノード用 |
|
|
586
|
-
| `inputVStackNodeSchema` | VStackノード用 |
|
|
587
|
-
| `inputHStackNodeSchema` | HStackノード用 |
|
|
588
|
-
| `inputMasterSlideOptionsSchema` | マスタースライド設定用 |
|
|
589
|
-
|
|
590
|
-
## ライセンス
|
|
634
|
+
**Difference between `@hirokisakabe/pom` and `@hirokisakabe/pom/schema`:**
|
|
635
|
+
|
|
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) |
|
|
640
|
+
|
|
641
|
+
## License
|
|
591
642
|
|
|
592
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/inputSch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e,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/schema.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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, inputMasterSlideOptionsSchema, inputBaseNodeSchema, type InputPOMNode, type InputTextNode, type InputImageNode, type InputTableNode, type InputBoxNode, type InputVStackNode, type InputHStackNode, type InputShapeNode, type InputChartNode, type InputMasterSlideOptions, } from "./inputSchema";
|
|
22
|
+
export { lengthSchema, paddingSchema, borderStyleSchema, borderDashSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, bulletNumberTypeSchema, tableColumnSchema, tableRowSchema, tableCellSchema, pageNumberPositionSchema, 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 PageNumberPosition, } from "./types";
|
|
23
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,6BAA6B,EAC7B,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,uBAAuB,GAC7B,MAAM,eAAe,CAAC;AAGvB,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,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,GACxB,MAAM,SAAS,CAAC"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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, inputMasterSlideOptionsSchema, inputBaseNodeSchema, } from "./inputSchema";
|
|
23
|
+
// Basic type schemas (browser-compatible)
|
|
24
|
+
export { lengthSchema, paddingSchema, borderStyleSchema, borderDashSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, bulletNumberTypeSchema, tableColumnSchema, tableRowSchema, tableCellSchema, pageNumberPositionSchema, } from "./types";
|
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":"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;;;;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",
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./schema": {
|
|
14
|
+
"types": "./dist/schema.d.ts",
|
|
15
|
+
"import": "./dist/schema.js"
|
|
12
16
|
}
|
|
13
17
|
},
|
|
14
18
|
"files": [
|
|
@@ -52,10 +56,10 @@
|
|
|
52
56
|
"test:run": "vitest run",
|
|
53
57
|
"vrt": "tsx vrt/runVrt.ts",
|
|
54
58
|
"vrt:update": "tsx vrt/runVrt.ts --update",
|
|
55
|
-
"vrt:docker": "docker compose run --rm vrt",
|
|
56
|
-
"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",
|
|
57
61
|
"preview": "tsx preview/lib/previewPptx.ts",
|
|
58
|
-
"preview:docker": "docker compose run --rm preview"
|
|
62
|
+
"preview:docker": "docker compose build preview && docker compose run --rm preview"
|
|
59
63
|
},
|
|
60
64
|
"devDependencies": {
|
|
61
65
|
"@eslint/js": "^9.39.1",
|