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

mithril-tour-component

v1.0.4

Published

Tour Guide Component for Mithril.js

Downloads

3

Readme

Mithril Tour Component

Tour Guide Component for Mithril.js

version License Downloads Dependencies

Install

Usage

Node.js / Browserify

var m = require('mithril')
var TourComponent = require('mithril-tour-component')

Note: lib/styles/tour.css is also required.

Browser

<link href="path/to/mithril-tour-component/lib/styles/tour.css" rel="stylesheet" />
<script src="path/to/mithril.js" type="text/javascript"></script>
<script src="path/to/mithril-tour-component/build/tour.min.js" type="text/javascript"></script>

Documentation

TourComponent

Creates and returns a component class constructor which takes two arguments:

Function TourComponent (Object options, Array Indicators)

Options

  • skipped - Boolean - Disable rendering of indicators completely.
  • dismissed - Array - Array of indicators that have been skipped. Useful for those remembering where the user is occasions.
  • onskip - Function(event, identifier) - Global skip handler
  • ondismiss - Function(event, identifier) - Global dismiss handler

Example:

var dismissed = [1]
var skipped = false

TourComponent({
  skipped: skipped,
  dismissed: dismissed,

  ondismiss: function (event, identifier) {
    dismissed.push(identifier)
    // save to localstorage, etc.
  },

  onskip: function (event, identifier) {
    skipped = true
    // save to localstorage, etc.
  }
}, /* ... Indicators ... */)

Indicators

Each indicator is an Object that contains properties the properties of an Indicator are as follows:

  • id - Number / String - Indicator / Tooltip identifier, Optional
  • x - Number - x position on the page, Optional when using .element
  • y - Number - y position on the page, Optional when using .element
  • element - Object - Attach indicator to element
  • element.selector - String - Target element selector
  • element.position - Possible options include: right, left, bottom right, bottom left, top right, top left, top, bottom
  • element.offset - Object - x and y offsets, Optional
  • ondismiss - Function(event, identifier) - When a tooltip / indicator is dismissed (removed from page)
  • onclick - Function(event, identifier) - When the indicator is clicked on.
  • onskip - Function(event, identifier) - When the tour is completely skipped (all indicators are removed.)
  • onclose - Function(event, identifier) - When the tooltip backdrop is closed (not considered dismissing / confirming)
  • tooltip - Object - Tooltip settings
  • tooltip.content - Array - Mithril children placed in the content section of the tooltip
  • tooltip.footer - Object - Tooltip footer settings
  • tooltip.footer.skipText
  • tooltip.footer.skipLinkText
  • tooltip.footer.dismissText

Example:

TourComponent(/* ... options ... */, [{
  id: 1, // optional

  element: {
    selector: '.rotate-button',
    position: 'right',

    // Offset defaults
    offset: {
      x: 5,
      y: 10
    }
  },

  tooltip: {
    content: [
      m('p', 'Rotate list of links when clicked, give it a whirl!')
    ],

    footer: {
      skipText: 'Been here before? ',
      skipLinkText: 'Yes, disable tour!',
      dismissText: 'Thanks!'
    }
  }
}])

Example Usage

See index.html

Building

  1. npm install -g browserify uglify-js
  2. npm run build

License

Licensed under The MIT License.