Skip to content

feat: add card dealer block - #234

Merged
starc007 merged 2 commits into
mainfrom
feat/card-dealer
Oct 24, 2026
Merged

starc007 merged 2 commits into
mainfrom
feat/card-dealer

Conversation

@starc007

Copy link
Copy Markdown
Owner

What

New Card Dealer block (@beui/card-dealer): a card table with a face-down deck, a fanned hand and a tilted discard pile.

  • Data-driven: each card has an id, a zone (deck / hand / pile) and a label. Moving a card is just changing its zone; array order sets stacking and fan order.
  • renderFace / renderBack for any card design; cardWidth, cardHeight, spread and angle tune the layout.
  • onCardSelect makes hand cards buttons, rendered in fan order so Tab follows the hand.

Motion

  • A zone change arcs the card across the table on motion's arc() path while it flips face up or down in 3D.
  • Multi-card moves stagger within a fixed 0.6s window, so dealing several cards or collecting the table flows instead of moving as a slab.
  • Reordering the hand makes cards hop over each other into their new slots.
  • Hovered or focused hand cards lift and part their neighbours.
  • The fan caps its outer tilt (40°) and drop (26px), so large hands keep one shallow arc.
  • Resize snaps cards to the new layout without flights. Reduced motion makes every move and flip instant.

Each card runs on useAnimate and stops its previous move before starting the next: a declarative arc path keeps running when its target changes, so a long flight finishing after a quick hop would otherwise write its stale end point back.

Demo

52-card deck that opens with a dealt hand of five. Deal, Deal 3 (up to a 13-card hand), Sort, Shuffle and Collect; clicking a hand card plays it to the pile.

Also

Registry entry, SEO and About copy, component dates, changelog line, AGENTS.md catalog row, and tests/card-dealer.a11y.test.tsx.

Verification

  • bun run check, bun test
  • Browser: deal flight and flip, play to pile, collect stagger, rapid deals at 15 to 120ms apart settle on even spacing, hover and focus lift, 13-card fan, Deal 3 respects the hand limit, desktop and 375px widths, resize snap
  • Not verified: reduced motion in a real browser, physical touch devices, light theme

A deck, fanned hand and discard pile driven by each card's zone. Zone changes arc cards across the table on motion's arc() path while they flip in 3D, multi-card moves stagger, hand reorders hop, and hovered or focused hand cards lift. Each card stops its previous move before starting a new one so quick successive moves settle on the latest target.
The hand fan now caps its outer tilt and drop, so large hands keep one shallow arc, and a multi-card move spreads its stagger over a fixed window. The demo deals up to 13 cards and adds Deal 3.
@starc007
starc007 merged commit eae0236 into main Oct 24, 2026
1 check passed
@starc007
starc007 deleted the feat/card-dealer branch October 24, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant