doc-schema.js 3.3.0 → 4.1.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.
Files changed (51) hide show
  1. package/README.md +141 -30
  2. package/dist/codec.d.cts +2 -7
  3. package/dist/codec.d.ts +2 -7
  4. package/dist/construct-0rpAcHRT.d.cts +204 -0
  5. package/dist/construct-0rpAcHRT.d.ts +204 -0
  6. package/dist/construct.cjs +106 -0
  7. package/dist/construct.d.cts +2 -0
  8. package/dist/construct.d.ts +2 -0
  9. package/dist/construct.js +93 -0
  10. package/dist/content-D4gWnk94.d.ts +2393 -0
  11. package/dist/content-eCPtLgjC.d.cts +2393 -0
  12. package/dist/content-json-schema-defs.cjs +1227 -0
  13. package/dist/content-json-schema-defs.js +1227 -0
  14. package/dist/content.cjs +1 -7
  15. package/dist/content.d.cts +2 -2354
  16. package/dist/content.d.ts +2 -2354
  17. package/dist/content.js +1 -7
  18. package/dist/definitions.cjs +109 -0
  19. package/dist/definitions.d.cts +115 -0
  20. package/dist/definitions.d.ts +115 -0
  21. package/dist/definitions.js +99 -0
  22. package/dist/index.cjs +60 -18
  23. package/dist/index.d.cts +9 -7
  24. package/dist/index.d.ts +9 -7
  25. package/dist/index.js +7 -5
  26. package/dist/{math-B7gZJeND.d.cts → math-BlG8Tjk-.d.cts} +3 -3
  27. package/dist/{math-B7gZJeND.d.ts → math-BlG8Tjk-.d.ts} +3 -3
  28. package/dist/math.d.cts +1 -1
  29. package/dist/math.d.ts +1 -1
  30. package/dist/package-node-BigDwzL9.d.ts +456 -0
  31. package/dist/package-node-WkzRlNO1.d.cts +456 -0
  32. package/dist/package-node.cjs +133 -0
  33. package/dist/package-node.d.cts +2 -0
  34. package/dist/package-node.d.ts +2 -0
  35. package/dist/package-node.js +102 -0
  36. package/dist/package.cjs +40 -7
  37. package/dist/package.d.cts +498 -756
  38. package/dist/package.d.ts +498 -756
  39. package/dist/package.js +42 -8
  40. package/dist/schema-io.cjs +55 -25
  41. package/dist/schema-io.d.cts +13 -11
  42. package/dist/schema-io.d.ts +13 -11
  43. package/dist/schema-io.js +54 -25
  44. package/package.json +2 -2
  45. package/schemas/content-document.schema.json +1813 -68
  46. package/schemas/document-package.schema.json +3528 -30
  47. package/dist/layout.cjs +0 -150
  48. package/dist/layout.d.cts +0 -684
  49. package/dist/layout.d.ts +0 -684
  50. package/dist/layout.js +0 -136
  51. 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;