@json-to-office/shared-docx 0.35.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-436TK3T4.js → chunk-2YUAD26Q.js} +7 -2
- package/dist/chunk-2YUAD26Q.js.map +1 -0
- package/dist/{chunk-7FNE5T7M.js → chunk-DYTUITUL.js} +78 -29
- package/dist/chunk-DYTUITUL.js.map +1 -0
- package/dist/{chunk-EKBKTVLD.js → chunk-GGAJWGDI.js} +2 -2
- package/dist/{chunk-HHF5AQ7X.js → chunk-K2LA6WCD.js} +2 -2
- package/dist/{chunk-UKOAOVPP.js → chunk-K367M7TI.js} +2 -2
- package/dist/{chunk-4FOTCEYP.js → chunk-OUSJFBMX.js} +2 -2
- package/dist/{chunk-KKFRVDJH.js → chunk-SH3OH4OY.js} +6 -6
- package/dist/chunk-SH3OH4OY.js.map +1 -0
- package/dist/{chunk-4ORMKPLQ.js → chunk-WDRYTKHA.js} +2 -2
- package/dist/{chunk-G5GIBBUX.js → chunk-WOFU72HH.js} +8 -3
- package/dist/chunk-WOFU72HH.js.map +1 -0
- package/dist/{chunk-PQITDZWT.js → chunk-ZC2I7CTZ.js} +2 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +12 -10
- package/dist/index.js.map +1 -1
- package/dist/schemas/api.js +5 -5
- package/dist/schemas/component-defaults.d.ts +2 -0
- package/dist/schemas/component-defaults.js +1 -1
- package/dist/schemas/component-registry.js +3 -3
- package/dist/schemas/components.d.ts +4 -0
- package/dist/schemas/components.js +4 -4
- package/dist/schemas/document.js +6 -6
- package/dist/schemas/export.js +4 -4
- package/dist/schemas/generator.js +4 -4
- package/dist/schemas/theme.d.ts +1 -0
- package/dist/schemas/theme.js +2 -2
- package/dist/validation/unified/index.d.ts +4 -1
- package/dist/validation/unified/index.js +8 -6
- package/package.json +1 -1
- package/dist/chunk-436TK3T4.js.map +0 -1
- package/dist/chunk-7FNE5T7M.js.map +0 -1
- package/dist/chunk-G5GIBBUX.js.map +0 -1
- package/dist/chunk-KKFRVDJH.js.map +0 -1
- /package/dist/{chunk-EKBKTVLD.js.map → chunk-GGAJWGDI.js.map} +0 -0
- /package/dist/{chunk-HHF5AQ7X.js.map → chunk-K2LA6WCD.js.map} +0 -0
- /package/dist/{chunk-UKOAOVPP.js.map → chunk-K367M7TI.js.map} +0 -0
- /package/dist/{chunk-4FOTCEYP.js.map → chunk-OUSJFBMX.js.map} +0 -0
- /package/dist/{chunk-4ORMKPLQ.js.map → chunk-WDRYTKHA.js.map} +0 -0
- /package/dist/{chunk-PQITDZWT.js.map → chunk-ZC2I7CTZ.js.map} +0 -0
|
@@ -596,7 +596,7 @@ var HeadingPropsSchema = Type4.Object(
|
|
|
596
596
|
),
|
|
597
597
|
numbering: Type4.Optional(
|
|
598
598
|
Type4.Boolean({
|
|
599
|
-
description: "
|
|
599
|
+
description: "Number this heading with the document's multilevel heading numbering (1., 1.1., 1.1.1.). Set globally via componentDefaults.heading.numbering; false opts a single heading out."
|
|
600
600
|
})
|
|
601
601
|
),
|
|
602
602
|
keepNext: Type4.Optional(
|
|
@@ -1558,6 +1558,11 @@ var ListPropsSchema = Type12.Object(
|
|
|
1558
1558
|
description: "Nesting level for this item"
|
|
1559
1559
|
})
|
|
1560
1560
|
),
|
|
1561
|
+
id: Type12.Optional(
|
|
1562
|
+
Type12.String({
|
|
1563
|
+
description: "Bookmark id for this item, targetable by internal links (#id) and cross-references ([@id])"
|
|
1564
|
+
})
|
|
1565
|
+
),
|
|
1561
1566
|
revision: Type12.Optional(RevisionSchema)
|
|
1562
1567
|
},
|
|
1563
1568
|
{ additionalProperties: false }
|
|
@@ -1710,4 +1715,4 @@ export {
|
|
|
1710
1715
|
ListComponentDefaultsSchema,
|
|
1711
1716
|
ComponentDefaultsSchema
|
|
1712
1717
|
};
|
|
1713
|
-
//# sourceMappingURL=chunk-
|
|
1718
|
+
//# sourceMappingURL=chunk-2YUAD26Q.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schemas/component-defaults.ts","../src/schemas/components/heading.ts","../src/schemas/components/common.ts","../src/schemas/components/revision.ts","../src/schemas/components/comment.ts","../src/schemas/components/paragraph.ts","../src/schemas/components/note.ts","../src/schemas/components/image.ts","../src/schemas/components/statistic.ts","../src/schemas/components/table.ts","../src/schemas/components/section.ts","../src/schemas/components/columns.ts","../src/schemas/components/list.ts"],"sourcesContent":["/**\n * Component Defaults Schemas\n *\n * Extracted to its own file to avoid circular imports:\n * report.ts needs ComponentDefaultsSchema, but theme.ts (where it was)\n * imports from components.ts barrel which re-exports report.ts.\n *\n * This file imports directly from individual component files.\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { HeadingPropsSchema } from './components/heading';\nimport { ParagraphPropsSchema } from './components/paragraph';\nimport { ImagePropsSchema } from './components/image';\nimport { StatisticPropsSchema } from './components/statistic';\nimport { TablePropsSchema } from './components/table';\nimport { SectionPropsSchema } from './components/section';\nimport { ColumnsPropsSchema } from './components/columns';\nimport { ListPropsSchema } from './components/list';\n\n/**\n * Props that describe one specific occurrence of a component and can never be\n * a shared default.\n *\n * `revision` would silently replace every component's text with the same\n * tracked change; `comment` would attach the same review comment to every\n * component and make the registry allocate a fresh id for each copy;\n * `footnotes` and `endnotes` are bodies bound to markers in one paragraph's\n * own text.\n * `ComponentDefaultsSchema` is embedded in every theme, so either leak is\n * theme-wide.\n *\n * Anything added here must also be added to the table in\n * `__tests__/component-defaults-per-instance.test.ts`, which is driven by this\n * list.\n */\nexport const PER_INSTANCE_PROPS = [\n 'revision',\n 'comment',\n 'footnotes',\n 'endnotes',\n] as const;\n\nexport type PerInstanceProp = (typeof PER_INSTANCE_PROPS)[number];\n\n// Create component defaults by making all fields optional (Type.Partial),\n// minus the per-instance props above.\nexport const HeadingComponentDefaultsSchema = Type.Partial(\n Type.Omit(HeadingPropsSchema, PER_INSTANCE_PROPS)\n);\nexport const ParagraphComponentDefaultsSchema = Type.Partial(\n Type.Omit(ParagraphPropsSchema, PER_INSTANCE_PROPS)\n);\nexport const ImageComponentDefaultsSchema = Type.Partial(ImagePropsSchema);\nexport const StatisticComponentDefaultsSchema =\n Type.Partial(StatisticPropsSchema);\n/**\n * `rows` is table *content*, not a default: it carries per-row revisions, and\n * `Type.Partial` is shallow, so leaving it in would let a theme mark the same\n * row of every table inserted or deleted.\n *\n * The leak is real only for `rows`, and only because `rows` is optional on the\n * instance. `deepMerge` replaces arrays wholesale rather than merging them\n * element-wise, and `columns` is the one required table prop — so a valid\n * table always supplies its own `columns`, which replaces any the theme\n * declared, cell comments and revisions included. `columns` therefore stays\n * here: it is inert in defaults, and rejecting an inert field would break\n * existing themes for no gain.\n */\nexport const TableComponentDefaultsSchema = Type.Partial(\n Type.Omit(TablePropsSchema, ['rows'])\n);\nexport const SectionComponentDefaultsSchema = Type.Partial(SectionPropsSchema);\nexport const ColumnsComponentDefaultsSchema = Type.Partial(ColumnsPropsSchema);\nexport const ListComponentDefaultsSchema = Type.Partial(\n Type.Omit(ListPropsSchema, PER_INSTANCE_PROPS)\n);\n\nexport const ComponentDefaultsSchema = Type.Object(\n {\n heading: Type.Optional(HeadingComponentDefaultsSchema),\n paragraph: Type.Optional(ParagraphComponentDefaultsSchema),\n image: Type.Optional(ImageComponentDefaultsSchema),\n statistic: Type.Optional(StatisticComponentDefaultsSchema),\n table: Type.Optional(TableComponentDefaultsSchema),\n section: Type.Optional(SectionComponentDefaultsSchema),\n columns: Type.Optional(ColumnsComponentDefaultsSchema),\n list: Type.Optional(ListComponentDefaultsSchema),\n },\n { additionalProperties: true } // TODO: add a way to add strict custom component defaults when the plugin/registry paradigm will be implemented\n);\n\n// TypeScript types\nexport type HeadingComponentDefaults = Static<\n typeof HeadingComponentDefaultsSchema\n>;\nexport type ParagraphComponentDefaults = Static<\n typeof ParagraphComponentDefaultsSchema\n>;\nexport type ImageComponentDefaults = Static<\n typeof ImageComponentDefaultsSchema\n>;\nexport type StatisticComponentDefaults = Static<\n typeof StatisticComponentDefaultsSchema\n>;\nexport type TableComponentDefaults = Static<\n typeof TableComponentDefaultsSchema\n>;\nexport type SectionComponentDefaults = Static<\n typeof SectionComponentDefaultsSchema\n>;\nexport type ColumnsComponentDefaults = Static<\n typeof ColumnsComponentDefaultsSchema\n>;\nexport type ListComponentDefaults = Static<typeof ListComponentDefaultsSchema>;\nexport type ComponentDefaults = Static<typeof ComponentDefaultsSchema>;\n","/**\n * Heading Component Schema\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport {\n FontDefinitionSchema,\n LanguageSchema,\n NoProofSchema,\n NoProofWordsSchema,\n} from '../font';\nimport {\n HeadingLevelSchema,\n JustifiedAlignmentSchema,\n SpacingSchema,\n LineSpacingSchema,\n ParagraphIndentSchema,\n} from './common';\nimport { RevisionSchema } from './revision';\nimport { CommentSchema } from './comment';\n\nexport const HeadingPropsSchema = Type.Object(\n {\n text: Type.String({\n description: 'Heading text (required)',\n }),\n level: Type.Optional(HeadingLevelSchema),\n // Local font override: allows customizing family/size/color/bold/italic/underline\n // without modifying theme styles. Supports partial overrides.\n font: Type.Optional(Type.Partial(FontDefinitionSchema)),\n // Local language override (BCP-47). Falls back to the document default when omitted.\n language: Type.Optional(LanguageSchema),\n // Disable spell/grammar checking for this heading's text\n noProof: Type.Optional(NoProofSchema),\n // Known-words allowlist for this heading (merged with the document list)\n noProofWords: Type.Optional(NoProofWordsSchema),\n alignment: Type.Optional(JustifiedAlignmentSchema),\n spacing: Type.Optional(SpacingSchema),\n // Paragraph indentation (w:ind) in twips\n indent: Type.Optional(ParagraphIndentSchema),\n lineSpacing: Type.Optional(\n Type.Union([Type.Number({ minimum: 0 }), LineSpacingSchema])\n ),\n pageBreak: Type.Optional(\n Type.Boolean({\n description: 'Insert page break before heading',\n })\n ),\n columnBreak: Type.Optional(\n Type.Boolean({\n description: 'Insert column break before heading',\n })\n ),\n numbering: Type.Optional(\n Type.Boolean({\n description:\n \"Number this heading with the document's multilevel heading numbering (1., 1.1., 1.1.1.). Set globally via componentDefaults.heading.numbering; false opts a single heading out.\",\n })\n ),\n keepNext: Type.Optional(\n Type.Boolean({\n description: 'Keep heading with next paragraph on same page',\n })\n ),\n keepLines: Type.Optional(\n Type.Boolean({\n description: 'Keep all lines of heading together on same page',\n })\n ),\n revision: Type.Optional(RevisionSchema),\n comment: Type.Optional(CommentSchema),\n },\n {\n description: 'Heading component props',\n additionalProperties: false,\n }\n);\n\nexport type HeadingProps = Static<typeof HeadingPropsSchema>;\n","/**\n * Common Types and Schemas for Components\n *\n * Shared type definitions used across multiple component schemas.\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { HexColorSchema } from '../font';\n\n// ============================================================================\n// Common Types\n// ============================================================================\n\nexport const AlignmentSchema = Type.Union(\n [Type.Literal('left'), Type.Literal('center'), Type.Literal('right')],\n { description: 'Text alignment options' }\n);\n\nexport const JustifiedAlignmentSchema = Type.Union(\n [\n Type.Literal('left'),\n Type.Literal('center'),\n Type.Literal('right'),\n Type.Literal('justify'),\n ],\n { description: 'Text alignment options including justify' }\n);\n\nexport const HeadingLevelSchema = Type.Union(\n [\n Type.Literal(1),\n Type.Literal(2),\n Type.Literal(3),\n Type.Literal(4),\n Type.Literal(5),\n Type.Literal(6),\n ],\n { description: 'Heading level (1-6)' }\n);\n\nexport const SpacingSchema = Type.Object(\n {\n before: Type.Optional(\n Type.Number({\n minimum: 0,\n description: 'Spacing before element in points',\n })\n ),\n after: Type.Optional(\n Type.Number({\n minimum: 0,\n description: 'Spacing after element in points',\n })\n ),\n },\n {\n description: 'Spacing configuration',\n additionalProperties: false,\n }\n);\n\nexport const ListSpacingSchema = Type.Object(\n {\n before: Type.Optional(\n Type.Number({\n minimum: 0,\n description: 'Spacing before list in points',\n })\n ),\n after: Type.Optional(\n Type.Number({\n minimum: 0,\n description: 'Spacing after list in points',\n })\n ),\n item: Type.Optional(\n Type.Number({\n minimum: 0,\n description: 'Spacing between list items in points',\n })\n ),\n },\n {\n description: 'List spacing configuration with item spacing',\n additionalProperties: false,\n }\n);\n\nexport const MarginsSchema = Type.Object(\n {\n top: Type.Optional(Type.Number({ minimum: 0 })),\n bottom: Type.Optional(Type.Number({ minimum: 0 })),\n left: Type.Optional(Type.Number({ minimum: 0 })),\n right: Type.Optional(Type.Number({ minimum: 0 })),\n },\n { description: 'Margin configuration', additionalProperties: false }\n);\n\nexport const BorderSchema = Type.Object(\n {\n style: Type.Optional(\n Type.Union([\n Type.Literal('solid'),\n Type.Literal('dashed'),\n Type.Literal('dotted'),\n Type.Literal('double'),\n Type.Literal('none'),\n ])\n ),\n width: Type.Optional(Type.Number({ minimum: 0 })),\n color: Type.Optional(HexColorSchema),\n },\n { description: 'Border configuration', additionalProperties: false }\n);\n\nexport const LineSpacingSchema = Type.Object(\n {\n type: Type.Union([\n Type.Literal('single'),\n Type.Literal('atLeast'),\n Type.Literal('exactly'),\n Type.Literal('double'),\n Type.Literal('multiple'),\n ]),\n value: Type.Optional(Type.Number({ minimum: 0 })),\n },\n { description: 'Line spacing configuration', additionalProperties: false }\n);\n\nexport const IndentSchema = Type.Object(\n {\n left: Type.Optional(Type.Number({ minimum: 0 })),\n hanging: Type.Optional(Type.Number({ minimum: 0 })),\n },\n { description: 'Indentation configuration', additionalProperties: false }\n);\n\nexport const ParagraphIndentSchema = Type.Object(\n {\n left: Type.Optional(\n Type.Number({\n description: 'Left indentation in twips (1/20 of a point)',\n })\n ),\n right: Type.Optional(\n Type.Number({\n description: 'Right indentation in twips (1/20 of a point)',\n })\n ),\n hanging: Type.Optional(\n Type.Number({\n minimum: 0,\n description:\n 'Hanging indent in twips: first line stays at the left indent, following lines are indented. Mutually exclusive with firstLine.',\n })\n ),\n firstLine: Type.Optional(\n Type.Number({\n minimum: 0,\n description:\n 'First-line indent in twips: only the first line is indented. Mutually exclusive with hanging.',\n })\n ),\n },\n {\n description:\n 'Paragraph indentation (w:ind) in twips. Use either hanging or firstLine, not both.',\n additionalProperties: false,\n }\n);\n\nexport const TabStopTypeSchema = Type.Union(\n [\n Type.Literal('left'),\n Type.Literal('right'),\n Type.Literal('center'),\n Type.Literal('decimal'),\n Type.Literal('bar'),\n ],\n { description: 'Tab stop alignment type' }\n);\n\nexport const TabStopLeaderSchema = Type.Union(\n [\n Type.Literal('dot'),\n Type.Literal('hyphen'),\n Type.Literal('underscore'),\n Type.Literal('middleDot'),\n Type.Literal('none'),\n ],\n { description: 'Leader character filling the space before the tab stop' }\n);\n\nexport const TabStopSchema = Type.Object(\n {\n type: TabStopTypeSchema,\n position: Type.Number({\n minimum: 0,\n description: 'Tab stop position in twips (1/20 of a point)',\n }),\n leader: Type.Optional(TabStopLeaderSchema),\n },\n {\n description: 'Tab stop definition (w:tab in w:tabs)',\n additionalProperties: false,\n }\n);\n\nexport const TabStopsSchema = Type.Array(TabStopSchema, {\n description:\n 'Tab stops for the paragraph. Tab characters (\\\\t) in the text jump to these positions.',\n});\n\n// ============================================================================\n// Floating Positioning Schemas (shared between image, text-box components)\n// ============================================================================\n\nexport const HorizontalPositionRelativeFromSchema = Type.Union(\n [\n Type.Literal('character'),\n Type.Literal('column'),\n Type.Literal('margin'),\n Type.Literal('page'),\n Type.Literal('text'), // VML compatibility for text-box\n ],\n {\n description: 'Horizontal position relative to',\n }\n);\n\nexport const VerticalPositionRelativeFromSchema = Type.Union(\n [\n Type.Literal('margin'),\n Type.Literal('page'),\n Type.Literal('paragraph'),\n Type.Literal('line'),\n Type.Literal('text'), // VML compatibility for text-box\n ],\n {\n description: 'Vertical position relative to',\n }\n);\n\nexport const HorizontalPositionAlignSchema = Type.Union(\n [\n Type.Literal('left'),\n Type.Literal('center'),\n Type.Literal('right'),\n Type.Literal('inside'),\n Type.Literal('outside'),\n ],\n {\n description: 'Horizontal alignment',\n }\n);\n\nexport const VerticalPositionAlignSchema = Type.Union(\n [\n Type.Literal('top'),\n Type.Literal('center'),\n Type.Literal('bottom'),\n Type.Literal('inside'),\n Type.Literal('outside'),\n ],\n {\n description: 'Vertical alignment',\n }\n);\n\nexport const TextWrappingTypeSchema = Type.Union(\n [\n Type.Literal('none'),\n Type.Literal('square'),\n Type.Literal('topAndBottom'),\n Type.Literal('around'), // VML compatibility for text-box\n Type.Literal('tight'), // VML compatibility for text-box\n Type.Literal('through'), // VML compatibility for text-box\n ],\n {\n description: 'Text wrapping type',\n }\n);\n\nexport const TextWrappingSideSchema = Type.Union(\n [\n Type.Literal('bothSides'),\n Type.Literal('left'),\n Type.Literal('right'),\n Type.Literal('largest'),\n ],\n {\n description: 'Text wrapping side',\n }\n);\n\nexport const FloatingPropertiesSchema = Type.Object(\n {\n horizontalPosition: Type.Optional(\n Type.Object(\n {\n relative: Type.Optional(HorizontalPositionRelativeFromSchema),\n align: Type.Optional(HorizontalPositionAlignSchema),\n offset: Type.Optional(\n Type.Union([\n Type.Number({\n description: 'Horizontal offset in twips (1/20 of a point)',\n }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description:\n 'Horizontal offset as percentage (e.g., \"50%\") relative to page or margin width',\n }),\n ])\n ),\n },\n {\n description:\n 'Horizontal positioning (use either align or offset, not both)',\n additionalProperties: false,\n }\n )\n ),\n verticalPosition: Type.Optional(\n Type.Object(\n {\n relative: Type.Optional(VerticalPositionRelativeFromSchema),\n align: Type.Optional(VerticalPositionAlignSchema),\n offset: Type.Optional(\n Type.Union([\n Type.Number({\n description: 'Vertical offset in twips (1/20 of a point)',\n }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description:\n 'Vertical offset as percentage (e.g., \"50%\") relative to page or margin height',\n }),\n ])\n ),\n },\n {\n description:\n 'Vertical positioning (use either align or offset, not both)',\n additionalProperties: false,\n }\n )\n ),\n wrap: Type.Optional(\n Type.Object(\n {\n type: TextWrappingTypeSchema,\n side: Type.Optional(TextWrappingSideSchema),\n margins: Type.Optional(\n Type.Object(\n {\n top: Type.Optional(\n Type.Union([\n Type.Number({ description: 'Top margin in twips' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'Top margin as percentage of page height',\n }),\n ])\n ),\n bottom: Type.Optional(\n Type.Union([\n Type.Number({ description: 'Bottom margin in twips' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'Bottom margin as percentage of page height',\n }),\n ])\n ),\n left: Type.Optional(\n Type.Union([\n Type.Number({ description: 'Left margin in twips' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'Left margin as percentage of page width',\n }),\n ])\n ),\n right: Type.Optional(\n Type.Union([\n Type.Number({ description: 'Right margin in twips' }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description: 'Right margin as percentage of page width',\n }),\n ])\n ),\n },\n {\n description: 'Distance from text margins',\n additionalProperties: false,\n }\n )\n ),\n },\n {\n description: 'Text wrapping configuration',\n additionalProperties: false,\n }\n )\n ),\n allowOverlap: Type.Optional(\n Type.Boolean({\n description: 'Allow element to overlap with other elements',\n })\n ),\n behindDocument: Type.Optional(\n Type.Boolean({\n description: 'Place element behind document text',\n })\n ),\n lockAnchor: Type.Optional(\n Type.Boolean({\n description: 'Lock the anchor position',\n })\n ),\n layoutInCell: Type.Optional(\n Type.Boolean({\n description: 'Layout element within table cell',\n })\n ),\n zIndex: Type.Optional(\n Type.Number({\n minimum: 0,\n description: 'Z-order for overlapping elements (must be non-negative)',\n })\n ),\n rotation: Type.Optional(\n Type.Number({\n description: 'Rotation angle in degrees',\n })\n ),\n visibility: Type.Optional(\n Type.Union([Type.Literal('hidden'), Type.Literal('inherit')], {\n description: 'Visibility of the floating element',\n })\n ),\n },\n {\n description: 'Floating element properties',\n additionalProperties: false,\n }\n);\n\nexport type HorizontalPositionRelativeFrom = Static<\n typeof HorizontalPositionRelativeFromSchema\n>;\nexport type VerticalPositionRelativeFrom = Static<\n typeof VerticalPositionRelativeFromSchema\n>;\nexport type HorizontalPositionAlign = Static<\n typeof HorizontalPositionAlignSchema\n>;\nexport type VerticalPositionAlign = Static<typeof VerticalPositionAlignSchema>;\nexport type TextWrappingType = Static<typeof TextWrappingTypeSchema>;\nexport type TextWrappingSide = Static<typeof TextWrappingSideSchema>;\nexport type FloatingProperties = Static<typeof FloatingPropertiesSchema>;\n\nexport const NumberingSchema = Type.Object(\n {\n start: Type.Optional(Type.Number({ minimum: 1 })),\n style: Type.Optional(\n Type.Union([\n Type.Literal('decimal'),\n Type.Literal('lowerLetter'),\n Type.Literal('upperLetter'),\n Type.Literal('lowerRoman'),\n Type.Literal('upperRoman'),\n ])\n ),\n separator: Type.Optional(Type.String()),\n },\n {\n description: 'Numbering configuration for lists',\n additionalProperties: false,\n }\n);\n\n// ============================================================================\n// Base Component Props (common fields across all components)\n// ============================================================================\n// Note: BaseComponentFields is currently empty as common properties\n// (className, style, hidden, condition) are not implemented in the rendering engine.\n// These were removed to accurately reflect actual capabilities.\n\nconst BaseComponentFields = {};\n\n// Export BaseComponentPropsSchema\nexport const BaseComponentPropsSchema = Type.Object(BaseComponentFields, {\n description: 'Base component props',\n additionalProperties: true,\n});\n\n// Export BaseComponentFields for use in component definitions\nexport { BaseComponentFields };\n\n// ============================================================================\n// TypeScript Types\n// ============================================================================\n\nexport type Alignment = Static<typeof AlignmentSchema>;\nexport type JustifiedAlignment = Static<typeof JustifiedAlignmentSchema>;\nexport type HeadingLevel = Static<typeof HeadingLevelSchema>;\nexport type Spacing = Static<typeof SpacingSchema>;\nexport type ListSpacing = Static<typeof ListSpacingSchema>;\nexport type LineSpacing = Static<typeof LineSpacingSchema>;\nexport type Indent = Static<typeof IndentSchema>;\nexport type ParagraphIndent = Static<typeof ParagraphIndentSchema>;\nexport type TabStopType = Static<typeof TabStopTypeSchema>;\nexport type TabStopLeader = Static<typeof TabStopLeaderSchema>;\nexport type TabStop = Static<typeof TabStopSchema>;\nexport type TabStops = Static<typeof TabStopsSchema>;\nexport type Numbering = Static<typeof NumberingSchema>;\nexport type Margins = Static<typeof MarginsSchema>;\nexport type Border = Static<typeof BorderSchema>;\nexport type BaseComponentProps = Static<typeof BaseComponentPropsSchema>;\n","/**\n * Revision Schema\n * Tracked-change (redline) metadata for text-bearing components.\n *\n * When a component carries a `revision`, its text is rendered from\n * `revision.segments` as native Word tracked changes (w:ins / w:del)\n * instead of the plain `text` prop. The `text` prop should hold the\n * new (post-change) text so the document degrades gracefully when\n * revisions are ignored.\n */\n\nimport { Type, Static } from '@sinclair/typebox';\n\nexport const RevisionSegmentSchema = Type.Object(\n {\n type: Type.Union(\n [Type.Literal('equal'), Type.Literal('insert'), Type.Literal('delete')],\n {\n description:\n \"Segment kind: 'equal' renders as normal text, 'insert' as a tracked insertion, 'delete' as a tracked deletion\",\n }\n ),\n text: Type.String({\n description: 'Literal text of this segment (rendered without markdown)',\n }),\n },\n {\n description: 'A contiguous run of text sharing one revision state',\n additionalProperties: false,\n }\n);\n\nexport const RevisionSchema = Type.Object(\n {\n author: Type.Optional(\n Type.String({\n description:\n 'Revision author shown in Word (default: \"json-to-office\")',\n })\n ),\n date: Type.Optional(\n Type.String({\n format: 'date-time',\n description:\n 'Revision timestamp (ISO 8601). Defaults to the Unix epoch for deterministic output',\n })\n ),\n segments: Type.Array(RevisionSegmentSchema, {\n minItems: 1,\n description:\n 'Ordered text segments; concatenating equal+insert segments yields the new text, equal+delete the old text',\n }),\n },\n {\n description:\n 'Tracked-change data: renders the component text as native Word revisions (accept/reject in Word)',\n additionalProperties: false,\n }\n);\n\nexport type RevisionSegment = Static<typeof RevisionSegmentSchema>;\nexport type Revision = Static<typeof RevisionSchema>;\n\n/**\n * A structural revision: an insertion or deletion of a whole element (a table\n * row, say) rather than a run of text.\n *\n * `RevisionSchema` cannot express this — it requires `segments` with at least\n * one entry, and a structural mark has no text of its own.\n */\nexport const RevisionMarkSchema = Type.Object(\n {\n type: Type.Union([Type.Literal('insert'), Type.Literal('delete')], {\n description: 'Whether the element was inserted or deleted',\n }),\n author: Type.Optional(\n Type.String({\n description:\n 'Revision author shown in Word (default: \"json-to-office\")',\n })\n ),\n date: Type.Optional(\n Type.String({\n format: 'date-time',\n description:\n 'Revision timestamp (ISO 8601). Defaults to the Unix epoch for deterministic output',\n })\n ),\n },\n {\n description:\n 'Structural tracked change: the element itself was inserted or deleted',\n additionalProperties: false,\n }\n);\n\nexport type RevisionMark = Static<typeof RevisionMarkSchema>;\n","/**\n * Comment Schema\n * Word review comments anchored to a text-bearing component.\n *\n * A comment attaches to the component that carries it: the rendered text is\n * wrapped in a `w:commentRangeStart` / `w:commentRangeEnd` pair and followed by\n * a `w:commentReference`, with the body living in `word/comments.xml`. The\n * component's own text is unaffected, so a reader that ignores comments sees\n * exactly the same document.\n *\n * Comment ids live in their own OOXML namespace, separate from the\n * `w:ins` / `w:del` ids used by [`RevisionSchema`](./revision.ts).\n */\n\nimport { Type, Static } from '@sinclair/typebox';\n\n/** Fields every comment in a thread shares. */\nconst CommentBodyFields = {\n text: Type.String({\n minLength: 1,\n description:\n 'Comment body. Newlines split it into separate paragraphs in the comment pane.',\n }),\n author: Type.Optional(\n Type.String({\n description: 'Comment author shown in Word (default: \"json-to-office\")',\n })\n ),\n initials: Type.Optional(\n Type.String({\n description:\n 'Author initials shown on the comment bubble (derived from the author when omitted)',\n })\n ),\n date: Type.Optional(\n Type.String({\n format: 'date-time',\n description:\n 'Comment timestamp (ISO 8601). Defaults to the Unix epoch for deterministic output',\n })\n ),\n};\n\n/**\n * A reply in a comment thread. Word threads are one level deep — a reply\n * cannot itself carry replies — so this is deliberately not recursive.\n */\nexport const CommentReplySchema = Type.Object(CommentBodyFields, {\n description: 'A reply within a comment thread',\n additionalProperties: false,\n});\n\nexport const CommentSchema = Type.Object(\n {\n ...CommentBodyFields,\n replies: Type.Optional(\n Type.Array(CommentReplySchema, {\n minItems: 1,\n description:\n 'Replies, in order. They anchor to the same text and Word shows them as one thread.',\n })\n ),\n resolved: Type.Optional(\n Type.Boolean({\n description:\n 'Mark the whole thread resolved (w15:done). Word writes the thread state only when the document contains at least one reply.',\n })\n ),\n },\n {\n description: \"A Word review comment anchored to this component's text\",\n additionalProperties: false,\n }\n);\n\nexport type CommentReply = Static<typeof CommentReplySchema>;\nexport type Comment = Static<typeof CommentSchema>;\n","/**\n * Paragraph Component Schema\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { SpacingSchema, ParagraphIndentSchema, TabStopsSchema } from './common';\nimport {\n FontDefinitionSchema,\n HexColorSchema,\n LanguageSchema,\n NoProofSchema,\n NoProofWordsSchema,\n} from '../font';\nimport { RevisionSchema } from './revision';\nimport { CommentSchema } from './comment';\nimport { EndnotesSchema, FootnotesSchema } from './note';\n\n// Frame wrapping type schema\nconst FrameWrapTypeSchema = Type.Union(\n [\n Type.Literal('around'),\n Type.Literal('none'),\n Type.Literal('notBeside'),\n Type.Literal('through'),\n Type.Literal('tight'),\n Type.Literal('auto'),\n ],\n {\n description: 'Frame text wrapping type',\n }\n);\n\n// Frame anchor type schema\nconst FrameAnchorTypeSchema = Type.Union(\n [Type.Literal('margin'), Type.Literal('page'), Type.Literal('text')],\n {\n description: 'Frame anchor type',\n }\n);\n\n// Frame horizontal position alignment schema\nconst FrameHorizontalAlignSchema = Type.Union(\n [\n Type.Literal('left'),\n Type.Literal('center'),\n Type.Literal('right'),\n Type.Literal('inside'),\n Type.Literal('outside'),\n ],\n {\n description: 'Frame horizontal alignment',\n }\n);\n\n// Frame vertical position alignment schema\nconst FrameVerticalAlignSchema = Type.Union(\n [\n Type.Literal('top'),\n Type.Literal('center'),\n Type.Literal('bottom'),\n Type.Literal('inside'),\n Type.Literal('outside'),\n ],\n {\n description: 'Frame vertical alignment',\n }\n);\n\n// Floating frame properties schema\nconst FloatingFramePropertiesSchema = Type.Object(\n {\n horizontalPosition: Type.Optional(\n Type.Object(\n {\n relative: Type.Optional(FrameAnchorTypeSchema),\n align: Type.Optional(FrameHorizontalAlignSchema),\n offset: Type.Optional(\n Type.Union([\n Type.Number({\n description: 'Horizontal offset in twips (1/20 of a point)',\n }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description:\n 'Horizontal offset as percentage (e.g., \"50%\") relative to page or margin width',\n }),\n ])\n ),\n },\n {\n description:\n 'Horizontal positioning (use either align or offset, not both)',\n additionalProperties: false,\n }\n )\n ),\n verticalPosition: Type.Optional(\n Type.Object(\n {\n relative: Type.Optional(FrameAnchorTypeSchema),\n align: Type.Optional(FrameVerticalAlignSchema),\n offset: Type.Optional(\n Type.Union([\n Type.Number({\n description: 'Vertical offset in twips (1/20 of a point)',\n }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description:\n 'Vertical offset as percentage (e.g., \"50%\") relative to page or margin height',\n }),\n ])\n ),\n },\n {\n description:\n 'Vertical positioning (use either align or offset, not both)',\n additionalProperties: false,\n }\n )\n ),\n wrap: Type.Optional(\n Type.Object(\n {\n type: FrameWrapTypeSchema,\n },\n {\n description: 'Text wrapping configuration',\n additionalProperties: false,\n }\n )\n ),\n lockAnchor: Type.Optional(\n Type.Boolean({\n description: 'Lock the anchor position',\n })\n ),\n width: Type.Optional(\n Type.Number({\n minimum: 1,\n description: 'Frame width in twips (DXA units)',\n })\n ),\n height: Type.Optional(\n Type.Number({\n minimum: 1,\n description: 'Frame height in twips (DXA units)',\n })\n ),\n },\n {\n description: 'Floating text frame properties',\n additionalProperties: false,\n }\n);\n\n// Alignment type schema (paragraph-level, not font-level)\nconst AlignmentSchema = Type.Union(\n [\n Type.Literal('left'),\n Type.Literal('center'),\n Type.Literal('right'),\n Type.Literal('justify'),\n ],\n {\n description: 'Paragraph text alignment',\n }\n);\n\nexport const ParagraphPropsSchema = Type.Object(\n {\n text: Type.String({\n description: 'Text content (required)',\n }),\n // New nested font object, aligned with theme's FontDefinitionSchema\n // Allow partial overrides (family not required when overriding a subset)\n font: Type.Optional(Type.Partial(FontDefinitionSchema)),\n // Optional reference to a named style from theme.styles (e.g., 'heading1', 'normal')\n themeStyle: Type.Optional(Type.String()),\n // Local language override (BCP-47). Falls back to the document default when omitted.\n language: Type.Optional(LanguageSchema),\n // Disable spell/grammar checking for this paragraph's text\n noProof: Type.Optional(NoProofSchema),\n // Known-words allowlist for this paragraph (merged with the document list)\n noProofWords: Type.Optional(NoProofWordsSchema),\n // Rich-text decoration color for bold segments (kept as top-level behavior\n // option). Same value space as font.color: hex or theme color token.\n boldColor: Type.Optional(HexColorSchema),\n // Paragraph spacing (in points) — limited paragraph-level option allowed\n spacing: Type.Optional(SpacingSchema),\n // Paragraph alignment (moved from font to config level)\n alignment: Type.Optional(AlignmentSchema),\n // Paragraph indentation (w:ind) in twips\n indent: Type.Optional(ParagraphIndentSchema),\n // Tab stops (w:tabs); tab characters (\\t) in text jump to these positions\n tabStops: Type.Optional(TabStopsSchema),\n pageBreak: Type.Optional(\n Type.Boolean({\n description: 'Insert page break before paragraph',\n })\n ),\n columnBreak: Type.Optional(\n Type.Boolean({\n description: 'Insert column break before paragraph',\n })\n ),\n floating: Type.Optional(FloatingFramePropertiesSchema),\n keepNext: Type.Optional(\n Type.Boolean({\n description: 'Keep paragraph with next paragraph on same page',\n })\n ),\n keepLines: Type.Optional(\n Type.Boolean({\n description: 'Keep all lines of paragraph together on same page',\n })\n ),\n id: Type.Optional(\n Type.String({\n description: 'Unique identifier for internal linking (bookmark anchor)',\n })\n ),\n revision: Type.Optional(RevisionSchema),\n comment: Type.Optional(CommentSchema),\n footnotes: Type.Optional(FootnotesSchema),\n endnotes: Type.Optional(EndnotesSchema),\n },\n {\n description:\n 'Paragraph component props (font nested for theme consistency; no flat font properties)',\n additionalProperties: false,\n }\n);\n\nexport type ParagraphProps = Static<typeof ParagraphPropsSchema>;\n","/**\n * Note Schemas (footnotes and endnotes)\n *\n * A note is authored in two halves: an inline `[^id]` marker in the text and a\n * body declared on the paragraph that carries it.\n *\n * { \"text\": \"Revenue grew 12%.[^rev]\",\n * \"footnotes\": [{ \"id\": \"rev\", \"text\": \"Source: FY26 audited accounts.\" }] }\n *\n * Footnotes and endnotes share the marker syntax and differ only in where Word\n * puts the body — the foot of the page, or the end of the document. An id is\n * resolved against the paragraph's `footnotes` first, then its `endnotes`.\n *\n * `[^id]` is only treated as a marker when `id` matches a declared note, so\n * text that merely looks like one — a regex character class in a code sample,\n * say — is left exactly as written.\n */\n\nimport { Type, Static } from '@sinclair/typebox';\n\nexport const NoteSchema = Type.Object(\n {\n id: Type.String({\n minLength: 1,\n pattern: '^[^\\\\]\\\\s]+$',\n description:\n 'Marker id referenced from the text as `[^id]`. Any characters except whitespace and \"]\".',\n }),\n text: Type.String({\n minLength: 1,\n description:\n 'Note body. Newlines split it into separate paragraphs where the note is placed.',\n }),\n },\n {\n description: 'A note body bound to an inline `[^id]` marker',\n additionalProperties: false,\n }\n);\n\nexport const FootnotesSchema = Type.Array(NoteSchema, {\n description:\n 'Footnote bodies for `[^id]` markers in this paragraph, placed at the foot of the page. An unreferenced body is not emitted.',\n minItems: 1,\n});\n\nexport const EndnotesSchema = Type.Array(NoteSchema, {\n description:\n 'Endnote bodies for `[^id]` markers in this paragraph, collected at the end of the document. An unreferenced body is not emitted.',\n minItems: 1,\n});\n\nexport type Note = Static<typeof NoteSchema>;\n","/**\n * Image Component Schema\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport {\n AlignmentSchema,\n SpacingSchema,\n FloatingPropertiesSchema,\n} from './common';\n\nexport const ImagePropsSchema = Type.Object(\n {\n path: Type.Optional(\n Type.String({\n description:\n 'Image source URL or file path (mutually exclusive with base64 and svg)',\n })\n ),\n base64: Type.Optional(\n Type.String({\n description:\n 'Base64-encoded image data in data URI format (e.g., \"data:image/png;base64,iVBORw0KGgo...\") (mutually exclusive with path and svg)',\n })\n ),\n svg: Type.Optional(\n Type.String({\n description:\n 'Raw inline SVG markup, e.g. \"<svg xmlns=\\\\\"http://www.w3.org/2000/svg\\\\\" viewBox=\\\\\"0 0 24 24\\\\\">...</svg>\" (mutually exclusive with path and base64). Renders as a vector image (Word 2016+); intrinsic size taken from the SVG viewBox/width/height when width/height omitted.',\n })\n ),\n alt: Type.Optional(\n Type.String({\n description: 'Alternative text for accessibility',\n })\n ),\n width: Type.Optional(\n Type.Union(\n [\n Type.Number({\n minimum: 1,\n description: 'Image width in pixels',\n }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description:\n 'Image width as percentage (e.g., \"90%\") relative to widthRelativeTo (defaults to content width)',\n }),\n ],\n {\n description:\n 'Image width in pixels (number) or as percentage string (e.g., \"90%\")',\n default: '100%',\n }\n )\n ),\n height: Type.Optional(\n Type.Union(\n [\n Type.Number({\n minimum: 1,\n description: 'Image height in pixels',\n }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description:\n 'Image height as percentage (e.g., \"90%\") relative to heightRelativeTo (defaults to content height)',\n }),\n ],\n {\n description:\n 'Image height in pixels (number) or as percentage string (e.g., \"90%\")',\n }\n )\n ),\n widthRelativeTo: Type.Optional(\n Type.Union([Type.Literal('content'), Type.Literal('page')], {\n description:\n 'Reference for width percentages: content (page width minus margins) or page (full page width)',\n default: 'content',\n })\n ),\n heightRelativeTo: Type.Optional(\n Type.Union([Type.Literal('content'), Type.Literal('page')], {\n description:\n 'Reference for height percentages: content (page height minus margins) or page (full page height)',\n default: 'content',\n })\n ),\n alignment: Type.Optional(AlignmentSchema),\n caption: Type.Optional(\n Type.String({\n description:\n 'Image caption (supports rich text with **bold**, *italic*, ***both***)',\n })\n ),\n spacing: Type.Optional(SpacingSchema),\n floating: Type.Optional(FloatingPropertiesSchema),\n keepNext: Type.Optional(\n Type.Boolean({\n description: 'Keep paragraph with next paragraph on same page',\n })\n ),\n keepLines: Type.Optional(\n Type.Boolean({\n description: 'Keep all lines of paragraph together on same page',\n })\n ),\n },\n {\n description: 'Image component props',\n additionalProperties: false,\n }\n);\n\nexport type ImageProps = Static<typeof ImagePropsSchema>;\n","/**\n * Statistic Component Schema\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { AlignmentSchema, SpacingSchema } from './common';\n\nexport const StatisticPropsSchema = Type.Object(\n {\n number: Type.String({\n description: 'Statistic number/value (required)',\n }),\n description: Type.String({\n description: 'Statistic description (required)',\n }),\n unit: Type.Optional(\n Type.String({\n description: 'Unit of measurement',\n })\n ),\n format: Type.Optional(\n Type.String({\n description: 'Number format pattern',\n })\n ),\n trend: Type.Optional(\n Type.Union([\n Type.Literal('up'),\n Type.Literal('down'),\n Type.Literal('neutral'),\n ])\n ),\n trendValue: Type.Optional(Type.Union([Type.String(), Type.Number()])),\n alignment: Type.Optional(AlignmentSchema),\n spacing: Type.Optional(SpacingSchema),\n size: Type.Optional(\n Type.Union([\n Type.Literal('small'),\n Type.Literal('medium'),\n Type.Literal('large'),\n ])\n ),\n },\n {\n description: 'Statistic component props',\n additionalProperties: false,\n }\n);\n\nexport type StatisticProps = Static<typeof StatisticPropsSchema>;\n","/**\n * Table Component Schema\n */\n\nimport { Type, Static, TSchema } from '@sinclair/typebox';\nimport { HexColorSchema, HexColorOrTransparentSchema } from '../font';\nimport { CommentSchema } from './comment';\nimport { RevisionMarkSchema, RevisionSchema } from './revision';\n\n// Define Cell type - can be plain text or a component definition\nconst CellContentSchema = Type.Recursive((This) =>\n Type.Union([\n Type.String(),\n Type.Object(\n {\n name: Type.String(),\n props: Type.Object({}, { additionalProperties: true }),\n children: Type.Optional(Type.Array(This)),\n },\n { additionalProperties: false }\n ),\n ])\n);\n\n// Horizontal alignment schema\nconst HorizontalAlignmentSchema = Type.Union(\n [\n Type.Literal('left'),\n Type.Literal('center'),\n Type.Literal('right'),\n Type.Literal('justify'),\n ],\n { description: 'Horizontal text alignment' }\n);\n\n// Vertical alignment schema\nconst VerticalAlignmentSchema = Type.Union(\n [Type.Literal('top'), Type.Literal('middle'), Type.Literal('bottom')],\n { description: 'Vertical cell alignment' }\n);\n\n// Font configuration schema\nconst FontConfigSchema = Type.Object(\n {\n family: Type.Optional(Type.String({ description: 'Font family name' })),\n size: Type.Optional(\n Type.Number({ minimum: 0, description: 'Font size in points' })\n ),\n bold: Type.Optional(Type.Boolean({ description: 'Bold text' })),\n fontWeight: Type.Optional(\n Type.Integer({\n minimum: 100,\n maximum: 900,\n description: 'Per-cell weight (100–900). Overrides `bold` when set.',\n })\n ),\n italic: Type.Optional(Type.Boolean({ description: 'Italic text' })),\n underline: Type.Optional(Type.Boolean({ description: 'Underlined text' })),\n },\n { additionalProperties: false }\n);\n\n// Border color - can be a single string or an object with sides\nconst BorderColorSchema = Type.Union([\n Type.String({ description: 'Border color for all sides (hex without #)' }),\n Type.Object(\n {\n bottom: Type.Optional(\n Type.String({ description: 'Bottom border color (hex without #)' })\n ),\n top: Type.Optional(\n Type.String({ description: 'Top border color (hex without #)' })\n ),\n right: Type.Optional(\n Type.String({ description: 'Right border color (hex without #)' })\n ),\n left: Type.Optional(\n Type.String({ description: 'Left border color (hex without #)' })\n ),\n },\n { additionalProperties: false }\n ),\n]);\n\n// Border size - can be a single number or an object with sides\nconst BorderSizeSchema = Type.Union([\n Type.Number({\n minimum: 0,\n description: 'Border size for all sides in points',\n }),\n Type.Object(\n {\n bottom: Type.Optional(\n Type.Number({ minimum: 0, description: 'Bottom border size in points' })\n ),\n top: Type.Optional(\n Type.Number({ minimum: 0, description: 'Top border size in points' })\n ),\n right: Type.Optional(\n Type.Number({ minimum: 0, description: 'Right border size in points' })\n ),\n left: Type.Optional(\n Type.Number({ minimum: 0, description: 'Left border size in points' })\n ),\n },\n { additionalProperties: false }\n ),\n]);\n\n// Hide borders - can be a boolean or an object with sides\nconst HideBordersSchema = Type.Union([\n Type.Boolean({\n description: 'Hide all borders when true',\n }),\n Type.Object(\n {\n bottom: Type.Optional(\n Type.Boolean({ description: 'Hide bottom border' })\n ),\n top: Type.Optional(Type.Boolean({ description: 'Hide top border' })),\n right: Type.Optional(Type.Boolean({ description: 'Hide right border' })),\n left: Type.Optional(Type.Boolean({ description: 'Hide left border' })),\n insideHorizontal: Type.Optional(\n Type.Boolean({ description: 'Hide horizontal borders between rows' })\n ),\n insideVertical: Type.Optional(\n Type.Boolean({ description: 'Hide vertical borders between columns' })\n ),\n },\n {\n description: 'Selectively hide specific borders',\n additionalProperties: false,\n }\n ),\n]);\n\n// Padding - can be a single number or an object with sides\nconst PaddingSchema = Type.Union([\n Type.Number({ minimum: 0, description: 'Padding for all sides in points' }),\n Type.Object(\n {\n bottom: Type.Optional(\n Type.Number({ minimum: 0, description: 'Bottom padding in points' })\n ),\n top: Type.Optional(\n Type.Number({ minimum: 0, description: 'Top padding in points' })\n ),\n right: Type.Optional(\n Type.Number({ minimum: 0, description: 'Right padding in points' })\n ),\n left: Type.Optional(\n Type.Number({ minimum: 0, description: 'Left padding in points' })\n ),\n },\n { additionalProperties: false }\n ),\n]);\n\n// Cell defaults configuration\nconst CellDefaultsSchema = Type.Object(\n {\n color: Type.Optional(HexColorSchema),\n backgroundColor: Type.Optional(HexColorOrTransparentSchema),\n horizontalAlignment: Type.Optional(HorizontalAlignmentSchema),\n verticalAlignment: Type.Optional(VerticalAlignmentSchema),\n font: Type.Optional(FontConfigSchema),\n borderColor: Type.Optional(BorderColorSchema),\n borderSize: Type.Optional(BorderSizeSchema),\n padding: Type.Optional(PaddingSchema),\n height: Type.Optional(\n Type.Number({ minimum: 0, description: 'Cell height in points' })\n ),\n },\n { additionalProperties: false }\n);\n\n/**\n * Build TablePropsSchema with a given cell-content type.\n * Called with `CellContentSchema` for the static export below, and with a\n * live recursive ref at schema-generation time.\n */\nexport function createTablePropsSchema(componentRef: TSchema): TSchema {\n const cellContent = Type.Union([Type.String(), componentRef]);\n\n const cellFields = {\n color: Type.Optional(HexColorSchema),\n backgroundColor: Type.Optional(HexColorOrTransparentSchema),\n horizontalAlignment: Type.Optional(HorizontalAlignmentSchema),\n verticalAlignment: Type.Optional(VerticalAlignmentSchema),\n font: Type.Optional(FontConfigSchema),\n borderColor: Type.Optional(BorderColorSchema),\n borderSize: Type.Optional(BorderSizeSchema),\n padding: Type.Optional(PaddingSchema),\n height: Type.Optional(\n Type.Number({ minimum: 0, description: 'Cell height in points' })\n ),\n comment: Type.Optional(CommentSchema),\n revision: Type.Optional(RevisionSchema),\n };\n\n const headerSchema = Type.Object(\n {\n ...cellFields,\n content: Type.Optional(cellContent),\n },\n { additionalProperties: false }\n );\n\n const cellSchema = Type.Object(\n {\n ...cellFields,\n content: Type.Optional(cellContent),\n },\n { additionalProperties: false }\n );\n\n const columnSchema = Type.Object(\n {\n width: Type.Optional(\n Type.Union([\n Type.Number({\n minimum: 0,\n description:\n 'Column width in points. When set on some columns, remaining columns will automatically share the leftover table space equally. Leave undefined to distribute space evenly among unspecified columns.',\n }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description:\n 'Column width as percentage of available width (e.g., \"40%\")',\n }),\n ])\n ),\n cellDefaults: Type.Optional(CellDefaultsSchema),\n header: Type.Optional(headerSchema),\n cells: Type.Optional(Type.Array(cellSchema)),\n },\n { additionalProperties: false }\n );\n\n return Type.Object(\n {\n borderColor: Type.Optional(BorderColorSchema),\n borderSize: Type.Optional(BorderSizeSchema),\n hideBorders: Type.Optional(HideBordersSchema),\n cellDefaults: Type.Optional(CellDefaultsSchema),\n headerCellDefaults: Type.Optional(CellDefaultsSchema),\n width: Type.Optional(\n Type.Number({\n minimum: 0,\n maximum: 100,\n description: 'Table width in percentage (0-100)',\n })\n ),\n columns: Type.Array(columnSchema, {\n description: 'Table columns with headers and cells',\n minItems: 1,\n }),\n rows: Type.Optional(\n Type.Array(\n Type.Object(\n {\n revision: Type.Optional(RevisionMarkSchema),\n cantSplit: Type.Optional(\n Type.Boolean({\n description: 'Keep this row on one page',\n })\n ),\n tableHeader: Type.Optional(\n Type.Boolean({\n description: 'Repeat this row as a header on each page',\n })\n ),\n },\n { additionalProperties: false }\n ),\n {\n description:\n 'Row-parallel properties, indexed like `columns[].cells`. The model is column-major, so anything that belongs to a whole row lives here.',\n }\n )\n ),\n keepInOnePage: Type.Optional(\n Type.Boolean({\n description:\n 'Keep table rows together on the same page by setting keepNext on all paragraphs',\n })\n ),\n keepNext: Type.Optional(\n Type.Boolean({\n description:\n 'Set keepNext on the last row to keep it connected to the next element. Works independently of keepInOnePage. Defaults to false.',\n })\n ),\n repeatHeaderOnPageBreak: Type.Optional(\n Type.Boolean({\n description:\n 'Repeat the header row on each page when the table spans multiple pages. Defaults to true.',\n default: true,\n })\n ),\n },\n {\n description: 'Table component props with column-based structure',\n additionalProperties: false,\n }\n );\n}\n\n// Static version for validators, type inference, and theme defaults.\nexport const TablePropsSchema = createTablePropsSchema(CellContentSchema);\n\nexport type TableProps = Static<typeof TablePropsSchema>;\n","/**\n * Section Component Schema\n */\n\nimport { Type, Static, TSchema } from '@sinclair/typebox';\nimport { SpacingSchema } from './common';\n\n// Create a function to generate SectionPropsSchema with recursive component reference\nexport const createSectionPropsSchema = (componentRef?: TSchema) =>\n Type.Object(\n {\n meta: Type.Optional(\n Type.Object(\n {\n title: Type.Optional(\n Type.String({\n description:\n 'Authoring label for this section, shown in editors and outlines. Never rendered — add a heading child for a visible title.',\n })\n ),\n },\n {\n additionalProperties: false,\n description: 'Authoring metadata; has no effect on the document.',\n }\n )\n ),\n header: Type.Optional(\n Type.Union([\n Type.Array(componentRef || Type.Any(), {\n description: 'Section header components',\n }),\n Type.Literal('linkToPrevious', {\n description: 'Link header to previous section',\n }),\n ])\n ),\n footer: Type.Optional(\n Type.Union([\n Type.Array(componentRef || Type.Any(), {\n description: 'Section footer components',\n }),\n Type.Literal('linkToPrevious', {\n description: 'Link footer to previous section',\n }),\n ])\n ),\n pageBreak: Type.Optional(\n Type.Boolean({\n description: 'Insert page break before section',\n default: true,\n })\n ),\n spacing: Type.Optional(SpacingSchema),\n page: Type.Optional(\n Type.Object(\n {\n size: Type.Optional(\n Type.Union([\n Type.Literal('A4'),\n Type.Literal('A3'),\n Type.Literal('LETTER'),\n Type.Literal('LEGAL'),\n Type.Object({\n width: Type.Number({ minimum: 0 }),\n height: Type.Number({ minimum: 0 }),\n }),\n ])\n ),\n margins: Type.Optional(\n Type.Object(\n {\n top: Type.Optional(Type.Number({ minimum: 0 })),\n bottom: Type.Optional(Type.Number({ minimum: 0 })),\n left: Type.Optional(Type.Number({ minimum: 0 })),\n right: Type.Optional(Type.Number({ minimum: 0 })),\n header: Type.Optional(Type.Number({ minimum: 0 })),\n footer: Type.Optional(Type.Number({ minimum: 0 })),\n gutter: Type.Optional(Type.Number({ minimum: 0 })),\n },\n {\n additionalProperties: false,\n }\n )\n ),\n },\n {\n description:\n 'Page configuration override for this section (overrides theme page settings)',\n additionalProperties: false,\n }\n )\n ),\n },\n {\n description: 'Section component props',\n additionalProperties: false,\n }\n );\n\nexport const SectionPropsSchema = createSectionPropsSchema();\n\nexport type SectionProps = Static<typeof SectionPropsSchema>;\n","/**\n * Columns Component Schema\n */\n\nimport { Type, Static } from '@sinclair/typebox';\n\n// Single column descriptor\nconst ColumnDescriptorSchema = Type.Object(\n {\n width: Type.Optional(\n Type.Union([\n Type.Number({\n minimum: 1,\n description: 'Column width in points',\n }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description:\n 'Column width as percentage of available width (e.g., \"30%\")',\n }),\n Type.Literal('auto', {\n description:\n 'Auto width: consume remaining space after fixed widths and gaps',\n }),\n ])\n ),\n gap: Type.Optional(\n Type.Union([\n Type.Number({\n minimum: 0,\n description: 'Gap after this column in points',\n }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description:\n 'Gap after this column as percentage of available width (e.g., \"5%\")',\n }),\n ])\n ),\n },\n { additionalProperties: false }\n);\n\nexport const ColumnsPropsSchema = Type.Object(\n {\n columns: Type.Union([\n Type.Number({\n minimum: 1,\n description:\n 'Number of equal-width columns (converter will normalize to array)',\n }),\n Type.Array(ColumnDescriptorSchema, {\n minItems: 1,\n description:\n 'List of columns in order; width and gap can be points, percentages, or auto width',\n }),\n ]),\n gap: Type.Optional(\n Type.Union([\n Type.Number({\n minimum: 0,\n description:\n 'Default gap applied after each column except the last (points)',\n }),\n Type.String({\n pattern: '^\\\\d+(\\\\.\\\\d+)?%$',\n description:\n 'Default gap applied after each column except the last as percentage of available width (e.g., \"5%\")',\n }),\n ])\n ),\n },\n {\n description: 'Columns component props',\n additionalProperties: false,\n }\n);\n\nexport type ColumnsProps = Static<typeof ColumnsPropsSchema>;\n","/**\n * List Component Schema\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport {\n ListSpacingSchema,\n JustifiedAlignmentSchema,\n IndentSchema,\n} from './common';\nimport { HexColorSchema } from '../font';\nimport { RevisionSchema } from './revision';\nimport { CommentSchema } from './comment';\n\n/**\n * Level format options for docx numbering\n * Maps to docx LevelFormat enum\n */\nexport const LevelFormatSchema = Type.Union(\n [\n Type.Literal('decimal'),\n Type.Literal('upperRoman'),\n Type.Literal('lowerRoman'),\n Type.Literal('upperLetter'),\n Type.Literal('lowerLetter'),\n Type.Literal('bullet'),\n Type.Literal('ordinal'),\n Type.Literal('cardinalText'),\n Type.Literal('ordinalText'),\n Type.Literal('hex'),\n Type.Literal('chicago'),\n Type.Literal('ideographDigital'),\n Type.Literal('japaneseCounting'),\n Type.Literal('aiueo'),\n Type.Literal('iroha'),\n Type.Literal('decimalFullWidth'),\n Type.Literal('decimalHalfWidth'),\n Type.Literal('japaneseLegal'),\n Type.Literal('japaneseDigitalTenThousand'),\n Type.Literal('decimalEnclosedCircle'),\n Type.Literal('decimalFullWidth2'),\n Type.Literal('aiueoFullWidth'),\n Type.Literal('irohaFullWidth'),\n Type.Literal('decimalZero'),\n Type.Literal('ganada'),\n Type.Literal('chosung'),\n Type.Literal('decimalEnclosedFullstop'),\n Type.Literal('decimalEnclosedParen'),\n Type.Literal('decimalEnclosedCircleChinese'),\n Type.Literal('ideographEnclosedCircle'),\n Type.Literal('ideographTraditional'),\n Type.Literal('ideographZodiac'),\n Type.Literal('ideographZodiacTraditional'),\n Type.Literal('taiwaneseCounting'),\n Type.Literal('ideographLegalTraditional'),\n Type.Literal('taiwaneseCountingThousand'),\n Type.Literal('taiwaneseDigital'),\n Type.Literal('chineseCounting'),\n Type.Literal('chineseLegalSimplified'),\n Type.Literal('chineseCountingThousand'),\n Type.Literal('koreanDigital'),\n Type.Literal('koreanCounting'),\n Type.Literal('koreanLegal'),\n Type.Literal('koreanDigital2'),\n Type.Literal('vietnameseCounting'),\n Type.Literal('russianLower'),\n Type.Literal('russianUpper'),\n Type.Literal('none'),\n Type.Literal('numberInDash'),\n Type.Literal('hebrew1'),\n Type.Literal('hebrew2'),\n Type.Literal('arabicAlpha'),\n Type.Literal('arabicAbjad'),\n Type.Literal('hindiVowels'),\n Type.Literal('hindiConsonants'),\n Type.Literal('hindiNumbers'),\n Type.Literal('hindiCounting'),\n Type.Literal('thaiLetters'),\n Type.Literal('thaiNumbers'),\n Type.Literal('thaiCounting'),\n ],\n {\n description: 'Number or bullet format for list levels',\n }\n);\n\n/**\n * Font applied to the marker glyph itself (the number or bullet), independent\n * of the list text. Maps to the numbering level's `w:rPr`.\n */\nexport const ListMarkerFontSchema = Type.Object(\n {\n family: Type.Optional(Type.String({ description: 'Font family name' })),\n size: Type.Optional(\n Type.Number({ minimum: 1, description: 'Marker size in points' })\n ),\n color: Type.Optional(HexColorSchema),\n bold: Type.Optional(Type.Boolean({ description: 'Bold marker' })),\n italic: Type.Optional(Type.Boolean({ description: 'Italic marker' })),\n underline: Type.Optional(\n Type.Boolean({ description: 'Underlined marker' })\n ),\n },\n {\n description:\n 'Styling for the number/bullet glyph only. The list text is unaffected.',\n additionalProperties: false,\n }\n);\n\n/**\n * Configuration for a single numbering level\n */\nexport const ListLevelPropsSchema = Type.Object(\n {\n level: Type.Number({\n minimum: 0,\n maximum: 8,\n description: 'Nesting level (0 = root, 1 = first sublevel, etc.)',\n }),\n format: Type.Optional(LevelFormatSchema),\n text: Type.Optional(\n Type.String({\n description:\n 'Number format string (e.g., \"%1.\" for \"1.\", \"%1)\" for \"1)\", custom bullet character for bullet format)',\n })\n ),\n alignment: Type.Optional(\n Type.Union(\n [\n Type.Literal('start'),\n Type.Literal('end'),\n Type.Literal('left'),\n Type.Literal('right'),\n Type.Literal('center'),\n ],\n {\n description: 'Alignment of the numbering/bullet',\n }\n )\n ),\n indent: Type.Optional(IndentSchema),\n start: Type.Optional(\n Type.Number({\n minimum: 1,\n description: 'Starting number for this level (default: 1)',\n })\n ),\n font: Type.Optional(ListMarkerFontSchema),\n },\n {\n description: 'Configuration for a single list level',\n additionalProperties: false,\n }\n);\n\nexport const ListPropsSchema = Type.Object(\n {\n items: Type.Array(\n Type.Union([\n Type.String(),\n Type.Object(\n {\n text: Type.String(),\n level: Type.Optional(\n Type.Number({\n minimum: 0,\n maximum: 8,\n description: 'Nesting level for this item',\n })\n ),\n id: Type.Optional(\n Type.String({\n description:\n 'Bookmark id for this item, targetable by internal links (#id) and cross-references ([@id])',\n })\n ),\n revision: Type.Optional(RevisionSchema),\n },\n { additionalProperties: false }\n ),\n ]),\n {\n description: 'List items (required)',\n minItems: 1,\n }\n ),\n reference: Type.Optional(\n Type.String({\n description:\n 'Unique reference ID for this numbering configuration (auto-generated if not provided)',\n })\n ),\n levels: Type.Optional(\n Type.Array(ListLevelPropsSchema, {\n description: 'Configuration for each nesting level',\n minItems: 1,\n maxItems: 9,\n })\n ),\n // Simplified options for common use cases (when levels not specified)\n format: Type.Optional(\n Type.Union(\n [LevelFormatSchema, Type.Literal('numbered'), Type.Literal('none')],\n {\n description:\n 'Format for level 0 (simplified option when levels not specified)',\n }\n )\n ),\n bullet: Type.Optional(\n Type.String({\n description:\n 'Custom bullet character (simplified option when levels not specified)',\n })\n ),\n start: Type.Optional(\n Type.Number({\n minimum: 1,\n description:\n 'Starting number for level 0. Applies whether or not `levels` is given; a `start` on the level itself wins.',\n })\n ),\n spacing: Type.Optional(ListSpacingSchema),\n alignment: Type.Optional(JustifiedAlignmentSchema),\n indent: Type.Optional(\n Type.Union([Type.Number({ minimum: 0 }), IndentSchema])\n ),\n // Anchored to the list as a whole: the range opens on the first rendered\n // item and closes on the last.\n comment: Type.Optional(CommentSchema),\n },\n {\n description: 'List component props',\n additionalProperties: false,\n }\n);\n\nexport type LevelFormat = Static<typeof LevelFormatSchema>;\nexport type ListMarkerFont = Static<typeof ListMarkerFontSchema>;\nexport type ListLevelProps = Static<typeof ListLevelPropsSchema>;\nexport type ListProps = Static<typeof ListPropsSchema>;\n"],"mappings":";;;;;;;;;;AAUA,SAAS,QAAAA,cAAoB;;;ACN7B,SAAS,QAAAC,aAAoB;;;ACE7B,SAAS,YAAoB;AAOtB,IAAM,kBAAkB,KAAK;AAAA,EAClC,CAAC,KAAK,QAAQ,MAAM,GAAG,KAAK,QAAQ,QAAQ,GAAG,KAAK,QAAQ,OAAO,CAAC;AAAA,EACpE,EAAE,aAAa,yBAAyB;AAC1C;AAEO,IAAM,2BAA2B,KAAK;AAAA,EAC3C;AAAA,IACE,KAAK,QAAQ,MAAM;AAAA,IACnB,KAAK,QAAQ,QAAQ;AAAA,IACrB,KAAK,QAAQ,OAAO;AAAA,IACpB,KAAK,QAAQ,SAAS;AAAA,EACxB;AAAA,EACA,EAAE,aAAa,2CAA2C;AAC5D;AAEO,IAAM,qBAAqB,KAAK;AAAA,EACrC;AAAA,IACE,KAAK,QAAQ,CAAC;AAAA,IACd,KAAK,QAAQ,CAAC;AAAA,IACd,KAAK,QAAQ,CAAC;AAAA,IACd,KAAK,QAAQ,CAAC;AAAA,IACd,KAAK,QAAQ,CAAC;AAAA,IACd,KAAK,QAAQ,CAAC;AAAA,EAChB;AAAA,EACA,EAAE,aAAa,sBAAsB;AACvC;AAEO,IAAM,gBAAgB,KAAK;AAAA,EAChC;AAAA,IACE,QAAQ,KAAK;AAAA,MACX,KAAK,OAAO;AAAA,QACV,SAAS;AAAA,QACT,aAAa;AAAA,MACf,CAAC;AAAA,IACH;AAAA,IACA,OAAO,KAAK;AAAA,MACV,KAAK,OAAO;AAAA,QACV,SAAS;AAAA,QACT,aAAa;AAAA,MACf,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EACA;AAAA,IACE,aAAa;AAAA,IACb,sBAAsB;AAAA,EACx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M,mCAAmCA,OAAK;AAAA,EACnDA,OAAK,KAAK,sBAAsB,kBAAkB;AACpD;AACO,IAAM,+BAA+BA,OAAK,QAAQ,gBAAgB;AAClE,IAAM,mCACXA,OAAK,QAAQ,oBAAoB;AAc5B,IAAM,+BAA+BA,OAAK;AAAA,EAC/CA,OAAK,KAAK,kBAAkB,CAAC,MAAM,CAAC;AACtC;AACO,IAAM,iCAAiCA,OAAK,QAAQ,kBAAkB;AACtE,IAAM,iCAAiCA,OAAK,QAAQ,kBAAkB;AACtE,IAAM,8BAA8BA,OAAK;AAAA,EAC9CA,OAAK,KAAK,iBAAiB,kBAAkB;AAC/C;AAEO,IAAM,0BAA0BA,OAAK;AAAA,EAC1C;AAAA,IACE,SAASA,OAAK,SAAS,8BAA8B;AAAA,IACrD,WAAWA,OAAK,SAAS,gCAAgC;AAAA,IACzD,OAAOA,OAAK,SAAS,4BAA4B;AAAA,IACjD,WAAWA,OAAK,SAAS,gCAAgC;AAAA,IACzD,OAAOA,OAAK,SAAS,4BAA4B;AAAA,IACjD,SAASA,OAAK,SAAS,8BAA8B;AAAA,IACrD,SAASA,OAAK,SAAS,8BAA8B;AAAA,IACrD,MAAMA,OAAK,SAAS,2BAA2B;AAAA,EACjD;AAAA,EACA,EAAE,sBAAsB,KAAK;AAAA;AAC/B;","names":["Type","Type","Type","Type","Type","Type","Type","Type","AlignmentSchema","Type","Type","Type","Type","Type","Type","Type","Type","Type","Type","Type","Type"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ComponentDefinitionSchema,
|
|
3
3
|
StandardComponentDefinitionSchema
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-K2LA6WCD.js";
|
|
5
5
|
import {
|
|
6
6
|
CustomComponentDefinitionSchema
|
|
7
7
|
} from "./chunk-7GGTZ4TA.js";
|
|
8
8
|
import {
|
|
9
9
|
ReportPropsSchema,
|
|
10
10
|
STANDARD_COMPONENTS_REGISTRY
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WOFU72HH.js";
|
|
12
12
|
|
|
13
13
|
// src/validation/unified/error-transformer.ts
|
|
14
14
|
import {
|
|
@@ -393,6 +393,47 @@ function collectNoteRevisionConflicts(data) {
|
|
|
393
393
|
visit(data, "");
|
|
394
394
|
return errors;
|
|
395
395
|
}
|
|
396
|
+
var UNDASHABLE_BORDER_STYLES = /* @__PURE__ */ new Set(["dashed", "dotted", "double"]);
|
|
397
|
+
function collectTextBoxShapeConflicts(data) {
|
|
398
|
+
const errors = [];
|
|
399
|
+
const visit = (node, path) => {
|
|
400
|
+
if (Array.isArray(node)) {
|
|
401
|
+
node.forEach((item, i) => visit(item, `${path}/${i}`));
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
if (!node || typeof node !== "object") return;
|
|
405
|
+
if (node.name === "text-box" && node.props?.renderAs === "shape") {
|
|
406
|
+
const missing = ["width", "height"].filter(
|
|
407
|
+
(axis) => node.props[axis] === void 0
|
|
408
|
+
);
|
|
409
|
+
if (missing.length > 0) {
|
|
410
|
+
errors.push({
|
|
411
|
+
path: `${path}/props/${missing[0]}`,
|
|
412
|
+
message: `A text-box with renderAs "shape" requires ${missing.join(" and ")}: a shape has no autofit, so its size cannot be derived from its content. Give it an explicit size, or use renderAs "table", which grows to fit.`,
|
|
413
|
+
code: "required"
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
const border = node.props.style?.border;
|
|
417
|
+
if (border && typeof border === "object") {
|
|
418
|
+
for (const side of ["top", "right", "bottom", "left"]) {
|
|
419
|
+
const style = border[side]?.style;
|
|
420
|
+
if (typeof style === "string" && UNDASHABLE_BORDER_STYLES.has(style)) {
|
|
421
|
+
errors.push({
|
|
422
|
+
path: `${path}/props/style/border/${side}/style`,
|
|
423
|
+
message: `A text-box with renderAs "shape" cannot draw a "${style}" border: a shape outline carries no dash pattern. Use "solid", or use renderAs "table", which draws every border style.`,
|
|
424
|
+
code: "unsupported_value"
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
for (const key of Object.keys(node)) {
|
|
431
|
+
visit(node[key], `${path}/${key}`);
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
visit(data, "");
|
|
435
|
+
return errors;
|
|
436
|
+
}
|
|
396
437
|
function deepValidateDocument(data, opts = {}) {
|
|
397
438
|
const allErrors = [];
|
|
398
439
|
if (!data || typeof data !== "object") {
|
|
@@ -746,6 +787,33 @@ function getValidationSummary(result) {
|
|
|
746
787
|
// src/validation/unified/document-validator.ts
|
|
747
788
|
import { extractStandardComponentNames } from "@json-to-office/shared";
|
|
748
789
|
var JsonComponentDefinitionSchema = ComponentDefinitionSchema;
|
|
790
|
+
var SEMANTIC_COLLECTORS = [
|
|
791
|
+
{
|
|
792
|
+
// A multi-source image passes the structural check: each source is its own
|
|
793
|
+
// optional field.
|
|
794
|
+
why: "image source mutual-exclusivity",
|
|
795
|
+
collect: collectImageSourceConflicts
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
why: "indent hanging/firstLine mutual-exclusivity",
|
|
799
|
+
collect: collectIndentConflicts
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
// Tracked-change text renders literally, so a note marker inside it never
|
|
803
|
+
// resolves and docx cannot express the pair anyway.
|
|
804
|
+
why: "notes on a revised paragraph",
|
|
805
|
+
collect: collectNoteRevisionConflicts
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
// A shape has no autofit and its outline carries no dash pattern, so the
|
|
809
|
+
// request could only ever come back as a table.
|
|
810
|
+
why: "a text box asking for a shape rendering a shape cannot give it",
|
|
811
|
+
collect: collectTextBoxShapeConflicts
|
|
812
|
+
}
|
|
813
|
+
];
|
|
814
|
+
function collectSemanticConflicts(document) {
|
|
815
|
+
return SEMANTIC_COLLECTORS.flatMap(({ collect }) => collect(document));
|
|
816
|
+
}
|
|
749
817
|
function validateDocument(data, options) {
|
|
750
818
|
const result = validateAgainstSchema(
|
|
751
819
|
ComponentDefinitionSchema,
|
|
@@ -763,19 +831,9 @@ function validateDocument(data, options) {
|
|
|
763
831
|
finalValid = true;
|
|
764
832
|
}
|
|
765
833
|
}
|
|
766
|
-
const
|
|
767
|
-
if (
|
|
768
|
-
finalErrors = [...finalErrors, ...
|
|
769
|
-
finalValid = false;
|
|
770
|
-
}
|
|
771
|
-
const indentConflicts = collectIndentConflicts(data);
|
|
772
|
-
if (indentConflicts.length > 0) {
|
|
773
|
-
finalErrors = [...finalErrors, ...indentConflicts];
|
|
774
|
-
finalValid = false;
|
|
775
|
-
}
|
|
776
|
-
const noteRevisionConflicts = collectNoteRevisionConflicts(data);
|
|
777
|
-
if (noteRevisionConflicts.length > 0) {
|
|
778
|
-
finalErrors = [...finalErrors, ...noteRevisionConflicts];
|
|
834
|
+
const semanticConflicts = collectSemanticConflicts(data);
|
|
835
|
+
if (semanticConflicts.length > 0) {
|
|
836
|
+
finalErrors = [...finalErrors, ...semanticConflicts];
|
|
779
837
|
finalValid = false;
|
|
780
838
|
}
|
|
781
839
|
const resolvedData = result.data ?? (finalValid ? data : void 0);
|
|
@@ -814,19 +872,9 @@ function validateJsonDocument(jsonInput, options) {
|
|
|
814
872
|
finalValid = true;
|
|
815
873
|
}
|
|
816
874
|
}
|
|
817
|
-
const
|
|
818
|
-
if (
|
|
819
|
-
finalErrors = [...finalErrors, ...
|
|
820
|
-
finalValid = false;
|
|
821
|
-
}
|
|
822
|
-
const indentConflicts = collectIndentConflicts(result.parsed);
|
|
823
|
-
if (indentConflicts.length > 0) {
|
|
824
|
-
finalErrors = [...finalErrors, ...indentConflicts];
|
|
825
|
-
finalValid = false;
|
|
826
|
-
}
|
|
827
|
-
const noteRevisionConflicts = collectNoteRevisionConflicts(result.parsed);
|
|
828
|
-
if (noteRevisionConflicts.length > 0) {
|
|
829
|
-
finalErrors = [...finalErrors, ...noteRevisionConflicts];
|
|
875
|
+
const semanticConflicts = collectSemanticConflicts(result.parsed);
|
|
876
|
+
if (semanticConflicts.length > 0) {
|
|
877
|
+
finalErrors = [...finalErrors, ...semanticConflicts];
|
|
830
878
|
finalValid = false;
|
|
831
879
|
}
|
|
832
880
|
const resolvedData = result.data ?? (finalValid ? result.parsed : void 0);
|
|
@@ -884,6 +932,7 @@ export {
|
|
|
884
932
|
transformValueErrors,
|
|
885
933
|
collectIndentConflicts,
|
|
886
934
|
collectNoteRevisionConflicts,
|
|
935
|
+
collectTextBoxShapeConflicts,
|
|
887
936
|
deepValidateDocument,
|
|
888
937
|
comprehensiveValidateDocument,
|
|
889
938
|
validateAgainstSchema,
|
|
@@ -903,4 +952,4 @@ export {
|
|
|
903
952
|
validateJsonComponent,
|
|
904
953
|
validateDocumentWithSchema
|
|
905
954
|
};
|
|
906
|
-
//# sourceMappingURL=chunk-
|
|
955
|
+
//# sourceMappingURL=chunk-DYTUITUL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/validation/unified/error-transformer.ts","../src/validation/unified/deep-validator.ts","../src/validation/unified/base-validator.ts","../src/validation/unified/document-validator.ts"],"sourcesContent":["/**\n * Unified error transformation utilities\n * Converts TypeBox ValueError objects to standardized ValidationError format\n */\n\nimport type { ValueError } from '@sinclair/typebox/value';\nimport type { ValidationError } from '@json-to-office/shared';\nimport { ReportPropsSchema } from '../../schemas/components/report';\nimport {\n isObjectSchema,\n getObjectSchemaPropertyNames,\n getLiteralValue,\n type ErrorFormatterConfig,\n createErrorConfig,\n formatErrorMessage,\n ERROR_EMOJIS,\n} from '@json-to-office/shared';\n\n/**\n * Generate enhanced error message based on error type and context\n */\nfunction generateEnhancedMessage(\n error: ValueError,\n _config: Required<ErrorFormatterConfig>\n): string {\n const typeStr = String(error.type || '');\n const path = error.path || 'root';\n\n // Handle union errors specially - these are the most common and least helpful\n if (typeStr === '62' || typeStr === 'union') {\n return generateUnionErrorMessage(error);\n }\n\n // Handle additional properties error\n if (error.message?.includes('additionalProperties')) {\n return generateAdditionalPropertiesMessage(error);\n }\n\n // Handle missing required properties\n if (error.message?.includes('Required property')) {\n return generateRequiredPropertyMessage(error);\n }\n\n // Handle type mismatches\n if (\n typeStr === 'string' ||\n typeStr === 'number' ||\n typeStr === 'boolean' ||\n typeStr === 'array' ||\n typeStr === 'object'\n ) {\n return generateTypeMismatchMessage(error);\n }\n\n // Handle literal value errors\n if (typeStr === 'literal') {\n return generateLiteralErrorMessage(error);\n }\n\n // Handle pattern/regex errors\n if (typeStr === 'pattern' || typeStr === 'RegExp') {\n return generatePatternErrorMessage(error);\n }\n\n // Default to original message with some context\n return `At ${path}: ${error.message}`;\n}\n\n/**\n * Generate message for union validation errors\n */\nfunction generateUnionErrorMessage(error: ValueError): string {\n const path = error.path || 'root';\n const value = error.value;\n\n // Try to determine what the user was attempting\n if (path === 'root' || path === '/' || path === '/jsonDefinition') {\n // Root level or jsonDefinition union error - likely a document type issue\n if (value && typeof value === 'object') {\n if ('name' in value) {\n const name = value.name;\n if (name === 'docx') {\n return 'Document structure appears valid but contains invalid component configurations. Check each component for errors.';\n }\n return `Unknown document name '${name}'. Expected 'docx'.`;\n }\n\n // Missing name field\n const valueAny = value as Record<string, unknown>;\n if ('children' in value && Array.isArray(valueAny.children)) {\n return 'Document is missing required \\'name\\' field. Add \"name\": \"docx\" at the root level.';\n }\n\n // Check if it might be a theme\n if ('name' in value || 'styles' in value) {\n return 'This appears to be a theme configuration. Use --type theme or ensure proper document structure.';\n }\n }\n return 'Invalid document structure. Expected a document with name=\"docx\" or a theme configuration.';\n }\n\n // Component-level union error\n if (path.includes('/children/')) {\n if (value && typeof value === 'object' && 'name' in value) {\n const componentType = (value as any).name;\n return `Invalid component configuration for type '${componentType}'. Check that all required fields are present and correctly formatted.`;\n }\n return 'Invalid component structure. Each component must have a \"name\" field and valid configuration.';\n }\n\n // Default union error message\n return `Value at ${path} doesn't match any of the expected formats. Check the structure and required fields.`;\n}\n\n/**\n * Generate message for additional properties errors\n */\nfunction generateAdditionalPropertiesMessage(error: ValueError): string {\n const path = error.path || 'root';\n const value = error.value;\n\n if (typeof value === 'object' && value !== null) {\n // Try to identify the unknown properties\n const schema = error.schema;\n if (schema && isObjectSchema(schema)) {\n const knownProps = getObjectSchemaPropertyNames(schema);\n const actualProps = Object.keys(value);\n const unknownProps = actualProps.filter((p) => !knownProps.includes(p));\n\n if (unknownProps.length > 0) {\n return (\n `Unknown properties at ${path}: ${unknownProps.join(', ')}. ` +\n `Allowed properties are: ${knownProps.join(', ')}`\n );\n }\n }\n }\n\n return `Additional properties not allowed at ${path}. Check for typos or unsupported fields.`;\n}\n\n/**\n * Generate message for required property errors\n */\nfunction generateRequiredPropertyMessage(error: ValueError): string {\n const path = error.path || 'root';\n const match = error.message?.match(/Required property '([^']+)'/);\n\n if (match) {\n const propName = match[1];\n return `Missing required field '${propName}' at ${path}. This field is mandatory for this configuration.`;\n }\n\n return `Missing required property at ${path}. Check that all mandatory fields are present.`;\n}\n\n/**\n * Generate message for type mismatch errors\n */\nfunction generateTypeMismatchMessage(error: ValueError): string {\n const path = error.path || 'root';\n const expectedType = String(error.type);\n const actualType = Array.isArray(error.value) ? 'array' : typeof error.value;\n\n // Provide context-specific messages\n if (path.includes('alignment')) {\n return `Invalid alignment value at ${path}. Expected one of: left, center, right, justify`;\n }\n\n if (path.includes('color')) {\n return `Invalid color value at ${path}. Use hex format (#RRGGBB), rgb(r,g,b), or a named color`;\n }\n\n if (path.includes('fontSize') || path.includes('size')) {\n return `Invalid size value at ${path}. Expected a number (in points)`;\n }\n\n if (\n path.includes('margin') ||\n path.includes('padding') ||\n path.includes('spacing')\n ) {\n return `Invalid spacing value at ${path}. Expected a number or spacing object with top/bottom/left/right`;\n }\n\n return `Type mismatch at ${path}: Expected ${expectedType} but got ${actualType}`;\n}\n\n/**\n * Generate message for literal value errors\n */\nfunction generateLiteralErrorMessage(error: ValueError): string {\n const path = error.path || 'root';\n const expected = error.schema\n ? JSON.stringify(getLiteralValue(error.schema))\n : 'specific value';\n const actual = JSON.stringify(error.value);\n\n return `Invalid value at ${path}: Expected exactly ${expected} but got ${actual}`;\n}\n\n/**\n * Generate message for pattern/regex errors\n */\nfunction generatePatternErrorMessage(error: ValueError): string {\n const path = error.path || 'root';\n\n // Try to provide helpful context based on the path\n if (path.includes('email')) {\n return `Invalid email format at ${path}. Use format: user@example.com`;\n }\n\n if (path.includes('url') || path.includes('link')) {\n return `Invalid URL format at ${path}. Use format: https://example.com`;\n }\n\n if (path.includes('date')) {\n return `Invalid date format at ${path}. Use ISO format: YYYY-MM-DD`;\n }\n\n if (path.includes('phone')) {\n return `Invalid phone number format at ${path}`;\n }\n\n return `Value at ${path} doesn't match the required pattern`;\n}\n\n/**\n * Transform TypeBox ValueError to standardized ValidationError\n */\nexport function transformValueError(\n error: ValueError,\n jsonString?: string,\n config?: ErrorFormatterConfig\n): ValidationError {\n const formatterConfig = createErrorConfig(config);\n\n // Generate enhanced message based on error type\n const enhancedMessage = generateEnhancedMessage(error, formatterConfig);\n\n const baseError: ValidationError = {\n path: error.path || 'root',\n message: formatErrorMessage(\n enhancedMessage || error.message,\n formatterConfig\n ),\n code: String(error.type || 'validation_error'),\n value: error.value,\n };\n\n // Add suggestion if available and configured\n if (formatterConfig.includeSuggestions) {\n const suggestion = getSuggestion(error, formatterConfig);\n if (suggestion) {\n baseError.suggestion = formatErrorMessage(suggestion, formatterConfig);\n }\n }\n\n // Calculate line and column if JSON string is provided\n if (jsonString && error.path) {\n const position = calculatePosition(jsonString, error.path);\n if (position) {\n baseError.line = position.line;\n baseError.column = position.column;\n }\n }\n\n return baseError;\n}\n\n/**\n * Transform multiple TypeBox errors to ValidationError array\n * Enhanced to collect ALL errors, not just stopping at union failures\n */\nexport function transformValueErrors(\n errors: ValueError[],\n options?: {\n jsonString?: string;\n maxErrors?: number;\n }\n): ValidationError[] {\n const maxErrors = options?.maxErrors ?? Number.MAX_SAFE_INTEGER;\n const result: ValidationError[] = [];\n const seenPaths = new Set<string>();\n\n // Collect all errors, but avoid duplicates at the same path\n for (const error of errors) {\n if (result.length >= maxErrors) break;\n\n // Create a unique key for this error based on path and type\n const errorKey = `${error.path}:${error.type}`;\n\n // Skip if we've already seen an error at this exact path and type\n // This helps avoid duplicate union errors while still showing all unique issues\n if (!seenPaths.has(errorKey)) {\n seenPaths.add(errorKey);\n result.push(transformValueError(error, options?.jsonString, undefined));\n }\n }\n\n return result;\n}\n\n/**\n * Calculate line and column position in JSON string\n */\nexport function calculatePosition(\n jsonString: string,\n path: string\n): { line: number; column: number } | null {\n try {\n // Convert path like \"/children/0/props/title\" to searchable parts\n const pathParts = path.split('/').filter(Boolean);\n if (pathParts.length === 0) {\n return { line: 1, column: 1 };\n }\n\n // Try to find the last part of the path in the JSON\n const lastPart = pathParts[pathParts.length - 1];\n const searchPattern = `\"${lastPart}\"`;\n const index = jsonString.indexOf(searchPattern);\n\n if (index === -1) {\n // Try to find just the value if it's a property name\n return { line: 1, column: 1 };\n }\n\n // Calculate line and column from index\n const beforeError = jsonString.substring(0, index);\n const lines = beforeError.split('\\n');\n const line = lines.length;\n const column = lines[lines.length - 1].length + 1;\n\n return { line, column };\n } catch {\n return null;\n }\n}\n\n/**\n * Get helpful suggestion based on error type and context\n */\nfunction getSuggestion(\n error: ValueError,\n config: Required<ErrorFormatterConfig>\n): string | undefined {\n const { type, path, value } = error;\n const typeStr = String(type);\n\n // Enhanced suggestions for union errors\n if (typeStr === '62' || typeStr === 'union') {\n if (path === 'root' || path === '/') {\n if (value && typeof value === 'object') {\n if (!('name' in value)) {\n const msg = 'Add a \"name\" field with value \"docx\" for documents';\n return config.includeEmojis ? `${ERROR_EMOJIS.FIX} ${msg}` : msg;\n }\n if ('props' in value && typeof value.props === 'object') {\n const knownFields = getObjectSchemaPropertyNames(ReportPropsSchema);\n return `Review the props section for unsupported fields. Allowed fields: ${knownFields.join(', ')}`;\n }\n }\n return 'Ensure the document has proper structure: { \"name\": \"docx\", \"props\": {...}, \"children\": [...] }';\n }\n if (path?.includes('/children/')) {\n return 'Check that the component has a valid \"name\" and all required fields for that component type';\n }\n return 'Review the structure and ensure all required fields are present with correct types';\n }\n\n // Suggestions for additional properties errors\n if (error.message?.includes('additionalProperties')) {\n return 'Remove any unknown or unsupported fields. Check documentation for allowed properties.';\n }\n\n // Suggestions for required properties\n if (error.message?.includes('Required property')) {\n return 'Add the missing required field to fix this error';\n }\n\n // Type-specific suggestions\n if (typeStr === 'string') {\n if (path?.includes('alignment')) {\n return 'Use one of: left, center, right, justify';\n }\n if (path?.includes('color')) {\n return 'Use a valid color format (hex: #RRGGBB, rgb: rgb(r,g,b), or named color)';\n }\n return 'Provide a text string value';\n }\n\n if (typeStr === 'number') {\n if (path?.includes('fontSize') || path?.includes('size')) {\n return 'Use a number in points (e.g., 12, 14, 16)';\n }\n if (path?.includes('margin') || path?.includes('padding')) {\n return 'Use a number for spacing in points';\n }\n return 'Provide a numeric value';\n }\n\n if (typeStr === 'boolean') {\n return 'Use true or false (without quotes)';\n }\n\n if (typeStr === 'array') {\n if (path?.includes('children')) {\n return 'Provide an array of component objects, each with a \"name\" field';\n }\n return 'Provide an array/list of values using square brackets []';\n }\n\n if (typeStr === 'object') {\n return 'Provide an object with key-value pairs using curly braces {}';\n }\n\n if (typeStr === 'literal') {\n const expected = error.schema\n ? JSON.stringify(getLiteralValue(error.schema))\n : 'specific value';\n return `Use exactly this value: ${expected}`;\n }\n\n if (typeStr === 'pattern' || typeStr === 'RegExp') {\n if (path?.includes('email')) {\n return 'Use valid email format: user@example.com';\n }\n if (path?.includes('url')) {\n return 'Use valid URL format: https://example.com';\n }\n if (path?.includes('date')) {\n return 'Use ISO date format: YYYY-MM-DD';\n }\n return 'Ensure the value matches the required format';\n }\n\n // Path-based suggestions\n if (path?.includes('name') || path?.includes('type')) {\n return 'Use a valid component name: docx, section, columns, heading, paragraph, image, statistic, table, list, toc, text-box, highcharts, or visual';\n }\n\n return undefined;\n}\n\n/**\n * Format validation errors as a summary string\n */\nexport function formatErrorSummary(errors: ValidationError[]): string {\n if (errors.length === 0) return 'No errors';\n\n if (errors.length === 1) {\n return errors[0].message;\n }\n\n const summary = errors\n .slice(0, 3)\n .map((e) => `${e.path}: ${e.message}`)\n .join(', ');\n\n if (errors.length > 3) {\n return `${summary} and ${errors.length - 3} more...`;\n }\n\n return summary;\n}\n\n/**\n * Group errors by path for better reporting\n */\nexport function groupErrorsByPath(\n errors: ValidationError[]\n): Map<string, ValidationError[]> {\n const grouped = new Map<string, ValidationError[]>();\n\n for (const error of errors) {\n const path = error.path || 'root';\n const group = grouped.get(path) || [];\n group.push(error);\n grouped.set(path, group);\n }\n\n return grouped;\n}\n\n/**\n * Create a JSON parse error\n */\nexport function createJsonParseError(\n error: Error,\n jsonString: string\n): ValidationError {\n // Try to extract position from error message\n const match = error.message.match(/position (\\d+)/);\n const position = match ? parseInt(match[1], 10) : 0;\n\n let line = 1;\n let column = 1;\n\n if (position > 0) {\n const lines = jsonString.substring(0, position).split('\\n');\n line = lines.length;\n column = lines[lines.length - 1].length + 1;\n }\n\n return {\n path: 'root',\n message: `JSON Parse Error: ${error.message}`,\n code: 'json_parse_error',\n line,\n column,\n suggestion: 'Check for missing commas, quotes, or brackets',\n };\n}\n","/**\n * Deep validation utilities for collecting ALL errors in nested structures\n * This bypasses TypeBox's union short-circuiting to provide comprehensive error reporting\n */\n\nimport { Value } from '@sinclair/typebox/value';\nimport type { TSchema } from '@sinclair/typebox';\nimport type { ValidationError } from '@json-to-office/shared';\nimport { STANDARD_COMPONENTS_REGISTRY } from '../../schemas/component-registry';\nimport { CustomComponentDefinitionSchema } from '../../schemas/custom-components';\nimport { transformValueErrors } from './error-transformer';\n\n// Map of component names to their props schemas, sourced from the registry.\n// This stays in sync as new standard components are added, so the document\n// root ('docx') and every standard child component are recognized here.\nconst COMPONENT_SCHEMAS: Record<string, TSchema> = Object.fromEntries([\n ...STANDARD_COMPONENTS_REGISTRY.map((c) => [c.name, c.propsSchema]),\n ['custom', CustomComponentDefinitionSchema],\n]);\n\n// Root component names that may appear at the top of a document.\nconst ROOT_COMPONENT_NAMES = new Set(\n STANDARD_COMPONENTS_REGISTRY.filter((c) =>\n Boolean(c.special?.hasSchemaField)\n ).map((c) => c.name)\n);\n\n/**\n * Options that tune deep validation.\n *\n * `knownCustomNames` — names of registered plugin components. The deep\n * validator neither flags these as \"unknown component\" nor validates their\n * props here; the plugin layer validates custom props version-aware separately.\n *\n * `allowUnknownFields` — when true, unknown properties are stripped before the\n * per-component check instead of being rejected. The escape hatch for callers\n * migrating onto strict schemas.\n */\nexport interface DeepValidateOptions {\n knownCustomNames?: Set<string>;\n allowUnknownFields?: boolean;\n}\n\n// Image source fields that are mutually exclusive: exactly one may be set.\nconst IMAGE_SOURCE_FIELDS = ['path', 'base64', 'svg'] as const;\n\n/**\n * Names of the image source fields that carry a non-empty value on a props object.\n */\nexport function presentImageSources(props: unknown): string[] {\n if (!props || typeof props !== 'object') return [];\n const p = props as Record<string, unknown>;\n return IMAGE_SOURCE_FIELDS.filter((f) => {\n const v = p[f];\n return typeof v === 'string' && v.trim().length > 0;\n });\n}\n\n/**\n * Collect \"more than one image source\" conflicts anywhere in a document.\n *\n * `path`, `base64`, and `svg` are mutually exclusive on the image component, but\n * all three are optional fields on a single object schema — so a multi-source\n * payload passes TypeBox's structural check and would otherwise be silently\n * resolved by runtime precedence (svg > base64 > path). This walk runs\n * unconditionally and rejects such payloads. It traverses every nested value, so\n * images inside columns, table cells, text boxes, headers/footers, and sections\n * are all covered regardless of container shape.\n */\nexport function collectImageSourceConflicts(data: unknown): ValidationError[] {\n const errors: ValidationError[] = [];\n\n const visit = (node: any, path: string): void => {\n if (Array.isArray(node)) {\n node.forEach((item, i) => visit(item, `${path}/${i}`));\n return;\n }\n if (!node || typeof node !== 'object') return;\n\n if (node.name === 'image') {\n const present = presentImageSources(node.props);\n if (present.length > 1) {\n errors.push({\n path: `${path}/props`,\n message: `Image component accepts only one source, but found ${present\n .map((f) => `\"${f}\"`)\n .join(', ')}. Use exactly one of \"path\", \"base64\", or \"svg\".`,\n code: 'mutually_exclusive',\n });\n }\n }\n\n for (const key of Object.keys(node)) {\n visit(node[key], `${path}/${key}`);\n }\n };\n\n visit(data, '');\n return errors;\n}\n\n// Components that accept a paragraph-style `indent` prop with the mutually\n// exclusive hanging/firstLine pair.\nconst INDENT_COMPONENT_NAMES = new Set(['paragraph', 'heading']);\n\n/**\n * Collect \"hanging and firstLine both set\" indent conflicts anywhere in a\n * document.\n *\n * `hanging` and `firstLine` are mutually exclusive on `props.indent` (they both\n * map to the same w:ind axis — Word keeps only one), but each is an optional\n * field on a single object schema, so a payload carrying both passes TypeBox's\n * structural check. Like the image-source walk above, this runs unconditionally\n * and traverses every nested value, so paragraphs inside columns, table cells,\n * text boxes, headers/footers, and sections are all covered.\n */\nexport function collectIndentConflicts(data: unknown): ValidationError[] {\n const errors: ValidationError[] = [];\n\n const visit = (node: any, path: string): void => {\n if (Array.isArray(node)) {\n node.forEach((item, i) => visit(item, `${path}/${i}`));\n return;\n }\n if (!node || typeof node !== 'object') return;\n\n if (INDENT_COMPONENT_NAMES.has(node.name)) {\n const indent = node.props?.indent;\n if (\n indent &&\n typeof indent === 'object' &&\n indent.hanging !== undefined &&\n indent.firstLine !== undefined\n ) {\n errors.push({\n path: `${path}/props/indent`,\n message:\n 'Indent accepts either \"hanging\" or \"firstLine\", not both. Use exactly one of the two.',\n code: 'mutually_exclusive',\n });\n }\n }\n\n for (const key of Object.keys(node)) {\n visit(node[key], `${path}/${key}`);\n }\n };\n\n visit(data, '');\n return errors;\n}\n\n/**\n * Collect \"notes declared on a revised paragraph\" conflicts anywhere in a\n * document.\n *\n * `revision` renders a paragraph's text from its segments as literal runs, so a\n * `[^id]` marker inside them never resolves and the declared note body is never\n * written. The combination is not expressible either: `InsertedTextRun` and\n * `DeletedTextRun` wrap exactly one `TextRun` built from their own options, so\n * `docx` offers no way to put a footnote reference inside `w:ins` / `w:del`\n * without reaching past its public API.\n *\n * Each half is an independent optional field, so a payload carrying both passes\n * TypeBox's structural check. Like the image-source and indent walks above,\n * this runs unconditionally and traverses every nested value, so paragraphs\n * inside columns, table cells, text boxes, headers/footers and sections are all\n * covered.\n */\nexport function collectNoteRevisionConflicts(data: unknown): ValidationError[] {\n const errors: ValidationError[] = [];\n\n const visit = (node: any, path: string): void => {\n if (Array.isArray(node)) {\n node.forEach((item, i) => visit(item, `${path}/${i}`));\n return;\n }\n if (!node || typeof node !== 'object') return;\n\n // A paragraph revised directly, or a table cell whose own revision drives\n // the runs of the paragraph inside it — both render the text from segments,\n // so neither can resolve a marker.\n const revisedNotes: { notes: unknown; path: string }[] = [];\n if (node.name === 'paragraph' && node.props?.revision) {\n for (const kind of ['footnotes', 'endnotes'] as const) {\n revisedNotes.push({\n notes: node.props[kind],\n path: `${path}/props/${kind}`,\n });\n }\n }\n if (node.revision && node.content?.name === 'paragraph') {\n for (const kind of ['footnotes', 'endnotes'] as const) {\n revisedNotes.push({\n notes: node.content.props?.[kind],\n path: `${path}/content/props/${kind}`,\n });\n }\n }\n\n for (const { notes, path: notesPath } of revisedNotes) {\n if (Array.isArray(notes) && notes.length > 0) {\n const kind = notesPath.endsWith('endnotes') ? 'endnotes' : 'footnotes';\n errors.push({\n path: notesPath,\n message:\n `\"revision\" and \"${kind}\" cannot apply to the same text. Tracked-change ` +\n 'text renders literally, so note markers inside it are not resolved and the ' +\n 'note bodies would be dropped. Move the notes to text without a revision.',\n code: 'mutually_exclusive',\n });\n }\n }\n\n for (const key of Object.keys(node)) {\n visit(node[key], `${path}/${key}`);\n }\n };\n\n visit(data, '');\n return errors;\n}\n\n/**\n * Collect `text-box` requests for a shape rendering that a shape cannot honour,\n * anywhere in a document.\n *\n * `renderAs: 'shape'` emits a WPS DrawingML shape, and two of its limits are\n * decidable from the props alone:\n *\n * - **Size.** A shape carries an absolute extent and has no autofit, so a box\n * without both `width` and `height` has no size to render at.\n * - **Border style.** docx's outline options carry width, cap, compound and\n * fill but no `a:prstDash`, so a dash pattern cannot be expressed at all; the\n * `compoundLine` that could stand in for `double` is emitted as the enum key\n * (`cmpd=\"DOUBLE\"`) rather than the OOXML value.\n *\n * Both are independently optional fields, so the combination passes TypeBox's\n * structural check. Reporting them here rather than warning at render time puts\n * the fault where the author can fix it — the renderer's own guards degrade to\n * the table rendering, which is silent in an editor that only shows the result.\n *\n * Like the walks above this runs unconditionally over every nested value, so a\n * text box inside columns, a table cell, a header/footer or another text box is\n * covered too. The third render-time fallback — content that renders as a table\n * rather than a paragraph — is deliberately absent: it depends on what the\n * children render to, which no static walk can know.\n */\nconst UNDASHABLE_BORDER_STYLES = new Set(['dashed', 'dotted', 'double']);\n\nexport function collectTextBoxShapeConflicts(data: unknown): ValidationError[] {\n const errors: ValidationError[] = [];\n\n const visit = (node: any, path: string): void => {\n if (Array.isArray(node)) {\n node.forEach((item, i) => visit(item, `${path}/${i}`));\n return;\n }\n if (!node || typeof node !== 'object') return;\n\n if (node.name === 'text-box' && node.props?.renderAs === 'shape') {\n const missing = (['width', 'height'] as const).filter(\n (axis) => node.props[axis] === undefined\n );\n if (missing.length > 0) {\n errors.push({\n path: `${path}/props/${missing[0]}`,\n message:\n `A text-box with renderAs \"shape\" requires ${missing.join(' and ')}: a shape ` +\n 'has no autofit, so its size cannot be derived from its content. Give it an ' +\n 'explicit size, or use renderAs \"table\", which grows to fit.',\n code: 'required',\n });\n }\n\n const border = node.props.style?.border;\n if (border && typeof border === 'object') {\n for (const side of ['top', 'right', 'bottom', 'left'] as const) {\n const style = border[side]?.style;\n if (\n typeof style === 'string' &&\n UNDASHABLE_BORDER_STYLES.has(style)\n ) {\n errors.push({\n path: `${path}/props/style/border/${side}/style`,\n message:\n `A text-box with renderAs \"shape\" cannot draw a \"${style}\" border: a shape ` +\n 'outline carries no dash pattern. Use \"solid\", or use renderAs \"table\", ' +\n 'which draws every border style.',\n code: 'unsupported_value',\n });\n }\n }\n }\n }\n\n for (const key of Object.keys(node)) {\n visit(node[key], `${path}/${key}`);\n }\n };\n\n visit(data, '');\n return errors;\n}\n\n/**\n * Deep validate a document to collect ALL errors, not just union-level errors\n */\nexport function deepValidateDocument(\n data: any,\n opts: DeepValidateOptions = {}\n): ValidationError[] {\n const allErrors: ValidationError[] = [];\n\n // Validate the document structure\n if (!data || typeof data !== 'object') {\n allErrors.push({\n path: 'root',\n message: 'Document must be an object',\n code: 'invalid_type',\n });\n return allErrors;\n }\n\n // Check name field\n if (!data.name) {\n allErrors.push({\n path: '/name',\n message: 'Missing required field \"name\"',\n code: 'required_property',\n });\n } else if (!ROOT_COMPONENT_NAMES.has(data.name)) {\n const expected = [...ROOT_COMPONENT_NAMES].map((n) => `\"${n}\"`).join(', ');\n allErrors.push({\n path: '/name',\n message: `Invalid name \"${data.name}\". Expected ${expected}`,\n code: 'invalid_value',\n });\n }\n\n // Validate props section when the key is present so explicit `null` (or any\n // falsy non-object) is checked against the component's schema instead of\n // silently passing.\n if (ROOT_COMPONENT_NAMES.has(data.name) && 'props' in data) {\n const propsErrors = validateComponentProps(\n data.name,\n data.props,\n '/props',\n opts\n );\n allErrors.push(...propsErrors);\n }\n\n // Validate the children array. The root component requires one; nested\n // containers may legitimately omit it.\n if (!data.children) {\n allErrors.push({\n path: '/children',\n message: 'Missing required field \"children\"',\n code: 'required_property',\n });\n } else if (!Array.isArray(data.children)) {\n allErrors.push({\n path: '/children',\n message: 'Field \"children\" must be an array',\n code: 'invalid_type',\n });\n }\n\n // Deep-validate the props of every component anywhere in the tree.\n //\n // The earlier implementation only re-validated the root's direct children\n // and one level of `section` children. Two whole-tree blind spots followed:\n // 1. component props nested inside `text-box`/`columns` children — the\n // content of every container lives in the shared `children` field, so\n // anything below the first level went unchecked; and\n // 2. the `header`/`footer` paragraph regions, which the section schema\n // types loosely as an array of `Type.Any()` (or the `'linkToPrevious'`\n // literal) — so their entries' props are never checked by the\n // per-section validation.\n // The in-editor (Monaco) validator runs the generated JSON Schema over the\n // entire document, so it flags both. This walk brings the CLI to parity.\n walkComponentTree(data, '', opts, allErrors);\n\n return allErrors;\n}\n\n/**\n * Recursively validate the props of every component nested under `node`.\n *\n * Walks two kinds of child position to any depth:\n * - the `children` array — the universal container field shared by `docx`,\n * `section`, `columns` and `text-box` (added by the component registry), so\n * a bad prop inside a `text-box` or `columns` child is caught however deeply\n * it is nested; and\n * - the `header` / `footer` paragraph regions under `props` — typed only\n * loosely on the section schema (an array of `Type.Any()`, or the\n * `'linkToPrevious'` literal, which is skipped), so their entries are not\n * deep-checked by the parent's per-component validation.\n *\n * The node's own props are NOT validated here — the caller validates the root\n * props, and every entry is validated as it is visited. `table` and `list`\n * nest their components inside their own recursive props schemas, so those are\n * already covered by `validateComponentProps` and are intentionally not\n * re-walked here.\n */\nfunction walkComponentTree(\n node: any,\n path: string,\n opts: DeepValidateOptions,\n errors: ValidationError[]\n): void {\n if (!node || typeof node !== 'object') return;\n\n // `strictStructure` controls whether a malformed entry (not an object, or\n // missing `name`) is reported here. It is ON for positions the per-component\n // schema leaves unchecked — the `children` array (a sibling field, never seen\n // by props validation) and the `header`/`footer` regions (typed `Type.Any()`\n // on the static section schema) — so the walk is their only structural\n // checker and must match the whole-tree schema the editor runs. It is OFF for\n // `table` cell content, whose structure the table's own props schema already\n // validates; there the walk only adds the prop-constraint errors the loose\n // cell-content ref misses, so reporting structure too would double-report.\n const validateEntry = (\n child: any,\n childPath: string,\n strictStructure: boolean\n ): void => {\n if (!child || typeof child !== 'object') {\n if (strictStructure) {\n errors.push({\n path: childPath,\n message: 'Component must be an object',\n code: 'invalid_type',\n });\n }\n return;\n }\n if (typeof child.name !== 'string' || child.name.length === 0) {\n if (strictStructure) {\n errors.push({\n path: `${childPath}/name`,\n message: 'Component missing required field \"name\"',\n code: 'required_property',\n });\n }\n return;\n }\n\n // Registered plugin components are validated version-aware by the plugin\n // layer; skip their props and subtree so they are neither double-validated\n // nor misreported as unknown.\n if (opts.knownCustomNames?.has(child.name)) return;\n\n // Validate props against the component's schema. When props is omitted,\n // validate an empty object so the schema decides whether props are\n // required (e.g. `section` needs none; `heading` requires text+level).\n if (child.props != null) {\n errors.push(\n ...validateComponentProps(\n child.name,\n child.props,\n `${childPath}/props`,\n opts\n )\n );\n } else if (child.name !== 'custom') {\n errors.push(\n ...validateComponentProps(child.name, {}, `${childPath}/props`, opts)\n );\n }\n\n // Recurse so arbitrarily nested containers are covered.\n walkComponentTree(child, childPath, opts, errors);\n };\n\n // header/footer entries are validated strictly: the static section schema\n // types them as `Type.Any()`, so the editor's whole-tree schema (where they\n // resolve to the component union) is stricter than the per-component check —\n // the walk closes that gap, flagging non-component entries too. A bare\n // `'linkToPrevious'` value is not an array, so it is skipped here.\n for (const region of ['header', 'footer'] as const) {\n const entries = node.props?.[region];\n if (Array.isArray(entries)) {\n entries.forEach((child: any, i: number) =>\n validateEntry(child, `${path}/props/${region}/${i}`, true)\n );\n }\n }\n\n // `table` nests its cell content under `props` (not the shared `children`\n // field), and the static table schema types that content loosely — the\n // cell-content ref accepts any props object, just like the `Type.Any()`\n // header/footer above. So a bad prop deep in a cell (e.g. `font.size` over the\n // cap) slips past the per-component table check; walk each content component\n // so its props are validated against the real schema. Structural problems\n // with a cell are already reported by the table's own props validation, hence\n // the lenient (`false`) entry check to avoid double-reporting.\n if (node.name === 'table' && Array.isArray(node.props?.columns)) {\n node.props.columns.forEach((col: any, c: number) => {\n if (!col || typeof col !== 'object') return;\n const base = `${path}/props/columns/${c}`;\n const headerContent = col.header?.content;\n if (headerContent && typeof headerContent === 'object') {\n validateEntry(headerContent, `${base}/header/content`, false);\n }\n if (Array.isArray(col.cells)) {\n col.cells.forEach((cell: any, r: number) => {\n const content = cell?.content;\n if (content && typeof content === 'object') {\n validateEntry(content, `${base}/cells/${r}/content`, false);\n }\n });\n }\n });\n }\n\n if (Array.isArray(node.children)) {\n node.children.forEach((child: any, i: number) =>\n validateEntry(child, `${path}/children/${i}`, true)\n );\n } else if (node.children != null && path !== '') {\n // `children` is present but not an array on a nested container. The root's\n // `children` is already checked by deepValidateDocument (skipped here via\n // `path !== ''` so it is not reported twice); this branch covers every\n // deeper container (`section`/`columns`/`text-box`) the old one-level walk\n // never reached. Without it a malformed subtree slips through as valid:\n // TypeBox reports only a generic catch-all (which we strip), so an empty\n // error set would otherwise flip the document back to `valid`.\n errors.push({\n path: `${path}/children`,\n message: 'Field \"children\" must be an array',\n code: 'invalid_type',\n });\n }\n}\n\n/**\n * Validate a component's props against its schema\n */\nfunction validateComponentProps(\n componentName: string,\n props: any,\n basePath: string,\n opts: DeepValidateOptions = {}\n): ValidationError[] {\n const errors: ValidationError[] = [];\n\n // Get the schema for this component\n const schema = COMPONENT_SCHEMAS[componentName];\n if (!schema) {\n // Unknown component type. `basePath` always ends in `/props`; anchor the\n // swap to the end so a nested region path like `…/props/header/0/props`\n // becomes `…/props/header/0/name` rather than mangling an earlier `/props`.\n errors.push({\n path: basePath.replace(/\\/props$/, '/name'),\n message: `Unknown component \"${componentName}\"`,\n code: 'unknown_component',\n });\n return errors;\n }\n\n // When unknown fields are explicitly allowed, strip them before checking so\n // additionalProperties:false no longer rejects — required/typed fields are\n // still enforced.\n const toCheck = opts.allowUnknownFields\n ? Value.Clean(schema, Value.Clone(props))\n : props;\n\n // Use TypeBox to validate against the specific schema\n if (!Value.Check(schema, toCheck)) {\n const valueErrors = [...Value.Errors(schema, toCheck)];\n const transformedErrors = transformValueErrors(valueErrors, {\n maxErrors: 100,\n });\n\n // Adjust paths to be relative to the document root\n transformedErrors.forEach((error) => {\n // Combine base path with error path\n const fullPath =\n error.path === 'root'\n ? basePath\n : `${basePath}${error.path.startsWith('/') ? error.path : '/' + error.path}`;\n\n errors.push({\n ...error,\n path: fullPath,\n });\n });\n }\n\n return errors;\n}\n\n/**\n * Combine deep validation with standard validation.\n *\n * Deep validation produces precise, path-aware errors. TypeBox's discriminated-\n * union check, by contrast, often collapses any failure under the root document\n * into a single generic \"Invalid component configuration for 'docx'\" message at\n * `root` — useful as a signal that something is wrong, but actionable only via\n * the deep-validator's output. We always strip that catch-all so it doesn't\n * appear alongside (or, worse, instead of) the real diagnostics.\n */\nexport function comprehensiveValidateDocument(\n data: any,\n existingErrors: ValidationError[] = [],\n opts: DeepValidateOptions = {}\n): ValidationError[] {\n const deepErrors = deepValidateDocument(data, opts);\n\n const filteredExisting = existingErrors.filter(\n (e) => !isGenericUnionCatchAll(e)\n );\n\n return deduplicateErrors([...filteredExisting, ...deepErrors]);\n}\n\n/**\n * Detect TypeBox's generic union/discriminator catch-all error at the document\n * root. These messages name the component type ('docx') but give no actionable\n * detail — the deep validator emits the actual path-level errors instead.\n */\nfunction isGenericUnionCatchAll(error: ValidationError): boolean {\n const atRoot = !error.path || error.path === 'root' || error.path === '/';\n if (!atRoot) return false;\n const msg = error.message || '';\n return (\n /invalid component configurations?/i.test(msg) ||\n /invalid document structure/i.test(msg)\n );\n}\n\n/**\n * Deduplicate errors by path and message\n */\nfunction deduplicateErrors(errors: ValidationError[]): ValidationError[] {\n const seen = new Set<string>();\n const unique: ValidationError[] = [];\n\n for (const error of errors) {\n const key = `${error.path}:${error.message}`;\n if (!seen.has(key)) {\n seen.add(key);\n unique.push(error);\n }\n }\n\n return unique;\n}\n","/**\n * Base validator implementation\n * Core validation logic that eliminates duplication across the codebase\n */\n\nimport { Value } from '@sinclair/typebox/value';\nimport type { Static, TSchema } from '@sinclair/typebox';\nimport type {\n ValidationResult,\n ValidationOptions,\n JsonValidationResult,\n} from './types';\nimport {\n transformValueErrors,\n createJsonParseError,\n formatErrorSummary,\n} from '@json-to-office/shared';\n\n/**\n * Base validation function that all specific validators use\n * This eliminates the repeated Value.Check -> Value.Errors -> map pattern\n */\nexport function validateAgainstSchema<T extends TSchema>(\n schema: T,\n data: unknown,\n options?: ValidationOptions\n): ValidationResult<Static<T>> {\n try {\n // Check if data matches the schema\n if (!Value.Check(schema, data)) {\n // Collect ALL errors (not just the first one)\n const errors = [...Value.Errors(schema, data)];\n const transformedErrors = transformValueErrors(errors, {\n jsonString: options?.jsonString,\n maxErrors: options?.maxErrors || 100, // Default to 100 if not specified\n });\n\n return {\n valid: false,\n errors: transformedErrors,\n };\n }\n\n // Data is valid, apply transformations if requested\n let processedData = data;\n\n if (options?.clean) {\n // Remove unknown properties\n processedData = Value.Clean(schema, Value.Clone(processedData));\n }\n\n if (options?.applyDefaults) {\n // Apply default values\n processedData = Value.Default(schema, processedData);\n }\n\n return {\n valid: true,\n data: processedData as Static<T>,\n };\n } catch (error) {\n // Handle unexpected errors\n return {\n valid: false,\n errors: [\n {\n path: 'root',\n message:\n error instanceof Error ? error.message : 'Unknown validation error',\n code: 'validation_exception',\n },\n ],\n };\n }\n}\n\n/**\n * Validate JSON string or object with schema\n */\nexport function validateJson<T extends TSchema>(\n schema: T,\n jsonInput: string | object,\n options?: ValidationOptions\n): JsonValidationResult<Static<T>> {\n // Handle string input\n if (typeof jsonInput === 'string') {\n // Basic input validation\n if (!jsonInput.trim()) {\n return {\n valid: false,\n errors: [\n {\n path: 'root',\n message: 'Input must be a non-empty string',\n code: 'empty_input',\n },\n ],\n isJsonError: true,\n };\n }\n\n // Try to parse JSON\n let parsed: unknown;\n try {\n parsed = JSON.parse(jsonInput);\n } catch (error) {\n if (error instanceof Error) {\n return {\n valid: false,\n errors: [createJsonParseError(error, jsonInput)],\n isJsonError: true,\n };\n }\n return {\n valid: false,\n errors: [\n {\n path: 'root',\n message: 'Failed to parse JSON',\n code: 'json_parse_error',\n },\n ],\n isJsonError: true,\n };\n }\n\n // Validate parsed object with position calculation\n const result = validateAgainstSchema(schema, parsed, {\n ...options,\n jsonString: jsonInput,\n calculatePosition: true,\n });\n\n return {\n ...result,\n parsed,\n isJsonError: false,\n };\n }\n\n // Handle object input directly\n const result = validateAgainstSchema(schema, jsonInput, options);\n return {\n ...result,\n parsed: jsonInput,\n isJsonError: false,\n };\n}\n\n/**\n * Batch validate multiple items\n */\nexport function validateBatch<T extends TSchema>(\n schema: T,\n items: unknown[],\n options?: ValidationOptions\n): ValidationResult<Static<T>[]> {\n const results: Static<T>[] = [];\n const allErrors: any[] = [];\n let hasErrors = false;\n\n for (let i = 0; i < items.length; i++) {\n const result = validateAgainstSchema(schema, items[i], options);\n\n if (result.valid && result.data) {\n results.push(result.data);\n } else {\n hasErrors = true;\n if (result.errors) {\n // Prefix errors with item index\n const prefixedErrors = result.errors.map((e) => ({\n ...e,\n path: `[${i}]${e.path ? '/' + e.path : ''}`,\n }));\n allErrors.push(...prefixedErrors);\n }\n }\n\n // Stop if we've hit the max errors\n if (options?.maxErrors && allErrors.length >= options.maxErrors) {\n break;\n }\n }\n\n if (hasErrors) {\n return {\n valid: false,\n errors: allErrors.slice(0, options?.maxErrors),\n };\n }\n\n return {\n valid: true,\n data: results,\n };\n}\n\n/**\n * Validate with custom error enhancement\n */\nexport function validateWithEnhancement<T extends TSchema>(\n schema: T,\n data: unknown,\n enhancer: (errors: any[]) => any[],\n options?: ValidationOptions\n): ValidationResult<Static<T>> {\n const result = validateAgainstSchema(schema, data, options);\n\n if (!result.valid && result.errors) {\n result.errors = enhancer(result.errors);\n }\n\n return result;\n}\n\n/**\n * Create a validator function for a specific schema\n */\nexport function createValidator<T extends TSchema>(\n schema: T,\n defaultOptions?: ValidationOptions\n) {\n return (data: unknown, options?: ValidationOptions) => {\n return validateAgainstSchema(schema, data, {\n ...defaultOptions,\n ...options,\n });\n };\n}\n\n/**\n * Create a JSON validator function for a specific schema\n */\nexport function createJsonValidator<T extends TSchema>(\n schema: T,\n defaultOptions?: ValidationOptions\n) {\n return (jsonInput: string | object, options?: ValidationOptions) => {\n return validateJson(schema, jsonInput, {\n ...defaultOptions,\n ...options,\n });\n };\n}\n\n/**\n * Utility to check if validation result is successful with type guard\n */\nexport function isValidationSuccess<T>(\n result: ValidationResult<T>\n): result is ValidationResult<T> & { valid: true; data: T } {\n return result.valid === true && result.data !== undefined;\n}\n\n/**\n * Get validation error summary\n */\nexport function getValidationSummary(result: ValidationResult): string {\n if (result.valid) {\n return 'Validation successful';\n }\n\n if (!result.errors || result.errors.length === 0) {\n return 'Validation failed with unknown error';\n }\n\n return formatErrorSummary(result.errors);\n}\n","/**\n * Document validation implementation\n * Single source of truth for all document validation\n */\n\nimport type { Static } from '@sinclair/typebox';\nimport {\n ComponentDefinitionSchema,\n StandardComponentDefinitionSchema,\n} from '../../schemas/components';\nimport { extractStandardComponentNames } from '@json-to-office/shared';\nimport {\n comprehensiveValidateDocument,\n collectImageSourceConflicts,\n collectIndentConflicts,\n collectNoteRevisionConflicts,\n collectTextBoxShapeConflicts,\n} from './deep-validator';\n\n// JsonComponentDefinitionSchema is just an alias for ComponentDefinitionSchema\nconst JsonComponentDefinitionSchema = ComponentDefinitionSchema;\nimport type {\n DocumentValidationResult,\n ValidationError,\n ValidationOptions,\n} from './types';\nimport { validateAgainstSchema, validateJson } from './base-validator';\n\n/**\n * The semantic rules the structural schema cannot express.\n *\n * Each entry runs unconditionally over the whole document, because every one of\n * them describes a payload TypeBox already accepted: the fields involved are\n * independently optional, and only their combination is wrong.\n *\n * They live in one list because both entry points below need all of them, and a\n * collector wired into only one of the two is invisible until a document takes\n * the other path.\n */\nconst SEMANTIC_COLLECTORS: readonly {\n readonly why: string;\n readonly collect: (document: unknown) => ValidationError[];\n}[] = [\n {\n // A multi-source image passes the structural check: each source is its own\n // optional field.\n why: 'image source mutual-exclusivity',\n collect: collectImageSourceConflicts,\n },\n {\n why: 'indent hanging/firstLine mutual-exclusivity',\n collect: collectIndentConflicts,\n },\n {\n // Tracked-change text renders literally, so a note marker inside it never\n // resolves and docx cannot express the pair anyway.\n why: 'notes on a revised paragraph',\n collect: collectNoteRevisionConflicts,\n },\n {\n // A shape has no autofit and its outline carries no dash pattern, so the\n // request could only ever come back as a table.\n why: 'a text box asking for a shape rendering a shape cannot give it',\n collect: collectTextBoxShapeConflicts,\n },\n];\n\n/**\n * Run every semantic rule over an already-resolved document — `data` for the\n * object entry point, `result.parsed` for the JSON one.\n */\nfunction collectSemanticConflicts(document: unknown): ValidationError[] {\n return SEMANTIC_COLLECTORS.flatMap(({ collect }) => collect(document));\n}\n\n/**\n * Validate a document/report component definition\n */\nexport function validateDocument(\n data: unknown,\n options?: ValidationOptions\n): DocumentValidationResult {\n const result = validateAgainstSchema(\n ComponentDefinitionSchema,\n data,\n options\n );\n\n // If validation failed, use deep validation to get all detailed errors\n let finalErrors = result.errors || [];\n let finalValid = result.valid;\n if (!result.valid && data) {\n finalErrors = comprehensiveValidateDocument(data, result.errors, {\n allowUnknownFields: options?.allowUnknownFields,\n knownCustomNames: options?.knownCustomNames,\n });\n // If TypeBox's union check produced only generic catch-all errors and the\n // deep validator finds nothing actionable, treat the document as valid.\n if (finalErrors.length === 0) {\n finalValid = true;\n }\n }\n\n // Semantic rules run on every document, valid or not: they describe payloads\n // the structural check already accepted.\n const semanticConflicts = collectSemanticConflicts(data);\n if (semanticConflicts.length > 0) {\n finalErrors = [...finalErrors, ...semanticConflicts];\n finalValid = false;\n }\n\n // Add document-specific metadata. Keep `data` populated whenever `valid` is\n // true so `isValidDocument()` (which requires both) stays consistent — when\n // TypeBox failed and the deep validator cleared the doc, fall back to the\n // original input as the data payload.\n const resolvedData =\n result.data ??\n (finalValid\n ? (data as Static<typeof ComponentDefinitionSchema>)\n : undefined);\n const documentResult: DocumentValidationResult = {\n ...result,\n valid: finalValid,\n documentType: 'docx',\n errors: finalErrors,\n data: resolvedData,\n };\n\n // Check if document has custom components\n if (finalValid) {\n const doc = resolvedData as any;\n if (doc && doc.children && Array.isArray(doc.children)) {\n const hasCustom = doc.children.some(\n (c: any) => !isStandardComponentName(c.name)\n );\n documentResult.hasCustomComponents = hasCustom;\n }\n }\n\n return documentResult;\n}\n\n/**\n * Validate a JSON document (string or object)\n */\nexport function validateJsonDocument(\n jsonInput: string | object,\n options?: ValidationOptions\n): DocumentValidationResult {\n // Use the JSON-specific schema which includes the $schema field\n const result = validateJson(\n JsonComponentDefinitionSchema,\n jsonInput,\n options\n );\n\n // If validation failed, use deep validation to get all detailed errors\n let finalErrors = result.errors || [];\n let finalValid = result.valid;\n if (!result.valid && result.parsed) {\n finalErrors = comprehensiveValidateDocument(result.parsed, result.errors, {\n allowUnknownFields: options?.allowUnknownFields,\n knownCustomNames: options?.knownCustomNames,\n });\n if (finalErrors.length === 0) {\n finalValid = true;\n }\n }\n\n // Semantic rules run on every document, valid or not: they describe payloads\n // the structural check already accepted.\n const semanticConflicts = collectSemanticConflicts(result.parsed);\n if (semanticConflicts.length > 0) {\n finalErrors = [...finalErrors, ...semanticConflicts];\n finalValid = false;\n }\n\n // Add document-specific metadata. Keep `data` populated whenever `valid` is\n // true so `isValidDocument()` (which requires both) stays consistent — when\n // TypeBox failed and the deep validator cleared the doc, fall back to the\n // parsed input as the data payload.\n const resolvedData =\n result.data ??\n (finalValid\n ? (result.parsed as Static<typeof ComponentDefinitionSchema>)\n : undefined);\n const documentResult: DocumentValidationResult = {\n ...result,\n valid: finalValid,\n documentType: 'docx',\n errors: finalErrors,\n data: resolvedData,\n };\n\n // Check for custom components\n if (finalValid) {\n const doc = resolvedData as any;\n if (doc && doc.children && Array.isArray(doc.children)) {\n const hasCustom = doc.children.some(\n (c: any) => !isStandardComponentName(c.name)\n );\n documentResult.hasCustomComponents = hasCustom;\n }\n }\n\n return documentResult;\n}\n\n/**\n * Type guard for document validation result\n */\nexport function isValidDocument(\n result: DocumentValidationResult\n): result is DocumentValidationResult & {\n valid: true;\n data: Static<typeof ComponentDefinitionSchema>;\n} {\n return result.valid === true && result.data !== undefined;\n}\n\n/**\n * Extract standard component names from the schema (cached)\n */\nfunction getStandardComponentNames(): string[] {\n return extractStandardComponentNames(StandardComponentDefinitionSchema);\n}\n\n/**\n * Check if a component name is standard\n */\nfunction isStandardComponentName(name: string): boolean {\n const standardNames = getStandardComponentNames();\n return standardNames.includes(name);\n}\n\n/**\n * Create a document validator with default options\n */\nexport function createDocumentValidator(defaultOptions?: ValidationOptions) {\n return {\n validate: (data: unknown, options?: ValidationOptions) =>\n validateDocument(data, { ...defaultOptions, ...options }),\n validateJson: (jsonInput: string | object, options?: ValidationOptions) =>\n validateJsonDocument(jsonInput, { ...defaultOptions, ...options }),\n };\n}\n\n// Export convenient validators with common configurations\nexport const documentValidator = createDocumentValidator({\n clean: true,\n applyDefaults: true,\n maxErrors: 100, // Collect up to 100 errors to show all validation issues\n});\n\nexport const strictDocumentValidator = createDocumentValidator({\n clean: false,\n applyDefaults: false,\n maxErrors: 100, // Increased from 10 to show more errors\n});\n\n/**\n * Legacy compatibility exports\n */\nexport const validateJsonComponent = validateJsonDocument;\nexport const validateDocumentWithSchema = validateDocument;\n"],"mappings":";;;;;;;;;;;;;AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,SAAS,wBACP,OACA,SACQ;AACR,QAAM,UAAU,OAAO,MAAM,QAAQ,EAAE;AACvC,QAAM,OAAO,MAAM,QAAQ;AAG3B,MAAI,YAAY,QAAQ,YAAY,SAAS;AAC3C,WAAO,0BAA0B,KAAK;AAAA,EACxC;AAGA,MAAI,MAAM,SAAS,SAAS,sBAAsB,GAAG;AACnD,WAAO,oCAAoC,KAAK;AAAA,EAClD;AAGA,MAAI,MAAM,SAAS,SAAS,mBAAmB,GAAG;AAChD,WAAO,gCAAgC,KAAK;AAAA,EAC9C;AAGA,MACE,YAAY,YACZ,YAAY,YACZ,YAAY,aACZ,YAAY,WACZ,YAAY,UACZ;AACA,WAAO,4BAA4B,KAAK;AAAA,EAC1C;AAGA,MAAI,YAAY,WAAW;AACzB,WAAO,4BAA4B,KAAK;AAAA,EAC1C;AAGA,MAAI,YAAY,aAAa,YAAY,UAAU;AACjD,WAAO,4BAA4B,KAAK;AAAA,EAC1C;AAGA,SAAO,MAAM,IAAI,KAAK,MAAM,OAAO;AACrC;AAKA,SAAS,0BAA0B,OAA2B;AAC5D,QAAM,OAAO,MAAM,QAAQ;AAC3B,QAAM,QAAQ,MAAM;AAGpB,MAAI,SAAS,UAAU,SAAS,OAAO,SAAS,mBAAmB;AAEjE,QAAI,SAAS,OAAO,UAAU,UAAU;AACtC,UAA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