{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "prompt-mark",
  "title": "Prompt Mark",
  "description": "Prompt to logo reveal: a prompt types into a dark pill while the camera rides the caret, pans onto the send button, the arrow becomes the snapcn mark, the room flashes into the other mode inside an accent bloom, and the badge settles into a logo lockup. Camera, keystrokes and cursor measured frame by frame from a recording.",
  "dependencies": [
    "remotion",
    "@remotion/google-fonts"
  ],
  "registryDependencies": [
    "https://snapcn.dev/r/snap-cn-ui.json",
    "https://snapcn.dev/r/input.json"
  ],
  "files": [
    {
      "path": "registry/snap-cn/prompt-mark/index.tsx",
      "content": "// Prompt Mark · snapcn — https://snapcn.dev/docs/ai-input/prompt-mark\n\"use client\";\n\nimport { loadFont } from \"@remotion/google-fonts/Inter\";\nimport type { ReactNode } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  getRemotionEnvironment,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\nimport { inputStyleContext } from \"@/components/snap-cn/input\";\nimport {\n  mixOklch,\n  resolveFont,\n  type SnapCnTheme,\n  useSnapCnTheme,\n  withAlpha,\n} from \"@/lib/snap-cn-ui\";\n\nconst { fontFamily: SANS } = loadFont(\"normal\", {\n  weights: [\"500\", \"600\"],\n  subsets: [\"latin\"],\n});\n\n// --- The stage -------------------------------------------------------------\n//\n// Geometry and timing were read off a 712×402, 30fps screen recording, in its\n// own pixels (\"ref px\"). They are multiplied out to the composition's pixels\n// (`u`) before anything is laid out: laying out at ref size and scaling the box\n// up lets Chrome round every left/top to a whole *ref* pixel, which is a 1.8px\n// jump per frame at 720p. Everything that moves, moves by `transform`.\n//\n// \"World\" is the recording's frame 0. The camera only pans (the pill is 187px\n// tall on every frame), so a world point lands on screen at `world + cam`.\n\nconst REF_W = 712;\nconst REF_H = 402;\n/** Recorded fps: every time below is in recorded frames. */\nconst REF_FPS = 30;\n\n/**\n * The pan, per recorded frame, measured by registering each frame on the last.\n * The source's one-frame 7.5px hop on the first keystroke is folded into the\n * text's position instead, so the pan starts from rest.\n */\nconst CAM_X = [\n  0, 0, 0, 0, 0, 0, 0, 0, -0.2, -0.8, -1.9, -3.6, -5.7, -8.5, -12, -16, -20.9,\n  -26.6, -33.1, -40.4, -49, -58.6, -69.6, -82.1, -96.2, -112.1, -130, -150.3,\n  -173.3, -199.4, -229.1, -262.8, -300.9, -343.6, -390.9, -441.8, -494.7,\n  -547.3, -597.4, -643.5, -685, -721.8, -754.2, -782.6, -807.7, -829.7, -849.1,\n  -866.2, -881.2, -894.5, -906.2, -916.5, -925.6, -933.5, -940.4, -946.4,\n  -951.5, -955.7, -959.3, -962.2, -964.4, -966.2, -967.3, -968, -968.2,\n];\nconst CAM_X_END = CAM_X[CAM_X.length - 1];\n/** The rise: already moving on frame 0, an exponential settle onto -35. */\nconst CAM_Y_END = -35;\nconst camY = (f: number) => CAM_Y_END * (1 - Math.exp(-0.23 * Math.max(0, f)));\n\n/** The input pill, world ref px. Fully round ends. */\nconst PILL = { x: 142, y: 142, w: 1273, h: 187 };\n/** The prompt line: Inter 500 at 127px, its line box's top at y 171. */\nconst TEXT = { x: 198.9, top: 171, size: 127, tracking: 3 };\n/** The caret: a 9px bar from y 180 to 307, 9px past the last glyph. */\nconst CARET = { w: 9, top: 180, h: 127, gap: 9 };\n/** The send button: a 168px disc, 11px inside the pill's right end. */\nconst SEND = { cx: 1320.2, cy: 239, d: 168 };\n/** It shrinks to an 88px badge, whose mark then carries the lockup. */\nconst BADGE = 88;\n/**\n * The lockup's proportions, as a wordmark would set them. The name is\n * lowercase, so the mark is sized and centred on its x-height (Inter: 0.546em,\n * centred 0.091em below the line box's middle at line-height 1), not its em\n * box: the mark stands as tall as a capital (1.33 x-heights), the gap is 0.24em.\n */\nconst WORD = { size: 64, gap: 0.24, xHeight: 0.546, xDrop: 0.091 };\nconst MARK_H = 1.33 * WORD.xHeight * WORD.size;\nconst MARK_W = (MARK_H * 464) / 409;\n\n/** The recording's 11 keystrokes; anything longer keeps typing at 3 frames a key. */\nconst KEYS = [3, 6, 9, 13, 16, 19, 22, 26, 29, 32, 35];\nconst keyAt = (i: number) =>\n  i < KEYS.length ? KEYS[i] : KEYS[KEYS.length - 1] + 3 * (i - KEYS.length + 1);\n\n/** A moderate decelerate: arrives at rest without spending frames on nothing. */\nconst SETTLE = Easing.bezier(0.2, 0.6, 0.35, 1);\nconst IN_OUT = Easing.bezier(0.45, 0, 0.25, 1);\nconst clamp = { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\" } as const;\n\n/** Linear lookup into a per-frame table, holding its ends. */\nfunction table(t: readonly number[], f: number): number {\n  if (f <= 0) return t[0];\n  if (f >= t.length - 1) return t[t.length - 1];\n  const lo = Math.floor(f);\n  return t[lo] + (t[lo + 1] - t[lo]) * (f - lo);\n}\n\n/** The snapcn mark — a lens body and its shutter wedge. */\nfunction Mark({ size, fill }: { size: number; fill: string }) {\n  return (\n    <svg\n      width={size}\n      height={(size * 409) / 464}\n      viewBox=\"0 0 464 409\"\n      aria-hidden\n      style={{ display: \"block\" }}\n    >\n      <g transform=\"translate(0,409) scale(0.1,-0.1)\" fill={fill}>\n        <path d=\"M589 3805 c-167 -41 -305 -149 -380 -297 -60 -120 -59 -84 -59 -1239 0 -1004 1 -1059 19 -1112 48 -147 148 -226 331 -262 100 -20 127 -33 186 -87 53 -49 74 -109 74 -212 1 -121 42 -196 133 -244 l52 -27 980 -3 c883 -3 986 -1 1042 13 75 21 133 67 171 139 l27 51 3 315 c2 173 2 342 0 374 l-3 60 -31 -50 c-36 -59 -101 -115 -170 -146 l-49 -23 -810 -3 c-591 -2 -825 0 -865 8 -128 28 -258 121 -325 234 -65 110 -66 128 -63 826 l3 625 24 58 c44 111 147 210 270 259 l56 23 830 3 c809 2 831 2 895 -18 80 -25 149 -74 198 -142 l37 -52 3 334 c3 367 -3 418 -56 494 -30 44 -98 91 -152 106 -22 6 -457 10 -1175 9 -923 -1 -1151 -3 -1196 -14z M3800 2983 c-327 -196 -598 -361 -602 -367 -4 -6 -7 -254 -5 -550 l2 -540 145 -91 c80 -50 208 -130 285 -177 77 -47 283 -174 457 -282 174 -108 326 -196 337 -196 11 0 27 7 35 16 14 14 16 141 16 1254 0 781 -4 1248 -10 1264 -7 20 -16 26 -37 26 -18 -1 -232 -123 -623 -357z\" />\n      </g>\n    </svg>\n  );\n}\n\ninterface DiscLook {\n  /** Drawn at this size in px, then scaled by `scale` — never resized. */\n  size: number;\n  scale: number;\n  fill: string;\n  accent: string;\n  arrow: number;\n  mark: number;\n  glow: number;\n  ring: string;\n}\n\n/**\n * The send button and, later, the badge. One drawing, so the hand-off from the\n * camera's world to the lockup is pixel-identical.\n */\nfunction Disc({\n  size,\n  scale,\n  fill,\n  accent,\n  arrow,\n  mark,\n  glow,\n  ring,\n}: DiscLook) {\n  return (\n    <div\n      style={{\n        position: \"absolute\",\n        left: -size / 2,\n        top: -size / 2,\n        width: size,\n        height: size,\n        borderRadius: \"50%\",\n        background: fill,\n        boxShadow: `inset 0 0 0 ${size * 0.012}px ${ring}`,\n        overflow: \"hidden\",\n        transform: `scale(${scale})`,\n      }}\n    >\n      <div\n        style={{\n          position: \"absolute\",\n          inset: 0,\n          opacity: glow,\n          background: `radial-gradient(75% 60% at 50% 100%, ${withAlpha(accent, 0.55)} 0%, ${withAlpha(accent, 0.18)} 50%, ${withAlpha(accent, 0)} 100%)`,\n        }}\n      />\n      {/* Send: the round-capped lucide up-arrow, drawn at disc scale. */}\n      <svg\n        width={size}\n        height={size}\n        viewBox=\"0 0 24 24\"\n        aria-hidden\n        style={{\n          position: \"absolute\",\n          inset: 0,\n          opacity: arrow,\n          transform: `scale(${0.5 + 0.06 * arrow})`,\n        }}\n      >\n        <g\n          fill=\"none\"\n          stroke={accent}\n          strokeWidth={2.4}\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n        >\n          <path d=\"M12 19V5\" />\n          <path d=\"M5.5 11.5L12 5l6.5 6.5\" />\n        </g>\n      </svg>\n      <div\n        style={{\n          position: \"absolute\",\n          inset: 0,\n          display: \"flex\",\n          alignItems: \"center\",\n          justifyContent: \"center\",\n          opacity: mark,\n          transform: `scale(${0.88 + 0.12 * mark})`,\n        }}\n      >\n        <Mark size={size * 0.5} fill={accent} />\n      </div>\n    </div>\n  );\n}\n\nexport interface PromptMarkProps {\n  /** What gets typed into the prompt. About 11 characters fits the pan. */\n  text?: string;\n  /** The name in the closing lockup. */\n  name?: string;\n  theme?: Partial<SnapCnTheme>;\n  /** The scene opens in this mode and flashes into the other. */\n  mode?: \"light\" | \"dark\";\n  fontFamily?: string;\n}\n\n/**\n * A prompt types into a pill while the camera rides the caret, pans onto the\n * send button, the arrow becomes the mark, the room flashes into the other mode\n * inside an accent bloom, and the badge settles into a logo lockup.\n */\nexport function PromptMark({\n  text = \"Ship a demo\",\n  name = \"snapcn\",\n  theme,\n  mode = \"dark\",\n  fontFamily = \"Default\",\n}: PromptMarkProps) {\n  const frame = useCurrentFrame();\n  const { fps, width, height } = useVideoConfig();\n  const f = (frame * REF_FPS) / fps;\n  const t = useSnapCnTheme(theme, mode);\n  const ui = inputStyleContext(t);\n  const face = resolveFont(fontFamily) ?? SANS;\n  const rendering = getRemotionEnvironment().isRendering;\n\n  // The composition's px per ref px, and the stage's offset inside the frame.\n  const u = Math.max(width / REF_W, height / REF_H);\n  const ox = (width - REF_W * u) / 2;\n  const oy = (height - REF_H * u) / 2;\n  const camX = table(CAM_X, f);\n  const cy = camY(f);\n  const at = (wx: number, wy: number) => [\n    (wx + camX) * u + ox,\n    (wy + cy) * u + oy,\n  ];\n\n  // --- palette: the mode it opens in, and the one the flash lands in ------\n  const accent = t.primary;\n  const endPage = t.foreground;\n  const endInk = t.background;\n  const glowColor = mixOklch(t.background, accent, 0.42);\n\n  // --- typing --------------------------------------------------------------\n  const chars = Array.from(text);\n  const typed = chars.filter((_, i) => f >= keyAt(i)).length;\n  const lastKey = typed ? keyAt(typed - 1) : 0;\n  const doneAt = keyAt(Math.max(0, chars.length - 1));\n  const cool = (k: number) => interpolate(f - k, [0, 2], [0, 1], clamp);\n  const caretOn = f < doneAt + 1 || Math.floor(f - lastKey) % 16 < 7;\n  const pillOpacity = interpolate(f, [55, 60], [1, 0], clamp);\n\n  // --- send → mark → badge -------------------------------------------------\n  const flash = interpolate(f, [107, 118], [0, 1], clamp);\n  const look: DiscLook = {\n    size: SEND.d * u,\n    scale: interpolate(f, [93, 116], [1, BADGE / SEND.d], {\n      ...clamp,\n      easing: IN_OUT,\n    }),\n    fill: t.foreground,\n    accent,\n    arrow: interpolate(f, [66, 73], [1, 0], clamp),\n    mark: interpolate(f, [72, 90], [0, 1], { ...clamp, easing: SETTLE }),\n    glow:\n      interpolate(f, [74, 93], [0, 1], clamp) *\n      interpolate(f, [100, 116], [1, 0], clamp),\n    // On the flashed page the badge is page-coloured, so a hairline draws it.\n    ring: withAlpha(mixOklch(endPage, endInk, 0.14), flash),\n  };\n\n  // The cursor rises from below the frame and settles under the button.\n  const cursorRise = interpolate(f, [36, 64], [0, 1], {\n    ...clamp,\n    easing: SETTLE,\n  });\n  const cursorOpacity = interpolate(f, [80, 96], [1, 0], clamp);\n\n  // --- the flash: the room lifts into the other mode inside an accent bloom\n  const bloomGrow = interpolate(f, [107, 118], [0.25, 1], {\n    ...clamp,\n    easing: SETTLE,\n  });\n  const bloomOut = interpolate(f, [118, 136], [0, 1], clamp);\n  const bloomOpacity =\n    interpolate(f, [107, 110], [0, 1], clamp) * (1 - bloomOut);\n\n  // --- the lockup ----------------------------------------------------------\n  const p = interpolate(f, [118, 142], [0, 1], { ...clamp, easing: IN_OUT });\n  const word = interpolate(f, [128, 150], [0, 1], {\n    ...clamp,\n    easing: SETTLE,\n  });\n  const inLockup = f >= 118;\n\n  const [sx, sy] = at(SEND.cx, SEND.cy);\n  // Where the camera leaves the badge; the lockup starts from exactly here.\n  const restX = (SEND.cx + CAM_X_END) * u + ox;\n  const restY = (SEND.cy + CAM_Y_END) * u + oy;\n  const badgePx = BADGE * u;\n  const markPx = MARK_W * u;\n  // The badge's mark, as drawn on the disc, is half the badge wide; it grows\n  // from exactly that into the lockup's mark while the disc fades out.\n  const markScale = interpolate(p, [0, 1], [(0.5 * BADGE) / MARK_W, 1]);\n  const discFade = interpolate(p, [0, 0.55], [1, 0], clamp);\n\n  // The prompt line. Chrome rounds a glyph's vertical origin to a whole device\n  // pixel, so a line riding the camera's rise would climb in 1px steps. Two\n  // copies a pixel apart, cross-faded and summed (plus-lighter), put it exactly\n  // where it belongs instead.\n  const lineX = (TEXT.x + camX) * u + ox;\n  const lineY = (TEXT.top + cy) * u + oy;\n  const y0 = Math.floor(lineY);\n  const frac = lineY - y0;\n  const line: ReactNode = (\n    <div\n      style={{\n        display: \"flex\",\n        alignItems: \"flex-start\",\n        height: TEXT.size * u,\n        lineHeight: `${TEXT.size * u}px`,\n        fontFamily: face,\n        fontSize: TEXT.size * u,\n        fontWeight: 500,\n        letterSpacing: TEXT.tracking * u,\n        whiteSpace: \"pre\",\n        textRendering: \"geometricPrecision\",\n      }}\n    >\n      {chars.slice(0, typed).map((ch, i) => (\n        <span\n          // biome-ignore lint/suspicious/noArrayIndexKey: a fixed string\n          key={i}\n          style={{ color: mixOklch(accent, ui.foreground, cool(keyAt(i))) }}\n        >\n          {ch}\n        </span>\n      ))}\n      <span\n        style={{\n          display: \"inline-block\",\n          width: CARET.w * u,\n          height: CARET.h * u,\n          marginLeft: (typed ? CARET.gap : CARET.gap + 9.5) * u,\n          marginTop: (CARET.top - TEXT.top) * u,\n          borderRadius: u,\n          background: typed\n            ? mixOklch(accent, ui.foreground, cool(lastKey))\n            : accent,\n          opacity: caretOn ? 1 : 0,\n        }}\n      />\n    </div>\n  );\n  const [px, py] = at(PILL.x, PILL.y);\n\n  return (\n    <AbsoluteFill style={{ background: t.background, overflow: \"hidden\" }}>\n      {/* The room: fixed to the screen, lit in the accent from the top-right. */}\n      <AbsoluteFill\n        style={{\n          background: `radial-gradient(130% 95% at 100% 0%, ${glowColor} 0%, ${withAlpha(glowColor, 0.45)} 22%, ${withAlpha(glowColor, 0.12)} 48%, ${withAlpha(glowColor, 0)} 78%)`,\n        }}\n      />\n\n      {pillOpacity > 0 ? (\n        <>\n          <div\n            style={{\n              position: \"absolute\",\n              left: 0,\n              top: 0,\n              width: PILL.w * u,\n              height: PILL.h * u,\n              borderRadius: (PILL.h * u) / 2,\n              background: mixOklch(ui.background, t.card, 0.8),\n              boxShadow: `inset 0 0 0 ${Math.max(1, u)}px ${mixOklch(ui.idleBorder, ui.foreground, 0.12)}`,\n              transform: `translate(${px}px, ${py}px)`,\n              opacity: pillOpacity,\n            }}\n          />\n          <div\n            style={{\n              position: \"absolute\",\n              inset: 0,\n              isolation: \"isolate\",\n              opacity: pillOpacity,\n            }}\n          >\n            {[0, 1].map((k) => (\n              <div\n                key={k}\n                style={{\n                  position: \"absolute\",\n                  left: 0,\n                  top: 0,\n                  transform: `translate(${lineX}px, ${y0 + k}px)`,\n                  opacity: k ? frac : 1 - frac,\n                  mixBlendMode: \"plus-lighter\",\n                  willChange: rendering ? undefined : \"transform\",\n                }}\n              >\n                {line}\n              </div>\n            ))}\n          </div>\n        </>\n      ) : null}\n\n      {/* The flash and its bloom. */}\n      <AbsoluteFill style={{ background: endPage, opacity: flash }} />\n      {bloomOpacity > 0 ? (\n        <div\n          style={{\n            position: \"absolute\",\n            left: -250 * u,\n            top: -270 * u,\n            width: 500 * u,\n            height: 540 * u,\n            borderRadius: \"50%\",\n            background: `radial-gradient(closest-side, ${mixOklch(accent, t.primaryForeground, 0.12)} 0%, ${accent} 50%, ${withAlpha(accent, 0)} 100%)`,\n            filter: `blur(${24 * u}px)`,\n            opacity: bloomOpacity,\n            transform: `translate(${restX}px, ${restY}px) scale(${bloomGrow * (1 + 0.12 * bloomOut)})`,\n          }}\n        />\n      ) : null}\n\n      {!inLockup ? (\n        <div\n          style={{\n            position: \"absolute\",\n            left: 0,\n            top: 0,\n            transform: `translate(${sx}px, ${sy}px)`,\n          }}\n        >\n          <Disc {...look} />\n        </div>\n      ) : null}\n\n      {f >= 36 && cursorOpacity > 0 ? (\n        <svg\n          width={26 * u}\n          height={42 * u}\n          viewBox=\"-1 -1 13 21\"\n          aria-hidden\n          style={{\n            position: \"absolute\",\n            left: 0,\n            top: 0,\n            opacity: cursorOpacity,\n            transform: `translate(${sx + 29 * u}px, ${sy + (198 - 145 * cursorRise) * u}px)`,\n          }}\n        >\n          <path\n            d=\"M0 0V16.2L3.9 12.6L6.6 18.7L9.1 17.6L6.5 11.6H11.6Z\"\n            fill=\"#000000\"\n            stroke=\"#ffffff\"\n            strokeWidth={1}\n            strokeLinejoin=\"round\"\n          />\n        </svg>\n      ) : null}\n\n      {/* The lockup: the badge slides over and the name follows it out. */}\n      {inLockup ? (\n        <div\n          style={{\n            position: \"absolute\",\n            left: 0,\n            top: 0,\n            width,\n            height: badgePx,\n            display: \"flex\",\n            justifyContent: \"center\",\n            // A transform, not `top`: a fractional top would be rounded and\n            // the badge would hop on the frame it changes hands.\n            transform: `translateY(${restY - badgePx / 2}px)`,\n          }}\n        >\n          <div\n            style={{\n              display: \"flex\",\n              alignItems: \"center\",\n              height: badgePx,\n              // Percent is of this row: shifting by half of it less half the\n              // badge parks the badge on the frame's centre without measuring\n              // the name; the last term starts it where the camera left it.\n              transform: `translateX(calc(${(1 - p) * 50}% - ${((1 - p) * markPx) / 2}px + ${(1 - p) * (restX - width / 2)}px))`,\n            }}\n          >\n            <div\n              style={{\n                position: \"relative\",\n                width: markPx,\n                height: badgePx,\n                flexShrink: 0,\n                display: \"flex\",\n                alignItems: \"center\",\n                justifyContent: \"center\",\n              }}\n            >\n              {discFade > 0 ? (\n                <div\n                  style={{\n                    position: \"absolute\",\n                    left: markPx / 2,\n                    top: badgePx / 2,\n                    opacity: discFade,\n                  }}\n                >\n                  <Disc {...look} mark={0} />\n                </div>\n              ) : null}\n              <div style={{ transform: `scale(${markScale})` }}>\n                <Mark size={markPx} fill={accent} />\n              </div>\n            </div>\n            <span\n              style={{\n                marginLeft: WORD.gap * WORD.size * u,\n                fontFamily: face,\n                fontSize: WORD.size * u,\n                fontWeight: 600,\n                letterSpacing: -0.025 * WORD.size * u,\n                lineHeight: 1,\n                color: endInk,\n                whiteSpace: \"pre\",\n                textRendering: \"geometricPrecision\",\n                opacity: word,\n                // Lift the x-height's centre onto the mark's centre (static).\n                transform: `translate(${18 * u * (1 - word)}px, ${-WORD.xDrop * WORD.size * u}px)`,\n              }}\n            >\n              {name}\n            </span>\n          </div>\n        </div>\n      ) : null}\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/snap-cn/prompt-mark.tsx"
    }
  ],
  "docs": "Docs and props: https://snapcn.dev/docs/ai-input/prompt-mark?ref=cli — text is the prompt (about 11 characters fits the measured pan), name is the lockup's wordmark; colours come from SnapCnTheme (primary is the accent), mode is the mode it opens in and it flashes into the other. 175 frames at 30fps. — 82 Pro components too — charts, launch scenes, device shots: https://snapcn.dev/docs/pricing?ref=cli-docs",
  "type": "registry:component"
}
