aesthetic-utils
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -6,2 +6,3 @@ /** | ||
// eslint-disable-next-line import/no-unresolved | ||
module.exports = require('./lib/index').default; |
@@ -13,3 +13,3 @@ 'use strict'; | ||
function createStyleElement(id /*: string*/) /*: HTMLElement*/ { | ||
function createStyleElement(id) { | ||
var style = document.createElement('style'); | ||
@@ -19,3 +19,2 @@ style.type = 'text/css'; | ||
// $FlowIssue We know the document exists | ||
document.head.appendChild(style); | ||
@@ -22,0 +21,0 @@ |
@@ -15,12 +15,3 @@ 'use strict'; | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
/*:: import type { AtRuleMap, CSSStyle } from '../../types';*/ | ||
function injectAtRules(properties /*: CSSStyle*/, atName /*: string*/, rules /*: AtRuleMap*/) { | ||
// Font faces don't have IDs in their declaration, | ||
// so we need to handle this differently. | ||
function injectAtRules(properties, atName, rules) { | ||
if (atName === '@font-face') { | ||
@@ -34,9 +25,11 @@ var fonts = (0, _keys2.default)(rules).map(function (key) { | ||
} | ||
// All other at-rules work the same. | ||
} else { | ||
(0, _keys2.default)(rules).forEach(function (key /*: string*/) { | ||
(0, _keys2.default)(rules).forEach(function (key) { | ||
properties[atName + ' ' + key] = rules[key]; | ||
}); | ||
} | ||
} | ||
} /** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ |
@@ -15,11 +15,4 @@ 'use strict'; | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
/*:: import type { CSSStyle } from '../../types';*/ | ||
function injectFallbacks(properties /*: CSSStyle*/, fallbacks /*: CSSStyle*/) { | ||
(0, _keys2.default)(fallbacks).forEach(function (propName /*: string*/) { | ||
function injectFallbacks(properties, fallbacks) { | ||
(0, _keys2.default)(fallbacks).forEach(function (propName) { | ||
var prop = properties[propName]; | ||
@@ -34,2 +27,6 @@ var fallback = fallbacks[propName]; | ||
}); | ||
} | ||
} /** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ |
@@ -6,13 +6,14 @@ 'use strict'; | ||
}); | ||
var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray'); | ||
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); | ||
exports.default = injectRuleByLookup; | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
/*:: import type { AtRuleMap, AtRuleCache, CSSStyle } from '../../types';*/ | ||
function injectRuleByLookup(properties /*: CSSStyle*/, propName /*: string*/, lookup /*: AtRuleMap | AtRuleCache*/) { | ||
var flatten /*: boolean*/ = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function injectRuleByLookup(properties, propName, lookup) { | ||
var flatten = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
var value = properties[propName]; | ||
@@ -24,3 +25,3 @@ | ||
value = value.split(',').map(function (name /*: string*/) { | ||
value = value.split(',').map(function (name) { | ||
name = name.trim(); | ||
@@ -30,3 +31,7 @@ var found = lookup[name]; | ||
if (found && Array.isArray(found)) { | ||
found = found[0]; | ||
var _found = found; | ||
var _found2 = (0, _slicedToArray3.default)(_found, 1); | ||
found = _found2[0]; | ||
} | ||
@@ -40,6 +45,14 @@ | ||
} else if (value.length === 1) { | ||
value = value[0]; | ||
var _value = value; | ||
var _value2 = (0, _slicedToArray3.default)(_value, 1); | ||
value = _value2[0]; | ||
} | ||
properties[propName] = value; | ||
} | ||
} /** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ |
@@ -21,4 +21,4 @@ 'use strict'; | ||
function isObject /*:: <T>*/(value /*: T*/) /*: boolean*/ { | ||
function isObject(value) { | ||
return value !== null && !Array.isArray(value) && (typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value)) === 'object'; | ||
} |
@@ -21,3 +21,3 @@ 'use strict'; | ||
function isPrimitive /*:: <T>*/(value /*: T*/) /*: boolean*/ { | ||
function isPrimitive(value) { | ||
var type = typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value); | ||
@@ -24,0 +24,0 @@ |
@@ -13,4 +13,4 @@ "use strict"; | ||
function toArray /*:: <T>*/(value /*: T | T[]*/) /*: T[]*/ { | ||
function toArray(value) { | ||
return Array.isArray(value) ? value : [value]; | ||
} |
{ | ||
"name": "aesthetic-utils", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Utility functions for Aesthetic.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
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
12389
23
300