Skip to content

Commit f5da6bc

Browse files
committed
Conflicts and cleanup
1 parent 332d3a1 commit f5da6bc

6 files changed

Lines changed: 29 additions & 16 deletions

File tree

front_end/core/rn_experiments/experimentsImpl.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,10 @@ Instance.register({
191191
unstable: true,
192192
enabledByDefault: () => globalThis.enableTimelineFrames ?? false,
193193
});
194+
195+
Instance.register({
196+
name: RNExperimentName.ENABLE_LIVEMATE_PANEL,
197+
title: 'Enable Livemate Panel',
198+
unstable: true,
199+
enabledByDefault: false,
200+
});

front_end/core/root/Runtime.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ export enum RNExperimentName {
306306
REACT_NATIVE_SPECIFIC_UI = 'react-native-specific-ui',
307307
JS_HEAP_PROFILER_ENABLE = 'js-heap-profiler-enable',
308308
ENABLE_TIMELINE_FRAMES = 'enable-timeline-frames',
309+
ENABLE_LIVEMATE_PANEL = 'enable-livemate-panel',
309310
}
310311

311312
export enum ConditionName {
@@ -341,6 +342,7 @@ export const enum ExperimentName {
341342
REACT_NATIVE_SPECIFIC_UI = RNExperimentName.REACT_NATIVE_SPECIFIC_UI,
342343
NOT_REACT_NATIVE_SPECIFIC_UI = '!' + RNExperimentName.REACT_NATIVE_SPECIFIC_UI,
343344
ENABLE_TIMELINE_FRAMES = RNExperimentName.ENABLE_TIMELINE_FRAMES,
345+
ENABLE_LIVEMATE_PANEL = RNExperimentName.ENABLE_LIVEMATE_PANEL,
344346
}
345347

346348
export enum GenAiEnterprisePolicyValue {

front_end/entrypoints/rn_fusebox/rn_fusebox.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ RNExperiments.RNExperimentsImpl.setIsReactNativeEntryPoint(true);
7979
RNExperiments.RNExperimentsImpl.Instance.enableExperimentsByDefault([
8080
Root.Runtime.ExperimentName.JS_HEAP_PROFILER_ENABLE,
8181
Root.Runtime.ExperimentName.REACT_NATIVE_SPECIFIC_UI,
82+
Root.Runtime.ExperimentName.ENABLE_LIVEMATE_PANEL,
8283
]);
8384

8485
document.addEventListener('visibilitychange', () => {

front_end/panels/livemate/LivematePanel.ts

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class LivematePanel extends ReactDevToolsViewBase {
3434
this.registerRequiredCSS(livematePanelStyles);
3535
}
3636

37-
override renderDevToolsView(): void {
37+
protected override renderDevToolsView(): void {
3838
this.clearView();
3939

4040
this.contentElement.classList.add('livemate-panel');
@@ -71,11 +71,6 @@ export class LivematePanel extends ReactDevToolsViewBase {
7171
const breadcrumb = document.createElement('div');
7272
breadcrumb.setAttribute('style', 'flex: 1; font-family: monospace; font-size: 12px; color: var(--sys-color-on-surface); display: flex; align-items: center; gap: 4px; flex-wrap: wrap;');
7373

74-
// Selected component box
75-
// const selectedComponentBox = document.createElement('div');
76-
// selectedComponentBox.setAttribute('style', 'padding: 4px 8px; border: 1px solid var(--sys-color-divider); border-radius: 4px; background: var(--sys-color-surface-variant); font-family: monospace; font-size: 12px; color: var(--sys-color-on-surface);');
77-
// selectedComponentBox.textContent = '';
78-
7974
// Track the current hierarchy for prompt context
8075
let currentHierarchy: Array<{name: string}> = [];
8176

@@ -87,13 +82,7 @@ export class LivematePanel extends ReactDevToolsViewBase {
8782
return;
8883
}
8984

90-
// Set the selected component to the first one (most specific)
91-
// selectedComponentBox.textContent = components[0].name;
92-
93-
// Show remaining components as breadcrumb (skip the first since it's in the selected box)
94-
const breadcrumbComponents = components.slice(-5);
95-
96-
breadcrumbComponents.forEach((component, index) => {
85+
components.forEach((component: {name: string}, index: number) => {
9786
const componentSpan = document.createElement('span');
9887
componentSpan.textContent = component.name;
9988
componentSpan.setAttribute('style', 'cursor: pointer; color: var(--sys-color-primary); text-decoration: underline;');
@@ -106,17 +95,17 @@ export class LivematePanel extends ReactDevToolsViewBase {
10695

10796
breadcrumb.appendChild(componentSpan);
10897

109-
if (index < breadcrumbComponents.length - 1) {
98+
if (index < components.length - 1) {
11099
const separator = document.createElement('span');
111100
separator.textContent = '>';
112-
separator.setAttribute('style', 'color: var(--sys-color-on-surface); opacity: 0.6;');
101+
separator.setAttribute('style', 'opacity: 0.6;');
113102
breadcrumb.appendChild(separator);
114103
}
115104
});
116105
};
117106

118107
// Listen for component data from React DevTools
119-
bridge.addListener('viewDataAtPoint', (data: unknown) => {
108+
bridge.addListener('selectElementWithViewData', (data: unknown) => {
120109
currentHierarchy = data as Array<{name: string}>;
121110
updateBreadcrumb(currentHierarchy);
122111
});

front_end/panels/livemate/livemate-meta.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// found in the LICENSE file.
55

66
import * as i18n from '../../core/i18n/i18n.js';
7+
import * as Root from '../../core/root/root.js';
78
import * as UI from '../../ui/legacy/legacy.js';
89
import type * as Livemate from './livemate.js';
910

@@ -36,6 +37,7 @@ UI.ViewManager.registerViewExtension({
3637
title: i18nLazyString(UIStrings.livemate),
3738
commandPrompt: i18nLazyString(UIStrings.showLivemate),
3839
order: 100,
40+
experiment: Root.Runtime.ExperimentName.ENABLE_LIVEMATE_PANEL,
3941
async loadView() {
4042
const Livemate = await loadLivemateModule();
4143
return Livemate.LivematePanel.LivematePanel.instance();

front_end/panels/react_devtools/ReactDevToolsViewBase.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ export class ReactDevToolsViewBase extends UI.View.SimpleView implements
7777
readonly #tab: string;
7878
#model: ReactDevToolsModel | null = null;
7979

80+
protected get model(): ReactDevToolsModel | null {
81+
return this.#model;
82+
}
83+
8084
constructor(
8185
tab: 'components' | 'profiler',
8286
title: Platform.UIString.LocalizedString,
@@ -213,4 +217,12 @@ export class ReactDevToolsViewBase extends UI.View.SimpleView implements
213217
#clearView(): void {
214218
this.contentElement.removeChildren();
215219
}
220+
221+
protected clearView(): void {
222+
this.#clearView();
223+
}
224+
225+
protected renderDevToolsView(): void {
226+
this.#renderDevToolsView();
227+
}
216228
}

0 commit comments

Comments
 (0)