pretty-lights
Advanced tools
Comparing version 0.0.12-alpha.4 to 0.0.12-alpha.5
@@ -67,8 +67,8 @@ "use strict"; | ||
function getStyles(lights) { | ||
return Object.keys(lights.caches.inserted).reduce(function (style, current) { | ||
if (lights.caches.inserted[current] === true) { | ||
return Object.keys(lights.cache.inserted).reduce(function (style, current) { | ||
if (lights.cache.inserted[current] === true) { | ||
return style; | ||
} | ||
return style + lights.caches.inserted[current]; | ||
return style + lights.cache.inserted[current]; | ||
}, ''); | ||
@@ -94,8 +94,8 @@ } | ||
Object.keys(lights.caches.registered).forEach(function (className) { | ||
Object.keys(lights.cache.registered).forEach(function (className) { | ||
var indexOfClassName = classNames.indexOf(className); | ||
if (indexOfClassName !== -1) { | ||
var nameWithoutKey = classNames[indexOfClassName].substring(lights.caches.key.length + 1); | ||
styles += lights.caches.inserted[nameWithoutKey]; | ||
var nameWithoutKey = classNames[indexOfClassName].substring(lights.cache.key.length + 1); | ||
styles += lights.cache.inserted[nameWithoutKey]; | ||
} | ||
@@ -121,3 +121,3 @@ }); | ||
var printedVal = printer(val); | ||
return (0, _replaceClassNames.replaceClassNames)(classNames, styles, printedVal, lights.caches.key, classNameReplacer); | ||
return (0, _replaceClassNames.replaceClassNames)(classNames, styles, printedVal, lights.cache.key, classNameReplacer); | ||
} | ||
@@ -124,0 +124,0 @@ |
@@ -52,8 +52,8 @@ "use strict"; | ||
function getStylesFromClassNames(classNames, lights) { | ||
return Object.keys(lights.caches.registered).reduce(function (styles, className) { | ||
return Object.keys(lights.cache.registered).reduce(function (styles, className) { | ||
var indexOfClassName = classNames.indexOf(className); | ||
if (indexOfClassName !== -1) { | ||
var nameWithoutKey = classNames[indexOfClassName].substring(lights.caches.key.length + 1); | ||
styles += lights.caches.inserted[nameWithoutKey]; | ||
var nameWithoutKey = classNames[indexOfClassName].substring(lights.cache.key.length + 1); | ||
styles += lights.cache.inserted[nameWithoutKey]; | ||
} | ||
@@ -60,0 +60,0 @@ |
@@ -1,2 +0,2 @@ | ||
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("@emotion/stylis")),r=e(require("stylis-rule-sheet")),n=e(require("@emotion/hash")),o=e(require("@emotion/memoize")),i=e(require("@emotion/unitless")),a=e(require("@emotion/is-prop-valid")),s=e(require("@emotion/weak-memoize")),c=e(require("hoist-non-react-statics")),u=e(require("react"));function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),e}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(){return(y=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}).apply(this,arguments)}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(){function e(t){f(this,e),this.isSpeedy=void 0===t.speedy?"production"===process.env.NODE_ENV:t.speedy,this.tags=[],this.ctr=0,this.nonce=t.nonce,this.key=t.key,this.container=t.container,this.before=null}return h(e,[{key:"insert",value:function(e,t){if(this.ctr%(this.isSpeedy?65e3:1)==0){var r=function(e){var t=document.createElement("style");return t.setAttribute("data-lights",e.key||""),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t}(this);this.container.insertBefore(r,0===this.tags.length?this.before:this.tags[this.tags.length-1].nextSibling),this.tags.push(r)}var n=this.tags[this.tags.length-1];if(this.isSpeedy){var o=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t+=1)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(n);try{var i=105===e.charCodeAt(1)&&64===e.charCodeAt(0);o.insertRule(e,i?0:o.cssRules.length)}catch(t){"production"!==process.env.NODE_ENV&&console.warn('There was a problem inserting the following rule: "'.concat(e,'"'),t)}}else n.appendChild(document.createTextNode(e+(t||"")));this.ctr+=1}},{key:"flush",value:function(){this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0}}]),e}(),_="undefined"!=typeof document,E="You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences",w="You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).",O=/[A-Z]|^ms/g,N=function(e){return null!=e&&"boolean"!=typeof e},S=o(function(e){return 45===e.charCodeAt(1)?e:e.replace(O,"-$&").toLowerCase()}),j=function(e,t){return null==t||"boolean"==typeof t?"":1===i[e]||45===e.charCodeAt(1)||isNaN(t)||0===t?t:"".concat(t,"px")};if("production"!==process.env.NODE_ENV){var P=/(attr|calc|counters?|url)\(/,x=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit","unset"],A=j;j=function(e,t){return"content"===e&&("string"!=typeof t||-1===x.indexOf(t)&&!P.test(t)&&(t.charAt(0)!==t.charAt(t.length-1)||'"'!==t.charAt(0)&&"'"!==t.charAt(0)))&&console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"".concat(t,"\"'`")),A(e,t)}}function C(e,t,r){if(null==t)return"";switch(l(t)){case"boolean":return"";case"function":if(void 0!==t.__lights_styles){var n=t.toString();if("NO_COMPONENT_SELECTOR"===n&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");return n}return void 0===this&&"production"!==process.env.NODE_ENV&&console.error("Interpolating functions in css calls is deprecated.\nIf you want to have a css call based on props, create a function that returns a css call like this\nlet dynamicStyle = (props) => css`color: ${props.color}`\nIt can be called directly with props or interpolated in a styled call like this\nlet SomeComponent = styled('div')`${dynamicStyle}`"),C.call(this,e,void 0===this?t():t(this.mergedProps),r);case"object":return function(e,t){var r=this;if(T.has(t))return T.get(t);var n="";if(Array.isArray(t))for(var o=0;o<t.length;o+=1)n+=C.call(this,e,t[o],!1);else Object.keys(t).forEach(function(o){var i=t[o];if("object"!==l(i))null!=e&&void 0!==e[i]?n+="".concat(o,"{").concat(e[i],"}"):N(i)&&(n+="".concat(S(o),":").concat(j(o,i),";"));else{if("NO_COMPONENT_SELECTOR"===o&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");if(!Array.isArray(i)||"string"!=typeof i[0]||null!=e&&void 0!==e[i[0]]){var a=C.call(r,e,i,!1);switch(o){case"animation":case"animationName":n+="".concat(S(o),":").concat(a,";");break;default:"production"!==process.env.NODE_ENV&&"undefined"===o&&console.error(w),n+="".concat(o,"{").concat(a,"}")}}else for(var s=0;s<i.length;s+=1)N(i[s])&&(n+="".concat(S(o),":").concat(j(o,i[s]),";"))}});return T.set(t,n),n}.call(this,e,t)}if(null==e)return t;var o=e[t];return!1===r&&void 0!==o?o:t}var k,T=new WeakMap,D=/label:\s*([^\s;\n{]+)\s*;/g;function V(e,t){var r,o=!0,i="",a=e[0];null==a||void 0===a.raw?(o=!1,i+=C.call(this,t,a,!1)):("production"!==process.env.NODE_ENV&&void 0===a[0]&&console.error(E),i+=a[0]);for(var s=1;s<e.length;s+=1)i+=C.call(this,t,e[s],46===i.charCodeAt(i.length-1)),o&&("production"!==process.env.NODE_ENV&&void 0===a[s]&&console.error(E),i+=a[s]);"production"!==process.env.NODE_ENV&&(i=i.replace(k,function(e){return r=e,""})),D.lastIndex=0;var c="",u=i;return i=i.replace(D,function(e,t){return c+="-".concat(t),""}),{name:n(i+c)+c,styles:i,stylesWithLabel:u,map:r}}function R(e,t,r){var n="";return r.split(" ").forEach(function(r){void 0!==e[r]?t.push(r):n+="".concat(r," ")}),n}function q(e,t){if(void 0===e.inserted[t.name])return e.insert("",t)}function L(e,t,r,n){var o=[],i=R(e,o,r);return o.length<2?r:i+t(o,n)}"production"!==process.env.NODE_ENV&&(k=/\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//);var I=u.createContext({}),Y=a,G=function(e){return"theme"!==e&&"innerRef"!==e},M=function(){return!0},W=function(e,t){for(var r=arguments,n=2,o=arguments.length;n<o;n+=1){var i=r[n],a=void 0;for(a in i)e(a)&&(t[a]=i[a])}return t},z=s(function(e){return s(function(t){return function(e,t){if("function"==typeof t){var r=t(e);if("production"!==process.env.NODE_ENV&&(null==r||"object"!==l(r)||Array.isArray(r)))throw new Error("[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!");return r}if("production"!==process.env.NODE_ENV&&(null==t||"object"!==l(t)||Array.isArray(t)))throw new Error("[ThemeProvider] Please make your theme prop a plain object");return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach(function(t){d(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e,{},t)}(e,t)})});function F(e,t,r){var n,o=t.theme&&t.theme[e];return"function"==typeof(n="function"==typeof o?o(r):r[o]?r[o]:r.none)?n(t):n}function B(e,t){return function(r){return F(e,r,t)}}B.variants=function(e,t,r){return function(n){var o=n[t]&&r[n[t]];return o&&F(e,n,o)}};var H=function(e,n){if(void 0!==e.__SECRET_LIGHTS__)return e.__SECRET_LIGHTS__;var o=function(e){void 0===e&&(e={});var n,o=e.key||"css";if("production"!==process.env.NODE_ENV&&/[^a-z-]/.test(o))throw new Error('Pretty Lights key must only contain lower case alphabetical characters and - but "'.concat(o,'" was passed'));var i,a,s="",c=r(function(e){i+=e,_&&n.sheet.insert(e,s)});void 0!==e.prefix&&(a={prefix:e.prefix});var u=new t(a);if(u.use(e.stylisPlugins)(c),"production"!==process.env.NODE_ENV){var l=u;u=function(e,t){l(e,t),s=""}}var f,p={};if(_){f=e.container||document.head;var h=document.querySelectorAll("style[data-lights-".concat(o,"]"));Array.prototype.forEach.call(h,function(e){(e.getAttribute("data-lights-".concat(o))||"").split(" ").forEach(function(e){p[e]=!0}),e.parentNode!==f&&f.appendChild(e)})}return n={key:o,sheet:new b({key:o,container:f,nonce:e.nonce,speedy:e.speedy}),nonce:e.nonce,inserted:p,registered:{},insert:function(e,t){s=t.map,void 0===n.inserted[t.name]&&(i="",u(e,t.styles),n.inserted[t.name]=i)}}}(void 0);o.sheet.speedy=function(e){if("production"!==process.env.NODE_ENV&&0!==this.ctr)throw new Error("speedy must be changed before any rules are inserted");this.isSpeedy=e};var i=function(){for(var e=arguments,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=e[n];var i=V.call(this,r,o.registered),a="".concat(o.key,"-").concat(i.name);return function(e,t){var r="".concat(e.key,"-").concat(t.name);void 0===e.registered[r]&&(e.registered[r]=t.stylesWithLabel||""),e.insert(".".concat(r),t)}(o,i),a},a={css:i,cx:function(){for(var e=arguments,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=e[n];return L(o.registered,i,function e(t){for(var r="",n=0;n<t.length;n+=1){var o=t[n];if(null!=o){var i=void 0;switch(l(o)){case"boolean":break;case"object":if(Array.isArray(o))i=e(o);else for(var a in i="",o)o[a]&&a&&(i&&(i+=" "),i+=a);break;default:i=o}i&&(r&&(r+=" "),r+=i)}}return r}(r))},injectGlobal:function(){for(var e=arguments,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=e[n];var i=V.call(this,r,o.registered);q(o,i)},keyframes:function(){for(var e=arguments,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=e[n];var i=V.call(this,r,o.registered),a="animation-".concat(i.name);return q(o,{name:i.name,styles:"@keyframes ".concat(a,"{").concat(i.styles,"}")}),a},hydrate:function(e){e.forEach(function(e){o.inserted[e]=!0})},flush:function(){o.inserted={},o.registered={},o.sheet.flush()},sheet:o.sheet,caches:o,getRegisteredStyles:R,merge:L.bind(null,o.registered,i)};return e.__SECRET_LIGHTS__=a,a}("undefined"!=typeof global?global:{}),$=function(e){var t=function(r,n){if("production"!==process.env.NODE_ENV&&void 0===r)throw new Error("You are trying to create a styled element with an undefined component.\nYou may have forgotten to import it.");var o,i,a,s;void 0!==n&&(o=n.e,i=n.label,a=n.target,s=r.__lights_forwardProp&&n.shouldForwardProp?function(e){return r.__lights_forwardProp(e)&&n.shouldForwardProp(e)}:n.shouldForwardProp);var c=r.__lights_real===r,l=void 0===o&&c&&r.__lights_base||r;return"function"!=typeof s&&(s="string"==typeof l&&l.charAt(0)===l.charAt(0).toLowerCase()?Y:G),function(){var p=arguments,d=c&&void 0!==r.__lights_styles?r.__lights_styles.slice(0):[];if(void 0!==i&&d.push("label:".concat(i,";")),void 0===o){for(var y=arguments.length,v=new Array(y),b=0;b<y;b++)v[b]=p[b];if(null==v[0]||void 0===v[0].raw)d.push.apply(d,v);else{d.push(v[0][0]);for(var _=v.length,E=1;E<_;E+=1)d.push(v[E],v[0][E])}}var w=function(t){function r(){return f(this,r),!(e=m(r).apply(this,arguments))||"object"!=typeof e&&"function"!=typeof e?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this):e;var e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(r,u.Component),h(r,[{key:"render",value:function(){var t=this;return u.createElement(I.Consumer,null,function(r){var n=t.props;t.mergedProps=W(M,{},n,{theme:n.theme||r});var i="",c=[];return n.className&&(i+=void 0===o?e.getRegisteredStyles(e.caches.registered,c,n.className):"".concat(n.className," ")),i+=void 0===o?e.css.apply(t,d.concat(c)):o,void 0!==a&&(i+=" ".concat(a)),u.createElement(l,W(s,{},n,{className:i,ref:n.innerRef}))})}}]),r}();return w.displayName=void 0!==i?i:"Styled(".concat("string"==typeof l?l:l.displayName||l.name||"Component",")"),void 0!==r.defaultProps&&(w.defaultProps=r.defaultProps),w.__lights_styles=d,w.__lights_base=l,w.__lights_real=w,w.__lights_forwardProp=s,Object.defineProperty(w,"toString",{value:function(){return"production"!==process.env.NODE_ENV&&void 0===a?"NO_COMPONENT_SELECTOR":".".concat(a)}}),w.withComponent=function(e,r){return t(e,void 0!==r?W(M,{},n,r):n).apply(void 0,function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(o=d)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}());var o},w}};return"production"!==process.env.NODE_ENV&&"undefined"!=typeof Proxy&&(t=new Proxy(t,{get:function(e,t){switch(t){case"__proto__":case"name":case"prototype":case"displayName":return e[t];default:throw new Error("You're trying to use the styled shorthand without the pretty-lights/babel plugin."+"\nPlease add pretty-lights/babel to your Babel config or use the function call syntax(`styled('".concat(t,"')` instead of `styled.").concat(t,"`)"))}}})),t}(H),J=H.hydrate,U=H.cx,Z=H.merge,K=H.getRegisteredStyles,Q=H.injectGlobal,X=H.keyframes,ee=H.css,te=H.sheet,re=H.caches;exports.flush=H.flush,exports.hydrate=J,exports.cx=U,exports.merge=Z,exports.getRegisteredStyles=K,exports.injectGlobal=Q,exports.keyframes=X,exports.css=ee,exports.sheet=te,exports.caches=re,exports.ThemeContext=I,exports.ThemeProvider=function(e){return u.createElement(I.Consumer,null,function(t){return e.theme!==t&&(t=z(t)(e.theme)),u.createElement(I.Provider,{value:t},e.children)})},exports.useTheme=function(){return u.useContext(I)},exports.withTheme=function(e){var t=e.displayName||e.name||"Component",r=u.forwardRef(function(t,r){return u.createElement(I.Consumer,null,function(n){return u.createElement(e,y({theme:n,ref:r},t))})});return r.displayName="WithTheme(".concat(t,")"),c(r,e)},exports.themeFn=B,exports.styled=$; | ||
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("@emotion/stylis")),r=e(require("@emotion/hash")),n=e(require("@emotion/unitless")),o=e(require("@emotion/memoize")),i=e(require("@emotion/is-prop-valid")),a=e(require("@emotion/weak-memoize")),s=e(require("hoist-non-react-statics")),c=require("react"),u=e(c);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(){return(y=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}).apply(this,arguments)}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(){function e(t){f(this,e),this.isSpeedy=void 0===t.speedy?"production"===process.env.NODE_ENV:t.speedy,this.tags=[],this.ctr=0,this.nonce=t.nonce,this.key=t.key,this.container=t.container,this.before=null}return d(e,[{key:"insert",value:function(e){if(this.ctr%(this.isSpeedy?65e3:1)==0){var t=function(e){var t=document.createElement("style");return t.setAttribute("data-lights",e.key||""),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t}(this);this.container.insertBefore(t,0===this.tags.length?this.before:this.tags[this.tags.length-1].nextSibling),this.tags.push(t)}var r=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t+=1)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(r);try{var o=105===e.charCodeAt(1)&&64===e.charCodeAt(0);n.insertRule(e,o?0:n.cssRules.length)}catch(t){"production"!==process.env.NODE_ENV&&console.warn('There was a problem inserting the following rule: "'.concat(e,'"'),t)}}else r.appendChild(document.createTextNode(e));this.ctr+=1}},{key:"flush",value:function(){this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0}}]),e}(),_="".concat("/*|*/","}"),w={current:null};function E(e){e&&w.current.insert("".concat(e,"}"))}var O=function(e,t,r,n,o,i,a,s,c,u){switch(e){default:break;case 1:switch(t.charCodeAt(0)){default:break;case 64:return w.current.insert("".concat(t,";")),"";case 108:if(98===t.charCodeAt(2))return""}break;case 2:if(0===s)return t+"/*|*/";break;case 3:switch(s){case 102:case 112:return w.current.insert(r[0]+t),"";default:return t+(0===u?"/*|*/":"")}case-2:t.split(_).forEach(E)}},N=function(e,t){if(1===e&&108===t.charCodeAt(0)&&98===t.charCodeAt(2))return""},x="undefined"!=typeof document,S=/\/\*\|\*\//g,P={},j=x?void 0:a(function(){var e=a(function(){return{}}),t={},r={};return function(n){return void 0===n||!0===n?t:!1===n?r:e(n)}}),A="You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences",C="You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).",k=/[A-Z]|^ms/g,T=function(e){return 45===e.charCodeAt(1)},D=function(e){return null!=e&&"boolean"!=typeof e},V=o(function(e){return T(e)?e:e.replace(k,"-$&").toLowerCase()}),R=function(e,t){return 1===n[e]||T(e)||"number"!=typeof t||0===t?t:"".concat(t,"px")};if("production"!==process.env.NODE_ENV){var q=/(attr|calc|counters?|url)\(/,I=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit","unset"],L=R,Y=/^-ms-/,G=/-(.)/g,M={};R=function(e,t){"content"===e&&("string"!=typeof t||-1===I.indexOf(t)&&!q.test(t)&&(t.charAt(0)!==t.charAt(t.length-1)||'"'!==t.charAt(0)&&"'"!==t.charAt(0)))&&console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"".concat(t,"\"'`"));var r=L(e,t);return""===r||T(e)||-1===e.indexOf("-")||void 0!==M[e]||(M[e]=!0,console.error("Using kebab-case for css properties in objects is not supported. Did you mean ".concat(e.replace(Y,"ms-").replace(G,function(e,t){return t.toUpperCase()}),"?"))),r}}function W(e,t,r){if(null==t)return"";switch(l(t)){case"boolean":return"";case"function":if(void 0!==t.__lights_styles){var n=t.toString();if("NO_COMPONENT_SELECTOR"===n&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");return n}return void 0===this&&"production"!==process.env.NODE_ENV&&console.error("Interpolating functions in css calls is deprecated.\nIf you want to have a css call based on props, create a function that returns a css call like this\nlet dynamicStyle = (props) => css`color: ${props.color}`\nIt can be called directly with props or interpolated in a styled call like this\nlet SomeComponent = styled('div')`${dynamicStyle}`"),W.call(this,e,void 0===this?t():t(this.mergedProps),r);case"object":return function(e,t){var r=this;if(F.has(t))return F.get(t);var n="";if(Array.isArray(t))for(var o=0;o<t.length;o+=1)n+=W.call(this,e,t[o],!1);else Object.keys(t).forEach(function(o){var i=t[o];if("object"!==l(i))null!=e&&void 0!==e[i]?n+="".concat(o,"{").concat(e[i],"}"):D(i)&&(n+="".concat(V(o),":").concat(R(o,i),";"));else{if("NO_COMPONENT_SELECTOR"===o&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");if(!Array.isArray(i)||"string"!=typeof i[0]||null!=e&&void 0!==e[i[0]]){var a=W.call(r,e,i,!1);switch(o){case"animation":case"animationName":n+="".concat(V(o),":").concat(a,";");break;default:"production"!==process.env.NODE_ENV&&"undefined"===o&&console.error(C),n+="".concat(o,"{").concat(a,"}")}}else for(var s=0;s<i.length;s+=1)D(i[s])&&(n+="".concat(V(o),":").concat(R(o,i[s]),";"))}});return F.set(t,n),n}.call(this,e,t)}if(null==e)return t;var o=e[t];return!1===r&&void 0!==o?o:t}var z,F=new WeakMap,U=/label:\s*([^\s;\n{]+)\s*;/g;function B(e,t){if(1===e.length&&"object"===l(e[0])&&null!==e[0]&&void 0!==e[0].styles)return e[0];var n,o=!0,i="",a=e[0];null==a||void 0===a.raw?(o=!1,i+=W.call(this,t,a,!1)):("production"!==process.env.NODE_ENV&&void 0===a[0]&&console.error(A),i+=a[0]);for(var s=1;s<e.length;s+=1)i+=W.call(this,t,e[s],46===i.charCodeAt(i.length-1)),o&&("production"!==process.env.NODE_ENV&&void 0===a[s]&&console.error(A),i+=a[s]);"production"!==process.env.NODE_ENV&&(i=i.replace(z,function(e){return n=e,""})),U.lastIndex=0;var c="",u=i;return i=i.replace(U,function(e,t){return c+="-".concat(t),""}),{name:r(i+c)+c,styles:i,stylesWithLabel:u,map:n}}function H(e,t,r){var n="";return r.split(" ").forEach(function(r){void 0!==e[r]?t.push(r):n+="".concat(r," ")}),n}function $(e,t){if(void 0===e.inserted[t.name])return e.insert("",t,e.sheet,!0)}function J(e,t,r,n){var o=[],i=H(e,o,r);return o.length<2?r:i+t(o,n)}"production"!==process.env.NODE_ENV&&(z=/\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//);var Z=u.createContext({}),K=i,Q=function(e){return"theme"!==e&&"innerRef"!==e},X=function(){return!0},ee=function(e,t){for(var r=arguments,n=2,o=arguments.length;n<o;n+=1){var i=r[n],a=void 0;for(a in i)e(a)&&(t[a]=i[a])}return t},te=a(function(e){return a(function(t){return function(e,t){if("function"==typeof t){var r=t(e);if("production"!==process.env.NODE_ENV&&(null==r||"object"!==l(r)||Array.isArray(r)))throw new Error("[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!");return r}if("production"!==process.env.NODE_ENV&&(null==t||"object"!==l(t)||Array.isArray(t)))throw new Error("[ThemeProvider] Please make your theme prop a plain object");return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach(function(t){h(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e,{},t)}(e,t)})});function re(e,t,r){var n,o=t.theme&&t.theme[e];return"function"==typeof(n="function"==typeof o?o(r):r[o]?r[o]:r.none)?n(t):n}function ne(e,t){return function(r){return re(e,r,t)}}ne.variants=function(e,t,r){return function(n){var o=n[t]&&r[n[t]];return o&&re(e,n,o)}};var oe=function(e,r){if(void 0!==e.__SECRET_LIGHTS__)return e.__SECRET_LIGHTS__;var n=function(e){void 0===e&&(e={});var r,n,o=e.key||"css";if("production"!==process.env.NODE_ENV&&/[^a-z-]/.test(o))throw new Error('Pretty Lights key must only contain lower case alphabetical characters and - but "'.concat(o,'" was passed'));void 0!==e.prefix&&(n={prefix:e.prefix});var i,a,s=new t(n),c={};if(x){i=e.container||document.head;var u="data-lights-".concat(o),l=document.querySelectorAll("style[".concat(u,"]"));Array.prototype.forEach.call(l,function(e){(e.getAttribute(u)||"").split(" ").forEach(function(e){c[e]=!0}),e.parentNode!==i&&i.appendChild(e)})}if(x)s.use(e.stylisPlugins)(O),a=function(e,t,n,o){if(w.current=n,"production"!==process.env.NODE_ENV&&void 0!==t.map){var i=t.map;w.current={insert:function(e){n.insert(e+i)}}}if(void 0===r.inserted[t.name]){var a=s(e,t.styles);o&&(r.inserted[t.name]=a.replace(S,""))}};else{s.use(N);var f=P;(e.stylisPlugins||void 0!==e.prefix)&&(s.use(e.stylisPlugins),f=j(e.stylisPlugins||P)(e.prefix)),a=function(e,t,n,o){if(void 0===r.inserted[t.name]){var i=function(e,t){var r=t.name;return void 0===f[r]&&(f[r]=s(e,t.styles)),f[r]}(e,t);if(!o)return i;r.inserted[t.name]=i}}}if("production"!==process.env.NODE_ENV){var p=/\/\*/g,d=/\*\//g;s.use(function(e,t){switch(e){default:break;case-1:for(;p.test(t);){if(d.lastIndex=p.lastIndex,!d.test(t))throw new Error('Your styles have an unterminated comment ("/*" without corresponding "*/").');p.lastIndex=d.lastIndex}p.lastIndex=0}})}return r={key:o,sheet:new b({key:o,container:i,nonce:e.nonce,speedy:e.speedy}),nonce:e.nonce,inserted:c,registered:{},insert:a}}(void 0);n.sheet.speedy=function(e){if("production"!==process.env.NODE_ENV&&0!==this.ctr)throw new Error("speedy must be changed before any rules are inserted");this.isSpeedy=e},n.compat=!0;var o=function(){for(var e=arguments,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=e[o];var i=B.call(this,r,n.registered),a="".concat(n.key,"-").concat(i.name);return function(e,t){var r="".concat(e.key,"-").concat(t.name);void 0===e.registered[r]&&(e.registered[r]=t.stylesWithLabel||""),void 0===e.inserted[t.name]&&e.insert(".".concat(r),t,e.sheet,!0)}(n,i),a},i={css:o,cx:function(){for(var e=arguments,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=e[i];return J(n.registered,o,function e(t){for(var r="",n=0;n<t.length;n+=1){var o=t[n];if(null!=o){var i=void 0;switch(l(o)){case"boolean":break;case"object":if(Array.isArray(o))i=e(o);else for(var a in i="",o)o[a]&&a&&(i&&(i+=" "),i+=a);break;default:i=o}i&&(r&&(r+=" "),r+=i)}}return r}(r))},injectGlobal:function(){for(var e=arguments,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=e[o];var i=B.call(this,r,n.registered);$(n,i)},keyframes:function(){for(var e=arguments,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=e[o];var i=B.call(this,r,n.registered),a="animation-".concat(i.name);return $(n,{name:i.name,styles:"@keyframes ".concat(a,"{").concat(i.styles,"}")}),a},hydrate:function(e){e.forEach(function(e){n.inserted[e]=!0})},flush:function(){n.registered={},n.inserted={},n.sheet.flush()},sheet:n.sheet,cache:n,getRegisteredStyles:H,merge:J.bind(null,n.registered,o)};return e.__SECRET_LIGHTS__=i,i}("undefined"!=typeof global?global:{}),ie=function(e){var t=function(r,n){if("production"!==process.env.NODE_ENV&&void 0===r)throw new Error("You are trying to create a styled element with an undefined component.\nYou may have forgotten to import it.");var o,i,a,s;void 0!==n&&(o=n.e,i=n.label,a=n.target,s=r.__lights_forwardProp&&n.shouldForwardProp?function(e){return r.__lights_forwardProp(e)&&n.shouldForwardProp(e)}:n.shouldForwardProp);var c=r.__lights_real===r,l=void 0===o&&c&&r.__lights_base||r;return"function"!=typeof s&&(s="string"==typeof l&&l.charAt(0)===l.charAt(0).toLowerCase()?K:Q),function(){var p=arguments,h=c&&void 0!==r.__lights_styles?r.__lights_styles.slice(0):[];if(void 0!==i&&h.push("label:".concat(i,";")),void 0===o){for(var y=arguments.length,v=new Array(y),b=0;b<y;b++)v[b]=p[b];if(null==v[0]||void 0===v[0].raw)h.push.apply(h,v);else{h.push(v[0][0]);for(var _=v.length,w=1;w<_;w+=1)h.push(v[w],v[0][w])}}var E=function(t){function r(){return f(this,r),!(e=m(r).apply(this,arguments))||"object"!=typeof e&&"function"!=typeof e?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this):e;var e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(r,u.Component),d(r,[{key:"render",value:function(){var t=this;return u.createElement(Z.Consumer,null,function(r){var n=t.props;t.mergedProps=ee(X,{},n,{theme:n.theme||r});var i="",c=[];return n.className&&(i+=void 0===o?e.getRegisteredStyles(e.cache.registered,c,n.className):"".concat(n.className," ")),i+=void 0===o?e.css.apply(t,h.concat(c)):o,void 0!==a&&(i+=" ".concat(a)),u.createElement(l,ee(s,{},n,{className:i,ref:n.innerRef}))})}}]),r}();return E.displayName=void 0!==i?i:"Styled(".concat("string"==typeof l?l:l.displayName||l.name||"Component",")"),void 0!==r.defaultProps&&(E.defaultProps=r.defaultProps),E.__lights_styles=h,E.__lights_base=l,E.__lights_real=E,E.__lights_forwardProp=s,Object.defineProperty(E,"toString",{value:function(){return"production"!==process.env.NODE_ENV&&void 0===a?"NO_COMPONENT_SELECTOR":".".concat(a)}}),E.withComponent=function(e,r){return t(e,void 0!==r?ee(X,{},n,r):n).apply(void 0,function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(o=h)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}());var o},E}};return"production"!==process.env.NODE_ENV&&"undefined"!=typeof Proxy&&(t=new Proxy(t,{get:function(e,t){switch(t){case"__proto__":case"name":case"prototype":case"displayName":return e[t];default:throw new Error("You're trying to use the styled shorthand without the pretty-lights/babel plugin."+"\nPlease add pretty-lights/babel to your Babel config or use the function call syntax(`styled('".concat(t,"')` instead of `styled.").concat(t,"`)"))}}})),t}(oe),ae=oe.hydrate,se=oe.cx,ce=oe.merge,ue=oe.getRegisteredStyles,le=oe.injectGlobal,fe=oe.keyframes,pe=oe.css,de=oe.sheet,he=oe.cache;exports.flush=oe.flush,exports.hydrate=ae,exports.cx=se,exports.merge=ce,exports.getRegisteredStyles=ue,exports.injectGlobal=le,exports.keyframes=fe,exports.css=pe,exports.sheet=de,exports.cache=he,exports.ThemeContext=Z,exports.ThemeProvider=function(e){return c.createElement(Z.Consumer,null,function(t){return e.theme!==t&&(t=te(t)(e.theme)),c.createElement(Z.Provider,{value:t},e.children)})},exports.useTheme=function(){return u.useContext(Z)},exports.withTheme=function(e){var t=e.displayName||e.name||"Component",r=c.forwardRef(function(t,r){return c.createElement(Z.Consumer,null,function(n){return c.createElement(e,y({theme:n,ref:r},t))})});return r.displayName="WithTheme(".concat(t,")"),s(r,e)},exports.themeFn=ne,exports.styled=ie; | ||
//# sourceMappingURL=pretty-lights.js.map |
@@ -1,2 +0,2 @@ | ||
import e from"@emotion/stylis";import t from"stylis-rule-sheet";import r from"@emotion/hash";import n from"@emotion/memoize";import o from"@emotion/unitless";import i from"@emotion/is-prop-valid";import a from"@emotion/weak-memoize";import c from"hoist-non-react-statics";import s from"react";function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(){return(d=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}).apply(this,arguments)}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var g=function(){function e(t){u(this,e),this.isSpeedy=void 0===t.speedy?"production"===process.env.NODE_ENV:t.speedy,this.tags=[],this.ctr=0,this.nonce=t.nonce,this.key=t.key,this.container=t.container,this.before=null}return p(e,[{key:"insert",value:function(e,t){if(this.ctr%(this.isSpeedy?65e3:1)==0){var r=function(e){var t=document.createElement("style");return t.setAttribute("data-lights",e.key||""),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t}(this);this.container.insertBefore(r,0===this.tags.length?this.before:this.tags[this.tags.length-1].nextSibling),this.tags.push(r)}var n=this.tags[this.tags.length-1];if(this.isSpeedy){var o=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t+=1)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(n);try{var i=105===e.charCodeAt(1)&&64===e.charCodeAt(0);o.insertRule(e,i?0:o.cssRules.length)}catch(t){"production"!==process.env.NODE_ENV&&console.warn('There was a problem inserting the following rule: "'.concat(e,'"'),t)}}else n.appendChild(document.createTextNode(e+(t||"")));this.ctr+=1}},{key:"flush",value:function(){this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0}}]),e}(),b="undefined"!=typeof document,_="You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences",E="You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).",w=/[A-Z]|^ms/g,O=function(e){return null!=e&&"boolean"!=typeof e},N=n(function(e){return 45===e.charCodeAt(1)?e:e.replace(w,"-$&").toLowerCase()}),S=function(e,t){return null==t||"boolean"==typeof t?"":1===o[e]||45===e.charCodeAt(1)||isNaN(t)||0===t?t:"".concat(t,"px")};if("production"!==process.env.NODE_ENV){var P=/(attr|calc|counters?|url)\(/,j=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit","unset"],A=S;S=function(e,t){return"content"===e&&("string"!=typeof t||-1===j.indexOf(t)&&!P.test(t)&&(t.charAt(0)!==t.charAt(t.length-1)||'"'!==t.charAt(0)&&"'"!==t.charAt(0)))&&console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"".concat(t,"\"'`")),A(e,t)}}function C(e,t,r){if(null==t)return"";switch(l(t)){case"boolean":return"";case"function":if(void 0!==t.__lights_styles){var n=t.toString();if("NO_COMPONENT_SELECTOR"===n&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");return n}return void 0===this&&"production"!==process.env.NODE_ENV&&console.error("Interpolating functions in css calls is deprecated.\nIf you want to have a css call based on props, create a function that returns a css call like this\nlet dynamicStyle = (props) => css`color: ${props.color}`\nIt can be called directly with props or interpolated in a styled call like this\nlet SomeComponent = styled('div')`${dynamicStyle}`"),C.call(this,e,void 0===this?t():t(this.mergedProps),r);case"object":return function(e,t){var r=this;if(D.has(t))return D.get(t);var n="";if(Array.isArray(t))for(var o=0;o<t.length;o+=1)n+=C.call(this,e,t[o],!1);else Object.keys(t).forEach(function(o){var i=t[o];if("object"!==l(i))null!=e&&void 0!==e[i]?n+="".concat(o,"{").concat(e[i],"}"):O(i)&&(n+="".concat(N(o),":").concat(S(o,i),";"));else{if("NO_COMPONENT_SELECTOR"===o&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");if(!Array.isArray(i)||"string"!=typeof i[0]||null!=e&&void 0!==e[i[0]]){var a=C.call(r,e,i,!1);switch(o){case"animation":case"animationName":n+="".concat(N(o),":").concat(a,";");break;default:"production"!==process.env.NODE_ENV&&"undefined"===o&&console.error(E),n+="".concat(o,"{").concat(a,"}")}}else for(var c=0;c<i.length;c+=1)O(i[c])&&(n+="".concat(N(o),":").concat(S(o,i[c]),";"))}});return D.set(t,n),n}.call(this,e,t)}if(null==e)return t;var o=e[t];return!1===r&&void 0!==o?o:t}var k,D=new WeakMap,T=/label:\s*([^\s;\n{]+)\s*;/g;function x(e,t){var n,o=!0,i="",a=e[0];null==a||void 0===a.raw?(o=!1,i+=C.call(this,t,a,!1)):("production"!==process.env.NODE_ENV&&void 0===a[0]&&console.error(_),i+=a[0]);for(var c=1;c<e.length;c+=1)i+=C.call(this,t,e[c],46===i.charCodeAt(i.length-1)),o&&("production"!==process.env.NODE_ENV&&void 0===a[c]&&console.error(_),i+=a[c]);"production"!==process.env.NODE_ENV&&(i=i.replace(k,function(e){return n=e,""})),T.lastIndex=0;var s="",l=i;return i=i.replace(T,function(e,t){return s+="-".concat(t),""}),{name:r(i+s)+s,styles:i,stylesWithLabel:l,map:n}}function V(e,t,r){var n="";return r.split(" ").forEach(function(r){void 0!==e[r]?t.push(r):n+="".concat(r," ")}),n}function R(e,t){if(void 0===e.inserted[t.name])return e.insert("",t)}function L(e,t,r,n){var o=[],i=V(e,o,r);return o.length<2?r:i+t(o,n)}"production"!==process.env.NODE_ENV&&(k=/\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//);var q=s.createContext({}),I=i,Y=function(e){return"theme"!==e&&"innerRef"!==e},G=function(){return!0},M=function(e,t){for(var r=arguments,n=2,o=arguments.length;n<o;n+=1){var i=r[n],a=void 0;for(a in i)e(a)&&(t[a]=i[a])}return t},W=a(function(e){return a(function(t){return function(e,t){if("function"==typeof t){var r=t(e);if("production"!==process.env.NODE_ENV&&(null==r||"object"!==l(r)||Array.isArray(r)))throw new Error("[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!");return r}if("production"!==process.env.NODE_ENV&&(null==t||"object"!==l(t)||Array.isArray(t)))throw new Error("[ThemeProvider] Please make your theme prop a plain object");return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach(function(t){h(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e,{},t)}(e,t)})}),z=function(e){return s.createElement(q.Consumer,null,function(t){return e.theme!==t&&(t=W(t)(e.theme)),s.createElement(q.Provider,{value:t},e.children)})};function F(e){var t=e.displayName||e.name||"Component",r=s.forwardRef(function(t,r){return s.createElement(q.Consumer,null,function(n){return s.createElement(e,d({theme:n,ref:r},t))})});return r.displayName="WithTheme(".concat(t,")"),c(r,e)}function B(){return s.useContext(q)}function H(e,t,r){var n,o=t.theme&&t.theme[e];return"function"==typeof(n="function"==typeof o?o(r):r[o]?r[o]:r.none)?n(t):n}function $(e,t){return function(r){return H(e,r,t)}}$.variants=function(e,t,r){return function(n){var o=n[t]&&r[n[t]];return o&&H(e,n,o)}};var J=function(r,n){if(void 0!==r.__SECRET_LIGHTS__)return r.__SECRET_LIGHTS__;var o=function(r){void 0===r&&(r={});var n,o=r.key||"css";if("production"!==process.env.NODE_ENV&&/[^a-z-]/.test(o))throw new Error('Pretty Lights key must only contain lower case alphabetical characters and - but "'.concat(o,'" was passed'));var i,a,c="",s=t(function(e){i+=e,b&&n.sheet.insert(e,c)});void 0!==r.prefix&&(a={prefix:r.prefix});var l=new e(a);if(l.use(r.stylisPlugins)(s),"production"!==process.env.NODE_ENV){var u=l;l=function(e,t){u(e,t),c=""}}var f,p={};if(b){f=r.container||document.head;var h=document.querySelectorAll("style[data-lights-".concat(o,"]"));Array.prototype.forEach.call(h,function(e){(e.getAttribute("data-lights-".concat(o))||"").split(" ").forEach(function(e){p[e]=!0}),e.parentNode!==f&&f.appendChild(e)})}return n={key:o,sheet:new g({key:o,container:f,nonce:r.nonce,speedy:r.speedy}),nonce:r.nonce,inserted:p,registered:{},insert:function(e,t){c=t.map,void 0===n.inserted[t.name]&&(i="",l(e,t.styles),n.inserted[t.name]=i)}}}(void 0);o.sheet.speedy=function(e){if("production"!==process.env.NODE_ENV&&0!==this.ctr)throw new Error("speedy must be changed before any rules are inserted");this.isSpeedy=e};var i=function(){for(var e=arguments,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=e[n];var i=x.call(this,r,o.registered),a="".concat(o.key,"-").concat(i.name);return function(e,t){var r="".concat(e.key,"-").concat(t.name);void 0===e.registered[r]&&(e.registered[r]=t.stylesWithLabel||""),e.insert(".".concat(r),t)}(o,i),a},a={css:i,cx:function(){for(var e=arguments,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=e[n];return L(o.registered,i,function e(t){for(var r="",n=0;n<t.length;n+=1){var o=t[n];if(null!=o){var i=void 0;switch(l(o)){case"boolean":break;case"object":if(Array.isArray(o))i=e(o);else for(var a in i="",o)o[a]&&a&&(i&&(i+=" "),i+=a);break;default:i=o}i&&(r&&(r+=" "),r+=i)}}return r}(r))},injectGlobal:function(){for(var e=arguments,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=e[n];var i=x.call(this,r,o.registered);R(o,i)},keyframes:function(){for(var e=arguments,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=e[n];var i=x.call(this,r,o.registered),a="animation-".concat(i.name);return R(o,{name:i.name,styles:"@keyframes ".concat(a,"{").concat(i.styles,"}")}),a},hydrate:function(e){e.forEach(function(e){o.inserted[e]=!0})},flush:function(){o.inserted={},o.registered={},o.sheet.flush()},sheet:o.sheet,caches:o,getRegisteredStyles:V,merge:L.bind(null,o.registered,i)};return r.__SECRET_LIGHTS__=a,a}("undefined"!=typeof global?global:{}),U=function(e){var t=function(r,n){if("production"!==process.env.NODE_ENV&&void 0===r)throw new Error("You are trying to create a styled element with an undefined component.\nYou may have forgotten to import it.");var o,i,a,c;void 0!==n&&(o=n.e,i=n.label,a=n.target,c=r.__lights_forwardProp&&n.shouldForwardProp?function(e){return r.__lights_forwardProp(e)&&n.shouldForwardProp(e)}:n.shouldForwardProp);var l=r.__lights_real===r,f=void 0===o&&l&&r.__lights_base||r;return"function"!=typeof c&&(c="string"==typeof f&&f.charAt(0)===f.charAt(0).toLowerCase()?I:Y),function(){var h=arguments,d=l&&void 0!==r.__lights_styles?r.__lights_styles.slice(0):[];if(void 0!==i&&d.push("label:".concat(i,";")),void 0===o){for(var y=arguments.length,g=new Array(y),b=0;b<y;b++)g[b]=h[b];if(null==g[0]||void 0===g[0].raw)d.push.apply(d,g);else{d.push(g[0][0]);for(var _=g.length,E=1;E<_;E+=1)d.push(g[E],g[0][E])}}var w=function(t){function r(){return u(this,r),!(e=v(r).apply(this,arguments))||"object"!=typeof e&&"function"!=typeof e?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this):e;var e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(r,s.Component),p(r,[{key:"render",value:function(){var t=this;return s.createElement(q.Consumer,null,function(r){var n=t.props;t.mergedProps=M(G,{},n,{theme:n.theme||r});var i="",l=[];return n.className&&(i+=void 0===o?e.getRegisteredStyles(e.caches.registered,l,n.className):"".concat(n.className," ")),i+=void 0===o?e.css.apply(t,d.concat(l)):o,void 0!==a&&(i+=" ".concat(a)),s.createElement(f,M(c,{},n,{className:i,ref:n.innerRef}))})}}]),r}();return w.displayName=void 0!==i?i:"Styled(".concat("string"==typeof f?f:f.displayName||f.name||"Component",")"),void 0!==r.defaultProps&&(w.defaultProps=r.defaultProps),w.__lights_styles=d,w.__lights_base=f,w.__lights_real=w,w.__lights_forwardProp=c,Object.defineProperty(w,"toString",{value:function(){return"production"!==process.env.NODE_ENV&&void 0===a?"NO_COMPONENT_SELECTOR":".".concat(a)}}),w.withComponent=function(e,r){return t(e,void 0!==r?M(G,{},n,r):n).apply(void 0,function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(o=d)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}());var o},w}};return"production"!==process.env.NODE_ENV&&"undefined"!=typeof Proxy&&(t=new Proxy(t,{get:function(e,t){switch(t){case"__proto__":case"name":case"prototype":case"displayName":return e[t];default:throw new Error("You're trying to use the styled shorthand without the pretty-lights/babel plugin."+"\nPlease add pretty-lights/babel to your Babel config or use the function call syntax(`styled('".concat(t,"')` instead of `styled.").concat(t,"`)"))}}})),t}(J),Z=J.flush,K=J.hydrate,Q=J.cx,X=J.merge,ee=J.getRegisteredStyles,te=J.injectGlobal,re=J.keyframes,ne=J.css,oe=J.sheet,ie=J.caches;export{Z as flush,K as hydrate,Q as cx,X as merge,ee as getRegisteredStyles,te as injectGlobal,re as keyframes,ne as css,oe as sheet,ie as caches,q as ThemeContext,z as ThemeProvider,B as useTheme,F as withTheme,$ as themeFn,U as styled}; | ||
import e from"@emotion/stylis";import t from"@emotion/hash";import r from"@emotion/unitless";import n from"@emotion/memoize";import o from"@emotion/is-prop-valid";import i from"@emotion/weak-memoize";import a from"hoist-non-react-statics";import c,{createElement as s,forwardRef as u}from"react";function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(){return(y=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}).apply(this,arguments)}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(){function e(t){f(this,e),this.isSpeedy=void 0===t.speedy?"production"===process.env.NODE_ENV:t.speedy,this.tags=[],this.ctr=0,this.nonce=t.nonce,this.key=t.key,this.container=t.container,this.before=null}return d(e,[{key:"insert",value:function(e){if(this.ctr%(this.isSpeedy?65e3:1)==0){var t=function(e){var t=document.createElement("style");return t.setAttribute("data-lights",e.key||""),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t}(this);this.container.insertBefore(t,0===this.tags.length?this.before:this.tags[this.tags.length-1].nextSibling),this.tags.push(t)}var r=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t+=1)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(r);try{var o=105===e.charCodeAt(1)&&64===e.charCodeAt(0);n.insertRule(e,o?0:n.cssRules.length)}catch(t){"production"!==process.env.NODE_ENV&&console.warn('There was a problem inserting the following rule: "'.concat(e,'"'),t)}}else r.appendChild(document.createTextNode(e));this.ctr+=1}},{key:"flush",value:function(){this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0}}]),e}(),_="".concat("/*|*/","}"),w={current:null};function E(e){e&&w.current.insert("".concat(e,"}"))}var O=function(e,t,r,n,o,i,a,c,s,u){switch(e){default:break;case 1:switch(t.charCodeAt(0)){default:break;case 64:return w.current.insert("".concat(t,";")),"";case 108:if(98===t.charCodeAt(2))return""}break;case 2:if(0===c)return t+"/*|*/";break;case 3:switch(c){case 102:case 112:return w.current.insert(r[0]+t),"";default:return t+(0===u?"/*|*/":"")}case-2:t.split(_).forEach(E)}},N=function(e,t){if(1===e&&108===t.charCodeAt(0)&&98===t.charCodeAt(2))return""},S="undefined"!=typeof document,P=/\/\*\|\*\//g,j={},A=S?void 0:i(function(){var e=i(function(){return{}}),t={},r={};return function(n){return void 0===n||!0===n?t:!1===n?r:e(n)}}),C="You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences",k="You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).",x=/[A-Z]|^ms/g,D=function(e){return 45===e.charCodeAt(1)},T=function(e){return null!=e&&"boolean"!=typeof e},V=n(function(e){return D(e)?e:e.replace(x,"-$&").toLowerCase()}),R=function(e,t){return 1===r[e]||D(e)||"number"!=typeof t||0===t?t:"".concat(t,"px")};if("production"!==process.env.NODE_ENV){var I=/(attr|calc|counters?|url)\(/,L=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit","unset"],q=R,Y=/^-ms-/,G=/-(.)/g,M={};R=function(e,t){"content"===e&&("string"!=typeof t||-1===L.indexOf(t)&&!I.test(t)&&(t.charAt(0)!==t.charAt(t.length-1)||'"'!==t.charAt(0)&&"'"!==t.charAt(0)))&&console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"".concat(t,"\"'`"));var r=q(e,t);return""===r||D(e)||-1===e.indexOf("-")||void 0!==M[e]||(M[e]=!0,console.error("Using kebab-case for css properties in objects is not supported. Did you mean ".concat(e.replace(Y,"ms-").replace(G,function(e,t){return t.toUpperCase()}),"?"))),r}}function W(e,t,r){if(null==t)return"";switch(l(t)){case"boolean":return"";case"function":if(void 0!==t.__lights_styles){var n=t.toString();if("NO_COMPONENT_SELECTOR"===n&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");return n}return void 0===this&&"production"!==process.env.NODE_ENV&&console.error("Interpolating functions in css calls is deprecated.\nIf you want to have a css call based on props, create a function that returns a css call like this\nlet dynamicStyle = (props) => css`color: ${props.color}`\nIt can be called directly with props or interpolated in a styled call like this\nlet SomeComponent = styled('div')`${dynamicStyle}`"),W.call(this,e,void 0===this?t():t(this.mergedProps),r);case"object":return function(e,t){var r=this;if(F.has(t))return F.get(t);var n="";if(Array.isArray(t))for(var o=0;o<t.length;o+=1)n+=W.call(this,e,t[o],!1);else Object.keys(t).forEach(function(o){var i=t[o];if("object"!==l(i))null!=e&&void 0!==e[i]?n+="".concat(o,"{").concat(e[i],"}"):T(i)&&(n+="".concat(V(o),":").concat(R(o,i),";"));else{if("NO_COMPONENT_SELECTOR"===o&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");if(!Array.isArray(i)||"string"!=typeof i[0]||null!=e&&void 0!==e[i[0]]){var a=W.call(r,e,i,!1);switch(o){case"animation":case"animationName":n+="".concat(V(o),":").concat(a,";");break;default:"production"!==process.env.NODE_ENV&&"undefined"===o&&console.error(k),n+="".concat(o,"{").concat(a,"}")}}else for(var c=0;c<i.length;c+=1)T(i[c])&&(n+="".concat(V(o),":").concat(R(o,i[c]),";"))}});return F.set(t,n),n}.call(this,e,t)}if(null==e)return t;var o=e[t];return!1===r&&void 0!==o?o:t}var z,F=new WeakMap,U=/label:\s*([^\s;\n{]+)\s*;/g;function B(e,r){if(1===e.length&&"object"===l(e[0])&&null!==e[0]&&void 0!==e[0].styles)return e[0];var n,o=!0,i="",a=e[0];null==a||void 0===a.raw?(o=!1,i+=W.call(this,r,a,!1)):("production"!==process.env.NODE_ENV&&void 0===a[0]&&console.error(C),i+=a[0]);for(var c=1;c<e.length;c+=1)i+=W.call(this,r,e[c],46===i.charCodeAt(i.length-1)),o&&("production"!==process.env.NODE_ENV&&void 0===a[c]&&console.error(C),i+=a[c]);"production"!==process.env.NODE_ENV&&(i=i.replace(z,function(e){return n=e,""})),U.lastIndex=0;var s="",u=i;return i=i.replace(U,function(e,t){return s+="-".concat(t),""}),{name:t(i+s)+s,styles:i,stylesWithLabel:u,map:n}}function H(e,t,r){var n="";return r.split(" ").forEach(function(r){void 0!==e[r]?t.push(r):n+="".concat(r," ")}),n}function $(e,t){if(void 0===e.inserted[t.name])return e.insert("",t,e.sheet,!0)}function J(e,t,r,n){var o=[],i=H(e,o,r);return o.length<2?r:i+t(o,n)}"production"!==process.env.NODE_ENV&&(z=/\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//);var Z=c.createContext({}),K=o,Q=function(e){return"theme"!==e&&"innerRef"!==e},X=function(){return!0},ee=function(e,t){for(var r=arguments,n=2,o=arguments.length;n<o;n+=1){var i=r[n],a=void 0;for(a in i)e(a)&&(t[a]=i[a])}return t},te=i(function(e){return i(function(t){return function(e,t){if("function"==typeof t){var r=t(e);if("production"!==process.env.NODE_ENV&&(null==r||"object"!==l(r)||Array.isArray(r)))throw new Error("[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!");return r}if("production"!==process.env.NODE_ENV&&(null==t||"object"!==l(t)||Array.isArray(t)))throw new Error("[ThemeProvider] Please make your theme prop a plain object");return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach(function(t){h(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e,{},t)}(e,t)})}),re=function(e){return s(Z.Consumer,null,function(t){return e.theme!==t&&(t=te(t)(e.theme)),s(Z.Provider,{value:t},e.children)})};function ne(e){var t=e.displayName||e.name||"Component",r=u(function(t,r){return s(Z.Consumer,null,function(n){return s(e,y({theme:n,ref:r},t))})});return r.displayName="WithTheme(".concat(t,")"),a(r,e)}function oe(){return c.useContext(Z)}function ie(e,t,r){var n,o=t.theme&&t.theme[e];return"function"==typeof(n="function"==typeof o?o(r):r[o]?r[o]:r.none)?n(t):n}function ae(e,t){return function(r){return ie(e,r,t)}}ae.variants=function(e,t,r){return function(n){var o=n[t]&&r[n[t]];return o&&ie(e,n,o)}};var ce=function(t,r){if(void 0!==t.__SECRET_LIGHTS__)return t.__SECRET_LIGHTS__;var n=function(t){void 0===t&&(t={});var r,n,o=t.key||"css";if("production"!==process.env.NODE_ENV&&/[^a-z-]/.test(o))throw new Error('Pretty Lights key must only contain lower case alphabetical characters and - but "'.concat(o,'" was passed'));void 0!==t.prefix&&(n={prefix:t.prefix});var i,a,c=new e(n),s={};if(S){i=t.container||document.head;var u="data-lights-".concat(o),l=document.querySelectorAll("style[".concat(u,"]"));Array.prototype.forEach.call(l,function(e){(e.getAttribute(u)||"").split(" ").forEach(function(e){s[e]=!0}),e.parentNode!==i&&i.appendChild(e)})}if(S)c.use(t.stylisPlugins)(O),a=function(e,t,n,o){if(w.current=n,"production"!==process.env.NODE_ENV&&void 0!==t.map){var i=t.map;w.current={insert:function(e){n.insert(e+i)}}}if(void 0===r.inserted[t.name]){var a=c(e,t.styles);o&&(r.inserted[t.name]=a.replace(P,""))}};else{c.use(N);var f=j;(t.stylisPlugins||void 0!==t.prefix)&&(c.use(t.stylisPlugins),f=A(t.stylisPlugins||j)(t.prefix)),a=function(e,t,n,o){if(void 0===r.inserted[t.name]){var i=function(e,t){var r=t.name;return void 0===f[r]&&(f[r]=c(e,t.styles)),f[r]}(e,t);if(!o)return i;r.inserted[t.name]=i}}}if("production"!==process.env.NODE_ENV){var p=/\/\*/g,d=/\*\//g;c.use(function(e,t){switch(e){default:break;case-1:for(;p.test(t);){if(d.lastIndex=p.lastIndex,!d.test(t))throw new Error('Your styles have an unterminated comment ("/*" without corresponding "*/").');p.lastIndex=d.lastIndex}p.lastIndex=0}})}return r={key:o,sheet:new b({key:o,container:i,nonce:t.nonce,speedy:t.speedy}),nonce:t.nonce,inserted:s,registered:{},insert:a}}(void 0);n.sheet.speedy=function(e){if("production"!==process.env.NODE_ENV&&0!==this.ctr)throw new Error("speedy must be changed before any rules are inserted");this.isSpeedy=e},n.compat=!0;var o=function(){for(var e=arguments,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=e[o];var i=B.call(this,r,n.registered),a="".concat(n.key,"-").concat(i.name);return function(e,t){var r="".concat(e.key,"-").concat(t.name);void 0===e.registered[r]&&(e.registered[r]=t.stylesWithLabel||""),void 0===e.inserted[t.name]&&e.insert(".".concat(r),t,e.sheet,!0)}(n,i),a},i={css:o,cx:function(){for(var e=arguments,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=e[i];return J(n.registered,o,function e(t){for(var r="",n=0;n<t.length;n+=1){var o=t[n];if(null!=o){var i=void 0;switch(l(o)){case"boolean":break;case"object":if(Array.isArray(o))i=e(o);else for(var a in i="",o)o[a]&&a&&(i&&(i+=" "),i+=a);break;default:i=o}i&&(r&&(r+=" "),r+=i)}}return r}(r))},injectGlobal:function(){for(var e=arguments,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=e[o];var i=B.call(this,r,n.registered);$(n,i)},keyframes:function(){for(var e=arguments,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=e[o];var i=B.call(this,r,n.registered),a="animation-".concat(i.name);return $(n,{name:i.name,styles:"@keyframes ".concat(a,"{").concat(i.styles,"}")}),a},hydrate:function(e){e.forEach(function(e){n.inserted[e]=!0})},flush:function(){n.registered={},n.inserted={},n.sheet.flush()},sheet:n.sheet,cache:n,getRegisteredStyles:H,merge:J.bind(null,n.registered,o)};return t.__SECRET_LIGHTS__=i,i}("undefined"!=typeof global?global:{}),se=function(e){var t=function(r,n){if("production"!==process.env.NODE_ENV&&void 0===r)throw new Error("You are trying to create a styled element with an undefined component.\nYou may have forgotten to import it.");var o,i,a,s;void 0!==n&&(o=n.e,i=n.label,a=n.target,s=r.__lights_forwardProp&&n.shouldForwardProp?function(e){return r.__lights_forwardProp(e)&&n.shouldForwardProp(e)}:n.shouldForwardProp);var u=r.__lights_real===r,l=void 0===o&&u&&r.__lights_base||r;return"function"!=typeof s&&(s="string"==typeof l&&l.charAt(0)===l.charAt(0).toLowerCase()?K:Q),function(){var p=arguments,h=u&&void 0!==r.__lights_styles?r.__lights_styles.slice(0):[];if(void 0!==i&&h.push("label:".concat(i,";")),void 0===o){for(var y=arguments.length,v=new Array(y),b=0;b<y;b++)v[b]=p[b];if(null==v[0]||void 0===v[0].raw)h.push.apply(h,v);else{h.push(v[0][0]);for(var _=v.length,w=1;w<_;w+=1)h.push(v[w],v[0][w])}}var E=function(t){function r(){return f(this,r),!(e=m(r).apply(this,arguments))||"object"!=typeof e&&"function"!=typeof e?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this):e;var e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(r,c.Component),d(r,[{key:"render",value:function(){var t=this;return c.createElement(Z.Consumer,null,function(r){var n=t.props;t.mergedProps=ee(X,{},n,{theme:n.theme||r});var i="",u=[];return n.className&&(i+=void 0===o?e.getRegisteredStyles(e.cache.registered,u,n.className):"".concat(n.className," ")),i+=void 0===o?e.css.apply(t,h.concat(u)):o,void 0!==a&&(i+=" ".concat(a)),c.createElement(l,ee(s,{},n,{className:i,ref:n.innerRef}))})}}]),r}();return E.displayName=void 0!==i?i:"Styled(".concat("string"==typeof l?l:l.displayName||l.name||"Component",")"),void 0!==r.defaultProps&&(E.defaultProps=r.defaultProps),E.__lights_styles=h,E.__lights_base=l,E.__lights_real=E,E.__lights_forwardProp=s,Object.defineProperty(E,"toString",{value:function(){return"production"!==process.env.NODE_ENV&&void 0===a?"NO_COMPONENT_SELECTOR":".".concat(a)}}),E.withComponent=function(e,r){return t(e,void 0!==r?ee(X,{},n,r):n).apply(void 0,function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(o=h)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}());var o},E}};return"production"!==process.env.NODE_ENV&&"undefined"!=typeof Proxy&&(t=new Proxy(t,{get:function(e,t){switch(t){case"__proto__":case"name":case"prototype":case"displayName":return e[t];default:throw new Error("You're trying to use the styled shorthand without the pretty-lights/babel plugin."+"\nPlease add pretty-lights/babel to your Babel config or use the function call syntax(`styled('".concat(t,"')` instead of `styled.").concat(t,"`)"))}}})),t}(ce),ue=ce.flush,le=ce.hydrate,fe=ce.cx,pe=ce.merge,de=ce.getRegisteredStyles,he=ce.injectGlobal,ye=ce.keyframes,ve=ce.css,me=ce.sheet,ge=ce.cache;export{ue as flush,le as hydrate,fe as cx,pe as merge,de as getRegisteredStyles,he as injectGlobal,ye as keyframes,ve as css,me as sheet,ge as cache,Z as ThemeContext,re as ThemeProvider,oe as useTheme,ne as withTheme,ae as themeFn,se as styled}; | ||
//# sourceMappingURL=pretty-lights.modern.js.map |
{ | ||
"name": "pretty-lights", | ||
"version": "0.0.12-alpha.4", | ||
"version": "0.0.12-alpha.5", | ||
"description": "CSS-in-JS with a reliable API", | ||
@@ -5,0 +5,0 @@ "main": "lib/pretty-lights.js", |
@@ -8,7 +8,7 @@ "use strict"; | ||
var createExtractCritical = function createExtractCritical(caches) { | ||
var createExtractCritical = function createExtractCritical(cache) { | ||
return function (html) { | ||
// parse out ids from html | ||
// reconstruct css/rules/cache to pass | ||
var RGX = new RegExp("".concat(caches.key, "-([a-zA-Z0-9-_]+)"), 'gm'); | ||
var RGX = new RegExp("".concat(cache.key, "-([a-zA-Z0-9-_]+)"), 'gm'); | ||
var o = { | ||
@@ -23,3 +23,5 @@ html: html, | ||
while ((match = RGX.exec(html)) !== null) { | ||
// $FlowFixMe | ||
if (ids[match[1]] === undefined) { | ||
// $FlowFixMe | ||
ids[match[1]] = true; | ||
@@ -29,5 +31,5 @@ } | ||
o.ids = Object.keys(caches.inserted).filter(function filterInserted(id) { | ||
if ((ids[id] === true || caches.registered["".concat(caches.key, "-").concat(id)] === undefined) && caches.inserted[id] !== true) { | ||
o.css += caches.inserted[id]; | ||
o.ids = Object.keys(cache.inserted).filter(function (id) { | ||
if ((ids[id] !== undefined || cache.registered["".concat(cache.key, "-").concat(id)] === undefined) && cache.inserted[id] !== true) { | ||
o.css += cache.inserted[id]; | ||
return true; | ||
@@ -34,0 +36,0 @@ } |
@@ -16,5 +16,7 @@ "use strict"; | ||
var extractCritical = (0, _extractCritical["default"])(_.caches); | ||
// $FORK$ we do not support the streaming API | ||
var extractCritical = (0, _extractCritical["default"])(_.cache); // $FORK$ we do not pass nonceString | ||
exports.extractCritical = extractCritical; | ||
var renderStylesToString = (0, _inline["default"])(_.caches); | ||
var renderStylesToString = (0, _inline["default"])(_.cache); | ||
exports.renderStylesToString = renderStylesToString; |
@@ -12,8 +12,8 @@ "use strict"; | ||
var createRenderStylesToString = function createRenderStylesToString(caches) { | ||
var createRenderStylesToString = function createRenderStylesToString(cache) { | ||
return function (html) { | ||
var nonceString = caches.nonce !== undefined ? " nonce=\"".concat(caches.nonce, "\"") : ''; | ||
var inserted = caches.inserted, | ||
cssKey = caches.key, | ||
registered = caches.registered; | ||
var nonceString = cache.nonce !== undefined ? " nonce=\"".concat(cache.nonce, "\"") : ''; | ||
var inserted = cache.inserted, | ||
cssKey = cache.key, | ||
registered = cache.registered; | ||
var regex = new RegExp("<|".concat(cssKey, "-([a-zA-Z0-9-_]+)"), 'gm'); | ||
@@ -48,2 +48,3 @@ var seen = {}; | ||
while ((match = regex.exec(html)) !== null) { | ||
// $FlowFixMe | ||
if (match[0] === '<') { | ||
@@ -54,14 +55,17 @@ if (ids !== '') { | ||
styles = ''; | ||
} | ||
} // $FlowFixMe | ||
result += html.substring(lastInsertionPoint, match.index); | ||
result += html.substring(lastInsertionPoint, match.index); // $FlowFixMe | ||
lastInsertionPoint = match.index; // eslint-disable-next-line no-continue | ||
continue; | ||
} | ||
} // $FlowFixMe | ||
var _id = match[1]; | ||
var _style = inserted[_id]; | ||
if (_style === true || seen[_id]) { | ||
if (_style === true || _style === undefined || seen[_id]) { | ||
// eslint-disable-next-line no-continue | ||
@@ -68,0 +72,0 @@ continue; |
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
969
110132
42