chrome-devtools-frontend 1.0.975699 → 1.0.976172

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.
package/AUTHORS CHANGED
@@ -29,6 +29,7 @@ Feng Lu <lufengd3@gmail.com>
29
29
  Gabriel Luong <gabriel.luong@gmail.com>
30
30
  Gautham Banasandra <gautham.bangalore@gmail.com>
31
31
  Jake Mulhern <mulherje@gmail.com>
32
+ Jan Keitel <jan.keitel@gmail.com>
32
33
  Jeffrey Chen <jeffreyca16@gmail.com>
33
34
  Jesper van den Ende <jespertheend@gmail.com>
34
35
  Juba Borgohain <chromiumjuba@gmail.com>
@@ -480,6 +480,7 @@ grd_files_release_sources = [
480
480
  "front_end/third_party/wasmparser/wasmparser.js",
481
481
  "front_end/ui/components/adorners/adorners.js",
482
482
  "front_end/ui/components/buttons/buttons.js",
483
+ "front_end/ui/components/chrome_link/chrome_link.js",
483
484
  "front_end/ui/components/code_highlighter/code_highlighter.js",
484
485
  "front_end/ui/components/data_grid/data_grid.js",
485
486
  "front_end/ui/components/diff_view/diff_view.js",
@@ -1400,6 +1401,8 @@ grd_files_debug_sources = [
1400
1401
  "front_end/ui/components/adorners/adorner.css.js",
1401
1402
  "front_end/ui/components/buttons/Button.js",
1402
1403
  "front_end/ui/components/buttons/button.css.js",
1404
+ "front_end/ui/components/chrome_link/ChromeLink.js",
1405
+ "front_end/ui/components/chrome_link/chromeLink.css.js",
1403
1406
  "front_end/ui/components/code_highlighter/CodeHighlighter.js",
1404
1407
  "front_end/ui/components/code_highlighter/codeHighlighter.css.js",
1405
1408
  "front_end/ui/components/data_grid/DataGrid.js",
@@ -1877,7 +1877,7 @@ export function registerCommands(inspectorBackend) {
1877
1877
  // Overlay.
1878
1878
  inspectorBackend.registerEnum('Overlay.LineStylePattern', {Dashed: 'dashed', Dotted: 'dotted'});
1879
1879
  inspectorBackend.registerEnum('Overlay.ContrastAlgorithm', {Aa: 'aa', Aaa: 'aaa', Apca: 'apca'});
1880
- inspectorBackend.registerEnum('Overlay.ColorFormat', {Rgb: 'rgb', Hsl: 'hsl', Hex: 'hex'});
1880
+ inspectorBackend.registerEnum('Overlay.ColorFormat', {Rgb: 'rgb', Hsl: 'hsl', Hwb: 'hwb', Hex: 'hex'});
1881
1881
  inspectorBackend.registerEnum('Overlay.InspectMode', {
1882
1882
  SearchForNode: 'searchForNode',
1883
1883
  SearchForUAShadowDOM: 'searchForUAShadowDOM',
@@ -9587,6 +9587,7 @@ export namespace Overlay {
9587
9587
  export const enum ColorFormat {
9588
9588
  Rgb = 'rgb',
9589
9589
  Hsl = 'hsl',
9590
+ Hwb = 'hwb',
9590
9591
  Hex = 'hex',
9591
9592
  }
9592
9593
 
@@ -8,7 +8,7 @@ import type * as Host from '../../../core/host/host.js';
8
8
  import * as i18n from '../../../core/i18n/i18n.js';
9
9
  import * as LitHtml from '../../../ui/lit-html/lit-html.js';
10
10
  import * as Settings from '../../../ui/components/settings/settings.js';
11
- import * as SDK from '../../../core/sdk/sdk.js';
11
+ import * as ChromeLink from '../../../ui/components/chrome_link/chrome_link.js';
12
12
 
13
13
  import syncSectionStyles from './syncSection.css.js';
14
14
 
@@ -92,9 +92,8 @@ function renderAccountInfoOrWarning(syncInfo: Host.InspectorFrontendHostAPI.Sync
92
92
  // clang-format off
93
93
  return LitHtml.html`
94
94
  <span class="warning">
95
- ${i18nString(UIStrings.syncDisabled)} <a href=${link} class="link" target="_blank"
96
- @click=${(e: Event): void => openSettingsTab(link, e)}
97
- @keydown=${(e: Event): void => openSettingsTab(link, e)}>${i18nString(UIStrings.settings)}</x-link>
95
+ ${i18nString(UIStrings.syncDisabled)}
96
+ <${ChromeLink.ChromeLink.ChromeLink.litTagName} .href=${link}>${i18nString(UIStrings.settings)}</${ChromeLink.ChromeLink.ChromeLink.litTagName}>
98
97
  </span>`;
99
98
  // clang-format on
100
99
  }
@@ -104,9 +103,8 @@ function renderAccountInfoOrWarning(syncInfo: Host.InspectorFrontendHostAPI.Sync
104
103
  // clang-format off
105
104
  return LitHtml.html`
106
105
  <span class="warning">
107
- ${i18nString(UIStrings.preferencesSyncDisabled)} <a href=${link} class="link" target="_blank"
108
- @click=${(e: Event): void => openSettingsTab(link, e)}
109
- @keydown=${(e: Event): void => openSettingsTab(link, e)}>${i18nString(UIStrings.settings)}</x-link>
106
+ ${i18nString(UIStrings.preferencesSyncDisabled)}
107
+ <${ChromeLink.ChromeLink.ChromeLink.litTagName} .href=${link}>${i18nString(UIStrings.settings)}</${ChromeLink.ChromeLink.ChromeLink.litTagName}>
110
108
  </span>`;
111
109
  // clang-format on
112
110
  }
@@ -120,16 +118,6 @@ function renderAccountInfoOrWarning(syncInfo: Host.InspectorFrontendHostAPI.Sync
120
118
  </div>`;
121
119
  }
122
120
 
123
- // Navigating to a chrome:// link via a normal anchor doesn't work, so we "navigate"
124
- // there using CDP.
125
- function openSettingsTab(url: string, event: Event): void {
126
- if (event.type === 'click' || (event.type === 'keydown' && self.isEnterOrSpaceKey(event))) {
127
- const mainTarget = SDK.TargetManager.TargetManager.instance().mainTarget();
128
- mainTarget && mainTarget.targetAgent().invoke_createTarget({url});
129
- event.consume(true);
130
- }
131
- }
132
-
133
121
  ComponentHelpers.CustomElements.defineComponent('devtools-sync-section', SyncSection);
134
122
 
135
123
  declare global {
@@ -0,0 +1,62 @@
1
+ // Copyright 2022 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 SDK from '../../../core/sdk/sdk.js';
6
+ import * as LitHtml from '../../lit-html/lit-html.js';
7
+ import * as ComponentHelpers from '../helpers/helpers.js';
8
+
9
+ import chromeLinkStyles from './chromeLink.css.js';
10
+
11
+ declare global {
12
+ interface HTMLElementTagNameMap {
13
+ 'devtools-chrome-link': ChromeLink;
14
+ }
15
+ }
16
+
17
+ // Use this component to render links to 'chrome://...'-URLs
18
+ // (for which regular <x-link>s do not work).
19
+ export class ChromeLink extends HTMLElement {
20
+ static readonly litTagName = LitHtml.literal`devtools-chrome-link`;
21
+ readonly #shadow = this.attachShadow({mode: 'open'});
22
+ readonly #boundRender = this.#render.bind(this);
23
+ #href: string = '';
24
+
25
+ connectedCallback(): void {
26
+ this.#shadow.adoptedStyleSheets = [chromeLinkStyles];
27
+ void ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
28
+ }
29
+
30
+ set href(href: string) {
31
+ if (!href.startsWith('chrome://')) {
32
+ throw new Error('ChromeLink href needs to start with \'chrome://\'');
33
+ }
34
+ this.#href = href;
35
+ void ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
36
+ }
37
+
38
+ // Navigating to a chrome:// link via a normal anchor doesn't work, so we "navigate"
39
+ // there using CDP.
40
+ openSettingsTab(event: Event): void {
41
+ if (event.type === 'click' || (event.type === 'keydown' && self.isEnterOrSpaceKey(event))) {
42
+ const mainTarget = SDK.TargetManager.TargetManager.instance().mainTarget();
43
+ mainTarget && mainTarget.targetAgent().invoke_createTarget({url: this.#href});
44
+ event.consume(true);
45
+ }
46
+ }
47
+
48
+ #render(): void {
49
+ // clang-format off
50
+ LitHtml.render(
51
+ /* x-link doesn't work with custom click/keydown handlers */
52
+ /* eslint-disable rulesdir/ban_a_tags_in_lit_html */
53
+ LitHtml.html`
54
+ <a href=${this.#href} class="link" target="_blank"
55
+ @click=${this.openSettingsTab}
56
+ @keydown=${this.openSettingsTab}><slot></slot></a>
57
+ `, this.#shadow, {host: this});
58
+ // clang-format on
59
+ }
60
+ }
61
+
62
+ ComponentHelpers.CustomElements.defineComponent('devtools-chrome-link', ChromeLink);
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Copyright 2022 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
+ .link {
8
+ color: var(--color-link);
9
+ text-decoration: underline;
10
+ cursor: pointer;
11
+ padding: 2px 0; /* adjust focus ring size */
12
+ }
@@ -0,0 +1,9 @@
1
+ // Copyright 2022 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 ChromeLink from './ChromeLink.js';
6
+
7
+ export {
8
+ ChromeLink,
9
+ };
package/package.json CHANGED
@@ -54,5 +54,5 @@
54
54
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
55
55
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
56
56
  },
57
- "version": "1.0.975699"
57
+ "version": "1.0.976172"
58
58
  }