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

@rokkit/actions

v1.1.17

Published

Contains generic actions that can be used in various components.

Downloads

3,916

Readme

@rokkit/actions

Svelte actions and DOM utilities for Rokkit components.

Installation

npm install @rokkit/actions
# or
bun add @rokkit/actions

Overview

@rokkit/actions provides the DOM event layer that @rokkit/ui components build on. The main export is Navigator — a class that wires keyboard, click, and focus events on a container element to a Wrapper (or any IWrapper-shaped object) instance. The package also includes standalone Svelte use: actions for effects like ripple, magnetic snap, reveal animations, dismissal on click-outside, and declarative keyboard shortcuts.

Usage

Navigator — keyboard and click navigation

The Navigator class wires a container element's DOM events to a Wrapper. It handles ArrowUp/ArrowDown/ArrowLeft/ArrowRight, Home, End, Enter, Space, typeahead, click-to-select, ctrl/cmd-click toggle, shift-click range, and contained scrollIntoView.

<script>
  import { Navigator } from '@rokkit/actions'
  import { ProxyTree, Wrapper } from '@rokkit/states'

  const tree = new ProxyTree(items)
  const wrapper = new Wrapper(tree, { onselect })

  let rootRef = $state(null)
  $effect(() => {
    if (!rootRef) return
    const nav = new Navigator(rootRef, wrapper, { orientation: 'vertical' })
    return () => nav.destroy()
  })
</script>

<ul bind:this={rootRef}>
  {#each wrapper.flatView as node (node.key)}
    <li data-path={node.key}>{node.proxy.label}</li>
  {/each}
</ul>

The data-path attribute on each item is required — Navigator uses it to resolve which item was clicked or focused.

Options:

new Navigator(containerEl, wrapper, {
  orientation: 'vertical', // 'vertical' | 'horizontal'
  dir: 'ltr',              // 'ltr' | 'rtl' — arrow-key direction
  collapsible: false,      // enable expand/collapse key handling
  containScroll: false     // stop wheel events from bubbling to parents
})

keyboard — declarative shortcut binding

<script>
  import { keyboard } from '@rokkit/actions'
</script>

<div
  use:keyboard={{ submit: 'enter', cancel: 'escape' }}
  onsubmit={() => save()}
  oncancel={() => close()}
>
  ...
</div>

Default mappings: alphabet keys dispatch add, Enter dispatches submit, Escape dispatches cancel, Backspace/Delete dispatch delete.

ripple — click ripple effect

<script>
  import { ripple } from '@rokkit/actions'
</script>

<button use:ripple>Click me</button>

<!-- With options -->
<button use:ripple={{ color: 'white', opacity: 0.2, duration: 400 }}>Click me</button>

hoverLift — elevation shadow on hover

<script>
  import { hoverLift } from '@rokkit/actions'
</script>

<div use:hoverLift>Card content</div>

magnetic — snap-to-cursor effect

<script>
  import { magnetic } from '@rokkit/actions'
</script>

<button use:magnetic>Hover me</button>

reveal — intersection observer reveal animation

<script>
  import { reveal } from '@rokkit/actions'
</script>

<section use:reveal>Fades in when scrolled into view</section>

dismissable — click-outside dismissal

<script>
  import { dismissable } from '@rokkit/actions'

  let open = $state(false)
</script>

<div use:dismissable={{ enabled: open, ondismiss: () => (open = false) }}>Dropdown content</div>

swipeable — touch swipe detection

<script>
  import { swipeable } from '@rokkit/actions'
</script>

<div use:swipeable onswipeleft={() => next()} onswiperight={() => prev()}>Swipeable content</div>

themable — apply theme CSS variables

<script>
  import { themable } from '@rokkit/actions'
</script>

<div use:themable={{ theme: 'ocean' }}>Themed content</div>

API Reference

Navigator options

| Option | Type | Default | Description | | ------------- | ---------------------------- | ------------ | ------------------------------------- | | orientation | 'vertical' \| 'horizontal' | 'vertical' | Arrow key axis for prev/next movement | | collapsible | boolean | false | Enable expand/collapse via arrow keys |

buildKeymap / resolveAction

Low-level utilities for constructing custom keymaps:

import { buildKeymap, resolveAction, ACTIONS } from '@rokkit/actions'

const keymap = buildKeymap({ orientation: 'vertical', collapsible: true })
const action = resolveAction(keymap, event) // returns action string or null

Exports

| Export | Type | Description | | --------------- | ------------- | ---------------------------------------------- | | Navigator | Class | DOM event wiring for Wrapper | | keyboard | Svelte action | Declarative keyboard shortcut binding | | ripple | Svelte action | Material Design ink ripple on click | | hoverLift | Svelte action | Elevation shadow on hover | | magnetic | Svelte action | Snap-to-cursor magnetic effect | | reveal | Svelte action | Intersection-observer reveal animation | | dismissable | Svelte action | Click-outside dismissal | | pannable | Svelte action | Pan / drag detection | | swipeable | Svelte action | Touch swipe detection | | themable | Svelte action | Apply theme CSS vars to element | | buildKeymap | Function | Build a keymap for given orientation/options | | resolveAction | Function | Resolve a keyboard event to an action string | | ACTIONS | Object | Named action constants |


Part of Rokkit — a Svelte 5 component library and design system.