← labopen drawer →

Drawer

A control surface over a scene, made once for every experiment in the lab. Tagged hci: the experiment is the interface itself.

Why

Each experiment had grown its own panel, and some covered the scene they were for. The Splats panel did, until it was capped. Looking across the lab and the home cell, each had solved part of the problem well:

None had all of it. This experiment is where they're put together: its own page to develop and judge them on (a stand-in scene, a stone on a ground), and modules any experiment imports (../drawer/drawer, ../drawer/sections).

The drawer (drawer.ts)

drawer(el, { persist, start, cap, onHeight, onState }) → { state, height, set, step, measure }.

Three heights, measured, not configured. Each height is the one before with more below it, so the drawer is only ever clipped to a height:

They're measured again whenever the window or the content changes.

The hand. The grip drags the height as a preview. It follows the finger and gives a little past either end. Let go and it settles where it was heading: past a quarter of the way to the next height it goes there, and a flick goes one further. A tap steps closed → focus → full → focus.

The keyboard.

The scene. The drawer lies over the scene and never resizes it.

It remembers its height under persist, if given.

Sections (sections.ts)

sections(root, { persist, summaries }) → { refresh, open, focused }.

Focus mode, from the home cell's tuner. Give a control's container data-focus and tapping its name (its label) narrows the drawer to that control alone, so the scene clears while you dial it. Tap the name again, or press Escape, and the rest comes back.

Its look

Its stylesheet is injected once, on first use, never on import (the lab is one bundle, and an import shouldn't touch a page that doesn't use it). It goes ahead of the page's own styles, and every colour is a token the pages already have: --card, --ink, --muted, --edge, --accent. A page keeps its look; a page that switches themes (Splats' paper) switches the drawer with it.

Who uses it

Next: Labyrinth's and Bamboo's layer palettes onto one shared palette, Taohua's modal shell as surface, then FAB itself.

Checks

node cells/lab/devtools/drawer-check.mjs checks, at a phone's size: the three heights by tap and by keyboard, Escape, focus mode, the lift, and both themes. node cells/lab/views.mjs drawer makes the pictures.

Every picture (5)

Heights

Working in it