consistent API for any virtual dom library
Switch branches/tags
greenkeeper/inferno-4.0.0 greenkeeper/inferno-4.0.1 greenkeeper/inferno-4.0.2 greenkeeper/inferno-4.0.3 greenkeeper/inferno-4.0.4 greenkeeper/inferno-4.0.5 greenkeeper/inferno-4.0.6 greenkeeper/inferno-4.0.7 greenkeeper/inferno-4.0.8 greenkeeper/inferno-5.0.0 greenkeeper/inferno-5.0.1 greenkeeper/inferno-5.0.2 greenkeeper/inferno-5.0.3 greenkeeper/inferno-5.0.4 greenkeeper/inferno-5.0.5 greenkeeper/inferno-5.0.6 greenkeeper/inferno-5.1.0 greenkeeper/inferno-5.1.1 greenkeeper/inferno-5.2.0 greenkeeper/inferno-5.3.0 greenkeeper/inferno-5.4.0 greenkeeper/inferno-5.4.1 greenkeeper/inferno-5.5.0 greenkeeper/inferno-5.6.0 greenkeeper/inferno-5.6.1 greenkeeper/inferno-6.0.0 greenkeeper/inferno-6.0.1 greenkeeper/inferno-6.0.2 greenkeeper/inferno-6.0.3 greenkeeper/inferno-6.1.0 greenkeeper/inferno-6.1.1 greenkeeper/inferno-6.1.2 greenkeeper/inferno-6.1.3 greenkeeper/inferno-6.1.4 greenkeeper/inferno-6.1.5 greenkeeper/inferno-6.2.0 greenkeeper/inferno-6.2.1 greenkeeper/inferno-6.3.0 greenkeeper/inferno-6.3.1 greenkeeper/inferno-7.0.0 greenkeeper/inferno-7.0.1 greenkeeper/inferno-7.0.2 greenkeeper/inferno-7.0.4 greenkeeper/monorepo.react-16.4.2 greenkeeper/monorepo.react-16.5.1 greenkeeper/monorepo.react-16.5.2 greenkeeper/monorepo.react-16.6.0 greenkeeper/monorepo.react-16.6.1 greenkeeper/monorepo.react-16.6.2 greenkeeper/monorepo.react-16.6.3 greenkeeper/preact-8.4.0 greenkeeper/preact-8.4.1 greenkeeper/preact-8.4.2 greenkeeper/preact-pin-8.3.1 greenkeeper/react-16.0.0 greenkeeper/react-16.1.0 greenkeeper/react-16.1.1 greenkeeper/react-16.2.0 greenkeeper/react-16.3.0 greenkeeper/react-16.3.1 greenkeeper/react-16.3.2 greenkeeper/react-16.4.0 greenkeeper/rollup-0.47.0 greenkeeper/rollup-0.47.1 greenkeeper/rollup-0.47.2 greenkeeper/rollup-0.47.3 greenkeeper/rollup-0.47.4 greenkeeper/rollup-0.47.5 greenkeeper/rollup-0.47.6 greenkeeper/rollup-0.48.0 greenkeeper/rollup-0.48.1 greenkeeper/rollup-0.48.2 greenkeeper/rollup-0.49.0 greenkeeper/rollup-0.49.1 greenkeeper/rollup-0.49.2 greenkeeper/rollup-0.49.3 greenkeeper/rollup-0.50.0 greenkeeper/rollup-0.50.1 greenkeeper/rollup-0.51.0 greenkeeper/rollup-0.51.1 greenkeeper/rollup-0.51.2 greenkeeper/rollup-0.51.3 greenkeeper/rollup-0.51.4 greenkeeper/rollup-0.51.5 greenkeeper/rollup-0.51.6 greenkeeper/rollup-0.51.7 greenkeeper/rollup-0.51.8 greenkeeper/rollup-0.52.0 greenkeeper/rollup-0.52.1 greenkeeper/rollup-0.52.2 greenkeeper/rollup-0.52.3 greenkeeper/rollup-0.53.0 greenkeeper/rollup-0.53.1 greenkeeper/rollup-0.53.2 greenkeeper/rollup-0.53.3 greenkeeper/rollup-0.53.4 greenkeeper/rollup-0.54.0 greenkeeper/rollup-0.54.1 greenkeeper/rollup-0.55.0 greenkeeper/rollup-0.55.1 greenkeeper/rollup-0.55.2 greenkeeper/rollup-0.55.3 greenkeeper/rollup-0.55.4 greenkeeper/rollup-0.55.5 greenkeeper/rollup-0.56.0 greenkeeper/rollup-0.56.1 greenkeeper/rollup-0.56.2 greenkeeper/rollup-0.56.3 greenkeeper/rollup-0.56.4 greenkeeper/rollup-0.56.5 greenkeeper/rollup-0.57.0 greenkeeper/rollup-0.57.1 greenkeeper/rollup-0.58.0 greenkeeper/rollup-0.58.1 greenkeeper/rollup-0.58.2 greenkeeper/rollup-0.59.0 greenkeeper/rollup-0.59.1 greenkeeper/rollup-0.59.2 greenkeeper/rollup-0.59.3 greenkeeper/rollup-0.59.4 greenkeeper/rollup-0.60.0 greenkeeper/rollup-0.60.1 greenkeeper/rollup-0.60.2 greenkeeper/rollup-0.60.3 greenkeeper/rollup-0.60.4 greenkeeper/rollup-0.60.5 greenkeeper/rollup-0.60.6 greenkeeper/rollup-0.60.7 greenkeeper/rollup-0.61.0 greenkeeper/rollup-0.61.1 greenkeeper/rollup-0.61.2 greenkeeper/rollup-0.62.0 greenkeeper/rollup-0.63.0 greenkeeper/rollup-0.63.1 greenkeeper/rollup-0.63.2 greenkeeper/rollup-0.63.3 greenkeeper/rollup-0.63.4 greenkeeper/rollup-0.63.5 greenkeeper/rollup-0.64.0 greenkeeper/rollup-0.64.1 greenkeeper/rollup-0.65.0 greenkeeper/rollup-0.65.1 greenkeeper/rollup-0.65.2 greenkeeper/rollup-0.66.0 greenkeeper/rollup-0.66.1 greenkeeper/rollup-0.66.2 greenkeeper/rollup-0.66.3 greenkeeper/rollup-0.66.4 greenkeeper/rollup-0.66.5 greenkeeper/rollup-0.66.6 greenkeeper/rollup-0.67.0 greenkeeper/rollup-0.67.1 greenkeeper/rollup-0.67.2 greenkeeper/rollup-0.67.3 greenkeeper/rollup-0.67.4 greenkeeper/rollup-0.68.0 greenkeeper/rollup-plugin-commonjs-9.0.0 greenkeeper/rollup-plugin-commonjs-9.1.0 greenkeeper/rollup-plugin-commonjs-9.1.1 greenkeeper/rollup-plugin-commonjs-9.1.2 greenkeeper/rollup-plugin-commonjs-9.1.3 greenkeeper/rollup-plugin-commonjs-9.1.4 greenkeeper/rollup-plugin-commonjs-9.1.5 greenkeeper/rollup-plugin-commonjs-9.1.6 greenkeeper/rollup-plugin-commonjs-9.1.7 greenkeeper/rollup-plugin-commonjs-9.1.8 greenkeeper/rollup-plugin-commonjs-9.2.0 greenkeeper/rollup-plugin-node-resolve-4.0.0 greenkeeper/semantic-release-11.0.2 greenkeeper/semantic-release-12.2.2 greenkeeper/semantic-release-12.2.4 greenkeeper/semantic-release-12.2.5 greenkeeper/semantic-release-12.4.0 greenkeeper/semantic-release-12.4.1 greenkeeper/semantic-release-15.0.0 greenkeeper/semantic-release-15.0.1 greenkeeper/semantic-release-15.0.2 greenkeeper/semantic-release-15.0.3 greenkeeper/semantic-release-15.1.2 greenkeeper/semantic-release-15.1.3 greenkeeper/semantic-release-15.1.4 greenkeeper/semantic-release-15.1.5 greenkeeper/semantic-release-15.1.6 greenkeeper/semantic-release-15.1.7 greenkeeper/semantic-release-15.1.8 greenkeeper/semantic-release-15.1.11 greenkeeper/semantic-release-15.3.0 greenkeeper/semantic-release-15.4.1 greenkeeper/semantic-release-15.4.2 greenkeeper/semantic-release-15.4.3 greenkeeper/semantic-release-15.4.4 greenkeeper/semantic-release-15.5.0 greenkeeper/semantic-release-15.5.1 greenkeeper/semantic-release-15.5.2 greenkeeper/semantic-release-15.5.3 greenkeeper/semantic-release-15.5.4 greenkeeper/semantic-release-15.5.5 greenkeeper/semantic-release-15.6.0 greenkeeper/semantic-release-15.6.1 greenkeeper/semantic-release-15.6.2 greenkeeper/semantic-release-15.6.3 greenkeeper/semantic-release-15.7.0 greenkeeper/semantic-release-15.7.1 greenkeeper/semantic-release-15.7.2 greenkeeper/semantic-release-15.8.0 greenkeeper/semantic-release-15.8.1 greenkeeper/semantic-release-15.9.1 greenkeeper/semantic-release-15.9.2 greenkeeper/semantic-release-15.9.3 greenkeeper/semantic-release-15.9.5 greenkeeper/semantic-release-15.9.6 greenkeeper/semantic-release-15.9.7 greenkeeper/semantic-release-15.9.8 greenkeeper/semantic-release-15.9.9 greenkeeper/semantic-release-15.9.11 greenkeeper/semantic-release-15.9.12 greenkeeper/semantic-release-15.9.13 greenkeeper/semantic-release-15.9.14 greenkeeper/semantic-release-15.9.15 greenkeeper/semantic-release-15.9.16 greenkeeper/semantic-release-15.9.17 greenkeeper/semantic-release-15.10.3 greenkeeper/semantic-release-15.10.4 greenkeeper/semantic-release-15.10.5 greenkeeper/semantic-release-15.10.6 greenkeeper/semantic-release-15.10.7 greenkeeper/semantic-release-15.10.8 greenkeeper/semantic-release-15.11.0 greenkeeper/semantic-release-15.12.0 greenkeeper/semantic-release-15.12.1 greenkeeper/semantic-release-15.12.2 greenkeeper/semantic-release-15.12.3 greenkeeper/semantic-release-15.12.4 greenkeeper/semantic-release-15.12.5 greenkeeper/semantic-release-15.13.0 greenkeeper/semantic-release-15.13.1 greenkeeper/@types/node-10.0.3 greenkeeper/@types/node-10.0.7 greenkeeper/@types/node-10.0.9 greenkeeper/@types/node-10.0.10 greenkeeper/@types/node-10.1.0 greenkeeper/@types/node-10.1.1 greenkeeper/@types/node-10.1.2 greenkeeper/@types/node-10.1.3 greenkeeper/@types/node-10.1.4 greenkeeper/@types/node-10.3.0 greenkeeper/@types/node-10.3.1 greenkeeper/@types/node-10.3.2 greenkeeper/@types/node-10.3.3 greenkeeper/@types/node-10.3.4 greenkeeper/@types/node-10.3.5 greenkeeper/@types/node-10.3.6 greenkeeper/@types/node-10.5.0 greenkeeper/@types/node-10.5.1 greenkeeper/@types/node-10.5.2 greenkeeper/@types/node-10.5.3 greenkeeper/@types/node-10.5.4 greenkeeper/@types/node-10.5.5 greenkeeper/@types/node-10.5.6 greenkeeper/@types/node-10.5.7 greenkeeper/@types/node-10.5.8 greenkeeper/@types/node-10.7.0 greenkeeper/@types/node-10.7.1 greenkeeper/@types/node-10.7.2 greenkeeper/@types/node-10.9.0 greenkeeper/@types/node-10.9.1 greenkeeper/@types/node-10.9.2 greenkeeper/@types/node-10.9.3 greenkeeper/@types/node-10.9.4 greenkeeper/@types/node-10.10.0 greenkeeper/@types/node-10.10.1 greenkeeper/@types/node-10.10.2 greenkeeper/@types/node-10.10.3 greenkeeper/@types/node-10.11.0 greenkeeper/@types/node-10.11.1 greenkeeper/@types/node-10.11.2 greenkeeper/@types/node-10.11.3 greenkeeper/@types/node-10.11.4 greenkeeper/@types/node-10.11.5 greenkeeper/@types/node-10.11.6 greenkeeper/@types/node-10.11.7 greenkeeper/@types/node-10.12.0 greenkeeper/@types/node-10.12.1 greenkeeper/@types/node-10.12.2 greenkeeper/@types/node-10.12.3 greenkeeper/@types/node-10.12.4 greenkeeper/@types/node-10.12.5 greenkeeper/@types/node-10.12.6 greenkeeper/@types/node-10.12.7 greenkeeper/@types/node-10.12.8 greenkeeper/@types/node-10.12.9 greenkeeper/@types/node-10.12.10 greenkeeper/@types/node-10.12.11 greenkeeper/@types/node-10.12.12 greenkeeper/@types/node-10.12.13 greenkeeper/@types/node-10.12.14 greenkeeper/@types/node-10.12.15 greenkeeper/update-to-node-10 master
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/dom
.gitignore
.npmignore
.travis.yml
README.md
build.ts
global.d.ts
package.json
tsconfig.json
yarn.lock

README.md

any-dom

consistent API for any virtual dom library

Greenkeeper badge

Provides a consistent API for any virtual dom library. Now one can create libraries that are not bound to only a single virtual dom library implementation.

Idea

There are so many virtual dom libraries on the internet right now and all of them have different APIs to create or patch the DOM. This makes it awfully tough to remember the signature while using and deters developers to make frameworks/libraries that are Virtual DOM agnostic.

Any DOM aims to solve this problem but keeping the API simple and consistent. It abstracts the original patching function and provides a more simpler function that looks like this —

function patch (container: HTMLElement, vNode: VirtualNode) : void 

The patch function takes in two arguments — First is the real DOM element and second is Virtual DOM element and it returns nothing. Now we can pass the patch function as an argument to our framework/library and expect it to just work :-)

Usage

Simplified Imports

// Using react
import {patch, h} from 'any-dom/react'

// using snabbdom
import {patch, h} from 'any-dom/snabbdom'

// using preact
import {patch, h} from 'any-dom/preact'

Simplified CDN

<script src="https://unpkg.com/any-dom/react.js"></script>

<script >
  console.log(window.anydom.patch)
</script>

Usage inside the DOM

import {patch, h} from 'any-dom/react'

const element = (
  h('h1', [
    'Hello, World!!'
  ])
)

patch(
  document.getElementById('root'),
  element  
)

Supported Libraries

Wishlist

  • Add mode virtual dom libraries.
  • Add consistent Hyperscript helpers