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

@uifn/dom

v0.0.1

Published

Owned DOM platform boundary for uifn

Readme

@uifn/dom

@uifn/dom is uifn's sole production browser-behavior layer. It is framework-neutral and root-scoped: every service receives an explicit Document, ShadowRoot, or HTMLElement and owns a deterministic teardown path.

React, Svelte, and Solid adapters bind these services to their lifecycle systems. They must not recreate focus traps, outside-click listeners, scroll locks, floating geometry, portals, or transition timers.

Overlay binding

createUIFnOverlayDomBinding is the single executor for the eight core overlay policies. Adapters render controller parts, retain element refs, and bind them to an acquired platform:

import { createPopoverController } from '@uifn/core'
import { acquireUIFnDomPlatform, createUIFnOverlayDomBinding } from '@uifn/dom'

const controller = createPopoverController()
const lease = acquireUIFnDomPlatform({ root: trigger.ownerDocument })
const binding = createUIFnOverlayDomBinding({
  platform: lease.platform,
  controller,
  trigger,
  content,
  positioner,
  reference: trigger,
  portalNode: positioner,
})

// Adapter teardown
binding.destroy()
controller.destroy()
lease.release()

Pass parent when an overlay is portaled from another overlay. The binding registers document and Shadow DOM branches with the parent layer, focus scope, and modal isolation manager. Touch outside dismissal completes on pointer-up; interrupted presence, removed triggers, abrupt unmount, and nested modal locks all retain deterministic cleanup.

Platform lifecycle

import { acquireUIFnDomPlatform } from '@uifn/dom'

const lease = acquireUIFnDomPlatform({ root: element.ownerDocument })
const layer = lease.platform.layers.register({
  element,
  onDismiss: () => close(),
})

// Framework cleanup / owner disposal
layer.destroy()
lease.release()

acquireUIFnDomPlatform shares one lazily-created service set per root and reference-counts consumers. createUIFnDomPlatform creates an explicitly owned platform instead. Destroy/release is idempotent; all listeners, observers, timers, animation frames, stateful DOM mutations, and service resources return to zero.

Owned services

  • root event delegation, observer lifecycles, input modality, focus-visible decisions, and native tabbable/focusable discovery;
  • composed-path dismissable layers with top-eligible routing, branches, portals, Shadow DOM, touch, right-click, focus outside, Escape, and cancellation;
  • nested focus scopes with trap/loop, autofocus cancellation, deterministic fallback, and focus restoration;
  • modal accessibility isolation, inertness, pointer isolation, nested desktop/iOS scroll locking, compensation, and exact restoration;
  • wrapped Floating UI positioning with offset, flip, shift, size, arrow, hide, inline, explicit boundaries, RTL, virtual anchors, and auto-update cleanup;
  • root-aware portals, transition-aware presence, animation cancellation, interruption, force-mount, and reduced-motion handling;
  • native form bridges, validation/reset/disabled-fieldset behavior, ordered live regions, deduplication, and stale-message rejection;
  • scoped multi-pointer tracking for gesture bindings.

The public API exposes owned uifn contracts rather than dependency APIs. Floating UI and tabbable remain private implementation details; see DEPENDENCIES.md for their review record.

Root and environment injection

import { createUIFnDomScope } from '@uifn/dom'

const scope = createUIFnDomScope({
  root: shadowRoot,
  environment: {
    locale: 'hi-IN',
    direction: 'rtl',
    reducedMotion: false,
    trace: (record) => diagnostics.push(record),
    error: (error) => report(error),
  },
})

scope.destroy()

Imports do not read browser globals. The same contracts work with same-origin iframe documents and open shadow roots. Optional capability failures use stable uifn errors rather than ambient ReferenceErrors.

Verification

npm run verify:uifn-dom-platform
npm --workspace @uifn/dom run typecheck
npm --workspace @uifn/dom run test

The phase gate builds and packs the public package, imports it in a clean consumer, rejects seeded framework-local behavior forks, and runs all TV-DOM-001 through TV-DOM-007 positive/negative vectors in Chromium, Firefox, and WebKit with screenshots and traces.