/** * bQuery DevTools — runtime debugging utilities. * * Enable devtools to inspect signals, stores, components, and view a * timeline of reactive events. * * @module bquery/devtools */ import type { ComponentSnapshot, DevtoolsOptions, DevtoolsState, SignalSnapshot, StoreSnapshot, TimelineEntry, TimelineEventType } from './types'; /** * Enable bQuery development mode. * * When enabled the devtools module records timeline events and * allows inspection of signals, stores, and components. * * @param enabled - `true` to enable, `false` to disable. * @param options - Optional configuration. * * @example * ```ts * import { enableDevtools } from '@bquery/bquery/devtools'; * enableDevtools(true, { logToConsole: true }); * ``` */ export declare const enableDevtools: (enabled: boolean, options?: DevtoolsOptions) => void; /** * Returns `true` when devtools are active. * * @example * ```ts * import { isDevtoolsEnabled } from '@bquery/bquery/devtools'; * if (isDevtoolsEnabled()) { ... } * ``` */ export declare const isDevtoolsEnabled: () => boolean; /** * Register a signal for devtools inspection. * * @param label - Human-readable label (must be unique). * @param peek - Returns the signal's value without tracking. * @param subscriberCount - Returns the current subscriber count. * @throws If a signal with the same label is already tracked. * * @example * ```ts * import { trackSignal } from '@bquery/bquery/devtools'; * import { signal } from '@bquery/bquery/reactive'; * * const count = signal(0); * trackSignal('count', () => count.peek(), () => 0); * ``` */ export declare const trackSignal: (label: string, peek: () => unknown, subscriberCount: () => number) => void; /** * Remove a previously tracked signal. * * @param label - The label used during registration. * * @example * ```ts * import { untrackSignal } from '@bquery/bquery/devtools'; * untrackSignal('count'); * ``` */ export declare const untrackSignal: (label: string) => void; /** * Generate a unique label for anonymous signals. * * @returns A label such as `signal_0`, `signal_1`, … * * @example * ```ts * import { generateSignalLabel } from '@bquery/bquery/devtools'; * const label = generateSignalLabel(); // 'signal_0' * ``` */ export declare const generateSignalLabel: () => string; /** * List all tracked signals with their current values. * * @returns An array of {@link SignalSnapshot} objects. * * @example * ```ts * import { inspectSignals } from '@bquery/bquery/devtools'; * console.table(inspectSignals()); * ``` */ export declare const inspectSignals: () => SignalSnapshot[]; /** * List all stores with their current state. * * Reads from the store registry (`listStores` / `getStore`) that is * already maintained by the store module. * * @returns An array of {@link StoreSnapshot} objects. * * @example * ```ts * import { inspectStores } from '@bquery/bquery/devtools'; * console.table(inspectStores()); * ``` */ export declare const inspectStores: () => StoreSnapshot[]; /** * List all bQuery-registered custom elements visible in the document. * * @returns An array of {@link ComponentSnapshot} objects. * * @example * ```ts * import { inspectComponents } from '@bquery/bquery/devtools'; * console.table(inspectComponents()); * ``` */ export declare const inspectComponents: () => ComponentSnapshot[]; /** * Record a timeline event. * * This is called internally by bQuery modules (signals, store, router) * or can be called from user code / plugins to add custom entries. * * @param type - The event category. * @param detail - A human-readable description. * * @example * ```ts * import { recordEvent } from '@bquery/bquery/devtools'; * recordEvent('signal:update', 'count changed to 5'); * ``` */ export declare const recordEvent: (type: TimelineEventType, detail: string) => void; /** * Returns the full timeline log. * * @returns A read-only array of {@link TimelineEntry} objects. * * @example * ```ts * import { getTimeline } from '@bquery/bquery/devtools'; * for (const e of getTimeline()) { * console.log(e.type, e.detail); * } * ``` */ export declare const getTimeline: () => readonly TimelineEntry[]; /** * Clear all timeline entries. * * @example * ```ts * import { clearTimeline } from '@bquery/bquery/devtools'; * clearTimeline(); * ``` */ export declare const clearTimeline: () => void; /** * Returns a snapshot of the full devtools state. * * @returns A {@link DevtoolsState} object. * * @example * ```ts * import { getDevtoolsState } from '@bquery/bquery/devtools'; * const state = getDevtoolsState(); * console.log(state.enabled, state.timeline.length); * ``` */ export declare const getDevtoolsState: () => DevtoolsState; /** * Pretty-print all tracked signals to the console. * * @example * ```ts * import { logSignals } from '@bquery/bquery/devtools'; * logSignals(); // → table output * ``` */ export declare const logSignals: () => void; /** * Pretty-print all stores to the console. * * @example * ```ts * import { logStores } from '@bquery/bquery/devtools'; * logStores(); // → table output * ``` */ export declare const logStores: () => void; /** * Pretty-print all registered components to the console. * * @example * ```ts * import { logComponents } from '@bquery/bquery/devtools'; * logComponents(); // → table output * ``` */ export declare const logComponents: () => void; /** * Pretty-print the timeline to the console. * * @param last - Only show the last N entries (default: all). * * @example * ```ts * import { logTimeline } from '@bquery/bquery/devtools'; * logTimeline(10); * ``` */ export declare const logTimeline: (last?: number) => void; //# sourceMappingURL=devtools.d.ts.map