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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vulture

v4.0.0-alpha.1

Published

Downloads

48

Readme

vulture

js-standard-style

vulture is a front-end framework optimized for progressive enhancement and accessibility. Everything rendered with vulture must be accessible for everyone, even those who have chosen to disable JavaScript.

To accomplish this goal, vulture uses the concept of isomorphism, shared code on both the client and server. However, in order to be isomorphic vulture uses a virtual DOM (specifically the virtual-dom package). This inevitably means writing HTML in JavaScript.

var v = require('vulture')
var render = require('vulture/dom')

render(v('p', 'Hello, world!'))

”Isn‘t that the opposite of progressive enhancement?” some may claim, but keep an open mind. The answer is not at all. There are different techniques for achieving a progressively enhanced web app, vulture just takes a more modern one.

Writing HTML in JavaScript gives a couple of acute benefits. First, the DOM can be constructed everywhere. Whether it be on the server, client, service worker, or refrigerator. Second, it‘s super easy to script in your templates. After all, it‘s just JavaScript! Third, we can run checks on your DOM for accessibility, semanticity, and more really simply.

For those who want a more HTML like syntax, JSX is an enhancement. For more information see here. The above example would instead be this:

var v = require('vulture')
var render = require('vulture/dom')

render(<p>Hello, world!</p>)

Strengths

  • Small. With one of the smallest file sizes of any front-end framework, vulture will not get in your way. Finally there is a front-end framework which is not a behemoth for users to download.
  • Blazing fast. The virtual DOM is super efficient as it allows for micro diffing and patching of the rendered DOM.
  • Isomorphic. vulture can easily go through an initial server render, and state is handled in such a way that it may be easily communicated across page visits. Whether it be the client, server, service worker, or even refrigerator, vulture can run.
  • Traversable virtual DOM. Other virtual DOM implementations like ReactJS are not easily traversable, vulture‘s virtual DOM output is. This allows for a wide range of tooling which just wasn’t possible when using ReactJS.

Library or Framework?

In API, vulture is really more of a library then a framework. However, with the entire vulture ecosystem, you can easily replace your front-end framework with vulture. The ecosystem and mindset used when developing with vulture is what makes it a framework.

Components

At it’s core, vulture is just an advanced virtual DOM rendering library. Therefore it’s components are completely user defined.

var v = require('vulture')

function StarButton(data) {
  var isStarred = data.isStarred
  var target = data.target
  return (
    v('button',
      { class: [isStarred ? 'is-starred' : null] },
      (isStarred ? 'Starred' : 'Star') + ' ' + target)
	)
}

module.exports = StarButton

The above snippet is the minimum you need for a component. No compiler, no class, no objects, just a plain function which you have complete control over. The only thing you need is the v function which is a helper for creating virtual DOM nodes.

To use the component is even easier.

var v = require('vulture')
var ButtonStar = require('./ButtonStar')

function Person(data) {
  var firstName = data.firstName
  var lastName = data.lastName
  var about = data.about
  var isStarred = data.isStarred
  return (
    v('article', [
      v('h1', firstName + ' ' + lastName),
      ButtonStar({
        target: firstName,
        isStarred: isStarred
      })
    ])
  )
}

module.exports = Person

Because our components are just functions, we can call them as such.

This also means that our rendered virtual DOM trees are not lazy as they are in ReactJS. Allowing you to traverse the full virtual DOM and apply transformations as you will.

State

TODO

JSX

To use with JSX, first install this JSX babel plugin by running:

$ npm install --save babel-plugin-transform-jsx

And then add the following to your .babelrc file:

{
  "plugins": [
    ["transform-jsx", { "module": "vulture/jsx" }]
  ]
}

That’s it! Unlike ReactJS, you don‘t need to require or import the vulture module in every file. If you are using JSX the plugin will know and add an appropriate import statement. Just remember to transform ES6 modules.

API

v(tagName? = 'div', properties? = {}, children?)

This will create a new virtual DOM node using the parameters. You can generally throw anything at this function and it will work. For example:

v('div', [v('p', 'Hello, world!')])

Would actually be like calling:

v('div', {}, [v('p', {}, ['Hello, world!'])])

If you are using JSX you should never really need this function.

For more information on what is returned, see the virtual-dom documentation.

  • tagName: The tag name string to be used. The standard stuff: div, h1, p, input, and on.
  • properties: An object of key/value properties. Can be considered as properties on the DOM node, or DOM attributes.
  • children: An array (or single value) of any type. Represents the children of the node.

renderToString

TODO

renderToDOM

TODO

applyState

TODO

map

TODO

forEach

TODO

reduce

TODO