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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@stephanullmann/rolling-dice

v0.1.5

Published

A dice lit webcomponent

Downloads

42

Readme

Rolling Dice Web Component

rolling-dice is a customizable Lit-based web component that simulates a rolling dice. It supports various features such as manual rolling, locking, and drag-and-drop movement.

A demo can be found here on Codepen: Demo

Installation

Install the package via npm:

npm install lit @stephanullmann/rolling-dice
bun add lit @stephanullmann/rolling-dice --registry https://registry.npmjs.org/

Note: This package depends on lit. Ensure it is installed in your project. If you are using a bundler, lit will be automatically resolved as a dependency.

Usage

Import the component in your project:

<script type="module" src="node_modules/@stephanullmann/rolling-dice/dist/index.js"></script>

Add the rolling-dice component to your HTML:

<rolling-dice id="dice1" color="blue" size="large" manual-roll manual-move></rolling-dice>

Attributes

| Attribute | Type | Default | Description | | ------------- | --------- | -------- | ----------------------------------------------- | | id | string | Random | Unique identifier for the dice. | | color | string | indigo | Color of the dice. | | size | string | medium | Size of the dice (small, medium, large). | | manual-roll | boolean | false | Enables manual rolling on double-click. | | manual-move | boolean | false | Enables drag-and-drop movement. | | locked | boolean | false | Locks the dice, preventing rolling or movement. |

Events

| Event | Description | | ------------- | ---------------------------------------------------------------------------------- | | dice-rolled | Fired when the dice finishes rolling. Contains the id and value of the dice. | | roll-dice | Custom event that triggers the dice to roll. The component listens for this event. |

Example

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Rolling Dice Example</title>
    <script type="module" src="node_modules/@stephanullmann/rolling-dice/dist/index.js"></script>
  </head>
  <body>
    <rolling-dice id="dice1" color="blue" size="large" manual-roll manual-move></rolling-dice>

    <button id="rollButton">Roll Dice</button>

    <script>
      const dice = document.querySelector('#dice1');
      const rollButton = document.querySelector('#rollButton');

      rollButton.addEventListener('click', () => {
        dice.dispatchEvent(new CustomEvent('roll-dice'));
      });

      dice.addEventListener('dice-rolled', (event) => {
        console.log(`Dice rolled: ID=${event.detail.id}, Value=${event.detail.value}`);
      });
    </script>
  </body>
</html>

Development

To build the project:

npm run build:package

To test the component locally:

npm link

License

This project is licensed under the MIT License. See the LICENSE file for details.