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

@zeix/le-truc

v2.5.0

Published

Le Truc - the thing for type-safe reactive web components

Downloads

1,317

Readme

Le Truc

Type-safe reactive Web Components — HTML-first, backend-agnostic

Le Truc adds a thin reactive layer to HTML that your server renders. Your backend can be Java, PHP, Python, C#, a static site generator, or any tool that outputs HTML. Le Truc connects reactive component properties to specific DOM nodes in the browser. It updates only these nodes. It does not re-render whole sections of the page. It does not need JavaScript on the server.

The result is reactivity in the style of SolidJS, packaged as standard Custom Elements: reusable across projects, type-safe, no framework lock-in.

Why use Le Truc

You often face this choice:

  • Imperative JavaScript, which becomes hard to maintain as the code grows
  • An SPA framework, which takes control of rendering and needs a JavaScript backend for SSR

Neither choice is good when the backend is a CMS. Neither choice is good when the initial HTML is already correct.

Le Truc solves one problem: how to add stateful interactivity to a page that the server has already rendered. See Key features below.

Installation

npm install @zeix/le-truc
# or
bun add @zeix/le-truc

Quick start

  1. Start with server-rendered HTML:
<basic-hello>
  <label for="name">Your name</label>
  <input id="name" name="name" type="text" autocomplete="given-name" />
  <p>Hello, <output for="name">World</output>!</p>
</basic-hello>
  1. Define the component:
import { bindText, defineComponent } from '@zeix/le-truc'

defineComponent(
  'basic-hello',                      // component name (must contain a hyphen)
  ({ expose, first, on, watch }) => { // query DOM, declare props, wire up effects
    const input = first('input', 'Needed to enter the name.')
    const output = first('output', 'Needed to display the name.')
    const fallback = output.textContent || ''

    expose({ name: output.textContent ?? '' }) // declare reactive prop

    on(input, 'input', () => ({ name: input.value || fallback }))
    watch('name', bindText(output))
  },
)
  1. Import the module. The component now works.

defineComponent registers the element with customElements.define(). expose() declares the reactive properties. watch() connects a DOM update to a signal. The update runs only when the signal changes. on() binds an event listener.

Key features

  • 🧱 HTML-first — enhances HTML that the server has already rendered and never re-renders it; no Virtual DOM, no hydration
  • 🔌 Plain Custom Elements — components work in any host environment
  • 🚦 Reactive properties — signals track their dependencies automatically
  • ⚡️ Pinpoint effects — changes only the exact DOM nodes that changed
  • 🛡️ Type-safe — TypeScript infers types from selector strings through to property types; it finds integration errors when you compile the code
  • 🧩 Composable — build component behavior from small, reusable parser and effect functions
  • 🌐 Context support — components share state without you passing props through each level
  • 🪶 Small size — core under 9 kB gzipped, tree-shakeable extensions

Le Truc uses Cause & Effect for its reactive primitives.

Documentation

Find the full documentation with live examples at zeixcom.github.io/le-truc:

Contributing and license

You can contribute code, report bugs, and send suggestions. See CONTRIBUTING.md for instructions.

License: MIT — © 2026 Zeix AG