@json-to-office/shared-docx 1.0.0 → 1.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 (49) hide show
  1. package/dist/{chunk-ZC2I7CTZ.js → chunk-45I2NASU.js} +5 -3
  2. package/dist/{chunk-ZC2I7CTZ.js.map → chunk-45I2NASU.js.map} +1 -1
  3. package/dist/chunk-5KOKA5GY.js +687 -0
  4. package/dist/chunk-5KOKA5GY.js.map +1 -0
  5. package/dist/{chunk-MG2PLA6W.js → chunk-6B3LHADB.js} +2 -2
  6. package/dist/{chunk-NZO5SZUO.js → chunk-6HFF6XZN.js} +44 -7
  7. package/dist/chunk-6HFF6XZN.js.map +1 -0
  8. package/dist/{chunk-V4HZOLMN.js → chunk-6YMJWMEC.js} +34 -18
  9. package/dist/chunk-6YMJWMEC.js.map +1 -0
  10. package/dist/{chunk-WXG3FQ5V.js → chunk-A2K66URO.js} +30 -151
  11. package/dist/chunk-A2K66URO.js.map +1 -0
  12. package/dist/{chunk-G3XK537A.js → chunk-BBFR3RRN.js} +14 -8
  13. package/dist/chunk-BBFR3RRN.js.map +1 -0
  14. package/dist/{chunk-NAVRPVTN.js → chunk-LBXOAXMG.js} +6 -6
  15. package/dist/{chunk-VEF4T6PL.js → chunk-MYLVUQCN.js} +2 -2
  16. package/dist/chunk-OP5PCDNN.js +1272 -0
  17. package/dist/chunk-OP5PCDNN.js.map +1 -0
  18. package/dist/{chunk-GT3MN2RI.js → chunk-TODYYVZ4.js} +2 -2
  19. package/dist/chunk-VX2J2KWA.js +465 -0
  20. package/dist/chunk-VX2J2KWA.js.map +1 -0
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.js +52 -28
  23. package/dist/index.js.map +1 -1
  24. package/dist/schemas/api.js +7 -6
  25. package/dist/schemas/component-defaults.js +2 -1
  26. package/dist/schemas/component-registry.js +5 -4
  27. package/dist/schemas/components.d.ts +1092 -4
  28. package/dist/schemas/components.js +72 -27
  29. package/dist/schemas/document.js +8 -7
  30. package/dist/schemas/export.d.ts +8 -2
  31. package/dist/schemas/export.js +6 -5
  32. package/dist/schemas/generator.js +6 -5
  33. package/dist/schemas/renderer.d.ts +21 -3
  34. package/dist/schemas/renderer.js +5 -1
  35. package/dist/schemas/theme.js +3 -2
  36. package/dist/validation/unified/index.js +8 -7
  37. package/package.json +2 -2
  38. package/dist/chunk-2YUAD26Q.js +0 -1718
  39. package/dist/chunk-2YUAD26Q.js.map +0 -1
  40. package/dist/chunk-G3XK537A.js.map +0 -1
  41. package/dist/chunk-NZO5SZUO.js.map +0 -1
  42. package/dist/chunk-T7P4TA7I.js +0 -89
  43. package/dist/chunk-T7P4TA7I.js.map +0 -1
  44. package/dist/chunk-V4HZOLMN.js.map +0 -1
  45. package/dist/chunk-WXG3FQ5V.js.map +0 -1
  46. /package/dist/{chunk-MG2PLA6W.js.map → chunk-6B3LHADB.js.map} +0 -0
  47. /package/dist/{chunk-NAVRPVTN.js.map → chunk-LBXOAXMG.js.map} +0 -0
  48. /package/dist/{chunk-VEF4T6PL.js.map → chunk-MYLVUQCN.js.map} +0 -0
  49. /package/dist/{chunk-GT3MN2RI.js.map → chunk-TODYYVZ4.js.map} +0 -0
@@ -1,1718 +0,0 @@
1
- import {
2
- FontDefinitionSchema,
3
- HexColorOrTransparentSchema,
4
- HexColorSchema,
5
- LanguageSchema,
6
- NoProofSchema,
7
- NoProofWordsSchema
8
- } from "./chunk-7TTAAYQ5.js";
9
-
10
- // src/schemas/component-defaults.ts
11
- import { Type as Type13 } from "@sinclair/typebox";
12
-
13
- // src/schemas/components/heading.ts
14
- import { Type as Type4 } from "@sinclair/typebox";
15
-
16
- // src/schemas/components/common.ts
17
- import { Type } from "@sinclair/typebox";
18
- var AlignmentSchema = Type.Union(
19
- [Type.Literal("left"), Type.Literal("center"), Type.Literal("right")],
20
- { description: "Text alignment options" }
21
- );
22
- var JustifiedAlignmentSchema = Type.Union(
23
- [
24
- Type.Literal("left"),
25
- Type.Literal("center"),
26
- Type.Literal("right"),
27
- Type.Literal("justify")
28
- ],
29
- { description: "Text alignment options including justify" }
30
- );
31
- var HeadingLevelSchema = Type.Union(
32
- [
33
- Type.Literal(1),
34
- Type.Literal(2),
35
- Type.Literal(3),
36
- Type.Literal(4),
37
- Type.Literal(5),
38
- Type.Literal(6)
39
- ],
40
- { description: "Heading level (1-6)" }
41
- );
42
- var SpacingSchema = Type.Object(
43
- {
44
- before: Type.Optional(
45
- Type.Number({
46
- minimum: 0,
47
- description: "Spacing before element in points"
48
- })
49
- ),
50
- after: Type.Optional(
51
- Type.Number({
52
- minimum: 0,
53
- description: "Spacing after element in points"
54
- })
55
- )
56
- },
57
- {
58
- description: "Spacing configuration",
59
- additionalProperties: false
60
- }
61
- );
62
- var ListSpacingSchema = Type.Object(
63
- {
64
- before: Type.Optional(
65
- Type.Number({
66
- minimum: 0,
67
- description: "Spacing before list in points"
68
- })
69
- ),
70
- after: Type.Optional(
71
- Type.Number({
72
- minimum: 0,
73
- description: "Spacing after list in points"
74
- })
75
- ),
76
- item: Type.Optional(
77
- Type.Number({
78
- minimum: 0,
79
- description: "Spacing between list items in points"
80
- })
81
- )
82
- },
83
- {
84
- description: "List spacing configuration with item spacing",
85
- additionalProperties: false
86
- }
87
- );
88
- var MarginsSchema = Type.Object(
89
- {
90
- top: Type.Optional(Type.Number({ minimum: 0 })),
91
- bottom: Type.Optional(Type.Number({ minimum: 0 })),
92
- left: Type.Optional(Type.Number({ minimum: 0 })),
93
- right: Type.Optional(Type.Number({ minimum: 0 }))
94
- },
95
- { description: "Margin configuration", additionalProperties: false }
96
- );
97
- var BorderSchema = Type.Object(
98
- {
99
- style: Type.Optional(
100
- Type.Union([
101
- Type.Literal("solid"),
102
- Type.Literal("dashed"),
103
- Type.Literal("dotted"),
104
- Type.Literal("double"),
105
- Type.Literal("none")
106
- ])
107
- ),
108
- width: Type.Optional(Type.Number({ minimum: 0 })),
109
- color: Type.Optional(HexColorSchema)
110
- },
111
- { description: "Border configuration", additionalProperties: false }
112
- );
113
- var LineSpacingSchema = Type.Object(
114
- {
115
- type: Type.Union([
116
- Type.Literal("single"),
117
- Type.Literal("atLeast"),
118
- Type.Literal("exactly"),
119
- Type.Literal("double"),
120
- Type.Literal("multiple")
121
- ]),
122
- value: Type.Optional(Type.Number({ minimum: 0 }))
123
- },
124
- { description: "Line spacing configuration", additionalProperties: false }
125
- );
126
- var IndentSchema = Type.Object(
127
- {
128
- left: Type.Optional(Type.Number({ minimum: 0 })),
129
- hanging: Type.Optional(Type.Number({ minimum: 0 }))
130
- },
131
- { description: "Indentation configuration", additionalProperties: false }
132
- );
133
- var ParagraphIndentSchema = Type.Object(
134
- {
135
- left: Type.Optional(
136
- Type.Number({
137
- description: "Left indentation in twips (1/20 of a point)"
138
- })
139
- ),
140
- right: Type.Optional(
141
- Type.Number({
142
- description: "Right indentation in twips (1/20 of a point)"
143
- })
144
- ),
145
- hanging: Type.Optional(
146
- Type.Number({
147
- minimum: 0,
148
- description: "Hanging indent in twips: first line stays at the left indent, following lines are indented. Mutually exclusive with firstLine."
149
- })
150
- ),
151
- firstLine: Type.Optional(
152
- Type.Number({
153
- minimum: 0,
154
- description: "First-line indent in twips: only the first line is indented. Mutually exclusive with hanging."
155
- })
156
- )
157
- },
158
- {
159
- description: "Paragraph indentation (w:ind) in twips. Use either hanging or firstLine, not both.",
160
- additionalProperties: false
161
- }
162
- );
163
- var TabStopTypeSchema = Type.Union(
164
- [
165
- Type.Literal("left"),
166
- Type.Literal("right"),
167
- Type.Literal("center"),
168
- Type.Literal("decimal"),
169
- Type.Literal("bar")
170
- ],
171
- { description: "Tab stop alignment type" }
172
- );
173
- var TabStopLeaderSchema = Type.Union(
174
- [
175
- Type.Literal("dot"),
176
- Type.Literal("hyphen"),
177
- Type.Literal("underscore"),
178
- Type.Literal("middleDot"),
179
- Type.Literal("none")
180
- ],
181
- { description: "Leader character filling the space before the tab stop" }
182
- );
183
- var TabStopSchema = Type.Object(
184
- {
185
- type: TabStopTypeSchema,
186
- position: Type.Number({
187
- minimum: 0,
188
- description: "Tab stop position in twips (1/20 of a point)"
189
- }),
190
- leader: Type.Optional(TabStopLeaderSchema)
191
- },
192
- {
193
- description: "Tab stop definition (w:tab in w:tabs)",
194
- additionalProperties: false
195
- }
196
- );
197
- var TabStopsSchema = Type.Array(TabStopSchema, {
198
- description: "Tab stops for the paragraph. Tab characters (\\t) in the text jump to these positions."
199
- });
200
- var HorizontalPositionRelativeFromSchema = Type.Union(
201
- [
202
- Type.Literal("character"),
203
- Type.Literal("column"),
204
- Type.Literal("margin"),
205
- Type.Literal("page"),
206
- Type.Literal("text")
207
- // VML compatibility for text-box
208
- ],
209
- {
210
- description: "Horizontal position relative to"
211
- }
212
- );
213
- var VerticalPositionRelativeFromSchema = Type.Union(
214
- [
215
- Type.Literal("margin"),
216
- Type.Literal("page"),
217
- Type.Literal("paragraph"),
218
- Type.Literal("line"),
219
- Type.Literal("text")
220
- // VML compatibility for text-box
221
- ],
222
- {
223
- description: "Vertical position relative to"
224
- }
225
- );
226
- var HorizontalPositionAlignSchema = Type.Union(
227
- [
228
- Type.Literal("left"),
229
- Type.Literal("center"),
230
- Type.Literal("right"),
231
- Type.Literal("inside"),
232
- Type.Literal("outside")
233
- ],
234
- {
235
- description: "Horizontal alignment"
236
- }
237
- );
238
- var VerticalPositionAlignSchema = Type.Union(
239
- [
240
- Type.Literal("top"),
241
- Type.Literal("center"),
242
- Type.Literal("bottom"),
243
- Type.Literal("inside"),
244
- Type.Literal("outside")
245
- ],
246
- {
247
- description: "Vertical alignment"
248
- }
249
- );
250
- var TextWrappingTypeSchema = Type.Union(
251
- [
252
- Type.Literal("none"),
253
- Type.Literal("square"),
254
- Type.Literal("topAndBottom"),
255
- Type.Literal("around"),
256
- // VML compatibility for text-box
257
- Type.Literal("tight"),
258
- // VML compatibility for text-box
259
- Type.Literal("through")
260
- // VML compatibility for text-box
261
- ],
262
- {
263
- description: "Text wrapping type"
264
- }
265
- );
266
- var TextWrappingSideSchema = Type.Union(
267
- [
268
- Type.Literal("bothSides"),
269
- Type.Literal("left"),
270
- Type.Literal("right"),
271
- Type.Literal("largest")
272
- ],
273
- {
274
- description: "Text wrapping side"
275
- }
276
- );
277
- var FloatingPropertiesSchema = Type.Object(
278
- {
279
- horizontalPosition: Type.Optional(
280
- Type.Object(
281
- {
282
- relative: Type.Optional(HorizontalPositionRelativeFromSchema),
283
- align: Type.Optional(HorizontalPositionAlignSchema),
284
- offset: Type.Optional(
285
- Type.Union([
286
- Type.Number({
287
- description: "Horizontal offset in twips (1/20 of a point)"
288
- }),
289
- Type.String({
290
- pattern: "^\\d+(\\.\\d+)?%$",
291
- description: 'Horizontal offset as percentage (e.g., "50%") relative to page or margin width'
292
- })
293
- ])
294
- )
295
- },
296
- {
297
- description: "Horizontal positioning (use either align or offset, not both)",
298
- additionalProperties: false
299
- }
300
- )
301
- ),
302
- verticalPosition: Type.Optional(
303
- Type.Object(
304
- {
305
- relative: Type.Optional(VerticalPositionRelativeFromSchema),
306
- align: Type.Optional(VerticalPositionAlignSchema),
307
- offset: Type.Optional(
308
- Type.Union([
309
- Type.Number({
310
- description: "Vertical offset in twips (1/20 of a point)"
311
- }),
312
- Type.String({
313
- pattern: "^\\d+(\\.\\d+)?%$",
314
- description: 'Vertical offset as percentage (e.g., "50%") relative to page or margin height'
315
- })
316
- ])
317
- )
318
- },
319
- {
320
- description: "Vertical positioning (use either align or offset, not both)",
321
- additionalProperties: false
322
- }
323
- )
324
- ),
325
- wrap: Type.Optional(
326
- Type.Object(
327
- {
328
- type: TextWrappingTypeSchema,
329
- side: Type.Optional(TextWrappingSideSchema),
330
- margins: Type.Optional(
331
- Type.Object(
332
- {
333
- top: Type.Optional(
334
- Type.Union([
335
- Type.Number({ description: "Top margin in twips" }),
336
- Type.String({
337
- pattern: "^\\d+(\\.\\d+)?%$",
338
- description: "Top margin as percentage of page height"
339
- })
340
- ])
341
- ),
342
- bottom: Type.Optional(
343
- Type.Union([
344
- Type.Number({ description: "Bottom margin in twips" }),
345
- Type.String({
346
- pattern: "^\\d+(\\.\\d+)?%$",
347
- description: "Bottom margin as percentage of page height"
348
- })
349
- ])
350
- ),
351
- left: Type.Optional(
352
- Type.Union([
353
- Type.Number({ description: "Left margin in twips" }),
354
- Type.String({
355
- pattern: "^\\d+(\\.\\d+)?%$",
356
- description: "Left margin as percentage of page width"
357
- })
358
- ])
359
- ),
360
- right: Type.Optional(
361
- Type.Union([
362
- Type.Number({ description: "Right margin in twips" }),
363
- Type.String({
364
- pattern: "^\\d+(\\.\\d+)?%$",
365
- description: "Right margin as percentage of page width"
366
- })
367
- ])
368
- )
369
- },
370
- {
371
- description: "Distance from text margins",
372
- additionalProperties: false
373
- }
374
- )
375
- )
376
- },
377
- {
378
- description: "Text wrapping configuration",
379
- additionalProperties: false
380
- }
381
- )
382
- ),
383
- allowOverlap: Type.Optional(
384
- Type.Boolean({
385
- description: "Allow element to overlap with other elements"
386
- })
387
- ),
388
- behindDocument: Type.Optional(
389
- Type.Boolean({
390
- description: "Place element behind document text"
391
- })
392
- ),
393
- lockAnchor: Type.Optional(
394
- Type.Boolean({
395
- description: "Lock the anchor position"
396
- })
397
- ),
398
- layoutInCell: Type.Optional(
399
- Type.Boolean({
400
- description: "Layout element within table cell"
401
- })
402
- ),
403
- zIndex: Type.Optional(
404
- Type.Number({
405
- minimum: 0,
406
- description: "Z-order for overlapping elements (must be non-negative)"
407
- })
408
- ),
409
- rotation: Type.Optional(
410
- Type.Number({
411
- description: "Rotation angle in degrees"
412
- })
413
- ),
414
- visibility: Type.Optional(
415
- Type.Union([Type.Literal("hidden"), Type.Literal("inherit")], {
416
- description: "Visibility of the floating element"
417
- })
418
- )
419
- },
420
- {
421
- description: "Floating element properties",
422
- additionalProperties: false
423
- }
424
- );
425
- var NumberingSchema = Type.Object(
426
- {
427
- start: Type.Optional(Type.Number({ minimum: 1 })),
428
- style: Type.Optional(
429
- Type.Union([
430
- Type.Literal("decimal"),
431
- Type.Literal("lowerLetter"),
432
- Type.Literal("upperLetter"),
433
- Type.Literal("lowerRoman"),
434
- Type.Literal("upperRoman")
435
- ])
436
- ),
437
- separator: Type.Optional(Type.String())
438
- },
439
- {
440
- description: "Numbering configuration for lists",
441
- additionalProperties: false
442
- }
443
- );
444
- var BaseComponentFields = {};
445
- var BaseComponentPropsSchema = Type.Object(BaseComponentFields, {
446
- description: "Base component props",
447
- additionalProperties: true
448
- });
449
-
450
- // src/schemas/components/revision.ts
451
- import { Type as Type2 } from "@sinclair/typebox";
452
- var RevisionSegmentSchema = Type2.Object(
453
- {
454
- type: Type2.Union(
455
- [Type2.Literal("equal"), Type2.Literal("insert"), Type2.Literal("delete")],
456
- {
457
- description: "Segment kind: 'equal' renders as normal text, 'insert' as a tracked insertion, 'delete' as a tracked deletion"
458
- }
459
- ),
460
- text: Type2.String({
461
- description: "Literal text of this segment (rendered without markdown)"
462
- })
463
- },
464
- {
465
- description: "A contiguous run of text sharing one revision state",
466
- additionalProperties: false
467
- }
468
- );
469
- var RevisionSchema = Type2.Object(
470
- {
471
- author: Type2.Optional(
472
- Type2.String({
473
- description: 'Revision author shown in Word (default: "json-to-office")'
474
- })
475
- ),
476
- date: Type2.Optional(
477
- Type2.String({
478
- format: "date-time",
479
- description: "Revision timestamp (ISO 8601). Defaults to the Unix epoch for deterministic output"
480
- })
481
- ),
482
- segments: Type2.Array(RevisionSegmentSchema, {
483
- minItems: 1,
484
- description: "Ordered text segments; concatenating equal+insert segments yields the new text, equal+delete the old text"
485
- })
486
- },
487
- {
488
- description: "Tracked-change data: renders the component text as native Word revisions (accept/reject in Word)",
489
- additionalProperties: false
490
- }
491
- );
492
- var RevisionMarkSchema = Type2.Object(
493
- {
494
- type: Type2.Union([Type2.Literal("insert"), Type2.Literal("delete")], {
495
- description: "Whether the element was inserted or deleted"
496
- }),
497
- author: Type2.Optional(
498
- Type2.String({
499
- description: 'Revision author shown in Word (default: "json-to-office")'
500
- })
501
- ),
502
- date: Type2.Optional(
503
- Type2.String({
504
- format: "date-time",
505
- description: "Revision timestamp (ISO 8601). Defaults to the Unix epoch for deterministic output"
506
- })
507
- )
508
- },
509
- {
510
- description: "Structural tracked change: the element itself was inserted or deleted",
511
- additionalProperties: false
512
- }
513
- );
514
-
515
- // src/schemas/components/comment.ts
516
- import { Type as Type3 } from "@sinclair/typebox";
517
- var CommentBodyFields = {
518
- text: Type3.String({
519
- minLength: 1,
520
- description: "Comment body. Newlines split it into separate paragraphs in the comment pane."
521
- }),
522
- author: Type3.Optional(
523
- Type3.String({
524
- description: 'Comment author shown in Word (default: "json-to-office")'
525
- })
526
- ),
527
- initials: Type3.Optional(
528
- Type3.String({
529
- description: "Author initials shown on the comment bubble (derived from the author when omitted)"
530
- })
531
- ),
532
- date: Type3.Optional(
533
- Type3.String({
534
- format: "date-time",
535
- description: "Comment timestamp (ISO 8601). Defaults to the Unix epoch for deterministic output"
536
- })
537
- )
538
- };
539
- var CommentReplySchema = Type3.Object(CommentBodyFields, {
540
- description: "A reply within a comment thread",
541
- additionalProperties: false
542
- });
543
- var CommentSchema = Type3.Object(
544
- {
545
- ...CommentBodyFields,
546
- replies: Type3.Optional(
547
- Type3.Array(CommentReplySchema, {
548
- minItems: 1,
549
- description: "Replies, in order. They anchor to the same text and Word shows them as one thread."
550
- })
551
- ),
552
- resolved: Type3.Optional(
553
- Type3.Boolean({
554
- description: "Mark the whole thread resolved (w15:done). Word writes the thread state only when the document contains at least one reply."
555
- })
556
- )
557
- },
558
- {
559
- description: "A Word review comment anchored to this component's text",
560
- additionalProperties: false
561
- }
562
- );
563
-
564
- // src/schemas/components/heading.ts
565
- var HeadingPropsSchema = Type4.Object(
566
- {
567
- text: Type4.String({
568
- description: "Heading text (required)"
569
- }),
570
- level: Type4.Optional(HeadingLevelSchema),
571
- // Local font override: allows customizing family/size/color/bold/italic/underline
572
- // without modifying theme styles. Supports partial overrides.
573
- font: Type4.Optional(Type4.Partial(FontDefinitionSchema)),
574
- // Local language override (BCP-47). Falls back to the document default when omitted.
575
- language: Type4.Optional(LanguageSchema),
576
- // Disable spell/grammar checking for this heading's text
577
- noProof: Type4.Optional(NoProofSchema),
578
- // Known-words allowlist for this heading (merged with the document list)
579
- noProofWords: Type4.Optional(NoProofWordsSchema),
580
- alignment: Type4.Optional(JustifiedAlignmentSchema),
581
- spacing: Type4.Optional(SpacingSchema),
582
- // Paragraph indentation (w:ind) in twips
583
- indent: Type4.Optional(ParagraphIndentSchema),
584
- lineSpacing: Type4.Optional(
585
- Type4.Union([Type4.Number({ minimum: 0 }), LineSpacingSchema])
586
- ),
587
- pageBreak: Type4.Optional(
588
- Type4.Boolean({
589
- description: "Insert page break before heading"
590
- })
591
- ),
592
- columnBreak: Type4.Optional(
593
- Type4.Boolean({
594
- description: "Insert column break before heading"
595
- })
596
- ),
597
- numbering: Type4.Optional(
598
- Type4.Boolean({
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
- })
601
- ),
602
- keepNext: Type4.Optional(
603
- Type4.Boolean({
604
- description: "Keep heading with next paragraph on same page"
605
- })
606
- ),
607
- keepLines: Type4.Optional(
608
- Type4.Boolean({
609
- description: "Keep all lines of heading together on same page"
610
- })
611
- ),
612
- revision: Type4.Optional(RevisionSchema),
613
- comment: Type4.Optional(CommentSchema)
614
- },
615
- {
616
- description: "Heading component props",
617
- additionalProperties: false
618
- }
619
- );
620
-
621
- // src/schemas/components/paragraph.ts
622
- import { Type as Type6 } from "@sinclair/typebox";
623
-
624
- // src/schemas/components/note.ts
625
- import { Type as Type5 } from "@sinclair/typebox";
626
- var NoteSchema = Type5.Object(
627
- {
628
- id: Type5.String({
629
- minLength: 1,
630
- pattern: "^[^\\]\\s]+$",
631
- description: 'Marker id referenced from the text as `[^id]`. Any characters except whitespace and "]".'
632
- }),
633
- text: Type5.String({
634
- minLength: 1,
635
- description: "Note body. Newlines split it into separate paragraphs where the note is placed."
636
- })
637
- },
638
- {
639
- description: "A note body bound to an inline `[^id]` marker",
640
- additionalProperties: false
641
- }
642
- );
643
- var FootnotesSchema = Type5.Array(NoteSchema, {
644
- description: "Footnote bodies for `[^id]` markers in this paragraph, placed at the foot of the page. An unreferenced body is not emitted.",
645
- minItems: 1
646
- });
647
- var EndnotesSchema = Type5.Array(NoteSchema, {
648
- description: "Endnote bodies for `[^id]` markers in this paragraph, collected at the end of the document. An unreferenced body is not emitted.",
649
- minItems: 1
650
- });
651
-
652
- // src/schemas/components/paragraph.ts
653
- var FrameWrapTypeSchema = Type6.Union(
654
- [
655
- Type6.Literal("around"),
656
- Type6.Literal("none"),
657
- Type6.Literal("notBeside"),
658
- Type6.Literal("through"),
659
- Type6.Literal("tight"),
660
- Type6.Literal("auto")
661
- ],
662
- {
663
- description: "Frame text wrapping type"
664
- }
665
- );
666
- var FrameAnchorTypeSchema = Type6.Union(
667
- [Type6.Literal("margin"), Type6.Literal("page"), Type6.Literal("text")],
668
- {
669
- description: "Frame anchor type"
670
- }
671
- );
672
- var FrameHorizontalAlignSchema = Type6.Union(
673
- [
674
- Type6.Literal("left"),
675
- Type6.Literal("center"),
676
- Type6.Literal("right"),
677
- Type6.Literal("inside"),
678
- Type6.Literal("outside")
679
- ],
680
- {
681
- description: "Frame horizontal alignment"
682
- }
683
- );
684
- var FrameVerticalAlignSchema = Type6.Union(
685
- [
686
- Type6.Literal("top"),
687
- Type6.Literal("center"),
688
- Type6.Literal("bottom"),
689
- Type6.Literal("inside"),
690
- Type6.Literal("outside")
691
- ],
692
- {
693
- description: "Frame vertical alignment"
694
- }
695
- );
696
- var FloatingFramePropertiesSchema = Type6.Object(
697
- {
698
- horizontalPosition: Type6.Optional(
699
- Type6.Object(
700
- {
701
- relative: Type6.Optional(FrameAnchorTypeSchema),
702
- align: Type6.Optional(FrameHorizontalAlignSchema),
703
- offset: Type6.Optional(
704
- Type6.Union([
705
- Type6.Number({
706
- description: "Horizontal offset in twips (1/20 of a point)"
707
- }),
708
- Type6.String({
709
- pattern: "^\\d+(\\.\\d+)?%$",
710
- description: 'Horizontal offset as percentage (e.g., "50%") relative to page or margin width'
711
- })
712
- ])
713
- )
714
- },
715
- {
716
- description: "Horizontal positioning (use either align or offset, not both)",
717
- additionalProperties: false
718
- }
719
- )
720
- ),
721
- verticalPosition: Type6.Optional(
722
- Type6.Object(
723
- {
724
- relative: Type6.Optional(FrameAnchorTypeSchema),
725
- align: Type6.Optional(FrameVerticalAlignSchema),
726
- offset: Type6.Optional(
727
- Type6.Union([
728
- Type6.Number({
729
- description: "Vertical offset in twips (1/20 of a point)"
730
- }),
731
- Type6.String({
732
- pattern: "^\\d+(\\.\\d+)?%$",
733
- description: 'Vertical offset as percentage (e.g., "50%") relative to page or margin height'
734
- })
735
- ])
736
- )
737
- },
738
- {
739
- description: "Vertical positioning (use either align or offset, not both)",
740
- additionalProperties: false
741
- }
742
- )
743
- ),
744
- wrap: Type6.Optional(
745
- Type6.Object(
746
- {
747
- type: FrameWrapTypeSchema
748
- },
749
- {
750
- description: "Text wrapping configuration",
751
- additionalProperties: false
752
- }
753
- )
754
- ),
755
- lockAnchor: Type6.Optional(
756
- Type6.Boolean({
757
- description: "Lock the anchor position"
758
- })
759
- ),
760
- width: Type6.Optional(
761
- Type6.Number({
762
- minimum: 1,
763
- description: "Frame width in twips (DXA units)"
764
- })
765
- ),
766
- height: Type6.Optional(
767
- Type6.Number({
768
- minimum: 1,
769
- description: "Frame height in twips (DXA units)"
770
- })
771
- )
772
- },
773
- {
774
- description: "Floating text frame properties",
775
- additionalProperties: false
776
- }
777
- );
778
- var AlignmentSchema2 = Type6.Union(
779
- [
780
- Type6.Literal("left"),
781
- Type6.Literal("center"),
782
- Type6.Literal("right"),
783
- Type6.Literal("justify")
784
- ],
785
- {
786
- description: "Paragraph text alignment"
787
- }
788
- );
789
- var ParagraphPropsSchema = Type6.Object(
790
- {
791
- text: Type6.String({
792
- description: "Text content (required)"
793
- }),
794
- // New nested font object, aligned with theme's FontDefinitionSchema
795
- // Allow partial overrides (family not required when overriding a subset)
796
- font: Type6.Optional(Type6.Partial(FontDefinitionSchema)),
797
- // Optional reference to a named style from theme.styles (e.g., 'heading1', 'normal')
798
- themeStyle: Type6.Optional(Type6.String()),
799
- // Local language override (BCP-47). Falls back to the document default when omitted.
800
- language: Type6.Optional(LanguageSchema),
801
- // Disable spell/grammar checking for this paragraph's text
802
- noProof: Type6.Optional(NoProofSchema),
803
- // Known-words allowlist for this paragraph (merged with the document list)
804
- noProofWords: Type6.Optional(NoProofWordsSchema),
805
- // Rich-text decoration color for bold segments (kept as top-level behavior
806
- // option). Same value space as font.color: hex or theme color token.
807
- boldColor: Type6.Optional(HexColorSchema),
808
- // Paragraph spacing (in points) — limited paragraph-level option allowed
809
- spacing: Type6.Optional(SpacingSchema),
810
- // Paragraph alignment (moved from font to config level)
811
- alignment: Type6.Optional(AlignmentSchema2),
812
- // Paragraph indentation (w:ind) in twips
813
- indent: Type6.Optional(ParagraphIndentSchema),
814
- // Tab stops (w:tabs); tab characters (\t) in text jump to these positions
815
- tabStops: Type6.Optional(TabStopsSchema),
816
- pageBreak: Type6.Optional(
817
- Type6.Boolean({
818
- description: "Insert page break before paragraph"
819
- })
820
- ),
821
- columnBreak: Type6.Optional(
822
- Type6.Boolean({
823
- description: "Insert column break before paragraph"
824
- })
825
- ),
826
- floating: Type6.Optional(FloatingFramePropertiesSchema),
827
- keepNext: Type6.Optional(
828
- Type6.Boolean({
829
- description: "Keep paragraph with next paragraph on same page"
830
- })
831
- ),
832
- keepLines: Type6.Optional(
833
- Type6.Boolean({
834
- description: "Keep all lines of paragraph together on same page"
835
- })
836
- ),
837
- id: Type6.Optional(
838
- Type6.String({
839
- description: "Unique identifier for internal linking (bookmark anchor)"
840
- })
841
- ),
842
- revision: Type6.Optional(RevisionSchema),
843
- comment: Type6.Optional(CommentSchema),
844
- footnotes: Type6.Optional(FootnotesSchema),
845
- endnotes: Type6.Optional(EndnotesSchema)
846
- },
847
- {
848
- description: "Paragraph component props (font nested for theme consistency; no flat font properties)",
849
- additionalProperties: false
850
- }
851
- );
852
-
853
- // src/schemas/components/image.ts
854
- import { Type as Type7 } from "@sinclair/typebox";
855
- var ImagePropsSchema = Type7.Object(
856
- {
857
- path: Type7.Optional(
858
- Type7.String({
859
- description: "Image source URL or file path (mutually exclusive with base64 and svg)"
860
- })
861
- ),
862
- base64: Type7.Optional(
863
- Type7.String({
864
- description: 'Base64-encoded image data in data URI format (e.g., "data:image/png;base64,iVBORw0KGgo...") (mutually exclusive with path and svg)'
865
- })
866
- ),
867
- svg: Type7.Optional(
868
- Type7.String({
869
- description: '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.'
870
- })
871
- ),
872
- alt: Type7.Optional(
873
- Type7.String({
874
- description: "Alternative text for accessibility"
875
- })
876
- ),
877
- width: Type7.Optional(
878
- Type7.Union(
879
- [
880
- Type7.Number({
881
- minimum: 1,
882
- description: "Image width in pixels"
883
- }),
884
- Type7.String({
885
- pattern: "^\\d+(\\.\\d+)?%$",
886
- description: 'Image width as percentage (e.g., "90%") relative to widthRelativeTo (defaults to content width)'
887
- })
888
- ],
889
- {
890
- description: 'Image width in pixels (number) or as percentage string (e.g., "90%")',
891
- default: "100%"
892
- }
893
- )
894
- ),
895
- height: Type7.Optional(
896
- Type7.Union(
897
- [
898
- Type7.Number({
899
- minimum: 1,
900
- description: "Image height in pixels"
901
- }),
902
- Type7.String({
903
- pattern: "^\\d+(\\.\\d+)?%$",
904
- description: 'Image height as percentage (e.g., "90%") relative to heightRelativeTo (defaults to content height)'
905
- })
906
- ],
907
- {
908
- description: 'Image height in pixels (number) or as percentage string (e.g., "90%")'
909
- }
910
- )
911
- ),
912
- widthRelativeTo: Type7.Optional(
913
- Type7.Union([Type7.Literal("content"), Type7.Literal("page")], {
914
- description: "Reference for width percentages: content (page width minus margins) or page (full page width)",
915
- default: "content"
916
- })
917
- ),
918
- heightRelativeTo: Type7.Optional(
919
- Type7.Union([Type7.Literal("content"), Type7.Literal("page")], {
920
- description: "Reference for height percentages: content (page height minus margins) or page (full page height)",
921
- default: "content"
922
- })
923
- ),
924
- alignment: Type7.Optional(AlignmentSchema),
925
- caption: Type7.Optional(
926
- Type7.String({
927
- description: "Image caption (supports rich text with **bold**, *italic*, ***both***)"
928
- })
929
- ),
930
- spacing: Type7.Optional(SpacingSchema),
931
- floating: Type7.Optional(FloatingPropertiesSchema),
932
- keepNext: Type7.Optional(
933
- Type7.Boolean({
934
- description: "Keep paragraph with next paragraph on same page"
935
- })
936
- ),
937
- keepLines: Type7.Optional(
938
- Type7.Boolean({
939
- description: "Keep all lines of paragraph together on same page"
940
- })
941
- )
942
- },
943
- {
944
- description: "Image component props",
945
- additionalProperties: false
946
- }
947
- );
948
-
949
- // src/schemas/components/statistic.ts
950
- import { Type as Type8 } from "@sinclair/typebox";
951
- var StatisticPropsSchema = Type8.Object(
952
- {
953
- number: Type8.String({
954
- description: "Statistic number/value (required)"
955
- }),
956
- description: Type8.String({
957
- description: "Statistic description (required)"
958
- }),
959
- unit: Type8.Optional(
960
- Type8.String({
961
- description: "Unit of measurement"
962
- })
963
- ),
964
- format: Type8.Optional(
965
- Type8.String({
966
- description: "Number format pattern"
967
- })
968
- ),
969
- trend: Type8.Optional(
970
- Type8.Union([
971
- Type8.Literal("up"),
972
- Type8.Literal("down"),
973
- Type8.Literal("neutral")
974
- ])
975
- ),
976
- trendValue: Type8.Optional(Type8.Union([Type8.String(), Type8.Number()])),
977
- alignment: Type8.Optional(AlignmentSchema),
978
- spacing: Type8.Optional(SpacingSchema),
979
- size: Type8.Optional(
980
- Type8.Union([
981
- Type8.Literal("small"),
982
- Type8.Literal("medium"),
983
- Type8.Literal("large")
984
- ])
985
- )
986
- },
987
- {
988
- description: "Statistic component props",
989
- additionalProperties: false
990
- }
991
- );
992
-
993
- // src/schemas/components/table.ts
994
- import { Type as Type9 } from "@sinclair/typebox";
995
- var CellContentSchema = Type9.Recursive(
996
- (This) => Type9.Union([
997
- Type9.String(),
998
- Type9.Object(
999
- {
1000
- name: Type9.String(),
1001
- props: Type9.Object({}, { additionalProperties: true }),
1002
- children: Type9.Optional(Type9.Array(This))
1003
- },
1004
- { additionalProperties: false }
1005
- )
1006
- ])
1007
- );
1008
- var HorizontalAlignmentSchema = Type9.Union(
1009
- [
1010
- Type9.Literal("left"),
1011
- Type9.Literal("center"),
1012
- Type9.Literal("right"),
1013
- Type9.Literal("justify")
1014
- ],
1015
- { description: "Horizontal text alignment" }
1016
- );
1017
- var VerticalAlignmentSchema = Type9.Union(
1018
- [Type9.Literal("top"), Type9.Literal("middle"), Type9.Literal("bottom")],
1019
- { description: "Vertical cell alignment" }
1020
- );
1021
- var FontConfigSchema = Type9.Object(
1022
- {
1023
- family: Type9.Optional(Type9.String({ description: "Font family name" })),
1024
- size: Type9.Optional(
1025
- Type9.Number({ minimum: 0, description: "Font size in points" })
1026
- ),
1027
- bold: Type9.Optional(Type9.Boolean({ description: "Bold text" })),
1028
- fontWeight: Type9.Optional(
1029
- Type9.Integer({
1030
- minimum: 100,
1031
- maximum: 900,
1032
- description: "Per-cell weight (100\u2013900). Overrides `bold` when set."
1033
- })
1034
- ),
1035
- italic: Type9.Optional(Type9.Boolean({ description: "Italic text" })),
1036
- underline: Type9.Optional(Type9.Boolean({ description: "Underlined text" }))
1037
- },
1038
- { additionalProperties: false }
1039
- );
1040
- var BorderColorSchema = Type9.Union([
1041
- Type9.String({ description: "Border color for all sides (hex without #)" }),
1042
- Type9.Object(
1043
- {
1044
- bottom: Type9.Optional(
1045
- Type9.String({ description: "Bottom border color (hex without #)" })
1046
- ),
1047
- top: Type9.Optional(
1048
- Type9.String({ description: "Top border color (hex without #)" })
1049
- ),
1050
- right: Type9.Optional(
1051
- Type9.String({ description: "Right border color (hex without #)" })
1052
- ),
1053
- left: Type9.Optional(
1054
- Type9.String({ description: "Left border color (hex without #)" })
1055
- )
1056
- },
1057
- { additionalProperties: false }
1058
- )
1059
- ]);
1060
- var BorderSizeSchema = Type9.Union([
1061
- Type9.Number({
1062
- minimum: 0,
1063
- description: "Border size for all sides in points"
1064
- }),
1065
- Type9.Object(
1066
- {
1067
- bottom: Type9.Optional(
1068
- Type9.Number({ minimum: 0, description: "Bottom border size in points" })
1069
- ),
1070
- top: Type9.Optional(
1071
- Type9.Number({ minimum: 0, description: "Top border size in points" })
1072
- ),
1073
- right: Type9.Optional(
1074
- Type9.Number({ minimum: 0, description: "Right border size in points" })
1075
- ),
1076
- left: Type9.Optional(
1077
- Type9.Number({ minimum: 0, description: "Left border size in points" })
1078
- )
1079
- },
1080
- { additionalProperties: false }
1081
- )
1082
- ]);
1083
- var HideBordersSchema = Type9.Union([
1084
- Type9.Boolean({
1085
- description: "Hide all borders when true"
1086
- }),
1087
- Type9.Object(
1088
- {
1089
- bottom: Type9.Optional(
1090
- Type9.Boolean({ description: "Hide bottom border" })
1091
- ),
1092
- top: Type9.Optional(Type9.Boolean({ description: "Hide top border" })),
1093
- right: Type9.Optional(Type9.Boolean({ description: "Hide right border" })),
1094
- left: Type9.Optional(Type9.Boolean({ description: "Hide left border" })),
1095
- insideHorizontal: Type9.Optional(
1096
- Type9.Boolean({ description: "Hide horizontal borders between rows" })
1097
- ),
1098
- insideVertical: Type9.Optional(
1099
- Type9.Boolean({ description: "Hide vertical borders between columns" })
1100
- )
1101
- },
1102
- {
1103
- description: "Selectively hide specific borders",
1104
- additionalProperties: false
1105
- }
1106
- )
1107
- ]);
1108
- var PaddingSchema = Type9.Union([
1109
- Type9.Number({ minimum: 0, description: "Padding for all sides in points" }),
1110
- Type9.Object(
1111
- {
1112
- bottom: Type9.Optional(
1113
- Type9.Number({ minimum: 0, description: "Bottom padding in points" })
1114
- ),
1115
- top: Type9.Optional(
1116
- Type9.Number({ minimum: 0, description: "Top padding in points" })
1117
- ),
1118
- right: Type9.Optional(
1119
- Type9.Number({ minimum: 0, description: "Right padding in points" })
1120
- ),
1121
- left: Type9.Optional(
1122
- Type9.Number({ minimum: 0, description: "Left padding in points" })
1123
- )
1124
- },
1125
- { additionalProperties: false }
1126
- )
1127
- ]);
1128
- var CellDefaultsSchema = Type9.Object(
1129
- {
1130
- color: Type9.Optional(HexColorSchema),
1131
- backgroundColor: Type9.Optional(HexColorOrTransparentSchema),
1132
- horizontalAlignment: Type9.Optional(HorizontalAlignmentSchema),
1133
- verticalAlignment: Type9.Optional(VerticalAlignmentSchema),
1134
- font: Type9.Optional(FontConfigSchema),
1135
- borderColor: Type9.Optional(BorderColorSchema),
1136
- borderSize: Type9.Optional(BorderSizeSchema),
1137
- padding: Type9.Optional(PaddingSchema),
1138
- height: Type9.Optional(
1139
- Type9.Number({ minimum: 0, description: "Cell height in points" })
1140
- )
1141
- },
1142
- { additionalProperties: false }
1143
- );
1144
- function createTablePropsSchema(componentRef) {
1145
- const cellContent = Type9.Union([Type9.String(), componentRef]);
1146
- const cellFields = {
1147
- color: Type9.Optional(HexColorSchema),
1148
- backgroundColor: Type9.Optional(HexColorOrTransparentSchema),
1149
- horizontalAlignment: Type9.Optional(HorizontalAlignmentSchema),
1150
- verticalAlignment: Type9.Optional(VerticalAlignmentSchema),
1151
- font: Type9.Optional(FontConfigSchema),
1152
- borderColor: Type9.Optional(BorderColorSchema),
1153
- borderSize: Type9.Optional(BorderSizeSchema),
1154
- padding: Type9.Optional(PaddingSchema),
1155
- height: Type9.Optional(
1156
- Type9.Number({ minimum: 0, description: "Cell height in points" })
1157
- ),
1158
- comment: Type9.Optional(CommentSchema),
1159
- revision: Type9.Optional(RevisionSchema)
1160
- };
1161
- const headerSchema = Type9.Object(
1162
- {
1163
- ...cellFields,
1164
- content: Type9.Optional(cellContent)
1165
- },
1166
- { additionalProperties: false }
1167
- );
1168
- const cellSchema = Type9.Object(
1169
- {
1170
- ...cellFields,
1171
- content: Type9.Optional(cellContent)
1172
- },
1173
- { additionalProperties: false }
1174
- );
1175
- const columnSchema = Type9.Object(
1176
- {
1177
- width: Type9.Optional(
1178
- Type9.Union([
1179
- Type9.Number({
1180
- minimum: 0,
1181
- description: "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."
1182
- }),
1183
- Type9.String({
1184
- pattern: "^\\d+(\\.\\d+)?%$",
1185
- description: 'Column width as percentage of available width (e.g., "40%")'
1186
- })
1187
- ])
1188
- ),
1189
- cellDefaults: Type9.Optional(CellDefaultsSchema),
1190
- header: Type9.Optional(headerSchema),
1191
- cells: Type9.Optional(Type9.Array(cellSchema))
1192
- },
1193
- { additionalProperties: false }
1194
- );
1195
- return Type9.Object(
1196
- {
1197
- borderColor: Type9.Optional(BorderColorSchema),
1198
- borderSize: Type9.Optional(BorderSizeSchema),
1199
- hideBorders: Type9.Optional(HideBordersSchema),
1200
- cellDefaults: Type9.Optional(CellDefaultsSchema),
1201
- headerCellDefaults: Type9.Optional(CellDefaultsSchema),
1202
- width: Type9.Optional(
1203
- Type9.Number({
1204
- minimum: 0,
1205
- maximum: 100,
1206
- description: "Table width in percentage (0-100)"
1207
- })
1208
- ),
1209
- columns: Type9.Array(columnSchema, {
1210
- description: "Table columns with headers and cells",
1211
- minItems: 1
1212
- }),
1213
- rows: Type9.Optional(
1214
- Type9.Array(
1215
- Type9.Object(
1216
- {
1217
- revision: Type9.Optional(RevisionMarkSchema),
1218
- cantSplit: Type9.Optional(
1219
- Type9.Boolean({
1220
- description: "Keep this row on one page"
1221
- })
1222
- ),
1223
- tableHeader: Type9.Optional(
1224
- Type9.Boolean({
1225
- description: "Repeat this row as a header on each page"
1226
- })
1227
- )
1228
- },
1229
- { additionalProperties: false }
1230
- ),
1231
- {
1232
- description: "Row-parallel properties, indexed like `columns[].cells`. The model is column-major, so anything that belongs to a whole row lives here."
1233
- }
1234
- )
1235
- ),
1236
- keepInOnePage: Type9.Optional(
1237
- Type9.Boolean({
1238
- description: "Keep table rows together on the same page by setting keepNext on all paragraphs"
1239
- })
1240
- ),
1241
- keepNext: Type9.Optional(
1242
- Type9.Boolean({
1243
- description: "Set keepNext on the last row to keep it connected to the next element. Works independently of keepInOnePage. Defaults to false."
1244
- })
1245
- ),
1246
- repeatHeaderOnPageBreak: Type9.Optional(
1247
- Type9.Boolean({
1248
- description: "Repeat the header row on each page when the table spans multiple pages. Defaults to true.",
1249
- default: true
1250
- })
1251
- )
1252
- },
1253
- {
1254
- description: "Table component props with column-based structure",
1255
- additionalProperties: false
1256
- }
1257
- );
1258
- }
1259
- var TablePropsSchema = createTablePropsSchema(CellContentSchema);
1260
-
1261
- // src/schemas/components/section.ts
1262
- import { Type as Type10 } from "@sinclair/typebox";
1263
- var createSectionPropsSchema = (componentRef) => Type10.Object(
1264
- {
1265
- meta: Type10.Optional(
1266
- Type10.Object(
1267
- {
1268
- title: Type10.Optional(
1269
- Type10.String({
1270
- description: "Authoring label for this section, shown in editors and outlines. Never rendered \u2014 add a heading child for a visible title."
1271
- })
1272
- )
1273
- },
1274
- {
1275
- additionalProperties: false,
1276
- description: "Authoring metadata; has no effect on the document."
1277
- }
1278
- )
1279
- ),
1280
- header: Type10.Optional(
1281
- Type10.Union([
1282
- Type10.Array(componentRef || Type10.Any(), {
1283
- description: "Section header components"
1284
- }),
1285
- Type10.Literal("linkToPrevious", {
1286
- description: "Link header to previous section"
1287
- })
1288
- ])
1289
- ),
1290
- footer: Type10.Optional(
1291
- Type10.Union([
1292
- Type10.Array(componentRef || Type10.Any(), {
1293
- description: "Section footer components"
1294
- }),
1295
- Type10.Literal("linkToPrevious", {
1296
- description: "Link footer to previous section"
1297
- })
1298
- ])
1299
- ),
1300
- pageBreak: Type10.Optional(
1301
- Type10.Boolean({
1302
- description: "Insert page break before section",
1303
- default: true
1304
- })
1305
- ),
1306
- spacing: Type10.Optional(SpacingSchema),
1307
- page: Type10.Optional(
1308
- Type10.Object(
1309
- {
1310
- size: Type10.Optional(
1311
- Type10.Union([
1312
- Type10.Literal("A4"),
1313
- Type10.Literal("A3"),
1314
- Type10.Literal("LETTER"),
1315
- Type10.Literal("LEGAL"),
1316
- Type10.Object({
1317
- width: Type10.Number({ minimum: 0 }),
1318
- height: Type10.Number({ minimum: 0 })
1319
- })
1320
- ])
1321
- ),
1322
- margins: Type10.Optional(
1323
- Type10.Object(
1324
- {
1325
- top: Type10.Optional(Type10.Number({ minimum: 0 })),
1326
- bottom: Type10.Optional(Type10.Number({ minimum: 0 })),
1327
- left: Type10.Optional(Type10.Number({ minimum: 0 })),
1328
- right: Type10.Optional(Type10.Number({ minimum: 0 })),
1329
- header: Type10.Optional(Type10.Number({ minimum: 0 })),
1330
- footer: Type10.Optional(Type10.Number({ minimum: 0 })),
1331
- gutter: Type10.Optional(Type10.Number({ minimum: 0 }))
1332
- },
1333
- {
1334
- additionalProperties: false
1335
- }
1336
- )
1337
- )
1338
- },
1339
- {
1340
- description: "Page configuration override for this section (overrides theme page settings)",
1341
- additionalProperties: false
1342
- }
1343
- )
1344
- )
1345
- },
1346
- {
1347
- description: "Section component props",
1348
- additionalProperties: false
1349
- }
1350
- );
1351
- var SectionPropsSchema = createSectionPropsSchema();
1352
-
1353
- // src/schemas/components/columns.ts
1354
- import { Type as Type11 } from "@sinclair/typebox";
1355
- var ColumnDescriptorSchema = Type11.Object(
1356
- {
1357
- width: Type11.Optional(
1358
- Type11.Union([
1359
- Type11.Number({
1360
- minimum: 1,
1361
- description: "Column width in points"
1362
- }),
1363
- Type11.String({
1364
- pattern: "^\\d+(\\.\\d+)?%$",
1365
- description: 'Column width as percentage of available width (e.g., "30%")'
1366
- }),
1367
- Type11.Literal("auto", {
1368
- description: "Auto width: consume remaining space after fixed widths and gaps"
1369
- })
1370
- ])
1371
- ),
1372
- gap: Type11.Optional(
1373
- Type11.Union([
1374
- Type11.Number({
1375
- minimum: 0,
1376
- description: "Gap after this column in points"
1377
- }),
1378
- Type11.String({
1379
- pattern: "^\\d+(\\.\\d+)?%$",
1380
- description: 'Gap after this column as percentage of available width (e.g., "5%")'
1381
- })
1382
- ])
1383
- )
1384
- },
1385
- { additionalProperties: false }
1386
- );
1387
- var ColumnsPropsSchema = Type11.Object(
1388
- {
1389
- columns: Type11.Union([
1390
- Type11.Number({
1391
- minimum: 1,
1392
- description: "Number of equal-width columns (converter will normalize to array)"
1393
- }),
1394
- Type11.Array(ColumnDescriptorSchema, {
1395
- minItems: 1,
1396
- description: "List of columns in order; width and gap can be points, percentages, or auto width"
1397
- })
1398
- ]),
1399
- gap: Type11.Optional(
1400
- Type11.Union([
1401
- Type11.Number({
1402
- minimum: 0,
1403
- description: "Default gap applied after each column except the last (points)"
1404
- }),
1405
- Type11.String({
1406
- pattern: "^\\d+(\\.\\d+)?%$",
1407
- description: 'Default gap applied after each column except the last as percentage of available width (e.g., "5%")'
1408
- })
1409
- ])
1410
- )
1411
- },
1412
- {
1413
- description: "Columns component props",
1414
- additionalProperties: false
1415
- }
1416
- );
1417
-
1418
- // src/schemas/components/list.ts
1419
- import { Type as Type12 } from "@sinclair/typebox";
1420
- var LevelFormatSchema = Type12.Union(
1421
- [
1422
- Type12.Literal("decimal"),
1423
- Type12.Literal("upperRoman"),
1424
- Type12.Literal("lowerRoman"),
1425
- Type12.Literal("upperLetter"),
1426
- Type12.Literal("lowerLetter"),
1427
- Type12.Literal("bullet"),
1428
- Type12.Literal("ordinal"),
1429
- Type12.Literal("cardinalText"),
1430
- Type12.Literal("ordinalText"),
1431
- Type12.Literal("hex"),
1432
- Type12.Literal("chicago"),
1433
- Type12.Literal("ideographDigital"),
1434
- Type12.Literal("japaneseCounting"),
1435
- Type12.Literal("aiueo"),
1436
- Type12.Literal("iroha"),
1437
- Type12.Literal("decimalFullWidth"),
1438
- Type12.Literal("decimalHalfWidth"),
1439
- Type12.Literal("japaneseLegal"),
1440
- Type12.Literal("japaneseDigitalTenThousand"),
1441
- Type12.Literal("decimalEnclosedCircle"),
1442
- Type12.Literal("decimalFullWidth2"),
1443
- Type12.Literal("aiueoFullWidth"),
1444
- Type12.Literal("irohaFullWidth"),
1445
- Type12.Literal("decimalZero"),
1446
- Type12.Literal("ganada"),
1447
- Type12.Literal("chosung"),
1448
- Type12.Literal("decimalEnclosedFullstop"),
1449
- Type12.Literal("decimalEnclosedParen"),
1450
- Type12.Literal("decimalEnclosedCircleChinese"),
1451
- Type12.Literal("ideographEnclosedCircle"),
1452
- Type12.Literal("ideographTraditional"),
1453
- Type12.Literal("ideographZodiac"),
1454
- Type12.Literal("ideographZodiacTraditional"),
1455
- Type12.Literal("taiwaneseCounting"),
1456
- Type12.Literal("ideographLegalTraditional"),
1457
- Type12.Literal("taiwaneseCountingThousand"),
1458
- Type12.Literal("taiwaneseDigital"),
1459
- Type12.Literal("chineseCounting"),
1460
- Type12.Literal("chineseLegalSimplified"),
1461
- Type12.Literal("chineseCountingThousand"),
1462
- Type12.Literal("koreanDigital"),
1463
- Type12.Literal("koreanCounting"),
1464
- Type12.Literal("koreanLegal"),
1465
- Type12.Literal("koreanDigital2"),
1466
- Type12.Literal("vietnameseCounting"),
1467
- Type12.Literal("russianLower"),
1468
- Type12.Literal("russianUpper"),
1469
- Type12.Literal("none"),
1470
- Type12.Literal("numberInDash"),
1471
- Type12.Literal("hebrew1"),
1472
- Type12.Literal("hebrew2"),
1473
- Type12.Literal("arabicAlpha"),
1474
- Type12.Literal("arabicAbjad"),
1475
- Type12.Literal("hindiVowels"),
1476
- Type12.Literal("hindiConsonants"),
1477
- Type12.Literal("hindiNumbers"),
1478
- Type12.Literal("hindiCounting"),
1479
- Type12.Literal("thaiLetters"),
1480
- Type12.Literal("thaiNumbers"),
1481
- Type12.Literal("thaiCounting")
1482
- ],
1483
- {
1484
- description: "Number or bullet format for list levels"
1485
- }
1486
- );
1487
- var ListMarkerFontSchema = Type12.Object(
1488
- {
1489
- family: Type12.Optional(Type12.String({ description: "Font family name" })),
1490
- size: Type12.Optional(
1491
- Type12.Number({ minimum: 1, description: "Marker size in points" })
1492
- ),
1493
- color: Type12.Optional(HexColorSchema),
1494
- bold: Type12.Optional(Type12.Boolean({ description: "Bold marker" })),
1495
- italic: Type12.Optional(Type12.Boolean({ description: "Italic marker" })),
1496
- underline: Type12.Optional(
1497
- Type12.Boolean({ description: "Underlined marker" })
1498
- )
1499
- },
1500
- {
1501
- description: "Styling for the number/bullet glyph only. The list text is unaffected.",
1502
- additionalProperties: false
1503
- }
1504
- );
1505
- var ListLevelPropsSchema = Type12.Object(
1506
- {
1507
- level: Type12.Number({
1508
- minimum: 0,
1509
- maximum: 8,
1510
- description: "Nesting level (0 = root, 1 = first sublevel, etc.)"
1511
- }),
1512
- format: Type12.Optional(LevelFormatSchema),
1513
- text: Type12.Optional(
1514
- Type12.String({
1515
- description: 'Number format string (e.g., "%1." for "1.", "%1)" for "1)", custom bullet character for bullet format)'
1516
- })
1517
- ),
1518
- alignment: Type12.Optional(
1519
- Type12.Union(
1520
- [
1521
- Type12.Literal("start"),
1522
- Type12.Literal("end"),
1523
- Type12.Literal("left"),
1524
- Type12.Literal("right"),
1525
- Type12.Literal("center")
1526
- ],
1527
- {
1528
- description: "Alignment of the numbering/bullet"
1529
- }
1530
- )
1531
- ),
1532
- indent: Type12.Optional(IndentSchema),
1533
- start: Type12.Optional(
1534
- Type12.Number({
1535
- minimum: 1,
1536
- description: "Starting number for this level (default: 1)"
1537
- })
1538
- ),
1539
- font: Type12.Optional(ListMarkerFontSchema)
1540
- },
1541
- {
1542
- description: "Configuration for a single list level",
1543
- additionalProperties: false
1544
- }
1545
- );
1546
- var ListPropsSchema = Type12.Object(
1547
- {
1548
- items: Type12.Array(
1549
- Type12.Union([
1550
- Type12.String(),
1551
- Type12.Object(
1552
- {
1553
- text: Type12.String(),
1554
- level: Type12.Optional(
1555
- Type12.Number({
1556
- minimum: 0,
1557
- maximum: 8,
1558
- description: "Nesting level for this item"
1559
- })
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
- ),
1566
- revision: Type12.Optional(RevisionSchema)
1567
- },
1568
- { additionalProperties: false }
1569
- )
1570
- ]),
1571
- {
1572
- description: "List items (required)",
1573
- minItems: 1
1574
- }
1575
- ),
1576
- reference: Type12.Optional(
1577
- Type12.String({
1578
- description: "Unique reference ID for this numbering configuration (auto-generated if not provided)"
1579
- })
1580
- ),
1581
- levels: Type12.Optional(
1582
- Type12.Array(ListLevelPropsSchema, {
1583
- description: "Configuration for each nesting level",
1584
- minItems: 1,
1585
- maxItems: 9
1586
- })
1587
- ),
1588
- // Simplified options for common use cases (when levels not specified)
1589
- format: Type12.Optional(
1590
- Type12.Union(
1591
- [LevelFormatSchema, Type12.Literal("numbered"), Type12.Literal("none")],
1592
- {
1593
- description: "Format for level 0 (simplified option when levels not specified)"
1594
- }
1595
- )
1596
- ),
1597
- bullet: Type12.Optional(
1598
- Type12.String({
1599
- description: "Custom bullet character (simplified option when levels not specified)"
1600
- })
1601
- ),
1602
- start: Type12.Optional(
1603
- Type12.Number({
1604
- minimum: 1,
1605
- description: "Starting number for level 0. Applies whether or not `levels` is given; a `start` on the level itself wins."
1606
- })
1607
- ),
1608
- spacing: Type12.Optional(ListSpacingSchema),
1609
- alignment: Type12.Optional(JustifiedAlignmentSchema),
1610
- indent: Type12.Optional(
1611
- Type12.Union([Type12.Number({ minimum: 0 }), IndentSchema])
1612
- ),
1613
- // Anchored to the list as a whole: the range opens on the first rendered
1614
- // item and closes on the last.
1615
- comment: Type12.Optional(CommentSchema)
1616
- },
1617
- {
1618
- description: "List component props",
1619
- additionalProperties: false
1620
- }
1621
- );
1622
-
1623
- // src/schemas/component-defaults.ts
1624
- var PER_INSTANCE_PROPS = [
1625
- "revision",
1626
- "comment",
1627
- "footnotes",
1628
- "endnotes"
1629
- ];
1630
- var HeadingComponentDefaultsSchema = Type13.Partial(
1631
- Type13.Omit(HeadingPropsSchema, PER_INSTANCE_PROPS)
1632
- );
1633
- var ParagraphComponentDefaultsSchema = Type13.Partial(
1634
- Type13.Omit(ParagraphPropsSchema, PER_INSTANCE_PROPS)
1635
- );
1636
- var ImageComponentDefaultsSchema = Type13.Partial(ImagePropsSchema);
1637
- var StatisticComponentDefaultsSchema = Type13.Partial(StatisticPropsSchema);
1638
- var TableComponentDefaultsSchema = Type13.Partial(
1639
- Type13.Omit(TablePropsSchema, ["rows"])
1640
- );
1641
- var SectionComponentDefaultsSchema = Type13.Partial(SectionPropsSchema);
1642
- var ColumnsComponentDefaultsSchema = Type13.Partial(ColumnsPropsSchema);
1643
- var ListComponentDefaultsSchema = Type13.Partial(
1644
- Type13.Omit(ListPropsSchema, PER_INSTANCE_PROPS)
1645
- );
1646
- var ComponentDefaultsSchema = Type13.Object(
1647
- {
1648
- heading: Type13.Optional(HeadingComponentDefaultsSchema),
1649
- paragraph: Type13.Optional(ParagraphComponentDefaultsSchema),
1650
- image: Type13.Optional(ImageComponentDefaultsSchema),
1651
- statistic: Type13.Optional(StatisticComponentDefaultsSchema),
1652
- table: Type13.Optional(TableComponentDefaultsSchema),
1653
- section: Type13.Optional(SectionComponentDefaultsSchema),
1654
- columns: Type13.Optional(ColumnsComponentDefaultsSchema),
1655
- list: Type13.Optional(ListComponentDefaultsSchema)
1656
- },
1657
- { additionalProperties: true }
1658
- // TODO: add a way to add strict custom component defaults when the plugin/registry paradigm will be implemented
1659
- );
1660
-
1661
- export {
1662
- AlignmentSchema,
1663
- JustifiedAlignmentSchema,
1664
- HeadingLevelSchema,
1665
- SpacingSchema,
1666
- ListSpacingSchema,
1667
- MarginsSchema,
1668
- BorderSchema,
1669
- LineSpacingSchema,
1670
- IndentSchema,
1671
- ParagraphIndentSchema,
1672
- TabStopTypeSchema,
1673
- TabStopLeaderSchema,
1674
- TabStopSchema,
1675
- TabStopsSchema,
1676
- HorizontalPositionRelativeFromSchema,
1677
- VerticalPositionRelativeFromSchema,
1678
- HorizontalPositionAlignSchema,
1679
- VerticalPositionAlignSchema,
1680
- TextWrappingTypeSchema,
1681
- TextWrappingSideSchema,
1682
- FloatingPropertiesSchema,
1683
- NumberingSchema,
1684
- BaseComponentFields,
1685
- BaseComponentPropsSchema,
1686
- RevisionSegmentSchema,
1687
- RevisionSchema,
1688
- RevisionMarkSchema,
1689
- CommentReplySchema,
1690
- CommentSchema,
1691
- HeadingPropsSchema,
1692
- NoteSchema,
1693
- FootnotesSchema,
1694
- EndnotesSchema,
1695
- ParagraphPropsSchema,
1696
- ImagePropsSchema,
1697
- StatisticPropsSchema,
1698
- createTablePropsSchema,
1699
- TablePropsSchema,
1700
- createSectionPropsSchema,
1701
- SectionPropsSchema,
1702
- ColumnsPropsSchema,
1703
- LevelFormatSchema,
1704
- ListMarkerFontSchema,
1705
- ListLevelPropsSchema,
1706
- ListPropsSchema,
1707
- PER_INSTANCE_PROPS,
1708
- HeadingComponentDefaultsSchema,
1709
- ParagraphComponentDefaultsSchema,
1710
- ImageComponentDefaultsSchema,
1711
- StatisticComponentDefaultsSchema,
1712
- TableComponentDefaultsSchema,
1713
- SectionComponentDefaultsSchema,
1714
- ColumnsComponentDefaultsSchema,
1715
- ListComponentDefaultsSchema,
1716
- ComponentDefaultsSchema
1717
- };
1718
- //# sourceMappingURL=chunk-2YUAD26Q.js.map