@json-to-office/core-docx 4.4.4 → 5.3.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/index.js CHANGED
@@ -456,17 +456,38 @@ var init_devportal_docx_theme = __esm({
456
456
  accent5: "#8A9299",
457
457
  accent6: "#E8A18D"
458
458
  },
459
+ palette: {
460
+ rule: "#D8D5D1",
461
+ textMuted: "#737373",
462
+ onPrimary: "#FFFFFF",
463
+ surfaceInverse: "#12191F",
464
+ positive: "#2E7D4F",
465
+ negative: "#B42318",
466
+ chart: ["accent", "primary", "accent4", "accent5", "accent6", "rule"]
467
+ },
459
468
  fonts: {
460
- heading: { family: "Helvetica", size: 23 },
461
- body: { family: "Helvetica", size: 9.5 },
462
- mono: { family: "Courier New", size: 10 },
463
- light: { family: "Helvetica", size: 23 }
469
+ heading: {
470
+ family: "Helvetica",
471
+ size: 23
472
+ },
473
+ body: {
474
+ family: "Helvetica",
475
+ size: 9.5
476
+ },
477
+ mono: {
478
+ family: "Courier New",
479
+ size: 10
480
+ },
481
+ light: {
482
+ family: "Helvetica",
483
+ size: 23
484
+ }
464
485
  },
465
486
  page: {
466
487
  size: "A4",
467
488
  margins: {
468
- top: 1440,
469
- bottom: 1440,
489
+ top: 1080,
490
+ bottom: 1080,
470
491
  left: 1080,
471
492
  right: 1080,
472
493
  header: 720,
@@ -474,13 +495,183 @@ var init_devportal_docx_theme = __esm({
474
495
  gutter: 0
475
496
  }
476
497
  },
498
+ typography: {
499
+ roles: {
500
+ eyebrow: {
501
+ face: "heading",
502
+ size: 8,
503
+ weight: 700,
504
+ case: "upper",
505
+ tracking: 10,
506
+ color: "accent",
507
+ spaceAfter: 4
508
+ },
509
+ display: {
510
+ face: "heading",
511
+ weight: 700,
512
+ color: "primary",
513
+ lineHeight: 1.05,
514
+ spaceAfter: 8,
515
+ tracking: -2
516
+ },
517
+ stat: {
518
+ face: "heading",
519
+ weight: 700,
520
+ color: "accent",
521
+ lineHeight: 1
522
+ },
523
+ quote: {
524
+ face: "body",
525
+ color: "textSecondary",
526
+ lineHeight: 1.3
527
+ },
528
+ label: {
529
+ face: "body",
530
+ size: 9,
531
+ weight: 700,
532
+ color: "textSecondary",
533
+ case: "upper",
534
+ tracking: 6
535
+ },
536
+ footer: {
537
+ face: "body",
538
+ size: 8,
539
+ color: "textMuted"
540
+ },
541
+ tableHeader: {
542
+ face: "body",
543
+ size: 9,
544
+ weight: 700,
545
+ color: "secondary"
546
+ },
547
+ tableCell: {
548
+ face: "body",
549
+ size: 9.5,
550
+ color: "textPrimary"
551
+ },
552
+ chartLabel: {
553
+ face: "body",
554
+ size: 9,
555
+ weight: 400,
556
+ color: "textSecondary"
557
+ },
558
+ tracker: {
559
+ face: "body",
560
+ size: 8,
561
+ case: "upper",
562
+ tracking: 6,
563
+ color: "textMuted"
564
+ },
565
+ source: {
566
+ face: "body",
567
+ size: 8,
568
+ color: "textMuted"
569
+ }
570
+ },
571
+ scale: {
572
+ a4: {
573
+ base: 9.5,
574
+ ratio: 1.2,
575
+ baselinePt: 2
576
+ },
577
+ letter: {
578
+ base: 9.5,
579
+ ratio: 1.2,
580
+ baselinePt: 2
581
+ }
582
+ }
583
+ },
584
+ spacing: {
585
+ basePt: 7,
586
+ blockGap: {
587
+ tight: 3,
588
+ normal: 7,
589
+ loose: 14
590
+ },
591
+ canvas: {
592
+ a4: {
593
+ safeAreaIn: 0.75,
594
+ gutterIn: 0,
595
+ columns: 12
596
+ },
597
+ letter: {
598
+ safeAreaIn: 0.75,
599
+ gutterIn: 0,
600
+ columns: 12
601
+ }
602
+ }
603
+ },
604
+ chrome: {
605
+ runningHead: {
606
+ type: "tracker",
607
+ color: "textMuted",
608
+ rule: {
609
+ weightPt: 0.5,
610
+ color: "rule"
611
+ },
612
+ alignment: "right"
613
+ },
614
+ tracker: {
615
+ type: "tracker",
616
+ color: "textMuted",
617
+ alignment: "right"
618
+ },
619
+ actionTitle: {
620
+ type: "display",
621
+ color: "primary"
622
+ },
623
+ keyTakeaways: {
624
+ type: "label",
625
+ color: "primary",
626
+ rule: {
627
+ weightPt: 1,
628
+ color: "accent"
629
+ },
630
+ padPt: 8
631
+ },
632
+ sourceLine: {
633
+ type: "source",
634
+ color: "textMuted"
635
+ },
636
+ confidentialFooter: {
637
+ type: "footer",
638
+ color: "textMuted",
639
+ rule: {
640
+ weightPt: 0.5,
641
+ color: "rule"
642
+ },
643
+ alignment: "left"
644
+ },
645
+ logoSlot: {
646
+ alignment: "right"
647
+ },
648
+ cover: {
649
+ type: "display",
650
+ color: "primary",
651
+ rule: {
652
+ weightPt: 3,
653
+ color: "accent"
654
+ }
655
+ }
656
+ },
657
+ motif: {
658
+ kind: "rule",
659
+ color: "accent",
660
+ weightPt: 2,
661
+ placement: "top"
662
+ },
477
663
  styles: {
478
664
  normal: {
479
665
  font: "body",
480
666
  color: "textPrimary",
481
- lineSpacing: { type: "multiple", value: 1.3 },
667
+ lineSpacing: {
668
+ type: "multiple",
669
+ value: 1.3
670
+ },
482
671
  alignment: "left",
483
- spacing: { after: 7 }
672
+ spacing: {
673
+ after: 7
674
+ }
484
675
  },
485
676
  title: {
486
677
  font: "heading",
@@ -488,9 +679,18 @@ var init_devportal_docx_theme = __esm({
488
679
  bold: true,
489
680
  color: "primary",
490
681
  alignment: "left",
491
- lineSpacing: { type: "multiple", value: 1.02 },
492
- characterSpacing: { type: "condensed", value: 8 },
493
- spacing: { before: 0, after: 10 }
682
+ lineSpacing: {
683
+ type: "multiple",
684
+ value: 1.02
685
+ },
686
+ characterSpacing: {
687
+ type: "condensed",
688
+ value: 8
689
+ },
690
+ spacing: {
691
+ before: 0,
692
+ after: 10
693
+ }
494
694
  },
495
695
  subtitle: {
496
696
  font: "body",
@@ -498,16 +698,28 @@ var init_devportal_docx_theme = __esm({
498
698
  italic: false,
499
699
  color: "textSecondary",
500
700
  alignment: "left",
501
- lineSpacing: { type: "multiple", value: 1.25 },
502
- spacing: { before: 0, after: 12 }
701
+ lineSpacing: {
702
+ type: "multiple",
703
+ value: 1.25
704
+ },
705
+ spacing: {
706
+ before: 0,
707
+ after: 12
708
+ }
503
709
  },
504
710
  heading1: {
505
711
  font: "heading",
506
712
  size: 21,
507
713
  bold: true,
508
714
  color: "primary",
509
- lineSpacing: { type: "multiple", value: 1.15 },
510
- spacing: { before: 26, after: 12 },
715
+ lineSpacing: {
716
+ type: "multiple",
717
+ value: 1.15
718
+ },
719
+ spacing: {
720
+ before: 26,
721
+ after: 12
722
+ },
511
723
  keepNext: true,
512
724
  alignment: "left",
513
725
  borders: {
@@ -524,8 +736,14 @@ var init_devportal_docx_theme = __esm({
524
736
  size: 15.5,
525
737
  bold: true,
526
738
  color: "secondary",
527
- lineSpacing: { type: "multiple", value: 1.15 },
528
- spacing: { before: 20, after: 8 },
739
+ lineSpacing: {
740
+ type: "multiple",
741
+ value: 1.15
742
+ },
743
+ spacing: {
744
+ before: 20,
745
+ after: 8
746
+ },
529
747
  keepNext: true,
530
748
  alignment: "left"
531
749
  },
@@ -534,7 +752,10 @@ var init_devportal_docx_theme = __esm({
534
752
  size: 12.5,
535
753
  bold: true,
536
754
  color: "secondary",
537
- spacing: { before: 14, after: 6 },
755
+ spacing: {
756
+ before: 14,
757
+ after: 6
758
+ },
538
759
  keepNext: true,
539
760
  alignment: "left"
540
761
  },
@@ -543,7 +764,10 @@ var init_devportal_docx_theme = __esm({
543
764
  size: 11.5,
544
765
  bold: true,
545
766
  color: "textPrimary",
546
- spacing: { before: 12, after: 4 },
767
+ spacing: {
768
+ before: 12,
769
+ after: 4
770
+ },
547
771
  keepNext: true,
548
772
  alignment: "left"
549
773
  },
@@ -552,7 +776,10 @@ var init_devportal_docx_theme = __esm({
552
776
  size: 10.5,
553
777
  bold: true,
554
778
  color: "secondary",
555
- spacing: { before: 10, after: 4 },
779
+ spacing: {
780
+ before: 10,
781
+ after: 4
782
+ },
556
783
  keepNext: true,
557
784
  alignment: "left"
558
785
  },
@@ -561,8 +788,14 @@ var init_devportal_docx_theme = __esm({
561
788
  size: 10.5,
562
789
  bold: false,
563
790
  color: "textSecondary",
564
- characterSpacing: { type: "expanded", value: 20 },
565
- spacing: { before: 10, after: 4 },
791
+ characterSpacing: {
792
+ type: "expanded",
793
+ value: 20
794
+ },
795
+ spacing: {
796
+ before: 10,
797
+ after: 4
798
+ },
566
799
  keepNext: true,
567
800
  alignment: "left"
568
801
  },
@@ -571,24 +804,53 @@ var init_devportal_docx_theme = __esm({
571
804
  size: 11,
572
805
  bold: true,
573
806
  color: "primary",
574
- spacing: { before: 5, after: 3 },
575
- tabStops: [{ type: "right", position: 9746, leader: "dot" }]
807
+ spacing: {
808
+ before: 5,
809
+ after: 3
810
+ },
811
+ tabStops: [
812
+ {
813
+ type: "right",
814
+ position: 9746,
815
+ leader: "dot"
816
+ }
817
+ ]
576
818
  },
577
819
  TOC2: {
578
820
  font: "body",
579
821
  size: 10.5,
580
822
  color: "textPrimary",
581
- indent: { left: 240 },
582
- spacing: { after: 2 },
583
- tabStops: [{ type: "right", position: 9746, leader: "dot" }]
823
+ indent: {
824
+ left: 240
825
+ },
826
+ spacing: {
827
+ after: 2
828
+ },
829
+ tabStops: [
830
+ {
831
+ type: "right",
832
+ position: 9746,
833
+ leader: "dot"
834
+ }
835
+ ]
584
836
  },
585
837
  TOC3: {
586
838
  font: "body",
587
839
  size: 10,
588
840
  color: "textSecondary",
589
- indent: { left: 480 },
590
- spacing: { after: 2 },
591
- tabStops: [{ type: "right", position: 9746, leader: "dot" }]
841
+ indent: {
842
+ left: 480
843
+ },
844
+ spacing: {
845
+ after: 2
846
+ },
847
+ tabStops: [
848
+ {
849
+ type: "right",
850
+ position: 9746,
851
+ leader: "dot"
852
+ }
853
+ ]
592
854
  }
593
855
  },
594
856
  componentDefaults: {
@@ -596,22 +858,37 @@ var init_devportal_docx_theme = __esm({
596
858
  width: 100,
597
859
  borderColor: "#E2E0DD",
598
860
  borderSize: 0.5,
599
- hideBorders: { left: true, right: true, insideVertical: true },
861
+ hideBorders: {
862
+ left: true,
863
+ right: true,
864
+ insideVertical: true
865
+ },
600
866
  cellDefaults: {
601
- padding: { top: 3, bottom: 3 }
867
+ padding: {
868
+ top: 3,
869
+ bottom: 3
870
+ }
602
871
  },
603
872
  headerCellDefaults: {
604
- font: { bold: true },
873
+ font: {
874
+ bold: true
875
+ },
605
876
  color: "#172028",
606
877
  backgroundColor: "#F7ECE7",
607
- borderColor: { bottom: "#D8D5D1" },
608
- borderSize: { bottom: 1 }
878
+ borderColor: {
879
+ bottom: "#D8D5D1"
880
+ },
881
+ borderSize: {
882
+ bottom: 1
883
+ }
609
884
  }
610
885
  },
611
886
  list: {
612
887
  format: "bullet",
613
888
  bullet: "\u2014",
614
- spacing: { item: 2 }
889
+ spacing: {
890
+ item: 2
891
+ }
615
892
  },
616
893
  image: {
617
894
  alignment: "center"
@@ -650,7 +927,19 @@ var init_vermilion_docx_theme = __esm({
650
927
  borderPrimary: "#C7C8CA",
651
928
  borderSecondary: "#EFEAE4",
652
929
  backgroundPrimary: "#FFFFFF",
653
- backgroundSecondary: "#FAF7F5"
930
+ backgroundSecondary: "#FAF7F5",
931
+ accent4: "#F4857A",
932
+ accent5: "#F9C4BE",
933
+ accent6: "#939598"
934
+ },
935
+ palette: {
936
+ rule: "#C7C8CA",
937
+ textMuted: "#939598",
938
+ onPrimary: "#FFFFFF",
939
+ surfaceInverse: "#282829",
940
+ positive: "#2E7D4F",
941
+ negative: "#B42318",
942
+ chart: ["accent", "primary", "textMuted", "accent4", "rule", "accent5"]
654
943
  },
655
944
  fonts: {
656
945
  heading: {
@@ -673,28 +962,190 @@ var init_vermilion_docx_theme = __esm({
673
962
  page: {
674
963
  size: "A4",
675
964
  margins: {
676
- top: 1360,
677
- bottom: 1360,
678
- left: 1180,
679
- right: 1180,
965
+ top: 1152,
966
+ bottom: 1152,
967
+ left: 1152,
968
+ right: 1152,
680
969
  header: 620,
681
970
  footer: 620,
682
971
  gutter: 0
683
972
  }
684
973
  },
685
- styles: {
686
- normal: {
687
- font: "body",
688
- color: "textPrimary",
689
- lineSpacing: {
690
- type: "multiple",
691
- value: 1.3
974
+ typography: {
975
+ roles: {
976
+ eyebrow: {
977
+ face: "heading",
978
+ size: 8,
979
+ weight: 700,
980
+ case: "upper",
981
+ tracking: 8,
982
+ color: "accent",
983
+ spaceAfter: 4
692
984
  },
693
- alignment: "left",
694
- spacing: {
695
- after: 8
696
- }
697
- },
985
+ display: {
986
+ face: "heading",
987
+ weight: 700,
988
+ color: "accent",
989
+ lineHeight: 1.05,
990
+ spaceAfter: 8
991
+ },
992
+ stat: {
993
+ face: "heading",
994
+ weight: 700,
995
+ color: "accent",
996
+ lineHeight: 1
997
+ },
998
+ quote: {
999
+ face: "body",
1000
+ color: "textSecondary",
1001
+ lineHeight: 1.3
1002
+ },
1003
+ label: {
1004
+ face: "body",
1005
+ size: 9,
1006
+ weight: 700,
1007
+ color: "textSecondary"
1008
+ },
1009
+ footer: {
1010
+ face: "body",
1011
+ size: 8,
1012
+ color: "textMuted"
1013
+ },
1014
+ tableHeader: {
1015
+ face: "body",
1016
+ size: 9.5,
1017
+ weight: 700,
1018
+ color: "accent"
1019
+ },
1020
+ tableCell: {
1021
+ face: "body",
1022
+ size: 9.5,
1023
+ color: "textPrimary"
1024
+ },
1025
+ chartLabel: {
1026
+ face: "body",
1027
+ size: 9,
1028
+ weight: 400,
1029
+ color: "textSecondary"
1030
+ },
1031
+ tracker: {
1032
+ face: "body",
1033
+ size: 8,
1034
+ case: "upper",
1035
+ tracking: 6,
1036
+ color: "textMuted"
1037
+ },
1038
+ source: {
1039
+ face: "body",
1040
+ size: 8,
1041
+ color: "textMuted"
1042
+ }
1043
+ },
1044
+ scale: {
1045
+ a4: {
1046
+ base: 10.5,
1047
+ ratio: 1.25,
1048
+ baselinePt: 2
1049
+ },
1050
+ letter: {
1051
+ base: 10.5,
1052
+ ratio: 1.25,
1053
+ baselinePt: 2
1054
+ }
1055
+ }
1056
+ },
1057
+ spacing: {
1058
+ basePt: 8,
1059
+ blockGap: {
1060
+ tight: 4,
1061
+ normal: 8,
1062
+ loose: 16
1063
+ },
1064
+ canvas: {
1065
+ a4: {
1066
+ safeAreaIn: 0.8,
1067
+ gutterIn: 0,
1068
+ columns: 12
1069
+ },
1070
+ letter: {
1071
+ safeAreaIn: 0.8,
1072
+ gutterIn: 0,
1073
+ columns: 12
1074
+ }
1075
+ }
1076
+ },
1077
+ chrome: {
1078
+ runningHead: {
1079
+ type: "tracker",
1080
+ color: "textMuted",
1081
+ rule: {
1082
+ weightPt: 0.5,
1083
+ color: "rule"
1084
+ },
1085
+ alignment: "right"
1086
+ },
1087
+ tracker: {
1088
+ type: "tracker",
1089
+ color: "textMuted",
1090
+ alignment: "right"
1091
+ },
1092
+ actionTitle: {
1093
+ type: "display",
1094
+ color: "primary"
1095
+ },
1096
+ keyTakeaways: {
1097
+ type: "label",
1098
+ color: "primary",
1099
+ rule: {
1100
+ weightPt: 1.5,
1101
+ color: "accent"
1102
+ },
1103
+ padPt: 8
1104
+ },
1105
+ sourceLine: {
1106
+ type: "source",
1107
+ color: "textMuted"
1108
+ },
1109
+ confidentialFooter: {
1110
+ type: "footer",
1111
+ color: "textMuted",
1112
+ rule: {
1113
+ weightPt: 0.5,
1114
+ color: "rule"
1115
+ },
1116
+ alignment: "left"
1117
+ },
1118
+ logoSlot: {
1119
+ alignment: "right"
1120
+ },
1121
+ cover: {
1122
+ type: "display",
1123
+ color: "primary",
1124
+ rule: {
1125
+ weightPt: 4,
1126
+ color: "accent"
1127
+ }
1128
+ }
1129
+ },
1130
+ motif: {
1131
+ kind: "rule",
1132
+ color: "accent",
1133
+ weightPt: 4,
1134
+ placement: "top"
1135
+ },
1136
+ styles: {
1137
+ normal: {
1138
+ font: "body",
1139
+ color: "textPrimary",
1140
+ lineSpacing: {
1141
+ type: "multiple",
1142
+ value: 1.3
1143
+ },
1144
+ alignment: "left",
1145
+ spacing: {
1146
+ after: 8
1147
+ }
1148
+ },
698
1149
  heading1: {
699
1150
  font: "heading",
700
1151
  size: 25,
@@ -814,23 +1265,40 @@ var init_vermilion_docx_theme = __esm({
814
1265
  insideVertical: true
815
1266
  },
816
1267
  cellDefaults: {
817
- font: { size: 9.5 },
818
- padding: { top: 7, bottom: 7 },
1268
+ font: {
1269
+ size: 9.5
1270
+ },
1271
+ padding: {
1272
+ top: 7,
1273
+ bottom: 7
1274
+ },
819
1275
  verticalAlignment: "middle"
820
1276
  },
821
1277
  headerCellDefaults: {
822
1278
  color: "#EF4130",
823
- font: { size: 9.5, bold: true },
824
- padding: { top: 0, bottom: 8 },
1279
+ font: {
1280
+ size: 9.5,
1281
+ bold: true
1282
+ },
1283
+ padding: {
1284
+ top: 0,
1285
+ bottom: 8
1286
+ },
825
1287
  verticalAlignment: "bottom",
826
- borderColor: { bottom: "#EF4130" },
827
- borderSize: { bottom: 0.5 }
1288
+ borderColor: {
1289
+ bottom: "#EF4130"
1290
+ },
1291
+ borderSize: {
1292
+ bottom: 0.5
1293
+ }
828
1294
  }
829
1295
  },
830
1296
  list: {
831
1297
  format: "bullet",
832
1298
  bullet: "\u2014",
833
- spacing: { item: 2 }
1299
+ spacing: {
1300
+ item: 2
1301
+ }
834
1302
  },
835
1303
  image: {
836
1304
  alignment: "center"
@@ -12322,6 +12790,7 @@ function finishDocxBlocks(expanded, document, theme, evaluator, effects, sources
12322
12790
  }
12323
12791
  const props = isBlockRecord(section2.props) ? { ...section2.props } : {};
12324
12792
  if (chrome) {
12793
+ const declaring = local.includes(chrome);
12325
12794
  const environment = {
12326
12795
  ...chrome.environment,
12327
12796
  context: {
@@ -12344,7 +12813,7 @@ function finishDocxBlocks(expanded, document, theme, evaluator, effects, sources
12344
12813
  );
12345
12814
  props[part] = evaluator.expand(compiled, `${path4}/props/${part}`);
12346
12815
  }
12347
- if (props.pageBreak === void 0)
12816
+ if (props.pageBreak === void 0 && declaring)
12348
12817
  props.pageBreak = chrome.settings.pageBreak ?? true;
12349
12818
  }
12350
12819
  for (const effect of local)
@@ -14631,6 +15100,39 @@ var docxRequiredChromeRule = {
14631
15100
  }));
14632
15101
  }
14633
15102
  };
15103
+ var docxExhibitRequiredRule = {
15104
+ id: "docx/exhibit-required",
15105
+ description: "Fewer data exhibits \u2014 charts, or tables of two or more columns \u2014 than a profile or policy expects. Off until one sets a minimum.",
15106
+ code: QUALITY_CODES.EXHIBIT_MISSING,
15107
+ category: "composition",
15108
+ defaultSeverity: "warning",
15109
+ defaultCertainty: "deterministic",
15110
+ formats: ["docx"],
15111
+ defaultEnabled: false,
15112
+ defaultParameters: { minimumExhibits: 1 },
15113
+ evaluate: ({ facts, configuration, profile }) => {
15114
+ const minimum = numberParameter(
15115
+ configuration.parameters,
15116
+ "minimumExhibits",
15117
+ 1
15118
+ );
15119
+ if (minimum <= 0) return [];
15120
+ const charts = facts.filter((fact) => fact.kind === "docx/chart").length;
15121
+ const tables = facts.filter(
15122
+ (fact) => fact.kind === "docx/table" && fact.columns.length >= 2
15123
+ ).length;
15124
+ const exhibits = charts + tables;
15125
+ if (exhibits >= minimum) return [];
15126
+ return [
15127
+ {
15128
+ path: themeFact(facts)?.path ?? "/props",
15129
+ message: exhibits === 0 ? `The document carries no data exhibit \u2014 no chart, no table of two or more columns; the ${profile?.id ?? "selected"} profile expects at least ${minimum}.` : `The document carries ${exhibits} data exhibit(s); the ${profile?.id ?? "selected"} profile expects at least ${minimum}.`,
15130
+ suggestion: "Put the numbers the argument leans on into a chart-figure or a data-table block, with a takeaway and a source, where the text discusses them. A kpi-row summarises; it does not count.",
15131
+ context: { charts, tables, minimum }
15132
+ }
15133
+ ];
15134
+ }
15135
+ };
14634
15136
  var SECTION_CHROME_PARTS = ["header", "footer", "pageNumber"];
14635
15137
  var docxRunningHeadRule = {
14636
15138
  id: "docx/running-head",
@@ -14660,7 +15162,7 @@ var docxRunningHeadRule = {
14660
15162
  {
14661
15163
  path: fact.path,
14662
15164
  message: `Section ${fact.index + 1} carries no ${parts}; the ${profile?.id ?? "selected"} profile expects a running head on every section after the cover.`,
14663
- suggestion: "Invoke a running-head block at the top of the first body section: its section effect fills every later section with the tracker and n / N.",
15165
+ suggestion: "Invoke a running-head block at the top of the first body section: its section effect fills every later section with the title and n / N.",
14664
15166
  context: { section: fact.index, missing }
14665
15167
  }
14666
15168
  ];
@@ -14848,6 +15350,7 @@ var DOCX_QUALITY_RULES = {
14848
15350
  docxPaletteRule,
14849
15351
  docxRequiredChromeRule,
14850
15352
  docxRunningHeadRule,
15353
+ docxExhibitRequiredRule,
14851
15354
  docxTypeScaleRule,
14852
15355
  docxSizeCountRule,
14853
15356
  docxRoleDriftRule
@@ -14857,7 +15360,7 @@ var DOCX_QUALITY_PROFILES = {
14857
15360
  "client-report": {
14858
15361
  id: "client-report",
14859
15362
  formats: ["docx"],
14860
- description: "Client or public-administration report: a running head with page numbers on every section after the cover, a takeaway and a source wherever a block declares them, no heading skipped, every size on the theme scale with at most eight in play, and no page rendered empty or left half blank under the running head.",
15363
+ description: "Client or public-administration report: a running head with page numbers on every section after the cover, a takeaway and a source wherever a block declares them, no heading skipped, every size on the theme scale with at most eight in play, no page rendered empty or left half blank under the running head, and at least one chart or table.",
14861
15364
  rules: {
14862
15365
  "docx/required-chrome": {
14863
15366
  parameters: { required: ["takeaway", "source"] }
@@ -14879,7 +15382,9 @@ var DOCX_QUALITY_PROFILES = {
14879
15382
  "rendered/empty-page": { severity: "warning" },
14880
15383
  // A section that ends early on its own page reads as unfinished; the
14881
15384
  // judge calls a page two-thirds blank a defect.
14882
- "rendered/page-underfilled": { severity: "warning" }
15385
+ "rendered/page-underfilled": { severity: "warning" },
15386
+ // A client report argues numbers: at least one chart or real table.
15387
+ "docx/exhibit-required": { enabled: true }
14883
15388
  }
14884
15389
  },
14885
15390
  "executive-report": {
@@ -14893,7 +15398,34 @@ var DOCX_QUALITY_PROFILES = {
14893
15398
  "technical-report": {
14894
15399
  id: "technical-report",
14895
15400
  formats: ["docx"],
14896
- description: "Portable professional report defaults."
15401
+ description: "Technical report or memo: numbered sections under a running head with page numbers on every section after the cover, a source wherever a block declares one, no heading skipped, every size on the theme scale with at most nine in play, no page rendered empty or left half blank, and at least one chart or table.",
15402
+ rules: {
15403
+ // A figure or table in a technical report cites where its numbers come
15404
+ // from; the takeaway is the client report's ask, the caption is the
15405
+ // block's own.
15406
+ "docx/required-chrome": { parameters: { required: ["source"] } },
15407
+ "docx/running-head": {
15408
+ parameters: {
15409
+ required: ["header", "footer", "pageNumber"],
15410
+ fromSection: 1
15411
+ }
15412
+ },
15413
+ "docx/heading-hierarchy": { severity: "warning" },
15414
+ "docx/type-scale": { enabled: true },
15415
+ // One more than the client report: the contents list paints TOC2 and
15416
+ // the sub-headings paint heading 2.
15417
+ "docx/size-count": { enabled: true, parameters: { maximumSizes: 9 } },
15418
+ "docx/role-drift": { enabled: true },
15419
+ "rendered/empty-page": { severity: "warning" },
15420
+ "rendered/page-underfilled": { severity: "warning" },
15421
+ // A technical report argues from measurements: a runs table, a chart.
15422
+ "docx/exhibit-required": { enabled: true }
15423
+ }
15424
+ },
15425
+ general: {
15426
+ id: "general",
15427
+ formats: ["docx"],
15428
+ description: "Any document that names no archetype: integrity and information-design rules at their defaults, nothing required by structure."
14897
15429
  },
14898
15430
  "legal-appendix": {
14899
15431
  id: "legal-appendix",
@@ -14901,7 +15433,7 @@ var DOCX_QUALITY_PROFILES = {
14901
15433
  description: "Dense appendix: preserve integrity without editorial taste."
14902
15434
  }
14903
15435
  };
14904
- var DOCX_DEFAULT_QUALITY_PROFILE = DOCX_QUALITY_PROFILES["technical-report"];
15436
+ var DOCX_DEFAULT_QUALITY_PROFILE = DOCX_QUALITY_PROFILES["general"];
14905
15437
  var DOCX_PROFILES_BY_ID = DOCX_QUALITY_PROFILES;
14906
15438
  function declaredDocxQualityProfile(document) {
14907
15439
  const props = document?.props;
@@ -15068,8 +15600,9 @@ init_styles();
15068
15600
 
15069
15601
  // src/blueprints/index.ts
15070
15602
  import {
15071
- blockDependencies,
15072
- validateBlueprint
15603
+ instantiateBlueprint,
15604
+ registerBlueprints,
15605
+ valueAt
15073
15606
  } from "@json-to-office/shared";
15074
15607
  import { collectPlaceholders as collectPlaceholders2 } from "@json-to-office/quality";
15075
15608
  import { existsSync, readdirSync, readFileSync as readFileSync2 } from "fs";
@@ -15140,8 +15673,7 @@ var client_report_docx_blueprint_default = {
15140
15673
  ref: "section-opener",
15141
15674
  slots: {
15142
15675
  number: "01",
15143
- title: "{{Section title: the finding, as a statement}}",
15144
- tracker: "{{Tracker: one word}}"
15676
+ title: "{{Section title: the finding, as a statement}}"
15145
15677
  }
15146
15678
  }
15147
15679
  },
@@ -15198,8 +15730,7 @@ var client_report_docx_blueprint_default = {
15198
15730
  ref: "section-opener",
15199
15731
  slots: {
15200
15732
  number: "02",
15201
- title: "{{Section title: the finding, as a statement}}",
15202
- tracker: "{{Tracker: one word}}"
15733
+ title: "{{Section title: the finding, as a statement}}"
15203
15734
  }
15204
15735
  }
15205
15736
  },
@@ -15271,15 +15802,529 @@ var client_report_docx_blueprint_default = {
15271
15802
  ref: "section-opener",
15272
15803
  slots: {
15273
15804
  number: "03",
15274
- title: "{{Section title: the finding, as a statement}}",
15275
- tracker: "{{Tracker: one word}}"
15805
+ title: "{{Section title: the finding, as a statement}}"
15806
+ }
15807
+ }
15808
+ },
15809
+ {
15810
+ name: "paragraph",
15811
+ props: {
15812
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15813
+ }
15814
+ },
15815
+ {
15816
+ name: "block",
15817
+ props: {
15818
+ ref: "data-table",
15819
+ slots: {
15820
+ title: "{{Table title: what it compares, and the period}}",
15821
+ labelHeader: "{{Row label}}",
15822
+ labels: ["{{Row 1}}", "{{Row 2}}", "{{Row 3}}"],
15823
+ columns: [
15824
+ {
15825
+ header: "{{Measure (unit)}}",
15826
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
15827
+ },
15828
+ {
15829
+ header: "{{Change}}",
15830
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
15831
+ }
15832
+ ],
15833
+ source: "{{Source: system or document, date}}"
15834
+ }
15835
+ }
15836
+ },
15837
+ {
15838
+ name: "block",
15839
+ props: {
15840
+ ref: "callout",
15841
+ slots: {
15842
+ label: "{{Note label}}",
15843
+ text: "{{Note: a caveat about the numbers, a definition or the method}}"
15844
+ }
15845
+ }
15846
+ }
15847
+ ]
15848
+ },
15849
+ {
15850
+ name: "section",
15851
+ children: [
15852
+ {
15853
+ name: "block",
15854
+ props: {
15855
+ ref: "section-opener",
15856
+ slots: {
15857
+ number: "04",
15858
+ title: "{{Section title: the finding, as a statement}}"
15859
+ }
15860
+ }
15861
+ },
15862
+ {
15863
+ name: "paragraph",
15864
+ props: {
15865
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15866
+ }
15867
+ },
15868
+ {
15869
+ name: "block",
15870
+ props: {
15871
+ ref: "footnotes"
15872
+ }
15873
+ }
15874
+ ]
15875
+ }
15876
+ ]
15877
+ },
15878
+ narrative: {
15879
+ description: "Argument-led: takeaways, then three sections of prose with one KPI row and one note as evidence, next steps last; one data table in the analysis section carries the numbers the argument leans on.",
15880
+ whenToUse: "The brief is a position, an assessment or a recommendation with few numbers; the reader follows an argument.",
15881
+ pages: {
15882
+ min: 3,
15883
+ max: 6
15884
+ },
15885
+ metadata: {
15886
+ title: "{{Title: as on the cover}}",
15887
+ author: "{{Author or team}}",
15888
+ company: "{{Client name}}",
15889
+ date: "{{Month YYYY}}"
15890
+ },
15891
+ children: [
15892
+ {
15893
+ name: "section",
15894
+ children: [
15895
+ {
15896
+ name: "block",
15897
+ props: {
15898
+ ref: "cover",
15899
+ slots: {
15900
+ title: "{{Title: the report's conclusion in one sentence}}",
15901
+ subtitle: "{{Subtitle: what the report answers, for whom}}",
15902
+ client: "{{Client name}}",
15903
+ date: "{{Month YYYY}}",
15904
+ confidentiality: "{{Confidentiality: Confidential, or For internal use}}"
15276
15905
  }
15277
15906
  }
15907
+ }
15908
+ ]
15909
+ },
15910
+ {
15911
+ name: "section",
15912
+ children: [
15913
+ {
15914
+ name: "block",
15915
+ props: {
15916
+ ref: "running-head",
15917
+ slots: {
15918
+ confidentiality: "{{Confidentiality: as on the cover}}",
15919
+ date: "{{Month YYYY}}"
15920
+ }
15921
+ }
15922
+ },
15923
+ {
15924
+ name: "block",
15925
+ props: {
15926
+ ref: "section-opener",
15927
+ slots: {
15928
+ number: "01",
15929
+ title: "{{Section title: the finding, as a statement}}"
15930
+ }
15931
+ }
15932
+ },
15933
+ {
15934
+ name: "block",
15935
+ props: {
15936
+ ref: "key-takeaways",
15937
+ slots: {
15938
+ items: [
15939
+ "{{Takeaway 1: one claim, one sentence, with its number}}",
15940
+ "{{Takeaway 2: one claim, one sentence, with its number}}",
15941
+ "{{Takeaway 3: the recommendation that follows}}"
15942
+ ]
15943
+ }
15944
+ }
15945
+ },
15946
+ {
15947
+ name: "paragraph",
15948
+ props: {
15949
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15950
+ }
15951
+ },
15952
+ {
15953
+ name: "paragraph",
15954
+ props: {
15955
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15956
+ }
15957
+ }
15958
+ ]
15959
+ },
15960
+ {
15961
+ name: "section",
15962
+ children: [
15963
+ {
15964
+ name: "block",
15965
+ props: {
15966
+ ref: "section-opener",
15967
+ slots: {
15968
+ number: "02",
15969
+ title: "{{Section title: the finding, as a statement}}"
15970
+ }
15971
+ }
15972
+ },
15973
+ {
15974
+ name: "paragraph",
15975
+ props: {
15976
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15977
+ }
15978
+ },
15979
+ {
15980
+ name: "block",
15981
+ props: {
15982
+ ref: "callout",
15983
+ slots: {
15984
+ label: "{{Note label}}",
15985
+ text: "{{Note: a caveat about the numbers, a definition or the method}}"
15986
+ }
15987
+ }
15988
+ },
15989
+ {
15990
+ name: "paragraph",
15991
+ props: {
15992
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15993
+ }
15994
+ }
15995
+ ]
15996
+ },
15997
+ {
15998
+ name: "section",
15999
+ children: [
16000
+ {
16001
+ name: "block",
16002
+ props: {
16003
+ ref: "section-opener",
16004
+ slots: {
16005
+ number: "03",
16006
+ title: "{{Section title: the finding, as a statement}}"
16007
+ }
16008
+ }
16009
+ },
16010
+ {
16011
+ name: "paragraph",
16012
+ props: {
16013
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16014
+ }
16015
+ },
16016
+ {
16017
+ name: "block",
16018
+ props: {
16019
+ ref: "data-table",
16020
+ slots: {
16021
+ title: "{{Table title: what it compares, and the period}}",
16022
+ labelHeader: "{{Row label}}",
16023
+ labels: ["{{Row 1}}", "{{Row 2}}", "{{Row 3}}"],
16024
+ columns: [
16025
+ {
16026
+ header: "{{Measure (unit)}}",
16027
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
16028
+ },
16029
+ {
16030
+ header: "{{Change}}",
16031
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
16032
+ }
16033
+ ],
16034
+ source: "{{Source: system or document, date}}"
16035
+ }
16036
+ }
16037
+ },
16038
+ {
16039
+ name: "block",
16040
+ props: {
16041
+ ref: "kpi-row",
16042
+ slots: {
16043
+ items: [
16044
+ {
16045
+ value: "{{0.0}}",
16046
+ label: "{{What it measures}}"
16047
+ },
16048
+ {
16049
+ value: "{{0.0}}",
16050
+ label: "{{What it measures}}"
16051
+ },
16052
+ {
16053
+ value: "{{0.0}}",
16054
+ label: "{{What it measures}}"
16055
+ }
16056
+ ],
16057
+ source: "{{Source: system or document, date}}"
16058
+ }
16059
+ }
16060
+ },
16061
+ {
16062
+ name: "paragraph",
16063
+ props: {
16064
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16065
+ }
16066
+ }
16067
+ ]
16068
+ },
16069
+ {
16070
+ name: "section",
16071
+ children: [
16072
+ {
16073
+ name: "block",
16074
+ props: {
16075
+ ref: "section-opener",
16076
+ slots: {
16077
+ number: "04",
16078
+ title: "{{Section title: the finding, as a statement}}"
16079
+ }
16080
+ }
16081
+ },
16082
+ {
16083
+ name: "paragraph",
16084
+ props: {
16085
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16086
+ }
16087
+ },
16088
+ {
16089
+ name: "block",
16090
+ props: {
16091
+ ref: "footnotes"
16092
+ }
16093
+ }
16094
+ ]
16095
+ }
16096
+ ]
16097
+ }
16098
+ }
16099
+ };
16100
+
16101
+ // src/templates/blueprints/technical-report.docx.blueprint.json
16102
+ var technical_report_docx_blueprint_default = {
16103
+ id: "technical-report",
16104
+ format: "docx",
16105
+ title: "Technical report",
16106
+ description: "A technical report or memo for engineers and their managers: numbered sections under a running head that numbers the pages, a contents list, a summary first, method and results with a chart and a runs table, recommendations, a readiness or decision statement, references last; or a memo that opens with To, From, Date and Subject and argues one recommendation in two pages.",
16107
+ whenToUse: "A load-test or audit report, a migration or capacity plan, a post-incident report, a standard, a security review, or a short memo recommending one option. Not for a client's periodic report, which reads for the conclusion first and rarely cites a method.",
16108
+ theme: "consulting",
16109
+ profile: "technical-report",
16110
+ definitions: "technical-report-blocks.docx.json",
16111
+ numbering: "sections",
16112
+ toc: true,
16113
+ variants: {
16114
+ "data-heavy": {
16115
+ description: "Evidence-led: summary, scope and method with its assumptions, results with a chart and two sub-headed findings and a runs table, recommendations with a risk note, a readiness statement, references.",
16116
+ whenToUse: "The brief comes with measurements: runs, findings, incidents, timings, anything the reader will check against a figure.",
16117
+ pages: {
16118
+ min: 4,
16119
+ max: 10
16120
+ },
16121
+ metadata: {
16122
+ title: "{{Title: as on the cover}}",
16123
+ author: "{{Author or team}}",
16124
+ company: "{{Team or client name}}",
16125
+ date: "{{Month YYYY}}"
16126
+ },
16127
+ children: [
16128
+ {
16129
+ name: "section",
16130
+ children: [
16131
+ {
16132
+ name: "block",
16133
+ props: {
16134
+ ref: "cover",
16135
+ slots: {
16136
+ title: "{{Title: the report's conclusion in one sentence}}",
16137
+ subtitle: "{{Subtitle: what was examined, for whom}}",
16138
+ client: "{{Team or client name}}",
16139
+ date: "{{Month YYYY}}",
16140
+ confidentiality: "{{Confidentiality: Internal, or Confidential}}"
16141
+ }
16142
+ }
16143
+ }
16144
+ ]
16145
+ },
16146
+ {
16147
+ name: "section",
16148
+ children: [
16149
+ {
16150
+ name: "block",
16151
+ props: {
16152
+ ref: "running-head",
16153
+ slots: {
16154
+ confidentiality: "{{Confidentiality: as on the cover}}",
16155
+ date: "{{Month YYYY}}"
16156
+ }
16157
+ }
16158
+ },
16159
+ {
16160
+ name: "toc",
16161
+ props: {
16162
+ scope: "document",
16163
+ title: "Contents",
16164
+ depth: {
16165
+ from: 1,
16166
+ to: 2
16167
+ }
16168
+ }
16169
+ },
16170
+ {
16171
+ name: "block",
16172
+ props: {
16173
+ ref: "section-opener",
16174
+ slots: {
16175
+ number: "1",
16176
+ title: "{{Section title: the conclusion, as a statement}}"
16177
+ }
16178
+ }
16179
+ },
16180
+ {
16181
+ name: "block",
16182
+ props: {
16183
+ ref: "key-takeaways",
16184
+ slots: {
16185
+ label: "Summary",
16186
+ items: [
16187
+ "{{Finding 1: one claim, one sentence, with its number}}",
16188
+ "{{Finding 2: one claim, one sentence, with its number}}",
16189
+ "{{Finding 3: the recommendation that follows}}"
16190
+ ]
16191
+ }
16192
+ }
16193
+ },
16194
+ {
16195
+ name: "paragraph",
16196
+ props: {
16197
+ text: "{{Body: what was examined, what was found and what is recommended, in one paragraph}}"
16198
+ }
16199
+ }
16200
+ ]
16201
+ },
16202
+ {
16203
+ name: "section",
16204
+ children: [
16205
+ {
16206
+ name: "block",
16207
+ props: {
16208
+ ref: "section-opener",
16209
+ slots: {
16210
+ number: "2",
16211
+ title: "{{Section title: scope and method}}"
16212
+ }
16213
+ }
16214
+ },
16215
+ {
16216
+ name: "paragraph",
16217
+ props: {
16218
+ text: "{{Body: what was measured, under which conditions, with which instruments, and what was left out}}"
16219
+ }
16220
+ },
16221
+ {
16222
+ name: "block",
16223
+ props: {
16224
+ ref: "callout",
16225
+ slots: {
16226
+ label: "{{Note label: Assumptions, or Limitations}}",
16227
+ text: "{{Note: the assumption or limit the results rest on}}"
16228
+ }
16229
+ }
16230
+ }
16231
+ ]
16232
+ },
16233
+ {
16234
+ name: "section",
16235
+ children: [
16236
+ {
16237
+ name: "block",
16238
+ props: {
16239
+ ref: "section-opener",
16240
+ slots: {
16241
+ number: "3",
16242
+ title: "{{Section title: results, as the headline finding}}"
16243
+ }
16244
+ }
16245
+ },
16246
+ {
16247
+ name: "paragraph",
16248
+ props: {
16249
+ text: "{{Body: what the figure shows and the number that matters}}"
16250
+ }
16251
+ },
16252
+ {
16253
+ name: "block",
16254
+ props: {
16255
+ ref: "chart-figure",
16256
+ slots: {
16257
+ chart: {
16258
+ name: "highcharts",
16259
+ props: {
16260
+ width: "100%",
16261
+ options: {
16262
+ chart: {
16263
+ type: "column",
16264
+ width: 900,
16265
+ height: 460
16266
+ },
16267
+ title: {
16268
+ text: null
16269
+ },
16270
+ xAxis: {
16271
+ categories: [
16272
+ "{{Condition 1}}",
16273
+ "{{Condition 2}}",
16274
+ "{{Condition 3}}"
16275
+ ],
16276
+ title: {
16277
+ text: "{{Independent variable (unit)}}"
16278
+ }
16279
+ },
16280
+ yAxis: {
16281
+ min: 0,
16282
+ title: {
16283
+ text: "{{Measure (unit)}}"
16284
+ }
16285
+ },
16286
+ series: [
16287
+ {
16288
+ name: "{{Series name}}",
16289
+ data: [0, 0, 0]
16290
+ }
16291
+ ],
16292
+ credits: {
16293
+ enabled: false
16294
+ }
16295
+ }
16296
+ }
16297
+ },
16298
+ caption: "{{Caption: what the chart shows, as a statement}}",
16299
+ takeaway: "{{Takeaway: the one sentence the reader should keep}}",
16300
+ source: "{{Source: system, run or document, date}}"
16301
+ }
16302
+ }
16303
+ },
16304
+ {
16305
+ name: "heading",
16306
+ props: {
16307
+ level: 2,
16308
+ text: "{{Sub-heading 3.1: the first result, as a statement}}"
16309
+ }
16310
+ },
16311
+ {
16312
+ name: "paragraph",
16313
+ props: {
16314
+ text: "{{Body: the evidence for the sub-heading, with its numbers}}"
16315
+ }
16316
+ },
16317
+ {
16318
+ name: "heading",
16319
+ props: {
16320
+ level: 2,
16321
+ text: "{{Sub-heading 3.2: the second result, as a statement}}"
16322
+ }
15278
16323
  },
15279
16324
  {
15280
16325
  name: "paragraph",
15281
16326
  props: {
15282
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16327
+ text: "{{Body: the evidence for the sub-heading, with its numbers}}"
15283
16328
  }
15284
16329
  },
15285
16330
  {
@@ -15287,8 +16332,8 @@ var client_report_docx_blueprint_default = {
15287
16332
  props: {
15288
16333
  ref: "data-table",
15289
16334
  slots: {
15290
- title: "{{Table title: what it compares, and the period}}",
15291
- labelHeader: "{{Row label}}",
16335
+ title: "{{Table title: the runs or cases, and their conditions}}",
16336
+ labelHeader: "{{Run or case}}",
15292
16337
  labels: ["{{Row 1}}", "{{Row 2}}", "{{Row 3}}"],
15293
16338
  columns: [
15294
16339
  {
@@ -15296,21 +16341,43 @@ var client_report_docx_blueprint_default = {
15296
16341
  cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
15297
16342
  },
15298
16343
  {
15299
- header: "{{Change}}",
16344
+ header: "{{Measure (unit)}}",
15300
16345
  cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
15301
16346
  }
15302
16347
  ],
15303
- source: "{{Source: system or document, date}}"
16348
+ notes: "{{Notes: definitions, conditions, exclusions the reader needs to read the figures}}",
16349
+ source: "{{Source: system, run or document, date}}"
16350
+ }
16351
+ }
16352
+ }
16353
+ ]
16354
+ },
16355
+ {
16356
+ name: "section",
16357
+ children: [
16358
+ {
16359
+ name: "block",
16360
+ props: {
16361
+ ref: "section-opener",
16362
+ slots: {
16363
+ number: "4",
16364
+ title: "{{Section title: recommendations, as what to do}}"
15304
16365
  }
15305
16366
  }
15306
16367
  },
16368
+ {
16369
+ name: "paragraph",
16370
+ props: {
16371
+ text: "{{Body: each recommendation with its expected effect, cost and owner}}"
16372
+ }
16373
+ },
15307
16374
  {
15308
16375
  name: "block",
15309
16376
  props: {
15310
16377
  ref: "callout",
15311
16378
  slots: {
15312
- label: "{{Note label}}",
15313
- text: "{{Note: a caveat about the numbers, a definition or the method}}"
16379
+ label: "{{Note label: Risk, or Open question}}",
16380
+ text: "{{Note: what could invalidate the recommendation and how it will be checked}}"
15314
16381
  }
15315
16382
  }
15316
16383
  }
@@ -15324,22 +16391,24 @@ var client_report_docx_blueprint_default = {
15324
16391
  props: {
15325
16392
  ref: "section-opener",
15326
16393
  slots: {
15327
- number: "04",
15328
- title: "{{Section title: the finding, as a statement}}",
15329
- tracker: "{{Tracker: one word}}"
16394
+ number: "5",
16395
+ title: "{{Section title: the readiness or decision statement}}"
15330
16396
  }
15331
16397
  }
15332
16398
  },
15333
16399
  {
15334
16400
  name: "paragraph",
15335
16401
  props: {
15336
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16402
+ text: "{{Body: the answer to the brief's question, with its condition}}"
15337
16403
  }
15338
16404
  },
15339
16405
  {
15340
16406
  name: "block",
15341
16407
  props: {
15342
- ref: "footnotes"
16408
+ ref: "footnotes",
16409
+ slots: {
16410
+ title: "References"
16411
+ }
15343
16412
  }
15344
16413
  }
15345
16414
  ]
@@ -15347,16 +16416,16 @@ var client_report_docx_blueprint_default = {
15347
16416
  ]
15348
16417
  },
15349
16418
  narrative: {
15350
- description: "Argument-led: takeaways, then three sections of prose with one KPI row and one note as evidence, next steps last.",
15351
- whenToUse: "The brief is a position, an assessment or a recommendation with few numbers; the reader follows an argument.",
16419
+ description: "Argument-led: summary, context and constraints, an analysis section built on one comparison table, options and risks, a recommendation with next steps, references.",
16420
+ whenToUse: "The brief is a plan, a policy, a standard or an assessment with few numbers; the reader follows an argument to a decision.",
15352
16421
  pages: {
15353
16422
  min: 3,
15354
- max: 6
16423
+ max: 8
15355
16424
  },
15356
16425
  metadata: {
15357
16426
  title: "{{Title: as on the cover}}",
15358
16427
  author: "{{Author or team}}",
15359
- company: "{{Client name}}",
16428
+ company: "{{Team or client name}}",
15360
16429
  date: "{{Month YYYY}}"
15361
16430
  },
15362
16431
  children: [
@@ -15369,10 +16438,10 @@ var client_report_docx_blueprint_default = {
15369
16438
  ref: "cover",
15370
16439
  slots: {
15371
16440
  title: "{{Title: the report's conclusion in one sentence}}",
15372
- subtitle: "{{Subtitle: what the report answers, for whom}}",
15373
- client: "{{Client name}}",
16441
+ subtitle: "{{Subtitle: what was examined, for whom}}",
16442
+ client: "{{Team or client name}}",
15374
16443
  date: "{{Month YYYY}}",
15375
- confidentiality: "{{Confidentiality: Confidential, or For internal use}}"
16444
+ confidentiality: "{{Confidentiality: Internal, or Confidential}}"
15376
16445
  }
15377
16446
  }
15378
16447
  }
@@ -15391,14 +16460,24 @@ var client_report_docx_blueprint_default = {
15391
16460
  }
15392
16461
  }
15393
16462
  },
16463
+ {
16464
+ name: "toc",
16465
+ props: {
16466
+ scope: "document",
16467
+ title: "Contents",
16468
+ depth: {
16469
+ from: 1,
16470
+ to: 2
16471
+ }
16472
+ }
16473
+ },
15394
16474
  {
15395
16475
  name: "block",
15396
16476
  props: {
15397
16477
  ref: "section-opener",
15398
16478
  slots: {
15399
- number: "01",
15400
- title: "{{Section title: the finding, as a statement}}",
15401
- tracker: "{{Tracker: one word}}"
16479
+ number: "1",
16480
+ title: "{{Section title: the conclusion, as a statement}}"
15402
16481
  }
15403
16482
  }
15404
16483
  },
@@ -15407,10 +16486,11 @@ var client_report_docx_blueprint_default = {
15407
16486
  props: {
15408
16487
  ref: "key-takeaways",
15409
16488
  slots: {
16489
+ label: "Summary",
15410
16490
  items: [
15411
- "{{Takeaway 1: one claim, one sentence, with its number}}",
15412
- "{{Takeaway 2: one claim, one sentence, with its number}}",
15413
- "{{Takeaway 3: the recommendation that follows}}"
16491
+ "{{Finding 1: one claim, one sentence, with its number}}",
16492
+ "{{Finding 2: one claim, one sentence, with its number}}",
16493
+ "{{Finding 3: the recommendation that follows}}"
15414
16494
  ]
15415
16495
  }
15416
16496
  }
@@ -15418,13 +16498,34 @@ var client_report_docx_blueprint_default = {
15418
16498
  {
15419
16499
  name: "paragraph",
15420
16500
  props: {
15421
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16501
+ text: "{{Body: what was examined, what was found and what is recommended, in one paragraph}}"
16502
+ }
16503
+ }
16504
+ ]
16505
+ },
16506
+ {
16507
+ name: "section",
16508
+ children: [
16509
+ {
16510
+ name: "block",
16511
+ props: {
16512
+ ref: "section-opener",
16513
+ slots: {
16514
+ number: "2",
16515
+ title: "{{Section title: context and constraints}}"
16516
+ }
15422
16517
  }
15423
16518
  },
15424
16519
  {
15425
16520
  name: "paragraph",
15426
16521
  props: {
15427
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16522
+ text: "{{Body: the system or situation as it is, with the numbers that bound it}}"
16523
+ }
16524
+ },
16525
+ {
16526
+ name: "paragraph",
16527
+ props: {
16528
+ text: "{{Body: the requirement or question this report answers}}"
15428
16529
  }
15429
16530
  }
15430
16531
  ]
@@ -15437,32 +16538,44 @@ var client_report_docx_blueprint_default = {
15437
16538
  props: {
15438
16539
  ref: "section-opener",
15439
16540
  slots: {
15440
- number: "02",
15441
- title: "{{Section title: the finding, as a statement}}",
15442
- tracker: "{{Tracker: one word}}"
16541
+ number: "3",
16542
+ title: "{{Section title: analysis, as the headline finding}}"
15443
16543
  }
15444
16544
  }
15445
16545
  },
15446
16546
  {
15447
16547
  name: "paragraph",
15448
16548
  props: {
15449
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16549
+ text: "{{Body: the argument, opening with its claim}}"
15450
16550
  }
15451
16551
  },
15452
16552
  {
15453
16553
  name: "block",
15454
16554
  props: {
15455
- ref: "callout",
16555
+ ref: "data-table",
15456
16556
  slots: {
15457
- label: "{{Note label}}",
15458
- text: "{{Note: a caveat about the numbers, a definition or the method}}"
16557
+ title: "{{Table title: what it compares, and the conditions}}",
16558
+ labelHeader: "{{Option or case}}",
16559
+ labels: ["{{Row 1}}", "{{Row 2}}", "{{Row 3}}"],
16560
+ columns: [
16561
+ {
16562
+ header: "{{Measure (unit)}}",
16563
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
16564
+ },
16565
+ {
16566
+ header: "{{Measure (unit)}}",
16567
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
16568
+ }
16569
+ ],
16570
+ notes: "{{Notes: definitions, conditions, exclusions the reader needs to read the figures}}",
16571
+ source: "{{Source: system, run or document, date}}"
15459
16572
  }
15460
16573
  }
15461
16574
  },
15462
16575
  {
15463
16576
  name: "paragraph",
15464
16577
  props: {
15465
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16578
+ text: "{{Body: what the table settles and what it leaves open}}"
15466
16579
  }
15467
16580
  }
15468
16581
  ]
@@ -15475,73 +16588,202 @@ var client_report_docx_blueprint_default = {
15475
16588
  props: {
15476
16589
  ref: "section-opener",
15477
16590
  slots: {
15478
- number: "03",
15479
- title: "{{Section title: the finding, as a statement}}",
15480
- tracker: "{{Tracker: one word}}"
16591
+ number: "4",
16592
+ title: "{{Section title: options and risks}}"
15481
16593
  }
15482
16594
  }
15483
16595
  },
15484
16596
  {
15485
16597
  name: "paragraph",
15486
16598
  props: {
15487
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16599
+ text: "{{Body: each option with its cost, its risk and what it forecloses}}"
15488
16600
  }
15489
16601
  },
15490
16602
  {
15491
16603
  name: "block",
15492
16604
  props: {
15493
- ref: "kpi-row",
16605
+ ref: "callout",
16606
+ slots: {
16607
+ label: "{{Note label: Risk, or Open question}}",
16608
+ text: "{{Note: what could invalidate the recommendation and how it will be checked}}"
16609
+ }
16610
+ }
16611
+ }
16612
+ ]
16613
+ },
16614
+ {
16615
+ name: "section",
16616
+ children: [
16617
+ {
16618
+ name: "block",
16619
+ props: {
16620
+ ref: "section-opener",
16621
+ slots: {
16622
+ number: "5",
16623
+ title: "{{Section title: recommendation and next steps}}"
16624
+ }
16625
+ }
16626
+ },
16627
+ {
16628
+ name: "paragraph",
16629
+ props: {
16630
+ text: "{{Body: the recommendation, its condition and the first three steps with owners and dates}}"
16631
+ }
16632
+ },
16633
+ {
16634
+ name: "block",
16635
+ props: {
16636
+ ref: "footnotes",
16637
+ slots: {
16638
+ title: "References"
16639
+ }
16640
+ }
16641
+ }
16642
+ ]
16643
+ }
16644
+ ]
16645
+ },
16646
+ memo: {
16647
+ description: "A memo in one flowing section: To, From, Date and Subject in place of a cover, the recommendation first, then the question, the options against the requirements in one table, and what would change the answer; references last. No contents list.",
16648
+ whenToUse: "One decision for one reader, argued in under three pages: a vendor or option choice, a go or no-go, a change of approach.",
16649
+ pages: {
16650
+ min: 1,
16651
+ max: 3
16652
+ },
16653
+ metadata: {
16654
+ title: "{{Title: the subject line}}",
16655
+ author: "{{Author or team}}",
16656
+ company: "{{Team or client name}}",
16657
+ date: "{{Month YYYY}}"
16658
+ },
16659
+ children: [
16660
+ {
16661
+ name: "section",
16662
+ children: [
16663
+ {
16664
+ name: "block",
16665
+ props: {
16666
+ ref: "memo-header",
16667
+ slots: {
16668
+ subject: "{{Subject: the recommendation in one line}}",
16669
+ to: "{{To: the person or group who decides}}",
16670
+ from: "{{From: author or team}}",
16671
+ date: "{{D Month YYYY}}"
16672
+ }
16673
+ }
16674
+ },
16675
+ {
16676
+ name: "block",
16677
+ props: {
16678
+ ref: "running-head",
15494
16679
  slots: {
16680
+ confidentiality: "{{Confidentiality: Internal, or Confidential}}",
16681
+ date: "{{Month YYYY}}"
16682
+ }
16683
+ }
16684
+ },
16685
+ {
16686
+ name: "block",
16687
+ props: {
16688
+ ref: "key-takeaways",
16689
+ slots: {
16690
+ label: "Recommendation",
15495
16691
  items: [
16692
+ "{{Recommendation: what to do, in one sentence}}",
16693
+ "{{Reason 1: the requirement it meets, with its number}}",
16694
+ "{{Reason 2: the cost or risk accepted, with its number}}"
16695
+ ]
16696
+ }
16697
+ }
16698
+ },
16699
+ {
16700
+ name: "block",
16701
+ props: {
16702
+ ref: "section-opener",
16703
+ slots: {
16704
+ number: "1",
16705
+ title: "{{Section title: the question and its constraints}}"
16706
+ }
16707
+ }
16708
+ },
16709
+ {
16710
+ name: "paragraph",
16711
+ props: {
16712
+ text: "{{Body: the requirements, each with its number, and what was considered}}"
16713
+ }
16714
+ },
16715
+ {
16716
+ name: "block",
16717
+ props: {
16718
+ ref: "section-opener",
16719
+ slots: {
16720
+ number: "2",
16721
+ title: "{{Section title: the options against the requirements}}"
16722
+ }
16723
+ }
16724
+ },
16725
+ {
16726
+ name: "block",
16727
+ props: {
16728
+ ref: "data-table",
16729
+ slots: {
16730
+ title: "{{Table title: options against the requirements}}",
16731
+ labelHeader: "{{Option}}",
16732
+ labels: ["{{Row 1}}", "{{Row 2}}", "{{Row 3}}"],
16733
+ columns: [
15496
16734
  {
15497
- value: "{{0.0}}",
15498
- label: "{{What it measures}}"
15499
- },
15500
- {
15501
- value: "{{0.0}}",
15502
- label: "{{What it measures}}"
16735
+ header: "{{Measure (unit)}}",
16736
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
15503
16737
  },
15504
16738
  {
15505
- value: "{{0.0}}",
15506
- label: "{{What it measures}}"
16739
+ header: "{{Measure (unit)}}",
16740
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
15507
16741
  }
15508
16742
  ],
15509
- source: "{{Source: system or document, date}}"
16743
+ notes: "{{Notes: definitions, conditions, exclusions the reader needs to read the figures}}",
16744
+ source: "{{Source: system, run or document, date}}"
15510
16745
  }
15511
16746
  }
15512
16747
  },
15513
16748
  {
15514
16749
  name: "paragraph",
15515
16750
  props: {
15516
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16751
+ text: "{{Body: why the recommended option wins and what the others lose on}}"
15517
16752
  }
15518
- }
15519
- ]
15520
- },
15521
- {
15522
- name: "section",
15523
- children: [
16753
+ },
16754
+ {
16755
+ name: "block",
16756
+ props: {
16757
+ ref: "callout",
16758
+ slots: {
16759
+ label: "{{Note label: Assumption}}",
16760
+ text: "{{Note: the assumption the recommendation rests on}}"
16761
+ }
16762
+ }
16763
+ },
15524
16764
  {
15525
16765
  name: "block",
15526
16766
  props: {
15527
16767
  ref: "section-opener",
15528
16768
  slots: {
15529
- number: "04",
15530
- title: "{{Section title: the finding, as a statement}}",
15531
- tracker: "{{Tracker: one word}}"
16769
+ number: "3",
16770
+ title: "{{Section title: what would change the answer}}"
15532
16771
  }
15533
16772
  }
15534
16773
  },
15535
16774
  {
15536
16775
  name: "paragraph",
15537
16776
  props: {
15538
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16777
+ text: "{{Body: the two or three facts that would reverse the recommendation, and who checks them}}"
15539
16778
  }
15540
16779
  },
15541
16780
  {
15542
16781
  name: "block",
15543
16782
  props: {
15544
- ref: "footnotes"
16783
+ ref: "footnotes",
16784
+ slots: {
16785
+ title: "References"
16786
+ }
15545
16787
  }
15546
16788
  }
15547
16789
  ]
@@ -15552,25 +16794,6 @@ var client_report_docx_blueprint_default = {
15552
16794
  };
15553
16795
 
15554
16796
  // src/blueprints/index.ts
15555
- function register(...candidates) {
15556
- const registry2 = {};
15557
- for (const candidate of candidates) {
15558
- const issues = validateBlueprint(candidate);
15559
- if (issues.length > 0)
15560
- throw new Error(
15561
- `Invalid bundled blueprint: ${issues.map((issue) => `${issue.path}: ${issue.message}`).join("; ")}`
15562
- );
15563
- const blueprint = candidate;
15564
- if (blueprint.format !== "docx")
15565
- throw new Error(`Blueprint ${blueprint.id} is not a DOCX blueprint.`);
15566
- if (registry2[blueprint.id])
15567
- throw new Error(
15568
- `Two bundled blueprints share the id "${blueprint.id}"; the later one would silently replace the earlier.`
15569
- );
15570
- registry2[blueprint.id] = blueprint;
15571
- }
15572
- return registry2;
15573
- }
15574
16797
  function scanned(known) {
15575
16798
  let here;
15576
16799
  try {
@@ -15588,119 +16811,23 @@ function scanned(known) {
15588
16811
  return !(typeof id === "string" && id in known);
15589
16812
  });
15590
16813
  }
15591
- var bundled = register(client_report_docx_blueprint_default);
16814
+ var bundled = registerBlueprints("docx", [client_report_docx_blueprint_default, technical_report_docx_blueprint_default]);
15592
16815
  var DOCX_BLUEPRINTS = {
15593
16816
  ...bundled,
15594
- ...register(...scanned(bundled))
16817
+ ...registerBlueprints("docx", scanned(bundled))
15595
16818
  };
15596
16819
  function docxBlueprint(id) {
15597
16820
  return DOCX_BLUEPRINTS[id];
15598
16821
  }
15599
- var MARKER = /^\{\{\s*([\s\S]*?)\s*\}\}$/;
15600
16822
  function instantiateDocxBlueprint(blueprint, options) {
15601
- if (blueprint.format !== "docx")
15602
- throw new Error(
15603
- `Blueprint ${blueprint.id} is a ${blueprint.format} blueprint; this instantiates DOCX ones.`
15604
- );
15605
- const variantId = options.variant ?? Object.keys(blueprint.variants)[0];
15606
- const variant = blueprint.variants[variantId];
15607
- if (!variant)
15608
- throw new Error(
15609
- `Blueprint ${blueprint.id} has no variant "${variantId}"; it has ${Object.keys(
15610
- blueprint.variants
15611
- ).join(", ")}.`
15612
- );
15613
- const children = structuredClone(variant.children);
15614
- const blocks = definitionsFor(children, options.definitions, blueprint);
15615
- const document = {
15616
- name: "docx",
15617
- props: {
15618
- theme: options.theme ?? blueprint.theme,
15619
- qualityProfile: blueprint.profile,
15620
- ...Object.keys(blocks).length > 0 && { blocks },
15621
- metadata: { ...variant.metadata, ...options.metadata }
15622
- },
15623
- children
15624
- };
15625
- return { document, fillMap: fillMap(document, blocks), variant: variantId };
15626
- }
15627
- function definitionsFor(children, available, blueprint) {
15628
- const refs = /* @__PURE__ */ new Set();
15629
- const visit = (node) => {
15630
- if (Array.isArray(node)) return node.forEach(visit);
15631
- if (!node || typeof node !== "object") return;
15632
- const record = node;
15633
- const props = record.props;
15634
- if (record.name === "block" && typeof props?.ref === "string")
15635
- refs.add(props.ref);
15636
- Object.values(record).forEach(visit);
15637
- };
15638
- visit(children);
15639
- const result = {};
15640
- for (const ref of refs) {
15641
- if (!available[ref])
15642
- throw new Error(
15643
- `Blueprint ${blueprint.id} invokes "${ref}", which ${blueprint.definitions} does not define.`
15644
- );
15645
- for (const name of [...blockDependencies(available, ref), ref])
15646
- result[name] ??= structuredClone(available[name]);
15647
- }
15648
- return result;
15649
- }
15650
- function fillMap(document, blocks) {
15651
- return collectPlaceholders2(document).filter((occurrence) => occurrence.match.kind === "scaffold-marker").map((occurrence) => {
15652
- const guidance = occurrence.text.match(MARKER)?.[1] ?? occurrence.text;
15653
- const base = { path: occurrence.path, marker: occurrence.text, guidance };
15654
- if (occurrence.path.startsWith("/props/metadata/"))
15655
- return { ...base, kind: "metadata" };
15656
- const slot = slotAt(document, occurrence.path, blocks);
15657
- return slot ? { ...base, kind: "slot", ...slot } : { ...base, kind: "text" };
16823
+ return instantiateBlueprint(blueprint, options, {
16824
+ format: "docx",
16825
+ metadataPointer: "/props/metadata",
16826
+ markers: (document) => collectPlaceholders2(document).filter(
16827
+ (occurrence) => occurrence.match.kind === "scaffold-marker"
16828
+ )
15658
16829
  });
15659
16830
  }
15660
- function slotAt(document, pointer, blocks) {
15661
- const at = pointer.lastIndexOf("/props/slots/");
15662
- if (at < 0) return void 0;
15663
- const invocation = valueAt(document, pointer.slice(0, at));
15664
- const ref = invocation?.props?.ref;
15665
- if (typeof ref !== "string" || !blocks[ref]) return void 0;
15666
- const segments = pointer.slice(at + "/props/slots/".length).split("/").map(unescape);
15667
- let slot = blocks[ref].slots[segments[0]];
15668
- const names = [segments[0]];
15669
- for (const segment of segments.slice(1)) {
15670
- if (!slot) break;
15671
- if (slot.type === "array" && /^\d+$/.test(segment)) slot = slot.items;
15672
- else if (slot.type === "object") {
15673
- slot = slot.properties?.[segment];
15674
- names.push(segment);
15675
- } else if (slot.type === "component")
15676
- break;
15677
- else slot = void 0;
15678
- }
15679
- if (!slot) return void 0;
15680
- return {
15681
- block: ref,
15682
- slot: names.join("."),
15683
- type: slot.type,
15684
- ...slot.maxWords !== void 0 && { maxWords: slot.maxWords },
15685
- ...slot.maxLength !== void 0 && { maxLength: slot.maxLength },
15686
- ...slot.oneLine !== void 0 && { oneLine: slot.oneLine },
15687
- ...slot.required !== void 0 && { required: slot.required }
15688
- };
15689
- }
15690
- function unescape(segment) {
15691
- return segment.replace(/~1/g, "/").replace(/~0/g, "~");
15692
- }
15693
- function valueAt(root, pointer) {
15694
- if (pointer === "") return root;
15695
- let current = root;
15696
- for (const segment of pointer.split("/").slice(1).map(unescape)) {
15697
- if (Array.isArray(current)) current = current[Number(segment)];
15698
- else if (current && typeof current === "object")
15699
- current = current[segment];
15700
- else return void 0;
15701
- }
15702
- return current;
15703
- }
15704
16831
 
15705
16832
  // src/index.ts
15706
16833
  init_json();