lighthouse 8.5.1-dev.20211012 → 8.5.1
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 +149 -0
- package/dist/report/standalone.js +228 -0
- package/flow-report/assets/styles.css +9 -272
- package/flow-report/jest.config.js +1 -1
- package/flow-report/src/app.tsx +9 -31
- package/flow-report/src/common.tsx +7 -86
- package/flow-report/src/icons.tsx +3 -20
- package/flow-report/src/sidebar/sidebar.tsx +16 -11
- package/flow-report/src/summary/category.tsx +24 -42
- package/flow-report/src/summary/summary.tsx +29 -32
- package/flow-report/src/topbar.tsx +4 -54
- package/flow-report/src/util.ts +1 -26
- package/flow-report/src/wrappers/report-renderer.tsx +1 -1
- package/flow-report/src/wrappers/report.tsx +21 -6
- package/flow-report/test/app-test.tsx +13 -17
- package/flow-report/test/setup/env-setup.ts +0 -1
- package/flow-report/test/sidebar/flow-test.tsx +12 -6
- package/flow-report/test/sidebar/sidebar-test.tsx +13 -7
- package/flow-report/test/summary/category-test.tsx +34 -79
- package/flow-report/test/summary/summary-test.tsx +17 -11
- package/flow-report/test/util-test.tsx +12 -1
- package/flow-report/tsconfig.json +0 -1
- package/flow-report/types/flow-report.d.ts +1 -2
- package/jest.config.js +15 -1
- package/lighthouse-cli/bin.js +0 -5
- package/lighthouse-cli/cli-flags.js +3 -10
- package/lighthouse-cli/commands/commands.js +0 -1
- package/lighthouse-cli/run.js +2 -2
- package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +0 -0
- package/lighthouse-cli/test/smokehouse/report-assert.js +4 -20
- package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +1 -2
- package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +1 -1
- package/lighthouse-core/audits/seo/crawlable-anchors.js +12 -10
- package/lighthouse-core/computed/js-bundles.js +2 -1
- package/lighthouse-core/computed/unused-javascript-summary.js +3 -3
- package/lighthouse-core/config/config.js +2 -2
- package/lighthouse-core/config/default-config.js +0 -5
- package/lighthouse-core/fraggle-rock/api.js +0 -10
- package/lighthouse-core/fraggle-rock/config/filters.js +3 -22
- package/lighthouse-core/fraggle-rock/gather/driver.js +0 -4
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +2 -2
- package/lighthouse-core/fraggle-rock/user-flow.js +6 -35
- package/lighthouse-core/gather/driver/navigation.js +0 -5
- package/lighthouse-core/gather/driver/prepare.js +0 -14
- package/lighthouse-core/gather/driver/storage.js +0 -5
- package/lighthouse-core/gather/gather-runner.js +2 -2
- package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +1 -5
- package/lighthouse-core/gather/gatherers/full-page-screenshot.js +24 -30
- package/{shared/localization/i18n-module.js → lighthouse-core/lib/cdt/Common.js} +8 -3
- package/lighthouse-core/lib/cdt/SDK.js +123 -3
- package/lighthouse-core/lib/cdt/generated/SourceMap.js +312 -148
- package/lighthouse-core/lib/csp-evaluator.js +1 -2
- package/lighthouse-core/lib/i18n/README.md +6 -6
- package/lighthouse-core/lib/i18n/i18n.js +342 -9
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/ar-XB.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/ar.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/bg.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/ca.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/cs.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/da.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/de.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/el.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/en-GB.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/en-US.json +0 -111
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/en-XA.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/en-XL.json +0 -111
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/es-419.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/es.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/fi.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/fil.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/fr.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/he.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/hi.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/hr.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/hu.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/id.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/it.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/ja.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/ko.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/lt.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/lv.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/nl.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/no.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/pl.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/pt-PT.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/pt.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/ro.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/ru.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/sk.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/sl.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/sr-Latn.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/sr.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/sv.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/ta.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/te.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/th.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/tr.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/uk.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/vi.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/zh-HK.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/zh-TW.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales/zh.json +0 -0
- package/{shared/localization → lighthouse-core/lib/i18n}/locales.js +1 -2
- package/{shared/localization → lighthouse-core/lib/i18n}/swap-locale.js +7 -9
- package/lighthouse-core/lib/page-functions.js +4 -4
- package/lighthouse-core/lib/stack-packs.js +13 -1
- package/{shared → lighthouse-core/lib}/type-verifiers.js +0 -0
- package/lighthouse-core/runner.js +6 -6
- package/lighthouse-core/scripts/manual-chrome-launcher.js +1 -4
- package/lighthouse-core/util-commonjs.js +4 -20
- package/package.json +16 -19
- package/readme.md +1 -1
- package/report/assets/standalone-template.html +1 -0
- package/report/assets/styles.css +41 -16
- package/report/assets/templates.html +4 -42
- package/report/clients/psi.js +0 -1
- package/report/clients/standalone.js +2 -1
- package/report/generator/file-namer.js +8 -17
- package/report/generator/report-generator.js +1 -0
- package/report/renderer/category-renderer.js +16 -4
- package/report/renderer/components.js +71 -107
- package/report/renderer/dom.js +0 -19
- package/report/renderer/logger.js +2 -35
- package/report/renderer/performance-category-renderer.js +21 -23
- package/report/renderer/pwa-category-renderer.js +2 -1
- package/report/renderer/report-renderer.js +0 -21
- package/report/renderer/report-ui-features.js +19 -7
- package/report/renderer/util.js +4 -20
- package/report/test/clients/psi-test.js +4 -0
- package/report/test/generator/file-namer-test.js +2 -2
- package/report/test/renderer/category-renderer-test.js +1 -1
- package/report/test/renderer/performance-category-renderer-test.js +0 -12
- package/report/test/renderer/report-renderer-test.js +55 -0
- package/report/test/renderer/util-test.js +8 -68
- package/report/test-assets/faux-psi-template.html +1 -0
- package/report/tsconfig.json +1 -2
- package/report/types/html-renderer.d.ts +1 -2
- package/root.js +0 -18
- package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +3 -5
- package/third-party/chromium-synchronization/installability-errors-test.js +1 -2
- package/tsconfig-all.json +0 -1
- package/tsconfig-base.json +1 -1
- package/tsconfig.json +3 -2
- package/types/config.d.ts +0 -1
- package/types/externs.d.ts +0 -2
- package/types/lhr/flow.d.ts +0 -7
- package/types/lhr/i18n.d.ts +3 -0
- package/changelog.md +0 -5395
- package/flow-report/.eslintrc.cjs +0 -49
- package/flow-report/package.json +0 -4
- package/flow-report/src/header.tsx +0 -88
- package/flow-report/src/help-dialog.tsx +0 -120
- package/flow-report/src/i18n/i18n.tsx +0 -44
- package/flow-report/src/i18n/localized-strings.js +0 -11
- package/flow-report/src/i18n/ui-strings.js +0 -86
- package/flow-report/test/common-test.tsx +0 -89
- package/flow-report/test/header-test.tsx +0 -55
- package/flow-report/test/sample-flow.ts +0 -17
- package/flow-report/test/topbar-test.tsx +0 -68
- package/lighthouse-cli/commands/list-locales.js +0 -16
- package/lighthouse-core/lib/cdt/Platform.js +0 -55
- package/lighthouse-core/scripts/package.json +0 -4
- package/report/renderer/swap-locale-feature.js +0 -82
- package/report/test/renderer/report-renderer-axe-test.js +0 -86
- package/shared/localization/format.js +0 -422
- package/shared/localization/swap-flow-locale.js +0 -20
- package/shared/test/localization/format-test.js +0 -377
- package/shared/test/localization/locales-test.js +0 -47
- package/shared/test/localization/swap-locale-test.js +0 -140
- package/shared/tsconfig.json +0 -22
- package/shared/types/shared.d.ts +0 -24
- package/types/es-main.d.ts +0 -18
package/report/assets/styles.css
CHANGED
|
@@ -92,7 +92,6 @@
|
|
|
92
92
|
--footer-padding-vertical: 16px;
|
|
93
93
|
--gauge-circle-size-big: 112px;
|
|
94
94
|
--gauge-circle-size: 80px;
|
|
95
|
-
--gauge-circle-size-sm: 36px;
|
|
96
95
|
--gauge-label-font-size-big: 28px;
|
|
97
96
|
--gauge-label-font-size: 20px;
|
|
98
97
|
--gauge-label-line-height-big: 36px;
|
|
@@ -104,7 +103,6 @@
|
|
|
104
103
|
--highlighter-background-color: var(--report-text-color);
|
|
105
104
|
--icon-square-size: calc(var(--score-icon-size) * 0.88);
|
|
106
105
|
--image-preview-size: 48px;
|
|
107
|
-
--locale-selector-background-color: var(--color-white);
|
|
108
106
|
--metric-toggle-lines-fill: #7F7F7F;
|
|
109
107
|
--metric-value-font-size: 28px;
|
|
110
108
|
--metrics-toggle-background-color: var(--color-gray-200);
|
|
@@ -170,8 +168,6 @@
|
|
|
170
168
|
|
|
171
169
|
--pwa-installable-color-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill-rule="nonzero" fill="none"><circle fill="%230CCE6B" cx="12" cy="12" r="12"/><path d="M12 5a7 7 0 1 0 0 14 7 7 0 0 0 0-14zm3.5 7.7h-2.8v2.8h-1.4v-2.8H8.5v-1.4h2.8V8.5h1.4v2.8h2.8v1.4z" fill="%23FFF"/></g></svg>');
|
|
172
170
|
--pwa-optimized-color-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><rect fill="%230CCE6B" width="24" height="24" rx="12"/><path d="M5 5h14v14H5z"/><path fill="%23FFF" d="M12 15.07l3.6 2.18-.95-4.1 3.18-2.76-4.2-.36L12 6.17l-1.64 3.86-4.2.36 3.2 2.76-.96 4.1z"/></g></svg>');
|
|
173
|
-
|
|
174
|
-
--swap-locale-icon-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"/></svg>');
|
|
175
171
|
}
|
|
176
172
|
|
|
177
173
|
@media not print {
|
|
@@ -194,7 +190,6 @@
|
|
|
194
190
|
|
|
195
191
|
/* Component variables */
|
|
196
192
|
--env-item-background-color: var(--color-gray);
|
|
197
|
-
--locale-selector-background-color: var(--color-gray-200);
|
|
198
193
|
--plugin-badge-background-color: var(--color-gray-800);
|
|
199
194
|
--report-background-color: var(--color-gray-900);
|
|
200
195
|
--report-border-color-secondary: var(--color-gray-200);
|
|
@@ -315,6 +310,7 @@
|
|
|
315
310
|
margin: 0;
|
|
316
311
|
line-height: var(--report-line-height);
|
|
317
312
|
background: var(--report-background-color);
|
|
313
|
+
scroll-behavior: smooth;
|
|
318
314
|
color: var(--report-text-color);
|
|
319
315
|
}
|
|
320
316
|
|
|
@@ -338,10 +334,6 @@
|
|
|
338
334
|
cursor: pointer;
|
|
339
335
|
}
|
|
340
336
|
|
|
341
|
-
.lh-hidden {
|
|
342
|
-
display: none !important;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
337
|
.lh-container {
|
|
346
338
|
/*
|
|
347
339
|
Text wrapping in the report is so much FUN!
|
|
@@ -687,8 +679,8 @@
|
|
|
687
679
|
|
|
688
680
|
.lh-metric__innerwrap {
|
|
689
681
|
display: grid;
|
|
690
|
-
/**
|
|
691
|
-
* Icon -- Metric Name
|
|
682
|
+
/**
|
|
683
|
+
* Icon -- Metric Name
|
|
692
684
|
* -- Metric Value
|
|
693
685
|
*/
|
|
694
686
|
grid-template-columns: calc(var(--score-icon-size) + var(--score-icon-margin-left) + var(--score-icon-margin-right)) 1fr;
|
|
@@ -732,7 +724,7 @@
|
|
|
732
724
|
/* Change the grid to 3 columns for narrow viewport. */
|
|
733
725
|
@media screen and (max-width: 535px) {
|
|
734
726
|
.lh-metric__innerwrap {
|
|
735
|
-
/**
|
|
727
|
+
/**
|
|
736
728
|
* Icon -- Metric Name -- Metric Value
|
|
737
729
|
*/
|
|
738
730
|
grid-template-columns: calc(var(--score-icon-size) + var(--score-icon-margin-left) + var(--score-icon-margin-right)) 2fr 1fr;
|
|
@@ -1410,10 +1402,6 @@
|
|
|
1410
1402
|
padding: var(--category-padding);
|
|
1411
1403
|
max-width: var(--report-width);
|
|
1412
1404
|
margin: 0 auto;
|
|
1413
|
-
|
|
1414
|
-
--sticky-header-height: calc(var(--gauge-circle-size-sm) + var(--score-container-padding) * 2);
|
|
1415
|
-
--topbar-plus-sticky-header: calc(var(--topbar-height) + var(--sticky-header-height));
|
|
1416
|
-
scroll-margin-top: var(--topbar-plus-sticky-header);
|
|
1417
1405
|
}
|
|
1418
1406
|
|
|
1419
1407
|
.lh-category-wrapper {
|
|
@@ -1424,6 +1412,18 @@
|
|
|
1424
1412
|
border-top: 1px solid var(--color-gray-200);
|
|
1425
1413
|
}
|
|
1426
1414
|
|
|
1415
|
+
/* section hash link jump should preserve fixed header
|
|
1416
|
+
https://css-tricks.com/hash-tag-links-padding/
|
|
1417
|
+
*/
|
|
1418
|
+
.lh-category > .lh-permalink {
|
|
1419
|
+
--sticky-header-height: calc(var(--gauge-circle-size) + var(--score-container-padding) * 2);
|
|
1420
|
+
--topbar-plus-header: calc(var(--topbar-height) + var(--sticky-header-height));
|
|
1421
|
+
margin-top: calc(var(--topbar-plus-header) * -1);
|
|
1422
|
+
padding-bottom: var(--topbar-plus-header);
|
|
1423
|
+
display: block;
|
|
1424
|
+
visibility: hidden;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
1427
|
.lh-category-header {
|
|
1428
1428
|
font-size: var(--category-header-font-size);
|
|
1429
1429
|
min-height: var(--gauge-circle-size);
|
|
@@ -1441,6 +1441,31 @@
|
|
|
1441
1441
|
line-height: var(--header-line-height);
|
|
1442
1442
|
}
|
|
1443
1443
|
|
|
1444
|
+
#lh-log {
|
|
1445
|
+
position: fixed;
|
|
1446
|
+
background-color: #323232;
|
|
1447
|
+
color: #fff;
|
|
1448
|
+
min-height: 48px;
|
|
1449
|
+
min-width: 288px;
|
|
1450
|
+
padding: 16px 24px;
|
|
1451
|
+
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
|
|
1452
|
+
border-radius: 2px;
|
|
1453
|
+
margin: 12px;
|
|
1454
|
+
font-size: 14px;
|
|
1455
|
+
cursor: default;
|
|
1456
|
+
transition: transform 0.3s, opacity 0.3s;
|
|
1457
|
+
transform: translateY(100px);
|
|
1458
|
+
opacity: 0;
|
|
1459
|
+
bottom: 0;
|
|
1460
|
+
left: 0;
|
|
1461
|
+
z-index: 3;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
#lh-log.lh-show {
|
|
1465
|
+
opacity: 1;
|
|
1466
|
+
transform: translateY(0);
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1444
1469
|
/* 964 fits the min-width of the filmstrip */
|
|
1445
1470
|
@media screen and (max-width: 964px) {
|
|
1446
1471
|
.lh-report {
|
|
@@ -165,7 +165,7 @@ limitations under the License.
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
.lh-sticky-header {
|
|
168
|
-
--gauge-circle-size:
|
|
168
|
+
--gauge-circle-size: 36px;
|
|
169
169
|
--plugin-badge-size: 18px;
|
|
170
170
|
--plugin-icon-size: 75%;
|
|
171
171
|
--gauge-wrapper-width: 60px;
|
|
@@ -263,15 +263,12 @@ limitations under the License.
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
.lh-tools {
|
|
266
|
-
display: flex;
|
|
267
|
-
align-items: center;
|
|
268
266
|
margin-left: auto;
|
|
269
267
|
will-change: transform;
|
|
270
268
|
min-width: var(--report-icon-size);
|
|
271
269
|
}
|
|
272
270
|
.lh-tools__button {
|
|
273
271
|
width: var(--report-icon-size);
|
|
274
|
-
min-width: 24px;
|
|
275
272
|
height: var(--report-icon-size);
|
|
276
273
|
cursor: pointer;
|
|
277
274
|
margin-right: 5px;
|
|
@@ -328,32 +325,6 @@ limitations under the License.
|
|
|
328
325
|
display: none;
|
|
329
326
|
}
|
|
330
327
|
|
|
331
|
-
.lh-locale-selector {
|
|
332
|
-
width: 100%;
|
|
333
|
-
color: var(--report-text-color);
|
|
334
|
-
background-color: var(--locale-selector-background-color);
|
|
335
|
-
padding: 2px;
|
|
336
|
-
}
|
|
337
|
-
.lh-tools-locale {
|
|
338
|
-
display: flex;
|
|
339
|
-
align-items: center;
|
|
340
|
-
flex-direction: row-reverse;
|
|
341
|
-
}
|
|
342
|
-
.lh-tools-locale__selector-wrapper {
|
|
343
|
-
transition: opacity 0.15s;
|
|
344
|
-
opacity: 0;
|
|
345
|
-
max-width: 200px;
|
|
346
|
-
}
|
|
347
|
-
.lh-button.lh-tool-locale__button {
|
|
348
|
-
height: unset;
|
|
349
|
-
color: var(--tools-icon-color);
|
|
350
|
-
}
|
|
351
|
-
.lh-tool-locale__button.lh-active + .lh-tools-locale__selector-wrapper {
|
|
352
|
-
opacity: 1;
|
|
353
|
-
clip: rect(-1px, 194px, 242px, -3px);
|
|
354
|
-
visibility: visible;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
328
|
@media screen and (max-width: 964px) {
|
|
358
329
|
.lh-tools__dropdown {
|
|
359
330
|
right: 0;
|
|
@@ -407,15 +378,6 @@ limitations under the License.
|
|
|
407
378
|
<a href="" class="lh-topbar__url" target="_blank" rel="noopener"></a>
|
|
408
379
|
|
|
409
380
|
<div class="lh-tools">
|
|
410
|
-
<div class="lh-tools-locale lh-hidden">
|
|
411
|
-
<button id="lh-button__swap-locales" class="lh-button lh-tool-locale__button" title="Show Language Picker" aria-label="Toggle language picker" aria-haspopup="menu" aria-expanded="false" aria-controls="lh-tools-locale__selector-wrapper">
|
|
412
|
-
<svg width="20px" height="20px" viewBox="0 0 24 24" fill="currentColor"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"/></svg>
|
|
413
|
-
</button>
|
|
414
|
-
<div id="lh-tools-locale__selector-wrapper" class="lh-tools-locale__selector-wrapper" role="menu" aria-labelledby="lh-button__swap-locales" aria-hidden="true">
|
|
415
|
-
<!-- Select element created by ReportUIFeatures._enableSwapLocale: .lh-locale-selector -->
|
|
416
|
-
</div>
|
|
417
|
-
</div>
|
|
418
|
-
|
|
419
381
|
<button id="lh-tools-button" class="lh-tools__button" title="Tools menu" aria-label="Toggle report tools menu" aria-haspopup="menu" aria-expanded="false" aria-controls="lh-tools-dropdown">
|
|
420
382
|
<svg width="100%" height="100%" viewBox="0 0 24 24">
|
|
421
383
|
<path d="M0 0h24v24H0z" fill="none"/>
|
|
@@ -587,7 +549,7 @@ limitations under the License.
|
|
|
587
549
|
|
|
588
550
|
<!-- Lighthouse score gauge -->
|
|
589
551
|
<template id="gauge">
|
|
590
|
-
<a class="lh-gauge__wrapper">
|
|
552
|
+
<a href="#" class="lh-gauge__wrapper">
|
|
591
553
|
<!-- Wrapper exists for the ::before plugin icon. Cannot create pseudo-elements on svgs. -->
|
|
592
554
|
<div class="lh-gauge__svg-wrapper">
|
|
593
555
|
<svg viewBox="0 0 120 120" class="lh-gauge">
|
|
@@ -603,7 +565,7 @@ limitations under the License.
|
|
|
603
565
|
|
|
604
566
|
<!-- Lighthouse category fraction -->
|
|
605
567
|
<template id="fraction">
|
|
606
|
-
<a class="lh-fraction__wrapper">
|
|
568
|
+
<a href="#" class="lh-fraction__wrapper">
|
|
607
569
|
<div class="lh-fraction__content-wrapper">
|
|
608
570
|
<div class="lh-fraction__content">
|
|
609
571
|
<div class="lh-fraction__background"></div>
|
|
@@ -660,7 +622,7 @@ limitations under the License.
|
|
|
660
622
|
}
|
|
661
623
|
</style>
|
|
662
624
|
|
|
663
|
-
<a class="lh-gauge__wrapper lh-gauge--pwa__wrapper">
|
|
625
|
+
<a href="#" class="lh-gauge__wrapper lh-gauge--pwa__wrapper">
|
|
664
626
|
<svg viewBox="0 0 60 60" class="lh-gauge lh-gauge--pwa">
|
|
665
627
|
<defs>
|
|
666
628
|
<linearGradient id="lh-gauge--pwa__check-circle__gradient" x1="50%" y1="0%" x2="50%" y2="100%">
|
package/report/clients/psi.js
CHANGED
|
@@ -77,7 +77,6 @@ export function prepareLabData(LHResult, document) {
|
|
|
77
77
|
reportLHR.categoryGroups,
|
|
78
78
|
{environment: 'PSI', gatherMode: lhResult.gatherMode}
|
|
79
79
|
);
|
|
80
|
-
perfCategoryEl.append(dom.createComponent('styles'));
|
|
81
80
|
|
|
82
81
|
const scoreGaugeEl = dom.find('.lh-score__gauge', perfCategoryEl);
|
|
83
82
|
scoreGaugeEl.remove();
|
|
@@ -40,7 +40,8 @@ function __initLighthouseReport__() {
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
document.addEventListener('lh-log', /** @param {Event} e */ e => {
|
|
43
|
-
const el =
|
|
43
|
+
const el = document.querySelector('#lh-log');
|
|
44
|
+
if (!el) return;
|
|
44
45
|
|
|
45
46
|
const logger = new Logger(el);
|
|
46
47
|
// @ts-expect-error
|
|
@@ -11,14 +11,15 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Generate a filenamePrefix of
|
|
14
|
+
* Generate a filenamePrefix of hostname_YYYY-MM-DD_HH-MM-SS
|
|
15
15
|
* Date/time uses the local timezone, however Node has unreliable ICU
|
|
16
16
|
* support, so we must construct a YYYY-MM-DD date format manually. :/
|
|
17
|
-
* @param {string}
|
|
18
|
-
* @
|
|
17
|
+
* @param {{finalUrl: string, fetchTime: string}} lhr
|
|
18
|
+
* @return {string}
|
|
19
19
|
*/
|
|
20
|
-
function getFilenamePrefix(
|
|
21
|
-
const
|
|
20
|
+
function getFilenamePrefix(lhr) {
|
|
21
|
+
const hostname = new URL(lhr.finalUrl).hostname;
|
|
22
|
+
const date = (lhr.fetchTime && new Date(lhr.fetchTime)) || new Date();
|
|
22
23
|
|
|
23
24
|
const timeStr = date.toLocaleTimeString('en-US', {hour12: false});
|
|
24
25
|
const dateParts = date.toLocaleDateString('en-US', {
|
|
@@ -28,19 +29,9 @@ function getFilenamePrefix(name, fetchTime) {
|
|
|
28
29
|
dateParts.unshift(dateParts.pop());
|
|
29
30
|
const dateStr = dateParts.join('-');
|
|
30
31
|
|
|
31
|
-
const filenamePrefix = `${
|
|
32
|
+
const filenamePrefix = `${hostname}_${dateStr}_${timeStr}`;
|
|
32
33
|
// replace characters that are unfriendly to filenames
|
|
33
34
|
return filenamePrefix.replace(/[/?<>\\:*|"]/g, '-');
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
* Generate a filenamePrefix of hostname_YYYY-MM-DD_HH-MM-SS.
|
|
38
|
-
* @param {{finalUrl: string, fetchTime: string}} lhr
|
|
39
|
-
* @return {string}
|
|
40
|
-
*/
|
|
41
|
-
function getLhrFilenamePrefix(lhr) {
|
|
42
|
-
const hostname = new URL(lhr.finalUrl).hostname;
|
|
43
|
-
return getFilenamePrefix(hostname, lhr.fetchTime);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
module.exports = {getLhrFilenamePrefix, getFilenamePrefix};
|
|
37
|
+
module.exports = {getFilenamePrefix};
|
|
@@ -55,6 +55,7 @@ class ReportGenerator {
|
|
|
55
55
|
return ReportGenerator.replaceStrings(htmlReportAssets.REPORT_TEMPLATE, [
|
|
56
56
|
{search: '%%LIGHTHOUSE_JSON%%', replacement: sanitizedJson},
|
|
57
57
|
{search: '%%LIGHTHOUSE_JAVASCRIPT%%', replacement: sanitizedJavascript},
|
|
58
|
+
{search: '/*%%LIGHTHOUSE_CSS%%*/', replacement: htmlReportAssets.REPORT_CSS},
|
|
58
59
|
]);
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -333,6 +333,7 @@ export class CategoryRenderer {
|
|
|
333
333
|
renderScoreGauge(category, groupDefinitions) { // eslint-disable-line no-unused-vars
|
|
334
334
|
const tmpl = this.dom.createComponent('gauge');
|
|
335
335
|
const wrapper = this.dom.find('a.lh-gauge__wrapper', tmpl);
|
|
336
|
+
this.dom.safelySetHref(wrapper, `#${category.id}`);
|
|
336
337
|
|
|
337
338
|
if (Util.isPluginCategory(category.id)) {
|
|
338
339
|
wrapper.classList.add('lh-gauge__wrapper--plugin');
|
|
@@ -373,13 +374,14 @@ export class CategoryRenderer {
|
|
|
373
374
|
renderCategoryFraction(category) {
|
|
374
375
|
const tmpl = this.dom.createComponent('fraction');
|
|
375
376
|
const wrapper = this.dom.find('a.lh-fraction__wrapper', tmpl);
|
|
377
|
+
this.dom.safelySetHref(wrapper, `#${category.id}`);
|
|
376
378
|
|
|
377
|
-
const {numPassed,
|
|
379
|
+
const {numPassed, numAudits, totalWeight} = Util.calculateCategoryFraction(category);
|
|
378
380
|
|
|
379
|
-
const fraction = numPassed /
|
|
381
|
+
const fraction = numPassed / numAudits;
|
|
380
382
|
const content = this.dom.find('.lh-fraction__content', tmpl);
|
|
381
383
|
const text = this.dom.createElement('span');
|
|
382
|
-
text.textContent = `${numPassed}/${
|
|
384
|
+
text.textContent = `${numPassed}/${numAudits}`;
|
|
383
385
|
content.appendChild(text);
|
|
384
386
|
|
|
385
387
|
let rating = Util.calculateRating(fraction);
|
|
@@ -483,7 +485,7 @@ export class CategoryRenderer {
|
|
|
483
485
|
*/
|
|
484
486
|
render(category, groupDefinitions = {}, options) {
|
|
485
487
|
const element = this.dom.createElement('div', 'lh-category');
|
|
486
|
-
element
|
|
488
|
+
this.createPermalinkSpan(element, category.id);
|
|
487
489
|
element.appendChild(this.renderCategoryHeader(category, groupDefinitions, options));
|
|
488
490
|
|
|
489
491
|
// Top level clumps for audits, in order they will appear in the report.
|
|
@@ -521,4 +523,14 @@ export class CategoryRenderer {
|
|
|
521
523
|
|
|
522
524
|
return element;
|
|
523
525
|
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Create a non-semantic span used for hash navigation of categories
|
|
529
|
+
* @param {Element} element
|
|
530
|
+
* @param {string} id
|
|
531
|
+
*/
|
|
532
|
+
createPermalinkSpan(element, id) {
|
|
533
|
+
const permalinkEl = this.dom.createChildOf(element, 'span', 'lh-permalink');
|
|
534
|
+
permalinkEl.id = id;
|
|
535
|
+
}
|
|
524
536
|
}
|