// This interface is only exposed and any Riot component will receive the following properties export interface RiotCoreComponent
{ // automatically generated on any component instance readonly props: P readonly root: HTMLElement readonly name?: string // TODO: add the @riotjs/dom-bindings types readonly slots: any[] mount( element: HTMLElement, initialState?: S, parentScope?: object ): RiotComponent
update(
newState?: Partial,
parentScope?: object
): RiotComponent
unmount(keepRootElement: boolean): RiotComponent
// Helpers $(selector: string): HTMLElement $$(selector: string): [HTMLElement] } // This object interface is created anytime a riot file will be compiled into javascript export interface RiotComponentShell
{ readonly css?: string readonly exports?: () => RiotComponentExport
|object readonly name?: string // TODO: add the @riotjs/dom-bindings types template(): any } // Interface that can be used when creating the components export export interface RiotComponentExport
{ // optional on the component object state?: S // optional alias to map the children component names components?: { [key: string]: RiotComponentShell
} // state handling methods shouldUpdate?(newProps: P, currentProps: P): boolean // lifecycle methods onBeforeMount?(currentProps: P, currentState: S): void onMounted?(currentProps: P, currentState: S): void onBeforeUpdate?(currentProps: P, currentState: S): void onUpdated?(currentProps: P, currentState: S): void onBeforeUnmount?(currentProps: P, currentState: S): void onUnmounted?(currentProps: P, currentState: S): void [key: string]: any } // All the RiotComponent Public interface properties are optional export interface RiotComponent
extends RiotCoreComponent
, RiotComponentExport
{}
export type RegisteredComponentsMap = Map (component: RiotComponent ) => RiotComponent
export type InstalledPluginsSet = Set (componentName: string, shell: RiotComponentShell ): RegisteredComponentsMap
export function unregister(componentName: string): RegisteredComponentsMap
export function mount (selector: string, initialProps?: P, componentName?: string): RiotComponent []
export function unmount(selector: string, keepRootElement: boolean):HTMLElement[]
export function install(plugin: ComponentEnhancer):InstalledPluginsSet
export function uninstall(plugin: ComponentEnhancer):InstalledPluginsSet
export function component (shell: RiotComponentShell ):(el: HTMLElement, initialProps?: P) => RiotComponent
export const version: string