Files
accountkit/package.json
T
CatoandClaude Opus 5.5 54dc11cf47 feat: one account menu for every product (v0.1.0) (#1)
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>
2026-10-02 05:45:04 -07:00

77 lines
2.1 KiB
JSON

{
"name": "@bitbaum/accountkit",
"version": "0.1.0",
"description": "One account menu for every bitbaum product: who is signed in, where to go, how to sign out. Sign-in library agnostic; styled from @bitbaum/design-tokens.",
"license": "MIT",
"author": "Cato",
"homepage": "https://github.com/bitbaum/accountkit#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/bitbaum/accountkit.git"
},
"bugs": {
"url": "https://github.com/bitbaum/accountkit/issues"
},
"keywords": [
"account-menu",
"avatar",
"sign-out",
"react",
"headless-auth"
],
"type": "module",
"sideEffects": [
"*.css"
],
"packageManager": "pnpm@11.25.0",
"engines": {
"node": ">=20"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"files": [
"dist",
"styles.css"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./styles.css": "./styles.css"
},
"peerDependencies": {
"react": ">=18"
},
"scripts": {
"build": "rm -rf dist && tsc -p tsconfig.json",
"lint": "eslint .",
"typecheck": "tsc -p tsconfig.json --noEmit",
"test": "node --test test/*.test.js",
"check:dist": "git diff --exit-code --stat -- dist",
"verify": "pnpm run format:check && pnpm run lint && pnpm run typecheck && pnpm run build && pnpm test && pnpm run test:browser",
"format": "prettier --write .",
"format:check": "prettier --check .",
"demo": "esbuild demo/demo.tsx --bundle --jsx=automatic --format=iife --define:process.env.NODE_ENV='\"production\"' --outfile=demo/dist/demo.js --log-level=warning",
"test:browser": "pnpm run demo && node test/browser.mjs"
},
"devDependencies": {
"@bitbaum/design-tokens": "^1.1.0",
"@eslint/js": "^10.0.1",
"@types/node": "^26.4.0",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.3",
"esbuild": "^0.28.2",
"eslint": "^10.9.1",
"globals": "^17.11.0",
"playwright": "1.63.0",
"prettier": "^3.9.6",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"typescript": "^6.0.3",
"typescript-eslint": "^8.68.0"
}
}