@hirokisakabe/pom 1.2.0 → 1.4.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 +27 -0
- package/dist/calcYogaLayout/calcYogaLayout.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/inputSchema.d.ts +115 -3
- package/dist/inputSchema.d.ts.map +1 -1
- package/dist/inputSchema.js +6 -1
- package/dist/parseXml.d.ts +24 -0
- package/dist/parseXml.d.ts.map +1 -0
- package/dist/parseXml.js +332 -0
- package/dist/renderPptx/nodes/image.d.ts.map +1 -1
- package/dist/renderPptx/nodes/image.js +10 -0
- package/dist/renderPptx/renderPptx.d.ts.map +1 -1
- package/dist/renderPptx/renderPptx.js +25 -4
- package/dist/renderPptx/utils/backgroundBorder.d.ts +3 -1
- package/dist/renderPptx/utils/backgroundBorder.d.ts.map +1 -1
- package/dist/renderPptx/utils/backgroundBorder.js +103 -23
- package/dist/types.d.ts +127 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +11 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -192,6 +192,33 @@ const slides = expandComponentSlides(llmOutput, registry);
|
|
|
192
192
|
const pptx = await buildPptx(slides, { w: 1280, h: 720 });
|
|
193
193
|
```
|
|
194
194
|
|
|
195
|
+
## XML Input
|
|
196
|
+
|
|
197
|
+
`parseXml` allows you to describe slides in XML instead of JSON. XML tags (PascalCase) are mapped to POM node types, and attribute values are automatically type-coerced using Zod schemas.
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
import { parseXml, buildPptx } from "@hirokisakabe/pom";
|
|
201
|
+
|
|
202
|
+
const xml = `
|
|
203
|
+
<VStack gap="16" padding="32">
|
|
204
|
+
<Text fontPx="32" bold="true">売上レポート</Text>
|
|
205
|
+
<HStack gap="16">
|
|
206
|
+
<Chart chartType="bar" w="400" h="300"
|
|
207
|
+
data='[{ "name": "Q1", "labels": ["1月","2月","3月"], "values": [100,120,90] }]'
|
|
208
|
+
/>
|
|
209
|
+
<Text fontPx="18" color="00AA00">前年比 +15%</Text>
|
|
210
|
+
</HStack>
|
|
211
|
+
</VStack>
|
|
212
|
+
`;
|
|
213
|
+
|
|
214
|
+
const nodes = parseXml(xml);
|
|
215
|
+
const pptx = await buildPptx(nodes, { w: 1280, h: 720 });
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Unknown tags are treated as component nodes (`{ type: "component", name: tagName, props: {...} }`), which can be resolved with `expandComponents()`.
|
|
219
|
+
|
|
220
|
+
For more details, see [LLM Integration - XML Format](./docs/llm-integration.md#xml-format).
|
|
221
|
+
|
|
195
222
|
## Documentation
|
|
196
223
|
|
|
197
224
|
| Document | Description |
|
|
@@ -35,6 +35,10 @@ async function prefetchAllImageSizes(node) {
|
|
|
35
35
|
function collectImageSources(node) {
|
|
36
36
|
const sources = [];
|
|
37
37
|
function traverse(n) {
|
|
38
|
+
// backgroundImage の src を収集(全ノード共通)
|
|
39
|
+
if (n.backgroundImage) {
|
|
40
|
+
sources.push(n.backgroundImage.src);
|
|
41
|
+
}
|
|
38
42
|
if (n.type === "image") {
|
|
39
43
|
sources.push(n.src);
|
|
40
44
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { buildPptx } from "./buildPptx.ts";
|
|
|
4
4
|
export type { TextMeasurementMode } from "./buildPptx.ts";
|
|
5
5
|
export { defineComponent, defaultTheme, mergeTheme, expandComponents, expandComponentSlides, } from "./component.ts";
|
|
6
6
|
export type { Theme, ComponentRegistry } from "./component.ts";
|
|
7
|
+
export { parseXml } from "./parseXml.ts";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACL,eAAe,EACf,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACL,eAAe,EACf,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/inputSchema.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
import { z } from "zod";
|
|
20
|
-
import { type AlignItems, type JustifyContent, type TreeDataItem } from "./types.ts";
|
|
20
|
+
import { type AlignItems, type JustifyContent, type TreeDataItem, type ShadowStyle } from "./types.ts";
|
|
21
21
|
export declare const inputBaseNodeSchema: z.ZodObject<{
|
|
22
22
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
23
23
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
@@ -32,6 +32,13 @@ export declare const inputBaseNodeSchema: z.ZodObject<{
|
|
|
32
32
|
left: z.ZodOptional<z.ZodNumber>;
|
|
33
33
|
}, z.core.$strip>]>>;
|
|
34
34
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
35
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
src: z.ZodString;
|
|
37
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
38
|
+
cover: "cover";
|
|
39
|
+
contain: "contain";
|
|
40
|
+
}>>;
|
|
41
|
+
}, z.core.$strip>>;
|
|
35
42
|
border: z.ZodOptional<z.ZodObject<{
|
|
36
43
|
color: z.ZodOptional<z.ZodString>;
|
|
37
44
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -47,6 +54,7 @@ export declare const inputBaseNodeSchema: z.ZodObject<{
|
|
|
47
54
|
}>>;
|
|
48
55
|
}, z.core.$strip>>;
|
|
49
56
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
50
58
|
}, z.core.$strip>;
|
|
51
59
|
type InputBaseNode = z.infer<typeof inputBaseNodeSchema>;
|
|
52
60
|
export declare const inputTextNodeSchema: z.ZodObject<{
|
|
@@ -63,6 +71,13 @@ export declare const inputTextNodeSchema: z.ZodObject<{
|
|
|
63
71
|
left: z.ZodOptional<z.ZodNumber>;
|
|
64
72
|
}, z.core.$strip>]>>;
|
|
65
73
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
74
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
src: z.ZodString;
|
|
76
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
77
|
+
cover: "cover";
|
|
78
|
+
contain: "contain";
|
|
79
|
+
}>>;
|
|
80
|
+
}, z.core.$strip>>;
|
|
66
81
|
border: z.ZodOptional<z.ZodObject<{
|
|
67
82
|
color: z.ZodOptional<z.ZodString>;
|
|
68
83
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -78,6 +93,7 @@ export declare const inputTextNodeSchema: z.ZodObject<{
|
|
|
78
93
|
}>>;
|
|
79
94
|
}, z.core.$strip>>;
|
|
80
95
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
81
97
|
type: z.ZodLiteral<"text">;
|
|
82
98
|
text: z.ZodString;
|
|
83
99
|
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
@@ -142,8 +158,8 @@ export declare const inputTextNodeSchema: z.ZodObject<{
|
|
|
142
158
|
}, z.core.$strip>;
|
|
143
159
|
export declare const inputImageSizingSchema: z.ZodObject<{
|
|
144
160
|
type: z.ZodEnum<{
|
|
145
|
-
contain: "contain";
|
|
146
161
|
cover: "cover";
|
|
162
|
+
contain: "contain";
|
|
147
163
|
crop: "crop";
|
|
148
164
|
}>;
|
|
149
165
|
w: z.ZodOptional<z.ZodNumber>;
|
|
@@ -165,6 +181,13 @@ export declare const inputImageNodeSchema: z.ZodObject<{
|
|
|
165
181
|
left: z.ZodOptional<z.ZodNumber>;
|
|
166
182
|
}, z.core.$strip>]>>;
|
|
167
183
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
184
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
185
|
+
src: z.ZodString;
|
|
186
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
187
|
+
cover: "cover";
|
|
188
|
+
contain: "contain";
|
|
189
|
+
}>>;
|
|
190
|
+
}, z.core.$strip>>;
|
|
168
191
|
border: z.ZodOptional<z.ZodObject<{
|
|
169
192
|
color: z.ZodOptional<z.ZodString>;
|
|
170
193
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -180,12 +203,13 @@ export declare const inputImageNodeSchema: z.ZodObject<{
|
|
|
180
203
|
}>>;
|
|
181
204
|
}, z.core.$strip>>;
|
|
182
205
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
206
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
183
207
|
type: z.ZodLiteral<"image">;
|
|
184
208
|
src: z.ZodString;
|
|
185
209
|
sizing: z.ZodOptional<z.ZodObject<{
|
|
186
210
|
type: z.ZodEnum<{
|
|
187
|
-
contain: "contain";
|
|
188
211
|
cover: "cover";
|
|
212
|
+
contain: "contain";
|
|
189
213
|
crop: "crop";
|
|
190
214
|
}>;
|
|
191
215
|
w: z.ZodOptional<z.ZodNumber>;
|
|
@@ -193,6 +217,17 @@ export declare const inputImageNodeSchema: z.ZodObject<{
|
|
|
193
217
|
x: z.ZodOptional<z.ZodNumber>;
|
|
194
218
|
y: z.ZodOptional<z.ZodNumber>;
|
|
195
219
|
}, z.core.$strip>>;
|
|
220
|
+
shadow: z.ZodOptional<z.ZodObject<{
|
|
221
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
222
|
+
outer: "outer";
|
|
223
|
+
inner: "inner";
|
|
224
|
+
}>>;
|
|
225
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
226
|
+
blur: z.ZodOptional<z.ZodNumber>;
|
|
227
|
+
angle: z.ZodOptional<z.ZodNumber>;
|
|
228
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
229
|
+
color: z.ZodOptional<z.ZodString>;
|
|
230
|
+
}, z.core.$strip>>;
|
|
196
231
|
}, z.core.$strip>;
|
|
197
232
|
export declare const inputTableNodeSchema: z.ZodObject<{
|
|
198
233
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
@@ -208,6 +243,13 @@ export declare const inputTableNodeSchema: z.ZodObject<{
|
|
|
208
243
|
left: z.ZodOptional<z.ZodNumber>;
|
|
209
244
|
}, z.core.$strip>]>>;
|
|
210
245
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
246
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
247
|
+
src: z.ZodString;
|
|
248
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
249
|
+
cover: "cover";
|
|
250
|
+
contain: "contain";
|
|
251
|
+
}>>;
|
|
252
|
+
}, z.core.$strip>>;
|
|
211
253
|
border: z.ZodOptional<z.ZodObject<{
|
|
212
254
|
color: z.ZodOptional<z.ZodString>;
|
|
213
255
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -223,6 +265,7 @@ export declare const inputTableNodeSchema: z.ZodObject<{
|
|
|
223
265
|
}>>;
|
|
224
266
|
}, z.core.$strip>>;
|
|
225
267
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
268
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
226
269
|
type: z.ZodLiteral<"table">;
|
|
227
270
|
columns: z.ZodArray<z.ZodObject<{
|
|
228
271
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -281,6 +324,13 @@ export declare const inputShapeNodeSchema: z.ZodObject<{
|
|
|
281
324
|
left: z.ZodOptional<z.ZodNumber>;
|
|
282
325
|
}, z.core.$strip>]>>;
|
|
283
326
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
327
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
328
|
+
src: z.ZodString;
|
|
329
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
330
|
+
cover: "cover";
|
|
331
|
+
contain: "contain";
|
|
332
|
+
}>>;
|
|
333
|
+
}, z.core.$strip>>;
|
|
284
334
|
border: z.ZodOptional<z.ZodObject<{
|
|
285
335
|
color: z.ZodOptional<z.ZodString>;
|
|
286
336
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -296,6 +346,7 @@ export declare const inputShapeNodeSchema: z.ZodObject<{
|
|
|
296
346
|
}>>;
|
|
297
347
|
}, z.core.$strip>>;
|
|
298
348
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
349
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
299
350
|
type: z.ZodLiteral<"shape">;
|
|
300
351
|
shapeType: z.ZodEnum<{
|
|
301
352
|
accentBorderCallout1: "accentBorderCallout1";
|
|
@@ -553,6 +604,13 @@ export declare const inputChartNodeSchema: z.ZodObject<{
|
|
|
553
604
|
left: z.ZodOptional<z.ZodNumber>;
|
|
554
605
|
}, z.core.$strip>]>>;
|
|
555
606
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
607
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
608
|
+
src: z.ZodString;
|
|
609
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
610
|
+
cover: "cover";
|
|
611
|
+
contain: "contain";
|
|
612
|
+
}>>;
|
|
613
|
+
}, z.core.$strip>>;
|
|
556
614
|
border: z.ZodOptional<z.ZodObject<{
|
|
557
615
|
color: z.ZodOptional<z.ZodString>;
|
|
558
616
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -568,6 +626,7 @@ export declare const inputChartNodeSchema: z.ZodObject<{
|
|
|
568
626
|
}>>;
|
|
569
627
|
}, z.core.$strip>>;
|
|
570
628
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
629
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
571
630
|
type: z.ZodLiteral<"chart">;
|
|
572
631
|
chartType: z.ZodEnum<{
|
|
573
632
|
line: "line";
|
|
@@ -606,6 +665,13 @@ export declare const inputTimelineNodeSchema: z.ZodObject<{
|
|
|
606
665
|
left: z.ZodOptional<z.ZodNumber>;
|
|
607
666
|
}, z.core.$strip>]>>;
|
|
608
667
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
668
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
669
|
+
src: z.ZodString;
|
|
670
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
671
|
+
cover: "cover";
|
|
672
|
+
contain: "contain";
|
|
673
|
+
}>>;
|
|
674
|
+
}, z.core.$strip>>;
|
|
609
675
|
border: z.ZodOptional<z.ZodObject<{
|
|
610
676
|
color: z.ZodOptional<z.ZodString>;
|
|
611
677
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -621,6 +687,7 @@ export declare const inputTimelineNodeSchema: z.ZodObject<{
|
|
|
621
687
|
}>>;
|
|
622
688
|
}, z.core.$strip>>;
|
|
623
689
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
690
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
624
691
|
type: z.ZodLiteral<"timeline">;
|
|
625
692
|
direction: z.ZodOptional<z.ZodEnum<{
|
|
626
693
|
horizontal: "horizontal";
|
|
@@ -647,6 +714,13 @@ export declare const inputMatrixNodeSchema: z.ZodObject<{
|
|
|
647
714
|
left: z.ZodOptional<z.ZodNumber>;
|
|
648
715
|
}, z.core.$strip>]>>;
|
|
649
716
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
717
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
718
|
+
src: z.ZodString;
|
|
719
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
720
|
+
cover: "cover";
|
|
721
|
+
contain: "contain";
|
|
722
|
+
}>>;
|
|
723
|
+
}, z.core.$strip>>;
|
|
650
724
|
border: z.ZodOptional<z.ZodObject<{
|
|
651
725
|
color: z.ZodOptional<z.ZodString>;
|
|
652
726
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -662,6 +736,7 @@ export declare const inputMatrixNodeSchema: z.ZodObject<{
|
|
|
662
736
|
}>>;
|
|
663
737
|
}, z.core.$strip>>;
|
|
664
738
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
739
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
665
740
|
type: z.ZodLiteral<"matrix">;
|
|
666
741
|
axes: z.ZodObject<{
|
|
667
742
|
x: z.ZodString;
|
|
@@ -695,6 +770,13 @@ export declare const inputTreeNodeSchema: z.ZodObject<{
|
|
|
695
770
|
left: z.ZodOptional<z.ZodNumber>;
|
|
696
771
|
}, z.core.$strip>]>>;
|
|
697
772
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
773
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
774
|
+
src: z.ZodString;
|
|
775
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
776
|
+
cover: "cover";
|
|
777
|
+
contain: "contain";
|
|
778
|
+
}>>;
|
|
779
|
+
}, z.core.$strip>>;
|
|
698
780
|
border: z.ZodOptional<z.ZodObject<{
|
|
699
781
|
color: z.ZodOptional<z.ZodString>;
|
|
700
782
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -710,6 +792,7 @@ export declare const inputTreeNodeSchema: z.ZodObject<{
|
|
|
710
792
|
}>>;
|
|
711
793
|
}, z.core.$strip>>;
|
|
712
794
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
795
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
713
796
|
type: z.ZodLiteral<"tree">;
|
|
714
797
|
layout: z.ZodOptional<z.ZodEnum<{
|
|
715
798
|
horizontal: "horizontal";
|
|
@@ -744,6 +827,13 @@ export declare const inputFlowNodeSchema: z.ZodObject<{
|
|
|
744
827
|
left: z.ZodOptional<z.ZodNumber>;
|
|
745
828
|
}, z.core.$strip>]>>;
|
|
746
829
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
830
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
831
|
+
src: z.ZodString;
|
|
832
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
833
|
+
cover: "cover";
|
|
834
|
+
contain: "contain";
|
|
835
|
+
}>>;
|
|
836
|
+
}, z.core.$strip>>;
|
|
747
837
|
border: z.ZodOptional<z.ZodObject<{
|
|
748
838
|
color: z.ZodOptional<z.ZodString>;
|
|
749
839
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -759,6 +849,7 @@ export declare const inputFlowNodeSchema: z.ZodObject<{
|
|
|
759
849
|
}>>;
|
|
760
850
|
}, z.core.$strip>>;
|
|
761
851
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
852
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
762
853
|
type: z.ZodLiteral<"flow">;
|
|
763
854
|
direction: z.ZodOptional<z.ZodEnum<{
|
|
764
855
|
horizontal: "horizontal";
|
|
@@ -822,6 +913,13 @@ export declare const inputProcessArrowNodeSchema: z.ZodObject<{
|
|
|
822
913
|
left: z.ZodOptional<z.ZodNumber>;
|
|
823
914
|
}, z.core.$strip>]>>;
|
|
824
915
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
916
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
917
|
+
src: z.ZodString;
|
|
918
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
919
|
+
cover: "cover";
|
|
920
|
+
contain: "contain";
|
|
921
|
+
}>>;
|
|
922
|
+
}, z.core.$strip>>;
|
|
825
923
|
border: z.ZodOptional<z.ZodObject<{
|
|
826
924
|
color: z.ZodOptional<z.ZodString>;
|
|
827
925
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -837,6 +935,7 @@ export declare const inputProcessArrowNodeSchema: z.ZodObject<{
|
|
|
837
935
|
}>>;
|
|
838
936
|
}, z.core.$strip>>;
|
|
839
937
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
938
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
840
939
|
type: z.ZodLiteral<"processArrow">;
|
|
841
940
|
direction: z.ZodOptional<z.ZodEnum<{
|
|
842
941
|
horizontal: "horizontal";
|
|
@@ -890,6 +989,13 @@ export declare const inputLineNodeSchema: z.ZodObject<{
|
|
|
890
989
|
left: z.ZodOptional<z.ZodNumber>;
|
|
891
990
|
}, z.core.$strip>]>>;
|
|
892
991
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
992
|
+
backgroundImage: z.ZodOptional<z.ZodObject<{
|
|
993
|
+
src: z.ZodString;
|
|
994
|
+
sizing: z.ZodOptional<z.ZodEnum<{
|
|
995
|
+
cover: "cover";
|
|
996
|
+
contain: "contain";
|
|
997
|
+
}>>;
|
|
998
|
+
}, z.core.$strip>>;
|
|
893
999
|
border: z.ZodOptional<z.ZodObject<{
|
|
894
1000
|
color: z.ZodOptional<z.ZodString>;
|
|
895
1001
|
width: z.ZodOptional<z.ZodNumber>;
|
|
@@ -905,6 +1011,7 @@ export declare const inputLineNodeSchema: z.ZodObject<{
|
|
|
905
1011
|
}>>;
|
|
906
1012
|
}, z.core.$strip>>;
|
|
907
1013
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
1014
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
908
1015
|
type: z.ZodLiteral<"line">;
|
|
909
1016
|
x1: z.ZodNumber;
|
|
910
1017
|
y1: z.ZodNumber;
|
|
@@ -957,6 +1064,7 @@ export type InputLineNode = z.infer<typeof inputLineNodeSchema>;
|
|
|
957
1064
|
export type InputBoxNode = InputBaseNode & {
|
|
958
1065
|
type: "box";
|
|
959
1066
|
children: InputPOMNode;
|
|
1067
|
+
shadow?: ShadowStyle;
|
|
960
1068
|
};
|
|
961
1069
|
export type InputVStackNode = InputBaseNode & {
|
|
962
1070
|
type: "vstack";
|
|
@@ -1204,6 +1312,8 @@ export declare const inputSlideMasterBackgroundSchema: z.ZodUnion<readonly [z.Zo
|
|
|
1204
1312
|
path: z.ZodString;
|
|
1205
1313
|
}, z.core.$strip>, z.ZodObject<{
|
|
1206
1314
|
data: z.ZodString;
|
|
1315
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1316
|
+
image: z.ZodString;
|
|
1207
1317
|
}, z.core.$strip>]>;
|
|
1208
1318
|
export declare const inputSlideMasterMarginSchema: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
1209
1319
|
top: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1238,6 +1348,8 @@ export declare const inputSlideMasterOptionsSchema: z.ZodObject<{
|
|
|
1238
1348
|
path: z.ZodString;
|
|
1239
1349
|
}, z.core.$strip>, z.ZodObject<{
|
|
1240
1350
|
data: z.ZodString;
|
|
1351
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1352
|
+
image: z.ZodString;
|
|
1241
1353
|
}, z.core.$strip>]>>;
|
|
1242
1354
|
margin: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
1243
1355
|
top: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../src/inputSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../src/inputSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAiCL,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAa9B,CAAC;AAEH,KAAK,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGzD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAc9B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;iBAMjC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgBtC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;iBAOvC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;iBAQtC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;iBAOtC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAKlC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;iBAQxC,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;;;mBAK3C,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;mBAQvC,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMxC,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, borderDashSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, tableColumnSchema, tableRowSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, radarStyleSchema, timelineDirectionSchema, timelineItemSchema, matrixAxisSchema, matrixQuadrantsSchema, matrixItemSchema, treeLayoutSchema, treeNodeShapeSchema, treeConnectorStyleSchema, flowDirectionSchema, flowNodeItemSchema, flowConnectionSchema, flowConnectorStyleSchema, processArrowDirectionSchema, processArrowStepSchema, lineArrowSchema, underlineSchema, } from "./types.js";
|
|
20
|
+
import { lengthSchema, paddingSchema, borderStyleSchema, borderDashSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, tableColumnSchema, tableRowSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, radarStyleSchema, timelineDirectionSchema, timelineItemSchema, matrixAxisSchema, matrixQuadrantsSchema, matrixItemSchema, treeLayoutSchema, treeNodeShapeSchema, treeConnectorStyleSchema, flowDirectionSchema, flowNodeItemSchema, flowConnectionSchema, flowConnectorStyleSchema, processArrowDirectionSchema, processArrowStepSchema, lineArrowSchema, underlineSchema, backgroundImageSchema, } from "./types.js";
|
|
21
21
|
// ===== Base Node Schema =====
|
|
22
22
|
export const inputBaseNodeSchema = z.object({
|
|
23
23
|
w: lengthSchema.optional(),
|
|
@@ -28,8 +28,10 @@ export const inputBaseNodeSchema = z.object({
|
|
|
28
28
|
maxH: z.number().optional(),
|
|
29
29
|
padding: paddingSchema.optional(),
|
|
30
30
|
backgroundColor: z.string().optional(),
|
|
31
|
+
backgroundImage: backgroundImageSchema.optional(),
|
|
31
32
|
border: borderStyleSchema.optional(),
|
|
32
33
|
borderRadius: z.number().optional(),
|
|
34
|
+
opacity: z.number().min(0).max(1).optional(),
|
|
33
35
|
});
|
|
34
36
|
// ===== Node Schemas =====
|
|
35
37
|
export const inputTextNodeSchema = inputBaseNodeSchema.extend({
|
|
@@ -58,6 +60,7 @@ export const inputImageNodeSchema = inputBaseNodeSchema.extend({
|
|
|
58
60
|
type: z.literal("image"),
|
|
59
61
|
src: z.string(),
|
|
60
62
|
sizing: inputImageSizingSchema.optional(),
|
|
63
|
+
shadow: shadowStyleSchema.optional(),
|
|
61
64
|
});
|
|
62
65
|
export const inputTableNodeSchema = inputBaseNodeSchema.extend({
|
|
63
66
|
type: z.literal("table"),
|
|
@@ -159,6 +162,7 @@ export const inputLineNodeSchema = inputBaseNodeSchema.extend({
|
|
|
159
162
|
const inputBoxNodeSchemaBase = inputBaseNodeSchema.extend({
|
|
160
163
|
type: z.literal("box"),
|
|
161
164
|
children: z.lazy(() => inputPomNodeSchema),
|
|
165
|
+
shadow: shadowStyleSchema.optional(),
|
|
162
166
|
});
|
|
163
167
|
const inputVStackNodeSchemaBase = inputBaseNodeSchema.extend({
|
|
164
168
|
type: z.literal("vstack"),
|
|
@@ -283,6 +287,7 @@ export const inputSlideMasterBackgroundSchema = z.union([
|
|
|
283
287
|
z.object({ color: z.string() }),
|
|
284
288
|
z.object({ path: z.string() }),
|
|
285
289
|
z.object({ data: z.string() }),
|
|
290
|
+
z.object({ image: z.string() }),
|
|
286
291
|
]);
|
|
287
292
|
export const inputSlideMasterMarginSchema = z.union([
|
|
288
293
|
z.number(),
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { POMNode } from "./types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* XML 文字列を POMNode 配列に変換する。
|
|
4
|
+
*
|
|
5
|
+
* XML タグは POM ノードタイプにマッピングされ、属性値は Zod スキーマを参照して
|
|
6
|
+
* 適切な型(number, boolean, array, object)に変換される。
|
|
7
|
+
* 組み込みノード以外のタグ名はカスタムコンポーネントとして扱われる。
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { parseXml, buildPptx } from "@hirokisakabe/pom";
|
|
12
|
+
*
|
|
13
|
+
* const xml = `
|
|
14
|
+
* <VStack gap="16" padding="32">
|
|
15
|
+
* <Text fontPx="32" bold="true">売上レポート</Text>
|
|
16
|
+
* </VStack>
|
|
17
|
+
* `;
|
|
18
|
+
*
|
|
19
|
+
* const nodes = parseXml(xml);
|
|
20
|
+
* const pptx = await buildPptx(nodes, { w: 1280, h: 720 });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseXml(xmlString: string): POMNode[];
|
|
24
|
+
//# sourceMappingURL=parseXml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseXml.d.ts","sourceRoot":"","sources":["../src/parseXml.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAoX1C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,CAuBrD"}
|