chrome-devtools-frontend 1.0.1595090 → 1.0.1596260

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 (49) hide show
  1. package/.stylelintrc.json +3 -1
  2. package/docs/ui_engineering.md +0 -36
  3. package/front_end/core/host/UserMetrics.ts +0 -1
  4. package/front_end/core/root/ExperimentNames.ts +0 -1
  5. package/front_end/core/sdk/DOMModel.ts +206 -0
  6. package/front_end/core/sdk/SourceMapScopesInfo.ts +1 -1
  7. package/front_end/entrypoints/greendev_floaty/floaty.css +2 -2
  8. package/front_end/entrypoints/main/MainImpl.ts +0 -5
  9. package/front_end/generated/InspectorBackendCommands.ts +3 -5
  10. package/front_end/generated/protocol-mapping.d.ts +0 -8
  11. package/front_end/generated/protocol-proxy-api.d.ts +0 -6
  12. package/front_end/generated/protocol.ts +1 -19
  13. package/front_end/models/ai_assistance/ConversationHandler.ts +1 -1
  14. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +1 -1
  15. package/front_end/models/javascript_metadata/NativeFunctions.js +5 -1
  16. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +2 -0
  17. package/front_end/panels/ai_assistance/components/ChatMessage.ts +48 -31
  18. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +38 -11
  19. package/front_end/panels/ai_assistance/components/chatMessage.css +4 -2
  20. package/front_end/panels/ai_assistance/components/walkthroughView.css +15 -0
  21. package/front_end/panels/application/IndexedDBModel.ts +2 -4
  22. package/front_end/panels/application/ServiceWorkersView.ts +3 -11
  23. package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +1 -1
  24. package/front_end/panels/elements/ComputedStyleWidget.ts +25 -16
  25. package/front_end/panels/elements/ElementsPanel.ts +0 -1
  26. package/front_end/panels/elements/StylePropertyTreeElement.ts +11 -5
  27. package/front_end/panels/elements/nodeStackTraceWidget.css +1 -1
  28. package/front_end/panels/emulation/DeviceModeToolbar.ts +171 -89
  29. package/front_end/panels/greendev/GreenDevPanel.css +2 -2
  30. package/front_end/panels/issues/AffectedPermissionElementsView.ts +9 -6
  31. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +11 -3
  32. package/front_end/panels/settings/components/SyncSection.ts +4 -13
  33. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +2 -15
  34. package/front_end/panels/timeline/RecordingMetadata.ts +1 -1
  35. package/front_end/panels/timeline/TimelineDetailsView.ts +2 -2
  36. package/front_end/panels/timeline/TimelineUIUtils.ts +7 -4
  37. package/front_end/panels/timeline/components/Utils.ts +2 -2
  38. package/front_end/panels/webauthn/webauthnPane.css +1 -1
  39. package/front_end/third_party/chromium/README.chromium +1 -1
  40. package/front_end/ui/components/tree_outline/TreeOutline.ts +1 -1
  41. package/front_end/ui/legacy/ProgressIndicator.ts +1 -1
  42. package/front_end/ui/legacy/Toolbar.ts +1 -1
  43. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +14 -7
  44. package/front_end/ui/legacy/legacy.ts +0 -2
  45. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
  46. package/inspector_overlay/loadCSS.rollup.js +2 -2
  47. package/inspector_overlay/tool_source_order.css +1 -0
  48. package/package.json +1 -1
  49. package/front_end/ui/legacy/Fragment.ts +0 -234
@@ -179,7 +179,7 @@
179
179
  }
180
180
 
181
181
  .code {
182
- font-family: monospace;
182
+ font-family: var(--monospace-font-family);
183
183
  }
184
184
 
185
185
  .learn-more {
@@ -1,7 +1,7 @@
1
1
  Name: Dependencies sourced from the upstream `chromium` repository
2
2
  URL: Internal
3
3
  Version: N/A
4
- Revision: cf64a516ef49cbc20688475f5ee7ec91c5bbe2da
4
+ Revision: a21e41557a9f4829967a0602aeecaa02de88801c
5
5
  Update Mechanism: Manual (https://crbug.com/428069060)
6
6
  License: BSD-3-Clause
7
7
  License File: LICENSE
@@ -527,7 +527,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
527
527
 
528
528
  const ulClasses = Lit.Directives.classMap({hasNoChildren: !hasChildrenInTree});
529
529
 
530
- await RenderCoordinator.write('TreeOutline render', () => {
530
+ await RenderCoordinator.write(() => {
531
531
  // Disabled until https://crbug.com/1079231 is fixed.
532
532
  // clang-format off
533
533
  // Unfortunately the TreeOutline web component adds the
@@ -66,7 +66,7 @@ export class ProgressIndicator extends HTMLElement implements Common.Progress.Pr
66
66
  }
67
67
 
68
68
  override get title(): string {
69
- return this.#labelElement.textContent ?? '';
69
+ return this.#labelElement.textContent;
70
70
  }
71
71
 
72
72
  set totalWork(totalWork: number) {
@@ -562,7 +562,7 @@ export class ToolbarText extends ToolbarItem<void, HTMLElement> {
562
562
  }
563
563
 
564
564
  text(): string {
565
- return this.element.textContent ?? '';
565
+ return this.element.textContent;
566
566
  }
567
567
 
568
568
  setText(text: string): void {
@@ -636,18 +636,25 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
636
636
  }
637
637
 
638
638
  static createNameElement(name: string|null, isPrivate?: boolean): Element {
639
+ const element = document.createElement('span');
640
+ element.classList.add('name');
639
641
  if (name === null) {
640
- return UI.Fragment.html`<span class="name"></span>`;
642
+ return element;
641
643
  }
642
644
  if (/^\s|\s$|^$|\n/.test(name)) {
643
- return UI.Fragment.html`<span class="name">"${name.replace(/\n/g, '\u21B5')}"</span>`;
645
+ element.textContent = `"${name.replace(/\n/g, '\u21B5')}"`;
646
+ return element;
644
647
  }
645
648
  if (isPrivate) {
646
- return UI.Fragment.html`<span class="name">
647
- <span class="private-property-hash">${name[0]}</span>${name.substring(1)}
648
- </span>`;
649
- }
650
- return UI.Fragment.html`<span class="name">${name}</span>`;
649
+ const privatePropertyHash = document.createElement('span');
650
+ privatePropertyHash.classList.add('private-property-hash');
651
+ privatePropertyHash.textContent = name[0];
652
+ element.appendChild(privatePropertyHash);
653
+ element.appendChild(document.createTextNode(name.substring(1)));
654
+ return element;
655
+ }
656
+ element.textContent = name;
657
+ return element;
651
658
  }
652
659
 
653
660
  static valueElementForFunctionDescription(
@@ -16,7 +16,6 @@ import * as EmptyWidget from './EmptyWidget.js';
16
16
  import * as FilterBar from './FilterBar.js';
17
17
  import * as FilterSuggestionBuilder from './FilterSuggestionBuilder.js';
18
18
  import * as ForwardedInputEventHandler from './ForwardedInputEventHandler.js';
19
- import * as Fragment from './Fragment.js';
20
19
  import * as GlassPane from './GlassPane.js';
21
20
  import * as Infobar from './Infobar.js';
22
21
  import * as InplaceEditor from './InplaceEditor.js';
@@ -67,7 +66,6 @@ export {
67
66
  FilterBar,
68
67
  FilterSuggestionBuilder,
69
68
  ForwardedInputEventHandler,
70
- Fragment,
71
69
  GlassPane,
72
70
  Infobar,
73
71
  InplaceEditor,
@@ -1359,6 +1359,10 @@ export const knownContextValues = new Set([
1359
1359
  'dominant-baseline',
1360
1360
  'dont-show-again',
1361
1361
  'download',
1362
+ 'dpr-1',
1363
+ 'dpr-2',
1364
+ 'dpr-3',
1365
+ 'dpr-default',
1362
1366
  'drag',
1363
1367
  'drag-drop',
1364
1368
  'dragend',
@@ -10,8 +10,8 @@ export default function loadCSS() {
10
10
  return {
11
11
  name: 'loadCSS',
12
12
  /**
13
- * @param code
14
- * @param id
13
+ * @param code {string}
14
+ * @param id {string}
15
15
  */
16
16
  transform(code, id) {
17
17
  if (id.endsWith('.css')) {
@@ -15,6 +15,7 @@
15
15
  text-align: center;
16
16
  align-items: center;
17
17
  background-color: #fff;
18
+ /* stylelint-disable-next-line plugin/use_monospace_font */
18
19
  font-family: Menlo, Consolas, monospace;
19
20
  font-size: 12px;
20
21
  font-weight: bold;
package/package.json CHANGED
@@ -105,5 +105,5 @@
105
105
  "flat-cache": "6.1.12"
106
106
  }
107
107
  },
108
- "version": "1.0.1595090"
108
+ "version": "1.0.1596260"
109
109
  }
@@ -1,234 +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
- /* eslint-disable @devtools/no-imperative-dom-api */
5
-
6
- function getNodeData(node: Node): string {
7
- return (node as unknown as {
8
- data: string,
9
- })
10
- .data;
11
- }
12
-
13
- function setNodeData<T>(node: Node, value: T): void {
14
- (node as unknown as {
15
- data: T,
16
- }).data = value;
17
- }
18
-
19
- export class Fragment {
20
- readonly #element: Element;
21
- private readonly elementsById = new Map<string, Element>();
22
-
23
- constructor(element: Element) {
24
- this.#element = element;
25
- }
26
-
27
- element(): Element {
28
- return this.#element;
29
- }
30
-
31
- $(elementId: string): Element {
32
- return this.elementsById.get(elementId) as Element;
33
- }
34
-
35
- static build(strings: TemplateDefinition, ...values: any[]): Fragment {
36
- return Fragment.render(Fragment.template(strings), values);
37
- }
38
-
39
- static cached(strings: TemplateDefinition, ...values: any[]): Fragment {
40
- let template = templateCache.get(strings);
41
- if (!template) {
42
- template = Fragment.template(strings);
43
- templateCache.set(strings, template);
44
- }
45
- return Fragment.render(template, values);
46
- }
47
-
48
- private static template(strings: TemplateDefinition): Template {
49
- let html = '';
50
- let insideText = true;
51
- for (let i = 0; i < strings.length - 1; i++) {
52
- html += strings[i];
53
- const close = strings[i].lastIndexOf('>');
54
- const open = strings[i].indexOf('<', close + 1);
55
- if (close !== -1 && open === -1) {
56
- insideText = true;
57
- } else if (open !== -1) {
58
- insideText = false;
59
- }
60
- html += insideText ? textMarker : attributeMarker(i);
61
- }
62
- html += strings[strings.length - 1];
63
-
64
- const template = document.createElement('template');
65
- template.innerHTML = html;
66
- const walker =
67
- template.ownerDocument.createTreeWalker(template.content, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, null);
68
- let valueIndex = 0;
69
- const emptyTextNodes = [];
70
- const binds: Bind[] = [];
71
- const nodesToMark = [];
72
- while (walker.nextNode()) {
73
- const node = (walker.currentNode as HTMLElement);
74
- if (node.nodeType === Node.ELEMENT_NODE && node.hasAttributes()) {
75
- if (node.hasAttribute('$')) {
76
- nodesToMark.push(node);
77
- binds.push({elementId: node.getAttribute('$') || ''});
78
- node.removeAttribute('$');
79
- }
80
-
81
- const attributesToRemove = [];
82
- for (let i = 0; i < node.attributes.length; i++) {
83
- const name = node.attributes[i].name;
84
-
85
- if (!attributeMarkerRegex.test(name) && !attributeMarkerRegex.test(node.attributes[i].value)) {
86
- continue;
87
- }
88
-
89
- attributesToRemove.push(name);
90
- nodesToMark.push(node);
91
-
92
- const attr = {
93
- index: valueIndex,
94
- names: name.split(attributeMarkerRegex),
95
- values: node.attributes[i].value.split(attributeMarkerRegex),
96
- };
97
- valueIndex += attr.names.length - 1;
98
- valueIndex += attr.values.length - 1;
99
- const bind: Bind = {
100
- attr,
101
- };
102
- binds.push(bind);
103
- }
104
- for (let i = 0; i < attributesToRemove.length; i++) {
105
- node.removeAttribute(attributesToRemove[i]);
106
- }
107
- }
108
-
109
- if (node.nodeType === Node.TEXT_NODE && getNodeData(node).indexOf(textMarker) !== -1) {
110
- const texts = getNodeData(node).split(textMarkerRegex);
111
- setNodeData(node, texts[texts.length - 1]);
112
- const parentNode = (node.parentNode as HTMLElement);
113
- for (let i = 0; i < texts.length - 1; i++) {
114
- if (texts[i]) {
115
- parentNode.insertBefore(document.createTextNode(texts[i]), node);
116
- }
117
- const nodeToReplace = document.createElement('span');
118
- nodesToMark.push(nodeToReplace);
119
- binds.push({replaceNodeIndex: valueIndex++});
120
- parentNode.insertBefore(nodeToReplace, node);
121
- }
122
- }
123
-
124
- if (node.nodeType === Node.TEXT_NODE &&
125
- (!node.previousSibling || node.previousSibling.nodeType === Node.ELEMENT_NODE) &&
126
- (!node.nextSibling || node.nextSibling.nodeType === Node.ELEMENT_NODE) && /^\s*$/.test(getNodeData(node))) {
127
- emptyTextNodes.push(node);
128
- }
129
- }
130
-
131
- for (let i = 0; i < nodesToMark.length; i++) {
132
- nodesToMark[i].classList.add(generateClassName(i));
133
- }
134
-
135
- for (const emptyTextNode of emptyTextNodes) {
136
- emptyTextNode.remove();
137
- }
138
- return {template, binds};
139
- }
140
-
141
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
142
- private static render(template: Template, values: any[]): Fragment {
143
- const content = template.template.ownerDocument.importNode(template.template.content, true);
144
- const resultElement = (content.firstChild === content.lastChild ? content.firstChild : content) as Element;
145
- const result = new Fragment(resultElement);
146
-
147
- const boundElements = [];
148
- for (let i = 0; i < template.binds.length; i++) {
149
- const className = generateClassName(i);
150
- const element = (content.querySelector('.' + className) as Element);
151
- element.classList.remove(className);
152
- boundElements.push(element);
153
- }
154
-
155
- for (let bindIndex = 0; bindIndex < template.binds.length; bindIndex++) {
156
- const bind = template.binds[bindIndex];
157
- const element = boundElements[bindIndex];
158
- if (bind.elementId !== undefined) {
159
- result.elementsById.set(bind.elementId, element);
160
- } else if (bind.replaceNodeIndex !== undefined) {
161
- const value = values[bind.replaceNodeIndex];
162
- (element.parentNode as HTMLElement).replaceChild(this.nodeForValue(value), element);
163
- } else if (bind.attr !== undefined) {
164
- if (bind.attr.names.length === 2 && bind.attr.values.length === 1 &&
165
- typeof values[bind.attr.index] === 'function') {
166
- values[bind.attr.index].call(null, element);
167
- } else {
168
- let name = bind.attr.names[0];
169
- for (let i = 1; i < bind.attr.names.length; i++) {
170
- name += values[bind.attr.index + i - 1];
171
- name += bind.attr.names[i];
172
- }
173
- if (name) {
174
- let value = bind.attr.values[0];
175
- for (let i = 1; i < bind.attr.values.length; i++) {
176
- value += values[bind.attr.index + bind.attr.names.length - 1 + i - 1];
177
- value += bind.attr.values[i];
178
- }
179
- element.setAttribute(name, value);
180
- }
181
- }
182
- } else {
183
- throw new Error('Unexpected bind');
184
- }
185
- }
186
- return result;
187
- }
188
-
189
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
190
- private static nodeForValue(value: any): Node {
191
- if (value instanceof Node) {
192
- return value;
193
- }
194
- if (value instanceof Fragment) {
195
- return value.#element;
196
- }
197
- if (Array.isArray(value)) {
198
- const node = document.createDocumentFragment();
199
- for (const v of value) {
200
- node.appendChild(this.nodeForValue(v));
201
- }
202
- return node;
203
- }
204
- return document.createTextNode(String(value));
205
- }
206
- }
207
-
208
- export const textMarker = '{{template-text}}';
209
- const textMarkerRegex = /{{template-text}}/;
210
- export const attributeMarker = (index: number): string => 'template-attribute' + index;
211
- const attributeMarkerRegex = /template-attribute\d+/;
212
- const generateClassName = (index: number): string => 'template-class-' + index;
213
- const templateCache = new Map<TemplateDefinition, Template>();
214
-
215
- export const html = (strings: TemplateDefinition, ...vararg: any[]): Element => {
216
- return Fragment.cached(strings, ...vararg).element();
217
- };
218
-
219
- export type TemplateDefinition = string[]|TemplateStringsArray;
220
-
221
- export interface Bind {
222
- elementId?: string;
223
- attr?: {
224
- index: number,
225
- names: string[],
226
- values: string[],
227
- };
228
- replaceNodeIndex?: number;
229
- }
230
-
231
- export interface Template {
232
- template: HTMLTemplateElement;
233
- binds: Bind[];
234
- }