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

@mojskin/vue-shortcut-manager

v1.0.0

Published

A powerful keyboard shortcut manager for Vue 3 applications with support for multi-key bindings, conditional execution, element targeting, navigation, and auto-generated help dialogs. Perfect for complex forms, dashboards, and productivity tools.

Readme

🇬🇧 English | 🇮🇷 فارسی

vue-shortcut-manager v1.0.0

Powerful keyboard shortcut manager for Vue 3 – multi‑key bindings, conditional actions, focus navigation, and auto‑generated help panel.

📦 Installation

npm install @mojskin/vue-shortcut-manager

🚀 Quick Start

// main.js
import { createApp } from 'vue'
import App from './App.vue'
import { ShortcutPlugin } from '@mojskin/vue-shortcut-manager'

const app = createApp(App)
app.use(ShortcutPlugin)
app.mount('#app')

⚙️ Basic Usage inside a Component

<template>
  <form ref="formRef">
    <input name="patient_name" placeholder="Patient name" />
    <button type="submit">Save</button>
  </form>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { useShortcutManager } from '@mojskin/vue-shortcut-manager'

const formRef = ref(null)
const { register } = useShortcutManager()

const shortcuts = [
  {
    keys: ['ctrl+s', 'f5'],
    description: 'Save form and print',
    target: { type: 'call', method: 'submitForm', params: { print: true }, scope: 'component' },
    confirm: 'Save changes?'
  },
  {
    keys: ['shift+tab', 'up'],
    description: 'Move to previous field',
    target: { type: 'navigate', direction: 'prev', step: 1 }
  }
]

const submitForm = (params) => {
  console.log('Submitted', params)
  if (params.print) window.print()
}

onMounted(() => {
  register(shortcuts)
  // manually set current component for navigation (automatic inside useShortcutManager)
})
</script>

🧩 Advanced Features

➤ Conditional execution

{
  keys: ['f1'],
  description: 'Open patient selector only when focus is on patient_name',
  when: { focused: '[name="patient_name"]' },
  target: { type: 'call', method: 'selectPatient', scope: 'component' }
}

➤ Navigate multiple steps

{ keys: ['page-down'], target: { type: 'navigate', direction: 'next', step: 3 } }

➤ Click an element by selector

{
  keys: ['alt+x'],
  target: { type: 'click', selector: { by: 'id', value: 'hidden-submit' } }
}

➤ Emit custom event

{
  keys: ['ctrl+shift+e'],
  target: { type: 'emit', event: 'export-data', payload: { format: 'csv' } }
}

🖼️ Generating a Help Menu (HTML)

Call getShortcutManager().getHelpHTML(componentInstance) to get raw HTML describing all global and local shortcuts (local ones from that component). Then display it anywhere (dialog, tooltip, sidebar).

import { getShortcutManager } from '@mojskin/vue-shortcut-manager'

function showHelp() {
  const html = getShortcutManager().getHelpHTML(this) // or pass component instance
  // insert into a modal
  document.getElementById('helpModalBody').innerHTML = html
  openModal()
}

📘 The returned HTML is unstyled – you can add your own CSS classes or framework styling (Tailwind, Bootstrap, etc.).

🌐 Registering Global Shortcuts

import { getShortcutManager } from '@mojskin/vue-shortcut-manager'
const manager = getShortcutManager()
manager.registerGlobal({
  keys: ['f1'],
  description: 'Global help',
  target: { type: 'call', method: 'openGlobalHelp', scope: 'global' }
})

🔧 API Reference

  • useShortcutManager() – returns { register, unregister, manager } (local shortcuts).
  • getShortcutManager() – returns the global manager instance.
  • registerGlobal(shortcut) – adds a global shortcut (works everywhere).
  • registerLocal(component, shortcuts) – normally called via register from composable.
  • getHelpHTML(component?) – generates help HTML string.

🙏 Support & Donations

Your support is greatly appreciated and helps ensure the continued development of this project.

Donate with Daramet

📄 License

MIT · Created by mojskin

Built for Vue 3 – enhance productivity with keyboard‑first design.