/** * useAppState Hook * * Consolidates core UI state management for App.tsx. * Extracts state that controls overlays, dialogs, and UI modes. * * @since v1.40.0 */ import type { ServerJarType } from '../../core/server-jar/index.js'; import type { PluginUpdateInfo } from '../../core/types/index.js'; import type { BatchDownloadResult, DownloadProgress as PluginDownloadProgress } from '../../workflows/download.js'; import type { SetupWizardState } from '../components/wizard/wizard-types.js'; import type { LogEntry } from '../views/logs-types.js'; /** * Workflow dialog types */ export type WorkflowType = 'sync' | 'backup' | 'download' | 'migrate' | null; /** * Download step in server download workflow */ export type DownloadStep = 'type' | 'version' | 'progress'; /** * UI overlay state - controls which overlays are visible */ export interface OverlayState { showHelp: boolean; showConfig: boolean; showCommandPalette: boolean; showBatchMenu: boolean; showSetup: boolean; } /** * Workflow dialog state - controls workflow-specific dialogs */ export interface WorkflowDialogState { workflowType: WorkflowType; showConfirmDialog: boolean; downloadStep: DownloadStep; selectedServerType: ServerJarType | null; } /** * Selection state - tracks user selections across views */ export interface SelectionState { selectedUpdates: Set; selectedPlugins: Set; failedDownloads: Set; } /** * App state returned by the hook */ export interface AppState { overlays: OverlayState; toggleHelp: () => void; toggleConfig: () => void; toggleCommandPalette: () => void; toggleBatchMenu: () => void; closeAllOverlays: () => void; showSetup: boolean; setShowSetup: (show: boolean) => void; setupWizardState: SetupWizardState | null; setSetupWizardState: (state: SetupWizardState | null) => void; changelogUpdate: PluginUpdateInfo | null; setChangelogUpdate: (update: PluginUpdateInfo | null) => void; workflow: WorkflowDialogState; setWorkflowType: (type: WorkflowType) => void; setShowConfirmDialog: (show: boolean) => void; setDownloadStep: (step: DownloadStep) => void; setSelectedServerType: (type: ServerJarType | null) => void; clearWorkflow: () => void; searchQuery: string; setSearchQuery: (query: string) => void; logs: LogEntry[]; setLogs: (logs: LogEntry[]) => void; logsLoading: boolean; setLogsLoading: (loading: boolean) => void; batchDownloadLoading: boolean; setBatchDownloadLoading: (loading: boolean) => void; batchDownloadProgress: PluginDownloadProgress | null; setBatchDownloadProgress: (progress: PluginDownloadProgress | null) => void; batchDownloadResult: BatchDownloadResult | null; setBatchDownloadResult: (result: BatchDownloadResult | null) => void; lastBatchProgressRef: React.MutableRefObject<{ pluginName: string; percent: number; } | null>; serversLoading: boolean; setServersLoading: (loading: boolean) => void; selections: SelectionState; setSelectedUpdates: React.Dispatch>>; setSelectedPlugins: React.Dispatch>>; setFailedDownloads: React.Dispatch>>; toggleUpdateSelection: (pluginName: string) => void; togglePluginSelection: (pluginName: string) => void; clearSelections: () => void; quitPending: boolean; setQuitPending: (pending: boolean) => void; quitTimeoutRef: React.MutableRefObject | null>; workflowDialogActive: boolean; inputEnabled: (authDialogActive: boolean) => boolean; } /** * Core UI state management hook for App component */ export declare function useAppState(): AppState; //# sourceMappingURL=useAppState.d.ts.map