lighthouse 11.1.0-dev.20231001 → 11.1.0-dev.20231003

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.
Files changed (33) hide show
  1. package/cli/test/smokehouse/__snapshots__/report-assert-test.js.snap +8 -0
  2. package/core/audits/audit.js +4 -9
  3. package/core/audits/byte-efficiency/uses-long-cache-ttl.js +1 -1
  4. package/core/audits/csp-xss.js +1 -1
  5. package/core/audits/installable-manifest.js +2 -2
  6. package/core/audits/metrics/cumulative-layout-shift.js +4 -1
  7. package/core/audits/metrics/first-contentful-paint.js +1 -0
  8. package/core/audits/metrics/largest-contentful-paint.js +1 -0
  9. package/core/audits/metrics/speed-index.js +1 -0
  10. package/core/audits/metrics/total-blocking-time.js +1 -0
  11. package/core/lib/csp-evaluator.js +13 -13
  12. package/dist/report/bundle.esm.js +243 -89
  13. package/dist/report/flow.js +248 -94
  14. package/dist/report/standalone.js +244 -90
  15. package/package.json +1 -1
  16. package/report/assets/styles.css +227 -78
  17. package/report/assets/templates.html +22 -35
  18. package/report/renderer/components.d.ts +2 -2
  19. package/report/renderer/components.js +34 -51
  20. package/report/renderer/dom.d.ts +24 -4
  21. package/report/renderer/dom.js +30 -3
  22. package/report/renderer/explodey-gauge.d.ts +11 -0
  23. package/report/renderer/explodey-gauge.js +357 -0
  24. package/report/renderer/performance-category-renderer.d.ts +16 -18
  25. package/report/renderer/performance-category-renderer.js +93 -102
  26. package/shared/localization/locales/en-US.json +14 -14
  27. package/shared/localization/locales/en-XL.json +14 -14
  28. package/shared/util.d.ts +22 -0
  29. package/shared/util.js +31 -0
  30. package/types/audit.d.ts +3 -1
  31. package/types/lhr/audit-result.d.ts +9 -0
  32. /package/{core/lib → shared}/statistics.d.ts +0 -0
  33. /package/{core/lib → shared}/statistics.js +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lighthouse",
3
3
  "type": "module",
4
- "version": "11.1.0-dev.20231001",
4
+ "version": "11.1.0-dev.20231003",
5
5
  "description": "Automated auditing, performance metrics, and best practices for the web.",
6
6
  "main": "./core/index.js",
7
7
  "bin": {
@@ -131,7 +131,6 @@
131
131
  --section-padding-vertical: calc(var(--default-padding) * 6);
132
132
  --snippet-background-color: var(--color-gray-50);
133
133
  --snippet-color: #0938C2;
134
- --sparkline-height: 5px;
135
134
  --stackpack-padding-horizontal: 10px;
136
135
  --sticky-header-background-color: var(--report-background-color);
137
136
  --sticky-header-buffer: calc(var(--topbar-height) + var(--sticky-header-height));
@@ -238,11 +237,6 @@
238
237
  --topbar-height: 28px;
239
238
  --topbar-logo-size: 20px;
240
239
  }
241
-
242
- /* Not enough space to adequately show the relative savings bars. */
243
- .lh-sparkline {
244
- display: none;
245
- }
246
240
  }
247
241
 
248
242
  .lh-vars.lh-devtools {
@@ -611,7 +605,6 @@
611
605
 
612
606
 
613
607
  .lh-audit__display-text,
614
- .lh-load-opportunity__sparkline,
615
608
  .lh-chevron-container {
616
609
  margin: 0 var(--audit-margin-horizontal);
617
610
  }
@@ -628,14 +621,11 @@
628
621
  font-size: var(--report-monospace-font-size);
629
622
  }
630
623
 
631
- /* Prepend display text with em dash separator. But not in Opportunities. */
624
+ /* Prepend display text with em dash separator. */
632
625
  .lh-audit__display-text:not(:empty):before {
633
626
  content: '—';
634
627
  margin-right: var(--audit-margin-horizontal);
635
628
  }
636
- .lh-audit-group.lh-audit-group--load-opportunities .lh-audit__display-text:not(:empty):before {
637
- display: none;
638
- }
639
629
 
640
630
  /* Expandable Details (Audit Groups, Audits) */
641
631
  .lh-audit__header {
@@ -644,10 +634,6 @@
644
634
  padding: var(--default-padding);
645
635
  }
646
636
 
647
- .lh-audit--load-opportunity .lh-audit__header {
648
- display: block;
649
- }
650
-
651
637
 
652
638
  .lh-metricfilter {
653
639
  display: grid;
@@ -875,68 +861,6 @@
875
861
  color: var(--color-fail-secondary);
876
862
  }
877
863
 
878
- /* Perf load opportunity */
879
-
880
- .lh-load-opportunity__cols {
881
- display: flex;
882
- align-items: flex-start;
883
- }
884
-
885
- .lh-load-opportunity__header .lh-load-opportunity__col {
886
- color: var(--color-gray-600);
887
- display: unset;
888
- line-height: calc(2.3 * var(--report-font-size));
889
- }
890
-
891
- .lh-load-opportunity__col {
892
- display: flex;
893
- }
894
-
895
- .lh-load-opportunity__col--one {
896
- flex: 5;
897
- align-items: center;
898
- margin-right: 2px;
899
- }
900
- .lh-load-opportunity__col--two {
901
- flex: 4;
902
- text-align: right;
903
- }
904
-
905
- .lh-audit--load-opportunity .lh-audit__display-text {
906
- text-align: right;
907
- flex: 0 0 7.5ch;
908
- }
909
-
910
-
911
- /* Sparkline */
912
-
913
- .lh-load-opportunity__sparkline {
914
- flex: 1;
915
- margin-top: calc((var(--report-line-height) - var(--sparkline-height)) / 2);
916
- }
917
-
918
- .lh-sparkline {
919
- height: var(--sparkline-height);
920
- width: 100%;
921
- }
922
-
923
- .lh-sparkline__bar {
924
- height: 100%;
925
- float: right;
926
- }
927
-
928
- .lh-audit--pass .lh-sparkline__bar {
929
- background: var(--color-pass);
930
- }
931
-
932
- .lh-audit--average .lh-sparkline__bar {
933
- background: var(--color-average);
934
- }
935
-
936
- .lh-audit--fail .lh-sparkline__bar {
937
- background: var(--color-fail);
938
- }
939
-
940
864
  /* Filmstrip */
941
865
 
942
866
  .lh-filmstrip-container {
@@ -1078,7 +1002,6 @@
1078
1002
 
1079
1003
  .lh-details,
1080
1004
  .lh-category-header__description,
1081
- .lh-load-opportunity__header,
1082
1005
  .lh-audit-group__footer {
1083
1006
  font-size: var(--report-font-size-secondary);
1084
1007
  line-height: var(--report-line-height-secondary);
@@ -1964,5 +1887,231 @@ details[open] .lh-clump-toggletext--hide { display: block;}
1964
1887
  }
1965
1888
  }
1966
1889
 
1890
+ /* Explodey gauge */
1891
+
1892
+ .lh-exp-gauge-component {
1893
+ margin-bottom: 10px;
1894
+ }
1895
+
1896
+ .lh-exp-gauge-component circle {
1897
+ stroke: currentcolor;
1898
+ r: var(--radius);
1899
+ }
1900
+
1901
+ .lh-exp-gauge-component text {
1902
+ font-size: calc(var(--radius) * 0.2);
1903
+ }
1904
+
1905
+ .lh-exp-gauge-component .lh-exp-gauge {
1906
+ margin: 0 auto;
1907
+ width: 225px;
1908
+ stroke-width: var(--stroke-width);
1909
+ stroke-linecap: round;
1910
+
1911
+ /* for better rendering perf */
1912
+ contain: strict;
1913
+ height: 225px;
1914
+ will-change: transform;
1915
+ }
1916
+ .lh-exp-gauge-component .lh-exp-gauge--faded {
1917
+ opacity: 0.1;
1918
+ }
1919
+ .lh-exp-gauge-component .lh-exp-gauge__wrapper {
1920
+ font-family: var(--report-font-family-monospace);
1921
+ text-align: center;
1922
+ text-decoration: none;
1923
+ transition: .3s;
1924
+ }
1925
+ .lh-exp-gauge-component .lh-exp-gauge__wrapper--pass {
1926
+ color: var(--color-pass);
1927
+ }
1928
+ .lh-exp-gauge-component .lh-exp-gauge__wrapper--average {
1929
+ color: var(--color-average);
1930
+ }
1931
+ .lh-exp-gauge-component .lh-exp-gauge__wrapper--fail {
1932
+ color: var(--color-fail);
1933
+ }
1934
+ .lh-exp-gauge-component .state--expanded {
1935
+ transition: color .3s;
1936
+ }
1937
+ .lh-exp-gauge-component .state--highlight {
1938
+ color: var(--color-highlight);
1939
+ }
1940
+ .lh-exp-gauge-component .lh-exp-gauge__svg-wrapper {
1941
+ display: flex;
1942
+ flex-direction: column-reverse;
1943
+ }
1944
+
1945
+ .lh-exp-gauge-component .lh-exp-gauge__label {
1946
+ fill: var(--report-text-color);
1947
+ font-family: var(--report-font-family);
1948
+ font-size: 12px;
1949
+ }
1950
+
1951
+ .lh-exp-gauge-component .lh-exp-gauge__cutout {
1952
+ opacity: .999;
1953
+ transition: opacity .3s;
1954
+ }
1955
+ .lh-exp-gauge-component .state--highlight .lh-exp-gauge__cutout {
1956
+ opacity: 0;
1957
+ }
1958
+
1959
+ .lh-exp-gauge-component .lh-exp-gauge__inner {
1960
+ color: inherit;
1961
+ }
1962
+ .lh-exp-gauge-component .lh-exp-gauge__base {
1963
+ fill: currentcolor;
1964
+ }
1965
+
1966
+
1967
+ .lh-exp-gauge-component .lh-exp-gauge__arc {
1968
+ fill: none;
1969
+ transition: opacity .3s;
1970
+ }
1971
+ .lh-exp-gauge-component .lh-exp-gauge__arc--metric {
1972
+ color: var(--metric-color);
1973
+ stroke-dashoffset: var(--metric-offset);
1974
+ opacity: 0.3;
1975
+ }
1976
+ .lh-exp-gauge-component .lh-exp-gauge-hovertarget {
1977
+ color: currentcolor;
1978
+ opacity: 0.001;
1979
+ stroke-linecap: butt;
1980
+ stroke-width: 24;
1981
+ /* hack. move the hover target out of the center. ideally i tweak the r instead but that rquires considerably more math. */
1982
+ transform: scale(1.15);
1983
+ }
1984
+ .lh-exp-gauge-component .lh-exp-gauge__arc--metric.lh-exp-gauge--miniarc {
1985
+ opacity: 0;
1986
+ stroke-dasharray: 0 calc(var(--circle-meas) * var(--radius));
1987
+ transition: 0s .005s;
1988
+ }
1989
+ .lh-exp-gauge-component .state--expanded .lh-exp-gauge__arc--metric.lh-exp-gauge--miniarc {
1990
+ opacity: .999;
1991
+ stroke-dasharray: var(--metric-array);
1992
+ transition: 0.3s; /* calc(.005s + var(--i)*.05s); entrace animation */
1993
+ }
1994
+ .lh-exp-gauge-component .state--expanded .lh-exp-gauge__inner .lh-exp-gauge__arc {
1995
+ opacity: 0;
1996
+ }
1997
+
1998
+
1999
+ .lh-exp-gauge-component .lh-exp-gauge__percentage {
2000
+ text-anchor: middle;
2001
+ dominant-baseline: middle;
2002
+ opacity: .999;
2003
+ font-size: calc(var(--radius) * 0.625);
2004
+ transition: opacity .3s ease-in;
2005
+ }
2006
+ .lh-exp-gauge-component .state--highlight .lh-exp-gauge__percentage {
2007
+ opacity: 0;
2008
+ }
2009
+
2010
+ .lh-exp-gauge-component .lh-exp-gauge__wrapper--fail .lh-exp-gauge__percentage {
2011
+ fill: var(--color-fail);
2012
+ }
2013
+ .lh-exp-gauge-component .lh-exp-gauge__wrapper--average .lh-exp-gauge__percentage {
2014
+ fill: var(--color-average);
2015
+ }
2016
+ .lh-exp-gauge-component .lh-exp-gauge__wrapper--pass .lh-exp-gauge__percentage {
2017
+ fill: var(--color-pass);
2018
+ }
2019
+
2020
+ .lh-exp-gauge-component .lh-cover {
2021
+ fill: none;
2022
+ opacity: .001;
2023
+ pointer-events: none;
2024
+ }
2025
+ .lh-exp-gauge-component .state--expanded .lh-cover {
2026
+ pointer-events: auto;
2027
+ }
2028
+
2029
+ .lh-exp-gauge-component .metric {
2030
+ transform: scale(var(--scale-initial));
2031
+ opacity: 0;
2032
+ transition: transform .1s .2s ease-out, opacity .3s ease-out;
2033
+ pointer-events: none;
2034
+ }
2035
+ .lh-exp-gauge-component .metric text {
2036
+ pointer-events: none;
2037
+ }
2038
+ .lh-exp-gauge-component .metric__value {
2039
+ fill: currentcolor;
2040
+ opacity: 0;
2041
+ transition: opacity 0.2s;
2042
+ }
2043
+ .lh-exp-gauge-component .state--expanded .metric {
2044
+ transform: scale(1);
2045
+ opacity: .999;
2046
+ transition: transform .3s ease-out, opacity .3s ease-in, stroke-width .1s ease-out;
2047
+ transition-delay: calc(var(--i)*.05s);
2048
+ pointer-events: auto;
2049
+ }
2050
+ .lh-exp-gauge-component .state--highlight .metric {
2051
+ opacity: .3;
2052
+ }
2053
+ .lh-exp-gauge-component .state--highlight .metric--highlight {
2054
+ opacity: .999;
2055
+ stroke-width: calc(1.5*var(--stroke-width));
2056
+ }
2057
+ .lh-exp-gauge-component .state--highlight .metric--highlight .metric__value {
2058
+ opacity: 0.999;
2059
+ }
2060
+
2061
+
2062
+ /*
2063
+ the initial first load peek
2064
+ */
2065
+ .lh-exp-gauge-component .lh-exp-gauge__bg { /* needed for the use zindex stacking w/ transparency */
2066
+ fill: var(--report-background-color);
2067
+ stroke: var(--report-background-color);
2068
+ }
2069
+ .lh-exp-gauge-component .state--peek .metric {
2070
+ transition-delay: 0ms;
2071
+ animation: peek var(--peek-dur) cubic-bezier(0.46, 0.03, 0.52, 0.96);
2072
+ animation-fill-mode: forwards;
2073
+ }
2074
+ .lh-exp-gauge-component .state--peek .lh-exp-gauge__inner .lh-exp-gauge__arc {
2075
+ opacity: 1;
2076
+ }
2077
+ .lh-exp-gauge-component .state--peek .lh-exp-gauge__arc.lh-exp-gauge--faded {
2078
+ opacity: 0.3; /* just a tad stronger cuz its fighting with a big solid arg */
2079
+ }
2080
+ /* do i need to set expanded and override this? */
2081
+ .lh-exp-gauge-component .state--peek .lh-exp-gauge__arc--metric.lh-exp-gauge--miniarc {
2082
+ transition: opacity 0.3s;
2083
+ }
2084
+ .lh-exp-gauge-component .state--peek {
2085
+ color: unset;
2086
+ }
2087
+ .lh-exp-gauge-component .state--peek .metric__label {
2088
+ display: none;
2089
+ }
2090
+
2091
+ .lh-exp-gauge-component .metric__label {
2092
+ fill: var(--report-text-color);
2093
+ }
2094
+
2095
+ @keyframes peek {
2096
+ /* biggest it should go is 0.92. smallest is 0.8 */
2097
+ 0% {
2098
+ transform: scale(0.8);
2099
+ opacity: 0.8;
2100
+ }
2101
+
2102
+ 50% {
2103
+ transform: scale(0.92);
2104
+ opacity: 1;
2105
+ }
2106
+
2107
+ 100% {
2108
+ transform: scale(0.8);
2109
+ opacity: 0.8;
2110
+ }
2111
+ }
2112
+
2113
+ .lh-exp-gauge-component .wrapper {
2114
+ width: 620px;
2115
+ }
1967
2116
 
1968
2117
  /*# sourceURL=report-styles.css */
@@ -94,41 +94,6 @@ SPDX-License-Identifier: Apache-2.0
94
94
  </div>
95
95
  </template>
96
96
 
97
- <!-- Lighthouse perf opportunity -->
98
- <template id="opportunity">
99
- <div class="lh-audit lh-audit--load-opportunity">
100
- <details class="lh-expandable-details">
101
- <summary>
102
- <div class="lh-audit__header">
103
- <div class="lh-load-opportunity__cols">
104
- <div class="lh-load-opportunity__col lh-load-opportunity__col--one">
105
- <span class="lh-audit__score-icon"></span>
106
- <div class="lh-audit__title"></div>
107
- </div>
108
- <div class="lh-load-opportunity__col lh-load-opportunity__col--two">
109
- <div class="lh-load-opportunity__sparkline">
110
- <div class="lh-sparkline"><div class="lh-sparkline__bar"></div></div>
111
- </div>
112
- <div class="lh-audit__display-text"></div>
113
- <div class="lh-chevron-container"></div>
114
- </div>
115
- </div>
116
- </div>
117
- </summary>
118
- <div class="lh-audit__description"></div>
119
- <div class="lh-audit__stackpacks"></div>
120
- </details>
121
- </div>
122
- </template>
123
-
124
- <!-- Lighthouse perf opportunity header -->
125
- <template id="opportunityHeader">
126
- <div class="lh-load-opportunity__header lh-load-opportunity__cols">
127
- <div class="lh-load-opportunity__col lh-load-opportunity__col--one"></div>
128
- <div class="lh-load-opportunity__col lh-load-opportunity__col--two"></div>
129
- </div>
130
- </template>
131
-
132
97
  <!-- Lighthouse score container -->
133
98
  <template id="scoresWrapper">
134
99
  <style>
@@ -515,6 +480,28 @@ SPDX-License-Identifier: Apache-2.0
515
480
  </a>
516
481
  </template>
517
482
 
483
+ <!-- Lighthouse score gauge - explodey version -->
484
+ <template id="explodeyGauge">
485
+ <div class="lh-exp-gauge-component">
486
+ <div class="lh-exp-gauge__wrapper" target="_blank">
487
+ <div class="lh-exp-gauge__svg-wrapper">
488
+ <svg class="lh-exp-gauge">
489
+ <g class="lh-exp-gauge__inner">
490
+ <circle class="lh-exp-gauge__bg" />
491
+ <circle class="lh-exp-gauge__base lh-exp-gauge--faded" />
492
+ <circle class="lh-exp-gauge__arc" />
493
+ <text class="lh-exp-gauge__percentage"></text>
494
+ </g>
495
+ <g class="lh-exp-gauge__outer">
496
+ <circle class="lh-cover" />
497
+ </g>
498
+ <text class="lh-exp-gauge__label" text-anchor="middle" x="0" y="60"></text>
499
+ </svg>
500
+ </div>
501
+ </div>
502
+ </div>
503
+ </template>
504
+
518
505
  <!-- Lighthouse category fraction -->
519
506
  <template id="fraction">
520
507
  <a class="lh-fraction__wrapper">
@@ -1,4 +1,4 @@
1
- /** @typedef {'3pFilter'|'audit'|'categoryHeader'|'chevron'|'clump'|'crc'|'crcChain'|'elementScreenshot'|'footer'|'fraction'|'gauge'|'gaugePwa'|'heading'|'metric'|'opportunity'|'opportunityHeader'|'scorescale'|'scoresWrapper'|'snippet'|'snippetContent'|'snippetHeader'|'snippetLine'|'styles'|'topbar'|'warningsToplevel'} ComponentName */
1
+ /** @typedef {'3pFilter'|'audit'|'categoryHeader'|'chevron'|'clump'|'crc'|'crcChain'|'elementScreenshot'|'explodeyGauge'|'footer'|'fraction'|'gauge'|'gaugePwa'|'heading'|'metric'|'scorescale'|'scoresWrapper'|'snippet'|'snippetContent'|'snippetHeader'|'snippetLine'|'styles'|'topbar'|'warningsToplevel'} ComponentName */
2
2
  /**
3
3
  * @param {DOM} dom
4
4
  * @param {ComponentName} componentName
@@ -6,5 +6,5 @@
6
6
  */
7
7
  export function createComponent(dom: DOM, componentName: ComponentName): DocumentFragment;
8
8
  export type DOM = import('./dom.js').DOM;
9
- export type ComponentName = '3pFilter' | 'audit' | 'categoryHeader' | 'chevron' | 'clump' | 'crc' | 'crcChain' | 'elementScreenshot' | 'footer' | 'fraction' | 'gauge' | 'gaugePwa' | 'heading' | 'metric' | 'opportunity' | 'opportunityHeader' | 'scorescale' | 'scoresWrapper' | 'snippet' | 'snippetContent' | 'snippetHeader' | 'snippetLine' | 'styles' | 'topbar' | 'warningsToplevel';
9
+ export type ComponentName = '3pFilter' | 'audit' | 'categoryHeader' | 'chevron' | 'clump' | 'crc' | 'crcChain' | 'elementScreenshot' | 'explodeyGauge' | 'footer' | 'fraction' | 'gauge' | 'gaugePwa' | 'heading' | 'metric' | 'scorescale' | 'scoresWrapper' | 'snippet' | 'snippetContent' | 'snippetHeader' | 'snippetLine' | 'styles' | 'topbar' | 'warningsToplevel';
10
10
  //# sourceMappingURL=components.d.ts.map