@bygghammar/cms-platform 0.68.0 → 0.69.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bygghammar/cms-platform",
3
- "version": "0.68.0",
3
+ "version": "0.69.1",
4
4
  "description": "Shared CMS platform: blocks, block types, i18n core, UI primitives and design-token contract used by every Bygghammar/Voyara site.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -89,6 +89,9 @@ export function HeroFullBlock({ props: p }: { props: HeroFullProps }) {
89
89
  return (
90
90
  <section
91
91
  id={p.anchor || undefined}
92
+ // Lets the shared site header know a full-bleed hero sits behind it, so
93
+ // it can render light chrome until the visitor scrolls past it.
94
+ data-site-hero={dark ? "dark" : "light"}
92
95
  className={`relative isolate w-full overflow-hidden bg-ink ${HEIGHTS[p.height ?? "full"]} flex`}
93
96
  >
94
97
  {/* Background media */}
@@ -205,7 +205,25 @@ export function SiteHeader({
205
205
  return () => document.removeEventListener("pointerdown", onDown);
206
206
  }, [open]);
207
207
 
208
- const lightText = lightTextPaths.includes(pathname) && !scrolled;
208
+ // Pages that open with a full-bleed dark hero mark it with
209
+ // `data-site-hero="dark"`. Detect it per route so the un-scrolled header uses
210
+ // light chrome there, and reverts to dark chrome once the hero is scrolled past.
211
+ const [darkHero, setDarkHero] = useState(false);
212
+ useEffect(() => {
213
+ const detect = () => setDarkHero(Boolean(document.querySelector('[data-site-hero="dark"]')));
214
+ detect();
215
+ // Blocks stream in after the route commits, so keep watching the document
216
+ // until the hero (or its absence) is settled.
217
+ const observer = new MutationObserver(detect);
218
+ observer.observe(document.body, { childList: true, subtree: true });
219
+ const stop = setTimeout(() => observer.disconnect(), 3000);
220
+ return () => {
221
+ observer.disconnect();
222
+ clearTimeout(stop);
223
+ };
224
+ }, [pathname]);
225
+
226
+ const lightText = (lightTextPaths.includes(pathname) || darkHero) && !scrolled;
209
227
  const name = t(brandName);
210
228
  // A dedicated dark artwork wins on light surfaces; otherwise invert the light one.
211
229
  const onLightSurface = !lightText;