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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@opentagcloud/core

v0.6.0

Published

Framework-agnostic layout engine, vanilla-JS renderer, and stylesheet for openTagCloud — a dependency-free, self-packing, SSR-friendly tag cloud.

Downloads

1,203

Readme

@opentagcloud/core

Framework-agnostic core of openTagCloud — a dependency-free, self-packing, SSR-friendly tag cloud. This package is the layout engine plus a vanilla-JS renderer; framework adapters (opentagcloud for Svelte, @opentagcloud/react, @opentagcloud/vue, @opentagcloud/angular, @opentagcloud/solid, @opentagcloud/next) are thin wrappers over it.

Vanilla usage

import { renderTagCloud } from '@opentagcloud/core';

const cloud = renderTagCloud(document.querySelector('#cloud'), [
  { label: 'JavaScript', weight: 95, href: '/tags/javascript' },
  { label: 'TypeScript', weight: 88 },
  { label: 'Rust', weight: 60, color: 'tomato' },
]);

cloud.update(newItems); // replace items and re-pack
cloud.destroy(); // stop observing, remove tags

Give the container a sized parent; the cloud packs to its width and grows its min-height to fit. Styles are injected at runtime — no CSS setup needed. For server-rendered pages, also ship @opentagcloud/core/styles.css so the no-JS fallback (justified inline flow) is styled before hydration.

Script tag / custom element (no build step)

The package also ships a browser global (dist/opentagcloud.vanilla.js, the unpkg/jsdelivr entry) that registers a light-DOM <otc-tag-cloud> custom element and exposes openTagCloud.mount(container, items, options):

<script src="https://unpkg.com/@opentagcloud/core/dist/opentagcloud.vanilla.js"></script>

<otc-tag-cloud
  style="height: 320px"
  items='[{ "label": "Rust", "weight": 60 }]'
>
</otc-tag-cloud>

mount() and defineElement() are also exported from the package root and the ./vanilla subpath for ES-module consumers (call defineElement() to register the element). Both are thin wrappers over renderTagCloud — same engine, same markup contract. Try the live vanilla example or view the example source.

SSR height estimation

estimateCloudHeight(items, width, options?) is pure and DOM-free: emit it as the container's min-height during SSR to reserve space and avoid layout shift (roughly ±25% of the real packed height).

Building your own adapter

  • prepareTags(items, { minPx, maxPx }) — pure and DOM-free: returns each tag's font size, opacity, key, display text, and inline style. Call it in your template layer (works during SSR).
  • Render one element per prepared tag with its className, style, title, and data-fs / data-weight / data-key attributes, inside a container with class otc-cloud. Render its parts as the content — nowrap parts go in a <span class="otc-nb"> so lines never break at a hyphen while the DOM text stays byte-identical to the label.
  • new TagCloudLayout(container, { fill }).attach() on mount; refresh() after the tags change; destroy() on teardown. All methods are no-ops without a DOM.

See the project README for props, theming, and how the packer works.

License

MIT © Henry Koren