Skip to content

Commit afda86f

Browse files
committed
Initial livemate panel entrypoint
1 parent f06200b commit afda86f

7 files changed

Lines changed: 158 additions & 0 deletions

File tree

front_end/entrypoints/rn_fusebox/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ devtools_entrypoint("entrypoint") {
5050
"../../panels/react_devtools:components_meta",
5151
"../../panels/react_devtools:profiler_meta",
5252
"../../panels/rn_welcome:meta",
53+
"../../panels/livemate:meta",
5354
"../../panels/security:meta",
5455
"../../panels/sensors:meta",
5556
"../../panels/timeline:meta",

front_end/entrypoints/rn_fusebox/rn_fusebox.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import '../../panels/network/network-meta.js';
1414
import '../../panels/react_devtools/react_devtools_components-meta.js';
1515
import '../../panels/react_devtools/react_devtools_profiler-meta.js';
1616
import '../../panels/rn_welcome/rn_welcome-meta.js';
17+
import '../../panels/livemate/livemate-meta.js';
1718
import '../../panels/timeline/timeline-meta.js';
1819

1920
import * as Host from '../../core/host/host.js';

front_end/panels/livemate/BUILD.gn

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# Copyright 2024 The Chromium Authors. All rights reserved.
3+
# Use of this source code is governed by a BSD-style license that can be
4+
# found in the LICENSE file.
5+
6+
import("../../../scripts/build/ninja/devtools_entrypoint.gni")
7+
import("../../../scripts/build/ninja/devtools_module.gni")
8+
import("../../../scripts/build/ninja/generate_css.gni")
9+
import("../visibility.gni")
10+
11+
generate_css("css_files") {
12+
sources = [ "livematePanel.css" ]
13+
}
14+
15+
devtools_module("livemate") {
16+
sources = [ "LivematePanel.ts" ]
17+
18+
deps = [ "../../ui/legacy:bundle" ]
19+
}
20+
21+
devtools_entrypoint("bundle") {
22+
entrypoint = "livemate.ts"
23+
24+
deps = [
25+
":css_files",
26+
":livemate",
27+
]
28+
29+
visibility = [
30+
":*",
31+
"../../entrypoints/*",
32+
]
33+
34+
visibility += devtools_panels_visibility
35+
}
36+
37+
devtools_entrypoint("meta") {
38+
entrypoint = "livemate-meta.ts"
39+
40+
deps = [
41+
":bundle",
42+
"../../core/i18n:bundle",
43+
"../../ui/legacy:bundle",
44+
]
45+
46+
visibility = [ "../../entrypoints/*" ]
47+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) Meta Platforms, Inc. and affiliates.
2+
// Copyright 2024 The Chromium Authors. All rights reserved.
3+
// Use of this source code is governed by a BSD-style license that can be
4+
// found in the LICENSE file.
5+
6+
import * as UI from '../../ui/legacy/legacy.js';
7+
import livematePanelStyles from './livematePanel.css.js';
8+
9+
let livematePanelInstance: LivematePanel;
10+
11+
export class LivematePanel extends UI.Widget.VBox {
12+
static instance(): LivematePanel {
13+
if (!livematePanelInstance) {
14+
livematePanelInstance = new LivematePanel();
15+
}
16+
return livematePanelInstance;
17+
}
18+
19+
private constructor() {
20+
super(true, true);
21+
this.registerRequiredCSS(livematePanelStyles);
22+
this.contentElement.classList.add('livemate-panel');
23+
}
24+
25+
override wasShown(): void {
26+
super.wasShown();
27+
this.renderContent();
28+
}
29+
30+
private renderContent(): void {
31+
this.contentElement.removeChildren();
32+
33+
const header = this.contentElement.createChild('div', 'livemate-header');
34+
header.textContent = 'Livemate Panel';
35+
}
36+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) Meta Platforms, Inc. and affiliates.
2+
// Copyright 2024 The Chromium Authors. All rights reserved.
3+
// Use of this source code is governed by a BSD-style license that can be
4+
// found in the LICENSE file.
5+
6+
import * as i18n from '../../core/i18n/i18n.js';
7+
import * as UI from '../../ui/legacy/legacy.js';
8+
import type * as Livemate from './livemate.js';
9+
10+
const UIStrings = {
11+
/**
12+
*@description Title of the Livemate panel
13+
*/
14+
livemate: 'Livemate',
15+
/**
16+
*@description Command for showing the Livemate panel
17+
*/
18+
showLivemate: 'Show Livemate',
19+
} as const;
20+
21+
const str_ = i18n.i18n.registerUIStrings('panels/livemate/livemate-meta.ts', UIStrings);
22+
const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
23+
24+
let loadedLivemateModule: (typeof Livemate | undefined);
25+
26+
async function loadLivemateModule(): Promise<typeof Livemate> {
27+
if (!loadedLivemateModule) {
28+
loadedLivemateModule = await import('./livemate.js');
29+
}
30+
return loadedLivemateModule;
31+
}
32+
33+
UI.ViewManager.registerViewExtension({
34+
location: UI.ViewManager.ViewLocationValues.PANEL,
35+
id: 'livemate',
36+
title: i18nLazyString(UIStrings.livemate),
37+
commandPrompt: i18nLazyString(UIStrings.showLivemate),
38+
order: 100,
39+
async loadView() {
40+
const Livemate = await loadLivemateModule();
41+
return Livemate.LivematePanel.LivematePanel.instance();
42+
},
43+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) Meta Platforms, Inc. and affiliates.
2+
// Copyright 2024 The Chromium Authors. All rights reserved.
3+
// Use of this source code is governed by a BSD-style license that can be
4+
// found in the LICENSE file.
5+
6+
import * as LivematePanel from './LivematePanel.js';
7+
8+
export {
9+
LivematePanel,
10+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.livemate-panel {
2+
display: flex;
3+
flex-direction: column;
4+
overflow: auto;
5+
padding: 12px;
6+
background-color: var(--sys-color-cdt-base-container);
7+
}
8+
9+
.livemate-header {
10+
font-size: 18px;
11+
font-weight: 500;
12+
margin-bottom: 16px;
13+
color: var(--sys-color-on-surface);
14+
}
15+
16+
.livemate-content {
17+
font-size: 14px;
18+
color: var(--sys-color-on-surface);
19+
line-height: 1.6;
20+
}

0 commit comments

Comments
 (0)