Installing basic UI

This commit is contained in:
2025-10-14 21:58:12 +02:00
parent 8bceae2396
commit ece02406bd
12 changed files with 1320 additions and 78 deletions

View File

@ -0,0 +1,50 @@
import { writable } from 'svelte/store';
export interface EditorSettings {
fontSize: number;
fontFamily: string;
showLineNumbers: boolean;
enableLineWrapping: boolean;
tabSize: number;
vimMode: boolean;
}
const defaultSettings: EditorSettings = {
fontSize: 14,
fontFamily: "'Roboto Mono', Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
showLineNumbers: true,
enableLineWrapping: false,
tabSize: 2,
vimMode: false
};
function createEditorSettings() {
const stored = localStorage.getItem('editorSettings');
const initial = stored ? { ...defaultSettings, ...JSON.parse(stored) } : defaultSettings;
const { subscribe, set, update } = writable<EditorSettings>(initial);
return {
subscribe,
set: (value: EditorSettings) => {
localStorage.setItem('editorSettings', JSON.stringify(value));
set(value);
},
update: (updater: (value: EditorSettings) => EditorSettings) => {
update((current) => {
const newValue = updater(current);
localStorage.setItem('editorSettings', JSON.stringify(newValue));
return newValue;
});
},
updatePartial: (partial: Partial<EditorSettings>) => {
update((current) => {
const newValue = { ...current, ...partial };
localStorage.setItem('editorSettings', JSON.stringify(newValue));
return newValue;
});
}
};
}
export const editorSettings = createEditorSettings();