diff --git a/src/App.svelte b/src/App.svelte index 075260b..a2492c5 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -4,6 +4,7 @@ import Toolbar from './lib/Toolbar.svelte'; import Editor from './lib/Editor.svelte'; import { state as appState } from './lib/state.svelte'; + import { exportBoard } from './lib/io.svelte'; let editingItem = $derived(appState.editingId ? appState.getItem(appState.editingId) : null); let showEditor = $derived(editingItem || appState.editingGlobal); @@ -11,6 +12,9 @@ let editorWidth = $state(320); let isResizing = $state(false); let interfaceHidden = $state(false); + let exportModalOpen = $state(false); + let exportFilename = $state('board'); + let exportInput: HTMLInputElement; $effect(() => { if (appState.editingId || appState.editingGlobal) { @@ -18,6 +22,13 @@ } }); + $effect(() => { + if (exportModalOpen && exportInput) { + exportInput.focus(); + exportInput.select(); + } + }); + function handleResizeStart(e: MouseEvent) { e.preventDefault(); isResizing = true; @@ -32,6 +43,28 @@ function handleResizeEnd() { isResizing = false; } + + function openExportModal() { + exportFilename = 'board'; + exportModalOpen = true; + } + + async function confirmExport() { + const result = await exportBoard(exportFilename.trim() || 'board'); + if (!result.success) { + alert(result.error || 'Export failed'); + } + exportModalOpen = false; + } + + function cancelExport() { + exportModalOpen = false; + } + + function handleExportKeydown(e: KeyboardEvent) { + if (e.key === 'Escape') cancelExport(); + if (e.key === 'Enter') confirmExport(); + } @@ -43,7 +76,7 @@
{#if !interfaceHidden} - { interfaceHidden = true; appState.setLocked(true); }} /> + { interfaceHidden = true; appState.setLocked(true); }} onExport={openExportModal} /> {/if}
@@ -82,6 +115,32 @@ {/each}
{/if} + {#if exportModalOpen} + + + {/if}
diff --git a/src/app.css b/src/app.css index 33e07b9..050815a 100644 --- a/src/app.css +++ b/src/app.css @@ -14,6 +14,13 @@ box-sizing: border-box; } +button, +input, +select, +textarea { + font-family: inherit; +} + :root { font-family: 'Departure Mono', monospace; color: var(--text, #fff); diff --git a/src/lib/Editor.svelte b/src/lib/Editor.svelte index 3df4401..4c5c55e 100644 --- a/src/lib/Editor.svelte +++ b/src/lib/Editor.svelte @@ -221,6 +221,7 @@ background: transparent; border: none; color: var(--text-dim, #666); + font-family: inherit; cursor: pointer; } @@ -237,6 +238,7 @@ background: transparent; border: none; color: var(--text-dim, #666); + font-family: inherit; cursor: pointer; font-size: 10px; text-transform: uppercase; @@ -251,6 +253,7 @@ background: transparent; border: none; color: var(--text-dim, #666); + font-family: inherit; cursor: pointer; } diff --git a/src/lib/Palette.svelte b/src/lib/Palette.svelte index 05a8fc5..362c9fb 100644 --- a/src/lib/Palette.svelte +++ b/src/lib/Palette.svelte @@ -236,6 +236,7 @@ background: var(--surface, #282c34); color: var(--text-dim, #666); border: 1px solid var(--border, #333); + font-family: inherit; cursor: pointer; } diff --git a/src/lib/Toolbar.svelte b/src/lib/Toolbar.svelte index d01ae40..02e4387 100644 --- a/src/lib/Toolbar.svelte +++ b/src/lib/Toolbar.svelte @@ -1,18 +1,17 @@