One bar for every mode: shared Bar, registered modes, one look (#269) #283

Closed
kayg wants to merge 0 commits from issue/269-one-bar into dev
Owner

Closes #269. Built on #280 (#268); merge that first. This branch contains its two commits.

One bar component. @calternal/ui/bar holds three pieces:

  • Bar.svelte is the capsule frame every mode lives in. It's Morph with its glass, blur halo and spring from tokens.css, plus #268's rule that nothing in it takes focus from the text, plus the phone scrim behind sheets.
  • modes.ts (barModes) registers each mode as a small plugin: its role, its label and its component. A new mode, such as multi-select (#212) or a block toolbar (#256), is one register call. The shell doesn't change.
  • pick.ts is #268's rule for which mode shows, in one place, with unit tests. The order is: question, toast, sheet, selection, typing (phone), note tools, tabs.

One look. styles/bar.css holds the rows, pills, tabs, toast and question styles once. Both the app and the mockup import it. The mockup's own copy is gone, and its round 40 px tabs on a phone are now the shared style.

The app. BottomBar.svelte now only builds the state, picks the key and hands the mode a context. The modes are small files in components/bar/: Tabs, Tools, TextBar, BlockBar, Sheet, Toast and Ask. On a phone the question's answer no longer takes focus (#268).

The mockup. Its BottomBar renders through the same Bar with the same classes. It builds (vite build).

How it compares with the mockup. Both already drew the bar with the same Morph and the same --glass-float* and --spring-morph* tokens, so the glass, blur and spring were already identical. The side-by-sides on the issue show that. What differed was duplicated code (two copies of the bar's CSS, three hand-written branches per mode). This PR removes that, so the two can't drift apart again.

Tests:

  • pick.test.ts covers the rule.
  • At 390 and 1440 in Chromium, the bar e2e tests pass: bar-focus, keyboard, day, shortcuts, links, trash, tags, tooltips, and editor apart from the phone tools step (fixed in #280).
  • Known failures, not from this PR: toast-bar's phone "carries on" test fails on dev too; the WebKit toast-bar test hits this machine's stalled WebKit rendering.

🤖 Generated with Claude Code

Closes #269. **Built on #280 (#268); merge that first.** This branch contains its two commits. **One bar component.** `@calternal/ui/bar` holds three pieces: - **`Bar.svelte`** is the capsule frame every mode lives in. It's Morph with its glass, blur halo and spring from `tokens.css`, plus #268's rule that nothing in it takes focus from the text, plus the phone scrim behind sheets. - **`modes.ts` (`barModes`)** registers each mode as a small plugin: its role, its label and its component. A new mode, such as multi-select (#212) or a block toolbar (#256), is one `register` call. The shell doesn't change. - **`pick.ts`** is #268's rule for which mode shows, in one place, with unit tests. The order is: question, toast, sheet, selection, typing (phone), note tools, tabs. **One look.** `styles/bar.css` holds the rows, pills, tabs, toast and question styles once. Both the app and the mockup import it. The mockup's own copy is gone, and its round 40 px tabs on a phone are now the shared style. **The app.** `BottomBar.svelte` now only builds the state, picks the key and hands the mode a context. The modes are small files in `components/bar/`: Tabs, Tools, TextBar, BlockBar, Sheet, Toast and Ask. On a phone the question's answer no longer takes focus (#268). **The mockup.** Its `BottomBar` renders through the same `Bar` with the same classes. It builds (`vite build`). **How it compares with the mockup.** Both already drew the bar with the same `Morph` and the same `--glass-float*` and `--spring-morph*` tokens, so the glass, blur and spring were already identical. The side-by-sides on the issue show that. What differed was duplicated code (two copies of the bar's CSS, three hand-written branches per mode). This PR removes that, so the two can't drift apart again. **Tests:** - `pick.test.ts` covers the rule. - At 390 and 1440 in Chromium, the bar e2e tests pass: bar-focus, keyboard, day, shortcuts, links, trash, tags, tooltips, and editor apart from the phone tools step (fixed in #280). - Known failures, not from this PR: toast-bar's phone "carries on" test fails on dev too; the WebKit toast-bar test hits this machine's stalled WebKit rendering. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Phone: text bar while typing; the bar never takes focus; sheets fit above the keyboard (#268)
Some checks failed
CI / server (pull_request) Successful in 22s
CI / web (pull_request) Failing after 24s
CI / rust (pull_request) Successful in 1m53s
4c15a581b2
- Caret in the text on a phone: the bar is the text bar. The note tools
  (Log, Insert, Style, Info, Source) show when the keyboard is down, or
  blocks are selected.
- Nothing in the bar or its sheets takes focus from the text: presses keep
  focus (pointerdown and mousedown), and actions only refocus the editor if
  it really lost focus. Focusing an already focused editor made iOS move
  its keyboard.
- B, I, S, code and highlight with just a caret start the mark right there.
- Sheets are never taller than what you can see above the bar
  (--sheet-room from the visual viewport).
- e2e/bar-focus: with a faked keyboard, every text-bar button and the
  Style sheet's controls keep focus in the text; the sheet fits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
e2e: on a phone, the note tools are there with the keyboard down (#268)
Some checks failed
CI / web (pull_request) Failing after 36s
CI / server (pull_request) Successful in 53s
CI / rust (pull_request) Successful in 1m33s
541d5bdacd
editor.spec and day.spec put the keyboard down before using the note tools
at phone width; keyboardDown lives in viewport.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
One bar for every mode: shared Bar, registered modes, one look (#269)
Some checks failed
CI / server (pull_request) Successful in 23s
CI / web (pull_request) Failing after 24s
CI / rust (pull_request) Successful in 1m44s
f42f3c59d4
- @calternal/ui/bar: Bar (the capsule frame: Morph with its glass, halo
  and spring, the keep-focus rule from #268, the phone scrim), barModes
  (each mode a registered plugin: role, label, component) and pick.ts
  (#268's rule for which mode shows, unit tested).
- styles/bar.css: the rows, pills, tabs, toast and question styles, once,
  for the app and the mockup (the mockup's pill tabs on a phone).
- The app's modes are small files in components/bar (tabs, note tools, text
  bar, block bar, sheets, toast, ask); BottomBar only picks and hands them a
  context. The mockup's bar is the same Bar with the same styles.
- On a phone the question's answer no longer takes focus (#268).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Author
Owner

Landed in merge train #329.

Landed in merge train #329.
kayg closed this pull request 2026-10-14 17:39:19 +00:00
Some checks failed
CI / server (pull_request) Successful in 23s
CI / web (pull_request) Failing after 24s
CI / rust (pull_request) Successful in 1m44s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!283
No description provided.