document-content-model 4.3.3 → 7.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +274 -95
  2. package/dist/border-weight.cjs +26 -0
  3. package/dist/border-weight.d.cts +12 -0
  4. package/dist/border-weight.d.ts +12 -0
  5. package/dist/border-weight.js +23 -0
  6. package/dist/codec.d.cts +1 -1
  7. package/dist/codec.d.ts +1 -1
  8. package/dist/{construct-CdQuI9f5.d.cts → construct-C9cYkjnd.d.cts} +242 -2
  9. package/dist/{construct-CdQuI9f5.d.ts → construct-C9cYkjnd.d.ts} +242 -2
  10. package/dist/construct.cjs +13 -6
  11. package/dist/construct.d.cts +1 -1
  12. package/dist/construct.d.ts +1 -1
  13. package/dist/construct.js +13 -6
  14. package/dist/content-JIKLIrji.d.cts +10273 -0
  15. package/dist/content-PPcQWl8e.d.ts +10273 -0
  16. package/dist/content-json-schema-defs.cjs +1056 -189
  17. package/dist/content-json-schema-defs.js +1056 -189
  18. package/dist/content.cjs +514 -36
  19. package/dist/content.d.cts +2 -2
  20. package/dist/content.d.ts +2 -2
  21. package/dist/content.js +488 -37
  22. package/dist/decompose.cjs +7 -17
  23. package/dist/decompose.d.cts +5 -5
  24. package/dist/decompose.d.ts +5 -5
  25. package/dist/decompose.js +7 -17
  26. package/dist/definitions.cjs +5 -1
  27. package/dist/definitions.d.cts +40 -4
  28. package/dist/definitions.d.ts +40 -4
  29. package/dist/definitions.js +5 -1
  30. package/dist/factor-styles.cjs +14 -8
  31. package/dist/factor-styles.d.cts +6 -6
  32. package/dist/factor-styles.d.ts +6 -6
  33. package/dist/factor-styles.js +15 -9
  34. package/dist/flatten.cjs +5 -5
  35. package/dist/flatten.d.cts +4 -4
  36. package/dist/flatten.d.ts +4 -4
  37. package/dist/flatten.js +5 -5
  38. package/dist/font-port.d.cts +2 -2
  39. package/dist/font-port.d.ts +2 -2
  40. package/dist/index.cjs +54 -14
  41. package/dist/index.d.cts +14 -12
  42. package/dist/index.d.ts +14 -12
  43. package/dist/index.js +12 -10
  44. package/dist/{math-BlG8Tjk-.d.cts → math-BScHxedi.d.cts} +97 -14
  45. package/dist/{math-BlG8Tjk-.d.ts → math-BScHxedi.d.ts} +97 -14
  46. package/dist/math-layout.d.cts +6 -6
  47. package/dist/math-layout.d.ts +6 -6
  48. package/dist/math.cjs +32 -6
  49. package/dist/math.d.cts +2 -2
  50. package/dist/math.d.ts +2 -2
  51. package/dist/math.js +29 -7
  52. package/dist/{mathml-B1oTCtzc.d.cts → mathml-Czqc1mdZ.d.cts} +3 -3
  53. package/dist/{mathml-B1oTCtzc.d.ts → mathml-Czqc1mdZ.d.ts} +3 -3
  54. package/dist/mathml.cjs +9 -2
  55. package/dist/mathml.d.cts +1 -1
  56. package/dist/mathml.d.ts +1 -1
  57. package/dist/mathml.js +9 -2
  58. package/dist/metadata.cjs +12 -1
  59. package/dist/metadata.d.cts +13 -0
  60. package/dist/metadata.d.ts +13 -0
  61. package/dist/metadata.js +12 -1
  62. package/dist/package-node-B4CHgiVQ.d.ts +1989 -0
  63. package/dist/package-node-duDMdOvH.d.cts +1989 -0
  64. package/dist/package-node.cjs +21 -21
  65. package/dist/package-node.d.cts +2 -2
  66. package/dist/package-node.d.ts +2 -2
  67. package/dist/package-node.js +14 -14
  68. package/dist/package.cjs +5 -3
  69. package/dist/package.d.cts +258 -13
  70. package/dist/package.d.ts +258 -13
  71. package/dist/package.js +5 -3
  72. package/dist/schema-io.cjs +21 -11
  73. package/dist/schema-io.d.cts +13 -9
  74. package/dist/schema-io.d.ts +13 -9
  75. package/dist/schema-io.js +21 -12
  76. package/dist/source-Bas5ol6f.d.cts +43 -0
  77. package/dist/source-Bas5ol6f.d.ts +43 -0
  78. package/dist/source.cjs +27 -0
  79. package/dist/source.d.cts +2 -0
  80. package/dist/source.d.ts +2 -0
  81. package/dist/source.js +25 -0
  82. package/dist/style-BGMcYrD2.d.cts +29 -0
  83. package/dist/style-BGMcYrD2.d.ts +29 -0
  84. package/dist/style.cjs +2 -0
  85. package/dist/style.d.cts +2 -24
  86. package/dist/style.d.ts +2 -24
  87. package/dist/style.js +2 -1
  88. package/dist/text-layout.d.cts +1 -1
  89. package/dist/text-layout.d.ts +1 -1
  90. package/package.json +28 -29
  91. package/schemas/content-document.schema.json +6623 -1694
  92. package/schemas/{document-package.schema.json → document-tree.schema.json} +1826 -143
  93. package/dist/content-B7b_P3FC.d.cts +0 -2481
  94. package/dist/content-Dn7uoJFG.d.ts +0 -2481
  95. package/dist/package-node-CC-FE2zS.d.cts +0 -459
  96. package/dist/package-node-DxdparRh.d.ts +0 -459
package/dist/content.cjs CHANGED
@@ -1,11 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_color = require("./color.cjs");
3
+ const require_source = require("./source.cjs");
3
4
  const require_construct = require("./construct.cjs");
4
5
  const require_math = require("./math.cjs");
5
- const require_geometry = require("./geometry.cjs");
6
6
  const require_mathml = require("./mathml.cjs");
7
- const require_metadata = require("./metadata.cjs");
7
+ const require_geometry = require("./geometry.cjs");
8
8
  const require_style = require("./style.cjs");
9
+ const require_metadata = require("./metadata.cjs");
9
10
  let zod = require("zod");
10
11
  //#region src/content.ts
11
12
  const ContentRunSchema = zod.z.object({
@@ -18,17 +19,55 @@ const ContentRunSchema = zod.z.object({
18
19
  sizePt: zod.z.number().positive().optional(),
19
20
  color: require_color.ColorSchema.optional(),
20
21
  hyperlink: zod.z.string().optional(),
22
+ verticalAlign: zod.z.enum(["superscript", "subscript"]).optional(),
23
+ direction: require_style.TextDirectionSchema.optional(),
21
24
  sourcePath: zod.z.string().optional(),
25
+ source: require_source.SourceResidueSchema.optional(),
22
26
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
23
27
  });
24
28
  const ContentListMembershipSchema = zod.z.object({
25
29
  numId: zod.z.string().optional(),
26
- level: zod.z.number().int().nonnegative()
30
+ level: zod.z.number().int().nonnegative(),
31
+ checked: zod.z.boolean().optional(),
32
+ itemId: zod.z.string().optional(),
33
+ format: zod.z.enum([
34
+ "bullet",
35
+ "decimal",
36
+ "lowerLetter",
37
+ "upperLetter",
38
+ "lowerRoman",
39
+ "upperRoman"
40
+ ]).optional()
41
+ });
42
+ const RunConstructExtentSchema = zod.z.object({
43
+ descriptor: require_construct.ConstructDescriptorSchema,
44
+ startRun: zod.z.number().int().nonnegative(),
45
+ endRun: zod.z.number().int().nonnegative()
46
+ });
47
+ const ContentStrokeStyleSchema = zod.z.enum([
48
+ "solid",
49
+ "dashed",
50
+ "dotted",
51
+ "double"
52
+ ]);
53
+ const ContentBorderSchema = zod.z.object({
54
+ color: require_color.ColorSchema,
55
+ widthPt: zod.z.number().positive(),
56
+ style: ContentStrokeStyleSchema.optional()
57
+ });
58
+ const ContentParagraphBordersSchema = zod.z.object({
59
+ left: ContentBorderSchema.optional(),
60
+ right: ContentBorderSchema.optional(),
61
+ top: ContentBorderSchema.optional(),
62
+ bottom: ContentBorderSchema.optional()
27
63
  });
28
64
  const ContentParagraphSchema = zod.z.object({
29
65
  kind: zod.z.literal("paragraph"),
30
66
  runs: zod.z.array(ContentRunSchema),
67
+ constructs: zod.z.array(RunConstructExtentSchema).optional(),
31
68
  styleId: zod.z.string().optional(),
69
+ codeLanguage: zod.z.string().optional(),
70
+ preformatted: zod.z.boolean().optional(),
32
71
  headingLevel: zod.z.number().int().positive().optional(),
33
72
  alignment: require_style.AlignmentSchema.optional(),
34
73
  list: ContentListMembershipSchema.optional(),
@@ -36,26 +75,75 @@ const ContentParagraphSchema = zod.z.object({
36
75
  spacingAfterPt: zod.z.number().optional(),
37
76
  lineSpacing: zod.z.number().positive().optional(),
38
77
  indentLeftPt: zod.z.number().optional(),
78
+ indentRightPt: zod.z.number().optional(),
39
79
  indentFirstLinePt: zod.z.number().optional(),
80
+ direction: require_style.TextDirectionSchema.optional(),
81
+ pageBreakBefore: zod.z.boolean().optional(),
82
+ pageBreakAfter: zod.z.boolean().optional(),
83
+ borders: ContentParagraphBordersSchema.optional(),
40
84
  sourcePath: zod.z.string().optional(),
85
+ source: require_source.SourceResidueSchema.optional(),
41
86
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
42
87
  });
43
88
  function clampHeadingLevel(level) {
44
89
  return Math.min(6, Math.max(1, Math.round(level)));
45
90
  }
91
+ const ContentFloatOriginSchema = zod.z.enum([
92
+ "page",
93
+ "margin",
94
+ "leftMargin",
95
+ "rightMargin",
96
+ "topMargin",
97
+ "bottomMargin",
98
+ "insideMargin",
99
+ "outsideMargin",
100
+ "column",
101
+ "character",
102
+ "paragraph",
103
+ "line",
104
+ "frame"
105
+ ]);
106
+ const ContentFloatAlignSchema = zod.z.enum([
107
+ "left",
108
+ "right",
109
+ "top",
110
+ "bottom",
111
+ "center",
112
+ "inside",
113
+ "outside"
114
+ ]);
115
+ const ContentFloatAxisSchema = zod.z.union([zod.z.strictObject({
116
+ relativeTo: ContentFloatOriginSchema,
117
+ offsetPt: zod.z.number()
118
+ }), zod.z.strictObject({
119
+ relativeTo: ContentFloatOriginSchema,
120
+ align: ContentFloatAlignSchema
121
+ })]);
122
+ const ContentFloatPositionSchema = zod.z.object({
123
+ horizontal: ContentFloatAxisSchema,
124
+ vertical: ContentFloatAxisSchema
125
+ });
46
126
  const ContentImageBlockSchema = zod.z.object({
47
127
  kind: zod.z.literal("image"),
48
- format: zod.z.enum(["png", "jpeg"]),
128
+ format: zod.z.enum([
129
+ "png",
130
+ "jpeg",
131
+ "svg",
132
+ "gif"
133
+ ]),
49
134
  base64: zod.z.string(),
50
135
  widthPt: zod.z.number().positive(),
51
136
  heightPt: zod.z.number().positive(),
52
137
  altText: zod.z.string().optional(),
138
+ floatPosition: ContentFloatPositionSchema.optional(),
53
139
  sourcePath: zod.z.string().optional(),
140
+ source: require_source.SourceResidueSchema.optional(),
54
141
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
55
142
  });
56
143
  const ContentPageBreakSchema = zod.z.object({
57
144
  kind: zod.z.literal("pageBreak"),
58
145
  sourcePath: zod.z.string().optional(),
146
+ source: require_source.SourceResidueSchema.optional(),
59
147
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
60
148
  });
61
149
  const ContentConstructStartSchema = zod.z.object({
@@ -76,24 +164,29 @@ function isContentTableRow(value) {
76
164
  return isRecord(value) && Array.isArray(value.cells) && value.cells.every(isContentTableCell) && (value.heightPt === void 0 || typeof value.heightPt === "number");
77
165
  }
78
166
  function isContentEmbeddedObjectKind(value) {
79
- return value === "formula" || value === "wordprocessing" || value === "presentation" || value === "spreadsheet" || value === "drawing";
167
+ return value === "formula" || value === "wordprocessing" || value === "presentation" || value === "spreadsheet" || value === "drawing" || value === "chart";
80
168
  }
81
169
  function isContentEmbeddedObject(value) {
82
170
  return isRecord(value) && isContentEmbeddedObjectKind(value.objectKind) && require_geometry.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");
83
171
  }
84
- function isContentEmbeddedObjectBlock(value) {
85
- return isRecord(value) && value.kind === "embeddedObject" && isContentEmbeddedObject(value);
86
- }
87
172
  function isContentConstructStart(value) {
88
173
  return isRecord(value) && value.kind === "constructStart" && require_construct.ConstructDescriptorSchema.safeParse(value.descriptor).success;
89
174
  }
90
175
  function isContentConstructEnd(value) {
91
176
  return isRecord(value) && value.kind === "constructEnd";
92
177
  }
178
+ function isRunConstructExtent(value) {
179
+ if (!isRecord(value)) return false;
180
+ if (!require_construct.ConstructDescriptorSchema.safeParse(value.descriptor).success) return false;
181
+ return isValidRunBound(value.startRun) && isValidRunBound(value.endRun);
182
+ }
183
+ function isValidRunBound(value) {
184
+ return typeof value === "number" && Number.isInteger(value) && value >= 0;
185
+ }
93
186
  function isContentBlock(value) {
94
187
  if (!isRecord(value)) return false;
95
188
  const kind = value.kind;
96
- if (kind === "paragraph") return Array.isArray(value.runs) && value.runs.every(isContentRun);
189
+ if (kind === "paragraph") return Array.isArray(value.runs) && value.runs.every(isContentRun) && (value.constructs === void 0 || Array.isArray(value.constructs) && value.constructs.every(isRunConstructExtent));
97
190
  if (kind === "image") return (value.format === "png" || value.format === "jpeg") && typeof value.base64 === "string" && typeof value.widthPt === "number" && typeof value.heightPt === "number";
98
191
  if (kind === "pageBreak") return true;
99
192
  if (kind === "table") return Array.isArray(value.rows) && value.rows.every(isContentTableRow) && Array.isArray(value.columnWidthsPt) && value.columnWidthsPt.every((w) => typeof w === "number");
@@ -102,9 +195,30 @@ function isContentBlock(value) {
102
195
  if (kind === "constructEnd") return true;
103
196
  return false;
104
197
  }
105
- const ContentBlockSchema = zod.z.custom(isContentBlock);
106
- const ContentEmbeddedObjectSchema = zod.z.custom(isContentEmbeddedObject);
107
- const ContentEmbeddedObjectBlockSchema = zod.z.custom(isContentEmbeddedObjectBlock);
198
+ const CONTENT_EMBEDDED_OBJECT_FIELDS = {
199
+ objectKind: zod.z.enum([
200
+ "formula",
201
+ "wordprocessing",
202
+ "presentation",
203
+ "spreadsheet",
204
+ "drawing",
205
+ "chart"
206
+ ]),
207
+ document: zod.z.lazy(() => ContentDocumentSchema),
208
+ frame: require_geometry.BoxSchema,
209
+ anchorRow: zod.z.number().int().nonnegative().optional(),
210
+ anchorColumn: zod.z.number().int().nonnegative().optional(),
211
+ offsetXPt: zod.z.number().optional(),
212
+ offsetYPt: zod.z.number().optional(),
213
+ source: require_source.SourceResidueSchema.optional()
214
+ };
215
+ const ContentEmbeddedObjectSchema = zod.z.object(CONTENT_EMBEDDED_OBJECT_FIELDS);
216
+ const ContentEmbeddedObjectBlockSchema = zod.z.object({
217
+ kind: zod.z.literal("embeddedObject"),
218
+ ...CONTENT_EMBEDDED_OBJECT_FIELDS,
219
+ sourcePath: zod.z.string().optional(),
220
+ frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
221
+ });
108
222
  function findConstructMarkerImbalance(blocks) {
109
223
  const openStartIndices = [];
110
224
  for (const [index, block] of blocks.entries()) if (isContentConstructStart(block)) openStartIndices.push(index);
@@ -118,47 +232,153 @@ function findConstructMarkerImbalance(blocks) {
118
232
  index: outermostUnclosed
119
233
  };
120
234
  }
121
- const ContentStrokeStyleSchema = zod.z.enum([
122
- "solid",
123
- "dashed",
124
- "dotted",
125
- "double"
126
- ]);
127
- const ContentBorderSchema = zod.z.object({
128
- color: require_color.ColorSchema,
129
- widthPt: zod.z.number().positive(),
130
- style: ContentStrokeStyleSchema.optional()
131
- });
235
+ function findRunConstructFault(paragraph) {
236
+ const constructs = paragraph.constructs;
237
+ if (constructs === void 0) return void 0;
238
+ for (const [index, extent] of constructs.entries()) {
239
+ if (extent.startRun > extent.endRun) return {
240
+ kind: "invertedRange",
241
+ index
242
+ };
243
+ if (extent.startRun < 0 || extent.endRun > paragraph.runs.length) return {
244
+ kind: "beyondRuns",
245
+ index
246
+ };
247
+ }
248
+ }
132
249
  const ContentCellBordersSchema = zod.z.object({
133
250
  left: ContentBorderSchema.optional(),
134
251
  right: ContentBorderSchema.optional(),
135
252
  top: ContentBorderSchema.optional(),
136
- bottom: ContentBorderSchema.optional()
253
+ bottom: ContentBorderSchema.optional(),
254
+ diagonalUp: ContentBorderSchema.optional(),
255
+ diagonalDown: ContentBorderSchema.optional()
137
256
  });
257
+ const ContentCellPatternTypeSchema = zod.z.enum([
258
+ "percent5",
259
+ "percent10",
260
+ "percent12",
261
+ "percent15",
262
+ "percent20",
263
+ "percent25",
264
+ "percent30",
265
+ "percent35",
266
+ "percent37",
267
+ "percent40",
268
+ "percent45",
269
+ "percent50",
270
+ "percent55",
271
+ "percent60",
272
+ "percent62",
273
+ "percent65",
274
+ "percent70",
275
+ "percent75",
276
+ "percent80",
277
+ "percent85",
278
+ "percent87",
279
+ "percent90",
280
+ "percent95",
281
+ "horizontalStripe",
282
+ "verticalStripe",
283
+ "diagonalStripe",
284
+ "reverseDiagonalStripe",
285
+ "horizontalCross",
286
+ "diagonalCross",
287
+ "thinHorizontalStripe",
288
+ "thinVerticalStripe",
289
+ "thinDiagonalStripe",
290
+ "thinReverseDiagonalStripe",
291
+ "thinHorizontalCross",
292
+ "thinDiagonalCross",
293
+ "mediumGray",
294
+ "darkGray",
295
+ "lightGray",
296
+ "darkHorizontal",
297
+ "darkVertical",
298
+ "darkDown",
299
+ "darkUp",
300
+ "darkGrid",
301
+ "darkTrellis",
302
+ "lightHorizontal",
303
+ "lightVertical",
304
+ "lightDown",
305
+ "lightUp",
306
+ "lightGrid",
307
+ "lightTrellis",
308
+ "gray125",
309
+ "gray0625"
310
+ ]);
311
+ const ContentCellFillSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
312
+ kind: zod.z.literal("solid"),
313
+ color: require_color.ColorSchema
314
+ }), zod.z.object({
315
+ kind: zod.z.literal("pattern"),
316
+ patternType: ContentCellPatternTypeSchema,
317
+ foregroundColor: require_color.ColorSchema.optional(),
318
+ backgroundColor: require_color.ColorSchema.optional()
319
+ })]);
320
+ function resolveCellFillColor(fill) {
321
+ return fill.kind === "solid" ? fill.color : fill.foregroundColor ?? fill.backgroundColor;
322
+ }
323
+ function unrecognizedFillKind(fill) {
324
+ return String(fill.kind);
325
+ }
138
326
  const ContentTableCellSchema = zod.z.object({
139
- blocks: zod.z.array(ContentBlockSchema),
327
+ blocks: zod.z.lazy(() => zod.z.array(ContentBlockSchema)),
140
328
  colSpan: zod.z.number().int().positive().optional(),
141
329
  rowSpan: zod.z.number().int().positive().optional(),
142
- background: require_color.ColorSchema.optional(),
330
+ background: ContentCellFillSchema.optional(),
143
331
  borders: ContentCellBordersSchema.optional(),
332
+ verticalAlign: zod.z.enum([
333
+ "top",
334
+ "center",
335
+ "bottom"
336
+ ]).optional(),
337
+ formula: zod.z.string().optional(),
144
338
  sourcePath: zod.z.string().optional(),
339
+ source: require_source.SourceResidueSchema.optional(),
145
340
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
146
341
  });
147
342
  const ContentTableRowSchema = zod.z.object({
148
343
  cells: zod.z.array(ContentTableCellSchema),
149
- heightPt: zod.z.number().positive().optional()
344
+ heightPt: zod.z.number().positive().optional(),
345
+ direction: require_style.TextDirectionSchema.optional()
150
346
  });
151
347
  const ContentTableSchema = zod.z.object({
152
348
  kind: zod.z.literal("table"),
153
349
  rows: zod.z.array(ContentTableRowSchema),
154
- columnWidthsPt: zod.z.array(zod.z.number().positive()),
350
+ columnWidthsPt: zod.z.array(zod.z.number().nonnegative()),
155
351
  sourcePath: zod.z.string().optional(),
352
+ source: require_source.SourceResidueSchema.optional(),
156
353
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
157
354
  });
355
+ const ContentBlockSchema = zod.z.discriminatedUnion("kind", [
356
+ ContentParagraphSchema,
357
+ ContentTableSchema,
358
+ ContentImageBlockSchema,
359
+ ContentPageBreakSchema,
360
+ ContentEmbeddedObjectBlockSchema,
361
+ ContentConstructStartSchema,
362
+ ContentConstructEndSchema
363
+ ]);
364
+ const ContentPageFurnitureSchema = zod.z.object({
365
+ default: zod.z.lazy(() => zod.z.array(ContentBlockSchema)).optional(),
366
+ even: zod.z.lazy(() => zod.z.array(ContentBlockSchema)).optional(),
367
+ first: zod.z.lazy(() => zod.z.array(ContentBlockSchema)).optional()
368
+ });
158
369
  const ContentSectionSchema = zod.z.object({
159
370
  pageSize: require_geometry.PageSizeSchema,
160
371
  margins: require_geometry.MarginsSchema,
161
- blocks: zod.z.array(ContentBlockSchema)
372
+ blocks: zod.z.lazy(() => zod.z.array(ContentBlockSchema)),
373
+ breakType: zod.z.enum([
374
+ "nextPage",
375
+ "continuous",
376
+ "evenPage",
377
+ "oddPage"
378
+ ]).optional(),
379
+ headers: ContentPageFurnitureSchema.optional(),
380
+ footers: ContentPageFurnitureSchema.optional(),
381
+ source: require_source.SourceResidueSchema.optional()
162
382
  });
163
383
  const ContentShapeSchema = zod.z.object({
164
384
  name: zod.z.string().optional(),
@@ -172,13 +392,15 @@ const ContentShapeSchema = zod.z.object({
172
392
  lineSpacingReduction: zod.z.number().nonnegative().optional(),
173
393
  paintOrder: zod.z.number().optional(),
174
394
  sourcePath: zod.z.string().optional(),
395
+ source: require_source.SourceResidueSchema.optional(),
175
396
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional(),
176
- blocks: zod.z.array(ContentBlockSchema)
397
+ blocks: zod.z.lazy(() => zod.z.array(ContentBlockSchema))
177
398
  });
178
399
  const ContentSlideSchema = zod.z.object({
179
400
  size: require_geometry.PageSizeSchema,
180
401
  shapes: zod.z.array(ContentShapeSchema),
181
- notes: zod.z.string()
402
+ notes: zod.z.string(),
403
+ source: require_source.SourceResidueSchema.optional()
182
404
  });
183
405
  const DecimalStringSchema = zod.z.string().regex(/^-?(0|[1-9]\d*)(\.\d+)?$/);
184
406
  const ContentCellValueSchema = zod.z.discriminatedUnion("kind", [
@@ -239,10 +461,11 @@ const ContentSheetCellSchema = zod.z.object({
239
461
  value: ContentCellValueSchema,
240
462
  formula: zod.z.string().optional(),
241
463
  displayText: zod.z.string(),
464
+ numberFormatCode: zod.z.string().optional(),
242
465
  runs: zod.z.array(ContentRunSchema).optional(),
243
466
  colSpan: zod.z.number().int().positive().optional(),
244
467
  rowSpan: zod.z.number().int().positive().optional(),
245
- background: require_color.ColorSchema.optional(),
468
+ background: ContentCellFillSchema.optional(),
246
469
  borders: ContentCellBordersSchema.optional(),
247
470
  alignment: require_style.AlignmentSchema.optional(),
248
471
  verticalAlignment: zod.z.enum([
@@ -252,6 +475,7 @@ const ContentSheetCellSchema = zod.z.object({
252
475
  ]).optional(),
253
476
  comment: ContentSheetCellCommentSchema.optional(),
254
477
  sourcePath: zod.z.string().optional(),
478
+ source: require_source.SourceResidueSchema.optional(),
255
479
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
256
480
  });
257
481
  const ContentSheetColumnSchema = zod.z.object({
@@ -293,6 +517,167 @@ const ContentSheetPrintSettingsSchema = zod.z.object({
293
517
  columns: zod.z.array(zod.z.number().int().nonnegative())
294
518
  }).optional()
295
519
  });
520
+ const ContentSheetRangeSchema = zod.z.object({
521
+ startRow: zod.z.number().int().nonnegative(),
522
+ startColumn: zod.z.number().int().nonnegative(),
523
+ endRow: zod.z.number().int().nonnegative(),
524
+ endColumn: zod.z.number().int().nonnegative()
525
+ });
526
+ const SheetRuleOperatorSchema = zod.z.enum([
527
+ "between",
528
+ "notBetween",
529
+ "equal",
530
+ "notEqual",
531
+ "greaterThan",
532
+ "greaterThanOrEqual",
533
+ "lessThan",
534
+ "lessThanOrEqual"
535
+ ]);
536
+ const ContentSheetDataValidationTypeSchema = zod.z.enum([
537
+ "whole",
538
+ "decimal",
539
+ "list",
540
+ "date",
541
+ "time",
542
+ "textLength",
543
+ "custom"
544
+ ]);
545
+ const ContentSheetDataValidationSchema = zod.z.object({
546
+ ranges: zod.z.array(ContentSheetRangeSchema),
547
+ type: ContentSheetDataValidationTypeSchema,
548
+ operator: SheetRuleOperatorSchema.optional(),
549
+ formula1: zod.z.string().optional(),
550
+ formula2: zod.z.string().optional(),
551
+ allowBlank: zod.z.boolean().optional(),
552
+ showInputMessage: zod.z.boolean().optional(),
553
+ promptTitle: zod.z.string().optional(),
554
+ prompt: zod.z.string().optional(),
555
+ showErrorMessage: zod.z.boolean().optional(),
556
+ errorStyle: zod.z.enum([
557
+ "stop",
558
+ "warning",
559
+ "information"
560
+ ]).optional(),
561
+ errorTitle: zod.z.string().optional(),
562
+ error: zod.z.string().optional(),
563
+ source: require_source.SourceResidueSchema.optional()
564
+ });
565
+ const ContentSheetConditionalFormatStyleSchema = zod.z.object({
566
+ textColor: require_color.ColorSchema.optional(),
567
+ background: require_color.ColorSchema.optional(),
568
+ source: require_source.SourceResidueSchema.optional()
569
+ });
570
+ const cfvoTypeSchema = zod.z.enum([
571
+ "num",
572
+ "percent",
573
+ "max",
574
+ "min",
575
+ "formula",
576
+ "percentile"
577
+ ]);
578
+ const ContentSheetConditionalFormatValueSchema = zod.z.object({
579
+ type: cfvoTypeSchema,
580
+ value: zod.z.string().optional()
581
+ });
582
+ const conditionalFormatCommonFields = {
583
+ ranges: zod.z.array(ContentSheetRangeSchema),
584
+ priority: zod.z.number().int().optional(),
585
+ stopIfTrue: zod.z.boolean().optional(),
586
+ source: require_source.SourceResidueSchema.optional()
587
+ };
588
+ const ContentSheetConditionalFormatSchema = zod.z.discriminatedUnion("type", [
589
+ zod.z.object({
590
+ type: zod.z.literal("cellIs"),
591
+ ...conditionalFormatCommonFields,
592
+ operator: SheetRuleOperatorSchema,
593
+ formula1: zod.z.string(),
594
+ formula2: zod.z.string().optional(),
595
+ style: ContentSheetConditionalFormatStyleSchema.optional()
596
+ }),
597
+ zod.z.object({
598
+ type: zod.z.enum([
599
+ "containsText",
600
+ "notContainsText",
601
+ "beginsWith",
602
+ "endsWith"
603
+ ]),
604
+ ...conditionalFormatCommonFields,
605
+ text: zod.z.string(),
606
+ style: ContentSheetConditionalFormatStyleSchema.optional()
607
+ }),
608
+ zod.z.object({
609
+ type: zod.z.enum([
610
+ "containsBlanks",
611
+ "notContainsBlanks",
612
+ "containsErrors",
613
+ "notContainsErrors",
614
+ "uniqueValues",
615
+ "duplicateValues"
616
+ ]),
617
+ ...conditionalFormatCommonFields,
618
+ style: ContentSheetConditionalFormatStyleSchema.optional()
619
+ }),
620
+ zod.z.object({
621
+ type: zod.z.literal("top10"),
622
+ ...conditionalFormatCommonFields,
623
+ rank: zod.z.number().positive(),
624
+ percent: zod.z.boolean().optional(),
625
+ bottom: zod.z.boolean().optional(),
626
+ style: ContentSheetConditionalFormatStyleSchema.optional()
627
+ }),
628
+ zod.z.object({
629
+ type: zod.z.literal("aboveAverage"),
630
+ ...conditionalFormatCommonFields,
631
+ aboveAverage: zod.z.boolean().optional(),
632
+ equalAverage: zod.z.boolean().optional(),
633
+ stdDev: zod.z.number().int().positive().optional(),
634
+ style: ContentSheetConditionalFormatStyleSchema.optional()
635
+ }),
636
+ zod.z.object({
637
+ type: zod.z.literal("timePeriod"),
638
+ ...conditionalFormatCommonFields,
639
+ timePeriod: zod.z.enum([
640
+ "yesterday",
641
+ "today",
642
+ "tomorrow",
643
+ "last7Days",
644
+ "thisMonth",
645
+ "lastMonth",
646
+ "nextMonth",
647
+ "thisWeek",
648
+ "lastWeek",
649
+ "nextWeek",
650
+ "thisYear",
651
+ "lastYear",
652
+ "nextYear"
653
+ ]),
654
+ style: ContentSheetConditionalFormatStyleSchema.optional()
655
+ }),
656
+ zod.z.object({
657
+ type: zod.z.literal("colorScale"),
658
+ ...conditionalFormatCommonFields,
659
+ stops: zod.z.array(zod.z.object({
660
+ value: ContentSheetConditionalFormatValueSchema,
661
+ color: require_color.ColorSchema
662
+ })).min(2).max(3)
663
+ }),
664
+ zod.z.object({
665
+ type: zod.z.literal("dataBar"),
666
+ ...conditionalFormatCommonFields,
667
+ min: ContentSheetConditionalFormatValueSchema,
668
+ max: ContentSheetConditionalFormatValueSchema,
669
+ color: require_color.ColorSchema,
670
+ showValue: zod.z.boolean().optional()
671
+ }),
672
+ zod.z.object({
673
+ type: zod.z.literal("iconSet"),
674
+ ...conditionalFormatCommonFields,
675
+ iconSetType: zod.z.string(),
676
+ thresholds: zod.z.array(ContentSheetConditionalFormatValueSchema),
677
+ reverse: zod.z.boolean().optional(),
678
+ showValue: zod.z.boolean().optional()
679
+ })
680
+ ]);
296
681
  const ContentSheetImageSchema = ContentImageBlockSchema.extend({
297
682
  anchorRow: zod.z.number().int().nonnegative(),
298
683
  anchorColumn: zod.z.number().int().nonnegative(),
@@ -306,13 +691,67 @@ const ContentSheetSchema = zod.z.object({
306
691
  rows: zod.z.array(ContentSheetRowSchema),
307
692
  images: zod.z.array(ContentSheetImageSchema),
308
693
  printSettings: ContentSheetPrintSettingsSchema,
309
- embeddedObjects: zod.z.array(ContentEmbeddedObjectSchema).optional()
694
+ embeddedObjects: zod.z.array(ContentEmbeddedObjectSchema).optional(),
695
+ dataValidations: zod.z.array(ContentSheetDataValidationSchema).optional(),
696
+ conditionalFormats: zod.z.array(ContentSheetConditionalFormatSchema).optional(),
697
+ source: require_source.SourceResidueSchema.optional()
698
+ });
699
+ const ContentStrokeDashSchema = zod.z.object({
700
+ dots1: zod.z.number().int().positive(),
701
+ dots1LengthPt: zod.z.number().positive(),
702
+ dots2: zod.z.number().int().positive().optional(),
703
+ dots2LengthPt: zod.z.number().positive().optional(),
704
+ distancePt: zod.z.number().nonnegative()
310
705
  });
311
706
  const ContentStrokeSchema = zod.z.object({
312
707
  color: require_color.ColorSchema,
313
708
  widthPt: zod.z.number().positive(),
314
- style: ContentStrokeStyleSchema.optional()
709
+ style: ContentStrokeStyleSchema.optional(),
710
+ opacity: zod.z.number().min(0).max(1).optional(),
711
+ dashPattern: ContentStrokeDashSchema.optional()
712
+ });
713
+ const ContentGradientStyleSchema = zod.z.enum([
714
+ "linear",
715
+ "axial",
716
+ "radial",
717
+ "ellipsoid",
718
+ "square",
719
+ "rectangular"
720
+ ]);
721
+ const ContentGradientFillSchema = zod.z.object({
722
+ kind: zod.z.literal("gradient"),
723
+ style: ContentGradientStyleSchema,
724
+ startColor: require_color.ColorSchema,
725
+ endColor: require_color.ColorSchema,
726
+ angleDeg: zod.z.number().optional()
727
+ });
728
+ const ContentHatchStyleSchema = zod.z.enum([
729
+ "single",
730
+ "double",
731
+ "triple"
732
+ ]);
733
+ const ContentHatchFillSchema = zod.z.object({
734
+ kind: zod.z.literal("hatch"),
735
+ style: ContentHatchStyleSchema,
736
+ color: require_color.ColorSchema,
737
+ distancePt: zod.z.number().nonnegative(),
738
+ rotationDeg: zod.z.number().optional()
739
+ });
740
+ const ContentBitmapFillSchema = zod.z.object({
741
+ kind: zod.z.literal("bitmap"),
742
+ format: zod.z.enum([
743
+ "png",
744
+ "jpeg",
745
+ "svg",
746
+ "gif"
747
+ ]),
748
+ base64: zod.z.string()
315
749
  });
750
+ const ContentFillPatternSchema = zod.z.discriminatedUnion("kind", [
751
+ ContentGradientFillSchema,
752
+ ContentHatchFillSchema,
753
+ ContentBitmapFillSchema
754
+ ]);
316
755
  const ContentPathPointSchema = zod.z.object({
317
756
  xPt: zod.z.number(),
318
757
  yPt: zod.z.number()
@@ -337,9 +776,12 @@ const ContentVectorSchema = zod.z.discriminatedUnion("kind", [
337
776
  frame: require_geometry.BoxSchema,
338
777
  rotationDeg: zod.z.number().optional(),
339
778
  fill: require_color.ColorSchema.optional(),
779
+ fillPattern: ContentFillPatternSchema.optional(),
780
+ fillOpacity: zod.z.number().min(0).max(1).optional(),
340
781
  stroke: ContentStrokeSchema.optional(),
341
782
  paintOrder: zod.z.number().optional(),
342
783
  sourcePath: zod.z.string().optional(),
784
+ source: require_source.SourceResidueSchema.optional(),
343
785
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
344
786
  }),
345
787
  zod.z.object({
@@ -347,9 +789,12 @@ const ContentVectorSchema = zod.z.discriminatedUnion("kind", [
347
789
  frame: require_geometry.BoxSchema,
348
790
  rotationDeg: zod.z.number().optional(),
349
791
  fill: require_color.ColorSchema.optional(),
792
+ fillPattern: ContentFillPatternSchema.optional(),
793
+ fillOpacity: zod.z.number().min(0).max(1).optional(),
350
794
  stroke: ContentStrokeSchema.optional(),
351
795
  paintOrder: zod.z.number().optional(),
352
796
  sourcePath: zod.z.string().optional(),
797
+ source: require_source.SourceResidueSchema.optional(),
353
798
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
354
799
  }),
355
800
  zod.z.object({
@@ -359,6 +804,7 @@ const ContentVectorSchema = zod.z.discriminatedUnion("kind", [
359
804
  stroke: ContentStrokeSchema,
360
805
  paintOrder: zod.z.number().optional(),
361
806
  sourcePath: zod.z.string().optional(),
807
+ source: require_source.SourceResidueSchema.optional(),
362
808
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
363
809
  }),
364
810
  zod.z.object({
@@ -367,24 +813,29 @@ const ContentVectorSchema = zod.z.discriminatedUnion("kind", [
367
813
  rotationDeg: zod.z.number().optional(),
368
814
  subpaths: zod.z.array(ContentSubpathSchema),
369
815
  fill: require_color.ColorSchema.optional(),
816
+ fillPattern: ContentFillPatternSchema.optional(),
817
+ fillOpacity: zod.z.number().min(0).max(1).optional(),
370
818
  fillRule: zod.z.enum(["nonzero", "evenodd"]).optional(),
371
819
  stroke: ContentStrokeSchema.optional(),
372
820
  paintOrder: zod.z.number().optional(),
373
821
  sourcePath: zod.z.string().optional(),
822
+ source: require_source.SourceResidueSchema.optional(),
374
823
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional()
375
824
  })
376
825
  ]);
377
826
  const ContentDrawPageSchema = zod.z.object({
378
827
  size: require_geometry.PageSizeSchema,
379
828
  shapes: zod.z.array(ContentShapeSchema),
380
- vectors: zod.z.array(ContentVectorSchema)
829
+ vectors: zod.z.array(ContentVectorSchema),
830
+ source: require_source.SourceResidueSchema.optional()
381
831
  });
382
832
  const ContentFormulaSchema = zod.z.object({
383
833
  mathml: zod.z.array(require_mathml.MathMlNodeSchema),
384
834
  starMath: zod.z.string().optional(),
385
835
  presentation: require_math.MathPresentationSchema.optional(),
386
836
  content: require_math.MathExpressionSchema.optional(),
387
- provenance: require_math.MathProvenanceSchema.optional()
837
+ provenance: require_math.MathProvenanceSchema.optional(),
838
+ source: require_source.SourceResidueSchema.optional()
388
839
  });
389
840
  const contentDocumentSharedFields = { symbolTable: require_math.SymbolTableSchema.optional() };
390
841
  const ContentDocumentSchema = zod.z.discriminatedUnion("kind", [
@@ -420,9 +871,12 @@ const ContentDocumentSchema = zod.z.discriminatedUnion("kind", [
420
871
  })
421
872
  ]);
422
873
  //#endregion
874
+ exports.ContentBitmapFillSchema = ContentBitmapFillSchema;
423
875
  exports.ContentBlockSchema = ContentBlockSchema;
424
876
  exports.ContentBorderSchema = ContentBorderSchema;
425
877
  exports.ContentCellBordersSchema = ContentCellBordersSchema;
878
+ exports.ContentCellFillSchema = ContentCellFillSchema;
879
+ exports.ContentCellPatternTypeSchema = ContentCellPatternTypeSchema;
426
880
  exports.ContentCellValueSchema = ContentCellValueSchema;
427
881
  exports.ContentConstructEndSchema = ContentConstructEndSchema;
428
882
  exports.ContentConstructStartSchema = ContentConstructStartSchema;
@@ -430,10 +884,21 @@ exports.ContentDocumentSchema = ContentDocumentSchema;
430
884
  exports.ContentDrawPageSchema = ContentDrawPageSchema;
431
885
  exports.ContentEmbeddedObjectBlockSchema = ContentEmbeddedObjectBlockSchema;
432
886
  exports.ContentEmbeddedObjectSchema = ContentEmbeddedObjectSchema;
887
+ exports.ContentFillPatternSchema = ContentFillPatternSchema;
888
+ exports.ContentFloatAlignSchema = ContentFloatAlignSchema;
889
+ exports.ContentFloatAxisSchema = ContentFloatAxisSchema;
890
+ exports.ContentFloatOriginSchema = ContentFloatOriginSchema;
891
+ exports.ContentFloatPositionSchema = ContentFloatPositionSchema;
433
892
  exports.ContentFormulaSchema = ContentFormulaSchema;
893
+ exports.ContentGradientFillSchema = ContentGradientFillSchema;
894
+ exports.ContentGradientStyleSchema = ContentGradientStyleSchema;
895
+ exports.ContentHatchFillSchema = ContentHatchFillSchema;
896
+ exports.ContentHatchStyleSchema = ContentHatchStyleSchema;
434
897
  exports.ContentImageBlockSchema = ContentImageBlockSchema;
435
898
  exports.ContentListMembershipSchema = ContentListMembershipSchema;
436
899
  exports.ContentPageBreakSchema = ContentPageBreakSchema;
900
+ exports.ContentPageFurnitureSchema = ContentPageFurnitureSchema;
901
+ exports.ContentParagraphBordersSchema = ContentParagraphBordersSchema;
437
902
  exports.ContentParagraphSchema = ContentParagraphSchema;
438
903
  exports.ContentPathPointSchema = ContentPathPointSchema;
439
904
  exports.ContentPathSegmentSchema = ContentPathSegmentSchema;
@@ -443,13 +908,20 @@ exports.ContentShapeSchema = ContentShapeSchema;
443
908
  exports.ContentSheetCellCommentSchema = ContentSheetCellCommentSchema;
444
909
  exports.ContentSheetCellSchema = ContentSheetCellSchema;
445
910
  exports.ContentSheetColumnSchema = ContentSheetColumnSchema;
911
+ exports.ContentSheetConditionalFormatSchema = ContentSheetConditionalFormatSchema;
912
+ exports.ContentSheetConditionalFormatStyleSchema = ContentSheetConditionalFormatStyleSchema;
913
+ exports.ContentSheetConditionalFormatValueSchema = ContentSheetConditionalFormatValueSchema;
914
+ exports.ContentSheetDataValidationSchema = ContentSheetDataValidationSchema;
915
+ exports.ContentSheetDataValidationTypeSchema = ContentSheetDataValidationTypeSchema;
446
916
  exports.ContentSheetImageSchema = ContentSheetImageSchema;
447
917
  exports.ContentSheetPrintRangeSchema = ContentSheetPrintRangeSchema;
448
918
  exports.ContentSheetPrintSettingsSchema = ContentSheetPrintSettingsSchema;
919
+ exports.ContentSheetRangeSchema = ContentSheetRangeSchema;
449
920
  exports.ContentSheetRepeatRangeSchema = ContentSheetRepeatRangeSchema;
450
921
  exports.ContentSheetRowSchema = ContentSheetRowSchema;
451
922
  exports.ContentSheetSchema = ContentSheetSchema;
452
923
  exports.ContentSlideSchema = ContentSlideSchema;
924
+ exports.ContentStrokeDashSchema = ContentStrokeDashSchema;
453
925
  exports.ContentStrokeSchema = ContentStrokeSchema;
454
926
  exports.ContentStrokeStyleSchema = ContentStrokeStyleSchema;
455
927
  exports.ContentSubpathSchema = ContentSubpathSchema;
@@ -458,9 +930,15 @@ exports.ContentTableRowSchema = ContentTableRowSchema;
458
930
  exports.ContentTableSchema = ContentTableSchema;
459
931
  exports.ContentVectorSchema = ContentVectorSchema;
460
932
  exports.DecimalStringSchema = DecimalStringSchema;
933
+ exports.RunConstructExtentSchema = RunConstructExtentSchema;
934
+ exports.SheetRuleOperatorSchema = SheetRuleOperatorSchema;
461
935
  exports.clampHeadingLevel = clampHeadingLevel;
462
936
  exports.contentDocumentSharedFields = contentDocumentSharedFields;
463
937
  exports.findConstructMarkerImbalance = findConstructMarkerImbalance;
938
+ exports.findRunConstructFault = findRunConstructFault;
464
939
  exports.isContentBlock = isContentBlock;
465
940
  exports.isContentConstructEnd = isContentConstructEnd;
466
941
  exports.isContentConstructStart = isContentConstructStart;
942
+ exports.isRunConstructExtent = isRunConstructExtent;
943
+ exports.resolveCellFillColor = resolveCellFillColor;
944
+ exports.unrecognizedFillKind = unrecognizedFillKind;