@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,364 @@
1
+ import {
2
+ ColumnsPropsSchema,
3
+ HeadingPropsSchema,
4
+ ImagePropsSchema,
5
+ IndentSchema,
6
+ ListPropsSchema,
7
+ ParagraphPropsSchema,
8
+ SectionPropsSchema,
9
+ StatisticPropsSchema,
10
+ TablePropsSchema
11
+ } from "./chunk-5533WPL6.js";
12
+ import {
13
+ FontDefinitionSchema,
14
+ HexColorSchema,
15
+ TextFormattingPropertiesSchema
16
+ } from "./chunk-F5LVWDTY.js";
17
+
18
+ // src/schemas/theme.ts
19
+ import { Type } from "@sinclair/typebox";
20
+ import { Value } from "@sinclair/typebox/value";
21
+ var DocumentMarginsSchema = Type.Object(
22
+ {
23
+ top: Type.Number({ minimum: 0 }),
24
+ bottom: Type.Number({ minimum: 0 }),
25
+ left: Type.Number({ minimum: 0 }),
26
+ right: Type.Number({ minimum: 0 }),
27
+ header: Type.Number({ minimum: 0 }),
28
+ footer: Type.Number({ minimum: 0 }),
29
+ gutter: Type.Number({ minimum: 0 })
30
+ },
31
+ { description: "Document margin configuration" }
32
+ );
33
+ var PageDimensionsSchema = Type.Object(
34
+ {
35
+ width: Type.Number({ minimum: 0 }),
36
+ height: Type.Number({ minimum: 0 })
37
+ },
38
+ { description: "Page dimensions in twips" }
39
+ );
40
+ var PageSchema = Type.Object(
41
+ {
42
+ size: Type.Union(
43
+ [
44
+ Type.Literal("A4"),
45
+ Type.Literal("A3"),
46
+ Type.Literal("LETTER"),
47
+ Type.Literal("LEGAL"),
48
+ Type.Object({
49
+ width: Type.Number({ minimum: 0 }),
50
+ height: Type.Number({ minimum: 0 })
51
+ })
52
+ ],
53
+ { description: "Standard page size or custom dimensions" }
54
+ ),
55
+ margins: DocumentMarginsSchema
56
+ },
57
+ {
58
+ description: "Page configuration including dimensions and margins",
59
+ additionalProperties: false
60
+ }
61
+ );
62
+ var FontsSchema = Type.Object(
63
+ {
64
+ heading: FontDefinitionSchema,
65
+ body: FontDefinitionSchema,
66
+ mono: FontDefinitionSchema,
67
+ light: FontDefinitionSchema
68
+ },
69
+ { description: "Font definitions for different text types" }
70
+ );
71
+ var BorderStyleSchema = Type.Union(
72
+ [
73
+ Type.Literal("single"),
74
+ Type.Literal("dashDotStroked"),
75
+ Type.Literal("dashed"),
76
+ Type.Literal("dashSmallGap"),
77
+ Type.Literal("dotDash"),
78
+ Type.Literal("dotDotDash"),
79
+ Type.Literal("dotted"),
80
+ Type.Literal("double"),
81
+ Type.Literal("doubleWave"),
82
+ Type.Literal("inset"),
83
+ Type.Literal("nil"),
84
+ Type.Literal("none"),
85
+ Type.Literal("outset"),
86
+ Type.Literal("thick"),
87
+ Type.Literal("thickThinLargeGap"),
88
+ Type.Literal("thickThinMediumGap"),
89
+ Type.Literal("thickThinSmallGap"),
90
+ Type.Literal("thinThickLargeGap"),
91
+ Type.Literal("thinThickMediumGap"),
92
+ Type.Literal("thinThickSmallGap"),
93
+ Type.Literal("thinThickThinLargeGap"),
94
+ Type.Literal("thinThickThinMediumGap"),
95
+ Type.Literal("thinThickThinSmallGap"),
96
+ Type.Literal("threeDEmboss"),
97
+ Type.Literal("threeDEngrave"),
98
+ Type.Literal("triple"),
99
+ Type.Literal("wave")
100
+ ],
101
+ { description: "Paragraph border style" }
102
+ );
103
+ var BorderDefinitionSchema = Type.Object(
104
+ {
105
+ style: BorderStyleSchema,
106
+ size: Type.Number({
107
+ minimum: 0,
108
+ description: "Width in eighths of a point (docx sz)"
109
+ }),
110
+ color: HexColorSchema,
111
+ space: Type.Optional(
112
+ Type.Number({
113
+ minimum: 0,
114
+ description: "Space between text and border in points"
115
+ })
116
+ )
117
+ },
118
+ {
119
+ additionalProperties: false,
120
+ description: "Paragraph border side definition"
121
+ }
122
+ );
123
+ var BordersSchema = Type.Object(
124
+ {
125
+ top: Type.Optional(BorderDefinitionSchema),
126
+ bottom: Type.Optional(BorderDefinitionSchema),
127
+ left: Type.Optional(BorderDefinitionSchema),
128
+ right: Type.Optional(BorderDefinitionSchema)
129
+ },
130
+ { additionalProperties: false, description: "Paragraph borders (per side)" }
131
+ );
132
+ var AlignmentSchema = Type.Optional(
133
+ Type.Union([
134
+ Type.Literal("left"),
135
+ Type.Literal("center"),
136
+ Type.Literal("right"),
137
+ Type.Literal("justify")
138
+ ])
139
+ );
140
+ var StylePropertiesSchema = Type.Object(
141
+ {
142
+ font: Type.Optional(
143
+ Type.Union([
144
+ Type.Literal("heading"),
145
+ Type.Literal("body"),
146
+ Type.Literal("mono"),
147
+ Type.Literal("light")
148
+ ])
149
+ ),
150
+ ...TextFormattingPropertiesSchema.properties,
151
+ // Paragraph-level alignment (not a font property)
152
+ alignment: AlignmentSchema,
153
+ // Additional properties specific to styles
154
+ priority: Type.Optional(Type.Number()),
155
+ baseStyle: Type.Optional(Type.String()),
156
+ followingStyle: Type.Optional(Type.String()),
157
+ widowControl: Type.Optional(Type.Boolean()),
158
+ keepNext: Type.Optional(Type.Boolean()),
159
+ keepLinesTogether: Type.Optional(Type.Boolean()),
160
+ outlineLevel: Type.Optional(Type.Number()),
161
+ borders: Type.Optional(BordersSchema),
162
+ indent: Type.Optional(IndentSchema)
163
+ },
164
+ { additionalProperties: false }
165
+ );
166
+ var TabStopLeaderSchema = Type.Union(
167
+ [
168
+ Type.Literal("dot"),
169
+ Type.Literal("hyphen"),
170
+ Type.Literal("middleDot"),
171
+ Type.Literal("none"),
172
+ Type.Literal("underscore")
173
+ ],
174
+ {
175
+ description: "Tab leader style: dot (dotted), hyphen (dashed), middleDot, none (blank), or underscore"
176
+ }
177
+ );
178
+ var TabStopTypeSchema = Type.Union(
179
+ [
180
+ Type.Literal("left"),
181
+ Type.Literal("right"),
182
+ Type.Literal("center"),
183
+ Type.Literal("bar"),
184
+ Type.Literal("clear"),
185
+ Type.Literal("decimal"),
186
+ Type.Literal("end"),
187
+ Type.Literal("num"),
188
+ Type.Literal("start")
189
+ ],
190
+ {
191
+ description: "Tab stop alignment type"
192
+ }
193
+ );
194
+ var TabStopDefinitionSchema = Type.Object(
195
+ {
196
+ type: TabStopTypeSchema,
197
+ position: Type.Union([
198
+ Type.Number({
199
+ description: "Tab stop position in twips (1/1440 inch). Common: 9026 for right-aligned at page margin"
200
+ }),
201
+ Type.Literal("max", {
202
+ description: "Use maximum position (TabStopPosition.MAX = 9026 twips)"
203
+ })
204
+ ]),
205
+ leader: Type.Optional(TabStopLeaderSchema)
206
+ },
207
+ {
208
+ description: "Tab stop configuration with position, alignment, and optional leader",
209
+ additionalProperties: false
210
+ }
211
+ );
212
+ var TocStylePropertiesSchema = Type.Object(
213
+ {
214
+ font: Type.Optional(
215
+ Type.Union([
216
+ Type.Literal("heading"),
217
+ Type.Literal("body"),
218
+ Type.Literal("mono"),
219
+ Type.Literal("light")
220
+ ])
221
+ ),
222
+ ...TextFormattingPropertiesSchema.properties,
223
+ // Paragraph-level alignment (not a font property)
224
+ alignment: AlignmentSchema,
225
+ // Tab stops for controlling TOC entry formatting (leader dots, alignment, etc.)
226
+ tabStops: Type.Optional(
227
+ Type.Array(TabStopDefinitionSchema, {
228
+ description: "Tab stops for TOC entries. Use right-aligned tab with leader to create dotted lines to page numbers.",
229
+ default: [{ type: "right", position: "max", leader: "none" }]
230
+ })
231
+ ),
232
+ // Additional properties specific to styles (baseStyle intentionally excluded)
233
+ priority: Type.Optional(Type.Number()),
234
+ followingStyle: Type.Optional(Type.String()),
235
+ widowControl: Type.Optional(Type.Boolean()),
236
+ keepNext: Type.Optional(Type.Boolean()),
237
+ keepLinesTogether: Type.Optional(Type.Boolean()),
238
+ outlineLevel: Type.Optional(Type.Number()),
239
+ borders: Type.Optional(BordersSchema),
240
+ indent: Type.Optional(IndentSchema)
241
+ },
242
+ { additionalProperties: false }
243
+ );
244
+ var StyleDefinitionsSchema = Type.Object(
245
+ {
246
+ normal: Type.Optional(StylePropertiesSchema),
247
+ heading1: Type.Optional(StylePropertiesSchema),
248
+ heading2: Type.Optional(StylePropertiesSchema),
249
+ heading3: Type.Optional(StylePropertiesSchema),
250
+ heading4: Type.Optional(StylePropertiesSchema),
251
+ heading5: Type.Optional(StylePropertiesSchema),
252
+ heading6: Type.Optional(StylePropertiesSchema),
253
+ title: Type.Optional(StylePropertiesSchema),
254
+ subtitle: Type.Optional(StylePropertiesSchema),
255
+ // TOC entry styles (used by Word to format TOC entries)
256
+ // Note: TOC styles use TocStylePropertiesSchema which excludes baseStyle to prevent coupling with Headings
257
+ TOC1: Type.Optional(TocStylePropertiesSchema),
258
+ TOC2: Type.Optional(TocStylePropertiesSchema),
259
+ TOC3: Type.Optional(TocStylePropertiesSchema),
260
+ TOC4: Type.Optional(TocStylePropertiesSchema),
261
+ TOC5: Type.Optional(TocStylePropertiesSchema),
262
+ TOC6: Type.Optional(TocStylePropertiesSchema)
263
+ },
264
+ {
265
+ additionalProperties: StylePropertiesSchema,
266
+ description: "Style definitions supporting predefined styles (normal, heading1..6, title, subtitle), TOC entry styles (TOC1..TOC6), and arbitrary custom styles."
267
+ }
268
+ );
269
+ var HeadingDefinitionSchema = Type.Object(
270
+ {
271
+ level: Type.Union([
272
+ Type.Literal(1),
273
+ Type.Literal(2),
274
+ Type.Literal(3),
275
+ Type.Literal(4),
276
+ Type.Literal(5),
277
+ Type.Literal(6)
278
+ ]),
279
+ ...StylePropertiesSchema.properties
280
+ },
281
+ { additionalProperties: false }
282
+ );
283
+ var HeadingComponentDefaultsSchema = Type.Partial(HeadingPropsSchema);
284
+ var ParagraphComponentDefaultsSchema = Type.Partial(ParagraphPropsSchema);
285
+ var ImageComponentDefaultsSchema = Type.Partial(ImagePropsSchema);
286
+ var StatisticComponentDefaultsSchema = Type.Partial(StatisticPropsSchema);
287
+ var TableComponentDefaultsSchema = Type.Partial(TablePropsSchema);
288
+ var SectionComponentDefaultsSchema = Type.Partial(SectionPropsSchema);
289
+ var ColumnsComponentDefaultsSchema = Type.Partial(ColumnsPropsSchema);
290
+ var ListComponentDefaultsSchema = Type.Partial(ListPropsSchema);
291
+ var ComponentDefaultsSchema = Type.Object(
292
+ {
293
+ heading: Type.Optional(HeadingComponentDefaultsSchema),
294
+ paragraph: Type.Optional(ParagraphComponentDefaultsSchema),
295
+ image: Type.Optional(ImageComponentDefaultsSchema),
296
+ statistic: Type.Optional(StatisticComponentDefaultsSchema),
297
+ table: Type.Optional(TableComponentDefaultsSchema),
298
+ section: Type.Optional(SectionComponentDefaultsSchema),
299
+ columns: Type.Optional(ColumnsComponentDefaultsSchema),
300
+ list: Type.Optional(ListComponentDefaultsSchema)
301
+ },
302
+ { additionalProperties: true }
303
+ // TODO: add a way to add strict custom component defaults when the plugin/registry paradigm will be implemented
304
+ );
305
+ var ThemeConfigSchema = Type.Object(
306
+ {
307
+ $schema: Type.Optional(Type.String()),
308
+ name: Type.String(),
309
+ displayName: Type.String(),
310
+ description: Type.String(),
311
+ version: Type.String(),
312
+ colors: Type.Object(
313
+ {
314
+ primary: HexColorSchema,
315
+ secondary: HexColorSchema,
316
+ accent: HexColorSchema,
317
+ text: HexColorSchema,
318
+ background: HexColorSchema,
319
+ border: HexColorSchema,
320
+ // Additional semantic color names
321
+ textPrimary: HexColorSchema,
322
+ textSecondary: HexColorSchema,
323
+ textMuted: HexColorSchema,
324
+ borderPrimary: HexColorSchema,
325
+ borderSecondary: HexColorSchema,
326
+ backgroundPrimary: HexColorSchema,
327
+ backgroundSecondary: HexColorSchema
328
+ },
329
+ { additionalProperties: false }
330
+ ),
331
+ fonts: FontsSchema,
332
+ page: PageSchema,
333
+ styles: Type.Optional(StyleDefinitionsSchema),
334
+ componentDefaults: Type.Optional(ComponentDefaultsSchema)
335
+ },
336
+ {
337
+ additionalProperties: false,
338
+ description: "Theme configuration"
339
+ }
340
+ );
341
+ function isValidThemeConfig(data) {
342
+ return Value.Check(ThemeConfigSchema, data);
343
+ }
344
+
345
+ export {
346
+ DocumentMarginsSchema,
347
+ PageDimensionsSchema,
348
+ PageSchema,
349
+ FontsSchema,
350
+ StyleDefinitionsSchema,
351
+ HeadingDefinitionSchema,
352
+ HeadingComponentDefaultsSchema,
353
+ ParagraphComponentDefaultsSchema,
354
+ ImageComponentDefaultsSchema,
355
+ StatisticComponentDefaultsSchema,
356
+ TableComponentDefaultsSchema,
357
+ SectionComponentDefaultsSchema,
358
+ ColumnsComponentDefaultsSchema,
359
+ ListComponentDefaultsSchema,
360
+ ComponentDefaultsSchema,
361
+ ThemeConfigSchema,
362
+ isValidThemeConfig
363
+ };
364
+ //# sourceMappingURL=chunk-BOUURUYX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/theme.ts"],"sourcesContent":["/**\n * Theme Schema Definitions using TypeBox\n * This file provides TypeBox schemas for theme configuration validation\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { FontDefinitionSchema, TextFormattingPropertiesSchema, HexColorSchema } from './font';\nimport { IndentSchema } from './components/common';\n\n// ============================================================================\n// Document Margins Schema\n// ============================================================================\n\nexport const DocumentMarginsSchema = Type.Object(\n {\n top: Type.Number({ minimum: 0 }),\n bottom: Type.Number({ minimum: 0 }),\n left: Type.Number({ minimum: 0 }),\n right: Type.Number({ minimum: 0 }),\n header: Type.Number({ minimum: 0 }),\n footer: Type.Number({ minimum: 0 }),\n gutter: Type.Number({ minimum: 0 }),\n },\n { description: 'Document margin configuration' }\n);\n\n// ============================================================================\n// Page Dimensions Schema\n// ============================================================================\n\nexport const PageDimensionsSchema = Type.Object(\n {\n width: Type.Number({ minimum: 0 }),\n height: Type.Number({ minimum: 0 }),\n },\n { description: 'Page dimensions in twips' }\n);\n\n// ============================================================================\n// Page Schema (replaces PageSetupSchema)\n// ============================================================================\n\nexport const PageSchema = Type.Object(\n {\n size: Type.Union(\n [\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 { description: 'Standard page size or custom dimensions' }\n ),\n margins: DocumentMarginsSchema,\n },\n {\n description: 'Page configuration including dimensions and margins',\n additionalProperties: false,\n }\n);\n\n// ============================================================================\n// Text formatting and font schemas now imported from './font' to avoid cycles\n\n// ============================================================================\n// Fonts Schema\n// ============================================================================\n\nexport const FontsSchema = Type.Object(\n {\n heading: FontDefinitionSchema,\n body: FontDefinitionSchema,\n mono: FontDefinitionSchema,\n light: FontDefinitionSchema,\n },\n { description: 'Font definitions for different text types' }\n);\n\n// ============================================================================\n// Style Definitions Schema\n// ============================================================================\n\n// Paragraph border style support (matches docx BorderStyle)\nconst BorderStyleSchema = Type.Union(\n [\n Type.Literal('single'),\n Type.Literal('dashDotStroked'),\n Type.Literal('dashed'),\n Type.Literal('dashSmallGap'),\n Type.Literal('dotDash'),\n Type.Literal('dotDotDash'),\n Type.Literal('dotted'),\n Type.Literal('double'),\n Type.Literal('doubleWave'),\n Type.Literal('inset'),\n Type.Literal('nil'),\n Type.Literal('none'),\n Type.Literal('outset'),\n Type.Literal('thick'),\n Type.Literal('thickThinLargeGap'),\n Type.Literal('thickThinMediumGap'),\n Type.Literal('thickThinSmallGap'),\n Type.Literal('thinThickLargeGap'),\n Type.Literal('thinThickMediumGap'),\n Type.Literal('thinThickSmallGap'),\n Type.Literal('thinThickThinLargeGap'),\n Type.Literal('thinThickThinMediumGap'),\n Type.Literal('thinThickThinSmallGap'),\n Type.Literal('threeDEmboss'),\n Type.Literal('threeDEngrave'),\n Type.Literal('triple'),\n Type.Literal('wave'),\n ],\n { description: 'Paragraph border style' }\n);\n\nconst BorderDefinitionSchema = Type.Object(\n {\n style: BorderStyleSchema,\n size: Type.Number({\n minimum: 0,\n description: 'Width in eighths of a point (docx sz)',\n }),\n color: HexColorSchema,\n space: Type.Optional(\n Type.Number({\n minimum: 0,\n description: 'Space between text and border in points',\n })\n ),\n },\n {\n additionalProperties: false,\n description: 'Paragraph border side definition',\n }\n);\n\nconst BordersSchema = Type.Object(\n {\n top: Type.Optional(BorderDefinitionSchema),\n bottom: Type.Optional(BorderDefinitionSchema),\n left: Type.Optional(BorderDefinitionSchema),\n right: Type.Optional(BorderDefinitionSchema),\n },\n { additionalProperties: false, description: 'Paragraph borders (per side)' }\n);\n\n// Alignment schema for paragraph-level alignment (used in styles)\nconst AlignmentSchema = Type.Optional(\n Type.Union([\n Type.Literal('left'),\n Type.Literal('center'),\n Type.Literal('right'),\n Type.Literal('justify'),\n ])\n);\n\n/**\n * Style properties schema that extends text formatting properties\n * with additional style-specific properties (priority, baseStyle, etc.)\n */\nconst StylePropertiesSchema = Type.Object(\n {\n font: Type.Optional(\n Type.Union([\n Type.Literal('heading'),\n Type.Literal('body'),\n Type.Literal('mono'),\n Type.Literal('light'),\n ])\n ),\n ...TextFormattingPropertiesSchema.properties,\n // Paragraph-level alignment (not a font property)\n alignment: AlignmentSchema,\n // Additional properties specific to styles\n priority: Type.Optional(Type.Number()),\n baseStyle: Type.Optional(Type.String()),\n followingStyle: Type.Optional(Type.String()),\n widowControl: Type.Optional(Type.Boolean()),\n keepNext: Type.Optional(Type.Boolean()),\n keepLinesTogether: Type.Optional(Type.Boolean()),\n outlineLevel: Type.Optional(Type.Number()),\n borders: Type.Optional(BordersSchema),\n indent: Type.Optional(IndentSchema),\n },\n { additionalProperties: false }\n);\n\n// ============================================================================\n// Tab Stop Schema\n// ============================================================================\n\n/**\n * Tab stop leader types matching docx.js LeaderType\n */\nconst TabStopLeaderSchema = Type.Union(\n [\n Type.Literal('dot'),\n Type.Literal('hyphen'),\n Type.Literal('middleDot'),\n Type.Literal('none'),\n Type.Literal('underscore'),\n ],\n {\n description:\n 'Tab leader style: dot (dotted), hyphen (dashed), middleDot, none (blank), or underscore',\n }\n);\n\n/**\n * Tab stop type matching docx.js TabStopType\n */\nconst TabStopTypeSchema = Type.Union(\n [\n Type.Literal('left'),\n Type.Literal('right'),\n Type.Literal('center'),\n Type.Literal('bar'),\n Type.Literal('clear'),\n Type.Literal('decimal'),\n Type.Literal('end'),\n Type.Literal('num'),\n Type.Literal('start'),\n ],\n {\n description: 'Tab stop alignment type',\n }\n);\n\n/**\n * Tab stop definition schema\n */\nconst TabStopDefinitionSchema = Type.Object(\n {\n type: TabStopTypeSchema,\n position: Type.Union([\n Type.Number({\n description:\n 'Tab stop position in twips (1/1440 inch). Common: 9026 for right-aligned at page margin',\n }),\n Type.Literal('max', {\n description: 'Use maximum position (TabStopPosition.MAX = 9026 twips)',\n }),\n ]),\n leader: Type.Optional(TabStopLeaderSchema),\n },\n {\n description:\n 'Tab stop configuration with position, alignment, and optional leader',\n additionalProperties: false,\n }\n);\n\n/**\n * TOC style properties schema that extends text formatting properties\n * but EXCLUDES baseStyle to prevent unwanted coupling with Heading styles\n */\nconst TocStylePropertiesSchema = Type.Object(\n {\n font: Type.Optional(\n Type.Union([\n Type.Literal('heading'),\n Type.Literal('body'),\n Type.Literal('mono'),\n Type.Literal('light'),\n ])\n ),\n ...TextFormattingPropertiesSchema.properties,\n // Paragraph-level alignment (not a font property)\n alignment: AlignmentSchema,\n // Tab stops for controlling TOC entry formatting (leader dots, alignment, etc.)\n tabStops: Type.Optional(\n Type.Array(TabStopDefinitionSchema, {\n description:\n 'Tab stops for TOC entries. Use right-aligned tab with leader to create dotted lines to page numbers.',\n default: [{ type: 'right', position: 'max', leader: 'none' }],\n })\n ),\n // Additional properties specific to styles (baseStyle intentionally excluded)\n priority: Type.Optional(Type.Number()),\n followingStyle: Type.Optional(Type.String()),\n widowControl: Type.Optional(Type.Boolean()),\n keepNext: Type.Optional(Type.Boolean()),\n keepLinesTogether: Type.Optional(Type.Boolean()),\n outlineLevel: Type.Optional(Type.Number()),\n borders: Type.Optional(BordersSchema),\n indent: Type.Optional(IndentSchema),\n },\n { additionalProperties: false }\n);\n\nexport const StyleDefinitionsSchema = Type.Object(\n {\n normal: Type.Optional(StylePropertiesSchema),\n heading1: Type.Optional(StylePropertiesSchema),\n heading2: Type.Optional(StylePropertiesSchema),\n heading3: Type.Optional(StylePropertiesSchema),\n heading4: Type.Optional(StylePropertiesSchema),\n heading5: Type.Optional(StylePropertiesSchema),\n heading6: Type.Optional(StylePropertiesSchema),\n title: Type.Optional(StylePropertiesSchema),\n subtitle: Type.Optional(StylePropertiesSchema),\n // TOC entry styles (used by Word to format TOC entries)\n // Note: TOC styles use TocStylePropertiesSchema which excludes baseStyle to prevent coupling with Headings\n TOC1: Type.Optional(TocStylePropertiesSchema),\n TOC2: Type.Optional(TocStylePropertiesSchema),\n TOC3: Type.Optional(TocStylePropertiesSchema),\n TOC4: Type.Optional(TocStylePropertiesSchema),\n TOC5: Type.Optional(TocStylePropertiesSchema),\n TOC6: Type.Optional(TocStylePropertiesSchema),\n },\n {\n additionalProperties: StylePropertiesSchema,\n description:\n 'Style definitions supporting predefined styles (normal, heading1..6, title, subtitle), TOC entry styles (TOC1..TOC6), and arbitrary custom styles.',\n }\n);\n\n// ============================================================================\n// Heading Definition Schema\n// ============================================================================\n\n/**\n * Heading definition schema that uses the same properties as StylePropertiesSchema\n * but adds a required 'level' field.\n */\nexport const HeadingDefinitionSchema = Type.Object(\n {\n level: Type.Union([\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 ...StylePropertiesSchema.properties,\n },\n { additionalProperties: false }\n);\n\n// ============================================================================\n// Component Defaults Schemas\n// ============================================================================\n\n// Import component props schemas from components.ts\nimport {\n HeadingPropsSchema,\n ParagraphPropsSchema,\n ImagePropsSchema,\n StatisticPropsSchema,\n TablePropsSchema,\n SectionPropsSchema,\n ColumnsPropsSchema,\n ListPropsSchema,\n} from './components';\n\n// Create component defaults by making all fields optional (Type.Partial)\nexport const HeadingComponentDefaultsSchema = Type.Partial(HeadingPropsSchema);\nexport const ParagraphComponentDefaultsSchema =\n Type.Partial(ParagraphPropsSchema);\nexport const ImageComponentDefaultsSchema = Type.Partial(ImagePropsSchema);\nexport const StatisticComponentDefaultsSchema =\n Type.Partial(StatisticPropsSchema);\nexport const TableComponentDefaultsSchema = Type.Partial(TablePropsSchema);\nexport const SectionComponentDefaultsSchema = Type.Partial(SectionPropsSchema);\nexport const ColumnsComponentDefaultsSchema = Type.Partial(ColumnsPropsSchema);\nexport const ListComponentDefaultsSchema = Type.Partial(ListPropsSchema);\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// ============================================================================\n// Theme Config Schema\n// ============================================================================\n\nexport const ThemeConfigSchema = Type.Object(\n {\n $schema: Type.Optional(Type.String()),\n name: Type.String(),\n displayName: Type.String(),\n description: Type.String(),\n version: Type.String(),\n colors: Type.Object(\n {\n primary: HexColorSchema,\n secondary: HexColorSchema,\n accent: HexColorSchema,\n text: HexColorSchema,\n background: HexColorSchema,\n border: HexColorSchema,\n // Additional semantic color names\n textPrimary: HexColorSchema,\n textSecondary: HexColorSchema,\n textMuted: HexColorSchema,\n borderPrimary: HexColorSchema,\n borderSecondary: HexColorSchema,\n backgroundPrimary: HexColorSchema,\n backgroundSecondary: HexColorSchema,\n },\n { additionalProperties: false }\n ),\n fonts: FontsSchema,\n page: PageSchema,\n styles: Type.Optional(StyleDefinitionsSchema),\n componentDefaults: Type.Optional(ComponentDefaultsSchema),\n },\n {\n additionalProperties: false,\n description: 'Theme configuration',\n }\n);\n\n// ============================================================================\n// TypeScript Types\n// ============================================================================\n\nexport type ThemeConfigJson = Static<typeof ThemeConfigSchema>;\nexport type DocumentMargins = Static<typeof DocumentMarginsSchema>;\nexport type PageDimensions = Static<typeof PageDimensionsSchema>;\nexport type Page = Static<typeof PageSchema>;\nexport type FontDefinition = Static<typeof FontDefinitionSchema>;\nexport type Fonts = Static<typeof FontsSchema>;\nexport type StyleDefinitions = Static<typeof StyleDefinitionsSchema>;\nexport type HeadingDefinition = Static<typeof HeadingDefinitionSchema>;\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// ============================================================================\n// Validation Function\n// ============================================================================\n\nimport { Value } from '@sinclair/typebox/value';\n\nexport function isValidThemeConfig(data: unknown): data is ThemeConfigJson {\n return Value.Check(ThemeConfigSchema, data);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,SAAS,YAAoB;AA+c7B,SAAS,aAAa;AAvcf,IAAM,wBAAwB,KAAK;AAAA,EACxC;AAAA,IACE,KAAK,KAAK,OAAO,EAAE,SAAS,EAAE,CAAC;AAAA,IAC/B,QAAQ,KAAK,OAAO,EAAE,SAAS,EAAE,CAAC;AAAA,IAClC,MAAM,KAAK,OAAO,EAAE,SAAS,EAAE,CAAC;AAAA,IAChC,OAAO,KAAK,OAAO,EAAE,SAAS,EAAE,CAAC;AAAA,IACjC,QAAQ,KAAK,OAAO,EAAE,SAAS,EAAE,CAAC;AAAA,IAClC,QAAQ,KAAK,OAAO,EAAE,SAAS,EAAE,CAAC;AAAA,IAClC,QAAQ,KAAK,OAAO,EAAE,SAAS,EAAE,CAAC;AAAA,EACpC;AAAA,EACA,EAAE,aAAa,gCAAgC;AACjD;AAMO,IAAM,uBAAuB,KAAK;AAAA,EACvC;AAAA,IACE,OAAO,KAAK,OAAO,EAAE,SAAS,EAAE,CAAC;AAAA,IACjC,QAAQ,KAAK,OAAO,EAAE,SAAS,EAAE,CAAC;AAAA,EACpC;AAAA,EACA,EAAE,aAAa,2BAA2B;AAC5C;AAMO,IAAM,aAAa,KAAK;AAAA,EAC7B;AAAA,IACE,MAAM,KAAK;AAAA,MACT;AAAA,QACE,KAAK,QAAQ,IAAI;AAAA,QACjB,KAAK,QAAQ,IAAI;AAAA,QACjB,KAAK,QAAQ,QAAQ;AAAA,QACrB,KAAK,QAAQ,OAAO;AAAA,QACpB,KAAK,OAAO;AAAA,UACV,OAAO,KAAK,OAAO,EAAE,SAAS,EAAE,CAAC;AAAA,UACjC,QAAQ,KAAK,OAAO,EAAE,SAAS,EAAE,CAAC;AAAA,QACpC,CAAC;AAAA,MACH;AAAA,MACA,EAAE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@sinclair/typebox";
7
+ var GenerateDocumentRequestSchema = Type.Object(
8
+ {
9
+ definition: ComponentDefinitionSchema,
10
+ format: Type.Optional(
11
+ Type.Union([
12
+ Type.Literal("docx"),
13
+ Type.Literal("pdf"),
14
+ Type.Literal("html")
15
+ ])
16
+ ),
17
+ options: Type.Optional(
18
+ Type.Object(
19
+ {
20
+ includeMetadata: Type.Optional(Type.Boolean()),
21
+ includeComments: Type.Optional(Type.Boolean()),
22
+ trackChanges: Type.Optional(Type.Boolean())
23
+ },
24
+ { additionalProperties: true }
25
+ )
26
+ )
27
+ },
28
+ {
29
+ additionalProperties: false,
30
+ description: "Document generation request"
31
+ }
32
+ );
33
+ var ValidateDocumentRequestSchema = Type.Object(
34
+ {
35
+ definition: Type.Unknown(),
36
+ strict: Type.Optional(Type.Boolean())
37
+ },
38
+ {
39
+ additionalProperties: false,
40
+ description: "Document validation request"
41
+ }
42
+ );
43
+ var GenerateDocumentResponseSchema = Type.Object(
44
+ {
45
+ success: Type.Boolean(),
46
+ documentId: Type.Optional(Type.String()),
47
+ downloadUrl: Type.Optional(Type.String()),
48
+ error: Type.Optional(Type.String()),
49
+ metadata: Type.Optional(
50
+ Type.Object(
51
+ {
52
+ pageCount: Type.Optional(Type.Number()),
53
+ wordCount: Type.Optional(Type.Number()),
54
+ generatedAt: Type.Optional(Type.String({ format: "date-time" }))
55
+ },
56
+ { additionalProperties: true }
57
+ )
58
+ )
59
+ },
60
+ {
61
+ additionalProperties: false,
62
+ description: "Document generation response"
63
+ }
64
+ );
65
+ var ValidateDocumentResponseSchema = Type.Object(
66
+ {
67
+ valid: Type.Boolean(),
68
+ errors: Type.Array(
69
+ Type.Object({
70
+ path: Type.String(),
71
+ message: Type.String(),
72
+ code: Type.Optional(Type.String())
73
+ })
74
+ ),
75
+ warnings: Type.Optional(
76
+ Type.Array(
77
+ Type.Object({
78
+ path: Type.String(),
79
+ message: Type.String(),
80
+ code: Type.Optional(Type.String())
81
+ })
82
+ )
83
+ )
84
+ },
85
+ {
86
+ additionalProperties: false,
87
+ description: "Document validation response"
88
+ }
89
+ );
90
+
91
+ export {
92
+ GenerateDocumentRequestSchema,
93
+ ValidateDocumentRequestSchema,
94
+ GenerateDocumentResponseSchema,
95
+ ValidateDocumentResponseSchema
96
+ };
97
+ //# sourceMappingURL=chunk-EKWM2CWA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/api.ts"],"sourcesContent":["/**\n * API Schema Definitions using TypeBox\n * This file provides TypeBox schemas for API request/response validation\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { ComponentDefinitionSchema } from './components';\n\n// ============================================================================\n// API Request Schemas\n// ============================================================================\n\nexport const GenerateDocumentRequestSchema = Type.Object(\n {\n definition: ComponentDefinitionSchema,\n format: Type.Optional(\n Type.Union([\n Type.Literal('docx'),\n Type.Literal('pdf'),\n Type.Literal('html'),\n ])\n ),\n options: Type.Optional(\n Type.Object(\n {\n includeMetadata: Type.Optional(Type.Boolean()),\n includeComments: Type.Optional(Type.Boolean()),\n trackChanges: Type.Optional(Type.Boolean()),\n },\n { additionalProperties: true }\n )\n ),\n },\n {\n additionalProperties: false,\n description: 'Document generation request',\n }\n);\n\nexport const ValidateDocumentRequestSchema = Type.Object(\n {\n definition: Type.Unknown(),\n strict: Type.Optional(Type.Boolean()),\n },\n {\n additionalProperties: false,\n description: 'Document validation request',\n }\n);\n\n// ============================================================================\n// API Response Schemas\n// ============================================================================\n\nexport const GenerateDocumentResponseSchema = Type.Object(\n {\n success: Type.Boolean(),\n documentId: Type.Optional(Type.String()),\n downloadUrl: Type.Optional(Type.String()),\n error: Type.Optional(Type.String()),\n metadata: Type.Optional(\n Type.Object(\n {\n pageCount: Type.Optional(Type.Number()),\n wordCount: Type.Optional(Type.Number()),\n generatedAt: Type.Optional(Type.String({ format: 'date-time' })),\n },\n { additionalProperties: true }\n )\n ),\n },\n {\n additionalProperties: false,\n description: 'Document generation response',\n }\n);\n\nexport const ValidateDocumentResponseSchema = Type.Object(\n {\n valid: Type.Boolean(),\n errors: Type.Array(\n Type.Object({\n path: Type.String(),\n message: Type.String(),\n code: Type.Optional(Type.String()),\n })\n ),\n warnings: Type.Optional(\n Type.Array(\n Type.Object({\n path: Type.String(),\n message: Type.String(),\n code: Type.Optional(Type.String()),\n })\n )\n ),\n },\n {\n additionalProperties: false,\n description: 'Document validation response',\n }\n);\n\n// ============================================================================\n// TypeScript Types\n// ============================================================================\n\nexport type GenerateDocumentRequest = Static<\n typeof GenerateDocumentRequestSchema\n>;\nexport type ValidateDocumentRequest = Static<\n typeof ValidateDocumentRequestSchema\n>;\nexport type GenerateDocumentResponse = Static<\n typeof GenerateDocumentResponseSchema\n>;\nexport type ValidateDocumentResponse = Static<\n typeof ValidateDocumentResponseSchema\n>;\n"],"mappings":";;;;;AAKA,SAAS,YAAoB;AAOtB,IAAM,gCAAgC,KAAK;AAAA,EAChD;AAAA,IACE,YAAY;AAAA,IACZ,QAAQ,KAAK;AAAA,MACX,KAAK,MAAM;AAAA,QACT,KAAK,QAAQ,MAAM;AAAA,QACnB,KAAK,QAAQ,KAAK;AAAA,QAClB,KAAK,QAAQ,MAAM;AAAA,MACrB,CAAC;AAAA,IACH;AAAA,IACA,SAAS,KAAK;AAAA,MACZ,KAAK;AAAA,QACH;AAAA,UACE,iBAAiB,KAAK,SAAS,KAAK,QAAQ,CAAC;AAAA,UAC7C,iBAAiB,KAAK,SAAS,KAAK,QAAQ,CAAC;AAAA,UAC7C,cAAc,KAAK,SAAS,KAAK,QAAQ,CAAC;AAAA,QAC5C;AAAA,QACA,EAAE,sBAAsB,KAAK;AAAA,MAC/B;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,sBAAsB;AAAA,IACtB,aAAa;AAAA,EACf;AACF;AAEO,IAAM,gCAAgC,KAAK;AAAA,EAChD;AAAA,IACE,YAAY,KAAK,QAAQ;AAAA,IACzB,QAAQ,KAAK,SAAS,KAAK,QAAQ,CAAC;AAAA,EACtC;AAAA,E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chunk-5533WPL6.js";
4
+
5
+ // src/schemas/components.ts
6
+ import { Type } from "@sinclair/typebox";
7
+ var StandardComponentDefinitionSchema = Type.Union(
8
+ // Use Type.Any() for non-recursive standard components
9
+ // Convert readonly array to mutable array for Type.Union
10
+ [...createAllComponentSchemas(Type.Any())],
11
+ {
12
+ discriminator: { propertyName: "name" },
13
+ description: "Standard component definition with discriminated union"
14
+ }
15
+ );
16
+ var ComponentDefinitionSchema = Type.Recursive(
17
+ (This) => Type.Union(
18
+ [
19
+ // Standard components from registry - SINGLE SOURCE OF TRUTH
20
+ // Note: Report and section use special factory functions with recursive refs
21
+ // Convert readonly array to mutable array for Type.Union
22
+ ...createAllComponentSchemas(This)
23
+ ],
24
+ {
25
+ discriminator: { propertyName: "name" },
26
+ description: "Component definition with discriminated union"
27
+ }
28
+ )
29
+ );
30
+
31
+ export {
32
+ StandardComponentDefinitionSchema,
33
+ ComponentDefinitionSchema
34
+ };
35
+ //# sourceMappingURL=chunk-ET6YMNMF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/components.ts"],"sourcesContent":["/**\n * TypeBox Component Schemas\n *\n * Complete component definitions with discriminated unions for perfect\n * JSON schema autocompletion and validation.\n *\n * IMPORTANT: Standard components are defined in component-registry.ts (SINGLE SOURCE OF TRUTH).\n * This file uses that registry to generate TypeBox schemas.\n */\n\nimport { Type, Static } from '@sinclair/typebox';\nimport { createAllComponentSchemas } from './component-registry';\n\n// Re-export all schemas from individual component files\nexport * from './components/common';\nexport * from './components/report';\nexport * from './components/section';\nexport * from './components/columns';\nexport * from './components/heading';\nexport * from './components/paragraph';\nexport * from './components/image';\nexport * from './components/highcharts';\nexport * from './components/statistic';\nexport * from './components/table';\nexport * from './components/header';\nexport * from './components/footer';\nexport * from './components/list';\nexport * from './components/toc';\nexport * from './components/text-box';\n\n// ============================================================================\n// Component Definitions with Discriminated Union\n// ============================================================================\n\n// StandardComponentDefinitionSchema - Union of all standard component types\n// Generated from the component registry (SINGLE SOURCE OF TRUTH)\nexport const StandardComponentDefinitionSchema = Type.Union(\n // Use Type.Any() for non-recursive standard components\n // Convert readonly array to mutable array for Type.Union\n [...createAllComponentSchemas(Type.Any())],\n {\n discriminator: { propertyName: 'name' },\n description:\n 'Standard component definition with discriminated union',\n }\n);\n\nexport const ComponentDefinitionSchema = Type.Recursive((This) =>\n Type.Union(\n [\n // Standard components from registry - SINGLE SOURCE OF TRUTH\n // Note: Report and section use special factory functions with recursive refs\n // Convert readonly array to mutable array for Type.Union\n ...createAllComponentSchemas(This),\n ],\n {\n discriminator: { propertyName: 'name' },\n description: 'Component definition with discriminated union',\n }\n )\n);\n\n// ============================================================================\n// TypeScript Types\n// ============================================================================\n\nexport type ComponentDefinition = Static<typeof ComponentDefinitionSchema>;\n"],"mappings":";;;;;AAUA,SAAS,YAAoB;AA0BtB,IAAM,oCAAoC,KAAK;AAAA;AAAA;AAAA,EAGpD,CAAC,GAAG,0BAA0B,KAAK,IAAI,CAAC,CAAC;AAAA,EACzC;AAAA,IACE,eAAe,EAAE,cAAc,OAAO;AAAA,IACtC,aACE;AAAA,EACJ;AACF;AAEO,IAAM,4BAA4B,KAAK;AAAA,EAAU,CAAC,SACvD,KAAK;AAAA,IACH;AAAA;AAAA;AAAA;AAAA,MAIE,GAAG,0BAA0B,IAAI;AAAA,IACnC;AAAA,IACA;AAAA,MACE,eAAe,EAAE,cAAc,OAAO;AAAA,MACtC,aAAa;AAAA,IACf;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,57 @@
1
+ // src/schemas/font.ts
2
+ import { Type } from "@sinclair/typebox";
3
+ var HexColorSchema = Type.String({
4
+ pattern: "^(#[0-9A-Fa-f]{6}|[a-zA-Z][a-zA-Z0-9]*)$",
5
+ description: 'Hex color with # prefix (e.g. "#000000") or theme color name'
6
+ });
7
+ var TextFormattingPropertiesSchema = Type.Object(
8
+ {
9
+ size: Type.Optional(Type.Number({ minimum: 8, maximum: 72 })),
10
+ color: Type.Optional(HexColorSchema),
11
+ bold: Type.Optional(Type.Boolean()),
12
+ italic: Type.Optional(Type.Boolean()),
13
+ underline: Type.Optional(Type.Boolean()),
14
+ lineSpacing: Type.Optional(
15
+ Type.Object({
16
+ type: Type.Union([
17
+ Type.Literal("single"),
18
+ Type.Literal("atLeast"),
19
+ Type.Literal("exactly"),
20
+ Type.Literal("double"),
21
+ Type.Literal("multiple")
22
+ ]),
23
+ value: Type.Optional(Type.Number({ minimum: 0 }))
24
+ })
25
+ ),
26
+ spacing: Type.Optional(
27
+ Type.Object({
28
+ before: Type.Optional(Type.Number({ minimum: 0 })),
29
+ after: Type.Optional(Type.Number({ minimum: 0 }))
30
+ })
31
+ ),
32
+ characterSpacing: Type.Optional(
33
+ Type.Object({
34
+ type: Type.Union([Type.Literal("condensed"), Type.Literal("expanded")]),
35
+ value: Type.Number()
36
+ })
37
+ )
38
+ },
39
+ { additionalProperties: false }
40
+ );
41
+ var FontDefinitionSchema = Type.Object(
42
+ {
43
+ family: Type.String(),
44
+ ...TextFormattingPropertiesSchema.properties
45
+ },
46
+ {
47
+ description: "Font definition with family and optional formatting properties",
48
+ additionalProperties: false
49
+ }
50
+ );
51
+
52
+ export {
53
+ HexColorSchema,
54
+ TextFormattingPropertiesSchema,
55
+ FontDefinitionSchema
56
+ };
57
+ //# sourceMappingURL=chunk-F5LVWDTY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/font.ts"],"sourcesContent":["/**\n * Font-related Schemas (shared)\n * Extracted to avoid circular dependencies between theme and module schemas.\n */\n\nimport { Type } from '@sinclair/typebox';\n\n// ----------------------------------------------------------------------------\n// Shared Color Schema\n// ----------------------------------------------------------------------------\n\n/** Hex color with # prefix (e.g. \"#000000\") or a theme color name (e.g. \"primary\") */\nexport const HexColorSchema = Type.String({\n pattern: '^(#[0-9A-Fa-f]{6}|[a-zA-Z][a-zA-Z0-9]*)$',\n description: 'Hex color with # prefix (e.g. \"#000000\") or theme color name',\n});\n\n// ----------------------------------------------------------------------------\n// Shared Text Formatting Properties\n// ----------------------------------------------------------------------------\n\n/**\n * Shared schema for text formatting properties.\n * Used as base for both font definitions and style definitions.\n */\nexport const TextFormattingPropertiesSchema = Type.Object(\n {\n size: Type.Optional(Type.Number({ minimum: 8, maximum: 72 })),\n color: Type.Optional(HexColorSchema),\n bold: Type.Optional(Type.Boolean()),\n italic: Type.Optional(Type.Boolean()),\n underline: Type.Optional(Type.Boolean()),\n lineSpacing: Type.Optional(\n Type.Object({\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 ),\n spacing: Type.Optional(\n Type.Object({\n before: Type.Optional(Type.Number({ minimum: 0 })),\n after: Type.Optional(Type.Number({ minimum: 0 })),\n })\n ),\n characterSpacing: Type.Optional(\n Type.Object({\n type: Type.Union([Type.Literal('condensed'), Type.Literal('expanded')]),\n value: Type.Number(),\n })\n ),\n },\n { additionalProperties: false }\n);\n\n// ----------------------------------------------------------------------------\n// Font Definition Schema\n// ----------------------------------------------------------------------------\n\n/**\n * Font definition schema with full text formatting properties.\n * All properties except 'family' are optional.\n */\nexport const FontDefinitionSchema = Type.Object(\n {\n family: Type.String(),\n ...TextFormattingPropertiesSchema.properties,\n },\n {\n description:\n 'Font definition with family and optional formatting properties',\n additionalProperties: false,\n }\n);\n"],"mappings":";AAKA,SAAS,YAAY;AAOd,IAAM,iBAAiB,KAAK,OAAO;AAAA,EACxC,SAAS;AAAA,EACT,aAAa;AACf,CAAC;AAUM,IAAM,iCAAiC,KAAK;AAAA,EACjD;AAAA,IACE,MAAM,KAAK,SAAS,KAAK,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,CAAC,CAAC;AAAA,IAC5D,OAAO,KAAK,SAAS,cAAc;AAAA,IACnC,MAAM,KAAK,SAAS,KAAK,QAAQ,CAAC;AAAA,IAClC,QAAQ,KAAK,SAAS,KA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