document-schema 7.15.1 → 7.15.3

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 (55) hide show
  1. package/dist/codec.d.cts +3 -3
  2. package/dist/codec.d.ts +3 -3
  3. package/dist/color.cjs +10 -4
  4. package/dist/color.js +10 -4
  5. package/dist/{content-BMrK9SrW.d.ts → content-1yGdeaVT.d.ts} +5905 -2549
  6. package/dist/{content-Dg9cb8mF.d.cts → content-CSf8z9NW.d.cts} +5905 -2549
  7. package/dist/content-json-schema-defs.cjs +5 -5
  8. package/dist/content-json-schema-defs.js +5 -5
  9. package/dist/content.cjs +12 -5
  10. package/dist/content.d.cts +1 -1
  11. package/dist/content.d.ts +1 -1
  12. package/dist/content.js +12 -5
  13. package/dist/decompose.cjs +5 -0
  14. package/dist/decompose.d.cts +4 -3
  15. package/dist/decompose.d.ts +4 -3
  16. package/dist/decompose.js +5 -1
  17. package/dist/definitions.d.cts +1 -1
  18. package/dist/definitions.d.ts +1 -1
  19. package/dist/factor-styles.cjs +2 -0
  20. package/dist/factor-styles.d.cts +1 -1
  21. package/dist/factor-styles.d.ts +1 -1
  22. package/dist/factor-styles.js +4 -2
  23. package/dist/flatten.cjs +5 -0
  24. package/dist/flatten.d.cts +3 -2
  25. package/dist/flatten.d.ts +3 -2
  26. package/dist/flatten.js +5 -1
  27. package/dist/index.cjs +2 -4
  28. package/dist/index.d.cts +5 -5
  29. package/dist/index.d.ts +5 -5
  30. package/dist/index.js +3 -7
  31. package/dist/math-layout.d.cts +2 -2
  32. package/dist/math-layout.d.ts +2 -2
  33. package/dist/math.cjs +7 -5
  34. package/dist/math.js +7 -5
  35. package/dist/mathml.cjs +3 -1
  36. package/dist/mathml.js +3 -1
  37. package/dist/{package-node-gA3Kpgl2.d.ts → package-node-CpE1BAqK.d.ts} +1 -1
  38. package/dist/{package-node-wxNXHAov.d.cts → package-node-ng7Yimj9.d.cts} +1 -1
  39. package/dist/package-node.d.cts +1 -1
  40. package/dist/package-node.d.ts +1 -1
  41. package/dist/package.d.cts +1 -1
  42. package/dist/package.d.ts +1 -1
  43. package/dist/schema-io.cjs +7 -2
  44. package/dist/schema-io.d.cts +3 -2
  45. package/dist/schema-io.d.ts +3 -2
  46. package/dist/schema-io.js +7 -3
  47. package/dist/table-grid.cjs +5 -0
  48. package/dist/table-grid.d.cts +3 -2
  49. package/dist/table-grid.d.ts +3 -2
  50. package/dist/table-grid.js +5 -1
  51. package/dist/text-layout.d.cts +6 -6
  52. package/dist/text-layout.d.ts +6 -6
  53. package/package.json +1 -1
  54. package/schemas/content-document.schema.json +16 -16
  55. package/schemas/document-tree.schema.json +3 -3
@@ -32,9 +32,9 @@ function mathMlDef(id) {
32
32
  delete stripped.$id;
33
33
  return stripped;
34
34
  }
35
- function cacheMathMlDef(id) {
35
+ function cacheMathMlDef(target, id) {
36
36
  const value = mathMlDef(id);
37
- Object.defineProperty(CONTENT_DEFS, id, {
37
+ Object.defineProperty(target, id, {
38
38
  value,
39
39
  enumerable: true,
40
40
  configurable: true,
@@ -2770,13 +2770,13 @@ const CONTENT_DEFS = {
2770
2770
  additionalProperties: {}
2771
2771
  },
2772
2772
  get MathMlAttribute() {
2773
- return cacheMathMlDef("MathMlAttribute");
2773
+ return cacheMathMlDef(this, "MathMlAttribute");
2774
2774
  },
2775
2775
  get MathMlElement() {
2776
- return cacheMathMlDef("MathMlElement");
2776
+ return cacheMathMlDef(this, "MathMlElement");
2777
2777
  },
2778
2778
  get MathMlNode() {
2779
- return cacheMathMlDef("MathMlNode");
2779
+ return cacheMathMlDef(this, "MathMlNode");
2780
2780
  },
2781
2781
  ContentFormula: {
2782
2782
  type: "object",
@@ -31,9 +31,9 @@ function mathMlDef(id) {
31
31
  delete stripped.$id;
32
32
  return stripped;
33
33
  }
34
- function cacheMathMlDef(id) {
34
+ function cacheMathMlDef(target, id) {
35
35
  const value = mathMlDef(id);
36
- Object.defineProperty(CONTENT_DEFS, id, {
36
+ Object.defineProperty(target, id, {
37
37
  value,
38
38
  enumerable: true,
39
39
  configurable: true,
@@ -2769,13 +2769,13 @@ const CONTENT_DEFS = {
2769
2769
  additionalProperties: {}
2770
2770
  },
2771
2771
  get MathMlAttribute() {
2772
- return cacheMathMlDef("MathMlAttribute");
2772
+ return cacheMathMlDef(this, "MathMlAttribute");
2773
2773
  },
2774
2774
  get MathMlElement() {
2775
- return cacheMathMlDef("MathMlElement");
2775
+ return cacheMathMlDef(this, "MathMlElement");
2776
2776
  },
2777
2777
  get MathMlNode() {
2778
- return cacheMathMlDef("MathMlNode");
2778
+ return cacheMathMlDef(this, "MathMlNode");
2779
2779
  },
2780
2780
  ContentFormula: {
2781
2781
  type: "object",
package/dist/content.cjs CHANGED
@@ -120,8 +120,9 @@ const ContentParagraphSchema = zod.z.object({
120
120
  frames: zod.z.array(require_geometry.LayoutFrameSchema).optional(),
121
121
  ...CONTENT_ANNOTATION_FIELDS
122
122
  });
123
+ const MAX_HEADING_LEVEL = 6;
123
124
  function clampHeadingLevel(level) {
124
- return Math.min(6, Math.max(1, Math.round(level)));
125
+ return Math.min(MAX_HEADING_LEVEL, Math.max(1, Math.round(level)));
125
126
  }
126
127
  const ContentFloatOriginSchema = zod.z.enum([
127
128
  "page",
@@ -219,8 +220,9 @@ function isContentTableColumn(value) {
219
220
  function isContentEmbeddedObjectKind(value) {
220
221
  return value === "formula" || value === "wordprocessing" || value === "presentation" || value === "spreadsheet" || value === "drawing" || value === "chart";
221
222
  }
223
+ const contentDocumentSchemaBox = {};
222
224
  function isContentEmbeddedObject(value) {
223
- 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");
225
+ return isRecord(value) && isContentEmbeddedObjectKind(value.objectKind) && require_geometry.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
226
  }
225
227
  function isContentConstructStart(value) {
226
228
  return isRecord(value) && value.kind === "constructStart" && require_construct.ConstructDescriptorSchema.safeParse(value.descriptor).success;
@@ -257,7 +259,7 @@ const CONTENT_EMBEDDED_OBJECT_FIELDS = {
257
259
  "drawing",
258
260
  "chart"
259
261
  ]),
260
- document: zod.z.lazy(() => ContentDocumentSchema),
262
+ document: zod.z.lazy(() => contentDocumentSchemaBox.value),
261
263
  frame: require_geometry.BoxSchema,
262
264
  anchorRow: zod.z.number().int().nonnegative().optional(),
263
265
  anchorColumn: zod.z.number().int().nonnegative().optional(),
@@ -377,8 +379,9 @@ function resolveCellFillColor(fill) {
377
379
  function unrecognizedFillKind(fill) {
378
380
  return String(fill.kind);
379
381
  }
382
+ const contentBlockSchemaBox = {};
380
383
  const ContentTableCellSchema = zod.z.object({
381
- blocks: zod.z.lazy(() => zod.z.array(ContentBlockSchema)),
384
+ blocks: zod.z.lazy(() => zod.z.array(contentBlockSchemaBox.value)),
382
385
  colSpan: zod.z.number().int().positive().optional(),
383
386
  rowSpan: zod.z.number().int().positive().optional(),
384
387
  background: ContentCellFillSchema.optional(),
@@ -422,6 +425,7 @@ const ContentBlockSchema = zod.z.discriminatedUnion("kind", [
422
425
  ContentConstructStartSchema,
423
426
  ContentConstructEndSchema
424
427
  ]);
428
+ contentBlockSchemaBox.value = ContentBlockSchema;
425
429
  const ContentPageFurnitureSchema = zod.z.object({
426
430
  default: zod.z.lazy(() => zod.z.array(ContentBlockSchema)).optional(),
427
431
  even: zod.z.lazy(() => zod.z.array(ContentBlockSchema)).optional(),
@@ -647,6 +651,8 @@ const ContentSheetConditionalFormatValueSchema = zod.z.object({
647
651
  type: cfvoTypeSchema,
648
652
  value: zod.z.string().optional()
649
653
  });
654
+ const MIN_COLOR_SCALE_STOPS = 2;
655
+ const MAX_COLOR_SCALE_STOPS = 3;
650
656
  const conditionalFormatCommonFields = {
651
657
  ranges: zod.z.array(ContentSheetRangeSchema),
652
658
  priority: zod.z.number().int().optional(),
@@ -727,7 +733,7 @@ const ContentSheetConditionalFormatSchema = zod.z.discriminatedUnion("type", [
727
733
  stops: zod.z.array(zod.z.object({
728
734
  value: ContentSheetConditionalFormatValueSchema,
729
735
  color: require_color.ColorSchema
730
- })).min(2).max(3)
736
+ })).min(MIN_COLOR_SCALE_STOPS).max(MAX_COLOR_SCALE_STOPS)
731
737
  }),
732
738
  zod.z.object({
733
739
  type: zod.z.literal("dataBar"),
@@ -951,6 +957,7 @@ const ContentDocumentSchema = zod.z.discriminatedUnion("kind", [
951
957
  formula: ContentFormulaSchema
952
958
  })
953
959
  ]);
960
+ contentDocumentSchemaBox.value = ContentDocumentSchema;
954
961
  //#endregion
955
962
  exports.CONTENT_ANNOTATION_FIELDS = CONTENT_ANNOTATION_FIELDS;
956
963
  exports.ContentBitmapFillSchema = ContentBitmapFillSchema;
@@ -1,2 +1,2 @@
1
- import { $ as ContentHatchStyleSchema, $t as ContentSheetRepeatRange, A as ContentEmbeddedObjectKind, An as ImageFormat, At as ContentSheetCellComment, B as ContentFloatPosition, Bn as findRunConstructFault, Bt as ContentSheetConditionalFormatValueSchema, C as ContentDocument, Cn as ContentTranscriptSchema, Ct as ContentRunSchema, D as ContentEmbeddedObject, Dn as DecimalStringSchema, Dt as ContentShapeSchema, E as ContentDrawPageSchema, En as DecimalString, Et as ContentShape, F as ContentFloatAlignSchema, Fn as SheetRuleOperator, Ft as ContentSheetConditionalFormat, G as ContentFormulaSchema, Gn as resolveCellFillColor, Gt as ContentSheetImage, H as ContentFont, Hn as isContentConstructEnd, Ht as ContentSheetDataValidationSchema, I as ContentFloatAxis, In as SheetRuleOperatorSchema, It as ContentSheetConditionalFormatSchema, J as ContentGradientStyle, Jt as ContentSheetPrintRangeSchema, K as ContentGradientFill, Kn as unrecognizedFillKind, Kt as ContentSheetImageSchema, L as ContentFloatAxisSchema, Ln as clampHeadingLevel, Lt as ContentSheetConditionalFormatStyle, M as ContentFillPattern, Mn as RunConstructExtent, Mt as ContentSheetCellSchema, N as ContentFillPatternSchema, Nn as RunConstructExtentSchema, Nt as ContentSheetColumn, O as ContentEmbeddedObjectBlock, On as FusedNode, Ot as ContentSheet, P as ContentFloatAlign, Pn as RunConstructFault, Pt as ContentSheetColumnSchema, Q as ContentHatchStyle, Qt as ContentSheetRangeSchema, R as ContentFloatOrigin, Rn as contentDocumentSharedFields, Rt as ContentSheetConditionalFormatStyleSchema, S as ContentDefinedNameSchema, Sn as ContentTranscript, St as ContentRun, T as ContentDrawPage, Tn as ContentVectorSchema, Tt as ContentSectionSchema, U as ContentFontSchema, Un as isContentConstructStart, Ut as ContentSheetDataValidationType, V as ContentFloatPositionSchema, Vn as isContentBlock, Vt as ContentSheetDataValidation, W as ContentFormula, Wn as isRunConstructExtent, Wt as ContentSheetDataValidationTypeSchema, X as ContentHatchFill, Xt as ContentSheetPrintSettingsSchema, Y as ContentGradientStyleSchema, Yt as ContentSheetPrintSettings, Z as ContentHatchFillSchema, Zt as ContentSheetRange, _ as ContentConstructEnd, _n as ContentTableColumn, _t as ContentParagraphSchema, a as ContentBlock, an as ContentSlideSchema, at as ContentInterpretationSchema, b as ContentConstructStartSchema, bn as ContentTableRowSchema, bt as ContentPathSegment, c as ContentBorderSchema, cn as ContentStrokeDashSchema, ct as ContentOrigin, d as ContentCellFill, dn as ContentStrokeStyleSchema, dt as ContentPageBreakSchema, en as ContentSheetRepeatRangeSchema, et as ContentImageBlock, f as ContentCellFillSchema, fn as ContentSubpath, ft as ContentPageFurniture, g as ContentCellValueSchema, gn as ContentTableCellSchema, gt as ContentParagraphBordersSchema, h as ContentCellValue, hn as ContentTableCell, ht as ContentParagraphBorders, i as ContentBitmapFillSchema, in as ContentSlide, it as ContentInterpretation, j as ContentEmbeddedObjectSchema, jn as RUN_FONT_PROPERTY_SHAPE, jt as ContentSheetCellCommentSchema, k as ContentEmbeddedObjectBlockSchema, kn as IMAGE_FORMATS, kt as ContentSheetCell, l as ContentCellBorders, ln as ContentStrokeSchema, lt as ContentOriginSchema, m as ContentCellPatternTypeSchema, mn as ContentTable, mt as ContentParagraph, n as ConstructMarkerImbalance, nn as ContentSheetRowSchema, nt as ContentImageOriginal, o as ContentBlockSchema, on as ContentStroke, ot as ContentListMembership, p as ContentCellPatternType, pn as ContentSubpathSchema, pt as ContentPageFurnitureSchema, q as ContentGradientFillSchema, qt as ContentSheetPrintRange, r as ContentBitmapFill, rn as ContentSheetSchema, rt as ContentImageOriginalSchema, s as ContentBorder, sn as ContentStrokeDash, st as ContentListMembershipSchema, t as CONTENT_ANNOTATION_FIELDS, tn as ContentSheetRow, tt as ContentImageBlockSchema, u as ContentCellBordersSchema, un as ContentStrokeStyle, ut as ContentPageBreak, v as ContentConstructEndSchema, vn as ContentTableColumnSchema, vt as ContentPathPoint, w as ContentDocumentSchema, wn as ContentVector, wt as ContentSection, x as ContentDefinedName, xn as ContentTableSchema, xt as ContentPathSegmentSchema, y as ContentConstructStart, yn as ContentTableRow, yt as ContentPathPointSchema, z as ContentFloatOriginSchema, zn as findConstructMarkerImbalance, zt as ContentSheetConditionalFormatValue } from "./content-Dg9cb8mF.cjs";
1
+ import { $ as ContentHatchStyleSchema, $t as ContentSheetRepeatRange, A as ContentEmbeddedObjectKind, An as ImageFormat, At as ContentSheetCellComment, B as ContentFloatPosition, Bn as findRunConstructFault, Bt as ContentSheetConditionalFormatValueSchema, C as ContentDocument, Cn as ContentTranscriptSchema, Ct as ContentRunSchema, D as ContentEmbeddedObject, Dn as DecimalStringSchema, Dt as ContentShapeSchema, E as ContentDrawPageSchema, En as DecimalString, Et as ContentShape, F as ContentFloatAlignSchema, Fn as SheetRuleOperator, Ft as ContentSheetConditionalFormat, G as ContentFormulaSchema, Gn as resolveCellFillColor, Gt as ContentSheetImage, H as ContentFont, Hn as isContentConstructEnd, Ht as ContentSheetDataValidationSchema, I as ContentFloatAxis, In as SheetRuleOperatorSchema, It as ContentSheetConditionalFormatSchema, J as ContentGradientStyle, Jt as ContentSheetPrintRangeSchema, K as ContentGradientFill, Kn as unrecognizedFillKind, Kt as ContentSheetImageSchema, L as ContentFloatAxisSchema, Ln as clampHeadingLevel, Lt as ContentSheetConditionalFormatStyle, M as ContentFillPattern, Mn as RunConstructExtent, Mt as ContentSheetCellSchema, N as ContentFillPatternSchema, Nn as RunConstructExtentSchema, Nt as ContentSheetColumn, O as ContentEmbeddedObjectBlock, On as FusedNode, Ot as ContentSheet, P as ContentFloatAlign, Pn as RunConstructFault, Pt as ContentSheetColumnSchema, Q as ContentHatchStyle, Qt as ContentSheetRangeSchema, R as ContentFloatOrigin, Rn as contentDocumentSharedFields, Rt as ContentSheetConditionalFormatStyleSchema, S as ContentDefinedNameSchema, Sn as ContentTranscript, St as ContentRun, T as ContentDrawPage, Tn as ContentVectorSchema, Tt as ContentSectionSchema, U as ContentFontSchema, Un as isContentConstructStart, Ut as ContentSheetDataValidationType, V as ContentFloatPositionSchema, Vn as isContentBlock, Vt as ContentSheetDataValidation, W as ContentFormula, Wn as isRunConstructExtent, Wt as ContentSheetDataValidationTypeSchema, X as ContentHatchFill, Xt as ContentSheetPrintSettingsSchema, Y as ContentGradientStyleSchema, Yt as ContentSheetPrintSettings, Z as ContentHatchFillSchema, Zt as ContentSheetRange, _ as ContentConstructEnd, _n as ContentTableColumn, _t as ContentParagraphSchema, a as ContentBlock, an as ContentSlideSchema, at as ContentInterpretationSchema, b as ContentConstructStartSchema, bn as ContentTableRowSchema, bt as ContentPathSegment, c as ContentBorderSchema, cn as ContentStrokeDashSchema, ct as ContentOrigin, d as ContentCellFill, dn as ContentStrokeStyleSchema, dt as ContentPageBreakSchema, en as ContentSheetRepeatRangeSchema, et as ContentImageBlock, f as ContentCellFillSchema, fn as ContentSubpath, ft as ContentPageFurniture, g as ContentCellValueSchema, gn as ContentTableCellSchema, gt as ContentParagraphBordersSchema, h as ContentCellValue, hn as ContentTableCell, ht as ContentParagraphBorders, i as ContentBitmapFillSchema, in as ContentSlide, it as ContentInterpretation, j as ContentEmbeddedObjectSchema, jn as RUN_FONT_PROPERTY_SHAPE, jt as ContentSheetCellCommentSchema, k as ContentEmbeddedObjectBlockSchema, kn as IMAGE_FORMATS, kt as ContentSheetCell, l as ContentCellBorders, ln as ContentStrokeSchema, lt as ContentOriginSchema, m as ContentCellPatternTypeSchema, mn as ContentTable, mt as ContentParagraph, n as ConstructMarkerImbalance, nn as ContentSheetRowSchema, nt as ContentImageOriginal, o as ContentBlockSchema, on as ContentStroke, ot as ContentListMembership, p as ContentCellPatternType, pn as ContentSubpathSchema, pt as ContentPageFurnitureSchema, q as ContentGradientFillSchema, qt as ContentSheetPrintRange, r as ContentBitmapFill, rn as ContentSheetSchema, rt as ContentImageOriginalSchema, s as ContentBorder, sn as ContentStrokeDash, st as ContentListMembershipSchema, t as CONTENT_ANNOTATION_FIELDS, tn as ContentSheetRow, tt as ContentImageBlockSchema, u as ContentCellBordersSchema, un as ContentStrokeStyle, ut as ContentPageBreak, v as ContentConstructEndSchema, vn as ContentTableColumnSchema, vt as ContentPathPoint, w as ContentDocumentSchema, wn as ContentVector, wt as ContentSection, x as ContentDefinedName, xn as ContentTableSchema, xt as ContentPathSegmentSchema, y as ContentConstructStart, yn as ContentTableRow, yt as ContentPathPointSchema, z as ContentFloatOriginSchema, zn as findConstructMarkerImbalance, zt as ContentSheetConditionalFormatValue } from "./content-CSf8z9NW.cjs";
2
2
  export { CONTENT_ANNOTATION_FIELDS, ConstructMarkerImbalance, ContentBitmapFill, ContentBitmapFillSchema, ContentBlock, ContentBlockSchema, ContentBorder, ContentBorderSchema, ContentCellBorders, ContentCellBordersSchema, ContentCellFill, ContentCellFillSchema, ContentCellPatternType, ContentCellPatternTypeSchema, ContentCellValue, ContentCellValueSchema, ContentConstructEnd, ContentConstructEndSchema, ContentConstructStart, ContentConstructStartSchema, ContentDefinedName, ContentDefinedNameSchema, ContentDocument, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentEmbeddedObject, ContentEmbeddedObjectBlock, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectKind, ContentEmbeddedObjectSchema, ContentFillPattern, ContentFillPatternSchema, ContentFloatAlign, ContentFloatAlignSchema, ContentFloatAxis, ContentFloatAxisSchema, ContentFloatOrigin, ContentFloatOriginSchema, ContentFloatPosition, ContentFloatPositionSchema, ContentFont, ContentFontSchema, ContentFormula, ContentFormulaSchema, ContentGradientFill, ContentGradientFillSchema, ContentGradientStyle, ContentGradientStyleSchema, ContentHatchFill, ContentHatchFillSchema, ContentHatchStyle, ContentHatchStyleSchema, ContentImageBlock, ContentImageBlockSchema, ContentImageOriginal, ContentImageOriginalSchema, ContentInterpretation, ContentInterpretationSchema, ContentListMembership, ContentListMembershipSchema, ContentOrigin, ContentOriginSchema, ContentPageBreak, ContentPageBreakSchema, ContentPageFurniture, ContentPageFurnitureSchema, ContentParagraph, ContentParagraphBorders, ContentParagraphBordersSchema, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellComment, ContentSheetCellCommentSchema, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetConditionalFormat, ContentSheetConditionalFormatSchema, ContentSheetConditionalFormatStyle, ContentSheetConditionalFormatStyleSchema, ContentSheetConditionalFormatValue, ContentSheetConditionalFormatValueSchema, ContentSheetDataValidation, ContentSheetDataValidationSchema, ContentSheetDataValidationType, ContentSheetDataValidationTypeSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRange, ContentSheetRangeSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeDash, ContentStrokeDashSchema, ContentStrokeSchema, ContentStrokeStyle, ContentStrokeStyleSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableColumn, ContentTableColumnSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentTranscript, ContentTranscriptSchema, ContentVector, ContentVectorSchema, DecimalString, DecimalStringSchema, FusedNode, IMAGE_FORMATS, ImageFormat, RUN_FONT_PROPERTY_SHAPE, RunConstructExtent, RunConstructExtentSchema, RunConstructFault, SheetRuleOperator, SheetRuleOperatorSchema, clampHeadingLevel, contentDocumentSharedFields, findConstructMarkerImbalance, findRunConstructFault, isContentBlock, isContentConstructEnd, isContentConstructStart, isRunConstructExtent, resolveCellFillColor, unrecognizedFillKind };
package/dist/content.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as ContentHatchStyleSchema, $t as ContentSheetRepeatRange, A as ContentEmbeddedObjectKind, An as ImageFormat, At as ContentSheetCellComment, B as ContentFloatPosition, Bn as findRunConstructFault, Bt as ContentSheetConditionalFormatValueSchema, C as ContentDocument, Cn as ContentTranscriptSchema, Ct as ContentRunSchema, D as ContentEmbeddedObject, Dn as DecimalStringSchema, Dt as ContentShapeSchema, E as ContentDrawPageSchema, En as DecimalString, Et as ContentShape, F as ContentFloatAlignSchema, Fn as SheetRuleOperator, Ft as ContentSheetConditionalFormat, G as ContentFormulaSchema, Gn as resolveCellFillColor, Gt as ContentSheetImage, H as ContentFont, Hn as isContentConstructEnd, Ht as ContentSheetDataValidationSchema, I as ContentFloatAxis, In as SheetRuleOperatorSchema, It as ContentSheetConditionalFormatSchema, J as ContentGradientStyle, Jt as ContentSheetPrintRangeSchema, K as ContentGradientFill, Kn as unrecognizedFillKind, Kt as ContentSheetImageSchema, L as ContentFloatAxisSchema, Ln as clampHeadingLevel, Lt as ContentSheetConditionalFormatStyle, M as ContentFillPattern, Mn as RunConstructExtent, Mt as ContentSheetCellSchema, N as ContentFillPatternSchema, Nn as RunConstructExtentSchema, Nt as ContentSheetColumn, O as ContentEmbeddedObjectBlock, On as FusedNode, Ot as ContentSheet, P as ContentFloatAlign, Pn as RunConstructFault, Pt as ContentSheetColumnSchema, Q as ContentHatchStyle, Qt as ContentSheetRangeSchema, R as ContentFloatOrigin, Rn as contentDocumentSharedFields, Rt as ContentSheetConditionalFormatStyleSchema, S as ContentDefinedNameSchema, Sn as ContentTranscript, St as ContentRun, T as ContentDrawPage, Tn as ContentVectorSchema, Tt as ContentSectionSchema, U as ContentFontSchema, Un as isContentConstructStart, Ut as ContentSheetDataValidationType, V as ContentFloatPositionSchema, Vn as isContentBlock, Vt as ContentSheetDataValidation, W as ContentFormula, Wn as isRunConstructExtent, Wt as ContentSheetDataValidationTypeSchema, X as ContentHatchFill, Xt as ContentSheetPrintSettingsSchema, Y as ContentGradientStyleSchema, Yt as ContentSheetPrintSettings, Z as ContentHatchFillSchema, Zt as ContentSheetRange, _ as ContentConstructEnd, _n as ContentTableColumn, _t as ContentParagraphSchema, a as ContentBlock, an as ContentSlideSchema, at as ContentInterpretationSchema, b as ContentConstructStartSchema, bn as ContentTableRowSchema, bt as ContentPathSegment, c as ContentBorderSchema, cn as ContentStrokeDashSchema, ct as ContentOrigin, d as ContentCellFill, dn as ContentStrokeStyleSchema, dt as ContentPageBreakSchema, en as ContentSheetRepeatRangeSchema, et as ContentImageBlock, f as ContentCellFillSchema, fn as ContentSubpath, ft as ContentPageFurniture, g as ContentCellValueSchema, gn as ContentTableCellSchema, gt as ContentParagraphBordersSchema, h as ContentCellValue, hn as ContentTableCell, ht as ContentParagraphBorders, i as ContentBitmapFillSchema, in as ContentSlide, it as ContentInterpretation, j as ContentEmbeddedObjectSchema, jn as RUN_FONT_PROPERTY_SHAPE, jt as ContentSheetCellCommentSchema, k as ContentEmbeddedObjectBlockSchema, kn as IMAGE_FORMATS, kt as ContentSheetCell, l as ContentCellBorders, ln as ContentStrokeSchema, lt as ContentOriginSchema, m as ContentCellPatternTypeSchema, mn as ContentTable, mt as ContentParagraph, n as ConstructMarkerImbalance, nn as ContentSheetRowSchema, nt as ContentImageOriginal, o as ContentBlockSchema, on as ContentStroke, ot as ContentListMembership, p as ContentCellPatternType, pn as ContentSubpathSchema, pt as ContentPageFurnitureSchema, q as ContentGradientFillSchema, qt as ContentSheetPrintRange, r as ContentBitmapFill, rn as ContentSheetSchema, rt as ContentImageOriginalSchema, s as ContentBorder, sn as ContentStrokeDash, st as ContentListMembershipSchema, t as CONTENT_ANNOTATION_FIELDS, tn as ContentSheetRow, tt as ContentImageBlockSchema, u as ContentCellBordersSchema, un as ContentStrokeStyle, ut as ContentPageBreak, v as ContentConstructEndSchema, vn as ContentTableColumnSchema, vt as ContentPathPoint, w as ContentDocumentSchema, wn as ContentVector, wt as ContentSection, x as ContentDefinedName, xn as ContentTableSchema, xt as ContentPathSegmentSchema, y as ContentConstructStart, yn as ContentTableRow, yt as ContentPathPointSchema, z as ContentFloatOriginSchema, zn as findConstructMarkerImbalance, zt as ContentSheetConditionalFormatValue } from "./content-BMrK9SrW.js";
1
+ import { $ as ContentHatchStyleSchema, $t as ContentSheetRepeatRange, A as ContentEmbeddedObjectKind, An as ImageFormat, At as ContentSheetCellComment, B as ContentFloatPosition, Bn as findRunConstructFault, Bt as ContentSheetConditionalFormatValueSchema, C as ContentDocument, Cn as ContentTranscriptSchema, Ct as ContentRunSchema, D as ContentEmbeddedObject, Dn as DecimalStringSchema, Dt as ContentShapeSchema, E as ContentDrawPageSchema, En as DecimalString, Et as ContentShape, F as ContentFloatAlignSchema, Fn as SheetRuleOperator, Ft as ContentSheetConditionalFormat, G as ContentFormulaSchema, Gn as resolveCellFillColor, Gt as ContentSheetImage, H as ContentFont, Hn as isContentConstructEnd, Ht as ContentSheetDataValidationSchema, I as ContentFloatAxis, In as SheetRuleOperatorSchema, It as ContentSheetConditionalFormatSchema, J as ContentGradientStyle, Jt as ContentSheetPrintRangeSchema, K as ContentGradientFill, Kn as unrecognizedFillKind, Kt as ContentSheetImageSchema, L as ContentFloatAxisSchema, Ln as clampHeadingLevel, Lt as ContentSheetConditionalFormatStyle, M as ContentFillPattern, Mn as RunConstructExtent, Mt as ContentSheetCellSchema, N as ContentFillPatternSchema, Nn as RunConstructExtentSchema, Nt as ContentSheetColumn, O as ContentEmbeddedObjectBlock, On as FusedNode, Ot as ContentSheet, P as ContentFloatAlign, Pn as RunConstructFault, Pt as ContentSheetColumnSchema, Q as ContentHatchStyle, Qt as ContentSheetRangeSchema, R as ContentFloatOrigin, Rn as contentDocumentSharedFields, Rt as ContentSheetConditionalFormatStyleSchema, S as ContentDefinedNameSchema, Sn as ContentTranscript, St as ContentRun, T as ContentDrawPage, Tn as ContentVectorSchema, Tt as ContentSectionSchema, U as ContentFontSchema, Un as isContentConstructStart, Ut as ContentSheetDataValidationType, V as ContentFloatPositionSchema, Vn as isContentBlock, Vt as ContentSheetDataValidation, W as ContentFormula, Wn as isRunConstructExtent, Wt as ContentSheetDataValidationTypeSchema, X as ContentHatchFill, Xt as ContentSheetPrintSettingsSchema, Y as ContentGradientStyleSchema, Yt as ContentSheetPrintSettings, Z as ContentHatchFillSchema, Zt as ContentSheetRange, _ as ContentConstructEnd, _n as ContentTableColumn, _t as ContentParagraphSchema, a as ContentBlock, an as ContentSlideSchema, at as ContentInterpretationSchema, b as ContentConstructStartSchema, bn as ContentTableRowSchema, bt as ContentPathSegment, c as ContentBorderSchema, cn as ContentStrokeDashSchema, ct as ContentOrigin, d as ContentCellFill, dn as ContentStrokeStyleSchema, dt as ContentPageBreakSchema, en as ContentSheetRepeatRangeSchema, et as ContentImageBlock, f as ContentCellFillSchema, fn as ContentSubpath, ft as ContentPageFurniture, g as ContentCellValueSchema, gn as ContentTableCellSchema, gt as ContentParagraphBordersSchema, h as ContentCellValue, hn as ContentTableCell, ht as ContentParagraphBorders, i as ContentBitmapFillSchema, in as ContentSlide, it as ContentInterpretation, j as ContentEmbeddedObjectSchema, jn as RUN_FONT_PROPERTY_SHAPE, jt as ContentSheetCellCommentSchema, k as ContentEmbeddedObjectBlockSchema, kn as IMAGE_FORMATS, kt as ContentSheetCell, l as ContentCellBorders, ln as ContentStrokeSchema, lt as ContentOriginSchema, m as ContentCellPatternTypeSchema, mn as ContentTable, mt as ContentParagraph, n as ConstructMarkerImbalance, nn as ContentSheetRowSchema, nt as ContentImageOriginal, o as ContentBlockSchema, on as ContentStroke, ot as ContentListMembership, p as ContentCellPatternType, pn as ContentSubpathSchema, pt as ContentPageFurnitureSchema, q as ContentGradientFillSchema, qt as ContentSheetPrintRange, r as ContentBitmapFill, rn as ContentSheetSchema, rt as ContentImageOriginalSchema, s as ContentBorder, sn as ContentStrokeDash, st as ContentListMembershipSchema, t as CONTENT_ANNOTATION_FIELDS, tn as ContentSheetRow, tt as ContentImageBlockSchema, u as ContentCellBordersSchema, un as ContentStrokeStyle, ut as ContentPageBreak, v as ContentConstructEndSchema, vn as ContentTableColumnSchema, vt as ContentPathPoint, w as ContentDocumentSchema, wn as ContentVector, wt as ContentSection, x as ContentDefinedName, xn as ContentTableSchema, xt as ContentPathSegmentSchema, y as ContentConstructStart, yn as ContentTableRow, yt as ContentPathPointSchema, z as ContentFloatOriginSchema, zn as findConstructMarkerImbalance, zt as ContentSheetConditionalFormatValue } from "./content-1yGdeaVT.js";
2
2
  export { CONTENT_ANNOTATION_FIELDS, ConstructMarkerImbalance, ContentBitmapFill, ContentBitmapFillSchema, ContentBlock, ContentBlockSchema, ContentBorder, ContentBorderSchema, ContentCellBorders, ContentCellBordersSchema, ContentCellFill, ContentCellFillSchema, ContentCellPatternType, ContentCellPatternTypeSchema, ContentCellValue, ContentCellValueSchema, ContentConstructEnd, ContentConstructEndSchema, ContentConstructStart, ContentConstructStartSchema, ContentDefinedName, ContentDefinedNameSchema, ContentDocument, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentEmbeddedObject, ContentEmbeddedObjectBlock, ContentEmbeddedObjectBlockSchema, ContentEmbeddedObjectKind, ContentEmbeddedObjectSchema, ContentFillPattern, ContentFillPatternSchema, ContentFloatAlign, ContentFloatAlignSchema, ContentFloatAxis, ContentFloatAxisSchema, ContentFloatOrigin, ContentFloatOriginSchema, ContentFloatPosition, ContentFloatPositionSchema, ContentFont, ContentFontSchema, ContentFormula, ContentFormulaSchema, ContentGradientFill, ContentGradientFillSchema, ContentGradientStyle, ContentGradientStyleSchema, ContentHatchFill, ContentHatchFillSchema, ContentHatchStyle, ContentHatchStyleSchema, ContentImageBlock, ContentImageBlockSchema, ContentImageOriginal, ContentImageOriginalSchema, ContentInterpretation, ContentInterpretationSchema, ContentListMembership, ContentListMembershipSchema, ContentOrigin, ContentOriginSchema, ContentPageBreak, ContentPageBreakSchema, ContentPageFurniture, ContentPageFurnitureSchema, ContentParagraph, ContentParagraphBorders, ContentParagraphBordersSchema, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellComment, ContentSheetCellCommentSchema, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetConditionalFormat, ContentSheetConditionalFormatSchema, ContentSheetConditionalFormatStyle, ContentSheetConditionalFormatStyleSchema, ContentSheetConditionalFormatValue, ContentSheetConditionalFormatValueSchema, ContentSheetDataValidation, ContentSheetDataValidationSchema, ContentSheetDataValidationType, ContentSheetDataValidationTypeSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRange, ContentSheetRangeSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeDash, ContentStrokeDashSchema, ContentStrokeSchema, ContentStrokeStyle, ContentStrokeStyleSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableColumn, ContentTableColumnSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentTranscript, ContentTranscriptSchema, ContentVector, ContentVectorSchema, DecimalString, DecimalStringSchema, FusedNode, IMAGE_FORMATS, ImageFormat, RUN_FONT_PROPERTY_SHAPE, RunConstructExtent, RunConstructExtentSchema, RunConstructFault, SheetRuleOperator, SheetRuleOperatorSchema, clampHeadingLevel, contentDocumentSharedFields, findConstructMarkerImbalance, findRunConstructFault, isContentBlock, isContentConstructEnd, isContentConstructStart, isRunConstructExtent, resolveCellFillColor, unrecognizedFillKind };
package/dist/content.js CHANGED
@@ -119,8 +119,9 @@ const ContentParagraphSchema = z.object({
119
119
  frames: z.array(LayoutFrameSchema).optional(),
120
120
  ...CONTENT_ANNOTATION_FIELDS
121
121
  });
122
+ const MAX_HEADING_LEVEL = 6;
122
123
  function clampHeadingLevel(level) {
123
- return Math.min(6, Math.max(1, Math.round(level)));
124
+ return Math.min(MAX_HEADING_LEVEL, Math.max(1, Math.round(level)));
124
125
  }
125
126
  const ContentFloatOriginSchema = z.enum([
126
127
  "page",
@@ -218,8 +219,9 @@ function isContentTableColumn(value) {
218
219
  function isContentEmbeddedObjectKind(value) {
219
220
  return value === "formula" || value === "wordprocessing" || value === "presentation" || value === "spreadsheet" || value === "drawing" || value === "chart";
220
221
  }
222
+ const contentDocumentSchemaBox = {};
221
223
  function isContentEmbeddedObject(value) {
222
- 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");
224
+ 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");
223
225
  }
224
226
  function isContentConstructStart(value) {
225
227
  return isRecord(value) && value.kind === "constructStart" && ConstructDescriptorSchema.safeParse(value.descriptor).success;
@@ -256,7 +258,7 @@ const CONTENT_EMBEDDED_OBJECT_FIELDS = {
256
258
  "drawing",
257
259
  "chart"
258
260
  ]),
259
- document: z.lazy(() => ContentDocumentSchema),
261
+ document: z.lazy(() => contentDocumentSchemaBox.value),
260
262
  frame: BoxSchema,
261
263
  anchorRow: z.number().int().nonnegative().optional(),
262
264
  anchorColumn: z.number().int().nonnegative().optional(),
@@ -376,8 +378,9 @@ function resolveCellFillColor(fill) {
376
378
  function unrecognizedFillKind(fill) {
377
379
  return String(fill.kind);
378
380
  }
381
+ const contentBlockSchemaBox = {};
379
382
  const ContentTableCellSchema = z.object({
380
- blocks: z.lazy(() => z.array(ContentBlockSchema)),
383
+ blocks: z.lazy(() => z.array(contentBlockSchemaBox.value)),
381
384
  colSpan: z.number().int().positive().optional(),
382
385
  rowSpan: z.number().int().positive().optional(),
383
386
  background: ContentCellFillSchema.optional(),
@@ -421,6 +424,7 @@ const ContentBlockSchema = z.discriminatedUnion("kind", [
421
424
  ContentConstructStartSchema,
422
425
  ContentConstructEndSchema
423
426
  ]);
427
+ contentBlockSchemaBox.value = ContentBlockSchema;
424
428
  const ContentPageFurnitureSchema = z.object({
425
429
  default: z.lazy(() => z.array(ContentBlockSchema)).optional(),
426
430
  even: z.lazy(() => z.array(ContentBlockSchema)).optional(),
@@ -646,6 +650,8 @@ const ContentSheetConditionalFormatValueSchema = z.object({
646
650
  type: cfvoTypeSchema,
647
651
  value: z.string().optional()
648
652
  });
653
+ const MIN_COLOR_SCALE_STOPS = 2;
654
+ const MAX_COLOR_SCALE_STOPS = 3;
649
655
  const conditionalFormatCommonFields = {
650
656
  ranges: z.array(ContentSheetRangeSchema),
651
657
  priority: z.number().int().optional(),
@@ -726,7 +732,7 @@ const ContentSheetConditionalFormatSchema = z.discriminatedUnion("type", [
726
732
  stops: z.array(z.object({
727
733
  value: ContentSheetConditionalFormatValueSchema,
728
734
  color: ColorSchema
729
- })).min(2).max(3)
735
+ })).min(MIN_COLOR_SCALE_STOPS).max(MAX_COLOR_SCALE_STOPS)
730
736
  }),
731
737
  z.object({
732
738
  type: z.literal("dataBar"),
@@ -950,5 +956,6 @@ const ContentDocumentSchema = z.discriminatedUnion("kind", [
950
956
  formula: ContentFormulaSchema
951
957
  })
952
958
  ]);
959
+ contentDocumentSchemaBox.value = ContentDocumentSchema;
953
960
  //#endregion
954
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 };
@@ -15,6 +15,9 @@ var ConstructMarkerImbalanceError = class extends Error {
15
15
  this.imbalance = imbalance;
16
16
  }
17
17
  };
18
+ function assertNeverContentDocumentKind(value) {
19
+ throw new Error(`decompose: unhandled ContentDocument kind ${JSON.stringify(value)}`);
20
+ }
18
21
  function decompose(content) {
19
22
  switch (content.kind) {
20
23
  case "wordprocessing": return content.sections.map(decomposeSection);
@@ -23,6 +26,7 @@ function decompose(content) {
23
26
  case "drawing": return content.pages.map(decomposeDrawPage);
24
27
  case "formula": return [content.formula];
25
28
  }
29
+ return assertNeverContentDocumentKind(content);
26
30
  }
27
31
  function decomposeSection(section) {
28
32
  const { blocks, ...rest } = section;
@@ -172,6 +176,7 @@ function openListGroup(sink, paragraph) {
172
176
  }
173
177
  //#endregion
174
178
  exports.ConstructMarkerImbalanceError = ConstructMarkerImbalanceError;
179
+ exports.assertNeverContentDocumentKind = assertNeverContentDocumentKind;
175
180
  exports.decompose = decompose;
176
181
  exports.decomposeDrawPage = decomposeDrawPage;
177
182
  exports.decomposeSection = decomposeSection;
@@ -1,5 +1,5 @@
1
- import { C as ContentDocument, Et as ContentShape, Ot as ContentSheet, T as ContentDrawPage, W as ContentFormula, in as ContentSlide, mt as ContentParagraph, n as ConstructMarkerImbalance, wt as ContentSection } from "./content-Dg9cb8mF.cjs";
2
- import { D as ShapeGroupNode, I as SlideGroupNode, M as SheetGroupNode, b as SectionGroupNode, c as HeadingParagraph, i as DrawPageGroupNode, p as ListParagraph } from "./package-node-wxNXHAov.cjs";
1
+ import { C as ContentDocument, Et as ContentShape, Ot as ContentSheet, T as ContentDrawPage, W as ContentFormula, in as ContentSlide, mt as ContentParagraph, n as ConstructMarkerImbalance, wt as ContentSection } from "./content-CSf8z9NW.cjs";
2
+ import { D as ShapeGroupNode, I as SlideGroupNode, M as SheetGroupNode, b as SectionGroupNode, c as HeadingParagraph, i as DrawPageGroupNode, p as ListParagraph } from "./package-node-ng7Yimj9.cjs";
3
3
  //#region src/decompose.d.ts
4
4
  declare function isHeadingParagraph(paragraph: ContentParagraph): paragraph is HeadingParagraph;
5
5
  declare function isListParagraph(paragraph: ContentParagraph): paragraph is ListParagraph;
@@ -7,6 +7,7 @@ declare class ConstructMarkerImbalanceError extends Error {
7
7
  readonly imbalance: ConstructMarkerImbalance;
8
8
  constructor(imbalance: ConstructMarkerImbalance);
9
9
  }
10
+ declare function assertNeverContentDocumentKind(value: never): never;
10
11
  type TreeChildren = SectionGroupNode[] | SlideGroupNode[] | SheetGroupNode[] | DrawPageGroupNode[] | ContentFormula[];
11
12
  declare function decompose(content: ContentDocument): TreeChildren;
12
13
  declare function decomposeSection(section: ContentSection): SectionGroupNode;
@@ -15,4 +16,4 @@ declare function decomposeSheet(sheet: ContentSheet): SheetGroupNode;
15
16
  declare function decomposeDrawPage(page: ContentDrawPage): DrawPageGroupNode;
16
17
  declare function decomposeShape(shape: ContentShape): ShapeGroupNode;
17
18
  //#endregion
18
- export { ConstructMarkerImbalanceError, TreeChildren, decompose, decomposeDrawPage, decomposeSection, decomposeShape, decomposeSheet, decomposeSlide, isHeadingParagraph, isListParagraph };
19
+ export { ConstructMarkerImbalanceError, TreeChildren, assertNeverContentDocumentKind, decompose, decomposeDrawPage, decomposeSection, decomposeShape, decomposeSheet, decomposeSlide, isHeadingParagraph, isListParagraph };
@@ -1,5 +1,5 @@
1
- import { C as ContentDocument, Et as ContentShape, Ot as ContentSheet, T as ContentDrawPage, W as ContentFormula, in as ContentSlide, mt as ContentParagraph, n as ConstructMarkerImbalance, wt as ContentSection } from "./content-BMrK9SrW.js";
2
- import { D as ShapeGroupNode, I as SlideGroupNode, M as SheetGroupNode, b as SectionGroupNode, c as HeadingParagraph, i as DrawPageGroupNode, p as ListParagraph } from "./package-node-gA3Kpgl2.js";
1
+ import { C as ContentDocument, Et as ContentShape, Ot as ContentSheet, T as ContentDrawPage, W as ContentFormula, in as ContentSlide, mt as ContentParagraph, n as ConstructMarkerImbalance, wt as ContentSection } from "./content-1yGdeaVT.js";
2
+ import { D as ShapeGroupNode, I as SlideGroupNode, M as SheetGroupNode, b as SectionGroupNode, c as HeadingParagraph, i as DrawPageGroupNode, p as ListParagraph } from "./package-node-CpE1BAqK.js";
3
3
  //#region src/decompose.d.ts
4
4
  declare function isHeadingParagraph(paragraph: ContentParagraph): paragraph is HeadingParagraph;
5
5
  declare function isListParagraph(paragraph: ContentParagraph): paragraph is ListParagraph;
@@ -7,6 +7,7 @@ declare class ConstructMarkerImbalanceError extends Error {
7
7
  readonly imbalance: ConstructMarkerImbalance;
8
8
  constructor(imbalance: ConstructMarkerImbalance);
9
9
  }
10
+ declare function assertNeverContentDocumentKind(value: never): never;
10
11
  type TreeChildren = SectionGroupNode[] | SlideGroupNode[] | SheetGroupNode[] | DrawPageGroupNode[] | ContentFormula[];
11
12
  declare function decompose(content: ContentDocument): TreeChildren;
12
13
  declare function decomposeSection(section: ContentSection): SectionGroupNode;
@@ -15,4 +16,4 @@ declare function decomposeSheet(sheet: ContentSheet): SheetGroupNode;
15
16
  declare function decomposeDrawPage(page: ContentDrawPage): DrawPageGroupNode;
16
17
  declare function decomposeShape(shape: ContentShape): ShapeGroupNode;
17
18
  //#endregion
18
- export { ConstructMarkerImbalanceError, TreeChildren, decompose, decomposeDrawPage, decomposeSection, decomposeShape, decomposeSheet, decomposeSlide, isHeadingParagraph, isListParagraph };
19
+ export { ConstructMarkerImbalanceError, TreeChildren, assertNeverContentDocumentKind, decompose, decomposeDrawPage, decomposeSection, decomposeShape, decomposeSheet, decomposeSlide, isHeadingParagraph, isListParagraph };
package/dist/decompose.js CHANGED
@@ -14,6 +14,9 @@ var ConstructMarkerImbalanceError = class extends Error {
14
14
  this.imbalance = imbalance;
15
15
  }
16
16
  };
17
+ function assertNeverContentDocumentKind(value) {
18
+ throw new Error(`decompose: unhandled ContentDocument kind ${JSON.stringify(value)}`);
19
+ }
17
20
  function decompose(content) {
18
21
  switch (content.kind) {
19
22
  case "wordprocessing": return content.sections.map(decomposeSection);
@@ -22,6 +25,7 @@ function decompose(content) {
22
25
  case "drawing": return content.pages.map(decomposeDrawPage);
23
26
  case "formula": return [content.formula];
24
27
  }
28
+ return assertNeverContentDocumentKind(content);
25
29
  }
26
30
  function decomposeSection(section) {
27
31
  const { blocks, ...rest } = section;
@@ -170,4 +174,4 @@ function openListGroup(sink, paragraph) {
170
174
  sink.listStack.push(group);
171
175
  }
172
176
  //#endregion
173
- export { ConstructMarkerImbalanceError, decompose, decomposeDrawPage, decomposeSection, decomposeShape, decomposeSheet, decomposeSlide, isHeadingParagraph, isListParagraph };
177
+ export { ConstructMarkerImbalanceError, assertNeverContentDocumentKind, decompose, decomposeDrawPage, decomposeSection, decomposeShape, decomposeSheet, decomposeSlide, isHeadingParagraph, isListParagraph };
@@ -1,4 +1,4 @@
1
- import { St as ContentRun, mt as ContentParagraph } from "./content-Dg9cb8mF.cjs";
1
+ import { St as ContentRun, mt as ContentParagraph } from "./content-CSf8z9NW.cjs";
2
2
  import { z } from "zod";
3
3
  //#region src/definitions.d.ts
4
4
  declare const StyleParagraphPropertiesSchema: z.ZodObject<{
@@ -1,4 +1,4 @@
1
- import { St as ContentRun, mt as ContentParagraph } from "./content-BMrK9SrW.js";
1
+ import { St as ContentRun, mt as ContentParagraph } from "./content-1yGdeaVT.js";
2
2
  import { z } from "zod";
3
3
  //#region src/definitions.d.ts
4
4
  declare const StyleParagraphPropertiesSchema: z.ZodObject<{
@@ -59,6 +59,7 @@ function assembleTree(content, pages) {
59
59
  children: [content.formula]
60
60
  });
61
61
  }
62
+ return require_decompose.assertNeverContentDocumentKind(content);
62
63
  }
63
64
  function factorStyles(pkg) {
64
65
  const reassembled = assembleTree(require_flatten.flattenTree(pkg), pkg.pages);
@@ -245,6 +246,7 @@ function mint(pkg) {
245
246
  styles
246
247
  };
247
248
  }
249
+ return require_flatten.assertNeverDocumentTreeKind(pkg);
248
250
  }
249
251
  function innerChain(group, chain, state) {
250
252
  const own = state.wrapperStrips.get(group);
@@ -1,5 +1,5 @@
1
1
  import { l as PageSize } from "./geometry-CvcjSwnA.cjs";
2
- import { C as ContentDocument } from "./content-Dg9cb8mF.cjs";
2
+ import { C as ContentDocument } from "./content-CSf8z9NW.cjs";
3
3
  import { DocumentTree } from "./package.cjs";
4
4
  //#region src/factor-styles.d.ts
5
5
  declare function assembleTree(content: ContentDocument, pages?: readonly PageSize[]): DocumentTree;
@@ -1,5 +1,5 @@
1
1
  import { l as PageSize } from "./geometry-CvcjSwnA.js";
2
- import { C as ContentDocument } from "./content-BMrK9SrW.js";
2
+ import { C as ContentDocument } from "./content-1yGdeaVT.js";
3
3
  import { DocumentTree } from "./package.js";
4
4
  //#region src/factor-styles.d.ts
5
5
  declare function assembleTree(content: ContentDocument, pages?: readonly PageSize[]): DocumentTree;
@@ -1,6 +1,6 @@
1
1
  import { canonicalKey } from "./canonicalise.js";
2
- import { decomposeDrawPage, decomposeSection, decomposeSheet, decomposeSlide } from "./decompose.js";
3
- import { flattenTree } from "./flatten.js";
2
+ import { assertNeverContentDocumentKind, decomposeDrawPage, decomposeSection, decomposeSheet, decomposeSlide } from "./decompose.js";
3
+ import { assertNeverDocumentTreeKind, flattenTree } from "./flatten.js";
4
4
  //#region src/factor-styles.ts
5
5
  const PARAGRAPH_STYLE_KEYS = [
6
6
  "alignment",
@@ -58,6 +58,7 @@ function assembleTree(content, pages) {
58
58
  children: [content.formula]
59
59
  });
60
60
  }
61
+ return assertNeverContentDocumentKind(content);
61
62
  }
62
63
  function factorStyles(pkg) {
63
64
  const reassembled = assembleTree(flattenTree(pkg), pkg.pages);
@@ -244,6 +245,7 @@ function mint(pkg) {
244
245
  styles
245
246
  };
246
247
  }
248
+ return assertNeverDocumentTreeKind(pkg);
247
249
  }
248
250
  function innerChain(group, chain, state) {
249
251
  const own = state.wrapperStrips.get(group);
package/dist/flatten.cjs CHANGED
@@ -19,6 +19,9 @@ function applyEntry(entry, paragraph) {
19
19
  runs: withParagraph.runs.map((run) => require_definitions.applyRunStyleProperties(runProperties, run))
20
20
  };
21
21
  }
22
+ function assertNeverDocumentTreeKind(value) {
23
+ throw new Error(`flattenTree: unhandled DocumentTree kind ${JSON.stringify(value)}`);
24
+ }
22
25
  function flattenTree(pkg) {
23
26
  const styles = pkg.styles;
24
27
  const envelope = {
@@ -88,6 +91,7 @@ function flattenTree(pkg) {
88
91
  };
89
92
  }
90
93
  }
94
+ return assertNeverDocumentTreeKind(pkg);
91
95
  }
92
96
  function untag(descriptor) {
93
97
  const copy = { ...descriptor };
@@ -152,4 +156,5 @@ function resolveAnchor(styles, chain, anchor) {
152
156
  return applyEntry(entry, anchor);
153
157
  }
154
158
  //#endregion
159
+ exports.assertNeverDocumentTreeKind = assertNeverDocumentTreeKind;
155
160
  exports.flattenTree = flattenTree;
@@ -1,6 +1,7 @@
1
- import { C as ContentDocument } from "./content-Dg9cb8mF.cjs";
1
+ import { C as ContentDocument } from "./content-CSf8z9NW.cjs";
2
2
  import { DocumentTree } from "./package.cjs";
3
3
  //#region src/flatten.d.ts
4
+ declare function assertNeverDocumentTreeKind(value: never): never;
4
5
  declare function flattenTree(pkg: DocumentTree): ContentDocument;
5
6
  //#endregion
6
- export { flattenTree };
7
+ export { assertNeverDocumentTreeKind, flattenTree };
package/dist/flatten.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { C as ContentDocument } from "./content-BMrK9SrW.js";
1
+ import { C as ContentDocument } from "./content-1yGdeaVT.js";
2
2
  import { DocumentTree } from "./package.js";
3
3
  //#region src/flatten.d.ts
4
+ declare function assertNeverDocumentTreeKind(value: never): never;
4
5
  declare function flattenTree(pkg: DocumentTree): ContentDocument;
5
6
  //#endregion
6
- export { flattenTree };
7
+ export { assertNeverDocumentTreeKind, flattenTree };
package/dist/flatten.js CHANGED
@@ -18,6 +18,9 @@ function applyEntry(entry, paragraph) {
18
18
  runs: withParagraph.runs.map((run) => applyRunStyleProperties(runProperties, run))
19
19
  };
20
20
  }
21
+ function assertNeverDocumentTreeKind(value) {
22
+ throw new Error(`flattenTree: unhandled DocumentTree kind ${JSON.stringify(value)}`);
23
+ }
21
24
  function flattenTree(pkg) {
22
25
  const styles = pkg.styles;
23
26
  const envelope = {
@@ -87,6 +90,7 @@ function flattenTree(pkg) {
87
90
  };
88
91
  }
89
92
  }
93
+ return assertNeverDocumentTreeKind(pkg);
90
94
  }
91
95
  function untag(descriptor) {
92
96
  const copy = { ...descriptor };
@@ -151,4 +155,4 @@ function resolveAnchor(styles, chain, anchor) {
151
155
  return applyEntry(entry, anchor);
152
156
  }
153
157
  //#endregion
154
- export { flattenTree };
158
+ export { assertNeverDocumentTreeKind, flattenTree };
package/dist/index.cjs CHANGED
@@ -1,7 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_a1 = require("./a1.cjs");
3
3
  const require_border_weight = require("./border-weight.cjs");
4
- require("./codec.cjs");
5
4
  const require_color = require("./color.cjs");
6
5
  const require_source = require("./source.cjs");
7
6
  const require_construct = require("./construct.cjs");
@@ -19,10 +18,7 @@ const require_content_json_schema_defs = require("./content-json-schema-defs.cjs
19
18
  const require_decompose = require("./decompose.cjs");
20
19
  const require_flatten = require("./flatten.cjs");
21
20
  const require_factor_styles = require("./factor-styles.cjs");
22
- require("./font-port.cjs");
23
21
  const require_table_grid = require("./table-grid.cjs");
24
- require("./text-layout.cjs");
25
- require("./math-layout.cjs");
26
22
  exports.AlignmentSchema = require_style.AlignmentSchema;
27
23
  exports.AnchorDescriptorSchema = require_construct.AnchorDescriptorSchema;
28
24
  exports.AnchorTypeSchema = require_construct.AnchorTypeSchema;
@@ -197,6 +193,8 @@ exports.UnrecognizedDocumentSchemaError = require_schema_io.UnrecognizedDocument
197
193
  exports.applyParagraphStyleProperties = require_definitions.applyParagraphStyleProperties;
198
194
  exports.applyRunStyleProperties = require_definitions.applyRunStyleProperties;
199
195
  exports.assembleTree = require_factor_styles.assembleTree;
196
+ exports.assertNeverDocumentSchemaKind = require_schema_io.assertNeverDocumentSchemaKind;
197
+ exports.assertNeverTableGridFaultKind = require_table_grid.assertNeverTableGridFaultKind;
200
198
  exports.borderWeightForWidthPt = require_border_weight.borderWeightForWidthPt;
201
199
  exports.cellReference = require_a1.cellReference;
202
200
  exports.clampHeadingLevel = require_content.clampHeadingLevel;