Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aphrodite

Package Overview
Dependencies
Maintainers
4
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aphrodite - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

.nyc_output/27692.json

6

.eslintrc.json

@@ -8,7 +8,13 @@ {

"browser": true,
"es6": true,
"node": true
},
"rules": {
"indent": ["error", 4],
"no-const-assign": "error",
"no-var": "error",
"prefer-const": "error",
"react/jsx-indent": [ 2, 4 ]
}
}

2

dist/aphrodite.umd.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.aphrodite=t():e.aphrodite=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(10)},function(e,t){"use strict";function r(e){return"string"==typeof e&&n.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n=/-webkit-|-moz-|-ms-/;e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=r(31),u=n(a),s=r(4),f=n(s),l=function(e){return Object.keys(e).map(function(t){return[t,e[t]]})};t.objectToPairs=l;var c=function(e,t){for(var r=Object.keys(e),n={},i=0;i<r.length;i+=1){var a=t([r[i],e[r[i]]]),u=o(a,2),s=u[0],f=u[1];n[s]=f}return n};t.mapObj=c;var d=function(e){return e.reduce(function(e,t){return e.concat(t)},[])};t.flatten=d;var m=function e(t){return t.reduce(function(t,r){return t.concat(Array.isArray(r)?e(r):r)},[])};t.flattenDeep=m;var p=/([A-Z])/g,b=function(e){return"-"+e.toLowerCase()},y=function(e){var t=e.replace(p,b);return"m"===t[0]&&"s"===t[1]&&"-"===t[2]?"-"+t:t};t.kebabifyStyleName=y;var k=function(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e},h=function e(t,r){if(!k(t)||!k(r))return k(r)?f.default.from(r):r;var n=f.default.from(t),i=f.default.from(r);return i.forEach(function(t,r){n.has(t)?n.set(t,e(n.get(t),r)):n.set(t,r)}),n};t.recursiveMerge=h;var v={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},g=["Webkit","ms","Moz","O"];Object.keys(v).forEach(function(e){g.forEach(function(t){v[i(t,e)]=v[e]})});var W=function(e,t){return"number"==typeof t?v[e]?""+t:t+"px":""+t};t.stringifyValue=W;var x=function(e){return(0,u.default)(JSON.stringify(e)).toString(36)};t.hashObject=x;var O=function(e){return"!"===e[e.length-10]&&" !important"===e.slice(-11)?e:e+" !important"};t.importantify=O},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(14),u=n(a),s=r(6),f=n(s),l=r(4),c=n(l),d=r(2),m=(0,u.default)(f.default),p=[function(e,t,r){return":"!==e[0]?null:r(t+e)},function(e,t,r){if("@"!==e[0])return null;var n=r(t);return e+"{"+n+"}"}];t.defaultSelectorHandlers=p;var b=function e(t,r,n,i,o){var a=r.reduce(d.recursiveMerge,new c.default),u=new c.default,s="";return a.forEach(function(r,a){var f=n.some(function(u){var f=u(r,t,function(t){return e(t,[a],n,i,o)});if(null!=f)return s+=f,!0});f||u.set(r,a)}),k(t,u,i,o,n)+s};t.generateCSS=b;var y=function(e,t,r){var n=!!t;return e.map(function(e,i){return n&&t.hasOwnProperty(e)?t[e](i,r):i})},k=function(e,t,r,n,a){function u(e){var t=i(e,2),r=t[0],n=t[1];return p.hasOwnProperty(r)?f.hasOwnProperty(r)&&f[r]!==n?p[r]-.25:p[r]:-1}for(var s=y(t,r,a),f=o({},s.elements),l=m(s.elements),c=(0,d.flatten)((0,d.objectToPairs)(l).map(function(e){var t=i(e,2),r=t[0],n=t[1];return Array.isArray(n)?n.map(function(e){return[r,e]}):[[r,n]]})),p={},b=0;b<s.keyOrder.length;b++){var k=s.keyOrder[b];p[k]=b;for(var h=""+k[0].toUpperCase()+k.slice(1),v=["Webkit"+h,"Moz"+h,"ms"+h],g=0;g<v.length;++g)f.hasOwnProperty(v[g])||(p[v[g]]=b-.5,f[v[g]]=f[k])}c.sort(function(e,t){return u(e)-u(t)});var W=n===!1?d.stringifyValue:function(e,t){return(0,d.importantify)((0,d.stringifyValue)(e,t))},x=c.map(function(e){var t=i(e,2),r=t[0],n=t[1];return(0,d.kebabifyStyleName)(r)+":"+W(r,n)+";"}).join("");return x?e+"{"+x+"}":""};t.generateCSSRuleset=k},function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?[]:arguments[1];r(this,e),this.elements=t,this.keyOrder=n}return i(e,[{key:"forEach",value:function(e){for(var t=0;t<this.keyOrder.length;t++)e(this.keyOrder[t],this.elements[this.keyOrder[t]])}},{key:"map",value:function(t){for(var r=new e,n=0;n<this.keyOrder.length;n++)r.set(this.keyOrder[n],t(this.keyOrder[n],this.elements[this.keyOrder[n]]));return r}},{key:"set",value:function(e,t){this.elements.hasOwnProperty(e)||this.keyOrder.push(e),this.elements[e]=t}},{key:"get",value:function(e){return this.elements[e]}},{key:"has",value:function(e){return this.elements.hasOwnProperty(e)}}]),e}();t.default=o,o.fromObject=function(e){return new o(e,Object.keys(e))},o.fromMap=function(e){var t=new o;return e.forEach(function(e,r){t.set(r,e)}),t},o.from=function(e){return e instanceof o?new o(n({},e.elements),e.keyOrder.slice()):"undefined"!=typeof Map&&e instanceof Map?o.fromMap(e):o.fromObject(e)},e.exports=t.default},function(e,t){"use strict";function r(e){return e.charAt(0).toUpperCase()+e.slice(1)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,r){var n=r(15),i=r(16),o=r(17),a=r(18),u=r(19),s=r(20),f=r(21),l=r(22),c=r(23),d=r(24),m=r(25),p=r(26);e.exports={plugins:[n,i,o,a,u,s,f,l,c,d,m,p],prefixMap:{transform:["Webkit","ms"],transformOrigin:["Webkit","ms"],transformOriginX:["Webkit","ms"],transformOriginY:["Webkit","ms"],backfaceVisibility:["Webkit"],perspective:["Webkit"],perspectiveOrigin:["Webkit"],transformStyle:["Webkit"],transformOriginZ:["Webkit"],animation:["Webkit"],animationDelay:["Webkit"],animationDirection:["Webkit"],animationFillMode:["Webkit"],animationDuration:["Webkit"],animationIterationCount:["Webkit"],animationName:["Webkit"],animationPlayState:["Webkit"],animationTimingFunction:["Webkit"],appearance:["Webkit","Moz"],userSelect:["Webkit","Moz","ms"],fontKerning:["Webkit"],textEmphasisPosition:["Webkit"],textEmphasis:["Webkit"],textEmphasisStyle:["Webkit"],textEmphasisColor:["Webkit"],boxDecorationBreak:["Webkit"],clipPath:["Webkit"],maskImage:["Webkit"],maskMode:["Webkit"],maskRepeat:["Webkit"],maskPosition:["Webkit"],maskClip:["Webkit"],maskOrigin:["Webkit"],maskSize:["Webkit"],maskComposite:["Webkit"],mask:["Webkit"],maskBorderSource:["Webkit"],maskBorderMode:["Webkit"],maskBorderSlice:["Webkit"],maskBorderWidth:["Webkit"],maskBorderOutset:["Webkit"],maskBorderRepeat:["Webkit"],maskBorder:["Webkit"],maskType:["Webkit"],textDecorationStyle:["Webkit","Moz"],textDecorationSkip:["Webkit","Moz"],textDecorationLine:["Webkit","Moz"],textDecorationColor:["Webkit","Moz"],filter:["Webkit"],fontFeatureSettings:["Webkit","Moz"],breakAfter:["Webkit","Moz","ms"],breakBefore:["Webkit","Moz","ms"],breakInside:["Webkit","Moz","ms"],columnCount:["Webkit","Moz"],columnFill:["Webkit","Moz"],columnGap:["Webkit","Moz"],columnRule:["Webkit","Moz"],columnRuleColor:["Webkit","Moz"],columnRuleStyle:["Webkit","Moz"],columnRuleWidth:["Webkit","Moz"],columns:["Webkit","Moz"],columnSpan:["Webkit","Moz"],columnWidth:["Webkit","Moz"],flex:["Webkit","ms"],flexBasis:["Webkit"],flexDirection:["Webkit","ms"],flexGrow:["Webkit"],flexFlow:["Webkit","ms"],flexShrink:["Webkit"],flexWrap:["Webkit","ms"],alignContent:["Webkit"],alignItems:["Webkit"],alignSelf:["Webkit"],justifyContent:["Webkit"],order:["Webkit"],transitionDelay:["Webkit"],transitionDuration:["Webkit"],transitionProperty:["Webkit"],transitionTimingFunction:["Webkit"],backdropFilter:["Webkit"],scrollSnapType:["Webkit","ms"],scrollSnapPointsX:["Webkit","ms"],scrollSnapPointsY:["Webkit","ms"],scrollSnapDestination:["Webkit","ms"],scrollSnapCoordinate:["Webkit","ms"],shapeImageThreshold:["Webkit"],shapeImageMargin:["Webkit"],shapeImageOutside:["Webkit"],hyphens:["Webkit","Moz","ms"],flowInto:["Webkit","ms"],flowFrom:["Webkit","ms"],regionFragment:["Webkit","ms"],boxSizing:["Moz"],textAlignLast:["Moz"],tabSize:["Moz"],wrapFlow:["ms"],wrapThrough:["ms"],wrapMargin:["ms"],touchAction:["ms"],gridTemplateColumns:["ms"],gridTemplateRows:["ms"],gridTemplateAreas:["ms"],gridTemplate:["ms"],gridAutoColumns:["ms"],gridAutoRows:["ms"],gridAutoFlow:["ms"],grid:["ms"],gridRowStart:["ms"],gridColumnStart:["ms"],gridRowEnd:["ms"],gridRow:["ms"],gridColumn:["ms"],gridColumnEnd:["ms"],gridColumnGap:["ms"],gridRowGap:["ms"],gridArea:["ms"],gridGap:["ms"],textSizeAdjust:["Webkit","ms"],borderImage:["Webkit"],borderImageOutset:["Webkit"],borderImageRepeat:["Webkit"],borderImageSlice:["Webkit"],borderImageSource:["Webkit"],borderImageWidth:["Webkit"]}}},function(e,t,r){"use strict";function n(){if(s.length)throw s.shift()}function i(e){var t;t=u.length?u.pop():new o,t.task=e,a(t)}function o(){this.task=null}var a=r(8),u=[],s=[],f=a.makeRequestCallFromTimer(n);e.exports=i,o.prototype.call=function(){try{this.task.call()}catch(e){i.onerror?i.onerror(e):(s.push(e),f())}finally{this.task=null,u[u.length]=this}}},function(e,t){(function(t){"use strict";function r(e){u.length||(a(),s=!0),u[u.length]=e}function n(){for(;f<u.length;){var e=f;if(f+=1,u[e].call(),f>l){for(var t=0,r=u.length-f;t<r;t++)u[t]=u[t+f];u.length-=f,f=0}}u.length=0,f=0,s=!1}function i(e){var t=1,r=new d(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}function o(e){return function(){function t(){clearTimeout(r),clearInterval(n),e()}var r=setTimeout(t,0),n=setInterval(t,50)}}e.exports=r;var a,u=[],s=!1,f=0,l=1024,c="undefined"!=typeof t?t:self,d=c.MutationObserver||c.WebKitMutationObserver;a="function"==typeof d?i(n):o(n),r.requestFlush=a,r.makeRequestCallFromTimer=o}).call(t,function(){return this}())},function(e,t,r){"use strict";var n=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=r(2),a=r(11),u={create:function(e){return(0,o.mapObj)(e,function(e){var t=n(e,2),r=t[0],i=t[1];return[r,{_name:r+"_"+(0,o.hashObject)(i),_definition:i}]})},rehydrate:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];(0,a.addRenderedClassNames)(e)}},s={renderStatic:function(e){(0,a.reset)(),(0,a.startBuffering)();var t=e(),r=(0,a.flushToString)();return{html:t,css:{content:r,renderedClassNames:(0,a.getRenderedClassNames)()}}}},f={suppressStyleInjection:function(){(0,a.reset)(),(0,a.startBuffering)()},clearBufferAndResumeStyleInjection:function(){(0,a.reset)()}},l=function e(t,r){return{StyleSheet:i({},u,{extend:function(n){var i=n.map(function(e){return e.selectorHandler}).filter(function(e){return e});return e(t,r.concat(i))}}),StyleSheetServer:s,StyleSheetTestUtils:f,css:function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return(0,a.injectAndGetClassName)(t,n,r)}}};e.exports=l},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=r(3),o=r(9),a=n(o),u=!0;t.default=(0,a.default)(u,i.defaultSelectorHandlers),e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=r(7),o=n(i),a=r(3),u=r(2),s=null,f=function(e){if(null==s&&(s=document.querySelector("style[data-aphrodite]"),null==s)){var t=document.head||document.getElementsByTagName("head")[0];s=document.createElement("style"),s.type="text/css",s.setAttribute("data-aphrodite",""),t.appendChild(s)}s.styleSheet?s.styleSheet.cssText+=e:s.appendChild(document.createTextNode(e))},l={fontFamily:function e(t){return Array.isArray(t)?t.map(e).join(","):"object"==typeof t?(b(t.src,"@font-face",[t],!1),'"'+t.fontFamily+'"'):t},animationName:function e(t,r){if(Array.isArray(t))return t.map(function(t){return e(t,r)}).join(",");if("object"==typeof t){var n="keyframe_"+(0,u.hashObject)(t),i="@keyframes "+n+"{";return Object.keys(t).forEach(function(e){i+=(0,a.generateCSS)(e,[t[e]],r,l,!1)}),i+="}",p(n,i),n}return t}},c={},d="",m=!1,p=function(e,t){if(!c[e]){if(!m){if("undefined"==typeof document)throw new Error("Cannot automatically buffer without a document");m=!0,(0,o.default)(v)}d+=t,c[e]=!0}},b=function(e,t,r,n){var i=arguments.length<=4||void 0===arguments[4]?[]:arguments[4];if(!c[e]){var o=(0,a.generateCSS)(t,r,i,l,n);p(e,o)}};t.injectStyleOnce=b;var y=function(){d="",c={},m=!1,s=null};t.reset=y;var k=function(){if(m)throw new Error("Cannot buffer while already buffering");m=!0};t.startBuffering=k;var h=function(){m=!1;var e=d;return d="",e};t.flushToString=h;var v=function(){var e=h();e.length>0&&f(e)};t.flushToStyleTag=v;var g=function(){return Object.keys(c)};t.getRenderedClassNames=g;var W=function(e){e.forEach(function(e){c[e]=!0})};t.addRenderedClassNames=W;var x=function(e,t,r){t=(0,u.flattenDeep)(t);for(var n=[],i=[],o=0;o<t.length;o+=1)t[o]&&(n.push(t[o]._name),i.push(t[o]._definition));if(0===n.length)return"";var a=n.join("-o_O-");return b(a,"."+a,i,e,r),a};t.injectAndGetClassName=x},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return(0,a.default)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(13),a=n(o);e.exports=t.default},function(e,t){"use strict";function r(e){return e in o?o[e]:o[e]=e.replace(n,"-$&").toLowerCase().replace(i,"-ms-")}var n=/[A-Z]/g,i=/^ms-/,o={};e.exports=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){function t(e){for(var i in e){var o=e[i];if((0,d.default)(o))e[i]=t(o);else if(Array.isArray(o)){for(var u=[],f=0,c=o.length;f<c;++f){var m=(0,s.default)(n,i,o[f],e,r);(0,l.default)(u,m||o[f])}u.length>0&&(e[i]=u)}else{var p=(0,s.default)(n,i,o,e,r);p&&(e[i]=p),e=(0,a.default)(r,i,e)}}return e}var r=e.prefixMap,n=e.plugins;return t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(29),a=n(o),u=r(30),s=n(u),f=r(27),l=n(f),c=r(28),d=n(c);e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if("string"==typeof t&&!(0,a.default)(t)&&t.indexOf("calc(")>-1)return u.map(function(e){return t.replace(/calc\(/g,e+"calc(")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(1),a=n(o),u=["-webkit-","-moz-",""];e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if("string"==typeof t&&!(0,a.default)(t)&&t.indexOf("cross-fade(")>-1)return u.map(function(e){return t.replace(/cross-fade\(/g,e+"cross-fade(")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(1),a=n(o),u=["-webkit-",""];e.exports=t.default},function(e,t){"use strict";function r(e,t){if("cursor"===e&&i.hasOwnProperty(t))return n.map(function(e){return e+t})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n=["-webkit-","-moz-",""],i={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if("string"==typeof t&&!(0,a.default)(t)&&t.indexOf("filter(")>-1)return u.map(function(e){return t.replace(/filter\(/g,e+"filter(")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(1),a=n(o),u=["-webkit-",""];e.exports=t.default},function(e,t){"use strict";function r(e,t){if("display"===e&&n.hasOwnProperty(t))return["-webkit-box","-moz-box","-ms-"+t+"box","-webkit-"+t,t]}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n={flex:!0,"inline-flex":!0};e.exports=t.default},function(e,t){"use strict";function r(e,t,r){i.hasOwnProperty(e)&&(r[i[e]]=n[t]||t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n={"space-around":"distribute","space-between":"justify","flex-start":"start","flex-end":"end"},i={alignContent:"msFlexLinePack",alignSelf:"msFlexItemAlign",alignItems:"msFlexAlign",justifyContent:"msFlexPack",order:"msFlexOrder",flexGrow:"msFlexPositive",flexShrink:"msFlexNegative",flexBasis:"msPreferredSize"};e.exports=t.default},function(e,t){"use strict";function r(e,t,r){"flexDirection"===e&&"string"==typeof t&&(t.indexOf("column")>-1?r.WebkitBoxOrient="vertical":r.WebkitBoxOrient="horizontal",t.indexOf("reverse")>-1?r.WebkitBoxDirection="reverse":r.WebkitBoxDirection="normal"),i.hasOwnProperty(e)&&(r[i[e]]=n[t]||t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n={"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"},i={alignItems:"WebkitBoxAlign",justifyContent:"WebkitBoxPack",flexWrap:"WebkitBoxLines"};e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if("string"==typeof t&&!(0,a.default)(t)&&s.test(t))return u.map(function(e){return e+t})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(1),a=n(o),u=["-webkit-","-moz-",""],s=/linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if("string"==typeof t&&!(0,a.default)(t)&&t.indexOf("image-set(")>-1)return u.map(function(e){return t.replace(/image-set\(/g,e+"image-set(")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(1),a=n(o),u=["-webkit-",""];e.exports=t.default},function(e,t){"use strict";function r(e,t){if("position"===e&&"sticky"===t)return["-webkit-sticky","sticky"]}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t){"use strict";function r(e,t){if(i.hasOwnProperty(e)&&o.hasOwnProperty(t))return n.map(function(e){return e+t})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n=["-webkit-","-moz-",""],i={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},o={"min-content":!0,"max-content":!0,"fill-available":!0,"fit-content":!0,"contain-floats":!0};e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if((0,f.default)(e))return e;for(var r=e.split(/,(?![^()]*(?:\([^()]*\))?\))/g),n=0,i=r.length;n<i;++n){var o=r[n],a=[o];for(var s in t){var l=(0,u.default)(s);if(o.indexOf(l)>-1&&"order"!==l)for(var c=t[s],d=0,p=c.length;d<p;++d)a.unshift(o.replace(l,m[c[d]]+l))}r[n]=a.join(",")}return r.join(",")}function o(e,t,r,n){if("string"==typeof t&&d.hasOwnProperty(e)){var o=i(t,n),a=o.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(e){return!/-moz-|-ms-/.test(e)}).join(",");if(e.indexOf("Webkit")>-1)return a;var u=o.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(e){return!/-webkit-|-ms-/.test(e)}).join(",");return e.indexOf("Moz")>-1?u:(r["Webkit"+(0,c.default)(e)]=a,r["Moz"+(0,c.default)(e)]=u,o)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var a=r(12),u=n(a),s=r(1),f=n(s),l=r(5),c=n(l),d={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0,MozTransition:!0,MozTransitionProperty:!0},m={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-"};e.exports=t.default},function(e,t){"use strict";function r(e,t){e.indexOf(t)===-1&&e.push(t)}function n(e,t){if(Array.isArray(t))for(var n=0,i=t.length;n<i;++n)r(e,t[n]);else r(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t){"use strict";function r(e){return e instanceof Object&&!Array.isArray(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t,r){if(!e.hasOwnProperty(t))return r;var n={};return Object.keys(r).forEach(function(i){if(i===t)for(var o=e[t],u=0,s=o.length;u<s;++u)n[o[u]+(0,a.default)(t)]=r[t];n[i]=r[i]}),n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(5),a=n(o);e.exports=t.default},function(e,t){"use strict";function r(e,t,r,n,i){for(var o=0,a=e.length;o<a;++o){var u=e[o](t,r,n,i);if(u)return u}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t){"use strict";function r(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0}e.exports=r}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.aphrodite=t():e.aphrodite=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(10)},function(e,t){"use strict";function r(e){return"string"==typeof e&&n.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n=/-webkit-|-moz-|-ms-/;e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=r(31),u=n(a),s=function(e,t){for(var r=Object.keys(e),n={},i=0;i<r.length;i+=1){var a=t([r[i],e[r[i]]]),u=o(a,2),s=u[0],f=u[1];n[s]=f}return n};t.mapObj=s;var f=/([A-Z])/g,l=function(e){return"-"+e.toLowerCase()},c=function(e){var t=e.replace(f,l);return"m"===t[0]&&"s"===t[1]&&"-"===t[2]?"-"+t:t};t.kebabifyStyleName=c;var d={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},m=["Webkit","ms","Moz","O"];Object.keys(d).forEach(function(e){m.forEach(function(t){d[i(t,e)]=d[e]})});var p=function(e,t){return"number"==typeof t?d[e]?""+t:t+"px":""+t};t.stringifyValue=p;var b=function(e,t){return y(p(e,t))};t.stringifyAndImportantifyValue=b;var k=function(e){return(0,u.default)(JSON.stringify(e)).toString(36)};t.hashObject=k;var y=function(e){return"!"===e[e.length-10]&&" !important"===e.slice(-11)?e:e+" !important"}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=r(14),a=n(o),u=r(6),s=n(u),f=r(4),l=n(f),c=r(2),d=(0,a.default)(s.default),m=[function(e,t,r){return":"!==e[0]?null:r(t+e)},function(e,t,r){if("@"!==e[0])return null;var n=r(t);return e+"{"+n+"}"}];t.defaultSelectorHandlers=m;var p=function e(t,r,n,i,o){for(var a=new l.default,u=0;u<r.length;u++)a.addStyleType(r[u]);var s=new l.default,f="";return a.forEach(function(r,a){var u=n.some(function(u){var s=u(a,t,function(t){return e(t,[r],n,i,o)});if(null!=s)return f+=s,!0});u||s.set(a,r)}),y(t,s,i,o,n)+f};t.generateCSS=p;var b=function(e,t,r){if(!t)return e;for(var n=Object.keys(t),i=0;i<n.length;i++){var o=n[i];e.has(o)&&e.set(o,t[o](e.get(o),r))}return e},k=function(e,t,r){return(0,c.kebabifyStyleName)(e)+":"+r(e,t)+";"},y=function(e,t,r,n,o){b(t,r,o);var a=i({},t.elements),u=d(t.elements),s=Object.keys(u);if(s.length!==t.keyOrder.length)for(var f=0;f<s.length;f++)if(!a.hasOwnProperty(s[f])){var l=void 0;if(l="W"===s[f][0]?s[f][6].toLowerCase()+s[f].slice(7):"o"===s[f][1]?s[f][3].toLowerCase()+s[f].slice(4):s[f][2].toLowerCase()+s[f].slice(3),l&&a.hasOwnProperty(l)){var m=t.keyOrder.indexOf(l);t.keyOrder.splice(m,0,s[f])}else t.keyOrder.unshift(s[f])}for(var p=n===!1?c.stringifyValue:c.stringifyAndImportantifyValue,y=[],f=0;f<t.keyOrder.length;f++){var h=t.keyOrder[f],v=u[h];if(Array.isArray(v))for(var g=0;g<v.length;g++)y.push(k(h,v[g],p));else y.push(k(h,v,p))}return y.length?e+"{"+y.join("")+"}":""};t.generateCSSRuleset=y},function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i="undefined"!=typeof Map,o=function(){function e(){r(this,e),this.elements={},this.keyOrder=[]}return n(e,[{key:"forEach",value:function(e){for(var t=0;t<this.keyOrder.length;t++)e(this.elements[this.keyOrder[t]],this.keyOrder[t])}},{key:"set",value:function(t,r){var n=this;if(this.elements.hasOwnProperty(t)||this.keyOrder.push(t),null==r)return void(this.elements[t]=r);if(i&&r instanceof Map||r instanceof e){var o=function(){var i=n.elements.hasOwnProperty(t)?n.elements[t]:new e;return r.forEach(function(e,t){i.set(t,e)}),n.elements[t]=i,{v:void 0}}();if("object"==typeof o)return o.v}if(!Array.isArray(r)&&"object"==typeof r){for(var a=this.elements.hasOwnProperty(t)?this.elements[t]:new e,u=Object.keys(r),s=0;s<u.length;s+=1)a.set(u[s],r[u[s]]);return void(this.elements[t]=a)}this.elements[t]=r}},{key:"get",value:function(e){return this.elements[e]}},{key:"has",value:function(e){return this.elements.hasOwnProperty(e)}},{key:"addStyleType",value:function(t){var r=this;if(i&&t instanceof Map||t instanceof e)t.forEach(function(e,t){r.set(t,e)});else for(var n=Object.keys(t),o=0;o<n.length;o++)this.set(n[o],t[n[o]])}}]),e}();t.default=o,e.exports=t.default},function(e,t){"use strict";function r(e){return e.charAt(0).toUpperCase()+e.slice(1)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,r){var n=r(15),i=r(16),o=r(17),a=r(18),u=r(19),s=r(20),f=r(21),l=r(22),c=r(23),d=r(24),m=r(25),p=r(26);e.exports={plugins:[n,i,o,a,u,s,f,l,c,d,m,p],prefixMap:{transform:["Webkit","ms"],transformOrigin:["Webkit","ms"],transformOriginX:["Webkit","ms"],transformOriginY:["Webkit","ms"],backfaceVisibility:["Webkit"],perspective:["Webkit"],perspectiveOrigin:["Webkit"],transformStyle:["Webkit"],transformOriginZ:["Webkit"],animation:["Webkit"],animationDelay:["Webkit"],animationDirection:["Webkit"],animationFillMode:["Webkit"],animationDuration:["Webkit"],animationIterationCount:["Webkit"],animationName:["Webkit"],animationPlayState:["Webkit"],animationTimingFunction:["Webkit"],appearance:["Webkit","Moz"],userSelect:["Webkit","Moz","ms"],fontKerning:["Webkit"],textEmphasisPosition:["Webkit"],textEmphasis:["Webkit"],textEmphasisStyle:["Webkit"],textEmphasisColor:["Webkit"],boxDecorationBreak:["Webkit"],clipPath:["Webkit"],maskImage:["Webkit"],maskMode:["Webkit"],maskRepeat:["Webkit"],maskPosition:["Webkit"],maskClip:["Webkit"],maskOrigin:["Webkit"],maskSize:["Webkit"],maskComposite:["Webkit"],mask:["Webkit"],maskBorderSource:["Webkit"],maskBorderMode:["Webkit"],maskBorderSlice:["Webkit"],maskBorderWidth:["Webkit"],maskBorderOutset:["Webkit"],maskBorderRepeat:["Webkit"],maskBorder:["Webkit"],maskType:["Webkit"],textDecorationStyle:["Webkit","Moz"],textDecorationSkip:["Webkit","Moz"],textDecorationLine:["Webkit","Moz"],textDecorationColor:["Webkit","Moz"],filter:["Webkit"],fontFeatureSettings:["Webkit","Moz"],breakAfter:["Webkit","Moz","ms"],breakBefore:["Webkit","Moz","ms"],breakInside:["Webkit","Moz","ms"],columnCount:["Webkit","Moz"],columnFill:["Webkit","Moz"],columnGap:["Webkit","Moz"],columnRule:["Webkit","Moz"],columnRuleColor:["Webkit","Moz"],columnRuleStyle:["Webkit","Moz"],columnRuleWidth:["Webkit","Moz"],columns:["Webkit","Moz"],columnSpan:["Webkit","Moz"],columnWidth:["Webkit","Moz"],flex:["Webkit","ms"],flexBasis:["Webkit"],flexDirection:["Webkit","ms"],flexGrow:["Webkit"],flexFlow:["Webkit","ms"],flexShrink:["Webkit"],flexWrap:["Webkit","ms"],alignContent:["Webkit"],alignItems:["Webkit"],alignSelf:["Webkit"],justifyContent:["Webkit"],order:["Webkit"],transitionDelay:["Webkit"],transitionDuration:["Webkit"],transitionProperty:["Webkit"],transitionTimingFunction:["Webkit"],backdropFilter:["Webkit"],scrollSnapType:["Webkit","ms"],scrollSnapPointsX:["Webkit","ms"],scrollSnapPointsY:["Webkit","ms"],scrollSnapDestination:["Webkit","ms"],scrollSnapCoordinate:["Webkit","ms"],shapeImageThreshold:["Webkit"],shapeImageMargin:["Webkit"],shapeImageOutside:["Webkit"],hyphens:["Webkit","Moz","ms"],flowInto:["Webkit","ms"],flowFrom:["Webkit","ms"],regionFragment:["Webkit","ms"],boxSizing:["Moz"],textAlignLast:["Moz"],tabSize:["Moz"],wrapFlow:["ms"],wrapThrough:["ms"],wrapMargin:["ms"],touchAction:["ms"],gridTemplateColumns:["ms"],gridTemplateRows:["ms"],gridTemplateAreas:["ms"],gridTemplate:["ms"],gridAutoColumns:["ms"],gridAutoRows:["ms"],gridAutoFlow:["ms"],grid:["ms"],gridRowStart:["ms"],gridColumnStart:["ms"],gridRowEnd:["ms"],gridRow:["ms"],gridColumn:["ms"],gridColumnEnd:["ms"],gridColumnGap:["ms"],gridRowGap:["ms"],gridArea:["ms"],gridGap:["ms"],textSizeAdjust:["Webkit","ms"],borderImage:["Webkit"],borderImageOutset:["Webkit"],borderImageRepeat:["Webkit"],borderImageSlice:["Webkit"],borderImageSource:["Webkit"],borderImageWidth:["Webkit"]}}},function(e,t,r){"use strict";function n(){if(s.length)throw s.shift()}function i(e){var t;t=u.length?u.pop():new o,t.task=e,a(t)}function o(){this.task=null}var a=r(8),u=[],s=[],f=a.makeRequestCallFromTimer(n);e.exports=i,o.prototype.call=function(){try{this.task.call()}catch(e){i.onerror?i.onerror(e):(s.push(e),f())}finally{this.task=null,u[u.length]=this}}},function(e,t){(function(t){"use strict";function r(e){u.length||(a(),s=!0),u[u.length]=e}function n(){for(;f<u.length;){var e=f;if(f+=1,u[e].call(),f>l){for(var t=0,r=u.length-f;t<r;t++)u[t]=u[t+f];u.length-=f,f=0}}u.length=0,f=0,s=!1}function i(e){var t=1,r=new d(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}function o(e){return function(){function t(){clearTimeout(r),clearInterval(n),e()}var r=setTimeout(t,0),n=setInterval(t,50)}}e.exports=r;var a,u=[],s=!1,f=0,l=1024,c="undefined"!=typeof t?t:self,d=c.MutationObserver||c.WebKitMutationObserver;a="function"==typeof d?i(n):o(n),r.requestFlush=a,r.makeRequestCallFromTimer=o}).call(t,function(){return this}())},function(e,t,r){"use strict";var n=function(){function e(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=r(2),a=r(11),u={create:function(e){return(0,o.mapObj)(e,function(e){var t=n(e,2),r=t[0],i=t[1];return[r,{_name:r+"_"+(0,o.hashObject)(i),_definition:i}]})},rehydrate:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];(0,a.addRenderedClassNames)(e)}},s={renderStatic:function(e){(0,a.reset)(),(0,a.startBuffering)();var t=e(),r=(0,a.flushToString)();return{html:t,css:{content:r,renderedClassNames:(0,a.getRenderedClassNames)()}}}},f={suppressStyleInjection:function(){(0,a.reset)(),(0,a.startBuffering)()},clearBufferAndResumeStyleInjection:function(){(0,a.reset)()}},l=function e(t,r){return{StyleSheet:i({},u,{extend:function(n){var i=n.map(function(e){return e.selectorHandler}).filter(function(e){return e});return e(t,r.concat(i))}}),StyleSheetServer:s,StyleSheetTestUtils:f,css:function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return(0,a.injectAndGetClassName)(t,n,r)}}};e.exports=l},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=r(3),o=r(9),a=n(o),u=!0;t.default=(0,a.default)(u,i.defaultSelectorHandlers),e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=r(7),o=n(i),a=r(4),u=n(a),s=r(3),f=r(2),l=null,c=function(e){if(null==l&&(l=document.querySelector("style[data-aphrodite]"),null==l)){var t=document.head||document.getElementsByTagName("head")[0];l=document.createElement("style"),l.type="text/css",l.setAttribute("data-aphrodite",""),t.appendChild(l)}l.styleSheet?l.styleSheet.cssText+=e:l.appendChild(document.createTextNode(e))},d={fontFamily:function e(t){return Array.isArray(t)?t.map(e).join(","):"object"==typeof t?(y(t.src,"@font-face",[t],!1),'"'+t.fontFamily+'"'):t},animationName:function e(t,r){if(Array.isArray(t))return t.map(function(t){return e(t,r)}).join(",");if("object"==typeof t){var n="keyframe_"+(0,f.hashObject)(t),i="@keyframes "+n+"{";return t instanceof u.default?t.forEach(function(e,t){i+=(0,s.generateCSS)(t,[e],r,d,!1)}):Object.keys(t).forEach(function(e){i+=(0,s.generateCSS)(e,[t[e]],r,d,!1)}),i+="}",k(n,i),n}return t}},m={},p="",b=!1,k=function(e,t){if(!m[e]){if(!b){if("undefined"==typeof document)throw new Error("Cannot automatically buffer without a document");b=!0,(0,o.default)(W)}p+=t,m[e]=!0}},y=function(e,t,r,n){var i=arguments.length<=4||void 0===arguments[4]?[]:arguments[4];if(!m[e]){var o=(0,s.generateCSS)(t,r,i,d,n);k(e,o)}};t.injectStyleOnce=y;var h=function(){p="",m={},b=!1,l=null};t.reset=h;var v=function(){if(b)throw new Error("Cannot buffer while already buffering");b=!0};t.startBuffering=v;var g=function(){b=!1;var e=p;return p="",e};t.flushToString=g;var W=function(){var e=g();e.length>0&&c(e)};t.flushToStyleTag=W;var x=function(){return Object.keys(m)};t.getRenderedClassNames=x;var O=function(e){e.forEach(function(e){m[e]=!0})};t.addRenderedClassNames=O;var _=function e(t,r){for(var n=0;n<t.length;n+=1)t[n]&&(Array.isArray(t[n])?e(t[n],r):(r.classNameBits.push(t[n]._name),r.definitionBits.push(t[n]._definition)))},w=function(e,t,r){var n={classNameBits:[],definitionBits:[]};if(_(t,n),0===n.classNameBits.length)return"";var i=n.classNameBits.join("-o_O-");return y(i,"."+i,n.definitionBits,e,r),i};t.injectAndGetClassName=w},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){return(0,a.default)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(13),a=n(o);e.exports=t.default},function(e,t){"use strict";function r(e){return e in o?o[e]:o[e]=e.replace(n,"-$&").toLowerCase().replace(i,"-ms-")}var n=/[A-Z]/g,i=/^ms-/,o={};e.exports=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){function t(e){for(var i in e){var o=e[i];if((0,d.default)(o))e[i]=t(o);else if(Array.isArray(o)){for(var u=[],f=0,c=o.length;f<c;++f){var m=(0,s.default)(n,i,o[f],e,r);(0,l.default)(u,m||o[f])}u.length>0&&(e[i]=u)}else{var p=(0,s.default)(n,i,o,e,r);p&&(e[i]=p),(0,a.default)(r,i,e)}}return e}var r=e.prefixMap,n=e.plugins;return t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(29),a=n(o),u=r(30),s=n(u),f=r(27),l=n(f),c=r(28),d=n(c);e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if("string"==typeof t&&!(0,a.default)(t)&&t.indexOf("calc(")>-1)return u.map(function(e){return t.replace(/calc\(/g,e+"calc(")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(1),a=n(o),u=["-webkit-","-moz-",""];e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if("string"==typeof t&&!(0,a.default)(t)&&t.indexOf("cross-fade(")>-1)return u.map(function(e){return t.replace(/cross-fade\(/g,e+"cross-fade(")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(1),a=n(o),u=["-webkit-",""];e.exports=t.default},function(e,t){"use strict";function r(e,t){if("cursor"===e&&i.hasOwnProperty(t))return n.map(function(e){return e+t})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n=["-webkit-","-moz-",""],i={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if("string"==typeof t&&!(0,a.default)(t)&&t.indexOf("filter(")>-1)return u.map(function(e){return t.replace(/filter\(/g,e+"filter(")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(1),a=n(o),u=["-webkit-",""];e.exports=t.default},function(e,t){"use strict";function r(e,t){if("display"===e&&n.hasOwnProperty(t))return["-webkit-box","-moz-box","-ms-"+t+"box","-webkit-"+t,t]}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n={flex:!0,"inline-flex":!0};e.exports=t.default},function(e,t){"use strict";function r(e,t,r){i.hasOwnProperty(e)&&(r[i[e]]=n[t]||t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n={"space-around":"distribute","space-between":"justify","flex-start":"start","flex-end":"end"},i={alignContent:"msFlexLinePack",alignSelf:"msFlexItemAlign",alignItems:"msFlexAlign",justifyContent:"msFlexPack",order:"msFlexOrder",flexGrow:"msFlexPositive",flexShrink:"msFlexNegative",flexBasis:"msPreferredSize"};e.exports=t.default},function(e,t){"use strict";function r(e,t,r){"flexDirection"===e&&"string"==typeof t&&(t.indexOf("column")>-1?r.WebkitBoxOrient="vertical":r.WebkitBoxOrient="horizontal",t.indexOf("reverse")>-1?r.WebkitBoxDirection="reverse":r.WebkitBoxDirection="normal"),i.hasOwnProperty(e)&&(r[i[e]]=n[t]||t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n={"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"},i={alignItems:"WebkitBoxAlign",justifyContent:"WebkitBoxPack",flexWrap:"WebkitBoxLines"};e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if("string"==typeof t&&!(0,a.default)(t)&&s.test(t))return u.map(function(e){return e+t})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(1),a=n(o),u=["-webkit-","-moz-",""],s=/linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if("string"==typeof t&&!(0,a.default)(t)&&t.indexOf("image-set(")>-1)return u.map(function(e){return t.replace(/image-set\(/g,e+"image-set(")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(1),a=n(o),u=["-webkit-",""];e.exports=t.default},function(e,t){"use strict";function r(e,t){if("position"===e&&"sticky"===t)return["-webkit-sticky","sticky"]}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t){"use strict";function r(e,t){if(i.hasOwnProperty(e)&&o.hasOwnProperty(t))return n.map(function(e){return e+t})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n=["-webkit-","-moz-",""],i={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},o={"min-content":!0,"max-content":!0,"fill-available":!0,"fit-content":!0,"contain-floats":!0};e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if((0,f.default)(e))return e;for(var r=e.split(/,(?![^()]*(?:\([^()]*\))?\))/g),n=0,i=r.length;n<i;++n){var o=r[n],a=[o];for(var s in t){var l=(0,u.default)(s);if(o.indexOf(l)>-1&&"order"!==l)for(var c=t[s],d=0,p=c.length;d<p;++d)a.unshift(o.replace(l,m[c[d]]+l))}r[n]=a.join(",")}return r.join(",")}function o(e,t,r,n){if("string"==typeof t&&d.hasOwnProperty(e)){var o=i(t,n),a=o.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(e){return!/-moz-|-ms-/.test(e)}).join(",");if(e.indexOf("Webkit")>-1)return a;var u=o.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(e){return!/-webkit-|-ms-/.test(e)}).join(",");return e.indexOf("Moz")>-1?u:(r["Webkit"+(0,c.default)(e)]=a,r["Moz"+(0,c.default)(e)]=u,o)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var a=r(12),u=n(a),s=r(1),f=n(s),l=r(5),c=n(l),d={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0,MozTransition:!0,MozTransitionProperty:!0},m={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-"};e.exports=t.default},function(e,t){"use strict";function r(e,t){e.indexOf(t)===-1&&e.push(t)}function n(e,t){if(Array.isArray(t))for(var n=0,i=t.length;n<i;++n)r(e,t[n]);else r(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,e.exports=t.default},function(e,t){"use strict";function r(e){return e instanceof Object&&!Array.isArray(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t,r){if(e.hasOwnProperty(t))for(var n=e[t],i=0,o=n.length;i<o;++i)r[n[i]+(0,a.default)(t)]=r[t]}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(5),a=n(o);e.exports=t.default},function(e,t){"use strict";function r(e,t,r,n,i){for(var o=0,a=e.length;o<a;++o){var u=e[o](t,r,n,i);if(u)return u}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t){"use strict";function r(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0}e.exports=r}])});
//# sourceMappingURL=aphrodite.umd.min.js.map
module.exports = {
output: {
path: __dirname + '/',
filename: 'bundle.js'
},
entry: [
'./src/examples'
],
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/
}]
}
output: {
path: __dirname + '/',
filename: 'bundle.js'
},
entry: [
'./src/examples'
],
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/
}]
}
}

@@ -7,4 +7,2 @@ 'use strict';

var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

@@ -164,4 +162,8 @@

) /* : string */{
var merged /* : OrderedElements */ = styleTypes.reduce(_util.recursiveMerge, new _orderedElements2['default']());
var merged = new _orderedElements2['default']();
for (var i = 0; i < styleTypes.length; i++) {
merged.addStyleType(styleTypes[i]);
}
var plainDeclarations = new _orderedElements2['default']();

@@ -171,3 +173,3 @@ var generatedStyles = "";

// TODO(emily): benchmark this to see if a plain for loop would be faster.
merged.forEach(function (key, val) {
merged.forEach(function (val, key) {
// For each key, see if one of the selector handlers will handle these

@@ -206,8 +208,15 @@ // styles.

selectorHandlers /* : SelectorHandler[] */
) /* */{
var hasStringHandlers = !!stringHandlers;
return declarations.map(function (key, val) {
// If a handler exists for this particular key, let it interpret
// that value first before continuing
if (hasStringHandlers && stringHandlers.hasOwnProperty(key)) {
) /* : OrderedElements */{
if (!stringHandlers) {
return declarations;
}
var stringHandlerKeys = Object.keys(stringHandlers);
for (var i = 0; i < stringHandlerKeys.length; i++) {
var key = stringHandlerKeys[i];
if (declarations.has(key)) {
// A declaration exists for this particular string handler, so we
// need to let the string handler interpret the declaration first
// before proceeding.
//
// TODO(emily): Pass in a callback which generates CSS, similar to

@@ -218,9 +227,17 @@ // how our selector handlers work, instead of passing in

// handlers are very specialized and do complex things.
return stringHandlers[key](val, selectorHandlers);
} else {
return val;
declarations.set(key, stringHandlers[key](declarations.get(key), selectorHandlers));
}
});
}
return declarations;
};
var transformRule = function transformRule(key, /* : string */
value, /* : string */
transformValue /* : function */
) {
return (/* : string */(0, _util.kebabifyStyleName)(key) + ':' + transformValue(key, value) + ';'
);
};
/**

@@ -263,15 +280,58 @@ * Generate a CSS ruleset with the selector and containing the declarations.

) /* : string */{
var handledDeclarations /* : OrderedElements */ = runStringHandlers(declarations, stringHandlers, selectorHandlers);
// Mutates declarations
runStringHandlers(declarations, stringHandlers, selectorHandlers);
var originalElements = _extends({}, handledDeclarations.elements);
var originalElements = _extends({}, declarations.elements);
// NOTE(emily): This mutates handledDeclarations.elements.
var prefixedDeclarations = prefixAll(handledDeclarations.elements);
var prefixedElements = prefixAll(declarations.elements);
var prefixedRules = (0, _util.flatten)((0, _util.objectToPairs)(prefixedDeclarations).map(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2);
var elementNames = Object.keys(prefixedElements);
if (elementNames.length !== declarations.keyOrder.length) {
// There are some prefixed values, so we need to figure out how to sort
// them.
//
// Loop through prefixedElements, looking for anything that is not in
// sortOrder, which means it was added by prefixAll. This means that we
// need to figure out where it should appear in the sortOrder.
for (var i = 0; i < elementNames.length; i++) {
if (!originalElements.hasOwnProperty(elementNames[i])) {
// This element is not in the sortOrder, which means it is a prefixed
// value that was added by prefixAll. Let's try to figure out where it
// goes.
var originalStyle = undefined;
if (elementNames[i][0] === 'W') {
// This is a Webkit-prefixed style, like "WebkitTransition". Let's
// find its original style's sort order.
originalStyle = elementNames[i][6].toLowerCase() + elementNames[i].slice(7);
} else if (elementNames[i][1] === 'o') {
// This is a Moz-prefixed style, like "MozTransition". We check
// the second character to avoid colliding with Ms-prefixed
// styles. Let's find its original style's sort order.
originalStyle = elementNames[i][3].toLowerCase() + elementNames[i].slice(4);
} else {
// if (elementNames[i][1] === 's') {
// This is a Ms-prefixed style, like "MsTransition".
originalStyle = elementNames[i][2].toLowerCase() + elementNames[i].slice(3);
}
var key = _ref2[0];
var value = _ref2[1];
if (originalStyle && originalElements.hasOwnProperty(originalStyle)) {
var originalIndex = declarations.keyOrder.indexOf(originalStyle);
declarations.keyOrder.splice(originalIndex, 0, elementNames[i]);
} else {
// We don't know what the original style was, so sort it to
// top. This can happen for styles that are added that don't
// have the same base name as the original style.
declarations.keyOrder.unshift(elementNames[i]);
}
}
}
}
var transformValue = useImportant === false ? _util.stringifyValue : _util.stringifyAndImportantifyValue;
var rules = [];
for (var i = 0; i < declarations.keyOrder.length; i++) {
var key = declarations.keyOrder[i];
var value = prefixedElements[key];
if (Array.isArray(value)) {

@@ -281,75 +341,12 @@ // inline-style-prefixer returns an array when there should be

// pairs with the same key.
return value.map(function (v) {
return [key, v];
});
}
return [[key, value]];
}));
// Calculate the order that we want to each element in `prefixedRules` to
// be in, based on its index in the original key ordering.
var sortOrder = {};
for (var i = 0; i < handledDeclarations.keyOrder.length; i++) {
var key = handledDeclarations.keyOrder[i];
sortOrder[key] = i;
// In order to keep most prefixed versions of keys in about the same
// order that the original keys were in but placed before the
// unprefixed version, we generate the prefixed forms of the keys and
// set their order to the same as the original key minus a little bit.
var capitalizedKey = '' + key[0].toUpperCase() + key.slice(1);
var prefixedKeys = ['Webkit' + capitalizedKey, 'Moz' + capitalizedKey, 'ms' + capitalizedKey];
for (var j = 0; j < prefixedKeys.length; ++j) {
if (!originalElements.hasOwnProperty(prefixedKeys[j])) {
sortOrder[prefixedKeys[j]] = i - 0.5;
originalElements[prefixedKeys[j]] = originalElements[key];
for (var j = 0; j < value.length; j++) {
rules.push(transformRule(key, value[j], transformValue));
}
}
}
// Calculate the sort order of a given property.
function sortOrderForProperty(_ref3) {
var _ref32 = _slicedToArray(_ref3, 2);
var key = _ref32[0];
var value = _ref32[1];
if (sortOrder.hasOwnProperty(key)) {
if (originalElements.hasOwnProperty(key) && originalElements[key] !== value) {
// The value is prefixed. Sort this just before the key with
// the unprefixed value.
return sortOrder[key] - 0.25;
} else {
// Either the key and value are unprefixed here, or this is a
// prefixed key. Either way, this is handled by the sortOrder
// calculation above.
return sortOrder[key];
}
} else {
// If the property isn't in the sort order, it wasn't in the
// original set of unprefixed keys, so it must be a prefixed key.
// Sort at order -1 to put it at the top of the set of styles.
return -1;
rules.push(transformRule(key, value, transformValue));
}
}
// Actually sort the rules according to the sort order.
prefixedRules.sort(function (a, b) {
return sortOrderForProperty(a) - sortOrderForProperty(b);
});
var transformValue = useImportant === false ? _util.stringifyValue : function (key, value) {
return (0, _util.importantify)((0, _util.stringifyValue)(key, value));
};
var rules = prefixedRules.map(function (_ref4) {
var _ref42 = _slicedToArray(_ref4, 2);
var key = _ref42[0];
var value = _ref42[1];
return (0, _util.kebabifyStyleName)(key) + ':' + transformValue(key, value) + ';';
}).join("");
if (rules) {
return selector + '{' + rules + '}';
if (rules.length) {
return selector + '{' + rules.join("") + '}';
} else {

@@ -356,0 +353,0 @@ return "";

@@ -13,2 +13,6 @@ 'use strict';

var _orderedElements = require('./ordered-elements');
var _orderedElements2 = _interopRequireDefault(_orderedElements);
var _generate = require('./generate');

@@ -22,2 +26,6 @@

import type { SelectorHandler } from './generate.js';
type ProcessedStyleDefinitions = {
classNameBits: Array<string>,
definitionBits: Array<Object>,
};
*/

@@ -115,5 +123,17 @@

var finalVal = '@keyframes ' + _name + '{';
Object.keys(val).forEach(function (key) {
finalVal += (0, _generate.generateCSS)(key, [val[key]], selectorHandlers, stringHandlers, false);
});
// TODO see if we can find a way where checking for OrderedElements
// here is not necessary. Alternatively, perhaps we should have a
// utility method that can iterate over either a plain object, an
// instance of OrderedElements, or a Map, and then use that here and
// elsewhere.
if (val instanceof _orderedElements2['default']) {
val.forEach(function (valVal, valKey) {
finalVal += (0, _generate.generateCSS)(valKey, [valVal], selectorHandlers, stringHandlers, false);
});
} else {
Object.keys(val).forEach(function (key) {
finalVal += (0, _generate.generateCSS)(key, [val[key]], selectorHandlers, stringHandlers, false);
});
}
finalVal += '}';

@@ -143,19 +163,21 @@

var injectGeneratedCSSOnce = function injectGeneratedCSSOnce(key, generatedCSS) {
if (!alreadyInjected[key]) {
if (!isBuffering) {
// We should never be automatically buffering on the server (or any
// place without a document), so guard against that.
if (typeof document === "undefined") {
throw new Error("Cannot automatically buffer without a document");
}
if (alreadyInjected[key]) {
return;
}
// If we're not already buffering, schedule a call to flush the
// current styles.
isBuffering = true;
(0, _asap2['default'])(flushToStyleTag);
if (!isBuffering) {
// We should never be automatically buffering on the server (or any
// place without a document), so guard against that.
if (typeof document === "undefined") {
throw new Error("Cannot automatically buffer without a document");
}
injectionBuffer += generatedCSS;
alreadyInjected[key] = true;
// If we're not already buffering, schedule a call to flush the
// current styles.
isBuffering = true;
(0, _asap2['default'])(flushToStyleTag);
}
injectionBuffer += generatedCSS;
alreadyInjected[key] = true;
};

@@ -170,7 +192,9 @@

if (!alreadyInjected[key]) {
var generated = (0, _generate.generateCSS)(selector, definitions, selectorHandlers, stringHandlers, useImportant);
if (alreadyInjected[key]) {
return;
}
injectGeneratedCSSOnce(key, generated);
}
var generated = (0, _generate.generateCSS)(selector, definitions, selectorHandlers, stringHandlers, useImportant);
injectGeneratedCSSOnce(key, generated);
};

@@ -223,2 +247,20 @@

exports.addRenderedClassNames = addRenderedClassNames;
var processStyleDefinitions = function processStyleDefinitions(styleDefinitions, /* : any[] */
result /* : ProcessedStyleDefinitions */
) /* : void */{
for (var i = 0; i < styleDefinitions.length; i += 1) {
// Filter out falsy values from the input, to allow for
// `css(a, test && c)`
if (styleDefinitions[i]) {
if (Array.isArray(styleDefinitions[i])) {
// We've encountered an array, so let's recurse
processStyleDefinitions(styleDefinitions[i], result);
} else {
result.classNameBits.push(styleDefinitions[i]._name);
result.definitionBits.push(styleDefinitions[i]._definition);
}
}
}
};
/**

@@ -238,21 +280,16 @@ * Inject styles associated with the passed style definition objects, and return

) /* : string */{
styleDefinitions = (0, _util.flattenDeep)(styleDefinitions);
var processedStyleDefinitions /* : ProcessedStyleDefinitions */ = {
classNameBits: [],
definitionBits: []
};
// Mutates processedStyleDefinitions
processStyleDefinitions(styleDefinitions, processedStyleDefinitions);
var classNameBits = [];
var definitionBits = [];
for (var i = 0; i < styleDefinitions.length; i += 1) {
// Filter out falsy values from the input, to allow for
// `css(a, test && c)`
if (styleDefinitions[i]) {
classNameBits.push(styleDefinitions[i]._name);
definitionBits.push(styleDefinitions[i]._definition);
}
}
// Break if there aren't any valid styles.
if (classNameBits.length === 0) {
if (processedStyleDefinitions.classNameBits.length === 0) {
return "";
}
var className = classNameBits.join("-o_O-");
var className = processedStyleDefinitions.classNameBits.join("-o_O-");
injectStyleOnce(className, '.' + className, definitionBits, useImportant, selectorHandlers);
injectStyleOnce(className, '.' + className, processedStyleDefinitions.definitionBits, useImportant, selectorHandlers);

@@ -259,0 +296,0 @@ return className;

@@ -0,15 +1,12 @@

'use strict';
/* global Map */
"use strict";
Object.defineProperty(exports, "__esModule", {
Object.defineProperty(exports, '__esModule', {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var MAP_EXISTS = typeof Map !== 'undefined';

@@ -20,44 +17,66 @@ var OrderedElements = (function () {

keyOrder: string[];
static fromObject: ({[string]: any}) => OrderedElements;
static fromMap: (Map<string,any>) => OrderedElements;
static from: (Map<string,any> | {[string]: any} | OrderedElements) =>
OrderedElements;
*/
function OrderedElements() {
var elements /* : {[string]: any} */ = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var keyOrder /* : string[] */ = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];
_classCallCheck(this, OrderedElements);
this.elements = elements;
this.keyOrder = keyOrder;
this.elements = {};
this.keyOrder = [];
}
_createClass(OrderedElements, [{
key: "forEach",
key: 'forEach',
value: function forEach(callback /* : (string, any) => void */) {
for (var i = 0; i < this.keyOrder.length; i++) {
callback(this.keyOrder[i], this.elements[this.keyOrder[i]]);
// (value, key) to match Map's API
callback(this.elements[this.keyOrder[i]], this.keyOrder[i]);
}
}
}, {
key: "map",
value: function map(callback /* : (string, any) => any */) /* : OrderedElements */{
var results = new OrderedElements();
for (var i = 0; i < this.keyOrder.length; i++) {
results.set(this.keyOrder[i], callback(this.keyOrder[i], this.elements[this.keyOrder[i]]));
}
return results;
}
}, {
key: "set",
key: 'set',
value: function set(key, /* : string */value /* : any */) {
var _this = this;
if (!this.elements.hasOwnProperty(key)) {
this.keyOrder.push(key);
}
if (value == null) {
this.elements[key] = value;
return;
}
if (MAP_EXISTS && value instanceof Map || value instanceof OrderedElements) {
var _ret = (function () {
// We have found a nested Map, so we need to recurse so that all
// of the nested objects and Maps are merged properly.
var nested = _this.elements.hasOwnProperty(key) ? _this.elements[key] : new OrderedElements();
value.forEach(function (value, key) {
nested.set(key, value);
});
_this.elements[key] = nested;
return {
v: undefined
};
})();
if (typeof _ret === 'object') return _ret.v;
}
if (!Array.isArray(value) && typeof value === 'object') {
// We have found a nested object, so we need to recurse so that all
// of the nested objects and Maps are merged properly.
var nested = this.elements.hasOwnProperty(key) ? this.elements[key] : new OrderedElements();
var keys = Object.keys(value);
for (var i = 0; i < keys.length; i += 1) {
nested.set(keys[i], value[keys[i]]);
}
this.elements[key] = nested;
return;
}
this.elements[key] = value;
}
}, {
key: "get",
key: 'get',
value: function get(key /* : string */) /* : any */{

@@ -67,6 +86,22 @@ return this.elements[key];

}, {
key: "has",
key: 'has',
value: function has(key /* : string */) /* : boolean */{
return this.elements.hasOwnProperty(key);
}
}, {
key: 'addStyleType',
value: function addStyleType(styleType /* : any */) /* : void */{
var _this2 = this;
if (MAP_EXISTS && styleType instanceof Map || styleType instanceof OrderedElements) {
styleType.forEach(function (value, key) {
_this2.set(key, value);
});
} else {
var keys = Object.keys(styleType);
for (var i = 0; i < keys.length; i++) {
this.set(keys[i], styleType[keys[i]]);
}
}
}
}]);

@@ -77,31 +112,3 @@

exports["default"] = OrderedElements;
OrderedElements.fromObject = function (obj) {
return new OrderedElements(obj, Object.keys(obj));
};
OrderedElements.fromMap = function (map) {
var ret = new OrderedElements();
map.forEach(function (val, key) {
ret.set(key, val);
});
return ret;
};
OrderedElements.from = function (obj) {
if (obj instanceof OrderedElements) {
// NOTE(emily): This makes a shallow copy of the previous elements, so
// if the elements are deeply modified it will affect all copies.
return new OrderedElements(_extends({}, obj.elements), obj.keyOrder.slice());
} else if (
// For some reason, flow complains about a plain
// `typeof Map !== "undefined"` check. Casting `Map` to `any` solves
// the problem.
typeof /*::(*/Map /*: any)*/ !== "undefined" && obj instanceof Map) {
return OrderedElements.fromMap(obj);
} else {
return OrderedElements.fromObject(obj);
}
};
module.exports = exports["default"];
exports['default'] = OrderedElements;
module.exports = exports['default'];

@@ -15,6 +15,2 @@ 'use strict';

var _orderedElements = require('./ordered-elements');
var _orderedElements2 = _interopRequireDefault(_orderedElements);
/* ::

@@ -27,11 +23,2 @@ type Pair = [ string, any ];

// {K1: V1, K2: V2, ...} -> [[K1, V1], [K2, V2]]
var objectToPairs = function objectToPairs(obj /* : ObjectMap */) {
return (/* : Pairs */Object.keys(obj).map(function (key) {
return [key, obj[key]];
})
);
};
exports.objectToPairs = objectToPairs;
var mapObj = function mapObj(obj, /* : ObjectMap */

@@ -56,20 +43,2 @@ fn /* : PairsMapper */

exports.mapObj = mapObj;
// Flattens an array one level
// [[A], [B, C, [D]]] -> [A, B, C, [D]]
var flatten = function flatten(list /* : any[] */) {
return (/* : any[] */list.reduce(function (memo, x) {
return memo.concat(x);
}, [])
);
};
exports.flatten = flatten;
var flattenDeep = function flattenDeep(list /* : any[] */) {
return (/* : any[] */list.reduce(function (memo, x) {
return memo.concat(Array.isArray(x) ? flattenDeep(x) : x);
}, [])
);
};
exports.flattenDeep = flattenDeep;
var UPPERCASE_RE = /([A-Z])/g;

@@ -90,37 +59,2 @@ var UPPERCASE_RE_TO_KEBAB = function UPPERCASE_RE_TO_KEBAB(match /* : string */) {

exports.kebabifyStyleName = kebabifyStyleName;
var isPlainObject = function isPlainObject(x /* : ObjectMap | any */
) {
return (/* : boolean */typeof x === 'object' && !Array.isArray(x) && x !== null
);
};
var recursiveMerge = function recursiveMerge(a, /* : OrderedElements | ObjectMap | Map<string,any> | any */
b /* : ObjectMap | Map<string,any> */
) /* : OrderedElements | any */{
// TODO(jlfwong): Handle malformed input where a and b are not the same
// type.
if (!isPlainObject(a) || !isPlainObject(b)) {
if (isPlainObject(b)) {
return _orderedElements2['default'].from(b);
} else {
return b;
}
}
var ret = _orderedElements2['default'].from(a);
var right = _orderedElements2['default'].from(b);
right.forEach(function (key, val) {
if (ret.has(key)) {
ret.set(key, recursiveMerge(ret.get(key), val));
} else {
ret.set(key, val);
}
});
return ret;
};
exports.recursiveMerge = recursiveMerge;
/**

@@ -212,2 +146,10 @@ * CSS properties which accept numbers but are not in units of "px".

exports.stringifyValue = stringifyValue;
var stringifyAndImportantifyValue = function stringifyAndImportantifyValue(key, /* : string */
prop /* : any */
) {
return (/* : string */importantify(stringifyValue(key, prop))
);
};
exports.stringifyAndImportantifyValue = stringifyAndImportantifyValue;
// Hash a javascript object using JSON.stringify. This is very fast, about 3

@@ -238,3 +180,2 @@ // microseconds on my computer for a sample object:

);
};
exports.importantify = importantify;
};
{
"name": "aphrodite",
"version": "1.2.0",
"version": "1.2.1",
"description": "Inline styles in JS that just work (TM)",

@@ -16,2 +16,3 @@ "keywords": [

"coverage": "nyc --check-coverage --lines 100 --branches 100 npm run tests",
"coveralls": "npm run coverage && nyc report --reporter=text-lcov | coveralls",
"pretest": "npm run build:prefixes",

@@ -51,3 +52,3 @@ "tests": "mocha --compilers js:babel/register tests",

"chai": "^3.3.0",
"es6-shim": "^0.35.3",
"coveralls": "^2.12.0",
"eslint": "^3.7.1",

@@ -70,3 +71,10 @@ "eslint-config-standard-react": "^4.2.0",

},
"tonicExampleFilename": "examples/runkit.js"
"tonicExampleFilename": "examples/runkit.js",
"nyc": {
"exclude": [
"**/node_modules/**",
"coverage",
"tests"
]
}
}
# Aphrodite: Inline Styles that work
[![npm version](https://badge.fury.io/js/aphrodite.svg)](https://badge.fury.io/js/aphrodite) [![Build Status](https://travis-ci.org/Khan/aphrodite.svg?branch=master)](https://travis-ci.org/Khan/aphrodite) [![Gitter chat](https://img.shields.io/gitter/room/Khan/aphrodite.svg)](https://gitter.im/Khan/aphrodite)
[![npm version](https://badge.fury.io/js/aphrodite.svg)](https://badge.fury.io/js/aphrodite) [![Build Status](https://travis-ci.org/Khan/aphrodite.svg?branch=master)](https://travis-ci.org/Khan/aphrodite) [![Coverage Status](https://coveralls.io/repos/github/Khan/aphrodite/badge.svg?branch=master)](https://coveralls.io/github/Khan/aphrodite?branch=master) [![Gitter chat](https://img.shields.io/gitter/room/Khan/aphrodite.svg)](https://gitter.im/Khan/aphrodite)

@@ -597,15 +597,2 @@ Support for colocating your styles with your JavaScript component.

# Changelog
## 1.1.0
- Animations now support multiple animations per style ([see section on Animations](https://github.com/Khan/aphrodite#animations)) ([PR #167](https://github.com/Khan/aphrodite/pull/167))
## 1.0.0
- Syntax extensions ([see section on Advanced extensions](https://github.com/Khan/aphrodite#advanced-extensions)) ([PR #95](https://github.com/Khan/aphrodite/pull/95))
## 0.6.0
- `css()` will now accept arbitrarily nested arrays. i.e. instead of `css(styles.a, styles.b)`, you can now do `css([styles.a, [styles.b, styles.c]])`. ([PR #154](https://github.com/Khan/aphrodite/pull/154))
- Support for multiple font styles with the same font-family. ([PR #82](https://github.com/Khan/aphrodite/pull/82))
# Tools

@@ -612,0 +599,0 @@

@@ -7,4 +7,5 @@ /* @flow */

import {
objectToPairs, kebabifyStyleName, recursiveMerge, stringifyValue,
importantify, flatten
kebabifyStyleName,
stringifyValue,
stringifyAndImportantifyValue
} from './util';

@@ -151,6 +152,8 @@

) /* : string */ => {
const merged /* : OrderedElements */ = styleTypes.reduce(
recursiveMerge,
new OrderedElements());
const merged = new OrderedElements();
for (let i = 0; i < styleTypes.length; i++) {
merged.addStyleType(styleTypes[i]);
}
const plainDeclarations = new OrderedElements();

@@ -160,3 +163,3 @@ let generatedStyles = "";

// TODO(emily): benchmark this to see if a plain for loop would be faster.
merged.forEach((key, val) => {
merged.forEach((val, key) => {
// For each key, see if one of the selector handlers will handle these

@@ -202,8 +205,15 @@ // styles.

selectorHandlers /* : SelectorHandler[] */
) /* */ => {
const hasStringHandlers = !!stringHandlers;
return declarations.map((key, val) => {
// If a handler exists for this particular key, let it interpret
// that value first before continuing
if (hasStringHandlers && stringHandlers.hasOwnProperty(key)) {
) /* : OrderedElements */ => {
if (!stringHandlers) {
return declarations;
}
const stringHandlerKeys = Object.keys(stringHandlers);
for (let i = 0; i < stringHandlerKeys.length; i++) {
const key = stringHandlerKeys[i];
if (declarations.has(key)) {
// A declaration exists for this particular string handler, so we
// need to let the string handler interpret the declaration first
// before proceeding.
//
// TODO(emily): Pass in a callback which generates CSS, similar to

@@ -214,9 +224,22 @@ // how our selector handlers work, instead of passing in

// handlers are very specialized and do complex things.
return stringHandlers[key](val, selectorHandlers);
} else {
return val;
declarations.set(
key,
stringHandlers[key](declarations.get(key), selectorHandlers)
);
}
});
}
return declarations;
};
const transformRule = (
key /* : string */,
value /* : string */,
transformValue /* : function */
) /* : string */ => (
`${kebabifyStyleName(key)}:${transformValue(key, value)};`
);
/**

@@ -260,43 +283,47 @@ * Generate a CSS ruleset with the selector and containing the declarations.

) /* : string */ => {
const handledDeclarations /* : OrderedElements */ = runStringHandlers(
declarations, stringHandlers, selectorHandlers);
// Mutates declarations
runStringHandlers(declarations, stringHandlers, selectorHandlers);
const originalElements = {...handledDeclarations.elements};
const originalElements = {...declarations.elements};
// NOTE(emily): This mutates handledDeclarations.elements.
const prefixedDeclarations = prefixAll(handledDeclarations.elements);
const prefixedElements = prefixAll(declarations.elements);
const prefixedRules = flatten(
objectToPairs(prefixedDeclarations).map(([key, value]) => {
if (Array.isArray(value)) {
// inline-style-prefixer returns an array when there should be
// multiple rules for the same key. Here we flatten to multiple
// pairs with the same key.
return value.map(v => [key, v]);
}
return [[key, value]];
})
);
const elementNames = Object.keys(prefixedElements);
if (elementNames.length !== declarations.keyOrder.length) {
// There are some prefixed values, so we need to figure out how to sort
// them.
//
// Loop through prefixedElements, looking for anything that is not in
// sortOrder, which means it was added by prefixAll. This means that we
// need to figure out where it should appear in the sortOrder.
for (let i = 0; i < elementNames.length; i++) {
if (!originalElements.hasOwnProperty(elementNames[i])) {
// This element is not in the sortOrder, which means it is a prefixed
// value that was added by prefixAll. Let's try to figure out where it
// goes.
let originalStyle;
if (elementNames[i][0] === 'W') {
// This is a Webkit-prefixed style, like "WebkitTransition". Let's
// find its original style's sort order.
originalStyle = elementNames[i][6].toLowerCase() + elementNames[i].slice(7);
} else if (elementNames[i][1] === 'o') {
// This is a Moz-prefixed style, like "MozTransition". We check
// the second character to avoid colliding with Ms-prefixed
// styles. Let's find its original style's sort order.
originalStyle = elementNames[i][3].toLowerCase() + elementNames[i].slice(4);
} else { // if (elementNames[i][1] === 's') {
// This is a Ms-prefixed style, like "MsTransition".
originalStyle = elementNames[i][2].toLowerCase() + elementNames[i].slice(3);
}
// Calculate the order that we want to each element in `prefixedRules` to
// be in, based on its index in the original key ordering.
const sortOrder = {};
for (let i = 0; i < handledDeclarations.keyOrder.length; i++) {
const key = handledDeclarations.keyOrder[i];
sortOrder[key] = i;
// In order to keep most prefixed versions of keys in about the same
// order that the original keys were in but placed before the
// unprefixed version, we generate the prefixed forms of the keys and
// set their order to the same as the original key minus a little bit.
const capitalizedKey = `${key[0].toUpperCase()}${key.slice(1)}`;
const prefixedKeys = [
`Webkit${capitalizedKey}`,
`Moz${capitalizedKey}`,
`ms${capitalizedKey}`,
];
for (let j = 0; j < prefixedKeys.length; ++j) {
if (!originalElements.hasOwnProperty(prefixedKeys[j])) {
sortOrder[prefixedKeys[j]] = i - 0.5;
originalElements[prefixedKeys[j]] = originalElements[key];
if (originalStyle && originalElements.hasOwnProperty(originalStyle)) {
const originalIndex = declarations.keyOrder.indexOf(originalStyle);
declarations.keyOrder.splice(originalIndex, 0, elementNames[i]);
} else {
// We don't know what the original style was, so sort it to
// top. This can happen for styles that are added that don't
// have the same base name as the original style.
declarations.keyOrder.unshift(elementNames[i]);
}
}

@@ -306,38 +333,24 @@ }

// Calculate the sort order of a given property.
function sortOrderForProperty([key, value]) {
if (sortOrder.hasOwnProperty(key)) {
if (originalElements.hasOwnProperty(key) &&
originalElements[key] !== value) {
// The value is prefixed. Sort this just before the key with
// the unprefixed value.
return sortOrder[key] - 0.25;
} else {
// Either the key and value are unprefixed here, or this is a
// prefixed key. Either way, this is handled by the sortOrder
// calculation above.
return sortOrder[key];
const transformValue = (useImportant === false)
? stringifyValue
: stringifyAndImportantifyValue;
const rules = [];
for (let i = 0; i < declarations.keyOrder.length; i ++) {
const key = declarations.keyOrder[i];
const value = prefixedElements[key];
if (Array.isArray(value)) {
// inline-style-prefixer returns an array when there should be
// multiple rules for the same key. Here we flatten to multiple
// pairs with the same key.
for (let j = 0; j < value.length; j++) {
rules.push(transformRule(key, value[j], transformValue));
}
} else {
// If the property isn't in the sort order, it wasn't in the
// original set of unprefixed keys, so it must be a prefixed key.
// Sort at order -1 to put it at the top of the set of styles.
return -1;
rules.push(transformRule(key, value, transformValue));
}
}
// Actually sort the rules according to the sort order.
prefixedRules.sort(
(a, b) => sortOrderForProperty(a) - sortOrderForProperty(b));
const transformValue = (useImportant === false)
? stringifyValue
: (key, value) => importantify(stringifyValue(key, value));
const rules = prefixedRules
.map(([key, value]) => `${kebabifyStyleName(key)}:${transformValue(key, value)};`)
.join("");
if (rules) {
return `${selector}{${rules}}`;
if (rules.length) {
return `${selector}{${rules.join("")}}`;
} else {

@@ -344,0 +357,0 @@ return "";

/* @flow */
import asap from 'asap';
import OrderedElements from './ordered-elements';
import {generateCSS} from './generate';
import {flattenDeep, hashObject} from './util';
import {hashObject} from './util';

@@ -11,2 +12,6 @@ /* ::

import type { SelectorHandler } from './generate.js';
type ProcessedStyleDefinitions = {
classNameBits: Array<string>,
definitionBits: Array<Object>,
};
*/

@@ -103,6 +108,19 @@

let finalVal = `@keyframes ${name}{`;
Object.keys(val).forEach(key => {
finalVal += generateCSS(
key, [val[key]], selectorHandlers, stringHandlers, false);
});
// TODO see if we can find a way where checking for OrderedElements
// here is not necessary. Alternatively, perhaps we should have a
// utility method that can iterate over either a plain object, an
// instance of OrderedElements, or a Map, and then use that here and
// elsewhere.
if (val instanceof OrderedElements) {
val.forEach((valVal, valKey) => {
finalVal += generateCSS(
valKey, [valVal], selectorHandlers, stringHandlers, false);
});
} else {
Object.keys(val).forEach(key => {
finalVal += generateCSS(
key, [val[key]], selectorHandlers, stringHandlers, false);
});
}
finalVal += '}';

@@ -132,20 +150,22 @@

const injectGeneratedCSSOnce = (key, generatedCSS) => {
if (!alreadyInjected[key]) {
if (!isBuffering) {
// We should never be automatically buffering on the server (or any
// place without a document), so guard against that.
if (typeof document === "undefined") {
throw new Error(
"Cannot automatically buffer without a document");
}
if (alreadyInjected[key]) {
return;
}
// If we're not already buffering, schedule a call to flush the
// current styles.
isBuffering = true;
asap(flushToStyleTag);
if (!isBuffering) {
// We should never be automatically buffering on the server (or any
// place without a document), so guard against that.
if (typeof document === "undefined") {
throw new Error(
"Cannot automatically buffer without a document");
}
injectionBuffer += generatedCSS;
alreadyInjected[key] = true;
// If we're not already buffering, schedule a call to flush the
// current styles.
isBuffering = true;
asap(flushToStyleTag);
}
injectionBuffer += generatedCSS;
alreadyInjected[key] = true;
}

@@ -160,9 +180,11 @@

) => {
if (!alreadyInjected[key]) {
const generated = generateCSS(
selector, definitions, selectorHandlers,
stringHandlers, useImportant);
if (alreadyInjected[key]) {
return;
}
injectGeneratedCSSOnce(key, generated);
}
const generated = generateCSS(
selector, definitions, selectorHandlers,
stringHandlers, useImportant);
injectGeneratedCSSOnce(key, generated);
};

@@ -209,2 +231,21 @@

const processStyleDefinitions = (
styleDefinitions /* : any[] */,
result /* : ProcessedStyleDefinitions */
) /* : void */ => {
for (let i = 0; i < styleDefinitions.length; i += 1) {
// Filter out falsy values from the input, to allow for
// `css(a, test && c)`
if (styleDefinitions[i]) {
if (Array.isArray(styleDefinitions[i])) {
// We've encountered an array, so let's recurse
processStyleDefinitions(styleDefinitions[i], result);
} else {
result.classNameBits.push(styleDefinitions[i]._name);
result.definitionBits.push(styleDefinitions[i]._definition);
}
}
}
};
/**

@@ -225,19 +266,14 @@ * Inject styles associated with the passed style definition objects, and return

) /* : string */ => {
styleDefinitions = flattenDeep(styleDefinitions);
const processedStyleDefinitions /* : ProcessedStyleDefinitions */ = {
classNameBits: [],
definitionBits: [],
};
// Mutates processedStyleDefinitions
processStyleDefinitions(styleDefinitions, processedStyleDefinitions);
const classNameBits = [];
const definitionBits = [];
for (let i = 0; i < styleDefinitions.length; i += 1) {
// Filter out falsy values from the input, to allow for
// `css(a, test && c)`
if (styleDefinitions[i]) {
classNameBits.push(styleDefinitions[i]._name);
definitionBits.push(styleDefinitions[i]._definition);
}
}
// Break if there aren't any valid styles.
if (classNameBits.length === 0) {
if (processedStyleDefinitions.classNameBits.length === 0) {
return "";
}
const className = classNameBits.join("-o_O-");
const className = processedStyleDefinitions.classNameBits.join("-o_O-");

@@ -247,3 +283,3 @@ injectStyleOnce(

`.${className}`,
definitionBits,
processedStyleDefinitions.definitionBits,
useImportant,

@@ -250,0 +286,0 @@ selectorHandlers

/* @flow */
/* global Map */
const MAP_EXISTS = typeof Map !== 'undefined';

@@ -8,15 +8,7 @@ export default class OrderedElements {

keyOrder: string[];
static fromObject: ({[string]: any}) => OrderedElements;
static fromMap: (Map<string,any>) => OrderedElements;
static from: (Map<string,any> | {[string]: any} | OrderedElements) =>
OrderedElements;
*/
constructor(
elements /* : {[string]: any} */ = {},
keyOrder /* : string[] */ = []
) {
this.elements = elements;
this.keyOrder = keyOrder;
constructor() {
this.elements = {};
this.keyOrder = [];
}

@@ -26,17 +18,7 @@

for (let i = 0; i < this.keyOrder.length; i++) {
callback(this.keyOrder[i], this.elements[this.keyOrder[i]]);
// (value, key) to match Map's API
callback(this.elements[this.keyOrder[i]], this.keyOrder[i]);
}
}
map(callback /* : (string, any) => any */) /* : OrderedElements */ {
const results = new OrderedElements();
for (let i = 0; i < this.keyOrder.length; i++) {
results.set(
this.keyOrder[i],
callback(this.keyOrder[i], this.elements[this.keyOrder[i]])
);
}
return results;
}
set(key /* : string */, value /* : any */) {

@@ -46,2 +28,35 @@ if (!this.elements.hasOwnProperty(key)) {

}
if (value == null) {
this.elements[key] = value;
return;
}
if ((MAP_EXISTS && value instanceof Map) || value instanceof OrderedElements) {
// We have found a nested Map, so we need to recurse so that all
// of the nested objects and Maps are merged properly.
const nested = this.elements.hasOwnProperty(key)
? this.elements[key]
: new OrderedElements();
value.forEach((value, key) => {
nested.set(key, value);
});
this.elements[key] = nested;
return;
}
if (!Array.isArray(value) && typeof value === 'object') {
// We have found a nested object, so we need to recurse so that all
// of the nested objects and Maps are merged properly.
const nested = this.elements.hasOwnProperty(key)
? this.elements[key]
: new OrderedElements();
const keys = Object.keys(value);
for (let i = 0; i < keys.length; i += 1) {
nested.set(keys[i], value[keys[i]]);
}
this.elements[key] = nested;
return;
}
this.elements[key] = value;

@@ -57,32 +72,15 @@ }

}
}
OrderedElements.fromObject = (obj) => {
return new OrderedElements(obj, Object.keys(obj));
};
OrderedElements.fromMap = (map) => {
const ret = new OrderedElements();
map.forEach((val, key) => {
ret.set(key, val);
});
return ret;
};
OrderedElements.from = (obj) => {
if (obj instanceof OrderedElements) {
// NOTE(emily): This makes a shallow copy of the previous elements, so
// if the elements are deeply modified it will affect all copies.
return new OrderedElements({...obj.elements}, obj.keyOrder.slice());
} else if (
// For some reason, flow complains about a plain
// `typeof Map !== "undefined"` check. Casting `Map` to `any` solves
// the problem.
typeof /*::(*/ Map /*: any)*/ !== "undefined" &&
obj instanceof Map
) {
return OrderedElements.fromMap(obj);
} else {
return OrderedElements.fromObject(obj);
addStyleType(styleType /* : any */) /* : void */ {
if ((MAP_EXISTS && styleType instanceof Map) || styleType instanceof OrderedElements) {
styleType.forEach((value, key) => {
this.set(key, value);
});
} else {
const keys = Object.keys(styleType);
for (let i = 0; i < keys.length; i++) {
this.set(keys[i], styleType[keys[i]]);
}
}
}
};
}
/* @flow */
import stringHash from 'string-hash';
import OrderedElements from './ordered-elements';
/* ::

@@ -13,5 +11,2 @@ type Pair = [ string, any ];

// {K1: V1, K2: V2, ...} -> [[K1, V1], [K2, V2]]
export const objectToPairs = (obj /* : ObjectMap */) /* : Pairs */ => Object.keys(obj).map(key => [key, obj[key]]);
export const mapObj = (

@@ -30,9 +25,2 @@ obj /* : ObjectMap */,

// Flattens an array one level
// [[A], [B, C, [D]]] -> [A, B, C, [D]]
export const flatten = (list /* : any[] */) /* : any[] */ => list.reduce((memo, x) => memo.concat(x), []);
export const flattenDeep = (list /* : any[] */) /* : any[] */ =>
list.reduce((memo, x) => memo.concat(Array.isArray(x) ? flattenDeep(x) : x), []);
const UPPERCASE_RE = /([A-Z])/g;

@@ -49,35 +37,2 @@ const UPPERCASE_RE_TO_KEBAB = (match /* : string */) /* : string */ => `-${match.toLowerCase()}`;

const isPlainObject = (
x/* : ObjectMap | any */
) /* : boolean */ => typeof x === 'object' && !Array.isArray(x) && x !== null;
export const recursiveMerge = (
a /* : OrderedElements | ObjectMap | Map<string,any> | any */,
b /* : ObjectMap | Map<string,any> */
) /* : OrderedElements | any */ => {
// TODO(jlfwong): Handle malformed input where a and b are not the same
// type.
if (!isPlainObject(a) || !isPlainObject(b)) {
if (isPlainObject(b)) {
return OrderedElements.from(b);
} else {
return b;
}
}
const ret = OrderedElements.from(a);
const right = OrderedElements.from(b);
right.forEach((key, val) => {
if (ret.has(key)) {
ret.set(key, recursiveMerge(ret.get(key), val));
} else {
ret.set(key, val)
}
});
return ret;
};
/**

@@ -87,3 +42,3 @@ * CSS properties which accept numbers but are not in units of "px".

*/
var isUnitlessNumber = {
const isUnitlessNumber = {
animationIterationCount: true,

@@ -136,3 +91,3 @@ borderImageOutset: true,

function prefixKey(prefix, key) {
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
}

@@ -145,3 +100,3 @@

*/
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
const prefixes = ['Webkit', 'ms', 'Moz', 'O'];

@@ -152,5 +107,5 @@ // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an

Object.keys(isUnitlessNumber).forEach(function(prop) {
prefixes.forEach(function(prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
prefixes.forEach(function(prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});

@@ -173,2 +128,7 @@

export const stringifyAndImportantifyValue = (
key /* : string */,
prop /* : any */
) /* : string */ => importantify(stringifyValue(key, prop));
// Hash a javascript object using JSON.stringify. This is very fast, about 3

@@ -187,3 +147,3 @@ // microseconds on my computer for a sample object:

// to generate "b !important".
export const importantify = (string /* : string */) /* : string */ => (
const importantify = (string /* : string */) /* : string */ => (
// Bracket string character access is very fast, and in the default case we

@@ -190,0 +150,0 @@ // normally don't expect there to be "!important" at the end of the string

@@ -10,5 +10,8 @@ import {assert} from 'chai';

const assertCSSRuleset = (selector, declarations, expected) => {
const actual = generateCSSRuleset(
selector,
OrderedElements.from(declarations));
const orderedDeclarations = new OrderedElements();
Object.keys(declarations).forEach((key) => {
orderedDeclarations.set(key, declarations[key]);
});
const actual = generateCSSRuleset(selector, orderedDeclarations);
const expectedNormalized = expected.split('\n').map(x => x.trim()).join('');

@@ -36,3 +39,3 @@ const formatStyles = (styles) => styles.replace(/(;|{|})/g, '$1\n');

it('returns a CSS string for multiple property', () => {
it('returns a CSS string for multiple properties', () => {
assertCSSRuleset('.foo', {

@@ -131,2 +134,19 @@ color: 'red',

it('works with Map', () => {
assertCSS('.foo', [new Map([
['color', 'red']
])], '.foo{color:red !important;}');
});
it('works with two Maps', () => {
assertCSS('.foo', [
new Map([
['color', 'red']
]),
new Map([
['color', 'blue']
]),
], '.foo{color:blue !important;}');
});
it('implements override logic', () => {

@@ -140,2 +160,20 @@ assertCSS('.foo', [{

it('does not mutate nested objects', () => {
const styles = {
a: {
':after': {
content: 'a',
}
},
b: {
':after': {
content: 'b',
}
}
};
generateCSS('.foo', [styles.a, styles.b], [], {}, true);
assert.equal(styles.a[':after'].content, 'a');
assert.equal(styles.b[':after'].content, 'b');
});
it('supports pseudo selectors', () => {

@@ -149,6 +187,25 @@ assertCSS('.foo', [{

it('works with a nested Map', () => {
assertCSS('.foo', [{
':hover': new Map([
['color', 'red'],
])
}], '.foo:hover{color:red !important;}', defaultSelectorHandlers);
});
it('works with two nested Maps', () => {
assertCSS('.foo', [
{':hover': new Map([
['color', 'red'],
])},
{':hover': new Map([
['color', 'blue'],
])}
], '.foo:hover{color:blue !important;}', defaultSelectorHandlers);
});
it('supports media queries', () => {
assertCSS('.foo', [{
"@media (max-width: 400px)": {
color: "blue"
color: "blue"
}

@@ -172,2 +229,39 @@ }], `@media (max-width: 400px){

it('vendor prefixes in pseudo selectors inside media queries', () => {
assertCSS('.foo', [{
"@media (max-width: 400px)": {
":hover": {
transform: "translateX(0)"
}
}
}], `@media (max-width: 400px){
.foo:hover{
-webkit-transform:translateX(0) !important;
-ms-transform:translateX(0) !important;
transform:translateX(0) !important;
}
}`, defaultSelectorHandlers);
});
it('supports combining pseudo selectors inside media queries', () => {
assertCSS('.foo', [
{"@media (max-width: 400px)": {
":hover": {
background: "blue",
color: "blue"
}
}},
{"@media (max-width: 400px)": {
":hover": {
color: "red"
}
}}
], `@media (max-width: 400px){
.foo:hover{
background:blue !important;
color:red !important;
}
}`, defaultSelectorHandlers);
});
it('supports custom string handlers', () => {

@@ -204,5 +298,5 @@ assertCSS('.foo', [{

'display:-webkit-box !important;' +
'display:-moz-box !important;' +
'display:-ms-flexbox !important;' +
'display:-webkit-flex !important;' +
'display:-moz-box !important;' +
'display:flex !important;' +

@@ -237,5 +331,5 @@ '-webkit-transition:all 0s !important;' +

it('correctly prefixes border-color transition properties', () => {
assertCSS('.foo', [{
'transition': 'border-color 200ms linear'
}], '.foo{' +
assertCSS('.foo', [{
'transition': 'border-color 200ms linear'
}], '.foo{' +
'-webkit-transition:border-color 200ms linear !important;' +

@@ -249,6 +343,6 @@ '-moz-transition:border-color 200ms linear !important;' +

it('handles nullish values', () => {
assertCSS('.foo', [{
'color': null,
'margin': undefined,
}], '.foo{' +
assertCSS('.foo', [{
'color': null,
'margin': undefined,
}], '.foo{' +
'color:null !important;' +

@@ -255,0 +349,0 @@ 'margin:undefined !important;' +

@@ -190,3 +190,3 @@ import asap from 'asap';

assert.equal(styleTags.length, 1);
let styleContentLength = styleTags[0].textContent.length;
const styleContentLength = styleTags[0].textContent.length;

@@ -373,7 +373,7 @@ startBuffering();

assertStylesInclude('@keyframes keyframe_1kmnkfo');
assertStylesInclude('@keyframes keyframe_tmjr6');
assertStylesInclude('from{left:10px;}');
assertStylesInclude('50%{left:20px;}');
assertStylesInclude('to{left:40px;}');
assertStylesInclude('animation-name:keyframe_1kmnkfo');
assertStylesInclude('animation-name:keyframe_tmjr6');
});

@@ -411,3 +411,3 @@

assert.include(styles, '@keyframes keyframe_1kmnkfo');
assert.include(styles, '@keyframes keyframe_tmjr6');
assert.equal(styles.match(/@keyframes/g).length, 1);

@@ -414,0 +414,0 @@ });

@@ -1,2 +0,1 @@

/* global Map */
import {assert} from 'chai';

@@ -6,45 +5,22 @@

import "es6-shim";
describe("OrderedElements", () => {
it("generates from an object", () => {
const orig = {
a: 1,
b: 2,
};
it("can identify elements it has", () => {
const elems = new OrderedElements();
const elems = OrderedElements.from(orig);
assert.deepEqual({
elements: orig,
keyOrder: ["a", "b"],
}, elems);
elems.set("a", 1);
assert.equal(elems.has("a"), true);
});
it("generates from a Map", () => {
const orig = new Map([
["a", 1],
["b", 2]
]);
it("can identify elements it does not have", () => {
const elems = new OrderedElements();
const elems = OrderedElements.from(orig);
assert.deepEqual({
elements: {
a: 1,
b: 2,
},
keyOrder: ["a", "b"],
}, elems);
elems.set("a", 1);
assert.equal(elems.has("b"), false);
});
it("generates from a OrderedElements", () => {
const orig = new OrderedElements();
it("can get elements it has", () => {
const elems = new OrderedElements();
orig.set("a", 1);
orig.set("b", 2);
const elems = OrderedElements.from(orig);
assert.deepEqual(orig, elems);
elems.set("a", 1);
assert.equal(elems.get("a"), 1);
});

@@ -90,3 +66,3 @@

elems.forEach((key, value) => {
elems.forEach((value, key) => {
order.push([key, value]);

@@ -101,23 +77,2 @@ });

});
it("maps over the elements, making a new OrderedElements from the result", () => {
const elems = new OrderedElements();
elems.set("a", 1);
elems.set("b", 2);
elems.set("c", 3);
const mapped = elems.map((key, value) => {
return value + 1;
});
assert.deepEqual({
elements: {
a: 2,
b: 3,
c: 4,
},
keyOrder: ["a", "b", "c"],
}, mapped);
});
});

@@ -1,142 +0,6 @@

/* global Map */
import {assert} from 'chai';
import {flattenDeep, kebabifyStyleName, recursiveMerge} from '../src/util.js';
import {kebabifyStyleName} from '../src/util.js';
import "es6-shim";
describe('Utils', () => {
describe('flattenDeep', () => {
it('flattens arrays at any level', () => {
assert.deepEqual(
flattenDeep([[1, [2, 3, []]], 4, [[5], [6, [7]]]]),
[1, 2, 3, 4, 5, 6, 7]);
});
});
describe('recursiveMerge', () => {
it('merges two objects', () => {
assert.deepEqual(
recursiveMerge({
a: 1,
}, {
a: 2,
}),
{
elements: {
a: 2,
},
keyOrder: ["a"],
});
assert.deepEqual(
recursiveMerge({
a: 1,
}, {
b: 2,
}),
{
elements: {
a: 1,
b: 2,
},
keyOrder: ["a", "b"],
});
});
it('merges maps together', () => {
assert.deepEqual(
recursiveMerge(
new Map([['a', 1], ['b', 2]]),
new Map([['a', 3], ['c', 4]])
),
{
elements: {
a: 3,
b: 2,
c: 4,
},
keyOrder: ["a", "b", "c"],
});
});
it('merges maps and objects together', () => {
assert.deepEqual(
[
new Map([['a', 1]]),
{a: 2, b: 3},
new Map([['b', 4], ['c', 5]]),
].reduce(recursiveMerge),
{
elements: {
a: 2,
b: 4,
c: 5,
},
keyOrder: ["a", "b", "c"],
});
});
it('generates OrderedElements from merging an object into a non-object', () => {
assert.deepEqual(
recursiveMerge(
1,
{a: 1},
),
{
elements: {
a: 1,
},
keyOrder: ["a"],
});
});
it('replaces arrays rather than merging them', () => {
assert.deepEqual(
recursiveMerge({
a: [1],
}, {
a: [2],
}),
{
elements: {
a: [2],
},
keyOrder: ["a"],
});
});
it('prefers the value from the override object if either property is not a true object', () => {
assert.deepEqual(
recursiveMerge({
a: { b: 2 },
}, {
a: null,
}),
{
elements: {
a: null,
},
keyOrder: ["a"],
});
assert.deepEqual(
recursiveMerge({
a: null,
}, {
a: { b: 2 },
}),
{
elements: {
a: {
elements: {
b: 2,
},
keyOrder: ["b"],
},
},
keyOrder: ["a"],
});
});
});
describe('kebabifyStyleName', () => {

@@ -143,0 +7,0 @@ it('kebabifies camelCase', () => {

@@ -1,17 +0,17 @@

var path = require('path');
const path = require('path');
module.exports = {
entry: [
'./src/index'
],
output: {
path: path.join(__dirname, 'dist')
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel'],
include: path.join(__dirname, 'src')
}]
}
entry: [
'./src/index'
],
output: {
path: path.join(__dirname, 'dist')
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel'],
include: path.join(__dirname, 'src')
}]
}
}

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

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc