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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-smart-gesture

v0.0.2

Published

A Vue.js project

Downloads

7

Readme

vue-smart-gesture

这是 smart-gesture 的 vue 版本, 在线 demo

安装

npm install --save vue-smart-gesture

Usage

<template>
  <div v-smart-gesture="options"></div>
</template>

<script>
  import smartGesture from 'vue-smart-gesture';

  export default {
    data() {
      return {
        //initial options
        options: {
          enablePath: true,
          timeDelay: 100,
          lineColor: '#666',
          lineWidth: 4,
          triggerMouseKey: 'right',
          activeColor: 'rgba(0, 0, 0, .05)',
        },
      };
    },
    directives: {
      smartGesture
    },
    events: {
      'smart-gesture-onswipe': function(list) {},
      'smart-gesture-ongesture': function(res, points) {},
    }
  };
</script>

Documentation

configuration

可配置的参数如下:

  • enablePath 是否显示鼠标轨迹,类型为Boolean。(default: true)

  • lineColor 鼠标轨迹的颜色,类型为String。(default: #666)

  • lineWidth 鼠标轨迹的宽度,类型为Number,单位px。(default: 4)

  • timeDelay 长按一定时间后才会触发手势识别,类型为Number,单位ms。(default: 600)

  • triggerMouseKey 触发手势识别的鼠标按键,类型为String,可选值left | right。(default: right)

  • gestures 初始化自定义图形集合。类型为Array | Object,若不想使用预设的手势,可以传空数组。(default: [所有预设的手势])

  • activeColor 开启手势时背景色。类型为String。(default: rgba(0, 0, 0, .05))

  • eventType 响应事件的类型。类型为String,可选值touch | mouse,当指定为touch时将捕获touch相关的事件,简单的说如果用于移动端请将参数设置为touch。(default: mouse)

events

会在vm上触发如下事件:

  • smart-gesture-onswipe function(directionList) 手势结束时调用,

    • directionList: 普通手势的识别结果,数组。
  • smart-gesture-ongesture function(result, points) 手势结束时调用

    • result: 自定义图形手势的识别结果,值为一个对象,包含namescore两个key。

    • points: 包含该次手势的轨迹的点的集合构成的数组。可以配合addGesture方法来实现自定义手势功能。

Methods

可通过vm.$smartGesture对象调用实例方法

  • .addGesture(gesture) 添加自定义图形模板

    • gesture: 自定义图形模板
      • type: Object
      • gesture.name:String: 模板名称
      • gesture.points:Array: 点集合
  • .refresh(options) 重新刷新实例的options

    • options: smartGesture参数对象
  • .destroy() 销毁当前的实例

Development

npm i
npm run dev

Contribution

请在提交 PR 前阅读我们的贡献指南

License

MIT