@hirokisakabe/pom 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -150
- package/dist/buildPptx.d.ts +2 -2
- package/dist/buildPptx.d.ts.map +1 -1
- package/dist/buildPptx.js +3 -1
- package/dist/calcYogaLayout/fontLoader.d.ts +0 -7
- package/dist/calcYogaLayout/fontLoader.d.ts.map +1 -1
- package/dist/calcYogaLayout/fontLoader.js +1 -1
- package/dist/calcYogaLayout/measureText.d.ts +0 -4
- package/dist/calcYogaLayout/measureText.d.ts.map +1 -1
- package/dist/calcYogaLayout/measureText.js +0 -6
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/inputSchema.d.ts +3 -438
- package/dist/inputSchema.d.ts.map +1 -1
- package/dist/inputSchema.js +6 -138
- package/dist/parseXml.d.ts +28 -0
- package/dist/parseXml.d.ts.map +1 -0
- package/dist/parseXml.js +795 -0
- package/dist/renderPptx/renderPptx.d.ts +1 -2
- package/dist/renderPptx/renderPptx.d.ts.map +1 -1
- package/dist/renderPptx/renderPptx.js +0 -2
- package/dist/renderPptx/textOptions.d.ts +0 -1
- package/dist/renderPptx/textOptions.d.ts.map +1 -1
- package/dist/renderPptx/textOptions.js +1 -1
- package/dist/renderPptx/types.d.ts +0 -2
- package/dist/renderPptx/types.d.ts.map +1 -1
- package/dist/table/utils.d.ts +0 -2
- package/dist/table/utils.d.ts.map +1 -1
- package/dist/table/utils.js +2 -2
- package/dist/types.d.ts +13 -121
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +21 -27
- package/package.json +4 -6
- package/dist/component.d.ts +0 -90
- package/dist/component.d.ts.map +0 -1
- package/dist/component.js +0 -123
- package/dist/renderPptx/nodes/box.d.ts +0 -2
- package/dist/renderPptx/nodes/box.d.ts.map +0 -1
- package/dist/renderPptx/nodes/box.js +0 -3
- package/dist/renderPptx/utils/index.d.ts +0 -6
- package/dist/renderPptx/utils/index.d.ts.map +0 -1
- package/dist/renderPptx/utils/index.js +0 -3
- package/dist/renderPptx/utils/shapeDrawing.d.ts +0 -27
- package/dist/renderPptx/utils/shapeDrawing.d.ts.map +0 -1
- package/dist/renderPptx/utils/shapeDrawing.js +0 -36
- package/dist/renderPptx/utils/textDrawing.d.ts +0 -25
- package/dist/renderPptx/utils/textDrawing.d.ts.map +0 -1
- package/dist/renderPptx/utils/textDrawing.js +0 -25
- package/dist/schema.d.ts +0 -23
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hirokisakabe/pom",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
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,10 +9,6 @@
|
|
|
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"
|
|
16
12
|
}
|
|
17
13
|
},
|
|
18
14
|
"files": [
|
|
@@ -49,6 +45,7 @@
|
|
|
49
45
|
"prepublishOnly": "npm run build && npm run lint && npm run fmt:check && npm run typecheck && npm run test:run",
|
|
50
46
|
"fmt": "prettier --write .",
|
|
51
47
|
"fmt:check": "prettier --check .",
|
|
48
|
+
"knip": "knip",
|
|
52
49
|
"lint": "eslint",
|
|
53
50
|
"typecheck": "tsc --noEmit",
|
|
54
51
|
"test": "vitest",
|
|
@@ -72,13 +69,13 @@
|
|
|
72
69
|
"@changesets/changelog-github": "^0.5.2",
|
|
73
70
|
"@changesets/cli": "^2.29.8",
|
|
74
71
|
"@eslint/js": "^9.39.1",
|
|
75
|
-
"@types/image-size": "0.7.0",
|
|
76
72
|
"@types/opentype.js": "^1.3.8",
|
|
77
73
|
"@types/pngjs": "6.0.5",
|
|
78
74
|
"@vitest/ui": "^4.0.8",
|
|
79
75
|
"eslint": "^9.39.1",
|
|
80
76
|
"globals": "^16.5.0",
|
|
81
77
|
"jiti": "2.6.1",
|
|
78
|
+
"knip": "^5.85.0",
|
|
82
79
|
"pixelmatch": "7.1.0",
|
|
83
80
|
"pngjs": "7.0.0",
|
|
84
81
|
"prettier": "3.6.2",
|
|
@@ -88,6 +85,7 @@
|
|
|
88
85
|
"vitest": "^4.0.8"
|
|
89
86
|
},
|
|
90
87
|
"dependencies": {
|
|
88
|
+
"fast-xml-parser": "^5.3.7",
|
|
91
89
|
"image-size": "2.0.2",
|
|
92
90
|
"opentype.js": "^1.3.4",
|
|
93
91
|
"pptxgenjs": "4.0.1",
|
package/dist/component.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { POMNode } from "./types.ts";
|
|
2
|
-
/**
|
|
3
|
-
* 再利用可能なコンポーネントを定義する。
|
|
4
|
-
* Props を受け取り POMNode を返す関数を作成する。
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* const SectionCard = defineComponent<{
|
|
9
|
-
* title: string;
|
|
10
|
-
* content: POMNode;
|
|
11
|
-
* color?: string;
|
|
12
|
-
* }>((props) => ({
|
|
13
|
-
* type: "box",
|
|
14
|
-
* padding: 20,
|
|
15
|
-
* backgroundColor: "FFFFFF",
|
|
16
|
-
* border: { color: "E2E8F0", width: 1 },
|
|
17
|
-
* borderRadius: 8,
|
|
18
|
-
* children: {
|
|
19
|
-
* type: "vstack",
|
|
20
|
-
* gap: 12,
|
|
21
|
-
* children: [
|
|
22
|
-
* {
|
|
23
|
-
* type: "text",
|
|
24
|
-
* text: props.title,
|
|
25
|
-
* fontPx: 18,
|
|
26
|
-
* bold: true,
|
|
27
|
-
* color: props.color ?? "334155",
|
|
28
|
-
* },
|
|
29
|
-
* props.content,
|
|
30
|
-
* ],
|
|
31
|
-
* },
|
|
32
|
-
* }));
|
|
33
|
-
*
|
|
34
|
-
* // Usage:
|
|
35
|
-
* const node = SectionCard({
|
|
36
|
-
* title: "KPI Summary",
|
|
37
|
-
* content: { type: "text", text: "Revenue: $1M" },
|
|
38
|
-
* });
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare function defineComponent<Props>(render: (props: Props) => POMNode): (props: Props) => POMNode;
|
|
42
|
-
/**
|
|
43
|
-
* テーマ設定の型。コンポーネントにスタイルの一括オーバーライドを提供する。
|
|
44
|
-
*/
|
|
45
|
-
export type Theme = {
|
|
46
|
-
colors?: {
|
|
47
|
-
primary?: string;
|
|
48
|
-
secondary?: string;
|
|
49
|
-
background?: string;
|
|
50
|
-
text?: string;
|
|
51
|
-
border?: string;
|
|
52
|
-
accent?: string;
|
|
53
|
-
};
|
|
54
|
-
spacing?: {
|
|
55
|
-
xs?: number;
|
|
56
|
-
sm?: number;
|
|
57
|
-
md?: number;
|
|
58
|
-
lg?: number;
|
|
59
|
-
xl?: number;
|
|
60
|
-
};
|
|
61
|
-
fontPx?: {
|
|
62
|
-
title?: number;
|
|
63
|
-
heading?: number;
|
|
64
|
-
body?: number;
|
|
65
|
-
caption?: number;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
type RequiredTheme = {
|
|
69
|
-
colors: Required<NonNullable<Theme["colors"]>>;
|
|
70
|
-
spacing: Required<NonNullable<Theme["spacing"]>>;
|
|
71
|
-
fontPx: Required<NonNullable<Theme["fontPx"]>>;
|
|
72
|
-
};
|
|
73
|
-
export declare const defaultTheme: RequiredTheme;
|
|
74
|
-
/**
|
|
75
|
-
* デフォルトテーマとユーザー指定テーマをマージする。
|
|
76
|
-
*/
|
|
77
|
-
export declare function mergeTheme(theme?: Partial<Theme>): RequiredTheme;
|
|
78
|
-
export type ComponentRegistry = Record<string, (props: any) => POMNode>;
|
|
79
|
-
/**
|
|
80
|
-
* JSON 入力内のコンポーネントノードを展開して POMNode を返す。
|
|
81
|
-
* LLM が出力した JSON に `{ type: "component", name: "...", props: {...} }` が
|
|
82
|
-
* 含まれている場合、レジストリからコンポーネント関数を取得して展開する。
|
|
83
|
-
*/
|
|
84
|
-
export declare function expandComponents(input: unknown, registry: ComponentRegistry): POMNode;
|
|
85
|
-
/**
|
|
86
|
-
* 複数スライドの JSON 入力内のコンポーネントノードを展開する。
|
|
87
|
-
*/
|
|
88
|
-
export declare function expandComponentSlides(inputs: unknown[], registry: ComponentRegistry): POMNode[];
|
|
89
|
-
export {};
|
|
90
|
-
//# sourceMappingURL=component.d.ts.map
|
package/dist/component.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,eAAe,CAAC,KAAK,EACnC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,GAChC,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAE3B;AAED;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,EAAE;QACR,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,EAAE,CAAC,EAAE,MAAM,CAAC;KACb,CAAC;IACF,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC/C,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,aAsB1B,CAAC;AAEF;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,aAAa,CAMhE;AAGD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC;AA0CxE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EAAE,EACjB,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,EAAE,CAEX"}
|
package/dist/component.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 再利用可能なコンポーネントを定義する。
|
|
3
|
-
* Props を受け取り POMNode を返す関数を作成する。
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* const SectionCard = defineComponent<{
|
|
8
|
-
* title: string;
|
|
9
|
-
* content: POMNode;
|
|
10
|
-
* color?: string;
|
|
11
|
-
* }>((props) => ({
|
|
12
|
-
* type: "box",
|
|
13
|
-
* padding: 20,
|
|
14
|
-
* backgroundColor: "FFFFFF",
|
|
15
|
-
* border: { color: "E2E8F0", width: 1 },
|
|
16
|
-
* borderRadius: 8,
|
|
17
|
-
* children: {
|
|
18
|
-
* type: "vstack",
|
|
19
|
-
* gap: 12,
|
|
20
|
-
* children: [
|
|
21
|
-
* {
|
|
22
|
-
* type: "text",
|
|
23
|
-
* text: props.title,
|
|
24
|
-
* fontPx: 18,
|
|
25
|
-
* bold: true,
|
|
26
|
-
* color: props.color ?? "334155",
|
|
27
|
-
* },
|
|
28
|
-
* props.content,
|
|
29
|
-
* ],
|
|
30
|
-
* },
|
|
31
|
-
* }));
|
|
32
|
-
*
|
|
33
|
-
* // Usage:
|
|
34
|
-
* const node = SectionCard({
|
|
35
|
-
* title: "KPI Summary",
|
|
36
|
-
* content: { type: "text", text: "Revenue: $1M" },
|
|
37
|
-
* });
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export function defineComponent(render) {
|
|
41
|
-
return render;
|
|
42
|
-
}
|
|
43
|
-
export const defaultTheme = {
|
|
44
|
-
colors: {
|
|
45
|
-
primary: "1D4ED8",
|
|
46
|
-
secondary: "64748B",
|
|
47
|
-
background: "F8FAFC",
|
|
48
|
-
text: "1E293B",
|
|
49
|
-
border: "E2E8F0",
|
|
50
|
-
accent: "0EA5E9",
|
|
51
|
-
},
|
|
52
|
-
spacing: {
|
|
53
|
-
xs: 4,
|
|
54
|
-
sm: 8,
|
|
55
|
-
md: 16,
|
|
56
|
-
lg: 24,
|
|
57
|
-
xl: 48,
|
|
58
|
-
},
|
|
59
|
-
fontPx: {
|
|
60
|
-
title: 32,
|
|
61
|
-
heading: 20,
|
|
62
|
-
body: 14,
|
|
63
|
-
caption: 11,
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* デフォルトテーマとユーザー指定テーマをマージする。
|
|
68
|
-
*/
|
|
69
|
-
export function mergeTheme(theme) {
|
|
70
|
-
return {
|
|
71
|
-
colors: { ...defaultTheme.colors, ...theme?.colors },
|
|
72
|
-
spacing: { ...defaultTheme.spacing, ...theme?.spacing },
|
|
73
|
-
fontPx: { ...defaultTheme.fontPx, ...theme?.fontPx },
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function isRecord(value) {
|
|
77
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
78
|
-
}
|
|
79
|
-
function expandNode(input, registry) {
|
|
80
|
-
if (Array.isArray(input)) {
|
|
81
|
-
return input.map((item) => expandNode(item, registry));
|
|
82
|
-
}
|
|
83
|
-
if (!isRecord(input)) {
|
|
84
|
-
return input;
|
|
85
|
-
}
|
|
86
|
-
if (input.type === "component") {
|
|
87
|
-
const name = input.name;
|
|
88
|
-
const fn = registry[name];
|
|
89
|
-
if (!fn) {
|
|
90
|
-
throw new Error(`Unknown component: "${name}"`);
|
|
91
|
-
}
|
|
92
|
-
const rawProps = isRecord(input.props) ? input.props : {};
|
|
93
|
-
const expandedProps = Object.fromEntries(Object.entries(rawProps).map(([key, value]) => [
|
|
94
|
-
key,
|
|
95
|
-
expandNode(value, registry),
|
|
96
|
-
]));
|
|
97
|
-
return expandNode(fn(expandedProps), registry);
|
|
98
|
-
}
|
|
99
|
-
const result = {};
|
|
100
|
-
for (const [key, value] of Object.entries(input)) {
|
|
101
|
-
if (key === "children") {
|
|
102
|
-
result[key] = expandNode(value, registry);
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
result[key] = value;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* JSON 入力内のコンポーネントノードを展開して POMNode を返す。
|
|
112
|
-
* LLM が出力した JSON に `{ type: "component", name: "...", props: {...} }` が
|
|
113
|
-
* 含まれている場合、レジストリからコンポーネント関数を取得して展開する。
|
|
114
|
-
*/
|
|
115
|
-
export function expandComponents(input, registry) {
|
|
116
|
-
return expandNode(input, registry);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* 複数スライドの JSON 入力内のコンポーネントノードを展開する。
|
|
120
|
-
*/
|
|
121
|
-
export function expandComponentSlides(inputs, registry) {
|
|
122
|
-
return inputs.map((input) => expandComponents(input, registry));
|
|
123
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/box.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { renderBackgroundAndBorder } from "./backgroundBorder.ts";
|
|
2
|
-
export { drawCircle, drawLine } from "./shapeDrawing.ts";
|
|
3
|
-
export type { CircleOptions, LineOptions } from "./shapeDrawing.ts";
|
|
4
|
-
export { drawSimpleText } from "./textDrawing.ts";
|
|
5
|
-
export type { SimpleTextOptions } from "./textDrawing.ts";
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { RenderContext } from "../types.ts";
|
|
2
|
-
export type CircleOptions = {
|
|
3
|
-
cx: number;
|
|
4
|
-
cy: number;
|
|
5
|
-
radius: number;
|
|
6
|
-
fillColor: string;
|
|
7
|
-
lineColor?: string;
|
|
8
|
-
lineWidth?: number;
|
|
9
|
-
};
|
|
10
|
-
export type LineOptions = {
|
|
11
|
-
x1: number;
|
|
12
|
-
y1: number;
|
|
13
|
-
x2: number;
|
|
14
|
-
y2: number;
|
|
15
|
-
color: string;
|
|
16
|
-
width: number;
|
|
17
|
-
endArrowType?: "none" | "arrow" | "diamond" | "oval" | "stealth" | "triangle";
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* 円を描画する
|
|
21
|
-
*/
|
|
22
|
-
export declare function drawCircle(ctx: RenderContext, options: CircleOptions): void;
|
|
23
|
-
/**
|
|
24
|
-
* 線を描画する
|
|
25
|
-
*/
|
|
26
|
-
export declare function drawLine(ctx: RenderContext, options: LineOptions): void;
|
|
27
|
-
//# sourceMappingURL=shapeDrawing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shapeDrawing.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/utils/shapeDrawing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;CAC/E,CAAC;AAEF;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAa3E;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAiBvE"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { pxToIn, pxToPt } from "../units.js";
|
|
2
|
-
/**
|
|
3
|
-
* 円を描画する
|
|
4
|
-
*/
|
|
5
|
-
export function drawCircle(ctx, options) {
|
|
6
|
-
const { cx, cy, radius, fillColor, lineColor, lineWidth } = options;
|
|
7
|
-
ctx.slide.addShape(ctx.pptx.ShapeType.ellipse, {
|
|
8
|
-
x: pxToIn(cx - radius),
|
|
9
|
-
y: pxToIn(cy - radius),
|
|
10
|
-
w: pxToIn(radius * 2),
|
|
11
|
-
h: pxToIn(radius * 2),
|
|
12
|
-
fill: { color: fillColor },
|
|
13
|
-
line: lineColor
|
|
14
|
-
? { color: lineColor, width: lineWidth ? pxToPt(lineWidth) : undefined }
|
|
15
|
-
: { type: "none" },
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* 線を描画する
|
|
20
|
-
*/
|
|
21
|
-
export function drawLine(ctx, options) {
|
|
22
|
-
const { x1, y1, x2, y2, color, width, endArrowType } = options;
|
|
23
|
-
const isHorizontal = y1 === y2;
|
|
24
|
-
const isVertical = x1 === x2;
|
|
25
|
-
ctx.slide.addShape(ctx.pptx.ShapeType.line, {
|
|
26
|
-
x: pxToIn(Math.min(x1, x2)),
|
|
27
|
-
y: pxToIn(Math.min(y1, y2)),
|
|
28
|
-
w: isVertical ? 0 : pxToIn(Math.abs(x2 - x1)),
|
|
29
|
-
h: isHorizontal ? 0 : pxToIn(Math.abs(y2 - y1)),
|
|
30
|
-
line: {
|
|
31
|
-
color,
|
|
32
|
-
width: pxToPt(width),
|
|
33
|
-
endArrowType,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Underline } from "../../types.ts";
|
|
2
|
-
import type { RenderContext } from "../types.ts";
|
|
3
|
-
export type SimpleTextOptions = {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
w: number;
|
|
7
|
-
h: number;
|
|
8
|
-
text: string;
|
|
9
|
-
fontSize?: number;
|
|
10
|
-
fontFace?: string;
|
|
11
|
-
color?: string;
|
|
12
|
-
bold?: boolean;
|
|
13
|
-
italic?: boolean;
|
|
14
|
-
underline?: Underline;
|
|
15
|
-
strike?: boolean;
|
|
16
|
-
highlight?: string;
|
|
17
|
-
align?: "left" | "center" | "right";
|
|
18
|
-
valign?: "top" | "middle" | "bottom";
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* シンプルなテキストを描画する
|
|
22
|
-
* timeline, matrix, tree, flow などの複雑ノードで使用
|
|
23
|
-
*/
|
|
24
|
-
export declare function drawSimpleText(ctx: RenderContext, options: SimpleTextOptions): void;
|
|
25
|
-
//# sourceMappingURL=textDrawing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"textDrawing.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/utils/textDrawing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACtC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,iBAAiB,GACzB,IAAI,CAmCN"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { pxToIn, pxToPt } from "../units.js";
|
|
2
|
-
import { convertUnderline, convertStrike } from "../textOptions.js";
|
|
3
|
-
/**
|
|
4
|
-
* シンプルなテキストを描画する
|
|
5
|
-
* timeline, matrix, tree, flow などの複雑ノードで使用
|
|
6
|
-
*/
|
|
7
|
-
export function drawSimpleText(ctx, options) {
|
|
8
|
-
const { x, y, w, h, text, fontSize = 12, fontFace = "Noto Sans JP", color = "000000", bold, italic, underline, strike, highlight, align = "left", valign = "top", } = options;
|
|
9
|
-
ctx.slide.addText(text, {
|
|
10
|
-
x: pxToIn(x),
|
|
11
|
-
y: pxToIn(y),
|
|
12
|
-
w: pxToIn(w),
|
|
13
|
-
h: pxToIn(h),
|
|
14
|
-
fontSize: pxToPt(fontSize),
|
|
15
|
-
fontFace,
|
|
16
|
-
color,
|
|
17
|
-
bold,
|
|
18
|
-
italic,
|
|
19
|
-
underline: convertUnderline(underline),
|
|
20
|
-
strike: convertStrike(strike),
|
|
21
|
-
highlight,
|
|
22
|
-
align,
|
|
23
|
-
valign,
|
|
24
|
-
});
|
|
25
|
-
}
|
package/dist/schema.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser-compatible schema exports
|
|
3
|
-
*
|
|
4
|
-
* This module exports only the Zod schemas and types without any Node.js dependencies.
|
|
5
|
-
* Use this entry point when you need to validate LLM-generated JSON in browser environments.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { inputPomNodeSchema } from "@hirokisakabe/pom/schema";
|
|
10
|
-
*
|
|
11
|
-
* const result = inputPomNodeSchema.safeParse(llmResponse);
|
|
12
|
-
* if (result.success) {
|
|
13
|
-
* // Send to server for PPTX generation
|
|
14
|
-
* await fetch("/api/generate-pptx", {
|
|
15
|
-
* method: "POST",
|
|
16
|
-
* body: JSON.stringify(result.data),
|
|
17
|
-
* });
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export { inputPomNodeSchema, inputTextNodeSchema, inputImageNodeSchema, inputTableNodeSchema, inputBoxNodeSchema, inputVStackNodeSchema, inputHStackNodeSchema, inputShapeNodeSchema, inputChartNodeSchema, inputTimelineNodeSchema, inputMatrixNodeSchema, inputTreeNodeSchema, inputFlowNodeSchema, inputProcessArrowNodeSchema, inputLineNodeSchema, inputLayerNodeSchema, inputSlideMasterOptionsSchema, inputMasterTextObjectSchema, inputMasterImageObjectSchema, inputMasterRectObjectSchema, inputMasterLineObjectSchema, inputMasterObjectSchema, inputSlideNumberOptionsSchema, inputSlideMasterBackgroundSchema, inputSlideMasterMarginSchema, inputBaseNodeSchema, type InputPOMNode, type InputTextNode, type InputImageNode, type InputTableNode, type InputBoxNode, type InputVStackNode, type InputHStackNode, type InputShapeNode, type InputChartNode, type InputTimelineNode, type InputMatrixNode, type InputTreeNode, type InputFlowNode, type InputProcessArrowNode, type InputLineNode, type InputLayerNode, type InputSlideMasterOptions, } from "./inputSchema.ts";
|
|
22
|
-
export { lengthSchema, paddingSchema, borderStyleSchema, borderDashSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, bulletNumberTypeSchema, tableColumnSchema, tableRowSchema, tableCellSchema, slideMasterOptionsSchema, masterTextObjectSchema, masterImageObjectSchema, masterRectObjectSchema, masterLineObjectSchema, masterObjectSchema, slideNumberOptionsSchema, slideMasterBackgroundSchema, slideMasterMarginSchema, type Length, type Padding, type BorderStyle, type BorderDash, type FillStyle, type ShadowStyle, type AlignItems, type JustifyContent, type ShapeType, type ChartType, type ChartData, type BulletOptions, type BulletNumberType, type TableColumn, type TableRow, type TableCell, type SlideMasterOptions, type MasterTextObject, type MasterImageObject, type MasterRectObject, type MasterLineObject, type MasterObject, type SlideNumberOptions, type SlideMasterBackground, type SlideMasterMargin, } from "./types.ts";
|
|
23
|
-
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACpB,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACvB,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,EAC5B,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,uBAAuB,GAC7B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC"}
|
package/dist/schema.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser-compatible schema exports
|
|
3
|
-
*
|
|
4
|
-
* This module exports only the Zod schemas and types without any Node.js dependencies.
|
|
5
|
-
* Use this entry point when you need to validate LLM-generated JSON in browser environments.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { inputPomNodeSchema } from "@hirokisakabe/pom/schema";
|
|
10
|
-
*
|
|
11
|
-
* const result = inputPomNodeSchema.safeParse(llmResponse);
|
|
12
|
-
* if (result.success) {
|
|
13
|
-
* // Send to server for PPTX generation
|
|
14
|
-
* await fetch("/api/generate-pptx", {
|
|
15
|
-
* method: "POST",
|
|
16
|
-
* body: JSON.stringify(result.data),
|
|
17
|
-
* });
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
// Input schemas for LLM/external input validation
|
|
22
|
-
export { inputPomNodeSchema, inputTextNodeSchema, inputImageNodeSchema, inputTableNodeSchema, inputBoxNodeSchema, inputVStackNodeSchema, inputHStackNodeSchema, inputShapeNodeSchema, inputChartNodeSchema, inputTimelineNodeSchema, inputMatrixNodeSchema, inputTreeNodeSchema, inputFlowNodeSchema, inputProcessArrowNodeSchema, inputLineNodeSchema, inputLayerNodeSchema, inputSlideMasterOptionsSchema, inputMasterTextObjectSchema, inputMasterImageObjectSchema, inputMasterRectObjectSchema, inputMasterLineObjectSchema, inputMasterObjectSchema, inputSlideNumberOptionsSchema, inputSlideMasterBackgroundSchema, inputSlideMasterMarginSchema, inputBaseNodeSchema, } from "./inputSchema.js";
|
|
23
|
-
// Basic type schemas (browser-compatible)
|
|
24
|
-
export { lengthSchema, paddingSchema, borderStyleSchema, borderDashSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, bulletNumberTypeSchema, tableColumnSchema, tableRowSchema, tableCellSchema, slideMasterOptionsSchema, masterTextObjectSchema, masterImageObjectSchema, masterRectObjectSchema, masterLineObjectSchema, masterObjectSchema, slideNumberOptionsSchema, slideMasterBackgroundSchema, slideMasterMarginSchema, } from "./types.js";
|