fela-utils
Advanced tools
Comparing version 8.1.3 to 10.0.0
@@ -41,12 +41,10 @@ var _handlers; | ||
} | ||
} else if (media) { | ||
if (!cluster.mediaRules[media]) { | ||
cluster.mediaRules[media] = ''; | ||
} | ||
cluster.mediaRules[media] += cssRule; | ||
} else { | ||
if (media) { | ||
if (!cluster.mediaRules[media]) { | ||
cluster.mediaRules[media] = ''; | ||
} | ||
cluster.mediaRules[media] += cssRule; | ||
} else { | ||
cluster.rules += cssRule; | ||
} | ||
cluster.rules += cssRule; | ||
} | ||
@@ -84,8 +82,8 @@ }), _defineProperty(_handlers, FONT_TYPE, function (cluster, _ref2) { | ||
var supportMediaRules = arrayReduce(mediaQueryOrder, function (supportRules, media) { | ||
supportRules[media] = applyKeysInOrder(supportQueryOrder); | ||
return supportRules; | ||
var supportMediaRules = arrayReduce(mediaQueryOrder, function (resultSupportRules, media) { | ||
resultSupportRules[media] = applyKeysInOrder(supportQueryOrder); | ||
return resultSupportRules; | ||
}, applyKeysInOrder(mediaQueryOrder, {})); | ||
return objectReduce(sortedCache, function (cluster, entry, key) { | ||
return objectReduce(sortedCache, function (cluster, entry) { | ||
var handler = handlers[entry.type]; | ||
@@ -92,0 +90,0 @@ |
@@ -8,3 +8,2 @@ import applyKeysInOrder from './applyKeysInOrder'; | ||
import generateCSSSupportRule from './generateCSSSupportRule'; | ||
import generateUniqueHash from './generateUniqueHash'; | ||
import getRuleScore from './getRuleScore'; | ||
@@ -21,2 +20,2 @@ import isMediaQuery from './isMediaQuery'; | ||
export { applyKeysInOrder, clusterCache, cssifySupportRules, generateCombinedMediaQuery, generateCSSRule, generateCSSSelector, generateCSSSupportRule, generateUniqueHash, getRuleScore, isMediaQuery, isNestedSelector, isSupport, isUndefinedValue, isValidHTMLElement, normalizeNestedProperty, processStyleWithPlugins, sheetMap, RULE_TYPE, KEYFRAME_TYPE, FONT_TYPE, STATIC_TYPE, CLEAR_TYPE }; | ||
export { applyKeysInOrder, clusterCache, cssifySupportRules, generateCombinedMediaQuery, generateCSSRule, generateCSSSelector, generateCSSSupportRule, getRuleScore, isMediaQuery, isNestedSelector, isSupport, isUndefinedValue, isValidHTMLElement, normalizeNestedProperty, processStyleWithPlugins, sheetMap, RULE_TYPE, KEYFRAME_TYPE, FONT_TYPE, STATIC_TYPE, CLEAR_TYPE }; |
@@ -10,4 +10,4 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
export default function objectSortByScore(obj, getScore) { | ||
var sortedKeys = objectReduce(obj, function (sortedKeys, value, key) { | ||
var index = sortedKeys.findIndex(function (el) { | ||
var sortedKeys = objectReduce(obj, function (resultSortedKeys, value, key) { | ||
var index = resultSortedKeys.findIndex(function (el) { | ||
return getScore(obj[el], el) > getScore(value, key); | ||
@@ -17,6 +17,6 @@ }); | ||
if (index !== -1) { | ||
return insertAtIndex(sortedKeys, key, index); | ||
return insertAtIndex(resultSortedKeys, key, index); | ||
} | ||
return [].concat(_toConsumableArray(sortedKeys), [key]); | ||
return [].concat(_toConsumableArray(resultSortedKeys), [key]); | ||
}, []); | ||
@@ -23,0 +23,0 @@ |
@@ -67,12 +67,10 @@ 'use strict'; | ||
} | ||
} else if (media) { | ||
if (!cluster.mediaRules[media]) { | ||
cluster.mediaRules[media] = ''; | ||
} | ||
cluster.mediaRules[media] += cssRule; | ||
} else { | ||
if (media) { | ||
if (!cluster.mediaRules[media]) { | ||
cluster.mediaRules[media] = ''; | ||
} | ||
cluster.mediaRules[media] += cssRule; | ||
} else { | ||
cluster.rules += cssRule; | ||
} | ||
cluster.rules += cssRule; | ||
} | ||
@@ -110,8 +108,8 @@ }), _defineProperty(_handlers, _styleTypes.FONT_TYPE, function (cluster, _ref2) { | ||
var supportMediaRules = (0, _arrayReduce2.default)(mediaQueryOrder, function (supportRules, media) { | ||
supportRules[media] = (0, _applyKeysInOrder2.default)(supportQueryOrder); | ||
return supportRules; | ||
var supportMediaRules = (0, _arrayReduce2.default)(mediaQueryOrder, function (resultSupportRules, media) { | ||
resultSupportRules[media] = (0, _applyKeysInOrder2.default)(supportQueryOrder); | ||
return resultSupportRules; | ||
}, (0, _applyKeysInOrder2.default)(mediaQueryOrder, {})); | ||
return (0, _objectReduce2.default)(sortedCache, function (cluster, entry, key) { | ||
return (0, _objectReduce2.default)(sortedCache, function (cluster, entry) { | ||
var handler = handlers[entry.type]; | ||
@@ -118,0 +116,0 @@ |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.CLEAR_TYPE = exports.STATIC_TYPE = exports.FONT_TYPE = exports.KEYFRAME_TYPE = exports.RULE_TYPE = exports.sheetMap = exports.processStyleWithPlugins = exports.normalizeNestedProperty = exports.isValidHTMLElement = exports.isUndefinedValue = exports.isSupport = exports.isNestedSelector = exports.isMediaQuery = exports.getRuleScore = exports.generateUniqueHash = exports.generateCSSSupportRule = exports.generateCSSSelector = exports.generateCSSRule = exports.generateCombinedMediaQuery = exports.cssifySupportRules = exports.clusterCache = exports.applyKeysInOrder = undefined; | ||
exports.CLEAR_TYPE = exports.STATIC_TYPE = exports.FONT_TYPE = exports.KEYFRAME_TYPE = exports.RULE_TYPE = exports.sheetMap = exports.processStyleWithPlugins = exports.normalizeNestedProperty = exports.isValidHTMLElement = exports.isUndefinedValue = exports.isSupport = exports.isNestedSelector = exports.isMediaQuery = exports.getRuleScore = exports.generateCSSSupportRule = exports.generateCSSSelector = exports.generateCSSRule = exports.generateCombinedMediaQuery = exports.cssifySupportRules = exports.clusterCache = exports.applyKeysInOrder = undefined; | ||
@@ -37,6 +37,2 @@ var _applyKeysInOrder = require('./applyKeysInOrder'); | ||
var _generateUniqueHash = require('./generateUniqueHash'); | ||
var _generateUniqueHash2 = _interopRequireDefault(_generateUniqueHash); | ||
var _getRuleScore = require('./getRuleScore'); | ||
@@ -89,3 +85,2 @@ | ||
exports.generateCSSSupportRule = _generateCSSSupportRule2.default; | ||
exports.generateUniqueHash = _generateUniqueHash2.default; | ||
exports.getRuleScore = _getRuleScore2.default; | ||
@@ -92,0 +87,0 @@ exports.isMediaQuery = _isMediaQuery2.default; |
@@ -26,4 +26,4 @@ 'use strict'; | ||
function objectSortByScore(obj, getScore) { | ||
var sortedKeys = (0, _objectReduce2.default)(obj, function (sortedKeys, value, key) { | ||
var index = sortedKeys.findIndex(function (el) { | ||
var sortedKeys = (0, _objectReduce2.default)(obj, function (resultSortedKeys, value, key) { | ||
var index = resultSortedKeys.findIndex(function (el) { | ||
return getScore(obj[el], el) > getScore(value, key); | ||
@@ -33,6 +33,6 @@ }); | ||
if (index !== -1) { | ||
return (0, _insertAtIndex2.default)(sortedKeys, key, index); | ||
return (0, _insertAtIndex2.default)(resultSortedKeys, key, index); | ||
} | ||
return [].concat(_toConsumableArray(sortedKeys), [key]); | ||
return [].concat(_toConsumableArray(resultSortedKeys), [key]); | ||
}, []); | ||
@@ -39,0 +39,0 @@ |
{ | ||
"name": "fela-utils", | ||
"version": "8.1.3", | ||
"version": "10.0.0", | ||
"description": "Internal utilities for Fela", | ||
@@ -24,8 +24,5 @@ "main": "lib/index.js", | ||
"css-in-js-utils": "^3.0.0", | ||
"fast-loops": "^1.0.0", | ||
"string-hash": "^1.1.3" | ||
"fast-loops": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"fela": "^6.2.3" | ||
} | ||
"gitHead": "7f81d463beac94a7ae8d642119c6ff394f1e9788" | ||
} |
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
2
0
26870
43
539
- Removedstring-hash@^1.1.3
- Removedstring-hash@1.1.3(transitive)