2023-01-17 18:31:51 +01:00
|
|
|
import BaseUIElement from "../BaseUIElement"
|
|
|
|
|
2023-01-22 20:59:50 +01:00
|
|
|
/**
|
|
|
|
* The SvelteUIComponent serves as a translating class which which wraps a SvelteElement into the BaseUIElement framework.
|
|
|
|
*/
|
2023-01-17 18:31:51 +01:00
|
|
|
export default class SvelteUIElement extends BaseUIElement {
|
|
|
|
private readonly _svelteComponent
|
|
|
|
private readonly _props: Record<string, any>
|
|
|
|
|
|
|
|
constructor(svelteElement, props: Record<string, any>) {
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|