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

@redbuck/intro

v0.0.4

Published

Step-by-step guide

Downloads

3

Readme

截图上传组件

简介

一个简单的引导插件. 支持事件钩子并跳过步骤. umd格式,可<script>和import引入使用.

Live Code

安装

js: npm i @redbuck/introyarn add @redbuck/intro

css: 位于@redbuck/intro/lib/intro.css

使用

const intro = new Intro(options)

options:

属性 | 类型 | 默认值|描述 --:|--:|--:|--: steps| Array | []|步骤 stepCount|Number|1|播放次数 storageKey|String|'intro_play_count'|标识播放次数

steps为一个成员为对象(step)的数组.对象必须包含el,text字段

其中,el字段应为DOM对象,或DOM对象组成的数组,或者是返回前述类型的函数.

引导窗将聚焦这个(些)DOM围合成的矩形. text字段将自动排布在剩余方向中,最大的一个.

实例支持浏览器事件风格绑定回调.

intro.on(event, callback)

支持事件

事件|参数|描述 --:|--:|--:| before-next|{step, next, skip}|下一步之前,传入下一步step对象,调用next以继续插件流程,也可以调用skip跳过该步骤 done|无|结束事件

示例

查看static/demo.html获取全部详情

const intro = new Intro({
  playCount: 3,
  steps: [
	{
	  el: $('#left'),
	  text: '点击这里,打开新世界大门!',
	},
	{
	// el can be on array
	  el: [$('#block1'), $('#block2'), $('#block3')],
	  text: '根据你想【赠送的奖励】,选择不同的活动类型',
	},
	{
	  el: $('#block4'),
	  text: '选择第5项活动',
	},
	{
	  el: $('#block6'),
	  text: '当你同时要赠送多种奖励时,请选择组合送吧!',
	},
	{
	  el: $('#item1'),
	  text: '点这里,可以查看和管理所有的活动1',
	},
	{
	  el: $('#item2'),
	  text: '点这里,可以查看和管理所有的活动2',
	},
	{
	  el: $('#item3'),
	  text: '点这里,可以查看和管理所有的活动3',
	},
	{
	  el: $('#item4'),
	  text: '点这里,可以查看和管理所有的活动4',
	},
	{
	  el: $('#item5'),
	  text: '点这里,可以查看和管理所有的活动5',
	},
  ],
})

// if you did not listen this event, intro will auto next
intro.on('before-next', async ({step, next, skip}) => {
  // do something
  console.log('before-next', step)
  // continue this step
  if (step.el) {
	next()
  }
  // you can skip this step
  else {
	skip()
  }
})