chrome-devtools-frontend 1.0.1545096 → 1.0.1547147

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 (124) hide show
  1. package/docs/styleguide/ux/styles.md +1 -1
  2. package/eslint.config.mjs +1 -1
  3. package/front_end/Images/src/arrow-down.svg +8 -1
  4. package/front_end/Images/src/arrow-up.svg +8 -1
  5. package/front_end/core/host/AidaClient.ts +1 -1
  6. package/front_end/core/host/InspectorFrontendHostAPI.ts +0 -1
  7. package/front_end/core/host/UserMetrics.ts +0 -5
  8. package/front_end/core/platform/HostRuntime.ts +18 -0
  9. package/front_end/core/platform/KeyboardUtilities.ts +2 -2
  10. package/front_end/core/platform/StringUtilities.ts +1 -1
  11. package/front_end/core/platform/api/HostRuntime.ts +20 -0
  12. package/front_end/core/platform/api/api.ts +7 -0
  13. package/front_end/core/platform/browser/HostRuntime.ts +14 -0
  14. package/front_end/core/platform/browser/browser.ts +7 -0
  15. package/front_end/core/platform/node/HostRuntime.ts +13 -0
  16. package/front_end/core/platform/node/node.ts +7 -0
  17. package/front_end/core/platform/platform.ts +2 -2
  18. package/front_end/core/sdk/SourceMapScopesInfo.ts +141 -23
  19. package/front_end/core/sdk/Target.ts +5 -14
  20. package/front_end/core/sdk/TargetManager.ts +26 -4
  21. package/front_end/core/sdk/sdk-meta.ts +62 -0
  22. package/front_end/devtools_compatibility.js +0 -1
  23. package/front_end/entrypoints/main/MainImpl.ts +2 -2
  24. package/front_end/foundation/Universe.ts +2 -2
  25. package/front_end/generated/Deprecation.ts +7 -0
  26. package/front_end/generated/InspectorBackendCommands.ts +1 -1
  27. package/front_end/generated/SupportedCSSProperties.js +4 -2
  28. package/front_end/generated/protocol.ts +3 -2
  29. package/front_end/models/ai_assistance/AiConversation.ts +188 -0
  30. package/front_end/models/ai_assistance/AiHistoryStorage.ts +1 -172
  31. package/front_end/models/ai_assistance/ConversationHandler.ts +5 -5
  32. package/front_end/models/ai_assistance/agents/AiAgent.ts +1 -3
  33. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +6 -2
  34. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +1 -1
  35. package/front_end/models/ai_assistance/agents/StylingAgent.ts +3 -9
  36. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  37. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +313 -313
  38. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +8 -6
  39. package/front_end/models/ai_assistance/performance/AICallTree.snapshot.txt +33 -33
  40. package/front_end/models/ai_assistance/performance/AICallTree.ts +9 -3
  41. package/front_end/models/bindings/CSSWorkspaceBinding.ts +5 -3
  42. package/front_end/models/bindings/SASSSourceMapping.ts +6 -4
  43. package/front_end/models/cpu_profile/CPUProfileDataModel.ts +10 -7
  44. package/front_end/models/crux-manager/CrUXManager.ts +7 -4
  45. package/front_end/models/issues_manager/GenericIssue.ts +12 -9
  46. package/front_end/models/javascript_metadata/NativeFunctions.js +4 -0
  47. package/front_end/models/trace/handlers/SamplesHandler.ts +3 -0
  48. package/front_end/models/trace/helpers/Trace.ts +13 -0
  49. package/front_end/models/trace/types/TraceEvents.ts +2 -1
  50. package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +29 -0
  51. package/front_end/models/workspace/IgnoreListManager.ts +1 -2
  52. package/front_end/models/workspace/UISourceCode.ts +50 -0
  53. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +9 -9
  54. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +8 -0
  55. package/front_end/panels/ai_assistance/components/ChatView.ts +2 -2
  56. package/front_end/panels/animation/AnimationTimeline.ts +0 -8
  57. package/front_end/panels/application/FrameDetailsView.ts +8 -8
  58. package/front_end/panels/application/components/StackTrace.ts +84 -85
  59. package/front_end/panels/common/AiCodeGenerationTeaser.ts +80 -0
  60. package/front_end/panels/common/common.ts +2 -1
  61. package/front_end/panels/console/ConsolePrompt.ts +3 -1
  62. package/front_end/panels/console/ConsoleViewport.ts +1 -2
  63. package/front_end/panels/elements/ElementIssueUtils.ts +2 -2
  64. package/front_end/panels/elements/StylePropertyTreeElement.ts +23 -19
  65. package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
  66. package/front_end/panels/elements/cssValueTraceView.css +1 -1
  67. package/front_end/panels/elements/elements-meta.ts +1 -0
  68. package/front_end/panels/explain/components/ConsoleInsight.ts +44 -57
  69. package/front_end/panels/explain/components/consoleInsight.css +46 -1
  70. package/front_end/panels/layer_viewer/LayerTreeOutline.ts +1 -2
  71. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +19 -0
  72. package/front_end/panels/network/RequestConditionsDrawer.ts +54 -24
  73. package/front_end/panels/network/networkLogView.css +11 -0
  74. package/front_end/panels/network/networkTimingTable.css +8 -6
  75. package/front_end/panels/network/requestConditionsDrawer.css +10 -1
  76. package/front_end/panels/profiler/ProfilesPanel.ts +1 -2
  77. package/front_end/panels/settings/KeybindsSettingsTab.ts +20 -21
  78. package/front_end/panels/sources/CoveragePlugin.ts +5 -5
  79. package/front_end/panels/sources/Plugin.ts +1 -1
  80. package/front_end/panels/sources/ProfilePlugin.ts +22 -14
  81. package/front_end/panels/sources/UISourceCodeFrame.ts +2 -1
  82. package/front_end/panels/sources/sources-meta.ts +0 -62
  83. package/front_end/panels/timeline/README.md +1 -9
  84. package/front_end/panels/timeline/ThreadAppender.ts +0 -7
  85. package/front_end/panels/timeline/TimelinePanel.ts +1 -1
  86. package/front_end/panels/timeline/TimelineUIUtils.ts +2 -0
  87. package/front_end/panels/timeline/components/ExportTraceOptions.ts +15 -1
  88. package/front_end/panels/timeline/components/LiveMetricsView.ts +37 -1
  89. package/front_end/panels/timeline/components/exportTraceOptions.css +11 -2
  90. package/front_end/third_party/chromium/README.chromium +1 -1
  91. package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +1 -0
  92. package/front_end/ui/legacy/ARIAUtils.ts +2 -2
  93. package/front_end/ui/legacy/ActionRegistration.ts +11 -0
  94. package/front_end/ui/legacy/SoftDropDown.ts +2 -2
  95. package/front_end/ui/legacy/TextPrompt.ts +3 -2
  96. package/front_end/ui/legacy/Treeoutline.ts +2 -1
  97. package/front_end/ui/legacy/UIUtils.ts +11 -10
  98. package/front_end/ui/legacy/Widget.ts +3 -2
  99. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +2 -2
  100. package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +62 -39
  101. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +1 -1
  102. package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +2 -2
  103. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +2 -7
  104. package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +1 -2
  105. package/front_end/ui/legacy/inspectorCommon.css +2 -2
  106. package/front_end/ui/legacy/legacy.ts +2 -0
  107. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  108. package/package.json +1 -1
  109. package/front_end/panels/explain/components/consoleInsightSourcesList.css +0 -51
  110. package/front_end/ui/components/docs/README.md +0 -6
  111. package/front_end/ui/components/docs/building-ui-documentation/ComponentEvents.md +0 -54
  112. package/front_end/ui/components/docs/building-ui-documentation/ComponentPerformance.md +0 -136
  113. package/front_end/ui/components/docs/building-ui-documentation/CreatingComponents.md +0 -242
  114. package/front_end/ui/components/docs/building-ui-documentation/README.md +0 -23
  115. package/front_end/ui/components/docs/building-ui-documentation/StylingComponents.md +0 -66
  116. package/front_end/ui/components/docs/building-ui-documentation/TestingComponents.md +0 -111
  117. package/front_end/ui/components/docs/component_docs.ts +0 -24
  118. package/front_end/ui/components/docs/component_docs_styles.css +0 -53
  119. package/front_end/ui/components/docs/create_breadcrumbs.ts +0 -44
  120. package/front_end/ui/components/docs/slider/basic.html +0 -20
  121. package/front_end/ui/components/docs/switch/basic.html +0 -20
  122. /package/front_end/models/issues_manager/descriptions/{genericFormAriaLabelledByToNonExistingId.md → genericFormAriaLabelledByToNonExistingIdError.md} +0 -0
  123. /package/front_end/models/issues_manager/descriptions/{genericFormLabelHasNeitherForNorNestedInput.md → genericFormLabelHasNeitherForNorNestedInputError.md} +0 -0
  124. /package/front_end/{core/platform → ui/legacy}/DOMUtilities.ts +0 -0
@@ -161,6 +161,7 @@ UI.ActionRegistration.registerActionExtension({
161
161
  },
162
162
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
163
163
  title: titleForAiAssistanceActions,
164
+ configurableBindings: false,
164
165
  featurePromotionId: 'ai-assistance',
165
166
  async loadActionDelegate() {
166
167
  const AiAssistance = await loadAiAssistanceModule();
@@ -176,6 +177,7 @@ UI.ActionRegistration.registerActionExtension({
176
177
  },
177
178
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
178
179
  title: titleForAiAssistanceActions,
180
+ configurableBindings: false,
179
181
  async loadActionDelegate() {
180
182
  const AiAssistance = await loadAiAssistanceModule();
181
183
  return new AiAssistance.ActionDelegate();
@@ -191,6 +193,7 @@ UI.ActionRegistration.registerActionExtension({
191
193
  },
192
194
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
193
195
  title: titleForAiAssistanceActions,
196
+ configurableBindings: false,
194
197
  async loadActionDelegate() {
195
198
  const AiAssistance = await loadAiAssistanceModule();
196
199
  return new AiAssistance.ActionDelegate();
@@ -206,6 +209,7 @@ UI.ActionRegistration.registerActionExtension({
206
209
  },
207
210
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
208
211
  title: titleForAiAssistanceActions,
212
+ configurableBindings: false,
209
213
  async loadActionDelegate() {
210
214
  const AiAssistance = await loadAiAssistanceModule();
211
215
  return new AiAssistance.ActionDelegate();
@@ -221,6 +225,7 @@ UI.ActionRegistration.registerActionExtension({
221
225
  },
222
226
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
223
227
  title: titleForAiAssistanceActions,
228
+ configurableBindings: false,
224
229
  async loadActionDelegate() {
225
230
  const AiAssistance = await loadAiAssistanceModule();
226
231
  return new AiAssistance.ActionDelegate();
@@ -236,6 +241,7 @@ UI.ActionRegistration.registerActionExtension({
236
241
  },
237
242
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
238
243
  title: titleForAiAssistanceActions,
244
+ configurableBindings: false,
239
245
  async loadActionDelegate() {
240
246
  const AiAssistance = await loadAiAssistanceModule();
241
247
  return new AiAssistance.ActionDelegate();
@@ -251,6 +257,7 @@ UI.ActionRegistration.registerActionExtension({
251
257
  },
252
258
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
253
259
  title: titleForAiAssistanceActions,
260
+ configurableBindings: false,
254
261
  async loadActionDelegate() {
255
262
  const AiAssistance = await loadAiAssistanceModule();
256
263
  return new AiAssistance.ActionDelegate();
@@ -265,6 +272,7 @@ UI.ActionRegistration.registerActionExtension({
265
272
  },
266
273
  category: UI.ActionRegistration.ActionCategory.GLOBAL,
267
274
  title: titleForAiAssistanceActions,
275
+ configurableBindings: false,
268
276
  async loadActionDelegate() {
269
277
  const AiAssistance = await loadAiAssistanceModule();
270
278
  return new AiAssistance.ActionDelegate();
@@ -698,7 +698,7 @@ function renderStep({step, isLoading, markdownRenderer, isLast}: {
698
698
  }): Lit.LitTemplate {
699
699
  const stepClasses = Lit.Directives.classMap({
700
700
  step: true,
701
- empty: !step.thought && !step.code && !step.contextDetails,
701
+ empty: !step.thought && !step.code && !step.contextDetails && !step.sideEffect,
702
702
  paused: Boolean(step.sideEffect),
703
703
  canceled: Boolean(step.canceled),
704
704
  });
@@ -884,7 +884,7 @@ function renderChatMessage({
884
884
  }
885
885
 
886
886
  function renderImageChatMessage(inlineData: Host.AidaClient.MediaBlob): Lit.LitTemplate {
887
- if (inlineData.data === AiAssistanceModel.AiHistoryStorage.NOT_FOUND_IMAGE_DATA) {
887
+ if (inlineData.data === AiAssistanceModel.AiConversation.NOT_FOUND_IMAGE_DATA) {
888
888
  // clang-format off
889
889
  return html`<div class="unavailable-image" title=${UIStringsNotTranslate.imageUnavailable}>
890
890
  <devtools-icon name='file-image'></devtools-icon>
@@ -508,14 +508,6 @@ export class AnimationTimeline extends UI.Widget.VBox implements
508
508
  }
509
509
 
510
510
  private setPlaybackRate(playbackRate: number): void {
511
- if (playbackRate !== this.#playbackRate) {
512
- Host.userMetrics.animationPlaybackRateChanged(
513
- playbackRate === 0.1 ? Host.UserMetrics.AnimationsPlaybackRate.PERCENT_10 :
514
- playbackRate === 0.25 ? Host.UserMetrics.AnimationsPlaybackRate.PERCENT_25 :
515
- playbackRate === 1 ? Host.UserMetrics.AnimationsPlaybackRate.PERCENT_100 :
516
- Host.UserMetrics.AnimationsPlaybackRate.OTHER);
517
- }
518
-
519
511
  this.#playbackRate = playbackRate;
520
512
  for (const animationModel of SDK.TargetManager.TargetManager.instance().models(
521
513
  SDK.AnimationModel.AnimationModel, {scoped: true})) {
@@ -453,14 +453,14 @@ function maybeRenderCreationStacktrace(
453
453
  return html`
454
454
  <devtools-report-key title=${i18nString(UIStrings.creationStackTraceExplanation)}>${
455
455
  i18nString(UIStrings.creationStackTrace)}</devtools-report-key>
456
- <devtools-report-value
457
- jslog=${VisualLogging.section('frame-creation-stack-trace')}
458
- >
459
- <devtools-resources-stack-trace .data=${{
460
- creationStackTraceData,
461
- buildStackTraceRows: Components.JSPresentationUtils.buildStackTraceRowsForLegacyRuntimeStackTrace,
462
- } as ApplicationComponents.StackTrace.StackTraceData}>
463
- </devtools-resources-stack-trace>
456
+ <devtools-report-value jslog=${VisualLogging.section('frame-creation-stack-trace')}>
457
+ <devtools-widget .widgetConfig=${widgetConfig(
458
+ ApplicationComponents.StackTrace.StackTrace, { data: {
459
+ creationStackTraceData,
460
+ buildStackTraceRows: Components.JSPresentationUtils.buildStackTraceRowsForLegacyRuntimeStackTrace }
461
+ }
462
+ )}>
463
+ </devtools-widget>
464
464
  </devtools-report-value>
465
465
  `;
466
466
  // clang-format on
@@ -9,13 +9,14 @@ import * as i18n from '../../../core/i18n/i18n.js';
9
9
  import type * as SDK from '../../../core/sdk/sdk.js';
10
10
  import type * as Protocol from '../../../generated/protocol.js';
11
11
  import * as Components from '../../../ui/legacy/components/utils/utils.js';
12
- import * as Lit from '../../../ui/lit/lit.js';
12
+ import * as UI from '../../../ui/legacy/legacy.js';
13
+ import {html, nothing, render, type TemplateResult} from '../../../ui/lit/lit.js';
13
14
  import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
14
15
 
15
16
  import stackTraceLinkButtonStyles from './stackTraceLinkButton.css.js';
16
17
  import stackTraceRowStyles from './stackTraceRow.css.js';
17
18
 
18
- const {html} = Lit;
19
+ const {widgetConfig} = UI.Widget;
19
20
 
20
21
  const UIStrings = {
21
22
  /**
@@ -54,89 +55,95 @@ export interface StackTraceData {
54
55
  ) => Array<Components.JSPresentationUtils.StackTraceRegularRow|Components.JSPresentationUtils.StackTraceAsyncRow>;
55
56
  }
56
57
 
57
- interface StackTraceRowData {
58
- stackTraceRowItem: Components.JSPresentationUtils.StackTraceRegularRow;
58
+ interface StackTraceRowViewInput {
59
+ stackTraceRowItem: Components.JSPresentationUtils.StackTraceRegularRow|null;
59
60
  }
60
61
 
61
- export class StackTraceRow extends HTMLElement {
62
- readonly #shadow = this.attachShadow({mode: 'open'});
63
-
64
- #stackTraceRowItem: Components.JSPresentationUtils.StackTraceRegularRow|null = null;
65
-
66
- set data(data: StackTraceRowData) {
67
- this.#stackTraceRowItem = data.stackTraceRowItem;
68
- this.#render();
62
+ type StackTraceRowView = (input: StackTraceRowViewInput, output: undefined, target: HTMLElement) => void;
63
+ const ROW_DEFAULT_VIEW: StackTraceRowView = (input, output, target) => {
64
+ if (!input.stackTraceRowItem) {
65
+ return;
66
+ }
67
+ // clang-format off
68
+ render(html`
69
+ <style>${stackTraceRowStyles}</style>
70
+ <div class="stack-trace-row">
71
+ <div class="stack-trace-function-name text-ellipsis" title=${input.stackTraceRowItem.functionName}>
72
+ ${input.stackTraceRowItem.functionName}
73
+ </div>
74
+ <div class="stack-trace-source-location">
75
+ ${input.stackTraceRowItem.link ? html`
76
+ <div class="text-ellipsis">\xA0@\xA0${input.stackTraceRowItem.link}</div>` :
77
+ nothing}
78
+ </div>
79
+ </div>`, target);
80
+ // clang-format on
81
+ };
82
+
83
+ export class StackTraceRow extends UI.Widget.Widget {
84
+ constructor(element?: HTMLElement, view = ROW_DEFAULT_VIEW) {
85
+ super(element, {useShadowDom: true});
86
+ this.#view = view;
69
87
  }
70
88
 
71
- #render(): void {
72
- if (!this.#stackTraceRowItem) {
73
- return;
74
- }
75
- Lit.render(
76
- html`
77
- <style>${stackTraceRowStyles}</style>
78
- <div class="stack-trace-row">
79
- <div class="stack-trace-function-name text-ellipsis" title=${this.#stackTraceRowItem.functionName}>
80
- ${this.#stackTraceRowItem.functionName}
81
- </div>
82
- <div class="stack-trace-source-location">
83
- ${
84
- this.#stackTraceRowItem.link ?
85
- html`<div class="text-ellipsis">\xA0@\xA0${this.#stackTraceRowItem.link}</div>` :
86
- Lit.nothing}
87
- </div>
88
- </div>
89
- `,
90
- this.#shadow, {host: this});
89
+ stackTraceRowItem: Components.JSPresentationUtils.StackTraceRegularRow|null = null;
90
+ #view: StackTraceRowView;
91
+
92
+ override performUpdate(): void {
93
+ this.#view(this, undefined, this.contentElement);
91
94
  }
92
95
  }
93
96
 
94
- interface StackTraceLinkButtonData {
97
+ interface StackTraceLinkViewInput {
95
98
  onShowAllClick: () => void;
96
- hiddenCallFramesCount: number;
99
+ hiddenCallFramesCount: number|null;
97
100
  expandedView: boolean;
98
101
  }
99
102
 
100
- export class StackTraceLinkButton extends HTMLElement {
101
- readonly #shadow = this.attachShadow({mode: 'open'});
102
-
103
- #onShowAllClick: () => void = () => {};
104
- #hiddenCallFramesCount: number|null = null;
105
- #expandedView = false;
106
-
107
- set data(data: StackTraceLinkButtonData) {
108
- this.#onShowAllClick = data.onShowAllClick;
109
- this.#hiddenCallFramesCount = data.hiddenCallFramesCount;
110
- this.#expandedView = data.expandedView;
111
- this.#render();
103
+ type StackTraceLinkView = (input: StackTraceLinkViewInput, output: undefined, target: HTMLElement) => void;
104
+ const LINK_DEFAULT_VIEW: StackTraceLinkView = (input, output, target) => {
105
+ if (!input.hiddenCallFramesCount) {
106
+ return;
107
+ }
108
+ const linkText = input.expandedView ? i18nString(UIStrings.showLess) :
109
+ i18nString(UIStrings.showSMoreFrames, {n: input.hiddenCallFramesCount});
110
+ // clang-format off
111
+ render(html`
112
+ <style>${stackTraceLinkButtonStyles}</style>
113
+ <div class="stack-trace-row">
114
+ <button class="link" @click=${() => input.onShowAllClick()}>
115
+ ${linkText}
116
+ </button>
117
+ </div>`, target);
118
+ // clang-format on
119
+ };
120
+
121
+ export class StackTraceLinkButton extends UI.Widget.Widget {
122
+ onShowAllClick: () => void = () => {};
123
+ hiddenCallFramesCount: number|null = null;
124
+ expandedView = false;
125
+ #view: StackTraceLinkView;
126
+
127
+ constructor(element?: HTMLElement, view = LINK_DEFAULT_VIEW) {
128
+ super(element, {useShadowDom: true});
129
+ this.#view = view;
112
130
  }
113
131
 
114
- #render(): void {
115
- if (!this.#hiddenCallFramesCount) {
116
- return;
117
- }
118
- const linkText = this.#expandedView ? i18nString(UIStrings.showLess) :
119
- i18nString(UIStrings.showSMoreFrames, {n: this.#hiddenCallFramesCount});
120
- Lit.render(
121
- html`
122
- <style>${stackTraceLinkButtonStyles}</style>
123
- <div class="stack-trace-row">
124
- <button class="link" @click=${() => this.#onShowAllClick()}>
125
- ${linkText}
126
- </button>
127
- </div>
128
- `,
129
- this.#shadow, {host: this});
132
+ override performUpdate(): void {
133
+ this.#view(this, undefined, this.contentElement);
130
134
  }
131
135
  }
132
136
 
133
- export class StackTrace extends HTMLElement {
134
- readonly #shadow = this.attachShadow({mode: 'open'});
137
+ export class StackTrace extends UI.Widget.Widget {
135
138
  readonly #linkifier = new Components.Linkifier.Linkifier();
136
139
  #stackTraceRows:
137
140
  Array<Components.JSPresentationUtils.StackTraceRegularRow|Components.JSPresentationUtils.StackTraceAsyncRow> = [];
138
141
  #showHidden = false;
139
142
 
143
+ constructor(element?: HTMLElement) {
144
+ super(element, {useShadowDom: true});
145
+ }
146
+
140
147
  set data(data: StackTraceData) {
141
148
  const {creationStackTrace, creationStackTraceTarget} = data.creationStackTraceData;
142
149
  if (creationStackTrace) {
@@ -160,7 +167,7 @@ export class StackTrace extends HTMLElement {
160
167
  this.#render();
161
168
  }
162
169
 
163
- createRowTemplates(): Lit.TemplateResult[] {
170
+ createRowTemplates(): TemplateResult[] {
164
171
  const expandableRows = [];
165
172
  let hiddenCallFramesCount = 0;
166
173
  for (const item of this.#stackTraceRows) {
@@ -176,9 +183,9 @@ export class StackTrace extends HTMLElement {
176
183
  if (this.#showHidden || !ignoreListHide) {
177
184
  if ('functionName' in item) {
178
185
  expandableRows.push(html`
179
- <devtools-stack-trace-row data-stack-trace-row .data=${{
180
- stackTraceRowItem: item,
181
- }}></devtools-stack-trace-row>`);
186
+ <devtools-widget data-stack-trace-row .widgetConfig=${widgetConfig(StackTraceRow, {
187
+ stackTraceRowItem: item
188
+ })}></devtools-widget>`);
182
189
  }
183
190
  if ('asyncDescription' in item) {
184
191
  expandableRows.push(html`
@@ -194,7 +201,11 @@ export class StackTrace extends HTMLElement {
194
201
  // Disabled until https://crbug.com/1079231 is fixed.
195
202
  // clang-format off
196
203
  expandableRows.push(html`
197
- <devtools-stack-trace-link-button data-stack-trace-row .data=${{onShowAllClick: this.#onToggleShowAllClick.bind(this), hiddenCallFramesCount, expandedView: this.#showHidden}}></devtools-stack-trace-link-button>
204
+ <devtools-widget data-stack-trace-row .widgetConfig=${widgetConfig(StackTraceLinkButton, {
205
+ onShowAllClick: this.#onToggleShowAllClick.bind(this),
206
+ hiddenCallFramesCount,
207
+ expandedView: this.#showHidden})}>
208
+ </devtools-widget>
198
209
  `);
199
210
  // clang-format on
200
211
  }
@@ -206,34 +217,22 @@ export class StackTrace extends HTMLElement {
206
217
  if (!this.#stackTraceRows.length) {
207
218
  // Disabled until https://crbug.com/1079231 is fixed.
208
219
  // clang-format off
209
- Lit.render(
220
+ render(
210
221
  html`
211
222
  <span>${i18nString(UIStrings.cannotRenderStackTrace)}</span>
212
223
  `,
213
- this.#shadow, {host: this});
224
+ this.contentElement, {host: this});
214
225
  return;
215
226
  }
216
227
 
217
228
  const expandableRows = this.createRowTemplates();
218
- Lit.render(
229
+ render(
219
230
  html`
220
231
  <devtools-expandable-list .data=${{rows: expandableRows, title: i18nString(UIStrings.creationStackTrace)}}
221
232
  jslog=${VisualLogging.tree()}>
222
233
  </devtools-expandable-list>
223
234
  `,
224
- this.#shadow, {host: this});
235
+ this.contentElement, {host: this});
225
236
  // clang-format on
226
237
  }
227
238
  }
228
-
229
- customElements.define('devtools-stack-trace-row', StackTraceRow);
230
- customElements.define('devtools-stack-trace-link-button', StackTraceLinkButton);
231
- customElements.define('devtools-resources-stack-trace', StackTrace);
232
-
233
- declare global {
234
- interface HTMLElementTagNameMap {
235
- 'devtools-stack-trace-row': StackTraceRow;
236
- 'devtools-stack-trace-link-button': StackTraceLinkButton;
237
- 'devtools-resources-stack-trace': StackTrace;
238
- }
239
- }
@@ -0,0 +1,80 @@
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 * as Host from '../../core/host/host.js';
6
+ import * as i18n from '../../core/i18n/i18n.js';
7
+ import * as UI from '../../ui/legacy/legacy.js';
8
+ import {html, render} from '../../ui/lit/lit.js';
9
+
10
+ const UIStringsNotTranslate = {
11
+ /**
12
+ * @description Text for teaser to generate code.
13
+ */
14
+ ctrlItoGenerateCode: 'ctrl-i to generate code',
15
+ /**
16
+ * @description Text for teaser to generate code in Mac.
17
+ */
18
+ cmdItoGenerateCode: 'cmd-i to generate code',
19
+ /**
20
+ * Text for teaser when generating suggestion.
21
+ */
22
+ generating: 'Generating... (esc to cancel)',
23
+ } as const;
24
+
25
+ const lockedString = i18n.i18n.lockedString;
26
+
27
+ export interface ViewInput {
28
+ loading: boolean;
29
+ }
30
+
31
+ export type View = (input: ViewInput, output: object, target: HTMLElement) => void;
32
+
33
+ export const DEFAULT_VIEW: View = (input, _output, target) => {
34
+ const toGenerateCode = Host.Platform.isMac() ? lockedString(UIStringsNotTranslate.cmdItoGenerateCode) :
35
+ lockedString(UIStringsNotTranslate.ctrlItoGenerateCode);
36
+ const teaserLabel = input.loading ? lockedString(UIStringsNotTranslate.generating) : toGenerateCode;
37
+ // clang-format off
38
+ render(
39
+ html`
40
+ <div class="ai-code-generation-teaser">
41
+ &nbsp;${teaserLabel}
42
+ </div>
43
+ `, target
44
+ );
45
+ // clang-format on
46
+ };
47
+
48
+ export class AiCodeGenerationTeaser extends UI.Widget.Widget {
49
+ readonly #view: View;
50
+
51
+ #loading = false;
52
+
53
+ constructor(view?: View) {
54
+ super();
55
+ this.markAsExternallyManaged();
56
+ this.#view = view ?? DEFAULT_VIEW;
57
+ this.requestUpdate();
58
+ }
59
+
60
+ override performUpdate(): void {
61
+ const output = {};
62
+ this.#view(
63
+ {
64
+ loading: this.#loading,
65
+ },
66
+ output, this.contentElement);
67
+ }
68
+
69
+ get loading(): boolean {
70
+ return this.#loading;
71
+ }
72
+
73
+ set loading(loading: boolean) {
74
+ if (loading === this.#loading) {
75
+ return;
76
+ }
77
+ this.#loading = loading;
78
+ this.requestUpdate();
79
+ }
80
+ }
@@ -69,7 +69,7 @@ export class TypeToAllowDialog {
69
69
  UI.UIUtils.createTextButton(i18nString(UIStrings.cancel), () => resolve(false), {jslogContext: 'cancel'});
70
70
 
71
71
  const allowButton = UI.UIUtils.createTextButton(i18nString(UIStrings.allow), () => {
72
- resolve(input.value === options.typePhrase);
72
+ resolve(input.value === options.typePhrase || input.value === `'${options.typePhrase}'`);
73
73
  }, {jslogContext: 'confirm', variant: Buttons.Button.Variant.PRIMARY});
74
74
  allowButton.disabled = true;
75
75
 
@@ -95,6 +95,7 @@ export class TypeToAllowDialog {
95
95
  }
96
96
 
97
97
  export {AiCodeCompletionTeaser} from './AiCodeCompletionTeaser.js';
98
+ export {AiCodeGenerationTeaser} from './AiCodeGenerationTeaser.js';
98
99
  export {FreDialog} from './FreDialog.js';
99
100
  export {GdpSignUpDialog} from './GdpSignUpDialog.js';
100
101
  export {AiCodeCompletionDisclaimer} from './AiCodeCompletionDisclaimer.js';
@@ -448,7 +448,9 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
448
448
  }
449
449
 
450
450
  private async handleEnter(forceEvaluate?: boolean): Promise<void> {
451
- if (this.#selfXssWarningShown && this.text() === i18nString(UIStrings.allowPasting)) {
451
+ if (this.#selfXssWarningShown &&
452
+ (this.text() === i18nString(UIStrings.allowPasting) ||
453
+ this.text() === `'${i18nString(UIStrings.allowPasting)}'`)) {
452
454
  Common.Console.Console.instance().log(this.text());
453
455
  this.editor.dispatch({
454
456
  changes: {from: 0, to: this.editor.state.doc.length},
@@ -215,8 +215,7 @@ export class ConsoleViewport {
215
215
  private updateFocusedItem(focusLastChild?: boolean): void {
216
216
  const selectedElement = this.renderedElementAt(this.virtualSelectedIndex);
217
217
  const changed = this.lastSelectedElement !== selectedElement;
218
- const containerHasFocus =
219
- this.#contentElement === Platform.DOMUtilities.deepActiveElement(this.element.ownerDocument);
218
+ const containerHasFocus = this.#contentElement === UI.DOMUtilities.deepActiveElement(this.element.ownerDocument);
220
219
  if (this.lastSelectedElement && changed) {
221
220
  this.lastSelectedElement.classList.remove('console-selected');
222
221
  }
@@ -124,11 +124,11 @@ function getTooltipFromGenericIssue(errorType: Protocol.Audits.GenericIssueError
124
124
  return i18nString(UIStrings.formAutocompleteAttributeEmptyError);
125
125
  case Protocol.Audits.GenericIssueErrorType.FormEmptyIdAndNameAttributesForInputError:
126
126
  return i18nString(UIStrings.formEmptyIdAndNameAttributesForInputError);
127
- case Protocol.Audits.GenericIssueErrorType.FormAriaLabelledByToNonExistingId:
127
+ case Protocol.Audits.GenericIssueErrorType.FormAriaLabelledByToNonExistingIdError:
128
128
  return i18nString(UIStrings.formAriaLabelledByToNonExistingId);
129
129
  case Protocol.Audits.GenericIssueErrorType.FormInputAssignedAutocompleteValueToIdOrNameAttributeError:
130
130
  return i18nString(UIStrings.formInputAssignedAutocompleteValueToIdOrNameAttributeError);
131
- case Protocol.Audits.GenericIssueErrorType.FormLabelHasNeitherForNorNestedInput:
131
+ case Protocol.Audits.GenericIssueErrorType.FormLabelHasNeitherForNorNestedInputError:
132
132
  return i18nString(UIStrings.formLabelHasNeitherForNorNestedInput);
133
133
  case Protocol.Audits.GenericIssueErrorType.FormLabelForMatchesNonExistingIdError:
134
134
  return i18nString(UIStrings.formLabelForMatchesNonExistingIdError);
@@ -1610,9 +1610,8 @@ export class LengthRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.L
1610
1610
  valueElement.tabIndex = -1;
1611
1611
  valueElement.textContent = match.text;
1612
1612
 
1613
- if (!context.tracing) {
1614
- void this.#attachPopover(valueElement, match, context);
1615
- }
1613
+ const tooltip = this.#getTooltip(valueElement, match, context);
1614
+
1616
1615
  const evaluation = context.tracing?.applyEvaluation([], () => {
1617
1616
  return {
1618
1617
  placeholder: [valueElement],
@@ -1620,7 +1619,11 @@ export class LengthRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.L
1620
1619
  };
1621
1620
  });
1622
1621
 
1623
- return evaluation ?? [valueElement];
1622
+ if (evaluation) {
1623
+ return evaluation;
1624
+ }
1625
+
1626
+ return tooltip ? [valueElement, tooltip] : [valueElement];
1624
1627
  }
1625
1628
 
1626
1629
  async #applyEvaluation(
@@ -1635,25 +1638,26 @@ export class LengthRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.L
1635
1638
  return false;
1636
1639
  }
1637
1640
 
1638
- async #attachPopover(
1639
- valueElement: HTMLElement, match: SDK.CSSPropertyParser.Match, context: RenderingContext): Promise<void> {
1640
- const pixelValue = await resolveValues(this.#stylesPane, this.#propertyName, match, context, match.text);
1641
- if (!pixelValue) {
1642
- return;
1643
- }
1644
-
1641
+ #getTooltip(valueElement: HTMLElement, match: SDK.CSSPropertyParser.Match, context: RenderingContext):
1642
+ Tooltips.Tooltip.Tooltip|undefined {
1645
1643
  const tooltipId = this.#treeElement?.getTooltipId('length');
1646
- if (tooltipId) {
1647
- valueElement.setAttribute('aria-details', tooltipId);
1648
- const tooltip = new Tooltips.Tooltip.Tooltip(
1649
- {anchor: valueElement, variant: 'rich', id: tooltipId, jslogContext: 'length-popover'});
1650
- tooltip.appendChild(document.createTextNode(pixelValue[0]));
1651
- valueElement.insertAdjacentElement('afterend', tooltip);
1644
+ if (!tooltipId) {
1645
+ return undefined;
1652
1646
  }
1653
- this.popOverAttachedForTest();
1647
+ valueElement.setAttribute('aria-details', tooltipId);
1648
+ const tooltip = new Tooltips.Tooltip.Tooltip(
1649
+ {anchor: valueElement, variant: 'rich', id: tooltipId, jslogContext: 'length-popover'});
1650
+ tooltip.addEventListener('beforetoggle', () => this.getTooltipValue(tooltip, match, context), {once: true});
1651
+ return tooltip;
1654
1652
  }
1655
1653
 
1656
- popOverAttachedForTest(): void {
1654
+ async getTooltipValue(
1655
+ tooltip: Tooltips.Tooltip.Tooltip, match: SDK.CSSPropertyParser.Match, context: RenderingContext): Promise<void> {
1656
+ const pixelValue = await resolveValues(this.#stylesPane, this.#propertyName, match, context, match.text);
1657
+ if (!pixelValue) {
1658
+ return;
1659
+ }
1660
+ tooltip.appendChild(document.createTextNode(pixelValue[0]));
1657
1661
  }
1658
1662
  }
1659
1663
 
@@ -370,7 +370,7 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
370
370
  }
371
371
 
372
372
  private sectionsContainerKeyDown(event: Event): void {
373
- const activeElement = Platform.DOMUtilities.deepActiveElement(this.sectionsContainer.contentElement.ownerDocument);
373
+ const activeElement = UI.DOMUtilities.deepActiveElement(this.sectionsContainer.contentElement.ownerDocument);
374
374
  if (!activeElement) {
375
375
  return;
376
376
  }
@@ -85,6 +85,6 @@
85
85
  }
86
86
  }
87
87
 
88
- ::highlight(css-value-tracing) {
88
+ :host::highlight(css-value-tracing) {
89
89
  background-color: var(--sys-color-tonal-container);
90
90
  }
@@ -454,6 +454,7 @@ UI.ActionRegistration.registerActionExtension({
454
454
  platform: UI.ActionRegistration.Platforms.MAC,
455
455
  },
456
456
  ],
457
+ configurableBindings: false,
457
458
  });
458
459
 
459
460
  UI.ActionRegistration.registerActionExtension({