@exah/prop-styles-system
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -32,4 +32,4 @@ 'use strict'; | ||
color: 'inherit', | ||
borderColor: 'currentColor', | ||
borderColor: 'transparent', | ||
backgroundColor: 'transparent' | ||
}; |
@@ -24,3 +24,3 @@ 'use strict'; | ||
return (0, _utils.wrapIfMedia)(mediaQuery, getStyle(mediaKey)); | ||
return (0, _utils.wrapIfMedia)(mediaQuery, getStyle(mediaKey, props)); | ||
}).filter(function (style) { | ||
@@ -27,0 +27,0 @@ return style != null; |
@@ -42,10 +42,9 @@ 'use strict'; | ||
var colorProp = function colorProp(cssProp, colorKey) { | ||
return (0, _ramda.curryN)(2, function (value, _ref2) { | ||
var theme = _ref2.theme; | ||
var getCssValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ramda.identity; | ||
return (0, _ramda.curryN)(2, function (value, props) { | ||
if (value == null) return {}; | ||
var color = value === false ? _constants.CSS_PROPS_DEFAULTS[cssProp] || _constants.CSS_DEFAULT_VALUE : (0, _utils.isColor)(value) ? value : (0, _utils.getColor)(theme, colorKey, value); | ||
var color = value === false ? _constants.CSS_PROPS_DEFAULTS[cssProp] || _constants.CSS_DEFAULT_VALUE : (0, _utils.isColor)(value) ? value : (0, _utils.getColor)(props.theme, colorKey, value); | ||
return !color ? {} : (0, _defineProperty3.default)({}, cssProp, color); | ||
return !color ? {} : (0, _defineProperty3.default)({}, cssProp, getCssValue(color, props)); | ||
}); | ||
@@ -52,0 +51,0 @@ }; |
@@ -41,2 +41,74 @@ 'use strict'; | ||
}); | ||
}); | ||
var _helpers = require('./utils/helpers'); | ||
Object.defineProperty(exports, 'wrap', { | ||
enumerable: true, | ||
get: function get() { | ||
return _helpers.wrap; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'wrapIfMedia', { | ||
enumerable: true, | ||
get: function get() { | ||
return _helpers.wrapIfMedia; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'sizeValue', { | ||
enumerable: true, | ||
get: function get() { | ||
return _helpers.sizeValue; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'spaceValue', { | ||
enumerable: true, | ||
get: function get() { | ||
return _helpers.spaceValue; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'skipPropValue', { | ||
enumerable: true, | ||
get: function get() { | ||
return _helpers.skipPropValue; | ||
} | ||
}); | ||
var _getters = require('./utils/getters'); | ||
Object.defineProperty(exports, 'getPalette', { | ||
enumerable: true, | ||
get: function get() { | ||
return _getters.getPalette; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'getColors', { | ||
enumerable: true, | ||
get: function get() { | ||
return _getters.getColors; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'getColor', { | ||
enumerable: true, | ||
get: function get() { | ||
return _getters.getColor; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'getSize', { | ||
enumerable: true, | ||
get: function get() { | ||
return _getters.getSize; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'getSpace', { | ||
enumerable: true, | ||
get: function get() { | ||
return _getters.getSpace; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'fromTheme', { | ||
enumerable: true, | ||
get: function get() { | ||
return _getters.fromTheme; | ||
} | ||
}); |
@@ -12,8 +12,6 @@ 'use strict'; | ||
var onMedia = (0, _ramda.curryN)(2, function (mediaKey, style) { | ||
return function (props) { | ||
return (0, _utils.wrapIfMedia)((0, _utils.themeMedia)(props.theme)[mediaKey], (0, _utils.getStyles)(style, props, mediaKey)); | ||
}; | ||
var onMedia = (0, _ramda.curryN)(3, function (mediaKey, style, props) { | ||
return (0, _utils.wrapIfMedia)((0, _utils.themeMedia)(props.theme)[mediaKey], (0, _utils.getStyles)(style, props, mediaKey)); | ||
}); | ||
exports.onMedia = onMedia; |
@@ -102,3 +102,3 @@ 'use strict'; | ||
if (!(0, _is.isNum)(step)) { | ||
if (!(0, _is.isNum)(step) && !(0, _is.isBool)(step)) { | ||
var themeSize = getSize(theme, step); | ||
@@ -105,0 +105,0 @@ |
@@ -19,14 +19,2 @@ 'use strict'; | ||
var _colors = require('./colors'); | ||
Object.keys(_colors).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _colors[key]; | ||
} | ||
}); | ||
}); | ||
var _getters = require('./getters'); | ||
@@ -33,0 +21,0 @@ |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.isObj = exports.isArr = exports.isStr = exports.isNum = exports.isBool = exports.isFn = undefined; | ||
exports.isColor = exports.isObj = exports.isArr = exports.isStr = exports.isNum = exports.isBool = exports.isFn = undefined; | ||
@@ -18,2 +18,18 @@ var _ramda = require('ramda'); | ||
var isHex = function isHex(str) { | ||
return (/^#/.test(str || '') | ||
); | ||
}; | ||
var isRgb = function isRgb(str) { | ||
return (/^rgba?/.test(str || '') | ||
); | ||
}; | ||
var isHsl = function isHsl(str) { | ||
return (/^hsla?/.test(str || '') | ||
); | ||
}; | ||
var isColor = function isColor(str) { | ||
return isHex(str) || isRgb(str) || isHsl(str); | ||
}; | ||
exports.isFn = isFn; | ||
@@ -24,2 +40,3 @@ exports.isBool = isBool; | ||
exports.isArr = isArr; | ||
exports.isObj = isObj; | ||
exports.isObj = isObj; | ||
exports.isColor = isColor; |
@@ -27,4 +27,4 @@ export var DEFAULT_KEY = 'default'; | ||
color: 'inherit', | ||
borderColor: 'currentColor', | ||
borderColor: 'transparent', | ||
backgroundColor: 'transparent' | ||
}; |
@@ -11,3 +11,3 @@ import _slicedToArray from 'babel-runtime/helpers/slicedToArray'; | ||
return wrapIfMedia(mediaQuery, getStyle(mediaKey)); | ||
return wrapIfMedia(mediaQuery, getStyle(mediaKey, props)); | ||
}).filter(function (style) { | ||
@@ -14,0 +14,0 @@ return style != null; |
import _defineProperty from 'babel-runtime/helpers/defineProperty'; | ||
import { curryN } from 'ramda'; | ||
import { curryN, identity } from 'ramda'; | ||
import { CSS_DEFAULT_VALUE, CSS_PROPS_DEFAULTS } from '../constants'; | ||
@@ -28,10 +28,9 @@ import { getColors, getColor, isColor } from '../utils'; | ||
var colorProp = function colorProp(cssProp, colorKey) { | ||
return curryN(2, function (value, _ref2) { | ||
var theme = _ref2.theme; | ||
var getCssValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : identity; | ||
return curryN(2, function (value, props) { | ||
if (value == null) return {}; | ||
var color = value === false ? CSS_PROPS_DEFAULTS[cssProp] || CSS_DEFAULT_VALUE : isColor(value) ? value : getColor(theme, colorKey, value); | ||
var color = value === false ? CSS_PROPS_DEFAULTS[cssProp] || CSS_DEFAULT_VALUE : isColor(value) ? value : getColor(props.theme, colorKey, value); | ||
return !color ? {} : _defineProperty({}, cssProp, color); | ||
return !color ? {} : _defineProperty({}, cssProp, getCssValue(color, props)); | ||
}); | ||
@@ -38,0 +37,0 @@ }; |
export * from './core'; | ||
export * from './styles'; | ||
export * from './props'; | ||
export * from './props'; | ||
export { wrap, wrapIfMedia, sizeValue, spaceValue, skipPropValue } from './utils/helpers'; | ||
export { getPalette, getColors, getColor, getSize, getSpace, fromTheme } from './utils/getters'; |
import { curryN } from 'ramda'; | ||
import { wrapIfMedia, themeMedia, getStyles } from '../utils'; | ||
var onMedia = curryN(2, function (mediaKey, style) { | ||
return function (props) { | ||
return wrapIfMedia(themeMedia(props.theme)[mediaKey], getStyles(style, props, mediaKey)); | ||
}; | ||
var onMedia = curryN(3, function (mediaKey, style, props) { | ||
return wrapIfMedia(themeMedia(props.theme)[mediaKey], getStyles(style, props, mediaKey)); | ||
}); | ||
export { onMedia }; |
@@ -6,3 +6,3 @@ import _toConsumableArray from 'babel-runtime/helpers/toConsumableArray'; | ||
import { isStr, isArr, isNum, isObj, isFn } from './is'; | ||
import { isStr, isArr, isNum, isObj, isFn, isBool } from './is'; | ||
import { spaceValue } from './helpers'; | ||
@@ -90,3 +90,3 @@ | ||
if (!isNum(step)) { | ||
if (!isNum(step) && !isBool(step)) { | ||
var themeSize = getSize(theme, step); | ||
@@ -93,0 +93,0 @@ |
export * from './is'; | ||
export * from './colors'; | ||
export * from './getters'; | ||
export * from './helpers'; |
@@ -10,2 +10,18 @@ import { is } from 'ramda'; | ||
export { isFn, isBool, isNum, isStr, isArr, isObj }; | ||
var isHex = function isHex(str) { | ||
return (/^#/.test(str || '') | ||
); | ||
}; | ||
var isRgb = function isRgb(str) { | ||
return (/^rgba?/.test(str || '') | ||
); | ||
}; | ||
var isHsl = function isHsl(str) { | ||
return (/^hsla?/.test(str || '') | ||
); | ||
}; | ||
var isColor = function isColor(str) { | ||
return isHex(str) || isRgb(str) || isHsl(str); | ||
}; | ||
export { isFn, isBool, isNum, isStr, isArr, isObj, isColor }; |
{ | ||
"name": "@exah/prop-styles-system", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Prop styles system for styled components", | ||
@@ -5,0 +5,0 @@ "author": "John Grishin <hi@johngrish.in>", |
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
61351
53
1450