document-content-model 7.15.3 → 7.16.1
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/bijection-constructs-3By08A5K.cjs +14695 -0
- package/dist/bijection-constructs-DlP29TpB.js +14624 -0
- package/dist/bijection-constructs.cjs +4 -0
- package/dist/bijection-constructs.d.cts +6 -0
- package/dist/bijection-constructs.d.ts +6 -0
- package/dist/bijection-constructs.js +2 -0
- package/dist/bijection-corpus.cjs +12 -0
- package/dist/bijection-corpus.d.cts +46 -0
- package/dist/bijection-corpus.d.ts +46 -0
- package/dist/bijection-corpus.js +2 -0
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/{content-1yGdeaVT.d.ts → content-C8oVg7U_.d.ts} +7873 -9463
- package/dist/{content-CSf8z9NW.d.cts → content-UFAqR2zQ.d.cts} +7873 -9463
- package/dist/content-drawing-3yNJVteg.d.cts +1606 -0
- package/dist/content-drawing-cjm6n33_.d.ts +1606 -0
- package/dist/content-drawing.cjs +186 -0
- package/dist/content-drawing.d.cts +2 -0
- package/dist/content-drawing.d.ts +2 -0
- package/dist/content-drawing.js +171 -0
- package/dist/content-json-schema-defs.cjs +27 -3033
- package/dist/content-json-schema-defs.d.cts +2 -6
- package/dist/content-json-schema-defs.d.ts +2 -6
- package/dist/content-json-schema-defs.js +28 -3031
- package/dist/content-sheet.cjs +408 -0
- package/dist/content-sheet.d.cts +2 -0
- package/dist/content-sheet.d.ts +2 -0
- package/dist/content-sheet.js +385 -0
- package/dist/content-vocabulary.cjs +190 -0
- package/dist/content-vocabulary.d.cts +2 -0
- package/dist/content-vocabulary.d.ts +2 -0
- package/dist/content-vocabulary.js +168 -0
- package/dist/content.cjs +29 -781
- package/dist/content.d.cts +2 -2
- package/dist/content.d.ts +2 -2
- package/dist/content.js +6 -701
- package/dist/decompose.d.cts +3 -2
- package/dist/decompose.d.ts +3 -2
- package/dist/definitions.cjs +2 -1
- package/dist/definitions.d.cts +4 -4
- package/dist/definitions.d.ts +4 -4
- package/dist/definitions.js +2 -1
- package/dist/factor-styles.d.cts +1 -1
- package/dist/factor-styles.d.ts +1 -1
- package/dist/flatten.d.cts +1 -1
- package/dist/flatten.d.ts +1 -1
- package/dist/index.cjs +69 -63
- package/dist/index.d.cts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +10 -6
- package/dist/json-schema-defs-blocks.cjs +1036 -0
- package/dist/json-schema-defs-blocks.d.cts +5 -0
- package/dist/json-schema-defs-blocks.d.ts +5 -0
- package/dist/json-schema-defs-blocks.js +1035 -0
- package/dist/json-schema-defs-math.cjs +291 -0
- package/dist/json-schema-defs-math.d.cts +5 -0
- package/dist/json-schema-defs-math.d.ts +5 -0
- package/dist/json-schema-defs-math.js +290 -0
- package/dist/json-schema-defs-shared.cjs +42 -0
- package/dist/json-schema-defs-shared.d.cts +9 -0
- package/dist/json-schema-defs-shared.d.ts +9 -0
- package/dist/json-schema-defs-shared.js +38 -0
- package/dist/json-schema-defs-sheet.cjs +944 -0
- package/dist/json-schema-defs-sheet.d.cts +5 -0
- package/dist/json-schema-defs-sheet.d.ts +5 -0
- package/dist/json-schema-defs-sheet.js +943 -0
- package/dist/json-schema-defs-tree.cjs +237 -0
- package/dist/json-schema-defs-tree.d.cts +5 -0
- package/dist/json-schema-defs-tree.d.ts +5 -0
- package/dist/json-schema-defs-tree.js +237 -0
- package/dist/json-schema-defs-vector.cjs +513 -0
- package/dist/json-schema-defs-vector.d.cts +5 -0
- package/dist/json-schema-defs-vector.d.ts +5 -0
- package/dist/json-schema-defs-vector.js +512 -0
- package/dist/magic-string.es-CB2hOw9v.js +1012 -0
- package/dist/magic-string.es-MEBc20Ce.cjs +1012 -0
- package/dist/{package-node-CpE1BAqK.d.ts → package-node-CoWOKxt7.d.ts} +20 -19
- package/dist/{package-node-ng7Yimj9.d.cts → package-node-H2Calta4.d.cts} +20 -19
- package/dist/package-node.cjs +12 -9
- package/dist/package-node.d.cts +1 -1
- package/dist/package-node.d.ts +1 -1
- package/dist/package-node.js +4 -1
- package/dist/package.d.cts +6 -6
- package/dist/package.d.ts +6 -6
- package/dist/schema-io.cjs +2 -2
- package/dist/schema-io.d.cts +1 -1
- package/dist/schema-io.d.ts +1 -1
- package/dist/schema-io.js +2 -2
- package/dist/{style-BGMcYrD2.d.cts → style-D06NwxAJ.d.cts} +1 -1
- package/dist/{style-BGMcYrD2.d.ts → style-D06NwxAJ.d.ts} +1 -1
- package/dist/style.d.cts +1 -1
- package/dist/style.d.ts +1 -1
- package/dist/table-grid.d.cts +2 -2
- package/dist/table-grid.d.ts +2 -2
- package/dist/text-layout.d.cts +1 -1
- package/dist/text-layout.d.ts +1 -1
- package/package.json +1 -1
- package/schemas/content-document.schema.json +16 -16
- package/schemas/document-tree.schema.json +3 -3
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { SourceResidueSchema } from "./source.js";
|
|
2
|
+
import { ConstructDescriptorSchema } from "./construct.js";
|
|
3
|
+
import { BoxSchema, LayoutFrameSchema } from "./geometry.js";
|
|
4
|
+
import { TextDirectionSchema } from "./style.js";
|
|
5
|
+
import { ColorSchema } from "./color.js";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
//#region src/content-vocabulary.ts
|
|
8
|
+
const ContentOriginSchema = z.enum([
|
|
9
|
+
"chart",
|
|
10
|
+
"diagram",
|
|
11
|
+
"table",
|
|
12
|
+
"image",
|
|
13
|
+
"notes",
|
|
14
|
+
"body"
|
|
15
|
+
]);
|
|
16
|
+
const ContentTranscriptSchema = z.object({
|
|
17
|
+
text: z.string(),
|
|
18
|
+
confidence: z.enum([
|
|
19
|
+
"high",
|
|
20
|
+
"medium",
|
|
21
|
+
"low"
|
|
22
|
+
]),
|
|
23
|
+
mechanism: z.enum(["deterministic", "model"])
|
|
24
|
+
});
|
|
25
|
+
const ContentInterpretationSchema = z.object({
|
|
26
|
+
transcript: ContentTranscriptSchema.optional(),
|
|
27
|
+
description: z.string().optional(),
|
|
28
|
+
by: z.object({
|
|
29
|
+
model: z.string(),
|
|
30
|
+
at: z.string()
|
|
31
|
+
}).optional()
|
|
32
|
+
});
|
|
33
|
+
const CONTENT_ANNOTATION_FIELDS = {
|
|
34
|
+
origin: ContentOriginSchema.optional(),
|
|
35
|
+
interpretation: ContentInterpretationSchema.optional()
|
|
36
|
+
};
|
|
37
|
+
const RUN_FONT_PROPERTY_SHAPE = {
|
|
38
|
+
bold: z.boolean().optional(),
|
|
39
|
+
italic: z.boolean().optional(),
|
|
40
|
+
underline: z.boolean().optional(),
|
|
41
|
+
strike: z.boolean().optional(),
|
|
42
|
+
fontFamily: z.string().optional(),
|
|
43
|
+
sizePt: z.number().positive().optional(),
|
|
44
|
+
color: ColorSchema.optional()
|
|
45
|
+
};
|
|
46
|
+
const ContentFontSchema = z.object(RUN_FONT_PROPERTY_SHAPE);
|
|
47
|
+
const ContentRunSchema = z.object({
|
|
48
|
+
text: z.string(),
|
|
49
|
+
...RUN_FONT_PROPERTY_SHAPE,
|
|
50
|
+
hyperlink: z.string().optional(),
|
|
51
|
+
verticalAlign: z.enum(["superscript", "subscript"]).optional(),
|
|
52
|
+
direction: TextDirectionSchema.optional(),
|
|
53
|
+
sourcePath: z.string().optional(),
|
|
54
|
+
source: SourceResidueSchema.optional(),
|
|
55
|
+
frames: z.array(LayoutFrameSchema).optional(),
|
|
56
|
+
...CONTENT_ANNOTATION_FIELDS
|
|
57
|
+
});
|
|
58
|
+
const RunConstructExtentSchema = z.object({
|
|
59
|
+
descriptor: ConstructDescriptorSchema,
|
|
60
|
+
startRun: z.number().int().nonnegative(),
|
|
61
|
+
endRun: z.number().int().nonnegative()
|
|
62
|
+
});
|
|
63
|
+
const ContentStrokeStyleSchema = z.enum([
|
|
64
|
+
"solid",
|
|
65
|
+
"dashed",
|
|
66
|
+
"dotted",
|
|
67
|
+
"double"
|
|
68
|
+
]);
|
|
69
|
+
const ContentBorderSchema = z.object({
|
|
70
|
+
color: ColorSchema,
|
|
71
|
+
widthPt: z.number().positive(),
|
|
72
|
+
style: ContentStrokeStyleSchema.optional()
|
|
73
|
+
});
|
|
74
|
+
const ContentFloatOriginSchema = z.enum([
|
|
75
|
+
"page",
|
|
76
|
+
"margin",
|
|
77
|
+
"leftMargin",
|
|
78
|
+
"rightMargin",
|
|
79
|
+
"topMargin",
|
|
80
|
+
"bottomMargin",
|
|
81
|
+
"insideMargin",
|
|
82
|
+
"outsideMargin",
|
|
83
|
+
"column",
|
|
84
|
+
"character",
|
|
85
|
+
"paragraph",
|
|
86
|
+
"line",
|
|
87
|
+
"frame"
|
|
88
|
+
]);
|
|
89
|
+
const ContentFloatAlignSchema = z.enum([
|
|
90
|
+
"left",
|
|
91
|
+
"right",
|
|
92
|
+
"top",
|
|
93
|
+
"bottom",
|
|
94
|
+
"center",
|
|
95
|
+
"inside",
|
|
96
|
+
"outside"
|
|
97
|
+
]);
|
|
98
|
+
const ContentFloatAxisSchema = z.union([z.strictObject({
|
|
99
|
+
relativeTo: ContentFloatOriginSchema,
|
|
100
|
+
offsetPt: z.number()
|
|
101
|
+
}), z.strictObject({
|
|
102
|
+
relativeTo: ContentFloatOriginSchema,
|
|
103
|
+
align: ContentFloatAlignSchema
|
|
104
|
+
})]);
|
|
105
|
+
const ContentFloatPositionSchema = z.object({
|
|
106
|
+
horizontal: ContentFloatAxisSchema,
|
|
107
|
+
vertical: ContentFloatAxisSchema
|
|
108
|
+
});
|
|
109
|
+
const IMAGE_FORMATS = [
|
|
110
|
+
"png",
|
|
111
|
+
"jpeg",
|
|
112
|
+
"svg",
|
|
113
|
+
"gif"
|
|
114
|
+
];
|
|
115
|
+
function isImageFormat(value) {
|
|
116
|
+
return IMAGE_FORMATS.includes(value);
|
|
117
|
+
}
|
|
118
|
+
const ContentImageOriginalSchema = z.object({
|
|
119
|
+
filter: z.enum(["jbig2", "jpeg2000"]),
|
|
120
|
+
base64: z.string(),
|
|
121
|
+
jbig2GlobalsBase64: z.string().optional()
|
|
122
|
+
});
|
|
123
|
+
const ContentImageBlockSchema = z.object({
|
|
124
|
+
kind: z.literal("image"),
|
|
125
|
+
format: z.enum(IMAGE_FORMATS),
|
|
126
|
+
base64: z.string(),
|
|
127
|
+
widthPt: z.number().positive(),
|
|
128
|
+
heightPt: z.number().positive(),
|
|
129
|
+
altText: z.string().optional(),
|
|
130
|
+
original: ContentImageOriginalSchema.optional(),
|
|
131
|
+
anchorRunIndex: z.number().int().nonnegative().optional(),
|
|
132
|
+
anchorOffset: z.number().int().nonnegative().optional(),
|
|
133
|
+
caption: z.string().optional(),
|
|
134
|
+
floatPosition: ContentFloatPositionSchema.optional(),
|
|
135
|
+
sourcePath: z.string().optional(),
|
|
136
|
+
source: SourceResidueSchema.optional(),
|
|
137
|
+
frames: z.array(LayoutFrameSchema).optional(),
|
|
138
|
+
...CONTENT_ANNOTATION_FIELDS
|
|
139
|
+
});
|
|
140
|
+
const contentBlockSchemaBox = {};
|
|
141
|
+
const contentDocumentSchemaBox = {};
|
|
142
|
+
const CONTENT_EMBEDDED_OBJECT_FIELDS = {
|
|
143
|
+
objectKind: z.enum([
|
|
144
|
+
"formula",
|
|
145
|
+
"wordprocessing",
|
|
146
|
+
"presentation",
|
|
147
|
+
"spreadsheet",
|
|
148
|
+
"drawing",
|
|
149
|
+
"chart"
|
|
150
|
+
]),
|
|
151
|
+
document: z.lazy(() => contentDocumentSchemaBox.value),
|
|
152
|
+
frame: BoxSchema,
|
|
153
|
+
anchorRow: z.number().int().nonnegative().optional(),
|
|
154
|
+
anchorColumn: z.number().int().nonnegative().optional(),
|
|
155
|
+
offsetXPt: z.number().optional(),
|
|
156
|
+
offsetYPt: z.number().optional(),
|
|
157
|
+
source: SourceResidueSchema.optional(),
|
|
158
|
+
...CONTENT_ANNOTATION_FIELDS
|
|
159
|
+
};
|
|
160
|
+
const ContentEmbeddedObjectSchema = z.object(CONTENT_EMBEDDED_OBJECT_FIELDS);
|
|
161
|
+
const ContentEmbeddedObjectBlockSchema = z.object({
|
|
162
|
+
kind: z.literal("embeddedObject"),
|
|
163
|
+
...CONTENT_EMBEDDED_OBJECT_FIELDS,
|
|
164
|
+
sourcePath: z.string().optional(),
|
|
165
|
+
frames: z.array(LayoutFrameSchema).optional()
|
|
166
|
+
});
|
|
167
|
+
//#endregion
|
|
168
|
+
export { CONTENT_ANNOTATION_FIELDS, ContentBorderSchema, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectSchema, ContentFloatAlignSchema, ContentFloatAxisSchema, ContentFloatOriginSchema, ContentFloatPositionSchema, ContentFontSchema, ContentImageBlockSchema, ContentImageOriginalSchema, ContentInterpretationSchema, ContentOriginSchema, ContentRunSchema, ContentStrokeStyleSchema, ContentTranscriptSchema, IMAGE_FORMATS, RUN_FONT_PROPERTY_SHAPE, RunConstructExtentSchema, contentBlockSchemaBox, contentDocumentSchemaBox, isImageFormat };
|