@taprootio/site-authoring 0.41.1 → 0.55.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 +50 -0
- package/examples/riverbend-wellness/settings/site-publishing-preferences.json +3 -0
- package/examples/riverbend-wellness/settings/taproot-styles.json +11 -0
- package/package.json +4 -3
- package/src/api.js +170 -11
- package/src/appearance-contract.js +278 -8
- package/src/authored-tag-names.js +88 -0
- package/src/block-flow.js +103 -1
- package/src/brand-color.js +39 -4
- package/src/breadcrumb-artwork.js +234 -0
- package/src/breadcrumb-separators.js +11 -0
- package/src/changelog.json +154 -0
- package/src/chrome-features.js +152 -0
- package/src/chrome-input.js +147 -0
- package/src/chrome-output.js +92 -0
- package/src/chrome-paint-catalog-taproot.json +52 -0
- package/src/chrome-report.js +173 -0
- package/src/cli.js +48 -17
- package/src/content/components.js +27 -4
- package/src/content/external-link.js +2 -1
- package/src/content/markdown.js +271 -101
- package/src/content/tiptap-prosemirror.ts +125 -43
- package/src/content/validate-document.js +4 -1
- package/src/content-inset.js +48 -0
- package/src/errors.js +1 -0
- package/src/espalier-shared.js +26 -0
- package/src/field-suggestions.js +40 -0
- package/src/fixture-init.js +22 -5
- package/src/font-catalog.js +11 -1
- package/src/footer-brand-inputs.js +25 -2
- package/src/footer-content.js +38 -0
- package/src/footer-contract.js +11 -0
- package/src/footer-cta-styles.js +6 -0
- package/src/footer-draft-hash.js +4 -2
- package/src/footer-fit.js +62 -15
- package/src/footer-workspace.js +60 -16
- package/src/header-presentation.js +16 -0
- package/src/latest-posts-tags.js +57 -0
- package/src/page-structure-checks.js +5 -0
- package/src/page-tag-badge-modes.js +6 -0
- package/src/page-tag-writes.js +158 -0
- package/src/page-type-tags.js +16 -0
- package/src/presentation-reference.js +312 -86
- package/src/recipe-page-options.js +22 -0
- package/src/recipe-step-contract.js +164 -0
- package/src/recipe-step-contract.json +65 -0
- package/src/reference-help.js +164 -78
- package/src/session.js +39 -24
- package/src/setting-reference.js +239 -48
- package/src/settings-catalog.js +63 -0
- package/src/site-check-findings.js +25 -5
- package/src/site-check-rules.json +3 -1
- package/src/site-health-findings.js +13 -13
- package/src/site-navigation-groups.js +70 -0
- package/src/styling-fixed-values.js +71 -0
- package/src/tag-destination-warnings.js +35 -0
- package/src/template-token-reach.json +242 -0
- package/src/theme-proposals.js +18 -27
- package/src/theme-resolve.js +305 -51
- package/src/theme-validation.js +126 -6
- package/src/token-reach.js +222 -0
- package/src/typed-page-reference.js +72 -15
- package/src/typed-pages.js +171 -71
- package/src/verbs/deploy.js +6 -0
- package/src/verbs/footer-push.js +30 -5
- package/src/verbs/forms-push.js +11 -3
- package/src/verbs/pages-delete.js +19 -10
- package/src/verbs/pages-push.js +125 -36
- package/src/verbs/plan.js +10 -4
- package/src/verbs/pull.js +277 -67
- package/src/verbs/staging-review.js +27 -1
- package/src/verbs/status.js +22 -0
- package/src/verbs/theme-push.js +249 -120
- package/src/verbs/theme-resolve.js +310 -47
- package/src/verbs/validate.js +71 -17
- package/src/workspace-check.js +37 -4
- package/src/workspace.js +37 -1
- package/test/fixtures/default-site-theme.json +516 -0
|
@@ -81,6 +81,7 @@ export const SITE_CHECK_WORDING = Object.freeze({
|
|
|
81
81
|
"seo.description_missing": () => "has no description; add a short account of what the page offers",
|
|
82
82
|
"seo.description_short": (finding) => `has a description of ${finding.detail} characters; consider adding useful detail (guidance: ${DESCRIPTION_MINIMUM_LENGTH}–${DESCRIPTION_WARN_LENGTH})`,
|
|
83
83
|
"seo.description_long": (finding) => `has a description of ${finding.detail} characters; consider shortening it (guidance: ${DESCRIPTION_MINIMUM_LENGTH}–${DESCRIPTION_WARN_LENGTH})`,
|
|
84
|
+
"seo.place_review_author_missing": () => "has no credited reviewer; Google review snippets require a reviewer name",
|
|
84
85
|
"seo.description_matches_title": () => "has a description that repeats its title; explain what readers will find",
|
|
85
86
|
"footer.word_breaks": (finding) => footerFindingWords(finding),
|
|
86
87
|
"brand.logo_on_surface": finding => {
|
|
@@ -88,6 +89,8 @@ export const SITE_CHECK_WORDING = Object.freeze({
|
|
|
88
89
|
const artwork = third ?? second;
|
|
89
90
|
return `the ${finding.subject === "footer" ? "footer" : "header"} shows ${artwork === "dark" ? "dark" : "light"}-background ${second === "compact" ? "compact " : ""}artwork against the opposite surface brightness in the ${scheme === "dark" ? "dark" : "light"} scheme; choose its other Logo variant or adjust its Colors context`;
|
|
90
91
|
},
|
|
92
|
+
"theme.chrome_report_name": () =>
|
|
93
|
+
"could not check report-name action contrast because its display eligibility is unknown",
|
|
91
94
|
"seo.social_image_fallback": (finding) =>
|
|
92
95
|
finding.detail === "first_image"
|
|
93
96
|
? "has no cover image; link previews use the page's first image only when it is public and at least 1200 pixels wide"
|
|
@@ -118,6 +121,7 @@ export const SITE_CHECK_REMEDIES = Object.freeze({
|
|
|
118
121
|
"seo.description_missing": `Add a short description of what the page offers, ${AFTER_PAGE_FIX}.`,
|
|
119
122
|
"seo.description_short": `Add useful detail so the description runs ${DESCRIPTION_MINIMUM_LENGTH}–${DESCRIPTION_WARN_LENGTH} characters, ${AFTER_PAGE_FIX}.`,
|
|
120
123
|
"seo.description_long": `Shorten the description to ${DESCRIPTION_MINIMUM_LENGTH}–${DESCRIPTION_WARN_LENGTH} characters, ${AFTER_PAGE_FIX}.`,
|
|
124
|
+
"seo.place_review_author_missing": `Assign a reviewer on the page, ${AFTER_PAGE_FIX}.`,
|
|
121
125
|
"seo.description_matches_title": `Rewrite the description to say what readers will find, not repeat the title, ${AFTER_PAGE_FIX}.`,
|
|
122
126
|
});
|
|
123
127
|
|
|
@@ -149,6 +153,9 @@ function footerFindingWords(finding) {
|
|
|
149
153
|
const widthName = Object.hasOwn(FOOTER_FIT_WIDTH_LABELS, width)
|
|
150
154
|
? FOOTER_FIT_WIDTH_LABELS[width].toLowerCase()
|
|
151
155
|
: undefined;
|
|
156
|
+
if (region === "aside-button") {
|
|
157
|
+
return `the footer button '${finding.subject}' may overflow ${widthName ? `at ${widthName} width` : "at this width"}. Shorten its label or choose a link style`;
|
|
158
|
+
}
|
|
152
159
|
const advice = FOOTER_REGION_ADVICE[region] ?? "Widen the region or shorten the text";
|
|
153
160
|
return `'${finding.subject}' may break mid-word ${widthName === undefined ? "at this width" : `at ${widthName} width`}. ${advice}`;
|
|
154
161
|
}
|
|
@@ -161,6 +168,18 @@ export function describeSiteFinding(finding) {
|
|
|
161
168
|
|
|
162
169
|
// Progress names this many; the JSON list is bounded by bytes instead.
|
|
163
170
|
export const MAXIMUM_PROGRESS_LINES = 20;
|
|
171
|
+
const metadataRules = new Set(METADATA_RULE_IDS);
|
|
172
|
+
|
|
173
|
+
function progressPriority({ rule, severity }) {
|
|
174
|
+
if (severity === "error") return 0;
|
|
175
|
+
return metadataRules.has(rule) ? 2 : 1;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Keep publish warnings ahead of recurring title and description advice in the capped terminal list. */
|
|
179
|
+
export function siteFindingsForProgress(items) {
|
|
180
|
+
return items.toSorted((left, right) => progressPriority(left) - progressPriority(right))
|
|
181
|
+
.slice(0, MAXIMUM_PROGRESS_LINES);
|
|
182
|
+
}
|
|
164
183
|
|
|
165
184
|
const rulesRunningAt = (point) => SITE_CHECK_RULES.filter((rule) => rule.runsAt.includes(point)).map((rule) => rule.id);
|
|
166
185
|
|
|
@@ -177,6 +196,7 @@ function structureFindingsFor(page) {
|
|
|
177
196
|
return pageStructureFindings(
|
|
178
197
|
{
|
|
179
198
|
freeForm,
|
|
199
|
+
reviewAuthorMissing: page.reviewAuthorMissing,
|
|
180
200
|
body: freeForm ? page.document : undefined,
|
|
181
201
|
...localAuthoringMetadata({
|
|
182
202
|
title: page.title,
|
|
@@ -218,8 +238,7 @@ export function evaluateOfflineSiteChecks({
|
|
|
218
238
|
for (const finding of [...linkFindings, ...structureFindingsFor(page)]) found.push({ page, finding });
|
|
219
239
|
}
|
|
220
240
|
for (const finding of footer.findings) found.push({ finding });
|
|
221
|
-
//
|
|
222
|
-
// matter most when a large site raises a frequent one (a missing description) on every page.
|
|
241
|
+
// Keep severity and catalogue order in the byte-capped JSON list.
|
|
223
242
|
const catalogueOrder = (ruleId) => SITE_CHECK_RULES.findIndex((rule) => rule.id === ruleId);
|
|
224
243
|
const severityOrder = (finding) => (finding.severity === "error" ? 0 : 1);
|
|
225
244
|
found.sort((left, right) =>
|
|
@@ -238,11 +257,12 @@ export function evaluateOfflineSiteChecks({
|
|
|
238
257
|
subject,
|
|
239
258
|
...(finding.detail === "" ? {} : { detail: finding.detail }),
|
|
240
259
|
};
|
|
241
|
-
if (items.length < MAXIMUM_PROGRESS_LINES) {
|
|
242
|
-
onProgress(`Warning: ${item.file} ${describeSiteFinding({ ...finding, subject })}.`);
|
|
243
|
-
}
|
|
244
260
|
items.push(item);
|
|
245
261
|
}
|
|
262
|
+
for (const item of siteFindingsForProgress(items)) {
|
|
263
|
+
const words = describeSiteFinding({ ruleId: item.rule, subject: item.subject, detail: item.detail ?? "" });
|
|
264
|
+
onProgress(`Warning: ${item.file} ${words}.`);
|
|
265
|
+
}
|
|
246
266
|
if (items.length > MAXIMUM_PROGRESS_LINES) {
|
|
247
267
|
onProgress(`Warning: ${items.length - MAXIMUM_PROGRESS_LINES} more site check finding(s); see findings.`);
|
|
248
268
|
}
|
|
@@ -33,8 +33,10 @@
|
|
|
33
33
|
{ "id": "seo.description_short", "severity": "warning", "scope": "document", "runsAt": ["validate", "edit", "deploy", "health"], "subject": "none", "detail": "character_count" },
|
|
34
34
|
{ "id": "seo.description_long", "severity": "warning", "scope": "document", "runsAt": ["validate", "edit", "deploy", "health"], "subject": "none", "detail": "character_count" },
|
|
35
35
|
{ "id": "seo.description_matches_title", "severity": "warning", "scope": "document", "runsAt": ["validate", "edit", "deploy", "health"], "subject": "none", "detail": "none" },
|
|
36
|
+
{ "id": "seo.place_review_author_missing", "severity": "warning", "scope": "document", "appliesTo": ["place_review"], "runsAt": ["validate", "deploy", "health"], "subject": "none", "detail": "none" },
|
|
36
37
|
{ "id": "seo.social_image_fallback", "severity": "warning", "scope": "document", "appliesTo": ["free_form"], "runsAt": ["edit"], "subject": "none", "detail": "social_image_source" },
|
|
37
38
|
{ "id": "footer.word_breaks", "severity": "warning", "scope": "site", "runsAt": ["validate", "edit", "deploy", "health"], "subject": "footer_word", "detail": "width_and_region" },
|
|
38
|
-
{ "id": "brand.logo_on_surface", "severity": "warning", "scope": "site", "runsAt": ["validate"], "subject": "surface", "detail": "scheme_and_variant" }
|
|
39
|
+
{ "id": "brand.logo_on_surface", "severity": "warning", "scope": "site", "runsAt": ["validate"], "subject": "surface", "detail": "scheme_and_variant" },
|
|
40
|
+
{ "id": "theme.chrome_report_name", "severity": "warning", "scope": "site", "runsAt": ["validate"], "subject": "none", "detail": "none" }
|
|
39
41
|
]
|
|
40
42
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { visitImageDescriptionObjects, imageDescriptionImageId } from "./content/image-description-document.js";
|
|
2
2
|
import { CLI_BINARY_NAME } from "./constants.js";
|
|
3
3
|
import { sanitizeDiagnostic } from "./errors.js";
|
|
4
|
-
import { AFTER_PAGE_FIX, describeSiteFinding, MAXIMUM_PROGRESS_LINES, remedyForRule } from "./site-check-findings.js";
|
|
4
|
+
import { AFTER_PAGE_FIX, describeSiteFinding, MAXIMUM_PROGRESS_LINES, remedyForRule, siteFindingsForProgress } from "./site-check-findings.js";
|
|
5
5
|
import { displayPagePath } from "./workspace.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -231,22 +231,22 @@ export function reportHealthProgress(onProgress, { environment, checkedAt, statu
|
|
|
231
231
|
// Every value here ends up on a terminal, and some come from the manifest or the server unchecked, so each is
|
|
232
232
|
// cleaned for display. The JSON result keeps the original values.
|
|
233
233
|
const safe = (value, fallback = "") => sanitizeDiagnostic(value, fallback);
|
|
234
|
-
const
|
|
235
|
-
...findings.filter((item) => item.newSinceProduction !== false).map((item) =>
|
|
236
|
-
`Warning: ${safe(item.file ?? item.path, "site")} ${
|
|
237
|
-
describeSiteFinding({ ruleId: safe(item.rule), subject: safe(item.subject), detail: safe(item.detail) })
|
|
238
|
-
}. Fix: ${safe(item.fix)}`
|
|
239
|
-
),
|
|
240
|
-
...imageFindings.filter((item) => item.newSinceProduction !== false).map(imageFindingLine),
|
|
241
|
-
];
|
|
234
|
+
const newFindings = [...findings, ...imageFindings].filter((item) => item.newSinceProduction !== false);
|
|
242
235
|
const scope = environment === "staging" && compared === false
|
|
243
236
|
? "not compared with production, so every warning is listed"
|
|
244
237
|
: environment === "staging"
|
|
245
|
-
? `${
|
|
238
|
+
? `${newFindings.length} new since production`
|
|
246
239
|
: "production";
|
|
247
240
|
onProgress(`Site health (${environment}, checked ${checkedAt}): ${total} finding(s), ${scope}.${incomplete}`);
|
|
248
|
-
for (const
|
|
249
|
-
|
|
250
|
-
|
|
241
|
+
for (const item of siteFindingsForProgress(newFindings)) {
|
|
242
|
+
if ("imageId" in item) {
|
|
243
|
+
onProgress(imageFindingLine(item));
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
const words = describeSiteFinding({ ruleId: safe(item.rule), subject: safe(item.subject), detail: safe(item.detail) });
|
|
247
|
+
onProgress(`Warning: ${safe(item.file ?? item.path, "site")} ${words}. Fix: ${safe(item.fix)}`);
|
|
248
|
+
}
|
|
249
|
+
if (newFindings.length > MAXIMUM_PROGRESS_LINES) {
|
|
250
|
+
onProgress(`Warning: ${newFindings.length - MAXIMUM_PROGRESS_LINES} more Site Health finding(s); see findings and imageFindings.`);
|
|
251
251
|
}
|
|
252
252
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Generated from shared/site-navigation-groups.ts by scripts/sync-field-validation.mjs. Do not edit.
|
|
2
|
+
import { isSafeUrl } from "./url-safety.js";
|
|
3
|
+
// Published navigation depth stays aligned with the API command validation cap.
|
|
4
|
+
export const MAX_NAVIGATION_DEPTH = 3;
|
|
5
|
+
export const SITE_NAVIGATION_KINDS = {
|
|
6
|
+
page: "NAV_ITEM_KIND_PAGE",
|
|
7
|
+
externalUrl: "NAV_ITEM_KIND_EXTERNAL_URL",
|
|
8
|
+
groupHeader: "NAV_ITEM_KIND_GROUP_HEADER",
|
|
9
|
+
};
|
|
10
|
+
/** Whether a page or external link without children can use button appearance. */
|
|
11
|
+
export function canStyleNavigationAsButton(kind, hasChildren, kinds = SITE_NAVIGATION_KINDS) {
|
|
12
|
+
return !hasChildren && (kind === kinds.page || kind === kinds.externalUrl);
|
|
13
|
+
}
|
|
14
|
+
/** Only top-level destination leaves can sit beside the header controls. */
|
|
15
|
+
export function canPlaceNavigationAtHeaderEnd(kind, depth, hasChildren, kinds = SITE_NAVIGATION_KINDS) {
|
|
16
|
+
return depth === 1 && canStyleNavigationAsButton(kind, hasChildren, kinds);
|
|
17
|
+
}
|
|
18
|
+
/** Rendering treatment after the navigation tree has been prepared. */
|
|
19
|
+
export function describeHeaderNavigationItem(item, kinds, buttonAppearance) {
|
|
20
|
+
const group = item.kind === kinds.groupHeader || (item.children?.length ?? 0) > 0;
|
|
21
|
+
const url = !group && item.url && isSafeUrl(item.url) ? item.url : "";
|
|
22
|
+
const button = Boolean(url) && item.appearance === buttonAppearance
|
|
23
|
+
&& canStyleNavigationAsButton(item.kind, group, kinds);
|
|
24
|
+
return { group, url, button };
|
|
25
|
+
}
|
|
26
|
+
/** Adapt old trees for rendering without changing their stored manifest or identities. */
|
|
27
|
+
export function normalizeSiteNavigationGroups(items, kinds) {
|
|
28
|
+
const usedIds = new Set();
|
|
29
|
+
const collect = (nodes) => {
|
|
30
|
+
for (const node of nodes) {
|
|
31
|
+
usedIds.add(node.id);
|
|
32
|
+
collect(node.children ?? []);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
collect(items);
|
|
36
|
+
const normalize = (item) => {
|
|
37
|
+
const children = (item.children ?? []).map(normalize);
|
|
38
|
+
if (children.length === 0)
|
|
39
|
+
return item;
|
|
40
|
+
const hasDestination = item.kind === kinds.page
|
|
41
|
+
? Boolean(item.resourceId?.trim())
|
|
42
|
+
: item.kind === kinds.externalUrl && Boolean(item.externalUrl?.trim());
|
|
43
|
+
if (hasDestination) {
|
|
44
|
+
// These opaque IDs exist only while rendering; persisted children get UUIDs from the API.
|
|
45
|
+
const base = `${item.id}-link`;
|
|
46
|
+
let id = base;
|
|
47
|
+
for (let suffix = 1; usedIds.has(id); suffix++)
|
|
48
|
+
id = `${base}-${suffix}`;
|
|
49
|
+
usedIds.add(id);
|
|
50
|
+
children.unshift({ ...item, id, children: [] });
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
...item,
|
|
54
|
+
kind: kinds.groupHeader,
|
|
55
|
+
resourceId: "",
|
|
56
|
+
externalUrl: "",
|
|
57
|
+
url: "",
|
|
58
|
+
children,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
return items.map(normalize);
|
|
62
|
+
}
|
|
63
|
+
/** Preserve the old depth boundary before adapting linked groups. */
|
|
64
|
+
export function prepareHeaderNavigation(items, kinds) {
|
|
65
|
+
const project = (nodes, depth) => nodes.map((item) => ({
|
|
66
|
+
...item,
|
|
67
|
+
children: depth < MAX_NAVIGATION_DEPTH ? project(item.children ?? [], depth + 1) : [],
|
|
68
|
+
}));
|
|
69
|
+
return normalizeSiteNavigationGroups(project(items, 1), kinds);
|
|
70
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function fact(name, value, where, source) {
|
|
2
|
+
return Object.freeze({ name, value, where, source });
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
const structuredPageTitleMargins = {
|
|
6
|
+
above: "0",
|
|
7
|
+
belowWithoutMetadata: "0.7em",
|
|
8
|
+
metadataGap: { factor: 0.9, token: "--esp-size-small", scaledBy: "blockSpacing" },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const APPEARANCE_FIXED_VALUES = Object.freeze([
|
|
12
|
+
fact(
|
|
13
|
+
"header.logoHeight",
|
|
14
|
+
{
|
|
15
|
+
barBase: { factor: 4.5, token: "--esp-size-small" },
|
|
16
|
+
brandLogoSize: { standard: 0.72, large: 0.85, full: 1 },
|
|
17
|
+
},
|
|
18
|
+
"The expanded limit multiplies the bar base by headerHeightMultiplier and the brandLogoSize factor. A fixed header "
|
|
19
|
+
+ "shrinks toward headerMinHeightMultiplier on scroll. Set --esp-header-brand-logo-max-width in theme componentProperties "
|
|
20
|
+
+ "to change the width cap for regular and compact artwork. With the default 12rem cap, a 5:1 logo renders at most "
|
|
21
|
+
+ "2.4rem (about 38px) tall at rest. brandHoverGrow enlarges the painted brand on hover.",
|
|
22
|
+
"esp-header --esp-header-brand-logo-size and Taproot header settings",
|
|
23
|
+
),
|
|
24
|
+
fact(
|
|
25
|
+
"blockFlow.outsideFlowContainers",
|
|
26
|
+
{ above: "--esp-size-small-to-normal", below: "--esp-size-tiny-to-small", structuredPageTitle: structuredPageTitleMargins },
|
|
27
|
+
"The fallback for plain h1–h5 headings outside a flow. Article, album, place review and recipe page titles "
|
|
28
|
+
+ "have no top margin. The title-to-metadata and byline-to-tags gaps both use 0.9 × --esp-size-small, "
|
|
29
|
+
+ "scaled by Block spacing. headingH1SpaceAfter can set the title-to-metadata gap in rem. "
|
|
30
|
+
+ "A title with no metadata keeps a 0.7em bottom margin. Recipe card headings, the footer aside, the legal title, legal "
|
|
31
|
+
+ "Contents and Summary of changes headings, and banners set their own margins.",
|
|
32
|
+
"esp-root and Taproot page styles",
|
|
33
|
+
),
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
const underline = Object.freeze({ rest: "underline", hover: "underline" });
|
|
37
|
+
const auto = Object.freeze({ rest: "auto", hover: "auto" });
|
|
38
|
+
|
|
39
|
+
export const FOOTER_LINK_DEFAULTS = Object.freeze({
|
|
40
|
+
column: { decoration: underline, offset: { rest: "0.18em", hover: "0.18em" }, thickness: auto },
|
|
41
|
+
bottom: { decoration: underline, offset: auto, thickness: auto },
|
|
42
|
+
brand: { decoration: { rest: "none", hover: "underline" }, offset: { rest: "auto", hover: "0.18em" }, thickness: auto },
|
|
43
|
+
asideCta: { decoration: underline, offset: auto, thickness: auto },
|
|
44
|
+
asideRichText: { decoration: underline, offset: auto, thickness: auto },
|
|
45
|
+
bottomRichText: { decoration: underline, offset: auto, thickness: auto },
|
|
46
|
+
social: { decoration: { rest: "underline", hover: "none" }, offset: auto, thickness: auto },
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const FOOTER_FIXED_VALUES = Object.freeze([
|
|
50
|
+
fact(
|
|
51
|
+
"footer.layoutBreakpoints",
|
|
52
|
+
{ wide: "above 64rem (1024px)", brandRow: "above 48rem (768px) through 64rem (1024px)", stacked: "48rem (768px) or less" },
|
|
53
|
+
"The footer content-box width selects the layout. A 768px viewport stacks.",
|
|
54
|
+
"esp-footer container query",
|
|
55
|
+
),
|
|
56
|
+
fact(
|
|
57
|
+
"footer.linkWeights",
|
|
58
|
+
{ column: "700", bottom: "700", brand: "400", asideCta: "400", asideCtaBoldLink: "700", asideRichText: "700", bottomRichText: "700", social: "400" },
|
|
59
|
+
"Weights in a newly created site's theme. Unclassed links use bold. In asideCtaStyle, link uses the body weight and "
|
|
60
|
+
+ "bold-link uses bold. Social links use the body weight. The configured brand uses the brand weight, with heading weight as its CSS fallback.",
|
|
61
|
+
"esp-root, esp-footer and Taproot's aside action",
|
|
62
|
+
),
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
export function formatFixedValues(fixedValues) {
|
|
66
|
+
if (!fixedValues?.length) return "";
|
|
67
|
+
return "\n\nFixed values\n" + fixedValues.map(({ name, value, where, source }) => {
|
|
68
|
+
const display = typeof value === "string" ? value : JSON.stringify(value);
|
|
69
|
+
return ` ${name} — ${display}\n ${where}\n Source: ${source}`;
|
|
70
|
+
}).join("\n") + "\n";
|
|
71
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isGonePage } from "./api.js";
|
|
2
|
+
import { boundedByBytes } from "./session.js";
|
|
3
|
+
|
|
4
|
+
const DESTINATION_SETTINGS = ["tagDestinations", "recipeMetadataDestinations"];
|
|
5
|
+
|
|
6
|
+
export function tagDestinationEntries(preferences) {
|
|
7
|
+
return DESTINATION_SETTINGS.flatMap((setting) =>
|
|
8
|
+
Object.entries(preferences?.[setting] ?? {})
|
|
9
|
+
.filter(([, resourceId]) => typeof resourceId === "string" && resourceId !== "")
|
|
10
|
+
.map(([name, resourceId]) => ({ setting, name, resourceId })),
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function missingTagDestinations(preferences, manifest) {
|
|
15
|
+
if (manifest === undefined || manifest.pagesTruncated === true) return [];
|
|
16
|
+
const knownPages = new Set(manifest.pages.filter((page) => page && !isGonePage(page)).map((page) => page.resourceId));
|
|
17
|
+
return tagDestinationEntries(preferences).filter(({ resourceId }) => !knownPages.has(resourceId));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function reportTagDestinationWarnings(items, onProgress, deletingPath) {
|
|
21
|
+
if (items.length === 0) return undefined;
|
|
22
|
+
const report = { count: items.length, ...boundedByBytes(items, 8 * 1024) };
|
|
23
|
+
const location = deletingPath === undefined
|
|
24
|
+
? "has a destination page absent from this workspace"
|
|
25
|
+
: "points to '" + deletingPath + "'";
|
|
26
|
+
for (const { setting, name } of report.items) {
|
|
27
|
+
onProgress(
|
|
28
|
+
"Warning: " + setting + " entry " + JSON.stringify(name) + " " + location
|
|
29
|
+
+ ". Badges render as plain text when the destination is unavailable. Update the destination in "
|
|
30
|
+
+ "settings/site-publishing-preferences.json and run 'taproot-site theme push'.",
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
if (report.truncated === true) onProgress("Additional tag destination warnings: " + (report.count - report.items.length) + ".");
|
|
34
|
+
return report;
|
|
35
|
+
}
|