chrome-devtools-frontend 1.0.1666631 → 1.0.1667564

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 (78) hide show
  1. package/front_end/core/host/AidaClient.ts +6 -4
  2. package/front_end/core/host/InspectorFrontendHostAPI.ts +1 -0
  3. package/front_end/core/host/InspectorFrontendHostStub.ts +3 -3
  4. package/front_end/core/host/UserMetrics.ts +49 -1
  5. package/front_end/core/sdk/CSSMatchedStyles.ts +2 -5
  6. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +12 -0
  7. package/front_end/core/sdk/Connections.ts +1 -1
  8. package/front_end/core/sdk/DOMModel.test.api.ts +104 -0
  9. package/front_end/core/sdk/DOMModel.ts +23 -11
  10. package/front_end/core/sdk/DebuggerModel.ts +9 -9
  11. package/front_end/core/sdk/IsolateManager.ts +1 -1
  12. package/front_end/core/sdk/NetworkManager.ts +105 -4
  13. package/front_end/core/sdk/OverlayModel.ts +15 -14
  14. package/front_end/core/sdk/RemoteObject.ts +1 -1
  15. package/front_end/devtools_compatibility.js +1 -0
  16. package/front_end/entrypoints/main/MainImpl.ts +5 -2
  17. package/front_end/entrypoints/main/SimpleApp.ts +9 -3
  18. package/front_end/foundation/Universe.ts +6 -0
  19. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +23 -10
  20. package/front_end/models/computed_style/ComputedStyleModel.ts +4 -7
  21. package/front_end/models/crux-manager/CrUXManager.ts +4 -0
  22. package/front_end/models/extensions/ExtensionAPI.ts +3 -3
  23. package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +2 -2
  24. package/front_end/models/live-metrics/LiveMetrics.ts +59 -19
  25. package/front_end/models/live-metrics/web-vitals-injected/README.md +1 -1
  26. package/front_end/models/live-metrics/web-vitals-injected/spec/spec.ts +6 -1
  27. package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +11 -3
  28. package/front_end/models/logs/LogManager.ts +1 -1
  29. package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +1 -1
  30. package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +6 -7
  31. package/front_end/models/workspace_diff/WorkspaceDiff.ts +13 -14
  32. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +15 -7
  33. package/front_end/panels/application/BackgroundServiceView.ts +18 -20
  34. package/front_end/panels/autofill/AutofillView.ts +17 -17
  35. package/front_end/panels/autofill/autofillView.css +7 -8
  36. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +31 -31
  37. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +15 -15
  38. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +12 -12
  39. package/front_end/panels/browser_debugger/browser_debugger-meta.ts +27 -27
  40. package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +14 -6
  41. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +14 -6
  42. package/front_end/panels/common/AiCodeCompletionTeaser.ts +13 -6
  43. package/front_end/panels/common/GeminiRebrandPromoDialog.ts +1 -1
  44. package/front_end/panels/console/ConsoleInsightTeaser.ts +13 -6
  45. package/front_end/panels/console/ConsoleView.ts +6 -6
  46. package/front_end/panels/console_counters/WarningErrorCounter.ts +4 -4
  47. package/front_end/panels/coverage/CoverageModel.ts +11 -1
  48. package/front_end/panels/elements/StylePropertiesSection.ts +50 -17
  49. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +18 -7
  50. package/front_end/panels/emulation/AdvancedApp.ts +18 -8
  51. package/front_end/panels/event_listeners/EventListenersView.ts +8 -8
  52. package/front_end/panels/explain/components/ConsoleInsight.ts +15 -7
  53. package/front_end/panels/network/NetworkLogView.ts +13 -14
  54. package/front_end/panels/screencast/ScreencastApp.ts +12 -6
  55. package/front_end/panels/screencast/ScreencastView.ts +37 -11
  56. package/front_end/panels/sensors/locationsSettingsTab.css +4 -0
  57. package/front_end/panels/settings/AISettingsTab.ts +13 -6
  58. package/front_end/panels/sources/DebuggerPlugin.ts +13 -2
  59. package/front_end/panels/timeline/components/LiveMetricsView.ts +14 -1
  60. package/front_end/panels/timeline/components/cpuThrottlingSelector.css +4 -0
  61. package/front_end/panels/timeline/components/liveMetricsView.css +28 -0
  62. package/front_end/panels/timeline/timeline-meta.ts +13 -0
  63. package/front_end/third_party/chromium/README.chromium +1 -1
  64. package/front_end/ui/components/menus/menu.css +4 -0
  65. package/front_end/ui/components/menus/menuItem.css +4 -0
  66. package/front_end/ui/components/menus/selectMenu.css +4 -0
  67. package/front_end/ui/components/menus/selectMenuButton.css +4 -0
  68. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +21 -10
  69. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +22 -10
  70. package/front_end/ui/components/text_editor/config.ts +7 -0
  71. package/front_end/ui/legacy/AppProvider.ts +2 -1
  72. package/front_end/ui/legacy/RootView.ts +8 -1
  73. package/front_end/ui/legacy/UniverseRequestEvent.ts +19 -0
  74. package/front_end/ui/legacy/Widget.ts +49 -6
  75. package/front_end/ui/legacy/inspectorCommon.css +1 -1
  76. package/front_end/ui/legacy/legacy.ts +2 -0
  77. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  78. package/package.json +1 -1
@@ -3,18 +3,25 @@
3
3
  // found in the LICENSE file.
4
4
  /* eslint-disable @devtools/no-imperative-dom-api */
5
5
 
6
+ import type * as Foundation from '../../foundation/foundation.js';
7
+
6
8
  import rootViewStyles from './rootView.css.js';
9
+ import {UniverseRequestEvent} from './UniverseRequestEvent.js';
7
10
  import {VBox} from './Widget.js';
8
11
  import {ZoomManager} from './ZoomManager.js';
9
12
 
10
13
  export class RootView extends VBox {
11
14
  private window?: (Window&typeof globalThis)|null;
12
- constructor() {
15
+ constructor(universe: Foundation.Universe.Universe) {
13
16
  super();
14
17
  this.markAsRoot();
15
18
  this.element.classList.add('root-view');
16
19
  this.registerRequiredCSS(rootViewStyles);
17
20
  this.element.setAttribute('spellcheck', 'false');
21
+ this.element.addEventListener(UniverseRequestEvent.eventName, (event: UniverseRequestEvent) => {
22
+ event.universe = universe;
23
+ event.stopPropagation();
24
+ });
18
25
  }
19
26
 
20
27
  attachToDocument(document: Document): void {
@@ -0,0 +1,19 @@
1
+ // Copyright 2026 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 Foundation from '../../foundation/foundation.js';
6
+
7
+ export class UniverseRequestEvent extends Event {
8
+ static readonly eventName = 'universerequest';
9
+
10
+ /**
11
+ * The `Universe` will be filled in by the `RootView` in the event handler.
12
+ * Widget.ts dispatches a new UniverseRequestEvent, and retrieves the Universe from the event right after.
13
+ */
14
+ universe?: Foundation.Universe.Universe;
15
+
16
+ constructor() {
17
+ super(UniverseRequestEvent.eventName, {bubbles: true, composed: true});
18
+ }
19
+ }
@@ -32,14 +32,36 @@
32
32
  import '../dom_extension/dom_extension.js';
33
33
 
34
34
  import * as Platform from '../../core/platform/platform.js';
35
+ import type * as Root from '../../core/root/root.js';
36
+ import type * as Foundation from '../../foundation/foundation.js';
35
37
  import * as Geometry from '../../models/geometry/geometry.js';
36
38
  import * as Lit from '../../ui/lit/lit.js';
37
39
 
38
40
  import {appendStyle, deepActiveElement} from './DOMUtilities.js';
39
41
  import {cloneCustomElement, createShadowRootWithCoreStyles} from './UIUtils.js';
42
+ import {UniverseRequestEvent} from './UniverseRequestEvent.js';
43
+
44
+ // eslint-disable-next-line @typescript-eslint/naming-convention
45
+ type InjectReturn<T> = T extends {INJECT: infer I} ? I :
46
+ // eslint-disable-next-line @typescript-eslint/naming-convention
47
+ T extends {constructor: {INJECT: infer I}} ? I : [];
48
+
49
+ type MapConstructors<T> = {
50
+ [K in keyof T]: T[K] extends Root.DevToolsContext.ConstructorT<infer Instance>?
51
+ Instance :
52
+ T[K] extends new (...args: any[]) => infer Instance ? Instance : never;
53
+ };
54
+
55
+ export type WidgetDependencies<T> = MapConstructors<InjectReturn<T>>;
40
56
 
41
57
  const {html} = Lit;
42
58
 
59
+ export function lookupUniverseForElement(element: HTMLElement): Foundation.Universe.Universe|undefined {
60
+ const event = new UniverseRequestEvent();
61
+ element.dispatchEvent(event);
62
+ return event.universe;
63
+ }
64
+
43
65
  // Remember the original DOM mutation methods here, since we
44
66
  // will override them below to sanity check the Widget system.
45
67
  const originalAppendChild = Node.prototype.appendChild;
@@ -55,8 +77,9 @@ function assert(condition: unknown, message: string): void {
55
77
 
56
78
  export type AnyWidget = Widget<HTMLElement|DocumentFragment>;
57
79
 
58
- type WidgetConstructor<WidgetT extends AnyWidget> = new (element: HTMLElement) => WidgetT;
59
- type WidgetProducer<WidgetT extends AnyWidget> = (element: HTMLElement) => WidgetT;
80
+ type WidgetConstructor<WidgetT extends AnyWidget> = new (element: HTMLElement, ...args: any[]) => WidgetT;
81
+ type WidgetProducer<WidgetT extends AnyWidget> = (element: HTMLElement, universe?: Foundation.Universe.Universe) =>
82
+ WidgetT;
60
83
  type WidgetFactory<WidgetT extends AnyWidget> = WidgetConstructor<WidgetT>|WidgetProducer<WidgetT>;
61
84
  type InferWidgetTFromFactory<F> = F extends WidgetFactory<infer WidgetT>? WidgetT : never;
62
85
 
@@ -199,8 +222,8 @@ export function registerWidgetConfig<WidgetT extends AnyWidget>(element: HTMLEle
199
222
  widgetConfigs.set(element, config);
200
223
  }
201
224
 
202
- function instantiateWidget<WidgetT extends AnyWidget>(element: HTMLElement,
203
- widgetConfig: WidgetConfig<WidgetT>): WidgetT {
225
+ export function instantiateWidget<WidgetT extends AnyWidget>(element: HTMLElement,
226
+ widgetConfig: WidgetConfig<WidgetT>): WidgetT {
204
227
  if (!widgetConfig.widgetClass) {
205
228
  throw new Error('No widgetClass defined');
206
229
  }
@@ -208,10 +231,21 @@ function instantiateWidget<WidgetT extends AnyWidget>(element: HTMLElement,
208
231
  let newWidget: WidgetT;
209
232
  if (Widget.isPrototypeOf(widgetConfig.widgetClass)) {
210
233
  const ctor = widgetConfig.widgetClass as WidgetConstructor<WidgetT>;
211
- newWidget = new ctor(element);
234
+ const depsCtors = (ctor as unknown as typeof Widget).INJECT;
235
+ if (depsCtors && depsCtors.length > 0) {
236
+ const universe = lookupUniverseForElement(element);
237
+ if (!universe) {
238
+ throw new Error(`No Universe found for widget ${ctor.name} requesting dependencies via INJECT.`);
239
+ }
240
+ const deps = depsCtors.map(depCtor => universe.get(depCtor));
241
+ newWidget = new ctor(element, deps);
242
+ } else {
243
+ newWidget = new ctor(element);
244
+ }
212
245
  } else {
213
246
  const factory = widgetConfig.widgetClass as WidgetProducer<WidgetT>;
214
- newWidget = factory(element);
247
+ const universe = lookupUniverseForElement(element);
248
+ newWidget = factory(element, universe);
215
249
  }
216
250
 
217
251
  if (widgetConfig.widgetParams) {
@@ -573,6 +607,15 @@ export class Widget<ContentTypeT extends HTMLElement|DocumentFragment = HTMLElem
573
607
  widgetMap.set(this.element, this);
574
608
  }
575
609
 
610
+ /**
611
+ * An array of dependency constructors that this widget class expects to receive as an array
612
+ * in the second positional argument to its constructor during `instantiateWidget`:
613
+ * `constructor(element: HTMLElement, deps: WidgetDependencies<typeof MyWidget>)`
614
+ *
615
+ * Override this static field in sub-classes to specify dependency constructors to be retrieved from `Universe`.
616
+ */
617
+ static readonly INJECT: ReadonlyArray<Root.DevToolsContext.ConstructorT<unknown>> = [];
618
+
576
619
  /**
577
620
  * Returns the {@link Widget} whose element is the given `node`, or `undefined`
578
621
  * if the `node` is not an element for a widget.
@@ -558,7 +558,7 @@ dt-icon-label {
558
558
  padding: 1px 3px;
559
559
  margin: 0 2px;
560
560
  font-size: 11px;
561
- font-family: sans-serif;
561
+ font-family: inherit;
562
562
  white-space: nowrap;
563
563
  display: inline-block;
564
564
  }
@@ -51,6 +51,7 @@ import * as Tooltip from './Tooltip.js';
51
51
  import * as TreeOutline from './Treeoutline.js';
52
52
  import * as UIUserMetrics from './UIUserMetrics.js';
53
53
  import * as UIUtils from './UIUtils.js';
54
+ import * as UniverseRequestEvent from './UniverseRequestEvent.js';
54
55
  import * as View from './View.js';
55
56
  import * as ViewManager from './ViewManager.js';
56
57
  import * as Widget from './Widget.js';
@@ -106,6 +107,7 @@ export {
106
107
  TreeOutline,
107
108
  UIUserMetrics,
108
109
  UIUtils,
110
+ UniverseRequestEvent,
109
111
  View,
110
112
  ViewManager,
111
113
  Widget,
@@ -3351,6 +3351,7 @@ export const knownContextValues = new Set([
3351
3351
  'request-payload',
3352
3352
  'request-types',
3353
3353
  'required',
3354
+ 'resend',
3354
3355
  'reset',
3355
3356
  'reset-children',
3356
3357
  'reset-columns',
@@ -4081,6 +4082,7 @@ export const knownContextValues = new Set([
4081
4082
  'timeline-dim-third-parties',
4082
4083
  'timeline-dim-unrelated-events',
4083
4084
  'timeline-disable-js-sampling',
4085
+ 'timeline-enable-soft-navigations',
4084
4086
  'timeline-enhanced-traces',
4085
4087
  'timeline-event-summary-widget',
4086
4088
  'timeline-experimental-insights',
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  "webidl2": "24.5.0",
92
92
  "yargs": "17.7.2"
93
93
  },
94
- "version": "1.0.1666631"
94
+ "version": "1.0.1667564"
95
95
  }