This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
feat: add support for styles debugging #1726
Merged
Merged
Conversation
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
kuzhelov
requested review from
dvdzkwsk,
layershifter,
levithomason,
miroslavstastny and
mnajdova
as code owners
July 29, 2019 00:18
Codecov Report
@@ Coverage Diff @@
## master #1726 +/- ##
==========================================
- Coverage 71.05% 69.94% -1.11%
==========================================
Files 862 868 +6
Lines 7169 7347 +178
Branches 2062 2118 +56
==========================================
+ Hits 5094 5139 +45
- Misses 2069 2202 +133
Partials 6 6
Continue to review full report at Codecov.
|
… into feat/debug-tools
lucivpav
reviewed
Jul 30, 2019
alinais
approved these changes
Aug 1, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR introduces first version of the toolset to debug Stardust styles (for most commonly reported debug scenarios).
Usage
Toolset is working in
development
builds only, and this is the set of steps to obtain debug information about Stardust component's styles:$stardust.whosProp('...')
,$stardust.whosValue('..')
(or other supported API method)API
List of commands
$stardust.whosProp(propName | (propName) => boolean)
siteVariables
,variables
andstyles
values to remain only those that havepropName
as a prop name.$stardust.whosPropContains(propNameSubstring)
siteVariables
,variables
andstyles
entries to only those that containpropNameSubstring
in their prop names$stardust.whosValue(value | (value) => boolean)
siteVariables
,variables
andstyles
values to remain only those that havevalue
as value$stardust.whosValueContains(valueSubstring)
siteVariables
,variables
andstyles
entries to only those that contain string values that containvalueSubstring
.$stardust()
Output
Each of these methods filters the
debugData
object (which could be accessed by$stardust()
with the component being selected in the React Dev Tools - this object contains extensive information about all the style ingredients of the component).The result of this filtering generally contains the following props:
componentName
,siteVariables
,variables
,styles
. Each of these categories contains resolved values grouped in the following categories:themes
- an array of theme values, in the same order as those are defined byProvider
components, starting from the root-level component down to the component which is debuggedinstanceOverrides
- values that are defined directly for component's instance by, for example,styles
orvariables
propresult
- contains result of all the values from all the sources being merged. This reflects the final value that is passed to component.It is worth to notice that empty categories are omitted from the output of filtering. For example, if there are only component
styles
that satisfy filtering conditions, then the following object will be provided as an output:And, if there is no filtered data in both
siteVariables
,variables
andstyles
categories, then the empty object will be returned as a result:Implementation Notes
Below there is a list of criterias the implementation approach was aiming on:
production
buildsdevelopment
buildsdevelopment
builds (tested on Stardust docs site's pages)