import { raw } from "hono/html"; export type ShellChild = | import("hono/utils/html").HtmlEscapedString | Promise; // Applies stored appearance, theme and motion settings before first paint. // Ink is the default theme; only a stored "prism" choice removes it. const themeInitScript = `(function(){try{var d=document.documentElement,t=localStorage.getItem("theme");if(t==="dark"||t==="light")d.setAttribute("data-theme",t);if(localStorage.getItem("style")==="prism")d.removeAttribute("data-style");if(localStorage.getItem("marks")==="black")d.setAttribute("data-marks","black");if(localStorage.getItem("motion")==="reduce")d.setAttribute("data-motion","reduce");var f=localStorage.getItem("font");if(f==="serif"||f==="mono")d.setAttribute("data-font",f);else if(f&&f!=="sans"&&/^[A-Za-z0-9 ]{1,60}$/.test(f)){var w=localStorage.getItem("font-weights")||"400";if(!/^[0-9;]{3,40}$/.test(w))w="400";var b=localStorage.getItem("font-fallback");if(["sans-serif","serif","monospace","system-ui"].indexOf(b)<0)b="sans-serif";var l=document.createElement("link");l.rel="stylesheet";l.id="site-font-link";l.href="https://fonts.bunny.net/css2?family="+f.split(" ").join("+")+":wght@"+w+"&display=swap";document.head.appendChild(l);d.setAttribute("data-font","custom");d.style.setProperty("--site-font-body",'"'+f+'", '+b)}}catch(e){}})()`; // Cross-page view transitions are reserved for moving into or out of the // homepage; between inner pages the transition is skipped so navigation stays // instant. Runs inline in the head so the listener exists before first render. const homeTransitionScript = `addEventListener("pagereveal",function(e){if(!e.viewTransition)return;try{var a=window.navigation&&navigation.activation,f=a&&a.from&&a.from.url;if(location.pathname!=="/"&&!(f&&new URL(f).pathname==="/"))e.viewTransition.skipTransition()}catch(_){e.viewTransition.skipTransition()}})`; const aroundFontUrl = "/public/fonts/around-regular.woff2?v=20260712-12"; export function Shell({ children, title, description, wide = false, noIndex = false, preloadAround = true, stylesheets = [], recordLinks = {}, social, appViewport = false, }: { children: ShellChild; title?: string; description?: string; wide?: boolean; noIndex?: boolean; preloadAround?: boolean; stylesheets?: string[]; recordLinks?: { publication?: string; document?: string }; /** Open Graph / Twitter card metadata for link previews. */ social?: { url?: string; image?: string; largeImage?: boolean; type?: "website" | "article" }; /** An app-like page (/chat): draw under the phone's bars and resize for the keyboard. */ appViewport?: boolean; }) { const pageTitle = title ? `${title} — Cameron's website` : "Cameron's website"; return ( {description && } {noIndex && } {recordLinks.publication && } {recordLinks.document && } {pageTitle} {social && ( <> {description && } {social.url && } {social.image && } )} {preloadAround && } {stylesheets.map((href) => )} {raw(``)} {raw(``)} {raw(``)}
{children}
{raw(`
Appearance
`)} ); }