- v0.9.0Latest
- v0.8.1
- v0.8.0
- v0.7.1
- v0.7.1-beta.2
- v0.6.0
- v0.6.0-beta1
- v0.6.0.beta3
- v0.6.0.beta2
- v0.6.0.beta1
- v0.5.0
- v0.5.0.beta8
- v0.5.0.beta7
- v0.5.0.beta6
- v0.5.0.beta5
- v0.5.0.beta4
- v0.5.0.beta3
- v0.5.0.beta2
- v0.5.0.beta1
- v0.4.0
- v0.3.6
- v0.3.5
- v0.3.4
- v0.3.3
- v0.3.2
- v0.3.1
- v0.3.0
- v0.2.9
- v0.2.8
- v0.2.7
- v0.2.6
- v0.2.5
- v0.2.4
- v0.2.3
- v0.2.1
- v0.2.0
- v0.1.3
- v0.1.2
- v0.1.1
Static Configurable Hyperscript
This is a very simple implementation of hyperscript with a few useful properties for modern environments:
- exposed as ES module
- clean, modern JavaScript with types and documentation
- test suite
- can be instantiated with different DOM implementations like deno_dom or xmldom
It provides a HyperScript-compatible h function, along with React-compatible
createElement. It also generally works fine with XML, not just HTML, for example
with xmldom.
To use this in the browser, you need to use a transpiler that understands JSR imports, and write:
import { h } from '@mdekstrand/hyperstatic';
let elt = h('a.link', {href: 'https://example.com'}, 'Example');If you use esbuild with esbuild-module-loader, you can specify the following
options to transpile JSX to Hyperstatic-based DOM manipulations for the browser:
{
jsx: "automatic",
jsxImportSource: "@mdekstrand/hyperstatic/browser",
}Node and JSDOM
To use in Node with JSDom:
import { h } from 'jsr:@mdekstrand/hyperstatic/jsdom';
let elt = h('a.link', {href: 'https://example.com'}, 'Example');Use with JSX
A Hyperstatic instance also exposes a React-compatible createElement
function, Fragment constant, and modern JSX runtime jsx and jsxs
functions to enable use with JSX. You enable this with the following
in tsconfig.json:
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@mdekstrand/hyperstatic/jsdom"
}
}