styled-components 6.0.0-alpha.6 → 6.0.0-beta.1
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/README.md +2 -2
- package/dist/models/ComponentStyle.d.ts +1 -0
- package/dist/styled-components-macro.cjs.js +1 -1
- package/dist/styled-components-macro.cjs.js.map +1 -1
- package/dist/styled-components-macro.esm.js +1 -1
- package/dist/styled-components-macro.esm.js.map +1 -1
- 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 +1 -1
- 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/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/stylis.d.ts +2 -1
- package/native/dist/models/ComponentStyle.d.ts +1 -0
- package/native/dist/styled-components.native.cjs.js +439 -400
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +440 -401
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/types.d.ts +1 -1
- package/native/dist/utils/stylis.d.ts +2 -1
- package/package.json +12 -11
- package/test-utils/setupTestFramework.ts +9 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"@emotion/is-prop-valid";import t,{useRef as n,useState as o,useContext as s,useMemo as r,useEffect as i,createElement as a,useDebugValue as c}from"react";import l from"shallowequal";import{prefixer as u,stringify as h,serialize as d,compile as p,middleware as m,RULESET as f}from"stylis";import y from"@emotion/unitless";const g="undefined"!=typeof process&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",S="6.0.0-alpha.6",v=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&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.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),w={},b=/invalid hook call/i,E=new Set,N=(e,t)=>{if("production"!==process.env.NODE_ENV){const o=`The component ${e}${t?` with the id of "${t}"`:""} has been created dynamically.\nYou 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.`,s=console.error;try{let e=!0;console.error=(t,...n)=>{b.test(t)?(e=!1,E.delete(o)):s(t,...n)},n(),e&&!E.has(o)&&(console.warn(o),E.add(o))}catch(e){b.test(e.message)&&E.delete(o)}finally{console.error=s}}},$=Object.freeze([]),_=Object.freeze({});function C(e,t,n=_){return e.theme!==n.theme&&e.theme||t||n.theme}var P=["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","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];const A=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,I=/(^-|-$)/g;function O(e){return e.replace(A,"-").replace(I,"")}const D=/(a)(d)/gi,R=e=>String.fromCharCode(e+(e>25?39:97));function j(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=R(t%52)+n;return(R(t%52)+n).replace(D,"$1-$2")}const T=(e,t)=>{let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e},x=e=>T(5381,e);function k(e){return j(x(e)>>>0)}function V(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function z(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}function B(e){return z(e)?`styled.${e}`:`Styled(${V(e)})`}const M="function"==typeof Symbol&&Symbol.for,F=M?Symbol.for("react.memo"):60115,G=M?Symbol.for("react.forward_ref"):60112,L={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Y={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},q={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},H={[G]:{$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},[F]:q};function W(e){return("type"in(t=e)&&t.type.$$typeof)===F?q:"$$typeof"in e?H[e.$$typeof]:L;var t}const U=Object.defineProperty,J=Object.getOwnPropertyNames,Z=Object.getOwnPropertySymbols,X=Object.getOwnPropertyDescriptor,K=Object.getPrototypeOf,Q=Object.prototype;function ee(e,t,n){if("string"!=typeof t){if(Q){const o=K(t);o&&o!==Q&&ee(e,o,n)}let o=J(t);Z&&(o=o.concat(Z(t)));const s=W(e),r=W(t);for(let i=0;i<o.length;++i){const a=o[i];if(!(a in Y||n&&n[a]||r&&a in r||s&&a in s)){const n=X(t,a);try{U(e,a,n)}catch(e){}}}}return e}function te(e){return"object"==typeof e&&"styledComponentId"in e}function ne(e){return!(null===e||"object"!=typeof e||e.constructor&&"Object"!==e.constructor.name||"[object Object]"!==(e.toString?e.toString():Object.prototype.toString.call(e))||"props"in e&&(e.$$typeof||void 0===e.constructor))}function oe(e,t,n=!1){if(!n&&!ne(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(let n=0;n<t.length;n++)e[n]=oe(e[n],t[n]);else if(ne(t))for(const n in t)e[n]=oe(e[n],t[n]);return e}const 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"}:{};function re(e,...t){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#${e} for more information.${t.length>0?` Args: ${t.join(", ")}`:""}`):new Error(function(...e){let t=e[0];const n=[];for(let t=1,o=e.length;t<o;t+=1)n.push(e[t]);return n.forEach((e=>{t=t.replace(/%[a-z]/,e)})),t}(se[e],...t).trim())}let ie=new Map,ae=new Map,ce=1;const le=e=>{if(ie.has(e))return ie.get(e);for(;ae.has(ce);)ce++;const t=ce++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>1073741824))throw re(16,`${t}`);return ie.set(e,t),ae.set(t,e),t},ue=e=>ae.get(e);function he(){return"undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}new RegExp(`^${g}\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)`);const de=e=>{const t=document.head,n=e||t,o=document.createElement("style"),s=(e=>{const{childNodes:t}=e;for(let e=t.length;e>=0;e--){const n=t[e];if(n&&1===n.nodeType&&n.hasAttribute(g))return n}})(n),r=void 0!==s?s.nextSibling:null;o.setAttribute(g,"active"),o.setAttribute("data-styled-version","6.0.0-alpha.6");const i=he();return i&&o.setAttribute("nonce",i),n.insertBefore(o,r),o},pe={isServer:!0,useCSSOMInjection:!v};class me{gs;names;options;server;tag;static registerId(e){return le(e)}constructor(e=_,t={},n){this.options={...pe,...e},this.gs=t,this.names=new Map(n),this.server=!!e.isServer,this.server}reconstructWithOptions(e,t=!0){return new me({...this.options,...e},this.gs,t&&this.names||void 0)}allocateGSInstance(e){return this.gs[e]=(this.gs[e]||0)+1}getTag(){return this.tag||(this.tag=(e=(({isServer:e,useCSSOMInjection:t,target:n})=>e?new class{rules;length;constructor(e){this.rules=[],this.length=0}insertRule(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)}deleteRule(e){this.rules.splice(e,1),this.length--}getRule(e){return e<this.length?this.rules[e]:""}}(n):t?new class{element;sheet;length;constructor(e){const t=this.element=de(e);t.appendChild(document.createTextNode("")),this.sheet=(e=>{if(e.sheet)return e.sheet;const{styleSheets:t}=document;for(let n=0,o=t.length;n<o;n++){const o=t[n];if(o.ownerNode===e)return o}throw re(17)})(t),this.length=0}insertRule(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}}deleteRule(e){this.sheet.deleteRule(e),this.length--}getRule(e){const t=this.sheet.cssRules[e];return void 0!==t&&"string"==typeof t.cssText?t.cssText:""}}(n):new class{element;nodes;length;constructor(e){const t=this.element=de(e);this.nodes=t.childNodes,this.length=0}insertRule(e,t){if(e<=this.length&&e>=0){const n=document.createTextNode(t),o=this.nodes[e];return this.element.insertBefore(n,o||null),this.length++,!0}return!1}deleteRule(e){this.element.removeChild(this.nodes[e]),this.length--}getRule(e){return e<this.length?this.nodes[e].textContent:""}}(n))(this.options),new class{groupSizes;length;tag;constructor(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}indexOfGroup(e){let t=0;for(let n=0;n<e;n++)t+=this.groupSizes[n];return t}insertRules(e,t){if(e>=this.groupSizes.length){const t=this.groupSizes,n=t.length;let o=n;for(;e>=o;)if(o<<=1,o<0)throw re(16,`${e}`);this.groupSizes=new Uint32Array(o),this.groupSizes.set(t),this.length=o;for(let e=n;e<o;e++)this.groupSizes[e]=0}let n=this.indexOfGroup(e+1);if(Array.isArray(t))for(let o=0,s=t.length;o<s;o++)this.tag.insertRule(n,t[o])&&(this.groupSizes[e]++,n++);else this.tag.insertRule(n,t)&&this.groupSizes[e]++}clearGroup(e){if(e<this.length){const t=this.groupSizes[e],n=this.indexOfGroup(e),o=n+t;this.groupSizes[e]=0;for(let e=n;e<o;e++)this.tag.deleteRule(n)}}getGroup(e){let t="";if(e>=this.length||0===this.groupSizes[e])return t;const n=this.groupSizes[e],o=this.indexOfGroup(e),s=o+n;for(let e=o;e<s;e++)t+=`${this.tag.getRule(e)}/*!sc*/\n`;return t}}(e)));var e}hasNameForId(e,t){return this.names.has(e)&&this.names.get(e).has(t)}registerName(e,t){if(le(e),this.names.has(e))this.names.get(e).add(t);else{const n=new Set;n.add(t),this.names.set(e,n)}}insertRules(e,t,n){this.registerName(e,t),this.getTag().insertRules(le(e),n)}clearNames(e){this.names.has(e)&&this.names.get(e).clear()}clearRules(e){this.getTag().clearGroup(le(e)),this.clearNames(e)}clearTag(){this.tag=void 0}toString(){return(e=>{const t=e.getTag(),{length:n}=t;let o="";for(let s=0;s<n;s++){const n=ue(s);if(void 0===n)continue;const r=e.names.get(n),i=t.getGroup(s);if(void 0===r||0===i.length)continue;const a=`${g}.g${s}[id="${n}"]`;let c="";void 0!==r&&r.forEach((e=>{e.length>0&&(c+=`${e},`)})),o+=`${i}${a}{content:"${c}"}/*!sc*/\n`}return o})(this)}}const fe=/^\s*\/\/.*$/gm,ye=[":","[",".","#"];function ge({options:e=_,plugins:t=$}=_){let n,o,s,r;const i=(e,t,s)=>0===t&&ye.includes(s[o.length])||s.match(r)?e:`.${n}`,a=e=>{if(e.type===f&&e.value.includes("&")){const t=e.props;t[0]=t[0].replace(s,i)}},c=(i,c="",l="",f="&")=>{let y=i.replace(fe,"");n=f,o=c,s=new RegExp(`\\${o}\\b`,"g"),r=new RegExp(`(\\${o}\\b){2,}`);const g=t.slice();return(e.prefix||void 0===e.prefix)&&g.unshift(u),g.push(a,h),d(p(l||c?`${l} ${c} { ${y} }`:y),m(g))};return c.hash=t.length?t.reduce(((e,t)=>(t.name||re(15),T(e,t.name))),5381).toString():"",c}const Se=t.createContext(void 0),ve=Se.Consumer,we=t.createContext(void 0);we.Consumer;const be=new me,Ee=ge();function Ne(){return s(Se)||be}function $e(){return s(we)||Ee}function _e(e){const[n,s]=o(e.stylisPlugins),a=Ne(),c=r((()=>{let t=a;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]),u=r((()=>ge({options:{prefix:!e.disableVendorPrefixes},plugins:n})),[e.disableVendorPrefixes,n]);return i((()=>{l(n,e.stylisPlugins)||s(e.stylisPlugins)}),[e.stylisPlugins]),t.createElement(Se.Provider,{value:c},t.createElement(we.Provider,{value:u},"production"!==process.env.NODE_ENV?t.Children.only(e.children):e.children))}class Ce{id;name;rules;constructor(e,t){this.name=e,this.id=`sc-keyframes-${e}`,this.rules=t}inject=(e,t=Ee)=>{const n=this.name+t.hash;e.hasNameForId(this.id,n)||e.insertRules(this.id,n,t(this.rules,n,"@keyframes"))};toString=()=>{throw re(12,String(this.name))};getName(e=Ee){return this.name+e.hash}}const Pe=/([A-Z])/,Ae=/([A-Z])/g,Ie=/^ms-/,Oe=e=>`-${e.toLowerCase()}`;function De(e){return Pe.test(e)?e.replace(Ae,Oe).replace(Ie,"-ms-"):e}function Re(e){return"function"==typeof e}const je=e=>null==e||!1===e||""===e,Te=(e,t)=>{const n=[];for(const t in e)e.hasOwnProperty(t)&&!je(e[t])&&(Array.isArray(e[t])&&e[t].isCss||Re(e[t])?n.push(`${De(t)}:`,e[t],";"):ne(e[t])?n.push(...Te(e[t],t)):n.push(`${De(t)}: ${o=t,s=e[t],null==s||"boolean"==typeof s||""===s?"":"number"!=typeof s||0===s||o in y?String(s).trim():`${s}px`};`));var o,s;return t?[`${t} {`,...n,"}"]:n};function xe(e,t,n,o){if(Array.isArray(e)){const s=[];for(let r,i=0,a=e.length;i<a;i+=1)r=xe(e[i],t,n,o),""!==r&&(Array.isArray(r)?s.push(...r):s.push(r));return s}if(je(e))return"";if(te(e))return`.${e.styledComponentId}`;if(Re(e)){if("function"!=typeof(s=e)||s.prototype&&s.prototype.isReactComponent||!t)return e;{const s=e,r=s(t);return"production"===process.env.NODE_ENV||"object"!=typeof r||Array.isArray(r)||r instanceof Ce||ne(r)||console.error(`${V(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.`),xe(r,t,n,o)}}var s;return e instanceof Ce?n?(e.inject(n,o),e.getName(o)):e:ne(e)?Te(e):e.toString()}function ke(e){for(let t=0;t<e.length;t+=1){const n=e[t];if(Re(n)&&!te(n))return!1}return!0}const Ve=x("6.0.0-alpha.6");class ze{baseHash;baseStyle;componentId;isStatic;rules;staticRulesId;constructor(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&ke(e),this.componentId=t,this.baseHash=T(Ve,t),this.baseStyle=n,me.registerId(t)}generateAndInjectStyles(e,t,n){const{componentId:o}=this,s=[];if(this.baseStyle&&s.push(this.baseStyle.generateAndInjectStyles(e,t,n)),this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(o,this.staticRulesId))s.push(this.staticRulesId);else{const r=xe(this.rules,e,t,n).join(""),i=j(T(this.baseHash,r)>>>0);if(!t.hasNameForId(o,i)){const e=n(r,`.${i}`,void 0,o);t.insertRules(o,i,e)}s.push(i),this.staticRulesId=i}else{const{length:r}=this.rules;let i=T(this.baseHash,n.hash),a="";for(let o=0;o<r;o++){const s=this.rules[o];if("string"==typeof s)a+=s,"production"!==process.env.NODE_ENV&&(i=T(i,s+o));else if(s){const r=xe(s,e,t,n),c=Array.isArray(r)?r.join(""):r;i=T(i,c+o),a+=c}}if(a){const e=j(i>>>0);if(!t.hasNameForId(o,e)){const s=n(a,`.${e}`,void 0,o);t.insertRules(o,e,s)}s.push(e)}}return s.join(" ")}}const Be=t.createContext(void 0),Me=Be.Consumer;function Fe(e){const n=s(Be),o=r((()=>function(e,t){if(!e)throw re(14);if(Re(e)){const n=e(t);if("production"!==process.env.NODE_ENV&&(null===n||Array.isArray(n)||"object"!=typeof n))throw re(7);return n}if(Array.isArray(e)||"object"!=typeof e)throw re(8);return t?{...t,...e}:e}(e.theme,n)),[e.theme,n]);return e.children?t.createElement(Be.Provider,{value:o},e.children):null}const Ge={};function Le(e,t){const n="string"!=typeof e?"sc":O(e);Ge[n]=(Ge[n]||0)+1;const o=`${n}-${k("6.0.0-alpha.6"+n+Ge[n])}`;return t?`${t}-${o}`:o}function Ye(n,o,r){const i=te(n),l=n,u=!z(n),{attrs:h=$,componentId:d=Le(o.displayName,o.parentComponentId),displayName:p=B(n)}=o,m=o.displayName&&o.componentId?`${O(o.displayName)}-${o.componentId}`:o.componentId||d,f=i&&l.attrs?l.attrs.concat(h).filter(Boolean):h;let{shouldForwardProp:y}=o;if(i&&l.shouldForwardProp){const e=l.shouldForwardProp;if(o.shouldForwardProp){const t=o.shouldForwardProp;y=(n,o,s)=>e(n,o,s)&&t(n,o,s)}else y=e}const g=new ze(r,m,i?l.componentStyle:void 0),S=g.isStatic&&0===h.length;function v(t,n){return function(t,n,o,r){const{attrs:i,componentStyle:l,defaultProps:u,foldedComponentIds:h,shouldForwardProp:d,styledComponentId:p,target:m}=t;"production"!==process.env.NODE_ENV&&c(p);const f=C(n,s(Be),u),[y,g]=function(e=_,t,n){const o={...t,theme:e},s={};return n.forEach((e=>{const t="function"==typeof e?e(o):e;let n;for(n in t)o[n]=s[n]="className"===n?(r=s[n],i=t[n],r&&i?`${r} ${i}`:r||i):t[n];var r,i})),[o,s]}(f||_,n,i),S=function(e,t,n,o){const s=Ne(),r=$e(),i=t?e.generateAndInjectStyles(_,s,r):e.generateAndInjectStyles(n,s,r);return"production"!==process.env.NODE_ENV&&c(i),"production"!==process.env.NODE_ENV&&!t&&o&&o(i),i}(l,r,y,"production"!==process.env.NODE_ENV?t.warnTooManyClasses:void 0),v=o,w=g.$as||n.$as||g.as||n.as||m,b=z(w),E=g!==n?{...n,...g}:n,N={};for(const t in E)"$"!==t[0]&&"as"!==t&&("forwardedAs"===t?N.as=E[t]:(d?d(t,e,w):!b||e(t))&&(N[t]=E[t]));return n.style&&g.style!==n.style&&(N.style={...n.style,...g.style}),N[b&&-1===P.indexOf(w)?"class":"className"]=h.concat(p,S!==p?S:null,n.className,g.className).filter(Boolean).join(" "),N.ref=v,a(w,N)}(w,t,n,S)}v.displayName=p;let w=t.forwardRef(v);return w.attrs=f,w.componentStyle=g,w.displayName=p,w.shouldForwardProp=y,w.foldedComponentIds=i?l.foldedComponentIds.concat(l.styledComponentId):$,w.styledComponentId=m,w.target=i?l.target:n,w.withComponent=function(e){const{componentId:t,...n}=o,s=t&&`${t}-${z(e)?e:O(V(e))}`;return Ye(e,{...n,attrs:f,componentId:s},r)},Object.defineProperty(w,"defaultProps",{get(){return this._foldedDefaultProps},set(e){this._foldedDefaultProps=i?function(e={},...t){for(const n of t)oe(e,n,!0);return e}({},l.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(N(p,m),w.warnTooManyClasses=((e,t)=>{let n={},o=!1;return s=>{if(!o&&(n[s]=!0,Object.keys(n).length>=200)){const s=t?` with the id of "${t}"`:"";console.warn(`Over 200 classes were generated for component ${e}${s}.\nConsider 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={}}}})(p,m)),w.toString=()=>`.${w.styledComponentId}`,u&&ee(w,n,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),w}function qe(e,t){const n=[e[0]];for(let o=0,s=t.length;o<s;o+=1)n.push(t[o],e[o+1]);return n}const He=e=>(Array.isArray(e)&&(e.isCss=!0),e);function We(e,...t){if(Re(e)||ne(e))return He(xe(qe($,[e,...t])));const n=e;return 0===t.length&&1===n.length&&"string"==typeof n[0]?n:He(xe(qe(n,t)))}function Ue(e,t,n=_){if(!t)throw re(1,t);const o=(o,...s)=>e(t,n,We(o,...s));return o.attrs=o=>Ue(e,t,{...n,attrs:Array.prototype.concat(n.attrs,o).filter(Boolean)}),o.withConfig=o=>Ue(e,t,{...n,...o}),o}const Je=e=>Ue(Ye,e),Ze=Je;P.forEach((e=>{Ze[e]=Je(e)}));class Xe{componentId;isStatic;rules;constructor(e,t){this.rules=e,this.componentId=t,this.isStatic=ke(e),me.registerId(this.componentId+1)}createStyles(e,t,n,o){const s=o(xe(this.rules,t,n,o).join(""),""),r=this.componentId+e;n.insertRules(r,r,s)}removeStyles(e,t){t.clearRules(this.componentId+e)}renderStyles(e,t,n,o){e>2&&me.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,o)}}function Ke(e,...n){const o=We(e,...n),s=`sc-global-${k(JSON.stringify(o))}`,r=new Xe(o,s);"production"!==process.env.NODE_ENV&&N(s);const i=e=>{const n=Ne(),a=$e(),c=t.useContext(Be),l=t.useRef(n.allocateGSInstance(s)).current;return"production"!==process.env.NODE_ENV&&t.Children.count(e.children)&&console.warn(`The global style component ${s} was given child JSX. createGlobalStyle does not render children.`),"production"!==process.env.NODE_ENV&&o.some((e=>"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."),n.server&&function(e,t,n,o,s){if(r.isStatic)r.renderStyles(e,w,n,s);else{const a={...t,theme:C(t,o,i.defaultProps)};r.renderStyles(e,a,n,s)}}(l,e,n,c,a),null};return t.memo(i)}function Qe(e,...t){"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.");const n=We(e,...t).join(""),o=k(n);return new Ce(o,n)}function et(e){const n=t.forwardRef(((n,o)=>{const s=C(n,t.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 "${V(e)}"`),t.createElement(e,{...n,theme:s,ref:o})}));return n.displayName=`WithTheme(${V(e)})`,ee(n,e)}const tt=()=>s(Be),nt=/^\s*<\/[a-z]/i;class ot{instance;sealed;constructor(){this.instance=new me({isServer:!0}),this.sealed=!1}_emitSheetCSS=()=>{const e=this.instance.toString(),t=he();return`<style ${[t&&`nonce="${t}"`,`${g}="true"`,'data-styled-version="6.0.0-alpha.6"'].filter(Boolean).join(" ")}>${e}</style>`};collectStyles(e){if(this.sealed)throw re(2);return t.createElement(_e,{sheet:this.instance},e)}getStyleTags=()=>{if(this.sealed)throw re(2);return this._emitSheetCSS()};getStyleElement=()=>{if(this.sealed)throw re(2);const e={[g]:"","data-styled-version":"6.0.0-alpha.6",dangerouslySetInnerHTML:{__html:this.instance.toString()}},n=he();return n&&(e.nonce=n),[t.createElement("style",{...e,key:"sc-0-0"})]};interleaveWithNodeStream(e){if(this.sealed)throw re(2);{this.seal();const{Transform:t}=require("stream"),n=e,{instance:o,_emitSheetCSS:s}=this,r=new t({transform:function(e,t,n){const r=e.toString(),i=s();if(o.clearTag(),nt.test(r)){const e=r.indexOf(">")+1,t=r.slice(0,e),n=r.slice(e);this.push(t+i+n)}else this.push(i+r);n()}});return n.on("error",(e=>{r.emit("error",e)})),n.pipe(r)}}seal=()=>{this.sealed=!0}}const st={StyleSheet:me,mainSheet:be};"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"),"production"!==process.env.NODE_ENV&&process.env.NODE_ENV;export{ot as ServerStyleSheet,ve as StyleSheetConsumer,Se as StyleSheetContext,_e as StyleSheetManager,Me as ThemeConsumer,Be as ThemeContext,Fe as ThemeProvider,st as __PRIVATE__,Ke as createGlobalStyle,We as css,Ze as default,te as isStyledComponent,Qe as keyframes,tt as useTheme,S as version,et as withTheme};
|
|
1
|
+
import{__spreadArray as e,__assign as t,__rest as n}from"tslib";import o from"@emotion/is-prop-valid";import r,{useRef as s,useState as i,useContext as a,useMemo as c,useEffect as u,createElement as l,useDebugValue as p}from"react";import d from"shallowequal";import{prefixer as h,stringify as f,middleware as m,compile as y,RULESET as v}from"stylis";import g from"@emotion/unitless";var S="undefined"!=typeof process&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",w="6.0.0-beta.1",b=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&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.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),E={},N=/invalid hook call/i,_=new Set,C=function(t,n){if("production"!==process.env.NODE_ENV){var o=n?' with the id of "'.concat(n,'"'):"",r="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];N.test(t)?(a=!1,_.delete(r)):i.apply(void 0,e([t],n,!1))},s(),a&&!_.has(r)&&(console.warn(r),_.add(r))}catch(e){N.test(e.message)&&_.delete(r)}finally{console.error=i}}},P=Object.freeze([]),A=Object.freeze({});function I(e,t,n){return void 0===n&&(n=A),e.theme!==n.theme&&e.theme||t||n.theme}var O=["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","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],D=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,R=/(^-|-$)/g;function j(e){return e.replace(D,"-").replace(R,"")}var T=/(a)(d)/gi,x=function(e){return String.fromCharCode(e+(e>25?39:97))};function k(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=x(t%52)+n;return(x(t%52)+n).replace(T,"$1-$2")}var V,B=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},$=function(e){return B(5381,e)};function z(e){return k($(e)>>>0)}function M(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function F(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var G="function"==typeof Symbol&&Symbol.for,L=G?Symbol.for("react.memo"):60115,Y=G?Symbol.for("react.forward_ref"):60112,q={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},H={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},W={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},U=((V={})[Y]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},V[L]=W,V);function J(e){return("type"in(t=e)&&t.type.$$typeof)===L?W:"$$typeof"in e?U[e.$$typeof]:q;var t}var Z=Object.defineProperty,X=Object.getOwnPropertyNames,K=Object.getOwnPropertySymbols,Q=Object.getOwnPropertyDescriptor,ee=Object.getPrototypeOf,te=Object.prototype;function ne(e,t,n){if("string"!=typeof t){if(te){var o=ee(t);o&&o!==te&&ne(e,o,n)}var r=X(t);K&&(r=r.concat(K(t)));for(var s=J(e),i=J(t),a=0;a<r.length;++a){var c=r[a];if(!(c in H||n&&n[c]||i&&c in i||s&&c in s)){var u=Q(t,c);try{Z(e,c,u)}catch(e){}}}}return e}function oe(e){return"object"==typeof e&&"styledComponentId"in e}function re(e){return!(null===e||"object"!=typeof e||e.constructor&&"Object"!==e.constructor.name||"[object Object]"!==(e.toString?e.toString():Object.prototype.toString.call(e))||"props"in e&&(e.$$typeof||void 0===e.constructor))}function se(e,t,n){if(void 0===n&&(n=!1),!n&&!re(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var o=0;o<t.length;o++)e[o]=se(e[o],t[o]);else if(re(t))for(var o in t)e[o]=se(e[o],t[o]);return e}var ie="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"}:{};function ae(){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 ce(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(ae.apply(void 0,e([ie[t]],n,!1)).trim())}var ue=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 ce(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}var i=this.indexOfGroup(e+1);if(Array.isArray(t)){s=0;for(var a=t.length;s<a;s++)this.tag.insertRule(i,t[s])&&(this.groupSizes[e]++,i++)}else this.tag.insertRule(i,t)&&this.groupSizes[e]++},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,pe=new Map,de=1,he=function(e){if(le.has(e))return le.get(e);for(;pe.has(de);)de++;var t=de++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>1073741824))throw ce(16,"".concat(t));return le.set(e,t),pe.set(t,e),t},fe=("style[".concat(S,"][").concat("data-styled-version",'="').concat(w,'"]'),new RegExp("^".concat(S,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),function(e){for(var t=e.getTag(),n=t.length,o="",r=function(n){var r=function(e){return pe.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(S,".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 me(){return"undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var ye=function(e){var t=document.head,n=e||t,o=document.createElement("style"),r=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var o=t[n];if(o&&1===o.nodeType&&o.hasAttribute(S))return o}}(n),s=void 0!==r?r.nextSibling:null;o.setAttribute(S,"active"),o.setAttribute("data-styled-version",w);var i=me();return i&&o.setAttribute("nonce",i),n.insertBefore(o,s),o},ve=function(){function e(e){var t=this.element=ye(e);t.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 ce(17)}(t),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 void 0!==t&&"string"==typeof t.cssText?t.cssText:""},e}(),ge=function(){function e(e){var t=this.element=ye(e);this.nodes=t.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}(),Se=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}(),we={isServer:!0,useCSSOMInjection:!b},be=function(){function e(e,n,o){void 0===e&&(e=A),void 0===n&&(n={}),this.options=t(t({},we),e),this.gs=n,this.names=new Map(o),this.server=!!e.isServer}return e.registerId=function(e){return he(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 Se(n):t?new ve(n):new ge(n)}(this.options),new ue(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(he(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(he(e),n)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(he(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e.prototype.toString=function(){return fe(this)},e}(),Ee=/^\s*\/\/.*$/gm,Ne=[":","[",".","#"];function _e(e){var t,n,o,r,s=void 0===e?A:e,i=s.options,a=void 0===i?A:i,c=s.plugins,u=void 0===c?P:c,l=function(e,o,s){return 0===o&&Ne.includes(s[n.length])||s.match(r)?e:".".concat(t)},p=function(e){if(e.type===v&&e.value.includes("&")){var t=e.props;t[0]=t[0].replace(o,l)}},d=function(e,s,i,c){void 0===s&&(s=""),void 0===i&&(i=""),void 0===c&&(c="&");var l=e.replace(Ee,"");t=c,n=s,o=new RegExp("\\".concat(n,"\\b"),"g"),r=new RegExp("(\\".concat(n,"\\b){2,}"));var d,v,g=u.slice();return(a.prefix||void 0===a.prefix)&&g.unshift(h),g.push(p,f),d=y(i||s?"".concat(i," ").concat(s," { ").concat(l," }"):l),v=m(g),d.map(function(e,t){return v(e,t,d,v)}).filter(Boolean)};return d.hash=u.length?u.reduce(function(e,t){return t.name||ce(15),B(e,t.name)},5381).toString():"",d}var Ce=r.createContext(void 0),Pe=Ce.Consumer,Ae=r.createContext(void 0),Ie=new be,Oe=_e();function De(){return a(Ce)||Ie}function Re(){return a(Ae)||Oe}function je(e){var t=i(e.stylisPlugins),n=t[0],o=t[1],s=De(),a=c(function(){var t=s;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]),l=c(function(){return _e({options:{prefix:!e.disableVendorPrefixes},plugins:n})},[e.disableVendorPrefixes,n]);return u(function(){d(n,e.stylisPlugins)||o(e.stylisPlugins)},[e.stylisPlugins]),r.createElement(Ce.Provider,{value:a},r.createElement(Ae.Provider,{value:l},"production"!==process.env.NODE_ENV?r.Children.only(e.children):e.children))}var Te=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=Oe);var o=n.name+t.hash;e.hasNameForId(n.id,o)||e.insertRules(n.id,o,t(n.rules,o,"@keyframes"))},this.toString=function(){throw ce(12,String(n.name))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=Oe),this.name+e.hash},e}(),xe=/([A-Z])/,ke=/([A-Z])/g,Ve=/^ms-/,Be=function(e){return"-".concat(e.toLowerCase())};function $e(e){return xe.test(e)?e.replace(ke,Be).replace(Ve,"-ms-"):e}function ze(e){return"function"==typeof e}var Me=function(e){return null==e||!1===e||""===e},Fe=function(t,n){var o,r=[];for(var s in t)t.hasOwnProperty(s)&&!Me(t[s])&&(Array.isArray(t[s])&&t[s].isCss||ze(t[s])?r.push("".concat($e(s),":"),t[s],";"):re(t[s])?r.push.apply(r,Fe(t[s],s)):r.push("".concat($e(s),": ").concat(null==(o=t[s])||"boolean"==typeof o||""===o?"":"number"!=typeof o||0===o||s in g?String(o).trim():"".concat(o,"px"),";")));return n?e(e(["".concat(n," {")],r,!0),["}"],!1):r};function Ge(e,t,n,o){if(Array.isArray(e)){for(var r=[],s=0,i=e.length,a=void 0;s<i;s+=1)""!==(a=Ge(e[s],t,n,o))&&(Array.isArray(a)?r.push.apply(r,a):r.push(a));return r}if(Me(e))return"";if(oe(e))return".".concat(e.styledComponentId);if(ze(e)){if("function"!=typeof(u=e)||u.prototype&&u.prototype.isReactComponent||!t)return e;var c=e;return a=c(t),"production"===process.env.NODE_ENV||"object"!=typeof a||Array.isArray(a)||a instanceof Te||re(a)||console.error("".concat(M(c)," 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.")),Ge(a,t,n,o)}var u;return e instanceof Te?n?(e.inject(n,o),e.getName(o)):e:re(e)?Fe(e):e.toString()}function Le(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(ze(n)&&!oe(n))return!1}return!0}var Ye=$(w),qe=function(){function e(e,t,n){this.names=[],this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&Le(e),this.componentId=t,this.baseHash=B(Ye,t),this.baseStyle=n,be.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var o=this.componentId;if(this.names.length=0,this.baseStyle&&this.names.push(this.baseStyle.generateAndInjectStyles(e,t,n)),this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(o,this.staticRulesId))this.names.push(this.staticRulesId);else{var r=Ge(this.rules,e,t,n).join(""),s=k(B(this.baseHash,r)>>>0);if(!t.hasNameForId(o,s)){var i=n(r,".".concat(s),void 0,o);t.insertRules(o,s,i)}this.names.push(s),this.staticRulesId=s}else{for(var a=this.rules.length,c=B(this.baseHash,n.hash),u="",l=0;l<a;l++){var p=this.rules[l];if("string"==typeof p)u+=p,"production"!==process.env.NODE_ENV&&(c=B(c,p));else if(p){var d=Ge(p,e,t,n),h=Array.isArray(d)?d.join(""):d;c=B(c,h),u+=h}}if(u){var f=k(c>>>0);if(!t.hasNameForId(o,f)){var m=n(u,".".concat(f),void 0,o);t.insertRules(o,f,m)}this.names.push(f)}}return this.names.join(" ")},e}(),He=r.createContext(void 0),We=He.Consumer;function Ue(e){var n=a(He),o=c(function(){return function(e,n){if(!e)throw ce(14);if(ze(e)){var o=e(n);if("production"!==process.env.NODE_ENV&&(null===o||Array.isArray(o)||"object"!=typeof o))throw ce(7);return o}if(Array.isArray(e)||"object"!=typeof e)throw ce(8);return n?t(t({},n),e):e}(e.theme,n)},[e.theme,n]);return e.children?r.createElement(He.Provider,{value:o},e.children):null}var Je={};function Ze(e,s,i){var c=oe(e),u=e,d=!F(e),h=s.attrs,f=void 0===h?P:h,m=s.componentId,y=void 0===m?function(e,t){var n="string"!=typeof e?"sc":j(e);Je[n]=(Je[n]||0)+1;var o="".concat(n,"-").concat(z(w+n+Je[n]));return t?"".concat(t,"-").concat(o):o}(s.displayName,s.parentComponentId):m,v=s.displayName,g=void 0===v?function(e){return F(e)?"styled.".concat(e):"Styled(".concat(M(e),")")}(e):v,S=s.displayName&&s.componentId?"".concat(j(s.displayName),"-").concat(s.componentId):s.componentId||y,b=c&&u.attrs?u.attrs.concat(f).filter(Boolean):f,E=s.shouldForwardProp;if(c&&u.shouldForwardProp){var N=u.shouldForwardProp;if(s.shouldForwardProp){var _=s.shouldForwardProp;E=function(e,t,n){return N(e,t,n)&&_(e,t,n)}}else E=N}var D=new qe(i,S,c?u.componentStyle:void 0),R=D.isStatic&&0===f.length;function T(e,n){return function(e,n,r,s){var i=e.attrs,c=e.componentStyle,u=e.defaultProps,d=e.foldedComponentIds,h=e.shouldForwardProp,f=e.styledComponentId,m=e.target;"production"!==process.env.NODE_ENV&&p(f);var y=function(e,n,o){void 0===e&&(e=A);var r=t(t({},n),{theme:e});return o.forEach(function(e){var n,o,s,i="function"==typeof e?e(r):e;for(n in i)r[n]="className"===n?(s=i[n],(o=r[n])&&s?"".concat(o," ").concat(s):o||s):"style"===n?t(t({},r[n]),i[n]):i[n]}),r}(I(n,a(He),u)||A,n,i),v=function(e,t,n,o){var r=De(),s=Re(),i=e.generateAndInjectStyles(t?A:n,r,s);return"production"!==process.env.NODE_ENV&&p(i),"production"!==process.env.NODE_ENV&&!t&&o&&o(i),i}(c,s,y,"production"!==process.env.NODE_ENV?e.warnTooManyClasses:void 0),g=r,S=y.$as||y.as||m,w=F(S),b={};for(var E in y)"$"!==E[0]&&"as"!==E&&"theme"!==E&&("forwardedAs"===E?b.as=y[E]:(h?h(E,o,S):!w||o(E))&&(b[E]=y[E]));return b[w&&-1===O.indexOf(S)?"class":"className"]=d.concat(f,v!==f?v:null,y.className).filter(Boolean).join(" "),b.ref=g,l(S,b)}(x,e,n,R)}T.displayName=g;var x=r.forwardRef(T);return x.attrs=b,x.componentStyle=D,x.displayName=g,x.shouldForwardProp=E,x.foldedComponentIds=c?u.foldedComponentIds.concat(u.styledComponentId):P,x.styledComponentId=S,x.target=c?u.target:e,x.withComponent=function(e){var o=s.componentId,r=n(s,["componentId"]),a=o&&"".concat(o,"-").concat(F(e)?e:j(M(e)));return Ze(e,t(t({},r),{attrs:b,componentId:a}),i)},Object.defineProperty(x,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=c?function(e){void 0===e&&(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++)se(e,r[o],!0);return e}({},u.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(C(g,S),x.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={}}}}(g,S)),x.toString=function(){return".".concat(x.styledComponentId)},d&&ne(x,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),x}function Xe(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 Ke=function(e){return Array.isArray(e)&&(e.isCss=!0),e};function Qe(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(ze(t)||re(t)){var r=t;return Ke(Ge(Xe(P,e([r],n,!0))))}var s=t;return 0===n.length&&1===s.length&&"string"==typeof s[0]?s:Ke(Ge(Xe(s,n)))}function et(n,o,r){if(void 0===r&&(r=A),!o)throw ce(1,o);var s=function(t){for(var s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];return n(o,r,Qe.apply(void 0,e([t],s,!1)))};return s.attrs=function(e){return et(n,o,t(t({},r),{attrs:Array.prototype.concat(r.attrs,e).filter(Boolean)}))},s.withConfig=function(e){return et(n,o,t(t({},r),e))},s}var tt=function(e){return et(Ze,e)},nt=tt;O.forEach(function(e){nt[e]=tt(e)});var ot=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=Le(e),be.registerId(this.componentId+1)}return e.prototype.createStyles=function(e,t,n,o){var r=o(Ge(this.rules,t,n,o).join(""),""),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&&be.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,o)},e}();function rt(n){for(var o=[],s=1;s<arguments.length;s++)o[s-1]=arguments[s];var i=Qe.apply(void 0,e([n],o,!1)),a="sc-global-".concat(z(JSON.stringify(i))),c=new ot(i,a);"production"!==process.env.NODE_ENV&&C(a);var u=function(e){var t=De(),n=Re(),o=r.useContext(He),s=r.useRef(t.allocateGSInstance(a)).current;return"production"!==process.env.NODE_ENV&&r.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.server&&l(s,e,t,o,n),null};function l(e,n,o,r,s){if(c.isStatic)c.renderStyles(e,E,o,s);else{var i=t(t({},n),{theme:I(n,r,u.defaultProps)});c.renderStyles(e,i,o,s)}}return r.memo(u)}function st(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=Qe.apply(void 0,e([t],n,!1)).join(""),s=z(r);return new Te(s,r)}function it(e){var n=r.forwardRef(function(n,o){var s=I(n,r.useContext(He),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(M(e),'"')),r.createElement(e,t({},n,{theme:s,ref:o}))});return n.displayName="WithTheme(".concat(M(e),")"),ne(n,e)}var at=function(){return a(He)},ct=/^\s*<\/[a-z]/i,ut=function(){function e(){var e=this;this._emitSheetCSS=function(){var t=e.instance.toString(),n=me(),o=[n&&'nonce="'.concat(n,'"'),"".concat(S,'="true"'),"".concat("data-styled-version",'="').concat(w,'"')].filter(Boolean).join(" ");return"<style ".concat(o,">").concat(t,"</style>")},this.getStyleTags=function(){if(e.sealed)throw ce(2);return e._emitSheetCSS()},this.getStyleElement=function(){var n;if(e.sealed)throw ce(2);var o=((n={})[S]="",n["data-styled-version"]=w,n.dangerouslySetInnerHTML={__html:e.instance.toString()},n),s=me();return s&&(o.nonce=s),[r.createElement("style",t({},o,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new be({isServer:!0}),this.sealed=!1}return e.prototype.collectStyles=function(e){if(this.sealed)throw ce(2);return r.createElement(je,{sheet:this.instance},e)},e.prototype.interleaveWithNodeStream=function(e){if(this.sealed)throw ce(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(),ct.test(s)){var a=s.indexOf(">")+1,c=s.slice(0,a),u=s.slice(a);this.push(c+i+u)}else this.push(i+s);n()}});return n.on("error",function(e){s.emit("error",e)}),n.pipe(s)},e}(),lt={StyleSheet:be,mainSheet:Ie};"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"),"production"!==process.env.NODE_ENV&&process;export{ut as ServerStyleSheet,Pe as StyleSheetConsumer,Ce as StyleSheetContext,je as StyleSheetManager,We as ThemeConsumer,He as ThemeContext,Ue as ThemeProvider,lt as __PRIVATE__,rt as createGlobalStyle,Qe as css,nt as default,oe as isStyledComponent,st as keyframes,at as useTheme,w as version,it as withTheme};
|
|
2
2
|
//# sourceMappingURL=styled-components.esm.js.map
|