npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@globalleadership/card-engine

v0.3.11

Published

A Vue 3 library for interactive card deck interfaces with drag & drop, animations, and mobile swipe support

Downloads

1,652

Readme

Card Engine

A Vue 3 library for interactive card deck interfaces with drag & drop, animations, and mobile swipe support.

Features

  • 🎴 Flexible Card Design: Customizable images, text, colors, borders, and rounded corners
  • 🎯 Drag & Drop: Intuitive drag and drop with touch and mouse support
  • 📱 Mobile-First: Tinder-like swipe interface for mobile devices
  • Smooth Animations: GPU-accelerated animations using Web Animations API
  • 🎲 Shuffle Animation: Visual card shuffling with full motion animation
  • 📊 Multiple Layouts: Scatter (random) or grid layout modes
  • 🎯 Drop Zones: Define areas where cards can be dropped with stacking and trash icon modes
  • Accessible: Full keyboard navigation and screen reader support
  • 🎨 Customizable: Override default styles with CSS
  • 📦 TypeScript: Full type definitions included
  • 🌳 Tree-shakeable: Import only what you need

Installation

npm install @globalleadership/card-engine

Quick Start

Option 1: Import Components (Recommended)

<script setup lang="ts">
import { ref } from 'vue';
import { CardDeck, type CardData, type DeckConfig } from '@globalleadership/card-engine';
import '@globalleadership/card-engine/style.css';

const cards = ref<CardData[]>([
  {
    id: 1,
    image: '/images/card1.jpg',
    text: 'Card 1',
    backgroundColor: '#ffffff',
  },
  {
    id: 2,
    image: '/images/card2.jpg',
    text: 'Card 2',
    backgroundColor: '#f0f0f0',
  },
]);

const config: DeckConfig = {
  aspectRatio: 0.7,
  cardWidth: 200,
  layout: 'scatter',
  enableShuffle: true,
  enableEnlarge: true,
};
</script>

<template>
  <CardDeck :cards="cards" :config="config" />
</template>

Option 2: Install as Plugin

// main.js
import { createApp } from 'vue';
import CardEngine from '@globalleadership/card-engine';
import '@globalleadership/card-engine/style.css';
import App from './App.vue';

const app = createApp(App);
app.use(CardEngine);
app.mount('#app');
<!-- No imports needed, components available globally -->
<template>
  <CardDeck :cards="cards" :config="config" />
</template>

Development

# Install dependencies
npm install

# Build library
npm run build

# Preview build
npm run preview

Documentation

Working with Zones

Card Engine tracks which cards are currently in each drop zone. You can query this via the imperative API after a drag/drop phase using a template ref:

const deckRef = ref<CardDeckAPI | null>(null);

// Later, e.g. when the user clicks "Next phase"
const keepCards = deckRef.value?.getCardsInZone('keep') ?? [];
const allZones = deckRef.value?.getZoneAssignments() ?? {};

// keepCards can now be reused as input to another CardDeck, or for your own logic

Features Status

  • [x] Basic card rendering with full customization
  • [x] Scatter and grid layouts (with fit-all and stack modes)
  • [x] Multi-select support (Cmd/Ctrl+Click)
  • [x] Drag & drop functionality
  • [x] Drop zones with snap-to-center
  • [x] Stacked card layout in drop zones (horizontal/vertical)
  • [x] Trash icon mode for drop zones
  • [x] Shuffle animation
  • [x] Enlarge/modal view
  • [x] Entry/exit animations with stagger
  • [x] Window resize with proportional scaling
  • [x] Performance tested with 100+ cards
  • [x] Full TypeScript support
  • [x] Complete API documentation
  • [ ] Mobile swipe interface (planned)
  • [ ] Accessibility features (planned)

License

MIT