JSPM

@semibran/manifest

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q9769F
  • License MIT

convert vdom nodes into html elements

Package Exports

  • @semibran/manifest

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@semibran/manifest) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

manifest

convert vdom nodes into html elements

let heading = manifest({
  tag: "h1",
  attributes: { class: "foo" },
  children: [ "hello world" ]
})

document.body.appendChild(heading)
console.log(document.body.outerHTML)
// <body><h1 class="foo">hello world</h1></body>

We can extend the definition of a virtual node as specified by hyper2/h2spec to cover primitive values. Doing so enables us to create "text nodes" out of raw strings, numbers, etc. and greatly simplifies vnode conversion. When used with primitive values, this function is practically equivalent to calling document.createTextNode, as in the following (impractical) example:

let foo = manifest("foo")
let bar = document.createTextNode("bar")
document.body.appendChild(foo)
document.body.appendChild(bar)
console.log(document.body.outerHTML)
// <body>foobar</body>

install

npm badge

To use this module in your project, package your code together using a bundler like rollup together with rollup-plugin-node-resolve.

license

MIT © Brandon Semilla