chrome-devtools-frontend 1.0.1681498 → 1.0.1682249

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.
Files changed (141) hide show
  1. package/eslint.config.mjs +8 -3
  2. package/front_end/core/sdk/ConsoleModel.ts +1 -1
  3. package/front_end/core/sdk/PreloadingModel.ts +44 -22
  4. package/front_end/core/sdk/RemoteObject.ts +4 -1
  5. package/front_end/core/sdk/RuntimeModel.ts +5 -5
  6. package/front_end/core/sdk/sdk.ts +2 -0
  7. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +1 -1
  8. package/front_end/entrypoints/inspector_main/InspectorMain.ts +3 -1
  9. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +1 -5
  10. package/front_end/entrypoints/main/MainImpl.ts +9 -10
  11. package/front_end/entrypoints/shell/shell.ts +0 -2
  12. package/front_end/entrypoints/trace_app/trace_app.ts +0 -2
  13. package/front_end/generated/InspectorBackendCommands.ts +2 -0
  14. package/front_end/generated/protocol-mapping.d.ts +16 -0
  15. package/front_end/generated/protocol-proxy-api.d.ts +12 -0
  16. package/front_end/generated/protocol.ts +12 -0
  17. package/front_end/models/ai_assistance/ExtensionScope.ts +11 -12
  18. package/front_end/models/ai_assistance/agents/AiAgent.ts +1 -1
  19. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +2 -1
  20. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +1 -1
  21. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +2 -1
  22. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +2 -1
  23. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +8 -8
  24. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +8 -8
  25. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +1 -0
  26. package/front_end/models/formatter/ScriptFormatter.ts +1 -0
  27. package/front_end/models/javascript_metadata/NativeFunctions.js +5 -1
  28. package/front_end/models/live-metrics/web-vitals-injected/spec/spec.ts +4 -4
  29. package/front_end/models/logs/NetworkLog.ts +8 -1
  30. package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +4 -2
  31. package/front_end/models/stack_trace/StackTraceImpl.ts +1 -0
  32. package/front_end/models/trace/Name.ts +5 -5
  33. package/front_end/models/trace/Styles.ts +115 -115
  34. package/front_end/models/trace/extras/TraceTree.ts +2 -1
  35. package/front_end/models/trace/helpers/Network.ts +4 -1
  36. package/front_end/models/trace/insights/CLSCulprits.ts +4 -2
  37. package/front_end/models/trace/insights/CharacterSet.ts +3 -3
  38. package/front_end/models/trace/insights/DOMSize.ts +1 -1
  39. package/front_end/models/trace/insights/DuplicatedJavaScript.ts +6 -2
  40. package/front_end/models/trace/insights/FontDisplay.ts +9 -3
  41. package/front_end/models/trace/insights/ForcedReflow.ts +4 -4
  42. package/front_end/models/trace/insights/INPBreakdown.ts +3 -4
  43. package/front_end/models/trace/insights/ImageDelivery.ts +2 -2
  44. package/front_end/models/trace/insights/LCPBreakdown.ts +1 -1
  45. package/front_end/models/trace/insights/LCPDiscovery.ts +5 -5
  46. package/front_end/models/trace/insights/LegacyJavaScript.ts +7 -3
  47. package/front_end/models/trace/insights/ModernHTTP.ts +3 -3
  48. package/front_end/models/trace/insights/NetworkDependencyTree.ts +13 -9
  49. package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
  50. package/front_end/models/trace/insights/SlowCSSSelector.ts +29 -25
  51. package/front_end/models/trace/insights/ThirdParties.ts +13 -5
  52. package/front_end/models/trace/insights/Viewport.ts +4 -2
  53. package/front_end/models/workspace/IgnoreListManager.ts +53 -17
  54. package/front_end/panels/accessibility/ARIAAttributesView.ts +11 -2
  55. package/front_end/panels/ai_assistance/components/ChatMessage.ts +67 -53
  56. package/front_end/panels/ai_assistance/components/ChatView.ts +2 -2
  57. package/front_end/panels/ai_assistance/components/StylingAgentMarkdownRenderer.ts +2 -2
  58. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +5 -5
  59. package/front_end/panels/animation/AnimationTimeline.ts +2 -0
  60. package/front_end/panels/application/preloading/PreloadingView.ts +9 -3
  61. package/front_end/panels/application/preloading/components/components.ts +2 -0
  62. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +10 -11
  63. package/front_end/panels/changes/CombinedDiffView.ts +1 -1
  64. package/front_end/panels/common/ExtensionServer.ts +9 -10
  65. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +9 -4
  66. package/front_end/panels/elements/ElementStatePaneWidget.ts +3 -0
  67. package/front_end/panels/elements/ElementsTreeElement.ts +7 -1
  68. package/front_end/panels/elements/EventListenersWidget.ts +10 -11
  69. package/front_end/panels/issues/IssueView.ts +5 -6
  70. package/front_end/panels/linear_memory_inspector/components/LinearMemoryViewer.ts +1 -1
  71. package/front_end/panels/media/PlayerPropertiesView.ts +309 -416
  72. package/front_end/panels/media/playerPropertiesView.css +1 -1
  73. package/front_end/panels/network/NetworkPanel.ts +2 -1
  74. package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -2
  75. package/front_end/panels/network/network-meta.ts +6 -0
  76. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -1
  77. package/front_end/panels/recorder/RecordingView.ts +89 -73
  78. package/front_end/panels/recorder/ReplaySection.ts +59 -40
  79. package/front_end/panels/recorder/injected/injected.ts +4 -0
  80. package/front_end/panels/security/SecurityPanel.ts +5 -6
  81. package/front_end/panels/security/SecurityPanelSidebar.ts +244 -204
  82. package/front_end/panels/security/security.ts +0 -4
  83. package/front_end/panels/settings/EditFileSystemView.ts +8 -7
  84. package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +20 -14
  85. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +10 -11
  86. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -3
  87. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +5 -5
  88. package/front_end/panels/timeline/components/CWVMetrics.ts +1 -2
  89. package/front_end/panels/timeline/components/IgnoreListSetting.ts +5 -5
  90. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +2 -3
  91. package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
  92. package/front_end/panels/timeline/components/Sidebar.ts +3 -3
  93. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -2
  94. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +3 -1
  95. package/front_end/panels/timeline/components/insights/CLSCulprits.ts +1 -2
  96. package/front_end/panels/timeline/components/insights/Cache.ts +1 -2
  97. package/front_end/panels/timeline/components/insights/CharacterSet.ts +1 -2
  98. package/front_end/panels/timeline/components/insights/DOMSize.ts +1 -2
  99. package/front_end/panels/timeline/components/insights/DocumentLatency.ts +2 -2
  100. package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +2 -2
  101. package/front_end/panels/timeline/components/insights/FontDisplay.ts +1 -2
  102. package/front_end/panels/timeline/components/insights/ForcedReflow.ts +1 -2
  103. package/front_end/panels/timeline/components/insights/INPBreakdown.ts +1 -2
  104. package/front_end/panels/timeline/components/insights/ImageDelivery.ts +1 -2
  105. package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +13 -13
  106. package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +1 -2
  107. package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +4 -4
  108. package/front_end/panels/timeline/components/insights/ModernHTTP.ts +1 -2
  109. package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +10 -8
  110. package/front_end/panels/timeline/components/insights/RenderBlocking.ts +2 -2
  111. package/front_end/panels/timeline/components/insights/SidebarInsight.ts +3 -1
  112. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
  113. package/front_end/panels/timeline/components/insights/ThirdParties.ts +1 -2
  114. package/front_end/panels/timeline/components/insights/Viewport.ts +1 -2
  115. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -2
  116. package/front_end/panels/timeline/timeline.ts +0 -2
  117. package/front_end/panels/web_audio/WebAudioView.ts +7 -7
  118. package/front_end/panels/webauthn/WebauthnPane.ts +9 -9
  119. package/front_end/third_party/chromium/README.chromium +1 -1
  120. package/front_end/ui/components/diff_view/DiffView.ts +2 -1
  121. package/front_end/ui/components/report_view/ReportView.docs.ts +2 -2
  122. package/front_end/ui/components/text_editor/javascript.ts +12 -13
  123. package/front_end/ui/legacy/GlassPane.ts +38 -14
  124. package/front_end/ui/legacy/Treeoutline.ts +14 -3
  125. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +1 -1
  126. package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +1 -1
  127. package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +1 -1
  128. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +21 -30
  129. package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +3 -8
  130. package/front_end/ui/legacy/components/utils/ImagePreview.ts +15 -16
  131. package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +4 -4
  132. package/front_end/ui/legacy/components/utils/Linkifier.ts +8 -10
  133. package/front_end/ui/settings/InspectorMainSettings.ts +12 -0
  134. package/front_end/ui/settings/settings.ts +2 -0
  135. package/front_end/ui/visual_logging/KnownContextValues.ts +21 -0
  136. package/mcp/mcp.ts +0 -6
  137. package/package.json +1 -1
  138. package/front_end/models/logs/logs-meta.ts +0 -24
  139. package/front_end/models/workspace/workspace-meta.ts +0 -40
  140. package/front_end/panels/security/OriginTreeElement.ts +0 -60
  141. package/front_end/panels/security/SecurityPanelSidebarTreeElement.ts +0 -30
@@ -163,17 +163,16 @@ export async function evaluateScriptSnippet(uiSourceCode: Workspace.UISourceCode
163
163
 
164
164
  const url = uiSourceCode.url();
165
165
 
166
- const result = await executionContext.evaluate(
167
- {
168
- expression: `${expression}\n//# sourceURL=${url}`,
169
- objectGroup: 'console',
170
- silent: false,
171
- includeCommandLineAPI: true,
172
- returnByValue: false,
173
- generatePreview: true,
174
- replMode: true,
175
- } as SDK.RuntimeModel.EvaluationOptions,
176
- true, true);
166
+ const result = await executionContext.evaluateWithSelectedFrameFallback({
167
+ expression: `${expression}\n//# sourceURL=${url}`,
168
+ objectGroup: 'console',
169
+ silent: false,
170
+ includeCommandLineAPI: true,
171
+ returnByValue: false,
172
+ generatePreview: true,
173
+ replMode: true,
174
+ } as SDK.RuntimeModel.EvaluationOptions,
175
+ true, true);
177
176
 
178
177
  if ('exceptionDetails' in result && result.exceptionDetails) {
179
178
  consoleModel?.addMessage(SDK.ConsoleModel.ConsoleMessage.fromException(
@@ -663,7 +663,7 @@ export class WatchExpression {
663
663
  }
664
664
 
665
665
  try {
666
- const result = await executionContext.evaluate({
666
+ const result = await executionContext.evaluateWithSelectedFrameFallback({
667
667
  expression,
668
668
  objectGroup: WatchExpression.watchObjectGroupId,
669
669
  includeCommandLineAPI: false,
@@ -671,8 +671,8 @@ export class WatchExpression {
671
671
  returnByValue: false,
672
672
  generatePreview: false,
673
673
  },
674
- /* userGesture */ false,
675
- /* awaitPromise */ false);
674
+ /* userGesture */ false,
675
+ /* awaitPromise */ false);
676
676
  if ('object' in result) {
677
677
  const objectTree = new ObjectUI.ObjectPropertiesSection.ObjectTree(result.object, {
678
678
  readOnly: true,
@@ -174,19 +174,19 @@ export class TimelineFlameChartDataProvider extends Common.ObjectWrapper.ObjectW
174
174
  'screenshot-loaded', () => this.dispatchEventToListeners(Events.DATA_CHANGED));
175
175
 
176
176
  Common.Settings.Settings.instance()
177
- .moduleSetting('skip-stack-frames-pattern')
177
+ .resolve(Workspace.IgnoreListManager.skipStackFramesPatternSettingDescriptor)
178
178
  .addChangeListener(this.#onIgnoreListChanged.bind(this));
179
179
  Common.Settings.Settings.instance()
180
- .moduleSetting('skip-content-scripts')
180
+ .resolve(Workspace.IgnoreListManager.skipContentScriptsSettingDescriptor)
181
181
  .addChangeListener(this.#onIgnoreListChanged.bind(this));
182
182
  Common.Settings.Settings.instance()
183
- .moduleSetting('automatically-ignore-list-known-third-party-scripts')
183
+ .resolve(Workspace.IgnoreListManager.automaticallyIgnoreListKnownThirdPartyScriptsSettingDescriptor)
184
184
  .addChangeListener(this.#onIgnoreListChanged.bind(this));
185
185
  Common.Settings.Settings.instance()
186
- .moduleSetting('enable-ignore-listing')
186
+ .resolve(Workspace.IgnoreListManager.enableIgnoreListingSettingDescriptor)
187
187
  .addChangeListener(this.#onIgnoreListChanged.bind(this));
188
188
  Common.Settings.Settings.instance()
189
- .moduleSetting('skip-anonymous-scripts')
189
+ .resolve(Workspace.IgnoreListManager.skipAnonymousScriptsSettingDescriptor)
190
190
  .addChangeListener(this.#onIgnoreListChanged.bind(this));
191
191
  }
192
192
 
@@ -12,7 +12,6 @@ import * as Lit from '../../../ui/lit/lit.js';
12
12
  import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
13
13
 
14
14
  import cwvMetricsStyles from './cwvMetrics.css.js';
15
- import {md} from './insights/Helpers.js';
16
15
  import * as Insights from './insights/insights.js';
17
16
  import metricValueStyles from './metricValueStyles.css.js';
18
17
  import {isFieldWorseThanLocal, NumberWithUnit} from './Utils.js';
@@ -266,7 +265,7 @@ const CWV_METRICS_VIEW: MetricsView = (input, _output, target) => {
266
265
  .jslogContext=${'timeline.insights.dismiss-field-mismatch'}
267
266
  @click=${onDismisFieldMismatchNotice}
268
267
  ></devtools-button>
269
- <div class="field-mismatch-notice__body">${md(i18nString(UIStrings.fieldMismatchNotice))}</div>
268
+ <div class="field-mismatch-notice__body">${Insights.Helpers.md(i18nString(UIStrings.fieldMismatchNotice))}</div>
270
269
  </div>
271
270
  `;
272
271
  // clang-format on
@@ -173,7 +173,7 @@ export class IgnoreListSetting extends UI.Widget.Widget {
173
173
 
174
174
  #view: View;
175
175
  readonly #ignoreListEnabled: Common.Settings.Setting<boolean> =
176
- Common.Settings.Settings.instance().moduleSetting('enable-ignore-listing');
176
+ Common.Settings.Settings.instance().resolve(Workspace.IgnoreListManager.enableIgnoreListingSettingDescriptor);
177
177
  readonly #regexPatterns = this.#getSkipStackFramesPatternSetting().getAsArray();
178
178
  #newRegexValue = '';
179
179
  #newRegexChecked = false;
@@ -187,17 +187,17 @@ export class IgnoreListSetting extends UI.Widget.Widget {
187
187
  this.element.classList.remove('vbox', 'flex-auto');
188
188
 
189
189
  Common.Settings.Settings.instance()
190
- .moduleSetting('skip-stack-frames-pattern')
190
+ .resolve(Workspace.IgnoreListManager.skipStackFramesPatternSettingDescriptor)
191
191
  .addChangeListener(this.requestUpdate.bind(this));
192
192
  Common.Settings.Settings.instance()
193
- .moduleSetting('enable-ignore-listing')
193
+ .resolve(Workspace.IgnoreListManager.enableIgnoreListingSettingDescriptor)
194
194
  .addChangeListener(this.requestUpdate.bind(this));
195
195
  this.requestUpdate();
196
196
  }
197
197
 
198
198
  #getSkipStackFramesPatternSetting(): Common.Settings.RegExpSetting {
199
- return Common.Settings.Settings.instance().moduleSetting('skip-stack-frames-pattern') as
200
- Common.Settings.RegExpSetting;
199
+ return Common.Settings.Settings.instance().resolve(
200
+ Workspace.IgnoreListManager.skipStackFramesPatternSettingDescriptor) as Common.Settings.RegExpSetting;
201
201
  }
202
202
 
203
203
  #onNewRegexInputFocus(value: string): void {
@@ -15,7 +15,6 @@ import * as Lit from '../../../ui/lit/lit.js';
15
15
  import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
16
16
 
17
17
  import * as Insights from './insights/insights.js';
18
- import {nodeLink} from './insights/NodeLink.js';
19
18
  import layoutShiftDetailsStyles from './layoutShiftDetails.css.js';
20
19
 
21
20
  const {html, render} = Lit;
@@ -375,7 +374,7 @@ function renderShiftedElements(
375
374
  return html`
376
375
  ${elementsShifted?.map(el => {
377
376
  if (el.node_id !== undefined) {
378
- return nodeLink({
377
+ return Insights.NodeLink.nodeLink({
379
378
  backendNodeId: el.node_id,
380
379
  frame: shift.args.frame,
381
380
  fallbackHtmlSnippet: el.debug_name,
@@ -406,7 +405,7 @@ function renderAnimation(
406
405
 
407
406
  function renderUnsizedImage(
408
407
  frame: string, unsizedImage: Trace.Insights.Models.CLSCulprits.UnsizedImage): Lit.LitTemplate {
409
- const nodeLinkEl = nodeLink({
408
+ const nodeLinkEl = Insights.NodeLink.nodeLink({
410
409
  backendNodeId: unsizedImage.backendNodeId,
411
410
  frame,
412
411
  fallbackUrl: unsizedImage.paintImageEvent.args.data.url as Platform.DevToolsPath.UrlString | undefined,
@@ -28,7 +28,7 @@ import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
28
28
  import * as PanelsCommon from '../../common/common.js';
29
29
  import * as MobileThrottling from '../../mobile_throttling/mobile_throttling.js';
30
30
 
31
- import {md} from './insights/Helpers.js';
31
+ import * as Insights from './insights/insights.js';
32
32
  import liveMetricsViewStyles from './liveMetricsView.css.js';
33
33
  import type {MetricCardData} from './MetricCard.js';
34
34
  import metricValueStyles from './metricValueStyles.css.js';
@@ -633,7 +633,7 @@ function renderRecordingSettings(input: ViewInput): Lit.LitTemplate {
633
633
  // clang-format off
634
634
  return html`
635
635
  <h3 class="card-title">${i18nString(UIStrings.environmentSettings)}</h3>
636
- <div class="device-toolbar-description">${md(i18nString(UIStrings.useDeviceToolbar))}</div>
636
+ <div class="device-toolbar-description">${Insights.Helpers.md(i18nString(UIStrings.useDeviceToolbar))}</div>
637
637
  ${fieldEnabled ? html`
638
638
  <ul class="environment-recs-list">
639
639
  <li>${uiI18n.getFormatLocalizedStringTemplate(str_, UIStrings.device, {PH1: html`<span class="environment-rec">${deviceRec}</span>`})}</li>
@@ -7,7 +7,7 @@ import * as Common from '../../../core/common/common.js';
7
7
  import type * as Trace from '../../../models/trace/trace.js';
8
8
  import * as UI from '../../../ui/legacy/legacy.js';
9
9
 
10
- import {InsightActivated, InsightDeactivated} from './insights/SidebarInsight.js';
10
+ import * as Insights from './insights/insights.js';
11
11
  import {SidebarAnnotationsTab} from './SidebarAnnotationsTab.js';
12
12
  import {SidebarInsightsTab} from './SidebarInsightsTab.js';
13
13
 
@@ -107,7 +107,7 @@ export class SidebarWidget extends UI.Widget.VBox {
107
107
  this.#updateAnnotationsCountBadge();
108
108
 
109
109
  if (this.#insightToRestoreOnOpen) {
110
- this.element.dispatchEvent(new InsightActivated(
110
+ this.element.dispatchEvent(new Insights.SidebarInsight.InsightActivated(
111
111
  this.#insightToRestoreOnOpen.model,
112
112
  this.#insightToRestoreOnOpen.insightSetKey,
113
113
  ));
@@ -129,7 +129,7 @@ export class SidebarWidget extends UI.Widget.VBox {
129
129
  this.#insightToRestoreOnOpen = currentlyActiveInsight;
130
130
 
131
131
  if (currentlyActiveInsight) {
132
- this.element.dispatchEvent(new InsightDeactivated());
132
+ this.element.dispatchEvent(new Insights.SidebarInsight.InsightDeactivated());
133
133
  }
134
134
  }
135
135
 
@@ -9,7 +9,6 @@ import * as UI from '../../../ui/legacy/legacy.js';
9
9
  import * as Lit from '../../../ui/lit/lit.js';
10
10
 
11
11
  import {CWVMetrics, getFieldMetrics} from './CWVMetrics.js';
12
- import {shouldRenderForCategory} from './insights/Helpers.js';
13
12
  import * as Insights from './insights/insights.js';
14
13
  import type {ActiveInsight} from './Sidebar.js';
15
14
  import sidebarSingleInsightSetStyles from './sidebarSingleInsightSet.css.js';
@@ -182,7 +181,7 @@ export class SidebarSingleInsightSet extends UI.Widget.Widget {
182
181
  const passedInsights: InsightData[] = [];
183
182
 
184
183
  for (const [insightName, model] of Object.entries(insightSet.model)) {
185
- if (!model || !shouldRenderForCategory({activeCategory, insightCategory: model.category})) {
184
+ if (!model || !Insights.Helpers.shouldRenderForCategory({activeCategory, insightCategory: model.category})) {
186
185
  continue;
187
186
  }
188
187
 
@@ -8,7 +8,7 @@ import * as i18n from '../../../../core/i18n/i18n.js';
8
8
  import * as Root from '../../../../core/root/root.js';
9
9
  import * as AIAssistance from '../../../../models/ai_assistance/ai_assistance.js';
10
10
  import * as Badges from '../../../../models/badges/badges.js';
11
- import type {InsightModel} from '../../../../models/trace/insights/types.js';
11
+ import type * as Insights from '../../../../models/trace/insights/insights.js';
12
12
  import type * as Trace from '../../../../models/trace/trace.js';
13
13
  import * as Buttons from '../../../../ui/components/buttons/buttons.js';
14
14
  import * as UI from '../../../../ui/legacy/legacy.js';
@@ -21,6 +21,8 @@ import {md} from './Helpers.js';
21
21
  import * as SidebarInsight from './SidebarInsight.js';
22
22
  import type {TableState} from './Table.js';
23
23
 
24
+ type InsightModel = Insights.Types.InsightModel;
25
+
24
26
  const {html} = Lit;
25
27
 
26
28
  const UIStrings = {
@@ -4,7 +4,6 @@
4
4
 
5
5
  import * as i18n from '../../../../core/i18n/i18n.js';
6
6
  import type * as Platform from '../../../../core/platform/platform.js';
7
- import type {CLSCulpritsInsightModel} from '../../../../models/trace/insights/CLSCulprits.js';
8
7
  import * as Trace from '../../../../models/trace/trace.js';
9
8
  import * as Lit from '../../../../ui/lit/lit.js';
10
9
 
@@ -16,7 +15,7 @@ const {UIStrings, i18nString} = Trace.Insights.Models.CLSCulprits;
16
15
 
17
16
  const {html} = Lit;
18
17
 
19
- export class CLSCulprits extends BaseInsightComponent<CLSCulpritsInsightModel> {
18
+ export class CLSCulprits extends BaseInsightComponent<Trace.Insights.Models.CLSCulprits.CLSCulpritsInsightModel> {
20
19
  override internalName = 'cls-culprits';
21
20
 
22
21
  protected override hasAskAiSupport(): boolean {
@@ -5,7 +5,6 @@
5
5
  import './Table.js';
6
6
 
7
7
  import * as i18n from '../../../../core/i18n/i18n.js';
8
- import type {CacheInsightModel} from '../../../../models/trace/insights/Cache.js';
9
8
  import * as Trace from '../../../../models/trace/trace.js';
10
9
  import * as UI from '../../../../ui/legacy/legacy.js';
11
10
  import * as Lit from '../../../../ui/lit/lit.js';
@@ -19,7 +18,7 @@ const {UIStrings, i18nString, createOverlayForRequest} = Trace.Insights.Models.C
19
18
  const {html} = Lit;
20
19
  const {widget} = UI.Widget;
21
20
 
22
- export class Cache extends BaseInsightComponent<CacheInsightModel> {
21
+ export class Cache extends BaseInsightComponent<Trace.Insights.Models.Cache.CacheInsightModel> {
23
22
  override internalName = 'cache';
24
23
 
25
24
  protected override hasAskAiSupport(): boolean {
@@ -2,7 +2,6 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import type {CharacterSetInsightModel} from '../../../../models/trace/insights/CharacterSet.js';
6
5
  import type * as Trace from '../../../../models/trace/trace.js';
7
6
  import * as UI from '../../../../ui/legacy/legacy.js';
8
7
  import * as Lit from '../../../../ui/lit/lit.js';
@@ -13,7 +12,7 @@ import {Checklist} from './Checklist.js';
13
12
  const {html} = Lit;
14
13
  const {widget} = UI.Widget;
15
14
 
16
- export class CharacterSet extends BaseInsightComponent<CharacterSetInsightModel> {
15
+ export class CharacterSet extends BaseInsightComponent<Trace.Insights.Models.CharacterSet.CharacterSetInsightModel> {
17
16
  override internalName = 'character-set';
18
17
 
19
18
  protected override hasAskAiSupport(): boolean {
@@ -6,7 +6,6 @@ import '../../../../ui/kit/kit.js';
6
6
  import './Table.js';
7
7
 
8
8
  import * as i18n from '../../../../core/i18n/i18n.js';
9
- import type {DOMSizeInsightModel} from '../../../../models/trace/insights/DOMSize.js';
10
9
  import * as Trace from '../../../../models/trace/trace.js';
11
10
  import * as UI from '../../../../ui/legacy/legacy.js';
12
11
  import * as Lit from '../../../../ui/lit/lit.js';
@@ -22,7 +21,7 @@ const {UIStrings, i18nString} = Trace.Insights.Models.DOMSize;
22
21
  const {html} = Lit;
23
22
  const {widget} = UI.Widget;
24
23
 
25
- export class DOMSize extends BaseInsightComponent<DOMSizeInsightModel> {
24
+ export class DOMSize extends BaseInsightComponent<Trace.Insights.Models.DOMSize.DOMSizeInsightModel> {
26
25
  override internalName = 'dom-size';
27
26
 
28
27
  protected override hasAskAiSupport(): boolean {
@@ -2,7 +2,6 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import type {DocumentLatencyInsightModel} from '../../../../models/trace/insights/DocumentLatency.js';
6
5
  import type * as Trace from '../../../../models/trace/trace.js';
7
6
  import * as UI from '../../../../ui/legacy/legacy.js';
8
7
  import * as Lit from '../../../../ui/lit/lit.js';
@@ -13,7 +12,8 @@ import {Checklist} from './Checklist.js';
13
12
  const {html} = Lit;
14
13
  const {widget} = UI.Widget;
15
14
 
16
- export class DocumentLatency extends BaseInsightComponent<DocumentLatencyInsightModel> {
15
+ export class DocumentLatency extends
16
+ BaseInsightComponent<Trace.Insights.Models.DocumentLatency.DocumentLatencyInsightModel> {
17
17
  override internalName = 'document-latency';
18
18
 
19
19
  protected override hasAskAiSupport(): boolean {
@@ -3,7 +3,6 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as i18n from '../../../../core/i18n/i18n.js';
6
- import type {DuplicatedJavaScriptInsightModel} from '../../../../models/trace/insights/DuplicatedJavaScript.js';
7
6
  import * as Trace from '../../../../models/trace/trace.js';
8
7
  import * as Buttons from '../../../../ui/components/buttons/buttons.js';
9
8
  import * as UI from '../../../../ui/legacy/legacy.js';
@@ -20,7 +19,8 @@ const {UIStrings, i18nString} = Trace.Insights.Models.DuplicatedJavaScript;
20
19
  const {html} = Lit;
21
20
  const {widget} = UI.Widget;
22
21
 
23
- export class DuplicatedJavaScript extends BaseInsightComponent<DuplicatedJavaScriptInsightModel> {
22
+ export class DuplicatedJavaScript extends
23
+ BaseInsightComponent<Trace.Insights.Models.DuplicatedJavaScript.DuplicatedJavaScriptInsightModel> {
24
24
  override internalName = 'duplicated-javascript';
25
25
  #treemapData: Utils.Treemap.TreemapData|null = null;
26
26
 
@@ -5,7 +5,6 @@
5
5
  import './Table.js';
6
6
 
7
7
  import * as i18n from '../../../../core/i18n/i18n.js';
8
- import type {FontDisplayInsightModel} from '../../../../models/trace/insights/FontDisplay.js';
9
8
  import * as Trace from '../../../../models/trace/trace.js';
10
9
  import * as UI from '../../../../ui/legacy/legacy.js';
11
10
  import * as Lit from '../../../../ui/lit/lit.js';
@@ -19,7 +18,7 @@ const {UIStrings, i18nString} = Trace.Insights.Models.FontDisplay;
19
18
  const {html} = Lit;
20
19
  const {widget} = UI.Widget;
21
20
 
22
- export class FontDisplay extends BaseInsightComponent<FontDisplayInsightModel> {
21
+ export class FontDisplay extends BaseInsightComponent<Trace.Insights.Models.FontDisplay.FontDisplayInsightModel> {
23
22
  override internalName = 'font-display';
24
23
  #overlayForRequest = new Map<Trace.Types.Events.Event, Trace.Types.Overlays.Overlay>();
25
24
 
@@ -6,7 +6,6 @@ import './Table.js';
6
6
  import * as i18n from '../../../../core/i18n/i18n.js';
7
7
  import * as Platform from '../../../../core/platform/platform.js';
8
8
  import type * as Protocol from '../../../../generated/protocol.js';
9
- import type {ForcedReflowInsightModel} from '../../../../models/trace/insights/ForcedReflow.js';
10
9
  import * as Trace from '../../../../models/trace/trace.js';
11
10
  import * as LegacyComponents from '../../../../ui/legacy/components/utils/utils.js';
12
11
  import * as UI from '../../../../ui/legacy/legacy.js';
@@ -20,7 +19,7 @@ const {UIStrings, i18nString, createOverlayForEvents} = Trace.Insights.Models.Fo
20
19
  const {html, nothing} = Lit;
21
20
  const {widget} = UI.Widget;
22
21
 
23
- export class ForcedReflow extends BaseInsightComponent<ForcedReflowInsightModel> {
22
+ export class ForcedReflow extends BaseInsightComponent<Trace.Insights.Models.ForcedReflow.ForcedReflowInsightModel> {
24
23
  override internalName = 'forced-reflow';
25
24
 
26
25
  protected override hasAskAiSupport(): boolean {
@@ -4,7 +4,6 @@
4
4
 
5
5
  import * as i18n from '../../../../core/i18n/i18n.js';
6
6
  import * as Platform from '../../../../core/platform/platform.js';
7
- import type {INPBreakdownInsightModel} from '../../../../models/trace/insights/INPBreakdown.js';
8
7
  import * as Trace from '../../../../models/trace/trace.js';
9
8
  import * as UI from '../../../../ui/legacy/legacy.js';
10
9
  import * as Lit from '../../../../ui/lit/lit.js';
@@ -17,7 +16,7 @@ const {UIStrings, i18nString, createOverlaysForSubpart} = Trace.Insights.Models.
17
16
  const {html} = Lit;
18
17
  const {widget} = UI.Widget;
19
18
 
20
- export class INPBreakdown extends BaseInsightComponent<INPBreakdownInsightModel> {
19
+ export class INPBreakdown extends BaseInsightComponent<Trace.Insights.Models.INPBreakdown.INPBreakdownInsightModel> {
21
20
  override internalName = 'inp';
22
21
 
23
22
  protected override hasAskAiSupport(): boolean {
@@ -4,7 +4,6 @@
4
4
 
5
5
  import '../../../../ui/kit/kit.js';
6
6
 
7
- import type {ImageDeliveryInsightModel} from '../../../../models/trace/insights/ImageDelivery.js';
8
7
  import * as Trace from '../../../../models/trace/trace.js';
9
8
  import * as UI from '../../../../ui/legacy/legacy.js';
10
9
  import * as Lit from '../../../../ui/lit/lit.js';
@@ -18,7 +17,7 @@ const {UIStrings, i18nString, createOverlayForRequest} = Trace.Insights.Models.I
18
17
  const {html} = Lit;
19
18
  const {widget} = UI.Widget;
20
19
 
21
- export class ImageDelivery extends BaseInsightComponent<ImageDeliveryInsightModel> {
20
+ export class ImageDelivery extends BaseInsightComponent<Trace.Insights.Models.ImageDelivery.ImageDeliveryInsightModel> {
22
21
  override internalName = 'image-delivery';
23
22
 
24
23
  mapToRow(image: Trace.Insights.Models.ImageDelivery.OptimizableImage): TableDataRow {
@@ -3,7 +3,6 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as i18n from '../../../../core/i18n/i18n.js';
6
- import type {LCPBreakdownInsightModel} from '../../../../models/trace/insights/LCPBreakdown.js';
7
6
  import * as Trace from '../../../../models/trace/trace.js';
8
7
  import * as UI from '../../../../ui/legacy/legacy.js';
9
8
  import * as Lit from '../../../../ui/lit/lit.js';
@@ -17,7 +16,7 @@ const {UIStrings, i18nString} = Trace.Insights.Models.LCPBreakdown;
17
16
  const {html} = Lit;
18
17
  const {widget} = UI.Widget;
19
18
 
20
- export class LCPBreakdown extends BaseInsightComponent<LCPBreakdownInsightModel> {
19
+ export class LCPBreakdown extends BaseInsightComponent<Trace.Insights.Models.LCPBreakdown.LCPBreakdownInsightModel> {
21
20
  override internalName = 'lcp-by-phase';
22
21
  #overlay: Trace.Types.Overlays.TimespanBreakdown|null = null;
23
22
 
@@ -100,17 +99,18 @@ export class LCPBreakdown extends BaseInsightComponent<LCPBreakdownInsightModel>
100
99
  return html`<div class="insight-section">${i18nString(UIStrings.noLcp)}</div>`;
101
100
  }
102
101
 
103
- const rows: TableDataRow[] = Object.values(subparts).map((subpart: Trace.Insights.Models.LCPBreakdown.Subpart) => {
104
- const section = this.#overlay?.sections.find(section => subpart.label === section.label);
105
- const timing = Trace.Helpers.Timing.microToMilli(subpart.range);
106
- return {
107
- values: [subpart.label, i18n.TimeUtilities.preciseMillisToString(timing)],
108
- overlays: section && [{
109
- type: 'TIMESPAN_BREAKDOWN',
110
- sections: [section],
111
- }],
112
- };
113
- });
102
+ const rows: TableDataRow[] =
103
+ (Object.values(subparts) as Trace.Insights.Models.LCPBreakdown.Subpart[]).map(subpart => {
104
+ const section = this.#overlay?.sections.find(section => subpart.label === section.label);
105
+ const timing = Trace.Helpers.Timing.microToMilli(subpart.range);
106
+ return {
107
+ values: [subpart.label, i18n.TimeUtilities.preciseMillisToString(timing)],
108
+ overlays: section && [{
109
+ type: 'TIMESPAN_BREAKDOWN',
110
+ sections: [section],
111
+ }],
112
+ };
113
+ });
114
114
 
115
115
  // clang-format off
116
116
  const sections: Lit.LitTemplate[] = [html`
@@ -3,7 +3,6 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as i18n from '../../../../core/i18n/i18n.js';
6
- import type {LCPDiscoveryInsightModel} from '../../../../models/trace/insights/LCPDiscovery.js';
7
6
  import * as Trace from '../../../../models/trace/trace.js';
8
7
  import * as uiI18n from '../../../../ui/i18n/i18n.js';
9
8
  import * as UI from '../../../../ui/legacy/legacy.js';
@@ -22,7 +21,7 @@ const {html} = Lit;
22
21
  // eslint-disable-next-line @devtools/l10n-filename-matches
23
22
  const str_ = i18n.i18n.registerUIStrings('models/trace/insights/LCPDiscovery.ts', UIStrings);
24
23
 
25
- export class LCPDiscovery extends BaseInsightComponent<LCPDiscoveryInsightModel> {
24
+ export class LCPDiscovery extends BaseInsightComponent<Trace.Insights.Models.LCPDiscovery.LCPDiscoveryInsightModel> {
26
25
  override internalName = 'lcp-discovery';
27
26
 
28
27
  protected override hasAskAiSupport(): boolean {
@@ -6,8 +6,6 @@ import * as Common from '../../../../core/common/common.js';
6
6
  import * as i18n from '../../../../core/i18n/i18n.js';
7
7
  import * as SDK from '../../../../core/sdk/sdk.js';
8
8
  import * as Bindings from '../../../../models/bindings/bindings.js';
9
- import type {
10
- LegacyJavaScriptInsightModel, PatternMatchResult} from '../../../../models/trace/insights/LegacyJavaScript.js';
11
9
  import * as Trace from '../../../../models/trace/trace.js';
12
10
  import * as UI from '../../../../ui/legacy/legacy.js';
13
11
  import * as Lit from '../../../../ui/lit/lit.js';
@@ -21,7 +19,8 @@ const {UIStrings, i18nString} = Trace.Insights.Models.LegacyJavaScript;
21
19
  const {html} = Lit;
22
20
  const {widget} = UI.Widget;
23
21
 
24
- export class LegacyJavaScript extends BaseInsightComponent<LegacyJavaScriptInsightModel> {
22
+ export class LegacyJavaScript extends
23
+ BaseInsightComponent<Trace.Insights.Models.LegacyJavaScript.LegacyJavaScriptInsightModel> {
25
24
  override internalName = 'legacy-javascript';
26
25
 
27
26
  override getEstimatedSavingsTime(): Trace.Types.Timing.Milli|null {
@@ -32,7 +31,8 @@ export class LegacyJavaScript extends BaseInsightComponent<LegacyJavaScriptInsig
32
31
  return true;
33
32
  }
34
33
 
35
- async #revealLocation(script: Trace.Handlers.ModelHandlers.Scripts.Script, match: PatternMatchResult): Promise<void> {
34
+ async #revealLocation(script: Trace.Handlers.ModelHandlers.Scripts.Script,
35
+ match: Trace.Insights.Models.LegacyJavaScript.PatternMatchResult): Promise<void> {
36
36
  const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
37
37
  if (!target) {
38
38
  return;
@@ -4,7 +4,6 @@
4
4
 
5
5
  import './Table.js';
6
6
 
7
- import type {ModernHTTPInsightModel} from '../../../../models/trace/insights/ModernHTTP.js';
8
7
  import * as Trace from '../../../../models/trace/trace.js';
9
8
  import * as UI from '../../../../ui/legacy/legacy.js';
10
9
  import * as Lit from '../../../../ui/lit/lit.js';
@@ -18,7 +17,7 @@ const {UIStrings, i18nString, createOverlayForRequest} = Trace.Insights.Models.M
18
17
  const {html} = Lit;
19
18
  const {widget} = UI.Widget;
20
19
 
21
- export class ModernHTTP extends BaseInsightComponent<ModernHTTPInsightModel> {
20
+ export class ModernHTTP extends BaseInsightComponent<Trace.Insights.Models.ModernHTTP.ModernHTTPInsightModel> {
22
21
  override internalName = 'modern-http';
23
22
 
24
23
  protected override hasAskAiSupport(): boolean {
@@ -6,9 +6,6 @@ import './Table.js';
6
6
  import '../../../../ui/kit/kit.js';
7
7
 
8
8
  import * as i18n from '../../../../core/i18n/i18n.js';
9
- import type {
10
- CriticalRequestNode, NetworkDependencyTreeInsightModel} from
11
- '../../../../models/trace/insights/NetworkDependencyTree.js';
12
9
  import * as Trace from '../../../../models/trace/trace.js';
13
10
  import * as UI from '../../../../ui/legacy/legacy.js';
14
11
  import * as Lit from '../../../../ui/lit/lit.js';
@@ -27,7 +24,8 @@ const {widget} = UI.Widget;
27
24
 
28
25
  export const MAX_CHAINS_TO_SHOW = 5;
29
26
 
30
- export class NetworkDependencyTree extends BaseInsightComponent<NetworkDependencyTreeInsightModel> {
27
+ export class NetworkDependencyTree extends
28
+ BaseInsightComponent<Trace.Insights.Models.NetworkDependencyTree.NetworkDependencyTreeInsightModel> {
31
29
  override internalName = 'long-critical-network-tree';
32
30
 
33
31
  #relatedRequests: Set<Trace.Types.Events.SyntheticNetworkRequest>|null = null;
@@ -48,7 +46,7 @@ export class NetworkDependencyTree extends BaseInsightComponent<NetworkDependenc
48
46
  return overlays;
49
47
  }
50
48
 
51
- #renderNetworkTreeRow(node: CriticalRequestNode): Lit.LitTemplate {
49
+ #renderNetworkTreeRow(node: Trace.Insights.Models.NetworkDependencyTree.CriticalRequestNode): Lit.LitTemplate {
52
50
  const requestStyles = Lit.Directives.styleMap({
53
51
  display: 'flex',
54
52
  '--override-timeline-link-text-color': node.isLongest ? 'var(--sys-color-error)' : '',
@@ -71,7 +69,7 @@ export class NetworkDependencyTree extends BaseInsightComponent<NetworkDependenc
71
69
  // clang-format on
72
70
  }
73
71
 
74
- mapNetworkDependencyToRow(node: CriticalRequestNode): TableDataRow|null {
72
+ mapNetworkDependencyToRow(node: Trace.Insights.Models.NetworkDependencyTree.CriticalRequestNode): TableDataRow|null {
75
73
  // Check early if we've exceeded the maximum number of chains to show.
76
74
  // If so, and this is a leaf node, increment count and then skip rendering.
77
75
  // Otherwise, simply skip rendering.
@@ -93,11 +91,15 @@ export class NetworkDependencyTree extends BaseInsightComponent<NetworkDependenc
93
91
  values: [this.#renderNetworkTreeRow(node)],
94
92
  overlays: this.#createOverlayForChain(node.relatedRequests),
95
93
  // Filter out the empty rows otherwise the `Table`component will render a super short row
96
- subRows: node.children.map(child => this.mapNetworkDependencyToRow(child)).filter(row => row !== null),
94
+ subRows: node.children
95
+ .map((child: Trace.Insights.Models.NetworkDependencyTree.CriticalRequestNode) =>
96
+ this.mapNetworkDependencyToRow(child))
97
+ .filter((row: TableDataRow|null) => row !== null),
97
98
  };
98
99
  }
99
100
 
100
- #renderNetworkDependencyTree(nodes: CriticalRequestNode[]): Lit.LitTemplate|null {
101
+ #renderNetworkDependencyTree(nodes: Trace.Insights.Models.NetworkDependencyTree.CriticalRequestNode[]):
102
+ Lit.LitTemplate|null {
101
103
  if (nodes.length === 0) {
102
104
  return null;
103
105
  }
@@ -3,7 +3,6 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as i18n from '../../../../core/i18n/i18n.js';
6
- import type {RenderBlockingInsightModel} from '../../../../models/trace/insights/RenderBlocking.js';
7
6
  import * as Trace from '../../../../models/trace/trace.js';
8
7
  import * as UI from '../../../../ui/legacy/legacy.js';
9
8
  import * as Lit from '../../../../ui/lit/lit.js';
@@ -17,7 +16,8 @@ const {UIStrings, i18nString, createOverlayForRequest} = Trace.Insights.Models.R
17
16
  const {html} = Lit;
18
17
  const {widget} = UI.Widget;
19
18
 
20
- export class RenderBlocking extends BaseInsightComponent<RenderBlockingInsightModel> {
19
+ export class RenderBlocking extends
20
+ BaseInsightComponent<Trace.Insights.Models.RenderBlocking.RenderBlockingInsightModel> {
21
21
  override internalName = 'render-blocking-requests';
22
22
 
23
23
  mapToRow(request: Trace.Types.Events.SyntheticNetworkRequest): TableDataRow {
@@ -2,10 +2,12 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import type {InsightModel} from '../../../../models/trace/insights/types.js';
5
+ import type * as Insights from '../../../../models/trace/insights/insights.js';
6
6
  import type * as Trace from '../../../../models/trace/trace.js';
7
7
  import type * as Overlays from '../../overlays/overlays.js';
8
8
 
9
+ type InsightModel = Insights.Types.InsightModel;
10
+
9
11
  export interface InsightDetails {
10
12
  title: string;
11
13
  description: string;