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

solid-ninja-keys

v0.3.0

Published

Add cmd+k interface to your solid site.

Downloads

39

Readme

solid-ninja-keys

Add cmd+k interface to your solid site. Built on top of ninja-keys.

Quick start

Install it:

pnpm add solid-ninja-keys # or npm or yarn

Use it:

import { createSignal } from 'solid-js'
import { NinjaKeys } from 'solid-ninja-keys'

function App() {
  const [isDark, setIsDark] = createSignal(false)
  const hotkeys = [
    {
      id: 'Home',
      title: 'Open Home',
      hotkey: 'cmd+h',
      mdIcon: 'home',
      handler: () => {
        console.log('navigation to home')
      },
    },
    {
      id: 'Theme',
      title: 'Change theme...',
      mdIcon: 'desktop_windows',
      children: [
        {
          id: 'Light Theme',
          title: 'Change theme to Light',
          mdIcon: 'light_mode',
          handler: () => {
            setIsDark(false)
          },
        },
        {
          id: 'Dark Theme',
          title: 'Change theme to Dark',
          mdIcon: 'dark_mode',
          keywords: 'lol',
          handler: () => {
            setIsDark(true)
          },
        },
      ],
    },
  ]

  return (
    <div>
      <NinjaKeys isDark={isDark()} hotkeys={hotkeys} />
    </div>
  )
}

export default App

Props

All attributes from ninja-keys are available plus additional props below:

| Field | Default | Description | |----------------------|-----------------------------|-------------------------------------------------------------| | hotkeys | [] | Array of ninja actions | | isDark | false | Apply dark theme |

Methods

You can access ninja-keys methods anywhere in your app via createNinjaKeys primitive.

| Name | Arg | Description | |----------------------|-----------------------------|-------------------------------------------------------------| | open | parent?: string | Open menu with parent, if null then open root menu | | close | | Close menu | | setParent | parent?: string | Navigate to parent menu |

Example

import { createNinjaKeys } from 'solid-ninja-keys'

const {
  open,
  close,
  setParent,
} = createNinjaKeys()

Styling

If you need more style control, use the CSS variables available.

Icons

By default, components use icons from https://fonts.google.com/icons . To add Material icons for your website, you need to add them to your HTML, for example

<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet">

You can also use svg or img. Please refer to the icons docs.

License

MIT License © 2022 Robert Soriano