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

@jothsa/sound-bite

v1.0.6

Published

A web component for simply, performantly, and accessibly adding inline sound bites.

Downloads

26

Readme

Sound-Bite

A web component for simply, performantly, and accessibly adding inline sound bites.

This web component was made using Lit. I was inspired by Soundcite. My goal for this project was to create a version that could be self hosted, was more accessible, and used modern technologies.

This component was built using Lit.

Usage

Installation

pnpm add @jothsa/sound-bite

Importing

Import the custom element.

import "sound-bite";

Or if you want to define it manually

import { SoundBite } from "sound-bite/soundBiteClass";

window.customElements.define("sound-bite", SoundBite);

HTML Usage

<sound-bite src="https://example.com/sound.mp3" name="Example Sound"></sound-bite>

For more details see the HTML Attributes section.

Accessibility

I have tried to make it accessible, however I am far from an expert. If you have any accessibility improvements or notice any problems, please open a GitHub issue!

HTML Attributes

These are set on the sound-bite element.

src - The URL of the audio file to play. name - The name of the sound bite. This will be used in the aria-label attribute of the button.

prefetchStrategy: "hover" | "intersection" | "load" (default: "intersection) - when to load the audio file. Either when the element is hovered over, when it is in view, or when the component is first connected to the dom. If the file is not loaded, clicking the button will have no effect.

audioState: "playing" | "paused" - The current state of the audio. This is a read-only attribute and should not be modified by the user.

Slots

default - The content that will be displayed after the icon inside the button. By default this will be the name of the sound (the name attribute).

<sound-bite src="https://example.com/sound.mp3" name="Crowd Noises">
  <span>the overwhelming crowd</span>
</sound-bite>

play-icon - The icon to be displayed to start playing the sound (it will be displayed when the sound is not playing). By default this is the play button emoji, ▶️.

<sound-bite src="https://example.com/sound.mp3" name="Crowd Noises">
  <img src="/my-icon" slot="play-icon" alt="" />
</sound-bite>

pause-icon - The icon to be displayed to pause the sound (it will be displayed when the sound is playing). By default this is the pause button emoji, ⏸️.

<sound-bite src="https://example.com/sound.mp3" name="Crowd Noises">
  <img src="/my-icon" slot="pause-icon" alt="" />
</sound-bite>

Custom Properties

This web component exposes several custom properties to allow custom styling.

--bg-block-offset - the block offset of the background

--bg-color - the color of the background.

--bg-height - the height of the background

--initial-bg-inline-size - the initial background size

--initial-padding - the padding between the initial bg and the icon/text

--focus-outline - the focus outline

--focus-outline-offset - the focus outline offset

Further Customization

I have tried to keep this component pretty simple. If you want to customize it further, feel free to fork the project!

Compatibility

This component should work in all browsers that support web components and css nesting.

Known Issues

This component doesn't handle line wrapping very well. Try to keep it on one life if possible.