mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-20 17:03:42 +00:00
migrate to typescript
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
import {themeBase, themeColor, themeSuccessBase} from "$lib/style/theme.server.js"
|
||||
|
||||
/** @type {import("./$types").LayoutServerLoad} */
|
||||
export async function load() {
|
||||
return {
|
||||
themeSuccessBase,
|
||||
themeBase,
|
||||
themeColor,
|
||||
}
|
||||
}
|
||||
8
src/routes/+layout.server.ts
Normal file
8
src/routes/+layout.server.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import {themeBase, themeColor, themeSuccessBase} from "$lib/style/theme.server"
|
||||
import type {LayoutServerLoad} from "./$types"
|
||||
|
||||
export const load = (async () => ({
|
||||
themeSuccessBase,
|
||||
themeBase,
|
||||
themeColor,
|
||||
})) satisfies LayoutServerLoad
|
||||
@@ -1,15 +1,17 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import "$lib/fonts/noto-sans-mono.scss"
|
||||
import "$lib/fonts/material-symbols-rounded.scss"
|
||||
import {onMount} from "svelte"
|
||||
import {applyTheme, argbFromHex, themeFromSourceColor} from "@material/material-color-utilities"
|
||||
import Navigation from "$lib/components/Navigation.svelte"
|
||||
import {hasSerialPermission} from "$lib/serial/device.js"
|
||||
import {initSerial} from "$lib/serial/connection.js"
|
||||
import {hasSerialPermission} from "$lib/serial/device"
|
||||
import {initSerial} from "$lib/serial/connection"
|
||||
// noinspection TypeScriptCheckImport
|
||||
import {pwaInfo} from "virtual:pwa-info"
|
||||
import type {LayoutServerData} from "./$types"
|
||||
import type {RegisterSWOptions} from "vite-plugin-pwa/types"
|
||||
|
||||
/** @type {import('./$types').LayoutServerData} */
|
||||
export let data
|
||||
export let data: LayoutServerData
|
||||
|
||||
onMount(async () => {
|
||||
const theme = themeFromSourceColor(argbFromHex("#6D81C7"), [
|
||||
@@ -19,15 +21,14 @@
|
||||
applyTheme(theme, {target: document.body, dark})
|
||||
|
||||
if (pwaInfo) {
|
||||
/** @type {import('vite-plugin-pwa/types').RegisterSWOptions} */
|
||||
const swOptions = {
|
||||
// noinspection TypeScriptCheckImport
|
||||
const {registerSW} = await import("virtual:pwa-register")
|
||||
registerSW({
|
||||
immediate: true,
|
||||
onRegisterError(error) {
|
||||
console.log("ServiceWorker Registration Error", error)
|
||||
},
|
||||
}
|
||||
const {registerSW} = await import("virtual:pwa-register")
|
||||
registerSW(swOptions)
|
||||
} satisfies RegisterSWOptions)
|
||||
}
|
||||
|
||||
if (await hasSerialPermission()) await initSerial()
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
export const prerender = true
|
||||
|
||||
export const trailingSlash = "always"
|
||||
@@ -1,6 +0,0 @@
|
||||
import {redirect} from "@sveltejs/kit"
|
||||
|
||||
/** @type {import("./$types").PageLoad} */
|
||||
export function load() {
|
||||
throw redirect(302, "/config/")
|
||||
}
|
||||
6
src/routes/+page.ts
Normal file
6
src/routes/+page.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import {redirect} from "@sveltejs/kit"
|
||||
import type {PageLoad} from "./$types"
|
||||
|
||||
export const load = (() => {
|
||||
throw redirect(302, "/config/")
|
||||
}) satisfies PageLoad
|
||||
@@ -1,6 +0,0 @@
|
||||
import {redirect} from "@sveltejs/kit"
|
||||
|
||||
/** @type {import("./$types").PageLoad} */
|
||||
export function load() {
|
||||
throw redirect(302, "/config/chords/")
|
||||
}
|
||||
6
src/routes/config/+page.ts
Normal file
6
src/routes/config/+page.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import {redirect} from "@sveltejs/kit"
|
||||
import type {PageLoad} from "./$types"
|
||||
|
||||
export const load = (() => {
|
||||
throw redirect(302, "/config/chords/")
|
||||
}) satisfies PageLoad
|
||||
@@ -1,6 +1,6 @@
|
||||
<script>
|
||||
import {chords} from "$lib/serial/connection.js"
|
||||
import {KEYMAP_CODES} from "$lib/serial/keymap-codes.js"
|
||||
<script lang="ts">
|
||||
import {chords} from "$lib/serial/connection"
|
||||
import {KEYMAP_CODES} from "$lib/serial/keymap-codes"
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
||||
Reference in New Issue
Block a user