@hirokisakabe/pom 0.1.6 → 0.1.7

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 CHANGED
@@ -2,8 +2,16 @@
2
2
 
3
3
  **pom (PowerPoint Object Model)** は、PowerPoint プレゼンテーション(pptx)を TypeScript で宣言的に記述するためのライブラリです。生成 AI に出力させた POM 形式の JSON を、PowerPoint ファイルに変換するユースケースを想定しています。
4
4
 
5
+ ## 動作環境
6
+
7
+ - Node.js 18 以上
8
+
9
+ > [!NOTE]
10
+ > pom は Node.js 環境でのみ動作します。ブラウザ環境では動作しません。
11
+
5
12
  ## 目次
6
13
 
14
+ - [動作環境](#動作環境)
7
15
  - [インストール](#インストール)
8
16
  - [クイックスタート](#クイックスタート)
9
17
  - [特徴](#特徴)
@@ -103,6 +111,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
103
111
  bold?: boolean;
104
112
  fontFamily?: string;
105
113
  lineSpacingMultiple?: number;
114
+ bullet?: boolean | BulletOptions;
106
115
 
107
116
  // 共通プロパティ
108
117
  w?: number | "max" | `${number}%`;
@@ -115,6 +124,54 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
115
124
  - `bold` で太字を指定できます。
116
125
  - `fontFamily` でフォントファミリーを指定できます(デフォルト: `"Noto Sans JP"`)。
117
126
  - `lineSpacingMultiple` で行間倍率を指定できます(デフォルト: `1.3`)。
127
+ - `bullet` で箇条書きを指定できます。`true` を指定するとデフォルトの箇条書き、オブジェクトで詳細設定が可能です。
128
+
129
+ **BulletOptions:**
130
+
131
+ ```typescript
132
+ {
133
+ type?: "bullet" | "number"; // "bullet": 記号、"number": 番号付き
134
+ indent?: number; // インデントレベル
135
+ numberType?: "alphaLcParenBoth" | "alphaLcParenR" | "alphaLcPeriod" |
136
+ "alphaUcParenBoth" | "alphaUcParenR" | "alphaUcPeriod" |
137
+ "arabicParenBoth" | "arabicParenR" | "arabicPeriod" | "arabicPlain" |
138
+ "romanLcParenBoth" | "romanLcParenR" | "romanLcPeriod" |
139
+ "romanUcParenBoth" | "romanUcParenR" | "romanUcPeriod";
140
+ numberStartAt?: number; // 番号の開始値
141
+ }
142
+ ```
143
+
144
+ **使用例:**
145
+
146
+ ```typescript
147
+ // シンプルな箇条書き
148
+ {
149
+ type: "text",
150
+ text: "項目1\n項目2\n項目3",
151
+ bullet: true,
152
+ }
153
+
154
+ // 番号付きリスト
155
+ {
156
+ type: "text",
157
+ text: "ステップ1\nステップ2\nステップ3",
158
+ bullet: { type: "number" },
159
+ }
160
+
161
+ // アルファベット小文字(a. b. c.)
162
+ {
163
+ type: "text",
164
+ text: "項目A\n項目B\n項目C",
165
+ bullet: { type: "number", numberType: "alphaLcPeriod" },
166
+ }
167
+
168
+ // 5から始まる番号リスト
169
+ {
170
+ type: "text",
171
+ text: "5番目\n6番目\n7番目",
172
+ bullet: { type: "number", numberStartAt: 5 },
173
+ }
174
+ ```
118
175
 
119
176
  #### 2. Image
120
177
 
@@ -142,7 +199,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
142
199
  ```typescript
143
200
  {
144
201
  type: "table";
145
- columns: { width: number }[];
202
+ columns: { width?: number }[];
146
203
  rows: {
147
204
  height?: number;
148
205
  cells: {
@@ -163,6 +220,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
163
220
  }
164
221
  ```
165
222
 
223
+ - `columns[].width` を省略すると、テーブル全体の幅から均等分割されます。
166
224
  - `columns` の合計がテーブルの自然幅になります(必要であれば `w` で上書きできます)。
167
225
  - `rows` の `height` を省略すると `defaultRowHeight`(未指定なら32px)が適用されます。
168
226
  - セル背景やフォント装飾を `cells` の各要素で個別に指定できます。
@@ -194,7 +252,7 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
194
252
  color?: string;
195
253
  };
196
254
  fontPx?: number;
197
- fontColor?: string;
255
+ color?: string;
198
256
  alignText?: "left" | "center" | "right";
199
257
 
200
258
  // 共通プロパティ
@@ -271,6 +329,76 @@ await pptx.writeFile({ fileName: "presentation.pptx" });
271
329
  }
272
330
  ```
273
331
 
332
+ #### 8. Chart
333
+
334
+ グラフを描画するノード。棒グラフ、折れ線グラフ、円グラフをサポート。
335
+
336
+ ```typescript
337
+ {
338
+ type: "chart";
339
+ chartType: "bar" | "line" | "pie";
340
+ data: {
341
+ name?: string; // 系列名
342
+ labels: string[]; // カテゴリラベル
343
+ values: number[]; // 値
344
+ }[];
345
+ showLegend?: boolean; // 凡例表示(デフォルト: false)
346
+ showTitle?: boolean; // タイトル表示(デフォルト: false)
347
+ title?: string; // タイトル文字列
348
+ chartColors?: string[]; // データカラー配列(16進カラーコード)
349
+
350
+ // 共通プロパティ
351
+ w?: number | "max" | `${number}%`;
352
+ h?: number | "max" | `${number}%`;
353
+ ...
354
+ }
355
+ ```
356
+
357
+ **使用例:**
358
+
359
+ ```typescript
360
+ // 棒グラフ
361
+ {
362
+ type: "chart",
363
+ chartType: "bar",
364
+ w: 600,
365
+ h: 400,
366
+ data: [
367
+ {
368
+ name: "売上",
369
+ labels: ["1月", "2月", "3月", "4月"],
370
+ values: [100, 200, 150, 300],
371
+ },
372
+ {
373
+ name: "利益",
374
+ labels: ["1月", "2月", "3月", "4月"],
375
+ values: [30, 60, 45, 90],
376
+ },
377
+ ],
378
+ showLegend: true,
379
+ showTitle: true,
380
+ title: "月別売上・利益",
381
+ chartColors: ["0088CC", "00AA00"],
382
+ }
383
+
384
+ // 円グラフ
385
+ {
386
+ type: "chart",
387
+ chartType: "pie",
388
+ w: 400,
389
+ h: 300,
390
+ data: [
391
+ {
392
+ name: "市場シェア",
393
+ labels: ["製品A", "製品B", "製品C", "その他"],
394
+ values: [40, 30, 20, 10],
395
+ },
396
+ ],
397
+ showLegend: true,
398
+ chartColors: ["0088CC", "00AA00", "FF6600", "888888"],
399
+ }
400
+ ```
401
+
274
402
  ## マスタースライド
275
403
 
276
404
  全ページに共通のヘッダー・フッター・ページ番号を自動挿入できます。
@@ -371,6 +499,17 @@ type MasterSlideOptions = {
371
499
 
372
500
  pom は LLM(GPT-4o、Claude など)で生成した JSON からスライドを作成するユースケースに対応しています。
373
501
 
502
+ ### LLM 向け仕様ガイド
503
+
504
+ [`llm-guide.md`](./llm-guide.md) は、LLM に pom 形式の JSON を生成させるためのコンパクトな仕様書です。システムプロンプトに含めて使用してください。
505
+
506
+ **含まれる内容:**
507
+
508
+ - ノード一覧と主要プロパティ
509
+ - 標準設定(スライドサイズ、padding、gap、フォントサイズ目安)
510
+ - パターン例(基本構造、2 カラム、テーブル、図形、グラフなど)
511
+ - よくある間違いと正しい書き方
512
+
374
513
  ### 入力用スキーマ
375
514
 
376
515
  `inputPomNodeSchema` を使って、LLM が生成した JSON を検証できます。
@@ -402,39 +541,6 @@ if (result.success) {
402
541
  }
403
542
  ```
404
543
 
405
- ### OpenAI Structured Outputs との連携
406
-
407
- OpenAI SDK の `zodResponseFormat` を使用して、LLM に直接スキーマ準拠の JSON を生成させることができます。
408
-
409
- ```typescript
410
- import { inputPomNodeSchema, buildPptx } from "@hirokisakabe/pom";
411
- import OpenAI from "openai";
412
- import { zodResponseFormat } from "openai/helpers/zod";
413
-
414
- const openai = new OpenAI();
415
-
416
- const response = await openai.chat.completions.create({
417
- model: "gpt-4o",
418
- messages: [
419
- {
420
- role: "system",
421
- content:
422
- "あなたはプレゼンテーション作成アシスタントです。指定されたスキーマに従ってスライドのJSONを生成してください。",
423
- },
424
- {
425
- role: "user",
426
- content:
427
- "売上報告のスライドを作成して。タイトルと3つの箇条書きを含めて。",
428
- },
429
- ],
430
- response_format: zodResponseFormat(inputPomNodeSchema, "slide"),
431
- });
432
-
433
- const slideData = JSON.parse(response.choices[0].message.content!);
434
- const pptx = await buildPptx([slideData], { w: 1280, h: 720 });
435
- await pptx.writeFile({ fileName: "sales-report.pptx" });
436
- ```
437
-
438
544
  ### 利用可能な入力用スキーマ
439
545
 
440
546
  | スキーマ | 説明 |
@@ -444,6 +550,7 @@ await pptx.writeFile({ fileName: "sales-report.pptx" });
444
550
  | `inputImageNodeSchema` | 画像ノード用 |
445
551
  | `inputTableNodeSchema` | テーブルノード用 |
446
552
  | `inputShapeNodeSchema` | 図形ノード用 |
553
+ | `inputChartNodeSchema` | チャートノード用 |
447
554
  | `inputBoxNodeSchema` | Boxノード用 |
448
555
  | `inputVStackNodeSchema` | VStackノード用 |
449
556
  | `inputHStackNodeSchema` | HStackノード用 |
@@ -1 +1 @@
1
- {"version":3,"file":"buildPptx.d.ts","sourceRoot":"","sources":["../src/buildPptx.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAkB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAiGtE,wBAAsB,SAAS,CAC7B,KAAK,EAAE,OAAO,EAAE,EAChB,SAAS,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACnC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,kBAAkB,CAAA;CAAE,wCAgB1C"}
1
+ {"version":3,"file":"buildPptx.d.ts","sourceRoot":"","sources":["../src/buildPptx.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAkB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA8FtE,wBAAsB,SAAS,CAC7B,KAAK,EAAE,OAAO,EAAE,EAChB,SAAS,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACnC,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,kBAAkB,CAAA;CAAE,wCAgB1C"}
package/dist/buildPptx.js CHANGED
@@ -29,9 +29,7 @@ function composePage(content, master, pageNumber, totalPages) {
29
29
  if (!master) {
30
30
  return content;
31
31
  }
32
- const date = master.date?.format === "locale"
33
- ? new Date().toLocaleDateString()
34
- : new Date().toISOString().split("T")[0].replace(/-/g, "/");
32
+ const date = master.date?.value ?? "";
35
33
  const children = [];
36
34
  // ヘッダーを追加
37
35
  if (master.header) {
@@ -1 +1 @@
1
- {"version":3,"file":"calcYogaLayout.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/calcYogaLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAOxC;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,OAAO,EACb,SAAS,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,iBAcpC"}
1
+ {"version":3,"file":"calcYogaLayout.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/calcYogaLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAOxC;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,OAAO,EACb,SAAS,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,iBAiBpC"}
@@ -1,6 +1,6 @@
1
1
  import { loadYoga } from "yoga-layout/load";
2
2
  import { measureText } from "./measureText";
3
- import { measureImage } from "./measureImage";
3
+ import { measureImage, prefetchImageSize } from "./measureImage";
4
4
  import { calcTableIntrinsicSize } from "../table/utils";
5
5
  /**
6
6
  * POMNode ツリーを Yoga でレイアウト計算する
@@ -11,6 +11,8 @@ import { calcTableIntrinsicSize } from "../table/utils";
11
11
  */
12
12
  export async function calcYogaLayout(root, slideSize) {
13
13
  const Yoga = await getYoga();
14
+ // 事前に全画像のサイズを取得(HTTPS対応のため)
15
+ await prefetchAllImageSizes(root);
14
16
  const rootYoga = Yoga.Node.create();
15
17
  root.yogaNode = rootYoga;
16
18
  await buildPomWithYogaTree(root, rootYoga);
@@ -19,6 +21,34 @@ export async function calcYogaLayout(root, slideSize) {
19
21
  rootYoga.setHeight(slideSize.h);
20
22
  rootYoga.calculateLayout(slideSize.w, slideSize.h, Yoga.DIRECTION_LTR);
21
23
  }
24
+ /**
25
+ * POMNode ツリー内のすべての画像のサイズを事前取得する
26
+ */
27
+ async function prefetchAllImageSizes(node) {
28
+ const imageSources = collectImageSources(node);
29
+ await Promise.all(imageSources.map((src) => prefetchImageSize(src)));
30
+ }
31
+ /**
32
+ * POMNode ツリー内のすべての画像のsrcを収集する
33
+ */
34
+ function collectImageSources(node) {
35
+ const sources = [];
36
+ function traverse(n) {
37
+ if (n.type === "image") {
38
+ sources.push(n.src);
39
+ }
40
+ else if (n.type === "box") {
41
+ traverse(n.children);
42
+ }
43
+ else if (n.type === "vstack" || n.type === "hstack") {
44
+ for (const child of n.children) {
45
+ traverse(child);
46
+ }
47
+ }
48
+ }
49
+ traverse(node);
50
+ return sources;
51
+ }
22
52
  /**
23
53
  * Yogaシングルトン
24
54
  */
@@ -31,21 +61,26 @@ async function getYoga() {
31
61
  /**
32
62
  * POMNode ツリーを再帰的に走査し、YogaNode ツリーを構築する
33
63
  */
34
- async function buildPomWithYogaTree(node, parentYoga) {
64
+ async function buildPomWithYogaTree(node, parentYoga, parentNode) {
35
65
  const yoga = await getYoga();
36
66
  const yn = yoga.Node.create();
37
67
  node.yogaNode = yn; // 対応する YogaNode をセット
38
68
  await applyStyleToYogaNode(node, yn);
69
+ // HStack の子要素で幅が指定されていない場合、デフォルトで均等分割
70
+ if (parentNode?.type === "hstack" && node.w === undefined) {
71
+ yn.setFlexGrow(1);
72
+ yn.setFlexBasis(0);
73
+ }
39
74
  parentYoga.insertChild(yn, parentYoga.getChildCount());
40
75
  switch (node.type) {
41
76
  case "box": {
42
- await buildPomWithYogaTree(node.children, yn);
77
+ await buildPomWithYogaTree(node.children, yn, node);
43
78
  break;
44
79
  }
45
80
  case "vstack":
46
81
  case "hstack": {
47
82
  for (const child of node.children) {
48
- await buildPomWithYogaTree(child, yn);
83
+ await buildPomWithYogaTree(child, yn, node);
49
84
  }
50
85
  break;
51
86
  }
@@ -227,7 +262,7 @@ async function applyStyleToYogaNode(node, yn) {
227
262
  const text = node.text;
228
263
  const fontSizePx = node.fontPx ?? 24;
229
264
  const fontFamily = "Noto Sans JP";
230
- const fontWeight = "normal";
265
+ const fontWeight = node.bold ? "bold" : "normal";
231
266
  const lineHeight = 1.3;
232
267
  yn.setMeasureFunc((width, widthMode) => {
233
268
  const maxWidthPx = (() => {
@@ -283,7 +318,7 @@ async function applyStyleToYogaNode(node, yn) {
283
318
  const text = node.text;
284
319
  const fontSizePx = node.fontPx ?? 24;
285
320
  const fontFamily = "Noto Sans JP";
286
- const fontWeight = "normal";
321
+ const fontWeight = node.bold ? "bold" : "normal";
287
322
  const lineHeight = 1.3;
288
323
  yn.setMeasureFunc((width, widthMode) => {
289
324
  const maxWidthPx = (() => {
@@ -1,6 +1,17 @@
1
1
  /**
2
- * 画像ファイルのサイズを取得する
3
- * @param src 画像のパス(ローカルパス、またはbase64データ)
2
+ * 画像サイズを事前取得してキャッシュする(非同期)
3
+ * HTTPS URLの画像を処理する際に使用
4
+ * @param src 画像のパス(ローカルパス、base64データ、またはHTTPS URL)
5
+ * @returns 画像の幅と高さ(px)
6
+ */
7
+ export declare function prefetchImageSize(src: string): Promise<{
8
+ widthPx: number;
9
+ heightPx: number;
10
+ }>;
11
+ /**
12
+ * 画像ファイルのサイズを取得する(同期)
13
+ * 事前にprefetchImageSizeでキャッシュしておくこと
14
+ * @param src 画像のパス(ローカルパス、base64データ、またはHTTPS URL)
4
15
  * @returns 画像の幅と高さ(px)
5
16
  */
6
17
  export declare function measureImage(src: string): {
@@ -1 +1 @@
1
- {"version":3,"file":"measureImage.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/measureImage.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CA+BA"}
1
+ {"version":3,"file":"measureImage.d.ts","sourceRoot":"","sources":["../../src/calcYogaLayout/measureImage.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5D,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAqDD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAqDA"}
@@ -1,11 +1,76 @@
1
1
  import imageSize from "image-size";
2
2
  import * as fs from "fs";
3
3
  /**
4
- * 画像ファイルのサイズを取得する
5
- * @param src 画像のパス(ローカルパス、またはbase64データ)
4
+ * 画像サイズのキャッシュ(事前取得した画像サイズを保持)
5
+ */
6
+ const imageSizeCache = new Map();
7
+ /**
8
+ * 画像サイズを事前取得してキャッシュする(非同期)
9
+ * HTTPS URLの画像を処理する際に使用
10
+ * @param src 画像のパス(ローカルパス、base64データ、またはHTTPS URL)
11
+ * @returns 画像の幅と高さ(px)
12
+ */
13
+ export async function prefetchImageSize(src) {
14
+ // キャッシュにあればそれを返す
15
+ const cached = imageSizeCache.get(src);
16
+ if (cached) {
17
+ return cached;
18
+ }
19
+ try {
20
+ let buffer;
21
+ // base64データの場合
22
+ if (src.startsWith("data:")) {
23
+ const base64Data = src.split(",")[1];
24
+ buffer = new Uint8Array(Buffer.from(base64Data, "base64"));
25
+ }
26
+ // HTTPS/HTTP URLの場合
27
+ else if (src.startsWith("https://") || src.startsWith("http://")) {
28
+ const response = await fetch(src);
29
+ if (!response.ok) {
30
+ throw new Error(`Failed to fetch image: ${response.status}`);
31
+ }
32
+ const arrayBuffer = await response.arrayBuffer();
33
+ buffer = new Uint8Array(arrayBuffer);
34
+ }
35
+ // ローカルファイルパスの場合
36
+ else {
37
+ buffer = new Uint8Array(fs.readFileSync(src));
38
+ }
39
+ const dimensions = imageSize(buffer);
40
+ const width = dimensions.width ?? 100; // デフォルト100px
41
+ const height = dimensions.height ?? 100; // デフォルト100px
42
+ const result = {
43
+ widthPx: width,
44
+ heightPx: height,
45
+ };
46
+ // キャッシュに保存
47
+ imageSizeCache.set(src, result);
48
+ return result;
49
+ }
50
+ catch (error) {
51
+ // エラーが発生した場合はデフォルトサイズを返す
52
+ console.warn(`Failed to measure image size for ${src}:`, error);
53
+ const result = {
54
+ widthPx: 100,
55
+ heightPx: 100,
56
+ };
57
+ imageSizeCache.set(src, result);
58
+ return result;
59
+ }
60
+ }
61
+ /**
62
+ * 画像ファイルのサイズを取得する(同期)
63
+ * 事前にprefetchImageSizeでキャッシュしておくこと
64
+ * @param src 画像のパス(ローカルパス、base64データ、またはHTTPS URL)
6
65
  * @returns 画像の幅と高さ(px)
7
66
  */
8
67
  export function measureImage(src) {
68
+ // キャッシュにあればそれを返す
69
+ const cached = imageSizeCache.get(src);
70
+ if (cached) {
71
+ return cached;
72
+ }
73
+ // キャッシュにない場合(ローカルファイルやbase64のみ同期処理可能)
9
74
  try {
10
75
  let buffer;
11
76
  // base64データの場合
@@ -13,6 +78,14 @@ export function measureImage(src) {
13
78
  const base64Data = src.split(",")[1];
14
79
  buffer = new Uint8Array(Buffer.from(base64Data, "base64"));
15
80
  }
81
+ // HTTPS/HTTP URLの場合はキャッシュがないとデフォルト値を返す
82
+ else if (src.startsWith("https://") || src.startsWith("http://")) {
83
+ console.warn(`Image size for URL ${src} was not prefetched. Using default size.`);
84
+ return {
85
+ widthPx: 100,
86
+ heightPx: 100,
87
+ };
88
+ }
16
89
  // ローカルファイルパスの場合
17
90
  else {
18
91
  buffer = new Uint8Array(fs.readFileSync(src));
@@ -20,10 +93,13 @@ export function measureImage(src) {
20
93
  const dimensions = imageSize(buffer);
21
94
  const width = dimensions.width ?? 100; // デフォルト100px
22
95
  const height = dimensions.height ?? 100; // デフォルト100px
23
- return {
96
+ const result = {
24
97
  widthPx: width,
25
98
  heightPx: height,
26
99
  };
100
+ // キャッシュに保存
101
+ imageSizeCache.set(src, result);
102
+ return result;
27
103
  }
28
104
  catch (error) {
29
105
  // エラーが発生した場合はデフォルトサイズを返す
@@ -88,6 +88,32 @@ export declare const inputTextNodeSchema: z.ZodObject<{
88
88
  bold: z.ZodOptional<z.ZodBoolean>;
89
89
  fontFamily: z.ZodOptional<z.ZodString>;
90
90
  lineSpacingMultiple: z.ZodOptional<z.ZodNumber>;
91
+ bullet: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
92
+ type: z.ZodOptional<z.ZodEnum<{
93
+ number: "number";
94
+ bullet: "bullet";
95
+ }>>;
96
+ indent: z.ZodOptional<z.ZodNumber>;
97
+ numberType: z.ZodOptional<z.ZodEnum<{
98
+ alphaLcParenBoth: "alphaLcParenBoth";
99
+ alphaLcParenR: "alphaLcParenR";
100
+ alphaLcPeriod: "alphaLcPeriod";
101
+ alphaUcParenBoth: "alphaUcParenBoth";
102
+ alphaUcParenR: "alphaUcParenR";
103
+ alphaUcPeriod: "alphaUcPeriod";
104
+ arabicParenBoth: "arabicParenBoth";
105
+ arabicParenR: "arabicParenR";
106
+ arabicPeriod: "arabicPeriod";
107
+ arabicPlain: "arabicPlain";
108
+ romanLcParenBoth: "romanLcParenBoth";
109
+ romanLcParenR: "romanLcParenR";
110
+ romanLcPeriod: "romanLcPeriod";
111
+ romanUcParenBoth: "romanUcParenBoth";
112
+ romanUcParenR: "romanUcParenR";
113
+ romanUcPeriod: "romanUcPeriod";
114
+ }>>;
115
+ numberStartAt: z.ZodOptional<z.ZodNumber>;
116
+ }, z.core.$strip>]>>;
91
117
  }, z.core.$strip>;
92
118
  export declare const inputImageNodeSchema: z.ZodObject<{
93
119
  w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
@@ -150,7 +176,7 @@ export declare const inputTableNodeSchema: z.ZodObject<{
150
176
  }, z.core.$strip>>;
151
177
  type: z.ZodLiteral<"table">;
152
178
  columns: z.ZodArray<z.ZodObject<{
153
- width: z.ZodNumber;
179
+ width: z.ZodOptional<z.ZodNumber>;
154
180
  }, z.core.$strip>>;
155
181
  rows: z.ZodArray<z.ZodObject<{
156
182
  cells: z.ZodArray<z.ZodObject<{
@@ -409,17 +435,62 @@ export declare const inputShapeNodeSchema: z.ZodObject<{
409
435
  color: z.ZodOptional<z.ZodString>;
410
436
  }, z.core.$strip>>;
411
437
  fontPx: z.ZodOptional<z.ZodNumber>;
412
- fontColor: z.ZodOptional<z.ZodString>;
438
+ color: z.ZodOptional<z.ZodString>;
413
439
  alignText: z.ZodOptional<z.ZodEnum<{
414
440
  right: "right";
415
441
  left: "left";
416
442
  center: "center";
417
443
  }>>;
418
444
  }, z.core.$strip>;
445
+ export declare const inputChartNodeSchema: z.ZodObject<{
446
+ w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
447
+ h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
448
+ minW: z.ZodOptional<z.ZodNumber>;
449
+ maxW: z.ZodOptional<z.ZodNumber>;
450
+ minH: z.ZodOptional<z.ZodNumber>;
451
+ maxH: z.ZodOptional<z.ZodNumber>;
452
+ padding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
453
+ top: z.ZodOptional<z.ZodNumber>;
454
+ right: z.ZodOptional<z.ZodNumber>;
455
+ bottom: z.ZodOptional<z.ZodNumber>;
456
+ left: z.ZodOptional<z.ZodNumber>;
457
+ }, z.core.$strip>]>>;
458
+ backgroundColor: z.ZodOptional<z.ZodString>;
459
+ border: z.ZodOptional<z.ZodObject<{
460
+ color: z.ZodOptional<z.ZodString>;
461
+ width: z.ZodOptional<z.ZodNumber>;
462
+ dashType: z.ZodOptional<z.ZodEnum<{
463
+ solid: "solid";
464
+ dash: "dash";
465
+ dashDot: "dashDot";
466
+ lgDash: "lgDash";
467
+ lgDashDot: "lgDashDot";
468
+ lgDashDotDot: "lgDashDotDot";
469
+ sysDash: "sysDash";
470
+ sysDot: "sysDot";
471
+ }>>;
472
+ }, z.core.$strip>>;
473
+ type: z.ZodLiteral<"chart">;
474
+ chartType: z.ZodEnum<{
475
+ line: "line";
476
+ pie: "pie";
477
+ bar: "bar";
478
+ }>;
479
+ data: z.ZodArray<z.ZodObject<{
480
+ name: z.ZodOptional<z.ZodString>;
481
+ labels: z.ZodArray<z.ZodString>;
482
+ values: z.ZodArray<z.ZodNumber>;
483
+ }, z.core.$strip>>;
484
+ showLegend: z.ZodOptional<z.ZodBoolean>;
485
+ showTitle: z.ZodOptional<z.ZodBoolean>;
486
+ title: z.ZodOptional<z.ZodString>;
487
+ chartColors: z.ZodOptional<z.ZodArray<z.ZodString>>;
488
+ }, z.core.$strip>;
419
489
  export type InputTextNode = z.infer<typeof inputTextNodeSchema>;
420
490
  export type InputImageNode = z.infer<typeof inputImageNodeSchema>;
421
491
  export type InputTableNode = z.infer<typeof inputTableNodeSchema>;
422
492
  export type InputShapeNode = z.infer<typeof inputShapeNodeSchema>;
493
+ export type InputChartNode = z.infer<typeof inputChartNodeSchema>;
423
494
  export type InputBoxNode = InputBaseNode & {
424
495
  type: "box";
425
496
  children: InputPOMNode;
@@ -438,7 +509,7 @@ export type InputHStackNode = InputBaseNode & {
438
509
  alignItems?: AlignItems;
439
510
  justifyContent?: JustifyContent;
440
511
  };
441
- export type InputPOMNode = InputTextNode | InputImageNode | InputTableNode | InputBoxNode | InputVStackNode | InputHStackNode | InputShapeNode;
512
+ export type InputPOMNode = InputTextNode | InputImageNode | InputTableNode | InputBoxNode | InputVStackNode | InputHStackNode | InputShapeNode | InputChartNode;
442
513
  export declare const inputBoxNodeSchema: z.ZodType<InputBoxNode>;
443
514
  export declare const inputVStackNodeSchema: z.ZodType<InputVStackNode>;
444
515
  export declare const inputHStackNodeSchema: z.ZodType<InputHStackNode>;
@@ -472,10 +543,7 @@ export declare const inputMasterSlideOptionsSchema: z.ZodObject<{
472
543
  }>;
473
544
  }, z.core.$strip>>;
474
545
  date: z.ZodOptional<z.ZodObject<{
475
- format: z.ZodEnum<{
476
- "YYYY/MM/DD": "YYYY/MM/DD";
477
- locale: "locale";
478
- }>;
546
+ value: z.ZodString;
479
547
  }, z.core.$strip>>;
480
548
  }, z.core.$strip>;
481
549
  export type InputMasterSlideOptions = z.infer<typeof inputMasterSlideOptionsSchema>;
@@ -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,EAaL,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAS9B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU/B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,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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"}
@@ -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, dateFormatSchema, } from "./types";
20
+ import { lengthSchema, paddingSchema, borderStyleSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, tableColumnSchema, tableRowSchema, pageNumberPositionSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, } from "./types";
21
21
  // ===== Base Node Schema =====
22
22
  export const inputBaseNodeSchema = z.object({
23
23
  w: lengthSchema.optional(),
@@ -40,6 +40,7 @@ export const inputTextNodeSchema = inputBaseNodeSchema.extend({
40
40
  bold: z.boolean().optional(),
41
41
  fontFamily: z.string().optional(),
42
42
  lineSpacingMultiple: z.number().optional(),
43
+ bullet: z.union([z.boolean(), bulletOptionsSchema]).optional(),
43
44
  });
44
45
  export const inputImageNodeSchema = inputBaseNodeSchema.extend({
45
46
  type: z.literal("image"),
@@ -59,9 +60,18 @@ export const inputShapeNodeSchema = inputBaseNodeSchema.extend({
59
60
  line: borderStyleSchema.optional(),
60
61
  shadow: shadowStyleSchema.optional(),
61
62
  fontPx: z.number().optional(),
62
- fontColor: z.string().optional(),
63
+ color: z.string().optional(),
63
64
  alignText: z.enum(["left", "center", "right"]).optional(),
64
65
  });
66
+ export const inputChartNodeSchema = inputBaseNodeSchema.extend({
67
+ type: z.literal("chart"),
68
+ chartType: chartTypeSchema,
69
+ data: z.array(chartDataSchema),
70
+ showLegend: z.boolean().optional(),
71
+ showTitle: z.boolean().optional(),
72
+ title: z.string().optional(),
73
+ chartColors: z.array(z.string()).optional(),
74
+ });
65
75
  // ===== Recursive Node Schemas =====
66
76
  const inputBoxNodeSchemaBase = inputBaseNodeSchema.extend({
67
77
  type: z.literal("box"),
@@ -110,6 +120,7 @@ export const inputPomNodeSchema = z.lazy(() => z.discriminatedUnion("type", [
110
120
  inputVStackNodeSchemaBase,
111
121
  inputHStackNodeSchemaBase,
112
122
  inputShapeNodeSchema,
123
+ inputChartNodeSchema,
113
124
  ]));
114
125
  // ===== Master Slide Options Schema =====
115
126
  export const inputMasterSlideOptionsSchema = z.object({
@@ -122,7 +133,7 @@ export const inputMasterSlideOptionsSchema = z.object({
122
133
  .optional(),
123
134
  date: z
124
135
  .object({
125
- format: dateFormatSchema,
136
+ value: z.string(),
126
137
  })
127
138
  .optional(),
128
139
  });
@@ -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,iBAsLnE"}
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,iBA8MnE"}
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from "module";
2
2
  const require = createRequire(import.meta.url);
3
3
  const PptxGenJS = require("pptxgenjs");
4
- import { resolveRowHeights } from "../table/utils";
4
+ import { resolveColumnWidths, resolveRowHeights } from "../table/utils";
5
5
  import { createTextOptions } from "./textOptions";
6
6
  import { pxToIn, pxToPt } from "./units";
7
7
  export { createTextOptions } from "./textOptions";
@@ -104,7 +104,7 @@ export function renderPptx(pages, slidePx) {
104
104
  y: pxToIn(node.y),
105
105
  w: pxToIn(node.w),
106
106
  h: pxToIn(node.h),
107
- colW: node.columns.map((column) => pxToIn(column.width)),
107
+ colW: resolveColumnWidths(node, node.w).map((width) => pxToIn(width)),
108
108
  rowH: resolveRowHeights(node).map((height) => pxToIn(height)),
109
109
  margin: 0,
110
110
  };
@@ -150,7 +150,7 @@ export function renderPptx(pages, slidePx) {
150
150
  shape: node.shapeType,
151
151
  fontSize: pxToPt(node.fontPx ?? 24),
152
152
  fontFace: "Noto Sans JP",
153
- color: node.fontColor,
153
+ color: node.color,
154
154
  align: node.alignText ?? "center",
155
155
  valign: "middle",
156
156
  lineSpacingMultiple: 1.3,
@@ -162,6 +162,25 @@ export function renderPptx(pages, slidePx) {
162
162
  }
163
163
  break;
164
164
  }
165
+ case "chart": {
166
+ const chartData = node.data.map((d) => ({
167
+ name: d.name,
168
+ labels: d.labels,
169
+ values: d.values,
170
+ }));
171
+ const chartOptions = {
172
+ x: pxToIn(node.x),
173
+ y: pxToIn(node.y),
174
+ w: pxToIn(node.w),
175
+ h: pxToIn(node.h),
176
+ showLegend: node.showLegend ?? false,
177
+ showTitle: node.showTitle ?? false,
178
+ title: node.title,
179
+ chartColors: node.chartColors,
180
+ };
181
+ slide.addChart(node.chartType, chartData, chartOptions);
182
+ break;
183
+ }
165
184
  }
166
185
  }
167
186
  renderNode(data);
@@ -1,7 +1,14 @@
1
- import type { PositionedNode } from "../types";
1
+ import type { PositionedNode, BulletOptions } from "../types";
2
2
  type TextNode = Extract<PositionedNode, {
3
3
  type: "text";
4
4
  }>;
5
+ type PptxBulletOptions = {
6
+ type?: "bullet" | "number";
7
+ indent?: number;
8
+ numberType?: BulletOptions["numberType"];
9
+ numberStartAt?: number;
10
+ };
11
+ export declare function createBulletOptions(bullet: boolean | BulletOptions): PptxBulletOptions | boolean;
5
12
  export declare function createTextOptions(node: TextNode): {
6
13
  x: number;
7
14
  y: number;
@@ -15,6 +22,20 @@ export declare function createTextOptions(node: TextNode): {
15
22
  lineSpacingMultiple: number;
16
23
  color: string;
17
24
  bold: boolean;
25
+ } | {
26
+ bullet: boolean | PptxBulletOptions;
27
+ x: number;
28
+ y: number;
29
+ w: number;
30
+ h: number;
31
+ fontSize: number;
32
+ fontFace: string;
33
+ align: "right" | "left" | "center";
34
+ valign: "top";
35
+ margin: number;
36
+ lineSpacingMultiple: number;
37
+ color: string;
38
+ bold: boolean;
18
39
  };
19
40
  export {};
20
41
  //# sourceMappingURL=textOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"textOptions.d.ts","sourceRoot":"","sources":["../../src/renderPptx/textOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,KAAK,QAAQ,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE1D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ;;;;;;;;;;;;;EAmB/C"}
1
+ {"version":3,"file":"textOptions.d.ts","sourceRoot":"","sources":["../../src/renderPptx/textOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9D,KAAK,QAAQ,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE1D,KAAK,iBAAiB,GAAG;IACvB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,OAAO,GAAG,aAAa,GAC9B,iBAAiB,GAAG,OAAO,CAqB7B;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4B/C"}
@@ -1,9 +1,28 @@
1
1
  import { pxToIn, pxToPt } from "./units";
2
+ export function createBulletOptions(bullet) {
3
+ if (typeof bullet === "boolean") {
4
+ return bullet;
5
+ }
6
+ const options = {};
7
+ if (bullet.type !== undefined) {
8
+ options.type = bullet.type;
9
+ }
10
+ if (bullet.indent !== undefined) {
11
+ options.indent = bullet.indent;
12
+ }
13
+ if (bullet.numberType !== undefined) {
14
+ options.numberType = bullet.numberType;
15
+ }
16
+ if (bullet.numberStartAt !== undefined) {
17
+ options.numberStartAt = bullet.numberStartAt;
18
+ }
19
+ return options;
20
+ }
2
21
  export function createTextOptions(node) {
3
22
  const fontSizePx = node.fontPx ?? 24;
4
23
  const fontFamily = node.fontFamily ?? "Noto Sans JP";
5
24
  const lineSpacingMultiple = node.lineSpacingMultiple ?? 1.3;
6
- return {
25
+ const baseOptions = {
7
26
  x: pxToIn(node.x),
8
27
  y: pxToIn(node.y),
9
28
  w: pxToIn(node.w),
@@ -17,4 +36,11 @@ export function createTextOptions(node) {
17
36
  color: node.color,
18
37
  bold: node.bold,
19
38
  };
39
+ if (node.bullet !== undefined) {
40
+ return {
41
+ ...baseOptions,
42
+ bullet: createBulletOptions(node.bullet),
43
+ };
44
+ }
45
+ return baseOptions;
20
46
  }
@@ -1,8 +1,18 @@
1
1
  import type { TableNode } from "../types";
2
2
  export declare const DEFAULT_TABLE_ROW_HEIGHT = 32;
3
+ export declare const DEFAULT_TABLE_COLUMN_WIDTH = 100;
3
4
  export declare function calcTableIntrinsicSize(node: TableNode): {
4
5
  width: number;
5
6
  height: number;
6
7
  };
7
8
  export declare function resolveRowHeights(node: TableNode): number[];
9
+ /**
10
+ * テーブルの各カラム幅を解決する
11
+ * - 幅が指定されているカラムはその値を使用
12
+ * - 幅が未指定のカラムは、残りの幅を均等分割
13
+ *
14
+ * @param node テーブルノード
15
+ * @param tableWidth テーブル全体の幅(レイアウト計算後の確定値)
16
+ */
17
+ export declare function resolveColumnWidths(node: TableNode, tableWidth: number): number[];
8
18
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/table/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS;;;EAKrD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,YAGhD"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/table/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,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"}
@@ -1,6 +1,7 @@
1
1
  export const DEFAULT_TABLE_ROW_HEIGHT = 32;
2
+ export const DEFAULT_TABLE_COLUMN_WIDTH = 100;
2
3
  export function calcTableIntrinsicSize(node) {
3
- const width = node.columns.reduce((sum, column) => sum + column.width, 0);
4
+ const width = node.columns.reduce((sum, column) => sum + (column.width ?? DEFAULT_TABLE_COLUMN_WIDTH), 0);
4
5
  const height = resolveRowHeights(node).reduce((sum, h) => sum + h, 0);
5
6
  return { width, height };
6
7
  }
@@ -8,3 +9,19 @@ export function resolveRowHeights(node) {
8
9
  const fallbackRowHeight = node.defaultRowHeight ?? DEFAULT_TABLE_ROW_HEIGHT;
9
10
  return node.rows.map((row) => row.height ?? fallbackRowHeight);
10
11
  }
12
+ /**
13
+ * テーブルの各カラム幅を解決する
14
+ * - 幅が指定されているカラムはその値を使用
15
+ * - 幅が未指定のカラムは、残りの幅を均等分割
16
+ *
17
+ * @param node テーブルノード
18
+ * @param tableWidth テーブル全体の幅(レイアウト計算後の確定値)
19
+ */
20
+ export function resolveColumnWidths(node, tableWidth) {
21
+ const specifiedTotal = node.columns.reduce((sum, col) => sum + (col.width ?? 0), 0);
22
+ const unspecifiedCount = node.columns.filter((col) => col.width === undefined).length;
23
+ // 未指定カラムがない場合、または未指定カラムに割り当てる幅を計算
24
+ const remainingWidth = Math.max(0, tableWidth - specifiedTotal);
25
+ const widthPerUnspecified = unspecifiedCount > 0 ? remainingWidth / unspecifiedCount : 0;
26
+ return node.columns.map((col) => col.width ?? widthPerUnspecified);
27
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"toPositioned.d.ts","sourceRoot":"","sources":["../../src/toPositioned/toPositioned.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,OAAO,EACZ,OAAO,SAAI,EACX,OAAO,SAAI,GACV,cAAc,CAiFhB"}
1
+ {"version":3,"file":"toPositioned.d.ts","sourceRoot":"","sources":["../../src/toPositioned/toPositioned.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,OAAO,EACZ,OAAO,SAAI,EACX,OAAO,SAAI,GACV,cAAc,CA0FhB"}
@@ -49,6 +49,15 @@ export function toPositioned(pom, parentX = 0, parentY = 0) {
49
49
  h: layout.height,
50
50
  };
51
51
  }
52
+ case "chart": {
53
+ return {
54
+ ...pom,
55
+ x: absoluteX,
56
+ y: absoluteY,
57
+ w: layout.width,
58
+ h: layout.height,
59
+ };
60
+ }
52
61
  case "box": {
53
62
  return {
54
63
  ...pom,
package/dist/types.d.ts CHANGED
@@ -46,6 +46,50 @@ export declare const shadowStyleSchema: z.ZodObject<{
46
46
  offset: z.ZodOptional<z.ZodNumber>;
47
47
  color: z.ZodOptional<z.ZodString>;
48
48
  }, z.core.$strip>;
49
+ export declare const bulletNumberTypeSchema: z.ZodEnum<{
50
+ alphaLcParenBoth: "alphaLcParenBoth";
51
+ alphaLcParenR: "alphaLcParenR";
52
+ alphaLcPeriod: "alphaLcPeriod";
53
+ alphaUcParenBoth: "alphaUcParenBoth";
54
+ alphaUcParenR: "alphaUcParenR";
55
+ alphaUcPeriod: "alphaUcPeriod";
56
+ arabicParenBoth: "arabicParenBoth";
57
+ arabicParenR: "arabicParenR";
58
+ arabicPeriod: "arabicPeriod";
59
+ arabicPlain: "arabicPlain";
60
+ romanLcParenBoth: "romanLcParenBoth";
61
+ romanLcParenR: "romanLcParenR";
62
+ romanLcPeriod: "romanLcPeriod";
63
+ romanUcParenBoth: "romanUcParenBoth";
64
+ romanUcParenR: "romanUcParenR";
65
+ romanUcPeriod: "romanUcPeriod";
66
+ }>;
67
+ export declare const bulletOptionsSchema: z.ZodObject<{
68
+ type: z.ZodOptional<z.ZodEnum<{
69
+ number: "number";
70
+ bullet: "bullet";
71
+ }>>;
72
+ indent: z.ZodOptional<z.ZodNumber>;
73
+ numberType: z.ZodOptional<z.ZodEnum<{
74
+ alphaLcParenBoth: "alphaLcParenBoth";
75
+ alphaLcParenR: "alphaLcParenR";
76
+ alphaLcPeriod: "alphaLcPeriod";
77
+ alphaUcParenBoth: "alphaUcParenBoth";
78
+ alphaUcParenR: "alphaUcParenR";
79
+ alphaUcPeriod: "alphaUcPeriod";
80
+ arabicParenBoth: "arabicParenBoth";
81
+ arabicParenR: "arabicParenR";
82
+ arabicPeriod: "arabicPeriod";
83
+ arabicPlain: "arabicPlain";
84
+ romanLcParenBoth: "romanLcParenBoth";
85
+ romanLcParenR: "romanLcParenR";
86
+ romanLcPeriod: "romanLcPeriod";
87
+ romanUcParenBoth: "romanUcParenBoth";
88
+ romanUcParenR: "romanUcParenR";
89
+ romanUcPeriod: "romanUcPeriod";
90
+ }>>;
91
+ numberStartAt: z.ZodOptional<z.ZodNumber>;
92
+ }, z.core.$strip>;
49
93
  export declare const alignItemsSchema: z.ZodEnum<{
50
94
  start: "start";
51
95
  center: "center";
@@ -250,6 +294,8 @@ export type BorderDash = z.infer<typeof borderDashSchema>;
250
294
  export type BorderStyle = z.infer<typeof borderStyleSchema>;
251
295
  export type FillStyle = z.infer<typeof fillStyleSchema>;
252
296
  export type ShadowStyle = z.infer<typeof shadowStyleSchema>;
297
+ export type BulletNumberType = z.infer<typeof bulletNumberTypeSchema>;
298
+ export type BulletOptions = z.infer<typeof bulletOptionsSchema>;
253
299
  export type AlignItems = z.infer<typeof alignItemsSchema>;
254
300
  export type JustifyContent = z.infer<typeof justifyContentSchema>;
255
301
  export type FlexDirection = z.infer<typeof flexDirectionSchema>;
@@ -326,6 +372,32 @@ export declare const textNodeSchema: z.ZodObject<{
326
372
  bold: z.ZodOptional<z.ZodBoolean>;
327
373
  fontFamily: z.ZodOptional<z.ZodString>;
328
374
  lineSpacingMultiple: z.ZodOptional<z.ZodNumber>;
375
+ bullet: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
376
+ type: z.ZodOptional<z.ZodEnum<{
377
+ number: "number";
378
+ bullet: "bullet";
379
+ }>>;
380
+ indent: z.ZodOptional<z.ZodNumber>;
381
+ numberType: z.ZodOptional<z.ZodEnum<{
382
+ alphaLcParenBoth: "alphaLcParenBoth";
383
+ alphaLcParenR: "alphaLcParenR";
384
+ alphaLcPeriod: "alphaLcPeriod";
385
+ alphaUcParenBoth: "alphaUcParenBoth";
386
+ alphaUcParenR: "alphaUcParenR";
387
+ alphaUcPeriod: "alphaUcPeriod";
388
+ arabicParenBoth: "arabicParenBoth";
389
+ arabicParenR: "arabicParenR";
390
+ arabicPeriod: "arabicPeriod";
391
+ arabicPlain: "arabicPlain";
392
+ romanLcParenBoth: "romanLcParenBoth";
393
+ romanLcParenR: "romanLcParenR";
394
+ romanLcPeriod: "romanLcPeriod";
395
+ romanUcParenBoth: "romanUcParenBoth";
396
+ romanUcParenR: "romanUcParenR";
397
+ romanUcPeriod: "romanUcPeriod";
398
+ }>>;
399
+ numberStartAt: z.ZodOptional<z.ZodNumber>;
400
+ }, z.core.$strip>]>>;
329
401
  }, z.core.$strip>;
330
402
  export declare const imageNodeSchema: z.ZodObject<{
331
403
  yogaNode: z.ZodOptional<z.ZodCustom<YogaNode, YogaNode>>;
@@ -387,7 +459,7 @@ export declare const tableRowSchema: z.ZodObject<{
387
459
  height: z.ZodOptional<z.ZodNumber>;
388
460
  }, z.core.$strip>;
389
461
  export declare const tableColumnSchema: z.ZodObject<{
390
- width: z.ZodNumber;
462
+ width: z.ZodOptional<z.ZodNumber>;
391
463
  }, z.core.$strip>;
392
464
  export declare const tableNodeSchema: z.ZodObject<{
393
465
  yogaNode: z.ZodOptional<z.ZodCustom<YogaNode, YogaNode>>;
@@ -420,7 +492,7 @@ export declare const tableNodeSchema: z.ZodObject<{
420
492
  }, z.core.$strip>>;
421
493
  type: z.ZodLiteral<"table">;
422
494
  columns: z.ZodArray<z.ZodObject<{
423
- width: z.ZodNumber;
495
+ width: z.ZodOptional<z.ZodNumber>;
424
496
  }, z.core.$strip>>;
425
497
  rows: z.ZodArray<z.ZodObject<{
426
498
  cells: z.ZodArray<z.ZodObject<{
@@ -680,12 +752,68 @@ export declare const shapeNodeSchema: z.ZodObject<{
680
752
  color: z.ZodOptional<z.ZodString>;
681
753
  }, z.core.$strip>>;
682
754
  fontPx: z.ZodOptional<z.ZodNumber>;
683
- fontColor: z.ZodOptional<z.ZodString>;
755
+ color: z.ZodOptional<z.ZodString>;
684
756
  alignText: z.ZodOptional<z.ZodEnum<{
685
757
  right: "right";
686
758
  left: "left";
687
759
  center: "center";
688
760
  }>>;
761
+ bold: z.ZodOptional<z.ZodBoolean>;
762
+ }, z.core.$strip>;
763
+ export declare const chartTypeSchema: z.ZodEnum<{
764
+ line: "line";
765
+ pie: "pie";
766
+ bar: "bar";
767
+ }>;
768
+ export declare const chartDataSchema: z.ZodObject<{
769
+ name: z.ZodOptional<z.ZodString>;
770
+ labels: z.ZodArray<z.ZodString>;
771
+ values: z.ZodArray<z.ZodNumber>;
772
+ }, z.core.$strip>;
773
+ export declare const chartNodeSchema: z.ZodObject<{
774
+ yogaNode: z.ZodOptional<z.ZodCustom<YogaNode, YogaNode>>;
775
+ w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
776
+ h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
777
+ minW: z.ZodOptional<z.ZodNumber>;
778
+ maxW: z.ZodOptional<z.ZodNumber>;
779
+ minH: z.ZodOptional<z.ZodNumber>;
780
+ maxH: z.ZodOptional<z.ZodNumber>;
781
+ padding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
782
+ top: z.ZodOptional<z.ZodNumber>;
783
+ right: z.ZodOptional<z.ZodNumber>;
784
+ bottom: z.ZodOptional<z.ZodNumber>;
785
+ left: z.ZodOptional<z.ZodNumber>;
786
+ }, z.core.$strip>]>>;
787
+ backgroundColor: z.ZodOptional<z.ZodString>;
788
+ border: z.ZodOptional<z.ZodObject<{
789
+ color: z.ZodOptional<z.ZodString>;
790
+ width: z.ZodOptional<z.ZodNumber>;
791
+ dashType: z.ZodOptional<z.ZodEnum<{
792
+ solid: "solid";
793
+ dash: "dash";
794
+ dashDot: "dashDot";
795
+ lgDash: "lgDash";
796
+ lgDashDot: "lgDashDot";
797
+ lgDashDotDot: "lgDashDotDot";
798
+ sysDash: "sysDash";
799
+ sysDot: "sysDot";
800
+ }>>;
801
+ }, z.core.$strip>>;
802
+ type: z.ZodLiteral<"chart">;
803
+ chartType: z.ZodEnum<{
804
+ line: "line";
805
+ pie: "pie";
806
+ bar: "bar";
807
+ }>;
808
+ data: z.ZodArray<z.ZodObject<{
809
+ name: z.ZodOptional<z.ZodString>;
810
+ labels: z.ZodArray<z.ZodString>;
811
+ values: z.ZodArray<z.ZodNumber>;
812
+ }, z.core.$strip>>;
813
+ showLegend: z.ZodOptional<z.ZodBoolean>;
814
+ showTitle: z.ZodOptional<z.ZodBoolean>;
815
+ title: z.ZodOptional<z.ZodString>;
816
+ chartColors: z.ZodOptional<z.ZodArray<z.ZodString>>;
689
817
  }, z.core.$strip>;
690
818
  export type TextNode = z.infer<typeof textNodeSchema>;
691
819
  export type ImageNode = z.infer<typeof imageNodeSchema>;
@@ -694,6 +822,9 @@ export type TableRow = z.infer<typeof tableRowSchema>;
694
822
  export type TableColumn = z.infer<typeof tableColumnSchema>;
695
823
  export type TableNode = z.infer<typeof tableNodeSchema>;
696
824
  export type ShapeNode = z.infer<typeof shapeNodeSchema>;
825
+ export type ChartType = z.infer<typeof chartTypeSchema>;
826
+ export type ChartData = z.infer<typeof chartDataSchema>;
827
+ export type ChartNode = z.infer<typeof chartNodeSchema>;
697
828
  export type BoxNode = BasePOMNode & {
698
829
  type: "box";
699
830
  children: POMNode;
@@ -712,7 +843,7 @@ export type HStackNode = BasePOMNode & {
712
843
  alignItems?: AlignItems;
713
844
  justifyContent?: JustifyContent;
714
845
  };
715
- export type POMNode = TextNode | ImageNode | TableNode | BoxNode | VStackNode | HStackNode | ShapeNode;
846
+ export type POMNode = TextNode | ImageNode | TableNode | BoxNode | VStackNode | HStackNode | ShapeNode | ChartNode;
716
847
  export declare const boxNodeSchema: z.ZodType<BoxNode>;
717
848
  export declare const vStackNodeSchema: z.ZodType<VStackNode>;
718
849
  export declare const hStackNodeSchema: z.ZodType<HStackNode>;
@@ -730,17 +861,13 @@ export type PositionedNode = (TextNode & PositionedBase) | (ImageNode & Position
730
861
  children: PositionedNode[];
731
862
  }) | (HStackNode & PositionedBase & {
732
863
  children: PositionedNode[];
733
- }) | (ShapeNode & PositionedBase);
864
+ }) | (ShapeNode & PositionedBase) | (ChartNode & PositionedBase);
734
865
  export declare const positionedNodeSchema: z.ZodType<PositionedNode>;
735
866
  export declare const pageNumberPositionSchema: z.ZodEnum<{
736
867
  right: "right";
737
868
  left: "left";
738
869
  center: "center";
739
870
  }>;
740
- export declare const dateFormatSchema: z.ZodEnum<{
741
- "YYYY/MM/DD": "YYYY/MM/DD";
742
- locale: "locale";
743
- }>;
744
871
  export declare const masterSlideOptionsSchema: z.ZodObject<{
745
872
  header: z.ZodOptional<z.ZodLazy<z.ZodType<POMNode, unknown, z.core.$ZodTypeInternals<POMNode, unknown>>>>;
746
873
  footer: z.ZodOptional<z.ZodLazy<z.ZodType<POMNode, unknown, z.core.$ZodTypeInternals<POMNode, unknown>>>>;
@@ -752,14 +879,10 @@ export declare const masterSlideOptionsSchema: z.ZodObject<{
752
879
  }>;
753
880
  }, z.core.$strip>>;
754
881
  date: z.ZodOptional<z.ZodObject<{
755
- format: z.ZodEnum<{
756
- "YYYY/MM/DD": "YYYY/MM/DD";
757
- locale: "locale";
758
- }>;
882
+ value: z.ZodString;
759
883
  }, z.core.$strip>>;
760
884
  }, z.core.$strip>;
761
885
  export type PageNumberPosition = z.infer<typeof pageNumberPositionSchema>;
762
- export type DateFormat = z.infer<typeof dateFormatSchema>;
763
886
  export type MasterSlideOptions = z.infer<typeof masterSlideOptionsSchema>;
764
887
  export {};
765
888
  //# sourceMappingURL=types.d.ts.map
@@ -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,gBAAgB;;;;;EAAgD,CAAC;AAE9E,eAAO,MAAM,oBAAoB;;;;;;;EAO/B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;EAA4B,CAAC;AAE7D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C;AAEjC,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAiB7B,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
@@ -41,6 +41,30 @@ export const shadowStyleSchema = z.object({
41
41
  offset: z.number().optional(),
42
42
  color: z.string().optional(),
43
43
  });
44
+ export const bulletNumberTypeSchema = z.enum([
45
+ "alphaLcParenBoth",
46
+ "alphaLcParenR",
47
+ "alphaLcPeriod",
48
+ "alphaUcParenBoth",
49
+ "alphaUcParenR",
50
+ "alphaUcPeriod",
51
+ "arabicParenBoth",
52
+ "arabicParenR",
53
+ "arabicPeriod",
54
+ "arabicPlain",
55
+ "romanLcParenBoth",
56
+ "romanLcParenR",
57
+ "romanLcPeriod",
58
+ "romanUcParenBoth",
59
+ "romanUcParenR",
60
+ "romanUcPeriod",
61
+ ]);
62
+ export const bulletOptionsSchema = z.object({
63
+ type: z.enum(["bullet", "number"]).optional(),
64
+ indent: z.number().optional(),
65
+ numberType: bulletNumberTypeSchema.optional(),
66
+ numberStartAt: z.number().optional(),
67
+ });
44
68
  export const alignItemsSchema = z.enum(["start", "center", "end", "stretch"]);
45
69
  export const justifyContentSchema = z.enum([
46
70
  "start",
@@ -254,6 +278,7 @@ export const textNodeSchema = basePOMNodeSchema.extend({
254
278
  bold: z.boolean().optional(),
255
279
  fontFamily: z.string().optional(),
256
280
  lineSpacingMultiple: z.number().optional(),
281
+ bullet: z.union([z.boolean(), bulletOptionsSchema]).optional(),
257
282
  });
258
283
  export const imageNodeSchema = basePOMNodeSchema.extend({
259
284
  type: z.literal("image"),
@@ -272,7 +297,7 @@ export const tableRowSchema = z.object({
272
297
  height: z.number().optional(),
273
298
  });
274
299
  export const tableColumnSchema = z.object({
275
- width: z.number(),
300
+ width: z.number().optional(),
276
301
  });
277
302
  export const tableNodeSchema = basePOMNodeSchema.extend({
278
303
  type: z.literal("table"),
@@ -288,8 +313,24 @@ export const shapeNodeSchema = basePOMNodeSchema.extend({
288
313
  line: borderStyleSchema.optional(),
289
314
  shadow: shadowStyleSchema.optional(),
290
315
  fontPx: z.number().optional(),
291
- fontColor: z.string().optional(),
316
+ color: z.string().optional(),
292
317
  alignText: z.enum(["left", "center", "right"]).optional(),
318
+ bold: z.boolean().optional(),
319
+ });
320
+ export const chartTypeSchema = z.enum(["bar", "line", "pie"]);
321
+ export const chartDataSchema = z.object({
322
+ name: z.string().optional(),
323
+ labels: z.array(z.string()),
324
+ values: z.array(z.number()),
325
+ });
326
+ export const chartNodeSchema = basePOMNodeSchema.extend({
327
+ type: z.literal("chart"),
328
+ chartType: chartTypeSchema,
329
+ data: z.array(chartDataSchema),
330
+ showLegend: z.boolean().optional(),
331
+ showTitle: z.boolean().optional(),
332
+ title: z.string().optional(),
333
+ chartColors: z.array(z.string()).optional(),
293
334
  });
294
335
  // Define schemas using passthrough to maintain type safety
295
336
  const boxNodeSchemaBase = basePOMNodeSchema.extend({
@@ -322,6 +363,7 @@ export const pomNodeSchema = z.lazy(() => z.discriminatedUnion("type", [
322
363
  vStackNodeSchemaBase,
323
364
  hStackNodeSchemaBase,
324
365
  shapeNodeSchema,
366
+ chartNodeSchema,
325
367
  ]));
326
368
  // ===== Positioned Node Types =====
327
369
  const positionedBaseSchema = z.object({
@@ -344,10 +386,10 @@ export const positionedNodeSchema = z.lazy(() => z.union([
344
386
  children: z.array(z.lazy(() => positionedNodeSchema)),
345
387
  }),
346
388
  shapeNodeSchema.merge(positionedBaseSchema),
389
+ chartNodeSchema.merge(positionedBaseSchema),
347
390
  ]));
348
391
  // ===== Master Slide Options =====
349
392
  export const pageNumberPositionSchema = z.enum(["left", "center", "right"]);
350
- export const dateFormatSchema = z.enum(["YYYY/MM/DD", "locale"]);
351
393
  export const masterSlideOptionsSchema = z.object({
352
394
  header: z.lazy(() => pomNodeSchema).optional(),
353
395
  footer: z.lazy(() => pomNodeSchema).optional(),
@@ -358,7 +400,7 @@ export const masterSlideOptionsSchema = z.object({
358
400
  .optional(),
359
401
  date: z
360
402
  .object({
361
- format: dateFormatSchema,
403
+ value: z.string(),
362
404
  })
363
405
  .optional(),
364
406
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hirokisakabe/pom",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "PowerPoint Object Model - A declarative TypeScript library for creating PowerPoint presentations",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -25,7 +25,21 @@
25
25
  "url": "git+https://github.com/hirokisakabe/pom.git"
26
26
  },
27
27
  "license": "MIT",
28
+ "keywords": [
29
+ "powerpoint",
30
+ "pptx",
31
+ "presentation",
32
+ "slides",
33
+ "typescript",
34
+ "declarative",
35
+ "flexbox",
36
+ "layout",
37
+ "office"
38
+ ],
28
39
  "author": "Hiroki Sakabe",
40
+ "engines": {
41
+ "node": ">=18"
42
+ },
29
43
  "scripts": {
30
44
  "build": "tsc",
31
45
  "prepublishOnly": "npm run build && npm run lint && npm run fmt:check && npm run typecheck && npm run test:run",