{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navbar-theme-reveal",
  "type": "registry:component",
  "title": "Navbar Theme Reveal",
  "description": "A navbar with a sun and moon switch that repaints the page with a circular wipe starting from the toggle itself. The icon morphs between moon and sun, and the new theme is committed when the wipe lands.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "navigation",
    "navbar",
    "dark mode",
    "theme toggle",
    "clip-path",
    "light",
    "header"
  ],
  "docs": "https://hyperblur.dev/effects/navbar-theme-reveal",
  "files": [
    {
      "path": "registry/hyperblur/navbar-theme-reveal.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/navbar-theme-reveal.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport type NavbarThemeRevealTheme = \"dark\" | \"light\";\n\nexport interface NavbarThemeRevealProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\"> {\n  brand?: string;\n  links?: { label: string; href: string }[];\n  cta?: { label: string; href: string } | null;\n  theme?: NavbarThemeRevealTheme;\n  defaultTheme?: NavbarThemeRevealTheme;\n  onThemeChange?: (theme: NavbarThemeRevealTheme) => void;\n  duration?: number;\n  accent?: string;\n  showBackdrop?: boolean;\n}\n\nconst defaultLinks = [\n  { label: \"Features\", href: \"#features\" },\n  { label: \"Templates\", href: \"#templates\" },\n  { label: \"Integrations\", href: \"#integrations\" },\n  { label: \"Pricing\", href: \"#pricing\" },\n];\n\nconst ease = \"cubic-bezier(.22,1,.36,1)\";\n\nconst css = `\n.hb-xj7 {\n  --hb-xj7-accent: #ff5c35;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-xj7 *, .hb-xj7 *::before, .hb-xj7 *::after { box-sizing: border-box; }\n.hb-xj7[data-backdrop=\"true\"] { min-height: 620px; overflow: hidden; }\n.hb-xj7-layer {\n  --hb-xj7-bg: #0a0a0a;\n  --hb-xj7-bar: rgba(17,17,17,.82);\n  --hb-xj7-line: #232323;\n  --hb-xj7-fg: #ededed;\n  --hb-xj7-mute: #8f8f8f;\n  --hb-xj7-chip: #1a1a1a;\n  --hb-xj7-inv: #ededed;\n  --hb-xj7-invfg: #0a0a0a;\n  position: relative;\n  color: var(--hb-xj7-fg);\n}\n.hb-xj7-layer[data-theme=\"light\"] {\n  --hb-xj7-bg: #f6f5f1;\n  --hb-xj7-bar: rgba(255,255,255,.85);\n  --hb-xj7-line: #e4e2dc;\n  --hb-xj7-fg: #16161a;\n  --hb-xj7-mute: #6b6a66;\n  --hb-xj7-chip: #ecebe6;\n  --hb-xj7-inv: #16161a;\n  --hb-xj7-invfg: #ffffff;\n}\n.hb-xj7[data-backdrop=\"true\"] .hb-xj7-layer { min-height: 620px; background: var(--hb-xj7-bg); }\n.hb-xj7-over { position: absolute; inset: 0; z-index: 8; pointer-events: none; clip-path: circle(0px at var(--hb-xj7-cx) var(--hb-xj7-cy)); animation: hb-xj7-wipe var(--hb-xj7-d) ${ease} forwards; }\n@keyframes hb-xj7-wipe { to { clip-path: circle(var(--hb-xj7-r) at var(--hb-xj7-cx) var(--hb-xj7-cy)); } }\n.hb-xj7-over .hb-xj7-layer { height: 100%; }\n.hb-xj7[data-backdrop=\"false\"] .hb-xj7-over { bottom: auto; }\n.hb-xj7-bar {\n  position: relative;\n  z-index: 3;\n  display: flex;\n  align-items: center;\n  gap: 18px;\n  height: 64px;\n  padding: 0 22px;\n  border-bottom: 1px solid var(--hb-xj7-line);\n  background: var(--hb-xj7-bar);\n  backdrop-filter: blur(14px) saturate(160%);\n}\n.hb-xj7-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--hb-xj7-fg); font-size: 16px; font-weight: 650; letter-spacing: -.025em; text-decoration: none; }\n.hb-xj7-logo { position: relative; width: 26px; height: 26px; border-radius: 50%; background: var(--hb-xj7-fg); overflow: hidden; }\n.hb-xj7-logo::after { content: \"\"; position: absolute; inset: 0 0 0 50%; background: var(--hb-xj7-accent); }\n.hb-xj7-links { display: flex; gap: 2px; margin: 0 auto; padding: 0; list-style: none; }\n.hb-xj7-link { display: inline-flex; align-items: center; height: 36px; padding: 0 13px; border-radius: 999px; color: var(--hb-xj7-mute); font-size: 14px; font-weight: 500; text-decoration: none; transition: color .2s ease, background-color .2s ease; }\n.hb-xj7-link:hover { color: var(--hb-xj7-fg); background: var(--hb-xj7-chip); }\n.hb-xj7-right { display: flex; align-items: center; gap: 10px; }\n.hb-xj7-toggle {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  width: 64px;\n  height: 34px;\n  padding: 3px;\n  border: 1px solid var(--hb-xj7-line);\n  border-radius: 999px;\n  background: var(--hb-xj7-chip);\n  cursor: pointer;\n  transition: border-color .2s ease;\n}\n.hb-xj7-toggle:hover { border-color: color-mix(in srgb, var(--hb-xj7-fg) 25%, transparent); }\n.hb-xj7-knob {\n  position: relative;\n  display: grid;\n  place-items: center;\n  width: 26px;\n  height: 26px;\n  border-radius: 50%;\n  background: var(--hb-xj7-inv);\n  color: var(--hb-xj7-invfg);\n  box-shadow: 0 2px 6px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.2);\n  transform: translateX(0);\n  transition: transform .5s cubic-bezier(.34,1.4,.5,1);\n}\n.hb-xj7-layer[data-theme=\"light\"] .hb-xj7-knob { transform: translateX(30px); }\n.hb-xj7-knob svg { width: 16px; height: 16px; overflow: visible; }\n.hb-xj7-bite { transition: transform .5s ${ease}; }\n.hb-xj7-rays { transform-origin: 8px 8px; transition: transform .6s ${ease}, opacity .3s ease; }\n.hb-xj7-layer[data-theme=\"dark\"] .hb-xj7-rays { transform: rotate(-60deg) scale(.4); opacity: 0; }\n.hb-xj7-layer[data-theme=\"light\"] .hb-xj7-bite { transform: translate(8px, -8px); }\n.hb-xj7-cta {\n  display: inline-flex;\n  align-items: center;\n  height: 36px;\n  padding: 0 16px;\n  border-radius: 999px;\n  background: var(--hb-xj7-inv);\n  color: var(--hb-xj7-invfg);\n  font-size: 14px;\n  font-weight: 600;\n  text-decoration: none;\n  white-space: nowrap;\n  transition: transform .2s ${ease};\n}\n.hb-xj7-cta:hover { transform: translateY(-1px); }\n.hb-xj7-burger { display: none; }\n.hb-xj7-sheet { display: none; }\n.hb-xj7 a:focus-visible, .hb-xj7 button:focus-visible { outline: 2px solid var(--hb-xj7-accent); outline-offset: 2px; }\n@container (max-width: 720px) {\n  .hb-xj7-bar { padding: 0 14px; gap: 10px; }\n  .hb-xj7-links, .hb-xj7-right .hb-xj7-cta { display: none; }\n  .hb-xj7-right { margin-left: auto; }\n  .hb-xj7-burger {\n    display: grid;\n    place-items: center;\n    width: 38px;\n    height: 38px;\n    border: 1px solid var(--hb-xj7-line);\n    border-radius: 999px;\n    background: var(--hb-xj7-chip);\n    color: var(--hb-xj7-fg);\n    cursor: pointer;\n  }\n  .hb-xj7-burger svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }\n  .hb-xj7-sheet {\n    position: absolute;\n    top: 64px;\n    left: 10px;\n    right: 10px;\n    z-index: 4;\n    display: block;\n    padding: 8px;\n    border: 1px solid var(--hb-xj7-line);\n    border-radius: 18px;\n    background: var(--hb-xj7-bg);\n    box-shadow: 0 30px 60px -20px rgba(0,0,0,.5);\n    transform-origin: 100% 0;\n    animation: hb-xj7-sheet .35s ${ease};\n  }\n  .hb-xj7-sheet[hidden] { display: none; }\n  .hb-xj7-sheet a { display: flex; align-items: center; height: 48px; padding: 0 12px; border-radius: 12px; color: var(--hb-xj7-fg); font-size: 16px; text-decoration: none; }\n  .hb-xj7-sheet a:hover { background: var(--hb-xj7-chip); }\n  .hb-xj7-sheet .hb-xj7-cta { justify-content: center; margin-top: 6px; height: 46px; color: var(--hb-xj7-invfg); }\n}\n@keyframes hb-xj7-sheet { from { opacity: 0; transform: translateY(-6px) scale(.97); } }\n.hb-xj7-page { position: relative; z-index: 1; max-width: 980px; margin: 0 auto; padding: 72px 22px 40px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }\n.hb-xj7-page h2 { margin: 0; font-family: var(--font-grotesk, inherit); font-size: clamp(34px, 5.6cqi, 58px); font-weight: 600; line-height: 1.02; letter-spacing: -.045em; }\n.hb-xj7-page h2 span { color: var(--hb-xj7-accent); }\n.hb-xj7-page p { margin: 16px 0 0; color: var(--hb-xj7-mute); font-size: 16px; line-height: 1.55; }\n.hb-xj7-win { border: 1px solid var(--hb-xj7-line); border-radius: 16px; background: var(--hb-xj7-chip); padding: 14px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.4); }\n.hb-xj7-dots { display: flex; gap: 6px; margin-bottom: 12px; }\n.hb-xj7-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--hb-xj7-line); font-style: normal; }\n.hb-xj7-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }\n.hb-xj7-card { height: 64px; border-radius: 10px; background: var(--hb-xj7-bg); border: 1px solid var(--hb-xj7-line); padding: 8px; }\n.hb-xj7-card i { display: block; height: 6px; width: 70%; border-radius: 3px; background: var(--hb-xj7-line); font-style: normal; }\n.hb-xj7-card i + i { width: 45%; margin-top: 6px; }\n.hb-xj7-card:nth-child(2) i:first-child, .hb-xj7-card:nth-child(4) i:first-child { background: var(--hb-xj7-accent); }\n@container (max-width: 720px) { .hb-xj7-page { grid-template-columns: 1fr; padding: 40px 16px; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xj7 *, .hb-xj7 *::before, .hb-xj7 *::after { transition: none !important; animation: none !important; }\n}\n`;\n\nfunction ThemeGlyph({ id }: { id: string }) {\n  return (\n    <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n      <mask id={id}>\n        <rect x=\"-4\" y=\"-4\" width=\"24\" height=\"24\" fill=\"#fff\" />\n        <circle className=\"hb-xj7-bite\" cx=\"11\" cy=\"5\" r=\"5\" fill=\"#000\" />\n      </mask>\n      <circle cx=\"8\" cy=\"8\" r=\"5.5\" fill=\"currentColor\" mask={`url(#${id})`} />\n      <g className=\"hb-xj7-rays\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\">\n        <path d=\"M8 0.5v1.2M8 14.3v1.2M0.5 8h1.2M14.3 8h1.2M2.7 2.7l.85.85M12.45 12.45l.85.85M2.7 13.3l.85-.85M12.45 3.55l.85-.85\" />\n      </g>\n    </svg>\n  );\n}\n\nexport function NavbarThemeReveal({\n  brand = \"Paperline\",\n  links = defaultLinks,\n  cta = { label: \"Try it free\", href: \"#signup\" },\n  theme,\n  defaultTheme = \"dark\",\n  onThemeChange,\n  duration = 700,\n  accent = \"#ff5c35\",\n  showBackdrop = true,\n  className,\n  style,\n  ...rest\n}: NavbarThemeRevealProps) {\n  const [inner, setInner] = React.useState<NavbarThemeRevealTheme>(defaultTheme);\n  const [wipe, setWipe] = React.useState<{ to: NavbarThemeRevealTheme; x: number; y: number; r: number } | null>(null);\n  const [menuOpen, setMenuOpen] = React.useState(false);\n  const rootRef = React.useRef<HTMLElement>(null);\n  const burgerRef = React.useRef<HTMLButtonElement>(null);\n  const sheetId = React.useId();\n  const maskId = `hb-xj7-m${React.useId().replace(/[^a-zA-Z0-9]/g, \"\")}`;\n  const current = theme ?? inner;\n\n  React.useEffect(() => {\n    if (!menuOpen) return;\n    const onKey = (e: KeyboardEvent) => {\n      if (e.key === \"Escape\") {\n        setMenuOpen(false);\n        burgerRef.current?.focus();\n      }\n    };\n    document.addEventListener(\"keydown\", onKey);\n    return () => document.removeEventListener(\"keydown\", onKey);\n  }, [menuOpen]);\n\n  const commit = (to: NavbarThemeRevealTheme) => {\n    if (theme === undefined) setInner(to);\n    onThemeChange?.(to);\n  };\n\n  const toggle = (e: React.MouseEvent<HTMLButtonElement>) => {\n    if (wipe) return;\n    const to: NavbarThemeRevealTheme = current === \"dark\" ? \"light\" : \"dark\";\n    const root = rootRef.current;\n    const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    if (!root || reduce || duration <= 0) {\n      commit(to);\n      return;\n    }\n    const box = root.getBoundingClientRect();\n    const btn = e.currentTarget.getBoundingClientRect();\n    const x = btn.left + btn.width / 2 - box.left;\n    const y = btn.top + btn.height / 2 - box.top;\n    const h = root.offsetHeight;\n    const r = Math.hypot(Math.max(x, box.width - x), Math.max(y, h - y)) + 8;\n    setWipe({ to, x, y, r });\n  };\n\n  const renderLayer = (t: NavbarThemeRevealTheme, live: boolean) => (\n    <div className=\"hb-xj7-layer\" data-theme={t}>\n      <nav className=\"hb-xj7-bar\" aria-label={live ? \"Main\" : undefined}>\n        <a className=\"hb-xj7-brand\" href=\"#top\" tabIndex={live ? undefined : -1}>\n          <span className=\"hb-xj7-logo\" aria-hidden=\"true\" />\n          {brand}\n        </a>\n        <ul className=\"hb-xj7-links\">\n          {links.map((l) => (\n            <li key={l.href}>\n              <a className=\"hb-xj7-link\" href={l.href} tabIndex={live ? undefined : -1}>\n                {l.label}\n              </a>\n            </li>\n          ))}\n        </ul>\n        <div className=\"hb-xj7-right\">\n          <button\n            type=\"button\"\n            className=\"hb-xj7-toggle\"\n            role=\"switch\"\n            aria-checked={t === \"light\"}\n            aria-label=\"Light theme\"\n            tabIndex={live ? undefined : -1}\n            onClick={live ? toggle : undefined}\n          >\n            <span className=\"hb-xj7-knob\">\n              <ThemeGlyph id={`${maskId}${live ? \"a\" : \"b\"}`} />\n            </span>\n          </button>\n          {cta && (\n            <a className=\"hb-xj7-cta\" href={cta.href} tabIndex={live ? undefined : -1}>\n              {cta.label}\n            </a>\n          )}\n          <button\n            ref={live ? burgerRef : undefined}\n            type=\"button\"\n            className=\"hb-xj7-burger\"\n            aria-label={menuOpen ? \"Close menu\" : \"Open menu\"}\n            aria-expanded={menuOpen}\n            aria-controls={live ? sheetId : undefined}\n            tabIndex={live ? undefined : -1}\n            onClick={live ? () => setMenuOpen(!menuOpen) : undefined}\n          >\n            <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n              {menuOpen ? <path d=\"m6 6 12 12M18 6 6 18\" /> : <path d=\"M5 9h14M5 15h14\" />}\n            </svg>\n          </button>\n        </div>\n      </nav>\n      <div className=\"hb-xj7-sheet\" id={live ? sheetId : undefined} hidden={!menuOpen}>\n        {links.map((l) => (\n          <a key={l.href} href={l.href} tabIndex={live ? undefined : -1} onClick={live ? () => setMenuOpen(false) : undefined}>\n            {l.label}\n          </a>\n        ))}\n        {cta && (\n          <a className=\"hb-xj7-cta\" href={cta.href} tabIndex={live ? undefined : -1}>\n            {cta.label}\n          </a>\n        )}\n      </div>\n      {showBackdrop && (\n        <div className=\"hb-xj7-page\" aria-hidden=\"true\">\n          <div>\n            <h2>\n              Docs that look sharp at <span>3am</span> and at noon.\n            </h2>\n            <p>Paperline turns your notes into a published handbook with search, versions and a reading mode for every room.</p>\n          </div>\n          <div className=\"hb-xj7-win\">\n            <div className=\"hb-xj7-dots\">\n              <i />\n              <i />\n              <i />\n            </div>\n            <div className=\"hb-xj7-col\">\n              <div className=\"hb-xj7-card\">\n                <i />\n                <i />\n              </div>\n              <div className=\"hb-xj7-card\">\n                <i />\n                <i />\n              </div>\n              <div className=\"hb-xj7-card\">\n                <i />\n                <i />\n              </div>\n              <div className=\"hb-xj7-card\">\n                <i />\n                <i />\n              </div>\n              <div className=\"hb-xj7-card\">\n                <i />\n                <i />\n              </div>\n              <div className=\"hb-xj7-card\">\n                <i />\n                <i />\n              </div>\n            </div>\n          </div>\n        </div>\n      )}\n    </div>\n  );\n\n  return (\n    <header\n      ref={rootRef}\n      className={[\"hb-xj7\", className].filter(Boolean).join(\" \")}\n      data-backdrop={showBackdrop ? \"true\" : \"false\"}\n      style={{ \"--hb-xj7-accent\": accent, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-navbar-theme-reveal\" precedence=\"default\">\n        {css}\n      </style>\n      {renderLayer(current, true)}\n      {wipe && (\n        <div\n          className=\"hb-xj7-over\"\n          aria-hidden=\"true\"\n          inert\n          style={\n            {\n              \"--hb-xj7-cx\": `${wipe.x.toFixed(1)}px`,\n              \"--hb-xj7-cy\": `${wipe.y.toFixed(1)}px`,\n              \"--hb-xj7-r\": `${wipe.r.toFixed(1)}px`,\n              \"--hb-xj7-d\": `${duration}ms`,\n            } as React.CSSProperties\n          }\n          onAnimationEnd={(e) => {\n            if (e.target !== e.currentTarget) return;\n            commit(wipe.to);\n            setWipe(null);\n          }}\n        >\n          {renderLayer(wipe.to, false)}\n        </div>\n      )}\n    </header>\n  );\n}\n"
    }
  ]
}