e9e6b4472e
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
100 lines
5.2 KiB
Markdown
100 lines
5.2 KiB
Markdown
# Notebook design
|
|
|
|
A notebook IDE look (Settings > Design > Notebook, id `notebook`): the chat
|
|
as numbered Jupyter-style In/Out cells with tool calls as collapsible
|
|
sub-cells, a white page (neutral charcoal in dark), light grey cells,
|
|
hairline borders, 5px corners, the device's interface sans for chrome and
|
|
the bundled RobotoMono for code, tool sub-cells and gutter labels.
|
|
|
|
## Tokens and modes
|
|
|
|
`notebookTheme()` (`lib/ui/theme/notebook_theme.dart`, palette and controls
|
|
beside it) sets:
|
|
|
|
- `transcript: TranscriptStyle.cells` (new). Other designs never take it.
|
|
- `composer: ComposerStyle.cell` (new): `composer_cell.dart`.
|
|
- `selectedRow: washed` (left accent bar plus a light fill), `radius: 5`,
|
|
`flat`, `frame: outlineVariant`, `panel`: white (raised grey in dark),
|
|
Notebook ANSI accents, `chatColorSaturation: 0.7`.
|
|
- `reading`: the interface sans at 15/16 of `bodyLarge`, line height 1.5.
|
|
|
|
Both new enum values are additions; every existing design keeps its own
|
|
value, so nothing else changes. Exhaustive switches on `TranscriptStyle`
|
|
gained a `cells` case (bubble, activity view, automated prompt).
|
|
|
|
## The cells transcript
|
|
|
|
`lib/features/chat/ui/transcript/notebook/`:
|
|
|
|
- `notebook_gutter.dart`: `NotebookGutterRow`, a fixed-width gutter (ten
|
|
monospace characters at 0.8 of the reading size, scaled with text, plus an
|
|
8px gap) holding the right-aligned label on the cell's first-line strut, so
|
|
it shares that line's baseline. Below 600px of row width (a phone) the label moves
|
|
inline above the cell. Rows that are not cells (shell runs, notices,
|
|
activity groups) get an empty gutter (`chat_thread_view.dart`), and a
|
|
`NotebookGutterScope` stops nested rows indenting twice.
|
|
- `notebook_input_cell.dart`: the operator's `In [n]:` cell (cell grey, 7%
|
|
of the chat colour, 3px bar in the chat colour, else the accent); the
|
|
scheduled cell for follow-ups, auto-continues (tag `scheduled`) and account
|
|
switches (tag `switched`) with an outline bar; `NotebookTag`.
|
|
- `notebook_tool_cells.dart` / `notebook_tool_cell.dart`: each tool call a
|
|
sub-cell: chevron, bold name and dim arguments, duration and a status icon
|
|
on the right (painted `NotebookGlyph`s, not Icons); collapsed it previews
|
|
the output's first line with "+N lines" at that line's end; the header
|
|
expands it in place (input and up to 400 output
|
|
lines, built only when open). The latest 8 calls show, earlier ones behind
|
|
"Show N earlier tool calls". The status line under them ("Used 6 tools ·
|
|
1 failed", or the live label and seconds) opens Activity details.
|
|
- `notebook_cell_frame.dart`: one `CustomPainter` per cell (fill, clipped
|
|
leading bar, 1px border), no layers.
|
|
- Sub-cell headers and the status line are a `GestureDetector` with the
|
|
click cursor and a Semantics button, not an `InkWell`: an InkWell per
|
|
sub-cell roughly doubled the elements a tool-heavy row builds and put the
|
|
design over the per-row rebuild budget. Keyboard users reach the same
|
|
content through Activity details; no hover ink on headers.
|
|
|
|
Numbering: `chatCellNumbers()` (`domain/chat_cell_numbers.dart`) numbers
|
|
operator turns from 1 in transcript order and gives each following answer
|
|
its prompt's number. It is derived, not stored, so a reload numbers the same;
|
|
with older history not yet loaded, numbering starts at the oldest loaded
|
|
turn (the server sends no absolute turn index). Queued or unsent prompts read
|
|
`In [ ]:`. A running answer shows `[*]` under its `Out [n]:`. The thread view
|
|
passes the number into `ChatMessageView.cell` (and the row cache's deps),
|
|
only under the cells transcript.
|
|
|
|
Under cells, answers keep their Read aloud/Copy on the footer line (shown on
|
|
hover) rather than the left Copy gutter, so short Out cells keep the
|
|
In/Out rhythm: 6px above an In cell, 3px between In and Out, 6px under an
|
|
Out cell.
|
|
|
|
## Composer
|
|
|
|
`ComposerCell`: `In [ ]:` in the same gutter, the field in a cell-grey frame
|
|
whose border and bar take the chat's accent on focus; a 2px running line at
|
|
its foot while a turn runs. Padding is the pill's 4px edge gap plus 3px, so
|
|
the usage ring (40px send button, 3px gap, following the 5px radius) clears
|
|
the cell's hairline. The send keys are unchanged.
|
|
|
|
## Still default
|
|
|
|
Markdown inside answers (headings, lists, code blocks) uses the standard
|
|
transcript styling in the interface font; chips, permission cards, task
|
|
cards, the chat stack discs and the graph follow the generic flat/radius/
|
|
panel/frame tokens with no Notebook-specific code. Typography is Material's
|
|
apart from semibold, tighter titles.
|
|
|
|
## Perf
|
|
|
|
Widget bench (`test/perf/design_bench_test.dart`): scrollRebuildsPerRow
|
|
about 99 against Default's 83.5 (budget 105.3); layers 8.2/frame, no
|
|
clipPath or saveLayer beyond Default's opacity count. Browser bench
|
|
(`design_bench.mjs --designs notebook`, skwasm CPU): PASS, notebook's
|
|
build/raster means below Default's in every scenario. The per-frame theme
|
|
switch test (`compact_switch_test.dart`) includes Notebook.
|
|
|
|
No `saveLayer`, blur or clip layers: cells paint in one picture each; the
|
|
expanded output is built only when opened; a tool cell memoises its preview
|
|
so a running turn's one-second tick does not resplit outputs. The theme is
|
|
value-equal on rebuild (identity-compared resolvers and indicators cached
|
|
per colour). Run the design budget (tool/perf/README.md) after changes.
|