facepaint
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):e.facepaint=r()}(this,function(){"use strict";return function(e){function r(e){return"object"!=typeof e||null==e?[]:Array.isArray(e)?e.map(r):Object.keys(e).reduce(function(t,f){var a=e[f];if(!Array.isArray(a)&&n&&(a=[a]),(n||Array.isArray(a))&&38!==f.charCodeAt(0)){var u=void 0;a.forEach(function(e,r){if((!o||u!==e)&&null!=e)if(u=e,0!==r||n)if(void 0===t[i[r]]){var a;t[i[r]]=(a={},a[f]=e,a)}else t[i[r]][f]=e;else t[f]=e})}else t[f]="object"==typeof a?r(a):a;return t},{})}var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.literal,o=t.overlap,i=n?e:["&"].concat(e);return function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.map(r)}}}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):e.facepaint=r()}(this,function(){"use strict";return function(e){function r(e){if("object"!=typeof e||null==e)return[];if(Array.isArray(e))return e.map(r);var n={},f={},a={};return Object.keys(e).forEach(function(c){var u=e[c];if(!Array.isArray(u)&&t&&(u=[u]),(t||Array.isArray(u))&&38!==c.charCodeAt(0)){var l=void 0;u.forEach(function(e,r){if((!o||l!==e)&&null!=e)if(l=e,0!==r||t)if(void 0===n[i[r]]){var f;n[i[r]]=(f={},f[c]=e,f)}else n[i[r]][c]=e;else a[c]=e})}else"object"==typeof u?f[c]=r(u):a[c]=u}),i.forEach(function(e){n[e]&&(a[e]=n[e])}),Object.assign(a,f),a}var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.literal,o=n.overlap,i=t?e:["&"].concat(e);return function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.map(r)}}}); | ||
//# sourceMappingURL=facepaint.umd.min.js.map |
@@ -20,3 +20,6 @@ 'use strict'; | ||
return Object.keys(obj).reduce(function (slots, key) { | ||
var slots = {}; | ||
var objects = {}; | ||
var props = {}; | ||
Object.keys(obj).forEach(function (key) { | ||
// Check if value is an array, but skip if it looks like a selector. | ||
@@ -46,3 +49,3 @@ // key.indexOf('&') === 0 | ||
if (index === 0 && !literal) { | ||
slots[key] = v; | ||
props[key] = v; | ||
} else if (slots[mq[index]] === undefined) { | ||
@@ -57,8 +60,16 @@ var _slots$mq$index; | ||
} else if (typeof item === 'object') { | ||
slots[key] = flatten(item); | ||
objects[key] = flatten(item); | ||
} else { | ||
slots[key] = item; | ||
props[key] = item; | ||
} | ||
return slots; | ||
}, {}); | ||
}); | ||
// Ensure that all slots and then child objects are pushed to the end | ||
mq.forEach(function (el) { | ||
if (slots[el]) { | ||
props[el] = slots[el]; | ||
} | ||
}); | ||
Object.assign(props, objects); | ||
return props; | ||
} | ||
@@ -65,0 +76,0 @@ |
@@ -18,3 +18,6 @@ /* eslint-disable no-param-reassign */ | ||
return Object.keys(obj).reduce(function (slots, key) { | ||
var slots = {}; | ||
var objects = {}; | ||
var props = {}; | ||
Object.keys(obj).forEach(function (key) { | ||
// Check if value is an array, but skip if it looks like a selector. | ||
@@ -44,3 +47,3 @@ // key.indexOf('&') === 0 | ||
if (index === 0 && !literal) { | ||
slots[key] = v; | ||
props[key] = v; | ||
} else if (slots[mq[index]] === undefined) { | ||
@@ -55,8 +58,16 @@ var _slots$mq$index; | ||
} else if (typeof item === 'object') { | ||
slots[key] = flatten(item); | ||
objects[key] = flatten(item); | ||
} else { | ||
slots[key] = item; | ||
props[key] = item; | ||
} | ||
return slots; | ||
}, {}); | ||
}); | ||
// Ensure that all slots and then child objects are pushed to the end | ||
mq.forEach(function (el) { | ||
if (slots[el]) { | ||
props[el] = slots[el]; | ||
} | ||
}); | ||
Object.assign(props, objects); | ||
return props; | ||
} | ||
@@ -63,0 +74,0 @@ |
{ | ||
"name": "facepaint", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Responsive style values for css-in-js.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -14,3 +14,6 @@ /* eslint-disable no-param-reassign */ | ||
return Object.keys(obj).reduce((slots, key) => { | ||
const slots = {} | ||
const objects = {} | ||
const props = {} | ||
Object.keys(obj).forEach(key => { | ||
// Check if value is an array, but skip if it looks like a selector. | ||
@@ -40,3 +43,3 @@ // key.indexOf('&') === 0 | ||
if (index === 0 && !literal) { | ||
slots[key] = v | ||
props[key] = v | ||
} else if (slots[mq[index]] === undefined) { | ||
@@ -49,8 +52,16 @@ slots[mq[index]] = { [key]: v } | ||
} else if (typeof item === 'object') { | ||
slots[key] = flatten(item) | ||
objects[key] = flatten(item) | ||
} else { | ||
slots[key] = item | ||
props[key] = item | ||
} | ||
return slots | ||
}, {}) | ||
}) | ||
// Ensure that all slots and then child objects are pushed to the end | ||
mq.forEach(el => { | ||
if (slots[el]) { | ||
props[el] = slots[el]; | ||
} | ||
}) | ||
Object.assign(props, objects) | ||
return props | ||
} | ||
@@ -57,0 +68,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
25560
199