@json-to-office/shared-docx 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +9 -0
  3. package/dist/chunk-5533WPL6.js +1895 -0
  4. package/dist/chunk-5533WPL6.js.map +1 -0
  5. package/dist/chunk-AA4HIXRG.js +34 -0
  6. package/dist/chunk-AA4HIXRG.js.map +1 -0
  7. package/dist/chunk-BEPLK76M.js +454 -0
  8. package/dist/chunk-BEPLK76M.js.map +1 -0
  9. package/dist/chunk-BOUURUYX.js +364 -0
  10. package/dist/chunk-BOUURUYX.js.map +1 -0
  11. package/dist/chunk-EKWM2CWA.js +97 -0
  12. package/dist/chunk-EKWM2CWA.js.map +1 -0
  13. package/dist/chunk-ET6YMNMF.js +35 -0
  14. package/dist/chunk-ET6YMNMF.js.map +1 -0
  15. package/dist/chunk-F5LVWDTY.js +57 -0
  16. package/dist/chunk-F5LVWDTY.js.map +1 -0
  17. package/dist/chunk-HHMK2RWF.js +274 -0
  18. package/dist/chunk-HHMK2RWF.js.map +1 -0
  19. package/dist/chunk-LOE6BZQG.js +750 -0
  20. package/dist/chunk-LOE6BZQG.js.map +1 -0
  21. package/dist/chunk-LWR4TFZ5.js +121 -0
  22. package/dist/chunk-LWR4TFZ5.js.map +1 -0
  23. package/dist/chunk-VP3X6DBP.js +44 -0
  24. package/dist/chunk-VP3X6DBP.js.map +1 -0
  25. package/dist/document-validator-CiaGiy1v.d.ts +119 -0
  26. package/dist/index.d.ts +938 -0
  27. package/dist/index.js +1129 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/schemas/api.d.ts +46 -0
  30. package/dist/schemas/api.js +16 -0
  31. package/dist/schemas/api.js.map +1 -0
  32. package/dist/schemas/component-registry.d.ts +90 -0
  33. package/dist/schemas/component-registry.js +24 -0
  34. package/dist/schemas/component-registry.js.map +1 -0
  35. package/dist/schemas/components.d.ts +755 -0
  36. package/dist/schemas/components.js +94 -0
  37. package/dist/schemas/components.js.map +1 -0
  38. package/dist/schemas/custom-components.d.ts +59 -0
  39. package/dist/schemas/custom-components.js +11 -0
  40. package/dist/schemas/custom-components.js.map +1 -0
  41. package/dist/schemas/document.d.ts +43 -0
  42. package/dist/schemas/document.js +19 -0
  43. package/dist/schemas/document.js.map +1 -0
  44. package/dist/schemas/export.d.ts +67 -0
  45. package/dist/schemas/export.js +19 -0
  46. package/dist/schemas/export.js.map +1 -0
  47. package/dist/schemas/font.d.ts +57 -0
  48. package/dist/schemas/font.js +11 -0
  49. package/dist/schemas/font.js.map +1 -0
  50. package/dist/schemas/generator.d.ts +80 -0
  51. package/dist/schemas/generator.js +9 -0
  52. package/dist/schemas/generator.js.map +1 -0
  53. package/dist/schemas/theme.d.ts +3354 -0
  54. package/dist/schemas/theme.js +42 -0
  55. package/dist/schemas/theme.js.map +1 -0
  56. package/dist/validation/unified/index.d.ts +720 -0
  57. package/dist/validation/unified/index.js +154 -0
  58. package/dist/validation/unified/index.js.map +1 -0
  59. package/package.json +80 -0
@@ -0,0 +1,94 @@
1
+ import {
2
+ ComponentDefinitionSchema,
3
+ StandardComponentDefinitionSchema
4
+ } from "../chunk-ET6YMNMF.js";
5
+ import {
6
+ AlignmentSchema,
7
+ BaseComponentFields,
8
+ BaseComponentPropsSchema,
9
+ BorderSchema,
10
+ ColumnsPropsSchema,
11
+ FloatingPropertiesSchema,
12
+ FooterPropsSchema,
13
+ HeaderPropsSchema,
14
+ HeadingLevelSchema,
15
+ HeadingPropsSchema,
16
+ HighchartsPropsSchema,
17
+ HorizontalPositionAlignSchema,
18
+ HorizontalPositionRelativeFromSchema,
19
+ ImagePropsSchema,
20
+ IndentSchema,
21
+ JustifiedAlignmentSchema,
22
+ LevelFormatSchema,
23
+ LineSpacingSchema,
24
+ ListLevelPropsSchema,
25
+ ListPropsSchema,
26
+ ListSpacingSchema,
27
+ MarginsSchema,
28
+ NumberingSchema,
29
+ ParagraphPropsSchema,
30
+ ReportPropsSchema,
31
+ SectionPropsSchema,
32
+ SpacingSchema,
33
+ StatisticPropsSchema,
34
+ TablePropsSchema,
35
+ TextBoxPropsSchema,
36
+ TextWrappingSideSchema,
37
+ TextWrappingTypeSchema,
38
+ TocDepthRangeSchema,
39
+ TocPropsSchema,
40
+ TocScopeSchema,
41
+ TocStyleMappingSchema,
42
+ TocStyleSchema,
43
+ VerticalPositionAlignSchema,
44
+ VerticalPositionRelativeFromSchema,
45
+ createReportPropsSchema,
46
+ createSectionPropsSchema
47
+ } from "../chunk-5533WPL6.js";
48
+ import "../chunk-F5LVWDTY.js";
49
+ export {
50
+ AlignmentSchema,
51
+ BaseComponentFields,
52
+ BaseComponentPropsSchema,
53
+ BorderSchema,
54
+ ColumnsPropsSchema,
55
+ ComponentDefinitionSchema,
56
+ FloatingPropertiesSchema,
57
+ FooterPropsSchema,
58
+ HeaderPropsSchema,
59
+ HeadingLevelSchema,
60
+ HeadingPropsSchema,
61
+ HighchartsPropsSchema,
62
+ HorizontalPositionAlignSchema,
63
+ HorizontalPositionRelativeFromSchema,
64
+ ImagePropsSchema,
65
+ IndentSchema,
66
+ JustifiedAlignmentSchema,
67
+ LevelFormatSchema,
68
+ LineSpacingSchema,
69
+ ListLevelPropsSchema,
70
+ ListPropsSchema,
71
+ ListSpacingSchema,
72
+ MarginsSchema,
73
+ NumberingSchema,
74
+ ParagraphPropsSchema,
75
+ ReportPropsSchema,
76
+ SectionPropsSchema,
77
+ SpacingSchema,
78
+ StandardComponentDefinitionSchema,
79
+ StatisticPropsSchema,
80
+ TablePropsSchema,
81
+ TextBoxPropsSchema,
82
+ TextWrappingSideSchema,
83
+ TextWrappingTypeSchema,
84
+ TocDepthRangeSchema,
85
+ TocPropsSchema,
86
+ TocScopeSchema,
87
+ TocStyleMappingSchema,
88
+ TocStyleSchema,
89
+ VerticalPositionAlignSchema,
90
+ VerticalPositionRelativeFromSchema,
91
+ createReportPropsSchema,
92
+ createSectionPropsSchema
93
+ };
94
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,59 @@
1
+ import * as _sinclair_typebox from '@sinclair/typebox';
2
+ import { Static } from '@sinclair/typebox';
3
+
4
+ /**
5
+ * Text Space After component props
6
+ * Simple custom component that adds spacing after text content
7
+ */
8
+ declare const TextSpaceAfterPropsSchema: _sinclair_typebox.TObject<{
9
+ content: _sinclair_typebox.TString;
10
+ spaceAfter: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
11
+ fontSize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
12
+ fontFamily: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
13
+ bold: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
14
+ italic: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
15
+ underline: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
16
+ color: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
17
+ alignment: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"left">, _sinclair_typebox.TLiteral<"center">, _sinclair_typebox.TLiteral<"right">, _sinclair_typebox.TLiteral<"justify">]>>;
18
+ }>;
19
+ /**
20
+ * Text Space After component definition schema
21
+ */
22
+ declare const TextSpaceAfterComponentSchema: _sinclair_typebox.TObject<{
23
+ name: _sinclair_typebox.TLiteral<"text-space-after">;
24
+ id: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
25
+ props: _sinclair_typebox.TObject<{
26
+ content: _sinclair_typebox.TString;
27
+ spaceAfter: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
28
+ fontSize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
29
+ fontFamily: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
30
+ bold: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
31
+ italic: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
32
+ underline: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
33
+ color: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
34
+ alignment: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"left">, _sinclair_typebox.TLiteral<"center">, _sinclair_typebox.TLiteral<"right">, _sinclair_typebox.TLiteral<"justify">]>>;
35
+ }>;
36
+ }>;
37
+ /**
38
+ * Union of all custom component types
39
+ */
40
+ declare const CustomComponentDefinitionSchema: _sinclair_typebox.TObject<{
41
+ name: _sinclair_typebox.TLiteral<"text-space-after">;
42
+ id: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
43
+ props: _sinclair_typebox.TObject<{
44
+ content: _sinclair_typebox.TString;
45
+ spaceAfter: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
46
+ fontSize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
47
+ fontFamily: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
48
+ bold: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
49
+ italic: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
50
+ underline: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
51
+ color: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
52
+ alignment: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"left">, _sinclair_typebox.TLiteral<"center">, _sinclair_typebox.TLiteral<"right">, _sinclair_typebox.TLiteral<"justify">]>>;
53
+ }>;
54
+ }>;
55
+ type TextSpaceAfterProps = Static<typeof TextSpaceAfterPropsSchema>;
56
+ type TextSpaceAfterComponent = Static<typeof TextSpaceAfterComponentSchema>;
57
+ type CustomComponentDefinition = Static<typeof CustomComponentDefinitionSchema>;
58
+
59
+ export { type CustomComponentDefinition, CustomComponentDefinitionSchema, type TextSpaceAfterComponent, TextSpaceAfterComponentSchema, type TextSpaceAfterProps, TextSpaceAfterPropsSchema };
@@ -0,0 +1,11 @@
1
+ import {
2
+ CustomComponentDefinitionSchema,
3
+ TextSpaceAfterComponentSchema,
4
+ TextSpaceAfterPropsSchema
5
+ } from "../chunk-VP3X6DBP.js";
6
+ export {
7
+ CustomComponentDefinitionSchema,
8
+ TextSpaceAfterComponentSchema,
9
+ TextSpaceAfterPropsSchema
10
+ };
11
+ //# sourceMappingURL=custom-components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,43 @@
1
+ import * as _sinclair_typebox from '@sinclair/typebox';
2
+ import { Static } from '@sinclair/typebox';
3
+ export { a as validateDocumentWithSchema, e as validateJsonComponent } from '../document-validator-CiaGiy1v.js';
4
+ import './components.js';
5
+ import '@sinclair/typebox/value';
6
+ import '@json-to-office/shared';
7
+
8
+ declare const JsonComponentDefinitionSchema: _sinclair_typebox.TRecursive<_sinclair_typebox.TUnion<_sinclair_typebox.TSchema[]>>;
9
+ type JsonComponentDefinition = Static<typeof JsonComponentDefinitionSchema>;
10
+ interface ValidationError {
11
+ path: string;
12
+ message: string;
13
+ code?: string;
14
+ line?: number;
15
+ column?: number;
16
+ suggestions?: string[];
17
+ }
18
+ interface DocumentValidationResult {
19
+ valid: boolean;
20
+ errors: ValidationError[];
21
+ warnings?: ValidationError[];
22
+ }
23
+ declare const JSON_SCHEMA_URLS: {
24
+ report: string;
25
+ section: string;
26
+ columns: string;
27
+ heading: string;
28
+ paragraph: string;
29
+ image: string;
30
+ statistic: string;
31
+ table: string;
32
+ header: string;
33
+ footer: string;
34
+ list: string;
35
+ alignment: string;
36
+ baseComponent: string;
37
+ border: string;
38
+ spacing: string;
39
+ margins: string;
40
+ index: string;
41
+ };
42
+
43
+ export { type DocumentValidationResult, JSON_SCHEMA_URLS, type JsonComponentDefinition, JsonComponentDefinitionSchema, type ValidationError };
@@ -0,0 +1,19 @@
1
+ import {
2
+ JSON_SCHEMA_URLS,
3
+ JsonComponentDefinitionSchema
4
+ } from "../chunk-AA4HIXRG.js";
5
+ import {
6
+ validateDocumentWithSchema,
7
+ validateJsonComponent
8
+ } from "../chunk-LOE6BZQG.js";
9
+ import "../chunk-ET6YMNMF.js";
10
+ import "../chunk-5533WPL6.js";
11
+ import "../chunk-VP3X6DBP.js";
12
+ import "../chunk-F5LVWDTY.js";
13
+ export {
14
+ JSON_SCHEMA_URLS,
15
+ JsonComponentDefinitionSchema,
16
+ validateDocumentWithSchema,
17
+ validateJsonComponent
18
+ };
19
+ //# sourceMappingURL=document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,67 @@
1
+ import { TSchema } from '@sinclair/typebox';
2
+
3
+ /**
4
+ * Unified Schema Export Utility
5
+ *
6
+ * Single source of truth for converting TypeBox schemas to JSON Schema format.
7
+ * Eliminates duplication between generate-schemas.mjs and plugin/schema.ts
8
+ */
9
+
10
+ /**
11
+ * Configuration for a component schema
12
+ */
13
+ interface ComponentSchemaConfig {
14
+ schema: TSchema;
15
+ title: string;
16
+ description: string;
17
+ requiresName?: boolean;
18
+ enhanceForRichContent?: boolean;
19
+ }
20
+ /**
21
+ * Fix TypeBox recursive references in a schema
22
+ * Handles both "T0" and "ComponentDefinition" reference patterns
23
+ */
24
+ declare function fixSchemaReferences(schema: Record<string, unknown>, rootDefinitionName?: string): void;
25
+ /**
26
+ * Convert TypeBox schema to JSON Schema format with proper definitions
27
+ */
28
+ declare function convertToJsonSchema(schema: TSchema, options?: {
29
+ $schema?: string;
30
+ $id?: string;
31
+ title?: string;
32
+ description?: string;
33
+ definitions?: Record<string, unknown>;
34
+ }): Record<string, unknown>;
35
+ /**
36
+ * Create a component schema with proper structure
37
+ */
38
+ declare function createComponentSchema(name: string, config: ComponentSchemaConfig, componentDefinitionSchema?: TSchema): Record<string, unknown>;
39
+ /**
40
+ * Export schema to file with proper formatting
41
+ */
42
+ declare function exportSchemaToFile(schema: Record<string, unknown>, outputPath: string, options?: {
43
+ prettyPrint?: boolean;
44
+ }): Promise<void>;
45
+ /**
46
+ * Component metadata registry
47
+ * Single source of truth for component titles and descriptions
48
+ */
49
+ declare const COMPONENT_METADATA: Record<string, Omit<ComponentSchemaConfig, 'schema'>>;
50
+ /**
51
+ * Base schema metadata registry
52
+ */
53
+ declare const BASE_SCHEMA_METADATA: Record<string, {
54
+ title: string;
55
+ description: string;
56
+ }>;
57
+ /**
58
+ * Theme schema metadata
59
+ */
60
+ declare const THEME_SCHEMA_METADATA: {
61
+ theme: {
62
+ title: string;
63
+ description: string;
64
+ };
65
+ };
66
+
67
+ export { BASE_SCHEMA_METADATA, COMPONENT_METADATA, type ComponentSchemaConfig, THEME_SCHEMA_METADATA, convertToJsonSchema, createComponentSchema, exportSchemaToFile, fixSchemaReferences };
@@ -0,0 +1,19 @@
1
+ import {
2
+ BASE_SCHEMA_METADATA,
3
+ COMPONENT_METADATA,
4
+ THEME_SCHEMA_METADATA,
5
+ convertToJsonSchema,
6
+ createComponentSchema,
7
+ exportSchemaToFile,
8
+ fixSchemaReferences
9
+ } from "../chunk-HHMK2RWF.js";
10
+ export {
11
+ BASE_SCHEMA_METADATA,
12
+ COMPONENT_METADATA,
13
+ THEME_SCHEMA_METADATA,
14
+ convertToJsonSchema,
15
+ createComponentSchema,
16
+ exportSchemaToFile,
17
+ fixSchemaReferences
18
+ };
19
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,57 @@
1
+ import * as _sinclair_typebox from '@sinclair/typebox';
2
+
3
+ /**
4
+ * Font-related Schemas (shared)
5
+ * Extracted to avoid circular dependencies between theme and module schemas.
6
+ */
7
+ /** Hex color with # prefix (e.g. "#000000") or a theme color name (e.g. "primary") */
8
+ declare const HexColorSchema: _sinclair_typebox.TString;
9
+ /**
10
+ * Shared schema for text formatting properties.
11
+ * Used as base for both font definitions and style definitions.
12
+ */
13
+ declare const TextFormattingPropertiesSchema: _sinclair_typebox.TObject<{
14
+ size: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
15
+ color: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
16
+ bold: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
17
+ italic: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
18
+ underline: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
19
+ lineSpacing: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
20
+ type: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"single">, _sinclair_typebox.TLiteral<"atLeast">, _sinclair_typebox.TLiteral<"exactly">, _sinclair_typebox.TLiteral<"double">, _sinclair_typebox.TLiteral<"multiple">]>;
21
+ value: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
22
+ }>>;
23
+ spacing: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
24
+ before: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
25
+ after: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
26
+ }>>;
27
+ characterSpacing: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
28
+ type: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"condensed">, _sinclair_typebox.TLiteral<"expanded">]>;
29
+ value: _sinclair_typebox.TNumber;
30
+ }>>;
31
+ }>;
32
+ /**
33
+ * Font definition schema with full text formatting properties.
34
+ * All properties except 'family' are optional.
35
+ */
36
+ declare const FontDefinitionSchema: _sinclair_typebox.TObject<{
37
+ size: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
38
+ color: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
39
+ bold: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
40
+ italic: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
41
+ underline: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
42
+ lineSpacing: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
43
+ type: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"single">, _sinclair_typebox.TLiteral<"atLeast">, _sinclair_typebox.TLiteral<"exactly">, _sinclair_typebox.TLiteral<"double">, _sinclair_typebox.TLiteral<"multiple">]>;
44
+ value: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
45
+ }>>;
46
+ spacing: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
47
+ before: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
48
+ after: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
49
+ }>>;
50
+ characterSpacing: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
51
+ type: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"condensed">, _sinclair_typebox.TLiteral<"expanded">]>;
52
+ value: _sinclair_typebox.TNumber;
53
+ }>>;
54
+ family: _sinclair_typebox.TString;
55
+ }>;
56
+
57
+ export { FontDefinitionSchema, HexColorSchema, TextFormattingPropertiesSchema };
@@ -0,0 +1,11 @@
1
+ import {
2
+ FontDefinitionSchema,
3
+ HexColorSchema,
4
+ TextFormattingPropertiesSchema
5
+ } from "../chunk-F5LVWDTY.js";
6
+ export {
7
+ FontDefinitionSchema,
8
+ HexColorSchema,
9
+ TextFormattingPropertiesSchema
10
+ };
11
+ //# sourceMappingURL=font.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,80 @@
1
+ import { TSchema } from '@sinclair/typebox';
2
+
3
+ /**
4
+ * Unified Document Schema Generator - SHARED UTILITY
5
+ *
6
+ * This is the SHARED implementation for generating document schemas.
7
+ * It's used by MULTIPLE CONSUMERS with different requirements:
8
+ *
9
+ * 1. BUILD-TIME: generate-schemas.mjs uses this to create static .schema.json files
10
+ * - Only standard components (no custom components available at build time)
11
+ * - Outputs to filesystem for IDE autocomplete
12
+ *
13
+ * 2. RUNTIME PLUGIN: plugin/schema.ts uses this for plugin-enhanced schemas
14
+ * - Includes custom components registered at runtime
15
+ * - Cannot be generated at build time (components must be instantiated)
16
+ *
17
+ * 3. WEB APP: Monaco editor may use this for in-browser validation
18
+ * - Optimized for browser environment
19
+ * - No filesystem access
20
+ *
21
+ * This separation is ARCHITECTURAL, not accidental:
22
+ * - Build-time vs runtime constraints are incompatible
23
+ * - Custom components require runtime instantiation
24
+ * - Different consumers need different output formats
25
+ *
26
+ * IMPORTANT: Standard components are defined in component-registry.ts (SINGLE SOURCE OF TRUTH).
27
+ * This generator consumes that registry to ensure consistency across all schema generation.
28
+ */
29
+
30
+ /**
31
+ * Per-version props schema entry
32
+ */
33
+ interface VersionedPropsEntry {
34
+ version: string;
35
+ propsSchema: TSchema;
36
+ hasChildren?: boolean;
37
+ description?: string;
38
+ }
39
+ /**
40
+ * Custom component interface for plugins
41
+ */
42
+ interface CustomComponentInfo {
43
+ name: string;
44
+ propsSchema: TSchema;
45
+ /** When true, the component includes an optional `children` array */
46
+ hasChildren?: boolean;
47
+ /** Human-readable description shown in autocomplete */
48
+ description?: string;
49
+ /**
50
+ * Per-version props schemas for version-discriminated validation.
51
+ * When provided, separate schema variants are generated per version,
52
+ * each pairing its version literal with its specific props schema.
53
+ * A "no version" fallback variant uses the latest version's props.
54
+ */
55
+ versionedProps?: VersionedPropsEntry[];
56
+ }
57
+ /**
58
+ * Options for generating document schema
59
+ */
60
+ interface GenerateDocumentSchemaOptions {
61
+ includeStandardComponents?: boolean;
62
+ includeTheme?: boolean;
63
+ customComponents?: CustomComponentInfo[];
64
+ title?: string;
65
+ description?: string;
66
+ }
67
+ /**
68
+ * Generate a complete document schema with all components
69
+ *
70
+ * This is the SHARED IMPLEMENTATION used by:
71
+ * - Build-time schema generation (standard components only)
72
+ * - Runtime plugin schema generation (with custom components)
73
+ * - Web app schema generation (optimized for browser)
74
+ *
75
+ * @param options Configuration for what to include in the schema
76
+ * @returns TypeBox schema that can be converted to JSON Schema
77
+ */
78
+ declare function generateUnifiedDocumentSchema(options?: GenerateDocumentSchemaOptions): TSchema;
79
+
80
+ export { type CustomComponentInfo, type GenerateDocumentSchemaOptions, type VersionedPropsEntry, generateUnifiedDocumentSchema };
@@ -0,0 +1,9 @@
1
+ import {
2
+ generateUnifiedDocumentSchema
3
+ } from "../chunk-LWR4TFZ5.js";
4
+ import "../chunk-5533WPL6.js";
5
+ import "../chunk-F5LVWDTY.js";
6
+ export {
7
+ generateUnifiedDocumentSchema
8
+ };
9
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}