{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"version-hero","type":"registry:component","title":"Version Hero","description":"A chrome 2.0 version numeral rises inside a glowing ring with Now available beneath.","dependencies":["remotion","@remotion/google-fonts"],"docs":"Needs a Remotion project. If a frame renders black, the component is drawing on a transparent layer: put a background behind it, e.g. <AbsoluteFill style={{ background: \"#faf9f6\" }}><Component /></AbsoluteFill>.","files":[{"path":"components/kuchi/version-hero.tsx","type":"registry:component","target":"components/kuchi/version-hero.tsx","content":"/*! Portions Copyright (c) 2026 Remocn. MIT License. See THIRD_PARTY_LICENSES. */\n\"use client\";\n\nimport { loadFont } from \"@remotion/google-fonts/BricolageGrotesque\";\nimport type React from \"react\";\nimport { useId } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nconst { fontFamily: bricolage } = loadFont(\"normal\", {\n  weights: [\"400\", \"500\"],\n  subsets: [\"latin\"],\n});\n\n/**\n * gradients.sh \"radial-glow\" palette: [#f3f1ff, #9db4ff, #5a46cb, #1d1240].\n * On dark it is a disc of light rising behind the object and catching its\n * faces; on paper it tints the stage under the numeral.\n */\nconst GLOW = [\"#f3f1ff\", \"#9db4ff\", \"#5a46cb\", \"#1d1240\"] as const;\n\nexport interface VersionHeroProps {\n  /** The release number, rendered as the extruded object. */\n  version?: string;\n  /** Product name in the label under the numeral. */\n  name?: string;\n  /** Second half of the label. */\n  label?: string;\n  /** Replaces the label's name: by default the acme logo when `name` is \"acme\". */\n  logo?: React.ReactNode;\n  accent?: string;\n  /** Text color of the label's name and logo; overrides the theme. */\n  ink?: string;\n  /** Background fill; \"transparent\" drops it. */\n  background?: string;\n  /** Typeface for the numeral and label. Load it yourself; Bricolage Grotesque by default. */\n  fontFamily?: string;\n  /** Extrusion depth of the numeral, as a share of its font size. */\n  depth?: number;\n  /** Frames between slices as the stack docks. */\n  stagger?: number;\n  grain?: boolean;\n  /** Size of the numeral and label, around the frame's center. */\n  scale?: number;\n  /** Frames to hold the first frame before anything moves. */\n  delay?: number;\n  /** Playback multiplier. */\n  speed?: number;\n  /** Dark = brushed aluminium; light = matte paper stock. */\n  theme?: \"dark\" | \"light\";\n}\n\nconst SLICES = 10;\nconst SUB = 4;\n\nconst EASE_IO = Easing.bezier(0.65, 0, 0.35, 1);\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\n/** Horizontal streak noise: brushed metal grain. Low x frequency, high y. */\nconst BRUSHED = `url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='300'><filter id='b'><feTurbulence type='fractalNoise' baseFrequency='0.003 0.75' numOctaves='2' seed='4' stitchTiles='stitch'/><feColorMatrix values='1 0 0 0 0  1 0 0 0 0  1 0 0 0 0  0 0 0 0 0.2'/></filter><rect width='600' height='300' filter='url(%23b)'/></svg>\")`;\n/** Isotropic fibre noise: matte paper tooth. */\nconst PAPER = `url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' seed='9' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.35  0 0 0 0 0.33  0 0 0 0 0.3  0 0 0 0.22 0'/></filter><rect width='240' height='240' filter='url(%23p)'/></svg>\")`;\n\nconst MATERIALS = {\n  dark: {\n    bg: \"#050508\",\n    stageLight: \"rgba(255,255,255,0.05)\",\n    /** Strength of the rising disc, and of its tint on the faces. */\n    glow: 1,\n    glowTint: 0.32,\n    /** How much the inside of the disc fills with violet. */\n    disc: 1,\n    /** The rim of the disc, inside → out. */\n    ring: [GLOW[0], GLOW[1], GLOW[2]],\n    fg: \"#F3F2EF\",\n    muted: \"#8B8A90\",\n    hair: \"rgba(255,255,255,0.18)\",\n    faceBase:\n      \"linear-gradient(180deg, #C4C7CD 0%, #A9ADB4 30%, #8D9199 52%, #9FA3AA 74%, #6E727A 100%)\",\n    faceTexture: BRUSHED,\n    faceTextureSize: \"600px 300px\",\n    plate: \"#7D8088\",\n    side: [\n      [0x5c, 0x5e, 0x65],\n      [0x26, 0x27, 0x2b],\n    ],\n    sideFloor: [0x0d, 0x0d, 0x0f],\n    spec: 0.9,\n    specSide: 0.35,\n    bevel: \"rgba(255,255,255,0.75)\",\n    shadow: \"rgba(0,0,0,0.85)\",\n    grain: 0.07,\n  },\n  light: {\n    bg: \"#F5F4F0\",\n    stageLight: \"rgba(255,255,255,0.9)\",\n    glow: 0.8,\n    glowTint: 0.16,\n    disc: 0,\n    ring: [GLOW[1], GLOW[2], GLOW[1]],\n    fg: \"#121214\",\n    muted: \"#6E6C67\",\n    hair: \"rgba(18,18,20,0.16)\",\n    faceBase: \"linear-gradient(180deg, #FFFFFF 0%, #F8F7F3 45%, #EDEBE5 100%)\",\n    faceTexture: PAPER,\n    faceTextureSize: \"240px 240px\",\n    plate: \"#E4E1DA\",\n    side: [\n      [0xd6, 0xd2, 0xc8],\n      [0xb3, 0xae, 0xa2],\n    ],\n    sideFloor: [0x8f, 0x8a, 0x7f],\n    spec: 0.55,\n    specSide: 0.25,\n    bevel: \"rgba(255,255,255,1)\",\n    shadow: \"rgba(60,52,40,0.32)\",\n    grain: 0.045,\n  },\n} as const;\n\ntype Material = (typeof MATERIALS)[keyof typeof MATERIALS];\n\nfunction mix(a: readonly number[], b: readonly number[], t: number) {\n  const c = a.map((v, i) => Math.round(v + (b[i] - v) * t));\n  return `rgb(${c[0]},${c[1]},${c[2]})`;\n}\n\n/** A soft diagonal band of light at horizontal position `x` (0..1). */\nfunction specBand(x: number, strength: number) {\n  const c = x * 100;\n  const a = `rgba(255,255,255,${strength})`;\n  const h = `rgba(255,255,255,${strength * 0.28})`;\n  return `linear-gradient(104deg, transparent ${c - 22}%, ${h} ${c - 9}%, ${a} ${c}%, ${h} ${c + 5}%, transparent ${c + 14}%)`;\n}\n\nfunction Grain({ opacity }: { opacity: number }) {\n  const id = `g${useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n  return (\n    <svg\n      width=\"100%\"\n      height=\"100%\"\n      style={{ position: \"absolute\", inset: 0, opacity }}\n      aria-hidden\n    >\n      <filter id={id}>\n        <feTurbulence\n          type=\"fractalNoise\"\n          baseFrequency=\"0.9\"\n          numOctaves={2}\n          seed={5}\n          stitchTiles=\"stitch\"\n        />\n        <feColorMatrix values=\"0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0.9 0\" />\n      </filter>\n      <rect width=\"100%\" height=\"100%\" filter={`url(#${id})`} />\n    </svg>\n  );\n}\n\n/** Placeholder wordmark, 100 units per em, baseline at y = 0. Pass your own logo. */\n/** Ink box of the outlined logo, in its own units; the R is `rW` wide. */\nconst LOGO = { x: 0, y: -76, w: 250, h: 77.5, rW: 0 } as const;\n\n/** The whole logo in one fill (a colour or a `url(#gradient)`). */\nfunction LogoPaths({ fill }: { fill: string }) {\n  return (\n    <text x={0} y={0} fill={fill} fontFamily=\"Manrope, Inter, sans-serif\" fontWeight={600} fontSize={100} letterSpacing={-2.5}>\n      Acme\n    </text>\n  );\n}\n\n/** The logo at a font size, sitting on the label's baseline. */\nfunction Logo({ size, color }: { size: number; color: string }) {\n  const k = size / 100;\n  return (\n    <svg\n      width={LOGO.w * k}\n      height={LOGO.h * k}\n      viewBox={`${LOGO.x} ${LOGO.y} ${LOGO.w} ${LOGO.h}`}\n      style={{ display: \"block\", overflow: \"visible\" }}\n      aria-hidden\n    >\n      <LogoPaths fill={color} />\n    </svg>\n  );\n}\n\n/** The foreground at `scale`, around the frame's center; nothing extra at 1. */\nfunction ScaleLayer({\n  scale,\n  children,\n}: {\n  scale: number;\n  children: React.ReactNode;\n}) {\n  if (scale === 1) return children;\n  return (\n    <AbsoluteFill style={{ transform: `scale(${scale})` }}>\n      {children}\n    </AbsoluteFill>\n  );\n}\n\nexport function VersionHero({\n  version = \"2.0\",\n  name = \"acme\",\n  label = \"Now available\",\n  logo,\n  accent = \"#3B5BFD\",\n  ink,\n  background: backdrop,\n  fontFamily = bricolage,\n  depth: extrude = 0.2,\n  stagger = 2.2,\n  grain = true,\n  scale = 1,\n  delay = 0,\n  speed = 1,\n  theme = \"dark\",\n}: VersionHeroProps) {\n  const t = Math.max(0, useCurrentFrame() - delay) * speed;\n  const { width, height } = useVideoConfig();\n  const u = height / 720;\n  const m: Material = MATERIALS[theme];\n  const fg = ink ?? m.fg;\n  const stage = backdrop === \"transparent\" ? \"transparent\" : (backdrop ?? m.bg);\n\n  const chars = Array.from(version).length;\n  const fontSize = Math.min(height * 0.7, (width * 0.6) / (chars * 0.5));\n  const depth = fontSize * extrude;\n  const dz = depth / (SLICES * SUB);\n  const spreadMax = fontSize * 0.42;\n  const boxW = width;\n  const boxH = fontSize * 1.2;\n  const cy = height * 0.43;\n\n  // camera: a slow eased orbit plus a gentle dolly-in\n  const orbit = interpolate(t, [0, 150], [0, 1], {\n    ...CLAMP,\n    easing: EASE_IO,\n  });\n  const rotY = -24 + orbit * 16;\n  const rotX = 10 - orbit * 4;\n  const dolly = interpolate(t, [0, 70], [-220 * u, 0], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n\n  // specular sweep across the faces once the stack has docked\n  const sweep = interpolate(t, [44, 92], [-0.3, 1.35], {\n    ...CLAMP,\n    easing: EASE_IO,\n  });\n  const restSheen = interpolate(t, [44, 92], [0, 1], CLAMP);\n  // the disc of light rises behind the object as it docks\n  const glowP = interpolate(t, [20, 96], [0, 1], {\n    ...CLAMP,\n    easing: EASE_IO,\n  });\n  const glowY = 136 - 16 * glowP;\n\n  const sliceP = (k: number) =>\n    interpolate(t, [4 + k * stagger, 4 + k * stagger + 34], [0, 1], {\n      ...CLAMP,\n      easing: EASE_OUT,\n    });\n\n  const textStyle: React.CSSProperties = {\n    position: \"absolute\",\n    left: -boxW / 2,\n    top: -boxH / 2,\n    width: boxW,\n    height: boxH,\n    display: \"flex\",\n    alignItems: \"center\",\n    justifyContent: \"center\",\n    fontFamily,\n    fontWeight: 500,\n    fontSize,\n    lineHeight: 1,\n    letterSpacing: \"-0.05em\",\n    whiteSpace: \"nowrap\",\n    color: \"transparent\",\n    WebkitBackgroundClip: \"text\",\n    backgroundClip: \"text\",\n    backfaceVisibility: \"visible\",\n  };\n\n  const layers: React.ReactNode[] = [];\n  for (let k = SLICES - 1; k >= 0; k--) {\n    const p = sliceP(k);\n    const zSlice = -k * SUB * dz - k * spreadMax * (1 - p);\n    const appear = interpolate(t, [-6 + k * 1.6, 8 + k * 1.6], [0, 1], CLAMP);\n    const blur = ((k * spreadMax * (1 - p)) / (spreadMax * SLICES)) * 7 * u;\n    const subs: React.ReactNode[] = [];\n    for (let s = SUB - 1; s >= 0; s--) {\n      const j = k * SUB + s;\n      const isFace = j === 0;\n      const depthT = j / (SLICES * SUB - 1);\n      const top = mix(m.side[0], m.sideFloor, depthT * 0.55);\n      const bottom = mix(m.side[1], m.sideFloor, depthT * 0.8);\n      const sideSpec = specBand(sweep - depthT * 0.05, m.specSide);\n      let background: string;\n      if (isFace) {\n        background = [\n          specBand(sweep, m.spec),\n          `linear-gradient(104deg, transparent 0%, rgba(255,255,255,${0.12 * restSheen}) 40%, transparent 75%)`,\n          // the disc rising behind bounces up into the lower half of the face\n          `linear-gradient(180deg, transparent 38%, color-mix(in oklab, ${GLOW[1]} ${Math.round(m.glowTint * 100 * glowP)}%, transparent) 78%, color-mix(in oklab, ${GLOW[2]} ${Math.round(m.glowTint * 100 * glowP)}%, transparent) 100%)`,\n          m.faceTexture,\n          m.faceBase,\n        ].join(\", \");\n      } else if (s === 0) {\n        // the leading face of each slice reads as a plate while spread out\n        const plate = 1 - p;\n        background = `linear-gradient(180deg, ${m.plate}${Math.round(\n          plate * 255,\n        )\n          .toString(16)\n          .padStart(2, \"0\")}, ${m.plate}${Math.round(plate * 200)\n          .toString(16)\n          .padStart(\n            2,\n            \"0\",\n          )}), ${sideSpec}, linear-gradient(180deg, ${top}, ${bottom})`;\n      } else {\n        background = `${sideSpec}, linear-gradient(180deg, ${top}, ${bottom})`;\n      }\n      if (isFace) {\n        // chamfer: a hairline of light just behind the face, nudged up-left\n        subs.push(\n          <div\n            key=\"bevel\"\n            style={{\n              ...textStyle,\n              color: m.bevel,\n              transform: `translate3d(${-0.8 * u}px, ${-1 * u}px, ${-dz * 0.5}px)`,\n            }}\n          >\n            {version}\n          </div>,\n        );\n      }\n      subs.push(\n        <div\n          key={j}\n          style={{\n            ...textStyle,\n            transform: `translateZ(${-s * dz}px)`,\n            backgroundImage: background,\n            backgroundSize: isFace\n              ? `100% 100%, 100% 100%, 100% 100%, ${m.faceTextureSize}, 100% 100%`\n              : undefined,\n          }}\n        >\n          {version}\n        </div>,\n      );\n    }\n    layers.push(\n      <div\n        key={k}\n        style={{\n          position: \"absolute\",\n          left: 0,\n          top: 0,\n          transformStyle: blur > 0.15 ? undefined : \"preserve-3d\",\n          transform: `translateZ(${zSlice}px)`,\n          opacity: appear,\n          filter: blur > 0.15 ? `blur(${blur}px)` : undefined,\n        }}\n      >\n        {subs}\n      </div>,\n    );\n  }\n\n  // label under the object\n  const labelP = (d: number) =>\n    interpolate(t, [62 + d, 86 + d], [0, 1], { ...CLAMP, easing: EASE_OUT });\n  const labelTop = cy + fontSize * 0.4 + 44 * u;\n\n  const shadowO = interpolate(t, [10, 60], [0.35, 1], CLAMP);\n\n  return (\n    <AbsoluteFill style={{ background: stage, overflow: \"hidden\" }}>\n      {/* overhead key light on the stage */}\n      <AbsoluteFill\n        style={{\n          background: `radial-gradient(ellipse 55% 60% at 50% 30%, ${m.stageLight}, transparent 72%)`,\n        }}\n      />\n      {/* radial-glow: a disc of light rising behind the numeral */}\n      <AbsoluteFill\n        style={{\n          opacity: m.glow * glowP,\n          background: [\n            `radial-gradient(82% 100% at 50% ${glowY}%, transparent 53%, color-mix(in oklab, ${m.ring[0]} 85%, transparent) 56.5%, color-mix(in oklab, ${m.ring[1]} 50%, transparent) 60%, color-mix(in oklab, ${m.ring[2]} 22%, transparent) 66%, transparent 78%)`,\n            `radial-gradient(82% 100% at 50% ${glowY}%, color-mix(in oklab, ${GLOW[2]} ${Math.round(70 * m.disc)}%, transparent) 0%, color-mix(in oklab, ${GLOW[3]} ${Math.round(60 * m.disc)}%, transparent) 40%, transparent 56%)`,\n          ].join(\", \"),\n        }}\n      />\n      <ScaleLayer scale={scale}>\n        {/* contact shadow */}\n        <div\n          style={{\n            position: \"absolute\",\n            left: width / 2 - fontSize * 0.95,\n            top: cy + fontSize * 0.3,\n            width: fontSize * 1.9,\n            height: fontSize * 0.16,\n            borderRadius: \"50%\",\n            background: `radial-gradient(closest-side, ${m.shadow}, transparent)`,\n            filter: `blur(${14 * u}px)`,\n            opacity: shadowO,\n          }}\n        />\n\n        <div\n          style={{\n            position: \"absolute\",\n            inset: 0,\n            perspective: 2000 * u,\n            perspectiveOrigin: `50% ${(cy / height) * 100}%`,\n          }}\n        >\n          <div\n            style={{\n              position: \"absolute\",\n              left: width / 2,\n              top: cy,\n              width: 0,\n              height: 0,\n              transformStyle: \"preserve-3d\",\n              transform: `translateZ(${dolly}px) rotateX(${rotX}deg) rotateY(${rotY}deg)`,\n            }}\n          >\n            {layers}\n          </div>\n        </div>\n\n        {/* label */}\n        <div\n          style={{\n            position: \"absolute\",\n            left: 0,\n            right: 0,\n            top: labelTop,\n            display: \"flex\",\n            justifyContent: \"center\",\n            alignItems: \"center\",\n            gap: 16 * u,\n            fontFamily,\n            fontSize: 22 * u,\n            lineHeight: 1,\n          }}\n        >\n          <div\n            style={{\n              display: \"flex\",\n              alignItems: \"center\",\n              gap: 9 * u,\n              opacity: labelP(0),\n              transform: `translateY(${(1 - labelP(0)) * 14 * u}px)`,\n            }}\n          >\n            {logo ??\n              (name.trim().toLowerCase() === \"acme\" ? (\n                <Logo size={30 * u} color={fg} />\n              ) : (\n                <span\n                  style={{\n                    color: fg,\n                    fontWeight: 500,\n                    letterSpacing: \"-0.03em\",\n                    fontSize: 26 * u,\n                  }}\n                >\n                  {name}\n                </span>\n              ))}\n          </div>\n          <div\n            style={{\n              width: Math.max(1, u),\n              height: 22 * u,\n              background: accent,\n              transform: `scaleY(${labelP(3)})`,\n            }}\n          />\n          <span\n            style={{\n              color: m.muted,\n              fontWeight: 400,\n              letterSpacing: \"-0.01em\",\n              opacity: labelP(6),\n              transform: `translateY(${(1 - labelP(6)) * 14 * u}px)`,\n            }}\n          >\n            {label}\n          </span>\n        </div>\n      </ScaleLayer>\n\n      {grain ? <Grain opacity={m.grain} /> : null}\n    </AbsoluteFill>\n  );\n}\n"}]}