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

ui-scaler

v1.0.5

Published

Your best ally for easily building responsive web applications

Readme

ui-scaler

Your best ally for easily building responsive web applications:

Build your interface in one single resolution, and let the package take care of the rest, scaling your sizes, paddings, margins, font-sizes, and more for all desktop resolutions

It works with a single line of execution, and has great synergy with any library or framework that uses the rem unit

Demo

ui-scaler will make sure your app proportions and relative sizes are the same across all desktop resolutions. The effect is most recognized in higher screen resolutions:

UI scaler demo

You will also notice an easier experience when adjusting the UI for portrait or mobile resolutions, since all elements proportions will look good, leaving to you just the effort of repositioning and realigning the elements

UI scaler portrait demo

Advantage

You don’t need to waste time checking or adjusting your interface across different desktop screen resolutions — it will look virtually the same on all of them.

Usage

There are two usage methods:

1. NPM

npm i ui-scaler

Then in your app entry point:

// main.js|ts
import scaleUI from 'ui-scaler'

...

// last line
scaleUI()

2. Script tag (CDN or local file)

Add to your index.html:

<head>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/browser-bundle.min.js"></script>
</head>

How it's done

A script will be added to your app, which:

  1. Has 8kb
  2. Runs once the document is ready
  3. Adds a window resize event listener that updates the HTML element font-size, based on the screen resolution, and the browser font-size
  4. Optionally, adds styles transformation logic that convert pixel values to rem values (see how to activate below)

Notice your app HTML font-size to be different in each screen resolution

All properties with rem values will respond, and adjust accordingly

Font-size styles take in consideration the user browser font-size definition, so we have a web accessible compliant solution

Options

You can pass an argument to the scaleUI(boolean | TransformPixelsOptions) method, instructing the script to attempt to convert pixel values to rem:

Default transform options example

The script will try to convert all document pixel styles to the respective rem definition

// main.ts
import scaleUI from 'ui-scaler'

...

scaleUI(true)

Custom transform options example

The script will try to convert all document pixel styles to the respective rem definition, excluding border-radius attributes, and elements with myCustomId id or my-custom-class class

// main.ts
import scaleUI from 'ui-scaler'

...

scaleUI({
  excludeAttributes: ['border-radius'],
  excludeSelectors: ['#myCustomId', '.my-custom-class']
})

Bypassing transformations

You can also add the ignore-ui-scaler class to any HTML element so the script transformations do not have effect. Example:

<style>
.width-300 {
  width: 300px;
}
/* Auto-generated class definition - done by the transformation script */
.width-300:not(.ignore-ui-scaler) {
  width: 18.75rem;
}
</style>

<div class="width-300 ignore-ui-scaler">
  My width will remain in pixels!
</div>

HTML options binding

In case you are using the <script src="..."></script> installation method, and want to transform pixels, you can add a data-ui-scaler-opts attribute to your HTML tag element:

<html data-ui-scaler-opts="true">
...
</html>

or

<html data-ui-scaler-opts="{ excludeAttributes: ['border-radius'] }">
...
</html>