@json-to-office/shared-docx 1.7.0 → 1.9.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-TCEEX3OY.js → chunk-3ELXAZC3.js} +6 -6
- package/dist/{chunk-OYSBFM6W.js → chunk-64CLASFN.js} +166 -98
- package/dist/chunk-64CLASFN.js.map +1 -0
- package/dist/{chunk-4LLFZ5OY.js → chunk-7ACKXJZL.js} +2 -2
- package/dist/{chunk-KGQAQE4S.js → chunk-JW5NOPVQ.js} +2 -2
- package/dist/{chunk-KLINZKYA.js → chunk-KEIKGZ7S.js} +2 -2
- package/dist/{chunk-DQ3DTWOC.js → chunk-M2GYRM4P.js} +2 -2
- package/dist/chunk-M2GYRM4P.js.map +1 -0
- package/dist/{chunk-5SMBRJIZ.js → chunk-N6CCWDPF.js} +4 -4
- package/dist/{chunk-MCS7JCUD.js → chunk-P43S7QYT.js} +6 -4
- package/dist/chunk-P43S7QYT.js.map +1 -0
- package/dist/{chunk-ZF3JUN3R.js → chunk-Q6RCIVH5.js} +3 -3
- package/dist/{chunk-Y6FW7T32.js → chunk-S7CHEAUQ.js} +4 -4
- package/dist/{chunk-TVMTDS57.js → chunk-UDP63RKH.js} +2 -2
- package/dist/{chunk-ZKBTTJN6.js → chunk-V3YRROBV.js} +20 -10
- package/dist/chunk-V3YRROBV.js.map +1 -0
- package/dist/{chunk-7TTAAYQ5.js → chunk-Y3XKLR27.js} +19 -9
- package/dist/chunk-Y3XKLR27.js.map +1 -0
- package/dist/index.d.ts +15 -5
- package/dist/index.js +16 -13
- package/dist/index.js.map +1 -1
- package/dist/schemas/api.js +8 -8
- package/dist/schemas/component-defaults.js +3 -3
- package/dist/schemas/component-registry.js +6 -6
- package/dist/schemas/components.d.ts +14 -1
- package/dist/schemas/components.js +9 -7
- package/dist/schemas/document.js +9 -9
- package/dist/schemas/export.js +7 -7
- package/dist/schemas/font.js +1 -1
- package/dist/schemas/generator.js +7 -7
- package/dist/schemas/renderer.js +3 -3
- package/dist/schemas/theme.js +4 -4
- package/dist/validation/unified/index.js +9 -9
- package/package.json +1 -1
- package/dist/chunk-7TTAAYQ5.js.map +0 -1
- package/dist/chunk-DQ3DTWOC.js.map +0 -1
- package/dist/chunk-MCS7JCUD.js.map +0 -1
- package/dist/chunk-OYSBFM6W.js.map +0 -1
- package/dist/chunk-ZKBTTJN6.js.map +0 -1
- /package/dist/{chunk-TCEEX3OY.js.map → chunk-3ELXAZC3.js.map} +0 -0
- /package/dist/{chunk-4LLFZ5OY.js.map → chunk-7ACKXJZL.js.map} +0 -0
- /package/dist/{chunk-KGQAQE4S.js.map → chunk-JW5NOPVQ.js.map} +0 -0
- /package/dist/{chunk-KLINZKYA.js.map → chunk-KEIKGZ7S.js.map} +0 -0
- /package/dist/{chunk-5SMBRJIZ.js.map → chunk-N6CCWDPF.js.map} +0 -0
- /package/dist/{chunk-ZF3JUN3R.js.map → chunk-Q6RCIVH5.js.map} +0 -0
- /package/dist/{chunk-Y6FW7T32.js.map → chunk-S7CHEAUQ.js.map} +0 -0
- /package/dist/{chunk-TVMTDS57.js.map → chunk-UDP63RKH.js.map} +0 -0
|
@@ -3,19 +3,19 @@ import {
|
|
|
3
3
|
strictDocumentValidator,
|
|
4
4
|
validateAgainstSchema,
|
|
5
5
|
validateJson
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S7CHEAUQ.js";
|
|
7
7
|
import {
|
|
8
8
|
ComponentDefinitionSchema
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-M2GYRM4P.js";
|
|
10
10
|
import {
|
|
11
11
|
CustomComponentDefinitionSchema
|
|
12
12
|
} from "./chunk-7GGTZ4TA.js";
|
|
13
13
|
import {
|
|
14
14
|
ReportPropsSchema
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-64CLASFN.js";
|
|
16
16
|
import {
|
|
17
17
|
ThemeConfigSchema
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-N6CCWDPF.js";
|
|
19
19
|
import {
|
|
20
20
|
ColumnsPropsSchema,
|
|
21
21
|
HeadingPropsSchema,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
SectionPropsSchema,
|
|
26
26
|
StatisticPropsSchema,
|
|
27
27
|
TablePropsSchema
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-P43S7QYT.js";
|
|
29
29
|
|
|
30
30
|
// src/validation/unified/index.ts
|
|
31
31
|
import {
|
|
@@ -410,4 +410,4 @@ export {
|
|
|
410
410
|
createErrorConfig,
|
|
411
411
|
formatErrorMessage
|
|
412
412
|
};
|
|
413
|
-
//# sourceMappingURL=chunk-
|
|
413
|
+
//# sourceMappingURL=chunk-3ELXAZC3.js.map
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
DOCX_RENDERER_IDS,
|
|
3
3
|
VisualPropsSchema,
|
|
4
4
|
docxPropsSchemaForRenderer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JW5NOPVQ.js";
|
|
6
6
|
import {
|
|
7
7
|
ThemeOverridesSchema
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-N6CCWDPF.js";
|
|
9
9
|
import {
|
|
10
10
|
ColumnsPropsSchema,
|
|
11
11
|
ComponentDefaultsSchema,
|
|
@@ -18,19 +18,19 @@ import {
|
|
|
18
18
|
TablePropsSchema,
|
|
19
19
|
createSectionPropsSchema,
|
|
20
20
|
createTablePropsSchema
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-P43S7QYT.js";
|
|
22
22
|
import {
|
|
23
23
|
AlignmentSchema,
|
|
24
24
|
FloatingPropertiesSchema,
|
|
25
25
|
SpacingSchema
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-V3YRROBV.js";
|
|
27
27
|
import {
|
|
28
28
|
HexColorSchema,
|
|
29
29
|
NoProofWordsSchema
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-Y3XKLR27.js";
|
|
31
31
|
|
|
32
32
|
// src/schemas/component-registry.ts
|
|
33
|
-
import { Type as
|
|
33
|
+
import { Type as Type7 } from "@sinclair/typebox";
|
|
34
34
|
|
|
35
35
|
// src/schemas/components/report.ts
|
|
36
36
|
import { Type } from "@sinclair/typebox";
|
|
@@ -452,45 +452,103 @@ var TocPropsSchema = Type3.Object(
|
|
|
452
452
|
}
|
|
453
453
|
);
|
|
454
454
|
|
|
455
|
-
// src/schemas/components/
|
|
455
|
+
// src/schemas/components/rule.ts
|
|
456
456
|
import { Type as Type4 } from "@sinclair/typebox";
|
|
457
|
-
var
|
|
457
|
+
var RulePropsSchema = Type4.Object(
|
|
458
|
+
{
|
|
459
|
+
thickness: Type4.Optional(
|
|
460
|
+
Type4.Number({
|
|
461
|
+
minimum: 0.25,
|
|
462
|
+
maximum: 12,
|
|
463
|
+
description: "Line weight in points (default 1). OOXML measures a border in eighths of a point and Word stops at 12pt, so this is the whole usable range."
|
|
464
|
+
})
|
|
465
|
+
),
|
|
466
|
+
color: Type4.Optional(HexColorSchema),
|
|
467
|
+
style: Type4.Optional(
|
|
468
|
+
Type4.Union(
|
|
469
|
+
[
|
|
470
|
+
Type4.Literal("solid"),
|
|
471
|
+
Type4.Literal("dashed"),
|
|
472
|
+
Type4.Literal("dotted"),
|
|
473
|
+
Type4.Literal("double")
|
|
474
|
+
],
|
|
475
|
+
{
|
|
476
|
+
description: 'Line style (default "solid"). `double` draws two lines and is measured per line, so it reads about twice as tall as its thickness.'
|
|
477
|
+
}
|
|
478
|
+
)
|
|
479
|
+
),
|
|
480
|
+
width: Type4.Optional(
|
|
481
|
+
Type4.Union(
|
|
482
|
+
[
|
|
483
|
+
Type4.Number({
|
|
484
|
+
minimum: 1,
|
|
485
|
+
description: "Rule width in points"
|
|
486
|
+
}),
|
|
487
|
+
Type4.String({
|
|
488
|
+
pattern: "^\\d+(\\.\\d+)?%$",
|
|
489
|
+
description: 'Rule width as a percentage of the text measure (e.g. "40%")'
|
|
490
|
+
})
|
|
491
|
+
],
|
|
492
|
+
{
|
|
493
|
+
description: "How far the rule runs (default: the full text measure). A percentage or a point width is turned into paragraph indents, resolved against the theme page \u2014 so a partial rule inside a column or a re-margined section is measured against the page, while the default full-measure rule is exact everywhere."
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
),
|
|
497
|
+
alignment: Type4.Optional(
|
|
498
|
+
Type4.Union(
|
|
499
|
+
[Type4.Literal("left"), Type4.Literal("center"), Type4.Literal("right")],
|
|
500
|
+
{
|
|
501
|
+
description: 'Which end of the measure a partial rule sits at (default "left"). Ignored at full width.'
|
|
502
|
+
}
|
|
503
|
+
)
|
|
504
|
+
),
|
|
505
|
+
spacing: Type4.Optional(SpacingSchema)
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
description: "Horizontal rule \u2014 a thin line across the measure, drawn as a Word paragraph border so it stays editable in Word.",
|
|
509
|
+
additionalProperties: false
|
|
510
|
+
}
|
|
511
|
+
);
|
|
512
|
+
|
|
513
|
+
// src/schemas/components/highcharts.ts
|
|
514
|
+
import { Type as Type5 } from "@sinclair/typebox";
|
|
515
|
+
var HighchartsPropsSchema = Type5.Object({
|
|
458
516
|
// Highcharts chart options - can be anything but must at least have chart.width and chart.height
|
|
459
|
-
options:
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
chart:
|
|
463
|
-
width:
|
|
464
|
-
height:
|
|
517
|
+
options: Type5.Intersect([
|
|
518
|
+
Type5.Record(Type5.String(), Type5.Unknown()),
|
|
519
|
+
Type5.Object({
|
|
520
|
+
chart: Type5.Object({
|
|
521
|
+
width: Type5.Number(),
|
|
522
|
+
height: Type5.Number()
|
|
465
523
|
})
|
|
466
524
|
})
|
|
467
525
|
]),
|
|
468
526
|
// Optional scale factor for export
|
|
469
|
-
scale:
|
|
527
|
+
scale: Type5.Optional(Type5.Number()),
|
|
470
528
|
// Optional resources forwarded verbatim to the export server (CSS/JS/files).
|
|
471
529
|
// Notably enables @font-face rules so charts render in custom fonts.
|
|
472
|
-
resources:
|
|
473
|
-
|
|
474
|
-
css:
|
|
475
|
-
js:
|
|
476
|
-
files:
|
|
530
|
+
resources: Type5.Optional(
|
|
531
|
+
Type5.Object({
|
|
532
|
+
css: Type5.Optional(Type5.String()),
|
|
533
|
+
js: Type5.Optional(Type5.String()),
|
|
534
|
+
files: Type5.Optional(Type5.Array(Type5.String()))
|
|
477
535
|
})
|
|
478
536
|
),
|
|
479
537
|
// Optional Highcharts Export Server URL override
|
|
480
|
-
serverUrl:
|
|
481
|
-
|
|
538
|
+
serverUrl: Type5.Optional(
|
|
539
|
+
Type5.String({
|
|
482
540
|
description: "Highcharts Export Server URL (default: http://localhost:7801)"
|
|
483
541
|
})
|
|
484
542
|
),
|
|
485
543
|
// Optional width for rendering (overrides chart width)
|
|
486
|
-
width:
|
|
487
|
-
|
|
544
|
+
width: Type5.Optional(
|
|
545
|
+
Type5.Union(
|
|
488
546
|
[
|
|
489
|
-
|
|
547
|
+
Type5.Number({
|
|
490
548
|
minimum: 1,
|
|
491
549
|
description: "Image width in pixels"
|
|
492
550
|
}),
|
|
493
|
-
|
|
551
|
+
Type5.String({
|
|
494
552
|
pattern: "^\\d+(\\.\\d+)?%$",
|
|
495
553
|
description: 'Image width as percentage (e.g., "90%") relative to content width'
|
|
496
554
|
})
|
|
@@ -501,14 +559,14 @@ var HighchartsPropsSchema = Type4.Object({
|
|
|
501
559
|
)
|
|
502
560
|
),
|
|
503
561
|
// Optional height for rendering (overrides chart height)
|
|
504
|
-
height:
|
|
505
|
-
|
|
562
|
+
height: Type5.Optional(
|
|
563
|
+
Type5.Union(
|
|
506
564
|
[
|
|
507
|
-
|
|
565
|
+
Type5.Number({
|
|
508
566
|
minimum: 1,
|
|
509
567
|
description: "Image height in pixels"
|
|
510
568
|
}),
|
|
511
|
-
|
|
569
|
+
Type5.String({
|
|
512
570
|
pattern: "^\\d+(\\.\\d+)?%$",
|
|
513
571
|
description: 'Image height as percentage (e.g., "90%") relative to content height'
|
|
514
572
|
})
|
|
@@ -521,112 +579,112 @@ var HighchartsPropsSchema = Type4.Object({
|
|
|
521
579
|
});
|
|
522
580
|
|
|
523
581
|
// src/schemas/components/chart.ts
|
|
524
|
-
import { Type as
|
|
525
|
-
var ChartTypeSchema =
|
|
582
|
+
import { Type as Type6 } from "@sinclair/typebox";
|
|
583
|
+
var ChartTypeSchema = Type6.Union(
|
|
526
584
|
[
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
585
|
+
Type6.Literal("area"),
|
|
586
|
+
Type6.Literal("bar"),
|
|
587
|
+
Type6.Literal("column"),
|
|
588
|
+
Type6.Literal("doughnut"),
|
|
589
|
+
Type6.Literal("line"),
|
|
590
|
+
Type6.Literal("pie"),
|
|
591
|
+
Type6.Literal("radar"),
|
|
592
|
+
Type6.Literal("scatter")
|
|
535
593
|
],
|
|
536
594
|
{ description: "Chart type" }
|
|
537
595
|
);
|
|
538
|
-
var ChartDataSeriesSchema =
|
|
596
|
+
var ChartDataSeriesSchema = Type6.Object(
|
|
539
597
|
{
|
|
540
|
-
name:
|
|
541
|
-
labels:
|
|
542
|
-
|
|
598
|
+
name: Type6.Optional(Type6.String({ description: "Series name" })),
|
|
599
|
+
labels: Type6.Optional(
|
|
600
|
+
Type6.Array(Type6.String(), {
|
|
543
601
|
description: "Category labels. Needed on every series, not just the first, and the same length as `values`; a series without both `labels` and `values` drops the whole chart."
|
|
544
602
|
})
|
|
545
603
|
),
|
|
546
|
-
values:
|
|
547
|
-
|
|
604
|
+
values: Type6.Optional(
|
|
605
|
+
Type6.Array(Type6.Number(), {
|
|
548
606
|
description: "Data values, one per label. Needed on every series \u2014 see `labels`."
|
|
549
607
|
})
|
|
550
608
|
)
|
|
551
609
|
},
|
|
552
610
|
{ additionalProperties: false }
|
|
553
611
|
);
|
|
554
|
-
var ChartPropsSchema =
|
|
612
|
+
var ChartPropsSchema = Type6.Object(
|
|
555
613
|
{
|
|
556
614
|
type: ChartTypeSchema,
|
|
557
|
-
data:
|
|
615
|
+
data: Type6.Array(ChartDataSeriesSchema, {
|
|
558
616
|
description: "Chart data series",
|
|
559
617
|
minItems: 1
|
|
560
618
|
}),
|
|
561
619
|
// Title
|
|
562
|
-
title:
|
|
563
|
-
showTitle:
|
|
564
|
-
|
|
620
|
+
title: Type6.Optional(Type6.String({ description: "Chart title text" })),
|
|
621
|
+
showTitle: Type6.Optional(
|
|
622
|
+
Type6.Boolean({
|
|
565
623
|
description: "Show the chart title. Defaults to true when `title` is set."
|
|
566
624
|
})
|
|
567
625
|
),
|
|
568
626
|
// Legend
|
|
569
|
-
showLegend:
|
|
570
|
-
|
|
627
|
+
showLegend: Type6.Optional(
|
|
628
|
+
Type6.Boolean({ description: "Show chart legend" })
|
|
571
629
|
),
|
|
572
|
-
legendPos:
|
|
573
|
-
|
|
630
|
+
legendPos: Type6.Optional(
|
|
631
|
+
Type6.Union(
|
|
574
632
|
[
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
633
|
+
Type6.Literal("b"),
|
|
634
|
+
Type6.Literal("l"),
|
|
635
|
+
Type6.Literal("r"),
|
|
636
|
+
Type6.Literal("t"),
|
|
637
|
+
Type6.Literal("tr")
|
|
580
638
|
],
|
|
581
639
|
{ description: "Legend position" }
|
|
582
640
|
)
|
|
583
641
|
),
|
|
584
642
|
// Series colors
|
|
585
|
-
chartColors:
|
|
586
|
-
|
|
643
|
+
chartColors: Type6.Optional(
|
|
644
|
+
Type6.Array(Type6.String(), {
|
|
587
645
|
description: "Series colors (hex or semantic theme names). Defaults to the theme palette."
|
|
588
646
|
})
|
|
589
647
|
),
|
|
590
648
|
// Axis titles
|
|
591
|
-
catAxisTitle:
|
|
592
|
-
|
|
649
|
+
catAxisTitle: Type6.Optional(
|
|
650
|
+
Type6.String({ description: "Category axis title" })
|
|
593
651
|
),
|
|
594
|
-
valAxisTitle:
|
|
595
|
-
|
|
652
|
+
valAxisTitle: Type6.Optional(
|
|
653
|
+
Type6.String({ description: "Value axis title" })
|
|
596
654
|
),
|
|
597
655
|
// Flow placement — the same vocabulary as `image` and `highcharts`.
|
|
598
|
-
width:
|
|
599
|
-
|
|
656
|
+
width: Type6.Optional(
|
|
657
|
+
Type6.Number({
|
|
600
658
|
minimum: 0,
|
|
601
659
|
exclusiveMinimum: 0,
|
|
602
660
|
description: "Chart width in inches. Defaults to the content width."
|
|
603
661
|
})
|
|
604
662
|
),
|
|
605
|
-
height:
|
|
606
|
-
|
|
663
|
+
height: Type6.Optional(
|
|
664
|
+
Type6.Number({
|
|
607
665
|
minimum: 0,
|
|
608
666
|
exclusiveMinimum: 0,
|
|
609
667
|
description: "Chart height in inches. Defaults to 3."
|
|
610
668
|
})
|
|
611
669
|
),
|
|
612
|
-
alignment:
|
|
613
|
-
caption:
|
|
614
|
-
|
|
670
|
+
alignment: Type6.Optional(AlignmentSchema),
|
|
671
|
+
caption: Type6.Optional(
|
|
672
|
+
Type6.String({
|
|
615
673
|
description: "Chart caption (supports rich text with **bold**, *italic*, ***both***)"
|
|
616
674
|
})
|
|
617
675
|
),
|
|
618
|
-
alt:
|
|
619
|
-
|
|
676
|
+
alt: Type6.Optional(
|
|
677
|
+
Type6.String({ description: "Alternative text for accessibility" })
|
|
620
678
|
),
|
|
621
|
-
spacing:
|
|
622
|
-
floating:
|
|
623
|
-
keepNext:
|
|
624
|
-
|
|
679
|
+
spacing: Type6.Optional(SpacingSchema),
|
|
680
|
+
floating: Type6.Optional(FloatingPropertiesSchema),
|
|
681
|
+
keepNext: Type6.Optional(
|
|
682
|
+
Type6.Boolean({
|
|
625
683
|
description: "Keep paragraph with next paragraph on same page"
|
|
626
684
|
})
|
|
627
685
|
),
|
|
628
|
-
keepLines:
|
|
629
|
-
|
|
686
|
+
keepLines: Type6.Optional(
|
|
687
|
+
Type6.Boolean({
|
|
630
688
|
description: "Keep all lines of paragraph together on same page"
|
|
631
689
|
})
|
|
632
690
|
)
|
|
@@ -674,6 +732,7 @@ var STANDARD_COMPONENTS_REGISTRY = [
|
|
|
674
732
|
"table",
|
|
675
733
|
"list",
|
|
676
734
|
"toc",
|
|
735
|
+
"rule",
|
|
677
736
|
"highcharts",
|
|
678
737
|
"chart",
|
|
679
738
|
"visual",
|
|
@@ -695,6 +754,7 @@ var STANDARD_COMPONENTS_REGISTRY = [
|
|
|
695
754
|
"table",
|
|
696
755
|
"list",
|
|
697
756
|
"toc",
|
|
757
|
+
"rule",
|
|
698
758
|
"highcharts",
|
|
699
759
|
"chart",
|
|
700
760
|
"visual",
|
|
@@ -707,7 +767,7 @@ var STANDARD_COMPONENTS_REGISTRY = [
|
|
|
707
767
|
name: "text-box",
|
|
708
768
|
propsSchema: TextBoxPropsSchema,
|
|
709
769
|
hasChildren: true,
|
|
710
|
-
allowedChildren: ["heading", "paragraph", "image"],
|
|
770
|
+
allowedChildren: ["heading", "paragraph", "image", "rule"],
|
|
711
771
|
category: "layout",
|
|
712
772
|
description: "Floating text container - allows positioning text anywhere on the page with absolute or relative positioning."
|
|
713
773
|
},
|
|
@@ -780,6 +840,13 @@ var STANDARD_COMPONENTS_REGISTRY = [
|
|
|
780
840
|
category: "content",
|
|
781
841
|
description: "Table of contents - automatically generates TOC from document headings. Supports depth ranges and custom styles."
|
|
782
842
|
},
|
|
843
|
+
{
|
|
844
|
+
name: "rule",
|
|
845
|
+
propsSchema: RulePropsSchema,
|
|
846
|
+
hasChildren: false,
|
|
847
|
+
category: "content",
|
|
848
|
+
description: "Horizontal rule - a thin line across the measure, for separating sections. Drawn as a Word paragraph border, so it stays a real Word object. Use this rather than collapsing a paragraph's line spacing to fake one."
|
|
849
|
+
},
|
|
783
850
|
{
|
|
784
851
|
name: "highcharts",
|
|
785
852
|
propsSchema: HighchartsPropsSchema,
|
|
@@ -830,26 +897,26 @@ function demandsProps(propsSchema) {
|
|
|
830
897
|
}
|
|
831
898
|
function createComponentSchemaObject(component, childrenType, selfRef, profile) {
|
|
832
899
|
const schema = {
|
|
833
|
-
name:
|
|
834
|
-
id:
|
|
835
|
-
enabled:
|
|
836
|
-
|
|
900
|
+
name: Type7.Literal(component.name),
|
|
901
|
+
id: Type7.Optional(Type7.String()),
|
|
902
|
+
enabled: Type7.Optional(
|
|
903
|
+
Type7.Boolean({
|
|
837
904
|
default: true,
|
|
838
905
|
description: "When false, this component is filtered out and not rendered. Defaults to true. Useful for conditional component inclusion."
|
|
839
906
|
})
|
|
840
907
|
)
|
|
841
908
|
};
|
|
842
909
|
if (component.special?.hasSchemaField) {
|
|
843
|
-
schema.$schema =
|
|
844
|
-
schema.renderer = profile ? profile.requireDiscriminator ?
|
|
910
|
+
schema.$schema = Type7.Optional(Type7.String({ format: "uri" }));
|
|
911
|
+
schema.renderer = profile ? profile.requireDiscriminator ? Type7.Literal(profile.renderer, {
|
|
845
912
|
description: "Renderer backend for this document"
|
|
846
|
-
}) :
|
|
847
|
-
|
|
913
|
+
}) : Type7.Optional(
|
|
914
|
+
Type7.Literal(profile.renderer, {
|
|
848
915
|
description: 'Renderer backend. Omitted defaults to "docxjs".'
|
|
849
916
|
})
|
|
850
|
-
) :
|
|
851
|
-
|
|
852
|
-
DOCX_RENDERER_IDS.map((renderer) =>
|
|
917
|
+
) : Type7.Optional(
|
|
918
|
+
Type7.Union(
|
|
919
|
+
DOCX_RENDERER_IDS.map((renderer) => Type7.Literal(renderer)),
|
|
853
920
|
{
|
|
854
921
|
description: 'Renderer backend. Omitted defaults to "docxjs".'
|
|
855
922
|
}
|
|
@@ -862,11 +929,11 @@ function createComponentSchemaObject(component, childrenType, selfRef, profile)
|
|
|
862
929
|
basePropsSchema,
|
|
863
930
|
profile.renderer
|
|
864
931
|
) : basePropsSchema;
|
|
865
|
-
schema.props = demandsProps(propsSchema) ? propsSchema :
|
|
932
|
+
schema.props = demandsProps(propsSchema) ? propsSchema : Type7.Optional(propsSchema);
|
|
866
933
|
if (component.hasChildren && childrenType) {
|
|
867
|
-
schema.children = component.special?.hasSchemaField ?
|
|
934
|
+
schema.children = component.special?.hasSchemaField ? Type7.Array(childrenType) : Type7.Optional(Type7.Array(childrenType));
|
|
868
935
|
}
|
|
869
|
-
return
|
|
936
|
+
return Type7.Object(schema, {
|
|
870
937
|
additionalProperties: false,
|
|
871
938
|
description: component.description
|
|
872
939
|
});
|
|
@@ -911,7 +978,7 @@ function createAllComponentSchemasNarrowed(selfRef, pluginSchemas = [], profile)
|
|
|
911
978
|
if (!containerDeps.every((d) => resolved.has(d))) continue;
|
|
912
979
|
const childSchemas = comp.allowedChildren.map((name) => resolved.get(name) ?? leafSchemas.get(name)).filter((s) => s !== void 0);
|
|
913
980
|
const allChildSchemas = [...childSchemas, ...pluginSchemas];
|
|
914
|
-
const childrenType = allChildSchemas.length === 1 ? allChildSchemas[0] :
|
|
981
|
+
const childrenType = allChildSchemas.length === 1 ? allChildSchemas[0] : Type7.Union(allChildSchemas);
|
|
915
982
|
resolved.set(
|
|
916
983
|
comp.name,
|
|
917
984
|
createComponentSchemaObject(comp, childrenType, selfRef, profile)
|
|
@@ -937,6 +1004,7 @@ export {
|
|
|
937
1004
|
TocStyleMappingSchema,
|
|
938
1005
|
TocDepthRangeSchema,
|
|
939
1006
|
TocPropsSchema,
|
|
1007
|
+
RulePropsSchema,
|
|
940
1008
|
HighchartsPropsSchema,
|
|
941
1009
|
ChartPropsSchema,
|
|
942
1010
|
STANDARD_COMPONENTS_REGISTRY,
|
|
@@ -950,4 +1018,4 @@ export {
|
|
|
950
1018
|
createAllComponentSchemas,
|
|
951
1019
|
createAllComponentSchemasNarrowed
|
|
952
1020
|
};
|
|
953
|
-
//# sourceMappingURL=chunk-
|
|
1021
|
+
//# sourceMappingURL=chunk-64CLASFN.js.map
|