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

msc-zoom

v1.0.0

Published

<msc-zoom /> is a web component. All we need to do is put the required script into your HTML document. Then follow <msc-zoom />'s html structure and everything will be all set.

Downloads

2

Readme

msc-zoom

Published on webcomponents.org DeepScan grade

<msc-zoom /> is a web component which provide zoom-in / zoom-out effects for image closing watch. Users could just tap the part they like to have a closing watch.

<msc-zoom />

Basic Usage

<msc-zoom /> is a web component. All we need to do is put the required script into your HTML document. Then follow <msc-zoom />'s html structure and everything will be all set.

  • Required Script
<script
  type="module"
  src="https://your-domain/wc-msc-zoom.js">        
</script>
  • Structure

Put img[slot="msc-zoom-vision"] inside <msc-zoom /> as its child. It will use it as source.

<msc-zoom>
  <script type="application/json">
    {
      "active": false,
      "duration": 300,
      "scale": 2
    }
  </script>
  <img src="https://picsum.photos/id/26/1000/670" alt="mas-zoom image" slot="msc-zoom-vision" />
</msc-zoom>

JavaScript Instantiation

<msc-zoom /> could also use JavaScript to create DOM element. Here comes some examples.

<script type="module">
import { MscZoom } from 'https://your-domain/wc-msc-zoom.js';

const content = document.querySelector('img[slot="msc-zoom-vision"]');

// use DOM api
const nodeA = document.createElement('msc-zoom');
nodeA.appendChild(content.cloneNode(true));
document.body.appendChild(nodeA);
nodeA.scale = 2;

// new instance with Class
const nodeB = new MscZoom();
nodeB.appendChild(content.cloneNode(true));
document.body.appendChild(nodeB);
nodeB.scale = 3;

// new instance with Class & default config
const config = {
  scale: 3.5,
  duration: 500
};
const nodeC = new MscZoom(config);
nodeC.appendChild(content.cloneNode(true));
document.body.appendChild(nodeC);
</script>

Style Customization

Developers could apply styles to decorate img[slot="msc-zoom-vision"].

<style>
img[slot="msc-zoom-vision"] {
  object-fit: cover;
}
</style>

Attributes

<msc-zoom /> supports some attributes to let it become more convenience & useful.

  • active

Set active for <msc-zoom />. It will zoom-in once set true. Default is false (not set).

<msc-zoom
  active
>
  <img src="https://picsum.photos/id/635/1000/670" slot="msc-zoom-vision" />
</msc-zoom>
  • duration

Set duration for <msc-zoom /> zoom-in / zoom-out animation. Default is 300 (ms).

<msc-zoom
  duration="300"
>
  <img src="https://picsum.photos/id/635/1000/670" slot="msc-zoom-vision" />
</msc-zoom>
  • scale

Set scale for <msc-zoom />. Default is 2.

<msc-zoom
  scale="2"
>
  <img src="https://picsum.photos/id/635/1000/670" slot="msc-zoom-vision" />
</msc-zoom>

Properties

| Property Name | Type | Description | | ----------- | ----------- | ----------- | | active | Boolean | Getter / Setter for active. It will turn on / off zoom effects. | | duration | Number | Getter / Setter for duration. The zoom animation's duration will apply this value with unit ms. Default is 300. | | scale | Number | Getter / Setter for scale. The scale rate will apply this value. Default is 2. |

Event

| Event Signature | Description | | ----------- | ----------- | | msc-zoom-click | Fired when <msc-zoom /> has been clicked. Developers could get mode through event.detail. |

Reference