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

@symbo.ls/windows

v3.14.719

Published

Unified modal / dialog system. One `ModalRoot` at the app shell hosts a stack of layers; each layer is a separate visible window so a modal can open another modal. Replaces:

Downloads

1,233

Readme

@symbo.ls/windows

Unified modal / dialog system. One ModalRoot at the app shell hosts a stack of layers; each layer is a separate visible window so a modal can open another modal. Replaces:

  • per-component Modal definitions that each declared their own stateKey on root state
  • native window.alert / window.confirm / window.prompt (which block the JS event loop and ship the host OS's chrome instead of the app's design system)

Wiring

Once per shell — at the app's entry point alongside the SDK + router plugins:

import { windowsComponents } from '@symbo.ls/windows/components'
import { windowsFunctions } from '@symbo.ls/windows/functions'

// 1. Register the plugin's components + functions into context
Object.assign(context.components, windowsComponents)
Object.assign(context.functions, windowsFunctions)

// 2. Add ModalRoot once at the root of your shell tree
const shell = {
  Header: {},
  Main: {},
  Footer: {},
  ModalRoot: {}, // ← this line, that's the whole wiring
}

The window chrome comes from the design system's ModalWindow (the sheet) and ModalHeader (the head row), plus Button, Input, Hgroup and Icon. When the design system defines no ModalWindow / ModalHeader (an app without a brand library), the plugin's own fallbacks render: the default config's opaque dialog sheet theme, B padding and the radiusSheet radius, and a start/space-between head row. They are registered as smbls.ModalWindow / smbls.ModalHeader, like the smbls.CancelButton fallback, so a host's own component of the same name always wins, even when the host spreads windowsComponents into its own registry.

On a phone (below mobileL, 768 px) every modal is the bottom sheet: full width on the bottom edge, top corners only, at most 92% of the screen, a grabber, and the modalInUp entry. The window half is the plugin's ModalPhoneSheet component, a base UNDER the host's ModalWindow: a ModalWindow that sets its own @mobileL keys or SheetGrabber wins per key, and every key it does not set keeps the phone sheet's. A host's own ModalPhoneSheet (registered under that bare name) replaces the plugin's window half for every modal. The frame half stays on ModalLayer: below mobileL the layer drops its gutter and seats the window on the bottom edge.

Calling

From any element handler:

el.call('confirmDialog', {
  title: 'Delete event?',
  message: 'This permanently removes "Standup" from everyone’s calendar.',
  confirmText: 'Delete',
  confirmTheme: 'red',
  icon: 'trash',
  onConfirm: () => el.call('deleteEvent', id),
  onCancel: () => {}, // optional
})

el.call('alertDialog', {
  title: 'Saved',
  message: 'Your changes are live.',
  onOk: () => {}, // optional
})

el.call('promptDialog', {
  title: 'Rename page',
  message: 'New name:',
  defaultValue: oldName,
  placeholder: 'Untitled',
  onConfirm: (value) => el.call('renamePage', value),
  onCancel: () => {}, // optional
})

// Custom content — caller provides a DOMQL fragment
const layerId = el.call('openModal', {
  template: 'custom',
  content: {
    H2: { text: 'Custom modal' },
    P: { text: 'Anything DOMQL goes here.' },
    Button: { text: 'Done', onClick: (e, btn) => btn.call('closeModal', layerId) },
  },
})

Default texts

A field the caller leaves out shows the template's default: Confirm's title, message, Cancel and Confirm; Alert's title and OK; Prompt's title, Cancel and OK. Each default is a polyglot key in the framework's dialog.* namespace. dialog.cancel and dialog.ok are the same keys the default-config Dialog reads, so one translation serves every framework dialog. The defaults and their resolver are the framework's own: DIALOG_COPY and resolveDialogCopy in @symbo.ls/default-config (re-exported by smbls), the one table both this plugin and Dialog read.

| Default | Key | en | ka | |---|---|---|---| | Cancel (Confirm, Prompt) | dialog.cancel | Cancel | გაუქმება | | OK (Alert, Prompt) | dialog.ok | OK | კარგი | | Confirm (Confirm) | dialog.confirm | Confirm | დადასტურება | | Confirm title | dialog.confirmTitle | Are you sure? | დარწმუნებული ხართ? | | Confirm message | dialog.confirmMessage | This action cannot be undone. | ამ მოქმედების გაუქმება შეუძლებელია. | | Alert title | dialog.alertTitle | Notice | შეტყობინება | | Prompt title | dialog.promptTitle | Enter a value | შეიყვანეთ მნიშვნელობა |

The first answer wins:

  1. the caller's own field (title, message, cancelText, confirmText, okText);
  2. the project's polyglot for the key: its static and server catalogs, the translations its shared libraries merge in, and its default-language fallback;
  3. the framework default for the active language (en, ka);
  4. English.

A project without polyglot, or with a polyglot that does not know the key, never shows the raw key. To word a default your own way, add its key to your polyglot catalog:

context.polyglot = {
  defaultLang: 'ka',
  languages: ['ka', 'en'],
  translations: {
    ka: { 'dialog.cancel': 'არა' },
    en: { 'dialog.cancel': 'Not now' },
  },
}

A dialog that is open during a language switch keeps the language it opened in. The next dialog opens in the new language.

Stacking

Up to 5 layers (ModalLayer_0 through ModalLayer_4). Layer N z-indexes at 2000 + N*10, so layer 1 always renders above layer 0. ESC closes the topmost layer and backdrop clicks dismiss, unless dismissOnBackdrop: false was passed to openModal: such a layer (the onboarding workspace gate, say) closes only through its own actions.

Accessible name

Every window is a role="dialog", aria-modal="true" surface named by its heading: aria-labelledby="modal-title-<layerId>". Each layer slot keeps all four templates in the DOM and shows one, and only the shown template's heading carries that id, so the name always comes from the heading on screen:

  • confirmDialog / alertDialog / promptDialog — the visible heading: title, or the template's default (Are you sure?, Notice, Enter a value, in the project's language: see Default texts) when the title is absent or blank.
  • openModal({ template: 'custom' }) — pass title to name the dialog; it renders as a visually hidden heading. Without a title the window carries no aria-labelledby: a heading inside content does not name the dialog.

Rules followed

  • FA101 / FA102 — flat el.X props + onClick/onInit/onDestroy (no el.props.X, no on.click).
  • FA201 — mutable state lives in state.stack on ModalRoot, never on globalScope.
  • FA204 — Prompt's input draft uses scope: { value: '' }.
  • FA207 — top-level const _layerText = (el, field, fallback) => ... helpers, no nested function declarations inside handlers.
  • FA514 — ESC listener attached via onInit/onDestroy lifecycle, not at module load. The previous window.__modalEscBound pattern in workspace/packages/shared/components/Modal.js is the exact anti-pattern this plugin retires.
  • REUSE rule — Window chrome extends the host's ModalWindow / ModalHeader (the plugin's smbls. fallbacks only fill a gap); buttons extend Button; inputs extend Input; icons extend Icon. No re-definition of built-ins.