document-schema 1.10.1 → 2.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.
package/dist/layout.d.ts CHANGED
@@ -9,12 +9,12 @@ declare const LayoutTextSchema: z.ZodObject<{
9
9
  font: z.ZodObject<{
10
10
  family: z.ZodString;
11
11
  weight: z.ZodEnum<{
12
- bold: "bold";
13
12
  normal: "normal";
13
+ bold: "bold";
14
14
  }>;
15
15
  style: z.ZodEnum<{
16
- italic: "italic";
17
16
  normal: "normal";
17
+ italic: "italic";
18
18
  }>;
19
19
  }, z.core.$strip>;
20
20
  sizePt: z.ZodNumber;
@@ -74,6 +74,12 @@ declare const LayoutLineSchema: z.ZodObject<{
74
74
  b: z.ZodNumber;
75
75
  }, z.core.$strip>;
76
76
  widthPt: z.ZodNumber;
77
+ style: z.ZodOptional<z.ZodEnum<{
78
+ solid: "solid";
79
+ dashed: "dashed";
80
+ dotted: "dotted";
81
+ double: "double";
82
+ }>>;
77
83
  sourcePath: z.ZodOptional<z.ZodString>;
78
84
  }, z.core.$strip>;
79
85
  type LayoutLine = z.infer<typeof LayoutLineSchema>;
@@ -169,6 +175,12 @@ declare const LayoutPathSchema: z.ZodObject<{
169
175
  }, z.core.$strip>;
170
176
  widthPt: z.ZodNumber;
171
177
  }, z.core.$strip>>;
178
+ style: z.ZodOptional<z.ZodEnum<{
179
+ solid: "solid";
180
+ dashed: "dashed";
181
+ dotted: "dotted";
182
+ double: "double";
183
+ }>>;
172
184
  sourcePath: z.ZodOptional<z.ZodString>;
173
185
  }, z.core.$strip>;
174
186
  type LayoutPath = z.infer<typeof LayoutPathSchema>;
@@ -190,12 +202,12 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
190
202
  font: z.ZodObject<{
191
203
  family: z.ZodString;
192
204
  weight: z.ZodEnum<{
193
- bold: "bold";
194
205
  normal: "normal";
206
+ bold: "bold";
195
207
  }>;
196
208
  style: z.ZodEnum<{
197
- italic: "italic";
198
209
  normal: "normal";
210
+ italic: "italic";
199
211
  }>;
200
212
  }, z.core.$strip>;
201
213
  sizePt: z.ZodNumber;
@@ -249,6 +261,12 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
249
261
  b: z.ZodNumber;
250
262
  }, z.core.$strip>;
251
263
  widthPt: z.ZodNumber;
264
+ style: z.ZodOptional<z.ZodEnum<{
265
+ solid: "solid";
266
+ dashed: "dashed";
267
+ dotted: "dotted";
268
+ double: "double";
269
+ }>>;
252
270
  sourcePath: z.ZodOptional<z.ZodString>;
253
271
  }, z.core.$strip>, z.ZodObject<{
254
272
  kind: z.ZodLiteral<"ellipse">;
@@ -307,6 +325,12 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
307
325
  }, z.core.$strip>;
308
326
  widthPt: z.ZodNumber;
309
327
  }, z.core.$strip>>;
328
+ style: z.ZodOptional<z.ZodEnum<{
329
+ solid: "solid";
330
+ dashed: "dashed";
331
+ dotted: "dotted";
332
+ double: "double";
333
+ }>>;
310
334
  sourcePath: z.ZodOptional<z.ZodString>;
311
335
  }, z.core.$strip>, z.ZodObject<{
312
336
  kind: z.ZodLiteral<"link">;
@@ -329,12 +353,12 @@ declare const LayoutPageSchema: z.ZodObject<{
329
353
  font: z.ZodObject<{
330
354
  family: z.ZodString;
331
355
  weight: z.ZodEnum<{
332
- bold: "bold";
333
356
  normal: "normal";
357
+ bold: "bold";
334
358
  }>;
335
359
  style: z.ZodEnum<{
336
- italic: "italic";
337
360
  normal: "normal";
361
+ italic: "italic";
338
362
  }>;
339
363
  }, z.core.$strip>;
340
364
  sizePt: z.ZodNumber;
@@ -388,6 +412,12 @@ declare const LayoutPageSchema: z.ZodObject<{
388
412
  b: z.ZodNumber;
389
413
  }, z.core.$strip>;
390
414
  widthPt: z.ZodNumber;
415
+ style: z.ZodOptional<z.ZodEnum<{
416
+ solid: "solid";
417
+ dashed: "dashed";
418
+ dotted: "dotted";
419
+ double: "double";
420
+ }>>;
391
421
  sourcePath: z.ZodOptional<z.ZodString>;
392
422
  }, z.core.$strip>, z.ZodObject<{
393
423
  kind: z.ZodLiteral<"ellipse">;
@@ -446,6 +476,12 @@ declare const LayoutPageSchema: z.ZodObject<{
446
476
  }, z.core.$strip>;
447
477
  widthPt: z.ZodNumber;
448
478
  }, z.core.$strip>>;
479
+ style: z.ZodOptional<z.ZodEnum<{
480
+ solid: "solid";
481
+ dashed: "dashed";
482
+ dotted: "dotted";
483
+ double: "double";
484
+ }>>;
449
485
  sourcePath: z.ZodOptional<z.ZodString>;
450
486
  }, z.core.$strip>, z.ZodObject<{
451
487
  kind: z.ZodLiteral<"link">;
@@ -492,12 +528,12 @@ declare const LayoutDocumentSchema: z.ZodObject<{
492
528
  font: z.ZodObject<{
493
529
  family: z.ZodString;
494
530
  weight: z.ZodEnum<{
495
- bold: "bold";
496
531
  normal: "normal";
532
+ bold: "bold";
497
533
  }>;
498
534
  style: z.ZodEnum<{
499
- italic: "italic";
500
535
  normal: "normal";
536
+ italic: "italic";
501
537
  }>;
502
538
  }, z.core.$strip>;
503
539
  sizePt: z.ZodNumber;
@@ -551,6 +587,12 @@ declare const LayoutDocumentSchema: z.ZodObject<{
551
587
  b: z.ZodNumber;
552
588
  }, z.core.$strip>;
553
589
  widthPt: z.ZodNumber;
590
+ style: z.ZodOptional<z.ZodEnum<{
591
+ solid: "solid";
592
+ dashed: "dashed";
593
+ dotted: "dotted";
594
+ double: "double";
595
+ }>>;
554
596
  sourcePath: z.ZodOptional<z.ZodString>;
555
597
  }, z.core.$strip>, z.ZodObject<{
556
598
  kind: z.ZodLiteral<"ellipse">;
@@ -609,6 +651,12 @@ declare const LayoutDocumentSchema: z.ZodObject<{
609
651
  }, z.core.$strip>;
610
652
  widthPt: z.ZodNumber;
611
653
  }, z.core.$strip>>;
654
+ style: z.ZodOptional<z.ZodEnum<{
655
+ solid: "solid";
656
+ dashed: "dashed";
657
+ dotted: "dotted";
658
+ double: "double";
659
+ }>>;
612
660
  sourcePath: z.ZodOptional<z.ZodString>;
613
661
  }, z.core.$strip>, z.ZodObject<{
614
662
  kind: z.ZodLiteral<"link">;
package/dist/layout.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ColorSchema } from "./color.js";
2
2
  import { LayoutMetadataSchema } from "./metadata.js";
3
3
  import { LayoutFontSchema } from "./style.js";
4
+ import { ContentStrokeStyleSchema } from "./content.js";
4
5
  import { z } from "zod";
5
6
  //#region src/layout.ts
6
7
  const LAYOUT_FORMAT_VERSION = 1;
@@ -48,6 +49,7 @@ const LayoutLineSchema = z.object({
48
49
  y2Pt: z.number(),
49
50
  color: ColorSchema,
50
51
  widthPt: z.number().positive(),
52
+ style: ContentStrokeStyleSchema.optional(),
51
53
  sourcePath: z.string().optional()
52
54
  });
53
55
  const LayoutEllipseSchema = z.object({
@@ -91,6 +93,7 @@ const LayoutPathSchema = z.object({
91
93
  color: ColorSchema,
92
94
  widthPt: z.number().positive()
93
95
  }).optional(),
96
+ style: ContentStrokeStyleSchema.optional(),
94
97
  sourcePath: z.string().optional()
95
98
  });
96
99
  const LayoutLinkSchema = z.object({
@@ -0,0 +1,56 @@
1
+ import { z } from "zod";
2
+ //#region src/mathml.d.ts
3
+ declare const MathMlAttributeSchema: z.ZodObject<{
4
+ name: z.ZodString;
5
+ value: z.ZodString;
6
+ }, z.core.$strip>;
7
+ type MathMlAttribute = z.infer<typeof MathMlAttributeSchema>;
8
+ declare const MathMlTextSchema: z.ZodObject<{
9
+ type: z.ZodLiteral<"text">;
10
+ value: z.ZodString;
11
+ }, z.core.$strip>;
12
+ type MathMlText = z.infer<typeof MathMlTextSchema>;
13
+ declare const MathMlCdataSchema: z.ZodObject<{
14
+ type: z.ZodLiteral<"cdata">;
15
+ value: z.ZodString;
16
+ }, z.core.$strip>;
17
+ type MathMlCdata = z.infer<typeof MathMlCdataSchema>;
18
+ declare const MathMlCommentSchema: z.ZodObject<{
19
+ type: z.ZodLiteral<"comment">;
20
+ value: z.ZodString;
21
+ }, z.core.$strip>;
22
+ type MathMlComment = z.infer<typeof MathMlCommentSchema>;
23
+ declare const MathMlDeclarationSchema: z.ZodObject<{
24
+ type: z.ZodLiteral<"declaration">;
25
+ attributes: z.ZodArray<z.ZodObject<{
26
+ name: z.ZodString;
27
+ value: z.ZodString;
28
+ }, z.core.$strip>>;
29
+ }, z.core.$strip>;
30
+ type MathMlDeclaration = z.infer<typeof MathMlDeclarationSchema>;
31
+ declare const MathMlPiSchema: z.ZodObject<{
32
+ type: z.ZodLiteral<"pi">;
33
+ target: z.ZodString;
34
+ content: z.ZodString;
35
+ }, z.core.$strip>;
36
+ type MathMlPi = z.infer<typeof MathMlPiSchema>;
37
+ interface MathMlElement {
38
+ type: 'element';
39
+ tag: string;
40
+ attributes: MathMlAttribute[];
41
+ children: MathMlNode[];
42
+ }
43
+ type MathMlNode = MathMlText | MathMlCdata | MathMlComment | MathMlDeclaration | MathMlPi | MathMlElement;
44
+ declare function isMathMlNode(value: unknown): value is MathMlNode;
45
+ declare const MathMlNodeSchema: z.ZodCustom<MathMlNode, MathMlNode>;
46
+ declare const MathMlElementSchema: z.ZodObject<{
47
+ type: z.ZodLiteral<"element">;
48
+ tag: z.ZodString;
49
+ attributes: z.ZodArray<z.ZodObject<{
50
+ name: z.ZodString;
51
+ value: z.ZodString;
52
+ }, z.core.$strip>>;
53
+ children: z.ZodArray<z.ZodCustom<MathMlNode, MathMlNode>>;
54
+ }, z.core.$strip>;
55
+ //#endregion
56
+ export { isMathMlNode as _, MathMlComment as a, MathMlDeclarationSchema as c, MathMlNode as d, MathMlNodeSchema as f, MathMlTextSchema as g, MathMlText as h, MathMlCdataSchema as i, MathMlElement as l, MathMlPiSchema as m, MathMlAttributeSchema as n, MathMlCommentSchema as o, MathMlPi as p, MathMlCdata as r, MathMlDeclaration as s, MathMlAttribute as t, MathMlElementSchema as u };
@@ -0,0 +1,56 @@
1
+ import { z } from "zod";
2
+ //#region src/mathml.d.ts
3
+ declare const MathMlAttributeSchema: z.ZodObject<{
4
+ name: z.ZodString;
5
+ value: z.ZodString;
6
+ }, z.core.$strip>;
7
+ type MathMlAttribute = z.infer<typeof MathMlAttributeSchema>;
8
+ declare const MathMlTextSchema: z.ZodObject<{
9
+ type: z.ZodLiteral<"text">;
10
+ value: z.ZodString;
11
+ }, z.core.$strip>;
12
+ type MathMlText = z.infer<typeof MathMlTextSchema>;
13
+ declare const MathMlCdataSchema: z.ZodObject<{
14
+ type: z.ZodLiteral<"cdata">;
15
+ value: z.ZodString;
16
+ }, z.core.$strip>;
17
+ type MathMlCdata = z.infer<typeof MathMlCdataSchema>;
18
+ declare const MathMlCommentSchema: z.ZodObject<{
19
+ type: z.ZodLiteral<"comment">;
20
+ value: z.ZodString;
21
+ }, z.core.$strip>;
22
+ type MathMlComment = z.infer<typeof MathMlCommentSchema>;
23
+ declare const MathMlDeclarationSchema: z.ZodObject<{
24
+ type: z.ZodLiteral<"declaration">;
25
+ attributes: z.ZodArray<z.ZodObject<{
26
+ name: z.ZodString;
27
+ value: z.ZodString;
28
+ }, z.core.$strip>>;
29
+ }, z.core.$strip>;
30
+ type MathMlDeclaration = z.infer<typeof MathMlDeclarationSchema>;
31
+ declare const MathMlPiSchema: z.ZodObject<{
32
+ type: z.ZodLiteral<"pi">;
33
+ target: z.ZodString;
34
+ content: z.ZodString;
35
+ }, z.core.$strip>;
36
+ type MathMlPi = z.infer<typeof MathMlPiSchema>;
37
+ interface MathMlElement {
38
+ type: 'element';
39
+ tag: string;
40
+ attributes: MathMlAttribute[];
41
+ children: MathMlNode[];
42
+ }
43
+ type MathMlNode = MathMlText | MathMlCdata | MathMlComment | MathMlDeclaration | MathMlPi | MathMlElement;
44
+ declare function isMathMlNode(value: unknown): value is MathMlNode;
45
+ declare const MathMlNodeSchema: z.ZodCustom<MathMlNode, MathMlNode>;
46
+ declare const MathMlElementSchema: z.ZodObject<{
47
+ type: z.ZodLiteral<"element">;
48
+ tag: z.ZodString;
49
+ attributes: z.ZodArray<z.ZodObject<{
50
+ name: z.ZodString;
51
+ value: z.ZodString;
52
+ }, z.core.$strip>>;
53
+ children: z.ZodArray<z.ZodCustom<MathMlNode, MathMlNode>>;
54
+ }, z.core.$strip>;
55
+ //#endregion
56
+ export { isMathMlNode as _, MathMlComment as a, MathMlDeclarationSchema as c, MathMlNode as d, MathMlNodeSchema as f, MathMlTextSchema as g, MathMlText as h, MathMlCdataSchema as i, MathMlElement as l, MathMlPiSchema as m, MathMlAttributeSchema as n, MathMlCommentSchema as o, MathMlPi as p, MathMlCdata as r, MathMlDeclaration as s, MathMlAttribute as t, MathMlElementSchema as u };
@@ -0,0 +1,60 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let zod = require("zod");
3
+ //#region src/mathml.ts
4
+ const MathMlAttributeSchema = zod.z.object({
5
+ name: zod.z.string(),
6
+ value: zod.z.string()
7
+ });
8
+ const MathMlTextSchema = zod.z.object({
9
+ type: zod.z.literal("text"),
10
+ value: zod.z.string()
11
+ });
12
+ const MathMlCdataSchema = zod.z.object({
13
+ type: zod.z.literal("cdata"),
14
+ value: zod.z.string()
15
+ });
16
+ const MathMlCommentSchema = zod.z.object({
17
+ type: zod.z.literal("comment"),
18
+ value: zod.z.string()
19
+ });
20
+ const MathMlDeclarationSchema = zod.z.object({
21
+ type: zod.z.literal("declaration"),
22
+ attributes: zod.z.array(MathMlAttributeSchema)
23
+ });
24
+ const MathMlPiSchema = zod.z.object({
25
+ type: zod.z.literal("pi"),
26
+ target: zod.z.string(),
27
+ content: zod.z.string()
28
+ });
29
+ function isRecord(value) {
30
+ return typeof value === "object" && value !== null && !Array.isArray(value);
31
+ }
32
+ function isMathMlAttribute(value) {
33
+ return isRecord(value) && typeof value.name === "string" && typeof value.value === "string";
34
+ }
35
+ function isMathMlNode(value) {
36
+ if (!isRecord(value)) return false;
37
+ const type = value.type;
38
+ if (type === "text" || type === "cdata" || type === "comment") return typeof value.value === "string";
39
+ if (type === "declaration") return Array.isArray(value.attributes) && value.attributes.every(isMathMlAttribute);
40
+ if (type === "pi") return typeof value.target === "string" && typeof value.content === "string";
41
+ if (type === "element") return typeof value.tag === "string" && Array.isArray(value.attributes) && value.attributes.every(isMathMlAttribute) && Array.isArray(value.children) && value.children.every(isMathMlNode);
42
+ return false;
43
+ }
44
+ const MathMlNodeSchema = zod.z.custom(isMathMlNode);
45
+ const MathMlElementSchema = zod.z.object({
46
+ type: zod.z.literal("element"),
47
+ tag: zod.z.string(),
48
+ attributes: zod.z.array(MathMlAttributeSchema),
49
+ children: zod.z.array(MathMlNodeSchema)
50
+ });
51
+ //#endregion
52
+ exports.MathMlAttributeSchema = MathMlAttributeSchema;
53
+ exports.MathMlCdataSchema = MathMlCdataSchema;
54
+ exports.MathMlCommentSchema = MathMlCommentSchema;
55
+ exports.MathMlDeclarationSchema = MathMlDeclarationSchema;
56
+ exports.MathMlElementSchema = MathMlElementSchema;
57
+ exports.MathMlNodeSchema = MathMlNodeSchema;
58
+ exports.MathMlPiSchema = MathMlPiSchema;
59
+ exports.MathMlTextSchema = MathMlTextSchema;
60
+ exports.isMathMlNode = isMathMlNode;
@@ -0,0 +1,2 @@
1
+ import { _ as isMathMlNode, a as MathMlComment, c as MathMlDeclarationSchema, d as MathMlNode, f as MathMlNodeSchema, g as MathMlTextSchema, h as MathMlText, i as MathMlCdataSchema, l as MathMlElement, m as MathMlPiSchema, n as MathMlAttributeSchema, o as MathMlCommentSchema, p as MathMlPi, r as MathMlCdata, s as MathMlDeclaration, t as MathMlAttribute, u as MathMlElementSchema } from "./mathml-B1oTCtzc.cjs";
2
+ export { MathMlAttribute, MathMlAttributeSchema, MathMlCdata, MathMlCdataSchema, MathMlComment, MathMlCommentSchema, MathMlDeclaration, MathMlDeclarationSchema, MathMlElement, MathMlElementSchema, MathMlNode, MathMlNodeSchema, MathMlPi, MathMlPiSchema, MathMlText, MathMlTextSchema, isMathMlNode };
@@ -0,0 +1,2 @@
1
+ import { _ as isMathMlNode, a as MathMlComment, c as MathMlDeclarationSchema, d as MathMlNode, f as MathMlNodeSchema, g as MathMlTextSchema, h as MathMlText, i as MathMlCdataSchema, l as MathMlElement, m as MathMlPiSchema, n as MathMlAttributeSchema, o as MathMlCommentSchema, p as MathMlPi, r as MathMlCdata, s as MathMlDeclaration, t as MathMlAttribute, u as MathMlElementSchema } from "./mathml-B1oTCtzc.js";
2
+ export { MathMlAttribute, MathMlAttributeSchema, MathMlCdata, MathMlCdataSchema, MathMlComment, MathMlCommentSchema, MathMlDeclaration, MathMlDeclarationSchema, MathMlElement, MathMlElementSchema, MathMlNode, MathMlNodeSchema, MathMlPi, MathMlPiSchema, MathMlText, MathMlTextSchema, isMathMlNode };
package/dist/mathml.js ADDED
@@ -0,0 +1,51 @@
1
+ import { z } from "zod";
2
+ //#region src/mathml.ts
3
+ const MathMlAttributeSchema = z.object({
4
+ name: z.string(),
5
+ value: z.string()
6
+ });
7
+ const MathMlTextSchema = z.object({
8
+ type: z.literal("text"),
9
+ value: z.string()
10
+ });
11
+ const MathMlCdataSchema = z.object({
12
+ type: z.literal("cdata"),
13
+ value: z.string()
14
+ });
15
+ const MathMlCommentSchema = z.object({
16
+ type: z.literal("comment"),
17
+ value: z.string()
18
+ });
19
+ const MathMlDeclarationSchema = z.object({
20
+ type: z.literal("declaration"),
21
+ attributes: z.array(MathMlAttributeSchema)
22
+ });
23
+ const MathMlPiSchema = z.object({
24
+ type: z.literal("pi"),
25
+ target: z.string(),
26
+ content: z.string()
27
+ });
28
+ function isRecord(value) {
29
+ return typeof value === "object" && value !== null && !Array.isArray(value);
30
+ }
31
+ function isMathMlAttribute(value) {
32
+ return isRecord(value) && typeof value.name === "string" && typeof value.value === "string";
33
+ }
34
+ function isMathMlNode(value) {
35
+ if (!isRecord(value)) return false;
36
+ const type = value.type;
37
+ if (type === "text" || type === "cdata" || type === "comment") return typeof value.value === "string";
38
+ if (type === "declaration") return Array.isArray(value.attributes) && value.attributes.every(isMathMlAttribute);
39
+ if (type === "pi") return typeof value.target === "string" && typeof value.content === "string";
40
+ if (type === "element") return typeof value.tag === "string" && Array.isArray(value.attributes) && value.attributes.every(isMathMlAttribute) && Array.isArray(value.children) && value.children.every(isMathMlNode);
41
+ return false;
42
+ }
43
+ const MathMlNodeSchema = z.custom(isMathMlNode);
44
+ const MathMlElementSchema = z.object({
45
+ type: z.literal("element"),
46
+ tag: z.string(),
47
+ attributes: z.array(MathMlAttributeSchema),
48
+ children: z.array(MathMlNodeSchema)
49
+ });
50
+ //#endregion
51
+ export { MathMlAttributeSchema, MathMlCdataSchema, MathMlCommentSchema, MathMlDeclarationSchema, MathMlElementSchema, MathMlNodeSchema, MathMlPiSchema, MathMlTextSchema, isMathMlNode };