diff --git a/frontend/README.md b/frontend/README.md index 8c89112b9..4066374dd 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -3,7 +3,8 @@ npm workspaces project for the hyperhive browser-facing assets: - `packages/shared/` — shared modules used by every surface (terminal - pane, Catppuccin palette + body typography). + pane, Catppuccin palette + body typography, the `AppShell` page chrome the + swarm UI mounts). - `packages/dashboard/` — the hive-c0re dashboard SPA. - `packages/agent/` — the per-container web pages (stats, screen). - `packages/swarm-ui/` — the swarm-level operator UI shell (hives, diff --git a/frontend/packages/shared/package.json b/frontend/packages/shared/package.json index fd8221796..791a5cfdb 100644 --- a/frontend/packages/shared/package.json +++ b/frontend/packages/shared/package.json @@ -10,6 +10,8 @@ "preact": "11.2.0" }, "exports": { + "./app-shell.js": "./src/app-shell/AppShell.tsx", + "./app-shell.css": "./src/app-shell/AppShell.css", "./term-msg.js": "./src/terminal/termMsg.ts", "./term-row.js": "./src/terminal/Row.tsx", "./term-linkify.js": "./src/terminal/linkify.tsx", diff --git a/frontend/packages/swarm-ui/src/shell/Shell.css b/frontend/packages/shared/src/app-shell/AppShell.css similarity index 68% rename from frontend/packages/swarm-ui/src/shell/Shell.css rename to frontend/packages/shared/src/app-shell/AppShell.css index 5c6e06e28..406b3f980 100644 --- a/frontend/packages/swarm-ui/src/shell/Shell.css +++ b/frontend/packages/shared/src/app-shell/AppShell.css @@ -1,8 +1,6 @@ -/* — header bar + nav row + the content column every route - renders into. Colour vars come from ../theme.css (same base16 slots - the per-hive dashboard uses, so this reads as recognizably - hyperhive) — the layout itself is this package's own, not - @hive/shared's chrome.css. +/* — header bar + nav row + the content column every route + renders into. Colour vars come from @hive/shared's theme.css, the base16 + slots every hyperhive UI uses. `flex-wrap` on the header and nav rather than a hamburger/collapse menu: a narrow viewport (phone or a tiled desktop window) wraps onto @@ -10,7 +8,7 @@ over-invest" is the explicit scope here, not full mobile navigation redesign. - Page-switch animation (see Shell.tsx's file-top comment for the JS + Page-switch animation (see AppShell.tsx's file-top comment for the JS half): both the nav indicator's slide and the page-body pop follow the same three-rule motion-guard shape `@hive/shared/motion-apply.js`'s own doc comment specifies — a base rule, @@ -50,7 +48,7 @@ } .shell-brand { font-weight: 600; - /* Base colour only — Shell.tsx overrides it inline to the same + /* Base colour only — AppShell.tsx overrides it inline to the same currently-active-tab accent `.shell-nav-indicator` uses (falling back to this `--purple` before the first measurement lands, which is also the "hives" default route's own accent, so there's no @@ -108,7 +106,7 @@ } } /* Holds `SettingsMenu` + `LinksMenu` — one `margin-left: auto` on the - wrapper, not one on each child (see Shell.tsx's comment for why two + wrapper, not one on each child (see AppShell.tsx's comment for why two adjacent auto margins don't sit flush together). */ .shell-header-actions { display: flex; @@ -145,9 +143,9 @@ color: var(--fg); } /* Shared underline, one element instead of one border-bottom per link - — see Shell.tsx's file-top comment. `left`/`top`/`width` are set + — see AppShell.tsx's file-top comment. `left`/`top`/`width` are set inline per-render from a real measurement; only the *transition* - between those values lives here. 140ms matches Shell.tsx's `HOP_MS` + between those values lives here. 140ms matches AppShell.tsx's `HOP_MS` exactly, so one hop's CSS transition finishes right as the next hop's JS-driven style update lands, instead of the two blending into an averaged easing curve. */ @@ -179,104 +177,13 @@ /* Suppresses the transition for exactly one render — the indicator's very first real position, so it snaps into place instead of visibly growing from the unmounted `left:0/width:0/transparent` fallback (see - Shell.tsx's `indicatorSettledOnce`). Two-class selector so it wins + AppShell.tsx's `indicatorSettledOnce`). Two-class selector so it wins over the plain `.shell-nav-indicator` rule above without `!important`, same reasoning `:root[data-motion='reduce']`'s extra attribute selector already relies on. */ .shell-nav-indicator.shell-nav-indicator-instant { transition: none; } -/* Dynamic tabs group — inline in `.shell-nav` itself, next to the - static route links (mara, PR review: "the dynamic tab should be in - the top bar, not a new one below" — an earlier cut had this as its - own sticky row under the header; that version and the reasoning for - it are still in this file's git history if the split ever needs to - come back). `margin-left: 0.5em` + `border-left` reads as "a group - attached to the nav, not another nav item" without a second landmark - or a fixed pixel gap that'd fight `.shell-nav`'s own `gap`. */ -.shell-tabs { - display: flex; - align-items: center; - flex-wrap: wrap; - gap: 0.5em; - margin-left: 0.5em; - padding-left: 0.75em; - border-left: 1px solid var(--border); -} -.shell-tab { - display: flex; - align-items: center; - gap: 0.25em; - padding: 0.2em 0.4em 0.2em 0.7em; - border-radius: 0.3em; - background: var(--bg); - border: 1px solid var(--border); -} -.shell-tab-active { - border-color: var(--pink); -} -/* A tab that can be dragged onto a terminal to split it shows a grip in a gutter - of its own on hover, so the drag is discoverable. The gutter is part of the - padding, so the tab does not change size when the grip appears. */ -.shell-tab-draggable { - position: relative; - padding-left: 1.3em; - cursor: grab; -} -/* The tab a dragged tab would take the place of. */ -.shell-tab-drop { - box-shadow: inset 2px 0 0 var(--purple); -} -.shell-tab-grip { - position: absolute; - left: 0.35em; - top: 50%; - display: inline-flex; - color: var(--muted); - opacity: 0; - transform: translateY(-50%); - transition: opacity 0.15s ease; - pointer-events: none; -} -.shell-tab-draggable:hover .shell-tab-grip { - opacity: 0.9; -} -@media (prefers-reduced-motion: reduce) { - .shell-tab-grip { - transition: none; - } -} -.shell-tab-link { - color: var(--muted); - text-decoration: none; - font-size: 0.9em; -} -.shell-tab-active .shell-tab-link { - color: var(--fg); -} -.shell-tab-link:hover { - color: var(--fg); -} -/* Same reset every icon-only chrome button in this codebase uses - (`Badge`'s own `