chrome-devtools-frontend 1.0.952865 → 1.0.953165

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.
@@ -16,13 +16,13 @@ ToggleFonts.init();
16
16
  // This can be used by tests to hide the UI elements that are part of the component docs interface.
17
17
  // E.g., this is useful for screenshot tests.
18
18
  window.addEventListener('hidecomponentdocsui', () => {
19
- for (const node of document.querySelectorAll('.component-docs-ui')) {
20
- (node as HTMLElement).style.display = 'none';
19
+ for (const node of document.querySelectorAll<HTMLElement>('.component-docs-ui')) {
20
+ node.style.display = 'none';
21
21
  }
22
22
  });
23
23
 
24
24
  window.addEventListener('showcomponentdocsui', () => {
25
- for (const node of document.querySelectorAll('.component-docs-ui')) {
26
- (node as HTMLElement).style.display = '';
25
+ for (const node of document.querySelectorAll<HTMLElement>('.component-docs-ui')) {
26
+ node.style.display = '';
27
27
  }
28
28
  });
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright 2021 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
+ body {
8
+ margin: 0;
9
+ padding: 0;
10
+ font-family: ".SFNSDisplay-Regular", "Helvetica Neue", "Lucida Grande", sans-serif;
11
+ }
12
+
13
+ #index-page h1 {
14
+ text-align: left;
15
+ border-bottom: 1px solid var(--color-details-hairline);
16
+ padding: 10px;
17
+ width: 100%;
18
+ margin-bottom: 10px;
19
+ }
20
+
21
+ .components-list {
22
+ display: flex;
23
+ flex-wrap: wrap;
24
+ list-style: none;
25
+ margin: 0;
26
+ padding: 10px;
27
+ }
28
+
29
+ .components-list li {
30
+ width: 20%;
31
+ min-width: 150px;
32
+ max-width: 300px;
33
+ margin: 0 12px 12px 0;
34
+ }
35
+
36
+ .components-list a {
37
+ display: block;
38
+ padding: 10px;
39
+ }
40
+
41
+ .components-list a:link,
42
+ .components-list a:visited {
43
+ text-transform: capitalize;
44
+ color: var(--color-primary);
45
+ text-decoration: none;
46
+ box-shadow: var(--drop-shadow);
47
+ }
48
+
49
+ .components-list a:hover {
50
+ box-shadow: var(--drop-shadow-depth-3);
51
+ }
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.952865"
56
+ "version": "1.0.953165"
57
57
  }
@@ -15,7 +15,7 @@ const parseOptions = {
15
15
  range: true,
16
16
  };
17
17
 
18
- const USER_METRICS_ENUM_ENDPOINT = '__lastValidEnumPosition';
18
+ const USER_METRICS_ENUM_ENDPOINT = 'MaxValue';
19
19
 
20
20
  /**
21
21
  * Determines if a node is a class declaration.
@@ -162,8 +162,7 @@ function getMainImplExperimentList(mainImplFile, experimentNames) {
162
162
  * Determines if AST Node is the DevtoolsExperiments Enum declaration
163
163
  */
164
164
  function isExperimentEnumDeclaration(node) {
165
- return node.type === 'ExportNamedDeclaration' && node.declaration.declarations &&
166
- node.declaration.declarations[0].id.name === 'DevtoolsExperiments';
165
+ return node.type === 'ExportNamedDeclaration' && node?.declaration?.id?.name === 'DevtoolsExperiments';
167
166
  }
168
167
 
169
168
  /**
@@ -173,9 +172,7 @@ function getUserMetricExperimentList(userMetricsFile) {
173
172
  const userMetricsAST = espree.parse(userMetricsFile, {ecmaVersion: 11, sourceType: 'module', range: true});
174
173
  for (const node of userMetricsAST.body) {
175
174
  if (isExperimentEnumDeclaration(node)) {
176
- return node.declaration.declarations[0].init.properties.map(property => {
177
- return property.key.value;
178
- });
175
+ return node.declaration.members.map(member => member.id.value);
179
176
  }
180
177
  }
181
178
  return null;
@@ -150,20 +150,12 @@ 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
- <style>
154
- a:link, a:visited {
155
- color: blue;
156
- text-transform: capitalize;
157
- text-decoration: none;
158
- }
159
- a:hover {
160
- text-decoration: underline;
161
- }
162
- </style>
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" />
163
155
  </head>
164
- <body>
156
+ <body id="index-page">
165
157
  <h1>DevTools components</h1>
166
- <ul>
158
+ <ul class="components-list">
167
159
  ${componentNames.map(name => {
168
160
  const niceName = name.replace(/_/g, ' ');
169
161
  return `<li><a href='/front_end/ui/components/docs/${name}'>${niceName}</a></li>`;
@@ -0,0 +1,32 @@
1
+ // Copyright 2020 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
+ 'use strict';
5
+
6
+ module.exports = {
7
+ meta: {
8
+ type: 'problem',
9
+ docs: {
10
+ description: 'check arguments when recording enumerated histograms',
11
+ category: 'Possible Errors',
12
+ },
13
+ fixable: 'code',
14
+ schema: [] // no options
15
+ },
16
+ create: function(context) {
17
+ return {
18
+ CallExpression(node) {
19
+ if (node?.callee?.object?.name === 'InspectorFrontendHostInstance' &&
20
+ node.callee.property.name === 'recordEnumeratedHistogram') {
21
+ if (node?.arguments[2]?.property?.name !== 'MaxValue') {
22
+ context.report({
23
+ node: node,
24
+ message:
25
+ 'When calling \'recordEnumeratedHistogram\' the third argument should be of the form \'SomeEnum.MaxValue\'.'
26
+ });
27
+ }
28
+ }
29
+ }
30
+ };
31
+ }
32
+ };
@@ -0,0 +1,32 @@
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
+ 'use strict';
5
+
6
+ const rule = require('../lib/check_enumerated_histograms.js');
7
+ const ruleTester = new (require('eslint').RuleTester)({
8
+ parserOptions: {ecmaVersion: 9, sourceType: 'module'},
9
+ parser: require.resolve('@typescript-eslint/parser'),
10
+ });
11
+
12
+ ruleTester.run('check_enumerated_histograms', rule, {
13
+ valid: [
14
+ {
15
+ code: 'InspectorFrontendHostInstance.recordEnumeratedHistogram(\'someparam\', 1, foo.MaxValue);',
16
+ filename: 'front_end/components/test.ts',
17
+ },
18
+ {
19
+ code:
20
+ 'InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.IssueCreated, issueCreated, IssueCreated.MaxValue);',
21
+ filename: 'front_end/components/test.ts'
22
+ }
23
+ ],
24
+ invalid: [{
25
+ code: 'InspectorFrontendHostInstance.recordEnumeratedHistogram(\'someparam\', 1, 5);',
26
+ filename: 'front_end/components/test.ts',
27
+ errors: [{
28
+ message:
29
+ 'When calling \'recordEnumeratedHistogram\' the third argument should be of the form \'SomeEnum.MaxValue\'.'
30
+ }],
31
+ }]
32
+ });