chrome-devtools-frontend 1.0.1542501 → 1.0.1543472
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/AUTHORS +1 -0
- package/front_end/core/common/Gzip.ts +4 -4
- package/front_end/core/common/common.ts +0 -2
- package/front_end/core/host/InspectorFrontendHost.ts +0 -3
- package/front_end/core/root/DevToolsContext.ts +60 -0
- package/front_end/core/root/Runtime.ts +0 -10
- package/front_end/core/root/root.ts +6 -1
- package/front_end/core/sdk/NetworkManager.ts +0 -7
- package/front_end/core/sdk/NetworkRequest.ts +0 -10
- package/front_end/core/sdk/TargetManager.ts +5 -6
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +1 -13
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +5 -5
- package/front_end/entrypoints/main/MainImpl.ts +3 -5
- package/front_end/entrypoints/main/main-meta.ts +1 -5
- package/front_end/foundation/Universe.ts +13 -1
- package/front_end/generated/Deprecation.ts +0 -14
- package/front_end/generated/InspectorBackendCommands.ts +1 -1
- package/front_end/generated/protocol.ts +0 -1
- package/front_end/models/ai_assistance/BuiltInAi.ts +13 -7
- package/front_end/models/bindings/CompilerScriptMapping.ts +3 -2
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +14 -9
- package/front_end/models/trace/handlers/SamplesHandler.ts +64 -6
- package/front_end/models/trace/types/TraceEvents.ts +16 -0
- package/front_end/models/workspace/IgnoreListManager.ts +10 -9
- package/front_end/models/workspace/WorkspaceImpl.ts +5 -10
- package/front_end/panels/application/ApplicationPanelSidebar.ts +0 -1
- package/front_end/panels/application/OpenedWindowDetailsView.ts +0 -2
- package/front_end/panels/application/ServiceWorkersView.ts +0 -2
- package/front_end/panels/application/StorageView.ts +0 -1
- package/front_end/panels/application/components/BackForwardCacheView.ts +12 -9
- package/front_end/panels/application/components/FrameDetailsView.ts +468 -447
- package/front_end/panels/console/ConsolePrompt.ts +1 -1
- package/front_end/panels/console/ConsoleView.ts +12 -7
- package/front_end/panels/console/ConsoleViewMessage.ts +19 -9
- package/front_end/panels/explain/components/ConsoleInsight.ts +314 -310
- package/front_end/panels/network/NetworkDataGridNode.ts +0 -7
- package/front_end/panels/network/NetworkLogView.ts +1 -45
- package/front_end/panels/security/SecurityPanel.ts +0 -2
- package/front_end/panels/security/SecurityPanelSidebar.ts +0 -16
- package/front_end/panels/security/security.ts +0 -2
- package/front_end/panels/settings/SettingsScreen.ts +3 -6
- package/front_end/panels/settings/components/SyncSection.ts +218 -226
- package/front_end/panels/settings/components/syncSection.css +81 -80
- package/front_end/panels/sources/DebuggerPlugin.ts +3 -1
- package/front_end/panels/sources/ResourceOriginPlugin.ts +7 -3
- package/front_end/panels/timeline/TimelinePanel.ts +0 -21
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/docs/component_docs.ts +0 -4
- package/front_end/ui/components/expandable_list/ExpandableList.docs.ts +30 -0
- package/front_end/ui/components/report_view/ReportView.ts +4 -1
- package/front_end/ui/legacy/ReportView.ts +0 -5
- package/front_end/ui/legacy/TextPrompt.ts +65 -19
- package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +8 -4
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +90 -92
- package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +114 -184
- package/front_end/ui/legacy/components/utils/Linkifier.ts +46 -2
- package/front_end/ui/{components/docs/theme_colors/basic.ts → legacy/theme_support/ThemeColors.docs.ts} +33 -23
- package/package.json +1 -1
- package/front_end/core/common/QueryParamHandler.ts +0 -7
- package/front_end/panels/security/IPProtectionTreeElement.ts +0 -21
- package/front_end/panels/security/IPProtectionView.ts +0 -287
- package/front_end/ui/components/docs/expandable_list/basic.html +0 -24
- package/front_end/ui/components/docs/expandable_list/basic.ts +0 -30
- package/front_end/ui/components/docs/input/basic.html +0 -31
- package/front_end/ui/components/docs/input/basic.ts +0 -12
- package/front_end/ui/components/docs/report/basic.html +0 -27
- package/front_end/ui/components/docs/report/basic.ts +0 -48
- package/front_end/ui/components/docs/text_prompt/basic.html +0 -35
- package/front_end/ui/components/docs/text_prompt/basic.ts +0 -19
- package/front_end/ui/components/docs/theme_colors/basic.html +0 -56
- package/front_end/ui/components/docs/toggle_dark_mode.ts +0 -36
- package/front_end/ui/components/docs/toggle_fonts.ts +0 -74
- package/front_end/ui/components/docs/user_agent_client_hints/basic.html +0 -25
- package/front_end/ui/components/docs/user_agent_client_hints/basic.ts +0 -26
|
@@ -4,63 +4,65 @@
|
|
|
4
4
|
* found in the LICENSE file.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
@scope to (devtools-widget > *) {
|
|
8
|
+
:scope {
|
|
9
|
+
break-inside: avoid;
|
|
10
|
+
display: block;
|
|
11
|
+
width: 100%;
|
|
12
|
+
position: relative;
|
|
13
|
+
}
|
|
13
14
|
|
|
14
|
-
fieldset {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
15
|
+
fieldset {
|
|
16
|
+
border: 0;
|
|
17
|
+
padding: 0;
|
|
18
|
+
padding: 4px 0 0;
|
|
19
|
+
}
|
|
19
20
|
|
|
20
|
-
.link {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
21
|
+
.link {
|
|
22
|
+
color: var(--sys-color-primary);
|
|
23
|
+
text-decoration: underline;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
outline-offset: 2px;
|
|
26
|
+
}
|
|
26
27
|
|
|
27
|
-
.account-avatar {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
28
|
+
.account-avatar {
|
|
29
|
+
border: 0;
|
|
30
|
+
border-radius: var(--sys-shape-corner-full);
|
|
31
|
+
display: block;
|
|
32
|
+
height: var(--sys-size-9);
|
|
33
|
+
width: var(--sys-size-9);
|
|
34
|
+
}
|
|
34
35
|
|
|
35
|
-
.account-info {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
36
|
+
.account-info {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
}
|
|
39
40
|
|
|
40
|
-
.account-email {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
41
|
+
.account-email {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
margin-left: 8px;
|
|
45
|
+
}
|
|
45
46
|
|
|
46
|
-
.not-signed-in {
|
|
47
|
-
|
|
48
|
-
}
|
|
47
|
+
.not-signed-in {
|
|
48
|
+
padding-bottom: 4px;
|
|
49
|
+
}
|
|
49
50
|
|
|
50
|
-
.setting-checkbox-container {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
51
|
+
.setting-checkbox-container {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
gap: var(--sys-size-2);
|
|
55
|
+
}
|
|
55
56
|
|
|
56
|
-
.setting-checkbox {
|
|
57
|
-
|
|
58
|
-
}
|
|
57
|
+
.setting-checkbox {
|
|
58
|
+
display: inline-block;
|
|
59
|
+
}
|
|
59
60
|
|
|
60
|
-
.gdp-profile-container {
|
|
61
|
-
|
|
61
|
+
.gdp-profile-container {
|
|
62
|
+
padding-bottom: var(--sys-size-4);
|
|
63
|
+
}
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
.gdp-profile-container .divider {
|
|
64
66
|
left: 0;
|
|
65
67
|
position: absolute;
|
|
66
68
|
width: 100%;
|
|
@@ -68,57 +70,56 @@ fieldset {
|
|
|
68
70
|
background: var(--sys-color-divider);
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
.gdp-profile-container .gdp-profile-header {
|
|
72
74
|
display: flex;
|
|
73
75
|
align-items: center;
|
|
74
76
|
gap: var(--sys-size-5);
|
|
75
77
|
font-family: "Google Sans", system-ui;
|
|
76
78
|
font-size: var(--sys-typescale-body3-size);
|
|
77
79
|
height: var(--sys-size-11);
|
|
80
|
+
}
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
.gdp-profile-container .gdp-profile-header .gdp-logo {
|
|
83
|
+
background-image: var(--image-file-gdp-logo-light);
|
|
84
|
+
background-size: contain;
|
|
85
|
+
width: 203px;
|
|
86
|
+
height: 18px;
|
|
87
|
+
background-repeat: no-repeat;
|
|
88
|
+
}
|
|
86
89
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
+
:host-context(.theme-with-dark-background) & .gdp-profile-container .gdp-profile-header .gdp-logo {
|
|
91
|
+
background-image: var(--image-file-gdp-logo-dark);
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
.gdp-profile-container .gdp-profile-sign-up-content {
|
|
93
95
|
padding-top: var(--sys-size-7);
|
|
94
96
|
display: flex;
|
|
95
97
|
justify-content: space-between;
|
|
96
98
|
align-items: center;
|
|
97
99
|
}
|
|
98
100
|
|
|
99
|
-
|
|
101
|
+
.gdp-profile-container .gdp-profile-details-content {
|
|
100
102
|
padding-top: var(--sys-size-7);
|
|
101
103
|
font: var(--sys-typescale-body4-regular);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.gdp-profile-container .gdp-profile-details-content .plan-details {
|
|
107
|
+
margin-top: var(--sys-size-3);
|
|
108
|
+
height: 18px;
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.gdp-profile-container .gdp-profile-details-content .setting-container {
|
|
114
|
+
margin: calc(var(--sys-size-3) - 6px) 0 -6px;
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
gap: var(--sys-size-2);
|
|
118
|
+
}
|
|
102
119
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
align-items: center;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
& .setting-container {
|
|
111
|
-
/* `<settigns-checkbox>` already provides 6px margin and we want to get rid of it here */
|
|
112
|
-
margin: calc(var(--sys-size-3) - 6px) -6px -6px;
|
|
113
|
-
display: flex;
|
|
114
|
-
align-items: center;
|
|
115
|
-
gap: var(--sys-size-2);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
& .tooltip-content {
|
|
119
|
-
max-width: 278px;
|
|
120
|
-
padding: var(--sys-size-2) var(--sys-size-3);
|
|
121
|
-
font: var(--sys-typescale-body5-regular);
|
|
122
|
-
}
|
|
120
|
+
.gdp-profile-container .gdp-profile-details-content .tooltip-content {
|
|
121
|
+
max-width: 278px;
|
|
122
|
+
padding: var(--sys-size-2) var(--sys-size-3);
|
|
123
|
+
font: var(--sys-typescale-body5-regular);
|
|
123
124
|
}
|
|
124
125
|
}
|
|
@@ -24,6 +24,7 @@ import * as Tooltips from '../../ui/components/tooltips/tooltips.js';
|
|
|
24
24
|
import * as ObjectUI from '../../ui/legacy/components/object_ui/object_ui.js';
|
|
25
25
|
import * as SourceFrame from '../../ui/legacy/components/source_frame/source_frame.js';
|
|
26
26
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
27
|
+
import {render} from '../../ui/lit/lit.js';
|
|
27
28
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
28
29
|
|
|
29
30
|
import {AddDebugInfoURLDialog} from './AddSourceMapURLDialog.js';
|
|
@@ -2004,7 +2005,8 @@ class ValueDecoration extends CodeMirror.WidgetType {
|
|
|
2004
2005
|
const propertyCount = value.preview ? value.preview.properties.length : 0;
|
|
2005
2006
|
const entryCount = value.preview?.entries ? value.preview.entries.length : 0;
|
|
2006
2007
|
if (value.preview && propertyCount + entryCount < 10) {
|
|
2007
|
-
|
|
2008
|
+
/* eslint-disable-next-line @devtools/no-lit-render-outside-of-view */
|
|
2009
|
+
render(formatter.renderObjectPreview(value.preview), nameValuePair.createChild('span'));
|
|
2008
2010
|
} else {
|
|
2009
2011
|
const propertyValue = ObjectUI.ObjectPropertiesSection.ObjectPropertiesSection.createPropertyValue(
|
|
2010
2012
|
value, /* wasThrown */ false, /* showPreview */ false);
|
|
@@ -28,6 +28,8 @@ const str_ = i18n.i18n.registerUIStrings('panels/sources/ResourceOriginPlugin.ts
|
|
|
28
28
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
29
29
|
|
|
30
30
|
export class ResourceOriginPlugin extends Plugin {
|
|
31
|
+
readonly #linkifier = new Components.Linkifier.Linkifier();
|
|
32
|
+
|
|
31
33
|
static override accepts(uiSourceCode: Workspace.UISourceCode.UISourceCode): boolean {
|
|
32
34
|
const contentType = uiSourceCode.contentType();
|
|
33
35
|
return contentType.hasScripts() || contentType.isFromSourceMap();
|
|
@@ -69,13 +71,15 @@ export class ResourceOriginPlugin extends Plugin {
|
|
|
69
71
|
// Handle anonymous scripts with an originStackTrace.
|
|
70
72
|
for (const script of debuggerWorkspaceBinding.scriptsForUISourceCode(this.uiSourceCode)) {
|
|
71
73
|
if (script.originStackTrace?.callFrames.length) {
|
|
72
|
-
const link = linkifier.linkifyStackTraceTopFrame(script.debuggerModel.target(), script.originStackTrace);
|
|
74
|
+
const link = this.#linkifier.linkifyStackTraceTopFrame(script.debuggerModel.target(), script.originStackTrace);
|
|
73
75
|
return [new UI.Toolbar.ToolbarItem(uiI18n.getFormatLocalizedString(str_, UIStrings.fromS, {PH1: link}))];
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
return [];
|
|
78
80
|
}
|
|
79
|
-
}
|
|
80
81
|
|
|
81
|
-
|
|
82
|
+
override dispose(): void {
|
|
83
|
+
this.#linkifier.dispose();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -3201,27 +3201,6 @@ export interface TimelineModeViewDelegate {
|
|
|
3201
3201
|
highlightEvent(event: Trace.Types.Events.Event|null): void;
|
|
3202
3202
|
}
|
|
3203
3203
|
|
|
3204
|
-
export let loadTimelineHandlerInstance: LoadTimelineHandler;
|
|
3205
|
-
|
|
3206
|
-
export class LoadTimelineHandler implements Common.QueryParamHandler.QueryParamHandler {
|
|
3207
|
-
static instance(opts: {
|
|
3208
|
-
forceNew: boolean|null,
|
|
3209
|
-
} = {forceNew: null}): LoadTimelineHandler {
|
|
3210
|
-
const {forceNew} = opts;
|
|
3211
|
-
if (!loadTimelineHandlerInstance || forceNew) {
|
|
3212
|
-
loadTimelineHandlerInstance = new LoadTimelineHandler();
|
|
3213
|
-
}
|
|
3214
|
-
|
|
3215
|
-
return loadTimelineHandlerInstance;
|
|
3216
|
-
}
|
|
3217
|
-
|
|
3218
|
-
handleQueryParam(value: string): void {
|
|
3219
|
-
void UI.ViewManager.ViewManager.instance().showView('timeline').then(async () => {
|
|
3220
|
-
await TimelinePanel.instance().loadFromURL(window.decodeURIComponent(value) as Platform.DevToolsPath.UrlString);
|
|
3221
|
-
});
|
|
3222
|
-
}
|
|
3223
|
-
}
|
|
3224
|
-
|
|
3225
3204
|
export class TraceRevealer implements Common.Revealer.Revealer<SDK.TraceObject.TraceObject> {
|
|
3226
3205
|
async reveal(trace: SDK.TraceObject.TraceObject): Promise<void> {
|
|
3227
3206
|
await UI.ViewManager.ViewManager.instance().showView('timeline');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Name: Dependencies sourced from the upstream `chromium` repository
|
|
2
2
|
URL: https://chromium.googlesource.com/chromium/src
|
|
3
3
|
Version: N/A
|
|
4
|
-
Revision:
|
|
4
|
+
Revision: 3e8720c1c3a43f134e2008e1764e70380a5b8bc1
|
|
5
5
|
Update Mechanism: Manual (https://crbug.com/428069060)
|
|
6
6
|
License: BSD-3-Clause
|
|
7
7
|
License File: LICENSE
|
|
@@ -6,12 +6,8 @@
|
|
|
6
6
|
import '../../../Images/Images.js';
|
|
7
7
|
|
|
8
8
|
import * as CreateBreadcrumbs from './create_breadcrumbs.js';
|
|
9
|
-
import * as ToggleDarkMode from './toggle_dark_mode.js';
|
|
10
|
-
import * as ToggleFonts from './toggle_fonts.js';
|
|
11
9
|
|
|
12
|
-
ToggleDarkMode.init();
|
|
13
10
|
CreateBreadcrumbs.init();
|
|
14
|
-
ToggleFonts.init();
|
|
15
11
|
|
|
16
12
|
// This can be used by tests to hide the UI elements that are part of the component docs interface.
|
|
17
13
|
// E.g., this is useful for screenshot tests.
|
|
@@ -0,0 +1,30 @@
|
|
|
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 Lit from '../../lit/lit.js';
|
|
6
|
+
|
|
7
|
+
import {ExpandableList} from './expandable_list.js';
|
|
8
|
+
|
|
9
|
+
const {html} = Lit;
|
|
10
|
+
|
|
11
|
+
export function render(container: HTMLElement): void {
|
|
12
|
+
const component = new ExpandableList.ExpandableList();
|
|
13
|
+
|
|
14
|
+
const rows = [];
|
|
15
|
+
rows.push(html`
|
|
16
|
+
<div>This is row 1. Click on the triangle icon to expand.</div>
|
|
17
|
+
`);
|
|
18
|
+
|
|
19
|
+
for (let rowNumber = 2; rowNumber < 11; rowNumber++) {
|
|
20
|
+
rows.push(html`
|
|
21
|
+
<div>This is row ${rowNumber}.</div>
|
|
22
|
+
`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
component.data = {
|
|
26
|
+
rows,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
container.appendChild(component);
|
|
30
|
+
}
|
|
@@ -29,11 +29,14 @@ import reportValueStyles from './reportValue.css.js';
|
|
|
29
29
|
* <devtools-report-divider></devtools-report-divider>
|
|
30
30
|
* </devtools-report>
|
|
31
31
|
* ```
|
|
32
|
-
* The component is intended to replace UI.ReportView in an idiomatic way.
|
|
33
32
|
*/
|
|
34
33
|
export interface ReportData {
|
|
35
34
|
reportTitle: string;
|
|
36
35
|
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use UI.ReportView.ReportView instead.
|
|
39
|
+
*/
|
|
37
40
|
export class Report extends HTMLElement {
|
|
38
41
|
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
39
42
|
#reportTitle = '';
|
|
@@ -13,11 +13,6 @@ import reportViewStyles from './reportView.css.js';
|
|
|
13
13
|
import type {Toolbar} from './Toolbar.js';
|
|
14
14
|
import {Tooltip} from './Tooltip.js';
|
|
15
15
|
import {VBox} from './Widget.js';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Please consider using the web component version of this widget
|
|
19
|
-
* (`ui/components/report_view/ReportView.ts`) for new code.
|
|
20
|
-
*/
|
|
21
16
|
export class ReportView extends VBox {
|
|
22
17
|
private readonly contentBox: HTMLElement;
|
|
23
18
|
private headerElement: HTMLElement;
|
|
@@ -57,50 +57,87 @@ import {cloneCustomElement, ElementFocusRestorer} from './UIUtils.js';
|
|
|
57
57
|
*
|
|
58
58
|
* @property completionTimeout Sets the delay for showing the autocomplete suggestion box.
|
|
59
59
|
* @event commit Editing is done and the result was accepted.
|
|
60
|
-
* @event
|
|
60
|
+
* @event cancel Editing was canceled.
|
|
61
61
|
* @event beforeautocomplete This is sent before the autocomplete suggestion box is triggered and before the <datalist>
|
|
62
62
|
* is read.
|
|
63
63
|
* @attribute editing Setting/removing this attribute starts/stops editing.
|
|
64
64
|
* @attribute completions Sets the `id` of the <datalist> containing the autocomplete options.
|
|
65
|
+
* @attribute placeholder Sets a placeholder that's shown in place of the text contents when editing if the text is too
|
|
66
|
+
* large.
|
|
65
67
|
*/
|
|
66
68
|
export class TextPromptElement extends HTMLElement {
|
|
67
|
-
static readonly observedAttributes = ['editing', 'completions'];
|
|
69
|
+
static readonly observedAttributes = ['editing', 'completions', 'placeholder'];
|
|
68
70
|
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
69
71
|
readonly #entrypoint = this.#shadow.createChild('span');
|
|
70
72
|
readonly #slot = this.#entrypoint.createChild('slot');
|
|
71
73
|
readonly #textPrompt = new TextPrompt();
|
|
72
74
|
#completionTimeout: number|null = null;
|
|
75
|
+
#completionObserver = new MutationObserver(this.#onMutate.bind(this));
|
|
73
76
|
|
|
74
77
|
constructor() {
|
|
75
78
|
super();
|
|
76
79
|
this.#textPrompt.initialize(this.#willAutoComplete.bind(this));
|
|
77
80
|
}
|
|
78
81
|
|
|
82
|
+
#onMutate(changes: MutationRecord[]): void {
|
|
83
|
+
const listId = this.getAttribute('completions');
|
|
84
|
+
if (!listId) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const checkIfNodeIsInCompletionList = (node: Node): boolean => {
|
|
88
|
+
if (node instanceof HTMLDataListElement) {
|
|
89
|
+
return node.id === listId;
|
|
90
|
+
}
|
|
91
|
+
if (node instanceof HTMLOptionElement) {
|
|
92
|
+
return Boolean(node.parentElement && checkIfNodeIsInCompletionList(node.parentElement));
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
};
|
|
96
|
+
const affectsCompletionList = (change: MutationRecord): boolean =>
|
|
97
|
+
change.addedNodes.values().some(checkIfNodeIsInCompletionList) ||
|
|
98
|
+
change.removedNodes.values().some(checkIfNodeIsInCompletionList) ||
|
|
99
|
+
checkIfNodeIsInCompletionList(change.target);
|
|
100
|
+
|
|
101
|
+
if (changes.some(affectsCompletionList)) {
|
|
102
|
+
this.#updateCompletions();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
79
106
|
attributeChangedCallback(name: string, oldValue: string|null, newValue: string|null): void {
|
|
80
|
-
if (oldValue === newValue
|
|
107
|
+
if (oldValue === newValue) {
|
|
81
108
|
return;
|
|
82
109
|
}
|
|
83
110
|
|
|
84
111
|
switch (name) {
|
|
85
112
|
case 'editing':
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
113
|
+
if (this.isConnected) {
|
|
114
|
+
if (newValue !== null && newValue !== 'false' && oldValue === null) {
|
|
115
|
+
this.#startEditing();
|
|
116
|
+
} else {
|
|
117
|
+
this.#stopEditing();
|
|
118
|
+
}
|
|
90
119
|
}
|
|
91
120
|
break;
|
|
92
121
|
case 'completions':
|
|
93
|
-
if (this
|
|
94
|
-
|
|
122
|
+
if (this.getAttribute('completions')) {
|
|
123
|
+
this.#completionObserver.observe(this, {childList: true, subtree: true});
|
|
124
|
+
this.#updateCompletions();
|
|
125
|
+
} else {
|
|
126
|
+
this.#textPrompt.clearAutocomplete();
|
|
127
|
+
this.#completionObserver.disconnect();
|
|
95
128
|
}
|
|
96
129
|
break;
|
|
97
130
|
}
|
|
98
131
|
}
|
|
99
132
|
|
|
100
|
-
|
|
101
|
-
if (
|
|
102
|
-
this.
|
|
133
|
+
#updateCompletions(): void {
|
|
134
|
+
if (this.isConnected) {
|
|
135
|
+
void this.#textPrompt.complete(/* force=*/ true);
|
|
103
136
|
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async #willAutoComplete(expression: string, filter: string, force: boolean): Promise<Suggestion[]> {
|
|
140
|
+
this.dispatchEvent(new TextPromptElement.BeforeAutoCompleteEvent({expression, filter, force}));
|
|
104
141
|
|
|
105
142
|
const listId = this.getAttribute('completions');
|
|
106
143
|
if (!listId) {
|
|
@@ -112,16 +149,20 @@ export class TextPromptElement extends HTMLElement {
|
|
|
112
149
|
return [];
|
|
113
150
|
}
|
|
114
151
|
|
|
115
|
-
filter = filter?.toLowerCase();
|
|
116
152
|
return datalist.values()
|
|
117
|
-
.filter(option => option.textContent.startsWith(filter
|
|
153
|
+
.filter(option => option.textContent.startsWith(filter.toLowerCase()))
|
|
118
154
|
.map(option => ({text: option.textContent}))
|
|
119
155
|
.toArray();
|
|
120
156
|
}
|
|
121
157
|
|
|
122
158
|
#startEditing(): void {
|
|
159
|
+
const truncatedTextPlaceholder = this.getAttribute('placeholder');
|
|
123
160
|
const placeholder = this.#entrypoint.createChild('span');
|
|
124
|
-
|
|
161
|
+
if (truncatedTextPlaceholder === null) {
|
|
162
|
+
placeholder.textContent = this.#slot.deepInnerText();
|
|
163
|
+
} else {
|
|
164
|
+
placeholder.setTextContentTruncatedIfNeeded(this.#slot.deepInnerText(), truncatedTextPlaceholder);
|
|
165
|
+
}
|
|
125
166
|
this.#slot.remove();
|
|
126
167
|
|
|
127
168
|
const proxy = this.#textPrompt.attachAndStartEditing(placeholder, e => this.#done(e, /* commit=*/ true));
|
|
@@ -189,8 +230,8 @@ export namespace TextPromptElement {
|
|
|
189
230
|
super('cancel');
|
|
190
231
|
}
|
|
191
232
|
}
|
|
192
|
-
export class BeforeAutoCompleteEvent extends CustomEvent<{expression
|
|
193
|
-
constructor(detail: {expression
|
|
233
|
+
export class BeforeAutoCompleteEvent extends CustomEvent<{expression: string, filter: string, force: boolean}> {
|
|
234
|
+
constructor(detail: {expression: string, filter: string, force: boolean}) {
|
|
194
235
|
super('beforeautocomplete', {detail});
|
|
195
236
|
}
|
|
196
237
|
}
|
|
@@ -215,7 +256,12 @@ export class TextPrompt extends Common.ObjectWrapper.ObjectWrapper<EventTypes> i
|
|
|
215
256
|
private completionRequestId: number;
|
|
216
257
|
private ghostTextElement: HTMLSpanElement;
|
|
217
258
|
private leftParenthesesIndices: number[];
|
|
218
|
-
private loadCompletions!: (
|
|
259
|
+
private loadCompletions!: (
|
|
260
|
+
this: null,
|
|
261
|
+
arg1: string,
|
|
262
|
+
arg2: string,
|
|
263
|
+
arg3: boolean,
|
|
264
|
+
) => Promise<Suggestion[]>;
|
|
219
265
|
private completionStopCharacters!: string;
|
|
220
266
|
private usesSuggestionBuilder!: boolean;
|
|
221
267
|
#element?: Element;
|
|
@@ -251,7 +297,7 @@ export class TextPrompt extends Common.ObjectWrapper.ObjectWrapper<EventTypes> i
|
|
|
251
297
|
}
|
|
252
298
|
|
|
253
299
|
initialize(
|
|
254
|
-
completions: (this: null, expression: string, filter: string, force
|
|
300
|
+
completions: (this: null, expression: string, filter: string, force: boolean) => Promise<Suggestion[]>,
|
|
255
301
|
stopCharacters?: string, usesSuggestionBuilder?: boolean): void {
|
|
256
302
|
this.loadCompletions = completions;
|
|
257
303
|
this.completionStopCharacters = stopCharacters || ' =:[({;,!+-*/&|^<>.';
|
|
@@ -7,6 +7,7 @@ import * as SDK from '../../../../core/sdk/sdk.js';
|
|
|
7
7
|
import * as Formatter from '../../../../models/formatter/formatter.js';
|
|
8
8
|
import * as SourceMapScopes from '../../../../models/source_map_scopes/source_map_scopes.js';
|
|
9
9
|
import * as Acorn from '../../../../third_party/acorn/acorn.js';
|
|
10
|
+
import {render} from '../../../lit/lit.js';
|
|
10
11
|
import * as UI from '../../legacy.js';
|
|
11
12
|
|
|
12
13
|
import {RemoteObjectPreviewFormatter} from './RemoteObjectPreviewFormatter.js';
|
|
@@ -103,11 +104,14 @@ export class JavaScriptREPL {
|
|
|
103
104
|
const formatter = new RemoteObjectPreviewFormatter();
|
|
104
105
|
const {preview, type, subtype, className, description} = result.object;
|
|
105
106
|
if (preview && type === 'object' && subtype !== 'node' && subtype !== 'trustedtype') {
|
|
106
|
-
|
|
107
|
+
/* eslint-disable-next-line @devtools/no-lit-render-outside-of-view */
|
|
108
|
+
render(formatter.renderObjectPreview(preview), fragment);
|
|
107
109
|
} else {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
/* eslint-disable-next-line @devtools/no-lit-render-outside-of-view */
|
|
111
|
+
render(
|
|
112
|
+
formatter.renderPropertyPreview(
|
|
113
|
+
type, subtype, className, Platform.StringUtilities.trimEndWithMaxLength(description || '', 400)),
|
|
114
|
+
fragment);
|
|
111
115
|
}
|
|
112
116
|
return fragment;
|
|
113
117
|
}
|