chrome-devtools-frontend 1.0.955630 → 1.0.956060

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
@@ -13,6 +13,7 @@
13
13
  # BEGIN individuals section.
14
14
  Ajay Panthagani <ajaypanthagani321@gmail.com>
15
15
  Alexander Stammbach <alexander@stammbach.io>
16
+ Alexey Rodionov <fluorescent.hallucinogen@gmail.com>
16
17
  Ankit Mishra <ankit.mishra131990@gmail.com>
17
18
  Anna Agoha <annaagoha@gmail.com>
18
19
  Anthony Xie <anthonyxie64@gmail.com>
@@ -116,17 +116,7 @@ module.exports = {
116
116
  'format': ['camelCase'],
117
117
  'leadingUnderscore': 'allow',
118
118
  }
119
- ],
120
- 'no-restricted-syntax': [
121
- 'warn', {
122
- // Matches the common pattern of `.registerRequiredCSS('path\to\module-styles.css');`.
123
- 'selector':
124
- 'CallExpression[callee.property.name="registerRequiredCSS"][arguments.length=1]:has(Literal[value=/css$/])',
125
- 'message': 'Styles should be imported using `import styles from \'[file name].css(.legacy).js\';` and' +
126
- // Intentional double periods.. since trailing period is stripped from output.
127
- ' registered using `.registerCSSFiles([styles]);` or `.registerRequiredCSS(legacyStyles);` syntax..',
128
- }
129
- ],
119
+ ]
130
120
  }
131
121
  },
132
122
  {
@@ -1047,6 +1047,7 @@ declare namespace Protocol {
1047
1047
  * https://www.chromestatus.com/feature/5684870116278272 for more details."
1048
1048
  */
1049
1049
  message?: string;
1050
+ deprecationType: string;
1050
1051
  }
1051
1052
 
1052
1053
  export const enum ClientHintIssueReason {
@@ -3,7 +3,6 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  /// <reference path="./request_idle_callback.d.ts" />
6
- /// <reference path="./intl_display_names.d.ts" />
7
6
 
8
7
  interface CSSStyleSheet {
9
8
  replaceSync(content: string): void;
@@ -3,20 +3,20 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import type * as SDK from '../../core/sdk/sdk.js';
6
- import type * as Protocol from '../../generated/protocol.js';
6
+ import * as Protocol from '../../generated/protocol.js';
7
7
 
8
8
  import {Issue, IssueCategory, IssueKind} from './Issue.js';
9
9
  import type {MarkdownIssueDescription} from './MarkdownIssueDescription.js';
10
10
 
11
- export const enum IssueCode {
12
- DeprecationIssue = 'DeprecationIssue',
13
- }
14
-
15
- export class DeprecationIssue extends Issue<IssueCode> {
11
+ export class DeprecationIssue extends Issue {
16
12
  #issueDetails: Protocol.Audits.DeprecationIssueDetails;
17
13
 
18
14
  constructor(issueDetails: Protocol.Audits.DeprecationIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel) {
19
- super(IssueCode.DeprecationIssue, issuesModel);
15
+ const issueCode = [
16
+ Protocol.Audits.InspectorIssueCode.DeprecationIssue,
17
+ issueDetails.deprecationType,
18
+ ].join('::');
19
+ super({code: issueCode, umaCode: 'DeprecationIssue'}, issuesModel);
20
20
  this.#issueDetails = issueDetails;
21
21
  }
22
22
 
@@ -237,13 +237,14 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
237
237
  private searchHighlightsVisible?: boolean;
238
238
  selectionElement?: HTMLDivElement;
239
239
  private hintElement?: HTMLElement;
240
+ private contentElement: HTMLElement;
240
241
 
241
242
  constructor(node: SDK.DOMModel.DOMNode, isClosingTag?: boolean) {
242
243
  // The title will be updated in onattach.
243
244
  super();
244
245
  this.nodeInternal = node;
245
246
  this.treeOutline = null;
246
-
247
+ this.contentElement = this.listItemElement.createChild('div');
247
248
  this.gutterContainer = this.contentElement.createChild('div', 'gutter-container');
248
249
  this.gutterContainer.addEventListener('click', this.showContextMenu.bind(this));
249
250
  const gutterMenuIcon = UI.Icon.Icon.create('largeicon-menu', 'gutter-menu-icon');
@@ -1303,11 +1304,11 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
1303
1304
  this.childrenListElement.classList.add('shadow-root-depth-' + depth);
1304
1305
  }
1305
1306
  }
1306
- const highlightElement = document.createElement('span');
1307
- highlightElement.className = 'highlight';
1307
+ this.contentElement.removeChildren();
1308
+ const highlightElement = this.contentElement.createChild('span', 'highlight');
1308
1309
  highlightElement.append(nodeInfo);
1309
1310
  // fixme: make it clear that `this.title = x` is a setter with significant side effects
1310
- this.title = highlightElement;
1311
+ this.title = this.contentElement;
1311
1312
  this.updateDecorations();
1312
1313
  this.contentElement.prepend(this.gutterContainer);
1313
1314
  if (!this.isClosingTagInternal && this.adornerContainer) {
@@ -566,7 +566,7 @@ export class SourcesPanel extends UI.Panel.Panel implements UI.ContextMenu.Provi
566
566
  const enabled = Common.Settings.Settings.instance().moduleSetting('pauseOnExceptionEnabled').get();
567
567
  const button = (this.pauseOnExceptionButton as UI.Toolbar.ToolbarToggle);
568
568
  button.setToggled(enabled);
569
- button.setTitle(enabled ? i18nString(UIStrings.pauseOnExceptions) : i18nString(UIStrings.dontPauseOnExceptions));
569
+ button.setTitle(enabled ? i18nString(UIStrings.dontPauseOnExceptions) : i18nString(UIStrings.pauseOnExceptions));
570
570
  this.debugToolbarDrawer.classList.toggle('expanded', enabled);
571
571
  }
572
572
 
@@ -56,7 +56,6 @@ export class GlassPane {
56
56
  }
57
57
 
58
58
  registerRequiredCSS(cssFile: {cssContent: string}): void {
59
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
60
59
  this.widgetInternal.registerRequiredCSS(cssFile);
61
60
  }
62
61
 
@@ -432,7 +432,6 @@ export class TreeElement {
432
432
  private readonly boundOnFocus: () => void;
433
433
  private readonly boundOnBlur: () => void;
434
434
  readonly listItemNode: HTMLLIElement;
435
- readonly contentNode: HTMLElement;
436
435
  titleElement: Node;
437
436
  titleInternal: string|Node;
438
437
  private childrenInternal: TreeElement[]|null;
@@ -459,10 +458,8 @@ export class TreeElement {
459
458
  this.boundOnFocus = this.onFocus.bind(this);
460
459
  this.boundOnBlur = this.onBlur.bind(this);
461
460
  this.listItemNode = document.createElement('li');
462
- this.contentNode = this.listItemElement.createChild('div');
463
- this.contentNode.classList.add('tree-element-content');
464
461
 
465
- this.titleElement = this.contentNode.createChild('span', 'tree-element-title');
462
+ this.titleElement = this.listItemNode.createChild('span', 'tree-element-title');
466
463
  treeElementBylistItemNode.set(this.listItemNode, this);
467
464
  this.titleInternal = '';
468
465
  if (title) {
@@ -732,10 +729,6 @@ export class TreeElement {
732
729
  return this.listItemNode;
733
730
  }
734
731
 
735
- get contentElement(): HTMLElement {
736
- return this.contentNode;
737
- }
738
-
739
732
  get childrenListElement(): HTMLOListElement {
740
733
  return this.childrenListNode;
741
734
  }
@@ -758,13 +751,13 @@ export class TreeElement {
758
751
  this.tooltip = '';
759
752
  }
760
753
 
761
- this.contentNode.removeChildren();
754
+ this.listItemNode.removeChildren();
762
755
  if (this.leadingIconsElement) {
763
- this.contentNode.appendChild(this.leadingIconsElement);
756
+ this.listItemNode.appendChild(this.leadingIconsElement);
764
757
  }
765
- this.contentNode.appendChild(this.titleElement);
758
+ this.listItemNode.appendChild(this.titleElement);
766
759
  if (this.trailingIconsElement) {
767
- this.contentNode.appendChild(this.trailingIconsElement);
760
+ this.listItemNode.appendChild(this.trailingIconsElement);
768
761
  }
769
762
  this.ensureSelection();
770
763
  }
@@ -794,7 +787,7 @@ export class TreeElement {
794
787
  this.leadingIconsElement = document.createElement('div');
795
788
  this.leadingIconsElement.classList.add('leading-icons');
796
789
  this.leadingIconsElement.classList.add('icons-container');
797
- this.contentNode.insertBefore(this.leadingIconsElement, this.titleElement);
790
+ this.listItemNode.insertBefore(this.leadingIconsElement, this.titleElement);
798
791
  this.ensureSelection();
799
792
  }
800
793
  this.leadingIconsElement.removeChildren();
@@ -811,7 +804,7 @@ export class TreeElement {
811
804
  this.trailingIconsElement = document.createElement('div');
812
805
  this.trailingIconsElement.classList.add('trailing-icons');
813
806
  this.trailingIconsElement.classList.add('icons-container');
814
- this.contentNode.appendChild(this.trailingIconsElement);
807
+ this.listItemNode.appendChild(this.trailingIconsElement);
815
808
  this.ensureSelection();
816
809
  }
817
810
  this.trailingIconsElement.removeChildren();
@@ -141,9 +141,9 @@ export function installDragHandle(
141
141
  }
142
142
 
143
143
  let startTimer: number|null;
144
- element.addEventListener('mousedown', onMouseDown, false);
144
+ element.addEventListener('pointerdown', onMouseDown, false);
145
145
  if (startDelay) {
146
- element.addEventListener('mouseup', onMouseUp, false);
146
+ element.addEventListener('pointerup', onMouseUp, false);
147
147
  }
148
148
  if (hoverCursor !== null) {
149
149
  (element as HTMLElement).style.cursor = hoverCursor || cursor || '';
@@ -233,12 +233,12 @@ class DragHandler {
233
233
  this.dragEventsTargetDocumentTop = this.dragEventsTargetDocument;
234
234
  }
235
235
 
236
- targetDocument.addEventListener('mousemove', this.elementDragMove, true);
237
- targetDocument.addEventListener('mouseup', this.elementDragEnd, true);
236
+ targetDocument.addEventListener('pointermove', this.elementDragMove, true);
237
+ targetDocument.addEventListener('pointerup', this.elementDragEnd, true);
238
238
  DragHandler.rootForMouseOut &&
239
- DragHandler.rootForMouseOut.addEventListener('mouseout', this.mouseOutWhileDragging, {capture: true});
239
+ DragHandler.rootForMouseOut.addEventListener('pointerout', this.mouseOutWhileDragging, {capture: true});
240
240
  if (this.dragEventsTargetDocumentTop && targetDocument !== this.dragEventsTargetDocumentTop) {
241
- this.dragEventsTargetDocumentTop.addEventListener('mouseup', this.elementDragEnd, true);
241
+ this.dragEventsTargetDocumentTop.addEventListener('pointerup', this.elementDragEnd, true);
242
242
  }
243
243
 
244
244
  const targetHtmlElement = (targetElement as HTMLElement);
@@ -264,17 +264,17 @@ class DragHandler {
264
264
  if (!DragHandler.rootForMouseOut) {
265
265
  return;
266
266
  }
267
- DragHandler.rootForMouseOut.removeEventListener('mouseout', this.mouseOutWhileDragging, {capture: true});
267
+ DragHandler.rootForMouseOut.removeEventListener('pointerout', this.mouseOutWhileDragging, {capture: true});
268
268
  }
269
269
 
270
270
  private unregisterDragEvents(): void {
271
271
  if (!this.dragEventsTargetDocument) {
272
272
  return;
273
273
  }
274
- this.dragEventsTargetDocument.removeEventListener('mousemove', this.elementDragMove, true);
275
- this.dragEventsTargetDocument.removeEventListener('mouseup', this.elementDragEnd, true);
274
+ this.dragEventsTargetDocument.removeEventListener('pointermove', this.elementDragMove, true);
275
+ this.dragEventsTargetDocument.removeEventListener('pointerup', this.elementDragEnd, true);
276
276
  if (this.dragEventsTargetDocumentTop && this.dragEventsTargetDocument !== this.dragEventsTargetDocumentTop) {
277
- this.dragEventsTargetDocumentTop.removeEventListener('mouseup', this.elementDragEnd, true);
277
+ this.dragEventsTargetDocumentTop.removeEventListener('pointerup', this.elementDragEnd, true);
278
278
  }
279
279
  delete this.dragEventsTargetDocument;
280
280
  delete this.dragEventsTargetDocumentTop;
@@ -993,9 +993,9 @@ export class LongClickController {
993
993
 
994
994
  this.element.addEventListener('keydown', boundKeyDown, false);
995
995
  this.element.addEventListener('keyup', boundKeyUp, false);
996
- this.element.addEventListener('mousedown', boundMouseDown, false);
997
- this.element.addEventListener('mouseout', boundReset, false);
998
- this.element.addEventListener('mouseup', boundMouseUp, false);
996
+ this.element.addEventListener('pointerdown', boundMouseDown, false);
997
+ this.element.addEventListener('pointerout', boundReset, false);
998
+ this.element.addEventListener('pointerup', boundMouseUp, false);
999
999
  this.element.addEventListener('click', boundReset, true);
1000
1000
 
1001
1001
  this.longClickData = {mouseUp: boundMouseUp, mouseDown: boundMouseDown, reset: boundReset};
@@ -1033,9 +1033,9 @@ export class LongClickController {
1033
1033
  if (!this.longClickData) {
1034
1034
  return;
1035
1035
  }
1036
- this.element.removeEventListener('mousedown', this.longClickData.mouseDown, false);
1037
- this.element.removeEventListener('mouseout', this.longClickData.reset, false);
1038
- this.element.removeEventListener('mouseup', this.longClickData.mouseUp, false);
1036
+ this.element.removeEventListener('poinerdown', this.longClickData.mouseDown, false);
1037
+ this.element.removeEventListener('pointerout', this.longClickData.reset, false);
1038
+ this.element.removeEventListener('pointerup', this.longClickData.mouseUp, false);
1039
1039
  this.element.addEventListener('click', this.longClickData.reset, true);
1040
1040
  delete this.longClickData;
1041
1041
  }
@@ -267,14 +267,14 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
267
267
  UI.ARIAUtils.markAsButton(displaySwitcher);
268
268
 
269
269
  UI.UIUtils.installDragHandle(
270
- this.hueElement, this.dragStart.bind(this, positionHue.bind(this)), positionHue.bind(this), null, 'pointer',
271
- 'default');
270
+ this.hueElement, this.dragStart.bind(this, positionHue.bind(this)), positionHue.bind(this), null, 'ew-resize',
271
+ 'crosshair');
272
272
  UI.UIUtils.installDragHandle(
273
273
  this.alphaElement, this.dragStart.bind(this, positionAlpha.bind(this)), positionAlpha.bind(this), null,
274
- 'pointer', 'default');
274
+ 'ew-resize', 'crosshair');
275
275
  UI.UIUtils.installDragHandle(
276
- this.colorElement, this.dragStart.bind(this, positionColor.bind(this)), positionColor.bind(this), null,
277
- 'pointer', 'default');
276
+ this.colorElement, this.dragStart.bind(this, positionColor.bind(this)), positionColor.bind(this), null, 'move',
277
+ 'crosshair');
278
278
 
279
279
  // Color contrast business.
280
280
  if (contrastInfo) {
@@ -25,6 +25,7 @@
25
25
  border-radius: 2px 2px 0 0;
26
26
  overflow: hidden;
27
27
  flex: none;
28
+ touch-action: none;
28
29
  }
29
30
 
30
31
  .spectrum-dragger,
@@ -37,7 +38,8 @@
37
38
  height: 12px;
38
39
  width: 12px;
39
40
  border: 1px solid var(--color-background);
40
- cursor: pointer;
41
+ cursor: move;
42
+ z-index: 1;
41
43
  position: absolute;
42
44
  top: 0;
43
45
  left: 0;
@@ -48,7 +50,7 @@
48
50
  .spectrum-slider {
49
51
  position: absolute;
50
52
  top: -1px;
51
- cursor: pointer;
53
+ cursor: ew-resize;
52
54
  width: 13px;
53
55
  height: 13px;
54
56
  border-radius: 13px;
@@ -90,6 +92,7 @@
90
92
  width: 130px;
91
93
  height: 11px;
92
94
  border-radius: 2px;
95
+ touch-action: none;
93
96
  }
94
97
 
95
98
  .spectrum-hue:focus-visible .spectrum-slider,
@@ -126,8 +126,6 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
126
126
  private lastMouseOffsetX: number;
127
127
  private selectedGroup: number;
128
128
  private keyboardFocusedGroup: number;
129
- private selectedGroupBackroundColor: string;
130
- private selectedGroupBorderColor: string;
131
129
  private offsetWidth!: number;
132
130
  private offsetHeight!: number;
133
131
  private dragStartX!: number;
@@ -229,11 +227,6 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
229
227
 
230
228
  // Keyboard focused group is used to navigate groups irrespective of whether they are selectable or not
231
229
  this.keyboardFocusedGroup = -1;
232
-
233
- this.selectedGroupBackroundColor = ThemeSupport.ThemeSupport.instance().patchColorText(
234
- Colors.SelectedGroupBackground, ThemeSupport.ThemeSupport.ColorUsage.Background);
235
- this.selectedGroupBorderColor = ThemeSupport.ThemeSupport.instance().patchColorText(
236
- Colors.SelectedGroupBorder, ThemeSupport.ThemeSupport.ColorUsage.Background);
237
230
  }
238
231
 
239
232
  willHide(): void {
@@ -1140,7 +1133,8 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1140
1133
  context.save();
1141
1134
  this.forEachGroupInViewport((offset, index, group, isFirst, groupHeight) => {
1142
1135
  if (this.isGroupFocused(index)) {
1143
- context.fillStyle = this.selectedGroupBackroundColor;
1136
+ context.fillStyle =
1137
+ ThemeSupport.ThemeSupport.instance().getComputedValue('--custom-val-test', this.contentElement);
1144
1138
  context.fillRect(0, offset, width, groupHeight - group.style.padding);
1145
1139
  }
1146
1140
  });
@@ -1563,7 +1557,6 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1563
1557
  return;
1564
1558
  }
1565
1559
  const lastGroupOffset = groupOffsets[groupOffsets.length - 1];
1566
- const colorUsage = ThemeSupport.ThemeSupport.ColorUsage;
1567
1560
 
1568
1561
  context.save();
1569
1562
  context.scale(ratio, ratio);
@@ -1571,7 +1564,7 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1571
1564
  const defaultFont = '11px ' + Host.Platform.fontFamily();
1572
1565
  context.font = defaultFont;
1573
1566
 
1574
- context.fillStyle = ThemeSupport.ThemeSupport.instance().patchColorText('#fff', colorUsage.Background);
1567
+ context.fillStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background');
1575
1568
  this.forEachGroupInViewport((offset, index, group) => {
1576
1569
  const paddingHeight = group.style.padding;
1577
1570
  if (paddingHeight < 5) {
@@ -1583,7 +1576,7 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1583
1576
  context.fillRect(0, lastGroupOffset + 2, width, top + height - lastGroupOffset);
1584
1577
  }
1585
1578
 
1586
- context.strokeStyle = ThemeSupport.ThemeSupport.instance().patchColorText('#eee', colorUsage.Background);
1579
+ context.strokeStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background-elevation-1');
1587
1580
  context.beginPath();
1588
1581
  this.forEachGroupInViewport((offset, index, group, isFirst) => {
1589
1582
  if (isFirst || group.style.padding < 4) {
@@ -1622,7 +1615,8 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1622
1615
  if (this.isGroupCollapsible(index) && !group.expanded || group.style.shareHeaderLine) {
1623
1616
  const width = this.labelWidthForGroup(context, group) + 2;
1624
1617
  if (this.isGroupFocused(index)) {
1625
- context.fillStyle = this.selectedGroupBackroundColor;
1618
+ context.fillStyle =
1619
+ ThemeSupport.ThemeSupport.instance().getComputedValue('--selected-group-background', this.contentElement);
1626
1620
  } else {
1627
1621
  const parsedColor = Common.Color.Color.parse(group.style.backgroundColor);
1628
1622
  if (parsedColor) {
@@ -1641,7 +1635,7 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1641
1635
  });
1642
1636
  context.restore();
1643
1637
 
1644
- context.fillStyle = ThemeSupport.ThemeSupport.instance().patchColorText('#6e6e6e', colorUsage.Foreground);
1638
+ context.fillStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-text-secondary');
1645
1639
  context.beginPath();
1646
1640
  this.forEachGroupInViewport((offset, index, group) => {
1647
1641
  if (this.isGroupCollapsible(index)) {
@@ -1652,7 +1646,7 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1652
1646
  });
1653
1647
  context.fill();
1654
1648
 
1655
- context.strokeStyle = ThemeSupport.ThemeSupport.instance().patchColorText('#ddd', colorUsage.Background);
1649
+ context.strokeStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-details-hairline-light');
1656
1650
  context.beginPath();
1657
1651
  context.stroke();
1658
1652
 
@@ -1660,7 +1654,8 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
1660
1654
  if (this.isGroupFocused(index)) {
1661
1655
  const lineWidth = 2;
1662
1656
  const bracketLength = 10;
1663
- context.fillStyle = this.selectedGroupBorderColor;
1657
+ context.fillStyle =
1658
+ ThemeSupport.ThemeSupport.instance().getComputedValue('--selected-group-border', this.contentElement);
1664
1659
  context.fillRect(0, offset - lineWidth, lineWidth, groupHeight - group.style.padding + 2 * lineWidth);
1665
1660
  context.fillRect(0, offset - lineWidth, bracketLength, lineWidth);
1666
1661
  context.fillRect(0, offset + groupHeight - group.style.padding, bracketLength, lineWidth);
@@ -2326,10 +2321,6 @@ export type EventTypes = {
2326
2321
  [Events.EntryHighlighted]: number,
2327
2322
  };
2328
2323
 
2329
- export const Colors = {
2330
- SelectedGroupBackground: 'hsl(215, 85%, 98%)',
2331
- SelectedGroupBorder: 'hsl(216, 68%, 54%)',
2332
- };
2333
2324
  export interface Group {
2334
2325
  name: Common.UIString.LocalizedString;
2335
2326
  startLevel: number;
@@ -6,6 +6,14 @@
6
6
 
7
7
  .flame-chart-main-pane {
8
8
  overflow: hidden;
9
+
10
+ --selected-group-background: hsl(215deg 85% 98%);
11
+ --selected-group-border: hsl(216deg 68% 54%);
12
+ }
13
+
14
+ :host-context(.-theme-with-dark-background) .flame-chart-main-pane {
15
+ --selected-group-background: hsl(215deg 85% 15%);
16
+ --selected-group-border: hsl(216deg 68% 46%);
9
17
  }
10
18
 
11
19
  .flame-chart-marker-highlight-element {
@@ -61,7 +61,6 @@ export class FontView extends UI.View.SimpleView {
61
61
  private inResize!: boolean|null;
62
62
  constructor(mimeType: string, contentProvider: TextUtils.ContentProvider.ContentProvider) {
63
63
  super(i18nString(UIStrings.font));
64
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
65
64
  this.registerRequiredCSS(fontViewStyles);
66
65
  this.element.classList.add('font-view');
67
66
  this.url = contentProvider.contentURL();
@@ -98,7 +98,6 @@ export class ImageView extends UI.View.SimpleView {
98
98
  private cachedContent?: string|null;
99
99
  constructor(mimeType: string, contentProvider: TextUtils.ContentProvider.ContentProvider) {
100
100
  super(i18nString(UIStrings.image));
101
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
102
101
  this.registerRequiredCSS(imageViewStyles);
103
102
  this.element.tabIndex = -1;
104
103
  this.element.classList.add('image-view');
@@ -56,7 +56,6 @@ export class JSONView extends UI.Widget.VBox implements UI.SearchableView.Search
56
56
  constructor(parsedJSON: ParsedJSON, startCollapsed?: boolean) {
57
57
  super();
58
58
  this.initialized = false;
59
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
60
59
  this.registerRequiredCSS(jsonViewStyles);
61
60
  this.parsedJSON = parsedJSON;
62
61
  this.startCollapsed = Boolean(startCollapsed);
@@ -84,7 +84,6 @@ export class SearchableContainer extends UI.Widget.VBox {
84
84
 
85
85
  constructor(resource: TextUtils.ContentProvider.ContentProvider, contentType: string, autoPrettyPrint?: boolean) {
86
86
  super(true);
87
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
88
87
  this.registerRequiredCSS(resourceSourceFrameStyles);
89
88
  const sourceFrame = new ResourceSourceFrame(resource, contentType);
90
89
  this.sourceFrame = sourceFrame;
@@ -28,11 +28,9 @@ export class XMLView extends UI.Widget.Widget implements UI.SearchableView.Searc
28
28
 
29
29
  constructor(parsedXML: Document) {
30
30
  super(true);
31
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
32
31
  this.registerRequiredCSS(xmlViewStyles);
33
32
  this.contentElement.classList.add('shadow-xml-view', 'source-code');
34
33
  this.treeOutline = new UI.TreeOutline.TreeOutlineInShadow();
35
- // eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
36
34
  this.treeOutline.registerRequiredCSS(xmlTreeStyles);
37
35
  this.contentElement.appendChild(this.treeOutline.element);
38
36
  this.currentSearchFocusIndex = 0;
@@ -236,6 +236,7 @@
236
236
  flex: 0 0 auto;
237
237
  flex-direction: column;
238
238
  padding-top: 10px;
239
+ padding-right: 8px;
239
240
  overflow: hidden;
240
241
  }
241
242
 
@@ -34,7 +34,6 @@
34
34
  */
35
35
 
36
36
  import * as Common from '../../../core/common/common.js';
37
- import * as Platform from '../../../core/platform/platform.js';
38
37
 
39
38
  import inspectorSyntaxHighlightStyles from '../inspectorSyntaxHighlight.css.legacy.js';
40
39
  import inspectorSyntaxHighlightDarkStyles from '../inspectorSyntaxHighlightDark.css.legacy.js';
@@ -45,33 +44,13 @@ const themeValuesCache = new Map<CSSStyleDeclaration, Map<string, string>>();
45
44
 
46
45
  export class ThemeSupport {
47
46
  private readonly themeNameInternal: string;
48
- private themableProperties: Set<string>;
49
- private readonly cachedThemePatches: Map<string, string>;
50
- private readonly setting: Common.Settings.Setting<string>;
51
47
  private readonly customSheets: Set<string>;
52
48
  private readonly computedRoot: () => symbol | CSSStyleDeclaration;
53
- private injectingStyleSheet?: boolean;
54
49
 
55
50
  private constructor(setting: Common.Settings.Setting<string>) {
56
51
  const systemPreferredTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'default';
57
52
  this.themeNameInternal = setting.get() === 'systemPreferred' ? systemPreferredTheme : setting.get();
58
- this.themableProperties = new Set([
59
- 'color',
60
- 'box-shadow',
61
- 'text-shadow',
62
- 'outline-color',
63
- 'background-image',
64
- 'background-color',
65
- 'border-left-color',
66
- 'border-right-color',
67
- 'border-top-color',
68
- 'border-bottom-color',
69
- '-webkit-border-image',
70
- 'fill',
71
- 'stroke',
72
- ]);
73
- this.cachedThemePatches = new Map();
74
- this.setting = setting;
53
+
75
54
  this.customSheets = new Set();
76
55
  this.computedRoot = Common.Lazy.lazy(() => window.getComputedStyle(document.documentElement));
77
56
  }
@@ -139,12 +118,10 @@ export class ThemeSupport {
139
118
  }
140
119
 
141
120
  injectHighlightStyleSheets(element: Element|ShadowRoot): void {
142
- this.injectingStyleSheet = true;
143
121
  this.appendStyle(element, inspectorSyntaxHighlightStyles);
144
122
  if (this.themeNameInternal === 'dark') {
145
123
  this.appendStyle(element, inspectorSyntaxHighlightDarkStyles);
146
124
  }
147
- this.injectingStyleSheet = false;
148
125
  }
149
126
 
150
127
  /**
@@ -174,195 +151,11 @@ export class ThemeSupport {
174
151
  }
175
152
 
176
153
  applyTheme(document: Document): void {
177
- if (!this.hasTheme() || this.isForcedColorsMode()) {
178
- return;
179
- }
180
-
181
- if (this.themeNameInternal === 'dark') {
182
- document.documentElement.classList.add('-theme-with-dark-background');
183
- }
184
-
185
- const styleSheets = document.styleSheets;
186
- const result = [];
187
- for (let i = 0; i < styleSheets.length; ++i) {
188
- const href = styleSheets[i].href;
189
- if (!href) {
190
- continue;
191
- }
192
- result.push(this.patchForTheme(href, (styleSheets[i] as CSSStyleSheet)));
193
- }
194
- result.push('/*# sourceURL=inspector.css.theme */');
195
-
196
- const styleElement = document.createElement('style');
197
- styleElement.textContent = result.join('\n');
198
- document.head.appendChild(styleElement);
199
- }
200
-
201
- themeStyleSheet(id: string, text: string): string {
202
- if (!this.hasTheme() || this.injectingStyleSheet || this.isForcedColorsMode()) {
203
- return '';
204
- }
205
-
206
- let patch = this.cachedThemePatches.get(id);
207
- if (!patch) {
208
- const styleElement = document.createElement('style');
209
- styleElement.textContent = text;
210
- document.body.appendChild(styleElement);
211
-
212
- const {sheet} = styleElement;
213
- if (!sheet) {
214
- throw new Error('No sheet in stylesheet object');
215
- }
216
- patch = this.patchForTheme(id, sheet);
217
- document.body.removeChild(styleElement);
218
- }
219
- return patch;
220
- }
221
-
222
- private patchForTheme(id: string, styleSheet: CSSStyleSheet): string {
223
- const cached = this.cachedThemePatches.get(id);
224
- if (cached) {
225
- return cached;
226
- }
227
-
228
- try {
229
- const rules = styleSheet.cssRules;
230
- const result = [];
231
- for (let j = 0; j < rules.length; ++j) {
232
- const rule = rules[j];
233
- if (rule instanceof CSSImportRule) {
234
- result.push(this.patchForTheme(rule.styleSheet.href || '', rule.styleSheet));
235
- continue;
236
- }
237
-
238
- if (!(rule instanceof CSSStyleRule)) {
239
- continue;
240
- }
241
-
242
- const output: string[] = [];
243
- const style = rule.style;
244
- const selectorText = rule.selectorText;
245
- for (let i = 0; style && i < style.length; ++i) {
246
- this.patchProperty(selectorText, style, style[i], output);
247
- }
248
- if (output.length) {
249
- result.push(rule.selectorText + '{' + output.join('') + '}');
250
- }
251
- }
252
-
253
- const fullText = result.join('\n');
254
- this.cachedThemePatches.set(id, fullText);
255
- return fullText;
256
- } catch (e) {
257
- this.setting.set('default');
258
- return '';
259
- }
260
- }
261
-
262
- /**
263
- * Theming API is primarily targeted at making dark theme look good.
264
- * - If rule has ".-theme-preserve" in selector, it won't be affected.
265
- * - One can create specializations for dark themes via body.-theme-with-dark-background selector in host context.
266
- */
267
- private patchProperty(selectorText: string, style: CSSStyleDeclaration, name: string, output: string[]): void {
268
- if (!this.themableProperties.has(name)) {
269
- return;
270
- }
271
-
272
- const value = style.getPropertyValue(name);
273
- if (!value || value === 'none' || value === 'inherit' || value === 'initial' || value === 'transparent') {
274
- return;
275
- }
276
- if (name === 'background-image' && value.indexOf('gradient') === -1) {
277
- return;
278
- }
279
-
280
- if (selectorText.indexOf('-theme-') !== -1) {
154
+ if (!this.hasTheme() || this.isForcedColorsMode() || this.themeNameInternal !== 'dark') {
281
155
  return;
282
156
  }
283
157
 
284
- let colorUsage = ThemeSupport.ColorUsage.Unknown;
285
- if (name.indexOf('background') === 0 || name.indexOf('border') === 0) {
286
- colorUsage |= ThemeSupport.ColorUsage.Background;
287
- }
288
- if (name.indexOf('background') === -1) {
289
- colorUsage |= ThemeSupport.ColorUsage.Foreground;
290
- }
291
-
292
- output.push(name);
293
- output.push(':');
294
- if (/^var\(.*\)$/.test(value)) {
295
- // Don't translate CSS variables.
296
- output.push(value);
297
- } else {
298
- const items = value.replace(Common.Color.Regex, '\0$1\0').split('\0');
299
- for (const item of items) {
300
- output.push(this.patchColorText(item, (colorUsage as number)));
301
- }
302
- }
303
- if (style.getPropertyPriority(name)) {
304
- output.push(' !important');
305
- }
306
- output.push(';');
307
- }
308
-
309
- /**
310
- * This legacy function has been supeseded by CSS custom properties. Wherever possible, please use
311
- * the values declared in global stylesheets.
312
- *
313
- * @deprecated
314
- */
315
- patchColorText(text: string, colorUsage: number): string {
316
- const color = Common.Color.Color.parse(text);
317
- if (!color) {
318
- return text;
319
- }
320
- const outColor = this.patchColor(color, colorUsage);
321
- let outText = outColor.asString(null);
322
- if (!outText) {
323
- outText = outColor.asString(outColor.hasAlpha() ? Common.Color.Format.RGBA : Common.Color.Format.RGB);
324
- }
325
- return outText || text;
326
- }
327
-
328
- /**
329
- * This legacy function has been supeseded by CSS custom properties. Wherever possible, please use
330
- * the values declared in global stylesheets.
331
- *
332
- * @deprecated
333
- */
334
- patchColor(color: Common.Color.Color, colorUsage: number): Common.Color.Color {
335
- const hsla = color.hsla();
336
- this.patchHSLA(hsla, colorUsage);
337
-
338
- const rgba: number[] = [];
339
- Common.Color.Color.hsl2rgb(hsla, rgba);
340
- return new Common.Color.Color(rgba, color.format());
341
- }
342
-
343
- private patchHSLA(hsla: number[], colorUsage: number): void {
344
- const hue = hsla[0];
345
- const sat = hsla[1];
346
- let lit: number = hsla[2];
347
- const alpha = hsla[3];
348
-
349
- switch (this.themeNameInternal) {
350
- case 'dark': {
351
- const minCap = colorUsage & ThemeSupport.ColorUsage.Background ? 0.14 : 0;
352
- const maxCap = colorUsage & ThemeSupport.ColorUsage.Foreground ? 0.9 : 1;
353
- lit = 1 - lit;
354
- if (lit < minCap * 2) {
355
- lit = minCap + lit / 2;
356
- } else if (lit > 2 * maxCap - 1) {
357
- lit = maxCap - 1 / 2 + lit / 2;
358
- }
359
- break;
360
- }
361
- }
362
- hsla[0] = Platform.NumberUtilities.clamp(hue, 0, 1);
363
- hsla[1] = Platform.NumberUtilities.clamp(sat, 0, 1);
364
- hsla[2] = Platform.NumberUtilities.clamp(lit, 0, 1);
365
- hsla[3] = Platform.NumberUtilities.clamp(alpha, 0, 1);
158
+ document.documentElement.classList.add('-theme-with-dark-background');
366
159
  }
367
160
  }
368
161
  export namespace ThemeSupport {
@@ -93,10 +93,6 @@ ol.tree-outline:not(.hide-selection-when-blurred) li.selected:focus * {
93
93
  color: inherit;
94
94
  }
95
95
 
96
- .tree-outline .tree-element-content {
97
- display: flex;
98
- }
99
-
100
96
  .tree-outline li .icons-container {
101
97
  align-self: center;
102
98
  display: flex;
package/package.json CHANGED
@@ -53,5 +53,5 @@
53
53
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
54
54
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
55
55
  },
56
- "version": "1.0.955630"
56
+ "version": "1.0.956060"
57
57
  }
@@ -150,8 +150,8 @@ function createServerIndexFile(componentNames) {
150
150
  <meta charset="UTF-8" />
151
151
  <meta name="viewport" content="width=device-width" />
152
152
  <title>DevTools components</title>
153
- <link rel="stylesheet" href="/front_end/ui/legacy/themeColors.css" />
154
- <link rel="stylesheet" href="/front_end/ui/components/docs/component_docs_styles.css" />
153
+ <link rel="stylesheet" href="${sharedResourcesBase}front_end/ui/legacy/themeColors.css" />
154
+ <link rel="stylesheet" href="${sharedResourcesBase}front_end/ui/components/docs/component_docs_styles.css" />
155
155
  </head>
156
156
  <body id="index-page">
157
157
  <h1>DevTools components</h1>
@@ -1,111 +0,0 @@
1
- declare namespace Intl {
2
- /**
3
- * An object with properties reflecting the locale
4
- * and styles options computed during initialization
5
- * of the `Intl.DisplayNames` object
6
- *
7
- * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions#Description).
8
- *
9
- * [Specification](https://tc39.es/ecma402/#sec-intl-displaynames-constructor)
10
- */
11
- interface DisplayNamesOptions {
12
- localeMatcher: RelativeTimeFormatLocaleMatcher;
13
- style: RelativeTimeFormatStyle;
14
- type: 'language'|'region'|'script'|'currency';
15
- fallback: 'code'|'none';
16
- }
17
-
18
- interface DisplayNames {
19
- /**
20
- * Receives a code and returns a string based on the locale and options provided when instantiating
21
- * [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
22
- *
23
- * @param code The `code` to provide depends on the `type`:
24
- * - If the type is "region", code should be either an [ISO-3166 two letters region code](https://www.iso.org/iso-3166-country-codes.html),
25
- * or a [three digits UN M49 Geographic Regions](https://unstats.un.org/unsd/methodology/m49/).
26
- * - If the type is "script", code should be an [ISO-15924 four letters script code](https://unicode.org/iso15924/iso15924-codes.html).
27
- * - If the type is "language", code should be a `languageCode` ["-" `scriptCode`] ["-" `regionCode` ] *("-" `variant` )
28
- * subsequence of the unicode_language_id grammar in [UTS 35's Unicode Language and Locale Identifiers grammar](https://unicode.org/reports/tr35/#Unicode_language_identifier).
29
- * `languageCode` is either a two letters ISO 639-1 language code or a three letters ISO 639-2 language code.
30
- * - If the type is "currency", code should be a [3-letter ISO 4217 currency code](https://www.iso.org/iso-4217-currency-codes.html).
31
- *
32
- * @returns A language-specific formatted string.
33
- *
34
- * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/of).
35
- *
36
- * [Specification](https://tc39.es/ecma402/#sec-Intl.DisplayNames.prototype.of).
37
- */
38
- of(code: string): string;
39
- /**
40
- * Returns a new object with properties reflecting the locale and style formatting options computed during the construction of the current
41
- * [`Intl/DisplayNames`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object.
42
- *
43
- * @returns An object with properties reflecting the locale and formatting options computed during the construction of the
44
- * given [`Intl/DisplayNames`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object.
45
- *
46
- * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions).
47
- *
48
- * [Specification](https://tc39.es/ecma402/#sec-Intl.DisplayNames.prototype.resolvedOptions)
49
- */
50
- resolvedOptions(): DisplayNamesOptions;
51
- }
52
-
53
- /**
54
- * The [`Intl.DisplayNames()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
55
- * object enables the consistent translation of language, region and script display names.
56
- *
57
- * Part of [Intl object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl)
58
- * namespace and the [ECMAScript Internationalization API](https://www.ecma-international.org/publications/standards/Ecma-402.htm).
59
- *
60
- * [Compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames#browser_compatibility).
61
- */
62
- const DisplayNames: {
63
- prototype: DisplayNames;
64
-
65
- /**
66
- * Constructor creates [`Intl.DisplayNames`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames)
67
- * objects that enable the consistent translation of language, region and script display names.
68
- *
69
- * @param locales A string with a BCP 47 language tag, or an array of such strings.
70
- * For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)
71
- * page. The following Unicode extension key is allowed:
72
- * - `nu` The numbering system to be used. Possible values include: `"arab"`, `"arabext"`, `"bali"`, `"beng"`, `"deva"`, `"fullwide"`, `"gujr"`, `"guru"`, `"hanidec"`, `"khmr"`, `"knda"`, `"laoo"`, `"latn"`, `"limb"`, `"mlym"`, `"mong"`, `"mymr"`, `"orya"`, `"tamldec"`, `"telu"`, `"thai"`, `"tibt"`.
73
- *
74
- * @param options An object with some or all of the following properties:
75
- * - `localeMatcher` The locale matching algorithm to use. Possible values are `"lookup"` and `"best fit"`; the default is `"best fit"`.
76
- * For information about this option, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation) page.
77
- * - `style` The formatting style to use, the default is `"long"`. `"narrow"` `"short"` `"long"`
78
- * - `type` The type to use. `"language"` `"region"` `"script"` `"currency"`
79
- * - `fallback` The fallback to use, the default is `"code"`. `"code"` `"none"`
80
- *
81
- * @returns [Intl.DisplayNames](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames) object.
82
- *
83
- * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames).
84
- *
85
- * [Specification](https://tc39.es/ecma402/#sec-intl-displaynames-constructor).
86
- */
87
- new (locales?: UnicodeBCP47LocaleIdentifier|UnicodeBCP47LocaleIdentifier[], options?: Partial<DisplayNamesOptions>):
88
- DisplayNames;
89
-
90
- /**
91
- * Returns an array containing those of the provided locales that are supported in display names without having to fall back to the runtime's default locale.
92
- *
93
- * @param locales A string with a BCP 47 language tag, or an array of such strings.
94
- * For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)
95
- * page.
96
- *
97
- * @param options An object that may have the following property:
98
- * - `localeMatcher` The locale matching algorithm to use. Possible values are `"lookup"` and `"best fit"`; the default is `"best fit"`.
99
- * For information about this option, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation) page.
100
- *
101
- * @returns An array of strings representing a subset of the given locale tags that are supported in display names without having to fall back to the runtime's default locale.
102
- *
103
- * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).
104
- *
105
- * [Specification](https://tc39.es/ecma402/#sec-Intl.DisplayNames.supportedLocalesOf).
106
- */
107
- supportedLocalesOf(
108
- locales: UnicodeBCP47LocaleIdentifier|UnicodeBCP47LocaleIdentifier[],
109
- options: {localeMatcher: RelativeTimeFormatLocaleMatcher}): UnicodeBCP47LocaleIdentifier[];
110
- };
111
- }