/** * bQuery DevTools — 1.14+ extension helpers. * * Adds richer inspection utilities (diff, trace, effects, snapshot import / * export, performance helpers, browser bridge) on top of the core devtools * primitives. * * @module bquery/devtools */ import { clearTimeline, enableDevtools, getDevtoolsState, getTimeline, inspectComponents, inspectSignals, inspectStores, isDevtoolsEnabled, recordEvent, subscribeTimeline, trackSignal } from './devtools'; import type { ComponentSnapshot, DevtoolsState, SignalSnapshot, StoreSnapshot, TimelineEntry, TimelineEventType } from './types'; /** Filter parameters for {@link filterTimeline}. */ export interface TimelineFilter { /** Restrict entries to the listed event types. */ types?: readonly TimelineEventType[]; /** Only include entries at or after this timestamp (ms). */ since?: number; /** Only include entries up to this timestamp (ms). */ until?: number; /** Case-insensitive substring search over `detail` and `source`. */ search?: string; } /** * Return a filtered view of the current timeline (1.14+). * * @example * ```ts * filterTimeline({ types: ['signal:update'], search: 'count' }); * ``` */ export declare const filterTimeline: (filter?: TimelineFilter) => readonly TimelineEntry[]; /** Single field change produced by {@link diffSignals} / {@link diffStores}. */ export interface DiffChange { /** Path of the changed field (label or store id). */ key: string; /** Type of change. */ kind: 'added' | 'removed' | 'changed'; /** Previous value (`undefined` when added). */ before?: unknown; /** Next value (`undefined` when removed). */ after?: unknown; } /** * Structural diff between two signal snapshot arrays (1.14+). */ export declare const diffSignals: (prev: readonly SignalSnapshot[], next: readonly SignalSnapshot[]) => DiffChange[]; /** * Structural diff between two store snapshot arrays (1.14+). */ export declare const diffStores: (prev: readonly StoreSnapshot[], next: readonly StoreSnapshot[]) => DiffChange[]; /** * Start logging every update event whose `source` matches the given label. * Useful for narrowing down which code path mutates a single signal. */ export declare const traceSignal: (label: string) => void; /** Stop a previously started signal trace. */ export declare const untraceSignal: (label: string) => void; /** Snapshot of a reactive effect, returned by {@link inspectEffects}. */ export interface EffectSnapshot { readonly label?: string; readonly runs: number; readonly disposed: boolean; } /** List currently tracked reactive effects created via {@link effect} (1.14+). */ export declare const inspectEffects: () => EffectSnapshot[]; /** Payload format produced by {@link exportDevtoolsSnapshot}. */ export interface DevtoolsSnapshot { readonly version: 1; readonly exportedAt: number; readonly state: DevtoolsState; readonly signals: readonly SignalSnapshot[]; readonly stores: readonly StoreSnapshot[]; readonly components: readonly ComponentSnapshot[]; } /** * Capture the current devtools state for offline inspection or bug-reports. */ export declare const exportDevtoolsSnapshot: () => DevtoolsSnapshot; /** Imported snapshot view as returned by {@link importDevtoolsSnapshot}. */ export interface ImportedDevtoolsSnapshot { readonly snapshot: DevtoolsSnapshot; /** Read-only timeline pulled from the imported snapshot. */ readonly timeline: readonly TimelineEntry[]; } /** * Parse a snapshot previously produced by {@link exportDevtoolsSnapshot}. * The current runtime state is **not** modified; the returned object can be * fed into a viewer or assertions. */ export declare const importDevtoolsSnapshot: (json: string | DevtoolsSnapshot) => ImportedDevtoolsSnapshot; /** * Install the bridge global `window.__BQUERY_DEVTOOLS__` and forward every * subsequent timeline event to it. The global is created if absent; * existing fields (such as the `stores` map maintained by the store module) * are preserved. * * No-op outside of a DOM environment. * * @returns Cleanup function that removes the listener. */ export declare const installBrowserBridge: () => (() => void); /** * Measure how long a function takes to execute and emit a `measure` event. */ export declare const time: (label: string, fn: () => T) => T; /** * Variant of {@link time} that emits a `component:render` event. */ export declare const measureRender: (tagName: string, fn: () => T) => T; /** * Aggregate summary returned by {@link getPerformanceSummary}. */ export interface PerformanceSummary { readonly totalEvents: number; readonly countsByType: Readonly>; readonly averageDurationByType: Readonly>; } /** * Compute a per-type breakdown of the current timeline (counts + average * durations for `measure` / `component:render` events). */ export declare const getPerformanceSummary: () => PerformanceSummary; export { clearTimeline, enableDevtools, getDevtoolsState, getTimeline, inspectComponents, inspectSignals, inspectStores, isDevtoolsEnabled, recordEvent, subscribeTimeline, trackSignal, }; //# sourceMappingURL=extensions.d.ts.map