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

v1.0.1

Published

Drawer effect provides extra promotion space for web page. It is also a common effect in web pages & APPs, such as Google APP applied it for image search or other related search results. Developers could also apply it for mentioning some information. <msc

Downloads

6

Readme

msc-drawer

Published on webcomponents.org DeepScan grade

Drawer effect provides extra promotion space for web page. It is also a common effect in web pages & APPs, such as Google APP applied it for image search or other related search results. Developers could also apply it for mentioning some information. <msc-drawer /> provides different themes for light / dark mode and also mobile ready.

<msc-drawer />

Basic Usage

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

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

Put [slot="msc-drawer-content"] inside <msc-drawer /> as its child. It will use it as content.

<msc-drawer>
  <script type="application/json">
    {
      "active": false,
      "subject": "your subject"
    }
  </script>
  <div slot="msc-drawer-content">
    ...
  </div>
</msc-drawer>

Or set attributes directly.

<msc-drawer
  active
  subject="your subject"
>
  <div slot="msc-drawer-content">
    ...
  </div>
</msc-drawer>

Otherwise, developers could also choose remoteconfig to fetch config for <msc-drawer />.

<msc-drawer remoteconfig="https://your-domain/api-path">
  <div slot="msc-drawer-content">
    ...
  </div>
</msc-drawer>

JavaScript Instantiation

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

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

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

// use DOM api
const nodeA = document.createElement('msc-drawer');
nodeA.appendChild(content.cloneNode(true));
document.body.appendChild(nodeA);
nodeA.subject = 'your subject';

// new instance with Class
const nodeB = new MscLens();
nodeB.appendChild(content.cloneNode(true));
document.body.appendChild(nodeB);
nodeB.subject = 'your subject';

// new instance with Class & default config
const config = {
  active: false,
  subject: 'your subject'
};
const nodeC = new MscLens(config);
nodeC.appendChild(content.cloneNode(true));
document.body.appendChild(nodeC);
nodeC.subject = 'your subject';
</script>

Style Customization

<msc-drawer /> uses CSS variables to style its interface. That means developer could easy change them into the lookup you like.

<style>
msc-drawer {
  --msc-drawer-z-index: 1000;
  --msc-drawer-overlay-bgcolor: #000;
}
</style>

Attributes

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

  • subject

Set subject for <msc-drawer />.

<msc-drawer
  subject="your subject"
>
  <div slot="msc-drawer-content">
    ...
  </div>
</msc-drawer>
  • active

Set active for <msc-drawer />. It will turn <msc-drawer /> on or not. Default is false (not set).

<msc-drawer
  active
>
  <div slot="msc-drawer-content">
    ...
  </div>
</msc-drawer>

Properties

| Property Name | Type | Description | | ----------- | ----------- | ----------- | | subject | String | Getter / Setter for subject. Developers could use this property to setup subject. | | active | Boolean | Getter / Setter for active. It will turn on or not. |

Method

| Method Signature | Description | | ----------- | ----------- | | toggle([force]) | Toggle active or not. When argument is present: If the argument is true, will be turned on, and if it is false, will be turned off. |

Event

| Event Signature | Description | | ----------- | ----------- | | msc-drawer-switch | FFired when turn on or off. Developers could get active through event.detail. |

Reference