Very simple DOM generator with types declaration.
# Via npm
npm install create-element-ts
# Or pnpm
pnpm add create-element-ts
# Yarn? sure
yarn add create-element-ts
Then import it to your project.
// ESM
import { h } from 'create-element-ts'
// CJS
const { h } = require('create-element-ts')
<script src="https://unpkg.com/create-element-ts/dist/index.umd.js"></script>
<script>
const { h } = window.CreateElement
// ...
</script>
Or... Why not ESM?
import { h } from 'https://unpkg.com/create-element-ts?module'
// ...
// step-1 - create element
const block = h('div', { class: 'foo' }, [h('span', 'bar'), 'baz'])
// step-2? - no more steps!
console.info(block.outerHTML) // <div class="foo"><span>bar</span>baz</div>