Files
tessera/docs/UI.md
Adnan Zahir 228ca42801 feat: turn the camera by dragging the map, and put big-screen labels on glass
Dragging the map walks the camera round the black hole (yaw) and raises or
lowers it (lift); clicking the hole springs back to the default view. The
shader takes an azimuth and an elevation, and the orbit overlay is projected
through the same view (orbitPose, trailAngle and project take a View), so rings,
stars, trails and rockets turn with the disk. A star behind the hole's shadow is
hidden by it. Labels and moons wait until the camera rests. A camera at rest
costs nothing, and the still quality tier still draws while it turns.

Big-screen map labels sit on dark glass chips so the radar grid cannot swallow
them, and the picked label and its status read as one chip.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 17:02:50 +07:00

24 KiB

Tessera orbital vault

The persistent viewport maps backup jobs and recovery points. The black hole represents the vault. Stars represent orbits, and moons represent the latest snapshots of the selected orbit.

Viewport and consoles

  • Flowing animates the projected orbits and the black hole's accretion disk. Pause or resume from the map toolbar. The map coasts to a visual stop, then reveals labels and moons in Locked mode, starting with the selected orbit. Resuming reverses that reveal. Selecting an orbit also locks the map. Reduced motion locks it immediately.
  • Select a star or use the orbit register. The register prioritizes failed and active jobs and supports the up/down arrow keys. The inspector includes the capture action and full snapshot history.
  • The first three recovery points of the selected orbit appear as moons when the map has room. Select a moon or history entry to review the snapshot and start a restore. Escape closes the console. Restore countdown and polling continue if the console closes.
  • Hub connectivity is separate from backup health. Capture targets the named orbit. A running backup is a light circling its star; when it succeeds the light leaves for the black hole, and when it fails it is lost. See Orbit activity below. Rehearsals show text feedback and a ghost light.
  • The map shows up to 55 overview orbits and reserves one slot for inspecting an orbit beyond that limit. The register provides access to every orbit. On narrow screens the map, register, and inspector stack vertically.
  • Big Screen is a holographic visor. The map fills the viewport, and every piece of the workspace has a counterpart there and springs to it with useScreenTransition rather than popping. There are no panels or plates, only light: thin mint lines and glowing text, a vignette and faint scan over the scene, four corner brackets and a glass edge. Top left, the brand and the map's mode (Flowing, or Locked with the orbit). Top right, the four telemetry readings with their lamps. Bottom left, the legend. Bottom centre, the systems as text, the active one held in a glowing frame (it can still be dragged), and an ember label for Activity while something needs you. Bottom right, the Window | Radar words with a sliding underline, the motion and exit keys, then search and sign out as outlined circles, with the hub's state above them. The register, the inspector, the canopy frame and the sill captions fade out; every orbit is labelled on the map, each on a dark glass chip so the radar's grid cannot swallow it (up to 60, each placed clear of the others; the workspace map shows 12), and the picked orbit's label stands off its star on an elbowed leader line, with its status beneath. Use Exit big screen or Escape to return to the workspace. Below 900 px the legend is hidden and the controls sit above the systems; below 520 px the brand and telemetry are hidden too and the view switch shows icons.
  • Drag the active navbar item sideways and release to open the destination. The regular navbar is a tray of switches with a sliding pill. Big Screen uses the same text tabs with a glowing frame in place of the pill.
  • The navbar stays available above the side panel so you can switch directly between consoles. In the regular workspace it becomes a floating text dock in the same top position. Big Screen keeps its tabs at the bottom.
  • Use Search, ⌘K, or Ctrl+K from the vault, a console, or Big Screen. An empty field shows navigation shortcuts. Type to find destinations, orbits by name, ID, or provider, and snapshots by orbit name, ID, or displayed capture date. Search uses the summaries already loaded by the vault. Use the arrow keys and Enter, or select a result with a pointer. Escape closes search and returns focus to its button. Search is a spotlight panel over a dimmed, lightly blurred deck: a large input, grouped results with a kind label on the right (the active row adds an Enter mark), a footer of key hints and the result count, and a "No signal" message when nothing matches.

Consoles

  • Orbits, Outposts, Activity and Snapshot open as console screens, and Restore opens from a snapshot: a centered panel under the navbar with an engraved label, a title and an Esc key, sized per console (panelWidths in App.tsx). They fade and rise with the shared spring, and the map behind is inert while one is open.
  • Orbits is two columns. The left holds the outpost job history and one card per orbit (a failed orbit gets an ember edge; Capture is the single amber key). The right is the permanent New orbit form: Folder | Database and Via hub | Via outpost are Segmented switches, fields are recessed, and Cancel resets the form. Below 860 px the form stacks under the list.
  • Outposts is a gate. With no code it shows a dark eye inside violet rings and one key, Open a wormhole. With a code it shows the code in large mono, a burn bar and a ticking time left (the bar counts down from the time the code was first seen, since the hub sends only the expiry), the agent command with a Copy key, and Generate fresh code. Outpost health is a roster with a lamp, last activity and an Online or Silent label; an outpost is online if it was seen in the last two minutes.
  • Selects are themed (ui/Select.tsx, a drop-in for <select> that reads <option> children). The trigger is a recessed field with a chevron set in from the edge. The list is drawn in a portal so a console's scroll never clips it, flips above when there is no room below, and shows the active row with an amber edge and the chosen row with a check. Arrow keys, Home, End, type-ahead, Enter and Space work with focus kept on the trigger, and Escape closes only the list. A hidden input carries the value into forms, so required still validates.
  • Activity is one log of backups and restores, and it only leads somewhere; it never acts. A row opens its snapshot (restores start there) or, for a backup that is running or failed and has no snapshot yet, its orbit. Rows are grouped Needs you (a restore in recovery_required, or a hub orbit whose last backup failed), Running now (with a five-tick position) and then days. A backup that stored a snapshot is one row. A restore whose snapshot retention has removed is shown without a link. Filter by text or by Backups and Restores. The Activity tab lamp turns ember while anything needs you. Data comes from the snapshot list, GET /api/v1/capture-jobs, which covers outpost orbits, GET /api/v1/restore-jobs, and the last status of hub orbits, which have no job list, so a failed one has no time. File exports are not logged: the hub keeps those sessions in memory and cannot list them, so a running export is followed from the Restore screen, which the footer reopens while one is active. The model is in web/src/lib/activity.ts.
  • The Restore screen is two columns. The left chooses and confirms: the recovery point as a card, the snapshot select, and a Restore to database | Export file on hub switch (shown for managed database snapshots). Database mode picks a registered target, shows an amber warning that the target is replaced, and asks for the typed confirmation before Queue database restore is enabled. The right follows the work. For a database it is the newest restore job as a five-step progress list (Queued, Verifying, Safety backup, Applying restore, Complete); a failed step becomes an ember diamond with the hub's reason, and recovery acknowledgement appears there when the job needs it. Older jobs are listed compactly. For a file export it is the countdown ring, which keeps counting from the hub's session, with Abort on the left. Below 860 px the right column stacks under the left.
  • The snapshot sheet opens from a moon, a history row or search. Its label says where the point sits (Recovery point · 1 of 4). A hero shows a small orbit with up to four moons and the chosen one lit; Captured, Payload (with the change against the previous snapshot of the same orbit) and Recovery sit in one plate; the id has a Copy key. Database recovery options (or Export file on hub) is the primary key, Download is secondary, and Delete is deliberately quiet and asks for confirmation in an ember panel.
  • Buttons are bevelled keys (Button, .console-control): raised with a top highlight, pressed with an inset shadow. Amber marks the one primary action, ember marks a destructive one.

Data and rendering

  • The map preserves each orbit's assigned slot across polling updates. Layout and snapshot grouping live in web/src/lib/galaxyLayout.ts.
  • Snapshot summaries carry orbit_id. When connected to an older hub, the UI groups by name only if the name is unique.
  • Successful capture preserves HTTP 204 and supplies X-Tessera-Snapshot-Id when it retained a new snapshot. Automatic decay applies to that orbit's history.
  • The orbits, markers, moons and selection are SVG on one animation clock. The black hole and the sky behind it are a single WebGL2 shader in web/src/lib/blackhole/. The clock pauses when the tab is hidden. Labels are laid out in screen coordinates.

Black hole renderer

  • Each pixel is a light ray traced through Schwarzschild spacetime (geodesic.ts, mirrored in the GLSL in shaders.ts). Rays that fall in are black, rays that cross the disk plane pick up Doppler-beamed disk light, and rays that escape sample the sky. The shadow, the arch of the far side of the disk, the second image and the Einstein ring all come from that, not from artwork. Far from the hole the integrator is skipped for the weak-field deflection. The thin ring hugging the shadow is real: it is light that skimmed the photon sphere. It stays on by default, and rimCut can fade it out.
  • The proportions follow reference imagery of a thin disk seen from a low angle: the disk reaches about 26 M, roughly five times the shadow's radius, the camera sits 8° above the disk plane, the disk is optically thick near the hole and thins toward its rim, and its brightness falls steeply outward. In the app the shadow is 34 scene units across its radius, so the disk ends just past the first orbit ring. The disk plane is not the orbit plane: the orbits keep their own 0.68 tilt.
  • The orbit overlay has two looks that follow the radar wave. In the realistic look each orbit is a star: a bright core, a glow tinted by status (mint when healthy, amber while working, ember red when failed) and four diffraction spikes, which the sky's own stars never have, so a marker cannot be mistaken for scenery. The orbit tracks recede to a faint trace; hovering a marker reveals its shell, and the selected orbit keeps its bright dashed ring. While the map flows, each marker trails a tapered comet tail back along its orbit, which lengthens with speed. Stars shimmer: each scales and brightens slightly out of phase with the others, and working and failed stars move the most. The shimmer rides the scene loop that is already running, so a stopped map is perfectly still, and it is off under reduced motion. Hovering a star enlarges it with the shared spring. Status is still carried by shape as well as colour: failed keeps its diamond and busy keeps its dashed ring. In the radar look the markers are plain instrument dots and the tracks are drawn at full strength. Each marker and track ring takes the look at its own distance from the hole, so they change as the wave front passes. The renderer exposes this as signal.lookAt and calls signal.onLook while the wave runs.
  • The disk's texture is filtered by how many pixels each feature covers: noise octaves too fine to resolve collapse to their mean and melt into a smooth glow, so thin lines cannot alias into moire. Light bent a long way round the hole is squeezed onto fewer pixels, so it is filtered harder. The gas shears with differential rotation, and the whole pattern flows faster near the hole.
  • Camera. Drag the map to turn the view: dragging sideways walks the camera round the hole (yaw), dragging down raises it above the orbit plane and dragging up lowers it (lift, from nearly edge-on to steeply from above). Click the black hole to spring back to the default view by the short way round. The whole scene turns together: the shader's camera takes an azimuth and an elevation (uAzimuth, uElevation), and the orbit overlay is projected through the same view in galaxyLayout.ts (orbitPose, trailAngle and project take a View; the default view is the map's old one). Rings open into circles or flatten into lines, stars and rockets move along them, a star behind the hole's shadow is hidden by it, and the disk's bright side and the lensed sky change as they would. A press that starts on a marker or a moon still selects it. While the camera moves, markers, rings and rockets are placed straight onto the SVG and labels and moons are hidden; they are laid out again once it rests. A camera at rest costs nothing: the black hole is redrawn only while the view differs from the last draw, at the tier's rate (15 fps on the still tier). On touch screens a sideways drag turns the map and a vertical one still scrolls the page; Big Screen takes both. The camera has no keyboard control yet; the register and the search reach every orbit without it.
  • The sky must never rival the orbit markers drawn over it. Point sources in the bake (stars and distant galaxies) are small, few, and capped in brightness (POINT_CAP), and every marker has a soft dark backing disc and a dark outline, so it stays readable over any haze. Treat both as a contract: a sky change that adds bright features near the orbits breaks clickability.
  • The sky is baked once into a cubemap at load and sampled per pixel. It is a procedural galaxy with a bulge, dust lanes, nebulae, distant galaxies and stars.
  • The canvas sits under the whole scene panel and follows .galaxy-frame through its bounding rectangle, so the hole stays centred on the orbits while the frame springs between the workspace and Big Screen. Drawing happens in Motion's post-render step so it never lags the frame's transform.
  • The galaxy loop publishes its disk clock and the capture absorption to the renderer through a shared signal, so Flowing, coasting and capture spin-up drive the disk. A locked map renders once and sleeps.
  • Quality adapts to the device. A few synchronised frames are timed at startup and after a resize, and the tier steps down until the median fits the frame budget: high, medium, low, minimal, then still, which freezes ambient motion. Ambient drawing is capped at 30 fps or lower. Tiers and the governor live in quality.ts.
  • Without WebGL2, or after a lost context, the scene falls back to the SVG core and backdrop.
  • The map is a cockpit canopy: chamfered corners with a bezel line and corner screws (.canopy-frame, drawn over the map and ignoring pointer events), clipped by .vault-scene's clip-path. Big Screen drops the frame. The bezel stays neutral in both looks.
  • The deck around the canopy follows the same vocabulary: the navbar is a tray of switches with a lamp per tab (the thumb still springs and drags), the overview is a slim telemetry rail, consoles carry an engraved label and a corner screw, and status lamps glow and stay distinct by shape. The canopy's sill holds the legend, the view switch and the motion and big-screen controls; below 760 px, and in Big Screen, the controls move up to the map toolbar.
  • Icon-only keys (Pause or Resume motion, Big screen, Sign out, Search) share one size, --key, and one gap, --key-gap, and keep their names in aria-label and the tooltip. Read-outs that sit beside keys (Hub online, the Big Screen status and telemetry) are recessed plates of the same height. Telemetry readings carry a lamp: ice for orbits, mint for failed at zero, ember diamond for failed above zero, a pale diamond for snapshots, violet for payload.
  • Window | Radar is a two-position view switch on the canopy sill (ViewSwitch in VaultScene.tsx, a radiogroup; arrow keys move between positions). Its thumb rides the shared spring and tints amber for the window and mint for radar. It switches between the realistic and radar looks. The choice is remembered per browser. Without WebGL2 the button is hidden. The radar sweep runs on its own clock rather than the scene's, so it keeps turning on a locked map. Reduced motion switches looks at once and holds the sweep still and evenly lit, and the still quality tier does the same. A page that loads with the radar look applies it at once, with no wave. While the sweep runs the map redraws at the tier's frame-rate cap, so radar costs more battery than a locked realistic map, which draws nothing.
  • The radar look draws range rings every 6 M, a bearing scale at 30 M just outside the disk, a crosshair and a rotating sweep head whose phosphor fades behind it. The lensed grid only shows outside about 20 M, so it never crowds the disk. The disk is drawn as contour bands equal in log brightness, and the long dim outer disk stays faint so the inner contours carry the weight.
  • A realistic and a stylized radar look share the same trace. The radar look arrives as a wave spreading outward from the hole: each pixel picks its look from its distance to a spring-driven front, with a thin leading edge (mint going to radar, amber coming back). look.ts holds the spring and queues a request made mid-wave rather than reversing it. web/blackhole-proto.html is a standalone page for tuning the look; Vite serves it in development and the build ignores it. Add ?throttle=N to emulate a GPU N times slower.

Orbit activity

What a backup is doing is shown by how a light moves, not by a drawing of a rocket. The light is a small glowing triangle that points where it is going, with a trail that follows the path it actually flew. The code is in web/src/lib/orbitActivity.ts (what happened), rocket.ts (the physics) and trail.ts, drawn by RocketSprites.tsx.

  • Where the events come from. The scene compares each orbit's status between polls. A click shows its own verdict until a poll that began after it has landed, so one backup is never animated twice and never flips through a stale status. A page that loads, or an orbit that appears, only sets a baseline: running orbits start circling and finished ones stay settled, so opening the page never replays history. A backup that finished between two polls still gets its outcome.
  • Queued. The light waits docked on its star with a dim engine.
  • Running. It circles its star, climbing and spinning up the longer it runs.
  • Success. When the status turns completed, the light waits for a launch window, the point on its circle where its own motion already carries it round the black hole and a little inward, then departs with the velocity it has. It follows the pseudo-Newtonian pull of the black hole, mu / (r - r_s)^2, after a short burn that trims its angular momentum to just under the capture limit. The path curves with the orbits instead of running straight in, the speed rises all the way, and near the shadow the light reddens, dims and stretches as gravitational redshift and tidal forces would, so it is gone by the shadow's edge. The disk spins up as it feeds, then the new snapshot flashes once its confirmed entry is listed.
  • Failure. If the hub can tell the cause (dump_failed, upload_failed), a failure before departure explodes in place; a failure while carrying the payload launches, loses power and falls back to its star. Otherwise it explodes. The star keeps its busy look until that moment and then turns red.
  • Rehearsal. A faint dashed light circles, then lands back on its star without leaving. The result is amber, since nothing was stored.
  • Limits. At most ten lights are drawn at once; further working orbits keep their busy ring. Reduced motion draws no lights, and every outcome shows at once.
  • Verification. capture-galaxy.mjs checks the lights by data-orbit. The physics has unit tests that hold the properties that matter for every shell and launch phase: it always arrives, it curves, and it never slows on the way in.

Animation guideline

  • Use the installed Framer Motion API from motion/react. Declarative motion components inherit the physics spring from MotionConfig in web/src/main.tsx. Use uiSpring for direct controls, gentleSpring for reveal and layout travel, and ambientSpring for scene effects. The tokens in web/src/lib/motion.ts define stiffness, damping, mass, and rest thresholds.
  • Keep the element, its React key, and its MotionValues stable while a target can change. Update the scalar animate target, call animate(value, nextTarget, uiSpring) on the same MotionValue, or call .set(nextTarget) on a useSpring value. Motion automatically replaces the active animation and inherits the live value and velocity. Leave from, velocity, and fixed timing options unset for these retargets. For colors and other compound styles, spring a numeric mix amount or progress value and derive the visual property from it.
  • Keep AnimatePresence mounted and use a stable child key so a reopening element can reverse its exit. Make an exiting overlay inert and release its hit area immediately. Track direct manipulation one-to-one and seed the spring with release velocity when handing control over from an external gesture.
  • Keep CSS state changes immediate. Use Motion springs for visual transitions, including hover and loading feedback. Reserve repeating springs for ambient indicators and give them a static state under reduced motion. For continuous simulation, keep the path on its existing clock and spring its speed or progress. A new event can start a distinct path at its own origin.
  • Prefer a small physical simulation to keyframes when something travels. A rocket's position and velocity are integrated, and each state only changes which forces act on it and never resets its velocity, so every transition is continuous and any one can be interrupted by another. Drive the parameters that shape it (spin, radius, engine thrust, opacity) with springs from motion.ts. If the snapshot list is still refreshing, let the arrival finish and hold the flash until its confirmed snapshot arrives.
  • Measure the destination frame on a mode change or resize. Spring the map's center and size from its current visual rectangle, and recompute the collision layout once the frame settles.
  • Honor live changes to prefers-reduced-motion. The app applies declarative targets immediately. Imperative effects must stop and jump to the appropriate static state themselves. Verify reversals before settling, the final target, and reduced motion in a browser.

Local verification

Build the web UI before building the hub, which embeds the generated assets.

cd web
npm ci
npm run typecheck
npm test
npm run build
cd ..
cargo test --workspace --locked
cargo build --locked -p tessera-hub

To preview a populated scene, start the hub with TESSERA_SEED_DEMO=1 and a fresh temporary TESSERA_DATA_DIR. Open the vault and select an orbit with snapshots to review the locked layout.

The optional web/scripts/capture-galaxy.mjs helper uses a local Playwright and Chromium installation. It saves Flowing and Locked screenshots in the system temporary directory by default. To exercise 55 orbits and simulated successful and failed captures against a running web build, use the browser fixture. It measures median and p95 frame intervals with Chromium CPU throttling and checks reversal, capture feedback, resizing, and reduced motion.

TESSERA_GALAXY_FIXTURE=1 CPU_THROTTLE=4 FRAME_P95_MAX_MS=33.4 \
  TESSERA_URL=http://127.0.0.1:5173 node web/scripts/capture-galaxy.mjs

Set VIEWPORT_WIDTH=3840 VIEWPORT_HEIGHT=2160 for a 4K viewport. Set VERIFY_ANIMATION=0 to record a fixture baseline on older builds. If Playwright or Chromium is installed outside the web workspace, point PLAYWRIGHT_MODULE and CHROMIUM_PATH at those installations.