{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ellipsis-resolve",
  "title": "Ellipsis Resolve",
  "description": "Three dots pulse and resolve into a gradient word and a closing period.",
  "dependencies": ["remotion", "@remotion/google-fonts"],
  "files": [
    {
      "path": "registry/remocn/ellipsis-resolve/index.tsx",
      "content": "\"use client\";\n\nimport { loadFont } from \"@remotion/google-fonts/InstrumentSerif\";\nimport type React from \"react\";\nimport { useId, useMemo } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  interpolateColors,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nconst { fontFamily: serif } = loadFont(\"normal\", {\n  weights: [\"400\"],\n  subsets: [\"latin\"],\n});\n\nexport interface EllipsisResolveProps {\n  /** The word the ellipsis resolves into. A period is always appended. */\n  word?: string;\n  accent?: string;\n  theme?: \"dark\" | \"light\";\n  speed?: number;\n}\n\n// Instrument Serif 400 advance widths (1/1000 em) for ASCII 32–126.\nconst SERIF_400 = [\n  170, 237, 371, 635, 417, 590, 579, 233, 340, 340, 444, 531, 217, 430, 213,\n  258, 460, 249, 404, 371, 393, 382, 404, 364, 433, 402, 213, 217, 531, 531,\n  531, 317, 660, 457, 478, 480, 530, 453, 408, 521, 546, 249, 249, 496, 413,\n  665, 540, 540, 466, 540, 513, 407, 461, 536, 457, 651, 546, 477, 427, 325,\n  258, 325, 433, 376, 354, 399, 443, 339, 457, 355, 288, 402, 470, 223, 215,\n  451, 220, 704, 470, 408, 444, 442, 318, 308, 259, 454, 393, 597, 385, 401,\n  353, 318, 252, 318, 531,\n];\nconst TRACK = -0.012;\nconst CAP = 0.72;\nconst BASELINE = 0.94; // baseline offset inside a lineHeight 1.2 box (asc 990, desc 310)\nconst PERIOD = 0.213; // advance of \".\"\nconst DOT = 0.105; // period diameter\nconst DOT_LSB = 0.054; // period left side bearing\n\n// Beats (frames at 30fps).\nconst PULSE_A = 2;\nconst PULSE_B = 20;\nconst BUMP = 11;\nconst BUMP_STEP = 4;\nconst STRETCH = 40;\nconst STRETCH_LEN = 20;\nconst SWEEP = 58;\nconst SWEEP_LEN = 26;\nconst RISE = 13;\nconst SETTLE = 10;\n\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst EASE_IO = Easing.bezier(0.65, 0, 0.35, 1);\nconst EASE_SWEEP = Easing.bezier(0.55, 0, 0.25, 1);\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\n// gradients.sh \"silk\" palette (#3b3fd8, #f3d6c0, #8a7bff on #030308): a\n// sheen across the resolved word, plus a faint haze of it on the stage.\nconst THEMES = {\n  dark: {\n    bg: \"#030308\",\n    fg: \"#F4F1EE\",\n    muted: \"#46464F\",\n    ink: [\"#F3D6C0\", \"#F6EEE9\", \"#B4A9FF\", \"#8A7BFF\"],\n    haze: \"rgba(138,123,255,0.16)\",\n    grain: 0.07,\n  },\n  light: {\n    bg: \"#F5F4F0\",\n    fg: \"#121214\",\n    muted: \"#BBBAB4\",\n    ink: [\"#14163F\", \"#2A2DA8\", \"#3B3FD8\", \"#8A7BFF\"],\n    haze: \"rgba(243,214,192,0.55)\",\n    grain: 0.045,\n  },\n} as const;\n\nfunction advance(ch: string) {\n  const code = ch.charCodeAt(0);\n  return (code >= 32 && code < 127 ? SERIF_400[code - 32] : 620) / 1000;\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, pointerEvents: \"none\" }}\n      aria-hidden\n    >\n      <filter id={id}>\n        <feTurbulence\n          type=\"fractalNoise\"\n          baseFrequency=\"0.9\"\n          numOctaves={2}\n          seed={17}\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\nconst lerp = (a: number, b: number, p: number) => a + (b - a) * p;\n\nexport const ellipsisResolveDuration = SWEEP + SWEEP_LEN + RISE + 34;\n\nexport function EllipsisResolve({\n  word = \"Shipped\",\n  accent = \"#3B5BFD\",\n  theme = \"dark\",\n  speed = 1,\n}: EllipsisResolveProps) {\n  const t = useCurrentFrame() * speed;\n  const { width: W, height: H } = useVideoConfig();\n  const c = THEMES[theme];\n  const u = H / 720;\n\n  const layout = useMemo(() => {\n    const chars = Array.from(word);\n    const adv = chars.map((ch) => advance(ch) + TRACK);\n    const total = adv.reduce((s, a) => s + a, 0) + PERIOD;\n    const F = Math.min(250 * u, (W * 0.72) / total);\n    const left = W / 2 - (total * F) / 2;\n    let x = left;\n    const letters = chars.map((ch, i) => {\n      const box = { ch, x, w: adv[i] * F };\n      x += adv[i] * F;\n      return box;\n    });\n    const periodCx = x + (DOT_LSB + DOT / 2) * F;\n    return { F, left, letters, periodCx, wordW: x - left };\n  }, [word, W, u]);\n  const { F, left, letters, periodCx, wordW } = layout;\n\n  const d = DOT * F;\n  const baseline = H / 2 + (CAP * F) / 2;\n  const restY = baseline - d / 2;\n  const pitch = 1.95 * d;\n\n  // Camera: starts close on the typing indicator, eases out to the word.\n  const zoom = interpolate(\n    t,\n    [STRETCH - 6, STRETCH + STRETCH_LEN + 6],\n    [0, 1],\n    {\n      ...CLAMP,\n      easing: EASE_IO,\n    },\n  );\n  const cam = lerp(1.75, 1, zoom);\n\n  // Dots begin centered in frame, then settle onto the word's baseline.\n  const drop = EASE_IO(\n    interpolate(t, [STRETCH, STRETCH + STRETCH_LEN], [0, 1], CLAMP),\n  );\n  const dotY = lerp(H / 2, restY, drop);\n\n  const bump = (k: number) => {\n    let b = 0;\n    for (const start of [PULSE_A, PULSE_B]) {\n      const local = (t - start - k * BUMP_STEP) / BUMP;\n      if (local > 0 && local < 1) b = Math.max(b, Math.sin(Math.PI * local));\n    }\n    return b;\n  };\n\n  // Stretch: dot 3 travels to the period, dots 1 and 2 pull into one bar.\n  const st = (k: number) =>\n    EASE_IO(\n      interpolate(\n        t,\n        [STRETCH + (2 - k) * 2, STRETCH + (2 - k) * 2 + STRETCH_LEN - 4],\n        [0, 1],\n        CLAMP,\n      ),\n    );\n  const barRight = periodCx - d / 2 - 0.55 * d;\n  const mid = (left + barRight) / 2;\n  const startCx = (k: number) => W / 2 + (k - 1) * pitch;\n\n  // Sweep: the bar's left edge chases right and folds into the period.\n  const sweepRaw = interpolate(t, [SWEEP, SWEEP + SWEEP_LEN], [0, 1], CLAMP);\n  const sweep = EASE_SWEEP(sweepRaw);\n  const closeGap = EASE_IO(interpolate(t, [SWEEP, SWEEP + 10], [0, 1], CLAMP));\n  const barL = lerp(left, periodCx - d / 2, sweep);\n  const barR = lerp(barRight, periodCx + d / 2, closeGap);\n  const sweeping = t >= SWEEP;\n\n  // Each letter starts rising the frame the bar's edge clears its middle.\n  const crossAt = useMemo(\n    () =>\n      letters.map((l) => {\n        const target = l.x + l.w * 0.45;\n        for (let f = 0; f <= SWEEP_LEN; f += 0.25) {\n          const x = lerp(left, periodCx - d / 2, EASE_SWEEP(f / SWEEP_LEN));\n          if (x >= target) return SWEEP + f;\n        }\n        return SWEEP + SWEEP_LEN;\n      }),\n    [letters, left, periodCx, d],\n  );\n\n  const accentIn = EASE_OUT(\n    interpolate(t, [STRETCH + 4, STRETCH + STRETCH_LEN], [0, 1], CLAMP),\n  );\n  const landAt = SWEEP + SWEEP_LEN;\n  const settle = interpolate(t, [landAt - 2, landAt + SETTLE], [0, 1], CLAMP);\n  const pop = 1 + 0.14 * Math.sin(Math.PI * EASE_OUT(settle));\n  const push = interpolate(t, [landAt, landAt + 40], [0, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n\n  // The silk sheen drifts a few degrees while the word holds.\n  const sheen = `linear-gradient(${96 + 10 * push}deg, ${c.ink[0]} 0%, ${c.ink[1]} 34%, ${c.ink[2]} 72%, ${c.ink[3]} 100%)`;\n\n  const dotStyle = (\n    l: number,\n    r: number,\n    y: number,\n    color: string,\n  ): React.CSSProperties => ({\n    position: \"absolute\",\n    left: l,\n    top: y - d / 2,\n    width: Math.max(d, r - l),\n    height: d,\n    borderRadius: d / 2,\n    background: color,\n  });\n\n  const dot3Cx = lerp(startCx(2), periodCx, st(2));\n  const dot3Color = interpolateColors(\n    accentIn,\n    [0, 1],\n    [interpolateColors(bump(2), [0, 1], [c.muted, c.fg]), accent],\n  );\n\n  return (\n    <AbsoluteFill style={{ background: c.bg, overflow: \"hidden\" }}>\n      <AbsoluteFill\n        style={{\n          opacity: 0.4 + 0.6 * accentIn,\n          background: `radial-gradient(60% 42% at ${46 + 4 * push}% 50%, ${c.haze} 0%, transparent 70%)`,\n        }}\n      />\n      <AbsoluteFill\n        style={{\n          transform: `scale(${cam * (1 + 0.02 * push)})`,\n          transformOrigin: `${W / 2}px ${lerp(H / 2, baseline - 0.3 * F, zoom)}px`,\n        }}\n      >\n        {letters.map((l, i) => {\n          const p = EASE_OUT(\n            interpolate(t, [crossAt[i], crossAt[i] + RISE], [0, 1], CLAMP),\n          );\n          if (p <= 0) return null;\n          return (\n            <div\n              key={`${i}-${l.ch}`}\n              style={{\n                position: \"absolute\",\n                left: l.x,\n                top: baseline - BASELINE * F,\n                fontFamily: serif,\n                fontWeight: 400,\n                fontSize: F,\n                lineHeight: 1.2,\n                whiteSpace: \"pre\",\n                color: \"transparent\",\n                backgroundImage: sheen,\n                backgroundSize: `${wordW}px ${1.2 * F}px`,\n                backgroundPosition: `${left - l.x}px 0`,\n                backgroundRepeat: \"no-repeat\",\n                WebkitBackgroundClip: \"text\",\n                backgroundClip: \"text\",\n                opacity: Math.min(1, p * 1.6),\n                transform: `translateY(${(1 - p) * 0.16 * F}px)`,\n              }}\n            >\n              {l.ch}\n            </div>\n          );\n        })}\n\n        {(() => {\n          if (sweeping) return <div style={dotStyle(barL, barR, dotY, c.fg)} />;\n          const segs = [0, 1].map((k) => {\n            const s = st(k);\n            const cx = startCx(k);\n            const l0 = cx - d / 2;\n            const r0 = cx + d / 2;\n            return {\n              l: k === 0 ? lerp(l0, left, s) : lerp(l0, mid - d / 2, s),\n              r: k === 0 ? lerp(r0, mid + d / 2, s) : lerp(r0, barRight, s),\n              lift: bump(k) * 0.05 * F * (1 - s),\n              color: interpolateColors(\n                Math.max(bump(k), Math.min(1, s * 3)),\n                [0, 1],\n                [c.muted, c.fg],\n              ),\n            };\n          });\n          // Once the two capsules overlap they are one bar: draw it once so\n          // the rounded ends never leave an antialiased seam.\n          if (segs[1].l < segs[0].r) {\n            return <div style={dotStyle(segs[0].l, segs[1].r, dotY, c.fg)} />;\n          }\n          return segs.map((g, k) => (\n            <div\n              key={k === 0 ? \"a\" : \"b\"}\n              style={dotStyle(g.l, g.r, dotY - g.lift, g.color)}\n            />\n          ));\n        })()}\n\n        <div\n          style={{\n            ...dotStyle(\n              dot3Cx - d / 2,\n              dot3Cx + d / 2,\n              dotY - bump(2) * 0.05 * F * (1 - st(2)),\n              dot3Color,\n            ),\n            transform: `scale(${pop})`,\n          }}\n        />\n      </AbsoluteFill>\n      <Grain opacity={c.grain} />\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/ellipsis-resolve.tsx"
    }
  ],
  "type": "registry:component"
}
