@stacksjs/stx
Version:
A performant UI Framework. Powered by Bun.
55 lines • 1.51 kB
TypeScript
/**
* Create initial navigation state
*/
export declare function createNavigationState(): NavigationState;
/**
* Parse hash from URL for routing
*/
export declare function parseHash(hash: string): { storyId: string | null, variantId: string | null };
/**
* Generate hash for URL
*/
export declare function generateHash(storyId: string | null, variantId: string | null): string;
/**
* Add story to recent list
*/
export declare function addToRecent(state: NavigationState, storyId: string): void;
/**
* Get keyboard navigation script
*/
export declare function getKeyboardNavigationScript(): string;
/**
* Get navigation styles
*/
export declare function getNavigationStyles(): string;
/**
* Generate recent stories list HTML
*/
export declare function generateRecentList(recentStories: string[], storyMap: Map<string, string>): string;
/**
* State persistence helpers
*/
export declare function saveNavigationState(state: NavigationState): void;
/**
* Load navigation state from storage
*/
export declare function loadNavigationState(): Partial<NavigationState>;
/**
* Get state persistence script
*/
export declare function getStatePersistenceScript(): string;
/**
* STX Story - Navigation
* Keyboard navigation, hash routing, and recent components
*/
/**
* Navigation state
*/
export declare interface NavigationState {
selectedStoryId: string | null
selectedVariantId: string | null
recentStories: string[]
maxRecent: number
searchQuery: string
focusedIndex: number
}