lighthouse 9.2.0-dev.20211224 → 9.2.0-dev.20211228

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.
@@ -1398,7 +1398,7 @@ function createTopbarComponent(dom) {
1398
1398
  el40.setAttribute('href', '#');
1399
1399
  el40.setAttribute('data-i18n', 'dropdownCopyJSON');
1400
1400
  el40.setAttribute('data-action', 'copy');
1401
- const el41 = dom.createElement('a', 'lh-report-icon lh-report-icon--download');
1401
+ const el41 = dom.createElement('a', 'lh-report-icon lh-report-icon--download lh-hidden');
1402
1402
  el41.setAttribute('role', 'menuitem');
1403
1403
  el41.setAttribute('tabindex', '-1');
1404
1404
  el41.setAttribute('href', '#');
@@ -1428,7 +1428,7 @@ function createTopbarComponent(dom) {
1428
1428
  el45.setAttribute('href', '#');
1429
1429
  el45.setAttribute('data-i18n', 'dropdownDarkTheme');
1430
1430
  el45.setAttribute('data-action', 'toggle-dark');
1431
- el37.append(' ', el38, ' ', el39, ' ', el40, ' ', el41, ' ', el42, ' ', el43, ' ', el44, ' ', el45, ' ');
1431
+ el37.append(' ', el38, ' ', el39, ' ', el40, ' ', ' ', el41, ' ', el42, ' ', el43, ' ', el44, ' ', el45, ' ');
1432
1432
  el26.append(' ', el27, ' ', el33, ' ', el37, ' ');
1433
1433
  el2.append(' ', ' ', el3, ' ', el25, ' ', el26, ' ');
1434
1434
  el0.append(el2);
@@ -5767,6 +5767,10 @@ class ReportUIFeatures {
5767
5767
  });
5768
5768
  }
5769
5769
 
5770
+ if (this._opts.getStandaloneReportHTML) {
5771
+ this._dom.find('a[data-action="save-html"]', this._dom.rootEl).classList.remove('lh-hidden');
5772
+ }
5773
+
5770
5774
  // Fill in all i18n data.
5771
5775
  for (const node of this._dom.findAll('[data-i18n]', this._dom.rootEl)) {
5772
5776
  // These strings are guaranteed to (at least) have a default English string in Util.UIStrings,
@@ -5801,15 +5805,23 @@ class ReportUIFeatures {
5801
5805
  return buttonEl;
5802
5806
  }
5803
5807
 
5808
+ resetUIState() {
5809
+ if (this._topbar) {
5810
+ this._topbar.resetUIState();
5811
+ }
5812
+ }
5813
+
5804
5814
  /**
5805
5815
  * Returns the html that recreates this report.
5806
5816
  * @return {string}
5807
5817
  */
5808
5818
  getReportHtml() {
5809
- if (this._topbar) {
5810
- this._topbar.resetUIState();
5819
+ if (!this._opts.getStandaloneReportHTML) {
5820
+ throw new Error('`getStandaloneReportHTML` is not set');
5811
5821
  }
5812
- return `<!doctype html><body style="margin: 0">${this._dom.rootEl.outerHTML}`;
5822
+
5823
+ this.resetUIState();
5824
+ return this._opts.getStandaloneReportHTML();
5813
5825
  }
5814
5826
 
5815
5827
  /**