Experimenting with Svelte: build a wrapper to convert 'old' components into Svelte, add a community index overview

This commit is contained in:
Pieter Vander Vennet 2023-02-02 17:57:07 +01:00
parent dfc7ba2114
commit 02da80c311
11 changed files with 250 additions and 55 deletions

17
UI/Base/ToSvelte.svelte Normal file
View file

@ -0,0 +1,17 @@
<script lang="ts">
import BaseUIElement from "../BaseUIElement.js";
import { onMount } from "svelte";
export let construct: BaseUIElement | (() => BaseUIElement);
let elem: HTMLElement;
onMount(() => {
let html: HTMLElement
if (typeof construct === "function") {
html = construct().ConstructElement();
} else {
html = construct.ConstructElement();
}
elem.appendChild(html)
});
</script>
<span bind:this={elem}></span>