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

virtex

v0.4.0

Published

Small, focused virtual dom library.

Downloads

3,956

Readme

virtex

js-standard-style

Small, focused virtual dom library that allows you to re-interpret all side effects via an action dispatcher. Those side effects include rendering 'thunks' (the primitive from which components are built), and DOM rendering. This allows you to do interesting things, like thread state from a single atom into your components in a pure way.

Installation

$ npm install virtex

Usage

virtex consists of two functions create and update, curried with an effect processor. You initialize them like this:

const {create, update} = virtex(effect)

  • create(tree) - takes a virtual node tree and returns a DOM element (if you are using virtex-dom)
  • update(oldTree, newTree) - takes the previous vnode tree and the new vnode tree and renders them into the DOM over the old nodes
  • effect(action) - handle all effectful actions (DOM manipulation and thunk rendering, for the time being)

Example

import {createStore, applyMiddleware} from 'redux'
import dom from 'virtex-dom'
import virtex from 'virtex'
import app from './app'

const store = applyMiddleware(dom(document))(createStore)(() => {}, {})
const {create, update} = virtex(store.dispatch)

let tree = app(store.getState())
const node = create(tree)

document.body.appendChild(node)

store.subscribe(() => {
  const state = store.getState()
  const newTree = app(state)

  update(tree, newTree, node)
  tree = newTree
})

JSX Pragma

Virtex itself exports a very minimal jsx/hyperscript function for building elements. It doesn't provide any syntactic sugar or register event handlers or anything like that - if you want those things, you should use virtex-element. If you want to build your own JSX pragma, you should build it on top of virtex's element, however:

import {element} from 'virtex'

function myElement (type, attrs, ...children) {
  if (attrs.focused) {
    attrs.focused = node => node.focus()
  }
}

Would allow you to pass a focused bool that would focus the element in question when it is rendered.

Processing effects

Your effect processor receives an action object, with at least one field: type. The other object properties are type specific. The available actions (and actions creators) are exported on the main virtex object, you can grab them like this:

import {actions} from 'virtex'

const {CREATE_ELEMENT} = actions.types

The available actions are:

CREATE_ELEMENT
SET_ATTRIBUTE
REMOVE_ATTRIBUTE
APPEND_CHILD
REPLACE_NODE
REMOVE_NODE
INSERT_BEFORE
CREATE_THUNK
UPDATE_THUNK
DESTROY_THUNK

Refer to actions.js and the existing middleware for more details on their structure and interpretation.

Performance

Virtex is not the fastest, but it's pretty fast. 6-7x faster than React, and about on par (ok, just a little slower) with snabbdom/deku. Here's the vdom-benchmark.

Ecosystem

License

The MIT License

Copyright © 2015, Weo.io <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.