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

resizable-widget

v1.3.2

Published

Create a resizable and movable widget on webpage

Downloads

66

Readme

resizable-widget

Online Demo

See a online demo here

Usage

  1. run npm install resizable-widget
  2. remember to import the library before using it (it will be automatically registered as <resizable-widget>; if not registered, the widget will not work)
import 'resizable-widget';

Notice: The old-styled registerResizableWidget has been removed. Now we automatically register the widget as <resizable-widget>. If you want to use the old-styled registerResizableWidget, you will have to install <=1.1.1 version.

  1. use the widget in your HTML
<!-- Example code: Modify it if you want to use in your project -->
<div id="container">
    <resizable-widget id="w" style="width: 400px; height: 300px;">
        <div slot="widget-caption" id="t">
            <span>My Widget</span>
            <button data-comment="// close or remove the widget..." id=x data-exclude-bindmove>x</button>
        </div>
        your content... (you can put anything, and the overflow will be automatically proceeded)
    </resizable-widget>
</div>

Stylesheet:

#container {
    position: absolute;
    inset: 0;
}
#t {
    display: flex;
    overflow: hidden;
}
#t > span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
  1. Open the widget by:
document.getElementById('w').open = true;
  1. Close the widget by:
document.getElementById('w').open = false;
// or:
document.getElementById('w').close();
// example:
document.getElementById('x').onclick = () => {
    document.getElementById('w').open = false;
}

Notice

  1. The container must have a height. In the example, we use position: absolute; inset: 0; to make the container full screen. If you directly put the widget in the body AND the height of your body is 0 (often seen in some SPA apps), it will NOT work and the widget will "disappear" when you try to move it. (In fact, in the case the element will have a "negative" top value, that's why it will "disappear".)
  2. The container can be the body, but you must ensure that the height of your body is not 0. In some SPA apps, the following DOM is often seen: <div id=app></div> Then if the #app is position: absolute; inset: 0;, the height of your body will be 0.
  3. In the caption, you must put data-exclude-bindmove attribute on clickable or interactive elements. Otherwise, the onclick (and other) event will never be triggered.
  4. The caption bar is not necessary. It is not required to have a slot="widget-caption" element in a widget. If not provided, the widget will be plain.
  5. There is no default caption bar. If not provided, the widget will not be moveable. To make it moveable, you must provide a slot="widget-caption" element.

Tech stack

  • Web Components

Known problems

  • Doesn't work well in some browsers

License

Unlicense