Comparing version 1.5.0 to 1.6.0
@@ -1,2 +0,12 @@ | ||
# 1.5.0 | ||
# 1.6.0 - 9/27/17 | ||
#### 🚀 New | ||
* Added support for `react` 16.0. | ||
* Updated `prop-types` to 15.6. | ||
#### 🛠 Internal | ||
* Updated Flowtype definitions. | ||
* Updated cross package imports to use CommonJS paths. | ||
* Improved the build process. | ||
# 1.5.0 - 7/28/17 | ||
* Updated `hoist-non-react-statics` to 2.2. | ||
@@ -6,14 +16,14 @@ * Updated Flow definitions. | ||
# 1.4.2 | ||
* Fixed an issue with the lerna package. | ||
# 1.4.2 - 6/19/17 | ||
* Fixed an issue with the Lerna package. | ||
# 1.4.1 | ||
# 1.4.1 - 6/19/17 | ||
* Updated `react` to 15.6. | ||
* Updated `prop-types` to 15.5.10. | ||
# 1.4.0 | ||
# 1.4.0 - 5/11/17 | ||
* Updated IE requirement to 11+. | ||
* Updated to include src/ files in the published package. | ||
# 1.3.0 | ||
# 1.3.0 - 4/24/17 | ||
* Updated to support React 15.5 and the new `prop-types` package. |
@@ -23,2 +23,4 @@ 'use strict'; | ||
var _aestheticUtils = require('aesthetic-utils'); | ||
var _lodash = require('lodash.merge'); | ||
@@ -32,6 +34,2 @@ | ||
var _isObject = require('aesthetic-utils/lib/isObject'); | ||
var _isObject2 = _interopRequireDefault(_isObject); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -109,5 +107,5 @@ | ||
throw new Error('Theme "' + themeName + '" already exists.'); | ||
} else if (!(0, _isObject2.default)(theme)) { | ||
} else if (!(0, _aestheticUtils.isObject)(theme)) { | ||
throw new TypeError('Theme "' + themeName + '" must be a style object.'); | ||
} else if (!(0, _isObject2.default)(globals)) { | ||
} else if (!(0, _aestheticUtils.isObject)(globals)) { | ||
throw new TypeError('Global styles for "' + themeName + '" must be an object.'); | ||
@@ -126,3 +124,3 @@ } | ||
value: function setAdapter(adapter) { | ||
if (adapter instanceof _Adapter2.default) { | ||
if (adapter instanceof _Adapter2.default || adapter && typeof adapter.transform === 'function') { | ||
adapter.native = this.native; | ||
@@ -144,3 +142,3 @@ this.adapter = adapter; | ||
throw new Error('Styles have already been set for "' + styleName + '".'); | ||
} else if (!(0, _isObject2.default)(declarations) && typeof declarations !== 'function') { | ||
} else if (!(0, _aestheticUtils.isObject)(declarations) && typeof declarations !== 'function') { | ||
throw new TypeError('Styles defined for "' + styleName + '" must be an object or function.'); | ||
@@ -147,0 +145,0 @@ } |
@@ -68,7 +68,5 @@ 'use strict'; | ||
return function wrapStyles(Component) { | ||
var styleName = options.styleName || Component.displayName; | ||
var styleName = options.styleName || Component.displayName || Component.name; | ||
if ("production" !== process.env.NODE_ENV) { | ||
styleName = styleName || Component.name; | ||
if (!(aesthetic instanceof _Aesthetic2.default)) { | ||
@@ -84,3 +82,3 @@ throw new TypeError('An instance of `Aesthetic` is required.'); | ||
styleName = styleName || '' + Math.random().toString(32).substr(2) + instanceID; | ||
styleName = '' + Math.random().toString(32).substr(2) + instanceID; | ||
} | ||
@@ -87,0 +85,0 @@ |
@@ -28,6 +28,4 @@ 'use strict'; | ||
var _isObject = require('aesthetic-utils/lib/isObject'); | ||
var _aestheticUtils = require('aesthetic-utils'); | ||
var _isObject2 = _interopRequireDefault(_isObject); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -122,3 +120,3 @@ | ||
if ("production" !== process.env.NODE_ENV) { | ||
if (!(0, _isObject2.default)(rules)) { | ||
if (!(0, _aestheticUtils.isObject)(rules)) { | ||
throw new SyntaxError('At-rule declaration "' + atRule + '" must be an object.'); | ||
@@ -125,0 +123,0 @@ } |
{ | ||
"name": "aesthetic", | ||
"version": "1.5.0", | ||
"description": "Abstract library to support a range of styling options for React components.", | ||
"version": "1.6.0", | ||
"description": "Aesthetic is a powerful React library for styling components through the use of adapters.", | ||
"keywords": [ | ||
"aesthetic", | ||
"react", | ||
"styles" | ||
"react-native", | ||
"native", | ||
"style", | ||
"components", | ||
"hoc", | ||
"css", | ||
"css-in-js", | ||
"css-modules", | ||
"aphrodite", | ||
"glamor", | ||
"fela", | ||
"jss" | ||
], | ||
"repository": "https://github.com/milesj/aesthetic/tree/master/packages/aesthetic", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "build-lib ./src -d ./lib" | ||
}, | ||
"dependencies": { | ||
"aesthetic-utils": "^1.5.0", | ||
"babel-runtime": "^6.25.0", | ||
"hoist-non-react-statics": "^2.2.0", | ||
"aesthetic-utils": "^1.6.0", | ||
"babel-runtime": "^6.26.0", | ||
"hoist-non-react-statics": "^2.3.1", | ||
"lodash.merge": "^4.6.0", | ||
"prop-types": "^15.5.10" | ||
"prop-types": "^15.6.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^15.0.0" | ||
"react": "^15.0.0 || ^16.0.0" | ||
}, | ||
"devDependencies": { | ||
"react": "^15.6.1" | ||
"@milesj/build-tool-config": "^0.30.2", | ||
"react": "^16.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Aesthetic v1.5.0 | ||
# Aesthetic | ||
[![Build Status](https://travis-ci.org/milesj/aesthetic.svg?branch=master)](https://travis-ci.org/milesj/aesthetic) | ||
@@ -90,2 +90,7 @@ | ||
## Requirements | ||
* React 15/16+ | ||
* IE 10+ | ||
## Installation | ||
@@ -92,0 +97,0 @@ |
@@ -7,5 +7,5 @@ /** | ||
import { isObject } from 'aesthetic-utils'; | ||
import deepMerge from 'lodash.merge'; | ||
import Adapter from './Adapter'; | ||
import isObject from '../../aesthetic-utils/src/isObject'; | ||
@@ -127,3 +127,3 @@ import type { | ||
setAdapter(adapter: Adapter): this { | ||
if (adapter instanceof Adapter) { | ||
if (adapter instanceof Adapter || (adapter && typeof adapter.transform === 'function')) { | ||
adapter.native = this.native; // eslint-disable-line | ||
@@ -130,0 +130,0 @@ this.adapter = adapter; |
@@ -22,5 +22,11 @@ /** | ||
type PropsAndState = { | ||
type StyleProps = { | ||
theme?: string, | ||
[key: string]: *, | ||
}; | ||
type StyleState = { | ||
classNames?: TransformedStylesMap, | ||
theme?: string, | ||
[key: string]: *, | ||
}; | ||
@@ -37,3 +43,3 @@ | ||
return function wrapStyles(Component: WrappedComponent): HOCComponent { | ||
let styleName = options.styleName || Component.displayName; | ||
let styleName = options.styleName || Component.displayName || Component.name; | ||
@@ -43,4 +49,2 @@ // Function/constructor name aren't always available when code is minified, | ||
if (__DEV__) { | ||
styleName = styleName || Component.name; | ||
if (!(aesthetic instanceof Aesthetic)) { | ||
@@ -70,3 +74,3 @@ throw new TypeError('An instance of `Aesthetic` is required.'); | ||
// eslint-disable-next-line no-magic-numbers | ||
styleName = styleName || `${Math.random().toString(32).substr(2)}${instanceID}`; | ||
styleName = `${Math.random().toString(32).substr(2)}${instanceID}`; | ||
} | ||
@@ -86,8 +90,6 @@ | ||
class StyledComponent extends ParentComponent { | ||
props: PropsAndState; | ||
state: PropsAndState; | ||
// $FlowIgnore | ||
class StyledComponent extends ParentComponent<StyleProps, StyleState> { | ||
static displayName: ?string = `Aesthetic(${styleName})`; | ||
static displayName: string = `Aesthetic(${styleName})`; | ||
static styleName: string = styleName; | ||
@@ -133,3 +135,3 @@ | ||
// Re-transform if the theme changes | ||
componentWillReceiveProps(nextProps: PropsAndState) { | ||
componentWillReceiveProps(nextProps: StyleProps) { | ||
const theme = this.getTheme(nextProps); | ||
@@ -142,3 +144,3 @@ | ||
getTheme(props: PropsAndState): string { | ||
getTheme(props: StyleProps): string { | ||
return props[themePropName] || this.context.themeName || ''; | ||
@@ -145,0 +147,0 @@ } |
@@ -10,3 +10,8 @@ /** | ||
export default class ThemeProvider extends React.Component { | ||
type ThemeProviderProps = { | ||
children: React$Node, | ||
name: string, | ||
}; | ||
export default class ThemeProvider extends React.Component<ThemeProviderProps> { | ||
static propTypes = { | ||
@@ -13,0 +18,0 @@ children: PropTypes.node.isRequired, |
@@ -7,3 +7,3 @@ /** | ||
import isObject from '../../aesthetic-utils/src/isObject'; | ||
import { isObject } from 'aesthetic-utils'; | ||
@@ -10,0 +10,0 @@ import type { |
Sorry, the diff of this file is not supported yet
85814
1401
721
2
+ Addedreact@16.14.0(transitive)
- Removedasap@2.0.6(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfbjs@0.8.18(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedpromise@7.3.1(transitive)
- Removedreact@15.7.0(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedua-parser-js@0.7.40(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)
Updatedaesthetic-utils@^1.6.0
Updatedbabel-runtime@^6.26.0
Updatedprop-types@^15.6.0