@json-to-office/shared-docx 0.6.0 → 0.8.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-6SLVQATI.js → chunk-3AJ5NHUF.js} +2 -2
- package/dist/{chunk-YQECZGRR.js → chunk-7PK36JXG.js} +2 -2
- package/dist/chunk-F5IGGVWN.js +1339 -0
- package/dist/chunk-F5IGGVWN.js.map +1 -0
- package/dist/{chunk-V4L4S6ZS.js → chunk-JYGWHRMY.js} +2 -2
- package/dist/{chunk-L5TZFC47.js → chunk-M4OD7UER.js} +4 -42
- package/dist/chunk-M4OD7UER.js.map +1 -0
- package/dist/{chunk-22VYYAC2.js → chunk-MQ7KNRW2.js} +6 -4
- package/dist/{chunk-22VYYAC2.js.map → chunk-MQ7KNRW2.js.map} +1 -1
- package/dist/{chunk-OE5JFL7S.js → chunk-QEDASPGD.js} +8 -6
- package/dist/{chunk-OE5JFL7S.js.map → chunk-QEDASPGD.js.map} +1 -1
- package/dist/{chunk-SK6LSPFN.js → chunk-RFNU2AYT.js} +2 -2
- package/dist/chunk-S5KMAUDZ.js +645 -0
- package/dist/chunk-S5KMAUDZ.js.map +1 -0
- package/dist/{chunk-ABVYMFDA.js → chunk-VQXTI6WF.js} +2 -2
- package/dist/index.d.ts +220 -1
- package/dist/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/dist/schemas/api.js +4 -3
- package/dist/schemas/component-defaults.d.ts +448 -0
- package/dist/schemas/component-defaults.js +24 -0
- package/dist/schemas/component-defaults.js.map +1 -0
- package/dist/schemas/component-registry.js +2 -1
- package/dist/schemas/components.d.ts +436 -0
- package/dist/schemas/components.js +13 -11
- package/dist/schemas/document.js +5 -4
- package/dist/schemas/export.js +3 -2
- package/dist/schemas/generator.js +3 -2
- package/dist/schemas/theme.d.ts +4 -444
- package/dist/schemas/theme.js +12 -12
- package/dist/validation/unified/index.d.ts +223 -0
- package/dist/validation/unified/index.js +6 -5
- package/package.json +2 -2
- package/dist/chunk-L5TZFC47.js.map +0 -1
- package/dist/chunk-PN6JT3KF.js +0 -1926
- package/dist/chunk-PN6JT3KF.js.map +0 -1
- /package/dist/{chunk-6SLVQATI.js.map → chunk-3AJ5NHUF.js.map} +0 -0
- /package/dist/{chunk-YQECZGRR.js.map → chunk-7PK36JXG.js.map} +0 -0
- /package/dist/{chunk-V4L4S6ZS.js.map → chunk-JYGWHRMY.js.map} +0 -0
- /package/dist/{chunk-SK6LSPFN.js.map → chunk-RFNU2AYT.js.map} +0 -0
- /package/dist/{chunk-ABVYMFDA.js.map → chunk-VQXTI6WF.js.map} +0 -0
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ColumnsPropsSchema,
|
|
3
|
+
ComponentDefaultsSchema,
|
|
4
|
+
FloatingPropertiesSchema,
|
|
5
|
+
HeadingPropsSchema,
|
|
6
|
+
ImagePropsSchema,
|
|
7
|
+
ListPropsSchema,
|
|
8
|
+
ParagraphPropsSchema,
|
|
9
|
+
SectionPropsSchema,
|
|
10
|
+
StatisticPropsSchema,
|
|
11
|
+
TablePropsSchema,
|
|
12
|
+
createSectionPropsSchema,
|
|
13
|
+
createTablePropsSchema
|
|
14
|
+
} from "./chunk-F5IGGVWN.js";
|
|
15
|
+
import {
|
|
16
|
+
HexColorSchema
|
|
17
|
+
} from "./chunk-JOXJOD2C.js";
|
|
18
|
+
|
|
19
|
+
// src/schemas/component-registry.ts
|
|
20
|
+
import { Type as Type5 } from "@sinclair/typebox";
|
|
21
|
+
|
|
22
|
+
// src/schemas/components/report.ts
|
|
23
|
+
import { Type } from "@sinclair/typebox";
|
|
24
|
+
var createReportPropsSchema = (_moduleRef) => Type.Object(
|
|
25
|
+
{
|
|
26
|
+
theme: Type.Optional(
|
|
27
|
+
Type.String({
|
|
28
|
+
description: 'Theme name to apply (default: "minimal")',
|
|
29
|
+
examples: ["minimal", "corporate", "modern"],
|
|
30
|
+
default: "minimal"
|
|
31
|
+
})
|
|
32
|
+
),
|
|
33
|
+
componentDefaults: Type.Optional(ComponentDefaultsSchema),
|
|
34
|
+
metadata: Type.Optional(
|
|
35
|
+
Type.Object(
|
|
36
|
+
{
|
|
37
|
+
title: Type.Optional(
|
|
38
|
+
Type.String({
|
|
39
|
+
description: "Document title",
|
|
40
|
+
examples: ["Annual Report 2024", "Technical Documentation"]
|
|
41
|
+
})
|
|
42
|
+
),
|
|
43
|
+
subtitle: Type.Optional(
|
|
44
|
+
Type.String({
|
|
45
|
+
description: "Document subtitle"
|
|
46
|
+
})
|
|
47
|
+
),
|
|
48
|
+
description: Type.Optional(Type.String()),
|
|
49
|
+
author: Type.Optional(Type.String()),
|
|
50
|
+
company: Type.Optional(Type.String()),
|
|
51
|
+
date: Type.Optional(Type.String()),
|
|
52
|
+
created: Type.Optional(Type.String({ format: "date-time" })),
|
|
53
|
+
modified: Type.Optional(Type.String({ format: "date-time" })),
|
|
54
|
+
version: Type.Optional(Type.String()),
|
|
55
|
+
tags: Type.Optional(Type.Array(Type.String()))
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
description: "Document metadata (title, author, company, dates, etc.)",
|
|
59
|
+
additionalProperties: false
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
description: "Report component props",
|
|
66
|
+
additionalProperties: false
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
var ReportPropsSchema = createReportPropsSchema();
|
|
70
|
+
|
|
71
|
+
// src/schemas/components/text-box.ts
|
|
72
|
+
import { Type as Type2 } from "@sinclair/typebox";
|
|
73
|
+
var TextBoxPropsSchema = Type2.Object(
|
|
74
|
+
{
|
|
75
|
+
width: Type2.Optional(
|
|
76
|
+
Type2.Union(
|
|
77
|
+
[
|
|
78
|
+
Type2.Number({
|
|
79
|
+
minimum: 1,
|
|
80
|
+
description: "Text box width in pixels"
|
|
81
|
+
}),
|
|
82
|
+
Type2.String({
|
|
83
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
84
|
+
description: 'Text box width as percentage (e.g., "50%") relative to content width'
|
|
85
|
+
})
|
|
86
|
+
],
|
|
87
|
+
{
|
|
88
|
+
description: 'Text box width in pixels (number) or as percentage string (e.g., "50%")'
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
),
|
|
92
|
+
height: Type2.Optional(
|
|
93
|
+
Type2.Union(
|
|
94
|
+
[
|
|
95
|
+
Type2.Number({
|
|
96
|
+
minimum: 1,
|
|
97
|
+
description: "Text box height in pixels"
|
|
98
|
+
}),
|
|
99
|
+
Type2.String({
|
|
100
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
101
|
+
description: 'Text box height as percentage (e.g., "50%") relative to content height'
|
|
102
|
+
})
|
|
103
|
+
],
|
|
104
|
+
{
|
|
105
|
+
description: 'Text box height in pixels (number) or as percentage string (e.g., "50%")'
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
),
|
|
109
|
+
floating: Type2.Optional(FloatingPropertiesSchema),
|
|
110
|
+
style: Type2.Optional(
|
|
111
|
+
Type2.Object(
|
|
112
|
+
{
|
|
113
|
+
padding: Type2.Optional(
|
|
114
|
+
Type2.Object(
|
|
115
|
+
{
|
|
116
|
+
top: Type2.Optional(Type2.Number({ minimum: 0 })),
|
|
117
|
+
right: Type2.Optional(Type2.Number({ minimum: 0 })),
|
|
118
|
+
bottom: Type2.Optional(Type2.Number({ minimum: 0 })),
|
|
119
|
+
left: Type2.Optional(Type2.Number({ minimum: 0 }))
|
|
120
|
+
},
|
|
121
|
+
{ additionalProperties: false }
|
|
122
|
+
)
|
|
123
|
+
),
|
|
124
|
+
border: Type2.Optional(
|
|
125
|
+
Type2.Object(
|
|
126
|
+
{
|
|
127
|
+
top: Type2.Optional(
|
|
128
|
+
// Reuse border schema semantics: style/width/color
|
|
129
|
+
Type2.Object({
|
|
130
|
+
style: Type2.Optional(
|
|
131
|
+
Type2.Union([
|
|
132
|
+
Type2.Literal("solid"),
|
|
133
|
+
Type2.Literal("dashed"),
|
|
134
|
+
Type2.Literal("dotted"),
|
|
135
|
+
Type2.Literal("double"),
|
|
136
|
+
Type2.Literal("none")
|
|
137
|
+
])
|
|
138
|
+
),
|
|
139
|
+
width: Type2.Optional(Type2.Number({ minimum: 0 })),
|
|
140
|
+
color: Type2.Optional(HexColorSchema)
|
|
141
|
+
})
|
|
142
|
+
),
|
|
143
|
+
right: Type2.Optional(
|
|
144
|
+
Type2.Object({
|
|
145
|
+
style: Type2.Optional(
|
|
146
|
+
Type2.Union([
|
|
147
|
+
Type2.Literal("solid"),
|
|
148
|
+
Type2.Literal("dashed"),
|
|
149
|
+
Type2.Literal("dotted"),
|
|
150
|
+
Type2.Literal("double"),
|
|
151
|
+
Type2.Literal("none")
|
|
152
|
+
])
|
|
153
|
+
),
|
|
154
|
+
width: Type2.Optional(Type2.Number({ minimum: 0 })),
|
|
155
|
+
color: Type2.Optional(HexColorSchema)
|
|
156
|
+
})
|
|
157
|
+
),
|
|
158
|
+
bottom: Type2.Optional(
|
|
159
|
+
Type2.Object({
|
|
160
|
+
style: Type2.Optional(
|
|
161
|
+
Type2.Union([
|
|
162
|
+
Type2.Literal("solid"),
|
|
163
|
+
Type2.Literal("dashed"),
|
|
164
|
+
Type2.Literal("dotted"),
|
|
165
|
+
Type2.Literal("double"),
|
|
166
|
+
Type2.Literal("none")
|
|
167
|
+
])
|
|
168
|
+
),
|
|
169
|
+
width: Type2.Optional(Type2.Number({ minimum: 0 })),
|
|
170
|
+
color: Type2.Optional(HexColorSchema)
|
|
171
|
+
})
|
|
172
|
+
),
|
|
173
|
+
left: Type2.Optional(
|
|
174
|
+
Type2.Object({
|
|
175
|
+
style: Type2.Optional(
|
|
176
|
+
Type2.Union([
|
|
177
|
+
Type2.Literal("solid"),
|
|
178
|
+
Type2.Literal("dashed"),
|
|
179
|
+
Type2.Literal("dotted"),
|
|
180
|
+
Type2.Literal("double"),
|
|
181
|
+
Type2.Literal("none")
|
|
182
|
+
])
|
|
183
|
+
),
|
|
184
|
+
width: Type2.Optional(Type2.Number({ minimum: 0 })),
|
|
185
|
+
color: Type2.Optional(HexColorSchema)
|
|
186
|
+
})
|
|
187
|
+
)
|
|
188
|
+
},
|
|
189
|
+
{ additionalProperties: false }
|
|
190
|
+
)
|
|
191
|
+
),
|
|
192
|
+
shading: Type2.Optional(
|
|
193
|
+
Type2.Object(
|
|
194
|
+
{
|
|
195
|
+
fill: Type2.Optional(Type2.String())
|
|
196
|
+
},
|
|
197
|
+
{ additionalProperties: false }
|
|
198
|
+
)
|
|
199
|
+
)
|
|
200
|
+
},
|
|
201
|
+
{ additionalProperties: false }
|
|
202
|
+
)
|
|
203
|
+
)
|
|
204
|
+
},
|
|
205
|
+
{ additionalProperties: false }
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
// src/schemas/components/toc.ts
|
|
209
|
+
import { Type as Type3 } from "@sinclair/typebox";
|
|
210
|
+
var TocStyleSchema = Type3.Union(
|
|
211
|
+
[Type3.Literal("numeric"), Type3.Literal("bullet"), Type3.Literal("none")],
|
|
212
|
+
{ description: "TOC numbering style" }
|
|
213
|
+
);
|
|
214
|
+
var TocScopeSchema = Type3.Union(
|
|
215
|
+
[Type3.Literal("document"), Type3.Literal("section")],
|
|
216
|
+
{ description: "TOC scope: document-wide or section-only" }
|
|
217
|
+
);
|
|
218
|
+
var TocStyleMappingSchema = Type3.Object(
|
|
219
|
+
{
|
|
220
|
+
styleId: Type3.String({
|
|
221
|
+
description: "Custom style ID matching a key in theme.styles"
|
|
222
|
+
}),
|
|
223
|
+
level: Type3.Number({
|
|
224
|
+
minimum: 1,
|
|
225
|
+
maximum: 6,
|
|
226
|
+
description: "TOC level (1-6) to assign to this style"
|
|
227
|
+
})
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
description: "Mapping of custom style to TOC level",
|
|
231
|
+
additionalProperties: false
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
var TocDepthRangeSchema = Type3.Object(
|
|
235
|
+
{
|
|
236
|
+
from: Type3.Optional(
|
|
237
|
+
Type3.Number({
|
|
238
|
+
minimum: 1,
|
|
239
|
+
maximum: 6,
|
|
240
|
+
default: 1,
|
|
241
|
+
description: "Starting heading level (1-6). Defaults to 1 if not specified."
|
|
242
|
+
})
|
|
243
|
+
),
|
|
244
|
+
to: Type3.Optional(
|
|
245
|
+
Type3.Number({
|
|
246
|
+
minimum: 1,
|
|
247
|
+
maximum: 6,
|
|
248
|
+
default: 3,
|
|
249
|
+
description: "Ending heading level (1-6). Defaults to 3 if not specified."
|
|
250
|
+
})
|
|
251
|
+
)
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
description: 'Range of heading levels to include in TOC. Specify at least one of "from" or "to".',
|
|
255
|
+
additionalProperties: false
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
var TocPropsSchema = Type3.Object(
|
|
259
|
+
{
|
|
260
|
+
pageBreak: Type3.Optional(
|
|
261
|
+
Type3.Boolean({
|
|
262
|
+
description: "Insert page break before TOC block"
|
|
263
|
+
})
|
|
264
|
+
),
|
|
265
|
+
depth: Type3.Optional(
|
|
266
|
+
Type3.Object(
|
|
267
|
+
{
|
|
268
|
+
from: Type3.Optional(
|
|
269
|
+
Type3.Number({
|
|
270
|
+
minimum: 1,
|
|
271
|
+
maximum: 6,
|
|
272
|
+
default: 1,
|
|
273
|
+
description: "Starting heading level (1-6). Defaults to 1 if not specified."
|
|
274
|
+
})
|
|
275
|
+
),
|
|
276
|
+
to: Type3.Optional(
|
|
277
|
+
Type3.Number({
|
|
278
|
+
minimum: 1,
|
|
279
|
+
maximum: 6,
|
|
280
|
+
default: 3,
|
|
281
|
+
description: "Ending heading level (1-6). Defaults to 3 if not specified."
|
|
282
|
+
})
|
|
283
|
+
)
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
description: 'Range of heading levels to include in TOC. Specify "from", "to", or both. Defaults: from=1, to=3',
|
|
287
|
+
additionalProperties: false,
|
|
288
|
+
default: { to: 3 }
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
),
|
|
292
|
+
pageNumbersDepth: Type3.Optional(
|
|
293
|
+
Type3.Object(
|
|
294
|
+
{
|
|
295
|
+
from: Type3.Optional(
|
|
296
|
+
Type3.Number({
|
|
297
|
+
minimum: 1,
|
|
298
|
+
maximum: 6,
|
|
299
|
+
default: 1,
|
|
300
|
+
description: "Starting heading level (1-6). Defaults to 1 if not specified."
|
|
301
|
+
})
|
|
302
|
+
),
|
|
303
|
+
to: Type3.Optional(
|
|
304
|
+
Type3.Number({
|
|
305
|
+
minimum: 1,
|
|
306
|
+
maximum: 6,
|
|
307
|
+
default: 3,
|
|
308
|
+
description: "Ending heading level (1-6). Defaults to 3 if not specified."
|
|
309
|
+
})
|
|
310
|
+
)
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
description: 'Range of heading levels to show page numbers. Specify "from", "to", or both. When specified, page numbers are hidden for entries outside this range.',
|
|
314
|
+
additionalProperties: false
|
|
315
|
+
}
|
|
316
|
+
)
|
|
317
|
+
),
|
|
318
|
+
numberingStyle: Type3.Optional(TocStyleSchema),
|
|
319
|
+
title: Type3.Optional(
|
|
320
|
+
Type3.String({
|
|
321
|
+
description: "TOC heading title"
|
|
322
|
+
})
|
|
323
|
+
),
|
|
324
|
+
includePageNumbers: Type3.Optional(
|
|
325
|
+
Type3.Boolean({
|
|
326
|
+
default: true,
|
|
327
|
+
description: "Show page numbers next to entries"
|
|
328
|
+
})
|
|
329
|
+
),
|
|
330
|
+
numberSeparator: Type3.Optional(
|
|
331
|
+
Type3.Boolean({
|
|
332
|
+
default: true,
|
|
333
|
+
description: 'Use tab separator between entry and page number. True applies "\\t" (default), false applies " "'
|
|
334
|
+
})
|
|
335
|
+
),
|
|
336
|
+
scope: Type3.Optional(
|
|
337
|
+
Type3.Union([TocScopeSchema, Type3.Literal("auto")], {
|
|
338
|
+
default: "auto",
|
|
339
|
+
description: 'TOC scope: "document" for entire document, "section" for parent section only, "auto" for automatic detection (section if inside section, otherwise document)'
|
|
340
|
+
})
|
|
341
|
+
),
|
|
342
|
+
styles: Type3.Optional(
|
|
343
|
+
Type3.Array(TocStyleMappingSchema, {
|
|
344
|
+
description: "Custom style mappings for TOC entries. Maps custom theme styles to TOC levels."
|
|
345
|
+
})
|
|
346
|
+
)
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
description: "Table of Contents component props",
|
|
350
|
+
additionalProperties: false
|
|
351
|
+
}
|
|
352
|
+
);
|
|
353
|
+
|
|
354
|
+
// src/schemas/components/highcharts.ts
|
|
355
|
+
import { Type as Type4 } from "@sinclair/typebox";
|
|
356
|
+
var HighchartsPropsSchema = Type4.Object({
|
|
357
|
+
// Highcharts chart options - can be anything but must at least have chart.width and chart.height
|
|
358
|
+
options: Type4.Intersect([
|
|
359
|
+
Type4.Record(Type4.String(), Type4.Unknown()),
|
|
360
|
+
Type4.Object({
|
|
361
|
+
chart: Type4.Object({
|
|
362
|
+
width: Type4.Number(),
|
|
363
|
+
height: Type4.Number()
|
|
364
|
+
})
|
|
365
|
+
})
|
|
366
|
+
]),
|
|
367
|
+
// Optional scale factor for export
|
|
368
|
+
scale: Type4.Optional(Type4.Number()),
|
|
369
|
+
// Optional Highcharts Export Server URL override
|
|
370
|
+
serverUrl: Type4.Optional(Type4.String({ description: "Highcharts Export Server URL (default: http://localhost:7801)" })),
|
|
371
|
+
// Optional width for rendering (overrides chart width)
|
|
372
|
+
width: Type4.Optional(
|
|
373
|
+
Type4.Union(
|
|
374
|
+
[
|
|
375
|
+
Type4.Number({
|
|
376
|
+
minimum: 1,
|
|
377
|
+
description: "Image width in pixels"
|
|
378
|
+
}),
|
|
379
|
+
Type4.String({
|
|
380
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
381
|
+
description: 'Image width as percentage (e.g., "90%") relative to content width'
|
|
382
|
+
})
|
|
383
|
+
],
|
|
384
|
+
{
|
|
385
|
+
description: 'Rendered image width in pixels (number) or as percentage string (e.g., "90%")'
|
|
386
|
+
}
|
|
387
|
+
)
|
|
388
|
+
),
|
|
389
|
+
// Optional height for rendering (overrides chart height)
|
|
390
|
+
height: Type4.Optional(
|
|
391
|
+
Type4.Union(
|
|
392
|
+
[
|
|
393
|
+
Type4.Number({
|
|
394
|
+
minimum: 1,
|
|
395
|
+
description: "Image height in pixels"
|
|
396
|
+
}),
|
|
397
|
+
Type4.String({
|
|
398
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
399
|
+
description: 'Image height as percentage (e.g., "90%") relative to content height'
|
|
400
|
+
})
|
|
401
|
+
],
|
|
402
|
+
{
|
|
403
|
+
description: 'Rendered image height in pixels (number) or as percentage string (e.g., "90%")'
|
|
404
|
+
}
|
|
405
|
+
)
|
|
406
|
+
)
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
// src/schemas/component-registry.ts
|
|
410
|
+
var STANDARD_COMPONENTS_REGISTRY = [
|
|
411
|
+
// ========================================================================
|
|
412
|
+
// Container Components (can contain children)
|
|
413
|
+
// ========================================================================
|
|
414
|
+
{
|
|
415
|
+
name: "docx",
|
|
416
|
+
propsSchema: ReportPropsSchema,
|
|
417
|
+
hasChildren: true,
|
|
418
|
+
allowedChildren: ["section"],
|
|
419
|
+
category: "container",
|
|
420
|
+
description: "Main document container - defines the overall document structure. Required as the root component.",
|
|
421
|
+
special: {
|
|
422
|
+
hasSchemaField: true
|
|
423
|
+
// Only docx root has $schema field
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
name: "section",
|
|
428
|
+
propsSchema: SectionPropsSchema,
|
|
429
|
+
createPropsSchema: createSectionPropsSchema,
|
|
430
|
+
hasChildren: true,
|
|
431
|
+
allowedChildren: [
|
|
432
|
+
"heading",
|
|
433
|
+
"paragraph",
|
|
434
|
+
"image",
|
|
435
|
+
"statistic",
|
|
436
|
+
"table",
|
|
437
|
+
"list",
|
|
438
|
+
"toc",
|
|
439
|
+
"highcharts",
|
|
440
|
+
"columns",
|
|
441
|
+
"text-box"
|
|
442
|
+
],
|
|
443
|
+
category: "container",
|
|
444
|
+
description: "Section container - groups related content with optional title. Use for organizing document structure."
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
name: "columns",
|
|
448
|
+
propsSchema: ColumnsPropsSchema,
|
|
449
|
+
hasChildren: true,
|
|
450
|
+
allowedChildren: [
|
|
451
|
+
"heading",
|
|
452
|
+
"paragraph",
|
|
453
|
+
"image",
|
|
454
|
+
"statistic",
|
|
455
|
+
"table",
|
|
456
|
+
"list",
|
|
457
|
+
"toc",
|
|
458
|
+
"highcharts",
|
|
459
|
+
"text-box"
|
|
460
|
+
],
|
|
461
|
+
category: "layout",
|
|
462
|
+
description: "Multi-column layout - arranges content in 2-4 columns. Great for side-by-side content."
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
name: "text-box",
|
|
466
|
+
propsSchema: TextBoxPropsSchema,
|
|
467
|
+
hasChildren: true,
|
|
468
|
+
allowedChildren: ["heading", "paragraph", "image"],
|
|
469
|
+
category: "layout",
|
|
470
|
+
description: "Floating text container - allows positioning text anywhere on the page with absolute or relative positioning."
|
|
471
|
+
},
|
|
472
|
+
// ========================================================================
|
|
473
|
+
// Content Components (leaf nodes, no children)
|
|
474
|
+
// ========================================================================
|
|
475
|
+
{
|
|
476
|
+
name: "heading",
|
|
477
|
+
propsSchema: HeadingPropsSchema,
|
|
478
|
+
hasChildren: false,
|
|
479
|
+
category: "content",
|
|
480
|
+
description: "Heading text - supports levels 1-6 for document hierarchy. Level 1 is largest."
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
name: "paragraph",
|
|
484
|
+
propsSchema: ParagraphPropsSchema,
|
|
485
|
+
hasChildren: false,
|
|
486
|
+
category: "content",
|
|
487
|
+
description: "Paragraph text - supports formatting like bold, italic, and color. Main content element."
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
name: "image",
|
|
491
|
+
propsSchema: ImagePropsSchema,
|
|
492
|
+
hasChildren: false,
|
|
493
|
+
category: "content",
|
|
494
|
+
description: "Image element - displays images with optional caption. Supports various formats."
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
name: "statistic",
|
|
498
|
+
propsSchema: StatisticPropsSchema,
|
|
499
|
+
hasChildren: false,
|
|
500
|
+
category: "content",
|
|
501
|
+
description: "Statistic display - shows a number with description. Perfect for KPIs and metrics."
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
name: "table",
|
|
505
|
+
propsSchema: TablePropsSchema,
|
|
506
|
+
createPropsSchema: createTablePropsSchema,
|
|
507
|
+
hasChildren: false,
|
|
508
|
+
category: "content",
|
|
509
|
+
description: "Data table - displays tabular data with headers. Supports formatting and alignment."
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
name: "list",
|
|
513
|
+
propsSchema: ListPropsSchema,
|
|
514
|
+
hasChildren: false,
|
|
515
|
+
category: "content",
|
|
516
|
+
description: "List element - bulleted or numbered list items. Supports nested lists."
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
name: "toc",
|
|
520
|
+
propsSchema: TocPropsSchema,
|
|
521
|
+
hasChildren: false,
|
|
522
|
+
category: "content",
|
|
523
|
+
description: "Table of contents - automatically generates TOC from document headings. Supports depth ranges and custom styles."
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
name: "highcharts",
|
|
527
|
+
propsSchema: HighchartsPropsSchema,
|
|
528
|
+
hasChildren: false,
|
|
529
|
+
category: "content",
|
|
530
|
+
description: "Chart component powered by Highcharts - render line, bar, pie, heatmap, and more with rich options."
|
|
531
|
+
}
|
|
532
|
+
];
|
|
533
|
+
function getStandardComponent(name) {
|
|
534
|
+
return STANDARD_COMPONENTS_REGISTRY.find((c) => c.name === name);
|
|
535
|
+
}
|
|
536
|
+
function getAllStandardComponentNames() {
|
|
537
|
+
return STANDARD_COMPONENTS_REGISTRY.map((c) => c.name);
|
|
538
|
+
}
|
|
539
|
+
function getComponentsByCategory(category) {
|
|
540
|
+
return STANDARD_COMPONENTS_REGISTRY.filter((c) => c.category === category);
|
|
541
|
+
}
|
|
542
|
+
function getContainerComponents() {
|
|
543
|
+
return STANDARD_COMPONENTS_REGISTRY.filter((c) => c.hasChildren);
|
|
544
|
+
}
|
|
545
|
+
function getContentComponents() {
|
|
546
|
+
return STANDARD_COMPONENTS_REGISTRY.filter((c) => !c.hasChildren);
|
|
547
|
+
}
|
|
548
|
+
function isStandardComponent(name) {
|
|
549
|
+
return STANDARD_COMPONENTS_REGISTRY.some((c) => c.name === name);
|
|
550
|
+
}
|
|
551
|
+
function createComponentSchemaObject(component, childrenType, selfRef) {
|
|
552
|
+
const schema = {
|
|
553
|
+
name: Type5.Literal(component.name),
|
|
554
|
+
id: Type5.Optional(Type5.String()),
|
|
555
|
+
enabled: Type5.Optional(
|
|
556
|
+
Type5.Boolean({
|
|
557
|
+
default: true,
|
|
558
|
+
description: "When false, this component is filtered out and not rendered. Defaults to true. Useful for conditional component inclusion."
|
|
559
|
+
})
|
|
560
|
+
)
|
|
561
|
+
};
|
|
562
|
+
if (component.special?.hasSchemaField) {
|
|
563
|
+
schema.$schema = Type5.Optional(Type5.String({ format: "uri" }));
|
|
564
|
+
}
|
|
565
|
+
schema.props = component.createPropsSchema && selfRef ? component.createPropsSchema(selfRef) : component.propsSchema;
|
|
566
|
+
if (component.hasChildren && childrenType) {
|
|
567
|
+
schema.children = Type5.Optional(Type5.Array(childrenType));
|
|
568
|
+
}
|
|
569
|
+
return Type5.Object(schema, { additionalProperties: false });
|
|
570
|
+
}
|
|
571
|
+
function createAllComponentSchemas(recursiveRef) {
|
|
572
|
+
return STANDARD_COMPONENTS_REGISTRY.map(
|
|
573
|
+
(component) => createComponentSchemaObject(component, recursiveRef)
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
function createAllComponentSchemasNarrowed(selfRef, pluginSchemas = []) {
|
|
577
|
+
const leafSchemas = /* @__PURE__ */ new Map();
|
|
578
|
+
for (const comp of STANDARD_COMPONENTS_REGISTRY) {
|
|
579
|
+
if (!comp.hasChildren) {
|
|
580
|
+
leafSchemas.set(
|
|
581
|
+
comp.name,
|
|
582
|
+
createComponentSchemaObject(comp, void 0, selfRef)
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
const containers = STANDARD_COMPONENTS_REGISTRY.filter((c) => c.hasChildren);
|
|
587
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
588
|
+
const pending = [...containers];
|
|
589
|
+
while (pending.length > 0) {
|
|
590
|
+
const before = pending.length;
|
|
591
|
+
for (let i = pending.length - 1; i >= 0; i--) {
|
|
592
|
+
const comp = pending[i];
|
|
593
|
+
if (!comp.allowedChildren) {
|
|
594
|
+
resolved.set(
|
|
595
|
+
comp.name,
|
|
596
|
+
createComponentSchemaObject(comp, selfRef, selfRef)
|
|
597
|
+
);
|
|
598
|
+
pending.splice(i, 1);
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
601
|
+
const containerDeps = comp.allowedChildren.filter(
|
|
602
|
+
(name) => containers.some((c) => c.name === name)
|
|
603
|
+
);
|
|
604
|
+
if (!containerDeps.every((d) => resolved.has(d))) continue;
|
|
605
|
+
const childSchemas = comp.allowedChildren.map((name) => resolved.get(name) ?? leafSchemas.get(name)).filter((s) => s !== void 0);
|
|
606
|
+
const allChildSchemas = [...childSchemas, ...pluginSchemas];
|
|
607
|
+
const childrenType = allChildSchemas.length === 1 ? allChildSchemas[0] : Type5.Union(allChildSchemas);
|
|
608
|
+
resolved.set(
|
|
609
|
+
comp.name,
|
|
610
|
+
createComponentSchemaObject(comp, childrenType, selfRef)
|
|
611
|
+
);
|
|
612
|
+
pending.splice(i, 1);
|
|
613
|
+
}
|
|
614
|
+
if (pending.length === before) {
|
|
615
|
+
throw new Error(
|
|
616
|
+
`Circular allowedChildren among: ${pending.map((c) => c.name).join(", ")}`
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
const byName = new Map([...resolved, ...leafSchemas]);
|
|
621
|
+
return { schemas: [...byName.values()], byName };
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
export {
|
|
625
|
+
createReportPropsSchema,
|
|
626
|
+
ReportPropsSchema,
|
|
627
|
+
TextBoxPropsSchema,
|
|
628
|
+
TocStyleSchema,
|
|
629
|
+
TocScopeSchema,
|
|
630
|
+
TocStyleMappingSchema,
|
|
631
|
+
TocDepthRangeSchema,
|
|
632
|
+
TocPropsSchema,
|
|
633
|
+
HighchartsPropsSchema,
|
|
634
|
+
STANDARD_COMPONENTS_REGISTRY,
|
|
635
|
+
getStandardComponent,
|
|
636
|
+
getAllStandardComponentNames,
|
|
637
|
+
getComponentsByCategory,
|
|
638
|
+
getContainerComponents,
|
|
639
|
+
getContentComponents,
|
|
640
|
+
isStandardComponent,
|
|
641
|
+
createComponentSchemaObject,
|
|
642
|
+
createAllComponentSchemas,
|
|
643
|
+
createAllComponentSchemasNarrowed
|
|
644
|
+
};
|
|
645
|
+
//# sourceMappingURL=chunk-S5KMAUDZ.js.map
|