Shared primitives: selector capsule, toasts, squish switch, spring check (#42) #61

Closed
kayg wants to merge 0 commits from issue/42-primitives into dev
Owner

Closes #42 once verified.

Four shared primitives in packages/ui/src/primitives/. They hold no app state (props in, Calternal's colour tokens read with fallbacks), so apps/web can import them directly as @calternal/ui/primitives/<name>. The mockup uses all four.

  • Selector capsule: one capsule for every single choice. The leading edge stretches toward the new choice and the trailing edge catches up, and an interruption turns from wherever it is. It's a tab list (arrows, Home/End, disabled options skipped), instant from the keyboard, with no per-frame layout reads.
  • Toasts: svelte-sonner 1.2.1 runs lifetime, stacking, swipe and pause; one custom renderer is updated in place by id.
    • Opens from a dot; counts rolling bursts (×12).
    • Bursts group by operation and subject, never by words.
    • Honest Undo: "Undone" only if everything was undone; otherwise "Undid 1 of 4" or "Couldn't undo that", with Try again.
    • A wait turns into its result in the same toast.
  • Squish switch: tap to glide and squash, or scrub with a thumb that stretches with your speed.
  • Spring check: a real checkbox. It squeezes, fills and draws its tick, then strikes the words line by line and dims them.

In the mockup:

  • Every single choice in Style and Settings, plus the bar's tabs, uses the selector. Swatches, thumbnails and multi-select marks are excluded on purpose.
  • Every on/off toggle is a squish switch, and every task checkbox a spring check.
  • Every toast goes through notify, with undo tokens that undo exactly their own edit and refuse if something has been edited on top.
  • The phone's Places screen gets the Notes/Settings bar (P8).

packages/ui/package.json is in its own small commit (728292a), in case #43 defines the package too.

Tests:

  • bun run --cwd packages/ui test:primitives: 23 unit tests.
  • bun run --cwd packages/ui e2e:primitives: 37 per engine, Chromium and WebKit.
  • The mockup suite gained four #42 checks and passes in Chromium (75); WebKit passes when run serially on this host.
  • Not wired into CI yet: .forgejo/workflows is outside this PR's lane.

Recordings and screenshots: #42 (comment)

Build for preview: bun install --frozen-lockfile && bun run --cwd apps/mockup build → apps/mockup/dist.

🤖 Generated with Claude Code

https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T

Closes #42 once verified. Four shared primitives in `packages/ui/src/primitives/`. They hold no app state (props in, Calternal's colour tokens read with fallbacks), so apps/web can import them directly as `@calternal/ui/primitives/<name>`. The mockup uses all four. - **Selector capsule:** one capsule for every single choice. The leading edge stretches toward the new choice and the trailing edge catches up, and an interruption turns from wherever it is. It's a tab list (arrows, Home/End, disabled options skipped), instant from the keyboard, with no per-frame layout reads. - **Toasts:** svelte-sonner 1.2.1 runs lifetime, stacking, swipe and pause; one custom renderer is updated in place by id. - Opens from a dot; counts rolling bursts (×12). - Bursts group by operation and subject, never by words. - Honest Undo: "Undone" only if everything was undone; otherwise "Undid 1 of 4" or "Couldn't undo that", with Try again. - A wait turns into its result in the same toast. - **Squish switch:** tap to glide and squash, or scrub with a thumb that stretches with your speed. - **Spring check:** a real checkbox. It squeezes, fills and draws its tick, then strikes the words line by line and dims them. **In the mockup:** - Every single choice in Style and Settings, plus the bar's tabs, uses the selector. Swatches, thumbnails and multi-select marks are excluded on purpose. - Every on/off toggle is a squish switch, and every task checkbox a spring check. - Every toast goes through `notify`, with undo tokens that undo exactly their own edit and refuse if something has been edited on top. - The phone's Places screen gets the Notes/Settings bar (P8). **packages/ui/package.json** is in its own small commit (728292a), in case #43 defines the package too. **Tests:** - `bun run --cwd packages/ui test:primitives`: 23 unit tests. - `bun run --cwd packages/ui e2e:primitives`: 37 per engine, Chromium and WebKit. - The mockup suite gained four #42 checks and passes in Chromium (75); WebKit passes when run serially on this host. - Not wired into CI yet: `.forgejo/workflows` is outside this PR's lane. Recordings and screenshots: https://git.kayg.org/kayg/calternal/issues/42#issuecomment-45495 **Build for preview:** `bun install --frozen-lockfile && bun run --cwd apps/mockup build` → `apps/mockup/dist`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
@calternal/ui exports each primitive as @calternal/ui/primitives/<name>,
with scripts for their unit and browser tests. Kept in its own commit so it
merges easily with #43's packages/ui work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Shared primitives: selector capsule, toasts, squish switch, spring check (#42)
All checks were successful
CI / rust (pull_request) Successful in 42s
CI / web (pull_request) Successful in 46s
a472243bb6
Four standalone primitives in packages/ui/src/primitives, free of any app
state (props in, Calternal's colour tokens read with fallbacks), used by the
mockup now and by apps/web next.

- Selector: one capsule behind plain options; the leading edge stretches
  toward the new choice and the trailing edge catches up; interruptions turn
  from where it is. A tab list with arrows, Home/End, disabled options
  skipped; instant from the keyboard; no layout reads per frame.
- Toasts on svelte-sonner 1.2.1 (lifetime, stacking, swipe, pause): one
  custom renderer that opens from a dot, counts bursts (×12), and says
  honestly what Undo did ("Undid 1 of 4", "Couldn't undo that"). Bursts group
  by operation and subject, never by words.
- Squish switch: tap to glide and squash, or scrub with a stretching thumb.
- Spring check: a real checkbox that squeezes, fills and draws its tick,
  then strikes the words line by line and dims them.

The mockup uses them for every single choice, toggle, task checkbox and
toast, with undo tokens that undo exactly their own edit. The phone's Places
screen gets the Notes/Settings bar (P8).

Tests: 23 unit tests, 37 browser tests per engine (Chromium and WebKit), and
four new mockup checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Author
Owner

Verified by Claude with own screenshots (selector capsule in Style, spring check strike/dim on tasks) plus the recordings on #42. svelte-sonner is the base; honest per-edit Undo replaced a global undo stack bug. CI green. Merging.

Verified by Claude with own screenshots (selector capsule in Style, spring check strike/dim on tasks) plus the recordings on #42. svelte-sonner is the base; honest per-edit Undo replaced a global undo stack bug. CI green. Merging.
Author
Owner

Closing: this branch is already fully contained in dev (it landed through a merge train). Branch cleanup, 2026-10-15.

Closing: this branch is already fully contained in `dev` (it landed through a merge train). Branch cleanup, 2026-10-15.
kayg closed this pull request 2026-10-15 08:35:28 +00:00
All checks were successful
CI / rust (pull_request) Successful in 42s
CI / web (pull_request) Successful in 46s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!61
No description provided.