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

asasvirtuais

v3.0.0

Published

React form and action management utilities - v3 Monorepo Edition

Readme

asasvirtuais

React form and action management utilities for building data-driven applications.

Installation

From npm

npm install asasvirtuais

From esm.sh

import { Form } from 'https://esm.sh/[email protected]/forms'
import { useFields } from 'https://esm.sh/[email protected]/fields'
import { useAction } from 'https://esm.sh/[email protected]/action'

Quick Start: Forms

Simple Form

import { Form } from 'asasvirtuais/forms'

type LoginFields = {
  email: string
  password: string
}

type LoginResult = {
  token: string
}

async function loginAction(fields: LoginFields): Promise<LoginResult> {
  const response = await fetch('/api/login', {
    method: 'POST',
    body: JSON.stringify(fields)
  })
  return response.json()
}

function LoginForm() {
  return (
    <Form<LoginFields, LoginResult>
      defaults={{ email: '', password: '' }}
      action={loginAction}
    >
      {({ fields, setField, submit, loading, error }) => (
        <form onSubmit={submit}>
          <input
            type="email"
            value={fields.email}
            onChange={(e) => setField('email', e.target.value)}
          />
          <input
            type="password"
            value={fields.password}
            onChange={(e) => setField('password', e.target.value)}
          />
          <button type="submit" disabled={loading}>
            {loading ? 'Logging in...' : 'Login'}
          </button>
          {error && <p>Error: {error.message}</p>}
        </form>
      )}
    </Form>
  )
}

Core Modules

1. asasvirtuais/forms

Self-contained form nodes that manage state and actions. Nest forms to create complex workflows.

2. asasvirtuais/interface

Components and hooks for data-driven React apps.

Sub-modules:

  • asasvirtuais/interface: Main React CRUD components.
  • asasvirtuais/interface/indexed: IndexedDB storage via Dexie.
  • asasvirtuais/fetch-interface: REST API adapter.
  • asasvirtuais/yaml-interface: Local flat-file adapter.

Todo App Example

1. Define Schema

import { z } from 'zod';

export const todoSchema = {
  readable: z.object({
    id: z.string(),
    text: z.string(),
    completed: z.boolean(),
  }),
  writable: z.object({
    text: z.string(),
    completed: z.boolean().optional(),
  }),
}

2. Provide Context

import { FetchInterfaceProvider } from 'asasvirtuais/fetch-interface'
import { TableProvider } from 'asasvirtuais/interface'
import { todoSchema } from './database'

export default function RootLayout({ children }) {
  return (
    <FetchInterfaceProvider schema={todoSchema} baseUrl='/api/v1'>
       <TableProvider table='todos' schema={todoSchema} interface={useInterface()}>
          {children}
       </TableProvider>
    </FetchInterfaceProvider>
  )
}

3. Build UI

'use client'
import { useTable, CreateForm } from 'asasvirtuais/interface'
import { todoSchema } from '@/app/database'

function TodoList() {
  const { array, remove } = useTable('todos', todoSchema)

  return (
    <>
      <CreateForm table="todos" schema={todoSchema} defaults={{ text: '' }}>
        {({ fields, setField, submit }) => (
          <form onSubmit={submit}>
            <input
              value={fields.text}
              onChange={(e) => setField('text', e.target.value)}
            />
            <button type="submit">Add Todo</button>
          </form>
        )}
      </CreateForm>

      <ul>
        {array.map(todo => (
          <li key={todo.id}>
            {todo.text}
            <button onClick={() => remove.trigger({ id: todo.id })}>Delete</button>
          </li>
        ))}
      </ul>
    </>
  )
}

Model Package Path

A model package is a self-contained module for a specific data model.

Structure

packages/[model-name]/
├── index.ts          # Schema + types
├── fields.tsx        # Form fields
├── forms.tsx         # CRUD forms
├── provider.tsx      # Context + hooks
└── components.tsx    # Display components