chrome-devtools-frontend 1.0.1571007 → 1.0.1572937

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 (168) hide show
  1. package/agents/prompts/README.md +18 -0
  2. package/agents/prompts/devtools-imports.md +47 -0
  3. package/agents/prompts/verification.md +27 -0
  4. package/front_end/Images/geminiInDevTools.png +0 -0
  5. package/front_end/Images/geminiInDevTools_2x.png +0 -0
  6. package/front_end/Images/src/database-off.svg +1 -0
  7. package/front_end/Images/src/lock-person.svg +1 -1
  8. package/front_end/core/common/Debouncer.ts +10 -1
  9. package/front_end/core/common/SettingRegistration.ts +1 -1
  10. package/front_end/core/host/AidaClient.ts +8 -0
  11. package/front_end/core/host/InspectorFrontendHostAPI.ts +0 -6
  12. package/front_end/core/host/UserMetrics.ts +1 -31
  13. package/front_end/core/root/ExperimentNames.ts +30 -0
  14. package/front_end/core/root/Runtime.ts +47 -48
  15. package/front_end/core/root/root.ts +2 -0
  16. package/front_end/core/sdk/CSSModel.ts +36 -13
  17. package/front_end/core/sdk/CSSProperty.ts +1 -1
  18. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +9 -0
  19. package/front_end/core/sdk/CookieModel.ts +2 -1
  20. package/front_end/core/sdk/DOMModel.ts +1 -1
  21. package/front_end/core/sdk/DebuggerModel.ts +1 -1
  22. package/front_end/core/sdk/OverlayModel.ts +3 -2
  23. package/front_end/core/sdk/SourceMap.ts +1 -1
  24. package/front_end/devtools_compatibility.js +0 -6
  25. package/front_end/entrypoints/main/MainImpl.ts +44 -24
  26. package/front_end/entrypoints/main/main-meta.ts +1 -1
  27. package/front_end/generated/SupportedCSSProperties.js +6 -14
  28. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +0 -180
  29. package/front_end/models/ai_assistance/ai_assistance.ts +0 -2
  30. package/front_end/models/breakpoints/BreakpointManager.ts +3 -3
  31. package/front_end/models/issues_manager/ContrastCheckTrigger.ts +2 -2
  32. package/front_end/models/javascript_metadata/NativeFunctions.js +8 -0
  33. package/front_end/models/source_map_scopes/NamesResolver.ts +1 -1
  34. package/front_end/models/trace/EventsSerializer.ts +5 -1
  35. package/front_end/models/trace/ModelImpl.ts +0 -4
  36. package/front_end/models/trace/types/TraceEvents.ts +4 -0
  37. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +1 -1
  38. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +1 -1
  39. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +8 -63
  40. package/front_end/panels/ai_assistance/PatchWidget.ts +10 -15
  41. package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +5 -4
  42. package/front_end/panels/ai_assistance/aiAssistancePanel.css +0 -16
  43. package/front_end/panels/ai_assistance/ai_assistance.ts +0 -1
  44. package/front_end/panels/ai_assistance/components/ChatMessage.ts +3 -2
  45. package/front_end/panels/ai_assistance/components/ChatView.ts +123 -108
  46. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +1 -145
  47. package/front_end/panels/application/DeviceBoundSessionsModel.ts +23 -1
  48. package/front_end/panels/application/DeviceBoundSessionsTreeElement.ts +23 -0
  49. package/front_end/panels/application/FrameDetailsView.ts +12 -10
  50. package/front_end/panels/application/components/BackForwardCacheView.ts +6 -8
  51. package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +4 -3
  52. package/front_end/panels/application/components/ProtocolHandlersView.ts +5 -6
  53. package/front_end/panels/application/components/ReportsGrid.ts +9 -9
  54. package/front_end/panels/application/components/SharedStorageAccessGrid.ts +5 -4
  55. package/front_end/panels/application/components/TrustTokensView.ts +4 -6
  56. package/front_end/panels/application/preloading/PreloadingView.ts +9 -8
  57. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +237 -230
  58. package/front_end/panels/application/preloading/components/PreloadingGrid.ts +3 -2
  59. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +6 -10
  60. package/front_end/panels/application/resourcesSidebar.css +8 -0
  61. package/front_end/panels/autofill/AutofillView.ts +4 -3
  62. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +3 -5
  63. package/front_end/panels/common/AiCodeCompletionTeaser.ts +5 -5
  64. package/front_end/panels/common/AiCodeGenerationTeaser.ts +35 -4
  65. package/front_end/panels/common/BadgeNotification.ts +17 -14
  66. package/front_end/panels/common/GdpSignUpDialog.ts +5 -6
  67. package/front_end/panels/common/GeminiRebrandPromoDialog.ts +192 -0
  68. package/front_end/panels/common/aiCodeGenerationTeaser.css +16 -1
  69. package/front_end/panels/common/common.ts +1 -0
  70. package/front_end/panels/common/geminiRebrandPromoDialog.css +47 -0
  71. package/front_end/panels/console/ConsoleInsightTeaser.ts +10 -11
  72. package/front_end/panels/console/ErrorStackParser.ts +11 -16
  73. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +2 -2
  74. package/front_end/panels/css_overview/CSSOverviewModel.ts +1 -1
  75. package/front_end/panels/elements/ComputedStyleModel.ts +16 -65
  76. package/front_end/panels/elements/ComputedStyleWidget.ts +3 -3
  77. package/front_end/panels/elements/ElementsPanel.ts +35 -5
  78. package/front_end/panels/elements/ElementsSidebarPane.ts +1 -1
  79. package/front_end/panels/elements/ElementsTreeOutline.ts +1 -1
  80. package/front_end/panels/elements/PlatformFontsWidget.ts +1 -1
  81. package/front_end/panels/elements/StylePropertiesSection.ts +16 -8
  82. package/front_end/panels/elements/StylePropertyTreeElement.ts +67 -32
  83. package/front_end/panels/elements/StylesSidebarPane.ts +28 -11
  84. package/front_end/panels/elements/components/CSSHintDetailsView.ts +3 -2
  85. package/front_end/panels/elements/components/CSSPropertyDocsView.ts +3 -2
  86. package/front_end/panels/elements/elements-meta.ts +1 -1
  87. package/front_end/panels/emulation/DeviceModeWrapper.ts +101 -62
  88. package/front_end/panels/explain/components/ConsoleInsight.ts +27 -23
  89. package/front_end/panels/explain/components/consoleInsight.css +1 -1
  90. package/front_end/panels/issues/IssueView.ts +6 -6
  91. package/front_end/panels/network/RequestConditionsDrawer.ts +4 -3
  92. package/front_end/panels/network/RequestCookiesView.ts +3 -4
  93. package/front_end/panels/network/RequestTimingView.ts +6 -10
  94. package/front_end/panels/network/components/HeaderSectionRow.ts +3 -2
  95. package/front_end/panels/network/components/RequestHeaderSection.ts +3 -1
  96. package/front_end/panels/network/components/RequestHeadersView.css +2 -2
  97. package/front_end/panels/network/components/RequestHeadersView.ts +7 -6
  98. package/front_end/panels/profiler/HeapProfileView.ts +3 -3
  99. package/front_end/panels/profiler/HeapSnapshotView.ts +2 -2
  100. package/front_end/panels/profiler/profiler-meta.ts +3 -3
  101. package/front_end/panels/protocol_monitor/protocol_monitor-meta.ts +1 -1
  102. package/front_end/panels/recorder/RecorderController.ts +7 -13
  103. package/front_end/panels/recorder/components/CreateRecordingView.ts +6 -6
  104. package/front_end/panels/recorder/components/RecordingView.ts +0 -38
  105. package/front_end/panels/recorder/components/ReplaySection.ts +0 -14
  106. package/front_end/panels/recorder/components/StepEditor.ts +2 -40
  107. package/front_end/panels/recorder/recorderController.css +4 -4
  108. package/front_end/panels/security/CookieControlsView.ts +2 -2
  109. package/front_end/panels/security/CookieReportView.ts +21 -21
  110. package/front_end/panels/security/cookieControlsView.css +1 -1
  111. package/front_end/panels/security/cookieReportView.css +1 -1
  112. package/front_end/panels/settings/AISettingsTab.ts +13 -15
  113. package/front_end/panels/settings/components/SyncSection.ts +4 -3
  114. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +4 -12
  115. package/front_end/panels/settings/settings-meta.ts +1 -1
  116. package/front_end/panels/sources/BreakpointEditDialog.ts +4 -3
  117. package/front_end/panels/sources/CallStackSidebarPane.ts +4 -1
  118. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +1 -1
  119. package/front_end/panels/sources/NavigatorView.ts +4 -4
  120. package/front_end/panels/sources/SourcesPanel.ts +7 -4
  121. package/front_end/panels/sources/components/HeadersView.ts +2 -2
  122. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +3 -2
  123. package/front_end/panels/timeline/ThreadAppender.ts +2 -1
  124. package/front_end/panels/timeline/TimelineController.ts +4 -3
  125. package/front_end/panels/timeline/TimelinePanel.ts +7 -4
  126. package/front_end/panels/timeline/TimelineUIUtils.ts +2 -2
  127. package/front_end/panels/timeline/components/ExportTraceOptions.ts +4 -4
  128. package/front_end/panels/timeline/components/FieldSettingsDialog.ts +13 -6
  129. package/front_end/panels/timeline/components/LiveMetricsView.ts +13 -9
  130. package/front_end/panels/timeline/components/exportTraceOptions.css +1 -1
  131. package/front_end/panels/timeline/components/fieldSettingsDialog.css +1 -1
  132. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +2 -19
  133. package/front_end/panels/timeline/components/insights/InsightRenderer.ts +3 -4
  134. package/front_end/panels/timeline/components/insights/baseInsightComponent.css +0 -5
  135. package/front_end/panels/timeline/components/liveMetricsView.css +1 -1
  136. package/front_end/panels/whats_new/ReleaseNoteView.ts +4 -3
  137. package/front_end/third_party/chromium/README.chromium +1 -1
  138. package/front_end/ui/components/buttons/button.css +4 -0
  139. package/front_end/ui/components/markdown_view/CodeBlock.ts +3 -6
  140. package/front_end/ui/components/markdown_view/MarkdownLink.ts +3 -4
  141. package/front_end/ui/components/panel_feedback/PanelFeedback.ts +3 -4
  142. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +10 -7
  143. package/front_end/ui/components/panel_feedback/panelFeedback.css +2 -2
  144. package/front_end/ui/components/panel_feedback/previewToggle.css +2 -2
  145. package/front_end/ui/components/text_editor/AiCodeGenerationParser.ts +27 -8
  146. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +36 -6
  147. package/front_end/ui/kit/link/Link.ts +1 -14
  148. package/front_end/ui/legacy/ActionRegistration.ts +1 -1
  149. package/front_end/ui/legacy/ContextMenu.ts +2 -2
  150. package/front_end/ui/legacy/EmptyWidget.ts +3 -3
  151. package/front_end/ui/legacy/LinkContextMenuProvider.ts +42 -0
  152. package/front_end/ui/legacy/ViewRegistration.ts +1 -1
  153. package/front_end/ui/legacy/XLink.ts +0 -27
  154. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +1 -1
  155. package/front_end/ui/legacy/components/color_picker/ContrastOverlay.ts +5 -4
  156. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -2
  157. package/front_end/ui/legacy/components/perf_ui/perf_ui-meta.ts +1 -1
  158. package/front_end/ui/legacy/inspectorCommon.css +2 -1
  159. package/front_end/ui/legacy/legacy.ts +3 -1
  160. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -1
  161. package/front_end/ui/visual_logging/LoggingDriver.ts +3 -0
  162. package/package.json +1 -1
  163. package/front_end/models/ai_assistance/ArtifactsManager.ts +0 -67
  164. package/front_end/panels/ai_assistance/components/ArtifactsViewer.ts +0 -183
  165. package/front_end/panels/ai_assistance/components/CollapsibleAssistanceContentWidget.ts +0 -89
  166. package/front_end/panels/ai_assistance/components/PerformanceAgentFlameChart.ts +0 -133
  167. package/front_end/panels/ai_assistance/components/artifactsViewer.css +0 -15
  168. package/front_end/panels/ai_assistance/components/collapsibleAssistanceContentWidget.css +0 -32
@@ -258,13 +258,20 @@ export class AiCodeGenerationProvider {
258
258
  }
259
259
 
260
260
  this.#aiCodeGenerationCitations = [];
261
- this.#generationTeaser.displayState = PanelCommon.AiCodeGenerationTeaser.AiCodeGenerationTeaserDisplayState.LOADING;
262
261
  const cursor = this.#editor.state.selection.main.head;
263
- const query = AiCodeGenerationParser.extractCommentText(this.#editor.state, cursor);
262
+ const commentNodeInfo = AiCodeGenerationParser.extractCommentNodeInfo(this.#editor.state, cursor);
263
+ if (!commentNodeInfo) {
264
+ return;
265
+ }
266
+ // Move cursor to end of comment node before triggering generation.
267
+ this.#editor.dispatch({selection: {anchor: commentNodeInfo.to}});
268
+
269
+ const query = commentNodeInfo.text;
264
270
  if (!query || query.trim().length === 0) {
265
271
  return;
266
272
  }
267
273
 
274
+ this.#generationTeaser.displayState = PanelCommon.AiCodeGenerationTeaser.AiCodeGenerationTeaserDisplayState.LOADING;
268
275
  try {
269
276
  const startTime = performance.now();
270
277
  this.#aiCodeGenerationConfig?.onRequestTriggered();
@@ -297,7 +304,7 @@ export class AiCodeGenerationProvider {
297
304
  effects: [
298
305
  setAiAutoCompleteSuggestion.of({
299
306
  text: '\n' + suggestionText,
300
- from: cursor,
307
+ from: commentNodeInfo.to,
301
308
  rpcGlobalId: generationResponse.metadata.rpcGlobalId,
302
309
  sampleId: topSample.sampleId,
303
310
  startTime,
@@ -359,14 +366,23 @@ function aiCodeGenerationTeaserExtension(teaser: PanelCommon.AiCodeGenerationTea
359
366
  const isEmptyLine = line.length === 0;
360
367
  const canShowDiscoveryState =
361
368
  UI.UIUtils.PromotionManager.instance().canShowPromotion(PanelCommon.AiCodeGenerationTeaser.PROMOTION_ID);
362
- const isComment = Boolean(AiCodeGenerationParser.extractCommentText(this.#view.state, cursorPosition));
363
- const isCursorAtEndOfLine = cursorPosition >= line.to;
364
369
 
365
- if ((isEmptyLine && canShowDiscoveryState) || (isComment && isCursorAtEndOfLine)) {
370
+ if ((isEmptyLine && canShowDiscoveryState)) {
366
371
  return CodeMirror.Decoration.set([
367
372
  CodeMirror.Decoration.widget({widget: new AccessiblePlaceholder(teaser), side: 1}).range(cursorPosition),
368
373
  ]);
369
374
  }
375
+
376
+ const commentInfo = AiCodeGenerationParser.extractCommentNodeInfo(this.#view.state, cursorPosition);
377
+ if (commentInfo) {
378
+ // If cursor is inside the comment, show at the end of the comment node.
379
+ // If cursor is after the comment (but on same line), show at the cursor.
380
+ const decorationPos = Math.max(cursorPosition, commentInfo.to);
381
+ return CodeMirror.Decoration.set([
382
+ CodeMirror.Decoration.widget({widget: new AccessiblePlaceholder(teaser), side: 1}).range(decorationPos),
383
+ ]);
384
+ }
385
+
370
386
  return CodeMirror.Decoration.none;
371
387
  }
372
388
 
@@ -397,6 +413,20 @@ function aiCodeGenerationTeaserExtension(teaser: PanelCommon.AiCodeGenerationTea
397
413
  // Required for mouse click to propagate to the info tooltip in teaser.
398
414
  return (event.target instanceof Node && teaser.contentElement.contains(event.target));
399
415
  },
416
+ keydown(event: KeyboardEvent): boolean {
417
+ if (!UI.KeyboardShortcut.KeyboardShortcut.eventHasCtrlEquivalentKey(event) ||
418
+ teaser.displayState !== PanelCommon.AiCodeGenerationTeaser.AiCodeGenerationTeaserDisplayState.TRIGGER) {
419
+ return false;
420
+ }
421
+ if (event.key === '.') {
422
+ event.consume(true);
423
+ void VisualLogging.logKeyDown(
424
+ event.currentTarget, event, 'ai-code-generation-teaser.show-disclaimer-info-tooltip');
425
+ teaser.showTooltip();
426
+ return true;
427
+ }
428
+ return false;
429
+ }
400
430
  },
401
431
  });
402
432
  }
@@ -82,20 +82,7 @@ export class Link extends HTMLElement {
82
82
  }
83
83
 
84
84
  #onJslogContextChange(): void {
85
- let jslogContext = this.jslogContext;
86
- if (!jslogContext) {
87
- try {
88
- if (!this.href) {
89
- return;
90
- }
91
- const urlForContext = new URL(this.href);
92
- urlForContext.search = '';
93
- jslogContext = Platform.StringUtilities.toKebabCase(urlForContext.toString());
94
- } catch {
95
- return;
96
- }
97
- }
98
-
85
+ const jslogContext = this.jslogContext ?? undefined;
99
86
  const jslog = VisualLogging.link().track({click: true, keydown: 'Enter|Space'}).context(jslogContext);
100
87
  this.setAttribute('jslog', jslog.toString());
101
88
  }
@@ -551,7 +551,7 @@ export interface ActionRegistration {
551
551
  * The name of the experiment an action is associated with. Enabling and disabling the declared
552
552
  * experiment will enable and disable the action respectively.
553
553
  */
554
- experiment?: Root.Runtime.ExperimentName;
554
+ experiment?: Root.ExperimentNames.ExperimentName;
555
555
  /**
556
556
  * Whether an action needs to be promoted. A new badge is shown next to the menu items then.
557
557
  */
@@ -1225,7 +1225,7 @@ export interface ProviderRegistration<T> {
1225
1225
  /** A function that asynchronously loads the provider instance. */
1226
1226
  loadProvider: () => Promise<Provider<T>>;
1227
1227
  /** Optional. The experiment that enables this provider. */
1228
- experiment?: Root.Runtime.ExperimentName;
1228
+ experiment?: Root.ExperimentNames.ExperimentName;
1229
1229
  }
1230
1230
 
1231
1231
  export interface ContextMenuItemRegistration {
@@ -1236,5 +1236,5 @@ export interface ContextMenuItemRegistration {
1236
1236
  /** Optional. A number used for sorting items within the same location. Lower numbers appear first. */
1237
1237
  order?: number;
1238
1238
  /** Optional. The experiment that enables this item. */
1239
- experiment?: Root.Runtime.ExperimentName;
1239
+ experiment?: Root.ExperimentNames.ExperimentName;
1240
1240
  }
@@ -2,6 +2,8 @@
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 '../../ui/kit/kit.js';
6
+
5
7
  import * as i18n from '../../core/i18n/i18n.js';
6
8
  import type * as Platform from '../../core/platform/platform.js';
7
9
  import {Directives, html, render} from '../lit/lit.js';
@@ -10,7 +12,6 @@ import * as VisualLogging from '../visual_logging/visual_logging.js';
10
12
  import emptyWidgetStyles from './emptyWidget.css.js';
11
13
  import inspectorCommonStyles from './inspectorCommon.css.js';
12
14
  import {VBox} from './Widget.js';
13
- import {XLink} from './XLink.js';
14
15
 
15
16
  const UIStrings = {
16
17
  /**
@@ -45,8 +46,7 @@ const DEFAULT_VIEW: View = (input, output, target) => {
45
46
  <div class="empty-state-header">${input.header}</div>
46
47
  <div class="empty-state-description">
47
48
  <span>${input.text}</span>
48
- ${input.link ? XLink.create(
49
- input.link, i18nString(UIStrings.learnMore), undefined, undefined, 'learn-more') : ''}
49
+ ${input.link ? html`<devtools-link href=${input.link} jslogContext=${'learn-more'}>${i18nString(UIStrings.learnMore)}</devtools-link>` : ''}
50
50
  </div>
51
51
  ${input.extraElements}
52
52
  </div>`, target);
@@ -0,0 +1,42 @@
1
+ // Copyright 2017 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as Host from '../../core/host/host.js';
6
+ import * as UIHelpers from '../helpers/helpers.js';
7
+ import {Link} from '../kit/kit.js';
8
+
9
+ import type {ContextMenu, Provider} from './ContextMenu.js';
10
+ import {
11
+ copyLinkAddressLabel,
12
+ openLinkExternallyLabel,
13
+ } from './UIUtils.js';
14
+ import {XLink} from './XLink.js';
15
+
16
+ /**
17
+ * We can move this next to the Link after
18
+ * the x-link is removed and the context menu
19
+ * is decoupled from the legacy bundle
20
+ */
21
+ export class LinkContextMenuProvider implements Provider<Node> {
22
+ appendApplicableItems(_event: Event, contextMenu: ContextMenu, target: Node): void {
23
+ let targetNode: Node|null = target;
24
+ while (targetNode && !(targetNode instanceof XLink || targetNode instanceof Link)) {
25
+ targetNode = targetNode.parentNodeOrShadowHost();
26
+ }
27
+ if (!targetNode?.href) {
28
+ return;
29
+ }
30
+ const node: XLink|Link = targetNode;
31
+ contextMenu.revealSection().appendItem(openLinkExternallyLabel(), () => {
32
+ if (node.href) {
33
+ UIHelpers.openInNewTab(node.href);
34
+ }
35
+ }, {jslogContext: 'open-in-new-tab'});
36
+ contextMenu.revealSection().appendItem(copyLinkAddressLabel(), () => {
37
+ if (node.href) {
38
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(node.href);
39
+ }
40
+ }, {jslogContext: 'copy-link-address'});
41
+ }
42
+ }
@@ -67,7 +67,7 @@ export interface ViewRegistration {
67
67
  * The name of the experiment a view is associated with. Enabling and disabling the declared
68
68
  * experiment will enable and disable the view respectively.
69
69
  */
70
- experiment?: Root.Runtime.ExperimentName;
70
+ experiment?: Root.ExperimentNames.ExperimentName;
71
71
  /**
72
72
  * A condition is a function that will make the view available if it
73
73
  * returns true, and not available, otherwise. Make sure that objects you
@@ -2,19 +2,15 @@
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 * as Host from '../../core/host/host.js';
6
5
  import * as Platform from '../../core/platform/platform.js';
7
6
  import * as UIHelpers from '../helpers/helpers.js';
8
7
  import * as VisualLogging from '../visual_logging/visual_logging.js';
9
8
 
10
9
  import * as ARIAUtils from './ARIAUtils.js';
11
- import type {ContextMenu, Provider} from './ContextMenu.js';
12
10
  import {html as xhtml} from './Fragment.js';
13
11
  import {Tooltip} from './Tooltip.js';
14
12
  import {
15
- copyLinkAddressLabel,
16
13
  MaxLengthForDisplayedURLs,
17
- openLinkExternallyLabel,
18
14
  } from './UIUtils.js';
19
15
  import {XElement} from './XElement.js';
20
16
 
@@ -128,28 +124,5 @@ export class XLink extends XElement {
128
124
  }
129
125
  }
130
126
 
131
- export class ContextMenuProvider implements Provider<Node> {
132
- appendApplicableItems(_event: Event, contextMenu: ContextMenu, target: Node): void {
133
- let targetNode: Node|null = target;
134
- while (targetNode && !(targetNode instanceof XLink)) {
135
- targetNode = targetNode.parentNodeOrShadowHost();
136
- }
137
- if (!targetNode?.href) {
138
- return;
139
- }
140
- const node: XLink = targetNode;
141
- contextMenu.revealSection().appendItem(openLinkExternallyLabel(), () => {
142
- if (node.href) {
143
- UIHelpers.openInNewTab(node.href);
144
- }
145
- }, {jslogContext: 'open-in-new-tab'});
146
- contextMenu.revealSection().appendItem(copyLinkAddressLabel(), () => {
147
- if (node.href) {
148
- Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(node.href);
149
- }
150
- }, {jslogContext: 'copy-link-address'});
151
- }
152
- }
153
-
154
127
  // eslint-disable-next-line @devtools/enforce-custom-element-prefix
155
128
  customElements.define('x-link', XLink);
@@ -242,7 +242,7 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
242
242
  this.setVisible(true);
243
243
  this.hideNoContrastInfoAvailableMessage();
244
244
 
245
- const isAPCAEnabled = Root.Runtime.experiments.isEnabled('apca');
245
+ const isAPCAEnabled = Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.APCA);
246
246
 
247
247
  const fgColor = this.contrastInfo.color();
248
248
  const bgColor = this.contrastInfo.bgColor();
@@ -25,7 +25,7 @@ export class ContrastOverlay {
25
25
 
26
26
  this.contrastRatioSVG = UI.UIUtils.createSVGChild(colorElement, 'svg', 'spectrum-contrast-container fill');
27
27
  this.contrastRatioLines = new Map();
28
- if (Root.Runtime.experiments.isEnabled('apca')) {
28
+ if (Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.APCA)) {
29
29
  this.contrastRatioLines.set(
30
30
  'APCA', UI.UIUtils.createSVGChild(this.contrastRatioSVG, 'path', 'spectrum-contrast-line'));
31
31
  } else {
@@ -50,7 +50,8 @@ export class ContrastOverlay {
50
50
  if (!this.visible || this.contrastInfo.isNull()) {
51
51
  return;
52
52
  }
53
- if (Root.Runtime.experiments.isEnabled('apca') && this.contrastInfo.contrastRatioAPCA() === null) {
53
+ if (Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.APCA) &&
54
+ this.contrastInfo.contrastRatioAPCA() === null) {
54
55
  return;
55
56
  }
56
57
  if (!this.contrastInfo.contrastRatio()) {
@@ -90,7 +91,7 @@ export class ContrastRatioLineBuilder {
90
91
  }
91
92
 
92
93
  drawContrastRatioLine(width: number, height: number, level: string): string|null {
93
- const isAPCA = Root.Runtime.experiments.isEnabled('apca');
94
+ const isAPCA = Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.APCA);
94
95
  const requiredContrast =
95
96
  isAPCA ? this.contrastInfo.contrastRatioAPCAThreshold() : this.contrastInfo.contrastRatioThreshold(level);
96
97
  if (!width || !height || requiredContrast === null) {
@@ -139,7 +140,7 @@ export class ContrastRatioLineBuilder {
139
140
  Common.ColorUtils.blendColors(Common.Color.Legacy.fromHSVA(candidateHSVA).rgba(), bgRGBA));
140
141
  };
141
142
 
142
- if (Root.Runtime.experiments.isEnabled('apca')) {
143
+ if (Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.APCA)) {
143
144
  candidateLuminance = (candidateHSVA: Common.ColorUtils.Color4D) => {
144
145
  return Common.ColorUtils.luminanceAPCA(
145
146
  Common.ColorUtils.blendColors(Common.Color.Legacy.fromHSVA(candidateHSVA).rgba(), bgRGBA));
@@ -1252,8 +1252,8 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
1252
1252
  if (this.property.object) {
1253
1253
  contextMenu.appendApplicableItems(this.property.object);
1254
1254
  if (this.property.parent?.object instanceof SDK.RemoteObject.LocalJSONObject) {
1255
- const propertyValue = typeof this.property.object === 'object' ? JSON.stringify(this.property.object, null, 2) :
1256
- this.property.object;
1255
+ const {object: {value}} = this.property;
1256
+ const propertyValue = typeof value === 'object' ? JSON.stringify(value, null, 2) : value;
1257
1257
  const copyValueHandler = (): void => {
1258
1258
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.NetworkPanelCopyValue);
1259
1259
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText((propertyValue as string | undefined));
@@ -91,7 +91,7 @@ Common.Settings.registerSettingExtension({
91
91
 
92
92
  Common.Settings.registerSettingExtension({
93
93
  category: Common.Settings.SettingCategory.MEMORY,
94
- experiment: Root.Runtime.ExperimentName.LIVE_HEAP_PROFILE,
94
+ experiment: Root.ExperimentNames.ExperimentName.LIVE_HEAP_PROFILE,
95
95
  title: i18nLazyString(UIStrings.liveMemoryAllocationAnnotations),
96
96
  settingName: 'memory-live-heap-profile',
97
97
  settingType: Common.Settings.SettingType.BOOLEAN,
@@ -494,7 +494,8 @@ select option {
494
494
  font: var(--sys-typescale-body4-regular);
495
495
  color: var(--sys-color-on-surface-subtle);
496
496
 
497
- > x-link {
497
+ > x-link,
498
+ > devtools-link {
498
499
  white-space: nowrap;
499
500
  margin-left: var(--sys-size-3);
500
501
  }
@@ -24,6 +24,7 @@ import * as InplaceEditor from './InplaceEditor.js';
24
24
  import inspectorCommonStyles from './inspectorCommon.css.js';
25
25
  import * as InspectorView from './InspectorView.js';
26
26
  import * as KeyboardShortcut from './KeyboardShortcut.js';
27
+ import * as LinkContextMenuProvider from './LinkContextMenuProvider.js';
27
28
  import * as ListControl from './ListControl.js';
28
29
  import * as ListModel from './ListModel.js';
29
30
  import * as ListWidget from './ListWidget.js';
@@ -77,6 +78,7 @@ export {
77
78
  inspectorCommonStyles,
78
79
  InspectorView,
79
80
  KeyboardShortcut,
81
+ LinkContextMenuProvider,
80
82
  ListControl,
81
83
  ListModel,
82
84
  ListWidget,
@@ -105,5 +107,5 @@ export {
105
107
  Widget,
106
108
  XElement,
107
109
  XLink,
108
- ZoomManager,
110
+ ZoomManager
109
111
  };
@@ -354,6 +354,7 @@ export const knownContextValues = new Set([
354
354
  'ai-code-completion-teaser.fre',
355
355
  'ai-code-generation-disclaimer',
356
356
  'ai-code-generation-teaser.info-button',
357
+ 'ai-code-generation-teaser.show-disclaimer-info-tooltip',
357
358
  'ai-code-generation-upgrade-dialog.continue',
358
359
  'ai-code-generation-upgrade-dialog.manage-in-settings',
359
360
  'ai-explorer',
@@ -1740,6 +1741,7 @@ export const knownContextValues = new Set([
1740
1741
  'gdp-profile',
1741
1742
  'gdp-sign-up-dialog',
1742
1743
  'gdp.ai-conversation-count',
1744
+ 'gemini-rebranding-dialog-shown',
1743
1745
  'gen-ai-settings-panel',
1744
1746
  'general',
1745
1747
  'generative-ai-terms-of-service',
@@ -3535,7 +3537,7 @@ export const knownContextValues = new Set([
3535
3537
  'show-minimal-safe-area-for-maskable-icons',
3536
3538
  'show-more',
3537
3539
  'show-network-requests',
3538
- 'show-option-tp-expose-internals-in-heap-snapshot',
3540
+ 'show-option-to-expose-internals-in-heap-snapshot',
3539
3541
  'show-overrides',
3540
3542
  'show-paint-rects',
3541
3543
  'show-paint-rects-true',
@@ -3803,6 +3805,7 @@ export const knownContextValues = new Set([
3803
3805
  'text-emphasis-color',
3804
3806
  'text-emphasis-position',
3805
3807
  'text-emphasis-style',
3808
+ 'text-fit',
3806
3809
  'text-grow',
3807
3810
  'text-indent',
3808
3811
  'text-justify',
@@ -266,6 +266,9 @@ export async function process(): Promise<void> {
266
266
  const root = nonDomRoots[i];
267
267
  for (const {loggable, config, parent, size} of getNonDomLoggables(root)) {
268
268
  const loggingState = getOrCreateLoggingState(loggable, config, parent);
269
+ if (loggingState.impressionLogged) {
270
+ continue;
271
+ }
269
272
  if (size) {
270
273
  loggingState.size = size;
271
274
  }
package/package.json CHANGED
@@ -104,5 +104,5 @@
104
104
  "flat-cache": "6.1.12"
105
105
  }
106
106
  },
107
- "version": "1.0.1571007"
107
+ "version": "1.0.1572937"
108
108
  }
@@ -1,67 +0,0 @@
1
- // Copyright 2025 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import type * as SDK from '../../core/sdk/sdk.js';
6
- import type * as Trace from '../../models/trace/trace.js';
7
- import type {InsightKeys} from '../trace/insights/types.js';
8
-
9
- export interface InsightArtifact {
10
- type: 'insight';
11
- insightType: InsightKeys;
12
- }
13
-
14
- export interface NetworkRequestArtifact {
15
- type: 'network-request';
16
- request: SDK.NetworkRequest.NetworkRequest|Trace.Types.Events.SyntheticNetworkRequest;
17
- }
18
-
19
- export interface FlameChartArtifact {
20
- type: 'flamechart';
21
- start: Trace.Types.Timing.Micro;
22
- end: Trace.Types.Timing.Micro;
23
- }
24
-
25
- export type Artifact = InsightArtifact|NetworkRequestArtifact|FlameChartArtifact;
26
-
27
- export class ArtifactAddedEvent extends Event {
28
- static readonly eventName = 'artifactadded';
29
-
30
- constructor(public artifact: Artifact) {
31
- super(ArtifactAddedEvent.eventName);
32
- }
33
- }
34
-
35
- let instance: ArtifactsManager|null = null;
36
-
37
- export class ArtifactsManager extends EventTarget {
38
- #artifacts: Artifact[] = [];
39
-
40
- static instance(): ArtifactsManager {
41
- if (!instance) {
42
- instance = new ArtifactsManager();
43
- }
44
- return instance;
45
- }
46
-
47
- static removeInstance(): void {
48
- instance = null;
49
- }
50
-
51
- private constructor() {
52
- super();
53
- }
54
-
55
- get artifacts(): Artifact[] {
56
- return this.#artifacts;
57
- }
58
-
59
- addArtifact(artifact: Artifact): void {
60
- this.#artifacts.push(artifact);
61
- this.dispatchEvent(new ArtifactAddedEvent(artifact));
62
- }
63
-
64
- clear(): void {
65
- this.#artifacts = [];
66
- }
67
- }
@@ -1,183 +0,0 @@
1
- // Copyright 2025 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import './CollapsibleAssistanceContentWidget.js';
6
- import './PerformanceAgentFlameChart.js';
7
-
8
- import * as Common from '../../../core/common/common.js';
9
- import * as AiAssistanceModel from '../../../models/ai_assistance/ai_assistance.js';
10
- import * as Logs from '../../../models/logs/logs.js';
11
- import * as NetworkTimeCalculator from '../../../models/network_time_calculator/network_time_calculator.js';
12
- import * as Trace from '../../../models/trace/trace.js';
13
- import * as UI from '../../../ui/legacy/legacy.js';
14
- import * as Lit from '../../../ui/lit/lit.js';
15
- import * as NetworkForward from '../../network/forward/forward.js';
16
- import * as Network from '../../network/network.js';
17
- import * as Insights from '../../timeline/components/insights/insights.js';
18
- import * as Timeline from '../../timeline/timeline.js';
19
-
20
- import artifactsViewerStyles from './artifactsViewer.css.js';
21
- import type * as PerformanceAgentFlameChart from './PerformanceAgentFlameChart.js';
22
-
23
- const {html, render} = Lit;
24
-
25
- export interface ViewInput {
26
- artifacts: AiAssistanceModel.ArtifactsManager.Artifact[];
27
- parsedTrace: Trace.TraceModel.ParsedTrace;
28
- }
29
-
30
- export function renderArtifact(
31
- artifact: AiAssistanceModel.ArtifactsManager.Artifact, parsedTrace: Trace.TraceModel.ParsedTrace): Lit.LitTemplate {
32
- switch (artifact.type) {
33
- // clang-format off
34
- case 'insight': {
35
- const insightRenderer = new Insights.InsightRenderer.InsightRenderer();
36
- const componentName = artifact.insightType;
37
- const insightSet = parsedTrace.insights?.values().next().value;
38
- const insightModel = insightSet?.model[componentName as Trace.Insights.Types.InsightKeys];
39
-
40
- if (!insightModel) {
41
- return Lit.nothing;
42
- }
43
-
44
- return html`
45
- <devtools-collapsible-assistance-content-widget .data=${{
46
- headerText: `Insight - ${componentName}`,
47
- onReveal: () => {
48
- void UI.InspectorView.InspectorView.instance().showPanel('timeline').then(() => {
49
- Timeline.TimelinePanel.TimelinePanel.instance().revealInsight(insightModel);
50
- });
51
- },
52
- }}>
53
- ${insightRenderer.renderInsightToWidgetElement(parsedTrace, insightSet, insightModel, componentName, {
54
- selected: true,
55
- isAIAssistanceContext: true,
56
- })}
57
- </devtools-collapsible-assistance-content-widget>`;
58
- }
59
- case 'network-request': {
60
- const networkRequest = artifact.request;
61
- if ('args' in networkRequest && Trace.Types.Events.isSyntheticNetworkRequest(networkRequest)) {
62
- const calculator = new NetworkTimeCalculator.NetworkTimeCalculator(true);
63
- const sdkRequest = Logs.NetworkLog.NetworkLog.instance()
64
- .requestsForId(networkRequest.args.data.requestId)
65
- .find(r => r.url() === networkRequest.args.data.url) ??
66
- null;
67
- if (!sdkRequest) {
68
- return Lit.nothing;
69
- }
70
- return html`
71
- <devtools-collapsible-assistance-content-widget
72
- .data=${{
73
- headerText: `Network Request: ${
74
- sdkRequest.url().length > 80 ? sdkRequest.url().slice(0, 80) + '...' : sdkRequest.url()}`,
75
- onReveal: () => {
76
- void UI.InspectorView.InspectorView.instance().showPanel('network').then(() => {
77
- void Common.Revealer.reveal(NetworkForward.UIRequestLocation.UIRequestLocation.tab(
78
- sdkRequest, NetworkForward.UIRequestLocation.UIRequestTabs.TIMING));
79
- });
80
- },
81
- }}>
82
- <devtools-widget class="actions" .widgetConfig=${UI.Widget.widgetConfig(Network.RequestTimingView.RequestTimingView, {
83
- request: sdkRequest,
84
- calculator,
85
- })}></devtools-widget>
86
- </devtools-collapsible-assistance-content-widget>`;
87
- }
88
- return Lit.nothing;
89
- }
90
- case 'flamechart': {
91
- return html`
92
- <devtools-collapsible-assistance-content-widget .data=${{
93
- headerText: `Flamechart`,
94
- onReveal: () => {
95
- // eslint-disable-next-line no-console
96
- console.log('Reveal flamechart', artifact.start, artifact.end);
97
- },
98
- }}>
99
- <devtools-performance-agent-flame-chart .data=${{
100
- parsedTrace,
101
- start: artifact.start,
102
- end: artifact.end,
103
- } as PerformanceAgentFlameChart.PerformanceAgentFlameChartData}>
104
- </devtools-performance-agent-flame-chart>
105
- </devtools-collapsible-assistance-content-widget>`;
106
- }
107
- default:
108
- return Lit.nothing;
109
- // clang-format on
110
- }
111
- }
112
-
113
- export const DEFAULT_VIEW = (
114
- input: ViewInput,
115
- _output: Record<string, unknown>,
116
- target: HTMLElement,
117
- ): void => {
118
- // clang-format off
119
- render(
120
- html`
121
- <style>${artifactsViewerStyles}</style>
122
- <div class="artifacts-viewer">
123
- ${input.artifacts.map(artifact => renderArtifact(artifact, input.parsedTrace))}
124
- </div>
125
- `,
126
- target
127
- );
128
- // clang-format on
129
- };
130
-
131
- export type View = typeof DEFAULT_VIEW;
132
-
133
- export class ArtifactsViewer extends UI.Widget.Widget {
134
- #view: View;
135
- #parsedTrace: Trace.TraceModel.ParsedTrace|null;
136
- constructor(element?: HTMLElement, view = DEFAULT_VIEW) {
137
- super(element);
138
- this.#view = view;
139
- this.#parsedTrace = null;
140
- }
141
-
142
- override wasShown(): void {
143
- super.wasShown();
144
- AiAssistanceModel.ArtifactsManager.ArtifactsManager.instance().addEventListener(
145
- AiAssistanceModel.ArtifactsManager.ArtifactAddedEvent.eventName,
146
- () => {
147
- if (this.#parsedTrace) {
148
- this.performUpdate();
149
- }
150
- },
151
- );
152
-
153
- UI.Context.Context.instance().addFlavorChangeListener(
154
- AiAssistanceModel.AIContext.AgentFocus,
155
- ({data}) => {
156
- this.#parsedTrace = data.parsedTrace;
157
- if (this.#parsedTrace) {
158
- this.performUpdate();
159
- }
160
- },
161
- );
162
-
163
- const focus = UI.Context.Context.instance().flavor(AiAssistanceModel.AIContext.AgentFocus);
164
- if (focus) {
165
- this.#parsedTrace = focus.parsedTrace;
166
- this.performUpdate();
167
- }
168
- }
169
-
170
- override performUpdate(): void {
171
- if (!this.#parsedTrace) {
172
- return;
173
- }
174
- this.#view(
175
- {
176
- artifacts: AiAssistanceModel.ArtifactsManager.ArtifactsManager.instance().artifacts,
177
- parsedTrace: this.#parsedTrace,
178
- },
179
- {},
180
- this.contentElement,
181
- );
182
- }
183
- }