import BaseUIElement from "../BaseUIElement" import { SvelteComponentTyped } from "svelte" /** * The SvelteUIComponent serves as a translating class which which wraps a SvelteElement into the BaseUIElement framework. * Also see ToSvelte.svelte for the opposite conversion */ export default class SvelteUIElement< Props extends Record = any, Events extends Record = any, Slots extends Record = any > extends BaseUIElement { private readonly _svelteComponent: { new (args: { target: HTMLElement props: Props events?: Events slots?: Slots }): SvelteComponentTyped } private readonly _props: Props constructor(svelteElement, props: Props) { super() this._svelteComponent = svelteElement this._props = props } protected InnerConstructElement(): HTMLElement { const el = document.createElement("div") new this._svelteComponent({ target: el, props: this._props, }) return el } }