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

rms-sparklines

v0.2.3

Published

A sparkline collection, written as web components

Downloads

19

Readme

<rms-sparklines>

Build Status

New in version

[0.2.3] - 2018-09-01

  • Trying to fix a hard to understand bug in TRAVIS

[0.2.2] - 2018-09-01

  • Trying to fix a hard to understand bug in TRAVIS

[0.2.1] - 2018-09-01

  • Trying to fix a hard to understand bug in TRAVIS: Module parse failed: /home/travis/build/RodrigoMattosoSilveira/rms-sparklines-styleguide/node_modules/rms-sparklines/util-lib/src/util-lib.ts Unexpected token (10:33) You may need an appropriate loader to handle this file type.

[0.2.0]

  • Added tooltips to barchart; now all sparklines have tooltips

Description

This is a collection of web components to render sparklines, conceived by Edward Tufte. My motivation for this project is to use web component technology to implement sparklines. The project's overall concepts, but not source code, borrows extensively from Gareth Watts jQery project.

These webcomponents are built using the @nutmeg/cli; this document assumes you are familiar with it and the ancillary technologies required by @nutmeg/cli.

Sparkline portifolio

Source code

Check rms-sparklines for the web components repository.

Check rms-sparklines-styleguide for the repository of an Angular web application illustrating their usage.

Live Application

You can navigate to rms-sparklines-styleguide to see a live version of the Angular web application illustrating their usage.

Installation

Cloning this repository:

  • $ cd ~
  • $ git clone https://github.com/RodrigoMattosoSilveira/rms-sparklines

Initialize the sparklines

  • $ cd ~/rms-sparklines
  • $ npm run setup

This will take a few minutes, and does the following

  • For each sparkline package
    • Installs the packages required by each sparkline package
    • Builds the sparkline package
    • Tests the sparkline

Note that this same script is used to tell the continuous development framwework to build and test all sparklines.

Write a new @rms/sparkline web component

The following steps are required:

  • Web Component Development
  • Show case the new web component in the style guide *

Install rms-sparklines

If not already installed, install according to the instructions above.

Create a @rms/sparkline web component

I use the nutmeg-cli to generate web components; see the instructions therein for details:

  • $ cd ~/rms-sparklines
  • $ nutmeg new rms-sparkline-awesome attribute_1:attribute_type ... attribute_4:attribute_type

This will create a new folder, rms-sparklines-awesome, including a scaffold for the new web component

Develop and publish the new component

I reflect the patterns in the existing @rms/sparkline web components to set up the new web component:

  • create a draw (): HTMLCanvasElement function.
  • empty the private get styles(): TemplateResult function, return only <style></style> for now.
  • update the private get template(): TemplateResult function to return the results of the get styles() and draw() functions.
  • update the getter methods to return default values were appropriate.
  • Update the unit tests to validate the handling of default attributes, and changed attributes; once the sparkline is complete, then include the image generation validation.
  • Renamde the readme.md to README.md and document your component requirements; keep this file updated as your component gains life.
  • Hook up rms-sparkline-awesome to rms-sparklines
    • Add an index.js file, exporting the component: export * from 'dist/rms-sparkline-awesome';
    • Update the ~/rms-sparklines/index.js to the component: export * from './rms-sparkline-awesome;'

Update the ~/sparklines/app/setup.sh script to initialize rms-sparkline-awesome

  • Add the relative web component path to the setup.sh script webComponents arraysetup.sh
#!/usr/bin/env bash

declare -a webComponents=("rms-sparkline-inline" \
. . . \
"rms-sparkline-bar-awesome"
)

. . . 

Develop unit tests for the new @rms/sparkline web component.

Ensure the web component's logic is covered by unit tests, and that the existing tests pass:

  • $ cd ~/rms-sparklines/rms-sparline-awesome
  • $ ng run test

Show case the new web component in the style guide

See the @rms/sparkline README for instructions

Publish the new @rms/sparkline web component.

This is done in the root directory:

  • $ cd ~/rms-sparklines
  • Increment packages.json version using semver notation
  • $ npm publish

See the rms-sparklines-styleguide. README for instructions on how and when to use the web component's published and under development versions.

Note that the publishing is done in the library's not the web component's root folder.

Update an existing @rms/sparkline web component

Similar as when creating a new component, except that you will skip the create component steps.

Last but not least

 _   _                   _____            
| | | | __ ___   _____  |  ___|   _ _ __  
| |_| |/ _` \ \ / / _ \ | |_ | | | | '_ \ 
|  _  | (_| |\ V /  __/ |  _|| |_| | | | |
|_| |_|\__,_| \_/ \___| |_|   \__,_|_| |_|