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

wordfest

v1.0.0

Published

HTML word clouds with frequency.

Downloads

3

Readme

WordFest

WordFest is a npm package to create word clouds. However, unlike most word clouds, Wordfest does not rotate the words but aligns them in reading direction. Thereby it appears similar to festival lineups.

Installation

You can install WordFest using npm:

npm install wordfest

Usage

Quick Start

import { wordfest } from "wordfest";

const data = [
  { text: "apple", value: 10 },
  { text: "banana", value: 8 },
  { text: "orange", value: 6 },
  { text: "cherry", value: 3 },
  { text: "blueberry", value: 2 },
];

const wordCloudDiv = wordfest(data);
document.getElementById('wordCloudContainer').appendChild(wordCloudDiv);

Result:

image

Advanced Usage

WordFest provides flexibility through configuration options:

import { wordfest } from "wordfest";

const data = [
  { fruit: "apple", quantity: 10, fruitColor: 'green' },
  { fruit: "banana", quantity: 8, fruitColor: 'gold' },
  { fruit: "orange", quantity: 6, fruitColor: 'orange' },
  { fruit: "cherry", quantity: 3, fruitColor: 'red' },
  { fruit: "blueberry", quantity: 2, fruitColor: 'darkslateblue' },
];

const fruitConfig = {
  textProperty: 'fruit',
  valueProperty: 'quantity',
  colorProperty: 'fruitColor',
};

const wordCloudDiv = wordfest(data, fruitConfig);
document.getElementById('wordCloudContainer').appendChild(wordCloudDiv);

Result:

image

Styling

Wordfest's output is pure HTML and can therefore be styled via CSS.

import { wordfest } from "wordfest";

const data = [
  { text: "apple", value: 10 },
  { text: "banana", value: 8 },
  { text: "orange", value: 6 },
  { text: "cherry", value: 3 },
  { text: "blueberry", value: 2 },
];

const wordCloudDiv = wordfest(data);
const container = document.getElementById('wordCloudContainer')
container.appendChild(wordCloudDiv);
container.style.background = "linear-gradient(0deg, #00DBDE 0%, #FC00FF 100%)";
container.style.webkitTextFillColor = "transparent";
container.style.backgroundClip = "text";
container.style.width = "25em";

Result:

image

API Reference

wordfest(data: DataItem[], config?: WordFestConfig): HTMLDivElement

Generates a word cloud visualization from the provided input data.

  • data: An array of JavaScript objects containing word data.
  • config (optional): An object that customizes word cloud behavior. Available options:
    • textProperty: Specifies the name of the property in data objects to use as word text (default: 'text').
    • valueProperty: Specifies the name of the property to use for scaling word sizes (default: 'value').
    • colorProperty: Specifies the name of the property for individual text colors (default: 'color'). If no color is specified, the the default text color is used.