Function bodies 868 total
saveToStorage function · typescript · L25-L31 (7 LOC)app/src/lib/stores/recentFiles.ts
function saveToStorage(files: RecentFile[]) {
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(files));
} catch {
// Ignore storage errors
}
}saveToStorage function · typescript · L25-L31 (7 LOC)app/src/lib/stores/recentFiles.ts
function saveToStorage(files: RecentFile[]) {
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(files));
} catch {
// Ignore storage errors
}
}createRecentFilesStore function · typescript · L40-L72 (33 LOC)app/src/lib/stores/recentFiles.ts
function createRecentFilesStore() {
const { subscribe, set, update } = writable<RecentFile[]>(loadFromStorage());
return {
subscribe,
/** Add a file to the top of the recent list */
add(filePath: string) {
update((files) => {
const filtered = files.filter((f) => f.path !== filePath);
const { name, folder } = extractFileInfo(filePath);
const updated = [{ path: filePath, name, folder }, ...filtered].slice(0, MAX_ENTRIES);
saveToStorage(updated);
return updated;
});
},
/** Remove entries whose paths no longer exist in the workspace files */
pruneForWorkspace(existingPaths: Set<string>) {
update((files) => {
const pruned = files.filter((f) => existingPaths.has(f.path));
saveToStorage(pruned);
return pruned;
});
},
/** Clear all recent files */
clear() {
saveToStorage([]);
set([]);
},
};
}createRecentFilesStore function · typescript · L40-L72 (33 LOC)app/src/lib/stores/recentFiles.ts
function createRecentFilesStore() {
const { subscribe, set, update } = writable<RecentFile[]>(loadFromStorage());
return {
subscribe,
/** Add a file to the top of the recent list */
add(filePath: string) {
update((files) => {
const filtered = files.filter((f) => f.path !== filePath);
const { name, folder } = extractFileInfo(filePath);
const updated = [{ path: filePath, name, folder }, ...filtered].slice(0, MAX_ENTRIES);
saveToStorage(updated);
return updated;
});
},
/** Remove entries whose paths no longer exist in the workspace files */
pruneForWorkspace(existingPaths: Set<string>) {
update((files) => {
const pruned = files.filter((f) => existingPaths.has(f.path));
saveToStorage(pruned);
return pruned;
});
},
/** Clear all recent files */
clear() {
saveToStorage([]);
set([]);
},
};
}createRecentFilesStore function · typescript · L40-L72 (33 LOC)app/src/lib/stores/recentFiles.ts
function createRecentFilesStore() {
const { subscribe, set, update } = writable<RecentFile[]>(loadFromStorage());
return {
subscribe,
/** Add a file to the top of the recent list */
add(filePath: string) {
update((files) => {
const filtered = files.filter((f) => f.path !== filePath);
const { name, folder } = extractFileInfo(filePath);
const updated = [{ path: filePath, name, folder }, ...filtered].slice(0, MAX_ENTRIES);
saveToStorage(updated);
return updated;
});
},
/** Remove entries whose paths no longer exist in the workspace files */
pruneForWorkspace(existingPaths: Set<string>) {
update((files) => {
const pruned = files.filter((f) => existingPaths.has(f.path));
saveToStorage(pruned);
return pruned;
});
},
/** Clear all recent files */
clear() {
saveToStorage([]);
set([]);
},
};
}createRecentFilesStore function · typescript · L40-L72 (33 LOC)app/src/lib/stores/recentFiles.ts
function createRecentFilesStore() {
const { subscribe, set, update } = writable<RecentFile[]>(loadFromStorage());
return {
subscribe,
/** Add a file to the top of the recent list */
add(filePath: string) {
update((files) => {
const filtered = files.filter((f) => f.path !== filePath);
const { name, folder } = extractFileInfo(filePath);
const updated = [{ path: filePath, name, folder }, ...filtered].slice(0, MAX_ENTRIES);
saveToStorage(updated);
return updated;
});
},
/** Remove entries whose paths no longer exist in the workspace files */
pruneForWorkspace(existingPaths: Set<string>) {
update((files) => {
const pruned = files.filter((f) => existingPaths.has(f.path));
saveToStorage(pruned);
return pruned;
});
},
/** Clear all recent files */
clear() {
saveToStorage([]);
set([]);
},
};
}createSessionStore function · typescript · L25-L92 (68 LOC)app/src/lib/stores/session.ts
function createSessionStore() {
const { subscribe, set, update } = writable<SessionStoreState>(defaultState);
return {
subscribe,
// Start tracking a note
startTracking: async (notePath: string) => {
update((s) => ({ ...s, isLoading: true }));
try {
const invoke = await getInvoke();
await invoke('start_tracking', { notePath });
const info = await invoke<TrackerInfo | null>('get_tracker_info');
update((s) => ({ ...s, trackerInfo: info, isLoading: false, error: null }));
} catch (e) {
const error = e instanceof Error ? e.message : String(e);
console.error('[Session] Failed to start tracking:', error);
toast.warning('Session tracking error');
update((s) => ({ ...s, isLoading: false, error }));
}
},
// Stop tracking and commit changes (when closing/switching notes)
stopTracking: async (): Promise<TrackerInfo | null> => {
try {
const invoke = await getInvoke()All rows above produced by Repobility · https://repobility.com
createSessionStore function · typescript · L25-L92 (68 LOC)app/src/lib/stores/session.ts
function createSessionStore() {
const { subscribe, set, update } = writable<SessionStoreState>(defaultState);
return {
subscribe,
// Start tracking a note
startTracking: async (notePath: string) => {
update((s) => ({ ...s, isLoading: true }));
try {
const invoke = await getInvoke();
await invoke('start_tracking', { notePath });
const info = await invoke<TrackerInfo | null>('get_tracker_info');
update((s) => ({ ...s, trackerInfo: info, isLoading: false, error: null }));
} catch (e) {
const error = e instanceof Error ? e.message : String(e);
console.error('[Session] Failed to start tracking:', error);
toast.warning('Session tracking error');
update((s) => ({ ...s, isLoading: false, error }));
}
},
// Stop tracking and commit changes (when closing/switching notes)
stopTracking: async (): Promise<TrackerInfo | null> => {
try {
const invoke = await getInvoke()createSessionStore function · typescript · L25-L92 (68 LOC)app/src/lib/stores/session.ts
function createSessionStore() {
const { subscribe, set, update } = writable<SessionStoreState>(defaultState);
return {
subscribe,
// Start tracking a note
startTracking: async (notePath: string) => {
update((s) => ({ ...s, isLoading: true }));
try {
const invoke = await getInvoke();
await invoke('start_tracking', { notePath });
const info = await invoke<TrackerInfo | null>('get_tracker_info');
update((s) => ({ ...s, trackerInfo: info, isLoading: false, error: null }));
} catch (e) {
const error = e instanceof Error ? e.message : String(e);
console.error('[Session] Failed to start tracking:', error);
toast.warning('Session tracking error');
update((s) => ({ ...s, isLoading: false, error }));
}
},
// Stop tracking and commit changes (when closing/switching notes)
stopTracking: async (): Promise<TrackerInfo | null> => {
try {
const invoke = await getInvoke()createSessionStore function · typescript · L25-L92 (68 LOC)app/src/lib/stores/session.ts
function createSessionStore() {
const { subscribe, set, update } = writable<SessionStoreState>(defaultState);
return {
subscribe,
// Start tracking a note
startTracking: async (notePath: string) => {
update((s) => ({ ...s, isLoading: true }));
try {
const invoke = await getInvoke();
await invoke('start_tracking', { notePath });
const info = await invoke<TrackerInfo | null>('get_tracker_info');
update((s) => ({ ...s, trackerInfo: info, isLoading: false, error: null }));
} catch (e) {
const error = e instanceof Error ? e.message : String(e);
console.error('[Session] Failed to start tracking:', error);
toast.warning('Session tracking error');
update((s) => ({ ...s, isLoading: false, error }));
}
},
// Stop tracking and commit changes (when closing/switching notes)
stopTracking: async (): Promise<TrackerInfo | null> => {
try {
const invoke = await getInvoke()formatDuration function · typescript · L97-L104 (8 LOC)app/src/lib/stores/session.ts
export function formatDuration(minutes: number): string {
if (minutes < 60) {
return `${minutes}m`;
}
const hours = Math.floor(minutes / 60);
const mins = minutes % 60;
return mins > 0 ? `${hours}h ${mins}m` : `${hours}h`;
}formatDuration function · typescript · L97-L104 (8 LOC)app/src/lib/stores/session.ts
export function formatDuration(minutes: number): string {
if (minutes < 60) {
return `${minutes}m`;
}
const hours = Math.floor(minutes / 60);
const mins = minutes % 60;
return mins > 0 ? `${hours}h ${mins}m` : `${hours}h`;
}formatDuration function · typescript · L97-L104 (8 LOC)app/src/lib/stores/session.ts
export function formatDuration(minutes: number): string {
if (minutes < 60) {
return `${minutes}m`;
}
const hours = Math.floor(minutes / 60);
const mins = minutes % 60;
return mins > 0 ? `${hours}h ${mins}m` : `${hours}h`;
}formatDuration function · typescript · L97-L104 (8 LOC)app/src/lib/stores/session.ts
export function formatDuration(minutes: number): string {
if (minutes < 60) {
return `${minutes}m`;
}
const hours = Math.floor(minutes / 60);
const mins = minutes % 60;
return mins > 0 ? `${hours}h ${mins}m` : `${hours}h`;
}createTagsStore function · typescript · L22-L53 (32 LOC)app/src/lib/stores/tags.ts
function createTagsStore() {
const { subscribe, set, update } = writable<TagsState>(defaultState);
return {
subscribe,
load: async () => {
const ws = get(currentWorkspace);
if (!ws || !isTauri()) return;
try {
const invoke = await getInvoke();
const data = await invoke<TagIndex>('read_tags', { workspacePath: ws.path });
update((s) => ({
...s,
index: data && data.byTag ? data : { byNote: {}, byTag: {} },
}));
} catch {
// Tags file may not exist yet
}
},
selectTag: (tag: string | null) => {
update((s) => ({
...s,
selectedTag: s.selectedTag === tag ? null : tag,
}));
},
clear: () => set(defaultState),
};
}Repobility — same analyzer, your code, free for public repos · /scan/
createTagsStore function · typescript · L22-L53 (32 LOC)app/src/lib/stores/tags.ts
function createTagsStore() {
const { subscribe, set, update } = writable<TagsState>(defaultState);
return {
subscribe,
load: async () => {
const ws = get(currentWorkspace);
if (!ws || !isTauri()) return;
try {
const invoke = await getInvoke();
const data = await invoke<TagIndex>('read_tags', { workspacePath: ws.path });
update((s) => ({
...s,
index: data && data.byTag ? data : { byNote: {}, byTag: {} },
}));
} catch {
// Tags file may not exist yet
}
},
selectTag: (tag: string | null) => {
update((s) => ({
...s,
selectedTag: s.selectedTag === tag ? null : tag,
}));
},
clear: () => set(defaultState),
};
}createTagsStore function · typescript · L22-L53 (32 LOC)app/src/lib/stores/tags.ts
function createTagsStore() {
const { subscribe, set, update } = writable<TagsState>(defaultState);
return {
subscribe,
load: async () => {
const ws = get(currentWorkspace);
if (!ws || !isTauri()) return;
try {
const invoke = await getInvoke();
const data = await invoke<TagIndex>('read_tags', { workspacePath: ws.path });
update((s) => ({
...s,
index: data && data.byTag ? data : { byNote: {}, byTag: {} },
}));
} catch {
// Tags file may not exist yet
}
},
selectTag: (tag: string | null) => {
update((s) => ({
...s,
selectedTag: s.selectedTag === tag ? null : tag,
}));
},
clear: () => set(defaultState),
};
}createTagsStore function · typescript · L22-L53 (32 LOC)app/src/lib/stores/tags.ts
function createTagsStore() {
const { subscribe, set, update } = writable<TagsState>(defaultState);
return {
subscribe,
load: async () => {
const ws = get(currentWorkspace);
if (!ws || !isTauri()) return;
try {
const invoke = await getInvoke();
const data = await invoke<TagIndex>('read_tags', { workspacePath: ws.path });
update((s) => ({
...s,
index: data && data.byTag ? data : { byNote: {}, byTag: {} },
}));
} catch {
// Tags file may not exist yet
}
},
selectTag: (tag: string | null) => {
update((s) => ({
...s,
selectedTag: s.selectedTag === tag ? null : tag,
}));
},
clear: () => set(defaultState),
};
}initTagsListener function · typescript · L105-L111 (7 LOC)app/src/lib/stores/tags.ts
export async function initTagsListener(): Promise<() => void> {
if (!isTauri()) return () => {};
const { listen } = await import('@tauri-apps/api/event');
return listen('chronicle:tags-updated', () => {
tagsStore.load();
});
}initTagsListener function · typescript · L105-L111 (7 LOC)app/src/lib/stores/tags.ts
export async function initTagsListener(): Promise<() => void> {
if (!isTauri()) return () => {};
const { listen } = await import('@tauri-apps/api/event');
return listen('chronicle:tags-updated', () => {
tagsStore.load();
});
}initTagsListener function · typescript · L105-L111 (7 LOC)app/src/lib/stores/tags.ts
export async function initTagsListener(): Promise<() => void> {
if (!isTauri()) return () => {};
const { listen } = await import('@tauri-apps/api/event');
return listen('chronicle:tags-updated', () => {
tagsStore.load();
});
}initTagsListener function · typescript · L105-L111 (7 LOC)app/src/lib/stores/tags.ts
export async function initTagsListener(): Promise<() => void> {
if (!isTauri()) return () => {};
const { listen } = await import('@tauri-apps/api/event');
return listen('chronicle:tags-updated', () => {
tagsStore.load();
});
}createTerminalStore function · typescript · L17-L32 (16 LOC)app/src/lib/stores/terminal.ts
function createTerminalStore() {
const { subscribe, set, update } = writable<TerminalState>(defaultState);
return {
subscribe,
setSpawned: (cwd: string) =>
update((s) => ({ ...s, isSpawned: true, workingDirectory: cwd, error: null })),
setError: (error: string) =>
update((s) => ({ ...s, error })),
requestFocus: () =>
update((s) => ({ ...s, focusRequested: true })),
clearFocusRequest: () =>
update((s) => ({ ...s, focusRequested: false })),
reset: () => set(defaultState),
};
}All rows scored by the Repobility analyzer (https://repobility.com)
createTerminalStore function · typescript · L17-L32 (16 LOC)app/src/lib/stores/terminal.ts
function createTerminalStore() {
const { subscribe, set, update } = writable<TerminalState>(defaultState);
return {
subscribe,
setSpawned: (cwd: string) =>
update((s) => ({ ...s, isSpawned: true, workingDirectory: cwd, error: null })),
setError: (error: string) =>
update((s) => ({ ...s, error })),
requestFocus: () =>
update((s) => ({ ...s, focusRequested: true })),
clearFocusRequest: () =>
update((s) => ({ ...s, focusRequested: false })),
reset: () => set(defaultState),
};
}createTerminalStore function · typescript · L17-L32 (16 LOC)app/src/lib/stores/terminal.ts
function createTerminalStore() {
const { subscribe, set, update } = writable<TerminalState>(defaultState);
return {
subscribe,
setSpawned: (cwd: string) =>
update((s) => ({ ...s, isSpawned: true, workingDirectory: cwd, error: null })),
setError: (error: string) =>
update((s) => ({ ...s, error })),
requestFocus: () =>
update((s) => ({ ...s, focusRequested: true })),
clearFocusRequest: () =>
update((s) => ({ ...s, focusRequested: false })),
reset: () => set(defaultState),
};
}createTerminalStore function · typescript · L17-L32 (16 LOC)app/src/lib/stores/terminal.ts
function createTerminalStore() {
const { subscribe, set, update } = writable<TerminalState>(defaultState);
return {
subscribe,
setSpawned: (cwd: string) =>
update((s) => ({ ...s, isSpawned: true, workingDirectory: cwd, error: null })),
setError: (error: string) =>
update((s) => ({ ...s, error })),
requestFocus: () =>
update((s) => ({ ...s, focusRequested: true })),
clearFocusRequest: () =>
update((s) => ({ ...s, focusRequested: false })),
reset: () => set(defaultState),
};
}createToastStore function · typescript · L13-L63 (51 LOC)app/src/lib/stores/toast.ts
function createToastStore() {
const { subscribe, update } = writable<Toast[]>([]);
const timers = new Map<string, ReturnType<typeof setTimeout>>();
function add(type: Toast['type'], message: string, duration?: number) {
const id = crypto.randomUUID();
const effectiveDuration = duration ?? (type === 'error' ? 0 : DEFAULT_DURATION);
const toast: Toast = { id, type, message, duration: effectiveDuration };
update((toasts) => {
const next = [toast, ...toasts];
// Auto-dismiss oldest if over limit
if (next.length > MAX_TOASTS) {
const removed = next.pop()!;
clearTimer(removed.id);
}
return next;
});
if (effectiveDuration > 0) {
timers.set(
id,
setTimeout(() => dismiss(id), effectiveDuration),
);
}
return id;
}
function dismiss(id: string) {
clearTimer(id);
update((toasts) => toasts.filter((t) => t.id !== id));
}
function clearTimer(id: string) {
const timecreateToastStore function · typescript · L13-L63 (51 LOC)app/src/lib/stores/toast.ts
function createToastStore() {
const { subscribe, update } = writable<Toast[]>([]);
const timers = new Map<string, ReturnType<typeof setTimeout>>();
function add(type: Toast['type'], message: string, duration?: number) {
const id = crypto.randomUUID();
const effectiveDuration = duration ?? (type === 'error' ? 0 : DEFAULT_DURATION);
const toast: Toast = { id, type, message, duration: effectiveDuration };
update((toasts) => {
const next = [toast, ...toasts];
// Auto-dismiss oldest if over limit
if (next.length > MAX_TOASTS) {
const removed = next.pop()!;
clearTimer(removed.id);
}
return next;
});
if (effectiveDuration > 0) {
timers.set(
id,
setTimeout(() => dismiss(id), effectiveDuration),
);
}
return id;
}
function dismiss(id: string) {
clearTimer(id);
update((toasts) => toasts.filter((t) => t.id !== id));
}
function clearTimer(id: string) {
const timecreateToastStore function · typescript · L13-L63 (51 LOC)app/src/lib/stores/toast.ts
function createToastStore() {
const { subscribe, update } = writable<Toast[]>([]);
const timers = new Map<string, ReturnType<typeof setTimeout>>();
function add(type: Toast['type'], message: string, duration?: number) {
const id = crypto.randomUUID();
const effectiveDuration = duration ?? (type === 'error' ? 0 : DEFAULT_DURATION);
const toast: Toast = { id, type, message, duration: effectiveDuration };
update((toasts) => {
const next = [toast, ...toasts];
// Auto-dismiss oldest if over limit
if (next.length > MAX_TOASTS) {
const removed = next.pop()!;
clearTimer(removed.id);
}
return next;
});
if (effectiveDuration > 0) {
timers.set(
id,
setTimeout(() => dismiss(id), effectiveDuration),
);
}
return id;
}
function dismiss(id: string) {
clearTimer(id);
update((toasts) => toasts.filter((t) => t.id !== id));
}
function clearTimer(id: string) {
const timecreateToastStore function · typescript · L13-L63 (51 LOC)app/src/lib/stores/toast.ts
function createToastStore() {
const { subscribe, update } = writable<Toast[]>([]);
const timers = new Map<string, ReturnType<typeof setTimeout>>();
function add(type: Toast['type'], message: string, duration?: number) {
const id = crypto.randomUUID();
const effectiveDuration = duration ?? (type === 'error' ? 0 : DEFAULT_DURATION);
const toast: Toast = { id, type, message, duration: effectiveDuration };
update((toasts) => {
const next = [toast, ...toasts];
// Auto-dismiss oldest if over limit
if (next.length > MAX_TOASTS) {
const removed = next.pop()!;
clearTimer(removed.id);
}
return next;
});
if (effectiveDuration > 0) {
timers.set(
id,
setTimeout(() => dismiss(id), effectiveDuration),
);
}
return id;
}
function dismiss(id: string) {
clearTimer(id);
update((toasts) => toasts.filter((t) => t.id !== id));
}
function clearTimer(id: string) {
const timeadd function · typescript · L17-L40 (24 LOC)app/src/lib/stores/toast.ts
function add(type: Toast['type'], message: string, duration?: number) {
const id = crypto.randomUUID();
const effectiveDuration = duration ?? (type === 'error' ? 0 : DEFAULT_DURATION);
const toast: Toast = { id, type, message, duration: effectiveDuration };
update((toasts) => {
const next = [toast, ...toasts];
// Auto-dismiss oldest if over limit
if (next.length > MAX_TOASTS) {
const removed = next.pop()!;
clearTimer(removed.id);
}
return next;
});
if (effectiveDuration > 0) {
timers.set(
id,
setTimeout(() => dismiss(id), effectiveDuration),
);
}
return id;
}Repobility — the code-quality scanner for AI-generated software · https://repobility.com
add function · typescript · L17-L40 (24 LOC)app/src/lib/stores/toast.ts
function add(type: Toast['type'], message: string, duration?: number) {
const id = crypto.randomUUID();
const effectiveDuration = duration ?? (type === 'error' ? 0 : DEFAULT_DURATION);
const toast: Toast = { id, type, message, duration: effectiveDuration };
update((toasts) => {
const next = [toast, ...toasts];
// Auto-dismiss oldest if over limit
if (next.length > MAX_TOASTS) {
const removed = next.pop()!;
clearTimer(removed.id);
}
return next;
});
if (effectiveDuration > 0) {
timers.set(
id,
setTimeout(() => dismiss(id), effectiveDuration),
);
}
return id;
}add function · typescript · L17-L40 (24 LOC)app/src/lib/stores/toast.ts
function add(type: Toast['type'], message: string, duration?: number) {
const id = crypto.randomUUID();
const effectiveDuration = duration ?? (type === 'error' ? 0 : DEFAULT_DURATION);
const toast: Toast = { id, type, message, duration: effectiveDuration };
update((toasts) => {
const next = [toast, ...toasts];
// Auto-dismiss oldest if over limit
if (next.length > MAX_TOASTS) {
const removed = next.pop()!;
clearTimer(removed.id);
}
return next;
});
if (effectiveDuration > 0) {
timers.set(
id,
setTimeout(() => dismiss(id), effectiveDuration),
);
}
return id;
}add function · typescript · L17-L40 (24 LOC)app/src/lib/stores/toast.ts
function add(type: Toast['type'], message: string, duration?: number) {
const id = crypto.randomUUID();
const effectiveDuration = duration ?? (type === 'error' ? 0 : DEFAULT_DURATION);
const toast: Toast = { id, type, message, duration: effectiveDuration };
update((toasts) => {
const next = [toast, ...toasts];
// Auto-dismiss oldest if over limit
if (next.length > MAX_TOASTS) {
const removed = next.pop()!;
clearTimer(removed.id);
}
return next;
});
if (effectiveDuration > 0) {
timers.set(
id,
setTimeout(() => dismiss(id), effectiveDuration),
);
}
return id;
}dismiss function · typescript · L42-L45 (4 LOC)app/src/lib/stores/toast.ts
function dismiss(id: string) {
clearTimer(id);
update((toasts) => toasts.filter((t) => t.id !== id));
}dismiss function · typescript · L42-L45 (4 LOC)app/src/lib/stores/toast.ts
function dismiss(id: string) {
clearTimer(id);
update((toasts) => toasts.filter((t) => t.id !== id));
}dismiss function · typescript · L42-L45 (4 LOC)app/src/lib/stores/toast.ts
function dismiss(id: string) {
clearTimer(id);
update((toasts) => toasts.filter((t) => t.id !== id));
}dismiss function · typescript · L42-L45 (4 LOC)app/src/lib/stores/toast.ts
function dismiss(id: string) {
clearTimer(id);
update((toasts) => toasts.filter((t) => t.id !== id));
}clearTimer function · typescript · L47-L53 (7 LOC)app/src/lib/stores/toast.ts
function clearTimer(id: string) {
const timer = timers.get(id);
if (timer) {
clearTimeout(timer);
timers.delete(id);
}
}All rows above produced by Repobility · https://repobility.com
clearTimer function · typescript · L47-L53 (7 LOC)app/src/lib/stores/toast.ts
function clearTimer(id: string) {
const timer = timers.get(id);
if (timer) {
clearTimeout(timer);
timers.delete(id);
}
}clearTimer function · typescript · L47-L53 (7 LOC)app/src/lib/stores/toast.ts
function clearTimer(id: string) {
const timer = timers.get(id);
if (timer) {
clearTimeout(timer);
timers.delete(id);
}
}clearTimer function · typescript · L47-L53 (7 LOC)app/src/lib/stores/toast.ts
function clearTimer(id: string) {
const timer = timers.get(id);
if (timer) {
clearTimeout(timer);
timers.delete(id);
}
}loadState function · typescript · L29-L50 (22 LOC)app/src/lib/stores/ui.ts
function loadState(): PaneState {
try {
const saved = localStorage.getItem(STORAGE_KEY);
if (saved) {
const parsed = JSON.parse(saved);
return {
explorerWidth: parsed.explorerWidth ?? defaultState.explorerWidth,
aiOutputWidth: parsed.aiOutputWidth ?? defaultState.aiOutputWidth,
terminalHeight: parsed.terminalHeight ?? defaultState.terminalHeight,
focusMode: parsed.focusMode ?? defaultState.focusMode,
collapsed: {
explorer: parsed.collapsed?.explorer ?? defaultState.collapsed.explorer,
aiOutput: parsed.collapsed?.aiOutput ?? defaultState.collapsed.aiOutput,
terminal: parsed.collapsed?.terminal ?? defaultState.collapsed.terminal,
},
};
}
} catch {
// Ignore parse errors, use defaults
}
return defaultState;
}loadState function · typescript · L29-L50 (22 LOC)app/src/lib/stores/ui.ts
function loadState(): PaneState {
try {
const saved = localStorage.getItem(STORAGE_KEY);
if (saved) {
const parsed = JSON.parse(saved);
return {
explorerWidth: parsed.explorerWidth ?? defaultState.explorerWidth,
aiOutputWidth: parsed.aiOutputWidth ?? defaultState.aiOutputWidth,
terminalHeight: parsed.terminalHeight ?? defaultState.terminalHeight,
focusMode: parsed.focusMode ?? defaultState.focusMode,
collapsed: {
explorer: parsed.collapsed?.explorer ?? defaultState.collapsed.explorer,
aiOutput: parsed.collapsed?.aiOutput ?? defaultState.collapsed.aiOutput,
terminal: parsed.collapsed?.terminal ?? defaultState.collapsed.terminal,
},
};
}
} catch {
// Ignore parse errors, use defaults
}
return defaultState;
}loadState function · typescript · L29-L50 (22 LOC)app/src/lib/stores/ui.ts
function loadState(): PaneState {
try {
const saved = localStorage.getItem(STORAGE_KEY);
if (saved) {
const parsed = JSON.parse(saved);
return {
explorerWidth: parsed.explorerWidth ?? defaultState.explorerWidth,
aiOutputWidth: parsed.aiOutputWidth ?? defaultState.aiOutputWidth,
terminalHeight: parsed.terminalHeight ?? defaultState.terminalHeight,
focusMode: parsed.focusMode ?? defaultState.focusMode,
collapsed: {
explorer: parsed.collapsed?.explorer ?? defaultState.collapsed.explorer,
aiOutput: parsed.collapsed?.aiOutput ?? defaultState.collapsed.aiOutput,
terminal: parsed.collapsed?.terminal ?? defaultState.collapsed.terminal,
},
};
}
} catch {
// Ignore parse errors, use defaults
}
return defaultState;
}loadState function · typescript · L29-L50 (22 LOC)app/src/lib/stores/ui.ts
function loadState(): PaneState {
try {
const saved = localStorage.getItem(STORAGE_KEY);
if (saved) {
const parsed = JSON.parse(saved);
return {
explorerWidth: parsed.explorerWidth ?? defaultState.explorerWidth,
aiOutputWidth: parsed.aiOutputWidth ?? defaultState.aiOutputWidth,
terminalHeight: parsed.terminalHeight ?? defaultState.terminalHeight,
focusMode: parsed.focusMode ?? defaultState.focusMode,
collapsed: {
explorer: parsed.collapsed?.explorer ?? defaultState.collapsed.explorer,
aiOutput: parsed.collapsed?.aiOutput ?? defaultState.collapsed.aiOutput,
terminal: parsed.collapsed?.terminal ?? defaultState.collapsed.terminal,
},
};
}
} catch {
// Ignore parse errors, use defaults
}
return defaultState;
}persistState function · typescript · L54-L63 (10 LOC)app/src/lib/stores/ui.ts
function persistState(state: PaneState) {
if (saveTimeout) clearTimeout(saveTimeout);
saveTimeout = setTimeout(() => {
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
} catch {
// Ignore storage errors
}
}, 200);
}Repobility — same analyzer, your code, free for public repos · /scan/
persistState function · typescript · L54-L63 (10 LOC)app/src/lib/stores/ui.ts
function persistState(state: PaneState) {
if (saveTimeout) clearTimeout(saveTimeout);
saveTimeout = setTimeout(() => {
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
} catch {
// Ignore storage errors
}
}, 200);
}persistState function · typescript · L54-L63 (10 LOC)app/src/lib/stores/ui.ts
function persistState(state: PaneState) {
if (saveTimeout) clearTimeout(saveTimeout);
saveTimeout = setTimeout(() => {
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
} catch {
// Ignore storage errors
}
}, 200);
}persistState function · typescript · L54-L63 (10 LOC)app/src/lib/stores/ui.ts
function persistState(state: PaneState) {
if (saveTimeout) clearTimeout(saveTimeout);
saveTimeout = setTimeout(() => {
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
} catch {
// Ignore storage errors
}
}, 200);
}