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

flip-tile

v1.0.12

Published

A simple web component depicting a flippable tile. The tile has stylable front and back faces that can both take slottable content.

Downloads

2

Readme

flip-tile

This readme will document how the flip-tile component can be used.

Overview

The flip tile is a custom element with a front and a back. The element will animate a simple rotation animation when clicked. It will also fire a custom event of type 'flip' when the face-up element is changed. The event has the innerHTML of the flipped element in 'event.detail.innerHTML'.

For styling and control, the element has a couple of boolean attributes, styling parts, and slots.

The flip has an animation time of 0.8s.

front

back

Watched Attributes

This component watches two attributes:

  • face-up
  • animationtime

face-up is described under the "boolean attributes" heading.

animationtime

This attribute controls the animation time. The value should be the animation time in milliseconds.

Boolean Attributes

The component makes use of three boolean attributes:

  • face-up
  • hidden
  • disabled

face-up

Toggling this attribute will flip the card. The card is facedown by default.

hidden

If this attribute is present the element will not be displayed at all.

disable

If this attribute is present the element will become unflipable, but the current face will still be visible. Making a tile disabled mid-flip breaks the animation, but will give the correct resulting face.

Styling parts

This element has three exposed parts for styling:

  • tile
  • front
  • back

tile

This controls the style of the tile container, which is the parent of the front and back faces of the tile.

By default, the style control for the flipping animation is here. The tile is also slightly larger than the front and back faces, so if it has a different background colour than the faces it will be like a coloured border.

front

This part allows for styling the front face of the tile. The most important css style rule is backface-visibility: hidden.

back

This part allows for styling the front face of the tile. The most important css styling is backface-visibility: hidden.

The image on the back of the card is set using the background style rule.

HTML Slots

The element has two HTML slots to control the content of the tile:

  • front-content
  • back-content

front-content

This slot can be used to slot in content for the front of the tile.

back-content

This slot can be used to slot in content for the back of the tile.