lighthouse 8.6.0-dev.20211101 → 8.6.0-dev.20211105
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/dist/report/flow.js +14 -14
- package/dist/report/standalone.js +41 -35
- package/flow-report/.eslintrc.cjs +2 -0
- package/flow-report/assets/standalone-flow-template.html +3 -2
- package/flow-report/assets/styles.css +1 -1
- package/flow-report/src/common.tsx +11 -4
- package/flow-report/src/i18n/i18n.tsx +10 -6
- package/flow-report/src/icons.tsx +30 -9
- package/flow-report/src/sidebar/sidebar.tsx +27 -8
- package/flow-report/src/summary/category.tsx +7 -2
- package/flow-report/src/summary/summary.tsx +9 -3
- package/flow-report/src/util.ts +21 -9
- package/flow-report/src/wrappers/report-renderer.tsx +10 -3
- package/flow-report/src/wrappers/report.tsx +9 -5
- package/flow-report/standalone-flow.tsx +4 -3
- package/flow-report/test/setup/env-setup.ts +1 -1
- package/flow-report/test/sidebar/sidebar-test.tsx +43 -1
- package/lighthouse-cli/.eslintrc.cjs +2 -0
- package/lighthouse-cli/cli-flags.js +1 -1
- package/lighthouse-core/audits/audit.js +1 -1
- package/lighthouse-core/computed/resource-summary.js +1 -1
- package/lighthouse-core/config/default-config.js +0 -2
- package/lighthouse-core/gather/connections/cri.js +1 -1
- package/lighthouse-core/lib/proto-preprocessor.js +14 -2
- package/lighthouse-core/lib/url-shim.js +1 -1
- package/lighthouse-core/util-commonjs.js +24 -9
- package/package.json +3 -3
- package/report/.eslintrc.cjs +2 -0
- package/report/assets/standalone-template.html +2 -3
- package/report/assets/styles.css +227 -251
- package/report/assets/templates.html +19 -29
- package/report/clients/bundle.js +1 -0
- package/report/clients/standalone.js +6 -13
- package/report/renderer/api.js +32 -0
- package/report/renderer/category-renderer.js +22 -18
- package/report/renderer/components.js +46 -79
- package/report/renderer/crc-details-renderer.js +15 -12
- package/report/renderer/dom.js +16 -1
- package/report/renderer/drop-down-menu.js +2 -2
- package/report/renderer/element-screenshot-renderer.js +6 -6
- package/report/renderer/features-util.js +1 -1
- package/report/renderer/open-tab.js +9 -3
- package/report/renderer/performance-category-renderer.js +31 -19
- package/report/renderer/report-renderer.js +34 -10
- package/report/renderer/report-ui-features.js +36 -33
- package/report/renderer/swap-locale-feature.js +3 -3
- package/report/renderer/topbar-features.js +52 -48
- package/report/renderer/util.js +25 -9
- package/report/test/clients/bundle-test.js +8 -0
- package/report/test/renderer/category-renderer-test.js +2 -2
- package/report/test/renderer/performance-category-renderer-test.js +1 -1
- package/report/test/renderer/report-renderer-axe-test.js +5 -2
- package/report/test/renderer/report-renderer-test.js +13 -10
- package/report/test/renderer/report-ui-features-test.js +17 -10
- package/report/test-assets/faux-psi-template.html +2 -7
- package/report/test-assets/faux-psi.js +20 -39
- package/report/types/html-renderer.d.ts +2 -0
- package/report/types/report-renderer.d.ts +23 -0
- package/shared/localization/locales/ar-XB.json +0 -15
- package/shared/localization/locales/ar.json +0 -15
- package/shared/localization/locales/bg.json +0 -15
- package/shared/localization/locales/ca.json +0 -15
- package/shared/localization/locales/cs.json +0 -15
- package/shared/localization/locales/da.json +0 -15
- package/shared/localization/locales/de.json +0 -15
- package/shared/localization/locales/el.json +0 -15
- package/shared/localization/locales/en-GB.json +0 -15
- package/shared/localization/locales/en-US.json +18 -15
- package/shared/localization/locales/en-XA.json +0 -15
- package/shared/localization/locales/en-XL.json +18 -15
- package/shared/localization/locales/es-419.json +0 -15
- package/shared/localization/locales/es.json +0 -15
- package/shared/localization/locales/fi.json +0 -15
- package/shared/localization/locales/fil.json +0 -15
- package/shared/localization/locales/fr.json +0 -15
- package/shared/localization/locales/he.json +0 -15
- package/shared/localization/locales/hi.json +0 -15
- package/shared/localization/locales/hr.json +0 -15
- package/shared/localization/locales/hu.json +0 -15
- package/shared/localization/locales/id.json +0 -15
- package/shared/localization/locales/it.json +0 -15
- package/shared/localization/locales/ja.json +0 -15
- package/shared/localization/locales/ko.json +0 -15
- package/shared/localization/locales/lt.json +0 -15
- package/shared/localization/locales/lv.json +0 -15
- package/shared/localization/locales/nl.json +0 -15
- package/shared/localization/locales/no.json +0 -15
- package/shared/localization/locales/pl.json +0 -15
- package/shared/localization/locales/pt-PT.json +0 -15
- package/shared/localization/locales/pt.json +0 -15
- package/shared/localization/locales/ro.json +0 -15
- package/shared/localization/locales/ru.json +0 -15
- package/shared/localization/locales/sk.json +0 -15
- package/shared/localization/locales/sl.json +0 -15
- package/shared/localization/locales/sr-Latn.json +0 -15
- package/shared/localization/locales/sr.json +0 -15
- package/shared/localization/locales/sv.json +0 -15
- package/shared/localization/locales/ta.json +0 -15
- package/shared/localization/locales/te.json +0 -15
- package/shared/localization/locales/th.json +0 -15
- package/shared/localization/locales/tr.json +0 -15
- package/shared/localization/locales/uk.json +0 -15
- package/shared/localization/locales/vi.json +0 -15
- package/shared/localization/locales/zh-HK.json +0 -15
- package/shared/localization/locales/zh-TW.json +0 -15
- package/shared/localization/locales/zh.json +0 -15
- package/lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js +0 -96
|
@@ -52,8 +52,9 @@ limitations under the License.
|
|
|
52
52
|
|
|
53
53
|
<!-- Lighthouse clump -->
|
|
54
54
|
<template id="clump">
|
|
55
|
+
<div class="lh-audit-group">
|
|
55
56
|
<!-- TODO: group classes shouldn't be reused for clumps. -->
|
|
56
|
-
<details class="lh-clump
|
|
57
|
+
<details class="lh-clump">
|
|
57
58
|
<summary>
|
|
58
59
|
<div class="lh-audit-group__summary">
|
|
59
60
|
<div class="lh-audit-group__header">
|
|
@@ -62,27 +63,13 @@ limitations under the License.
|
|
|
62
63
|
<!-- .lh-audit-group__description will be added here -->
|
|
63
64
|
<!-- .lh-metrics-toggle will be added here -->
|
|
64
65
|
</div>
|
|
66
|
+
<div class="lh-clump-toggle">
|
|
67
|
+
<span class="lh-clump-toggletext--show"></span>
|
|
68
|
+
<span class="lh-clump-toggletext--hide"></span>
|
|
69
|
+
</div>
|
|
65
70
|
</div>
|
|
66
71
|
</summary>
|
|
67
72
|
</details>
|
|
68
|
-
</template>
|
|
69
|
-
|
|
70
|
-
<!-- Lighthouse metrics toggle -->
|
|
71
|
-
<template id="metricsToggle">
|
|
72
|
-
<div class="lh-metrics-toggle">
|
|
73
|
-
<input class="lh-metrics-toggle__input" type="checkbox" id="toggle-metric-descriptions" aria-label="Toggle the display of metric descriptions">
|
|
74
|
-
<label class="lh-metrics-toggle__label" for="toggle-metric-descriptions">
|
|
75
|
-
<div class="lh-metrics-toggle__icon lh-metrics-toggle__icon--less" aria-hidden="true">
|
|
76
|
-
<svg width="24" height="24" viewBox="0 0 24 24">
|
|
77
|
-
<path class="lh-metrics-toggle__lines" d="M4 9h16v2H4zm0 4h10v2H4z" />
|
|
78
|
-
</svg>
|
|
79
|
-
</div>
|
|
80
|
-
<div class="lh-metrics-toggle__icon lh-metrics-toggle__icon--more" aria-hidden="true">
|
|
81
|
-
<svg width="24" height="24" viewBox="0 0 24 24">
|
|
82
|
-
<path class="lh-metrics-toggle__lines" d="M3 18h12v-2H3v2zM3 6v2h18V6H3zm0 7h18v-2H3v2z" />
|
|
83
|
-
</svg>
|
|
84
|
-
</div>
|
|
85
|
-
</label>
|
|
86
73
|
</div>
|
|
87
74
|
</template>
|
|
88
75
|
|
|
@@ -123,7 +110,7 @@ limitations under the License.
|
|
|
123
110
|
<div class="lh-audit lh-audit--load-opportunity">
|
|
124
111
|
<details class="lh-expandable-details">
|
|
125
112
|
<summary>
|
|
126
|
-
<div class="lh-audit__header
|
|
113
|
+
<div class="lh-audit__header">
|
|
127
114
|
<div class="lh-load-opportunity__cols">
|
|
128
115
|
<div class="lh-load-opportunity__col lh-load-opportunity__col--one">
|
|
129
116
|
<span class="lh-audit__score-icon"></span>
|
|
@@ -159,14 +146,14 @@ limitations under the License.
|
|
|
159
146
|
.lh-scores-container {
|
|
160
147
|
display: flex;
|
|
161
148
|
flex-direction: column;
|
|
162
|
-
padding: var(--
|
|
149
|
+
padding: var(--default-padding) 0;
|
|
163
150
|
position: relative;
|
|
164
151
|
width: 100%;
|
|
165
152
|
}
|
|
166
153
|
|
|
167
154
|
.lh-sticky-header {
|
|
168
155
|
--gauge-circle-size: var(--gauge-circle-size-sm);
|
|
169
|
-
--plugin-badge-size:
|
|
156
|
+
--plugin-badge-size: 16px;
|
|
170
157
|
--plugin-icon-size: 75%;
|
|
171
158
|
--gauge-wrapper-width: 60px;
|
|
172
159
|
--gauge-percentage-font-size: 13px;
|
|
@@ -174,7 +161,7 @@ limitations under the License.
|
|
|
174
161
|
left: 0;
|
|
175
162
|
right: 0;
|
|
176
163
|
top: var(--topbar-height);
|
|
177
|
-
font-weight:
|
|
164
|
+
font-weight: 500;
|
|
178
165
|
display: none;
|
|
179
166
|
justify-content: center;
|
|
180
167
|
background-color: var(--sticky-header-background-color);
|
|
@@ -242,8 +229,10 @@ limitations under the License.
|
|
|
242
229
|
display: flex;
|
|
243
230
|
align-items: center;
|
|
244
231
|
height: var(--topbar-height);
|
|
245
|
-
background-color: var(--topbar-background-color);
|
|
246
232
|
padding: var(--topbar-padding);
|
|
233
|
+
font-size: var(--report-font-size-secondary);
|
|
234
|
+
background-color: var(--topbar-background-color);
|
|
235
|
+
border-bottom: 1px solid var(--color-gray-200);
|
|
247
236
|
}
|
|
248
237
|
|
|
249
238
|
.lh-topbar__logo {
|
|
@@ -315,7 +304,7 @@ limitations under the License.
|
|
|
315
304
|
color: currentColor;
|
|
316
305
|
text-decoration: none;
|
|
317
306
|
white-space: nowrap;
|
|
318
|
-
padding: 0
|
|
307
|
+
padding: 0 6px;
|
|
319
308
|
line-height: 2;
|
|
320
309
|
}
|
|
321
310
|
.lh-tools__dropdown a:hover,
|
|
@@ -345,13 +334,15 @@ limitations under the License.
|
|
|
345
334
|
max-width: 200px;
|
|
346
335
|
}
|
|
347
336
|
.lh-button.lh-tool-locale__button {
|
|
348
|
-
height:
|
|
337
|
+
height: var(--topbar-height);
|
|
349
338
|
color: var(--tools-icon-color);
|
|
339
|
+
padding: calc(var(--default-padding) / 2);
|
|
350
340
|
}
|
|
351
341
|
.lh-tool-locale__button.lh-active + .lh-tools-locale__selector-wrapper {
|
|
352
342
|
opacity: 1;
|
|
353
343
|
clip: rect(-1px, 194px, 242px, -3px);
|
|
354
344
|
visibility: visible;
|
|
345
|
+
margin: 0 4px;
|
|
355
346
|
}
|
|
356
347
|
|
|
357
348
|
@media screen and (max-width: 964px) {
|
|
@@ -521,7 +512,7 @@ limitations under the License.
|
|
|
521
512
|
<style>
|
|
522
513
|
.lh-footer {
|
|
523
514
|
padding: var(--footer-padding-vertical) calc(var(--default-padding) * 2);
|
|
524
|
-
max-width: var(--report-width);
|
|
515
|
+
max-width: var(--report-content-width);
|
|
525
516
|
margin: 0 auto;
|
|
526
517
|
}
|
|
527
518
|
.lh-footer .lh-generated {
|
|
@@ -739,10 +730,9 @@ limitations under the License.
|
|
|
739
730
|
<template id="3pFilter">
|
|
740
731
|
<style>
|
|
741
732
|
.lh-3p-filter {
|
|
742
|
-
background-color: var(--table-higlight-background-color);
|
|
743
733
|
color: var(--color-gray-600);
|
|
744
734
|
float: right;
|
|
745
|
-
padding: 6px;
|
|
735
|
+
padding: 6px var(--stackpack-padding-horizontal);
|
|
746
736
|
}
|
|
747
737
|
.lh-3p-filter-label, .lh-3p-filter-input {
|
|
748
738
|
vertical-align: middle;
|
package/report/clients/bundle.js
CHANGED
|
@@ -13,24 +13,16 @@
|
|
|
13
13
|
|
|
14
14
|
/* global ga */
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import {renderReport} from '../renderer/api.js';
|
|
17
17
|
import {Logger} from '../renderer/logger.js';
|
|
18
|
-
import {ReportRenderer} from '../renderer/report-renderer.js';
|
|
19
|
-
import {ReportUIFeatures} from '../renderer/report-ui-features.js';
|
|
20
18
|
|
|
21
19
|
function __initLighthouseReport__() {
|
|
22
|
-
|
|
23
|
-
const renderer = new ReportRenderer(dom);
|
|
24
|
-
const container = dom.find('main', document);
|
|
25
|
-
/** @type {LH.ReportResult} */
|
|
20
|
+
/** @type {LH.Result} */
|
|
26
21
|
// @ts-expect-error
|
|
27
22
|
const lhr = window.__LIGHTHOUSE_JSON__;
|
|
28
|
-
renderer.renderReport(lhr, container);
|
|
29
23
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const features = new ReportUIFeatures(dom);
|
|
33
|
-
features.initFeatures(lhr);
|
|
24
|
+
const reportRootEl = renderReport(lhr);
|
|
25
|
+
document.body.append(reportRootEl);
|
|
34
26
|
|
|
35
27
|
document.addEventListener('lh-analytics', /** @param {Event} e */ e => {
|
|
36
28
|
// @ts-expect-error
|
|
@@ -38,7 +30,8 @@ function __initLighthouseReport__() {
|
|
|
38
30
|
});
|
|
39
31
|
|
|
40
32
|
document.addEventListener('lh-log', /** @param {Event} e */ e => {
|
|
41
|
-
const el =
|
|
33
|
+
const el = document.querySelector('div#lh-log');
|
|
34
|
+
if (!el) return;
|
|
42
35
|
|
|
43
36
|
const logger = new Logger(el);
|
|
44
37
|
// @ts-expect-error
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
import {DOM} from '../renderer/dom.js';
|
|
10
|
+
import {ReportRenderer} from '../renderer/report-renderer.js';
|
|
11
|
+
import {ReportUIFeatures} from '../renderer/report-ui-features.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {LH.Result} lhr
|
|
15
|
+
* @param {LH.Renderer.Options} opts
|
|
16
|
+
* @return {HTMLElement}
|
|
17
|
+
*/
|
|
18
|
+
export function renderReport(lhr, opts = {}) {
|
|
19
|
+
const rootEl = document.createElement('article');
|
|
20
|
+
rootEl.classList.add('lh-root', 'lh-vars');
|
|
21
|
+
|
|
22
|
+
const dom = new DOM(rootEl.ownerDocument, rootEl);
|
|
23
|
+
const renderer = new ReportRenderer(dom);
|
|
24
|
+
|
|
25
|
+
renderer.renderReport(lhr, rootEl, opts);
|
|
26
|
+
|
|
27
|
+
// Hook in JS features and page-level event listeners after the report
|
|
28
|
+
// is in the document.
|
|
29
|
+
const features = new ReportUIFeatures(dom, opts);
|
|
30
|
+
features.initFeatures(lhr);
|
|
31
|
+
return rootEl;
|
|
32
|
+
}
|
|
@@ -133,7 +133,7 @@ export class CategoryRenderer {
|
|
|
133
133
|
const warningsEl = this.dom.createChildOf(summaryEl, 'div', 'lh-warnings');
|
|
134
134
|
this.dom.createChildOf(warningsEl, 'span').textContent = strings.warningHeader;
|
|
135
135
|
if (warnings.length === 1) {
|
|
136
|
-
warningsEl.appendChild(this.dom.
|
|
136
|
+
warningsEl.appendChild(this.dom.createTextNode(warnings.join('')));
|
|
137
137
|
} else {
|
|
138
138
|
const warningsUl = this.dom.createChildOf(warningsEl, 'ul');
|
|
139
139
|
for (const warning of warnings) {
|
|
@@ -222,7 +222,7 @@ export class CategoryRenderer {
|
|
|
222
222
|
* Renders the group container for a group of audits. Individual audit elements can be added
|
|
223
223
|
* directly to the returned element.
|
|
224
224
|
* @param {LH.Result.ReportGroup} group
|
|
225
|
-
* @return {Element}
|
|
225
|
+
* @return {[Element, Element | null]}
|
|
226
226
|
*/
|
|
227
227
|
renderAuditGroup(group) {
|
|
228
228
|
const groupEl = this.dom.createElement('div', 'lh-audit-group');
|
|
@@ -231,14 +231,16 @@ export class CategoryRenderer {
|
|
|
231
231
|
|
|
232
232
|
this.dom.createChildOf(auditGroupHeader, 'span', 'lh-audit-group__title')
|
|
233
233
|
.textContent = group.title;
|
|
234
|
+
groupEl.appendChild(auditGroupHeader);
|
|
235
|
+
|
|
236
|
+
let footerEl = null;
|
|
234
237
|
if (group.description) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
+
footerEl = this.dom.convertMarkdownLinkSnippets(group.description);
|
|
239
|
+
footerEl.classList.add('lh-audit-group__description', 'lh-audit-group__footer');
|
|
240
|
+
groupEl.appendChild(footerEl);
|
|
238
241
|
}
|
|
239
|
-
groupEl.appendChild(auditGroupHeader);
|
|
240
242
|
|
|
241
|
-
return groupEl;
|
|
243
|
+
return [groupEl, footerEl];
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
/**
|
|
@@ -278,9 +280,9 @@ export class CategoryRenderer {
|
|
|
278
280
|
|
|
279
281
|
// Push grouped audits as a group.
|
|
280
282
|
const groupDef = groupDefinitions[groupId];
|
|
281
|
-
const auditGroupElem = this.renderAuditGroup(groupDef);
|
|
283
|
+
const [auditGroupElem, auditGroupFooterEl] = this.renderAuditGroup(groupDef);
|
|
282
284
|
for (const auditRef of groupAuditRefs) {
|
|
283
|
-
auditGroupElem.
|
|
285
|
+
auditGroupElem.insertBefore(this.renderAudit(auditRef), auditGroupFooterEl);
|
|
284
286
|
}
|
|
285
287
|
auditGroupElem.classList.add(`lh-audit-group--${groupId}`);
|
|
286
288
|
auditElements.push(auditGroupElem);
|
|
@@ -318,17 +320,9 @@ export class CategoryRenderer {
|
|
|
318
320
|
clumpElement.setAttribute('open', '');
|
|
319
321
|
}
|
|
320
322
|
|
|
321
|
-
const summaryInnerEl = this.dom.find('div.lh-audit-group__summary', clumpElement);
|
|
322
|
-
summaryInnerEl.appendChild(this._createChevron());
|
|
323
|
-
|
|
324
323
|
const headerEl = this.dom.find('.lh-audit-group__header', clumpElement);
|
|
325
324
|
const title = this._clumpTitles[clumpId];
|
|
326
325
|
this.dom.find('.lh-audit-group__title', headerEl).textContent = title;
|
|
327
|
-
if (description) {
|
|
328
|
-
const descriptionEl = this.dom.convertMarkdownLinkSnippets(description);
|
|
329
|
-
descriptionEl.classList.add('lh-audit-group__description');
|
|
330
|
-
headerEl.appendChild(descriptionEl);
|
|
331
|
-
}
|
|
332
326
|
|
|
333
327
|
const itemCountEl = this.dom.find('.lh-audit-group__itemcount', clumpElement);
|
|
334
328
|
itemCountEl.textContent = `(${auditRefs.length})`;
|
|
@@ -337,8 +331,18 @@ export class CategoryRenderer {
|
|
|
337
331
|
const auditElements = auditRefs.map(this.renderAudit.bind(this));
|
|
338
332
|
clumpElement.append(...auditElements);
|
|
339
333
|
|
|
334
|
+
const el = this.dom.find('.lh-audit-group', clumpComponent);
|
|
335
|
+
if (description) {
|
|
336
|
+
const descriptionEl = this.dom.convertMarkdownLinkSnippets(description);
|
|
337
|
+
descriptionEl.classList.add('lh-audit-group__description', 'lh-audit-group__footer');
|
|
338
|
+
el.appendChild(descriptionEl);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
this.dom.find('.lh-clump-toggletext--show', el).textContent = Util.i18n.strings.show;
|
|
342
|
+
this.dom.find('.lh-clump-toggletext--hide', el).textContent = Util.i18n.strings.hide;
|
|
343
|
+
|
|
340
344
|
clumpElement.classList.add(`lh-clump--${clumpId.toLowerCase()}`);
|
|
341
|
-
return
|
|
345
|
+
return el;
|
|
342
346
|
}
|
|
343
347
|
|
|
344
348
|
/**
|