lighthouse 8.3.0-dev.20210907 → 8.3.0
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/changelog.md +1 -1
- package/dist/report/standalone.js +196 -0
- package/jest.config.js +0 -4
- package/lighthouse-cli/cli-flags.js +6 -14
- package/lighthouse-cli/run.js +1 -1
- package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +3 -9
- package/lighthouse-cli/test/smokehouse/report-assert.js +16 -36
- package/lighthouse-core/audits/large-javascript-libraries.js +166 -0
- package/lighthouse-core/audits/seo/http-status-code.js +6 -2
- package/lighthouse-core/audits/viewport.js +1 -2
- package/lighthouse-core/config/config-helpers.js +75 -9
- package/lighthouse-core/config/config.js +50 -6
- package/lighthouse-core/config/constants.js +0 -1
- package/lighthouse-core/config/default-config.js +0 -3
- package/lighthouse-core/config/experimental-config.js +8 -0
- package/lighthouse-core/config/metrics-to-audits.js +0 -1
- package/lighthouse-core/fraggle-rock/config/config.js +4 -3
- package/lighthouse-core/fraggle-rock/config/default-config.js +1 -3
- package/lighthouse-core/fraggle-rock/config/validation.js +0 -201
- package/lighthouse-core/fraggle-rock/gather/base-artifacts.js +0 -4
- package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +8 -16
- package/lighthouse-core/fraggle-rock/gather/runner-helpers.js +0 -4
- package/lighthouse-core/fraggle-rock/gather/session.js +5 -30
- package/lighthouse-core/gather/driver/navigation.js +6 -7
- package/lighthouse-core/gather/driver/wait-for-condition.js +0 -27
- package/lighthouse-core/gather/fetcher.js +7 -17
- package/lighthouse-core/gather/gather-runner.js +0 -1
- package/lighthouse-core/gather/gatherers/seo/robots-txt.js +6 -2
- package/lighthouse-core/gather/gatherers/seo/tap-targets.js +2 -2
- package/lighthouse-core/gather/gatherers/stacks.js +1 -1
- package/lighthouse-core/lib/asset-saver.js +2 -2
- package/lighthouse-core/lib/cdt/SDK.js +0 -1
- package/lighthouse-core/lib/csp-evaluator.js +4 -17
- package/{report/generator → lighthouse-core/lib}/file-namer.js +0 -0
- package/lighthouse-core/lib/i18n/README.md +1 -1
- package/lighthouse-core/lib/i18n/i18n.js +7 -7
- package/lighthouse-core/lib/i18n/locales/ar-XB.json +18 -0
- package/lighthouse-core/lib/i18n/locales/ar.json +18 -0
- package/lighthouse-core/lib/i18n/locales/bg.json +18 -0
- package/lighthouse-core/lib/i18n/locales/ca.json +18 -0
- package/lighthouse-core/lib/i18n/locales/cs.json +18 -0
- package/lighthouse-core/lib/i18n/locales/da.json +18 -0
- package/lighthouse-core/lib/i18n/locales/de.json +18 -0
- package/lighthouse-core/lib/i18n/locales/el.json +18 -0
- package/lighthouse-core/lib/i18n/locales/en-GB.json +18 -0
- package/lighthouse-core/lib/i18n/locales/en-US.json +18 -18
- package/lighthouse-core/lib/i18n/locales/en-XA.json +18 -0
- package/lighthouse-core/lib/i18n/locales/en-XL.json +18 -18
- package/lighthouse-core/lib/i18n/locales/es-419.json +18 -0
- package/lighthouse-core/lib/i18n/locales/es.json +18 -0
- package/lighthouse-core/lib/i18n/locales/fi.json +18 -0
- package/lighthouse-core/lib/i18n/locales/fil.json +18 -0
- package/lighthouse-core/lib/i18n/locales/fr.json +18 -0
- package/lighthouse-core/lib/i18n/locales/he.json +18 -0
- package/lighthouse-core/lib/i18n/locales/hi.json +18 -0
- package/lighthouse-core/lib/i18n/locales/hr.json +18 -0
- package/lighthouse-core/lib/i18n/locales/hu.json +18 -0
- package/lighthouse-core/lib/i18n/locales/id.json +18 -0
- package/lighthouse-core/lib/i18n/locales/it.json +18 -0
- package/lighthouse-core/lib/i18n/locales/ja.json +18 -0
- package/lighthouse-core/lib/i18n/locales/ko.json +18 -0
- package/lighthouse-core/lib/i18n/locales/lt.json +18 -0
- package/lighthouse-core/lib/i18n/locales/lv.json +18 -0
- package/lighthouse-core/lib/i18n/locales/nl.json +18 -0
- package/lighthouse-core/lib/i18n/locales/no.json +18 -0
- package/lighthouse-core/lib/i18n/locales/pl.json +18 -0
- package/lighthouse-core/lib/i18n/locales/pt-PT.json +18 -0
- package/lighthouse-core/lib/i18n/locales/pt.json +18 -0
- package/lighthouse-core/lib/i18n/locales/ro.json +18 -0
- package/lighthouse-core/lib/i18n/locales/ru.json +18 -0
- package/lighthouse-core/lib/i18n/locales/sk.json +18 -0
- package/lighthouse-core/lib/i18n/locales/sl.json +18 -0
- package/lighthouse-core/lib/i18n/locales/sr-Latn.json +18 -0
- package/lighthouse-core/lib/i18n/locales/sr.json +18 -0
- package/lighthouse-core/lib/i18n/locales/sv.json +18 -0
- package/lighthouse-core/lib/i18n/locales/ta.json +18 -0
- package/lighthouse-core/lib/i18n/locales/te.json +18 -0
- package/lighthouse-core/lib/i18n/locales/th.json +18 -0
- package/lighthouse-core/lib/i18n/locales/tr.json +18 -0
- package/lighthouse-core/lib/i18n/locales/uk.json +18 -0
- package/lighthouse-core/lib/i18n/locales/vi.json +18 -0
- package/lighthouse-core/lib/i18n/locales/zh-HK.json +18 -0
- package/lighthouse-core/lib/i18n/locales/zh-TW.json +18 -0
- package/lighthouse-core/lib/i18n/locales/zh.json +18 -0
- package/lighthouse-core/lib/large-javascript-libraries/bundlephobia-database.json +62 -0
- package/lighthouse-core/lib/large-javascript-libraries/library-suggestions.js +20 -0
- package/lighthouse-core/lib/network-request.js +1 -3
- package/lighthouse-core/lib/traces/pwmetrics-events.js +2 -2
- package/lighthouse-core/lib/url-shim.js +1 -7
- package/lighthouse-core/runner.js +1 -4
- package/lighthouse-core/util-commonjs.js +2 -2
- package/now.json +1 -1
- package/package.json +13 -20
- package/report/README.md +2 -2
- package/report/assets/standalone-template.html +1 -0
- package/report/assets/styles.css +27 -23
- package/report/assets/templates.html +40 -37
- package/report/clients/bundle.js +0 -1
- package/report/{package.json → clients/package.json} +0 -0
- package/report/clients/psi.js +3 -13
- package/report/clients/standalone.js +1 -1
- package/report/{types/buffer.d.ts → clients/treemap.js} +13 -11
- package/report/renderer/category-renderer.js +2 -2
- package/report/renderer/components.js +48 -46
- package/report/renderer/crc-details-renderer.js +16 -16
- package/report/renderer/details-renderer.js +1 -1
- package/report/renderer/dom.js +0 -17
- package/report/renderer/element-screenshot-renderer.js +9 -9
- package/{flow-report/test/setup/global-setup.ts → report/renderer/file-namer.js} +2 -5
- package/report/renderer/logger.js +4 -4
- package/report/renderer/package.json +4 -0
- package/report/renderer/report-renderer.js +11 -4
- package/report/renderer/report-ui-features.js +656 -43
- package/report/renderer/text-encoding.js +1 -1
- package/report/renderer/util.js +2 -2
- package/report/{generator/report-assets.js → report-assets.js} +3 -9
- package/report/{generator/report-generator.js → report-generator.js} +9 -37
- package/report/test/clients/package.json +4 -0
- package/report/test/clients/psi-test.js +1 -3
- package/report/test/renderer/category-renderer-test.js +3 -8
- package/report/test/renderer/components-test.js +0 -35
- package/report/test/renderer/crc-details-renderer-test.js +4 -5
- package/report/test/renderer/details-renderer-test.js +1 -3
- package/report/test/renderer/dom-test.js +6 -8
- package/report/test/renderer/i18n-test.js +0 -1
- package/report/test/renderer/package.json +4 -0
- package/report/test/renderer/performance-category-renderer-test.js +27 -30
- package/report/test/renderer/pwa-category-renderer-test.js +1 -2
- package/report/test/renderer/report-renderer-test.js +0 -1
- package/report/test/renderer/report-ui-features-test.js +28 -20
- package/report/test/renderer/snippet-renderer-test.js +0 -1
- package/report/test/renderer/text-encoding-test.js +0 -2
- package/report/test/renderer/util-test.js +0 -1
- package/report/test/{generator/report-generator-test.js → report-generator-test.js} +7 -9
- package/third-party/chromium-synchronization/installability-errors-test.js +27 -28
- package/third-party/snyk/snapshot.json +0 -2
- package/tsconfig.json +5 -24
- package/types/artifacts.d.ts +18 -5
- package/types/{lhr/audit-details.d.ts → audit-details.d.ts} +3 -18
- package/types/audit.d.ts +58 -7
- package/types/{lhr/budget.d.ts → budget.d.ts} +0 -0
- package/types/bundle-phobia-cli/index.d.ts +40 -0
- package/types/config.d.ts +8 -3
- package/types/externs.d.ts +119 -5
- package/types/gatherer.d.ts +2 -3
- package/types/global-lh.d.ts +14 -16
- package/{report/types/report-result.d.ts → types/html-renderer.d.ts} +17 -8
- package/types/{lhr/i18n.d.ts → i18n.d.ts} +25 -2
- package/types/{lhr/lhr.d.ts → lhr.d.ts} +9 -41
- package/types/smokehouse.d.ts +3 -3
- package/types/{lhr/treemap.d.ts → treemap.d.ts} +3 -3
- package/flow-report/assets/standalone-flow-template.html +0 -38
- package/flow-report/assets/styles.css +0 -310
- package/flow-report/jest.config.js +0 -24
- package/flow-report/src/app.tsx +0 -40
- package/flow-report/src/common.tsx +0 -72
- package/flow-report/src/icons.tsx +0 -96
- package/flow-report/src/sidebar/flow.tsx +0 -72
- package/flow-report/src/sidebar/sidebar.tsx +0 -89
- package/flow-report/src/summary/summary.tsx +0 -178
- package/flow-report/src/util.ts +0 -160
- package/flow-report/src/wrappers/gauge.tsx +0 -40
- package/flow-report/src/wrappers/report-renderer.tsx +0 -46
- package/flow-report/src/wrappers/report.tsx +0 -71
- package/flow-report/standalone-flow.tsx +0 -23
- package/flow-report/test/app-test.tsx +0 -48
- package/flow-report/test/common-test.tsx +0 -131
- package/flow-report/test/setup/env-setup.ts +0 -25
- package/flow-report/test/sidebar/flow-test.tsx +0 -71
- package/flow-report/test/sidebar/sidebar-test.tsx +0 -53
- package/flow-report/test/summary/summary-test.tsx +0 -132
- package/flow-report/test/util-test.tsx +0 -109
- package/flow-report/tsconfig.json +0 -39
- package/flow-report/types/flow-report.d.ts +0 -27
- package/lighthouse-core/audits/lcp-lazy-loaded.js +0 -83
- package/report/.eslintrc.cjs +0 -33
- package/report/generator/README.md +0 -9
- package/report/generator/flow-report-assets.js +0 -20
- package/report/generator/package.json +0 -4
- package/report/generator/tsconfig.json +0 -28
- package/report/renderer/drop-down-menu.js +0 -215
- package/report/renderer/features-util.js +0 -26
- package/report/renderer/open-tab.js +0 -137
- package/report/renderer/topbar-features.js +0 -309
- package/report/test/generator/file-namer-test.js +0 -28
- package/report/test/generator/package.json +0 -4
- package/report/test-assets/faux-psi-template.html +0 -126
- package/report/test-assets/faux-psi.js +0 -92
- package/report/tsconfig.json +0 -39
- package/report/types/augment-dom.d.ts +0 -24
- package/report/types/html-renderer.d.ts +0 -28
- package/types/lhr/audit-result.d.ts +0 -59
- package/types/lhr/flow.d.ts +0 -16
- package/types/lhr/settings.d.ts +0 -105
- package/types/lhr/tsconfig.json +0 -24
- package/types/query-selector.d.ts +0 -36
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
// auto-generated by build/build-report-components.js
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// must import as DOM_ to avoid redeclaring 'DOM' export in bundle.d.ts, otherwise
|
|
6
|
+
// yarn test-devtools will fail.
|
|
7
|
+
/** @typedef {import('./dom.js').DOM} DOM_ */
|
|
6
8
|
|
|
7
9
|
/* eslint-disable max-len */
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
|
-
* @param {
|
|
13
|
+
* @param {DOM_} dom
|
|
12
14
|
*/
|
|
13
15
|
function create3pFilterComponent(dom) {
|
|
14
16
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -30,7 +32,7 @@ function create3pFilterComponent(dom) {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
|
-
* @param {
|
|
35
|
+
* @param {DOM_} dom
|
|
34
36
|
*/
|
|
35
37
|
function createAuditComponent(dom) {
|
|
36
38
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -55,7 +57,7 @@ function createAuditComponent(dom) {
|
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
/**
|
|
58
|
-
* @param {
|
|
60
|
+
* @param {DOM_} dom
|
|
59
61
|
*/
|
|
60
62
|
function createCategoryHeaderComponent(dom) {
|
|
61
63
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -70,7 +72,7 @@ function createCategoryHeaderComponent(dom) {
|
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
/**
|
|
73
|
-
* @param {
|
|
75
|
+
* @param {DOM_} dom
|
|
74
76
|
*/
|
|
75
77
|
function createChevronComponent(dom) {
|
|
76
78
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -88,7 +90,7 @@ function createChevronComponent(dom) {
|
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
/**
|
|
91
|
-
* @param {
|
|
93
|
+
* @param {DOM_} dom
|
|
92
94
|
*/
|
|
93
95
|
function createClumpComponent(dom) {
|
|
94
96
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -107,13 +109,13 @@ function createClumpComponent(dom) {
|
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
/**
|
|
110
|
-
* @param {
|
|
112
|
+
* @param {DOM_} dom
|
|
111
113
|
*/
|
|
112
114
|
function createCrcComponent(dom) {
|
|
113
115
|
const el0 = dom.document().createDocumentFragment();
|
|
114
116
|
const el1 = dom.createElement('div', 'lh-crc-container');
|
|
115
117
|
const el2 = dom.createElement('style');
|
|
116
|
-
el2.append('\n .lh-crc .
|
|
118
|
+
el2.append('\n .lh-crc .tree-marker {\n width: 12px;\n height: 26px;\n display: block;\n float: left;\n background-position: top left;\n }\n .lh-crc .horiz-down {\n background: url(\'data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><g fill="%23D8D8D8" fill-rule="evenodd"><path d="M16 12v2H-2v-2z"/><path d="M9 12v14H7V12z"/></g></svg>\');\n }\n .lh-crc .right {\n background: url(\'data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><path d="M16 12v2H0v-2z" fill="%23D8D8D8" fill-rule="evenodd"/></svg>\');\n }\n .lh-crc .up-right {\n background: url(\'data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><path d="M7 0h2v14H7zm2 12h7v2H9z" fill="%23D8D8D8" fill-rule="evenodd"/></svg>\');\n }\n .lh-crc .vert-right {\n background: url(\'data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><path d="M7 0h2v27H7zm2 12h7v2H9z" fill="%23D8D8D8" fill-rule="evenodd"/></svg>\');\n }\n .lh-crc .vert {\n background: url(\'data:image/svg+xml;utf8,<svg width="16" height="26" viewBox="0 0 16 26" xmlns="http://www.w3.org/2000/svg"><path d="M7 0h2v26H7z" fill="%23D8D8D8" fill-rule="evenodd"/></svg>\');\n }\n .lh-crc .crc-tree {\n font-size: 14px;\n width: 100%;\n overflow-x: auto;\n }\n .lh-crc .crc-node {\n height: 26px;\n line-height: 26px;\n white-space: nowrap;\n }\n .lh-crc .crc-node__tree-value {\n margin-left: 10px;\n }\n .lh-crc .crc-node__tree-value div {\n display: inline;\n }\n .lh-crc .crc-node__chain-duration {\n font-weight: 700;\n }\n .lh-crc .crc-initial-nav {\n color: #595959;\n font-style: italic;\n }\n .lh-crc__summary-value {\n margin-bottom: 10px;\n }\n ');
|
|
117
119
|
const el3 = dom.createElement('div');
|
|
118
120
|
const el4 = dom.createElement('div', 'lh-crc__summary-value');
|
|
119
121
|
const el5 = dom.createElement('span', 'lh-crc__longest_duration_label');
|
|
@@ -121,7 +123,7 @@ function createCrcComponent(dom) {
|
|
|
121
123
|
el4.append(' ', el5, ' ', el6, ' ');
|
|
122
124
|
el3.append(' ', el4, ' ');
|
|
123
125
|
const el7 = dom.createElement('div', 'lh-crc');
|
|
124
|
-
const el8 = dom.createElement('div', '
|
|
126
|
+
const el8 = dom.createElement('div', 'crc-initial-nav');
|
|
125
127
|
el7.append(' ', el8, ' ', ' ');
|
|
126
128
|
el1.append(' ', el2, ' ', el3, ' ', el7, ' ');
|
|
127
129
|
el0.append(el1);
|
|
@@ -129,20 +131,20 @@ function createCrcComponent(dom) {
|
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
/**
|
|
132
|
-
* @param {
|
|
134
|
+
* @param {DOM_} dom
|
|
133
135
|
*/
|
|
134
136
|
function createCrcChainComponent(dom) {
|
|
135
137
|
const el0 = dom.document().createDocumentFragment();
|
|
136
|
-
const el1 = dom.createElement('div', '
|
|
137
|
-
const el2 = dom.createElement('span', '
|
|
138
|
-
const el3 = dom.createElement('span', '
|
|
138
|
+
const el1 = dom.createElement('div', 'crc-node');
|
|
139
|
+
const el2 = dom.createElement('span', 'crc-node__tree-marker');
|
|
140
|
+
const el3 = dom.createElement('span', 'crc-node__tree-value');
|
|
139
141
|
el1.append(' ', el2, ' ', el3, ' ');
|
|
140
142
|
el0.append(el1);
|
|
141
143
|
return el0;
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
/**
|
|
145
|
-
* @param {
|
|
147
|
+
* @param {DOM_} dom
|
|
146
148
|
*/
|
|
147
149
|
function createElementScreenshotComponent(dom) {
|
|
148
150
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -167,7 +169,7 @@ function createElementScreenshotComponent(dom) {
|
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
/**
|
|
170
|
-
* @param {
|
|
172
|
+
* @param {DOM_} dom
|
|
171
173
|
*/
|
|
172
174
|
function createEnvItemComponent(dom) {
|
|
173
175
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -180,7 +182,7 @@ function createEnvItemComponent(dom) {
|
|
|
180
182
|
}
|
|
181
183
|
|
|
182
184
|
/**
|
|
183
|
-
* @param {
|
|
185
|
+
* @param {DOM_} dom
|
|
184
186
|
*/
|
|
185
187
|
function createFooterComponent(dom) {
|
|
186
188
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -210,7 +212,7 @@ function createFooterComponent(dom) {
|
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
/**
|
|
213
|
-
* @param {
|
|
215
|
+
* @param {DOM_} dom
|
|
214
216
|
*/
|
|
215
217
|
function createGaugeComponent(dom) {
|
|
216
218
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -239,12 +241,12 @@ function createGaugeComponent(dom) {
|
|
|
239
241
|
}
|
|
240
242
|
|
|
241
243
|
/**
|
|
242
|
-
* @param {
|
|
244
|
+
* @param {DOM_} dom
|
|
243
245
|
*/
|
|
244
246
|
function createGaugePwaComponent(dom) {
|
|
245
247
|
const el0 = dom.document().createDocumentFragment();
|
|
246
248
|
const el1 = dom.createElement('style');
|
|
247
|
-
el1.append('\n .lh-gauge--pwa .lh-gauge--pwa__component {\n display: none;\n }\n .lh-gauge--pwa__wrapper:not(.lh-badged--all) .lh-gauge--pwa__logo > path {\n /* Gray logo unless everything is passing. */\n fill: #B0B0B0;\n }\n\n .lh-gauge--pwa__disc {\n fill: var(--color-gray-200);\n }\n\n .lh-gauge--pwa__logo--primary-color {\n fill: #304FFE;\n }\n\n .lh-gauge--pwa__logo--secondary-color {\n fill: #3D3D3D;\n }\n .
|
|
249
|
+
el1.append('\n .lh-gauge--pwa .lh-gauge--pwa__component {\n display: none;\n }\n .lh-gauge--pwa__wrapper:not(.lh-badged--all) .lh-gauge--pwa__logo > path {\n /* Gray logo unless everything is passing. */\n fill: #B0B0B0;\n }\n\n .lh-gauge--pwa__disc {\n fill: var(--color-gray-200);\n }\n\n .lh-gauge--pwa__logo--primary-color {\n fill: #304FFE;\n }\n\n .lh-gauge--pwa__logo--secondary-color {\n fill: #3D3D3D;\n }\n .dark .lh-gauge--pwa__logo--secondary-color {\n fill: #D8B6B6;\n }\n\n /* No passing groups. */\n .lh-gauge--pwa__wrapper:not([class*=\'lh-badged--\']) .lh-gauge--pwa__na-line {\n display: inline;\n }\n /* Just optimized. Same n/a line as no passing groups. */\n .lh-gauge--pwa__wrapper.lh-badged--pwa-optimized:not(.lh-badged--pwa-installable) .lh-gauge--pwa__na-line {\n display: inline;\n }\n\n /* Just installable. */\n .lh-gauge--pwa__wrapper.lh-badged--pwa-installable .lh-gauge--pwa__installable-badge {\n display: inline;\n }\n\n /* All passing groups. */\n .lh-gauge--pwa__wrapper.lh-badged--all .lh-gauge--pwa__check-circle {\n display: inline;\n }\n ');
|
|
248
250
|
el0.append(el1);
|
|
249
251
|
const el2 = dom.createElement('a', 'lh-gauge__wrapper lh-gauge--pwa__wrapper');
|
|
250
252
|
el2.setAttribute('href', '#');
|
|
@@ -340,12 +342,12 @@ function createGaugePwaComponent(dom) {
|
|
|
340
342
|
}
|
|
341
343
|
|
|
342
344
|
/**
|
|
343
|
-
* @param {
|
|
345
|
+
* @param {DOM_} dom
|
|
344
346
|
*/
|
|
345
347
|
function createHeadingComponent(dom) {
|
|
346
348
|
const el0 = dom.document().createDocumentFragment();
|
|
347
349
|
const el1 = dom.createElement('style');
|
|
348
|
-
el1.append('\n /* CSS Fireworks. Originally by Eddie Lin\n https://codepen.io/paulirish/pen/yEVMbP\n */\n .
|
|
350
|
+
el1.append('\n /* CSS Fireworks. Originally by Eddie Lin\n https://codepen.io/paulirish/pen/yEVMbP\n */\n .pyro {\n display: none;\n z-index: 1;\n pointer-events: none;\n }\n .score100 .pyro {\n display: block;\n }\n .score100 .lh-lighthouse stop:first-child {\n stop-color: hsla(200, 12%, 95%, 0);\n }\n .score100 .lh-lighthouse stop:last-child {\n stop-color: hsla(65, 81%, 76%, 1);\n }\n\n .pyro > .before, .pyro > .after {\n position: absolute;\n width: 5px;\n height: 5px;\n border-radius: 2.5px;\n box-shadow: 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff, 0 0 #fff;\n animation: 1s bang ease-out infinite backwards, 1s gravity ease-in infinite backwards, 5s position linear infinite backwards;\n animation-delay: 1s, 1s, 1s;\n }\n\n .pyro > .after {\n animation-delay: 2.25s, 2.25s, 2.25s;\n animation-duration: 1.25s, 1.25s, 6.25s;\n }\n .fireworks-paused .pyro > div {\n animation-play-state: paused;\n }\n\n @keyframes bang {\n to {\n box-shadow: -70px -115.67px #47ebbc, -28px -99.67px #eb47a4, 58px -31.67px #7eeb47, 13px -141.67px #eb47c5, -19px 6.33px #7347eb, -2px -74.67px #ebd247, 24px -151.67px #eb47e0, 57px -138.67px #b4eb47, -51px -104.67px #479eeb, 62px 8.33px #ebcf47, -93px 0.33px #d547eb, -16px -118.67px #47bfeb, 53px -84.67px #47eb83, 66px -57.67px #eb47bf, -93px -65.67px #91eb47, 30px -13.67px #86eb47, -2px -59.67px #83eb47, -44px 1.33px #eb47eb, 61px -58.67px #47eb73, 5px -22.67px #47e8eb, -66px -28.67px #ebe247, 42px -123.67px #eb5547, -75px 26.33px #7beb47, 15px -52.67px #a147eb, 36px -51.67px #eb8347, -38px -12.67px #eb5547, -46px -59.67px #47eb81, 78px -114.67px #eb47ba, 15px -156.67px #eb47bf, -36px 1.33px #eb4783, -72px -86.67px #eba147, 31px -46.67px #ebe247, -68px 29.33px #47e2eb, -55px 19.33px #ebe047, -56px 27.33px #4776eb, -13px -91.67px #eb5547, -47px -138.67px #47ebc7, -18px -96.67px #eb47ac, 11px -88.67px #4783eb, -67px -28.67px #47baeb, 53px 10.33px #ba47eb, 11px 19.33px #5247eb, -5px -11.67px #eb4791, -68px -4.67px #47eba7, 95px -37.67px #eb478b, -67px -162.67px #eb5d47, -54px -120.67px #eb6847, 49px -12.67px #ebe047, 88px 8.33px #47ebda, 97px 33.33px #eb8147, 6px -71.67px #ebbc47;\n }\n }\n @keyframes gravity {\n to {\n transform: translateY(80px);\n opacity: 0;\n }\n }\n @keyframes position {\n 0%, 19.9% {\n margin-top: 4%;\n margin-left: 47%;\n }\n 20%, 39.9% {\n margin-top: 7%;\n margin-left: 30%;\n }\n 40%, 59.9% {\n margin-top: 6%;\n margin-left: 70%;\n }\n 60%, 79.9% {\n margin-top: 3%;\n margin-left: 20%;\n }\n 80%, 99.9% {\n margin-top: 3%;\n margin-left: 80%;\n }\n }\n ');
|
|
349
351
|
el0.append(el1);
|
|
350
352
|
const el2 = dom.createElement('div', 'lh-header-container');
|
|
351
353
|
const el3 = dom.createElement('div', 'lh-scores-wrapper-placeholder');
|
|
@@ -355,7 +357,7 @@ function createHeadingComponent(dom) {
|
|
|
355
357
|
}
|
|
356
358
|
|
|
357
359
|
/**
|
|
358
|
-
* @param {
|
|
360
|
+
* @param {DOM_} dom
|
|
359
361
|
*/
|
|
360
362
|
function createMetricComponent(dom) {
|
|
361
363
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -371,7 +373,7 @@ function createMetricComponent(dom) {
|
|
|
371
373
|
}
|
|
372
374
|
|
|
373
375
|
/**
|
|
374
|
-
* @param {
|
|
376
|
+
* @param {DOM_} dom
|
|
375
377
|
*/
|
|
376
378
|
function createMetricsToggleComponent(dom) {
|
|
377
379
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -409,7 +411,7 @@ function createMetricsToggleComponent(dom) {
|
|
|
409
411
|
}
|
|
410
412
|
|
|
411
413
|
/**
|
|
412
|
-
* @param {
|
|
414
|
+
* @param {DOM_} dom
|
|
413
415
|
*/
|
|
414
416
|
function createOpportunityComponent(dom) {
|
|
415
417
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -443,7 +445,7 @@ function createOpportunityComponent(dom) {
|
|
|
443
445
|
}
|
|
444
446
|
|
|
445
447
|
/**
|
|
446
|
-
* @param {
|
|
448
|
+
* @param {DOM_} dom
|
|
447
449
|
*/
|
|
448
450
|
function createOpportunityHeaderComponent(dom) {
|
|
449
451
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -456,7 +458,7 @@ function createOpportunityHeaderComponent(dom) {
|
|
|
456
458
|
}
|
|
457
459
|
|
|
458
460
|
/**
|
|
459
|
-
* @param {
|
|
461
|
+
* @param {DOM_} dom
|
|
460
462
|
*/
|
|
461
463
|
function createScorescaleComponent(dom) {
|
|
462
464
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -473,7 +475,7 @@ function createScorescaleComponent(dom) {
|
|
|
473
475
|
}
|
|
474
476
|
|
|
475
477
|
/**
|
|
476
|
-
* @param {
|
|
478
|
+
* @param {DOM_} dom
|
|
477
479
|
*/
|
|
478
480
|
function createScoresWrapperComponent(dom) {
|
|
479
481
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -482,9 +484,9 @@ function createScoresWrapperComponent(dom) {
|
|
|
482
484
|
el0.append(el1);
|
|
483
485
|
const el2 = dom.createElement('div', 'lh-scores-wrapper');
|
|
484
486
|
const el3 = dom.createElement('div', 'lh-scores-container');
|
|
485
|
-
const el4 = dom.createElement('div', '
|
|
486
|
-
const el5 = dom.createElement('div', '
|
|
487
|
-
const el6 = dom.createElement('div', '
|
|
487
|
+
const el4 = dom.createElement('div', 'pyro');
|
|
488
|
+
const el5 = dom.createElement('div', 'before');
|
|
489
|
+
const el6 = dom.createElement('div', 'after');
|
|
488
490
|
el4.append(' ', el5, ' ', el6, ' ');
|
|
489
491
|
el3.append(' ', el4, ' ');
|
|
490
492
|
el2.append(' ', el3, ' ');
|
|
@@ -493,7 +495,7 @@ function createScoresWrapperComponent(dom) {
|
|
|
493
495
|
}
|
|
494
496
|
|
|
495
497
|
/**
|
|
496
|
-
* @param {
|
|
498
|
+
* @param {DOM_} dom
|
|
497
499
|
*/
|
|
498
500
|
function createSnippetComponent(dom) {
|
|
499
501
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -506,7 +508,7 @@ function createSnippetComponent(dom) {
|
|
|
506
508
|
}
|
|
507
509
|
|
|
508
510
|
/**
|
|
509
|
-
* @param {
|
|
511
|
+
* @param {DOM_} dom
|
|
510
512
|
*/
|
|
511
513
|
function createSnippetContentComponent(dom) {
|
|
512
514
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -518,7 +520,7 @@ function createSnippetContentComponent(dom) {
|
|
|
518
520
|
}
|
|
519
521
|
|
|
520
522
|
/**
|
|
521
|
-
* @param {
|
|
523
|
+
* @param {DOM_} dom
|
|
522
524
|
*/
|
|
523
525
|
function createSnippetHeaderComponent(dom) {
|
|
524
526
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -535,7 +537,7 @@ function createSnippetHeaderComponent(dom) {
|
|
|
535
537
|
}
|
|
536
538
|
|
|
537
539
|
/**
|
|
538
|
-
* @param {
|
|
540
|
+
* @param {DOM_} dom
|
|
539
541
|
*/
|
|
540
542
|
function createSnippetLineComponent(dom) {
|
|
541
543
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -549,12 +551,12 @@ function createSnippetLineComponent(dom) {
|
|
|
549
551
|
}
|
|
550
552
|
|
|
551
553
|
/**
|
|
552
|
-
* @param {
|
|
554
|
+
* @param {DOM_} dom
|
|
553
555
|
*/
|
|
554
556
|
function createTopbarComponent(dom) {
|
|
555
557
|
const el0 = dom.document().createDocumentFragment();
|
|
556
558
|
const el1 = dom.createElement('style');
|
|
557
|
-
el1.append('\n .lh-topbar {\n position: sticky;\n top: 0;\n left: 0;\n right: 0;\n z-index: 1000;\n display: flex;\n align-items: center;\n height: var(--topbar-height);\n background-color: var(--topbar-background-color);\n padding: var(--topbar-padding);\n }\n\n .lh-topbar__logo {\n width: var(--topbar-logo-size);\n height: var(--topbar-logo-size);\n user-select: none;\n flex: none;\n }\n\n .lh-topbar__url {\n margin: var(--topbar-padding);\n text-decoration: none;\n color: var(--report-text-color);\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n\n .lh-tools {\n margin-left: auto;\n will-change: transform;\n min-width: var(--report-icon-size);\n }\n .lh-tools__button {\n width: var(--report-icon-size);\n height: var(--report-icon-size);\n cursor: pointer;\n margin-right: 5px;\n /* This is actually a button element, but we want to style it like a transparent div. */\n display: flex;\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n font: inherit;\n outline: inherit;\n }\n .lh-tools__button svg {\n fill: var(--tools-icon-color);\n }\n .
|
|
559
|
+
el1.append('\n .lh-topbar {\n position: sticky;\n top: 0;\n left: 0;\n right: 0;\n z-index: 1000;\n display: flex;\n align-items: center;\n height: var(--topbar-height);\n background-color: var(--topbar-background-color);\n padding: var(--topbar-padding);\n }\n\n .lh-topbar__logo {\n width: var(--topbar-logo-size);\n height: var(--topbar-logo-size);\n user-select: none;\n flex: none;\n }\n .lh-topbar__logo .shape {\n fill: var(--report-text-color);\n }\n\n .lh-topbar__url {\n margin: var(--topbar-padding);\n text-decoration: none;\n color: var(--report-text-color);\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n\n .lh-tools {\n margin-left: auto;\n will-change: transform;\n min-width: var(--report-icon-size);\n }\n .lh-tools__button {\n width: var(--report-icon-size);\n height: var(--report-icon-size);\n cursor: pointer;\n margin-right: 5px;\n /* This is actually a button element, but we want to style it like a transparent div. */\n display: flex;\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n font: inherit;\n outline: inherit;\n }\n .lh-tools__button svg {\n fill: var(--tools-icon-color);\n }\n .dark .lh-tools__button svg {\n filter: invert(1);\n }\n .lh-tools__button.active + .lh-tools__dropdown {\n opacity: 1;\n clip: rect(-1px, 194px, 242px, -3px);\n visibility: visible;\n }\n .lh-tools__dropdown {\n position: absolute;\n background-color: var(--report-background-color);\n border: 1px solid var(--report-border-color);\n border-radius: 3px;\n padding: calc(var(--default-padding) / 2) 0;\n cursor: pointer;\n top: 36px;\n right: 0;\n box-shadow: 1px 1px 3px #ccc;\n min-width: 125px;\n clip: rect(0, 164px, 0, 0);\n visibility: hidden;\n opacity: 0;\n transition: all 200ms cubic-bezier(0,0,0.2,1);\n }\n .lh-tools__dropdown a {\n color: currentColor;\n text-decoration: none;\n white-space: nowrap;\n padding: 0 12px;\n line-height: 2;\n }\n .lh-tools__dropdown a:hover,\n .lh-tools__dropdown a:focus {\n background-color: var(--color-gray-200);\n outline: none;\n }\n /* save-gist option hidden in report. */\n .lh-tools__dropdown a[data-action=\'save-gist\'] {\n display: none;\n }\n\n @media screen and (max-width: 964px) {\n .lh-tools__dropdown {\n right: 0;\n left: initial;\n }\n }\n @media print {\n .lh-topbar {\n position: static;\n margin-left: 0;\n }\n\n .lh-tools__dropdown {\n display: none;\n }\n }\n ');
|
|
558
560
|
el0.append(el1);
|
|
559
561
|
const el2 = dom.createElement('div', 'lh-topbar');
|
|
560
562
|
const el3 = dom.createElementNS('http://www.w3.org/2000/svg', 'svg', 'lh-topbar__logo');
|
|
@@ -683,49 +685,49 @@ function createTopbarComponent(dom) {
|
|
|
683
685
|
el31.setAttribute('id', 'lh-tools-dropdown');
|
|
684
686
|
el31.setAttribute('role', 'menu');
|
|
685
687
|
el31.setAttribute('aria-labelledby', 'lh-tools-button');
|
|
686
|
-
const el32 = dom.createElement('a', '
|
|
688
|
+
const el32 = dom.createElement('a', 'report-icon report-icon--print');
|
|
687
689
|
el32.setAttribute('role', 'menuitem');
|
|
688
690
|
el32.setAttribute('tabindex', '-1');
|
|
689
691
|
el32.setAttribute('href', '#');
|
|
690
692
|
el32.setAttribute('data-i18n', 'dropdownPrintSummary');
|
|
691
693
|
el32.setAttribute('data-action', 'print-summary');
|
|
692
|
-
const el33 = dom.createElement('a', '
|
|
694
|
+
const el33 = dom.createElement('a', 'report-icon report-icon--print');
|
|
693
695
|
el33.setAttribute('role', 'menuitem');
|
|
694
696
|
el33.setAttribute('tabindex', '-1');
|
|
695
697
|
el33.setAttribute('href', '#');
|
|
696
698
|
el33.setAttribute('data-i18n', 'dropdownPrintExpanded');
|
|
697
699
|
el33.setAttribute('data-action', 'print-expanded');
|
|
698
|
-
const el34 = dom.createElement('a', '
|
|
700
|
+
const el34 = dom.createElement('a', 'report-icon report-icon--copy');
|
|
699
701
|
el34.setAttribute('role', 'menuitem');
|
|
700
702
|
el34.setAttribute('tabindex', '-1');
|
|
701
703
|
el34.setAttribute('href', '#');
|
|
702
704
|
el34.setAttribute('data-i18n', 'dropdownCopyJSON');
|
|
703
705
|
el34.setAttribute('data-action', 'copy');
|
|
704
|
-
const el35 = dom.createElement('a', '
|
|
706
|
+
const el35 = dom.createElement('a', 'report-icon report-icon--download');
|
|
705
707
|
el35.setAttribute('role', 'menuitem');
|
|
706
708
|
el35.setAttribute('tabindex', '-1');
|
|
707
709
|
el35.setAttribute('href', '#');
|
|
708
710
|
el35.setAttribute('data-i18n', 'dropdownSaveHTML');
|
|
709
711
|
el35.setAttribute('data-action', 'save-html');
|
|
710
|
-
const el36 = dom.createElement('a', '
|
|
712
|
+
const el36 = dom.createElement('a', 'report-icon report-icon--download');
|
|
711
713
|
el36.setAttribute('role', 'menuitem');
|
|
712
714
|
el36.setAttribute('tabindex', '-1');
|
|
713
715
|
el36.setAttribute('href', '#');
|
|
714
716
|
el36.setAttribute('data-i18n', 'dropdownSaveJSON');
|
|
715
717
|
el36.setAttribute('data-action', 'save-json');
|
|
716
|
-
const el37 = dom.createElement('a', '
|
|
718
|
+
const el37 = dom.createElement('a', 'report-icon report-icon--open');
|
|
717
719
|
el37.setAttribute('role', 'menuitem');
|
|
718
720
|
el37.setAttribute('tabindex', '-1');
|
|
719
721
|
el37.setAttribute('href', '#');
|
|
720
722
|
el37.setAttribute('data-i18n', 'dropdownViewer');
|
|
721
723
|
el37.setAttribute('data-action', 'open-viewer');
|
|
722
|
-
const el38 = dom.createElement('a', '
|
|
724
|
+
const el38 = dom.createElement('a', 'report-icon report-icon--open');
|
|
723
725
|
el38.setAttribute('role', 'menuitem');
|
|
724
726
|
el38.setAttribute('tabindex', '-1');
|
|
725
727
|
el38.setAttribute('href', '#');
|
|
726
728
|
el38.setAttribute('data-i18n', 'dropdownSaveGist');
|
|
727
729
|
el38.setAttribute('data-action', 'save-gist');
|
|
728
|
-
const el39 = dom.createElement('a', '
|
|
730
|
+
const el39 = dom.createElement('a', 'report-icon report-icon--dark');
|
|
729
731
|
el39.setAttribute('role', 'menuitem');
|
|
730
732
|
el39.setAttribute('tabindex', '-1');
|
|
731
733
|
el39.setAttribute('href', '#');
|
|
@@ -739,7 +741,7 @@ function createTopbarComponent(dom) {
|
|
|
739
741
|
}
|
|
740
742
|
|
|
741
743
|
/**
|
|
742
|
-
* @param {
|
|
744
|
+
* @param {DOM_} dom
|
|
743
745
|
*/
|
|
744
746
|
function createWarningsToplevelComponent(dom) {
|
|
745
747
|
const el0 = dom.document().createDocumentFragment();
|
|
@@ -754,7 +756,7 @@ function createWarningsToplevelComponent(dom) {
|
|
|
754
756
|
|
|
755
757
|
/** @typedef {'3pFilter'|'audit'|'categoryHeader'|'chevron'|'clump'|'crc'|'crcChain'|'elementScreenshot'|'envItem'|'footer'|'gauge'|'gaugePwa'|'heading'|'metric'|'metricsToggle'|'opportunity'|'opportunityHeader'|'scorescale'|'scoresWrapper'|'snippet'|'snippetContent'|'snippetHeader'|'snippetLine'|'topbar'|'warningsToplevel'} ComponentName */
|
|
756
758
|
/**
|
|
757
|
-
* @param {
|
|
759
|
+
* @param {DOM_} dom
|
|
758
760
|
* @param {ComponentName} componentName
|
|
759
761
|
* @return {DocumentFragment}
|
|
760
762
|
*/
|
|
@@ -91,46 +91,46 @@ export class CriticalRequestChainRenderer {
|
|
|
91
91
|
const chainEl = dom.createComponent('crcChain');
|
|
92
92
|
|
|
93
93
|
// Hovering over request shows full URL.
|
|
94
|
-
dom.find('.
|
|
94
|
+
dom.find('.crc-node', chainEl).setAttribute('title', segment.node.request.url);
|
|
95
95
|
|
|
96
|
-
const treeMarkeEl = dom.find('.
|
|
96
|
+
const treeMarkeEl = dom.find('.crc-node__tree-marker', chainEl);
|
|
97
97
|
|
|
98
98
|
// Construct lines and add spacers for sub requests.
|
|
99
99
|
segment.treeMarkers.forEach(separator => {
|
|
100
100
|
if (separator) {
|
|
101
|
-
treeMarkeEl.appendChild(dom.createElement('span', '
|
|
102
|
-
treeMarkeEl.appendChild(dom.createElement('span', '
|
|
101
|
+
treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker vert'));
|
|
102
|
+
treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker'));
|
|
103
103
|
} else {
|
|
104
|
-
treeMarkeEl.appendChild(dom.createElement('span', '
|
|
105
|
-
treeMarkeEl.appendChild(dom.createElement('span', '
|
|
104
|
+
treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker'));
|
|
105
|
+
treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker'));
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
if (segment.isLastChild) {
|
|
110
|
-
treeMarkeEl.appendChild(dom.createElement('span', '
|
|
111
|
-
treeMarkeEl.appendChild(dom.createElement('span', '
|
|
110
|
+
treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker up-right'));
|
|
111
|
+
treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker right'));
|
|
112
112
|
} else {
|
|
113
|
-
treeMarkeEl.appendChild(dom.createElement('span', '
|
|
114
|
-
treeMarkeEl.appendChild(dom.createElement('span', '
|
|
113
|
+
treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker vert-right'));
|
|
114
|
+
treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker right'));
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
if (segment.hasChildren) {
|
|
118
|
-
treeMarkeEl.appendChild(dom.createElement('span', '
|
|
118
|
+
treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker horiz-down'));
|
|
119
119
|
} else {
|
|
120
|
-
treeMarkeEl.appendChild(dom.createElement('span', '
|
|
120
|
+
treeMarkeEl.appendChild(dom.createElement('span', 'tree-marker right'));
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
// Fill in url, host, and request size information.
|
|
124
124
|
const url = segment.node.request.url;
|
|
125
125
|
const linkEl = detailsRenderer.renderTextURL(url);
|
|
126
|
-
const treevalEl = dom.find('.
|
|
126
|
+
const treevalEl = dom.find('.crc-node__tree-value', chainEl);
|
|
127
127
|
treevalEl.appendChild(linkEl);
|
|
128
128
|
|
|
129
129
|
if (!segment.hasChildren) {
|
|
130
130
|
const {startTime, endTime, transferSize} = segment.node.request;
|
|
131
|
-
const span = dom.createElement('span', '
|
|
131
|
+
const span = dom.createElement('span', 'crc-node__chain-duration');
|
|
132
132
|
span.textContent = ' - ' + Util.i18n.formatMilliseconds((endTime - startTime) * 1000) + ', ';
|
|
133
|
-
const span2 = dom.createElement('span', '
|
|
133
|
+
const span2 = dom.createElement('span', 'crc-node__chain-duration');
|
|
134
134
|
span2.textContent = Util.i18n.formatBytesToKiB(transferSize, 0.01);
|
|
135
135
|
|
|
136
136
|
treevalEl.appendChild(span);
|
|
@@ -171,7 +171,7 @@ export class CriticalRequestChainRenderer {
|
|
|
171
171
|
const containerEl = dom.find('.lh-crc', tmpl);
|
|
172
172
|
|
|
173
173
|
// Fill in top summary.
|
|
174
|
-
dom.find('.
|
|
174
|
+
dom.find('.crc-initial-nav', tmpl).textContent = Util.i18n.strings.crcInitialNavigation;
|
|
175
175
|
dom.find('.lh-crc__longest_duration_label', tmpl).textContent =
|
|
176
176
|
Util.i18n.strings.crcLongestDurationLabel;
|
|
177
177
|
dom.find('.lh-crc__longest_duration', tmpl).textContent =
|
|
@@ -35,7 +35,7 @@ const URL_PREFIXES = ['http://', 'https://', 'data:'];
|
|
|
35
35
|
export class DetailsRenderer {
|
|
36
36
|
/**
|
|
37
37
|
* @param {DOM} dom
|
|
38
|
-
* @param {{fullPageScreenshot?: LH.
|
|
38
|
+
* @param {{fullPageScreenshot?: LH.Artifacts.FullPageScreenshot}} [options]
|
|
39
39
|
*/
|
|
40
40
|
constructor(dom, options = {}) {
|
|
41
41
|
this._dom = dom;
|
package/report/renderer/dom.js
CHANGED
|
@@ -16,8 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
'use strict';
|
|
18
18
|
|
|
19
|
-
/* eslint-env browser */
|
|
20
|
-
|
|
21
19
|
/** @typedef {HTMLElementTagNameMap & {[id: string]: HTMLElement}} HTMLElementByTagName */
|
|
22
20
|
/** @template {string} T @typedef {import('typed-query-selector/parser').ParseSelector<T, Element>} ParseSelector */
|
|
23
21
|
|
|
@@ -109,10 +107,6 @@ export class DOM {
|
|
|
109
107
|
return cloned;
|
|
110
108
|
}
|
|
111
109
|
|
|
112
|
-
clearComponentCache() {
|
|
113
|
-
this._componentCache.clear();
|
|
114
|
-
}
|
|
115
|
-
|
|
116
110
|
/**
|
|
117
111
|
* @param {string} text
|
|
118
112
|
* @return {Element}
|
|
@@ -260,15 +254,4 @@ export class DOM {
|
|
|
260
254
|
const elements = Array.from(context.querySelectorAll(query));
|
|
261
255
|
return elements;
|
|
262
256
|
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Fires a custom DOM event on target.
|
|
266
|
-
* @param {string} name Name of the event.
|
|
267
|
-
* @param {Node=} target DOM node to fire the event on.
|
|
268
|
-
* @param {*=} detail Custom data to include.
|
|
269
|
-
*/
|
|
270
|
-
fireEventOn(name, target = this._document, detail) {
|
|
271
|
-
const event = new CustomEvent(name, detail ? {detail} : undefined);
|
|
272
|
-
target.dispatchEvent(event);
|
|
273
|
-
}
|
|
274
257
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
/** @typedef {import('./dom.js').DOM} DOM */
|
|
15
|
-
/** @typedef {LH.
|
|
15
|
+
/** @typedef {LH.Artifacts.Rect} Rect */
|
|
16
16
|
/** @typedef {{width: number, height: number}} Size */
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
* @property {DOM} dom
|
|
21
21
|
* @property {Element} reportEl
|
|
22
22
|
* @property {Element} overlayContainerEl
|
|
23
|
-
* @property {LH.
|
|
23
|
+
* @property {LH.Artifacts.FullPageScreenshot} fullPageScreenshot
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import {Util} from './util.js';
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* @param {LH.
|
|
30
|
-
* @param {LH.
|
|
29
|
+
* @param {LH.Artifacts.FullPageScreenshot['screenshot']} screenshot
|
|
30
|
+
* @param {LH.Artifacts.Rect} rect
|
|
31
31
|
* @return {boolean}
|
|
32
32
|
*/
|
|
33
33
|
function screenshotOverlapsRect(screenshot, rect) {
|
|
@@ -98,7 +98,7 @@ export class ElementScreenshotRenderer {
|
|
|
98
98
|
* @param {DOM} dom
|
|
99
99
|
* @param {HTMLElement} maskEl
|
|
100
100
|
* @param {{left: number, top: number}} positionClip
|
|
101
|
-
* @param {Rect} elementRect
|
|
101
|
+
* @param {LH.Artifacts.Rect} elementRect
|
|
102
102
|
* @param {Size} elementPreviewSize
|
|
103
103
|
*/
|
|
104
104
|
static renderClipPathInScreenshot(dom, maskEl, positionClip, elementRect, elementPreviewSize) {
|
|
@@ -132,7 +132,7 @@ export class ElementScreenshotRenderer {
|
|
|
132
132
|
* Allows for multiple Lighthouse reports to be rendered on the page, each with their
|
|
133
133
|
* own full page screenshot.
|
|
134
134
|
* @param {HTMLElement} el
|
|
135
|
-
* @param {LH.
|
|
135
|
+
* @param {LH.Artifacts.FullPageScreenshot['screenshot']} screenshot
|
|
136
136
|
*/
|
|
137
137
|
static installFullPageScreenshot(el, screenshot) {
|
|
138
138
|
el.style.setProperty('--element-screenshot-url', `url(${screenshot.data})`);
|
|
@@ -195,7 +195,7 @@ export class ElementScreenshotRenderer {
|
|
|
195
195
|
/**
|
|
196
196
|
* Given the size of the element in the screenshot and the total available size of our preview container,
|
|
197
197
|
* compute the factor by which we need to zoom out to view the entire element with context.
|
|
198
|
-
* @param {Rect} elementRectSC
|
|
198
|
+
* @param {LH.Artifacts.Rect} elementRectSC
|
|
199
199
|
* @param {Size} renderContainerSizeDC
|
|
200
200
|
* @return {number}
|
|
201
201
|
*/
|
|
@@ -214,8 +214,8 @@ export class ElementScreenshotRenderer {
|
|
|
214
214
|
* Used to render both the thumbnail preview in details tables and the full-page screenshot in the lightbox.
|
|
215
215
|
* Returns null if element rect is outside screenshot bounds.
|
|
216
216
|
* @param {DOM} dom
|
|
217
|
-
* @param {LH.
|
|
218
|
-
* @param {Rect} elementRectSC Region of screenshot to highlight.
|
|
217
|
+
* @param {LH.Artifacts.FullPageScreenshot['screenshot']} screenshot
|
|
218
|
+
* @param {LH.Artifacts.Rect} elementRectSC Region of screenshot to highlight.
|
|
219
219
|
* @param {Size} maxRenderSizeDC e.g. maxThumbnailSize or maxLightboxSize.
|
|
220
220
|
* @return {Element|null}
|
|
221
221
|
*/
|
|
@@ -3,9 +3,6 @@
|
|
|
3
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
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
5
|
*/
|
|
6
|
+
'use strict';
|
|
6
7
|
|
|
7
|
-
export
|
|
8
|
-
// Use consistent TZ across testing environments.
|
|
9
|
-
// Timezone is used to construct date strings.
|
|
10
|
-
process.env.TZ = 'UTC';
|
|
11
|
-
};
|
|
8
|
+
export {getFilenamePrefix} from '../../lighthouse-core/lib/file-namer.js';
|
|
@@ -38,10 +38,10 @@ export class Logger {
|
|
|
38
38
|
this._id && clearTimeout(this._id);
|
|
39
39
|
|
|
40
40
|
this.el.textContent = msg;
|
|
41
|
-
this.el.classList.add('
|
|
41
|
+
this.el.classList.add('show');
|
|
42
42
|
if (autoHide) {
|
|
43
|
-
this._id = setTimeout(
|
|
44
|
-
this.el.classList.remove('
|
|
43
|
+
this._id = setTimeout(_ => {
|
|
44
|
+
this.el.classList.remove('show');
|
|
45
45
|
}, 7000);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -61,7 +61,7 @@ export class Logger {
|
|
|
61
61
|
|
|
62
62
|
// Rethrow to make sure it's auditable as an error, but in a setTimeout so page
|
|
63
63
|
// recovers gracefully and user can try loading a report again.
|
|
64
|
-
setTimeout(
|
|
64
|
+
setTimeout(_ => {
|
|
65
65
|
throw new Error(msg);
|
|
66
66
|
}, 0);
|
|
67
67
|
}
|
|
@@ -39,14 +39,14 @@ export class ReportRenderer {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* @param {LH.Result}
|
|
42
|
+
* @param {LH.Result} result
|
|
43
43
|
* @param {Element} container Parent element to render the report into.
|
|
44
44
|
* @return {!Element}
|
|
45
45
|
*/
|
|
46
|
-
renderReport(
|
|
47
|
-
this._dom.setLighthouseChannel(
|
|
46
|
+
renderReport(result, container) {
|
|
47
|
+
this._dom.setLighthouseChannel(result.configSettings.channel || 'unknown');
|
|
48
48
|
|
|
49
|
-
const report = Util.prepareReportResult(
|
|
49
|
+
const report = Util.prepareReportResult(result);
|
|
50
50
|
|
|
51
51
|
container.textContent = ''; // Remove previous report.
|
|
52
52
|
container.appendChild(this._renderReport(report));
|
|
@@ -54,6 +54,13 @@ export class ReportRenderer {
|
|
|
54
54
|
return container;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* @param {ParentNode} _
|
|
59
|
+
*/
|
|
60
|
+
setTemplateContext(_) {
|
|
61
|
+
// Removed, exists until usage is removed from CDT.
|
|
62
|
+
}
|
|
63
|
+
|
|
57
64
|
/**
|
|
58
65
|
* @param {LH.ReportResult} report
|
|
59
66
|
* @return {DocumentFragment}
|