chrome-devtools-frontend 1.0.1597448 → 1.0.1597624

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/front_end/core/host/AidaClient.ts +4 -0
  2. package/front_end/core/sdk/CPUThrottlingManager.ts +5 -1
  3. package/front_end/core/sdk/CSSMatchedStyles.ts +2 -0
  4. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +28 -0
  5. package/front_end/models/ai_assistance/AiConversation.ts +24 -8
  6. package/front_end/models/ai_assistance/ChangeManager.ts +16 -0
  7. package/front_end/models/ai_assistance/ExtensionScope.ts +11 -3
  8. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +127 -0
  9. package/front_end/models/ai_assistance/agents/AiAgent.ts +22 -3
  10. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +1 -1
  11. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +11 -8
  12. package/front_end/models/ai_assistance/agents/StylingAgent.ts +34 -4
  13. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  14. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +27 -0
  15. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +21 -0
  16. package/front_end/models/trace/Processor.ts +1 -0
  17. package/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +33 -0
  18. package/front_end/models/trace/insights/CharacterSet.ts +172 -0
  19. package/front_end/models/trace/insights/Models.ts +1 -0
  20. package/front_end/models/trace/insights/types.ts +1 -0
  21. package/front_end/models/trace/types/TraceEvents.ts +17 -0
  22. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +16 -3
  23. package/front_end/panels/ai_assistance/components/ChatMessage.ts +90 -46
  24. package/front_end/panels/ai_assistance/components/MarkdownRendererWithCodeBlock.ts +18 -9
  25. package/front_end/panels/ai_assistance/components/chatMessage.css +11 -0
  26. package/front_end/panels/application/AppManifestView.ts +3 -4
  27. package/front_end/panels/application/DeviceBoundSessionsView.ts +18 -22
  28. package/front_end/panels/application/FrameDetailsView.ts +9 -15
  29. package/front_end/panels/application/OriginTrialTreeView.ts +2 -3
  30. package/front_end/panels/application/ReportingApiView.ts +13 -17
  31. package/front_end/panels/application/components/BackForwardCacheView.ts +3 -3
  32. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +2 -3
  33. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +3 -2
  34. package/front_end/panels/changes/ChangesView.ts +6 -4
  35. package/front_end/panels/console/ConsolePinPane.ts +3 -3
  36. package/front_end/panels/coverage/CoverageListView.ts +1 -1
  37. package/front_end/panels/css_overview/CSSOverviewPanel.ts +11 -15
  38. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +3 -5
  39. package/front_end/panels/elements/EventListenersWidget.ts +3 -2
  40. package/front_end/panels/elements/StandaloneStylesContainer.ts +21 -6
  41. package/front_end/panels/elements/StylePropertyTreeElement.ts +49 -4
  42. package/front_end/panels/layer_viewer/Layers3DView.ts +5 -4
  43. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +5 -6
  44. package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +6 -11
  45. package/front_end/panels/network/RequestCookiesView.ts +3 -4
  46. package/front_end/panels/network/RequestInitiatorView.ts +7 -5
  47. package/front_end/panels/network/RequestResponseView.ts +10 -15
  48. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +3 -4
  49. package/front_end/panels/recorder/components/RecordingView.ts +31 -36
  50. package/front_end/panels/recorder/components/StepEditor.ts +6 -7
  51. package/front_end/panels/search/SearchView.ts +2 -3
  52. package/front_end/panels/settings/WorkspaceSettingsTab.ts +2 -5
  53. package/front_end/panels/timeline/components/LiveMetricsView.ts +5 -8
  54. package/front_end/panels/timeline/components/insights/Cache.ts +8 -10
  55. package/front_end/panels/timeline/components/insights/CharacterSet.ts +38 -0
  56. package/front_end/panels/timeline/components/insights/DOMSize.ts +16 -20
  57. package/front_end/panels/timeline/components/insights/DocumentLatency.ts +2 -6
  58. package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +3 -4
  59. package/front_end/panels/timeline/components/insights/FontDisplay.ts +3 -4
  60. package/front_end/panels/timeline/components/insights/ForcedReflow.ts +5 -7
  61. package/front_end/panels/timeline/components/insights/INPBreakdown.ts +3 -4
  62. package/front_end/panels/timeline/components/insights/ImageDelivery.ts +3 -4
  63. package/front_end/panels/timeline/components/insights/ImageRef.ts +2 -4
  64. package/front_end/panels/timeline/components/insights/InsightRenderer.ts +2 -0
  65. package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +5 -7
  66. package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +2 -4
  67. package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +3 -4
  68. package/front_end/panels/timeline/components/insights/ModernHTTP.ts +3 -4
  69. package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +7 -11
  70. package/front_end/panels/timeline/components/insights/NodeLink.ts +2 -4
  71. package/front_end/panels/timeline/components/insights/RenderBlocking.ts +3 -4
  72. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +7 -10
  73. package/front_end/panels/timeline/components/insights/ThirdParties.ts +5 -7
  74. package/front_end/panels/timeline/components/insights/insights.ts +2 -0
  75. package/front_end/panels/web_audio/WebAudioView.ts +3 -4
  76. package/front_end/ui/components/settings/SettingCheckbox.ts +2 -0
  77. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +3 -3
  78. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +8 -8
  79. package/front_end/ui/visual_logging/Debugging.ts +0 -32
  80. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  81. package/package.json +1 -1
@@ -6,7 +6,7 @@ import * as Host from '../../core/host/host.js';
6
6
  import * as SDK from '../../core/sdk/sdk.js';
7
7
  import type * as Protocol from '../../generated/protocol.js';
8
8
  import * as UI from '../../ui/legacy/legacy.js';
9
- import {html, render} from '../../ui/lit/lit.js';
9
+ import {render} from '../../ui/lit/lit.js';
10
10
 
11
11
  import {type ContrastIssue, CSSOverviewCompletedView, type OverviewData} from './CSSOverviewCompletedView.js';
12
12
  import {CSSOverviewModel, type GlobalStyleStats} from './CSSOverviewModel.js';
@@ -14,7 +14,7 @@ import {CSSOverviewProcessingView} from './CSSOverviewProcessingView.js';
14
14
  import {CSSOverviewStartView} from './CSSOverviewStartView.js';
15
15
  import type {UnusedDeclaration} from './CSSOverviewUnusedDeclarations.js';
16
16
 
17
- const {widgetConfig} = UI.Widget;
17
+ const {widget} = UI.Widget;
18
18
 
19
19
  interface ViewInput {
20
20
  state: 'start'|'processing'|'completed';
@@ -28,19 +28,15 @@ interface ViewInput {
28
28
  type View = (input: ViewInput, output: object, target: HTMLElement) => void;
29
29
 
30
30
  export const DEFAULT_VIEW: View = (input, _output, target) => {
31
- // clang-format off
32
- render(input.state === 'start' ? html`
33
- <devtools-widget .widgetConfig=${widgetConfig(CSSOverviewStartView, {onStartCapture: input.onStartCapture})}></devtools-widget>`
34
- : input.state === 'processing' ? html`
35
- <devtools-widget .widgetConfig=${widgetConfig(CSSOverviewProcessingView, {onCancel: input.onCancel})}></devtools-widget>`
36
- : html`
37
- <devtools-widget .widgetConfig=${widgetConfig(CSSOverviewCompletedView, {
38
- onReset: input.onReset,
39
- overviewData: input.overviewData,
40
- target: input.target,
41
- })}></devtools-widget>`,
42
- target);
43
- // clang-format on
31
+ render(
32
+ input.state === 'start' ? widget(CSSOverviewStartView, {onStartCapture: input.onStartCapture}) :
33
+ input.state === 'processing' ? widget(CSSOverviewProcessingView, {onCancel: input.onCancel}) :
34
+ widget(CSSOverviewCompletedView, {
35
+ onReset: input.onReset,
36
+ overviewData: input.overviewData,
37
+ target: input.target,
38
+ }),
39
+ target);
44
40
  };
45
41
 
46
42
  export class CSSOverviewPanel extends UI.Panel.Panel implements SDK.TargetManager.Observer {
@@ -16,7 +16,7 @@ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
16
16
  import {DeveloperResourcesListView} from './DeveloperResourcesListView.js';
17
17
  import developerResourcesViewStyles from './developerResourcesView.css.js';
18
18
 
19
- const {widgetConfig} = UI.Widget;
19
+ const {widget} = UI.Widget;
20
20
  const {bindToSetting} = UI.UIUtils;
21
21
 
22
22
  const UIStrings = {
@@ -98,14 +98,12 @@ export const DEFAULT_VIEW: View = (input, _output, target) => {
98
98
  </devtools-toolbar>
99
99
  </div>
100
100
  <div class="developer-resource-view-results">
101
- <devtools-widget
102
- .widgetConfig=${widgetConfig(DeveloperResourcesListView, {
101
+ ${widget(DeveloperResourcesListView, {
103
102
  items: input.items,
104
103
  selectedItem: input.selectedItem,
105
104
  onSelect: input.onSelect,
106
105
  filters: input.filters
107
- })}>
108
- </devtools-widget>
106
+ })}
109
107
  </div>
110
108
  <div class="developer-resource-view-toolbar-summary">
111
109
  <div class="developer-resource-view-message">
@@ -77,6 +77,7 @@ const UIStrings = {
77
77
  } as const;
78
78
  const str_ = i18n.i18n.registerUIStrings('panels/elements/EventListenersWidget.ts', UIStrings);
79
79
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
80
+ const {widget} = UI.Widget;
80
81
  let eventListenersWidgetInstance: EventListenersWidget;
81
82
 
82
83
  interface ViewInput {
@@ -123,11 +124,11 @@ export const DEFAULT_VIEW: View = (input, _output, target) => {
123
124
  ${i18nString(UIStrings.frameworkListeners)}
124
125
  </devtools-checkbox>
125
126
  </devtools-toolbar>
126
- <devtools-widget .widgetConfig=${UI.Widget.widgetConfig(EventListeners.EventListenersView.EventListenersView, {
127
+ ${widget(EventListeners.EventListenersView.EventListenersView, {
127
128
  changeCallback: input.onEventListenersViewChange,
128
129
  objects: input.eventListenerObjects,
129
130
  filter: input.filter,
130
- })}></devtools-widget>
131
+ })}
131
132
  </div>`, target);
132
133
  // clang-format on
133
134
  };
@@ -63,6 +63,7 @@ export class StandaloneStylesContainer extends Common.ObjectWrapper.eventMixin<E
63
63
  #swatchPopoverHelper = new InlineEditor.SwatchPopoverHelper.SwatchPopoverHelper();
64
64
  #computedStyleModelInternal = new ComputedStyle.ComputedStyleModel.ComputedStyleModel();
65
65
  #view: View;
66
+ #filter: RegExp|null = null;
66
67
 
67
68
  constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
68
69
  super(element, {useShadowDom: true});
@@ -84,6 +85,8 @@ export class StandaloneStylesContainer extends Common.ObjectWrapper.eventMixin<E
84
85
  return;
85
86
  }
86
87
 
88
+ this.node()?.domModel().cssModel().discardCachedMatchedCascade();
89
+ await this.#updateSections();
87
90
  this.requestUpdate();
88
91
  }
89
92
 
@@ -127,17 +130,15 @@ export class StandaloneStylesContainer extends Common.ObjectWrapper.eventMixin<E
127
130
  this.sectionByElement.set(section.element, section);
128
131
  }
129
132
  this.#sections = newSections;
133
+ this.#updateFilter();
130
134
  this.swatchPopoverHelper().reposition();
131
135
  }
132
136
 
133
137
  override async performUpdate(): Promise<void> {
134
138
  this.hideAllPopovers();
135
- this.node()?.domModel().cssModel().discardCachedMatchedCascade();
136
-
137
- await this.#updateSections();
138
139
 
139
140
  const viewInput: ViewInput = {
140
- sections: this.#sections,
141
+ sections: this.#sections.filter(section => !section.isHidden()),
141
142
  };
142
143
  this.#view(viewInput, undefined, this.contentElement);
143
144
  this.#onUpdateFinished();
@@ -147,6 +148,12 @@ export class StandaloneStylesContainer extends Common.ObjectWrapper.eventMixin<E
147
148
  this.dispatchEventToListeners(Events.STYLES_UPDATE_COMPLETED);
148
149
  }
149
150
 
151
+ #updateFilter(): void {
152
+ for (const section of this.#sections) {
153
+ section.updateFilter();
154
+ }
155
+ }
156
+
150
157
  swatchPopoverHelper(): InlineEditor.SwatchPopoverHelper.SwatchPopoverHelper {
151
158
  return this.#swatchPopoverHelper;
152
159
  }
@@ -157,6 +164,11 @@ export class StandaloneStylesContainer extends Common.ObjectWrapper.eventMixin<E
157
164
  return;
158
165
  }
159
166
  this.#computedStyleModelInternal.node = node;
167
+ }
168
+
169
+ set filter(regex: RegExp|null) {
170
+ this.#filter = regex;
171
+ this.#updateFilter();
160
172
  this.requestUpdate();
161
173
  }
162
174
 
@@ -195,7 +207,7 @@ export class StandaloneStylesContainer extends Common.ObjectWrapper.eventMixin<E
195
207
  }
196
208
 
197
209
  filterRegex(): RegExp|null {
198
- return null;
210
+ return this.#filter;
199
211
  }
200
212
 
201
213
  setEditingStyle(editing: boolean): void {
@@ -207,7 +219,10 @@ export class StandaloneStylesContainer extends Common.ObjectWrapper.eventMixin<E
207
219
  }
208
220
 
209
221
  forceUpdate(): void {
210
- this.requestUpdate();
222
+ this.node()?.domModel().cssModel().discardCachedMatchedCascade();
223
+ void this.#updateSections().then(() => {
224
+ this.requestUpdate();
225
+ });
211
226
  }
212
227
 
213
228
  hideAllPopovers(): void {
@@ -1024,6 +1024,46 @@ export class ColorMixRenderer extends rendererBase(SDK.CSSPropertyParserMatchers
1024
1024
  }
1025
1025
  }
1026
1026
 
1027
+ // clang-format off
1028
+ export class ContrastColorRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.ContrastColorMatch) {
1029
+ // clang-format on
1030
+ readonly #treeElement: StylePropertyTreeElement|null;
1031
+ readonly #stylesContainer: StylesContainer;
1032
+ constructor(stylesContainer: StylesContainer, treeElement: StylePropertyTreeElement|null) {
1033
+ super();
1034
+ this.#treeElement = treeElement;
1035
+ this.#stylesContainer = stylesContainer;
1036
+ }
1037
+
1038
+ override render(match: SDK.CSSPropertyParserMatchers.ContrastColorMatch, context: RenderingContext): Node[] {
1039
+ const content = document.createElement('span');
1040
+ content.appendChild(document.createTextNode('contrast-color('));
1041
+ const param = content.appendChild(document.createElement('span'));
1042
+ content.appendChild(document.createTextNode(')'));
1043
+ Renderer.renderInto(match.color, context, param);
1044
+
1045
+ if (context.matchedResult.hasUnresolvedSubstitutions(match.node)) {
1046
+ return [content];
1047
+ }
1048
+
1049
+ const colorText = context.matchedResult.getComputedText(match.node);
1050
+ const fakeSpan = document.body.appendChild(document.createElement('span'));
1051
+ fakeSpan.style.color = colorText;
1052
+ const resolvedColorText = window.getComputedStyle(fakeSpan).color;
1053
+ fakeSpan.remove();
1054
+
1055
+ const color = Common.Color.parse(resolvedColorText);
1056
+ if (!color) {
1057
+ return [content];
1058
+ }
1059
+
1060
+ const colorSwatch = new ColorRenderer(this.#stylesContainer, this.#treeElement).renderColorSwatch(color, content);
1061
+ context.addControl('color', colorSwatch);
1062
+
1063
+ return [colorSwatch, content];
1064
+ }
1065
+ }
1066
+
1027
1067
  // clang-format off
1028
1068
  export class AngleRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.AngleMatch) {
1029
1069
  // clang-format on
@@ -1490,7 +1530,8 @@ export class ShadowRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.S
1490
1530
  properties.push({value, source, propertyType: ShadowPropertyType.INSET, expansionContext});
1491
1531
  } else if (
1492
1532
  match instanceof SDK.CSSPropertyParserMatchers.ColorMatch ||
1493
- match instanceof SDK.CSSPropertyParserMatchers.ColorMixMatch) {
1533
+ match instanceof SDK.CSSPropertyParserMatchers.ColorMixMatch ||
1534
+ match instanceof SDK.CSSPropertyParserMatchers.ContrastColorMatch) {
1494
1535
  if (properties.find(({propertyType}) => propertyType === ShadowPropertyType.COLOR)) {
1495
1536
  return null;
1496
1537
  }
@@ -1950,6 +1991,7 @@ export function getPropertyRenderers(
1950
1991
  new VariableRenderer(stylesContainer, treeElement, matchedStyles, computedStyles, computedStyleExtraFields),
1951
1992
  new ColorRenderer(stylesContainer, treeElement),
1952
1993
  new ColorMixRenderer(stylesContainer, matchedStyles, computedStyles, computedStyleExtraFields, treeElement),
1994
+ new ContrastColorRenderer(stylesContainer, treeElement),
1953
1995
  new URLRenderer(style.parentRule, stylesContainer.node()),
1954
1996
  new AngleRenderer(treeElement),
1955
1997
  new LinkableNameRenderer(matchedStyles, stylesContainer),
@@ -2024,9 +2066,12 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
2024
2066
  this.listItemElement.textContent = '';
2025
2067
  }
2026
2068
 
2027
- this.property.addEventListener(SDK.CSSProperty.Events.LOCAL_VALUE_UPDATED, () => {
2028
- this.updateTitle();
2029
- });
2069
+ this.property.addEventListener(SDK.CSSProperty.Events.LOCAL_VALUE_UPDATED, this.updateTitle, this);
2070
+ }
2071
+
2072
+ override onunbind(): void {
2073
+ this.property.removeEventListener(SDK.CSSProperty.Events.LOCAL_VALUE_UPDATED, this.updateTitle, this);
2074
+ super.onunbind();
2030
2075
  }
2031
2076
 
2032
2077
  async gridNames(): Promise<Set<string>> {
@@ -27,6 +27,7 @@ import {
27
27
  import {Events as TransformControllerEvents, TransformController} from './TransformController.js';
28
28
 
29
29
  const {html, render, Directives: {ref}} = Lit;
30
+ const {widget} = UI.Widget;
30
31
 
31
32
  const UIStrings = {
32
33
  /**
@@ -108,11 +109,11 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
108
109
  ${layers3DViewStyles}
109
110
  </style>
110
111
  ${input.panelToolbar}
111
- ${input.error === 'missing-root' ? html`<div><devtools-widget .widgetConfig=${UI.Widget.widgetConfig(UI.EmptyWidget.EmptyWidget, {
112
+ ${input.error === 'missing-root' ? html`<div>${widget(UI.EmptyWidget.EmptyWidget, {
112
113
  header: i18nString(UIStrings.noLayerInformation),
113
114
  text: i18nString(UIStrings.layerExplanation)
114
- })}></devtools-widget></div>` : Lit.nothing}
115
- ${input.error === 'webgl-disabled' ? html`<div><devtools-widget .widgetConfig=${UI.Widget.widgetConfig(UI.EmptyWidget.EmptyWidget, {
115
+ })}</div>` : Lit.nothing}
116
+ ${input.error === 'webgl-disabled' ? html`<div>${widget(UI.EmptyWidget.EmptyWidget, {
116
117
  header: i18nString(UIStrings.cantDisplayLayers),
117
118
  text: i18nString(UIStrings.webglSupportIsDisabledInYour),
118
119
  extraElements: [
@@ -123,7 +124,7 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
123
124
  }
124
125
  )
125
126
  ],
126
- })}></devtools-widget></div>` : Lit.nothing}
127
+ })}</div>` : Lit.nothing}
127
128
  <canvas
128
129
  tabindex="0"
129
130
  jslog=${VisualLogging.canvas('layers').track({
@@ -41,7 +41,7 @@ const UIStrings = {
41
41
  const str_ =
42
42
  i18n.i18n.registerUIStrings('panels/linear_memory_inspector/components/LinearMemoryInspector.ts', UIStrings);
43
43
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
44
- const {widgetConfig} = UI.Widget;
44
+ const {widget} = UI.Widget;
45
45
 
46
46
  /**
47
47
  * If the LinearMemoryInspector only receives a portion
@@ -162,13 +162,12 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: Record<string, unknown>,
162
162
  @addressinputchanged=${input.onAddressChange}
163
163
  @pagenavigation=${input.onNavigatePage}
164
164
  @historynavigation=${input.onNavigateHistory}></devtools-linear-memory-inspector-navigator>
165
- <devtools-widget .widgetConfig=${widgetConfig(LinearMemoryHighlightChipList, {
165
+ ${widget(LinearMemoryHighlightChipList, {
166
166
  highlightInfos: highlightedMemoryAreas,
167
167
  focusedMemoryHighlight,
168
168
  jumpToAddress: (address: number) => input.onJumpToAddress(address),
169
169
  deleteHighlight: input.onDeleteMemoryHighlight,
170
- })}>
171
- </devtools-widget>
170
+ })}
172
171
  <devtools-linear-memory-inspector-viewer
173
172
  .data=${
174
173
  {
@@ -186,7 +185,7 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: Record<string, unknown>,
186
185
  ${
187
186
  input.hideValueInspector ? nothing : html`
188
187
  <div class="value-interpreter">
189
- <devtools-widget .widgetConfig=${widgetConfig(LinearMemoryValueInterpreter, {
188
+ ${widget(LinearMemoryValueInterpreter, {
190
189
  buffer: input.memory
191
190
  .slice(
192
191
  input.address - input.memoryOffset,
@@ -201,7 +200,7 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: Record<string, unknown>,
201
200
  onJumpToAddressClicked: input.onJumpToAddress,
202
201
  onValueTypeToggled: input.onValueTypeToggled,
203
202
  onEndiannessChanged: input.onEndiannessChanged,
204
- })}></devtools-widget>
203
+ })}
205
204
  </div>`}
206
205
  `,
207
206
  target);
@@ -32,7 +32,7 @@ const str_ =
32
32
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
33
33
 
34
34
  const {render, html} = Lit;
35
- const {widgetConfig} = UI.Widget;
35
+ const {widget} = UI.Widget;
36
36
 
37
37
  export interface ViewInput {
38
38
  endianness: Endianness;
@@ -89,14 +89,10 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLE
89
89
  </div>
90
90
  <span class="divider"></span>
91
91
  <div>
92
- ${input.showSettings ?
93
- html`
94
- <devtools-widget .widgetConfig=${widgetConfig(ValueInterpreterSettings, {
95
- valueTypes: input.valueTypes, onToggle: input.onValueTypeToggled
96
- })}>
97
- </devtools-widget>` :
98
- html`
99
- <devtools-widget .widgetConfig=${widgetConfig(ValueInterpreterDisplay, {
92
+ ${input.showSettings
93
+ ? widget(ValueInterpreterSettings, {
94
+ valueTypes: input.valueTypes, onToggle: input.onValueTypeToggled})
95
+ : widget(ValueInterpreterDisplay, {
100
96
  buffer: input.buffer,
101
97
  valueTypes: input.valueTypes,
102
98
  endianness: input.endianness,
@@ -104,8 +100,7 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLE
104
100
  memoryLength: input.memoryLength,
105
101
  onValueTypeModeChange: input.onValueTypeModeChange,
106
102
  onJumpToAddressClicked: input.onJumpToAddressClicked,
107
- })}>
108
- </devtools-widget>`}
103
+ })}
109
104
  </div>
110
105
  </div>
111
106
  `,
@@ -14,6 +14,7 @@ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
14
14
 
15
15
  import requestCookiesViewStyles from './requestCookiesView.css.js';
16
16
  const {render, html} = Lit;
17
+ const {widget} = UI.Widget;
17
18
 
18
19
  const UIStrings = {
19
20
  /**
@@ -93,10 +94,8 @@ export const DEFAULT_VIEW: ViewFunction = (input, _output, target) => {
93
94
  <style>${requestCookiesViewStyles}</style>
94
95
  <style>${UI.inspectorCommonStyles}</style>
95
96
  <div class="request-cookies-view">
96
- ${input.gotCookies ? Lit.nothing : html`
97
- <devtools-widget .widgetConfig=${UI.Widget.widgetConfig(UI.EmptyWidget.EmptyWidget, {
98
- header: i18nString(UIStrings.thisRequestHasNoCookies)})}></devtools-widget>
99
- `}
97
+ ${input.gotCookies ? Lit.nothing : widget(UI.EmptyWidget.EmptyWidget, {
98
+ header: i18nString(UIStrings.thisRequestHasNoCookies)})}
100
99
 
101
100
  <div class=${input.requestCookies.cookies.length || input.hasBlockedCookies ? '' : 'hidden'}>
102
101
  <span class="request-cookies-title" title=${i18nString(UIStrings.cookiesThatWereSentToTheServerIn)}>
@@ -16,7 +16,7 @@ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
16
16
  import requestInitiatorViewStyles from './requestInitiatorView.css.js';
17
17
  import requestInitiatorViewTreeStyles from './requestInitiatorViewTree.css.js';
18
18
 
19
- const {widgetConfig} = UI.Widget;
19
+ const {widget} = UI.Widget;
20
20
 
21
21
  const UIStrings = {
22
22
  /**
@@ -59,19 +59,21 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLE
59
59
  if (!input.stackTrace) {
60
60
  return html`${nothing}`;
61
61
  }
62
+ // clang-format off
62
63
  return html`
63
64
  <li role="treeitem" class="request-initiator-view-section-title" aria-expanded="true" open>
64
65
  ${i18nString(UIStrings.requestCallStack)}
65
66
  <ul role="group">
66
67
  <li role="treeitem">
67
- <devtools-widget .widgetConfig=${widgetConfig(Components.JSPresentationUtils.StackTracePreviewContent, {
68
- options: {tabStops: true},
69
- stackTrace: input.stackTrace,
70
- })}></devtools-widget>
68
+ ${widget(Components.JSPresentationUtils.StackTracePreviewContent, {
69
+ options: {tabStops: true},
70
+ stackTrace: input.stackTrace,
71
+ })}
71
72
  </li>
72
73
  </ul>
73
74
  </li>
74
75
  `;
76
+ // clang-format on
75
77
  };
76
78
 
77
79
  const renderInitiatorNodes =
@@ -43,43 +43,38 @@ export interface ViewOutput {
43
43
  revealPosition: (position: SourceFrame.SourceFrame.RevealPosition) => Promise<void>;
44
44
  }
45
45
 
46
- const widgetConfig = UI.Widget.widgetConfig;
47
- const widgetRef = UI.Widget.widgetRef;
46
+ const {widgetConfig, widgetRef, widget} = UI.Widget;
48
47
  type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
49
48
 
50
49
  export const DEFAULT_VIEW: View = (input: ViewInput, output: ViewOutput, target: HTMLElement): void => {
51
- let widget;
50
+ let widgetTemplate;
52
51
  if (TextUtils.StreamingContentData.isError(input.contentData)) {
53
52
  // clang-format off
54
- widget = html`<devtools-widget
55
- .widgetConfig=${widgetConfig(element => new UI.EmptyWidget.EmptyWidget(
53
+ widgetTemplate = html`${widget(element => new UI.EmptyWidget.EmptyWidget(
56
54
  i18nString(UIStrings.failedToLoadResponseData), (input.contentData as {error: string}).error,
57
- element))}></devtools-widget>`;
55
+ element))}`;
58
56
  // clang-format on
59
57
  } else if (input.request.statusCode === 204 || input.request.failed) {
60
58
  // clang-format off
61
- widget = html`<devtools-widget
62
- .widgetConfig=${widgetConfig(element => new UI.EmptyWidget.EmptyWidget(
59
+ widgetTemplate = html`${widget(element => new UI.EmptyWidget.EmptyWidget(
63
60
  i18nString(UIStrings.noPreview), i18nString(UIStrings.thisRequestHasNoResponseData),
64
- element))}></devtools-widget>`;
61
+ element))}`;
65
62
  // clang-format on
66
63
  } else if (input.renderAsText) {
67
64
  // clang-format off
68
- widget = html`<devtools-widget
69
- .widgetConfig=${widgetConfig(element => new SourceFrame.ResourceSourceFrame.SearchableContainer(
65
+ widgetTemplate = html`<devtools-widget .widgetConfig=${widgetConfig(element => new SourceFrame.ResourceSourceFrame.SearchableContainer(
70
66
  input.request, input.mimeType, element))}
71
67
  ${widgetRef(SourceFrame.ResourceSourceFrame.SearchableContainer, widget => {output.revealPosition = widget.revealPosition.bind(widget);})}></devtools-widget>`;
72
68
  // clang-format on
73
69
  } else {
74
70
  // clang-format off
75
- widget = html`<devtools-widget
76
- .widgetConfig=${widgetConfig(element => new BinaryResourceView(
71
+ widgetTemplate = html`${widget(element => new BinaryResourceView(
77
72
  input.contentData as TextUtils.StreamingContentData.StreamingContentData, input.request.url(),
78
- input.request.resourceType(), element))}></devtools-widget>`;
73
+ input.request.resourceType(), element))}`;
79
74
  // clang-format on
80
75
  }
81
76
 
82
- render(widget, target);
77
+ render(widgetTemplate, target);
83
78
  };
84
79
 
85
80
  export class RequestResponseView extends UI.Widget.VBox {
@@ -22,7 +22,7 @@ import {Events as JSONEditorEvents, JSONEditor, type Parameter} from './JSONEdit
22
22
  import protocolMonitorStyles from './protocolMonitor.css.js';
23
23
 
24
24
  const {styleMap} = Directives;
25
- const {widgetConfig, widgetRef} = UI.Widget;
25
+ const {widget, widgetConfig, widgetRef} = UI.Widget;
26
26
  const UIStrings = {
27
27
  /**
28
28
  * @description Text for one or a group of functions
@@ -675,7 +675,7 @@ type InfoWidgetView = (input: InfoWidgetViewInput, output: undefined, target: HT
675
675
 
676
676
  const INFO_WIDGET_VIEW: InfoWidgetView = (input, _output, target) => {
677
677
  // clang-format off
678
- render(html`<devtools-widget .widgetConfig=${widgetConfig(UI.TabbedPane.TabbedPane, {
678
+ render(widget(UI.TabbedPane.TabbedPane, {
679
679
  tabs: [
680
680
  {
681
681
  id: 'request',
@@ -696,8 +696,7 @@ const INFO_WIDGET_VIEW: InfoWidgetView = (input, _output, target) => {
696
696
  SourceFrame.JSONView.JSONView.createViewSync(input.response || null),
697
697
  selected: input.selectedTab === 'response',
698
698
  }
699
- ]})}>
700
- </devtools-widget>`, target);
699
+ ]}), target);
701
700
  // clang-format on
702
701
  };
703
702
 
@@ -37,6 +37,7 @@ import {
37
37
  } from './StepView.js';
38
38
 
39
39
  const {html} = Lit;
40
+ const {widget} = UI.Widget;
40
41
 
41
42
  const UIStrings = {
42
43
  /**
@@ -525,15 +526,12 @@ function renderReplayOrAbortButton(input: ViewInput): Lit.LitTemplate {
525
526
  }
526
527
 
527
528
  // clang-format off
528
- return html`<devtools-widget
529
- .widgetConfig=${UI.Widget.widgetConfig(ReplaySection, {
530
- settings: input.recorderSettings,
531
- replayExtensions: input.replayExtensions,
532
- onStartReplay: input.onTogglePlaying,
533
- disabled: input.replayState.isPlaying,
534
- })}
535
- >
536
- </devtools-widget>`;
529
+ return html`${widget(ReplaySection, {
530
+ settings: input.recorderSettings,
531
+ replayExtensions: input.replayExtensions,
532
+ onStartReplay: input.onTogglePlaying,
533
+ disabled: input.replayState.isPlaying,
534
+ })}`;
537
535
  // clang-format on
538
536
  }
539
537
 
@@ -571,32 +569,29 @@ function renderSections(input: ViewInput): Lit.LitTemplate {
571
569
  </div>
572
570
  <div class="content">
573
571
  <div class="steps">
574
- <devtools-widget
575
- .widgetConfig=${UI.Widget.widgetConfig(StepView, {
576
- section,
577
- state: input.getSectionState(section),
578
- isStartOfGroup: true,
579
- isEndOfGroup: section.steps.length === 0,
580
- isFirstSection: i === 0,
581
- isLastSection:
582
- i === input.sections.length - 1 &&
583
- section.steps.length === 0,
584
- isSelected:
585
- input.selectedStep === (section.causingStep || null),
586
- sectionIndex: i,
587
- isRecording: input.isRecording,
588
- isPlaying: input.replayState.isPlaying,
589
- error:
590
- input.getSectionState(section) === State.ERROR
591
- ? (input.currentError ?? undefined)
592
- : undefined,
593
- hasBreakpoint: false,
594
- removable: input.recording.steps.length > 1 && Boolean(section.causingStep),
595
- onStepClick: input.onStepClick,
596
- onStepHover: input.onStepHover,
597
- })}
598
- >
599
- </devtools-widget>
572
+ ${widget(StepView, {
573
+ section,
574
+ state: input.getSectionState(section),
575
+ isStartOfGroup: true,
576
+ isEndOfGroup: section.steps.length === 0,
577
+ isFirstSection: i === 0,
578
+ isLastSection:
579
+ i === input.sections.length - 1 &&
580
+ section.steps.length === 0,
581
+ isSelected:
582
+ input.selectedStep === (section.causingStep || null),
583
+ sectionIndex: i,
584
+ isRecording: input.isRecording,
585
+ isPlaying: input.replayState.isPlaying,
586
+ error:
587
+ input.getSectionState(section) === State.ERROR
588
+ ? (input.currentError ?? undefined)
589
+ : undefined,
590
+ hasBreakpoint: false,
591
+ removable: input.recording.steps.length > 1 && Boolean(section.causingStep),
592
+ onStepClick: input.onStepClick,
593
+ onStepHover: input.onStepHover,
594
+ })}
600
595
  ${section.steps.map(step => {
601
596
  const stepIndex = input.recording.steps.indexOf(step);
602
597
  return html`
@@ -653,7 +648,7 @@ function renderSections(input: ViewInput): Lit.LitTemplate {
653
648
  )}
654
649
  </div>
655
650
  `;
656
- // clang-format on
651
+ // clang-format on
657
652
  }
658
653
 
659
654
  function renderHeader(input: ViewInput): Lit.LitTemplate {
@@ -32,6 +32,7 @@ import {
32
32
  const {html, Decorators, Directives, LitElement} = Lit;
33
33
  const {customElement, property, state} = Decorators;
34
34
  const {live} = Directives;
35
+ const {widget} = UI.Widget;
35
36
 
36
37
  type StepFor<Type> = Extract<Models.Schema.Step, {type: Type}>;
37
38
  type Attribute = Keys<Models.Schema.Step>;
@@ -778,13 +779,11 @@ export class StepEditor extends LitElement {
778
779
  return html`<div class="attribute" data-attribute="selectors" jslog=${VisualLogging.treeItem('selectors')}>
779
780
  <div class="row">
780
781
  <div>selectors<span class="separator">:</span></div>
781
- <devtools-widget
782
- .widgetConfig=${UI.Widget.widgetConfig(SelectorPicker, {
783
- disabled: this.disabled,
784
- onSelectorPicked: this.#handleSelectorPicked,
785
- onAttributeRequested: this.#handleAttributeRequested,
786
- })}
787
- ></devtools-widget>
782
+ ${widget(SelectorPicker, {
783
+ disabled: this.disabled,
784
+ onSelectorPicked: this.#handleSelectorPicked,
785
+ onAttributeRequested: this.#handleAttributeRequested,
786
+ })}
788
787
  ${this.#renderDeleteButton('selectors')}
789
788
  </div>
790
789
  ${this.state.selectors.map((selector, index, selectors) => {
@@ -107,7 +107,7 @@ const UIStrings = {
107
107
  const str_ = i18n.i18n.registerUIStrings('panels/search/SearchView.ts', UIStrings);
108
108
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
109
109
  const {ref, live} = Directives;
110
- const {widgetConfig, widgetRef} = UI.Widget;
110
+ const {widgetConfig, widget, widgetRef} = UI.Widget;
111
111
 
112
112
  export interface SearchViewInput {
113
113
  query: string;
@@ -251,8 +251,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
251
251
  output.showAllMatches = () => void w.showAllMatches();
252
252
  output.collapseAllResults = () => void w.collapseAllResults(); })}>
253
253
  </devtools-widget>`
254
- : html`<devtools-widget .widgetConfig=${widgetConfig(UI.EmptyWidget.EmptyWidget, {header, text})}>
255
- </devtools-widget>`}
254
+ : widget(UI.EmptyWidget.EmptyWidget, {header, text})}
256
255
  </div>
257
256
  <div class="search-toolbar-summary" @keydown=${onPanelKeyDown}>
258
257
  <div class="search-message">${searchMessage}</div>