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

domolition

v1.0.6

Published

The Rage Quit UI Shatter Engine

Readme

DOMolition

"Because sometimes the only valid response to centering a div is blowing up the entire UI."

DOMolition is a React-based physics engine wrapper that converts standard DOM elements into interactive, rigid-body physics simulations. It is designed to provide highly satisfying "rage quit" UI mechanisms by capturing the visual state of a component tree and destroying it dynamically on an HTML5 canvas.

Architecture

The underlying system operates in three distinct phases:

  1. Capture Phase: Utilizes html-to-image (specifically toCanvas) to perform a high-fidelity capture of the target DOM node, resolving computed styles while supporting modern CSS features better than older rasterization libraries.
  2. Kinematic Phase: Integrates matter-js to compute rigid body dynamics. Depending on the selected "engine" (e.g., Grid, Glass, Implode), the source bitmap is algorithmically subdivided—either into a discrete Cartesian grid or via Voronoi tessellations using d3-delaunay. Each subdivision becomes a physical body with calculated mass, restitution, and friction. Specific force vectors are applied based on the engine's explosive profile.
  3. Render Pipeline: The original DOM element is visually hidden, and a full-viewport canvas is injected. A synchronized requestAnimationFrame loop paints the bitmap slices—using complex world-space clipping masks—according to the translation and rotation matrices calculated by the physics engine. The loop self-terminates when all rigid bodies reach a sleeping state.

Installation

Install the package via npm:

npm install domolition

Note: Ensure react and react-dom (v18.0.0 or higher) are installed in your project.

Usage

The library exposes the primary RageQuitWrapper component. The physics simulation is typically controlled imperatively via a React Ref, allowing you to trigger the effect from external buttons.

import React, { useRef, useState } from 'react';
import { RageQuitWrapper, RageQuitRef } from 'domolition';

export const Application = () => {
  const shatterRef = useRef<RageQuitRef>(null);

  return (
    <main style={{ padding: '2rem' }}>
      <button onClick={() => shatterRef.current?.triggerShatter()}>
        Initiate Destruction
      </button>

      <RageQuitWrapper ref="{shatterRef}" effect="glass" shardCount="{150}" onShatterComplete="{()"> console.log('Simulation terminated.')}
      >
        <section style={{ padding: '2rem', border: '1px solid #ccc', background: '#fff' }}>
          <h1>System Dashboard</h1>
          <p>This interface remains fully functional until the sequence is triggered.</p>
        </section>
      </RageQuitWrapper>
    </main>
  );
};

Physics Engines (Effects)

DOMolition supports multiple destruction engines, selected via the effect prop.

1. The Glass Engine (effect="glass")

Simulates brittle fracture. The UI cracks first (Pre-Fracture Phase), holding tension for 250ms, before shattering into jagged, realistic glass shards using Voronoi tessellation and a deterministic jitter-grid for performance. glass engine demo Usage:

<RageQuitWrapper effect="glass" shardCount="{200}" // Controls the number of jagged pieces>
  <YourComponent/>
</RageQuitWrapper>

2. The Implode Engine (effect="implode")

A high-energy inward collapse. The UI is broken into a grid, and forces pull all pieces toward the center of mass before they drop. implode engine demo Usage:

<RageQuitWrapper effect="implode" rows="{25}" // Horizontal grid subdivisions cols="{20}" Vertical>
  <YourComponent/>
</RageQuitWrapper>

3. The Grid Engine (effect="grid")

The classic blocky explosion. The UI splits into a clean grid of rectangles that explode outward uniformly. grid engine demo Usage:

<RageQuitWrapper effect="grid" rows="{12}" cols="{10}">
  <YourComponent/>
</RageQuitWrapper>

API Reference

RageQuitWrapperProps

| Property | Type | Default | Description | | :--- | :--- | :--- | :--- | | children | React.ReactNode | required | The DOM sub-tree to be captured and simulated. | | effect | 'grid' \| 'glass' \| 'implode' | 'glass' | The physics engine to use for destruction. | | isShattered | boolean | false | A declarative fallback prop to trigger the shatter effect. | | shardCount | number | 150 | The number of shards generated by the glass engine. | | rows | number | 10 | The horizontal subdivisions for the grid and implode engines. | | cols | number | 8 | The vertical subdivisions for the grid and implode engines. | | onShatterComplete | () => void | undefined | Callback invoked when all rigid bodies stop moving. |

RageQuitRef (Imperative API)

| Method | Signature | Description | | :--- | :--- | :--- | | triggerShatter | () => void | Imperatively triggers the capture and subsequent physics simulation. |

Core Dependencies

  • matter-js: Resolves 2D rigid body collisions, tunneling prevention, and kinematics.
  • d3-delaunay: Powers the Voronoi tessellation math for realistic glass fractures.
  • html-to-image: Executes the target DOM rasterization (replacing older html2canvas setups).