Skip to main content

The window's UI

The rules a change to ui/, window/, packages/ or plugins/*/ui works to: what the window may compute, the tokens, the kit's parts, accessibility and copy. Source of truth: packages/kit/tokens.css and the kit's components; held by ui/src/patterns.test.ts, ui/src/tokens.test.ts, ui/src/reach.test.ts, ui/src/boundaries.test.ts, ui/src/roles.test.ts and ui/src/raw.test.ts. AGENTS.md maps the directories and the window gates. In each table the last column names what holds a rule; "review" means no test does, so a reviewer does.

What the window computes​

RuleHeld by
It draws; the kernel computes: a price, P&L, greek, breakeven, yield, rank or filter result is a wire field (0001). The window keeps layout, axis ticks, scaling, formatting and shown sums. A domain formula in ui/src is a review defect, save a drawing's live in-drag tags. A streaming price's tick cue compares consecutive served lasts on the client: display, not a wire figurereview
A cross-account total is the kernel's totals, Partial (packages/kit/book/AccountFace.tsx) when it leaves an account out; buying power is never summedui/src/accounts/accounts.render.test.tsx
A view change (focus, selection, a toggle) goes through act (packages/plugin/state/act.ts): painted in the cache before posting, rolled back if refused. What must wait for the kernel (an order, the vault, a link) is a bare verbreview
No source reads a provider's own keys (raw off a data row)ui/src/raw.test.ts
A pane's UI imports only its folder, @taji/plugin, the kit and shared dependencies, never another plugin (window half)ui/src/boundaries.test.ts

Scene first​

  1. Add or change a scene in ui/mock/app/scenes.ts.
  2. Run pnpm --filter @taji/ui mock:app and open localhost:7793/app/?scene=<id>.
  3. Build the pane against that scene (ui/src/connections/ for a full-window page).
  4. Check: bash engine/crates/taji/scripts/ui_gate.sh.

Tokens​

SubjectRuleHeld by
ThemeOne dark theme, :root (neutral grey grounds, --up/--down performance). The accent, Buy's colour, is gold, sky, iris or graphite (data-accent); .warm (the gate, the welcome) keeps its own paletteui/src/tokens.test.ts
LiteralsColour, type, radius, duration and shadow are tokens.css tokens, never literals; structural sizes are literalui/src/patterns.test.ts
FontsGeist (--sans) and, for code and keys, Geist Mono (--mono), self-hosted in packages/kit/fonts.css; every number tabular; base 14pxpackages/kit/fonts.test.ts (tabular)
Type--fs-page-* for a surface read at arm's length (the welcome, Connections, any full-window page), --fs-micro to --fs-figure (11px floor) in the shell's chromereview
IconsTwo families, both currentColor: the chrome's lucide-react, 16px, stroke 1.75; the chart's drawing strip, TradingView's 28px and 1.5 stroke for parityreview
ComponentsA component does one job with few controlsreview
Selected fillA selected, current, pressed or checked row never fills with --accent-softui/src/patterns.test.ts
DisabledA disabled control's opacity is .4; the chart's controls (chart/) use .5ui/src/patterns.test.ts
SurfacesNo glass-panel classui/src/patterns.test.ts
ChordsA chord is read from the shortcut table (packages/kit/shell/shortcuts.ts), never written as a modifier glyph, a literal kbd or a literal hint; every row is hinted by a control unless it is marked unhintedui/src/patterns.test.ts
Animationmotion (motion/react), never a hand-rolled spring, easing or tweenui/src/patterns.test.ts (a numeric duration)
TailwindUtilities only, tw:-prefixed, the conversation's assistant-ui kit's alonereview

Parts​

Use the kit's part (liquikit: packages/kit/liquikit/); a hand-rolled twin is a review defect. ui/src/patterns.test.ts greps the title=, ChevronDown and class-string rows and lists the exceptions. A kit part's change handler is onValueChange, its test id eid.

ForUse
Menu, list, popover, dialogpackages/kit/ui/Pop.tsx; a dialog packages/kit/ui/Float.tsx
Confirm, quitAlert (packages/kit/ui/Alert.tsx) on Float, Keep focused
On the phone, a menu of many acts, a form, a confirmPhoneSheet (packages/kit/ui/Sheet.tsx); OrderConfirm (packages/kit/trade/Confirm.tsx) draws one itself
Pick one valueDropdown (packages/kit/ui/Select.tsx), its trigger .select, never ChevronDown
One of two to five wordsSegmented (packages/kit/ui/Segmented.tsx) with usePicked (packages/kit/ui/picked.ts)
A page's sectionsTabBar (packages/kit/ui/TabBar.tsx)
On or offpackages/kit/ui/Switch.tsx
ButtonAct (packages/kit/ui/Act.tsx), variant safe, danger or prominent (at most once per surface), never a class string; or liquikit Button
Icon-only buttonIconAct (packages/kit/ui/IconAct.tsx) with aria-label and data-tip
Tooltip, a disabled act's reasondata-tip (packages/kit/shell/Tip.tsx), not title=
Record tablepackages/kit/table/Table.tsx
A read pending, under the headsp.pending-line with role="status" (packages/kit/base.css), one line
A streaming price's up or down cueTick (packages/kit/ui/Tick.tsx) around its words
An account namedAccountFace (packages/kit/book/AccountFace.tsx): the brokerage's mark, name and tail; AccountShort where the surface says the stage; AccountAt in a confirm; never a tail alone

Accessibility​

RuleHeld by
Pointer focus draws nothing. Keyboard focus is a 3px --focus-ring (the accent at 70%) outline, offset 1px, on the control, never a wrapper (packages/kit/base.css); a field's moves its borderui/src/tokens.test.ts (the ring's contrast)
A role promises its keys: a listbox, tree, grid or menu item moves by arrow keys, or is a button or tableui/src/roles.test.ts
--ink-2 reads at 4.5:1 on the surfaces ui/src/tokens.test.ts lists, and prefers-contrast: more raises each colour it setsui/src/tokens.test.ts
Overlay sentences are at least --fs-ui, in --ink or --ink-2, never --ink-3; --fs-dense only for a one-line caption, quiet act, key hint or a well's mono textui/src/reach.test.ts (the overlay sheets it lists)
prefers-reduced-motion gets the end state, under MotionConfig reducedMotion="user" (packages/plugin/realm.tsx); a tick cue keeps its ink, unfadedreview
prefers-reduced-transparency makes glass solidui/src/reach.test.ts, mock:app:reach
Forced colours drop box-shadows: a shadow-only edge or state gets a system-colour outline; forced-color-adjust: none only on swatchesui/src/patterns.test.ts (the shadow half)
A useSyncExternalStore's subscribe is a module-scope function or a useCallback on its key, never an inline literal, which React resubscribes every renderui/src/patterns.test.ts
On a coarse pointer a target is 44px and 8px from the next (16px beside a commit) and an input 16px or more; useCompact (packages/kit/shell/compact.ts) swaps the frame for the phone's (a touch screen under 700px wide, or a phone on its side no taller than 500px).mock:app:reach (ui/mock/app/reach.ts) on every scene with touch (the targets); review (the input)

Copy​

Say what the user gets in their words, not how Taji is built: "Seal your vault", not "Argon2id". Say "device", never "Mac". One line per idea; cut a sentence that loses nothing. Held by review.

See also​