UNPKG

ttabs-svelte

Version:

A flexible layout management system with draggable, resizable tiles and tabs for Svelte applications. Like in VSCode

34 lines (33 loc) 995 B
import type { TileState } from '../types/tile-types'; import type { TtabsStorageAdapter, TtabsStorageData } from './adapter'; /** * LocalStorage adapter for Ttabs */ export declare class LocalStorageAdapter implements TtabsStorageAdapter { private storageKey; private debounceTimer; private debounceDelay; /** * Create a LocalStorage adapter * @param storageKey Key to use in localStorage * @param debounceMs Debounce delay in milliseconds (default: 500ms) */ constructor(storageKey: string, debounceMs?: number); /** * Save ttabs state to localStorage with debounce * @param state The tiles state */ save(state: Record<string, TileState>): void; /** * Perform the actual save to localStorage */ private saveToStorage; /** * Helper method to find focused tab from state */ private findFocusedTab; /** * Load ttabs state from localStorage */ load(): TtabsStorageData | null; }