Add composer autocomplete for #roomname (#47 follow-up)

Mirrors the @mention autocomplete exactly -- same trigger-detection
logic (factored into a shared detectTriggerQuery helper, parameterized
on '@' vs '#'), same arrow-key/Enter/Tab/Escape keyboard handling, same
dropdown. Suggests rooms the user belongs to, filtered by name prefix,
showing the room's description as a subtitle when it has one.

MentionAutocomplete.css is renamed to ComposerAutocomplete.css with
generic class names (composer-autocomplete-primary/-secondary instead of
-username/-display-name), now shared by both the mention and room-
reference dropdowns instead of being mention-specific.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-17 19:12:51 -06:00
co-authored by Claude Sonnet 5
parent 12264b4d18
commit 2a84a9c9bd
5 changed files with 141 additions and 27 deletions
@@ -0,0 +1,49 @@
.composer-autocomplete {
position: absolute;
bottom: calc(100% + 8px);
left: 0;
z-index: 31;
width: 240px;
max-height: 220px;
overflow-y: auto;
background: var(--ds-surface);
border: 1px solid var(--ds-border);
border-radius: var(--radius);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
padding: 4px;
display: flex;
flex-direction: column;
gap: 2px;
}
.composer-autocomplete-item {
display: flex;
align-items: baseline;
gap: 6px;
background: transparent;
border: none;
border-radius: 6px;
padding: 6px 8px;
text-align: left;
cursor: pointer;
color: var(--ds-text);
}
.composer-autocomplete-item-active,
.composer-autocomplete-item:hover {
background: var(--ds-surface-2);
}
.composer-autocomplete-primary {
font-size: 0.84rem;
font-weight: 700;
color: var(--ds-accent);
}
.composer-autocomplete-secondary {
font-size: 0.76rem;
color: var(--ds-muted);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}