Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DevTools] Separate RDT Fusebox into single-panel entry points #30708

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/react-devtools-fusebox/src/frontend.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ export type InitializationOptions = {
canViewElementSourceFunction?: CanViewElementSource,
};

export function initialize(node: Element | Document, options: InitializationOptions): void;
export function initializeComponents(node: Element | Document, options: InitializationOptions): void;
export function initializeProfiler(node: Element | Document, options: InitializationOptions): void;
25 changes: 21 additions & 4 deletions packages/react-devtools-fusebox/src/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ import type {
} from 'react-devtools-shared/src/frontend/types';
import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
import type {
CanViewElementSource,
TabID,
ViewAttributeSource,
ViewElementSource,
CanViewElementSource,
} from 'react-devtools-shared/src/devtools/views/DevTools';
import type {Config} from 'react-devtools-shared/src/devtools/store';

Expand Down Expand Up @@ -51,10 +52,11 @@ type InitializationOptions = {
canViewElementSourceFunction?: CanViewElementSource,
};

export function initialize(
function initializeTab(
tab: TabID,
contentWindow: Element | Document,
options: InitializationOptions,
): void {
) {
const {
bridge,
store,
Expand All @@ -70,7 +72,8 @@ export function initialize(
bridge={bridge}
browserTheme={theme}
store={store}
showTabBar={true}
showTabBar={false}
overrideTab={tab}
warnIfLegacyBackendDetected={true}
enabledInspectedElementContextMenu={true}
viewAttributeSourceFunction={viewAttributeSourceFunction}
Expand All @@ -79,3 +82,17 @@ export function initialize(
/>,
);
}

export function initializeComponents(
contentWindow: Element | Document,
options: InitializationOptions,
): void {
initializeTab('components', contentWindow, options);
}

export function initializeProfiler(
contentWindow: Element | Document,
options: InitializationOptions,
): void {
initializeTab('profiler', contentWindow, options);
}
Loading