use body as target

This commit is contained in:
Fractal-Tess
2024-01-24 04:06:49 +02:00
parent 2fde7cd4cc
commit cacbfe7428
3 changed files with 24 additions and 22 deletions

View File

@@ -1,12 +1,11 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Svelte-Tauri</title> <title>Svelte-Tauri</title>
</head> </head>
<body> <body id="app">
<div id="app"></div>
<script type="module" src="/src/main.ts"></script> <script type="module" src="/src/main.ts"></script>
</body> </body>
</html> </html>

View File

@@ -1,14 +1,16 @@
<script lang="ts"> <script lang="ts">
import { theme } from '$lib/stores/theme'; import Router from '$router/Router.svelte'
import Router from '$lib/router/Router.svelte'; import { ModeWatcher, mode } from 'mode-watcher'
import BaseLayout from '$lib/layout/BaseLayout.svelte'; import Header from '$lib/components/HeaderNav.svelte'
import { Toaster } from 'svelte-sonner'
$: {
document.documentElement.setAttribute('data-theme', $theme);
document.documentElement.classList.value = $theme;
}
</script> </script>
<BaseLayout> <ModeWatcher defaultMode="dark" />
<Toaster theme={$mode} />
<div class="relative flex flex-col h-screen" data-vaul-drawer-wrapper id="page">
<Header />
<main class="flex-1">
<Router /> <Router />
</BaseLayout> </main>
</div>

View File

@@ -1,15 +1,16 @@
import './styles.pcss'; import './styles.postcss'
import App from './App.svelte'; import App from './App.svelte'
const target = document.getElementById('app'); const target = document.getElementById('app')
if (!target) if (!target) {
throw new Error( throw new Error(
"The element with id of 'app' wasn't found on the base html file." "The element with id of 'app' was not found on the base html file. Create that element and try again"
); )
}
const app = new App({ const app = new App({
target, target,
intro: true intro: true
}); })
export default app; export default app