Files
magpie/internal/gui/assets/plugins/usage
yetone 2e1c0a377b usage: a single-account card folds to its figures, and folded cards are one size (PILIHU2023 on X)
PILIHU2023 asked for a fold on each Usage → Overview card that leaves
only the usage, with the cards all one height and width.

- A card with one account (or one key) and figures to show (windows or a
  balance) now has a disclosure chevron at the end of its head, before
  its ⋯. It reuses the per-account fold (usageAcctFold, usageAccts in
  localStorage), so its state is kept across restarts and its titles
  are the existing ones. Folded, the card keeps its windows' names,
  bars and figures. It drops resets, curves, history, the reading line
  and the auto-reset and credits rows. A plan-only card (OpenCode Zen
  Free) has nothing to fold and gets no chevron.
- Cards with several accounts keep their own folds: each account's
  chevron, and the All N accounts strip's.
- Folded cards are packed to one height: the tallest folded single
  card. A card of several accounts, each in brief, takes whole rows of
  that height. A fully folded page is a grid of one width and one
  height. Open cards keep their natural height, so nothing is stretched
  or clipped (jen_celeus, #860).
- app.js was at its budget with no room. The Usage packing block
  (packUsage and its helpers, about 3.8KB of code) moved from app.js to
  plugins/usage/page.js, which already holds the Usage page's card
  menus. app.js code is now about 3.2KB under its budget. No budget was
  raised.
- The chevron's turn uses --ease-out (cubic-bezier(.23, 1, .32, 1)),
  .15s.

What was run:
- New usage-card-fold.test.cjs: Chromium and WebKit × en, zh, zh-TW,
  ja, de, at 1400, 900 and 400px and after a reload. It folds every
  card and checks they are one width and one height, sit on whole rows
  and don't overlap. It then unfolds two cards and checks they are
  their own height again. Red on origin/main 96d1b93b2 (0 of 1 in
  chromium-en), 10 of 10 on this change.
- usage-fold (one-account case updated), usage-pack, usage-card-fold,
  i18n-keys and go test -run Budget ./internal/gui, on mica after the
  rebase on 45185710e. Everything passed except four usage-fold
  subtests. Those four ('17 subscriptions and 29 accounts' in
  chromium and webkit, 'several accounts…' in webkit en and zh) fail
  the same way alone at origin/main 96d1b93b2. Noted on #6003.
- The first version gave a plan-only card a chevron. That wrapped Zen's
  head at 897px and turned usage-pack's "head's height" check red,
  which is why the windows-or-balance condition was added.
- A 175-file GUI run (the usage-related files and i18n-keys) on mica,
  before the plan-only fix. Only account-eye was red: "a Usage card's
  eye" in Chromium. Eight parallel runs on mote give 1–3 reds each at
  origin/main too, all at the same line. Noted on #5052.
- go test ./internal/gui: ok, before the rebase.

Not tried: the real app (WebKitGTK on Linux, WebView2 on Windows) and
real accounts. Only test fixtures were used.
2026-11-15 14:04:13 +08:00
..