import { ModuleId, UseModuleReturn, EventHandler, EventSubscription, EventSubscriptionOptions, ModuleBoundaryConfig, ModulePerformanceMetrics } from '../types'; /** * Primary hook for accessing module context and capabilities. * Provides module identification, state, metrics, and event communication. * * @returns Module context and utilities * @throws Error if used outside a ModuleBoundary * * @example * ```tsx * function MyComponent() { * const { * moduleId, * config, * isMounted, * emit, * on, * } = useModule(); * * // Subscribe to events * useEffect(() => { * const subscription = on('user:action', (message) => { * console.log('Action received:', message.payload); * }); * * return () => subscription.unsubscribe(); * }, [on]); * * // Emit events * const handleClick = () => { * emit('button:clicked', { buttonId: 'submit' }); * }; * * return ( *
* Module: {config.name} * *
* ); * } * ``` */ export declare function useModule(): UseModuleReturn; /** * Hook to get the current module ID. * @returns Module ID * @throws Error if used outside a ModuleBoundary */ export declare function useModuleId(): ModuleId; /** * Hook to get the current module configuration. * @returns Module configuration * @throws Error if used outside a ModuleBoundary */ export declare function useModuleConfig(): ModuleBoundaryConfig; /** * Hook to check if the module is mounted. * @returns Whether module is mounted * @throws Error if used outside a ModuleBoundary */ export declare function useIsModuleMounted(): boolean; /** * Hook to get the module's performance metrics. * @returns Performance metrics * @throws Error if used outside a ModuleBoundary */ export declare function useModuleMetrics(): ModulePerformanceMetrics; /** * Hook to emit events from the current module. * @returns Event emitter function * @throws Error if used outside a ModuleBoundary * * @example * ```tsx * const emit = useModuleEmit(); * * const handleSave = () => { * emit('data:saved', { id: '123', timestamp: Date.now() }); * }; * ``` */ export declare function useModuleEmit(): (name: string, payload: T) => void; /** * Hook to subscribe to events in the current module. * @returns Event subscription function * @throws Error if used outside a ModuleBoundary * * @example * ```tsx * const on = useModuleSubscribe(); * * useEffect(() => { * const sub = on('notification:received', (msg) => { * showNotification(msg.payload); * }); * * return () => sub.unsubscribe(); * }, [on]); * ``` */ export declare function useModuleSubscribe(): (name: string, handler: EventHandler, options?: EventSubscriptionOptions) => EventSubscription;