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

tour

v2.0.3

Published

A simple, minimalist touring and on-boarding library for javascript

Downloads

1,212

Readme

Tour

A simple, minimalist touring and on-boarding library for javascript

Join the chat at https://gitter.im/tourjs/tour

Awesome Demo

Features

  • Supports single page apps, and complex scrollable content
  • Responsive & Intelligent
  • Automagic Positioning
  • Promise Driven Events & Hooks
  • Tour does not manipulate or relayer your DOM elements in any way

Installation

Install via npm

$ npm install tour --save

or CDN

https://npmcdn.com/tour@latest/dist/tour.js https://npmcdn.com/tour@latest/dist/tour.css

Import JS and CSS

// ES6+
import Tour from 'tour'

// CommonJS
const Tour = require('tour').default

// Vanilla
var Tour = window.Tour.default
@import 'node_modules/tour/dist/tour.css'

Simple Usage

const myTour = {
	canExit: true,
	nextText: 'Proceed!',
	steps: [{
		target: '#first-element',
		content: 'This is the first step!',
	}, {
		target: '.some .other .element',
		content: 'Blah blah blah. I prefer to show up on the right.',
		placement: [ 'right', 'top', 'bottom', 'left' ],
	}, {
		target: '#menu-element',
		content: 'I guess this is a menu!',
	}, {
		target: '#last-element',
		content: 'It is over! :(',
	}],
};

Tour.start(myTour)
  .then(() => {
    console.log('Tour Finished!');
  })
  .catch(() => {
    console.log('Tour Interrupted!')
  });

Config

Defaults:

{
	canExit: false, // Can exit the tour or not (via an X button)
	padding: 5, // Padding around the highlighted element
	maxHeight: 120, // Max height of the tooltip box
	maxWidth: 250, // Max width of the tooltip box
	maskVisible: true, // Shows the mask
	maskVisibleOnNoTarget: false, // Shows a full page mask if no target element has been specified
	maskClickThrough: false, // Allows the user to interact with elements beneath the mask
	maskScrollThrough: true // Allows the user to scroll the scrollbox or window through the mask
	maskColor: 'rgba(0,0,0,.7)' // The mask color
	scrollBox: 'body', // The container to scroll when searching for elements
	previousText: 'Previous',
	nextText: 'Next',
	finishText: 'Finish',
	showPrevious: true, // Setting to false hides the previous button
	showNext: true // Setting to false hides the next button
	animationDuration: 400, // Animation Duration for the box and mask
	placement: ['bottom', 'right', 'top','left'],
	dark: false, // Dark mode (Works great with `mask.visible = false`)
	disableInteraction: false, // Disable interaction with the highlighted elements
	disableEscExit: false // Disable end of tour when pressing ESC,
}

API

.start(tour)

  • Starts a Tour
  • Params:
    • tour: Tour Object
  • Returns:
    • Promise that resolves when the tour is finished or rejected when aborted.

.stop()

  • Stops a Tour
  • Returns:
    • Promise that resolves when the tour is stopped.

.next()

  • Goes to the next step in the current tour
  • Returns:
    • Promise that resolves when the next step is reached

.previous()

  • Goes to the previous step in the current tour
    • Promise that resolves when the previous step is reached

.goto(index)

  • Goes to a specific step in the tour

  • Params:

    • index: The 0-index number of the step eg. 0, 1, 2, 3
  • Returns:

    • Promise that resolves when the specific step is reached

Using Promise Event Hooks

You can pass any function that returns a promise to the before and after properties for any step. When the promise resolves, the tour moves on accordingly.

Example

var tour = {
	steps: [{
      target: '#first-element',
      content: 'This is the first step!',
    }, {
      target: '.some .other .element',
      content: 'Blah blah blah.',
      before: () => {
      	// Do something amazing
      	return new Promise()
    	}
    }, {
      target: '#menu-element',
      content: 'I guess this is a menu!',
      after: () => {
      	// Do some more cool stuff
      	return new Promise()
    	}
    }, {
      target: '#last-element',
      content: 'It is over! :(',
    }]
}

Roadmap & Contributing

All PR's and contributions are more than welcome!