{"name":"hover-card","title":"Hover Card","description":"","kind":"component","category":"overlays","status":"beta","props":{"open":{"type":"boolean","default":false,"model":true},"title":{"type":"string","description":"Header text, e.g. a file name."},"add":{"type":"number","description":"Lines added, shown in the header."},"del":{"type":"number","description":"Lines removed, shown in the header."},"lines":{"type":"array","items":{"text":"string","tone":"'add' | 'del' | 'ctx'?"},"description":"Preformatted lines; add and del lines are tinted and signed."},"tone":{"type":"enum","values":["ctx","add","del"],"default":"ctx","description":"Per line."},"placement":{"type":"enum","values":["top","top-start","top-end","bottom","bottom-start","bottom-end","left","right"],"default":"bottom-start","description":"Preferred side; flips when there is no room."},"openDelay":{"type":"number","default":500,"description":"Delay before opening, in ms."},"closeDelay":{"type":"number","default":150,"description":"Delay before closing, in ms."},"triggerLabel":{"type":"string","description":"Renders the default chip trigger with this label. Otherwise pass your own trigger."}},"playground":{"name":"Playground","props":{"triggerLabel":"src/webhooks/deliver.ts","title":"src/webhooks/deliver.ts","add":24,"del":6,"lines":[{"text":"for (let attempt = 1; ; attempt++) {","tone":"ctx"},{"text":"  await send(endpoint, event);","tone":"del"},{"text":"  const res = await send(endpoint, event);","tone":"add"},{"text":"  if (res.ok || attempt === MAX_ATTEMPTS) break;","tone":"add"},{"text":"  await sleep(backoff(attempt));","tone":"add"}]}},"exampleFiles":[{"file":"pull-request","title":"Pull request link in an activity line"},{"file":"changed-file","title":"Changed file with its diff"},{"file":"teammate","title":"Teammate profile"}],"worstCase":[{"name":"Long diff","props":{"triggerLabel":"packages/billing-operations/src/scheduling/weekly/InvoiceScheduleWithBillingWindows.tsx","title":"packages/billing-operations/src/scheduling/weekly/InvoiceScheduleWithBillingWindows.tsx","add":12480,"del":1,"lines":[{"text":"export const veryLongIdentifierThatDoesNotFitAnywhereOnOneLineOfThePreview = computeBillingWindowsForEveryPlan(week, { first: \"annual\" });","tone":"add"},{"text":"x","tone":"del"},{"text":"","tone":"ctx"},{"text":"// النكهات الموسمية","tone":"ctx"}]}},{"name":"No header","props":{"triggerLabel":"J"},"text":"Jo"}],"anatomy":[{"part":"root","element":"div","description":"Layout-neutral hook around the trigger (display: contents)"},{"part":"trigger","element":"button","description":"data-state=open|closed. The default trigger is a small mono chip. A label that is a path or a file name is cut in the middle while it does not fit (\"packages/…/Billing.tsx\": the file name stays), with the full text in title and aria-label while cut; any other label keeps its end ellipsis."},{"part":"positioner","element":"div","description":"Placed by the engine; rendered in a portal. Exposes --transform-origin and --available-height"},{"part":"content","element":"div","description":"The surface: the shared popup surface (`lib/popup.ts`: shadow.raised, motion, keyboard-instant; stacking from base.css); data-state=open|closed. Keeps its 288px width, no padding of its own (the sections pad themselves) and a 420px limit (--popup-max-height)."},{"part":"header","element":"div","optional":true},{"part":"title","element":"span","optional":true},{"part":"meta","element":"span","optional":true},{"part":"add","element":"span","optional":true},{"part":"del","element":"span","optional":true},{"part":"lines","element":"div","optional":true},{"part":"line","element":"div","optional":true,"repeat":true,"description":"data-tone=add|del|ctx"},{"part":"sign","element":"span","optional":true},{"part":"text","element":"span","optional":true},{"part":"body","element":"div","optional":true}],"slots":{"default":"Body content","trigger":"Your own trigger element (React `trigger` prop, Vue `trigger` slot, Svelte `trigger` snippet that spreads the props it receives)"},"events":{"openChange":"(open: boolean)"},"states":["open","hover","press","focus-visible"],"tokens":["color.surface","color.ink","color.ink-2","color.hover","color.line","color.green","color.green-tint","color.red","color.red-tint","shadow.btn","radius.chip","font.mono","text.2xs","duration.fast","duration.press","easing.out-strong","motion.press-scale"],"a11y":{"keyboard":["Focus on the trigger opens the card; blur closes it","Escape closes it","The card is a preview: anything essential in it must also be reachable another way"],"notes":["Not shown on touch.","Opening from keyboard focus is instant."]},"motion":["surface: the shared popup recipe (`popup`): opacity + scale from motion.popup-scale out of the trigger, duration.popup, easing.out-strong; closes at duration.fast; instant from the keyboard","default trigger: colour over duration.fast, press scale over duration.press","mounted open (defaultOpen, or open at mount): the surface is drawn at once, with no entrance (data-mounted-open until it first closes); its close, and every later open, animate as above"]}