Merge main (Compact design) into Glass

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 23:22:56 +00:00
93 changed files with 4110 additions and 313 deletions
+53
View File
@@ -0,0 +1,53 @@
# Cycling the chat panes on screen
Alt+] and Alt+[ move the keyboard to the next or previous chat pane on screen
(wide layouts only). On macOS and iOS, Cmd+] and Cmd+[ do the same.
## Keys
- Alt+Tab and Cmd+Tab belong to the OS window switcher. Ctrl+Tab already
cycles the open chats, and Alt+` cycles the floating windows.
Alt+Y, Alt+K, Alt+L, Alt+T and Ctrl+B are also taken.
- Browsers use Alt+Left and Alt+Right for back and forward. GNOME, Hyprland,
Windows and browsers do not bind Alt+[ or Alt+]. The web build handles the
key, so Flutter calls `preventDefault`. The capture's keydown recorder shows
this (`prevented: true`).
- On a Mac, Option+] and Option+[ type quotes. With Alt, the shortcut matches
the key's position, as Option+Y does. Cmd+] and Cmd+[ are the macOS
next/previous pair, so Option stays free for typing. On the web, Cmd+[ is
Back, and the app prevents that default.
- The shortcut never matches with Shift (Alt+Shift+[ types a brace), Ctrl or
AltGr. AltGr is how several layouts type brackets.
- A focused terminal (any `TypingSurface`) keeps the keys. Alt+[ is its
escape prefix.
## Behaviour
- Order: the tiled panes in split-tree order, which is visual order (left
before right, top before bottom; the center stage's row in order). Then
come the shown floating chat windows in the order they were opened. The
cycle wraps around. The shortcut never opens, closes, hides or moves a
chat.
- The target's composer takes focus. If nothing in the pane takes focus, a
pane-level focus node takes it. The pane's border flashes in the chat
colour for 700 ms (`ChatPaneFocusFlash`). The flash uses the design's
corner radius. Under reduced motion it shows for the same time without
fading.
- It does nothing in these cases: one pane on screen, a phone layout (the
stack and the quick switcher handle chats there), a popup or another
destination open, or a focused terminal.
- The shortcut is listed in the keyboard shortcuts list (Settings and the
Ctrl+? cheatsheet) as "Next or previous chat pane on screen".
## Evidence
- Tests: `test/features/chat/chat_pane_cycle_test.dart` (three tiles plus a
window, forward, backward and wrapping; two tiles plus a window; no-op
with one pane and on a phone; terminal keeps the keys) and
`test/features/chat/workspace/chat_pane_cycle_test.dart` (key matching,
labels, wrap).
- Capture: `tool/capture/examples/chat-pane-cycle.json` with
`CHROME_PATH=/usr/bin/chromium`, at 1600x900. `chat-pane-cycle/before.png`
shows the left pane focused. `chat-pane-cycle/after-alt-bracket.png` was
taken 120 ms after Alt+]: the right pane (api refactor) is active, its
composer has the caret, and its purple ring is fading.
Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

+94
View File
@@ -0,0 +1,94 @@
# Compact design
Classic's (formerly Default's) Material 3 look, packed tight for a big monitor and long runs and
chats (Settings > Design > Compact). It has the same colours and glass bars
as Default. Type is smaller: body 13px, labels 11-12px, chat reading 14px on a
1.5 line. Spacing sits on a 4px grid. Rows are 36px with one line and about
54px with two. Icons are 18px, avatars 28px, and every corner is 6px.
## Tokens
- `density` (`DesignDensity`, `design_density.dart`; `comfortable` for every
other design). It holds `spacing` (0.6), `iconSize` (18), `avatarSize`
(28), `railWidth` (64), `railLabels` (false) and `titleBarHeight` (32).
- `space(v)` scales a widget's own spacing and snaps it to the 4px grid.
- `inset(v)` does the same for side insets, halfway between: 16 becomes 12.
- `minTouchRow` is 40 on touch devices and 0 on pointer devices.
- `dense` and `pointerPlatform` are also available. All of them return the
input unchanged when the density is comfortable, so other designs keep
their numbers.
- `ReadingType.paragraphGap` is the gap between paragraphs of an answer, in
lines. Default is 0.9; Compact is 0.6.
- `AppDesignTokens.denseCorners(r)` gives the design's radius only under a
dense design. It is for surfaces whose own corners the comfortable designs
keep: floating windows (12), search thumbnails, find bars, run detail
boxes and the search field stadium.
- `AppDesign.dense` and `AppDesign.swatchLines` (the picker preview draws 4
thin lines for Compact).
## Themed surfaces
- `compact_theme.dart`, `compact_controls.dart`, `compact_typography.dart`:
- visual density is `compact`;
- the tap target is `shrinkWrap` on desktop and `padded` (40px) on touch;
- Material 3 icon buttons need their own `visualDensity`, otherwise they
ignore the theme's; they are 32px with a padding of 7;
- buttons, chips, fields, the search bar, list tiles, menus, popups,
dialogs, sheets, snack bars, tooltips, FABs (40px), the rail, the
navigation bar, tabs, badges, the scrollbar, date and time pickers all
take 6px corners and dense paddings;
- cards get a hairline, so `Card.outlined` (graph nodes) keeps its outline.
- `AppListRow` / `AppListAvatar`: dense insets, padding and avatar size, plus
the touch minimum.
- `ShellNavigationRail`: 64px wide, icons only with tooltips. Settings uses
the same 56x32 indicator as the tabs.
- The shell and window host read the rail width through
`navigationRailSpaceOf`.
- Chat:
- the operator bubble has 6px corners and 12/8 padding;
- turn gaps and the paragraph gap are tighter;
- the activity line is 28px (40px on touch);
- turn chips, follow-up and automatic-continue cards are tighter;
- code blocks use 8px insets with monospace at 13/14;
- the composer is a 40px pill, and its field padding is 10 because
density takes 4px off each side.
- Top bars: segmented pieces are 40px (`segmentedPieceHeight(context)`) and
title pill padding is 12. Chat bar text buttons have a 32px minimum.
- Floating windows: a 32px title bar with 16px icons and 6px corners on the
frame, outline and page clip.
- Graph: nodes use 12/8 insets with a 32px minimum height.
`graphMetricsOf(context)` tightens the gaps, lanes and padding.
- Settings: `settingsSectionGapOf` and `settingsRowInsetOf` give 16 and 12,
and the group header, footer and item paddings are dense.
## Live switch
A switch into or out of a dense design does not blend
(`AppDesignController.themeAnimationDuration` is zero). The reason:
`ThemeData.lerp` takes a component theme's unset size as 0, so every icon
(and any text style set in a component theme) passes through size 0. In
skwasm, laying out glyphs at nearly zero size hung the page. This was
bisected with `tool/perf/design_bench.mjs`, and the pause stack showed
`paragraph_layout`.
For the same reason, Compact's component themes set no text styles. Each
component keeps its Material role, which is already at Compact's size.
`test/ui/theme/compact_switch_test.dart` checks every frame of a switch.
Default, Terminal and Paper keep their blend.
## Perf budget changes
- `test/perf/design_bench_test.dart` budgets `scrollRebuildsPerRow`, not
per frame. A denser design shows more rows in each 120px step.
- `design_bench.mjs` gives the chat-switch clicks per-design points
(`compact: [x, y]`), checked with `tool/capture`.
## Still Default
- Sliders and switches keep their size.
- Tab heights are not themeable.
- The walkthrough's bullet dot sits off the baseline in every design.
- The glass bar margins (`kFloatingBarMargin`) and `GlassBarMetrics` (artifact
viewer, chevron pager) keep 48px.
- Fields that set their own `OutlineInputBorder()` keep 4px corners.
+46 -6
View File
@@ -16,17 +16,52 @@ they are saved on the device.
- `flutter_tts_speech_engine.dart`: the `flutter_tts` implementation. The rate
is a multiplier (1.0 = normal); Apple platforms get half of it on their 0..1
scale. Linux reports unsupported, so the button and section are hidden.
- `speech_controller.dart`: the app's single reader (`speechController`, a fake
in tests via `debugSpeechController`). State changes notify the controller;
the spoken word is the separate `word` notifier. Stops on `hidden`, `paused`
or `detached` (not `inactive`, which is only a lost focus).
- `speech_controller.dart`: the reader. State changes notify the controller;
the spoken word is the separate `word` notifier and the reading's
conversation (`SpeechReading`: chat id and name) the `reading` notifier.
Stops on `hidden`, `paused` or `detached` (not `inactive`, which is only a
lost focus): the phone app backgrounded keeps that behaviour.
- `app_speech.dart`: the app's single reader (`speechController`, a fake in
tests via `debugSpeechController`), `speechControllerIfCreated` for code that
only stops or relabels, and `speechReading`, the app-level listenable the
avatars and the global control follow.
- `speech_document.dart`: Markdown to sentences, with each spoken character's
part and source offset. Code blocks (``` and ~~~) are "Code block.", tables
"Table." then cells; rules are skipped.
- `chat_markdown_speech.dart`: highlight spans and the reveal scroll for
`ChatMarkdownView`.
- Reader ids are `<sessionId>/<row id>` so a chat that closes or is swapped
for another stops only its own reply (`stopScope`).
- Reader ids are `<sessionId>/<row id>`; `SpeechOrigin` (put by the thread
view) gives Read aloud the chat id and name when a reading starts.
## Keeps reading across chats
The reader belongs to the app, not the thread view: switching chats or panes,
opening the chat list or another destination keeps the reply reading, and
reopening the chat shows its Pause/Stop again. A reading ends when it is
stopped (the reply's Stop or the global one), finishes, another reply starts,
its chat is closed (`/close`, the row's Close, or a refreshed row closed
elsewhere) or deleted (gone from a successful list read, which includes its
machine being removed), and when the app closes or is backgrounded.
- Indicator: `chatSessionActivityBadge(speaking:)` draws
`ChatSpeakingGlyph` (three animated bars; a still speaker under reduced
motion) in the avatar's bottom-right badge, ahead of the operator wait, the
running spinner and the background-task count. `ChatSessionAvatar` (list,
quick switch, phone chat stack, pane header) and `ChatCompactAvatar`
(compact sidebar) follow `speechReading`.
- Global stop: `ChatSpeakingControl`, "Speaking · <chat>" (or "Paused") with
Stop speaking, sits above the composer of the active pane (`pasteTarget`)
of any chat, so one copy shows whatever the layout. It uses the design's
panel fill, frame and corner tokens.
- Servers: federated chat ids carry their machine, so moving between machines
in the combined list keeps reading. Switching the server profile (native)
remounts `PipelinesApp`, whose dispose stops the reader; on the web a server
switch loads another page, which ends speech.
- Detached windows are separate processes (desktop) or browser windows (web),
each with its own reader: speech belongs to the window that started it,
shows only there, and stops when that window closes.
- Web: the utterance is held by `WebSpeechEngine`, owned by the app reader,
never by a widget.
## Platform notes
@@ -49,7 +84,12 @@ Tests (fake engine): `test/features/chat/speech/`,
`test/features/chat/ui/transcript/chat_read_aloud_button_test.dart`,
`chat_markdown_read_aloud_test.dart`,
`test/features/chat/conversation/chat_thread_read_aloud_test.dart`,
`test/features/chat/ui/sessions/chat_speaking_badge_test.dart`,
`chat_sessions_speech_test.dart`,
`test/features/settings/settings_read_aloud_section_test.dart`.
Captures (`speech=fake`, Terminal and Classic, wide and phone) show the badge
on the reading chat after switching to another one, and the global control.
Not verified on a device: real speech output, word boundaries and voices on
Android, macOS and browsers.