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

pilatch-card

v2.0.5

Published

Pilatch card web component that can flip

Downloads

5

Readme

pilatch-card

A simple web component for Pilatch playing cards

Installation

From your command line

yarn add pilatch-card
yarn install --flat

In your HTML add polyfills, the helper this depends on, the HTML import and the stylesheet.

<script src="/node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
<script src="/node_modules/pilatch-card/dist/pilatch-card.es5.js"></script>

Usage

<pilatch-card></pilatch-card>
<pilatch-card rank="12" suit="rock" up></pilatch-card>
<pilatch-card rank="14" suit="scissors" known></pilatch-card>
<pilatch-card binary></pilatch-card>

black-backed Pilatch card, face-down Queen of rock Pilatch card, face-up known, face-down, Ace of Scissors binary Pilatch card, DOWN

Unknown

Unknown cards are the simplest, just displaying the card-back. They are created without any HTML attributes.

Suit

Pilatch cards (other than binary cards) are grouped into three suits: rock, paper, and scissors. Use the suit HTML attribute and provide it one of those three values.

Rank

The suited Pilatch cards can have ranks between 1 and 15, inclusive. Use the rank HTML attribute and provide it a value in that range. 1 through 10 are numeric ranks. 11 is Jack. 12 is Queen. 13 is King. 14 is Ace. 15 is Joker.

Up

To flip a card over, add or remove its up HTML attribute. All ranked, suited Pilatch cards will appear with the same card back until an up attribute is added.

Binary

Binary cards say "UP" on one side and "DOWN" on the other. Add the binary HTML attribute to create one. Each binary card is DOWN by default. Add the up HTML attribute to flip it.

Clickable

To make a card have cursor: pointer add the clickable HTML element. Clicking it won't do anything out-of-the-box. Your application must decide how to handle those events, and attach event listeners to <pilatch-card> elements.

Known

If a player knows what a face-down card is, then add the known HTML attribute to make the back-face translucent.

No Transition

To have cards instantaneously switch between their up and down sides, instead of using CSS transitions, add the no-transition HTML attribute. This is especially useful when rearranging <pilatch-card> elements in the DOM.

Read more on how that's helpful in this blog post on animating web components with virtual DOM.

Demo

For examples, clone this repository then run

yarn install
yarn start

...and navigate to http://localhost:3000

Future

In the future this may depend on the web components v1 spec instead of v0. Pilatch cards may eventually use Shadow DOM when browser support/usage allows.