import { ClientApi, AppBridge } from '@u-devtools/core'; export interface Toast { success: (msg: string) => void; error: (msg: string) => void; info: (msg: string) => void; } export interface DevToolsContext { api?: ClientApi; bridge: AppBridge; toast: Toast; } /** * Creates an isolated context storage for a plugin. * * Since each plugin is bundled by Vite, we can use * module closure to store context. This is the most reliable, fast and * framework-independent way. * * @returns Pair of functions: setupDevTools (for initialization) and useDevTools (for usage). * * @example * ```typescript * // In plugin's context.ts * import { createDevToolsContext } from '@u-devtools/kit'; * * export const { setupDevTools, useDevTools } = createDevToolsContext(); * * // In client.ts * import { setupDevTools } from './context'; * * renderMain(container, api) { * const bridge = new AppBridge('my-plugin'); * setupDevTools({ api, bridge }); * // ... render UI * } * * // In component * import { useDevTools } from './context'; * * const { api, bridge, toast } = useDevTools(); * ``` */ export declare function createDevToolsContext(): { setupDevTools: (ctx: { api?: ClientApi; bridge: AppBridge; toast?: Toast; }) => void; useDevTools: () => DevToolsContext; useBridge: () => AppBridge; useToast: () => Toast; useApi: () => ClientApi | undefined; }; //# sourceMappingURL=context.d.ts.map