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

tightset

v0.1.5

Published

Variable-weight text fitting engine — fill any rectangle with kinetic typography

Readme

Every line stretches to fill the width, with heavier weight on larger lines. Works with any variable-weight font. Ships with React, Svelte, Vue, Angular, vanilla Canvas, and DOM/Tailwind renderers.

Install

npm install tightset

Quick Start

import { fit } from 'tightset'
import { render } from 'tightset/canvas'

await document.fonts.ready // always wait for fonts before canvas rendering

const result = fit('Every Line Fills The Width', {
  width: 800,
  height: 500,
  fontFamily: 'Inter',
})

render(document.querySelector('canvas'), result, {
  fontFamily: 'Inter',
  color: '#ffffff',
  background: '#0d0d0d',
})

Font loading: Canvas mode measures text via the Canvas 2D API, so the font must be fully loaded before calling fit(). Wait for document.fonts.ready or use the CSS Font Loading API. The framework components (tightset/react, tightset/vue, etc.) use canvas internally — ensure your fonts are loaded before they mount, or trigger a re-render once fonts are ready.

Packages

| Import | What | |--------|------| | tightset | Core engine: fit(), clearCache(), setMeasureContext() | | tightset/canvas | Canvas 2D draw() and render() | | tightset/dom | renderToHTML(), renderToDOM(), getLineStyles() — for Tailwind/CSS | | tightset/react | <Tightset> React component | | tightset/svelte | <Tightset> Svelte component | | tightset/vue | <Tightset> Vue component | | tightset/angular | <TightsetComponent> Angular standalone component |

React

import { Tightset } from 'tightset/react'

<Tightset
  text="Make It Tight"
  width={800}
  height={500}
  fontFamily="Inter"
  color="#fff"
  background="#000"
/>

Svelte

<script>
  import Tightset from 'tightset/svelte'
</script>

<Tightset
  text="Hello World"
  width={800}
  height={500}
  fontFamily="Inter"
  color="#fff"
  background="#000"
/>

Vue

<script setup>
import Tightset from 'tightset/vue'
</script>

<template>
  <Tightset
    text="Hello World"
    :width="800"
    :height="500"
    fontFamily="Inter"
    mode="html"
  />
</template>

Angular

Note: The Angular component is shipped as TypeScript source (not pre-compiled), so it cannot be consumed directly from node_modules with AOT compilation. Copy the component into your project from node_modules/tightset/dist/angular/tightset.component.ts, or use the source from src/angular.

// Copy tightset.component.ts into your project, then:
import { TightsetComponent } from './tightset.component'

@Component({
  standalone: true,
  imports: [TightsetComponent],
  template: `
    <tightset
      text="Make It Tight"
      [width]="800"
      [height]="500"
      fontFamily="Inter"
      color="#ffffff"
      background="#0d0d0d"
    />
  `,
})
export class MyComponent {}

Tailwind / DOM

import { fit } from 'tightset'
import { renderToHTML } from 'tightset/dom'

const result = fit('Style Me', { width: 800, height: 400, fontFamily: 'Inter' })
const html = renderToHTML(result, {
  fontFamily: 'Inter',
  containerClass: 'bg-black rounded-2xl',
  lineClass: 'tracking-tight drop-shadow-lg',
})

Or get style objects for JSX:

import { getLineStyles } from 'tightset/dom'

const styles = getLineStyles(result, { fontFamily: 'Inter' })
result.lines.map((line, i) => <div style={styles[i]} className="drop-shadow-lg">{line}</div>)

Options

| Option | Default | Description | |--------|---------|-------------| | width | — | Box width (px, required) | | height | — | Box height (px, required) | | fontFamily | 'sans-serif' | Font family name | | padX | 60 | Horizontal padding | | padY | 40 | Vertical padding | | gap | 20 | Line gap | | maxWeight | 900 | Heaviest font weight | | spread | 150 | Weight range (heavy − light) | | maxLines | 8 | Max lines | | uppercase | true | Uppercase transform |

Node.js / SSR

import { createCanvas } from 'canvas'
import { setMeasureContext, fit } from 'tightset'

setMeasureContext(createCanvas(1, 1).getContext('2d'))
const result = fit('Server Side', { width: 800, height: 400 })

Demo

Live demo → dmoptimal.github.io/tightset

Or run locally:

npx serve .
# Open http://localhost:3000/docs/

License

MIT