@taprootio/site-authoring 0.39.0 → 0.40.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 CHANGED
@@ -125,12 +125,12 @@ writes it (`help appearance` prints the same text beside each writable field,
125
125
  and the shipped help is the authority if this table drifts). The ones that are
126
126
  easy to confuse:
127
127
 
128
- | App control | Workspace field | Where it renders |
129
- | --- | --- | --- |
130
- | Brand & style > Page style > Background image | `lightTheme` / `darkTheme` `pageBackgroundImage` (with `pageBackgroundImageOpacity`) | One layer across the page box behind the content; the opaque header and footer cover it, so it shows behind the main content. |
131
- | Brand & style > Page canvas > Canvas image | `lightCanvasImageId` / `darkCanvasImageId` in `taproot-styles.json` (with the two `...CanvasImageOpacity` fields) | Only the empty side margins of a page. Not on a standard site today, whose margins are 0 px wide. |
132
- | Brand & style > Brand > Logo | `lightLogoId` / `darkLogoId` | The header brand and the enabled footer's inherited logo. Each footer scheme may override it with `logoId`. |
133
- | Brand & style > Brand > Favicon | `brand.json` `faviconId` | The icon set in every page's head and `/favicon.ico`. |
128
+ | App control | Workspace field | Where it renders |
129
+ | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
130
+ | Brand & style > Page style > Background image | `lightTheme` / `darkTheme` `pageBackgroundImage` (with `pageBackgroundImageOpacity`) | One layer across the page box behind the content; the opaque header and footer cover it, so it shows behind the main content. |
131
+ | Brand & style > Page canvas > Canvas image | `lightCanvasImageId` / `darkCanvasImageId` in `taproot-styles.json` (with the two `...CanvasImageOpacity` fields) | Only the empty side margins of a page. Not on a standard site today, whose margins are 0 px wide. |
132
+ | Brand & style > Brand > Logo | `lightLogoId` / `darkLogoId` | The header brand and the enabled footer's inherited logo. Each footer scheme may override it with `logoId`. |
133
+ | Brand & style > Brand > Favicon | `brand.json` `faviconId` | The icon set in every page's head and `/favicon.ico`. |
134
134
 
135
135
  Both background layers tile at the image's natural pixel size from the top-left;
136
136
  neither sets a size, repeat or position.
@@ -183,11 +183,11 @@ Desktop, Small desktop, Tablet, Phone and Small phone (320px). They show at most
183
183
  metrics, type scale and gaps are assumed; custom fonts or scale may differ.
184
184
  Supported whitespace, hyphen and zero-width breaks are estimated, with bounded
185
185
  contextual shaping; fragments containing Han, Kana or Thai are skipped.
186
- Unknown logo proportions
186
+ Local upload dimensions follow the selected footer artwork. Unknown proportions
187
187
  use the 4:1 maximum, so a narrow logo can produce extra brand warnings.
188
188
  Warnings allow the push. Managed Docs workspaces get the same check; deployment
189
189
  checks cover standard and profile sites. Footer overrides count as logos even without
190
- a site logo. After upgrading to this v7 footer hash
190
+ a site logo. After upgrading to the v8 footer hash
191
191
  contract, pull again before pushing.
192
192
 
193
193
  `validate` also runs the site checks that need nothing but the workspace, from
@@ -352,12 +352,12 @@ explicitly and bypasses discovery. `login`, `logout`, `sites`, `use`,
352
352
  }
353
353
  ```
354
354
 
355
- | Field | Rule |
356
- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
357
- | `configVersion` | Must be `1`. |
358
- | `siteId` | Optional. The canonical lowercase UUID of the site the next command writes to. `use` writes it; a present but malformed value is refused. |
359
- | `authoringSurface` | Optional. `standard`, `docs-presentation`, or `none`: the verbs the site accepts, as `use` recorded them. A present but unknown value is refused; Taproot re-resolves the surface on every write. |
360
- | `workspaceDir` | Required. A relative POSIX path beneath the configuration directory that `pull` writes into. Every existing segment must be a real directory. |
355
+ | Field | Rule |
356
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
357
+ | `configVersion` | Must be `1`. |
358
+ | `siteId` | Optional. The canonical lowercase UUID of the site the next command writes to. `use` writes it; a present but malformed value is refused. |
359
+ | `authoringSurface` | Optional. `standard`, `docs-presentation`, or `none`: the verbs the site accepts, as `use` recorded them. A present but unknown value is refused; Taproot re-resolves the surface on every write. |
360
+ | `workspaceDir` | Required. A relative POSIX path beneath the configuration directory that `pull` writes into. Every existing segment must be a real directory. |
361
361
 
362
362
  The file is a small, closed JSON object. Unknown fields, duplicate keys, links
363
363
  in the path, and unsupported versions are refused before any credential is
@@ -418,7 +418,7 @@ each step names the reference it relies on.
418
418
  `theme push --dry-run` reads the site and lists the JSON paths at which
419
419
  each settings file differs from it, and whether the baseline `pull`
420
420
  recorded is still current; `theme push` saves both themes, the appearance
421
- scalars and the ten footer scheme colours in one transaction fenced by
421
+ scalars, header/footer contexts and logo variants in one transaction fenced by
422
422
  that baseline. A concurrent change to any of those fields refuses the
423
423
  whole push (`theme.concurrent_modification`) and nothing is written: keep
424
424
  copies of the edited files, pull, re-apply, push again. A lost response is
@@ -426,8 +426,17 @@ each step names the reference it relies on.
426
426
  `theme push` again with the same files replays it under its original
427
427
  baseline, and the site answers `applied: false` when it already holds the
428
428
  change set. `pull` reads the four settings documents and the revision
429
- from one snapshot, and `footer push` advances the recorded revision only
430
- when its save replaced that same revision.
429
+ from one snapshot. `footer push` saves only content and retains local presentation
430
+ edits for the next `theme push`; it does not advance over unseen presentation edits.
431
+ Set `site-header.context` and `footerSettings.context` to a context declared
432
+ by both themes, or remove the key to follow the page colors. The five footer
433
+ color fields are retired; `help appearance` gives the color-to-context recipe.
434
+ Each surface's `logoVariant` is empty to match the color scheme, `light` for
435
+ light-background artwork, or `dark` for dark-background artwork. `validate`
436
+ reports an advisory brightness mismatch when another variant can fix it;
437
+ inspect the artwork in both schemes on staging. Offline workspaces have no
438
+ profile fallback metadata, and unknown image dimensions retain conservative
439
+ footer-fit estimates.
431
440
  6. **Review on staging in both schemes.** `staging review` (or
432
441
  `deploy --staging --handoff`) returns a single-use handoff in
433
442
  `stagingPreview.url`, on a managed Docs site too; open it once and use the
@@ -534,7 +543,7 @@ Markdown subset accepts levels 1 to 4.
534
543
  A `.pm.json` page's title, path, description and author live in the workspace
535
544
  manifest rather than the file. `pages meta set <path> --title <text>
536
545
  --description <text>` changes the title or description there (a Markdown page
537
- keeps them in its front matter; `--author` is described under *Page authors*); `pull` keeps that edit until `pages push`
546
+ keeps them in its front matter; `--author` is described under _Page authors_); `pull` keeps that edit until `pages push`
538
547
  sends it, and a site edit to the same page conflicts only while that edit is unpushed
539
548
  (`pages.pull_conflict`; see the pull rule above). A
540
549
  description over 160 characters is a warning (`descriptionWarnings`), because
@@ -551,6 +560,7 @@ section. The regions stack in source order when the section is too narrow.
551
560
  :::section {}
552
561
  :::columns {"ratio":"40-60"}
553
562
  :::column {}
563
+
554
564
  ## Start a conversation
555
565
 
556
566
  Tell us about your project.
@@ -1280,7 +1290,10 @@ The same ProseMirror node is:
1280
1290
  "cite": "https://www.huxley.net/bnw/four.html"
1281
1291
  },
1282
1292
  "content": [
1283
- { "type": "paragraph", "content": [{ "type": "text", "text": "Words can be like X-rays." }] }
1293
+ {
1294
+ "type": "paragraph",
1295
+ "content": [{ "type": "text", "text": "Words can be like X-rays." }]
1296
+ }
1284
1297
  ]
1285
1298
  }
1286
1299
  ```
@@ -1,5 +1,5 @@
1
1
  {
2
- "manifestVersion": 7,
2
+ "manifestVersion": 8,
3
3
  "siteId": "a0000000-0000-4000-8000-000000000001",
4
4
  "pulledAt": "2026-09-04T00:00:00.000Z",
5
5
  "pages": [
@@ -27,11 +27,6 @@
27
27
  }
28
28
  ],
29
29
  "light": {
30
- "backgroundColor": "--esp-color-layer-1",
31
- "textColor": "--esp-color-text",
32
- "headingColor": "--esp-color-headings",
33
- "linkColor": "--esp-color-link",
34
- "linkHoverColor": "--esp-color-link-hover",
35
30
  "backgroundImageId": "",
36
31
  "backgroundImageOpacity": 0,
37
32
  "backgroundPresentation": "FOOTER_BACKGROUND_PRESENTATION_COVER",
@@ -41,11 +36,6 @@
41
36
  "logoId": "a0000000-0000-4000-8000-0000000000a0"
42
37
  },
43
38
  "dark": {
44
- "backgroundColor": "--esp-color-layer-1",
45
- "textColor": "--esp-color-text",
46
- "headingColor": "--esp-color-headings",
47
- "linkColor": "--esp-color-link",
48
- "linkHoverColor": "--esp-color-link-hover",
49
39
  "backgroundImageId": "",
50
40
  "backgroundImageOpacity": 0,
51
41
  "backgroundPresentation": "FOOTER_BACKGROUND_PRESENTATION_COVER",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taprootio/site-authoring",
3
- "version": "0.39.0",
3
+ "version": "0.40.0",
4
4
  "description": "Taproot site authoring CLI: sign in once in the browser, then pull, validate, push, preview, approve, and deploy a site from the terminal",
5
5
  "type": "module",
6
6
  "license": "ISC",
@@ -28,7 +28,7 @@
28
28
  "README.md"
29
29
  ],
30
30
  "dependencies": {
31
- "@taprootio/espalier": "7.1.0",
31
+ "@taprootio/espalier": "7.1.1",
32
32
  "mediabunny": "1.61.1"
33
33
  },
34
34
  "scripts": {
package/src/api.js CHANGED
@@ -877,11 +877,10 @@ export async function getSitePresentation(client, siteId) {
877
877
 
878
878
  /**
879
879
  * Applies a presentation change set atomically (TR00807). `expectedRevision`
880
- * is the revision the workspace was pulled at; `expectedFooterDraftHash` is
881
- * the footer document's draft token from the read immediately before, because
882
- * the server overlays the ten colours onto that document. Sent through the
883
- * replayable-POST path: a save whose response was lost is answered as already
884
- * current when it committed, and applied when it did not.
880
+ * is the revision the workspace was pulled at. Surface contexts are saved
881
+ * with the themes that declare them, independently of footer content. The
882
+ * replayable POST answers a lost response as already current when the save
883
+ * committed, and applies it when it did not.
885
884
  */
886
885
  export async function saveSitePresentation(client, siteId, body) {
887
886
  const response = requireObject(
@@ -1,13 +1,15 @@
1
1
  import { BLOCK_SPACINGS, DEFAULT_BLOCK_SPACING } from "./block-flow.js";
2
2
  import { hasControlCharacter, isCanonicalUuid, SiteAuthoringError } from "./errors.js";
3
- import { HEADER_HEIGHT_MULTIPLIER_LIMITS, parseHeaderHeightMultiplier } from "./header-presentation.js";
3
+ import { FOOTER_PRESENTATION_FIELDS } from "./footer-content.js";
4
+ import { refuseRetiredFooterColors } from "./footer-contract.js";
5
+ import { HEADER_HEIGHT_MULTIPLIER_LIMITS, LOGO_VARIANTS, parseHeaderHeightMultiplier } from "./header-presentation.js";
4
6
  import {
5
7
  SETTINGS_TYPE_BRAND,
6
8
  SETTINGS_TYPE_SITE_HEADER,
7
9
  SETTINGS_TYPE_SITE_PUBLISHING_PREFERENCES,
8
10
  SETTINGS_TYPE_TAPROOT_STYLES,
9
11
  } from "./settings-catalog.js";
10
- import { FOOTER_COLOR_TOKENS, HEADER_BRAND_COLOR_TOKENS, requireAppearanceColor } from "./theme-validation.js";
12
+ import { HEADER_BRAND_COLOR_TOKENS, requireAppearanceColor } from "./theme-validation.js";
11
13
 
12
14
  export const APPEARANCE_FILES = Object.freeze({
13
15
  [SETTINGS_TYPE_TAPROOT_STYLES]: "settings/taproot-styles.json",
@@ -67,6 +69,23 @@ export const APPEARANCE_SCALAR_FIELDS = Object.freeze([
67
69
  type: "site-owned-image-id",
68
70
  default: "",
69
71
  }),
72
+ Object.freeze({
73
+ settingsType: SETTINGS_TYPE_SITE_HEADER,
74
+ name: "logoVariant",
75
+ path: "site-header.logoVariant",
76
+ type: "enum",
77
+ values: LOGO_VARIANTS,
78
+ optional: true,
79
+ default: "",
80
+ }),
81
+ Object.freeze({
82
+ settingsType: SETTINGS_TYPE_SITE_HEADER,
83
+ name: "context",
84
+ path: "site-header.context",
85
+ type: "theme-context",
86
+ optional: true,
87
+ default: "",
88
+ }),
70
89
  Object.freeze({
71
90
  settingsType: SETTINGS_TYPE_SITE_HEADER,
72
91
  name: "headerLayout",
@@ -131,15 +150,17 @@ export const APPEARANCE_SCALAR_FIELDS = Object.freeze([
131
150
  values: Object.freeze(["normal", "sticky", "fixed"]),
132
151
  default: "normal",
133
152
  }),
134
- ...["headerHeightMultiplier", "headerMinHeightMultiplier"].map(name => Object.freeze({
135
- settingsType: SETTINGS_TYPE_SITE_HEADER,
136
- name,
137
- path: `site-header.${name}`,
138
- type: "header-height-multiplier",
139
- ...HEADER_HEIGHT_MULTIPLIER_LIMITS,
140
- optional: true,
141
- default: "",
142
- })),
153
+ ...["headerHeightMultiplier", "headerMinHeightMultiplier"].map(name =>
154
+ Object.freeze({
155
+ settingsType: SETTINGS_TYPE_SITE_HEADER,
156
+ name,
157
+ path: `site-header.${name}`,
158
+ type: "header-height-multiplier",
159
+ ...HEADER_HEIGHT_MULTIPLIER_LIMITS,
160
+ optional: true,
161
+ default: "",
162
+ })
163
+ ),
143
164
  Object.freeze({
144
165
  settingsType: SETTINGS_TYPE_SITE_HEADER,
145
166
  name: "showThemeToggle",
@@ -218,21 +239,16 @@ export const APPEARANCE_READ_ONLY_FIELDS = Object.freeze([
218
239
  Object.freeze({ file: APPEARANCE_FILES[SETTINGS_TYPE_BRAND], path: "settings.faviconUrl" }),
219
240
  ]);
220
241
 
221
- export const APPEARANCE_FOOTER_COLOR_FIELDS = Object.freeze(
222
- ["light", "dark"].flatMap((scheme) =>
223
- Object.keys(FOOTER_COLOR_TOKENS).map((name) =>
224
- Object.freeze({
225
- file: APPEARANCE_FILES[SETTINGS_TYPE_SITE_PUBLISHING_PREFERENCES],
226
- path: `settings.footerSettings.${scheme}.${name}`,
227
- scheme,
228
- name,
229
- type: "appearance-color",
230
- default: "",
231
- allowedTokens: FOOTER_COLOR_TOKENS[name],
232
- })
233
- )
234
- ),
235
- );
242
+ export const APPEARANCE_FOOTER_FIELDS = Object.freeze(FOOTER_PRESENTATION_FIELDS.map(name =>
243
+ Object.freeze({
244
+ file: APPEARANCE_FILES[SETTINGS_TYPE_SITE_PUBLISHING_PREFERENCES],
245
+ path: `settings.footerSettings.${name}`,
246
+ name,
247
+ ...(name === "context" ? { type: "theme-context" } : { type: "enum", values: LOGO_VARIANTS }),
248
+ optional: true,
249
+ default: "",
250
+ })
251
+ ));
236
252
 
237
253
  export const APPEARANCE_IMAGE_FIELDS = Object.freeze(
238
254
  APPEARANCE_SCALAR_FIELDS.filter((field) => field.type === "site-owned-image-id"),
@@ -283,6 +299,15 @@ function validateScalar(definition, value, knownImageIds) {
283
299
  return value;
284
300
  case "string":
285
301
  return requireString(value, definition.path);
302
+ case "theme-context":
303
+ if (typeof value !== "string") {
304
+ fail(
305
+ "settings.context_unknown",
306
+ `${definition.path} must name a shared theme context or be empty.`,
307
+ definition.path,
308
+ );
309
+ }
310
+ return value;
286
311
  case "plain-text": {
287
312
  const text = requireString(value, definition.path, definition.maximumLength);
288
313
  if ([...text].some((character) => character === "<" || character === ">" || character === "\"")) {
@@ -355,7 +380,7 @@ export function buildAppearanceScalarOperations(documents, knownImageIds) {
355
380
  }));
356
381
  }
357
382
 
358
- export function footerColorOverlay(workspaceFooter) {
383
+ export function footerPresentationOverlay(workspaceFooter) {
359
384
  if (workspaceFooter === null || typeof workspaceFooter !== "object" || Array.isArray(workspaceFooter)) {
360
385
  fail(
361
386
  "theme.footer_missing",
@@ -363,38 +388,22 @@ export function footerColorOverlay(workspaceFooter) {
363
388
  "site-publishing-preferences.footerSettings",
364
389
  );
365
390
  }
366
- const colors = { light: {}, dark: {} };
367
- for (const definition of APPEARANCE_FOOTER_COLOR_FIELDS) {
368
- const scheme = workspaceFooter[definition.scheme];
391
+ refuseRetiredFooterColors(workspaceFooter);
392
+ for (const name of ["light", "dark"]) {
393
+ const scheme = workspaceFooter[name];
369
394
  if (scheme === null || typeof scheme !== "object" || Array.isArray(scheme)) {
370
395
  fail(
371
396
  "theme.footer_invalid",
372
- `footerSettings.${definition.scheme} must be an object.`,
373
- `footerSettings.${definition.scheme}`,
397
+ `footerSettings.${name} must be an object.`,
398
+ `footerSettings.${name}`,
374
399
  );
375
400
  }
376
- colors[definition.scheme][definition.name] = requireAppearanceColor(
377
- scheme[definition.name] === undefined ? "" : scheme[definition.name],
378
- definition.allowedTokens,
379
- `footerSettings.${definition.scheme}.${definition.name}`,
380
- );
381
401
  }
382
- return colors;
383
- }
384
-
385
- export function applyFooterColors(currentFooter, colors) {
386
- const next = structuredClone(
387
- currentFooter !== null && typeof currentFooter === "object" && !Array.isArray(currentFooter)
388
- ? currentFooter
389
- : {},
390
- );
391
- for (const scheme of ["light", "dark"]) {
392
- next[scheme] = {
393
- ...(next[scheme] !== null && typeof next[scheme] === "object" && !Array.isArray(next[scheme])
394
- ? next[scheme]
395
- : {}),
396
- ...colors[scheme],
397
- };
398
- }
399
- return next;
402
+ return Object.fromEntries(APPEARANCE_FOOTER_FIELDS.map(definition => [
403
+ definition.name,
404
+ validateScalar(
405
+ { ...definition, path: `footerSettings.${definition.name}` },
406
+ workspaceFooter[definition.name] === undefined ? definition.default : workspaceFooter[definition.name],
407
+ ),
408
+ ]));
400
409
  }
@@ -1,5 +1,23 @@
1
1
  {
2
2
  "entries": [
3
+ {
4
+ "version": "0.40.0",
5
+ "note": "Choose a theme context and logo artwork independently for the header and footer, with an offline warning when the selected artwork may be hard to see.",
6
+ "behavior": [
7
+ "The bundled Espalier is 7.1.1. Header and footer contexts reach their controls and navigation, and panel menus keep a full-screen dismissing scrim. The default site theme is unchanged apart from its Espalier version.",
8
+ "Header context and footerSettings.context select a context declared in both theme schemes. Empty uses the root colors. Theme push saves both contexts with the theme atomically; footer push preserves them.",
9
+ "The five footer color overrides in each scheme are retired. Before this API release deploys, pull every site with custom footer colors using the previous CLI and preserve those values. After upgrading, pull again and recreate the colors as a context in both theme schemes. Old color keys are refused with their field paths.",
10
+ "Header logoVariant and footerSettings.logoVariant accept empty, light or dark. Empty follows the page scheme; light and dark select that artwork in both schemes. Header and footer select independently, including compact header artwork and per-scheme footer overrides. Theme push owns these choices; footer push preserves them, logo ids, scale, box and alignment.",
11
+ "Offline validation adds the warning brand.logo_on_surface when the selected artwork is likely hard to see on its resolved surface and another choice selects different artwork. It uses theme brightness and artwork identity, not image pixels or background images. Unavailable theme engines and surfaces with no meaningful alternative are skipped; warnings never block a save.",
12
+ "Workspace manifests now use version 8. Footer concurrency uses footer-draft-v8, footer content uses footer-content-v3, and atomic presentation revisions use site-presentation-v2. Upgrade and pull again before validating, planning or pushing an older workspace.",
13
+ "The help reference version is 61."
14
+ ],
15
+ "help": [
16
+ "theme",
17
+ "appearance",
18
+ "footer"
19
+ ]
20
+ },
3
21
  {
4
22
  "version": "0.39.0",
5
23
  "note": "Set footer widths, responsive alignment and artwork space, choose independent logos and scale, and check whether words fit before saving.",
package/src/cli.js CHANGED
@@ -519,7 +519,7 @@ const VERBS = Object.freeze([
519
519
  tokens: ["plan"],
520
520
  summary: "Check the whole workspace against the live site and order what is left to send. Writes nothing.",
521
521
  note: "Runs every check the pushes run — each page against the site's pages, revisions, videos and forms; media that "
522
- + "pages reference and media upload has not sent; the theme, appearance and footer colors against the site's "
522
+ + "pages reference and media upload has not sent; the theme, appearance, surface contexts and logo variants against the site's "
523
523
  + "presentation revision; the footer against its draft; navigation against the live page list and the revision pull recorded (an unchanged tree under a stale revision is listed ready with settlesLostPush, so apply settles a push whose answer was lost) — and lists "
524
524
  + "every problem with its area, file, code and field. It then orders the steps that remain: media upload, "
525
525
  + "pages push, footer push (theme push refuses unsaved footer content), theme push, nav push, each marked "
@@ -689,7 +689,7 @@ const VERBS = Object.freeze([
689
689
  summary: "Validate and push the workspace's complete theme and appearance settings in one atomic save.",
690
690
  note: "Run pull first. Theme JSON stays decoded in the workspace; this command validates the complete light/dark"
691
691
  + " pair and encodes it only at the API boundary. Image settings reference site-owned image IDs from media upload. "
692
- + "The complete change set — both themes, the appearance scalars, and the ten footer scheme colors — is saved in "
692
+ + "The complete change set — both themes, the appearance scalars, and the header/footer contexts and logo variants — is saved in "
693
693
  + "one transaction fenced by the presentation revision pull recorded: a concurrent change to any of those "
694
694
  + "fields refuses the whole push (theme.concurrent_modification) and nothing is written. A save whose response "
695
695
  + "was lost is replayed safely; the site answers applied=false when it already holds the change set. "
@@ -1,3 +1,4 @@
1
+ import { sharedDeclaredThemeContextNames } from "../theme-contexts.js";
1
2
  import registry from "./free-form-section-registry.json" with { type: "json" };
2
3
  import { imageDescriptionIssues, pickImageDescriptionFields } from "./image-description-validation.js";
3
4
 
@@ -538,9 +539,7 @@ export function normalizeFreeFormSectionDecoration(
538
539
 
539
540
  /** The exact, sorted context names present in both staged site themes. */
540
541
  export function sharedThemeContextNames(lightTheme, darkTheme) {
541
- const light = isPlainObject(lightTheme?.contexts) ? lightTheme.contexts : {};
542
- const dark = isPlainObject(darkTheme?.contexts) ? darkTheme.contexts : {};
543
- return Object.freeze(Object.keys(light).filter((name) => Object.hasOwn(dark, name)).sort());
542
+ return Object.freeze(sharedDeclaredThemeContextNames(lightTheme, darkTheme));
544
543
  }
545
544
 
546
545
  /**
@@ -1,7 +1,9 @@
1
1
  import { APPEARANCE_FILES } from "./appearance-contract.js";
2
- import { isCanonicalUuid } from "./errors.js";
2
+ import { resolveFooterLogoPairs } from "./footer-branding.js";
3
+ import { footerLogoAspectRatio } from "./footer-fit.js";
4
+ import { logoInputsFromSettings } from "./logo-inputs.js";
3
5
  import { SETTINGS_TYPE_SITE_HEADER, SETTINGS_TYPE_TAPROOT_STYLES } from "./settings-catalog.js";
4
- import { readWorkspaceJson, WORKSPACE_LIMITS } from "./workspace.js";
6
+ import { MEDIA_MANIFEST_FILE_NAME, readWorkspaceJson, WORKSPACE_LIMITS } from "./workspace.js";
5
7
 
6
8
  async function optionalSettings(workspaceDir, settingsType) {
7
9
  try {
@@ -14,13 +16,18 @@ async function optionalSettings(workspaceDir, settingsType) {
14
16
 
15
17
  /** Optional files are independent: losing the header must not discard a known logo, or the reverse. */
16
18
  export async function readFooterBrandInputs(workspaceDir, footerSettings) {
17
- const [header, styles] = await Promise.all([
19
+ const [header, styles, media] = await Promise.all([
18
20
  optionalSettings(workspaceDir, SETTINGS_TYPE_SITE_HEADER),
19
21
  optionalSettings(workspaceDir, SETTINGS_TYPE_TAPROOT_STYLES),
22
+ readWorkspaceJson(workspaceDir, MEDIA_MANIFEST_FILE_NAME, WORKSPACE_LIMITS.manifestBytes).then(value => value?.media ?? {}).catch(() => ({})),
20
23
  ]);
24
+ const pair = resolveFooterLogoPairs({ ...logoInputsFromSettings(styles, footerSettings, media), logoVariant: footerSettings?.logoVariant });
25
+ const visible = [pair.light, pair.dark].filter(value => value.url !== "");
26
+ const ratios = visible.map(value => Number(value.aspectRatio));
27
+ const knownRatios = visible.length > 0 && ratios.every(value => Number.isFinite(value) && value > 0);
21
28
  return {
22
29
  brandText: typeof header?.brandText === "string" ? header.brandText : "",
23
- hasLogo: [styles?.lightLogoId, styles?.darkLogoId, footerSettings?.light?.logoId, footerSettings?.dark?.logoId]
24
- .some(isCanonicalUuid),
30
+ hasLogo: visible.length > 0,
31
+ ...(knownRatios ? { logoAspectRatio: footerLogoAspectRatio(ratios) } : {}),
25
32
  };
26
33
  }
@@ -1,6 +1,6 @@
1
1
  // Generated from shared/footer-branding.ts by scripts/sync-field-validation.mjs. Do not edit.
2
2
  import { DISPLAY_SCALE_LIMITS, parseDisplayScale } from "./display-scale.js";
3
- import { resolveHeaderLogoPairs } from "./header-presentation.js";
3
+ import { resolveHeaderLogoPairs, resolveLogoVariant, } from "./header-presentation.js";
4
4
  export const FOOTER_LOGO_SCALE_LIMITS = DISPLAY_SCALE_LIMITS;
5
5
  export const FOOTER_LOGO_BOX = Object.freeze({ heightRem: 3, maxWidthRem: 12 });
6
6
  /** TR01365's unpublished Large setting scaled both logo and text before separation. */
@@ -11,7 +11,7 @@ export function parseFooterLogoScale(value, brandSize) {
11
11
  export function resolveFooterLogoScale(value, brandSize) {
12
12
  return parseFooterLogoScale(value, brandSize) ?? parseDisplayScale("");
13
13
  }
14
- export function footerBrandSizeStyles(size, logoScale) {
14
+ export function footerBrandSizeStyleMap(size, logoScale) {
15
15
  const scale = resolveFooterLogoScale(logoScale, size).scale;
16
16
  const declarations = {};
17
17
  if (scale !== 1) {
@@ -25,14 +25,20 @@ export function footerBrandSizeStyles(size, logoScale) {
25
25
  declarations["--esp-footer-brand-text-size"] = "var(--esp-type-big)";
26
26
  declarations["--esp-footer-brand-text-size-compact"] = "var(--esp-type-large)";
27
27
  }
28
- return Object.entries(declarations).map(([key, value]) => `${key}: ${value};`).join(" ");
28
+ return declarations;
29
+ }
30
+ export function footerBrandSizeStyles(size, logoScale) {
31
+ return Object.entries(footerBrandSizeStyleMap(size, logoScale)).map(([key, value]) => `${key}: ${value};`).join(" ");
29
32
  }
30
33
  /** An unset footer scheme inherits its site scheme, never the other footer override. */
31
34
  export function resolveFooterLogoPairs(input) {
32
- const site = resolveHeaderLogoPairs(input);
35
+ // A footer inherits the site pair before either surface selects its artwork.
36
+ const site = resolveHeaderLogoPairs({ ...input, logoVariant: "" });
33
37
  const override = (id, url = "", aspectRatio = "", inherited) => id ? { url, aspectRatio: url ? aspectRatio : "" } : inherited;
34
- return {
38
+ const effective = {
35
39
  light: override(input.lightFooterLogoId, input.lightFooterLogoUrl, input.lightFooterLogoAspectRatio, site.light),
36
40
  dark: override(input.darkFooterLogoId, input.darkFooterLogoUrl, input.darkFooterLogoAspectRatio, site.dark),
37
41
  };
42
+ const variant = resolveLogoVariant(input.logoVariant);
43
+ return variant ? { light: effective[variant], dark: effective[variant] } : effective;
38
44
  }
@@ -0,0 +1,10 @@
1
+ // Generated from shared/footer-content.ts by scripts/sync-field-validation.mjs. Do not edit.
2
+ /** These fields belong to presentation; footer content saves and dirty checks leave them alone. */
3
+ export const FOOTER_PRESENTATION_FIELDS = ["context", "logoVariant"];
4
+ /** Preserve raw content values; callers decide whether their document needs normalization. */
5
+ export function projectFooterContent(settings) {
6
+ const content = { ...settings };
7
+ for (const field of FOOTER_PRESENTATION_FIELDS)
8
+ delete content[field];
9
+ return content;
10
+ }