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

@aofl/picture

v3.14.1

Published

`<aofl-picture>` serves as a container for zero or more `<aofl-source>` and one `<aofl-img>` elements to provide versions of an image for different display sizes. Display size specific sources are defined using the media attribute of the `aofl-source` ele

Downloads

596

Readme

@aofl/picture

<aofl-picture> serves as a container for zero or more <aofl-source> and one <aofl-img> elements to provide versions of an image for different display sizes. Display size specific sources are defined using the media attribute of the aofl-source element.

Api Documentation

Examples

  • https://stackblitz.com/edit/1-0-0-aofl-picture?embed=1&file=js/example-component/template.js

Installation

npm i -S @aofl/picture

Usage

<aofl-picture>
  <aofl-source media="(max-width: 320px)" srcset="https://via.placeholder.com/300x150" width="300" height="150"></aofl-source>
  <aofl-source media="(max-width: 500px)" srcset="https://via.placeholder.com/500x250" width="500" height="250"></aofl-source>
  <aofl-source media="(max-width: 700px)" srcset="https://via.placeholder.com/700x350" width="700" height="350"></aofl-source>
  <aofl-img src="https://via.placeholder.com/1000x500" width="1000" height="500"></aofl-img>
</aofl-picture>

Attributes

| Attributes | Type | Default | Description | |-----------------|---------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | disable-sources | Boolean | false | disable-sources can be used to deactivate the media query checks when aofl-picture loads. It is useful for cases where the desktop version of the app is not responsive. |

<aofl-img> embeds an image into the document. It behaves similarly to <img> with the addition of lazy loading images as they scroll near the visible area of the screen. The current formula is 2x height or width. In addition to this <aofl-img> can be combined with <aofl-picture> and <aofl-source> to provide different images for different display sizes.

Examples

  • https://stackblitz.com/edit/1-0-0-aofl-img?embed=1&file=js/example-component/template.js
  • https://stackblitz.com/edit/1-0-0-aofl-img-scroll?embed=1&file=js/example-component/template.js

Usage

<aofl-img src="path/to/image" width="100" height="100" alt="image description"></aofl-img>

attributes

| Attributes | Type | Default | Description | |------------|--------|-----------|-------------------------------------------------------| | src | String | undefined | Image url | | width | Number | undefined | Width of image in pixels. | | Height | Number | undefined | Height of image in pixels. | | alt | String | undefined | Defines an alternative text description of the image. |

AoflSource component must be used as a child of aofl-picture and specifies images for different media queries.

Examples

  • https://stackblitz.com/edit/1-0-0-aofl-picture?embed=1&file=js/example-component/template.js

Usage

<aofl-picture>
  <aofl-source media="(max-width: 480px)" srcset="path/to/image-480"></aofl-source>
  <aofl-source media="(max-width: 640px)" srcset="path/to/image-640"></aofl-source>
  <aofl-source media="(max-width: 1024px)" srcset="path/to/image-1024"></aofl-source>

  <aofl-img src="path/to/image" width="" height=""></aofl-img>
</aofl-picture>

attributes

| Attributes | Type | Default | Description | |------------|--------|---------|---------------------------------------------------------| | media | String | | media query specifying when aofl-source becomes active. | | srcset | String | | Url of the image. |