commit 28c177e43c306725f4ef417eaa1616b8c6b26317
parent 807bbaf1badfac1c5c55b1f9111fc639f4170559
Author: triesap <137732411+triesap@users.noreply.github.com>
Date: Sun, 15 Sep 2024 12:48:56 +0000
apps-lib: add app config component
Diffstat:
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/apps-lib/src/lib/components/app_config.svelte b/apps-lib/src/lib/components/app_config.svelte
@@ -0,0 +1,24 @@
+<script lang="ts">
+ import { app_config, app_layout, app_thc, app_win } from "$lib";
+ import { onMount } from "svelte";
+
+ onMount(async () => {
+ try {
+ app_win.set([window.innerHeight, window.innerWidth]);
+
+ const prefers_dark = window.matchMedia(
+ `(prefers-color-scheme: dark)`,
+ ).matches;
+
+ if (prefers_dark) app_thc.set(`dark`);
+ app_config.set(true);
+ } catch (e) {
+ console.log(`(layout mount) `, e);
+ } finally {
+ }
+ });
+
+ app_win.subscribe(([win_h, win_w]) => {
+ if (win_h > 800) app_layout.set("lg");
+ });
+</script>
diff --git a/apps-lib/src/lib/index.ts b/apps-lib/src/lib/index.ts
@@ -1,4 +1,5 @@
export * from "./locales/i18n"
+export { default as AppConfig } from "./components/app_config.svelte"
export { default as Envelope } from "./components/envelope.svelte"
export { default as EnvelopeTitled } from "./components/envelope_titled.svelte"
export { default as InputForm } from "./components/input_form.svelte"