@resumekit/schema 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/template.ts CHANGED
@@ -1053,35 +1053,41 @@ export type ResumeEdits = z.infer<typeof ResumeEditsSchema>;
1053
1053
  export const DOCUMENT_FONTS = {
1054
1054
  helvetica: {
1055
1055
  name: 'Helvetica',
1056
+ category: 'sans',
1056
1057
  supplied: 'TeX Gyre Heros',
1057
1058
  stack:
1058
1059
  "'TeX Gyre Heros', 'Helvetica Neue', Helvetica, Arial, 'Liberation Sans', sans-serif",
1059
1060
  },
1060
1061
  arial: {
1061
1062
  name: 'Arial',
1063
+ category: 'sans',
1062
1064
  supplied: 'Arimo',
1063
1065
  stack:
1064
1066
  "Arimo, Arial, 'Helvetica Neue', Helvetica, 'Liberation Sans', sans-serif",
1065
1067
  },
1066
1068
  calibri: {
1067
1069
  name: 'Calibri',
1070
+ category: 'sans',
1068
1071
  supplied: 'Carlito',
1069
1072
  stack:
1070
1073
  "Carlito, Calibri, Candara, Segoe, 'Segoe UI', Optima, Arial, sans-serif",
1071
1074
  },
1072
1075
  georgia: {
1073
1076
  name: 'Georgia',
1077
+ category: 'serif',
1074
1078
  supplied: 'Gelasio',
1075
1079
  stack: "Gelasio, Georgia, Cambria, 'Times New Roman', Times, serif",
1076
1080
  },
1077
1081
  garamond: {
1078
1082
  name: 'Garamond',
1083
+ category: 'serif',
1079
1084
  supplied: 'EB Garamond',
1080
1085
  stack:
1081
1086
  "'EB Garamond', Garamond, Baskerville, 'Baskerville Old Face', 'Times New Roman', serif",
1082
1087
  },
1083
1088
  times: {
1084
1089
  name: 'Times',
1090
+ category: 'serif',
1085
1091
  supplied: 'Tinos',
1086
1092
  stack: "Tinos, 'Times New Roman', Times, Georgia, serif",
1087
1093
  },
@@ -1101,29 +1107,157 @@ export const DOCUMENT_FONTS = {
1101
1107
  */
1102
1108
  lato: {
1103
1109
  name: 'Lato',
1110
+ category: 'sans',
1104
1111
  supplied: 'Lato',
1105
1112
  stack: "Lato, 'Segoe UI', Candara, Optima, Calibri, sans-serif",
1106
1113
  },
1107
1114
  condensed: {
1108
1115
  name: 'Roboto Condensed',
1116
+ category: 'sans',
1109
1117
  supplied: 'Roboto Condensed',
1110
1118
  stack:
1111
1119
  "'Roboto Condensed', 'Arial Narrow', 'Helvetica Neue Condensed', 'Liberation Sans Narrow', sans-serif",
1112
1120
  },
1113
1121
  ptserif: {
1114
1122
  name: 'PT Serif',
1123
+ category: 'serif',
1115
1124
  supplied: 'PT Serif',
1116
1125
  stack: "'PT Serif', Charter, Cambria, Georgia, 'Times New Roman', serif",
1117
1126
  },
1118
1127
  bitter: {
1119
1128
  name: 'Bitter',
1129
+ category: 'slab',
1120
1130
  supplied: 'Bitter',
1121
1131
  stack:
1122
1132
  "Bitter, 'Roboto Slab', Rockwell, 'Courier New', Cambria, Georgia, serif",
1123
1133
  },
1134
+ /*
1135
+ * The wider catalog. Popular open faces, so a candidate can find the one they
1136
+ * have in mind rather than the nearest of ten. Each is supplied in the same
1137
+ * four styles, and each stack degrades to its own register.
1138
+ */
1139
+ inter: {
1140
+ name: 'Inter',
1141
+ category: 'sans',
1142
+ supplied: 'Inter',
1143
+ stack: "Inter, 'Helvetica Neue', Arial, sans-serif",
1144
+ },
1145
+ opensans: {
1146
+ name: 'Open Sans',
1147
+ category: 'sans',
1148
+ supplied: 'Open Sans',
1149
+ stack: "'Open Sans', 'Segoe UI', Arial, sans-serif",
1150
+ },
1151
+ montserrat: {
1152
+ name: 'Montserrat',
1153
+ category: 'sans',
1154
+ supplied: 'Montserrat',
1155
+ stack: "Montserrat, 'Century Gothic', Arial, sans-serif",
1156
+ },
1157
+ plexsans: {
1158
+ name: 'IBM Plex Sans',
1159
+ category: 'sans',
1160
+ supplied: 'IBM Plex Sans',
1161
+ stack: "'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",
1162
+ },
1163
+ worksans: {
1164
+ name: 'Work Sans',
1165
+ category: 'sans',
1166
+ supplied: 'Work Sans',
1167
+ stack: "'Work Sans', 'Helvetica Neue', Arial, sans-serif",
1168
+ },
1169
+ nunitosans: {
1170
+ name: 'Nunito Sans',
1171
+ category: 'sans',
1172
+ supplied: 'Nunito Sans',
1173
+ stack: "'Nunito Sans', 'Segoe UI', Arial, sans-serif",
1174
+ },
1175
+ dmsans: {
1176
+ name: 'DM Sans',
1177
+ category: 'sans',
1178
+ supplied: 'DM Sans',
1179
+ stack: "'DM Sans', 'Helvetica Neue', Arial, sans-serif",
1180
+ },
1181
+ firasans: {
1182
+ name: 'Fira Sans',
1183
+ category: 'sans',
1184
+ supplied: 'Fira Sans',
1185
+ stack: "'Fira Sans', 'Segoe UI', Arial, sans-serif",
1186
+ },
1187
+ librefranklin: {
1188
+ name: 'Libre Franklin',
1189
+ category: 'sans',
1190
+ supplied: 'Libre Franklin',
1191
+ stack: "'Libre Franklin', 'Franklin Gothic', Arial, sans-serif",
1192
+ },
1193
+ notosans: {
1194
+ name: 'Noto Sans',
1195
+ category: 'sans',
1196
+ supplied: 'Noto Sans',
1197
+ stack: "'Noto Sans', 'Segoe UI', Arial, sans-serif",
1198
+ },
1199
+ lora: {
1200
+ name: 'Lora',
1201
+ category: 'serif',
1202
+ supplied: 'Lora',
1203
+ stack: "Lora, Georgia, 'Times New Roman', serif",
1204
+ },
1205
+ sourceserif: {
1206
+ name: 'Source Serif',
1207
+ category: 'serif',
1208
+ supplied: 'Source Serif 4',
1209
+ stack: "'Source Serif 4', Georgia, 'Times New Roman', serif",
1210
+ },
1211
+ plexserif: {
1212
+ name: 'IBM Plex Serif',
1213
+ category: 'serif',
1214
+ supplied: 'IBM Plex Serif',
1215
+ stack: "'IBM Plex Serif', Georgia, 'Times New Roman', serif",
1216
+ },
1217
+ spectral: {
1218
+ name: 'Spectral',
1219
+ category: 'serif',
1220
+ supplied: 'Spectral',
1221
+ stack: 'Spectral, Garamond, Georgia, serif',
1222
+ },
1223
+ playfair: {
1224
+ name: 'Playfair Display',
1225
+ category: 'serif',
1226
+ supplied: 'Playfair Display',
1227
+ stack: "'Playfair Display', Didot, Georgia, serif",
1228
+ },
1229
+ /* Template faces that are also worth picking: already shipped for a design. */
1230
+ roboto: {
1231
+ name: 'Roboto',
1232
+ category: 'sans',
1233
+ supplied: 'Roboto',
1234
+ stack: "Roboto, 'Helvetica Neue', Arial, sans-serif",
1235
+ },
1236
+ sourcesans: {
1237
+ name: 'Source Sans',
1238
+ category: 'sans',
1239
+ supplied: 'Source Sans 3',
1240
+ stack: "'Source Sans 3', 'Segoe UI', Arial, sans-serif",
1241
+ },
1242
+ raleway: {
1243
+ name: 'Raleway',
1244
+ category: 'sans',
1245
+ supplied: 'Raleway',
1246
+ stack: "Raleway, 'Century Gothic', Arial, sans-serif",
1247
+ },
1248
+ latinmodern: {
1249
+ name: 'Latin Modern (LaTeX)',
1250
+ category: 'serif',
1251
+ supplied: 'Latin Modern Roman',
1252
+ stack: "'Latin Modern Roman', 'Computer Modern', 'Times New Roman', serif",
1253
+ },
1124
1254
  } as const;
1125
1255
 
1126
1256
  export type DocumentFontId = keyof typeof DOCUMENT_FONTS;
1257
+
1258
+ /** How a picker groups the typefaces, in the order it shows them. */
1259
+ export const FONT_CATEGORIES = ['sans', 'serif', 'slab'] as const;
1260
+ export type FontCategory = (typeof FONT_CATEGORIES)[number];
1127
1261
  export const DocumentFontIdSchema = z.enum(
1128
1262
  Object.keys(DOCUMENT_FONTS) as [DocumentFontId, ...DocumentFontId[]],
1129
1263
  );
@@ -1142,6 +1276,21 @@ export const INK_COLORS = {
1142
1276
  maroon: { name: 'Maroon', hex: '#6b2434' },
1143
1277
  forest: { name: 'Forest', hex: '#1f4433' },
1144
1278
  grey: { name: 'Grey', hex: '#5a5a5a' },
1279
+ /*
1280
+ * The wider palette. Same rule as the first six: every ink holds at least
1281
+ * 4.5:1 against white (WCAG AA for body text; these all clear 8:1), so a
1282
+ * document set in any of them stays readable on paper, in greyscale and in
1283
+ * an ATS preview. `template.spec.ts` asserts the contrast, so a lighter ink
1284
+ * cannot be added.
1285
+ */
1286
+ charcoal: { name: 'Charcoal', hex: '#2e3236' },
1287
+ cobalt: { name: 'Cobalt', hex: '#1d4a91' },
1288
+ indigo: { name: 'Indigo', hex: '#2f3878' },
1289
+ teal: { name: 'Teal', hex: '#0f5257' },
1290
+ olive: { name: 'Olive', hex: '#404a1c' },
1291
+ plum: { name: 'Plum', hex: '#4e2a5a' },
1292
+ rust: { name: 'Rust', hex: '#7c3416' },
1293
+ brown: { name: 'Brown', hex: '#57382a' },
1145
1294
  } as const;
1146
1295
 
1147
1296
  export type InkId = keyof typeof INK_COLORS;
@@ -1317,6 +1466,28 @@ export const SCALE_MAX = 1.2;
1317
1466
  export const SCALE_STEP = 0.05;
1318
1467
  export const SCALE_DEFAULT = 1;
1319
1468
 
1469
+ /**
1470
+ * Sizes for one role of the document — the name, the section headings, the body
1471
+ * text — as a multiplier on what the template (and the overall scale) already
1472
+ * set for that role. Bounded and stepped like the scale, so there is still no
1473
+ * free numeric size; absent means the template's own size for the role.
1474
+ */
1475
+ export const ROLE_SIZE_MIN = 0.8;
1476
+ export const ROLE_SIZE_MAX = 1.3;
1477
+ export const ROLE_SIZE_STEP = 0.05;
1478
+ export const ROLE_SIZE_DEFAULT = 1;
1479
+ export const DOCUMENT_ROLES = ['name', 'heading', 'body'] as const;
1480
+ export type DocumentRole = (typeof DOCUMENT_ROLES)[number];
1481
+
1482
+ /** Round a role size onto its step, within its bounds. */
1483
+ export function normalizeRoleSize(value: number): number {
1484
+ const stepped = Math.round(value / ROLE_SIZE_STEP) * ROLE_SIZE_STEP;
1485
+ const clamped = Math.min(ROLE_SIZE_MAX, Math.max(ROLE_SIZE_MIN, stepped));
1486
+ return Number(clamped.toFixed(2));
1487
+ }
1488
+
1489
+ const RoleSizeSchema = z.number().min(ROLE_SIZE_MIN).max(ROLE_SIZE_MAX);
1490
+
1320
1491
  /** Round to the nearest representable scale, clamped to the bounds. */
1321
1492
  export function normalizeScale(value: number): number {
1322
1493
  const stepped = Math.round(value / SCALE_STEP) * SCALE_STEP;
@@ -1325,6 +1496,67 @@ export function normalizeScale(value: number): number {
1325
1496
  return Number(clamped.toFixed(2));
1326
1497
  }
1327
1498
 
1499
+ /**
1500
+ * How far apart the letters of the document's text sit — an override of the
1501
+ * template's tracking, chosen from presets, never a free number.
1502
+ *
1503
+ * Absent means the template's own tracking, which is what every stored
1504
+ * document has. Headings keep the template's tracking either way: it is part of
1505
+ * how a heading is drawn (an uppercase rule is tracked open on purpose), and
1506
+ * {@link HEADING_CASES} owns it when the candidate changes the heading's case.
1507
+ */
1508
+ export const LETTER_SPACINGS = {
1509
+ tight: { name: 'Tight', em: -0.01 },
1510
+ wide: { name: 'Wide', em: 0.02 },
1511
+ } as const;
1512
+ export type LetterSpacingId = keyof typeof LETTER_SPACINGS;
1513
+ export const LetterSpacingIdSchema = z.enum(
1514
+ Object.keys(LETTER_SPACINGS) as [LetterSpacingId, ...LetterSpacingId[]],
1515
+ );
1516
+
1517
+ /**
1518
+ * The distance between lines of the document's text, as a unitless line height
1519
+ * from presets. Absent means the template's own leading. Headings keep theirs.
1520
+ */
1521
+ export const LINE_HEIGHTS = {
1522
+ compact: { name: 'Compact', value: 1.15 },
1523
+ relaxed: { name: 'Relaxed', value: 1.4 },
1524
+ airy: { name: 'Airy', value: 1.55 },
1525
+ } as const;
1526
+ export type LineHeightId = keyof typeof LINE_HEIGHTS;
1527
+ export const LineHeightIdSchema = z.enum(
1528
+ Object.keys(LINE_HEIGHTS) as [LineHeightId, ...LineHeightId[]],
1529
+ );
1530
+
1531
+ /**
1532
+ * How section headings are cased. A presentation of the heading, never its
1533
+ * text: the stored heading is unchanged, so copy-out and ATS extraction read
1534
+ * what the candidate wrote. Absent means the template's own casing.
1535
+ */
1536
+ export const HEADING_CASES = {
1537
+ normal: { name: 'As written' },
1538
+ upper: { name: 'Uppercase' },
1539
+ smallcaps: { name: 'Small caps' },
1540
+ } as const;
1541
+ export type HeadingCaseId = keyof typeof HEADING_CASES;
1542
+ export const HeadingCaseIdSchema = z.enum(
1543
+ Object.keys(HEADING_CASES) as [HeadingCaseId, ...HeadingCaseId[]],
1544
+ );
1545
+
1546
+ /**
1547
+ * How heavy section headings are. Two weights, because every font in
1548
+ * {@link DOCUMENT_FONTS} ships both, so no choice falls back to a synthesised
1549
+ * weight. Absent means the template's own weight.
1550
+ */
1551
+ export const HEADING_WEIGHTS = {
1552
+ regular: { name: 'Regular', weight: 400 },
1553
+ bold: { name: 'Bold', weight: 700 },
1554
+ } as const;
1555
+ export type HeadingWeightId = keyof typeof HEADING_WEIGHTS;
1556
+ export const HeadingWeightIdSchema = z.enum(
1557
+ Object.keys(HEADING_WEIGHTS) as [HeadingWeightId, ...HeadingWeightId[]],
1558
+ );
1559
+
1328
1560
  /**
1329
1561
  * How the whole document is set. Absent means the template's own defaults — a
1330
1562
  * resume nobody has styled renders exactly as the template defines it.
@@ -1351,6 +1583,27 @@ export const DocumentStyleSchema = z.object({
1351
1583
  accent: InkIdSchema.optional(),
1352
1584
  /** Absent means the template's own rhythm — see {@link DENSITIES}. */
1353
1585
  density: DensityIdSchema.optional(),
1586
+ /*
1587
+ * The typographic controls a word processor offers, each as a preset over
1588
+ * the template rather than a free value, and each absent unless chosen — so
1589
+ * a document that sets none renders exactly as the template defines it.
1590
+ */
1591
+ /** Letter spacing of the text — see {@link LETTER_SPACINGS}. */
1592
+ tracking: LetterSpacingIdSchema.optional(),
1593
+ /** Line height of the text — see {@link LINE_HEIGHTS}. */
1594
+ leading: LineHeightIdSchema.optional(),
1595
+ /** The typeface of the name and section headings, from the same vetted set. */
1596
+ headingFont: DocumentFontIdSchema.optional(),
1597
+ /** How section headings are cased — see {@link HEADING_CASES}. */
1598
+ headingCase: HeadingCaseIdSchema.optional(),
1599
+ /** How heavy section headings are — see {@link HEADING_WEIGHTS}. */
1600
+ headingWeight: HeadingWeightIdSchema.optional(),
1601
+ /** The name's size, over the template's — see {@link ROLE_SIZE_MIN}. */
1602
+ nameSize: RoleSizeSchema.optional(),
1603
+ /** The section headings' size, over the template's. */
1604
+ headingSize: RoleSizeSchema.optional(),
1605
+ /** The body text's size, over the template's. */
1606
+ bodySize: RoleSizeSchema.optional(),
1354
1607
  });
1355
1608
  export type DocumentStyle = z.infer<typeof DocumentStyleSchema>;
1356
1609
 
@@ -1358,9 +1611,27 @@ export type DocumentStyle = z.infer<typeof DocumentStyleSchema>;
1358
1611
  export const FieldAlignSchema = z.enum(['left', 'center', 'right']);
1359
1612
  export type FieldAlign = z.infer<typeof FieldAlignSchema>;
1360
1613
 
1614
+ /**
1615
+ * One step smaller or larger than the template sets the line. A step, not a
1616
+ * size: the template's proportions hold, so a stepped-up bullet still reads
1617
+ * smaller than a heading.
1618
+ */
1619
+ export const FIELD_STEPS = {
1620
+ smaller: { name: 'Smaller', factor: 0.9 },
1621
+ larger: { name: 'Larger', factor: 1.12 },
1622
+ } as const;
1623
+ export type FieldStepId = keyof typeof FIELD_STEPS;
1624
+ export const FieldStepSchema = z.enum(
1625
+ Object.keys(FIELD_STEPS) as [FieldStepId, ...FieldStepId[]],
1626
+ );
1627
+
1361
1628
  export const FieldFormatSchema = z.object({
1362
1629
  path: ResumeFieldPathSchema,
1363
1630
  bold: z.boolean().optional(),
1631
+ italic: z.boolean().optional(),
1632
+ underline: z.boolean().optional(),
1633
+ /** One step smaller or larger — see {@link FIELD_STEPS}. */
1634
+ step: FieldStepSchema.optional(),
1364
1635
  align: FieldAlignSchema.optional(),
1365
1636
  ink: InkIdSchema.optional(),
1366
1637
  /** Extra space above this field — the one place a section rule cannot reach. */
@@ -1386,6 +1657,9 @@ export type FieldFormat = z.infer<typeof FieldFormatSchema>;
1386
1657
  export function formatIsEmpty(format: FieldFormat): boolean {
1387
1658
  return (
1388
1659
  format.bold === undefined &&
1660
+ format.italic === undefined &&
1661
+ format.underline === undefined &&
1662
+ format.step === undefined &&
1389
1663
  format.align === undefined &&
1390
1664
  format.ink === undefined &&
1391
1665
  format.href === undefined &&
@@ -1438,12 +1712,7 @@ export const THEMES = {
1438
1712
  classic: {
1439
1713
  name: 'Classic',
1440
1714
  description: 'Serif and restrained',
1441
- style: {
1442
- font: 'times',
1443
- ink: 'ink',
1444
- accent: 'ink',
1445
- density: 'normal',
1446
- },
1715
+ style: { font: 'times', ink: 'ink', accent: 'ink', density: 'normal' },
1447
1716
  },
1448
1717
  modern: {
1449
1718
  name: 'Modern',
@@ -1458,21 +1727,100 @@ export const THEMES = {
1458
1727
  compact: {
1459
1728
  name: 'Compact',
1460
1729
  description: 'Tight, fits more',
1730
+ style: { font: 'arial', ink: 'ink', accent: 'grey', density: 'tight' },
1731
+ },
1732
+ academic: {
1733
+ name: 'Academic',
1734
+ description: 'Formal and sober',
1735
+ style: { font: 'georgia', ink: 'ink', accent: 'maroon', density: 'normal' },
1736
+ },
1737
+ minimal: {
1738
+ name: 'Minimal',
1739
+ description: 'Quiet, light headings',
1461
1740
  style: {
1462
- font: 'arial',
1463
- ink: 'ink',
1741
+ font: 'inter',
1742
+ ink: 'charcoal',
1464
1743
  accent: 'grey',
1744
+ density: 'roomy',
1745
+ headingWeight: 'regular',
1746
+ },
1747
+ },
1748
+ corporate: {
1749
+ name: 'Corporate',
1750
+ description: 'Clean and businesslike',
1751
+ style: {
1752
+ font: 'opensans',
1753
+ ink: 'slate',
1754
+ accent: 'cobalt',
1755
+ density: 'normal',
1756
+ headingCase: 'upper',
1757
+ },
1758
+ },
1759
+ tech: {
1760
+ name: 'Tech',
1761
+ description: 'Precise and compact',
1762
+ style: {
1763
+ font: 'plexsans',
1764
+ ink: 'charcoal',
1765
+ accent: 'teal',
1465
1766
  density: 'tight',
1767
+ headingFont: 'plexserif',
1466
1768
  },
1467
1769
  },
1468
- academic: {
1469
- name: 'Academic',
1470
- description: 'Formal and sober',
1770
+ boardroom: {
1771
+ name: 'Boardroom',
1772
+ description: 'Stately small capitals',
1773
+ style: {
1774
+ font: 'garamond',
1775
+ ink: 'ink',
1776
+ accent: 'navy',
1777
+ density: 'normal',
1778
+ headingCase: 'smallcaps',
1779
+ },
1780
+ },
1781
+ editorial: {
1782
+ name: 'Editorial',
1783
+ description: 'Warm magazine serif',
1784
+ style: {
1785
+ font: 'lora',
1786
+ ink: 'brown',
1787
+ accent: 'rust',
1788
+ density: 'normal',
1789
+ headingFont: 'montserrat',
1790
+ headingCase: 'upper',
1791
+ },
1792
+ },
1793
+ creative: {
1794
+ name: 'Creative',
1795
+ description: 'Expressive display headings',
1471
1796
  style: {
1472
- font: 'georgia',
1797
+ font: 'worksans',
1798
+ ink: 'charcoal',
1799
+ accent: 'plum',
1800
+ density: 'roomy',
1801
+ headingFont: 'playfair',
1802
+ },
1803
+ },
1804
+ fresh: {
1805
+ name: 'Fresh',
1806
+ description: 'Friendly and airy',
1807
+ style: {
1808
+ font: 'nunitosans',
1809
+ ink: 'slate',
1810
+ accent: 'forest',
1811
+ density: 'roomy',
1812
+ leading: 'relaxed',
1813
+ },
1814
+ },
1815
+ latex: {
1816
+ name: 'LaTeX',
1817
+ description: 'The look of a typeset paper',
1818
+ style: {
1819
+ font: 'latinmodern',
1473
1820
  ink: 'ink',
1474
- accent: 'maroon',
1821
+ accent: 'ink',
1475
1822
  density: 'normal',
1823
+ headingCase: 'smallcaps',
1476
1824
  },
1477
1825
  },
1478
1826
  } as const satisfies Record<
@@ -1486,21 +1834,44 @@ export const THEMES = {
1486
1834
  ink: InkId;
1487
1835
  accent: InkId;
1488
1836
  density: DensityId;
1837
+ headingFont?: DocumentFontId;
1838
+ headingCase?: HeadingCaseId;
1839
+ headingWeight?: HeadingWeightId;
1840
+ tracking?: LetterSpacingId;
1841
+ leading?: LineHeightId;
1489
1842
  };
1490
1843
  }
1491
1844
  >;
1492
1845
 
1846
+ /**
1847
+ * What a theme speaks to. Applying one clears all of these before setting its
1848
+ * own, so a heading case one theme chose does not leak into the next.
1849
+ */
1850
+ export const THEME_KEYS = [
1851
+ 'font',
1852
+ 'ink',
1853
+ 'accent',
1854
+ 'density',
1855
+ 'headingFont',
1856
+ 'headingCase',
1857
+ 'headingWeight',
1858
+ 'tracking',
1859
+ 'leading',
1860
+ ] as const satisfies readonly (keyof DocumentStyle)[];
1861
+
1493
1862
  export type ThemeId = keyof typeof THEMES;
1494
1863
 
1495
1864
  /**
1496
1865
  * Apply a theme, preserving what the theme does not speak to.
1497
1866
  *
1498
- * The size scale survives: it is how a candidate fits their resume on one page,
1867
+ * The size scale and the role sizes survive: they are how a candidate fits their resume on one page,
1499
1868
  * which is a decision about THEIR document rather than about its styling, and
1500
1869
  * silently resetting it would undo work a theme has no opinion about.
1501
1870
  */
1502
1871
  export function applyTheme(style: DocumentStyle, id: ThemeId): DocumentStyle {
1503
- return { ...style, ...THEMES[id].style };
1872
+ const kept: Record<string, unknown> = { ...style };
1873
+ for (const key of THEME_KEYS) delete kept[key];
1874
+ return { ...kept, ...THEMES[id].style } as DocumentStyle;
1504
1875
  }
1505
1876
 
1506
1877
  /** Extra space above one named section. */