stunning-md 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.mjs CHANGED
@@ -1,3 +1,13 @@
1
+ import {
2
+ BlockSplitter,
3
+ CHAT_INSTRUCTIONS,
4
+ chatCompletionsUrl,
5
+ createChat,
6
+ settledMarkdown,
7
+ sortReply,
8
+ wantsContent
9
+ } from "./chunk-MKH2VK55.mjs";
10
+
1
11
  // src/stunning-md/parse.ts
2
12
  import remarkFrontmatter from "remark-frontmatter";
3
13
  import remarkGfm from "remark-gfm";
@@ -218,7 +228,7 @@ function parseDate(raw) {
218
228
  return null;
219
229
  }
220
230
  var ID_HEADER = /^(#|no\.?|nr\.?|id|rank|pos(ition)?|s\/n|index|ref)$/i;
221
- var TIME_HEADER = /\b(year|date|when|period|month|quarter|fy|time|day|week)\b/i;
231
+ var TIME_HEADER = /\b(years?|dates?|when|periods?|months?|quarters?|fy|time|days?|weeks?)\b/i;
222
232
  var SHARE_HEADER = /\b(share|allocation|mix|breakdown|distribution|portion|weight|split|composition)\b/i;
223
233
  var SUMMARY_LABEL = /^(grand )?(total|sum|overall|subtotal|average|avg|mean|median|all)\b/i;
224
234
  function unitFromHeader(label) {
@@ -373,6 +383,21 @@ function planViz(model) {
373
383
  }
374
384
  return table("no label column");
375
385
  }
386
+ if (!dateColumn && numeric.length === 1 && label.type === "text" && rows.length >= 3 && avgLength(label) >= 16) {
387
+ const years = rows.map((row) => /^\d{4}$/.test(row.text[numeric[0].key]) ? row.value[numeric[0].key] : NaN);
388
+ const plausible = years.every((year) => year >= 1e3 && year <= 2100);
389
+ const ordered = years.every((year, i) => i === 0 || year >= years[i - 1]) || years.every((year, i) => i === 0 || year <= years[i - 1]);
390
+ if (plausible && ordered) {
391
+ return {
392
+ kind: "timeline",
393
+ labelKey: numeric[0].key,
394
+ charts: [],
395
+ rowIndices: all,
396
+ candidates: ["timeline", "table"],
397
+ reason: "years in order beside descriptions"
398
+ };
399
+ }
400
+ }
376
401
  if (otherTexts.length >= numeric.length || otherTexts.some((c) => avgLength(c) > 40)) {
377
402
  if (dateColumn && rows.length >= 3 && numeric.length <= 1) {
378
403
  return {
@@ -580,7 +605,7 @@ function buildBlocks(nodes, ctx, sectionId) {
580
605
  blocks.push({
581
606
  kind: "heading",
582
607
  depth: Math.max(1, node.depth - ctx.sectionDepth),
583
- id: slugify(toText(node), ctx.slugs),
608
+ id: ctx.prefix + slugify(toText(node), ctx.slugs),
584
609
  children: node.children
585
610
  });
586
611
  break;
@@ -624,7 +649,8 @@ function buildBlocks(nodes, ctx, sectionId) {
624
649
  blocks.push({ kind: "content", node });
625
650
  }
626
651
  }
627
- return blocks;
652
+ const breaks = (block) => !block || block.kind === "rule" || block.kind === "heading";
653
+ return blocks.filter((block, index) => block.kind !== "rule" || !(breaks(blocks[index - 1]) || breaks(blocks[index + 1])));
628
654
  }
629
655
  function measure(raw, ctx) {
630
656
  const { nodes } = raw;
@@ -692,7 +718,7 @@ function rankLayouts(raw, shape) {
692
718
  }
693
719
  function buildSection(raw, ctx, index) {
694
720
  const titleText = raw.heading ? toText(raw.heading).trim() : "";
695
- const id = raw.heading ? slugify(titleText, ctx.slugs) : slugify("introduction", ctx.slugs);
721
+ const id = ctx.prefix + (raw.heading ? slugify(titleText, ctx.slugs) : slugify("introduction", ctx.slugs));
696
722
  const shape = measure(raw, ctx);
697
723
  const { layouts, reason } = rankLayouts(raw, shape);
698
724
  const wanted = ctx.judgements.layouts?.[id];
@@ -706,7 +732,7 @@ function buildSection(raw, ctx, index) {
706
732
  {
707
733
  kind: "cards",
708
734
  items: shape.cards.map((card) => ({
709
- id: slugify(toText(card.heading), ctx.slugs),
735
+ id: ctx.prefix + slugify(toText(card.heading), ctx.slugs),
710
736
  title: card.heading.children,
711
737
  blocks: buildBlocks(card.nodes, ctx, id)
712
738
  }))
@@ -754,6 +780,7 @@ function planDocument(input) {
754
780
  images: input.images ?? {},
755
781
  judgements: input.judgements ?? {},
756
782
  slugs: /* @__PURE__ */ new Set(["top"]),
783
+ prefix: input.idPrefix ?? "",
757
784
  sectionDepth,
758
785
  splitCount: 0,
759
786
  dataCount: 0
@@ -861,267 +888,318 @@ function planDocument(input) {
861
888
  }
862
889
 
863
890
  // src/stunning-md/theme/themes.ts
864
- var tokens = (bg, surface, fg, muted, border, accent, accentFg) => ({
891
+ var themeTopics = [
892
+ { id: "writing", name: "Writing" },
893
+ { id: "official", name: "Business & official" },
894
+ { id: "technology", name: "Technology" },
895
+ { id: "lifestyle", name: "Places & lifestyle" },
896
+ { id: "wellbeing", name: "Nature & health" },
897
+ { id: "culture", name: "Culture & play" }
898
+ ];
899
+ var tokens = (bg, surface, fg, muted, border, accent, accentFg, highlight, highlightFg) => ({
865
900
  bg,
866
901
  surface,
867
902
  fg,
868
903
  muted,
869
904
  border,
870
905
  accent,
871
- accentFg
906
+ accentFg,
907
+ ...highlight && highlightFg ? { highlight: { bg: highlight, fg: highlightFg } } : {}
872
908
  });
873
909
  var themes = {
874
910
  paper: {
875
911
  id: "paper",
876
912
  name: "Paper",
877
- description: "essays, stories, opinion, personal writing",
913
+ topic: "writing",
914
+ description: "essays, short stories, fiction, memoir, opinion, local history",
878
915
  look: "cream paper, terracotta accent",
879
916
  fonts: "editorial",
880
917
  formality: 0.5,
881
918
  chart: "flat",
919
+ hero: "wash",
882
920
  keywords: /\b(essay|story|chapter|novel|memoir|poem|letter|journal|philosophy|opinion|notebook|writing)\b/gi,
883
- light: tokens("#faf7f2", "#f1ebe1", "#1f1b16", "#6b6257", "#e0d7c9", "#a8481f", "#ffffff"),
884
- dark: tokens("#171411", "#221d18", "#f1ebe2", "#a89f92", "#352e26", "#e59468", "#1a120c")
921
+ light: tokens("#f5eedf", "#ebe1cc", "#1f1b16", "#4e473c", "#d6c9b0", "#a23f17", "#ffffff"),
922
+ dark: tokens("#1b1612", "#29221b", "#f3ecdf", "#b8ad9d", "#3f352a", "#f0a070", "#1a120c")
885
923
  },
886
924
  ink: {
887
925
  id: "ink",
888
926
  name: "Ink",
889
- description: "plain notes, memos, minimal design writing",
890
- look: "white, black ink, no colour",
927
+ topic: "writing",
928
+ description: "meeting notes, memos, minutes, plain lists",
929
+ look: "white page, black cover, no colour",
891
930
  fonts: "modern",
892
931
  formality: 0.7,
893
932
  chart: "linework",
933
+ hero: "ink",
894
934
  keywords: /\b(design|minimal|typography|studio|portfolio|notes|memo|manifesto)\b/gi,
895
- light: tokens("#ffffff", "#f4f4f5", "#0a0a0a", "#5f5f68", "#e4e4e7", "#18181b", "#ffffff"),
896
- dark: tokens("#0a0a0a", "#18181b", "#fafafa", "#a1a1aa", "#27272a", "#f4f4f5", "#0a0a0a")
935
+ light: tokens("#ffffff", "#f1f1f2", "#000000", "#505056", "#d4d4d8", "#111111", "#ffffff"),
936
+ dark: tokens("#000000", "#161618", "#ffffff", "#a8a8b0", "#2e2e33", "#f4f4f5", "#0a0a0a")
897
937
  },
898
938
  ocean: {
899
939
  id: "ocean",
900
940
  name: "Ocean",
901
- description: "business reports, finance, strategy, investors",
902
- look: "cool white, navy, corporate blue",
941
+ topic: "official",
942
+ description: "business reports, finance, sales, strategy, investors",
943
+ look: "cool white, corporate blue cover, amber",
903
944
  fonts: "modern",
904
945
  formality: 0.6,
905
946
  chart: "soft",
947
+ hero: "block",
906
948
  keywords: /\b(revenue|profit|quarter|q[1-4]|market|investor|financial|growth|customers?|sales|strategy|kpi|forecast|budget|margin|earnings|business)\b/gi,
907
- light: tokens("#f7fafc", "#eaf1f7", "#0f1f2e", "#52667a", "#d5e0eb", "#0b5fa8", "#ffffff"),
908
- dark: tokens("#0b1420", "#121f2e", "#e8f0f7", "#93a7ba", "#213347", "#62b0f0", "#06121d")
949
+ light: tokens("#eef4fa", "#dce8f4", "#0a1f33", "#374c63", "#bfd2e5", "#0a55a0", "#ffffff", "#f2b84b", "#0a1f33"),
950
+ dark: tokens("#0a1a30", "#12284a", "#eaf2fb", "#a0b6ce", "#24406b", "#6cb8ff", "#06121d", "#f2b84b", "#0a1a30")
909
951
  },
910
952
  forest: {
911
953
  id: "forest",
912
954
  name: "Forest",
913
- description: "nature, environment, outdoors, gardening",
914
- look: "sage background, deep green",
955
+ topic: "wellbeing",
956
+ description: "nature, environment, outdoors, gardening, biology",
957
+ look: "sage green page, deep forest green",
915
958
  fonts: "friendly",
916
959
  formality: 0.35,
917
960
  chart: "instrument",
961
+ hero: "wash",
918
962
  keywords: /\b(nature|climate|forest|garden|plants?|sustainab\w+|environment\w*|organic|wildlife|hiking|ecology|carbon|farm\w*|valley|trail)\b/gi,
919
- light: tokens("#f6f8f3", "#e9efe2", "#17231a", "#586a5b", "#d3ddcd", "#2b6a3c", "#ffffff"),
920
- dark: tokens("#0e1510", "#17211a", "#e6efe6", "#97aa9a", "#28372c", "#7fc890", "#0b160e")
963
+ light: tokens("#e3ecd8", "#f5f9ef", "#14241a", "#3c5040", "#c3d2b5", "#1f6b35", "#ffffff"),
964
+ dark: tokens("#0f2417", "#183422", "#e8f2e4", "#abc1ad", "#2b4b36", "#8fdc9c", "#0b160e")
921
965
  },
922
966
  sunset: {
923
967
  id: "sunset",
924
968
  name: "Sunset",
925
- description: "travel journals, itineraries, destinations",
926
- look: "warm peach, burnt orange",
969
+ topic: "lifestyle",
970
+ description: "travel journals, itineraries, destinations, city guides",
971
+ look: "apricot page, burnt orange cover",
927
972
  fonts: "elegant",
928
973
  formality: 0.4,
929
974
  chart: "soft",
975
+ hero: "block",
930
976
  keywords: /\b(travel|trip|beach|hotel|festival|holiday|itinerary|adventure|temples?|shrine|guesthouse|city|walks?|journey|island)\b/gi,
931
- light: tokens("#fff9f4", "#fdeee2", "#2a1710", "#78594b", "#f0d8c8", "#bb3a15", "#ffffff"),
932
- dark: tokens("#1a100c", "#281912", "#fbeee6", "#c0a497", "#3d281e", "#ff8f63", "#200e06")
977
+ light: tokens("#fde3cf", "#fff5ec", "#2a130a", "#694133", "#efc3a7", "#a32c0c", "#ffffff"),
978
+ dark: tokens("#24101a", "#361a27", "#fdeee6", "#cfa79b", "#4e2839", "#ff9a62", "#200e06")
933
979
  },
934
980
  violet: {
935
981
  id: "violet",
936
982
  name: "Violet",
937
- description: "tech products, startups, AI, launches",
938
- look: "lavender, vivid purple",
983
+ topic: "technology",
984
+ description: "tech products, startups, AI, launches, pricing pages",
985
+ look: "lavender page, vivid purple cover, lime",
939
986
  fonts: "friendly",
940
987
  formality: 0.25,
941
988
  chart: "instrument",
989
+ hero: "block",
942
990
  keywords: /\b(product|startup|launch|ai|model|platform|features?|app|saas|creative|innovation|roadmap|pricing|beta)\b/gi,
943
- light: tokens("#faf8ff", "#f0ebfd", "#1a1530", "#625b7e", "#dfd8f5", "#6236e0", "#ffffff"),
944
- dark: tokens("#100d1c", "#1a162c", "#efeaff", "#a69fc4", "#2c2647", "#a892ff", "#120b2a")
991
+ light: tokens("#eae4ff", "#f8f5ff", "#17112e", "#4e456e", "#cdc2f4", "#5a2be0", "#ffffff", "#c8f560", "#17112e"),
992
+ dark: tokens("#170f3a", "#231856", "#f0ebff", "#b3a9db", "#382a78", "#b39dff", "#120b2a", "#c8f560", "#170f3a")
945
993
  },
946
994
  terminal: {
947
995
  id: "terminal",
948
996
  name: "Terminal",
949
- description: "software docs, READMEs, API and developer guides",
950
- look: "cool grey, teal",
997
+ topic: "technology",
998
+ description: "software docs, READMEs, API and developer guides, framework comparisons",
999
+ look: "cool grey, dark slate cover, teal, amber",
951
1000
  fonts: "technical",
952
1001
  formality: 0.6,
953
1002
  chart: "flat",
1003
+ hero: "ink",
954
1004
  keywords: /\b(install|npm|api|cli|usage|config\w*|repository|function|library|docker|git|sdk|endpoint|compile|typescript|python|server|deploy\w*)\b/gi,
955
- light: tokens("#f6f8f9", "#e9eff1", "#0d1b21", "#4f656e", "#d2dde1", "#0a716c", "#ffffff"),
956
- dark: tokens("#0a0f12", "#121b20", "#e2ecef", "#8ba2ab", "#202f36", "#45dcc2", "#04201b")
1005
+ light: tokens("#edf2f3", "#dde6e9", "#0b1a20", "#354c55", "#c0cfd4", "#0a6f6a", "#ffffff", "#ffb000", "#0b1a20"),
1006
+ dark: tokens("#0a1114", "#131f24", "#e2ecef", "#97acb5", "#22333b", "#45dcc2", "#04201b", "#ffb000", "#0a1114")
957
1007
  },
958
1008
  chambers: {
959
1009
  id: "chambers",
960
1010
  name: "Chambers",
1011
+ topic: "official",
961
1012
  description: "legal documents, contracts, policy, regulation",
962
- look: "ivory, navy and gold",
1013
+ look: "ivory, navy cover, gold",
963
1014
  fonts: "classic",
964
1015
  formality: 0.9,
965
1016
  chart: "flat",
1017
+ hero: "block",
966
1018
  keywords: /\b(agreement|contract|clause|shall|court|law|legal|policy|regulation|act|statute|party|parties|compliance|hereby|pursuant|terms)\b/gi,
967
- light: tokens("#fbfaf7", "#f0eee6", "#151c2c", "#575e70", "#dbd8cd", "#1f3a6e", "#ffffff"),
968
- dark: tokens("#0d111b", "#161c2b", "#ece9e0", "#a0a6b5", "#283046", "#cdae66", "#1a1405")
1019
+ light: tokens("#f6f1e4", "#ebe3cf", "#111a2e", "#3f485c", "#d1c7ad", "#1f3a6e", "#ffffff", "#c9a54f", "#111a2e"),
1020
+ dark: tokens("#0e1526", "#18223b", "#efe9da", "#a8aebd", "#2b3654", "#d4b46a", "#1a1405", "#27468a", "#f4eee0")
969
1021
  },
970
1022
  academia: {
971
1023
  id: "academia",
972
1024
  name: "Academia",
973
- description: "scholarly papers, research, theses, lecture notes",
974
- look: "ivory, oxblood red",
1025
+ topic: "official",
1026
+ description: "scholarly papers, research, theses, lecture notes, science explainers",
1027
+ look: "parchment, oxblood red",
975
1028
  fonts: "scholarly",
976
1029
  formality: 0.9,
977
1030
  chart: "linework",
1031
+ hero: "wash",
978
1032
  keywords: /\b(research|study|abstract|hypothesis|methodology|findings|literature|thesis|theorem|proof|citation|journal|university|experiment)\b/gi,
979
- light: tokens("#fbf9f3", "#f1eddf", "#1c1812", "#655c4c", "#ddd6c2", "#7b1e22", "#ffffff"),
980
- dark: tokens("#13110c", "#1e1b13", "#efe9d8", "#aca38c", "#332e20", "#e58a86", "#240808")
1033
+ light: tokens("#f3ebd6", "#e8dec2", "#1c1710", "#4d4536", "#d1c5a3", "#7b1e22", "#ffffff"),
1034
+ dark: tokens("#1c1410", "#2a1e18", "#f1e8d3", "#b7aa8f", "#42322a", "#f09a94", "#240808")
981
1035
  },
982
1036
  blueprint: {
983
1037
  id: "blueprint",
984
1038
  name: "Blueprint",
1039
+ topic: "technology",
985
1040
  description: "engineering specs, architecture, hardware, proposals",
986
- look: "drafting blue-white, cobalt",
1041
+ look: "pale drafting blue, cobalt cover, marker yellow",
987
1042
  fonts: "geometric",
988
1043
  formality: 0.8,
989
1044
  chart: "flat",
1045
+ hero: "block",
990
1046
  keywords: /\b(specification|architecture|system|design doc|requirements?|protocol|diagram|engineering|hardware|sensor|circuit|tolerance|proposal|rfc)\b/gi,
991
- light: tokens("#f5f8fd", "#e6eefa", "#0c1a33", "#4c5f80", "#cfdcf0", "#1447c8", "#ffffff"),
992
- dark: tokens("#08122a", "#0f1d3d", "#e4ecfb", "#93a6cc", "#1d3160", "#7aa5ff", "#05102a")
1047
+ light: tokens("#dee8fb", "#f4f8ff", "#0a1836", "#394a6f", "#b7caee", "#1140c0", "#ffffff", "#ffd54a", "#0a1836"),
1048
+ dark: tokens("#0a1d4d", "#122a68", "#e6eeff", "#aabce3", "#24408c", "#8fb4ff", "#05102a", "#ffd54a", "#0a1d4d")
993
1049
  },
994
1050
  midnight: {
995
1051
  id: "midnight",
996
1052
  name: "Midnight",
997
- description: "night-time, space, science fiction, games, nightlife",
998
- look: "deep indigo, electric cyan",
1053
+ topic: "culture",
1054
+ description: "night-time, space, astronomy, science fiction, games, nightlife",
1055
+ look: "periwinkle, deep indigo cover, electric cyan, magenta",
999
1056
  fonts: "geometric",
1000
1057
  formality: 0.4,
1001
1058
  chart: "instrument",
1059
+ hero: "ink",
1002
1060
  keywords: /\b(space|galaxy|stars?|orbit|planet|astronom\w+|game|gaming|cyber\w*|future|sci-?fi|night|dark|dusk|cinematic|neon|milky way)\b/gi,
1003
- light: tokens("#f6f6fc", "#eaeaf7", "#14132b", "#5a5980", "#d7d6ee", "#3d2fd0", "#ffffff"),
1004
- dark: tokens("#07071a", "#10102a", "#ecebff", "#9c9bc6", "#232350", "#5ee6ff", "#03141a")
1061
+ light: tokens("#e3e3fa", "#f5f5ff", "#100f2e", "#464572", "#c1c0ed", "#3a2bd0", "#ffffff", "#ff5ad6", "#100f2e"),
1062
+ dark: tokens("#060620", "#101038", "#ecebff", "#a3a2d4", "#25256a", "#5ee6ff", "#03141a", "#ff5ad6", "#060620")
1005
1063
  },
1006
1064
  rose: {
1007
1065
  id: "rose",
1008
1066
  name: "Rose",
1009
- description: "weddings, beauty, fashion, celebrations",
1010
- look: "blush pink, deep rose",
1067
+ topic: "lifestyle",
1068
+ description: "weddings, beauty, skincare, fashion, celebrations",
1069
+ look: "blush pink page, deep rose",
1011
1070
  fonts: "luxe",
1012
1071
  formality: 0.3,
1013
1072
  chart: "soft",
1073
+ hero: "wash",
1014
1074
  keywords: /\b(wedding|bride|beauty|fashion|skincare|romance|love|invitation|bouquet|engagement|anniversary|bridal)\b/gi,
1015
- light: tokens("#fff7f7", "#fbe9ea", "#2b1519", "#7a5560", "#f1d3d6", "#b3305a", "#ffffff"),
1016
- dark: tokens("#1a0e11", "#27161b", "#fbe9ec", "#c59ba5", "#3e242b", "#ff8fae", "#2a0a14")
1075
+ light: tokens("#fbdfe3", "#fff4f5", "#2b1218", "#673e4e", "#eebcc5", "#a8234f", "#ffffff"),
1076
+ dark: tokens("#2a0f1a", "#3b1826", "#fdeaee", "#d1a3b1", "#55263a", "#ff9bb8", "#2a0a14")
1017
1077
  },
1018
1078
  sand: {
1019
1079
  id: "sand",
1020
1080
  name: "Sand",
1081
+ topic: "lifestyle",
1021
1082
  description: "interiors, craft, slow living, quiet luxury",
1022
1083
  look: "stone beige, muted olive",
1023
1084
  fonts: "luxe",
1024
1085
  formality: 0.7,
1025
1086
  chart: "flat",
1087
+ hero: "wash",
1026
1088
  keywords: /\b(interior|furniture|ceramics?|craft|atelier|linen|slow living|minimalis[mt]|gallery|curated|artisan)\b/gi,
1027
- light: tokens("#f8f5ef", "#ece6da", "#26221b", "#6a6253", "#dcd3c2", "#5d6b2f", "#ffffff"),
1028
- dark: tokens("#15130f", "#201d17", "#efe9dc", "#aba28f", "#353026", "#b9c77a", "#171a08")
1089
+ light: tokens("#e9e0cf", "#f6f1e6", "#25211a", "#4c4639", "#cdc1a8", "#525f27", "#ffffff"),
1090
+ dark: tokens("#201d14", "#2d291d", "#f0e9d9", "#beb59c", "#433d2c", "#c3d184", "#171a08")
1029
1091
  },
1030
1092
  citrus: {
1031
1093
  id: "citrus",
1032
1094
  name: "Citrus",
1033
- description: "children, schools, community, playful guides",
1034
- look: "sunny yellow, bold orange",
1095
+ topic: "culture",
1096
+ description: "children, schools, community events, playful guides",
1097
+ look: "sunny yellow page, bold orange cover",
1035
1098
  fonts: "rounded",
1036
1099
  formality: 0.05,
1037
1100
  chart: "instrument",
1101
+ hero: "block",
1038
1102
  keywords: /\b(kids?|children|school|classroom|play|fun|games?|party|club|camp|volunteers?|community|activities|learn\w*)\b/gi,
1039
- light: tokens("#fffdf2", "#fbf3c9", "#1f1a05", "#6b6130", "#eee2a6", "#b84a00", "#ffffff"),
1040
- dark: tokens("#151302", "#211e08", "#fdf8d8", "#bdb37a", "#37320f", "#ffd23f", "#1c1600")
1103
+ light: tokens("#ffe98a", "#fff8d6", "#1f1900", "#564c14", "#efcf4c", "#9e3400", "#ffffff"),
1104
+ dark: tokens("#1f1a02", "#302805", "#fff8d0", "#c7bb7c", "#4a3f0c", "#ffd23f", "#1c1600")
1041
1105
  },
1042
1106
  crimson: {
1043
1107
  id: "crimson",
1044
1108
  name: "Crimson",
1109
+ topic: "official",
1045
1110
  description: "news, journalism, press releases, politics",
1046
- look: "newsprint white, strong red",
1111
+ look: "newsprint white, red masthead",
1047
1112
  fonts: "gazette",
1048
1113
  formality: 0.85,
1049
1114
  chart: "flat",
1115
+ hero: "block",
1050
1116
  keywords: /\b(news|report(ed|er|ing)?|press release|journalis\w+|election|government|minister|breaking|investigation|headline|spokesperson|announced)\b/gi,
1051
- light: tokens("#ffffff", "#f6f2f2", "#120a0a", "#5f5252", "#e6dcdc", "#c1121f", "#ffffff"),
1052
- dark: tokens("#0f0a0a", "#1b1313", "#f7efef", "#b5a3a3", "#2e2121", "#ff5a63", "#1f0406")
1117
+ light: tokens("#ffffff", "#f4eded", "#110808", "#5a4c4c", "#dbcaca", "#ad0f1b", "#ffffff"),
1118
+ dark: tokens("#120909", "#211313", "#f8efef", "#b9a6a6", "#3a2626", "#ff6b73", "#170204")
1053
1119
  },
1054
1120
  slate: {
1055
1121
  id: "slate",
1056
1122
  name: "Slate",
1123
+ topic: "official",
1057
1124
  description: "operations manuals, industrial reports, safety procedures",
1058
- look: "steel grey, safety orange",
1125
+ look: "steel grey, safety orange cover, hazard yellow",
1059
1126
  fonts: "slab",
1060
1127
  formality: 0.75,
1061
1128
  chart: "flat",
1129
+ hero: "block",
1062
1130
  keywords: /\b(manual|procedure|maintenance|safety|inspection|operations?|runbook|checklist|equipment|construction|logistics|warehouse|incident)\b/gi,
1063
- light: tokens("#f4f6f7", "#e5eaed", "#131c22", "#4d5c66", "#cfd8de", "#b4470b", "#ffffff"),
1064
- dark: tokens("#0d1215", "#161d22", "#e3eaee", "#93a2ab", "#26313a", "#ff9248", "#1e0d02")
1131
+ light: tokens("#dfe4e8", "#f2f5f7", "#121b21", "#3c4a53", "#bac6cd", "#9a3a07", "#ffffff", "#ffd400", "#121b21"),
1132
+ dark: tokens("#12181c", "#1d262c", "#e5ecf0", "#a4b2bb", "#313e47", "#ff9248", "#1e0d02", "#ffd400", "#12181c")
1065
1133
  },
1066
1134
  lagoon: {
1067
1135
  id: "lagoon",
1068
1136
  name: "Lagoon",
1069
- description: "healthcare, medicine, patient information, wellbeing",
1070
- look: "white and aqua, calm teal",
1137
+ topic: "wellbeing",
1138
+ description: "healthcare, medicine, patient information, fitness, wellbeing",
1139
+ look: "aqua page, calm teal, coral",
1071
1140
  fonts: "modern",
1072
1141
  formality: 0.45,
1073
1142
  chart: "instrument",
1143
+ hero: "wash",
1074
1144
  keywords: /\b(health\w*|medical|patients?|clinic\w*|treatment|symptoms?|doctor|nurse|therapy|wellness|wellbeing|diagnos\w+|care|vaccine)\b/gi,
1075
- light: tokens("#f5fbfb", "#e2f3f3", "#0b2226", "#46666b", "#c8e2e3", "#0a7480", "#ffffff"),
1076
- dark: tokens("#06161a", "#0d2126", "#e0f3f4", "#8db4b9", "#17363d", "#4fd4df", "#031a1d")
1145
+ light: tokens("#d6f0f1", "#f3fbfb", "#08242a", "#305258", "#acd9dc", "#086673", "#ffffff", "#ff7a66", "#08242a"),
1146
+ dark: tokens("#062a31", "#0c3a43", "#e2f6f7", "#a4cbd0", "#18525b", "#5fdbe6", "#031a1d", "#ff8a78", "#062a31")
1077
1147
  },
1078
1148
  plum: {
1079
1149
  id: "plum",
1080
1150
  name: "Plum",
1151
+ topic: "culture",
1081
1152
  description: "arts, music, theatre, film, exhibitions",
1082
- look: "soft mauve, deep plum",
1153
+ look: "orchid mauve page, deep plum cover, gold",
1083
1154
  fonts: "elegant",
1084
1155
  formality: 0.5,
1085
1156
  chart: "soft",
1157
+ hero: "block",
1086
1158
  keywords: /\b(art|artist|music|concert|theatre|theater|film|exhibition|gallery|opera|dance|festival|programme|culture|orchestra)\b/gi,
1087
- light: tokens("#fbf7fa", "#f1e6ef", "#24121f", "#6c5066", "#e2d0de", "#7a1f6b", "#ffffff"),
1088
- dark: tokens("#150b13", "#21131e", "#f5e8f1", "#b99ab2", "#372232", "#f0a6d8", "#2a0a22")
1159
+ light: tokens("#f0dcee", "#fbf3fa", "#24101f", "#5b3e55", "#dbbdd6", "#7a1f6b", "#ffffff", "#e2b23a", "#24101f"),
1160
+ dark: tokens("#221023", "#331a35", "#f7e9f3", "#c6a6bf", "#4d2b4e", "#f3addc", "#2a0a22", "#e2b23a", "#221023")
1089
1161
  },
1090
1162
  poster: {
1091
1163
  id: "poster",
1092
1164
  name: "Poster",
1093
- description: "events, sports, bold announcements, manifestos",
1094
- look: "black and white, electric blue",
1165
+ topic: "culture",
1166
+ description: "sports, tournaments, events, bold announcements, manifestos",
1167
+ look: "stark black and white, electric blue block, neon yellow",
1095
1168
  fonts: "poster",
1096
1169
  formality: 1,
1097
1170
  chart: "flat",
1171
+ hero: "block",
1098
1172
  keywords: /\b(event|tickets?|match|league|team|championship|tournament|race|drop|lineup|kick-?off|season|score|win)\b/gi,
1099
- light: tokens("#ffffff", "#f0f0f0", "#000000", "#555555", "#d9d9d9", "#1a3cff", "#ffffff"),
1100
- dark: tokens("#000000", "#141414", "#ffffff", "#a8a8a8", "#2b2b2b", "#e8ff3a", "#101400")
1173
+ light: tokens("#ffffff", "#efefef", "#000000", "#4d4d4d", "#111111", "#1a3cff", "#ffffff", "#e8ff3a", "#000000"),
1174
+ dark: tokens("#000000", "#151515", "#ffffff", "#b0b0b0", "#5a5a5a", "#e8ff3a", "#101400", "#1a3cff", "#ffffff")
1101
1175
  },
1102
1176
  espresso: {
1103
1177
  id: "espresso",
1104
1178
  name: "Espresso",
1179
+ topic: "lifestyle",
1105
1180
  description: "food, recipes, coffee, restaurants, small makers",
1106
- look: "cream, coffee brown, caramel",
1181
+ look: "latte page, dark roast cover, caramel",
1107
1182
  fonts: "slab",
1108
1183
  formality: 0.5,
1109
1184
  chart: "flat",
1185
+ hero: "ink",
1110
1186
  keywords: /\b(recipe|food|restaurant|cook\w*|bak\w+|coffee|cafe|menu|ingredients?|wine|taste|kitchen|dinner|chef|flavou?r)\b/gi,
1111
- light: tokens("#f8f1e9", "#eee0d0", "#2a1a10", "#6f5646", "#dfcbb7", "#8b4a12", "#ffffff"),
1112
- dark: tokens("#17100b", "#231912", "#f3e6d8", "#b79f8c", "#3a2a1f", "#e9a763", "#241204")
1187
+ light: tokens("#ecdcc6", "#f8efe2", "#2a180d", "#574031", "#d5bea1", "#8a4310", "#ffffff"),
1188
+ dark: tokens("#1f130b", "#2e1e13", "#f5e8d9", "#c1a994", "#46311f", "#ecab66", "#241204")
1113
1189
  },
1114
1190
  console: {
1115
1191
  id: "console",
1116
1192
  name: "Console",
1117
- description: "changelogs, release notes, security write-ups, logs",
1118
- look: "black screen, phosphor green",
1193
+ topic: "technology",
1194
+ description: "changelogs, release notes, incident reports, security write-ups, logs",
1195
+ look: "black screen, phosphor green, amber",
1119
1196
  fonts: "mono",
1120
1197
  formality: 0.95,
1121
1198
  chart: "linework",
1199
+ hero: "ink",
1122
1200
  keywords: /\b(changelog|release notes|patch|exploit|vulnerabilit\w+|cve|payload|shell|kernel|stack trace|commit|binary|ctf|debug\w*)\b/gi,
1123
- light: tokens("#f7f9f4", "#e8eee0", "#101a0e", "#4c5f48", "#d0dcc6", "#1f7a1f", "#ffffff"),
1124
- dark: tokens("#050a05", "#0c140c", "#d7f5d0", "#86a880", "#1a2a1a", "#5cf25c", "#021002")
1201
+ light: tokens("#e8f0e1", "#f5f9f1", "#0c160b", "#40543b", "#c2d3b6", "#17701a", "#ffffff", "#ffb000", "#0c160b"),
1202
+ dark: tokens("#030803", "#0b150b", "#d7f5d0", "#88aa82", "#1d331d", "#5cf25c", "#021002", "#ffb000", "#030803")
1125
1203
  }
1126
1204
  };
1127
1205
  var themeList = Object.values(themes);
@@ -1287,7 +1365,7 @@ var fontPairings = {
1287
1365
  };
1288
1366
  var fontPairingList = Object.values(fontPairings);
1289
1367
  function describeTheme(theme) {
1290
- return `${theme.description}; ${theme.look}; ${fontPairings[theme.fonts].look}`;
1368
+ return theme.description;
1291
1369
  }
1292
1370
  function themeChoice(id) {
1293
1371
  const theme = themes[id];
@@ -1371,10 +1449,11 @@ async function judgeDocument(plan, prose, classify, options = {}) {
1371
1449
  })
1372
1450
  );
1373
1451
  };
1374
- attempt(
1452
+ if (!options.skipTheme) attempt(
1375
1453
  "theme",
1376
1454
  {
1377
- state: documentDigest(plan, prose),
1455
+ state: documentDigest(plan, prose) + (options.context ? `
1456
+ Written in answer to: ${options.context.replace(/\s+/g, " ").slice(0, 300)}` : ""),
1378
1457
  questions: { theme: { type: "choice", criteria: Object.fromEntries(themeList.map((t) => [t.id, describeTheme(t)])) } }
1379
1458
  },
1380
1459
  ({ theme }) => {
@@ -1392,7 +1471,7 @@ async function judgeDocument(plan, prose, classify, options = {}) {
1392
1471
  }
1393
1472
  );
1394
1473
  const image = plan.hero.image;
1395
- if (image) {
1474
+ if (image && !options.themeOnly) {
1396
1475
  attempt(
1397
1476
  "hero",
1398
1477
  {
@@ -1419,7 +1498,7 @@ async function judgeDocument(plan, prose, classify, options = {}) {
1419
1498
  }
1420
1499
  const tables = plan.sections.flatMap(
1421
1500
  (section) => section.blocks.flatMap((block) => block.kind === "cards" ? block.items.flatMap((item) => item.blocks) : [block]).flatMap((block) => block.kind === "data" ? [{ section, block }] : [])
1422
- ).filter(({ block }) => block.viz.candidates.length > 1).slice(0, options.maxTables ?? 8);
1501
+ ).filter(({ block }) => block.viz.candidates.length > 1).slice(0, options.themeOnly ? 0 : options.maxTables ?? 8);
1423
1502
  for (const { section, block } of tables) {
1424
1503
  const { columns, rows } = block.table;
1425
1504
  const { viz } = block;
@@ -1457,8 +1536,12 @@ ${lines.join("\n")}`,
1457
1536
  return judgements;
1458
1537
  }
1459
1538
  export {
1539
+ BlockSplitter,
1540
+ CHAT_INSTRUCTIONS,
1460
1541
  buildTableModel,
1542
+ chatCompletionsUrl,
1461
1543
  collectImageUrls,
1544
+ createChat,
1462
1545
  createClassifier,
1463
1546
  describeTheme,
1464
1547
  documentDigest,
@@ -1473,9 +1556,13 @@ export {
1473
1556
  parseNumber,
1474
1557
  planDocument,
1475
1558
  planViz,
1559
+ settledMarkdown,
1560
+ sortReply,
1476
1561
  themeChoice,
1477
1562
  themeList,
1563
+ themeTopics,
1478
1564
  themes,
1565
+ wantsContent,
1479
1566
  withVizKind
1480
1567
  };
1481
1568
  //# sourceMappingURL=core.mjs.map