@taprootio/site-authoring 0.56.0 → 0.59.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/README.md +13 -11
- package/package.json +2 -2
- package/src/api.js +7 -0
- package/src/block-flow.js +4 -2
- package/src/changelog.json +87 -0
- package/src/chrome-additions.js +106 -0
- package/src/chrome-features.js +43 -10
- package/src/chrome-input.js +137 -30
- package/src/chrome-report.js +4 -2
- package/src/cli.js +54 -17
- package/src/content/button-styles.js +27 -0
- package/src/content/components.js +76 -10
- package/src/content/free-form-section-registry.json +9 -0
- package/src/content/free-form-sections.js +55 -16
- package/src/content/markdown.js +133 -56
- package/src/content/media-presentation.js +37 -0
- package/src/content/tiptap-prosemirror.ts +26 -10
- package/src/credentials.js +2 -1
- package/src/delivery-check.js +10 -2
- package/src/font-catalog.js +9 -6
- package/src/footer-content.js +1 -1
- package/src/footer-contract.js +3 -0
- package/src/footer-draft-hash.js +1 -0
- package/src/heading-outline.js +94 -6
- package/src/image-description-contract.js +5 -3
- package/src/image-description-write.js +26 -0
- package/src/index.js +1 -0
- package/src/output.js +2 -1
- package/src/page-structure-checks.js +14 -25
- package/src/placed-image-ids.js +42 -17
- package/src/presentation-reference.js +63 -18
- package/src/problems.js +147 -4
- package/src/reference-help.js +102 -57
- package/src/site-check-findings.js +2 -3
- package/src/site-check-rules.json +0 -1
- package/src/site-health-findings.js +7 -9
- package/src/site-health-image-checks.js +4 -1
- package/src/site-health-precheck.js +23 -6
- package/src/site-navigation-groups.js +16 -0
- package/src/status-warning-paints.js +175 -0
- package/src/template-token-reach.json +13 -18
- package/src/theme-proposals.js +143 -55
- package/src/theme-resolve.js +14 -1
- package/src/theme-validation.js +70 -38
- package/src/token-reach.js +20 -0
- package/src/typed-page-reference.js +3 -2
- package/src/typed-pages.js +7 -7
- package/src/verbs/changelog.js +23 -2
- package/src/verbs/delivery-check.js +43 -9
- package/src/verbs/media-images.js +4 -4
- package/src/verbs/pages-push.js +38 -32
- package/src/verbs/plan.js +28 -20
- package/src/verbs/pull.js +179 -24
- package/src/verbs/theme-push.js +59 -15
- package/src/verbs/theme-resolve.js +109 -11
- package/src/verbs/validate.js +97 -16
- package/src/workspace-check.js +4 -4
- package/src/workspace-context-usage.js +180 -0
- package/src/workspace.js +12 -0
- package/test/fixtures/default-site-theme.json +1 -1
package/README.md
CHANGED
|
@@ -197,9 +197,9 @@ does not have), a severity, the file, and the value found (and a `detail` for
|
|
|
197
197
|
some); a warning never refuses. For a free-form page the rules also read its headings,
|
|
198
198
|
images and links the way the publisher does: `seo.h1_missing` when no `#` heading,
|
|
199
199
|
banner title or hero title is the page's `<h1>`; `seo.h1_demoted` when a `#` heading
|
|
200
|
-
publishes as an `<h2>` because the banner's overlay text, a hero title
|
|
201
|
-
`#` heading already is the `<h1>` (`detail` says which);
|
|
202
|
-
|
|
200
|
+
or a hero title publishes as an `<h2>` because the banner's overlay text, a hero title
|
|
201
|
+
or an earlier `#` heading already is the `<h1>` (`detail` says which);
|
|
202
|
+
`seo.heading_renumbered` and `seo.heading_before_title` for
|
|
203
203
|
headings published at another level; and `a11y.link_text_empty`. Image-default
|
|
204
204
|
completeness (`a11y.image_default_missing`) needs the site's own image records,
|
|
205
205
|
so plain `validate` lists it in `siteChecks.skipped`, with `siteChecks.imageCheckReason`
|
|
@@ -479,7 +479,7 @@ Markdown subset with `title`, `path`, and `description` front matter, or
|
|
|
479
479
|
`pages/<name>.pm.json` as a ProseMirror document — and pull never writes a
|
|
480
480
|
generated `.pm.json` beside a tracked `.md`. For a page tracked as Markdown
|
|
481
481
|
the site's own document is kept as internal state under
|
|
482
|
-
`.taproot-site-state/`, which is never a page source and never pushed. A tracked
|
|
482
|
+
`.taproot-site-state/`, which is never a page source and never pushed; leave it out of version control. A tracked
|
|
483
483
|
Markdown page conflicts, with a `pages.pull_conflict` refusal before anything under
|
|
484
484
|
`pages/` changes and both recovery paths named, when the site moved: its stored-state
|
|
485
485
|
revision moved, or its display date moved for a page type that has one. A `.pm.json`
|
|
@@ -493,10 +493,12 @@ a category override does not move it. The `Differs at:` paths of a refusal expla
|
|
|
493
493
|
and never decide it (an empty list can mean a change to the title, path, description,
|
|
494
494
|
cover image or display date).
|
|
495
495
|
Pull before creating a new JSON source. Once a new page is declared with a
|
|
496
|
-
file, title or path but has no server page ID,
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
496
|
+
file, title or path but has no server page ID, pull keeps such a pending entry and its file as they are and
|
|
497
|
+
lists it as `keptPendingPages`; save it with `pages push` (a legal page needs
|
|
498
|
+
`taproot-site login --legal-drafts`, then `taproot-site --legal-drafts pages push`).
|
|
499
|
+
Pull refuses instead, changing nothing, when the file is missing or is not a
|
|
500
|
+
page source, a page on the site holds the same path, another page's tracked
|
|
501
|
+
source is the same file, or the page list was truncated. It also refuses an untracked legal or unreadable JSON source
|
|
500
502
|
that would be replaced by a new remote page.
|
|
501
503
|
|
|
502
504
|
Pages are not only free-form. A source chooses its template with `template:` in
|
|
@@ -1337,9 +1339,9 @@ exits 0 whenever it reads the report, whatever the findings.
|
|
|
1337
1339
|
a `fix` for the rule. `imageFindings` are one for each image with no default
|
|
1338
1340
|
description: `imageId`, `name`, up to ten `affectedPages` (with
|
|
1339
1341
|
`affectedPageCount` for the total), and a `fix`.
|
|
1340
|
-
- An image `fix` is the exact command,
|
|
1341
|
-
the
|
|
1342
|
-
`taproot-site media images describe <id> --description='<alt>' --
|
|
1342
|
+
- An image `fix` is the exact command, carrying the alt text the workspace's own
|
|
1343
|
+
pages place; the CLI reads the description revision itself when it runs:
|
|
1344
|
+
`taproot-site media images describe <id> --description='<alt>' --if-missing`.
|
|
1343
1345
|
The text is single-quoted for a POSIX shell. When no placement gives a usable
|
|
1344
1346
|
description (none, over 1000 characters, or with control characters), the
|
|
1345
1347
|
finding says `needsDescription: true` and its `fix` is a sentence; write the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taprootio/site-authoring",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"description": "Taproot site authoring CLI: sign in once in the browser, then pull, validate, push, preview, approve, and deploy a site from the terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "ISC",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test/fixtures/default-site-theme.json"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@taprootio/espalier": "7.
|
|
32
|
+
"@taprootio/espalier": "7.8.0",
|
|
33
33
|
"mediabunny": "1.61.1"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
package/src/api.js
CHANGED
|
@@ -332,6 +332,12 @@ function enumValue(value, allowed, zero, code, field) {
|
|
|
332
332
|
return value;
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
+
// TR01420: an absent count is null, never 0, so a caller can tell "not reported" from "none".
|
|
336
|
+
function optionalCount(value) {
|
|
337
|
+
const numeric = typeof value === "string" && value !== "" ? Number(value) : value;
|
|
338
|
+
return Number.isSafeInteger(numeric) && numeric >= 0 ? numeric : null;
|
|
339
|
+
}
|
|
340
|
+
|
|
335
341
|
function safeCount(value) {
|
|
336
342
|
const numeric = typeof value === "string" ? Number(value) : value;
|
|
337
343
|
return Number.isSafeInteger(numeric) && numeric >= 0 ? numeric : 0;
|
|
@@ -1928,6 +1934,7 @@ export function normalizeDeployment(value) {
|
|
|
1928
1934
|
completedAt: text(deployment.completedAt),
|
|
1929
1935
|
errorMessage: text(deployment.errorMessage),
|
|
1930
1936
|
pageCount: safeCount(deployment.pageCount),
|
|
1937
|
+
pagesGenerated: optionalCount(deployment.pagesGenerated),
|
|
1931
1938
|
phaseTimings: normalizePhaseTimings(deployment.phaseHistory),
|
|
1932
1939
|
// Identical requests coalesced into this deployment inside its settling
|
|
1933
1940
|
// window (TR00839). Zero for a deployment that never anchored one.
|
package/src/block-flow.js
CHANGED
|
@@ -164,9 +164,11 @@ export const HEADING_FLOW_NEIGHBORS = [
|
|
|
164
164
|
{ surface: "both", selector: "esp-columns[data-taproot-columns]", edge: "self-contained" },
|
|
165
165
|
{ surface: "both", selector: "esp-section[data-taproot-section], taproot-integration-placement[data-placement-id]", edge: "excluded" },
|
|
166
166
|
{ surface: "both", selector: "esp-image[data-tiptap-image]:not([banner])", edge: "self-contained" },
|
|
167
|
-
|
|
167
|
+
// Before the element upgrades its text and links are light DOM but hidden, and only its media shows; the
|
|
168
|
+
// element then reports whether it shows anything (TR01424).
|
|
168
169
|
{ surface: "both", selector: ":is(taproot-hero, taproot-cta)[data-heading-flow-ready]", edge: "self-contained" },
|
|
169
|
-
{ surface: "both", selector: ":is(taproot-hero, taproot-cta)[data-heading-flow-component]:not(
|
|
170
|
+
{ surface: "both", selector: ":is(taproot-hero, taproot-cta)[data-heading-flow-component]:not(:defined)", edge: "barrier" },
|
|
171
|
+
{ surface: "both", selector: ":is(taproot-hero, taproot-cta)[data-heading-flow-component]:defined:not([data-heading-flow-ready])", edge: "excluded" },
|
|
170
172
|
{ surface: "both", selector: "taproot-feature-grid:not(:empty), taproot-card-grid:not(:empty), taproot-product-grid:not(:empty), taproot-testimonial:not(:empty)", edge: "barrier" },
|
|
171
173
|
{ surface: "published", selector: "taproot-latest-posts:not(:empty)", edge: "barrier" },
|
|
172
174
|
{ surface: "preview", selector: '[data-heading-flow-neighbor="latest-posts"]:not(:empty)', edge: "barrier" },
|
package/src/changelog.json
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
|
+
{
|
|
4
|
+
"version": "0.59.0",
|
|
5
|
+
"note": "Follow-ups from the 0.58.0 trial: Espalier 7.8.0 outline buttons, button shadow and footer heading colors, file lines and every section problem in validate, pages and sections behind each context count, and delivery and help fixes.",
|
|
6
|
+
"behavior": [
|
|
7
|
+
"Espalier 7.8.0: an outline button casts the theme's button shadow only when the theme sets --esp-button-outline-background in componentProperties, so an unfilled outline button no longer prints its label and border twice and draws no shadow. A hero's secondary action is an outline button by default, so it casts the theme shadow only when the theme sets an outline fill and its style is outline; solid keeps its theme shadow. help component hero-section says so.",
|
|
8
|
+
"help theme lists Espalier 7.8.0's new settable properties: --esp-button-shadow-color (recolors the elevation levels used for button rest and hover), --esp-button-outline-background and --esp-button-outline-border-color (an outline button's fill and resting border color; its label is fitted to the fill), and --esp-footer-heading-color. theme push refused --esp-footer-heading-color as a public token on 0.58.0. help theme no longer says the shadow color stays the theme's or that the quote fill stays at layer 1 (--esp-blockquote-surface sets it), and help component explains that an outline button is transparent by default and can take a theme fill.",
|
|
9
|
+
"An ink fitted to a theme footer heading fill or outline button fill now also meets WCAG 4.5:1, so a footer heading whose fill is mid-tone can get a different heading ink on its next publish. --esp-footer-heading-color wins over the fitted ink, and theme resolve and validate measure it at WCAG 4.5:1 over the footer surface, or over the heading fill when --esp-footer-heading-background is set. It supplies the footer's resting configured brand text color only when no explicit brand color applies.",
|
|
10
|
+
"Since 0.58.0 (Espalier 7.7.0), --esp-blockquote-font-family reaches a quote's paragraphs and lists, not only its frame; 0.58.0 did not record this, and help theme now says it.",
|
|
11
|
+
"In a workspace, theme push, theme resolve and validate list the pages and sections behind each context warning's usedBy counts (theme resolve --site scans no workspace pages, so it emits neither usedIn nor contextUsageSkipped): usedIn holds up to 20 items (file, kind section or cta, 1-based position among the page's sections or call-to-action blocks) with the true total and truncated, once on the warning's first retained statusWarningPaints record in a successful JSON result; when validate refuses, its progress text carries the Used by lines instead. theme resolve's text view shows them as Used by lines.",
|
|
12
|
+
"Context counts come only from pages that read, convert and pass the shared document checks. When a status-color warning is scoped to a named context, theme push and theme resolve list the pages left out, with their first problem code, in contextUsageSkipped (up to 20 files, with total and truncated) and a Not counted line; validate reports them in its progress text before it refuses. When the page inventory itself cannot be read, one usage-unavailable line says so. The new fields never displace other results: usedIn can be left out of the JSON entirely when room runs out (the text view still shows it), and contextUsageSkipped can shrink to its total, which theme resolve's table still prints as Not counted, or be left out, and only then does the Not counted line move to the progress text. Retired generated sources are not pages.",
|
|
13
|
+
"Every Markdown page problem that has a source line reports the file line, as a line field and, when the message fits the diagnostic limit, in the message (front matter used to shift it), including an inline problem on the second line of a paragraph. Markdown problems name their file; an ordinary .pm.json document finding keeps its file-qualified field, and a recipe-step finding carries file and a document-relative field. A lone problem that has a source line gets its own stderr row.",
|
|
14
|
+
"In a free-form Markdown page, validate and pages push report every section decoration, background and section-owned image problem at once, each with its file line (a failed image field does not hide the others). Any other Markdown error still stops that file, a decoration or background problem in a typed page such as an article still stops at the first, and recipe steps keep reporting all of theirs. A refusal lists at most 5,000 problems and the bounded JSON can omit more, while problemCount counts every one found and problemsTruncated says rows were dropped.",
|
|
15
|
+
"delivery check prints the number of routes it checks (it counted / twice). Every delivery report carries verdictCovers and uncheckedRoutes, with items [] and a total of 0 when no saved manifest page was left out for its status; with no manifest the sample is only /, so 0 does not show the rest of the site was covered. A refusal such as delivery.no_completed_deployment has neither.",
|
|
16
|
+
"The deploy note says deployment.pageCount leaves out the home page, the 404 page and generated pages on Standard sites, and pagesGenerated counts the pages rendered for the deployment (null when the server sends none). The use note says use rewrites the file a leading --config names, which must exist, and that a missing one refuses with config.not_found; without it use rewrites the file found in this or a parent directory, or creates one here, and config.ambiguous points to --config.",
|
|
17
|
+
"validate cannot see an integration placement's h1, so a level-1 heading or hero title after a placement can publish as h2 without an seo.h1_demoted finding and a page whose only h1 is a placement can get seo.h1_missing; the validate note and help page free-form say to check the published page. Adopted fragments stay visible to validate. help component says a default hero or call-to-action button style writes no attribute in the delivered HTML.",
|
|
18
|
+
"Run help page free-form, help component hero-section and help component cta for the page and component topics; the help list names them as page and component, and bare help page and help component fail with help.usage.",
|
|
19
|
+
"Declined, with the alternative each time: a secondary button color role (set an outline fill and border color instead); saying whether a painting component appears inside a context (usedIn lists the places to look); counting pages that do not convert (contextUsageSkipped lists them); collecting every Markdown error (only decoration and background problems are self-contained); writing default style attributes (so a later default change reaches omitting heroes and calls to action; an explicit style is kept); use --config creating a missing file (a mistyped path would write a new configuration); validate seeing an integration placement's h1 (help and the validate note say it cannot).",
|
|
20
|
+
"Taproot refuses older authoring clients at sign-in and token exchange once this release deploys. Automation that signs in with TAPROOT_SITE_KEY skips that exchange, so upgrade it explicitly. Upgrade with npm install -g @taprootio/site-authoring@latest.",
|
|
21
|
+
"The help reference version is 83."
|
|
22
|
+
],
|
|
23
|
+
"help": [
|
|
24
|
+
"theme",
|
|
25
|
+
"footer",
|
|
26
|
+
"delivery",
|
|
27
|
+
"page",
|
|
28
|
+
"component",
|
|
29
|
+
"import"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"version": "0.58.0",
|
|
34
|
+
"note": "Follow-ups from a site build on 0.57.0: hero actions share the button look, buttons lift and take a focus outline, prose quotes, lists, code and footer headings gain Espalier 7.7.0 hooks, checks report where and why, and local keys say tr_test_.",
|
|
35
|
+
"behavior": [
|
|
36
|
+
"help sections is a new topic holding the section reference (fields, photo backgrounds, scrims, decorations, contexts, sizing) moved out of help page free-form, which keeps a pointer to it.",
|
|
37
|
+
"A section decoration's repeat is a keyword: repeat (both axes, natural size), repeat-x or repeat-y (one axis, and they take a size). The 0.57.0 boolean is refused, so re-set repeat: true as repeat.",
|
|
38
|
+
"hero-section actions render as buttons that share the theme's button border, shadow, hover lift, press and focus outline; the secondary action uses Espalier's outline look by default. hero-section takes titleSize compact and leadSize (normal, compact). An app-authored hero's subtitle now publishes as its lead. Publishing refuses an unknown hero titleSize or leadSize, or a decoration repeat or size the renderer cannot paint, in every page body.",
|
|
39
|
+
"A hero action or call-to-action button takes a look of the author's choosing: hero primaryActionStyle (default solid) and secondaryActionStyle (default outline), and cta buttonStyle (default solid), each solid (the theme's filled button), outline (a transparent button with a link-colored border) or text (a borderless button that reads as a link). Leaving an option out renders as before, a cta variant of danger colors only the solid button (an outline button follows the link colors and a text button the text color), and publishing refuses any other value. help component lists the values.",
|
|
40
|
+
"A hero's overline, title and lead and its action links, and a call-to-action's heading, description and button link, are now in the delivered HTML itself, so a crawler finds the page's h1, text and links in it (they were set from attributes after load); the text and links stay hidden until the elements upgrade. A hero-section title is the page's h1 only when nothing earlier claimed it: after a # heading, a banner title, an adopted fragment's h1 or another hero it publishes as an h2, and validate reports it as seo.h1_demoted. seo.h1_multiple is retired, and validate no longer reports it.",
|
|
41
|
+
"card-grid and image-row take mediaBorderWidth to frame their images; left out, the images stay unframed (unlike hero-section and cta, which follow the site's image border).",
|
|
42
|
+
"help theme lists Espalier 7.7.0's settable properties: button hover offset, hover shadow, focus color, focus width and focus offset; quote frame, glyph size and surface; code border width and shadow; the ordered-list marker frame (tag draws numbers as code tags); and the footer heading fill. Heading marks no longer reach footer headings.",
|
|
43
|
+
"Context status warnings no longer say to retune a status via intents when the collision is the context's action color, and each context-scoped warning reports usedBy: the header, footer, sections and CTAs that use that context across the workspace's page files, or null with usedByNote when none do. Pages are read only when such a warning needs it, and a failed read never blocks a theme push.",
|
|
44
|
+
"A refused theme reports every refusal in error.problems, a single one included (ordinary errors first, then each refused component property with its accepted form), and problemCount counts rows dropped by the cap; length properties are rem or em only, and the message says so with an example in range.",
|
|
45
|
+
"component_property_scheme_differs no longer warns for properties that only paint (heading mark height, shadows, offsets, underline offset and thickness); it compares only properties that can move layout.",
|
|
46
|
+
"theme resolve and validate measure the button focus outline instead of the glow when a theme sets --esp-button-focus-color, and footer headings on their fill when --esp-footer-heading-background is set.",
|
|
47
|
+
"delivery check routes the pages a published site links in the workspace manifest (a saved page id, published or approved) plus '/', so a kept pending page no longer fails it. Saved pages whose manifest status is not published or approved are omitted from that route sample and listed as uncheckedRoutes (path and reason, fitted to the output bound; a stale draft status says nothing about whether the deployed site links the page), the summary says they were left out of the sample because of their manifest status (the check may still fetch one as a link from another page), and verdictCovers says the verdict covers the sampled routes and the checks made from them; run pull after approving pages in the app so their statuses are current.",
|
|
48
|
+
"skippedNavigationLinks items add location (header or footer), resourceId and path; theme resolve bounds the list and keeps its count.",
|
|
49
|
+
"Terminal summaries strip control and bidirectional characters from page paths.",
|
|
50
|
+
"pull's summary counts every manifest entry and names the kept pending ones; deploy reports deployment.pagesGenerated (null when the server sends none), and the deploy note says what pageCount, pagesGenerated, stagedPageCount and plannedPageCount count.",
|
|
51
|
+
"An image placed only as a section decoration (including in an integration-managed page's introduction) no longer needs a default description (a11y.image_default_missing) in validate --site and Site Health; a decoration image is also never a page's feed thumbnail.",
|
|
52
|
+
"A publish also declares a bold companion for the body font when the family has a heavier upright face (700 for a 400 body when the family has 700, else the face CSS matches, such as 800 for Coda), with no preload of its own (a heading or another font field can still preload the same face), so bold body text no longer renders as synthesized bold for such families; a family with only a regular face, such as ABeeZee, still does. help fonts says so.",
|
|
53
|
+
"help theme says the theme's box image paints above each box's fill. help page free-form (the Markdown hard break, a trailing backslash or two spaces), the pull, authors add, pages push and use notes, and help page place-review regain facts trimmed in 0.57.0.",
|
|
54
|
+
"help pages now states the rule for every page type that two sources for one path are refused (pages.path_conflict); help page free-form no longer repeats it.",
|
|
55
|
+
"Keys and sign-ins minted by any Taproot other than production start tr_test_ (production stays tr_live_), and each Taproot accepts only its own prefix, so sign in again on a local stack after upgrading it; login and whoami help say so.",
|
|
56
|
+
"The help reference version is 82."
|
|
57
|
+
],
|
|
58
|
+
"help": [
|
|
59
|
+
"sections",
|
|
60
|
+
"pages",
|
|
61
|
+
"page",
|
|
62
|
+
"components",
|
|
63
|
+
"component",
|
|
64
|
+
"theme",
|
|
65
|
+
"tokens",
|
|
66
|
+
"appearance",
|
|
67
|
+
"footer",
|
|
68
|
+
"fonts",
|
|
69
|
+
"delivery"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"version": "0.57.0",
|
|
74
|
+
"note": "Chrome checks see staged nav links, status advice keeps each status's hue, and new options cover CTA fills, media frames, card press, footer brand hover, tiling decorations and Espalier 7.6.0's settable properties.",
|
|
75
|
+
"behavior": [
|
|
76
|
+
"validate, theme push and theme resolve treat approved pages as linked, as staging renders them, and report what they could not check in skippedNavigationLinks (draft_page, missing_page, unknown_path; at most 50 items). theme resolve --site reads the page list.",
|
|
77
|
+
"Status-color advice keeps each status within 16 degrees of its hue, ranks candidates as the check renders them, moves danger last, and names the context's action field for a context collision. statusWarningPaints lists the components each status color paints.",
|
|
78
|
+
"cta takes context (a theme context declared by both themes) so its panel paints that context's background and border; hero-section and cta take mediaBorderWidth.",
|
|
79
|
+
"card-grid interaction takes press; help component card-grid describes each interaction.",
|
|
80
|
+
"footer takes brandHoverGrow. The footer draft hash is footer-draft-v10, so pull before you footer push.",
|
|
81
|
+
"A section decoration takes repeat: true to tile its image at natural size, without a size percent.",
|
|
82
|
+
"pull keeps a never-saved page entry and its file (keptPendingPages) instead of refusing, unless another page claims its path or file.",
|
|
83
|
+
"media images describe --if-missing reads the current revision itself, so --expected-revision is optional with it.",
|
|
84
|
+
"help theme lists Espalier 7.6.0's settable properties: shadow geometry per level, button shadow, border width and press offset, list marker style and color, quote bar width, shadow and font, heading marks, inline code frame, nav indicator colors and footer hover backgrounds. help tokens names the layer each surface paints.",
|
|
85
|
+
"changelog --since lists the newest releases that fit one result and names the older ones it left out (complete: false).",
|
|
86
|
+
"The help reference version is 81."
|
|
87
|
+
],
|
|
88
|
+
"help": ["theme", "tokens", "footer", "component", "page", "media", "settings"]
|
|
89
|
+
},
|
|
3
90
|
{
|
|
4
91
|
"version": "0.56.0",
|
|
5
92
|
"note": "Give a site author a byline link and an image, and change an author with authors set.",
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { LIMITS } from "./constants.js";
|
|
2
|
+
import { usedInOf, withoutUsedIn } from "./status-warning-paints.js";
|
|
3
|
+
|
|
4
|
+
// The chrome extras may use at most this much of a result, whatever room is left.
|
|
5
|
+
const MAXIMUM_ADDITION_BYTES = 8 * 1024;
|
|
6
|
+
// Room kept for the envelope a verb wraps around its fields.
|
|
7
|
+
const ENVELOPE_RESERVE_BYTES = 2048;
|
|
8
|
+
|
|
9
|
+
const bytes = (value) => Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
10
|
+
|
|
11
|
+
/** The skipped-link report cut to `room` bytes: the count stays, the list shrinks, and `truncated` says so. */
|
|
12
|
+
export function boundSkippedLinks(skipped, room = MAXIMUM_ADDITION_BYTES) {
|
|
13
|
+
if (bytes(skipped) <= room) return skipped;
|
|
14
|
+
const items = [];
|
|
15
|
+
let used = bytes({ ...skipped, items: [], truncated: true });
|
|
16
|
+
// The report did not fit, so at least one row goes: `truncated: true` is shorter than a `false` it replaces.
|
|
17
|
+
for (const item of skipped.items.slice(0, -1)) {
|
|
18
|
+
const size = bytes(item) + (items.length === 0 ? 0 : 1);
|
|
19
|
+
if (used + size > room) break;
|
|
20
|
+
items.push(item);
|
|
21
|
+
used += size;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
...skipped,
|
|
25
|
+
items,
|
|
26
|
+
...(items.length < skipped.items.length || skipped.truncated ? { truncated: true } : {}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Adds the context-usage fields (TR01426) to a finished, already fitted result from the bytes it has left: each
|
|
32
|
+
* warning's `usedIn` list and `contextUsageSkipped`. They never displace a field that is already in the result.
|
|
33
|
+
* When they do not all fit, `usedIn` lists are shed first, last warning first, and then the skipped rows are cut
|
|
34
|
+
* to the total; a summary that cannot fit is left out of the JSON.
|
|
35
|
+
*/
|
|
36
|
+
export function addUsageFields(result, { usedIn = new Map(), skipped } = {}) {
|
|
37
|
+
const records = result.statusWarningPaints;
|
|
38
|
+
const wanted = records === undefined ? [] : [...usedIn].filter(([warning]) => records.some((record) => record.warning === warning));
|
|
39
|
+
if (wanted.length === 0 && skipped === undefined) return result;
|
|
40
|
+
// The result is already wrapped, so what it measures is what is left.
|
|
41
|
+
const room = LIMITS.githubOutputBytes - bytes(result);
|
|
42
|
+
// Adding a list to a record costs its comma and `"usedIn":[...]`, which is the object's size less its two braces.
|
|
43
|
+
const listCost = (rows) => rows.reduce((sum, [, list]) => sum + bytes({ usedIn: list }) - 1, 0);
|
|
44
|
+
// What the field adds beyond its value: the comma, the quoted key and the colon.
|
|
45
|
+
const keyBytes = bytes({ contextUsageSkipped: 0 }) - 3 + 1;
|
|
46
|
+
const skippedCost = skipped === undefined ? 0 : keyBytes + bytes(skipped);
|
|
47
|
+
const kept = [...wanted];
|
|
48
|
+
while (kept.length > 0 && listCost(kept) + skippedCost > room) kept.pop();
|
|
49
|
+
let reported = skipped;
|
|
50
|
+
if (skipped !== undefined && listCost(kept) + skippedCost > room) {
|
|
51
|
+
const available = room - listCost(kept);
|
|
52
|
+
reported = boundSkippedLinks(skipped, available - keyBytes);
|
|
53
|
+
if (keyBytes + bytes(reported) > available) reported = undefined;
|
|
54
|
+
}
|
|
55
|
+
const lists = new Map(kept);
|
|
56
|
+
const seen = new Set();
|
|
57
|
+
return {
|
|
58
|
+
...result,
|
|
59
|
+
...(records === undefined ? {} : {
|
|
60
|
+
statusWarningPaints: records.map((record) => {
|
|
61
|
+
if (seen.has(record.warning)) return record;
|
|
62
|
+
seen.add(record.warning);
|
|
63
|
+
return lists.has(record.warning) ? { ...record, usedIn: lists.get(record.warning) } : record;
|
|
64
|
+
}),
|
|
65
|
+
}),
|
|
66
|
+
...(reported === undefined ? {} : { contextUsageSkipped: reported }),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Fits the skipped-link report and the status-paint records into what the rest of a result leaves, so a large
|
|
72
|
+
* valid workspace never turns into output.too_large because of them. Counts stay; the skipped list shrinks with
|
|
73
|
+
* `truncated: true`, and whole paint groups are dropped and counted in `statusWarningPaintsOmitted`.
|
|
74
|
+
*/
|
|
75
|
+
export function fitChromeAdditions(fields) {
|
|
76
|
+
const { skippedNavigationLinks, statusWarningPaints: listedPaints, statusWarningPaintsOmitted = 0, contextUsageSkipped, ...rest } = fields;
|
|
77
|
+
if (skippedNavigationLinks === undefined && listedPaints === undefined && contextUsageSkipped === undefined) return fields;
|
|
78
|
+
// The usage fields come last, from what the existing records leave, so they never change what those keep.
|
|
79
|
+
const usedIn = usedInOf(listedPaints);
|
|
80
|
+
const statusWarningPaints = withoutUsedIn(listedPaints);
|
|
81
|
+
let room = Math.min(MAXIMUM_ADDITION_BYTES, LIMITS.githubOutputBytes - bytes(rest) - ENVELOPE_RESERVE_BYTES);
|
|
82
|
+
const fitted = { ...rest };
|
|
83
|
+
if (statusWarningPaints !== undefined) {
|
|
84
|
+
const kept = [];
|
|
85
|
+
const groups = [];
|
|
86
|
+
for (const record of statusWarningPaints) {
|
|
87
|
+
if (groups.at(-1)?.[0].warning === record.warning) groups.at(-1).push(record);
|
|
88
|
+
else groups.push([record]);
|
|
89
|
+
}
|
|
90
|
+
let used = 0;
|
|
91
|
+
let omitted = statusWarningPaintsOmitted;
|
|
92
|
+
for (const group of groups) {
|
|
93
|
+
const size = bytes(group);
|
|
94
|
+
if (used + size > room / 2) omitted += 1;
|
|
95
|
+
else {
|
|
96
|
+
kept.push(...group);
|
|
97
|
+
used += size;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
room -= used;
|
|
101
|
+
if (kept.length > 0) fitted.statusWarningPaints = kept;
|
|
102
|
+
if (omitted > 0) fitted.statusWarningPaintsOmitted = omitted;
|
|
103
|
+
}
|
|
104
|
+
if (skippedNavigationLinks !== undefined) fitted.skippedNavigationLinks = boundSkippedLinks(skippedNavigationLinks, room);
|
|
105
|
+
return addUsageFields(fitted, { usedIn, skipped: contextUsageSkipped });
|
|
106
|
+
}
|
package/src/chrome-features.js
CHANGED
|
@@ -6,7 +6,7 @@ import { resolveHeaderChromePresentation } from "./header-presentation.js";
|
|
|
6
6
|
import { describeHeaderNavigationItem, MAX_NAVIGATION_DEPTH, prepareHeaderNavigation, SITE_NAVIGATION_KINDS, } from "./site-navigation-groups.js";
|
|
7
7
|
import { isRenderableSocialLink } from "./social-link-url.js";
|
|
8
8
|
/** Flags describe reachable paint across pages, viewport sizes and header scroll positions. */
|
|
9
|
-
export function chromeFeatures({ headerSettings, footerSettings, navItems, footerPagePaths, logoPairs, searchEnabled, hasIconSprite, nameReportEnabled, }) {
|
|
9
|
+
export function chromeFeatures({ headerSettings, footerSettings, navItems, footerPagePaths, logoPairs, searchEnabled, hasIconSprite, nameReportEnabled, themes, }) {
|
|
10
10
|
const features = {};
|
|
11
11
|
if (headerSettings) {
|
|
12
12
|
const header = resolveHeaderChromePresentation(headerSettings);
|
|
@@ -34,7 +34,7 @@ export function chromeFeatures({ headerSettings, footerSettings, navItems, foote
|
|
|
34
34
|
features.header = schemeFeatures(flags, navigation, header.showBrandText ? header.brandText : undefined, {
|
|
35
35
|
light: hasLogo,
|
|
36
36
|
dark: hasLogo,
|
|
37
|
-
});
|
|
37
|
+
}, themeFlags(themes, headerSettings.context));
|
|
38
38
|
}
|
|
39
39
|
if (footerSettings?.enabled === true) {
|
|
40
40
|
const flags = footerContentFlags(footerSettings, footerPagePaths);
|
|
@@ -47,10 +47,11 @@ export function chromeFeatures({ headerSettings, footerSettings, navItems, foote
|
|
|
47
47
|
// A one-scheme footer override must not become the opposite scheme's logo.
|
|
48
48
|
light: showBrand && Boolean(logoPairs?.footer?.light.url),
|
|
49
49
|
dark: showBrand && Boolean(logoPairs?.footer?.dark.url),
|
|
50
|
-
});
|
|
50
|
+
}, themeFlags(themes, footerSettings.context));
|
|
51
51
|
}
|
|
52
52
|
else if (nameReportEnabled === true) {
|
|
53
|
-
|
|
53
|
+
// The standalone action sits outside any footer context, so only root properties apply.
|
|
54
|
+
features.footer = schemeFeatures(["footerActionButton:standalone"], [], undefined, { light: false, dark: false }, themeFlags(themes, undefined));
|
|
54
55
|
}
|
|
55
56
|
return features;
|
|
56
57
|
}
|
|
@@ -62,14 +63,46 @@ export function standaloneFooterActionEntries(entries) {
|
|
|
62
63
|
background: entry.kind === "ring" ? "background" : entry.background,
|
|
63
64
|
}));
|
|
64
65
|
}
|
|
65
|
-
function schemeFeatures(flags, navigation, brandText, logos) {
|
|
66
|
+
function schemeFeatures(flags, navigation, brandText, logos, themed = { light: [], dark: [] }) {
|
|
66
67
|
const paintedText = hasText(brandText) ? ["brandText"] : [];
|
|
67
68
|
// Nonbreaking whitespace has no ink but still gives the brand link a focusable box.
|
|
68
|
-
const forScheme = (hasLogo) =>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
const forScheme = (hasLogo, themeEnabled) => {
|
|
70
|
+
// A filled heading is measured on its fill instead of layer 2, so the fill flag replaces the plain one.
|
|
71
|
+
const base = themeEnabled.includes("footerHeadingFill") ? flags.filter(flag => flag !== "footerHeadings") : flags;
|
|
72
|
+
const filled = themeEnabled.includes("footerHeadingFill") && flags.includes("footerHeadings");
|
|
73
|
+
return {
|
|
74
|
+
flags: [
|
|
75
|
+
...base,
|
|
76
|
+
...themeEnabled.filter(flag => flag !== "footerHeadingFill" || filled),
|
|
77
|
+
...paintedText,
|
|
78
|
+
...(brandText || hasLogo ? ["brandLink"] : []),
|
|
79
|
+
],
|
|
80
|
+
navigation,
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
return { light: forScheme(logos.light, themed.light), dark: forScheme(logos.dark, themed.dark) };
|
|
84
|
+
}
|
|
85
|
+
const THEME_ENABLED_FLAGS = [
|
|
86
|
+
["buttonFocusOutline", "--esp-button-focus-color"],
|
|
87
|
+
["footerHeadingFill", "--esp-footer-heading-background"],
|
|
88
|
+
];
|
|
89
|
+
/** A color property is authored as a token or color string, or as a `{ source, lightness }` object. */
|
|
90
|
+
function isAuthoredColor(value) {
|
|
91
|
+
if (typeof value === "string")
|
|
92
|
+
return value.trim() !== "";
|
|
93
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
94
|
+
return false;
|
|
95
|
+
const { source } = value;
|
|
96
|
+
return typeof source === "string" && source.trim() !== "";
|
|
97
|
+
}
|
|
98
|
+
/** Espalier asks the consumer to set these flags when the theme authors the property, in the surface's own context. */
|
|
99
|
+
function themeFlags(themes, context) {
|
|
100
|
+
const forScheme = (theme) => {
|
|
101
|
+
const properties = { ...theme?.componentProperties, ...(context ? theme?.contexts?.[context]?.componentProperties : undefined) };
|
|
102
|
+
return THEME_ENABLED_FLAGS.filter(([, name]) => isAuthoredColor(properties[name]))
|
|
103
|
+
.map(([flag]) => flag);
|
|
104
|
+
};
|
|
105
|
+
return { light: forScheme(themes?.light), dark: forScheme(themes?.dark) };
|
|
73
106
|
}
|
|
74
107
|
// The slots match NavItemKind in Sites.proto.
|
|
75
108
|
const NAVIGATION_KIND_NAMES = ["", SITE_NAVIGATION_KINDS.page, SITE_NAVIGATION_KINDS.externalUrl, SITE_NAVIGATION_KINDS.groupHeader];
|