fix: harden the vault before release

Require a private passphrase and loopback-or-token admin auth. New vaults use Argon2id; existing PBKDF2 vaults still open, and new snapshot metadata is encrypted. Wormhole tokens survive restart, offset uploads seal into the vault, and client-certificate uploads are real. Reject the command provider and keep Postgres passwords off the process arguments. Keep the interruptible canvas motion.
This commit is contained in:
2026-11-10 09:53:06 +07:00
parent 60ba8fed88
commit 95778d54e4
46 changed files with 2311 additions and 415 deletions

3
web/AGENTS.md Normal file
View File

@@ -0,0 +1,3 @@
# Web animation
Follow the [animation guideline](../docs/UI.md#animation-guideline) for component transitions and scene motion. Use the shared Framer Motion physics spring and retarget the same element or MotionValue so interruption preserves velocity.

View File

@@ -2,6 +2,7 @@
"name": "tessera-web",
"private": true,
"version": "0.1.0",
"license": "AGPL-3.0-or-later",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,4 +1,5 @@
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import { AnimatePresence } from "motion/react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import {
abortReconstitute, fetchHealth, fetchOrbits, fetchSnapshots, pollReconstitute,
@@ -14,6 +15,7 @@ import { ReconstituteWizard } from "./components/reconstitute/ReconstituteWizard
import { VaultScene } from "./components/scene/VaultScene";
import { EmptyState } from "./components/ui/EmptyState";
import { QueryGate } from "./components/ui/QueryGate";
import { SpringPane } from "./components/ui/SpringPane";
import { SnapshotSheet } from "./components/vault/SnapshotSheet";
import { useReducedMotion } from "./hooks/useReducedMotion";
import { orbitStatus } from "./lib/format";
@@ -38,6 +40,7 @@ export default function App() {
const workspaceScroll = useRef<number>(undefined);
const [bigScreen, setBigScreen] = useState(false);
const [mode, setMode] = useState<HUDMode>("scene");
const panelOpen = mode !== "scene";
const [orbitId, setOrbitId] = useState<string>();
const [snapshotId, setSnapshotId] = useState<string | null>(null);
const [pairing, setPairing] = useState<{ code: string; expires_at: string } | null>(null);
@@ -169,14 +172,14 @@ export default function App() {
</svg>
<div><strong>Tessera</strong><span>Backup control</span></div>
</div>
<HUDRail active={mode === "snapshot" ? "scene" : mode} onSelect={openConsole} />
<HUDRail active={mode === "snapshot" ? "scene" : mode} floating={bigScreen} panelOpen={panelOpen} reducedMotion={reducedMotion} onSelect={openConsole} />
<p className="hub-link" role="status">
<span className={`register-signal signal-${online ? "green" : "grey"}`} />
{online ? "Hub online" : health.isPending ? "Connecting" : "Hub offline"}
</p>
</header>
<main className="vault-main">
<main className="vault-main" inert={panelOpen}>
<div className="vault-overview">
<div>
<p className="instrument-label overview-label"><span aria-hidden="true">◈</span> Vault / 01</p>
@@ -227,22 +230,34 @@ export default function App() {
</main>
<HUDPanel
open={mode !== "scene"}
open={panelOpen}
title={panelTitles[mode]}
subtitle={mode === "reconstitute" ? "Review the destination before starting the restore." : undefined}
onClose={() => setMode("scene")}
>
{mode === "orbits" && (
<QueryGate query={orbits}>
{() => <OrbitsView orbits={sceneOrbits} onRun={runCapture} captureDisabled={!online || capture.isPending} notice={captureNotice} />}
</QueryGate>
)}
{mode === "wormhole" && <WormholeView pairing={pairing} onPaired={setPairing} />}
{mode === "decay" && <DecayView appliedPresets={sceneOrbits.map((orbit) => orbit.decay_preset ?? "week-of-dailies")} />}
{mode === "snapshot" && (snapshot ? (
<SnapshotSheet snap={snapshot} onReconstitute={() => openConsole("reconstitute", snapshot.id)} />
) : <EmptyState title="Snapshot unavailable" body="It may have expired under the retention policy." />)}
<div hidden={mode !== "reconstitute"}>
<AnimatePresence initial={false}>
{mode === "orbits" && (
<SpringPane key="orbits">
<QueryGate query={orbits}>
{() => <OrbitsView orbits={sceneOrbits} onRun={runCapture} captureDisabled={!online || capture.isPending} notice={captureNotice} />}
</QueryGate>
</SpringPane>
)}
{mode === "wormhole" && (
<SpringPane key="wormhole"><WormholeView pairing={pairing} onPaired={setPairing} /></SpringPane>
)}
{mode === "decay" && (
<SpringPane key="decay"><DecayView appliedPresets={sceneOrbits.map((orbit) => orbit.decay_preset ?? "week-of-dailies")} /></SpringPane>
)}
{mode === "snapshot" && (
<SpringPane key="snapshot">
{snapshot
? <SnapshotSheet snap={snapshot} onReconstitute={() => openConsole("reconstitute", snapshot.id)} />
: <EmptyState title="Snapshot unavailable" body="It may have expired under the retention policy." />}
</SpringPane>
)}
</AnimatePresence>
<SpringPane active={mode === "reconstitute"}>
{restoreTarget && (snaps.data?.length || restoreBusy ? (
<ReconstituteWizard
key={restoreTarget.id ?? "manual"}
@@ -254,7 +269,7 @@ export default function App() {
{() => null}
</QueryGate>
))}
</div>
</SpringPane>
</HUDPanel>
</div>
);

View File

@@ -1,6 +1,9 @@
import { AnimatePresence, motion } from "motion/react";
import type { KeyboardEvent, ReactNode } from "react";
import type { Orbit, Snapshot } from "../../api";
import { useReducedMotion } from "../../hooks/useReducedMotion";
import { formatBytes, formatWhen, orbitStatus, schedulePhrase } from "../../lib/format";
import { SpringPane } from "../ui/SpringPane";
export function TelemetryStrip({
orbitCount, failedCount, snapCount, totalBytes,
@@ -29,6 +32,7 @@ export function OrbitRegister({
onSelect: (id: string) => void;
onManage: () => void;
}) {
const reducedMotion = useReducedMotion();
const active = orbits.some(({ id }) => id === selected) ? selected : orbits[0]?.id;
function moveFocus(event: KeyboardEvent<HTMLButtonElement>, index: number) {
@@ -47,11 +51,11 @@ export function OrbitRegister({
<h2 id="register-title">Orbits</h2>
</header>
{message && <p className="console-empty" role="status">{message}</p>}
<ul className="register-list">
<motion.ul className="register-list" layoutScroll>
{orbits.map((orbit, index) => {
const status = orbitStatus(orbit.last_status);
return (
<li key={orbit.id}>
<motion.li key={orbit.id} layout={reducedMotion ? false : "position"}>
<button
type="button"
id={`register-${orbit.id}`}
@@ -68,10 +72,10 @@ export function OrbitRegister({
</span>
<span className={`register-state tone-${status.tone}`}>{status.label}</span>
</button>
</li>
</motion.li>
);
})}
</ul>
</motion.ul>
<div className="console-bottom">
<button type="button" className="console-control" onClick={onManage}>
{orbits.length ? "Manage orbits" : "Set up an orbit"} <span aria-hidden="true">↗</span>
@@ -98,35 +102,41 @@ export function OrbitInspector({
<h2 id="inspector-title">{orbit?.name ?? "Select an orbit"}</h2>
{orbit && <p className={`inspector-state tone-${status.tone}`}><span className={`register-signal signal-${status.tone}`} />{status.label}</p>}
</header>
{orbit ? (
<>
<p className="inspector-schedule">{schedulePhrase(orbit.schedule, orbit.dry_run)}</p>
<div className="inspector-capture">{capture}</div>
<section className="inspector-history" aria-labelledby="history-title">
<header>
<h3 id="history-title">Snapshot history</h3>
<span>{snapshots.length.toString().padStart(2, "0")}</span>
</header>
{snapshotMessage && <p className="console-empty" role="status">{snapshotMessage}</p>}
<ul>
{snapshots.map((snapshot, index) => (
<li key={snapshot.id}>
<button id={`snapshot-${snapshot.id}`} type="button" className="snapshot-row" onClick={() => onSelectSnapshot(snapshot.id)}>
<span className="snapshot-glyph" aria-hidden="true">◇</span>
<span>
<strong>{formatWhen(snapshot.taken_at)}</strong>
<small>{formatBytes(snapshot.size_bytes)}{index === 0 ? " · Latest" : ""}</small>
</span>
<span className="snapshot-arrow" aria-hidden="true">›</span>
</button>
</li>
))}
</ul>
</section>
</>
) : (
<p className="console-empty">Choose a star on the map or an orbit in the register to inspect its status and recovery points.</p>
)}
<div className="spring-stack inspector-stack">
<AnimatePresence initial={false}>
{orbit ? (
<SpringPane key={orbit.id}>
<p className="inspector-schedule">{schedulePhrase(orbit.schedule, orbit.dry_run)}</p>
<div className="inspector-capture">{capture}</div>
<section className="inspector-history" aria-label="Snapshot history">
<header>
<h3>Snapshot history</h3>
<span>{snapshots.length.toString().padStart(2, "0")}</span>
</header>
{snapshotMessage && <p className="console-empty" role="status">{snapshotMessage}</p>}
<ul>
{snapshots.map((snapshot, index) => (
<li key={snapshot.id}>
<button id={`snapshot-${snapshot.id}`} type="button" className="snapshot-row" onClick={() => onSelectSnapshot(snapshot.id)}>
<span className="snapshot-glyph" aria-hidden="true">◇</span>
<span>
<strong>{formatWhen(snapshot.taken_at)}</strong>
<small>{formatBytes(snapshot.size_bytes)}{index === 0 ? " · Latest" : ""}</small>
</span>
<span className="snapshot-arrow" aria-hidden="true">›</span>
</button>
</li>
))}
</ul>
</section>
</SpringPane>
) : (
<SpringPane key="empty">
<p className="console-empty">Choose a star on the map or an orbit in the register to inspect its status and recovery points.</p>
</SpringPane>
)}
</AnimatePresence>
</div>
</section>
);
}

View File

@@ -1,4 +1,5 @@
import { useId, useLayoutEffect, useRef, type ReactNode } from "react";
import { motion } from "motion/react";
import { useEffect, useId, useLayoutEffect, useRef, type ReactNode } from "react";
export function HUDPanel({
open, title, subtitle, onClose, children,
@@ -9,46 +10,73 @@ export function HUDPanel({
onClose: () => void;
children: ReactNode;
}) {
const dialog = useRef<HTMLDialogElement>(null);
const panel = useRef<HTMLElement>(null);
const heading = useRef<HTMLHeadingElement>(null);
const returnFocus = useRef<HTMLElement>(null);
const lastHeading = useRef({ title, subtitle });
const labelId = useId();
const descriptionId = useId();
useLayoutEffect(() => {
const panel = dialog.current;
if (!open || !panel) return;
panel.showModal();
return () => panel.close();
const focused = document.activeElement;
if (open) {
returnFocus.current = focused instanceof HTMLElement ? focused : null;
if (!focused?.closest(".vault-nav")) heading.current?.focus({ preventScroll: true });
} else if (returnFocus.current && (panel.current?.contains(focused) || focused === document.body)) {
const previous = returnFocus.current;
const target = previous.isConnected && previous !== document.body
? previous
: document.querySelector<HTMLElement>(".vault-nav button[aria-current]");
target?.focus({ preventScroll: true });
}
}, [open]);
useLayoutEffect(() => {
if (open) heading.current?.focus();
}, [open, title]);
if (open) {
lastHeading.current = { title, subtitle };
panel.current?.scrollTo(0, 0);
}
}, [open, title, subtitle]);
useEffect(() => {
if (!open) return;
const closeOnEscape = (event: KeyboardEvent) => {
if (event.key !== "Escape" || event.defaultPrevented || event.repeat) return;
event.preventDefault();
onClose();
};
window.addEventListener("keydown", closeOnEscape);
return () => window.removeEventListener("keydown", closeOnEscape);
}, [open, onClose]);
const display = open ? { title, subtitle } : lastHeading.current;
return (
<dialog
ref={dialog}
className="vault-dialog"
aria-labelledby={labelId}
aria-describedby={subtitle ? descriptionId : undefined}
onCancel={(event) => {
event.preventDefault();
onClose();
}}
>
{open && (
<div className="vault-overlay">
<motion.div className="vault-scrim" aria-hidden="true" initial={false} animate={{ opacity: open ? 1 : 0 }} />
<motion.aside
ref={panel}
className="vault-dialog"
role="dialog"
aria-labelledby={labelId}
aria-describedby={display.subtitle ? descriptionId : undefined}
aria-hidden={!open}
inert={!open}
initial={false}
animate={{ x: open ? "0%" : "100%" }}
>
<header className="dialog-heading">
<div>
<p className="instrument-label">Vault console</p>
<h2 id={labelId} ref={heading} tabIndex={-1}>{title}</h2>
{subtitle && <p id={descriptionId}>{subtitle}</p>}
<h2 id={labelId} ref={heading} tabIndex={-1}>{display.title}</h2>
{display.subtitle && <p id={descriptionId}>{display.subtitle}</p>}
</div>
<button type="button" className="console-control" onClick={onClose}>
Close <span aria-hidden="true">×</span>
</button>
</header>
)}
<div className="dialog-content">{children}</div>
</dialog>
<div className="dialog-content"><div className="spring-stack">{children}</div></div>
</motion.aside>
</div>
);
}

View File

@@ -1,31 +1,189 @@
import { animate, motion, useMotionValue, useTransform, useVelocity } from "motion/react";
import { useCallback, useId, useLayoutEffect, useRef, type PointerEvent } from "react";
import { uiSpring } from "../../lib/motion";
export type HUDMode = "scene" | "orbits" | "wormhole" | "decay" | "reconstitute" | "snapshot";
const items = [
{ id: "scene", label: "Vault" },
{ id: "orbits", label: "Orbits" },
{ id: "wormhole", label: "Outposts" },
{ id: "decay", label: "Retention" },
{ id: "reconstitute", label: "Restore" },
{ id: "scene", label: "Vault", icon: "M4 9l8-4 8 4v6l-8 4-8-4z M4 9l8 4 8-4 M12 13v6" },
{ id: "orbits", label: "Orbits", icon: "M21 12a9 5 0 1 1-18 0 9 5 0 1 1 18 0z M12 10.5a1.5 1.5 0 1 1 0 3 1.5 1.5 0 1 1 0-3z M18 5h.01" },
{ id: "wormhole", label: "Outposts", icon: "M12 3v3 M4.2 7.5l2.6 1.5 M4.2 16.5 6.8 15 M12 18v3 M17.2 15l2.6 1.5 M17.2 9l2.6-1.5 M15.5 12a3.5 3.5 0 1 1-7 0 3.5 3.5 0 1 1 7 0z" },
{ id: "decay", label: "Retention", icon: "M6 4h12 M6 20h12 M8 4v3l4 5-4 5v3 M16 4v3l-4 5 4 5v3" },
{ id: "reconstitute", label: "Restore", icon: "M4 12a8 8 0 1 1 2.3 5.7 M4 6v6h6 M12 8v4l3 2" },
] as const;
type Slot = { center: number; width: number };
type Gesture = { pointer: number; x: number; y: number; origin?: number };
export function HUDRail({
active, onSelect,
active, floating, panelOpen, reducedMotion, onSelect,
}: {
active: HUDMode;
floating: boolean;
panelOpen: boolean;
reducedMotion: boolean;
onSelect: (mode: HUDMode) => void;
}) {
const nav = useRef<HTMLElement>(null);
const slots = useRef<Slot[]>([]);
const gesture = useRef<Gesture>(undefined);
const suppressClick = useRef(false);
const center = useMotionValue(0);
const width = useMotionValue(0);
const velocity = useVelocity(center);
const tail = useTransform(() => center.get() - Math.max(-22, Math.min(22, velocity.get() * 0.032)));
const id = useId();
const activeIndex = Math.max(0, items.findIndex(item => item.id === active));
const snap = useCallback((index: number, immediate = false) => {
const slot = slots.current[index];
if (!slot) return;
if (immediate || reducedMotion) {
center.jump(slot.center);
width.jump(slot.width);
} else {
animate(center, slot.center, uiSpring);
animate(width, slot.width, uiSpring);
}
}, [center, reducedMotion, width]);
useLayoutEffect(() => () => {
center.stop();
width.stop();
}, [center, width]);
useLayoutEffect(() => {
const element = nav.current!;
const buttons = Array.from(element.querySelectorAll("button"));
const measure = () => {
const left = element.getBoundingClientRect().left + element.clientLeft;
const next = buttons.map(button => {
const rect = button.getBoundingClientRect();
return { center: rect.left + rect.width / 2 - left, width: rect.width - 10 };
});
const changed = next.some((slot, index) =>
slot.center !== slots.current[index]?.center || slot.width !== slots.current[index]?.width,
);
slots.current = next;
if (changed) gesture.current = undefined;
return changed;
};
snap(activeIndex, measure());
const observer = new ResizeObserver(() => {
if (measure()) snap(activeIndex, true);
});
observer.observe(element);
buttons.forEach(button => observer.observe(button));
return () => observer.disconnect();
}, [activeIndex, floating, snap]);
function start(event: PointerEvent<HTMLElement>) {
if (!event.isPrimary || event.button !== 0) return;
suppressClick.current = false;
const button = (event.target as Element).closest("button");
if (button?.hasAttribute("aria-current")) {
gesture.current = { pointer: event.pointerId, x: event.clientX, y: event.clientY };
}
}
function move(event: PointerEvent<HTMLElement>) {
const drag = gesture.current;
if (drag?.pointer !== event.pointerId) return;
const dx = event.clientX - drag.x;
if (drag.origin === undefined) {
if (Math.abs(dx) < 5 || Math.abs(dx) < Math.abs(event.clientY - drag.y)) return;
center.stop();
drag.origin = center.get();
suppressClick.current = true;
event.currentTarget.setPointerCapture(event.pointerId);
}
center.set(Math.max(slots.current[0].center, Math.min(slots.current.at(-1)!.center, drag.origin + dx)));
}
function finish(event: PointerEvent<HTMLElement>) {
const drag = gesture.current;
if (drag?.pointer !== event.pointerId) return;
gesture.current = undefined;
if (drag.origin === undefined) return;
if (event.type !== "pointerup") {
snap(activeIndex);
return;
}
const projected = center.get() + Math.max(-18, Math.min(18, center.getVelocity() * 0.1));
const next = slots.current.reduce((nearest, slot, index) =>
Math.abs(slot.center - projected) < Math.abs(slots.current[nearest].center - projected) ? index : nearest,
0);
if (next === activeIndex) snap(activeIndex);
else onSelect(items[next].id);
}
return (
<nav className="vault-nav" aria-label="Vault systems">
{items.map(({ id, label }) => (
<motion.nav
ref={nav}
className="vault-nav"
aria-label="Vault systems"
initial={false}
animate={{ "--dock-morph": panelOpen && !floating ? 1 : 0 }}
onPointerDown={start}
onPointerMove={move}
onPointerUp={finish}
onPointerCancel={finish}
onLostPointerCapture={event => {
if (event.target === event.currentTarget) finish(event);
}}
onPointerLeave={event => {
if (gesture.current?.pointer === event.pointerId && gesture.current.origin === undefined) {
gesture.current = undefined;
}
}}
onClickCapture={event => {
if (event.detail > 0 && suppressClick.current) {
event.preventDefault();
event.stopPropagation();
}
}}
>
{floating ? (
<svg className="nav-liquid" aria-hidden="true">
<defs>
<filter id={`${id}-goo`} x="-25%" y="-50%" width="150%" height="200%">
<feGaussianBlur in="SourceGraphic" stdDeviation="3.5" result="blur" />
<feColorMatrix in="blur" type="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -8" result="goo" />
<feComposite in="SourceGraphic" in2="goo" operator="atop" />
</filter>
<linearGradient id={`${id}-fill`} x2="0%" y2="100%">
<stop stopColor="#724a34" />
<stop offset="100%" stopColor="#38251e" />
</linearGradient>
</defs>
<g filter={`url(#${id}-goo)`} fill={`url(#${id}-fill)`}>
<motion.ellipse cx={reducedMotion ? center : tail} cy="50%" rx="17" ry="13" />
<motion.ellipse cx={center} cy="50%" rx="21" ry="17" />
</g>
</svg>
) : (
<>
<span aria-hidden="true" className="nav-text-dock" />
<motion.span aria-hidden="true" className="nav-underline" style={{ x: center, width }} />
</>
)}
{items.map(({ id, label, icon }) => (
<button
key={id}
type="button"
aria-label={floating ? label : undefined}
title={floating ? label : undefined}
onClick={() => onSelect(id)}
aria-current={active === id ? "page" : undefined}
>
{label}
{floating ? (
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
<path d={icon} />
</svg>
) : label}
</button>
))}
</nav>
</motion.nav>
);
}

View File

@@ -1,4 +1,5 @@
import { useState, type ReactNode } from "react";
import { AnimatePresence } from "motion/react";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import type { Orbit } from "../../api";
import { createOrbit } from "../../api";
@@ -7,6 +8,7 @@ import { Button } from "../ui/Button";
import { OrbitStatusDot } from "../ui/StatusDot";
import { TelemetryPanel } from "../ui/Telemetry";
import { Hint } from "../ui/EmptyState";
import { SpringPane } from "../ui/SpringPane";
export function OrbitsView({
orbits, onRun, captureDisabled, notice,
@@ -80,74 +82,82 @@ export function OrbitsView({
))}
</div>
{editing ? (
<div className="rounded-2xl border border-wormhole-violet/30 bg-space-900 p-4 space-y-3">
<h3 className="font-medium text-star-100">New orbit</h3>
<label className="block text-sm">
<span className="text-star-400">Name</span>
<input
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2"
value={name}
onChange={(e) => setName(e.target.value)}
/>
</label>
<label className="block text-sm">
<span className="text-star-400">Folder path</span>
<input
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2 font-mono text-xs"
value={path}
onChange={(e) => setPath(e.target.value)}
/>
</label>
<label className="block text-sm">
<span className="text-star-400">Schedule (cron)</span>
<input
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2 font-mono text-xs"
value={schedule}
onChange={(e) => setSchedule(e.target.value)}
/>
</label>
<label className="block text-sm">
<span className="text-star-400">Decay</span>
<select
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2"
value={preset}
onChange={(e) => setPreset(e.target.value)}
>
{DECAY_PRESETS.map((p) => (
<option key={p.id} value={p.id}>
{p.title}
</option>
))}
</select>
</label>
<label className="flex items-center gap-2 text-sm text-star-300">
<input type="checkbox" checked={rehearse} onChange={(e) => setRehearse(e.target.checked)} />
Rehearse only (dry run)
</label>
<Hint>
Rehearse orbits prove the path without writing to the vault — status shows amber “rehearsed”.
</Hint>
{create.isError && <p role="alert" className="text-sm text-orbit-red">The orbit could not be saved.</p>}
<div className="flex gap-2">
<Button className="flex-1" onClick={() => setEditing(false)}>
Cancel
</Button>
<Button
variant="primary"
className="flex-1"
disabled={create.isPending}
onClick={() => create.mutate()}
>
Save orbit
</Button>
</div>
</div>
) : (
<Button variant="primary" className="w-full" onClick={() => setEditing(true)}>
Add an orbit
</Button>
)}
<div className="spring-stack">
<AnimatePresence initial={false}>
{editing ? (
<SpringPane key="form">
<div className="rounded-2xl border border-wormhole-violet/30 bg-space-900 p-4 space-y-3">
<h3 className="font-medium text-star-100">New orbit</h3>
<label className="block text-sm">
<span className="text-star-400">Name</span>
<input
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2"
value={name}
onChange={(e) => setName(e.target.value)}
/>
</label>
<label className="block text-sm">
<span className="text-star-400">Folder path</span>
<input
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2 font-mono text-xs"
value={path}
onChange={(e) => setPath(e.target.value)}
/>
</label>
<label className="block text-sm">
<span className="text-star-400">Schedule (cron)</span>
<input
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2 font-mono text-xs"
value={schedule}
onChange={(e) => setSchedule(e.target.value)}
/>
</label>
<label className="block text-sm">
<span className="text-star-400">Decay</span>
<select
className="mt-1 w-full rounded-xl bg-space-950 border border-space-700 px-3 py-2"
value={preset}
onChange={(e) => setPreset(e.target.value)}
>
{DECAY_PRESETS.map((p) => (
<option key={p.id} value={p.id}>
{p.title}
</option>
))}
</select>
</label>
<label className="flex items-center gap-2 text-sm text-star-300">
<input type="checkbox" checked={rehearse} onChange={(e) => setRehearse(e.target.checked)} />
Rehearse only (dry run)
</label>
<Hint>
Rehearse orbits prove the path without writing to the vault — status shows amber “rehearsed”.
</Hint>
{create.isError && <p role="alert" className="text-sm text-orbit-red">The orbit could not be saved.</p>}
<div className="flex gap-2">
<Button className="flex-1" onClick={() => setEditing(false)}>
Cancel
</Button>
<Button
variant="primary"
className="flex-1"
disabled={create.isPending}
onClick={() => create.mutate()}
>
Save orbit
</Button>
</div>
</div>
</SpringPane>
) : (
<SpringPane key="add">
<Button variant="primary" className="w-full" onClick={() => setEditing(true)}>
Add an orbit
</Button>
</SpringPane>
)}
</AnimatePresence>
</div>
</div>
);
}

View File

@@ -1,6 +1,8 @@
import { useMutation } from "@tanstack/react-query";
import { motion } from "motion/react";
import { startPairing } from "../../api";
import { useReducedMotion } from "../../hooks/useReducedMotion";
import { ambientPulse } from "../../lib/motion";
import { Button } from "../ui/Button";
import { Hint } from "../ui/EmptyState";
import { TelemetryPanel } from "../ui/Telemetry";
@@ -16,6 +18,7 @@ export function WormholeView({
mutationFn: startPairing,
onSuccess: onPaired,
});
const reducedMotion = useReducedMotion();
const expires = pairing ? new Date(pairing.expires_at).toLocaleTimeString() : "";
@@ -31,7 +34,7 @@ export function WormholeView({
) : (
<motion.div
className="rounded-2xl border border-wormhole-violet/35 bg-gradient-to-b from-wormhole-violet/10 to-space-900 p-6 text-center"
initial={{ scale: 0.95, opacity: 0 }}
initial={reducedMotion ? false : { scale: 0.95, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
>
<p className="text-xs uppercase tracking-[0.2em] text-wormhole-violet mb-4">
@@ -73,15 +76,19 @@ function EmptyWormhole({
onGenerate: () => void;
loading: boolean;
}) {
const reducedMotion = useReducedMotion();
return (
<div className="text-center py-8">
<motion.div
className="mx-auto w-24 h-24 rounded-full border border-wormhole-violet/30 flex items-center justify-center text-3xl"
animate={{ boxShadow: ["0 0 0 rgba(167,139,250,0)", "0 0 32px rgba(167,139,250,0.25)", "0 0 0 rgba(167,139,250,0)"] }}
transition={{ duration: 3, repeat: Infinity }}
>
<div className="relative mx-auto w-24 h-24 rounded-full border border-wormhole-violet/30 flex items-center justify-center text-3xl">
<motion.span
aria-hidden="true"
className="pointer-events-none absolute inset-0 rounded-full shadow-[0_0_32px_rgba(167,139,250,0.25)]"
initial={{ opacity: 0 }}
animate={{ opacity: reducedMotion ? 0 : [0, 1] }}
transition={reducedMotion ? { type: false } : ambientPulse}
/>
◉
</motion.div>
</div>
<p className="mt-4 text-star-300 text-sm max-w-xs mx-auto">
Open a wormhole when you&apos;re ready to claim an outpost.
</p>

View File

@@ -1,4 +1,5 @@
import { useEffect, useState } from "react";
import { motion } from "motion/react";
import type { Snapshot } from "../../api";
import { formatBytes, formatWhen } from "../../lib/format";
import { Button } from "../ui/Button";
@@ -108,21 +109,23 @@ export function ReconstituteWizard({
</label>
{inCountdown && (
<div
<motion.div
className="relative rounded-2xl border border-orbit-amber/40 bg-orbit-amber/10 p-6 text-center"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
>
<div className="relative mx-auto w-20 h-20">
<svg viewBox="0 0 36 36" className="w-full h-full -rotate-90">
<circle cx="18" cy="18" r="16" fill="none" stroke="#1e2647" strokeWidth="3" />
<circle
<motion.circle
cx="18"
cy="18"
r="16"
fill="none"
stroke="#f0c468"
strokeWidth="3"
strokeDasharray={`${(remaining / GRACE) * 100} 100`}
pathLength={100}
initial={false}
animate={{ pathLength: Math.max(0, Math.min(1, remaining / GRACE)) }}
/>
</svg>
<span className="absolute inset-0 flex items-center justify-center text-2xl font-semibold text-orbit-amber">
@@ -132,7 +135,7 @@ export function ReconstituteWizard({
<p className="mt-3 text-orbit-amber text-sm font-medium">
Reconstituting in {remaining}s — abort restores nothing.
</p>
</div>
</motion.div>
)}
<div className="flex gap-2">

View File

@@ -1,4 +1,5 @@
import { useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
import { animate, spring, useMotionValue } from "motion/react";
import type { Orbit, Snapshot } from "../../api";
import { orbitStatus } from "../../lib/format";
import { LABEL_HEIGHT, placeLabels, type Rect } from "../../lib/galaxyLabelLayout";
@@ -7,6 +8,7 @@ import {
SCENE_HEIGHT, SCENE_WIDTH, spiralPoint, type Vec2,
} from "../../lib/galaxyLayout";
import { useGalaxyMotion } from "../../hooks/useGalaxyMotion";
import { uiSpring } from "../../lib/motion";
import { VaultCore } from "./VaultCore";
export type CaptureArrival = { orbitId: string; snapshotId: string };
@@ -16,6 +18,7 @@ type Props = {
selectedOrbitId?: string;
recentSnapshots: Snapshot[];
flowing: boolean;
reducedMotion: boolean;
arrival?: CaptureArrival;
onSelectOrbit: (id: string) => void;
onSelectSnapshot: (id: string) => void;
@@ -25,22 +28,38 @@ const HALF_WIDTH = SCENE_WIDTH / 2;
const HALF_HEIGHT = SCENE_HEIGHT / 2;
const labelFont = "500 11px ui-monospace, monospace";
const MAX_LABELS = 12;
const METEOR_SECONDS = 1.4;
const ACCRETION_SECONDS = 6.4;
export function BlackholeGalaxy({
orbits, selectedOrbitId, recentSnapshots, flowing, arrival, onSelectOrbit, onSelectSnapshot,
orbits, selectedOrbitId, recentSnapshots, flowing, reducedMotion, arrival, onSelectOrbit, onSelectSnapshot,
}: Props) {
const frame = useRef<HTMLDivElement>(null);
const bodyNodes = useRef(new Map<SVGGElement, { id: string; far: boolean }>());
const slotsBefore = useRef<ReturnType<typeof assignOrbitSlots>>(undefined);
const elapsed = useRef(0);
const core = useRef<SVGGElement>(null);
const meteor = useRef<{ id: string; time: number; source: Vec2 }>(undefined);
const meteor = useRef<{ id: string; time: number; source: Vec2; progress: ReturnType<typeof spring> }>(undefined);
const trail = useRef<SVGPathElement>(null);
const head = useRef<SVGCircleElement>(null);
const effect = useRef<SVGGElement>(null);
const [width, setWidth] = useState(0);
const [coasting, setCoasting] = useState(false);
const rate = useMotionValue(flowing && !reducedMotion ? 1 : 0);
const moving = !reducedMotion && (flowing || coasting);
useLayoutEffect(() => () => rate.stop(), [rate]);
useLayoutEffect(() => {
if (reducedMotion) {
rate.jump(0);
setCoasting(false);
return;
}
const target = flowing ? 1 : 0;
if (rate.get() === target && !rate.isAnimating()) return;
setCoasting(!flowing);
animate(rate, target, { ...uiSpring, onComplete: () => setCoasting(false) });
}, [flowing, rate, reducedMotion]);
const slots = useMemo(
() => assignOrbitSlots(orbits.map(({ id }) => id), slotsBefore.current, selectedOrbitId),
@@ -58,8 +77,8 @@ export function BlackholeGalaxy({
}, []);
const draw = useCallback((delta: number) => {
if (flowing && delta > 0) {
elapsed.current += delta;
if (moving && delta > 0) {
elapsed.current += delta * Math.max(0, rate.get());
const phase = (elapsed.current % ACCRETION_SECONDS) / ACCRETION_SECONDS;
core.current?.style.setProperty("--accretion-offset", String(-100 * phase));
}
@@ -74,37 +93,42 @@ export function BlackholeGalaxy({
node.setAttribute("transform", `translate(${x} ${y})`);
}
if (!arrival) {
if (!arrival || reducedMotion) {
effect.current?.setAttribute("opacity", "0");
return flowing;
return moving;
}
const slot = slots.get(arrival.orbitId);
if (meteor.current?.id !== arrival.snapshotId && slot) {
const source = orbitPose(slot, elapsed.current);
meteor.current = { id: arrival.snapshotId, time: 0, source };
meteor.current = {
id: arrival.snapshotId,
time: 0,
source,
progress: spring({ ...uiSpring, stiffness: 36, damping: 12, keyframes: [0, 1], restDelta: 0.002 }),
};
const points = Array.from({ length: 36 }, (_, i) => spiralPoint(source, i / 35));
trail.current?.setAttribute("d", points.map(({ x, y }, i) => `${i ? "L" : "M"} ${x} ${y}`).join(" "));
}
const current = meteor.current;
if (!current || current.id !== arrival.snapshotId) return flowing;
current.time += delta;
const progress = Math.min(1, current.time / METEOR_SECONDS);
if (!current || current.id !== arrival.snapshotId) return moving;
current.time += delta * 1000;
const { value: progress, done } = current.progress.next(current.time);
const { x, y } = spiralPoint(current.source, progress);
head.current?.setAttribute("cx", String(x));
head.current?.setAttribute("cy", String(y));
trail.current?.setAttribute("stroke-dashoffset", String(0.2 - progress));
effect.current?.setAttribute("opacity", String(progress >= 1 ? 0 : Math.min(1, (1 - progress) * 6)));
return flowing || progress < 1;
}, [arrival, flowing, slots]);
return moving || !done;
}, [arrival, moving, rate, reducedMotion, slots]);
useGalaxyMotion(flowing || !!arrival, draw);
useGalaxyMotion(moving || (!reducedMotion && !!arrival), draw);
const scale = width / SCENE_WIDTH;
const height = SCENE_HEIGHT * scale;
const hitRadius = Math.max(12, scale ? 12 / scale : 12);
const selectedSlot = selectedOrbitId ? slots.get(selectedOrbitId) : undefined;
const selectedPosition = !flowing && selectedSlot ? orbitPose(selectedSlot, elapsed.current) : undefined;
const positions = !flowing ? [...slots.values()].map((slot) => orbitPose(slot, elapsed.current)) : [];
const selectedPosition = !moving && selectedSlot ? orbitPose(selectedSlot, elapsed.current) : undefined;
const positions = !moving ? [...slots.values()].map((slot) => orbitPose(slot, elapsed.current)) : [];
const moons = selectedPosition
? moonPoses(selectedPosition, recentSnapshots.length, 2 * hitRadius + 3, positions)
: [];
@@ -122,7 +146,7 @@ export function BlackholeGalaxy({
};
let labels: ReturnType<typeof placeLabels> = [];
if (!flowing && width && labelCandidates.length) {
if (!moving && width && labelCandidates.length) {
const measure = document.createElement("canvas").getContext("2d");
if (measure) measure.font = labelFont;
const markers = positions.map((point) => box(point, 7));

View File

@@ -63,6 +63,7 @@ export function VaultScene({
selectedOrbitId={selectedOrbitId}
recentSnapshots={recentSnapshots}
flowing={flowing}
reducedMotion={reducedMotion}
arrival={arrival}
onSelectOrbit={onSelectOrbit}
onSelectSnapshot={onSelectSnapshot}

View File

@@ -1,25 +1,28 @@
import type { ButtonHTMLAttributes } from "react";
import { motion, type HTMLMotionProps } from "motion/react";
const variants = {
primary:
"bg-wormhole-violet/25 text-star-100 border-wormhole-violet/40 hover:bg-wormhole-violet/35",
ghost: "bg-space-800/60 text-star-200 border-space-700 hover:bg-space-800",
danger: "bg-orbit-red/15 text-orbit-red border-orbit-red/35 hover:bg-orbit-red/25",
success: "bg-orbit-green/15 text-orbit-green border-orbit-green/35 hover:bg-orbit-green/25",
warn: "bg-orbit-amber/15 text-orbit-amber border-orbit-amber/40 hover:bg-orbit-amber/25",
"text-star-100 border-wormhole-violet/40 [--button-color:var(--color-wormhole-violet)] [--button-rest:25%] [--button-hover:35%]",
ghost: "text-star-200 border-space-700 [--button-color:var(--color-space-800)] [--button-rest:60%] [--button-hover:100%]",
danger: "text-orbit-red border-orbit-red/35 [--button-color:var(--color-orbit-red)]",
success: "text-orbit-green border-orbit-green/35 [--button-color:var(--color-orbit-green)]",
warn: "text-orbit-amber border-orbit-amber/40 [--button-color:var(--color-orbit-amber)]",
};
export function Button({
variant = "ghost",
className = "",
...props
}: ButtonHTMLAttributes<HTMLButtonElement> & {
}: HTMLMotionProps<"button"> & {
variant?: keyof typeof variants;
}) {
return (
<button
<motion.button
type="button"
className={`px-4 py-2.5 rounded-xl text-sm font-medium border transition-colors disabled:opacity-40 ${variants[variant]} ${className}`}
className={`vault-button px-4 py-2.5 rounded-xl text-sm font-medium border disabled:opacity-40 ${variants[variant]} ${className}`}
initial={false}
animate={{ "--button-mix": "0%" }}
whileHover={{ "--button-mix": "100%" }}
{...props}
/>
);

View File

@@ -1,5 +1,8 @@
import type { UseQueryResult } from "@tanstack/react-query";
import type { ReactNode } from "react";
import { motion } from "motion/react";
import { useReducedMotion } from "../../hooks/useReducedMotion";
import { ambientPulse } from "../../lib/motion";
import { Button } from "./Button";
export function QueryGate<T>({
@@ -11,10 +14,17 @@ export function QueryGate<T>({
empty?: ReactNode;
children: (data: T) => ReactNode;
}) {
const reducedMotion = useReducedMotion();
if (query.isLoading) {
return (
<div className="flex flex-col items-center justify-center py-16 text-star-400">
<div className="w-10 h-10 rounded-full border-2 border-wormhole-violet/40 border-t-wormhole-violet animate-spin" />
<div className="flex flex-col items-center justify-center py-16 text-star-400" role="status">
<motion.div
aria-hidden="true"
className="w-10 h-10 rounded-full border-2 border-wormhole-violet"
initial={{ opacity: reducedMotion ? 1 : 0.4 }}
animate={{ opacity: reducedMotion ? 1 : [0.4, 1] }}
transition={reducedMotion ? { type: false } : ambientPulse}
/>
<p className="mt-3 text-sm">Pulling telemetry from the vault…</p>
</div>
);

View File

@@ -1,21 +1,31 @@
import { motion } from "motion/react";
import { AnimatePresence, motion, useIsPresent } from "motion/react";
import type { ReactNode } from "react";
import { useReducedMotion } from "../../hooks/useReducedMotion";
export function Sheet({
open,
onClose,
title,
children,
}: {
open: boolean;
type SheetContentProps = {
onClose: () => void;
title: string;
children: ReactNode;
}) {
if (!open) return null;
};
export function Sheet({ open, ...content }: SheetContentProps & { open: boolean }) {
return (
<AnimatePresence>
{open && <SheetContent key="sheet" {...content} />}
</AnimatePresence>
);
}
function SheetContent({ onClose, title, children }: SheetContentProps) {
const present = useIsPresent();
const reducedMotion = useReducedMotion();
const closedY = reducedMotion ? "0%" : "100%";
return (
<motion.div
className="fixed inset-0 z-40 flex flex-col justify-end"
inert={!present}
style={{ pointerEvents: present ? undefined : "none" }}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
@@ -28,10 +38,9 @@ export function Sheet({
/>
<motion.aside
className="relative z-10 max-h-[78dvh] overflow-y-auto rounded-t-3xl border-t border-space-700 bg-space-900/98 px-5 pt-4 pb-8 shadow-2xl"
initial={{ y: "100%" }}
animate={{ y: 0 }}
exit={{ y: "100%" }}
transition={{ type: "spring", damping: 28, stiffness: 320 }}
initial={{ y: closedY }}
animate={{ y: "0%" }}
exit={{ y: closedY }}
>
<div className="mx-auto mb-3 h-1 w-10 rounded-full bg-space-700" />
<div className="flex items-center justify-between gap-3 mb-4">

View File

@@ -0,0 +1,25 @@
import { motion, useIsPresent } from "motion/react";
import type { ReactNode } from "react";
import { useReducedMotion } from "../../hooks/useReducedMotion";
export function SpringPane({ active = true, children }: { active?: boolean; children: ReactNode }) {
const present = useIsPresent();
const reducedMotion = useReducedMotion();
const visible = active && present;
const offset = reducedMotion ? 0 : 8;
return (
<motion.div
className="spring-pane"
aria-hidden={!visible}
inert={!visible}
initial={active && !reducedMotion ? { opacity: 0, y: offset } : false}
animate={active
? { opacity: 1, y: 0, visibility: "visible" }
: { opacity: 0, y: offset, transitionEnd: { visibility: "hidden" } }}
exit={{ opacity: 0, y: offset }}
>
{children}
</motion.div>
);
}

View File

@@ -36,11 +36,22 @@ body {
button:enabled { cursor: pointer; }
button:disabled { cursor: default; }
.vault-button {
background-color: color-mix(
in oklab,
color-mix(in oklab, var(--button-color) var(--button-rest, 15%), transparent),
color-mix(in oklab, var(--button-color) var(--button-hover, 25%), transparent) var(--button-mix, 0%)
);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.scrollbar-none { scrollbar-width: none; }
.vault-app { --vault-header-height: 70px; }
.vault-topbar {
min-height: 70px;
position: sticky;
top: 0;
z-index: 30;
min-height: var(--vault-header-height);
padding: 0 clamp(16px, 3vw, 44px);
display: grid;
grid-template-columns: 1fr auto 1fr;
@@ -60,17 +71,58 @@ button:disabled { cursor: default; }
}
.vault-brand span { display: block; margin-top: 5px; font-size: 9px; }
.vault-nav { display: flex; align-self: stretch; gap: clamp(8px, 2vw, 27px); }
.vault-nav { position: relative; display: flex; align-self: stretch; gap: clamp(8px, 2vw, 27px); }
.vault-nav button {
position: relative;
z-index: 1;
min-height: 44px;
padding: 0 6px;
color: var(--quiet);
font-size: 13px;
white-space: nowrap;
touch-action: pan-y;
user-select: none;
}
.vault-nav button:hover, .vault-nav button[aria-current] { color: var(--color-star-100); }
.vault-nav button[aria-current]::after { position: absolute; inset: auto 5px -1px; height: 2px; content: ""; background: var(--accent); }
.vault-nav button[aria-current] { cursor: grab; }
.vault-nav:active button[aria-current] { cursor: grabbing; }
.nav-text-dock {
position: absolute;
inset: 50% -8px auto;
height: 54px;
translate: 0 -50%;
scale: calc(0.94 + var(--dock-morph, 0) * 0.06) calc(0.83 + var(--dock-morph, 0) * 0.17);
opacity: var(--dock-morph, 0);
border: 1px solid #3a3d44;
border-radius: 999px;
background: #111418d9;
backdrop-filter: blur(14px);
box-shadow: inset 0 1px #ffffff12, 0 8px 24px #0005;
pointer-events: none;
}
.nav-underline {
position: absolute;
left: 0;
bottom: calc(-1px + var(--dock-morph, 0) * (50% - 16px));
height: calc(2px + var(--dock-morph, 0) * 32px);
translate: -50% 0;
pointer-events: none;
}
.nav-underline::before {
content: "";
position: absolute;
inset: 0 calc(-8px * var(--dock-morph, 0));
border-radius: 999px;
background: color-mix(in oklab, #4a3225 calc(var(--dock-morph, 0) * 100%), var(--accent));
}
.nav-liquid {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
overflow: visible;
pointer-events: none;
}
.hub-link { justify-self: end; display: flex; align-items: center; gap: 8px; color: var(--color-star-300); font: 500 11px var(--font-mono); white-space: nowrap; }
.vault-main { max-width: 1720px; padding: 30px clamp(16px, 3vw, 44px) 10px; margin-inline: auto; }
@@ -234,26 +286,34 @@ button:disabled { cursor: default; }
.capture-notice { margin-block: 4px; font: 500 12px/1.5 var(--font-mono); color: var(--color-star-200); text-transform: none; letter-spacing: 0; }
.capture-notice.tone-red { color: var(--color-orbit-red); }
.vault-dialog {
.vault-overlay {
position: fixed;
inset: 0 0 0 auto;
margin: 0;
inset: 0;
z-index: 20;
overflow: hidden;
pointer-events: none;
}
.vault-scrim { position: absolute; inset: 0; background: #030508b3; }
.vault-dialog {
position: absolute;
inset: var(--vault-header-height) 0 0 auto;
width: min(440px, 100%);
height: 100dvh;
max-width: none;
max-height: none;
overflow: auto;
padding: 0;
overscroll-behavior: contain;
pointer-events: auto;
background: #121519;
color: var(--color-star-100);
border-left: 1px solid #3b4048;
}
.vault-dialog::backdrop { background: #030508b3; }
.vault-dialog[inert] { pointer-events: none; }
.dialog-heading { display: flex; gap: 12px; justify-content: space-between; align-items: start; padding: 18px 20px; position: sticky; top: 0; z-index: 1; background: #121519; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { font-size: 23px; font-weight: 550; letter-spacing: -.035em; margin-top: 3px; }
.dialog-heading h2:focus { outline: none; }
.dialog-heading h2 + p { margin-top: 4px; color: var(--quiet); font-size: 13px; }
.dialog-content { padding: 18px 20px; }
.spring-stack { position: relative; min-width: 0; }
.spring-stack > .spring-pane[inert] { position: absolute; inset: 0 0 auto; pointer-events: none; }
.inspector-stack, .inspector-stack > .spring-pane { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.big-screen {
--screen-gutter: clamp(12px, 2vw, 30px);
@@ -266,6 +326,7 @@ button:disabled { cursor: default; }
}
.big-screen .vault-topbar { display: contents; }
.big-screen .vault-dialog { top: var(--screen-top); bottom: calc(var(--screen-bottom) + 64px); }
.big-screen :is(.vault-brand, .hub-link, .vault-console, .vault-footer, .scene-footer) { display: none; }
.big-screen .vault-main { padding: 0; }
.big-screen .vault-workspace,
@@ -308,20 +369,25 @@ button:disabled { cursor: default; }
.big-screen .vault-telemetry { border-radius: 8px; padding-block: 8px; }
.big-screen .vault-nav {
position: absolute;
z-index: 2;
z-index: 30;
bottom: var(--screen-bottom);
left: 50%;
transform: translateX(-50%);
gap: 3px;
gap: 4px;
max-width: calc(100% - 2 * var(--screen-gutter));
margin: 0;
padding: 4px;
padding: 5px 7px;
border-radius: 999px;
box-shadow: 0 8px 30px #0006;
box-shadow: inset 0 1px #ffffff12, 0 8px 30px #0008;
}
.big-screen .vault-nav button { border-radius: 999px; padding-inline: clamp(8px, 1.65vw, 23px); }
.big-screen .vault-nav button[aria-current] { background: #30251f; color: #ffd0a9; }
.big-screen .vault-nav button[aria-current]::after { display: none; }
.big-screen .vault-nav button {
display: grid;
place-items: center;
width: 46px;
border-radius: 999px;
padding: 0;
}
.big-screen .vault-nav button[aria-current] { color: #ffe2c9; }
@media (max-width: 1060px) {
.vault-workspace { grid-template-areas: "map map" "register inspector"; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: auto; }
@@ -329,6 +395,7 @@ button:disabled { cursor: default; }
}
@media (max-width: 640px) {
.vault-app { --vault-header-height: 105px; }
.vault-topbar { grid-template-columns: 1fr auto; gap: 0 10px; padding-top: 11px; }
.vault-nav { grid-row: 2; grid-column: 1 / -1; justify-content: space-between; margin-top: 7px; gap: 3px; }
.vault-nav button { padding-inline: 5px; font-size: 12px; }
@@ -340,7 +407,7 @@ button:disabled { cursor: default; }
.vault-console { min-height: 0; }
.register-list { max-height: 196px; }
.orbit-inspector { max-height: 480px; padding-bottom: 8px; }
.orbit-inspector > .console-empty { padding-bottom: 8px; }
.inspector-stack .console-empty { padding-bottom: 8px; }
.galaxy-frame { max-width: none; }
.scene-toolbar, .scene-footer { padding: 9px; }
.scene-footer > p { display: none; }
@@ -370,14 +437,5 @@ button:disabled { cursor: default; }
@media (max-width: 380px) {
.big-screen .vault-nav { gap: 2px; }
.big-screen .vault-nav button { padding-inline: 6px; }
.big-screen .vault-telemetry > div { padding-inline: 7px; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: .01ms !important;
animation-iteration-count: 1 !important;
transition-duration: .01ms !important;
}
}

16
web/src/lib/motion.ts Normal file
View File

@@ -0,0 +1,16 @@
import type { Transition } from "motion/react";
export const uiSpring = {
type: "spring",
stiffness: 320,
damping: 36,
mass: 1,
} as const satisfies Transition;
export const ambientPulse = {
...uiSpring,
stiffness: 40,
damping: 13,
repeat: Infinity,
repeatType: "mirror",
} as const satisfies Transition;

View File

@@ -1,15 +1,27 @@
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { MotionConfig } from "motion/react";
import App from "./App";
import { useReducedMotion } from "./hooks/useReducedMotion";
import { uiSpring } from "./lib/motion";
import "./index.css";
const queryClient = new QueryClient();
function MotionApp() {
const reducedMotion = useReducedMotion();
return (
<MotionConfig reducedMotion={reducedMotion ? "always" : "never"} transition={reducedMotion ? { type: false } : uiSpring}>
<App />
</MotionConfig>
);
}
createRoot(document.getElementById("root")!).render(
<StrictMode>
<QueryClientProvider client={queryClient}>
<App />
<MotionApp />
</QueryClientProvider>
</StrictMode>,
);