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

@sifrr/elements

v0.0.5

Published

Sifrr elements.

Downloads

4

Readme

sifrr-dom elements

List of Elements:

| Elements | Description | Size | Test | | :------------------------------------------------------ | :------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-----------------------------------------------: | | sifrr-stater | State manager for sifrr elements, save them to storage, replay state changes, travel to past state | Minified + Gzipped | [WIP] | | sifrr-tabs | Android like tabs in browser | Minified + Gzipped | [WIP] | | sifrr-lazy-picture | Lazy loading pictures only when in view | Minified + Gzipped | OK | | sifrr-lazy-img | Lazy loading images only when in view | Minified + Gzipped | OK | | sifrr-progress-round | Circular progress circle | Minified + Gzipped | OK | | sifrr-code-editor | Code editor with syntax highlighting using highlight.js | Minified + Gzipped | [WIP] | | sifrr-showcase | Showcase sifrr-dom elements | Minified + Gzipped | [WIP] | | sifrr-include | Async include html/js/css with url elements | Minified + Gzipped | OK |

View examples

Examples as showcase: https://sifrr.github.io/sifrr-elements/showcase/ (only desktop friendly)

Packages that have tests have a working example of that package in test/public folder

Usage

Using direct distribution file

Script tag

// load sifrr-dom
<script src="https://unpkg.com/@sifrr/sifrr@{version}/packages/browser/sifrr-dom/dist/sifrr.dom.min.js"></script>
// load element you want to add
<script src="https://unpkg.com/@sifrr/elements@{version}/elements/element-name/dist/elementname.min.js"></script>
// for v0.0.3, version = 0.0.3

Script Module tag

// load sifrr-dom
<script src="https://unpkg.com/@sifrr/sifrr@{version}/packages/browser/sifrr-dom/dist/sifrr.dom.module.js" type="module"></script>
// load element you want to add
<script src="https://unpkg.com/@sifrr/elements@{version}/elements/element-name/dist/elementname.module.js" type="module"></script>
// for v0.0.3, version = 0.0.3

Sifrr.Dom.load

Sifrr.Dom.load('element-name', { url: "https://unpkg.com/@sifrr/elements@{version}/elements/element-name/dist/elementname.min.js" })

NPM module

add @sifrr/elements package, yarn add @sifrr/elements

require/import needed elements

const SifrrDom = require('@sifrr/dom');
const { SifrrLazyPicture } = require('@sifrr/elements');
//or
import SifrrDom from '@sifrr/dom';
import { SifrrLazyPicture } from '@sifrr/elements';

// Register
SifrrDom.register(SifrrLazyPicture);

Helpers

LazyLoader

Since lazy-image and lazy-picture doesn't work with safari, you can simply use LazyLoader helper to lazy load native images and pictures.

Lazy loads a image when it is near viewport, using data-src and data-srcset.

usage:

// In HTML <img data-src="url" class="lazy">
// // supports picture tag also

import { LazyLoader } from '@sifrr/elements';

const lazyLoader = new LazyLoader(rootMargin /* same as mutation observer's rootMargin, default: '0px 0px 0px 0px' */);

lazyLoader.observe(document.querySelector('.lazy'));

// or multiple images
document.querySelectorAll('.lazy').forEach(lazyLoader.observe);

// observed images' data-src will be changed to src when rootmargin condition is satisfied

License

sifrr-elements is MIT Licensed.

FOSSA Status

(c) @aadityataparia