Components
Code View
BetaCode on its own, with line numbers: a listing, a diff, or an editor.
Details
The code itself, with no frame, to place anywhere: an editor pane, a diff view, the body of a Code Block. A gutter of line numbers as wide as the widest number, then the code in mono at a 20px line height with light syntax colouring (keywords, strings and numbers, function calls), or lines already highlighted elsewhere. A diff shows one gutter, a green / red accent bar, a row tint and word-level add / del highlights. A current line is tinted across the gutter and the code. Long lines wrap (wrap) or the code scrolls sideways under a gutter that stays. Its height is the code's, a fixed height, a cap past which it scrolls, or its container's (fill). Read-only it is plain markup, complete in the first frame and server-rendered, and every line is in the page. editable turns it into a code editor (CodeMirror 6): undo history, find and replace (a compact widget floating over the code), several cursors, folding by indentation. The editor is loaded only then (a dynamic import), so a read-only view never downloads it; its packages are installed with the component all the same. It looks exactly like the listing: same font, line height, gutter, colours, current-line tint and insets. An editable view keeps a 12px fold column after the gutter's hairline, in the listing shown while the editor loads as well, so nothing moves when the editor arrives; a read-only view has none, so turning editable on or off on a live view moves the code by that column.