Commit 286e368
add: chat font-size toggle (small/large) with retro glyph control (PR-27)
The v2.0 hero feature. A two-state toggle at the far right of the
chat status bar — `a` (lowercase, 9px) for small mode, `A`
(uppercase, 13px) for large mode. The active size lights up in
`--accent`, the inactive in `--muted`. Click swaps; Cmd/Ctrl+`+` /
`-` work as keyboard shortcuts independent of browser zoom.
Design choices (per v2.0_plan.md §3.1 + §8 defaults):
- Two states only, not three. The glyph sizes ARE the legend; no
"small / large" labels required.
- Lowercase + uppercase pair (`a A`), matching the existing CRT-ish
glyph vocabulary (▰▰▰ wave, █ blink cursor, [ ... ] brackets).
- Placement: far right of the status bar, AFTER the existing
`[ idle · model · tokens · █ ]` group. The toggle sits OUTSIDE
the bracket pseudo-elements so it reads as a separate control.
- Persistence: `localStorage["tdpilot.fontMode"]`, applied before
`$history.innerHTML = WELCOME_HTML;` so users with a saved 'large'
setting never see a small-text flash on reload.
- Default: `small` (today's behavior). Existing users see no change
unless they opt in.
- Scope: scales `#history` (13px → 17px) + `#input` (13px → 17px)
only. Status bar, buttons, modal headers, badges all stay at
their designed scale so the layout doesn't reflow.
Layout note: adding the toggle as a 3rd flex child of #status-bar
(which uses justify-content: space-between) would push `.rhs` to
the middle. `.rhs` now carries `margin-left: auto` to absorb free
space and keep the right-edge cluster intact. No-op for the
pre-PR-27 2-child layout.
Implementation footprint:
- `td_component/tdpilot_api_chat.html` — +79 LOC across HTML
(button + 2 spans), CSS (~35 LOC of toggle/scaling rules), and
JS (FONT_KEY + applyFontMode() + initial restoration + click
handler + 2 keyboard-shortcut branches in the existing
document-scope shortcuts handler).
- No backend changes, no WS protocol changes, no new deps.
Tests: `tests/test_chat_html_font_toggle.py` — 21 structural
assertions following `tests/test_chat_html_state.py`'s
served-HTML-as-string pattern. Pins the DOM (button + glyphs +
status-bar order), the CSS (scaling rules, active-state colors,
chrome stays fixed, .rhs has margin-left: auto), and the JS
(localStorage namespacing + try/catch guards, restoration order,
click handler logic, both keyboard shortcuts, default-to-small
fallback).
Pytest: 1623 pass / 12 deselected (delta +21 from 1602).
Standalone .tox (`tdpilot_API.tox`) carries the baked v1.10.0 chat
HTML; rebuild on main as a follow-up commit before v2.0 ships,
mirroring the v1.10.0 release pattern (commit 7456eb5). The
freshness gate doesn't track the standalone tox today.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 7e32054 commit 286e368
2 files changed
Lines changed: 369 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
| |||
145 | 149 | | |
146 | 150 | | |
147 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
148 | 188 | | |
149 | 189 | | |
150 | 190 | | |
| |||
670 | 710 | | |
671 | 711 | | |
672 | 712 | | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
673 | 718 | | |
674 | 719 | | |
675 | 720 | | |
| |||
758 | 803 | | |
759 | 804 | | |
760 | 805 | | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
761 | 827 | | |
762 | 828 | | |
763 | 829 | | |
| |||
1822 | 1888 | | |
1823 | 1889 | | |
1824 | 1890 | | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
1825 | 1904 | | |
1826 | 1905 | | |
1827 | 1906 | | |
| |||
0 commit comments