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

@ritterim/handholdjs

v0.1.9

Published

A configurable JavaScript hand held walk-through for user interfaces.

Downloads

2

Readme

handholdJS

A configurable JavaScript hand held walk-through for user interfaces.

Table of Contents

Installation

Install package via NPM.

npm install @ritterim/handholdJS

Adding to project

Import handholdJS into your project and instantiate it to a new variable.

main.js:

import Handhold from '@ritterim/handholdJS';
import '../path/to/node_modules/@ritterim/handholdJS/dist/style.css';

const handhold = new Handhold();

Creating steps

Create either a JSON file or JavaScript object and include the steps in an array:

handhold-config.json:

{
  "steps": [
    {
      "number": "1",
      "title": "Step 1",
      "description": "Lorem ipsum dolor sit amet"
    },
    {
      "number": "2",
      "title": "Step 2",
      "description": "Lorem ipsum dolor sit amet"
    },
    {
      "number": "3",
      "title": "Step 3",
      "description": "Lorem ipsum dolor sit amet"
    }
  ]
}

Customization

Inside your created JSON or JavaScript object, create a config property to include directions for customization:

handhold-config.json:

{
  "config": {
    // Config...
  },
  "steps": [
    // Steps...
  ]
}

You can customize the following Handhold elements:

  • boundingBox - Box that wraps around the highlighted element.
  • modal - Modal element where steps will be displayed.
  • nextButton - Button that moves to the next step.
  • previousButton - Button that moves to the next step.
  • finishBtn - Button that moves to the next step.

Each Handhold element can be customized using the following properties:

  • classList - An array of classes to be applied to the element.
  • style - An object containing CSS properties and values to apply to the element.

Full Example

handhold-config.json:

{
  "config": {
    "boundingBox": {
      "style": {
        "outlineStyle": "solid",
        "outlineColor": "var(--navy)"
      }
    },
    "finishBtn": {
      "classList": ["button", "button--orange", "text--white"]
    },
    "nextButton": {
      "classList": ["button"]
    },
    "previousButton": {
      "classList": ["button"]
    }
  },
  "steps": [
    {
      "number": "1",
      "title": "Step 1",
      "description": "Lorem ipsum dolor sit amet"
    },
    {
      "number": "2",
      "title": "Step 2",
      "description": "Lorem ipsum dolor sit amet"
    },
    {
      "number": "3",
      "title": "Step 3",
      "description": "Lorem ipsum dolor sit amet"
    }
  ]
}

Adding steps

Import the JSON file into your JavaScript and pass it into the .setup() method.

main.js:

import Handhold from '@ritterim/handholdJS';
import '../path/to/node_modules/@ritterim/handholdJS/dist/style.css';
import handholdConfig from '../path/to/handhold-config.json'

const handhold = new Handhold();
handhold.setup(handholdConfig);

Initiate Handhold

Call the .init() method.

main.js:

import Handhold from '@ritterim/handholdJS';
import '../path/to/node_modules/@ritterim/handholdJS/dist/style.css';
import handholdConfig from '../path/to/handhold-config.json'

const handhold = new Handhold();
handhold.setup(handholdConfig);
handhold.init();

Matching steps to DOM elements

Inside your HTML you must include a clickable "start" element and pair the steps to relevant HTML elements.

On the start element, apply the data-handhold-start data attribute.

On related HTML elements add the data-step attribute and give it the value of the corresponding step number you want to display.

index.html:

<!-- On start button: -->
<button type="button" data-start-handhold>
  Start Product Tour
</button>

<!-- On elements: -->
<div class="element" data-step="1">
  <p>Lorem Ipsum</p>
</div>
<div class="element" data-step="2">
  <p>Lorem Ipsum</p>
</div>
<div class="element" data-step="3">
  <p>Lorem Ipsum</p>
</div>

Developer Notes

Project setup

  • Fork repo and clone to local machine
  • Inside the project, run npm install to install all dependencies
  • Start the project by running npm run dev

Dependencies

  • Autoprefixer
  • PostCSS
  • PostCSS CLI
  • Sass
  • Vite
  • Vite Plugin Banner