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

where-was-i

v0.4.5

Published

A plugin for your page to display an interactive history of your users session

Downloads

59

Readme

A plugin for your page to display an interactive history of your users session

Demo

🏠 Homepage

Install

Where Was I? is available as a module through npm or as a CDN.

Npm install:

npm install -S where-was-i

And then in the root of your project:

import whereWasI from 'where-was-i'

whereWasI()

Or via CDN, add Where Was I? with dependencies manually to the <head> element of your site:

<script
  src="//cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"
  defer
></script>
<script
  src="//cdn.jsdelivr.net/npm/[email protected]/lib/index.iife.min.js"
  defer
></script>

Note: Where Was I? depends on html2canvas, which is not included in the CDN.

Then initiate it:

<script>
  if (typeof WhereWasI !== 'undefined' && typeof html2canvas !== 'undefined') {
    WhereWasI()
  }
</script>

Options

Where Was I? offers a lot of customizability to tailor the plugin to fit your needs

Types

ShowButtonPostionType Specifies the position of the show button.

type ShowButtonPostionType =
  | 'bottom-left'
  | 'bottom-right'
  | 'top-left'
  | 'top-right'

ShowButtonOptions Options for customizing the show button.

type ShowButtonOptions = {
  /** The position of the show button */
  position?: ShowButtonPostionType
  /** Custom HTML for the show button */
  html?: string
  /** Custom color for the show button */
  color?: string
}

FooterOptions Options for customizing the footer.

type FooterOptions = {
  /** Hide the footer */
  hide?: boolean
  /** Custom HTML for the footer */
  customHtml?: string
}

WhereWasIOptions Options for configuring "Where Was I?".

type WhereWasIOptions = {
  /** The title to display in the control panel. @default "Where was i?" */
  panelTitle?: string
  /** The maximum amount of location objects to display */
  maxAmount?: number
  /** The style for the location objects. @default "panel" */
  style?: 'cards' | 'panel' | 'drawer'
  /** How often the screenshot should refresh in milliseconds. @default 15000 */
  screenRefreshRate?: number
  /** Adds filter to which paths should be added as location objects */
  acceptedPaths?:
    | {
        /** Path should contain the following string */
        type: 'contains'
        path: string
      }
    | {
        /** Path should start with the following string */
        type: 'startsWith'
        path: string
      }
  /** Get the content of meta fields to use as metadata along each screenshot */
  metafields?: Array<string | Array<string>>
  /** html2canvas options, see https://html2canvas.hertzen.com/configuration for all options */
  canvasOptions?: CanvasOptions
  /** Set log level */
  logging?: 'debug' | 'default'
  /** Z-index of the container. @default 1000 */
  zIndex?: string
  /** Storage type. @default "session" */
  storage?: 'session' | 'local'
  /** Auto close the drawer/panel when leaving. @default true */
  autoClosing?: boolean
  /** Styling options for the show button */
  showButtonOptions?: ShowButtonOptions
  /** Styling options for the footer */
  footerOptions?: FooterOptions
  /** Flag that the application is a SPA */
  isSpa?: boolean
  /** Callback function for navigating to previous location. Useful for SPAs with custom routing */
  navigationCallback?: (path: string) => void
  /** SPA basepath */
  basePath?: string
}

Example usage

const whereWasIOptions: WhereWasIOptions = {
  panelTitle: 'Recent Locations',
  maxAmount: 10,
  style: 'cards',
  screenRefreshRate: 20000,
  acceptedPaths: {
    type: 'contains',
    path: '/dashboard',
  },
  metafields: ['author', ['date', 'time']],
  canvasOptions: {
    logging: true,
    useCORS: true,
  },
  logging: 'debug',
  zIndex: '1500',
  storage: 'local',
  autoClosing: false,
  showButtonOptions: {
    position: 'bottom-right',
    html: '<img src="/my-icon.svg">',
    color: '#FF0000',
  },
  footerOptions: {
    hide: false,
    customHtml: '<footer>Custom footer</footer>',
  },
  isSpa: true,
  navigationCallback: (path: string) => {
    navigate(path)
  },
  basePath: '/app',
}

whereWasI(whereWasIOptions)

Author

👤 Gustaf Eriksson Segerdorf

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2024 Gustaf Eriksson Segerdorf. This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator