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
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { schemaUriFor } from "./schema-io.js";
|
|
2
|
+
//#region src/content-json-schema-defs.ts
|
|
3
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
|
4
|
+
const EMBEDDED_OBJECT_KINDS = [
|
|
5
|
+
"formula",
|
|
6
|
+
"wordprocessing",
|
|
7
|
+
"presentation",
|
|
8
|
+
"spreadsheet",
|
|
9
|
+
"drawing"
|
|
10
|
+
];
|
|
11
|
+
const CONTENT_DOCUMENT_URI = schemaUriFor("ContentDocument");
|
|
12
|
+
const CONTENT_DEFS = {
|
|
13
|
+
Color: {
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
r: {
|
|
17
|
+
type: "number",
|
|
18
|
+
minimum: 0,
|
|
19
|
+
maximum: 1
|
|
20
|
+
},
|
|
21
|
+
g: {
|
|
22
|
+
type: "number",
|
|
23
|
+
minimum: 0,
|
|
24
|
+
maximum: 1
|
|
25
|
+
},
|
|
26
|
+
b: {
|
|
27
|
+
type: "number",
|
|
28
|
+
minimum: 0,
|
|
29
|
+
maximum: 1
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
required: [
|
|
33
|
+
"r",
|
|
34
|
+
"g",
|
|
35
|
+
"b"
|
|
36
|
+
],
|
|
37
|
+
additionalProperties: false
|
|
38
|
+
},
|
|
39
|
+
Box: {
|
|
40
|
+
type: "object",
|
|
41
|
+
properties: {
|
|
42
|
+
xPt: { type: "number" },
|
|
43
|
+
yPt: { type: "number" },
|
|
44
|
+
widthPt: {
|
|
45
|
+
type: "number",
|
|
46
|
+
minimum: 0
|
|
47
|
+
},
|
|
48
|
+
heightPt: {
|
|
49
|
+
type: "number",
|
|
50
|
+
minimum: 0
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
required: [
|
|
54
|
+
"xPt",
|
|
55
|
+
"yPt",
|
|
56
|
+
"widthPt",
|
|
57
|
+
"heightPt"
|
|
58
|
+
],
|
|
59
|
+
additionalProperties: false
|
|
60
|
+
},
|
|
61
|
+
Alignment: {
|
|
62
|
+
type: "string",
|
|
63
|
+
enum: [
|
|
64
|
+
"left",
|
|
65
|
+
"center",
|
|
66
|
+
"right",
|
|
67
|
+
"justify"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
ContentStrokeStyle: {
|
|
71
|
+
type: "string",
|
|
72
|
+
enum: [
|
|
73
|
+
"solid",
|
|
74
|
+
"dashed",
|
|
75
|
+
"dotted",
|
|
76
|
+
"double"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
ContentBorder: {
|
|
80
|
+
type: "object",
|
|
81
|
+
properties: {
|
|
82
|
+
color: { $ref: "#/$defs/Color" },
|
|
83
|
+
widthPt: {
|
|
84
|
+
type: "number",
|
|
85
|
+
exclusiveMinimum: 0
|
|
86
|
+
},
|
|
87
|
+
style: { $ref: "#/$defs/ContentStrokeStyle" }
|
|
88
|
+
},
|
|
89
|
+
required: ["color", "widthPt"],
|
|
90
|
+
additionalProperties: false
|
|
91
|
+
},
|
|
92
|
+
ContentCellBorders: {
|
|
93
|
+
type: "object",
|
|
94
|
+
properties: {
|
|
95
|
+
left: { $ref: "#/$defs/ContentBorder" },
|
|
96
|
+
right: { $ref: "#/$defs/ContentBorder" },
|
|
97
|
+
top: { $ref: "#/$defs/ContentBorder" },
|
|
98
|
+
bottom: { $ref: "#/$defs/ContentBorder" }
|
|
99
|
+
},
|
|
100
|
+
additionalProperties: false
|
|
101
|
+
},
|
|
102
|
+
ContentListMembership: {
|
|
103
|
+
type: "object",
|
|
104
|
+
properties: {
|
|
105
|
+
numId: { type: "string" },
|
|
106
|
+
level: {
|
|
107
|
+
type: "integer",
|
|
108
|
+
minimum: 0,
|
|
109
|
+
maximum: MAX_SAFE_INTEGER
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
required: ["numId", "level"],
|
|
113
|
+
additionalProperties: false
|
|
114
|
+
},
|
|
115
|
+
ContentRun: {
|
|
116
|
+
type: "object",
|
|
117
|
+
properties: {
|
|
118
|
+
text: { type: "string" },
|
|
119
|
+
bold: { type: "boolean" },
|
|
120
|
+
italic: { type: "boolean" },
|
|
121
|
+
underline: { type: "boolean" },
|
|
122
|
+
strike: { type: "boolean" },
|
|
123
|
+
fontFamily: { type: "string" },
|
|
124
|
+
sizePt: {
|
|
125
|
+
type: "number",
|
|
126
|
+
exclusiveMinimum: 0
|
|
127
|
+
},
|
|
128
|
+
color: { $ref: "#/$defs/Color" },
|
|
129
|
+
hyperlink: { type: "string" },
|
|
130
|
+
sourcePath: { type: "string" }
|
|
131
|
+
},
|
|
132
|
+
required: ["text"],
|
|
133
|
+
additionalProperties: false
|
|
134
|
+
},
|
|
135
|
+
ContentParagraph: {
|
|
136
|
+
type: "object",
|
|
137
|
+
properties: {
|
|
138
|
+
kind: {
|
|
139
|
+
type: "string",
|
|
140
|
+
const: "paragraph"
|
|
141
|
+
},
|
|
142
|
+
runs: {
|
|
143
|
+
type: "array",
|
|
144
|
+
items: { $ref: "#/$defs/ContentRun" }
|
|
145
|
+
},
|
|
146
|
+
styleId: { type: "string" },
|
|
147
|
+
alignment: { $ref: "#/$defs/Alignment" },
|
|
148
|
+
list: { $ref: "#/$defs/ContentListMembership" },
|
|
149
|
+
spacingBeforePt: { type: "number" },
|
|
150
|
+
spacingAfterPt: { type: "number" },
|
|
151
|
+
lineSpacing: {
|
|
152
|
+
type: "number",
|
|
153
|
+
exclusiveMinimum: 0
|
|
154
|
+
},
|
|
155
|
+
indentLeftPt: { type: "number" },
|
|
156
|
+
indentFirstLinePt: { type: "number" },
|
|
157
|
+
sourcePath: { type: "string" }
|
|
158
|
+
},
|
|
159
|
+
required: ["kind", "runs"],
|
|
160
|
+
additionalProperties: false
|
|
161
|
+
},
|
|
162
|
+
ContentImageBlock: {
|
|
163
|
+
type: "object",
|
|
164
|
+
properties: {
|
|
165
|
+
kind: {
|
|
166
|
+
type: "string",
|
|
167
|
+
const: "image"
|
|
168
|
+
},
|
|
169
|
+
format: {
|
|
170
|
+
type: "string",
|
|
171
|
+
enum: ["png", "jpeg"]
|
|
172
|
+
},
|
|
173
|
+
base64: { type: "string" },
|
|
174
|
+
widthPt: {
|
|
175
|
+
type: "number",
|
|
176
|
+
exclusiveMinimum: 0
|
|
177
|
+
},
|
|
178
|
+
heightPt: {
|
|
179
|
+
type: "number",
|
|
180
|
+
exclusiveMinimum: 0
|
|
181
|
+
},
|
|
182
|
+
altText: { type: "string" },
|
|
183
|
+
sourcePath: { type: "string" }
|
|
184
|
+
},
|
|
185
|
+
required: [
|
|
186
|
+
"kind",
|
|
187
|
+
"format",
|
|
188
|
+
"base64",
|
|
189
|
+
"widthPt",
|
|
190
|
+
"heightPt"
|
|
191
|
+
],
|
|
192
|
+
additionalProperties: false
|
|
193
|
+
},
|
|
194
|
+
ContentPageBreak: {
|
|
195
|
+
type: "object",
|
|
196
|
+
properties: {
|
|
197
|
+
kind: {
|
|
198
|
+
type: "string",
|
|
199
|
+
const: "pageBreak"
|
|
200
|
+
},
|
|
201
|
+
sourcePath: { type: "string" }
|
|
202
|
+
},
|
|
203
|
+
required: ["kind"],
|
|
204
|
+
additionalProperties: false
|
|
205
|
+
},
|
|
206
|
+
ContentTableCell: {
|
|
207
|
+
type: "object",
|
|
208
|
+
properties: {
|
|
209
|
+
blocks: {
|
|
210
|
+
type: "array",
|
|
211
|
+
items: { $ref: "#/$defs/ContentBlock" }
|
|
212
|
+
},
|
|
213
|
+
colSpan: {
|
|
214
|
+
type: "integer",
|
|
215
|
+
exclusiveMinimum: 0,
|
|
216
|
+
maximum: MAX_SAFE_INTEGER
|
|
217
|
+
},
|
|
218
|
+
rowSpan: {
|
|
219
|
+
type: "integer",
|
|
220
|
+
exclusiveMinimum: 0,
|
|
221
|
+
maximum: MAX_SAFE_INTEGER
|
|
222
|
+
},
|
|
223
|
+
background: { $ref: "#/$defs/Color" },
|
|
224
|
+
borders: { $ref: "#/$defs/ContentCellBorders" },
|
|
225
|
+
sourcePath: { type: "string" }
|
|
226
|
+
},
|
|
227
|
+
required: ["blocks"],
|
|
228
|
+
additionalProperties: false
|
|
229
|
+
},
|
|
230
|
+
ContentTableRow: {
|
|
231
|
+
type: "object",
|
|
232
|
+
properties: {
|
|
233
|
+
cells: {
|
|
234
|
+
type: "array",
|
|
235
|
+
items: { $ref: "#/$defs/ContentTableCell" }
|
|
236
|
+
},
|
|
237
|
+
heightPt: {
|
|
238
|
+
type: "number",
|
|
239
|
+
exclusiveMinimum: 0
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
required: ["cells"],
|
|
243
|
+
additionalProperties: false
|
|
244
|
+
},
|
|
245
|
+
ContentTable: {
|
|
246
|
+
type: "object",
|
|
247
|
+
properties: {
|
|
248
|
+
kind: {
|
|
249
|
+
type: "string",
|
|
250
|
+
const: "table"
|
|
251
|
+
},
|
|
252
|
+
rows: {
|
|
253
|
+
type: "array",
|
|
254
|
+
items: { $ref: "#/$defs/ContentTableRow" }
|
|
255
|
+
},
|
|
256
|
+
columnWidthsPt: {
|
|
257
|
+
type: "array",
|
|
258
|
+
items: {
|
|
259
|
+
type: "number",
|
|
260
|
+
exclusiveMinimum: 0
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
sourcePath: { type: "string" }
|
|
264
|
+
},
|
|
265
|
+
required: [
|
|
266
|
+
"kind",
|
|
267
|
+
"rows",
|
|
268
|
+
"columnWidthsPt"
|
|
269
|
+
],
|
|
270
|
+
additionalProperties: false
|
|
271
|
+
},
|
|
272
|
+
ContentEmbeddedObjectBlock: {
|
|
273
|
+
type: "object",
|
|
274
|
+
properties: {
|
|
275
|
+
kind: {
|
|
276
|
+
type: "string",
|
|
277
|
+
const: "embeddedObject"
|
|
278
|
+
},
|
|
279
|
+
objectKind: {
|
|
280
|
+
type: "string",
|
|
281
|
+
enum: EMBEDDED_OBJECT_KINDS
|
|
282
|
+
},
|
|
283
|
+
document: { $ref: CONTENT_DOCUMENT_URI },
|
|
284
|
+
frame: { $ref: "#/$defs/Box" },
|
|
285
|
+
sourcePath: { type: "string" }
|
|
286
|
+
},
|
|
287
|
+
required: [
|
|
288
|
+
"kind",
|
|
289
|
+
"objectKind",
|
|
290
|
+
"document",
|
|
291
|
+
"frame"
|
|
292
|
+
],
|
|
293
|
+
additionalProperties: false
|
|
294
|
+
},
|
|
295
|
+
ContentBlock: { oneOf: [
|
|
296
|
+
{ $ref: "#/$defs/ContentParagraph" },
|
|
297
|
+
{ $ref: "#/$defs/ContentTable" },
|
|
298
|
+
{ $ref: "#/$defs/ContentImageBlock" },
|
|
299
|
+
{ $ref: "#/$defs/ContentPageBreak" },
|
|
300
|
+
{ $ref: "#/$defs/ContentEmbeddedObjectBlock" }
|
|
301
|
+
] },
|
|
302
|
+
MathMlAttribute: {
|
|
303
|
+
type: "object",
|
|
304
|
+
properties: {
|
|
305
|
+
name: { type: "string" },
|
|
306
|
+
value: { type: "string" }
|
|
307
|
+
},
|
|
308
|
+
required: ["name", "value"],
|
|
309
|
+
additionalProperties: false
|
|
310
|
+
},
|
|
311
|
+
MathMlElement: {
|
|
312
|
+
type: "object",
|
|
313
|
+
properties: {
|
|
314
|
+
type: {
|
|
315
|
+
type: "string",
|
|
316
|
+
const: "element"
|
|
317
|
+
},
|
|
318
|
+
tag: { type: "string" },
|
|
319
|
+
attributes: {
|
|
320
|
+
type: "array",
|
|
321
|
+
items: { $ref: "#/$defs/MathMlAttribute" }
|
|
322
|
+
},
|
|
323
|
+
children: {
|
|
324
|
+
type: "array",
|
|
325
|
+
items: { $ref: "#/$defs/MathMlNode" }
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
required: [
|
|
329
|
+
"type",
|
|
330
|
+
"tag",
|
|
331
|
+
"attributes",
|
|
332
|
+
"children"
|
|
333
|
+
],
|
|
334
|
+
additionalProperties: false
|
|
335
|
+
},
|
|
336
|
+
MathMlNode: { oneOf: [
|
|
337
|
+
{
|
|
338
|
+
type: "object",
|
|
339
|
+
properties: {
|
|
340
|
+
type: {
|
|
341
|
+
type: "string",
|
|
342
|
+
const: "text"
|
|
343
|
+
},
|
|
344
|
+
value: { type: "string" }
|
|
345
|
+
},
|
|
346
|
+
required: ["type", "value"],
|
|
347
|
+
additionalProperties: false
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
type: "object",
|
|
351
|
+
properties: {
|
|
352
|
+
type: {
|
|
353
|
+
type: "string",
|
|
354
|
+
const: "cdata"
|
|
355
|
+
},
|
|
356
|
+
value: { type: "string" }
|
|
357
|
+
},
|
|
358
|
+
required: ["type", "value"],
|
|
359
|
+
additionalProperties: false
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
type: "object",
|
|
363
|
+
properties: {
|
|
364
|
+
type: {
|
|
365
|
+
type: "string",
|
|
366
|
+
const: "comment"
|
|
367
|
+
},
|
|
368
|
+
value: { type: "string" }
|
|
369
|
+
},
|
|
370
|
+
required: ["type", "value"],
|
|
371
|
+
additionalProperties: false
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
type: "object",
|
|
375
|
+
properties: {
|
|
376
|
+
type: {
|
|
377
|
+
type: "string",
|
|
378
|
+
const: "declaration"
|
|
379
|
+
},
|
|
380
|
+
attributes: {
|
|
381
|
+
type: "array",
|
|
382
|
+
items: { $ref: "#/$defs/MathMlAttribute" }
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
required: ["type", "attributes"],
|
|
386
|
+
additionalProperties: false
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
type: "object",
|
|
390
|
+
properties: {
|
|
391
|
+
type: {
|
|
392
|
+
type: "string",
|
|
393
|
+
const: "pi"
|
|
394
|
+
},
|
|
395
|
+
target: { type: "string" },
|
|
396
|
+
content: { type: "string" }
|
|
397
|
+
},
|
|
398
|
+
required: [
|
|
399
|
+
"type",
|
|
400
|
+
"target",
|
|
401
|
+
"content"
|
|
402
|
+
],
|
|
403
|
+
additionalProperties: false
|
|
404
|
+
},
|
|
405
|
+
{ $ref: "#/$defs/MathMlElement" }
|
|
406
|
+
] }
|
|
407
|
+
};
|
|
408
|
+
//#endregion
|
|
409
|
+
export { CONTENT_DEFS, CONTENT_DOCUMENT_URI, EMBEDDED_OBJECT_KINDS, MAX_SAFE_INTEGER };
|
package/dist/content.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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
|
let zod = require("zod");
|
|
@@ -81,11 +82,30 @@ function isContentBlock(value) {
|
|
|
81
82
|
const ContentBlockSchema = zod.z.custom(isContentBlock);
|
|
82
83
|
const ContentEmbeddedObjectSchema = zod.z.custom(isContentEmbeddedObject);
|
|
83
84
|
const ContentEmbeddedObjectBlockSchema = zod.z.custom(isContentEmbeddedObjectBlock);
|
|
85
|
+
const ContentStrokeStyleSchema = zod.z.enum([
|
|
86
|
+
"solid",
|
|
87
|
+
"dashed",
|
|
88
|
+
"dotted",
|
|
89
|
+
"double"
|
|
90
|
+
]);
|
|
91
|
+
const ContentBorderSchema = zod.z.object({
|
|
92
|
+
color: require_color.ColorSchema,
|
|
93
|
+
widthPt: zod.z.number().positive(),
|
|
94
|
+
style: ContentStrokeStyleSchema.optional()
|
|
95
|
+
});
|
|
96
|
+
const ContentCellBordersSchema = zod.z.object({
|
|
97
|
+
left: ContentBorderSchema.optional(),
|
|
98
|
+
right: ContentBorderSchema.optional(),
|
|
99
|
+
top: ContentBorderSchema.optional(),
|
|
100
|
+
bottom: ContentBorderSchema.optional()
|
|
101
|
+
});
|
|
84
102
|
const ContentTableCellSchema = zod.z.object({
|
|
85
103
|
blocks: zod.z.array(ContentBlockSchema),
|
|
86
104
|
colSpan: zod.z.number().int().positive().optional(),
|
|
87
105
|
rowSpan: zod.z.number().int().positive().optional(),
|
|
88
|
-
background: require_color.ColorSchema.optional()
|
|
106
|
+
background: require_color.ColorSchema.optional(),
|
|
107
|
+
borders: ContentCellBordersSchema.optional(),
|
|
108
|
+
sourcePath: zod.z.string().optional()
|
|
89
109
|
});
|
|
90
110
|
const ContentTableRowSchema = zod.z.object({
|
|
91
111
|
cells: zod.z.array(ContentTableCellSchema),
|
|
@@ -112,6 +132,7 @@ const ContentShapeSchema = zod.z.object({
|
|
|
112
132
|
insetBottomPt: zod.z.number().nonnegative(),
|
|
113
133
|
fontScale: zod.z.number().positive().optional(),
|
|
114
134
|
lineSpacingReduction: zod.z.number().nonnegative().optional(),
|
|
135
|
+
paintOrder: zod.z.number().optional(),
|
|
115
136
|
sourcePath: zod.z.string().optional(),
|
|
116
137
|
blocks: zod.z.array(ContentBlockSchema)
|
|
117
138
|
});
|
|
@@ -120,19 +141,23 @@ const ContentSlideSchema = zod.z.object({
|
|
|
120
141
|
shapes: zod.z.array(ContentShapeSchema),
|
|
121
142
|
notes: zod.z.string()
|
|
122
143
|
});
|
|
144
|
+
const DecimalStringSchema = zod.z.string().regex(/^-?(0|[1-9]\d*)(\.\d+)?$/);
|
|
123
145
|
const ContentCellValueSchema = zod.z.discriminatedUnion("kind", [
|
|
124
146
|
zod.z.object({
|
|
125
147
|
kind: zod.z.literal("number"),
|
|
126
|
-
value: zod.z.number()
|
|
148
|
+
value: zod.z.number(),
|
|
149
|
+
exactValue: DecimalStringSchema.optional()
|
|
127
150
|
}),
|
|
128
151
|
zod.z.object({
|
|
129
152
|
kind: zod.z.literal("percentage"),
|
|
130
|
-
value: zod.z.number()
|
|
153
|
+
value: zod.z.number(),
|
|
154
|
+
exactValue: DecimalStringSchema.optional()
|
|
131
155
|
}),
|
|
132
156
|
zod.z.object({
|
|
133
157
|
kind: zod.z.literal("currency"),
|
|
134
158
|
value: zod.z.number(),
|
|
135
|
-
currency: zod.z.string().optional()
|
|
159
|
+
currency: zod.z.string().optional(),
|
|
160
|
+
exactValue: DecimalStringSchema.optional()
|
|
136
161
|
}),
|
|
137
162
|
zod.z.object({
|
|
138
163
|
kind: zod.z.literal("boolean"),
|
|
@@ -146,6 +171,10 @@ const ContentCellValueSchema = zod.z.discriminatedUnion("kind", [
|
|
|
146
171
|
kind: zod.z.literal("time"),
|
|
147
172
|
value: zod.z.string()
|
|
148
173
|
}),
|
|
174
|
+
zod.z.object({
|
|
175
|
+
kind: zod.z.literal("dateTime"),
|
|
176
|
+
value: zod.z.string()
|
|
177
|
+
}),
|
|
149
178
|
zod.z.object({
|
|
150
179
|
kind: zod.z.literal("string"),
|
|
151
180
|
value: zod.z.string()
|
|
@@ -164,16 +193,25 @@ const ContentSheetCellSchema = zod.z.object({
|
|
|
164
193
|
displayText: zod.z.string(),
|
|
165
194
|
runs: zod.z.array(ContentRunSchema).optional(),
|
|
166
195
|
colSpan: zod.z.number().int().positive().optional(),
|
|
167
|
-
rowSpan: zod.z.number().int().positive().optional()
|
|
196
|
+
rowSpan: zod.z.number().int().positive().optional(),
|
|
197
|
+
background: require_color.ColorSchema.optional(),
|
|
198
|
+
borders: ContentCellBordersSchema.optional(),
|
|
199
|
+
alignment: require_style.AlignmentSchema.optional(),
|
|
200
|
+
verticalAlignment: zod.z.enum([
|
|
201
|
+
"top",
|
|
202
|
+
"middle",
|
|
203
|
+
"bottom"
|
|
204
|
+
]).optional(),
|
|
205
|
+
sourcePath: zod.z.string().optional()
|
|
168
206
|
});
|
|
169
207
|
const ContentSheetColumnSchema = zod.z.object({
|
|
170
208
|
index: zod.z.number().int().nonnegative(),
|
|
171
|
-
widthPt: zod.z.number().
|
|
209
|
+
widthPt: zod.z.number().positive().optional(),
|
|
172
210
|
hidden: zod.z.boolean().optional()
|
|
173
211
|
});
|
|
174
212
|
const ContentSheetRowSchema = zod.z.object({
|
|
175
213
|
index: zod.z.number().int().nonnegative(),
|
|
176
|
-
heightPt: zod.z.number().
|
|
214
|
+
heightPt: zod.z.number().positive().optional(),
|
|
177
215
|
hidden: zod.z.boolean().optional()
|
|
178
216
|
});
|
|
179
217
|
const ContentSheetPrintRangeSchema = zod.z.object({
|
|
@@ -190,7 +228,7 @@ const ContentSheetPrintSettingsSchema = zod.z.object({
|
|
|
190
228
|
pageSize: require_geometry.PageSizeSchema,
|
|
191
229
|
margins: require_geometry.MarginsSchema,
|
|
192
230
|
printRange: ContentSheetPrintRangeSchema.optional(),
|
|
193
|
-
|
|
231
|
+
scalePercent: zod.z.number().positive().optional(),
|
|
194
232
|
fitToPages: zod.z.object({
|
|
195
233
|
width: zod.z.number().int().positive(),
|
|
196
234
|
height: zod.z.number().int().positive()
|
|
@@ -222,7 +260,8 @@ const ContentSheetSchema = zod.z.object({
|
|
|
222
260
|
});
|
|
223
261
|
const ContentStrokeSchema = zod.z.object({
|
|
224
262
|
color: require_color.ColorSchema,
|
|
225
|
-
widthPt: zod.z.number().positive()
|
|
263
|
+
widthPt: zod.z.number().positive(),
|
|
264
|
+
style: ContentStrokeStyleSchema.optional()
|
|
226
265
|
});
|
|
227
266
|
const ContentPathPointSchema = zod.z.object({
|
|
228
267
|
xPt: zod.z.number(),
|
|
@@ -246,15 +285,19 @@ const ContentVectorSchema = zod.z.discriminatedUnion("kind", [
|
|
|
246
285
|
zod.z.object({
|
|
247
286
|
kind: zod.z.literal("rect"),
|
|
248
287
|
frame: require_geometry.BoxSchema,
|
|
288
|
+
rotationDeg: zod.z.number().optional(),
|
|
249
289
|
fill: require_color.ColorSchema.optional(),
|
|
250
290
|
stroke: ContentStrokeSchema.optional(),
|
|
291
|
+
paintOrder: zod.z.number().optional(),
|
|
251
292
|
sourcePath: zod.z.string().optional()
|
|
252
293
|
}),
|
|
253
294
|
zod.z.object({
|
|
254
295
|
kind: zod.z.literal("ellipse"),
|
|
255
296
|
frame: require_geometry.BoxSchema,
|
|
297
|
+
rotationDeg: zod.z.number().optional(),
|
|
256
298
|
fill: require_color.ColorSchema.optional(),
|
|
257
299
|
stroke: ContentStrokeSchema.optional(),
|
|
300
|
+
paintOrder: zod.z.number().optional(),
|
|
258
301
|
sourcePath: zod.z.string().optional()
|
|
259
302
|
}),
|
|
260
303
|
zod.z.object({
|
|
@@ -262,15 +305,18 @@ const ContentVectorSchema = zod.z.discriminatedUnion("kind", [
|
|
|
262
305
|
from: ContentPathPointSchema,
|
|
263
306
|
to: ContentPathPointSchema,
|
|
264
307
|
stroke: ContentStrokeSchema,
|
|
308
|
+
paintOrder: zod.z.number().optional(),
|
|
265
309
|
sourcePath: zod.z.string().optional()
|
|
266
310
|
}),
|
|
267
311
|
zod.z.object({
|
|
268
312
|
kind: zod.z.literal("path"),
|
|
269
313
|
frame: require_geometry.BoxSchema,
|
|
314
|
+
rotationDeg: zod.z.number().optional(),
|
|
270
315
|
subpaths: zod.z.array(ContentSubpathSchema),
|
|
271
316
|
fill: require_color.ColorSchema.optional(),
|
|
272
317
|
fillRule: zod.z.enum(["nonzero", "evenodd"]).optional(),
|
|
273
318
|
stroke: ContentStrokeSchema.optional(),
|
|
319
|
+
paintOrder: zod.z.number().optional(),
|
|
274
320
|
sourcePath: zod.z.string().optional()
|
|
275
321
|
})
|
|
276
322
|
]);
|
|
@@ -279,41 +325,54 @@ const ContentDrawPageSchema = zod.z.object({
|
|
|
279
325
|
shapes: zod.z.array(ContentShapeSchema),
|
|
280
326
|
vectors: zod.z.array(ContentVectorSchema)
|
|
281
327
|
});
|
|
282
|
-
const
|
|
328
|
+
const ContentFormulaSchema = zod.z.object({
|
|
329
|
+
mathml: zod.z.array(require_mathml.MathMlNodeSchema),
|
|
330
|
+
starMath: zod.z.string().optional()
|
|
331
|
+
});
|
|
332
|
+
const CONTENT_FORMAT_VERSION = 2;
|
|
283
333
|
const ContentDocumentSchema = zod.z.discriminatedUnion("kind", [
|
|
284
334
|
zod.z.object({
|
|
285
335
|
kind: zod.z.literal("wordprocessing"),
|
|
286
|
-
formatVersion: zod.z.literal(
|
|
336
|
+
formatVersion: zod.z.literal(2),
|
|
287
337
|
metadata: require_metadata.LayoutMetadataSchema,
|
|
288
338
|
sections: zod.z.array(ContentSectionSchema)
|
|
289
339
|
}),
|
|
290
340
|
zod.z.object({
|
|
291
341
|
kind: zod.z.literal("presentation"),
|
|
292
|
-
formatVersion: zod.z.literal(
|
|
342
|
+
formatVersion: zod.z.literal(2),
|
|
293
343
|
metadata: require_metadata.LayoutMetadataSchema,
|
|
294
344
|
slides: zod.z.array(ContentSlideSchema)
|
|
295
345
|
}),
|
|
296
346
|
zod.z.object({
|
|
297
347
|
kind: zod.z.literal("spreadsheet"),
|
|
298
|
-
formatVersion: zod.z.literal(
|
|
348
|
+
formatVersion: zod.z.literal(2),
|
|
299
349
|
metadata: require_metadata.LayoutMetadataSchema,
|
|
300
350
|
sheets: zod.z.array(ContentSheetSchema)
|
|
301
351
|
}),
|
|
302
352
|
zod.z.object({
|
|
303
353
|
kind: zod.z.literal("drawing"),
|
|
304
|
-
formatVersion: zod.z.literal(
|
|
354
|
+
formatVersion: zod.z.literal(2),
|
|
305
355
|
metadata: require_metadata.LayoutMetadataSchema,
|
|
306
356
|
pages: zod.z.array(ContentDrawPageSchema)
|
|
357
|
+
}),
|
|
358
|
+
zod.z.object({
|
|
359
|
+
kind: zod.z.literal("formula"),
|
|
360
|
+
formatVersion: zod.z.literal(2),
|
|
361
|
+
metadata: require_metadata.LayoutMetadataSchema,
|
|
362
|
+
formula: ContentFormulaSchema
|
|
307
363
|
})
|
|
308
364
|
]);
|
|
309
365
|
//#endregion
|
|
310
366
|
exports.CONTENT_FORMAT_VERSION = CONTENT_FORMAT_VERSION;
|
|
311
367
|
exports.ContentBlockSchema = ContentBlockSchema;
|
|
368
|
+
exports.ContentBorderSchema = ContentBorderSchema;
|
|
369
|
+
exports.ContentCellBordersSchema = ContentCellBordersSchema;
|
|
312
370
|
exports.ContentCellValueSchema = ContentCellValueSchema;
|
|
313
371
|
exports.ContentDocumentSchema = ContentDocumentSchema;
|
|
314
372
|
exports.ContentDrawPageSchema = ContentDrawPageSchema;
|
|
315
373
|
exports.ContentEmbeddedObjectBlockSchema = ContentEmbeddedObjectBlockSchema;
|
|
316
374
|
exports.ContentEmbeddedObjectSchema = ContentEmbeddedObjectSchema;
|
|
375
|
+
exports.ContentFormulaSchema = ContentFormulaSchema;
|
|
317
376
|
exports.ContentImageBlockSchema = ContentImageBlockSchema;
|
|
318
377
|
exports.ContentListMembershipSchema = ContentListMembershipSchema;
|
|
319
378
|
exports.ContentPageBreakSchema = ContentPageBreakSchema;
|
|
@@ -333,9 +392,11 @@ exports.ContentSheetRowSchema = ContentSheetRowSchema;
|
|
|
333
392
|
exports.ContentSheetSchema = ContentSheetSchema;
|
|
334
393
|
exports.ContentSlideSchema = ContentSlideSchema;
|
|
335
394
|
exports.ContentStrokeSchema = ContentStrokeSchema;
|
|
395
|
+
exports.ContentStrokeStyleSchema = ContentStrokeStyleSchema;
|
|
336
396
|
exports.ContentSubpathSchema = ContentSubpathSchema;
|
|
337
397
|
exports.ContentTableCellSchema = ContentTableCellSchema;
|
|
338
398
|
exports.ContentTableRowSchema = ContentTableRowSchema;
|
|
339
399
|
exports.ContentTableSchema = ContentTableSchema;
|
|
340
400
|
exports.ContentVectorSchema = ContentVectorSchema;
|
|
401
|
+
exports.DecimalStringSchema = DecimalStringSchema;
|
|
341
402
|
exports.isContentBlock = isContentBlock;
|