ui: Linting & Formatting scripts (#26819)

This commit is contained in:
Aleksander Grygier
2026-08-10 08:38:37 +02:00
committed by GitHub
parent 1e396e72a8
commit 92d1bb0c99
538 changed files with 8806 additions and 6036 deletions
+4 -4
View File
@@ -1,13 +1,13 @@
<script lang="ts">
import { replaceState } from '$app/navigation';
import { page } from '$app/state';
import { DialogModelNotAvailable } from '$lib/components/app';
import { APP_NAME, URL_PARAMS } from '$lib/constants';
import { chatStore } from '$lib/stores/chat.svelte';
import { conversationsStore, isConversationsInitialized } from '$lib/stores/conversations.svelte';
import { modelsStore, modelOptions } from '$lib/stores/models.svelte';
import { modelOptions, modelsStore } from '$lib/stores/models.svelte';
import { isRouterMode } from '$lib/stores/server.svelte';
import { onMount } from 'svelte';
import { page } from '$app/state';
import { replaceState } from '$app/navigation';
import { APP_NAME, URL_PARAMS } from '$lib/constants';
let qParam = $derived(page.url.searchParams.get(URL_PARAMS.QUERY));
let modelParam = $derived(page.url.searchParams.get(URL_PARAMS.MODEL));
@@ -1,12 +1,12 @@
<script lang="ts">
import { goto, replaceState } from '$app/navigation';
import { page } from '$app/state';
import { afterNavigate } from '$app/navigation';
import { page } from '$app/state';
import { DialogModelNotAvailable } from '$lib/components/app';
import { APP_NAME, ROUTES, URL_PARAMS } from '$lib/constants';
import { chatStore } from '$lib/stores/chat.svelte';
import { conversationsStore, activeConversation } from '$lib/stores/conversations.svelte';
import { modelsStore, modelOptions } from '$lib/stores/models.svelte';
import { activeConversation, conversationsStore } from '$lib/stores/conversations.svelte';
import { modelOptions, modelsStore } from '$lib/stores/models.svelte';
let chatId = $derived(page.params.id);
let currentChatId: string | undefined = undefined;
@@ -28,6 +28,7 @@
*/
function clearUrlParams() {
const url = new URL(page.url);
url.searchParams.delete(URL_PARAMS.QUERY);
url.searchParams.delete(URL_PARAMS.MODEL);
replaceState(url.toString(), {});
@@ -40,6 +41,7 @@
// Handle model parameter - select model if provided
if (modelParam) {
const model = modelsStore.findModelByName(modelParam);
if (model) {
try {
await modelsStore.selectModelById(model.id);
@@ -47,12 +49,14 @@
console.error('Failed to select model:', error);
requestedModelName = modelParam;
showModelNotAvailable = true;
return;
}
} else {
// Model not found - show error dialog
requestedModelName = modelParam;
showModelNotAvailable = true;
return;
}
}
@@ -84,18 +88,23 @@
// Skip loading if this conversation is already active (e.g., just created)
if (activeConversation()?.id === chatId) {
void chatStore.discoverActiveStream(chatId);
if ((qParam !== null || modelParam !== null) && !urlParamsProcessed) {
handleUrlParams();
}
return;
}
(async () => {
const success = await conversationsStore.loadConversation(chatId);
if (!success) {
await goto(ROUTES.START);
return;
}
chatStore.syncLoadingStateForChat(chatId);
// server probe (with localStorage fallback) and attach
await chatStore.discoverActiveStream(chatId);
@@ -114,10 +123,14 @@
// where the initial mount probe missed an active session
const onVisibility = () => {
if (document.visibilityState !== 'visible') return;
if (!chatId) return;
void chatStore.discoverActiveStream(chatId);
};
document.addEventListener('visibilitychange', onVisibility);
return () => document.removeEventListener('visibilitychange', onVisibility);
});
</script>
+2 -2
View File
@@ -1,9 +1,9 @@
<script lang="ts">
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { ServerErrorSplash } from '$lib/components/app';
import { ROUTES } from '$lib/constants/routes';
import { APP_NAME } from '$lib/constants';
import { ROUTES } from '$lib/constants/routes';
let error = $derived($page.error);
let status = $derived($page.status);
+25 -25
View File
@@ -1,36 +1,33 @@
<script lang="ts">
import '../app.css';
import { base } from '$app/paths';
import { browser } from '$app/environment';
import { goto } from '$app/navigation';
import { base } from '$app/paths';
import { page } from '$app/state';
import { untrack } from 'svelte';
import { onMount } from 'svelte';
import { SidebarNavigation } from '$lib/components/app';
import { PwaMetaTags, PwaRefreshAlert } from '$lib/components/pwa';
import { pwaAssetsHead } from 'virtual:pwa-assets/head';
import { chatStore } from '$lib/stores/chat.svelte';
import * as Tooltip from '$lib/components/ui/tooltip';
import { isRouterMode, serverStore } from '$lib/stores/server.svelte';
import { config, settingsStore } from '$lib/stores/settings.svelte';
import { ModeWatcher } from 'mode-watcher';
import { ROUTES } from '$lib/constants/routes';
import { RouterService } from '$lib/services/router.service';
import { Toaster } from 'svelte-sonner';
import { modelsStore } from '$lib/stores/models.svelte';
import { mcpStore } from '$lib/stores/mcp.svelte';
import { AUTHORIZATION_HEADER, BEARER_PREFIX, TOOLTIP_DELAY_DURATION } from '$lib/constants';
import { SETTINGS_KEYS } from '$lib/constants';
import { FAVICON_PATHS, FAVICON_SELECTORS } from '$lib/constants/pwa';
import { ROUTES } from '$lib/constants/routes';
import { useKeyboardShortcuts } from '$lib/hooks/use-keyboard-shortcuts.svelte';
import { usePwa } from '$lib/hooks/use-pwa.svelte';
import { conversations } from '$lib/stores/conversations.svelte';
import { isMobile } from '$lib/stores/viewport.svelte';
import { theme } from '$lib/stores/theme.svelte';
import { RouterService } from '$lib/services/router.service';
import { buildInfoStore } from '$lib/stores/build-info.svelte';
import { SETTINGS_KEYS } from '$lib/constants';
import { chatStore } from '$lib/stores/chat.svelte';
import { conversations } from '$lib/stores/conversations.svelte';
import { mcpStore } from '$lib/stores/mcp.svelte';
import { modelsStore } from '$lib/stores/models.svelte';
import { isRouterMode, serverStore } from '$lib/stores/server.svelte';
import { config, settingsStore } from '$lib/stores/settings.svelte';
import { theme } from '$lib/stores/theme.svelte';
import { isMobile } from '$lib/stores/viewport.svelte';
import { ModeWatcher } from 'mode-watcher';
import { untrack } from 'svelte';
import { onMount } from 'svelte';
import { Toaster } from 'svelte-sonner';
import { pwaAssetsHead } from 'virtual:pwa-assets/head';
let { children } = $props();
let innerHeight = $state<number | undefined>();
@@ -53,11 +50,13 @@
const dark = theme.isSystemDark;
let icoLink = document.querySelector(FAVICON_SELECTORS.ICO_48X48) as HTMLLinkElement | null;
if (icoLink) {
icoLink.href = dark ? FAVICON_PATHS.ICO_DARK : FAVICON_PATHS.ICO_LIGHT;
}
let svgLink = document.querySelector(FAVICON_SELECTORS.SVG_ANY) as HTMLLinkElement | null;
if (svgLink) {
svgLink.href = dark ? FAVICON_PATHS.SVG_DARK : FAVICON_PATHS.SVG_LIGHT;
}
@@ -92,8 +91,8 @@
// Global keyboard shortcuts
const { handleKeydown } = useKeyboardShortcuts({
editActiveConversation: () => chatSidebar?.editActiveConversation?.(),
navigateToPrevConversation: () => navigateToConversation(-1),
navigateToNextConversation: () => navigateToConversation(1)
navigateToNextConversation: () => navigateToConversation(1),
navigateToPrevConversation: () => navigateToConversation(-1)
});
function checkApiKey() {
@@ -113,8 +112,8 @@
page.status !== 403
) {
const headers: Record<string, string> = {
'Content-Type': 'application/json',
[AUTHORIZATION_HEADER]: `${BEARER_PREFIX}${apiKey.trim()}`
[AUTHORIZATION_HEADER]: `${BEARER_PREFIX}${apiKey.trim()}`,
'Content-Type': 'application/json'
};
fetch(`${base}/props`, { headers })
@@ -141,6 +140,7 @@
// or ended while it was hidden. snapshot only, no polling
function handleVisibilityChange() {
if (document.visibilityState !== 'visible') return;
void chatStore.syncRemoteRunningStreams();
}
@@ -200,6 +200,7 @@
// Live model status and load progress via the /models/sse feed (router mode)
$effect(() => {
if (!browser) return;
if (!isRouterMode()) return;
untrack(() => {
@@ -224,7 +225,6 @@
if (!browser) return;
const mcpServers = mcpStore.getServers();
const serversWithUrls = mcpServers.filter((s) => s.url.trim());
if (serversWithUrls.length > 0) {
+8 -3
View File
@@ -1,13 +1,12 @@
<script lang="ts">
import { browser } from '$app/environment';
import { goto } from '$app/navigation';
import { page } from '$app/state';
import { browser } from '$app/environment';
import { SearchInput, SidebarNavigationSearchResults } from '$lib/components/app';
import { ROUTES } from '$lib/constants/routes';
import { RouterService } from '$lib/services/router.service';
import { conversationsStore, conversations } from '$lib/stores/conversations.svelte';
import { chatStore } from '$lib/stores/chat.svelte';
import { conversations, conversationsStore } from '$lib/stores/conversations.svelte';
import { isMobile } from '$lib/stores/viewport.svelte';
let searchQuery = $state('');
@@ -17,7 +16,9 @@
let filteredConversations = $derived.by(() => {
const query = searchQuery.trim().toLowerCase();
if (query.length === 0) return [];
return conversations().filter((c) => c.name.toLowerCase().includes(query));
});
@@ -35,9 +36,11 @@
async function handleEditConversation(id: string) {
const conversation = conversations().find((c) => c.id === id);
if (!conversation) return;
const newName = window.prompt('Rename conversation', conversation.name);
if (newName && newName.trim()) {
await conversationsStore.updateConversationName(id, newName.trim());
}
@@ -45,11 +48,13 @@
async function handleDeleteConversation(id: string) {
const conversation = conversations().find((c) => c.id === id);
if (!conversation) return;
const confirmed = window.confirm(
`Delete "${conversation.name}"? This action cannot be undone.`
);
if (!confirmed) return;
await conversationsStore.deleteConversation(id, { deleteWithForks: false });
+3 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { X } from '@lucide/svelte';
import { goto } from '$app/navigation';
import { browser } from '$app/environment';
import { goto } from '$app/navigation';
import { page } from '$app/state';
import { ActionIcon } from '$lib/components/app';
import { SETTINGS_FALLBACK_EXIT_ROUTE } from '$lib/constants';
@@ -12,6 +12,7 @@
$effect(() => {
const currentId = page.route.id;
return () => {
previousRouteId = currentId;
};
@@ -19,6 +20,7 @@
function handleClose() {
const prevIsSettings = previousRouteId?.startsWith('/settings');
if (browser && window.history.length > 1 && !prevIsSettings) {
history.back();
} else {
@@ -1,9 +1,9 @@
<script lang="ts">
import { SettingsChat } from '$lib/components/app/settings';
import { page } from '$app/state';
import { afterNavigate, replaceState } from '$app/navigation';
import { RouterService } from '$lib/services';
import { page } from '$app/state';
import { SettingsChat } from '$lib/components/app/settings';
import { SETTINGS_SECTION_SLUGS } from '$lib/constants';
import { RouterService } from '$lib/services';
afterNavigate(() => {
if (!page.params.section) {