0.5.40 • Published 11 months ago

@!!!!!/elemental v0.5.40

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Try this library in the Browser Console on Deno.land!

For VS Code use this extension to get syntax highlighting.

var { html } = await import("https://deno.land/x/elementalist@0.5.39/main/deno.js?code")

// create a custom component
const myAsyncCustomComponent = async ({ style, children, ...props }) => {
    // load a big'ole depenency like d3
    const d3 = await import('https://cdn.skypack.dev/d3')
    return html`<div style=${style}>
        Do you even Async?
        Keys of the d3 library: ${JSON.stringify(Object.keys(d3))}
    </div>`
}

// add it to the local scope
html = html.extend({myAsyncCustomComponent})

// change some elements
document.body = html`<body style="padding:1rem;">
    Hello World (I render Immediately)
    <br>
    <myAsyncCustomComponent style='background: darkgray; color: white; padding: 1rem; border-radius: 1rem; margin: 0.3rem;' />
    <br>
    this ^ takes a second to render cause it has a massive async depenency
</body>`

You can also use it with JSX:

/** @jsx html */
var { html } = await import("https://deno.land/x/elementalist@0.5.34/main/deno.js?code")

// create a custom component
const myAsyncCustomComponent = async ({ style, children, ...props }) => {
    // load a big'ole depenency like d3
    const d3 = await import('https://cdn.skypack.dev/d3')
    return <div style={style}>
        Do you even Async?
        Keys of the d3 library: {JSON.stringify(Object.keys(d3))}
    </div>
}

// change some elements
document.body = <body style="padding:1rem;">
    Hello World (I render Immediately)
    <br>
    <myAsyncCustomComponent style='background: darkgray; color: white; padding: 1rem; border-radius: 1rem; margin: 0.3rem;' />
    <br>
    this ^ takes a second to render cause it has a massive async depenency
</body>
0.5.40

11 months ago

0.5.39

11 months ago

0.0.13

3 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago