@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
package/src/reference-help.js
CHANGED
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
mapComponentImages,
|
|
10
10
|
} from "./content/components.js";
|
|
11
11
|
import { FREE_FORM_SECTION_REGISTRY } from "./content/free-form-sections.js";
|
|
12
|
+
import { BADGE_FOCUS_RING, getSettableComponentProperties, supportsBadgeFocusRing } from "./espalier-shared.js";
|
|
12
13
|
import { formatFontCatalog } from "./font-catalog.js";
|
|
14
|
+
import { DEFAULT_PAGE_TAG_BADGES } from "./page-tag-badge-modes.js";
|
|
13
15
|
import {
|
|
14
16
|
CONTENT_ERROR_CODES,
|
|
15
17
|
CONTENT_LIMITS,
|
|
@@ -72,6 +74,8 @@ import {
|
|
|
72
74
|
} from "./redirects-contract.js";
|
|
73
75
|
import { SETTINGS_GROUPS } from "./settings-catalog.js";
|
|
74
76
|
import { getSettingsReference } from "./setting-reference.js";
|
|
77
|
+
import { formatFixedValues } from "./styling-fixed-values.js";
|
|
78
|
+
import { buildTokenPaintCatalog, formatTokenPaints, getPageTokenReach } from "./token-reach.js";
|
|
75
79
|
import {
|
|
76
80
|
formatTypedPageReference,
|
|
77
81
|
getTypedPageReference,
|
|
@@ -95,7 +99,7 @@ import {
|
|
|
95
99
|
|
|
96
100
|
export { getAppearanceReference, getFooterReference, getSettingsReference, getThemeReference };
|
|
97
101
|
|
|
98
|
-
export const REFERENCE_VERSION =
|
|
102
|
+
export const REFERENCE_VERSION = 80;
|
|
99
103
|
|
|
100
104
|
// The date-limit examples `help forms` prints; tests run them through the form validator.
|
|
101
105
|
export const FORM_DATE_WINDOW_FIELD = Object.freeze({
|
|
@@ -464,6 +468,11 @@ export const REFERENCE_TOPICS = Object.freeze([
|
|
|
464
468
|
usage: `${CLI_BINARY_NAME} help theme`,
|
|
465
469
|
summary: "Design and validate a complete Espalier light/dark theme pair.",
|
|
466
470
|
}),
|
|
471
|
+
Object.freeze({
|
|
472
|
+
name: "tokens",
|
|
473
|
+
usage: `${CLI_BINARY_NAME} help tokens`,
|
|
474
|
+
summary: "See what each semantic color paints and which theme role drives it.",
|
|
475
|
+
}),
|
|
467
476
|
Object.freeze({
|
|
468
477
|
name: "appearance",
|
|
469
478
|
usage: `${CLI_BINARY_NAME} help appearance`,
|
|
@@ -650,14 +659,17 @@ const WORKFLOW_REFERENCES = Object.freeze({
|
|
|
650
659
|
+ "appearance files, the footer, every page, navigation and redirects — against the contracts the site enforces, "
|
|
651
660
|
+ "lists every problem in error.problems, and warns when a semanticMappings pin repeats the default on a token "
|
|
652
661
|
+ "your roles would have moved (the pin would keep the role from rendering). validate stays offline unless you add "
|
|
653
|
-
+ "--site, which also reads the site's image records to report placed images that have no default description."
|
|
662
|
+
+ "--site, which also reads the site's image records to report placed images that have no default description. "
|
|
663
|
+
+ "Unknown settings in taproot-styles.json and site-publishing-preferences.json fail validation and theme push, including dry runs.",
|
|
654
664
|
`Plan a combined change: when pages, the footer, the theme and navigation all changed, ${CLI_BINARY_NAME} plan `
|
|
655
665
|
+ "checks them against the live site and lists the steps in the order they must run, each ready, blocked or "
|
|
656
666
|
+ `nothing to do; ${CLI_BINARY_NAME} apply --plan <planHash> runs them through the ordinary push verbs and refuses `
|
|
657
667
|
+ "a plan the workspace or the site has moved past. After a failed step, plan again: finished steps read as "
|
|
658
668
|
+ "nothing to do.",
|
|
659
669
|
`Push: ${CLI_BINARY_NAME} theme push --dry-run first: it reads the site and lists the JSON paths at which each `
|
|
660
|
-
+ "settings file differs from it, and says whether the baseline pull recorded is still current.
|
|
670
|
+
+ "settings file differs from it, and says whether the baseline pull recorded is still current. It previews "
|
|
671
|
+
+ "local footer content alongside theme changes. Run footer push --dry-run for the footer draft alone. To apply "
|
|
672
|
+
+ "both edits, run footer push first. Then "
|
|
661
673
|
+ `${CLI_BINARY_NAME} theme push saves both themes, the appearance scalars, header/footer contexts and logo variants in `
|
|
662
674
|
+ "one transaction fenced by that baseline: a concurrent change to any of those fields refuses the whole push "
|
|
663
675
|
+ "(theme.concurrent_modification) and nothing is written; keep copies of the edited files, pull, re-apply, "
|
|
@@ -774,7 +786,9 @@ const WORKFLOW_REFERENCES = Object.freeze({
|
|
|
774
786
|
+ "authenticates with its own handoff either way. With --handoff, stagingPreview.url is a fresh, single-use "
|
|
775
787
|
+ "two-minute handoff, minted after checks. It is emitted only in final JSON, excluded from progress and "
|
|
776
788
|
+ "GITHUB_OUTPUT; keep it private. Without it, stagingPreview.reason is staging.handoff_not_requested and "
|
|
777
|
-
+ "'staging review' mints one
|
|
789
|
+
+ "'staging review' mints one after the first successful staging deployment. Check stagingHosting in status "
|
|
790
|
+
+ "for staging host setup and acknowledged release separately from candidate readiness. The staging cookie lasts "
|
|
791
|
+
+ "five minutes and remains subject to current "
|
|
778
792
|
+ "site/host/credential permission. Each run mints its own handoff, which ends an earlier review link "
|
|
779
793
|
+ "minted with the same key (see 'help preview').",
|
|
780
794
|
`${REDIRECTS_FILE_NAME} is { siteId, revision, entries }, not a bare array. 'redirects pull' writes it and `
|
|
@@ -870,6 +884,8 @@ const WORKFLOW_REFERENCES = Object.freeze({
|
|
|
870
884
|
+ `sink is one of ${FORM_SINKS.join(", ")} and defaults to `
|
|
871
885
|
+ "'none' (store submissions only); 'newsletter' requests double-opt-in confirmation for the contact address. "
|
|
872
886
|
+ "A newsletter sink requires a required email contact field and at least one consent checkbox; every consent checkbox must be checked. "
|
|
887
|
+
+ "If forms push reports forms.newsletter_disabled, use sink: none or ask a Taproot platform administrator to enable "
|
|
888
|
+
+ "Newsletter sink enabled under Site Forms. "
|
|
873
889
|
+ `retention_days is ${FORM_RETENTION_DAYS.minimum} to ${FORM_RETENTION_DAYS.maximum} (a site's plan may cap it lower): `
|
|
874
890
|
+ "submissions are deleted that many days after they arrive. Leave it out and the site chooses on creation (its "
|
|
875
891
|
+ "plan's default, usually 365) and keeps the current value on an update. Shortening it deletes the submissions that fall outside it, "
|
|
@@ -1519,7 +1535,7 @@ function placementMatrix() {
|
|
|
1519
1535
|
label: definition.label,
|
|
1520
1536
|
rootPlacement: definition.placement,
|
|
1521
1537
|
fullBleed: explicit,
|
|
1522
|
-
contentPadding: explicit ? "standard by default; section may choose none" : "implicit
|
|
1538
|
+
contentPadding: explicit ? "standard by default; section may choose none" : "implicit: standard",
|
|
1523
1539
|
well: explicit ? "shared site well by default; none removes the cap" : "shared site well",
|
|
1524
1540
|
measure: type === FREE_FORM_SECTION_REGISTRY.section.nodeType ? "child-defined" : definition.measure,
|
|
1525
1541
|
});
|
|
@@ -1532,7 +1548,7 @@ function placementMatrix() {
|
|
|
1532
1548
|
label: definition.label,
|
|
1533
1549
|
rootPlacement: definition.rootPlacement,
|
|
1534
1550
|
fullBleed: rootBand,
|
|
1535
|
-
contentPadding: rootBand ? "component-owned" : "implicit
|
|
1551
|
+
contentPadding: rootBand ? "component-owned" : "implicit: standard",
|
|
1536
1552
|
well: rootBand ? "none at root" : "shared site well",
|
|
1537
1553
|
measure: definition.measure,
|
|
1538
1554
|
});
|
|
@@ -1716,89 +1732,79 @@ const FREE_FORM_REFERENCE = Object.freeze({
|
|
|
1716
1732
|
workspace: Object.freeze({
|
|
1717
1733
|
directory: "pages/",
|
|
1718
1734
|
sourceRule: Object.freeze({
|
|
1719
|
-
rule:
|
|
1720
|
-
"One page path has exactly one authoritative editable source. The manifest records its file and sourceFormat.",
|
|
1735
|
+
rule: "Each page path has exactly one authoritative editable source. The manifest records its file and sourceFormat.",
|
|
1721
1736
|
manifestFields: Object.freeze(["file", "sourceFormat", "baseline"]),
|
|
1722
|
-
pull:
|
|
1723
|
-
"pull keeps a tracked source that is still on disk and never writes a second editable file for the same page.",
|
|
1737
|
+
pull: "Pull preserves a tracked source still on disk and creates no second editable source.",
|
|
1724
1738
|
internalState:
|
|
1725
|
-
`${INTERNAL_PAGE_BASELINE_DIRECTORY}/<pageId>.pm.json holds the site's document for
|
|
1726
|
-
+ "
|
|
1727
|
-
+ "
|
|
1728
|
-
|
|
1729
|
-
+ "in version control.",
|
|
1730
|
-
formatChange:
|
|
1731
|
-
"Remove the tracked source, then author the other format beside it. Two editable sources for one path is a "
|
|
1732
|
-
+ "refusal, not a guess.",
|
|
1739
|
+
`${INTERNAL_PAGE_BASELINE_DIRECTORY}/<pageId>.pm.json holds the site's document for tracked Markdown. `
|
|
1740
|
+
+ "<pageId>.revision.json records the revision a refused pull showed for a recovery push. These files are "
|
|
1741
|
+
+ "never discovered as a page source or pushed. A reconciled pull rewrites or removes them. You can ignore them in version control.",
|
|
1742
|
+
formatChange: "Remove the tracked source before writing the other format. Two sources for one path are refused.",
|
|
1733
1743
|
formatChangeError: "pages.path_conflict",
|
|
1734
|
-
renamedSource:
|
|
1735
|
-
"A tracked source renamed onto the workspace file another page falls back to leaves that page nowhere to be "
|
|
1736
|
-
+ "written. Rename or remove it, then pull again.",
|
|
1744
|
+
renamedSource: "If a renamed source occupies another page's fallback file, rename or remove it and pull again.",
|
|
1737
1745
|
renamedSourceError: "pages.source_conflict",
|
|
1738
1746
|
conflict:
|
|
1739
|
-
"
|
|
1740
|
-
+ "
|
|
1741
|
-
+ "
|
|
1742
|
-
+ "
|
|
1743
|
-
+ "
|
|
1744
|
-
+ "
|
|
1745
|
-
+ "ProseMirror) approve, staging and production publication never move it; a legal page's version stamp is "
|
|
1746
|
-
+ "written at publication and does move it; a place review's effective category is applied only to the "
|
|
1747
|
-
+ "release, so a category override does not move it.",
|
|
1747
|
+
"A new stored-state revision or supported display date signals a site edit. For stale tracked Markdown, "
|
|
1748
|
+
+ "pull saves the site version internally and refuses before editing pages/. For .pm.json, pull refreshes the site "
|
|
1749
|
+
+ "version unless the body or manifest metadata (title, path, description or author) also has local edits. "
|
|
1750
|
+
+ "Revision covers the stored body, title, path, short description and cover image. Approval, staging and production "
|
|
1751
|
+
+ "leave authored revisions alone. Publishing a legal page stamps its version and changes its revision. "
|
|
1752
|
+
+ "Place review category overrides affect the release alone.",
|
|
1748
1753
|
conflictError: "pages.pull_conflict",
|
|
1749
1754
|
metadata:
|
|
1750
|
-
"A .pm.json page's title, path and description live in the manifest
|
|
1751
|
-
+ "
|
|
1752
|
-
+ "
|
|
1753
|
-
+ "
|
|
1754
|
-
+ "over 1000 is refused.",
|
|
1755
|
+
"A .pm.json page's title, path and description live in the manifest. Edit title or description with "
|
|
1756
|
+
+ "pages meta set <path> --title/--description. Edit Markdown metadata in front matter. Pull keeps local edits "
|
|
1757
|
+
+ "until push and refuses a concurrent site edit. Descriptions over 160 characters get a search cutoff warning. "
|
|
1758
|
+
+ "Over 1000 is refused.",
|
|
1755
1759
|
authorship:
|
|
1756
|
-
"Pages
|
|
1757
|
-
+ "
|
|
1758
|
-
+ "(
|
|
1759
|
-
+ "
|
|
1760
|
-
+ "
|
|
1761
|
-
+ "
|
|
1762
|
-
+ "
|
|
1763
|
-
+ "
|
|
1764
|
-
+ "
|
|
1765
|
-
+ "
|
|
1766
|
-
+ "
|
|
1767
|
-
+ "
|
|
1768
|
-
+ "
|
|
1769
|
-
+ "
|
|
1770
|
-
+ "
|
|
1771
|
-
+ "
|
|
1772
|
-
+ "
|
|
1773
|
-
|
|
1760
|
+
"Pages start authorless. pages push lists new pages without a byline in pages.authorless. Set author: in front "
|
|
1761
|
+
+ "matter for any template or use pages meta set <path> --author for .pm.json. Use a site author's handle "
|
|
1762
|
+
+ "(jane-doe) or the email of a member who can create pages. authors list refreshes authors.json. "
|
|
1763
|
+
+ "authors add <handle> --name <name> [--email <address>] creates a site author with a private email, "
|
|
1764
|
+
+ "a byline and structured data. Site authors have no Taproot account or follow button. "
|
|
1765
|
+
+ "A site author's byline can link to a page on the site (--link-page <path or resourceId>) or a web address "
|
|
1766
|
+
+ "(--link-url <address>), never both (authors.link_conflict), and show an image from the media library "
|
|
1767
|
+
+ "(--image <media path or image id>). authors set <handle> changes the name, email, link or image, sending "
|
|
1768
|
+
+ "only what is passed; --no-link, --no-image and --no-email clear. It asks for the deployments capability "
|
|
1769
|
+
+ "because changing the byline of an author on published pages queues a deployment (authors.deployment_refused "
|
|
1770
|
+
+ "when that is not allowed). authors.json records each author's link and image. "
|
|
1771
|
+
+ "Reusing a handle and name returns existing: true; a link or image is compared only when its option is "
|
|
1772
|
+
+ "passed. A difference triggers authors.handle_taken and points at authors set. "
|
|
1773
|
+
+ "Only the CLI assigns authors, and only to authorless pages. Repeating the assigned author is a no-op. "
|
|
1774
|
+
+ "A different author triggers pages.author_conflict. Restore the site's author in front matter or with "
|
|
1775
|
+
+ "pages meta set <path> --author. Use --author \"\" to clear an unsent assignment. "
|
|
1776
|
+
+ "Offline validate and pages meta set warn pages.author_unverified on authors.json misses. pages push "
|
|
1777
|
+
+ "and plan check the live list once on a miss. Unknown or ineligible authors trigger pages.author_unknown. "
|
|
1778
|
+
+ "Text that is neither a handle nor an address triggers pages.author_invalid. "
|
|
1779
|
+
// Kept to one sentence: every page type's help carries this rule, and the free-form help is near its
|
|
1780
|
+
// output bound. The typed page's field help holds the detail (TR01402).
|
|
1781
|
+
+ "displayAuthor on a typed page names a site author for the byline instead of the member; that page "
|
|
1782
|
+
+ "type's field help has the rules.",
|
|
1783
|
+
authorshipErrors: Object.freeze([
|
|
1784
|
+
"pages.author_invalid",
|
|
1785
|
+
"pages.author_unknown",
|
|
1786
|
+
"pages.author_conflict",
|
|
1787
|
+
"pages.display_author_invalid",
|
|
1788
|
+
"pages.display_author_unknown",
|
|
1789
|
+
]),
|
|
1774
1790
|
conflictDetail:
|
|
1775
|
-
"
|
|
1776
|
-
+ "
|
|
1777
|
-
+ "
|
|
1778
|
-
+ "compared and the body is identical, so the change was to the page's title, path, description, cover image "
|
|
1779
|
-
+ "or display date, none of which is part of the body. Non-empty: the JSON paths at which the body differs. "
|
|
1780
|
-
+ "These paths explain a refusal; they never decide whether it happens.",
|
|
1791
|
+
"error.differences is absent when the workspace has no baseline document to compare. An empty list means "
|
|
1792
|
+
+ "only title, path, description, cover image or display date changed. Otherwise it lists changed JSON body paths. "
|
|
1793
|
+
+ "These paths explain the refusal.",
|
|
1781
1794
|
pushConflict:
|
|
1782
|
-
"pages push
|
|
1783
|
-
+ "
|
|
1784
|
-
+ "
|
|
1785
|
-
+ "error.alternatives, recorded first and live second. The guard is armed once both are known — a page this "
|
|
1786
|
-
+ "workspace has never reconciled with, or a Taproot that predates the revision contract, leaves it unarmed "
|
|
1787
|
-
+ "rather than refusing every push. A pull that refuses records the revision it showed you, so the pull "
|
|
1788
|
-
+ "conflict's own recovery push still goes through; a page that moved again since is refused again.",
|
|
1795
|
+
"pages push compares recorded and live revisions when both are known. A mismatch stops all writes and lists "
|
|
1796
|
+
+ "the recorded revision first in error.alternatives. A refused pull records the revision it showed for a recovery push. "
|
|
1797
|
+
+ "A later site edit invalidates that recovery. Workspaces without a reconciled revision and older servers leave the guard unarmed.",
|
|
1789
1798
|
pushConflictError: "pages.push_conflict",
|
|
1790
1799
|
revisionSource:
|
|
1791
|
-
"baseline.revision
|
|
1792
|
-
+ "
|
|
1800
|
+
"The manifest's baseline.revision comes from bodyRevision on page reads, listings, creates and updates. "
|
|
1801
|
+
+ "Compare the opaque value directly.",
|
|
1793
1802
|
conflictRecovery:
|
|
1794
|
-
"Either push the local source
|
|
1795
|
-
+ "the
|
|
1796
|
-
+ "differences list) changed only its title, path, description, cover image or display date, so the "
|
|
1797
|
-
+ "same two choices apply.",
|
|
1803
|
+
"Either push the local source or delete the local source and pull the site's document. "
|
|
1804
|
+
+ "Use the same choices when an empty differences list reports a metadata-only change.",
|
|
1798
1805
|
pushSelection:
|
|
1799
|
-
"pages push <path> validates the selected page
|
|
1800
|
-
+ "
|
|
1801
|
-
+ "path is the command that reports every authored page.",
|
|
1806
|
+
"pages push <path> converts and validates the selected page with every cross-page guard that applies. "
|
|
1807
|
+
+ "pages push with no path is the command that reports every authored page.",
|
|
1802
1808
|
}),
|
|
1803
1809
|
formats: Object.freeze([
|
|
1804
1810
|
Object.freeze({
|
|
@@ -2012,12 +2018,96 @@ export function listPageTypeReferences() {
|
|
|
2012
2018
|
});
|
|
2013
2019
|
}
|
|
2014
2020
|
|
|
2021
|
+
const PAGE_INSET = Object.freeze({
|
|
2022
|
+
file: "settings/taproot-styles.json",
|
|
2023
|
+
path: "settings.contentInset",
|
|
2024
|
+
helpCommand: `${CLI_BINARY_NAME} help appearance`,
|
|
2025
|
+
});
|
|
2026
|
+
|
|
2027
|
+
const RECIPE_ANCHOR = Object.freeze({
|
|
2028
|
+
name: "recipe.anchor",
|
|
2029
|
+
value: "#recipe",
|
|
2030
|
+
where: "the recipe card on every recipe page that renders it",
|
|
2031
|
+
source: "recipe card",
|
|
2032
|
+
});
|
|
2033
|
+
|
|
2034
|
+
const BADGE_PAGE_TYPES = new Set(["article", "album", "recipe", "place-review"]);
|
|
2035
|
+
function pageBadgeReference(type) {
|
|
2036
|
+
return {
|
|
2037
|
+
setting: "pageTagBadges",
|
|
2038
|
+
default: DEFAULT_PAGE_TAG_BADGES,
|
|
2039
|
+
renders: "On Standard sites, page displays authored tags in the page header. Page-and-cards also displays them in folder indexes and Latest Posts cards.",
|
|
2040
|
+
visibility: "Badges show explicitly assigned tags from the release’s selected page version, sorted alphabetically ignoring case. System tags and tags from member-only pages are omitted.",
|
|
2041
|
+
preview: "Generator-backed authoring preview shows the badges. The editor page preview and component previews keep their existing markup.",
|
|
2042
|
+
destinations: "Use settings.tagDestinations in settings/site-publishing-preferences.json to link a tag to a page resource ID. "
|
|
2043
|
+
+ "Tags without a current published destination appear as plain badges. See help appearance for the complete tag listing workflow.",
|
|
2044
|
+
componentProperties: getSettableComponentProperties()
|
|
2045
|
+
.filter(property => property.component === "esp-badge" && property.syntax === "color").map(({ name }) => name),
|
|
2046
|
+
...(supportsBadgeFocusRing() ? { focusRing: `Set the outside focus ring separately with ${BADGE_FOCUS_RING}. `
|
|
2047
|
+
+ "It defaults to --esp-color-link. Theme resolve checks 3:1 against surrounding surfaces." } : {}),
|
|
2048
|
+
...(type === "recipe" ? {
|
|
2049
|
+
recipeMetadata: "The bottom tag bar shows the same authored badges and links as the header, even when pageTagBadges is off. "
|
|
2050
|
+
+ "Set recipeTagsContent to metadata or both to include category, cuisine and method. Both keeps the authored badge and its link for a shared name, ignoring case. "
|
|
2051
|
+
+ "Metadata links can use a matching site tag's destination or an explicit recipeMetadataDestinations entry. See help settings.",
|
|
2052
|
+
} : {}),
|
|
2053
|
+
};
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2015
2056
|
export function getPageTypeReference(type) {
|
|
2016
|
-
if (type === "free-form")
|
|
2017
|
-
|
|
2057
|
+
if (type === "free-form") {
|
|
2058
|
+
return {
|
|
2059
|
+
...FREE_FORM_REFERENCE,
|
|
2060
|
+
components: listComponentTypeReferences(),
|
|
2061
|
+
contentInset: PAGE_INSET,
|
|
2062
|
+
fixedValues: Object.freeze([]),
|
|
2063
|
+
tokenReach: getPageTokenReach(type),
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
const page = getTypedPageReference(type);
|
|
2067
|
+
if (!page) return undefined;
|
|
2068
|
+
return Object.freeze({
|
|
2069
|
+
...page,
|
|
2070
|
+
...(BADGE_PAGE_TYPES.has(type) ? { tagBadges: pageBadgeReference(type) } : {}),
|
|
2071
|
+
contentInset: PAGE_INSET,
|
|
2072
|
+
fixedValues: Object.freeze(type === "recipe" ? [RECIPE_ANCHOR] : []),
|
|
2073
|
+
tokenReach: getPageTokenReach(type),
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
export function getTokenReference() {
|
|
2078
|
+
return {
|
|
2079
|
+
...buildTokenPaintCatalog(),
|
|
2080
|
+
pinning: "structure drives both border and shadow, and pinning either through semanticMappings "
|
|
2081
|
+
+ "(with its token in explicitMappingTokens at the root) colors it alone.",
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
function formatTokenReference({ tokens, paintCatalog, pinning }) {
|
|
2086
|
+
const derivations = Object.entries(tokens).map(([name, { derivation, note }]) => {
|
|
2087
|
+
const rolePlan = derivation === null ? note : `${derivation.role}.${derivation.slot} — ${derivation.defaultStop}`;
|
|
2088
|
+
return ` ${name.padEnd(18)} ${rolePlan}`;
|
|
2089
|
+
});
|
|
2090
|
+
return [
|
|
2091
|
+
"What each token paints",
|
|
2092
|
+
...formatTokenPaints(tokens, paintCatalog),
|
|
2093
|
+
"",
|
|
2094
|
+
"Static role plan and default lightness stops",
|
|
2095
|
+
...derivations,
|
|
2096
|
+
"",
|
|
2097
|
+
pinning,
|
|
2098
|
+
"",
|
|
2099
|
+
].join("\n");
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
function formatPageTokenReach(rows = []) {
|
|
2103
|
+
if (!rows.length) return "";
|
|
2104
|
+
return "\n\nTemplate token reach\n" + rows.map(({ token, file, markup, part, label }) =>
|
|
2105
|
+
` ${label} — ${token} (${file}, ${markup}, ${part})`
|
|
2106
|
+
).join("\n") + "\n";
|
|
2018
2107
|
}
|
|
2019
2108
|
|
|
2020
2109
|
function schemaLabel(schema) {
|
|
2110
|
+
if (schema.anyOf) return schema.anyOf.map(schemaLabel).join(" | ");
|
|
2021
2111
|
if (schema.enum) return schema.enum.map((value) => JSON.stringify(value)).join(" | ");
|
|
2022
2112
|
if (schema.type === "array") return `array<${schemaLabel(schema.items)}>`;
|
|
2023
2113
|
if (Array.isArray(schema.type)) return schema.type.join(" | ");
|
|
@@ -2157,6 +2247,8 @@ export function formatReferenceResult(result) {
|
|
|
2157
2247
|
switch (result.topic) {
|
|
2158
2248
|
case "fonts":
|
|
2159
2249
|
return formatFontCatalog(result.fonts);
|
|
2250
|
+
case "tokens":
|
|
2251
|
+
return formatTokenReference(result);
|
|
2160
2252
|
case "topics":
|
|
2161
2253
|
return `Usage: ${CLI_BINARY_NAME} help <topic> [name] [--json]\n\nReference topics:\n${
|
|
2162
2254
|
result.topics.map((topic) => ` ${topic.usage.padEnd(48)} ${topic.summary}`).join("\n")
|
|
@@ -2191,7 +2283,18 @@ export function formatReferenceResult(result) {
|
|
|
2191
2283
|
}
|
|
2192
2284
|
case "page": {
|
|
2193
2285
|
const page = result.page;
|
|
2194
|
-
|
|
2286
|
+
const inset = page.contentInset;
|
|
2287
|
+
const styling = `\n\nContent inset uses ${inset.path} in ${inset.file}. See ${inset.helpCommand}.\n`
|
|
2288
|
+
+ formatFixedValues(page.fixedValues) + formatPageTokenReach(page.tokenReach);
|
|
2289
|
+
if (page.type !== "free-form") {
|
|
2290
|
+
const badges = page.tagBadges;
|
|
2291
|
+
const badgeText = badges
|
|
2292
|
+
? "\n\nTag badges (" + badges.setting + ", default " + badges.default + ")\n "
|
|
2293
|
+
+ [badges.renders, badges.visibility, badges.preview, badges.destinations, badges.recipeMetadata, badges.focusRing].filter(Boolean).join(" ")
|
|
2294
|
+
+ "\n Theme properties: " + badges.componentProperties.join(", ")
|
|
2295
|
+
: "";
|
|
2296
|
+
return `${formatTypedPageReference(page).trimEnd()}${badgeText}${styling}`;
|
|
2297
|
+
}
|
|
2195
2298
|
const markdownFormat = page.workspace.formats.find((format) => format.extension === ".md");
|
|
2196
2299
|
const sourceRule = page.workspace.sourceRule;
|
|
2197
2300
|
return `${page.displayName} (${page.type})\n${page.summary}\n\nWorkspace:\n${
|
|
@@ -2241,7 +2344,7 @@ export function formatReferenceResult(result) {
|
|
|
2241
2344
|
page.components.map((component) => ` ${component.type.padEnd(16)} ${component.summary}`).join("\n")
|
|
2242
2345
|
}\n\nWorkflow:\n${
|
|
2243
2346
|
page.workflow.map((step) => ` ${step.command}: ${step.result}`).join("\n")
|
|
2244
|
-
}\
|
|
2347
|
+
}${styling}\nUse --json for exact metadata and component-node shapes.\n`;
|
|
2245
2348
|
}
|
|
2246
2349
|
case "component": {
|
|
2247
2350
|
const component = result.component;
|
package/src/session.js
CHANGED
|
@@ -220,7 +220,16 @@ export async function resolveApiBaseUrl(environment) {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
export async function openSession(invocation = {}) {
|
|
223
|
-
|
|
223
|
+
const resolved = await resolveSiteSession(invocation);
|
|
224
|
+
return await resolved.open();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** Resolves the credential and bound site locally before a verb needs to use either on the wire. */
|
|
228
|
+
export async function resolveSiteSession(invocation = {}) {
|
|
229
|
+
if (invocation.resolvedSession !== undefined) {
|
|
230
|
+
const session = invocation.resolvedSession;
|
|
231
|
+
return { config: session.config, siteId: session.siteId, open: () => session };
|
|
232
|
+
}
|
|
224
233
|
const environment = invocation.environment ?? process.env;
|
|
225
234
|
const onProgress = progressSink(invocation);
|
|
226
235
|
const now = invocation.now ?? Date.now;
|
|
@@ -240,23 +249,7 @@ export async function openSession(invocation = {}) {
|
|
|
240
249
|
const config = await loadConfig(invocation);
|
|
241
250
|
if (!config.siteId) throw siteMissingError();
|
|
242
251
|
requireRecordedSurface(invocation, config);
|
|
243
|
-
|
|
244
|
-
?? new SiteApiClient(buildClientOptions(invocation, apiBaseUrl, environmentToken));
|
|
245
|
-
// No exchange happens on this path, and nothing else on the contract reads
|
|
246
|
-
// the platform switch — so its state is genuinely unknown here rather than
|
|
247
|
-
// assumed. Reporting it as enabled would be a guess, and reporting it as
|
|
248
|
-
// paused would warn on every write against a healthy platform.
|
|
249
|
-
return {
|
|
250
|
-
config,
|
|
251
|
-
client,
|
|
252
|
-
legalDrafts: false,
|
|
253
|
-
siteId: config.siteId,
|
|
254
|
-
surface: config.authoringSurface,
|
|
255
|
-
platform: UNKNOWN_PLATFORM,
|
|
256
|
-
release: UNKNOWN_CLI_RELEASE,
|
|
257
|
-
now,
|
|
258
|
-
onProgress,
|
|
259
|
-
};
|
|
252
|
+
return resolveDirectSiteSession(invocation, { config, apiBaseUrl, now, onProgress }, environmentToken);
|
|
260
253
|
}
|
|
261
254
|
|
|
262
255
|
if (invocation.legalDrafts) {
|
|
@@ -278,11 +271,7 @@ export async function openSession(invocation = {}) {
|
|
|
278
271
|
+ `If Taproot refuses it, run '${CLI_BINARY_NAME} ${VERB_LOGIN} --legal-drafts' again.`,
|
|
279
272
|
);
|
|
280
273
|
}
|
|
281
|
-
return {
|
|
282
|
-
config, client: invocation.client ?? new SiteApiClient(buildClientOptions(invocation, apiBaseUrl, credential.key)),
|
|
283
|
-
legalDrafts: true, siteId: config.siteId, surface: config.authoringSurface,
|
|
284
|
-
platform: UNKNOWN_PLATFORM, release: UNKNOWN_CLI_RELEASE, now, onProgress,
|
|
285
|
-
};
|
|
274
|
+
return resolveDirectSiteSession(invocation, { config, apiBaseUrl, now, onProgress }, credential.key);
|
|
286
275
|
}
|
|
287
276
|
|
|
288
277
|
let config;
|
|
@@ -295,6 +284,32 @@ export async function openSession(invocation = {}) {
|
|
|
295
284
|
if (!config.siteId) throw siteMissingError();
|
|
296
285
|
requireRecordedSurface(invocation, config);
|
|
297
286
|
|
|
287
|
+
return {
|
|
288
|
+
config,
|
|
289
|
+
siteId: config.siteId,
|
|
290
|
+
open: () => openStoredSiteSession(invocation, { environment, apiBaseUrl, config, signIn, now, onProgress }),
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function resolveDirectSiteSession(invocation, { config, apiBaseUrl, now, onProgress }, key) {
|
|
295
|
+
return {
|
|
296
|
+
config,
|
|
297
|
+
siteId: config.siteId,
|
|
298
|
+
open: () => ({
|
|
299
|
+
config,
|
|
300
|
+
client: invocation.client ?? new SiteApiClient(buildClientOptions(invocation, apiBaseUrl, key)),
|
|
301
|
+
legalDrafts: Boolean(invocation.legalDrafts),
|
|
302
|
+
siteId: config.siteId,
|
|
303
|
+
surface: config.authoringSurface,
|
|
304
|
+
platform: UNKNOWN_PLATFORM,
|
|
305
|
+
release: UNKNOWN_CLI_RELEASE,
|
|
306
|
+
now,
|
|
307
|
+
onProgress,
|
|
308
|
+
}),
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
async function openStoredSiteSession(invocation, { environment, apiBaseUrl, config, signIn, now, onProgress }) {
|
|
298
313
|
// The server is the authority on expiry, so an expired sign-in is still sent
|
|
299
314
|
// — the clock here may simply be wrong. What is worth saying out loud is that
|
|
300
315
|
// the credential is already past the expiry it recorded, so a refusal that
|
|
@@ -324,7 +339,7 @@ export async function openSession(invocation = {}) {
|
|
|
324
339
|
|
|
325
340
|
const accountClient = new SiteApiClient(buildClientOptions(invocation, apiBaseUrl, signIn.key));
|
|
326
341
|
// Announced here, not left to the generic failure line. The exchange is the
|
|
327
|
-
// first request
|
|
342
|
+
// first network request a site verb makes and it sits outside each verb's own
|
|
328
343
|
// `withRefusalGuidance`, so a refusal raised by it used to reach the operator
|
|
329
344
|
// as a field name and nothing else. That matters most for `cli_outdated`,
|
|
330
345
|
// whose whole remedy is a command the operator has to be handed (TR00703),
|