web/settings: move to state folder

This commit is contained in:
dumbmoron 2024-07-13 13:17:03 +00:00
parent 4232c3437b
commit 1f0958a0d1
No known key found for this signature in database
12 changed files with 15 additions and 15 deletions

View file

@ -6,7 +6,7 @@
Value extends CobaltSettings[Context][Id] Value extends CobaltSettings[Context][Id]
" "
> >
import settings, { updateSetting } from "$lib/settings"; import settings, { updateSetting } from "$lib/state/settings";
import type { CobaltSettings } from "$lib/types/settings"; import type { CobaltSettings } from "$lib/types/settings";
export let settingContext: Context; export let settingContext: Context;

View file

@ -5,7 +5,7 @@
Id extends keyof CobaltSettings[Context] Id extends keyof CobaltSettings[Context]
" "
> >
import settings, { updateSetting } from "$lib/settings"; import settings, { updateSetting } from "$lib/state/settings";
import type { CobaltSettings } from "$lib/types/settings"; import type { CobaltSettings } from "$lib/types/settings";
import Toggle from "$components/misc/Toggle.svelte"; import Toggle from "$components/misc/Toggle.svelte";

View file

@ -12,7 +12,7 @@
import ActionButton from "$components/buttons/ActionButton.svelte"; import ActionButton from "$components/buttons/ActionButton.svelte";
import SettingsButton from "$components/buttons/SettingsButton.svelte"; import SettingsButton from "$components/buttons/SettingsButton.svelte";
import { updateSetting } from "$lib/settings"; import { updateSetting } from "$lib/state/settings";
import type { DownloadModeOption } from "$lib/types/settings"; import type { DownloadModeOption } from "$lib/types/settings";
import IconSparkles from "$lib/icons/Sparkles.svelte"; import IconSparkles from "$lib/icons/Sparkles.svelte";

View file

@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import settings from "$lib/settings"; import settings from "$lib/state/settings";
import { device } from "$lib/device"; import { device } from "$lib/device";
import { locale, locales } from "$lib/i18n/translations"; import { locale } from "$lib/i18n/translations";
import SettingsToggle from "$components/buttons/SettingsToggle.svelte"; import SettingsToggle from "$components/buttons/SettingsToggle.svelte";

View file

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import settings, { updateSetting } from "$lib/settings"; import settings, { updateSetting } from "$lib/state/settings";
import { t, locale, locales } from "$lib/i18n/translations"; import { t, locale, locales } from "$lib/i18n/translations";
import languages from "$i18n/languages.json"; import languages from "$i18n/languages.json";

View file

@ -1,5 +1,5 @@
import { get } from 'svelte/store'; import { get } from 'svelte/store';
import settings from "$lib/settings"; import settings from "$lib/state/settings";
import type { CobaltAPIResponse } from "$lib/types/api"; import type { CobaltAPIResponse } from "$lib/types/api";
const apiURL = "https://api.cobalt.tools"; const apiURL = "https://api.cobalt.tools";

View file

@ -1,10 +1,10 @@
import { derived, readable, type Updater } from 'svelte/store'; import { derived, readable, type Updater } from 'svelte/store';
import { merge } from 'ts-deepmerge'; import { merge } from 'ts-deepmerge';
import type { RecursivePartial } from './types/generic'; import type { RecursivePartial } from '../types/generic';
import type { CobaltSettings } from './types/settings'; import type { CobaltSettings } from '../types/settings';
import defaultSettings from './settings/defaults'; import defaultSettings from '../settings/defaults';
type PartialSettings = RecursivePartial<CobaltSettings>; type PartialSettings = RecursivePartial<CobaltSettings>;
type PartialSettingsWithSchema = RecursivePartial<CobaltSettings> & { schemaVersion: number }; type PartialSettingsWithSchema = RecursivePartial<CobaltSettings> & { schemaVersion: number };

View file

@ -1,6 +1,6 @@
import { readable, derived, type Readable } from 'svelte/store'; import { readable, derived, type Readable } from 'svelte/store';
import settings from '$lib/settings'; import settings from '$lib/state/settings';
import { themeOptions } from '$lib/types/settings'; import { themeOptions } from '$lib/types/settings';
type Theme = typeof themeOptions[number]; type Theme = typeof themeOptions[number];

View file

@ -2,7 +2,7 @@
import "@fontsource/ibm-plex-mono/400.css"; import "@fontsource/ibm-plex-mono/400.css";
import "@fontsource/ibm-plex-mono/500.css"; import "@fontsource/ibm-plex-mono/500.css";
import settings from "$lib/settings"; import settings from "$lib/state/settings";
import { device, app } from "$lib/device"; import { device, app } from "$lib/device";
import currentTheme, { statusBarColors } from "$lib/state/theme"; import currentTheme, { statusBarColors } from "$lib/state/theme";

View file

@ -16,7 +16,7 @@ export const load: Load = async ({ url }) => {
if (browser) { if (browser) {
const device = (await import('$lib/device')).device; const device = (await import('$lib/device')).device;
const settings = get((await import('$lib/settings')).default); const settings = get((await import('$lib/state/settings')).default);
const deviceLanguage = device.prefers.language; const deviceLanguage = device.prefers.language;
const settingsLanguage = settings.appearance.language; const settingsLanguage = settings.appearance.language;

View file

@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { page } from "$app/stores"; import { page } from "$app/stores";
import settings from "$lib/settings"; import settings from "$lib/state/settings";
import { t } from "$lib/i18n/translations"; import { t } from "$lib/i18n/translations";

View file

@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { device, app } from "$lib/device"; import { device, app } from "$lib/device";
import { version } from "$lib/version"; import { version } from "$lib/version";
import settings, { storedSettings } from "$lib/settings"; import settings, { storedSettings } from "$lib/state/settings";
import { goto } from "$app/navigation"; import { goto } from "$app/navigation";
import { defaultSettingsPage } from "$lib/settings/defaults"; import { defaultSettingsPage } from "$lib/settings/defaults";