Skip to content

Code surface: editor and terminal chrome (ATL-874) - #20

Merged
uzayer merged 2 commits into
mainfrom
ds-874-code-surface
Nov 4, 2026
Merged

uzayer merged 2 commits into
mainfrom
ds-874-code-surface

Conversation

@uzayer

@uzayer uzayer commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

ATL-874: the editor and terminal chrome, copied from desktop (0.4.1) into a new src/components/code-surface/ group, props-only, with a story for each. CodeMirror, xterm, the PTY and the line emulator stay in desktop.

  • Editor: EditorFrame (header band, warning notice row, find-bar slot, status-bar slot), EditorBreadcrumbs (desktop's crumb look, middle folds into one ellipsis), EditorStatusBar, EditorPreview (a static excerpt drawn the way build-cm-theme.ts draws a file: change bars, numbers, folds, active line, selection, matches, bracket, caret), and FindBar (desktop's FileFindBar look, plus the options, replace, and Select all matches).
  • Terminal: TerminalBlock (desktop's BlockCard), TerminalOutput and the memoised TerminalOutputLine, TerminalCommandInput and TerminalStatus, CommandSuggestions (Base UI Popover, non-modal, never takes focus), TerminalStopControl (desktop's phase machine), and TerminalPalette.
  • Helpers in code-surface.ts: pathSegments (fixes the /a/b vs /a/bc/x root bug), collapseSegments, formatDuration (fixes 59,999 ms printing "60s"), highlightRanges, segmentClassName, and the literal SYNTAX_TEXT_CLASS, ANSI_TEXT_CLASS and ANSI_BG_CLASS tables. TerminalSegment takes desktop's AnsiSegment and LinkedRun without a cast.
  • Colour bridges in utilities.css: --color-syntax-*, --color-editor-*, --color-search-match-*, --color-diff-{added,removed}-text and --color-terminal-*, each named after its theme key, as the other roles are.

Where this differs from the issue's spec, and why

  • The location is src/components/code-surface/, not src/components/patterns/code-surface/. storybook:smoke only checks one level under src/components/<group>/, so a nested folder would have gone unchecked. Stories live in stories/components/code-surface/ as the smoke test expects, and CommandSuggestions has a small story of its own for the same reason.
  • CommandInput is exported as TerminalCommandInput, because CommandInput is already the command palette's input in src/ui/command.tsx.
  • Desktop wins on look: sans text-xs breadcrumbs, not mono. TerminalOutput sits on the card in text-secondary-foreground at desktop's 1.4 leading, not on bg-terminal-background. "No results" is muted, not text-error. The suggestions footer is desktop's plain text, not a KbdGroup. The px sizes (260/460px popup, the 29px command row, the 3px change bar, the 2px caret) are desktop's, since the spec's rem steps come out smaller at the 13px root.
  • The command field is a textbox with aria-autocomplete, aria-controls and aria-activedescendant, not role="combobox". ARIA does not allow that role on a <textarea>, and the Storybook axe run fails on it.
  • matchIndex is 0-based (null or unset means no current match).

Upgrade notes (for the next release's README)

  • Code surfaces are new (src/components/code-surface/, all on the root entry): EditorFrame, EditorBreadcrumbs, EditorStatusBar, EditorPreview, FindBar, TerminalBlock, TerminalOutput, TerminalOutputLine, TerminalCommandInput, TerminalStatus, CommandSuggestions, TerminalStopControl and TerminalPalette, plus the helpers and types in code-surface.ts.
  • The syntax, editor, search-match, diff-text and terminal theme keys reach Tailwind under their own names: text-syntax-keyword, bg-editor-selection-background, bg-search-match-background, bg-diff-added-text, text-terminal-ansi-red, and so on. Before this, these were app-owned roles.

Evidence

All gates are green locally on the branch, rebased onto main at #18:

  • typecheck, format:check and theme:check pass.
  • test passes 417 tests. tests/code-surface.test.ts covers the helper tables, expectBridged, the type check, the Unicode and regex-escape cases for highlightRanges, and formatDuration at 999.6. src/components/code-surface/code-surface.test.tsx covers component behaviour: keys, counts, copy timer, collapse, links, memo, the stop phases, and focus kept on suggestion press.
  • build, test:consumer, build-storybook and storybook:smoke pass. Smoke reports 90 component files and 640 stories.
  • test:storybook passes 640 tests with axe, including every new play: FindBar Matches and SelectAll, TerminalBlock Succeeded, Links, SearchHighlight, MemoisedLines and CommandHighlight, CommandInput Suggestions, and TerminalStopControl Ready.
  • I loaded all 50 new stories in Playwright in Atlas dark and light at scale 1 and 1.3. None logged a console error. EditorFrame/Phone and TerminalCommandInput/NarrowStatus have no horizontal overflow at 375px. The screenshots are local, in shots/ATL-874/.

Merge Danger

Low. The change is additive: new exports and new --color-* bridges. No existing component or utility changed, apart from a README table row and the formatter reflowing that table.

  • Consumers' compiled CSS grows a little with the new utilities, but only where a consumer uses them.
  • Left out:
    • Desktop's breadcrumb folder menus, which read the filesystem.
    • The Foundations/Colour terminal specimen. There isn't one to replace, so TerminalPalette has its own story.
    • Adopting TerminalBlock inside the package's ToolCallCard is a follow-up.
  • No desktop counterpart: EditorStatusBar and TerminalStatus are built to the spec, but desktop doesn't render either today (term-git has the data but no UI).

…mbs, EditorStatusBar, EditorPreview, FindBar, TerminalBlock, TerminalOutput, TerminalCommandInput, TerminalStatus, CommandSuggestions, TerminalStopControl, TerminalPalette), the syntax/editor/terminal colour bridges, and their helpers
… its completions without a combobox role (not allowed on a textarea), the completion popup is named, and the scrolling preview takes focus
@uzayer
uzayer merged commit 3674d7d into main Nov 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant