@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/dist/inputSchema.d.ts
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Input schemas for LLM/external input validation
|
|
2
|
+
* Input schemas for LLM/external input validation (internal module)
|
|
3
3
|
*
|
|
4
4
|
* These schemas do not include internal properties like `yogaNode`.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { inputPomNodeSchema, InputPOMNode } from "@hirokisakabe/pom";
|
|
10
|
-
*
|
|
11
|
-
* // Validate and parse JSON from LLM
|
|
12
|
-
* const json = JSON.parse(llmResponse);
|
|
13
|
-
* const result = inputPomNodeSchema.safeParse(json);
|
|
14
|
-
* if (result.success) {
|
|
15
|
-
* const pptx = await buildPptx([result.data], { w: 1280, h: 720 });
|
|
16
|
-
* }
|
|
17
|
-
* ```
|
|
5
|
+
* Used by `parseXml` to validate parsed XML input.
|
|
18
6
|
*/
|
|
19
7
|
import { z } from "zod";
|
|
20
|
-
import { type
|
|
8
|
+
import { type TreeDataItem } from "./types.ts";
|
|
21
9
|
export declare const inputBaseNodeSchema: z.ZodObject<{
|
|
22
10
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
23
11
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
@@ -56,7 +44,6 @@ export declare const inputBaseNodeSchema: z.ZodObject<{
|
|
|
56
44
|
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
57
45
|
opacity: z.ZodOptional<z.ZodNumber>;
|
|
58
46
|
}, z.core.$strip>;
|
|
59
|
-
type InputBaseNode = z.infer<typeof inputBaseNodeSchema>;
|
|
60
47
|
export declare const inputTextNodeSchema: z.ZodObject<{
|
|
61
48
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
62
49
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
@@ -156,17 +143,6 @@ export declare const inputTextNodeSchema: z.ZodObject<{
|
|
|
156
143
|
numberStartAt: z.ZodOptional<z.ZodNumber>;
|
|
157
144
|
}, z.core.$strip>]>>;
|
|
158
145
|
}, z.core.$strip>;
|
|
159
|
-
export declare const inputImageSizingSchema: z.ZodObject<{
|
|
160
|
-
type: z.ZodEnum<{
|
|
161
|
-
cover: "cover";
|
|
162
|
-
contain: "contain";
|
|
163
|
-
crop: "crop";
|
|
164
|
-
}>;
|
|
165
|
-
w: z.ZodOptional<z.ZodNumber>;
|
|
166
|
-
h: z.ZodOptional<z.ZodNumber>;
|
|
167
|
-
x: z.ZodOptional<z.ZodNumber>;
|
|
168
|
-
y: z.ZodOptional<z.ZodNumber>;
|
|
169
|
-
}, z.core.$strip>;
|
|
170
146
|
export declare const inputImageNodeSchema: z.ZodObject<{
|
|
171
147
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
172
148
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
@@ -755,7 +731,6 @@ export declare const inputMatrixNodeSchema: z.ZodObject<{
|
|
|
755
731
|
color: z.ZodOptional<z.ZodString>;
|
|
756
732
|
}, z.core.$strip>>;
|
|
757
733
|
}, z.core.$strip>;
|
|
758
|
-
export declare const inputTreeDataItemSchema: z.ZodType<TreeDataItem>;
|
|
759
734
|
export declare const inputTreeNodeSchema: z.ZodObject<{
|
|
760
735
|
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
761
736
|
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
@@ -1050,414 +1025,4 @@ export declare const inputLineNodeSchema: z.ZodObject<{
|
|
|
1050
1025
|
}>>;
|
|
1051
1026
|
}, z.core.$strip>]>>;
|
|
1052
1027
|
}, z.core.$strip>;
|
|
1053
|
-
export type InputTextNode = z.infer<typeof inputTextNodeSchema>;
|
|
1054
|
-
export type InputImageNode = z.infer<typeof inputImageNodeSchema>;
|
|
1055
|
-
export type InputTableNode = z.infer<typeof inputTableNodeSchema>;
|
|
1056
|
-
export type InputShapeNode = z.infer<typeof inputShapeNodeSchema>;
|
|
1057
|
-
export type InputChartNode = z.infer<typeof inputChartNodeSchema>;
|
|
1058
|
-
export type InputTimelineNode = z.infer<typeof inputTimelineNodeSchema>;
|
|
1059
|
-
export type InputMatrixNode = z.infer<typeof inputMatrixNodeSchema>;
|
|
1060
|
-
export type InputTreeNode = z.infer<typeof inputTreeNodeSchema>;
|
|
1061
|
-
export type InputFlowNode = z.infer<typeof inputFlowNodeSchema>;
|
|
1062
|
-
export type InputProcessArrowNode = z.infer<typeof inputProcessArrowNodeSchema>;
|
|
1063
|
-
export type InputLineNode = z.infer<typeof inputLineNodeSchema>;
|
|
1064
|
-
export type InputBoxNode = InputBaseNode & {
|
|
1065
|
-
type: "box";
|
|
1066
|
-
children: InputPOMNode;
|
|
1067
|
-
shadow?: ShadowStyle;
|
|
1068
|
-
};
|
|
1069
|
-
export type InputVStackNode = InputBaseNode & {
|
|
1070
|
-
type: "vstack";
|
|
1071
|
-
children: InputPOMNode[];
|
|
1072
|
-
gap?: number;
|
|
1073
|
-
alignItems?: AlignItems;
|
|
1074
|
-
justifyContent?: JustifyContent;
|
|
1075
|
-
};
|
|
1076
|
-
export type InputHStackNode = InputBaseNode & {
|
|
1077
|
-
type: "hstack";
|
|
1078
|
-
children: InputPOMNode[];
|
|
1079
|
-
gap?: number;
|
|
1080
|
-
alignItems?: AlignItems;
|
|
1081
|
-
justifyContent?: JustifyContent;
|
|
1082
|
-
};
|
|
1083
|
-
export type InputLayerChild = InputPOMNode & {
|
|
1084
|
-
x: number;
|
|
1085
|
-
y: number;
|
|
1086
|
-
};
|
|
1087
|
-
export type InputLayerNode = InputBaseNode & {
|
|
1088
|
-
type: "layer";
|
|
1089
|
-
children: InputLayerChild[];
|
|
1090
|
-
};
|
|
1091
|
-
export type InputPOMNode = InputTextNode | InputImageNode | InputTableNode | InputBoxNode | InputVStackNode | InputHStackNode | InputShapeNode | InputChartNode | InputTimelineNode | InputMatrixNode | InputTreeNode | InputFlowNode | InputProcessArrowNode | InputLineNode | InputLayerNode;
|
|
1092
|
-
export declare const inputBoxNodeSchema: z.ZodType<InputBoxNode>;
|
|
1093
|
-
export declare const inputVStackNodeSchema: z.ZodType<InputVStackNode>;
|
|
1094
|
-
export declare const inputHStackNodeSchema: z.ZodType<InputHStackNode>;
|
|
1095
|
-
export declare const inputLayerNodeSchema: z.ZodType<InputLayerNode>;
|
|
1096
|
-
/**
|
|
1097
|
-
* Input schema for POM nodes (for LLM/external input validation)
|
|
1098
|
-
*
|
|
1099
|
-
* @example
|
|
1100
|
-
* ```typescript
|
|
1101
|
-
* import { inputPomNodeSchema, buildPptx } from "@hirokisakabe/pom";
|
|
1102
|
-
*
|
|
1103
|
-
* const json = JSON.parse(llmResponse);
|
|
1104
|
-
* const result = inputPomNodeSchema.safeParse(json);
|
|
1105
|
-
*
|
|
1106
|
-
* if (result.success) {
|
|
1107
|
-
* const pptx = await buildPptx([result.data], { w: 1280, h: 720 });
|
|
1108
|
-
* await pptx.writeFile({ fileName: "output.pptx" });
|
|
1109
|
-
* } else {
|
|
1110
|
-
* console.error("Validation failed:", result.error);
|
|
1111
|
-
* }
|
|
1112
|
-
* ```
|
|
1113
|
-
*/
|
|
1114
|
-
export declare const inputPomNodeSchema: z.ZodType<InputPOMNode>;
|
|
1115
|
-
export declare const inputMasterTextObjectSchema: z.ZodObject<{
|
|
1116
|
-
type: z.ZodLiteral<"text">;
|
|
1117
|
-
text: z.ZodString;
|
|
1118
|
-
x: z.ZodNumber;
|
|
1119
|
-
y: z.ZodNumber;
|
|
1120
|
-
w: z.ZodNumber;
|
|
1121
|
-
h: z.ZodNumber;
|
|
1122
|
-
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
1123
|
-
fontFamily: z.ZodOptional<z.ZodString>;
|
|
1124
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1125
|
-
bold: z.ZodOptional<z.ZodBoolean>;
|
|
1126
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
1127
|
-
underline: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
1128
|
-
style: z.ZodOptional<z.ZodEnum<{
|
|
1129
|
-
dash: "dash";
|
|
1130
|
-
dashHeavy: "dashHeavy";
|
|
1131
|
-
dashLong: "dashLong";
|
|
1132
|
-
dashLongHeavy: "dashLongHeavy";
|
|
1133
|
-
dbl: "dbl";
|
|
1134
|
-
dotDash: "dotDash";
|
|
1135
|
-
dotDotDash: "dotDotDash";
|
|
1136
|
-
dotted: "dotted";
|
|
1137
|
-
dottedHeavy: "dottedHeavy";
|
|
1138
|
-
heavy: "heavy";
|
|
1139
|
-
none: "none";
|
|
1140
|
-
sng: "sng";
|
|
1141
|
-
wavy: "wavy";
|
|
1142
|
-
wavyDbl: "wavyDbl";
|
|
1143
|
-
wavyHeavy: "wavyHeavy";
|
|
1144
|
-
}>>;
|
|
1145
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1146
|
-
}, z.core.$strip>]>>;
|
|
1147
|
-
strike: z.ZodOptional<z.ZodBoolean>;
|
|
1148
|
-
highlight: z.ZodOptional<z.ZodString>;
|
|
1149
|
-
alignText: z.ZodOptional<z.ZodEnum<{
|
|
1150
|
-
right: "right";
|
|
1151
|
-
left: "left";
|
|
1152
|
-
center: "center";
|
|
1153
|
-
}>>;
|
|
1154
|
-
}, z.core.$strip>;
|
|
1155
|
-
export declare const inputMasterImageObjectSchema: z.ZodObject<{
|
|
1156
|
-
type: z.ZodLiteral<"image">;
|
|
1157
|
-
src: z.ZodString;
|
|
1158
|
-
x: z.ZodNumber;
|
|
1159
|
-
y: z.ZodNumber;
|
|
1160
|
-
w: z.ZodNumber;
|
|
1161
|
-
h: z.ZodNumber;
|
|
1162
|
-
}, z.core.$strip>;
|
|
1163
|
-
export declare const inputMasterRectObjectSchema: z.ZodObject<{
|
|
1164
|
-
type: z.ZodLiteral<"rect">;
|
|
1165
|
-
x: z.ZodNumber;
|
|
1166
|
-
y: z.ZodNumber;
|
|
1167
|
-
w: z.ZodNumber;
|
|
1168
|
-
h: z.ZodNumber;
|
|
1169
|
-
fill: z.ZodOptional<z.ZodObject<{
|
|
1170
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1171
|
-
transparency: z.ZodOptional<z.ZodNumber>;
|
|
1172
|
-
}, z.core.$strip>>;
|
|
1173
|
-
border: z.ZodOptional<z.ZodObject<{
|
|
1174
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1175
|
-
width: z.ZodOptional<z.ZodNumber>;
|
|
1176
|
-
dashType: z.ZodOptional<z.ZodEnum<{
|
|
1177
|
-
solid: "solid";
|
|
1178
|
-
dash: "dash";
|
|
1179
|
-
dashDot: "dashDot";
|
|
1180
|
-
lgDash: "lgDash";
|
|
1181
|
-
lgDashDot: "lgDashDot";
|
|
1182
|
-
lgDashDotDot: "lgDashDotDot";
|
|
1183
|
-
sysDash: "sysDash";
|
|
1184
|
-
sysDot: "sysDot";
|
|
1185
|
-
}>>;
|
|
1186
|
-
}, z.core.$strip>>;
|
|
1187
|
-
}, z.core.$strip>;
|
|
1188
|
-
export declare const inputMasterLineObjectSchema: z.ZodObject<{
|
|
1189
|
-
type: z.ZodLiteral<"line">;
|
|
1190
|
-
x: z.ZodNumber;
|
|
1191
|
-
y: z.ZodNumber;
|
|
1192
|
-
w: z.ZodNumber;
|
|
1193
|
-
h: z.ZodNumber;
|
|
1194
|
-
line: z.ZodOptional<z.ZodObject<{
|
|
1195
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1196
|
-
width: z.ZodOptional<z.ZodNumber>;
|
|
1197
|
-
dashType: z.ZodOptional<z.ZodEnum<{
|
|
1198
|
-
solid: "solid";
|
|
1199
|
-
dash: "dash";
|
|
1200
|
-
dashDot: "dashDot";
|
|
1201
|
-
lgDash: "lgDash";
|
|
1202
|
-
lgDashDot: "lgDashDot";
|
|
1203
|
-
lgDashDotDot: "lgDashDotDot";
|
|
1204
|
-
sysDash: "sysDash";
|
|
1205
|
-
sysDot: "sysDot";
|
|
1206
|
-
}>>;
|
|
1207
|
-
}, z.core.$strip>>;
|
|
1208
|
-
}, z.core.$strip>;
|
|
1209
|
-
export declare const inputMasterObjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1210
|
-
type: z.ZodLiteral<"text">;
|
|
1211
|
-
text: z.ZodString;
|
|
1212
|
-
x: z.ZodNumber;
|
|
1213
|
-
y: z.ZodNumber;
|
|
1214
|
-
w: z.ZodNumber;
|
|
1215
|
-
h: z.ZodNumber;
|
|
1216
|
-
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
1217
|
-
fontFamily: z.ZodOptional<z.ZodString>;
|
|
1218
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1219
|
-
bold: z.ZodOptional<z.ZodBoolean>;
|
|
1220
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
1221
|
-
underline: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
1222
|
-
style: z.ZodOptional<z.ZodEnum<{
|
|
1223
|
-
dash: "dash";
|
|
1224
|
-
dashHeavy: "dashHeavy";
|
|
1225
|
-
dashLong: "dashLong";
|
|
1226
|
-
dashLongHeavy: "dashLongHeavy";
|
|
1227
|
-
dbl: "dbl";
|
|
1228
|
-
dotDash: "dotDash";
|
|
1229
|
-
dotDotDash: "dotDotDash";
|
|
1230
|
-
dotted: "dotted";
|
|
1231
|
-
dottedHeavy: "dottedHeavy";
|
|
1232
|
-
heavy: "heavy";
|
|
1233
|
-
none: "none";
|
|
1234
|
-
sng: "sng";
|
|
1235
|
-
wavy: "wavy";
|
|
1236
|
-
wavyDbl: "wavyDbl";
|
|
1237
|
-
wavyHeavy: "wavyHeavy";
|
|
1238
|
-
}>>;
|
|
1239
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1240
|
-
}, z.core.$strip>]>>;
|
|
1241
|
-
strike: z.ZodOptional<z.ZodBoolean>;
|
|
1242
|
-
highlight: z.ZodOptional<z.ZodString>;
|
|
1243
|
-
alignText: z.ZodOptional<z.ZodEnum<{
|
|
1244
|
-
right: "right";
|
|
1245
|
-
left: "left";
|
|
1246
|
-
center: "center";
|
|
1247
|
-
}>>;
|
|
1248
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1249
|
-
type: z.ZodLiteral<"image">;
|
|
1250
|
-
src: z.ZodString;
|
|
1251
|
-
x: z.ZodNumber;
|
|
1252
|
-
y: z.ZodNumber;
|
|
1253
|
-
w: z.ZodNumber;
|
|
1254
|
-
h: z.ZodNumber;
|
|
1255
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1256
|
-
type: z.ZodLiteral<"rect">;
|
|
1257
|
-
x: z.ZodNumber;
|
|
1258
|
-
y: z.ZodNumber;
|
|
1259
|
-
w: z.ZodNumber;
|
|
1260
|
-
h: z.ZodNumber;
|
|
1261
|
-
fill: z.ZodOptional<z.ZodObject<{
|
|
1262
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1263
|
-
transparency: z.ZodOptional<z.ZodNumber>;
|
|
1264
|
-
}, z.core.$strip>>;
|
|
1265
|
-
border: z.ZodOptional<z.ZodObject<{
|
|
1266
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1267
|
-
width: z.ZodOptional<z.ZodNumber>;
|
|
1268
|
-
dashType: z.ZodOptional<z.ZodEnum<{
|
|
1269
|
-
solid: "solid";
|
|
1270
|
-
dash: "dash";
|
|
1271
|
-
dashDot: "dashDot";
|
|
1272
|
-
lgDash: "lgDash";
|
|
1273
|
-
lgDashDot: "lgDashDot";
|
|
1274
|
-
lgDashDotDot: "lgDashDotDot";
|
|
1275
|
-
sysDash: "sysDash";
|
|
1276
|
-
sysDot: "sysDot";
|
|
1277
|
-
}>>;
|
|
1278
|
-
}, z.core.$strip>>;
|
|
1279
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1280
|
-
type: z.ZodLiteral<"line">;
|
|
1281
|
-
x: z.ZodNumber;
|
|
1282
|
-
y: z.ZodNumber;
|
|
1283
|
-
w: z.ZodNumber;
|
|
1284
|
-
h: z.ZodNumber;
|
|
1285
|
-
line: z.ZodOptional<z.ZodObject<{
|
|
1286
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1287
|
-
width: z.ZodOptional<z.ZodNumber>;
|
|
1288
|
-
dashType: z.ZodOptional<z.ZodEnum<{
|
|
1289
|
-
solid: "solid";
|
|
1290
|
-
dash: "dash";
|
|
1291
|
-
dashDot: "dashDot";
|
|
1292
|
-
lgDash: "lgDash";
|
|
1293
|
-
lgDashDot: "lgDashDot";
|
|
1294
|
-
lgDashDotDot: "lgDashDotDot";
|
|
1295
|
-
sysDash: "sysDash";
|
|
1296
|
-
sysDot: "sysDot";
|
|
1297
|
-
}>>;
|
|
1298
|
-
}, z.core.$strip>>;
|
|
1299
|
-
}, z.core.$strip>], "type">;
|
|
1300
|
-
export declare const inputSlideNumberOptionsSchema: z.ZodObject<{
|
|
1301
|
-
x: z.ZodNumber;
|
|
1302
|
-
y: z.ZodNumber;
|
|
1303
|
-
w: z.ZodOptional<z.ZodNumber>;
|
|
1304
|
-
h: z.ZodOptional<z.ZodNumber>;
|
|
1305
|
-
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
1306
|
-
fontFamily: z.ZodOptional<z.ZodString>;
|
|
1307
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1308
|
-
}, z.core.$strip>;
|
|
1309
|
-
export declare const inputSlideMasterBackgroundSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
1310
|
-
color: z.ZodString;
|
|
1311
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1312
|
-
path: z.ZodString;
|
|
1313
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1314
|
-
data: z.ZodString;
|
|
1315
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1316
|
-
image: z.ZodString;
|
|
1317
|
-
}, z.core.$strip>]>;
|
|
1318
|
-
export declare const inputSlideMasterMarginSchema: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
1319
|
-
top: z.ZodOptional<z.ZodNumber>;
|
|
1320
|
-
right: z.ZodOptional<z.ZodNumber>;
|
|
1321
|
-
bottom: z.ZodOptional<z.ZodNumber>;
|
|
1322
|
-
left: z.ZodOptional<z.ZodNumber>;
|
|
1323
|
-
}, z.core.$strip>]>;
|
|
1324
|
-
/**
|
|
1325
|
-
* Input schema for slide master options (for LLM/external input validation)
|
|
1326
|
-
*
|
|
1327
|
-
* @example
|
|
1328
|
-
* ```typescript
|
|
1329
|
-
* import { inputSlideMasterOptionsSchema, buildPptx } from "@hirokisakabe/pom";
|
|
1330
|
-
*
|
|
1331
|
-
* const masterOptions = inputSlideMasterOptionsSchema.parse({
|
|
1332
|
-
* title: "MY_MASTER",
|
|
1333
|
-
* background: { color: "F0F0F0" },
|
|
1334
|
-
* objects: [
|
|
1335
|
-
* { type: "text", text: "Header", x: 48, y: 12, w: 200, h: 28, fontPx: 14 },
|
|
1336
|
-
* ],
|
|
1337
|
-
* slideNumber: { x: 1100, y: 680, fontPx: 10 },
|
|
1338
|
-
* });
|
|
1339
|
-
*
|
|
1340
|
-
* const pptx = await buildPptx([page], { w: 1280, h: 720 }, { master: masterOptions });
|
|
1341
|
-
* ```
|
|
1342
|
-
*/
|
|
1343
|
-
export declare const inputSlideMasterOptionsSchema: z.ZodObject<{
|
|
1344
|
-
title: z.ZodOptional<z.ZodString>;
|
|
1345
|
-
background: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1346
|
-
color: z.ZodString;
|
|
1347
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1348
|
-
path: z.ZodString;
|
|
1349
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1350
|
-
data: z.ZodString;
|
|
1351
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1352
|
-
image: z.ZodString;
|
|
1353
|
-
}, z.core.$strip>]>>;
|
|
1354
|
-
margin: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
1355
|
-
top: z.ZodOptional<z.ZodNumber>;
|
|
1356
|
-
right: z.ZodOptional<z.ZodNumber>;
|
|
1357
|
-
bottom: z.ZodOptional<z.ZodNumber>;
|
|
1358
|
-
left: z.ZodOptional<z.ZodNumber>;
|
|
1359
|
-
}, z.core.$strip>]>>;
|
|
1360
|
-
objects: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1361
|
-
type: z.ZodLiteral<"text">;
|
|
1362
|
-
text: z.ZodString;
|
|
1363
|
-
x: z.ZodNumber;
|
|
1364
|
-
y: z.ZodNumber;
|
|
1365
|
-
w: z.ZodNumber;
|
|
1366
|
-
h: z.ZodNumber;
|
|
1367
|
-
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
1368
|
-
fontFamily: z.ZodOptional<z.ZodString>;
|
|
1369
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1370
|
-
bold: z.ZodOptional<z.ZodBoolean>;
|
|
1371
|
-
italic: z.ZodOptional<z.ZodBoolean>;
|
|
1372
|
-
underline: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
1373
|
-
style: z.ZodOptional<z.ZodEnum<{
|
|
1374
|
-
dash: "dash";
|
|
1375
|
-
dashHeavy: "dashHeavy";
|
|
1376
|
-
dashLong: "dashLong";
|
|
1377
|
-
dashLongHeavy: "dashLongHeavy";
|
|
1378
|
-
dbl: "dbl";
|
|
1379
|
-
dotDash: "dotDash";
|
|
1380
|
-
dotDotDash: "dotDotDash";
|
|
1381
|
-
dotted: "dotted";
|
|
1382
|
-
dottedHeavy: "dottedHeavy";
|
|
1383
|
-
heavy: "heavy";
|
|
1384
|
-
none: "none";
|
|
1385
|
-
sng: "sng";
|
|
1386
|
-
wavy: "wavy";
|
|
1387
|
-
wavyDbl: "wavyDbl";
|
|
1388
|
-
wavyHeavy: "wavyHeavy";
|
|
1389
|
-
}>>;
|
|
1390
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1391
|
-
}, z.core.$strip>]>>;
|
|
1392
|
-
strike: z.ZodOptional<z.ZodBoolean>;
|
|
1393
|
-
highlight: z.ZodOptional<z.ZodString>;
|
|
1394
|
-
alignText: z.ZodOptional<z.ZodEnum<{
|
|
1395
|
-
right: "right";
|
|
1396
|
-
left: "left";
|
|
1397
|
-
center: "center";
|
|
1398
|
-
}>>;
|
|
1399
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1400
|
-
type: z.ZodLiteral<"image">;
|
|
1401
|
-
src: z.ZodString;
|
|
1402
|
-
x: z.ZodNumber;
|
|
1403
|
-
y: z.ZodNumber;
|
|
1404
|
-
w: z.ZodNumber;
|
|
1405
|
-
h: z.ZodNumber;
|
|
1406
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1407
|
-
type: z.ZodLiteral<"rect">;
|
|
1408
|
-
x: z.ZodNumber;
|
|
1409
|
-
y: z.ZodNumber;
|
|
1410
|
-
w: z.ZodNumber;
|
|
1411
|
-
h: z.ZodNumber;
|
|
1412
|
-
fill: z.ZodOptional<z.ZodObject<{
|
|
1413
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1414
|
-
transparency: z.ZodOptional<z.ZodNumber>;
|
|
1415
|
-
}, z.core.$strip>>;
|
|
1416
|
-
border: z.ZodOptional<z.ZodObject<{
|
|
1417
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1418
|
-
width: z.ZodOptional<z.ZodNumber>;
|
|
1419
|
-
dashType: z.ZodOptional<z.ZodEnum<{
|
|
1420
|
-
solid: "solid";
|
|
1421
|
-
dash: "dash";
|
|
1422
|
-
dashDot: "dashDot";
|
|
1423
|
-
lgDash: "lgDash";
|
|
1424
|
-
lgDashDot: "lgDashDot";
|
|
1425
|
-
lgDashDotDot: "lgDashDotDot";
|
|
1426
|
-
sysDash: "sysDash";
|
|
1427
|
-
sysDot: "sysDot";
|
|
1428
|
-
}>>;
|
|
1429
|
-
}, z.core.$strip>>;
|
|
1430
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1431
|
-
type: z.ZodLiteral<"line">;
|
|
1432
|
-
x: z.ZodNumber;
|
|
1433
|
-
y: z.ZodNumber;
|
|
1434
|
-
w: z.ZodNumber;
|
|
1435
|
-
h: z.ZodNumber;
|
|
1436
|
-
line: z.ZodOptional<z.ZodObject<{
|
|
1437
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1438
|
-
width: z.ZodOptional<z.ZodNumber>;
|
|
1439
|
-
dashType: z.ZodOptional<z.ZodEnum<{
|
|
1440
|
-
solid: "solid";
|
|
1441
|
-
dash: "dash";
|
|
1442
|
-
dashDot: "dashDot";
|
|
1443
|
-
lgDash: "lgDash";
|
|
1444
|
-
lgDashDot: "lgDashDot";
|
|
1445
|
-
lgDashDotDot: "lgDashDotDot";
|
|
1446
|
-
sysDash: "sysDash";
|
|
1447
|
-
sysDot: "sysDot";
|
|
1448
|
-
}>>;
|
|
1449
|
-
}, z.core.$strip>>;
|
|
1450
|
-
}, z.core.$strip>], "type">>>;
|
|
1451
|
-
slideNumber: z.ZodOptional<z.ZodObject<{
|
|
1452
|
-
x: z.ZodNumber;
|
|
1453
|
-
y: z.ZodNumber;
|
|
1454
|
-
w: z.ZodOptional<z.ZodNumber>;
|
|
1455
|
-
h: z.ZodOptional<z.ZodNumber>;
|
|
1456
|
-
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
1457
|
-
fontFamily: z.ZodOptional<z.ZodString>;
|
|
1458
|
-
color: z.ZodOptional<z.ZodString>;
|
|
1459
|
-
}, z.core.$strip>>;
|
|
1460
|
-
}, z.core.$strip>;
|
|
1461
|
-
export type InputSlideMasterOptions = z.infer<typeof inputSlideMasterOptionsSchema>;
|
|
1462
|
-
export {};
|
|
1463
1028
|
//# sourceMappingURL=inputSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../src/inputSchema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../src/inputSchema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAmCL,KAAK,YAAY,EAElB,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAa9B,CAAC;AAKH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAc9B,CAAC;AAUH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAe/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU/B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIlC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKhC,CAAC;AAUH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU9B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAS9B,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAatC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAW9B,CAAC"}
|
package/dist/inputSchema.js
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Input schemas for LLM/external input validation
|
|
2
|
+
* Input schemas for LLM/external input validation (internal module)
|
|
3
3
|
*
|
|
4
4
|
* These schemas do not include internal properties like `yogaNode`.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { inputPomNodeSchema, InputPOMNode } from "@hirokisakabe/pom";
|
|
10
|
-
*
|
|
11
|
-
* // Validate and parse JSON from LLM
|
|
12
|
-
* const json = JSON.parse(llmResponse);
|
|
13
|
-
* const result = inputPomNodeSchema.safeParse(json);
|
|
14
|
-
* if (result.success) {
|
|
15
|
-
* const pptx = await buildPptx([result.data], { w: 1280, h: 720 });
|
|
16
|
-
* }
|
|
17
|
-
* ```
|
|
5
|
+
* Used by `parseXml` to validate parsed XML input.
|
|
18
6
|
*/
|
|
19
7
|
import { z } from "zod";
|
|
20
8
|
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";
|
|
@@ -49,7 +37,7 @@ export const inputTextNodeSchema = inputBaseNodeSchema.extend({
|
|
|
49
37
|
lineSpacingMultiple: z.number().optional(),
|
|
50
38
|
bullet: z.union([z.boolean(), bulletOptionsSchema]).optional(),
|
|
51
39
|
});
|
|
52
|
-
|
|
40
|
+
const inputImageSizingSchema = z.object({
|
|
53
41
|
type: z.enum(["contain", "cover", "crop"]),
|
|
54
42
|
w: z.number().optional(),
|
|
55
43
|
h: z.number().optional(),
|
|
@@ -106,7 +94,7 @@ export const inputMatrixNodeSchema = inputBaseNodeSchema.extend({
|
|
|
106
94
|
quadrants: matrixQuadrantsSchema.optional(),
|
|
107
95
|
items: z.array(matrixItemSchema),
|
|
108
96
|
});
|
|
109
|
-
|
|
97
|
+
const inputTreeDataItemSchema = z.lazy(() => z.object({
|
|
110
98
|
label: z.string(),
|
|
111
99
|
color: z.string().optional(),
|
|
112
100
|
children: z.array(inputTreeDataItemSchema).optional(),
|
|
@@ -186,29 +174,8 @@ const inputLayerNodeSchemaBase = inputBaseNodeSchema.extend({
|
|
|
186
174
|
type: z.literal("layer"),
|
|
187
175
|
children: z.array(inputLayerChildSchemaBase),
|
|
188
176
|
});
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
export const inputHStackNodeSchema = inputHStackNodeSchemaBase;
|
|
192
|
-
export const inputLayerNodeSchema = inputLayerNodeSchemaBase;
|
|
193
|
-
/**
|
|
194
|
-
* Input schema for POM nodes (for LLM/external input validation)
|
|
195
|
-
*
|
|
196
|
-
* @example
|
|
197
|
-
* ```typescript
|
|
198
|
-
* import { inputPomNodeSchema, buildPptx } from "@hirokisakabe/pom";
|
|
199
|
-
*
|
|
200
|
-
* const json = JSON.parse(llmResponse);
|
|
201
|
-
* const result = inputPomNodeSchema.safeParse(json);
|
|
202
|
-
*
|
|
203
|
-
* if (result.success) {
|
|
204
|
-
* const pptx = await buildPptx([result.data], { w: 1280, h: 720 });
|
|
205
|
-
* await pptx.writeFile({ fileName: "output.pptx" });
|
|
206
|
-
* } else {
|
|
207
|
-
* console.error("Validation failed:", result.error);
|
|
208
|
-
* }
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
export const inputPomNodeSchema = z.lazy(() => z.discriminatedUnion("type", [
|
|
177
|
+
/** Input schema for POM nodes (used internally by parseXml) */
|
|
178
|
+
const inputPomNodeSchema = z.lazy(() => z.discriminatedUnion("type", [
|
|
212
179
|
inputTextNodeSchema,
|
|
213
180
|
inputImageNodeSchema,
|
|
214
181
|
inputTableNodeSchema,
|
|
@@ -225,102 +192,3 @@ export const inputPomNodeSchema = z.lazy(() => z.discriminatedUnion("type", [
|
|
|
225
192
|
inputLineNodeSchema,
|
|
226
193
|
inputLayerNodeSchemaBase,
|
|
227
194
|
]));
|
|
228
|
-
// ===== Slide Master Options Schema =====
|
|
229
|
-
export const inputMasterTextObjectSchema = z.object({
|
|
230
|
-
type: z.literal("text"),
|
|
231
|
-
text: z.string(),
|
|
232
|
-
x: z.number(),
|
|
233
|
-
y: z.number(),
|
|
234
|
-
w: z.number(),
|
|
235
|
-
h: z.number(),
|
|
236
|
-
fontPx: z.number().optional(),
|
|
237
|
-
fontFamily: z.string().optional(),
|
|
238
|
-
color: z.string().optional(),
|
|
239
|
-
bold: z.boolean().optional(),
|
|
240
|
-
italic: z.boolean().optional(),
|
|
241
|
-
underline: underlineSchema.optional(),
|
|
242
|
-
strike: z.boolean().optional(),
|
|
243
|
-
highlight: z.string().optional(),
|
|
244
|
-
alignText: z.enum(["left", "center", "right"]).optional(),
|
|
245
|
-
});
|
|
246
|
-
export const inputMasterImageObjectSchema = z.object({
|
|
247
|
-
type: z.literal("image"),
|
|
248
|
-
src: z.string(),
|
|
249
|
-
x: z.number(),
|
|
250
|
-
y: z.number(),
|
|
251
|
-
w: z.number(),
|
|
252
|
-
h: z.number(),
|
|
253
|
-
});
|
|
254
|
-
export const inputMasterRectObjectSchema = z.object({
|
|
255
|
-
type: z.literal("rect"),
|
|
256
|
-
x: z.number(),
|
|
257
|
-
y: z.number(),
|
|
258
|
-
w: z.number(),
|
|
259
|
-
h: z.number(),
|
|
260
|
-
fill: fillStyleSchema.optional(),
|
|
261
|
-
border: borderStyleSchema.optional(),
|
|
262
|
-
});
|
|
263
|
-
export const inputMasterLineObjectSchema = z.object({
|
|
264
|
-
type: z.literal("line"),
|
|
265
|
-
x: z.number(),
|
|
266
|
-
y: z.number(),
|
|
267
|
-
w: z.number(),
|
|
268
|
-
h: z.number(),
|
|
269
|
-
line: borderStyleSchema.optional(),
|
|
270
|
-
});
|
|
271
|
-
export const inputMasterObjectSchema = z.discriminatedUnion("type", [
|
|
272
|
-
inputMasterTextObjectSchema,
|
|
273
|
-
inputMasterImageObjectSchema,
|
|
274
|
-
inputMasterRectObjectSchema,
|
|
275
|
-
inputMasterLineObjectSchema,
|
|
276
|
-
]);
|
|
277
|
-
export const inputSlideNumberOptionsSchema = z.object({
|
|
278
|
-
x: z.number(),
|
|
279
|
-
y: z.number(),
|
|
280
|
-
w: z.number().optional(),
|
|
281
|
-
h: z.number().optional(),
|
|
282
|
-
fontPx: z.number().optional(),
|
|
283
|
-
fontFamily: z.string().optional(),
|
|
284
|
-
color: z.string().optional(),
|
|
285
|
-
});
|
|
286
|
-
export const inputSlideMasterBackgroundSchema = z.union([
|
|
287
|
-
z.object({ color: z.string() }),
|
|
288
|
-
z.object({ path: z.string() }),
|
|
289
|
-
z.object({ data: z.string() }),
|
|
290
|
-
z.object({ image: z.string() }),
|
|
291
|
-
]);
|
|
292
|
-
export const inputSlideMasterMarginSchema = z.union([
|
|
293
|
-
z.number(),
|
|
294
|
-
z.object({
|
|
295
|
-
top: z.number().optional(),
|
|
296
|
-
right: z.number().optional(),
|
|
297
|
-
bottom: z.number().optional(),
|
|
298
|
-
left: z.number().optional(),
|
|
299
|
-
}),
|
|
300
|
-
]);
|
|
301
|
-
/**
|
|
302
|
-
* Input schema for slide master options (for LLM/external input validation)
|
|
303
|
-
*
|
|
304
|
-
* @example
|
|
305
|
-
* ```typescript
|
|
306
|
-
* import { inputSlideMasterOptionsSchema, buildPptx } from "@hirokisakabe/pom";
|
|
307
|
-
*
|
|
308
|
-
* const masterOptions = inputSlideMasterOptionsSchema.parse({
|
|
309
|
-
* title: "MY_MASTER",
|
|
310
|
-
* background: { color: "F0F0F0" },
|
|
311
|
-
* objects: [
|
|
312
|
-
* { type: "text", text: "Header", x: 48, y: 12, w: 200, h: 28, fontPx: 14 },
|
|
313
|
-
* ],
|
|
314
|
-
* slideNumber: { x: 1100, y: 680, fontPx: 10 },
|
|
315
|
-
* });
|
|
316
|
-
*
|
|
317
|
-
* const pptx = await buildPptx([page], { w: 1280, h: 720 }, { master: masterOptions });
|
|
318
|
-
* ```
|
|
319
|
-
*/
|
|
320
|
-
export const inputSlideMasterOptionsSchema = z.object({
|
|
321
|
-
title: z.string().optional(),
|
|
322
|
-
background: inputSlideMasterBackgroundSchema.optional(),
|
|
323
|
-
margin: inputSlideMasterMarginSchema.optional(),
|
|
324
|
-
objects: z.array(inputMasterObjectSchema).optional(),
|
|
325
|
-
slideNumber: inputSlideNumberOptionsSchema.optional(),
|
|
326
|
-
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { POMNode } from "./types.ts";
|
|
2
|
+
export declare class ParseXmlError extends Error {
|
|
3
|
+
readonly errors: string[];
|
|
4
|
+
constructor(errors: string[]);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* XML 文字列を POMNode 配列に変換する。
|
|
8
|
+
*
|
|
9
|
+
* XML タグは POM ノードタイプにマッピングされ、属性値は Zod スキーマを参照して
|
|
10
|
+
* 適切な型(number, boolean, array, object)に変換される。
|
|
11
|
+
* 未知のタグ名が指定された場合はエラーがスローされる。
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { parseXml, buildPptx } from "@hirokisakabe/pom";
|
|
16
|
+
*
|
|
17
|
+
* const xml = `
|
|
18
|
+
* <VStack gap="16" padding="32">
|
|
19
|
+
* <Text fontPx="32" bold="true">売上レポート</Text>
|
|
20
|
+
* </VStack>
|
|
21
|
+
* `;
|
|
22
|
+
*
|
|
23
|
+
* const nodes = parseXml(xml);
|
|
24
|
+
* const pptx = await buildPptx(nodes, { w: 1280, h: 720 });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseXml(xmlString: string): POMNode[];
|
|
28
|
+
//# sourceMappingURL=parseXml.d.ts.map
|