chrome-devtools-frontend 1.0.1583146 → 1.0.1585664
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/front_end/core/host/InspectorFrontendHostAPI.ts +1 -0
- package/front_end/core/host/InspectorFrontendHostStub.ts +2 -0
- package/front_end/core/root/Runtime.ts +12 -6
- package/front_end/core/sdk/CSSMatchedStyles.ts +3 -0
- package/front_end/core/sdk/CSSMetadata.ts +3 -0
- package/front_end/entrypoints/main/MainImpl.ts +1 -0
- package/front_end/generated/Deprecation.ts +21 -0
- package/front_end/generated/InspectorBackendCommands.ts +5 -3
- package/front_end/generated/SupportedCSSProperties.js +10 -4
- package/front_end/generated/protocol-mapping.d.ts +2 -1
- package/front_end/generated/protocol-proxy-api.d.ts +2 -1
- package/front_end/generated/protocol.ts +14 -0
- package/front_end/models/ai_assistance/AiConversation.ts +34 -2
- package/front_end/models/ai_assistance/BuiltInAi.ts +1 -2
- package/front_end/models/ai_assistance/agents/AiAgent.ts +3 -10
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +17 -9
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +0 -24
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +12 -0
- package/front_end/models/ai_code_generation/AiCodeGeneration.ts +5 -0
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +16 -8
- package/front_end/models/computed_style/ComputedStyleModel.ts +20 -15
- package/front_end/models/greendev/Prototypes.ts +1 -5
- package/front_end/models/issues_manager/CorsIssue.ts +2 -9
- package/front_end/models/issues_manager/descriptions/corsLocalNetworkAccessPermissionDenied.md +2 -2
- package/front_end/models/javascript_metadata/NativeFunctions.js +20 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +13 -36
- package/front_end/panels/ai_assistance/components/ChatInput.ts +73 -95
- package/front_end/panels/ai_assistance/components/ChatView.ts +13 -2
- package/front_end/panels/application/FrameDetailsView.ts +4 -9
- package/front_end/panels/common/AiCodeGenerationTeaser.ts +10 -0
- package/front_end/panels/console/ConsoleView.ts +1 -2
- package/front_end/panels/console/ConsoleViewMessage.ts +19 -12
- package/front_end/panels/elements/ComputedStyleWidget.ts +41 -21
- package/front_end/panels/elements/ElementsPanel.ts +18 -5
- package/front_end/panels/elements/ElementsTreeElement.ts +173 -169
- package/front_end/panels/elements/NodeStackTraceWidget.ts +3 -13
- package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +69 -0
- package/front_end/panels/elements/computedStyleWidget.css +1 -6
- package/front_end/panels/elements/elements.ts +3 -1
- package/front_end/panels/issues/AffectedResourcesView.ts +1 -2
- package/front_end/panels/network/NetworkDataGridNode.ts +0 -8
- package/front_end/panels/network/RequestConditionsDrawer.ts +138 -112
- package/front_end/panels/network/RequestInitiatorView.ts +2 -10
- package/front_end/panels/settings/SettingsScreen.ts +12 -4
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +6 -9
- package/front_end/panels/sources/CallStackSidebarPane.ts +4 -6
- package/front_end/panels/sources/DebuggerPlugin.ts +2 -1
- package/front_end/panels/sources/GoToLineQuickOpen.ts +0 -4
- package/front_end/panels/sources/OpenFileQuickOpen.ts +0 -4
- package/front_end/panels/sources/OutlineQuickOpen.ts +0 -4
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -1
- package/front_end/panels/sources/sources-meta.ts +9 -6
- package/front_end/panels/timeline/TimelineFlameChartView.ts +0 -12
- package/front_end/panels/timeline/TimelinePanel.ts +35 -15
- package/front_end/panels/timeline/TimelineUIUtils.ts +2 -6
- package/front_end/panels/timeline/components/Sidebar.ts +21 -0
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +1 -20
- package/front_end/panels/timeline/components/insights/InsightRenderer.ts +0 -1
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +2 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/encoding.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/encoding.js +5 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/encoding.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +8 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +2 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/encoding.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/encoding.js +5 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/encoding.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/package.json +4 -4
- package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +4 -3
- package/front_end/third_party/puppeteer/package/src/revisions.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/util/encoding.ts +5 -3
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +3 -0
- package/front_end/ui/components/linkifier/LinkifierUtils.ts +3 -0
- package/front_end/ui/components/text_editor/AiCodeGenerationParser.ts +29 -7
- package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +34 -18
- package/front_end/ui/legacy/InspectorView.ts +41 -15
- package/front_end/ui/legacy/UIUtils.ts +30 -6
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +4 -3
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +2 -1
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +8 -2
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +8 -8
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +20 -150
- package/front_end/ui/legacy/components/utils/Linkifier.ts +120 -87
- package/front_end/ui/legacy/components/utils/jsUtils.css +0 -9
- package/front_end/ui/legacy/legacy.ts +0 -2
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/mcp/HostBindings.ts +3 -0
- package/package.json +1 -1
- package/front_end/models/issues_manager/descriptions/corsInsecurePrivateNetwork.md +0 -10
- package/front_end/models/issues_manager/descriptions/corsPreflightAllowPrivateNetworkError.md +0 -10
- package/front_end/models/issues_manager/descriptions/corsPrivateNetworkPermissionDenied.md +0 -10
- package/front_end/ui/legacy/Floaty.ts +0 -438
- package/front_end/ui/legacy/floaty.css +0 -77
|
@@ -10,9 +10,6 @@ import type * as Platform from '../../../core/platform/platform.js';
|
|
|
10
10
|
import * as SDK from '../../../core/sdk/sdk.js';
|
|
11
11
|
import * as Protocol from '../../../generated/protocol.js';
|
|
12
12
|
import * as AiAssistanceModel from '../../../models/ai_assistance/ai_assistance.js';
|
|
13
|
-
import * as GreenDev from '../../../models/greendev/greendev.js';
|
|
14
|
-
import * as Trace from '../../../models/trace/trace.js';
|
|
15
|
-
import * as Workspace from '../../../models/workspace/workspace.js';
|
|
16
13
|
import * as PanelsCommon from '../../../panels/common/common.js';
|
|
17
14
|
import * as PanelUtils from '../../../panels/utils/utils.js';
|
|
18
15
|
import * as Buttons from '../../../ui/components/buttons/buttons.js';
|
|
@@ -39,14 +36,6 @@ const UIStrings = {
|
|
|
39
36
|
* @description The footer disclaimer that links to more information about the AI feature.
|
|
40
37
|
*/
|
|
41
38
|
learnAbout: 'Learn about AI in DevTools',
|
|
42
|
-
/**
|
|
43
|
-
* @description Label added to the button that remove the currently selected context in AI Assistance panel.
|
|
44
|
-
*/
|
|
45
|
-
removeContext: 'Remove from context',
|
|
46
|
-
/**
|
|
47
|
-
* @description Label added to the button that add selected context from the current panel in AI Assistance panel.
|
|
48
|
-
*/
|
|
49
|
-
addContext: 'Add selected item as context',
|
|
50
39
|
} as const;
|
|
51
40
|
|
|
52
41
|
/*
|
|
@@ -93,6 +82,30 @@ const UIStringsNotTranslate = {
|
|
|
93
82
|
* @description Message displayed in toast in case of any failures while uploading an image file as input.
|
|
94
83
|
*/
|
|
95
84
|
uploadImageFailureMessage: 'Failed to upload image. Please try again.',
|
|
85
|
+
/**
|
|
86
|
+
* @description Label added to the button that add selected context from the current panel in AI Assistance panel.
|
|
87
|
+
*/
|
|
88
|
+
addContext: 'Add item for context',
|
|
89
|
+
/**
|
|
90
|
+
* @description Label added to the button that remove the currently selected element in AI Assistance panel.
|
|
91
|
+
*/
|
|
92
|
+
removeContextElement: 'Remove element from context',
|
|
93
|
+
/**
|
|
94
|
+
* @description Label added to the button that remove the currently selected context in AI Assistance panel.
|
|
95
|
+
*/
|
|
96
|
+
removeContextRequest: 'Remove request from context',
|
|
97
|
+
/**
|
|
98
|
+
* @description Label added to the button that remove the currently selected context in AI Assistance panel.
|
|
99
|
+
*/
|
|
100
|
+
removeContextFile: 'Remove file from context',
|
|
101
|
+
/**
|
|
102
|
+
* @description Label added to the button that remove the currently selected context in AI Assistance panel.
|
|
103
|
+
*/
|
|
104
|
+
removeContextPerfInsight: 'Remove performance insight from context',
|
|
105
|
+
/**
|
|
106
|
+
* @description Label added to the button that remove the currently selected context in AI Assistance panel.
|
|
107
|
+
*/
|
|
108
|
+
removeContext: 'Remove from context',
|
|
96
109
|
} as const;
|
|
97
110
|
|
|
98
111
|
const str_ = i18n.i18n.registerUIStrings('panels/ai_assistance/components/ChatInput.ts', UIStrings);
|
|
@@ -123,7 +136,6 @@ export interface ViewInput {
|
|
|
123
136
|
inputPlaceholder: Platform.UIString.LocalizedString;
|
|
124
137
|
selectedContext: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null;
|
|
125
138
|
inspectElementToggled: boolean;
|
|
126
|
-
additionalFloatyContext: UI.Floaty.FloatyContextSelection[];
|
|
127
139
|
disclaimerText: string;
|
|
128
140
|
conversationType: AiAssistanceModel.AiHistoryStorage.ConversationType;
|
|
129
141
|
multimodalInputEnabled: boolean;
|
|
@@ -151,22 +163,36 @@ export interface ViewInput {
|
|
|
151
163
|
|
|
152
164
|
export type ViewOutput = undefined;
|
|
153
165
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
function getContextRemoveLabel(context: AiAssistanceModel.AiAgent.ConversationContext<unknown>):
|
|
167
|
+
Platform.UIString.LocalizedString {
|
|
168
|
+
if (context instanceof AiAssistanceModel.FileAgent.FileContext) {
|
|
169
|
+
return lockedString(UIStringsNotTranslate.removeContextFile);
|
|
170
|
+
}
|
|
171
|
+
if (context instanceof AiAssistanceModel.StylingAgent.NodeContext) {
|
|
172
|
+
return lockedString(UIStringsNotTranslate.removeContextElement);
|
|
173
|
+
}
|
|
174
|
+
if (context instanceof AiAssistanceModel.NetworkAgent.RequestContext) {
|
|
175
|
+
return lockedString(UIStringsNotTranslate.removeContextRequest);
|
|
176
|
+
}
|
|
177
|
+
if (context instanceof AiAssistanceModel.PerformanceAgent.PerformanceTraceContext) {
|
|
178
|
+
return lockedString(UIStringsNotTranslate.removeContextPerfInsight);
|
|
179
|
+
}
|
|
180
|
+
return lockedString(UIStringsNotTranslate.removeContext);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export const DEFAULT_VIEW = (input: ViewInput, _output: ViewOutput, target: HTMLElement): void => {
|
|
184
|
+
const chatInputContainerCls = Lit.Directives.classMap({
|
|
185
|
+
'chat-input-container': true,
|
|
186
|
+
'single-line-layout': !input.selectedContext && !input.onContextAdd,
|
|
187
|
+
disabled: input.isTextInputDisabled,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
const renderRelevantDataDisclaimer = (tooltipId: string): Lit.LitTemplate => {
|
|
191
|
+
const classes = Lit.Directives.classMap({
|
|
192
|
+
'chat-input-disclaimer': true,
|
|
193
|
+
'hide-divider': !input.isLoading && input.blockedByCrossOrigin,
|
|
194
|
+
});
|
|
195
|
+
// clang-format off
|
|
170
196
|
return html`
|
|
171
197
|
<div class=${classes}>
|
|
172
198
|
<button
|
|
@@ -198,10 +224,10 @@ export const
|
|
|
198
224
|
</div></devtools-tooltip>
|
|
199
225
|
</div>
|
|
200
226
|
`;
|
|
201
|
-
|
|
202
|
-
|
|
227
|
+
// clang-format on
|
|
228
|
+
};
|
|
203
229
|
|
|
204
|
-
|
|
230
|
+
// clang-format off
|
|
205
231
|
Lit.render(html`
|
|
206
232
|
<style>${Input.textInputStyles}</style>
|
|
207
233
|
<style>${chatInputStyles}</style>
|
|
@@ -226,52 +252,6 @@ export const
|
|
|
226
252
|
:
|
|
227
253
|
html`
|
|
228
254
|
<form class="input-form" @submit=${input.onSubmit}>
|
|
229
|
-
${GreenDev.Prototypes.instance().isEnabled('inDevToolsFloaty') ?
|
|
230
|
-
html`
|
|
231
|
-
<ul class="floaty">
|
|
232
|
-
${input.additionalFloatyContext.map(c => {
|
|
233
|
-
return html`
|
|
234
|
-
<li>
|
|
235
|
-
<span class="context-item">
|
|
236
|
-
${c instanceof SDK.NetworkRequest.NetworkRequest ? html`${c.url()}` :
|
|
237
|
-
c instanceof SDK.DOMModel.DOMNode ? html`
|
|
238
|
-
<devtools-widget .widgetConfig=${
|
|
239
|
-
UI.Widget.widgetConfig(PanelsCommon.DOMLinkifier.DOMNodeLink, {node: c})}
|
|
240
|
-
></devtools-widget>` :
|
|
241
|
-
'insight' in c ? html`${c.insight.title}` :
|
|
242
|
-
'event' in c && 'traceStartTime' in c ? html`
|
|
243
|
-
${c.event.name} @ ${i18n.TimeUtilities.formatMicroSecondsAsMillisFixed(Trace.Types.Timing.Micro(c.event.ts - c.traceStartTime))}` :
|
|
244
|
-
Lit.nothing}
|
|
245
|
-
</span>
|
|
246
|
-
<devtools-button
|
|
247
|
-
class="floaty-delete-button"
|
|
248
|
-
@click=${(e: MouseEvent) => {
|
|
249
|
-
e.preventDefault();
|
|
250
|
-
UI.Floaty.onFloatyContextDelete(c);
|
|
251
|
-
}}
|
|
252
|
-
.data=${{
|
|
253
|
-
variant: Buttons.Button.Variant.ICON,
|
|
254
|
-
iconName: 'cross',
|
|
255
|
-
title: 'Delete',
|
|
256
|
-
size: Buttons.Button.Size.SMALL,
|
|
257
|
-
} as Buttons.Button.ButtonData}
|
|
258
|
-
></devtools-button>
|
|
259
|
-
</li>`;
|
|
260
|
-
})}
|
|
261
|
-
<li class="open-floaty">
|
|
262
|
-
<devtools-button
|
|
263
|
-
class="floaty-add-button"
|
|
264
|
-
@click=${UI.Floaty.onFloatyOpen}
|
|
265
|
-
.data=${{
|
|
266
|
-
variant: Buttons.Button.Variant.ICON,
|
|
267
|
-
iconName: 'select-element',
|
|
268
|
-
title: 'Open context picker',
|
|
269
|
-
size: Buttons.Button.Size.SMALL,
|
|
270
|
-
} as Buttons.Button.ButtonData}
|
|
271
|
-
></devtools-button>
|
|
272
|
-
</li>
|
|
273
|
-
</ul>`
|
|
274
|
-
: Lit.nothing}
|
|
275
255
|
<div class=${chatInputContainerCls}>
|
|
276
256
|
${(input.multimodalInputEnabled && input.imageInput && !input.isTextInputDisabled) ?
|
|
277
257
|
html`
|
|
@@ -355,20 +335,20 @@ export const
|
|
|
355
335
|
}}
|
|
356
336
|
aria-description=${i18nString(UIStrings.revealContextDescription)}
|
|
357
337
|
>
|
|
358
|
-
${input.selectedContext
|
|
359
|
-
PanelUtils.PanelUtils.getIconForNetworkRequest(input.selectedContext.getItem()
|
|
360
|
-
input.selectedContext
|
|
361
|
-
PanelUtils.PanelUtils.getIconForSourceFile(input.selectedContext.getItem()
|
|
362
|
-
input.selectedContext
|
|
338
|
+
${input.selectedContext instanceof AiAssistanceModel.NetworkAgent.RequestContext ?
|
|
339
|
+
PanelUtils.PanelUtils.getIconForNetworkRequest(input.selectedContext.getItem()) :
|
|
340
|
+
input.selectedContext instanceof AiAssistanceModel.FileAgent.FileContext ?
|
|
341
|
+
PanelUtils.PanelUtils.getIconForSourceFile(input.selectedContext.getItem()) :
|
|
342
|
+
input.selectedContext instanceof AiAssistanceModel.PerformanceAgent.PerformanceTraceContext ?
|
|
363
343
|
html`<devtools-icon name="performance" title="Performance"></devtools-icon>` :
|
|
364
344
|
Lit.nothing}
|
|
365
345
|
<span class="title">
|
|
366
|
-
${input.selectedContext
|
|
346
|
+
${input.selectedContext instanceof AiAssistanceModel.StylingAgent.NodeContext ?
|
|
367
347
|
html`
|
|
368
348
|
<devtools-widget .widgetConfig=${UI.Widget.widgetConfig(PanelsCommon.DOMLinkifier.DOMNodeLink, {
|
|
369
|
-
node: input.selectedContext.getItem()
|
|
349
|
+
node: input.selectedContext.getItem(),
|
|
370
350
|
options: {
|
|
371
|
-
hiddenClassList:
|
|
351
|
+
hiddenClassList: input.selectedContext.getItem().classNames().filter(
|
|
372
352
|
className => className.startsWith(AiAssistanceModel.Injected.AI_ASSISTANCE_CSS_CLASS_NAME)),
|
|
373
353
|
disabled: input.isTextInputDisabled,
|
|
374
354
|
},
|
|
@@ -378,8 +358,8 @@ export const
|
|
|
378
358
|
</span>
|
|
379
359
|
${input.onContextRemoved ? html`
|
|
380
360
|
<devtools-button
|
|
381
|
-
title=${
|
|
382
|
-
aria-label=${
|
|
361
|
+
title=${getContextRemoveLabel(input.selectedContext)}
|
|
362
|
+
aria-label=${getContextRemoveLabel(input.selectedContext)}
|
|
383
363
|
class="remove-context"
|
|
384
364
|
.iconName=${'cross'}
|
|
385
365
|
.size=${Buttons.Button.Size.MICRO}
|
|
@@ -391,8 +371,8 @@ export const
|
|
|
391
371
|
:
|
|
392
372
|
input.onContextAdd ? html`
|
|
393
373
|
<devtools-button
|
|
394
|
-
title=${
|
|
395
|
-
aria-label=${
|
|
374
|
+
title=${lockedString(UIStringsNotTranslate.addContext)}
|
|
375
|
+
aria-label=${lockedString(UIStringsNotTranslate.addContext)}
|
|
396
376
|
class="add-context"
|
|
397
377
|
.iconName=${'plus'}
|
|
398
378
|
.size=${Buttons.Button.Size.SMALL}
|
|
@@ -494,9 +474,9 @@ export const
|
|
|
494
474
|
>
|
|
495
475
|
${renderRelevantDataDisclaimer(RELEVANT_DATA_LINK_FOOTER_ID)}
|
|
496
476
|
</footer>
|
|
497
|
-
`, target);
|
|
498
|
-
|
|
499
|
-
|
|
477
|
+
`, target,);
|
|
478
|
+
// clang-format on
|
|
479
|
+
};
|
|
500
480
|
|
|
501
481
|
/**
|
|
502
482
|
* ChatInput is a presenter for the input area in the AI Assistance panel.
|
|
@@ -506,9 +486,8 @@ export class ChatInput extends UI.Widget.Widget implements SDK.TargetManager.Obs
|
|
|
506
486
|
blockedByCrossOrigin = false;
|
|
507
487
|
isTextInputDisabled = false;
|
|
508
488
|
inputPlaceholder = '' as Platform.UIString.LocalizedString;
|
|
509
|
-
selectedContext
|
|
489
|
+
selectedContext: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null = null;
|
|
510
490
|
inspectElementToggled = false;
|
|
511
|
-
additionalFloatyContext = [] as UI.Floaty.FloatyContextSelection[];
|
|
512
491
|
disclaimerText = '';
|
|
513
492
|
conversationType = AiAssistanceModel.AiHistoryStorage.ConversationType.STYLING;
|
|
514
493
|
multimodalInputEnabled = false;
|
|
@@ -697,7 +676,6 @@ export class ChatInput extends UI.Widget.Widget implements SDK.TargetManager.Obs
|
|
|
697
676
|
selectedContext: this.selectedContext,
|
|
698
677
|
inspectElementToggled: this.inspectElementToggled,
|
|
699
678
|
isTextInputEmpty: this.#isTextInputEmpty(),
|
|
700
|
-
additionalFloatyContext: this.additionalFloatyContext,
|
|
701
679
|
disclaimerText: this.disclaimerText,
|
|
702
680
|
conversationType: this.conversationType,
|
|
703
681
|
multimodalInputEnabled: this.multimodalInputEnabled,
|
|
@@ -76,7 +76,6 @@ export interface Props {
|
|
|
76
76
|
disclaimerText: Platform.UIString.LocalizedString;
|
|
77
77
|
uploadImageInputEnabled?: boolean;
|
|
78
78
|
markdownRenderer: MarkdownLitRenderer;
|
|
79
|
-
additionalFloatyContext: UI.Floaty.FloatyContextSelection[];
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
interface ChatWidgetInput extends Props {
|
|
@@ -171,7 +170,6 @@ const DEFAULT_VIEW: View = (input, output, target) => {
|
|
|
171
170
|
conversationType: input.conversationType,
|
|
172
171
|
uploadImageInputEnabled: input.uploadImageInputEnabled ?? false,
|
|
173
172
|
isReadOnly: input.isReadOnly,
|
|
174
|
-
additionalFloatyContext: input.additionalFloatyContext,
|
|
175
173
|
onContextClick: input.onContextClick,
|
|
176
174
|
onInspectElementClick: input.onInspectElementClick,
|
|
177
175
|
onTextSubmit: input.onTextSubmit,
|
|
@@ -185,6 +183,19 @@ const DEFAULT_VIEW: View = (input, output, target) => {
|
|
|
185
183
|
`, target);
|
|
186
184
|
// clang-format on
|
|
187
185
|
};
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* ChatView is a web component for historical reasons and generally should not
|
|
189
|
+
* exist because it barely has any presenter logic and it is definitely not
|
|
190
|
+
* re-usable as a custom element. Instead, the template from ChatView should be
|
|
191
|
+
* embdedded into the AiAssistancePanel (the sole host of chat interfaces) and
|
|
192
|
+
* the scroll handling logic should be implemented in view functions using refs
|
|
193
|
+
* or re-usable custom elements. Currently, the ChatView just combines the
|
|
194
|
+
* interfaces of ChatMessage and ChatInput presenters and passes most of the
|
|
195
|
+
* properties down to those presenters as-is.
|
|
196
|
+
*
|
|
197
|
+
* @deprecated
|
|
198
|
+
*/
|
|
188
199
|
export class ChatView extends HTMLElement {
|
|
189
200
|
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
190
201
|
#scrollTop?: number;
|
|
@@ -272,7 +272,6 @@ interface FrameDetailsViewInput {
|
|
|
272
272
|
frame: SDK.ResourceTreeModel.ResourceTreeFrame;
|
|
273
273
|
target: SDK.Target.Target|null;
|
|
274
274
|
creationStackTrace: StackTrace.StackTrace.StackTrace|null;
|
|
275
|
-
creationTarget: SDK.Target.Target|null;
|
|
276
275
|
adScriptAncestry: Protocol.Page.AdScriptAncestry|null;
|
|
277
276
|
linkTargetDOMNode: SDK.DOMModel.DOMNode|null;
|
|
278
277
|
permissionsPolicies: Protocol.Page.PermissionsPolicyFeatureState[]|null;
|
|
@@ -354,7 +353,7 @@ function renderDocumentSection(input: FrameDetailsViewInput): LitTemplate {
|
|
|
354
353
|
${maybeRenderUnreachableURL(input.frame?.unreachableUrl())}
|
|
355
354
|
${maybeRenderOrigin(input.frame?.securityOrigin)}
|
|
356
355
|
${renderOwnerElement(input.linkTargetDOMNode)}
|
|
357
|
-
${maybeRenderCreationStacktrace(input.creationStackTrace
|
|
356
|
+
${maybeRenderCreationStacktrace(input.creationStackTrace)}
|
|
358
357
|
${maybeRenderAdStatus(input.frame?.adFrameType(), input.frame?.adFrameStatus())}
|
|
359
358
|
${maybeRenderCreatorAdScriptAncestry(input.frame?.adFrameType(), input.target, input.adScriptAncestry)}
|
|
360
359
|
<devtools-report-divider></devtools-report-divider>`;
|
|
@@ -447,9 +446,8 @@ function renderOwnerElement(linkTargetDOMNode: SDK.DOMModel.DOMNode|null): LitTe
|
|
|
447
446
|
return nothing;
|
|
448
447
|
}
|
|
449
448
|
|
|
450
|
-
function maybeRenderCreationStacktrace(
|
|
451
|
-
|
|
452
|
-
if (stackTrace && target) {
|
|
449
|
+
function maybeRenderCreationStacktrace(stackTrace: StackTrace.StackTrace.StackTrace|null): LitTemplate {
|
|
450
|
+
if (stackTrace) {
|
|
453
451
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
454
452
|
// clang-format off
|
|
455
453
|
return html`
|
|
@@ -457,7 +455,7 @@ function maybeRenderCreationStacktrace(
|
|
|
457
455
|
i18nString(UIStrings.creationStackTrace)}</devtools-report-key>
|
|
458
456
|
<devtools-report-value jslog=${VisualLogging.section('frame-creation-stack-trace')}>
|
|
459
457
|
<devtools-widget .widgetConfig=${UI.Widget.widgetConfig(
|
|
460
|
-
Components.JSPresentationUtils.StackTracePreviewContent, {
|
|
458
|
+
Components.JSPresentationUtils.StackTracePreviewContent, {stackTrace, options: {expandable: true}})}>
|
|
461
459
|
</devtools-widget>
|
|
462
460
|
</devtools-report-value>
|
|
463
461
|
`;
|
|
@@ -844,7 +842,6 @@ export class FrameDetailsReportView extends UI.Widget.Widget {
|
|
|
844
842
|
#frame?: SDK.ResourceTreeModel.ResourceTreeFrame;
|
|
845
843
|
#target: SDK.Target.Target|null = null;
|
|
846
844
|
#creationStackTrace: StackTrace.StackTrace.StackTrace|null = null;
|
|
847
|
-
#creationTarget: SDK.Target.Target|null = null;
|
|
848
845
|
#securityIsolationInfo: Protocol.Network.SecurityIsolationStatus|null = null;
|
|
849
846
|
#linkTargetDOMNode: SDK.DOMModel.DOMNode|null = null;
|
|
850
847
|
#trials: Protocol.Page.OriginTrial[]|null = null;
|
|
@@ -869,7 +866,6 @@ export class FrameDetailsReportView extends UI.Widget.Widget {
|
|
|
869
866
|
});
|
|
870
867
|
const {creationStackTrace: rawCreationStackTrace, creationStackTraceTarget: creationTarget} =
|
|
871
868
|
frame.getCreationStackTraceData();
|
|
872
|
-
this.#creationTarget = creationTarget;
|
|
873
869
|
if (rawCreationStackTrace) {
|
|
874
870
|
void Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()
|
|
875
871
|
.createStackTraceFromProtocolRuntime(rawCreationStackTrace, creationTarget)
|
|
@@ -924,7 +920,6 @@ export class FrameDetailsReportView extends UI.Widget.Widget {
|
|
|
924
920
|
frame,
|
|
925
921
|
target: this.#target,
|
|
926
922
|
creationStackTrace: this.#creationStackTrace,
|
|
927
|
-
creationTarget: this.#creationTarget,
|
|
928
923
|
protocolMonitorExperimentEnabled: this.#protocolMonitorExperimentEnabled,
|
|
929
924
|
permissionsPolicies: this.#permissionsPolicies,
|
|
930
925
|
adScriptAncestry: this.#adScriptAncestry,
|
|
@@ -55,6 +55,14 @@ const UIStringsNotTranslate = {
|
|
|
55
55
|
* @description Text for teaser when suggestion has been generated.
|
|
56
56
|
*/
|
|
57
57
|
tab: 'tab',
|
|
58
|
+
/**
|
|
59
|
+
* @description Text for teaser when suggestion has been generated.
|
|
60
|
+
*/
|
|
61
|
+
or: 'or',
|
|
62
|
+
/**
|
|
63
|
+
* @description Text for teaser when suggestion has been generated.
|
|
64
|
+
*/
|
|
65
|
+
enter: 'enter',
|
|
58
66
|
/**
|
|
59
67
|
* @description Text for teaser when suggestion has been generated.
|
|
60
68
|
*/
|
|
@@ -234,6 +242,8 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
|
234
242
|
// clang-format off
|
|
235
243
|
teaserLabel = html`<div class="ai-code-generation-teaser-generated">
|
|
236
244
|
<span>${lockedString(UIStringsNotTranslate.tab)}</span>
|
|
245
|
+
${lockedString(UIStringsNotTranslate.or)}
|
|
246
|
+
<span>${lockedString(UIStringsNotTranslate.enter)}</span>
|
|
237
247
|
${lockedString(UIStringsNotTranslate.toAccept)}
|
|
238
248
|
</div>`;
|
|
239
249
|
// clang-format on
|
|
@@ -72,7 +72,6 @@ import {
|
|
|
72
72
|
ConsoleTableMessageView,
|
|
73
73
|
ConsoleViewMessage,
|
|
74
74
|
getMessageForElement,
|
|
75
|
-
MaxLengthForLinks,
|
|
76
75
|
} from './ConsoleViewMessage.js';
|
|
77
76
|
import {ConsoleViewport, type ConsoleViewportElement, type ConsoleViewportProvider} from './ConsoleViewport.js';
|
|
78
77
|
|
|
@@ -549,7 +548,7 @@ export class ConsoleView extends UI.Widget.VBox implements
|
|
|
549
548
|
// the linkifiers live location change event.
|
|
550
549
|
const throttler = new Common.Throttler.Throttler(100);
|
|
551
550
|
const refilterMessages = (): Promise<void> => throttler.schedule(async () => this.onFilterChanged());
|
|
552
|
-
this.linkifier = new Components.Linkifier.Linkifier(
|
|
551
|
+
this.linkifier = new Components.Linkifier.Linkifier(UI.UIUtils.MaxLengthForDisplayedURLsInConsole);
|
|
553
552
|
this.linkifier.addEventListener(Components.Linkifier.Events.LIVE_LOCATION_UPDATED, refilterMessages);
|
|
554
553
|
|
|
555
554
|
this.consoleMessages = [];
|
|
@@ -702,15 +702,27 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
|
|
|
702
702
|
clickableElement.tabIndex = -1;
|
|
703
703
|
}
|
|
704
704
|
clickableElement.appendChild(messageElement);
|
|
705
|
-
const stackTraceElement = contentElement.createChild('div');
|
|
706
|
-
const
|
|
707
|
-
|
|
705
|
+
const stackTraceElement = contentElement.createChild('div', 'hidden-stack-trace');
|
|
706
|
+
const targetManager = SDK.TargetManager.TargetManager.instance();
|
|
707
|
+
const stackTraceTarget = target ?? targetManager.primaryPageTarget() ?? targetManager.rootTarget();
|
|
708
|
+
const stackTracePreview = new Components.JSPresentationUtils.StackTracePreviewContent();
|
|
709
|
+
stackTracePreview.options = {widthConstrained: true};
|
|
710
|
+
if (stackTraceTarget && stackTrace) {
|
|
711
|
+
const selectableChildIndex = this.selectableChildren.length;
|
|
712
|
+
void Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()
|
|
713
|
+
.createStackTraceFromProtocolRuntime(stackTrace, stackTraceTarget)
|
|
714
|
+
.then(stackTrace => {
|
|
715
|
+
stackTracePreview.stackTrace = stackTrace;
|
|
716
|
+
return stackTracePreview.updateComplete;
|
|
717
|
+
})
|
|
718
|
+
.then(() => {
|
|
719
|
+
const selectableLinks =
|
|
720
|
+
stackTracePreview.linkElements.map(element => ({element, forceSelect: () => element.focus()}));
|
|
721
|
+
this.selectableChildren.splice(selectableChildIndex, 0, ...selectableLinks);
|
|
722
|
+
});
|
|
723
|
+
}
|
|
708
724
|
stackTracePreview.markAsRoot();
|
|
709
725
|
stackTracePreview.show(stackTraceElement);
|
|
710
|
-
for (const linkElement of stackTracePreview.linkElements) {
|
|
711
|
-
this.selectableChildren.push({element: linkElement, forceSelect: () => linkElement.focus()});
|
|
712
|
-
}
|
|
713
|
-
stackTraceElement.classList.add('hidden-stack-trace');
|
|
714
726
|
UI.ARIAUtils.setLabel(
|
|
715
727
|
contentElement, `${messageElement.textContent} ${i18nString(UIStrings.stackMessageCollapsed)}`);
|
|
716
728
|
UI.ARIAUtils.markAsGroup(stackTraceElement);
|
|
@@ -2351,11 +2363,6 @@ export class ConsoleTableMessageView extends ConsoleViewMessage {
|
|
|
2351
2363
|
*/
|
|
2352
2364
|
const MaxLengthToIgnoreHighlighter = 10000;
|
|
2353
2365
|
|
|
2354
|
-
/**
|
|
2355
|
-
* @constant
|
|
2356
|
-
*/
|
|
2357
|
-
export const MaxLengthForLinks = 40;
|
|
2358
|
-
|
|
2359
2366
|
let maxTokenizableStringLength = 10000;
|
|
2360
2367
|
let longStringVisibleLength = 5000;
|
|
2361
2368
|
|
|
@@ -38,7 +38,7 @@ import * as Common from '../../core/common/common.js';
|
|
|
38
38
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
39
39
|
import * as Platform from '../../core/platform/platform.js';
|
|
40
40
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
41
|
-
import * as ComputedStyleModule from '../../models/computed_style/computed_style.js';
|
|
41
|
+
import type * as ComputedStyleModule from '../../models/computed_style/computed_style.js';
|
|
42
42
|
import * as TreeOutline from '../../ui/components/tree_outline/tree_outline.js';
|
|
43
43
|
import * as InlineEditor from '../../ui/legacy/components/inline_editor/inline_editor.js';
|
|
44
44
|
import * as Components from '../../ui/legacy/components/utils/utils.js';
|
|
@@ -265,7 +265,7 @@ type ComputedStyleData = {
|
|
|
265
265
|
interface ComputedStyleWidgetInput {
|
|
266
266
|
computedStylesTree: TreeOutline.TreeOutline.TreeOutline<ComputedStyleData>;
|
|
267
267
|
hasMatches: boolean;
|
|
268
|
-
computedStyleModel
|
|
268
|
+
computedStyleModel?: ComputedStyleModule.ComputedStyleModel.ComputedStyleModel;
|
|
269
269
|
showInheritedComputedStylePropertiesSetting: Common.Settings.Setting<boolean>;
|
|
270
270
|
groupComputedStylesSetting: Common.Settings.Setting<boolean>;
|
|
271
271
|
onFilterChanged: (event: CustomEvent<string>) => void;
|
|
@@ -296,17 +296,17 @@ export const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
|
296
296
|
>${i18nString(UIStrings.group)}</devtools-checkbox>
|
|
297
297
|
</devtools-toolbar>
|
|
298
298
|
</div>
|
|
299
|
-
|
|
300
|
-
${input.computedStylesTree}
|
|
301
|
-
</div>
|
|
299
|
+
${input.computedStylesTree}
|
|
302
300
|
${!input.hasMatches ? html`<div class="gray-info-message">${i18nString(UIStrings.noMatchingProperty)}</div>` : ''}
|
|
303
|
-
|
|
301
|
+
${input.computedStyleModel ? html`<devtools-widget .widgetConfig=${UI.Widget.widgetConfig(PlatformFontsWidget, { sharedModel: input.computedStyleModel})}></devtools-widget>` : ''}
|
|
304
302
|
`, target);
|
|
305
303
|
// clang-format on
|
|
306
304
|
};
|
|
307
305
|
|
|
308
306
|
export class ComputedStyleWidget extends UI.Widget.VBox {
|
|
309
|
-
|
|
307
|
+
#computedStyleModel?: ComputedStyleModule.ComputedStyleModel.ComputedStyleModel;
|
|
308
|
+
#nodeStyle: ComputedStyleModule.ComputedStyleModel.ComputedStyle|null = null;
|
|
309
|
+
#matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles|null = null;
|
|
310
310
|
private readonly showInheritedComputedStylePropertiesSetting: Common.Settings.Setting<boolean>;
|
|
311
311
|
private readonly groupComputedStylesSetting: Common.Settings.Setting<boolean>;
|
|
312
312
|
private filterRegex: RegExp|null;
|
|
@@ -318,18 +318,12 @@ export class ComputedStyleWidget extends UI.Widget.VBox {
|
|
|
318
318
|
readonly #view: View;
|
|
319
319
|
#filterText = '';
|
|
320
320
|
|
|
321
|
-
constructor(
|
|
321
|
+
constructor() {
|
|
322
322
|
super({useShadowDom: true});
|
|
323
323
|
this.#view = DEFAULT_VIEW;
|
|
324
324
|
|
|
325
325
|
this.contentElement.classList.add('styles-sidebar-computed-style-widget');
|
|
326
326
|
|
|
327
|
-
this.computedStyleModel = computedStyleModel;
|
|
328
|
-
this.computedStyleModel.addEventListener(
|
|
329
|
-
ComputedStyleModule.ComputedStyleModel.Events.CSS_MODEL_CHANGED, this.requestUpdate, this);
|
|
330
|
-
this.computedStyleModel.addEventListener(
|
|
331
|
-
ComputedStyleModule.ComputedStyleModel.Events.COMPUTED_STYLE_CHANGED, this.requestUpdate, this);
|
|
332
|
-
|
|
333
327
|
this.showInheritedComputedStylePropertiesSetting =
|
|
334
328
|
Common.Settings.Settings.instance().createSetting('show-inherited-computed-style-properties', false);
|
|
335
329
|
this.showInheritedComputedStylePropertiesSetting.addChangeListener(this.requestUpdate.bind(this));
|
|
@@ -340,16 +334,14 @@ export class ComputedStyleWidget extends UI.Widget.VBox {
|
|
|
340
334
|
});
|
|
341
335
|
|
|
342
336
|
this.filterRegex = null;
|
|
343
|
-
|
|
344
337
|
this.linkifier = new Components.Linkifier.Linkifier(maxLinkLength);
|
|
345
|
-
|
|
346
338
|
this.imagePreviewPopover = new ImagePreviewPopover(this.contentElement, event => {
|
|
347
339
|
const link = event.composedPath()[0];
|
|
348
340
|
if (link instanceof Element) {
|
|
349
341
|
return link;
|
|
350
342
|
}
|
|
351
343
|
return null;
|
|
352
|
-
}, () => this
|
|
344
|
+
}, () => this.#computedStyleModel ? this.#computedStyleModel.node : null);
|
|
353
345
|
|
|
354
346
|
this.#updateView({hasMatches: true});
|
|
355
347
|
}
|
|
@@ -377,7 +369,7 @@ export class ComputedStyleWidget extends UI.Widget.VBox {
|
|
|
377
369
|
{
|
|
378
370
|
computedStylesTree: this.#computedStylesTree,
|
|
379
371
|
hasMatches,
|
|
380
|
-
computedStyleModel: this
|
|
372
|
+
computedStyleModel: this.#computedStyleModel,
|
|
381
373
|
showInheritedComputedStylePropertiesSetting: this.showInheritedComputedStylePropertiesSetting,
|
|
382
374
|
groupComputedStylesSetting: this.groupComputedStylesSetting,
|
|
383
375
|
onFilterChanged: this.onFilterChanged.bind(this),
|
|
@@ -386,8 +378,36 @@ export class ComputedStyleWidget extends UI.Widget.VBox {
|
|
|
386
378
|
null, this.contentElement);
|
|
387
379
|
}
|
|
388
380
|
|
|
381
|
+
get nodeStyle(): ComputedStyleModule.ComputedStyleModel.ComputedStyle|null {
|
|
382
|
+
return this.#nodeStyle;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
set nodeStyle(nodeStyle: ComputedStyleModule.ComputedStyleModel.ComputedStyle|null) {
|
|
386
|
+
this.#nodeStyle = nodeStyle;
|
|
387
|
+
this.requestUpdate();
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
get matchedStyles(): SDK.CSSMatchedStyles.CSSMatchedStyles|null {
|
|
391
|
+
return this.#matchedStyles;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
set matchedStyles(matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles|null) {
|
|
395
|
+
this.#matchedStyles = matchedStyles;
|
|
396
|
+
this.requestUpdate();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
get computedStyleModel(): ComputedStyleModule.ComputedStyleModel.ComputedStyleModel|undefined {
|
|
400
|
+
return this.#computedStyleModel;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
set computedStyleModel(computedStyleModel: ComputedStyleModule.ComputedStyleModel.ComputedStyleModel) {
|
|
404
|
+
this.#computedStyleModel = computedStyleModel;
|
|
405
|
+
this.requestUpdate();
|
|
406
|
+
}
|
|
407
|
+
|
|
389
408
|
override async performUpdate(): Promise<void> {
|
|
390
|
-
const
|
|
409
|
+
const nodeStyles = this.#nodeStyle;
|
|
410
|
+
const matchedStyles = this.#matchedStyles;
|
|
391
411
|
if (!nodeStyles || !matchedStyles) {
|
|
392
412
|
this.#updateView({hasMatches: false});
|
|
393
413
|
return;
|
|
@@ -405,7 +425,7 @@ export class ComputedStyleWidget extends UI.Widget.VBox {
|
|
|
405
425
|
matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles): Promise<void> {
|
|
406
426
|
this.imagePreviewPopover.hide();
|
|
407
427
|
this.linkifier.reset();
|
|
408
|
-
const cssModel = this
|
|
428
|
+
const cssModel = this.#computedStyleModel?.cssModel();
|
|
409
429
|
if (!cssModel) {
|
|
410
430
|
return;
|
|
411
431
|
}
|
|
@@ -448,7 +468,7 @@ export class ComputedStyleWidget extends UI.Widget.VBox {
|
|
|
448
468
|
matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles|null): Promise<void> {
|
|
449
469
|
this.imagePreviewPopover.hide();
|
|
450
470
|
this.linkifier.reset();
|
|
451
|
-
const cssModel = this
|
|
471
|
+
const cssModel = this.#computedStyleModel?.cssModel();
|
|
452
472
|
if (!nodeStyle || !matchedStyles || !cssModel) {
|
|
453
473
|
this.#updateView({hasMatches: false});
|
|
454
474
|
return;
|
|
@@ -212,7 +212,7 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
|
|
|
212
212
|
private readonly accessibilityTreeView: AccessibilityTreeView|undefined;
|
|
213
213
|
private breadcrumbs: ElementsComponents.ElementsBreadcrumbs.ElementsBreadcrumbs;
|
|
214
214
|
stylesWidget: StylesSidebarPane;
|
|
215
|
-
|
|
215
|
+
readonly #computedStyleWidget: ComputedStyleWidget;
|
|
216
216
|
private readonly metricsWidget: MetricsSidebarPane;
|
|
217
217
|
private searchResults!: Array<{
|
|
218
218
|
domModel: SDK.DOMModel.DOMModel,
|
|
@@ -315,7 +315,13 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
|
|
|
315
315
|
ComputedStyleWidget, this.evaluateTrackingComputedStyleUpdatesForNode, this);
|
|
316
316
|
|
|
317
317
|
this.stylesWidget = new StylesSidebarPane(this.#computedStyleModel);
|
|
318
|
-
this
|
|
318
|
+
this.#computedStyleWidget = new ComputedStyleWidget();
|
|
319
|
+
this.#computedStyleWidget.computedStyleModel = this.#computedStyleModel;
|
|
320
|
+
this.#computedStyleModel.addEventListener(
|
|
321
|
+
ComputedStyle.ComputedStyleModel.Events.COMPUTED_STYLE_CHANGED, this.#updateComputedStyles, this);
|
|
322
|
+
this.#computedStyleModel.addEventListener(
|
|
323
|
+
ComputedStyle.ComputedStyleModel.Events.CSS_MODEL_CHANGED, this.#updateComputedStyles, this);
|
|
324
|
+
|
|
319
325
|
this.metricsWidget = new MetricsSidebarPane(this.#computedStyleModel);
|
|
320
326
|
|
|
321
327
|
Common.Settings.Settings.instance()
|
|
@@ -374,6 +380,13 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
|
|
|
374
380
|
shouldTrackComputedStyleUpdates ? selectedNode.id : undefined);
|
|
375
381
|
}, 100);
|
|
376
382
|
|
|
383
|
+
async #updateComputedStyles(): Promise<void> {
|
|
384
|
+
const computedStyle = await this.#computedStyleModel.fetchComputedStyle();
|
|
385
|
+
const matchedCascade = await this.#computedStyleModel.fetchMatchedCascade();
|
|
386
|
+
this.#computedStyleWidget.nodeStyle = computedStyle;
|
|
387
|
+
this.#computedStyleWidget.matchedStyles = matchedCascade;
|
|
388
|
+
}
|
|
389
|
+
|
|
377
390
|
private handleElementExpanded(): void {
|
|
378
391
|
if (Annotations.AnnotationRepository.annotationsEnabled()) {
|
|
379
392
|
void PanelCommon.AnnotationManager.instance().resolveAnnotationsOfType(Annotations.AnnotationType.ELEMENT_NODE);
|
|
@@ -1007,7 +1020,7 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
|
|
|
1007
1020
|
const computedStylePanesWrapper = new UI.Widget.VBox();
|
|
1008
1021
|
computedStylePanesWrapper.element.classList.add('style-panes-wrapper');
|
|
1009
1022
|
computedStylePanesWrapper.element.setAttribute('jslog', `${VisualLogging.pane('computed').track({resize: true})}`);
|
|
1010
|
-
this
|
|
1023
|
+
this.#computedStyleWidget.show(computedStylePanesWrapper.element);
|
|
1011
1024
|
|
|
1012
1025
|
const stylesSplitWidget = new UI.SplitWidget.SplitWidget(
|
|
1013
1026
|
true /* isVertical */, true /* secondIsSidebar */, 'elements.styles.sidebar.width', 100);
|
|
@@ -1024,7 +1037,7 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
|
|
|
1024
1037
|
});
|
|
1025
1038
|
|
|
1026
1039
|
const showMetricsWidgetInComputedPane = (): void => {
|
|
1027
|
-
this.metricsWidget.show(computedStylePanesWrapper.element, this
|
|
1040
|
+
this.metricsWidget.show(computedStylePanesWrapper.element, this.#computedStyleWidget.element);
|
|
1028
1041
|
this.stylesWidget.removeEventListener(StylesSidebarPaneEvents.STYLES_UPDATE_COMPLETED, toggleMetricsWidget);
|
|
1029
1042
|
};
|
|
1030
1043
|
|
|
@@ -1147,7 +1160,7 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
|
|
|
1147
1160
|
}
|
|
1148
1161
|
|
|
1149
1162
|
getComputedStyleWidget(): ComputedStyleWidget {
|
|
1150
|
-
return this
|
|
1163
|
+
return this.#computedStyleWidget;
|
|
1151
1164
|
}
|
|
1152
1165
|
|
|
1153
1166
|
private setupStyleTracking(cssModel: SDK.CSSModel.CSSModel): void {
|