/** * vapor-chamber - Vue DevTools integration * * Optional. Call setupDevtools(bus, app) once at app setup. * Requires @vue/devtools-api to be installed - silently no-ops if not present. */ import type { ActionScope, Hook, Listener } from './command-bus'; interface Observable { onAfter: (hook: Hook) => () => void; on?: (pattern: string, listener: Listener) => () => void; } /** Options of {@link setupDevtools}. */ export type DevtoolsOptions = { /** * Emitted facts to show on a "Facts" timeline layer: an {@link ActionScope} * of event names, such as `['router*']` for `routerFacts`. Default: none. * `emit` runs no hooks, so the Commands layer never shows a fact. */ facts?: ActionScope; }; /** * Connect a command bus to Vue DevTools. * * - Adds a **Commands** timeline layer: every dispatch appears as an event, * green for success, red for error. * - Adds a **Vapor Chamber** inspector panel: browse recent commands, * inspect target/payload/result of each one. * * - With `facts`, adds a **Facts** timeline layer: every emitted fact whose * name matches appears as an event. * * @param bus A CommandBus or AsyncCommandBus instance to observe. * @param app The Vue app instance (passed to setupDevtoolsPlugin). * @param options {@link DevtoolsOptions}. * @returns Unsubscribe function - call it to detach from the bus. * * @example * import { createApp } from 'vue'; * import { getCommandBus } from 'vapor-chamber'; * import { setupDevtools } from 'vapor-chamber/devtools'; * * const app = createApp(App); * setupDevtools(getCommandBus(), app, { facts: ['router*'] }); * app.mount('#app'); */ export declare function setupDevtools(bus: Observable, app: unknown, options?: DevtoolsOptions): () => void; export {}; //# sourceMappingURL=devtools.d.ts.map