feat(messaging-ui): rendered Messenger components — the drop-in UI

Turns the SDK from hooks-only into a real UI SDK: <Messenger> (conversation
list + open thread + composer), plus <ConversationList> and <Thread>, all
driven by the existing useConversations/useMessages hooks over the injected
adapter — zero transport imports (boundary intact).

- themeable via --miu-* CSS variables; default theme ships as ./styles.css
- optimistic send, typing indicator, seen ticks, reactions display, unread badges
- render smoke tests (jsdom + MockAdapter): mounts, auto-selects first thread,
  sends a message, switches threads (3 tests) — 48 total green
- tsup: css bundled to dist/styles.css; dts scoped to TS entries

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-21 17:47:30 +05:30
parent c5237a237a
commit 3f1f89dfbe
7 changed files with 433 additions and 2 deletions
+223
View File
@@ -0,0 +1,223 @@
/* Default theme for @insignia/iios-messaging-ui. Everything is driven by CSS variables
scoped to .miu-messenger, so a host restyles by overriding the tokens — no component edits. */
.miu-messenger {
--miu-bg: #0e0e13;
--miu-panel: #16161d;
--miu-panel-2: #1d1d26;
--miu-border: #262631;
--miu-text: #e9e9ef;
--miu-muted: #9a9aa7;
--miu-accent: #fda913;
--miu-accent-text: #1a1206;
--miu-radius: 12px;
display: flex;
height: 100%;
min-height: 0;
color: var(--miu-text);
background: var(--miu-bg);
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
font-size: 14px;
}
.miu-sidebar {
width: 300px;
flex-shrink: 0;
border-right: 1px solid var(--miu-border);
overflow-y: auto;
background: var(--miu-panel);
}
.miu-main {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
}
/* conversation list */
.miu-convlist {
list-style: none;
margin: 0;
padding: 0;
}
.miu-convrow {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
padding: 11px 14px;
border: none;
border-bottom: 1px solid var(--miu-border);
background: transparent;
color: inherit;
text-align: left;
cursor: pointer;
font: inherit;
}
.miu-convrow:hover {
background: var(--miu-panel-2);
}
.miu-convrow.is-active {
background: var(--miu-panel-2);
}
.miu-avatar {
width: 34px;
height: 34px;
flex-shrink: 0;
border-radius: 50%;
display: grid;
place-items: center;
font-size: 12px;
font-weight: 700;
color: var(--miu-accent-text);
background: var(--miu-accent);
}
.miu-convrow-main {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.miu-convrow-title {
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.miu-convrow-preview {
color: var(--miu-muted);
font-size: 12.5px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.miu-badge {
flex-shrink: 0;
min-width: 18px;
height: 18px;
padding: 0 5px;
border-radius: 999px;
display: grid;
place-items: center;
font-size: 11px;
font-weight: 700;
color: var(--miu-accent-text);
background: var(--miu-accent);
}
/* thread */
.miu-thread {
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
}
.miu-messages {
flex: 1;
min-height: 0;
overflow-y: auto;
padding: 16px;
display: flex;
flex-direction: column;
gap: 8px;
}
.miu-msg {
display: flex;
flex-direction: column;
align-items: flex-start;
max-width: 78%;
}
.miu-msg.is-mine {
align-self: flex-end;
align-items: flex-end;
}
.miu-bubble {
padding: 8px 12px;
border-radius: 14px;
border: 1px solid var(--miu-border);
background: var(--miu-panel);
white-space: pre-wrap;
word-break: break-word;
}
.miu-msg.is-mine .miu-bubble {
border: none;
color: var(--miu-accent-text);
background: var(--miu-accent);
}
.miu-msg.is-pending {
opacity: 0.6;
}
.miu-reactions {
display: flex;
gap: 4px;
margin-top: 3px;
}
.miu-reaction {
font-size: 12px;
padding: 1px 7px;
border-radius: 999px;
border: 1px solid var(--miu-border);
background: var(--miu-panel-2);
}
.miu-reaction.is-mine {
border-color: var(--miu-accent);
}
.miu-seen {
font-size: 11px;
color: var(--miu-muted);
margin-top: 2px;
}
.miu-typing {
font-size: 12.5px;
color: var(--miu-muted);
font-style: italic;
}
/* composer */
.miu-composer {
display: flex;
gap: 8px;
padding: 12px;
border-top: 1px solid var(--miu-border);
}
.miu-input {
flex: 1;
padding: 9px 12px;
border-radius: 10px;
border: 1px solid var(--miu-border);
background: var(--miu-panel);
color: var(--miu-text);
font: inherit;
outline: none;
}
.miu-input:focus {
border-color: var(--miu-accent);
}
.miu-send {
padding: 0 16px;
border-radius: 10px;
border: none;
font-weight: 700;
cursor: pointer;
color: var(--miu-accent-text);
background: var(--miu-accent);
}
.miu-send:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* misc */
.miu-empty {
padding: 24px;
color: var(--miu-muted);
text-align: center;
}
.miu-thread-empty {
margin: auto;
}
.miu-error {
color: #f0563f;
}