@taprootio/site-authoring 0.42.0 → 0.56.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 +110 -12
- 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 +242 -23
- package/src/appearance-contract.js +264 -3
- package/src/authored-tag-names.js +88 -0
- package/src/authors-contract.js +71 -3
- package/src/block-flow.js +103 -1
- package/src/brand-color.js +22 -0
- package/src/breadcrumb-artwork.js +234 -0
- package/src/breadcrumb-separators.js +11 -0
- package/src/changelog.json +160 -0
- package/src/chrome-features.js +6 -2
- package/src/chrome-input.js +1 -0
- package/src/chrome-paint-catalog-taproot.json +3 -3
- package/src/chrome-report.js +91 -12
- package/src/cli.js +136 -38
- package/src/constants.js +1 -0
- 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 +22 -3
- package/src/footer-content.js +1 -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 +44 -7
- package/src/latest-posts-tags.js +57 -0
- package/src/page-metadata.js +15 -13
- 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 +297 -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 +182 -79
- 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 +23 -5
- package/src/site-check-rules.json +1 -0
- package/src/site-health-findings.js +13 -13
- 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 +265 -23
- package/src/theme-validation.js +118 -7
- package/src/token-reach.js +222 -0
- package/src/typed-page-reference.js +94 -16
- package/src/typed-pages.js +233 -74
- package/src/verbs/authors.js +198 -33
- 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/index.js +4 -2
- package/src/verbs/pages-delete.js +19 -10
- package/src/verbs/pages-push.js +225 -71
- package/src/verbs/plan.js +10 -4
- package/src/verbs/pull.js +324 -69
- package/src/verbs/staging-review.js +27 -1
- package/src/verbs/status.js +22 -0
- package/src/verbs/theme-push.js +93 -25
- package/src/verbs/theme-resolve.js +189 -55
- package/src/verbs/validate.js +6 -5
- package/src/workspace-check.js +35 -3
- package/src/workspace.js +73 -2
- package/test/fixtures/default-site-theme.json +516 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Generated from shared/recipe-page-options.ts by scripts/sync-field-validation.mjs. Do not edit.
|
|
2
|
+
export const RECIPE_JUMP_CONTROLS = ["none", "link", "button"];
|
|
3
|
+
export const DEFAULT_RECIPE_JUMP_CONTROL = RECIPE_JUMP_CONTROLS[0];
|
|
4
|
+
export const RECIPE_TAGS_ICONS = ["info", "tags", "category", "none"];
|
|
5
|
+
export const DEFAULT_RECIPE_TAGS_ICON = RECIPE_TAGS_ICONS[0];
|
|
6
|
+
export const RECIPE_TAGS_CONTENT = ["tags", "metadata", "both"];
|
|
7
|
+
export const DEFAULT_RECIPE_TAGS_CONTENT = RECIPE_TAGS_CONTENT[0];
|
|
8
|
+
export function normalizeRecipeTagsContent(value) {
|
|
9
|
+
return RECIPE_TAGS_CONTENT.find(option => option === value) ?? DEFAULT_RECIPE_TAGS_CONTENT;
|
|
10
|
+
}
|
|
11
|
+
export function isRecipeJumpControl(value) {
|
|
12
|
+
return RECIPE_JUMP_CONTROLS.some(option => option === value);
|
|
13
|
+
}
|
|
14
|
+
export function isRecipeTagsIcon(value) {
|
|
15
|
+
return RECIPE_TAGS_ICONS.some(option => option === value);
|
|
16
|
+
}
|
|
17
|
+
export function normalizeRecipeJumpControl(value) {
|
|
18
|
+
return isRecipeJumpControl(value) ? value : DEFAULT_RECIPE_JUMP_CONTROL;
|
|
19
|
+
}
|
|
20
|
+
export function normalizeRecipeTagsIcon(value) {
|
|
21
|
+
return isRecipeTagsIcon(value) ? value : DEFAULT_RECIPE_TAGS_ICON;
|
|
22
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Generated from shared/recipe-step-contract.ts by scripts/sync-field-validation.mjs. Do not edit.
|
|
2
|
+
import contract from "./recipe-step-contract.json" with { type: "json" };
|
|
3
|
+
export const RECIPE_STEP_CONTRACT = contract;
|
|
4
|
+
function record(value) {
|
|
5
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
6
|
+
}
|
|
7
|
+
export function isRecipeStepLinkHref(value) {
|
|
8
|
+
if (/[\x00-\x1f\x7f\\]/u.test(value))
|
|
9
|
+
return false;
|
|
10
|
+
const href = value.trim();
|
|
11
|
+
if (!href || href.startsWith("//"))
|
|
12
|
+
return false;
|
|
13
|
+
const scheme = /^([A-Za-z][A-Za-z0-9+.-]*):/u.exec(href)?.[1].toLowerCase();
|
|
14
|
+
if (!scheme)
|
|
15
|
+
return true;
|
|
16
|
+
if (!RECIPE_STEP_CONTRACT.linkSchemes.includes(scheme))
|
|
17
|
+
return false;
|
|
18
|
+
if (scheme !== "mailto" && scheme !== "tel")
|
|
19
|
+
return true;
|
|
20
|
+
const body = href.slice(scheme.length + 1);
|
|
21
|
+
return href.length <= 2048 && !/[\u0080-\u009f]/u.test(href)
|
|
22
|
+
&& !body.startsWith("//") && /^[^?#]/u.test(body);
|
|
23
|
+
}
|
|
24
|
+
export function isRecipeStepLinkTarget(value) {
|
|
25
|
+
const target = value.trim().toLowerCase();
|
|
26
|
+
return target === "" || RECIPE_STEP_CONTRACT.linkTargets.includes(target);
|
|
27
|
+
}
|
|
28
|
+
export function isRecipeStepLinkRel(value) {
|
|
29
|
+
return value.trim().toLowerCase().split(/\s+/u)
|
|
30
|
+
.every(token => token === "" || RECIPE_STEP_CONTRACT.linkRelTokens.includes(token));
|
|
31
|
+
}
|
|
32
|
+
export function recipeStepUnsupportedContentMessage(type) {
|
|
33
|
+
const { unsupportedContentLabels, unsupportedContentActions } = RECIPE_STEP_CONTRACT;
|
|
34
|
+
const label = Object.prototype.hasOwnProperty.call(unsupportedContentLabels, type)
|
|
35
|
+
? unsupportedContentLabels[type] : `a '${type}' node`;
|
|
36
|
+
const action = Object.prototype.hasOwnProperty.call(unsupportedContentActions, type)
|
|
37
|
+
? unsupportedContentActions[type] : unsupportedContentActions.default;
|
|
38
|
+
return `This step contains ${label}. ${action}`;
|
|
39
|
+
}
|
|
40
|
+
export function recipeStepProblems(value, { allowEmpty = false } = {}) {
|
|
41
|
+
const problems = [];
|
|
42
|
+
const { requiresText, nodes, marks } = RECIPE_STEP_CONTRACT;
|
|
43
|
+
const add = (path, message) => problems.push({ path, message });
|
|
44
|
+
function checkAttributes(entry, allowed, path, label) {
|
|
45
|
+
if (entry.attrs === undefined)
|
|
46
|
+
return;
|
|
47
|
+
const attrs = record(entry.attrs);
|
|
48
|
+
if (!attrs) {
|
|
49
|
+
add(path + ".attrs", `Use an attribute object for ${label}.`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
for (const [key, attr] of Object.entries(attrs)) {
|
|
53
|
+
if (!allowed.includes(key))
|
|
54
|
+
add(path + ".attrs." + key, `${label} does not support the ${key} attribute.`);
|
|
55
|
+
else if (attr !== null && typeof attr !== "string")
|
|
56
|
+
add(path + ".attrs." + key, `Use text for the ${key} attribute.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function checkMark(value, path, seen) {
|
|
60
|
+
const mark = record(value);
|
|
61
|
+
const type = mark?.type;
|
|
62
|
+
if (!mark || typeof type !== "string" || !Object.prototype.hasOwnProperty.call(marks, type)) {
|
|
63
|
+
add(path, typeof type === "string" ? `Formatting '${type}' is not supported in a recipe step.` : "Use a supported inline formatting mark.");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (seen.has(type))
|
|
67
|
+
add(path, `Formatting '${type}' is listed more than once.`);
|
|
68
|
+
seen.add(type);
|
|
69
|
+
for (const key of Object.keys(mark)) {
|
|
70
|
+
if (key !== "type" && key !== "attrs")
|
|
71
|
+
add(path + "." + key, `Formatting '${type}' does not support the ${key} field.`);
|
|
72
|
+
}
|
|
73
|
+
checkAttributes(mark, marks[type], path, `Formatting '${type}'`);
|
|
74
|
+
if (type === "link") {
|
|
75
|
+
const attrs = record(mark.attrs);
|
|
76
|
+
if (mark.attrs !== undefined && !attrs)
|
|
77
|
+
return;
|
|
78
|
+
const { href, target, rel } = attrs ?? {};
|
|
79
|
+
if (href == null || (typeof href === "string" && !isRecipeStepLinkHref(href))) {
|
|
80
|
+
add(path + ".attrs.href", "Use a safe link address.");
|
|
81
|
+
}
|
|
82
|
+
if (typeof target === "string" && !isRecipeStepLinkTarget(target)) {
|
|
83
|
+
add(path + ".attrs.target", "Use _blank, _self, or leave the link target empty.");
|
|
84
|
+
}
|
|
85
|
+
if (typeof rel === "string" && !isRecipeStepLinkRel(rel)) {
|
|
86
|
+
add(path + ".attrs.rel", "Use supported space-separated link relations.");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function checkNode(value, allowed, path) {
|
|
91
|
+
const node = record(value);
|
|
92
|
+
const type = node?.type;
|
|
93
|
+
if (!node || typeof type !== "string" || !allowed.includes(type)) {
|
|
94
|
+
if (typeof type === "string") {
|
|
95
|
+
add(path, recipeStepUnsupportedContentMessage(type));
|
|
96
|
+
}
|
|
97
|
+
else
|
|
98
|
+
add(path, "Use a ProseMirror document with plain paragraphs and inline formatting.");
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const rule = nodes[type];
|
|
102
|
+
const fields = ["type", "attrs"];
|
|
103
|
+
if (rule.children)
|
|
104
|
+
fields.push("content");
|
|
105
|
+
if (rule.text)
|
|
106
|
+
fields.push("text");
|
|
107
|
+
if (rule.marks)
|
|
108
|
+
fields.push("marks");
|
|
109
|
+
for (const key of Object.keys(node)) {
|
|
110
|
+
if (!fields.includes(key))
|
|
111
|
+
add(path + "." + key, `A ${type} node does not support the ${key} field.`);
|
|
112
|
+
}
|
|
113
|
+
checkAttributes(node, [], path, `A ${type} node`);
|
|
114
|
+
if (rule.text && (typeof node.text !== "string" || node.text.length === 0)) {
|
|
115
|
+
add(path + ".text", "A text node needs a nonempty string.");
|
|
116
|
+
}
|
|
117
|
+
if (rule.marks && node.marks !== undefined) {
|
|
118
|
+
if (Array.isArray(node.marks)) {
|
|
119
|
+
const seen = new Set();
|
|
120
|
+
node.marks.forEach((mark, index) => checkMark(mark, `${path}.marks[${index}]`, seen));
|
|
121
|
+
}
|
|
122
|
+
else
|
|
123
|
+
add(path + ".marks", "Use an array of inline formatting marks.");
|
|
124
|
+
}
|
|
125
|
+
if (rule.children && (type === "doc" || node.content !== undefined)) {
|
|
126
|
+
const children = rule.children;
|
|
127
|
+
if (Array.isArray(node.content) && (type !== "doc" || node.content.length > 0)) {
|
|
128
|
+
node.content.forEach((child, index) => checkNode(child, children, `${path}.content[${index}]`));
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
add(path + ".content", type === "doc" ? "A step needs at least one paragraph." : "Use an array of inline nodes.");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
checkNode(value, ["doc"], "");
|
|
136
|
+
if (requiresText && !allowEmpty && problems.length === 0 && !hasVisibleStepText(value)) {
|
|
137
|
+
add("", "This step has no text. Add text or remove the step.");
|
|
138
|
+
}
|
|
139
|
+
return problems;
|
|
140
|
+
}
|
|
141
|
+
/** Plain text for JSON-LD, including soft line breaks and paragraph boundaries. */
|
|
142
|
+
export function recipeStepText(value) {
|
|
143
|
+
const paragraphs = record(value)?.content;
|
|
144
|
+
if (!Array.isArray(paragraphs))
|
|
145
|
+
return "";
|
|
146
|
+
return paragraphs.map(paragraph => {
|
|
147
|
+
const inline = record(paragraph)?.content;
|
|
148
|
+
if (!Array.isArray(inline))
|
|
149
|
+
return "";
|
|
150
|
+
return inline.map(value => {
|
|
151
|
+
const node = record(value);
|
|
152
|
+
return node?.type === "hardBreak" ? "\n" : typeof node?.text === "string" ? node.text : "";
|
|
153
|
+
}).join("");
|
|
154
|
+
}).join("\n\n").trim();
|
|
155
|
+
}
|
|
156
|
+
function hasVisibleStepText(value) {
|
|
157
|
+
const { visibleTextIgnoredRanges } = RECIPE_STEP_CONTRACT;
|
|
158
|
+
for (const character of recipeStepText(value)) {
|
|
159
|
+
const point = character.codePointAt(0);
|
|
160
|
+
if (!visibleTextIgnoredRanges.some(([first, last]) => point >= first && point <= last))
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"requiresText": true,
|
|
3
|
+
"visibleTextIgnoredRanges": [
|
|
4
|
+
[0,32], [127,160], [173,173], [847,847], [1536,1541], [1564,1564],
|
|
5
|
+
[1757,1757], [1807,1807], [2192,2193], [2274,2274], [4447,4448], [5760,5760],
|
|
6
|
+
[6068,6069], [6155,6159], [8192,8207], [8232,8239], [8287,8303], [12288,12288],
|
|
7
|
+
[12644,12644], [65024,65039], [65279,65279], [65440,65440], [65520,65531], [69821,69821],
|
|
8
|
+
[69837,69837], [78896,78911], [113824,113827], [119155,119162], [917504,921599]
|
|
9
|
+
],
|
|
10
|
+
"nodes": {
|
|
11
|
+
"doc": { "children": ["paragraph"] },
|
|
12
|
+
"paragraph": { "children": ["text", "hardBreak"] },
|
|
13
|
+
"text": { "text": true, "marks": true },
|
|
14
|
+
"hardBreak": { "marks": true }
|
|
15
|
+
},
|
|
16
|
+
"unsupportedContentLabels": {
|
|
17
|
+
"doc": "a document",
|
|
18
|
+
"paragraph": "a paragraph",
|
|
19
|
+
"text": "text outside a paragraph",
|
|
20
|
+
"hardBreak": "a line break outside a paragraph",
|
|
21
|
+
"heading": "a heading",
|
|
22
|
+
"bulletList": "a bulleted list",
|
|
23
|
+
"orderedList": "a numbered list",
|
|
24
|
+
"listItem": "a list item",
|
|
25
|
+
"blockquote": "a quote",
|
|
26
|
+
"codeBlock": "a code block",
|
|
27
|
+
"indentedCodeBlock": "an indented code block",
|
|
28
|
+
"horizontalRule": "a horizontal rule",
|
|
29
|
+
"taprootImage": "an image",
|
|
30
|
+
"inlineImage": "an inline image",
|
|
31
|
+
"componentBlock": "a component",
|
|
32
|
+
"integrationPlacement": "an integration placement",
|
|
33
|
+
"integrationFragment": "an integration fragment",
|
|
34
|
+
"section": "a section",
|
|
35
|
+
"columns": "a columns layout",
|
|
36
|
+
"column": "a column",
|
|
37
|
+
"inlineFacts": "inline facts",
|
|
38
|
+
"table": "a table",
|
|
39
|
+
"tableRow": "a table row",
|
|
40
|
+
"tableHeader": "a table header cell",
|
|
41
|
+
"tableCell": "a table cell"
|
|
42
|
+
},
|
|
43
|
+
"unsupportedContentActions": {
|
|
44
|
+
"default": "Move it to the introduction or make it a paragraph.",
|
|
45
|
+
"taprootImage": "Move it to the introduction.",
|
|
46
|
+
"inlineImage": "Move it to the introduction.",
|
|
47
|
+
"componentBlock": "Move it to the introduction.",
|
|
48
|
+
"horizontalRule": "Remove it from the step."
|
|
49
|
+
},
|
|
50
|
+
"marks": {
|
|
51
|
+
"bold": [],
|
|
52
|
+
"italic": [],
|
|
53
|
+
"underline": [],
|
|
54
|
+
"strike": [],
|
|
55
|
+
"code": [],
|
|
56
|
+
"link": ["href", "target", "rel", "title"]
|
|
57
|
+
},
|
|
58
|
+
"linkTargets": ["_blank", "_self"],
|
|
59
|
+
"linkRelTokens": [
|
|
60
|
+
"nofollow", "sponsored", "ugc", "me", "noopener", "noreferrer", "external",
|
|
61
|
+
"author", "license", "tag", "bookmark", "help", "prev", "next", "privacy-policy",
|
|
62
|
+
"terms-of-service"
|
|
63
|
+
],
|
|
64
|
+
"linkSchemes": ["http", "https", "mailto", "tel"]
|
|
65
|
+
}
|