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

@wc-bindable/core

v0.8.0

Published

Core protocol definitions and bind utility for wc-bindable

Readme

@wc-bindable/core

Core type definitions and bind utility for the wc-bindable protocol.

Install

npm install @wc-bindable/core

Usage

Declaring a bindable Web Component

class MyInput extends HTMLElement {
  static wcBindable = {
    protocol: "wc-bindable",
    version: 1,
    properties: [
      {
        name: "value",
        event: "my-input:value-changed",
      },
    ],
  };
}

Binding to a component

import { bind } from "@wc-bindable/core";

const unbind = bind(element, (name, value) => {
  console.log(`${name} changed to`, value);
});

// Clean up when done
unbind();

Type guard

import { isWcBindable } from "@wc-bindable/core";

if (isWcBindable(element)) {
  // element.constructor.wcBindable is available
}

API

| Export | Description | |---|---| | bind(target, onUpdate, options?) | Attaches listeners for every declared property and reads each property's current value. Returns an UnbindFn that removes every listener it installed. options.syncOn is "call" (default) or "connect" (defer the initial-value read until connectedCallback for unmounted HTMLElements). | | getWcBindableDeclaration(target) | Returns the validated declaration or undefined. MUST NOT throw, even on hostile targets — see SPEC.md § Discovery API. | | isWcBindable(target) | Type guard wrapping getWcBindableDeclaration() !== undefined. Narrows target to WcBindableElement. | | WcBindableDeclaration | Type for the static wcBindable field. | | WcBindableProperty | Type for a single property descriptor ({ name, event, getter? }). | | WcBindableInput | Type for a single input descriptor ({ name, attribute? }). | | WcBindableCommand | Type for a single command descriptor ({ name, async? }). | | WcBindableElement | Structural type for a protocol-compliant target (add/removeEventListener + constructor.wcBindable). Does NOT require dispatchEvent so relay-only proxies fit. | | WcBindableConstructor | The constructor side of WcBindableElement. | | UnbindFn | () => void — the cleanup function returned by bind(). | | BindOptions | Options object for bind(). | | MIN_COMPATIBLE_VERSION | Lowest protocol version any declaration may carry (fixed at 1). See SPEC.md § Versioning. | | SUPPORTED_PROTOCOL_VERSION | Deprecated alias for MIN_COMPATIBLE_VERSION. Removed in v1.0. |

The normative TypeScript surface lives in SPEC.md § Normative TypeScript surface. The exports above match it 1:1; the names here are authoritative when reading the implementation.

License

MIT