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

@jsweb/ui

v1.2.8

Published

JS Web Microframework

Readme

@jsweb/ui

Introdução

O @jsweb/ui é um micro-framework frontend escrito em TypeScript, projetado para ser uma ferramenta leve, rápida e flexível para o desenvolvimento de interfaces de usuário. Ele combina a reatividade moderna de frameworks como Vue 3 (Composition API) com a simplicidade de uso direto no HTML, semelhante ao Alpine.js.

Pilares Arquiteturais

  • Sem Virtual DOM: Utiliza reatividade de grão fino (Fine-grained reactivity) via Proxy para atualizações diretas no DOM real.
  • Distribuição Dupla:
    • Standalone: Arquivo único (IIFE/UMD) para inclusão via <script src="...">.
    • Module: Pacote ESM com exports nomeados para suporte a Tree-Shaking.
  • Contexto Híbrido: Suporta definição de estado via Objetos Literais (POJOs) ou Classes TypeScript.
  • Template Engine: Baseado em atributos customizados no HTML (ui:* para diretivas e ui@* para eventos, com shorthands @, :).
    • Suporte completo a modificadores de eventos encadeados (.prevent, .stop, .self, .outside).

Instalação

NPM

npm i @jsweb/ui

CDN

<script src="https://unpkg.com/@jsweb/ui"></script>

Diretivas Disponíveis (v0.1.0)

O framework utiliza um sistema de atributos customizados para declaratividade no HTML.

| Diretiva | Descrição | Exemplo | | :-------------------- | :------------------------------------------------------------------------------ | :------------------------------------ | | ui:scope / :scope | Define o objeto de estado para o elemento e seus filhos. | <div :scope="{ count: 0 }"> | | ui:text / :text | Sincroniza o textContent com uma variável. | <span :text="count"></span> | | :attr | Shorthand para bind de atributos HTML nativos. | <button :disabled="count > 10"> | | :class / :style | Bind dinâmico avançado para classes CSS e Estilos Inline (dicionários, arrays). | <div :class="{ active: isActive }"> | | @event | Shorthand para event listeners (com suporte a modificadores). | <button @click.prevent="save"> | | $emit | Despacha CustomEvents a partir do escopo atual. (Exposto no contexto) | <button @click="$emit('custom')"> | | :bind | Two-way data binding para inputs, checkboxes, radios e selects. | <input :bind="name"> | | ui:if / :if | Adiciona/Remove o elemento do DOM (via Comment Node placeholder). | <div :if="count > 0"> | | ui:for / :for | Renderiza uma lista de elementos a partir de um array. | <li :for="item in items"> |

Exemplo de Uso

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>JS Web UI</title>
    <script src="https://unpkg.com/@jsweb/ui"></script>
    <script>
      const scope = {
        count: 0,
        inc: 'Incremento',
        dec: 'Decremento',
        increment() {
          this.count++
        },
        decrement() {
          this.count--
        },
      }

      jsweb.ui.createScope('body', { scope })
    </script>
  </head>
  <body>
    <div ui:scope="scope">
      <h1>JS Web UI</h1>
      <p>Contador: <span ui:text="count"></span></p>
      <button ui:text="inc" @click="increment()"></button>
      <button ui:text="dec" @click="decrement()"></button>
    </div>
  </body>
</html>

TypeScript / ESM

import { createScope, reactive, watch } from '@jsweb/ui'

const scope = reactive({
  count: 0,
  inc: 'Incremento',
  dec: 'Decremento',
  increment() {
    this.count++
  },
  decrement() {
    this.count--
  },
})

watch(() => scope.count, (newVal, oldVal) => {
  console.log(`Contador mudou de ${oldVal} para ${newVal}`)
})

createScope('#container', { scope })