@json-to-office/shared-docx 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ZC2I7CTZ.js → chunk-45I2NASU.js} +5 -3
- package/dist/{chunk-ZC2I7CTZ.js.map → chunk-45I2NASU.js.map} +1 -1
- package/dist/chunk-5KOKA5GY.js +687 -0
- package/dist/chunk-5KOKA5GY.js.map +1 -0
- package/dist/{chunk-MG2PLA6W.js → chunk-6B3LHADB.js} +2 -2
- package/dist/{chunk-WXG3FQ5V.js → chunk-A2K66URO.js} +30 -151
- package/dist/chunk-A2K66URO.js.map +1 -0
- package/dist/{chunk-V4HZOLMN.js → chunk-B4STXH5L.js} +36 -20
- package/dist/chunk-B4STXH5L.js.map +1 -0
- package/dist/{chunk-G3XK537A.js → chunk-BBFR3RRN.js} +14 -8
- package/dist/chunk-BBFR3RRN.js.map +1 -0
- package/dist/{chunk-VEF4T6PL.js → chunk-MYLVUQCN.js} +2 -2
- package/dist/{chunk-NZO5SZUO.js → chunk-NAZDY3PK.js} +45 -8
- package/dist/chunk-NAZDY3PK.js.map +1 -0
- package/dist/chunk-OP5PCDNN.js +1272 -0
- package/dist/chunk-OP5PCDNN.js.map +1 -0
- package/dist/{chunk-NAVRPVTN.js → chunk-SOI64OJZ.js} +6 -6
- package/dist/{chunk-GT3MN2RI.js → chunk-TODYYVZ4.js} +2 -2
- package/dist/chunk-VX2J2KWA.js +465 -0
- package/dist/chunk-VX2J2KWA.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +52 -28
- package/dist/index.js.map +1 -1
- package/dist/schemas/api.js +7 -6
- package/dist/schemas/component-defaults.js +2 -1
- package/dist/schemas/component-registry.js +5 -4
- package/dist/schemas/components.d.ts +1792 -34
- package/dist/schemas/components.js +72 -27
- package/dist/schemas/document.js +8 -7
- package/dist/schemas/export.d.ts +8 -2
- package/dist/schemas/export.js +6 -5
- package/dist/schemas/generator.js +6 -5
- package/dist/schemas/renderer.d.ts +21 -3
- package/dist/schemas/renderer.js +5 -1
- package/dist/schemas/theme.js +3 -2
- package/dist/validation/unified/index.js +8 -7
- package/package.json +2 -2
- package/dist/chunk-2YUAD26Q.js +0 -1718
- package/dist/chunk-2YUAD26Q.js.map +0 -1
- package/dist/chunk-G3XK537A.js.map +0 -1
- package/dist/chunk-NZO5SZUO.js.map +0 -1
- package/dist/chunk-T7P4TA7I.js +0 -89
- package/dist/chunk-T7P4TA7I.js.map +0 -1
- package/dist/chunk-V4HZOLMN.js.map +0 -1
- package/dist/chunk-WXG3FQ5V.js.map +0 -1
- /package/dist/{chunk-MG2PLA6W.js.map → chunk-6B3LHADB.js.map} +0 -0
- /package/dist/{chunk-VEF4T6PL.js.map → chunk-MYLVUQCN.js.map} +0 -0
- /package/dist/{chunk-NAVRPVTN.js.map → chunk-SOI64OJZ.js.map} +0 -0
- /package/dist/{chunk-GT3MN2RI.js.map → chunk-TODYYVZ4.js.map} +0 -0
|
@@ -0,0 +1,1272 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AlignmentSchema,
|
|
3
|
+
FloatingPropertiesSchema,
|
|
4
|
+
HeadingLevelSchema,
|
|
5
|
+
IndentSchema,
|
|
6
|
+
JustifiedAlignmentSchema,
|
|
7
|
+
LineSpacingSchema,
|
|
8
|
+
ListSpacingSchema,
|
|
9
|
+
ParagraphIndentSchema,
|
|
10
|
+
SpacingSchema,
|
|
11
|
+
TabStopsSchema
|
|
12
|
+
} from "./chunk-VX2J2KWA.js";
|
|
13
|
+
import {
|
|
14
|
+
FontDefinitionSchema,
|
|
15
|
+
HexColorOrTransparentSchema,
|
|
16
|
+
HexColorSchema,
|
|
17
|
+
LanguageSchema,
|
|
18
|
+
NoProofSchema,
|
|
19
|
+
NoProofWordsSchema
|
|
20
|
+
} from "./chunk-7TTAAYQ5.js";
|
|
21
|
+
|
|
22
|
+
// src/schemas/component-defaults.ts
|
|
23
|
+
import { Type as Type12 } from "@sinclair/typebox";
|
|
24
|
+
|
|
25
|
+
// src/schemas/components/heading.ts
|
|
26
|
+
import { Type as Type3 } from "@sinclair/typebox";
|
|
27
|
+
|
|
28
|
+
// src/schemas/components/revision.ts
|
|
29
|
+
import { Type } from "@sinclair/typebox";
|
|
30
|
+
var RevisionSegmentSchema = Type.Object(
|
|
31
|
+
{
|
|
32
|
+
type: Type.Union(
|
|
33
|
+
[Type.Literal("equal"), Type.Literal("insert"), Type.Literal("delete")],
|
|
34
|
+
{
|
|
35
|
+
description: "Segment kind: 'equal' renders as normal text, 'insert' as a tracked insertion, 'delete' as a tracked deletion"
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
text: Type.String({
|
|
39
|
+
description: "Literal text of this segment (rendered without markdown)"
|
|
40
|
+
})
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
description: "A contiguous run of text sharing one revision state",
|
|
44
|
+
additionalProperties: false
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
var RevisionSchema = Type.Object(
|
|
48
|
+
{
|
|
49
|
+
author: Type.Optional(
|
|
50
|
+
Type.String({
|
|
51
|
+
description: 'Revision author shown in Word (default: "json-to-office")'
|
|
52
|
+
})
|
|
53
|
+
),
|
|
54
|
+
date: Type.Optional(
|
|
55
|
+
Type.String({
|
|
56
|
+
format: "date-time",
|
|
57
|
+
description: "Revision timestamp (ISO 8601). Defaults to the Unix epoch for deterministic output"
|
|
58
|
+
})
|
|
59
|
+
),
|
|
60
|
+
segments: Type.Array(RevisionSegmentSchema, {
|
|
61
|
+
minItems: 1,
|
|
62
|
+
description: "Ordered text segments; concatenating equal+insert segments yields the new text, equal+delete the old text"
|
|
63
|
+
})
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
description: "Tracked-change data: renders the component text as native Word revisions (accept/reject in Word)",
|
|
67
|
+
additionalProperties: false
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
var RevisionMarkSchema = Type.Object(
|
|
71
|
+
{
|
|
72
|
+
type: Type.Union([Type.Literal("insert"), Type.Literal("delete")], {
|
|
73
|
+
description: "Whether the element was inserted or deleted"
|
|
74
|
+
}),
|
|
75
|
+
author: Type.Optional(
|
|
76
|
+
Type.String({
|
|
77
|
+
description: 'Revision author shown in Word (default: "json-to-office")'
|
|
78
|
+
})
|
|
79
|
+
),
|
|
80
|
+
date: Type.Optional(
|
|
81
|
+
Type.String({
|
|
82
|
+
format: "date-time",
|
|
83
|
+
description: "Revision timestamp (ISO 8601). Defaults to the Unix epoch for deterministic output"
|
|
84
|
+
})
|
|
85
|
+
)
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
description: "Structural tracked change: the element itself was inserted or deleted",
|
|
89
|
+
additionalProperties: false
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
// src/schemas/components/comment.ts
|
|
94
|
+
import { Type as Type2 } from "@sinclair/typebox";
|
|
95
|
+
var CommentBodyFields = {
|
|
96
|
+
text: Type2.String({
|
|
97
|
+
minLength: 1,
|
|
98
|
+
description: "Comment body. Newlines split it into separate paragraphs in the comment pane."
|
|
99
|
+
}),
|
|
100
|
+
author: Type2.Optional(
|
|
101
|
+
Type2.String({
|
|
102
|
+
description: 'Comment author shown in Word (default: "json-to-office")'
|
|
103
|
+
})
|
|
104
|
+
),
|
|
105
|
+
initials: Type2.Optional(
|
|
106
|
+
Type2.String({
|
|
107
|
+
description: "Author initials shown on the comment bubble (derived from the author when omitted)"
|
|
108
|
+
})
|
|
109
|
+
),
|
|
110
|
+
date: Type2.Optional(
|
|
111
|
+
Type2.String({
|
|
112
|
+
format: "date-time",
|
|
113
|
+
description: "Comment timestamp (ISO 8601). Defaults to the Unix epoch for deterministic output"
|
|
114
|
+
})
|
|
115
|
+
)
|
|
116
|
+
};
|
|
117
|
+
var CommentReplySchema = Type2.Object(CommentBodyFields, {
|
|
118
|
+
description: "A reply within a comment thread",
|
|
119
|
+
additionalProperties: false
|
|
120
|
+
});
|
|
121
|
+
var CommentSchema = Type2.Object(
|
|
122
|
+
{
|
|
123
|
+
...CommentBodyFields,
|
|
124
|
+
replies: Type2.Optional(
|
|
125
|
+
Type2.Array(CommentReplySchema, {
|
|
126
|
+
minItems: 1,
|
|
127
|
+
description: "Replies, in order. They anchor to the same text and Word shows them as one thread."
|
|
128
|
+
})
|
|
129
|
+
),
|
|
130
|
+
resolved: Type2.Optional(
|
|
131
|
+
Type2.Boolean({
|
|
132
|
+
description: "Mark the whole thread resolved (w15:done). Word writes the thread state only when the document contains at least one reply."
|
|
133
|
+
})
|
|
134
|
+
)
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
description: "A Word review comment anchored to this component's text",
|
|
138
|
+
additionalProperties: false
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// src/schemas/components/heading.ts
|
|
143
|
+
var HeadingPropsSchema = Type3.Object(
|
|
144
|
+
{
|
|
145
|
+
text: Type3.String({
|
|
146
|
+
description: "Heading text (required)"
|
|
147
|
+
}),
|
|
148
|
+
level: Type3.Optional(HeadingLevelSchema),
|
|
149
|
+
// Local font override: allows customizing family/size/color/bold/italic/underline
|
|
150
|
+
// without modifying theme styles. Supports partial overrides.
|
|
151
|
+
font: Type3.Optional(Type3.Partial(FontDefinitionSchema)),
|
|
152
|
+
// Local language override (BCP-47). Falls back to the document default when omitted.
|
|
153
|
+
language: Type3.Optional(LanguageSchema),
|
|
154
|
+
// Disable spell/grammar checking for this heading's text
|
|
155
|
+
noProof: Type3.Optional(NoProofSchema),
|
|
156
|
+
// Known-words allowlist for this heading (merged with the document list)
|
|
157
|
+
noProofWords: Type3.Optional(NoProofWordsSchema),
|
|
158
|
+
alignment: Type3.Optional(JustifiedAlignmentSchema),
|
|
159
|
+
spacing: Type3.Optional(SpacingSchema),
|
|
160
|
+
// Paragraph indentation (w:ind) in twips
|
|
161
|
+
indent: Type3.Optional(ParagraphIndentSchema),
|
|
162
|
+
lineSpacing: Type3.Optional(
|
|
163
|
+
Type3.Union([Type3.Number({ minimum: 0 }), LineSpacingSchema])
|
|
164
|
+
),
|
|
165
|
+
pageBreak: Type3.Optional(
|
|
166
|
+
Type3.Boolean({
|
|
167
|
+
description: "Insert page break before heading"
|
|
168
|
+
})
|
|
169
|
+
),
|
|
170
|
+
columnBreak: Type3.Optional(
|
|
171
|
+
Type3.Boolean({
|
|
172
|
+
description: "Insert column break before heading"
|
|
173
|
+
})
|
|
174
|
+
),
|
|
175
|
+
numbering: Type3.Optional(
|
|
176
|
+
Type3.Boolean({
|
|
177
|
+
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."
|
|
178
|
+
})
|
|
179
|
+
),
|
|
180
|
+
keepNext: Type3.Optional(
|
|
181
|
+
Type3.Boolean({
|
|
182
|
+
description: "Keep heading with next paragraph on same page"
|
|
183
|
+
})
|
|
184
|
+
),
|
|
185
|
+
keepLines: Type3.Optional(
|
|
186
|
+
Type3.Boolean({
|
|
187
|
+
description: "Keep all lines of heading together on same page"
|
|
188
|
+
})
|
|
189
|
+
),
|
|
190
|
+
revision: Type3.Optional(RevisionSchema),
|
|
191
|
+
comment: Type3.Optional(CommentSchema)
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
description: "Heading component props",
|
|
195
|
+
additionalProperties: false
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
// src/schemas/components/paragraph.ts
|
|
200
|
+
import { Type as Type5 } from "@sinclair/typebox";
|
|
201
|
+
|
|
202
|
+
// src/schemas/components/note.ts
|
|
203
|
+
import { Type as Type4 } from "@sinclair/typebox";
|
|
204
|
+
var NoteSchema = Type4.Object(
|
|
205
|
+
{
|
|
206
|
+
id: Type4.String({
|
|
207
|
+
minLength: 1,
|
|
208
|
+
pattern: "^[^\\]\\s]+$",
|
|
209
|
+
description: 'Marker id referenced from the text as `[^id]`. Any characters except whitespace and "]".'
|
|
210
|
+
}),
|
|
211
|
+
text: Type4.String({
|
|
212
|
+
minLength: 1,
|
|
213
|
+
description: "Note body. Newlines split it into separate paragraphs where the note is placed."
|
|
214
|
+
})
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
description: "A note body bound to an inline `[^id]` marker",
|
|
218
|
+
additionalProperties: false
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
var FootnotesSchema = Type4.Array(NoteSchema, {
|
|
222
|
+
description: "Footnote bodies for `[^id]` markers in this paragraph, placed at the foot of the page. An unreferenced body is not emitted.",
|
|
223
|
+
minItems: 1
|
|
224
|
+
});
|
|
225
|
+
var EndnotesSchema = Type4.Array(NoteSchema, {
|
|
226
|
+
description: "Endnote bodies for `[^id]` markers in this paragraph, collected at the end of the document. An unreferenced body is not emitted.",
|
|
227
|
+
minItems: 1
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// src/schemas/components/paragraph.ts
|
|
231
|
+
var FrameWrapTypeSchema = Type5.Union(
|
|
232
|
+
[
|
|
233
|
+
Type5.Literal("around"),
|
|
234
|
+
Type5.Literal("none"),
|
|
235
|
+
Type5.Literal("notBeside"),
|
|
236
|
+
Type5.Literal("through"),
|
|
237
|
+
Type5.Literal("tight"),
|
|
238
|
+
Type5.Literal("auto")
|
|
239
|
+
],
|
|
240
|
+
{
|
|
241
|
+
description: "Frame text wrapping type"
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
var FrameAnchorTypeSchema = Type5.Union(
|
|
245
|
+
[Type5.Literal("margin"), Type5.Literal("page"), Type5.Literal("text")],
|
|
246
|
+
{
|
|
247
|
+
description: "Frame anchor type"
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
var FrameHorizontalAlignSchema = Type5.Union(
|
|
251
|
+
[
|
|
252
|
+
Type5.Literal("left"),
|
|
253
|
+
Type5.Literal("center"),
|
|
254
|
+
Type5.Literal("right"),
|
|
255
|
+
Type5.Literal("inside"),
|
|
256
|
+
Type5.Literal("outside")
|
|
257
|
+
],
|
|
258
|
+
{
|
|
259
|
+
description: "Frame horizontal alignment"
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
var FrameVerticalAlignSchema = Type5.Union(
|
|
263
|
+
[
|
|
264
|
+
Type5.Literal("top"),
|
|
265
|
+
Type5.Literal("center"),
|
|
266
|
+
Type5.Literal("bottom"),
|
|
267
|
+
Type5.Literal("inside"),
|
|
268
|
+
Type5.Literal("outside")
|
|
269
|
+
],
|
|
270
|
+
{
|
|
271
|
+
description: "Frame vertical alignment"
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
var FloatingFramePropertiesSchema = Type5.Object(
|
|
275
|
+
{
|
|
276
|
+
horizontalPosition: Type5.Optional(
|
|
277
|
+
Type5.Object(
|
|
278
|
+
{
|
|
279
|
+
relative: Type5.Optional(FrameAnchorTypeSchema),
|
|
280
|
+
align: Type5.Optional(FrameHorizontalAlignSchema),
|
|
281
|
+
offset: Type5.Optional(
|
|
282
|
+
Type5.Union([
|
|
283
|
+
Type5.Number({
|
|
284
|
+
description: "Horizontal offset in twips (1/20 of a point)"
|
|
285
|
+
}),
|
|
286
|
+
Type5.String({
|
|
287
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
288
|
+
description: 'Horizontal offset as percentage (e.g., "50%") relative to page or margin width'
|
|
289
|
+
})
|
|
290
|
+
])
|
|
291
|
+
)
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
description: "Horizontal positioning (use either align or offset, not both)",
|
|
295
|
+
additionalProperties: false
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
),
|
|
299
|
+
verticalPosition: Type5.Optional(
|
|
300
|
+
Type5.Object(
|
|
301
|
+
{
|
|
302
|
+
relative: Type5.Optional(FrameAnchorTypeSchema),
|
|
303
|
+
align: Type5.Optional(FrameVerticalAlignSchema),
|
|
304
|
+
offset: Type5.Optional(
|
|
305
|
+
Type5.Union([
|
|
306
|
+
Type5.Number({
|
|
307
|
+
description: "Vertical offset in twips (1/20 of a point)"
|
|
308
|
+
}),
|
|
309
|
+
Type5.String({
|
|
310
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
311
|
+
description: 'Vertical offset as percentage (e.g., "50%") relative to page or margin height'
|
|
312
|
+
})
|
|
313
|
+
])
|
|
314
|
+
)
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
description: "Vertical positioning (use either align or offset, not both)",
|
|
318
|
+
additionalProperties: false
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
),
|
|
322
|
+
wrap: Type5.Optional(
|
|
323
|
+
Type5.Object(
|
|
324
|
+
{
|
|
325
|
+
type: FrameWrapTypeSchema
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
description: "Text wrapping configuration",
|
|
329
|
+
additionalProperties: false
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
),
|
|
333
|
+
lockAnchor: Type5.Optional(
|
|
334
|
+
Type5.Boolean({
|
|
335
|
+
description: "Lock the anchor position"
|
|
336
|
+
})
|
|
337
|
+
),
|
|
338
|
+
width: Type5.Optional(
|
|
339
|
+
Type5.Number({
|
|
340
|
+
minimum: 1,
|
|
341
|
+
description: "Frame width in twips (DXA units)"
|
|
342
|
+
})
|
|
343
|
+
),
|
|
344
|
+
height: Type5.Optional(
|
|
345
|
+
Type5.Number({
|
|
346
|
+
minimum: 1,
|
|
347
|
+
description: "Frame height in twips (DXA units)"
|
|
348
|
+
})
|
|
349
|
+
)
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
description: "Floating text frame properties",
|
|
353
|
+
additionalProperties: false
|
|
354
|
+
}
|
|
355
|
+
);
|
|
356
|
+
var AlignmentSchema2 = Type5.Union(
|
|
357
|
+
[
|
|
358
|
+
Type5.Literal("left"),
|
|
359
|
+
Type5.Literal("center"),
|
|
360
|
+
Type5.Literal("right"),
|
|
361
|
+
Type5.Literal("justify")
|
|
362
|
+
],
|
|
363
|
+
{
|
|
364
|
+
description: "Paragraph text alignment"
|
|
365
|
+
}
|
|
366
|
+
);
|
|
367
|
+
var ParagraphPropsSchema = Type5.Object(
|
|
368
|
+
{
|
|
369
|
+
text: Type5.String({
|
|
370
|
+
description: "Text content (required)"
|
|
371
|
+
}),
|
|
372
|
+
// New nested font object, aligned with theme's FontDefinitionSchema
|
|
373
|
+
// Allow partial overrides (family not required when overriding a subset)
|
|
374
|
+
font: Type5.Optional(Type5.Partial(FontDefinitionSchema)),
|
|
375
|
+
// Optional reference to a named style from theme.styles (e.g., 'heading1', 'normal')
|
|
376
|
+
themeStyle: Type5.Optional(Type5.String()),
|
|
377
|
+
// Local language override (BCP-47). Falls back to the document default when omitted.
|
|
378
|
+
language: Type5.Optional(LanguageSchema),
|
|
379
|
+
// Disable spell/grammar checking for this paragraph's text
|
|
380
|
+
noProof: Type5.Optional(NoProofSchema),
|
|
381
|
+
// Known-words allowlist for this paragraph (merged with the document list)
|
|
382
|
+
noProofWords: Type5.Optional(NoProofWordsSchema),
|
|
383
|
+
// Rich-text decoration color for bold segments (kept as top-level behavior
|
|
384
|
+
// option). Same value space as font.color: hex or theme color token.
|
|
385
|
+
boldColor: Type5.Optional(HexColorSchema),
|
|
386
|
+
// Paragraph spacing (in points) — limited paragraph-level option allowed
|
|
387
|
+
spacing: Type5.Optional(SpacingSchema),
|
|
388
|
+
// Paragraph alignment (moved from font to config level)
|
|
389
|
+
alignment: Type5.Optional(AlignmentSchema2),
|
|
390
|
+
// Paragraph indentation (w:ind) in twips
|
|
391
|
+
indent: Type5.Optional(ParagraphIndentSchema),
|
|
392
|
+
// Tab stops (w:tabs); tab characters (\t) in text jump to these positions
|
|
393
|
+
tabStops: Type5.Optional(TabStopsSchema),
|
|
394
|
+
pageBreak: Type5.Optional(
|
|
395
|
+
Type5.Boolean({
|
|
396
|
+
description: "Insert page break before paragraph"
|
|
397
|
+
})
|
|
398
|
+
),
|
|
399
|
+
columnBreak: Type5.Optional(
|
|
400
|
+
Type5.Boolean({
|
|
401
|
+
description: "Insert column break before paragraph"
|
|
402
|
+
})
|
|
403
|
+
),
|
|
404
|
+
floating: Type5.Optional(FloatingFramePropertiesSchema),
|
|
405
|
+
keepNext: Type5.Optional(
|
|
406
|
+
Type5.Boolean({
|
|
407
|
+
description: "Keep paragraph with next paragraph on same page"
|
|
408
|
+
})
|
|
409
|
+
),
|
|
410
|
+
keepLines: Type5.Optional(
|
|
411
|
+
Type5.Boolean({
|
|
412
|
+
description: "Keep all lines of paragraph together on same page"
|
|
413
|
+
})
|
|
414
|
+
),
|
|
415
|
+
id: Type5.Optional(
|
|
416
|
+
Type5.String({
|
|
417
|
+
description: "Unique identifier for internal linking (bookmark anchor)"
|
|
418
|
+
})
|
|
419
|
+
),
|
|
420
|
+
revision: Type5.Optional(RevisionSchema),
|
|
421
|
+
comment: Type5.Optional(CommentSchema),
|
|
422
|
+
footnotes: Type5.Optional(FootnotesSchema),
|
|
423
|
+
endnotes: Type5.Optional(EndnotesSchema)
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
description: "Paragraph component props (font nested for theme consistency; no flat font properties)",
|
|
427
|
+
additionalProperties: false
|
|
428
|
+
}
|
|
429
|
+
);
|
|
430
|
+
|
|
431
|
+
// src/schemas/components/image.ts
|
|
432
|
+
import { Type as Type6 } from "@sinclair/typebox";
|
|
433
|
+
var ImagePropsSchema = Type6.Object(
|
|
434
|
+
{
|
|
435
|
+
path: Type6.Optional(
|
|
436
|
+
Type6.String({
|
|
437
|
+
description: "Image source URL or file path (mutually exclusive with base64 and svg)"
|
|
438
|
+
})
|
|
439
|
+
),
|
|
440
|
+
base64: Type6.Optional(
|
|
441
|
+
Type6.String({
|
|
442
|
+
description: 'Base64-encoded image data in data URI format (e.g., "data:image/png;base64,iVBORw0KGgo...") (mutually exclusive with path and svg)'
|
|
443
|
+
})
|
|
444
|
+
),
|
|
445
|
+
svg: Type6.Optional(
|
|
446
|
+
Type6.String({
|
|
447
|
+
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.'
|
|
448
|
+
})
|
|
449
|
+
),
|
|
450
|
+
alt: Type6.Optional(
|
|
451
|
+
Type6.String({
|
|
452
|
+
description: "Alternative text for accessibility"
|
|
453
|
+
})
|
|
454
|
+
),
|
|
455
|
+
width: Type6.Optional(
|
|
456
|
+
Type6.Union(
|
|
457
|
+
[
|
|
458
|
+
Type6.Number({
|
|
459
|
+
minimum: 1,
|
|
460
|
+
description: "Image width in pixels"
|
|
461
|
+
}),
|
|
462
|
+
Type6.String({
|
|
463
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
464
|
+
description: 'Image width as percentage (e.g., "90%") relative to widthRelativeTo (defaults to content width)'
|
|
465
|
+
})
|
|
466
|
+
],
|
|
467
|
+
{
|
|
468
|
+
description: 'Image width in pixels (number) or as percentage string (e.g., "90%")',
|
|
469
|
+
default: "100%"
|
|
470
|
+
}
|
|
471
|
+
)
|
|
472
|
+
),
|
|
473
|
+
height: Type6.Optional(
|
|
474
|
+
Type6.Union(
|
|
475
|
+
[
|
|
476
|
+
Type6.Number({
|
|
477
|
+
minimum: 1,
|
|
478
|
+
description: "Image height in pixels"
|
|
479
|
+
}),
|
|
480
|
+
Type6.String({
|
|
481
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
482
|
+
description: 'Image height as percentage (e.g., "90%") relative to heightRelativeTo (defaults to content height)'
|
|
483
|
+
})
|
|
484
|
+
],
|
|
485
|
+
{
|
|
486
|
+
description: 'Image height in pixels (number) or as percentage string (e.g., "90%")'
|
|
487
|
+
}
|
|
488
|
+
)
|
|
489
|
+
),
|
|
490
|
+
widthRelativeTo: Type6.Optional(
|
|
491
|
+
Type6.Union([Type6.Literal("content"), Type6.Literal("page")], {
|
|
492
|
+
description: "Reference for width percentages: content (page width minus margins) or page (full page width)",
|
|
493
|
+
default: "content"
|
|
494
|
+
})
|
|
495
|
+
),
|
|
496
|
+
heightRelativeTo: Type6.Optional(
|
|
497
|
+
Type6.Union([Type6.Literal("content"), Type6.Literal("page")], {
|
|
498
|
+
description: "Reference for height percentages: content (page height minus margins) or page (full page height)",
|
|
499
|
+
default: "content"
|
|
500
|
+
})
|
|
501
|
+
),
|
|
502
|
+
alignment: Type6.Optional(AlignmentSchema),
|
|
503
|
+
caption: Type6.Optional(
|
|
504
|
+
Type6.String({
|
|
505
|
+
description: "Image caption (supports rich text with **bold**, *italic*, ***both***)"
|
|
506
|
+
})
|
|
507
|
+
),
|
|
508
|
+
spacing: Type6.Optional(SpacingSchema),
|
|
509
|
+
floating: Type6.Optional(FloatingPropertiesSchema),
|
|
510
|
+
keepNext: Type6.Optional(
|
|
511
|
+
Type6.Boolean({
|
|
512
|
+
description: "Keep paragraph with next paragraph on same page"
|
|
513
|
+
})
|
|
514
|
+
),
|
|
515
|
+
keepLines: Type6.Optional(
|
|
516
|
+
Type6.Boolean({
|
|
517
|
+
description: "Keep all lines of paragraph together on same page"
|
|
518
|
+
})
|
|
519
|
+
)
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
description: "Image component props",
|
|
523
|
+
additionalProperties: false
|
|
524
|
+
}
|
|
525
|
+
);
|
|
526
|
+
|
|
527
|
+
// src/schemas/components/statistic.ts
|
|
528
|
+
import { Type as Type7 } from "@sinclair/typebox";
|
|
529
|
+
var StatisticPropsSchema = Type7.Object(
|
|
530
|
+
{
|
|
531
|
+
number: Type7.String({
|
|
532
|
+
description: "Statistic number/value (required)"
|
|
533
|
+
}),
|
|
534
|
+
description: Type7.String({
|
|
535
|
+
description: "Statistic description (required)"
|
|
536
|
+
}),
|
|
537
|
+
unit: Type7.Optional(
|
|
538
|
+
Type7.String({
|
|
539
|
+
description: "Unit of measurement"
|
|
540
|
+
})
|
|
541
|
+
),
|
|
542
|
+
format: Type7.Optional(
|
|
543
|
+
Type7.String({
|
|
544
|
+
description: "Number format pattern"
|
|
545
|
+
})
|
|
546
|
+
),
|
|
547
|
+
trend: Type7.Optional(
|
|
548
|
+
Type7.Union([
|
|
549
|
+
Type7.Literal("up"),
|
|
550
|
+
Type7.Literal("down"),
|
|
551
|
+
Type7.Literal("neutral")
|
|
552
|
+
])
|
|
553
|
+
),
|
|
554
|
+
trendValue: Type7.Optional(Type7.Union([Type7.String(), Type7.Number()])),
|
|
555
|
+
alignment: Type7.Optional(AlignmentSchema),
|
|
556
|
+
spacing: Type7.Optional(SpacingSchema),
|
|
557
|
+
size: Type7.Optional(
|
|
558
|
+
Type7.Union([
|
|
559
|
+
Type7.Literal("small"),
|
|
560
|
+
Type7.Literal("medium"),
|
|
561
|
+
Type7.Literal("large")
|
|
562
|
+
])
|
|
563
|
+
)
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
description: "Statistic component props",
|
|
567
|
+
additionalProperties: false
|
|
568
|
+
}
|
|
569
|
+
);
|
|
570
|
+
|
|
571
|
+
// src/schemas/components/table.ts
|
|
572
|
+
import { Type as Type8 } from "@sinclair/typebox";
|
|
573
|
+
var CellContentSchema = Type8.Recursive(
|
|
574
|
+
(This) => Type8.Union([
|
|
575
|
+
Type8.String(),
|
|
576
|
+
Type8.Object(
|
|
577
|
+
{
|
|
578
|
+
name: Type8.String(),
|
|
579
|
+
props: Type8.Object({}, { additionalProperties: true }),
|
|
580
|
+
children: Type8.Optional(Type8.Array(This))
|
|
581
|
+
},
|
|
582
|
+
{ additionalProperties: false }
|
|
583
|
+
)
|
|
584
|
+
])
|
|
585
|
+
);
|
|
586
|
+
var HorizontalAlignmentSchema = Type8.Union(
|
|
587
|
+
[
|
|
588
|
+
Type8.Literal("left"),
|
|
589
|
+
Type8.Literal("center"),
|
|
590
|
+
Type8.Literal("right"),
|
|
591
|
+
Type8.Literal("justify")
|
|
592
|
+
],
|
|
593
|
+
{ description: "Horizontal text alignment" }
|
|
594
|
+
);
|
|
595
|
+
var VerticalAlignmentSchema = Type8.Union(
|
|
596
|
+
[Type8.Literal("top"), Type8.Literal("middle"), Type8.Literal("bottom")],
|
|
597
|
+
{ description: "Vertical cell alignment" }
|
|
598
|
+
);
|
|
599
|
+
var FontConfigSchema = Type8.Object(
|
|
600
|
+
{
|
|
601
|
+
family: Type8.Optional(Type8.String({ description: "Font family name" })),
|
|
602
|
+
size: Type8.Optional(
|
|
603
|
+
Type8.Number({ minimum: 0, description: "Font size in points" })
|
|
604
|
+
),
|
|
605
|
+
bold: Type8.Optional(Type8.Boolean({ description: "Bold text" })),
|
|
606
|
+
fontWeight: Type8.Optional(
|
|
607
|
+
Type8.Integer({
|
|
608
|
+
minimum: 100,
|
|
609
|
+
maximum: 900,
|
|
610
|
+
description: "Per-cell weight (100\u2013900). Overrides `bold` when set."
|
|
611
|
+
})
|
|
612
|
+
),
|
|
613
|
+
italic: Type8.Optional(Type8.Boolean({ description: "Italic text" })),
|
|
614
|
+
underline: Type8.Optional(Type8.Boolean({ description: "Underlined text" }))
|
|
615
|
+
},
|
|
616
|
+
{ additionalProperties: false }
|
|
617
|
+
);
|
|
618
|
+
var BorderColorSchema = Type8.Union([
|
|
619
|
+
Type8.String({ description: "Border color for all sides (hex without #)" }),
|
|
620
|
+
Type8.Object(
|
|
621
|
+
{
|
|
622
|
+
bottom: Type8.Optional(
|
|
623
|
+
Type8.String({ description: "Bottom border color (hex without #)" })
|
|
624
|
+
),
|
|
625
|
+
top: Type8.Optional(
|
|
626
|
+
Type8.String({ description: "Top border color (hex without #)" })
|
|
627
|
+
),
|
|
628
|
+
right: Type8.Optional(
|
|
629
|
+
Type8.String({ description: "Right border color (hex without #)" })
|
|
630
|
+
),
|
|
631
|
+
left: Type8.Optional(
|
|
632
|
+
Type8.String({ description: "Left border color (hex without #)" })
|
|
633
|
+
)
|
|
634
|
+
},
|
|
635
|
+
{ additionalProperties: false }
|
|
636
|
+
)
|
|
637
|
+
]);
|
|
638
|
+
var BorderSizeSchema = Type8.Union([
|
|
639
|
+
Type8.Number({
|
|
640
|
+
minimum: 0,
|
|
641
|
+
description: "Border size for all sides in points"
|
|
642
|
+
}),
|
|
643
|
+
Type8.Object(
|
|
644
|
+
{
|
|
645
|
+
bottom: Type8.Optional(
|
|
646
|
+
Type8.Number({ minimum: 0, description: "Bottom border size in points" })
|
|
647
|
+
),
|
|
648
|
+
top: Type8.Optional(
|
|
649
|
+
Type8.Number({ minimum: 0, description: "Top border size in points" })
|
|
650
|
+
),
|
|
651
|
+
right: Type8.Optional(
|
|
652
|
+
Type8.Number({ minimum: 0, description: "Right border size in points" })
|
|
653
|
+
),
|
|
654
|
+
left: Type8.Optional(
|
|
655
|
+
Type8.Number({ minimum: 0, description: "Left border size in points" })
|
|
656
|
+
)
|
|
657
|
+
},
|
|
658
|
+
{ additionalProperties: false }
|
|
659
|
+
)
|
|
660
|
+
]);
|
|
661
|
+
var HideBordersSchema = Type8.Union([
|
|
662
|
+
Type8.Boolean({
|
|
663
|
+
description: "Hide all borders when true"
|
|
664
|
+
}),
|
|
665
|
+
Type8.Object(
|
|
666
|
+
{
|
|
667
|
+
bottom: Type8.Optional(
|
|
668
|
+
Type8.Boolean({ description: "Hide bottom border" })
|
|
669
|
+
),
|
|
670
|
+
top: Type8.Optional(Type8.Boolean({ description: "Hide top border" })),
|
|
671
|
+
right: Type8.Optional(Type8.Boolean({ description: "Hide right border" })),
|
|
672
|
+
left: Type8.Optional(Type8.Boolean({ description: "Hide left border" })),
|
|
673
|
+
insideHorizontal: Type8.Optional(
|
|
674
|
+
Type8.Boolean({ description: "Hide horizontal borders between rows" })
|
|
675
|
+
),
|
|
676
|
+
insideVertical: Type8.Optional(
|
|
677
|
+
Type8.Boolean({ description: "Hide vertical borders between columns" })
|
|
678
|
+
)
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
description: "Selectively hide specific borders",
|
|
682
|
+
additionalProperties: false
|
|
683
|
+
}
|
|
684
|
+
)
|
|
685
|
+
]);
|
|
686
|
+
var PaddingSchema = Type8.Union([
|
|
687
|
+
Type8.Number({ minimum: 0, description: "Padding for all sides in points" }),
|
|
688
|
+
Type8.Object(
|
|
689
|
+
{
|
|
690
|
+
bottom: Type8.Optional(
|
|
691
|
+
Type8.Number({ minimum: 0, description: "Bottom padding in points" })
|
|
692
|
+
),
|
|
693
|
+
top: Type8.Optional(
|
|
694
|
+
Type8.Number({ minimum: 0, description: "Top padding in points" })
|
|
695
|
+
),
|
|
696
|
+
right: Type8.Optional(
|
|
697
|
+
Type8.Number({ minimum: 0, description: "Right padding in points" })
|
|
698
|
+
),
|
|
699
|
+
left: Type8.Optional(
|
|
700
|
+
Type8.Number({ minimum: 0, description: "Left padding in points" })
|
|
701
|
+
)
|
|
702
|
+
},
|
|
703
|
+
{ additionalProperties: false }
|
|
704
|
+
)
|
|
705
|
+
]);
|
|
706
|
+
var CellDefaultsSchema = Type8.Object(
|
|
707
|
+
{
|
|
708
|
+
color: Type8.Optional(HexColorSchema),
|
|
709
|
+
backgroundColor: Type8.Optional(HexColorOrTransparentSchema),
|
|
710
|
+
horizontalAlignment: Type8.Optional(HorizontalAlignmentSchema),
|
|
711
|
+
verticalAlignment: Type8.Optional(VerticalAlignmentSchema),
|
|
712
|
+
font: Type8.Optional(FontConfigSchema),
|
|
713
|
+
borderColor: Type8.Optional(BorderColorSchema),
|
|
714
|
+
borderSize: Type8.Optional(BorderSizeSchema),
|
|
715
|
+
padding: Type8.Optional(PaddingSchema),
|
|
716
|
+
height: Type8.Optional(
|
|
717
|
+
Type8.Number({ minimum: 0, description: "Cell height in points" })
|
|
718
|
+
)
|
|
719
|
+
},
|
|
720
|
+
{ additionalProperties: false }
|
|
721
|
+
);
|
|
722
|
+
function createTablePropsSchema(componentRef) {
|
|
723
|
+
const cellContent = Type8.Union([Type8.String(), componentRef]);
|
|
724
|
+
const cellFields = {
|
|
725
|
+
color: Type8.Optional(HexColorSchema),
|
|
726
|
+
backgroundColor: Type8.Optional(HexColorOrTransparentSchema),
|
|
727
|
+
horizontalAlignment: Type8.Optional(HorizontalAlignmentSchema),
|
|
728
|
+
verticalAlignment: Type8.Optional(VerticalAlignmentSchema),
|
|
729
|
+
font: Type8.Optional(FontConfigSchema),
|
|
730
|
+
borderColor: Type8.Optional(BorderColorSchema),
|
|
731
|
+
borderSize: Type8.Optional(BorderSizeSchema),
|
|
732
|
+
padding: Type8.Optional(PaddingSchema),
|
|
733
|
+
height: Type8.Optional(
|
|
734
|
+
Type8.Number({ minimum: 0, description: "Cell height in points" })
|
|
735
|
+
),
|
|
736
|
+
comment: Type8.Optional(CommentSchema),
|
|
737
|
+
revision: Type8.Optional(RevisionSchema)
|
|
738
|
+
};
|
|
739
|
+
const headerSchema = Type8.Object(
|
|
740
|
+
{
|
|
741
|
+
...cellFields,
|
|
742
|
+
content: Type8.Optional(cellContent)
|
|
743
|
+
},
|
|
744
|
+
{ additionalProperties: false }
|
|
745
|
+
);
|
|
746
|
+
const cellSchema = Type8.Object(
|
|
747
|
+
{
|
|
748
|
+
...cellFields,
|
|
749
|
+
content: Type8.Optional(cellContent)
|
|
750
|
+
},
|
|
751
|
+
{ additionalProperties: false }
|
|
752
|
+
);
|
|
753
|
+
const columnSchema = Type8.Object(
|
|
754
|
+
{
|
|
755
|
+
width: Type8.Optional(
|
|
756
|
+
Type8.Union([
|
|
757
|
+
Type8.Number({
|
|
758
|
+
minimum: 0,
|
|
759
|
+
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."
|
|
760
|
+
}),
|
|
761
|
+
Type8.String({
|
|
762
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
763
|
+
description: 'Column width as percentage of available width (e.g., "40%")'
|
|
764
|
+
})
|
|
765
|
+
])
|
|
766
|
+
),
|
|
767
|
+
cellDefaults: Type8.Optional(CellDefaultsSchema),
|
|
768
|
+
header: Type8.Optional(headerSchema),
|
|
769
|
+
cells: Type8.Optional(Type8.Array(cellSchema))
|
|
770
|
+
},
|
|
771
|
+
{ additionalProperties: false }
|
|
772
|
+
);
|
|
773
|
+
return Type8.Object(
|
|
774
|
+
{
|
|
775
|
+
borderColor: Type8.Optional(BorderColorSchema),
|
|
776
|
+
borderSize: Type8.Optional(BorderSizeSchema),
|
|
777
|
+
hideBorders: Type8.Optional(HideBordersSchema),
|
|
778
|
+
cellDefaults: Type8.Optional(CellDefaultsSchema),
|
|
779
|
+
headerCellDefaults: Type8.Optional(CellDefaultsSchema),
|
|
780
|
+
width: Type8.Optional(
|
|
781
|
+
Type8.Number({
|
|
782
|
+
minimum: 0,
|
|
783
|
+
maximum: 100,
|
|
784
|
+
description: "Table width in percentage (0-100)"
|
|
785
|
+
})
|
|
786
|
+
),
|
|
787
|
+
columns: Type8.Array(columnSchema, {
|
|
788
|
+
description: "Table columns with headers and cells",
|
|
789
|
+
minItems: 1
|
|
790
|
+
}),
|
|
791
|
+
rows: Type8.Optional(
|
|
792
|
+
Type8.Array(
|
|
793
|
+
Type8.Object(
|
|
794
|
+
{
|
|
795
|
+
revision: Type8.Optional(RevisionMarkSchema),
|
|
796
|
+
cantSplit: Type8.Optional(
|
|
797
|
+
Type8.Boolean({
|
|
798
|
+
description: "Keep this row on one page"
|
|
799
|
+
})
|
|
800
|
+
),
|
|
801
|
+
tableHeader: Type8.Optional(
|
|
802
|
+
Type8.Boolean({
|
|
803
|
+
description: "Repeat this row as a header on each page"
|
|
804
|
+
})
|
|
805
|
+
)
|
|
806
|
+
},
|
|
807
|
+
{ additionalProperties: false }
|
|
808
|
+
),
|
|
809
|
+
{
|
|
810
|
+
description: "Row-parallel properties, indexed like `columns[].cells`. The model is column-major, so anything that belongs to a whole row lives here."
|
|
811
|
+
}
|
|
812
|
+
)
|
|
813
|
+
),
|
|
814
|
+
keepInOnePage: Type8.Optional(
|
|
815
|
+
Type8.Boolean({
|
|
816
|
+
description: "Keep table rows together on the same page by setting keepNext on all paragraphs"
|
|
817
|
+
})
|
|
818
|
+
),
|
|
819
|
+
keepNext: Type8.Optional(
|
|
820
|
+
Type8.Boolean({
|
|
821
|
+
description: "Set keepNext on the last row to keep it connected to the next element. Works independently of keepInOnePage. Defaults to false."
|
|
822
|
+
})
|
|
823
|
+
),
|
|
824
|
+
repeatHeaderOnPageBreak: Type8.Optional(
|
|
825
|
+
Type8.Boolean({
|
|
826
|
+
description: "Repeat the header row on each page when the table spans multiple pages. Defaults to true.",
|
|
827
|
+
default: true
|
|
828
|
+
})
|
|
829
|
+
)
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
description: "Table component props with column-based structure",
|
|
833
|
+
additionalProperties: false
|
|
834
|
+
}
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
var TablePropsSchema = createTablePropsSchema(CellContentSchema);
|
|
838
|
+
|
|
839
|
+
// src/schemas/components/section.ts
|
|
840
|
+
import { Type as Type9 } from "@sinclair/typebox";
|
|
841
|
+
var createSectionPropsSchema = (componentRef) => Type9.Object(
|
|
842
|
+
{
|
|
843
|
+
meta: Type9.Optional(
|
|
844
|
+
Type9.Object(
|
|
845
|
+
{
|
|
846
|
+
title: Type9.Optional(
|
|
847
|
+
Type9.String({
|
|
848
|
+
description: "Authoring label for this section, shown in editors and outlines. Never rendered \u2014 add a heading child for a visible title."
|
|
849
|
+
})
|
|
850
|
+
)
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
additionalProperties: false,
|
|
854
|
+
description: "Authoring metadata; has no effect on the document."
|
|
855
|
+
}
|
|
856
|
+
)
|
|
857
|
+
),
|
|
858
|
+
header: Type9.Optional(
|
|
859
|
+
Type9.Union([
|
|
860
|
+
Type9.Array(componentRef || Type9.Any(), {
|
|
861
|
+
description: "Section header components"
|
|
862
|
+
}),
|
|
863
|
+
Type9.Literal("linkToPrevious", {
|
|
864
|
+
description: "Link header to previous section"
|
|
865
|
+
})
|
|
866
|
+
])
|
|
867
|
+
),
|
|
868
|
+
footer: Type9.Optional(
|
|
869
|
+
Type9.Union([
|
|
870
|
+
Type9.Array(componentRef || Type9.Any(), {
|
|
871
|
+
description: "Section footer components"
|
|
872
|
+
}),
|
|
873
|
+
Type9.Literal("linkToPrevious", {
|
|
874
|
+
description: "Link footer to previous section"
|
|
875
|
+
})
|
|
876
|
+
])
|
|
877
|
+
),
|
|
878
|
+
pageBreak: Type9.Optional(
|
|
879
|
+
Type9.Boolean({
|
|
880
|
+
description: "Insert page break before section",
|
|
881
|
+
default: true
|
|
882
|
+
})
|
|
883
|
+
),
|
|
884
|
+
spacing: Type9.Optional(SpacingSchema),
|
|
885
|
+
page: Type9.Optional(
|
|
886
|
+
Type9.Object(
|
|
887
|
+
{
|
|
888
|
+
size: Type9.Optional(
|
|
889
|
+
Type9.Union([
|
|
890
|
+
Type9.Literal("A4"),
|
|
891
|
+
Type9.Literal("A3"),
|
|
892
|
+
Type9.Literal("LETTER"),
|
|
893
|
+
Type9.Literal("LEGAL"),
|
|
894
|
+
Type9.Object({
|
|
895
|
+
width: Type9.Number({ minimum: 0 }),
|
|
896
|
+
height: Type9.Number({ minimum: 0 })
|
|
897
|
+
})
|
|
898
|
+
])
|
|
899
|
+
),
|
|
900
|
+
margins: Type9.Optional(
|
|
901
|
+
Type9.Object(
|
|
902
|
+
{
|
|
903
|
+
top: Type9.Optional(Type9.Number({ minimum: 0 })),
|
|
904
|
+
bottom: Type9.Optional(Type9.Number({ minimum: 0 })),
|
|
905
|
+
left: Type9.Optional(Type9.Number({ minimum: 0 })),
|
|
906
|
+
right: Type9.Optional(Type9.Number({ minimum: 0 })),
|
|
907
|
+
header: Type9.Optional(Type9.Number({ minimum: 0 })),
|
|
908
|
+
footer: Type9.Optional(Type9.Number({ minimum: 0 })),
|
|
909
|
+
gutter: Type9.Optional(Type9.Number({ minimum: 0 }))
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
additionalProperties: false
|
|
913
|
+
}
|
|
914
|
+
)
|
|
915
|
+
)
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
description: "Page configuration override for this section (overrides theme page settings)",
|
|
919
|
+
additionalProperties: false
|
|
920
|
+
}
|
|
921
|
+
)
|
|
922
|
+
)
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
description: "Section component props",
|
|
926
|
+
additionalProperties: false
|
|
927
|
+
}
|
|
928
|
+
);
|
|
929
|
+
var SectionPropsSchema = createSectionPropsSchema();
|
|
930
|
+
|
|
931
|
+
// src/schemas/components/columns.ts
|
|
932
|
+
import { Type as Type10 } from "@sinclair/typebox";
|
|
933
|
+
var ColumnDescriptorSchema = Type10.Object(
|
|
934
|
+
{
|
|
935
|
+
width: Type10.Optional(
|
|
936
|
+
Type10.Union([
|
|
937
|
+
Type10.Number({
|
|
938
|
+
minimum: 1,
|
|
939
|
+
description: "Column width in points"
|
|
940
|
+
}),
|
|
941
|
+
Type10.String({
|
|
942
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
943
|
+
description: 'Column width as percentage of available width (e.g., "30%")'
|
|
944
|
+
}),
|
|
945
|
+
Type10.Literal("auto", {
|
|
946
|
+
description: "Auto width: consume remaining space after fixed widths and gaps"
|
|
947
|
+
})
|
|
948
|
+
])
|
|
949
|
+
),
|
|
950
|
+
gap: Type10.Optional(
|
|
951
|
+
Type10.Union([
|
|
952
|
+
Type10.Number({
|
|
953
|
+
minimum: 0,
|
|
954
|
+
description: "Gap after this column in points"
|
|
955
|
+
}),
|
|
956
|
+
Type10.String({
|
|
957
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
958
|
+
description: 'Gap after this column as percentage of available width (e.g., "5%")'
|
|
959
|
+
})
|
|
960
|
+
])
|
|
961
|
+
)
|
|
962
|
+
},
|
|
963
|
+
{ additionalProperties: false }
|
|
964
|
+
);
|
|
965
|
+
var ColumnsPropsSchema = Type10.Object(
|
|
966
|
+
{
|
|
967
|
+
columns: Type10.Union([
|
|
968
|
+
Type10.Number({
|
|
969
|
+
minimum: 1,
|
|
970
|
+
description: "Number of equal-width columns (converter will normalize to array)"
|
|
971
|
+
}),
|
|
972
|
+
Type10.Array(ColumnDescriptorSchema, {
|
|
973
|
+
minItems: 1,
|
|
974
|
+
description: "List of columns in order; width and gap can be points, percentages, or auto width"
|
|
975
|
+
})
|
|
976
|
+
]),
|
|
977
|
+
gap: Type10.Optional(
|
|
978
|
+
Type10.Union([
|
|
979
|
+
Type10.Number({
|
|
980
|
+
minimum: 0,
|
|
981
|
+
description: "Default gap applied after each column except the last (points)"
|
|
982
|
+
}),
|
|
983
|
+
Type10.String({
|
|
984
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
985
|
+
description: 'Default gap applied after each column except the last as percentage of available width (e.g., "5%")'
|
|
986
|
+
})
|
|
987
|
+
])
|
|
988
|
+
)
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
description: "Columns component props",
|
|
992
|
+
additionalProperties: false
|
|
993
|
+
}
|
|
994
|
+
);
|
|
995
|
+
|
|
996
|
+
// src/schemas/components/list.ts
|
|
997
|
+
import { Type as Type11 } from "@sinclair/typebox";
|
|
998
|
+
var LevelFormatSchema = Type11.Union(
|
|
999
|
+
[
|
|
1000
|
+
Type11.Literal("decimal"),
|
|
1001
|
+
Type11.Literal("upperRoman"),
|
|
1002
|
+
Type11.Literal("lowerRoman"),
|
|
1003
|
+
Type11.Literal("upperLetter"),
|
|
1004
|
+
Type11.Literal("lowerLetter"),
|
|
1005
|
+
Type11.Literal("bullet"),
|
|
1006
|
+
Type11.Literal("ordinal"),
|
|
1007
|
+
Type11.Literal("cardinalText"),
|
|
1008
|
+
Type11.Literal("ordinalText"),
|
|
1009
|
+
Type11.Literal("hex"),
|
|
1010
|
+
Type11.Literal("chicago"),
|
|
1011
|
+
Type11.Literal("ideographDigital"),
|
|
1012
|
+
Type11.Literal("japaneseCounting"),
|
|
1013
|
+
Type11.Literal("aiueo"),
|
|
1014
|
+
Type11.Literal("iroha"),
|
|
1015
|
+
Type11.Literal("decimalFullWidth"),
|
|
1016
|
+
Type11.Literal("decimalHalfWidth"),
|
|
1017
|
+
Type11.Literal("japaneseLegal"),
|
|
1018
|
+
Type11.Literal("japaneseDigitalTenThousand"),
|
|
1019
|
+
Type11.Literal("decimalEnclosedCircle"),
|
|
1020
|
+
Type11.Literal("decimalFullWidth2"),
|
|
1021
|
+
Type11.Literal("aiueoFullWidth"),
|
|
1022
|
+
Type11.Literal("irohaFullWidth"),
|
|
1023
|
+
Type11.Literal("decimalZero"),
|
|
1024
|
+
Type11.Literal("ganada"),
|
|
1025
|
+
Type11.Literal("chosung"),
|
|
1026
|
+
Type11.Literal("decimalEnclosedFullstop"),
|
|
1027
|
+
Type11.Literal("decimalEnclosedParen"),
|
|
1028
|
+
Type11.Literal("decimalEnclosedCircleChinese"),
|
|
1029
|
+
Type11.Literal("ideographEnclosedCircle"),
|
|
1030
|
+
Type11.Literal("ideographTraditional"),
|
|
1031
|
+
Type11.Literal("ideographZodiac"),
|
|
1032
|
+
Type11.Literal("ideographZodiacTraditional"),
|
|
1033
|
+
Type11.Literal("taiwaneseCounting"),
|
|
1034
|
+
Type11.Literal("ideographLegalTraditional"),
|
|
1035
|
+
Type11.Literal("taiwaneseCountingThousand"),
|
|
1036
|
+
Type11.Literal("taiwaneseDigital"),
|
|
1037
|
+
Type11.Literal("chineseCounting"),
|
|
1038
|
+
Type11.Literal("chineseLegalSimplified"),
|
|
1039
|
+
Type11.Literal("chineseCountingThousand"),
|
|
1040
|
+
Type11.Literal("koreanDigital"),
|
|
1041
|
+
Type11.Literal("koreanCounting"),
|
|
1042
|
+
Type11.Literal("koreanLegal"),
|
|
1043
|
+
Type11.Literal("koreanDigital2"),
|
|
1044
|
+
Type11.Literal("vietnameseCounting"),
|
|
1045
|
+
Type11.Literal("russianLower"),
|
|
1046
|
+
Type11.Literal("russianUpper"),
|
|
1047
|
+
Type11.Literal("none"),
|
|
1048
|
+
Type11.Literal("numberInDash"),
|
|
1049
|
+
Type11.Literal("hebrew1"),
|
|
1050
|
+
Type11.Literal("hebrew2"),
|
|
1051
|
+
Type11.Literal("arabicAlpha"),
|
|
1052
|
+
Type11.Literal("arabicAbjad"),
|
|
1053
|
+
Type11.Literal("hindiVowels"),
|
|
1054
|
+
Type11.Literal("hindiConsonants"),
|
|
1055
|
+
Type11.Literal("hindiNumbers"),
|
|
1056
|
+
Type11.Literal("hindiCounting"),
|
|
1057
|
+
Type11.Literal("thaiLetters"),
|
|
1058
|
+
Type11.Literal("thaiNumbers"),
|
|
1059
|
+
Type11.Literal("thaiCounting")
|
|
1060
|
+
],
|
|
1061
|
+
{
|
|
1062
|
+
description: "Number or bullet format for list levels"
|
|
1063
|
+
}
|
|
1064
|
+
);
|
|
1065
|
+
var ListMarkerFontSchema = Type11.Object(
|
|
1066
|
+
{
|
|
1067
|
+
family: Type11.Optional(Type11.String({ description: "Font family name" })),
|
|
1068
|
+
size: Type11.Optional(
|
|
1069
|
+
Type11.Number({ minimum: 1, description: "Marker size in points" })
|
|
1070
|
+
),
|
|
1071
|
+
color: Type11.Optional(HexColorSchema),
|
|
1072
|
+
bold: Type11.Optional(Type11.Boolean({ description: "Bold marker" })),
|
|
1073
|
+
italic: Type11.Optional(Type11.Boolean({ description: "Italic marker" })),
|
|
1074
|
+
underline: Type11.Optional(
|
|
1075
|
+
Type11.Boolean({ description: "Underlined marker" })
|
|
1076
|
+
)
|
|
1077
|
+
},
|
|
1078
|
+
{
|
|
1079
|
+
description: "Styling for the number/bullet glyph only. The list text is unaffected.",
|
|
1080
|
+
additionalProperties: false
|
|
1081
|
+
}
|
|
1082
|
+
);
|
|
1083
|
+
var ListLevelPropsSchema = Type11.Object(
|
|
1084
|
+
{
|
|
1085
|
+
level: Type11.Number({
|
|
1086
|
+
minimum: 0,
|
|
1087
|
+
maximum: 8,
|
|
1088
|
+
description: "Nesting level (0 = root, 1 = first sublevel, etc.)"
|
|
1089
|
+
}),
|
|
1090
|
+
format: Type11.Optional(LevelFormatSchema),
|
|
1091
|
+
text: Type11.Optional(
|
|
1092
|
+
Type11.String({
|
|
1093
|
+
description: 'Number format string (e.g., "%1." for "1.", "%1)" for "1)", custom bullet character for bullet format)'
|
|
1094
|
+
})
|
|
1095
|
+
),
|
|
1096
|
+
alignment: Type11.Optional(
|
|
1097
|
+
Type11.Union(
|
|
1098
|
+
[
|
|
1099
|
+
Type11.Literal("start"),
|
|
1100
|
+
Type11.Literal("end"),
|
|
1101
|
+
Type11.Literal("left"),
|
|
1102
|
+
Type11.Literal("right"),
|
|
1103
|
+
Type11.Literal("center")
|
|
1104
|
+
],
|
|
1105
|
+
{
|
|
1106
|
+
description: "Alignment of the numbering/bullet"
|
|
1107
|
+
}
|
|
1108
|
+
)
|
|
1109
|
+
),
|
|
1110
|
+
indent: Type11.Optional(IndentSchema),
|
|
1111
|
+
start: Type11.Optional(
|
|
1112
|
+
Type11.Number({
|
|
1113
|
+
minimum: 1,
|
|
1114
|
+
description: "Starting number for this level (default: 1)"
|
|
1115
|
+
})
|
|
1116
|
+
),
|
|
1117
|
+
font: Type11.Optional(ListMarkerFontSchema)
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
description: "Configuration for a single list level",
|
|
1121
|
+
additionalProperties: false
|
|
1122
|
+
}
|
|
1123
|
+
);
|
|
1124
|
+
var ListPropsSchema = Type11.Object(
|
|
1125
|
+
{
|
|
1126
|
+
items: Type11.Array(
|
|
1127
|
+
Type11.Union([
|
|
1128
|
+
Type11.String(),
|
|
1129
|
+
Type11.Object(
|
|
1130
|
+
{
|
|
1131
|
+
text: Type11.String(),
|
|
1132
|
+
level: Type11.Optional(
|
|
1133
|
+
Type11.Number({
|
|
1134
|
+
minimum: 0,
|
|
1135
|
+
maximum: 8,
|
|
1136
|
+
description: "Nesting level for this item"
|
|
1137
|
+
})
|
|
1138
|
+
),
|
|
1139
|
+
id: Type11.Optional(
|
|
1140
|
+
Type11.String({
|
|
1141
|
+
description: "Bookmark id for this item, targetable by internal links (#id) and cross-references ([@id])"
|
|
1142
|
+
})
|
|
1143
|
+
),
|
|
1144
|
+
revision: Type11.Optional(RevisionSchema)
|
|
1145
|
+
},
|
|
1146
|
+
{ additionalProperties: false }
|
|
1147
|
+
)
|
|
1148
|
+
]),
|
|
1149
|
+
{
|
|
1150
|
+
description: "List items (required)",
|
|
1151
|
+
minItems: 1
|
|
1152
|
+
}
|
|
1153
|
+
),
|
|
1154
|
+
reference: Type11.Optional(
|
|
1155
|
+
Type11.String({
|
|
1156
|
+
description: "Unique reference ID for this numbering configuration (auto-generated if not provided)"
|
|
1157
|
+
})
|
|
1158
|
+
),
|
|
1159
|
+
levels: Type11.Optional(
|
|
1160
|
+
Type11.Array(ListLevelPropsSchema, {
|
|
1161
|
+
description: "Configuration for each nesting level",
|
|
1162
|
+
minItems: 1,
|
|
1163
|
+
maxItems: 9
|
|
1164
|
+
})
|
|
1165
|
+
),
|
|
1166
|
+
// Simplified options for common use cases (when levels not specified)
|
|
1167
|
+
format: Type11.Optional(
|
|
1168
|
+
Type11.Union(
|
|
1169
|
+
[LevelFormatSchema, Type11.Literal("numbered"), Type11.Literal("none")],
|
|
1170
|
+
{
|
|
1171
|
+
description: "Format for level 0 (simplified option when levels not specified)"
|
|
1172
|
+
}
|
|
1173
|
+
)
|
|
1174
|
+
),
|
|
1175
|
+
bullet: Type11.Optional(
|
|
1176
|
+
Type11.String({
|
|
1177
|
+
description: "Custom bullet character (simplified option when levels not specified)"
|
|
1178
|
+
})
|
|
1179
|
+
),
|
|
1180
|
+
start: Type11.Optional(
|
|
1181
|
+
Type11.Number({
|
|
1182
|
+
minimum: 1,
|
|
1183
|
+
description: "Starting number for level 0. Applies whether or not `levels` is given; a `start` on the level itself wins."
|
|
1184
|
+
})
|
|
1185
|
+
),
|
|
1186
|
+
spacing: Type11.Optional(ListSpacingSchema),
|
|
1187
|
+
alignment: Type11.Optional(JustifiedAlignmentSchema),
|
|
1188
|
+
indent: Type11.Optional(
|
|
1189
|
+
Type11.Union([Type11.Number({ minimum: 0 }), IndentSchema])
|
|
1190
|
+
),
|
|
1191
|
+
// Anchored to the list as a whole: the range opens on the first rendered
|
|
1192
|
+
// item and closes on the last.
|
|
1193
|
+
comment: Type11.Optional(CommentSchema)
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
description: "List component props",
|
|
1197
|
+
additionalProperties: false
|
|
1198
|
+
}
|
|
1199
|
+
);
|
|
1200
|
+
|
|
1201
|
+
// src/schemas/component-defaults.ts
|
|
1202
|
+
var PER_INSTANCE_PROPS = [
|
|
1203
|
+
"revision",
|
|
1204
|
+
"comment",
|
|
1205
|
+
"footnotes",
|
|
1206
|
+
"endnotes"
|
|
1207
|
+
];
|
|
1208
|
+
var HeadingComponentDefaultsSchema = Type12.Partial(
|
|
1209
|
+
Type12.Omit(HeadingPropsSchema, PER_INSTANCE_PROPS)
|
|
1210
|
+
);
|
|
1211
|
+
var ParagraphComponentDefaultsSchema = Type12.Partial(
|
|
1212
|
+
Type12.Omit(ParagraphPropsSchema, PER_INSTANCE_PROPS)
|
|
1213
|
+
);
|
|
1214
|
+
var ImageComponentDefaultsSchema = Type12.Partial(ImagePropsSchema);
|
|
1215
|
+
var StatisticComponentDefaultsSchema = Type12.Partial(StatisticPropsSchema);
|
|
1216
|
+
var TableComponentDefaultsSchema = Type12.Partial(
|
|
1217
|
+
Type12.Omit(TablePropsSchema, ["rows"])
|
|
1218
|
+
);
|
|
1219
|
+
var SectionComponentDefaultsSchema = Type12.Partial(SectionPropsSchema);
|
|
1220
|
+
var ColumnsComponentDefaultsSchema = Type12.Partial(ColumnsPropsSchema);
|
|
1221
|
+
var ListComponentDefaultsSchema = Type12.Partial(
|
|
1222
|
+
Type12.Omit(ListPropsSchema, PER_INSTANCE_PROPS)
|
|
1223
|
+
);
|
|
1224
|
+
var ComponentDefaultsSchema = Type12.Object(
|
|
1225
|
+
{
|
|
1226
|
+
heading: Type12.Optional(HeadingComponentDefaultsSchema),
|
|
1227
|
+
paragraph: Type12.Optional(ParagraphComponentDefaultsSchema),
|
|
1228
|
+
image: Type12.Optional(ImageComponentDefaultsSchema),
|
|
1229
|
+
statistic: Type12.Optional(StatisticComponentDefaultsSchema),
|
|
1230
|
+
table: Type12.Optional(TableComponentDefaultsSchema),
|
|
1231
|
+
section: Type12.Optional(SectionComponentDefaultsSchema),
|
|
1232
|
+
columns: Type12.Optional(ColumnsComponentDefaultsSchema),
|
|
1233
|
+
list: Type12.Optional(ListComponentDefaultsSchema)
|
|
1234
|
+
},
|
|
1235
|
+
{ additionalProperties: true }
|
|
1236
|
+
// TODO: add a way to add strict custom component defaults when the plugin/registry paradigm will be implemented
|
|
1237
|
+
);
|
|
1238
|
+
|
|
1239
|
+
export {
|
|
1240
|
+
RevisionSegmentSchema,
|
|
1241
|
+
RevisionSchema,
|
|
1242
|
+
RevisionMarkSchema,
|
|
1243
|
+
CommentReplySchema,
|
|
1244
|
+
CommentSchema,
|
|
1245
|
+
HeadingPropsSchema,
|
|
1246
|
+
NoteSchema,
|
|
1247
|
+
FootnotesSchema,
|
|
1248
|
+
EndnotesSchema,
|
|
1249
|
+
ParagraphPropsSchema,
|
|
1250
|
+
ImagePropsSchema,
|
|
1251
|
+
StatisticPropsSchema,
|
|
1252
|
+
createTablePropsSchema,
|
|
1253
|
+
TablePropsSchema,
|
|
1254
|
+
createSectionPropsSchema,
|
|
1255
|
+
SectionPropsSchema,
|
|
1256
|
+
ColumnsPropsSchema,
|
|
1257
|
+
LevelFormatSchema,
|
|
1258
|
+
ListMarkerFontSchema,
|
|
1259
|
+
ListLevelPropsSchema,
|
|
1260
|
+
ListPropsSchema,
|
|
1261
|
+
PER_INSTANCE_PROPS,
|
|
1262
|
+
HeadingComponentDefaultsSchema,
|
|
1263
|
+
ParagraphComponentDefaultsSchema,
|
|
1264
|
+
ImageComponentDefaultsSchema,
|
|
1265
|
+
StatisticComponentDefaultsSchema,
|
|
1266
|
+
TableComponentDefaultsSchema,
|
|
1267
|
+
SectionComponentDefaultsSchema,
|
|
1268
|
+
ColumnsComponentDefaultsSchema,
|
|
1269
|
+
ListComponentDefaultsSchema,
|
|
1270
|
+
ComponentDefaultsSchema
|
|
1271
|
+
};
|
|
1272
|
+
//# sourceMappingURL=chunk-OP5PCDNN.js.map
|