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

umi-plugin-cmdk

v0.1.4

Published

在 umi 项目里可以快速搜索菜单

Downloads

3

Readme

Umi-plugin-cmdk

一个通过快捷键打开搜索面板的插件, 搜索面板默认可以搜索菜单,也可以定制其他的链接。

Pasted image 20230307175305

Install

Npm

npm install umi-plugin-cmdk

Yarn

yarn add umi-plugin-cmdk

Pnpm

pnpm add umi-plugin-cmdk

Usage

Configure in .umirc.ts,

export default {
  plugins: ["umi-plugin-cmdk"],
};

Options

可以通过配置文件 config/config. Ts 中的 layout 属性开启插件。

import { defineConfig } from 'umi';

export default defineConfig({
  cmdk: {
    keyFilter: 'meta.k',
    searchPlaceholder: '搜索菜单',
    empty: '找不到搜索结果',
    suggestionKeys: [],
    groups: []
  }
});

keyFilter

  • Type: KeyFilter
  • Default: meta.k

定义打开弹框的快捷键, 具体用法可见 ahooks 的 useKeyPress

searchPlaceholder

  • Type: string
  • Default: 寻找你想去的地方...

弹框搜索框的 Placeholder

Empty

  • Type: string
  • Default: 迷路了! ! !

搜索结果为空的时候展示效果

suggestionKeys

  • Type: string[]
  • Default: 无

用于配置哪些菜单需要置顶,置顶之后会放到 suggestion 组内,同时在 menu 组下面就会隐藏。

Pasted image 20230307180853

groups

  • Type: Group
  • Default: 无

出了菜单以外,还想配置更多的跳转链接,可以用这个属性进行扩展更多的分组。 Pasted image 20230307181335

类型如下:


interface Item {
  key: string;
  title: string;
  action?: () => void;
}

interface Group {
  groupName: string;
  items: Item[];
}

TODO

  • [ ] 更多的主题切换
  • [ ] 增加一个静态站点演示,或者整一个每个属性配置的 gif

LICENSE

MIT