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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-playing-card

v1.0.0

Published

Simple Vue component for displaying playing cards, for 52-card French card decks

Downloads

2

Readme

VuePlayingCard

npm vue2

Simple Vue component for displaying playing cards, for 52-card French card decks

This component uses an SVG sprite for actually displaying the playing cards in a scalable format. The SVG is injected only once into the <body> as a collection of symbols.

Note: the SVG sprite is quite heavy (390 kB). Use with caution!

Installation

npm install --save vue-playing-card

Usage

As a module

Per-usage

<template>
  <vue-playing-card cover />
</template>

<script>
import VuePlayingCard from 'vue-playing-card';

export default {
  components: { VuePlayingCard }
};
</script>

Mount globally

import Vue from 'vue';
import VuePlayingCard from 'vue-playing-card';

Vue.use(VuePlayingCard);

As a script

<!-- Include after Vue -->
<!-- Local files -->
<script src="vue-playing-card/dist/vue-playing-card.umd.min.js"></script>

<!-- From CDN -->
<script src="https://unpkg.com/vue-playing-card/dist/vue-playing-card.umd.min.js"></script>

After including

<vue-playing-card signature="4s"></vue-playing-card>
<vue-playing-card cover></vue-playing-card>
<vue-playing-card signature="as" :width="300"></vue-playing-card>

Props

signature

Type: string or null

Accepts a valid card signature that can be parsed by the playing-card-signature module. If null or missing, the card will show its cover.

cover

Type: boolean

If true (or present without value), the card will show its cover, no matter the signature.

width

Type: string or number

Sets the width of each card component, in pixels. If string given, the numbers are extracted from it using parseInt(strValue, 10).

height

Type: string or number

Sets the height of each card component, in pixels. If string given, the numbers are extracted from it using parseInt(strValue, 10).

Card sizing

Cards have a default size of 200x280 pixels. They can be resized using either the width or height props. If one of these props is given, the other prop is calculated from it using a ratio between the default width and height. E.g. if you give width="140", the resulting card component will have a height of 196, because resultingHeight = userWidth * (DEFAULT_HEIGHT / DEFAULT_WIDTH). This calculation is useful if you want to customize the size of cards, but want to keep the aspect ratio of them.

Using both width and height at the same time is allowed, but should only be used if you know what you're doing, as you will probably mess up the aspect ratio of the cards, and be left with an odd-looking card.

Development

Build

Bundle the js to the dist folder:

npm run build

License

MIT