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

@webly/rebind

v0.4.0

Published

[![npm version](https://img.shields.io/npm/v/@webly/rebind.svg)](https://www.npmjs.com/package/@webly/rebind) [![gzip](https://deno.bundlejs.com/badge?q=@webly/rebind)](https://bundlejs.com/?q=@webly/rebind) [![License: MIT](https://img.shields.io/badge/L

Readme

Package Name

npm version gzip License: MIT


📦 Installation

npm install @webly/rebind

🚀 Quick Start

Briefly show the most common use case.

<head>
  <title @text="{title}"></title>
  
  <script type="module" defer>
    import {Rebind} from '@webly/rebind';
    // import {Rebind} from "https://cdn.jsdelivr.net/npm/@webly/[email protected]/dist/min/index.js"
    
    new Rebind(document).state({
      title: "hello",
      say: function(arg) {
        alert(this.title + arg)
      }
    }).run()
  </script>
</head>

<body>
  <h1 @text="hello world"></h1>
  <button @on:click="say('world')">click</button>
</body>

🛠 API Reference

Implicit Variables

Implicit variables are automatically provided. They can be accessed inside directive expressions without being explicitly defined in state.

| Variable | Description | |----------|-------------| | $element | current element node | | $select() | currentElement.querySelector | | $selectAll() | currentElement.querySelectorAll |


🔧Directives


@text

@text="text content"

Description

Sets the text content of an element. Supports string interpolation using {propertyName} to access properties from the current scope.

Accepted Values / Type

  • string – Plain text or text with placeholders: Example: "Hello {fullName}"

Usage Example

<p @text="Hello {fullName}"></p>

Notes / Behavior

  • Multiple placeholders are supported: "Hi {firstName} {lastName}"
  • Safe for plain text (does not render HTML).
  • Works with deeply nested properties (e.g., {user.profile.name}).

@data

@data='{ "name": "linus"}'

Description

Binds JSON data to the element. Supports direct JSON objects or dynamic properties from the scope, including nested properties.

Accepted Values / Type

  • JSON object:
<div @data='{ "name": "linus" }'></div>
  • Scope property (dynamic):
<div @data="user"></div>
  • Nested property:
<div @data="user.profile"></div>

Usage Example

<div @data='{ "name": "linus" }'>
  <p @text="Hello {name}"></p>
</div>

Notes / Behavior

  • Property names must not contain spaces.
  • Supports deeply nested properties.

@skip

@skip=""

Description

Skips the element and all its children. None of its directives or content will run.

Usage Example

<div @skip>
  <p @text="skiped"></p>
</div>
<p @text="not skiped"></p>

@html

@html="html"

Description

Set innerHTML to the element

Usage Example

<div @html="<p>Hello World</p>"></div>
<div @html="{html}"></div>

@:attribute

@:attributeName="value"

Description

Sets or creates an HTML attribute on the element. Supports string interpolation using {property} or nested {object.property} from the current scope. Property names cannot contain spaces.

Usage Example

<button @:class="btn {color}"></button>

@on:event

@on:eventType="functionName(arg)"

Description

Add event listener to the element.

Usage Example


<button @on:click="increment()" @text="{count}">0</button>
<script>
const rootData = observe({
  count: 0,
  increment() {
    console.log(this.$event)
    this.$event.preventDefault()

    this.count += 1
  }
})
new Rebind(document.body.state(rootData).run())
</script>  

@init

@init="functionName(arg)"

Description

Runs a function from the scope after @data has been initialized on the element.

Accepted Values / Type

  • Scope function call with optional arguments:
<div @init="setup(user)"></div>

@for

@for=""

Description

Iterates over an array or iterable and renders the contents of the <template> for each element. During iteration, the directive implicitly creates local variables that are available inside the template scope.

The <template> element itself is not rendered; its content is cloned and inserted into the DOM for each item in the collection.

Implicit Variables

The directive automatically exposes the following variable inside the template:

| variable | Description | |----------|-------------| | $key | index or key of the iteration |

Usage Example

<ul @data="data">
  <template @for="animal in animals">
    <li @text="{animal.name}">item</li>
  </template>
</ul>

<script>
new Rebind(document.body)
  .state({
    data: {
      animals: [
        { name: "cat", tail: true },
        { name: "husky", tail: true }
      ]
    }
  })
  .run()
</script>

@if

@if="Foo ConditionalOperator Bar; functionName()"

Description

Run function when condition is true.

Usage Example

<div @data='{"count": 10}'>
  <div @if="{count} > 5"; show()">
    <p hidden>Hello World</p>
  </div>  
</div>

<script>
new Rebind(document.body).state({
  show() {
    const p = this.$element.querySelector("p")
    if (p) p.hidden = !p.hidden
  }
}).run()
</script>

📄 License

Distributed under the MIT License. See LICENSE for more information.