{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"spec-sheet","type":"registry:component","title":"Spec Sheet","description":"A tech spec table with hairline rows reveals values like 4K, 60 fps and 1 command.","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/spec-sheet.tsx","type":"registry:component","target":"components/kuchi/spec-sheet.tsx","content":"/*! Portions Copyright (c) 2026 Remocn. MIT License. See THIRD_PARTY_LICENSES. */\n\"use client\";\n\nimport { loadFont as loadSans } from \"@remotion/google-fonts/InstrumentSans\";\nimport { loadFont as loadSerif } from \"@remotion/google-fonts/InstrumentSerif\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport type React from \"react\";\nimport { useId } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  interpolateColors,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nconst { fontFamily: sans } = loadSans(\"normal\", {\n  weights: [\"400\", \"500\"],\n  subsets: [\"latin\"],\n});\nconst { fontFamily: serif } = loadSerif(\"normal\", {\n  weights: [\"400\"],\n  subsets: [\"latin\"],\n});\nconst manrope = loadManrope(\"normal\", {\n  weights: [\"500\", \"600\"],\n  subsets: [\"latin\"],\n});\n\nexport interface SpecRow {\n  label: string;\n  value: string;\n}\n\nexport interface SpecSheetProps {\n  rows?: SpecRow[];\n  highlight?: number;\n  title?: string;\n  name?: string;\n  logo?: React.ReactNode;\n  accent?: string;\n  /** Text color of the title, values and logo; overrides the theme. */\n  ink?: string;\n  background?: string;\n  /** Typeface for the labels and values. Load it yourself; Instrument Sans by default. */\n  fontFamily?: string;\n  /** Frames between rows as the table builds. */\n  stagger?: number;\n  /** Frame the highlighted row starts to expand. */\n  expandAt?: number;\n  /** Size of the sheet, around the frame's center. */\n  scale?: number;\n  /** Frames to hold the first frame before anything moves. */\n  delay?: number;\n  grain?: boolean;\n  theme?: \"dark\" | \"light\";\n  speed?: number;\n}\n\nconst DEFAULT_ROWS: SpecRow[] = [\n  { label: \"Resolution\", value: \"4K\" },\n  { label: \"Frame rate\", value: \"60 fps\" },\n  { label: \"Components\", value: \"236\" },\n  { label: \"Install\", value: \"1 command\" },\n  { label: \"License\", value: \"MIT\" },\n];\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\nconst THEMES = {\n  dark: {\n    bg: \"#0A0A0B\",\n    key: \"rgba(255,255,255,0.05)\",\n    fg: \"#F3F2EF\",\n    muted: \"#8B8A90\",\n    hair: \"rgba(255,255,255,0.14)\",\n    rule: \"rgba(243,242,239,0.9)\",\n    grain: 0.07,\n  },\n  light: {\n    bg: \"#F5F4F0\",\n    key: \"rgba(255,255,255,0.9)\",\n    fg: \"#121214\",\n    muted: \"#6E6C67\",\n    hair: \"rgba(18,18,20,0.14)\",\n    rule: \"rgba(18,18,20,0.9)\",\n    grain: 0.045,\n  },\n} as const;\n\nconst STAGGER = 5;\nconst EXPAND = 62;\nconst FIGURE_SPACE = \" \";\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, pointerEvents: \"none\" }}\n      aria-hidden\n    >\n      <filter id={id}>\n        <feTurbulence\n          type=\"fractalNoise\"\n          baseFrequency=\"0.9\"\n          numOctaves={2}\n          seed={13}\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\n/** acme.dev logo: R mark (0.76em, on the baseline) + \"Acme\" in Manrope 600. */\nfunction KuchiLogo({ fontSize, color }: { fontSize: number; color: string }) {\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        alignItems: \"baseline\",\n        color,\n        fontFamily: manrope.fontFamily,\n        fontWeight: 600,\n        fontSize,\n        letterSpacing: \"-0.025em\",\n        lineHeight: 1,\n      }}\n    >\n      <span>Acme</span>\n    </div>\n  );\n}\n\n// gradients.sh \"halo\" palette (its blue stop is the accent): the highlighted\n// value fills with it as it grows.\nconst HALO = [\"#fff4ec\", \"#ffb36b\", \"#e2457a\", \"#3d4dff\"] as const;\n\nfunction haloFill(\n  theme: \"dark\" | \"light\",\n  t: number,\n  veil: string,\n  blue: string,\n) {\n  const a = 100 + 6 * Math.sin(t / 60);\n  const hi = 18 + 10 * Math.sin(t / 50);\n  const stops =\n    theme === \"dark\"\n      ? `${HALO[1]} 0%, ${HALO[2]} 48%, ${blue} 100%`\n      : `${HALO[2]} 0%, #b8357f 45%, ${blue} 100%`;\n  const glint =\n    theme === \"dark\"\n      ? `radial-gradient(40% 90% at ${hi}% 20%, color-mix(in oklab, ${HALO[0]} 85%, transparent) 0%, transparent 70%), `\n      : \"\";\n  return `linear-gradient(${veil}, ${veil}), ${glint}linear-gradient(${a}deg, ${stops})`;\n}\n\nfunction rgba(hex: string, a: number) {\n  const v = Number.parseInt(hex.replace(\"#\", \"\").slice(0, 6), 16);\n  return `rgba(${(v >> 16) & 255},${(v >> 8) & 255},${v & 255},${a})`;\n}\n\nfunction Value({ value, p }: { value: string; p: number }) {\n  const m = /^(\\d[\\d,.]*)(.*)$/.exec(value);\n  const num = m ? m[1] : \"\";\n  const rest = m ? m[2] : value;\n  const countP = m ? Math.min(1, p / 0.7) : 0;\n  let shown = \"\";\n  if (num) {\n    const target = Number(num.replace(/,/g, \"\"));\n    const decimals = num.includes(\".\") ? num.split(\".\")[1].length : 0;\n    const cur = EASE_OUT(countP) * target;\n    const formatted = cur.toLocaleString(\"en-US\", {\n      minimumFractionDigits: decimals,\n      maximumFractionDigits: decimals,\n      useGrouping: num.includes(\",\"),\n    });\n    shown = formatted.padStart(num.length, FIGURE_SPACE);\n    if (countP === 0) shown = FIGURE_SPACE.repeat(num.length);\n  }\n  const typeStart = num ? 0.45 : 0;\n  const chars = Array.from(rest);\n  const per = (1 - typeStart) / (chars.length + 0.6);\n  return (\n    <>\n      {shown}\n      {chars.map((ch, i) => {\n        const a = interpolate(\n          p,\n          [typeStart + i * per, typeStart + (i + 1.6) * per],\n          [0, 1],\n          CLAMP,\n        );\n        return (\n          <span key={`${i}-${ch}`} style={{ opacity: a }}>\n            {ch}\n          </span>\n        );\n      })}\n    </>\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 SpecSheet({\n  rows = DEFAULT_ROWS,\n  highlight = 3,\n  title = \"Tech specs\",\n  name = \"3.0\",\n  logo,\n  accent = \"#3B5BFD\",\n  ink,\n  background,\n  fontFamily = sans,\n  stagger = STAGGER,\n  expandAt = EXPAND,\n  scale = 1,\n  delay = 0,\n  grain = true,\n  theme = \"dark\",\n  speed = 1,\n}: SpecSheetProps) {\n  const t = Math.max(0, useCurrentFrame() - delay) * speed;\n  const { width: W, height: H } = useVideoConfig();\n  const u = H / 720;\n  const c = THEMES[theme];\n  const fg = ink ?? c.fg;\n  const n = Math.max(1, rows.length);\n  const hl = Math.min(Math.max(0, Math.round(highlight)), n - 1);\n\n  const mX = W * 0.075;\n  const cw = W - mX * 2;\n  const col = cw / 12;\n  const tableX = mX + col * 4;\n  const tableW = W - mX - tableX;\n  const hair = Math.max(1, u);\n\n  const baseH = Math.min(82 * u, (H * 0.6) / n);\n  const extra = 66 * u;\n  const valueF = 40 * u;\n  const longestLabel = Math.max(...rows.map((r) => r.label.length), 1);\n  const labelW = longestLabel * 22 * u * 0.56 + 48 * u;\n  const hlF = Math.min(\n    84 * u,\n    (tableW - labelW) / Math.max(rows[hl]?.value.length ?? 1, 1) / 0.56,\n  );\n  const hScale = valueF / hlF;\n\n  const grow = interpolate(t, [expandAt, expandAt + 22], [0, 1], {\n    ...CLAMP,\n    easing: EASE_IO,\n  });\n  const heights = rows.map((_, i) => baseH + (i === hl ? extra * grow : 0));\n  const total = heights.reduce((a, b) => a + b, 0);\n  const top = (H - total) / 2;\n  const rowTop = (i: number) => {\n    let y = top;\n    for (let k = 0; k < i; k++) y += heights[k];\n    return y;\n  };\n\n  const rule = (i: number) =>\n    interpolate(t, [4 + i * stagger, 26 + i * stagger], [0, 1], {\n      ...CLAMP,\n      easing: EASE_IO,\n    });\n  const rise = (d: number) =>\n    interpolate(t, [d, d + 18], [0, 1], { ...CLAMP, easing: EASE_OUT });\n  const valueP = (i: number) =>\n    interpolate(t, [12 + i * stagger, 34 + i * stagger], [0, 1], CLAMP);\n\n  const titleF = 84 * u;\n  const titleP = rise(0);\n  const lockP = rise(8);\n  const bottom = top + total;\n\n  return (\n    <AbsoluteFill\n      style={{ background: background ?? c.bg, overflow: \"hidden\" }}\n    >\n      {background === \"transparent\" ? null : (\n        <AbsoluteFill\n          style={{\n            background: `radial-gradient(ellipse 70% 80% at 30% 30%, ${c.key}, transparent 70%)`,\n          }}\n        />\n      )}\n      <ScaleLayer scale={scale}>\n        <div\n          style={{\n            position: \"absolute\",\n            left: mX,\n            top: top - 2 * u,\n            height: titleF * 1.2,\n            overflow: \"hidden\",\n          }}\n        >\n          <div\n            style={{\n              fontFamily: serif,\n              fontWeight: 400,\n              fontSize: titleF,\n              lineHeight: 1.2,\n              letterSpacing: \"-0.02em\",\n              whiteSpace: \"nowrap\",\n              color: fg,\n              transform: `translateY(${(1 - titleP) * titleF * 1.2}px)`,\n            }}\n          >\n            {title}\n          </div>\n        </div>\n\n        <div\n          style={{\n            position: \"absolute\",\n            left: mX,\n            top: bottom - 24 * u - 28 * u,\n            height: 28 * u,\n            display: \"flex\",\n            alignItems: \"baseline\",\n            gap: 10 * u,\n            fontFamily,\n            fontWeight: 400,\n            fontSize: 22 * u,\n            lineHeight: 1,\n            letterSpacing: \"-0.01em\",\n            color: c.muted,\n            opacity: lockP,\n            transform: `translateY(${(1 - lockP) * 10 * u}px)`,\n          }}\n        >\n          {logo ?? <KuchiLogo fontSize={26 * u} color={fg} />}\n          {name}\n        </div>\n\n        {Array.from({ length: n + 1 }, (_, i) => {\n          const strong = i === 0;\n          const th = strong ? 2 * u : hair;\n          return (\n            <div\n              key={`r${i}`}\n              style={{\n                position: \"absolute\",\n                left: tableX,\n                top: rowTop(i) - th / 2,\n                width: tableW * rule(i),\n                height: th,\n                background: strong ? c.rule : c.hair,\n              }}\n            />\n          );\n        })}\n\n        {rows.map((row, i) => {\n          const y = rowTop(i);\n          const h = heights[i];\n          const isHl = i === hl;\n          const lp = rise(10 + i * stagger);\n          const grown = isHl ? hScale + (1 - hScale) * grow : 1;\n          const fill =\n            isHl && grow > 0\n              ? {\n                  backgroundImage: haloFill(\n                    theme,\n                    t,\n                    ink\n                      ? `color-mix(in srgb, ${ink} ${((1 - grow) * 100).toFixed(2)}%, transparent)`\n                      : rgba(c.fg, 1 - grow),\n                    accent,\n                  ),\n                  WebkitBackgroundClip: \"text\",\n                  backgroundClip: \"text\",\n                  color: \"transparent\",\n                }\n              : { color: fg };\n          const labelColor = isHl\n            ? interpolateColors(grow, [0, 1], [c.muted, fg])\n            : c.muted;\n          return (\n            <div key={`${i}-${row.label}`}>\n              <div\n                style={{\n                  position: \"absolute\",\n                  left: tableX,\n                  top: y,\n                  height: h,\n                  display: \"flex\",\n                  alignItems: \"center\",\n                  fontFamily,\n                  fontWeight: 400,\n                  fontSize: 22 * u,\n                  lineHeight: 1,\n                  letterSpacing: \"-0.005em\",\n                  whiteSpace: \"nowrap\",\n                  color: labelColor,\n                  opacity: lp,\n                  transform: `translateY(${(1 - lp) * 12 * u}px)`,\n                }}\n              >\n                {row.label}\n              </div>\n              <div\n                style={{\n                  position: \"absolute\",\n                  right: mX,\n                  top: y,\n                  height: h,\n                  display: \"flex\",\n                  alignItems: \"center\",\n                  fontFamily,\n                  fontWeight: 500,\n                  fontSize: isHl ? hlF : valueF,\n                  lineHeight: 1.1,\n                  letterSpacing: \"-0.03em\",\n                  fontVariantNumeric: \"tabular-nums\",\n                  whiteSpace: \"pre\",\n                  ...fill,\n                  transform: `scale(${grown})`,\n                  transformOrigin: \"100% 50%\",\n                }}\n              >\n                <Value value={row.value} p={valueP(i)} />\n              </div>\n            </div>\n          );\n        })}\n      </ScaleLayer>\n\n      {grain ? <Grain opacity={c.grain} /> : null}\n    </AbsoluteFill>\n  );\n}\n"}]}