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

gonia

v0.3.7

Published

A lightweight, SSR-first reactive UI library with declarative directives

Readme

Gonia

A lightweight, SSR-first reactive UI library for building web applications with HTML-based templates and declarative directives.

Features

  • SSR-First Architecture - Server-side rendering with seamless client hydration
  • Declarative Directives - Vue-inspired template syntax (g-text, g-for, g-if, etc.)
  • Fine-Grained Reactivity - Efficient updates without virtual DOM diffing
  • Zero Dependencies - Core library has no runtime dependencies (linkedom for SSR only)
  • TypeScript Native - Full type safety with excellent IDE support

Installation

pnpm add gonia

Quick Start

Server-Side Rendering

import { render, registerDirective } from 'gonia/server';
import { text, show, cfor, cif, cclass } from 'gonia';

// Create directive registry
const registry = new Map();
registerDirective(registry, 'text', text);
registerDirective(registry, 'show', show);
registerDirective(registry, 'for', cfor);
registerDirective(registry, 'if', cif);
registerDirective(registry, 'class', cclass);

// Render HTML with state
const html = await render(
  '<ul><li g-for="item in items" g-text="item"></li></ul>',
  { items: ['Apple', 'Banana', 'Cherry'] },
  registry
);

Client-Side Hydration

import { hydrate } from 'gonia/client';
import { directive } from 'gonia';

// Import directives (registers globally)
import './directives/my-app.js';

// Hydrate when DOM is ready
hydrate();

Creating a Component Directive

Directives receive their dependencies through dependency injection — parameter names like $element and $scope tell the framework what to provide:

import { directive, Directive } from 'gonia';

const myApp: Directive<['$element', '$scope']> = ($element, $scope) => {
  // Initialize scope
  $scope.count = 0;

  // Define methods
  $scope.increment = () => {
    $scope.count++;
  };
};

// Register with scope: true to create isolated state
directive('my-app', myApp, { scope: true });
<my-app>
  <p g-text="count"></p>
  <button g-on="click: increment">+1</button>
</my-app>

Directives

| Directive | Description | Example | |-----------|-------------|---------| | g-text | Set text content | <span g-text="message"></span> | | g-show | Toggle visibility | <div g-show="isVisible">...</div> | | g-if | Conditional render | <p g-if="hasError">Error!</p> | | g-for | Loop iteration | <li g-for="item in items">...</li> | | g-class | Dynamic classes | <div g-class="{ active: isActive }"> | | g-model | Two-way binding | <input g-model="name"> | | g-on | Event handling | <button g-on="click: handleClick"> | | g-scope | Inline scope init | <div g-scope="{ count: 0 }"> | | g-bind:* | Dynamic attributes | <a g-bind:href="link"> |

Vite Integration

// vite.config.ts
import { defineConfig } from 'vite';
import { gonia } from 'gonia/vite';

export default defineConfig({
  plugins: [gonia()]
});

Documentation

See the docs folder for detailed documentation:

Roadmap

Done

  • [x] Core directives (g-text, g-show, g-if, g-for, g-class, g-model, g-on, g-scope, g-bind:*, g-html)
  • [x] Directive options (scope, template, assign, provide, using)
  • [x] SSR with client hydration
  • [x] Vite plugin with $inject transformation
  • [x] Typed context registry
  • [x] Persistent scopes for g-if toggles

Planned

  • [ ] Reducer-based two-way bindings (scope: { prop: '=' })
  • [ ] Scoped CSS with automatic class mangling
  • [ ] Async components with suspense boundaries
  • [ ] Browser devtools extension
  • [ ] Transition system for g-if/g-for

License

MIT