feat(spaces): move Space-Switcher into the PillNav start slot

Repositions the switcher from its floating spot in the top right of
the workbench into the bottom-fixed PillNav so it sits with the rest
of the nav chrome. Matches how every other persistent nav control
(app switcher, AI tier, sync status) lives in the PillNav.

Mechanics:
- @mana/shared-ui PillNavigation gains a `startSlot?: Snippet` prop
  rendered inside .pill-nav-container, before AppDrawer. Generic slot
  — any host component drops in.
- (app)/+layout.svelte passes the existing <SpaceSwitcher /> as the
  snippet (authenticated only). The old .space-bar wrapper above
  <main> is removed along with its CSS.
- SpaceSwitcher trigger is restyled to match Pill conventions: pill
  radius 999px, 32px height, 0.8125rem text, tighter paddings, shorter
  name cap (7rem). Visually merges with the surrounding Pills.
- Dropdown menu flips upward (bottom: calc(100% + 4px)) because the
  PillNav is position:fixed bottom — opening downward would land
  off-screen.

Type-check: 0 errors across 7200 files.
Scope tests: 10/10 pass.
Go tests + bun tests (mana-auth): all pass.

Plan: docs/plans/spaces-foundation.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-20 20:54:41 +02:00
parent 1d3794f96c
commit fabd45bd87
4 changed files with 38 additions and 20 deletions

View file

@ -269,6 +269,12 @@
prependElements?: PillNavElement[];
/** Additional elements (tab groups, dividers) to show after nav items */
elements?: PillNavElement[];
/**
* Snippet rendered at the very start of the bar, before the app
* switcher. Lets the host drop a custom component (e.g. Space
* switcher) into the nav without adding more dedicated props.
*/
startSlot?: import('svelte').Snippet;
/** Show logout button */
showLogout?: boolean;
/** Theme variant dropdown items */
@ -355,6 +361,7 @@
primaryColor,
prependElements = [],
elements = [],
startSlot,
showLogout = true,
themeVariantItems = [],
currentThemeVariantLabel = 'Theme',
@ -608,6 +615,12 @@
aria-label={ariaLabel}
>
<div class="pill-nav-container">
<!-- Host-provided start slot (e.g. Space switcher). Rendered
before the app drawer so it anchors the left edge of the bar. -->
{#if startSlot}
{@render startSlot()}
{/if}
<!-- App Switcher (optional) -->
{#if showAppSwitcher && appItems.length > 0}
<AppDrawer

View file

@ -202,6 +202,14 @@ export interface PillNavigationProps {
prependElements?: PillNavElement[];
/** Additional elements to show after nav items (tab groups, dividers) */
elements?: PillNavElement[];
/**
* Snippet rendered at the very start of the pill bar, before the app
* switcher and any prepend elements. Lets the host drop an arbitrary
* Svelte component (e.g. a Space switcher) into the bar without
* adding another dedicated prop surface. Keep the rendered content
* short it's first-in-line real estate.
*/
startSlot?: Snippet;
/** Bottom offset from viewport bottom (default: '0px'). Use to position above other fixed bars. */
bottomOffset?: string;
}