-
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
report: introduce the new report api, add dom.rootEl #13277
Merged
Merged
Changes from 33 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
60e38ee
report api. (and psi thinger)
paulirish 9d0326b
cleanup
paulirish f059abd
'proper' psi variant
paulirish da84011
Merge remote-tracking branch 'origin/master' into reportapi
paulirish c18bd48
fixup psi dist
paulirish 349a655
new tabs. distinguished screenshots
paulirish f6003b6
Merge remote-tracking branch 'origin/master' into reportapi
paulirish 4c2f18f
cleanup psi more
paulirish 743b1ea
moved that other stuff to #12815
paulirish 94823f3
one-shot functions
paulirish 5e84263
latest report api proposal
paulirish e122e5d
address all feedback
paulirish 38db26b
Merge remote-tracking branch 'origin/master' into reportapi
paulirish d8aa593
update
paulirish 399cd3c
drop renderGaugeForCategory
paulirish 96cbb47
report api impl
paulirish 2b08fc2
omittopbar
paulirish 0c2f103
broken because features is enabled before reportEl is added to dom
paulirish bff39ee
rootEl in a good spot
paulirish 501a980
rootEl all the things
paulirish 37bf128
root for fallback scenario
paulirish 69a7fed
happy tests
paulirish cdac9fc
Merge branch 'reportapidom' into reportapi
paulirish 5f95ff3
Merge remote-tracking branch 'origin/master' into reportapi
paulirish cc6f08a
fix types
paulirish c1f94cb
cleanup of remainign _document references
paulirish ce7dd3e
drop unimplemented options.
paulirish cc119a2
disableAutoDarkModeAndFireworks
paulirish 7779f25
add overlayParentEl option. but since the overlay is pos:fixed, it do…
paulirish 69e7a48
Revert "add overlayParentEl option. but since the overlay is pos:fixe…
paulirish a572b9c
renderReport 2nd arg is now optional
paulirish 66216a9
format types
paulirish 3058b57
standalone using new api. tsc errrs tho
paulirish e0bf5a5
fixtest
paulirish c9ba910
Merge remote-tracking branch 'origin/master' into reportapi-impl
paulirish 6e19522
move lh-vars classes to main rather than body
paulirish 88b6c23
tsc in standalone
paulirish 7c21389
container and lh-root shenanigans
paulirish 871e8e5
reword
paulirish 91390dc
fix flow
paulirish 6c4d3df
margin
paulirish eeb5a2b
Merge remote-tracking branch 'origin/master' into reportapi-impl
paulirish b6aaf01
latest feedback. new report creates an article. keep main as container
paulirish 4187992
tsc
paulirish 033a453
fix report tests
paulirish 536f4cf
handle flow legacy ussage
paulirish db94ac1
fix FPSS. css var was installed too low in the DOM
paulirish 7384079
optional fpss cleanup and renaming
paulirish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved. | ||
* 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 | ||
* 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. | ||
*/ | ||
'use strict'; | ||
|
||
|
||
import {DOM} from '../renderer/dom.js'; | ||
import {ReportRenderer} from '../renderer/report-renderer.js'; | ||
import {ReportUIFeatures} from '../renderer/report-ui-features.js'; | ||
|
||
/** | ||
* @param {LH.Result} lhr | ||
* @param {LH.Renderer.Options} opts | ||
* @return {HTMLElement} | ||
*/ | ||
export function renderReport(lhr, opts = {}) { | ||
const rootEl = document.createElement('main'); | ||
rootEl.classList.add('lh-root', 'lh-vars'); | ||
|
||
const dom = new DOM(rootEl.ownerDocument, rootEl); | ||
const renderer = new ReportRenderer(dom); | ||
|
||
renderer.renderReport(lhr, rootEl, opts); | ||
|
||
// Hook in JS features and page-level event listeners after the report | ||
// is in the document. | ||
const features = new ReportUIFeatures(dom, opts); | ||
features.initFeatures(lhr); | ||
return rootEl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The standalone template HTML already includes these classes in a
main
tag. WDYT about makingrootEl
a normal div, and removing the classes from the template files?Standalone renderer would still look for the
main
tag.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.
basically did the same kinda thing. just avoiding a double-main scenario. :)