react-inspector-devtools 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +199 -2
- package/dist/DevtoolsApp.d.ts +1 -0
- package/dist/InspectorDevTools.d.ts +8 -0
- package/dist/components/ConfirmDialog/index.d.ts +12 -0
- package/dist/components/ContextMenu/index.d.ts +27 -0
- package/dist/components/DevToolsContainer/index.d.ts +3 -0
- package/dist/components/ErrorBoundary/index.d.ts +18 -0
- package/dist/components/Icons/index.d.ts +39 -0
- package/dist/components/ObjectInspector/index.d.ts +28 -0
- package/dist/components/SplitPane/index.d.ts +17 -0
- package/dist/components/StatusBar/index.d.ts +2 -0
- package/dist/components/Toolbar/index.d.ts +6 -0
- package/dist/core/eventBus.d.ts +32 -0
- package/dist/core/ownership.d.ts +9 -0
- package/dist/core/panelRegistry.d.ts +9 -0
- package/dist/hooks/useConfig.d.ts +13 -0
- package/dist/hooks/useDevtoolsContext.d.ts +8 -0
- package/dist/hooks/useDrag.d.ts +6 -0
- package/dist/hooks/useThemeResolved.d.ts +2 -0
- package/dist/index.cjs +10667 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +10662 -0
- package/dist/index.js.map +1 -0
- package/dist/inspectors/CSSInspector/BoxModel.d.ts +4 -0
- package/dist/inspectors/CSSInspector/ComputedPane.d.ts +3 -0
- package/dist/inspectors/CSSInspector/StylesPane.d.ts +3 -0
- package/dist/inspectors/CSSInspector/cssModel.d.ts +72 -0
- package/dist/inspectors/CookieInspector/index.d.ts +1 -0
- package/dist/inspectors/DOMInspector/DOMTree.d.ts +1 -0
- package/dist/inspectors/DOMInspector/Overlay.d.ts +2 -0
- package/dist/inspectors/DOMInspector/PropertiesPane.d.ts +7 -0
- package/dist/inspectors/DOMInspector/treeModel.d.ts +19 -0
- package/dist/inspectors/DOMInspector/usePicker.d.ts +6 -0
- package/dist/inspectors/StorageInspector/index.d.ts +10 -0
- package/dist/inspectors/StorageInspector/providers.d.ts +2 -0
- package/dist/instrumentation/console/index.d.ts +10 -0
- package/dist/instrumentation/dom/index.d.ts +9 -0
- package/dist/instrumentation/errors/index.d.ts +5 -0
- package/dist/instrumentation/index.d.ts +26 -0
- package/dist/instrumentation/network/fetch.d.ts +9 -0
- package/dist/instrumentation/network/resources.d.ts +15 -0
- package/dist/instrumentation/network/shared.d.ts +26 -0
- package/dist/instrumentation/network/xhr.d.ts +10 -0
- package/dist/instrumentation/storage/index.d.ts +9 -0
- package/dist/panels/Application/index.d.ts +1 -0
- package/dist/panels/Console/ConsoleInput.d.ts +3 -0
- package/dist/panels/Console/evaluate.d.ts +26 -0
- package/dist/panels/Console/format.d.ts +8 -0
- package/dist/panels/Console/index.d.ts +1 -0
- package/dist/panels/DeviceToolbar/emulation.d.ts +34 -0
- package/dist/panels/DeviceToolbar/index.d.ts +1 -0
- package/dist/panels/Elements/index.d.ts +1 -0
- package/dist/panels/Network/RequestDetails.d.ts +5 -0
- package/dist/panels/Network/index.d.ts +1 -0
- package/dist/panels/Network/util.d.ts +11 -0
- package/dist/panels/Settings/index.d.ts +1 -0
- package/dist/panels/index.d.ts +3 -0
- package/dist/store/applicationStore.d.ts +10 -0
- package/dist/store/consoleStore.d.ts +30 -0
- package/dist/store/deviceStore.d.ts +24 -0
- package/dist/store/devtoolsStore.d.ts +49 -0
- package/dist/store/elementsStore.d.ts +24 -0
- package/dist/store/networkStore.d.ts +33 -0
- package/dist/themes/index.d.ts +1 -0
- package/dist/types/index.d.ts +158 -0
- package/dist/utils/cookies.d.ts +32 -0
- package/dist/utils/domSelector.d.ts +4 -0
- package/dist/utils/format.d.ts +15 -0
- package/dist/utils/mediaQuery.d.ts +19 -0
- package/dist/utils/safeStorage.d.ts +10 -0
- package/dist/utils/shortcut.d.ts +15 -0
- package/dist/utils/specificity.d.ts +6 -0
- package/dist/utils/stack.d.ts +2 -0
- package/package.json +66 -4
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type Specificity } from '../../utils/specificity';
|
|
2
|
+
export interface Declaration {
|
|
3
|
+
name: string;
|
|
4
|
+
value: string;
|
|
5
|
+
important: boolean;
|
|
6
|
+
/** Disabled through the inspector checkbox (temporarily removed from the style). */
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
/** Overridden by a declaration with higher precedence. */
|
|
9
|
+
overridden: boolean;
|
|
10
|
+
/** Only meaningful for inherited sections: whether the property inherits. */
|
|
11
|
+
inherited?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface RuleModel {
|
|
14
|
+
key: string;
|
|
15
|
+
kind: 'inline' | 'rule';
|
|
16
|
+
selector: string;
|
|
17
|
+
/** Selectors from the list that matched the element (for highlighting). */
|
|
18
|
+
matchedSelectors: string[];
|
|
19
|
+
source: string;
|
|
20
|
+
media: string[];
|
|
21
|
+
style: CSSStyleDeclaration;
|
|
22
|
+
rule?: CSSStyleRule;
|
|
23
|
+
element?: Element;
|
|
24
|
+
declarations: Declaration[];
|
|
25
|
+
specificity: Specificity;
|
|
26
|
+
order: number;
|
|
27
|
+
editable: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface InheritedSection {
|
|
30
|
+
ancestor: Element;
|
|
31
|
+
rules: RuleModel[];
|
|
32
|
+
}
|
|
33
|
+
export interface MatchedStyles {
|
|
34
|
+
rules: RuleModel[];
|
|
35
|
+
inherited: InheritedSection[];
|
|
36
|
+
blockedSheets: string[];
|
|
37
|
+
}
|
|
38
|
+
/** Splits a cssText string into declarations, respecting parentheses and quotes. */
|
|
39
|
+
export declare function parseCssText(text: string): {
|
|
40
|
+
name: string;
|
|
41
|
+
value: string;
|
|
42
|
+
important: boolean;
|
|
43
|
+
}[];
|
|
44
|
+
export declare function hasChanges(): boolean;
|
|
45
|
+
/** Reverts every style change made through the inspector. */
|
|
46
|
+
export declare function revertAllChanges(): void;
|
|
47
|
+
export declare function setDeclaration(model: RuleModel, name: string, value: string, important: boolean, oldName?: string): boolean;
|
|
48
|
+
export declare function removeDeclaration(model: RuleModel, name: string): void;
|
|
49
|
+
export declare function toggleDeclaration(model: RuleModel, decl: Declaration, enable: boolean): void;
|
|
50
|
+
/** Creates a new rule for the element in a devtools-owned "inspector stylesheet". */
|
|
51
|
+
export declare function addNewRule(el: Element): CSSStyleRule | null;
|
|
52
|
+
export declare function setRuleSelector(rule: CSSStyleRule, selector: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Returns all rules matching an element, in Chrome's display order
|
|
55
|
+
* (inline style first, then by cascade precedence).
|
|
56
|
+
*/
|
|
57
|
+
export declare function getMatchedRules(el: Element, { inheritedOnly }?: {
|
|
58
|
+
inheritedOnly?: boolean | undefined;
|
|
59
|
+
}): {
|
|
60
|
+
rules: RuleModel[];
|
|
61
|
+
blockedSheets: string[];
|
|
62
|
+
};
|
|
63
|
+
/** Inheritable CSS properties (subset covering everything commonly used). */
|
|
64
|
+
export declare const INHERITED_PROPERTIES: Set<string>;
|
|
65
|
+
export declare const isInheritable: (name: string) => boolean;
|
|
66
|
+
/** Full style information for the Styles pane. */
|
|
67
|
+
export declare function getMatchedStyles(el: Element, maxAncestors?: number): MatchedStyles;
|
|
68
|
+
/**
|
|
69
|
+
* Computed style of a pristine element with the same tag, used by the Computed
|
|
70
|
+
* pane to hide properties that still have their default value.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getDefaultComputed(tag: string, host: ShadowRoot | null): Map<string, string> | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CookieInspector(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function DOMTree(): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Layout / properties / attributes summary of the selected element. */
|
|
2
|
+
export declare function LayoutPane({ el }: {
|
|
3
|
+
el: Element;
|
|
4
|
+
}): import("react").JSX.Element;
|
|
5
|
+
export declare function PropertiesPane({ el }: {
|
|
6
|
+
el: Element;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type RowKind = 'open' | 'close' | 'inline' | 'text' | 'comment' | 'doctype' | 'shadow';
|
|
2
|
+
export interface TreeRow {
|
|
3
|
+
node: Node;
|
|
4
|
+
depth: number;
|
|
5
|
+
kind: RowKind;
|
|
6
|
+
expandable: boolean;
|
|
7
|
+
expanded: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const VOID_ELEMENTS: Set<string>;
|
|
10
|
+
/** Child nodes shown in the tree (whitespace-only text and devtools nodes hidden). */
|
|
11
|
+
export declare function visibleChildren(node: Node): Node[];
|
|
12
|
+
/** An element whose only child is short text renders on one line: <p>text</p> */
|
|
13
|
+
export declare function inlineText(el: Element): string | null;
|
|
14
|
+
/** Flattens the expanded DOM into rows (with closing-tag rows like Chrome). */
|
|
15
|
+
export declare function flattenTree(root: Document): TreeRow[];
|
|
16
|
+
export declare function expandRecursively(node: Node, maxDepth?: number): void;
|
|
17
|
+
export declare function collapseRecursively(node: Node): void;
|
|
18
|
+
/** Finds nodes matching a CSS selector, falling back to a text/attribute search. */
|
|
19
|
+
export declare function searchDom(query: string): Element[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Key/value inspector for localStorage and sessionStorage. Changes apply to the live page immediately. */
|
|
2
|
+
export declare function StorageInspector({ area }: {
|
|
3
|
+
area: 'local' | 'session';
|
|
4
|
+
}): import("react").JSX.Element;
|
|
5
|
+
export declare function CellInput({ initial, onCommit, onCancel, placeholder }: {
|
|
6
|
+
initial: string;
|
|
7
|
+
onCommit: (v: string) => void;
|
|
8
|
+
onCancel: () => void;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EventBus, DevToolsEvents } from '../../core/eventBus';
|
|
2
|
+
type Bus = EventBus<DevToolsEvents>;
|
|
3
|
+
declare const PATCHED: readonly ["log", "info", "warn", "error", "debug", "table", "group", "groupCollapsed", "groupEnd", "time", "timeLog", "timeEnd", "count", "countReset", "trace", "assert", "clear", "dir", "dirxml"];
|
|
4
|
+
type Method = (typeof PATCHED)[number];
|
|
5
|
+
/** Errors already reported via console.error, used to de-duplicate uncaught error reports. */
|
|
6
|
+
export declare const reportedErrors: WeakSet<object>;
|
|
7
|
+
/** Original console methods, captured at install time. Used by devtools for its own diagnostics. */
|
|
8
|
+
export declare const originalConsole: Partial<Record<Method, (...args: any[]) => void>>;
|
|
9
|
+
export declare function installConsole(bus: Bus): () => void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DevToolsEvents, EventBus } from '../../core/eventBus';
|
|
2
|
+
type Bus = EventBus<DevToolsEvents>;
|
|
3
|
+
/**
|
|
4
|
+
* Watches the document for changes (including React re-renders) and emits a
|
|
5
|
+
* single batched 'dom:mutation' per animation frame. Mutations to the devtools
|
|
6
|
+
* host itself are ignored.
|
|
7
|
+
*/
|
|
8
|
+
export declare function installDomObserver(bus: Bus): () => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { EventBus, DevToolsEvents } from '../../core/eventBus';
|
|
2
|
+
type Bus = EventBus<DevToolsEvents>;
|
|
3
|
+
/** Captures uncaught exceptions, unhandled promise rejections and failed resource loads. */
|
|
4
|
+
export declare function installErrors(bus: Bus): () => void;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface InstrumentationConfig {
|
|
2
|
+
console?: boolean;
|
|
3
|
+
network?: boolean;
|
|
4
|
+
storage?: boolean;
|
|
5
|
+
dom?: boolean;
|
|
6
|
+
/** Patch matchMedia so the device toolbar can emulate viewport media queries. */
|
|
7
|
+
media?: boolean;
|
|
8
|
+
ignoreUrls?: (string | RegExp)[];
|
|
9
|
+
maxConsoleEntries?: number;
|
|
10
|
+
maxNetworkEntries?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Installs the requested instrumentation. Reference counted: multiple callers
|
|
14
|
+
* (StrictMode double-mounts, installEarly + component) patch globals only once.
|
|
15
|
+
* Returns a release function that restores the original globals when the last
|
|
16
|
+
* user releases them.
|
|
17
|
+
*/
|
|
18
|
+
export declare function acquireInstrumentation(cfg?: InstrumentationConfig): () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Starts capturing console output and network requests immediately — call this
|
|
21
|
+
* in your entry file before rendering so logs/requests made during startup are captured.
|
|
22
|
+
* Returns a function that undoes the early installation.
|
|
23
|
+
*/
|
|
24
|
+
export declare function installEarly(cfg?: InstrumentationConfig): () => void;
|
|
25
|
+
/** For tests: whether any module is currently installed. */
|
|
26
|
+
export declare function installedModules(): string[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DevToolsEvents, EventBus } from '../../core/eventBus';
|
|
2
|
+
import { type NetworkConfig } from './shared';
|
|
3
|
+
type Bus = EventBus<DevToolsEvents>;
|
|
4
|
+
/**
|
|
5
|
+
* Wraps window.fetch. The original promise is returned untouched; response bodies
|
|
6
|
+
* are read from `response.clone()` so the application's stream is never consumed.
|
|
7
|
+
*/
|
|
8
|
+
export declare function installFetch(bus: Bus, cfg: NetworkConfig): () => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DevToolsEvents, EventBus } from '../../core/eventBus';
|
|
2
|
+
import type { NetworkTiming } from '../../types';
|
|
3
|
+
import { type NetworkConfig } from './shared';
|
|
4
|
+
type Bus = EventBus<DevToolsEvents>;
|
|
5
|
+
export declare function timingFromEntry(e: PerformanceResourceTiming): NetworkTiming;
|
|
6
|
+
/**
|
|
7
|
+
* Uses the Resource Timing API to list resources loaded by the page (scripts,
|
|
8
|
+
* stylesheets, images, fonts…) — including ones loaded before devtools mounted.
|
|
9
|
+
* Fetch/XHR entries are emitted as 'network:resource' so the store can attach
|
|
10
|
+
* timing data to requests captured by the fetch/XHR wrappers.
|
|
11
|
+
*/
|
|
12
|
+
export declare function installResources(bus: Bus, cfg: NetworkConfig): () => void;
|
|
13
|
+
/** Wraps the WebSocket constructor to record connections and frames. */
|
|
14
|
+
export declare function installWebSocket(bus: Bus, cfg: NetworkConfig): () => void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { RequestPayload, ResourceType } from '../../types';
|
|
2
|
+
export interface NetworkConfig {
|
|
3
|
+
ignoreUrls: (string | RegExp)[];
|
|
4
|
+
isCacheDisabled: () => boolean;
|
|
5
|
+
}
|
|
6
|
+
/** Max response body we keep in memory per request. */
|
|
7
|
+
export declare const MAX_BODY: number;
|
|
8
|
+
export declare const MAX_BINARY_PREVIEW: number;
|
|
9
|
+
export declare const newRequestId: () => string;
|
|
10
|
+
export declare function shouldIgnore(url: string, cfg: NetworkConfig): boolean;
|
|
11
|
+
export declare function absoluteUrl(url: string): string;
|
|
12
|
+
export declare function headersToList(h: HeadersInit | Headers | undefined | null): [string, string][];
|
|
13
|
+
export declare function parseRawHeaders(raw: string): [string, string][];
|
|
14
|
+
export declare function getHeader(list: [string, string][], name: string): string | undefined;
|
|
15
|
+
/** Describes a request body without consuming or mutating it. */
|
|
16
|
+
export declare function describeBody(body: unknown): RequestPayload | undefined;
|
|
17
|
+
export declare function typeFromUrl(url: string): ResourceType | null;
|
|
18
|
+
export declare function typeFromInitiator(initiatorType: string, url: string): ResourceType;
|
|
19
|
+
export declare function isTextual(mime: string | undefined): boolean;
|
|
20
|
+
export declare function shortStack(): string | undefined;
|
|
21
|
+
/** Reads at most `limit` bytes from a (cloned) response body stream. Never touches the original. */
|
|
22
|
+
export declare function readLimitedText(res: Response, limit: number): Promise<{
|
|
23
|
+
text: string;
|
|
24
|
+
truncated: boolean;
|
|
25
|
+
size: number;
|
|
26
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DevToolsEvents, EventBus } from '../../core/eventBus';
|
|
2
|
+
import { type NetworkConfig } from './shared';
|
|
3
|
+
type Bus = EventBus<DevToolsEvents>;
|
|
4
|
+
/**
|
|
5
|
+
* Patches XMLHttpRequest.prototype.open/send/setRequestHeader. Only listeners are
|
|
6
|
+
* added; responses are read through the normal getters after `loadend`, which does
|
|
7
|
+
* not alter the request.
|
|
8
|
+
*/
|
|
9
|
+
export declare function installXHR(bus: Bus, cfg: NetworkConfig): () => void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DevToolsEvents, EventBus } from '../../core/eventBus';
|
|
2
|
+
type Bus = EventBus<DevToolsEvents>;
|
|
3
|
+
/**
|
|
4
|
+
* Observes storage writes so the Application panel stays live. Writes from other
|
|
5
|
+
* tabs arrive via the `storage` event; same-tab writes are observed by wrapping
|
|
6
|
+
* Storage.prototype methods (behaviour is unchanged — the original is always called).
|
|
7
|
+
*/
|
|
8
|
+
export declare function installStorage(bus: Bus): () => void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ApplicationPanel(): import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns top-level `let`/`const` into `var` so declarations persist between
|
|
3
|
+
* evaluations, like they do in Chrome's console.
|
|
4
|
+
*/
|
|
5
|
+
export declare function hoistDeclarations(code: string): string;
|
|
6
|
+
export type EvalResult = {
|
|
7
|
+
ok: true;
|
|
8
|
+
value: unknown;
|
|
9
|
+
awaited: boolean;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
error: unknown;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Evaluates code in the page's global scope (indirect eval).
|
|
16
|
+
* Requires the page CSP to allow 'unsafe-eval'.
|
|
17
|
+
*/
|
|
18
|
+
export declare function evaluate(code: string): Promise<EvalResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Side-effect-conscious autocompletion: only simple identifier paths
|
|
21
|
+
* (e.g. `document.body.cl`) are resolved — nothing is ever called.
|
|
22
|
+
*/
|
|
23
|
+
export declare function completions(input: string): {
|
|
24
|
+
prefix: string;
|
|
25
|
+
items: string[];
|
|
26
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Renders console arguments, applying printf-style substitutions
|
|
4
|
+
* (%s %d %i %f %o %O %c) to the first string argument.
|
|
5
|
+
*/
|
|
6
|
+
export declare function formatArgs(args: unknown[], preserved?: boolean): ReactNode[];
|
|
7
|
+
/** Plain-text representation used for searching/filtering. */
|
|
8
|
+
export declare function argsToText(args: unknown[]): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ConsolePanel(): import("react").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Patches window.matchMedia so lists created from now on report emulated values
|
|
3
|
+
* while device mode is active (and real values otherwise). The returned object is
|
|
4
|
+
* still a genuine MediaQueryList, so `instanceof` and listeners keep working.
|
|
5
|
+
*/
|
|
6
|
+
export declare function installMatchMediaPatch(): () => void;
|
|
7
|
+
export declare function resolveTarget(target?: string | HTMLElement): HTMLElement | null;
|
|
8
|
+
export interface EmulationState {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
dpr: number;
|
|
12
|
+
touch: boolean;
|
|
13
|
+
zoom: number;
|
|
14
|
+
left: number;
|
|
15
|
+
top: number;
|
|
16
|
+
frame: 'none' | 'mobile' | 'tablet' | 'desktop';
|
|
17
|
+
dark: boolean;
|
|
18
|
+
emulateMedia: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Applies and later restores device emulation for one target element. */
|
|
21
|
+
export declare class DeviceEmulator {
|
|
22
|
+
private target;
|
|
23
|
+
private savedTarget;
|
|
24
|
+
private restorePage;
|
|
25
|
+
private restoreGlobals;
|
|
26
|
+
private restoreTouch;
|
|
27
|
+
private headObserver;
|
|
28
|
+
private interval;
|
|
29
|
+
private state;
|
|
30
|
+
constructor(target: HTMLElement);
|
|
31
|
+
apply(s: EmulationState): void;
|
|
32
|
+
private installGlobals;
|
|
33
|
+
restore(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function DeviceLayer(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ElementsPanel(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function NetworkPanel(): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NetworkRequest } from '../../types';
|
|
2
|
+
export declare function statusText(r: NetworkRequest): string;
|
|
3
|
+
export declare function displayName(url: string): {
|
|
4
|
+
name: string;
|
|
5
|
+
host: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const TYPE_LABEL: Record<string, string>;
|
|
8
|
+
export declare function isFailed(r: NetworkRequest): boolean;
|
|
9
|
+
export declare function toCurl(r: NetworkRequest): string;
|
|
10
|
+
export declare function toFetch(r: NetworkRequest): string;
|
|
11
|
+
export declare function copyText(text: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SettingsPanel(): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type AppSection = 'local' | 'session' | 'cookies' | 'indexeddb' | 'cache';
|
|
2
|
+
interface ApplicationState {
|
|
3
|
+
section: AppSection;
|
|
4
|
+
/** Bumped on storage changes to trigger refresh. */
|
|
5
|
+
versions: Record<'local' | 'session' | 'cookie', number>;
|
|
6
|
+
setSection: (s: AppSection) => void;
|
|
7
|
+
bump: (area: 'local' | 'session' | 'cookie') => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const useApplication: import("zustand").UseBoundStore<import("zustand").StoreApi<ApplicationState>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ConsoleEntry, ConsoleLevel } from '../types';
|
|
2
|
+
import type { DevToolsEvents } from '../core/eventBus';
|
|
3
|
+
export type LevelFilter = 'verbose' | 'info' | 'warnings' | 'errors';
|
|
4
|
+
interface ConsoleState {
|
|
5
|
+
entries: ConsoleEntry[];
|
|
6
|
+
max: number;
|
|
7
|
+
filterText: string;
|
|
8
|
+
levels: Record<LevelFilter, boolean>;
|
|
9
|
+
/** user-toggled group collapse overrides (group-start entry id -> collapsed) */
|
|
10
|
+
groupToggles: Record<number, boolean>;
|
|
11
|
+
history: string[];
|
|
12
|
+
clear: () => void;
|
|
13
|
+
setFilterText: (t: string) => void;
|
|
14
|
+
toggleLevel: (l: LevelFilter) => void;
|
|
15
|
+
setLevels: (l: Record<LevelFilter, boolean>) => void;
|
|
16
|
+
toggleGroup: (id: number, collapsed: boolean) => void;
|
|
17
|
+
pushHistory: (cmd: string) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const levelToFilter: (l: ConsoleLevel) => LevelFilter;
|
|
20
|
+
export declare const useConsole: import("zustand").UseBoundStore<import("zustand").StoreApi<ConsoleState>>;
|
|
21
|
+
export declare function loadConsoleHistory(): void;
|
|
22
|
+
export declare function setGroupSimilar(v: boolean): void;
|
|
23
|
+
export declare function addConsoleEntry(raw: DevToolsEvents['console:entry']): void;
|
|
24
|
+
/** Applies buffered entries to the store. Batched so heavy logging stays cheap. */
|
|
25
|
+
export declare function flush(): void;
|
|
26
|
+
export declare function resetGroupStack(): void;
|
|
27
|
+
export declare function stringifyForPreserve(v: unknown): string;
|
|
28
|
+
export declare function savePreservedConsole(): void;
|
|
29
|
+
export declare function restorePreservedConsole(): void;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DevicePreset } from '../types';
|
|
2
|
+
export declare const BUILTIN_PRESETS: DevicePreset[];
|
|
3
|
+
export declare const RESPONSIVE_ID = "responsive";
|
|
4
|
+
export type ZoomSetting = number | 'fit';
|
|
5
|
+
interface DeviceState {
|
|
6
|
+
presetId: string;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
dpr: number;
|
|
10
|
+
zoom: ZoomSetting;
|
|
11
|
+
landscape: boolean;
|
|
12
|
+
showFrame: boolean;
|
|
13
|
+
touch: boolean;
|
|
14
|
+
customPresets: DevicePreset[];
|
|
15
|
+
set: (patch: Partial<DeviceState>) => void;
|
|
16
|
+
applyPreset: (id: string) => void;
|
|
17
|
+
rotate: () => void;
|
|
18
|
+
saveCustomPreset: (p: DevicePreset) => void;
|
|
19
|
+
deleteCustomPreset: (id: string) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function allPresets(custom: DevicePreset[]): DevicePreset[];
|
|
22
|
+
export declare const useDevice: import("zustand").UseBoundStore<import("zustand").StoreApi<DeviceState>>;
|
|
23
|
+
export declare function hydrateDevice(): void;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DockPosition, PanelId, ThemeSetting } from '../types';
|
|
2
|
+
export interface FloatingRect {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export interface DevToolsSettings {
|
|
9
|
+
dock: DockPosition;
|
|
10
|
+
theme: ThemeSetting;
|
|
11
|
+
bottomHeight: number;
|
|
12
|
+
rightWidth: number;
|
|
13
|
+
floating: FloatingRect;
|
|
14
|
+
activePanel: PanelId;
|
|
15
|
+
preserveConsoleLog: boolean;
|
|
16
|
+
preserveNetworkLog: boolean;
|
|
17
|
+
disableCache: boolean;
|
|
18
|
+
consoleTimestamps: boolean;
|
|
19
|
+
groupSimilar: boolean;
|
|
20
|
+
shortcutOverride: string | null;
|
|
21
|
+
/** Panels hidden by the user from the Settings panel */
|
|
22
|
+
hiddenPanels: string[];
|
|
23
|
+
elementsSidebarWidth: number;
|
|
24
|
+
networkDetailWidth: number;
|
|
25
|
+
}
|
|
26
|
+
interface DevToolsState extends DevToolsSettings {
|
|
27
|
+
open: boolean;
|
|
28
|
+
minimized: boolean;
|
|
29
|
+
maximized: boolean;
|
|
30
|
+
pickerActive: boolean;
|
|
31
|
+
deviceMode: boolean;
|
|
32
|
+
systemDark: boolean;
|
|
33
|
+
set: (patch: Partial<DevToolsState>) => void;
|
|
34
|
+
setOpen: (open: boolean) => void;
|
|
35
|
+
toggle: () => void;
|
|
36
|
+
updateSettings: (patch: Partial<DevToolsSettings>) => void;
|
|
37
|
+
resetSettings: () => void;
|
|
38
|
+
}
|
|
39
|
+
export declare const defaultSettings: DevToolsSettings;
|
|
40
|
+
export declare const useDevtools: import("zustand").UseBoundStore<import("zustand").StoreApi<DevToolsState>>;
|
|
41
|
+
export declare function persistSettings(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Loads persisted settings. Component props act as defaults (like Chrome DevTools,
|
|
44
|
+
* the user's last choices are remembered and win over the initial configuration).
|
|
45
|
+
*/
|
|
46
|
+
export declare function hydrateSettings(defaults: Partial<DevToolsSettings> & {
|
|
47
|
+
open?: boolean;
|
|
48
|
+
}): void;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ElementsSidebarTab = 'styles' | 'computed' | 'layout' | 'properties';
|
|
2
|
+
interface ElementsState {
|
|
3
|
+
selected: Node | null;
|
|
4
|
+
hovered: Node | null;
|
|
5
|
+
/** Bumped whenever the observed DOM changes. */
|
|
6
|
+
domVersion: number;
|
|
7
|
+
/** Bumped when the expansion set changes. */
|
|
8
|
+
expandVersion: number;
|
|
9
|
+
/** Bumped when styles were edited through the inspector. */
|
|
10
|
+
styleVersion: number;
|
|
11
|
+
sidebarTab: ElementsSidebarTab;
|
|
12
|
+
/** Request to scroll the selected node into view in the tree */
|
|
13
|
+
revealToken: number;
|
|
14
|
+
select: (node: Node | null, reveal?: boolean) => void;
|
|
15
|
+
hover: (node: Node | null) => void;
|
|
16
|
+
setSidebarTab: (t: ElementsSidebarTab) => void;
|
|
17
|
+
bumpStyles: () => void;
|
|
18
|
+
}
|
|
19
|
+
/** Expanded tree nodes. Kept outside React state: a WeakSet does not leak removed nodes. */
|
|
20
|
+
export declare const expandedNodes: WeakSet<Node>;
|
|
21
|
+
export declare const useElements: import("zustand").UseBoundStore<import("zustand").StoreApi<ElementsState>>;
|
|
22
|
+
export declare function setExpanded(node: Node, expanded: boolean): void;
|
|
23
|
+
export declare function bumpDomVersion(): void;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { NetworkRequest, ResourceType } from '../types';
|
|
2
|
+
export type TypeFilter = 'all' | 'fetch-xhr' | Exclude<ResourceType, 'fetch' | 'xhr'>;
|
|
3
|
+
export type StatusFilter = 'all' | '1xx' | '2xx' | '3xx' | '4xx' | '5xx' | 'failed' | 'pending';
|
|
4
|
+
interface NetworkState {
|
|
5
|
+
requests: NetworkRequest[];
|
|
6
|
+
max: number;
|
|
7
|
+
selectedId: string | null;
|
|
8
|
+
filterText: string;
|
|
9
|
+
invert: boolean;
|
|
10
|
+
typeFilters: TypeFilter[];
|
|
11
|
+
methodFilter: string;
|
|
12
|
+
statusFilter: StatusFilter;
|
|
13
|
+
domainFilter: string;
|
|
14
|
+
recording: boolean;
|
|
15
|
+
sort: {
|
|
16
|
+
column: string;
|
|
17
|
+
dir: 1 | -1;
|
|
18
|
+
} | null;
|
|
19
|
+
select: (id: string | null) => void;
|
|
20
|
+
clear: () => void;
|
|
21
|
+
set: (patch: Partial<NetworkState>) => void;
|
|
22
|
+
toggleType: (t: TypeFilter, multi: boolean) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const useNetwork: import("zustand").UseBoundStore<import("zustand").StoreApi<NetworkState>>;
|
|
25
|
+
export declare function matchesType(r: NetworkRequest, filters: TypeFilter[]): boolean;
|
|
26
|
+
export declare function addRequest(r: NetworkRequest): void;
|
|
27
|
+
export declare function patchRequest(id: string, patch: Partial<NetworkRequest>): void;
|
|
28
|
+
export declare function flushNetwork(): void;
|
|
29
|
+
/** Finds a request (including not-yet-flushed ones). */
|
|
30
|
+
export declare function findRequest(predicate: (r: NetworkRequest) => boolean): NetworkRequest | undefined;
|
|
31
|
+
export declare function savePreservedNetwork(): void;
|
|
32
|
+
export declare function restorePreservedNetwork(): void;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const STYLES: string;
|