styled-system
Advanced tools
Comparing version 1.0.0-4 to 1.0.0-5
'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -51,3 +53,5 @@ | ||
var joinObj = function joinObj(acc, obj) { | ||
return Object.assign(acc, obj); | ||
return Object.assign(acc, Object.keys(obj).reduce(function (result, key) { | ||
return Object.assign(result, _defineProperty({}, key, _typeof(acc[key]) === 'object' && _typeof(obj[key]) === 'object' ? [acc[key], obj[key]].reduce(joinObj, {}) : obj[key])); | ||
}, {})); | ||
}; | ||
@@ -65,3 +69,4 @@ | ||
dec: dec, | ||
joinObj: joinObj | ||
joinObj: joinObj, | ||
mq: mq | ||
}; |
{ | ||
"name": "styled-system", | ||
"version": "1.0.0-4", | ||
"version": "1.0.0-5", | ||
"description": "Design system utilities for styled-components, glamorous, and other css-in-js libraries", | ||
@@ -35,9 +35,6 @@ "main": "dist/index.js", | ||
"react-x-ray": "^1.0.0-2", | ||
"styled-components": "^2.1.0", | ||
"webpack": "^2.6.1", | ||
"webpack-dev-server": "^2.4.5" | ||
}, | ||
"dependencies": { | ||
"glamorous": "^3.23.2", | ||
"styled-components": "^2.1.0" | ||
} | ||
} |
@@ -16,3 +16,15 @@ const { breakpoints } = require('./constants') | ||
const media = bp => (d, i) => bp[i] ? ({[bp[i]]: d}) : d | ||
const joinObj = (acc, obj) => Object.assign(acc, obj) | ||
const joinObj = (acc, obj) => | ||
Object.assign( | ||
acc, | ||
Object.keys(obj).reduce( | ||
(result, key) => | ||
Object.assign(result, { | ||
[key]: typeof acc[key] === 'object' && typeof obj[key] === 'object' | ||
? [acc[key], obj[key]].reduce(joinObj, {}) | ||
: obj[key], | ||
}), | ||
{} | ||
) | ||
); | ||
@@ -30,2 +42,3 @@ module.exports = { | ||
joinObj, | ||
mq | ||
} |
24
test.js
@@ -159,2 +159,14 @@ import test from 'ava' | ||
test('space returns responsive directional margins', t => { | ||
const a = space({mt: [0, 1], mb: [2, 3]}) | ||
t.deepEqual(a, { | ||
marginBottom: '16px', | ||
marginTop: '0px', | ||
'@media screen and (min-width: 40em)': { | ||
marginBottom: '32px', | ||
marginTop: '8px', | ||
}, | ||
}) | ||
}) | ||
test('space returns padding declarations', t => { | ||
@@ -197,2 +209,14 @@ const dec = space({p: 1}) | ||
test('space returns responsive directional paddings', t => { | ||
const a = space({pt: [0, 1], pb: [2, 3]}) | ||
t.deepEqual(a, { | ||
paddingBottom: '16px', | ||
paddingTop: '0px', | ||
'@media screen and (min-width: 40em)': { | ||
paddingBottom: '32px', | ||
paddingTop: '8px', | ||
}, | ||
}) | ||
}) | ||
test('space can be configured with a theme', t => { | ||
@@ -199,0 +223,0 @@ const a = space({theme, m: 1}) |
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
0
27153
17
21
728
- Removedglamorous@^3.23.2
- Removedstyled-components@^2.1.0
- Removedasap@2.0.6(transitive)
- Removedbase64-js@1.5.1(transitive)
- Removedbowser@1.9.4(transitive)
- Removedbrcast@2.0.2(transitive)
- Removedbuffer@5.7.1(transitive)
- Removedcamelize@1.0.1(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcss-color-keywords@1.0.0(transitive)
- Removedcss-in-js-utils@2.0.1(transitive)
- Removedcss-to-react-native@2.3.2(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfast-memoize@2.5.2(transitive)
- Removedfbjs@0.8.18(transitive)
- Removedglamor@2.20.40(transitive)
- Removedglamorous@3.25.0(transitive)
- Removedhas-flag@1.0.0(transitive)
- Removedhoist-non-react-statics@1.2.0(transitive)
- Removedhtml-element-attributes@1.3.1(transitive)
- Removedhtml-tag-names@1.1.5(transitive)
- Removedhyphenate-style-name@1.1.0(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedieee754@1.2.1(transitive)
- Removedinline-style-prefixer@3.0.8(transitive)
- Removedis-plain-object@2.0.4(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisobject@3.0.1(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedpostcss-value-parser@3.3.1(transitive)
- Removedpromise@7.3.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact@16.14.018.3.1(transitive)
- Removedreact-html-attributes@1.4.6(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedstyled-components@2.4.1(transitive)
- Removedstylis@3.5.4(transitive)
- Removedsupports-color@3.2.3(transitive)
- Removedsvg-tag-names@1.1.2(transitive)
- Removedthrough@2.3.8(transitive)
- Removedua-parser-js@0.7.39(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)