chrome-devtools-frontend 1.0.928589 → 1.0.929998

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 (64) hide show
  1. package/config/gni/devtools_grd_files.gni +7 -2
  2. package/config/gni/devtools_image_files.gni +1 -0
  3. package/front_end/Images/src/preview_feature_video_thumbnail.svg +92 -0
  4. package/front_end/Images/whatsnew.avif +0 -0
  5. package/front_end/core/common/CharacterIdMap.ts +12 -12
  6. package/front_end/core/common/Color.ts +71 -71
  7. package/front_end/core/common/Console.ts +4 -4
  8. package/front_end/core/common/ParsedURL.ts +14 -14
  9. package/front_end/core/common/Progress.ts +45 -45
  10. package/front_end/core/common/ResolverBase.ts +8 -8
  11. package/front_end/core/common/ResourceType.ts +20 -20
  12. package/front_end/core/common/SegmentedRange.ts +17 -16
  13. package/front_end/core/common/Settings.ts +84 -66
  14. package/front_end/core/common/SimpleHistoryManager.ts +33 -33
  15. package/front_end/core/common/StringOutputStream.ts +4 -4
  16. package/front_end/core/common/Throttler.ts +44 -40
  17. package/front_end/core/common/Trie.ts +42 -42
  18. package/front_end/core/common/WasmDisassembly.ts +11 -11
  19. package/front_end/core/common/Worker.ts +9 -9
  20. package/front_end/core/host/InspectorFrontendHost.ts +13 -13
  21. package/front_end/core/host/UserMetrics.ts +12 -13
  22. package/front_end/core/i18n/locales/en-US.json +53 -20
  23. package/front_end/core/i18n/locales/en-XL.json +53 -20
  24. package/front_end/core/platform/keyboard-utilities.ts +6 -0
  25. package/front_end/core/sdk/sdk-meta.ts +5 -0
  26. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +1 -0
  27. package/front_end/entrypoints/main/MainImpl.ts +14 -5
  28. package/front_end/entrypoints/main/main-meta.ts +4 -0
  29. package/front_end/models/issues_manager/IssuesManager.ts +2 -2
  30. package/front_end/panels/application/BackForwardCacheView.ts +19 -31
  31. package/front_end/panels/application/components/OriginTrialTreeView.ts +16 -0
  32. package/front_end/panels/console/console-meta.ts +6 -0
  33. package/front_end/panels/css_overview/CSSOverviewPanel.ts +9 -6
  34. package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +171 -0
  35. package/front_end/panels/css_overview/components/components.ts +9 -0
  36. package/front_end/panels/css_overview/components/cssOverviewStartView.css +134 -0
  37. package/front_end/panels/css_overview/css_overview-meta.ts +2 -1
  38. package/front_end/panels/css_overview/css_overview.ts +0 -3
  39. package/front_end/panels/elements/ElementsTreeElement.ts +9 -0
  40. package/front_end/panels/elements/components/LayoutPane.ts +1 -1
  41. package/front_end/panels/elements/elements-meta.ts +1 -0
  42. package/front_end/panels/elements/layoutPane.css +1 -1
  43. package/front_end/panels/event_listeners/EventListenersView.ts +9 -0
  44. package/front_end/panels/help/ReleaseNoteText.ts +29 -0
  45. package/front_end/panels/help/help-meta.ts +1 -0
  46. package/front_end/panels/issues/IssueKindView.ts +36 -0
  47. package/front_end/panels/issues/IssueView.ts +19 -4
  48. package/front_end/panels/issues/IssuesPane.ts +2 -3
  49. package/front_end/panels/issues/components/HideIssuesMenu.ts +11 -40
  50. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +11 -0
  51. package/front_end/panels/sources/DebuggerPlugin.ts +23 -4
  52. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +1 -1
  53. package/front_end/ui/components/helpers/get-stylesheet.ts +4 -0
  54. package/front_end/ui/components/text_prompt/TextPrompt.ts +21 -19
  55. package/front_end/ui/components/text_prompt/textPrompt.css +20 -9
  56. package/front_end/ui/legacy/Infobar.ts +1 -0
  57. package/front_end/ui/legacy/components/inline_editor/CSSLength.ts +4 -2
  58. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +17 -7
  59. package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +6 -6
  60. package/front_end/ui/legacy/tabbedPane.css +9 -0
  61. package/package.json +1 -1
  62. package/scripts/javascript_natives/index.js +31 -25
  63. package/front_end/panels/css_overview/CSSOverviewStartView.ts +0 -55
  64. package/front_end/panels/css_overview/cssOverviewStartView.css +0 -29
@@ -0,0 +1,171 @@
1
+ // Copyright 2019 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as i18n from '../../../core/i18n/i18n.js';
6
+ import * as Buttons from '../../../ui/components/buttons/buttons.js';
7
+ import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
8
+ import * as IconButton from '../../../ui/components/icon_button/icon_button.js';
9
+ import * as LitHtml from '../../../ui/lit-html/lit-html.js';
10
+
11
+ import cssOverviewStartViewStyles from './cssOverviewStartView.css.js';
12
+
13
+ const UIStrings = {
14
+ /**
15
+ *@description Label for the capture button in the CSS Overview Panel
16
+ */
17
+ captureOverview: 'Capture overview',
18
+ /**
19
+ *@description Header for the summary of CSS Overview
20
+ */
21
+ identifyCSSImprovements: 'Identify potential CSS improvements',
22
+ /**
23
+ *@description First point of the summarized features of CSS Overview
24
+ */
25
+ capturePageCSSOverview: 'Capture an overview of your page’s CSS',
26
+ /**
27
+ *@description Second point of the summarized features of CSS Overview
28
+ */
29
+ identifyCSSImprovementsWithExampleIssues:
30
+ 'Identify potential CSS improvements (e.g. low contrast issues, unused declarations, color or font mismatches)',
31
+ /**
32
+ *@description Third point of the summarized features of CSS Overview
33
+ */
34
+ locateAffectedElements: 'Locate the affected elements in the Elements panel',
35
+ /**
36
+ *@description Title of the "Preview feature" reminder box
37
+ */
38
+ previewFeature: 'Preview feature',
39
+ /**
40
+ *@description Sentence to convey the feature is being actively worked on and we are looking for feedback
41
+ *@example {https://goo.gle/css-overview-feedback} PH1
42
+ */
43
+ activelyWorkingAndLookingForS: 'Our team is actively working on this feature and we are looking for your {PH1}!',
44
+ /**
45
+ *@description Link text of the inline anchor to navigate to a feedback page
46
+ */
47
+ feedbackInline: 'feedback',
48
+ /**
49
+ *@description Title of the section to the quick start video and documentation to CSS Overview panel
50
+ */
51
+ videoAndDocumentation: 'Video and documentation',
52
+ /**
53
+ *@description Title of the link to the quick start video and documentation to CSS Overview panel
54
+ */
55
+ quickStartWithCSSOverview: 'Quick start: get started with the new CSS Overview panel',
56
+ /**
57
+ *@description Link text of the standalone button to navigate to a feedback page
58
+ */
59
+ feedbackStandalone: 'Feedback',
60
+ };
61
+ const str_ = i18n.i18n.registerUIStrings('panels/css_overview/components/CSSOverviewStartView.ts', UIStrings);
62
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
63
+
64
+ const {render, html} = LitHtml;
65
+
66
+ const FEEDBACK_LINK = 'https://goo.gle/css-overview-feedback';
67
+ const DOC_LINK = 'https://developer.chrome.com/docs/devtools/css-overview';
68
+ export class OverviewStartRequestedEvent extends Event {
69
+ static readonly eventName = 'overviewstartrequested';
70
+
71
+ constructor() {
72
+ super(OverviewStartRequestedEvent.eventName);
73
+ }
74
+ }
75
+
76
+ export class CSSOverviewStartView extends HTMLElement {
77
+ static readonly litTagName = LitHtml.literal`devtools-css-overview-start-view`;
78
+ private readonly shadow = this.attachShadow({mode: 'open'});
79
+ #feedbackLink: HTMLAnchorElement;
80
+
81
+ constructor() {
82
+ super();
83
+ this.#feedbackLink = document.createElement('a');
84
+ this.#feedbackLink.href = FEEDBACK_LINK;
85
+ this.#feedbackLink.target = '_blank';
86
+ this.#feedbackLink.innerText = i18nString(UIStrings.feedbackInline);
87
+ }
88
+
89
+ connectedCallback(): void {
90
+ this.shadow.adoptedStyleSheets = [cssOverviewStartViewStyles];
91
+ this.render();
92
+ }
93
+
94
+ show(): void {
95
+ this.classList.remove('hidden');
96
+ }
97
+
98
+ hide(): void {
99
+ this.classList.add('hidden');
100
+ }
101
+
102
+ private onStartCaptureClick(): void {
103
+ this.dispatchEvent(new OverviewStartRequestedEvent());
104
+ }
105
+
106
+ private render(): void {
107
+ // Disabled until https://crbug.com/1079231 is fixed.
108
+ // clang-format off
109
+ render(html`
110
+ <div class="css-overview-start-view">
111
+ <h1 class="summary-header">${i18nString(UIStrings.identifyCSSImprovements)}</h1>
112
+ <ol class="summary-list">
113
+ <li>${i18nString(UIStrings.capturePageCSSOverview)}</li>
114
+ <li>${i18nString(UIStrings.identifyCSSImprovementsWithExampleIssues)}</li>
115
+ <li>${i18nString(UIStrings.locateAffectedElements)}</li>
116
+ </ol>
117
+ <div class="start-capture-wrapper">
118
+ <${Buttons.Button.Button.litTagName}
119
+ class="start-capture"
120
+ .variant=${Buttons.Button.Variant.PRIMARY}
121
+ @click=${this.onStartCaptureClick}>
122
+ ${i18nString(UIStrings.captureOverview)}
123
+ </${Buttons.Button.Button.litTagName}>
124
+ </div>
125
+ <section class="preview-feature">
126
+ <h1 class="preview-header">
127
+ <${IconButton.Icon.Icon.litTagName} class="preview-icon" .data=${{
128
+ iconName: 'ic_preview_feature',
129
+ width: '24px',
130
+ height: '24px',
131
+ color: 'var(--color-primary)',
132
+ } as IconButton.Icon.IconData}></${IconButton.Icon.Icon.litTagName}>
133
+ ${i18nString(UIStrings.previewFeature)}
134
+ </h1>
135
+ <div class="feedback-prompt">${i18n.i18n.getFormatLocalizedString(str_, UIStrings.activelyWorkingAndLookingForS, {PH1: this.#feedbackLink})}</div>
136
+ <div class="resources">
137
+ <div class="thumbnail-wrapper">
138
+ <${IconButton.Icon.Icon.litTagName} .data=${{
139
+ iconName: 'preview_feature_video_thumbnail',
140
+ width: '144px',
141
+ height: '92px',
142
+ } as IconButton.Icon.IconData}></${IconButton.Icon.Icon.litTagName}>
143
+ </div>
144
+ <div>
145
+ <h1 class="video-doc-header">${i18nString(UIStrings.videoAndDocumentation)}</h1>
146
+ <a href=${DOC_LINK} target="_blank">${i18nString(UIStrings.quickStartWithCSSOverview)}</a>
147
+ </div>
148
+ </div>
149
+ </section>
150
+ <a class="feedback-standalone" href=${FEEDBACK_LINK} target="_blank">${i18nString(UIStrings.feedbackStandalone)}</a>
151
+ </div>
152
+ `, this.shadow, {
153
+ host: this,
154
+ });
155
+ // clang-format on
156
+
157
+ const startButton = this.shadow.querySelector<HTMLElement>('.start-capture');
158
+ if (startButton) {
159
+ startButton.focus();
160
+ }
161
+ }
162
+ }
163
+
164
+ ComponentHelpers.CustomElements.defineComponent('devtools-css-overview-start-view', CSSOverviewStartView);
165
+
166
+ declare global {
167
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
168
+ interface HTMLElementTagNameMap {
169
+ 'devtools-css-overview-start-view': CSSOverviewStartView;
170
+ }
171
+ }
@@ -0,0 +1,9 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as CSSOverviewStartView from './CSSOverviewStartView.js';
6
+
7
+ export {
8
+ CSSOverviewStartView,
9
+ };
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Copyright 2019 The Chromium Authors. All rights reserved.
3
+ * Use of this source code is governed by a BSD-style license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ h1 {
8
+ font-weight: normal;
9
+ }
10
+
11
+ .css-overview-start-view {
12
+ padding: 24px;
13
+ height: 100%;
14
+ display: flex;
15
+ flex-direction: column;
16
+ background-color: var(--color-background);
17
+ }
18
+
19
+ .summary-header {
20
+ color: var(--color-text-primary);
21
+ font-size: 18px;
22
+ font-weight: normal;
23
+ letter-spacing: 0.02em;
24
+ line-height: 1.33;
25
+ margin: 0;
26
+ padding: 0;
27
+ }
28
+
29
+ .summary-list {
30
+ counter-reset: custom-counter;
31
+ list-style: none;
32
+ margin: 16px 0 30px 30px;
33
+ padding: 0;
34
+ }
35
+
36
+ .summary-list li {
37
+ color: var(--color-text-primary);
38
+ counter-increment: custom-counter;
39
+ font-size: 13px;
40
+ letter-spacing: 0.03em;
41
+ line-height: 1.54;
42
+ margin-bottom: 9px;
43
+ position: relative;
44
+ }
45
+
46
+ .summary-list li::before {
47
+ --override-color-counter-background: rgba(26 115 232 / 25%);
48
+
49
+ box-sizing: border-box;
50
+ background: var(--override-color-counter-background);
51
+ border-radius: 50%;
52
+ color: var(--color-primary);
53
+ content: counter(custom-counter);
54
+ font-size: 12px;
55
+ height: 18px;
56
+ left: -30px;
57
+ line-height: 20px;
58
+ position: absolute;
59
+ text-align: center;
60
+ top: 0;
61
+ width: 18px;
62
+ display: flex;
63
+ align-items: center;
64
+ justify-content: center;
65
+ }
66
+
67
+ .start-capture-wrapper {
68
+ width: fit-content;
69
+ }
70
+
71
+ .preview-feature {
72
+ padding: 12px 16px;
73
+ border: 1px solid var(--color-details-hairline);
74
+ color: var(--color-text-primary);
75
+ font-size: 13px;
76
+ line-height: 20px;
77
+ border-radius: 12px;
78
+ margin: 42px 0;
79
+ letter-spacing: 0.01em;
80
+ }
81
+
82
+ .preview-header {
83
+ color: var(--color-primary);
84
+ font-size: 13px;
85
+ line-height: 20px;
86
+ letter-spacing: 0.01em;
87
+ margin: 9px 0 14px 0;
88
+ }
89
+
90
+ .preview-icon {
91
+ vertical-align: middle;
92
+ }
93
+
94
+ .feedback-prompt {
95
+ margin-bottom: 24px;
96
+ }
97
+
98
+ .resources {
99
+ display: flex;
100
+ flex-direction: row;
101
+ }
102
+
103
+ .thumbnail-wrapper {
104
+ width: 144px;
105
+ height: 92px;
106
+ margin-right: 20px;
107
+ }
108
+
109
+ .video-doc-header {
110
+ font-size: 13px;
111
+ line-height: 20px;
112
+ letter-spacing: 0.04em;
113
+ color: var(--color-text-primary);
114
+ margin-bottom: 2px;
115
+ }
116
+
117
+ .feedback-standalone {
118
+ width: fit-content;
119
+ padding: 0.5em;
120
+ align-self: flex-end;
121
+ color: var(--color-primary);
122
+ border: 1px solid var(--color-details-hairline);
123
+ border-radius: 2px;
124
+ text-decoration: none;
125
+ font-weight: bold;
126
+ }
127
+
128
+ .resources a {
129
+ font-size: 14px;
130
+ line-height: 22px;
131
+ letter-spacing: 0.04em;
132
+ text-decoration-line: underline;
133
+ color: var(--color-primary);
134
+ }
@@ -40,9 +40,10 @@ UI.ViewManager.registerViewExtension({
40
40
  commandPrompt: i18nLazyString(UIStrings.showCssOverview),
41
41
  title: i18nLazyString(UIStrings.cssOverview),
42
42
  order: 95,
43
+ persistence: UI.ViewManager.ViewPersistence.CLOSEABLE,
43
44
  async loadView() {
44
45
  const CSSOverview = await loadCSSOverviewModule();
45
46
  return CSSOverview.CSSOverviewPanel.CSSOverviewPanel.instance();
46
47
  },
47
- experiment: Root.Runtime.ExperimentName.CSS_OVERVIEW,
48
+ isPreviewFeature: true,
48
49
  });
@@ -5,7 +5,6 @@
5
5
  import './CSSOverviewController.js';
6
6
  import './CSSOverviewUnusedDeclarations.js';
7
7
  import './CSSOverviewModel.js';
8
- import './CSSOverviewStartView.js';
9
8
  import './CSSOverviewProcessingView.js';
10
9
  import './CSSOverviewCompletedView.js';
11
10
  import './CSSOverviewSidebarPanel.js';
@@ -17,7 +16,6 @@ import * as CSSOverviewModel from './CSSOverviewModel.js';
17
16
  import * as CSSOverviewPanel from './CSSOverviewPanel.js';
18
17
  import * as CSSOverviewProcessingView from './CSSOverviewProcessingView.js';
19
18
  import * as CSSOverviewSidebarPanel from './CSSOverviewSidebarPanel.js';
20
- import * as CSSOverviewStartView from './CSSOverviewStartView.js';
21
19
  import * as CSSOverviewUnusedDeclarations from './CSSOverviewUnusedDeclarations.js';
22
20
 
23
21
  export {
@@ -27,6 +25,5 @@ export {
27
25
  CSSOverviewPanel,
28
26
  CSSOverviewProcessingView,
29
27
  CSSOverviewSidebarPanel,
30
- CSSOverviewStartView,
31
28
  CSSOverviewUnusedDeclarations,
32
29
  };
@@ -676,9 +676,13 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
676
676
  populateNodeContextMenu(contextMenu: UI.ContextMenu.ContextMenu): void {
677
677
  // Add free-form node-related actions.
678
678
  const isEditable = this.hasEditableNode();
679
+ // clang-format off
679
680
  if (isEditable && !this.editing) {
681
+ // Eagerly load CodeMirror to avoid a delay when opening the "Edit as HTML" editor when the user actually clicks on it
682
+ import('../../ui/components/text_editor/text_editor.js');
680
683
  contextMenu.editSection().appendItem(i18nString(UIStrings.editAsHtml), this.editAsHTML.bind(this));
681
684
  }
685
+ // clang-format on
682
686
  const isShadowRoot = this.nodeInternal.isShadowRoot();
683
687
 
684
688
  const createShortcut = UI.KeyboardShortcut.KeyboardShortcut.shortcutToString.bind(null);
@@ -1015,6 +1019,11 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
1015
1019
  }
1016
1020
  // Append editor.
1017
1021
  this.listItemElement.appendChild(this.htmlEditElement);
1022
+ this.htmlEditElement.addEventListener('keydown', event => {
1023
+ if (event.key === 'Escape') {
1024
+ event.consume(true);
1025
+ }
1026
+ });
1018
1027
 
1019
1028
  const TextEditor = await import('../../ui/components/text_editor/text_editor.js');
1020
1029
  const CodeMirror = await import('../../third_party/codemirror.next/codemirror.next.js');
@@ -251,7 +251,7 @@ export class LayoutPane extends HTMLElement {
251
251
  // Disabled until https://crbug.com/1079231 is fixed.
252
252
  // clang-format off
253
253
  return html`<div class="element">
254
- <label data-element="true" class="checkbox-label" title=${element.name}>
254
+ <label data-element="true" class="checkbox-label">
255
255
  <input data-input="true" type="checkbox" .checked=${element.enabled} @change=${onElementToggle} />
256
256
  <span class="node-text-container" data-label="true" @mouseenter=${onMouseEnter} @mouseleave=${onMouseLeave}>
257
257
  <${NodeText.litTagName} .data=${{
@@ -450,6 +450,7 @@ Common.Settings.registerSettingExtension({
450
450
 
451
451
  Common.Settings.registerSettingExtension({
452
452
  category: Common.Settings.SettingCategory.ADORNER,
453
+ storageType: Common.Settings.SettingStorageType.Synced,
453
454
  settingName: 'adornerSettings',
454
455
  settingType: Common.Settings.SettingType.ARRAY,
455
456
  defaultValue: [],
@@ -144,7 +144,7 @@
144
144
  }
145
145
 
146
146
  .color-picker {
147
- visibility: hidden;
147
+ opacity: 0%;
148
148
  }
149
149
 
150
150
  .color-picker-label {
@@ -389,4 +389,13 @@ export class ObjectEventListenerBar extends UI.TreeOutline.TreeElement {
389
389
 
390
390
  return false;
391
391
  }
392
+
393
+ ondelete(): boolean {
394
+ if (this.eventListenerInternal.canRemove()) {
395
+ this.removeListener();
396
+ return true;
397
+ }
398
+
399
+ return false;
400
+ }
392
401
  }
@@ -35,6 +35,35 @@ function getLocalizedReleaseNoteURL(url: string): string {
35
35
  }
36
36
 
37
37
  export const releaseNoteText: ReleaseNote[] = [
38
+ {
39
+ version: 38,
40
+ header: 'Highlights from the Chrome 96 update',
41
+ highlights: [
42
+ {
43
+ title: 'New preview feature: CSS Overview panel',
44
+ subtitle: 'Use the CSS overview panel to identify CSS improvements on your page.',
45
+ link: getLocalizedReleaseNoteURL('https://developer.chrome.com/blog/new-in-devtools-96/#css-overview'),
46
+ },
47
+ {
48
+ title: 'Enable emulating prefers-contrast media and auto dark mode',
49
+ subtitle:
50
+ 'Emulate the user preference on using a different contrast mode for the page and Chrome’s auto dark mode.',
51
+ link: getLocalizedReleaseNoteURL('https://developer.chrome.com/blog/new-in-devtools-96/#emulation'),
52
+ },
53
+ {
54
+ title: 'New Payload tab in the Network panel',
55
+ subtitle: 'A new Payload tab is available when you click to inspect a network request.',
56
+ link: getLocalizedReleaseNoteURL('https://developer.chrome.com/blog/new-in-devtools-96/#payload'),
57
+ },
58
+ {
59
+ title: 'Option to hide CORS errors in the Console',
60
+ subtitle:
61
+ 'Now that CORS errors are reported in the Issues tab, you can hide CORS errors in the Console to reduce clutter.',
62
+ link: getLocalizedReleaseNoteURL('https://developer.chrome.com/blog/new-in-devtools-96/#hide-cors-errors'),
63
+ },
64
+ ],
65
+ link: getLocalizedReleaseNoteURL('https://developer.chrome.com/blog/new-in-devtools-96'),
66
+ },
38
67
  {
39
68
  version: 37,
40
69
  header: 'Highlights from the Chrome 95 update',
@@ -105,6 +105,7 @@ UI.ActionRegistration.registerActionExtension({
105
105
 
106
106
  Common.Settings.registerSettingExtension({
107
107
  category: Common.Settings.SettingCategory.APPEARANCE,
108
+ storageType: Common.Settings.SettingStorageType.Synced,
108
109
  title: i18nLazyString(UIStrings.showWhatsNewAfterEachUpdate),
109
110
  settingName: 'help.show-release-note',
110
111
  settingType: Common.Settings.SettingType.BOOLEAN,
@@ -3,12 +3,25 @@
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 IssuesManager from '../../models/issues_manager/issues_manager.js';
7
8
  import * as Adorners from '../../ui/components/adorners/adorners.js';
8
9
  import * as IconButton from '../../ui/components/icon_button/icon_button.js';
9
10
  import * as IssueCounter from '../../ui/components/issue_counter/issue_counter.js';
10
11
  import * as UI from '../../ui/legacy/legacy.js';
11
12
 
13
+ import * as Components from './components/components.js';
14
+
15
+ const UIStrings = {
16
+ /**
17
+ * @description Menu entry for hiding all current issues belonging to a particular kind.
18
+ * @example {Page Errors} PH1
19
+ */
20
+ hideAllCurrent: 'Hide all current {PH1}',
21
+ };
22
+ const str_ = i18n.i18n.registerUIStrings('panels/issues/IssueKindView.ts', UIStrings);
23
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
24
+
12
25
  export function getGroupIssuesByKindSetting(): Common.Settings.Setting<boolean> {
13
26
  return Common.Settings.Settings.instance().createSetting('groupIssuesByKind', false);
14
27
  }
@@ -77,9 +90,32 @@ export class IssueKindView extends UI.TreeOutline.TreeElement {
77
90
  title.classList.add('title');
78
91
  title.textContent = IssuesManager.Issue.getIssueKindName(this.kind);
79
92
 
93
+ const hideAvailableIssuesBtn = new Components.HideIssuesMenu.HideIssuesMenu();
94
+ hideAvailableIssuesBtn.classList.add('hide-available-issues');
95
+ hideAvailableIssuesBtn.data = {
96
+ menuItemLabel: i18nString(UIStrings.hideAllCurrent, {PH1: IssuesManager.Issue.getIssueKindName(this.kind)}),
97
+ menuItemAction: (): void => {
98
+ const setting = IssuesManager.IssuesManager.getHideIssueByCodeSetting();
99
+ const values = setting.get();
100
+ for (const issue of IssuesManager.IssuesManager.IssuesManager.instance().issues()) {
101
+ if (issue.getKind() === this.kind) {
102
+ values[issue.code()] = IssuesManager.IssuesManager.IssueStatus.Hidden;
103
+ }
104
+ }
105
+ setting.set(values);
106
+ },
107
+ };
108
+
80
109
  header.appendChild(issueKindIcon);
81
110
  header.appendChild(countAdorner);
82
111
  header.appendChild(title);
112
+ header.appendChild(hideAvailableIssuesBtn);
113
+ header.addEventListener('mouseenter', () => {
114
+ hideAvailableIssuesBtn.setVisible(true);
115
+ });
116
+ header.addEventListener('mouseleave', () => {
117
+ hideAvailableIssuesBtn.setVisible(false);
118
+ });
83
119
 
84
120
  this.listItemElement.appendChild(header);
85
121
  }
@@ -72,9 +72,17 @@ const UIStrings = {
72
72
  */
73
73
  learnMoreS: 'Learn more: {PH1}',
74
74
  /**
75
- *@description The kind of resolution for a mixed content issue
76
- */
75
+ *@description The kind of resolution for a mixed content issue
76
+ */
77
77
  automaticallyUpgraded: 'automatically upgraded',
78
+ /**
79
+ *@description Menu entry for hiding a particular issue, in the Hide Issues context menu.
80
+ */
81
+ hideIssuesLikeThis: 'Hide issues like this',
82
+ /**
83
+ *@description Menu entry for unhiding a particular issue, in the Hide Issues context menu.
84
+ */
85
+ unhideIssuesLikeThis: 'Unhide issues like this',
78
86
  };
79
87
  const str_ = i18n.i18n.registerUIStrings('panels/issues/IssueView.ts', UIStrings);
80
88
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -371,8 +379,15 @@ export class IssueView extends UI.TreeOutline.TreeElement {
371
379
  }
372
380
  this.listItemElement.classList.toggle('hidden-issue', this.issue.isHidden());
373
381
  const data: HiddenIssuesMenuData = {
374
- issueCode: this.issue.code(),
375
- forHiddenIssue: this.issue.isHidden(),
382
+ menuItemLabel: this.issue.isHidden() ? i18nString(UIStrings.unhideIssuesLikeThis) :
383
+ i18nString(UIStrings.hideIssuesLikeThis),
384
+ menuItemAction: () => {
385
+ const setting = IssuesManager.IssuesManager.getHideIssueByCodeSetting();
386
+ const values = setting.get();
387
+ values[this.issue.code()] = this.issue.isHidden() ? IssuesManager.IssuesManager.IssueStatus.Unhidden :
388
+ IssuesManager.IssuesManager.IssueStatus.Hidden;
389
+ setting.set(values);
390
+ },
376
391
  };
377
392
  this.hiddenIssuesMenu.data = data;
378
393
  }
@@ -405,8 +405,7 @@ export class IssuesPane extends UI.Widget.VBox {
405
405
 
406
406
  private updateIssueKindViewsCount(): void {
407
407
  for (const view of this.kindViews.values()) {
408
- const count =
409
- this.issuesManager.numberOfIssues(view.getKind()) - this.issuesManager.numberOfHiddenIssues(view.getKind());
408
+ const count = this.issuesManager.numberOfIssues(view.getKind());
410
409
  view.update(count);
411
410
  }
412
411
  }
@@ -421,7 +420,7 @@ export class IssuesPane extends UI.Widget.VBox {
421
420
  }
422
421
 
423
422
  private showIssuesTreeOrNoIssuesDetectedMessage(issuesCount: number, hiddenIssueCount: number): void {
424
- if (issuesCount > 0) {
423
+ if (issuesCount > 0 || hiddenIssueCount > 0) {
425
424
  this.hiddenIssuesRow.hidden = hiddenIssueCount === 0;
426
425
  this.hiddenIssuesRow.update(hiddenIssueCount);
427
426
  this.issuesTree.element.hidden = false;
@@ -3,13 +3,12 @@
3
3
  // Use of this source code is governed by a BSD-style license that can be
4
4
  // found in the LICENSE file.
5
5
 
6
- import type * as Common from '../../../core/common/common.js';
6
+ import * as Common from '../../../core/common/common.js';
7
+ import * as i18n from '../../../core/i18n/i18n.js';
7
8
  import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
8
9
  import * as IconButton from '../../../ui/components/icon_button/icon_button.js';
9
- import * as IssuesManager from '../../../models/issues_manager/issues_manager.js';
10
- import * as i18n from '../../../core/i18n/i18n.js';
11
- import * as LitHtml from '../../../ui/lit-html/lit-html.js';
12
10
  import * as UI from '../../../ui/legacy/legacy.js';
11
+ import * as LitHtml from '../../../ui/lit-html/lit-html.js';
13
12
 
14
13
  import hideIssuesMenuStyles from './hideIssuesMenu.css.js';
15
14
 
@@ -17,38 +16,27 @@ const UIStrings = {
17
16
  /**
18
17
  *@description Title for the tooltip of the (3 dots) Hide Issues menu icon.
19
18
  */
20
- tooltipTitle: 'Hide issues menu',
21
- /**
22
- *@description Menu entry for hiding a particular issue, in the Hide Issues context menu.
23
- */
24
- hideIssueByCode: 'Hide issues like this',
25
- /**
26
- *@description Menu entry for Unhiding a particular issue, in the Hide Issues context menu.
27
- */
28
- UnhideIssueByCode: 'Unhide issues like this',
19
+ tooltipTitle: 'Hide issues',
29
20
  };
30
21
 
31
22
  const str_ = i18n.i18n.registerUIStrings('panels/issues/components/HideIssuesMenu.ts', UIStrings);
32
23
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
33
24
 
34
25
  export interface HiddenIssuesMenuData {
35
- issueCode: string;
36
- forHiddenIssue: boolean;
26
+ menuItemLabel: Common.UIString.LocalizedString;
27
+ menuItemAction: () => void;
37
28
  }
38
29
 
39
30
  export class HideIssuesMenu extends HTMLElement {
40
31
  static readonly litTagName = LitHtml.literal`devtools-hide-issues-menu`;
41
32
  private readonly shadow: ShadowRoot = this.attachShadow({mode: 'open'});
42
- private code: string = '';
43
33
  private visible: boolean = false;
44
- private hideIssueSetting: Common.Settings.Setting<IssuesManager.IssuesManager.HideIssueMenuSetting> =
45
- IssuesManager.IssuesManager.getHideIssueByCodeSetting();
46
- private forHiddenIssue: boolean = false;
34
+ private menuItemLabel: Common.UIString.LocalizedString = Common.UIString.LocalizedEmptyString;
35
+ private menuItemAction: () => void = () => {};
47
36
 
48
37
  set data(data: HiddenIssuesMenuData) {
49
- this.classList.add('hide-issues-menu');
50
- this.code = data.issueCode;
51
- this.forHiddenIssue = data.forHiddenIssue;
38
+ this.menuItemLabel = data.menuItemLabel;
39
+ this.menuItemAction = data.menuItemAction;
52
40
  this.render();
53
41
  }
54
42
 
@@ -67,27 +55,10 @@ export class HideIssuesMenu extends HTMLElement {
67
55
  onMenuOpen(event: Event): void {
68
56
  event.stopPropagation();
69
57
  const contextMenu = new UI.ContextMenu.ContextMenu(event, {useSoftMenu: true});
70
- if (this.forHiddenIssue) {
71
- contextMenu.headerSection().appendItem(i18nString(UIStrings.UnhideIssueByCode), () => this.onUnhideIssueByCode());
72
- contextMenu.show();
73
- return;
74
- }
75
- contextMenu.headerSection().appendItem(i18nString(UIStrings.hideIssueByCode), () => this.onHideIssueByCode());
58
+ contextMenu.headerSection().appendItem(this.menuItemLabel, () => this.menuItemAction());
76
59
  contextMenu.show();
77
60
  }
78
61
 
79
- onHideIssueByCode(): void {
80
- const values = this.hideIssueSetting.get();
81
- values[this.code] = IssuesManager.IssuesManager.IssueStatus.Hidden;
82
- this.hideIssueSetting.set(values);
83
- }
84
-
85
- onUnhideIssueByCode(): void {
86
- const values = this.hideIssueSetting.get();
87
- values[this.code] = IssuesManager.IssuesManager.IssueStatus.Unhidden;
88
- this.hideIssueSetting.set(values);
89
- }
90
-
91
62
  private render(): void {
92
63
  this.classList.toggle('hidden', !this.visible);
93
64
  // Disabled until https://crbug.com/1079231 is fixed.