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

@frankhoodbs/image-cmp

v1.2.8

Published

Image utility wrapper

Downloads

360

Readme

Image Cmp

A component that allows displaying images optimized for various devices and formats, ensuring that the browser loads the most appropriate image based on its capabilities and the user's device size.

Componente che consente di visualizzare immagini ottimizzate per diversi dispositivi e formati, garantendo che il browser carichi l'immagine più appropriata in base alle sue capacità e alle dimensioni del dispositivo dell'utente.

Version License

API Reference

Props

| Name | Type | Description | |:------------------------|:-------------------------|:--------------------------------| | data-grid-breakpoints | Record<string, string> | Required Breakpoint Object. | | data-sources | Source[] | Source items, see below. |

SourceItem

type definition for each item in data-sources prop

| name | Type | Description | |:--------------------|:----------|:--------------------------------------------------------------------------| | type | string | Image format, can be null. | | switch_breakpoint | string | Indicates at which breakpoint the srcset should switch, can be null. | | srcset | string | Different image to load, based on different type or different breakpoint. |

You can use this prop to switch the image at different breakpoints, put at least 2 element, a desktop and a mobile image, the order is important, put the images with the highest breakpoint first and proceed in DESC order.

[
  {
    type: null,
    switch_breakpoint: 'lg',
    srcset: '/image3.png',
  }, // Desktop image
  {
    type: null,
    switch_breakpoint: 'md',
    srcset: '/image2.png',
  }, // Tablet image
  {
    type: null,
    switch_breakpoint: null,
    srcset: '/image1.png',
  }, // Mobile image
]

You can use this prop to load image in different format

[
  {
    type: 'image/avif',
    switch_breakpoint: null,
    srcset: '/image2.png',
  }, // avif
  {
    type: 'image/webp',
    switch_breakpoint: null,
    srcset: '/image1.png',
  }, // webp
]

CSS theme classes

| Name | Description | |:-----------------|:-----------------------------------------------------------------------------| | .bg-image | If present on the component instance the image is treated like a background. | | .left-top | Works in combination with .bg-image. Set the object-position. | | .left-center | Works in combination with .bg-image. Set the object-position. | | .left-center | Works in combination with .bg-image. Set the object-position. | | .left-bottom | Works in combination with .bg-image. Set the object-position. | | .center-top | Works in combination with .bg-image. Set the object-position. | | .center-center | Works in combination with .bg-image. Set the object-position. | | .center-bottom | Works in combination with .bg-image. Set the object-position. | | .right-top | Works in combination with .bg-image. Set the object-position. | | .right-center | Works in combination with .bg-image. Set the object-position. | | .right-bottom | Works in combination with .bg-image. Set the object-position. | | .fill | Works in combination with .bg-image. Set the object-fit. | | .contain | Works in combination with .bg-image. Set the object-fit. | | .cover | Works in combination with .bg-image. Set the object-fit. | | .none | Works in combination with .bg-image. Set the object-fit. | | .scale-down | Works in combination with .bg-image. Set the object-fit. |

Usage/Examples

<image-cmp
  :data-sources="[
    {
      type: null,
      switch_breakpoint: 'lg',
      srcset: 'https://picsum.photos/id/100/1440/800',
    },
    {
      type: null,
      switch_breakpoint: 'md',
      srcset: 'https://picsum.photos/id/101/1024/560',
    },
    {
      type: null,
      switch_breakpoint: null,
      srcset: 'https://picsum.photos/id/102/767/943',
    },
  ]"
  :dataGridBreakpoints="gridBreakpoints"
>
  <img
    width="1440"
    height="800"
    src="https://picsum.photos/id/100/1440/800"
    alt="Demo image"
  />
</image-cmp>