mirror of
https://github.com/remorses/gpuix.git
synced 2026-10-28 18:59:22 +08:00
examples/chat.tsx is a full ChatGPT-like app in ~900 lines: sidebar with
grouped history, scrolling transcript, composer, and <markdown>, <code>
and <diff> inside assistant turns. Data is hardcoded.
cd examples && bun run chat
Two details it exists to demonstrate:
Chrome sets userSelect: 'none'. The sidebar, top bar and composer opt
out, so a drag across the transcript selects message text and never a
conversation title. A test asserts both halves.
<diff> needs a bounded viewport, because it virtualizes internally, and
it carries its own borderRadius. GPUI clips a scroll container to its
bounds RECTANGLE, never to a rounded path, so a rounded wrapper with
overflow: hidden still shows square corners underneath.
examples/native-text.tsx is the smaller demo: the three components behind
a tab switcher, with a status line for events.
Screenshots
-----------
Test output lands in gitignored screenshots/ folders and churns on every
run, so only a curated set is committed, under docs/images. They are
regenerated with:
bun scripts/screenshots.ts
which runs the visual tests and copies eight frames through a 256-colour
palette. That is lossless in practice for flat dark UI (no gradients to
band) and cuts the committed size from 976 KB to 352 KB.
The README now opens with the chat app, gains an Examples table, and shows
each native component next to the snippet that produces it.
AGENTS.md records the two rules that were expensive to learn: all text
must go through crate::text (never div().child(String), or it is invisible
to both selection and getPaintedText), and layout numbers belong on
Theme::metrics rather than in Rust constants.