Add JSX support and a vanilla JS API
danieldietrich opened this issue Β· comments
Update: we need to distinguish this issue into two tasks:
- [π ββοΈ wontfix] there exist JSX DOM factories on npmjs.com, we do not ship them as part of candid. The JSX binding is part of the runtime env, not of the Candid lib.
- provide a function to programmatically define web-components
type Options = {
mode?: 'open' | 'closed' | null // shadow root mode (default: null)
extends?: string | null // super tag name (default: null)
props?: object | null // observed properties and default values
template?: HTMLTemplateElement | null // the html template
}
// Candid.createWebComponent()
function createWebComponent(name: string, options?: Options)
Question: Should createWebComponent()
call customElements.define()
?
Currently we use a declarative approach only and only have one public API candid(options)
to initialize Candid.
We should think about exposing the JS API in order to allow to create web-components dynamically using JS. Maybe it also makes sense to expose the web-import API.
It is not sufficient to just export existing functions. Most probably we might need to re-design the internal API.