styled-components 6.0.0 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hoc/withTheme.d.ts +1 -1
- package/dist/models/StyleSheetManager.d.ts +7 -7
- package/dist/sheet/Tag.d.ts +4 -4
- package/dist/styled-components.browser.cjs.js +1 -1
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +1 -1
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +1 -1
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +1 -1
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +28 -22
- package/dist/styled-components.js.map +1 -1
- package/dist/styled-components.min.js +1 -1
- package/dist/styled-components.min.js.map +1 -1
- package/dist/test/utils.d.ts +1 -0
- package/dist/types.d.ts +8 -5
- package/native/dist/hoc/withTheme.d.ts +1 -1
- package/native/dist/models/StyleSheetManager.d.ts +7 -7
- package/native/dist/sheet/Tag.d.ts +4 -4
- package/native/dist/styled-components.native.cjs.js +1 -1
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +1 -1
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/test/utils.d.ts +1 -0
- package/native/dist/types.d.ts +8 -5
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__spreadArray as e,__assign as t}from"tslib";import n from"@emotion/is-prop-valid";import o,{useRef as r,useState as s,useMemo as i,useEffect as a,useContext as c,useDebugValue as l,createElement as u}from"react";import p from"shallowequal";import*as d from"stylis";import h from"@emotion/unitless";var f="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",m="6.0.0",y=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),v={},g=/invalid hook call/i,S=new Set,w=function(t,n){if("production"!==process.env.NODE_ENV){var o=n?' with the id of "'.concat(n,'"'):"",s="The component ".concat(t).concat(o," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.",i=console.error;try{var a=!0;console.error=function(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];g.test(t)?(a=!1,S.delete(s)):i.apply(void 0,e([t],n,!1))},r(),a&&!S.has(s)&&(console.warn(s),S.add(s))}catch(e){g.test(e.message)&&S.delete(s)}finally{console.error=i}}},b=Object.freeze([]),E=Object.freeze({});function N(e,t,n){return void 0===n&&(n=E),e.theme!==n.theme&&e.theme||t||n.theme}var P=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),_=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,C=/(^-|-$)/g;function I(e){return e.replace(_,"-").replace(C,"")}var A=/(a)(d)/gi,O=function(e){return String.fromCharCode(e+(e>25?39:97))};function D(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=O(t%52)+n;return(O(t%52)+n).replace(A,"$1-$2")}var R,T=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},j=function(e){return T(5381,e)};function x(e){return D(j(e)>>>0)}function k(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function V(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var M="function"==typeof Symbol&&Symbol.for,F=M?Symbol.for("react.memo"):60115,$=M?Symbol.for("react.forward_ref"):60112,z={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},B={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},G={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},L=((R={})[$]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},R[F]=G,R);function Y(e){return("type"in(t=e)&&t.type.$$typeof)===F?G:"$$typeof"in e?L[e.$$typeof]:z;var t}var W=Object.defineProperty,q=Object.getOwnPropertyNames,H=Object.getOwnPropertySymbols,U=Object.getOwnPropertyDescriptor,J=Object.getPrototypeOf,X=Object.prototype;function Z(e,t,n){if("string"!=typeof t){if(X){var o=J(t);o&&o!==X&&Z(e,o,n)}var r=q(t);H&&(r=r.concat(H(t)));for(var s=Y(e),i=Y(t),a=0;a<r.length;++a){var c=r[a];if(!(c in B||n&&n[c]||i&&c in i||s&&c in s)){var l=U(t,c);try{W(e,c,l)}catch(e){}}}}return e}function K(e){return"function"==typeof e}function Q(e){return"object"==typeof e&&"styledComponentId"in e}function ee(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function te(e,t){if(0===e.length)return"";for(var n=e[0],o=1;o<e.length;o++)n+=t?t+e[o]:e[o];return n}function ne(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function oe(e,t,n){if(void 0===n&&(n=!1),!n&&!ne(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var o=0;o<t.length;o++)e[o]=oe(e[o],t[o]);else if(ne(t))for(var o in t)e[o]=oe(e[o],t[o]);return e}function re(e,t){Object.defineProperty(e,"toString",{value:t})}var se="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function ie(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e[0],o=[],r=1,s=e.length;r<s;r+=1)o.push(e[r]);return o.forEach(function(e){n=n.replace(/%[a-z]/,e)}),n}function ae(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return"production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t," for more information.").concat(n.length>0?" Args: ".concat(n.join(", ")):"")):new Error(ie.apply(void 0,e([se[t]],n,!1)).trim())}var ce=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,o=n.length,r=o;e>=r;)if((r<<=1)<0)throw ae(16,"".concat(e));this.groupSizes=new Uint32Array(r),this.groupSizes.set(n),this.length=r;for(var s=o;s<r;s++)this.groupSizes[s]=0}for(var i=this.indexOfGroup(e+1),a=(s=0,t.length);s<a;s++)this.tag.insertRule(i,t[s])&&(this.groupSizes[e]++,i++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),o=n+t;this.groupSizes[e]=0;for(var r=n;r<o;r++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],o=this.indexOfGroup(e),r=o+n,s=o;s<r;s++)t+="".concat(this.tag.getRule(s)).concat("/*!sc*/\n");return t},e}(),le=new Map,ue=new Map,pe=1,de=function(e){if(le.has(e))return le.get(e);for(;ue.has(pe);)pe++;var t=pe++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>1073741824))throw ae(16,"".concat(t));return le.set(e,t),ue.set(t,e),t},he=("style[".concat(f,"][").concat("data-styled-version",'="').concat("6.0.0",'"]'),new RegExp("^".concat(f,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),function(e){for(var t=e.getTag(),n=t.length,o="",r=function(n){var r=function(e){return ue.get(e)}(n);if(void 0===r)return"continue";var s=e.names.get(r),i=t.getGroup(n);if(void 0===s||0===i.length)return"continue";var a="".concat(f,".g").concat(n,'[id="').concat(r,'"]'),c="";void 0!==s&&s.forEach(function(e){e.length>0&&(c+="".concat(e,","))}),o+="".concat(i).concat(a,'{content:"').concat(c,'"}').concat("/*!sc*/\n")},s=0;s<n;s++)r(s);return o});function fe(){return"undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var me=function(e){var t=document.head,n=e||t,o=document.createElement("style"),r=function(e){return Array.from(e.querySelectorAll("style[".concat(f,"]"))).at(-1)}(n),s=void 0!==r?r.nextSibling:null;o.setAttribute(f,"active"),o.setAttribute("data-styled-version","6.0.0");var i=fe();return i&&o.setAttribute("nonce",i),n.insertBefore(o,s),o},ye=function(){function e(e){this.element=me(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,o=t.length;n<o;n++){var r=t[n];if(r.ownerNode===e)return r}throw ae(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),ve=function(){function e(e){this.element=me(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),ge=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),Se={isServer:!0,useCSSOMInjection:!y},we=function(){function e(e,n,o){void 0===e&&(e=E),void 0===n&&(n={});var r=this;this.options=t(t({},Se),e),this.gs=n,this.names=new Map(o),this.server=!!e.isServer,re(this,function(){return he(r)})}return e.registerId=function(e){return de(e)},e.prototype.reconstructWithOptions=function(n,o){return void 0===o&&(o=!0),new e(t(t({},this.options),n),this.gs,o&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new ge(n):t?new ye(n):new ve(n)}(this.options),new ce(e)));var e},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(de(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(de(e),n)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(de(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),be=/&/g,Ee=/^\s*\/\/.*$/gm;function Ne(e,t){return e.map(function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return"".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=Ne(e.children,t)),e})}function Pe(e){var t,n,o,r=void 0===e?E:e,s=r.options,i=void 0===s?E:s,a=r.plugins,c=void 0===a?b:a,l=function(e,o,r){return r===n||r.startsWith(n)&&r.endsWith(n)&&r.replaceAll(n,"").length>0?".".concat(t):e},u=c.slice();u.push(function(e){e.type===d.RULESET&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(be,n).replace(o,l))}),i.prefix&&u.push(d.prefixer),u.push(d.stringify);var p=function(e,r,s,a){void 0===r&&(r=""),void 0===s&&(s=""),void 0===a&&(a="&"),t=a,n=r,o=new RegExp("\\".concat(n,"\\b"),"g");var c=e.replace(Ee,""),l=d.compile(s||r?"".concat(s," ").concat(r," { ").concat(c," }"):c);i.namespace&&(l=Ne(l,i.namespace));var p=[];return d.serialize(l,d.middleware(u.concat(d.rulesheet(function(e){return p.push(e)})))),p};return p.hash=c.length?c.reduce(function(e,t){return t.name||ae(15),T(e,t.name)},5381).toString():"",p}var _e=new we,Ce=Pe(),Ie=o.createContext({shouldForwardProp:void 0,styleSheet:_e,stylis:Ce}),Ae=Ie.Consumer,Oe=o.createContext(void 0);function De(){return c(Ie)}function Re(e){var t=s(e.stylisPlugins),n=t[0],r=t[1],c=De().styleSheet,l=i(function(){var t=c;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t},[e.disableCSSOMInjection,e.sheet,e.target,c]),u=i(function(){return Pe({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})},[e.enableVendorPrefixes,e.namespace,n]);return a(function(){p(n,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]),o.createElement(Ie.Provider,{value:{shouldForwardProp:e.shouldForwardProp,styleSheet:l,stylis:u}},o.createElement(Oe.Provider,{value:u},e.children))}var Te=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=Ce);var o=n.name+t.hash;e.hasNameForId(n.id,o)||e.insertRules(n.id,o,t(n.rules,o,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,re(this,function(){throw ae(12,String(n.name))})}return e.prototype.getName=function(e){return void 0===e&&(e=Ce),this.name+e.hash},e}(),je=function(e){return e>="A"&&e<="Z"};function xe(e){for(var t="",n=0;n<e.length;n++){var o=e[n];if(1===n&&"-"===o&&"-"===e[0])return e;je(o)?t+="-"+o.toLowerCase():t+=o}return t.startsWith("ms-")?"-"+t:t}var ke=function(e){return null==e||!1===e||""===e},Ve=function(t){var n,o,r=[];for(var s in t){var i=t[s];t.hasOwnProperty(s)&&!ke(i)&&(Array.isArray(i)&&i.isCss||K(i)?r.push("".concat(xe(s),":"),i,";"):ne(i)?r.push.apply(r,e(e(["".concat(s," {")],Ve(i),!1),["}"],!1)):r.push("".concat(xe(s),": ").concat((n=s,null==(o=i)||"boolean"==typeof o||""===o?"":"number"!=typeof o||0===o||n in h||n.startsWith("--")?String(o).trim():"".concat(o,"px")),";")))}return r};function Me(e,t,n,o){if(ke(e))return[];if(Q(e))return[".".concat(e.styledComponentId)];if(K(e)){if(!K(s=e)||s.prototype&&s.prototype.isReactComponent||!t)return[e];var r=e(t);return"production"===process.env.NODE_ENV||"object"!=typeof r||Array.isArray(r)||r instanceof Te||ne(r)||null===r||console.error("".concat(k(e)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),Me(r,t,n,o)}var s;return e instanceof Te?n?(e.inject(n,o),[e.getName(o)]):[e]:ne(e)?Ve(e):Array.isArray(e)?e.flatMap(function(e){return Me(e,t,n,o)}):[e.toString()]}function Fe(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(K(n)&&!Q(n))return!1}return!0}var $e=j("6.0.0"),ze=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&Fe(e),this.componentId=t,this.baseHash=T($e,t),this.baseStyle=n,we.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var o=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))o=ee(o,this.staticRulesId);else{var r=te(Me(this.rules,e,t,n)),s=D(T(this.baseHash,r)>>>0);if(!t.hasNameForId(this.componentId,s)){var i=n(r,".".concat(s),void 0,this.componentId);t.insertRules(this.componentId,s,i)}o=ee(o,s),this.staticRulesId=s}else{for(var a=T(this.baseHash,n.hash),c="",l=0;l<this.rules.length;l++){var u=this.rules[l];if("string"==typeof u)c+=u,"production"!==process.env.NODE_ENV&&(a=T(a,u));else if(u){var p=te(Me(u,e,t,n));a=T(a,p),c+=p}}if(c){var d=D(a>>>0);t.hasNameForId(this.componentId,d)||t.insertRules(this.componentId,d,n(c,".".concat(d),void 0,this.componentId)),o=ee(o,d)}}return o},e}(),Be=o.createContext(void 0),Ge=Be.Consumer;function Le(){var e=c(Be);if(!e)throw ae(18);return e}function Ye(e){var n=o.useContext(Be),r=i(function(){return function(e,n){if(!e)throw ae(14);if(K(e)){var o=e(n);if("production"!==process.env.NODE_ENV&&(null===o||Array.isArray(o)||"object"!=typeof o))throw ae(7);return o}if(Array.isArray(e)||"object"!=typeof e)throw ae(8);return n?t(t({},n),e):e}(e.theme,n)},[e.theme,n]);return e.children?o.createElement(Be.Provider,{value:r},e.children):null}var We={},qe=new Set;function He(e,r,s){var i=Q(e),a=e,c=!V(e),p=r.attrs,d=void 0===p?b:p,h=r.componentId,f=void 0===h?function(e,t){var n="string"!=typeof e?"sc":I(e);We[n]=(We[n]||0)+1;var o="".concat(n,"-").concat(x("6.0.0"+n+We[n]));return t?"".concat(t,"-").concat(o):o}(r.displayName,r.parentComponentId):h,m=r.displayName,y=void 0===m?function(e){return V(e)?"styled.".concat(e):"Styled(".concat(k(e),")")}(e):m,v=r.displayName&&r.componentId?"".concat(I(r.displayName),"-").concat(r.componentId):r.componentId||f,g=i&&a.attrs?a.attrs.concat(d).filter(Boolean):d,S=r.shouldForwardProp;if(i&&a.shouldForwardProp){var _=a.shouldForwardProp;if(r.shouldForwardProp){var C=r.shouldForwardProp;S=function(e,t){return _(e,t)&&C(e,t)}}else S=_}var A=new ze(s,v,i?a.componentStyle:void 0),O=A.isStatic&&0===d.length;function D(e,r){return function(e,r,s,i){var a=e.attrs,c=e.componentStyle,p=e.defaultProps,d=e.foldedComponentIds,h=e.styledComponentId,f=e.target,m=o.useContext(Be),y=De(),v=e.shouldForwardProp||y.shouldForwardProp;"production"!==process.env.NODE_ENV&&l(h);var g=function(e,n,o){for(var r,s=t(t({},n),{className:void 0,theme:o}),i=0;i<e.length;i+=1){var a=K(r=e[i])?r(s):r;for(var c in a)s[c]="className"===c?ee(s[c],a[c]):"style"===c?t(t({},s[c]),a[c]):a[c]}return n.className&&(s.className=ee(s.className,n.className)),s}(a,r,N(r,m,p)||E),S=g.as||f,w={};for(var b in g)void 0===g[b]||"$"===b[0]||"as"===b||"theme"===b||("forwardedAs"===b?w.as=g.forwardedAs:v&&!v(b,S)||(w[b]=g[b])),v||"development"!==process.env.NODE_ENV||n(b)||qe.has(b)||(qe.add(b),console.warn('styled-components: it looks like an unknown prop "'.concat(b,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')));var _=function(e,t){var n=De(),o=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return"production"!==process.env.NODE_ENV&&l(o),o}(c,g);"production"!==process.env.NODE_ENV&&!i&&e.warnTooManyClasses&&e.warnTooManyClasses(_);var C=ee(d,h);return _&&(C+=" "+_),g.className&&(C+=" "+g.className),w[V(S)&&!P.has(S)?"class":"className"]=C,w.ref=s,u(S,w)}(R,e,r,O)}D.displayName=y;var R=o.forwardRef(D);return R.attrs=g,R.componentStyle=A,R.displayName=y,R.shouldForwardProp=S,R.foldedComponentIds=i?ee(a.foldedComponentIds,a.styledComponentId):"",R.styledComponentId=v,R.target=i?a.target:e,Object.defineProperty(R,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=i?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var o=0,r=t;o<r.length;o++)oe(e,r[o],!0);return e}({},a.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(w(y,v),R.warnTooManyClasses=function(e,t){var n={},o=!1;return function(r){if(!o&&(n[r]=!0,Object.keys(n).length>=200)){var s=t?' with the id of "'.concat(t,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(e).concat(s,".\n")+"Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),o=!0,n={}}}}(y,v)),re(R,function(){return".".concat(R.styledComponentId)}),c&&Z(R,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),R}function Ue(e,t){for(var n=[e[0]],o=0,r=t.length;o<r;o+=1)n.push(t[o],e[o+1]);return n}var Je=function(e){return Object.assign(e,{isCss:!0})};function Xe(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(K(t)||ne(t)){var r=t;return Je(Me(Ue(b,e([r],n,!0))))}var s=t;return 0===n.length&&1===s.length&&"string"==typeof s[0]?Me(s):Je(Me(Ue(s,n)))}function Ze(n,o,r){if(void 0===r&&(r=E),!o)throw ae(1,o);var s=function(t){for(var s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];return n(o,r,Xe.apply(void 0,e([t],s,!1)))};return s.attrs=function(e){return Ze(n,o,t(t({},r),{attrs:Array.prototype.concat(r.attrs,e).filter(Boolean)}))},s.withConfig=function(e){return Ze(n,o,t(t({},r),e))},s}var Ke=function(e){return Ze(He,e)},Qe=Ke;P.forEach(function(e){Qe[e]=Ke(e)});var et=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=Fe(e),we.registerId(this.componentId+1)}return e.prototype.createStyles=function(e,t,n,o){var r=o(te(Me(this.rules,t,n,o)),""),s=this.componentId+e;n.insertRules(s,s,r)},e.prototype.removeStyles=function(e,t){t.clearRules(this.componentId+e)},e.prototype.renderStyles=function(e,t,n,o){e>2&&we.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,o)},e}();function tt(n){for(var r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];var i=Xe.apply(void 0,e([n],r,!1)),a="sc-global-".concat(x(JSON.stringify(i))),c=new et(i,a);"production"!==process.env.NODE_ENV&&w(a);var l=function(e){var t=De(),n=o.useContext(Be),r=o.useRef(t.styleSheet.allocateGSInstance(a)).current;return"production"!==process.env.NODE_ENV&&o.Children.count(e.children)&&console.warn("The global style component ".concat(a," was given child JSX. createGlobalStyle does not render children.")),"production"!==process.env.NODE_ENV&&i.some(function(e){return"string"==typeof e&&-1!==e.indexOf("@import")})&&console.warn("Please do not use @import CSS syntax in createGlobalStyle at this time, as the CSSOM APIs we use in production do not handle it well. Instead, we recommend using a library such as react-helmet to inject a typical <link> meta tag to the stylesheet, or simply embedding it manually in your index.html <head> section for a simpler app."),t.styleSheet.server&&u(r,e,t.styleSheet,n,t.stylis),null};function u(e,n,o,r,s){if(c.isStatic)c.renderStyles(e,v,o,s);else{var i=t(t({},n),{theme:N(n,r,l.defaultProps)});c.renderStyles(e,i,o,s)}}return o.memo(l)}function nt(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.");var r=te(Xe.apply(void 0,e([t],n,!1))),s=x(r);return new Te(s,r)}function ot(e){var n=o.forwardRef(function(n,r){var s=N(n,o.useContext(Be),e.defaultProps);return"production"!==process.env.NODE_ENV&&void 0===s&&console.warn('[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class "'.concat(k(e),'"')),o.createElement(e,t({},n,{theme:s,ref:r}))});return n.displayName="WithTheme(".concat(k(e),")"),Z(n,e)}var rt=/^\s*<\/[a-z]/i,st=function(){function e(){var e=this;this._emitSheetCSS=function(){var t=e.instance.toString(),n=fe(),o=te([n&&'nonce="'.concat(n,'"'),"".concat(f,'="true"'),"".concat("data-styled-version",'="').concat("6.0.0",'"')].filter(Boolean)," ");return"<style ".concat(o,">").concat(t,"</style>")},this.getStyleTags=function(){if(e.sealed)throw ae(2);return e._emitSheetCSS()},this.getStyleElement=function(){var n;if(e.sealed)throw ae(2);var r=((n={})[f]="",n["data-styled-version"]="6.0.0",n.dangerouslySetInnerHTML={__html:e.instance.toString()},n),s=fe();return s&&(r.nonce=s),[o.createElement("style",t({},r,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new we({isServer:!0}),this.sealed=!1}return e.prototype.collectStyles=function(e){if(this.sealed)throw ae(2);return o.createElement(Re,{sheet:this.instance},e)},e.prototype.interleaveWithNodeStream=function(e){if(this.sealed)throw ae(2);this.seal();var t=require("stream").Transform,n=e,o=this.instance,r=this._emitSheetCSS,s=new t({transform:function(e,t,n){var s=e.toString(),i=r();if(o.clearTag(),rt.test(s)){var a=s.indexOf(">")+1,c=s.slice(0,a),l=s.slice(a);this.push(c+i+l)}else this.push(i+s);n()}});return n.on("error",function(e){s.emit("error",e)}),n.pipe(s)},e}(),it={StyleSheet:we,mainSheet:_e};"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native"),"__sc-".concat(f,"__"),"production"!==process.env.NODE_ENV&&process;export{st as ServerStyleSheet,Ae as StyleSheetConsumer,Ie as StyleSheetContext,Re as StyleSheetManager,Ge as ThemeConsumer,Be as ThemeContext,Ye as ThemeProvider,it as __PRIVATE__,tt as createGlobalStyle,Xe as css,Qe as default,Q as isStyledComponent,nt as keyframes,Qe as styled,Le as useTheme,m as version,ot as withTheme};
|
|
1
|
+
import{__spreadArray as e,__assign as t}from"tslib";import n from"@emotion/is-prop-valid";import o,{useRef as r,useState as s,useMemo as i,useEffect as a,useContext as c,useDebugValue as l,createElement as u}from"react";import p from"shallowequal";import*as d from"stylis";import h from"@emotion/unitless";var f="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",m="6.0.2",y=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),v={},g=/invalid hook call/i,S=new Set,w=function(t,n){if("production"!==process.env.NODE_ENV){var o=n?' with the id of "'.concat(n,'"'):"",s="The component ".concat(t).concat(o," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.",i=console.error;try{var a=!0;console.error=function(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];g.test(t)?(a=!1,S.delete(s)):i.apply(void 0,e([t],n,!1))},r(),a&&!S.has(s)&&(console.warn(s),S.add(s))}catch(e){g.test(e.message)&&S.delete(s)}finally{console.error=i}}},b=Object.freeze([]),E=Object.freeze({});function N(e,t,n){return void 0===n&&(n=E),e.theme!==n.theme&&e.theme||t||n.theme}var P=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),_=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,C=/(^-|-$)/g;function I(e){return e.replace(_,"-").replace(C,"")}var A=/(a)(d)/gi,O=function(e){return String.fromCharCode(e+(e>25?39:97))};function D(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=O(t%52)+n;return(O(t%52)+n).replace(A,"$1-$2")}var R,T=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},j=function(e){return T(5381,e)};function x(e){return D(j(e)>>>0)}function k(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function V(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var F="function"==typeof Symbol&&Symbol.for,M=F?Symbol.for("react.memo"):60115,$=F?Symbol.for("react.forward_ref"):60112,z={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},B={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},G={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},L=((R={})[$]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},R[M]=G,R);function Y(e){return("type"in(t=e)&&t.type.$$typeof)===M?G:"$$typeof"in e?L[e.$$typeof]:z;var t}var W=Object.defineProperty,q=Object.getOwnPropertyNames,H=Object.getOwnPropertySymbols,U=Object.getOwnPropertyDescriptor,J=Object.getPrototypeOf,X=Object.prototype;function Z(e,t,n){if("string"!=typeof t){if(X){var o=J(t);o&&o!==X&&Z(e,o,n)}var r=q(t);H&&(r=r.concat(H(t)));for(var s=Y(e),i=Y(t),a=0;a<r.length;++a){var c=r[a];if(!(c in B||n&&n[c]||i&&c in i||s&&c in s)){var l=U(t,c);try{W(e,c,l)}catch(e){}}}}return e}function K(e){return"function"==typeof e}function Q(e){return"object"==typeof e&&"styledComponentId"in e}function ee(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function te(e,t){if(0===e.length)return"";for(var n=e[0],o=1;o<e.length;o++)n+=t?t+e[o]:e[o];return n}function ne(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function oe(e,t,n){if(void 0===n&&(n=!1),!n&&!ne(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var o=0;o<t.length;o++)e[o]=oe(e[o],t[o]);else if(ne(t))for(var o in t)e[o]=oe(e[o],t[o]);return e}function re(e,t){Object.defineProperty(e,"toString",{value:t})}var se="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function ie(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e[0],o=[],r=1,s=e.length;r<s;r+=1)o.push(e[r]);return o.forEach(function(e){n=n.replace(/%[a-z]/,e)}),n}function ae(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return"production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t," for more information.").concat(n.length>0?" Args: ".concat(n.join(", ")):"")):new Error(ie.apply(void 0,e([se[t]],n,!1)).trim())}var ce=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,o=n.length,r=o;e>=r;)if((r<<=1)<0)throw ae(16,"".concat(e));this.groupSizes=new Uint32Array(r),this.groupSizes.set(n),this.length=r;for(var s=o;s<r;s++)this.groupSizes[s]=0}for(var i=this.indexOfGroup(e+1),a=(s=0,t.length);s<a;s++)this.tag.insertRule(i,t[s])&&(this.groupSizes[e]++,i++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),o=n+t;this.groupSizes[e]=0;for(var r=n;r<o;r++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],o=this.indexOfGroup(e),r=o+n,s=o;s<r;s++)t+="".concat(this.tag.getRule(s)).concat("/*!sc*/\n");return t},e}(),le=new Map,ue=new Map,pe=1,de=function(e){if(le.has(e))return le.get(e);for(;ue.has(pe);)pe++;var t=pe++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>1073741824))throw ae(16,"".concat(t));return le.set(e,t),ue.set(t,e),t},he=("style[".concat(f,"][").concat("data-styled-version",'="').concat("6.0.2",'"]'),new RegExp("^".concat(f,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),function(e){for(var t=e.getTag(),n=t.length,o="",r=function(n){var r=function(e){return ue.get(e)}(n);if(void 0===r)return"continue";var s=e.names.get(r),i=t.getGroup(n);if(void 0===s||0===i.length)return"continue";var a="".concat(f,".g").concat(n,'[id="').concat(r,'"]'),c="";void 0!==s&&s.forEach(function(e){e.length>0&&(c+="".concat(e,","))}),o+="".concat(i).concat(a,'{content:"').concat(c,'"}').concat("/*!sc*/\n")},s=0;s<n;s++)r(s);return o});function fe(){return"undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var me=function(e){var t=document.head,n=e||t,o=document.createElement("style"),r=function(e){var t=Array.from(e.querySelectorAll("style[".concat(f,"]")));return t[t.length-1]}(n),s=void 0!==r?r.nextSibling:null;o.setAttribute(f,"active"),o.setAttribute("data-styled-version","6.0.2");var i=fe();return i&&o.setAttribute("nonce",i),n.insertBefore(o,s),o},ye=function(){function e(e){this.element=me(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,o=t.length;n<o;n++){var r=t[n];if(r.ownerNode===e)return r}throw ae(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),ve=function(){function e(e){this.element=me(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),ge=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),Se={isServer:!0,useCSSOMInjection:!y},we=function(){function e(e,n,o){void 0===e&&(e=E),void 0===n&&(n={});var r=this;this.options=t(t({},Se),e),this.gs=n,this.names=new Map(o),this.server=!!e.isServer,re(this,function(){return he(r)})}return e.registerId=function(e){return de(e)},e.prototype.reconstructWithOptions=function(n,o){return void 0===o&&(o=!0),new e(t(t({},this.options),n),this.gs,o&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new ge(n):t?new ye(n):new ve(n)}(this.options),new ce(e)));var e},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(de(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(de(e),n)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(de(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),be=/&/g,Ee=/^\s*\/\/.*$/gm;function Ne(e,t){return e.map(function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return"".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=Ne(e.children,t)),e})}function Pe(e){var t,n,o,r=void 0===e?E:e,s=r.options,i=void 0===s?E:s,a=r.plugins,c=void 0===a?b:a,l=function(e,o,r){return r===n||r.startsWith(n)&&r.endsWith(n)&&r.replaceAll(n,"").length>0?".".concat(t):e},u=c.slice();u.push(function(e){e.type===d.RULESET&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(be,n).replace(o,l))}),i.prefix&&u.push(d.prefixer),u.push(d.stringify);var p=function(e,r,s,a){void 0===r&&(r=""),void 0===s&&(s=""),void 0===a&&(a="&"),t=a,n=r,o=new RegExp("\\".concat(n,"\\b"),"g");var c=e.replace(Ee,""),l=d.compile(s||r?"".concat(s," ").concat(r," { ").concat(c," }"):c);i.namespace&&(l=Ne(l,i.namespace));var p=[];return d.serialize(l,d.middleware(u.concat(d.rulesheet(function(e){return p.push(e)})))),p};return p.hash=c.length?c.reduce(function(e,t){return t.name||ae(15),T(e,t.name)},5381).toString():"",p}var _e=new we,Ce=Pe(),Ie=o.createContext({shouldForwardProp:void 0,styleSheet:_e,stylis:Ce}),Ae=Ie.Consumer,Oe=o.createContext(void 0);function De(){return c(Ie)}function Re(e){var t=s(e.stylisPlugins),n=t[0],r=t[1],c=De().styleSheet,l=i(function(){var t=c;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t},[e.disableCSSOMInjection,e.sheet,e.target,c]),u=i(function(){return Pe({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})},[e.enableVendorPrefixes,e.namespace,n]);return a(function(){p(n,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]),o.createElement(Ie.Provider,{value:{shouldForwardProp:e.shouldForwardProp,styleSheet:l,stylis:u}},o.createElement(Oe.Provider,{value:u},e.children))}var Te=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=Ce);var o=n.name+t.hash;e.hasNameForId(n.id,o)||e.insertRules(n.id,o,t(n.rules,o,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,re(this,function(){throw ae(12,String(n.name))})}return e.prototype.getName=function(e){return void 0===e&&(e=Ce),this.name+e.hash},e}(),je=function(e){return e>="A"&&e<="Z"};function xe(e){for(var t="",n=0;n<e.length;n++){var o=e[n];if(1===n&&"-"===o&&"-"===e[0])return e;je(o)?t+="-"+o.toLowerCase():t+=o}return t.startsWith("ms-")?"-"+t:t}var ke=function(e){return null==e||!1===e||""===e},Ve=function(t){var n,o,r=[];for(var s in t){var i=t[s];t.hasOwnProperty(s)&&!ke(i)&&(Array.isArray(i)&&i.isCss||K(i)?r.push("".concat(xe(s),":"),i,";"):ne(i)?r.push.apply(r,e(e(["".concat(s," {")],Ve(i),!1),["}"],!1)):r.push("".concat(xe(s),": ").concat((n=s,null==(o=i)||"boolean"==typeof o||""===o?"":"number"!=typeof o||0===o||n in h||n.startsWith("--")?String(o).trim():"".concat(o,"px")),";")))}return r};function Fe(e,t,n,o){if(ke(e))return[];if(Q(e))return[".".concat(e.styledComponentId)];if(K(e)){if(!K(s=e)||s.prototype&&s.prototype.isReactComponent||!t)return[e];var r=e(t);return"production"===process.env.NODE_ENV||"object"!=typeof r||Array.isArray(r)||r instanceof Te||ne(r)||null===r||console.error("".concat(k(e)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),Fe(r,t,n,o)}var s;return e instanceof Te?n?(e.inject(n,o),[e.getName(o)]):[e]:ne(e)?Ve(e):Array.isArray(e)?Array.prototype.concat.apply(b,e.map(function(e){return Fe(e,t,n,o)})):[e.toString()]}function Me(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(K(n)&&!Q(n))return!1}return!0}var $e=j("6.0.2"),ze=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&Me(e),this.componentId=t,this.baseHash=T($e,t),this.baseStyle=n,we.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var o=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))o=ee(o,this.staticRulesId);else{var r=te(Fe(this.rules,e,t,n)),s=D(T(this.baseHash,r)>>>0);if(!t.hasNameForId(this.componentId,s)){var i=n(r,".".concat(s),void 0,this.componentId);t.insertRules(this.componentId,s,i)}o=ee(o,s),this.staticRulesId=s}else{for(var a=T(this.baseHash,n.hash),c="",l=0;l<this.rules.length;l++){var u=this.rules[l];if("string"==typeof u)c+=u,"production"!==process.env.NODE_ENV&&(a=T(a,u));else if(u){var p=te(Fe(u,e,t,n));a=T(a,p),c+=p}}if(c){var d=D(a>>>0);t.hasNameForId(this.componentId,d)||t.insertRules(this.componentId,d,n(c,".".concat(d),void 0,this.componentId)),o=ee(o,d)}}return o},e}(),Be=o.createContext(void 0),Ge=Be.Consumer;function Le(){var e=c(Be);if(!e)throw ae(18);return e}function Ye(e){var n=o.useContext(Be),r=i(function(){return function(e,n){if(!e)throw ae(14);if(K(e)){var o=e(n);if("production"!==process.env.NODE_ENV&&(null===o||Array.isArray(o)||"object"!=typeof o))throw ae(7);return o}if(Array.isArray(e)||"object"!=typeof e)throw ae(8);return n?t(t({},n),e):e}(e.theme,n)},[e.theme,n]);return e.children?o.createElement(Be.Provider,{value:r},e.children):null}var We={},qe=new Set;function He(e,r,s){var i=Q(e),a=e,c=!V(e),p=r.attrs,d=void 0===p?b:p,h=r.componentId,f=void 0===h?function(e,t){var n="string"!=typeof e?"sc":I(e);We[n]=(We[n]||0)+1;var o="".concat(n,"-").concat(x("6.0.2"+n+We[n]));return t?"".concat(t,"-").concat(o):o}(r.displayName,r.parentComponentId):h,m=r.displayName,y=void 0===m?function(e){return V(e)?"styled.".concat(e):"Styled(".concat(k(e),")")}(e):m,v=r.displayName&&r.componentId?"".concat(I(r.displayName),"-").concat(r.componentId):r.componentId||f,g=i&&a.attrs?a.attrs.concat(d).filter(Boolean):d,S=r.shouldForwardProp;if(i&&a.shouldForwardProp){var _=a.shouldForwardProp;if(r.shouldForwardProp){var C=r.shouldForwardProp;S=function(e,t){return _(e,t)&&C(e,t)}}else S=_}var A=new ze(s,v,i?a.componentStyle:void 0);function O(e,r){return function(e,r,s){var i=e.attrs,a=e.componentStyle,c=e.defaultProps,p=e.foldedComponentIds,d=e.styledComponentId,h=e.target,f=o.useContext(Be),m=De(),y=e.shouldForwardProp||m.shouldForwardProp;"production"!==process.env.NODE_ENV&&l(d);var v=function(e,n,o){for(var r,s=t(t({},n),{className:void 0,theme:o}),i=0;i<e.length;i+=1){var a=K(r=e[i])?r(s):r;for(var c in a)s[c]="className"===c?ee(s[c],a[c]):"style"===c?t(t({},s[c]),a[c]):a[c]}return n.className&&(s.className=ee(s.className,n.className)),s}(i,r,N(r,f,c)||E),g=v.as||h,S={};for(var w in v)void 0===v[w]||"$"===w[0]||"as"===w||"theme"===w||("forwardedAs"===w?S.as=v.forwardedAs:y&&!y(w,g)||(S[w]=v[w],y||"development"!==process.env.NODE_ENV||n(w)||qe.has(w)||(qe.add(w),console.warn('styled-components: it looks like an unknown prop "'.concat(w,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var b=function(e,t){var n=De(),o=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return"production"!==process.env.NODE_ENV&&l(o),o}(a,v);"production"!==process.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(b);var _=ee(p,d);return b&&(_+=" "+b),v.className&&(_+=" "+v.className),S[V(g)&&!P.has(g)?"class":"className"]=_,S.ref=s,u(g,S)}(D,e,r)}"production"!==process.env.NODE_ENV&&(O.displayName=y);var D=o.forwardRef(O);return D.attrs=g,D.componentStyle=A,D.shouldForwardProp=S,"production"!==process.env.NODE_ENV&&(D.displayName=y),D.foldedComponentIds=i?ee(a.foldedComponentIds,a.styledComponentId):"",D.styledComponentId=v,D.target=i?a.target:e,Object.defineProperty(D,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=i?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var o=0,r=t;o<r.length;o++)oe(e,r[o],!0);return e}({},a.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(w(y,v),D.warnTooManyClasses=function(e,t){var n={},o=!1;return function(r){if(!o&&(n[r]=!0,Object.keys(n).length>=200)){var s=t?' with the id of "'.concat(t,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(e).concat(s,".\n")+"Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),o=!0,n={}}}}(y,v)),re(D,function(){return".".concat(D.styledComponentId)}),c&&Z(D,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),D}function Ue(e,t){for(var n=[e[0]],o=0,r=t.length;o<r;o+=1)n.push(t[o],e[o+1]);return n}var Je=function(e){return Object.assign(e,{isCss:!0})};function Xe(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(K(t)||ne(t)){var r=t;return Je(Fe(Ue(b,e([r],n,!0))))}var s=t;return 0===n.length&&1===s.length&&"string"==typeof s[0]?Fe(s):Je(Fe(Ue(s,n)))}function Ze(n,o,r){if(void 0===r&&(r=E),!o)throw ae(1,o);var s=function(t){for(var s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];return n(o,r,Xe.apply(void 0,e([t],s,!1)))};return s.attrs=function(e){return Ze(n,o,t(t({},r),{attrs:Array.prototype.concat(r.attrs,e).filter(Boolean)}))},s.withConfig=function(e){return Ze(n,o,t(t({},r),e))},s}var Ke=function(e){return Ze(He,e)},Qe=Ke;P.forEach(function(e){Qe[e]=Ke(e)});var et=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=Me(e),we.registerId(this.componentId+1)}return e.prototype.createStyles=function(e,t,n,o){var r=o(te(Fe(this.rules,t,n,o)),""),s=this.componentId+e;n.insertRules(s,s,r)},e.prototype.removeStyles=function(e,t){t.clearRules(this.componentId+e)},e.prototype.renderStyles=function(e,t,n,o){e>2&&we.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,o)},e}();function tt(n){for(var r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];var i=Xe.apply(void 0,e([n],r,!1)),a="sc-global-".concat(x(JSON.stringify(i))),c=new et(i,a);"production"!==process.env.NODE_ENV&&w(a);var l=function(e){var t=De(),n=o.useContext(Be),r=o.useRef(t.styleSheet.allocateGSInstance(a)).current;return"production"!==process.env.NODE_ENV&&o.Children.count(e.children)&&console.warn("The global style component ".concat(a," was given child JSX. createGlobalStyle does not render children.")),"production"!==process.env.NODE_ENV&&i.some(function(e){return"string"==typeof e&&-1!==e.indexOf("@import")})&&console.warn("Please do not use @import CSS syntax in createGlobalStyle at this time, as the CSSOM APIs we use in production do not handle it well. Instead, we recommend using a library such as react-helmet to inject a typical <link> meta tag to the stylesheet, or simply embedding it manually in your index.html <head> section for a simpler app."),t.styleSheet.server&&u(r,e,t.styleSheet,n,t.stylis),null};function u(e,n,o,r,s){if(c.isStatic)c.renderStyles(e,v,o,s);else{var i=t(t({},n),{theme:N(n,r,l.defaultProps)});c.renderStyles(e,i,o,s)}}return o.memo(l)}function nt(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.");var r=te(Xe.apply(void 0,e([t],n,!1))),s=x(r);return new Te(s,r)}function ot(e){var n=o.forwardRef(function(n,r){var s=N(n,o.useContext(Be),e.defaultProps);return"production"!==process.env.NODE_ENV&&void 0===s&&console.warn('[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class "'.concat(k(e),'"')),o.createElement(e,t({},n,{theme:s,ref:r}))});return"production"!==process.env.NODE_ENV&&(n.displayName="WithTheme(".concat(k(e),")")),Z(n,e)}var rt=/^\s*<\/[a-z]/i,st=function(){function e(){var e=this;this._emitSheetCSS=function(){var t=e.instance.toString(),n=fe(),o=te([n&&'nonce="'.concat(n,'"'),"".concat(f,'="true"'),"".concat("data-styled-version",'="').concat("6.0.2",'"')].filter(Boolean)," ");return"<style ".concat(o,">").concat(t,"</style>")},this.getStyleTags=function(){if(e.sealed)throw ae(2);return e._emitSheetCSS()},this.getStyleElement=function(){var n;if(e.sealed)throw ae(2);var r=((n={})[f]="",n["data-styled-version"]="6.0.2",n.dangerouslySetInnerHTML={__html:e.instance.toString()},n),s=fe();return s&&(r.nonce=s),[o.createElement("style",t({},r,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new we({isServer:!0}),this.sealed=!1}return e.prototype.collectStyles=function(e){if(this.sealed)throw ae(2);return o.createElement(Re,{sheet:this.instance},e)},e.prototype.interleaveWithNodeStream=function(e){if(this.sealed)throw ae(2);this.seal();var t=require("stream").Transform,n=e,o=this.instance,r=this._emitSheetCSS,s=new t({transform:function(e,t,n){var s=e.toString(),i=r();if(o.clearTag(),rt.test(s)){var a=s.indexOf(">")+1,c=s.slice(0,a),l=s.slice(a);this.push(c+i+l)}else this.push(i+s);n()}});return n.on("error",function(e){s.emit("error",e)}),n.pipe(s)},e}(),it={StyleSheet:we,mainSheet:_e};"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native"),"__sc-".concat(f,"__"),"production"!==process.env.NODE_ENV&&process;export{st as ServerStyleSheet,Ae as StyleSheetConsumer,Ie as StyleSheetContext,Re as StyleSheetManager,Ge as ThemeConsumer,Be as ThemeContext,Ye as ThemeProvider,it as __PRIVATE__,tt as createGlobalStyle,Xe as css,Qe as default,Q as isStyledComponent,nt as keyframes,Qe as styled,Le as useTheme,m as version,ot as withTheme};
|
|
2
2
|
//# sourceMappingURL=styled-components.esm.js.map
|