chrome-devtools-frontend 1.0.995629 → 1.0.997048

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 (119) hide show
  1. package/AUTHORS +1 -0
  2. package/front_end/core/i18n/locales/af.json +96 -42
  3. package/front_end/core/i18n/locales/am.json +97 -43
  4. package/front_end/core/i18n/locales/ar.json +95 -41
  5. package/front_end/core/i18n/locales/as.json +95 -41
  6. package/front_end/core/i18n/locales/az.json +96 -42
  7. package/front_end/core/i18n/locales/be.json +124 -70
  8. package/front_end/core/i18n/locales/bg.json +96 -42
  9. package/front_end/core/i18n/locales/bn.json +95 -41
  10. package/front_end/core/i18n/locales/bs.json +95 -41
  11. package/front_end/core/i18n/locales/ca.json +96 -42
  12. package/front_end/core/i18n/locales/cs.json +95 -41
  13. package/front_end/core/i18n/locales/cy.json +95 -41
  14. package/front_end/core/i18n/locales/da.json +97 -43
  15. package/front_end/core/i18n/locales/de.json +96 -42
  16. package/front_end/core/i18n/locales/el.json +95 -41
  17. package/front_end/core/i18n/locales/en-GB.json +95 -41
  18. package/front_end/core/i18n/locales/en-US.json +32 -5
  19. package/front_end/core/i18n/locales/en-XL.json +32 -5
  20. package/front_end/core/i18n/locales/es-419.json +95 -41
  21. package/front_end/core/i18n/locales/es.json +101 -47
  22. package/front_end/core/i18n/locales/et.json +95 -41
  23. package/front_end/core/i18n/locales/eu.json +100 -46
  24. package/front_end/core/i18n/locales/fa.json +104 -50
  25. package/front_end/core/i18n/locales/fi.json +95 -41
  26. package/front_end/core/i18n/locales/fil.json +95 -41
  27. package/front_end/core/i18n/locales/fr-CA.json +96 -42
  28. package/front_end/core/i18n/locales/fr.json +95 -41
  29. package/front_end/core/i18n/locales/gl.json +104 -50
  30. package/front_end/core/i18n/locales/gu.json +95 -41
  31. package/front_end/core/i18n/locales/he.json +95 -41
  32. package/front_end/core/i18n/locales/hi.json +98 -44
  33. package/front_end/core/i18n/locales/hr.json +96 -42
  34. package/front_end/core/i18n/locales/hu.json +96 -42
  35. package/front_end/core/i18n/locales/hy.json +95 -41
  36. package/front_end/core/i18n/locales/id.json +97 -43
  37. package/front_end/core/i18n/locales/is.json +95 -41
  38. package/front_end/core/i18n/locales/it.json +96 -42
  39. package/front_end/core/i18n/locales/ja.json +95 -41
  40. package/front_end/core/i18n/locales/ka.json +95 -41
  41. package/front_end/core/i18n/locales/kk.json +98 -44
  42. package/front_end/core/i18n/locales/km.json +95 -41
  43. package/front_end/core/i18n/locales/kn.json +96 -42
  44. package/front_end/core/i18n/locales/ko.json +96 -42
  45. package/front_end/core/i18n/locales/ky.json +97 -43
  46. package/front_end/core/i18n/locales/lo.json +96 -42
  47. package/front_end/core/i18n/locales/lt.json +95 -41
  48. package/front_end/core/i18n/locales/lv.json +95 -41
  49. package/front_end/core/i18n/locales/mk.json +98 -44
  50. package/front_end/core/i18n/locales/ml.json +96 -42
  51. package/front_end/core/i18n/locales/mn.json +96 -42
  52. package/front_end/core/i18n/locales/mr.json +95 -41
  53. package/front_end/core/i18n/locales/ms.json +95 -41
  54. package/front_end/core/i18n/locales/my.json +95 -41
  55. package/front_end/core/i18n/locales/ne.json +100 -46
  56. package/front_end/core/i18n/locales/nl.json +99 -45
  57. package/front_end/core/i18n/locales/no.json +95 -41
  58. package/front_end/core/i18n/locales/or.json +98 -44
  59. package/front_end/core/i18n/locales/pa.json +95 -41
  60. package/front_end/core/i18n/locales/pl.json +95 -41
  61. package/front_end/core/i18n/locales/pt-PT.json +95 -41
  62. package/front_end/core/i18n/locales/pt.json +98 -44
  63. package/front_end/core/i18n/locales/ro.json +96 -42
  64. package/front_end/core/i18n/locales/ru.json +115 -61
  65. package/front_end/core/i18n/locales/si.json +96 -42
  66. package/front_end/core/i18n/locales/sk.json +95 -41
  67. package/front_end/core/i18n/locales/sl.json +95 -41
  68. package/front_end/core/i18n/locales/sq.json +96 -42
  69. package/front_end/core/i18n/locales/sr-Latn.json +96 -42
  70. package/front_end/core/i18n/locales/sr.json +96 -42
  71. package/front_end/core/i18n/locales/sv.json +96 -42
  72. package/front_end/core/i18n/locales/sw.json +97 -43
  73. package/front_end/core/i18n/locales/ta.json +96 -42
  74. package/front_end/core/i18n/locales/te.json +108 -54
  75. package/front_end/core/i18n/locales/th.json +95 -41
  76. package/front_end/core/i18n/locales/tr.json +95 -41
  77. package/front_end/core/i18n/locales/uk.json +95 -41
  78. package/front_end/core/i18n/locales/ur.json +95 -41
  79. package/front_end/core/i18n/locales/uz.json +95 -41
  80. package/front_end/core/i18n/locales/vi.json +104 -50
  81. package/front_end/core/i18n/locales/zh-HK.json +96 -42
  82. package/front_end/core/i18n/locales/zh-TW.json +97 -43
  83. package/front_end/core/i18n/locales/zh.json +99 -45
  84. package/front_end/core/i18n/locales/zu.json +95 -41
  85. package/front_end/core/root/Runtime.ts +5 -0
  86. package/front_end/core/sdk/CSSMatchedStyles.ts +158 -33
  87. package/front_end/core/sdk/CSSMetadata.ts +1 -8
  88. package/front_end/core/sdk/DebuggerModel.ts +1 -1
  89. package/front_end/generated/InspectorBackendCommands.js +33 -2
  90. package/front_end/generated/protocol.ts +42 -7
  91. package/front_end/models/bindings/BreakpointManager.ts +12 -3
  92. package/front_end/models/issues_manager/DeprecationIssue.ts +3 -3
  93. package/front_end/panels/changes/ChangesView.ts +25 -10
  94. package/front_end/panels/elements/ElementsPanel.ts +7 -6
  95. package/front_end/panels/elements/StylesSidebarPane.ts +55 -21
  96. package/front_end/panels/elements/components/adornerSettingsPane.css +5 -0
  97. package/front_end/panels/elements/stylesSectionTree.css +5 -4
  98. package/front_end/panels/elements/stylesSidebarPane.css +1 -1
  99. package/front_end/panels/lighthouse/LighthouseController.ts +38 -7
  100. package/front_end/panels/lighthouse/LighthousePanel.ts +1 -1
  101. package/front_end/panels/lighthouse/LighthouseStartView.ts +15 -7
  102. package/front_end/panels/lighthouse/LighthouseStartViewFR.ts +77 -21
  103. package/front_end/panels/lighthouse/RadioSetting.ts +12 -6
  104. package/front_end/panels/lighthouse/lighthouseStartView.css +49 -2
  105. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +1 -0
  106. package/front_end/panels/security/SecurityPanel.ts +2 -2
  107. package/front_end/panels/sources/DebuggerPlugin.ts +6 -2
  108. package/front_end/panels/sources/SourcesPanel.ts +22 -6
  109. package/front_end/panels/sources/sources-legacy.ts +1 -1
  110. package/front_end/panels/sources/sources-meta.ts +61 -7
  111. package/front_end/ui/components/diff_view/diffView.css +2 -0
  112. package/front_end/ui/components/tree_outline/TreeOutline.ts +18 -7
  113. package/front_end/ui/legacy/SplitWidget.ts +17 -7
  114. package/front_end/ui/legacy/Toolbar.ts +5 -0
  115. package/front_end/ui/legacy/softDropDownButton.css +4 -0
  116. package/package.json +2 -1
  117. package/scripts/eslint_rules/lib/inline_type_imports.js +158 -0
  118. package/scripts/eslint_rules/tests/inline_type_imports_test.js +106 -0
  119. package/scripts/javascript_natives/index.js +1 -2
@@ -10,20 +10,32 @@ import {StartView} from './LighthouseStartView.js';
10
10
  import {Events} from './LighthouseController.js';
11
11
 
12
12
  const UIStrings = {
13
+ /**
14
+ * @description Text displayed as the title of a panel that can be used to audit a web page with Lighthouse.
15
+ */
16
+ generateLighthouseReport: 'Generate a Lighthouse report',
13
17
  /**
14
18
  * @description Text that refers to the Lighthouse mode
15
19
  */
16
20
  mode: 'Mode',
21
+ /**
22
+ * @description Title in the Lighthouse Start View for list of categories to run during audit
23
+ */
24
+ categories: 'Categories',
25
+ /**
26
+ * @description Title in the Lighthouse Start View for list of available start plugins
27
+ */
28
+ plugins: 'Plugins',
17
29
  /**
18
30
  * @description Label for a button to start analyzing a page navigation with Lighthouse
19
31
  */
20
- analyzeNavigation: 'Analyze navigation',
32
+ analyzeNavigation: 'Analyze page load',
21
33
  /**
22
34
  * @description Label for a button to start analyzing the current page state with Lighthouse
23
35
  */
24
- analyzeSnapshot: 'Analyze snapshot',
36
+ analyzeSnapshot: 'Analyze page state',
25
37
  /**
26
- * @description Label for a button that ends a Lighthouse timespan
38
+ * @description Label for a button that starts a Lighthouse mode that analyzes user interactions over a period of time.
27
39
  */
28
40
  startTimespan: 'Start timespan',
29
41
  };
@@ -35,31 +47,75 @@ export class StartViewFR extends StartView {
35
47
  protected render(): void {
36
48
  super.render();
37
49
  const fragment = UI.Fragment.Fragment.build`
38
- <div class="lighthouse-form-section">
39
- <div class="lighthouse-form-section-label">
40
- ${i18nString(UIStrings.mode)}
41
- </div>
42
- <div class="lighthouse-form-elements" $="mode-form-elements"></div>
50
+ <form class="lighthouse-start-view-fr">
51
+ <header class="hbox">
52
+ <div class="lighthouse-logo"></div>
53
+ <div class="lighthouse-title">${i18nString(UIStrings.generateLighthouseReport)}</div>
54
+ <div class="lighthouse-start-button-container">${this.startButton}</div>
55
+ </header>
56
+ <div $="help-text" class="lighthouse-help-text hidden"></div>
57
+ <div class="lighthouse-options hbox">
58
+ <div class="lighthouse-form-section">
59
+ <div class="lighthouse-form-elements" $="mode-form-elements"></div>
60
+ </div>
61
+ <div class="lighthouse-form-section">
62
+ <div class="lighthouse-form-elements" $="device-type-form-elements"></div>
63
+ </div>
64
+ <div class="lighthouse-form-categories">
65
+ <div class="lighthouse-form-section">
66
+ <div class="lighthouse-form-section-label">${i18nString(UIStrings.categories)}</div>
67
+ <div class="lighthouse-form-elements" $="categories-form-elements"></div>
68
+ </div>
69
+ <div class="lighthouse-form-section">
70
+ <div class="lighthouse-form-section-label">
71
+ <div class="lighthouse-icon-label">${i18nString(UIStrings.plugins)}</div>
72
+ </div>
73
+ <div class="lighthouse-form-elements" $="plugins-form-elements"></div>
74
+ </div>
75
+ </div>
43
76
  </div>
77
+ <div $="warning-text" class="lighthouse-warning-text hidden"></div>
78
+ </form>
44
79
  `;
45
80
 
81
+ this.helpText = fragment.$('help-text');
82
+ this.warningText = fragment.$('warning-text');
83
+
84
+ // The previous radios are removed later and don't exist on the new fragment yet.
85
+ this.populateFormControls(fragment);
86
+
46
87
  // Populate the Lighthouse mode
47
88
  const modeFormElements = fragment.$('mode-form-elements');
48
89
  this.populateRuntimeSettingAsRadio('lighthouse.mode', i18nString(UIStrings.mode), modeFormElements);
49
90
 
50
- const form = this.contentElement.querySelector('form');
51
- form?.appendChild(fragment.element());
52
- this.updateStartButton();
91
+ this.contentElement.textContent = '';
92
+ this.contentElement.append(fragment.element());
93
+ this.updateMode();
94
+ }
95
+
96
+ onResize(): void {
97
+ const useNarrowLayout = this.contentElement.offsetWidth < 500;
98
+ const useWideLayout = this.contentElement.offsetWidth > 800;
99
+ const headerEl = this.contentElement.querySelector('.lighthouse-start-view-fr header');
100
+ const optionsEl = this.contentElement.querySelector('.lighthouse-options');
101
+ if (headerEl) {
102
+ headerEl.classList.toggle('hbox', !useNarrowLayout);
103
+ headerEl.classList.toggle('vbox', useNarrowLayout);
104
+ }
105
+ if (optionsEl) {
106
+ optionsEl.classList.toggle('wide', useWideLayout);
107
+ optionsEl.classList.toggle('narrow', useNarrowLayout);
108
+ }
53
109
  }
54
110
 
55
- updateStartButton(): void {
111
+ updateMode(): void {
56
112
  const {mode} = this.controller.getFlags();
57
113
 
58
- let label: Platform.UIString.LocalizedString;
114
+ let buttonLabel: Platform.UIString.LocalizedString;
59
115
  let callback: () => void;
60
116
 
61
117
  if (mode === 'timespan') {
62
- label = i18nString(UIStrings.startTimespan);
118
+ buttonLabel = i18nString(UIStrings.startTimespan);
63
119
  callback = (): void => {
64
120
  this.controller.dispatchEventToListeners(
65
121
  Events.RequestLighthouseTimespanStart,
@@ -67,7 +123,7 @@ export class StartViewFR extends StartView {
67
123
  );
68
124
  };
69
125
  } else if (mode === 'snapshot') {
70
- label = i18nString(UIStrings.analyzeSnapshot);
126
+ buttonLabel = i18nString(UIStrings.analyzeSnapshot);
71
127
  callback = (): void => {
72
128
  this.controller.dispatchEventToListeners(
73
129
  Events.RequestLighthouseStart,
@@ -75,7 +131,7 @@ export class StartViewFR extends StartView {
75
131
  );
76
132
  };
77
133
  } else {
78
- label = i18nString(UIStrings.analyzeNavigation);
134
+ buttonLabel = i18nString(UIStrings.analyzeNavigation);
79
135
  callback = (): void => {
80
136
  this.controller.dispatchEventToListeners(
81
137
  Events.RequestLighthouseStart,
@@ -85,16 +141,16 @@ export class StartViewFR extends StartView {
85
141
  }
86
142
 
87
143
  this.startButton = UI.UIUtils.createTextButton(
88
- label,
144
+ buttonLabel,
89
145
  callback,
90
146
  /* className */ '',
91
147
  /* primary */ true,
92
148
  );
93
149
 
94
- const startButtonContainer = this.contentElement.querySelector('.lighthouse-start-button-container');
95
- if (startButtonContainer) {
96
- startButtonContainer.textContent = '';
97
- startButtonContainer.appendChild(this.startButton);
150
+ const startButtonContainerEl = this.contentElement.querySelector('.lighthouse-start-button-container');
151
+ if (startButtonContainerEl) {
152
+ startButtonContainerEl.textContent = '';
153
+ startButtonContainerEl.appendChild(this.startButton);
98
154
  }
99
155
  }
100
156
  }
@@ -5,16 +5,20 @@
5
5
  import type * as Common from '../../core/common/common.js';
6
6
  import * as UI from '../../ui/legacy/legacy.js';
7
7
 
8
+ interface RadioOption {
9
+ value: string;
10
+ label: () => Common.UIString.LocalizedString;
11
+ tooltip?: () => Common.UIString.LocalizedString;
12
+ }
13
+
8
14
  export class RadioSetting {
9
15
  private readonly setting: Common.Settings.Setting<string>;
10
- private options: {value: string, label: () => Common.UIString.LocalizedString}[];
16
+ private options: RadioOption[];
11
17
  element: HTMLDivElement;
12
18
  private radioElements: HTMLInputElement[];
13
19
  private ignoreChangeEvents: boolean;
14
20
  private selectedIndex: number;
15
- constructor(
16
- options: {value: string, label: () => Common.UIString.LocalizedString}[],
17
- setting: Common.Settings.Setting<string>, description: string) {
21
+ constructor(options: RadioOption[], setting: Common.Settings.Setting<string>, description: string) {
18
22
  this.setting = setting;
19
23
  this.options = options;
20
24
 
@@ -32,9 +36,11 @@ export class RadioSetting {
32
36
  `;
33
37
 
34
38
  this.element.appendChild(fragment.element());
39
+
40
+ const tooltip = option.tooltip?.() || description;
35
41
  if (description) {
36
- UI.Tooltip.Tooltip.install(fragment.$('input') as HTMLElement, description);
37
- UI.Tooltip.Tooltip.install(fragment.$('span') as HTMLElement, description);
42
+ UI.Tooltip.Tooltip.install(fragment.$('input') as HTMLElement, tooltip);
43
+ UI.Tooltip.Tooltip.install(fragment.$('span') as HTMLElement, tooltip);
38
44
  }
39
45
  const radioElement = fragment.$('input') as HTMLInputElement;
40
46
  radioElement.addEventListener('change', this.valueChanged.bind(this));
@@ -5,7 +5,8 @@
5
5
  */
6
6
  /* <3 */
7
7
 
8
- .lighthouse-start-view {
8
+ .lighthouse-start-view,
9
+ .lighthouse-start-view-fr {
9
10
  font-family: Roboto, sans-serif;
10
11
  font-size: var(--font-size);
11
12
  line-height: 18px;
@@ -16,6 +17,10 @@
16
17
  --report-font-family: roboto, helvetica, arial, sans-serif;
17
18
  }
18
19
 
20
+ .lighthouse-start-view-fr {
21
+ margin: 24px;
22
+ }
23
+
19
24
  .lighthouse-start-view header {
20
25
  flex: 2 1;
21
26
  padding: 16px;
@@ -23,6 +28,15 @@
23
28
  justify-items: center;
24
29
  }
25
30
 
31
+ .lighthouse-start-view-fr header {
32
+ display: flex;
33
+ font-size: 18px;
34
+ flex-direction: row;
35
+ align-items: center;
36
+ column-gap: 16px;
37
+ margin-bottom: 16px;
38
+ }
39
+
26
40
  .lighthouse-logo {
27
41
  width: 75px;
28
42
  height: 75px;
@@ -32,6 +46,11 @@
32
46
  background-image: var(--image-file-lighthouse_logo);
33
47
  }
34
48
 
49
+ .lighthouse-start-view-fr .lighthouse-logo {
50
+ width: 45px;
51
+ height: 45px;
52
+ }
53
+
35
54
  .lighthouse-start-view-text {
36
55
  margin: 0 40px;
37
56
  text-align: center;
@@ -65,6 +84,10 @@
65
84
  top: -4px;
66
85
  }
67
86
 
87
+ .lighthouse-form-section-label .lighthouse-learn-more {
88
+ padding: 20px;
89
+ }
90
+
68
91
  .lighthouse-radio {
69
92
  display: flex;
70
93
  align-items: center;
@@ -86,8 +109,16 @@ input[type="radio"]:focus {
86
109
  align-items: center;
87
110
  }
88
111
 
112
+ .lighthouse-start-view-fr header.hbox .lighthouse-start-button-container {
113
+ margin-left: auto;
114
+ }
115
+
116
+ .lighthouse-start-view-fr header.vbox .lighthouse-title {
117
+ text-align: center;
118
+ }
119
+
89
120
  .lighthouse-start-button-container button {
90
- margin: 8px auto;
121
+ margin: 16px auto;
91
122
  font-family: var(--report-font-family);
92
123
  font-weight: 500;
93
124
  font-size: var(--font-size);
@@ -136,3 +167,19 @@ input[type="radio"]:focus {
136
167
  content: "⚠";
137
168
  margin-right: 10px;
138
169
  }
170
+
171
+ .lighthouse-options {
172
+ display: grid;
173
+ grid-template-columns: auto auto;
174
+ grid-template-rows: auto auto;
175
+ }
176
+
177
+ .lighthouse-options.narrow {
178
+ grid-template-columns: auto;
179
+ grid-template-rows: auto auto auto;
180
+ }
181
+
182
+ .lighthouse-options.wide {
183
+ grid-template-columns: auto auto auto;
184
+ grid-template-rows: auto;
185
+ }
@@ -572,6 +572,7 @@ export abstract class HeapSnapshotGenericObjectNode extends HeapSnapshotGridNode
572
572
  valueStyle = 'number';
573
573
  break;
574
574
  case 'hidden':
575
+ case 'object shape':
575
576
  valueStyle = 'null';
576
577
  break;
577
578
  case 'array':
@@ -111,7 +111,7 @@ const UIStrings = {
111
111
  *@description Second part of the body of message to display in devtools security tab when you are viewing a page that triggered a safety tip.
112
112
  */
113
113
  ifYouBelieveThisIsShownIn:
114
- 'If you believe this is shown in error please visit https://bugs.chromium.org/p/chromium/issues/entry?template=Safety+Tips+Appeals.',
114
+ 'If you believe this is shown in error please visit https://g.co/chrome/lookalike-warnings.',
115
115
  /**
116
116
  *@description Summary of a warning when the user visits a page that triggered a Safety Tip because the domain looked like another domain.
117
117
  */
@@ -126,7 +126,7 @@ const UIStrings = {
126
126
  *@description second part of body of a warning when the user visits a page that triggered a Safety Tip because the domain looked like another domain.
127
127
  */
128
128
  ifYouBelieveThisIsShownInErrorSafety:
129
- 'If you believe this is shown in error please visit https://bugs.chromium.org/p/chromium/issues/entry?template=Safety+Tips+Appeals.',
129
+ 'If you believe this is shown in error please visit https://g.co/chrome/lookalike-warnings.',
130
130
  /**
131
131
  *@description Title of the devtools security tab when the page you are on triggered a safety tip.
132
132
  */
@@ -536,6 +536,10 @@ export class DebuggerPlugin extends Plugin {
536
536
  return true;
537
537
  }
538
538
 
539
+ private isVariableIdentifier(tokenType: string): boolean {
540
+ return tokenType === 'VariableName' || tokenType === 'VariableDefinition';
541
+ }
542
+
539
543
  private isIdentifier(tokenType: string): boolean {
540
544
  return tokenType === 'VariableName' || tokenType === 'VariableDefinition' || tokenType === 'PropertyName' ||
541
545
  tokenType === 'PropertyDefinition';
@@ -962,8 +966,8 @@ export class DebuggerPlugin extends Plugin {
962
966
  tree.iterate({
963
967
  from: fromPos,
964
968
  to: toPos,
965
- enter(node): void {
966
- const varName = node.name === 'VariableName' && editorState.sliceDoc(node.from, node.to);
969
+ enter: node => {
970
+ const varName = this.isVariableIdentifier(node.name) && editorState.sliceDoc(node.from, node.to);
967
971
  if (varName && variableMap.has(varName)) {
968
972
  if (node.from > curLine.to) {
969
973
  curLine = editorState.doc.lineAt(node.from);
@@ -439,6 +439,14 @@ export class SourcesPanel extends UI.Panel.Panel implements UI.ContextMenu.Provi
439
439
  return this.sourcesViewInternal.searchableView();
440
440
  }
441
441
 
442
+ toggleNavigatorSidebar(): void {
443
+ this.editorView.toggleSidebar();
444
+ }
445
+
446
+ toggleDebuggerSidebar(): void {
447
+ this.splitWidget.toggleSidebar();
448
+ }
449
+
442
450
  private debuggerPaused(event: Common.EventTarget.EventTargetEvent<SDK.DebuggerModel.DebuggerModel>): void {
443
451
  const debuggerModel = event.data;
444
452
  const details = debuggerModel.debuggerPausedDetails();
@@ -1285,18 +1293,18 @@ export class RevealingActionDelegate implements UI.ActionRegistration.ActionDele
1285
1293
  }
1286
1294
  }
1287
1295
 
1288
- let debuggingActionDelegateInstance: DebuggingActionDelegate;
1296
+ let actionDelegateInstance: ActionDelegate;
1289
1297
 
1290
- export class DebuggingActionDelegate implements UI.ActionRegistration.ActionDelegate {
1298
+ export class ActionDelegate implements UI.ActionRegistration.ActionDelegate {
1291
1299
  static instance(opts: {
1292
1300
  forceNew: boolean|null,
1293
- } = {forceNew: null}): DebuggingActionDelegate {
1301
+ } = {forceNew: null}): ActionDelegate {
1294
1302
  const {forceNew} = opts;
1295
- if (!debuggingActionDelegateInstance || forceNew) {
1296
- debuggingActionDelegateInstance = new DebuggingActionDelegate();
1303
+ if (!actionDelegateInstance || forceNew) {
1304
+ actionDelegateInstance = new ActionDelegate();
1297
1305
  }
1298
1306
 
1299
- return debuggingActionDelegateInstance;
1307
+ return actionDelegateInstance;
1300
1308
  }
1301
1309
  handleAction(context: UI.Context.Context, actionId: string): boolean {
1302
1310
  const panel = SourcesPanel.instance();
@@ -1340,6 +1348,14 @@ export class DebuggingActionDelegate implements UI.ActionRegistration.ActionDele
1340
1348
  }
1341
1349
  return true;
1342
1350
  }
1351
+ case 'sources.toggle-navigator-sidebar': {
1352
+ panel.toggleNavigatorSidebar();
1353
+ return true;
1354
+ }
1355
+ case 'sources.toggle-debugger-sidebar': {
1356
+ panel.toggleDebuggerSidebar();
1357
+ return true;
1358
+ }
1343
1359
  }
1344
1360
  return false;
1345
1361
  }
@@ -189,7 +189,7 @@ Sources.SourcesPanel.DebuggerPausedDetailsRevealer = SourcesModule.SourcesPanel.
189
189
  Sources.SourcesPanel.RevealingActionDelegate = SourcesModule.SourcesPanel.RevealingActionDelegate;
190
190
 
191
191
  /** @constructor */
192
- Sources.SourcesPanel.DebuggingActionDelegate = SourcesModule.SourcesPanel.DebuggingActionDelegate;
192
+ Sources.SourcesPanel.ActionDelegate = SourcesModule.SourcesPanel.ActionDelegate;
193
193
 
194
194
  /** @constructor */
195
195
  Sources.SourcesPanel.WrapperView = SourcesModule.SourcesPanel.WrapperView;
@@ -378,6 +378,14 @@ const UIStrings = {
378
378
  * comes to a halt.
379
379
  */
380
380
  enableAutoFocusOnDebuggerPaused: 'Focus Sources panel when triggering a breakpoint',
381
+ /**
382
+ * @description Text for command of toggling navigator sidebar in Sources panel
383
+ */
384
+ toggleNavigatorSidebar: 'Toggle navigator sidebar',
385
+ /**
386
+ * @description Text for command of toggling debugger sidebar in Sources panel
387
+ */
388
+ toggleDebuggerSidebar: 'Toggle debugger sidebar',
381
389
 
382
390
  };
383
391
  const str_ = i18n.i18n.registerUIStrings('panels/sources/sources-meta.ts', UIStrings);
@@ -567,7 +575,7 @@ UI.ActionRegistration.registerActionExtension({
567
575
  actionId: 'debugger.step-over',
568
576
  async loadActionDelegate() {
569
577
  const Sources = await loadSourcesModule();
570
- return Sources.SourcesPanel.DebuggingActionDelegate.instance();
578
+ return Sources.SourcesPanel.ActionDelegate.instance();
571
579
  },
572
580
 
573
581
  title: i18nLazyString(UIStrings.stepOverNextFunctionCall),
@@ -599,7 +607,7 @@ UI.ActionRegistration.registerActionExtension({
599
607
  actionId: 'debugger.step-into',
600
608
  async loadActionDelegate() {
601
609
  const Sources = await loadSourcesModule();
602
- return Sources.SourcesPanel.DebuggingActionDelegate.instance();
610
+ return Sources.SourcesPanel.ActionDelegate.instance();
603
611
  },
604
612
  title: i18nLazyString(UIStrings.stepIntoNextFunctionCall),
605
613
  iconClass: UI.ActionRegistration.IconClass.LARGE_ICON_STEP_INTO,
@@ -630,7 +638,7 @@ UI.ActionRegistration.registerActionExtension({
630
638
  actionId: 'debugger.step',
631
639
  async loadActionDelegate() {
632
640
  const Sources = await loadSourcesModule();
633
- return Sources.SourcesPanel.DebuggingActionDelegate.instance();
641
+ return Sources.SourcesPanel.ActionDelegate.instance();
634
642
  },
635
643
  title: i18nLazyString(UIStrings.step),
636
644
  iconClass: UI.ActionRegistration.IconClass.LARGE_ICON_STEP,
@@ -652,7 +660,7 @@ UI.ActionRegistration.registerActionExtension({
652
660
  actionId: 'debugger.step-out',
653
661
  async loadActionDelegate() {
654
662
  const Sources = await loadSourcesModule();
655
- return Sources.SourcesPanel.DebuggingActionDelegate.instance();
663
+ return Sources.SourcesPanel.ActionDelegate.instance();
656
664
  },
657
665
  title: i18nLazyString(UIStrings.stepOutOfCurrentFunction),
658
666
  iconClass: UI.ActionRegistration.IconClass.LARGE_ICON_STEP_OUT,
@@ -683,7 +691,7 @@ UI.ActionRegistration.registerActionExtension({
683
691
  category: UI.ActionRegistration.ActionCategory.DEBUGGER,
684
692
  async loadActionDelegate() {
685
693
  const Sources = await loadSourcesModule();
686
- return Sources.SourcesPanel.DebuggingActionDelegate.instance();
694
+ return Sources.SourcesPanel.ActionDelegate.instance();
687
695
  },
688
696
  title: i18nLazyString(UIStrings.runSnippet),
689
697
  iconClass: UI.ActionRegistration.IconClass.LARGEICON_PLAY,
@@ -709,7 +717,7 @@ UI.ActionRegistration.registerActionExtension({
709
717
  toggleable: true,
710
718
  async loadActionDelegate() {
711
719
  const Sources = await loadSourcesModule();
712
- return Sources.SourcesPanel.DebuggingActionDelegate.instance();
720
+ return Sources.SourcesPanel.ActionDelegate.instance();
713
721
  },
714
722
  contextTypes() {
715
723
  return maybeRetrieveContextTypes(Sources => [Sources.SourcesView.SourcesView]);
@@ -764,7 +772,7 @@ UI.ActionRegistration.registerActionExtension({
764
772
  category: UI.ActionRegistration.ActionCategory.DEBUGGER,
765
773
  async loadActionDelegate() {
766
774
  const Sources = await loadSourcesModule();
767
- return Sources.SourcesPanel.DebuggingActionDelegate.instance();
775
+ return Sources.SourcesPanel.ActionDelegate.instance();
768
776
  },
769
777
  title: i18nLazyString(UIStrings.evaluateSelectedTextInConsole),
770
778
  contextTypes() {
@@ -1240,6 +1248,52 @@ UI.ActionRegistration.registerActionExtension({
1240
1248
  ],
1241
1249
  });
1242
1250
 
1251
+ UI.ActionRegistration.registerActionExtension({
1252
+ actionId: 'sources.toggle-navigator-sidebar',
1253
+ category: UI.ActionRegistration.ActionCategory.SOURCES,
1254
+ title: i18nLazyString(UIStrings.toggleNavigatorSidebar),
1255
+ async loadActionDelegate() {
1256
+ const Sources = await loadSourcesModule();
1257
+ return Sources.SourcesPanel.ActionDelegate.instance();
1258
+ },
1259
+ contextTypes() {
1260
+ return maybeRetrieveContextTypes(Sources => [Sources.SourcesView.SourcesView]);
1261
+ },
1262
+ bindings: [
1263
+ {
1264
+ platform: UI.ActionRegistration.Platforms.WindowsLinux,
1265
+ shortcut: 'Ctrl+Shift+y',
1266
+ },
1267
+ {
1268
+ platform: UI.ActionRegistration.Platforms.Mac,
1269
+ shortcut: 'Meta+Shift+y',
1270
+ },
1271
+ ],
1272
+ });
1273
+
1274
+ UI.ActionRegistration.registerActionExtension({
1275
+ actionId: 'sources.toggle-debugger-sidebar',
1276
+ category: UI.ActionRegistration.ActionCategory.SOURCES,
1277
+ title: i18nLazyString(UIStrings.toggleDebuggerSidebar),
1278
+ async loadActionDelegate() {
1279
+ const Sources = await loadSourcesModule();
1280
+ return Sources.SourcesPanel.ActionDelegate.instance();
1281
+ },
1282
+ contextTypes() {
1283
+ return maybeRetrieveContextTypes(Sources => [Sources.SourcesView.SourcesView]);
1284
+ },
1285
+ bindings: [
1286
+ {
1287
+ platform: UI.ActionRegistration.Platforms.WindowsLinux,
1288
+ shortcut: 'Ctrl+Shift+h',
1289
+ },
1290
+ {
1291
+ platform: UI.ActionRegistration.Platforms.Mac,
1292
+ shortcut: 'Meta+Shift+h',
1293
+ },
1294
+ ],
1295
+ });
1296
+
1243
1297
  Common.Settings.registerSettingExtension({
1244
1298
  settingName: 'navigatorGroupByFolder',
1245
1299
  settingType: Common.Settings.SettingType.BOOLEAN,
@@ -11,12 +11,14 @@
11
11
  font-size: var(--source-code-font-size);
12
12
  white-space: pre;
13
13
  line-height: 1.2em;
14
+ user-select: text;
14
15
  }
15
16
 
16
17
  .diff-line-number {
17
18
  color: var(--color-line-number);
18
19
  padding: 0 3px 0 9px;
19
20
  text-align: right;
21
+ user-select: none;
20
22
  }
21
23
 
22
24
  .diff-line-marker {
@@ -255,25 +255,36 @@ export class TreeOutline<TreeNodeDataType> extends HTMLElement {
255
255
  return this.#selectedTreeNode;
256
256
  }
257
257
 
258
- async #fetchNodeChildren(node: TreeNodeWithChildren<TreeNodeDataType>): Promise<TreeNode<TreeNodeDataType>[]> {
258
+ async #flattenSubtree(node: TreeNodeWithChildren<TreeNodeDataType>, filter: (node: TreeNodeDataType) => FilterOption):
259
+ Promise<TreeNode<TreeNodeDataType>[]> {
259
260
  const children = await getNodeChildren(node);
260
- if (!this.#nodeFilter) {
261
- return children;
262
- }
263
261
  const filteredChildren = [];
264
262
  for (const child of children) {
265
- const filtering = this.#nodeFilter(child.treeNodeData);
263
+ const filtering = filter(child.treeNodeData);
266
264
  // We always include the selected node in the tree, regardless of its filtering status.
267
- if (filtering === FilterOption.SHOW || this.#isSelectedNode(child) || child.id === this.#nodeIdPendingFocus) {
265
+ const toBeSelected = this.#isSelectedNode(child) || child.id === this.#nodeIdPendingFocus;
266
+ // If a node is already expanded we should not flatten it away.
267
+ const expanded = this.#nodeExpandedMap.get(child.id);
268
+ if (filtering === FilterOption.SHOW || toBeSelected || expanded) {
268
269
  filteredChildren.push(child);
269
270
  } else if (filtering === FilterOption.FLATTEN && isExpandableNode(child)) {
270
- const grandChildren = await this.#fetchNodeChildren(child);
271
+ const grandChildren = await this.#flattenSubtree(child, filter);
271
272
  filteredChildren.push(...grandChildren);
272
273
  }
273
274
  }
274
275
  return filteredChildren;
275
276
  }
276
277
 
278
+ async #fetchNodeChildren(node: TreeNodeWithChildren<TreeNodeDataType>): Promise<TreeNode<TreeNodeDataType>[]> {
279
+ const children = await getNodeChildren(node);
280
+ const filter = this.#nodeFilter;
281
+ if (!filter) {
282
+ return children;
283
+ }
284
+ const filteredDescendants = await this.#flattenSubtree(node, filter);
285
+ return filteredDescendants.length ? filteredDescendants : children;
286
+ }
287
+
277
288
  #setNodeExpandedState(node: TreeNode<TreeNodeDataType>, newExpandedState: boolean): void {
278
289
  this.#nodeExpandedMap.set(node.id, newExpandedState);
279
290
  }
@@ -61,6 +61,8 @@ export class SplitWidget extends Common.ObjectWrapper.eventMixin<EventTypes, typ
61
61
  private animationCallback: (() => void)|null;
62
62
  private showSidebarButtonTitle: Common.UIString.LocalizedString;
63
63
  private hideSidebarButtonTitle: Common.UIString.LocalizedString;
64
+ private shownSidebarString: Common.UIString.LocalizedString;
65
+ private hiddenSidebarString: Common.UIString.LocalizedString;
64
66
  private showHideSidebarButton: ToolbarButton|null;
65
67
  private isVerticalInternal: boolean;
66
68
  private sidebarMinimized: boolean;
@@ -111,6 +113,8 @@ export class SplitWidget extends Common.ObjectWrapper.eventMixin<EventTypes, typ
111
113
  this.animationCallback = null;
112
114
  this.showSidebarButtonTitle = Common.UIString.LocalizedEmptyString;
113
115
  this.hideSidebarButtonTitle = Common.UIString.LocalizedEmptyString;
116
+ this.shownSidebarString = Common.UIString.LocalizedEmptyString;
117
+ this.hiddenSidebarString = Common.UIString.LocalizedEmptyString;
114
118
  this.showHideSidebarButton = null;
115
119
  this.isVerticalInternal = false;
116
120
  this.sidebarMinimized = false;
@@ -821,23 +825,29 @@ export class SplitWidget extends Common.ObjectWrapper.eventMixin<EventTypes, typ
821
825
  shownString: Common.UIString.LocalizedString, hiddenString: Common.UIString.LocalizedString): ToolbarButton {
822
826
  this.showSidebarButtonTitle = showTitle;
823
827
  this.hideSidebarButtonTitle = hideTitle;
828
+ this.shownSidebarString = shownString;
829
+ this.hiddenSidebarString = hiddenString;
824
830
  this.showHideSidebarButton = new ToolbarButton('', '');
825
831
  this.showHideSidebarButton.addEventListener(ToolbarButton.Events.Click, buttonClicked, this);
826
832
  this.updateShowHideSidebarButton();
827
833
 
828
834
  function buttonClicked(this: SplitWidget): void {
829
- if (this.showModeInternal !== ShowMode.Both) {
830
- this.showBoth(true);
831
- ARIAUtils.alert(shownString);
832
- } else {
833
- this.hideSidebar(true);
834
- ARIAUtils.alert(hiddenString);
835
- }
835
+ this.toggleSidebar();
836
836
  }
837
837
 
838
838
  return this.showHideSidebarButton;
839
839
  }
840
840
 
841
+ toggleSidebar(): void {
842
+ if (this.showModeInternal !== ShowMode.Both) {
843
+ this.showBoth(true);
844
+ ARIAUtils.alert(this.shownSidebarString);
845
+ } else {
846
+ this.hideSidebar(true);
847
+ ARIAUtils.alert(this.hiddenSidebarString);
848
+ }
849
+ }
850
+
841
851
  private updateShowHideSidebarButton(): void {
842
852
  if (!this.showHideSidebarButton) {
843
853
  return;
@@ -57,6 +57,10 @@ const UIStrings = {
57
57
  *@description Announced screen reader message for ToolbarSettingToggle when the setting is toggled off.
58
58
  */
59
59
  notPressed: 'not pressed',
60
+ /**
61
+ *@description Tooltip shown when the user hovers over the clear icon to empty the text input.
62
+ */
63
+ clearInput: 'Clear input',
60
64
  };
61
65
  const str_ = i18n.i18n.registerUIStrings('ui/legacy/Toolbar.ts', UIStrings);
62
66
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -701,6 +705,7 @@ export class ToolbarInput extends ToolbarItem<ToolbarInput.EventTypes> {
701
705
  }
702
706
 
703
707
  const clearButton = this.element.createChild('div', 'toolbar-input-clear-button');
708
+ clearButton.title = UIStrings.clearInput;
704
709
  clearButton.appendChild(Icon.create('mediumicon-gray-cross-active', 'search-cancel-button'));
705
710
  clearButton.addEventListener('click', () => {
706
711
  this.setValue('', true);