@taprootio/site-authoring 0.61.0 → 0.64.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 +97 -23
- package/package.json +2 -2
- package/src/api.js +149 -21
- package/src/appearance-contract.js +27 -0
- package/src/article-appearance.js +19 -0
- package/src/article-appearance.json +9 -0
- package/src/article-end-settings.js +295 -0
- package/src/changelog.json +49 -0
- package/src/chrome-input.js +1 -1
- package/src/cli.js +110 -26
- package/src/constants.js +7 -0
- package/src/content/components.js +130 -14
- package/src/content/cta-decoration-paint.js +321 -0
- package/src/content/form-placement-presentation.js +91 -0
- package/src/content/form-placement-presentation.json +6 -0
- package/src/content/free-form-section-registry.json +19 -1
- package/src/content/free-form-sections.js +64 -55
- package/src/content/markdown.js +13 -0
- package/src/content/tiptap-prosemirror.ts +72 -59
- package/src/content/validate-document.js +2 -0
- package/src/cta-artwork-warnings.js +164 -0
- package/src/errors.js +6 -0
- package/src/field-schema.json +6 -2
- package/src/field-validation.js +14 -5
- package/src/footer-workspace.js +7 -3
- package/src/form-references.js +71 -9
- package/src/forms-contract.js +3 -5
- package/src/heading-outline.js +7 -0
- package/src/output.js +2 -0
- package/src/page-article-end.js +66 -0
- package/src/page-block-catalog.js +54 -0
- package/src/page-form-presentation.js +104 -0
- package/src/page-structure-checks.js +7 -1
- package/src/placed-image-ids.js +15 -18
- package/src/presentation-reference.js +31 -53
- package/src/reference-help.js +97 -27
- package/src/reusable-blocks.js +429 -0
- package/src/reusable-placements.js +271 -0
- package/src/setting-reference.js +57 -1
- package/src/settings-catalog.js +3 -0
- package/src/site-check-findings.js +30 -2
- package/src/site-check-rules.json +1 -0
- package/src/site-checks.js +26 -2
- package/src/site-health-findings.js +25 -3
- package/src/site-health-image-checks.js +1 -1
- package/src/staging-check.js +108 -21
- package/src/staging-served.js +5 -49
- package/src/status-warning-paints.js +17 -0
- package/src/template-token-reach.json +20 -2
- package/src/theme-resolve.js +27 -0
- package/src/transport.js +41 -5
- package/src/typed-page-reference.js +55 -5
- package/src/typed-pages.js +27 -4
- package/src/verbs/approve.js +2 -1
- package/src/verbs/deploy.js +93 -15
- package/src/verbs/footer-push.js +4 -2
- package/src/verbs/forms-push.js +9 -0
- package/src/verbs/health.js +11 -6
- package/src/verbs/index.js +3 -0
- package/src/verbs/pages-blocks-pull.js +22 -0
- package/src/verbs/pages-push.js +89 -34
- package/src/verbs/plan.js +34 -5
- package/src/verbs/pull.js +213 -124
- package/src/verbs/status.js +20 -2
- package/src/verbs/theme-push.js +170 -20
- package/src/verbs/theme-resolve.js +114 -40
- package/src/verbs/validate.js +49 -18
- package/src/workspace-check.js +42 -5
- package/src/workspace-context-usage.js +54 -1
- package/src/workspace.js +37 -7
- package/test/fixtures/default-site-theme.json +1 -1
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { LIMITS } from "./constants.js";
|
|
2
|
+
import { FREE_FORM_SECTION_REGISTRY, sectionBorderWidthProblem, sectionDecorationOptionProblems, sharedThemeContextNames } from "./content/free-form-sections.js";
|
|
3
|
+
import { CONTENT_LIMITS } from "./content/vocabulary.js";
|
|
4
|
+
import { isCanonicalUuid, sanitizeDiagnostic, SiteAuthoringError } from "./errors.js";
|
|
5
|
+
import { stableJson } from "./footer-draft-hash.js";
|
|
6
|
+
import { anyUnstorableString, isFormKey } from "./forms-contract.js";
|
|
7
|
+
import { requireReusableSurface } from "./reusable-blocks.js";
|
|
8
|
+
import { boundedByBytes } from "./session.js";
|
|
9
|
+
import { readWorkspaceJson, workspaceFileExists, workspaceImageFromReference, WORKSPACE_LIMITS } from "./workspace.js";
|
|
10
|
+
|
|
11
|
+
export const ARTICLE_END_FILE = "settings/article-end.json";
|
|
12
|
+
const MAX_RULES = 30;
|
|
13
|
+
const TEMPLATE_LABELS = Object.freeze({ article: "Article", recipe: "Recipe", album: "Album", "place-review": "Place review" });
|
|
14
|
+
const SECTION_ATTRIBUTES = FREE_FORM_SECTION_REGISTRY.section.attrs;
|
|
15
|
+
const DECORATION_FIELDS = Object.keys(SECTION_ATTRIBUTES.decoration.fields);
|
|
16
|
+
const DECORATION_WIRE_FIELDS = ["imageId", ...DECORATION_FIELDS.filter((key) => key !== "image")];
|
|
17
|
+
const CONTEXT_PATTERN = new RegExp(SECTION_ATTRIBUTES.context.pattern, "u");
|
|
18
|
+
|
|
19
|
+
function invalid(field, message) {
|
|
20
|
+
throw new SiteAuthoringError("theme.article_end_invalid", message, { field: ARTICLE_END_FILE + (field === "" ? "" : ":" + field) });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function closed(value, fields) {
|
|
24
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
25
|
+
&& Object.keys(value).every((field) => fields.includes(field));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const validSlug = (value) => typeof value === "string" && value.trim() !== "" && !anyUnstorableString(value);
|
|
29
|
+
|
|
30
|
+
function checkBand(band, path) {
|
|
31
|
+
if (!closed(band, ["context", "surface", "borderBlockStartWidth", "decoration"])) {
|
|
32
|
+
invalid(path, "Write a section band with optional context, surface, top border and decoration.");
|
|
33
|
+
}
|
|
34
|
+
if (band.context !== undefined
|
|
35
|
+
&& (typeof band.context !== "string" || CONTEXT_PATTERN.exec(band.context)?.[0] !== band.context)) {
|
|
36
|
+
invalid(`${path}/context`, "Choose a named theme context.");
|
|
37
|
+
}
|
|
38
|
+
if (band.surface !== undefined && !SECTION_ATTRIBUTES.surface.values.includes(band.surface)) {
|
|
39
|
+
invalid(`${path}/surface`, "Choose none, raised or elevated for the section surface.");
|
|
40
|
+
}
|
|
41
|
+
const borderProblem = sectionBorderWidthProblem(band.borderBlockStartWidth);
|
|
42
|
+
if (borderProblem !== null) invalid(`${path}/borderBlockStartWidth`, `The top border width must be ${borderProblem}.`);
|
|
43
|
+
if (band.decoration === undefined) return;
|
|
44
|
+
if (!closed(band.decoration, DECORATION_FIELDS)) invalid(`${path}/decoration`, "Use the Section decoration fields and an owned image.");
|
|
45
|
+
const { image } = band.decoration;
|
|
46
|
+
const usableReference = typeof image === "string" && image.trim() !== "" && image.length <= CONTENT_LIMITS.imageReferenceLength
|
|
47
|
+
&& !anyUnstorableString(image);
|
|
48
|
+
if (!usableReference && (!closed(image, ["imageId"]) || !isCanonicalUuid(image.imageId))) {
|
|
49
|
+
invalid(`${path}/decoration/image`, "Choose a workspace media path or an owned image by its imageId.");
|
|
50
|
+
}
|
|
51
|
+
const [problem] = sectionDecorationOptionProblems(band.decoration, `${path}/decoration`);
|
|
52
|
+
if (problem !== undefined) invalid(problem.path, problem.message);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function checkShape(data) {
|
|
56
|
+
if (!closed(data, ["defaultCtaKey", "defaultBand", "rules"])) invalid("", "Write an article-end settings object.");
|
|
57
|
+
if (data.defaultCtaKey !== undefined && !isFormKey(data.defaultCtaKey)) {
|
|
58
|
+
invalid("/defaultCtaKey", "Choose a reusable CTA key.");
|
|
59
|
+
}
|
|
60
|
+
if (data.defaultBand !== undefined) {
|
|
61
|
+
if (data.defaultCtaKey === undefined) invalid("/defaultCtaKey", "Choose a default reusable CTA for this band.");
|
|
62
|
+
checkBand(data.defaultBand, "/defaultBand");
|
|
63
|
+
}
|
|
64
|
+
const rules = data.rules === undefined ? [] : data.rules;
|
|
65
|
+
if (!Array.isArray(rules) || rules.length > MAX_RULES) invalid("/rules", "Write an ordered list of up to 30 rules.");
|
|
66
|
+
const bySlug = new Map();
|
|
67
|
+
const byId = new Set();
|
|
68
|
+
rules.forEach((rule, index) => {
|
|
69
|
+
const field = "/rules/" + index;
|
|
70
|
+
if (!closed(rule, ["template", "ctaKey", "tag", "tagId", "band"])) invalid(field, "Write template, ctaKey and an optional tag or section band.");
|
|
71
|
+
if (typeof rule.template !== "string" || !Object.hasOwn(TEMPLATE_LABELS, rule.template)) invalid(field + "/template", "Choose article, recipe, album or place-review.");
|
|
72
|
+
if (!isFormKey(rule.ctaKey)) invalid(field + "/ctaKey", "Choose a reusable CTA key.");
|
|
73
|
+
if ((rule.tag !== undefined && !validSlug(rule.tag)) ||
|
|
74
|
+
(rule.tagId !== undefined && (rule.tag === undefined || !isCanonicalUuid(rule.tagId)))) {
|
|
75
|
+
invalid(field + "/tag", "Use a tag slug and its optional stable tagId.");
|
|
76
|
+
}
|
|
77
|
+
if (rule.band !== undefined) checkBand(rule.band, `${field}/band`);
|
|
78
|
+
const slugPair = rule.template + "/" + (rule.tag ?? "");
|
|
79
|
+
const idPair = rule.template + "/" + rule.tagId;
|
|
80
|
+
const unresolved = rule.tagId === undefined;
|
|
81
|
+
if ((bySlug.has(slugPair) && (unresolved || bySlug.get(slugPair))) || (!unresolved && byId.has(idPair))) {
|
|
82
|
+
invalid(field, "Keep one rule for each template and tag combination.");
|
|
83
|
+
}
|
|
84
|
+
bySlug.set(slugPair, unresolved);
|
|
85
|
+
if (rule.tagId !== undefined) byId.add(idPair);
|
|
86
|
+
});
|
|
87
|
+
return { ...data, rules };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function mapBands(document, project) {
|
|
91
|
+
return {
|
|
92
|
+
...document,
|
|
93
|
+
...(document.defaultBand === undefined ? {} : { defaultBand: project(document.defaultBand, "/defaultBand") }),
|
|
94
|
+
rules: document.rules.map((rule, index) => rule.band === undefined
|
|
95
|
+
? rule
|
|
96
|
+
: { ...rule, band: project(rule.band, `/rules/${index}/band`) }),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function bandContexts(style) {
|
|
101
|
+
return style === undefined ? undefined : new Set(sharedThemeContextNames(style.lightTheme, style.darkTheme));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function confirmBandContext(band, path, contexts) {
|
|
105
|
+
if (band.context !== undefined && contexts !== undefined && !contexts.has(band.context)) {
|
|
106
|
+
invalid(`${path}/context`, "Choose a band context defined by both workspace themes.");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export async function readArticleEndWorkspace(workspaceDir, authoringSurface, evidence) {
|
|
111
|
+
if (!await workspaceFileExists(workspaceDir, ARTICLE_END_FILE)) return undefined;
|
|
112
|
+
requireReusableSurface(authoringSurface);
|
|
113
|
+
const document = checkShape(await readWorkspaceJson(workspaceDir, ARTICLE_END_FILE, WORKSPACE_LIMITS.settingsBytes));
|
|
114
|
+
if (evidence === undefined) return document;
|
|
115
|
+
const { knownImageIds, mediaManifest, style } = evidence;
|
|
116
|
+
const contexts = bandContexts(style);
|
|
117
|
+
return mapBands(document, (band, path) => {
|
|
118
|
+
confirmBandContext(band, path, contexts);
|
|
119
|
+
if (band.decoration === undefined) return band;
|
|
120
|
+
const { image } = band.decoration;
|
|
121
|
+
const imageId = typeof image === "string" ? workspaceImageFromReference(mediaManifest, image)?.imageId : image.imageId;
|
|
122
|
+
if (!isCanonicalUuid(imageId) || (knownImageIds !== undefined && !knownImageIds.has(imageId))) {
|
|
123
|
+
invalid(`${path}/decoration/image`, "Choose an owned image recorded by media upload or a settings pull.");
|
|
124
|
+
}
|
|
125
|
+
return { ...band, decoration: { ...band.decoration, image: { imageId } } };
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function bandFromPresentation(band) {
|
|
130
|
+
if (band?.decoration === undefined) return band;
|
|
131
|
+
if (!closed(band.decoration, DECORATION_WIRE_FIELDS)) {
|
|
132
|
+
invalid("", "The site returned invalid section band decoration.");
|
|
133
|
+
}
|
|
134
|
+
const { imageId, ...decoration } = band.decoration;
|
|
135
|
+
return { ...band, decoration: { ...decoration, image: { imageId } } };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function articleEndImageIds(document) {
|
|
139
|
+
const bands = [document.defaultBand, ...document.rules.map((rule) => rule.band)];
|
|
140
|
+
return [...new Set(bands.map((band) => band?.decoration?.image?.imageId).filter(isCanonicalUuid))].sort();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function readArticleEndPresentation(presentation) {
|
|
144
|
+
const articleEnd = presentation?.articleEnd;
|
|
145
|
+
if (articleEnd === undefined) return undefined;
|
|
146
|
+
const tags = presentation.tagDestinationCatalog?.authoredTags ?? [];
|
|
147
|
+
try {
|
|
148
|
+
if (articleEnd === null || typeof articleEnd !== "object" || Array.isArray(articleEnd) ||
|
|
149
|
+
(articleEnd.rules !== undefined && !Array.isArray(articleEnd.rules))) invalid("", "The site returned invalid rules.");
|
|
150
|
+
const rules = (articleEnd.rules ?? []).map((rule) => {
|
|
151
|
+
if (rule === null || typeof rule !== "object" || Array.isArray(rule)) invalid("", "The site returned an invalid rule.");
|
|
152
|
+
const { template, ctaKey, tagId, tagSlug, band } = rule;
|
|
153
|
+
return {
|
|
154
|
+
template, ctaKey,
|
|
155
|
+
...(tagId === undefined ? {} : { tag: tagSlug, tagId }),
|
|
156
|
+
...(band === undefined ? {} : { band: bandFromPresentation(band) }),
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
if (!Array.isArray(tags) || tags.some((tag) => !isCanonicalUuid(tag?.id) || !validSlug(tag.slug) || typeof tag.name !== "string")) {
|
|
160
|
+
invalid("", "The site returned an invalid tag catalog.");
|
|
161
|
+
}
|
|
162
|
+
const { defaultCtaKey, defaultBand } = articleEnd;
|
|
163
|
+
return { document: checkShape({
|
|
164
|
+
...(defaultCtaKey === undefined ? {} : { defaultCtaKey }),
|
|
165
|
+
...(defaultBand === undefined ? {} : { defaultBand: bandFromPresentation(defaultBand) }),
|
|
166
|
+
rules,
|
|
167
|
+
}), tags };
|
|
168
|
+
} catch (error) {
|
|
169
|
+
if (!(error instanceof SiteAuthoringError)) throw error;
|
|
170
|
+
throw new SiteAuthoringError("api.article_end_contract", "Taproot returned invalid article-end settings.", { field: "articleEnd" });
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function resolveArticleEndWorkspace(document, { definitions, tags, style, onProgress = () => {} } = {}) {
|
|
175
|
+
if (document === undefined) return undefined;
|
|
176
|
+
const contexts = bandContexts(style);
|
|
177
|
+
const authored = mapBands(document, (band, path) => {
|
|
178
|
+
confirmBandContext(band, path, contexts);
|
|
179
|
+
if (band.decoration === undefined) return band;
|
|
180
|
+
const { image, ...decoration } = band.decoration;
|
|
181
|
+
if (!isCanonicalUuid(image?.imageId)) invalid(`${path}/decoration/image`, "Record this image with media upload before using it in a band.");
|
|
182
|
+
return { ...band, decoration: { ...decoration, imageId: image.imageId } };
|
|
183
|
+
});
|
|
184
|
+
const ctas = definitions?.filter((row) => row.cta !== undefined);
|
|
185
|
+
const byCta = ctas === undefined ? undefined : new Map(ctas.map((row) => [row.key, row.name ?? row.label]));
|
|
186
|
+
function confirmCta(key, field) {
|
|
187
|
+
if (byCta !== undefined && !byCta.has(key)) invalid(field, "Choose a reusable CTA from settings/reusable-blocks.json.");
|
|
188
|
+
}
|
|
189
|
+
if (document.defaultCtaKey !== undefined) confirmCta(document.defaultCtaKey, "/defaultCtaKey");
|
|
190
|
+
const bySlug = tags === undefined ? undefined : new Map(tags.map((tag) => [tag.slug, tag]));
|
|
191
|
+
const wholeTemplate = new Set();
|
|
192
|
+
const rules = authored.rules.map((rule, index) => {
|
|
193
|
+
const field = "/rules/" + index;
|
|
194
|
+
const { template, ctaKey, tag, tagId, band } = rule;
|
|
195
|
+
const choice = { template, ctaKey, ...(band === undefined ? {} : { band }) };
|
|
196
|
+
confirmCta(ctaKey, field + "/ctaKey");
|
|
197
|
+
if (wholeTemplate.has(template)) onProgress("Warning: Article-end rule " + (index + 1) +
|
|
198
|
+
" is shadowed by an earlier rule for every " + TEMPLATE_LABELS[template] + ".");
|
|
199
|
+
if (tag === undefined) {
|
|
200
|
+
wholeTemplate.add(template);
|
|
201
|
+
return choice;
|
|
202
|
+
}
|
|
203
|
+
const known = bySlug?.get(tag);
|
|
204
|
+
if (bySlug !== undefined && (known === undefined || (tagId !== undefined && tagId !== known.id))) {
|
|
205
|
+
invalid(field + "/tag", "This site tag changed or is unavailable. Run 'taproot-site pull --settings-only' and choose the tag again.");
|
|
206
|
+
}
|
|
207
|
+
return { ...choice, tagSlug: tag, tagId: known?.id ?? tagId };
|
|
208
|
+
});
|
|
209
|
+
if (byCta === undefined && (document.defaultCtaKey !== undefined || rules.length > 0)) {
|
|
210
|
+
onProgress("Article-end CTA checks are unavailable. Pull settings/reusable-blocks.json with a Design key.");
|
|
211
|
+
}
|
|
212
|
+
if (bySlug === undefined && rules.some((rule) => rule.tagSlug !== undefined)) {
|
|
213
|
+
onProgress("Article-end tag checks are unavailable. Run 'taproot-site pull --settings-only' with a Design key.");
|
|
214
|
+
}
|
|
215
|
+
return { ...authored, rules };
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export function requireSavedArticleEndBands(submitted, saved) {
|
|
219
|
+
if (submitted === undefined) return;
|
|
220
|
+
function choices(settings) {
|
|
221
|
+
const bands = (settings?.rules ?? []).flatMap((rule) => rule.band === undefined ? [] : [[ruleIdentity(rule), rule.band]]);
|
|
222
|
+
return { defaultBand: settings?.defaultBand, rules: Object.fromEntries(bands) };
|
|
223
|
+
}
|
|
224
|
+
const resolved = resolveArticleEndWorkspace(saved);
|
|
225
|
+
if (stableJson(choices(submitted)) !== stableJson(choices(resolved))) {
|
|
226
|
+
throw new SiteAuthoringError("api.article_end_contract", "Taproot did not confirm the submitted article-end bands. Pull settings to check the saved selection.", {
|
|
227
|
+
field: ARTICLE_END_FILE,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function ruleIdentity(rule) {
|
|
233
|
+
return `${rule.template}/${rule.tagId ?? rule.tagSlug ?? ""}`;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function bandLabel(band) {
|
|
237
|
+
return [
|
|
238
|
+
"Full-width section band",
|
|
239
|
+
band.context === undefined ? undefined : `context ${sanitizeDiagnostic(band.context, "")}`,
|
|
240
|
+
band.surface === undefined || band.surface === "none" ? undefined : `${band.surface} surface`,
|
|
241
|
+
band.borderBlockStartWidth > 0 ? `${band.borderBlockStartWidth}px top border` : undefined,
|
|
242
|
+
band.decoration === undefined ? undefined : "decorative artwork",
|
|
243
|
+
].filter(Boolean).join(", ");
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** Labels and order are enough to read a rule change without copying raw settings into the report. */
|
|
247
|
+
export function articleEndChanges(previous, proposed, currentDefinitions, nextDefinitions, tags) {
|
|
248
|
+
if (proposed === undefined || stableJson(previous) === stableJson(proposed)) return undefined;
|
|
249
|
+
const tagNames = new Map(tags.map((tag) => [tag.id, tag.name]));
|
|
250
|
+
const previousRules = new Map(previous.rules.map((rule) => [ruleIdentity(rule), rule]));
|
|
251
|
+
function labels(settings, definitions, compareBands = false) {
|
|
252
|
+
const names = new Map((definitions ?? []).map((row) => [row.key, row.name]));
|
|
253
|
+
const ctaLabel = (key) => sanitizeDiagnostic(names.get(key) ?? key, key);
|
|
254
|
+
return {
|
|
255
|
+
defaultCta: settings.defaultCtaKey === undefined ? "Off" : ctaLabel(settings.defaultCtaKey),
|
|
256
|
+
...(settings.defaultBand === undefined ? {} : { defaultBand: bandLabel(settings.defaultBand) }),
|
|
257
|
+
...(compareBands && stableJson(previous.defaultBand) !== stableJson(settings.defaultBand) ? { defaultBandChanged: true } : {}),
|
|
258
|
+
rules: settings.rules.map((rule) => ({
|
|
259
|
+
template: TEMPLATE_LABELS[rule.template],
|
|
260
|
+
cta: ctaLabel(rule.ctaKey),
|
|
261
|
+
tag: sanitizeDiagnostic(tagNames.get(rule.tagId) ?? rule.tagSlug ?? "Any tag", "Tag unavailable"),
|
|
262
|
+
...(rule.band === undefined ? {} : { band: bandLabel(rule.band) }),
|
|
263
|
+
...(compareBands && stableJson(previousRules.get(ruleIdentity(rule))?.band) !== stableJson(rule.band) ? { bandChanged: true } : {}),
|
|
264
|
+
})),
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
return { current: labels(previous, currentDefinitions), proposed: labels(proposed, nextDefinitions, true) };
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export function reportArticleEndChanges(result, changes, onProgress) {
|
|
271
|
+
if (changes === undefined) return result;
|
|
272
|
+
if (changes.current.defaultCta !== changes.proposed.defaultCta) {
|
|
273
|
+
onProgress("Article-end default changes from " + changes.current.defaultCta + " to " + changes.proposed.defaultCta + ".");
|
|
274
|
+
}
|
|
275
|
+
if (changes.proposed.defaultBandChanged) {
|
|
276
|
+
const before = changes.current.defaultBand ?? "Inline CTA";
|
|
277
|
+
const after = changes.proposed.defaultBand ?? "Inline CTA";
|
|
278
|
+
onProgress(before === after
|
|
279
|
+
? `Article-end default section band changes. ${after}.`
|
|
280
|
+
: `Article-end default band changes from ${before} to ${after}.`);
|
|
281
|
+
}
|
|
282
|
+
changes.proposed.rules.forEach((rule, index) => {
|
|
283
|
+
const placement = rule.band === undefined ? "" : ` (${rule.band})`;
|
|
284
|
+
const change = !rule.bandChanged ? "" : rule.band === undefined ? " The section band is removed." : " The section band changes.";
|
|
285
|
+
onProgress(`Article-end rule ${index + 1} uses ${rule.cta} for ${rule.template}, ${rule.tag}${placement}.${change}`);
|
|
286
|
+
});
|
|
287
|
+
if (changes.proposed.rules.length === 0 && changes.current.rules.length > 0) onProgress("Article-end rules will be cleared.");
|
|
288
|
+
const room = LIMITS.githubOutputBytes - Buffer.byteLength(JSON.stringify(result), "utf8") - 1024;
|
|
289
|
+
if (room < 512) return result;
|
|
290
|
+
const directions = Object.entries(changes).map(([key, section]) => {
|
|
291
|
+
const { items: rules, truncated } = boundedByBytes(section.rules, Math.floor(room / 2));
|
|
292
|
+
return [key, { ...section, rules, ...(truncated ? { truncated: true } : {}) }];
|
|
293
|
+
});
|
|
294
|
+
return { ...result, articleEndChanges: Object.fromEntries(directions) };
|
|
295
|
+
}
|
package/src/changelog.json
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
|
+
{
|
|
4
|
+
"version": "0.64.0",
|
|
5
|
+
"note": "Article-end CTA bands, section borders, reusable newsletter signup panels and page-aware staging diagnostics.",
|
|
6
|
+
"behavior": [
|
|
7
|
+
"The Scrim switch in the page CTA editor and reusable CTA dialog turns the overlay on or off. It covers the full panel when on and leaves the configured artwork opacity alone when off.",
|
|
8
|
+
"Set decoration.scrimEnabled in Markdown and ProseMirror CTA data or in reusable CTA settings. Existing artScrim values keep their meaning when the switch is unset. See help component cta.",
|
|
9
|
+
"Set borderBlockStartWidth to a whole number from 0 to 20 in the Section editor, Markdown or ProseMirror. The border follows the section's theme context.",
|
|
10
|
+
"Set decoration.sizeMode to natural with repeat-x or repeat-y to retain the tile's intrinsic size. Omit both percentage sizes when natural is set. See help sections.",
|
|
11
|
+
"Form versions can set presentation.hideRequiredLegend to hide the visible explanatory note. Required fields retain their individual indicators and validation. See help forms.",
|
|
12
|
+
"Staging health compares image warnings by the affected pages. A warning is new when the image affects an additional page. The report flags groups that could not be compared. Stage changes gives authors with Design access a direct Site preferences instruction for a known draft-only reusable definition.",
|
|
13
|
+
"Use defaultBand or a rule's band in settings/article-end.json to place its CTA in a full-width Section with an optional context, top border and decorative artwork. An omitted band keeps its own placement inline. See help walkthrough and help sections.",
|
|
14
|
+
"Set heading, introduction, finePrint and context on a direct Form placement or a reusable Form definition. Add a privacy link with finePrint.linkLabel and finePrint.linkUrl. Save a new context in both themes with theme push before pushing a direct Form that uses it. Stage publishing preferences to update pages that use a reusable key. See help component form and help forms.",
|
|
15
|
+
"The help reference version is 89."
|
|
16
|
+
],
|
|
17
|
+
"help": ["component", "theme", "sections", "forms", "delivery", "walkthrough"]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"version": "0.63.0",
|
|
21
|
+
"note": "Named theme contexts report usage, and refused promotions explain when to restage or review the current stage.",
|
|
22
|
+
"behavior": [
|
|
23
|
+
"On Standard sites, use pull --settings-only with Design access to edit reusable CTA and Form definitions in settings/reusable-blocks.json. theme push and --dry-run report additions and edits, and validate checks targets and contrast against the workspace candidate. Use pages blocks pull with Content access to refresh placement choices in the workspace manifest.",
|
|
24
|
+
"Place a reusable CTA or Form in Markdown or ProseMirror using reusableKey as the only data field. pages push and plan check draft keys and types with Content access. Include publishing preferences in a release for a definition only in draft; draft evidence cannot verify the selected release. validate checks available draft CTA and Form evidence, including compact layout. See help page article and help component cta or form.",
|
|
25
|
+
"CTA Markdown and ProseMirror accept an owned decoration image and an optional dark image behind the panel content. Use original colors or a theme-tinted mask, place the image or repeat a tile, and set the scrim and compact visibility. validate reports possible low contrast in each scheme. See help component cta and help theme.",
|
|
26
|
+
"Place a form between article paragraphs and use layout: compact for a signup with one required contact email and one consent checkbox. A release with an ineligible form version uses the standard layout. See help component form and help forms for newsletter confirmation, sending and export.",
|
|
27
|
+
"Configure a default CTA and ordered template or tag rules in settings/article-end.json. Design pull --settings-only records exact tag IDs. Validate and theme push share the rules, and dry run shows the before and after order.",
|
|
28
|
+
"On a Standard article, recipe, album or place review, put articleEnd: false in Markdown front matter or the ProseMirror page wrapper to omit the site's article-end call to action. Omit it or use true to follow the site rules. Pull an existing page before changing its preference.",
|
|
29
|
+
"Run taproot-site deploy --reset-staging to restore the live release on authenticated Standard staging. Drafts and approvals stay available, production keeps serving the same deployment, and the saved promotion selection is kept. If staging already matches production, resetStatus is unchanged. Run deploy --staging with a new candidate before promoting.",
|
|
30
|
+
"Espalier 7.11.0 adds --esp-pre-background, --esp-pre-color and --esp-pre-shadow for preformatted code. Long lines scroll within the block. Standard sites can opt in to a keyboard-accessible Copy button with codeCopyEnabled in site publishing preferences, including member content after unlock.",
|
|
31
|
+
"theme resolve reports contextUsage with workspace or site scope, page evidence status, and per-context header, footer, listingCards, sections and ctas in text and JSON. It scans workspace pages once and counts only the readable, valid sources. A verified empty workspace counts zero. --site reads presentation settings and leaves page counts null. Each unavailable setting has a null count of its own. --context selects one name.",
|
|
32
|
+
"Production promotion reports deploy.stage_again when Taproot cannot repeat the staged selection and deploy.stage_updating while it is updating the release. Status identifies the current acknowledged stage and shows the exact promotion command when that stage can be retried after review. See deploy --help and status --help.",
|
|
33
|
+
"A failed stage returns Taproot's available reason as error.reason in JSON. Status stops offering a promotion retry when that stage's production base has changed. A page CTA and a reusable CTA can share decorative artwork without blocking staging or asking for a default image description.",
|
|
34
|
+
"help settings explains how to check reusable-block removals in a pulled workspace and when the live write checks retained releases. help forms explains how to set a custom Newsletter confirmation message.",
|
|
35
|
+
"An approved last-child move can stage and publish an explicit folder redirect in the same release. A stage that retains the folder lists the redirect in redirects.waitingForMove. The article redirect becomes durable after promotion.",
|
|
36
|
+
"contextUsage.omitted counts rows that did not fit the JSON, and an unfiltered report can carry contextUsage.narrowWith. contextUsageOmitted is true when only the omission marker fits. The text view still shows the rows. Status warnings keep their existing usage and location details. See help theme.",
|
|
37
|
+
"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.",
|
|
38
|
+
"The help reference version is 88."
|
|
39
|
+
],
|
|
40
|
+
"help": ["theme", "preview", "component", "forms", "page", "pages", "settings"]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"version": "0.62.0",
|
|
44
|
+
"note": "Article publication dates follow the byline, and article title sizing and inline code have their own appearance settings.",
|
|
45
|
+
"behavior": [
|
|
46
|
+
"An article with a displayDate emits that day in the site's time zone as BlogPosting.datePublished. Without displayDate it emits the recorded first publication. dateModified still tracks published content edits. Regenerate and publish the site to update its served article HTML.",
|
|
47
|
+
"Edit settings/taproot-styles.json to adjust article inline code fill, padding, border and shadow, or change the article title's mobile size, desktop size and scaling viewport. The fields are independent. Validate and save with theme push, then stage the Taproot styles and promote the release.",
|
|
48
|
+
"The help reference version is 86."
|
|
49
|
+
],
|
|
50
|
+
"help": ["appearance", "settings"]
|
|
51
|
+
},
|
|
3
52
|
{
|
|
4
53
|
"version": "0.61.0",
|
|
5
54
|
"note": "Feedback from building jereme.net on 0.59.0: a deleted page's path can take a redirect, legal roles and keys are checked before a push, refused fields carry Taproot's reason, Espalier 7.9.0 and 7.10.0 add button, header and heading controls, and listing cards take a site default.",
|
package/src/chrome-input.js
CHANGED
|
@@ -43,7 +43,7 @@ export function selectNameReportEligibility({ saved, current, manifest }) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function isSettingsOnly(resources) {
|
|
46
|
-
return resources.settingsOnly === true || resources.manifest?.authoringSurface !== undefined;
|
|
46
|
+
return resources.settingsOnly === true || resources.manifest?.settingsOnly === true || resources.manifest?.authoringSurface !== undefined;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/** Take optional workspace evidence while the caller still owns its read snapshot. */
|