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-media

v1.3.2

Published

iaspect media package

Readme

iaspect-media

Installation:

npm install @sycoraxya/iaspect-media

or

yarn add @sycoraxya/iaspect-media

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 Media from "@sycoraxya/iaspect-media";

Or add the folder to your webpack.config:

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

// And add the following line to your scripts
import Media from "iaspect-media";
// 2 ways of instantiating a media class

// 1) by passing an element
const mediaElement = document.querySelector('.media');

new Media(mediaElement);

// 2) by passing a selector
new Media('.media');

// Both methods support passing an optional prefix. This determines the prefix of all modal classes.
new Media('.media', 'product__'); // This will change selectors like media__thumb to product__thumb

API:

Each Media instance has acces to .select(). Select takes 1 argument; the mount to append the selected media element to. This will replace the current media item in that mount.

Example:

<!-- The HTML Markup -->
<div class="main-media">
    <img src="image-url.jpg" alt="image" class="thumb"/>
</div>

<div class="media-wrapper">
    <span class="media media--image" data-key="original" data-hq-image="image-url-hq.jpg">
        <img src="image-url.jpg" alt="image"/>
    </span>

    <span class="media media--image" data-key="1" data-hq-image="second-image-url-hq.jpg">
        <img src="second-image-url.jpg" alt="image"/>
    </span>
</div>
// Select all media elements in the wrapper
const mediaElements = [...document.querySelectorAll('.media-wrapper .media')]; 

// Create a new Media instance from each element and bind a click event to the element
const mediaList = mediaElements.map((element) => {
    const media = new Media(element);
    
    element.addEventListener('click', () => {
        // Call media.select() on click
        media.select(document.querySelector('.main-media'));
    })

    return media;
});

console.log(mediaList); // (2) [Media, Media]

Working example: