document-schema 7.15.2 → 7.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/bijection-constructs-3By08A5K.cjs +14695 -0
  2. package/dist/bijection-constructs-DlP29TpB.js +14624 -0
  3. package/dist/bijection-constructs.cjs +4 -0
  4. package/dist/bijection-constructs.d.cts +6 -0
  5. package/dist/bijection-constructs.d.ts +6 -0
  6. package/dist/bijection-constructs.js +2 -0
  7. package/dist/bijection-corpus.cjs +12 -0
  8. package/dist/bijection-corpus.d.cts +46 -0
  9. package/dist/bijection-corpus.d.ts +46 -0
  10. package/dist/bijection-corpus.js +2 -0
  11. package/dist/codec.d.cts +3 -3
  12. package/dist/codec.d.ts +3 -3
  13. package/dist/{construct-C9cYkjnd.d.cts → construct-GVdTKrE7.d.cts} +3 -3
  14. package/dist/{construct-C9cYkjnd.d.ts → construct-GVdTKrE7.d.ts} +3 -3
  15. package/dist/construct.d.cts +1 -1
  16. package/dist/construct.d.ts +1 -1
  17. package/dist/{content-Dg9cb8mF.d.cts → content-DQui8vwD.d.cts} +7925 -6159
  18. package/dist/{content-BMrK9SrW.d.ts → content-DaST7v0K.d.ts} +7925 -6159
  19. package/dist/content-drawing-DAC7_N1K.d.cts +1606 -0
  20. package/dist/content-drawing-DNxYhY-G.d.ts +1606 -0
  21. package/dist/content-drawing.cjs +186 -0
  22. package/dist/content-drawing.d.cts +2 -0
  23. package/dist/content-drawing.d.ts +2 -0
  24. package/dist/content-drawing.js +171 -0
  25. package/dist/content-json-schema-defs.cjs +29 -3035
  26. package/dist/content-json-schema-defs.d.cts +2 -6
  27. package/dist/content-json-schema-defs.d.ts +2 -6
  28. package/dist/content-json-schema-defs.js +30 -3033
  29. package/dist/content-sheet.cjs +408 -0
  30. package/dist/content-sheet.d.cts +2 -0
  31. package/dist/content-sheet.d.ts +2 -0
  32. package/dist/content-sheet.js +385 -0
  33. package/dist/content-vocabulary.cjs +190 -0
  34. package/dist/content-vocabulary.d.cts +2 -0
  35. package/dist/content-vocabulary.d.ts +2 -0
  36. package/dist/content-vocabulary.js +168 -0
  37. package/dist/content.cjs +29 -777
  38. package/dist/content.d.cts +2 -2
  39. package/dist/content.d.ts +2 -2
  40. package/dist/content.js +10 -701
  41. package/dist/decompose.cjs +5 -0
  42. package/dist/decompose.d.cts +5 -3
  43. package/dist/decompose.d.ts +5 -3
  44. package/dist/decompose.js +5 -1
  45. package/dist/definitions.cjs +2 -1
  46. package/dist/definitions.d.cts +4 -4
  47. package/dist/definitions.d.ts +4 -4
  48. package/dist/definitions.js +2 -1
  49. package/dist/factor-styles.cjs +2 -0
  50. package/dist/factor-styles.d.cts +1 -1
  51. package/dist/factor-styles.d.ts +1 -1
  52. package/dist/factor-styles.js +4 -2
  53. package/dist/flatten.cjs +5 -0
  54. package/dist/flatten.d.cts +3 -2
  55. package/dist/flatten.d.ts +3 -2
  56. package/dist/flatten.js +5 -1
  57. package/dist/index.cjs +71 -67
  58. package/dist/index.d.cts +13 -11
  59. package/dist/index.d.ts +13 -11
  60. package/dist/index.js +12 -12
  61. package/dist/json-schema-defs-blocks.cjs +1036 -0
  62. package/dist/json-schema-defs-blocks.d.cts +5 -0
  63. package/dist/json-schema-defs-blocks.d.ts +5 -0
  64. package/dist/json-schema-defs-blocks.js +1035 -0
  65. package/dist/json-schema-defs-math.cjs +291 -0
  66. package/dist/json-schema-defs-math.d.cts +5 -0
  67. package/dist/json-schema-defs-math.d.ts +5 -0
  68. package/dist/json-schema-defs-math.js +290 -0
  69. package/dist/json-schema-defs-shared.cjs +42 -0
  70. package/dist/json-schema-defs-shared.d.cts +9 -0
  71. package/dist/json-schema-defs-shared.d.ts +9 -0
  72. package/dist/json-schema-defs-shared.js +38 -0
  73. package/dist/json-schema-defs-sheet.cjs +944 -0
  74. package/dist/json-schema-defs-sheet.d.cts +5 -0
  75. package/dist/json-schema-defs-sheet.d.ts +5 -0
  76. package/dist/json-schema-defs-sheet.js +943 -0
  77. package/dist/json-schema-defs-tree.cjs +237 -0
  78. package/dist/json-schema-defs-tree.d.cts +5 -0
  79. package/dist/json-schema-defs-tree.d.ts +5 -0
  80. package/dist/json-schema-defs-tree.js +237 -0
  81. package/dist/json-schema-defs-vector.cjs +513 -0
  82. package/dist/json-schema-defs-vector.d.cts +5 -0
  83. package/dist/json-schema-defs-vector.d.ts +5 -0
  84. package/dist/json-schema-defs-vector.js +512 -0
  85. package/dist/magic-string.es-CB2hOw9v.js +1012 -0
  86. package/dist/magic-string.es-MEBc20Ce.cjs +1012 -0
  87. package/dist/{math-BScHxedi.d.cts → math-DdIQCljT.d.cts} +9 -9
  88. package/dist/{math-BScHxedi.d.ts → math-DdIQCljT.d.ts} +9 -9
  89. package/dist/math-layout.d.cts +2 -2
  90. package/dist/math-layout.d.ts +2 -2
  91. package/dist/math.cjs +7 -5
  92. package/dist/math.d.cts +1 -1
  93. package/dist/math.d.ts +1 -1
  94. package/dist/math.js +7 -5
  95. package/dist/mathml.cjs +3 -1
  96. package/dist/mathml.js +3 -1
  97. package/dist/{package-node-gA3Kpgl2.d.ts → package-node-BMbep0jw.d.ts} +44 -43
  98. package/dist/{package-node-wxNXHAov.d.cts → package-node-DXhNJt15.d.cts} +44 -43
  99. package/dist/package-node.cjs +12 -9
  100. package/dist/package-node.d.cts +1 -1
  101. package/dist/package-node.d.ts +1 -1
  102. package/dist/package-node.js +4 -1
  103. package/dist/package.d.cts +12 -12
  104. package/dist/package.d.ts +12 -12
  105. package/dist/schema-io.cjs +7 -2
  106. package/dist/schema-io.d.cts +3 -2
  107. package/dist/schema-io.d.ts +3 -2
  108. package/dist/schema-io.js +7 -3
  109. package/dist/{style-BGMcYrD2.d.cts → style-D06NwxAJ.d.cts} +1 -1
  110. package/dist/{style-BGMcYrD2.d.ts → style-D06NwxAJ.d.ts} +1 -1
  111. package/dist/style.d.cts +1 -1
  112. package/dist/style.d.ts +1 -1
  113. package/dist/table-grid.cjs +5 -0
  114. package/dist/table-grid.d.cts +4 -3
  115. package/dist/table-grid.d.ts +4 -3
  116. package/dist/table-grid.js +5 -1
  117. package/dist/text-layout.d.cts +7 -7
  118. package/dist/text-layout.d.ts +7 -7
  119. package/package.json +1 -1
  120. package/schemas/content-document.schema.json +16 -16
  121. package/schemas/document-tree.schema.json +3 -3
package/dist/content.js CHANGED
@@ -1,63 +1,15 @@
1
- import { ColorSchema } from "./color.js";
2
1
  import { SourceResidueSchema } from "./source.js";
3
2
  import { ConstructDescriptorSchema } from "./construct.js";
3
+ import { BoxSchema, LayoutFrameSchema, MarginsSchema, PageSizeSchema } from "./geometry.js";
4
4
  import { MathExpressionSchema, MathPresentationSchema, MathProvenanceSchema, SymbolTableSchema } from "./math.js";
5
5
  import { MathMlNodeSchema } from "./mathml.js";
6
- import { BoxSchema, LayoutFrameSchema, MarginsSchema, PageSizeSchema } from "./geometry.js";
7
6
  import { AlignmentSchema, TextDirectionSchema } from "./style.js";
8
7
  import { LayoutMetadataSchema } from "./metadata.js";
8
+ import { CONTENT_ANNOTATION_FIELDS, ContentBorderSchema, ContentEmbeddedObjectBlockSchema, ContentImageBlockSchema, ContentRunSchema, RunConstructExtentSchema, contentBlockSchemaBox, contentDocumentSchemaBox, isImageFormat } from "./content-vocabulary.js";
9
+ import { ContentCellBordersSchema, ContentCellFillSchema, ContentSheetSchema } from "./content-sheet.js";
10
+ import { ContentDrawPageSchema, ContentSlideSchema } from "./content-drawing.js";
9
11
  import { z } from "zod";
10
12
  //#region src/content.ts
11
- const ContentOriginSchema = z.enum([
12
- "chart",
13
- "diagram",
14
- "table",
15
- "image",
16
- "notes",
17
- "body"
18
- ]);
19
- const ContentTranscriptSchema = z.object({
20
- text: z.string(),
21
- confidence: z.enum([
22
- "high",
23
- "medium",
24
- "low"
25
- ]),
26
- mechanism: z.enum(["deterministic", "model"])
27
- });
28
- const ContentInterpretationSchema = z.object({
29
- transcript: ContentTranscriptSchema.optional(),
30
- description: z.string().optional(),
31
- by: z.object({
32
- model: z.string(),
33
- at: z.string()
34
- }).optional()
35
- });
36
- const CONTENT_ANNOTATION_FIELDS = {
37
- origin: ContentOriginSchema.optional(),
38
- interpretation: ContentInterpretationSchema.optional()
39
- };
40
- const RUN_FONT_PROPERTY_SHAPE = {
41
- bold: z.boolean().optional(),
42
- italic: z.boolean().optional(),
43
- underline: z.boolean().optional(),
44
- strike: z.boolean().optional(),
45
- fontFamily: z.string().optional(),
46
- sizePt: z.number().positive().optional(),
47
- color: ColorSchema.optional()
48
- };
49
- const ContentFontSchema = z.object(RUN_FONT_PROPERTY_SHAPE);
50
- const ContentRunSchema = z.object({
51
- text: z.string(),
52
- ...RUN_FONT_PROPERTY_SHAPE,
53
- hyperlink: z.string().optional(),
54
- verticalAlign: z.enum(["superscript", "subscript"]).optional(),
55
- direction: TextDirectionSchema.optional(),
56
- sourcePath: z.string().optional(),
57
- source: SourceResidueSchema.optional(),
58
- frames: z.array(LayoutFrameSchema).optional(),
59
- ...CONTENT_ANNOTATION_FIELDS
60
- });
61
13
  const ContentListMembershipSchema = z.object({
62
14
  numId: z.string().optional(),
63
15
  level: z.number().int().nonnegative(),
@@ -72,22 +24,6 @@ const ContentListMembershipSchema = z.object({
72
24
  "upperRoman"
73
25
  ]).optional()
74
26
  });
75
- const RunConstructExtentSchema = z.object({
76
- descriptor: ConstructDescriptorSchema,
77
- startRun: z.number().int().nonnegative(),
78
- endRun: z.number().int().nonnegative()
79
- });
80
- const ContentStrokeStyleSchema = z.enum([
81
- "solid",
82
- "dashed",
83
- "dotted",
84
- "double"
85
- ]);
86
- const ContentBorderSchema = z.object({
87
- color: ColorSchema,
88
- widthPt: z.number().positive(),
89
- style: ContentStrokeStyleSchema.optional()
90
- });
91
27
  const ContentParagraphBordersSchema = z.object({
92
28
  left: ContentBorderSchema.optional(),
93
29
  right: ContentBorderSchema.optional(),
@@ -123,72 +59,6 @@ const MAX_HEADING_LEVEL = 6;
123
59
  function clampHeadingLevel(level) {
124
60
  return Math.min(MAX_HEADING_LEVEL, Math.max(1, Math.round(level)));
125
61
  }
126
- const ContentFloatOriginSchema = z.enum([
127
- "page",
128
- "margin",
129
- "leftMargin",
130
- "rightMargin",
131
- "topMargin",
132
- "bottomMargin",
133
- "insideMargin",
134
- "outsideMargin",
135
- "column",
136
- "character",
137
- "paragraph",
138
- "line",
139
- "frame"
140
- ]);
141
- const ContentFloatAlignSchema = z.enum([
142
- "left",
143
- "right",
144
- "top",
145
- "bottom",
146
- "center",
147
- "inside",
148
- "outside"
149
- ]);
150
- const ContentFloatAxisSchema = z.union([z.strictObject({
151
- relativeTo: ContentFloatOriginSchema,
152
- offsetPt: z.number()
153
- }), z.strictObject({
154
- relativeTo: ContentFloatOriginSchema,
155
- align: ContentFloatAlignSchema
156
- })]);
157
- const ContentFloatPositionSchema = z.object({
158
- horizontal: ContentFloatAxisSchema,
159
- vertical: ContentFloatAxisSchema
160
- });
161
- const IMAGE_FORMATS = [
162
- "png",
163
- "jpeg",
164
- "svg",
165
- "gif"
166
- ];
167
- function isImageFormat(value) {
168
- return IMAGE_FORMATS.includes(value);
169
- }
170
- const ContentImageOriginalSchema = z.object({
171
- filter: z.enum(["jbig2", "jpeg2000"]),
172
- base64: z.string(),
173
- jbig2GlobalsBase64: z.string().optional()
174
- });
175
- const ContentImageBlockSchema = z.object({
176
- kind: z.literal("image"),
177
- format: z.enum(IMAGE_FORMATS),
178
- base64: z.string(),
179
- widthPt: z.number().positive(),
180
- heightPt: z.number().positive(),
181
- altText: z.string().optional(),
182
- original: ContentImageOriginalSchema.optional(),
183
- anchorRunIndex: z.number().int().nonnegative().optional(),
184
- anchorOffset: z.number().int().nonnegative().optional(),
185
- caption: z.string().optional(),
186
- floatPosition: ContentFloatPositionSchema.optional(),
187
- sourcePath: z.string().optional(),
188
- source: SourceResidueSchema.optional(),
189
- frames: z.array(LayoutFrameSchema).optional(),
190
- ...CONTENT_ANNOTATION_FIELDS
191
- });
192
62
  const ContentPageBreakSchema = z.object({
193
63
  kind: z.literal("pageBreak"),
194
64
  sourcePath: z.string().optional(),
@@ -220,7 +90,7 @@ function isContentEmbeddedObjectKind(value) {
220
90
  return value === "formula" || value === "wordprocessing" || value === "presentation" || value === "spreadsheet" || value === "drawing" || value === "chart";
221
91
  }
222
92
  function isContentEmbeddedObject(value) {
223
- return isRecord(value) && isContentEmbeddedObjectKind(value.objectKind) && BoxSchema.safeParse(value.frame).success && ContentDocumentSchema.safeParse(value.document).success && (value.anchorRow === void 0 || typeof value.anchorRow === "number" && Number.isInteger(value.anchorRow) && value.anchorRow >= 0) && (value.anchorColumn === void 0 || typeof value.anchorColumn === "number" && Number.isInteger(value.anchorColumn) && value.anchorColumn >= 0) && (value.offsetXPt === void 0 || typeof value.offsetXPt === "number") && (value.offsetYPt === void 0 || typeof value.offsetYPt === "number");
93
+ return isRecord(value) && isContentEmbeddedObjectKind(value.objectKind) && BoxSchema.safeParse(value.frame).success && contentDocumentSchemaBox.value.safeParse(value.document).success && (value.anchorRow === void 0 || typeof value.anchorRow === "number" && Number.isInteger(value.anchorRow) && value.anchorRow >= 0) && (value.anchorColumn === void 0 || typeof value.anchorColumn === "number" && Number.isInteger(value.anchorColumn) && value.anchorColumn >= 0) && (value.offsetXPt === void 0 || typeof value.offsetXPt === "number") && (value.offsetYPt === void 0 || typeof value.offsetYPt === "number");
224
94
  }
225
95
  function isContentConstructStart(value) {
226
96
  return isRecord(value) && value.kind === "constructStart" && ConstructDescriptorSchema.safeParse(value.descriptor).success;
@@ -248,31 +118,6 @@ function isContentBlock(value) {
248
118
  if (kind === "constructEnd") return true;
249
119
  return false;
250
120
  }
251
- const CONTENT_EMBEDDED_OBJECT_FIELDS = {
252
- objectKind: z.enum([
253
- "formula",
254
- "wordprocessing",
255
- "presentation",
256
- "spreadsheet",
257
- "drawing",
258
- "chart"
259
- ]),
260
- document: z.lazy(() => ContentDocumentSchema),
261
- frame: BoxSchema,
262
- anchorRow: z.number().int().nonnegative().optional(),
263
- anchorColumn: z.number().int().nonnegative().optional(),
264
- offsetXPt: z.number().optional(),
265
- offsetYPt: z.number().optional(),
266
- source: SourceResidueSchema.optional(),
267
- ...CONTENT_ANNOTATION_FIELDS
268
- };
269
- const ContentEmbeddedObjectSchema = z.object(CONTENT_EMBEDDED_OBJECT_FIELDS);
270
- const ContentEmbeddedObjectBlockSchema = z.object({
271
- kind: z.literal("embeddedObject"),
272
- ...CONTENT_EMBEDDED_OBJECT_FIELDS,
273
- sourcePath: z.string().optional(),
274
- frames: z.array(LayoutFrameSchema).optional()
275
- });
276
121
  function findConstructMarkerImbalance(blocks) {
277
122
  const openStartIndices = [];
278
123
  for (const [index, block] of blocks.entries()) if (isContentConstructStart(block)) openStartIndices.push(index);
@@ -300,85 +145,8 @@ function findRunConstructFault(paragraph) {
300
145
  };
301
146
  }
302
147
  }
303
- const ContentCellBordersSchema = z.object({
304
- left: ContentBorderSchema.optional(),
305
- right: ContentBorderSchema.optional(),
306
- top: ContentBorderSchema.optional(),
307
- bottom: ContentBorderSchema.optional(),
308
- diagonalUp: ContentBorderSchema.optional(),
309
- diagonalDown: ContentBorderSchema.optional()
310
- });
311
- const ContentCellPatternTypeSchema = z.enum([
312
- "percent5",
313
- "percent10",
314
- "percent12",
315
- "percent15",
316
- "percent20",
317
- "percent25",
318
- "percent30",
319
- "percent35",
320
- "percent37",
321
- "percent40",
322
- "percent45",
323
- "percent50",
324
- "percent55",
325
- "percent60",
326
- "percent62",
327
- "percent65",
328
- "percent70",
329
- "percent75",
330
- "percent80",
331
- "percent85",
332
- "percent87",
333
- "percent90",
334
- "percent95",
335
- "horizontalStripe",
336
- "verticalStripe",
337
- "diagonalStripe",
338
- "reverseDiagonalStripe",
339
- "horizontalCross",
340
- "diagonalCross",
341
- "thinHorizontalStripe",
342
- "thinVerticalStripe",
343
- "thinDiagonalStripe",
344
- "thinReverseDiagonalStripe",
345
- "thinHorizontalCross",
346
- "thinDiagonalCross",
347
- "mediumGray",
348
- "darkGray",
349
- "lightGray",
350
- "darkHorizontal",
351
- "darkVertical",
352
- "darkDown",
353
- "darkUp",
354
- "darkGrid",
355
- "darkTrellis",
356
- "lightHorizontal",
357
- "lightVertical",
358
- "lightDown",
359
- "lightUp",
360
- "lightGrid",
361
- "lightTrellis",
362
- "gray125",
363
- "gray0625"
364
- ]);
365
- const ContentCellFillSchema = z.discriminatedUnion("kind", [z.object({
366
- kind: z.literal("solid"),
367
- color: ColorSchema
368
- }), z.object({
369
- kind: z.literal("pattern"),
370
- patternType: ContentCellPatternTypeSchema,
371
- foregroundColor: ColorSchema.optional(),
372
- backgroundColor: ColorSchema.optional()
373
- })]);
374
- function resolveCellFillColor(fill) {
375
- return fill.kind === "solid" ? fill.color : fill.foregroundColor ?? fill.backgroundColor;
376
- }
377
- function unrecognizedFillKind(fill) {
378
- return String(fill.kind);
379
- }
380
148
  const ContentTableCellSchema = z.object({
381
- blocks: z.lazy(() => z.array(ContentBlockSchema)),
149
+ blocks: z.lazy(() => z.array(contentBlockSchemaBox.value)),
382
150
  colSpan: z.number().int().positive().optional(),
383
151
  rowSpan: z.number().int().positive().optional(),
384
152
  background: ContentCellFillSchema.optional(),
@@ -422,6 +190,8 @@ const ContentBlockSchema = z.discriminatedUnion("kind", [
422
190
  ContentConstructStartSchema,
423
191
  ContentConstructEndSchema
424
192
  ]);
193
+ contentBlockSchemaBox.value = ContentBlockSchema;
194
+ contentBlockSchemaBox.value = ContentBlockSchema;
425
195
  const ContentPageFurnitureSchema = z.object({
426
196
  default: z.lazy(() => z.array(ContentBlockSchema)).optional(),
427
197
  even: z.lazy(() => z.array(ContentBlockSchema)).optional(),
@@ -443,468 +213,6 @@ const ContentSectionSchema = z.object({
443
213
  source: SourceResidueSchema.optional(),
444
214
  ...CONTENT_ANNOTATION_FIELDS
445
215
  });
446
- const ContentShapeSchema = z.object({
447
- name: z.string().optional(),
448
- frame: BoxSchema,
449
- rotationDeg: z.number().optional(),
450
- insetLeftPt: z.number().nonnegative(),
451
- insetTopPt: z.number().nonnegative(),
452
- insetRightPt: z.number().nonnegative(),
453
- insetBottomPt: z.number().nonnegative(),
454
- fontScale: z.number().positive().optional(),
455
- lineSpacingReduction: z.number().nonnegative().optional(),
456
- paintOrder: z.number().optional(),
457
- readingOrder: z.number().optional(),
458
- sourcePath: z.string().optional(),
459
- source: SourceResidueSchema.optional(),
460
- frames: z.array(LayoutFrameSchema).optional(),
461
- ...CONTENT_ANNOTATION_FIELDS,
462
- blocks: z.lazy(() => z.array(ContentBlockSchema))
463
- });
464
- const ContentSlideSchema = z.object({
465
- size: PageSizeSchema,
466
- shapes: z.array(ContentShapeSchema),
467
- notes: z.string(),
468
- source: SourceResidueSchema.optional(),
469
- ...CONTENT_ANNOTATION_FIELDS
470
- });
471
- const DecimalStringSchema = z.string().regex(/^-?(0|[1-9]\d*)(\.\d+)?$/);
472
- const ContentCellValueSchema = z.discriminatedUnion("kind", [
473
- z.object({
474
- kind: z.literal("number"),
475
- value: z.number(),
476
- exactValue: DecimalStringSchema.optional()
477
- }),
478
- z.object({
479
- kind: z.literal("percentage"),
480
- value: z.number(),
481
- exactValue: DecimalStringSchema.optional()
482
- }),
483
- z.object({
484
- kind: z.literal("currency"),
485
- value: z.number(),
486
- currency: z.string().optional(),
487
- exactValue: DecimalStringSchema.optional()
488
- }),
489
- z.object({
490
- kind: z.literal("boolean"),
491
- value: z.boolean()
492
- }),
493
- z.object({
494
- kind: z.literal("date"),
495
- value: z.string()
496
- }),
497
- z.object({
498
- kind: z.literal("time"),
499
- value: z.string()
500
- }),
501
- z.object({
502
- kind: z.literal("dateTime"),
503
- value: z.string()
504
- }),
505
- z.object({
506
- kind: z.literal("string"),
507
- value: z.string()
508
- }),
509
- z.object({
510
- kind: z.literal("error"),
511
- value: z.string()
512
- }),
513
- z.object({ kind: z.literal("empty") })
514
- ]);
515
- const ContentSheetCellCommentSchema = z.object({
516
- text: z.string(),
517
- author: z.string().optional(),
518
- createdAt: z.string().optional(),
519
- replies: z.array(z.object({
520
- text: z.string(),
521
- author: z.string().optional()
522
- })).optional()
523
- });
524
- const ContentSheetCellSchema = z.object({
525
- row: z.number().int().nonnegative(),
526
- column: z.number().int().nonnegative(),
527
- value: ContentCellValueSchema,
528
- formula: z.string().optional(),
529
- displayText: z.string(),
530
- numberFormatCode: z.string().optional(),
531
- font: ContentFontSchema.optional(),
532
- runs: z.array(ContentRunSchema).optional(),
533
- colSpan: z.number().int().positive().optional(),
534
- rowSpan: z.number().int().positive().optional(),
535
- background: ContentCellFillSchema.optional(),
536
- borders: ContentCellBordersSchema.optional(),
537
- alignment: AlignmentSchema.optional(),
538
- verticalAlignment: z.enum([
539
- "top",
540
- "middle",
541
- "bottom"
542
- ]).optional(),
543
- comment: ContentSheetCellCommentSchema.optional(),
544
- sourcePath: z.string().optional(),
545
- source: SourceResidueSchema.optional(),
546
- frames: z.array(LayoutFrameSchema).optional(),
547
- ...CONTENT_ANNOTATION_FIELDS
548
- });
549
- const ContentSheetColumnSchema = z.object({
550
- index: z.number().int().nonnegative(),
551
- widthPt: z.number().positive().optional(),
552
- hidden: z.boolean().optional()
553
- });
554
- const ContentSheetRowSchema = z.object({
555
- index: z.number().int().nonnegative(),
556
- heightPt: z.number().positive().optional(),
557
- hidden: z.boolean().optional()
558
- });
559
- const ContentSheetPrintRangeSchema = z.object({
560
- startRow: z.number().int().nonnegative(),
561
- startColumn: z.number().int().nonnegative(),
562
- endRow: z.number().int().nonnegative(),
563
- endColumn: z.number().int().nonnegative()
564
- });
565
- const ContentSheetRepeatRangeSchema = z.object({
566
- start: z.number().int().nonnegative(),
567
- end: z.number().int().nonnegative()
568
- });
569
- const ContentSheetPrintSettingsSchema = z.object({
570
- pageSize: PageSizeSchema,
571
- margins: MarginsSchema,
572
- printRange: ContentSheetPrintRangeSchema.optional(),
573
- scalePercent: z.number().positive().optional(),
574
- fitToPages: z.object({
575
- width: z.number().int().positive(),
576
- height: z.number().int().positive()
577
- }).optional(),
578
- repeatRows: ContentSheetRepeatRangeSchema.optional(),
579
- repeatColumns: ContentSheetRepeatRangeSchema.optional(),
580
- gridlines: z.boolean(),
581
- headers: z.boolean(),
582
- pageOrder: z.enum(["downThenOver", "overThenDown"]),
583
- manualBreaks: z.object({
584
- rows: z.array(z.number().int().nonnegative()),
585
- columns: z.array(z.number().int().nonnegative())
586
- }).optional()
587
- });
588
- const ContentSheetRangeSchema = z.object({
589
- startRow: z.number().int().nonnegative(),
590
- startColumn: z.number().int().nonnegative(),
591
- endRow: z.number().int().nonnegative(),
592
- endColumn: z.number().int().nonnegative()
593
- });
594
- const SheetRuleOperatorSchema = z.enum([
595
- "between",
596
- "notBetween",
597
- "equal",
598
- "notEqual",
599
- "greaterThan",
600
- "greaterThanOrEqual",
601
- "lessThan",
602
- "lessThanOrEqual"
603
- ]);
604
- const ContentSheetDataValidationTypeSchema = z.enum([
605
- "whole",
606
- "decimal",
607
- "list",
608
- "date",
609
- "time",
610
- "textLength",
611
- "custom"
612
- ]);
613
- const ContentSheetDataValidationSchema = z.object({
614
- ranges: z.array(ContentSheetRangeSchema),
615
- type: ContentSheetDataValidationTypeSchema,
616
- operator: SheetRuleOperatorSchema.optional(),
617
- formula1: z.string().optional(),
618
- formula2: z.string().optional(),
619
- allowBlank: z.boolean().optional(),
620
- showInputMessage: z.boolean().optional(),
621
- promptTitle: z.string().optional(),
622
- prompt: z.string().optional(),
623
- showErrorMessage: z.boolean().optional(),
624
- errorStyle: z.enum([
625
- "stop",
626
- "warning",
627
- "information"
628
- ]).optional(),
629
- errorTitle: z.string().optional(),
630
- error: z.string().optional(),
631
- source: SourceResidueSchema.optional()
632
- });
633
- const ContentSheetConditionalFormatStyleSchema = z.object({
634
- textColor: ColorSchema.optional(),
635
- background: ColorSchema.optional(),
636
- source: SourceResidueSchema.optional()
637
- });
638
- const cfvoTypeSchema = z.enum([
639
- "num",
640
- "percent",
641
- "max",
642
- "min",
643
- "formula",
644
- "percentile"
645
- ]);
646
- const ContentSheetConditionalFormatValueSchema = z.object({
647
- type: cfvoTypeSchema,
648
- value: z.string().optional()
649
- });
650
- const MIN_COLOR_SCALE_STOPS = 2;
651
- const MAX_COLOR_SCALE_STOPS = 3;
652
- const conditionalFormatCommonFields = {
653
- ranges: z.array(ContentSheetRangeSchema),
654
- priority: z.number().int().optional(),
655
- stopIfTrue: z.boolean().optional(),
656
- source: SourceResidueSchema.optional()
657
- };
658
- const ContentSheetConditionalFormatSchema = z.discriminatedUnion("type", [
659
- z.object({
660
- type: z.literal("cellIs"),
661
- ...conditionalFormatCommonFields,
662
- operator: SheetRuleOperatorSchema,
663
- formula1: z.string(),
664
- formula2: z.string().optional(),
665
- style: ContentSheetConditionalFormatStyleSchema.optional()
666
- }),
667
- z.object({
668
- type: z.enum([
669
- "containsText",
670
- "notContainsText",
671
- "beginsWith",
672
- "endsWith"
673
- ]),
674
- ...conditionalFormatCommonFields,
675
- text: z.string(),
676
- style: ContentSheetConditionalFormatStyleSchema.optional()
677
- }),
678
- z.object({
679
- type: z.enum([
680
- "containsBlanks",
681
- "notContainsBlanks",
682
- "containsErrors",
683
- "notContainsErrors",
684
- "uniqueValues",
685
- "duplicateValues"
686
- ]),
687
- ...conditionalFormatCommonFields,
688
- style: ContentSheetConditionalFormatStyleSchema.optional()
689
- }),
690
- z.object({
691
- type: z.literal("top10"),
692
- ...conditionalFormatCommonFields,
693
- rank: z.number().positive(),
694
- percent: z.boolean().optional(),
695
- bottom: z.boolean().optional(),
696
- style: ContentSheetConditionalFormatStyleSchema.optional()
697
- }),
698
- z.object({
699
- type: z.literal("aboveAverage"),
700
- ...conditionalFormatCommonFields,
701
- aboveAverage: z.boolean().optional(),
702
- equalAverage: z.boolean().optional(),
703
- stdDev: z.number().int().positive().optional(),
704
- style: ContentSheetConditionalFormatStyleSchema.optional()
705
- }),
706
- z.object({
707
- type: z.literal("timePeriod"),
708
- ...conditionalFormatCommonFields,
709
- timePeriod: z.enum([
710
- "yesterday",
711
- "today",
712
- "tomorrow",
713
- "last7Days",
714
- "thisMonth",
715
- "lastMonth",
716
- "nextMonth",
717
- "thisWeek",
718
- "lastWeek",
719
- "nextWeek",
720
- "thisYear",
721
- "lastYear",
722
- "nextYear"
723
- ]),
724
- style: ContentSheetConditionalFormatStyleSchema.optional()
725
- }),
726
- z.object({
727
- type: z.literal("colorScale"),
728
- ...conditionalFormatCommonFields,
729
- stops: z.array(z.object({
730
- value: ContentSheetConditionalFormatValueSchema,
731
- color: ColorSchema
732
- })).min(MIN_COLOR_SCALE_STOPS).max(MAX_COLOR_SCALE_STOPS)
733
- }),
734
- z.object({
735
- type: z.literal("dataBar"),
736
- ...conditionalFormatCommonFields,
737
- min: ContentSheetConditionalFormatValueSchema,
738
- max: ContentSheetConditionalFormatValueSchema,
739
- color: ColorSchema,
740
- showValue: z.boolean().optional()
741
- }),
742
- z.object({
743
- type: z.literal("iconSet"),
744
- ...conditionalFormatCommonFields,
745
- iconSetType: z.string(),
746
- thresholds: z.array(ContentSheetConditionalFormatValueSchema),
747
- reverse: z.boolean().optional(),
748
- showValue: z.boolean().optional()
749
- })
750
- ]);
751
- const ContentSheetImageSchema = ContentImageBlockSchema.extend({
752
- anchorRow: z.number().int().nonnegative(),
753
- anchorColumn: z.number().int().nonnegative(),
754
- offsetXPt: z.number(),
755
- offsetYPt: z.number()
756
- });
757
- const ContentSheetSchema = z.object({
758
- name: z.string(),
759
- cells: z.array(ContentSheetCellSchema),
760
- columns: z.array(ContentSheetColumnSchema),
761
- rows: z.array(ContentSheetRowSchema),
762
- images: z.array(ContentSheetImageSchema),
763
- printSettings: ContentSheetPrintSettingsSchema,
764
- embeddedObjects: z.array(ContentEmbeddedObjectSchema).optional(),
765
- dataValidations: z.array(ContentSheetDataValidationSchema).optional(),
766
- conditionalFormats: z.array(ContentSheetConditionalFormatSchema).optional(),
767
- source: SourceResidueSchema.optional(),
768
- ...CONTENT_ANNOTATION_FIELDS
769
- });
770
- const ContentStrokeDashSchema = z.object({
771
- dots1: z.number().int().positive(),
772
- dots1LengthPt: z.number().positive(),
773
- dots2: z.number().int().positive().optional(),
774
- dots2LengthPt: z.number().positive().optional(),
775
- distancePt: z.number().nonnegative()
776
- });
777
- const ContentStrokeSchema = z.object({
778
- color: ColorSchema,
779
- widthPt: z.number().positive(),
780
- style: ContentStrokeStyleSchema.optional(),
781
- opacity: z.number().min(0).max(1).optional(),
782
- dashPattern: ContentStrokeDashSchema.optional()
783
- });
784
- const ContentGradientStyleSchema = z.enum([
785
- "linear",
786
- "axial",
787
- "radial",
788
- "ellipsoid",
789
- "square",
790
- "rectangular"
791
- ]);
792
- const ContentGradientFillSchema = z.object({
793
- kind: z.literal("gradient"),
794
- style: ContentGradientStyleSchema,
795
- startColor: ColorSchema,
796
- endColor: ColorSchema,
797
- angleDeg: z.number().optional()
798
- });
799
- const ContentHatchStyleSchema = z.enum([
800
- "single",
801
- "double",
802
- "triple"
803
- ]);
804
- const ContentHatchFillSchema = z.object({
805
- kind: z.literal("hatch"),
806
- style: ContentHatchStyleSchema,
807
- color: ColorSchema,
808
- distancePt: z.number().nonnegative(),
809
- rotationDeg: z.number().optional()
810
- });
811
- const ContentBitmapFillSchema = z.object({
812
- kind: z.literal("bitmap"),
813
- format: z.enum([
814
- "png",
815
- "jpeg",
816
- "svg",
817
- "gif"
818
- ]),
819
- base64: z.string()
820
- });
821
- const ContentFillPatternSchema = z.discriminatedUnion("kind", [
822
- ContentGradientFillSchema,
823
- ContentHatchFillSchema,
824
- ContentBitmapFillSchema
825
- ]);
826
- const ContentPathPointSchema = z.object({
827
- xPt: z.number(),
828
- yPt: z.number()
829
- });
830
- const ContentPathSegmentSchema = z.discriminatedUnion("kind", [z.object({
831
- kind: z.literal("line"),
832
- to: ContentPathPointSchema
833
- }), z.object({
834
- kind: z.literal("cubic"),
835
- control1: ContentPathPointSchema,
836
- control2: ContentPathPointSchema,
837
- to: ContentPathPointSchema
838
- })]);
839
- const ContentSubpathSchema = z.object({
840
- start: ContentPathPointSchema,
841
- segments: z.array(ContentPathSegmentSchema),
842
- closed: z.boolean()
843
- });
844
- const ContentVectorSchema = z.discriminatedUnion("kind", [
845
- z.object({
846
- kind: z.literal("rect"),
847
- frame: BoxSchema,
848
- rotationDeg: z.number().optional(),
849
- fill: ColorSchema.optional(),
850
- fillPattern: ContentFillPatternSchema.optional(),
851
- fillOpacity: z.number().min(0).max(1).optional(),
852
- stroke: ContentStrokeSchema.optional(),
853
- paintOrder: z.number().optional(),
854
- sourcePath: z.string().optional(),
855
- source: SourceResidueSchema.optional(),
856
- frames: z.array(LayoutFrameSchema).optional(),
857
- ...CONTENT_ANNOTATION_FIELDS
858
- }),
859
- z.object({
860
- kind: z.literal("ellipse"),
861
- frame: BoxSchema,
862
- rotationDeg: z.number().optional(),
863
- fill: ColorSchema.optional(),
864
- fillPattern: ContentFillPatternSchema.optional(),
865
- fillOpacity: z.number().min(0).max(1).optional(),
866
- stroke: ContentStrokeSchema.optional(),
867
- paintOrder: z.number().optional(),
868
- sourcePath: z.string().optional(),
869
- source: SourceResidueSchema.optional(),
870
- frames: z.array(LayoutFrameSchema).optional(),
871
- ...CONTENT_ANNOTATION_FIELDS
872
- }),
873
- z.object({
874
- kind: z.literal("line"),
875
- from: ContentPathPointSchema,
876
- to: ContentPathPointSchema,
877
- stroke: ContentStrokeSchema,
878
- paintOrder: z.number().optional(),
879
- sourcePath: z.string().optional(),
880
- source: SourceResidueSchema.optional(),
881
- frames: z.array(LayoutFrameSchema).optional(),
882
- ...CONTENT_ANNOTATION_FIELDS
883
- }),
884
- z.object({
885
- kind: z.literal("path"),
886
- frame: BoxSchema,
887
- rotationDeg: z.number().optional(),
888
- subpaths: z.array(ContentSubpathSchema),
889
- fill: ColorSchema.optional(),
890
- fillPattern: ContentFillPatternSchema.optional(),
891
- fillOpacity: z.number().min(0).max(1).optional(),
892
- fillRule: z.enum(["nonzero", "evenodd"]).optional(),
893
- stroke: ContentStrokeSchema.optional(),
894
- paintOrder: z.number().optional(),
895
- sourcePath: z.string().optional(),
896
- source: SourceResidueSchema.optional(),
897
- frames: z.array(LayoutFrameSchema).optional(),
898
- ...CONTENT_ANNOTATION_FIELDS
899
- })
900
- ]);
901
- const ContentDrawPageSchema = z.object({
902
- size: PageSizeSchema,
903
- shapes: z.array(ContentShapeSchema),
904
- vectors: z.array(ContentVectorSchema),
905
- source: SourceResidueSchema.optional(),
906
- ...CONTENT_ANNOTATION_FIELDS
907
- });
908
216
  const ContentFormulaSchema = z.object({
909
217
  mathml: z.array(MathMlNodeSchema),
910
218
  starMath: z.string().optional(),
@@ -953,5 +261,6 @@ const ContentDocumentSchema = z.discriminatedUnion("kind", [
953
261
  formula: ContentFormulaSchema
954
262
  })
955
263
  ]);
264
+ contentDocumentSchemaBox.value = ContentDocumentSchema;
956
265
  //#endregion
957
- export { CONTENT_ANNOTATION_FIELDS, ContentBitmapFillSchema, ContentBlockSchema, ContentBorderSchema, ContentCellBordersSchema, ContentCellFillSchema, ContentCellPatternTypeSchema, ContentCellValueSchema, ContentConstructEndSchema, ContentConstructStartSchema, ContentDefinedNameSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectSchema, ContentFillPatternSchema, ContentFloatAlignSchema, ContentFloatAxisSchema, ContentFloatOriginSchema, ContentFloatPositionSchema, ContentFontSchema, ContentFormulaSchema, ContentGradientFillSchema, ContentGradientStyleSchema, ContentHatchFillSchema, ContentHatchStyleSchema, ContentImageBlockSchema, ContentImageOriginalSchema, ContentInterpretationSchema, ContentListMembershipSchema, ContentOriginSchema, ContentPageBreakSchema, ContentPageFurnitureSchema, ContentParagraphBordersSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellCommentSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetConditionalFormatSchema, ContentSheetConditionalFormatStyleSchema, ContentSheetConditionalFormatValueSchema, ContentSheetDataValidationSchema, ContentSheetDataValidationTypeSchema, ContentSheetImageSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRangeSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeDashSchema, ContentStrokeSchema, ContentStrokeStyleSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableColumnSchema, ContentTableRowSchema, ContentTableSchema, ContentTranscriptSchema, ContentVectorSchema, DecimalStringSchema, IMAGE_FORMATS, RUN_FONT_PROPERTY_SHAPE, RunConstructExtentSchema, SheetRuleOperatorSchema, clampHeadingLevel, contentDocumentSharedFields, findConstructMarkerImbalance, findRunConstructFault, isContentBlock, isContentConstructEnd, isContentConstructStart, isRunConstructExtent, resolveCellFillColor, unrecognizedFillKind };
266
+ export { ContentBlockSchema, ContentConstructEndSchema, ContentConstructStartSchema, ContentDefinedNameSchema, ContentDocumentSchema, ContentFormulaSchema, ContentListMembershipSchema, ContentPageBreakSchema, ContentPageFurnitureSchema, ContentParagraphBordersSchema, ContentParagraphSchema, ContentSectionSchema, ContentTableCellSchema, ContentTableColumnSchema, ContentTableRowSchema, ContentTableSchema, clampHeadingLevel, contentDocumentSharedFields, findConstructMarkerImbalance, findRunConstructFault, isContentBlock, isContentConstructEnd, isContentConstructStart, isRunConstructExtent };