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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@micx/lib-js

v2.0.2

Published

Setting the global Subscription Id:

Readme

micx-lib-js

General

Usage

Setting the global Subscription Id:

<html>
<head>
    <script>
        window["micx_subscription_id"] = "Subscritpion Id";
    </script>

FormMailer

Send E-Mail from a Website to a E-Mail Address.

Usage in Html Context

Observe all <form data-micx-formmail-preset="preset-name" data-micx-formmail-sent-message="E-Mail erfolgreich gesendet!"> elements:

<form data-micx-formmail-preset="preset-name" data-micx-formmail-sent-message="E-Mail erfolgreich gesendet!">
    <input type="text" name="name" placeholder="Name" data-invalidMsg="Bitte gültige E-Mail der Form [email protected] eingeben">
</form>
(new MicxFormmailFacade()).observe();

Api Access

var formmail = Micx.formMailApi;
await formmail.sendData({
    "key": "value"
}, "preset-name");      

CDN Image

Load optimally sized images from the MICX CDN by simply pointing your <img> tags to a v2-encoded CDN URL. The micx-cdn-image-loader custom element observes images in its subtree, detects CDN URLs, computes the best fitting width for the current element size and screen, and swaps in the high‑resolution image. Non-CDN images are ignored.

Example (HTML):

<micx-cdn-image-loader default-size-adjust=":1.5;1200:1">
  <!-- Detects the v2 URL, pre-renders a preview, then loads the best width -->
    ...
  <img src="https://cdn.leuffen.de/leuffen/v2/abc123/d_gfedcba/hero.jpg_webp" data-size-adjust=":1.25;1600:1">
    ...
</micx-cdn-image-loader>

What is does:

  • It adds a loading="lazy" attribute to all <img> elements that match the CDN v2 URL pattern and have no loading attribute.
  • It adds a data-src attribute to all <img> elements that match the CDN v2 URL pattern and not have a data-src attribute.
  • It sets the height and width attributes of the <img> element to the original image size, if not already set.
  • It adds the filename to the alt attribute of the <img> element, if not already set.
  • It switches the src attribute to a high‑resolution image URL based on the current element size and screen size, while keeping the original URL as a background preview.

How it works:

  • Detection: The loader watches for <img> elements. If the src (or data-src) matches the CDN v2 pattern (e.g. v2/<id>/<aspect>_<widths>/<filename>.<exts>), it takes over.
  • Preview then swap: It keeps the original URL as a background preview, computes the best width based on the element’s rendered size and a configurable scale, then sets src to the computed high‑res URL. When loaded, the preview is removed and a loaded class is added.
  • Sizing logic: The URL encodes an aspect ratio and a set of available widths (often using shortcuts, e.g. d = 16-9, g..a = 2560..260). The loader picks the smallest width that is still >= required pixels.
  • Lazy and eager: If loading="eager" is set, the high‑res image is loaded immediately (ideal for LCP). Otherwise it waits for the preview to load first.
  • Adjust scale: Use data-size-adjust on an individual image or default-size-adjust on the micx-cdn-image-loader to influence up/down-scaling per screen size. Format: ":;480:;1200:" (example: ":2;480:1.5;1200:1").
  • Resize aware: On window resize, the loader re-evaluates and may reload a better fitting size.