{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "xray-lens-demo",
  "type": "registry:block",
  "title": "Xray Lens: Model Output",
  "description": "Hover Reveal Magnifier example, Model Output: A support ticket triaged by an AI. Under the glass every chip and button turns into the field or tool call behind it, and both messages turn into their tokens in place with `XrayLensText`: the reply tinted by confidence, the customer's message with the extracted entities outlined. The lens is `size=\"36%\"`, the switch sits under the card and flips the whole ticket, and on a phone the lens tours the spots by itself. A take on the magnifier (magnifying glass). Fits features and docs sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "features",
    "docs",
    "magnifier",
    "image-reveal",
    "before-and-after",
    "hover",
    "interaction",
    "developer"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/xray-lens#xray-lens-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/xray-lens.json"
  ],
  "files": [
    {
      "path": "components/xray-lens-demo.tsx",
      "type": "registry:component",
      "content": "import type { ReactNode } from \"react\";\n\nimport { XrayLens, XrayLensSpot, XrayLensText } from \"@/components/ui/xray-lens\";\n\n// A spot's box in the xray: a dashed outline exactly where the UI element sits.\nconst box = \"outline-1 -outline-offset-1 outline-dashed outline-sky-400/50 bg-sky-400/[0.07]\";\n\nfunction Value({ children, className }: { children: ReactNode; className?: string }) {\n  return (\n    <span\n      className={`grid size-full place-items-center font-mono text-[11px] leading-none whitespace-nowrap ${className ?? \"text-amber-300\"}`}\n    >\n      {children}\n    </span>\n  );\n}\n\nfunction Chip({ dot, children }: { dot: string; children: ReactNode }) {\n  return (\n    <span className=\"inline-flex h-6 items-center gap-1.5 rounded-full bg-zinc-100 px-2.5 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300\">\n      <span className={`size-1.5 rounded-full ${dot}`} />\n      {children}\n    </span>\n  );\n}\n\nconst MESSAGE =\n  \"I was charged twice for Pro this month, once on Oct 2 and again on Oct 3. Could you refund the extra $49.00?\";\n\n// The reply as the model streamed it: each token with its probability. The dates and the\n// amount are where it was least sure.\nconst REPLY: [string, number][] = [\n  [\"Hi\", 0.99], [\" Maya\", 0.98], [\",\", 0.99], [\" sorry\", 0.93], [\" about\", 0.97], [\" that\", 0.98],\n  [\".\", 0.99], [\" I\", 0.95], [\"'ve\", 0.97], [\" refunded\", 0.9], [\" the\", 0.99], [\" duplicate\", 0.88],\n  [\" $\", 0.7], [\"49\", 0.62], [\".\", 0.9], [\"00\", 0.95], [\" charge\", 0.97], [\",\", 0.96], [\" so\", 0.9],\n  [\" it\", 0.97], [\" should\", 0.82], [\" be\", 0.99], [\" back\", 0.96], [\" on\", 0.95], [\" your\", 0.98],\n  [\" card\", 0.97], [\" in\", 0.94], [\" 5\", 0.41], [\" to\", 0.7], [\" 7\", 0.38], [\" days\", 0.93], [\".\", 0.99],\n];\n\nfunction Ticket() {\n  return (\n    <div className=\"flex flex-col gap-5 p-5 sm:p-6\">\n      <div className=\"flex items-start justify-between gap-4\">\n        <XrayLensSpot\n          label=\"customer = cus_8Hq2nL\"\n          xrayClassName={box}\n          xray={\n            <span className=\"flex h-full flex-col justify-center gap-1.5 pl-2 font-mono text-[11px] leading-none\">\n              <span className=\"text-emerald-300\">&quot;cus_8Hq2nL&quot;</span>\n              <span className=\"text-zinc-400\">\n                plan <span className=\"text-emerald-300\">pro</span> · ltv{\" \"}\n                <span className=\"text-amber-300\">1188</span>\n              </span>\n            </span>\n          }\n          className=\"flex items-center gap-3\"\n        >\n          <span className=\"grid size-10 place-items-center rounded-full bg-gradient-to-br from-amber-200 to-rose-300 text-sm font-semibold text-rose-950\">\n            MC\n          </span>\n          <span className=\"flex flex-col\">\n            <span className=\"text-sm font-medium text-zinc-900 dark:text-zinc-50\">Maya Chen</span>\n            <span className=\"text-xs text-zinc-500\">maya@northwind.io</span>\n          </span>\n        </XrayLensSpot>\n        <XrayLensSpot\n          label=\"received_at\"\n          xrayClassName={box}\n          xray={<Value>1760531412</Value>}\n          className=\"pt-1 text-xs text-zinc-500 tabular-nums\"\n        >\n          2 min ago\n        </XrayLensSpot>\n      </div>\n\n      <div className=\"flex flex-wrap gap-2\">\n        <XrayLensSpot\n          label=\"classify.intent\"\n          xrayClassName={box}\n          xray={<Value className=\"text-emerald-300\">&quot;refund&quot;</Value>}\n        >\n          <Chip dot=\"bg-sky-500\">Billing</Chip>\n        </XrayLensSpot>\n        <XrayLensSpot label=\"classify.sentiment\" xrayClassName={box} xray={<Value>-0.72</Value>}>\n          <Chip dot=\"bg-rose-500\">Frustrated</Chip>\n        </XrayLensSpot>\n        <XrayLensSpot label=\"route.priority = p1\" xrayClassName={box} xray={<Value>sla 2h</Value>}>\n          <Chip dot=\"bg-amber-500\">Urgent</Chip>\n        </XrayLensSpot>\n      </div>\n\n      <XrayLensText\n        text={MESSAGE}\n        entities={[\n          { text: \"charged twice\", label: \"extract.issue = duplicate_charge\" },\n          { text: \"$49.00\", label: \"extract.amount = 4900\" },\n        ]}\n        label=\"input · 31 tokens\"\n        className=\"text-[15px] leading-relaxed text-pretty text-zinc-700 dark:text-zinc-300\"\n      />\n\n      <XrayLensSpot\n        label=\"generate.reply\"\n        xrayClassName={box}\n        xray={\n          <span className=\"absolute top-4 left-4 font-mono text-[11px] leading-4\">\n            <span className=\"text-violet-300\">generate</span>\n            <span className=\"text-zinc-400\">\n              () · <span className=\"text-amber-300\">61</span> tok · <span className=\"text-amber-300\">412</span>ms\n            </span>\n          </span>\n        }\n        className=\"rounded-xl bg-zinc-50 p-4 ring-1 ring-zinc-950/5 dark:bg-zinc-900 dark:ring-white/10\"\n      >\n        <div className=\"flex items-center justify-between text-xs leading-4\">\n          <span className=\"font-medium text-zinc-900 dark:text-zinc-100\">Suggested reply</span>\n          <XrayLensSpot\n            as=\"span\"\n            label=\"eval.confidence\"\n            xrayClassName={box}\n            xray={<Value>p 0.94</Value>}\n            className=\"inline-block text-zinc-500 tabular-nums\"\n          >\n            94% confident\n          </XrayLensSpot>\n        </div>\n        <XrayLensText\n          tokens={REPLY.map(([text, p]) => ({ text, p }))}\n          label=\"output · logprobs\"\n          className=\"mt-2 text-sm leading-relaxed text-pretty text-zinc-600 dark:text-zinc-400\"\n        />\n      </XrayLensSpot>\n\n      <div className=\"flex items-center gap-2\">\n        <XrayLensSpot\n          label=\"tool_call · stripe\"\n          xrayClassName={box}\n          xray={<Value className=\"text-violet-300\">refunds.create()</Value>}\n        >\n          <button\n            type=\"button\"\n            className=\"h-9 rounded-lg bg-zinc-900 px-3.5 text-sm font-medium text-white transition-colors hover:bg-zinc-800 dark:bg-white dark:text-zinc-900 dark:hover:bg-zinc-200\"\n          >\n            Refund $49.00\n          </button>\n        </XrayLensSpot>\n        <XrayLensSpot\n          label=\"tool_call · helpdesk\"\n          xrayClassName={box}\n          xray={<Value className=\"text-violet-300\">reply.send()</Value>}\n        >\n          <button\n            type=\"button\"\n            className=\"h-9 rounded-lg px-3.5 text-sm font-medium text-zinc-700 ring-1 ring-zinc-950/10 transition-colors hover:bg-zinc-50 dark:text-zinc-300 dark:ring-white/15 dark:hover:bg-zinc-900\"\n          >\n            Send reply\n          </button>\n        </XrayLensSpot>\n      </div>\n    </div>\n  );\n}\n\nexport function XrayLensDemo() {\n  return (\n    <section className=\"w-full max-w-xl\">\n      <XrayLens\n        size=\"36%\"\n        rest={{ x: 0.26, y: 0.26 }}\n        labels={[\"Ticket\", \"Model\"]}\n        toggleClassName=\"top-full right-auto bottom-auto left-1/2 mt-4 -translate-x-1/2\"\n        surface={<Ticket />}\n        xray={\n          <div className=\"absolute inset-0 bg-[linear-gradient(rgb(56_189_248/0.07)_1px,transparent_1px),linear-gradient(90deg,rgb(56_189_248/0.07)_1px,transparent_1px)] bg-size-[16px_16px]\" />\n        }\n        xrayClassName=\"bg-[#060a12] text-sky-100\"\n        className=\"rounded-2xl bg-white shadow-[0_1px_2px_rgb(0_0_0/0.05),0_16px_40px_-20px_rgb(0_0_0/0.3)] ring-1 ring-zinc-950/5 dark:bg-zinc-950 dark:ring-white/10\"\n      />\n      <p className=\"mt-20 text-center text-sm text-zinc-500\">\n        Point at the ticket to see what the model read and returned, or flip the whole card.\n      </p>\n    </section>\n  );\n}\n"
    }
  ]
}