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

@simonwep/widgetify

v0.1.0

Published

<h1 align="center"> <img src="https://user-images.githubusercontent.com/30767528/63182165-2c9f4f00-c052-11e9-931a-6d4aae6e621e.png" alt="Logo"> </h1>

Downloads

2

Readme

Features

  • Integrated positioning engine
  • Simple usage
  • Handling of hiding / showing
  • Ultra small (2.2kB gzip)
  • No dependencies
  • Supports touch devices

Getting Started

Node

Note: The readme is always up-to-date with the latest commit. See Releases for installation instructions regarding to the latest version.

Install via npm:

$ npm install @simonwep/widgetify

Install via yarn:

$ yarn add @simonwep/widgetify

Usage

// Simple example, see optional options for more configuration.
const widget = Widgetify({
    el: '.my-button',
    ref: '.my-widget'
});

Options

const widget = Widgetify({

    // Widget element with all its content
    el: '.widget',

    // Reference element, used for positioning
    ref: '.reference',

    // Disables auto-positioning aka fixed widget
    inline: false,

    // Distance of widget (el) to button (ref) in pixels
    padding: 8,

    // Defines the position of the widget.
    // Any combinations of top, left, bottom or right with one of these optional modifiers: start, middle, end
    // Examples: top-start / right-end
    // If clipping occurs, the widget will automatically choose its position.
    position: 'bottom-middle',

    // Start state. If true 'disabled' will be added to the classlist of your ref element.
    disabled: false,

    // Close widget with keyboard-key
    closeWithKey: 'Escape',

    // Event listeners
    onShow(instance) {},
    onHide(instance) {},

    // Before - and after repositioning events. 
    beforeRepositioning(instance) {
        // Return false to cancel positioning
    },

    afterRepositoning(instance) {}
});

Methods

  • widgetify.show() - Shows the widget, returns instance.
  • widgetify.hide() - Hides the widget, returns instance.
  • widgetify.disable() - Disables the widget and adds the disabled class to the button, returns instance.
  • widgetify.enable() - Enables the widget and removes the disabled class from the button, returns instance.
  • widgetify.isVisible() - Returns true if the widget is currently open.
  • widgetify.destroy() - Destroys all functionality.
  • widgetify.destroyAndRemove() - Destroys all functionality and removes the widget element including the reference.

Static properties

Widgetify.utils

  • on(elements:HTMLElement(s), events:String(s), fn:Function[, options :Object]) - Attach an event handler function.
  • off(elements:HTMLElement(s), event:String(s), fn:Function[, options :Object]) - Remove an event handler.
  • eventPath(evt:Event):[HTMLElement] - A polyfill for the event-path event propery.