document-schema 3.3.0 → 4.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 +82 -31
- package/dist/codec.d.cts +2 -7
- package/dist/codec.d.ts +2 -7
- package/dist/content-BN0PWqpt.d.cts +2393 -0
- package/dist/content-CiZf6Fqn.d.ts +2393 -0
- package/dist/content-json-schema-defs.cjs +1005 -0
- package/dist/content-json-schema-defs.js +1005 -0
- package/dist/content.cjs +1 -7
- package/dist/content.d.cts +2 -2354
- package/dist/content.d.ts +2 -2354
- package/dist/content.js +1 -7
- package/dist/definitions.cjs +109 -0
- package/dist/definitions.d.cts +115 -0
- package/dist/definitions.d.ts +115 -0
- package/dist/definitions.js +99 -0
- package/dist/index.cjs +42 -18
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +6 -5
- package/dist/package-node-DDPSNOvy.d.cts +441 -0
- package/dist/package-node-QVFHQcm8.d.ts +441 -0
- package/dist/package-node.cjs +120 -0
- package/dist/package-node.d.cts +2 -0
- package/dist/package-node.d.ts +2 -0
- package/dist/package-node.js +93 -0
- package/dist/package.cjs +37 -7
- package/dist/package.d.cts +452 -755
- package/dist/package.d.ts +452 -755
- package/dist/package.js +39 -8
- package/dist/schema-io.cjs +55 -25
- package/dist/schema-io.d.cts +13 -11
- package/dist/schema-io.d.ts +13 -11
- package/dist/schema-io.js +54 -25
- package/package.json +2 -2
- package/schemas/content-document.schema.json +1476 -68
- package/schemas/document-package.schema.json +3056 -30
- package/dist/layout.cjs +0 -150
- package/dist/layout.d.cts +0 -684
- package/dist/layout.d.ts +0 -684
- package/dist/layout.js +0 -136
- package/schemas/layout-document.schema.json +0 -760
package/dist/layout.cjs
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_color = require("./color.cjs");
|
|
3
|
-
const require_metadata = require("./metadata.cjs");
|
|
4
|
-
const require_style = require("./style.cjs");
|
|
5
|
-
const require_content = require("./content.cjs");
|
|
6
|
-
let zod = require("zod");
|
|
7
|
-
//#region src/layout.ts
|
|
8
|
-
const LAYOUT_FORMAT_VERSION = 1;
|
|
9
|
-
const LayoutTextSchema = zod.z.object({
|
|
10
|
-
kind: zod.z.literal("text"),
|
|
11
|
-
text: zod.z.string(),
|
|
12
|
-
xPt: zod.z.number(),
|
|
13
|
-
yPt: zod.z.number(),
|
|
14
|
-
font: require_style.LayoutFontSchema,
|
|
15
|
-
sizePt: zod.z.number().positive(),
|
|
16
|
-
color: require_color.ColorSchema,
|
|
17
|
-
widthPt: zod.z.number().nonnegative().optional(),
|
|
18
|
-
rotationDeg: zod.z.number().optional(),
|
|
19
|
-
underline: zod.z.boolean().optional(),
|
|
20
|
-
sourcePath: zod.z.string().optional()
|
|
21
|
-
});
|
|
22
|
-
const LayoutImageSchema = zod.z.object({
|
|
23
|
-
kind: zod.z.literal("image"),
|
|
24
|
-
imageId: zod.z.string(),
|
|
25
|
-
xPt: zod.z.number(),
|
|
26
|
-
yPt: zod.z.number(),
|
|
27
|
-
widthPt: zod.z.number().positive(),
|
|
28
|
-
heightPt: zod.z.number().positive(),
|
|
29
|
-
rotationDeg: zod.z.number().optional(),
|
|
30
|
-
sourcePath: zod.z.string().optional()
|
|
31
|
-
});
|
|
32
|
-
const LayoutRectSchema = zod.z.object({
|
|
33
|
-
kind: zod.z.literal("rect"),
|
|
34
|
-
xPt: zod.z.number(),
|
|
35
|
-
yPt: zod.z.number(),
|
|
36
|
-
widthPt: zod.z.number().nonnegative(),
|
|
37
|
-
heightPt: zod.z.number().nonnegative(),
|
|
38
|
-
fill: require_color.ColorSchema.optional(),
|
|
39
|
-
stroke: zod.z.object({
|
|
40
|
-
color: require_color.ColorSchema,
|
|
41
|
-
widthPt: zod.z.number().positive()
|
|
42
|
-
}).optional(),
|
|
43
|
-
sourcePath: zod.z.string().optional()
|
|
44
|
-
});
|
|
45
|
-
const LayoutLineSchema = zod.z.object({
|
|
46
|
-
kind: zod.z.literal("line"),
|
|
47
|
-
x1Pt: zod.z.number(),
|
|
48
|
-
y1Pt: zod.z.number(),
|
|
49
|
-
x2Pt: zod.z.number(),
|
|
50
|
-
y2Pt: zod.z.number(),
|
|
51
|
-
color: require_color.ColorSchema,
|
|
52
|
-
widthPt: zod.z.number().positive(),
|
|
53
|
-
style: require_content.ContentStrokeStyleSchema.optional(),
|
|
54
|
-
sourcePath: zod.z.string().optional()
|
|
55
|
-
});
|
|
56
|
-
const LayoutEllipseSchema = zod.z.object({
|
|
57
|
-
kind: zod.z.literal("ellipse"),
|
|
58
|
-
xPt: zod.z.number(),
|
|
59
|
-
yPt: zod.z.number(),
|
|
60
|
-
widthPt: zod.z.number().positive(),
|
|
61
|
-
heightPt: zod.z.number().positive(),
|
|
62
|
-
fill: require_color.ColorSchema.optional(),
|
|
63
|
-
stroke: zod.z.object({
|
|
64
|
-
color: require_color.ColorSchema,
|
|
65
|
-
widthPt: zod.z.number().positive()
|
|
66
|
-
}).optional(),
|
|
67
|
-
sourcePath: zod.z.string().optional()
|
|
68
|
-
});
|
|
69
|
-
const LayoutPathSegmentSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
|
|
70
|
-
kind: zod.z.literal("line"),
|
|
71
|
-
xPt: zod.z.number(),
|
|
72
|
-
yPt: zod.z.number()
|
|
73
|
-
}), zod.z.object({
|
|
74
|
-
kind: zod.z.literal("cubic"),
|
|
75
|
-
c1xPt: zod.z.number(),
|
|
76
|
-
c1yPt: zod.z.number(),
|
|
77
|
-
c2xPt: zod.z.number(),
|
|
78
|
-
c2yPt: zod.z.number(),
|
|
79
|
-
xPt: zod.z.number(),
|
|
80
|
-
yPt: zod.z.number()
|
|
81
|
-
})]);
|
|
82
|
-
const LayoutSubpathSchema = zod.z.object({
|
|
83
|
-
startXPt: zod.z.number(),
|
|
84
|
-
startYPt: zod.z.number(),
|
|
85
|
-
segments: zod.z.array(LayoutPathSegmentSchema),
|
|
86
|
-
closed: zod.z.boolean()
|
|
87
|
-
});
|
|
88
|
-
const LayoutPathSchema = zod.z.object({
|
|
89
|
-
kind: zod.z.literal("path"),
|
|
90
|
-
subpaths: zod.z.array(LayoutSubpathSchema),
|
|
91
|
-
fill: require_color.ColorSchema.optional(),
|
|
92
|
-
fillRule: zod.z.enum(["nonzero", "evenodd"]).optional(),
|
|
93
|
-
stroke: zod.z.object({
|
|
94
|
-
color: require_color.ColorSchema,
|
|
95
|
-
widthPt: zod.z.number().positive()
|
|
96
|
-
}).optional(),
|
|
97
|
-
style: require_content.ContentStrokeStyleSchema.optional(),
|
|
98
|
-
sourcePath: zod.z.string().optional()
|
|
99
|
-
});
|
|
100
|
-
const LayoutLinkSchema = zod.z.object({
|
|
101
|
-
kind: zod.z.literal("link"),
|
|
102
|
-
uri: zod.z.string(),
|
|
103
|
-
xPt: zod.z.number(),
|
|
104
|
-
yPt: zod.z.number(),
|
|
105
|
-
widthPt: zod.z.number().nonnegative(),
|
|
106
|
-
heightPt: zod.z.number().nonnegative(),
|
|
107
|
-
sourcePath: zod.z.string().optional()
|
|
108
|
-
});
|
|
109
|
-
const LayoutItemSchema = zod.z.discriminatedUnion("kind", [
|
|
110
|
-
LayoutTextSchema,
|
|
111
|
-
LayoutImageSchema,
|
|
112
|
-
LayoutRectSchema,
|
|
113
|
-
LayoutLineSchema,
|
|
114
|
-
LayoutEllipseSchema,
|
|
115
|
-
LayoutPathSchema,
|
|
116
|
-
LayoutLinkSchema
|
|
117
|
-
]);
|
|
118
|
-
const LayoutPageSchema = zod.z.object({
|
|
119
|
-
widthPt: zod.z.number().positive(),
|
|
120
|
-
heightPt: zod.z.number().positive(),
|
|
121
|
-
items: zod.z.array(LayoutItemSchema),
|
|
122
|
-
notes: zod.z.string().optional()
|
|
123
|
-
});
|
|
124
|
-
const LayoutImageAssetSchema = zod.z.object({
|
|
125
|
-
format: zod.z.enum(["png", "jpeg"]),
|
|
126
|
-
base64: zod.z.string(),
|
|
127
|
-
widthPx: zod.z.number().int().positive(),
|
|
128
|
-
heightPx: zod.z.number().int().positive()
|
|
129
|
-
});
|
|
130
|
-
const LayoutDocumentSchema = zod.z.object({
|
|
131
|
-
formatVersion: zod.z.literal(1),
|
|
132
|
-
metadata: require_metadata.LayoutMetadataSchema,
|
|
133
|
-
pages: zod.z.array(LayoutPageSchema),
|
|
134
|
-
images: zod.z.record(zod.z.string(), LayoutImageAssetSchema)
|
|
135
|
-
});
|
|
136
|
-
//#endregion
|
|
137
|
-
exports.LAYOUT_FORMAT_VERSION = LAYOUT_FORMAT_VERSION;
|
|
138
|
-
exports.LayoutDocumentSchema = LayoutDocumentSchema;
|
|
139
|
-
exports.LayoutEllipseSchema = LayoutEllipseSchema;
|
|
140
|
-
exports.LayoutImageAssetSchema = LayoutImageAssetSchema;
|
|
141
|
-
exports.LayoutImageSchema = LayoutImageSchema;
|
|
142
|
-
exports.LayoutItemSchema = LayoutItemSchema;
|
|
143
|
-
exports.LayoutLineSchema = LayoutLineSchema;
|
|
144
|
-
exports.LayoutLinkSchema = LayoutLinkSchema;
|
|
145
|
-
exports.LayoutPageSchema = LayoutPageSchema;
|
|
146
|
-
exports.LayoutPathSchema = LayoutPathSchema;
|
|
147
|
-
exports.LayoutPathSegmentSchema = LayoutPathSegmentSchema;
|
|
148
|
-
exports.LayoutRectSchema = LayoutRectSchema;
|
|
149
|
-
exports.LayoutSubpathSchema = LayoutSubpathSchema;
|
|
150
|
-
exports.LayoutTextSchema = LayoutTextSchema;
|