From 0b9e7cbcf64b39af4a96e2e088a4a3e928f5c8ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Sun, 17 May 2026 11:50:39 +0200 Subject: [PATCH] css: extract terminal pane styles to hive-fr0nt::TERMINAL_CSS --- hive-ag3nt/assets/agent.css | 181 +------------------------------- hive-ag3nt/src/web_ui.rs | 3 +- hive-c0re/src/dashboard.rs | 3 +- hive-fr0nt/assets/terminal.css | 182 +++++++++++++++++++++++++++++++++ hive-fr0nt/src/lib.rs | 1 + 5 files changed, 191 insertions(+), 179 deletions(-) create mode 100644 hive-fr0nt/assets/terminal.css diff --git a/hive-ag3nt/assets/agent.css b/hive-ag3nt/assets/agent.css index 9f6781c..ca61c2a 100644 --- a/hive-ag3nt/assets/agent.css +++ b/hive-ag3nt/assets/agent.css @@ -262,39 +262,9 @@ pre.diff { 60% { box-shadow: 0 0 18px -4px currentColor, 0 0 4px 0 currentColor; } 100% { box-shadow: 0 0 0 0 currentColor, 0 0 0 0 currentColor; } } -/* Terminal-ish wrapper holding the live output + prompt input as one - unit. Crust as bg (almost-black), slightly inset, mauve phosphor glow. - Frosted-glass backdrop blur: the page bg behind the wrap gets softened, - so anything that bleeds through (page banner glow, scroll position) - reads as out-of-focus depth instead of sharp competing detail. */ -.terminal-wrap { - position: relative; - background: rgba(17, 17, 27, 0.78); - -webkit-backdrop-filter: blur(8px) saturate(120%); - backdrop-filter: blur(8px) saturate(120%); - border: 1px solid var(--purple-dim); - box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.7); - border-radius: 4px; - font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "Source Code Pro", monospace; - font-size: 0.92em; - color: #cdd6f4; - margin-top: 0.6em; -} -.live.terminal { - background: transparent; - border: 0; - box-shadow: none; - border-radius: 0; - padding: 0.8em 1em 0.4em; - overflow-y: auto; - /* Make the terminal the page's main visual element on tall screens - while staying inside the page chrome on short ones. */ - height: min(72vh, 60em); - max-height: none; - font-family: inherit; - font-size: inherit; - color: inherit; -} +/* `.terminal-wrap`, `.live`, `.live.terminal`, row + pill + details + styling all live in hive-fr0nt::TERMINAL_CSS (prepended by serve_css). + What stays here is the composer chrome that sits inside the wrap. */ .term-input { padding: 0.4em 1em 0.8em; } .term-input .sendform-term { display: flex; @@ -331,147 +301,4 @@ pre.diff { .term-input .submit-hint { color: var(--muted); font-size: 0.8em; flex: 0 0 auto; } .term-input.disabled .prompt { color: var(--muted); text-shadow: none; } .term-input.disabled textarea { color: var(--muted); } -.live { - background: rgba(255, 255, 255, 0.02); - border: 1px solid var(--purple-dim); - padding: 0.4em 0.6em; - overflow-y: auto; - max-height: 32em; - font-family: inherit; -} -.live .unread-badge { - color: var(--amber); - font-weight: normal; - margin-left: 0.6em; - font-size: 0.85em; - text-shadow: 0 0 6px rgba(250, 179, 135, 0.55); - animation: badge-pulse 1.4s ease-in-out infinite; -} -@keyframes badge-pulse { - 0%, 100% { opacity: 1; text-shadow: 0 0 6px rgba(250, 179, 135, 0.55); } - 50% { opacity: 0.7; text-shadow: 0 0 14px rgba(250, 179, 135, 0.95); } -} -/* Per-event fade-in slide-up. Applied to every row the live panel - appends; the `.no-anim` modifier lets history-backfill skip the - animation (we don't want 100 rows fading in at once on page load). */ -.live .row, -.live details.row { - animation: row-fade-in 220ms ease-out both; -} -.live .row.no-anim, -.live details.row.no-anim { - animation: none; -} -@keyframes row-fade-in { - from { opacity: 0; transform: translateY(4px); } - to { opacity: 1; transform: translateY(0); } -} -/* "↓ N new" pill: shown when new rows arrive while the operator is - scrolled up; click to jump to bottom. */ -.tail-pill { - position: absolute; - right: 1em; - bottom: 4.2em; - background: var(--amber); - color: #11111b; - font-family: inherit; - font-size: 0.8em; - font-weight: bold; - letter-spacing: 0.08em; - border: 0; - border-radius: 999px; - padding: 0.35em 0.9em; - cursor: pointer; - box-shadow: 0 0 14px -2px rgba(250, 179, 135, 0.85); - opacity: 0; - transform: translateY(6px); - pointer-events: none; - transition: opacity 160ms ease, transform 160ms ease; -} -.tail-pill.visible { - opacity: 1; - transform: translateY(0); - pointer-events: auto; -} -.tail-pill:hover { - filter: brightness(1.1); -} -details.row { - white-space: normal; - padding-left: 0.5em; -} -details.row > summary { - cursor: pointer; - color: var(--muted); - list-style: none; - white-space: pre-wrap; - word-break: break-word; -} -details.row > summary::before { - content: '▸ '; - color: var(--muted); - display: inline-block; - width: 1em; -} -details.row[open] > summary::before { content: '▾ '; } -details.row.tool-result-block > summary { color: var(--muted); } -/* Inline diff body for Write / Edit tool_use rows: same shape as - tool-body but each line is wrapped in a span with diff-add / - diff-del / diff-ctx so + / - lines are colored. */ -details.row > pre.diff-body { - margin: 0.3em 0 0.4em 1.2em; - padding: 0.4em 0.6em; - background: rgba(255, 255, 255, 0.02); - border-left: 2px solid var(--purple-dim); - white-space: pre-wrap; - word-break: break-word; - max-height: 22em; - overflow-y: auto; -} -details.row > pre.diff-body .diff-add { color: var(--green); } -details.row > pre.diff-body .diff-del { color: var(--red); } -details.row > pre.diff-body .diff-ctx { color: var(--fg); } -details.row > pre.tool-body { - margin: 0.3em 0 0.4em 1.2em; - padding: 0.4em 0.6em; - background: rgba(255, 255, 255, 0.03); - border-left: 2px solid var(--purple-dim); - color: var(--fg); - white-space: pre-wrap; - word-break: break-word; - max-height: 22em; - overflow-y: auto; -} -.live .row { - white-space: pre-wrap; - word-break: break-word; - padding: 0.05em 0; - line-height: 1.45; - border-left: 2px solid transparent; - padding-left: 0.5em; - margin: 0.1em 0; -} -.live .row + .row { border-top: 0; } -.live .turn-start { - color: var(--amber); - font-weight: bold; - margin-top: 1em; - border-left-color: var(--amber); - padding-top: 0.3em; -} -.live .turn-start:first-child { margin-top: 0; } -.live .turn-body { - color: var(--fg); - font-weight: normal; - margin-top: 0.15em; - padding-left: 1.2em; - opacity: 0.85; -} -.live .turn-end-ok { color: var(--green); border-left-color: var(--green); margin-bottom: 0.4em; } -.live .turn-end-fail { color: var(--red); border-left-color: var(--red); margin-bottom: 0.4em; } -.live .text { color: var(--fg); padding-left: 1.2em; } -.live .thinking { color: var(--muted); font-style: italic; padding-left: 1.2em; } -.live .tool-use { color: var(--cyan); padding-left: 1.2em; } -.live .tool-result { color: var(--muted); padding-left: 1.2em; } -.live .result { color: var(--green); padding-left: 0.5em; } -.live .sys, .live .note { color: var(--muted); } +/* Row + pill + details styling moved to hive-fr0nt::TERMINAL_CSS. */ diff --git a/hive-ag3nt/src/web_ui.rs b/hive-ag3nt/src/web_ui.rs index 81ac199..6feef41 100644 --- a/hive-ag3nt/src/web_ui.rs +++ b/hive-ag3nt/src/web_ui.rs @@ -166,8 +166,9 @@ async fn serve_css() -> impl IntoResponse { // to declare what's actually page-specific. One HTTP request, no // per-asset cache to invalidate. let body = format!( - "{}\n{}", + "{}\n{}\n{}", hive_fr0nt::BASE_CSS, + hive_fr0nt::TERMINAL_CSS, include_str!("../assets/agent.css"), ); ([("content-type", "text/css")], body) diff --git a/hive-c0re/src/dashboard.rs b/hive-c0re/src/dashboard.rs index 023e02a..cf0c626 100644 --- a/hive-c0re/src/dashboard.rs +++ b/hive-c0re/src/dashboard.rs @@ -118,8 +118,9 @@ async fn serve_css() -> impl IntoResponse { // to declare what's actually page-specific. One HTTP request, no // per-asset cache to invalidate. let body = format!( - "{}\n{}", + "{}\n{}\n{}", hive_fr0nt::BASE_CSS, + hive_fr0nt::TERMINAL_CSS, include_str!("../assets/dashboard.css"), ); ([("content-type", "text/css")], body) diff --git a/hive-fr0nt/assets/terminal.css b/hive-fr0nt/assets/terminal.css new file mode 100644 index 0000000..62f33d6 --- /dev/null +++ b/hive-fr0nt/assets/terminal.css @@ -0,0 +1,182 @@ +/* Shared terminal pane: a scroll-sticky log of rows + a "↓ N new" pill. + Pages wrap their stream container in `.terminal-wrap` and give the log + itself the `.live` class; renderer JS appends `.row` (flat line) or + `details.row` (collapsible body) elements. Row-kind classes + (`.turn-start`, `.tool-use`, `.thinking`, etc.) carry the per-event + colour; pages that don't emit a given kind simply never produce that + class — the unused rule sits in the bundle harmlessly. + + `.terminal-wrap` provides the crust-on-black phosphor chrome that makes + the agent page feel like a terminal. Pages can opt in by wrapping a + block in this class; or skip it and the rows still render with their + class colours, just without the frame. + + No `.term-input` here — composers are a separate concern (see + hive-fr0nt::COMPOSER_CSS / COMPOSER_JS once introduced). */ + +.terminal-wrap { + position: relative; + background: rgba(17, 17, 27, 0.78); + -webkit-backdrop-filter: blur(8px) saturate(120%); + backdrop-filter: blur(8px) saturate(120%); + border: 1px solid var(--purple-dim); + box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.7); + border-radius: 4px; + font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "Source Code Pro", monospace; + font-size: 0.92em; + color: var(--fg); + margin-top: 0.6em; +} +.live { + background: rgba(255, 255, 255, 0.02); + border: 1px solid var(--purple-dim); + padding: 0.4em 0.6em; + overflow-y: auto; + max-height: 32em; + font-family: inherit; +} +.live.terminal { + background: transparent; + border: 0; + box-shadow: none; + border-radius: 0; + padding: 0.8em 1em 0.4em; + overflow-y: auto; + height: min(72vh, 60em); + max-height: none; + font-family: inherit; + font-size: inherit; + color: inherit; +} +.live .row, +.live details.row { + animation: row-fade-in 220ms ease-out both; +} +.live .row.no-anim, +.live details.row.no-anim { + animation: none; +} +@keyframes row-fade-in { + from { opacity: 0; transform: translateY(4px); } + to { opacity: 1; transform: translateY(0); } +} +.live .row { + white-space: pre-wrap; + word-break: break-word; + padding: 0.05em 0; + line-height: 1.45; + border-left: 2px solid transparent; + padding-left: 0.5em; + margin: 0.1em 0; +} +.live .row + .row { border-top: 0; } +/* Row-kind colours. Pages register renderers that emit these classes; + any class no page emits is just dead CSS, which is fine. */ +.live .turn-start { + color: var(--amber); + font-weight: bold; + margin-top: 1em; + border-left-color: var(--amber); + padding-top: 0.3em; +} +.live .turn-start:first-child { margin-top: 0; } +.live .turn-body { + color: var(--fg); + font-weight: normal; + margin-top: 0.15em; + padding-left: 1.2em; + opacity: 0.85; +} +.live .turn-end-ok { color: var(--green); border-left-color: var(--green); margin-bottom: 0.4em; } +.live .turn-end-fail { color: var(--red); border-left-color: var(--red); margin-bottom: 0.4em; } +.live .text { color: var(--fg); padding-left: 1.2em; } +.live .thinking { color: var(--muted); font-style: italic; padding-left: 1.2em; } +.live .tool-use { color: var(--cyan); padding-left: 1.2em; } +.live .tool-result { color: var(--muted); padding-left: 1.2em; } +.live .result { color: var(--green); padding-left: 0.5em; } +.live .sys, .live .note { color: var(--muted); } +.live .unread-badge { + color: var(--amber); + font-weight: normal; + margin-left: 0.6em; + font-size: 0.85em; + text-shadow: 0 0 6px rgba(250, 179, 135, 0.55); + animation: badge-pulse 1.4s ease-in-out infinite; +} +@keyframes badge-pulse { + 0%, 100% { opacity: 1; text-shadow: 0 0 6px rgba(250, 179, 135, 0.55); } + 50% { opacity: 0.7; text-shadow: 0 0 14px rgba(250, 179, 135, 0.95); } +} +/* "↓ N new" pill: shown when new rows arrive while the operator is + scrolled up; click to jump to bottom. Positioned by the wrapper's + `position: relative` (terminal-wrap supplies it; pages that skip the + wrapper must add their own positioned ancestor). */ +.tail-pill { + position: absolute; + right: 1em; + bottom: 4.2em; + background: var(--amber); + color: #11111b; + font-family: inherit; + font-size: 0.8em; + font-weight: bold; + letter-spacing: 0.08em; + border: 0; + border-radius: 999px; + padding: 0.35em 0.9em; + cursor: pointer; + box-shadow: 0 0 14px -2px rgba(250, 179, 135, 0.85); + opacity: 0; + transform: translateY(6px); + pointer-events: none; + transition: opacity 160ms ease, transform 160ms ease; +} +.tail-pill.visible { + opacity: 1; + transform: translateY(0); + pointer-events: auto; +} +.tail-pill:hover { filter: brightness(1.1); } +details.row { + white-space: normal; + padding-left: 0.5em; +} +details.row > summary { + cursor: pointer; + color: var(--muted); + list-style: none; + white-space: pre-wrap; + word-break: break-word; +} +details.row > summary::before { + content: '▸ '; + color: var(--muted); + display: inline-block; + width: 1em; +} +details.row[open] > summary::before { content: '▾ '; } +details.row.tool-result-block > summary { color: var(--muted); } +details.row > pre.diff-body { + margin: 0.3em 0 0.4em 1.2em; + padding: 0.4em 0.6em; + background: rgba(255, 255, 255, 0.02); + border-left: 2px solid var(--purple-dim); + white-space: pre-wrap; + word-break: break-word; + max-height: 22em; + overflow-y: auto; +} +details.row > pre.diff-body .diff-add { color: var(--green); } +details.row > pre.diff-body .diff-del { color: var(--red); } +details.row > pre.diff-body .diff-ctx { color: var(--fg); } +details.row > pre.tool-body { + margin: 0.3em 0 0.4em 1.2em; + padding: 0.4em 0.6em; + background: rgba(255, 255, 255, 0.03); + border-left: 2px solid var(--purple-dim); + color: var(--fg); + white-space: pre-wrap; + word-break: break-word; + max-height: 22em; + overflow-y: auto; +} diff --git a/hive-fr0nt/src/lib.rs b/hive-fr0nt/src/lib.rs index 0351345..b66ad51 100644 --- a/hive-fr0nt/src/lib.rs +++ b/hive-fr0nt/src/lib.rs @@ -30,3 +30,4 @@ //! `dashboard.rs` / `web_ui.rs` route needs it. pub const BASE_CSS: &str = include_str!("../assets/base.css"); +pub const TERMINAL_CSS: &str = include_str!("../assets/terminal.css");