Comparing version 2.0.0-0 to 2.0.0
@@ -46,2 +46,18 @@ import _toConsumableArray from 'babel-runtime/helpers/toConsumableArray'; | ||
return this.adapter.create(this.getStyles(styleName, themeName, props)); | ||
} | ||
}, { | ||
key: 'extendTheme', | ||
value: function extendTheme(parentThemeName, themeName) { | ||
var theme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var globals = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
return this.registerTheme(themeName, deepMerge({}, this.getTheme(parentThemeName), theme), globals); | ||
} | ||
}, { | ||
key: 'getStyles', | ||
value: function getStyles(styleName) { | ||
var themeName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var parentStyleName = this.parents[styleName]; | ||
@@ -61,16 +77,8 @@ var styleSheet = this.styles[styleName]; | ||
if (parentStyleName) { | ||
styleSheet = deepMerge({}, this.createStyleSheet(parentStyleName, themeName, props), styleSheet); | ||
styleSheet = deepMerge({}, this.getStyles(parentStyleName, themeName, props), styleSheet); | ||
} | ||
return this.adapter.create(styleSheet); | ||
return styleSheet; | ||
} | ||
}, { | ||
key: 'extendTheme', | ||
value: function extendTheme(parentThemeName, themeName) { | ||
var theme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var globals = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
return this.registerTheme(themeName, deepMerge({}, this.getTheme(parentThemeName), theme), globals); | ||
} | ||
}, { | ||
key: 'getTheme', | ||
@@ -77,0 +85,0 @@ value: function getTheme() { |
import _extends from 'babel-runtime/helpers/extends'; | ||
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; | ||
import _defineProperty from 'babel-runtime/helpers/defineProperty'; | ||
@@ -105,3 +106,7 @@ import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; | ||
value: function render() { | ||
return React.createElement(Component, _extends({}, this.props, this.state)); | ||
var _state = this.state, | ||
firstMount = _state.firstMount, | ||
state = _objectWithoutProperties(_state, ['firstMount']); | ||
return React.createElement(Component, _extends({}, this.props, state)); | ||
} | ||
@@ -108,0 +113,0 @@ }], [{ |
@@ -81,8 +81,2 @@ import _toConsumableArray from 'babel-runtime/helpers/toConsumableArray'; | ||
Object.keys(_this.checkBlock(faces)).forEach(function (fontFamily) { | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (_this.fontFaces[fontFamily]) { | ||
throw new Error('@font-face "' + fontFamily + '" already exists.'); | ||
} | ||
} | ||
_this.fontFaces[fontFamily] = toArray(faces[fontFamily]).map(function (font) { | ||
@@ -120,8 +114,2 @@ return _extends({}, font, { | ||
Object.keys(_this.checkBlock(frames)).forEach(function (animationName) { | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (_this.keyframes[animationName]) { | ||
throw new Error('@keyframes "' + animationName + '" already exists.'); | ||
} | ||
} | ||
_this.keyframes[animationName] = _this.checkBlock(frames[animationName]); | ||
@@ -128,0 +116,0 @@ |
@@ -72,2 +72,18 @@ 'use strict'; | ||
return this.adapter.create(this.getStyles(styleName, themeName, props)); | ||
} | ||
}, { | ||
key: 'extendTheme', | ||
value: function extendTheme(parentThemeName, themeName) { | ||
var theme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var globals = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
return this.registerTheme(themeName, (0, _lodash2.default)({}, this.getTheme(parentThemeName), theme), globals); | ||
} | ||
}, { | ||
key: 'getStyles', | ||
value: function getStyles(styleName) { | ||
var themeName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var parentStyleName = this.parents[styleName]; | ||
@@ -87,16 +103,8 @@ var styleSheet = this.styles[styleName]; | ||
if (parentStyleName) { | ||
styleSheet = (0, _lodash2.default)({}, this.createStyleSheet(parentStyleName, themeName, props), styleSheet); | ||
styleSheet = (0, _lodash2.default)({}, this.getStyles(parentStyleName, themeName, props), styleSheet); | ||
} | ||
return this.adapter.create(styleSheet); | ||
return styleSheet; | ||
} | ||
}, { | ||
key: 'extendTheme', | ||
value: function extendTheme(parentThemeName, themeName) { | ||
var theme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var globals = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
return this.registerTheme(themeName, (0, _lodash2.default)({}, this.getTheme(parentThemeName), theme), globals); | ||
} | ||
}, { | ||
key: 'getTheme', | ||
@@ -103,0 +111,0 @@ value: function getTheme() { |
@@ -11,2 +11,6 @@ 'use strict'; | ||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties'); | ||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2); | ||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty'); | ||
@@ -145,3 +149,8 @@ | ||
value: function render() { | ||
return _react2.default.createElement(Component, (0, _extends3.default)({}, this.props, this.state)); | ||
var _state = this.state, | ||
firstMount = _state.firstMount, | ||
state = (0, _objectWithoutProperties3.default)(_state, ['firstMount']); | ||
return _react2.default.createElement(Component, (0, _extends3.default)({}, this.props, state)); | ||
} | ||
@@ -148,0 +157,0 @@ }], [{ |
@@ -107,8 +107,2 @@ 'use strict'; | ||
Object.keys(_this.checkBlock(faces)).forEach(function (fontFamily) { | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (_this.fontFaces[fontFamily]) { | ||
throw new Error('@font-face "' + fontFamily + '" already exists.'); | ||
} | ||
} | ||
_this.fontFaces[fontFamily] = (0, _toArray2.default)(faces[fontFamily]).map(function (font) { | ||
@@ -146,8 +140,2 @@ return (0, _extends3.default)({}, font, { | ||
Object.keys(_this.checkBlock(frames)).forEach(function (animationName) { | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (_this.keyframes[animationName]) { | ||
throw new Error('@keyframes "' + animationName + '" already exists.'); | ||
} | ||
} | ||
_this.keyframes[animationName] = _this.checkBlock(frames[animationName]); | ||
@@ -154,0 +142,0 @@ |
{ | ||
"name": "aesthetic", | ||
"version": "2.0.0-0", | ||
"version": "2.0.0", | ||
"description": "Aesthetic is a powerful React library for styling components through the use of adapters.", | ||
@@ -35,5 +35,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"@milesj/build-tool-config": "^0.44.0", | ||
"@milesj/build-tool-config": "^0.46.0", | ||
"react": "^16.2.0" | ||
} | ||
} |
@@ -53,6 +53,29 @@ /** | ||
/** | ||
* Extract the defined style declarations. If the declaratin is a function, | ||
* Return a stylesheet unique to an adapter. | ||
*/ | ||
createStyleSheet(styleName: string, themeName?: string = '', props?: Object = {}): StyleSheet { | ||
return this.adapter.create(this.getStyles(styleName, themeName, props)); | ||
} | ||
/** | ||
* Register a theme by extending and merging with a previously defined theme. | ||
*/ | ||
extendTheme( | ||
parentThemeName: string, | ||
themeName: string, | ||
theme?: ThemeSheet = {}, | ||
globals?: StyleSheet = {}, | ||
): this { | ||
return this.registerTheme( | ||
themeName, | ||
deepMerge({}, this.getTheme(parentThemeName), theme), | ||
globals, | ||
); | ||
} | ||
/** | ||
* Retrieve the defined style declarations. If the declaratin is a function, | ||
* execute it while passing the current theme and React props. | ||
*/ | ||
createStyleSheet(styleName: string, themeName?: string = '', props?: Object = {}): StyleSheet { | ||
getStyles(styleName: string, themeName?: string = '', props?: Object = {}): StyleSheet { | ||
const parentStyleName = this.parents[styleName]; | ||
@@ -76,3 +99,3 @@ let styleSheet = this.styles[styleName]; | ||
{}, | ||
this.createStyleSheet(parentStyleName, themeName, props), | ||
this.getStyles(parentStyleName, themeName, props), | ||
styleSheet, | ||
@@ -82,22 +105,6 @@ ); | ||
return this.adapter.create(styleSheet); | ||
return styleSheet; | ||
} | ||
/** | ||
* Register a theme by extending and merging with a previously defined theme. | ||
*/ | ||
extendTheme( | ||
parentThemeName: string, | ||
themeName: string, | ||
theme?: ThemeSheet = {}, | ||
globals?: StyleSheet = {}, | ||
): this { | ||
return this.registerTheme( | ||
themeName, | ||
deepMerge({}, this.getTheme(parentThemeName), theme), | ||
globals, | ||
); | ||
} | ||
/** | ||
* Return a themes style object or throw an error. | ||
@@ -104,0 +111,0 @@ */ |
@@ -158,3 +158,5 @@ /** | ||
render(): React$Node { | ||
return <Component {...this.props} {...this.state} />; | ||
const { firstMount, ...state } = this.state; | ||
return <Component {...this.props} {...state} />; | ||
} | ||
@@ -161,0 +163,0 @@ } |
@@ -112,8 +112,2 @@ /** | ||
Object.keys(this.checkBlock(faces)).forEach((fontFamily) => { | ||
if (__DEV__) { | ||
if (this.fontFaces[fontFamily]) { | ||
throw new Error(`@font-face "${fontFamily}" already exists.`); | ||
} | ||
} | ||
// $FlowIgnore | ||
@@ -154,8 +148,2 @@ this.fontFaces[fontFamily] = toArray(faces[fontFamily]) | ||
Object.keys(this.checkBlock(frames)).forEach((animationName) => { | ||
if (__DEV__) { | ||
if (this.keyframes[animationName]) { | ||
throw new Error(`@keyframes "${animationName}" already exists.`); | ||
} | ||
} | ||
this.keyframes[animationName] = this.checkBlock(frames[animationName]); | ||
@@ -162,0 +150,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
131717
1
39