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

@gramex/ui

v0.3.1

Published

Commonly used UI components and interactions

Downloads

188

Readme

@gramex/ui

Commonly used UI components and interactions.

Installation

Install via npm:

npm install @gramex/ui

Formats

JavaScript supports the Intl object to format numbers, dates, lists, etc. based on locale.

These utility functions provide commonly used number, percentage and date formats.

Import the functions as:

import { num, num0, num2, pc, pc0, pc1 } from "https://cdn.jsdelivr.net/npm/@gramex/[email protected]/dist/format.js";

| | 0.0038 | 0.038 | 0.38 | 3.81 | 381 | 38,104 | 3,810,369.24 | | ----------: | -----: | ----: | ----: | -----: | -----: | --------: | -----------: | | num(val) | 0.0038 | 0.038 | 0.38 | 3.8 | 381 | 38K | 3.8M | | num0(val) | 0 | 0 | 0 | 4 | 381 | 38,104 | 3,810,369 | | num2(val) | 0 | 0.04 | 0.38 | 3.81 | 381.04 | 38,103.69 | 3,810,369.24 | | pc(val) | 0.38% | 3.8% | 38% | 381% | | pc0(val) | 0% | 4% | 38% | 381% | | pc1(val) | 0.4% | 3.8% | 38.1% | 381.0% |

  • num(value): Use by default. Shows 2-3 significant digits and shortens to "K", "M", etc.
  • num0(value): Integers. Use when values are typically between 1 - 1,000,000
  • num2(value): 2 decimal numbers. Use when values are typically between 1 - 1,000
  • pc(value): Use by default. Shows 2-3 digits
  • pc0(value): 0 decimal percent. Use if % is between 10-100% and never below 1%
  • pc1(value): 1 decimal percent. Use if % is between 1-10% and never below 0.1%

See the source to create your own formats. Refer to Intl.NumberFormat().

The following date formats are supported:

import { dmy, mdy, dm, md, wdmy } from "https://cdn.jsdelivr.net/npm/@gramex/[email protected]/dist/format.js";

| Function | 23 Jan 2023 | | ----------: | ---------------: | | dmy(val) | 23 Jan 2023 | | mdy(val) | Jan 23, 2023 | | dm(val) | 23 Jan | | md(val) | Jan 23 | | wdmy(val) | Mon, 23 Jan 2023 |

Dark theme

This code adds a dropdown to switch the Bootstrap color mode between light and dark themes.

Dark theme example

Source code

Setup

To run this project locally:

  • Clone this repo, and run npm install to install dependencies
  • Run npm run build to compile
  • Open index.html using a HTTP server (e.g. python -m http.server)

To release, run:

npm version minor
npm publish
git push --tags

Release notes

Authors

Anand S [email protected]

License

MIT