Refactoring: use proper way to initialize the main svelte components
This commit is contained in:
parent
4dc48274dc
commit
5354cbf6c3
15 changed files with 43 additions and 30 deletions
|
@ -1,4 +1,5 @@
|
||||||
import SvelteUIElement from "./UI/Base/SvelteUIElement"
|
|
||||||
import StylesheetTestGui from "./UI/StylesheetTestGui.svelte"
|
import StylesheetTestGui from "./UI/StylesheetTestGui.svelte"
|
||||||
|
|
||||||
new SvelteUIElement(StylesheetTestGui, {}).AttachTo("main")
|
new StylesheetTestGui({
|
||||||
|
target: document.getElementById("maindiv")
|
||||||
|
})
|
||||||
|
|
|
@ -65,6 +65,7 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<main>
|
||||||
<div class="m-4 flex flex-col">
|
<div class="m-4 flex flex-col">
|
||||||
<LanguagePicker
|
<LanguagePicker
|
||||||
clss="self-end max-w-full"
|
clss="self-end max-w-full"
|
||||||
|
@ -165,3 +166,4 @@
|
||||||
v{Constants.vNumber}
|
v{Constants.vNumber}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</main>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
}
|
}
|
||||||
> = UIEventSource.FromPromise(Utils.downloadJsonCached(source))
|
> = UIEventSource.FromPromise(Utils.downloadJsonCached(source))
|
||||||
</script>
|
</script>
|
||||||
|
<main>
|
||||||
<h1>Contributed images with MapComplete: leaderboard</h1>
|
<h1>Contributed images with MapComplete: leaderboard</h1>
|
||||||
|
|
||||||
{#if $data}
|
{#if $data}
|
||||||
|
@ -67,3 +67,4 @@
|
||||||
<div>
|
<div>
|
||||||
Logged in as {$loggedInContributor}
|
Logged in as {$loggedInContributor}
|
||||||
</div>
|
</div>
|
||||||
|
</main>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
console.log("???")
|
console.log("???")
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<main>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<Tr t={Translations.t.general["404"]} />
|
<Tr t={Translations.t.general["404"]} />
|
||||||
<BackButton
|
<BackButton
|
||||||
|
@ -18,3 +19,4 @@
|
||||||
</div>
|
</div>
|
||||||
</BackButton>
|
</BackButton>
|
||||||
</div>
|
</div>
|
||||||
|
</main>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
userRelatedState: new UserRelatedState(osmConnection)
|
userRelatedState: new UserRelatedState(osmConnection)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<main>
|
||||||
<div class="flex h-screen flex-col overflow-hidden px-4">
|
<div class="flex h-screen flex-col overflow-hidden px-4">
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
<h2 class="flex items-center">
|
<h2 class="flex items-center">
|
||||||
|
@ -33,3 +33,4 @@
|
||||||
<Tr t={Translations.t.general.backToIndex} />
|
<Tr t={Translations.t.general.backToIndex} />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
</main>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
import { UIEventSource } from "../Logic/UIEventSource"
|
import { UIEventSource } from "../Logic/UIEventSource"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<main>
|
||||||
<div>
|
<div>
|
||||||
<h1>Stylesheet testing grounds</h1>
|
<h1>Stylesheet testing grounds</h1>
|
||||||
|
|
||||||
|
@ -167,3 +168,4 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</main>
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Translation } from "./i18n/Translation"
|
import { Button, Search } from "flowbite-svelte"
|
||||||
import LanguagePicker from "./InputElement/LanguagePicker.svelte"
|
|
||||||
import Tr from "./Base/Tr.svelte"
|
|
||||||
import ToSvelte from "./Base/ToSvelte.svelte"
|
|
||||||
|
|
||||||
const m = new Map<string, string>()
|
|
||||||
m.set("nl", "Nederlands")
|
|
||||||
const tr = Translation.fromMap(m, true)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<LanguagePicker/>
|
<main>
|
||||||
<h1>Svelte native</h1>
|
<Search size="md">
|
||||||
<Tr t={tr}/>
|
</Search>
|
||||||
<h1>ToSvelte</h1>
|
</main>
|
||||||
<ToSvelte construct={tr}/>
|
|
||||||
|
|
|
@ -203,6 +203,7 @@
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<main>
|
||||||
<div class="absolute top-0 left-0 h-screen w-screen overflow-hidden">
|
<div class="absolute top-0 left-0 h-screen w-screen overflow-hidden">
|
||||||
<MaplibreMap map={maplibremap} mapProperties={mapproperties} />
|
<MaplibreMap map={maplibremap} mapProperties={mapproperties} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -688,3 +689,4 @@
|
||||||
<CloseAnimation isOpened={selectedElement.map(sl => sl !== undefined && sl?.properties?.id === LastClickFeatureSource.newPointElementId)} moveTo={openNewElementButton} debug="newElement"/>
|
<CloseAnimation isOpened={selectedElement.map(sl => sl !== undefined && sl?.properties?.id === LastClickFeatureSource.newPointElementId)} moveTo={openNewElementButton} debug="newElement"/>
|
||||||
<CloseAnimation isOpened={state.guistate.filtersPanelIsOpened} moveTo={openFilterButton} debug="filter"/>
|
<CloseAnimation isOpened={state.guistate.filtersPanelIsOpened} moveTo={openFilterButton} debug="filter"/>
|
||||||
<CloseAnimation isOpened={state.guistate.backgroundLayerSelectionIsOpened} moveTo={openBackgroundButton} debug="bg"/>
|
<CloseAnimation isOpened={state.guistate.backgroundLayerSelectionIsOpened} moveTo={openBackgroundButton} debug="bg"/>
|
||||||
|
</main>
|
||||||
|
|
|
@ -28,4 +28,6 @@ if (layout !== "") {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
new SvelteUIElement(AllThemesGui, {}).AttachTo("main")
|
new AllThemesGui({
|
||||||
|
target: document.getElementById("main")
|
||||||
|
})
|
||||||
|
|
|
@ -52,8 +52,10 @@ async function main() {
|
||||||
])
|
])
|
||||||
console.log("The available layers on server are", Array.from(availableLayers))
|
console.log("The available layers on server are", Array.from(availableLayers))
|
||||||
const state = new ThemeViewState(layout, availableLayers)
|
const state = new ThemeViewState(layout, availableLayers)
|
||||||
const main = new SvelteUIElement(ThemeViewGUI, { state })
|
new ThemeViewGUI({
|
||||||
main.AttachTo("maindiv")
|
target: document.getElementById("maindiv"),
|
||||||
|
props: {state}
|
||||||
|
})
|
||||||
Array.from(document.getElementsByClassName("delete-on-load")).forEach((el) => {
|
Array.from(document.getElementsByClassName("delete-on-load")).forEach((el) => {
|
||||||
el.parentElement.removeChild(el)
|
el.parentElement.removeChild(el)
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import ThemeViewState from "./src/Models/ThemeViewState"
|
import ThemeViewState from "./src/Models/ThemeViewState"
|
||||||
import SvelteUIElement from "./src/UI/Base/SvelteUIElement"
|
|
||||||
import ThemeViewGUI from "./src/UI/ThemeViewGUI.svelte"
|
import ThemeViewGUI from "./src/UI/ThemeViewGUI.svelte"
|
||||||
import LayoutConfig from "./src/Models/ThemeConfig/LayoutConfig";
|
import LayoutConfig from "./src/Models/ThemeConfig/LayoutConfig";
|
||||||
import MetaTagging from "./src/Logic/MetaTagging";
|
import MetaTagging from "./src/Logic/MetaTagging";
|
||||||
|
@ -47,8 +46,10 @@ async function main() {
|
||||||
MetaTagging.setThemeMetatagging(new ThemeMetaTagging())
|
MetaTagging.setThemeMetatagging(new ThemeMetaTagging())
|
||||||
// LAYOUT.ADD_LAYERS
|
// LAYOUT.ADD_LAYERS
|
||||||
const state = new ThemeViewState(new LayoutConfig(<any> layout), availableLayers)
|
const state = new ThemeViewState(new LayoutConfig(<any> layout), availableLayers)
|
||||||
const main = new SvelteUIElement(ThemeViewGUI, { state })
|
new ThemeViewGUI({
|
||||||
main.AttachTo("maindiv")
|
target: document.getElementById("maindiv"),
|
||||||
|
props: {state}
|
||||||
|
})
|
||||||
Array.from(document.getElementsByClassName("delete-on-load")).forEach(el => {
|
Array.from(document.getElementsByClassName("delete-on-load")).forEach(el => {
|
||||||
el.parentElement.removeChild(el)
|
el.parentElement.removeChild(el)
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import SvelteUIElement from "./UI/Base/SvelteUIElement"
|
|
||||||
import Leaderboard from "./UI/Leaderboard.svelte"
|
import Leaderboard from "./UI/Leaderboard.svelte"
|
||||||
|
|
||||||
new SvelteUIElement(Leaderboard, {}).AttachTo("main")
|
new Leaderboard({
|
||||||
|
target: document.getElementById("main")
|
||||||
|
})
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import SvelteUIElement from "./UI/Base/SvelteUIElement"
|
|
||||||
import NotFound from "./UI/NotFound.svelte"
|
import NotFound from "./UI/NotFound.svelte"
|
||||||
|
|
||||||
new SvelteUIElement(NotFound, {}).AttachTo("maindiv")
|
new NotFound({
|
||||||
|
target: document.getElementById("maindiv")
|
||||||
|
})
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
import SvelteUIElement from "./UI/Base/SvelteUIElement"
|
|
||||||
import PrivacyGui from "./UI/PrivacyGui.svelte"
|
import PrivacyGui from "./UI/PrivacyGui.svelte"
|
||||||
new SvelteUIElement(PrivacyGui, {}).AttachTo("main")
|
new PrivacyGui({
|
||||||
|
target: document.getElementById("main")
|
||||||
|
})
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import SvelteUIElement from "./UI/Base/SvelteUIElement"
|
import SvelteUIElement from "./UI/Base/SvelteUIElement"
|
||||||
import Test from "./UI/Test.svelte"
|
import Test from "./UI/Test.svelte"
|
||||||
|
|
||||||
new SvelteUIElement(Test).AttachTo("maindiv")
|
new Test({
|
||||||
|
target: document.getElementById("maindiv")
|
||||||
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue