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.
Files changed (172) hide show
  1. package/dist/report/flow.js +149 -0
  2. package/dist/report/standalone.js +228 -0
  3. package/flow-report/assets/styles.css +9 -272
  4. package/flow-report/jest.config.js +1 -1
  5. package/flow-report/src/app.tsx +9 -31
  6. package/flow-report/src/common.tsx +7 -86
  7. package/flow-report/src/icons.tsx +3 -20
  8. package/flow-report/src/sidebar/sidebar.tsx +16 -11
  9. package/flow-report/src/summary/category.tsx +24 -42
  10. package/flow-report/src/summary/summary.tsx +29 -32
  11. package/flow-report/src/topbar.tsx +4 -54
  12. package/flow-report/src/util.ts +1 -26
  13. package/flow-report/src/wrappers/report-renderer.tsx +1 -1
  14. package/flow-report/src/wrappers/report.tsx +21 -6
  15. package/flow-report/test/app-test.tsx +13 -17
  16. package/flow-report/test/setup/env-setup.ts +0 -1
  17. package/flow-report/test/sidebar/flow-test.tsx +12 -6
  18. package/flow-report/test/sidebar/sidebar-test.tsx +13 -7
  19. package/flow-report/test/summary/category-test.tsx +34 -79
  20. package/flow-report/test/summary/summary-test.tsx +17 -11
  21. package/flow-report/test/util-test.tsx +12 -1
  22. package/flow-report/tsconfig.json +0 -1
  23. package/flow-report/types/flow-report.d.ts +1 -2
  24. package/jest.config.js +15 -1
  25. package/lighthouse-cli/bin.js +0 -5
  26. package/lighthouse-cli/cli-flags.js +3 -10
  27. package/lighthouse-cli/commands/commands.js +0 -1
  28. package/lighthouse-cli/run.js +2 -2
  29. package/lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js +0 -0
  30. package/lighthouse-cli/test/smokehouse/report-assert.js +4 -20
  31. package/lighthouse-core/audits/byte-efficiency/byte-efficiency-audit.js +1 -2
  32. package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +1 -1
  33. package/lighthouse-core/audits/seo/crawlable-anchors.js +12 -10
  34. package/lighthouse-core/computed/js-bundles.js +2 -1
  35. package/lighthouse-core/computed/unused-javascript-summary.js +3 -3
  36. package/lighthouse-core/config/config.js +2 -2
  37. package/lighthouse-core/config/default-config.js +0 -5
  38. package/lighthouse-core/fraggle-rock/api.js +0 -10
  39. package/lighthouse-core/fraggle-rock/config/filters.js +3 -22
  40. package/lighthouse-core/fraggle-rock/gather/driver.js +0 -4
  41. package/lighthouse-core/fraggle-rock/gather/navigation-runner.js +2 -2
  42. package/lighthouse-core/fraggle-rock/user-flow.js +6 -35
  43. package/lighthouse-core/gather/driver/navigation.js +0 -5
  44. package/lighthouse-core/gather/driver/prepare.js +0 -14
  45. package/lighthouse-core/gather/driver/storage.js +0 -5
  46. package/lighthouse-core/gather/gather-runner.js +2 -2
  47. package/lighthouse-core/gather/gatherers/dobetterweb/response-compression.js +1 -5
  48. package/lighthouse-core/gather/gatherers/full-page-screenshot.js +24 -30
  49. package/{shared/localization/i18n-module.js → lighthouse-core/lib/cdt/Common.js} +8 -3
  50. package/lighthouse-core/lib/cdt/SDK.js +123 -3
  51. package/lighthouse-core/lib/cdt/generated/SourceMap.js +312 -148
  52. package/lighthouse-core/lib/csp-evaluator.js +1 -2
  53. package/lighthouse-core/lib/i18n/README.md +6 -6
  54. package/lighthouse-core/lib/i18n/i18n.js +342 -9
  55. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ar-XB.json +0 -0
  56. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ar.json +0 -0
  57. package/{shared/localization → lighthouse-core/lib/i18n}/locales/bg.json +0 -0
  58. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ca.json +0 -0
  59. package/{shared/localization → lighthouse-core/lib/i18n}/locales/cs.json +0 -0
  60. package/{shared/localization → lighthouse-core/lib/i18n}/locales/da.json +0 -0
  61. package/{shared/localization → lighthouse-core/lib/i18n}/locales/de.json +0 -0
  62. package/{shared/localization → lighthouse-core/lib/i18n}/locales/el.json +0 -0
  63. package/{shared/localization → lighthouse-core/lib/i18n}/locales/en-GB.json +0 -0
  64. package/{shared/localization → lighthouse-core/lib/i18n}/locales/en-US.json +0 -111
  65. package/{shared/localization → lighthouse-core/lib/i18n}/locales/en-XA.json +0 -0
  66. package/{shared/localization → lighthouse-core/lib/i18n}/locales/en-XL.json +0 -111
  67. package/{shared/localization → lighthouse-core/lib/i18n}/locales/es-419.json +0 -0
  68. package/{shared/localization → lighthouse-core/lib/i18n}/locales/es.json +0 -0
  69. package/{shared/localization → lighthouse-core/lib/i18n}/locales/fi.json +0 -0
  70. package/{shared/localization → lighthouse-core/lib/i18n}/locales/fil.json +0 -0
  71. package/{shared/localization → lighthouse-core/lib/i18n}/locales/fr.json +0 -0
  72. package/{shared/localization → lighthouse-core/lib/i18n}/locales/he.json +0 -0
  73. package/{shared/localization → lighthouse-core/lib/i18n}/locales/hi.json +0 -0
  74. package/{shared/localization → lighthouse-core/lib/i18n}/locales/hr.json +0 -0
  75. package/{shared/localization → lighthouse-core/lib/i18n}/locales/hu.json +0 -0
  76. package/{shared/localization → lighthouse-core/lib/i18n}/locales/id.json +0 -0
  77. package/{shared/localization → lighthouse-core/lib/i18n}/locales/it.json +0 -0
  78. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ja.json +0 -0
  79. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ko.json +0 -0
  80. package/{shared/localization → lighthouse-core/lib/i18n}/locales/lt.json +0 -0
  81. package/{shared/localization → lighthouse-core/lib/i18n}/locales/lv.json +0 -0
  82. package/{shared/localization → lighthouse-core/lib/i18n}/locales/nl.json +0 -0
  83. package/{shared/localization → lighthouse-core/lib/i18n}/locales/no.json +0 -0
  84. package/{shared/localization → lighthouse-core/lib/i18n}/locales/pl.json +0 -0
  85. package/{shared/localization → lighthouse-core/lib/i18n}/locales/pt-PT.json +0 -0
  86. package/{shared/localization → lighthouse-core/lib/i18n}/locales/pt.json +0 -0
  87. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ro.json +0 -0
  88. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ru.json +0 -0
  89. package/{shared/localization → lighthouse-core/lib/i18n}/locales/sk.json +0 -0
  90. package/{shared/localization → lighthouse-core/lib/i18n}/locales/sl.json +0 -0
  91. package/{shared/localization → lighthouse-core/lib/i18n}/locales/sr-Latn.json +0 -0
  92. package/{shared/localization → lighthouse-core/lib/i18n}/locales/sr.json +0 -0
  93. package/{shared/localization → lighthouse-core/lib/i18n}/locales/sv.json +0 -0
  94. package/{shared/localization → lighthouse-core/lib/i18n}/locales/ta.json +0 -0
  95. package/{shared/localization → lighthouse-core/lib/i18n}/locales/te.json +0 -0
  96. package/{shared/localization → lighthouse-core/lib/i18n}/locales/th.json +0 -0
  97. package/{shared/localization → lighthouse-core/lib/i18n}/locales/tr.json +0 -0
  98. package/{shared/localization → lighthouse-core/lib/i18n}/locales/uk.json +0 -0
  99. package/{shared/localization → lighthouse-core/lib/i18n}/locales/vi.json +0 -0
  100. package/{shared/localization → lighthouse-core/lib/i18n}/locales/zh-HK.json +0 -0
  101. package/{shared/localization → lighthouse-core/lib/i18n}/locales/zh-TW.json +0 -0
  102. package/{shared/localization → lighthouse-core/lib/i18n}/locales/zh.json +0 -0
  103. package/{shared/localization → lighthouse-core/lib/i18n}/locales.js +1 -2
  104. package/{shared/localization → lighthouse-core/lib/i18n}/swap-locale.js +7 -9
  105. package/lighthouse-core/lib/page-functions.js +4 -4
  106. package/lighthouse-core/lib/stack-packs.js +13 -1
  107. package/{shared → lighthouse-core/lib}/type-verifiers.js +0 -0
  108. package/lighthouse-core/runner.js +6 -6
  109. package/lighthouse-core/scripts/manual-chrome-launcher.js +1 -4
  110. package/lighthouse-core/util-commonjs.js +4 -20
  111. package/package.json +16 -19
  112. package/readme.md +1 -1
  113. package/report/assets/standalone-template.html +1 -0
  114. package/report/assets/styles.css +41 -16
  115. package/report/assets/templates.html +4 -42
  116. package/report/clients/psi.js +0 -1
  117. package/report/clients/standalone.js +2 -1
  118. package/report/generator/file-namer.js +8 -17
  119. package/report/generator/report-generator.js +1 -0
  120. package/report/renderer/category-renderer.js +16 -4
  121. package/report/renderer/components.js +71 -107
  122. package/report/renderer/dom.js +0 -19
  123. package/report/renderer/logger.js +2 -35
  124. package/report/renderer/performance-category-renderer.js +21 -23
  125. package/report/renderer/pwa-category-renderer.js +2 -1
  126. package/report/renderer/report-renderer.js +0 -21
  127. package/report/renderer/report-ui-features.js +19 -7
  128. package/report/renderer/util.js +4 -20
  129. package/report/test/clients/psi-test.js +4 -0
  130. package/report/test/generator/file-namer-test.js +2 -2
  131. package/report/test/renderer/category-renderer-test.js +1 -1
  132. package/report/test/renderer/performance-category-renderer-test.js +0 -12
  133. package/report/test/renderer/report-renderer-test.js +55 -0
  134. package/report/test/renderer/util-test.js +8 -68
  135. package/report/test-assets/faux-psi-template.html +1 -0
  136. package/report/tsconfig.json +1 -2
  137. package/report/types/html-renderer.d.ts +1 -2
  138. package/root.js +0 -18
  139. package/third-party/chromium-synchronization/inspector-issueAdded-types-test.js +3 -5
  140. package/third-party/chromium-synchronization/installability-errors-test.js +1 -2
  141. package/tsconfig-all.json +0 -1
  142. package/tsconfig-base.json +1 -1
  143. package/tsconfig.json +3 -2
  144. package/types/config.d.ts +0 -1
  145. package/types/externs.d.ts +0 -2
  146. package/types/lhr/flow.d.ts +0 -7
  147. package/types/lhr/i18n.d.ts +3 -0
  148. package/changelog.md +0 -5395
  149. package/flow-report/.eslintrc.cjs +0 -49
  150. package/flow-report/package.json +0 -4
  151. package/flow-report/src/header.tsx +0 -88
  152. package/flow-report/src/help-dialog.tsx +0 -120
  153. package/flow-report/src/i18n/i18n.tsx +0 -44
  154. package/flow-report/src/i18n/localized-strings.js +0 -11
  155. package/flow-report/src/i18n/ui-strings.js +0 -86
  156. package/flow-report/test/common-test.tsx +0 -89
  157. package/flow-report/test/header-test.tsx +0 -55
  158. package/flow-report/test/sample-flow.ts +0 -17
  159. package/flow-report/test/topbar-test.tsx +0 -68
  160. package/lighthouse-cli/commands/list-locales.js +0 -16
  161. package/lighthouse-core/lib/cdt/Platform.js +0 -55
  162. package/lighthouse-core/scripts/package.json +0 -4
  163. package/report/renderer/swap-locale-feature.js +0 -82
  164. package/report/test/renderer/report-renderer-axe-test.js +0 -86
  165. package/shared/localization/format.js +0 -422
  166. package/shared/localization/swap-flow-locale.js +0 -20
  167. package/shared/test/localization/format-test.js +0 -377
  168. package/shared/test/localization/locales-test.js +0 -47
  169. package/shared/test/localization/swap-locale-test.js +0 -140
  170. package/shared/tsconfig.json +0 -22
  171. package/shared/types/shared.d.ts +0 -24
  172. package/types/es-main.d.ts +0 -18
@@ -10,28 +10,17 @@
10
10
  --category-summary-font-size: 18px;
11
11
  --double-base-spacing: calc(var(--base-spacing) * 2);
12
12
  --gather-mode-icon-size: 16px;
13
- --header-adjacent-title-font-size: 14px;
14
- --header-adjacent-title-width: minmax(var(--min-text-width), 1fr);
15
- --header-current-description-font-size: 12px;
16
- --header-current-title-font-size: 20px;
17
- --header-margin: minmax(0px, calc(var(--base-spacing) * 4));
18
13
  --half-base-spacing: calc(var(--base-spacing) / 2);
19
- --min-text-width: 20ch;
20
- --dialog-border-color: var(--color-gray-700);
21
14
  --separator-color: var(--color-gray-300);
22
15
  --sidebar-flow-step-navigation-font-size: 14px;
23
16
  --sidebar-selected-bg-color: #DDEEFF;
24
17
  --sidebar-summary-font-size: 14px;
25
18
  --sidebar-title-font-size: 16px;
26
- --sidebar-max-width: 400px;
27
19
  --summary-flow-step-label-font-size: 16px;
28
20
  --summary-subtitle-font-size: 16px;
29
21
  --summary-title-font-size: 32px;
30
22
  --summary-tooltip-box-shadow-color: rgba(0, 0, 0, 0.25);
31
- --topbar-button-font-size: 14px;
32
- --topbar-button-size: 45px;
33
23
  --topbar-title-font-size: 14px;
34
- --dialog-title-font-size: 20px;
35
24
  }
36
25
 
37
26
  .App {
@@ -52,59 +41,23 @@
52
41
  display: none;
53
42
  }
54
43
 
55
- @media print {
56
- .App {
57
- grid-template-rows: 0px auto !important;
58
- grid-template-columns: 0px auto !important;
59
- }
60
-
61
- .Topbar {
62
- display: none !important;
63
- }
64
-
65
- .Sidebar {
66
- display: none !important;
67
- }
68
-
69
- .Content {
70
- overflow-y: visible !important;
71
- }
72
-
73
- .SummaryFlow {
74
- grid-template-columns: repeat(7, min-content) !important;
75
- }
76
- }
77
-
78
44
  .Topbar {
79
- position: relative;
80
- padding-right: var(--base-spacing);
81
45
  grid-area: topbar;
82
46
  display: flex;
83
47
  align-items: center;
84
48
  border-bottom: 1px solid var(--separator-color);
85
49
  }
86
50
 
87
- .TopbarButton {
88
- height: var(--topbar-button-size);
89
- min-width: var(--topbar-button-size);
51
+ .Topbar__menu {
52
+ padding: var(--base-spacing);
90
53
  cursor: pointer;
91
54
  display: flex;
92
- align-items: center;
93
- justify-content: center;
94
55
  -webkit-touch-callout: none;
95
56
  -webkit-user-select: none;
96
57
  -khtml-user-select: none;
97
58
  -moz-user-select: none;
98
59
  -ms-user-select: none;
99
60
  user-select: none;
100
- cursor: pointer;
101
- background: none;
102
- color: inherit;
103
- border: none;
104
- font: inherit;
105
- outline: inherit;
106
- font-size: var(--topbar-button-font-size);
107
- margin-right: var(--base-spacing);
108
61
  }
109
62
 
110
63
  .Topbar__logo {
@@ -115,7 +68,6 @@
115
68
  .Topbar__title {
116
69
  font-size: var(--topbar-title-font-size);
117
70
  font-weight: bold;
118
- margin-right: var(--double-base-spacing);
119
71
  }
120
72
 
121
73
  .Content {
@@ -148,10 +100,6 @@
148
100
  .Sidebar {
149
101
  grid-area: sidebar;
150
102
  border-right: 1px solid var(--separator-color);
151
- width: min-content;
152
- max-width: var(--sidebar-max-width);
153
- overflow-x: hidden;
154
- overflow-y: auto;
155
103
  }
156
104
  .Sidebar a {
157
105
  color: var(--color-gray-800);
@@ -233,8 +181,6 @@
233
181
  grid-column: 2;
234
182
  margin: var(--half-base-spacing) 0px;
235
183
  justify-self: left;
236
- overflow-x: hidden;
237
- text-overflow: ellipsis;
238
184
  }
239
185
  .SidebarFlowStep__label--navigation {
240
186
  font-size: var(--sidebar-flow-step-navigation-font-size);
@@ -277,14 +223,14 @@
277
223
 
278
224
  .SummarySectionHeader__content {
279
225
  margin: var(--base-spacing) 0px;
280
- text-transform: uppercase;
281
226
  }
282
227
 
283
228
  .SummaryFlow {
284
229
  width: 100%;
230
+ max-width: max-content;
285
231
  display: grid;
286
232
  grid-auto-rows: min-content;
287
- grid-template-columns: min-content min-content minmax(var(--min-text-width), 4fr) 1fr 1fr 1fr 1fr;
233
+ grid-template-columns: min-content min-content 4fr 1fr 1fr 1fr 1fr;
288
234
  align-items: center;
289
235
  margin: var(--base-spacing) 0px;
290
236
  }
@@ -320,24 +266,21 @@
320
266
  .SummaryFlowStep .FlowSegment {
321
267
  grid-column: 2;
322
268
  }
323
- .SummaryFlowStep .FlowStepThumbnail {
324
- margin: var(--base-spacing) var(--half-base-spacing);
325
- }
326
269
 
327
- .FlowStepThumbnail {
270
+ .SummaryFlowStep__screenshot {
328
271
  align-self: center;
329
272
  justify-self: center;
273
+ margin: var(--base-spacing) var(--half-base-spacing);
330
274
  object-fit: cover;
331
275
  object-position: top left;
276
+ }
277
+ .SummaryFlowStep__screenshot[src] {
332
278
  border: 1px solid var(--color-gray);
333
279
  }
334
280
 
335
281
  .SummaryFlowStep__label {
336
282
  grid-column: 3;
337
283
  margin: var(--half-base-spacing);
338
- width: 100%;
339
- overflow-x: hidden;
340
- text-overflow: ellipsis;
341
284
  }
342
285
 
343
286
  .SummaryFlowStep__mode {
@@ -348,8 +291,6 @@
348
291
  font-size: var(--summary-flow-step-label-font-size);
349
292
  color: var(--color-gray-800);
350
293
  text-decoration: underline;
351
- width: 100%;
352
- overflow-x: hidden;
353
294
  }
354
295
 
355
296
  .SummaryCategory__content {
@@ -373,7 +314,7 @@
373
314
  width: max-content;
374
315
  background-color: var(--report-background-color);
375
316
  border: 1px solid var(--color-gray-900);
376
- border-radius: 3px;
317
+ border-radius: 5px;
377
318
  padding: var(--base-spacing);
378
319
  right: 0;
379
320
  box-shadow: 0px 4px 4px var(--summary-tooltip-box-shadow-color);
@@ -419,7 +360,6 @@
419
360
  justify-content: center;
420
361
  padding: var(--half-base-spacing);
421
362
  background-color: var(--color-gray-100);
422
- color: var(--color-gray-700);
423
363
  border-top: 1px solid var(--color-gray-300);
424
364
  text-align: center;
425
365
  }
@@ -427,11 +367,6 @@
427
367
  justify-content: start;
428
368
  text-align: left;
429
369
  }
430
- .SummaryNavigationHeader__url > a {
431
- color: inherit;
432
- overflow-x: hidden;
433
- text-overflow: ellipsis;
434
- }
435
370
 
436
371
  .SummaryFlowStep__separator {
437
372
  display: contents;
@@ -448,201 +383,3 @@
448
383
  margin: auto;
449
384
  background-color: var(--color-gray-700);
450
385
  }
451
-
452
- .Header {
453
- display: grid;
454
- grid-template-areas:
455
- ". . . current-tn . . ."
456
- "prev-seg prev-tn prev-tn current-tn next-tn next-tn next-seg"
457
- ". prev-title . current-tn . next-title ."
458
- ". prev-title current-title current-title current-title next-title .";
459
- grid-template-rows: 1fr auto 1fr auto;
460
- grid-template-columns: var(--header-margin) var(--header-adjacent-title-width) auto auto auto var(--header-adjacent-title-width) var(--header-margin);
461
- align-items: center;
462
- margin: var(--double-base-spacing) 0px;
463
- }
464
- .Header a {
465
- color: var(--color-gray-800);
466
- }
467
- .Header > .Header__segment:first-child {
468
- grid-area: prev-seg;
469
- }
470
- .Header > .Header__segment:last-child {
471
- grid-area: next-seg;
472
- }
473
-
474
- .Header__prev-thumbnail {
475
- display: flex;
476
- align-items: center;
477
- grid-area: prev-tn;
478
- }
479
- .Header__current-thumbnail {
480
- display: flex;
481
- align-items: center;
482
- grid-area: current-tn;
483
- }
484
- .Header__next-thumbnail {
485
- display: flex;
486
- align-items: center;
487
- grid-area: next-tn;
488
- }
489
- .Header__prev-thumbnail .Header__segment,
490
- .Header__next-thumbnail .Header__segment {
491
- flex-grow: 1;
492
- }
493
-
494
- .Header__segment {
495
- height: 2px;
496
- background-color: var(--color-blue-A700);
497
- }
498
-
499
- .HeaderThumbnail {
500
- position: relative;
501
- display: flex;
502
- margin: var(--base-spacing) 0px;
503
- }
504
- .HeaderThumbnail--main .FlowStepThumbnail {
505
- border: 2px solid var(--color-blue-A700);
506
- }
507
- .HeaderThumbnail--prev .HeaderThumbnail__icon {
508
- top: 50%;
509
- left: 100%;
510
- }
511
- .HeaderThumbnail--next .HeaderThumbnail__icon {
512
- top: 50%;
513
- left: 0;
514
- }
515
- .HeaderThumbnail--main .HeaderThumbnail__icon {
516
- top: 100%;
517
- left: 50%;
518
- }
519
-
520
- .HeaderThumbnail__icon {
521
- position: absolute;
522
- display: flex;
523
- padding: calc(var(--base-spacing) * 0.25);
524
- background-color: var(--report-background-color);
525
- border-radius: 50%;
526
- transform: translate(-50%, -50%);
527
- color: var(--color-blue-A700)
528
- }
529
-
530
- .Header__prev-title {
531
- grid-area: prev-title;
532
- text-align: left;
533
- }
534
-
535
- .Header__next-title {
536
- grid-area: next-title;
537
- text-align: right;
538
- justify-self: end;
539
- }
540
-
541
- .Header__prev-title,
542
- .Header__next-title {
543
- font-size: var(--header-adjacent-title-font-size);
544
- align-self: start;
545
- overflow-x: hidden;
546
- text-overflow: ellipsis;
547
- width: 100%;
548
- }
549
-
550
- .Header__current-title {
551
- grid-area: current-title;
552
- text-align: center;
553
- font-size: var(--header-current-title-font-size);
554
- font-weight: bold;
555
- overflow-x: hidden;
556
- text-overflow: ellipsis;
557
- }
558
-
559
- .Header__current-description {
560
- text-align: center;
561
- font-size: var(--header-current-description-font-size);
562
- font-weight: normal;
563
- }
564
-
565
- .HelpDialog {
566
- position: absolute;
567
- top: 100%;
568
- right: var(--base-spacing);
569
- z-index: 100;
570
- max-width: 720px;
571
-
572
- background: var(--color-white);
573
- color: var(--color-gray-800);
574
- border-radius: 3px;
575
- border: 1px solid var(--dialog-border-color);
576
- box-shadow: 0px 4px 12px var(--summary-tooltip-box-shadow-color);
577
-
578
- padding: var(--base-spacing) calc(var(--base-spacing) * 1.5);
579
- }
580
-
581
- .HelpDialog__title {
582
- display: flex;
583
- align-items: center;
584
-
585
- font-size: var(--dialog-title-font-size);
586
- font-weight: bold;
587
-
588
- margin-bottom: calc(var(--base-spacing) * 2);
589
- }
590
-
591
- .HelpDialog__close {
592
- background: none;
593
- border: none;
594
- cursor: pointer;
595
- line-height: 0;
596
- }
597
-
598
- .HelpDialog__columns {
599
- display: grid;
600
- grid-auto-flow: column;
601
- grid-template-rows: repeat(4, auto);
602
- grid-template-columns: repeat(3, 1fr);
603
- grid-column-gap: var(--base-spacing);
604
- }
605
-
606
- .HelpDialogColumn {
607
- display: contents;
608
- }
609
-
610
- .HelpDialogColumn__header-title {
611
- font-size: var(--category-summary-font-size);
612
- font-weight: bold;
613
- }
614
-
615
- .HelpDialogColumn__legend-label {
616
- color: var(--color-blue-A700);
617
- font-weight: bold;
618
- }
619
-
620
- .HelpDialogColumn ul {
621
- padding-left: var(--base-spacing);
622
- }
623
-
624
- .HelpDialogColumn__use-cases p,
625
- .HelpDialogColumn__categories p {
626
- font-weight: bold;
627
- color: var(--color-gray-700);
628
- }
629
-
630
- .HelpDialogColumnTimeline {
631
- display: flex;
632
- align-items: center;
633
-
634
- height: var(--double-base-spacing);
635
- color: var(--color-blue-A700);
636
- margin-right: calc(var(--base-spacing) * -1);
637
- }
638
-
639
- .HelpDialogColumn:last-child .HelpDialogColumnTimeline {
640
- margin-right: 0;
641
- }
642
-
643
- .HelpDialogColumnTimeline__line {
644
- height: 2px;
645
- flex-grow: 1;
646
-
647
- background: var(--color-blue-A700);
648
- }
@@ -4,7 +4,7 @@
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
6
 
7
- export default {
7
+ module.exports = {
8
8
  testEnvironment: 'node',
9
9
  preset: 'ts-jest',
10
10
  globalSetup: './test/setup/global-setup.ts',
@@ -5,43 +5,23 @@
5
5
  */
6
6
 
7
7
  import {FunctionComponent} from 'preact';
8
- import {useEffect, useRef, useState} from 'preact/hooks';
8
+ import {useState} from 'preact/hooks';
9
9
 
10
10
  import {ReportRendererProvider} from './wrappers/report-renderer';
11
11
  import {Sidebar} from './sidebar/sidebar';
12
12
  import {Summary} from './summary/summary';
13
- import {classNames, FlowResultContext, useCurrentLhr, useHashParam} from './util';
13
+ import {classNames, FlowResultContext, useCurrentLhr} from './util';
14
14
  import {Report} from './wrappers/report';
15
15
  import {Topbar} from './topbar';
16
- import {Header} from './header';
17
- import {I18nProvider} from './i18n/i18n';
18
16
 
19
17
  const Content: FunctionComponent = () => {
20
18
  const currentLhr = useCurrentLhr();
21
- const anchor = useHashParam('anchor');
22
- const ref = useRef<HTMLDivElement>(null);
23
-
24
- useEffect(() => {
25
- if (anchor) {
26
- const el = document.getElementById(anchor);
27
- if (el) {
28
- el.scrollIntoView({behavior: 'smooth'});
29
- return;
30
- }
31
- }
32
-
33
- // Scroll to top no anchor is found.
34
- if (ref.current) ref.current.scrollTop = 0;
35
- }, [anchor, currentLhr]);
36
19
 
37
20
  return (
38
- <div ref={ref} className="Content">
21
+ <div className="Content">
39
22
  {
40
23
  currentLhr ?
41
- <>
42
- <Header currentLhr={currentLhr}/>
43
- <Report currentLhr={currentLhr}/>
44
- </> :
24
+ <Report/> :
45
25
  <Summary/>
46
26
  }
47
27
  </div>
@@ -53,13 +33,11 @@ export const App: FunctionComponent<{flowResult: LH.FlowResult}> = ({flowResult}
53
33
  return (
54
34
  <FlowResultContext.Provider value={flowResult}>
55
35
  <ReportRendererProvider>
56
- <I18nProvider>
57
- <div className={classNames('App', {'App--collapsed': collapsed})} data-testid="App">
58
- <Topbar onMenuClick={() => setCollapsed(c => !c)} />
59
- <Sidebar/>
60
- <Content/>
61
- </div>
62
- </I18nProvider>
36
+ <div className={classNames('App', {'App--collapsed': collapsed})}>
37
+ <Topbar onMenuClick={() => setCollapsed(c => !c)} />
38
+ <Sidebar/>
39
+ <Content/>
40
+ </div>
63
41
  </ReportRendererProvider>
64
42
  </FlowResultContext.Provider>
65
43
  );
@@ -5,106 +5,27 @@
5
5
  */
6
6
 
7
7
  import {FunctionComponent} from 'preact';
8
- import {useEffect, useState} from 'preact/hooks';
9
8
 
10
9
  import {NavigationIcon, SnapshotIcon, TimespanIcon} from './icons';
11
- import {getFilmstripFrames, getScreenDimensions, getScreenshot} from './util';
12
-
13
- const ANIMATION_FRAME_DURATION_MS = 250;
14
10
 
15
11
  export const Separator: FunctionComponent = () => {
16
12
  return <div className="Separator" role="separator"></div>;
17
13
  };
18
14
 
19
- export const FlowStepIcon: FunctionComponent<{mode: LH.Result.GatherMode}> = ({mode}) => {
20
- return <>
21
- {
22
- mode === 'navigation' && <NavigationIcon/>
23
- }
24
- {
25
- mode === 'timespan' && <TimespanIcon/>
26
- }
27
- {
28
- mode === 'snapshot' && <SnapshotIcon/>
29
- }
30
- </>;
31
- };
32
-
33
15
  export const FlowSegment: FunctionComponent<{mode?: LH.Result.GatherMode}> = ({mode}) => {
34
16
  return (
35
17
  <div className="FlowSegment">
36
18
  <div className="FlowSegment__top-line"/>
37
19
  {
38
- mode && <FlowStepIcon mode={mode}/>
20
+ mode === 'navigation' && <NavigationIcon/>
21
+ }
22
+ {
23
+ mode === 'timespan' && <TimespanIcon/>
24
+ }
25
+ {
26
+ mode === 'snapshot' && <SnapshotIcon/>
39
27
  }
40
28
  <div className="FlowSegment__bottom-line"/>
41
29
  </div>
42
30
  );
43
31
  };
44
-
45
- const FlowStepAnimatedThumbnail: FunctionComponent<{
46
- frames: Array<{data: string}>,
47
- width: number,
48
- height: number,
49
- }> = ({frames, width, height}) => {
50
- const [frameIndex, setFrameIndex] = useState(0);
51
- // Handle a frame array of a different length being set.
52
- const effectiveFrameIndex = frameIndex % frames.length;
53
-
54
- useEffect(() => {
55
- const interval = setInterval(
56
- () => setFrameIndex(i => (i + 1) % frames.length),
57
- ANIMATION_FRAME_DURATION_MS
58
- );
59
-
60
- return () => clearInterval(interval);
61
- }, [frames.length]);
62
-
63
- return (
64
- <img
65
- className="FlowStepThumbnail"
66
- data-testid="FlowStepAnimatedThumbnail"
67
- src={frames[effectiveFrameIndex].data}
68
- style={{width, height}}
69
- alt="Animated screenshots of a page tested by Lighthouse"
70
- />
71
- );
72
- };
73
-
74
- export const FlowStepThumbnail: FunctionComponent<{
75
- reportResult: LH.ReportResult,
76
- width?: number,
77
- height?: number,
78
- }> = ({reportResult, width, height}) => {
79
- const screenshot = getScreenshot(reportResult);
80
- const frames = getFilmstripFrames(reportResult);
81
-
82
- // Resize the image to fit the viewport aspect ratio.
83
- const dimensions = getScreenDimensions(reportResult);
84
- if (width && height === undefined) {
85
- height = dimensions.height * width / dimensions.width;
86
- } else if (height && width === undefined) {
87
- width = dimensions.width * height / dimensions.height;
88
- }
89
-
90
- if (!width || !height) {
91
- console.warn(new Error('FlowStepThumbnail requested without any dimensions').stack);
92
- return <></>;
93
- }
94
-
95
- if (reportResult.gatherMode === 'timespan' && frames && frames.length) {
96
- return <FlowStepAnimatedThumbnail frames={frames} width={width} height={height} />;
97
- }
98
-
99
- return <>
100
- {
101
- screenshot &&
102
- <img
103
- className="FlowStepThumbnail"
104
- src={screenshot}
105
- style={{width, height}}
106
- alt="Screenshot of a page tested by Lighthouse"
107
- />
108
- }
109
- </>;
110
- };
@@ -79,23 +79,6 @@ export const SnapshotIcon: FunctionComponent = () => {
79
79
  );
80
80
  };
81
81
 
82
- export const CloseIcon: FunctionComponent = () => {
83
- return (
84
- <svg
85
- xmlns="http://www.w3.org/2000/svg"
86
- height="24px"
87
- viewBox="0 0 24 24"
88
- width="24px"
89
- fill="currentColor"
90
- role="img"
91
- aria-label="Icon representing a close action"
92
- >
93
- <path d="M0 0h24v24H0V0z" fill="none" />
94
- <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
95
- </svg>
96
- );
97
- };
98
-
99
82
  export const EnvIcon: FunctionComponent = () => {
100
83
  return (
101
84
  <svg width="15" height="12" viewBox="0 0 15 12" fill="none" role="img">
@@ -115,9 +98,9 @@ export const CpuIcon: FunctionComponent = () => {
115
98
  export const HamburgerIcon: FunctionComponent = () => {
116
99
  return (
117
100
  <svg viewBox="0 0 18 12" width="18" height="12" role="img">
118
- <rect width="18" height="2" fill="currentColor"></rect>
119
- <rect y="5" width="18" height="2" fill="currentColor"></rect>
120
- <rect y="10" width="18" height="2" fill="currentColor"></rect>
101
+ <rect width="18" height="2"></rect>
102
+ <rect y="5" width="18" height="2"></rect>
103
+ <rect y="10" width="18" height="2"></rect>
121
104
  </svg>
122
105
  );
123
106
  };
@@ -5,17 +5,15 @@
5
5
  */
6
6
 
7
7
  import {FunctionComponent} from 'preact';
8
+ import {useMemo} from 'preact/hooks';
8
9
 
9
10
  import {Separator} from '../common';
10
- import {useI18n, useUIStrings} from '../i18n/i18n';
11
11
  import {CpuIcon, EnvIcon, SummaryIcon} from '../icons';
12
- import {classNames, useCurrentLhr, useFlowResult} from '../util';
12
+ import {classNames, useCurrentLhr, useFlowResult, useLocale} from '../util';
13
13
  import {SidebarFlow} from './flow';
14
14
 
15
15
  export const SidebarSummary: FunctionComponent = () => {
16
16
  const currentLhr = useCurrentLhr();
17
- const strings = useUIStrings();
18
-
19
17
  const url = new URL(location.href);
20
18
  url.hash = '#';
21
19
  return (
@@ -27,14 +25,12 @@ export const SidebarSummary: FunctionComponent = () => {
27
25
  <div className="SidebarSummary__icon">
28
26
  <SummaryIcon/>
29
27
  </div>
30
- <div className="SidebarSummary__label">{strings.summary}</div>
28
+ <div className="SidebarSummary__label">Summary</div>
31
29
  </a>
32
30
  );
33
31
  };
34
32
 
35
33
  const SidebarRuntimeSettings: FunctionComponent<{settings: LH.ConfigSettings}> = ({settings}) => {
36
- const strings = useUIStrings();
37
-
38
34
  return (
39
35
  <div className="SidebarRuntimeSettings">
40
36
  <div className="SidebarRuntimeSettings__item">
@@ -42,7 +38,8 @@ const SidebarRuntimeSettings: FunctionComponent<{settings: LH.ConfigSettings}> =
42
38
  <EnvIcon/>
43
39
  </div>
44
40
  {
45
- settings.formFactor === 'desktop' ? strings.desktop : strings.mobile
41
+ `${settings.formFactor === 'desktop' ? 'Desktop' : 'Mobile'} | ` +
42
+ `${settings.screenEmulation.height}x${settings.screenEmulation.width}px`
46
43
  }
47
44
  </div>
48
45
  <div className="SidebarRuntimeSettings__item">
@@ -58,11 +55,19 @@ const SidebarRuntimeSettings: FunctionComponent<{settings: LH.ConfigSettings}> =
58
55
  };
59
56
 
60
57
  export const SidebarHeader: FunctionComponent<{title: string, date: string}> = ({title, date}) => {
61
- const i18n = useI18n();
58
+ const locale = useLocale();
59
+ const formatter = useMemo(() => {
60
+ const options: Intl.DateTimeFormatOptions = {
61
+ month: 'short', day: 'numeric', year: 'numeric',
62
+ hour: 'numeric', minute: 'numeric', timeZoneName: 'short',
63
+ };
64
+ return new Intl.DateTimeFormat(locale, options);
65
+ }, [locale]);
66
+ const dateString = useMemo(() => formatter.format(new Date(date)), [date, formatter]);
62
67
  return (
63
68
  <div className="SidebarHeader">
64
69
  <div className="SidebarHeader__title">{title}</div>
65
- <div className="SidebarHeader__date">{i18n.formatDateTime(date)}</div>
70
+ <div className="SidebarHeader__date">{dateString}</div>
66
71
  </div>
67
72
  );
68
73
  };
@@ -72,7 +77,7 @@ export const Sidebar: FunctionComponent = () => {
72
77
  const firstLhr = flowResult.steps[0].lhr;
73
78
  return (
74
79
  <div className="Sidebar">
75
- <SidebarHeader title={flowResult.name} date={firstLhr.fetchTime}/>
80
+ <SidebarHeader title="Lighthouse User Flow Report" date={firstLhr.fetchTime}/>
76
81
  <Separator/>
77
82
  <SidebarSummary/>
78
83
  <Separator/>