fela-plugin-lvha
Advanced tools
Comparing version 4.2.1 to 4.2.2
@@ -47,26 +47,30 @@ (function (global, factory) { | ||
var precedence = { | ||
':link': 4, | ||
':visited': 3, | ||
':link': 0, | ||
':visited': 1, | ||
':hover': 2, | ||
':focus': 1.5, | ||
':active': 1 | ||
':focus': 3, | ||
':active': 4 | ||
}; | ||
function sortPseudoClasses(left, right) { | ||
var precedenceLeft = precedence[left]; | ||
// eslint-disable-line | ||
var precedenceRight = precedence[right]; | ||
// Only sort if both properties are listed | ||
// This prevents other pseudos from reordering | ||
if (precedenceLeft && precedenceRight) { | ||
return precedenceLeft < precedenceRight ? 1 : -1; | ||
var pseudoClasses = Object.keys(precedence); | ||
function LVHA(style) { | ||
var pseudoList = []; | ||
for (var property in style) { | ||
if (precedence[property]) { | ||
pseudoList[precedence[property]] = style[property]; | ||
delete style[property]; | ||
} | ||
} | ||
return 0; | ||
} | ||
function LVHA(style) { | ||
return Object.keys(style).sort(sortPseudoClasses).reduce(function (out, pseudo) { | ||
out[pseudo] = style[pseudo]; | ||
return out; | ||
}, {}); | ||
for (var i = 0, len = pseudoList.length; i < len; ++i) { | ||
var pseudoStyle = pseudoList[i]; | ||
if (pseudoStyle) { | ||
style[pseudoClasses[i]] = pseudoStyle; | ||
} | ||
} | ||
return style; | ||
} | ||
@@ -73,0 +77,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.FelaPluginLVHA=t()}(this,function(){"use strict";function e(e,t){var n=o[e],r=o[t];return n&&r?n<r?1:-1:0}function t(t){return Object.keys(t).sort(e).reduce(function(e,n){return e[n]=t[n],e},{})}var n={};n.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n.defineProperty=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},n.extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e};var o={":link":4,":visited":3,":hover":2,":focus":1.5,":active":1},r=function(){return t};return r}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.FelaPluginLVHA=t()}(this,function(){"use strict";function e(e){var t=[];for(var r in e)n[r]&&(t[n[r]]=e[r],delete e[r]);for(var f=0,i=t.length;f<i;++f){var u=t[f];u&&(e[o[f]]=u)}return e}var t={};t.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t.defineProperty=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},t.extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e};var n={":link":0,":visited":1,":hover":2,":focus":3,":active":4},o=Object.keys(n),r=function(){return e};return r}); |
{ | ||
"name": "fela-plugin-lvha", | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"description": "Fela plugin that sorts pseudo classes according to LVH(F)A", | ||
@@ -23,4 +23,4 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"fela": "4.2.1" | ||
"fela": "4.2.2" | ||
} | ||
} |
@@ -17,5 +17,5 @@ # fela-plugin-lvha | ||
<!-- Fela (Development): Unminified version including all warnings --> | ||
<script src="https://unpkg.com/fela-plugin-lvha@4.2.1/dist/fela-plugin-lvha.js"></script> | ||
<script src="https://unpkg.com/fela-plugin-lvha@4.2.2/dist/fela-plugin-lvha.js"></script> | ||
<!-- Fela (Production): Minified version --> | ||
<script src="https://unpkg.com/fela-plugin-lvha@4.2.1/dist/fela-plugin-lvha.min.js"></script> | ||
<script src="https://unpkg.com/fela-plugin-lvha@4.2.2/dist/fela-plugin-lvha.min.js"></script> | ||
``` | ||
@@ -22,0 +22,0 @@ |
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
8265