Skip to content

feat(zen): two-engine Motion with shared presets - #75

Merged
codingcodax merged 75 commits into
mainfrom
codingcodax/motion-two-engines
Nov 12, 2026
Merged

codingcodax merged 75 commits into
mainfrom
codingcodax/motion-two-engines

Conversation

@codingcodax

@codingcodax codingcodax commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Implements #64 and every ticket in its graph.

zen now runs Motion on two engines. Springs, presses, thumbs, the tab highlight, expandables and popup enter/exit go through the motion package; colour, shadow, border, hover, focus, Toast, Drawer, Sidebar, Progress and Meter stay CSS.

  • One registry:lib item, @kosori/motion, installed at lib/motion.ts, is the only item declaring the motion package. Animated items depend on it and nothing else.
  • Springs live in TypeScript as snappy, smooth, morph, responsive and gentle; easing and duration live in CSS as --ease-* and --duration-*. No value is duplicated across engines.
  • Popups compose through Base UI's render prop, with one shared presence seam, so no component gained a prop, export or DOM level.
  • Reduced motion is read per component: no provider, no layout edit. Presses, toggles and expandables jump to their end state; overlays fade opacity only.
  • onOpenChange cancellation, controlled and uncontrolled open, nested dialog depth and Select's mixed mount lifecycle are preserved.

Closes #64
Closes #65
Closes #66
Closes #67
Closes #68
Closes #69
Closes #70
Closes #71
Closes #72
Closes #73
Closes #74

Test plan:

  • bun test — 61 pass, 0 fail (includes a real CLI install and Consumer typecheck)
  • bun run check-types
  • bun run check
  • bun run visual:capture — 120/120 (60 Examples × light/dark), reduced motion asserted per Example
  • bun run build

@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ui-web Ready Ready Preview Nov 12, 2026 5:14pm UTC

…ew-card

# Conflicts:
#	apps/web/scripts/capture-examples.ts
#	apps/web/test/install.test.ts
Cover Popover, Dropdown Menu, Context Menu and Select in the install and capture seams: the library dependency, the snappy preset, the pointer origin, the anchor width and Select's mixed mounting.
Resolve each popup's open state with useControllableOpen and compose the snappy spring through render inside AnimatePresence. Context Menu keeps its pointer origin, Dropdown Menu its anchor width and keyboard navigation, and Select keeps Base UI's mixed mounting after the first interaction.
…components

# Conflicts:
#	apps/web/scripts/capture-examples.ts
@codingcodax
codingcodax marked this pull request as ready for review November 12, 2026 04:18
The combobox width check sampled the painted box, so an entrance scale read as a narrower popup on a slower CI runner; sample the layout width beside it. The tab highlight compared viewport boxes read at different moments, so a late scroll shift read as a misaligned indicator; compare both in one evaluation. Upload the hidden capture directory so failures are debuggable.
The settle check polled the indicator's left edge and then asserted the full box 80ms later, so a slower spring could pass the poll while its width was still travelling. Poll all four edges atomically against the selected tab, which also removes the scroll-drift comparison.
Button and Toggle used the snappy spring for press feedback. Measured: 250ms to reach 0.97 and 260ms back, while a click lasts about 100ms, so the button was still shrinking when released and lagged on the way out. Press is a tween now: 100ms down, 160ms up, shared by pointer, Enter and Space. The Motion page and the capture seam follow.
Switch stretch and Slider grab ran on springs, so both were still growing when a 100ms click ended; they use the press tween now. The Checkbox mark's pop gets a 120ms state tween and the Tabs highlight moves to snappy.
The Motion page must list Switch travel, Switch press, Checkbox state, Slider grab and Tabs highlight with a shipped preset, and the state tween must finish inside a click.
Combobox and Autocomplete no longer spring their popup size, so rows hold still under the pointer.
Select shares the menu presence shape, so its exit completes instead of keeping the popup mounted for the rest of the session.
Command now uses the smooth preset for its backdrop and popup, matching Dialog, Sheet and Alert Dialog.
Examples render a plain button with buttonVariants, so pressing an open trigger does not scale it.
Clear the settled flag when an animation starts, so a reopen mid-close stays clipped until the open settles.
…iming

# Conflicts:
#	apps/web/test/motion.test.ts
A clicked Drawer runs at the standard duration while a swipe keeps the drawer duration, which now ships in the preset scale. Toast content and the anchored popup follow the root duration.
The capture seam samples the clip on every frame of a close and reopen, and checks the Drawer opens and closes at the standard duration and the Toast keeps one timing.
The check polled for data-ending-style, a transient attribute on a 240ms close, so a slow runner could miss it entirely. Record the computed transition durations in the exit observer that is already installed before Escape, then wait for the popup to hide.
@codingcodax
codingcodax merged commit 96cc6cf into main Nov 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant