chrome-devtools-frontend 1.0.1537268 → 1.0.1538310
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/.env.template +10 -0
- package/docs/get_the_code.md +27 -0
- package/eslint.config.mjs +151 -149
- package/front_end/core/common/SettingRegistration.ts +10 -7
- package/front_end/core/common/Settings.ts +3 -0
- package/front_end/core/host/AidaClient.ts +1 -0
- package/front_end/core/host/UserMetrics.ts +3 -1
- package/front_end/core/root/Runtime.ts +8 -0
- package/front_end/core/sdk/sdk-meta.ts +8 -2
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +4 -3
- package/front_end/generated/SupportedCSSProperties.js +1 -0
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +23 -7
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +110 -5
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +50 -45
- package/front_end/models/ai_code_generation/AiCodeGeneration.ts +151 -0
- package/front_end/models/ai_code_generation/ai_code_generation.ts +6 -0
- package/front_end/models/ai_code_generation/debug.ts +30 -0
- package/front_end/models/cpu_profile/ProfileTreeModel.ts +7 -7
- package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +1 -1
- package/front_end/panels/application/PreloadingTreeElement.ts +10 -2
- package/front_end/panels/application/StorageView.ts +3 -2
- package/front_end/panels/application/components/BackForwardCacheView.ts +34 -51
- package/front_end/panels/application/components/OriginTrialTreeView.ts +141 -170
- package/front_end/panels/application/components/backForwardCacheView.css +4 -0
- package/front_end/panels/application/components/originTrialTreeView.css +37 -7
- package/front_end/panels/application/preloading/components/PreloadingGrid.ts +2 -2
- package/front_end/panels/application/preloading/components/PreloadingString.ts +30 -1
- package/front_end/panels/autofill/AutofillView.ts +1 -1
- package/front_end/panels/console/ConsoleView.ts +11 -9
- package/front_end/panels/coverage/CoverageView.ts +1 -2
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +1 -1
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +1 -1
- package/front_end/panels/elements/ElementStatePaneWidget.ts +1 -1
- package/front_end/panels/elements/EventListenersWidget.ts +1 -2
- package/front_end/panels/elements/PropertiesWidget.ts +1 -1
- package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +1 -0
- package/front_end/panels/network/NetworkConfigView.ts +2 -1
- package/front_end/panels/network/NetworkItemView.ts +1 -1
- package/front_end/panels/network/NetworkPanel.ts +5 -4
- package/front_end/panels/network/NetworkWaterfallColumn.ts +5 -6
- package/front_end/panels/network/RequestCookiesView.ts +2 -1
- package/front_end/panels/network/RequestTimingView.ts +404 -348
- package/front_end/panels/network/networkTimingTable.css +22 -2
- package/front_end/panels/profiler/HeapSnapshotView.ts +3 -2
- package/front_end/panels/sensors/SensorsView.ts +4 -3
- package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +8 -6
- package/front_end/panels/settings/KeybindsSettingsTab.ts +3 -2
- package/front_end/panels/settings/SettingsScreen.ts +2 -1
- package/front_end/panels/settings/WorkspaceSettingsTab.ts +1 -1
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +2 -1
- package/front_end/panels/sources/SourcesPanel.ts +2 -1
- package/front_end/panels/sources/sources-meta.ts +8 -1
- package/front_end/panels/timeline/TimelinePanel.ts +4 -3
- package/front_end/panels/timeline/TimelineUIUtils.ts +4 -20
- package/front_end/panels/timeline/components/LiveMetricsView.ts +1 -0
- package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +42 -3
- package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +2 -0
- package/front_end/panels/timeline/components/networkRequestTooltip.css +19 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/adorners/Adorner.ts +3 -1
- package/front_end/ui/components/buttons/Button.docs.ts +195 -0
- package/front_end/ui/components/icon_button/IconButton.ts +1 -0
- package/front_end/ui/components/settings/SettingCheckbox.ts +50 -14
- package/front_end/ui/components/settings/settingCheckbox.css +6 -1
- package/front_end/ui/components/spinners/Spinners.docs.ts +13 -0
- package/front_end/ui/components/tooltips/Tooltip.docs.ts +76 -0
- package/front_end/ui/legacy/FilterBar.ts +1 -2
- package/front_end/ui/legacy/RadioButton.docs.ts +41 -0
- package/front_end/ui/legacy/SelectMenu.docs.ts +98 -0
- package/front_end/ui/legacy/Toolbar.ts +4 -6
- package/front_end/ui/legacy/Treeoutline.ts +15 -0
- package/front_end/ui/legacy/UIUtils.ts +117 -1
- package/front_end/ui/legacy/Widget.ts +68 -38
- package/front_end/ui/legacy/XLink.ts +1 -0
- package/front_end/ui/legacy/components/inline_editor/Swatches.ts +1 -0
- package/front_end/ui/legacy/components/perf_ui/BrickBreaker.ts +1 -0
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +125 -0
- package/front_end/ui/legacy/components/settings_ui/settings_ui.ts +8 -0
- package/front_end/ui/legacy/legacy.ts +0 -2
- package/front_end/ui/legacy/popover.css +12 -11
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/package.json +1 -1
- package/front_end/models/trace/lantern/testing/MetricTestUtils.ts +0 -62
- package/front_end/models/trace/lantern/testing/testing.ts +0 -5
- package/front_end/panels/application/components/badge.css +0 -25
- package/front_end/ui/components/docs/button/basic.html +0 -44
- package/front_end/ui/components/docs/button/basic.ts +0 -175
- package/front_end/ui/components/docs/radio_button/basic.html +0 -23
- package/front_end/ui/components/docs/radio_button/basic.ts +0 -50
- package/front_end/ui/components/docs/select_menu/basic.html +0 -19
- package/front_end/ui/components/docs/select_menu/basic.ts +0 -95
- package/front_end/ui/components/docs/select_menu/wide-option.html +0 -38
- package/front_end/ui/components/docs/select_menu/wide-option.ts +0 -43
- package/front_end/ui/components/docs/spinners/basic.html +0 -17
- package/front_end/ui/components/docs/spinners/basic.ts +0 -22
- package/front_end/ui/components/docs/tooltip/basic.html +0 -20
- package/front_end/ui/components/docs/tooltip/basic.ts +0 -82
- package/front_end/ui/legacy/SettingsUI.ts +0 -240
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2021 The Chromium Authors
|
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
found in the LICENSE file.
|
|
5
|
-
-->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html>
|
|
8
|
-
<head>
|
|
9
|
-
<meta charset="UTF-8" />
|
|
10
|
-
<meta name="viewport" content="width=device-width" />
|
|
11
|
-
<title>Button example</title>
|
|
12
|
-
<style>
|
|
13
|
-
body {
|
|
14
|
-
overflow: auto !important; /* stylelint-disable-line declaration-no-important */
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
div {
|
|
18
|
-
width: 500px;
|
|
19
|
-
padding: 25px;
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
flex-wrap: wrap;
|
|
23
|
-
gap: 10px;
|
|
24
|
-
}
|
|
25
|
-
</style>
|
|
26
|
-
</head>
|
|
27
|
-
<body>
|
|
28
|
-
<header>Buttons</header>
|
|
29
|
-
<div id="buttons"></div>
|
|
30
|
-
<header>Primary buttons</header>
|
|
31
|
-
<div id="primary-buttons"></div>
|
|
32
|
-
<header>Tonal buttons</header>
|
|
33
|
-
<div id="tonal-buttons"></div>
|
|
34
|
-
<header>Outlined buttons</header>
|
|
35
|
-
<div id="outlined-buttons"></div>
|
|
36
|
-
<header>Text buttons</header>
|
|
37
|
-
<div id="text-buttons"></div>
|
|
38
|
-
<header>Icon buttons</header>
|
|
39
|
-
<div id="icon-buttons"></div>
|
|
40
|
-
<header>Floating buttons</header>
|
|
41
|
-
<div id="floating-buttons"></div>
|
|
42
|
-
<script type="module" src="./basic.js"></script>
|
|
43
|
-
</body>
|
|
44
|
-
</html>
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
// Copyright 2021 The Chromium Authors
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
import * as FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
|
|
6
|
-
import * as Buttons from '../../buttons/buttons.js';
|
|
7
|
-
import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
8
|
-
|
|
9
|
-
await ComponentHelpers.ComponentServerSetup.setup();
|
|
10
|
-
await FrontendHelpers.initializeGlobalVars();
|
|
11
|
-
|
|
12
|
-
const BUTTONS_SECTION = '#buttons';
|
|
13
|
-
const PRIMARY_SECTION = '#primary-buttons';
|
|
14
|
-
const TONAL_SECTION = '#tonal-buttons';
|
|
15
|
-
const OUTLINED_SECTION = '#outlined-buttons';
|
|
16
|
-
const TEXT_SECTION = '#text-buttons';
|
|
17
|
-
const ICON_SECTION = '#icon-buttons';
|
|
18
|
-
const FLOATING_SECTION = '#floating-buttons';
|
|
19
|
-
|
|
20
|
-
const DEFAULT_TEXT = 'Default';
|
|
21
|
-
const WITH_ICON_TEXT = 'With icon';
|
|
22
|
-
const MICRO_TEXT = 'Micro';
|
|
23
|
-
|
|
24
|
-
function append(section: string, element: HTMLElement): void {
|
|
25
|
-
document.querySelector(section)?.appendChild(element);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Buttons
|
|
29
|
-
{
|
|
30
|
-
const primaryButton = new Buttons.Button.Button();
|
|
31
|
-
primaryButton.data = {
|
|
32
|
-
variant: Buttons.Button.Variant.PRIMARY,
|
|
33
|
-
};
|
|
34
|
-
primaryButton.innerText = 'Primary button';
|
|
35
|
-
append(BUTTONS_SECTION, primaryButton);
|
|
36
|
-
|
|
37
|
-
const tonalButton = new Buttons.Button.Button();
|
|
38
|
-
tonalButton.data = {
|
|
39
|
-
variant: Buttons.Button.Variant.TONAL,
|
|
40
|
-
};
|
|
41
|
-
tonalButton.innerText = 'Tonal button';
|
|
42
|
-
append(BUTTONS_SECTION, tonalButton);
|
|
43
|
-
|
|
44
|
-
const outlinedButton = new Buttons.Button.Button();
|
|
45
|
-
outlinedButton.data = {
|
|
46
|
-
variant: Buttons.Button.Variant.OUTLINED,
|
|
47
|
-
};
|
|
48
|
-
outlinedButton.innerText = 'Outlined button';
|
|
49
|
-
append(BUTTONS_SECTION, outlinedButton);
|
|
50
|
-
|
|
51
|
-
const textButton = new Buttons.Button.Button();
|
|
52
|
-
textButton.data = {
|
|
53
|
-
variant: Buttons.Button.Variant.TEXT,
|
|
54
|
-
};
|
|
55
|
-
textButton.innerText = 'Text button';
|
|
56
|
-
append(BUTTONS_SECTION, textButton);
|
|
57
|
-
|
|
58
|
-
const iconButton = new Buttons.Button.Button();
|
|
59
|
-
iconButton.data = {
|
|
60
|
-
variant: Buttons.Button.Variant.ICON,
|
|
61
|
-
iconName: 'gear',
|
|
62
|
-
};
|
|
63
|
-
append(BUTTONS_SECTION, iconButton);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Primary buttons
|
|
67
|
-
{
|
|
68
|
-
const primaryDefault = new Buttons.Button.Button();
|
|
69
|
-
primaryDefault.data = {
|
|
70
|
-
variant: Buttons.Button.Variant.PRIMARY,
|
|
71
|
-
};
|
|
72
|
-
primaryDefault.innerText = DEFAULT_TEXT;
|
|
73
|
-
append(PRIMARY_SECTION, primaryDefault);
|
|
74
|
-
|
|
75
|
-
const primaryWithIcon = new Buttons.Button.Button();
|
|
76
|
-
primaryWithIcon.innerText = WITH_ICON_TEXT;
|
|
77
|
-
primaryWithIcon.data = {
|
|
78
|
-
variant: Buttons.Button.Variant.PRIMARY,
|
|
79
|
-
iconName: 'plus',
|
|
80
|
-
};
|
|
81
|
-
append(PRIMARY_SECTION, primaryWithIcon);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Tonal buttons
|
|
85
|
-
{
|
|
86
|
-
const tonalDefault = new Buttons.Button.Button();
|
|
87
|
-
tonalDefault.data = {
|
|
88
|
-
variant: Buttons.Button.Variant.TONAL,
|
|
89
|
-
};
|
|
90
|
-
tonalDefault.innerText = DEFAULT_TEXT;
|
|
91
|
-
append(TONAL_SECTION, tonalDefault);
|
|
92
|
-
|
|
93
|
-
const tonalWithIcon = new Buttons.Button.Button();
|
|
94
|
-
tonalWithIcon.innerText = WITH_ICON_TEXT;
|
|
95
|
-
|
|
96
|
-
tonalWithIcon.data = {
|
|
97
|
-
variant: Buttons.Button.Variant.PRIMARY,
|
|
98
|
-
iconName: 'plus',
|
|
99
|
-
};
|
|
100
|
-
append(TONAL_SECTION, tonalWithIcon);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Outlined buttons
|
|
104
|
-
{
|
|
105
|
-
const outlinedDefault = new Buttons.Button.Button();
|
|
106
|
-
outlinedDefault.data = {
|
|
107
|
-
variant: Buttons.Button.Variant.OUTLINED,
|
|
108
|
-
};
|
|
109
|
-
outlinedDefault.innerText = DEFAULT_TEXT;
|
|
110
|
-
append(OUTLINED_SECTION, outlinedDefault);
|
|
111
|
-
|
|
112
|
-
const outlinedWithIcon = new Buttons.Button.Button();
|
|
113
|
-
outlinedWithIcon.innerText = WITH_ICON_TEXT;
|
|
114
|
-
outlinedWithIcon.data = {
|
|
115
|
-
variant: Buttons.Button.Variant.OUTLINED,
|
|
116
|
-
iconName: 'plus',
|
|
117
|
-
};
|
|
118
|
-
append(OUTLINED_SECTION, outlinedWithIcon);
|
|
119
|
-
|
|
120
|
-
const outlinedMicro = new Buttons.Button.Button();
|
|
121
|
-
outlinedMicro.innerText = MICRO_TEXT;
|
|
122
|
-
outlinedMicro.data = {
|
|
123
|
-
variant: Buttons.Button.Variant.OUTLINED,
|
|
124
|
-
size: Buttons.Button.Size.MICRO,
|
|
125
|
-
};
|
|
126
|
-
append(OUTLINED_SECTION, outlinedMicro);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Text buttons
|
|
130
|
-
{
|
|
131
|
-
const textDefault = new Buttons.Button.Button();
|
|
132
|
-
textDefault.innerText = DEFAULT_TEXT;
|
|
133
|
-
textDefault.data = {
|
|
134
|
-
variant: Buttons.Button.Variant.TEXT,
|
|
135
|
-
};
|
|
136
|
-
append(TEXT_SECTION, textDefault);
|
|
137
|
-
|
|
138
|
-
const textWithIcon = new Buttons.Button.Button();
|
|
139
|
-
textWithIcon.innerText = WITH_ICON_TEXT;
|
|
140
|
-
|
|
141
|
-
textWithIcon.data = {
|
|
142
|
-
variant: Buttons.Button.Variant.TEXT,
|
|
143
|
-
iconName: 'plus',
|
|
144
|
-
};
|
|
145
|
-
append(TEXT_SECTION, textWithIcon);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Icon buttons
|
|
149
|
-
{
|
|
150
|
-
const iconDefault = new Buttons.Button.Button();
|
|
151
|
-
iconDefault.data = {
|
|
152
|
-
variant: Buttons.Button.Variant.ICON,
|
|
153
|
-
iconName: 'gear',
|
|
154
|
-
};
|
|
155
|
-
append(ICON_SECTION, iconDefault);
|
|
156
|
-
|
|
157
|
-
const iconToggle = new Buttons.Button.Button();
|
|
158
|
-
iconToggle.data = {
|
|
159
|
-
variant: Buttons.Button.Variant.ICON_TOGGLE,
|
|
160
|
-
iconName: 'gear',
|
|
161
|
-
toggledIconName: 'gear',
|
|
162
|
-
toggled: true,
|
|
163
|
-
toggleType: Buttons.Button.ToggleType.PRIMARY,
|
|
164
|
-
};
|
|
165
|
-
const toggledWithLabel = document.createElement('span');
|
|
166
|
-
toggledWithLabel.textContent = '(Toggle)';
|
|
167
|
-
append(ICON_SECTION, iconToggle);
|
|
168
|
-
append(ICON_SECTION, toggledWithLabel);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// Floating buttons
|
|
172
|
-
{
|
|
173
|
-
const floatingButton = Buttons.FloatingButton.create('smart-assistant', 'Ask AI!');
|
|
174
|
-
append(FLOATING_SECTION, floatingButton);
|
|
175
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2024 The Chromium Authors
|
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
found in the LICENSE file.
|
|
5
|
-
-->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html>
|
|
8
|
-
<head>
|
|
9
|
-
<meta charset="UTF-8" />
|
|
10
|
-
<meta name="viewport" content="width=device-width" />
|
|
11
|
-
<title>Basic Radio Button example</title>
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
|
|
15
|
-
<div id="container">
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<script type="module" src="./basic.js"></script>
|
|
19
|
-
<style>
|
|
20
|
-
fieldset { label { display: block; } }
|
|
21
|
-
</style>
|
|
22
|
-
</body>
|
|
23
|
-
</html>
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 The Chromium Authors
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
import * as UI from '../../../legacy/legacy.js';
|
|
6
|
-
import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
7
|
-
|
|
8
|
-
await ComponentHelpers.ComponentServerSetup.setup();
|
|
9
|
-
function radioExample({name, tabbable, disabled}: {
|
|
10
|
-
name: string,
|
|
11
|
-
tabbable: boolean,
|
|
12
|
-
disabled: boolean,
|
|
13
|
-
}): HTMLElement {
|
|
14
|
-
const example = document.createElement('fieldset');
|
|
15
|
-
example.style.marginTop = '20px';
|
|
16
|
-
const legend = document.createElement('legend');
|
|
17
|
-
legend.textContent = name;
|
|
18
|
-
const list = document.createElement('div');
|
|
19
|
-
for (let i = 0; i < 3; ++i) {
|
|
20
|
-
const {label, radio} = UI.UIUtils.createRadioButton(name, `Option #${i + 1}`, name);
|
|
21
|
-
radio.tabIndex = tabbable ? 0 : -1;
|
|
22
|
-
radio.disabled = disabled;
|
|
23
|
-
radio.checked = i === 0;
|
|
24
|
-
list.append(label);
|
|
25
|
-
}
|
|
26
|
-
example.append(legend, list);
|
|
27
|
-
return example;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function init(): void {
|
|
31
|
-
const container = document.getElementById('container');
|
|
32
|
-
if (!container) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
container.style.padding = '42px 42px';
|
|
37
|
-
container.style.margin = '42px 42px';
|
|
38
|
-
container.style.border = '1px solid rgb(0 0 0 / 20%)';
|
|
39
|
-
|
|
40
|
-
// Basic
|
|
41
|
-
container.appendChild(radioExample({name: 'basic', tabbable: true, disabled: false}));
|
|
42
|
-
|
|
43
|
-
// Not tab reachable
|
|
44
|
-
container.appendChild(radioExample({name: 'not-table-reachable', tabbable: false, disabled: false}));
|
|
45
|
-
|
|
46
|
-
// Disabled
|
|
47
|
-
container.appendChild(radioExample({name: 'disabled', tabbable: true, disabled: true}));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
init();
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2023 The Chromium Authors
|
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
found in the LICENSE file.
|
|
5
|
-
-->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html>
|
|
8
|
-
|
|
9
|
-
<head>
|
|
10
|
-
<meta charset="UTF-8" />
|
|
11
|
-
<meta name="viewport" content="width=device-width" />
|
|
12
|
-
<title>Select menu example</title>
|
|
13
|
-
</head>
|
|
14
|
-
|
|
15
|
-
<body>
|
|
16
|
-
<script src="./basic.js" type="module"></script>
|
|
17
|
-
</body>
|
|
18
|
-
|
|
19
|
-
</html>
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Chromium Authors
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
import * as UI from '../../../../ui/legacy/legacy.js';
|
|
6
|
-
import * as Lit from '../../../lit/lit.js';
|
|
7
|
-
import * as VisualLogging from '../../../visual_logging/visual_logging.js';
|
|
8
|
-
|
|
9
|
-
const {html} = Lit;
|
|
10
|
-
|
|
11
|
-
function createDivWithP(text: string): HTMLDivElement {
|
|
12
|
-
const div = document.createElement('div');
|
|
13
|
-
div.style.paddingLeft = '25px';
|
|
14
|
-
const p = document.createElement('p');
|
|
15
|
-
p.style.marginLeft = '-25px';
|
|
16
|
-
p.textContent = text;
|
|
17
|
-
div.appendChild(p);
|
|
18
|
-
document.body.appendChild(div);
|
|
19
|
-
return div;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
const simpleMenuHTML = createDivWithP('Simple item select with lit-html');
|
|
24
|
-
Lit.render(
|
|
25
|
-
html`<select id="menu" aria-label="Select an option"
|
|
26
|
-
@change=${onChange}>
|
|
27
|
-
<option hidden>Select an option</option>
|
|
28
|
-
<option id="option-1" jslog=${VisualLogging.item('option-1').track({
|
|
29
|
-
click: true
|
|
30
|
-
})}
|
|
31
|
-
value="Option1">Option 1</option>
|
|
32
|
-
<option jslog=${VisualLogging.item('option-2').track({
|
|
33
|
-
click: true
|
|
34
|
-
})}
|
|
35
|
-
value="Option2">Option 2</option>
|
|
36
|
-
<option disabled jslog=${VisualLogging.item('option-3').track({
|
|
37
|
-
click: true
|
|
38
|
-
})}
|
|
39
|
-
value="Option3">Option 3</option>
|
|
40
|
-
</select>`,
|
|
41
|
-
simpleMenuHTML);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
const groupMenuHTML = createDivWithP('Select with groups with lit-html');
|
|
46
|
-
Lit.render(
|
|
47
|
-
html`<select aria-label="Select an option"
|
|
48
|
-
@change=${onChange}>
|
|
49
|
-
<optgroup label="Group 1">
|
|
50
|
-
<option jslog=${VisualLogging.item('option-1').track({
|
|
51
|
-
click: true
|
|
52
|
-
})}
|
|
53
|
-
value="Option1">Option 1</option>
|
|
54
|
-
</optgroup>
|
|
55
|
-
<optgroup label="Group 2">
|
|
56
|
-
<option jslog=${VisualLogging.item('option-2').track({
|
|
57
|
-
click: true
|
|
58
|
-
})}
|
|
59
|
-
value="Option2">Option 2</option>
|
|
60
|
-
<option jslog=${VisualLogging.item('option-3').track({
|
|
61
|
-
click: true
|
|
62
|
-
})}
|
|
63
|
-
value="Option3">Option 3</option>
|
|
64
|
-
</optgroup>
|
|
65
|
-
</select>`,
|
|
66
|
-
groupMenuHTML);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
{
|
|
70
|
-
const simpleMenuImperative = createDivWithP('Simple item select with imperative API');
|
|
71
|
-
const simpleSelect = UI.UIUtils.createSelect('Select an option', [
|
|
72
|
-
'Option 1',
|
|
73
|
-
'Option 2',
|
|
74
|
-
'Option 3',
|
|
75
|
-
]);
|
|
76
|
-
simpleSelect.addEventListener('change', event => onChange(event));
|
|
77
|
-
simpleMenuImperative.appendChild(simpleSelect);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
{
|
|
81
|
-
const groupMenuImperative = createDivWithP('Select with groups with imperative API');
|
|
82
|
-
const group1 = new Map<string, string[]>([['Group 1', ['Option 1']]]);
|
|
83
|
-
const group2 = new Map<string, string[]>([['Group 2', ['Option 2', 'Option 3']]]);
|
|
84
|
-
const groupSelect = UI.UIUtils.createSelect('Select an option', [group1, group2]);
|
|
85
|
-
groupSelect.addEventListener('change', event => onChange(event));
|
|
86
|
-
groupMenuImperative.appendChild(groupSelect);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function onChange(event: Event): void {
|
|
90
|
-
const menu = event.target;
|
|
91
|
-
if (menu instanceof HTMLSelectElement) {
|
|
92
|
-
// eslint-disable-next-line no-console
|
|
93
|
-
console.log('Option selected: ', menu.value);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2023 The Chromium Authors
|
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
found in the LICENSE file.
|
|
5
|
-
-->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html>
|
|
8
|
-
|
|
9
|
-
<head>
|
|
10
|
-
<meta charset="UTF-8" />
|
|
11
|
-
<meta name="viewport" content="width=device-width" />
|
|
12
|
-
<title>Select menu example</title>
|
|
13
|
-
<style>
|
|
14
|
-
#root {
|
|
15
|
-
padding: 20px;
|
|
16
|
-
width: 80%;
|
|
17
|
-
margin: 0 auto;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
#width-150 {
|
|
21
|
-
width: 150px;
|
|
22
|
-
}
|
|
23
|
-
#width-400 {
|
|
24
|
-
width: 400px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
devtools-select-menu {
|
|
28
|
-
display: block;
|
|
29
|
-
margin: 15px;
|
|
30
|
-
}
|
|
31
|
-
</style>
|
|
32
|
-
</head>
|
|
33
|
-
|
|
34
|
-
<body>
|
|
35
|
-
<div id="root"></div>
|
|
36
|
-
<script src="./wide-option.js" type="module"></script>
|
|
37
|
-
</body>
|
|
38
|
-
</html>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Chromium Authors
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
import * as Menus from '../../../../ui/components/menus/menus.js';
|
|
6
|
-
|
|
7
|
-
const root = document.getElementById('root');
|
|
8
|
-
function makeMenu(id: string): void {
|
|
9
|
-
const items: Menus.Menu.MenuItem[] = [];
|
|
10
|
-
const menu = new Menus.SelectMenu.SelectMenu();
|
|
11
|
-
|
|
12
|
-
const options = [
|
|
13
|
-
{text: 'A short option', value: 'option-1'},
|
|
14
|
-
{text: 'A very long option that has a lot of text', value: 'option-2'},
|
|
15
|
-
{text: 'An average sized option', value: 'option-3'},
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
options.forEach(opt => {
|
|
19
|
-
const item = new Menus.Menu.MenuItem();
|
|
20
|
-
item.value = opt.value;
|
|
21
|
-
item.textContent = opt.text;
|
|
22
|
-
menu.appendChild(item);
|
|
23
|
-
items.push(item);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
menu.addEventListener('selectmenuselected', (event: Menus.SelectMenu.SelectMenuItemSelectedEvent) => {
|
|
27
|
-
items.forEach(item => {
|
|
28
|
-
item.selected = item.value === event.itemValue;
|
|
29
|
-
});
|
|
30
|
-
const selectedOption = options.find(option => option.value === event.itemValue);
|
|
31
|
-
menu.buttonTitle = selectedOption?.text || '';
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
items[1].selected = true;
|
|
35
|
-
menu.buttonTitle = options[1].text;
|
|
36
|
-
menu.showArrow = true;
|
|
37
|
-
menu.id = id;
|
|
38
|
-
|
|
39
|
-
root?.appendChild(menu);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
makeMenu('width-150');
|
|
43
|
-
makeMenu('width-400');
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2025 The Chromium Authors
|
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
found in the LICENSE file.
|
|
5
|
-
-->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html>
|
|
8
|
-
<head>
|
|
9
|
-
<meta charset="UTF-8" />
|
|
10
|
-
<meta name="viewport" content="width=device-width" />
|
|
11
|
-
<title>Spinner example</title>
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
<div id="container"></div>
|
|
15
|
-
<script type="module" src="./basic.js"></script>
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// Copyright 2025 The Chromium Authors
|
|
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 '../../spinners/spinners.js';
|
|
7
|
-
|
|
8
|
-
import * as FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
|
|
9
|
-
import * as Lit from '../../../lit/lit.js';
|
|
10
|
-
import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
11
|
-
|
|
12
|
-
const {html} = Lit;
|
|
13
|
-
|
|
14
|
-
await FrontendHelpers.initializeGlobalVars();
|
|
15
|
-
await ComponentHelpers.ComponentServerSetup.setup();
|
|
16
|
-
const container = document.getElementById('container');
|
|
17
|
-
|
|
18
|
-
if (!container) {
|
|
19
|
-
throw new Error('No component container found.');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
Lit.render(html`<devtools-spinner></devtools-spinner>`, container);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2025 The Chromium Authors
|
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
-
found in the LICENSE file.
|
|
5
|
-
-->
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html>
|
|
8
|
-
<head>
|
|
9
|
-
<meta charset="UTF-8" />
|
|
10
|
-
<meta name="viewport" content="width=device-width" />
|
|
11
|
-
<title>Tooltip example</title>
|
|
12
|
-
</head>
|
|
13
|
-
<body>
|
|
14
|
-
|
|
15
|
-
<div id="container">
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<script type="module" src="./basic.js"></script>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 The Chromium Authors
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
import * as FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
|
|
6
|
-
import * as Lit from '../../../lit/lit.js';
|
|
7
|
-
import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
8
|
-
import {Tooltip} from '../../tooltips/Tooltip.js';
|
|
9
|
-
|
|
10
|
-
const {html} = Lit;
|
|
11
|
-
|
|
12
|
-
await FrontendHelpers.initializeGlobalVars();
|
|
13
|
-
await ComponentHelpers.ComponentServerSetup.setup();
|
|
14
|
-
const container = document.getElementById('container');
|
|
15
|
-
if (!container) {
|
|
16
|
-
throw new Error('No component container found.');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
Lit.render(
|
|
20
|
-
html`
|
|
21
|
-
<div style="position: relative; z-index: 0;">
|
|
22
|
-
<button aria-describedby="simple-tooltip" style="position: absolute; left: 16px; top: 16px;">
|
|
23
|
-
Simple
|
|
24
|
-
</button>
|
|
25
|
-
<devtools-tooltip id="simple-tooltip">Simple content</devtools-tooltip>
|
|
26
|
-
</div>
|
|
27
|
-
<div style="position: relative; z-index: 0;">
|
|
28
|
-
<span
|
|
29
|
-
aria-details="rich-tooltip"
|
|
30
|
-
style="position: absolute; left: 16px; top: 116px; border: 1px solid black;"
|
|
31
|
-
>
|
|
32
|
-
Non-button click trigger
|
|
33
|
-
</span>
|
|
34
|
-
<devtools-tooltip id="rich-tooltip" variant="rich" trigger="click">
|
|
35
|
-
<p>Rich tooltip</p>
|
|
36
|
-
<button>Action</button>
|
|
37
|
-
</devtools-tooltip>
|
|
38
|
-
</div>
|
|
39
|
-
<div>
|
|
40
|
-
<button
|
|
41
|
-
id="removable"
|
|
42
|
-
@click=${() => document.getElementById('removable')?.remove()}
|
|
43
|
-
class="anchor"
|
|
44
|
-
aria-details="programatic"
|
|
45
|
-
style="position: absolute; left: 16px; top: 216px;"
|
|
46
|
-
>
|
|
47
|
-
Click to remove anchor
|
|
48
|
-
</button>
|
|
49
|
-
</div>
|
|
50
|
-
`,
|
|
51
|
-
container);
|
|
52
|
-
|
|
53
|
-
const anchor = container.querySelector('.anchor') as HTMLElement;
|
|
54
|
-
const programmaticTooltip = new Tooltip({id: 'programatic', variant: 'rich', anchor});
|
|
55
|
-
programmaticTooltip.append('Text content');
|
|
56
|
-
anchor.insertAdjacentElement('afterend', programmaticTooltip);
|
|
57
|
-
|
|
58
|
-
// Make the buttons draggable, so that we can experiment with the position of the tooltip.
|
|
59
|
-
container.querySelectorAll('button,span').forEach(anchor => draggable(anchor as HTMLElement));
|
|
60
|
-
function draggable(element: HTMLElement|null): void {
|
|
61
|
-
if (!element) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
element.addEventListener('mousedown', event => {
|
|
65
|
-
const target = event.target as HTMLElement;
|
|
66
|
-
const offsetX = event.clientX - target.getBoundingClientRect().left;
|
|
67
|
-
const offsetY = event.clientY - target.getBoundingClientRect().top;
|
|
68
|
-
|
|
69
|
-
function onMouseMove(event: MouseEvent) {
|
|
70
|
-
target.style.left = `${event.clientX - offsetX}px`;
|
|
71
|
-
target.style.top = `${event.clientY - offsetY}px`;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function onMouseUp() {
|
|
75
|
-
document.removeEventListener('mousemove', onMouseMove);
|
|
76
|
-
document.removeEventListener('mouseup', onMouseUp);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
document.addEventListener('mousemove', onMouseMove);
|
|
80
|
-
document.addEventListener('mouseup', onMouseUp);
|
|
81
|
-
});
|
|
82
|
-
}
|