document-model.js 1.9.1 → 1.10.1
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 +11 -0
- package/dist/color-AELCDH_b.d.cts +13 -0
- package/dist/color-AELCDH_b.d.ts +13 -0
- package/dist/color.cjs +40 -0
- package/dist/color.d.cts +2 -0
- package/dist/color.d.ts +2 -0
- package/dist/color.js +36 -0
- package/dist/content.cjs +341 -0
- package/dist/content.d.cts +1188 -0
- package/dist/content.d.ts +1188 -0
- package/dist/content.js +309 -0
- package/dist/geometry-CokwQGtJ.d.cts +27 -0
- package/dist/geometry-CokwQGtJ.d.ts +27 -0
- package/dist/geometry.cjs +43 -0
- package/dist/geometry.d.cts +2 -0
- package/dist/geometry.d.ts +2 -0
- package/dist/geometry.js +36 -0
- package/dist/index.cjs +79 -684
- package/dist/index.d.cts +8 -2448
- package/dist/index.d.ts +8 -2448
- package/dist/index.js +8 -613
- package/dist/layout.cjs +147 -0
- package/dist/layout.d.cts +636 -0
- package/dist/layout.d.ts +636 -0
- package/dist/layout.js +133 -0
- package/dist/metadata.cjs +15 -0
- package/dist/metadata.d.cts +15 -0
- package/dist/metadata.d.ts +15 -0
- package/dist/metadata.js +14 -0
- package/dist/package.cjs +14 -0
- package/dist/package.d.cts +528 -0
- package/dist/package.d.ts +528 -0
- package/dist/package.js +12 -0
- package/dist/schema-io.cjs +87 -0
- package/dist/schema-io.d.cts +37 -0
- package/dist/schema-io.d.ts +37 -0
- package/dist/schema-io.js +79 -0
- package/dist/style.cjs +23 -0
- package/dist/style.d.cts +24 -0
- package/dist/style.d.ts +24 -0
- package/dist/style.js +20 -0
- package/package.json +10 -4
- package/schemas/content-document.schema.json +3 -3
- package/schemas/document-package.schema.json +3 -3
- package/schemas/layout-document.schema.json +1 -1
package/dist/content.js
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { ColorSchema } from "./color.js";
|
|
2
|
+
import { BoxSchema, MarginsSchema, PageSizeSchema } from "./geometry.js";
|
|
3
|
+
import { LayoutMetadataSchema } from "./metadata.js";
|
|
4
|
+
import { AlignmentSchema } from "./style.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
//#region src/content.ts
|
|
7
|
+
const ContentRunSchema = z.object({
|
|
8
|
+
text: z.string(),
|
|
9
|
+
bold: z.boolean().optional(),
|
|
10
|
+
italic: z.boolean().optional(),
|
|
11
|
+
underline: z.boolean().optional(),
|
|
12
|
+
strike: z.boolean().optional(),
|
|
13
|
+
fontFamily: z.string().optional(),
|
|
14
|
+
sizePt: z.number().positive().optional(),
|
|
15
|
+
color: ColorSchema.optional(),
|
|
16
|
+
hyperlink: z.string().optional(),
|
|
17
|
+
sourcePath: z.string().optional()
|
|
18
|
+
});
|
|
19
|
+
const ContentListMembershipSchema = z.object({
|
|
20
|
+
numId: z.string(),
|
|
21
|
+
level: z.number().int().nonnegative()
|
|
22
|
+
});
|
|
23
|
+
const ContentParagraphSchema = z.object({
|
|
24
|
+
kind: z.literal("paragraph"),
|
|
25
|
+
runs: z.array(ContentRunSchema),
|
|
26
|
+
styleId: z.string().optional(),
|
|
27
|
+
alignment: AlignmentSchema.optional(),
|
|
28
|
+
list: ContentListMembershipSchema.optional(),
|
|
29
|
+
spacingBeforePt: z.number().optional(),
|
|
30
|
+
spacingAfterPt: z.number().optional(),
|
|
31
|
+
lineSpacing: z.number().positive().optional(),
|
|
32
|
+
indentLeftPt: z.number().optional(),
|
|
33
|
+
indentFirstLinePt: z.number().optional(),
|
|
34
|
+
sourcePath: z.string().optional()
|
|
35
|
+
});
|
|
36
|
+
const ContentImageBlockSchema = z.object({
|
|
37
|
+
kind: z.literal("image"),
|
|
38
|
+
format: z.enum(["png", "jpeg"]),
|
|
39
|
+
base64: z.string(),
|
|
40
|
+
widthPt: z.number().positive(),
|
|
41
|
+
heightPt: z.number().positive(),
|
|
42
|
+
altText: z.string().optional(),
|
|
43
|
+
sourcePath: z.string().optional()
|
|
44
|
+
});
|
|
45
|
+
const ContentPageBreakSchema = z.object({
|
|
46
|
+
kind: z.literal("pageBreak"),
|
|
47
|
+
sourcePath: z.string().optional()
|
|
48
|
+
});
|
|
49
|
+
function isRecord(value) {
|
|
50
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
51
|
+
}
|
|
52
|
+
function isContentRun(value) {
|
|
53
|
+
return isRecord(value) && typeof value.text === "string";
|
|
54
|
+
}
|
|
55
|
+
function isContentTableCell(value) {
|
|
56
|
+
return isRecord(value) && Array.isArray(value.blocks) && value.blocks.every(isContentBlock);
|
|
57
|
+
}
|
|
58
|
+
function isContentTableRow(value) {
|
|
59
|
+
return isRecord(value) && Array.isArray(value.cells) && value.cells.every(isContentTableCell) && (value.heightPt === void 0 || typeof value.heightPt === "number");
|
|
60
|
+
}
|
|
61
|
+
function isContentEmbeddedObjectKind(value) {
|
|
62
|
+
return value === "formula" || value === "wordprocessing" || value === "presentation" || value === "spreadsheet" || value === "drawing";
|
|
63
|
+
}
|
|
64
|
+
function isContentEmbeddedObject(value) {
|
|
65
|
+
return isRecord(value) && isContentEmbeddedObjectKind(value.objectKind) && BoxSchema.safeParse(value.frame).success && ContentDocumentSchema.safeParse(value.document).success;
|
|
66
|
+
}
|
|
67
|
+
function isContentEmbeddedObjectBlock(value) {
|
|
68
|
+
return isRecord(value) && value.kind === "embeddedObject" && isContentEmbeddedObject(value);
|
|
69
|
+
}
|
|
70
|
+
function isContentBlock(value) {
|
|
71
|
+
if (!isRecord(value)) return false;
|
|
72
|
+
const kind = value.kind;
|
|
73
|
+
if (kind === "paragraph") return Array.isArray(value.runs) && value.runs.every(isContentRun);
|
|
74
|
+
if (kind === "image") return (value.format === "png" || value.format === "jpeg") && typeof value.base64 === "string" && typeof value.widthPt === "number" && typeof value.heightPt === "number";
|
|
75
|
+
if (kind === "pageBreak") return true;
|
|
76
|
+
if (kind === "table") return Array.isArray(value.rows) && value.rows.every(isContentTableRow) && Array.isArray(value.columnWidthsPt) && value.columnWidthsPt.every((w) => typeof w === "number");
|
|
77
|
+
if (kind === "embeddedObject") return isContentEmbeddedObject(value);
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const ContentBlockSchema = z.custom(isContentBlock);
|
|
81
|
+
const ContentEmbeddedObjectSchema = z.custom(isContentEmbeddedObject);
|
|
82
|
+
const ContentEmbeddedObjectBlockSchema = z.custom(isContentEmbeddedObjectBlock);
|
|
83
|
+
const ContentTableCellSchema = z.object({
|
|
84
|
+
blocks: z.array(ContentBlockSchema),
|
|
85
|
+
colSpan: z.number().int().positive().optional(),
|
|
86
|
+
rowSpan: z.number().int().positive().optional(),
|
|
87
|
+
background: ColorSchema.optional()
|
|
88
|
+
});
|
|
89
|
+
const ContentTableRowSchema = z.object({
|
|
90
|
+
cells: z.array(ContentTableCellSchema),
|
|
91
|
+
heightPt: z.number().positive().optional()
|
|
92
|
+
});
|
|
93
|
+
const ContentTableSchema = z.object({
|
|
94
|
+
kind: z.literal("table"),
|
|
95
|
+
rows: z.array(ContentTableRowSchema),
|
|
96
|
+
columnWidthsPt: z.array(z.number().positive()),
|
|
97
|
+
sourcePath: z.string().optional()
|
|
98
|
+
});
|
|
99
|
+
const ContentSectionSchema = z.object({
|
|
100
|
+
pageSize: PageSizeSchema,
|
|
101
|
+
margins: MarginsSchema,
|
|
102
|
+
blocks: z.array(ContentBlockSchema)
|
|
103
|
+
});
|
|
104
|
+
const ContentShapeSchema = z.object({
|
|
105
|
+
name: z.string().optional(),
|
|
106
|
+
frame: BoxSchema,
|
|
107
|
+
rotationDeg: z.number().optional(),
|
|
108
|
+
insetLeftPt: z.number().nonnegative(),
|
|
109
|
+
insetTopPt: z.number().nonnegative(),
|
|
110
|
+
insetRightPt: z.number().nonnegative(),
|
|
111
|
+
insetBottomPt: z.number().nonnegative(),
|
|
112
|
+
fontScale: z.number().positive().optional(),
|
|
113
|
+
lineSpacingReduction: z.number().nonnegative().optional(),
|
|
114
|
+
sourcePath: z.string().optional(),
|
|
115
|
+
blocks: z.array(ContentBlockSchema)
|
|
116
|
+
});
|
|
117
|
+
const ContentSlideSchema = z.object({
|
|
118
|
+
size: PageSizeSchema,
|
|
119
|
+
shapes: z.array(ContentShapeSchema),
|
|
120
|
+
notes: z.string()
|
|
121
|
+
});
|
|
122
|
+
const ContentCellValueSchema = z.discriminatedUnion("kind", [
|
|
123
|
+
z.object({
|
|
124
|
+
kind: z.literal("number"),
|
|
125
|
+
value: z.number()
|
|
126
|
+
}),
|
|
127
|
+
z.object({
|
|
128
|
+
kind: z.literal("percentage"),
|
|
129
|
+
value: z.number()
|
|
130
|
+
}),
|
|
131
|
+
z.object({
|
|
132
|
+
kind: z.literal("currency"),
|
|
133
|
+
value: z.number(),
|
|
134
|
+
currency: z.string().optional()
|
|
135
|
+
}),
|
|
136
|
+
z.object({
|
|
137
|
+
kind: z.literal("boolean"),
|
|
138
|
+
value: z.boolean()
|
|
139
|
+
}),
|
|
140
|
+
z.object({
|
|
141
|
+
kind: z.literal("date"),
|
|
142
|
+
value: z.string()
|
|
143
|
+
}),
|
|
144
|
+
z.object({
|
|
145
|
+
kind: z.literal("time"),
|
|
146
|
+
value: z.string()
|
|
147
|
+
}),
|
|
148
|
+
z.object({
|
|
149
|
+
kind: z.literal("string"),
|
|
150
|
+
value: z.string()
|
|
151
|
+
}),
|
|
152
|
+
z.object({
|
|
153
|
+
kind: z.literal("error"),
|
|
154
|
+
value: z.string()
|
|
155
|
+
}),
|
|
156
|
+
z.object({ kind: z.literal("empty") })
|
|
157
|
+
]);
|
|
158
|
+
const ContentSheetCellSchema = z.object({
|
|
159
|
+
row: z.number().int().nonnegative(),
|
|
160
|
+
column: z.number().int().nonnegative(),
|
|
161
|
+
value: ContentCellValueSchema,
|
|
162
|
+
formula: z.string().optional(),
|
|
163
|
+
displayText: z.string(),
|
|
164
|
+
runs: z.array(ContentRunSchema).optional(),
|
|
165
|
+
colSpan: z.number().int().positive().optional(),
|
|
166
|
+
rowSpan: z.number().int().positive().optional()
|
|
167
|
+
});
|
|
168
|
+
const ContentSheetColumnSchema = z.object({
|
|
169
|
+
index: z.number().int().nonnegative(),
|
|
170
|
+
widthPt: z.number().nonnegative(),
|
|
171
|
+
hidden: z.boolean().optional()
|
|
172
|
+
});
|
|
173
|
+
const ContentSheetRowSchema = z.object({
|
|
174
|
+
index: z.number().int().nonnegative(),
|
|
175
|
+
heightPt: z.number().nonnegative(),
|
|
176
|
+
hidden: z.boolean().optional()
|
|
177
|
+
});
|
|
178
|
+
const ContentSheetPrintRangeSchema = z.object({
|
|
179
|
+
startRow: z.number().int().nonnegative(),
|
|
180
|
+
startColumn: z.number().int().nonnegative(),
|
|
181
|
+
endRow: z.number().int().nonnegative(),
|
|
182
|
+
endColumn: z.number().int().nonnegative()
|
|
183
|
+
});
|
|
184
|
+
const ContentSheetRepeatRangeSchema = z.object({
|
|
185
|
+
start: z.number().int().nonnegative(),
|
|
186
|
+
end: z.number().int().nonnegative()
|
|
187
|
+
});
|
|
188
|
+
const ContentSheetPrintSettingsSchema = z.object({
|
|
189
|
+
pageSize: PageSizeSchema,
|
|
190
|
+
margins: MarginsSchema,
|
|
191
|
+
printRange: ContentSheetPrintRangeSchema.optional(),
|
|
192
|
+
scale: z.number().positive().optional(),
|
|
193
|
+
fitToPages: z.object({
|
|
194
|
+
width: z.number().int().positive(),
|
|
195
|
+
height: z.number().int().positive()
|
|
196
|
+
}).optional(),
|
|
197
|
+
repeatRows: ContentSheetRepeatRangeSchema.optional(),
|
|
198
|
+
repeatColumns: ContentSheetRepeatRangeSchema.optional(),
|
|
199
|
+
gridlines: z.boolean(),
|
|
200
|
+
headers: z.boolean(),
|
|
201
|
+
pageOrder: z.enum(["downThenOver", "overThenDown"]),
|
|
202
|
+
manualBreaks: z.object({
|
|
203
|
+
rows: z.array(z.number().int().nonnegative()),
|
|
204
|
+
columns: z.array(z.number().int().nonnegative())
|
|
205
|
+
}).optional()
|
|
206
|
+
});
|
|
207
|
+
const ContentSheetImageSchema = ContentImageBlockSchema.extend({
|
|
208
|
+
anchorRow: z.number().int().nonnegative(),
|
|
209
|
+
anchorColumn: z.number().int().nonnegative(),
|
|
210
|
+
offsetXPt: z.number(),
|
|
211
|
+
offsetYPt: z.number()
|
|
212
|
+
});
|
|
213
|
+
const ContentSheetSchema = z.object({
|
|
214
|
+
name: z.string(),
|
|
215
|
+
cells: z.array(ContentSheetCellSchema),
|
|
216
|
+
columns: z.array(ContentSheetColumnSchema),
|
|
217
|
+
rows: z.array(ContentSheetRowSchema),
|
|
218
|
+
images: z.array(ContentSheetImageSchema),
|
|
219
|
+
printSettings: ContentSheetPrintSettingsSchema,
|
|
220
|
+
embeddedObjects: z.array(ContentEmbeddedObjectSchema).optional()
|
|
221
|
+
});
|
|
222
|
+
const ContentStrokeSchema = z.object({
|
|
223
|
+
color: ColorSchema,
|
|
224
|
+
widthPt: z.number().positive()
|
|
225
|
+
});
|
|
226
|
+
const ContentPathPointSchema = z.object({
|
|
227
|
+
xPt: z.number(),
|
|
228
|
+
yPt: z.number()
|
|
229
|
+
});
|
|
230
|
+
const ContentPathSegmentSchema = z.discriminatedUnion("kind", [z.object({
|
|
231
|
+
kind: z.literal("line"),
|
|
232
|
+
to: ContentPathPointSchema
|
|
233
|
+
}), z.object({
|
|
234
|
+
kind: z.literal("cubic"),
|
|
235
|
+
control1: ContentPathPointSchema,
|
|
236
|
+
control2: ContentPathPointSchema,
|
|
237
|
+
to: ContentPathPointSchema
|
|
238
|
+
})]);
|
|
239
|
+
const ContentSubpathSchema = z.object({
|
|
240
|
+
start: ContentPathPointSchema,
|
|
241
|
+
segments: z.array(ContentPathSegmentSchema),
|
|
242
|
+
closed: z.boolean()
|
|
243
|
+
});
|
|
244
|
+
const ContentVectorSchema = z.discriminatedUnion("kind", [
|
|
245
|
+
z.object({
|
|
246
|
+
kind: z.literal("rect"),
|
|
247
|
+
frame: BoxSchema,
|
|
248
|
+
fill: ColorSchema.optional(),
|
|
249
|
+
stroke: ContentStrokeSchema.optional(),
|
|
250
|
+
sourcePath: z.string().optional()
|
|
251
|
+
}),
|
|
252
|
+
z.object({
|
|
253
|
+
kind: z.literal("ellipse"),
|
|
254
|
+
frame: BoxSchema,
|
|
255
|
+
fill: ColorSchema.optional(),
|
|
256
|
+
stroke: ContentStrokeSchema.optional(),
|
|
257
|
+
sourcePath: z.string().optional()
|
|
258
|
+
}),
|
|
259
|
+
z.object({
|
|
260
|
+
kind: z.literal("line"),
|
|
261
|
+
from: ContentPathPointSchema,
|
|
262
|
+
to: ContentPathPointSchema,
|
|
263
|
+
stroke: ContentStrokeSchema,
|
|
264
|
+
sourcePath: z.string().optional()
|
|
265
|
+
}),
|
|
266
|
+
z.object({
|
|
267
|
+
kind: z.literal("path"),
|
|
268
|
+
frame: BoxSchema,
|
|
269
|
+
subpaths: z.array(ContentSubpathSchema),
|
|
270
|
+
fill: ColorSchema.optional(),
|
|
271
|
+
fillRule: z.enum(["nonzero", "evenodd"]).optional(),
|
|
272
|
+
stroke: ContentStrokeSchema.optional(),
|
|
273
|
+
sourcePath: z.string().optional()
|
|
274
|
+
})
|
|
275
|
+
]);
|
|
276
|
+
const ContentDrawPageSchema = z.object({
|
|
277
|
+
size: PageSizeSchema,
|
|
278
|
+
shapes: z.array(ContentShapeSchema),
|
|
279
|
+
vectors: z.array(ContentVectorSchema)
|
|
280
|
+
});
|
|
281
|
+
const CONTENT_FORMAT_VERSION = 1;
|
|
282
|
+
const ContentDocumentSchema = z.discriminatedUnion("kind", [
|
|
283
|
+
z.object({
|
|
284
|
+
kind: z.literal("wordprocessing"),
|
|
285
|
+
formatVersion: z.literal(1),
|
|
286
|
+
metadata: LayoutMetadataSchema,
|
|
287
|
+
sections: z.array(ContentSectionSchema)
|
|
288
|
+
}),
|
|
289
|
+
z.object({
|
|
290
|
+
kind: z.literal("presentation"),
|
|
291
|
+
formatVersion: z.literal(1),
|
|
292
|
+
metadata: LayoutMetadataSchema,
|
|
293
|
+
slides: z.array(ContentSlideSchema)
|
|
294
|
+
}),
|
|
295
|
+
z.object({
|
|
296
|
+
kind: z.literal("spreadsheet"),
|
|
297
|
+
formatVersion: z.literal(1),
|
|
298
|
+
metadata: LayoutMetadataSchema,
|
|
299
|
+
sheets: z.array(ContentSheetSchema)
|
|
300
|
+
}),
|
|
301
|
+
z.object({
|
|
302
|
+
kind: z.literal("drawing"),
|
|
303
|
+
formatVersion: z.literal(1),
|
|
304
|
+
metadata: LayoutMetadataSchema,
|
|
305
|
+
pages: z.array(ContentDrawPageSchema)
|
|
306
|
+
})
|
|
307
|
+
]);
|
|
308
|
+
//#endregion
|
|
309
|
+
export { CONTENT_FORMAT_VERSION, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectSchema, ContentImageBlockSchema, ContentListMembershipSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetImageSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, isContentBlock };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/geometry.d.ts
|
|
3
|
+
declare const BoxSchema: z.ZodObject<{
|
|
4
|
+
xPt: z.ZodNumber;
|
|
5
|
+
yPt: z.ZodNumber;
|
|
6
|
+
widthPt: z.ZodNumber;
|
|
7
|
+
heightPt: z.ZodNumber;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
type Box = z.infer<typeof BoxSchema>;
|
|
10
|
+
declare const PageSizeSchema: z.ZodObject<{
|
|
11
|
+
widthPt: z.ZodNumber;
|
|
12
|
+
heightPt: z.ZodNumber;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
type PageSize = z.infer<typeof PageSizeSchema>;
|
|
15
|
+
declare const MarginsSchema: z.ZodObject<{
|
|
16
|
+
topPt: z.ZodNumber;
|
|
17
|
+
rightPt: z.ZodNumber;
|
|
18
|
+
bottomPt: z.ZodNumber;
|
|
19
|
+
leftPt: z.ZodNumber;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
type Margins = z.infer<typeof MarginsSchema>;
|
|
22
|
+
declare const PAGE_SIZE_LETTER: PageSize;
|
|
23
|
+
declare const PAGE_SIZE_A4: PageSize;
|
|
24
|
+
declare const SLIDE_SIZE_WIDESCREEN: PageSize;
|
|
25
|
+
declare const SLIDE_SIZE_STANDARD: PageSize;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { PAGE_SIZE_A4 as a, PageSizeSchema as c, MarginsSchema as i, SLIDE_SIZE_STANDARD as l, BoxSchema as n, PAGE_SIZE_LETTER as o, Margins as r, PageSize as s, Box as t, SLIDE_SIZE_WIDESCREEN as u };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/geometry.d.ts
|
|
3
|
+
declare const BoxSchema: z.ZodObject<{
|
|
4
|
+
xPt: z.ZodNumber;
|
|
5
|
+
yPt: z.ZodNumber;
|
|
6
|
+
widthPt: z.ZodNumber;
|
|
7
|
+
heightPt: z.ZodNumber;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
type Box = z.infer<typeof BoxSchema>;
|
|
10
|
+
declare const PageSizeSchema: z.ZodObject<{
|
|
11
|
+
widthPt: z.ZodNumber;
|
|
12
|
+
heightPt: z.ZodNumber;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
type PageSize = z.infer<typeof PageSizeSchema>;
|
|
15
|
+
declare const MarginsSchema: z.ZodObject<{
|
|
16
|
+
topPt: z.ZodNumber;
|
|
17
|
+
rightPt: z.ZodNumber;
|
|
18
|
+
bottomPt: z.ZodNumber;
|
|
19
|
+
leftPt: z.ZodNumber;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
type Margins = z.infer<typeof MarginsSchema>;
|
|
22
|
+
declare const PAGE_SIZE_LETTER: PageSize;
|
|
23
|
+
declare const PAGE_SIZE_A4: PageSize;
|
|
24
|
+
declare const SLIDE_SIZE_WIDESCREEN: PageSize;
|
|
25
|
+
declare const SLIDE_SIZE_STANDARD: PageSize;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { PAGE_SIZE_A4 as a, PageSizeSchema as c, MarginsSchema as i, SLIDE_SIZE_STANDARD as l, BoxSchema as n, PAGE_SIZE_LETTER as o, Margins as r, PageSize as s, Box as t, SLIDE_SIZE_WIDESCREEN as u };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
//#region src/geometry.ts
|
|
4
|
+
const BoxSchema = zod.z.object({
|
|
5
|
+
xPt: zod.z.number(),
|
|
6
|
+
yPt: zod.z.number(),
|
|
7
|
+
widthPt: zod.z.number().nonnegative(),
|
|
8
|
+
heightPt: zod.z.number().nonnegative()
|
|
9
|
+
});
|
|
10
|
+
const PageSizeSchema = zod.z.object({
|
|
11
|
+
widthPt: zod.z.number().positive(),
|
|
12
|
+
heightPt: zod.z.number().positive()
|
|
13
|
+
});
|
|
14
|
+
const MarginsSchema = zod.z.object({
|
|
15
|
+
topPt: zod.z.number().nonnegative(),
|
|
16
|
+
rightPt: zod.z.number().nonnegative(),
|
|
17
|
+
bottomPt: zod.z.number().nonnegative(),
|
|
18
|
+
leftPt: zod.z.number().nonnegative()
|
|
19
|
+
});
|
|
20
|
+
const PAGE_SIZE_LETTER = {
|
|
21
|
+
widthPt: 612,
|
|
22
|
+
heightPt: 792
|
|
23
|
+
};
|
|
24
|
+
const PAGE_SIZE_A4 = {
|
|
25
|
+
widthPt: 595.28,
|
|
26
|
+
heightPt: 841.89
|
|
27
|
+
};
|
|
28
|
+
const SLIDE_SIZE_WIDESCREEN = {
|
|
29
|
+
widthPt: 960,
|
|
30
|
+
heightPt: 540
|
|
31
|
+
};
|
|
32
|
+
const SLIDE_SIZE_STANDARD = {
|
|
33
|
+
widthPt: 720,
|
|
34
|
+
heightPt: 540
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.BoxSchema = BoxSchema;
|
|
38
|
+
exports.MarginsSchema = MarginsSchema;
|
|
39
|
+
exports.PAGE_SIZE_A4 = PAGE_SIZE_A4;
|
|
40
|
+
exports.PAGE_SIZE_LETTER = PAGE_SIZE_LETTER;
|
|
41
|
+
exports.PageSizeSchema = PageSizeSchema;
|
|
42
|
+
exports.SLIDE_SIZE_STANDARD = SLIDE_SIZE_STANDARD;
|
|
43
|
+
exports.SLIDE_SIZE_WIDESCREEN = SLIDE_SIZE_WIDESCREEN;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as PAGE_SIZE_A4, c as PageSizeSchema, i as MarginsSchema, l as SLIDE_SIZE_STANDARD, n as BoxSchema, o as PAGE_SIZE_LETTER, r as Margins, s as PageSize, t as Box, u as SLIDE_SIZE_WIDESCREEN } from "./geometry-CokwQGtJ.cjs";
|
|
2
|
+
export { Box, BoxSchema, Margins, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as PAGE_SIZE_A4, c as PageSizeSchema, i as MarginsSchema, l as SLIDE_SIZE_STANDARD, n as BoxSchema, o as PAGE_SIZE_LETTER, r as Margins, s as PageSize, t as Box, u as SLIDE_SIZE_WIDESCREEN } from "./geometry-CokwQGtJ.js";
|
|
2
|
+
export { Box, BoxSchema, Margins, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN };
|
package/dist/geometry.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/geometry.ts
|
|
3
|
+
const BoxSchema = z.object({
|
|
4
|
+
xPt: z.number(),
|
|
5
|
+
yPt: z.number(),
|
|
6
|
+
widthPt: z.number().nonnegative(),
|
|
7
|
+
heightPt: z.number().nonnegative()
|
|
8
|
+
});
|
|
9
|
+
const PageSizeSchema = z.object({
|
|
10
|
+
widthPt: z.number().positive(),
|
|
11
|
+
heightPt: z.number().positive()
|
|
12
|
+
});
|
|
13
|
+
const MarginsSchema = z.object({
|
|
14
|
+
topPt: z.number().nonnegative(),
|
|
15
|
+
rightPt: z.number().nonnegative(),
|
|
16
|
+
bottomPt: z.number().nonnegative(),
|
|
17
|
+
leftPt: z.number().nonnegative()
|
|
18
|
+
});
|
|
19
|
+
const PAGE_SIZE_LETTER = {
|
|
20
|
+
widthPt: 612,
|
|
21
|
+
heightPt: 792
|
|
22
|
+
};
|
|
23
|
+
const PAGE_SIZE_A4 = {
|
|
24
|
+
widthPt: 595.28,
|
|
25
|
+
heightPt: 841.89
|
|
26
|
+
};
|
|
27
|
+
const SLIDE_SIZE_WIDESCREEN = {
|
|
28
|
+
widthPt: 960,
|
|
29
|
+
heightPt: 540
|
|
30
|
+
};
|
|
31
|
+
const SLIDE_SIZE_STANDARD = {
|
|
32
|
+
widthPt: 720,
|
|
33
|
+
heightPt: 540
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { BoxSchema, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN };
|