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

shap

v1.1.3

Published

shap

Downloads

611

Readme

Shap · build status

A document evaluation tool, which also provides page access to the PV recording function, facilitates developers to control the quality of documents, and to build a better document. Checkout online demo.

Install

Installation via CDN

<script src="https://unpkg.com/shap"></script>

Installation via NPM

$ npm i shap -S

Examples

<div class="shap-container"></div>
new Shap({
  key: '980aeb0e-27b4-4922-a2dd-7e3452eb0f50',
  el: '.shap-container',
  hash: true,
  absence: /^\/#\/about/,
  dev: true
})

Options

key

Type: string

The key for your own project, generated by shap admin background.

el

Type: string | HTMLElement

DOM container for Shap, query by document.querySelector when el is string.

mode

Type: string Default: inline Options: inline|suspension

Determine the presentation of the tool, suspended or embedded.

hash

Type: boolean Default: false

Whether to use the hash mode, eg: mode: 'hash' in VueRouter. hash: true will match location.href.pathname and hash: false will match location.href.hash as the document patch in the absence of formatter function.

dev

Type: boolean Default: false

Api testing, data will not be stored on the server.

formatter

Type: function

Custom formatter document path function, will take formatter function return value as document path whether hash are supplied or not.

absence

Type: RegExp | function

No display on particular page, will not record PV on this page either. Will macth the string which replace origin in url when absence is RegExp. eg: location.href.replace(location.origin, '') Nothing will be shown when absence return value is false

leadin

Type: string Default: '这个页面有帮助吗?'

Custom leadin text, such as 以上内容是否对您有帮助? the default value is 这个页面有帮助吗?.

feedback

Type: string Default: '感谢您的反馈!'

custom feedback text, the default value is 这个页面有帮助吗?.

API

How Work With SPA

const shap = new Shap({ key: <Your Own Key>, el: '.shap-container' })
const router = new VueRouter({ /* options */ })

router.afterEach((to, from) => {
  shap.spa()
  // Your Code...
})

Change The Dom Status Dynamic

// change the shap mode
shap._vm.mode = 'suspension'
// change the leadin text
shap._vm.leadin = 'Shap\'s leadin'
// change the leadin feedback
shap._vm.feedback = 'Shap\'s feedback'
// toggle expansion state
shap._vm.spreading = false

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details