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

v1.0.6

Published

People love collages. With collages we could combined several images together and make them more vivid and interesting. Developers could apply <msc-collages /> instead of annoying HTML code & CSS setting. All we need to do is just make a few setting and e

Downloads

16

Readme

msc-collages

Published on webcomponents.org DeepScan grade

People love collages. With collages we could combined several images together and make them more vivid and interesting. Developers could apply <msc-collages /> instead of annoying HTML code & CSS setting. All we need to do is just make a few setting and everything will be all set.

<msc-collages />

Basic Usage

  • Required Script
<script 
  type="module"
  src="https://your-domain/wc-msc-collages.js"
</script>
  • Structure Put into HTML document. It will have different functions and looks with attribute mutation.
<msc-collages>
  <script type="application/json">
    {
      "theme": 8, // 1 ~ 8
      "object-fit": "cover", // cover || contain
      "collages": [
        {
          "link": "?",
          "src": "https://picsum.photos/300/300?grayscale&random=1",
          "alt": "grayscale 1",
          "target": "_blank"
        },
        {
          "link": "?",
          "src": "https://picsum.photos/300/300?grayscale&random=2",
          "alt": "grayscale 2",
          "target": "_blank"
        },
        {
          "link": "?",
          "src": "https://picsum.photos/300/300?grayscale&random=3",
          "alt": "grayscale 3",
          "target": "_blank"
        },
        {
          "link": "?",
          "src": "https://picsum.photos/300/300?grayscale&random=4",
          "alt": "grayscale 4",
          "target": "_blank"
        }
      ]
    }
  </script>
</msc-collages>

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

<msc-collages
  remoteconfig="https://your-domain/api-path"
  ...
></msc-collages>

JavaScript Instantiation

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

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

//use DOM api
const nodeA = document.createElement('msc-collages');
document.body.appendChild(nodeA);
nodeA.theme = 1;
nodeA.collages = [ {...} ];

// new instance with Class
const nodeB = new MscCollages();
document.body.appendChild(nodeB);
nodeB.theme = 2;
nodeB.collages = [ {...}, {...} ];

// new instance with Class & default config
const config = {
  theme: 3,
  collages: [
    {...},
    {...},
    ...
  ]
};
const nodeC = new MscCollages(config);
document.body.appendChild(nodeC);
</script>

Style Customization

<msc-collages /> uses CSS variables to hook uploader trigger theme & drop zone. That means developer could easy change it into the looks you like.

<style>
msc-collages {
  --msc-collages-gap: 1px;
  --msc-collages-overlay: #1d2228;
  --msc-collages-border-radius: 8px;
}
</style>

Attributes

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

  • theme

Set theme id for different usage. Developers could set 1 ~ 8 theme. Default is "1".

<msc-collages
  theme="1"
  ...
></msc-collages>
  • object-fit

Set image render property. This attribute only accept cover or contain. Default is "cover".

<msc-collages
  object-fit="cover"
  ...
></msc-collages>
  • collages

Set collages data. This should be JSON string and each element needs contains "link"、"src"、"alt"、"target" for rendering. Max count is 4.

<msc-collages
  collages='[{"link":"?","src":"https://picsum.photos/300/300?grayscale&random=1","alt":"grayscale 1","target":"_blank"}]'
  ...
></msc-collages>

Properties

| Property Name | Type | Description | | ----------- | ----------- | ----------- | | theme | String | Getter / Setter for theme id. | | object-fit | String | Getter / Setter for image render property. Only accept "cover" or "contain" | | collages | Object | Getter / Setter for collages data. |

Events

| Event Signature | Description | | ----------- | ----------- | | msc-collages-click | Fired when clicked. Developers could get original click event from event.detail.baseEvent to do preventDefault behavior. |

Reference