document-schema 7.15.3 → 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 (107) 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 +1 -1
  12. package/dist/codec.d.ts +1 -1
  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-CSf8z9NW.d.cts → content-DQui8vwD.d.cts} +7917 -9507
  18. package/dist/{content-1yGdeaVT.d.ts → content-DaST7v0K.d.ts} +7917 -9507
  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 +27 -3033
  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 +28 -3031
  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 -781
  38. package/dist/content.d.cts +2 -2
  39. package/dist/content.d.ts +2 -2
  40. package/dist/content.js +6 -701
  41. package/dist/decompose.d.cts +3 -2
  42. package/dist/decompose.d.ts +3 -2
  43. package/dist/definitions.cjs +2 -1
  44. package/dist/definitions.d.cts +4 -4
  45. package/dist/definitions.d.ts +4 -4
  46. package/dist/definitions.js +2 -1
  47. package/dist/factor-styles.d.cts +1 -1
  48. package/dist/factor-styles.d.ts +1 -1
  49. package/dist/flatten.d.cts +1 -1
  50. package/dist/flatten.d.ts +1 -1
  51. package/dist/index.cjs +69 -63
  52. package/dist/index.d.cts +11 -9
  53. package/dist/index.d.ts +11 -9
  54. package/dist/index.js +10 -6
  55. package/dist/json-schema-defs-blocks.cjs +1036 -0
  56. package/dist/json-schema-defs-blocks.d.cts +5 -0
  57. package/dist/json-schema-defs-blocks.d.ts +5 -0
  58. package/dist/json-schema-defs-blocks.js +1035 -0
  59. package/dist/json-schema-defs-math.cjs +291 -0
  60. package/dist/json-schema-defs-math.d.cts +5 -0
  61. package/dist/json-schema-defs-math.d.ts +5 -0
  62. package/dist/json-schema-defs-math.js +290 -0
  63. package/dist/json-schema-defs-shared.cjs +42 -0
  64. package/dist/json-schema-defs-shared.d.cts +9 -0
  65. package/dist/json-schema-defs-shared.d.ts +9 -0
  66. package/dist/json-schema-defs-shared.js +38 -0
  67. package/dist/json-schema-defs-sheet.cjs +944 -0
  68. package/dist/json-schema-defs-sheet.d.cts +5 -0
  69. package/dist/json-schema-defs-sheet.d.ts +5 -0
  70. package/dist/json-schema-defs-sheet.js +943 -0
  71. package/dist/json-schema-defs-tree.cjs +237 -0
  72. package/dist/json-schema-defs-tree.d.cts +5 -0
  73. package/dist/json-schema-defs-tree.d.ts +5 -0
  74. package/dist/json-schema-defs-tree.js +237 -0
  75. package/dist/json-schema-defs-vector.cjs +513 -0
  76. package/dist/json-schema-defs-vector.d.cts +5 -0
  77. package/dist/json-schema-defs-vector.d.ts +5 -0
  78. package/dist/json-schema-defs-vector.js +512 -0
  79. package/dist/magic-string.es-CB2hOw9v.js +1012 -0
  80. package/dist/magic-string.es-MEBc20Ce.cjs +1012 -0
  81. package/dist/{math-BScHxedi.d.cts → math-DdIQCljT.d.cts} +9 -9
  82. package/dist/{math-BScHxedi.d.ts → math-DdIQCljT.d.ts} +9 -9
  83. package/dist/math.d.cts +1 -1
  84. package/dist/math.d.ts +1 -1
  85. package/dist/{package-node-CpE1BAqK.d.ts → package-node-BMbep0jw.d.ts} +44 -43
  86. package/dist/{package-node-ng7Yimj9.d.cts → package-node-DXhNJt15.d.cts} +44 -43
  87. package/dist/package-node.cjs +12 -9
  88. package/dist/package-node.d.cts +1 -1
  89. package/dist/package-node.d.ts +1 -1
  90. package/dist/package-node.js +4 -1
  91. package/dist/package.d.cts +12 -12
  92. package/dist/package.d.ts +12 -12
  93. package/dist/schema-io.cjs +2 -2
  94. package/dist/schema-io.d.cts +1 -1
  95. package/dist/schema-io.d.ts +1 -1
  96. package/dist/schema-io.js +2 -2
  97. package/dist/{style-BGMcYrD2.d.cts → style-D06NwxAJ.d.cts} +1 -1
  98. package/dist/{style-BGMcYrD2.d.ts → style-D06NwxAJ.d.ts} +1 -1
  99. package/dist/style.d.cts +1 -1
  100. package/dist/style.d.ts +1 -1
  101. package/dist/table-grid.d.cts +2 -2
  102. package/dist/table-grid.d.ts +2 -2
  103. package/dist/text-layout.d.cts +1 -1
  104. package/dist/text-layout.d.ts +1 -1
  105. package/package.json +1 -1
  106. package/schemas/content-document.schema.json +16 -16
  107. 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(),
@@ -219,7 +89,6 @@ function isContentTableColumn(value) {
219
89
  function isContentEmbeddedObjectKind(value) {
220
90
  return value === "formula" || value === "wordprocessing" || value === "presentation" || value === "spreadsheet" || value === "drawing" || value === "chart";
221
91
  }
222
- const contentDocumentSchemaBox = {};
223
92
  function isContentEmbeddedObject(value) {
224
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");
225
94
  }
@@ -249,31 +118,6 @@ function isContentBlock(value) {
249
118
  if (kind === "constructEnd") return true;
250
119
  return false;
251
120
  }
252
- const CONTENT_EMBEDDED_OBJECT_FIELDS = {
253
- objectKind: z.enum([
254
- "formula",
255
- "wordprocessing",
256
- "presentation",
257
- "spreadsheet",
258
- "drawing",
259
- "chart"
260
- ]),
261
- document: z.lazy(() => contentDocumentSchemaBox.value),
262
- frame: BoxSchema,
263
- anchorRow: z.number().int().nonnegative().optional(),
264
- anchorColumn: z.number().int().nonnegative().optional(),
265
- offsetXPt: z.number().optional(),
266
- offsetYPt: z.number().optional(),
267
- source: SourceResidueSchema.optional(),
268
- ...CONTENT_ANNOTATION_FIELDS
269
- };
270
- const ContentEmbeddedObjectSchema = z.object(CONTENT_EMBEDDED_OBJECT_FIELDS);
271
- const ContentEmbeddedObjectBlockSchema = z.object({
272
- kind: z.literal("embeddedObject"),
273
- ...CONTENT_EMBEDDED_OBJECT_FIELDS,
274
- sourcePath: z.string().optional(),
275
- frames: z.array(LayoutFrameSchema).optional()
276
- });
277
121
  function findConstructMarkerImbalance(blocks) {
278
122
  const openStartIndices = [];
279
123
  for (const [index, block] of blocks.entries()) if (isContentConstructStart(block)) openStartIndices.push(index);
@@ -301,84 +145,6 @@ function findRunConstructFault(paragraph) {
301
145
  };
302
146
  }
303
147
  }
304
- const ContentCellBordersSchema = z.object({
305
- left: ContentBorderSchema.optional(),
306
- right: ContentBorderSchema.optional(),
307
- top: ContentBorderSchema.optional(),
308
- bottom: ContentBorderSchema.optional(),
309
- diagonalUp: ContentBorderSchema.optional(),
310
- diagonalDown: ContentBorderSchema.optional()
311
- });
312
- const ContentCellPatternTypeSchema = z.enum([
313
- "percent5",
314
- "percent10",
315
- "percent12",
316
- "percent15",
317
- "percent20",
318
- "percent25",
319
- "percent30",
320
- "percent35",
321
- "percent37",
322
- "percent40",
323
- "percent45",
324
- "percent50",
325
- "percent55",
326
- "percent60",
327
- "percent62",
328
- "percent65",
329
- "percent70",
330
- "percent75",
331
- "percent80",
332
- "percent85",
333
- "percent87",
334
- "percent90",
335
- "percent95",
336
- "horizontalStripe",
337
- "verticalStripe",
338
- "diagonalStripe",
339
- "reverseDiagonalStripe",
340
- "horizontalCross",
341
- "diagonalCross",
342
- "thinHorizontalStripe",
343
- "thinVerticalStripe",
344
- "thinDiagonalStripe",
345
- "thinReverseDiagonalStripe",
346
- "thinHorizontalCross",
347
- "thinDiagonalCross",
348
- "mediumGray",
349
- "darkGray",
350
- "lightGray",
351
- "darkHorizontal",
352
- "darkVertical",
353
- "darkDown",
354
- "darkUp",
355
- "darkGrid",
356
- "darkTrellis",
357
- "lightHorizontal",
358
- "lightVertical",
359
- "lightDown",
360
- "lightUp",
361
- "lightGrid",
362
- "lightTrellis",
363
- "gray125",
364
- "gray0625"
365
- ]);
366
- const ContentCellFillSchema = z.discriminatedUnion("kind", [z.object({
367
- kind: z.literal("solid"),
368
- color: ColorSchema
369
- }), z.object({
370
- kind: z.literal("pattern"),
371
- patternType: ContentCellPatternTypeSchema,
372
- foregroundColor: ColorSchema.optional(),
373
- backgroundColor: ColorSchema.optional()
374
- })]);
375
- function resolveCellFillColor(fill) {
376
- return fill.kind === "solid" ? fill.color : fill.foregroundColor ?? fill.backgroundColor;
377
- }
378
- function unrecognizedFillKind(fill) {
379
- return String(fill.kind);
380
- }
381
- const contentBlockSchemaBox = {};
382
148
  const ContentTableCellSchema = z.object({
383
149
  blocks: z.lazy(() => z.array(contentBlockSchemaBox.value)),
384
150
  colSpan: z.number().int().positive().optional(),
@@ -425,6 +191,7 @@ const ContentBlockSchema = z.discriminatedUnion("kind", [
425
191
  ContentConstructEndSchema
426
192
  ]);
427
193
  contentBlockSchemaBox.value = ContentBlockSchema;
194
+ contentBlockSchemaBox.value = ContentBlockSchema;
428
195
  const ContentPageFurnitureSchema = z.object({
429
196
  default: z.lazy(() => z.array(ContentBlockSchema)).optional(),
430
197
  even: z.lazy(() => z.array(ContentBlockSchema)).optional(),
@@ -446,468 +213,6 @@ const ContentSectionSchema = z.object({
446
213
  source: SourceResidueSchema.optional(),
447
214
  ...CONTENT_ANNOTATION_FIELDS
448
215
  });
449
- const ContentShapeSchema = z.object({
450
- name: z.string().optional(),
451
- frame: BoxSchema,
452
- rotationDeg: z.number().optional(),
453
- insetLeftPt: z.number().nonnegative(),
454
- insetTopPt: z.number().nonnegative(),
455
- insetRightPt: z.number().nonnegative(),
456
- insetBottomPt: z.number().nonnegative(),
457
- fontScale: z.number().positive().optional(),
458
- lineSpacingReduction: z.number().nonnegative().optional(),
459
- paintOrder: z.number().optional(),
460
- readingOrder: z.number().optional(),
461
- sourcePath: z.string().optional(),
462
- source: SourceResidueSchema.optional(),
463
- frames: z.array(LayoutFrameSchema).optional(),
464
- ...CONTENT_ANNOTATION_FIELDS,
465
- blocks: z.lazy(() => z.array(ContentBlockSchema))
466
- });
467
- const ContentSlideSchema = z.object({
468
- size: PageSizeSchema,
469
- shapes: z.array(ContentShapeSchema),
470
- notes: z.string(),
471
- source: SourceResidueSchema.optional(),
472
- ...CONTENT_ANNOTATION_FIELDS
473
- });
474
- const DecimalStringSchema = z.string().regex(/^-?(0|[1-9]\d*)(\.\d+)?$/);
475
- const ContentCellValueSchema = z.discriminatedUnion("kind", [
476
- z.object({
477
- kind: z.literal("number"),
478
- value: z.number(),
479
- exactValue: DecimalStringSchema.optional()
480
- }),
481
- z.object({
482
- kind: z.literal("percentage"),
483
- value: z.number(),
484
- exactValue: DecimalStringSchema.optional()
485
- }),
486
- z.object({
487
- kind: z.literal("currency"),
488
- value: z.number(),
489
- currency: z.string().optional(),
490
- exactValue: DecimalStringSchema.optional()
491
- }),
492
- z.object({
493
- kind: z.literal("boolean"),
494
- value: z.boolean()
495
- }),
496
- z.object({
497
- kind: z.literal("date"),
498
- value: z.string()
499
- }),
500
- z.object({
501
- kind: z.literal("time"),
502
- value: z.string()
503
- }),
504
- z.object({
505
- kind: z.literal("dateTime"),
506
- value: z.string()
507
- }),
508
- z.object({
509
- kind: z.literal("string"),
510
- value: z.string()
511
- }),
512
- z.object({
513
- kind: z.literal("error"),
514
- value: z.string()
515
- }),
516
- z.object({ kind: z.literal("empty") })
517
- ]);
518
- const ContentSheetCellCommentSchema = z.object({
519
- text: z.string(),
520
- author: z.string().optional(),
521
- createdAt: z.string().optional(),
522
- replies: z.array(z.object({
523
- text: z.string(),
524
- author: z.string().optional()
525
- })).optional()
526
- });
527
- const ContentSheetCellSchema = z.object({
528
- row: z.number().int().nonnegative(),
529
- column: z.number().int().nonnegative(),
530
- value: ContentCellValueSchema,
531
- formula: z.string().optional(),
532
- displayText: z.string(),
533
- numberFormatCode: z.string().optional(),
534
- font: ContentFontSchema.optional(),
535
- runs: z.array(ContentRunSchema).optional(),
536
- colSpan: z.number().int().positive().optional(),
537
- rowSpan: z.number().int().positive().optional(),
538
- background: ContentCellFillSchema.optional(),
539
- borders: ContentCellBordersSchema.optional(),
540
- alignment: AlignmentSchema.optional(),
541
- verticalAlignment: z.enum([
542
- "top",
543
- "middle",
544
- "bottom"
545
- ]).optional(),
546
- comment: ContentSheetCellCommentSchema.optional(),
547
- sourcePath: z.string().optional(),
548
- source: SourceResidueSchema.optional(),
549
- frames: z.array(LayoutFrameSchema).optional(),
550
- ...CONTENT_ANNOTATION_FIELDS
551
- });
552
- const ContentSheetColumnSchema = z.object({
553
- index: z.number().int().nonnegative(),
554
- widthPt: z.number().positive().optional(),
555
- hidden: z.boolean().optional()
556
- });
557
- const ContentSheetRowSchema = z.object({
558
- index: z.number().int().nonnegative(),
559
- heightPt: z.number().positive().optional(),
560
- hidden: z.boolean().optional()
561
- });
562
- const ContentSheetPrintRangeSchema = z.object({
563
- startRow: z.number().int().nonnegative(),
564
- startColumn: z.number().int().nonnegative(),
565
- endRow: z.number().int().nonnegative(),
566
- endColumn: z.number().int().nonnegative()
567
- });
568
- const ContentSheetRepeatRangeSchema = z.object({
569
- start: z.number().int().nonnegative(),
570
- end: z.number().int().nonnegative()
571
- });
572
- const ContentSheetPrintSettingsSchema = z.object({
573
- pageSize: PageSizeSchema,
574
- margins: MarginsSchema,
575
- printRange: ContentSheetPrintRangeSchema.optional(),
576
- scalePercent: z.number().positive().optional(),
577
- fitToPages: z.object({
578
- width: z.number().int().positive(),
579
- height: z.number().int().positive()
580
- }).optional(),
581
- repeatRows: ContentSheetRepeatRangeSchema.optional(),
582
- repeatColumns: ContentSheetRepeatRangeSchema.optional(),
583
- gridlines: z.boolean(),
584
- headers: z.boolean(),
585
- pageOrder: z.enum(["downThenOver", "overThenDown"]),
586
- manualBreaks: z.object({
587
- rows: z.array(z.number().int().nonnegative()),
588
- columns: z.array(z.number().int().nonnegative())
589
- }).optional()
590
- });
591
- const ContentSheetRangeSchema = z.object({
592
- startRow: z.number().int().nonnegative(),
593
- startColumn: z.number().int().nonnegative(),
594
- endRow: z.number().int().nonnegative(),
595
- endColumn: z.number().int().nonnegative()
596
- });
597
- const SheetRuleOperatorSchema = z.enum([
598
- "between",
599
- "notBetween",
600
- "equal",
601
- "notEqual",
602
- "greaterThan",
603
- "greaterThanOrEqual",
604
- "lessThan",
605
- "lessThanOrEqual"
606
- ]);
607
- const ContentSheetDataValidationTypeSchema = z.enum([
608
- "whole",
609
- "decimal",
610
- "list",
611
- "date",
612
- "time",
613
- "textLength",
614
- "custom"
615
- ]);
616
- const ContentSheetDataValidationSchema = z.object({
617
- ranges: z.array(ContentSheetRangeSchema),
618
- type: ContentSheetDataValidationTypeSchema,
619
- operator: SheetRuleOperatorSchema.optional(),
620
- formula1: z.string().optional(),
621
- formula2: z.string().optional(),
622
- allowBlank: z.boolean().optional(),
623
- showInputMessage: z.boolean().optional(),
624
- promptTitle: z.string().optional(),
625
- prompt: z.string().optional(),
626
- showErrorMessage: z.boolean().optional(),
627
- errorStyle: z.enum([
628
- "stop",
629
- "warning",
630
- "information"
631
- ]).optional(),
632
- errorTitle: z.string().optional(),
633
- error: z.string().optional(),
634
- source: SourceResidueSchema.optional()
635
- });
636
- const ContentSheetConditionalFormatStyleSchema = z.object({
637
- textColor: ColorSchema.optional(),
638
- background: ColorSchema.optional(),
639
- source: SourceResidueSchema.optional()
640
- });
641
- const cfvoTypeSchema = z.enum([
642
- "num",
643
- "percent",
644
- "max",
645
- "min",
646
- "formula",
647
- "percentile"
648
- ]);
649
- const ContentSheetConditionalFormatValueSchema = z.object({
650
- type: cfvoTypeSchema,
651
- value: z.string().optional()
652
- });
653
- const MIN_COLOR_SCALE_STOPS = 2;
654
- const MAX_COLOR_SCALE_STOPS = 3;
655
- const conditionalFormatCommonFields = {
656
- ranges: z.array(ContentSheetRangeSchema),
657
- priority: z.number().int().optional(),
658
- stopIfTrue: z.boolean().optional(),
659
- source: SourceResidueSchema.optional()
660
- };
661
- const ContentSheetConditionalFormatSchema = z.discriminatedUnion("type", [
662
- z.object({
663
- type: z.literal("cellIs"),
664
- ...conditionalFormatCommonFields,
665
- operator: SheetRuleOperatorSchema,
666
- formula1: z.string(),
667
- formula2: z.string().optional(),
668
- style: ContentSheetConditionalFormatStyleSchema.optional()
669
- }),
670
- z.object({
671
- type: z.enum([
672
- "containsText",
673
- "notContainsText",
674
- "beginsWith",
675
- "endsWith"
676
- ]),
677
- ...conditionalFormatCommonFields,
678
- text: z.string(),
679
- style: ContentSheetConditionalFormatStyleSchema.optional()
680
- }),
681
- z.object({
682
- type: z.enum([
683
- "containsBlanks",
684
- "notContainsBlanks",
685
- "containsErrors",
686
- "notContainsErrors",
687
- "uniqueValues",
688
- "duplicateValues"
689
- ]),
690
- ...conditionalFormatCommonFields,
691
- style: ContentSheetConditionalFormatStyleSchema.optional()
692
- }),
693
- z.object({
694
- type: z.literal("top10"),
695
- ...conditionalFormatCommonFields,
696
- rank: z.number().positive(),
697
- percent: z.boolean().optional(),
698
- bottom: z.boolean().optional(),
699
- style: ContentSheetConditionalFormatStyleSchema.optional()
700
- }),
701
- z.object({
702
- type: z.literal("aboveAverage"),
703
- ...conditionalFormatCommonFields,
704
- aboveAverage: z.boolean().optional(),
705
- equalAverage: z.boolean().optional(),
706
- stdDev: z.number().int().positive().optional(),
707
- style: ContentSheetConditionalFormatStyleSchema.optional()
708
- }),
709
- z.object({
710
- type: z.literal("timePeriod"),
711
- ...conditionalFormatCommonFields,
712
- timePeriod: z.enum([
713
- "yesterday",
714
- "today",
715
- "tomorrow",
716
- "last7Days",
717
- "thisMonth",
718
- "lastMonth",
719
- "nextMonth",
720
- "thisWeek",
721
- "lastWeek",
722
- "nextWeek",
723
- "thisYear",
724
- "lastYear",
725
- "nextYear"
726
- ]),
727
- style: ContentSheetConditionalFormatStyleSchema.optional()
728
- }),
729
- z.object({
730
- type: z.literal("colorScale"),
731
- ...conditionalFormatCommonFields,
732
- stops: z.array(z.object({
733
- value: ContentSheetConditionalFormatValueSchema,
734
- color: ColorSchema
735
- })).min(MIN_COLOR_SCALE_STOPS).max(MAX_COLOR_SCALE_STOPS)
736
- }),
737
- z.object({
738
- type: z.literal("dataBar"),
739
- ...conditionalFormatCommonFields,
740
- min: ContentSheetConditionalFormatValueSchema,
741
- max: ContentSheetConditionalFormatValueSchema,
742
- color: ColorSchema,
743
- showValue: z.boolean().optional()
744
- }),
745
- z.object({
746
- type: z.literal("iconSet"),
747
- ...conditionalFormatCommonFields,
748
- iconSetType: z.string(),
749
- thresholds: z.array(ContentSheetConditionalFormatValueSchema),
750
- reverse: z.boolean().optional(),
751
- showValue: z.boolean().optional()
752
- })
753
- ]);
754
- const ContentSheetImageSchema = ContentImageBlockSchema.extend({
755
- anchorRow: z.number().int().nonnegative(),
756
- anchorColumn: z.number().int().nonnegative(),
757
- offsetXPt: z.number(),
758
- offsetYPt: z.number()
759
- });
760
- const ContentSheetSchema = z.object({
761
- name: z.string(),
762
- cells: z.array(ContentSheetCellSchema),
763
- columns: z.array(ContentSheetColumnSchema),
764
- rows: z.array(ContentSheetRowSchema),
765
- images: z.array(ContentSheetImageSchema),
766
- printSettings: ContentSheetPrintSettingsSchema,
767
- embeddedObjects: z.array(ContentEmbeddedObjectSchema).optional(),
768
- dataValidations: z.array(ContentSheetDataValidationSchema).optional(),
769
- conditionalFormats: z.array(ContentSheetConditionalFormatSchema).optional(),
770
- source: SourceResidueSchema.optional(),
771
- ...CONTENT_ANNOTATION_FIELDS
772
- });
773
- const ContentStrokeDashSchema = z.object({
774
- dots1: z.number().int().positive(),
775
- dots1LengthPt: z.number().positive(),
776
- dots2: z.number().int().positive().optional(),
777
- dots2LengthPt: z.number().positive().optional(),
778
- distancePt: z.number().nonnegative()
779
- });
780
- const ContentStrokeSchema = z.object({
781
- color: ColorSchema,
782
- widthPt: z.number().positive(),
783
- style: ContentStrokeStyleSchema.optional(),
784
- opacity: z.number().min(0).max(1).optional(),
785
- dashPattern: ContentStrokeDashSchema.optional()
786
- });
787
- const ContentGradientStyleSchema = z.enum([
788
- "linear",
789
- "axial",
790
- "radial",
791
- "ellipsoid",
792
- "square",
793
- "rectangular"
794
- ]);
795
- const ContentGradientFillSchema = z.object({
796
- kind: z.literal("gradient"),
797
- style: ContentGradientStyleSchema,
798
- startColor: ColorSchema,
799
- endColor: ColorSchema,
800
- angleDeg: z.number().optional()
801
- });
802
- const ContentHatchStyleSchema = z.enum([
803
- "single",
804
- "double",
805
- "triple"
806
- ]);
807
- const ContentHatchFillSchema = z.object({
808
- kind: z.literal("hatch"),
809
- style: ContentHatchStyleSchema,
810
- color: ColorSchema,
811
- distancePt: z.number().nonnegative(),
812
- rotationDeg: z.number().optional()
813
- });
814
- const ContentBitmapFillSchema = z.object({
815
- kind: z.literal("bitmap"),
816
- format: z.enum([
817
- "png",
818
- "jpeg",
819
- "svg",
820
- "gif"
821
- ]),
822
- base64: z.string()
823
- });
824
- const ContentFillPatternSchema = z.discriminatedUnion("kind", [
825
- ContentGradientFillSchema,
826
- ContentHatchFillSchema,
827
- ContentBitmapFillSchema
828
- ]);
829
- const ContentPathPointSchema = z.object({
830
- xPt: z.number(),
831
- yPt: z.number()
832
- });
833
- const ContentPathSegmentSchema = z.discriminatedUnion("kind", [z.object({
834
- kind: z.literal("line"),
835
- to: ContentPathPointSchema
836
- }), z.object({
837
- kind: z.literal("cubic"),
838
- control1: ContentPathPointSchema,
839
- control2: ContentPathPointSchema,
840
- to: ContentPathPointSchema
841
- })]);
842
- const ContentSubpathSchema = z.object({
843
- start: ContentPathPointSchema,
844
- segments: z.array(ContentPathSegmentSchema),
845
- closed: z.boolean()
846
- });
847
- const ContentVectorSchema = z.discriminatedUnion("kind", [
848
- z.object({
849
- kind: z.literal("rect"),
850
- frame: BoxSchema,
851
- rotationDeg: z.number().optional(),
852
- fill: ColorSchema.optional(),
853
- fillPattern: ContentFillPatternSchema.optional(),
854
- fillOpacity: z.number().min(0).max(1).optional(),
855
- stroke: ContentStrokeSchema.optional(),
856
- paintOrder: z.number().optional(),
857
- sourcePath: z.string().optional(),
858
- source: SourceResidueSchema.optional(),
859
- frames: z.array(LayoutFrameSchema).optional(),
860
- ...CONTENT_ANNOTATION_FIELDS
861
- }),
862
- z.object({
863
- kind: z.literal("ellipse"),
864
- frame: BoxSchema,
865
- rotationDeg: z.number().optional(),
866
- fill: ColorSchema.optional(),
867
- fillPattern: ContentFillPatternSchema.optional(),
868
- fillOpacity: z.number().min(0).max(1).optional(),
869
- stroke: ContentStrokeSchema.optional(),
870
- paintOrder: z.number().optional(),
871
- sourcePath: z.string().optional(),
872
- source: SourceResidueSchema.optional(),
873
- frames: z.array(LayoutFrameSchema).optional(),
874
- ...CONTENT_ANNOTATION_FIELDS
875
- }),
876
- z.object({
877
- kind: z.literal("line"),
878
- from: ContentPathPointSchema,
879
- to: ContentPathPointSchema,
880
- stroke: ContentStrokeSchema,
881
- paintOrder: z.number().optional(),
882
- sourcePath: z.string().optional(),
883
- source: SourceResidueSchema.optional(),
884
- frames: z.array(LayoutFrameSchema).optional(),
885
- ...CONTENT_ANNOTATION_FIELDS
886
- }),
887
- z.object({
888
- kind: z.literal("path"),
889
- frame: BoxSchema,
890
- rotationDeg: z.number().optional(),
891
- subpaths: z.array(ContentSubpathSchema),
892
- fill: ColorSchema.optional(),
893
- fillPattern: ContentFillPatternSchema.optional(),
894
- fillOpacity: z.number().min(0).max(1).optional(),
895
- fillRule: z.enum(["nonzero", "evenodd"]).optional(),
896
- stroke: ContentStrokeSchema.optional(),
897
- paintOrder: z.number().optional(),
898
- sourcePath: z.string().optional(),
899
- source: SourceResidueSchema.optional(),
900
- frames: z.array(LayoutFrameSchema).optional(),
901
- ...CONTENT_ANNOTATION_FIELDS
902
- })
903
- ]);
904
- const ContentDrawPageSchema = z.object({
905
- size: PageSizeSchema,
906
- shapes: z.array(ContentShapeSchema),
907
- vectors: z.array(ContentVectorSchema),
908
- source: SourceResidueSchema.optional(),
909
- ...CONTENT_ANNOTATION_FIELDS
910
- });
911
216
  const ContentFormulaSchema = z.object({
912
217
  mathml: z.array(MathMlNodeSchema),
913
218
  starMath: z.string().optional(),
@@ -958,4 +263,4 @@ const ContentDocumentSchema = z.discriminatedUnion("kind", [
958
263
  ]);
959
264
  contentDocumentSchemaBox.value = ContentDocumentSchema;
960
265
  //#endregion
961
- 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 };