Repository navigation
Conversation
Mention ranges carry the bot peer instead of a resolved hex value, and the span takes the bot-identity class with data-bot-color, so each skin's tuned identity ink colours it and a coloured bubble keeps its own text colour.
A sent mention shows the bot's face and name in its colour, and a click opens that bot's chat. The chip has no fill until hover or keyboard focus. The composer's mirror keeps plain coloured text, since its glyphs must stay under the field's caret.
The face covers the unseen @ glyph, so the field's caret keeps its place. The mirror paints 4px past each side of the field, so a face at the start of a line is not cut off.
The chip's padding only gives the hover fill room, so matching negative margins keep the gap before and after the name the width of a space.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #515
Before this change,
@Namelooked the same for every bot in the composer and in sent messages. Two bots with similar names, or a bot's name used in a sentence, were hard to tell apart.With this change, a mention uses the face and identity colour the bot already has. The same
data-bot-color/--identity-*tokens colour it, and each skin already tunes them for contrast.@Name.@, and the name is in the bot's colour. The textarea is unchanged. The face sits in the mirror layer behind it, over the unseen@glyph, so the caret and selection stay exactly on the text.Screenshots
Desktop, composer (2x):
Desktop, sent message, and on hover over Redline (2x):
Mobile, 390x844 (3x). The composer wraps so two faces start a line. Sent message:
Limitations of the composer face
The composer is a transparent
<textarea>over a mirror div that must keep the same glyph widths. A 16px face is wider than the@it covers, so:say@Juniper) it touches that word.@Nameshows.The proper fix, for discussion
A contenteditable editor (Lexical, Tiptap/ProseMirror, or our own) could make a mention an atomic inline node. It would be a real chip in the field: Backspace removes it whole, it has its own width, and it never overlaps the caret.
I think this is worth discussing before anyone starts it.
Commits
Each commit passes lint and tests on its own:
Verification
pnpm typecheck,pnpm lint, andvitestoversrc/componentsandsrc/lib(972 files, 8730 tests) pass.control-dusk ui launch) with three bots (hoot, boo and mochi bodies; blue, red and purple), I checked at desktop 1280x800 and mobile 390x844:@, including at the start of a wrapped line