chrome-devtools-frontend 1.0.1521746 → 1.0.1522145

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 (47) hide show
  1. package/front_end/core/host/GdpClient.ts +116 -66
  2. package/front_end/core/root/Runtime.ts +1 -0
  3. package/front_end/entrypoints/inspector_main/InspectorMain.ts +82 -32
  4. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +1 -1
  5. package/front_end/entrypoints/main/MainImpl.ts +7 -1
  6. package/front_end/generated/InspectorBackendCommands.js +3 -2
  7. package/front_end/generated/protocol-mapping.d.ts +9 -0
  8. package/front_end/generated/protocol-proxy-api.d.ts +8 -0
  9. package/front_end/generated/protocol.ts +12 -0
  10. package/front_end/models/ai_assistance/agents/NetworkAgent.ts +10 -6
  11. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +42 -4
  12. package/front_end/models/badges/UserBadges.ts +14 -16
  13. package/front_end/panels/ai_assistance/components/UserActionRow.ts +1 -2
  14. package/front_end/panels/application/IndexedDBViews.ts +1 -0
  15. package/front_end/panels/application/ReportingApiTreeElement.ts +1 -2
  16. package/front_end/panels/application/ReportingApiView.ts +18 -20
  17. package/front_end/panels/application/ServiceWorkerCacheViews.ts +3 -0
  18. package/front_end/panels/application/components/EndpointsGrid.ts +51 -59
  19. package/front_end/panels/application/components/ReportsGrid.ts +86 -107
  20. package/front_end/panels/application/components/StorageMetadataView.ts +30 -4
  21. package/front_end/panels/application/components/endpointsGrid.css +30 -0
  22. package/front_end/panels/application/components/reportsGrid.css +34 -0
  23. package/front_end/panels/application/components/storageMetadataView.css +9 -0
  24. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +19 -27
  25. package/front_end/panels/common/BadgeNotification.ts +10 -3
  26. package/front_end/panels/network/NetworkPanel.ts +1 -1
  27. package/front_end/panels/search/SearchResultsPane.ts +14 -13
  28. package/front_end/panels/search/SearchView.ts +3 -20
  29. package/front_end/panels/settings/components/SyncSection.ts +8 -6
  30. package/front_end/panels/sources/SearchSourcesView.ts +1 -1
  31. package/front_end/panels/whats_new/ReleaseNoteText.ts +15 -11
  32. package/front_end/panels/whats_new/resources/WNDT.md +9 -6
  33. package/front_end/third_party/chromium/README.chromium +1 -1
  34. package/front_end/third_party/diff/README.chromium +0 -1
  35. package/front_end/ui/legacy/Treeoutline.ts +6 -9
  36. package/front_end/ui/legacy/UIUtils.ts +4 -17
  37. package/front_end/ui/legacy/Widget.ts +0 -5
  38. package/front_end/ui/legacy/XElement.ts +0 -33
  39. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +3 -3
  40. package/front_end/ui/legacy/components/perf_ui/FilmStripView.ts +38 -21
  41. package/front_end/ui/legacy/components/perf_ui/filmStripView.css +29 -0
  42. package/front_end/ui/legacy/components/source_frame/XMLView.ts +3 -2
  43. package/front_end/ui/legacy/legacy.ts +0 -2
  44. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  45. package/package.json +1 -1
  46. package/front_end/panels/application/components/reportingApiGrid.css +0 -31
  47. package/front_end/ui/legacy/XWidget.ts +0 -133
@@ -40,28 +40,32 @@ export function getReleaseNote(): ReleaseNote {
40
40
  }
41
41
 
42
42
  let releaseNote: ReleaseNote = {
43
- version: 82,
44
- header: 'What\'s new in DevTools 141',
43
+ version: 83,
44
+ header: 'What\'s new in DevTools 142',
45
45
  markdownLinks: [
46
46
  {
47
- key: 'ai-insight',
48
- link: 'https://developer.chrome.com/blog/new-in-devtools-141/#ai-insight',
47
+ key: 'perf-ai-agent',
48
+ link: 'https://developer.chrome.com/blog/new-in-devtools-142/#perf-ai-agent',
49
49
  },
50
50
  {
51
- key: 'ai-chat-export',
52
- link: 'https://developer.chrome.com/blog/new-in-devtools-141/#ai-chat-export',
51
+ key: 'ai-code-completion',
52
+ link: 'https://developer.chrome.com/blog/new-in-devtools-142/#ai-code-completion',
53
53
  },
54
54
  {
55
- key: 'ipp',
56
- link: 'https://developer.chrome.com/blog/new-in-devtools-141/#ipp',
55
+ key: 'gdp',
56
+ link: 'https://developer.chrome.com/blog/new-in-devtools-142/#gdp',
57
+ },
58
+ {
59
+ key: 'ai-main-button',
60
+ link: 'https://developer.chrome.com/blog/new-in-devtools-142/#ai-main-button',
57
61
  },
58
62
  ],
59
63
  videoLinks: [
60
64
  {
61
- description: 'See past highlights from Chrome 140',
62
- link: 'https://developer.chrome.com/blog/new-in-devtools-140' as Platform.DevToolsPath.UrlString,
65
+ description: 'See past highlights from Chrome 141',
66
+ link: 'https://developer.chrome.com/blog/new-in-devtools-141' as Platform.DevToolsPath.UrlString,
63
67
  type: VideoType.WHATS_NEW,
64
68
  },
65
69
  ],
66
- link: 'https://developer.chrome.com/blog/new-in-devtools-141/',
70
+ link: 'https://developer.chrome.com/blog/new-in-devtools-142/',
67
71
  };
@@ -1,8 +1,11 @@
1
- ### [Debug the network dependency tree with Gemini](ai-insight)
2
- In Performance > Insights > Network dependency tree, click the corresponding AI button to discuss and debug said tree with Gemini in the 'AI assistance' panel.
1
+ ### [Full stack trace AI agent in Performance panel](perf-ai-agent)
2
+ The Performance panel now integrates a more capable AI agent that has full access to the stack trace.
3
3
 
4
- ### [Export your chats with Gemini](ai-chat-export)
5
- You can now export your current chat with Gemini or copy its response to clipboard with a click of a button.
4
+ ### [AI code completion in Sources and Console](ai-code-completion)
5
+ Code completion powered by AI is now available in the Sources panel and the Console.
6
6
 
7
- ### [Filter IP protected network requests](ipp)
8
- In the Network panel, you can now filter requests sent to IP Protection proxies.
7
+ ### [Google Developer Program support](gdp)
8
+ The Google Developer Program, a ready-made subscription and community platform, is now in DevTools, offering a more personalized experience, a badge system, and easier discovery of new features.
9
+
10
+ ### [One main 'Debug with AI' button](ai-main-button)
11
+ The primary action bar at the top of DevTools now features the primary "Debug with AI" button which opens the 'AI assistance' panel in a right-hand side bar.
@@ -1,7 +1,7 @@
1
1
  Name: Dependencies sourced from the upstream `chromium` repository
2
2
  URL: https://source.chromium.org/chromium/chromium/src/+/main:components/variations/proto/devtools/
3
3
  Version: N/A
4
- Revision: c0cd408650a942d836b07c15facd3f4fede1d578
4
+ Revision: e8bb55e7f56140e285b00abfd3811f1c3656ca4c
5
5
  Update Mechanism: Manual (https://crbug.com/428069060)
6
6
  License: BSD-3-Clause
7
7
  License File: LICENSE
@@ -3,7 +3,6 @@ Short Name: diff-match-patch
3
3
  URL: https://github.com/google/diff-match-patch/tree/master/javascript
4
4
  Version: 5.60.0
5
5
  Revision: 0ae308daa77aeddb089cd6b7b0a443fca026266e
6
- Update Mechanism: Manual
7
6
  License: Apache-2.0
8
7
  License File: LICENSE
9
8
  Update Mechanism: Static.HardFork (https://crbug.com/422918273)
@@ -1637,7 +1637,7 @@ function getTreeNodes(nodeList: NodeList|Node[]): HTMLLIElement[] {
1637
1637
  * <devtools-tree
1638
1638
  * .template=${html`
1639
1639
  * <ul role="tree">
1640
- * <li role="treeitem">
1640
+ * <li role="treeitem" @expand=${onExpand}>
1641
1641
  * Tree Node Text
1642
1642
  * <ul role="group">
1643
1643
  * Node with subtree
@@ -1659,7 +1659,7 @@ function getTreeNodes(nodeList: NodeList|Node[]): HTMLLIElement[] {
1659
1659
  * tree node). If a tree node contains a <ul role="group">, that defines a subtree under that tree node. The `hidden`
1660
1660
  * attribute on the <ul> defines whether that subtree should render as collapsed. Note that node expanding/collapsing do
1661
1661
  * not reflect this state back to the attribute on the config element, those state changes are rather sent out as
1662
- * `expand` events.
1662
+ * `expand` events on the config element.
1663
1663
  *
1664
1664
  * Under the hood this uses TreeOutline.
1665
1665
  *
@@ -1687,7 +1687,6 @@ function getTreeNodes(nodeList: NodeList|Node[]): HTMLLIElement[] {
1687
1687
  *
1688
1688
  * @property template Define the tree contents
1689
1689
  * @event selected A node was selected
1690
- * @event expand A subtree was expanded or collapsed
1691
1690
  * @attribute navigation-variant Turn this tree into the navigation variant
1692
1691
  * @attribute hide-overflow
1693
1692
  */
@@ -1704,14 +1703,12 @@ export class TreeViewElement extends HTMLElementWithLightDOMTemplate {
1704
1703
  });
1705
1704
  this.#treeOutline.addEventListener(Events.ElementExpanded, event => {
1706
1705
  if (event.data instanceof TreeViewTreeElement) {
1707
- this.dispatchEvent(new TreeViewElement.ExpandEvent(
1708
- {expanded: true, target: (event.data as TreeViewTreeElement).configElement}));
1706
+ event.data.listItemElement.dispatchEvent(new TreeViewElement.ExpandEvent({expanded: true}));
1709
1707
  }
1710
1708
  });
1711
1709
  this.#treeOutline.addEventListener(Events.ElementCollapsed, event => {
1712
1710
  if (event.data instanceof TreeViewTreeElement) {
1713
- this.dispatchEvent(new TreeViewElement.ExpandEvent(
1714
- {expanded: false, target: (event.data as TreeViewTreeElement).configElement}));
1711
+ event.data.listItemElement.dispatchEvent(new TreeViewElement.ExpandEvent({expanded: false}));
1715
1712
  }
1716
1713
  });
1717
1714
  this.addNodes(getTreeNodes([this]));
@@ -1832,8 +1829,8 @@ export namespace TreeViewElement {
1832
1829
  }
1833
1830
  }
1834
1831
 
1835
- export class ExpandEvent extends CustomEvent<{expanded: boolean, target: HTMLLIElement}> {
1836
- constructor(detail: {expanded: boolean, target: HTMLLIElement}) {
1832
+ export class ExpandEvent extends CustomEvent<{expanded: boolean}> {
1833
+ constructor(detail: {expanded: boolean}) {
1837
1834
  super('expand', {detail});
1838
1835
  }
1839
1836
  }
@@ -62,7 +62,6 @@ import smallBubbleStyles from './smallBubble.css.js';
62
62
  import type {ToolbarButton} from './Toolbar.js';
63
63
  import {Tooltip} from './Tooltip.js';
64
64
  import {Widget} from './Widget.js';
65
- import type {XWidget} from './XWidget.js';
66
65
 
67
66
  declare global {
68
67
  interface HTMLElementTagNameMap {
@@ -1935,27 +1934,11 @@ function updateWidgetfocusWidgetForNode(node: Node|null): void {
1935
1934
  }
1936
1935
  }
1937
1936
 
1938
- function updateXWidgetfocusWidgetForNode(node: Node|null): void {
1939
- node = node?.parentNodeOrShadowHost() ?? null;
1940
- const XWidgetConstructor = customElements.get('x-widget') as Platform.Constructor.Constructor<XWidget>| undefined;
1941
- let widget = null;
1942
- while (node) {
1943
- if (XWidgetConstructor && node instanceof XWidgetConstructor) {
1944
- if (widget) {
1945
- node.defaultFocusedElement = widget;
1946
- }
1947
- widget = node;
1948
- }
1949
- node = node.parentNodeOrShadowHost();
1950
- }
1951
- }
1952
-
1953
1937
  function focusChanged(event: Event): void {
1954
1938
  const target = event.target as HTMLElement;
1955
1939
  const document = target ? target.ownerDocument : null;
1956
1940
  const element = document ? Platform.DOMUtilities.deepActiveElement(document) : null;
1957
1941
  updateWidgetfocusWidgetForNode(element);
1958
- updateXWidgetfocusWidgetForNode(element);
1959
1942
  }
1960
1943
 
1961
1944
  /**
@@ -2282,6 +2265,10 @@ export class HTMLElementWithLightDOMTemplate extends HTMLElement {
2282
2265
  }
2283
2266
  }
2284
2267
 
2268
+ get templateRoot(): DocumentFragment|HTMLElement {
2269
+ return this.#contentTemplate?.content ?? this;
2270
+ }
2271
+
2285
2272
  set template(template: Lit.LitTemplate) {
2286
2273
  if (!this.#contentTemplate) {
2287
2274
  this.removeChildren();
@@ -36,7 +36,6 @@ import * as Geometry from '../../models/geometry/geometry.js';
36
36
  import * as Lit from '../../ui/lit/lit.js';
37
37
 
38
38
  import {createShadowRootWithCoreStyles} from './UIUtils.js';
39
- import {XWidget} from './XWidget.js';
40
39
 
41
40
  // Remember the original DOM mutation methods here, since we
42
41
  // will override them below to sanity check the Widget system.
@@ -757,10 +756,6 @@ export class Widget {
757
756
  }
758
757
  let child = this.contentElement.traverseNextNode(this.contentElement);
759
758
  while (child) {
760
- if (child instanceof XWidget) {
761
- child.focus();
762
- return;
763
- }
764
759
  child = child.traverseNextNode(this.contentElement);
765
760
  }
766
761
  }
@@ -39,36 +39,3 @@ export class XElement extends HTMLElement {
39
39
  }
40
40
  }
41
41
  }
42
-
43
- class XBox extends XElement {
44
- constructor(direction: string) {
45
- super();
46
- this.style.setProperty('display', 'flex');
47
- this.style.setProperty('flex-direction', direction);
48
- this.style.setProperty('justify-content', 'flex-start');
49
- }
50
-
51
- static override get observedAttributes(): string[] {
52
- return super.observedAttributes.concat(['x-start', 'x-center', 'x-stretch', 'x-baseline', 'justify-content']);
53
- }
54
-
55
- override attributeChangedCallback(attr: string, oldValue: string|null, newValue: string|null): void {
56
- if (attr === 'x-start' || attr === 'x-center' || attr === 'x-stretch' || attr === 'x-baseline') {
57
- if (newValue === null) {
58
- this.style.removeProperty('align-items');
59
- } else {
60
- this.style.setProperty('align-items', attr === 'x-start' ? 'flex-start' : attr.substr(2));
61
- }
62
- return;
63
- }
64
- super.attributeChangedCallback(attr, oldValue, newValue);
65
- }
66
- }
67
-
68
- class XHBox extends XBox {
69
- constructor() {
70
- super('row');
71
- }
72
- }
73
-
74
- customElements.define('x-hbox', XHBox);
@@ -95,7 +95,7 @@ class DataGridElement extends UI.UIUtils.HTMLElementWithLightDOMTemplate {
95
95
 
96
96
  this.#resizeObserver.observe(this);
97
97
  this.#updateColumns();
98
- this.addNodes(this.querySelectorAll('tr'));
98
+ this.addNodes(this.templateRoot.querySelectorAll('tr'));
99
99
  }
100
100
 
101
101
  attributeChangedCallback(name: string, oldValue: string|null, newValue: string|null): void {
@@ -155,7 +155,7 @@ class DataGridElement extends UI.UIUtils.HTMLElementWithLightDOMTemplate {
155
155
  this.#hideableColumns.clear();
156
156
  this.#columns = [];
157
157
  let hasEditableColumn = false;
158
- for (const column of this.querySelectorAll('th[id]') || []) {
158
+ for (const column of this.templateRoot.querySelectorAll('th[id]') || []) {
159
159
  const id = column.id as Lowercase<string>;
160
160
  let title = column.textContent?.trim() || '';
161
161
  const titleDOMFragment = column.firstElementChild ? document.createDocumentFragment() : undefined;
@@ -308,7 +308,7 @@ class DataGridElement extends UI.UIUtils.HTMLElementWithLightDOMTemplate {
308
308
  this.#usedCreationNode = null;
309
309
  this.#dataGrid.creationNode = undefined;
310
310
  }
311
- const placeholder = this.querySelector('tr[placeholder]');
311
+ const placeholder = this.templateRoot.querySelector('tr[placeholder]');
312
312
  if (!placeholder) {
313
313
  this.#dataGrid.creationNode?.remove();
314
314
  this.#dataGrid.creationNode = undefined;
@@ -149,8 +149,7 @@ interface DialogParsedTrace {
149
149
  }
150
150
 
151
151
  export class Dialog {
152
- private fragment: UI.Fragment.Fragment;
153
- private readonly widget: UI.XWidget.XWidget;
152
+ private readonly widget: UI.Widget.Widget;
154
153
  private index: number;
155
154
  private dialog: UI.Dialog.Dialog|null = null;
156
155
 
@@ -173,21 +172,32 @@ export class Dialog {
173
172
  UI.Tooltip.Tooltip.install(prevButton, i18nString(UIStrings.previousFrame));
174
173
  const nextButton = UI.UIUtils.createTextButton('\u25B6', this.onNextFrame.bind(this));
175
174
  UI.Tooltip.Tooltip.install(nextButton, i18nString(UIStrings.nextFrame));
176
- this.fragment = UI.Fragment.Fragment.build`
177
- <x-widget flex=none margin='var(--sys-size-7) var(--sys-size-8) var(--sys-size-8) var(--sys-size-8)'>
178
- <x-hbox overflow=auto border='var(--sys-size-1) solid var(--sys-color-divider)'>
179
- <img $='image' data-film-strip-dialog-img style="max-height: 80vh; max-width: 80vw;"></img>
180
- </x-hbox>
181
- <x-hbox x-center justify-content=center margin-top='var(--sys-size-6)'>
182
- ${prevButton}
183
- <x-hbox $='time' margin='var(--sys-size-5)'></x-hbox>
184
- ${nextButton}
185
- </x-hbox>
186
- </x-widget>
187
- `;
188
- this.widget = (this.fragment.element() as UI.XWidget.XWidget);
189
- (this.widget as HTMLElement).tabIndex = 0;
190
- this.widget.addEventListener('keydown', this.keyDown.bind(this), false);
175
+ this.widget = new UI.Widget.Widget({classes: ['film-strip-image-dialog']});
176
+ this.widget.registerRequiredCSS(filmStripViewStyles);
177
+
178
+ const imageBox = document.createElement('div');
179
+ imageBox.classList.add('image-box');
180
+
181
+ const image = document.createElement('img');
182
+ image.setAttribute('data-film-strip-dialog-img', '');
183
+ imageBox.append(image);
184
+
185
+ const buttonBox = document.createElement('div');
186
+ buttonBox.classList.add('button-box');
187
+
188
+ const timeBox = document.createElement('div');
189
+ timeBox.classList.add('time-box');
190
+
191
+ buttonBox.append(prevButton);
192
+ buttonBox.append(timeBox);
193
+ buttonBox.append(nextButton);
194
+
195
+ this.widget.contentElement.append(imageBox);
196
+ this.widget.contentElement.append(buttonBox);
197
+
198
+ this.widget.element.tabIndex = 0;
199
+ this.widget.contentElement.append();
200
+ this.widget.contentElement.addEventListener('keydown', this.keyDown.bind(this), false);
191
201
  this.dialog = null;
192
202
 
193
203
  void this.render();
@@ -210,8 +220,8 @@ export class Dialog {
210
220
  private resize(): void {
211
221
  if (!this.dialog) {
212
222
  this.dialog = new UI.Dialog.Dialog();
213
- this.dialog.contentElement.appendChild(this.widget);
214
- this.dialog.setDefaultFocusedElement(this.widget);
223
+ this.widget.show(this.dialog.contentElement);
224
+ this.dialog.setDefaultFocusedElement(this.widget.element);
215
225
  this.dialog.show();
216
226
  }
217
227
  this.dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.MEASURE_CONTENT);
@@ -273,8 +283,15 @@ export class Dialog {
273
283
  private render(): void {
274
284
  const frame = this.#data.frames[this.index];
275
285
  const timestamp = Trace.Helpers.Timing.microToMilli(frame.screenshotEvent.ts);
276
- this.fragment.$('time').textContent = i18n.TimeUtilities.millisToString(timestamp - this.#zeroTime());
277
- const image = (this.fragment.$('image') as HTMLImageElement);
286
+ const timeBox = this.widget.contentElement.querySelector('.time-box');
287
+ if (timeBox) {
288
+ timeBox.textContent = i18n.TimeUtilities.millisToString(timestamp - this.#zeroTime());
289
+ }
290
+
291
+ const image = this.widget.contentElement.querySelector('img');
292
+ if (!image) {
293
+ return;
294
+ }
278
295
  image.setAttribute('data-frame-index', this.index.toString());
279
296
  const imgData = Trace.Handlers.ModelHandlers.Screenshots.screenshotImageDataUri(frame.screenshotEvent);
280
297
  FilmStripView.setImageData(image, imgData);
@@ -59,3 +59,32 @@
59
59
  .film-strip-view .frame:focus .thumbnail img {
60
60
  box-shadow: none;
61
61
  }
62
+
63
+ .film-strip-image-dialog {
64
+ display: flex;
65
+ flex-direction: column;
66
+ width: 100%;
67
+
68
+ .image-box {
69
+ overflow: auto;
70
+ margin: var(--sys-size-7) var(--sys-size-8) var(--sys-size-8)
71
+ var(--sys-size-8);
72
+ border: var(--sys-size-1) solid var(--sys-color-divider);
73
+ }
74
+
75
+ img {
76
+ max-height: 80vh;
77
+ max-width: 80vw;
78
+ }
79
+
80
+ .time-box {
81
+ margin: 0 var(--sys-size-3);
82
+ }
83
+
84
+ .button-box {
85
+ display: flex;
86
+ align-items: center;
87
+ justify-content: center;
88
+ margin: var(--sys-size-6) 0 var(--sys-size-5);
89
+ }
90
+ }
@@ -5,6 +5,7 @@
5
5
  import * as i18n from '../../../../core/i18n/i18n.js';
6
6
  import * as TextUtils from '../../../../models/text_utils/text_utils.js';
7
7
  import * as Lit from '../../../lit/lit.js';
8
+ import * as VisualLogging from '../../../visual_logging/visual_logging.js';
8
9
  import * as UI from '../../legacy.js';
9
10
 
10
11
  import xmlTreeStyles from './xmlTree.css.js';
@@ -29,7 +30,7 @@ function* attributes(element: Element): Generator<Attr> {
29
30
  }
30
31
 
31
32
  function hasNonTextChildren(node: Node): boolean {
32
- return node.childNodes.length !== node.childTextNodes.length;
33
+ return Boolean(node.childNodes.values().find(node => node.nodeType !== Node.TEXT_NODE));
33
34
  }
34
35
 
35
36
  function textView(treeNode: XMLTreeViewNode, closeTag: boolean): string {
@@ -249,7 +250,7 @@ export class XMLView extends UI.Widget.Widget implements UI.SearchableView.Searc
249
250
  #nextJump: SearchResult|undefined;
250
251
 
251
252
  constructor(target?: HTMLElement, view: View = DEFAULT_VIEW) {
252
- super(target, {jslog: 'xml-view', classes: ['shadow-xml-view', 'source-code']});
253
+ super(target, {jslog: `${VisualLogging.pane('xml-view')}`, classes: ['shadow-xml-view', 'source-code']});
253
254
  this.#view = view;
254
255
  }
255
256
 
@@ -52,7 +52,6 @@ import * as ViewManager from './ViewManager.js';
52
52
  import * as Widget from './Widget.js';
53
53
  import * as XElement from './XElement.js';
54
54
  import * as XLink from './XLink.js';
55
- import * as XWidget from './XWidget.js';
56
55
  import * as ZoomManager from './ZoomManager.js';
57
56
 
58
57
  export {
@@ -106,6 +105,5 @@ export {
106
105
  Widget,
107
106
  XElement,
108
107
  XLink,
109
- XWidget,
110
108
  ZoomManager,
111
109
  };
@@ -4137,6 +4137,7 @@ export const knownContextValues = new Set([
4137
4137
  'x-offset',
4138
4138
  'x-small',
4139
4139
  'xhr',
4140
+ 'xml-view',
4140
4141
  'xr',
4141
4142
  'xx-large',
4142
4143
  'xx-small',
package/package.json CHANGED
@@ -102,5 +102,5 @@
102
102
  "@eslint/core": "0.15.1"
103
103
  }
104
104
  },
105
- "version": "1.0.1521746"
105
+ "version": "1.0.1522145"
106
106
  }
@@ -1,31 +0,0 @@
1
- /*
2
- * Copyright 2021 The Chromium Authors
3
- * Use of this source code is governed by a BSD-style license that can be
4
- * found in the LICENSE file.
5
- */
6
-
7
- :host {
8
- overflow: auto;
9
- height: 100%;
10
- }
11
-
12
- .reporting-container {
13
- height: 100%;
14
- display: flex;
15
- flex-direction: column;
16
- }
17
-
18
- .reporting-header {
19
- font-size: 15px;
20
- background-color: var(--sys-color-surface2);
21
- padding: 1px 4px;
22
- flex-shrink: 0;
23
- }
24
-
25
- devtools-data-grid {
26
- flex: auto;
27
- }
28
-
29
- .inline-icon {
30
- vertical-align: text-bottom;
31
- }
@@ -1,133 +0,0 @@
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 {XElement} from './XElement.js';
6
-
7
- let observer: ResizeObserver|null = null;
8
-
9
- const storedScrollPositions = new WeakMap<Element, {
10
- scrollLeft: number,
11
- scrollTop: number,
12
- }>();
13
-
14
- export class XWidget extends XElement {
15
- private visible: boolean;
16
- defaultFocusedElement: Element|null;
17
- private elementsToRestoreScrollPositionsFor: Element[];
18
- private onShownCallback!: (() => void)|null;
19
- private onHiddenCallback!: (() => void)|null;
20
- private onResizedCallback!: (() => void)|null;
21
-
22
- constructor() {
23
- super();
24
- this.style.setProperty('display', 'flex');
25
- this.style.setProperty('flex-direction', 'column');
26
- this.style.setProperty('align-items', 'stretch');
27
- this.style.setProperty('justify-content', 'flex-start');
28
- this.style.setProperty('contain', 'layout style');
29
-
30
- this.visible = false;
31
- this.defaultFocusedElement = null;
32
- this.elementsToRestoreScrollPositionsFor = [];
33
-
34
- if (!observer) {
35
- observer = new ResizeObserver(entries => {
36
- for (const entry of entries) {
37
- const widget = (entry.target as XWidget);
38
- if (widget.visible && widget.onResizedCallback) {
39
- widget.onResizedCallback.call(null);
40
- }
41
- }
42
- });
43
- }
44
-
45
- observer.observe(this);
46
-
47
- this.setElementsToRestoreScrollPositionsFor([this]);
48
- }
49
-
50
- isShowing(): boolean {
51
- return this.visible;
52
- }
53
-
54
- setElementsToRestoreScrollPositionsFor(elements: Element[]): void {
55
- for (const element of this.elementsToRestoreScrollPositionsFor) {
56
- element.removeEventListener('scroll', XWidget.storeScrollPosition, {capture: false});
57
- }
58
- this.elementsToRestoreScrollPositionsFor = elements;
59
- for (const element of this.elementsToRestoreScrollPositionsFor) {
60
- element.addEventListener('scroll', XWidget.storeScrollPosition, {passive: true, capture: false});
61
- }
62
- }
63
-
64
- restoreScrollPositions(): void {
65
- for (const element of this.elementsToRestoreScrollPositionsFor) {
66
- const storedPositions = storedScrollPositions.get(element);
67
- if (storedPositions) {
68
- element.scrollTop = storedPositions.scrollTop;
69
- element.scrollLeft = storedPositions.scrollLeft;
70
- }
71
- }
72
- }
73
-
74
- private static storeScrollPosition(event: Event): void {
75
- const element = (event.currentTarget as Element);
76
- storedScrollPositions.set(element, {scrollLeft: element.scrollLeft, scrollTop: element.scrollTop});
77
- }
78
-
79
- setDefaultFocusedElement(element: Element|null): void {
80
- if (element && !this.isSelfOrAncestor(element)) {
81
- throw new Error('Default focus must be descendant');
82
- }
83
- this.defaultFocusedElement = element;
84
- }
85
-
86
- override focus(): void {
87
- if (!this.visible) {
88
- return;
89
- }
90
-
91
- let element;
92
- if (this.defaultFocusedElement && this.isSelfOrAncestor(this.defaultFocusedElement)) {
93
- element = this.defaultFocusedElement;
94
- } else if (this.tabIndex !== -1) {
95
- element = this;
96
- } else {
97
- let child = this.traverseNextNode(this);
98
- while (child) {
99
- if ((child instanceof XWidget) && child.visible) {
100
- element = child;
101
- break;
102
- }
103
- child = child.traverseNextNode(this);
104
- }
105
- }
106
-
107
- if (!element || element.hasFocus()) {
108
- return;
109
- }
110
- if (element === this) {
111
- HTMLElement.prototype.focus.call(this);
112
- } else {
113
- (element as HTMLElement).focus();
114
- }
115
- }
116
-
117
- connectedCallback(): void {
118
- this.visible = true;
119
- this.restoreScrollPositions();
120
- if (this.onShownCallback) {
121
- this.onShownCallback.call(null);
122
- }
123
- }
124
-
125
- disconnectedCallback(): void {
126
- this.visible = false;
127
- if (this.onHiddenCallback) {
128
- this.onHiddenCallback.call(null);
129
- }
130
- }
131
- }
132
-
133
- customElements.define('x-widget', XWidget);