forked from MapComplete/MapComplete
ToSvelte will now bind directly to svelte in the case that a SvelteUIElement is passed. This helps with cleaning up MapLibre maps, which should help with #2024
This commit is contained in:
parent
7038fcc6f6
commit
7d678d95c7
4 changed files with 54 additions and 18 deletions
|
|
@ -11,7 +11,7 @@ export default class SvelteUIElement<
|
|||
Events extends Record<string, any> = any,
|
||||
Slots extends Record<string, any> = any
|
||||
> extends BaseUIElement {
|
||||
private readonly _svelteComponent: {
|
||||
public readonly _svelteComponent: {
|
||||
new (args: {
|
||||
target: HTMLElement
|
||||
props: Props
|
||||
|
|
@ -19,10 +19,11 @@ export default class SvelteUIElement<
|
|||
slots?: Slots
|
||||
}): SvelteComponentTyped<Props, Events, Slots>
|
||||
}
|
||||
private readonly _props: Props
|
||||
private readonly _events: Events
|
||||
private readonly _slots: Slots
|
||||
public readonly _props: Props
|
||||
public readonly _events: Events
|
||||
public readonly _slots: Slots
|
||||
private tag: "div" | "span" = "div"
|
||||
public readonly isSvelte = true
|
||||
|
||||
constructor(svelteElement, props?: Props, events?: Events, slots?: Slots) {
|
||||
super()
|
||||
|
|
@ -47,4 +48,18 @@ export default class SvelteUIElement<
|
|||
})
|
||||
return el
|
||||
}
|
||||
|
||||
public getClass(){
|
||||
if(this.clss.size === 0){
|
||||
return undefined
|
||||
}
|
||||
return this.clss
|
||||
}
|
||||
|
||||
public getStyle(){
|
||||
if(this.style === ""){
|
||||
return undefined
|
||||
}
|
||||
return this.style
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue