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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@shopnex/analytics-plugin

v0.0.4

Published

Analytics plugin for ShopNext

Downloads

239

Readme

Quick Actions Plugin for Payload CMS

A powerful and extensible command palette plugin for Payload CMS that provides instant access to collections, globals, and custom actions through a searchable interface.

✨ Features

  • Instant Access – Quick search and navigation to any collection or global
  • 🎨 Customizable – Full control over actions, icons, and positioning
  • 🔧 Extensible – Plugin hooks, custom action builders, and filtering
  • 🎯 Type Safe – Full TypeScript support with comprehensive type definitions
  • 🚀 Performance – Optimized rendering and minimal bundle impact
  • 🔍 Fuzzy Search – Search for actions with fuzzy matching

🚀 Installation

npm install @shopnex/quick-actions-plugin
# or
pnpm add @shopnex/quick-actions-plugin

🛠️ Basic Usage

import { quickActionsPlugin } from "@shopnex/quick-actions-plugin";

export default buildConfig({
    plugins: [
        quickActionsPlugin({
            position: "actions", // 'actions' | 'before-nav-links' | 'after-nav-links'
            defaultCreateActions: true,
        }),
        // ... other plugins
    ],
    // ... rest of config
});

🔧 Advanced Configuration

Custom Actions

import { quickActionsPlugin, QuickActionBuilder } from '@shopnex/quick-actions-plugin';
import { Settings, Users } from 'lucide-react';

const customActions = [
  QuickActionBuilder
    .create('settings', 'System Settings')
    .withIcon(<Settings size={16} />)
    .withLink('/admin/settings')
    .withKeywords('config system settings')
    .withGroup('admin')
    .build(),

  QuickActionBuilder
    .create('users-export', 'Export Users')
    .withIcon(<Users size={16} />)
    .withLink('/admin/collections/users/export')
    .withPriority(10)
    .build()
];

export default buildConfig({
  plugins: [
    quickActionsPlugin({
      additionalActions: customActions,
      excludeCollections: ['sensitive-data'],
    }),
  ],
});

Plugin Hooks

quickActionsPlugin({
    hooks: {
        beforeActionsGenerated: (config) => {
            console.log("Generating actions for config:", config);
        },
        afterActionsGenerated: (actions) => {
            return actions.filter((action) => !action.name.includes("test"));
        },
        onActionExecute: async (action) => {
            console.log("Executing action:", action.name);
            // Custom analytics or logging
        },
    },
});

Custom Action Builder

quickActionsPlugin({
    customActionBuilder: (config) => {
        const actions = [];

        // Custom logic to generate actions based on config
        config.collections?.forEach((collection) => {
            if (collection.admin?.useAsTitle) {
                actions.push({
                    id: `search-${collection.slug}`,
                    name: `Search ${collection.slug}`,
                    link: `/admin/collections/${collection.slug}?search=`,
                    priority: 90,
                });
            }
        });

        return actions;
    },
});

Action Filtering and Utilities

import {
    filterActions,
    sortActionsByPriority,
    groupActionsByCategory,
} from "@shopnex/quick-actions-plugin";

// Filter actions by criteria
const filteredActions = filterActions(actions, {
    byGroup: "collections",
    byPriority: 50,
    excludeGroups: ["admin"],
});

// Sort by priority
const sortedActions = sortActionsByPriority(actions);

// Group by category
const groupedActions = groupActionsByCategory(actions);

Custom Icons

import { quickActionsPlugin } from '@shopnex/quick-actions-plugin';
import { Database, FileText, Image } from 'lucide-react';

quickActionsPlugin({
  overrideIconsMap: {
    posts: <FileText size={16} />,
    media: <Image size={16} />,
    categories: <Database size={16} />
  }
});

⌨️ Keyboard Shortcuts

  • Cmd/Ctrl + K - Open command palette
  • Arrow Keys - Navigate actions
  • Enter - Execute selected action
  • Escape - Close command palette

🎨 Styling

The plugin includes default SCSS styles that can be customized:

.CommandBar {
    // Custom styles for the command bar
}

.quick-actions {
    // Custom styles for the trigger button
}

📚 API Reference

QuickActionsPluginConfig

interface QuickActionsPluginConfig {
    position?: "actions" | "before-nav-links" | "after-nav-links";
    overrideActions?: QuickAction[];
    additionalActions?: QuickAction[];
    overrideIconsMap?: Record<string, JSX.Element>;
    defaultCreateActions?: boolean;
    kbarOptions?: KBarOptions;
    hooks?: PluginHooks;
    enableDefaultActions?: boolean;
    customActionBuilder?: (config: any) => QuickAction[];
    excludeCollections?: string[];
    excludeGlobals?: string[];
}

QuickAction Interface

interface QuickAction {
    id: ActionId;
    name: string;
    shortcut?: string[];
    keywords?: string;
    section?: ActionSection;
    icon?: string | React.ReactElement | React.ReactNode;
    subtitle?: string;
    perform?: (currentActionImpl: ActionImpl) => any;
    parent?: ActionId;
    priority?: Priority;
    link?: string;
    group?: string;
    custom?: boolean;
}

🤝 Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests to the main repository.

📄 License

MIT – © 2025 ShopNex.ai