forked from MapComplete/MapComplete
🚧 First svelte component
This commit is contained in:
parent
1c1df43bf9
commit
203d1b6b34
10 changed files with 809 additions and 668 deletions
21
UI/Base/SvelteUIElement.ts
Normal file
21
UI/Base/SvelteUIElement.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import BaseUIElement from "../BaseUIElement"
|
||||
|
||||
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
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue