fela-utils
Advanced tools
Comparing version 8.0.8 to 8.1.0
@@ -10,2 +10,4 @@ var _handlers; | ||
import generateCSSRule from './generateCSSRule'; | ||
import sortCache from './sortCache'; | ||
import getRuleScore from './getRuleScore'; | ||
@@ -73,3 +75,19 @@ import { RULE_TYPE, KEYFRAME_TYPE, FONT_TYPE, STATIC_TYPE } from './styleTypes'; | ||
var supportQueryOrder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | ||
var ruleOrder = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; | ||
var sortedCache = sortCache(cache, function (left, right) { | ||
var leftScore = getRuleScore(ruleOrder, left.pseudo); | ||
var rightScore = getRuleScore(ruleOrder, right.pseudo); | ||
if (leftScore > rightScore) { | ||
return 1; | ||
} | ||
if (rightScore > leftScore) { | ||
return -1; | ||
} | ||
return 0; | ||
}); | ||
var mediaRules = applyKeysInOrder(mediaQueryOrder); | ||
@@ -83,3 +101,3 @@ var supportRules = applyKeysInOrder(supportQueryOrder); | ||
return objectReduce(cache, function (cluster, entry, key) { | ||
return objectReduce(sortedCache, function (cluster, entry, key) { | ||
var handler = handlers[entry.type]; | ||
@@ -86,0 +104,0 @@ |
@@ -9,2 +9,3 @@ import applyKeysInOrder from './applyKeysInOrder'; | ||
import generateUniqueHash from './generateUniqueHash'; | ||
import getRuleScore from './getRuleScore'; | ||
import isMediaQuery from './isMediaQuery'; | ||
@@ -20,2 +21,2 @@ import isNestedSelector from './isNestedSelector'; | ||
export { applyKeysInOrder, clusterCache, cssifySupportRules, generateCombinedMediaQuery, generateCSSRule, generateCSSSelector, generateCSSSupportRule, generateUniqueHash, 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, generateUniqueHash, getRuleScore, isMediaQuery, isNestedSelector, isSupport, isUndefinedValue, isValidHTMLElement, normalizeNestedProperty, processStyleWithPlugins, sheetMap, RULE_TYPE, KEYFRAME_TYPE, FONT_TYPE, STATIC_TYPE, CLEAR_TYPE }; |
@@ -27,2 +27,10 @@ 'use strict'; | ||
var _sortCache = require('./sortCache'); | ||
var _sortCache2 = _interopRequireDefault(_sortCache); | ||
var _getRuleScore = require('./getRuleScore'); | ||
var _getRuleScore2 = _interopRequireDefault(_getRuleScore); | ||
var _styleTypes = require('./styleTypes'); | ||
@@ -93,3 +101,19 @@ | ||
var supportQueryOrder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | ||
var ruleOrder = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; | ||
var sortedCache = (0, _sortCache2.default)(cache, function (left, right) { | ||
var leftScore = (0, _getRuleScore2.default)(ruleOrder, left.pseudo); | ||
var rightScore = (0, _getRuleScore2.default)(ruleOrder, right.pseudo); | ||
if (leftScore > rightScore) { | ||
return 1; | ||
} | ||
if (rightScore > leftScore) { | ||
return -1; | ||
} | ||
return 0; | ||
}); | ||
var mediaRules = (0, _applyKeysInOrder2.default)(mediaQueryOrder); | ||
@@ -103,3 +127,3 @@ var supportRules = (0, _applyKeysInOrder2.default)(supportQueryOrder); | ||
return (0, _objectReduce2.default)(cache, function (cluster, entry, key) { | ||
return (0, _objectReduce2.default)(sortedCache, function (cluster, entry, key) { | ||
var handler = handlers[entry.type]; | ||
@@ -106,0 +130,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.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.generateUniqueHash = exports.generateCSSSupportRule = exports.generateCSSSelector = exports.generateCSSRule = exports.generateCombinedMediaQuery = exports.cssifySupportRules = exports.clusterCache = exports.applyKeysInOrder = undefined; | ||
@@ -41,2 +41,6 @@ var _applyKeysInOrder = require('./applyKeysInOrder'); | ||
var _getRuleScore = require('./getRuleScore'); | ||
var _getRuleScore2 = _interopRequireDefault(_getRuleScore); | ||
var _isMediaQuery = require('./isMediaQuery'); | ||
@@ -86,2 +90,3 @@ | ||
exports.generateUniqueHash = _generateUniqueHash2.default; | ||
exports.getRuleScore = _getRuleScore2.default; | ||
exports.isMediaQuery = _isMediaQuery2.default; | ||
@@ -88,0 +93,0 @@ exports.isNestedSelector = _isNestedSelector2.default; |
{ | ||
"name": "fela-utils", | ||
"version": "8.0.8", | ||
"version": "8.1.0", | ||
"description": "Internal utilities for Fela", | ||
@@ -28,4 +28,4 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"fela": "^6.1.9" | ||
"fela": "^6.2.0" | ||
} | ||
} |
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
27047
61246
561