d2b3eb9b6030d1cb6a2c05fa07cc71b85da69f34
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
54cde7106a |
ui: expand the chat form into a large editor for longer messages (#31973)
* ui: expand the chat form into a large editor for longer messages The chat form expands into a large editor once a message has markdown beyond plain paragraphs or reaches four lines, and a Maximize button in its top-right corner toggles it by hand. The expanded form starts around half the screen height and grows with the text up to the space below the tabs bar, animating its height by mirroring the editor's content height. On a new chat the expanded form keeps the collapsed form's top edge and the greeting only fades out, waiting for a collapse to settle before it fades back in. In a conversation the messages follow the form as it grows, so the latest one stays in view above it. Assisted-by: Claude (Opus 5.5 Medium) * ui: make the expanded chat form a full-screen sheet on phones In the expanded editor Enter adds a line and Cmd/Ctrl+Enter sends. On a phone the expanded form is a full-screen sheet with no corners or border. The page around it and Safari's bars take its colour, and the sidebar's logo button and the working-directory chip step aside while it is open. It moves by relative offsets and a clip on the main thread, so its edges, text, actions and chip stay in step in every engine, and its content keeps the collapsed card's places and widths, so nothing reflows when it settles. Expanding does not focus the editor on a phone. On a new chat on desktop the form is lifted by its sticky bottom offset instead of a translate, and the expanded size is built on the collapsed card's real height, so its top edge holds still through any sequence of quick toggles. Assisted-by: Claude (Opus 5.5 Medium) * ui: hide the phone menu toggle and the sheet's focus edge while expanded On a phone the menu toggle rides on the page, above the chat form: it now fades out while the expanded form covers the screen, and comes back when it collapses. The expanded sheet also drops the glass rim and inner ring, so focusing the editor no longer outlines the whole screen. Assisted-by: Claude (Opus 5.5 Medium) * ui: keep the expanded phone sheet clear of the status bar The expanded chat form fills the screen on a phone, under the status bar an installed app draws over the page. Its text now starts below the bar (pt-safe) and its collapse button sits below it too (top-safe-2.5). Assisted-by: Claude (Opus 5.5 Medium) * ui: hide the phone's context gauge while the chat form is expanded The gauge pinned to the phone's top right sat over the expanded sheet's collapse key. Like the menu toggle across from it, it now fades out while the expanded form covers the screen and comes back when it collapses. Assisted-by: Claude (Opus 5.5 Medium) * ui: lift the expanded phone sheet's actions above the iOS keyboard Assisted-by: Claude (Opus 5.5 Medium) * ui: move the chat form with a short, quick drift, without sliding after it lands Its position transition came back on before the browser had laid out the new position, so it slid the form there after the fade; the drift is now 10px each way and quicker. Assisted-by: Claude (Opus 5.5 Medium) * ui: style the expanded chat form with master's surfaces until the design system lands Assisted-by: Claude (Opus 5.5 Medium) * ui: tighten the expanding chat form after review - Expand on markdown only in finished lines: a lone `-`, `#` or `1.` on the line being typed no longer opens the large editor. - Show "Cmd/Ctrl+Enter to send" by the send button while expanded. - Move the expansion state, the phone sheet and the held collapsed height into useChatFormExpansion, and the sheet's geometry into pure functions. - Drop the working-directory chip's phone animation, which never ran since the phone chip moved to the + menu. - Clearing or sending mid-move cancels the sheet's animation. - A click only continues at the end of the text when it lands below it. - Reuse ActionIcon for the toggle and INPUT_CLASSES for the card, derive the centered form's offset from its drop, name the shared easing and fade. - The greeting owns its fade behind the expanded form. - MarkdownEditor's view is reactive, so following its content starts once it exists. Assisted-by: Claude (Fable 5.2) * ui: keep the expanded chat form to the message being written - The form expands on its own only for what is written or pasted, and another conversation starts collapsed: a restored draft no longer opens the large editor, or the phone sheet, on arriving at a chat. - In the expanded editor the pickers open by the line being written, above it or, short of room, below, instead of above the form's top edge. - The sidebar's swipe is off while the phone sheet covers the screen. - The send hint shows only beside the send button, where the row has room. - The inner area keeps master's focus shadow, except on the phone sheet. - The card and the form's position honour reduced motion. - The phone greeting's place accounts for the wrapper it is counted from. - The sheet's animation tolerates the form going away mid-move. Assisted-by: Claude (Fable 5.2) * ui: turn the typed pickers off on phones, and scroll long messages - On a phone, typing `/` or `@` opens no picker for now: each mobile browser moves the page its own way as the keyboard opens, so a list by the form can not stay clear of the text being written. A note marks it for later. - The editor scrolls inside the form again: MarkdownEditor's own box sat between the input and the editor without taking its height, so a message longer than the form ran under the actions instead of scrolling. Assisted-by: Claude (Fable 5.2) * ui: settle the expanding chat form's review findings - A phone expands the form only by hand: the sheet switching in mid-typing moves the text under the keyboard. - The typed pickers are off wherever a finger is the main pointer, not below a viewport width, so a narrow desktop window keeps them and an iPad loses them. The prompt picker opened from the + menu floats by the sheet's actions on a phone. - A message put back after a failed send expands the form again. - Only the left button moves the caret from a click below the text. - The sheet's fill is one token, used by the sheet, the page and Safari's bars. - The collapsed-height hold is its own module and no longer finds the editor's elements by class name. - Shorter comments. Assisted-by: Claude (Sonnet 5.5) * ui: keep a one-line message on the chat form's actions row On a desktop the main chat form is a single pill while its message is one line: the add button, the text, then the model selector and send. A second line, or a line that wraps beside the actions, brings back the two rows, and they stay until the text is shorter than where it wrapped, so the wider row can not flip it straight back. The editor stays mounted: the actions join the text's row by CSS alone. The single row's corners are `--chat-form-single-row-radius` in app.css, a pill by default; the "Scrapbook / ChatForm single row" story shows the real form with other radii. Assisted-by: Claude (Opus 5.5) * ui: give the one-line chat form 1.25rem corners Assisted-by: Claude (Opus 5.5) * ui: pick the working directory from the + menu on desktop too The chip under the chat form is gone: the + menu offers the working directory everywhere but a phone's chat, whose header shows it. The menu item names the directory once one is set, and the picker gains a row to clear it, which the chip's X used to do. Assisted-by: Claude (Opus 5.5) * ui: put the single-row chat form behind a Display setting "Single-row chat form for short messages", on by default. Assisted-by: Claude (Opus 5.5) * ui: send the chat form on Enter, and add a line with Shift or Ctrl/Cmd Enter sends wherever the caret is, the expanded editor and code blocks included; Shift+Enter and Ctrl/Cmd+Enter add a line, continuing lists and quotes. With "Send message on Enter" off the two swap as before. The expanded editor's send hint and the code-block rule are gone with it. Assisted-by: Claude (Opus 5.5) * ui: start the chat form on the row layout it will settle on Assisted-by: Claude (Opus 5.5) * ui: show a set working directory under the chat form again On desktop the chip under the form is back once a directory is set, and the + menu offers the directory only until then. Assisted-by: Claude (Opus 5.5) * ui: add a line on Enter with an on-screen keyboard A phone's Return has no Shift, so on a touch screen Enter adds a line and the send button sends, as "Send message on Enter" turned off does; on a desktop Enter still sends. Assisted-by: Claude (Opus 5.5) |
||
|
|
ac007054e7 |
ui: use a live-preview markdown editor for the chat form input (#31955)
* ui: use a live-preview markdown editor for the chat form input Replace the contenteditable rich input with a CodeMirror editor that shows the markdown source of the block being edited and renders every other block through the MarkdownContent pipeline and stylesheet, so they match chat messages. Plain text types exactly as before, the value stays the exact markdown source, and mention links show as atomic badges. The editor lives in a shared MarkdownEditor component, and the highlight.js theme loader is shared between MarkdownContent and SyntaxHighlightedCode. The old rich input, its tokenizer, source history and their tests go away. Assisted-by: Claude (Opus 5.5 Medium) * ui: give the production build more memory, note what mdsvex is for The single-bundle build now includes CodeMirror and runs past Node's default heap limit on CI runners. Raise it in the build script, so local and CI builds behave the same on every platform. Assisted-by: Claude (Opus 5.5 Medium) * ui: keep the live preview's blocks while only the cursor moves Moving the cursor re-walked the syntax tree and rebuilt every block's decoration. Keep the blocks with the decorations and rebuild only when the text changes or the cursor enters another block. Assisted-by: Claude (Opus 5.5 Medium) * ui: point the chat form story at the editor and drop the engraved placeholder until the design system lands Assisted-by: Claude (Opus 5.5 Medium) * ui: name the markdown editor for screen readers CodeMirror's content is a textbox with no name of its own, so the chat form input was announced as an unnamed text box, and could not be found by its name as the old input could. It takes an aria-label, its placeholder by default, which makes the chat form's "Type a message..." again. Assisted-by: Claude (Opus 5.5 Medium) * ui: format the chat form input's classes Assisted-by: Claude (Opus 5.5 Medium) * ui: share the markdown styles and diagram drawing between messages and the editor The editor and MarkdownContent each @imported markdown-content.css into their own <style>, so the bundle carried two scoped copies of it. Both now render into a MarkdownSurface, the one element that carries the stylesheet; the few rules for MarkdownContent's own template elements are global under .markdown-content. Drawing mermaid and svg blocks and the actions of their header buttons move to markdown-diagrams.ts, so the editor's rendered blocks can draw diagrams the same way messages do. Assisted-by: Claude (Opus 5.5 Medium) * ui: harden the live preview editor after review - onChange skips only the editor's own syncs from `value`, marked by an annotation, instead of reporting only edits that carry a user event - Enter and the mention badges ask the syntax tree whether they are in code, so ~~~ fences and indented code count, and a closing fence ends a block - a picked mention is one undoable edit, through replaceText - rendered blocks draw mermaid and svg diagrams with their header buttons, a $$ math block with blank lines renders as one block, and a link reference definition stays raw instead of rendering to nothing - rendered blocks render again when the mention path settings change - a drag in a rendered block selects its text and copy takes it, across blocks; a click still opens the block - the block margins are the ones a chat message renders (each heading is a first child there), checked by a test; the blank lines after a raw block are its gap - the tree comes from syntaxTree, without forcing a full parse on every edit - placeholder, label, extensions, mention widgets and render key follow prop changes after mount, through compartments - the editor uses the markdown language alone, which drops the html, css and javascript parsers markdown() pulls in for html tag completion (-70 KB gzip) Assisted-by: Claude (Opus 5.5 Medium) * ui: pin the CodeMirror packages and set the build heap in .npmrc The new dependencies are pinned like the rest of package.json. The build heap moves from a node call on vite's bin path to npm's node-options, so the build script is plain `vite build` again and the setting reaches it on every platform. Assisted-by: Claude (Opus 5.5 Medium) * ui: update the live preview block by block and estimate block heights An edit used to build every block's decorations and widgets again, which the editor then compared one by one. The previous decorations, and the mention badges of raw blocks, now move through the edit, and only the blocks whose range, text, raw or rendered state, or gap changed get new ones; the texts of the blocks an edit left alone are reused instead of sliced again. A test drives random edits, cursor moves and focus changes and checks each result against a full build. Rendered blocks report the height they were last measured at, or a guess from their text, so CodeMirror's height map for blocks off screen in a long document stays close and scrolling stays steady. Assisted-by: Claude (Opus 5.5 Medium) * ui: skip the editor's redundant syncs, reconfigures and theme reloads - syncing `value` compares it with the text the editor last reported or synced, so a keystroke coming back through onChange no longer serializes the document again - the prop effects reconfigure the editor only when a prop changed, not once more right after it is created (which rebuilt the whole preview) - loadHighlightTheme leaves the theme's style element alone while the mode stays, so a message or an editor mounting no longer restyles the whole page Tests check that typing in one block leaves the other rendered blocks without a single DOM mutation, and that mounting reconfigures nothing. Assisted-by: Claude (Opus 5.5 Medium) * ui: simplify the live preview to a plain rebuild in three small modules Rebuilding the decorations of every block on an edit measures the same as patching only the changed ones (0.09 ms against 0.11 ms per keystroke at 200 blocks, 0.9 ms against 1.1 ms at 2000), and equal widgets keep their DOM either way, so the incremental update and its test go. - markdown-blocks.ts collects the document's blocks, markdown-block-widget.ts renders one, markdown-live-preview.ts decides which ones show raw text - one bounded cache holds a block's HTML and its measured height - the render key is a plain option: a new one reconfigures the preview, which keeps the editor's focus - MarkdownEditor follows its props with one helper instead of five effects Assisted-by: Claude (Opus 5.5 Medium) * ui: keep setext headings raw in the live preview editor `test` over `---` is a setext heading, so the preview rendered it as an h2 and the underline vanished once the cursor left the block. The editor now shows a setext heading's text as typed at all times, like a link reference definition. Assisted-by: Claude (Opus 5.5 Medium) * ui: add a setting to turn the live markdown preview off "Live markdown preview in the message input" (General) is on by default. Off, the input shows the plain markdown text, with file mention badges still in place; switching it takes effect without a reload. Assisted-by: Claude (Opus 5.5 Medium) |