Changeset 0.37.8 (#220)

Co-authored-by: gobha <jasafpro@gmail.com>
Co-committed-by: gobha <jasafpro@gmail.com>
This commit is contained in:
2026-03-21 18:50:04 +00:00
committed by xcaliber
parent b6152fbf5e
commit 2695bb3bdc
18 changed files with 1151 additions and 299 deletions

379
src/css/sw-chat-pane.css Normal file
View File

@@ -0,0 +1,379 @@
/* ==========================================
Chat Switchboard — Preact ChatPane Kit CSS
==========================================
v0.37.8: Styles for the composable ChatPane kit.
sw- prefixed, no conflicts with legacy chat-pane.css.
========================================== */
/* ── Container ─────────────────────────────── */
.sw-chat-pane {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
background: var(--bg, #0e0e10);
}
/* ── Header Bar (standalone mode) ──────────── */
.sw-chat-pane__header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
padding: 6px 10px;
border-bottom: 1px solid var(--border, #2a2a2e);
background: var(--bg-secondary, #151517);
flex-shrink: 0;
min-height: 36px;
}
.sw-chat-pane__header-left {
display: flex;
align-items: center;
gap: 4px;
flex: 1;
min-width: 0;
}
.sw-chat-pane__header-right {
display: flex;
align-items: center;
gap: 4px;
flex-shrink: 0;
}
/* ── Chat History Select ──────────────────── */
.sw-chat-history__select {
flex: 1;
min-width: 0;
background: var(--bg, #0e0e10);
border: 1px solid var(--border, #2a2a2e);
border-radius: 4px;
color: var(--text, #eee);
font-size: 11px;
font-family: inherit;
padding: 4px 6px;
cursor: pointer;
overflow: hidden;
text-overflow: ellipsis;
}
.sw-chat-history__select:focus {
border-color: var(--accent, #b38a4e);
outline: none;
}
.sw-chat-history__new-btn {
display: flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
background: none;
border: 1px solid var(--border, #2a2a2e);
border-radius: 4px;
color: var(--text-2, #999);
cursor: pointer;
flex-shrink: 0;
transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.sw-chat-history__new-btn:hover {
color: var(--accent, #b38a4e);
border-color: var(--accent, #b38a4e);
background: var(--accent-dim, rgba(179, 138, 78, 0.1));
}
/* ── Model Selector ───────────────────────── */
.sw-model-selector__select {
background: var(--bg, #0e0e10);
border: 1px solid var(--border, #2a2a2e);
border-radius: 4px;
color: var(--text-2, #999);
font-size: 11px;
font-family: inherit;
padding: 4px 6px;
cursor: pointer;
max-width: 140px;
overflow: hidden;
text-overflow: ellipsis;
}
.sw-model-selector__select:focus {
border-color: var(--accent, #b38a4e);
outline: none;
color: var(--text, #eee);
}
/* ── Messages Area ─────────────────────────── */
.sw-chat-pane__messages {
flex: 1;
overflow-y: auto;
scroll-behavior: smooth;
padding: 12px 0;
min-height: 0;
}
/* ── Message Bubbles ───────────────────────── */
.sw-chat-msg {
padding: 8px 16px;
font-size: var(--msg-font, 14px);
line-height: 1.65;
color: var(--text, #eee);
}
.sw-chat-msg + .sw-chat-msg {
margin-top: 2px;
}
/* User messages — right-aligned bubble */
.sw-chat-msg--user {
display: flex;
justify-content: flex-end;
padding: 8px 16px;
}
.sw-chat-msg--user .sw-chat-msg__content {
background: var(--accent-dim, rgba(179, 138, 78, 0.15));
color: var(--text, #eee);
padding: 8px 14px;
border-radius: 12px 12px 2px 12px;
max-width: 85%;
word-wrap: break-word;
}
/* Assistant messages — left-aligned */
.sw-chat-msg--assistant {
padding: 8px 16px;
}
.sw-chat-msg--assistant .sw-chat-msg__content {
max-width: 100%;
word-wrap: break-word;
}
/* System/error messages */
.sw-chat-msg--system {
padding: 6px 16px;
font-size: 12px;
}
.sw-chat-msg--system .sw-chat-msg__content {
color: var(--danger, #f44336);
font-size: 12px;
}
/* ── Streaming indicator ───────────────────── */
.sw-chat-msg--streaming .sw-chat-msg__content::after {
content: '';
display: inline-block;
width: 6px;
height: 14px;
background: var(--accent, #b38a4e);
margin-left: 2px;
vertical-align: text-bottom;
animation: sw-cursor-blink 0.8s step-end infinite;
}
@keyframes sw-cursor-blink {
0%, 100% { opacity: 1; }
50% { opacity: 0; }
}
/* ── Typing dots ───────────────────────────── */
.sw-chat-msg--typing {
padding: 8px 16px;
}
.sw-chat-msg--typing .sw-typing-dots {
display: flex;
gap: 4px;
padding: 4px 0;
}
.sw-chat-msg--typing .sw-typing-dots span {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--text-3, #555);
animation: sw-dot-bounce 1.2s ease-in-out infinite;
}
.sw-chat-msg--typing .sw-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.sw-chat-msg--typing .sw-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes sw-dot-bounce {
0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
30% { transform: translateY(-4px); opacity: 1; }
}
/* ── Markdown content ──────────────────────── */
.sw-chat-msg__content p { margin: 0 0 0.5em; }
.sw-chat-msg__content p:last-child { margin-bottom: 0; }
.sw-chat-msg__content pre {
background: var(--bg-secondary, #151517);
border: 1px solid var(--border, #2a2a2e);
border-radius: 6px;
padding: 10px 12px;
overflow-x: auto;
margin: 8px 0;
font-size: 12px;
line-height: 1.5;
font-family: var(--mono, 'SF Mono', monospace);
}
.sw-chat-msg__content code {
background: var(--bg-secondary, #151517);
padding: 1px 5px;
border-radius: 3px;
font-size: 0.88em;
font-family: var(--mono, 'SF Mono', monospace);
}
.sw-chat-msg__content pre code {
background: none;
padding: 0;
border-radius: 0;
font-size: inherit;
}
.sw-chat-msg__content ul, .sw-chat-msg__content ol {
margin: 4px 0;
padding-left: 1.5em;
}
.sw-chat-msg__content blockquote {
border-left: 3px solid var(--accent, #b38a4e);
padding: 4px 12px;
margin: 8px 0;
color: var(--text-2, #999);
}
.sw-chat-msg__content a {
color: var(--accent, #b38a4e);
text-decoration: none;
}
.sw-chat-msg__content a:hover {
text-decoration: underline;
}
.sw-chat-msg__content table {
border-collapse: collapse;
margin: 8px 0;
font-size: 13px;
}
.sw-chat-msg__content th,
.sw-chat-msg__content td {
border: 1px solid var(--border, #2a2a2e);
padding: 4px 8px;
}
.sw-chat-msg__content th {
background: var(--bg-secondary, #151517);
font-weight: 600;
}
/* ── Welcome / Empty State ─────────────────── */
.sw-chat-welcome {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
text-align: center;
padding: 40px 20px;
opacity: 0.6;
}
.sw-chat-welcome__title {
font-size: 15px;
font-weight: 600;
color: var(--text, #eee);
margin: 0 0 6px;
}
.sw-chat-welcome__hint {
font-size: 13px;
color: var(--text-3, #555);
margin: 0;
}
/* ── Input Bar ─────────────────────────────── */
.sw-chat-pane__input-bar {
flex-shrink: 0;
border-top: 1px solid var(--border, #2a2a2e);
background: var(--bg-secondary, #151517);
padding: 8px 12px;
}
.sw-msg-input__wrap {
display: flex;
align-items: flex-end;
gap: 6px;
background: var(--bg, #0e0e10);
border: 1px solid var(--border, #2a2a2e);
border-radius: 8px;
padding: 6px 8px;
transition: border-color 0.15s;
}
.sw-msg-input__wrap:focus-within {
border-color: var(--accent, #b38a4e);
}
.sw-msg-input__textarea {
flex: 1;
min-height: 20px;
max-height: 160px;
width: 100%;
background: transparent;
border: none;
color: var(--text, #eee);
font-size: 13px;
font-family: inherit;
line-height: 1.5;
resize: none;
outline: none;
padding: 0;
}
/* ── Send Button ───────────────────────────── */
.sw-msg-input__send {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
background: none;
border: none;
border-radius: 6px;
color: var(--accent, #b38a4e);
cursor: pointer;
transition: background 0.15s, color 0.15s;
}
.sw-msg-input__send:hover {
background: var(--accent-dim, rgba(179, 138, 78, 0.15));
color: var(--accent-hover, #c9a05e);
}
.sw-msg-input__send:disabled {
opacity: 0.3;
cursor: not-allowed;
}