@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.
@@ -4,6 +4,7 @@ import {
4
4
  isContactOrWebUrl,
5
5
  } from "./contact-url.js";
6
6
  import { hasControlCharacter, isCanonicalUuid, SiteAuthoringError } from "./errors.js";
7
+ import { LOGO_VARIANTS, resolveLogoVariant } from "./header-presentation.js";
7
8
  import { parseFooterLogoScale, resolveFooterLogoScale } from "./footer-branding.js";
8
9
  import {
9
10
  FOOTER_ALIGNMENT_LAYOUTS,
@@ -15,7 +16,6 @@ import {
15
16
  } from "./footer-alignment.js";
16
17
  import { isSocialLinkUrl, SOCIAL_LINK_URL_MAX_LENGTH, trimSocialLinkInput } from "./social-link-url.js";
17
18
  import socialPlatforms from "./social-platforms.json" with { type: "json" };
18
- import { FOOTER_COLOR_TOKENS, requireAppearanceColor } from "./theme-validation.js";
19
19
 
20
20
  export const FOOTER_LIMITS = Object.freeze({
21
21
  linkColumns: 6,
@@ -81,6 +81,8 @@ export const FOOTER_FIELD_INVENTORY = Object.freeze({
81
81
  "asideAlignment",
82
82
  "bottomAlignment",
83
83
  "logoBox",
84
+ "context",
85
+ "logoVariant",
84
86
  ]),
85
87
  FooterLinkColumn: Object.freeze(["id", "groups", "span", "alignment"]),
86
88
  FooterAlignment: Object.freeze(["horizontal", "vertical", "textAlign"]),
@@ -95,11 +97,6 @@ export const FOOTER_FIELD_INVENTORY = Object.freeze({
95
97
  FooterRichTextRun: Object.freeze(["text", "bold", "italic", "underline", "link"]),
96
98
  FooterInlineLink: Object.freeze(["pageResourceId", "externalUrl"]),
97
99
  FooterSchemeSettings: Object.freeze([
98
- "backgroundColor",
99
- "textColor",
100
- "headingColor",
101
- "linkColor",
102
- "linkHoverColor",
103
100
  "backgroundImageId",
104
101
  "backgroundImageUrl",
105
102
  "backgroundImageOpacity",
@@ -138,6 +135,23 @@ function fail(code, message, field) {
138
135
  throw new SiteAuthoringError(code, message, { field });
139
136
  }
140
137
 
138
+ /** Refuse the retired model before closed-object errors obscure the migration recipe. */
139
+ export function refuseRetiredFooterColors(footer) {
140
+ for (const schemeName of ["light", "dark"]) {
141
+ const scheme = footer?.[schemeName];
142
+ if (!isPlainObject(scheme)) continue;
143
+ for (const name of ["backgroundColor", "textColor", "headingColor", "linkColor", "linkHoverColor"]) {
144
+ if (!Object.hasOwn(scheme, name)) continue;
145
+ const field = `footerSettings.${schemeName}.${name}`;
146
+ fail(
147
+ "appearance.retired_footer_color",
148
+ `${field} is retired. Declare a context in both themes and set footerSettings.context; 'taproot-site help appearance' gives the color-to-context recipe.`,
149
+ field,
150
+ );
151
+ }
152
+ }
153
+ }
154
+
141
155
  function object(value, path, { nullable = false } = {}) {
142
156
  if (nullable && (value === null || value === undefined)) return null;
143
157
  if (!isPlainObject(value)) fail("footer.document_invalid", `${path} must be a JSON object.`, path);
@@ -471,23 +485,6 @@ function scheme(value, path, knownImageIds) {
471
485
  );
472
486
  }
473
487
  return {
474
- backgroundColor: requireAppearanceColor(
475
- value.backgroundColor ?? "",
476
- FOOTER_COLOR_TOKENS.backgroundColor,
477
- `${path}.backgroundColor`,
478
- ),
479
- textColor: requireAppearanceColor(value.textColor ?? "", FOOTER_COLOR_TOKENS.textColor, `${path}.textColor`),
480
- headingColor: requireAppearanceColor(
481
- value.headingColor ?? "",
482
- FOOTER_COLOR_TOKENS.headingColor,
483
- `${path}.headingColor`,
484
- ),
485
- linkColor: requireAppearanceColor(value.linkColor ?? "", FOOTER_COLOR_TOKENS.linkColor, `${path}.linkColor`),
486
- linkHoverColor: requireAppearanceColor(
487
- value.linkHoverColor ?? "",
488
- FOOTER_COLOR_TOKENS.linkHoverColor,
489
- `${path}.linkHoverColor`,
490
- ),
491
488
  logoId: imageId(value.logoId, `${path}.logoId`, knownImageIds),
492
489
  backgroundImageId: imageId(value.backgroundImageId, `${path}.backgroundImageId`, knownImageIds),
493
490
  backgroundImageOpacity: number(value.backgroundImageOpacity, 1, `${path}.backgroundImageOpacity`, 0, 1),
@@ -547,11 +544,6 @@ function featureImage(value, knownImageIds, tolerateStoredValues) {
547
544
 
548
545
  export function footerDefaults() {
549
546
  const defaults = () => ({
550
- backgroundColor: "",
551
- textColor: "",
552
- headingColor: "",
553
- linkColor: "",
554
- linkHoverColor: "",
555
547
  logoId: "",
556
548
  backgroundImageId: "",
557
549
  backgroundImageOpacity: 1,
@@ -587,6 +579,7 @@ function normalizeFooterDocument(
587
579
  { knownPageResourceIds, knownImageIds, tolerateStoredValues = false } = {},
588
580
  ) {
589
581
  value = object(value ?? {}, "footerSettings");
582
+ refuseRetiredFooterColors(value);
590
583
  closed(value, "FooterSettings", "footerSettings");
591
584
  const seenColumnIds = new Set();
592
585
  const seenGroupIds = new Set();
@@ -638,14 +631,36 @@ function normalizeFooterDocument(
638
631
  }
639
632
 
640
633
  const normalizedFeatureImage = featureImage(value.featureImage, knownImageIds, tolerateStoredValues);
641
- const brandSize = choice(value.brandSize === "" ? undefined : value.brandSize, "standard", ["standard", "large"], "footerSettings.brandSize");
634
+ const brandSize = choice(
635
+ value.brandSize === "" ? undefined : value.brandSize,
636
+ "standard",
637
+ ["standard", "large"],
638
+ "footerSettings.brandSize",
639
+ );
642
640
  const logoScale = tolerateStoredValues
643
641
  ? resolveFooterLogoScale(value.logoScale, brandSize)
644
642
  : parseFooterLogoScale(value.logoScale, brandSize);
645
643
  if (logoScale === null) {
646
- fail("footer.field_invalid", "footerSettings.logoScale must be a string from 1.0 through 5.0 in 0.1 steps.", "footerSettings.logoScale");
644
+ fail(
645
+ "footer.field_invalid",
646
+ "footerSettings.logoScale must be a string from 1.0 through 5.0 in 0.1 steps.",
647
+ "footerSettings.logoScale",
648
+ );
649
+ }
650
+ const context = value.context === undefined ? "" : value.context;
651
+ if (typeof context !== "string") {
652
+ fail(
653
+ "settings.context_unknown",
654
+ "footerSettings.context must name a shared theme context or be empty.",
655
+ "footerSettings.context",
656
+ );
647
657
  }
658
+ const logoVariant = tolerateStoredValues
659
+ ? resolveLogoVariant(value.logoVariant)
660
+ : choice(value.logoVariant, "", LOGO_VARIANTS, "footerSettings.logoVariant");
648
661
  return {
662
+ ...(context === "" ? {} : { context }),
663
+ ...(logoVariant === "" ? {} : { logoVariant }),
649
664
  enabled: boolean(value.enabled, false, "footerSettings.enabled"),
650
665
  showBrand: boolean(value.showBrand, true, "footerSettings.showBrand"),
651
666
  brandSpan: span(value.brandSpan, FOOTER_LIMITS.brandSpanMax, "footerSettings.brandSpan"),
@@ -653,7 +668,10 @@ function normalizeFooterDocument(
653
668
  logoScale: logoScale.canonical,
654
669
  logoBox: tolerateStoredValues
655
670
  ? normalizeFooterLogoBox(value.logoBox)
656
- : choice(value.logoBox === "" || value.logoBox === null ? undefined : value.logoBox, "fixed", ["fixed", "natural"], "footerSettings.logoBox"),
671
+ : choice(value.logoBox === "" || value.logoBox === null ? undefined : value.logoBox, "fixed", [
672
+ "fixed",
673
+ "natural",
674
+ ], "footerSettings.logoBox"),
657
675
  ...authoredAlignment(value, "alignment", "footerSettings", tolerateStoredValues),
658
676
  ...authoredAlignment(value, "brandAlignment", "footerSettings", tolerateStoredValues),
659
677
  ...authoredAlignment(value, "asideAlignment", "footerSettings", tolerateStoredValues),
@@ -708,7 +726,9 @@ function normalizeFooterDocument(
708
726
  ...(normalizedFeatureImage === undefined ? {} : { featureImage: normalizedFeatureImage }),
709
727
  showBrandText: boolean(value.showBrandText, true, "footerSettings.showBrandText"),
710
728
  socialLinks: array(value.socialLinks, "footerSettings.socialLinks", FOOTER_LIMITS.socialLinks)
711
- .map((link, index) => socialLink(link, `footerSettings.socialLinks[${index}]`, seenLinkIds, tolerateStoredValues)),
729
+ .map((link, index) =>
730
+ socialLink(link, `footerSettings.socialLinks[${index}]`, seenLinkIds, tolerateStoredValues)
731
+ ),
712
732
  };
713
733
  }
714
734
 
@@ -788,11 +808,6 @@ export const FOOTER_EXAMPLE = Object.freeze({
788
808
  }),
789
809
  ]),
790
810
  light: Object.freeze({
791
- backgroundColor: "--esp-color-layer-1",
792
- textColor: "--esp-color-text",
793
- headingColor: "--esp-color-headings",
794
- linkColor: "--esp-color-link",
795
- linkHoverColor: "--esp-color-link-hover",
796
811
  logoId: "",
797
812
  backgroundImageId: "d461035a-74b6-4528-a4f5-e5a96fb50037",
798
813
  backgroundImageOpacity: 0.18,
@@ -802,11 +817,6 @@ export const FOOTER_EXAMPLE = Object.freeze({
802
817
  additionalTopPaddingRem: 0,
803
818
  }),
804
819
  dark: Object.freeze({
805
- backgroundColor: "--esp-color-background",
806
- textColor: "--esp-color-text",
807
- headingColor: "--esp-color-headings",
808
- linkColor: "--esp-color-link",
809
- linkHoverColor: "--esp-color-link-hover",
810
820
  logoId: "",
811
821
  backgroundImageId: "",
812
822
  backgroundImageOpacity: 1,
@@ -3,12 +3,7 @@ import { createHash } from "node:crypto";
3
3
  import { SiteAuthoringError } from "./errors.js";
4
4
  import { resolveFooterLogoScale } from "./footer-branding.js";
5
5
  import { footerAlignmentProfileValues, normalizeFooterLogoBox } from "./footer-alignment.js";
6
- import { FOOTER_COLOR_TOKENS } from "./theme-validation.js";
7
-
8
- // The ten scheme colors theme push owns — light/dark times the color-token
9
- // registry — so a new footer color changes one executable registry, not a
10
- // hand-copied list. Every other footer field is footer-push content.
11
- const THEME_OWNED_SCHEME_COLORS = Object.freeze(Object.keys(FOOTER_COLOR_TOKENS));
6
+ import { projectFooterContent } from "./footer-content.js";
12
7
 
13
8
  // Matches the package's document-depth convention (CONTENT_LIMITS.documentDepth):
14
9
  // the baseline hashes raw hand-editable JSON, and unbounded nesting would
@@ -17,8 +12,8 @@ const MAXIMUM_CONTENT_DEPTH = 64;
17
12
 
18
13
  /**
19
14
  * The pull baseline over everything `footer push` owns: a stable, type- and
20
- * shape-preserving JSON hash of the raw footer document with exactly the ten
21
- * scheme colors `theme push` overlays removed. The draft hash's canonical
15
+ * shape-preserving JSON hash of the raw footer document with presentation
16
+ * fields removed. The draft hash's canonical
22
17
  * form deliberately normalizes types and shapes the way the server does, so
23
18
  * it cannot see a hand-edit such as `enabled: "true"` or `bottomLinks: {}`;
24
19
  * this baseline must, because `theme push` would otherwise silently discard
@@ -28,16 +23,8 @@ const MAXIMUM_CONTENT_DEPTH = 64;
28
23
  */
29
24
  export function computeFooterContentHash(settings = {}) {
30
25
  requireBoundedDepth(settings);
31
- let content = settings;
32
- if (isContentObject(settings)) {
33
- content = structuredClone(settings);
34
- for (const scheme of ["light", "dark"]) {
35
- if (isContentObject(content[scheme])) {
36
- for (const color of THEME_OWNED_SCHEME_COLORS) delete content[scheme][color];
37
- }
38
- }
39
- }
40
- return createHash("sha256").update(`footer-content-v2${stableJson(content)}`, "utf8").digest("hex");
26
+ const content = isContentObject(settings) ? projectFooterContent(settings) : settings;
27
+ return createHash("sha256").update(`footer-content-v3${stableJson(content)}`, "utf8").digest("hex");
41
28
  }
42
29
 
43
30
  function isContentObject(value) {
@@ -85,12 +72,11 @@ export function stableJson(value) {
85
72
  }
86
73
 
87
74
  // Byte-for-byte port of FooterDraftConcurrency.ComputeHash. The token protects
88
- // the whole footer document while theme push overlays only its ten scheme color
89
- // fields onto a fresh read. Response-only image URLs deliberately do not enter
90
- // the canonical form.
75
+ // footer content independently of theme-owned presentation fields.
76
+ // Response-only image URLs stay outside the canonical form.
91
77
  export function computeFooterDraftHash(settings = {}) {
92
78
  const canonical = [];
93
- append(canonical, "footer-draft-v7");
79
+ append(canonical, "footer-draft-v8");
94
80
  append(canonical, settings.enabled === true);
95
81
  append(canonical, settings.showBrand ?? true);
96
82
  append(canonical, settings.showBrandText ?? true);
@@ -198,11 +184,6 @@ function appendRichText(canonical, richText) {
198
184
 
199
185
  function appendScheme(canonical, rawScheme) {
200
186
  const scheme = rawScheme ?? {};
201
- append(canonical, scheme.backgroundColor ?? "");
202
- append(canonical, scheme.textColor ?? "");
203
- append(canonical, scheme.headingColor ?? "");
204
- append(canonical, scheme.linkColor ?? "");
205
- append(canonical, scheme.linkHoverColor ?? "");
206
187
  append(canonical, normalizeId(scheme.logoId));
207
188
  append(canonical, normalizeId(scheme.backgroundImageId));
208
189
  append(canonical, doubleBits(scheme.backgroundImageOpacity ?? 1));
@@ -98,10 +98,8 @@ export async function advanceFooterManifest(
98
98
  expectedContentHash: computeFooterContentHash(footerSettings),
99
99
  imageIds: [...new Set([...prior.imageIds, ...footerImageIds(footerSettings)])].sort(),
100
100
  };
101
- // The ten scheme colours are part of the presentation change set, so a
102
- // footer save that moved one moved the revision too; the server reports the
103
- // new one from the same transaction and it becomes the baseline the next
104
- // theme push must carry (TR00807). One manifest write for both baselines.
101
+ // Update both baselines in one manifest write. The caller only supplies a
102
+ // presentation revision when it is already safe for this workspace to own.
105
103
  if (presentationRevision !== undefined) {
106
104
  manifest.presentation = presentationManifestEntry(presentationRevision);
107
105
  }
@@ -203,8 +201,8 @@ export function footerManifestEntry(footerSettings) {
203
201
  * `theme push` begins with a fresh server read that replaces the workspace
204
202
  * footer document, so an unpushed footer-content edit would be silently lost.
205
203
  * Refuse while the workspace footer's content hash differs from the recorded
206
- * pull baseline. The ten scheme colors `theme push` overlays are excluded
207
- * from the comparison, so a colour-only edit passes. A manifest that predates
204
+ * pull baseline. The presentation fields `theme push` owns are excluded
205
+ * from the comparison, so a context- or logo-variant-only edit passes. A manifest that predates
208
206
  * the baseline cannot prove the workspace is clean and refuses toward pull:
209
207
  * assuming "unchanged" is exactly the data loss this guard exists to stop.
210
208
  */
@@ -1,6 +1,11 @@
1
1
  // Generated from shared/header-presentation.ts by scripts/sync-field-validation.mjs. Do not edit.
2
2
  import { DISPLAY_SCALE_LIMITS, parseDisplayScale } from "./display-scale.js";
3
3
  export const HEADER_HEIGHT_MULTIPLIER_LIMITS = DISPLAY_SCALE_LIMITS;
4
+ export const LOGO_VARIANTS = Object.freeze(["", "light", "dark"]);
5
+ /** Unknown stored values keep the existing scheme choice; writers validate the literal vocabulary. */
6
+ export function resolveLogoVariant(value) {
7
+ return value === "light" || value === "dark" ? value : "";
8
+ }
4
9
  const STANDARD_HEIGHT = Object.freeze({ tenths: 10, scale: 1, canonical: "" });
5
10
  /** Parse the authored string without floating-point remainder or whitespace normalization. */
6
11
  export function parseHeaderHeightMultiplier(value) {
@@ -34,6 +39,14 @@ export function resolveHeaderLogoPairs(input) {
34
39
  const first = (...pairs) => pairs.find(candidate => candidate.url !== "") ?? pairs[0];
35
40
  const resolvedLight = first(light, profile, dark);
36
41
  const resolvedDark = first(dark, light, profile);
42
+ const variant = resolveLogoVariant(input.logoVariant);
43
+ if (variant) {
44
+ const regular = variant === "light" ? resolvedLight : resolvedDark;
45
+ const compact = variant === "light"
46
+ ? first(compactLight, light, compactDark, regular)
47
+ : first(compactDark, dark, compactLight, regular);
48
+ return { light: regular, dark: regular, lightCompact: compact, darkCompact: compact };
49
+ }
37
50
  return {
38
51
  light: resolvedLight,
39
52
  dark: resolvedDark,
@@ -0,0 +1,38 @@
1
+ import { isCanonicalUuid } from "./errors.js";
2
+
3
+ const identity = value => isCanonicalUuid(value) ? value : "";
4
+ const record = value => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
5
+
6
+ /** Stable image identities can go through the URL resolver without copying its fallback rules. */
7
+ export function logoInputsFromSettings(styles = {}, footer = {}, media = {}) {
8
+ styles = record(styles);
9
+ footer = record(footer);
10
+ const dimensions = new Map(Object.values(record(media)).filter(value => isCanonicalUuid(value?.imageId)).map(value => [value.imageId, value]));
11
+ const ratio = id => {
12
+ const image = dimensions.get(id);
13
+ return Number.isFinite(image?.width) && image.width > 0 && Number.isFinite(image?.height) && image.height > 0
14
+ ? String(image.width / image.height) : "";
15
+ };
16
+ const input = {};
17
+ for (const name of ["light", "dark", "lightCompact", "darkCompact"]) {
18
+ const id = identity(styles[`${name}LogoId`]);
19
+ input[`${name}LogoUrl`] = id;
20
+ input[`${name}LogoAspectRatio`] = ratio(id);
21
+ }
22
+ for (const scheme of ["light", "dark"]) {
23
+ const id = identity(footer[scheme]?.logoId);
24
+ input[`${scheme}FooterLogoId`] = id;
25
+ input[`${scheme}FooterLogoUrl`] = id;
26
+ input[`${scheme}FooterLogoAspectRatio`] = ratio(id);
27
+ }
28
+ return input;
29
+ }
30
+
31
+ /** Shared artwork has no single intended brightness; classify the artifact that actually resolved. */
32
+ export function logoArtworkScheme(identity, input) {
33
+ if (!identity) return undefined;
34
+ const schemes = ["light", "dark"].filter(scheme => [
35
+ input[`${scheme}LogoUrl`], input[`${scheme}CompactLogoUrl`], input[`${scheme}FooterLogoUrl`],
36
+ ].includes(identity));
37
+ return schemes.length === 1 ? schemes[0] : undefined;
38
+ }
@@ -0,0 +1,67 @@
1
+ import { resolveFooterLogoPairs } from "./footer-branding.js";
2
+ import { canUseCompactHeaderLogo, LOGO_VARIANTS, resolveHeaderLogoPairs, resolveLogoVariant } from "./header-presentation.js";
3
+ import { logoArtworkScheme, logoInputsFromSettings } from "./logo-inputs.js";
4
+ import { boundedByBytes } from "./session.js";
5
+ import { describeSiteFinding, SITE_FINDINGS_MAX_BYTES } from "./site-check-findings.js";
6
+ import { loadThemeEngines } from "./theme-resolve.js";
7
+
8
+ export const LOGO_ON_SURFACE_RULE = "brand.logo_on_surface";
9
+ const FILES = Object.freeze({ header: "settings/site-header.json", footer: "settings/site-publishing-preferences.json" });
10
+
11
+ function result(items, skipped = false) {
12
+ const reported = boundedByBytes(items, SITE_FINDINGS_MAX_BYTES);
13
+ return {
14
+ findings: { total: items.length, errors: 0, warnings: items.length, items: reported.items, ...(reported.truncated ? { truncated: true } : {}) },
15
+ siteChecks: { ranOffline: [LOGO_ON_SURFACE_RULE], ...(skipped ? { skipped: [LOGO_ON_SURFACE_RULE] } : {}) },
16
+ };
17
+ }
18
+
19
+ /** A brightness heuristic over the selected artifacts, not pixel analysis or background-image analysis. */
20
+ export async function evaluateLogoSurfaceChecks({ styles, header = {}, footer = {}, profileLogoFallbackUrl, onProgress = () => {} } = {}, { loadEngines = loadThemeEngines } = {}) {
21
+ if (!styles?.lightTheme || !styles?.darkTheme) return result([], true);
22
+ // Ordinary workspaces have no site-kind metadata. Only an explicit caller can supply the profile fallback.
23
+ const input = { ...logoInputsFromSettings(styles, footer), profileLogoFallbackUrl };
24
+ const regular = resolveHeaderLogoPairs(input);
25
+ const compact = canUseCompactHeaderLogo(header.headerPosition, header.headerHeightMultiplier, Boolean(regular.light.url || regular.dark.url), header.headerMinHeightMultiplier);
26
+ const headerInput = compact ? input : { ...input, lightCompactLogoUrl: "", darkCompactLogoUrl: "" };
27
+ const surfaces = [
28
+ { name: "header", context: header.context ?? "", variant: resolveLogoVariant(header.logoVariant), kinds: compact ? ["regular", "compact"] : ["regular"], resolve: logoVariant => resolveHeaderLogoPairs({ ...headerInput, logoVariant }) },
29
+ ...(footer.enabled === true && footer.showBrand !== false ? [{ name: "footer", context: footer.context ?? "", variant: resolveLogoVariant(footer.logoVariant), kinds: ["regular"], resolve: logoVariant => resolveFooterLogoPairs({ ...input, logoVariant }) }] : []),
30
+ ];
31
+ const checks = [];
32
+ for (const surface of surfaces) {
33
+ const alternatives = new Map(LOGO_VARIANTS.map(variant => [variant, surface.resolve(variant)]));
34
+ for (const scheme of ["light", "dark"]) {
35
+ for (const kind of surface.kinds) {
36
+ const key = kind === "compact" ? `${scheme}Compact` : scheme;
37
+ const selected = alternatives.get(surface.variant)[key].url;
38
+ if (!selected || new Set(LOGO_VARIANTS.map(variant => alternatives.get(variant)[key].url)).size <= 1) continue;
39
+ const artwork = logoArtworkScheme(selected, input);
40
+ if (artwork !== undefined) checks.push({ surface, scheme, kind, artwork });
41
+ }
42
+ }
43
+ }
44
+ if (checks.length === 0) return result([], true);
45
+ let engines;
46
+ let suite;
47
+ try {
48
+ engines = await loadEngines();
49
+ suite = engines.fit.themeFitReportSuite(styles.lightTheme, styles.darkTheme);
50
+ } catch {
51
+ return result([], true);
52
+ }
53
+ const items = [];
54
+ let skipped = false;
55
+ for (const { surface, scheme, kind, artwork } of checks) {
56
+ const report = suite[scheme]?.find(value => value.surface === (surface.context || engines.fit.ROOT_SURFACE));
57
+ const token = report?.tokens.find(value => value.token === "layer2");
58
+ const parsed = token === undefined ? null : engines.color.parseCssColor(token.resolved);
59
+ if (parsed === null || !Number.isFinite(parsed.l)) { skipped = true; continue; }
60
+ if ((parsed.l < 0.5 ? "dark" : "light") === artwork) continue;
61
+ const detail = `${scheme}:${kind === "compact" ? "compact:" : ""}${artwork}`;
62
+ const item = { rule: LOGO_ON_SURFACE_RULE, severity: "warning", file: FILES[surface.name], subject: surface.name, detail };
63
+ items.push(item);
64
+ onProgress(`Warning: ${item.file} ${describeSiteFinding({ ruleId: item.rule, ...item })}.`);
65
+ }
66
+ return result(items, skipped);
67
+ }