chrome-devtools-frontend 1.0.929965 → 1.0.930993

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 (63) hide show
  1. package/config/gni/devtools_grd_files.gni +2 -1
  2. package/front_end/core/host/InspectorFrontendHost.ts +8 -1
  3. package/front_end/core/host/InspectorFrontendHostAPI.ts +12 -0
  4. package/front_end/core/i18n/locales/en-US.json +3 -0
  5. package/front_end/core/i18n/locales/en-XL.json +3 -0
  6. package/front_end/core/protocol_client/InspectorBackend.ts +71 -71
  7. package/front_end/core/sdk/NetworkManager.ts +6 -2
  8. package/front_end/devtools_compatibility.js +8 -0
  9. package/front_end/legacy_test_runner/sources_test_runner/DebuggerTestRunner.js +2 -2
  10. package/front_end/legacy_test_runner/test_runner/TestRunner.js +2 -3
  11. package/front_end/models/bindings/BreakpointManager.ts +158 -154
  12. package/front_end/models/bindings/CSSWorkspaceBinding.ts +64 -56
  13. package/front_end/models/bindings/CompilerScriptMapping.ts +70 -70
  14. package/front_end/models/bindings/ContentProviderBasedProject.ts +20 -20
  15. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +132 -132
  16. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +73 -72
  17. package/front_end/models/bindings/DefaultScriptMapping.ts +22 -22
  18. package/front_end/models/bindings/FileUtils.ts +81 -81
  19. package/front_end/models/bindings/IgnoreListManager.ts +17 -17
  20. package/front_end/models/bindings/LiveLocation.ts +21 -21
  21. package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +28 -28
  22. package/front_end/models/bindings/ResourceMapping.ts +50 -50
  23. package/front_end/models/bindings/ResourceScriptMapping.ts +71 -71
  24. package/front_end/models/bindings/SASSSourceMapping.ts +32 -32
  25. package/front_end/models/bindings/StylesSourceMapping.ts +57 -57
  26. package/front_end/models/bindings/TempFile.ts +34 -34
  27. package/front_end/models/emulation/DeviceModeModel.ts +208 -203
  28. package/front_end/models/emulation/EmulatedDevices.ts +34 -34
  29. package/front_end/panels/console/ConsoleView.ts +2 -1
  30. package/front_end/panels/console/ConsoleViewMessage.ts +3 -3
  31. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +133 -133
  32. package/front_end/panels/css_overview/CSSOverviewModel.ts +16 -16
  33. package/front_end/panels/css_overview/CSSOverviewPanel.ts +77 -77
  34. package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +5 -5
  35. package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
  36. package/front_end/panels/elements/ElementsTreeElement.ts +6 -10
  37. package/front_end/panels/elements/ElementsTreeOutline.ts +3 -1
  38. package/front_end/panels/elements/components/LayoutPane.ts +6 -0
  39. package/front_end/panels/elements/elementsPanel.css +0 -1
  40. package/front_end/panels/elements/elementsTreeOutline.css +0 -4
  41. package/front_end/panels/lighthouse/LighthouseController.ts +18 -9
  42. package/front_end/panels/lighthouse/LighthousePanel.ts +2 -2
  43. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +7 -2
  44. package/front_end/panels/network/BlockedURLsPane.ts +8 -5
  45. package/front_end/panels/network/blockedURLsPane.css +0 -1
  46. package/front_end/panels/search/SearchView.ts +0 -2
  47. package/front_end/panels/sources/BreakpointEditDialog.ts +98 -81
  48. package/front_end/panels/sources/DebuggerPlugin.ts +15 -14
  49. package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +18 -2
  50. package/front_end/ui/components/text_editor/config.ts +6 -0
  51. package/front_end/ui/components/text_editor/cursor_tooltip.ts +70 -0
  52. package/front_end/ui/components/text_editor/javascript.ts +590 -0
  53. package/front_end/ui/components/text_editor/text_editor.ts +1 -0
  54. package/front_end/ui/components/text_editor/theme.ts +11 -0
  55. package/front_end/ui/components/tree_outline/TreeOutline.ts +3 -1
  56. package/front_end/ui/legacy/ARIAUtils.ts +24 -8
  57. package/front_end/ui/legacy/components/text_editor/cmdevtools.css +1 -0
  58. package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -3
  59. package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -2
  60. package/package.json +1 -1
  61. package/scripts/migration/class-fields/migrate.js +15 -2
  62. package/scripts/migration/class-fields/migrate.sh +10 -0
  63. package/front_end/ui/legacy/components/text_editor/SyntaxHighlighter.ts +0 -62
@@ -22,22 +22,22 @@ import type {UnusedDeclaration} from './CSSOverviewUnusedDeclarations.js';
22
22
  let CSSOverviewPanelInstance: CSSOverviewPanel;
23
23
 
24
24
  export class CSSOverviewPanel extends UI.Panel.Panel {
25
- private readonly model: CSSOverviewModel;
26
- private readonly controller: OverviewController;
27
- private readonly startView: CSSOverviewComponents.CSSOverviewStartView.CSSOverviewStartView;
28
- private readonly processingView: CSSOverviewProcessingView;
29
- private readonly completedView: CSSOverviewCompletedView;
30
- private backgroundColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
31
- private textColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
32
- private fillColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
33
- private borderColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
34
- private fontInfo!: Map<string, Map<string, Map<string, Protocol.DOM.BackendNodeId[]>>>;
35
- private mediaQueries!: Map<string, Protocol.CSS.CSSMedia[]>;
36
- private unusedDeclarations!: Map<string, UnusedDeclaration[]>;
37
- private elementCount!: number;
38
- private cancelled?: boolean;
39
- private globalStyleStats!: GlobalStyleStats;
40
- private textColorContrastIssues!: Map<string, ContrastIssue[]>;
25
+ readonly #model: CSSOverviewModel;
26
+ readonly #controller: OverviewController;
27
+ readonly #startView: CSSOverviewComponents.CSSOverviewStartView.CSSOverviewStartView;
28
+ readonly #processingView: CSSOverviewProcessingView;
29
+ readonly #completedView: CSSOverviewCompletedView;
30
+ #backgroundColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
31
+ #textColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
32
+ #fillColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
33
+ #borderColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
34
+ #fontInfo!: Map<string, Map<string, Map<string, Protocol.DOM.BackendNodeId[]>>>;
35
+ #mediaQueries!: Map<string, Protocol.CSS.CSSMedia[]>;
36
+ #unusedDeclarations!: Map<string, UnusedDeclaration[]>;
37
+ #elementCount!: number;
38
+ #cancelled?: boolean;
39
+ #globalStyleStats!: GlobalStyleStats;
40
+ #textColorContrastIssues!: Map<string, ContrastIssue[]>;
41
41
 
42
42
  private constructor() {
43
43
  super('css_overview');
@@ -45,23 +45,23 @@ export class CSSOverviewPanel extends UI.Panel.Panel {
45
45
  this.element.classList.add('css-overview-panel');
46
46
 
47
47
  const [model] = SDK.TargetManager.TargetManager.instance().models(CSSOverviewModel);
48
- this.model = (model as CSSOverviewModel);
48
+ this.#model = (model as CSSOverviewModel);
49
49
 
50
- this.controller = new OverviewController();
51
- this.startView = new CSSOverviewComponents.CSSOverviewStartView.CSSOverviewStartView();
52
- this.startView.addEventListener(
53
- 'overviewstartrequested', () => this.controller.dispatchEventToListeners(Events.RequestOverviewStart));
54
- this.processingView = new CSSOverviewProcessingView(this.controller);
55
- this.completedView = new CSSOverviewCompletedView(this.controller, model.target());
50
+ this.#controller = new OverviewController();
51
+ this.#startView = new CSSOverviewComponents.CSSOverviewStartView.CSSOverviewStartView();
52
+ this.#startView.addEventListener(
53
+ 'overviewstartrequested', () => this.#controller.dispatchEventToListeners(Events.RequestOverviewStart));
54
+ this.#processingView = new CSSOverviewProcessingView(this.#controller);
55
+ this.#completedView = new CSSOverviewCompletedView(this.#controller, model.target());
56
56
 
57
- this.controller.addEventListener(Events.RequestOverviewStart, _event => {
57
+ this.#controller.addEventListener(Events.RequestOverviewStart, _event => {
58
58
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.CaptureCssOverviewClicked);
59
59
  this.startOverview();
60
60
  }, this);
61
- this.controller.addEventListener(Events.RequestOverviewCancel, this.cancelOverview, this);
62
- this.controller.addEventListener(Events.OverviewCompleted, this.overviewCompleted, this);
63
- this.controller.addEventListener(Events.Reset, this.reset, this);
64
- this.controller.addEventListener(Events.RequestNodeHighlight, this.requestNodeHighlight, this);
61
+ this.#controller.addEventListener(Events.RequestOverviewCancel, this.cancelOverview, this);
62
+ this.#controller.addEventListener(Events.OverviewCompleted, this.overviewCompleted, this);
63
+ this.#controller.addEventListener(Events.Reset, this.reset, this);
64
+ this.#controller.addEventListener(Events.RequestNodeHighlight, this.requestNodeHighlight, this);
65
65
 
66
66
  this.reset();
67
67
  }
@@ -74,16 +74,16 @@ export class CSSOverviewPanel extends UI.Panel.Panel {
74
74
  }
75
75
 
76
76
  private reset(): void {
77
- this.backgroundColors = new Map();
78
- this.textColors = new Map();
79
- this.fillColors = new Map();
80
- this.borderColors = new Map();
81
- this.fontInfo = new Map();
82
- this.mediaQueries = new Map();
83
- this.unusedDeclarations = new Map();
84
- this.elementCount = 0;
85
- this.cancelled = false;
86
- this.globalStyleStats = {
77
+ this.#backgroundColors = new Map();
78
+ this.#textColors = new Map();
79
+ this.#fillColors = new Map();
80
+ this.#borderColors = new Map();
81
+ this.#fontInfo = new Map();
82
+ this.#mediaQueries = new Map();
83
+ this.#unusedDeclarations = new Map();
84
+ this.#elementCount = 0;
85
+ this.#cancelled = false;
86
+ this.#globalStyleStats = {
87
87
  styleRules: 0,
88
88
  inlineStyles: 0,
89
89
  externalSheets: 0,
@@ -99,45 +99,45 @@ export class CSSOverviewPanel extends UI.Panel.Panel {
99
99
  nonSimple: 0,
100
100
  },
101
101
  };
102
- this.textColorContrastIssues = new Map();
102
+ this.#textColorContrastIssues = new Map();
103
103
  this.renderInitialView();
104
104
  }
105
105
 
106
106
  private requestNodeHighlight(evt: Common.EventTarget.EventTargetEvent<number>): void {
107
- this.model.highlightNode((evt.data as Protocol.DOM.BackendNodeId));
107
+ this.#model.highlightNode((evt.data as Protocol.DOM.BackendNodeId));
108
108
  }
109
109
 
110
110
  private renderInitialView(): void {
111
- this.processingView.hideWidget();
112
- this.completedView.hideWidget();
111
+ this.#processingView.hideWidget();
112
+ this.#completedView.hideWidget();
113
113
 
114
- this.contentElement.append(this.startView);
115
- this.startView.show();
114
+ this.contentElement.append(this.#startView);
115
+ this.#startView.show();
116
116
  }
117
117
 
118
118
  private renderOverviewStartedView(): void {
119
- this.startView.hide();
120
- this.completedView.hideWidget();
119
+ this.#startView.hide();
120
+ this.#completedView.hideWidget();
121
121
 
122
- this.processingView.show(this.contentElement);
122
+ this.#processingView.show(this.contentElement);
123
123
  }
124
124
 
125
125
  private renderOverviewCompletedView(): void {
126
- this.startView.hide();
127
- this.processingView.hideWidget();
128
-
129
- this.completedView.show(this.contentElement);
130
- this.completedView.setOverviewData({
131
- backgroundColors: this.backgroundColors,
132
- textColors: this.textColors,
133
- textColorContrastIssues: this.textColorContrastIssues,
134
- fillColors: this.fillColors,
135
- borderColors: this.borderColors,
136
- globalStyleStats: this.globalStyleStats,
137
- fontInfo: this.fontInfo,
138
- elementCount: this.elementCount,
139
- mediaQueries: this.mediaQueries,
140
- unusedDeclarations: this.unusedDeclarations,
126
+ this.#startView.hide();
127
+ this.#processingView.hideWidget();
128
+
129
+ this.#completedView.show(this.contentElement);
130
+ this.#completedView.setOverviewData({
131
+ backgroundColors: this.#backgroundColors,
132
+ textColors: this.#textColors,
133
+ textColorContrastIssues: this.#textColorContrastIssues,
134
+ fillColors: this.#fillColors,
135
+ borderColors: this.#borderColors,
136
+ globalStyleStats: this.#globalStyleStats,
137
+ fontInfo: this.#fontInfo,
138
+ elementCount: this.#elementCount,
139
+ mediaQueries: this.#mediaQueries,
140
+ unusedDeclarations: this.#unusedDeclarations,
141
141
  });
142
142
  }
143
143
 
@@ -145,52 +145,52 @@ export class CSSOverviewPanel extends UI.Panel.Panel {
145
145
  this.renderOverviewStartedView();
146
146
 
147
147
  const [globalStyleStats, { elementCount, backgroundColors, textColors, textColorContrastIssues, fillColors, borderColors, fontInfo, unusedDeclarations }, mediaQueries] = await Promise.all([
148
- this.model.getGlobalStylesheetStats(),
149
- this.model.getNodeStyleStats(),
150
- this.model.getMediaQueries(),
148
+ this.#model.getGlobalStylesheetStats(),
149
+ this.#model.getNodeStyleStats(),
150
+ this.#model.getMediaQueries(),
151
151
  ]);
152
152
 
153
153
  if (elementCount) {
154
- this.elementCount = elementCount;
154
+ this.#elementCount = elementCount;
155
155
  }
156
156
 
157
157
  if (globalStyleStats) {
158
- this.globalStyleStats = globalStyleStats;
158
+ this.#globalStyleStats = globalStyleStats;
159
159
  }
160
160
 
161
161
  if (mediaQueries) {
162
- this.mediaQueries = mediaQueries;
162
+ this.#mediaQueries = mediaQueries;
163
163
  }
164
164
 
165
165
  if (backgroundColors) {
166
- this.backgroundColors = backgroundColors;
166
+ this.#backgroundColors = backgroundColors;
167
167
  }
168
168
 
169
169
  if (textColors) {
170
- this.textColors = textColors;
170
+ this.#textColors = textColors;
171
171
  }
172
172
 
173
173
  if (textColorContrastIssues) {
174
- this.textColorContrastIssues = textColorContrastIssues;
174
+ this.#textColorContrastIssues = textColorContrastIssues;
175
175
  }
176
176
 
177
177
  if (fillColors) {
178
- this.fillColors = fillColors;
178
+ this.#fillColors = fillColors;
179
179
  }
180
180
 
181
181
  if (borderColors) {
182
- this.borderColors = borderColors;
182
+ this.#borderColors = borderColors;
183
183
  }
184
184
 
185
185
  if (fontInfo) {
186
- this.fontInfo = fontInfo;
186
+ this.#fontInfo = fontInfo;
187
187
  }
188
188
 
189
189
  if (unusedDeclarations) {
190
- this.unusedDeclarations = unusedDeclarations;
190
+ this.#unusedDeclarations = unusedDeclarations;
191
191
  }
192
192
 
193
- this.controller.dispatchEventToListeners(Events.OverviewCompleted);
193
+ this.#controller.dispatchEventToListeners(Events.OverviewCompleted);
194
194
  }
195
195
 
196
196
  private getStyleValue(styles: Protocol.CSS.CSSComputedStyleProperty[], name: string): string|undefined {
@@ -203,7 +203,7 @@ export class CSSOverviewPanel extends UI.Panel.Panel {
203
203
  }
204
204
 
205
205
  private cancelOverview(): void {
206
- this.cancelled = true;
206
+ this.#cancelled = true;
207
207
  }
208
208
 
209
209
  private overviewCompleted(): void {
@@ -19,20 +19,20 @@ const UIStrings = {
19
19
  const str_ = i18n.i18n.registerUIStrings('panels/css_overview/CSSOverviewProcessingView.ts', UIStrings);
20
20
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
21
21
  export class CSSOverviewProcessingView extends UI.Widget.Widget {
22
- private readonly formatter: Intl.NumberFormat;
23
- private readonly controller: OverviewController;
22
+ readonly #formatter: Intl.NumberFormat;
23
+ readonly #controller: OverviewController;
24
24
  fragment?: UI.Fragment.Fragment;
25
25
  constructor(controller: OverviewController) {
26
26
  super();
27
27
 
28
- this.formatter = new Intl.NumberFormat('en-US');
29
- this.controller = controller;
28
+ this.#formatter = new Intl.NumberFormat('en-US');
29
+ this.#controller = controller;
30
30
  this.render();
31
31
  }
32
32
 
33
33
  private render(): void {
34
34
  const cancelButton = UI.UIUtils.createTextButton(
35
- i18nString(UIStrings.cancel), () => this.controller.dispatchEventToListeners(Events.RequestOverviewCancel), '',
35
+ i18nString(UIStrings.cancel), () => this.#controller.dispatchEventToListeners(Events.RequestOverviewCancel), '',
36
36
  true /* primary */);
37
37
  this.setDefaultFocusedElement(cancelButton);
38
38
 
@@ -75,7 +75,7 @@ export class OverviewStartRequestedEvent extends Event {
75
75
 
76
76
  export class CSSOverviewStartView extends HTMLElement {
77
77
  static readonly litTagName = LitHtml.literal`devtools-css-overview-start-view`;
78
- private readonly shadow = this.attachShadow({mode: 'open'});
78
+ readonly #shadow = this.attachShadow({mode: 'open'});
79
79
  #feedbackLink: HTMLAnchorElement;
80
80
 
81
81
  constructor() {
@@ -87,7 +87,7 @@ export class CSSOverviewStartView extends HTMLElement {
87
87
  }
88
88
 
89
89
  connectedCallback(): void {
90
- this.shadow.adoptedStyleSheets = [cssOverviewStartViewStyles];
90
+ this.#shadow.adoptedStyleSheets = [cssOverviewStartViewStyles];
91
91
  this.render();
92
92
  }
93
93
 
@@ -149,12 +149,12 @@ export class CSSOverviewStartView extends HTMLElement {
149
149
  </section>
150
150
  <a class="feedback-standalone" href=${FEEDBACK_LINK} target="_blank">${i18nString(UIStrings.feedbackStandalone)}</a>
151
151
  </div>
152
- `, this.shadow, {
152
+ `, this.#shadow, {
153
153
  host: this,
154
154
  });
155
155
  // clang-format on
156
156
 
157
- const startButton = this.shadow.querySelector<HTMLElement>('.start-capture');
157
+ const startButton = this.#shadow.querySelector<HTMLElement>('.start-capture');
158
158
  if (startButton) {
159
159
  startButton.focus();
160
160
  }
@@ -39,8 +39,9 @@ import * as Platform from '../../core/platform/platform.js';
39
39
  import * as SDK from '../../core/sdk/sdk.js';
40
40
  import * as TextUtils from '../../models/text_utils/text_utils.js';
41
41
  import * as Adorners from '../../ui/components/adorners/adorners.js';
42
+ import * as CodeHighlighter from '../../ui/components/code_highlighter/code_highlighter.js';
43
+
42
44
  import type * as TextEditor from '../../ui/components/text_editor/text_editor.js';
43
- import * as TextEditorLegacy from '../../ui/legacy/components/text_editor/text_editor.js';
44
45
  import * as Components from '../../ui/legacy/components/utils/utils.js';
45
46
  import * as UI from '../../ui/legacy/legacy.js';
46
47
  import * as Emulation from '../emulation/emulation.js';
@@ -1730,18 +1731,13 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
1730
1731
  if (node.parentNode && node.parentNode.nodeName().toLowerCase() === 'script') {
1731
1732
  const newNode = titleDOM.createChild('span', 'webkit-html-text-node webkit-html-js-node');
1732
1733
  const text = node.nodeValue();
1733
- newNode.textContent = text.startsWith('\n') ? text.substring(1) : text;
1734
-
1735
- const javascriptSyntaxHighlighter =
1736
- new TextEditorLegacy.SyntaxHighlighter.SyntaxHighlighter('text/javascript', true);
1737
- javascriptSyntaxHighlighter.syntaxHighlightNode(newNode).then(updateSearchHighlight);
1734
+ newNode.textContent = text.replace(/^[\n\r]+|\s+$/g, '');
1735
+ CodeHighlighter.CodeHighlighter.highlightNode(newNode, 'text/javascript').then(updateSearchHighlight);
1738
1736
  } else if (node.parentNode && node.parentNode.nodeName().toLowerCase() === 'style') {
1739
1737
  const newNode = titleDOM.createChild('span', 'webkit-html-text-node webkit-html-css-node');
1740
1738
  const text = node.nodeValue();
1741
- newNode.textContent = text.startsWith('\n') ? text.substring(1) : text;
1742
-
1743
- const cssSyntaxHighlighter = new TextEditorLegacy.SyntaxHighlighter.SyntaxHighlighter('text/css', true);
1744
- cssSyntaxHighlighter.syntaxHighlightNode(newNode).then(updateSearchHighlight);
1739
+ newNode.textContent = text.replace(/^[\n\r]+|\s+$/g, '');
1740
+ CodeHighlighter.CodeHighlighter.highlightNode(newNode, 'text/css').then(updateSearchHighlight);
1745
1741
  } else {
1746
1742
  UI.UIUtils.createTextChild(titleDOM, '"');
1747
1743
  const textNodeElement = titleDOM.createChild('span', 'webkit-html-text-node');
@@ -35,6 +35,7 @@
35
35
  import * as Common from '../../core/common/common.js';
36
36
  import * as i18n from '../../core/i18n/i18n.js';
37
37
  import * as SDK from '../../core/sdk/sdk.js';
38
+ import * as CodeHighlighter from '../../ui/components/code_highlighter/code_highlighter.js';
38
39
  import * as UI from '../../ui/legacy/legacy.js';
39
40
 
40
41
  import {linkifyDeferredNodeReference} from './DOMLinkifier.js';
@@ -105,7 +106,8 @@ export class ElementsTreeOutline extends
105
106
  this.treeElementByNode = new WeakMap();
106
107
  const shadowContainer = document.createElement('div');
107
108
  this.shadowRoot = UI.Utils.createShadowRootWithCoreStyles(
108
- shadowContainer, {cssFile: [elementsTreeOutlineStyles], delegatesFocus: undefined});
109
+ shadowContainer,
110
+ {cssFile: [elementsTreeOutlineStyles, CodeHighlighter.Style.default], delegatesFocus: undefined});
109
111
  const outlineDisclosureElement = this.shadowRoot.createChild('div', 'elements-disclosure');
110
112
 
111
113
  this.elementInternal = this.element;
@@ -4,6 +4,7 @@
4
4
 
5
5
  import * as Common from '../../../core/common/common.js';
6
6
  import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
7
+ import * as UI from '../../../ui/legacy/legacy.js';
7
8
  import * as LitHtml from '../../../ui/lit-html/lit-html.js';
8
9
 
9
10
  import type {BooleanSetting, EnumSetting, Setting} from './LayoutPaneUtils.js';
@@ -53,6 +54,10 @@ const UIStrings = {
53
54
  *@description Text in the Layout panel, when no flexbox elements are found
54
55
  */
55
56
  noFlexboxLayoutsFoundOnThisPage: 'No flexbox layouts found on this page',
57
+ /**
58
+ *@description Screen reader announcement when opening color picker tool.
59
+ */
60
+ colorPickerOpened: 'Color picker opened.',
56
61
  };
57
62
  const str_ = i18n.i18n.registerUIStrings('panels/elements/components/LayoutPane.ts', UIStrings);
58
63
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -240,6 +245,7 @@ export class LayoutPane extends HTMLElement {
240
245
  const target = event.target as HTMLLabelElement;
241
246
  const input = target.querySelector('input') as HTMLInputElement;
242
247
  input.click();
248
+ UI.ARIAUtils.alert(i18nString(UIStrings.colorPickerOpened));
243
249
  event.preventDefault();
244
250
  };
245
251
  const onColorLabelKeyDown = (event: KeyboardEvent): void => {
@@ -31,7 +31,6 @@
31
31
  flex: 1 1;
32
32
  overflow: auto;
33
33
  padding: 2px 0 0 0;
34
- background-color: var(--color-background);
35
34
  }
36
35
 
37
36
  .style-panes-wrapper {
@@ -314,10 +314,6 @@ select {
314
314
  }
315
315
  /** Guide line */
316
316
 
317
- li.selected {
318
- z-index: 0;
319
- }
320
-
321
317
  li.hovered:not(.always-parent) + ol.children,
322
318
  .elements-tree-outline ol.shadow-root,
323
319
  li.selected:not(.always-parent) + ol.children {
@@ -363,42 +363,48 @@ const STORAGE_TYPE_NAMES = new Map([
363
363
  export const Presets: Preset[] = [
364
364
  // configID maps to Lighthouse's Object.keys(config.categories)[0] value
365
365
  {
366
- setting: Common.Settings.Settings.instance().createSetting('lighthouse.cat_perf', true),
366
+ setting: Common.Settings.Settings.instance().createSetting(
367
+ 'lighthouse.cat_perf', true, Common.Settings.SettingStorageType.Synced),
367
368
  configID: 'performance',
368
369
  title: i18nLazyString(UIStrings.performance),
369
370
  description: i18nLazyString(UIStrings.howLongDoesThisAppTakeToShow),
370
371
  plugin: false,
371
372
  },
372
373
  {
373
- setting: Common.Settings.Settings.instance().createSetting('lighthouse.cat_pwa', true),
374
+ setting: Common.Settings.Settings.instance().createSetting(
375
+ 'lighthouse.cat_pwa', true, Common.Settings.SettingStorageType.Synced),
374
376
  configID: 'pwa',
375
377
  title: i18nLazyString(UIStrings.progressiveWebApp),
376
378
  description: i18nLazyString(UIStrings.doesThisPageMeetTheStandardOfA),
377
379
  plugin: false,
378
380
  },
379
381
  {
380
- setting: Common.Settings.Settings.instance().createSetting('lighthouse.cat_best_practices', true),
382
+ setting: Common.Settings.Settings.instance().createSetting(
383
+ 'lighthouse.cat_best_practices', true, Common.Settings.SettingStorageType.Synced),
381
384
  configID: 'best-practices',
382
385
  title: i18nLazyString(UIStrings.bestPractices),
383
386
  description: i18nLazyString(UIStrings.doesThisPageFollowBestPractices),
384
387
  plugin: false,
385
388
  },
386
389
  {
387
- setting: Common.Settings.Settings.instance().createSetting('lighthouse.cat_a11y', true),
390
+ setting: Common.Settings.Settings.instance().createSetting(
391
+ 'lighthouse.cat_a11y', true, Common.Settings.SettingStorageType.Synced),
388
392
  configID: 'accessibility',
389
393
  title: i18nLazyString(UIStrings.accessibility),
390
394
  description: i18nLazyString(UIStrings.isThisPageUsableByPeopleWith),
391
395
  plugin: false,
392
396
  },
393
397
  {
394
- setting: Common.Settings.Settings.instance().createSetting('lighthouse.cat_seo', true),
398
+ setting: Common.Settings.Settings.instance().createSetting(
399
+ 'lighthouse.cat_seo', true, Common.Settings.SettingStorageType.Synced),
395
400
  configID: 'seo',
396
401
  title: i18nLazyString(UIStrings.seo),
397
402
  description: i18nLazyString(UIStrings.isThisPageOptimizedForSearch),
398
403
  plugin: false,
399
404
  },
400
405
  {
401
- setting: Common.Settings.Settings.instance().createSetting('lighthouse.cat_pubads', false),
406
+ setting: Common.Settings.Settings.instance().createSetting(
407
+ 'lighthouse.cat_pubads', false, Common.Settings.SettingStorageType.Synced),
402
408
  plugin: true,
403
409
  configID: 'lighthouse-plugin-publisher-ads',
404
410
  title: i18nLazyString(UIStrings.publisherAds),
@@ -412,7 +418,8 @@ export type Flags = {
412
418
 
413
419
  export const RuntimeSettings: RuntimeSetting[] = [
414
420
  {
415
- setting: Common.Settings.Settings.instance().createSetting('lighthouse.device_type', 'mobile'),
421
+ setting: Common.Settings.Settings.instance().createSetting(
422
+ 'lighthouse.device_type', 'mobile', Common.Settings.SettingStorageType.Synced),
416
423
  title: i18nLazyString(UIStrings.applyMobileEmulation),
417
424
  description: i18nLazyString(UIStrings.applyMobileEmulationDuring),
418
425
  setFlags: (flags: Flags, value: string|boolean): void => {
@@ -427,7 +434,8 @@ export const RuntimeSettings: RuntimeSetting[] = [
427
434
  },
428
435
  {
429
436
  // This setting is disabled, but we keep it around to show in the UI.
430
- setting: Common.Settings.Settings.instance().createSetting('lighthouse.throttling', true),
437
+ setting: Common.Settings.Settings.instance().createSetting(
438
+ 'lighthouse.throttling', true, Common.Settings.SettingStorageType.Synced),
431
439
  title: i18nLazyString(UIStrings.simulatedThrottling),
432
440
  // We will disable this when we have a Lantern trace viewer within DevTools.
433
441
  learnMore:
@@ -439,7 +447,8 @@ export const RuntimeSettings: RuntimeSetting[] = [
439
447
  options: undefined,
440
448
  },
441
449
  {
442
- setting: Common.Settings.Settings.instance().createSetting('lighthouse.clear_storage', true),
450
+ setting: Common.Settings.Settings.instance().createSetting(
451
+ 'lighthouse.clear_storage', true, Common.Settings.SettingStorageType.Synced),
443
452
  title: i18nLazyString(UIStrings.clearStorage),
444
453
  description: i18nLazyString(UIStrings.resetStorageLocalstorage),
445
454
  setFlags: (flags: Flags, value: string|boolean): void => {
@@ -185,8 +185,8 @@ export class LighthousePanel extends UI.Panel.Panel {
185
185
  this.settingsPane.show(this.contentElement);
186
186
  this.settingsPane.element.classList.add('lighthouse-settings-pane');
187
187
  this.settingsPane.element.appendChild(this.startView.settingsToolbar().element);
188
- this.showSettingsPaneSetting =
189
- Common.Settings.Settings.instance().createSetting('lighthouseShowSettingsToolbar', false);
188
+ this.showSettingsPaneSetting = Common.Settings.Settings.instance().createSetting(
189
+ 'lighthouseShowSettingsToolbar', false, Common.Settings.SettingStorageType.Synced);
190
190
 
191
191
  this.rightToolbar = new UI.Toolbar.Toolbar('', lighthouseToolbarContainer);
192
192
  this.rightToolbar.appendSeparator();
@@ -90,8 +90,13 @@ export class ProtocolService {
90
90
 
91
91
  private initWorker(): Promise<Worker> {
92
92
  this.lighthouseWorkerPromise = new Promise<Worker>(resolve => {
93
- const worker = new Worker(
94
- new URL('../../entrypoints/lighthouse_worker/lighthouse_worker.js', import.meta.url), {type: 'module'});
93
+ const workerUrl = new URL('../../entrypoints/lighthouse_worker/lighthouse_worker.js', import.meta.url);
94
+ const remoteBaseSearchParam = new URL(self.location.href).searchParams.get('remoteBase');
95
+ if (remoteBaseSearchParam) {
96
+ // Allows Lighthouse worker to fetch remote locale files.
97
+ workerUrl.searchParams.set('remoteBase', remoteBaseSearchParam);
98
+ }
99
+ const worker = new Worker(workerUrl, {type: 'module'});
95
100
 
96
101
  worker.addEventListener('message', event => {
97
102
  if (event.data === 'workerReady') {
@@ -135,18 +135,20 @@ export class BlockedURLsPane extends UI.Widget.VBox implements
135
135
  this.list.addNewItem(0, {url: '', enabled: true});
136
136
  }
137
137
 
138
- renderItem(pattern: SDK.NetworkManager.BlockedPattern, _editable: boolean): Element {
138
+ renderItem(pattern: SDK.NetworkManager.BlockedPattern, editable: boolean): Element {
139
139
  const count = this.blockedRequestsCount(pattern.url);
140
140
  const element = document.createElement('div');
141
141
  element.classList.add('blocked-url');
142
142
  const checkbox = (element.createChild('input', 'blocked-url-checkbox') as HTMLInputElement);
143
143
  checkbox.type = 'checkbox';
144
144
  checkbox.checked = pattern.enabled;
145
- checkbox.disabled = !this.manager.blockingEnabled();
145
+ checkbox.disabled = !editable;
146
146
  element.createChild('div', 'blocked-url-label').textContent = pattern.url;
147
147
  element.createChild('div', 'blocked-url-count').textContent = i18nString(UIStrings.dBlocked, {PH1: count});
148
- element.addEventListener('click', event => this.togglePattern(pattern, event));
149
- checkbox.addEventListener('click', event => this.togglePattern(pattern, event));
148
+ if (editable) {
149
+ element.addEventListener('click', event => this.togglePattern(pattern, event));
150
+ checkbox.addEventListener('click', event => this.togglePattern(pattern, event));
151
+ }
150
152
  return element;
151
153
  }
152
154
 
@@ -226,10 +228,11 @@ export class BlockedURLsPane extends UI.Widget.VBox implements
226
228
  private update(): Promise<void> {
227
229
  const enabled = this.manager.blockingEnabled();
228
230
  this.list.element.classList.toggle('blocking-disabled', !enabled && Boolean(this.manager.blockedPatterns().length));
231
+
229
232
  this.enabledCheckbox.setChecked(enabled);
230
233
  this.list.clear();
231
234
  for (const pattern of this.manager.blockedPatterns()) {
232
- this.list.appendItem(pattern, true);
235
+ this.list.appendItem(pattern, enabled);
233
236
  }
234
237
  return Promise.resolve();
235
238
  }
@@ -10,7 +10,6 @@
10
10
  }
11
11
 
12
12
  .blocking-disabled {
13
- pointer-events: none;
14
13
  opacity: 80%;
15
14
  }
16
15
 
@@ -440,8 +440,6 @@ export class SearchView extends UI.Widget.VBox {
440
440
  }
441
441
 
442
442
  private onAction(): void {
443
- // Resetting alert variable to prime for next search query result.
444
- UI.ARIAUtils.alert(' ');
445
443
  const searchConfig = this.buildSearchConfig();
446
444
  if (!searchConfig.query() || !searchConfig.query().length) {
447
445
  return;