flowlight
Version:
A lightweight command interface library with floating button, search functionality, and React integration
61 lines (51 loc) • 1.78 kB
TypeScript
declare module 'flowlight' {
export interface FlowLightOptions {
debug?: boolean;
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
theme?: 'light' | 'dark' | 'auto';
}
export interface SearchState {
isVisible: boolean;
query: string;
}
export class FlowLight {
constructor(options?: FlowLightOptions);
showSearch(): void;
hideSearch(): void;
toggleSearch(): void;
updateOptions(options: FlowLightOptions): void;
getSearchState(): SearchState;
destroy(): void;
eventBus: {
on(event: string, callback: Function): void;
off(event: string, callback: Function): void;
emit(event: string, data?: any): void;
};
}
export default FlowLight;
}
declare module 'flowlight/react' {
import { ReactNode } from 'react';
import { FlowLightOptions, SearchState } from 'flowlight';
export interface FlowLightContext {
flowlight: FlowLight | null;
isReady: boolean;
isSearchVisible: boolean;
error: Error | null;
showSearch: () => void;
hideSearch: () => void;
toggleSearch: () => void;
updateOptions: (options: FlowLightOptions) => void;
getSearchState: () => SearchState | null;
destroy: () => void;
}
export interface FlowLightProviderProps {
options?: FlowLightOptions;
children?: ReactNode;
}
export function FlowLightProvider(props: FlowLightProviderProps): JSX.Element | null;
export function useFlowLight(options?: FlowLightOptions): FlowLightContext;
export function useFlowvana(options?: FlowLightOptions): FlowLightContext;
export function withFlowLight<P extends object>(Component: React.ComponentType<P>): React.ComponentType<P & FlowLightContext>;
export { FlowLight } from 'flowlight';
}