Comparing version 0.3.3 to 0.4.0
@@ -91,2 +91,5 @@ module.exports = | ||
/** | ||
* Utilities for using Aphrodite server-side. | ||
*/ | ||
var StyleSheetServer = { | ||
@@ -109,2 +112,32 @@ renderStatic: function renderStatic(renderFunc) { | ||
/** | ||
* Utilities for using Aphrodite in tests. | ||
* | ||
* Not meant to be used in production. | ||
*/ | ||
var StyleSheetTestUtils = { | ||
/** | ||
* Prevent styles from being injected into the DOM. | ||
* | ||
* This is useful in situations where you'd like to test rendering UI | ||
* components which use Aphrodite without any of the side-effects of | ||
* Aphrodite happening. Particularly useful for testing the output of | ||
* components when you have no DOM, e.g. testing in Node without a fake DOM. | ||
* | ||
* Should be paired with a subsequent call to | ||
* clearBufferAndResumeStyleInjection. | ||
*/ | ||
suppressStyleInjection: function suppressStyleInjection() { | ||
(0, _inject.reset)(); | ||
(0, _inject.startBuffering)(); | ||
}, | ||
/** | ||
* Opposite method of preventStyleInject. | ||
*/ | ||
clearBufferAndResumeStyleInjection: function clearBufferAndResumeStyleInjection() { | ||
(0, _inject.reset)(); | ||
} | ||
}; | ||
var css = function css() { | ||
@@ -139,2 +172,3 @@ for (var _len = arguments.length, styleDefinitions = Array(_len), _key = 0; _key < _len; _key++) { | ||
StyleSheetServer: StyleSheetServer, | ||
StyleSheetTestUtils: StyleSheetTestUtils, | ||
css: css | ||
@@ -905,2 +939,46 @@ }; | ||
/** | ||
* Generate CSS for a selector and some styles. | ||
* | ||
* This function handles the media queries, pseudo selectors, and descendant | ||
* styles that can be used in aphrodite styles. | ||
* | ||
* @param {string} selector: A base CSS selector for the styles to be generated | ||
* with. | ||
* @param {Object} styleTypes: A list of properties of the return type of | ||
* StyleSheet.create, e.g. [styles.red, styles.blue]. | ||
* @param stringHandlers: See `generateCSSRuleset` | ||
* @param useImportant: See `generateCSSRuleset` | ||
* | ||
* To actually generate the CSS special-construct-less styles are passed to | ||
* `generateCSSRuleset`. | ||
* | ||
* For instance, a call to | ||
* | ||
* generateCSSInner(".foo", { | ||
* color: "red", | ||
* "@media screen": { | ||
* height: 20, | ||
* ":hover": { | ||
* backgroundColor: "black" | ||
* } | ||
* }, | ||
* ":active": { | ||
* fontWeight: "bold", | ||
* ">>bar": { | ||
* _names: { "foo_bar": true }, | ||
* height: 10, | ||
* } | ||
* } | ||
* }); | ||
* | ||
* will make 5 calls to `generateCSSRuleset`: | ||
* | ||
* generateCSSRuleset(".foo", { color: "red" }, ...) | ||
* generateCSSRuleset(".foo:active", { fontWeight: "bold" }, ...) | ||
* generateCSSRuleset(".foo:active .foo_bar", { height: 10 }, ...) | ||
* // These 2 will be wrapped in @media screen {} | ||
* generateCSSRuleset(".foo", { height: 20 }, ...) | ||
* generateCSSRuleset(".foo:hover", { backgroundColor: "black" }, ...) | ||
*/ | ||
var generateCSS = function generateCSS(selector, styleTypes, stringHandlers, useImportant) { | ||
@@ -932,2 +1010,8 @@ var merged = styleTypes.reduce(_util.recursiveMerge); | ||
exports.generateCSS = generateCSS; | ||
/** | ||
* Helper method of generateCSSRuleset to facilitate custom handling of certain | ||
* CSS properties. Used for e.g. font families. | ||
* | ||
* See generateCSSRuleset for usage and documentation of paramater types. | ||
*/ | ||
var runStringHandlers = function runStringHandlers(declarations, stringHandlers) { | ||
@@ -949,2 +1033,33 @@ var result = {}; | ||
/** | ||
* Generate a CSS ruleset with the selector and containing the declarations. | ||
* | ||
* This function assumes that the given declarations don't contain any special | ||
* children (such as media queries, pseudo-selectors, or descendant styles). | ||
* | ||
* Note that this method does not deal with nesting used for e.g. | ||
* psuedo-selectors or media queries. That responsibility is left to the | ||
* `generateCSS` function. | ||
* | ||
* @param {string} selector: the selector associated with the ruleset | ||
* @param {Object} declarations: a map from camelCased CSS property name to CSS | ||
* property value. | ||
* @param {Object.<string, function>} stringHandlers: a map from camelCased CSS | ||
* property name to a function which will map the given value to the value | ||
* that is output. | ||
* @param {bool} useImportant: A boolean saying whether to append "!important" | ||
* to each of the CSS declarations. | ||
* @returns {string} A string of raw CSS. | ||
* | ||
* Examples: | ||
* | ||
* generateCSSRuleset(".blah", { color: "red" }) | ||
* -> ".blah{color: red !important;}" | ||
* generateCSSRuleset(".blah", { color: "red" }, {}, false) | ||
* -> ".blah{color: red}" | ||
* generateCSSRuleset(".blah", { color: "red" }, {color: c => c.toUpperCase}) | ||
* -> ".blah{color: RED}" | ||
* generateCSSRuleset(".blah:hover", { color: "red" }) | ||
* -> ".blah:hover{color: red}" | ||
*/ | ||
var generateCSSRuleset = function generateCSSRuleset(selector, declarations, stringHandlers, useImportant) { | ||
@@ -951,0 +1066,0 @@ var handledDeclarations = runStringHandlers(declarations, stringHandlers); |
@@ -100,2 +100,5 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/** | ||
* Utilities for using Aphrodite server-side. | ||
*/ | ||
var StyleSheetServer = { | ||
@@ -118,2 +121,32 @@ renderStatic: function renderStatic(renderFunc) { | ||
/** | ||
* Utilities for using Aphrodite in tests. | ||
* | ||
* Not meant to be used in production. | ||
*/ | ||
var StyleSheetTestUtils = { | ||
/** | ||
* Prevent styles from being injected into the DOM. | ||
* | ||
* This is useful in situations where you'd like to test rendering UI | ||
* components which use Aphrodite without any of the side-effects of | ||
* Aphrodite happening. Particularly useful for testing the output of | ||
* components when you have no DOM, e.g. testing in Node without a fake DOM. | ||
* | ||
* Should be paired with a subsequent call to | ||
* clearBufferAndResumeStyleInjection. | ||
*/ | ||
suppressStyleInjection: function suppressStyleInjection() { | ||
(0, _inject.reset)(); | ||
(0, _inject.startBuffering)(); | ||
}, | ||
/** | ||
* Opposite method of preventStyleInject. | ||
*/ | ||
clearBufferAndResumeStyleInjection: function clearBufferAndResumeStyleInjection() { | ||
(0, _inject.reset)(); | ||
} | ||
}; | ||
var css = function css() { | ||
@@ -148,2 +181,3 @@ for (var _len = arguments.length, styleDefinitions = Array(_len), _key = 0; _key < _len; _key++) { | ||
StyleSheetServer: StyleSheetServer, | ||
StyleSheetTestUtils: StyleSheetTestUtils, | ||
css: css | ||
@@ -914,2 +948,46 @@ }; | ||
/** | ||
* Generate CSS for a selector and some styles. | ||
* | ||
* This function handles the media queries, pseudo selectors, and descendant | ||
* styles that can be used in aphrodite styles. | ||
* | ||
* @param {string} selector: A base CSS selector for the styles to be generated | ||
* with. | ||
* @param {Object} styleTypes: A list of properties of the return type of | ||
* StyleSheet.create, e.g. [styles.red, styles.blue]. | ||
* @param stringHandlers: See `generateCSSRuleset` | ||
* @param useImportant: See `generateCSSRuleset` | ||
* | ||
* To actually generate the CSS special-construct-less styles are passed to | ||
* `generateCSSRuleset`. | ||
* | ||
* For instance, a call to | ||
* | ||
* generateCSSInner(".foo", { | ||
* color: "red", | ||
* "@media screen": { | ||
* height: 20, | ||
* ":hover": { | ||
* backgroundColor: "black" | ||
* } | ||
* }, | ||
* ":active": { | ||
* fontWeight: "bold", | ||
* ">>bar": { | ||
* _names: { "foo_bar": true }, | ||
* height: 10, | ||
* } | ||
* } | ||
* }); | ||
* | ||
* will make 5 calls to `generateCSSRuleset`: | ||
* | ||
* generateCSSRuleset(".foo", { color: "red" }, ...) | ||
* generateCSSRuleset(".foo:active", { fontWeight: "bold" }, ...) | ||
* generateCSSRuleset(".foo:active .foo_bar", { height: 10 }, ...) | ||
* // These 2 will be wrapped in @media screen {} | ||
* generateCSSRuleset(".foo", { height: 20 }, ...) | ||
* generateCSSRuleset(".foo:hover", { backgroundColor: "black" }, ...) | ||
*/ | ||
var generateCSS = function generateCSS(selector, styleTypes, stringHandlers, useImportant) { | ||
@@ -941,2 +1019,8 @@ var merged = styleTypes.reduce(_util.recursiveMerge); | ||
exports.generateCSS = generateCSS; | ||
/** | ||
* Helper method of generateCSSRuleset to facilitate custom handling of certain | ||
* CSS properties. Used for e.g. font families. | ||
* | ||
* See generateCSSRuleset for usage and documentation of paramater types. | ||
*/ | ||
var runStringHandlers = function runStringHandlers(declarations, stringHandlers) { | ||
@@ -958,2 +1042,33 @@ var result = {}; | ||
/** | ||
* Generate a CSS ruleset with the selector and containing the declarations. | ||
* | ||
* This function assumes that the given declarations don't contain any special | ||
* children (such as media queries, pseudo-selectors, or descendant styles). | ||
* | ||
* Note that this method does not deal with nesting used for e.g. | ||
* psuedo-selectors or media queries. That responsibility is left to the | ||
* `generateCSS` function. | ||
* | ||
* @param {string} selector: the selector associated with the ruleset | ||
* @param {Object} declarations: a map from camelCased CSS property name to CSS | ||
* property value. | ||
* @param {Object.<string, function>} stringHandlers: a map from camelCased CSS | ||
* property name to a function which will map the given value to the value | ||
* that is output. | ||
* @param {bool} useImportant: A boolean saying whether to append "!important" | ||
* to each of the CSS declarations. | ||
* @returns {string} A string of raw CSS. | ||
* | ||
* Examples: | ||
* | ||
* generateCSSRuleset(".blah", { color: "red" }) | ||
* -> ".blah{color: red !important;}" | ||
* generateCSSRuleset(".blah", { color: "red" }, {}, false) | ||
* -> ".blah{color: red}" | ||
* generateCSSRuleset(".blah", { color: "red" }, {color: c => c.toUpperCase}) | ||
* -> ".blah{color: RED}" | ||
* generateCSSRuleset(".blah:hover", { color: "red" }) | ||
* -> ".blah:hover{color: red}" | ||
*/ | ||
var generateCSSRuleset = function generateCSSRuleset(selector, declarations, stringHandlers, useImportant) { | ||
@@ -960,0 +1075,0 @@ var handledDeclarations = runStringHandlers(declarations, stringHandlers); |
@@ -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(10)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return e.replace(/([a-z]|^)([A-Z])/g,function(e,t,r){return t+"-"+r.toLowerCase()}).replace("ms-","-ms-")},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}Object.defineProperty(t,"__esModule",{value:!0});var i=r(1);n(i);t["default"]=function(e,t){var r=arguments.length<=2||void 0===arguments[2]?function(e,t){return e+t}:arguments[2];return function(){return o({},e,["-webkit-","-moz-",""].map(function(e){return r(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},b=["Webkit","ms","Moz","O"];Object.keys(y).forEach(function(e){b.forEach(function(t){y[r(t,e)]=y[e]})});var h=function(e,t){return"number"==typeof t?y[e]?""+t:t+"px":t};t.stringifyValue=h;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(8),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(20),a=n(i),u=r(3),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(3),i=r(11),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=function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=t.filter(function(e){return e});if(0===n.length)return"";var o=n.map(function(e){return e._name}).join("-o_O-");return(0,i.injectStyleOnce)(o,"."+o,n.map(function(e){return e._definition})),o};t["default"]={StyleSheet:a,StyleSheetServer:u,css:l},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(7),i=n(o),a=r(9),u=r(3),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 k(e){return Array.isArray(e)?e.map(k).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 b=function(){d="",s={},m=!1,l=null};t.reset=b;var h=function(){if(m)throw new Error("Cannot buffer while already buffering");m=!0};t.startBuffering=h;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},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(2),a=n(i),u=r(4),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(2),a=n(i),u={"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 o(e,t){return"display"===e&&a[t]?{display:["-webkit-box","-moz-box","-ms-"+t+"box","-webkit-"+t,t]}:void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=(n(i),{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,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){return"flexDirection"===e?{WebkitBoxOrient:t.indexOf("column")>-1?"vertical":"horizontal",WebkitBoxDirection:t.indexOf("reverse")>-1?"reverse":"normal"}:l[e]?o({},l[e],u[t]||t):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var a=r(1),u=(n(a),{"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"}),l={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(2),a=n(i),u=r(4),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(2),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(",").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&&(t=e.replace(o,n+o)+","+t)}),t},e)}),t.join(",")}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var u=r(1),l=n(u),f=r(6),c=n(f),s=r(4),d=n(s),m=r(5),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).reduce(function(t,r){var n=e[r];return n instanceof Object&&!Array.isArray(n)?t[r]=o(n):(Object.keys(a["default"]).forEach(function(e){var o=a["default"][e];o[r]&&(t[e+(0,l["default"])(r)]=n)}),C.forEach(function(e){return(0,c["default"])(t,e(r,n))})),t},e)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(5),a=n(i),u=r(6),l=n(u),f=r(21),c=n(f),s=r(12),d=n(s),m=r(13),p=n(m),y=r(14),b=n(y),h=r(18),v=n(h),g=r(17),x=n(g),O=r(19),k=n(O),S=r(15),j=n(S),_=r(16),w=n(_),C=[d["default"],p["default"],v["default"],x["default"],k["default"],j["default"],w["default"],b["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(r,n){return e[n]=t[n],r},{})},e.exports=t["default"]}])}); | ||
!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(10)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){return e.replace(/([a-z]|^)([A-Z])/g,function(e,t,r){return t+"-"+r.toLowerCase()}).replace("ms-","-ms-")},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}Object.defineProperty(t,"__esModule",{value:!0});var i=r(1);n(i);t["default"]=function(e,t){var r=arguments.length<=2||void 0===arguments[2]?function(e,t){return e+t}:arguments[2];return function(){return o({},e,["-webkit-","-moz-",""].map(function(e){return r(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},b=["Webkit","ms","Moz","O"];Object.keys(y).forEach(function(e){b.forEach(function(t){y[r(t,e)]=y[e]})});var h=function(e,t){return"number"==typeof t?y[e]?""+t:t+"px":t};t.stringifyValue=h;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(8),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(20),a=n(i),u=r(3),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(3),i=r(11),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=t.filter(function(e){return e});if(0===n.length)return"";var o=n.map(function(e){return e._name}).join("-o_O-");return(0,i.injectStyleOnce)(o,"."+o,n.map(function(e){return e._definition})),o};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(7),i=n(o),a=r(9),u=r(3),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 b=function(){d="",s={},m=!1,l=null};t.reset=b;var h=function(){if(m)throw new Error("Cannot buffer while already buffering");m=!0};t.startBuffering=h;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},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(2),a=n(i),u=r(4),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(2),a=n(i),u={"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 o(e,t){return"display"===e&&a[t]?{display:["-webkit-box","-moz-box","-ms-"+t+"box","-webkit-"+t,t]}:void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=(n(i),{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,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){return"flexDirection"===e?{WebkitBoxOrient:t.indexOf("column")>-1?"vertical":"horizontal",WebkitBoxDirection:t.indexOf("reverse")>-1?"reverse":"normal"}:l[e]?o({},l[e],u[t]||t):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var a=r(1),u=(n(a),{"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"}),l={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(2),a=n(i),u=r(4),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(2),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(",").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&&(t=e.replace(o,n+o)+","+t)}),t},e)}),t.join(",")}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var u=r(1),l=n(u),f=r(6),c=n(f),s=r(4),d=n(s),m=r(5),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).reduce(function(t,r){var n=e[r];return n instanceof Object&&!Array.isArray(n)?t[r]=o(n):(Object.keys(a["default"]).forEach(function(e){var o=a["default"][e];o[r]&&(t[e+(0,l["default"])(r)]=n)}),C.forEach(function(e){return(0,c["default"])(t,e(r,n))})),t},e)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(5),a=n(i),u=r(6),l=n(u),f=r(21),c=n(f),s=r(12),d=n(s),m=r(13),p=n(m),y=r(14),b=n(y),h=r(18),v=n(h),g=r(17),x=n(g),O=r(19),S=n(O),k=r(15),j=n(k),_=r(16),w=n(_),C=[d["default"],p["default"],v["default"],x["default"],S["default"],j["default"],w["default"],b["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(r,n){return e[n]=t[n],r},{})},e.exports=t["default"]}])}); | ||
//# sourceMappingURL=aphrodite.umd.min.js.map |
@@ -17,2 +17,46 @@ 'use strict'; | ||
/** | ||
* Generate CSS for a selector and some styles. | ||
* | ||
* This function handles the media queries, pseudo selectors, and descendant | ||
* styles that can be used in aphrodite styles. | ||
* | ||
* @param {string} selector: A base CSS selector for the styles to be generated | ||
* with. | ||
* @param {Object} styleTypes: A list of properties of the return type of | ||
* StyleSheet.create, e.g. [styles.red, styles.blue]. | ||
* @param stringHandlers: See `generateCSSRuleset` | ||
* @param useImportant: See `generateCSSRuleset` | ||
* | ||
* To actually generate the CSS special-construct-less styles are passed to | ||
* `generateCSSRuleset`. | ||
* | ||
* For instance, a call to | ||
* | ||
* generateCSSInner(".foo", { | ||
* color: "red", | ||
* "@media screen": { | ||
* height: 20, | ||
* ":hover": { | ||
* backgroundColor: "black" | ||
* } | ||
* }, | ||
* ":active": { | ||
* fontWeight: "bold", | ||
* ">>bar": { | ||
* _names: { "foo_bar": true }, | ||
* height: 10, | ||
* } | ||
* } | ||
* }); | ||
* | ||
* will make 5 calls to `generateCSSRuleset`: | ||
* | ||
* generateCSSRuleset(".foo", { color: "red" }, ...) | ||
* generateCSSRuleset(".foo:active", { fontWeight: "bold" }, ...) | ||
* generateCSSRuleset(".foo:active .foo_bar", { height: 10 }, ...) | ||
* // These 2 will be wrapped in @media screen {} | ||
* generateCSSRuleset(".foo", { height: 20 }, ...) | ||
* generateCSSRuleset(".foo:hover", { backgroundColor: "black" }, ...) | ||
*/ | ||
var generateCSS = function generateCSS(selector, styleTypes, stringHandlers, useImportant) { | ||
@@ -44,2 +88,8 @@ var merged = styleTypes.reduce(_util.recursiveMerge); | ||
exports.generateCSS = generateCSS; | ||
/** | ||
* Helper method of generateCSSRuleset to facilitate custom handling of certain | ||
* CSS properties. Used for e.g. font families. | ||
* | ||
* See generateCSSRuleset for usage and documentation of paramater types. | ||
*/ | ||
var runStringHandlers = function runStringHandlers(declarations, stringHandlers) { | ||
@@ -61,2 +111,33 @@ var result = {}; | ||
/** | ||
* Generate a CSS ruleset with the selector and containing the declarations. | ||
* | ||
* This function assumes that the given declarations don't contain any special | ||
* children (such as media queries, pseudo-selectors, or descendant styles). | ||
* | ||
* Note that this method does not deal with nesting used for e.g. | ||
* psuedo-selectors or media queries. That responsibility is left to the | ||
* `generateCSS` function. | ||
* | ||
* @param {string} selector: the selector associated with the ruleset | ||
* @param {Object} declarations: a map from camelCased CSS property name to CSS | ||
* property value. | ||
* @param {Object.<string, function>} stringHandlers: a map from camelCased CSS | ||
* property name to a function which will map the given value to the value | ||
* that is output. | ||
* @param {bool} useImportant: A boolean saying whether to append "!important" | ||
* to each of the CSS declarations. | ||
* @returns {string} A string of raw CSS. | ||
* | ||
* Examples: | ||
* | ||
* generateCSSRuleset(".blah", { color: "red" }) | ||
* -> ".blah{color: red !important;}" | ||
* generateCSSRuleset(".blah", { color: "red" }, {}, false) | ||
* -> ".blah{color: red}" | ||
* generateCSSRuleset(".blah", { color: "red" }, {color: c => c.toUpperCase}) | ||
* -> ".blah{color: RED}" | ||
* generateCSSRuleset(".blah:hover", { color: "red" }) | ||
* -> ".blah:hover{color: red}" | ||
*/ | ||
var generateCSSRuleset = function generateCSSRuleset(selector, declarations, stringHandlers, useImportant) { | ||
@@ -63,0 +144,0 @@ var handledDeclarations = runStringHandlers(declarations, stringHandlers); |
@@ -37,2 +37,5 @@ 'use strict'; | ||
/** | ||
* Utilities for using Aphrodite server-side. | ||
*/ | ||
var StyleSheetServer = { | ||
@@ -55,2 +58,32 @@ renderStatic: function renderStatic(renderFunc) { | ||
/** | ||
* Utilities for using Aphrodite in tests. | ||
* | ||
* Not meant to be used in production. | ||
*/ | ||
var StyleSheetTestUtils = { | ||
/** | ||
* Prevent styles from being injected into the DOM. | ||
* | ||
* This is useful in situations where you'd like to test rendering UI | ||
* components which use Aphrodite without any of the side-effects of | ||
* Aphrodite happening. Particularly useful for testing the output of | ||
* components when you have no DOM, e.g. testing in Node without a fake DOM. | ||
* | ||
* Should be paired with a subsequent call to | ||
* clearBufferAndResumeStyleInjection. | ||
*/ | ||
suppressStyleInjection: function suppressStyleInjection() { | ||
(0, _inject.reset)(); | ||
(0, _inject.startBuffering)(); | ||
}, | ||
/** | ||
* Opposite method of preventStyleInject. | ||
*/ | ||
clearBufferAndResumeStyleInjection: function clearBufferAndResumeStyleInjection() { | ||
(0, _inject.reset)(); | ||
} | ||
}; | ||
var css = function css() { | ||
@@ -85,4 +118,5 @@ for (var _len = arguments.length, styleDefinitions = Array(_len), _key = 0; _key < _len; _key++) { | ||
StyleSheetServer: StyleSheetServer, | ||
StyleSheetTestUtils: StyleSheetTestUtils, | ||
css: css | ||
}; | ||
module.exports = exports['default']; |
{ | ||
"name": "aphrodite", | ||
"version": "0.3.3", | ||
"version": "0.4.0", | ||
"description": "Inline styles in JS that just work (TM)", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"preversion": "npm test", | ||
"version": "npm run build" | ||
"version": "npm run build && git add dist" | ||
}, | ||
@@ -31,0 +31,0 @@ "repository": { |
@@ -7,3 +7,46 @@ import prefixAll from 'inline-style-prefix-all'; | ||
} from './util'; | ||
/** | ||
* Generate CSS for a selector and some styles. | ||
* | ||
* This function handles the media queries, pseudo selectors, and descendant | ||
* styles that can be used in aphrodite styles. | ||
* | ||
* @param {string} selector: A base CSS selector for the styles to be generated | ||
* with. | ||
* @param {Object} styleTypes: A list of properties of the return type of | ||
* StyleSheet.create, e.g. [styles.red, styles.blue]. | ||
* @param stringHandlers: See `generateCSSRuleset` | ||
* @param useImportant: See `generateCSSRuleset` | ||
* | ||
* To actually generate the CSS special-construct-less styles are passed to | ||
* `generateCSSRuleset`. | ||
* | ||
* For instance, a call to | ||
* | ||
* generateCSSInner(".foo", { | ||
* color: "red", | ||
* "@media screen": { | ||
* height: 20, | ||
* ":hover": { | ||
* backgroundColor: "black" | ||
* } | ||
* }, | ||
* ":active": { | ||
* fontWeight: "bold", | ||
* ">>bar": { | ||
* _names: { "foo_bar": true }, | ||
* height: 10, | ||
* } | ||
* } | ||
* }); | ||
* | ||
* will make 5 calls to `generateCSSRuleset`: | ||
* | ||
* generateCSSRuleset(".foo", { color: "red" }, ...) | ||
* generateCSSRuleset(".foo:active", { fontWeight: "bold" }, ...) | ||
* generateCSSRuleset(".foo:active .foo_bar", { height: 10 }, ...) | ||
* // These 2 will be wrapped in @media screen {} | ||
* generateCSSRuleset(".foo", { height: 20 }, ...) | ||
* generateCSSRuleset(".foo:hover", { backgroundColor: "black" }, ...) | ||
*/ | ||
export const generateCSS = (selector, styleTypes, stringHandlers, | ||
@@ -43,2 +86,8 @@ useImportant) => { | ||
/** | ||
* Helper method of generateCSSRuleset to facilitate custom handling of certain | ||
* CSS properties. Used for e.g. font families. | ||
* | ||
* See generateCSSRuleset for usage and documentation of paramater types. | ||
*/ | ||
const runStringHandlers = (declarations, stringHandlers) => { | ||
@@ -60,2 +109,33 @@ const result = {}; | ||
/** | ||
* Generate a CSS ruleset with the selector and containing the declarations. | ||
* | ||
* This function assumes that the given declarations don't contain any special | ||
* children (such as media queries, pseudo-selectors, or descendant styles). | ||
* | ||
* Note that this method does not deal with nesting used for e.g. | ||
* psuedo-selectors or media queries. That responsibility is left to the | ||
* `generateCSS` function. | ||
* | ||
* @param {string} selector: the selector associated with the ruleset | ||
* @param {Object} declarations: a map from camelCased CSS property name to CSS | ||
* property value. | ||
* @param {Object.<string, function>} stringHandlers: a map from camelCased CSS | ||
* property name to a function which will map the given value to the value | ||
* that is output. | ||
* @param {bool} useImportant: A boolean saying whether to append "!important" | ||
* to each of the CSS declarations. | ||
* @returns {string} A string of raw CSS. | ||
* | ||
* Examples: | ||
* | ||
* generateCSSRuleset(".blah", { color: "red" }) | ||
* -> ".blah{color: red !important;}" | ||
* generateCSSRuleset(".blah", { color: "red" }, {}, false) | ||
* -> ".blah{color: red}" | ||
* generateCSSRuleset(".blah", { color: "red" }, {color: c => c.toUpperCase}) | ||
* -> ".blah{color: RED}" | ||
* generateCSSRuleset(".blah:hover", { color: "red" }) | ||
* -> ".blah:hover{color: red}" | ||
*/ | ||
export const generateCSSRuleset = (selector, declarations, stringHandlers, | ||
@@ -62,0 +142,0 @@ useImportant) => { |
@@ -25,2 +25,5 @@ import {mapObj, hashObject} from './util'; | ||
/** | ||
* Utilities for using Aphrodite server-side. | ||
*/ | ||
const StyleSheetServer = { | ||
@@ -43,2 +46,32 @@ renderStatic(renderFunc) { | ||
/** | ||
* Utilities for using Aphrodite in tests. | ||
* | ||
* Not meant to be used in production. | ||
*/ | ||
const StyleSheetTestUtils = { | ||
/** | ||
* Prevent styles from being injected into the DOM. | ||
* | ||
* This is useful in situations where you'd like to test rendering UI | ||
* components which use Aphrodite without any of the side-effects of | ||
* Aphrodite happening. Particularly useful for testing the output of | ||
* components when you have no DOM, e.g. testing in Node without a fake DOM. | ||
* | ||
* Should be paired with a subsequent call to | ||
* clearBufferAndResumeStyleInjection. | ||
*/ | ||
suppressStyleInjection() { | ||
reset(); | ||
startBuffering(); | ||
}, | ||
/** | ||
* Opposite method of preventStyleInject. | ||
*/ | ||
clearBufferAndResumeStyleInjection() { | ||
reset(); | ||
}, | ||
}; | ||
const css = (...styleDefinitions) => { | ||
@@ -64,3 +97,4 @@ // Filter out falsy values from the input, to allow for | ||
StyleSheetServer, | ||
StyleSheetTestUtils, | ||
css, | ||
}; |
@@ -5,3 +5,8 @@ import asap from 'asap'; | ||
import { StyleSheet, StyleSheetServer, css } from '../src/index.js'; | ||
import { | ||
StyleSheet, | ||
StyleSheetServer, | ||
StyleSheetTestUtils, | ||
css | ||
} from '../src/index.js'; | ||
import { reset } from '../src/inject.js'; | ||
@@ -348,1 +353,22 @@ | ||
}); | ||
describe('StyleSheetTestUtils.suppressStyleInjection', () => { | ||
beforeEach(() => { | ||
StyleSheetTestUtils.suppressStyleInjection(); | ||
}); | ||
afterEach(() => { | ||
StyleSheetTestUtils.clearBufferAndResumeStyleInjection(); | ||
}); | ||
it('allows css to be called without requiring a DOM', (done) => { | ||
const sheet = StyleSheet.create({ | ||
red: { | ||
color: 'red', | ||
}, | ||
}); | ||
css(sheet.red); | ||
asap(done); | ||
}); | ||
}); |
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
530072
5081