saltfish
Version:
An interactive video-guided tour system for web applications
150 lines • 4.95 kB
TypeScript
import type { ShadowDOMManager } from './ShadowDOMManager';
import type { VideoManager } from './VideoManager';
import type { CursorManager } from './CursorManager';
import type { InteractionManager } from './InteractionManager';
import { type ErrorDisplayOptions } from '../components/ErrorDisplay';
import type { PlayerState, ResettableManager } from '../types';
/**
* Manages all UI coordination, positioning, DOM creation, and button functionality.
* Consolidates the responsibilities of the former ButtonManager and PlayerView.
*/
export declare class UIManager implements ResettableManager {
private shadowDOMManager;
private playerRoot;
private playerElement;
private minimizeButton;
private exitButton;
private playPauseButton;
private errorDisplay;
private loadingSpinner;
private compactLabel;
private playbackButtonsVisible;
private playButton;
private centerPlayButton;
private videoManager;
private storeUnsubscribe;
constructor(shadowDOMManager: ShadowDOMManager);
/**
* Creates the complete player UI including all DOM structure and button management
*/
createPlayerUI(videoManager: VideoManager, cursorManager: CursorManager, interactionManager: InteractionManager): void;
/**
* Sets up click handler for video container
*/
private setupVideoContainerClickHandler;
/**
* Updates the position of the player element based on store state
*/
updatePosition(): void;
/**
* Handles minimize button click
*/
handleMinimizeClick(): void;
/**
* Handles minimize state changes and updates button visibility
*/
handleMinimizeStateChange(isMinimized: boolean): void;
/**
* Gets the player element
*/
getPlayerElement(): HTMLElement | null;
/**
* Gets the player root element
*/
getPlayerRoot(): HTMLElement | null;
/**
* Shows an error display with the specified options
*/
showError(error: Error | string, errorType?: string, customOptions?: Partial<ErrorDisplayOptions>): void;
/**
* Hides the current error display
*/
hideError(): void;
/**
* Checks if error display is currently visible
*/
isErrorDisplayVisible(): boolean;
/**
* Shows the loading spinner with optional message
* @param message - Optional loading message to display
*/
showLoading(message?: string): void;
/**
* Hides the loading spinner
*/
hideLoading(): void;
/**
* Updates the loading message
* @param message - New loading message to display
*/
updateLoadingMessage(message: string): void;
/**
* Shows the player by fading it in
*/
showPlayer(): void;
/**
* Creates the main player DOM structure
* @param shadowRoot - The shadow DOM root element to append to
* @returns The created player element
*/
private createPlayerElement;
/**
* Creates the controls container structure
* @param parentElement - The parent element to append the controls container to
* @returns The created controls container element
*/
private createControlsContainer;
/**
* Creates and adds the saltfish logo to the player
* @param parentElement - The parent element to append the logo to
*/
private createSaltfishLogo;
/**
* Initializes button management functionality
*/
private initializeButtonManagement;
/**
* Displays or hides the playback buttons based on the given visibility state
* @param visible - Whether the buttons should be visible
*/
displayPlaybackButtons(visible: boolean): void;
/**
* Updates the play/pause button state based on the video state
* @param state - The current video state ('playing' or 'paused')
*/
updatePlayPauseButton(state: PlayerState): void;
/**
* Handles autoplay fallback and idle mode interaction by unmuting and resetting video
* @param source - The UI element that triggered the interaction (for logging)
*/
private handleAutoplayFallbackInteraction;
/**
* Creates the center play button with proper click handler
*/
private createCenterPlayButton;
/**
* Shows the compact label next to the player with the provided text
*/
showCompactLabel(labelText: string): void;
/**
* Hides and removes the compact label
*/
hideCompactLabel(): void;
/**
* Resets the UI manager to initial state for reuse
*/
reset(): void;
/**
* Enable prominent styling for the center play button (for special states)
*/
enablePlayButtonProminent(): void;
/**
* Disable prominent styling for the center play button
*/
disablePlayButtonProminent(): void;
/**
* Destroys the UI and cleans up resources
*/
destroy(): void;
}
//# sourceMappingURL=UIManager.d.ts.map