pretty-lights
Advanced tools
Comparing version 0.0.11 to 0.0.12-alpha.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("@emotion/hash")),n=e(require("stylis-rule-sheet")),o=e(require("@emotion/memoize")),i=e(require("@emotion/unitless")),c=e(require("@emotion/is-prop-valid")),a=e(require("@emotion/weak-memoize")),s=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 g(e){return(g=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 b=/[A-Z]|^ms/g,_=o(function(e){return e.replace(b,"-$&").toLowerCase()}),w=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 E=/(attr|calc|counters?|url)\(/,O=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit","unset"],N=w;w=function(e,t){return"content"===e&&("string"!=typeof t||-1===O.indexOf(t)&&!E.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,"\"'`")),N(e,t)}}var j="undefined"!=typeof document;function x(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("")),(void 0!==e.container?e.container:document.head).appendChild(t),t}var P=function(){function e(t){f(this,e),this.isSpeedy="production"===process.env.NODE_ENV,this.tags=[],this.ctr=0,this.opts=t}return h(e,[{key:"inject",value:function(){if(this.injected)throw new Error("already injected!");this.tags[0]=x(this.opts),this.injected=!0}},{key:"speedy",value:function(e){if(0!==this.ctr)throw new Error("cannot change speedy now");this.isSpeedy=!!e}},{key:"insert",value:function(e,t){if(this.isSpeedy){var r=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]}(this.tags[this.tags.length-1]);try{r.insertRule(e,r.cssRules.length)}catch(t){"production"!==process.env.NODE_ENV&&console.warn("illegal rule",e)}}else{var n=x(this.opts);this.tags.push(n),n.appendChild(document.createTextNode(e+(t||"")))}this.ctr+=1,this.ctr%65e3==0&&this.tags.push(x(this.opts))}},{key:"flush",value:function(){this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0,this.injected=!1}}]),e}(),S=u.createContext({}),A=c,C=function(e){return"theme"!==e&&"innerRef"!==e},k=function(){return!0},T=function(e,t){for(var r=arguments,n=2,o=arguments.length;n<o;n+=1){var i=r[n],c=void 0;for(c in i)e(c)&&(t[c]=i[c])}return t};function R(e,t,r,n){return"<style data-lights-".concat(e,'="').concat(t.substring(1),'"').concat(n,">").concat(r,"</style>")}var D=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(r,!0).forEach(function(t){d(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e,{},t)}(e,t)})});function q(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 V(e,t){return function(r){return q(e,r,t)}}V.variants=function(e,t,r){return function(n){var o=n[t]&&r[n[t]];return o&&q(e,n,o)}};var L=function(e,o){if(void 0!==e.__SECRET_LIGHTS__)return e.__SECRET_LIGHTS__;void 0===o&&(o={});var i=o.key||"css";if("production"!==process.env.NODE_ENV&&/[^a-z-]/.test(i))throw new Error('Pretty Lights key must only contain lower case alphabetical characters and - but "'.concat(i,'" was passed'));var c,a,s=new P(o),u="",f=n(function(e){c+=e,j&&s.insert(e,u)});void 0!==o.prefix&&(a={prefix:o.prefix});var p={registered:{},inserted:{},nonce:o.nonce,key:i};j&&s.inject();var h=new t(a);function d(e,t){if(null==e)return"";switch(l(e)){case"boolean":return"";case"function":if(void 0!==e.__lights_styles){var r=e.toString();if("NO_COMPONENT_SELECTOR"===r&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");return r}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}`"),d.call(this,void 0===this?e():e(this.mergedProps,this.context),t);case"object":return function(e){if(g.has(e))return g.get(e);var t="";return Array.isArray(e)?e.forEach(function(e){t+=d.call(this,e,!1)},this):Object.keys(e).forEach(function(r){if("object"!==l(e[r]))t+=void 0!==p.registered[e[r]]?"".concat(r,"{").concat(p.registered[e[r]],"}"):"".concat(_(r),":").concat(w(r,e[r]),";");else{if("NO_COMPONENT_SELECTOR"===r&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");Array.isArray(e[r])&&"string"==typeof e[r][0]&&void 0===p.registered[e[r][0]]?e[r].forEach(function(e){t+="".concat(_(r),":").concat(w(r,e),";")}):t+="".concat(r,"{").concat(d.call(this,e[r],!1),"}")}},this),g.set(e,t),t}.call(this,e);default:var n=p.registered[e];return!1===t&&void 0!==n?n:e}}h.use(o.stylisPlugins)(f);var y,v,g=new WeakMap,m=/label:\s*([^\s;\n{]+)\s*;/g,b=function(e,t){return r(e+t)+t};if("production"!==process.env.NODE_ENV){var E=b,O=/\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;b=function(e,t){return E(e.replace(O,function(e){return u=e,""}),t)}}var N=function(e){var t=arguments,r=!0,n="",o="";null==e||void 0===e.raw?(r=!1,n+=d.call(this,e,!1)):n+=e[0];for(var i=arguments.length,c=new Array(i>1?i-1:0),a=1;a<i;a++)c[a-1]=t[a];return c.forEach(function(t,o){n+=d.call(this,t,46===n.charCodeAt(n.length-1)),!0===r&&void 0!==e[o+1]&&(n+=e[o+1])},this),v=n,n=n.replace(m,function(e,t){return o+="-".concat(t),""}),y=b(n,o),n};if("production"!==process.env.NODE_ENV){var x=h;h=function(e,t){x(e,t),u=""}}function S(e,t){void 0===p.inserted[y]&&(c="",h(e,t),p.inserted[y]=c)}var A=function(){var e=N.apply(this,arguments),t="".concat(i,"-").concat(y);return void 0===p.registered[t]&&(p.registered[t]=v),S(".".concat(t),e),t};function C(e,t){var r="";return t.split(" ").forEach(function(t){void 0!==p.registered[t]?e.push(t):r+="".concat(t," ")}),r}function k(e,t){var r=[],n=C(r,e);return r.length<2?e:n+A(r,t)}function T(e){p.inserted[e]=!0}if(j){var R=document.querySelectorAll("[data-lights-".concat(i,"]"));Array.prototype.forEach.call(R,function(e){s.tags[0].parentNode.insertBefore(e,s.tags[0]),e.getAttribute("data-lights-".concat(i)).split(" ").forEach(T)})}var D={flush:function(){j&&(s.flush(),s.inject()),p.inserted={},p.registered={}},hydrate:function(e){e.forEach(T)},cx:function(){for(var e=arguments,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=e[n];return k(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 c in i="",o)o[c]&&c&&(i&&(i+=" "),i+=c);break;default:i=o}i&&(r&&(r+=" "),r+=i)}}return r}(r))},merge:k,getRegisteredStyles:C,injectGlobal:function(){S("",N.apply(this,arguments))},keyframes:function(){var e=N.apply(this,arguments),t="animation-".concat(y);return S("","@keyframes ".concat(t,"{").concat(e,"}")),t},css:A,sheet:s,caches:p};return e.__SECRET_LIGHTS__=D,D}("undefined"!=typeof global?global:{}),I=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,c,a;void 0!==n&&(o=n.e,i=n.label,c=n.target,a=r.__lights_forwardProp&&n.shouldForwardProp?function(e){return r.__lights_forwardProp(e)&&n.shouldForwardProp(e)}:n.shouldForwardProp);var s=r.__lights_real===r,l=void 0===o&&s&&r.__lights_base||r;return"function"!=typeof a&&(a="string"==typeof l&&l.charAt(0)===l.charAt(0).toLowerCase()?A:C),function(){var p=arguments,d=s&&void 0!==r.__lights_styles?r.__lights_styles.slice(0):[];if(void 0!==i&&d.push("label:".concat(i,";")),void 0===o)if(null==p[0]||void 0===p[0].raw)d.push.apply(d,p);else{d.push(p[0][0]);for(var y=p.length,v=1;v<y;v+=1)d.push(p[v],p[0][v])}var b=function(t){function r(){return f(this,r),!(e=g(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,u.Component),h(r,[{key:"render",value:function(){var t=this;return u.createElement(S.Consumer,null,function(r){var n=t.props;t.mergedProps=T(k,{},n,{theme:n.theme||r});var i="",s=[];return n.className&&(i+=void 0===o?e.getRegisteredStyles(s,n.className):"".concat(n.className," ")),i+=void 0===o?e.css.apply(t,d.concat(s)):o,void 0!==c&&(i+=" ".concat(c)),u.createElement(l,T(a,{},n,{className:i,ref:n.innerRef}))})}}]),r}();return b.displayName=void 0!==i?i:"Styled(".concat("string"==typeof l?l:l.displayName||l.name||"Component",")"),void 0!==r.defaultProps&&(b.defaultProps=r.defaultProps),b.__lights_styles=d,b.__lights_base=l,b.__lights_real=b,b.__lights_forwardProp=a,Object.defineProperty(b,"toString",{value:function(){return"production"!==process.env.NODE_ENV&&void 0===c?"NO_COMPONENT_SELECTOR":".".concat(c)}}),b.withComponent=function(e,r){return t(e,void 0!==r?T(k,{},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},b}};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}(L),G=function(e){return function(t){for(var r,n=new RegExp("".concat(e.caches.key,"-([a-zA-Z0-9-_]+)"),"gm"),o={html:t,ids:[],css:""},i={};null!==(r=n.exec(t));)void 0===i[r[1]]&&(i[r[1]]=!0);return o.ids=Object.keys(e.caches.inserted).filter(function(t){return(!0===i[t]||void 0===e.caches.registered["".concat(e.caches.key,"-").concat(t)])&&!0!==e.caches.inserted[t]&&(o.css+=e.caches.inserted[t],!0)}),o}}(L),z=function(e,t){return function(r){var n=e.caches,o=n.inserted,i=n.key,c=n.registered,a=new RegExp("<|".concat(i,"-([a-zA-Z0-9-_]+)"),"gm"),s={},u="",l="",f="";for(var p in o)if(o.hasOwnProperty(p)){var h=o[p],d="".concat(i,"-").concat(p);!0!==h&&void 0===c[d]&&(f+=h,l+=" ".concat(p))}""!==f&&(u=R(i,l,f,t));for(var y,v="",g="",m=0;null!==(y=a.exec(r));)if("<"!==y[0]){var b=y[1],_=o[b];!0===_||s[b]||(s[b]=!0,g+=_,v+=" ".concat(b))}else""!==v&&(u+=R(i,v,g,t),v="",g=""),u+=r.substring(m,y.index),m=y.index;return u+r.substring(m)}}(L,void 0!==L.caches.nonce?' nonce="'.concat(L.caches.nonce,'"'):""),M=L.hydrate,F=L.cx,Y=L.merge,H=L.getRegisteredStyles,Z=L.injectGlobal,$=L.keyframes,B=L.css,W=L.sheet,U=L.caches;exports.flush=L.flush,exports.hydrate=M,exports.cx=F,exports.merge=Y,exports.getRegisteredStyles=H,exports.injectGlobal=Z,exports.keyframes=$,exports.css=B,exports.sheet=W,exports.caches=U,exports.ThemeContext=S,exports.ThemeProvider=function(e){return u.createElement(S.Consumer,null,function(t){return e.theme!==t&&(t=D(t)(e.theme)),u.createElement(S.Provider,{value:t},e.children)})},exports.useTheme=function(){return u.useContext(S)},exports.withTheme=function(e){var t=e.displayName||e.name||"Component",r=u.forwardRef(function(t,r){return u.createElement(S.Consumer,null,function(n){return u.createElement(e,y({theme:n,ref:r},t))})});return r.displayName="WithTheme(".concat(t,")"),s(r,e)},exports.themeFn=V,exports.extractCritical=G,exports.renderStylesToString=z,exports.styled=I; | ||
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("stylis-rule-sheet")),o=e(require("@emotion/memoize")),i=e(require("@emotion/unitless")),c=e(require("@emotion/is-prop-valid")),a=e(require("@emotion/weak-memoize")),s=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=/[A-Z]|^ms/g,_=o(function(e){return e.replace(b,"-$&").toLowerCase()}),E=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 w=/(attr|calc|counters?|url)\(/,O=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit","unset"],N=E;E=function(e,t){return"content"===e&&("string"!=typeof t||-1===O.indexOf(t)&&!w.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,"\"'`")),N(e,t)}}var j="undefined"!=typeof document;function P(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("")),(void 0!==e.container?e.container:document.head).appendChild(t),t}var S=function(){function e(t){f(this,e),this.isSpeedy="production"===process.env.NODE_ENV,this.tags=[],this.ctr=0,this.opts=t}return h(e,[{key:"inject",value:function(){if(this.injected)throw new Error("already injected!");this.tags[0]=P(this.opts),this.injected=!0}},{key:"speedy",value:function(e){if(0!==this.ctr)throw new Error("cannot change speedy now");this.isSpeedy=!!e}},{key:"insert",value:function(e,t){if(this.isSpeedy){var r=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]}(this.tags[this.tags.length-1]);try{r.insertRule(e,r.cssRules.length)}catch(t){"production"!==process.env.NODE_ENV&&console.warn("illegal rule",e)}}else{var n=P(this.opts);this.tags.push(n),n.appendChild(document.createTextNode(e+(t||"")))}this.ctr+=1,this.ctr%65e3==0&&this.tags.push(P(this.opts))}},{key:"flush",value:function(){this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0,this.injected=!1}}]),e}(),x=u.createContext({}),A=c,C=function(e){return"theme"!==e&&"innerRef"!==e},T=function(){return!0},k=function(e,t){for(var r=arguments,n=2,o=arguments.length;n<o;n+=1){var i=r[n],c=void 0;for(c in i)e(c)&&(t[c]=i[c])}return t},D=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(r,!0).forEach(function(t){d(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e,{},t)}(e,t)})});function R(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 q(e,t){return function(r){return R(e,r,t)}}q.variants=function(e,t,r){return function(n){var o=n[t]&&r[n[t]];return o&&R(e,n,o)}};var V=function(e,o){if(void 0!==e.__SECRET_LIGHTS__)return e.__SECRET_LIGHTS__;void 0===o&&(o={});var i=o.key||"css";if("production"!==process.env.NODE_ENV&&/[^a-z-]/.test(i))throw new Error('Pretty Lights key must only contain lower case alphabetical characters and - but "'.concat(i,'" was passed'));var c,a,s=new S(o),u="",f=n(function(e){c+=e,j&&s.insert(e,u)});void 0!==o.prefix&&(a={prefix:o.prefix});var p={registered:{},inserted:{},nonce:o.nonce,key:i};j&&s.inject();var h=new t(a);function d(e,t){if(null==e)return"";switch(l(e)){case"boolean":return"";case"function":if(void 0!==e.__lights_styles){var r=e.toString();if("NO_COMPONENT_SELECTOR"===r&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");return r}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}`"),d.call(this,void 0===this?e():e(this.mergedProps,this.context),t);case"object":return function(e){if(m.has(e))return m.get(e);var t="";return Array.isArray(e)?e.forEach(function(e){t+=d.call(this,e,!1)},this):Object.keys(e).forEach(function(r){if("object"!==l(e[r]))t+=void 0!==p.registered[e[r]]?"".concat(r,"{").concat(p.registered[e[r]],"}"):"".concat(_(r),":").concat(E(r,e[r]),";");else{if("NO_COMPONENT_SELECTOR"===r&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");Array.isArray(e[r])&&"string"==typeof e[r][0]&&void 0===p.registered[e[r][0]]?e[r].forEach(function(e){t+="".concat(_(r),":").concat(E(r,e),";")}):t+="".concat(r,"{").concat(d.call(this,e[r],!1),"}")}},this),m.set(e,t),t}.call(this,e);default:var n=p.registered[e];return!1===t&&void 0!==n?n:e}}h.use(o.stylisPlugins)(f);var y,v,m=new WeakMap,g=/label:\s*([^\s;\n{]+)\s*;/g,b=function(e,t){return r(e+t)+t};if("production"!==process.env.NODE_ENV){var w=b,O=/\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;b=function(e,t){return w(e.replace(O,function(e){return u=e,""}),t)}}var N=function(e){var t=arguments,r=!0,n="",o="";null==e||void 0===e.raw?(r=!1,n+=d.call(this,e,!1)):n+=e[0];for(var i=arguments.length,c=new Array(i>1?i-1:0),a=1;a<i;a++)c[a-1]=t[a];return c.forEach(function(t,o){n+=d.call(this,t,46===n.charCodeAt(n.length-1)),!0===r&&void 0!==e[o+1]&&(n+=e[o+1])},this),v=n,n=n.replace(g,function(e,t){return o+="-".concat(t),""}),y=b(n,o),n};if("production"!==process.env.NODE_ENV){var P=h;h=function(e,t){P(e,t),u=""}}function x(e,t){void 0===p.inserted[y]&&(c="",h(e,t),p.inserted[y]=c)}var A=function(){var e=N.apply(this,arguments),t="".concat(i,"-").concat(y);return void 0===p.registered[t]&&(p.registered[t]=v),x(".".concat(t),e),t};function C(e,t){var r="";return t.split(" ").forEach(function(t){void 0!==p.registered[t]?e.push(t):r+="".concat(t," ")}),r}function T(e,t){var r=[],n=C(r,e);return r.length<2?e:n+A(r,t)}function k(e){p.inserted[e]=!0}if(j){var D=document.querySelectorAll("[data-lights-".concat(i,"]"));Array.prototype.forEach.call(D,function(e){s.tags[0].parentNode.insertBefore(e,s.tags[0]),e.getAttribute("data-lights-".concat(i)).split(" ").forEach(k)})}var R={flush:function(){j&&(s.flush(),s.inject()),p.inserted={},p.registered={}},hydrate:function(e){e.forEach(k)},cx:function(){for(var e=arguments,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=e[n];return T(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 c in i="",o)o[c]&&c&&(i&&(i+=" "),i+=c);break;default:i=o}i&&(r&&(r+=" "),r+=i)}}return r}(r))},merge:T,getRegisteredStyles:C,injectGlobal:function(){x("",N.apply(this,arguments))},keyframes:function(){var e=N.apply(this,arguments),t="animation-".concat(y);return x("","@keyframes ".concat(t,"{").concat(e,"}")),t},css:A,sheet:s,caches:p};return e.__SECRET_LIGHTS__=R,R}("undefined"!=typeof global?global:{}),L=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,c,a;void 0!==n&&(o=n.e,i=n.label,c=n.target,a=r.__lights_forwardProp&&n.shouldForwardProp?function(e){return r.__lights_forwardProp(e)&&n.shouldForwardProp(e)}:n.shouldForwardProp);var s=r.__lights_real===r,l=void 0===o&&s&&r.__lights_base||r;return"function"!=typeof a&&(a="string"==typeof l&&l.charAt(0)===l.charAt(0).toLowerCase()?A:C),function(){var p=arguments,d=s&&void 0!==r.__lights_styles?r.__lights_styles.slice(0):[];if(void 0!==i&&d.push("label:".concat(i,";")),void 0===o)if(null==p[0]||void 0===p[0].raw)d.push.apply(d,p);else{d.push(p[0][0]);for(var y=p.length,v=1;v<y;v+=1)d.push(p[v],p[0][v])}var b=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(x.Consumer,null,function(r){var n=t.props;t.mergedProps=k(T,{},n,{theme:n.theme||r});var i="",s=[];return n.className&&(i+=void 0===o?e.getRegisteredStyles(s,n.className):"".concat(n.className," ")),i+=void 0===o?e.css.apply(t,d.concat(s)):o,void 0!==c&&(i+=" ".concat(c)),u.createElement(l,k(a,{},n,{className:i,ref:n.innerRef}))})}}]),r}();return b.displayName=void 0!==i?i:"Styled(".concat("string"==typeof l?l:l.displayName||l.name||"Component",")"),void 0!==r.defaultProps&&(b.defaultProps=r.defaultProps),b.__lights_styles=d,b.__lights_base=l,b.__lights_real=b,b.__lights_forwardProp=a,Object.defineProperty(b,"toString",{value:function(){return"production"!==process.env.NODE_ENV&&void 0===c?"NO_COMPONENT_SELECTOR":".".concat(c)}}),b.withComponent=function(e,r){return t(e,void 0!==r?k(T,{},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},b}};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}(V),I=V.hydrate,G=V.cx,M=V.merge,F=V.getRegisteredStyles,Y=V.injectGlobal,z=V.keyframes,H=V.css,$=V.sheet,B=V.caches;exports.flush=V.flush,exports.hydrate=I,exports.cx=G,exports.merge=M,exports.getRegisteredStyles=F,exports.injectGlobal=Y,exports.keyframes=z,exports.css=H,exports.sheet=$,exports.caches=B,exports.ThemeContext=x,exports.ThemeProvider=function(e){return u.createElement(x.Consumer,null,function(t){return e.theme!==t&&(t=D(t)(e.theme)),u.createElement(x.Provider,{value:t},e.children)})},exports.useTheme=function(){return u.useContext(x)},exports.withTheme=function(e){var t=e.displayName||e.name||"Component",r=u.forwardRef(function(t,r){return u.createElement(x.Consumer,null,function(n){return u.createElement(e,y({theme:n,ref:r},t))})});return r.displayName="WithTheme(".concat(t,")"),s(r,e)},exports.themeFn=q,exports.styled=L; | ||
//# sourceMappingURL=pretty-lights.js.map |
@@ -1,2 +0,2 @@ | ||
import e from"@emotion/stylis";import t from"@emotion/hash";import n from"stylis-rule-sheet";import r from"@emotion/memoize";import o from"@emotion/unitless";import i from"@emotion/is-prop-valid";import c from"@emotion/weak-memoize";import a from"hoist-non-react-statics";import s from"react";function u(e){return(u="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 l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}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=/[A-Z]|^ms/g,b=r(function(e){return e.replace(g,"-$&").toLowerCase()}),_=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 E=/(attr|calc|counters?|url)\(/,w=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit","unset"],O=_;_=function(e,t){return"content"===e&&("string"!=typeof t||-1===w.indexOf(t)&&!E.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,"\"'`")),O(e,t)}}var N="undefined"!=typeof document;function j(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("")),(void 0!==e.container?e.container:document.head).appendChild(t),t}var P=function(){function e(t){l(this,e),this.isSpeedy="production"===process.env.NODE_ENV,this.tags=[],this.ctr=0,this.opts=t}return p(e,[{key:"inject",value:function(){if(this.injected)throw new Error("already injected!");this.tags[0]=j(this.opts),this.injected=!0}},{key:"speedy",value:function(e){if(0!==this.ctr)throw new Error("cannot change speedy now");this.isSpeedy=!!e}},{key:"insert",value:function(e,t){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]}(this.tags[this.tags.length-1]);try{n.insertRule(e,n.cssRules.length)}catch(t){"production"!==process.env.NODE_ENV&&console.warn("illegal rule",e)}}else{var r=j(this.opts);this.tags.push(r),r.appendChild(document.createTextNode(e+(t||"")))}this.ctr+=1,this.ctr%65e3==0&&this.tags.push(j(this.opts))}},{key:"flush",value:function(){this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0,this.injected=!1}}]),e}(),S=s.createContext({}),A=i,C=function(e){return"theme"!==e&&"innerRef"!==e},k=function(){return!0},x=function(e,t){for(var n=arguments,r=2,o=arguments.length;r<o;r+=1){var i=n[r],c=void 0;for(c in i)e(c)&&(t[c]=i[c])}return t};function T(e,t,n,r){return"<style data-lights-".concat(e,'="').concat(t.substring(1),'"').concat(r,">").concat(n,"</style>")}var D=c(function(e){return c(function(t){return function(e,t){if("function"==typeof t){var n=t(e);if("production"!==process.env.NODE_ENV&&(null==n||"object"!==u(n)||Array.isArray(n)))throw new Error("[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!");return n}if("production"!==process.env.NODE_ENV&&(null==t||"object"!==u(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 n=null!=arguments[t]?arguments[t]:{};t%2?y(n,!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e,{},t)}(e,t)})}),R=function(e){return s.createElement(S.Consumer,null,function(t){return e.theme!==t&&(t=D(t)(e.theme)),s.createElement(S.Provider,{value:t},e.children)})};function V(e){var t=e.displayName||e.name||"Component",n=s.forwardRef(function(t,n){return s.createElement(S.Consumer,null,function(r){return s.createElement(e,d({theme:r,ref:n},t))})});return n.displayName="WithTheme(".concat(t,")"),a(n,e)}function L(){return s.useContext(S)}function I(e,t,n){var r,o=t.theme&&t.theme[e];return"function"==typeof(r="function"==typeof o?o(n):n[o]?n[o]:n.none)?r(t):r}function q(e,t){return function(n){return I(e,n,t)}}q.variants=function(e,t,n){return function(r){var o=r[t]&&n[r[t]];return o&&I(e,r,o)}};var z=function(r,o){if(void 0!==r.__SECRET_LIGHTS__)return r.__SECRET_LIGHTS__;void 0===o&&(o={});var i=o.key||"css";if("production"!==process.env.NODE_ENV&&/[^a-z-]/.test(i))throw new Error('Pretty Lights key must only contain lower case alphabetical characters and - but "'.concat(i,'" was passed'));var c,a,s=new P(o),l="",f=n(function(e){c+=e,N&&s.insert(e,l)});void 0!==o.prefix&&(a={prefix:o.prefix});var p={registered:{},inserted:{},nonce:o.nonce,key:i};N&&s.inject();var h=new e(a);function d(e,t){if(null==e)return"";switch(u(e)){case"boolean":return"";case"function":if(void 0!==e.__lights_styles){var n=e.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}`"),d.call(this,void 0===this?e():e(this.mergedProps,this.context),t);case"object":return function(e){if(m.has(e))return m.get(e);var t="";return Array.isArray(e)?e.forEach(function(e){t+=d.call(this,e,!1)},this):Object.keys(e).forEach(function(n){if("object"!==u(e[n]))t+=void 0!==p.registered[e[n]]?"".concat(n,"{").concat(p.registered[e[n]],"}"):"".concat(b(n),":").concat(_(n,e[n]),";");else{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.");Array.isArray(e[n])&&"string"==typeof e[n][0]&&void 0===p.registered[e[n][0]]?e[n].forEach(function(e){t+="".concat(b(n),":").concat(_(n,e),";")}):t+="".concat(n,"{").concat(d.call(this,e[n],!1),"}")}},this),m.set(e,t),t}.call(this,e);default:var r=p.registered[e];return!1===t&&void 0!==r?r:e}}h.use(o.stylisPlugins)(f);var y,v,m=new WeakMap,g=/label:\s*([^\s;\n{]+)\s*;/g,E=function(e,n){return t(e+n)+n};if("production"!==process.env.NODE_ENV){var w=E,O=/\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;E=function(e,t){return w(e.replace(O,function(e){return l=e,""}),t)}}var j=function(e){var t=arguments,n=!0,r="",o="";null==e||void 0===e.raw?(n=!1,r+=d.call(this,e,!1)):r+=e[0];for(var i=arguments.length,c=new Array(i>1?i-1:0),a=1;a<i;a++)c[a-1]=t[a];return c.forEach(function(t,o){r+=d.call(this,t,46===r.charCodeAt(r.length-1)),!0===n&&void 0!==e[o+1]&&(r+=e[o+1])},this),v=r,r=r.replace(g,function(e,t){return o+="-".concat(t),""}),y=E(r,o),r};if("production"!==process.env.NODE_ENV){var S=h;h=function(e,t){S(e,t),l=""}}function A(e,t){void 0===p.inserted[y]&&(c="",h(e,t),p.inserted[y]=c)}var C=function(){var e=j.apply(this,arguments),t="".concat(i,"-").concat(y);return void 0===p.registered[t]&&(p.registered[t]=v),A(".".concat(t),e),t};function k(e,t){var n="";return t.split(" ").forEach(function(t){void 0!==p.registered[t]?e.push(t):n+="".concat(t," ")}),n}function x(e,t){var n=[],r=k(n,e);return n.length<2?e:r+C(n,t)}function T(e){p.inserted[e]=!0}if(N){var D=document.querySelectorAll("[data-lights-".concat(i,"]"));Array.prototype.forEach.call(D,function(e){s.tags[0].parentNode.insertBefore(e,s.tags[0]),e.getAttribute("data-lights-".concat(i)).split(" ").forEach(T)})}var R={flush:function(){N&&(s.flush(),s.inject()),p.inserted={},p.registered={}},hydrate:function(e){e.forEach(T)},cx:function(){for(var e=arguments,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=e[r];return x(function e(t){for(var n="",r=0;r<t.length;r+=1){var o=t[r];if(null!=o){var i=void 0;switch(u(o)){case"boolean":break;case"object":if(Array.isArray(o))i=e(o);else for(var c in i="",o)o[c]&&c&&(i&&(i+=" "),i+=c);break;default:i=o}i&&(n&&(n+=" "),n+=i)}}return n}(n))},merge:x,getRegisteredStyles:k,injectGlobal:function(){A("",j.apply(this,arguments))},keyframes:function(){var e=j.apply(this,arguments),t="animation-".concat(y);return A("","@keyframes ".concat(t,"{").concat(e,"}")),t},css:C,sheet:s,caches:p};return r.__SECRET_LIGHTS__=R,R}("undefined"!=typeof global?global:{}),G=function(e){var t=function(n,r){if("production"!==process.env.NODE_ENV&&void 0===n)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,c,a;void 0!==r&&(o=r.e,i=r.label,c=r.target,a=n.__lights_forwardProp&&r.shouldForwardProp?function(e){return n.__lights_forwardProp(e)&&r.shouldForwardProp(e)}:r.shouldForwardProp);var u=n.__lights_real===n,f=void 0===o&&u&&n.__lights_base||n;return"function"!=typeof a&&(a="string"==typeof f&&f.charAt(0)===f.charAt(0).toLowerCase()?A:C),function(){var h=arguments,d=u&&void 0!==n.__lights_styles?n.__lights_styles.slice(0):[];if(void 0!==i&&d.push("label:".concat(i,";")),void 0===o)if(null==h[0]||void 0===h[0].raw)d.push.apply(d,h);else{d.push(h[0][0]);for(var y=h.length,g=1;g<y;g+=1)d.push(h[g],h[0][g])}var b=function(t){function n(){return l(this,n),!(e=v(n).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)}(n,s.Component),p(n,[{key:"render",value:function(){var t=this;return s.createElement(S.Consumer,null,function(n){var r=t.props;t.mergedProps=x(k,{},r,{theme:r.theme||n});var i="",u=[];return r.className&&(i+=void 0===o?e.getRegisteredStyles(u,r.className):"".concat(r.className," ")),i+=void 0===o?e.css.apply(t,d.concat(u)):o,void 0!==c&&(i+=" ".concat(c)),s.createElement(f,x(a,{},r,{className:i,ref:r.innerRef}))})}}]),n}();return b.displayName=void 0!==i?i:"Styled(".concat("string"==typeof f?f:f.displayName||f.name||"Component",")"),void 0!==n.defaultProps&&(b.defaultProps=n.defaultProps),b.__lights_styles=d,b.__lights_base=f,b.__lights_real=b,b.__lights_forwardProp=a,Object.defineProperty(b,"toString",{value:function(){return"production"!==process.env.NODE_ENV&&void 0===c?"NO_COMPONENT_SELECTOR":".".concat(c)}}),b.withComponent=function(e,n){return t(e,void 0!==n?x(k,{},r,n):r).apply(void 0,function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(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},b}};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}(z),M=function(e){return function(t){for(var n,r=new RegExp("".concat(e.caches.key,"-([a-zA-Z0-9-_]+)"),"gm"),o={html:t,ids:[],css:""},i={};null!==(n=r.exec(t));)void 0===i[n[1]]&&(i[n[1]]=!0);return o.ids=Object.keys(e.caches.inserted).filter(function(t){return(!0===i[t]||void 0===e.caches.registered["".concat(e.caches.key,"-").concat(t)])&&!0!==e.caches.inserted[t]&&(o.css+=e.caches.inserted[t],!0)}),o}}(z),F=function(e,t){return function(n){var r=e.caches,o=r.inserted,i=r.key,c=r.registered,a=new RegExp("<|".concat(i,"-([a-zA-Z0-9-_]+)"),"gm"),s={},u="",l="",f="";for(var p in o)if(o.hasOwnProperty(p)){var h=o[p],d="".concat(i,"-").concat(p);!0!==h&&void 0===c[d]&&(f+=h,l+=" ".concat(p))}""!==f&&(u=T(i,l,f,t));for(var y,v="",m="",g=0;null!==(y=a.exec(n));)if("<"!==y[0]){var b=y[1],_=o[b];!0===_||s[b]||(s[b]=!0,m+=_,v+=" ".concat(b))}else""!==v&&(u+=T(i,v,m,t),v="",m=""),u+=n.substring(g,y.index),g=y.index;return u+n.substring(g)}}(z,void 0!==z.caches.nonce?' nonce="'.concat(z.caches.nonce,'"'):""),Y=z.flush,H=z.hydrate,Z=z.cx,$=z.merge,B=z.getRegisteredStyles,W=z.injectGlobal,U=z.keyframes,J=z.css,K=z.sheet,Q=z.caches;export{Y as flush,H as hydrate,Z as cx,$ as merge,B as getRegisteredStyles,W as injectGlobal,U as keyframes,J as css,K as sheet,Q as caches,S as ThemeContext,R as ThemeProvider,L as useTheme,V as withTheme,q as themeFn,M as extractCritical,F as renderStylesToString,G as styled}; | ||
import e from"@emotion/stylis";import t from"@emotion/hash";import r from"stylis-rule-sheet";import n from"@emotion/memoize";import o from"@emotion/unitless";import i from"@emotion/is-prop-valid";import c from"@emotion/weak-memoize";import a from"hoist-non-react-statics";import s from"react";function u(e){return(u="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 l(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=/[A-Z]|^ms/g,b=n(function(e){return e.replace(g,"-$&").toLowerCase()}),_=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 E=/(attr|calc|counters?|url)\(/,w=["normal","none","counter","open-quote","close-quote","no-open-quote","no-close-quote","initial","inherit","unset"],O=_;_=function(e,t){return"content"===e&&("string"!=typeof t||-1===w.indexOf(t)&&!E.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,"\"'`")),O(e,t)}}var N="undefined"!=typeof document;function j(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("")),(void 0!==e.container?e.container:document.head).appendChild(t),t}var P=function(){function e(t){l(this,e),this.isSpeedy="production"===process.env.NODE_ENV,this.tags=[],this.ctr=0,this.opts=t}return p(e,[{key:"inject",value:function(){if(this.injected)throw new Error("already injected!");this.tags[0]=j(this.opts),this.injected=!0}},{key:"speedy",value:function(e){if(0!==this.ctr)throw new Error("cannot change speedy now");this.isSpeedy=!!e}},{key:"insert",value:function(e,t){if(this.isSpeedy){var r=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]}(this.tags[this.tags.length-1]);try{r.insertRule(e,r.cssRules.length)}catch(t){"production"!==process.env.NODE_ENV&&console.warn("illegal rule",e)}}else{var n=j(this.opts);this.tags.push(n),n.appendChild(document.createTextNode(e+(t||"")))}this.ctr+=1,this.ctr%65e3==0&&this.tags.push(j(this.opts))}},{key:"flush",value:function(){this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0,this.injected=!1}}]),e}(),S=s.createContext({}),A=i,C=function(e){return"theme"!==e&&"innerRef"!==e},k=function(){return!0},T=function(e,t){for(var r=arguments,n=2,o=arguments.length;n<o;n+=1){var i=r[n],c=void 0;for(c in i)e(c)&&(t[c]=i[c])}return t},D=c(function(e){return c(function(t){return function(e,t){if("function"==typeof t){var r=t(e);if("production"!==process.env.NODE_ENV&&(null==r||"object"!==u(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"!==u(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(r,!0).forEach(function(t){h(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e,{},t)}(e,t)})}),x=function(e){return s.createElement(S.Consumer,null,function(t){return e.theme!==t&&(t=D(t)(e.theme)),s.createElement(S.Provider,{value:t},e.children)})};function R(e){var t=e.displayName||e.name||"Component",r=s.forwardRef(function(t,r){return s.createElement(S.Consumer,null,function(n){return s.createElement(e,d({theme:n,ref:r},t))})});return r.displayName="WithTheme(".concat(t,")"),a(r,e)}function V(){return s.useContext(S)}function L(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 I(e,t){return function(r){return L(e,r,t)}}I.variants=function(e,t,r){return function(n){var o=n[t]&&r[n[t]];return o&&L(e,n,o)}};var q=function(n,o){if(void 0!==n.__SECRET_LIGHTS__)return n.__SECRET_LIGHTS__;void 0===o&&(o={});var i=o.key||"css";if("production"!==process.env.NODE_ENV&&/[^a-z-]/.test(i))throw new Error('Pretty Lights key must only contain lower case alphabetical characters and - but "'.concat(i,'" was passed'));var c,a,s=new P(o),l="",f=r(function(e){c+=e,N&&s.insert(e,l)});void 0!==o.prefix&&(a={prefix:o.prefix});var p={registered:{},inserted:{},nonce:o.nonce,key:i};N&&s.inject();var h=new e(a);function d(e,t){if(null==e)return"";switch(u(e)){case"boolean":return"";case"function":if(void 0!==e.__lights_styles){var r=e.toString();if("NO_COMPONENT_SELECTOR"===r&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");return r}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}`"),d.call(this,void 0===this?e():e(this.mergedProps,this.context),t);case"object":return function(e){if(m.has(e))return m.get(e);var t="";return Array.isArray(e)?e.forEach(function(e){t+=d.call(this,e,!1)},this):Object.keys(e).forEach(function(r){if("object"!==u(e[r]))t+=void 0!==p.registered[e[r]]?"".concat(r,"{").concat(p.registered[e[r]],"}"):"".concat(b(r),":").concat(_(r,e[r]),";");else{if("NO_COMPONENT_SELECTOR"===r&&"production"!==process.env.NODE_ENV)throw new Error("Component selectors can only be used in conjunction with pretty-lights/babel.");Array.isArray(e[r])&&"string"==typeof e[r][0]&&void 0===p.registered[e[r][0]]?e[r].forEach(function(e){t+="".concat(b(r),":").concat(_(r,e),";")}):t+="".concat(r,"{").concat(d.call(this,e[r],!1),"}")}},this),m.set(e,t),t}.call(this,e);default:var n=p.registered[e];return!1===t&&void 0!==n?n:e}}h.use(o.stylisPlugins)(f);var y,v,m=new WeakMap,g=/label:\s*([^\s;\n{]+)\s*;/g,E=function(e,r){return t(e+r)+r};if("production"!==process.env.NODE_ENV){var w=E,O=/\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;E=function(e,t){return w(e.replace(O,function(e){return l=e,""}),t)}}var j=function(e){var t=arguments,r=!0,n="",o="";null==e||void 0===e.raw?(r=!1,n+=d.call(this,e,!1)):n+=e[0];for(var i=arguments.length,c=new Array(i>1?i-1:0),a=1;a<i;a++)c[a-1]=t[a];return c.forEach(function(t,o){n+=d.call(this,t,46===n.charCodeAt(n.length-1)),!0===r&&void 0!==e[o+1]&&(n+=e[o+1])},this),v=n,n=n.replace(g,function(e,t){return o+="-".concat(t),""}),y=E(n,o),n};if("production"!==process.env.NODE_ENV){var S=h;h=function(e,t){S(e,t),l=""}}function A(e,t){void 0===p.inserted[y]&&(c="",h(e,t),p.inserted[y]=c)}var C=function(){var e=j.apply(this,arguments),t="".concat(i,"-").concat(y);return void 0===p.registered[t]&&(p.registered[t]=v),A(".".concat(t),e),t};function k(e,t){var r="";return t.split(" ").forEach(function(t){void 0!==p.registered[t]?e.push(t):r+="".concat(t," ")}),r}function T(e,t){var r=[],n=k(r,e);return r.length<2?e:n+C(r,t)}function D(e){p.inserted[e]=!0}if(N){var x=document.querySelectorAll("[data-lights-".concat(i,"]"));Array.prototype.forEach.call(x,function(e){s.tags[0].parentNode.insertBefore(e,s.tags[0]),e.getAttribute("data-lights-".concat(i)).split(" ").forEach(D)})}var R={flush:function(){N&&(s.flush(),s.inject()),p.inserted={},p.registered={}},hydrate:function(e){e.forEach(D)},cx:function(){for(var e=arguments,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=e[n];return T(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(u(o)){case"boolean":break;case"object":if(Array.isArray(o))i=e(o);else for(var c in i="",o)o[c]&&c&&(i&&(i+=" "),i+=c);break;default:i=o}i&&(r&&(r+=" "),r+=i)}}return r}(r))},merge:T,getRegisteredStyles:k,injectGlobal:function(){A("",j.apply(this,arguments))},keyframes:function(){var e=j.apply(this,arguments),t="animation-".concat(y);return A("","@keyframes ".concat(t,"{").concat(e,"}")),t},css:C,sheet:s,caches:p};return n.__SECRET_LIGHTS__=R,R}("undefined"!=typeof global?global:{}),G=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,c,a;void 0!==n&&(o=n.e,i=n.label,c=n.target,a=r.__lights_forwardProp&&n.shouldForwardProp?function(e){return r.__lights_forwardProp(e)&&n.shouldForwardProp(e)}:n.shouldForwardProp);var u=r.__lights_real===r,f=void 0===o&&u&&r.__lights_base||r;return"function"!=typeof a&&(a="string"==typeof f&&f.charAt(0)===f.charAt(0).toLowerCase()?A:C),function(){var h=arguments,d=u&&void 0!==r.__lights_styles?r.__lights_styles.slice(0):[];if(void 0!==i&&d.push("label:".concat(i,";")),void 0===o)if(null==h[0]||void 0===h[0].raw)d.push.apply(d,h);else{d.push(h[0][0]);for(var y=h.length,g=1;g<y;g+=1)d.push(h[g],h[0][g])}var b=function(t){function r(){return l(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(S.Consumer,null,function(r){var n=t.props;t.mergedProps=T(k,{},n,{theme:n.theme||r});var i="",u=[];return n.className&&(i+=void 0===o?e.getRegisteredStyles(u,n.className):"".concat(n.className," ")),i+=void 0===o?e.css.apply(t,d.concat(u)):o,void 0!==c&&(i+=" ".concat(c)),s.createElement(f,T(a,{},n,{className:i,ref:n.innerRef}))})}}]),r}();return b.displayName=void 0!==i?i:"Styled(".concat("string"==typeof f?f:f.displayName||f.name||"Component",")"),void 0!==r.defaultProps&&(b.defaultProps=r.defaultProps),b.__lights_styles=d,b.__lights_base=f,b.__lights_real=b,b.__lights_forwardProp=a,Object.defineProperty(b,"toString",{value:function(){return"production"!==process.env.NODE_ENV&&void 0===c?"NO_COMPONENT_SELECTOR":".".concat(c)}}),b.withComponent=function(e,r){return t(e,void 0!==r?T(k,{},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},b}};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}(q),M=q.flush,F=q.hydrate,Y=q.cx,z=q.merge,H=q.getRegisteredStyles,$=q.injectGlobal,B=q.keyframes,W=q.css,U=q.sheet,Z=q.caches;export{M as flush,F as hydrate,Y as cx,z as merge,H as getRegisteredStyles,$ as injectGlobal,B as keyframes,W as css,U as sheet,Z as caches,S as ThemeContext,x as ThemeProvider,V as useTheme,R as withTheme,I as themeFn,G as styled}; | ||
//# sourceMappingURL=pretty-lights.modern.js.map |
{ | ||
"name": "pretty-lights", | ||
"version": "0.0.11", | ||
"version": "0.0.12-alpha.0", | ||
"description": "CSS-in-JS with a reliable API", | ||
"main": "lib/pretty-lights.js", | ||
"umd:main": "lib/pretty-lights.umd.js", | ||
"module": "lib/pretty-lights.modern.js", | ||
@@ -12,3 +11,4 @@ "source": "src/index.js", | ||
"jest/", | ||
"lib/" | ||
"lib/", | ||
"server/" | ||
], | ||
@@ -93,7 +93,8 @@ "repository": { | ||
"scripts": { | ||
"clean": "rimraf lib babel jest", | ||
"clean": "rimraf lib babel jest server", | ||
"build:jest": "babel src/jest --ignore \"**/__tests__/**\" -d jest", | ||
"build:babel": "babel src/babel --ignore \"**/__tests__/**\" -d babel", | ||
"build:main": "NODE_ENV=production microbundle --jsx React.createElement", | ||
"build:dev": "npm run clean && npm run build:jest && npm run build:babel", | ||
"build:server": "babel src/server --ignore \"**/__tests__/**\" -d server", | ||
"build:main": "NODE_ENV=production microbundle --jsx React.createElement -f es,cjs", | ||
"build:dev": "npm run clean && npm run build:jest && npm run build:babel && npm run build:server", | ||
"build": "npm run build:dev && npm run build:main", | ||
@@ -100,0 +101,0 @@ "prepare": "npm run build", |
@@ -62,6 +62,36 @@ # pretty-lights | ||
- [`css`](./src/create/README.md) | ||
### Core API | ||
- [`css`](./src/create/README.md#css) | ||
- [`cx`](./src/create/README.md#cx) | ||
- [`keyframes`](./src/create/README.md#keyframes) | ||
- [`injectGlobal`](./src/create/README.md#injectGlobal) | ||
### Styled Components | ||
- [`styled`](./src/styled/README.md) | ||
- [`extractCritical`](./src/server/README.md#extractcritical) / [`hydrate`](./src/create/README.md#hydrate) | ||
- [`ThemeProvider`](./src/theming/README.md#themeprovider) / [`withTheme`](./src/theming/README.md#withtheme) / [`useTheme`](./src/theming/README.md#usetheme) | ||
### Theming | ||
- [`ThemeProvider`](./src/theming/README.md#themeprovider) | ||
- [`withTheme`](./src/theming/README.md#withtheme) | ||
- [`useTheme`](./src/theming/README.md#usetheme) | ||
- [`themeFn`](./src/theming/README.md#themeFn) | ||
### SSR | ||
- [`extractCritical`](./src/server/README.md#extractcritical) | ||
- [`hydrate`](./src/create/README.md#hydrate) | ||
- [`renderStylesToString`](./src/server/README.md#renderStylesToString) | ||
### Jest | ||
- [`pretty-lights/jest`](./src/jest/README.md) | ||
### Babel | ||
- [`pretty-lights/babel`](./src/babel/README.md) | ||
### ESLint | ||
- [`eslint-plugin-pretty-lights`](./src/eslint/README.md) |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
18
936
3
97
30
147711