@theme-ui/css
Advanced tools
Comparing version 0.3.1 to 0.4.0-alpha.0
@@ -1,10 +0,10 @@ | ||
var get = function (obj, key, def, p, undef) { | ||
key = key && key.split ? key.split('.') : [key]; | ||
function get(obj, key, def, p, undef) { | ||
var path = key && typeof key === 'string' ? key.split('.') : [key]; | ||
for (p = 0; p < key.length; p++) { | ||
obj = obj ? obj[key[p]] : undef; | ||
for (p = 0; p < path.length; p++) { | ||
obj = obj ? obj[path[p]] : undef; | ||
} | ||
return obj === undef ? def : obj; | ||
}; | ||
} | ||
var defaultBreakpoints = [40, 52, 64].map(function (n) { return n + 'em'; }); | ||
@@ -121,3 +121,3 @@ var defaultTheme = { | ||
if (typeof n === 'string') { return '-' + n; } | ||
return n * -1; | ||
return Number(n) * -1; | ||
}; | ||
@@ -134,3 +134,3 @@ | ||
var next = {}; | ||
var breakpoints = get(theme, 'breakpoints', defaultBreakpoints); | ||
var breakpoints = theme && theme.breakpoints || defaultBreakpoints; | ||
var mediaQueries = [null ].concat( breakpoints.map(function (n) { return ("@media screen and (min-width: " + n + ")"); })); | ||
@@ -164,7 +164,10 @@ | ||
var css = function (args) { return function (props) { | ||
var css = function (args) { | ||
if ( args === void 0 ) args = {}; | ||
return function (props) { | ||
if ( props === void 0 ) props = {}; | ||
var theme = Object.assign({}, defaultTheme, | ||
(props.theme || props)); | ||
('theme' in props ? props.theme : props)); | ||
var result = {}; | ||
@@ -190,4 +193,4 @@ var obj = typeof args === 'function' ? args(theme) : args; | ||
var prop = get(aliases, key, key); | ||
var scaleName = get(scales, prop); | ||
var prop = key in aliases ? aliases[key] : key; | ||
var scaleName = prop in scales ? scales[prop] : undefined; | ||
var scale = get(theme, scaleName, get(theme, prop, {})); | ||
@@ -209,5 +212,6 @@ var transform = get(transforms, prop, get); | ||
return result; | ||
}; }; | ||
}; | ||
}; | ||
export { get, css }; | ||
export { get, multiples, scales, css }; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,10 +0,10 @@ | ||
var get = function (obj, key, def, p, undef) { | ||
key = key && key.split ? key.split('.') : [key]; | ||
function get(obj, key, def, p, undef) { | ||
var path = key && typeof key === 'string' ? key.split('.') : [key]; | ||
for (p = 0; p < key.length; p++) { | ||
obj = obj ? obj[key[p]] : undef; | ||
for (p = 0; p < path.length; p++) { | ||
obj = obj ? obj[path[p]] : undef; | ||
} | ||
return obj === undef ? def : obj; | ||
}; | ||
} | ||
var defaultBreakpoints = [40, 52, 64].map(function (n) { return n + 'em'; }); | ||
@@ -121,3 +121,3 @@ var defaultTheme = { | ||
if (typeof n === 'string') { return '-' + n; } | ||
return n * -1; | ||
return Number(n) * -1; | ||
}; | ||
@@ -134,3 +134,3 @@ | ||
var next = {}; | ||
var breakpoints = get(theme, 'breakpoints', defaultBreakpoints); | ||
var breakpoints = theme && theme.breakpoints || defaultBreakpoints; | ||
var mediaQueries = [null ].concat( breakpoints.map(function (n) { return ("@media screen and (min-width: " + n + ")"); })); | ||
@@ -164,7 +164,10 @@ | ||
var css = function (args) { return function (props) { | ||
var css = function (args) { | ||
if ( args === void 0 ) args = {}; | ||
return function (props) { | ||
if ( props === void 0 ) props = {}; | ||
var theme = Object.assign({}, defaultTheme, | ||
(props.theme || props)); | ||
('theme' in props ? props.theme : props)); | ||
var result = {}; | ||
@@ -190,4 +193,4 @@ var obj = typeof args === 'function' ? args(theme) : args; | ||
var prop = get(aliases, key, key); | ||
var scaleName = get(scales, prop); | ||
var prop = key in aliases ? aliases[key] : key; | ||
var scaleName = prop in scales ? scales[prop] : undefined; | ||
var scale = get(theme, scaleName, get(theme, prop, {})); | ||
@@ -209,6 +212,9 @@ var transform = get(transforms, prop, get); | ||
return result; | ||
}; }; | ||
}; | ||
}; | ||
exports.get = get; | ||
exports.multiples = multiples; | ||
exports.scales = scales; | ||
exports.css = css; | ||
//# sourceMappingURL=index.js.map |
@@ -6,11 +6,11 @@ (function (global, factory) { | ||
}(this, (function (exports) { | ||
var get = function (obj, key, def, p, undef) { | ||
key = key && key.split ? key.split('.') : [key]; | ||
function get(obj, key, def, p, undef) { | ||
var path = key && typeof key === 'string' ? key.split('.') : [key]; | ||
for (p = 0; p < key.length; p++) { | ||
obj = obj ? obj[key[p]] : undef; | ||
for (p = 0; p < path.length; p++) { | ||
obj = obj ? obj[path[p]] : undef; | ||
} | ||
return obj === undef ? def : obj; | ||
}; | ||
} | ||
var defaultBreakpoints = [40, 52, 64].map(function (n) { return n + 'em'; }); | ||
@@ -127,3 +127,3 @@ var defaultTheme = { | ||
if (typeof n === 'string') { return '-' + n; } | ||
return n * -1; | ||
return Number(n) * -1; | ||
}; | ||
@@ -140,3 +140,3 @@ | ||
var next = {}; | ||
var breakpoints = get(theme, 'breakpoints', defaultBreakpoints); | ||
var breakpoints = theme && theme.breakpoints || defaultBreakpoints; | ||
var mediaQueries = [null ].concat( breakpoints.map(function (n) { return ("@media screen and (min-width: " + n + ")"); })); | ||
@@ -170,7 +170,10 @@ | ||
var css = function (args) { return function (props) { | ||
var css = function (args) { | ||
if ( args === void 0 ) args = {}; | ||
return function (props) { | ||
if ( props === void 0 ) props = {}; | ||
var theme = Object.assign({}, defaultTheme, | ||
(props.theme || props)); | ||
('theme' in props ? props.theme : props)); | ||
var result = {}; | ||
@@ -196,4 +199,4 @@ var obj = typeof args === 'function' ? args(theme) : args; | ||
var prop = get(aliases, key, key); | ||
var scaleName = get(scales, prop); | ||
var prop = key in aliases ? aliases[key] : key; | ||
var scaleName = prop in scales ? scales[prop] : undefined; | ||
var scale = get(theme, scaleName, get(theme, prop, {})); | ||
@@ -215,5 +218,8 @@ var transform = get(transforms, prop, get); | ||
return result; | ||
}; }; | ||
}; | ||
}; | ||
exports.get = get; | ||
exports.multiples = multiples; | ||
exports.scales = scales; | ||
exports.css = css; | ||
@@ -220,0 +226,0 @@ |
{ | ||
"name": "@theme-ui/css", | ||
"version": "0.3.1", | ||
"version": "0.4.0-alpha.0", | ||
"source": "src/index.ts", | ||
"main": "dist/index.js", | ||
"module": "dist/index.esm.js", | ||
"types": "dist/index.d.ts", | ||
"sideEffects": false, | ||
@@ -16,3 +18,6 @@ "scripts": { | ||
}, | ||
"gitHead": "f6380fc356ce97e64bf50ba60e0bc6f38a25dabe" | ||
"dependencies": { | ||
"csstype": "^2.5.7" | ||
}, | ||
"gitHead": "fbdd88ea280c0d9880d39a114cb6d19f0d4da2ca" | ||
} |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
157277
291
2454
1
1
+ Addedcsstype@^2.5.7
+ Addedcsstype@2.6.21(transitive)