chrome-devtools-frontend 1.0.943017 → 1.0.943182

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 (86) hide show
  1. package/config/gni/all_devtools_files.gni +0 -9
  2. package/config/gni/devtools_grd_files.gni +6 -1
  3. package/front_end/core/sdk/ConsoleModel.ts +1 -5
  4. package/front_end/entrypoints/device_mode_emulation_frame/device_mode_emulation_frame.ts +1 -1
  5. package/front_end/entrypoints/devtools_app/devtools_app.js +1 -1
  6. package/front_end/entrypoints/devtools_app/devtools_app.json +1 -2
  7. package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +1 -1
  8. package/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker-entrypoint.ts +1 -1
  9. package/front_end/entrypoints/inspector/inspector.js +1 -1
  10. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +2 -3
  11. package/front_end/entrypoints/js_app/js_app.js +1 -1
  12. package/front_end/entrypoints/main/main-meta.ts +1 -2
  13. package/front_end/entrypoints/ndb_app/ndb_app.js +1 -1
  14. package/front_end/entrypoints/node_app/node_app-meta.ts +0 -2
  15. package/front_end/entrypoints/node_app/node_app.js +1 -1
  16. package/front_end/entrypoints/node_main/node_main-meta.ts +0 -1
  17. package/front_end/entrypoints/shell/shell.json +1 -2
  18. package/front_end/entrypoints/wasmparser_worker/wasmparser_worker-entrypoint.ts +1 -1
  19. package/front_end/entrypoints/worker_app/worker_app.js +1 -1
  20. package/front_end/legacy_test_runner/console_test_runner/console_test_runner.js +5 -1
  21. package/front_end/models/persistence/persistence-meta.ts +0 -1
  22. package/front_end/panels/accessibility/accessibility-meta.ts +0 -1
  23. package/front_end/panels/animation/animation-meta.ts +0 -1
  24. package/front_end/panels/application/application-meta.ts +0 -1
  25. package/front_end/panels/application/components/stackTraceRow.css +8 -0
  26. package/front_end/panels/browser_debugger/browser_debugger-meta.ts +1 -2
  27. package/front_end/panels/changes/changes-meta.ts +0 -1
  28. package/front_end/panels/console/ConsolePinPane.ts +2 -6
  29. package/front_end/panels/console/ConsoleViewMessage.ts +8 -1
  30. package/front_end/panels/console/console-meta.ts +0 -1
  31. package/front_end/panels/console_counters/console_counters-meta.ts +0 -1
  32. package/front_end/panels/coverage/coverage-meta.ts +0 -1
  33. package/front_end/panels/css_overview/css_overview-meta.ts +0 -1
  34. package/front_end/panels/developer_resources/developer_resources-meta.ts +0 -1
  35. package/front_end/panels/elements/elements-meta.ts +0 -1
  36. package/front_end/panels/emulation/emulation-meta.ts +0 -1
  37. package/front_end/panels/help/help-meta.ts +0 -1
  38. package/front_end/panels/input/input-meta.ts +0 -1
  39. package/front_end/panels/issues/issues-meta.ts +0 -1
  40. package/front_end/panels/js_profiler/js_profiler-meta.ts +0 -1
  41. package/front_end/panels/layers/layers-meta.ts +0 -4
  42. package/front_end/panels/lighthouse/lighthouse-meta.ts +0 -1
  43. package/front_end/panels/media/media-meta.ts +0 -1
  44. package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +0 -1
  45. package/front_end/panels/network/network-meta.ts +1 -2
  46. package/front_end/panels/performance_monitor/performance_monitor-meta.ts +0 -1
  47. package/front_end/panels/profiler/profiler-meta.ts +0 -1
  48. package/front_end/panels/protocol_monitor/protocol_monitor-meta.ts +0 -1
  49. package/front_end/panels/screencast/screencast-meta.ts +0 -1
  50. package/front_end/panels/security/security-meta.ts +0 -1
  51. package/front_end/panels/sensors/sensors-meta.ts +0 -1
  52. package/front_end/panels/settings/emulation/emulation-meta.ts +0 -1
  53. package/front_end/panels/settings/settings-meta.ts +0 -1
  54. package/front_end/panels/sources/sources-meta.ts +1 -2
  55. package/front_end/panels/timeline/timeline-meta.ts +2 -4
  56. package/front_end/panels/web_audio/web_audio-meta.ts +0 -1
  57. package/front_end/panels/webauthn/webauthn-meta.ts +0 -1
  58. package/front_end/ui/components/docs/component_docs.ts +14 -0
  59. package/front_end/ui/components/docs/create_breadcrumbs.ts +1 -1
  60. package/front_end/ui/components/docs/toggle_dark_mode.ts +1 -0
  61. package/front_end/ui/components/docs/toggle_fonts.ts +2 -0
  62. package/front_end/ui/components/helpers/get-stylesheet.ts +0 -1
  63. package/front_end/ui/components/linear_memory_inspector/linear_memory_inspector-meta.ts +1 -2
  64. package/front_end/ui/components/tree_outline/TreeOutline.ts +63 -8
  65. package/front_end/ui/components/tree_outline/TreeOutlineUtils.ts +8 -6
  66. package/front_end/ui/legacy/SoftContextMenu.ts +1 -1
  67. package/front_end/ui/legacy/Treeoutline.ts +1 -1
  68. package/front_end/ui/legacy/UIUtils.ts +1 -1
  69. package/front_end/ui/legacy/components/inline_editor/CSSAngle.ts +1 -2
  70. package/front_end/ui/legacy/components/inline_editor/cssAngle.css +4 -0
  71. package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +2 -2
  72. package/front_end/ui/legacy/components/object_ui/object_ui-meta.ts +0 -1
  73. package/front_end/ui/legacy/components/perf_ui/perf_ui-meta.ts +0 -1
  74. package/front_end/ui/legacy/components/quick_open/quick_open-meta.ts +2 -3
  75. package/front_end/ui/legacy/components/source_frame/FontView.ts +3 -1
  76. package/front_end/ui/legacy/components/source_frame/ImageView.ts +3 -1
  77. package/front_end/ui/legacy/components/source_frame/JSONView.ts +3 -1
  78. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +2 -1
  79. package/front_end/ui/legacy/components/source_frame/XMLView.ts +5 -2
  80. package/package.json +1 -1
  81. package/scripts/check_gn.js +0 -35
  82. package/scripts/eslint_rules/lib/es_modules_import.js +15 -8
  83. package/scripts/eslint_rules/tests/es_modules_import_test.js +8 -0
  84. package/front_end/panels/layers/module.json +0 -4
  85. package/front_end/ui/legacy/components/source_frame/messagesPopover.css +0 -32
  86. package/front_end/ui/legacy/components/source_frame/module.json +0 -11
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
+ import * as i18n from '../../core/i18n/i18n.js';
6
7
  import * as Root from '../../core/root/root.js';
7
8
  import * as SDK from '../../core/sdk/sdk.js';
8
9
  import * as Workspace from '../../models/workspace/workspace.js';
@@ -10,10 +11,8 @@ import * as ObjectUI from '../../ui/legacy/components/object_ui/object_ui.js';
10
11
  import * as QuickOpen from '../../ui/legacy/components/quick_open/quick_open.js';
11
12
  import * as UI from '../../ui/legacy/legacy.js';
12
13
 
13
- // eslint-disable-next-line rulesdir/es_modules_import
14
14
  import type * as Sources from './sources.js';
15
15
 
16
- import * as i18n from '../../core/i18n/i18n.js';
17
16
  const UIStrings = {
18
17
  /**
19
18
  *@description Command for showing the 'Sources' tool
@@ -4,13 +4,11 @@
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
6
  import * as UI from '../../ui/legacy/legacy.js';
7
+ import type * as Profiler from '../profiler/profiler.js';
8
+ import * as i18n from '../../core/i18n/i18n.js';
7
9
 
8
- // eslint-disable-next-line rulesdir/es_modules_import
9
10
  import type * as Timeline from './timeline.js';
10
11
 
11
- import type * as Profiler from '../profiler/profiler.js';
12
-
13
- import * as i18n from '../../core/i18n/i18n.js';
14
12
  const UIStrings = {
15
13
  /**
16
14
  *@description Text for the performance of something
@@ -5,7 +5,6 @@
5
5
  import * as i18n from '../../core/i18n/i18n.js';
6
6
  import * as UI from '../../ui/legacy/legacy.js';
7
7
 
8
- // eslint-disable-next-line rulesdir/es_modules_import
9
8
  import type * as WebAudio from './web_audio.js';
10
9
 
11
10
  const UIStrings = {
@@ -6,7 +6,6 @@ import * as i18n from '../../core/i18n/i18n.js';
6
6
  import * as Root from '../../core/root/root.js';
7
7
  import * as UI from '../../ui/legacy/legacy.js';
8
8
 
9
- // eslint-disable-next-line rulesdir/es_modules_import
10
9
  import type * as Webauthn from './webauthn.js';
11
10
 
12
11
  const UIStrings = {
@@ -12,3 +12,17 @@ import * as ToggleFonts from './toggle_fonts.js';
12
12
  ToggleDarkMode.init();
13
13
  CreateBreadcrumbs.init();
14
14
  ToggleFonts.init();
15
+
16
+ // This can be used by tests to hide the UI elements that are part of the component docs interface.
17
+ // E.g., this is useful for screenshot tests.
18
+ window.addEventListener('hidecomponentdocsui', () => {
19
+ for (const node of document.querySelectorAll('.component-docs-ui')) {
20
+ (node as HTMLElement).style.display = 'none';
21
+ }
22
+ });
23
+
24
+ window.addEventListener('showcomponentdocsui', () => {
25
+ for (const node of document.querySelectorAll('.component-docs-ui')) {
26
+ (node as HTMLElement).style.display = '';
27
+ }
28
+ });
@@ -32,7 +32,7 @@ export function init(): void {
32
32
  }
33
33
  </style>
34
34
 
35
- <ul class="docs-breadcrumbs">
35
+ <ul class="docs-breadcrumbs component-docs-ui">
36
36
  <li><a href="/">Index</a></li>
37
37
  <li><a href=".">All component examples</a></li>
38
38
  </ul>`, container);
@@ -16,6 +16,7 @@ export function init(): void {
16
16
  window.addEventListener('load', () => {
17
17
  const button = document.createElement('button');
18
18
  button.innerText = 'Toggle light/dark mode';
19
+ button.className = 'component-docs-ui';
19
20
 
20
21
  button.style.position = 'fixed';
21
22
  button.style.bottom = '10px';
@@ -14,6 +14,7 @@ export function init(): void {
14
14
  // we want a single font-family to be used by the tests.
15
15
  if (urlParams.has('fontFamily')) {
16
16
  const div = document.createElement('div');
17
+ div.className = 'component-docs-ui';
17
18
  div.style.position = 'fixed';
18
19
  div.style.bottom = '10px';
19
20
  div.style.right = '230px';
@@ -30,6 +31,7 @@ export function init(): void {
30
31
 
31
32
  document.body.classList.add(PLATFORM_LINUX_CLASS);
32
33
  const button = document.createElement('button');
34
+ button.className = 'component-docs-ui';
33
35
 
34
36
  const loop = [
35
37
  PLATFORM_LINUX_CLASS,
@@ -42,5 +42,4 @@ export function legacyGetStyleSheets(path: string): CSSStyleSheet[] {
42
42
  */
43
43
  export const CSS_RESOURCES_TO_LOAD_INTO_RUNTIME = [
44
44
  'panels/application/serviceWorkerUpdateCycleView.css',
45
- 'ui/legacy/components/source_frame/jsonView.css',
46
45
  ];
@@ -2,12 +2,11 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ import * as i18n from '../../../core/i18n/i18n.js';
5
6
  import * as UI from '../../legacy/legacy.js';
6
7
 
7
- // eslint-disable-next-line rulesdir/es_modules_import
8
8
  import type * as LinearMemoryInspector from './linear_memory_inspector.js';
9
9
 
10
- import * as i18n from '../../../core/i18n/i18n.js';
11
10
  const UIStrings = {
12
11
  /**
13
12
  *@description Title of the Linear Memory Inspector tool
@@ -10,7 +10,7 @@ import * as Coordinator from '../render_coordinator/render_coordinator.js';
10
10
 
11
11
  import treeOutlineStyles from './treeOutline.css.js';
12
12
 
13
- import type {TreeNode, TreeNodeWithChildren} from './TreeOutlineUtils.js';
13
+ import type {TreeNodeId, TreeNode, TreeNodeWithChildren} from './TreeOutlineUtils.js';
14
14
  import {findNextNodeForTreeOutlineKeyboardNavigation, getNodeChildren, getPathToTreeNode, isExpandableNode, trackDOMNodeToTreeNode} from './TreeOutlineUtils.js';
15
15
 
16
16
  const coordinator = Coordinator.RenderCoordinator.RenderCoordinator.instance();
@@ -24,6 +24,7 @@ export interface TreeOutlineData<TreeNodeDataType> {
24
24
  * cause issues in the TreeOutline.
25
25
  */
26
26
  tree: readonly TreeNode<TreeNodeDataType>[];
27
+ filter?: (node: TreeNodeDataType) => FilterOption;
27
28
  }
28
29
 
29
30
  export function defaultRenderer(node: TreeNode<string>): LitHtml.TemplateResult {
@@ -66,6 +67,19 @@ export class ItemMouseOutEvent<TreeNodeDataType> extends Event {
66
67
  }
67
68
  }
68
69
 
70
+ /**
71
+ *
72
+ * The tree can be filtered by providing a custom filter function.
73
+ * The filter is applied on every node when constructing the tree
74
+ * and proceeds as follows:
75
+ * - If the filter return SHOW for a node, the node is included in the tree.
76
+ * - If the filter returns FLATTEN, the node is ignored but its subtree is included.
77
+ */
78
+ export const enum FilterOption {
79
+ SHOW = 'SHOW',
80
+ FLATTEN = 'FLATTEN',
81
+ }
82
+
69
83
  export class TreeOutline<TreeNodeDataType> extends HTMLElement {
70
84
  static readonly litTagName = LitHtml.literal`devtools-tree-outline`;
71
85
  private readonly shadow = this.attachShadow({mode: 'open'});
@@ -79,7 +93,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
79
93
  * know for sure when that node will be rendered. This variable tracks the
80
94
  * node that we want focused but may not yet have been rendered.
81
95
  */
82
- private nodePendingFocus: TreeNode<TreeNodeDataType>|null = null;
96
+ private nodeIdPendingFocus: TreeNodeId|null = null;
83
97
  private selectedTreeNode: TreeNode<TreeNodeDataType>|null = null;
84
98
  private defaultRenderer =
85
99
  (node: TreeNode<TreeNodeDataType>, _state: {isExpanded: boolean}): LitHtml.TemplateResult => {
@@ -91,6 +105,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
91
105
  }
92
106
  return LitHtml.html`${String(node.treeNodeData)}`;
93
107
  };
108
+ private nodeFilter?: ((node: TreeNodeDataType) => FilterOption);
94
109
 
95
110
  /**
96
111
  * scheduledRender = render() has been called and scheduled a render.
@@ -134,6 +149,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
134
149
  set data(data: TreeOutlineData<TreeNodeDataType>) {
135
150
  this.defaultRenderer = data.defaultRenderer;
136
151
  this.treeData = data.tree;
152
+ this.nodeFilter = data.filter;
137
153
  if (!this.hasRenderedAtLeastOnce) {
138
154
  this.selectedTreeNode = this.treeData[0];
139
155
  }
@@ -154,10 +170,17 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
154
170
  * Takes a TreeNode, expands the outline to reveal it, and focuses it.
155
171
  */
156
172
  async expandToAndSelectTreeNode(targetTreeNode: TreeNode<TreeNodeDataType>): Promise<void> {
157
- const pathToTreeNode = await getPathToTreeNode(this.treeData, targetTreeNode);
173
+ return this.expandToAndSelectTreeNodeId(targetTreeNode.id);
174
+ }
175
+
176
+ /**
177
+ * Takes a TreeNode ID, expands the outline to reveal it, and focuses it.
178
+ */
179
+ async expandToAndSelectTreeNodeId(targetTreeNodeId: TreeNodeId): Promise<void> {
180
+ const pathToTreeNode = await getPathToTreeNode(this.treeData, targetTreeNodeId);
158
181
 
159
182
  if (pathToTreeNode === null) {
160
- throw new Error(`Could not find node with id ${targetTreeNode.id} in the tree.`);
183
+ throw new Error(`Could not find node with id ${targetTreeNodeId} in the tree.`);
161
184
  }
162
185
  pathToTreeNode.forEach((node, index) => {
163
186
  // We don't expand the very last node, which was the target node.
@@ -167,10 +190,26 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
167
190
  });
168
191
 
169
192
  // Mark the node as pending focus so when it is rendered into the DOM we can focus it
170
- this.nodePendingFocus = targetTreeNode;
193
+ this.nodeIdPendingFocus = targetTreeNodeId;
171
194
  await this.render();
172
195
  }
173
196
 
197
+ /**
198
+ * Takes a list of TreeNode IDs and expands the corresponding nodes.
199
+ */
200
+ expandNodeIds(nodeIds: TreeNodeId[]): Promise<void> {
201
+ nodeIds.forEach(id => this.nodeExpandedMap.set(id, true));
202
+ return this.render();
203
+ }
204
+
205
+ /**
206
+ * Takes a TreeNode ID and focuses the corresponding node.
207
+ */
208
+ focusNodeId(nodeId: TreeNodeId): Promise<void> {
209
+ this.nodeIdPendingFocus = nodeId;
210
+ return this.render();
211
+ }
212
+
174
213
  async collapseChildrenOfNode(domNode: HTMLLIElement): Promise<void> {
175
214
  const treeNode = this.domNodeToTreeNodeMap.get(domNode);
176
215
  if (!treeNode) {
@@ -208,7 +247,22 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
208
247
  }
209
248
 
210
249
  private async fetchNodeChildren(node: TreeNodeWithChildren<TreeNodeDataType>): Promise<TreeNode<TreeNodeDataType>[]> {
211
- return getNodeChildren(node);
250
+ const children = await getNodeChildren(node);
251
+ if (!this.nodeFilter) {
252
+ return children;
253
+ }
254
+ const filteredChildren = [];
255
+ for (const child of children) {
256
+ const filtering = this.nodeFilter(child.treeNodeData);
257
+ // We always include the selected node in the tree, regardless of its filtering status.
258
+ if (filtering === FilterOption.SHOW || this.isSelectedNode(child) || child.id === this.nodeIdPendingFocus) {
259
+ filteredChildren.push(child);
260
+ } else if (filtering === FilterOption.FLATTEN && isExpandableNode(child)) {
261
+ const grandChildren = await this.fetchNodeChildren(child);
262
+ filteredChildren.push(...grandChildren);
263
+ }
264
+ }
265
+ return filteredChildren;
212
266
  }
213
267
 
214
268
  private setNodeExpandedState(node: TreeNode<TreeNodeDataType>, newExpandedState: boolean): void {
@@ -337,7 +391,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
337
391
  }
338
392
 
339
393
  private focusPendingNode(domNode: HTMLLIElement): void {
340
- this.nodePendingFocus = null;
394
+ this.nodeIdPendingFocus = null;
341
395
  this.focusTreeNode(domNode);
342
396
  }
343
397
 
@@ -411,7 +465,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
411
465
  return;
412
466
  }
413
467
 
414
- if (this.nodePendingFocus && node.id === this.nodePendingFocus.id) {
468
+ if (this.nodeIdPendingFocus && node.id === this.nodeIdPendingFocus) {
415
469
  this.focusPendingNode(domNode);
416
470
  }
417
471
  })}
@@ -433,6 +487,7 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
433
487
  `;
434
488
  // clang-format on
435
489
  }
490
+
436
491
  private async render(): Promise<void> {
437
492
  if (this.scheduledRender) {
438
493
  // If we are already rendering, don't render again immediately, but
@@ -4,10 +4,12 @@
4
4
  import * as Platform from '../../../core/platform/platform.js';
5
5
  import * as LitHtml from '../../lit-html/lit-html.js';
6
6
 
7
+ export type TreeNodeId = string;
8
+
7
9
  interface BaseTreeNode<TreeNodeDataType> {
8
10
  treeNodeData: TreeNodeDataType;
9
11
  renderer?: (node: TreeNode<TreeNodeDataType>, state: {isExpanded: boolean}) => LitHtml.TemplateResult;
10
- id: string;
12
+ id: TreeNodeId;
11
13
  }
12
14
 
13
15
  export interface TreeNodeWithChildren<TreeNodeDataType> extends BaseTreeNode<TreeNodeDataType> {
@@ -196,10 +198,10 @@ export const getNodeChildren =
196
198
  * And you look for F, you'll get back [A, D, F]
197
199
  */
198
200
  export const getPathToTreeNode =
199
- async<TreeNodeDataType>(tree: readonly TreeNode<TreeNodeDataType>[], nodeToFind: TreeNode<TreeNodeDataType>):
201
+ async<TreeNodeDataType>(tree: readonly TreeNode<TreeNodeDataType>[], nodeIdToFind: TreeNodeId):
200
202
  Promise<TreeNode<TreeNodeDataType>[]|null> => {
201
203
  for (const rootNode of tree) {
202
- const foundPathOrNull = await getPathToTreeNodeRecursively(rootNode, nodeToFind, [rootNode]);
204
+ const foundPathOrNull = await getPathToTreeNodeRecursively(rootNode, nodeIdToFind, [rootNode]);
203
205
  if (foundPathOrNull !== null) {
204
206
  return foundPathOrNull;
205
207
  }
@@ -208,16 +210,16 @@ export const getPathToTreeNode =
208
210
  };
209
211
 
210
212
  const getPathToTreeNodeRecursively = async<TreeNodeDataType>(
211
- currentNode: TreeNode<TreeNodeDataType>, nodeToFind: TreeNode<TreeNodeDataType>,
213
+ currentNode: TreeNode<TreeNodeDataType>, nodeIdToFind: TreeNodeId,
212
214
  pathToNode: TreeNode<TreeNodeDataType>[]): Promise<TreeNode<TreeNodeDataType>[]|null> => {
213
- if (currentNode.id === nodeToFind.id) {
215
+ if (currentNode.id === nodeIdToFind) {
214
216
  return pathToNode;
215
217
  }
216
218
 
217
219
  if (currentNode.children) {
218
220
  const children = await getNodeChildren(currentNode);
219
221
  for (const child of children) {
220
- const foundPathOrNull = await getPathToTreeNodeRecursively(child, nodeToFind, [...pathToNode, child]);
222
+ const foundPathOrNull = await getPathToTreeNodeRecursively(child, nodeIdToFind, [...pathToNode, child]);
221
223
  if (foundPathOrNull !== null) {
222
224
  return foundPathOrNull;
223
225
  }
@@ -35,7 +35,7 @@ import type * as Platform from '../../core/platform/platform.js';
35
35
  import * as ARIAUtils from './ARIAUtils.js';
36
36
  import {AnchorBehavior, GlassPane, MarginBehavior, PointerEventsBehavior, SizeBehavior} from './GlassPane.js';
37
37
  import {Icon} from './Icon.js';
38
- import * as ThemeSupport from './theme_support/theme_support.js'; // eslint-disable-line rulesdir/es_modules_import
38
+ import * as ThemeSupport from './theme_support/theme_support.js';
39
39
  import {createTextChild, ElementFocusRestorer} from './UIUtils.js';
40
40
  import softContextMenuStyles from './softContextMenu.css.legacy.js';
41
41
 
@@ -399,7 +399,7 @@ export class TreeOutlineInShadow extends TreeOutline {
399
399
  this.renderSelection = true;
400
400
  }
401
401
 
402
- registerRequiredCSS(cssFile: string): void {
402
+ registerRequiredCSS(cssFile: string|{cssContent: string}): void {
403
403
  Utils.appendStyle(this.shadowRoot, cssFile);
404
404
  }
405
405
 
@@ -46,7 +46,7 @@ import {Size} from './Geometry.js';
46
46
  import {GlassPane, PointerEventsBehavior, SizeBehavior} from './GlassPane.js';
47
47
  import {Icon} from './Icon.js';
48
48
  import {KeyboardShortcut} from './KeyboardShortcut.js';
49
- import * as ThemeSupport from './theme_support/theme_support.js'; // eslint-disable-line rulesdir/es_modules_import
49
+ import * as ThemeSupport from './theme_support/theme_support.js';
50
50
  import * as Utils from './utils/utils.js';
51
51
 
52
52
  import type {ToolbarButton} from './Toolbar.js';
@@ -222,8 +222,7 @@ export class CSSAngle extends HTMLElement {
222
222
  .data=${{
223
223
  angle: this.angle,
224
224
  } as CSSAngleSwatchData}>
225
- </${CSSAngleSwatch.litTagName}><slot></slot>
226
- </div>
225
+ </${CSSAngleSwatch.litTagName}><slot></slot></div>
227
226
  ${this.popoverOpen ? this.renderPopover() : null}
228
227
  </div>
229
228
  `, this.shadow, {
@@ -22,3 +22,7 @@ devtools-css-angle-editor {
22
22
  position: fixed;
23
23
  z-index: 2;
24
24
  }
25
+
26
+ .preview {
27
+ display: inline-block;
28
+ }
@@ -36,7 +36,7 @@ export class JavaScriptREPL {
36
36
 
37
37
  static async evaluateAndBuildPreview(
38
38
  text: string, throwOnSideEffect: boolean, replMode: boolean, timeout?: number, allowErrors?: boolean,
39
- objectGroup?: string): Promise<{
39
+ objectGroup?: string, awaitPromise: boolean = false): Promise<{
40
40
  preview: DocumentFragment,
41
41
  result: SDK.RuntimeModel.EvaluationResult|null,
42
42
  }> {
@@ -60,7 +60,7 @@ export class JavaScriptREPL {
60
60
  returnByValue: undefined,
61
61
  allowUnsafeEvalBlockedByCSP: undefined,
62
62
  };
63
- const result = await executionContext.evaluate(options, false /* userGesture */, false /* awaitPromise */);
63
+ const result = await executionContext.evaluate(options, false /* userGesture */, awaitPromise);
64
64
  const preview = JavaScriptREPL.buildEvaluationPreview(result, allowErrors);
65
65
  return {preview, result};
66
66
  }
@@ -5,7 +5,6 @@
5
5
  import * as SDK from '../../../../core/sdk/sdk.js';
6
6
  import * as UI from '../../legacy.js';
7
7
 
8
- // eslint-disable-next-line rulesdir/es_modules_import
9
8
  import type * as ObjectUI from './object_ui.js';
10
9
 
11
10
  let loadedObjectUIModule: (typeof ObjectUI|undefined);
@@ -7,7 +7,6 @@ import * as i18n from '../../../../core/i18n/i18n.js';
7
7
  import * as Root from '../../../../core/root/root.js';
8
8
  import * as UI from '../../legacy.js';
9
9
 
10
- // eslint-disable-next-line rulesdir/es_modules_import
11
10
  import type * as PerfUI from './perf_ui.js';
12
11
 
13
12
  const UIStrings = {
@@ -5,6 +5,8 @@
5
5
  import * as i18n from '../../../../core/i18n/i18n.js';
6
6
  import * as UI from '../../legacy.js';
7
7
 
8
+ import type * as QuickOpen from './quick_open.js';
9
+
8
10
  const UIStrings = {
9
11
  /**
10
12
  *@description Title of action that opens a file
@@ -18,9 +20,6 @@ const UIStrings = {
18
20
  const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/quick_open/quick_open-meta.ts', UIStrings);
19
21
  const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
20
22
 
21
- // eslint-disable-next-line rulesdir/es_modules_import
22
- import type * as QuickOpen from './quick_open.js';
23
-
24
23
  let loadedQuickOpenModule: (typeof QuickOpen|undefined);
25
24
 
26
25
  async function loadQuickOpenModule(): Promise<typeof QuickOpen> {
@@ -35,6 +35,8 @@ import * as Platform from '../../../../core/platform/platform.js';
35
35
  import * as TextUtils from '../../../../models/text_utils/text_utils.js';
36
36
  import * as UI from '../../legacy.js';
37
37
 
38
+ import fontViewStyles from './fontView.css.legacy.js';
39
+
38
40
  const UIStrings = {
39
41
  /**
40
42
  *@description Text that appears on a button for the font resource type filter.
@@ -60,7 +62,7 @@ export class FontView extends UI.View.SimpleView {
60
62
  constructor(mimeType: string, contentProvider: TextUtils.ContentProvider.ContentProvider) {
61
63
  super(i18nString(UIStrings.font));
62
64
  // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
63
- this.registerRequiredCSS('ui/legacy/components/source_frame/fontView.css');
65
+ this.registerRequiredCSS(fontViewStyles);
64
66
  this.element.classList.add('font-view');
65
67
  this.url = contentProvider.contentURL();
66
68
  UI.ARIAUtils.setAccessibleName(this.element, i18nString(UIStrings.previewOfFontFromS, {PH1: this.url}));
@@ -38,6 +38,8 @@ import * as TextUtils from '../../../../models/text_utils/text_utils.js';
38
38
  import * as Workspace from '../../../../models/workspace/workspace.js';
39
39
  import * as UI from '../../legacy.js';
40
40
 
41
+ import imageViewStyles from './imageView.css.legacy.js';
42
+
41
43
  const UIStrings = {
42
44
  /**
43
45
  *@description Text in Image View of the Sources panel
@@ -97,7 +99,7 @@ export class ImageView extends UI.View.SimpleView {
97
99
  constructor(mimeType: string, contentProvider: TextUtils.ContentProvider.ContentProvider) {
98
100
  super(i18nString(UIStrings.image));
99
101
  // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
100
- this.registerRequiredCSS('ui/legacy/components/source_frame/imageView.css');
102
+ this.registerRequiredCSS(imageViewStyles);
101
103
  this.element.tabIndex = -1;
102
104
  this.element.classList.add('image-view');
103
105
  this.url = contentProvider.contentURL();
@@ -34,6 +34,8 @@ import * as SDK from '../../../../core/sdk/sdk.js';
34
34
  import * as UI from '../../legacy.js';
35
35
  import * as ObjectUI from '../object_ui/object_ui.js';
36
36
 
37
+ import jsonViewStyles from './jsonView.css.legacy.js';
38
+
37
39
  const UIStrings = {
38
40
  /**
39
41
  *@description Text to find an item
@@ -55,7 +57,7 @@ export class JSONView extends UI.Widget.VBox implements UI.SearchableView.Search
55
57
  super();
56
58
  this.initialized = false;
57
59
  // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
58
- this.registerRequiredCSS('ui/legacy/components/source_frame/jsonView.css');
60
+ this.registerRequiredCSS(jsonViewStyles);
59
61
  this.parsedJSON = parsedJSON;
60
62
  this.startCollapsed = Boolean(startCollapsed);
61
63
  this.element.classList.add('json-view');
@@ -37,6 +37,7 @@ import * as UI from '../../legacy.js';
37
37
 
38
38
  import type {SourceFrameOptions} from './SourceFrame.js';
39
39
  import {SourceFrameImpl} from './SourceFrame.js';
40
+ import resourceSourceFrameStyles from './resourceSourceFrame.css.legacy.js';
40
41
 
41
42
  const UIStrings = {
42
43
  /**
@@ -84,7 +85,7 @@ export class SearchableContainer extends UI.Widget.VBox {
84
85
  constructor(resource: TextUtils.ContentProvider.ContentProvider, contentType: string, autoPrettyPrint?: boolean) {
85
86
  super(true);
86
87
  // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
87
- this.registerRequiredCSS('ui/legacy/components/source_frame/resourceSourceFrame.css');
88
+ this.registerRequiredCSS(resourceSourceFrameStyles);
88
89
  const sourceFrame = new ResourceSourceFrame(resource, contentType);
89
90
  this.sourceFrame = sourceFrame;
90
91
  const canPrettyPrint =
@@ -7,6 +7,9 @@ import * as Platform from '../../../../core/platform/platform.js';
7
7
  import * as TextUtils from '../../../../models/text_utils/text_utils.js';
8
8
  import * as UI from '../../legacy.js';
9
9
 
10
+ import xmlTreeStyles from './xmlTree.css.legacy.js';
11
+ import xmlViewStyles from './xmlView.css.legacy.js';
12
+
10
13
  const UIStrings = {
11
14
  /**
12
15
  *@description Text to find an item
@@ -26,11 +29,11 @@ export class XMLView extends UI.Widget.Widget implements UI.SearchableView.Searc
26
29
  constructor(parsedXML: Document) {
27
30
  super(true);
28
31
  // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
29
- this.registerRequiredCSS('ui/legacy/components/source_frame/xmlView.css');
32
+ this.registerRequiredCSS(xmlViewStyles);
30
33
  this.contentElement.classList.add('shadow-xml-view', 'source-code');
31
34
  this.treeOutline = new UI.TreeOutline.TreeOutlineInShadow();
32
35
  // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
33
- this.treeOutline.registerRequiredCSS('ui/legacy/components/source_frame/xmlTree.css');
36
+ this.treeOutline.registerRequiredCSS(xmlTreeStyles);
34
37
  this.contentElement.appendChild(this.treeOutline.element);
35
38
  this.currentSearchFocusIndex = 0;
36
39
  this.currentSearchTreeElements = [];
package/package.json CHANGED
@@ -55,5 +55,5 @@
55
55
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
56
56
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
57
57
  },
58
- "version": "1.0.943017"
58
+ "version": "1.0.943182"
59
59
  }
@@ -17,40 +17,6 @@ const gnPath = path.resolve(__dirname, '..', 'BUILD.gn');
17
17
  const gnFile = fs.readFileSync(gnPath, 'utf-8');
18
18
  const gnLines = gnFile.split('\n');
19
19
 
20
- /**
21
- * Ensures that generated module files are in the right list in BUILD.gn.
22
- * This is primarily to avoid remote modules from accidentally getting
23
- * bundled with the main Chrome binary.
24
- */
25
- function checkNonAutostartNonRemoteModules() {
26
- const errors = [];
27
- const gnVariable = 'non_autostart_non_remote_modules';
28
- const lines = selectGNLines(`${gnVariable} = [`, ']');
29
- if (!lines.length) {
30
- return [
31
- 'Could not identify non-autostart non-remote modules in gn file',
32
- 'Please look at: ' + __filename,
33
- ];
34
- }
35
- const text = lines.join('\n');
36
- const modules = manifestModules.filter(m => m.type !== 'autostart').map(m => m.name);
37
-
38
- const missingModules = modules.filter(m => !text.includes(`${m}/${path.basename(m)}_module.js`));
39
- if (missingModules.length) {
40
- errors.push(`Check that you've included [${missingModules.join(', ')}] modules in: ` + gnVariable);
41
- }
42
-
43
- // e.g. "lighthouse/lighthouse_module.js" => "lighthouse"
44
- const mapLineToModuleName = line => path.dirname(line.substring(1));
45
-
46
- const extraneousModules = lines.map(mapLineToModuleName).filter(module => !modules.includes(module));
47
- if (extraneousModules.length) {
48
- errors.push(`Found extraneous modules [${extraneousModules.join(', ')}] in: ` + gnVariable);
49
- }
50
-
51
- return errors;
52
- }
53
-
54
20
  /**
55
21
  * Ensures that all source files (according to the various module.json files) are
56
22
  * listed in BUILD.gn.
@@ -139,7 +105,6 @@ function selectGNLines(startLine, endLine, linesToCheck = gnLines) {
139
105
 
140
106
  function main() {
141
107
  const errors = [
142
- ...checkNonAutostartNonRemoteModules(),
143
108
  ...checkAllDevToolsFiles(),
144
109
  ];
145
110
  if (errors.length) {
@@ -90,14 +90,21 @@ function checkStarImport(context, node, importPath, importPathForErrorMessage, i
90
90
  const invalidCrossFolderUsage = !isSameFolder && !isModuleEntrypoint(exportingFileName);
91
91
 
92
92
  if (invalidSameFolderUsage) {
93
- context.report({
94
- node,
95
- message:
96
- 'Incorrect same-namespace import: "{{importPathForErrorMessage}}". Use "import { Symbol } from \'./relative-file.js\';" instead.',
97
- data: {
98
- importPathForErrorMessage,
99
- },
100
- });
93
+ // Meta files import their entrypoints and are considered separate entrypoints.
94
+ // Additionally, any file ending with `-entrypoint.ts` is considered an entrypoint as well.
95
+ // Therefore, they are allowed to import using a same-namespace star-import.
96
+ const importingFileIsEntrypoint =
97
+ importingFileName.endsWith('-entrypoint.ts') || importingFileName.endsWith('-meta.ts');
98
+ if (!importingFileIsEntrypoint) {
99
+ context.report({
100
+ node,
101
+ message:
102
+ 'Incorrect same-namespace import: "{{importPathForErrorMessage}}". Use "import { Symbol } from \'./relative-file.js\';" instead.',
103
+ data: {
104
+ importPathForErrorMessage,
105
+ },
106
+ });
107
+ }
101
108
  }
102
109
 
103
110
  if (invalidCrossFolderUsage) {
@@ -106,6 +106,14 @@ ruleTester.run('es_modules_import', rule, {
106
106
  code: 'import * as ConsoleCounters from \'../console_counters/console_counters.js\';',
107
107
  filename: 'front_end/panels/console/ConsoleView.ts',
108
108
  },
109
+ {
110
+ code: 'import * as Elements from \'./elements.js\';',
111
+ filename: 'front_end/panels/elements/elements-meta.ts',
112
+ },
113
+ {
114
+ code: 'import * as Elements from \'./elements.js\';',
115
+ filename: 'front_end/panels/elements/elements-entrypoint.ts',
116
+ },
109
117
  // Tests are allowed to import from front_end
110
118
  {
111
119
  code: 'import * as UI from \'../../../front_end/ui/ui.js\';',