/** * @fileoverview Action Notifier - Centralized action notification system * * Provides a centralized event system for notifying UI components about automation actions. * Both the floating cursor and floating action pill subscribe to these notifications. * * @module @vowel.to/client/core * @author vowel.to * @license Proprietary */ /** * Action notification types */ export type ActionType = 'search' | 'click' | 'type' | 'focus' | 'scroll' | 'navigate' | 'custom' | 'idle' | 'ready'; /** * Action notification details */ export interface ActionNotification { /** Type of action being performed */ type: ActionType; /** Human-readable message describing the action */ message: string; /** Optional target element ID (for DOM actions) */ targetElementId?: string; /** Whether the action is idle/completed */ isIdle: boolean; /** Optional position (for cursor positioning) */ position?: { x: number; y: number; }; /** Timestamp when the notification was created */ timestamp: number; } /** * Action notification listener callback */ export type ActionNotificationListener = (notification: ActionNotification) => void; /** * Action Notifier * * Singleton class that manages action notifications for UI components. * Provides a pub-sub pattern for components to subscribe to action updates. * * @example * ```typescript * // Subscribe to notifications * const unsubscribe = ActionNotifier.getInstance().subscribe((notification) => { * console.log('Action:', notification.message); * }); * * // Notify about an action * ActionNotifier.getInstance().notify({ * type: 'click', * message: 'Clicking add to cart button', * targetElementId: 'add_to_cart', * isIdle: false, * timestamp: Date.now() * }); * * // Cleanup * unsubscribe(); * ``` */ export declare class ActionNotifier { private static instance; private listeners; private currentNotification; private enabled; /** * Private constructor (singleton pattern) */ private constructor(); /** * Get singleton instance */ static getInstance(): ActionNotifier; /** * Subscribe to action notifications * * @param listener - Callback function to receive notifications * @returns Unsubscribe function */ subscribe(listener: ActionNotificationListener): () => void; /** * Notify all listeners about an action * * @param notification - Action notification details */ notify(notification: ActionNotification): void; /** * Notify about a search action * * @param query - Search query */ notifySearch(query: string): void; /** * Notify about a click action * * @param elementId - Target element ID * @param message - Optional custom message * @param position - Optional position */ notifyClick(elementId: string, message?: string, position?: { x: number; y: number; }): void; /** * Notify about a type action * * @param elementId - Target element ID * @param text - Text being typed * @param message - Optional custom message * @param position - Optional position */ notifyType(elementId: string, text: string, message?: string, position?: { x: number; y: number; }): void; /** * Notify about a navigation action * * @param path - Target path * @param message - Optional custom message */ notifyNavigate(path: string, message?: string): void; /** * Notify about idle/ready state * * @param message - Status message */ notifyReady(message?: string): void; /** * Clear current notification */ clear(): void; /** * Get current notification */ getCurrentNotification(): ActionNotification | null; /** * Enable notifications */ enable(): void; /** * Disable notifications */ disable(): void; /** * Check if notifications are enabled */ isEnabled(): boolean; /** * Get number of active listeners */ getListenerCount(): number; /** * Clear all listeners (cleanup) */ clearListeners(): void; /** * Reset singleton instance (for testing) */ static reset(): void; } /** * Export convenience function for getting instance */ export declare function getActionNotifier(): ActionNotifier; //# sourceMappingURL=action-notifier.d.ts.map