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

flexi-layer

v0.1.0

Published

Accessible, stackable modal/dialog web component built with Lit 3

Downloads

5

Readme

flexi-layer

An accessible, stackable, framework-agnostic modal/dialog web component built with Lit 3.

Features

  • Accessible — Full ARIA support, focus trapping, and keyboard navigation
  • Stackable — Multiple layers stacked with automatic stack management
  • Framework-agnostic — Works with any framework or vanilla JS via Web Components
  • Animations — Smooth transitions with Web Animations API
  • Event-driven API — Control layers via a central event bus
  • TypeScript — Full type safety included

Installation

npm install @enrivera/flexi-layer

Note: This package is published to GitHub Packages. Add this to your project's .npmrc or package.json if needed:

@enrivera:registry=https://npm.pkg.github.com/

Quick Start

Import the module

<script type="module" src="https://npm.pkg.github.com/@enrivera/flexi-layer"></script>

or via npm:

npm install @enrivera/flexi-layer
<script type="module" src="node_modules/@enrivera/flexi-layer/dist/flexi-layer.es.js"></script>

Basic Layer

<flexi-layer id="my-layer" title="Title">
  <p>Layer content goes here</p>
</flexi-layer>

<button onclick="document.querySelector('#my-layer').show()">
  Open Layer
</button>

Component API

Attributes / Properties

| Attribute | Type | Default | Description | |--------------------|------------------------------|---------|--------------------------| | open | Boolean | false | Open/closed state | | title | String | "" | Layer title | | size | "sm" "md" "lg" "full" | "md" | Layer size | | close-on-overlay | Boolean | true | Close on overlay click | | close-on-escape | Boolean | true | Close on Escape key | | loading | Boolean | false | Show loading spinner |

Methods

layer.show()           // Open the layer
layer.hide()           // Close the layer
layer.toggle()         // Toggle the state
layer.push(content)    // Push dynamic content

Events

| Event | Detail | Description | |------------------------|---------------------------|--------------------------------------| | flexi:open | { target } | Dispatched when opening | | flexi:close | { target } | Dispatched when closing | | flexi:show | — | Dispatched after show animation | | flexi:push | { content, position } | Dispatched when content is pushed | | flexi:backdrop-click| { originalEvent } | Dispatched on overlay click |

Event Bus API (FlexiEventBus)

For centralized layer control across your entire app. Configure the registry first as shown in Installation, then:

import { FlexiEventBus } from '@enrivera/flexi-layer';

// Open
FlexiEventBus.open({ target: '#my-layer' });

// Close
FlexiEventBus.close({ target: '#my-layer' });

// Close all
FlexiEventBus.closeAll();

// Push content
FlexiEventBus.push({
  target: '#layer',
  content: '<p>New content</p>'
});

Sizes

<flexi-layer size="sm">...</flexi-layer>   <!-- Small -->
<flexi-layer size="md">...</flexi-layer>   <!-- Default -->
<flexi-layer size="lg">...</flexi-layer>   <!-- Large -->
<flexi-layer size="full">...</flexi-layer> <!-- Full screen -->

Accessibility

  • role="dialog" and aria-modal="true" on the layer
  • aria-labelledby points to the title
  • Focus trapping: focus stays within the layer
  • Keyboard navigation: Tab, Shift+Tab, Escape
  • Overlay with role="presentation"

Development

# Install dependencies
npm install

# Development mode
npm run dev

# Production build
npm run build

# Tests
npm test

# Tests in watch mode
npm run test:watch

Project Structure

src/
├── core/
│   ├── types.ts         # Domain interfaces
│   └── constants.ts     # Constants and events
├── infra/
│   ├── animations.ts    # Web Animations API
│   ├── event-bus.ts     # Generic event bus
│   ├── flexi-bus.ts     # Layer bus
│   └── focus-trap.ts    # Focus trapping
├── components/
│   └── flexi-layer.ts   # Web Component
├── styles/
│   └── modal.css.ts    # Encapsulated styles
└── index.ts            # Main export

Browser support

  • Chrome/Edge 88+
  • Firefox 78+
  • Safari 14+

Requires Web Components and CSS custom properties support.

License

MIT