@taprootio/site-authoring 0.56.0 → 0.60.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.
Files changed (60) hide show
  1. package/README.md +27 -12
  2. package/package.json +2 -2
  3. package/src/api.js +16 -0
  4. package/src/block-flow.js +4 -2
  5. package/src/changelog.json +99 -0
  6. package/src/chrome-additions.js +106 -0
  7. package/src/chrome-features.js +43 -10
  8. package/src/chrome-input.js +137 -30
  9. package/src/chrome-report.js +4 -2
  10. package/src/cli.js +56 -17
  11. package/src/content/button-styles.js +27 -0
  12. package/src/content/components.js +76 -10
  13. package/src/content/free-form-section-registry.json +9 -0
  14. package/src/content/free-form-sections.js +55 -16
  15. package/src/content/markdown.js +133 -56
  16. package/src/content/media-presentation.js +37 -0
  17. package/src/content/tiptap-prosemirror.ts +26 -10
  18. package/src/credentials.js +2 -1
  19. package/src/delivery-check.js +10 -2
  20. package/src/font-catalog.js +9 -6
  21. package/src/footer-content.js +1 -1
  22. package/src/footer-contract.js +3 -0
  23. package/src/footer-draft-hash.js +1 -0
  24. package/src/heading-outline.js +94 -6
  25. package/src/image-description-contract.js +5 -3
  26. package/src/image-description-write.js +26 -0
  27. package/src/index.js +1 -0
  28. package/src/output.js +2 -1
  29. package/src/page-structure-checks.js +14 -25
  30. package/src/placed-image-ids.js +42 -17
  31. package/src/presentation-reference.js +63 -18
  32. package/src/problems.js +147 -4
  33. package/src/reference-help.js +102 -57
  34. package/src/site-check-findings.js +2 -3
  35. package/src/site-check-rules.json +0 -1
  36. package/src/site-health-findings.js +7 -9
  37. package/src/site-health-image-checks.js +4 -1
  38. package/src/site-health-precheck.js +23 -6
  39. package/src/site-navigation-groups.js +16 -0
  40. package/src/status-warning-paints.js +175 -0
  41. package/src/template-token-reach.json +13 -18
  42. package/src/theme-proposals.js +143 -55
  43. package/src/theme-resolve.js +14 -1
  44. package/src/theme-validation.js +70 -38
  45. package/src/token-reach.js +20 -0
  46. package/src/typed-page-reference.js +10 -3
  47. package/src/typed-pages.js +7 -7
  48. package/src/verbs/changelog.js +23 -2
  49. package/src/verbs/delivery-check.js +43 -9
  50. package/src/verbs/media-images.js +4 -4
  51. package/src/verbs/pages-push.js +38 -32
  52. package/src/verbs/plan.js +28 -20
  53. package/src/verbs/pull.js +179 -24
  54. package/src/verbs/theme-push.js +59 -15
  55. package/src/verbs/theme-resolve.js +109 -11
  56. package/src/verbs/validate.js +97 -16
  57. package/src/workspace-check.js +4 -4
  58. package/src/workspace-context-usage.js +180 -0
  59. package/src/workspace.js +12 -0
  60. package/test/fixtures/default-site-theme.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { SiteAuthoringError } from "../errors.js";
2
+ import { problemsOf } from "../problems.js";
2
3
  import { isRecipeStepLinkHref, recipeStepUnsupportedContentMessage } from "../recipe-step-contract.js";
3
4
  import { readBlockquoteMetadata, validateBlockquoteMetadata } from "./blockquote-metadata.js";
4
5
  import {
@@ -97,7 +98,11 @@ function fail(code, construct, message, line, cause) {
97
98
  line === undefined ? message : `${message} (line ${line})`,
98
99
  { field: construct, cause },
99
100
  );
100
- if (line !== undefined) Object.defineProperty(error, "markdownLine", { value: line });
101
+ if (line !== undefined) {
102
+ Object.defineProperty(error, "markdownLine", { value: line });
103
+ // A lone refusal serializes only its own list, so the line must ride in it (TR01427).
104
+ error.withProblems([{ code: error.code, field: error.field, line, message: error.message }]);
105
+ }
101
106
  return error;
102
107
  }
103
108
 
@@ -156,7 +161,7 @@ function rejectFrontMatter(lines) {
156
161
  "front matter",
157
162
  "The Markdown source still carries a front-matter block. Strip it before converting: the page envelope "
158
163
  + "belongs to 'pages push', not to the body.",
159
- 1,
164
+ lines[0].number,
160
165
  );
161
166
  }
162
167
  if (text !== "" && !/^[A-Za-z_][A-Za-z0-9_-]*:/u.test(text)) return;
@@ -791,38 +796,52 @@ async function sectionHeaderAttrs(text, line, markdownContext) {
791
796
  }
792
797
  }
793
798
 
799
+ const recover = markdownContext.sectionProblems;
800
+ const failedImages = new Set();
794
801
  for (const [owner, field] of [["decoration", "image"], ["background", "image"], ["background", "portraitImage"]]) {
795
802
  if (isPlainObject(parsed[owner]) && Object.hasOwn(parsed[owner], field)) {
796
- parsed[owner] = {
797
- ...parsed[owner],
798
- [field]: await authoredImageField(
799
- parsed[owner][field],
800
- `/${owner}/${field}`,
801
- markdownContext,
802
- line,
803
- "section header",
804
- ),
805
- };
803
+ try {
804
+ parsed[owner] = {
805
+ ...parsed[owner],
806
+ [field]: await authoredImageField(
807
+ parsed[owner][field],
808
+ `/${owner}/${field}`,
809
+ markdownContext,
810
+ line,
811
+ "section header",
812
+ ),
813
+ };
814
+ } catch (error) {
815
+ if (recover === undefined || !(error instanceof SiteAuthoringError)) throw error;
816
+ const { [field]: _dropped, ...rest } = parsed[owner];
817
+ parsed[owner] = rest;
818
+ failedImages.add(`${owner}.${field}`);
819
+ recover.push({ ...error.problems[0], field: `${owner}.${field}` });
820
+ }
806
821
  }
807
822
  }
808
823
 
824
+ // A recovered image failure already reported the missing image, so the normalizer's own complaint is a duplicate.
825
+ const recordFindings = (owner, errors) => {
826
+ for (const finding of errors) {
827
+ if (failedImages.has(`${owner}.image`) && finding.path === `/attrs/${owner}/image`) continue;
828
+ const refusal = fail(finding.code, finding.path, finding.message, line.number);
829
+ if (recover === undefined) throw refusal;
830
+ recover.push(refusal.problems[0]);
831
+ }
832
+ };
833
+
809
834
  const normalizedDecoration = normalizeFreeFormSectionDecoration(
810
835
  parsed.decoration,
811
836
  "/attrs/decoration",
812
837
  );
813
- if (normalizedDecoration.errors.length > 0) {
814
- const [first] = normalizedDecoration.errors;
815
- throw fail(first.code, first.path, first.message, line.number);
816
- }
838
+ recordFindings("decoration", normalizedDecoration.errors);
817
839
 
818
840
  const normalizedBackground = normalizeFreeFormSectionBackground(
819
841
  parsed.background,
820
842
  "/attrs/background",
821
843
  );
822
- if (normalizedBackground.errors.length > 0) {
823
- const [first] = normalizedBackground.errors;
824
- throw fail(first.code, first.path, first.message, line.number);
825
- }
844
+ recordFindings("background", normalizedBackground.errors);
826
845
 
827
846
  return {
828
847
  ...(typeof context === "string" ? { context } : {}),
@@ -1369,11 +1388,8 @@ async function consumeParagraph(lines, start, context) {
1369
1388
  }
1370
1389
 
1371
1390
  const line = lines[start];
1372
- const inlineSource = context.recipeStepIssues === undefined ? undefined : {
1373
- lineStarts: [],
1374
- offset: 0,
1375
- issues: context.recipeStepIssues,
1376
- };
1391
+ // The line map is kept in every mode; only recipe steps also collect issues (`issues` is set).
1392
+ const inlineSource = { lineStarts: [], offset: 0, issues: context.recipeStepIssues };
1377
1393
  const joined = joinParagraphLines(collected, inlineSource?.lineStarts);
1378
1394
  const standalone = STANDALONE_IMAGE_RE.exec(joined);
1379
1395
  if (standalone) {
@@ -1577,8 +1593,13 @@ function sliceInlineSource(source, start) {
1577
1593
  return source === undefined ? undefined : { ...source, offset: source.offset + start };
1578
1594
  }
1579
1595
 
1596
+ /** Only recipe steps collect inline issues; any other source carries just the line map. */
1597
+ function isRecipeStepSource(source) {
1598
+ return source?.issues !== undefined;
1599
+ }
1600
+
1580
1601
  function reportInlineIssue(error, source) {
1581
- if (source === undefined) throw error;
1602
+ if (!isRecipeStepSource(source)) throw error;
1582
1603
  source.issues.push({
1583
1604
  line: error.markdownLine,
1584
1605
  message: error.message.replace(/ \(line \d+\)$/u, ""),
@@ -1683,9 +1704,9 @@ function parseInline(text, scan, lineNumber, marks, source) {
1683
1704
  reportInlineIssue(fail(
1684
1705
  CODES.markdownImage,
1685
1706
  "inline image",
1686
- source === undefined
1687
- ? "An image must stand alone in its own block; the document model has no inline image."
1688
- : recipeStepUnsupportedContentMessage("inlineImage"),
1707
+ isRecipeStepSource(source)
1708
+ ? recipeStepUnsupportedContentMessage("inlineImage")
1709
+ : "An image must stand alone in its own block; the document model has no inline image.",
1689
1710
  sourceLine,
1690
1711
  ), source);
1691
1712
  index = inlineImageEnd(text, index, scan, sourceLine);
@@ -1793,17 +1814,17 @@ function parseLink(text, index, scan, lineNumber, marks, source) {
1793
1814
  const destinationEnd = findDestinationEnd(text, textEnd + 2, scan, line);
1794
1815
  if (destinationEnd < 0) return undefined;
1795
1816
  const destination = text.slice(textEnd + 2, destinationEnd).trim();
1796
- const isAllowedDestination = source === undefined ? isSafeUrl : isRecipeStepLinkHref;
1797
- const before = source?.issues.length;
1817
+ const isAllowedDestination = isRecipeStepSource(source) ? isRecipeStepLinkHref : isSafeUrl;
1818
+ const before = source?.issues?.length;
1798
1819
  let refusal;
1799
1820
  if (marks.some((mark) => mark.type === "link")) {
1800
1821
  refusal = "Links cannot be nested.";
1801
1822
  } else if (destination.startsWith("<")) {
1802
1823
  refusal = "Pointy-bracket link destinations are outside the supported subset; write the URL directly.";
1803
1824
  } else if (/\s/u.test(destination)) {
1804
- refusal = source === undefined
1805
- ? "Link titles are outside the supported subset; the document model has nowhere to put one."
1806
- : "Use a plain link destination and put the title in attribute braces.";
1825
+ refusal = isRecipeStepSource(source)
1826
+ ? "Use a plain link destination and put the title in attribute braces."
1827
+ : "Link titles are outside the supported subset; the document model has nowhere to put one.";
1807
1828
  } else if (destination === "" || !isAllowedDestination(destination)) {
1808
1829
  refusal = "A link destination must be a safe HTTP(S), mailto, tel, non-protocol-relative root, fragment, query, or relative URL without backslashes or ASCII controls; the renderer drops an unsafe link and publishes only its text.";
1809
1830
  }
@@ -1814,12 +1835,30 @@ function parseLink(text, index, scan, lineNumber, marks, source) {
1814
1835
  const inner = text.slice(index + 1, textEnd);
1815
1836
  const innerMarks = refusal === undefined ? [...marks, { type: "link", attrs }] : marks;
1816
1837
  const nodes = parseInline(inner, scan, lineNumber, innerMarks, sliceInlineSource(source, index + 1));
1817
- if (nodes.length === 0 && before === source?.issues.length) {
1838
+ if (nodes.length === 0 && before === source?.issues?.length) {
1818
1839
  reportInlineIssue(fail(CODES.markdownLink, "link", "A link must have text.", line), source);
1819
1840
  }
1820
1841
  return { nodes, end: options ? options.end : destinationEnd + 1 };
1821
1842
  }
1822
1843
 
1844
+ /** Where the first attribute that is not a double-quoted name="value" pair starts in the braces, else the brace. */
1845
+ function malformedAttributeOffset(rest, recipeStep) {
1846
+ const close = rest.indexOf("}");
1847
+ if (close === -1) return 0;
1848
+ const body = rest.slice(1, close);
1849
+ const well = recipeStep ? /\s*[A-Za-z][\w-]*="[^"\\{}]*"/yu : /\s*(?:rel|target)="[^"\\{}]*"/yu;
1850
+ let at = 0;
1851
+ for (;;) {
1852
+ well.lastIndex = at;
1853
+ const found = well.exec(body);
1854
+ if (!found) break;
1855
+ at = well.lastIndex;
1856
+ }
1857
+ const rest2 = body.slice(at);
1858
+ const lead = rest2.length - rest2.trimStart().length;
1859
+ return rest2.trim() === "" ? 0 : 1 + at + lead;
1860
+ }
1861
+
1823
1862
  /**
1824
1863
  * The optional `{rel="sponsored nofollow" target="_blank"}` right after a
1825
1864
  * link's destination (TR01190), either attribute alone or both in any order.
@@ -1827,7 +1866,7 @@ function parseLink(text, index, scan, lineNumber, marks, source) {
1827
1866
  * formed; any other brace after a link stays literal text.
1828
1867
  */
1829
1868
  function parseLinkAttributes(text, from, lineNumber, source) {
1830
- const recipeStep = source !== undefined;
1869
+ const recipeStep = isRecipeStepSource(source);
1831
1870
  const rest = text.slice(from);
1832
1871
  const prefix = recipeStep ? /^\{\s*[A-Za-z][\w-]*\s*=/u : /^\{\s*(?:rel|target)\s*=/u;
1833
1872
  if (!prefix.test(rest)) return undefined;
@@ -1835,13 +1874,13 @@ function parseLinkAttributes(text, from, lineNumber, source) {
1835
1874
  : /^\{((?:\s*(?:rel|target)="[^"\\{}]*")+)\s*\}/u;
1836
1875
  const match = attributes.exec(rest);
1837
1876
  const pairs = match ? [...match[1].matchAll(/([A-Za-z][\w-]*)="([^"]*)"/gu)] : [];
1838
- if (!match || (!recipeStep && new Set(pairs.map(pair => pair[1])).size !== pairs.length)) {
1877
+ if (!match) {
1839
1878
  reportInlineIssue(fail(
1840
1879
  CODES.markdownLink,
1841
1880
  "link attributes",
1842
1881
  'Write a link\'s attributes right after it as {rel="nofollow" target="_blank"}: each at most once, '
1843
1882
  + "double-quoted. Escape a literal brace as \\{.",
1844
- inlineSourceLine(source, from, lineNumber),
1883
+ inlineSourceLine(source, from + malformedAttributeOffset(rest, recipeStep), lineNumber),
1845
1884
  ), source);
1846
1885
  return { attrs: {}, end: from + Math.max(0, rest.indexOf("}")) + 1 };
1847
1886
  }
@@ -2043,6 +2082,40 @@ export function assertConvertedDocument(document) {
2043
2082
  );
2044
2083
  }
2045
2084
 
2085
+ /**
2086
+ * One refusal for the recovered section problems and, when one stopped the conversion, that last error. The
2087
+ * top-level code, field and message are the first recovered problem's own (TR01427).
2088
+ */
2089
+ function sectionProblemsError(recovered, stopping) {
2090
+ const [first] = recovered;
2091
+ return new SiteAuthoringError(first.code, first.message, { field: first.field })
2092
+ .withProblems([...recovered, ...stopping]);
2093
+ }
2094
+
2095
+ /**
2096
+ * The checks every parsed document passes, in order; the first failure is returned, not thrown, so the
2097
+ * recovery path and the normal path share one list (TR01427). A recipe step skips them: it is a fragment.
2098
+ */
2099
+ function firstPostParseFailure(document) {
2100
+ if (!documentIsPresent(document)) {
2101
+ return fail(
2102
+ CODES.markdownEmpty,
2103
+ "document",
2104
+ "The Markdown source produced an empty page body. A page needs text, an image, a component block, or inline facts.",
2105
+ );
2106
+ }
2107
+ const columns = validateColumnsBody(document);
2108
+ if (columns.errors.length > 0) {
2109
+ return fail(CODES.markdownColumns, columns.errors[0].path, "The columns layout has invalid nesting or exceeds its structural limits.");
2110
+ }
2111
+ try {
2112
+ assertConvertedDocument(document);
2113
+ } catch (error) {
2114
+ return error;
2115
+ }
2116
+ return undefined;
2117
+ }
2118
+
2046
2119
  /**
2047
2120
  * Converts a Markdown document into a ProseMirror page body.
2048
2121
  *
@@ -2073,29 +2146,33 @@ export async function markdownToProseMirror(markdown, options = {}) {
2073
2146
  }
2074
2147
 
2075
2148
  const recipeStepIssues = options.recipeStep === true ? [] : undefined;
2076
- const lines = toLines(markdown, recipeStepIssues === undefined ? 1 : options.firstLine);
2149
+ // A page file's body starts below its front matter, so errors name the file's own lines (TR01427).
2150
+ const lines = toLines(markdown, options.firstLine ?? 1);
2077
2151
  if (recipeStepIssues === undefined) rejectFrontMatter(lines);
2078
- const content = await parseBlocks(
2079
- lines,
2080
- { resolveImage, scan: createScanBudget(), blockPlacement: "root", recipeStepIssues },
2081
- 0,
2082
- );
2152
+ const sectionProblems = options.recoverSectionProblems === true && recipeStepIssues === undefined ? [] : undefined;
2153
+ let content;
2154
+ try {
2155
+ content = await parseBlocks(
2156
+ lines,
2157
+ { resolveImage, scan: createScanBudget(), blockPlacement: "root", recipeStepIssues, sectionProblems },
2158
+ 0,
2159
+ );
2160
+ } catch (error) {
2161
+ if (sectionProblems?.length > 0 && error instanceof SiteAuthoringError) {
2162
+ throw sectionProblemsError(sectionProblems, problemsOf(error));
2163
+ }
2164
+ throw error;
2165
+ }
2083
2166
  const document = { type: "doc", content };
2167
+ const failure = recipeStepIssues === undefined ? firstPostParseFailure(document) : undefined;
2168
+ if (sectionProblems?.length > 0) {
2169
+ // The recovered sections still get every normal check, so one run reports all of it.
2170
+ throw sectionProblemsError(sectionProblems, failure === undefined ? [] : problemsOf(failure));
2171
+ }
2084
2172
  if (recipeStepIssues !== undefined) {
2085
2173
  recipeStepIssues.sort((left, right) => left.line - right.line);
2086
2174
  return { doc: document, recipeStepIssues };
2087
2175
  }
2088
- if (!documentIsPresent(document)) {
2089
- throw fail(
2090
- CODES.markdownEmpty,
2091
- "document",
2092
- "The Markdown source produced an empty page body. A page needs text, an image, a component block, or inline facts.",
2093
- );
2094
- }
2095
- const columns = validateColumnsBody(document);
2096
- if (columns.errors.length > 0) {
2097
- throw fail(CODES.markdownColumns, columns.errors[0].path, "The columns layout has invalid nesting or exceeds its structural limits.");
2098
- }
2099
- assertConvertedDocument(document);
2176
+ if (failure !== undefined) throw failure;
2100
2177
  return { doc: normalizeColumnsBody(document).body };
2101
2178
  }
@@ -27,6 +27,22 @@ export const DEFAULT_TIPTAP_IMAGE_BORDER_WIDTH_PX = 2;
27
27
  export const MEDIA_MAX_HEIGHT_PROPERTY = "--taproot-article-image-max-height";
28
28
  /** The custom property every bordered media block reads its border from. */
29
29
  export const MEDIA_BORDER_PROPERTY = "--esp-image-border";
30
+ /**
31
+ * The custom property a card grid or an image row holds its images' whole frame in.
32
+ * The images read it as their `border` shorthand, not through `--esp-image-border`,
33
+ * because the page shell sets that one on each free-form image and would win (TR01421).
34
+ */
35
+ export const MEDIA_FRAME_PROPERTY = "--taproot-media-border";
36
+ /**
37
+ * The frame's width alone, set beside the frame. A framed image is `content-box` so its aspect ratio and its
38
+ * raster stay whole inside the frame, and a row caps its width with twice this width added (TR01421).
39
+ */
40
+ export const MEDIA_FRAME_WIDTH_PROPERTY = "--taproot-media-border-width";
41
+ /** The space a frame takes from an image's `inline-size` and `block-size`, in the image's own units. */
42
+ // Clamped at zero: a negative calc() width draws no border, so it must not widen the image either.
43
+ export const MEDIA_FRAME_INSET = `calc(2 * max(0px, var(${MEDIA_FRAME_WIDTH_PROPERTY}, 0px)))`;
44
+ /** The declaration card and row images use: the host's frame, or none when it sets none. */
45
+ export const MEDIA_FRAME_DECLARATION = `border: var(${MEDIA_FRAME_PROPERTY}, none)`;
30
46
  /** A number, or text read as one (a cleared field reads as 0); anything else is not a number. */
31
47
  function optionNumber(value) {
32
48
  if (typeof value === "number")
@@ -70,6 +86,7 @@ const CSS_CALC_RE = new RegExp(`^calc\\(\\s*${CSS_CALC_TERM}(?:\\s*[+\\-*/]\\s*$
70
86
  * unitless `0`, a non-negative length, `var(--token)`, `calc(...)` of those
71
87
  * terms, and — when `allowNone` is set — the `none` keyword (max-height).
72
88
  * Returns the trimmed value, or null when invalid or set to the site default.
89
+ * `percent: false` refuses a percentage anywhere in the value, `calc()` included.
73
90
  */
74
91
  export function normalizeCssLengthOverride(value, options) {
75
92
  if (typeof value !== "string")
@@ -81,6 +98,8 @@ export function normalizeCssLengthOverride(value, options) {
81
98
  return trimmed;
82
99
  if (options?.allowNone && trimmed.toLowerCase() === "none")
83
100
  return "none";
101
+ if (options?.percent === false && trimmed.includes("%"))
102
+ return null;
84
103
  if (CSS_LENGTH_RE.test(trimmed))
85
104
  return trimmed;
86
105
  if (CSS_VAR_RE.test(trimmed))
@@ -97,6 +116,14 @@ export function normalizeMaxHeightOverride(value) {
97
116
  export function normalizeBorderWidthOverride(value) {
98
117
  return normalizeCssLengthOverride(value);
99
118
  }
119
+ /**
120
+ * The validated `mediaBorderWidth` of a hero, call to action, card grid or image row, or null for the default.
121
+ * A percentage is refused: `border-width` takes none, and the frame inset in a `calc()` would size by the
122
+ * image's own width instead of the border. Image and video `borderWidth` keep the older grammar (TR01421).
123
+ */
124
+ export function normalizeFrameWidthOverride(value) {
125
+ return normalizeCssLengthOverride(value, { percent: false });
126
+ }
100
127
  /** CSS value for the border hook given a width; zero collapses to none. */
101
128
  export function imageBorderValue(width) {
102
129
  return /^0(?:\.0+)?(?:[a-z%]+)?$/i.test(width) ? "none" : `${width} solid var(--esp-color-border)`;
@@ -121,3 +148,13 @@ export function mediaOverrideStyleParts(overrides) {
121
148
  parts.push(`${MEDIA_BORDER_PROPERTY}: ${imageBorderValue(borderWidth)}`);
122
149
  return parts;
123
150
  }
151
+ /** The host declaration that frames every image of a card grid or image row; empty leaves them unframed. */
152
+ export function mediaFrameStyleParts(width) {
153
+ const borderWidth = normalizeFrameWidthOverride(width);
154
+ return borderWidth
155
+ ? [
156
+ `${MEDIA_FRAME_PROPERTY}: ${imageBorderValue(borderWidth)}`,
157
+ `${MEDIA_FRAME_WIDTH_PROPERTY}: ${imageBorderValue(borderWidth) === "none" ? "0px" : borderWidth}`,
158
+ ]
159
+ : [];
160
+ }
@@ -1167,6 +1167,7 @@ type NormalizedSectionDecoration = {
1167
1167
  inlineOffsetPercent: number;
1168
1168
  blockOffsetPercent: number;
1169
1169
  size: string;
1170
+ repeat: string | undefined;
1170
1171
  opacity: number;
1171
1172
  tintToken: string;
1172
1173
  };
@@ -1179,6 +1180,8 @@ function normalizedSectionDecorationStyle(value: unknown): string[] | undefined
1179
1180
  `--esp-section-decoration-color: var(${decoration.tintToken})`,
1180
1181
  `--esp-section-decoration-position: ${sectionDecorationPosition(decoration)}`,
1181
1182
  `--esp-section-decoration-size: ${decoration.size}`,
1183
+ // Espalier's default is no-repeat, so only a tiling decoration emits the hook (TR01416, TR01421).
1184
+ ...(decoration.repeat ? [`--esp-section-decoration-repeat: ${decoration.repeat}`] : []),
1182
1185
  `--esp-section-decoration-opacity: ${decoration.opacity}`,
1183
1186
  ];
1184
1187
  }
@@ -1186,7 +1189,7 @@ function normalizedSectionDecorationStyle(value: unknown): string[] | undefined
1186
1189
  /**
1187
1190
  * Re-check the document boundary before emitting inline CSS. Authoring and
1188
1191
  * readiness validation report the actionable diagnostic; the renderer's safe
1189
- * failure is to omit all five hooks rather than partially paint an invalid or
1192
+ * failure is to omit every hook rather than partially paint an invalid or
1190
1193
  * attacker-controlled decoration.
1191
1194
  */
1192
1195
  function normalizeSectionDecoration(value: unknown): NormalizedSectionDecoration | undefined {
@@ -1203,6 +1206,15 @@ function normalizeSectionDecoration(value: unknown): NormalizedSectionDecoration
1203
1206
  // TR01329: width and height sizes are exclusive. Read the raw keys, because
1204
1207
  // the width default is filled in below.
1205
1208
  if (value.inlineSizePercent !== undefined && value.blockSizePercent !== undefined) return undefined;
1209
+ // TR01416: a `repeat` tile keeps the image's natural size, so a size beside it is a conflict. A one-axis tile
1210
+ // (`repeat-x`, `repeat-y`) takes a size like any decoration (TR01421).
1211
+ if (
1212
+ value.repeat !== undefined
1213
+ && (typeof value.repeat !== "string" || !(fields.repeat.values as readonly string[]).includes(value.repeat))
1214
+ ) return undefined;
1215
+ const repeatKeyword = value.repeat as string | undefined;
1216
+ const repeat = repeatKeyword === "repeat";
1217
+ if (repeat && (value.inlineSizePercent !== undefined || value.blockSizePercent !== undefined)) return undefined;
1206
1218
  const blockSizePercent = value.blockSizePercent;
1207
1219
  const inlineSizePercent = value.inlineSizePercent ?? fields.inlineSizePercent.default;
1208
1220
  const opacity = value.opacity ?? fields.opacity.default;
@@ -1214,15 +1226,18 @@ function normalizeSectionDecoration(value: unknown): NormalizedSectionDecoration
1214
1226
  if (!isBoundedNumber(blockOffsetPercent, fields.blockOffsetPercent.minimum, fields.blockOffsetPercent.maximum)) {
1215
1227
  return undefined;
1216
1228
  }
1217
- if (blockSizePercent !== undefined) {
1218
- if (
1219
- !isBoundedNumber(blockSizePercent, fields.blockSizePercent.minimum, fields.blockSizePercent.maximum)
1220
- || !Number.isInteger(blockSizePercent)
1229
+ // A tile has no size to check: it paints at the image's natural size.
1230
+ if (!repeat) {
1231
+ if (blockSizePercent !== undefined) {
1232
+ if (
1233
+ !isBoundedNumber(blockSizePercent, fields.blockSizePercent.minimum, fields.blockSizePercent.maximum)
1234
+ || !Number.isInteger(blockSizePercent)
1235
+ ) return undefined;
1236
+ } else if (
1237
+ !isBoundedNumber(inlineSizePercent, fields.inlineSizePercent.minimum, fields.inlineSizePercent.maximum)
1238
+ || !Number.isInteger(inlineSizePercent)
1221
1239
  ) return undefined;
1222
- } else if (
1223
- !isBoundedNumber(inlineSizePercent, fields.inlineSizePercent.minimum, fields.inlineSizePercent.maximum)
1224
- || !Number.isInteger(inlineSizePercent)
1225
- ) return undefined;
1240
+ }
1226
1241
  if (!isBoundedNumber(opacity, fields.opacity.minimum, fields.opacity.maximum)) return undefined;
1227
1242
  if (typeof tint !== "string" || !fields.tint.values.includes(tint as never)) return undefined;
1228
1243
  const tintToken = fields.tint.tokenByValue[tint as keyof typeof fields.tint.tokenByValue];
@@ -1233,7 +1248,8 @@ function normalizeSectionDecoration(value: unknown): NormalizedSectionDecoration
1233
1248
  anchor,
1234
1249
  inlineOffsetPercent,
1235
1250
  blockOffsetPercent,
1236
- size: blockSizePercent !== undefined ? `auto ${blockSizePercent}%` : `${inlineSizePercent}% auto`,
1251
+ size: repeat ? "auto" : blockSizePercent !== undefined ? `auto ${blockSizePercent}%` : `${inlineSizePercent}% auto`,
1252
+ repeat: repeatKeyword,
1237
1253
  opacity,
1238
1254
  tintToken,
1239
1255
  };
@@ -51,7 +51,8 @@ import { isWellFormedCredential, MAXIMUM_TOKEN_LENGTH } from "./transport.js";
51
51
  * a progress line, or a result.
52
52
  */
53
53
 
54
- // The display prefix the API mints (`tr_live_` + eight characters + "..."). A
54
+ // The display prefix the API mints: `tr_live_` in production or `tr_test_` in
55
+ // any other environment (TR01422), then eight characters and "...". A
55
56
  // display value, never a secret, but still bounded and printable. Exported so
56
57
  // the wire layer accepts exactly what this store will keep: a prefix accepted
57
58
  // on claim but refused on save would turn a successful mint into an orphaned
@@ -619,6 +619,15 @@ function budgeted(observed, sampledRoutes, selected) {
619
619
  return report;
620
620
  }
621
621
 
622
+ /**
623
+ * The routes a check fetches: the home page first, once, then the authored routes, cut to the limit. The verb's
624
+ * progress count and the check both use this, so the count printed is the count checked (TR01428).
625
+ */
626
+ export function selectDeliveryRoutes(routes) {
627
+ const selected = [...new Set(["/", ...routes.filter((path) => typeof path === "string" && path.startsWith("/"))])];
628
+ return { selected, sampled: selected.slice(0, DELIVERY_LIMITS.routes) };
629
+ }
630
+
622
631
  /**
623
632
  * Verify a completed deployment's public delivery.
624
633
  *
@@ -653,8 +662,7 @@ export async function checkDelivery({
653
662
  allowedOrigins: new Set([new URL(origin).origin]),
654
663
  sleep: sleep ?? ((milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds))),
655
664
  };
656
- const selected = [...new Set(["/", ...routes.filter((path) => typeof path === "string" && path.startsWith("/"))])];
657
- const sampledRoutes = selected.slice(0, DELIVERY_LIMITS.routes);
665
+ const { selected, sampled: sampledRoutes } = selectDeliveryRoutes(routes);
658
666
 
659
667
  let observed = await observe(context, origin, sampledRoutes);
660
668
  // One bounded re-observation of everything, for edge propagation: it waits
@@ -17,8 +17,8 @@ function variantWeight(variant) {
17
17
  return variant === "regular" || variant === "italic" ? 400 : Number.parseInt(variant, 10);
18
18
  }
19
19
 
20
- // Only upright weights: a publish loads one upright face per font field, and
21
- // the browser slants it for italics.
20
+ // Only upright weights: a publish loads one upright face per font field (and the body family's bold
21
+ // face), and the browser slants them for italics.
22
22
  const FAMILIES = Object.freeze(definitions.map((definition) => Object.freeze({
23
23
  family: definition.family,
24
24
  category: definition.category,
@@ -39,15 +39,18 @@ const DETAILS = Object.freeze([
39
39
  + "takes the default: 400 for body and monospace, 700 for headings, brand and menu (brand also inherits the "
40
40
  + "headings family). So when a family lacks the default weight for its field, set that field's weight.",
41
41
  "A publish loads one upright face per font field and serves it from the site itself; visitors never contact a "
42
- + "font service. Italic text is the browser slanting that face. A family with no weights offers only italics and "
43
- + "cannot be used.",
42
+ + "font service. It also declares a bold companion for the body family when the family has a heavier upright face "
43
+ + "(700 for a 400 body when the family has 700; otherwise the heavier face the browser would pick, such as 800 for Coda); a family with only a regular face, such as ABeeZee, still renders synthesized bold. "
44
+ + "That face adds no preload of its own, though headings or another font field that selects the same face "
45
+ + "can still preload it. Italic text is the browser slanting "
46
+ + "these faces. A family with no weights offers only italics and cannot be used.",
44
47
  ]);
45
48
 
46
49
  const FIXED_VALUES = Object.freeze([Object.freeze({
47
50
  name: "fonts.requestedAxes",
48
51
  value: "ital,wght@0,<weight>",
49
- where: "Publish requests only ital (at 0, the upright face) and wght (at the font field's configured weight). "
50
- + "Publish never requests opsz, SOFT or WONK.",
52
+ where: "Publish requests only ital (at 0, the upright face) and wght (at the font field's configured weight), "
53
+ + "and the same two axes for the body family's bold companion face, where the family has one. Publish never requests opsz, SOFT or WONK.",
51
54
  source: "Taproot publish font requests",
52
55
  })]);
53
56
 
@@ -1,6 +1,6 @@
1
1
  // Generated from shared/footer-content.ts by scripts/sync-field-validation.mjs. Do not edit.
2
2
  import { isSafeUrl } from "./url-safety.js";
3
- export const FOOTER_DRAFT_VERSION = "footer-draft-v9";
3
+ export const FOOTER_DRAFT_VERSION = "footer-draft-v10";
4
4
  /** These fields belong to presentation; footer content saves and dirty checks leave them alone. */
5
5
  export const FOOTER_PRESENTATION_FIELDS = ["context", "logoVariant"];
6
6
  /** Preserve raw content values; callers decide whether their document needs normalization. */
@@ -85,6 +85,7 @@ export const FOOTER_FIELD_INVENTORY = Object.freeze({
85
85
  "context",
86
86
  "logoVariant",
87
87
  "asideCtaStyle",
88
+ "brandHoverGrow",
88
89
  ]),
89
90
  FooterLinkColumn: Object.freeze(["id", "groups", "span", "alignment"]),
90
91
  FooterAlignment: Object.freeze(["horizontal", "vertical", "textAlign"]),
@@ -561,6 +562,7 @@ export function footerDefaults() {
561
562
  brandSize: "standard",
562
563
  logoScale: "1.0",
563
564
  logoBox: "fixed",
565
+ brandHoverGrow: false,
564
566
  asideSpan: 1,
565
567
  asideCta: undefined,
566
568
  asideCtaStyle: DEFAULT_FOOTER_CTA_STYLE,
@@ -675,6 +677,7 @@ function normalizeFooterDocument(
675
677
  "fixed",
676
678
  "natural",
677
679
  ], "footerSettings.logoBox"),
680
+ brandHoverGrow: boolean(value.brandHoverGrow, false, "footerSettings.brandHoverGrow"),
678
681
  ...authoredAlignment(value, "alignment", "footerSettings", tolerateStoredValues),
679
682
  ...authoredAlignment(value, "brandAlignment", "footerSettings", tolerateStoredValues),
680
683
  ...authoredAlignment(value, "asideAlignment", "footerSettings", tolerateStoredValues),
@@ -85,6 +85,7 @@ export function computeFooterDraftHash(settings = {}) {
85
85
  append(canonical, settings.brandSize || "standard");
86
86
  append(canonical, resolveFooterLogoScale(settings.logoScale, settings.brandSize).canonical);
87
87
  append(canonical, normalizeFooterLogoBox(settings.logoBox));
88
+ append(canonical, settings.brandHoverGrow === true);
88
89
  appendAlignment(canonical, settings.alignment);
89
90
  appendAlignment(canonical, settings.brandAlignment);
90
91
  appendAlignment(canonical, settings.asideAlignment);