🚀 Enhancements
- flashcards:
⚠️ Remove deprecated approve/reject API (6ea94f8) - flashcards:
⚠️ Drive swipe animations with Web Animations API (3f8a4d3) - flashcards: Complete swipes on a fast flick (drag velocity) (d0d900e)
- flashcards: Add peek() to nudge the active card (88a5ea2)
- flashcards:
⚠️ Accessibility on by default (e2620ce) - flashcards: Add declarative swipe(direction) method (21cf77a)
- flashcards: Add dev-only warnings for common misconfigurations (c7fb88a)
🔥 Performance
- useStackList: Constant-time active-card lookup via positional cursor (8e1b29e)
💅 Refactors
- useStackList: Model card lifecycle as an explicit state machine (fb678ea)
- flashcards:
⚠️ Group related props into object props (63e0c92)
📖 Documentation
- Refresh and restructure documentation (3e8d008)
- Refresh and restructure documentation (8cbf6da)
- Add no-style-included info (a69bf32)
- Make docs beginner-friendly and align with grouped v2 API (b75466b)
❤️ Contributors
- Vadym Bulakh (@vad1ym)
v2.0.0
New flick/peek/swipe API, accessibility on by default, Web Animations API engine, grouped object props. Several breaking changes — see Migration.
✨ Features
-
Accessibility on by default — single grouped
a11yprop (boolean orA11yOptions):- Keyboard nav: arrows swipe enabled directions, Enter/Space = primary swipe, Backspace/
z= restore. OptionalconfirmOnKeypeeks then waits for confirmation (Escape cancels). - ARIA roles & labels on deck and active card; off-screen cards
aria-hidden. - Visually-hidden
aria-liveannouncer (liveMode, localizablelabels, customannounce()builder). prefers-reduced-motion: animations snap instantly, skip-shimmer suppressed (useReducedMotion).- Focus follows the active card after a keyboard swipe without stealing focus.
- Opt out fully with
:a11y="false". ExportsA11yOptions/A11yProp/A11yAnnounceEvent.
- Keyboard nav: arrows swipe enabled directions, Enter/Space = primary swipe, Backspace/
-
Flick-to-swipe (drag velocity) — a fast flick completes a swipe even if released before
swipeThreshold, matching native mobile feel. Velocity sign must match drag direction so opposite jitter never flings the wrong way. On by default; configured via the groupedvelocityprop (nullto disable). -
peek(percent, direction?)— nudge the active card toward a direction (0–1 fraction of threshold) without completing the swipe. Same rotation/scale/indicators as mid-drag. Useful for hints and confirm-before-swipe flows.percentclamped 0–1;peek(0)settles back. Disabled directions ignored. Exposed onFlashCardsandFlashCard. -
swipe(direction)— declarative wrapper overswipeLeft/Right/Top/Bottom()taking direction as an argument; cleaner when direction is dynamic. -
Dev-only warnings — tree-shakeable
devWarn(guarded byimport.meta.env.DEV, warns once) for common misconfigs: missingitemKeywith noidfield, emptyswipeDirection,renderLimit < 1.itemKeynarrowed tokeyof T.
⚙️ Engine / Internals
- Web Animations API replaces the CSS-keyframe + DOM-clone "ghost" system. Each card animates its own real element via
element.animate()— the "last animating card vanishes" class of bugs is now structurally impossible. Also fixes button actions targeting the topmost visible card instead of the highest array-index one. useStackListrewritten: explicit card-lifecycle state machine, constant-time active-card lookup via positional cursor (was O(n)), loop-mode edge-case fixes (cycle-boundary fast swipes, collapsed empty stack, off-center hang, rotation snap). Backed by invariant + benchmark tests.
💥 Breaking Changes
-
approve/rejectAPI removed. Use the directional API instead:swipeRight/swipeTop= approve,swipeLeft/swipeBottom= reject. Removed: approve/reject events,#approve/#rejectslots,approve()/reject()methods, actions-slot props, dual-emit aliases.dragmoveno longer emits'approve'/'reject'. -
Flat props grouped into object props:
Old (v1) New (v2) animationKeyframes/animationDuration/animationEasinganimation { keyframes?, duration?, easing? }resistanceEffect/resistanceThreshold/resistanceStrengthresistance { threshold?, strength? }|nullswipeVelocityEnabled/swipeVelocityThresholdvelocity { threshold? }|nullDisable sentinel is
null, notfalse(a| falseunion makes Vue infer a Boolean prop and silently disable default-on features). -
.flash-card-animation--*CSS keyframe classes removed. Custom swipe/restore animations move toanimation.keyframes— a callback returning only the off-screen fly-out frame (from center); the library supplies the rest. ExportsdefaultAnimationKeyframes/AnimationContext/AnimationKeyframes. -
Deck DOM changed by default a11y — root gains
tabindex/role/aria-*; hidden live-region nodes are rendered. Snapshot tests or strict DOM selectors may need updating;:a11y="false"restores the old DOM.
Migration
See docs/guide/migrating-to-v2.md (renamed from migrating-from-v0, with an index and a Deprecated API section).