style: auto-format codebase with Prettier

Applied formatting to 1487+ files using pnpm format:write
  - TypeScript/JavaScript files
  - Svelte components
  - Astro pages
  - JSON configs
  - Markdown docs

  13 files still need manual review (Astro JSX comments)
This commit is contained in:
Wuesteon 2025-11-27 18:33:16 +01:00
parent 0241f5554c
commit d36b321d9d
3952 changed files with 661498 additions and 739751 deletions

View file

@ -2,121 +2,119 @@ import { writable } from 'svelte/store';
import { browser } from '$app/environment';
export interface QuoteList {
id: string;
name: string;
description?: string;
quoteIds: string[];
createdAt: number;
updatedAt: number;
id: string;
name: string;
description?: string;
quoteIds: string[];
createdAt: number;
updatedAt: number;
}
const LISTS_KEY = 'quote-lists';
function createListsStore() {
// Load initial data from localStorage
const initialLists: QuoteList[] = browser
? JSON.parse(localStorage.getItem(LISTS_KEY) || '[]')
: [];
// Load initial data from localStorage
const initialLists: QuoteList[] = browser
? JSON.parse(localStorage.getItem(LISTS_KEY) || '[]')
: [];
const { subscribe, set, update } = writable<QuoteList[]>(initialLists);
const { subscribe, set, update } = writable<QuoteList[]>(initialLists);
// Helper to save to localStorage
function saveToStorage(lists: QuoteList[]) {
if (browser) {
localStorage.setItem(LISTS_KEY, JSON.stringify(lists));
}
}
// Helper to save to localStorage
function saveToStorage(lists: QuoteList[]) {
if (browser) {
localStorage.setItem(LISTS_KEY, JSON.stringify(lists));
}
}
return {
subscribe,
return {
subscribe,
// Create a new list
createList: (name: string, description?: string) => {
const newList: QuoteList = {
id: `list-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
name,
description,
quoteIds: [],
createdAt: Date.now(),
updatedAt: Date.now(),
};
// Create a new list
createList: (name: string, description?: string) => {
const newList: QuoteList = {
id: `list-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
name,
description,
quoteIds: [],
createdAt: Date.now(),
updatedAt: Date.now(),
};
update(lists => {
const updated = [...lists, newList];
saveToStorage(updated);
return updated;
});
update((lists) => {
const updated = [...lists, newList];
saveToStorage(updated);
return updated;
});
return newList.id;
},
return newList.id;
},
// Update a list
updateList: (id: string, updates: Partial<Omit<QuoteList, 'id' | 'createdAt'>>) => {
update(lists => {
const updated = lists.map(list =>
list.id === id
? { ...list, ...updates, updatedAt: Date.now() }
: list
);
saveToStorage(updated);
return updated;
});
},
// Update a list
updateList: (id: string, updates: Partial<Omit<QuoteList, 'id' | 'createdAt'>>) => {
update((lists) => {
const updated = lists.map((list) =>
list.id === id ? { ...list, ...updates, updatedAt: Date.now() } : list
);
saveToStorage(updated);
return updated;
});
},
// Delete a list
deleteList: (id: string) => {
update(lists => {
const updated = lists.filter(list => list.id !== id);
saveToStorage(updated);
return updated;
});
},
// Delete a list
deleteList: (id: string) => {
update((lists) => {
const updated = lists.filter((list) => list.id !== id);
saveToStorage(updated);
return updated;
});
},
// Add quote to list
addQuoteToList: (listId: string, quoteId: string) => {
update(lists => {
const updated = lists.map(list => {
if (list.id === listId && !list.quoteIds.includes(quoteId)) {
return {
...list,
quoteIds: [...list.quoteIds, quoteId],
updatedAt: Date.now(),
};
}
return list;
});
saveToStorage(updated);
return updated;
});
},
// Add quote to list
addQuoteToList: (listId: string, quoteId: string) => {
update((lists) => {
const updated = lists.map((list) => {
if (list.id === listId && !list.quoteIds.includes(quoteId)) {
return {
...list,
quoteIds: [...list.quoteIds, quoteId],
updatedAt: Date.now(),
};
}
return list;
});
saveToStorage(updated);
return updated;
});
},
// Remove quote from list
removeQuoteFromList: (listId: string, quoteId: string) => {
update(lists => {
const updated = lists.map(list => {
if (list.id === listId) {
return {
...list,
quoteIds: list.quoteIds.filter(id => id !== quoteId),
updatedAt: Date.now(),
};
}
return list;
});
saveToStorage(updated);
return updated;
});
},
// Remove quote from list
removeQuoteFromList: (listId: string, quoteId: string) => {
update((lists) => {
const updated = lists.map((list) => {
if (list.id === listId) {
return {
...list,
quoteIds: list.quoteIds.filter((id) => id !== quoteId),
updatedAt: Date.now(),
};
}
return list;
});
saveToStorage(updated);
return updated;
});
},
// Get a specific list
getList: (id: string): QuoteList | undefined => {
let foundList: QuoteList | undefined;
subscribe(lists => {
foundList = lists.find(list => list.id === id);
})();
return foundList;
},
};
// Get a specific list
getList: (id: string): QuoteList | undefined => {
let foundList: QuoteList | undefined;
subscribe((lists) => {
foundList = lists.find((list) => list.id === id);
})();
return foundList;
},
};
}
export const listsStore = createListsStore();

View file

@ -4,21 +4,22 @@ import { browser } from '$app/environment';
const SIDEBAR_KEY = 'sidebar-collapsed';
function createSidebarStore() {
const stored = browser ? localStorage.getItem(SIDEBAR_KEY) === 'true' : false;
const { subscribe, set, update } = writable<boolean>(stored);
const stored = browser ? localStorage.getItem(SIDEBAR_KEY) === 'true' : false;
const { subscribe, set, update } = writable<boolean>(stored);
return {
subscribe,
toggle: () => update(v => {
const newValue = !v;
if (browser) localStorage.setItem(SIDEBAR_KEY, String(newValue));
return newValue;
}),
set: (value: boolean) => {
if (browser) localStorage.setItem(SIDEBAR_KEY, String(value));
set(value);
}
};
return {
subscribe,
toggle: () =>
update((v) => {
const newValue = !v;
if (browser) localStorage.setItem(SIDEBAR_KEY, String(newValue));
return newValue;
}),
set: (value: boolean) => {
if (browser) localStorage.setItem(SIDEBAR_KEY, String(value));
set(value);
},
};
}
export const isSidebarCollapsed = createSidebarStore();

View file

@ -4,32 +4,32 @@ import { browser } from '$app/environment';
export type Theme = 'light' | 'dark';
function createThemeStore() {
const { subscribe, set, update } = writable<Theme>('light');
const { subscribe, set, update } = writable<Theme>('light');
return {
subscribe,
set,
toggle: () => {
update(current => {
const newTheme = current === 'light' ? 'dark' : 'light';
if (browser) {
localStorage.setItem('theme', newTheme);
document.documentElement.setAttribute('data-theme', newTheme);
}
return newTheme;
});
},
init: () => {
if (browser) {
const savedTheme = localStorage.getItem('theme') as Theme | null;
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
const initialTheme = savedTheme || (prefersDark ? 'dark' : 'light');
return {
subscribe,
set,
toggle: () => {
update((current) => {
const newTheme = current === 'light' ? 'dark' : 'light';
if (browser) {
localStorage.setItem('theme', newTheme);
document.documentElement.setAttribute('data-theme', newTheme);
}
return newTheme;
});
},
init: () => {
if (browser) {
const savedTheme = localStorage.getItem('theme') as Theme | null;
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
const initialTheme = savedTheme || (prefersDark ? 'dark' : 'light');
document.documentElement.setAttribute('data-theme', initialTheme);
set(initialTheme);
}
}
};
document.documentElement.setAttribute('data-theme', initialTheme);
set(initialTheme);
}
},
};
}
export const theme = createThemeStore();

View file

@ -3,49 +3,49 @@ import { writable } from 'svelte/store';
export type ToastType = 'success' | 'error' | 'info' | 'warning';
export interface Toast {
id: string;
message: string;
type: ToastType;
duration: number;
id: string;
message: string;
type: ToastType;
duration: number;
}
function createToastStore() {
const { subscribe, update } = writable<Toast[]>([]);
const { subscribe, update } = writable<Toast[]>([]);
function addToast(message: string, type: ToastType = 'info', duration: number = 3000) {
const id = `toast-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
function addToast(message: string, type: ToastType = 'info', duration: number = 3000) {
const id = `toast-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
const toast: Toast = {
id,
message,
type,
duration,
};
const toast: Toast = {
id,
message,
type,
duration,
};
update(toasts => [...toasts, toast]);
update((toasts) => [...toasts, toast]);
// Auto-remove after duration
if (duration > 0) {
setTimeout(() => {
removeToast(id);
}, duration);
}
// Auto-remove after duration
if (duration > 0) {
setTimeout(() => {
removeToast(id);
}, duration);
}
return id;
}
return id;
}
function removeToast(id: string) {
update(toasts => toasts.filter(t => t.id !== id));
}
function removeToast(id: string) {
update((toasts) => toasts.filter((t) => t.id !== id));
}
return {
subscribe,
success: (message: string, duration?: number) => addToast(message, 'success', duration),
error: (message: string, duration?: number) => addToast(message, 'error', duration),
info: (message: string, duration?: number) => addToast(message, 'info', duration),
warning: (message: string, duration?: number) => addToast(message, 'warning', duration),
remove: removeToast,
};
return {
subscribe,
success: (message: string, duration?: number) => addToast(message, 'success', duration),
error: (message: string, duration?: number) => addToast(message, 'error', duration),
info: (message: string, duration?: number) => addToast(message, 'info', duration),
warning: (message: string, duration?: number) => addToast(message, 'warning', duration),
remove: removeToast,
};
}
export const toast = createToastStore();