@json-to-office/core-docx 4.5.0 → 5.4.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"
@@ -5040,7 +5508,10 @@ import {
5040
5508
  import {
5041
5509
  clampVisualDpi,
5042
5510
  DEFAULT_VISUAL_DPI,
5043
- MAX_RASTERIZE_BATCH_SLIDES
5511
+ MAX_RASTERIZE_BATCH_SLIDES,
5512
+ createLimiter,
5513
+ resolveServiceUrl as resolveServiceUrl2,
5514
+ postJsonToService as postJsonToService2
5044
5515
  } from "@json-to-office/shared";
5045
5516
  import {
5046
5517
  isNativeVisualProps
@@ -5061,54 +5532,8 @@ function hasNodeBuiltins() {
5061
5532
  }
5062
5533
  }
5063
5534
 
5064
- // src/utils/serviceClient.ts
5065
- var DEFAULT_TIMEOUT_MS = 3e4;
5066
- function resolveServiceUrl(propsUrl, servicesUrl, defaultUrl) {
5067
- const raw = (propsUrl || servicesUrl || defaultUrl).trim();
5068
- const withScheme = /^https?:\/\//i.test(raw) ? raw : `http://${raw}`;
5069
- return withScheme.replace(/\/+$/, "");
5070
- }
5071
- var SERVICE_UNAVAILABLE_CODE = "SERVICE_UNAVAILABLE";
5072
- function serviceUnavailable(message) {
5073
- return Object.assign(new Error(message), { code: SERVICE_UNAVAILABLE_CODE });
5074
- }
5075
- async function postJsonToService(opts) {
5076
- const resolvedHeaders = typeof opts.headers === "function" ? await opts.headers(opts.body) : opts.headers;
5077
- const headers = {
5078
- "Content-Type": "application/json",
5079
- ...resolvedHeaders
5080
- };
5081
- const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
5082
- const controller = new AbortController();
5083
- const timer = setTimeout(() => controller.abort(), timeoutMs);
5084
- let response;
5085
- try {
5086
- response = await fetch(`${opts.url}${opts.path}`, {
5087
- method: "POST",
5088
- headers,
5089
- body: JSON.stringify(opts.body),
5090
- signal: controller.signal
5091
- });
5092
- } catch (error) {
5093
- if (error?.name === "AbortError") {
5094
- throw serviceUnavailable(
5095
- `${opts.serviceLabel} timed out after ${timeoutMs}ms at ${opts.url}.`
5096
- );
5097
- }
5098
- const cause = error instanceof Error ? error.message : String(error);
5099
- throw serviceUnavailable(opts.onUnreachable(opts.url, cause));
5100
- } finally {
5101
- clearTimeout(timer);
5102
- }
5103
- if (!response.ok) {
5104
- throw new Error(
5105
- `${opts.serviceLabel} returned ${response.status}: ${response.statusText}`
5106
- );
5107
- }
5108
- return response;
5109
- }
5110
-
5111
5535
  // src/components/visual.ts
5536
+ import { resolveServiceUrl, postJsonToService } from "@json-to-office/shared";
5112
5537
  var DEFAULT_RASTERIZE_SERVER_URL = "http://localhost:7802";
5113
5538
  var PIXELS_PER_INCH = 96;
5114
5539
  function buildVisualPresentation(props) {
@@ -5210,26 +5635,6 @@ Cause: ${cause}`
5210
5635
  return result;
5211
5636
  }
5212
5637
 
5213
- // src/utils/promiseLimiter.ts
5214
- function createLimiter(max) {
5215
- let active = 0;
5216
- const queue = [];
5217
- const release = () => {
5218
- active--;
5219
- queue.shift()?.();
5220
- };
5221
- return async function limit(fn) {
5222
- while (active >= max)
5223
- await new Promise((resolve4) => queue.push(resolve4));
5224
- active++;
5225
- try {
5226
- return await fn();
5227
- } finally {
5228
- release();
5229
- }
5230
- };
5231
- }
5232
-
5233
5638
  // src/core/prerasterizeVisuals.ts
5234
5639
  var DEFAULT_FALLBACK_CONCURRENCY = 4;
5235
5640
  var BATCH_TIMEOUT_BASE_MS = 3e4;
@@ -5406,7 +5811,7 @@ async function prerasterizeVisuals(root, serviceConfig, options = {}) {
5406
5811
  await rasterizeIndividually(unique);
5407
5812
  return map;
5408
5813
  }
5409
- const serverUrl = resolveServiceUrl(
5814
+ const serverUrl = resolveServiceUrl2(
5410
5815
  void 0,
5411
5816
  serviceConfig?.serverUrl,
5412
5817
  DEFAULT_RASTERIZE_SERVER_URL
@@ -5414,7 +5819,7 @@ async function prerasterizeVisuals(root, serviceConfig, options = {}) {
5414
5819
  const postBatch = async (chunk, fonts) => {
5415
5820
  let response;
5416
5821
  try {
5417
- response = await postJsonToService({
5822
+ response = await postJsonToService2({
5418
5823
  url: serverUrl,
5419
5824
  path: "/rasterize/batch",
5420
5825
  body: {
@@ -5540,7 +5945,8 @@ function containsComponent(root, name) {
5540
5945
  // src/core/desugarExternals.ts
5541
5946
  import {
5542
5947
  clampVisualDpi as clampVisualDpi2,
5543
- DEFAULT_VISUAL_DPI as DEFAULT_VISUAL_DPI2
5948
+ DEFAULT_VISUAL_DPI as DEFAULT_VISUAL_DPI2,
5949
+ limitChartRequest
5544
5950
  } from "@json-to-office/shared";
5545
5951
  import {
5546
5952
  isNativeVisualProps as isNativeVisualProps2
@@ -5556,30 +5962,42 @@ import {
5556
5962
  chartPointsPerPixel,
5557
5963
  POINTS_PER_PIXEL_96DPI,
5558
5964
  withChartFontFaceCss,
5559
- withChartTypography
5965
+ withChartTypography,
5966
+ resolveServiceUrl as resolveServiceUrl3,
5967
+ postJsonToService as postJsonToService3,
5968
+ chartRequestKey,
5969
+ dedupeChartRequest,
5970
+ recordChartRetry
5560
5971
  } from "@json-to-office/shared";
5561
5972
  var DEFAULT_EXPORT_SERVER_URL = "http://localhost:7801";
5973
+ function effectiveChartServerUrl(props, servicesConfig) {
5974
+ return resolveServiceUrl3(
5975
+ props.serverUrl,
5976
+ servicesConfig?.serverUrl,
5977
+ DEFAULT_EXPORT_SERVER_URL
5978
+ );
5979
+ }
5562
5980
  function assertExportServerAllowed(serverUrl, servicesConfig, warnings) {
5563
5981
  const notice = remoteExportNotice(serverUrl, servicesConfig?.allowRemote);
5564
- if (notice)
5565
- warnings?.push({
5566
- component: "highcharts",
5567
- severity: "warning",
5568
- message: notice,
5569
- context: { code: REMOTE_EXPORT_WARNING, serverUrl }
5570
- });
5982
+ if (!notice || !warnings) return;
5983
+ const alreadySaid = warnings.some(
5984
+ (warning) => warning.context?.code === REMOTE_EXPORT_WARNING && warning.context?.serverUrl === serverUrl
5985
+ );
5986
+ if (alreadySaid) return;
5987
+ warnings.push({
5988
+ component: "highcharts",
5989
+ severity: "warning",
5990
+ message: notice,
5991
+ context: { code: REMOTE_EXPORT_WARNING, serverUrl }
5992
+ });
5571
5993
  }
5572
- async function generateChart(config, servicesConfig, warnings) {
5994
+ async function generateChart(config, servicesConfig, warnings, cache) {
5573
5995
  if (!isNodeEnvironment()) {
5574
5996
  throw new Error(
5575
5997
  "Highcharts export server requires a Node.js environment. Chart generation is not available in browser environments."
5576
5998
  );
5577
5999
  }
5578
- const serverUrl = resolveServiceUrl(
5579
- config.serverUrl,
5580
- servicesConfig?.serverUrl,
5581
- DEFAULT_EXPORT_SERVER_URL
5582
- );
6000
+ const serverUrl = effectiveChartServerUrl(config, servicesConfig);
5583
6001
  assertExportServerAllowed(serverUrl, servicesConfig, warnings);
5584
6002
  const requestBody = {
5585
6003
  infile: config.options,
@@ -5590,11 +6008,21 @@ async function generateChart(config, servicesConfig, warnings) {
5590
6008
  // byte-identical to before for callers that omit it.
5591
6009
  ...config.resources ? { resources: config.resources } : {}
5592
6010
  };
5593
- const response = await postJsonToService({
6011
+ return dedupeChartRequest(
6012
+ cache,
6013
+ chartRequestKey(serverUrl, requestBody),
6014
+ () => postChart(serverUrl, requestBody, config, servicesConfig)
6015
+ );
6016
+ }
6017
+ async function postChart(serverUrl, requestBody, config, servicesConfig) {
6018
+ const response = await postJsonToService3({
5594
6019
  url: serverUrl,
5595
6020
  path: "/export",
5596
6021
  body: requestBody,
5597
6022
  headers: servicesConfig?.headers,
6023
+ timeoutMs: servicesConfig?.timeoutMs,
6024
+ retries: servicesConfig?.retries,
6025
+ onRetry: recordChartRetry,
5598
6026
  serviceLabel: "Highcharts export server",
5599
6027
  onUnreachable: (url, cause) => `Highcharts Export Server is not running at ${url}. Start it with: npx highcharts-export-server --enableServer true
5600
6028
  Cause: ${cause}`
@@ -5693,13 +6121,13 @@ function withChartFontFaces(config, theme, faces) {
5693
6121
  theme.fonts.heading.family
5694
6122
  ]);
5695
6123
  }
5696
- async function renderChartToImageProps(props, theme, servicesConfig, chartFonts, warnings) {
6124
+ async function renderChartToImageProps(props, theme, servicesConfig, chartFonts, warnings, cache) {
5697
6125
  const config = withChartFontFaces(
5698
6126
  withThemeTypography(withThemeColors(props, theme), theme),
5699
6127
  theme,
5700
6128
  chartFonts
5701
6129
  );
5702
- const chart = await generateChart(config, servicesConfig, warnings);
6130
+ const chart = await generateChart(config, servicesConfig, warnings, cache);
5703
6131
  const hasConfigDimensions = config.width !== void 0 || config.height !== void 0;
5704
6132
  return {
5705
6133
  base64: chart.base64DataUri,
@@ -5719,6 +6147,7 @@ async function desugarExternals(document, options) {
5719
6147
  ...options.visualFonts ? { fonts: options.visualFonts } : {}
5720
6148
  }
5721
6149
  ).catch(() => /* @__PURE__ */ new Map());
6150
+ const chartCache = /* @__PURE__ */ new Map();
5722
6151
  return transformComponents(document, async (node) => {
5723
6152
  if (node.enabled === false) return void 0;
5724
6153
  if (node.name === "visual") {
@@ -5733,14 +6162,21 @@ async function desugarExternals(document, options) {
5733
6162
  });
5734
6163
  }
5735
6164
  if (node.name === "highcharts") {
6165
+ const props = node.props;
6166
+ const chartConfig = options.services?.highcharts;
5736
6167
  return withNodeIdentity(node, {
5737
6168
  name: "image",
5738
- props: await renderChartToImageProps(
5739
- node.props,
5740
- options.theme,
5741
- options.services?.highcharts,
5742
- options.chartFonts,
5743
- options.warnings
6169
+ props: await limitChartRequest(
6170
+ effectiveChartServerUrl(props, chartConfig),
6171
+ chartConfig?.concurrency,
6172
+ () => renderChartToImageProps(
6173
+ props,
6174
+ options.theme,
6175
+ chartConfig,
6176
+ options.chartFonts,
6177
+ options.warnings,
6178
+ chartCache
6179
+ )
5744
6180
  )
5745
6181
  });
5746
6182
  }
@@ -13839,7 +14275,8 @@ var DocumentGenerator = {
13839
14275
  // src/core/flattenVisuals.ts
13840
14276
  import {
13841
14277
  clampVisualDpi as clampVisualDpi3,
13842
- DEFAULT_VISUAL_DPI as DEFAULT_VISUAL_DPI3
14278
+ DEFAULT_VISUAL_DPI as DEFAULT_VISUAL_DPI3,
14279
+ createLimiter as createLimiter2
13843
14280
  } from "@json-to-office/shared";
13844
14281
  import {
13845
14282
  isNativeVisualProps as isNativeVisualProps5
@@ -13881,7 +14318,7 @@ async function flattenVisuals(doc, options) {
13881
14318
  dpi: options.dpi,
13882
14319
  baseDir: options.baseDir,
13883
14320
  fonts: options.fonts,
13884
- limit: createLimiter(
14321
+ limit: createLimiter2(
13885
14322
  Math.max(1, options.concurrency ?? DEFAULT_CONCURRENCY)
13886
14323
  )
13887
14324
  };
@@ -13913,6 +14350,12 @@ async function rasterizeVisual(obj, ctx) {
13913
14350
  });
13914
14351
  }
13915
14352
 
14353
+ // src/index.ts
14354
+ import {
14355
+ getChartRequestStats,
14356
+ resetChartRequestStats
14357
+ } from "@json-to-office/shared";
14358
+
13916
14359
  // src/quality/preflight.ts
13917
14360
  import {
13918
14361
  assertValidQualityPolicy,
@@ -14930,7 +15373,34 @@ var DOCX_QUALITY_PROFILES = {
14930
15373
  "technical-report": {
14931
15374
  id: "technical-report",
14932
15375
  formats: ["docx"],
14933
- description: "Portable professional report defaults."
15376
+ 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.",
15377
+ rules: {
15378
+ // A figure or table in a technical report cites where its numbers come
15379
+ // from; the takeaway is the client report's ask, the caption is the
15380
+ // block's own.
15381
+ "docx/required-chrome": { parameters: { required: ["source"] } },
15382
+ "docx/running-head": {
15383
+ parameters: {
15384
+ required: ["header", "footer", "pageNumber"],
15385
+ fromSection: 1
15386
+ }
15387
+ },
15388
+ "docx/heading-hierarchy": { severity: "warning" },
15389
+ "docx/type-scale": { enabled: true },
15390
+ // One more than the client report: the contents list paints TOC2 and
15391
+ // the sub-headings paint heading 2.
15392
+ "docx/size-count": { enabled: true, parameters: { maximumSizes: 9 } },
15393
+ "docx/role-drift": { enabled: true },
15394
+ "rendered/empty-page": { severity: "warning" },
15395
+ "rendered/page-underfilled": { severity: "warning" },
15396
+ // A technical report argues from measurements: a runs table, a chart.
15397
+ "docx/exhibit-required": { enabled: true }
15398
+ }
15399
+ },
15400
+ general: {
15401
+ id: "general",
15402
+ formats: ["docx"],
15403
+ description: "Any document that names no archetype: integrity and information-design rules at their defaults, nothing required by structure."
14934
15404
  },
14935
15405
  "legal-appendix": {
14936
15406
  id: "legal-appendix",
@@ -14938,7 +15408,7 @@ var DOCX_QUALITY_PROFILES = {
14938
15408
  description: "Dense appendix: preserve integrity without editorial taste."
14939
15409
  }
14940
15410
  };
14941
- var DOCX_DEFAULT_QUALITY_PROFILE = DOCX_QUALITY_PROFILES["technical-report"];
15411
+ var DOCX_DEFAULT_QUALITY_PROFILE = DOCX_QUALITY_PROFILES["general"];
14942
15412
  var DOCX_PROFILES_BY_ID = DOCX_QUALITY_PROFILES;
14943
15413
  function declaredDocxQualityProfile(document) {
14944
15414
  const props = document?.props;
@@ -15105,8 +15575,9 @@ init_styles();
15105
15575
 
15106
15576
  // src/blueprints/index.ts
15107
15577
  import {
15108
- blockDependencies,
15109
- validateBlueprint
15578
+ instantiateBlueprint,
15579
+ registerBlueprints,
15580
+ valueAt
15110
15581
  } from "@json-to-office/shared";
15111
15582
  import { collectPlaceholders as collectPlaceholders2 } from "@json-to-office/quality";
15112
15583
  import { existsSync, readdirSync, readFileSync as readFileSync2 } from "fs";
@@ -15220,7 +15691,789 @@ var client_report_docx_blueprint_default = {
15220
15691
  {
15221
15692
  name: "paragraph",
15222
15693
  props: {
15223
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15694
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15695
+ }
15696
+ }
15697
+ ]
15698
+ },
15699
+ {
15700
+ name: "section",
15701
+ children: [
15702
+ {
15703
+ name: "block",
15704
+ props: {
15705
+ ref: "section-opener",
15706
+ slots: {
15707
+ number: "02",
15708
+ title: "{{Section title: the finding, as a statement}}"
15709
+ }
15710
+ }
15711
+ },
15712
+ {
15713
+ name: "paragraph",
15714
+ props: {
15715
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15716
+ }
15717
+ },
15718
+ {
15719
+ name: "block",
15720
+ props: {
15721
+ ref: "chart-figure",
15722
+ slots: {
15723
+ chart: {
15724
+ name: "highcharts",
15725
+ props: {
15726
+ width: "100%",
15727
+ options: {
15728
+ chart: {
15729
+ type: "column",
15730
+ width: 900,
15731
+ height: 460
15732
+ },
15733
+ title: {
15734
+ text: null
15735
+ },
15736
+ xAxis: {
15737
+ categories: [
15738
+ "{{Period 1}}",
15739
+ "{{Period 2}}",
15740
+ "{{Period 3}}"
15741
+ ]
15742
+ },
15743
+ yAxis: {
15744
+ title: {
15745
+ text: "{{Measure (unit)}}"
15746
+ }
15747
+ },
15748
+ series: [
15749
+ {
15750
+ name: "{{Series name}}",
15751
+ data: [0, 0, 0]
15752
+ }
15753
+ ]
15754
+ }
15755
+ }
15756
+ },
15757
+ caption: "{{Caption: what the chart shows, as a statement}}",
15758
+ takeaway: "{{Takeaway: the one sentence the reader should keep}}",
15759
+ source: "{{Source: system or document, date}}"
15760
+ }
15761
+ }
15762
+ },
15763
+ {
15764
+ name: "paragraph",
15765
+ props: {
15766
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15767
+ }
15768
+ }
15769
+ ]
15770
+ },
15771
+ {
15772
+ name: "section",
15773
+ children: [
15774
+ {
15775
+ name: "block",
15776
+ props: {
15777
+ ref: "section-opener",
15778
+ slots: {
15779
+ number: "03",
15780
+ title: "{{Section title: the finding, as a statement}}"
15781
+ }
15782
+ }
15783
+ },
15784
+ {
15785
+ name: "paragraph",
15786
+ props: {
15787
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15788
+ }
15789
+ },
15790
+ {
15791
+ name: "block",
15792
+ props: {
15793
+ ref: "data-table",
15794
+ slots: {
15795
+ title: "{{Table title: what it compares, and the period}}",
15796
+ labelHeader: "{{Row label}}",
15797
+ labels: ["{{Row 1}}", "{{Row 2}}", "{{Row 3}}"],
15798
+ columns: [
15799
+ {
15800
+ header: "{{Measure (unit)}}",
15801
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
15802
+ },
15803
+ {
15804
+ header: "{{Change}}",
15805
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
15806
+ }
15807
+ ],
15808
+ source: "{{Source: system or document, date}}"
15809
+ }
15810
+ }
15811
+ },
15812
+ {
15813
+ name: "block",
15814
+ props: {
15815
+ ref: "callout",
15816
+ slots: {
15817
+ label: "{{Note label}}",
15818
+ text: "{{Note: a caveat about the numbers, a definition or the method}}"
15819
+ }
15820
+ }
15821
+ }
15822
+ ]
15823
+ },
15824
+ {
15825
+ name: "section",
15826
+ children: [
15827
+ {
15828
+ name: "block",
15829
+ props: {
15830
+ ref: "section-opener",
15831
+ slots: {
15832
+ number: "04",
15833
+ title: "{{Section title: the finding, as a statement}}"
15834
+ }
15835
+ }
15836
+ },
15837
+ {
15838
+ name: "paragraph",
15839
+ props: {
15840
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15841
+ }
15842
+ },
15843
+ {
15844
+ name: "block",
15845
+ props: {
15846
+ ref: "footnotes"
15847
+ }
15848
+ }
15849
+ ]
15850
+ }
15851
+ ]
15852
+ },
15853
+ narrative: {
15854
+ 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.",
15855
+ whenToUse: "The brief is a position, an assessment or a recommendation with few numbers; the reader follows an argument.",
15856
+ pages: {
15857
+ min: 3,
15858
+ max: 6
15859
+ },
15860
+ metadata: {
15861
+ title: "{{Title: as on the cover}}",
15862
+ author: "{{Author or team}}",
15863
+ company: "{{Client name}}",
15864
+ date: "{{Month YYYY}}"
15865
+ },
15866
+ children: [
15867
+ {
15868
+ name: "section",
15869
+ children: [
15870
+ {
15871
+ name: "block",
15872
+ props: {
15873
+ ref: "cover",
15874
+ slots: {
15875
+ title: "{{Title: the report's conclusion in one sentence}}",
15876
+ subtitle: "{{Subtitle: what the report answers, for whom}}",
15877
+ client: "{{Client name}}",
15878
+ date: "{{Month YYYY}}",
15879
+ confidentiality: "{{Confidentiality: Confidential, or For internal use}}"
15880
+ }
15881
+ }
15882
+ }
15883
+ ]
15884
+ },
15885
+ {
15886
+ name: "section",
15887
+ children: [
15888
+ {
15889
+ name: "block",
15890
+ props: {
15891
+ ref: "running-head",
15892
+ slots: {
15893
+ confidentiality: "{{Confidentiality: as on the cover}}",
15894
+ date: "{{Month YYYY}}"
15895
+ }
15896
+ }
15897
+ },
15898
+ {
15899
+ name: "block",
15900
+ props: {
15901
+ ref: "section-opener",
15902
+ slots: {
15903
+ number: "01",
15904
+ title: "{{Section title: the finding, as a statement}}"
15905
+ }
15906
+ }
15907
+ },
15908
+ {
15909
+ name: "block",
15910
+ props: {
15911
+ ref: "key-takeaways",
15912
+ slots: {
15913
+ items: [
15914
+ "{{Takeaway 1: one claim, one sentence, with its number}}",
15915
+ "{{Takeaway 2: one claim, one sentence, with its number}}",
15916
+ "{{Takeaway 3: the recommendation that follows}}"
15917
+ ]
15918
+ }
15919
+ }
15920
+ },
15921
+ {
15922
+ name: "paragraph",
15923
+ props: {
15924
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15925
+ }
15926
+ },
15927
+ {
15928
+ name: "paragraph",
15929
+ props: {
15930
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15931
+ }
15932
+ }
15933
+ ]
15934
+ },
15935
+ {
15936
+ name: "section",
15937
+ children: [
15938
+ {
15939
+ name: "block",
15940
+ props: {
15941
+ ref: "section-opener",
15942
+ slots: {
15943
+ number: "02",
15944
+ title: "{{Section title: the finding, as a statement}}"
15945
+ }
15946
+ }
15947
+ },
15948
+ {
15949
+ name: "paragraph",
15950
+ props: {
15951
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15952
+ }
15953
+ },
15954
+ {
15955
+ name: "block",
15956
+ props: {
15957
+ ref: "callout",
15958
+ slots: {
15959
+ label: "{{Note label}}",
15960
+ text: "{{Note: a caveat about the numbers, a definition or the method}}"
15961
+ }
15962
+ }
15963
+ },
15964
+ {
15965
+ name: "paragraph",
15966
+ props: {
15967
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15968
+ }
15969
+ }
15970
+ ]
15971
+ },
15972
+ {
15973
+ name: "section",
15974
+ children: [
15975
+ {
15976
+ name: "block",
15977
+ props: {
15978
+ ref: "section-opener",
15979
+ slots: {
15980
+ number: "03",
15981
+ title: "{{Section title: the finding, as a statement}}"
15982
+ }
15983
+ }
15984
+ },
15985
+ {
15986
+ name: "paragraph",
15987
+ props: {
15988
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15989
+ }
15990
+ },
15991
+ {
15992
+ name: "block",
15993
+ props: {
15994
+ ref: "data-table",
15995
+ slots: {
15996
+ title: "{{Table title: what it compares, and the period}}",
15997
+ labelHeader: "{{Row label}}",
15998
+ labels: ["{{Row 1}}", "{{Row 2}}", "{{Row 3}}"],
15999
+ columns: [
16000
+ {
16001
+ header: "{{Measure (unit)}}",
16002
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
16003
+ },
16004
+ {
16005
+ header: "{{Change}}",
16006
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
16007
+ }
16008
+ ],
16009
+ source: "{{Source: system or document, date}}"
16010
+ }
16011
+ }
16012
+ },
16013
+ {
16014
+ name: "block",
16015
+ props: {
16016
+ ref: "kpi-row",
16017
+ slots: {
16018
+ items: [
16019
+ {
16020
+ value: "{{0.0}}",
16021
+ label: "{{What it measures}}"
16022
+ },
16023
+ {
16024
+ value: "{{0.0}}",
16025
+ label: "{{What it measures}}"
16026
+ },
16027
+ {
16028
+ value: "{{0.0}}",
16029
+ label: "{{What it measures}}"
16030
+ }
16031
+ ],
16032
+ source: "{{Source: system or document, date}}"
16033
+ }
16034
+ }
16035
+ },
16036
+ {
16037
+ name: "paragraph",
16038
+ props: {
16039
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16040
+ }
16041
+ }
16042
+ ]
16043
+ },
16044
+ {
16045
+ name: "section",
16046
+ children: [
16047
+ {
16048
+ name: "block",
16049
+ props: {
16050
+ ref: "section-opener",
16051
+ slots: {
16052
+ number: "04",
16053
+ title: "{{Section title: the finding, as a statement}}"
16054
+ }
16055
+ }
16056
+ },
16057
+ {
16058
+ name: "paragraph",
16059
+ props: {
16060
+ text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16061
+ }
16062
+ },
16063
+ {
16064
+ name: "block",
16065
+ props: {
16066
+ ref: "footnotes"
16067
+ }
16068
+ }
16069
+ ]
16070
+ }
16071
+ ]
16072
+ }
16073
+ }
16074
+ };
16075
+
16076
+ // src/templates/blueprints/technical-report.docx.blueprint.json
16077
+ var technical_report_docx_blueprint_default = {
16078
+ id: "technical-report",
16079
+ format: "docx",
16080
+ title: "Technical report",
16081
+ 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.",
16082
+ 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.",
16083
+ theme: "consulting",
16084
+ profile: "technical-report",
16085
+ definitions: "technical-report-blocks.docx.json",
16086
+ numbering: "sections",
16087
+ toc: true,
16088
+ variants: {
16089
+ "data-heavy": {
16090
+ 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.",
16091
+ whenToUse: "The brief comes with measurements: runs, findings, incidents, timings, anything the reader will check against a figure.",
16092
+ pages: {
16093
+ min: 4,
16094
+ max: 10
16095
+ },
16096
+ metadata: {
16097
+ title: "{{Title: as on the cover}}",
16098
+ author: "{{Author or team}}",
16099
+ company: "{{Team or client name}}",
16100
+ date: "{{Month YYYY}}"
16101
+ },
16102
+ children: [
16103
+ {
16104
+ name: "section",
16105
+ children: [
16106
+ {
16107
+ name: "block",
16108
+ props: {
16109
+ ref: "cover",
16110
+ slots: {
16111
+ title: "{{Title: the report's conclusion in one sentence}}",
16112
+ subtitle: "{{Subtitle: what was examined, for whom}}",
16113
+ client: "{{Team or client name}}",
16114
+ date: "{{Month YYYY}}",
16115
+ confidentiality: "{{Confidentiality: Internal, or Confidential}}"
16116
+ }
16117
+ }
16118
+ }
16119
+ ]
16120
+ },
16121
+ {
16122
+ name: "section",
16123
+ children: [
16124
+ {
16125
+ name: "block",
16126
+ props: {
16127
+ ref: "running-head",
16128
+ slots: {
16129
+ confidentiality: "{{Confidentiality: as on the cover}}",
16130
+ date: "{{Month YYYY}}"
16131
+ }
16132
+ }
16133
+ },
16134
+ {
16135
+ name: "toc",
16136
+ props: {
16137
+ scope: "document",
16138
+ title: "Contents",
16139
+ depth: {
16140
+ from: 1,
16141
+ to: 2
16142
+ }
16143
+ }
16144
+ },
16145
+ {
16146
+ name: "block",
16147
+ props: {
16148
+ ref: "section-opener",
16149
+ slots: {
16150
+ number: "1",
16151
+ title: "{{Section title: the conclusion, as a statement}}"
16152
+ }
16153
+ }
16154
+ },
16155
+ {
16156
+ name: "block",
16157
+ props: {
16158
+ ref: "key-takeaways",
16159
+ slots: {
16160
+ label: "Summary",
16161
+ items: [
16162
+ "{{Finding 1: one claim, one sentence, with its number}}",
16163
+ "{{Finding 2: one claim, one sentence, with its number}}",
16164
+ "{{Finding 3: the recommendation that follows}}"
16165
+ ]
16166
+ }
16167
+ }
16168
+ },
16169
+ {
16170
+ name: "paragraph",
16171
+ props: {
16172
+ text: "{{Body: what was examined, what was found and what is recommended, in one paragraph}}"
16173
+ }
16174
+ }
16175
+ ]
16176
+ },
16177
+ {
16178
+ name: "section",
16179
+ children: [
16180
+ {
16181
+ name: "block",
16182
+ props: {
16183
+ ref: "section-opener",
16184
+ slots: {
16185
+ number: "2",
16186
+ title: "{{Section title: scope and method}}"
16187
+ }
16188
+ }
16189
+ },
16190
+ {
16191
+ name: "paragraph",
16192
+ props: {
16193
+ text: "{{Body: what was measured, under which conditions, with which instruments, and what was left out}}"
16194
+ }
16195
+ },
16196
+ {
16197
+ name: "block",
16198
+ props: {
16199
+ ref: "callout",
16200
+ slots: {
16201
+ label: "{{Note label: Assumptions, or Limitations}}",
16202
+ text: "{{Note: the assumption or limit the results rest on}}"
16203
+ }
16204
+ }
16205
+ }
16206
+ ]
16207
+ },
16208
+ {
16209
+ name: "section",
16210
+ children: [
16211
+ {
16212
+ name: "block",
16213
+ props: {
16214
+ ref: "section-opener",
16215
+ slots: {
16216
+ number: "3",
16217
+ title: "{{Section title: results, as the headline finding}}"
16218
+ }
16219
+ }
16220
+ },
16221
+ {
16222
+ name: "paragraph",
16223
+ props: {
16224
+ text: "{{Body: what the figure shows and the number that matters}}"
16225
+ }
16226
+ },
16227
+ {
16228
+ name: "block",
16229
+ props: {
16230
+ ref: "chart-figure",
16231
+ slots: {
16232
+ chart: {
16233
+ name: "highcharts",
16234
+ props: {
16235
+ width: "100%",
16236
+ options: {
16237
+ chart: {
16238
+ type: "column",
16239
+ width: 900,
16240
+ height: 460
16241
+ },
16242
+ title: {
16243
+ text: null
16244
+ },
16245
+ xAxis: {
16246
+ categories: [
16247
+ "{{Condition 1}}",
16248
+ "{{Condition 2}}",
16249
+ "{{Condition 3}}"
16250
+ ],
16251
+ title: {
16252
+ text: "{{Independent variable (unit)}}"
16253
+ }
16254
+ },
16255
+ yAxis: {
16256
+ min: 0,
16257
+ title: {
16258
+ text: "{{Measure (unit)}}"
16259
+ }
16260
+ },
16261
+ series: [
16262
+ {
16263
+ name: "{{Series name}}",
16264
+ data: [0, 0, 0]
16265
+ }
16266
+ ],
16267
+ credits: {
16268
+ enabled: false
16269
+ }
16270
+ }
16271
+ }
16272
+ },
16273
+ caption: "{{Caption: what the chart shows, as a statement}}",
16274
+ takeaway: "{{Takeaway: the one sentence the reader should keep}}",
16275
+ source: "{{Source: system, run or document, date}}"
16276
+ }
16277
+ }
16278
+ },
16279
+ {
16280
+ name: "heading",
16281
+ props: {
16282
+ level: 2,
16283
+ text: "{{Sub-heading 3.1: the first result, as a statement}}"
16284
+ }
16285
+ },
16286
+ {
16287
+ name: "paragraph",
16288
+ props: {
16289
+ text: "{{Body: the evidence for the sub-heading, with its numbers}}"
16290
+ }
16291
+ },
16292
+ {
16293
+ name: "heading",
16294
+ props: {
16295
+ level: 2,
16296
+ text: "{{Sub-heading 3.2: the second result, as a statement}}"
16297
+ }
16298
+ },
16299
+ {
16300
+ name: "paragraph",
16301
+ props: {
16302
+ text: "{{Body: the evidence for the sub-heading, with its numbers}}"
16303
+ }
16304
+ },
16305
+ {
16306
+ name: "block",
16307
+ props: {
16308
+ ref: "data-table",
16309
+ slots: {
16310
+ title: "{{Table title: the runs or cases, and their conditions}}",
16311
+ labelHeader: "{{Run or case}}",
16312
+ labels: ["{{Row 1}}", "{{Row 2}}", "{{Row 3}}"],
16313
+ columns: [
16314
+ {
16315
+ header: "{{Measure (unit)}}",
16316
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
16317
+ },
16318
+ {
16319
+ header: "{{Measure (unit)}}",
16320
+ cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
16321
+ }
16322
+ ],
16323
+ notes: "{{Notes: definitions, conditions, exclusions the reader needs to read the figures}}",
16324
+ source: "{{Source: system, run or document, date}}"
16325
+ }
16326
+ }
16327
+ }
16328
+ ]
16329
+ },
16330
+ {
16331
+ name: "section",
16332
+ children: [
16333
+ {
16334
+ name: "block",
16335
+ props: {
16336
+ ref: "section-opener",
16337
+ slots: {
16338
+ number: "4",
16339
+ title: "{{Section title: recommendations, as what to do}}"
16340
+ }
16341
+ }
16342
+ },
16343
+ {
16344
+ name: "paragraph",
16345
+ props: {
16346
+ text: "{{Body: each recommendation with its expected effect, cost and owner}}"
16347
+ }
16348
+ },
16349
+ {
16350
+ name: "block",
16351
+ props: {
16352
+ ref: "callout",
16353
+ slots: {
16354
+ label: "{{Note label: Risk, or Open question}}",
16355
+ text: "{{Note: what could invalidate the recommendation and how it will be checked}}"
16356
+ }
16357
+ }
16358
+ }
16359
+ ]
16360
+ },
16361
+ {
16362
+ name: "section",
16363
+ children: [
16364
+ {
16365
+ name: "block",
16366
+ props: {
16367
+ ref: "section-opener",
16368
+ slots: {
16369
+ number: "5",
16370
+ title: "{{Section title: the readiness or decision statement}}"
16371
+ }
16372
+ }
16373
+ },
16374
+ {
16375
+ name: "paragraph",
16376
+ props: {
16377
+ text: "{{Body: the answer to the brief's question, with its condition}}"
16378
+ }
16379
+ },
16380
+ {
16381
+ name: "block",
16382
+ props: {
16383
+ ref: "footnotes",
16384
+ slots: {
16385
+ title: "References"
16386
+ }
16387
+ }
16388
+ }
16389
+ ]
16390
+ }
16391
+ ]
16392
+ },
16393
+ narrative: {
16394
+ description: "Argument-led: summary, context and constraints, an analysis section built on one comparison table, options and risks, a recommendation with next steps, references.",
16395
+ whenToUse: "The brief is a plan, a policy, a standard or an assessment with few numbers; the reader follows an argument to a decision.",
16396
+ pages: {
16397
+ min: 3,
16398
+ max: 8
16399
+ },
16400
+ metadata: {
16401
+ title: "{{Title: as on the cover}}",
16402
+ author: "{{Author or team}}",
16403
+ company: "{{Team or client name}}",
16404
+ date: "{{Month YYYY}}"
16405
+ },
16406
+ children: [
16407
+ {
16408
+ name: "section",
16409
+ children: [
16410
+ {
16411
+ name: "block",
16412
+ props: {
16413
+ ref: "cover",
16414
+ slots: {
16415
+ title: "{{Title: the report's conclusion in one sentence}}",
16416
+ subtitle: "{{Subtitle: what was examined, for whom}}",
16417
+ client: "{{Team or client name}}",
16418
+ date: "{{Month YYYY}}",
16419
+ confidentiality: "{{Confidentiality: Internal, or Confidential}}"
16420
+ }
16421
+ }
16422
+ }
16423
+ ]
16424
+ },
16425
+ {
16426
+ name: "section",
16427
+ children: [
16428
+ {
16429
+ name: "block",
16430
+ props: {
16431
+ ref: "running-head",
16432
+ slots: {
16433
+ confidentiality: "{{Confidentiality: as on the cover}}",
16434
+ date: "{{Month YYYY}}"
16435
+ }
16436
+ }
16437
+ },
16438
+ {
16439
+ name: "toc",
16440
+ props: {
16441
+ scope: "document",
16442
+ title: "Contents",
16443
+ depth: {
16444
+ from: 1,
16445
+ to: 2
16446
+ }
16447
+ }
16448
+ },
16449
+ {
16450
+ name: "block",
16451
+ props: {
16452
+ ref: "section-opener",
16453
+ slots: {
16454
+ number: "1",
16455
+ title: "{{Section title: the conclusion, as a statement}}"
16456
+ }
16457
+ }
16458
+ },
16459
+ {
16460
+ name: "block",
16461
+ props: {
16462
+ ref: "key-takeaways",
16463
+ slots: {
16464
+ label: "Summary",
16465
+ items: [
16466
+ "{{Finding 1: one claim, one sentence, with its number}}",
16467
+ "{{Finding 2: one claim, one sentence, with its number}}",
16468
+ "{{Finding 3: the recommendation that follows}}"
16469
+ ]
16470
+ }
16471
+ }
16472
+ },
16473
+ {
16474
+ name: "paragraph",
16475
+ props: {
16476
+ text: "{{Body: what was examined, what was found and what is recommended, in one paragraph}}"
15224
16477
  }
15225
16478
  }
15226
16479
  ]
@@ -15233,66 +16486,21 @@ var client_report_docx_blueprint_default = {
15233
16486
  props: {
15234
16487
  ref: "section-opener",
15235
16488
  slots: {
15236
- number: "02",
15237
- title: "{{Section title: the finding, as a statement}}"
16489
+ number: "2",
16490
+ title: "{{Section title: context and constraints}}"
15238
16491
  }
15239
16492
  }
15240
16493
  },
15241
16494
  {
15242
16495
  name: "paragraph",
15243
16496
  props: {
15244
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15245
- }
15246
- },
15247
- {
15248
- name: "block",
15249
- props: {
15250
- ref: "chart-figure",
15251
- slots: {
15252
- chart: {
15253
- name: "highcharts",
15254
- props: {
15255
- width: "100%",
15256
- options: {
15257
- chart: {
15258
- type: "column",
15259
- width: 900,
15260
- height: 460
15261
- },
15262
- title: {
15263
- text: null
15264
- },
15265
- xAxis: {
15266
- categories: [
15267
- "{{Period 1}}",
15268
- "{{Period 2}}",
15269
- "{{Period 3}}"
15270
- ]
15271
- },
15272
- yAxis: {
15273
- title: {
15274
- text: "{{Measure (unit)}}"
15275
- }
15276
- },
15277
- series: [
15278
- {
15279
- name: "{{Series name}}",
15280
- data: [0, 0, 0]
15281
- }
15282
- ]
15283
- }
15284
- }
15285
- },
15286
- caption: "{{Caption: what the chart shows, as a statement}}",
15287
- takeaway: "{{Takeaway: the one sentence the reader should keep}}",
15288
- source: "{{Source: system or document, date}}"
15289
- }
16497
+ text: "{{Body: the system or situation as it is, with the numbers that bound it}}"
15290
16498
  }
15291
16499
  },
15292
16500
  {
15293
16501
  name: "paragraph",
15294
16502
  props: {
15295
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16503
+ text: "{{Body: the requirement or question this report answers}}"
15296
16504
  }
15297
16505
  }
15298
16506
  ]
@@ -15305,15 +16513,15 @@ var client_report_docx_blueprint_default = {
15305
16513
  props: {
15306
16514
  ref: "section-opener",
15307
16515
  slots: {
15308
- number: "03",
15309
- title: "{{Section title: the finding, as a statement}}"
16516
+ number: "3",
16517
+ title: "{{Section title: analysis, as the headline finding}}"
15310
16518
  }
15311
16519
  }
15312
16520
  },
15313
16521
  {
15314
16522
  name: "paragraph",
15315
16523
  props: {
15316
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16524
+ text: "{{Body: the argument, opening with its claim}}"
15317
16525
  }
15318
16526
  },
15319
16527
  {
@@ -15321,8 +16529,8 @@ var client_report_docx_blueprint_default = {
15321
16529
  props: {
15322
16530
  ref: "data-table",
15323
16531
  slots: {
15324
- title: "{{Table title: what it compares, and the period}}",
15325
- labelHeader: "{{Row label}}",
16532
+ title: "{{Table title: what it compares, and the conditions}}",
16533
+ labelHeader: "{{Option or case}}",
15326
16534
  labels: ["{{Row 1}}", "{{Row 2}}", "{{Row 3}}"],
15327
16535
  columns: [
15328
16536
  {
@@ -15330,21 +16538,49 @@ var client_report_docx_blueprint_default = {
15330
16538
  cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
15331
16539
  },
15332
16540
  {
15333
- header: "{{Change}}",
16541
+ header: "{{Measure (unit)}}",
15334
16542
  cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
15335
16543
  }
15336
16544
  ],
15337
- source: "{{Source: system or document, date}}"
16545
+ notes: "{{Notes: definitions, conditions, exclusions the reader needs to read the figures}}",
16546
+ source: "{{Source: system, run or document, date}}"
16547
+ }
16548
+ }
16549
+ },
16550
+ {
16551
+ name: "paragraph",
16552
+ props: {
16553
+ text: "{{Body: what the table settles and what it leaves open}}"
16554
+ }
16555
+ }
16556
+ ]
16557
+ },
16558
+ {
16559
+ name: "section",
16560
+ children: [
16561
+ {
16562
+ name: "block",
16563
+ props: {
16564
+ ref: "section-opener",
16565
+ slots: {
16566
+ number: "4",
16567
+ title: "{{Section title: options and risks}}"
15338
16568
  }
15339
16569
  }
15340
16570
  },
16571
+ {
16572
+ name: "paragraph",
16573
+ props: {
16574
+ text: "{{Body: each option with its cost, its risk and what it forecloses}}"
16575
+ }
16576
+ },
15341
16577
  {
15342
16578
  name: "block",
15343
16579
  props: {
15344
16580
  ref: "callout",
15345
16581
  slots: {
15346
- label: "{{Note label}}",
15347
- text: "{{Note: a caveat about the numbers, a definition or the method}}"
16582
+ label: "{{Note label: Risk, or Open question}}",
16583
+ text: "{{Note: what could invalidate the recommendation and how it will be checked}}"
15348
16584
  }
15349
16585
  }
15350
16586
  }
@@ -15358,38 +16594,41 @@ var client_report_docx_blueprint_default = {
15358
16594
  props: {
15359
16595
  ref: "section-opener",
15360
16596
  slots: {
15361
- number: "04",
15362
- title: "{{Section title: the finding, as a statement}}"
16597
+ number: "5",
16598
+ title: "{{Section title: recommendation and next steps}}"
15363
16599
  }
15364
16600
  }
15365
16601
  },
15366
16602
  {
15367
16603
  name: "paragraph",
15368
16604
  props: {
15369
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16605
+ text: "{{Body: the recommendation, its condition and the first three steps with owners and dates}}"
15370
16606
  }
15371
16607
  },
15372
16608
  {
15373
16609
  name: "block",
15374
16610
  props: {
15375
- ref: "footnotes"
16611
+ ref: "footnotes",
16612
+ slots: {
16613
+ title: "References"
16614
+ }
15376
16615
  }
15377
16616
  }
15378
16617
  ]
15379
16618
  }
15380
16619
  ]
15381
16620
  },
15382
- narrative: {
15383
- 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.",
15384
- whenToUse: "The brief is a position, an assessment or a recommendation with few numbers; the reader follows an argument.",
16621
+ memo: {
16622
+ 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.",
16623
+ 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.",
15385
16624
  pages: {
15386
- min: 3,
15387
- max: 6
16625
+ min: 1,
16626
+ max: 3
15388
16627
  },
15389
16628
  metadata: {
15390
- title: "{{Title: as on the cover}}",
16629
+ title: "{{Title: the subject line}}",
15391
16630
  author: "{{Author or team}}",
15392
- company: "{{Client name}}",
16631
+ company: "{{Team or client name}}",
15393
16632
  date: "{{Month YYYY}}"
15394
16633
  },
15395
16634
  children: [
@@ -15399,131 +16638,72 @@ var client_report_docx_blueprint_default = {
15399
16638
  {
15400
16639
  name: "block",
15401
16640
  props: {
15402
- ref: "cover",
16641
+ ref: "memo-header",
15403
16642
  slots: {
15404
- title: "{{Title: the report's conclusion in one sentence}}",
15405
- subtitle: "{{Subtitle: what the report answers, for whom}}",
15406
- client: "{{Client name}}",
15407
- date: "{{Month YYYY}}",
15408
- confidentiality: "{{Confidentiality: Confidential, or For internal use}}"
16643
+ subject: "{{Subject: the recommendation in one line}}",
16644
+ to: "{{To: the person or group who decides}}",
16645
+ from: "{{From: author or team}}",
16646
+ date: "{{D Month YYYY}}"
15409
16647
  }
15410
16648
  }
15411
- }
15412
- ]
15413
- },
15414
- {
15415
- name: "section",
15416
- children: [
16649
+ },
15417
16650
  {
15418
16651
  name: "block",
15419
16652
  props: {
15420
16653
  ref: "running-head",
15421
16654
  slots: {
15422
- confidentiality: "{{Confidentiality: as on the cover}}",
16655
+ confidentiality: "{{Confidentiality: Internal, or Confidential}}",
15423
16656
  date: "{{Month YYYY}}"
15424
16657
  }
15425
16658
  }
15426
16659
  },
15427
- {
15428
- name: "block",
15429
- props: {
15430
- ref: "section-opener",
15431
- slots: {
15432
- number: "01",
15433
- title: "{{Section title: the finding, as a statement}}"
15434
- }
15435
- }
15436
- },
15437
16660
  {
15438
16661
  name: "block",
15439
16662
  props: {
15440
16663
  ref: "key-takeaways",
15441
16664
  slots: {
16665
+ label: "Recommendation",
15442
16666
  items: [
15443
- "{{Takeaway 1: one claim, one sentence, with its number}}",
15444
- "{{Takeaway 2: one claim, one sentence, with its number}}",
15445
- "{{Takeaway 3: the recommendation that follows}}"
16667
+ "{{Recommendation: what to do, in one sentence}}",
16668
+ "{{Reason 1: the requirement it meets, with its number}}",
16669
+ "{{Reason 2: the cost or risk accepted, with its number}}"
15446
16670
  ]
15447
16671
  }
15448
16672
  }
15449
16673
  },
15450
- {
15451
- name: "paragraph",
15452
- props: {
15453
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15454
- }
15455
- },
15456
- {
15457
- name: "paragraph",
15458
- props: {
15459
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15460
- }
15461
- }
15462
- ]
15463
- },
15464
- {
15465
- name: "section",
15466
- children: [
15467
16674
  {
15468
16675
  name: "block",
15469
16676
  props: {
15470
16677
  ref: "section-opener",
15471
16678
  slots: {
15472
- number: "02",
15473
- title: "{{Section title: the finding, as a statement}}"
16679
+ number: "1",
16680
+ title: "{{Section title: the question and its constraints}}"
15474
16681
  }
15475
16682
  }
15476
16683
  },
15477
16684
  {
15478
16685
  name: "paragraph",
15479
16686
  props: {
15480
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15481
- }
15482
- },
15483
- {
15484
- name: "block",
15485
- props: {
15486
- ref: "callout",
15487
- slots: {
15488
- label: "{{Note label}}",
15489
- text: "{{Note: a caveat about the numbers, a definition or the method}}"
15490
- }
16687
+ text: "{{Body: the requirements, each with its number, and what was considered}}"
15491
16688
  }
15492
16689
  },
15493
- {
15494
- name: "paragraph",
15495
- props: {
15496
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15497
- }
15498
- }
15499
- ]
15500
- },
15501
- {
15502
- name: "section",
15503
- children: [
15504
16690
  {
15505
16691
  name: "block",
15506
16692
  props: {
15507
16693
  ref: "section-opener",
15508
16694
  slots: {
15509
- number: "03",
15510
- title: "{{Section title: the finding, as a statement}}"
16695
+ number: "2",
16696
+ title: "{{Section title: the options against the requirements}}"
15511
16697
  }
15512
16698
  }
15513
16699
  },
15514
- {
15515
- name: "paragraph",
15516
- props: {
15517
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
15518
- }
15519
- },
15520
16700
  {
15521
16701
  name: "block",
15522
16702
  props: {
15523
16703
  ref: "data-table",
15524
16704
  slots: {
15525
- title: "{{Table title: what it compares, and the period}}",
15526
- labelHeader: "{{Row label}}",
16705
+ title: "{{Table title: options against the requirements}}",
16706
+ labelHeader: "{{Option}}",
15527
16707
  labels: ["{{Row 1}}", "{{Row 2}}", "{{Row 3}}"],
15528
16708
  columns: [
15529
16709
  {
@@ -15531,68 +16711,54 @@ var client_report_docx_blueprint_default = {
15531
16711
  cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
15532
16712
  },
15533
16713
  {
15534
- header: "{{Change}}",
16714
+ header: "{{Measure (unit)}}",
15535
16715
  cells: ["{{0.0}}", "{{0.0}}", "{{0.0}}"]
15536
16716
  }
15537
16717
  ],
15538
- source: "{{Source: system or document, date}}"
16718
+ notes: "{{Notes: definitions, conditions, exclusions the reader needs to read the figures}}",
16719
+ source: "{{Source: system, run or document, date}}"
15539
16720
  }
15540
16721
  }
15541
16722
  },
15542
16723
  {
15543
- name: "block",
16724
+ name: "paragraph",
15544
16725
  props: {
15545
- ref: "kpi-row",
15546
- slots: {
15547
- items: [
15548
- {
15549
- value: "{{0.0}}",
15550
- label: "{{What it measures}}"
15551
- },
15552
- {
15553
- value: "{{0.0}}",
15554
- label: "{{What it measures}}"
15555
- },
15556
- {
15557
- value: "{{0.0}}",
15558
- label: "{{What it measures}}"
15559
- }
15560
- ],
15561
- source: "{{Source: system or document, date}}"
15562
- }
16726
+ text: "{{Body: why the recommended option wins and what the others lose on}}"
15563
16727
  }
15564
16728
  },
15565
16729
  {
15566
- name: "paragraph",
16730
+ name: "block",
15567
16731
  props: {
15568
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16732
+ ref: "callout",
16733
+ slots: {
16734
+ label: "{{Note label: Assumption}}",
16735
+ text: "{{Note: the assumption the recommendation rests on}}"
16736
+ }
15569
16737
  }
15570
- }
15571
- ]
15572
- },
15573
- {
15574
- name: "section",
15575
- children: [
16738
+ },
15576
16739
  {
15577
16740
  name: "block",
15578
16741
  props: {
15579
16742
  ref: "section-opener",
15580
16743
  slots: {
15581
- number: "04",
15582
- title: "{{Section title: the finding, as a statement}}"
16744
+ number: "3",
16745
+ title: "{{Section title: what would change the answer}}"
15583
16746
  }
15584
16747
  }
15585
16748
  },
15586
16749
  {
15587
16750
  name: "paragraph",
15588
16751
  props: {
15589
- text: "{{Body: two or three short paragraphs of evidence for the section title, each opening with its claim}}"
16752
+ text: "{{Body: the two or three facts that would reverse the recommendation, and who checks them}}"
15590
16753
  }
15591
16754
  },
15592
16755
  {
15593
16756
  name: "block",
15594
16757
  props: {
15595
- ref: "footnotes"
16758
+ ref: "footnotes",
16759
+ slots: {
16760
+ title: "References"
16761
+ }
15596
16762
  }
15597
16763
  }
15598
16764
  ]
@@ -15603,25 +16769,6 @@ var client_report_docx_blueprint_default = {
15603
16769
  };
15604
16770
 
15605
16771
  // src/blueprints/index.ts
15606
- function register(...candidates) {
15607
- const registry2 = {};
15608
- for (const candidate of candidates) {
15609
- const issues = validateBlueprint(candidate);
15610
- if (issues.length > 0)
15611
- throw new Error(
15612
- `Invalid bundled blueprint: ${issues.map((issue) => `${issue.path}: ${issue.message}`).join("; ")}`
15613
- );
15614
- const blueprint = candidate;
15615
- if (blueprint.format !== "docx")
15616
- throw new Error(`Blueprint ${blueprint.id} is not a DOCX blueprint.`);
15617
- if (registry2[blueprint.id])
15618
- throw new Error(
15619
- `Two bundled blueprints share the id "${blueprint.id}"; the later one would silently replace the earlier.`
15620
- );
15621
- registry2[blueprint.id] = blueprint;
15622
- }
15623
- return registry2;
15624
- }
15625
16772
  function scanned(known) {
15626
16773
  let here;
15627
16774
  try {
@@ -15639,119 +16786,23 @@ function scanned(known) {
15639
16786
  return !(typeof id === "string" && id in known);
15640
16787
  });
15641
16788
  }
15642
- var bundled = register(client_report_docx_blueprint_default);
16789
+ var bundled = registerBlueprints("docx", [client_report_docx_blueprint_default, technical_report_docx_blueprint_default]);
15643
16790
  var DOCX_BLUEPRINTS = {
15644
16791
  ...bundled,
15645
- ...register(...scanned(bundled))
16792
+ ...registerBlueprints("docx", scanned(bundled))
15646
16793
  };
15647
16794
  function docxBlueprint(id) {
15648
16795
  return DOCX_BLUEPRINTS[id];
15649
16796
  }
15650
- var MARKER = /^\{\{\s*([\s\S]*?)\s*\}\}$/;
15651
16797
  function instantiateDocxBlueprint(blueprint, options) {
15652
- if (blueprint.format !== "docx")
15653
- throw new Error(
15654
- `Blueprint ${blueprint.id} is a ${blueprint.format} blueprint; this instantiates DOCX ones.`
15655
- );
15656
- const variantId = options.variant ?? Object.keys(blueprint.variants)[0];
15657
- const variant = blueprint.variants[variantId];
15658
- if (!variant)
15659
- throw new Error(
15660
- `Blueprint ${blueprint.id} has no variant "${variantId}"; it has ${Object.keys(
15661
- blueprint.variants
15662
- ).join(", ")}.`
15663
- );
15664
- const children = structuredClone(variant.children);
15665
- const blocks = definitionsFor(children, options.definitions, blueprint);
15666
- const document = {
15667
- name: "docx",
15668
- props: {
15669
- theme: options.theme ?? blueprint.theme,
15670
- qualityProfile: blueprint.profile,
15671
- ...Object.keys(blocks).length > 0 && { blocks },
15672
- metadata: { ...variant.metadata, ...options.metadata }
15673
- },
15674
- children
15675
- };
15676
- return { document, fillMap: fillMap(document, blocks), variant: variantId };
15677
- }
15678
- function definitionsFor(children, available, blueprint) {
15679
- const refs = /* @__PURE__ */ new Set();
15680
- const visit = (node) => {
15681
- if (Array.isArray(node)) return node.forEach(visit);
15682
- if (!node || typeof node !== "object") return;
15683
- const record = node;
15684
- const props = record.props;
15685
- if (record.name === "block" && typeof props?.ref === "string")
15686
- refs.add(props.ref);
15687
- Object.values(record).forEach(visit);
15688
- };
15689
- visit(children);
15690
- const result = {};
15691
- for (const ref of refs) {
15692
- if (!available[ref])
15693
- throw new Error(
15694
- `Blueprint ${blueprint.id} invokes "${ref}", which ${blueprint.definitions} does not define.`
15695
- );
15696
- for (const name of [...blockDependencies(available, ref), ref])
15697
- result[name] ??= structuredClone(available[name]);
15698
- }
15699
- return result;
15700
- }
15701
- function fillMap(document, blocks) {
15702
- return collectPlaceholders2(document).filter((occurrence) => occurrence.match.kind === "scaffold-marker").map((occurrence) => {
15703
- const guidance = occurrence.text.match(MARKER)?.[1] ?? occurrence.text;
15704
- const base = { path: occurrence.path, marker: occurrence.text, guidance };
15705
- if (occurrence.path.startsWith("/props/metadata/"))
15706
- return { ...base, kind: "metadata" };
15707
- const slot = slotAt(document, occurrence.path, blocks);
15708
- return slot ? { ...base, kind: "slot", ...slot } : { ...base, kind: "text" };
16798
+ return instantiateBlueprint(blueprint, options, {
16799
+ format: "docx",
16800
+ metadataPointer: "/props/metadata",
16801
+ markers: (document) => collectPlaceholders2(document).filter(
16802
+ (occurrence) => occurrence.match.kind === "scaffold-marker"
16803
+ )
15709
16804
  });
15710
16805
  }
15711
- function slotAt(document, pointer, blocks) {
15712
- const at = pointer.lastIndexOf("/props/slots/");
15713
- if (at < 0) return void 0;
15714
- const invocation = valueAt(document, pointer.slice(0, at));
15715
- const ref = invocation?.props?.ref;
15716
- if (typeof ref !== "string" || !blocks[ref]) return void 0;
15717
- const segments = pointer.slice(at + "/props/slots/".length).split("/").map(unescape);
15718
- let slot = blocks[ref].slots[segments[0]];
15719
- const names = [segments[0]];
15720
- for (const segment of segments.slice(1)) {
15721
- if (!slot) break;
15722
- if (slot.type === "array" && /^\d+$/.test(segment)) slot = slot.items;
15723
- else if (slot.type === "object") {
15724
- slot = slot.properties?.[segment];
15725
- names.push(segment);
15726
- } else if (slot.type === "component")
15727
- break;
15728
- else slot = void 0;
15729
- }
15730
- if (!slot) return void 0;
15731
- return {
15732
- block: ref,
15733
- slot: names.join("."),
15734
- type: slot.type,
15735
- ...slot.maxWords !== void 0 && { maxWords: slot.maxWords },
15736
- ...slot.maxLength !== void 0 && { maxLength: slot.maxLength },
15737
- ...slot.oneLine !== void 0 && { oneLine: slot.oneLine },
15738
- ...slot.required !== void 0 && { required: slot.required }
15739
- };
15740
- }
15741
- function unescape(segment) {
15742
- return segment.replace(/~1/g, "/").replace(/~0/g, "~");
15743
- }
15744
- function valueAt(root, pointer) {
15745
- if (pointer === "") return root;
15746
- let current = root;
15747
- for (const segment of pointer.split("/").slice(1).map(unescape)) {
15748
- if (Array.isArray(current)) current = current[Number(segment)];
15749
- else if (current && typeof current === "object")
15750
- current = current[segment];
15751
- else return void 0;
15752
- }
15753
- return current;
15754
- }
15755
16806
 
15756
16807
  // src/index.ts
15757
16808
  init_json();
@@ -16690,6 +17741,7 @@ export {
16690
17741
  generateComponentSchemas,
16691
17742
  generatePluginDocumentSchema,
16692
17743
  generateWarningsDocument,
17744
+ getChartRequestStats,
16693
17745
  getCoreVersion,
16694
17746
  getExample,
16695
17747
  getExampleNames,
@@ -16716,6 +17768,7 @@ export {
16716
17768
  mergeSchemas,
16717
17769
  minimalTheme,
16718
17770
  prepareDocxQualityDocument,
17771
+ resetChartRequestStats,
16719
17772
  resetVisualPrepassStats,
16720
17773
  resolveDocxQualityProfile,
16721
17774
  runExample,