Closed alebiavati closed 7 years ago
Merging #16 into master will increase coverage by
2.77%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #16 +/- ##
========================================
+ Coverage 97.22% 100% +2.77%
========================================
Files 5 6 +1
Lines 108 87 -21
Branches 24 0 -24
========================================
- Hits 105 87 -18
+ Misses 3 0 -3
Impacted Files | Coverage Δ | |
---|---|---|
src/index.js | 100% <ø> (ø) |
:white_check_mark: |
src/utils/index.js | 100% <100%> (+9.09%) |
:white_check_mark: |
src/Themer.js | 100% <100%> (ø) |
:white_check_mark: |
src/theme/index.js | 100% <100%> (+2.38%) |
:white_check_mark: |
src/decorator/index.js | 100% <100%> (ø) |
|
src/middleware/index.js | 100% <0%> (ø) |
:white_check_mark: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 1ca43f9...0b9154d. Read the comment docs.
Status
READY
Description
Cleanup code base to better reflect how the package is being used in CA UI components and to extend functionality.
This PR includes some small breaking changes (listed below), therefore this will be published as v2.0.0 on NPM.
Affected areas:
Themer
class:theme
. We useThemer
instance for many themed components, each with different themes, therefore we can't storetheme
as a property ofThemer
.Themer
class:id
. There is no need to assign a uuid to Themer instances if we only instantiate one per project.Themer
class:getVariants
,getThemeVariables
,getThemeStyles
,getThemeId
,setTheme
. No need for these convenience methods if notheme
instance is stored inThemer
.Themer
class:render
. As a developer I want to use the same rendering mechanism, no matter if I am usingThemer
for styling or not. After wrapping the snippet via the themer decorator, the developer can render the themed snippet simply by executing it.Themer
class:resolveMiddleware
. Middlewares are resolved when callingresolveAttributes
, therefore the convenience methodresolveMiddleware
is not needed.resolve()
toTheme
class to get resolved theme, instead of different methods forvariants
,styles
andvariables
. TheTheme
class now owns the theme structure, whileThemer
only owns middlewares. If the theme structure should change in the future, only theTheme
would need to be refactored.Themer.resolveAttributes
, the entire resolved theme is now passed tothis.middleware.resolve()
, this allows to keep the knowledge of the theme structure within theTheme
class alone. This is a breaking change for all themer-based middlewares likeca-ui-react-themer-jss
.mapThemeProps
that mapstheme
andvariants
to snippet props.Themer
as the latter doesn't have access to props. This is a breaking change for other themer-based decorators likeca-ui-react-themer