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