chrome-devtools-frontend 1.0.1597448 → 1.0.1597624
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/AidaClient.ts +4 -0
- package/front_end/core/sdk/CPUThrottlingManager.ts +5 -1
- package/front_end/core/sdk/CSSMatchedStyles.ts +2 -0
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +28 -0
- package/front_end/models/ai_assistance/AiConversation.ts +24 -8
- package/front_end/models/ai_assistance/ChangeManager.ts +16 -0
- package/front_end/models/ai_assistance/ExtensionScope.ts +11 -3
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +127 -0
- package/front_end/models/ai_assistance/agents/AiAgent.ts +22 -3
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +11 -8
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +34 -4
- package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +27 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +21 -0
- package/front_end/models/trace/Processor.ts +1 -0
- package/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +33 -0
- package/front_end/models/trace/insights/CharacterSet.ts +172 -0
- package/front_end/models/trace/insights/Models.ts +1 -0
- package/front_end/models/trace/insights/types.ts +1 -0
- package/front_end/models/trace/types/TraceEvents.ts +17 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +16 -3
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +90 -46
- package/front_end/panels/ai_assistance/components/MarkdownRendererWithCodeBlock.ts +18 -9
- package/front_end/panels/ai_assistance/components/chatMessage.css +11 -0
- package/front_end/panels/application/AppManifestView.ts +3 -4
- package/front_end/panels/application/DeviceBoundSessionsView.ts +18 -22
- package/front_end/panels/application/FrameDetailsView.ts +9 -15
- package/front_end/panels/application/OriginTrialTreeView.ts +2 -3
- package/front_end/panels/application/ReportingApiView.ts +13 -17
- package/front_end/panels/application/components/BackForwardCacheView.ts +3 -3
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +2 -3
- package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +3 -2
- package/front_end/panels/changes/ChangesView.ts +6 -4
- package/front_end/panels/console/ConsolePinPane.ts +3 -3
- package/front_end/panels/coverage/CoverageListView.ts +1 -1
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +11 -15
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +3 -5
- package/front_end/panels/elements/EventListenersWidget.ts +3 -2
- package/front_end/panels/elements/StandaloneStylesContainer.ts +21 -6
- package/front_end/panels/elements/StylePropertyTreeElement.ts +49 -4
- package/front_end/panels/layer_viewer/Layers3DView.ts +5 -4
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +5 -6
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +6 -11
- package/front_end/panels/network/RequestCookiesView.ts +3 -4
- package/front_end/panels/network/RequestInitiatorView.ts +7 -5
- package/front_end/panels/network/RequestResponseView.ts +10 -15
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +3 -4
- package/front_end/panels/recorder/components/RecordingView.ts +31 -36
- package/front_end/panels/recorder/components/StepEditor.ts +6 -7
- package/front_end/panels/search/SearchView.ts +2 -3
- package/front_end/panels/settings/WorkspaceSettingsTab.ts +2 -5
- package/front_end/panels/timeline/components/LiveMetricsView.ts +5 -8
- package/front_end/panels/timeline/components/insights/Cache.ts +8 -10
- package/front_end/panels/timeline/components/insights/CharacterSet.ts +38 -0
- package/front_end/panels/timeline/components/insights/DOMSize.ts +16 -20
- package/front_end/panels/timeline/components/insights/DocumentLatency.ts +2 -6
- package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +3 -4
- package/front_end/panels/timeline/components/insights/FontDisplay.ts +3 -4
- package/front_end/panels/timeline/components/insights/ForcedReflow.ts +5 -7
- package/front_end/panels/timeline/components/insights/INPBreakdown.ts +3 -4
- package/front_end/panels/timeline/components/insights/ImageDelivery.ts +3 -4
- package/front_end/panels/timeline/components/insights/ImageRef.ts +2 -4
- package/front_end/panels/timeline/components/insights/InsightRenderer.ts +2 -0
- package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +5 -7
- package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +2 -4
- package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +3 -4
- package/front_end/panels/timeline/components/insights/ModernHTTP.ts +3 -4
- package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +7 -11
- package/front_end/panels/timeline/components/insights/NodeLink.ts +2 -4
- package/front_end/panels/timeline/components/insights/RenderBlocking.ts +3 -4
- package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +7 -10
- package/front_end/panels/timeline/components/insights/ThirdParties.ts +5 -7
- package/front_end/panels/timeline/components/insights/insights.ts +2 -0
- package/front_end/panels/web_audio/WebAudioView.ts +3 -4
- package/front_end/ui/components/settings/SettingCheckbox.ts +2 -0
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +3 -3
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +8 -8
- package/front_end/ui/visual_logging/Debugging.ts +0 -32
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
- package/package.json +1 -1
|
@@ -13,7 +13,8 @@ import * as Root from '../../../core/root/root.js';
|
|
|
13
13
|
import * as SDK from '../../../core/sdk/sdk.js';
|
|
14
14
|
import type * as Protocol from '../../../generated/protocol.js';
|
|
15
15
|
import type {
|
|
16
|
-
AiWidget, ComputedStyleAiWidget, CoreVitalsAiWidget} from
|
|
16
|
+
AiWidget, ComputedStyleAiWidget, CoreVitalsAiWidget, StylePropertiesAiWidget} from
|
|
17
|
+
'../../../models/ai_assistance/agents/AiAgent.js';
|
|
17
18
|
import * as AiAssistanceModel from '../../../models/ai_assistance/ai_assistance.js';
|
|
18
19
|
import * as ComputedStyle from '../../../models/computed_style/computed_style.js';
|
|
19
20
|
import * as Marked from '../../../third_party/marked/marked.js';
|
|
@@ -101,6 +102,10 @@ const UIStringsNotTranslate = {
|
|
|
101
102
|
* @description The error message when the LLM gets stuck in a loop (max steps reached).
|
|
102
103
|
*/
|
|
103
104
|
maxStepsError: 'Seems like I am stuck with the investigation. It would be better if you start over.',
|
|
105
|
+
/**
|
|
106
|
+
* @description The error message when the LLM selects context from a different origin.
|
|
107
|
+
*/
|
|
108
|
+
crossOriginError: 'I have selected the new context but you will have to start a new chat.',
|
|
104
109
|
/**
|
|
105
110
|
* @description Displayed when the user stop the response
|
|
106
111
|
*/
|
|
@@ -205,7 +210,12 @@ export interface StepPart {
|
|
|
205
210
|
step: Step;
|
|
206
211
|
}
|
|
207
212
|
|
|
208
|
-
export
|
|
213
|
+
export interface WidgetPart {
|
|
214
|
+
type: 'widget';
|
|
215
|
+
widgets: AiWidget[];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export type ModelMessagePart = AnswerPart|StepPart|WidgetPart;
|
|
209
219
|
|
|
210
220
|
export interface UserChatMessage {
|
|
211
221
|
entity: ChatMessageEntity.USER;
|
|
@@ -327,6 +337,9 @@ export const DEFAULT_VIEW = (input: ChatMessageViewInput, output: ViewOutput, ta
|
|
|
327
337
|
if (part.type === 'answer') {
|
|
328
338
|
return html`<p>${renderTextAsMarkdown(part.text, input.markdownRenderer, { animate: !input.isReadOnly && input.isLoading && isLastPart && input.isLastMessage })}</p>`;
|
|
329
339
|
}
|
|
340
|
+
if (part.type === 'widget') {
|
|
341
|
+
return html`${Lit.Directives.until(renderWidgets(part.widgets, {wrapperClass: 'main-widgets-wrapper'}))}`;
|
|
342
|
+
}
|
|
330
343
|
if (!aiAssistanceV2 && part.type === 'step') {
|
|
331
344
|
return renderStep({
|
|
332
345
|
step: part.step,
|
|
@@ -602,7 +615,6 @@ export function renderStep({step, isLoading, markdownRenderer, isLast}: {
|
|
|
602
615
|
markdownRenderer: MarkdownLitRenderer,
|
|
603
616
|
isLast: boolean,
|
|
604
617
|
}): Lit.LitTemplate {
|
|
605
|
-
const shouldRenderWidgets = Boolean(step.widgets?.length && Root.Runtime.hostConfig.devToolsAiAssistanceV2?.enabled);
|
|
606
618
|
const stepClasses = Lit.Directives.classMap({
|
|
607
619
|
step: true,
|
|
608
620
|
empty: !step.thought && !step.code && !step.contextDetails && !step.requestApproval,
|
|
@@ -626,11 +638,8 @@ export function renderStep({step, isLoading, markdownRenderer, isLast}: {
|
|
|
626
638
|
</summary>
|
|
627
639
|
${renderStepDetails({step, markdownRenderer, isLast})}
|
|
628
640
|
</details>
|
|
629
|
-
${
|
|
630
|
-
|
|
631
|
-
${Lit.Directives.until(renderStepWidgets(step))}
|
|
632
|
-
</div>` : Lit.nothing
|
|
633
|
-
}`;
|
|
641
|
+
${Lit.Directives.until(renderWidgets(step.widgets, {wrapperClass: 'step-widgets-wrapper'}))}
|
|
642
|
+
`;
|
|
634
643
|
// clang-format on
|
|
635
644
|
}
|
|
636
645
|
|
|
@@ -639,25 +648,31 @@ interface WidgetMakerResponse {
|
|
|
639
648
|
revealable: unknown;
|
|
640
649
|
}
|
|
641
650
|
|
|
642
|
-
const
|
|
651
|
+
const nodeCache = new Map<Protocol.DOM.BackendNodeId, SDK.DOMModel.DOMNode>();
|
|
652
|
+
|
|
653
|
+
async function resolveNode(backendNodeId: Protocol.DOM.BackendNodeId): Promise<SDK.DOMModel.DOMNode|null> {
|
|
654
|
+
const cachedNode = nodeCache.get(backendNodeId);
|
|
655
|
+
if (cachedNode) {
|
|
656
|
+
return cachedNode;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
|
|
660
|
+
if (!target) {
|
|
661
|
+
return null;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
const node = new SDK.DOMModel.DeferredDOMNode(target, backendNodeId);
|
|
665
|
+
const resolved = await node.resolvePromise();
|
|
666
|
+
if (resolved) {
|
|
667
|
+
nodeCache.set(backendNodeId, resolved);
|
|
668
|
+
}
|
|
669
|
+
return resolved;
|
|
670
|
+
}
|
|
643
671
|
|
|
644
672
|
async function makeComputedStyleWidget(widgetData: ComputedStyleAiWidget): Promise<WidgetMakerResponse|null> {
|
|
645
|
-
|
|
673
|
+
const domNodeForId = await resolveNode(widgetData.data.backendNodeId);
|
|
646
674
|
if (!domNodeForId) {
|
|
647
|
-
|
|
648
|
-
if (!target) {
|
|
649
|
-
return null;
|
|
650
|
-
}
|
|
651
|
-
const node = new SDK.DOMModel.DeferredDOMNode(
|
|
652
|
-
target,
|
|
653
|
-
widgetData.data.backendNodeId,
|
|
654
|
-
);
|
|
655
|
-
const resolved = await node.resolvePromise();
|
|
656
|
-
if (!resolved) {
|
|
657
|
-
return null;
|
|
658
|
-
}
|
|
659
|
-
domNodeForId = resolved;
|
|
660
|
-
computedStyleNodeCache.set(widgetData.data.backendNodeId, resolved);
|
|
675
|
+
return null;
|
|
661
676
|
}
|
|
662
677
|
const styles = new ComputedStyle.ComputedStyleModel.ComputedStyle(domNodeForId, widgetData.data.computedStyles);
|
|
663
678
|
|
|
@@ -690,6 +705,27 @@ async function makeCoreVitalsWidget(widgetData: CoreVitalsAiWidget): Promise<Wid
|
|
|
690
705
|
};
|
|
691
706
|
}
|
|
692
707
|
|
|
708
|
+
async function makeStylePropertiesWidget(widgetData: StylePropertiesAiWidget): Promise<WidgetMakerResponse|null> {
|
|
709
|
+
const domNodeForId = await resolveNode(widgetData.data.backendNodeId);
|
|
710
|
+
if (!domNodeForId) {
|
|
711
|
+
return null;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
const widgetConfig = UI.Widget.widgetConfig(Elements.StandaloneStylesContainer.StandaloneStylesContainer, {
|
|
715
|
+
domNode: domNodeForId,
|
|
716
|
+
filter: widgetData.data.selector ? new RegExp(widgetData.data.selector) : null,
|
|
717
|
+
});
|
|
718
|
+
|
|
719
|
+
// clang-format off
|
|
720
|
+
const widget = html`<devtools-widget
|
|
721
|
+
class="styling-preview-widget"
|
|
722
|
+
.widgetConfig=${widgetConfig}
|
|
723
|
+
></devtools-widget>`;
|
|
724
|
+
// clang-format on
|
|
725
|
+
|
|
726
|
+
return {renderedWidget: widget, revealable: domNodeForId};
|
|
727
|
+
}
|
|
728
|
+
|
|
693
729
|
function renderWidgetResponse(response: WidgetMakerResponse|null): Lit.LitTemplate {
|
|
694
730
|
if (response === null) {
|
|
695
731
|
return Lit.nothing;
|
|
@@ -721,38 +757,43 @@ function renderWidgetResponse(response: WidgetMakerResponse|null): Lit.LitTempla
|
|
|
721
757
|
}
|
|
722
758
|
|
|
723
759
|
/**
|
|
724
|
-
* Renders AI-defined UI widgets
|
|
725
|
-
* When a ModelChatMessage contains a WidgetPart,
|
|
726
|
-
* iterates through the
|
|
727
|
-
* the appropriate rendering logic based on
|
|
760
|
+
* Renders AI-defined UI widgets.
|
|
761
|
+
* When a ModelChatMessage contains a WidgetPart, or a Step has widgets,
|
|
762
|
+
* the ChatMessage component iterates through the \`widgets\` array.
|
|
763
|
+
* For each widget, it determines the appropriate rendering logic based on
|
|
764
|
+
* the \`widgetData.name\`.
|
|
728
765
|
*
|
|
729
|
-
* Currently,
|
|
730
|
-
*
|
|
731
|
-
* data and configuration for the
|
|
732
|
-
* and
|
|
733
|
-
*
|
|
734
|
-
* custom element, which dynamically instantiates and displays the specified
|
|
735
|
-
* UI.Widget subclass with the provided configuration.
|
|
766
|
+
* Currently, 'COMPUTED_STYLES', 'CORE_VITALS' and 'STYLE_PROPERTIES' widgets are supported.
|
|
767
|
+
* For these, the corresponding \`make...Widget\` functions are called to construct the necessary
|
|
768
|
+
* data and configuration for the UI components. The widget is then rendered using the
|
|
769
|
+
* \`<devtools-widget>\` custom element, which dynamically instantiates and displays the
|
|
770
|
+
* specified UI.Widget subclass with the provided configuration.
|
|
736
771
|
*
|
|
737
772
|
* This allows for a flexible and extensible system where new widget types
|
|
738
773
|
* can be added to the AI responses and rendered in DevTools by adding
|
|
739
|
-
* corresponding
|
|
774
|
+
* corresponding \`make...Widget\` functions and handling them here.
|
|
740
775
|
*/
|
|
741
|
-
async function
|
|
742
|
-
|
|
776
|
+
async function renderWidgets(
|
|
777
|
+
widgets: AiWidget[]|undefined, options: {wrapperClass?: string} = {}): Promise<Lit.LitTemplate> {
|
|
778
|
+
if (!Root.Runtime.hostConfig.devToolsAiAssistanceV2?.enabled || !widgets || widgets.length === 0) {
|
|
743
779
|
return Lit.nothing;
|
|
744
780
|
}
|
|
745
|
-
const ui = await Promise.all(
|
|
781
|
+
const ui = await Promise.all(widgets.map(async widgetData => {
|
|
782
|
+
let response: WidgetMakerResponse|null = null;
|
|
746
783
|
if (widgetData.name === 'COMPUTED_STYLES') {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
if (widgetData.name === '
|
|
751
|
-
|
|
752
|
-
return renderWidgetResponse(response);
|
|
784
|
+
response = await makeComputedStyleWidget(widgetData);
|
|
785
|
+
} else if (widgetData.name === 'CORE_VITALS') {
|
|
786
|
+
response = await makeCoreVitalsWidget(widgetData);
|
|
787
|
+
} else if (widgetData.name === 'STYLE_PROPERTIES') {
|
|
788
|
+
response = await makeStylePropertiesWidget(widgetData);
|
|
753
789
|
}
|
|
754
|
-
return
|
|
790
|
+
return renderWidgetResponse(response);
|
|
755
791
|
}));
|
|
792
|
+
|
|
793
|
+
if (options.wrapperClass) {
|
|
794
|
+
return html`<div class=${options.wrapperClass}>${ui}</div>`;
|
|
795
|
+
}
|
|
796
|
+
|
|
756
797
|
return html`${ui}`;
|
|
757
798
|
}
|
|
758
799
|
|
|
@@ -807,6 +848,9 @@ function renderError(message: ModelChatMessage): Lit.LitTemplate {
|
|
|
807
848
|
case AiAssistanceModel.AiAgent.ErrorType.MAX_STEPS:
|
|
808
849
|
errorMessage = UIStringsNotTranslate.maxStepsError;
|
|
809
850
|
break;
|
|
851
|
+
case AiAssistanceModel.AiAgent.ErrorType.CROSS_ORIGIN:
|
|
852
|
+
errorMessage = UIStringsNotTranslate.crossOriginError;
|
|
853
|
+
break;
|
|
810
854
|
case AiAssistanceModel.AiAgent.ErrorType.ABORT:
|
|
811
855
|
return html`<p class="aborted" jslog=${VisualLogging.section('aborted')}>${
|
|
812
856
|
lockedString(UIStringsNotTranslate.stoppedResponse)}</p>`;
|
|
@@ -33,16 +33,21 @@ export class MarkdownRendererWithCodeBlock extends MarkdownView.MarkdownView.Mar
|
|
|
33
33
|
}}>${Platform.StringUtilities.trimEndWithMaxLength(label, 100)}</devtools-link>`;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
#renderLink(
|
|
36
|
+
#renderLink(
|
|
37
|
+
href: string,
|
|
38
|
+
fallbackText: string,
|
|
39
|
+
): Lit.LitTemplate|null {
|
|
37
40
|
if (href.startsWith('#req-')) {
|
|
38
|
-
const request =
|
|
39
|
-
|
|
41
|
+
const request = Logs.NetworkLog.NetworkLog.instance().requests().find(
|
|
42
|
+
req => req.requestId() === href.substring(5),
|
|
43
|
+
);
|
|
40
44
|
|
|
41
45
|
if (request) {
|
|
42
46
|
return this.#revealableLink(request, request.url());
|
|
43
47
|
}
|
|
44
|
-
|
|
45
|
-
}
|
|
48
|
+
return html`${fallbackText}`;
|
|
49
|
+
}
|
|
50
|
+
if (href.startsWith('#file-')) {
|
|
46
51
|
const file = AiAssistanceModel.ContextSelectionAgent.ContextSelectionAgent.getUISourceCodes().find(
|
|
47
52
|
file => AiAssistanceModel.ContextSelectionAgent.ContextSelectionAgent.uiSourceCodeId.get(file) ===
|
|
48
53
|
Number(href.substring(6)));
|
|
@@ -50,13 +55,14 @@ export class MarkdownRendererWithCodeBlock extends MarkdownView.MarkdownView.Mar
|
|
|
50
55
|
if (file) {
|
|
51
56
|
return this.#revealableLink(file, file.name());
|
|
52
57
|
}
|
|
58
|
+
return html`${fallbackText}`;
|
|
53
59
|
}
|
|
54
60
|
return null;
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
override templateForToken(token: Marked.Marked.MarkedToken): Lit.LitTemplate|null {
|
|
58
64
|
if (token.type === 'link') {
|
|
59
|
-
const link = this.#renderLink(token.href);
|
|
65
|
+
const link = this.#renderLink(token.href, token.text);
|
|
60
66
|
if (link) {
|
|
61
67
|
return link;
|
|
62
68
|
}
|
|
@@ -73,9 +79,12 @@ export class MarkdownRendererWithCodeBlock extends MarkdownView.MarkdownView.Mar
|
|
|
73
79
|
if (token.type === 'codespan') {
|
|
74
80
|
// LLM likes outputting the link inside a codespan block.
|
|
75
81
|
// Remove the codespan and render the link directly
|
|
76
|
-
const matches = token.text.match(/^\[
|
|
77
|
-
if (matches?.[
|
|
78
|
-
const link = this.#renderLink(
|
|
82
|
+
const matches = token.text.match(/^\[(.*)\]\((.+)\)$/);
|
|
83
|
+
if (matches?.[2]) {
|
|
84
|
+
const link = this.#renderLink(
|
|
85
|
+
matches[2],
|
|
86
|
+
matches[1],
|
|
87
|
+
);
|
|
79
88
|
if (link) {
|
|
80
89
|
return link;
|
|
81
90
|
}
|
|
@@ -354,6 +354,17 @@
|
|
|
354
354
|
width: fit-content;
|
|
355
355
|
}
|
|
356
356
|
|
|
357
|
+
.styling-preview-widget {
|
|
358
|
+
width: 100%;
|
|
359
|
+
min-height: 100px;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.main-widgets-wrapper {
|
|
363
|
+
display: flex;
|
|
364
|
+
flex-direction: column;
|
|
365
|
+
gap: var(--sys-size-5);
|
|
366
|
+
}
|
|
367
|
+
|
|
357
368
|
.step-widgets-wrapper {
|
|
358
369
|
width: fit-content;
|
|
359
370
|
display: flex;
|
|
@@ -22,7 +22,7 @@ import * as ApplicationComponents from './components/components.js';
|
|
|
22
22
|
|
|
23
23
|
const {styleMap, classMap, ref} = Directives;
|
|
24
24
|
const {linkifyURL} = Components.Linkifier.Linkifier;
|
|
25
|
-
const {widgetConfig} = UI.Widget;
|
|
25
|
+
const {widget, widgetConfig} = UI.Widget;
|
|
26
26
|
|
|
27
27
|
const UIStrings = {
|
|
28
28
|
/**
|
|
@@ -1095,12 +1095,11 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
|
1095
1095
|
render(html`
|
|
1096
1096
|
<style>${appManifestViewStyles}</style>
|
|
1097
1097
|
<style>${UI.inspectorCommonStyles}</style>
|
|
1098
|
-
${isEmpty ?
|
|
1099
|
-
<devtools-widget .widgetConfig=${widgetConfig(UI.EmptyWidget.EmptyWidget, {
|
|
1098
|
+
${isEmpty ? widget(UI.EmptyWidget.EmptyWidget, {
|
|
1100
1099
|
header: i18nString(UIStrings.noManifestDetected),
|
|
1101
1100
|
text: i18nString(UIStrings.manifestDescription),
|
|
1102
1101
|
link: 'https://web.dev/add-manifest/' as Platform.DevToolsPath.UrlString
|
|
1103
|
-
})
|
|
1102
|
+
}) : html`
|
|
1104
1103
|
<devtools-report .data=${{reportTitle: i18nString(UIStrings.appManifest), reportUrl: url}}>
|
|
1105
1104
|
${renderErrors(warnings, errors, imageErrors, output)}
|
|
1106
1105
|
${installabilityErrors?.length ? renderInstallability(installabilityErrors) : nothing}
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
type SessionAndEvents
|
|
20
20
|
} from './DeviceBoundSessionsModel.js';
|
|
21
21
|
import deviceBoundSessionsViewStyles from './deviceBoundSessionsView.css.js';
|
|
22
|
-
const {widgetConfig} = UI.Widget;
|
|
22
|
+
const {widget, widgetConfig} = UI.Widget;
|
|
23
23
|
|
|
24
24
|
const UIStrings = {
|
|
25
25
|
/**
|
|
@@ -727,28 +727,24 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: ViewOutput, target: HTML
|
|
|
727
727
|
if (!failedRequest) {
|
|
728
728
|
return nothing;
|
|
729
729
|
}
|
|
730
|
+
// clang-format off
|
|
730
731
|
return html`${failedRequest.requestUrl && html`
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
<devtools-widget .widgetConfig=${UI.Widget.widgetConfig(SourceFrame.JSONView.SearchableJsonView, {
|
|
748
|
-
jsonObject: tryParseJson(failedRequest.responseErrorBody),
|
|
749
|
-
})}></devtools-widget>
|
|
750
|
-
</devtools-report-value>
|
|
751
|
-
`}`;
|
|
732
|
+
<devtools-report-key>${i18nString(UIStrings.failedRequestUrl)}</devtools-report-key>
|
|
733
|
+
<devtools-report-value>${failedRequest.requestUrl}</devtools-report-value>`}
|
|
734
|
+
${failedRequest.netError && html`
|
|
735
|
+
<devtools-report-key>${i18nString(UIStrings.failedRequestNetError)}</devtools-report-key>
|
|
736
|
+
<devtools-report-value>${failedRequest.netError}</devtools-report-value>`}
|
|
737
|
+
${failedRequest.responseError !== undefined ? html`
|
|
738
|
+
<devtools-report-key>${i18nString(UIStrings.failedRequestResponseCode)}</devtools-report-key>
|
|
739
|
+
<devtools-report-value>${failedRequest.responseError}</devtools-report-value>` : nothing}
|
|
740
|
+
${failedRequest.responseErrorBody && html`
|
|
741
|
+
<devtools-report-key>${i18nString(UIStrings.failedRequestResponseBody)}</devtools-report-key>
|
|
742
|
+
<devtools-report-value>
|
|
743
|
+
${widget(SourceFrame.JSONView.SearchableJsonView, {
|
|
744
|
+
jsonObject: tryParseJson(failedRequest.responseErrorBody),
|
|
745
|
+
})}
|
|
746
|
+
</devtools-report-value>`}`;
|
|
747
|
+
// clang-format on
|
|
752
748
|
};
|
|
753
749
|
|
|
754
750
|
const creationEventDetails =
|
|
@@ -30,7 +30,7 @@ import * as ApplicationComponents from './components/components.js';
|
|
|
30
30
|
import frameDetailsReportViewStyles from './frameDetailsReportView.css.js';
|
|
31
31
|
import {OriginTrialTreeView} from './OriginTrialTreeView.js';
|
|
32
32
|
|
|
33
|
-
const {widgetConfig} = UI.Widget;
|
|
33
|
+
const {widget, widgetConfig} = UI.Widget;
|
|
34
34
|
|
|
35
35
|
const UIStrings = {
|
|
36
36
|
/**
|
|
@@ -297,11 +297,10 @@ const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
|
297
297
|
${renderIsolationSection(input)}
|
|
298
298
|
${renderApiAvailabilitySection(input.frame)}
|
|
299
299
|
${renderOriginTrial(input.trials)}
|
|
300
|
-
${input.permissionsPolicies ?
|
|
301
|
-
|
|
300
|
+
${input.permissionsPolicies ?
|
|
301
|
+
widget(ApplicationComponents.PermissionsPolicySection.PermissionsPolicySection, {
|
|
302
302
|
policies: input.permissionsPolicies,
|
|
303
|
-
showDetails: false})}
|
|
304
|
-
</devtools-widget>` : nothing}
|
|
303
|
+
showDetails: false}) : nothing}
|
|
305
304
|
${input.protocolMonitorExperimentEnabled ? renderAdditionalInfoSection(input.frame) : nothing}
|
|
306
305
|
</devtools-report>
|
|
307
306
|
`, target);
|
|
@@ -434,10 +433,7 @@ function renderOwnerElement(linkTargetDOMNode: SDK.DOMModel.DOMNode|null): LitTe
|
|
|
434
433
|
<devtools-report-key>${i18nString(UIStrings.ownerElement)}</devtools-report-key>
|
|
435
434
|
<devtools-report-value class="without-min-width">
|
|
436
435
|
<div class="inline-items">
|
|
437
|
-
|
|
438
|
-
node: linkTargetDOMNode
|
|
439
|
-
})}>
|
|
440
|
-
</devtools-widget>
|
|
436
|
+
${widget(PanelCommon.DOMLinkifier.DOMNodeLink, {node: linkTargetDOMNode})}
|
|
441
437
|
</div>
|
|
442
438
|
</devtools-report-value>
|
|
443
439
|
`;
|
|
@@ -454,9 +450,8 @@ function maybeRenderCreationStacktrace(stackTrace: StackTrace.StackTrace.StackTr
|
|
|
454
450
|
<devtools-report-key title=${i18nString(UIStrings.creationStackTraceExplanation)}>${
|
|
455
451
|
i18nString(UIStrings.creationStackTrace)}</devtools-report-key>
|
|
456
452
|
<devtools-report-value jslog=${VisualLogging.section('frame-creation-stack-trace')}>
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
</devtools-widget>
|
|
453
|
+
${widget(Components.JSPresentationUtils.StackTracePreviewContent,
|
|
454
|
+
{stackTrace, options: {expandable: true}})}
|
|
460
455
|
</devtools-report-value>
|
|
461
456
|
`;
|
|
462
457
|
// clang-format on
|
|
@@ -524,9 +519,8 @@ function maybeRenderCreatorAdScriptAncestry(
|
|
|
524
519
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
525
520
|
// clang-format off
|
|
526
521
|
return html`<div>
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
</devtools-widget>
|
|
522
|
+
${widget(Components.Linkifier.ScriptLocationLink,
|
|
523
|
+
{target, scriptId: adScriptId.scriptId, options: {jslogContext: 'ad-script'}})}
|
|
530
524
|
</div>`;
|
|
531
525
|
// clang-format on
|
|
532
526
|
});
|
|
@@ -16,7 +16,7 @@ import originTrialTokenRowsStyles from './originTrialTokenRows.css.js';
|
|
|
16
16
|
import originTrialTreeViewStyles from './originTrialTreeView.css.js';
|
|
17
17
|
|
|
18
18
|
const {classMap} = Directives;
|
|
19
|
-
const {
|
|
19
|
+
const {widget} = UI.Widget;
|
|
20
20
|
|
|
21
21
|
const UIStrings = {
|
|
22
22
|
/**
|
|
@@ -131,8 +131,7 @@ interface TokenField {
|
|
|
131
131
|
function renderTokenDetails(token: Protocol.Page.OriginTrialTokenWithStatus): TemplateResult {
|
|
132
132
|
return html`
|
|
133
133
|
<li role="treeitem">
|
|
134
|
-
|
|
135
|
-
</devtools-widget>
|
|
134
|
+
${widget(OriginTrialTokenRows, {data: token})}
|
|
136
135
|
</li>`;
|
|
137
136
|
}
|
|
138
137
|
|
|
@@ -13,7 +13,7 @@ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
|
13
13
|
|
|
14
14
|
import * as ApplicationComponents from './components/components.js';
|
|
15
15
|
|
|
16
|
-
const {widgetConfig} = UI.Widget;
|
|
16
|
+
const {widget, widgetConfig} = UI.Widget;
|
|
17
17
|
|
|
18
18
|
const UIStrings = {
|
|
19
19
|
/**
|
|
@@ -66,34 +66,30 @@ export const DEFAULT_VIEW = (input: ViewInput, output: undefined, target: HTMLEl
|
|
|
66
66
|
${input.hasReports ? html`
|
|
67
67
|
<devtools-split-view slot="main" sidebar-position="second" sidebar-initial-size="150">
|
|
68
68
|
<div slot="main">
|
|
69
|
-
|
|
69
|
+
${widget(ApplicationComponents.ReportsGrid.ReportsGrid, {
|
|
70
70
|
reports: input.reports, onReportSelected: input.onReportSelected,
|
|
71
|
-
})}
|
|
71
|
+
})}
|
|
72
72
|
</div>
|
|
73
73
|
<div slot="sidebar" class="vbox" jslog=${VisualLogging.pane('preview').track({resize: true})}>
|
|
74
|
-
${input.focusedReport
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
header: i18nString(UIStrings.noReportSelected),
|
|
81
|
-
text: i18nString(UIStrings.clickToDisplayBody),
|
|
82
|
-
})}></devtools-widget>
|
|
83
|
-
`}
|
|
74
|
+
${input.focusedReport
|
|
75
|
+
? widget(SourceFrame.JSONView.SearchableJsonView, {jsonObject: input.focusedReport.body})
|
|
76
|
+
: widget(UI.EmptyWidget.EmptyWidget, {
|
|
77
|
+
header: i18nString(UIStrings.noReportSelected),
|
|
78
|
+
text: i18nString(UIStrings.clickToDisplayBody),
|
|
79
|
+
})}
|
|
84
80
|
</div>
|
|
85
81
|
</devtools-split-view>
|
|
86
82
|
` : html`
|
|
87
83
|
<div slot="main">
|
|
88
|
-
|
|
84
|
+
${widget(ApplicationComponents.ReportsGrid.ReportsGrid, {
|
|
89
85
|
reports: input.reports, onReportSelected: input.onReportSelected,
|
|
90
|
-
})}
|
|
86
|
+
})}
|
|
91
87
|
</div>
|
|
92
88
|
`}
|
|
93
89
|
<div slot="sidebar">
|
|
94
|
-
|
|
90
|
+
${widget(ApplicationComponents.EndpointsGrid.EndpointsGrid, {
|
|
95
91
|
endpoints: input.endpoints,
|
|
96
|
-
})}
|
|
92
|
+
})}
|
|
97
93
|
</div>
|
|
98
94
|
</devtools-split-view>
|
|
99
95
|
`, target);
|
|
@@ -147,7 +147,7 @@ const UIStrings = {
|
|
|
147
147
|
|
|
148
148
|
const str_ = i18n.i18n.registerUIStrings('panels/application/components/BackForwardCacheView.ts', UIStrings);
|
|
149
149
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
150
|
-
const {
|
|
150
|
+
const {widget} = UI.Widget;
|
|
151
151
|
|
|
152
152
|
const enum ScreenStatusType {
|
|
153
153
|
RUNNING = 'Running',
|
|
@@ -387,7 +387,7 @@ function maybeRenderJavaScriptDetails(details: Protocol.Page.BackForwardCacheBlo
|
|
|
387
387
|
const maxLengthForDisplayedURLs = 50;
|
|
388
388
|
const rows = [html`<div>${i18nString(UIStrings.filesPerIssue, {n: details.length})}</div>`];
|
|
389
389
|
rows.push(...details.map(detail => html`
|
|
390
|
-
|
|
390
|
+
${widget(Components.Linkifier.ScriptLocationLink, {
|
|
391
391
|
sourceURL: detail.url as Platform.DevToolsPath.UrlString,
|
|
392
392
|
lineNumber: detail.lineNumber,
|
|
393
393
|
options: {
|
|
@@ -396,7 +396,7 @@ function maybeRenderJavaScriptDetails(details: Protocol.Page.BackForwardCacheBlo
|
|
|
396
396
|
inlineFrameIndex: 0,
|
|
397
397
|
maxLength: maxLengthForDisplayedURLs,
|
|
398
398
|
}
|
|
399
|
-
})}
|
|
399
|
+
})}`));
|
|
400
400
|
return html`
|
|
401
401
|
<div class="details-list">
|
|
402
402
|
<devtools-expandable-list .data=${
|
|
@@ -134,7 +134,7 @@ const UIStrings = {
|
|
|
134
134
|
const str_ = i18n.i18n.registerUIStrings('panels/application/preloading/components/UsedPreloadingView.ts', UIStrings);
|
|
135
135
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
136
136
|
|
|
137
|
-
const {
|
|
137
|
+
const {widget} = UI.Widget;
|
|
138
138
|
|
|
139
139
|
export interface UsedPreloadingViewData {
|
|
140
140
|
pageURL: Platform.DevToolsPath.UrlString;
|
|
@@ -270,8 +270,7 @@ function renderMismatchedSections(data: MismatchedData): LitTemplate {
|
|
|
270
270
|
${i18nString(UIStrings.preloadedURLs)}
|
|
271
271
|
</devtools-report-section-header>
|
|
272
272
|
<devtools-report-section jslog=${VisualLogging.section('preloaded-urls')}>
|
|
273
|
-
|
|
274
|
-
</devtools-widget>
|
|
273
|
+
${widget(MismatchedPreloadingGrid, {data})}
|
|
275
274
|
</devtools-report-section>`;
|
|
276
275
|
// clang-format on
|
|
277
276
|
}
|
|
@@ -107,6 +107,7 @@ const DOM_BREAKPOINT_DOCUMENTATION_URL =
|
|
|
107
107
|
'https://developer.chrome.com/docs/devtools/javascript/breakpoints#dom' as Platform.DevToolsPath.UrlString;
|
|
108
108
|
|
|
109
109
|
const {html, render, Directives} = Lit;
|
|
110
|
+
const {widget} = UI.Widget;
|
|
110
111
|
|
|
111
112
|
export interface Breakpoint {
|
|
112
113
|
breakpoint: SDK.DOMDebuggerModel.DOMBreakpoint;
|
|
@@ -169,11 +170,11 @@ export const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
|
169
170
|
</ul>` : html
|
|
170
171
|
`<div class="placeholder">
|
|
171
172
|
<div class="gray-info-message">${i18nString(UIStrings.noBreakpoints)}</div>
|
|
172
|
-
|
|
173
|
+
${widget(UI.EmptyWidget.EmptyWidget, {
|
|
173
174
|
header: i18nString(UIStrings.noBreakpoints),
|
|
174
175
|
text: i18nString(UIStrings.domBreakpointsDescription),
|
|
175
176
|
link: DOM_BREAKPOINT_DOCUMENTATION_URL,
|
|
176
|
-
})}
|
|
177
|
+
})}
|
|
177
178
|
</div>`}
|
|
178
179
|
</div>
|
|
179
180
|
`,
|
|
@@ -34,6 +34,8 @@ const UIStrings = {
|
|
|
34
34
|
const str_ = i18n.i18n.registerUIStrings('panels/changes/ChangesView.ts', UIStrings);
|
|
35
35
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
36
36
|
const {render, html} = Lit;
|
|
37
|
+
const {widget} = UI.Widget;
|
|
38
|
+
|
|
37
39
|
interface ViewInput {
|
|
38
40
|
selectedSourceCode: Workspace.UISourceCode.UISourceCode|null;
|
|
39
41
|
onSelect(sourceCode: Workspace.UISourceCode.UISourceCode|null): void;
|
|
@@ -63,10 +65,10 @@ export const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
|
63
65
|
})}>
|
|
64
66
|
</devtools-widget>
|
|
65
67
|
<div class=diff-container role=tabpanel ?hidden=${input.workspaceDiff.modifiedUISourceCodes().length === 0}>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
${widget(CombinedDiffView.CombinedDiffView, {
|
|
69
|
+
selectedFileUrl: input.selectedSourceCode?.url(),
|
|
70
|
+
workspaceDiff: input.workspaceDiff
|
|
71
|
+
})}
|
|
70
72
|
</div>
|
|
71
73
|
${hasCopyToPrompt ? html`
|
|
72
74
|
<devtools-widget class="copy-to-prompt"
|
|
@@ -20,6 +20,7 @@ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
|
20
20
|
import consolePinPaneStyles from './consolePinPane.css.js';
|
|
21
21
|
|
|
22
22
|
const {createRef, ref} = Directives;
|
|
23
|
+
const {widget} = UI.Widget;
|
|
23
24
|
|
|
24
25
|
const UIStrings = {
|
|
25
26
|
/**
|
|
@@ -71,12 +72,11 @@ export const DEFAULT_PANE_VIEW = (input: PaneViewInput, _output: object, target:
|
|
|
71
72
|
render(html`
|
|
72
73
|
<style>${consolePinPaneStyles}</style>
|
|
73
74
|
<div class='console-pins monospace' jslog=${VisualLogging.pane('console-pins')} @contextmenu=${input.onContextMenu}>
|
|
74
|
-
${input.pins.map(pin =>
|
|
75
|
-
<devtools-widget .widgetConfig=${UI.Widget.widgetConfig(ConsolePinPresenter, {
|
|
75
|
+
${input.pins.map(pin => widget(ConsolePinPresenter, {
|
|
76
76
|
pin,
|
|
77
77
|
focusOut: input.focusOut,
|
|
78
78
|
onRemove: () => input.onRemove(pin),
|
|
79
|
-
|
|
79
|
+
})
|
|
80
80
|
)}
|
|
81
81
|
</div>`, target);
|
|
82
82
|
// clang-format on
|
|
@@ -340,7 +340,7 @@ function renderItem(info: CoverageListItem, input: ViewInput): TemplateResult {
|
|
|
340
340
|
</td>
|
|
341
341
|
${info.sources.length > 0 ? html`
|
|
342
342
|
<td><table>
|
|
343
|
-
${ifExpanded(
|
|
343
|
+
${ifExpanded(html`${repeat(info.sources, source => source.url, source => renderItem(source, input))}`)}
|
|
344
344
|
</table></td>` : nothing}
|
|
345
345
|
</tr>`;
|
|
346
346
|
// clang-format on
|