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 🙏

© 2024 – Pkg Stats / Ryan Hefner

floating-window

v0.1.7

Published

JavaScript module which creates a floating window. The window consists of a header, a titlel and a close button. In addition to closing, event handlers to move the window are added. The actual content of the window is then passed when the class is ini

Downloads

2

Readme

floating-window

JavaScript module which creates a floating window. The window consists of a header, a titlel and a close button. In addition to closing, event handlers to move the window are added. The actual content of the window is then passed when the class is initialized.

The Modul has a default export for the class "win". You'll find an example in "demo".

How to use

install

npm install floating-window

import

import Win from './node_modules/floating-win/index.js'

create instance

Inits the class and creates the window. But the window is not added to any tree.

const winId = 'myFloatingTestWin';  // the id for the new window
const winTitle = 'Test title';      // the text that is displayed in the title bar of the window
const winBody = document.createElement('div');
// ... body building
const winFloat = new Win(winId, winTitle, winBody);

append the window

Append the window to a tree. This can be also a shadow tree.

winFloat.appendWindow(document.documentElement);

show the window

Append the window to a tree. This can be also a shadow tree.

winFloat.show();

hide the window

The window can either close by the close button in the window head. Or you use the "hide" method:

winFloat.hide();

destroy the window

To destroy the window and remove all EventListener call the "destroy" method.

winFloat.destory();

styling

The following selectors are available:

  • floating-win (for the dialog)
  • floating-win-head (for the head of the window)
  • floating-win-head-title (for the title inside the head)
  • floating-win-head-closer (for the element represents the close button)
  • floating-win-body (parent element for the content of the window)

If the window is inserted into the shadow DOM, then the selector must be used as a parameter for "::part".

::part(floating-win-head) {
    background-color: darkblue;
}