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

@directorkit/dialogs

v0.1.1

Published

Open any component as a modal or sheet from anywhere — dialog state for Nuxt, with no v-if and no wrapper element.

Readme

@directorkit/dialogs

Hand a component to useModalDialog / useSheetDialog and open it from anywhere — no v-if at the call site, no wrapper element, no dialog markup near the page that opens it. The layer owns dialog state; painting it is the consumer's job.

Install

npm install @directorkit/dialogs
// nuxt.config.ts
export default defineNuxtConfig({
  extends: ["@directorkit/dialogs"],
});

@directorkit/dialogs is a Nuxt layer, not a built library: it ships raw source and the consuming app's Vite compiles it. nuxt and vue are peer dependencies.

Use it

const editTeam = useModalDialog<Props, { saved: [] }>(EditTeamDialog, {
  props: computed(() => ({ teamId: teamId.value })),
  emits: { saved: () => editTeam.closeDialog() },
  isCloseable: true,
});

editTeam.openDialog();

You get back { isOpen, openDialog, closeDialog, onCloseEvent }. Props are reactive — pass a computed, and the dialog re-renders with them. Emits are the handlers the component's events land in, which is also how a dialog resolves a value back to its opener (choose: value => { result.value = value; picker.closeDialog(); }). onCloseEvent fires however the dialog was dismissed. TypeScript enforces the pair: a component with no props takes no props key at all, rather than an empty object.

useSheetDialog is the same API for a sheet, plus direction ("right" by default). Both accept isCloseable, withPadding, onClose, and unregisterOnUnmount: false for a dialog that must outlive the component that opened it.

Painting the dialogs

The layer registers state, not markup — it ships no components. Write one host near the root of your app and render the manager's open instances through it:

<!-- app/components/DialogHost.vue — mounted once, near the root -->
<script setup lang="ts">
const manager = useDialogManager();
const dialogInstances = manager.instances; // the dialogs worth painting, in open order

function close(entry: (typeof dialogInstances)["value"][number]): void {
  entry.instance.isOpen = false;
  manager.removeFromRender(entry.key);
}
</script>

<template>
  <template v-for="(entry, index) in dialogInstances" :key="entry.key">
    <YourOverlay
      v-if="entry.instance.isOpen"
      :style="{ zIndex: 100 + index }"
      @dismiss="entry.instance.isCloseable && close(entry)"
    >
      <component
        :is="entry.instance.component"
        v-bind="(entry.instance.props ?? {}) as Record<string, unknown>"
        v-on="(entry.instance.emits ?? {}) as Record<string, (...args: Array<unknown>) => void>"
      />
    </YourOverlay>
  </template>
</template>

YourOverlay is whatever you paint with — reka-ui's Dialog, vaul-vue for sheets, your own markup — and escape-to-close, overlay-to-close and stacking order are yours to define. Note that the manager's ref deep-unwraps each instance, so isOpen is a plain boolean here and props / emits arrive typed as unknown. A closed dialog stays in instances briefly so its close transition can play out.

The playground's DialogHost.vue is a complete worked example, including escape handling.

Documentation

See ADR-0017 for why the state/paint split is where it is.

License

MIT © Tomáš Petržela