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">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Svelte-Tauri</title>
</head>
<body>
<div id="app"></div>
<body id="app">
<script type="module" src="/src/main.ts"></script>
</body>
</html>

View File

@@ -1,14 +1,16 @@
<script lang="ts">
import { theme } from '$lib/stores/theme';
import Router from '$lib/router/Router.svelte';
import BaseLayout from '$lib/layout/BaseLayout.svelte';
$: {
document.documentElement.setAttribute('data-theme', $theme);
document.documentElement.classList.value = $theme;
}
import Router from '$router/Router.svelte'
import { ModeWatcher, mode } from 'mode-watcher'
import Header from '$lib/components/HeaderNav.svelte'
import { Toaster } from 'svelte-sonner'
</script>
<BaseLayout>
<Router />
</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 />
</main>
</div>

View File

@@ -1,15 +1,16 @@
import './styles.pcss';
import App from './App.svelte';
import './styles.postcss'
import App from './App.svelte'
const target = document.getElementById('app');
if (!target)
const target = document.getElementById('app')
if (!target) {
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({
target,
intro: true
});
})
export default app;
export default app