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

emily-js

v0.2.0

Published

Tiny declarative behavior layer for server-rendered HTML, EmilyCSS, and EmilyUI.

Readme

EmilyJS

Tiny declarative behavior layer for server-rendered HTML, EmilyCSS, and EmilyUI.

EmilyJS adds local state, simple events, form bindings, visibility, class/style bindings, and accessibility helpers directly to HTML attributes. It is designed for pages and components that render HTML on the server and need a small amount of client-side behavior without a full application framework.

Install

npm install emily-js
const EmilyJS = require('emily-js');

new EmilyJS(document);

You can also load emily.js directly in the browser. It auto-starts as window.emily when document is ready.

<script src="./emily.js"></script>

Example

<div class="em-card" emily-state='{"open": false, "saving": false}'>
  <button class="em-button" emily-click="open = !open">
    Toggle panel
  </button>

  <div
    class="em-panel"
    emily-show="open"
    emily-class='{"is-open": "open"}'>
    Panel content
  </div>

  <button class="em-button" emily-disabled="saving">
    Save
  </button>
</div>

Directives

  • emily-state: JSON object that creates local component state.
  • emily-click: shortcut for click expressions, such as open = !open.
  • emily-on:event: binds any DOM event to an expression, such as emily-on:change="dirty = true".
  • emily-submit: binds a form submit event and prevents the browser default.
  • emily-show: hides an element when an expression is false.
  • emily-text: writes a state value to textContent.
  • emily-html: writes trusted state HTML to innerHTML.
  • emily-bind: maps attributes from state or expressions.
  • emily-disabled: syncs disabled and aria-disabled.
  • emily-model: two-way binding for inputs, selects, and textareas.
  • emily-model.lazy: defers text input updates until blur.
  • emily-class: toggles classes from expressions.
  • emily-style: maps state or expressions to inline style properties.
  • emily-trap: traps focus inside an active container.
  • emily-announce: pushes state updates into a polite live region.

Expressions

EmilyJS intentionally supports a small CSP-safe expression subset:

open
!open
tab === 2
mode !== 'dark'
open = !open
tab = 2
count++
count--

There is no eval() or new Function(). Nested paths, function calls, loops, and compound boolean expressions are not part of the expression language.

Security

emily-html writes directly to innerHTML. Only bind trusted or pre-sanitized content.

Dynamic Content

Call refresh() after injecting HTML that contains new emily-state components:

window.emily.refresh(container);

License

MIT