-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lighthouse Report Style Refresh #926
Changes from 5 commits
7206622
3b84bbe
22d1646
b24908e
c226478
9cbb0e3
08bdd0d
7aae333
ab2088b
ad53532
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,15 @@ | ||
<style> | ||
.axe-violation { | ||
color: #D0021B; | ||
} | ||
|
||
.axe-violation__help { | ||
color: #76B530; | ||
} | ||
|
||
.axe-violation__help-minor, | ||
.axe-violation__help-moderate { | ||
color: #F5A623; | ||
} | ||
|
||
.axe-violation__help-serious, | ||
.axe-violation__help--critical { | ||
color: #D0021B; | ||
} | ||
</style> | ||
<div class="axe-violation"> | ||
<details> | ||
<summary> | ||
<a class="axe-violation__help--{{ this.impact }}" href="{{ this.helpUrl }}" target="_blank">{{ this.help }}</a> | ||
</summary> | ||
<ul> | ||
{{#each this.nodes}} | ||
<li><code>{{ this.target }}</code></li> | ||
{{/each}} | ||
</ul> | ||
</details> | ||
</div> | ||
<details class="subitem__details"> | ||
<summary class="subitem__detail"> | ||
{{#if (gt this.nodes.length 1)}} | ||
{{this.nodes.length}} elements fail this test | ||
{{else}} | ||
{{this.nodes.length}} element fails this test | ||
{{/if}} | ||
<a href="{{ this.helpUrl }}" target="_blank"><small>learn more</small></a> | ||
</summary> | ||
<ul class="subitem__details"> | ||
{{#each this.nodes}} | ||
<li class="subitem__detail"><code>{{ this.target }}</code></li> | ||
{{/each}} | ||
</ul> | ||
</details> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,27 @@ | ||
<style> | ||
.http-resources { | ||
font-size: 14px; | ||
} | ||
.http-resource__url { | ||
margin-right: 8px; | ||
} | ||
.http-resource__protocol, | ||
.http-resource__code { | ||
color: #999; | ||
color: var(--secondary-text-color); | ||
} | ||
.http-resource__code { | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
} | ||
</style> | ||
|
||
<div> | ||
<details class="http-resources"> | ||
<summary>URLs</summary> | ||
{{#each this}} | ||
<div class="http-resource"> | ||
<span class="http-resource__url">{{this.url}}</span> | ||
{{#if this.label}} | ||
<span class="http-resource__protocol">({{this.label}})</span> | ||
{{/if}} | ||
{{#if this.code}} | ||
<pre class="http-resource__code">{{this.code}}</pre> | ||
{{/if}} | ||
</div> | ||
{{/each}} | ||
</details> | ||
</div> | ||
<details class="subitem__details"> | ||
<summary class="subitem__detail">URLs</summary> | ||
<ul class="subitem__details"> | ||
{{#each this}} | ||
<li class="subitem__detail http-resource"> | ||
<span class="http-resource__url">{{this.url}}</span> | ||
{{#if this.label}} | ||
<span class="http-resource__protocol">({{this.label}})</span> | ||
{{/if}} | ||
{{#if this.code}} | ||
<pre class="http-resource__code">{{this.code}}</pre> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need a test case to reproduce this. Where can I see some examples with the old flexbox? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Start a server in
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose you could also use a jsbin: http://jsbin.com/ruzanisodu There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can reproduce, but can't identify the cause. The extra leading space is within the string (extendedInfo.value.code). That extra space doesn't appear in the original page, though. I tracked it through StyleHelper.getFormattedStyleRule, which doesn't appear to add any extra whitespace. I didn't change the element or the styling applied to that element directly. No Handlebars helpers are being applied to the string. I'm at a loss to what's causing this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries. Thanks for investigating. I can look into this later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a blocker on the PR? @paulirish There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope not a blocker. eric can you give this a green check? :) |
||
{{/if}} | ||
</li> | ||
{{/each}} | ||
</ul> | ||
</details> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,17 @@ | ||
<style> | ||
.ut-measures { | ||
font-size: 14px | ||
} | ||
|
||
.ut-measure_listing-duration { | ||
font-weight: bold | ||
} | ||
</style> | ||
|
||
<div> | ||
<div class="ut-measures"> | ||
{{#each this}} | ||
<div> | ||
{{#if this.isMark}} | ||
<span class="ut-measure_listing-duration">Mark: {{ decimal this.startTime }}ms</span> - {{ this.name }} | ||
{{else}} | ||
<span class="ut-measure_listing-duration">Measure {{ decimal this.duration }}ms</span> - {{ this.name }} | ||
{{/if}} | ||
</div> | ||
{{/each}} | ||
</div> | ||
</div> | ||
<ul class="subitem__details"> | ||
{{#each this}} | ||
<li class="subitem__detail"> | ||
{{#if this.isMark}} | ||
<strong class="ut-measure_listing-duration">Mark: {{ decimal this.startTime }}ms</strong> - {{ this.name }} | ||
{{else}} | ||
<strong class="ut-measure_listing-duration">Measure {{ decimal this.duration }}ms</strong> - {{ this.name }} | ||
{{/if}} | ||
</li> | ||
{{/each}} | ||
</ul> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,9 +93,8 @@ class ReportGenerator { | |
// for color styling. | ||
Handlebars.registerHelper('getItemRating', getItemRating); | ||
|
||
Handlebars.registerHelper('showHelpText', value => { | ||
return getItemRating(value) === RATINGS.GOOD.label ? 'hidden' : ''; | ||
}); | ||
Handlebars.registerHelper('shouldShowHelpText', | ||
value => (getItemRating(value) !== RATINGS.GOOD.label)); | ||
|
||
// Convert numbers to fixed point decimals | ||
Handlebars.registerHelper('decimal', number => { | ||
|
@@ -104,6 +103,27 @@ class ReportGenerator { | |
} | ||
return number; | ||
}); | ||
|
||
// value is boolean? | ||
Handlebars.registerHelper('is-bool', value => (typeof value === 'boolean')); | ||
|
||
// a > b | ||
Handlebars.registerHelper('gt', (a, b) => (a > b)); | ||
|
||
// !value | ||
Handlebars.registerHelper('not', value => !value); | ||
|
||
// arg1 && arg2 && ... && argn | ||
Handlebars.registerHelper('and', (...args) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. travis is failing b/c node 5 doesn't support the spread operator in function args. You'll have to use |
||
args.pop(); | ||
let arg; | ||
for (arg of args) { | ||
if (!arg) { | ||
break; | ||
} | ||
} | ||
return arg; | ||
}); | ||
} | ||
|
||
/** | ||
|
@@ -222,6 +242,7 @@ class ReportGenerator { | |
lighthouseVersion: results.lighthouseVersion, | ||
generatedTime: this._formatTime(results.generatedTime), | ||
css: this.getReportCSS(inline), | ||
reportContext: 'extension', // devtools, extension, cli | ||
script: this.getReportJS(inline), | ||
aggregations: results.aggregations, | ||
auditsByCategory: this._createPWAAuditsByCategory(results.aggregations) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 space indent to be consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done