document-content-model 1.2.1 → 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/dist/index.cjs +44 -0
- package/dist/index.d.cts +713 -1
- package/dist/index.d.ts +713 -1
- package/dist/index.js +40 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -461,6 +461,36 @@ const LayoutEllipseSchema = z.object({
|
|
|
461
461
|
}).optional(),
|
|
462
462
|
sourcePath: z.string().optional()
|
|
463
463
|
});
|
|
464
|
+
const LayoutPathSegmentSchema = z.discriminatedUnion("kind", [z.object({
|
|
465
|
+
kind: z.literal("line"),
|
|
466
|
+
xPt: z.number(),
|
|
467
|
+
yPt: z.number()
|
|
468
|
+
}), z.object({
|
|
469
|
+
kind: z.literal("cubic"),
|
|
470
|
+
c1xPt: z.number(),
|
|
471
|
+
c1yPt: z.number(),
|
|
472
|
+
c2xPt: z.number(),
|
|
473
|
+
c2yPt: z.number(),
|
|
474
|
+
xPt: z.number(),
|
|
475
|
+
yPt: z.number()
|
|
476
|
+
})]);
|
|
477
|
+
const LayoutSubpathSchema = z.object({
|
|
478
|
+
startXPt: z.number(),
|
|
479
|
+
startYPt: z.number(),
|
|
480
|
+
segments: z.array(LayoutPathSegmentSchema),
|
|
481
|
+
closed: z.boolean()
|
|
482
|
+
});
|
|
483
|
+
const LayoutPathSchema = z.object({
|
|
484
|
+
kind: z.literal("path"),
|
|
485
|
+
subpaths: z.array(LayoutSubpathSchema),
|
|
486
|
+
fill: ColorSchema.optional(),
|
|
487
|
+
fillRule: z.enum(["nonzero", "evenodd"]).optional(),
|
|
488
|
+
stroke: z.object({
|
|
489
|
+
color: ColorSchema,
|
|
490
|
+
widthPt: z.number().positive()
|
|
491
|
+
}).optional(),
|
|
492
|
+
sourcePath: z.string().optional()
|
|
493
|
+
});
|
|
464
494
|
const LayoutLinkSchema = z.object({
|
|
465
495
|
kind: z.literal("link"),
|
|
466
496
|
uri: z.string(),
|
|
@@ -476,6 +506,7 @@ const LayoutItemSchema = z.discriminatedUnion("kind", [
|
|
|
476
506
|
LayoutRectSchema,
|
|
477
507
|
LayoutLineSchema,
|
|
478
508
|
LayoutEllipseSchema,
|
|
509
|
+
LayoutPathSchema,
|
|
479
510
|
LayoutLinkSchema
|
|
480
511
|
]);
|
|
481
512
|
const LayoutPageSchema = z.object({
|
|
@@ -497,4 +528,12 @@ const LayoutDocumentSchema = z.object({
|
|
|
497
528
|
images: z.record(z.string(), LayoutImageAssetSchema)
|
|
498
529
|
});
|
|
499
530
|
//#endregion
|
|
500
|
-
|
|
531
|
+
//#region src/package.ts
|
|
532
|
+
const DOCUMENT_PACKAGE_FORMAT_VERSION = 1;
|
|
533
|
+
const DocumentPackageSchema = z.object({
|
|
534
|
+
formatVersion: z.literal(1),
|
|
535
|
+
content: ContentDocumentSchema,
|
|
536
|
+
layout: LayoutDocumentSchema.optional()
|
|
537
|
+
});
|
|
538
|
+
//#endregion
|
|
539
|
+
export { AlignmentSchema, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, ColorSchema, 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, DEFAULT_LAYOUT_FONT, DOCUMENT_PACKAGE_FORMAT_VERSION, DocumentPackageSchema, LAYOUT_FORMAT_VERSION, LayoutDocumentSchema, LayoutEllipseSchema, LayoutFontSchema, LayoutImageAssetSchema, LayoutImageSchema, LayoutItemSchema, LayoutLineSchema, LayoutLinkSchema, LayoutMetadataSchema, LayoutPageSchema, LayoutPathSchema, LayoutPathSegmentSchema, LayoutRectSchema, LayoutSubpathSchema, LayoutTextSchema, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, colorToRgbHex, isContentBlock, rgbHexToColor };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-content-model",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "The canonical, format-agnostic content and layout schemas shared by ooxml.js, odf.js, and documents.js -- pure Zod schemas, no behaviour.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|