Files
chatkit/dist/react/Screen.d.ts
T
CatoandClaude Fable 5.1 b37c3d65ce feat(rich): chart blocks in answers, drawn by an injected renderer (0.15) (#28)
"Who produces gallium?" now carries a ranked bar chart, not a list. chatkit
stays dependency-free: it defines the data contract (`ChartBlock`, mirroring
@bitbaum/chartkit's props for line, bars, share, timeline, tiles) and a
renderer slot (`renderers={{ chart }}` on ChatScreen, ChatThread, ChatMessage,
Markdown and RichAnswerBlock); the app injects the drawing.

- Parser: each kind validated field by field (bounded lists, finite numbers,
  safe links). A malformed block is rejected by the parser and degrades to
  its caption and a table of the safe rows; without a renderer, or when one
  returns null, chatkit draws that table itself. A chart is never a blank.
- Instruction: when to draw (ranked 3+ rows -> bars, shares -> share, 3+
  points over time -> line, 3+ dated events -> timeline, 2-4 figures ->
  tiles), figures only from tool results, hrefs copied from the result.
- Copy and Listen read the figures as lines, never the wire JSON.
- Tests: node tests per kind, the fallback and the renderer paths; the
  browser test renders a bars block through a stub renderer and a line block
  through the fallback in demo/screen.html at 320/390/1280, with the
  broken-word scan and no horizontal overflow.


Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-23 11:09:15 +02:00

45 lines
2.1 KiB
TypeScript

import { type ReactNode } from "react";
import { type RichRenderers } from "./renderers.js";
/**
* The chat as the whole screen, the way the ChatGPT and Claude apps lay it
* out: the conversation runs edge to edge and top to bottom, and the controls
* FLOAT over it — a see-through header at the top, the composer at the bottom
* — instead of each taking a strip of the screen away from the reading.
*
* Words scroll under both. They fade out as they pass beneath the header and
* the composer, so the controls stay legible without an opaque bar behind
* them; the last line of an answer always rests above the composer, never
* behind it (the scroller is padded by the measured height of each).
*
* The heights are published as `--ck-top-inset` and `--ck-bottom-inset` on
* the screen, so an app whose thread is its own scroller pads it with them:
*
* .my-thread { padding-block: var(--ck-top-inset) var(--ck-bottom-inset); }
*
* chatkit's own `ChatThread` does that already.
*/
export declare function ChatScreen({ header, composer, footnote, children, fill, className, renderers, }: {
/**
* The app's drawing for chart blocks in every answer on this screen:
* `{ chart: (block) => <Chart … /> }`. Reaches chatkit's thread and
* `Markdown` wherever they render under it; a `renderers` prop on one of
* them overrides it there.
*/
renderers?: RichRenderers;
/** Floats over the top of the conversation. Give its buttons `ck-glass`. */
header?: ReactNode;
/** The composer (and anything that belongs with it: an error, a queue). */
composer: ReactNode;
/** One quiet line under the composer ("Answers can be wrong"). */
footnote?: ReactNode;
/** The conversation: a `ChatThread`, or an app's own scroller. */
children: ReactNode;
/**
* "parent" fills the box the app gives it. "viewport" takes the visual
* viewport — the height that shrinks when the phone keyboard opens, so the
* composer rides on top of the keyboard instead of behind it.
*/
fill?: "parent" | "viewport";
className?: string;
}): import("react").JSX.Element;
//# sourceMappingURL=Screen.d.ts.map