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

retil-interactions

v0.18.9

Published

Utilities to create unstyled interactive components

Readme

retil-interactions

  • this package should be completely free of styles or integrations for specific, style libraries, but does contain useStyles, which takes a style object of various forms possibly including named selectors, and replaces any named selectors with selectors from the context.

  • this package should contain usePopupTrigger, usePopup

  • things to test:

    • can we configure for usage with styled-components using a single global Provider? we'd probably need to configure a way of patching theme context, as well as the stuff to actually patch it with. we'd want a separate retil-interactions-styled-components package to handle this

      For our surfaces, we can probably use constant class names instead of using class names generated for empty styled components. e.g. an AnchorSurface could have a "retil-anchor-surface" classname, and we could just build our selectors based on that. No need for fancy styled components stuff.

      For , we can actually use a :first-child selector to pick out whatever control is the first child, which allows us to select anything.

  • why may want to then export reset styles for anchors, buttons, inputs, etc. along with UnstyledAnchor, UnstyledButton, UnstyledInput, etc. in a separate package.


  • surface and control primitives

    these render individual DOM elements, setting up context such that embedded styled components can target interaction states like hover, disabled, etc.

    • <DivSurface activated onPress?>
      • you'll need to manually set aria roles, as I don't want to make assumptions

    exported by retil-router

    • - will not change interaction state based on url

    • - sets up default "activated" state based on url

    • useControlRef() - returns the ref created by ControlInteractionProvider

    • <ControlDiv control decorators? />

      • "control" is an element that will be rendered as the first child of this component. e.g. , , , etc.
      • we'll look for both :focus and :focus-within on the :first-child selector, and put these selectors in the selector context of subsequent children. note that :focus-within won't work on older browsers, so for controls with nested markup where focus may be applied to internal elements, it may not work
      • we'll also pass in any ref provided by ControlProvider to control, ensuring that this can be used with control boundary surfaces, etc.
      • rendered in a wrapper. could create non-div wrappers too, but we do need to have some kind of container so that we can use the :first-child selector to pick out the control
      • can be used outside of a ControlProvider, allowing interaction styles to be applied using pure CSS pseudoselectors and no extra event handlers.
    • custom controls can be built that don't need to be wrapped in ControlContainer. they just need to handle the state passed down by ControlProvider, e.g. allow it to focus the control, and pass the control ref to whatever part of the dom events should be bound to.

    • usePopup({ trigger: boolean | PopupTrigger }): { style, connectTrigger, connectReaction, etc. }

      • wraps a popper and a popup trigger
      • can still be focused even if byFocus is not set, so long as the the TriggerSurface is focusable
      • connectTrigger sets the popper reference and popup trigger
      • connectReaction sets the popup
      • if this is rendered inside a , then any surfaces within the popup will delegate focus to the control itself, allowing you to click the surfaces within the popup without removing focus from a trigger wrapping the control input.
    • usePopupContext()

    • a control is free to move focus around inside of it, and to move the tabIndex of any of its internal markup around. controls are basically black boxes. the only constraint is that the control must provide functions to focus/blur it, and it must render the control context ref on an element that events should be bound to.

  • need to add modal interactions too...