preact-island
Version:
🏝 Create your own slice of paradise on any website.
31 lines (30 loc) • 1.12 kB
TypeScript
import { ComponentType, VNode } from 'preact';
import { FC } from 'preact/compat';
import { Island } from './island';
export declare type InitialPropsWebComponent = {
[x: string]: any;
};
export declare const createIslandWebComponent: <P extends InitialPropsWebComponent>(elementName: string, widget: ComponentType<P>) => {
render: (args: Omit<{
selector?: string | undefined;
clean?: boolean | undefined;
replace?: boolean | undefined;
inline?: boolean | undefined;
initialProps?: Partial<P> | undefined;
propsSelector?: string | undefined;
elementName?: string | undefined;
}, "replace" | "clean" | "inline">) => void;
injectStyles: (style: string) => void;
_rootsToObservers: WeakMap<any, MutationObserver>;
_roots: any[];
_executedScript: HTMLOrSVGScriptElement | null;
props: P;
rerender: (props: P) => void;
destroy: () => void;
};
export declare const WebComponentPortal: FC<{
name: string;
container?: Element;
children: VNode<{}>;
style?: string | HTMLStyleElement;
}>;