/**
 * Global Context - Cross-module communication and state access
 */
import type { HypenModuleInstance } from "./app.js";
import { TypedEventEmitter, type HypenFrameworkEvents } from "./events.js";
export type ModuleReference<T = unknown> = {
    /**
     * Live proxy state - mutations are tracked and trigger re-renders.
     * Use `getState()` for a snapshot if you only need to read values.
     */
    state: T;
    setState: (patch: Partial<T>) => void;
    /**
     * Returns a deep-cloned snapshot of the current state.
     * Unlike `state`, mutations to the returned object are NOT tracked.
     */
    getState: () => T;
};
/**
 * @deprecated Use TypedEventEmitter from events.ts for type-safe events
 */
export type EventHandler = (payload?: unknown) => void;
/**
 * Global Context - Provides access to all modules and cross-module communication
 *
 * @template TEvents - Custom event map (extends HypenFrameworkEvents)
 */
export declare class HypenGlobalContext<TEvents extends Record<string, unknown> = HypenFrameworkEvents> {
    private modules;
    private typedEvents;
    /**
     * @deprecated Legacy event bus for backward compatibility
     */
    private legacyEventBus;
    constructor();
    /**
     * Get the typed event emitter for type-safe event handling
     */
    get events(): TypedEventEmitter<TEvents>;
    /**
     * Register a module instance with an ID
     */
    registerModule(id: string, instance: HypenModuleInstance): void;
    /**
     * Unregister a module
     */
    unregisterModule(id: string): void;
    /**
     * Get a module by ID with type safety
     */
    getModule<T = unknown>(id: string): ModuleReference<T>;
    /**
     * Check if a module exists
     */
    hasModule(id: string): boolean;
    /**
     * Get all registered module IDs
     */
    getModuleIds(): string[];
    /**
     * Get the entire app state tree (snapshot)
     */
    getGlobalState(): Record<string, unknown>;
    /**
     * Emit an event to the event bus (legacy API for backward compatibility)
     * @deprecated Use `context.events.emit()` for type-safe events
     */
    emit(event: string, payload?: unknown): void;
    /**
     * Subscribe to an event (legacy API for backward compatibility)
     * @deprecated Use `context.events.on()` for type-safe events
     */
    on(event: string, handler: EventHandler): () => void;
    /**
     * Unsubscribe from an event (legacy API)
     * @deprecated Use the unsubscribe function returned by `context.events.on()`
     */
    off(event: string, handler: EventHandler): void;
    /**
     * Clear all event listeners for an event (legacy API)
     * @deprecated Use `context.events.removeAllListeners()`
     */
    clearEvent(event: string): void;
    /**
     * Clear all event listeners (legacy API)
     * @deprecated Use `context.events.clearAll()`
     */
    clearAllEvents(): void;
    /**
     * Get debug info about the context
     */
    debug(): {
        modules: string[];
        events: string[];
        typedEvents: Array<keyof TEvents>;
        state: Record<string, unknown>;
    };
}
