@taprootio/site-authoring 0.34.0 → 0.36.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.
@@ -39,23 +39,20 @@ import {
39
39
  SOCIAL_PLATFORM_KEYS,
40
40
  validateFooterDocument,
41
41
  } from "./footer-contract.js";
42
- import {
43
- APPEARANCE_COLOR_CONSTRAINT,
44
- MAXIMUM_THEME_OPEN_MAP_ENTRIES,
45
- MAXIMUM_THEME_OPEN_MAP_KEY_SCALARS,
46
- REQUIRED_THEME_PROPERTIES,
47
- validateAndLintThemePair,
48
- } from "./theme-validation.js";
49
42
  import {
50
43
  describeSettingField,
51
44
  formatSettingsReference,
52
45
  PAGE_BACKGROUND_IMAGE_RENDERING,
53
46
  PAGE_BACKGROUND_VERSUS_CANVAS,
54
47
  } from "./setting-reference.js";
48
+ import { SETTINGS_TYPE_SITE_PUBLISHING_PREFERENCES, SETTINGS_TYPE_TAPROOT_STYLES } from "./settings-catalog.js";
55
49
  import {
56
- SETTINGS_TYPE_SITE_PUBLISHING_PREFERENCES,
57
- SETTINGS_TYPE_TAPROOT_STYLES,
58
- } from "./settings-catalog.js";
50
+ APPEARANCE_COLOR_CONSTRAINT,
51
+ MAXIMUM_THEME_OPEN_MAP_ENTRIES,
52
+ MAXIMUM_THEME_OPEN_MAP_KEY_SCALARS,
53
+ REQUIRED_THEME_PROPERTIES,
54
+ validateAndLintThemePair,
55
+ } from "./theme-validation.js";
59
56
 
60
57
  let espalierVersion;
61
58
 
@@ -281,8 +278,7 @@ const THEME_GROUPS = Object.freeze([
281
278
  }),
282
279
  Object.freeze({
283
280
  name: "surface-assets",
284
- summary:
285
- "Preserve pulled asset fields; use appearance image ids for the logos, favicon and canvas image. The page "
281
+ summary: "Preserve pulled asset fields; use appearance image ids for the logos, favicon and canvas image. The page "
286
282
  + "background image is a theme field behind the page content, unlike the canvas image, which paints only the "
287
283
  + "side margins (help settings has both).",
288
284
  fields: Object.freeze([
@@ -392,7 +388,11 @@ function assertExampleContrast(theme, scheme) {
392
388
  const surface = themeLightness(properties[surfaceToken]);
393
389
  const lightness = themeLightness(properties[token]);
394
390
  if (surface === undefined || lightness === undefined || Math.abs(lightness - surface) < 0.4) {
395
- throw new Error(`${scheme} theme example: ${token} (${properties[token]}) does not contrast with ${surfaceToken} (${properties[surfaceToken]}).`);
391
+ throw new Error(
392
+ `${scheme} theme example: ${token} (${properties[token]}) does not contrast with ${surfaceToken} (${
393
+ properties[surfaceToken]
394
+ }).`,
395
+ );
396
396
  }
397
397
  }
398
398
  }
@@ -458,6 +458,8 @@ export function getAppearanceReference() {
458
458
  ...(field.values ? { values: field.values } : {}),
459
459
  ...(field.minimum !== undefined ? { minimum: field.minimum, maximum: field.maximum } : {}),
460
460
  ...(field.maximumLength !== undefined ? { maximumLength: field.maximumLength } : {}),
461
+ ...(field.step !== undefined ? { step: field.step } : {}),
462
+ ...(field.optional ? { optional: true } : {}),
461
463
  ...appearanceColorReference(field),
462
464
  default: field.default,
463
465
  }));
@@ -483,7 +485,9 @@ export function getAppearanceReference() {
483
485
  file: field.file,
484
486
  path: field.path,
485
487
  appLabel: "Footer",
486
- description: `The footer's ${footerColorLabel(field.name)} in the ${field.scheme} scheme. footer push owns the rest of the footer.`,
488
+ description: `The footer's ${
489
+ footerColorLabel(field.name)
490
+ } in the ${field.scheme} scheme. footer push owns the rest of the footer.`,
487
491
  renders: "The footer, once footerSettings.enabled is true (default false).",
488
492
  type: field.type,
489
493
  ...appearanceColorReference(field),
@@ -492,11 +496,13 @@ export function getAppearanceReference() {
492
496
  ],
493
497
  readOnlyProjections: APPEARANCE_READ_ONLY_FIELDS,
494
498
  pageBackgroundVersusCanvas: PAGE_BACKGROUND_VERSUS_CANVAS,
495
- fieldMap: CLI_BINARY_NAME + " help settings maps every pulled field, including the read-only ones, to its app control.",
499
+ fieldMap: CLI_BINARY_NAME
500
+ + " help settings maps every pulled field, including the read-only ones, to its app control.",
496
501
  imageReferences:
497
502
  "Use site-owned image ids retained from pull or returned by media upload. URLs are server projections, never authored inputs.",
498
503
  logoContract:
499
- "lightLogoId and darkLogoId are the current scheme-specific logo fields; there is no separate compact-logo setting. "
504
+ "lightLogoId and darkLogoId are the expanded scheme logos; optional lightCompactLogoId and darkCompactLogoId "
505
+ + "supply compact logos for Fixed headers above 1.0 when a regular logo resolves. Inactive choices are retained. "
500
506
  + "Each takes one image id: upload the highest-resolution file you have and assign it. An @2x or @3x suffix is only "
501
507
  + "part of a filename, nothing pairs it with another file, and the platform generates the sizes. "
502
508
  + "Prefer transparent PNG or WebP artwork with genuine alpha so the header background shows through, including "
@@ -514,8 +520,7 @@ export function getAppearanceReference() {
514
520
  + "header at desktop and compact/mobile widths. Transparent pixels provide no contrast: inspect the visible mark, "
515
521
  + "not its canvas bounds. When one asset does not remain distinct in both schemes, supply scheme-specific logo "
516
522
  + "assets rather than relying on a shadow, outline, or header color that has not been previewed.",
517
- headerWidthContract:
518
- "headerWidth 'contained' keeps the brand and the header buttons at the page content edges; "
523
+ headerWidthContract: "headerWidth 'contained' keeps the brand and the header buttons at the page content edges; "
519
524
  + "'wide' moves them to the viewport edges. Pages with root-band components (image-banner) span the viewport, "
520
525
  + "so full-bleed designs usually pair headerWidth 'wide' with headerLayout 'centered-menu', which keeps the "
521
526
  + "brand left, the buttons right, and the navigation centered. validate prints a hint, never a failure, when a "
@@ -549,24 +554,20 @@ export function getAppearanceReference() {
549
554
  + "(theme.concurrent_modification) and nothing is written. Footer prose, links and imagery, and the "
550
555
  + "publishing scalars are outside the revision, so an unrelated concurrent edit is preserved rather than "
551
556
  + "refused. footer push advances the baseline only when its save replaced that same revision.",
552
- dryRun:
553
- CLI_BINARY_NAME + " theme push --dry-run reads the site, lists the JSON paths at which each settings file "
557
+ dryRun: CLI_BINARY_NAME + " theme push --dry-run reads the site, lists the JSON paths at which each settings file "
554
558
  + "differs from it, and says whether the recorded baseline is still current or a pending save of the same "
555
559
  + "change set would be replayed; it writes nothing.",
556
- retry:
557
- "The save is recorded as pending in the manifest before it is sent. A save whose response was lost is "
560
+ retry: "The save is recorded as pending in the manifest before it is sent. A save whose response was lost is "
558
561
  + "replayed by running theme push again with the same settings files: it goes under the baseline it was "
559
562
  + "first sent with, even after the site's revision moved, and the site answers applied=false when it already "
560
563
  + "holds the change set, so nothing is applied twice and no partial write is ever reported. Editing the "
561
564
  + "files before retrying makes the pending record moot and a moved revision refuses toward pull.",
562
- recovery:
563
- "On theme.concurrent_modification keep copies of the edited settings files, run " + CLI_BINARY_NAME
565
+ recovery: "On theme.concurrent_modification keep copies of the edited settings files, run " + CLI_BINARY_NAME
564
566
  + " pull to refresh the baseline, re-apply the edits, and push again. A Taproot without the atomic save "
565
567
  + "refuses with theme.server_unsupported; theme push never falls back to sequential writes.",
566
568
  footerBoundary:
567
569
  "theme push changes only five colors per footer scheme. Use footer push for prose, links, layout, and imagery.",
568
- footerContentGuard:
569
- "theme push refuses while settings.footerSettings carries unpushed content edits: "
570
+ footerContentGuard: "theme push refuses while settings.footerSettings carries unpushed content edits: "
570
571
  + "theme.unpushed_footer_content names " + CLI_BINARY_NAME + " footer push to save them "
571
572
  + "(" + CLI_BINARY_NAME + " pull discards them). A workspace pulled before this baseline "
572
573
  + "fails theme.pull_required; footer push records it non-destructively, while pull "
@@ -722,12 +723,10 @@ export function getFooterReference() {
722
723
  messages: footerMessages(),
723
724
  totalGroupMaximum: FOOTER_LIMITS.linkGroups,
724
725
  totalRichTextRunsMaximum: FOOTER_LIMITS.richTextRuns,
725
- targetRule:
726
- "Each link has exactly one target: a tracked pageResourceId, or an externalUrl that is an absolute "
726
+ targetRule: "Each link has exactly one target: a tracked pageResourceId, or an externalUrl that is an absolute "
727
727
  + "credential-free http/https URL, or a mailto:/tel: contact URL such as tel:+15555550123. A contact URL is "
728
728
  + "published exactly as authored, so write the number the way it should be dialled.",
729
- socialLinkRule:
730
- "Each social link names a platform key (" + SOCIAL_PLATFORM_KEYS.join(", ") + ") and a url that "
729
+ socialLinkRule: "Each social link names a platform key (" + SOCIAL_PLATFORM_KEYS.join(", ") + ") and a url that "
731
730
  + SOCIAL_LINK_URL_REQUIREMENT + ". The label is the link's text and what screen readers announce; "
732
731
  + "leave it empty to use the platform's name, and give one to every other (Website) link. Domain names "
733
732
  + "with accented or non-English letters are not supported here; use a bottom link for that site. "
@@ -95,7 +95,7 @@ import {
95
95
 
96
96
  export { getAppearanceReference, getFooterReference, getSettingsReference, getThemeReference };
97
97
 
98
- export const REFERENCE_VERSION = 53;
98
+ export const REFERENCE_VERSION = 56;
99
99
 
100
100
  // The date-limit examples `help forms` prints; tests run them through the form validator.
101
101
  export const FORM_DATE_WINDOW_FIELD = Object.freeze({
@@ -545,8 +545,11 @@ const WORKFLOW_REFERENCES = Object.freeze({
545
545
  + "'pages push --dry-run' then checks the pages against the live site — paths taken, templates, revisions, "
546
546
  + "videos — and sends nothing. 'plan' checks the whole workspace against the site and orders what is left "
547
547
  + "(media, pages, footer, theme, navigation); 'apply --plan <planHash>' runs exactly that plan.",
548
- "Navigation. A site can have several menus (header, footer): ask which is primary and list the rest. Rebuild it as nav.json after 'pages push', at most three levels deep with canonical UUID ids, 1000 items and 200-character titles (help nav); a label-only dropdown heading (a WordPress '#' link) is a GROUP_HEADER, and a child of an item you cannot map is listed, not promoted (page items carry the resourceId from the "
549
- + "manifest; a custom link is an EXTERNAL_URL item; a category or tag item has no target, so list it).",
548
+ `Navigation. A site can have several menus (header, footer): ask which is primary and list the rest. Rebuild it as nav.json after 'pages push', at most three levels deep with canonical UUID ids, ${LIMITS.navigationItems} items and 200-character titles (help nav); a label-only dropdown heading (a WordPress '#' link) is a GROUP_HEADER, and a child of an item you cannot map is listed, not promoted (page items carry the resourceId from the `
549
+ + "manifest; a custom link is an EXTERNAL_URL item; a category or tag item has no target, so list it). "
550
+ + "For a page or custom link with children, save its address in a same-title first leaf child with a fresh canonical UUID, "
551
+ + "change the parent to GROUP_HEADER and clear its address, then append the original children in order. "
552
+ + "A parent with children has no address of its own; nav push refuses it until the address is moved into a child item.",
550
553
  "Redirects. At most 2000 entries; never redirect to a page you did not push. Every imported page's old path (from its <link>) becomes a 301 to its new path, unless the two "
551
554
  + "are the same. A category archive redirects to its folder when it became one. Query-string URLs (?p=12), "
552
555
  + "feeds, tag archives, author archives and attachment pages cannot be redirect sources or have no "
@@ -631,7 +634,9 @@ const WORKFLOW_REFERENCES = Object.freeze({
631
634
  "Prepare media locally: PNG, JPEG, GIF and WebP raster files only, addressed relative to the workspace root. Make "
632
635
  + "the variants yourself with any image tool (a transparent logo at the highest resolution you have, a square favicon); there is no "
633
636
  + "recolor, crop or SVG upload command. Upload each with media upload, then assign lightLogoId and darkLogoId "
634
- + "(and brand.faviconId) from the image ids .taproot-site-media.json records for those files, so each scheme carries the artwork that reads on its header.",
637
+ + "(and brand.faviconId) from the image ids .taproot-site-media.json records for those files, so each scheme carries the artwork that reads on its header. "
638
+ + "Optional lightCompactLogoId and darkCompactLogoId in the same styles file provide alternate artwork when a Fixed header above 1.0 shrinks; "
639
+ + "set headerHeightMultiplier as a string in site-header.json. See help appearance for the range and fallback rules.",
635
640
  `See the compiled colors: ${CLI_BINARY_NAME} theme resolve prints, offline, every semantic color Espalier compiles `
636
641
  + "from the pair for each scheme and context, whether each is compiled from the roles or pinned, and the contrast "
637
642
  + "of every ink-on-surface pair, with a flag for each one under WCAG AA. Run it after each theme edit, in both "
@@ -692,8 +697,29 @@ const WORKFLOW_REFERENCES = Object.freeze({
692
697
  + "edits, and push again. A manifest with no navigation revision is refused with nav.pull_required; run pull. "
693
698
  + "A successful push records the revision it saved, so the next push is fenced against that state.",
694
699
  "kind is NAV_ITEM_KIND_PAGE, NAV_ITEM_KIND_EXTERNAL_URL, or NAV_ITEM_KIND_GROUP_HEADER.",
700
+ "position is optional: omit it for Menu, or use NAV_ITEM_POSITION_HEADER_END for Header end beside the header controls. "
701
+ + "NAV_ITEM_POSITION_UNSPECIFIED and NAV_ITEM_POSITION_MENU are accepted Menu aliases; pull omits both. "
702
+ + "Only top-level PAGE or EXTERNAL_URL leaves can use Header end; dropdown headers and nested items stay in Menu. "
703
+ + "Invalid position is refused at its exact navItems[n].position or nested path before saving. "
704
+ + "Header end links precede the search and theme controls inline. In auto mode they join the collapsed menu "
705
+ + "in original navigation order, including phones; drawer mode always combines them. Minimal layout uses the drawer. "
706
+ + "The existing auto and drawer navigation display choices are unchanged.",
707
+ "appearance is optional: omit it for Link, or use NAV_ITEM_APPEARANCE_BUTTON for Button styling. "
708
+ + "NAV_ITEM_APPEARANCE_UNSPECIFIED and NAV_ITEM_APPEARANCE_LINK are accepted Link aliases; pull omits both. "
709
+ + "PAGE and EXTERNAL_URL leaves can use Button at any depth, in Menu or Header end where that position is available. "
710
+ + "GROUP_HEADER cannot use Button. An invalid appearance is refused at its exact navItems[n].appearance or nested path before saving. "
711
+ + "Button links keep their destination and link behavior in inline menus and the drawer; the current page stays noninteractive. "
712
+ + "In the app, choose Display as in the navigation item dialog.",
713
+ `The tree allows at most ${LIMITS.navigationItems} items. nav.json is bounded to `
714
+ + `${LIMITS.navigationWorkspaceBytes / (1024 * 1024)} MiB; navigation GET and PUT replies are bounded to `
715
+ + `${LIMITS.navigationResponseBytes / (1024 * 1024)} MiB to allow the API's printed defaults.`,
695
716
  "PAGE uses resourceId from .taproot-site-manifest.json, never pageId or path.",
696
- "EXTERNAL_URL uses externalUrl; GROUP_HEADER has no target; every kind may carry children.",
717
+ "EXTERNAL_URL uses externalUrl. Only GROUP_HEADER may carry children; it has no destination and may be empty. "
718
+ + "Items with children cannot have an address. Move the address into a child item and use a dropdown header. "
719
+ + "nav push refuses PAGE or EXTERNAL_URL items with children locally as nav.group_target_unexpected at the item path, before saving.",
720
+ "pull preserves an existing linked parent's destination as a same-title first child, followed by its existing "
721
+ + "children, and exposes the parent as GROUP_HEADER. Its ID and the children's IDs stay stable across pulls. "
722
+ + "A normal nav push saves this migrated draft; existing published pages change at the next regeneration and deployment.",
697
723
  "externalUrl is an absolute credential-free http/https URL, or a mailto:/tel: contact URL such as "
698
724
  + "tel:+15555550123, published exactly as authored. An http or https address on another host opens in a new tab, "
699
725
  + "and the link says so to a screen reader.",
@@ -705,6 +731,13 @@ const WORKFLOW_REFERENCES = Object.freeze({
705
731
  kind: "NAV_ITEM_KIND_PAGE",
706
732
  title: "Classes",
707
733
  resourceId: "<resourceId-from-manifest>",
734
+ }), Object.freeze({
735
+ id: "<another-author-minted-lowercase-uuid>",
736
+ kind: "NAV_ITEM_KIND_EXTERNAL_URL",
737
+ title: "Sign in",
738
+ externalUrl: "https://app.example.com/sign-in",
739
+ position: "NAV_ITEM_POSITION_HEADER_END",
740
+ appearance: "NAV_ITEM_APPEARANCE_BUTTON",
708
741
  })]),
709
742
  }),
710
743
  }),
@@ -1865,7 +1898,7 @@ const FREE_FORM_REFERENCE = Object.freeze({
1865
1898
  minimumChildren: FREE_FORM_SECTION_REGISTRY.section.minimumChildren,
1866
1899
  additionalProperties: false,
1867
1900
  attrs: Object.freeze(sectionAttributeReference()),
1868
- content: "one or more ordinary non-section block nodes; sections may not nest",
1901
+ content: "ordinary flow blocks or columns layouts; sections may not nest",
1869
1902
  }),
1870
1903
  integrationPlacementNode: Object.freeze({
1871
1904
  type: "integrationPlacement",
@@ -1897,6 +1930,17 @@ const FREE_FORM_REFERENCE = Object.freeze({
1897
1930
  decoration: decorationReference(),
1898
1931
  placementMatrix: placementMatrix(),
1899
1932
  }),
1933
+ columns: Object.freeze({
1934
+ pageType: "free-form",
1935
+ placement: "Directly inside a top-level section only. Each region contains ordinary flow blocks; no nested layouts or full-width bands.",
1936
+ node: FREE_FORM_SECTION_REGISTRY.columns,
1937
+ region: FREE_FORM_SECTION_REGISTRY.column,
1938
+ markdownSyntax: ':::section {}\n:::columns {"ratio":"40-60"}\n:::column {}\nFirst region\n:::endcolumn\n:::column {}\nSecond region\n:::endcolumn\n:::endcolumns\n:::',
1939
+ defaults: "Two equal columns. Omit default count and ratio. Three columns must be equal.",
1940
+ responsive: "Columns stack in source order when the containing section cannot fit every region.",
1941
+ markers: "Headers require JSON objects and no indentation or trailing text. Region options are {}. Fenced code keeps markers literal; a leading backslash escapes a marker. Close every region and layout explicitly before the section.",
1942
+ transport: "Existing whole-response and workspace input limits still apply. Pull writes JSON and does not convert it back to Markdown.",
1943
+ }),
1900
1944
  tables: TABLE_REFERENCE,
1901
1945
  inlineFacts: INLINE_FACTS_REFERENCE,
1902
1946
  workflow: Object.freeze([
@@ -2139,7 +2183,7 @@ export function formatReferenceResult(result) {
2139
2183
  .join("\n")
2140
2184
  }\n\nTransparent-mask example:\n${page.sections.decoration.markdownExample}\n\nMask guidance: ${page.sections.decoration.maskGuidance}\nSize guidance: ${page.sections.decoration.sizeGuidance}\nWarning: ${page.sections.decoration.opaqueWarning}\n\nRoot defaults and placement:\n${
2141
2185
  page.sections.placementMatrix.map(formatPlacement).join("\n")
2142
- }\n\nSemantic tables:\n placement document root or directly inside a top-level section; wide/full-well measure\n rows exactly ${page.tables.structure.headerRows} header row, then ${page.tables.limits.dataRows.min} through ${page.tables.limits.dataRows.max} data rows\n columns ${page.tables.limits.columns.min} through ${page.tables.limits.columns.max}; delimiter and every row must match the header width\n caption optional non-empty plain text; maximum ${page.tables.limits.captionScalars.max} Unicode scalar values; syntax ${page.tables.markdown.captionSyntax}\n caption guidance ${page.tables.captionGuidance}\n cells exactly ${page.tables.structure.paragraphChildrenPerCell} paragraph; headers need non-whitespace text; data cells may be empty; maximum ${page.tables.limits.cellTextScalars.max} text scalars\n inline ${
2186
+ }\n\nColumns inside sections:\n${page.columns.markdownSyntax}\n placement ${page.columns.placement}\n defaults ${page.columns.defaults}\n responsive ${page.columns.responsive}\n markers ${page.columns.markers}\n limits ${page.columns.node.limits.rowsPerSection} rows per section; ${page.columns.node.limits.blocksPerRegion} blocks per region; ${page.columns.node.limits.nodesPerDocument} nodes and depth ${page.columns.node.limits.nodeDepth}\n transport ${page.columns.transport}\n\nSemantic tables:\n placement document root or directly inside a top-level section; wide/full-well measure\n rows exactly ${page.tables.structure.headerRows} header row, then ${page.tables.limits.dataRows.min} through ${page.tables.limits.dataRows.max} data rows\n columns ${page.tables.limits.columns.min} through ${page.tables.limits.columns.max}; delimiter and every row must match the header width\n caption optional non-empty plain text; maximum ${page.tables.limits.captionScalars.max} Unicode scalar values; syntax ${page.tables.markdown.captionSyntax}\n caption guidance ${page.tables.captionGuidance}\n cells exactly ${page.tables.structure.paragraphChildrenPerCell} paragraph; headers need non-whitespace text; data cells may be empty; maximum ${page.tables.limits.cellTextScalars.max} text scalars\n inline ${
2143
2187
  page.tables.structure.inlineNodes.join(", ")
2144
2188
  }; marks ${
2145
2189
  page.tables.structure.marks.join(", ")
@@ -50,7 +50,8 @@ const OPACITY_RENDERS = "Sets the opacity of the canvas image layer in the same
50
50
  + "canvas image is set.";
51
51
 
52
52
  /** The page background image's rendering, stated once for the theme reference, `help settings` and the README. */
53
- export const PAGE_BACKGROUND_IMAGE_RENDERING = "One layer across the whole page box, behind the content. The header and "
53
+ export const PAGE_BACKGROUND_IMAGE_RENDERING =
54
+ "One layer across the whole page box, behind the content. The header and "
54
55
  + "footer paint their own opaque backgrounds over it, so it shows behind the main content only.";
55
56
 
56
57
  export const PAGE_BACKGROUND_VERSUS_CANVAS = Object.freeze({
@@ -104,6 +105,18 @@ const TAPROOT_STYLES_ENTRIES = {
104
105
  LOGO_RENDERS,
105
106
  ),
106
107
  darkLogoUrl: entry(`${BRAND} > Logo`, "Read-only: the delivery URL of darkLogoId."),
108
+ lightCompactLogoId: entry(
109
+ `${HEADER} > Compact logo`,
110
+ "Optional site-owned light-scheme logo for a Fixed header above 1.0. Hidden controls retain saved choices.",
111
+ "Only while the header is compact: this scheme's compact logo, then the other compact scheme, then the regular logo.",
112
+ ),
113
+ lightCompactLogoUrl: entry(`${HEADER} > Compact logo`, "Read-only: the delivery URL of lightCompactLogoId."),
114
+ darkCompactLogoId: entry(
115
+ `${HEADER} > Compact logo`,
116
+ "Optional site-owned dark-scheme logo for a Fixed header above 1.0. Hidden controls retain saved choices.",
117
+ "Only while the header is compact: this scheme's compact logo, then the other compact scheme, then the regular logo.",
118
+ ),
119
+ darkCompactLogoUrl: entry(`${HEADER} > Compact logo`, "Read-only: the delivery URL of darkCompactLogoId."),
107
120
  lightCanvasImageId: entry(
108
121
  "Brand & style > Page canvas > Canvas image",
109
122
  "The site-owned image painted in the side margins of a page in the light scheme.",
@@ -207,9 +220,14 @@ const HEADER_ENTRIES = {
207
220
  ),
208
221
  headerPosition: entry(
209
222
  `${HEADER} > Position`,
210
- "normal lets the header scroll away with the page; sticky keeps it at the top once it reaches it.",
223
+ "normal scrolls away with the page; sticky stays at the top once reached; fixed stays at the viewport top with page space reserved.",
211
224
  "The header at the top of every published page.",
212
225
  ),
226
+ headerHeightMultiplier: entry(
227
+ `${HEADER} > Header height`,
228
+ "A string such as \"1.8\", from \"1.0\" through \"5.0\" in 0.1 steps. Omit it for standard 1.0; integers normalize to one decimal digit.",
229
+ "The primary header bar; extra menu rows and controls keep their size. Fixed headers above 1.0 shrink to standard on scroll; Normal and Sticky retain their height.",
230
+ ),
213
231
  showThemeToggle: entry(
214
232
  `${HEADER} > Theme toggle`,
215
233
  "Whether visitors get a light/dark toggle in the header.",
@@ -468,7 +486,5 @@ export function formatSettingsReference(reference) {
468
486
  }`
469
487
  ).join("\n");
470
488
  const contrast = reference.pageBackgroundVersusCanvas;
471
- return `${reference.title}\nUsage: ${reference.usage}\n\nPage background image versus canvas image:\n - ${
472
- contrast.pageBackground
473
- }\n - ${contrast.canvas}\n - ${contrast.shared}\n\nApp controls stored inside the theme (help theme describes each field):\n${controls}\n\n${groups}\n`;
489
+ return `${reference.title}\nUsage: ${reference.usage}\n\nPage background image versus canvas image:\n - ${contrast.pageBackground}\n - ${contrast.canvas}\n - ${contrast.shared}\n\nApp controls stored inside the theme (help theme describes each field):\n${controls}\n\n${groups}\n`;
474
490
  }
@@ -2,6 +2,7 @@ import { parseTheme } from "@taprootio/espalier/shared/theme";
2
2
 
3
3
  import { SiteAuthoringError } from "./errors.js";
4
4
  import { projectFooterSettingsForWorkspace } from "./footer-contract.js";
5
+ import { parseHeaderHeightMultiplier } from "./header-presentation.js";
5
6
  import { projectPulledTheme } from "./theme-projection.js";
6
7
 
7
8
  /**
@@ -63,6 +64,10 @@ export const SETTINGS_GROUPS = Object.freeze([
63
64
  "lightLogoUrl",
64
65
  "darkLogoId",
65
66
  "darkLogoUrl",
67
+ "lightCompactLogoId",
68
+ "lightCompactLogoUrl",
69
+ "darkCompactLogoId",
70
+ "darkCompactLogoUrl",
66
71
  "lightCanvasImageId",
67
72
  "lightCanvasImageUrl",
68
73
  "darkCanvasImageId",
@@ -95,6 +100,7 @@ export const SETTINGS_GROUPS = Object.freeze([
95
100
  "logoAlt",
96
101
  "navMenuDisplay",
97
102
  "headerPosition",
103
+ "headerHeightMultiplier",
98
104
  "lightBrandColor",
99
105
  "darkBrandColor",
100
106
  ),
@@ -203,6 +209,16 @@ export function projectSettingsGroup(group, response) {
203
209
  const source = message !== null && typeof message === "object" && !Array.isArray(message) ? message : {};
204
210
  const projected = {};
205
211
  for (const field of group.fields) {
212
+ if (field.name === "headerHeightMultiplier") {
213
+ const height = parseHeaderHeightMultiplier(source[field.name]);
214
+ if (!height) {
215
+ throw new SiteAuthoringError("api.setting_contract", "Taproot returned an invalid header height multiplier.", {
216
+ field: field.name,
217
+ });
218
+ }
219
+ if (height.canonical !== "") projected[field.name] = height.canonical;
220
+ continue;
221
+ }
206
222
  projected[field.name] = normalizeField(field, source[field.name]);
207
223
  if (field.wireType === "theme") {
208
224
  // A stored theme is what was written, possibly before a required key
package/src/transport.js CHANGED
@@ -823,10 +823,8 @@ export class SiteApiClient {
823
823
  attempts = LIMITS.requestAttempts,
824
824
  deadline,
825
825
  now = this.now,
826
- // How large a body this one call may read. The default bounds every read
827
- // the way it always has; a caller raises it only for the one contract
828
- // whose valid answer is larger, and never above what its workspace file
829
- // may hold.
826
+ // Replies can include defaults omitted from workspace files, so an
827
+ // endpoint may need a larger, explicit response bound.
830
828
  maximumResponseBytes = LIMITS.apiResponseBytes,
831
829
  } = {}, replaceableMutation) {
832
830
  const url = new URL(path, this.apiBaseUrl);
@@ -301,7 +301,7 @@ const TYPE_DETAILS = Object.freeze({
301
301
  dataFields: [
302
302
  "kind: what the page is, written by pull. Leave it as pulled; a push that changes it is refused (pages.generated_identity)",
303
303
  "customTitle: string; empty uses the generated title (the page's reader-facing title)",
304
- "breadcrumbTitle: string; empty uses the generated label (used on pages beneath this one and as this page's own last crumb)",
304
+ "breadcrumbTitle: string; empty uses the generated label (used on pages beneath this one)",
305
305
  "customDescription: string, at most 1000 characters, about 160 shown in search results; empty uses the "
306
306
  + "introduction's first paragraph, else the generated description",
307
307
  "introductionBody: ProseMirror document (optional), shown above the generated listing",
@@ -2,13 +2,22 @@ import {
2
2
  getNavigation,
3
3
  listSitePages,
4
4
  NAV_ITEM_KIND_EXTERNAL_URL,
5
+ NAV_ITEM_KIND_GROUP_HEADER,
5
6
  NAV_ITEM_KIND_PAGE,
6
7
  NAV_ITEM_KINDS,
8
+ NAV_ITEM_POSITION_UNSPECIFIED,
9
+ NAV_ITEM_POSITION_MENU,
10
+ NAV_ITEM_POSITION_HEADER_END,
11
+ NAV_ITEM_POSITIONS,
12
+ NAV_ITEM_APPEARANCE_UNSPECIFIED,
13
+ NAV_ITEM_APPEARANCE_LINK,
14
+ NAV_ITEM_APPEARANCE_BUTTON,
15
+ NAV_ITEM_APPEARANCES,
7
16
  NAVIGATION_MAXIMUM_DEPTH,
8
17
  saveNavigation,
9
18
  withRefusalGuidance,
10
19
  } from "../api.js";
11
- import { VERB_NAV_PUSH } from "../constants.js";
20
+ import { LIMITS, VERB_NAV_PUSH } from "../constants.js";
12
21
  import {
13
22
  CONTACT_OR_WEB_URL_MAX_LENGTH,
14
23
  CONTACT_OR_WEB_URL_REQUIREMENT,
@@ -34,34 +43,16 @@ import {
34
43
  } from "../workspace.js";
35
44
 
36
45
  /**
37
- * `nav push` — replace the whole navigation tree.
38
- *
39
- * `SaveSiteNavigation` is a whole-tree PUT fenced by a revision (TR01231): the
40
- * pull records the revision the tree was read at, and the save presents it. A
41
- * tree edited in the app since is refused with `nav.concurrent_modification`
42
- * and nothing is written. Two more things follow, and the body does both:
43
- *
44
- * 1. The tree is re-read immediately before the write, so a moved tree is
45
- * refused before anything is sent, and what the replace is about to remove
46
- * is *named* rather than discovered afterwards.
47
- * 2. Local validation is exhaustive and refuses by item path. The server stores
48
- * what it is given; a `PAGE` item carrying `pageId` instead of `resourceId`,
49
- * or a fourth level of nesting, is accepted and then renders wrong. And the
50
- * one shape it does check — `id` and `resourceId` are parsed as GUIDs — it
51
- * refuses with a bare `InvalidArgument` naming no field at all, so a single
52
- * `id: "home"` in a hundred-item tree would come back as an unclassified 400
53
- * with nothing to grep for. A `resourceId` that is a valid UUID pointing at
54
- * no page is the same story with a bare `ResourceId`, so PAGE targets are
55
- * checked against the live page list too. Naming `navItems[1].children[0]`
56
- * is the difference between a fixable error and a hunt.
46
+ * Replaces the whole navigation tree, fenced by the revision pull recorded.
47
+ * Validate locally to name malformed items by their exact workspace path, then
48
+ * re-read before saving so stale work cannot erase somebody else's changes.
57
49
  */
58
50
 
59
51
  const MAXIMUM_REPORTED = 100;
60
- const MAXIMUM_ITEMS = 1_000;
61
52
  const MAXIMUM_TITLE_LENGTH = 200;
62
53
  const MAXIMUM_URL_LENGTH = CONTACT_OR_WEB_URL_MAX_LENGTH;
63
54
  // The item keys in the order the workspace file spells them; validation and projection share this list.
64
- const NAVIGATION_ITEM_KEY_ORDER = Object.freeze(["id", "kind", "title", "resourceId", "externalUrl", "children"]);
55
+ const NAVIGATION_ITEM_KEY_ORDER = Object.freeze(["id", "kind", "title", "resourceId", "externalUrl", "position", "appearance", "children"]);
65
56
  const ITEM_KEYS = new Set(NAVIGATION_ITEM_KEY_ORDER);
66
57
 
67
58
  // `SaveSiteNavigation` maps both `id` and `resourceId` through
@@ -100,8 +91,8 @@ function validateItem(item, itemPath, depth, seenIds, counters) {
100
91
  );
101
92
  }
102
93
  counters.items += 1;
103
- if (counters.items > MAXIMUM_ITEMS) {
104
- throw navError("nav.too_many_items", `the navigation tree holds more than ${MAXIMUM_ITEMS} items.`, itemPath);
94
+ if (counters.items > LIMITS.navigationItems) {
95
+ throw navError("nav.too_many_items", `the navigation tree holds more than ${LIMITS.navigationItems} items.`, itemPath);
105
96
  }
106
97
 
107
98
  const unknown = Object.keys(item).filter((key) => !ITEM_KEYS.has(key)).sort();
@@ -139,6 +130,51 @@ function validateItem(item, itemPath, depth, seenIds, counters) {
139
130
  throw navError("nav.title_invalid", "every navigation item needs a non-empty 'title'.", itemPath);
140
131
  }
141
132
 
133
+ const children = item.children ?? [];
134
+ if (!Array.isArray(children)) {
135
+ throw navError("nav.children_invalid", "'children' must be a list when it is present.", itemPath);
136
+ }
137
+ if (children.length > 0 &&
138
+ (item.kind !== NAV_ITEM_KIND_GROUP_HEADER || !isEmpty(item.resourceId) || !isEmpty(item.externalUrl))) {
139
+ throw navError(
140
+ "nav.group_target_unexpected",
141
+ "Items with children cannot have an address. Move the address into a child item and use a dropdown header.",
142
+ itemPath,
143
+ );
144
+ }
145
+
146
+ if (item.position !== undefined && !NAV_ITEM_POSITIONS.includes(item.position)) {
147
+ throw navError(
148
+ "nav.position_invalid",
149
+ `'position' must be one of ${NAV_ITEM_POSITIONS.join(", ")}.`,
150
+ `${itemPath}.position`,
151
+ );
152
+ }
153
+ const headerEnd = item.position === NAV_ITEM_POSITION_HEADER_END;
154
+ if (headerEnd && (depth !== 1 || item.kind === NAV_ITEM_KIND_GROUP_HEADER || children.length > 0)) {
155
+ throw navError(
156
+ "nav.position_unavailable",
157
+ "Header end is available only for top-level page or external links without children. Use Menu for this item.",
158
+ `${itemPath}.position`,
159
+ );
160
+ }
161
+
162
+ if (item.appearance !== undefined && !NAV_ITEM_APPEARANCES.includes(item.appearance)) {
163
+ throw navError(
164
+ "nav.appearance_invalid",
165
+ `'appearance' must be one of ${NAV_ITEM_APPEARANCES.join(", ")}.`,
166
+ `${itemPath}.appearance`,
167
+ );
168
+ }
169
+ const button = item.appearance === NAV_ITEM_APPEARANCE_BUTTON;
170
+ if (button && item.kind === NAV_ITEM_KIND_GROUP_HEADER) {
171
+ throw navError(
172
+ "nav.appearance_unavailable",
173
+ "Button appearance is available only for page or external links. Use Link for a dropdown header.",
174
+ `${itemPath}.appearance`,
175
+ );
176
+ }
177
+
142
178
  if (item.kind === NAV_ITEM_KIND_PAGE) {
143
179
  if (!isUuid(item.resourceId)) {
144
180
  throw navError(
@@ -174,10 +210,6 @@ function validateItem(item, itemPath, depth, seenIds, counters) {
174
210
  );
175
211
  }
176
212
 
177
- const children = item.children ?? [];
178
- if (!Array.isArray(children)) {
179
- throw navError("nav.children_invalid", "'children' must be a list when it is present.", itemPath);
180
- }
181
213
  const validated = children.map((child, index) =>
182
214
  validateItem(child, `${itemPath}.children[${index}]`, depth + 1, seenIds, counters));
183
215
  // Rebuilt field by field so nothing outside the contract can ride along, and
@@ -189,6 +221,8 @@ function validateItem(item, itemPath, depth, seenIds, counters) {
189
221
  title: item.title.trim(),
190
222
  resourceId: item.kind === NAV_ITEM_KIND_PAGE ? item.resourceId : "",
191
223
  externalUrl: item.kind === NAV_ITEM_KIND_EXTERNAL_URL ? item.externalUrl.trim() : "",
224
+ ...(headerEnd ? { position: NAV_ITEM_POSITION_HEADER_END } : {}),
225
+ ...(button ? { appearance: NAV_ITEM_APPEARANCE_BUTTON } : {}),
192
226
  children: validated,
193
227
  };
194
228
  }
@@ -213,6 +247,8 @@ export function projectNavigationForWorkspace(items) {
213
247
  for (const key of keys) {
214
248
  const value = item[key];
215
249
  if ((key === "resourceId" || key === "externalUrl") && value === "") continue;
250
+ if (key === "position" && (value === NAV_ITEM_POSITION_UNSPECIFIED || value === NAV_ITEM_POSITION_MENU)) continue;
251
+ if (key === "appearance" && (value === NAV_ITEM_APPEARANCE_UNSPECIFIED || value === NAV_ITEM_APPEARANCE_LINK)) continue;
216
252
  if (key === "children" && Array.isArray(value)) {
217
253
  if (value.length > 0) projected.children = projectNavigationForWorkspace(value);
218
254
  continue;
@@ -22,6 +22,7 @@ import {
22
22
  readAuthorsDocument,
23
23
  } from "../authors-contract.js";
24
24
  import { VERB_PAGES_PUSH } from "../constants.js";
25
+ import { normalizeColumnsBody, validateColumnsBody } from "../content/free-form-columns.js";
25
26
  import { autolinkWarnings } from "../content/link-warnings.js";
26
27
  import { placedFormKeys, readFormIndex, withFormIds } from "../form-references.js";
27
28
  import { workspaceFormKeys } from "../forms-workspace.js";
@@ -780,7 +781,7 @@ export async function convertWorkspacePageSource({ source, mediaManifest, conten
780
781
  throw documentError("pages.document_shape", `'${file}' is not valid JSON.`, file);
781
782
  }
782
783
  if (source.template !== TEMPLATE_FREE_FORM) return typedDocumentFromJson(parsed, file);
783
- return unwrapProseMirrorDocument(parsed, file);
784
+ return normalizeColumnsBody(unwrapProseMirrorDocument(parsed, file)).body;
784
785
  }
785
786
 
786
787
  /**
@@ -836,6 +837,12 @@ export async function validateWorkspacePageDocument({
836
837
  }
837
838
  for (const { doc, path, mayBeEmpty, restricted } of contentDocuments(document_)) {
838
839
  const location = path === "" ? file : `${file}:${path}`;
840
+ const columns = validateColumnsBody(doc, { allowColumns: documentTemplate(document_) === TEMPLATE_FREE_FORM });
841
+ if (columns.errors.length > 0) {
842
+ const first = columns.errors[0];
843
+ throw documentError("pages.document_invalid", `'${location}' has an invalid columns layout. Columns are available only inside sections of a free-form page.`, `${location}:${first.path}`)
844
+ .withProblems(columns.errors.map(error => ({ code: error.code, field: `${location}:${error.path}`, message: "Use a valid columns layout in a free-form section." })));
845
+ }
839
846
  assertValid(content, doc, location, { mayBeEmpty });
840
847
  const unsupported = restricted ? unsupportedRestrictedNode(doc) : undefined;
841
848
  if (unsupported !== undefined) {