An AccountMenu item or group may carry shown: "always" | "narrow"
(default "always"), and extra has the same choice as extraShown. A narrow
row is in the menu below 768px only: hidden by the package stylesheet in a
media query (no width read in script, right on the server render and the
first paint), skipped by the arrow keys, and a hidden group takes its
divider with it.
For a row that repeats a control the header carries from md up, such as
OrangeCat's theme toggle, which its menu also showed as "Appearance".
Claude-Session: https://claude.ai/code/session_019MDtmvT2nQyPBK4EfWf3Rn
Co-authored-by: Claude <noreply@anthropic.com>
An account in accounts may carry waiting, a count of what waits there
(unread messages, notifications). It is shown at the end of that account's
row, capped at 99+, and as a dot beside the trigger, so a person knows
before opening the menu. The trigger's accessible name says so too.
- Zero, absent or not a positive number shows nothing; so does a count with
no onSwitchAccount, because there is nowhere to go.
- The dot sits beside the trigger, not in it: the trigger clips to keep a
photo round and would clip the dot with it.
- The count and the dot are the text colour inverted, not the accent, which
the fleet keeps for Bitcoin and for the action that brings someone in.
- A long name truncates before the count instead of pushing it off the row.
Claude-Session: https://claude.ai/code/session_019MDtmubu4vMeqp2pdae1Zy
Co-authored-by: Claude <noreply@anthropic.com>
One person can hold several accounts: OrangeCat's identities are the first
case. The other accounts are listed under who is signed in, and a tap
switches.
- New optional props accounts ({ id, user, note? }) and onSwitchAccount(id).
A row is a face (photo, initials from the name, or a glyph), the name, and
one line with the note and the handle. The note leads so it survives a long
handle; another account's email is never shown.
- Same failure contract as sign-out: the row says it is switching, and a
switch that rejects keeps the menu open and says it did not complete.
- The rows are menu items, so arrows, Home and End reach them.
- Without the new props the menu renders exactly as before.
Browser suite: listed under a heading, 44px rows, a long name and handle
keep the panel on a 390px and a 320px screen, keyboard reach, a failed
switch, a completed one.
Claude-Session: https://claude.ai/code/session_019MDtmubu4vMeqp2pdae1Zy
Co-authored-by: Claude <noreply@anthropic.com>
Nine apps hand-rolled OrangeCat OIDC; this is the best of each:
- provider for Auth.js v5 and next-auth v4: client_secret_post, pkce+state,
identity scopes; profile() without email (contactEmail as data)
- syncOcSession (heidi/solon refresh): invalid_grant ends the session,
anything else retries in 60 s
- authorizationParams / returnPath (solon)
- placeholder email, withOrangecatIdentity adapter wrapper and
resolveOrangecatUser (petvity, surf-your-life, datacat race),
decideOrangecatSignIn + link token (evig), emailEarnsPromotion,
mayReceivePasswordReset
- SignInError: Try again restarts sign-in
Contract tests mutated: basic auth, dropped pkce, email in profile,
ignored invalid_grant, kept actorId, reused taken email, admin promotion,
reset for OC-only — each turns the suite red.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Each product wrote its own account menu, and each learned half of what
the other had:
Loki AccountMenu OrangeCat UserProfileDropdown
initials from the name only never rebuilds a name from the email
custom rows (Appearance) photo with a fallback, arrow keys
36px trigger 44px trigger
name falls back to the —
email local-part
and Loki's public pages had no menu at all, so a signed-in person could
not find sign-out (loki#870 papered over that by reusing the app's menu).
This is the one menu with both halves. It knows nothing about how a
product signs people in — NextAuth, Supabase, better-auth all pass the
person, the places, and a sign-out function — and keeps routing with a
renderLink seam (Next <Link>; a plain <a> by default).
Shared and not configurable, because each shipped broken somewhere:
- the name is never built from the email (OrangeCat's rule; Loki broke it)
- initials only from the name; else a person glyph
- a broken photo falls back to initials
- 44px trigger and rows; the panel never runs off a 390px screen
- Escape closes and returns focus wherever focus was
- sign-out says it is happening, and says when it FAILED (menu stays open)
The real-browser check caught a bug before release: Escape did nothing
after a MOUSE open, because the handler sat on the panel and focus was
on the trigger. It is now a document listener while open.
Styled from @bitbaum/design-tokens through --acct-* variables at zero
specificity (chatkit's pattern), so an app's own :root wins and an OKLCH
app maps its tokens once.
dist/ is committed so `github:bitbaum/accountkit#v0.1.0` installs with no
build and no allowBuilds entry; CI fails if it drifts from the source.
verify: format, lint, types, build, 13 unit+render tests, browser checks
at 390px light and dark. Proved by mutation — letting the name fall back
to the email local-part fails "a name is NEVER reconstructed from the
email address".
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>