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

@sycoraxya/iaspect-modal

v1.1.4

Published

i-aspect modal

Readme

iaspect-modal

Installation:

npm install @sycoraxya/iaspect-modal

or

yarn add @sycoraxya/iaspect-modal

npm install @sycoraxya/[email protected]

or

yarn add @sycoraxya/[email protected]

See tags for version numbers

Usage:

Add the following line to your script

import Modal from "@sycoraxya/iaspect-modal";

Or add the folder to your webpack.config:

resolve: {
  modulesDirectories: [
    'node_modules/@sycoraxya'
  ]
}

// And add the following line to your scripts
import Modal from "iaspect-modal";

API:

// 2 ways of instantiating a modal

// 1) by passing an element
const modalWrapper = document.querySelector('.modal-wrapper');

new Modal(modalWrapper);

// 2) by passing a selector
new Modal('.modal-wrapper');

// Both methods support passing an optional prefix. This determines the prefix of all modal classes.
new Modal('.modal-wrapper', 'add-to-cart'); // This will change selectors like modal__content to add-to-cart__content

The standard way of creating a new Modal is having the HTML already present on the page. The other way is extending the base Modal class and doing whatever you want with it. See 'Extending the modal' for an example

The HTML should look like this:

<div class="modal-wrapper">
    <div class="modal js-modal">
        <div class="modal__header">
            <h3 class="modal__title text-transform--none">
                <!-- Header text goes here -->
            </h3>
            <i class="fa fa-fw fa-times modal__close js-close-modal"></i>
        </div>
        <div class="modal__content">
            <!-- Content goes here -->
        </div>
        <div class="modal__footer">
            <!-- Buttons go here -->
        </div>
    </div>
</div>

And then you can just use 1 of the 2 ways of instantiating a modal as shown above.

open() // Opens the modal

close() // Closes the modal

reset() // Resets the modal's content to the initial state

/**
Adds a button to the footer. Should only be used when extending the modal

text {String} - The button's text
classes {Array<string>} - The classes to add to the button. A button always gets the classes 'button' & 'd--inline-block'
callback: {Function} - What to do when the button is clicked
*/
createFooterButton(text, classes, callback)

setContent(string) // Sets the content modal's main content (.modal__content)

Extending the modal

See the following example

/* whitelabel/product/AddToCartModal.js */

import Modal from "@sycoraxya/iaspect-modal";

/**
 * @class
 * @name AddToCartModal
 */
class AddToCartModal extends Modal{
    constructor ({selector, product}: {selector?: string | Element, product: Product} = {}) {
        super(selector);

        this.product = product;

        this.createFooterButton(
            'Naar winkelwagen', 
            ['button--primary'], 
            () => window.location.href = 'https://www.i-aspect.com'
        );
        this.createFooterButton(
            'Verder winkelen', 
            ['button--gray'], 
            () => this.close()
        );

        this.defineContent();
    }

    defineContent (): void {
        this.setContent(`
            <div class="modal__product modal-product">
                <img class="modal-product__image" src="${this.product.image.url}" />
                <div class="modal-product__data">
                    <div class="modal-product__name">${this.product.name}</div>
                    <div class="modal-product__model">${this.product.model}</div>
                    <div class="modal-product__price">${this.product.price}</div>
                </div>
            </div>
        `);
    }
}

TODOS:

  • [ ] Add styles (like iaspect-popup)