diff --git a/src/lib/components/ui/BasePane.svelte b/src/lib/components/ui/BasePane.svelte new file mode 100644 index 0000000..1e15383 --- /dev/null +++ b/src/lib/components/ui/BasePane.svelte @@ -0,0 +1,170 @@ + + +{#if isOpen} + +{/if} + + diff --git a/src/lib/components/ui/Pane.svelte b/src/lib/components/ui/Pane.svelte new file mode 100644 index 0000000..ce76738 --- /dev/null +++ b/src/lib/components/ui/Pane.svelte @@ -0,0 +1,99 @@ + + + + {#if title || showCloseButton} +
+ {#if title} +

{title}

+ {/if} + {#if showCloseButton} + + {/if} +
+ {/if} + + {#if children} + {@render children()} + {/if} +
+ + diff --git a/src/lib/stores/pane-manager.ts b/src/lib/stores/pane-manager.ts new file mode 100644 index 0000000..b437115 --- /dev/null +++ b/src/lib/stores/pane-manager.ts @@ -0,0 +1,32 @@ +import { writable } from 'svelte/store' + +interface PaneState { + activePane: string | null +} + +function createPaneManager() { + const { subscribe, set, update } = writable({ + activePane: null + }) + + return { + subscribe, + open: (paneId: string) => { + update((state) => ({ + ...state, + activePane: paneId + })) + }, + close: () => { + update((state) => ({ + ...state, + activePane: null + })) + }, + isActive: (paneId: string, state: PaneState) => { + return state.activePane === paneId + } + } +} + +export const paneManager = createPaneManager()