chrome-devtools-frontend 1.0.1571573 → 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 (140) hide show
  1. package/front_end/Images/geminiInDevTools.png +0 -0
  2. package/front_end/Images/geminiInDevTools_2x.png +0 -0
  3. package/front_end/Images/src/database-off.svg +1 -0
  4. package/front_end/Images/src/lock-person.svg +1 -1
  5. package/front_end/core/common/Debouncer.ts +10 -1
  6. package/front_end/core/common/SettingRegistration.ts +1 -1
  7. package/front_end/core/host/AidaClient.ts +8 -0
  8. package/front_end/core/host/InspectorFrontendHostAPI.ts +0 -6
  9. package/front_end/core/host/UserMetrics.ts +0 -30
  10. package/front_end/core/root/ExperimentNames.ts +30 -0
  11. package/front_end/core/root/Runtime.ts +12 -27
  12. package/front_end/core/root/root.ts +2 -0
  13. package/front_end/core/sdk/CSSModel.ts +36 -13
  14. package/front_end/core/sdk/CSSProperty.ts +1 -1
  15. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +9 -0
  16. package/front_end/core/sdk/CookieModel.ts +2 -1
  17. package/front_end/core/sdk/DOMModel.ts +1 -1
  18. package/front_end/core/sdk/DebuggerModel.ts +1 -1
  19. package/front_end/core/sdk/OverlayModel.ts +1 -1
  20. package/front_end/core/sdk/SourceMap.ts +1 -1
  21. package/front_end/devtools_compatibility.js +0 -6
  22. package/front_end/entrypoints/main/MainImpl.ts +34 -25
  23. package/front_end/entrypoints/main/main-meta.ts +1 -1
  24. package/front_end/generated/SupportedCSSProperties.js +4 -8
  25. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +0 -180
  26. package/front_end/models/ai_assistance/ai_assistance.ts +0 -2
  27. package/front_end/models/breakpoints/BreakpointManager.ts +3 -3
  28. package/front_end/models/issues_manager/ContrastCheckTrigger.ts +2 -2
  29. package/front_end/models/source_map_scopes/NamesResolver.ts +1 -1
  30. package/front_end/models/trace/EventsSerializer.ts +5 -1
  31. package/front_end/models/trace/types/TraceEvents.ts +4 -0
  32. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +1 -1
  33. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +1 -1
  34. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +8 -63
  35. package/front_end/panels/ai_assistance/aiAssistancePanel.css +0 -16
  36. package/front_end/panels/ai_assistance/ai_assistance.ts +0 -1
  37. package/front_end/panels/ai_assistance/components/ChatView.ts +123 -108
  38. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +1 -145
  39. package/front_end/panels/application/DeviceBoundSessionsModel.ts +23 -1
  40. package/front_end/panels/application/DeviceBoundSessionsTreeElement.ts +23 -0
  41. package/front_end/panels/application/FrameDetailsView.ts +11 -10
  42. package/front_end/panels/application/components/BackForwardCacheView.ts +6 -8
  43. package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +4 -3
  44. package/front_end/panels/application/components/ProtocolHandlersView.ts +5 -6
  45. package/front_end/panels/application/components/ReportsGrid.ts +8 -9
  46. package/front_end/panels/application/components/SharedStorageAccessGrid.ts +5 -4
  47. package/front_end/panels/application/components/TrustTokensView.ts +4 -6
  48. package/front_end/panels/application/preloading/PreloadingView.ts +9 -8
  49. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +237 -230
  50. package/front_end/panels/application/preloading/components/PreloadingGrid.ts +3 -2
  51. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +6 -10
  52. package/front_end/panels/application/resourcesSidebar.css +8 -0
  53. package/front_end/panels/autofill/AutofillView.ts +4 -3
  54. package/front_end/panels/common/AiCodeGenerationTeaser.ts +35 -4
  55. package/front_end/panels/common/BadgeNotification.ts +17 -14
  56. package/front_end/panels/common/GdpSignUpDialog.ts +5 -6
  57. package/front_end/panels/common/GeminiRebrandPromoDialog.ts +192 -0
  58. package/front_end/panels/common/aiCodeGenerationTeaser.css +16 -1
  59. package/front_end/panels/common/common.ts +1 -0
  60. package/front_end/panels/common/geminiRebrandPromoDialog.css +47 -0
  61. package/front_end/panels/console/ErrorStackParser.ts +11 -16
  62. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +2 -2
  63. package/front_end/panels/css_overview/CSSOverviewModel.ts +1 -1
  64. package/front_end/panels/elements/ComputedStyleModel.ts +7 -54
  65. package/front_end/panels/elements/ElementsPanel.ts +33 -6
  66. package/front_end/panels/elements/ElementsTreeOutline.ts +1 -1
  67. package/front_end/panels/elements/StylePropertiesSection.ts +16 -8
  68. package/front_end/panels/elements/StylePropertyTreeElement.ts +67 -32
  69. package/front_end/panels/elements/StylesSidebarPane.ts +28 -11
  70. package/front_end/panels/elements/components/CSSHintDetailsView.ts +3 -2
  71. package/front_end/panels/elements/components/CSSPropertyDocsView.ts +3 -2
  72. package/front_end/panels/elements/elements-meta.ts +1 -1
  73. package/front_end/panels/issues/IssueView.ts +6 -6
  74. package/front_end/panels/network/RequestConditionsDrawer.ts +4 -3
  75. package/front_end/panels/network/RequestCookiesView.ts +3 -4
  76. package/front_end/panels/network/RequestTimingView.ts +2 -7
  77. package/front_end/panels/network/components/HeaderSectionRow.ts +3 -2
  78. package/front_end/panels/network/components/RequestHeaderSection.ts +3 -1
  79. package/front_end/panels/profiler/HeapProfileView.ts +3 -3
  80. package/front_end/panels/profiler/HeapSnapshotView.ts +1 -1
  81. package/front_end/panels/profiler/profiler-meta.ts +3 -3
  82. package/front_end/panels/protocol_monitor/protocol_monitor-meta.ts +1 -1
  83. package/front_end/panels/recorder/RecorderController.ts +2 -7
  84. package/front_end/panels/recorder/components/CreateRecordingView.ts +6 -6
  85. package/front_end/panels/recorder/components/RecordingView.ts +0 -38
  86. package/front_end/panels/recorder/components/ReplaySection.ts +0 -14
  87. package/front_end/panels/recorder/components/StepEditor.ts +2 -40
  88. package/front_end/panels/recorder/recorderController.css +3 -3
  89. package/front_end/panels/security/CookieReportView.ts +14 -14
  90. package/front_end/panels/security/cookieControlsView.css +1 -1
  91. package/front_end/panels/security/cookieReportView.css +1 -1
  92. package/front_end/panels/settings/AISettingsTab.ts +8 -10
  93. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +4 -12
  94. package/front_end/panels/settings/settings-meta.ts +1 -1
  95. package/front_end/panels/sources/BreakpointEditDialog.ts +4 -3
  96. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +1 -1
  97. package/front_end/panels/sources/NavigatorView.ts +4 -4
  98. package/front_end/panels/sources/SourcesPanel.ts +5 -4
  99. package/front_end/panels/sources/components/HeadersView.ts +2 -2
  100. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +3 -2
  101. package/front_end/panels/timeline/ThreadAppender.ts +2 -1
  102. package/front_end/panels/timeline/TimelineController.ts +3 -3
  103. package/front_end/panels/timeline/TimelinePanel.ts +6 -4
  104. package/front_end/panels/timeline/TimelineUIUtils.ts +2 -2
  105. package/front_end/panels/timeline/components/ExportTraceOptions.ts +4 -4
  106. package/front_end/panels/timeline/components/FieldSettingsDialog.ts +13 -6
  107. package/front_end/panels/timeline/components/LiveMetricsView.ts +13 -9
  108. package/front_end/panels/timeline/components/exportTraceOptions.css +1 -1
  109. package/front_end/panels/timeline/components/fieldSettingsDialog.css +1 -1
  110. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +2 -19
  111. package/front_end/panels/timeline/components/insights/InsightRenderer.ts +3 -4
  112. package/front_end/panels/timeline/components/insights/baseInsightComponent.css +0 -5
  113. package/front_end/panels/timeline/components/liveMetricsView.css +1 -1
  114. package/front_end/third_party/chromium/README.chromium +1 -1
  115. package/front_end/ui/components/buttons/button.css +4 -0
  116. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +5 -5
  117. package/front_end/ui/components/panel_feedback/previewToggle.css +2 -2
  118. package/front_end/ui/components/text_editor/AiCodeGenerationParser.ts +27 -8
  119. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +36 -6
  120. package/front_end/ui/legacy/ActionRegistration.ts +1 -1
  121. package/front_end/ui/legacy/ContextMenu.ts +2 -2
  122. package/front_end/ui/legacy/EmptyWidget.ts +3 -3
  123. package/front_end/ui/legacy/LinkContextMenuProvider.ts +42 -0
  124. package/front_end/ui/legacy/ViewRegistration.ts +1 -1
  125. package/front_end/ui/legacy/XLink.ts +0 -27
  126. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +1 -1
  127. package/front_end/ui/legacy/components/color_picker/ContrastOverlay.ts +4 -4
  128. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -2
  129. package/front_end/ui/legacy/components/perf_ui/perf_ui-meta.ts +1 -1
  130. package/front_end/ui/legacy/inspectorCommon.css +2 -1
  131. package/front_end/ui/legacy/legacy.ts +3 -1
  132. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  133. package/front_end/ui/visual_logging/LoggingDriver.ts +3 -0
  134. package/package.json +1 -1
  135. package/front_end/models/ai_assistance/ArtifactsManager.ts +0 -67
  136. package/front_end/panels/ai_assistance/components/ArtifactsViewer.ts +0 -183
  137. package/front_end/panels/ai_assistance/components/CollapsibleAssistanceContentWidget.ts +0 -89
  138. package/front_end/panels/ai_assistance/components/PerformanceAgentFlameChart.ts +0 -133
  139. package/front_end/panels/ai_assistance/components/artifactsViewer.css +0 -15
  140. package/front_end/panels/ai_assistance/components/collapsibleAssistanceContentWidget.css +0 -32
@@ -16,7 +16,7 @@ export interface PreviewToggleData {
16
16
  name: string;
17
17
  helperText: string|null;
18
18
  feedbackURL: string|null;
19
- experiment: Root.Runtime.ExperimentName;
19
+ experiment: Root.ExperimentNames.ExperimentName;
20
20
  learnMoreURL?: string;
21
21
  onChangeCallback?: (checked: boolean) => void;
22
22
  }
@@ -46,7 +46,7 @@ export class PreviewToggle extends HTMLElement {
46
46
  #helperText: string|null = null;
47
47
  #feedbackURL: string|null = null;
48
48
  #learnMoreURL: string|undefined;
49
- #experiment: Root.Runtime.ExperimentName|'' = '';
49
+ #experiment: Root.ExperimentNames.ExperimentName|'' = '';
50
50
  #onChangeCallback?: (checked: boolean) => void;
51
51
 
52
52
  set data(data: PreviewToggleData) {
@@ -76,14 +76,14 @@ export class PreviewToggle extends HTMLElement {
76
76
  </devtools-checkbox>
77
77
  <div class="spacer"></div>
78
78
  ${this.#feedbackURL && !this.#helperText
79
- ? html`<div class="feedback"><devtools-link class="x-link" href=${this.#feedbackURL}>${i18nString(UIStrings.shortFeedbackLink)}</devtools-link></div>`
79
+ ? html`<div class="feedback"><devtools-link class="devtools-link" href=${this.#feedbackURL} jslogContext=${'feedback'}>${i18nString(UIStrings.shortFeedbackLink)}</devtools-link></div>`
80
80
  : nothing}
81
81
  ${this.#learnMoreURL
82
- ? html`<div class="learn-more"><devtools-link class="x-link" href=${this.#learnMoreURL}>${i18nString(UIStrings.learnMoreLink)}</devtools-link></div>`
82
+ ? html`<div class="learn-more"><devtools-link class="devtools-link" href=${this.#learnMoreURL} jslogContext=${'learn-more'}>${i18nString(UIStrings.learnMoreLink)}</devtools-link></div>`
83
83
  : nothing}
84
84
  <div class="helper">
85
85
  ${this.#helperText && this.#feedbackURL
86
- ? html`<p>${this.#helperText} <devtools-link class="x-link" href=${this.#feedbackURL}>${i18nString(UIStrings.previewTextFeedbackLink)}</devtools-link></p>`
86
+ ? html`<p>${this.#helperText} <devtools-link class="devtools-link" href=${this.#feedbackURL} jslogContext=${'feedback'}>${i18nString(UIStrings.previewTextFeedbackLink)}</devtools-link></p>`
87
87
  : nothing}
88
88
  </div>
89
89
  </div>`,
@@ -30,12 +30,12 @@
30
30
  flex: 1;
31
31
  }
32
32
 
33
- .x-link {
33
+ .devtools-link {
34
34
  color: var(--sys-color-primary);
35
35
  text-decoration-line: underline;
36
36
  margin: 0 4px;
37
37
  }
38
38
 
39
- .feedback .x-link {
39
+ .feedback .devtools-link {
40
40
  color: var(--sys-color-token-subtle);
41
41
  }
@@ -9,6 +9,11 @@ const BLOCK_COMMENT_START_PATTERN = /^\/\*+\s*/;
9
9
  const BLOCK_COMMENT_END_PATTERN = /\s*\*+\/$/;
10
10
  const BLOCK_COMMENT_LINE_PREFIX_PATTERN = /^\s*\*\s?/;
11
11
 
12
+ export interface CommentNodeInfo {
13
+ text: string;
14
+ to: number;
15
+ }
16
+
12
17
  function findLastNonWhitespacePos(state: CodeMirror.EditorState, cursorPosition: number): number {
13
18
  const line = state.doc.lineAt(cursorPosition);
14
19
  const textBefore = line.text.substring(0, cursorPosition - line.from);
@@ -23,8 +28,8 @@ function resolveCommentNode(state: CodeMirror.EditorState, cursorPosition: numbe
23
28
  // The bias of -1 makes it check the character to the left of the position.
24
29
  const node = tree.resolveInner(lookupPos, -1);
25
30
  const nodeType = node.type.name;
26
- // Check if the node type is a comment AND the cursor is within the node's range.
27
- if (nodeType.includes('Comment') && cursorPosition >= node.to) {
31
+ // Check if the node type is a comment
32
+ if (nodeType.includes('Comment')) {
28
33
  if (!nodeType.includes('BlockComment')) {
29
34
  return node;
30
35
  }
@@ -48,7 +53,14 @@ function resolveCommentNode(state: CodeMirror.EditorState, cursorPosition: numbe
48
53
 
49
54
  function extractBlockComment(rawText: string): string|undefined {
50
55
  // Remove /* and */, whitespace, and common leading asterisks on new lines
51
- let cleaned = rawText.replace(BLOCK_COMMENT_START_PATTERN, '').replace(BLOCK_COMMENT_END_PATTERN, '');
56
+ if (!rawText.match(BLOCK_COMMENT_START_PATTERN)) {
57
+ return;
58
+ }
59
+ let cleaned = rawText.replace(BLOCK_COMMENT_START_PATTERN, '');
60
+ if (!cleaned.match(BLOCK_COMMENT_END_PATTERN)) {
61
+ return;
62
+ }
63
+ cleaned = cleaned.replace(BLOCK_COMMENT_END_PATTERN, '');
52
64
  // Remove leading " * " from multi-line block comments
53
65
  cleaned = cleaned.split('\n').map(line => line.replace(BLOCK_COMMENT_LINE_PREFIX_PATTERN, '')).join('\n').trim();
54
66
  return cleaned;
@@ -59,19 +71,26 @@ function extractLineComment(rawText: string): string {
59
71
  }
60
72
 
61
73
  export class AiCodeGenerationParser {
62
- static extractCommentText(state: CodeMirror.EditorState, cursorPosition: number): string|undefined {
74
+ static extractCommentNodeInfo(state: CodeMirror.EditorState, cursorPosition: number): CommentNodeInfo|undefined {
63
75
  const node = resolveCommentNode(state, cursorPosition);
64
76
  if (!node) {
65
77
  return;
66
78
  }
67
79
  const nodeType = node.type.name;
68
80
  const rawText = state.doc.sliceString(node.from, node.to);
81
+ let text = '';
69
82
  if (nodeType.includes('LineComment')) {
70
- return extractLineComment(rawText);
83
+ text = extractLineComment(rawText);
84
+ } else if (nodeType.includes('BlockComment')) {
85
+ text = extractBlockComment(rawText) ?? '';
86
+ } else {
87
+ text = rawText;
71
88
  }
72
- if (nodeType.includes('BlockComment')) {
73
- return extractBlockComment(rawText);
89
+
90
+ if (!Boolean(text)) {
91
+ return;
74
92
  }
75
- return rawText;
93
+
94
+ return {text, to: node.to};
76
95
  }
77
96
  }
@@ -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
  }
@@ -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(Root.Runtime.ExperimentName.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(Root.Runtime.ExperimentName.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,7 @@ export class ContrastOverlay {
50
50
  if (!this.visible || this.contrastInfo.isNull()) {
51
51
  return;
52
52
  }
53
- if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.APCA) &&
53
+ if (Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.APCA) &&
54
54
  this.contrastInfo.contrastRatioAPCA() === null) {
55
55
  return;
56
56
  }
@@ -91,7 +91,7 @@ export class ContrastRatioLineBuilder {
91
91
  }
92
92
 
93
93
  drawContrastRatioLine(width: number, height: number, level: string): string|null {
94
- const isAPCA = Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.APCA);
94
+ const isAPCA = Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.APCA);
95
95
  const requiredContrast =
96
96
  isAPCA ? this.contrastInfo.contrastRatioAPCAThreshold() : this.contrastInfo.contrastRatioThreshold(level);
97
97
  if (!width || !height || requiredContrast === null) {
@@ -140,7 +140,7 @@ export class ContrastRatioLineBuilder {
140
140
  Common.ColorUtils.blendColors(Common.Color.Legacy.fromHSVA(candidateHSVA).rgba(), bgRGBA));
141
141
  };
142
142
 
143
- if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.APCA)) {
143
+ if (Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.APCA)) {
144
144
  candidateLuminance = (candidateHSVA: Common.ColorUtils.Color4D) => {
145
145
  return Common.ColorUtils.luminanceAPCA(
146
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',
@@ -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.1571573"
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
- }