document-model.js 1.10.1 → 2.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 +28 -4
- package/dist/content-json-schema-defs.cjs +413 -0
- package/dist/content-json-schema-defs.d.cts +9 -0
- package/dist/content-json-schema-defs.d.ts +9 -0
- package/dist/content-json-schema-defs.js +409 -0
- package/dist/content.cjs +75 -14
- package/dist/content.d.cts +653 -15
- package/dist/content.d.ts +653 -15
- package/dist/content.js +71 -15
- package/dist/index.cjs +20 -0
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/mathml-B1oTCtzc.d.cts +56 -0
- package/dist/mathml-B1oTCtzc.d.ts +56 -0
- package/dist/mathml.cjs +60 -0
- package/dist/mathml.d.cts +2 -0
- package/dist/mathml.d.ts +2 -0
- package/dist/mathml.js +51 -0
- package/dist/package.d.cts +139 -7
- package/dist/package.d.ts +139 -7
- package/dist/schema-io.cjs +1 -1
- package/dist/schema-io.js +1 -1
- package/package.json +1 -1
- package/schemas/content-document.schema.json +622 -14
- package/schemas/document-package.schema.json +3 -3
- package/schemas/layout-document.schema.json +1 -1
package/dist/content.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ColorSchema } from "./color.js";
|
|
2
2
|
import { BoxSchema, MarginsSchema, PageSizeSchema } from "./geometry.js";
|
|
3
|
+
import { MathMlNodeSchema } from "./mathml.js";
|
|
3
4
|
import { LayoutMetadataSchema } from "./metadata.js";
|
|
4
5
|
import { AlignmentSchema } from "./style.js";
|
|
5
6
|
import { z } from "zod";
|
|
@@ -80,11 +81,30 @@ function isContentBlock(value) {
|
|
|
80
81
|
const ContentBlockSchema = z.custom(isContentBlock);
|
|
81
82
|
const ContentEmbeddedObjectSchema = z.custom(isContentEmbeddedObject);
|
|
82
83
|
const ContentEmbeddedObjectBlockSchema = z.custom(isContentEmbeddedObjectBlock);
|
|
84
|
+
const ContentStrokeStyleSchema = z.enum([
|
|
85
|
+
"solid",
|
|
86
|
+
"dashed",
|
|
87
|
+
"dotted",
|
|
88
|
+
"double"
|
|
89
|
+
]);
|
|
90
|
+
const ContentBorderSchema = z.object({
|
|
91
|
+
color: ColorSchema,
|
|
92
|
+
widthPt: z.number().positive(),
|
|
93
|
+
style: ContentStrokeStyleSchema.optional()
|
|
94
|
+
});
|
|
95
|
+
const ContentCellBordersSchema = z.object({
|
|
96
|
+
left: ContentBorderSchema.optional(),
|
|
97
|
+
right: ContentBorderSchema.optional(),
|
|
98
|
+
top: ContentBorderSchema.optional(),
|
|
99
|
+
bottom: ContentBorderSchema.optional()
|
|
100
|
+
});
|
|
83
101
|
const ContentTableCellSchema = z.object({
|
|
84
102
|
blocks: z.array(ContentBlockSchema),
|
|
85
103
|
colSpan: z.number().int().positive().optional(),
|
|
86
104
|
rowSpan: z.number().int().positive().optional(),
|
|
87
|
-
background: ColorSchema.optional()
|
|
105
|
+
background: ColorSchema.optional(),
|
|
106
|
+
borders: ContentCellBordersSchema.optional(),
|
|
107
|
+
sourcePath: z.string().optional()
|
|
88
108
|
});
|
|
89
109
|
const ContentTableRowSchema = z.object({
|
|
90
110
|
cells: z.array(ContentTableCellSchema),
|
|
@@ -111,6 +131,7 @@ const ContentShapeSchema = z.object({
|
|
|
111
131
|
insetBottomPt: z.number().nonnegative(),
|
|
112
132
|
fontScale: z.number().positive().optional(),
|
|
113
133
|
lineSpacingReduction: z.number().nonnegative().optional(),
|
|
134
|
+
paintOrder: z.number().optional(),
|
|
114
135
|
sourcePath: z.string().optional(),
|
|
115
136
|
blocks: z.array(ContentBlockSchema)
|
|
116
137
|
});
|
|
@@ -119,19 +140,23 @@ const ContentSlideSchema = z.object({
|
|
|
119
140
|
shapes: z.array(ContentShapeSchema),
|
|
120
141
|
notes: z.string()
|
|
121
142
|
});
|
|
143
|
+
const DecimalStringSchema = z.string().regex(/^-?(0|[1-9]\d*)(\.\d+)?$/);
|
|
122
144
|
const ContentCellValueSchema = z.discriminatedUnion("kind", [
|
|
123
145
|
z.object({
|
|
124
146
|
kind: z.literal("number"),
|
|
125
|
-
value: z.number()
|
|
147
|
+
value: z.number(),
|
|
148
|
+
exactValue: DecimalStringSchema.optional()
|
|
126
149
|
}),
|
|
127
150
|
z.object({
|
|
128
151
|
kind: z.literal("percentage"),
|
|
129
|
-
value: z.number()
|
|
152
|
+
value: z.number(),
|
|
153
|
+
exactValue: DecimalStringSchema.optional()
|
|
130
154
|
}),
|
|
131
155
|
z.object({
|
|
132
156
|
kind: z.literal("currency"),
|
|
133
157
|
value: z.number(),
|
|
134
|
-
currency: z.string().optional()
|
|
158
|
+
currency: z.string().optional(),
|
|
159
|
+
exactValue: DecimalStringSchema.optional()
|
|
135
160
|
}),
|
|
136
161
|
z.object({
|
|
137
162
|
kind: z.literal("boolean"),
|
|
@@ -145,6 +170,10 @@ const ContentCellValueSchema = z.discriminatedUnion("kind", [
|
|
|
145
170
|
kind: z.literal("time"),
|
|
146
171
|
value: z.string()
|
|
147
172
|
}),
|
|
173
|
+
z.object({
|
|
174
|
+
kind: z.literal("dateTime"),
|
|
175
|
+
value: z.string()
|
|
176
|
+
}),
|
|
148
177
|
z.object({
|
|
149
178
|
kind: z.literal("string"),
|
|
150
179
|
value: z.string()
|
|
@@ -163,16 +192,25 @@ const ContentSheetCellSchema = z.object({
|
|
|
163
192
|
displayText: z.string(),
|
|
164
193
|
runs: z.array(ContentRunSchema).optional(),
|
|
165
194
|
colSpan: z.number().int().positive().optional(),
|
|
166
|
-
rowSpan: z.number().int().positive().optional()
|
|
195
|
+
rowSpan: z.number().int().positive().optional(),
|
|
196
|
+
background: ColorSchema.optional(),
|
|
197
|
+
borders: ContentCellBordersSchema.optional(),
|
|
198
|
+
alignment: AlignmentSchema.optional(),
|
|
199
|
+
verticalAlignment: z.enum([
|
|
200
|
+
"top",
|
|
201
|
+
"middle",
|
|
202
|
+
"bottom"
|
|
203
|
+
]).optional(),
|
|
204
|
+
sourcePath: z.string().optional()
|
|
167
205
|
});
|
|
168
206
|
const ContentSheetColumnSchema = z.object({
|
|
169
207
|
index: z.number().int().nonnegative(),
|
|
170
|
-
widthPt: z.number().
|
|
208
|
+
widthPt: z.number().positive().optional(),
|
|
171
209
|
hidden: z.boolean().optional()
|
|
172
210
|
});
|
|
173
211
|
const ContentSheetRowSchema = z.object({
|
|
174
212
|
index: z.number().int().nonnegative(),
|
|
175
|
-
heightPt: z.number().
|
|
213
|
+
heightPt: z.number().positive().optional(),
|
|
176
214
|
hidden: z.boolean().optional()
|
|
177
215
|
});
|
|
178
216
|
const ContentSheetPrintRangeSchema = z.object({
|
|
@@ -189,7 +227,7 @@ const ContentSheetPrintSettingsSchema = z.object({
|
|
|
189
227
|
pageSize: PageSizeSchema,
|
|
190
228
|
margins: MarginsSchema,
|
|
191
229
|
printRange: ContentSheetPrintRangeSchema.optional(),
|
|
192
|
-
|
|
230
|
+
scalePercent: z.number().positive().optional(),
|
|
193
231
|
fitToPages: z.object({
|
|
194
232
|
width: z.number().int().positive(),
|
|
195
233
|
height: z.number().int().positive()
|
|
@@ -221,7 +259,8 @@ const ContentSheetSchema = z.object({
|
|
|
221
259
|
});
|
|
222
260
|
const ContentStrokeSchema = z.object({
|
|
223
261
|
color: ColorSchema,
|
|
224
|
-
widthPt: z.number().positive()
|
|
262
|
+
widthPt: z.number().positive(),
|
|
263
|
+
style: ContentStrokeStyleSchema.optional()
|
|
225
264
|
});
|
|
226
265
|
const ContentPathPointSchema = z.object({
|
|
227
266
|
xPt: z.number(),
|
|
@@ -245,15 +284,19 @@ const ContentVectorSchema = z.discriminatedUnion("kind", [
|
|
|
245
284
|
z.object({
|
|
246
285
|
kind: z.literal("rect"),
|
|
247
286
|
frame: BoxSchema,
|
|
287
|
+
rotationDeg: z.number().optional(),
|
|
248
288
|
fill: ColorSchema.optional(),
|
|
249
289
|
stroke: ContentStrokeSchema.optional(),
|
|
290
|
+
paintOrder: z.number().optional(),
|
|
250
291
|
sourcePath: z.string().optional()
|
|
251
292
|
}),
|
|
252
293
|
z.object({
|
|
253
294
|
kind: z.literal("ellipse"),
|
|
254
295
|
frame: BoxSchema,
|
|
296
|
+
rotationDeg: z.number().optional(),
|
|
255
297
|
fill: ColorSchema.optional(),
|
|
256
298
|
stroke: ContentStrokeSchema.optional(),
|
|
299
|
+
paintOrder: z.number().optional(),
|
|
257
300
|
sourcePath: z.string().optional()
|
|
258
301
|
}),
|
|
259
302
|
z.object({
|
|
@@ -261,15 +304,18 @@ const ContentVectorSchema = z.discriminatedUnion("kind", [
|
|
|
261
304
|
from: ContentPathPointSchema,
|
|
262
305
|
to: ContentPathPointSchema,
|
|
263
306
|
stroke: ContentStrokeSchema,
|
|
307
|
+
paintOrder: z.number().optional(),
|
|
264
308
|
sourcePath: z.string().optional()
|
|
265
309
|
}),
|
|
266
310
|
z.object({
|
|
267
311
|
kind: z.literal("path"),
|
|
268
312
|
frame: BoxSchema,
|
|
313
|
+
rotationDeg: z.number().optional(),
|
|
269
314
|
subpaths: z.array(ContentSubpathSchema),
|
|
270
315
|
fill: ColorSchema.optional(),
|
|
271
316
|
fillRule: z.enum(["nonzero", "evenodd"]).optional(),
|
|
272
317
|
stroke: ContentStrokeSchema.optional(),
|
|
318
|
+
paintOrder: z.number().optional(),
|
|
273
319
|
sourcePath: z.string().optional()
|
|
274
320
|
})
|
|
275
321
|
]);
|
|
@@ -278,32 +324,42 @@ const ContentDrawPageSchema = z.object({
|
|
|
278
324
|
shapes: z.array(ContentShapeSchema),
|
|
279
325
|
vectors: z.array(ContentVectorSchema)
|
|
280
326
|
});
|
|
281
|
-
const
|
|
327
|
+
const ContentFormulaSchema = z.object({
|
|
328
|
+
mathml: z.array(MathMlNodeSchema),
|
|
329
|
+
starMath: z.string().optional()
|
|
330
|
+
});
|
|
331
|
+
const CONTENT_FORMAT_VERSION = 2;
|
|
282
332
|
const ContentDocumentSchema = z.discriminatedUnion("kind", [
|
|
283
333
|
z.object({
|
|
284
334
|
kind: z.literal("wordprocessing"),
|
|
285
|
-
formatVersion: z.literal(
|
|
335
|
+
formatVersion: z.literal(2),
|
|
286
336
|
metadata: LayoutMetadataSchema,
|
|
287
337
|
sections: z.array(ContentSectionSchema)
|
|
288
338
|
}),
|
|
289
339
|
z.object({
|
|
290
340
|
kind: z.literal("presentation"),
|
|
291
|
-
formatVersion: z.literal(
|
|
341
|
+
formatVersion: z.literal(2),
|
|
292
342
|
metadata: LayoutMetadataSchema,
|
|
293
343
|
slides: z.array(ContentSlideSchema)
|
|
294
344
|
}),
|
|
295
345
|
z.object({
|
|
296
346
|
kind: z.literal("spreadsheet"),
|
|
297
|
-
formatVersion: z.literal(
|
|
347
|
+
formatVersion: z.literal(2),
|
|
298
348
|
metadata: LayoutMetadataSchema,
|
|
299
349
|
sheets: z.array(ContentSheetSchema)
|
|
300
350
|
}),
|
|
301
351
|
z.object({
|
|
302
352
|
kind: z.literal("drawing"),
|
|
303
|
-
formatVersion: z.literal(
|
|
353
|
+
formatVersion: z.literal(2),
|
|
304
354
|
metadata: LayoutMetadataSchema,
|
|
305
355
|
pages: z.array(ContentDrawPageSchema)
|
|
356
|
+
}),
|
|
357
|
+
z.object({
|
|
358
|
+
kind: z.literal("formula"),
|
|
359
|
+
formatVersion: z.literal(2),
|
|
360
|
+
metadata: LayoutMetadataSchema,
|
|
361
|
+
formula: ContentFormulaSchema
|
|
306
362
|
})
|
|
307
363
|
]);
|
|
308
364
|
//#endregion
|
|
309
|
-
export { CONTENT_FORMAT_VERSION, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectSchema, ContentImageBlockSchema, ContentListMembershipSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetImageSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, isContentBlock };
|
|
365
|
+
export { CONTENT_FORMAT_VERSION, ContentBlockSchema, ContentBorderSchema, ContentCellBordersSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectSchema, ContentFormulaSchema, ContentImageBlockSchema, ContentListMembershipSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetImageSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentStrokeStyleSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, DecimalStringSchema, isContentBlock };
|
package/dist/index.cjs
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_color = require("./color.cjs");
|
|
3
3
|
const require_geometry = require("./geometry.cjs");
|
|
4
|
+
const require_mathml = require("./mathml.cjs");
|
|
4
5
|
const require_metadata = require("./metadata.cjs");
|
|
5
6
|
const require_style = require("./style.cjs");
|
|
6
7
|
const require_content = require("./content.cjs");
|
|
7
8
|
const require_layout = require("./layout.cjs");
|
|
8
9
|
const require_package = require("./package.cjs");
|
|
9
10
|
const require_schema_io = require("./schema-io.cjs");
|
|
11
|
+
const require_content_json_schema_defs = require("./content-json-schema-defs.cjs");
|
|
10
12
|
exports.AlignmentSchema = require_style.AlignmentSchema;
|
|
11
13
|
exports.BoxSchema = require_geometry.BoxSchema;
|
|
12
14
|
exports.COLOR_BLACK = require_color.COLOR_BLACK;
|
|
15
|
+
exports.CONTENT_DEFS = require_content_json_schema_defs.CONTENT_DEFS;
|
|
16
|
+
exports.CONTENT_DOCUMENT_URI = require_content_json_schema_defs.CONTENT_DOCUMENT_URI;
|
|
13
17
|
exports.CONTENT_FORMAT_VERSION = require_content.CONTENT_FORMAT_VERSION;
|
|
14
18
|
exports.ColorSchema = require_color.ColorSchema;
|
|
15
19
|
exports.ContentBlockSchema = require_content.ContentBlockSchema;
|
|
20
|
+
exports.ContentBorderSchema = require_content.ContentBorderSchema;
|
|
21
|
+
exports.ContentCellBordersSchema = require_content.ContentCellBordersSchema;
|
|
16
22
|
exports.ContentCellValueSchema = require_content.ContentCellValueSchema;
|
|
17
23
|
exports.ContentDocumentSchema = require_content.ContentDocumentSchema;
|
|
18
24
|
exports.ContentDrawPageSchema = require_content.ContentDrawPageSchema;
|
|
19
25
|
exports.ContentEmbeddedObjectBlockSchema = require_content.ContentEmbeddedObjectBlockSchema;
|
|
20
26
|
exports.ContentEmbeddedObjectSchema = require_content.ContentEmbeddedObjectSchema;
|
|
27
|
+
exports.ContentFormulaSchema = require_content.ContentFormulaSchema;
|
|
21
28
|
exports.ContentImageBlockSchema = require_content.ContentImageBlockSchema;
|
|
22
29
|
exports.ContentListMembershipSchema = require_content.ContentListMembershipSchema;
|
|
23
30
|
exports.ContentPageBreakSchema = require_content.ContentPageBreakSchema;
|
|
@@ -37,6 +44,7 @@ exports.ContentSheetRowSchema = require_content.ContentSheetRowSchema;
|
|
|
37
44
|
exports.ContentSheetSchema = require_content.ContentSheetSchema;
|
|
38
45
|
exports.ContentSlideSchema = require_content.ContentSlideSchema;
|
|
39
46
|
exports.ContentStrokeSchema = require_content.ContentStrokeSchema;
|
|
47
|
+
exports.ContentStrokeStyleSchema = require_content.ContentStrokeStyleSchema;
|
|
40
48
|
exports.ContentSubpathSchema = require_content.ContentSubpathSchema;
|
|
41
49
|
exports.ContentTableCellSchema = require_content.ContentTableCellSchema;
|
|
42
50
|
exports.ContentTableRowSchema = require_content.ContentTableRowSchema;
|
|
@@ -44,7 +52,9 @@ exports.ContentTableSchema = require_content.ContentTableSchema;
|
|
|
44
52
|
exports.ContentVectorSchema = require_content.ContentVectorSchema;
|
|
45
53
|
exports.DEFAULT_LAYOUT_FONT = require_style.DEFAULT_LAYOUT_FONT;
|
|
46
54
|
exports.DOCUMENT_PACKAGE_FORMAT_VERSION = require_package.DOCUMENT_PACKAGE_FORMAT_VERSION;
|
|
55
|
+
exports.DecimalStringSchema = require_content.DecimalStringSchema;
|
|
47
56
|
exports.DocumentPackageSchema = require_package.DocumentPackageSchema;
|
|
57
|
+
exports.EMBEDDED_OBJECT_KINDS = require_content_json_schema_defs.EMBEDDED_OBJECT_KINDS;
|
|
48
58
|
exports.LAYOUT_FORMAT_VERSION = require_layout.LAYOUT_FORMAT_VERSION;
|
|
49
59
|
exports.LayoutDocumentSchema = require_layout.LayoutDocumentSchema;
|
|
50
60
|
exports.LayoutEllipseSchema = require_layout.LayoutEllipseSchema;
|
|
@@ -61,7 +71,16 @@ exports.LayoutPathSegmentSchema = require_layout.LayoutPathSegmentSchema;
|
|
|
61
71
|
exports.LayoutRectSchema = require_layout.LayoutRectSchema;
|
|
62
72
|
exports.LayoutSubpathSchema = require_layout.LayoutSubpathSchema;
|
|
63
73
|
exports.LayoutTextSchema = require_layout.LayoutTextSchema;
|
|
74
|
+
exports.MAX_SAFE_INTEGER = require_content_json_schema_defs.MAX_SAFE_INTEGER;
|
|
64
75
|
exports.MarginsSchema = require_geometry.MarginsSchema;
|
|
76
|
+
exports.MathMlAttributeSchema = require_mathml.MathMlAttributeSchema;
|
|
77
|
+
exports.MathMlCdataSchema = require_mathml.MathMlCdataSchema;
|
|
78
|
+
exports.MathMlCommentSchema = require_mathml.MathMlCommentSchema;
|
|
79
|
+
exports.MathMlDeclarationSchema = require_mathml.MathMlDeclarationSchema;
|
|
80
|
+
exports.MathMlElementSchema = require_mathml.MathMlElementSchema;
|
|
81
|
+
exports.MathMlNodeSchema = require_mathml.MathMlNodeSchema;
|
|
82
|
+
exports.MathMlPiSchema = require_mathml.MathMlPiSchema;
|
|
83
|
+
exports.MathMlTextSchema = require_mathml.MathMlTextSchema;
|
|
65
84
|
exports.PAGE_SIZE_A4 = require_geometry.PAGE_SIZE_A4;
|
|
66
85
|
exports.PAGE_SIZE_LETTER = require_geometry.PAGE_SIZE_LETTER;
|
|
67
86
|
exports.PageSizeSchema = require_geometry.PageSizeSchema;
|
|
@@ -75,6 +94,7 @@ exports.documentFromJson = require_schema_io.documentFromJson;
|
|
|
75
94
|
exports.documentPackageWithSchema = require_schema_io.documentPackageWithSchema;
|
|
76
95
|
exports.documentSchemaKindOf = require_schema_io.documentSchemaKindOf;
|
|
77
96
|
exports.isContentBlock = require_content.isContentBlock;
|
|
97
|
+
exports.isMathMlNode = require_mathml.isMathMlNode;
|
|
78
98
|
exports.layoutDocumentWithSchema = require_schema_io.layoutDocumentWithSchema;
|
|
79
99
|
exports.rgbHexToColor = require_color.rgbHexToColor;
|
|
80
100
|
exports.schemaUriFor = require_schema_io.schemaUriFor;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { a as rgbHexToColor, i as colorToRgbHex, n as Color, r as ColorSchema, t as COLOR_BLACK } from "./color-AELCDH_b.cjs";
|
|
2
|
+
import { CONTENT_DEFS, CONTENT_DOCUMENT_URI, EMBEDDED_OBJECT_KINDS, MAX_SAFE_INTEGER } from "./content-json-schema-defs.cjs";
|
|
3
|
+
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
4
|
import { a as PAGE_SIZE_A4, c as PageSizeSchema, i as MarginsSchema, l as SLIDE_SIZE_STANDARD, n as BoxSchema, o as PAGE_SIZE_LETTER, r as Margins, s as PageSize, t as Box, u as SLIDE_SIZE_WIDESCREEN } from "./geometry-CokwQGtJ.cjs";
|
|
3
|
-
import { CONTENT_FORMAT_VERSION, ContentBlock, ContentBlockSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentEmbeddedObject, ContentEmbeddedObjectBlock, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectKind, ContentEmbeddedObjectSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentVector, ContentVectorSchema, isContentBlock } from "./content.cjs";
|
|
5
|
+
import { CONTENT_FORMAT_VERSION, ContentBlock, ContentBlockSchema, ContentBorder, ContentBorderSchema, ContentCellBorders, ContentCellBordersSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentEmbeddedObject, ContentEmbeddedObjectBlock, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectKind, ContentEmbeddedObjectSchema, ContentFormula, ContentFormulaSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeSchema, ContentStrokeStyle, ContentStrokeStyleSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentVector, ContentVectorSchema, DecimalString, DecimalStringSchema, isContentBlock } from "./content.cjs";
|
|
4
6
|
import { Alignment, AlignmentSchema, DEFAULT_LAYOUT_FONT, LayoutFont, LayoutFontSchema } from "./style.cjs";
|
|
5
7
|
import { LayoutMetadata, LayoutMetadataSchema } from "./metadata.cjs";
|
|
6
8
|
import { LAYOUT_FORMAT_VERSION, LayoutDocument, LayoutDocumentSchema, LayoutEllipse, LayoutEllipseSchema, LayoutImage, LayoutImageAsset, LayoutImageAssetSchema, LayoutImageSchema, LayoutItem, LayoutItemSchema, LayoutLine, LayoutLineSchema, LayoutLink, LayoutLinkSchema, LayoutPage, LayoutPageSchema, LayoutPath, LayoutPathSchema, LayoutPathSegment, LayoutPathSegmentSchema, LayoutRect, LayoutRectSchema, LayoutSubpath, LayoutSubpathSchema, LayoutText, LayoutTextSchema } from "./layout.cjs";
|
|
7
9
|
import { DOCUMENT_PACKAGE_FORMAT_VERSION, DocumentPackage, DocumentPackageSchema } from "./package.cjs";
|
|
8
10
|
import { ContentDocumentJson, DocumentJsonResult, DocumentPackageJson, DocumentSchemaKind, LayoutDocumentJson, SCHEMA_FILE_NAMES, UnrecognizedDocumentSchemaError, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, layoutDocumentWithSchema, schemaUriFor } from "./schema-io.cjs";
|
|
9
|
-
export { Alignment, AlignmentSchema, Box, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, Color, ColorSchema, ContentBlock, ContentBlockSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocumentJson, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentEmbeddedObject, ContentEmbeddedObjectBlock, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectKind, ContentEmbeddedObjectSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentVector, ContentVectorSchema, DEFAULT_LAYOUT_FONT, DOCUMENT_PACKAGE_FORMAT_VERSION, DocumentJsonResult, DocumentPackage, DocumentPackageJson, DocumentPackageSchema, DocumentSchemaKind, LAYOUT_FORMAT_VERSION, LayoutDocument, LayoutDocumentJson, LayoutDocumentSchema, LayoutEllipse, LayoutEllipseSchema, LayoutFont, LayoutFontSchema, LayoutImage, LayoutImageAsset, LayoutImageAssetSchema, LayoutImageSchema, LayoutItem, LayoutItemSchema, LayoutLine, LayoutLineSchema, LayoutLink, LayoutLinkSchema, LayoutMetadata, LayoutMetadataSchema, LayoutPage, LayoutPageSchema, LayoutPath, LayoutPathSchema, LayoutPathSegment, LayoutPathSegmentSchema, LayoutRect, LayoutRectSchema, LayoutSubpath, LayoutSubpathSchema, LayoutText, LayoutTextSchema, Margins, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PageSizeSchema, SCHEMA_FILE_NAMES, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, UnrecognizedDocumentSchemaError, colorToRgbHex, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, isContentBlock, layoutDocumentWithSchema, rgbHexToColor, schemaUriFor };
|
|
11
|
+
export { Alignment, AlignmentSchema, Box, BoxSchema, COLOR_BLACK, CONTENT_DEFS, CONTENT_DOCUMENT_URI, CONTENT_FORMAT_VERSION, Color, ColorSchema, ContentBlock, ContentBlockSchema, ContentBorder, ContentBorderSchema, ContentCellBorders, ContentCellBordersSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocumentJson, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentEmbeddedObject, ContentEmbeddedObjectBlock, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectKind, ContentEmbeddedObjectSchema, ContentFormula, ContentFormulaSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeSchema, ContentStrokeStyle, ContentStrokeStyleSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentVector, ContentVectorSchema, DEFAULT_LAYOUT_FONT, DOCUMENT_PACKAGE_FORMAT_VERSION, DecimalString, DecimalStringSchema, DocumentJsonResult, DocumentPackage, DocumentPackageJson, DocumentPackageSchema, DocumentSchemaKind, EMBEDDED_OBJECT_KINDS, LAYOUT_FORMAT_VERSION, LayoutDocument, LayoutDocumentJson, LayoutDocumentSchema, LayoutEllipse, LayoutEllipseSchema, LayoutFont, LayoutFontSchema, LayoutImage, LayoutImageAsset, LayoutImageAssetSchema, LayoutImageSchema, LayoutItem, LayoutItemSchema, LayoutLine, LayoutLineSchema, LayoutLink, LayoutLinkSchema, LayoutMetadata, LayoutMetadataSchema, LayoutPage, LayoutPageSchema, LayoutPath, LayoutPathSchema, LayoutPathSegment, LayoutPathSegmentSchema, LayoutRect, LayoutRectSchema, LayoutSubpath, LayoutSubpathSchema, LayoutText, LayoutTextSchema, MAX_SAFE_INTEGER, Margins, MarginsSchema, MathMlAttribute, MathMlAttributeSchema, MathMlCdata, MathMlCdataSchema, MathMlComment, MathMlCommentSchema, MathMlDeclaration, MathMlDeclarationSchema, MathMlElement, MathMlElementSchema, MathMlNode, MathMlNodeSchema, MathMlPi, MathMlPiSchema, MathMlText, MathMlTextSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PageSizeSchema, SCHEMA_FILE_NAMES, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, UnrecognizedDocumentSchemaError, colorToRgbHex, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, isContentBlock, isMathMlNode, layoutDocumentWithSchema, rgbHexToColor, schemaUriFor };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { a as rgbHexToColor, i as colorToRgbHex, n as Color, r as ColorSchema, t as COLOR_BLACK } from "./color-AELCDH_b.js";
|
|
2
|
+
import { CONTENT_DEFS, CONTENT_DOCUMENT_URI, EMBEDDED_OBJECT_KINDS, MAX_SAFE_INTEGER } from "./content-json-schema-defs.js";
|
|
3
|
+
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
4
|
import { a as PAGE_SIZE_A4, c as PageSizeSchema, i as MarginsSchema, l as SLIDE_SIZE_STANDARD, n as BoxSchema, o as PAGE_SIZE_LETTER, r as Margins, s as PageSize, t as Box, u as SLIDE_SIZE_WIDESCREEN } from "./geometry-CokwQGtJ.js";
|
|
3
|
-
import { CONTENT_FORMAT_VERSION, ContentBlock, ContentBlockSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentEmbeddedObject, ContentEmbeddedObjectBlock, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectKind, ContentEmbeddedObjectSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentVector, ContentVectorSchema, isContentBlock } from "./content.js";
|
|
5
|
+
import { CONTENT_FORMAT_VERSION, ContentBlock, ContentBlockSchema, ContentBorder, ContentBorderSchema, ContentCellBorders, ContentCellBordersSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentEmbeddedObject, ContentEmbeddedObjectBlock, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectKind, ContentEmbeddedObjectSchema, ContentFormula, ContentFormulaSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeSchema, ContentStrokeStyle, ContentStrokeStyleSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentVector, ContentVectorSchema, DecimalString, DecimalStringSchema, isContentBlock } from "./content.js";
|
|
4
6
|
import { Alignment, AlignmentSchema, DEFAULT_LAYOUT_FONT, LayoutFont, LayoutFontSchema } from "./style.js";
|
|
5
7
|
import { LayoutMetadata, LayoutMetadataSchema } from "./metadata.js";
|
|
6
8
|
import { LAYOUT_FORMAT_VERSION, LayoutDocument, LayoutDocumentSchema, LayoutEllipse, LayoutEllipseSchema, LayoutImage, LayoutImageAsset, LayoutImageAssetSchema, LayoutImageSchema, LayoutItem, LayoutItemSchema, LayoutLine, LayoutLineSchema, LayoutLink, LayoutLinkSchema, LayoutPage, LayoutPageSchema, LayoutPath, LayoutPathSchema, LayoutPathSegment, LayoutPathSegmentSchema, LayoutRect, LayoutRectSchema, LayoutSubpath, LayoutSubpathSchema, LayoutText, LayoutTextSchema } from "./layout.js";
|
|
7
9
|
import { DOCUMENT_PACKAGE_FORMAT_VERSION, DocumentPackage, DocumentPackageSchema } from "./package.js";
|
|
8
10
|
import { ContentDocumentJson, DocumentJsonResult, DocumentPackageJson, DocumentSchemaKind, LayoutDocumentJson, SCHEMA_FILE_NAMES, UnrecognizedDocumentSchemaError, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, layoutDocumentWithSchema, schemaUriFor } from "./schema-io.js";
|
|
9
|
-
export { Alignment, AlignmentSchema, Box, BoxSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, Color, ColorSchema, ContentBlock, ContentBlockSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocumentJson, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentEmbeddedObject, ContentEmbeddedObjectBlock, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectKind, ContentEmbeddedObjectSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentVector, ContentVectorSchema, DEFAULT_LAYOUT_FONT, DOCUMENT_PACKAGE_FORMAT_VERSION, DocumentJsonResult, DocumentPackage, DocumentPackageJson, DocumentPackageSchema, DocumentSchemaKind, LAYOUT_FORMAT_VERSION, LayoutDocument, LayoutDocumentJson, LayoutDocumentSchema, LayoutEllipse, LayoutEllipseSchema, LayoutFont, LayoutFontSchema, LayoutImage, LayoutImageAsset, LayoutImageAssetSchema, LayoutImageSchema, LayoutItem, LayoutItemSchema, LayoutLine, LayoutLineSchema, LayoutLink, LayoutLinkSchema, LayoutMetadata, LayoutMetadataSchema, LayoutPage, LayoutPageSchema, LayoutPath, LayoutPathSchema, LayoutPathSegment, LayoutPathSegmentSchema, LayoutRect, LayoutRectSchema, LayoutSubpath, LayoutSubpathSchema, LayoutText, LayoutTextSchema, Margins, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PageSizeSchema, SCHEMA_FILE_NAMES, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, UnrecognizedDocumentSchemaError, colorToRgbHex, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, isContentBlock, layoutDocumentWithSchema, rgbHexToColor, schemaUriFor };
|
|
11
|
+
export { Alignment, AlignmentSchema, Box, BoxSchema, COLOR_BLACK, CONTENT_DEFS, CONTENT_DOCUMENT_URI, CONTENT_FORMAT_VERSION, Color, ColorSchema, ContentBlock, ContentBlockSchema, ContentBorder, ContentBorderSchema, ContentCellBorders, ContentCellBordersSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocumentJson, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentEmbeddedObject, ContentEmbeddedObjectBlock, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectKind, ContentEmbeddedObjectSchema, ContentFormula, ContentFormulaSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeSchema, ContentStrokeStyle, ContentStrokeStyleSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentVector, ContentVectorSchema, DEFAULT_LAYOUT_FONT, DOCUMENT_PACKAGE_FORMAT_VERSION, DecimalString, DecimalStringSchema, DocumentJsonResult, DocumentPackage, DocumentPackageJson, DocumentPackageSchema, DocumentSchemaKind, EMBEDDED_OBJECT_KINDS, LAYOUT_FORMAT_VERSION, LayoutDocument, LayoutDocumentJson, LayoutDocumentSchema, LayoutEllipse, LayoutEllipseSchema, LayoutFont, LayoutFontSchema, LayoutImage, LayoutImageAsset, LayoutImageAssetSchema, LayoutImageSchema, LayoutItem, LayoutItemSchema, LayoutLine, LayoutLineSchema, LayoutLink, LayoutLinkSchema, LayoutMetadata, LayoutMetadataSchema, LayoutPage, LayoutPageSchema, LayoutPath, LayoutPathSchema, LayoutPathSegment, LayoutPathSegmentSchema, LayoutRect, LayoutRectSchema, LayoutSubpath, LayoutSubpathSchema, LayoutText, LayoutTextSchema, MAX_SAFE_INTEGER, Margins, MarginsSchema, MathMlAttribute, MathMlAttributeSchema, MathMlCdata, MathMlCdataSchema, MathMlComment, MathMlCommentSchema, MathMlDeclaration, MathMlDeclarationSchema, MathMlElement, MathMlElementSchema, MathMlNode, MathMlNodeSchema, MathMlPi, MathMlPiSchema, MathMlText, MathMlTextSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PageSizeSchema, SCHEMA_FILE_NAMES, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, UnrecognizedDocumentSchemaError, colorToRgbHex, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, isContentBlock, isMathMlNode, layoutDocumentWithSchema, rgbHexToColor, schemaUriFor };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { COLOR_BLACK, ColorSchema, colorToRgbHex, rgbHexToColor } from "./color.js";
|
|
2
2
|
import { BoxSchema, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN } from "./geometry.js";
|
|
3
|
+
import { MathMlAttributeSchema, MathMlCdataSchema, MathMlCommentSchema, MathMlDeclarationSchema, MathMlElementSchema, MathMlNodeSchema, MathMlPiSchema, MathMlTextSchema, isMathMlNode } from "./mathml.js";
|
|
3
4
|
import { LayoutMetadataSchema } from "./metadata.js";
|
|
4
5
|
import { AlignmentSchema, DEFAULT_LAYOUT_FONT, LayoutFontSchema } from "./style.js";
|
|
5
|
-
import { CONTENT_FORMAT_VERSION, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectSchema, ContentImageBlockSchema, ContentListMembershipSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetImageSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, isContentBlock } from "./content.js";
|
|
6
|
+
import { CONTENT_FORMAT_VERSION, ContentBlockSchema, ContentBorderSchema, ContentCellBordersSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectSchema, ContentFormulaSchema, ContentImageBlockSchema, ContentListMembershipSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetImageSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentStrokeStyleSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, DecimalStringSchema, isContentBlock } from "./content.js";
|
|
6
7
|
import { LAYOUT_FORMAT_VERSION, LayoutDocumentSchema, LayoutEllipseSchema, LayoutImageAssetSchema, LayoutImageSchema, LayoutItemSchema, LayoutLineSchema, LayoutLinkSchema, LayoutPageSchema, LayoutPathSchema, LayoutPathSegmentSchema, LayoutRectSchema, LayoutSubpathSchema, LayoutTextSchema } from "./layout.js";
|
|
7
8
|
import { DOCUMENT_PACKAGE_FORMAT_VERSION, DocumentPackageSchema } from "./package.js";
|
|
8
9
|
import { SCHEMA_FILE_NAMES, UnrecognizedDocumentSchemaError, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, layoutDocumentWithSchema, schemaUriFor } from "./schema-io.js";
|
|
9
|
-
|
|
10
|
+
import { CONTENT_DEFS, CONTENT_DOCUMENT_URI, EMBEDDED_OBJECT_KINDS, MAX_SAFE_INTEGER } from "./content-json-schema-defs.js";
|
|
11
|
+
export { AlignmentSchema, BoxSchema, COLOR_BLACK, CONTENT_DEFS, CONTENT_DOCUMENT_URI, CONTENT_FORMAT_VERSION, ColorSchema, ContentBlockSchema, ContentBorderSchema, ContentCellBordersSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectSchema, ContentFormulaSchema, ContentImageBlockSchema, ContentListMembershipSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetImageSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentStrokeStyleSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, DEFAULT_LAYOUT_FONT, DOCUMENT_PACKAGE_FORMAT_VERSION, DecimalStringSchema, DocumentPackageSchema, EMBEDDED_OBJECT_KINDS, LAYOUT_FORMAT_VERSION, LayoutDocumentSchema, LayoutEllipseSchema, LayoutFontSchema, LayoutImageAssetSchema, LayoutImageSchema, LayoutItemSchema, LayoutLineSchema, LayoutLinkSchema, LayoutMetadataSchema, LayoutPageSchema, LayoutPathSchema, LayoutPathSegmentSchema, LayoutRectSchema, LayoutSubpathSchema, LayoutTextSchema, MAX_SAFE_INTEGER, MarginsSchema, MathMlAttributeSchema, MathMlCdataSchema, MathMlCommentSchema, MathMlDeclarationSchema, MathMlElementSchema, MathMlNodeSchema, MathMlPiSchema, MathMlTextSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSizeSchema, SCHEMA_FILE_NAMES, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, UnrecognizedDocumentSchemaError, colorToRgbHex, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, isContentBlock, isMathMlNode, layoutDocumentWithSchema, rgbHexToColor, schemaUriFor };
|
|
@@ -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 };
|
package/dist/mathml.cjs
ADDED
|
@@ -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 };
|
package/dist/mathml.d.ts
ADDED
|
@@ -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 };
|