Comparing version 0.5.0 to 0.6.0
@@ -208,2 +208,9 @@ module.exports = | ||
exports.flatten = flatten; | ||
var flattenDeep = function flattenDeep(list) { | ||
return list.reduce(function (memo, x) { | ||
return memo.concat(Array.isArray(x) ? flattenDeep(x) : x); | ||
}, []); | ||
}; | ||
exports.flattenDeep = flattenDeep; | ||
var UPPERCASE_RE = /([A-Z])/g; | ||
@@ -464,3 +471,3 @@ var MS_RE = /^ms-/; | ||
} else if (typeof val === "object") { | ||
injectStyleOnce(val.fontFamily, "@font-face", [val], false); | ||
injectStyleOnce(val.src, "@font-face", [val], false); | ||
return '"' + val.fontFamily + '"'; | ||
@@ -608,6 +615,9 @@ } else { | ||
* CSS output. e.g. {color: red} -> "color: red !important". | ||
* @param {Object[]} styleDefinitions style definition objects as returned as | ||
* properties of the return value of StyleSheet.create(). | ||
* @param {(Object|Object[])[]} styleDefinitions style definition objects, or | ||
* arbitrarily nested arrays of them, as returned as properties of the | ||
* return value of StyleSheet.create(). | ||
*/ | ||
var injectAndGetClassName = function injectAndGetClassName(useImportant, styleDefinitions) { | ||
styleDefinitions = (0, _util.flattenDeep)(styleDefinitions); | ||
// Filter out falsy values from the input, to allow for | ||
@@ -614,0 +624,0 @@ // `css(a, test && c)` |
@@ -217,2 +217,9 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
exports.flatten = flatten; | ||
var flattenDeep = function flattenDeep(list) { | ||
return list.reduce(function (memo, x) { | ||
return memo.concat(Array.isArray(x) ? flattenDeep(x) : x); | ||
}, []); | ||
}; | ||
exports.flattenDeep = flattenDeep; | ||
var UPPERCASE_RE = /([A-Z])/g; | ||
@@ -473,3 +480,3 @@ var MS_RE = /^ms-/; | ||
} else if (typeof val === "object") { | ||
injectStyleOnce(val.fontFamily, "@font-face", [val], false); | ||
injectStyleOnce(val.src, "@font-face", [val], false); | ||
return '"' + val.fontFamily + '"'; | ||
@@ -617,6 +624,9 @@ } else { | ||
* CSS output. e.g. {color: red} -> "color: red !important". | ||
* @param {Object[]} styleDefinitions style definition objects as returned as | ||
* properties of the return value of StyleSheet.create(). | ||
* @param {(Object|Object[])[]} styleDefinitions style definition objects, or | ||
* arbitrarily nested arrays of them, as returned as properties of the | ||
* return value of StyleSheet.create(). | ||
*/ | ||
var injectAndGetClassName = function injectAndGetClassName(useImportant, styleDefinitions) { | ||
styleDefinitions = (0, _util.flattenDeep)(styleDefinitions); | ||
// Filter out falsy values from the input, to allow for | ||
@@ -623,0 +633,0 @@ // `css(a, test && c)` |
@@ -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 o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(9)},function(e,t){"use strict";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e,t){var n=arguments.length<=2||void 0===arguments[2]?function(e,t){return e+t}:arguments[2];return r({},e,["-webkit-","-moz-",""].map(function(e){return n(e,t)}))},e.exports=t["default"]},function(e,t){"use strict";function r(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}function n(e){for(var t=e.length,r=t,n=0,o=void 0;t>=4;)o=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24,o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16),o^=o>>>24,o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^o,t-=4,++n;switch(t){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r^=255&e.charCodeAt(n),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)}return r^=r>>>13,r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16),r^=r>>>15,(r>>>0).toString(36)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){var r=[],n=!0,o=!1,i=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(l){o=!0,i=l}finally{try{!n&&u["return"]&&u["return"]()}finally{if(o)throw i}}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},a=function(e){return Object.keys(e).map(function(t){return[t,e[t]]})};t.objectToPairs=a;var u=function(e){var t={};return e.forEach(function(e){var r=o(e,2),n=r[0],i=r[1];t[n]=i}),t},l=function(e,t){return u(a(e).map(t))};t.mapObj=l;var f=function(e){return e.reduce(function(e,t){return e.concat(t)},[])};t.flatten=f;var c=/([A-Z])/g,s=/^ms-/,d=function(e){return e.replace(c,"-$1").toLowerCase()},m=function(e){return d(e).replace(s,"-ms-")};t.kebabifyStyleName=m;var p=function O(e,t){if("object"!=typeof e)return t;var r=i({},e);return Object.keys(t).forEach(function(n){r.hasOwnProperty(n)?r[n]=O(e[n],t[n]):r[n]=t[n]}),r};t.recursiveMerge=p;var y={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},h=["Webkit","ms","Moz","O"];Object.keys(y).forEach(function(e){h.forEach(function(t){y[r(t,e)]=y[e]})});var b=function(e,t){return"number"==typeof t?y[e]?""+t:t+"px":t};t.stringifyValue=b;var v=function(e){return n(JSON.stringify(e))};t.hashObject=v;var g=/^([^:]+:.*?)( !important)?;$/,x=function(e){return e.replace(g,function(e,t,r){return t+" !important;"})};t.importantify=x},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return Array.isArray(e)&&(e=e.join(",")),null!==e.match(/-webkit-|-moz-|-ms-/)},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={Webkit:{transform:!0,transformOrigin:!0,transformOriginX:!0,transformOriginY:!0,backfaceVisibility:!0,perspective:!0,perspectiveOrigin:!0,transformStyle:!0,transformOriginZ:!0,animation:!0,animationDelay:!0,animationDirection:!0,animationFillMode:!0,animationDuration:!0,animationIterationCount:!0,animationName:!0,animationPlayState:!0,animationTimingFunction:!0,appearance:!0,userSelect:!0,fontKerning:!0,textEmphasisPosition:!0,textEmphasis:!0,textEmphasisStyle:!0,textEmphasisColor:!0,boxDecorationBreak:!0,clipPath:!0,maskImage:!0,maskMode:!0,maskRepeat:!0,maskPosition:!0,maskClip:!0,maskOrigin:!0,maskSize:!0,maskComposite:!0,mask:!0,maskBorderSource:!0,maskBorderMode:!0,maskBorderSlice:!0,maskBorderWidth:!0,maskBorderOutset:!0,maskBorderRepeat:!0,maskBorder:!0,maskType:!0,textDecorationStyle:!0,textDecorationSkip:!0,textDecorationLine:!0,textDecorationColor:!0,filter:!0,fontFeatureSettings:!0,breakAfter:!0,breakBefore:!0,breakInside:!0,columnCount:!0,columnFill:!0,columnGap:!0,columnRule:!0,columnRuleColor:!0,columnRuleStyle:!0,columnRuleWidth:!0,columns:!0,columnSpan:!0,columnWidth:!0,flex:!0,flexBasis:!0,flexDirection:!0,flexGrow:!0,flexFlow:!0,flexShrink:!0,flexWrap:!0,alignContent:!0,alignItems:!0,alignSelf:!0,justifyContent:!0,order:!0,transition:!0,transitionDelay:!0,transitionDuration:!0,transitionProperty:!0,transitionTimingFunction:!0,backdropFilter:!0,scrollSnapType:!0,scrollSnapPointsX:!0,scrollSnapPointsY:!0,scrollSnapDestination:!0,scrollSnapCoordinate:!0,shapeImageThreshold:!0,shapeImageMargin:!0,shapeImageOutside:!0,hyphens:!0,flowInto:!0,flowFrom:!0,regionFragment:!0,textSizeAdjust:!0,borderImage:!0,borderImageOutset:!0,borderImageRepeat:!0,borderImageSlice:!0,borderImageSource:!0,borderImageWidth:!0,tabSize:!0,objectFit:!0,objectPosition:!0},Moz:{appearance:!0,userSelect:!0,boxSizing:!0,textAlignLast:!0,textDecorationStyle:!0,textDecorationSkip:!0,textDecorationLine:!0,textDecorationColor:!0,tabSize:!0,hyphens:!0,fontFeatureSettings:!0,breakAfter:!0,breakBefore:!0,breakInside:!0,columnCount:!0,columnFill:!0,columnGap:!0,columnRule:!0,columnRuleColor:!0,columnRuleStyle:!0,columnRuleWidth:!0,columns:!0,columnSpan:!0,columnWidth:!0},ms:{flex:!0,flexBasis:!1,flexDirection:!0,flexGrow:!1,flexFlow:!0,flexShrink:!1,flexWrap:!0,alignContent:!1,alignItems:!1,alignSelf:!1,justifyContent:!1,order:!1,transform:!0,transformOrigin:!0,transformOriginX:!0,transformOriginY:!0,userSelect:!0,wrapFlow:!0,wrapThrough:!0,wrapMargin:!0,scrollSnapType:!0,scrollSnapPointsX:!0,scrollSnapPointsY:!0,scrollSnapDestination:!0,scrollSnapCoordinate:!0,touchAction:!0,hyphens:!0,flowInto:!0,flowFrom:!0,breakBefore:!0,breakAfter:!0,breakInside:!0,regionFragment:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridTemplate:!0,gridAutoColumns:!0,gridAutoRows:!0,gridAutoFlow:!0,grid:!0,gridRowStart:!0,gridColumnStart:!0,gridRowEnd:!0,gridRow:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnGap:!0,gridRowGap:!0,gridArea:!0,gridGap:!0,textSizeAdjust:!0}},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},e.exports=t["default"]},function(e,t,r){"use strict";function n(){if(l.length)throw l.shift()}function o(e){var t;t=u.length?u.pop():new i,t.task=e,a(t)}function i(){this.task=null}var a=r(7),u=[],l=[],f=a.makeRequestCallFromTimer(n);e.exports=o,i.prototype.call=function(){try{this.task.call()}catch(e){o.onerror?o.onerror(e):(l.push(e),f())}finally{this.task=null,u[u.length]=this}}},function(e,t){(function(t){"use strict";function r(e){u.length||(a(),l=!0),u[u.length]=e}function n(){for(;f<u.length;){var e=f;if(f+=1,u[e].call(),f>c){for(var t=0,r=u.length-f;r>t;t++)u[t]=u[t+f];u.length-=f,f=0}}u.length=0,f=0,l=!1}function o(e){var t=1,r=new s(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}function i(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=[],l=!1,f=0,c=1024,s=t.MutationObserver||t.WebKitMutationObserver;a="function"==typeof s?o(n):i(n),r.requestFlush=a,r.makeRequestCallFromTimer=i}).call(t,function(){return this}())},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){var r=[],n=!0,o=!1,i=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(l){o=!0,i=l}finally{try{!n&&u["return"]&&u["return"]()}finally{if(o)throw i}}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=r(22),a=n(i),u=r(2),l=function s(e,t,r,n){var o=t.reduce(u.recursiveMerge),i={},a={},l={};return Object.keys(o).forEach(function(e){":"===e[0]?l[e]=o[e]:"@"===e[0]?a[e]=o[e]:i[e]=o[e]}),c(e,i,r,n)+Object.keys(l).map(function(t){return c(e+t,l[t],r,n)}).join("")+Object.keys(a).map(function(t){var o=s(e,[a[t]],r,n);return t+"{"+o+"}"}).join("")};t.generateCSS=l;var f=function(e,t){var r={};return Object.keys(e).forEach(function(n){t&&t.hasOwnProperty(n)?r[n]=t[n](e[n]):r[n]=e[n]}),r},c=function(e,t,r,n){var i=f(t,r),l=(0,a["default"])(i),c=(0,u.flatten)((0,u.objectToPairs)(l).map(function(e){var t=o(e,2),r=t[0],n=t[1];if(Array.isArray(n)){var i=function(){var e=[],t=[];return n.forEach(function(r){0===r.indexOf("-")?e.push(r):t.push(r)}),e.sort(),t.sort(),{v:e.concat(t).map(function(e){return[r,e]})}}();if("object"==typeof i)return i.v}return[[r,n]]})),s=c.map(function(e){var t=o(e,2),r=t[0],i=t[1],a=(0,u.stringifyValue)(r,i),l=(0,u.kebabifyStyleName)(r)+":"+a+";";return n===!1?l:(0,u.importantify)(l)}).join("");return s?e+"{"+s+"}":""};t.generateCSSRuleset=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){var r=[],n=!0,o=!1,i=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(l){o=!0,i=l}finally{try{!n&&u["return"]&&u["return"]()}finally{if(o)throw i}}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=r(2),i=r(10),a={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,i.addRenderedClassNames)(e)}},u={renderStatic:function(e){(0,i.reset)(),(0,i.startBuffering)();var t=e(),r=(0,i.flushToString)();return{html:t,css:{content:r,renderedClassNames:(0,i.getRenderedClassNames)()}}}},l={suppressStyleInjection:function(){(0,i.reset)(),(0,i.startBuffering)()},clearBufferAndResumeStyleInjection:function(){(0,i.reset)()}},f=function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=!0;return(0,i.injectAndGetClassName)(n,t)};t["default"]={StyleSheet:a,StyleSheetServer:u,StyleSheetTestUtils:l,css:f},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 o=r(6),i=n(o),a=r(8),u=r(2),l=null,f=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))},c={fontFamily:function S(e){return Array.isArray(e)?e.map(S).join(","):"object"==typeof e?(y(e.fontFamily,"@font-face",[e],!1),'"'+e.fontFamily+'"'):e},animationName:function(e){if("object"!=typeof e)return e;var t="keyframe_"+(0,u.hashObject)(e),r="@keyframes "+t+"{";return Object.keys(e).forEach(function(t){r+=(0,a.generateCSS)(t,[e[t]],c,!1)}),r+="}",p(t,r),t}},s={},d="",m=!1,p=function(e,t){if(!s[e]){if(!m){if("undefined"==typeof document)throw new Error("Cannot automatically buffer without a document");m=!0,(0,i["default"])(g)}d+=t,s[e]=!0}},y=function(e,t,r,n){if(!s[e]){var o=(0,a.generateCSS)(t,r,c,n);p(e,o)}};t.injectStyleOnce=y;var h=function(){d="",s={},m=!1,l=null};t.reset=h;var b=function(){if(m)throw new Error("Cannot buffer while already buffering");m=!0};t.startBuffering=b;var v=function(){m=!1;var e=d;return d="",e};t.flushToString=v;var g=function(){var e=v();e.length>0&&f(e)};t.flushToStyleTag=g;var x=function(){return Object.keys(s)};t.getRenderedClassNames=x;var O=function(e){e.forEach(function(e){s[e]=!0})};t.addRenderedClassNames=O;var k=function(e,t){var r=t.filter(function(e){return e});if(0===r.length)return"";var n=r.map(function(e){return e._name}).join("-o_O-");return y(n,"."+n,r.map(function(e){return e._definition}),e),n};t.injectAndGetClassName=k},function(e,t){"use strict";function r(e){return e.replace(n,"-$&").toLowerCase().replace(o,"-ms-")}var n=/[A-Z]/g,o=/^ms-/;e.exports=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if("string"==typeof t&&t.indexOf("calc(")>-1){if((0,l["default"])(t))return;return(0,a["default"])(e,t,function(e,t){return t.replace(/calc\(/g,e+"calc(")})}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(3),l=n(u);e.exports=t["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){return"cursor"===e&&u[t]?(0,a["default"])(e,t):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};e.exports=t["default"]},function(e,t){"use strict";function r(e,t){return"display"===e&&n[t]?{display:["-webkit-box","-moz-box","-ms-"+t+"box","-webkit-"+t,t]}:void 0}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){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){return i[e]?r({},i[e],o[t]||t):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var o={"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){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){return"flexDirection"===e?{WebkitBoxOrient:t.indexOf("column")>-1?"vertical":"horizontal",WebkitBoxDirection:t.indexOf("reverse")>-1?"reverse":"normal"}:i[e]?r({},i[e],o[t]||t):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var o={"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 o(e,t){if("string"==typeof t&&null!==t.match(f)){if((0,l["default"])(t))return;return(0,a["default"])(e,t)}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(3),l=n(u),f=/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 o(e,t){return u[e]&&l[t]?(0,a["default"])(e,t):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},l={"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 o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){if("string"==typeof t&&y[e]){var r,n=a(t),i=n.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(e){return null===e.match(/-moz-|-ms-/)}).join(",");return e.indexOf("Webkit")>-1?o({},e,i):(r={},o(r,"Webkit"+(0,c["default"])(e),i),o(r,e,n),r)}}function a(e){if((0,d["default"])(e))return e;var t=e.split(/,(?![^()]*(?:\([^()]*\))?\))/g);return t.forEach(function(e,r){t[r]=Object.keys(p["default"]).reduce(function(t,r){var n="-"+r.toLowerCase()+"-";return Object.keys(p["default"][r]).forEach(function(r){var o=(0,l["default"])(r);e.indexOf(o)>-1&&"order"!==o&&(t=e.replace(o,n+o)+","+t)}),t},e)}),t.join(",")}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var u=r(11),l=n(u),f=r(5),c=n(f),s=r(3),d=n(s),m=r(4),p=n(m),y={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0};e.exports=t["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){return Object.keys(e).forEach(function(t){var r=e[t];r instanceof Object&&!Array.isArray(r)?e[t]=o(r):Array.isArray(r)?(0,d["default"])(e,i(t,r)):Object.keys(l["default"]).forEach(function(n){var o=l["default"][n];o[t]&&(e[n+(0,c["default"])(t)]=r)})}),Object.keys(e).forEach(function(t){var r=e[t];P.forEach(function(n){return(0,d["default"])(e,n(t,r))})}),e}function i(e,t){var r={};return t.forEach(function(t){P.forEach(function(n){var o=n(e,t);o&&Object.keys(o).forEach(function(e){var t=o[e];r[e]=r[e]?a(r[e],t):t})}),r[e]||(r[e]=t)}),r}function a(e,t){var r=e,n=Array.isArray(t)?t:[t];return n.forEach(function(e){Array.isArray(r)&&-1===r.indexOf(e)?r.push(e):r!==e&&(r=[r,e])}),r}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var u=r(4),l=n(u),f=r(5),c=n(f),s=r(21),d=n(s),m=r(12),p=n(m),y=r(13),h=n(y),b=r(14),v=n(b),g=r(18),x=n(g),O=r(17),k=n(O),S=r(19),j=n(S),w=r(15),_=n(w),C=r(16),A=n(C),P=[p["default"],h["default"],x["default"],k["default"],j["default"],_["default"],A["default"],v["default"]];e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return Object.keys(t).reduce(function(e,r){return e[r]=t[r],e},e)},e.exports=t["default"]},function(e,t,r){e.exports=r(20)}])}); | ||
!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 o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(9)},function(e,t){"use strict";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e,t){var n=arguments.length<=2||void 0===arguments[2]?function(e,t){return e+t}:arguments[2];return r({},e,["-webkit-","-moz-",""].map(function(e){return n(e,t)}))},e.exports=t["default"]},function(e,t){"use strict";function r(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}function n(e){for(var t=e.length,r=t,n=0,o=void 0;t>=4;)o=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24,o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16),o^=o>>>24,o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^o,t-=4,++n;switch(t){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r^=255&e.charCodeAt(n),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)}return r^=r>>>13,r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16),r^=r>>>15,(r>>>0).toString(36)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){var r=[],n=!0,o=!1,i=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(l){o=!0,i=l}finally{try{!n&&u["return"]&&u["return"]()}finally{if(o)throw i}}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},a=function(e){return Object.keys(e).map(function(t){return[t,e[t]]})};t.objectToPairs=a;var u=function(e){var t={};return e.forEach(function(e){var r=o(e,2),n=r[0],i=r[1];t[n]=i}),t},l=function(e,t){return u(a(e).map(t))};t.mapObj=l;var f=function(e){return e.reduce(function(e,t){return e.concat(t)},[])};t.flatten=f;var c=function k(e){return e.reduce(function(e,t){return e.concat(Array.isArray(t)?k(t):t)},[])};t.flattenDeep=c;var s=/([A-Z])/g,d=/^ms-/,p=function(e){return e.replace(s,"-$1").toLowerCase()},m=function(e){return p(e).replace(d,"-ms-")};t.kebabifyStyleName=m;var y=function S(e,t){if("object"!=typeof e)return t;var r=i({},e);return Object.keys(t).forEach(function(n){r.hasOwnProperty(n)?r[n]=S(e[n],t[n]):r[n]=t[n]}),r};t.recursiveMerge=y;var h={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},b=["Webkit","ms","Moz","O"];Object.keys(h).forEach(function(e){b.forEach(function(t){h[r(t,e)]=h[e]})});var v=function(e,t){return"number"==typeof t?h[e]?""+t:t+"px":t};t.stringifyValue=v;var g=function(e){return n(JSON.stringify(e))};t.hashObject=g;var x=/^([^:]+:.*?)( !important)?;$/,O=function(e){return e.replace(x,function(e,t,r){return t+" !important;"})};t.importantify=O},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return Array.isArray(e)&&(e=e.join(",")),null!==e.match(/-webkit-|-moz-|-ms-/)},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={Webkit:{transform:!0,transformOrigin:!0,transformOriginX:!0,transformOriginY:!0,backfaceVisibility:!0,perspective:!0,perspectiveOrigin:!0,transformStyle:!0,transformOriginZ:!0,animation:!0,animationDelay:!0,animationDirection:!0,animationFillMode:!0,animationDuration:!0,animationIterationCount:!0,animationName:!0,animationPlayState:!0,animationTimingFunction:!0,appearance:!0,userSelect:!0,fontKerning:!0,textEmphasisPosition:!0,textEmphasis:!0,textEmphasisStyle:!0,textEmphasisColor:!0,boxDecorationBreak:!0,clipPath:!0,maskImage:!0,maskMode:!0,maskRepeat:!0,maskPosition:!0,maskClip:!0,maskOrigin:!0,maskSize:!0,maskComposite:!0,mask:!0,maskBorderSource:!0,maskBorderMode:!0,maskBorderSlice:!0,maskBorderWidth:!0,maskBorderOutset:!0,maskBorderRepeat:!0,maskBorder:!0,maskType:!0,textDecorationStyle:!0,textDecorationSkip:!0,textDecorationLine:!0,textDecorationColor:!0,filter:!0,fontFeatureSettings:!0,breakAfter:!0,breakBefore:!0,breakInside:!0,columnCount:!0,columnFill:!0,columnGap:!0,columnRule:!0,columnRuleColor:!0,columnRuleStyle:!0,columnRuleWidth:!0,columns:!0,columnSpan:!0,columnWidth:!0,flex:!0,flexBasis:!0,flexDirection:!0,flexGrow:!0,flexFlow:!0,flexShrink:!0,flexWrap:!0,alignContent:!0,alignItems:!0,alignSelf:!0,justifyContent:!0,order:!0,transition:!0,transitionDelay:!0,transitionDuration:!0,transitionProperty:!0,transitionTimingFunction:!0,backdropFilter:!0,scrollSnapType:!0,scrollSnapPointsX:!0,scrollSnapPointsY:!0,scrollSnapDestination:!0,scrollSnapCoordinate:!0,shapeImageThreshold:!0,shapeImageMargin:!0,shapeImageOutside:!0,hyphens:!0,flowInto:!0,flowFrom:!0,regionFragment:!0,textSizeAdjust:!0,borderImage:!0,borderImageOutset:!0,borderImageRepeat:!0,borderImageSlice:!0,borderImageSource:!0,borderImageWidth:!0,tabSize:!0,objectFit:!0,objectPosition:!0},Moz:{appearance:!0,userSelect:!0,boxSizing:!0,textAlignLast:!0,textDecorationStyle:!0,textDecorationSkip:!0,textDecorationLine:!0,textDecorationColor:!0,tabSize:!0,hyphens:!0,fontFeatureSettings:!0,breakAfter:!0,breakBefore:!0,breakInside:!0,columnCount:!0,columnFill:!0,columnGap:!0,columnRule:!0,columnRuleColor:!0,columnRuleStyle:!0,columnRuleWidth:!0,columns:!0,columnSpan:!0,columnWidth:!0},ms:{flex:!0,flexBasis:!1,flexDirection:!0,flexGrow:!1,flexFlow:!0,flexShrink:!1,flexWrap:!0,alignContent:!1,alignItems:!1,alignSelf:!1,justifyContent:!1,order:!1,transform:!0,transformOrigin:!0,transformOriginX:!0,transformOriginY:!0,userSelect:!0,wrapFlow:!0,wrapThrough:!0,wrapMargin:!0,scrollSnapType:!0,scrollSnapPointsX:!0,scrollSnapPointsY:!0,scrollSnapDestination:!0,scrollSnapCoordinate:!0,touchAction:!0,hyphens:!0,flowInto:!0,flowFrom:!0,breakBefore:!0,breakAfter:!0,breakInside:!0,regionFragment:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridTemplate:!0,gridAutoColumns:!0,gridAutoRows:!0,gridAutoFlow:!0,grid:!0,gridRowStart:!0,gridColumnStart:!0,gridRowEnd:!0,gridRow:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnGap:!0,gridRowGap:!0,gridArea:!0,gridGap:!0,textSizeAdjust:!0}},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},e.exports=t["default"]},function(e,t,r){"use strict";function n(){if(l.length)throw l.shift()}function o(e){var t;t=u.length?u.pop():new i,t.task=e,a(t)}function i(){this.task=null}var a=r(7),u=[],l=[],f=a.makeRequestCallFromTimer(n);e.exports=o,i.prototype.call=function(){try{this.task.call()}catch(e){o.onerror?o.onerror(e):(l.push(e),f())}finally{this.task=null,u[u.length]=this}}},function(e,t){(function(t){"use strict";function r(e){u.length||(a(),l=!0),u[u.length]=e}function n(){for(;f<u.length;){var e=f;if(f+=1,u[e].call(),f>c){for(var t=0,r=u.length-f;r>t;t++)u[t]=u[t+f];u.length-=f,f=0}}u.length=0,f=0,l=!1}function o(e){var t=1,r=new s(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}function i(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=[],l=!1,f=0,c=1024,s=t.MutationObserver||t.WebKitMutationObserver;a="function"==typeof s?o(n):i(n),r.requestFlush=a,r.makeRequestCallFromTimer=i}).call(t,function(){return this}())},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){var r=[],n=!0,o=!1,i=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(l){o=!0,i=l}finally{try{!n&&u["return"]&&u["return"]()}finally{if(o)throw i}}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=r(22),a=n(i),u=r(2),l=function s(e,t,r,n){var o=t.reduce(u.recursiveMerge),i={},a={},l={};return Object.keys(o).forEach(function(e){":"===e[0]?l[e]=o[e]:"@"===e[0]?a[e]=o[e]:i[e]=o[e]}),c(e,i,r,n)+Object.keys(l).map(function(t){return c(e+t,l[t],r,n)}).join("")+Object.keys(a).map(function(t){var o=s(e,[a[t]],r,n);return t+"{"+o+"}"}).join("")};t.generateCSS=l;var f=function(e,t){var r={};return Object.keys(e).forEach(function(n){t&&t.hasOwnProperty(n)?r[n]=t[n](e[n]):r[n]=e[n]}),r},c=function(e,t,r,n){var i=f(t,r),l=(0,a["default"])(i),c=(0,u.flatten)((0,u.objectToPairs)(l).map(function(e){var t=o(e,2),r=t[0],n=t[1];if(Array.isArray(n)){var i=function(){var e=[],t=[];return n.forEach(function(r){0===r.indexOf("-")?e.push(r):t.push(r)}),e.sort(),t.sort(),{v:e.concat(t).map(function(e){return[r,e]})}}();if("object"==typeof i)return i.v}return[[r,n]]})),s=c.map(function(e){var t=o(e,2),r=t[0],i=t[1],a=(0,u.stringifyValue)(r,i),l=(0,u.kebabifyStyleName)(r)+":"+a+";";return n===!1?l:(0,u.importantify)(l)}).join("");return s?e+"{"+s+"}":""};t.generateCSSRuleset=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){var r=[],n=!0,o=!1,i=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(l){o=!0,i=l}finally{try{!n&&u["return"]&&u["return"]()}finally{if(o)throw i}}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=r(2),i=r(10),a={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,i.addRenderedClassNames)(e)}},u={renderStatic:function(e){(0,i.reset)(),(0,i.startBuffering)();var t=e(),r=(0,i.flushToString)();return{html:t,css:{content:r,renderedClassNames:(0,i.getRenderedClassNames)()}}}},l={suppressStyleInjection:function(){(0,i.reset)(),(0,i.startBuffering)()},clearBufferAndResumeStyleInjection:function(){(0,i.reset)()}},f=function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=!0;return(0,i.injectAndGetClassName)(n,t)};t["default"]={StyleSheet:a,StyleSheetServer:u,StyleSheetTestUtils:l,css:f},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 o=r(6),i=n(o),a=r(8),u=r(2),l=null,f=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))},c={fontFamily:function S(e){return Array.isArray(e)?e.map(S).join(","):"object"==typeof e?(y(e.src,"@font-face",[e],!1),'"'+e.fontFamily+'"'):e},animationName:function(e){if("object"!=typeof e)return e;var t="keyframe_"+(0,u.hashObject)(e),r="@keyframes "+t+"{";return Object.keys(e).forEach(function(t){r+=(0,a.generateCSS)(t,[e[t]],c,!1)}),r+="}",m(t,r),t}},s={},d="",p=!1,m=function(e,t){if(!s[e]){if(!p){if("undefined"==typeof document)throw new Error("Cannot automatically buffer without a document");p=!0,(0,i["default"])(g)}d+=t,s[e]=!0}},y=function(e,t,r,n){if(!s[e]){var o=(0,a.generateCSS)(t,r,c,n);m(e,o)}};t.injectStyleOnce=y;var h=function(){d="",s={},p=!1,l=null};t.reset=h;var b=function(){if(p)throw new Error("Cannot buffer while already buffering");p=!0};t.startBuffering=b;var v=function(){p=!1;var e=d;return d="",e};t.flushToString=v;var g=function(){var e=v();e.length>0&&f(e)};t.flushToStyleTag=g;var x=function(){return Object.keys(s)};t.getRenderedClassNames=x;var O=function(e){e.forEach(function(e){s[e]=!0})};t.addRenderedClassNames=O;var k=function(e,t){t=(0,u.flattenDeep)(t);var r=t.filter(function(e){return e});if(0===r.length)return"";var n=r.map(function(e){return e._name}).join("-o_O-");return y(n,"."+n,r.map(function(e){return e._definition}),e),n};t.injectAndGetClassName=k},function(e,t){"use strict";function r(e){return e.replace(n,"-$&").toLowerCase().replace(o,"-ms-")}var n=/[A-Z]/g,o=/^ms-/;e.exports=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if("string"==typeof t&&t.indexOf("calc(")>-1){if((0,l["default"])(t))return;return(0,a["default"])(e,t,function(e,t){return t.replace(/calc\(/g,e+"calc(")})}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(3),l=n(u);e.exports=t["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){return"cursor"===e&&u[t]?(0,a["default"])(e,t):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};e.exports=t["default"]},function(e,t){"use strict";function r(e,t){return"display"===e&&n[t]?{display:["-webkit-box","-moz-box","-ms-"+t+"box","-webkit-"+t,t]}:void 0}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){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){return i[e]?r({},i[e],o[t]||t):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var o={"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){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){return"flexDirection"===e?{WebkitBoxOrient:t.indexOf("column")>-1?"vertical":"horizontal",WebkitBoxDirection:t.indexOf("reverse")>-1?"reverse":"normal"}:i[e]?r({},i[e],o[t]||t):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var o={"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 o(e,t){if("string"==typeof t&&null!==t.match(f)){if((0,l["default"])(t))return;return(0,a["default"])(e,t)}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(3),l=n(u),f=/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 o(e,t){return u[e]&&l[t]?(0,a["default"])(e,t):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},l={"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 o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){if("string"==typeof t&&y[e]){var r,n=a(t),i=n.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(e){return null===e.match(/-moz-|-ms-/)}).join(",");return e.indexOf("Webkit")>-1?o({},e,i):(r={},o(r,"Webkit"+(0,c["default"])(e),i),o(r,e,n),r)}}function a(e){if((0,d["default"])(e))return e;var t=e.split(/,(?![^()]*(?:\([^()]*\))?\))/g);return t.forEach(function(e,r){t[r]=Object.keys(m["default"]).reduce(function(t,r){var n="-"+r.toLowerCase()+"-";return Object.keys(m["default"][r]).forEach(function(r){var o=(0,l["default"])(r);e.indexOf(o)>-1&&"order"!==o&&(t=e.replace(o,n+o)+","+t)}),t},e)}),t.join(",")}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var u=r(11),l=n(u),f=r(5),c=n(f),s=r(3),d=n(s),p=r(4),m=n(p),y={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0};e.exports=t["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){return Object.keys(e).forEach(function(t){var r=e[t];r instanceof Object&&!Array.isArray(r)?e[t]=o(r):Array.isArray(r)?(0,d["default"])(e,i(t,r)):Object.keys(l["default"]).forEach(function(n){var o=l["default"][n];o[t]&&(e[n+(0,c["default"])(t)]=r)})}),Object.keys(e).forEach(function(t){var r=e[t];P.forEach(function(n){return(0,d["default"])(e,n(t,r))})}),e}function i(e,t){var r={};return t.forEach(function(t){P.forEach(function(n){var o=n(e,t);o&&Object.keys(o).forEach(function(e){var t=o[e];r[e]=r[e]?a(r[e],t):t})}),r[e]||(r[e]=t)}),r}function a(e,t){var r=e,n=Array.isArray(t)?t:[t];return n.forEach(function(e){Array.isArray(r)&&-1===r.indexOf(e)?r.push(e):r!==e&&(r=[r,e])}),r}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var u=r(4),l=n(u),f=r(5),c=n(f),s=r(21),d=n(s),p=r(12),m=n(p),y=r(13),h=n(y),b=r(14),v=n(b),g=r(18),x=n(g),O=r(17),k=n(O),S=r(19),j=n(S),w=r(15),_=n(w),C=r(16),A=n(C),P=[m["default"],h["default"],x["default"],k["default"],j["default"],_["default"],A["default"],v["default"]];e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return Object.keys(t).reduce(function(e,r){return e[r]=t[r],e},e)},e.exports=t["default"]},function(e,t,r){e.exports=r(20)}])}); | ||
//# sourceMappingURL=aphrodite.umd.min.js.map |
@@ -64,3 +64,3 @@ 'use strict'; | ||
} else if (typeof val === "object") { | ||
injectStyleOnce(val.fontFamily, "@font-face", [val], false); | ||
injectStyleOnce(val.src, "@font-face", [val], false); | ||
return '"' + val.fontFamily + '"'; | ||
@@ -208,6 +208,9 @@ } else { | ||
* CSS output. e.g. {color: red} -> "color: red !important". | ||
* @param {Object[]} styleDefinitions style definition objects as returned as | ||
* properties of the return value of StyleSheet.create(). | ||
* @param {(Object|Object[])[]} styleDefinitions style definition objects, or | ||
* arbitrarily nested arrays of them, as returned as properties of the | ||
* return value of StyleSheet.create(). | ||
*/ | ||
var injectAndGetClassName = function injectAndGetClassName(useImportant, styleDefinitions) { | ||
styleDefinitions = (0, _util.flattenDeep)(styleDefinitions); | ||
// Filter out falsy values from the input, to allow for | ||
@@ -214,0 +217,0 @@ // `css(a, test && c)` |
@@ -47,2 +47,9 @@ // {K1: V1, K2: V2, ...} -> [[K1, V1], [K2, V2]] | ||
exports.flatten = flatten; | ||
var flattenDeep = function flattenDeep(list) { | ||
return list.reduce(function (memo, x) { | ||
return memo.concat(Array.isArray(x) ? flattenDeep(x) : x); | ||
}, []); | ||
}; | ||
exports.flattenDeep = flattenDeep; | ||
var UPPERCASE_RE = /([A-Z])/g; | ||
@@ -49,0 +56,0 @@ var MS_RE = /^ms-/; |
{ | ||
"name": "aphrodite", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Inline styles in JS that just work (TM)", | ||
@@ -55,3 +55,4 @@ "keywords": [ | ||
"inline-style-prefixer": "^2.0.0" | ||
} | ||
}, | ||
"tonicExampleFilename": "examples/runkit.js" | ||
} |
@@ -30,3 +30,5 @@ # Aphrodite: Inline Styles that work | ||
```js | ||
If you'd rather watch introductory videos, you can find them [here](https://www.youtube.com/playlist?list=PLo4Zh55ZzNSBP78pCD0dZJi9zf8CA72_M). | ||
```jsx | ||
import React, { Component } from 'react'; | ||
@@ -81,2 +83,53 @@ import { StyleSheet, css } from 'aphrodite'; | ||
## Conditionally Applying Styles | ||
Note: If you want to conditionally use styles, that is simply accomplished via: | ||
```jsx | ||
const className = css( | ||
shouldBeRed() ? styles.red : styles.blue, | ||
shouldBeResponsive() && styles.small, | ||
shouldBeHoverable() && styles.hover | ||
) | ||
<div className={className}>Hi</div> | ||
``` | ||
This is possible because any falsey arguments will be ignored. | ||
## Combining Styles | ||
To combine styles, pass multiple styles or arrays of styles into `css()`. This is common when combining styles from an owner component: | ||
```jsx | ||
class App extends Component { | ||
render() { | ||
return <Marker styles={[styles.large, styles.red]} />; | ||
} | ||
} | ||
class Marker extends Component { | ||
render() { | ||
// css() accepts styles, arrays of styles (including nested arrays), | ||
// and falsy values including undefined. | ||
return <div className={css(styles.marker, this.props.styles)} />; | ||
} | ||
} | ||
const styles = StyleSheet.create({ | ||
red: { | ||
backgroundColor: 'red' | ||
}, | ||
large: { | ||
height: 20, | ||
width: 20 | ||
}, | ||
marker: { | ||
backgroundColor: 'blue' | ||
} | ||
}; | ||
``` | ||
## Server-side rendering | ||
@@ -193,3 +246,3 @@ | ||
```js | ||
import { StyleSheetServer, css } from 'aphrodite'; | ||
import { StyleSheet, css } from 'aphrodite'; | ||
@@ -196,0 +249,0 @@ class Component extends React.Component { |
import asap from 'asap'; | ||
import {generateCSS} from './generate'; | ||
import {hashObject} from './util'; | ||
import {flattenDeep, hashObject} from './util'; | ||
@@ -53,3 +53,3 @@ // The current <style> tag we are inserting into, or null if we haven't | ||
} else if (typeof val === "object") { | ||
injectStyleOnce(val.fontFamily, "@font-face", [val], false); | ||
injectStyleOnce(val.src, "@font-face", [val], false); | ||
return `"${val.fontFamily}"`; | ||
@@ -193,6 +193,9 @@ } else { | ||
* CSS output. e.g. {color: red} -> "color: red !important". | ||
* @param {Object[]} styleDefinitions style definition objects as returned as | ||
* properties of the return value of StyleSheet.create(). | ||
* @param {(Object|Object[])[]} styleDefinitions style definition objects, or | ||
* arbitrarily nested arrays of them, as returned as properties of the | ||
* return value of StyleSheet.create(). | ||
*/ | ||
export const injectAndGetClassName = (useImportant, styleDefinitions) => { | ||
styleDefinitions = flattenDeep(styleDefinitions); | ||
// Filter out falsy values from the input, to allow for | ||
@@ -199,0 +202,0 @@ // `css(a, test && c)` |
@@ -19,2 +19,5 @@ // {K1: V1, K2: V2, ...} -> [[K1, V1], [K2, V2]] | ||
export const flattenDeep = (list) => | ||
list.reduce((memo, x) => memo.concat(Array.isArray(x) ? flattenDeep(x) : x), []); | ||
const UPPERCASE_RE = /([A-Z])/g; | ||
@@ -21,0 +24,0 @@ const MS_RE = /^ms-/; |
@@ -49,2 +49,19 @@ import asap from 'asap'; | ||
it('accepts arrays of styles', () => { | ||
const sheet = StyleSheet.create({ | ||
red: { | ||
color: 'red', | ||
}, | ||
blue: { | ||
color: 'blue' | ||
} | ||
}); | ||
assert.equal(css(sheet.red, sheet.blue), css([sheet.red, sheet.blue])); | ||
assert.equal(css(sheet.red, sheet.blue), css(sheet.red, [sheet.blue])); | ||
assert.equal(css(sheet.red, sheet.blue), css([sheet.red, [sheet.blue]])); | ||
assert.equal(css(sheet.red), css(false, [null, false, sheet.red])); | ||
}); | ||
it('succeeds for with empty args', () => { | ||
@@ -352,2 +369,51 @@ assert(css() != null); | ||
}); | ||
it('should inject unique font-faces by src', () => { | ||
const fontSheet = StyleSheet.create({ | ||
test: { | ||
fontFamily: [{ | ||
fontStyle: "normal", | ||
fontWeight: "normal", | ||
fontFamily: "My Font", | ||
src: 'url(blah) format("woff"), url(blah) format("truetype")' | ||
}, { | ||
fontStyle: "italic", | ||
fontWeight: "normal", | ||
fontFamily: "My Font", | ||
src: 'url(blahitalic) format("woff"), url(blahitalic) format("truetype")' | ||
}], | ||
}, | ||
anotherTest: { | ||
fontFamily: [{ | ||
fontStyle: "normal", | ||
fontWeight: "normal", | ||
fontFamily: "My Font", | ||
src: 'url(blah) format("woff"), url(blah) format("truetype")' | ||
}, { | ||
fontStyle: "normal", | ||
fontWeight: "normal", | ||
fontFamily: "My Other Font", | ||
src: 'url(other-font) format("woff"), url(other-font) format("truetype")', | ||
}], | ||
}, | ||
}); | ||
const render = () => { | ||
css(fontSheet.test); | ||
css(fontSheet.anotherTest); | ||
return "html!"; | ||
}; | ||
const ret = StyleSheetServer.renderStatic(render); | ||
// 3 unique @font-faces should be added | ||
assert.equal(3, ret.css.content.match(/@font\-face/g).length); | ||
assert.include(ret.css.content, "font-style:normal"); | ||
assert.include(ret.css.content, "font-style:italic"); | ||
assert.include(ret.css.content, 'font-family:"My Font"'); | ||
assert.include(ret.css.content, 'font-family:"My Font","My Other Font"'); | ||
}); | ||
}); | ||
@@ -354,0 +420,0 @@ |
import {assert} from 'chai'; | ||
import {recursiveMerge} from '../src/util.js'; | ||
import {flattenDeep, recursiveMerge} from '../src/util.js'; | ||
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', () => { | ||
@@ -7,0 +15,0 @@ it('merges two objects', () => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
920991
40
5393
334