styled-components 6.0.0-alpha.7 → 6.0.0-beta.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/README.md +2 -2
- package/dist/constructors/constructWithOptions.d.ts +16 -21
- package/dist/constructors/css.d.ts +2 -2
- package/dist/constructors/styled.d.ts +179 -179
- package/dist/models/ComponentStyle.d.ts +1 -0
- package/dist/models/StyledComponent.d.ts +1 -1
- package/dist/models/StyledNativeComponent.d.ts +2 -2
- package/dist/native/index.d.ts +29 -29
- package/dist/styled-components-macro.cjs.js +47 -1
- package/dist/styled-components-macro.cjs.js.map +1 -1
- package/dist/styled-components-macro.esm.js +38 -1
- package/dist/styled-components-macro.esm.js.map +1 -1
- package/dist/styled-components.browser.cjs.js +1854 -1
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +1829 -1
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +1874 -1
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +1849 -1
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +2074 -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/test/utils.d.ts +178 -178
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +33 -44
- package/dist/utils/generateDisplayName.d.ts +1 -1
- package/dist/utils/getComponentName.d.ts +1 -1
- package/dist/utils/isStyledComponent.d.ts +1 -1
- package/dist/utils/isTag.d.ts +1 -1
- package/dist/utils/stylis.d.ts +2 -1
- package/native/dist/constructors/constructWithOptions.d.ts +16 -21
- package/native/dist/constructors/css.d.ts +2 -2
- package/native/dist/constructors/styled.d.ts +179 -179
- package/native/dist/models/ComponentStyle.d.ts +1 -0
- package/native/dist/models/StyledComponent.d.ts +1 -1
- package/native/dist/models/StyledNativeComponent.d.ts +2 -2
- package/native/dist/native/index.d.ts +29 -29
- package/native/dist/styled-components.native.cjs.js +438 -403
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +439 -404
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/test/utils.d.ts +178 -178
- package/native/dist/types.d.ts +33 -44
- package/native/dist/utils/generateDisplayName.d.ts +1 -1
- package/native/dist/utils/getComponentName.d.ts +1 -1
- package/native/dist/utils/isStyledComponent.d.ts +1 -1
- package/native/dist/utils/isTag.d.ts +1 -1
- package/native/dist/utils/stylis.d.ts +2 -1
- package/package.json +8 -8
- package/test-utils/setupTestFramework.ts +9 -3
|
@@ -1,2 +1,1855 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@emotion/is-prop-valid"),t=require("react"),n=require("shallowequal"),o=require("stylis"),s=require("@emotion/unitless");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=r(e),a=r(t),l=r(n),c=r(s);const u="undefined"!=typeof process&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",d="undefined"!=typeof window&&"HTMLElement"in window,h=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),p={},m=/invalid hook call/i,f=new Set,y=(e,n)=>{if("production"!==process.env.NODE_ENV){const o=`The component ${e}${n?` with the id of "${n}"`:""} 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)=>{m.test(t)?(e=!1,f.delete(o)):s(t,...n)},t.useRef(),e&&!f.has(o)&&(console.warn(o),f.add(o))}catch(e){m.test(e.message)&&f.delete(o)}finally{console.error=s}}},g=Object.freeze([]),S=Object.freeze({});function v(e,t,n=S){return e.theme!==n.theme&&e.theme||t||n.theme}var w=["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 b=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,E=/(^-|-$)/g;function N(e){return e.replace(b,"-").replace(E,"")}const _=/(a)(d)/gi,C=e=>String.fromCharCode(e+(e>25?39:97));function $(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=C(t%52)+n;return(C(t%52)+n).replace(_,"$1-$2")}const P=(e,t)=>{let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e},A=e=>P(5381,e);function I(e){return $(A(e)>>>0)}function x(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function O(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}function R(e){return O(e)?`styled.${e}`:`Styled(${x(e)})`}const D="function"==typeof Symbol&&Symbol.for,T=D?Symbol.for("react.memo"):60115,j=D?Symbol.for("react.forward_ref"):60112,k={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},V={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},M={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},z={[j]:{$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},[T]:M};function B(e){return("type"in(t=e)&&t.type.$$typeof)===T?M:"$$typeof"in e?z[e.$$typeof]:k;var t}const L=Object.defineProperty,G=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols,q=Object.getOwnPropertyDescriptor,Y=Object.getPrototypeOf,H=Object.prototype;function W(e,t,n){if("string"!=typeof t){if(H){const o=Y(t);o&&o!==H&&W(e,o,n)}let o=G(t);F&&(o=o.concat(F(t)));const s=B(e),r=B(t);for(let i=0;i<o.length;++i){const a=o[i];if(!(a in V||n&&n[a]||r&&a in r||s&&a in s)){const n=q(t,a);try{L(e,a,n)}catch(e){}}}}return e}function U(e){return"object"==typeof e&&"styledComponentId"in e}function J(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 X(e,t,n=!1){if(!n&&!J(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(let n=0;n<t.length;n++)e[n]=X(e[n],t[n]);else if(J(t))for(const n in t)e[n]=X(e[n],t[n]);return e}const Z="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 K(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}(Z[e],...t).trim())}let Q=new Map,ee=new Map,te=1;const ne=e=>{if(Q.has(e))return Q.get(e);for(;ee.has(te);)te++;const t=te++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>1073741824))throw K(16,`${t}`);return Q.set(e,t),ee.set(t,e),t},oe=e=>ee.get(e),se=(e,t)=>{Q.set(e,t),ee.set(t,e)},re=`style[${u}][data-styled-version="6.0.0-alpha.7"]`,ie=new RegExp(`^${u}\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)`),ae=(e,t,n)=>{const o=n.split(",");let s;for(let n=0,r=o.length;n<r;n++)(s=o[n])&&e.registerName(t,s)},le=(e,t)=>{const n=(t.textContent??"").split("/*!sc*/\n"),o=[];for(let t=0,s=n.length;t<s;t++){const s=n[t].trim();if(!s)continue;const r=s.match(ie);if(r){const t=0|parseInt(r[1],10),n=r[2];0!==t&&(se(n,t),ae(e,n,r[3]),e.getTag().insertRules(t,o)),o.length=0}else o.push(s)}};function ce(){return"undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}const ue=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(u))return n}})(n),r=void 0!==s?s.nextSibling:null;o.setAttribute(u,"active"),o.setAttribute("data-styled-version","6.0.0-alpha.7");const i=ce();return i&&o.setAttribute("nonce",i),n.insertBefore(o,r),o};let de=d;const he={isServer:!d,useCSSOMInjection:!h};class pe{gs;names;options;server;tag;static registerId(e){return ne(e)}constructor(e=S,t={},n){this.options={...he,...e},this.gs=t,this.names=new Map(n),this.server=!!e.isServer,!this.server&&d&&de&&(de=!1,(e=>{const t=document.querySelectorAll(re);for(let n=0,o=t.length;n<o;n++){const o=t[n];o&&"active"!==o.getAttribute(u)&&(le(e,o),o.parentNode&&o.parentNode.removeChild(o))}})(this))}reconstructWithOptions(e,t=!0){return new pe({...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=ue(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 K(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=ue(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 K(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(ne(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(ne(e),n)}clearNames(e){this.names.has(e)&&this.names.get(e).clear()}clearRules(e){this.getTag().clearGroup(ne(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=oe(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=`${u}.g${s}[id="${n}"]`;let l="";void 0!==r&&r.forEach((e=>{e.length>0&&(l+=`${e},`)})),o+=`${i}${a}{content:"${l}"}/*!sc*/\n`}return o})(this)}}const me=/^\s*\/\/.*$/gm,fe=[":","[",".","#"];function ye({options:e=S,plugins:t=g}=S){let n,s,r,i;const a=(e,t,o)=>0===t&&fe.includes(o[s.length])||o.match(i)?e:`.${n}`,l=e=>{if(e.type===o.RULESET&&e.value.includes("&")){const t=e.props;t[0]=t[0].replace(r,a)}},c=(a,c="",u="",d="&")=>{let h=a.replace(me,"");n=d,s=c,r=new RegExp(`\\${s}\\b`,"g"),i=new RegExp(`(\\${s}\\b){2,}`);const p=t.slice();return(e.prefix||void 0===e.prefix)&&p.unshift(o.prefixer),p.push(l,o.stringify),o.serialize(o.compile(u||c?`${u} ${c} { ${h} }`:h),o.middleware(p))};return c.hash=t.length?t.reduce(((e,t)=>(t.name||K(15),P(e,t.name))),5381).toString():"",c}const ge=a.default.createContext(void 0),Se=ge.Consumer,ve=a.default.createContext(void 0);ve.Consumer;const we=new pe,be=ye();function Ee(){return t.useContext(ge)||we}function Ne(){return t.useContext(ve)||be}function _e(e){const[n,o]=t.useState(e.stylisPlugins),s=Ee(),r=t.useMemo((()=>{let 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]),i=t.useMemo((()=>ye({options:{prefix:!e.disableVendorPrefixes},plugins:n})),[e.disableVendorPrefixes,n]);return t.useEffect((()=>{l.default(n,e.stylisPlugins)||o(e.stylisPlugins)}),[e.stylisPlugins]),a.default.createElement(ge.Provider,{value:r},a.default.createElement(ve.Provider,{value:i},"production"!==process.env.NODE_ENV?a.default.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=be)=>{const n=this.name+t.hash;e.hasNameForId(this.id,n)||e.insertRules(this.id,n,t(this.rules,n,"@keyframes"))};toString=()=>{throw K(12,String(this.name))};getName(e=be){return this.name+e.hash}}const $e=/([A-Z])/,Pe=/([A-Z])/g,Ae=/^ms-/,Ie=e=>`-${e.toLowerCase()}`;function xe(e){return $e.test(e)?e.replace(Pe,Ie).replace(Ae,"-ms-"):e}function Oe(e){return"function"==typeof e}const Re=e=>null==e||!1===e||""===e,De=(e,t)=>{const n=[];for(const t in e)e.hasOwnProperty(t)&&!Re(e[t])&&(Array.isArray(e[t])&&e[t].isCss||Oe(e[t])?n.push(`${xe(t)}:`,e[t],";"):J(e[t])?n.push(...De(e[t],t)):n.push(`${xe(t)}: ${o=t,s=e[t],null==s||"boolean"==typeof s||""===s?"":"number"!=typeof s||0===s||o in c.default?String(s).trim():`${s}px`};`));var o,s;return t?[`${t} {`,...n,"}"]:n};function Te(e,t,n,o){if(Array.isArray(e)){const s=[];for(let r,i=0,a=e.length;i<a;i+=1)r=Te(e[i],t,n,o),""!==r&&(Array.isArray(r)?s.push(...r):s.push(r));return s}if(Re(e))return"";if(U(e))return`.${e.styledComponentId}`;if(Oe(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||J(r)||console.error(`${x(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.`),Te(r,t,n,o)}}var s;return e instanceof Ce?n?(e.inject(n,o),e.getName(o)):e:J(e)?De(e):e.toString()}function je(e){for(let t=0;t<e.length;t+=1){const n=e[t];if(Oe(n)&&!U(n))return!1}return!0}const ke=A("6.0.0-alpha.7");class Ve{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)&&je(e),this.componentId=t,this.baseHash=P(ke,t),this.baseStyle=n,pe.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=Te(this.rules,e,t,n).join(""),i=$(P(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=P(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=P(i,s+o));else if(s){const r=Te(s,e,t,n),l=Array.isArray(r)?r.join(""):r;i=P(i,l+o),a+=l}}if(a){const e=$(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 Me=a.default.createContext(void 0),ze=Me.Consumer,Be={};function Le(e,t){const n="string"!=typeof e?"sc":N(e);Be[n]=(Be[n]||0)+1;const o=`${n}-${I("6.0.0-alpha.7"+n+Be[n])}`;return t?`${t}-${o}`:o}function Ge(e,n,o){const s=U(e),r=e,l=!O(e),{attrs:c=g,componentId:u=Le(n.displayName,n.parentComponentId),displayName:d=R(e)}=n,h=n.displayName&&n.componentId?`${N(n.displayName)}-${n.componentId}`:n.componentId||u,p=s&&r.attrs?r.attrs.concat(c).filter(Boolean):c;let{shouldForwardProp:m}=n;if(s&&r.shouldForwardProp){const e=r.shouldForwardProp;if(n.shouldForwardProp){const t=n.shouldForwardProp;m=(n,o,s)=>e(n,o,s)&&t(n,o,s)}else m=e}const f=new Ve(o,h,s?r.componentStyle:void 0),b=f.isStatic&&0===c.length;function E(e,n){return function(e,n,o,s){const{attrs:r,componentStyle:a,defaultProps:l,foldedComponentIds:c,shouldForwardProp:u,styledComponentId:d,target:h}=e;"production"!==process.env.NODE_ENV&&t.useDebugValue(d);const p=v(n,t.useContext(Me),l),[m,f]=function(e=S,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]}(p||S,n,r),y=function(e,n,o,s){const r=Ee(),i=Ne(),a=n?e.generateAndInjectStyles(S,r,i):e.generateAndInjectStyles(o,r,i);return"production"!==process.env.NODE_ENV&&t.useDebugValue(a),"production"!==process.env.NODE_ENV&&!n&&s&&s(a),a}(a,s,m,"production"!==process.env.NODE_ENV?e.warnTooManyClasses:void 0),g=o,b=f.$as||n.$as||f.as||n.as||h,E=O(b),N=f!==n?{...n,...f}:n,_={};for(const e in N)"$"!==e[0]&&"as"!==e&&("forwardedAs"===e?_.as=N[e]:(u?u(e,i.default,b):!E||i.default(e))&&(_[e]=N[e]));return n.style&&f.style!==n.style&&(_.style={...n.style,...f.style}),_[E&&-1===w.indexOf(b)?"class":"className"]=c.concat(d,y!==d?y:null,n.className,f.className).filter(Boolean).join(" "),_.ref=g,t.createElement(b,_)}(_,e,n,b)}E.displayName=d;let _=a.default.forwardRef(E);return _.attrs=p,_.componentStyle=f,_.displayName=d,_.shouldForwardProp=m,_.foldedComponentIds=s?r.foldedComponentIds.concat(r.styledComponentId):g,_.styledComponentId=h,_.target=s?r.target:e,_.withComponent=function(e){const{componentId:t,...s}=n,r=t&&`${t}-${O(e)?e:N(x(e))}`;return Ge(e,{...s,attrs:p,componentId:r},o)},Object.defineProperty(_,"defaultProps",{get(){return this._foldedDefaultProps},set(e){this._foldedDefaultProps=s?function(e={},...t){for(const n of t)X(e,n,!0);return e}({},r.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(y(d,h),_.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={}}}})(d,h)),_.toString=()=>`.${_.styledComponentId}`,l&&W(_,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),_}function Fe(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 qe=e=>(Array.isArray(e)&&(e.isCss=!0),e);function Ye(e,...t){if(Oe(e)||J(e))return qe(Te(Fe(g,[e,...t])));const n=e;return 0===t.length&&1===n.length&&"string"==typeof n[0]?n:qe(Te(Fe(n,t)))}function He(e,t,n=S){if(!t)throw K(1,t);const o=(o,...s)=>e(t,n,Ye(o,...s));return o.attrs=o=>He(e,t,{...n,attrs:Array.prototype.concat(n.attrs,o).filter(Boolean)}),o.withConfig=o=>He(e,t,{...n,...o}),o}const We=e=>He(Ge,e),Ue=We;w.forEach((e=>{Ue[e]=We(e)}));class Je{componentId;isStatic;rules;constructor(e,t){this.rules=e,this.componentId=t,this.isStatic=je(e),pe.registerId(this.componentId+1)}createStyles(e,t,n,o){const s=o(Te(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&&pe.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,o)}}const Xe={StyleSheet:pe,mainSheet:we};"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&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window["__styled-components-init__"]||=0,1===window["__styled-components-init__"]&&console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."),window["__styled-components-init__"]+=1),exports.ServerStyleSheet=class{instance;sealed;constructor(){this.instance=new pe({isServer:!0}),this.sealed=!1}_emitSheetCSS=()=>{const e=this.instance.toString(),t=ce();return`<style ${[t&&`nonce="${t}"`,`${u}="true"`,'data-styled-version="6.0.0-alpha.7"'].filter(Boolean).join(" ")}>${e}</style>`};collectStyles(e){if(this.sealed)throw K(2);return a.default.createElement(_e,{sheet:this.instance},e)}getStyleTags=()=>{if(this.sealed)throw K(2);return this._emitSheetCSS()};getStyleElement=()=>{if(this.sealed)throw K(2);const e={[u]:"","data-styled-version":"6.0.0-alpha.7",dangerouslySetInnerHTML:{__html:this.instance.toString()}},t=ce();return t&&(e.nonce=t),[a.default.createElement("style",{...e,key:"sc-0-0"})]};interleaveWithNodeStream(e){throw K(3)}seal=()=>{this.sealed=!0}},exports.StyleSheetConsumer=Se,exports.StyleSheetContext=ge,exports.StyleSheetManager=_e,exports.ThemeConsumer=ze,exports.ThemeContext=Me,exports.ThemeProvider=function(e){const n=t.useContext(Me),o=t.useMemo((()=>function(e,t){if(!e)throw K(14);if(Oe(e)){const n=e(t);if("production"!==process.env.NODE_ENV&&(null===n||Array.isArray(n)||"object"!=typeof n))throw K(7);return n}if(Array.isArray(e)||"object"!=typeof e)throw K(8);return t?{...t,...e}:e}(e.theme,n)),[e.theme,n]);return e.children?a.default.createElement(Me.Provider,{value:o},e.children):null},exports.__PRIVATE__=Xe,exports.createGlobalStyle=function(e,...t){const n=Ye(e,...t),o=`sc-global-${I(JSON.stringify(n))}`,s=new Je(n,o);"production"!==process.env.NODE_ENV&&y(o);const r=e=>{const t=Ee(),r=Ne(),l=a.default.useContext(Me),c=a.default.useRef(t.allocateGSInstance(o)).current;return"production"!==process.env.NODE_ENV&&a.default.Children.count(e.children)&&console.warn(`The global style component ${o} was given child JSX. createGlobalStyle does not render children.`),"production"!==process.env.NODE_ENV&&n.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."),t.server&&i(c,e,t,l,r),(a.default.useInsertionEffect||a.default.useLayoutEffect)((()=>{if(!t.server)return i(c,e,t,l,r),()=>s.removeStyles(c,t)}),[c,e,t,l,r]),null};function i(e,t,n,o,i){if(s.isStatic)s.renderStyles(e,p,n,i);else{const a={...t,theme:v(t,o,r.defaultProps)};s.renderStyles(e,a,n,i)}}return a.default.memo(r)},exports.css=Ye,exports.default=Ue,exports.isStyledComponent=U,exports.keyframes=function(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=Ye(e,...t).join(""),o=I(n);return new Ce(o,n)},exports.useTheme=()=>t.useContext(Me),exports.version="6.0.0-alpha.7",exports.withTheme=function(e){const t=a.default.forwardRef(((t,n)=>{const o=v(t,a.default.useContext(Me),e.defaultProps);return"production"!==process.env.NODE_ENV&&void 0===o&&console.warn(`[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class "${x(e)}"`),a.default.createElement(e,{...t,theme:o,ref:n})}));return t.displayName=`WithTheme(${x(e)})`,W(t,e)};
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var shallowequal = require('shallowequal');
|
|
8
|
+
var stylis = require('stylis');
|
|
9
|
+
var unitless = require('@emotion/unitless');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
+
var shallowequal__default = /*#__PURE__*/_interopDefaultLegacy(shallowequal);
|
|
15
|
+
var unitless__default = /*#__PURE__*/_interopDefaultLegacy(unitless);
|
|
16
|
+
|
|
17
|
+
var SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
|
|
18
|
+
'data-styled';
|
|
19
|
+
var SC_ATTR_ACTIVE = 'active';
|
|
20
|
+
var SC_ATTR_VERSION = 'data-styled-version';
|
|
21
|
+
var SC_VERSION = "6.0.0-beta.2";
|
|
22
|
+
var SPLITTER = '/*!sc*/\n';
|
|
23
|
+
var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
|
|
24
|
+
var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
|
|
25
|
+
? SC_DISABLE_SPEEDY
|
|
26
|
+
: typeof process !== 'undefined' &&
|
|
27
|
+
typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' &&
|
|
28
|
+
process.env.REACT_APP_SC_DISABLE_SPEEDY !== ''
|
|
29
|
+
? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false'
|
|
30
|
+
? false
|
|
31
|
+
: process.env.REACT_APP_SC_DISABLE_SPEEDY
|
|
32
|
+
: typeof process !== 'undefined' &&
|
|
33
|
+
typeof process.env.SC_DISABLE_SPEEDY !== 'undefined' &&
|
|
34
|
+
process.env.SC_DISABLE_SPEEDY !== ''
|
|
35
|
+
? process.env.SC_DISABLE_SPEEDY === 'false'
|
|
36
|
+
? false
|
|
37
|
+
: process.env.SC_DISABLE_SPEEDY
|
|
38
|
+
: process.env.NODE_ENV !== 'production');
|
|
39
|
+
// Shared empty execution context when generating static styles
|
|
40
|
+
var STATIC_EXECUTION_CONTEXT = {};
|
|
41
|
+
|
|
42
|
+
var invalidHookCallRe = /invalid hook call/i;
|
|
43
|
+
var seen = new Set();
|
|
44
|
+
var checkDynamicCreation = function (displayName, componentId) {
|
|
45
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
46
|
+
var parsedIdString = componentId ? " with the id of \"".concat(componentId, "\"") : '';
|
|
47
|
+
var message_1 = "The component ".concat(displayName).concat(parsedIdString, " has been created dynamically.\n") +
|
|
48
|
+
"You may see this warning because you've called styled inside another component.\n" +
|
|
49
|
+
'To resolve this only create new StyledComponents outside of any render method and function component.';
|
|
50
|
+
// If a hook is called outside of a component:
|
|
51
|
+
// React 17 and earlier throw an error
|
|
52
|
+
// React 18 and above use console.error
|
|
53
|
+
var originalConsoleError_1 = console.error;
|
|
54
|
+
try {
|
|
55
|
+
var didNotCallInvalidHook_1 = true;
|
|
56
|
+
console.error = function (consoleErrorMessage) {
|
|
57
|
+
var consoleErrorArgs = [];
|
|
58
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
59
|
+
consoleErrorArgs[_i - 1] = arguments[_i];
|
|
60
|
+
}
|
|
61
|
+
// The error here is expected, since we're expecting anything that uses `checkDynamicCreation` to
|
|
62
|
+
// be called outside of a React component.
|
|
63
|
+
if (invalidHookCallRe.test(consoleErrorMessage)) {
|
|
64
|
+
didNotCallInvalidHook_1 = false;
|
|
65
|
+
// This shouldn't happen, but resets `warningSeen` if we had this error happen intermittently
|
|
66
|
+
seen.delete(message_1);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
originalConsoleError_1.apply(void 0, tslib.__spreadArray([consoleErrorMessage], consoleErrorArgs, false));
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
// We purposefully call `useRef` outside of a component and expect it to throw
|
|
73
|
+
// If it doesn't, then we're inside another component.
|
|
74
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
75
|
+
React.useRef();
|
|
76
|
+
if (didNotCallInvalidHook_1 && !seen.has(message_1)) {
|
|
77
|
+
// eslint-disable-next-line no-console
|
|
78
|
+
console.warn(message_1);
|
|
79
|
+
seen.add(message_1);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
// The error here is expected, since we're expecting anything that uses `checkDynamicCreation` to
|
|
84
|
+
// be called outside of a React component.
|
|
85
|
+
if (invalidHookCallRe.test(error.message)) {
|
|
86
|
+
// This shouldn't happen, but resets `warningSeen` if we had this error happen intermittently
|
|
87
|
+
seen.delete(message_1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
console.error = originalConsoleError_1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
var LIMIT = 200;
|
|
97
|
+
var createWarnTooManyClasses = (function (displayName, componentId) {
|
|
98
|
+
var generatedClasses = {};
|
|
99
|
+
var warningSeen = false;
|
|
100
|
+
return function (className) {
|
|
101
|
+
if (!warningSeen) {
|
|
102
|
+
generatedClasses[className] = true;
|
|
103
|
+
if (Object.keys(generatedClasses).length >= LIMIT) {
|
|
104
|
+
// Unable to find latestRule in test environment.
|
|
105
|
+
/* eslint-disable no-console, prefer-template */
|
|
106
|
+
var parsedIdString = componentId ? " with the id of \"".concat(componentId, "\"") : '';
|
|
107
|
+
console.warn("Over ".concat(LIMIT, " classes were generated for component ").concat(displayName).concat(parsedIdString, ".\n") +
|
|
108
|
+
'Consider using the attrs method, together with a style object for frequently changed styles.\n' +
|
|
109
|
+
'Example:\n' +
|
|
110
|
+
' const Component = styled.div.attrs(props => ({\n' +
|
|
111
|
+
' style: {\n' +
|
|
112
|
+
' background: props.background,\n' +
|
|
113
|
+
' },\n' +
|
|
114
|
+
' }))`width: 100%;`\n\n' +
|
|
115
|
+
' <Component />');
|
|
116
|
+
warningSeen = true;
|
|
117
|
+
generatedClasses = {};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
var EMPTY_ARRAY = Object.freeze([]);
|
|
124
|
+
var EMPTY_OBJECT = Object.freeze({});
|
|
125
|
+
|
|
126
|
+
function determineTheme(props, providedTheme, defaultProps) {
|
|
127
|
+
if (defaultProps === void 0) { defaultProps = EMPTY_OBJECT; }
|
|
128
|
+
return (props.theme !== defaultProps.theme && props.theme) || providedTheme || defaultProps.theme;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Thanks to ReactDOMFactories for this handy list!
|
|
132
|
+
var domElements = [
|
|
133
|
+
'a',
|
|
134
|
+
'abbr',
|
|
135
|
+
'address',
|
|
136
|
+
'area',
|
|
137
|
+
'article',
|
|
138
|
+
'aside',
|
|
139
|
+
'audio',
|
|
140
|
+
'b',
|
|
141
|
+
'base',
|
|
142
|
+
'bdi',
|
|
143
|
+
'bdo',
|
|
144
|
+
'big',
|
|
145
|
+
'blockquote',
|
|
146
|
+
'body',
|
|
147
|
+
'br',
|
|
148
|
+
'button',
|
|
149
|
+
'canvas',
|
|
150
|
+
'caption',
|
|
151
|
+
'cite',
|
|
152
|
+
'code',
|
|
153
|
+
'col',
|
|
154
|
+
'colgroup',
|
|
155
|
+
'data',
|
|
156
|
+
'datalist',
|
|
157
|
+
'dd',
|
|
158
|
+
'del',
|
|
159
|
+
'details',
|
|
160
|
+
'dfn',
|
|
161
|
+
'dialog',
|
|
162
|
+
'div',
|
|
163
|
+
'dl',
|
|
164
|
+
'dt',
|
|
165
|
+
'em',
|
|
166
|
+
'embed',
|
|
167
|
+
'fieldset',
|
|
168
|
+
'figcaption',
|
|
169
|
+
'figure',
|
|
170
|
+
'footer',
|
|
171
|
+
'form',
|
|
172
|
+
'h1',
|
|
173
|
+
'h2',
|
|
174
|
+
'h3',
|
|
175
|
+
'h4',
|
|
176
|
+
'h5',
|
|
177
|
+
'h6',
|
|
178
|
+
'head',
|
|
179
|
+
'header',
|
|
180
|
+
'hgroup',
|
|
181
|
+
'hr',
|
|
182
|
+
'html',
|
|
183
|
+
'i',
|
|
184
|
+
'iframe',
|
|
185
|
+
'img',
|
|
186
|
+
'input',
|
|
187
|
+
'ins',
|
|
188
|
+
'kbd',
|
|
189
|
+
'keygen',
|
|
190
|
+
'label',
|
|
191
|
+
'legend',
|
|
192
|
+
'li',
|
|
193
|
+
'link',
|
|
194
|
+
'main',
|
|
195
|
+
'map',
|
|
196
|
+
'mark',
|
|
197
|
+
'menu',
|
|
198
|
+
'menuitem',
|
|
199
|
+
'meta',
|
|
200
|
+
'meter',
|
|
201
|
+
'nav',
|
|
202
|
+
'noscript',
|
|
203
|
+
'object',
|
|
204
|
+
'ol',
|
|
205
|
+
'optgroup',
|
|
206
|
+
'option',
|
|
207
|
+
'output',
|
|
208
|
+
'p',
|
|
209
|
+
'param',
|
|
210
|
+
'picture',
|
|
211
|
+
'pre',
|
|
212
|
+
'progress',
|
|
213
|
+
'q',
|
|
214
|
+
'rp',
|
|
215
|
+
'rt',
|
|
216
|
+
'ruby',
|
|
217
|
+
's',
|
|
218
|
+
'samp',
|
|
219
|
+
'script',
|
|
220
|
+
'section',
|
|
221
|
+
'select',
|
|
222
|
+
'small',
|
|
223
|
+
'source',
|
|
224
|
+
'span',
|
|
225
|
+
'strong',
|
|
226
|
+
'style',
|
|
227
|
+
'sub',
|
|
228
|
+
'summary',
|
|
229
|
+
'sup',
|
|
230
|
+
'table',
|
|
231
|
+
'tbody',
|
|
232
|
+
'td',
|
|
233
|
+
'textarea',
|
|
234
|
+
'tfoot',
|
|
235
|
+
'th',
|
|
236
|
+
'thead',
|
|
237
|
+
'time',
|
|
238
|
+
'title',
|
|
239
|
+
'tr',
|
|
240
|
+
'track',
|
|
241
|
+
'u',
|
|
242
|
+
'ul',
|
|
243
|
+
'var',
|
|
244
|
+
'video',
|
|
245
|
+
'wbr',
|
|
246
|
+
'circle',
|
|
247
|
+
'clipPath',
|
|
248
|
+
'defs',
|
|
249
|
+
'ellipse',
|
|
250
|
+
'foreignObject',
|
|
251
|
+
'g',
|
|
252
|
+
'image',
|
|
253
|
+
'line',
|
|
254
|
+
'linearGradient',
|
|
255
|
+
'marker',
|
|
256
|
+
'mask',
|
|
257
|
+
'path',
|
|
258
|
+
'pattern',
|
|
259
|
+
'polygon',
|
|
260
|
+
'polyline',
|
|
261
|
+
'radialGradient',
|
|
262
|
+
'rect',
|
|
263
|
+
'stop',
|
|
264
|
+
'svg',
|
|
265
|
+
'text',
|
|
266
|
+
'tspan',
|
|
267
|
+
];
|
|
268
|
+
|
|
269
|
+
// Source: https://www.w3.org/TR/cssom-1/#serialize-an-identifier
|
|
270
|
+
// Control characters and non-letter first symbols are not supported
|
|
271
|
+
var escapeRegex = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g;
|
|
272
|
+
var dashesAtEnds = /(^-|-$)/g;
|
|
273
|
+
/**
|
|
274
|
+
* TODO: Explore using CSS.escape when it becomes more available
|
|
275
|
+
* in evergreen browsers.
|
|
276
|
+
*/
|
|
277
|
+
function escape(str) {
|
|
278
|
+
return str // Replace all possible CSS selectors
|
|
279
|
+
.replace(escapeRegex, '-') // Remove extraneous hyphens at the start and end
|
|
280
|
+
.replace(dashesAtEnds, '');
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
var AD_REPLACER_R = /(a)(d)/gi;
|
|
284
|
+
/* This is the "capacity" of our alphabet i.e. 2x26 for all letters plus their capitalised
|
|
285
|
+
* counterparts */
|
|
286
|
+
var charsLength = 52;
|
|
287
|
+
/* start at 75 for 'a' until 'z' (25) and then start at 65 for capitalised letters */
|
|
288
|
+
var getAlphabeticChar = function (code) { return String.fromCharCode(code + (code > 25 ? 39 : 97)); };
|
|
289
|
+
/* input a number, usually a hash and convert it to base-52 */
|
|
290
|
+
function generateAlphabeticName(code) {
|
|
291
|
+
var name = '';
|
|
292
|
+
var x;
|
|
293
|
+
/* get a char and divide by alphabet-length */
|
|
294
|
+
for (x = Math.abs(code); x > charsLength; x = (x / charsLength) | 0) {
|
|
295
|
+
name = getAlphabeticChar(x % charsLength) + name;
|
|
296
|
+
}
|
|
297
|
+
return (getAlphabeticChar(x % charsLength) + name).replace(AD_REPLACER_R, '$1-$2');
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
var SEED$1 = 5381;
|
|
301
|
+
// When we have separate strings it's useful to run a progressive
|
|
302
|
+
// version of djb2 where we pretend that we're still looping over
|
|
303
|
+
// the same string
|
|
304
|
+
var phash = function (h, x) {
|
|
305
|
+
var i = x.length;
|
|
306
|
+
while (i) {
|
|
307
|
+
h = (h * 33) ^ x.charCodeAt(--i);
|
|
308
|
+
}
|
|
309
|
+
return h;
|
|
310
|
+
};
|
|
311
|
+
// This is a djb2 hashing function
|
|
312
|
+
var hash = function (x) {
|
|
313
|
+
return phash(SEED$1, x);
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
function generateComponentId(str) {
|
|
317
|
+
return generateAlphabeticName(hash(str) >>> 0);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function getComponentName(target) {
|
|
321
|
+
return ((process.env.NODE_ENV !== 'production' ? typeof target === 'string' && target : false) ||
|
|
322
|
+
target.displayName ||
|
|
323
|
+
target.name ||
|
|
324
|
+
'Component');
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function isTag(target) {
|
|
328
|
+
return (typeof target === 'string' &&
|
|
329
|
+
(process.env.NODE_ENV !== 'production'
|
|
330
|
+
? target.charAt(0) === target.charAt(0).toLowerCase()
|
|
331
|
+
: true));
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function generateDisplayName(target) {
|
|
335
|
+
return isTag(target) ? "styled.".concat(target) : "Styled(".concat(getComponentName(target), ")");
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
var _a;
|
|
339
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
340
|
+
// copied from react-is
|
|
341
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
342
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
343
|
+
/**
|
|
344
|
+
* Adapted from hoist-non-react-statics to avoid the react-is dependency.
|
|
345
|
+
*/
|
|
346
|
+
var REACT_STATICS = {
|
|
347
|
+
childContextTypes: true,
|
|
348
|
+
contextType: true,
|
|
349
|
+
contextTypes: true,
|
|
350
|
+
defaultProps: true,
|
|
351
|
+
displayName: true,
|
|
352
|
+
getDefaultProps: true,
|
|
353
|
+
getDerivedStateFromError: true,
|
|
354
|
+
getDerivedStateFromProps: true,
|
|
355
|
+
mixins: true,
|
|
356
|
+
propTypes: true,
|
|
357
|
+
type: true,
|
|
358
|
+
};
|
|
359
|
+
var KNOWN_STATICS = {
|
|
360
|
+
name: true,
|
|
361
|
+
length: true,
|
|
362
|
+
prototype: true,
|
|
363
|
+
caller: true,
|
|
364
|
+
callee: true,
|
|
365
|
+
arguments: true,
|
|
366
|
+
arity: true,
|
|
367
|
+
};
|
|
368
|
+
var FORWARD_REF_STATICS = {
|
|
369
|
+
$$typeof: true,
|
|
370
|
+
render: true,
|
|
371
|
+
defaultProps: true,
|
|
372
|
+
displayName: true,
|
|
373
|
+
propTypes: true,
|
|
374
|
+
};
|
|
375
|
+
var MEMO_STATICS = {
|
|
376
|
+
$$typeof: true,
|
|
377
|
+
compare: true,
|
|
378
|
+
defaultProps: true,
|
|
379
|
+
displayName: true,
|
|
380
|
+
propTypes: true,
|
|
381
|
+
type: true,
|
|
382
|
+
};
|
|
383
|
+
var TYPE_STATICS = (_a = {},
|
|
384
|
+
_a[REACT_FORWARD_REF_TYPE] = FORWARD_REF_STATICS,
|
|
385
|
+
_a[REACT_MEMO_TYPE] = MEMO_STATICS,
|
|
386
|
+
_a);
|
|
387
|
+
// adapted from react-is
|
|
388
|
+
function isMemo(object) {
|
|
389
|
+
var $$typeofType = 'type' in object && object.type.$$typeof;
|
|
390
|
+
return $$typeofType === REACT_MEMO_TYPE;
|
|
391
|
+
}
|
|
392
|
+
function getStatics(component) {
|
|
393
|
+
// React v16.11 and below
|
|
394
|
+
if (isMemo(component)) {
|
|
395
|
+
return MEMO_STATICS;
|
|
396
|
+
}
|
|
397
|
+
// React v16.12 and above
|
|
398
|
+
return '$$typeof' in component
|
|
399
|
+
? TYPE_STATICS[component['$$typeof']]
|
|
400
|
+
: REACT_STATICS;
|
|
401
|
+
}
|
|
402
|
+
var defineProperty = Object.defineProperty;
|
|
403
|
+
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
404
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
405
|
+
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
406
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
407
|
+
var objectPrototype = Object.prototype;
|
|
408
|
+
function hoistNonReactStatics(targetComponent, sourceComponent, excludelist) {
|
|
409
|
+
if (typeof sourceComponent !== 'string') {
|
|
410
|
+
// don't hoist over string (html) components
|
|
411
|
+
if (objectPrototype) {
|
|
412
|
+
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
413
|
+
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
414
|
+
hoistNonReactStatics(targetComponent, inheritedComponent, excludelist);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
var keys = getOwnPropertyNames(sourceComponent);
|
|
418
|
+
if (getOwnPropertySymbols) {
|
|
419
|
+
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
|
420
|
+
}
|
|
421
|
+
var targetStatics = getStatics(targetComponent);
|
|
422
|
+
var sourceStatics = getStatics(sourceComponent);
|
|
423
|
+
for (var i = 0; i < keys.length; ++i) {
|
|
424
|
+
var key = keys[i];
|
|
425
|
+
if (!(key in KNOWN_STATICS) &&
|
|
426
|
+
!(excludelist && excludelist[key]) &&
|
|
427
|
+
!(sourceStatics && key in sourceStatics) &&
|
|
428
|
+
!(targetStatics && key in targetStatics)) {
|
|
429
|
+
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
430
|
+
try {
|
|
431
|
+
// Avoid failures from read-only properties
|
|
432
|
+
defineProperty(targetComponent, key, descriptor);
|
|
433
|
+
}
|
|
434
|
+
catch (e) {
|
|
435
|
+
/* ignore */
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return targetComponent;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function isStyledComponent(target) {
|
|
444
|
+
return typeof target === 'object' && 'styledComponentId' in target;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Convenience function for joining strings to form className chains
|
|
449
|
+
*/
|
|
450
|
+
function joinStrings(a, b) {
|
|
451
|
+
return a && b ? "".concat(a, " ").concat(b) : a || b;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function isPlainObject(x) {
|
|
455
|
+
return (x !== null &&
|
|
456
|
+
typeof x === 'object' &&
|
|
457
|
+
/* a check for empty prototype would be more typical, but that
|
|
458
|
+
doesn't play well with objects created in different vm contexts */
|
|
459
|
+
(!x.constructor || x.constructor.name === 'Object') &&
|
|
460
|
+
(x.toString ? x.toString() : Object.prototype.toString.call(x)) === '[object Object]' &&
|
|
461
|
+
/* check for reasonable markers that the object isn't an element for react & preact/compat */
|
|
462
|
+
!('props' in x && (x.$$typeof || x.constructor === undefined)));
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
function mixinRecursively(target, source, forceMerge) {
|
|
466
|
+
if (forceMerge === void 0) { forceMerge = false; }
|
|
467
|
+
/* only merge into POJOs, Arrays, but for top level objects only
|
|
468
|
+
* allow to merge into anything by passing forceMerge = true */
|
|
469
|
+
if (!forceMerge && !isPlainObject(target) && !Array.isArray(target)) {
|
|
470
|
+
return source;
|
|
471
|
+
}
|
|
472
|
+
if (Array.isArray(source)) {
|
|
473
|
+
for (var key = 0; key < source.length; key++) {
|
|
474
|
+
target[key] = mixinRecursively(target[key], source[key]);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
else if (isPlainObject(source)) {
|
|
478
|
+
for (var key in source) {
|
|
479
|
+
target[key] = mixinRecursively(target[key], source[key]);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return target;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Arrays & POJOs merged recursively, other objects and value types are overridden
|
|
486
|
+
* If target is not a POJO or an Array, it will get source properties injected via shallow merge
|
|
487
|
+
* Source objects applied left to right. Mutates & returns target. Similar to lodash merge.
|
|
488
|
+
*/
|
|
489
|
+
function mixinDeep(target) {
|
|
490
|
+
if (target === void 0) { target = {}; }
|
|
491
|
+
var sources = [];
|
|
492
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
493
|
+
sources[_i - 1] = arguments[_i];
|
|
494
|
+
}
|
|
495
|
+
for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
|
|
496
|
+
var source = sources_1[_a];
|
|
497
|
+
mixinRecursively(target, source, true);
|
|
498
|
+
}
|
|
499
|
+
return target;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
var errorMap = {
|
|
503
|
+
'1': 'Cannot create styled-component for component: %s.\n\n',
|
|
504
|
+
'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",
|
|
505
|
+
'3': 'Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n',
|
|
506
|
+
'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',
|
|
507
|
+
'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',
|
|
508
|
+
'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",
|
|
509
|
+
'7': 'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',
|
|
510
|
+
'8': 'ThemeProvider: Please make your "theme" prop an object.\n\n',
|
|
511
|
+
'9': 'Missing document `<head>`\n\n',
|
|
512
|
+
'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',
|
|
513
|
+
'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',
|
|
514
|
+
'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',
|
|
515
|
+
'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',
|
|
516
|
+
'14': 'ThemeProvider: "theme" prop is required.\n\n',
|
|
517
|
+
'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",
|
|
518
|
+
'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",
|
|
519
|
+
'17': "CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
var ERRORS = process.env.NODE_ENV !== 'production' ? errorMap : {};
|
|
523
|
+
/**
|
|
524
|
+
* super basic version of sprintf
|
|
525
|
+
*/
|
|
526
|
+
function format() {
|
|
527
|
+
var args = [];
|
|
528
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
529
|
+
args[_i] = arguments[_i];
|
|
530
|
+
}
|
|
531
|
+
var a = args[0];
|
|
532
|
+
var b = [];
|
|
533
|
+
for (var c = 1, len = args.length; c < len; c += 1) {
|
|
534
|
+
b.push(args[c]);
|
|
535
|
+
}
|
|
536
|
+
b.forEach(function (d) {
|
|
537
|
+
a = a.replace(/%[a-z]/, d);
|
|
538
|
+
});
|
|
539
|
+
return a;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Create an error file out of errors.md for development and a simple web link to the full errors
|
|
543
|
+
* in production mode.
|
|
544
|
+
*/
|
|
545
|
+
function throwStyledComponentsError(code) {
|
|
546
|
+
var interpolations = [];
|
|
547
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
548
|
+
interpolations[_i - 1] = arguments[_i];
|
|
549
|
+
}
|
|
550
|
+
if (process.env.NODE_ENV === 'production') {
|
|
551
|
+
return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(code, " for more information.").concat(interpolations.length > 0 ? " Args: ".concat(interpolations.join(', ')) : ''));
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
return new Error(format.apply(void 0, tslib.__spreadArray([ERRORS[code]], interpolations, false)).trim());
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/** Create a GroupedTag with an underlying Tag implementation */
|
|
559
|
+
var makeGroupedTag = function (tag) {
|
|
560
|
+
return new DefaultGroupedTag(tag);
|
|
561
|
+
};
|
|
562
|
+
var BASE_SIZE = 1 << 9;
|
|
563
|
+
var DefaultGroupedTag = /** @class */ (function () {
|
|
564
|
+
function DefaultGroupedTag(tag) {
|
|
565
|
+
this.groupSizes = new Uint32Array(BASE_SIZE);
|
|
566
|
+
this.length = BASE_SIZE;
|
|
567
|
+
this.tag = tag;
|
|
568
|
+
}
|
|
569
|
+
DefaultGroupedTag.prototype.indexOfGroup = function (group) {
|
|
570
|
+
var index = 0;
|
|
571
|
+
for (var i = 0; i < group; i++) {
|
|
572
|
+
index += this.groupSizes[i];
|
|
573
|
+
}
|
|
574
|
+
return index;
|
|
575
|
+
};
|
|
576
|
+
DefaultGroupedTag.prototype.insertRules = function (group, rules) {
|
|
577
|
+
if (group >= this.groupSizes.length) {
|
|
578
|
+
var oldBuffer = this.groupSizes;
|
|
579
|
+
var oldSize = oldBuffer.length;
|
|
580
|
+
var newSize = oldSize;
|
|
581
|
+
while (group >= newSize) {
|
|
582
|
+
newSize <<= 1;
|
|
583
|
+
if (newSize < 0) {
|
|
584
|
+
throw throwStyledComponentsError(16, "".concat(group));
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
this.groupSizes = new Uint32Array(newSize);
|
|
588
|
+
this.groupSizes.set(oldBuffer);
|
|
589
|
+
this.length = newSize;
|
|
590
|
+
for (var i = oldSize; i < newSize; i++) {
|
|
591
|
+
this.groupSizes[i] = 0;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
var ruleIndex = this.indexOfGroup(group + 1);
|
|
595
|
+
if (Array.isArray(rules)) {
|
|
596
|
+
for (var i = 0, l = rules.length; i < l; i++) {
|
|
597
|
+
if (this.tag.insertRule(ruleIndex, rules[i])) {
|
|
598
|
+
this.groupSizes[group]++;
|
|
599
|
+
ruleIndex++;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
if (this.tag.insertRule(ruleIndex, rules)) {
|
|
605
|
+
this.groupSizes[group]++;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
DefaultGroupedTag.prototype.clearGroup = function (group) {
|
|
610
|
+
if (group < this.length) {
|
|
611
|
+
var length_1 = this.groupSizes[group];
|
|
612
|
+
var startIndex = this.indexOfGroup(group);
|
|
613
|
+
var endIndex = startIndex + length_1;
|
|
614
|
+
this.groupSizes[group] = 0;
|
|
615
|
+
for (var i = startIndex; i < endIndex; i++) {
|
|
616
|
+
this.tag.deleteRule(startIndex);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
DefaultGroupedTag.prototype.getGroup = function (group) {
|
|
621
|
+
var css = '';
|
|
622
|
+
if (group >= this.length || this.groupSizes[group] === 0) {
|
|
623
|
+
return css;
|
|
624
|
+
}
|
|
625
|
+
var length = this.groupSizes[group];
|
|
626
|
+
var startIndex = this.indexOfGroup(group);
|
|
627
|
+
var endIndex = startIndex + length;
|
|
628
|
+
for (var i = startIndex; i < endIndex; i++) {
|
|
629
|
+
css += "".concat(this.tag.getRule(i)).concat(SPLITTER);
|
|
630
|
+
}
|
|
631
|
+
return css;
|
|
632
|
+
};
|
|
633
|
+
return DefaultGroupedTag;
|
|
634
|
+
}());
|
|
635
|
+
|
|
636
|
+
var MAX_SMI = 1 << (31 - 1);
|
|
637
|
+
var groupIDRegister = new Map();
|
|
638
|
+
var reverseRegister = new Map();
|
|
639
|
+
var nextFreeGroup = 1;
|
|
640
|
+
var getGroupForId = function (id) {
|
|
641
|
+
if (groupIDRegister.has(id)) {
|
|
642
|
+
return groupIDRegister.get(id);
|
|
643
|
+
}
|
|
644
|
+
while (reverseRegister.has(nextFreeGroup)) {
|
|
645
|
+
nextFreeGroup++;
|
|
646
|
+
}
|
|
647
|
+
var group = nextFreeGroup++;
|
|
648
|
+
if (process.env.NODE_ENV !== 'production' && ((group | 0) < 0 || group > MAX_SMI)) {
|
|
649
|
+
throw throwStyledComponentsError(16, "".concat(group));
|
|
650
|
+
}
|
|
651
|
+
groupIDRegister.set(id, group);
|
|
652
|
+
reverseRegister.set(group, id);
|
|
653
|
+
return group;
|
|
654
|
+
};
|
|
655
|
+
var getIdForGroup = function (group) {
|
|
656
|
+
return reverseRegister.get(group);
|
|
657
|
+
};
|
|
658
|
+
var setGroupForId = function (id, group) {
|
|
659
|
+
groupIDRegister.set(id, group);
|
|
660
|
+
reverseRegister.set(group, id);
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
var SELECTOR = "style[".concat(SC_ATTR, "][").concat(SC_ATTR_VERSION, "=\"").concat(SC_VERSION, "\"]");
|
|
664
|
+
var MARKER_RE = new RegExp("^".concat(SC_ATTR, "\\.g(\\d+)\\[id=\"([\\w\\d-]+)\"\\].*?\"([^\"]*)"));
|
|
665
|
+
var outputSheet = function (sheet) {
|
|
666
|
+
var tag = sheet.getTag();
|
|
667
|
+
var length = tag.length;
|
|
668
|
+
var css = '';
|
|
669
|
+
var _loop_1 = function (group) {
|
|
670
|
+
var id = getIdForGroup(group);
|
|
671
|
+
if (id === undefined)
|
|
672
|
+
return "continue";
|
|
673
|
+
var names = sheet.names.get(id);
|
|
674
|
+
var rules = tag.getGroup(group);
|
|
675
|
+
if (names === undefined || rules.length === 0)
|
|
676
|
+
return "continue";
|
|
677
|
+
var selector = "".concat(SC_ATTR, ".g").concat(group, "[id=\"").concat(id, "\"]");
|
|
678
|
+
var content = '';
|
|
679
|
+
if (names !== undefined) {
|
|
680
|
+
names.forEach(function (name) {
|
|
681
|
+
if (name.length > 0) {
|
|
682
|
+
content += "".concat(name, ",");
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
// NOTE: It's easier to collect rules and have the marker
|
|
687
|
+
// after the actual rules to simplify the rehydration
|
|
688
|
+
css += "".concat(rules).concat(selector, "{content:\"").concat(content, "\"}").concat(SPLITTER);
|
|
689
|
+
};
|
|
690
|
+
for (var group = 0; group < length; group++) {
|
|
691
|
+
_loop_1(group);
|
|
692
|
+
}
|
|
693
|
+
return css;
|
|
694
|
+
};
|
|
695
|
+
var rehydrateNamesFromContent = function (sheet, id, content) {
|
|
696
|
+
var names = content.split(',');
|
|
697
|
+
var name;
|
|
698
|
+
for (var i = 0, l = names.length; i < l; i++) {
|
|
699
|
+
// eslint-disable-next-line
|
|
700
|
+
if ((name = names[i])) {
|
|
701
|
+
sheet.registerName(id, name);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
var rehydrateSheetFromTag = function (sheet, style) {
|
|
706
|
+
var _a;
|
|
707
|
+
var parts = ((_a = style.textContent) !== null && _a !== void 0 ? _a : '').split(SPLITTER);
|
|
708
|
+
var rules = [];
|
|
709
|
+
for (var i = 0, l = parts.length; i < l; i++) {
|
|
710
|
+
var part = parts[i].trim();
|
|
711
|
+
if (!part)
|
|
712
|
+
continue;
|
|
713
|
+
var marker = part.match(MARKER_RE);
|
|
714
|
+
if (marker) {
|
|
715
|
+
var group = parseInt(marker[1], 10) | 0;
|
|
716
|
+
var id = marker[2];
|
|
717
|
+
if (group !== 0) {
|
|
718
|
+
// Rehydrate componentId to group index mapping
|
|
719
|
+
setGroupForId(id, group);
|
|
720
|
+
// Rehydrate names and rules
|
|
721
|
+
// looks like: data-styled.g11[id="idA"]{content:"nameA,"}
|
|
722
|
+
rehydrateNamesFromContent(sheet, id, marker[3]);
|
|
723
|
+
sheet.getTag().insertRules(group, rules);
|
|
724
|
+
}
|
|
725
|
+
rules.length = 0;
|
|
726
|
+
}
|
|
727
|
+
else {
|
|
728
|
+
rules.push(part);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
var rehydrateSheet = function (sheet) {
|
|
733
|
+
var nodes = document.querySelectorAll(SELECTOR);
|
|
734
|
+
for (var i = 0, l = nodes.length; i < l; i++) {
|
|
735
|
+
var node = nodes[i];
|
|
736
|
+
if (node && node.getAttribute(SC_ATTR) !== SC_ATTR_ACTIVE) {
|
|
737
|
+
rehydrateSheetFromTag(sheet, node);
|
|
738
|
+
if (node.parentNode) {
|
|
739
|
+
node.parentNode.removeChild(node);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
function getNonce() {
|
|
746
|
+
return typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
var ELEMENT_TYPE = 1;
|
|
750
|
+
/* Node.ELEMENT_TYPE */
|
|
751
|
+
/** Find last style element if any inside target */
|
|
752
|
+
var findLastStyleTag = function (target) {
|
|
753
|
+
var childNodes = target.childNodes;
|
|
754
|
+
for (var i = childNodes.length; i >= 0; i--) {
|
|
755
|
+
var child = childNodes[i];
|
|
756
|
+
if (child && child.nodeType === ELEMENT_TYPE && child.hasAttribute(SC_ATTR)) {
|
|
757
|
+
return child;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return undefined;
|
|
761
|
+
};
|
|
762
|
+
/** Create a style element inside `target` or <head> after the last */
|
|
763
|
+
var makeStyleTag = function (target) {
|
|
764
|
+
var head = document.head;
|
|
765
|
+
var parent = target || head;
|
|
766
|
+
var style = document.createElement('style');
|
|
767
|
+
var prevStyle = findLastStyleTag(parent);
|
|
768
|
+
var nextSibling = prevStyle !== undefined ? prevStyle.nextSibling : null;
|
|
769
|
+
style.setAttribute(SC_ATTR, SC_ATTR_ACTIVE);
|
|
770
|
+
style.setAttribute(SC_ATTR_VERSION, SC_VERSION);
|
|
771
|
+
var nonce = getNonce();
|
|
772
|
+
if (nonce)
|
|
773
|
+
style.setAttribute('nonce', nonce);
|
|
774
|
+
parent.insertBefore(style, nextSibling);
|
|
775
|
+
return style;
|
|
776
|
+
};
|
|
777
|
+
/** Get the CSSStyleSheet instance for a given style element */
|
|
778
|
+
var getSheet = function (tag) {
|
|
779
|
+
if (tag.sheet) {
|
|
780
|
+
return tag.sheet;
|
|
781
|
+
}
|
|
782
|
+
// Avoid Firefox quirk where the style element might not have a sheet property
|
|
783
|
+
var styleSheets = document.styleSheets;
|
|
784
|
+
for (var i = 0, l = styleSheets.length; i < l; i++) {
|
|
785
|
+
var sheet = styleSheets[i];
|
|
786
|
+
if (sheet.ownerNode === tag) {
|
|
787
|
+
return sheet;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
throw throwStyledComponentsError(17);
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
/** Create a CSSStyleSheet-like tag depending on the environment */
|
|
794
|
+
var makeTag = function (_a) {
|
|
795
|
+
var isServer = _a.isServer, useCSSOMInjection = _a.useCSSOMInjection, target = _a.target;
|
|
796
|
+
if (isServer) {
|
|
797
|
+
return new VirtualTag(target);
|
|
798
|
+
}
|
|
799
|
+
else if (useCSSOMInjection) {
|
|
800
|
+
return new CSSOMTag(target);
|
|
801
|
+
}
|
|
802
|
+
else {
|
|
803
|
+
return new TextTag(target);
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
var CSSOMTag = /** @class */ (function () {
|
|
807
|
+
function CSSOMTag(target) {
|
|
808
|
+
var element = (this.element = makeStyleTag(target));
|
|
809
|
+
// Avoid Edge bug where empty style elements don't create sheets
|
|
810
|
+
element.appendChild(document.createTextNode(''));
|
|
811
|
+
this.sheet = getSheet(element);
|
|
812
|
+
this.length = 0;
|
|
813
|
+
}
|
|
814
|
+
CSSOMTag.prototype.insertRule = function (index, rule) {
|
|
815
|
+
try {
|
|
816
|
+
this.sheet.insertRule(rule, index);
|
|
817
|
+
this.length++;
|
|
818
|
+
return true;
|
|
819
|
+
}
|
|
820
|
+
catch (_error) {
|
|
821
|
+
return false;
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
CSSOMTag.prototype.deleteRule = function (index) {
|
|
825
|
+
this.sheet.deleteRule(index);
|
|
826
|
+
this.length--;
|
|
827
|
+
};
|
|
828
|
+
CSSOMTag.prototype.getRule = function (index) {
|
|
829
|
+
var rule = this.sheet.cssRules[index];
|
|
830
|
+
// Avoid IE11 quirk where cssText is inaccessible on some invalid rules
|
|
831
|
+
if (rule !== undefined && typeof rule.cssText === 'string') {
|
|
832
|
+
return rule.cssText;
|
|
833
|
+
}
|
|
834
|
+
else {
|
|
835
|
+
return '';
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
return CSSOMTag;
|
|
839
|
+
}());
|
|
840
|
+
/** A Tag that emulates the CSSStyleSheet API but uses text nodes */
|
|
841
|
+
var TextTag = /** @class */ (function () {
|
|
842
|
+
function TextTag(target) {
|
|
843
|
+
var element = (this.element = makeStyleTag(target));
|
|
844
|
+
this.nodes = element.childNodes;
|
|
845
|
+
this.length = 0;
|
|
846
|
+
}
|
|
847
|
+
TextTag.prototype.insertRule = function (index, rule) {
|
|
848
|
+
if (index <= this.length && index >= 0) {
|
|
849
|
+
var node = document.createTextNode(rule);
|
|
850
|
+
var refNode = this.nodes[index];
|
|
851
|
+
this.element.insertBefore(node, refNode || null);
|
|
852
|
+
this.length++;
|
|
853
|
+
return true;
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
return false;
|
|
857
|
+
}
|
|
858
|
+
};
|
|
859
|
+
TextTag.prototype.deleteRule = function (index) {
|
|
860
|
+
this.element.removeChild(this.nodes[index]);
|
|
861
|
+
this.length--;
|
|
862
|
+
};
|
|
863
|
+
TextTag.prototype.getRule = function (index) {
|
|
864
|
+
if (index < this.length) {
|
|
865
|
+
return this.nodes[index].textContent;
|
|
866
|
+
}
|
|
867
|
+
else {
|
|
868
|
+
return '';
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
|
+
return TextTag;
|
|
872
|
+
}());
|
|
873
|
+
/** A completely virtual (server-side) Tag that doesn't manipulate the DOM */
|
|
874
|
+
var VirtualTag = /** @class */ (function () {
|
|
875
|
+
function VirtualTag(_target) {
|
|
876
|
+
this.rules = [];
|
|
877
|
+
this.length = 0;
|
|
878
|
+
}
|
|
879
|
+
VirtualTag.prototype.insertRule = function (index, rule) {
|
|
880
|
+
if (index <= this.length) {
|
|
881
|
+
this.rules.splice(index, 0, rule);
|
|
882
|
+
this.length++;
|
|
883
|
+
return true;
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
return false;
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
VirtualTag.prototype.deleteRule = function (index) {
|
|
890
|
+
this.rules.splice(index, 1);
|
|
891
|
+
this.length--;
|
|
892
|
+
};
|
|
893
|
+
VirtualTag.prototype.getRule = function (index) {
|
|
894
|
+
if (index < this.length) {
|
|
895
|
+
return this.rules[index];
|
|
896
|
+
}
|
|
897
|
+
else {
|
|
898
|
+
return '';
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
return VirtualTag;
|
|
902
|
+
}());
|
|
903
|
+
|
|
904
|
+
var SHOULD_REHYDRATE = IS_BROWSER;
|
|
905
|
+
var defaultOptions = {
|
|
906
|
+
isServer: !IS_BROWSER,
|
|
907
|
+
useCSSOMInjection: !DISABLE_SPEEDY,
|
|
908
|
+
};
|
|
909
|
+
/** Contains the main stylesheet logic for stringification and caching */
|
|
910
|
+
var StyleSheet = /** @class */ (function () {
|
|
911
|
+
function StyleSheet(options, globalStyles, names) {
|
|
912
|
+
if (options === void 0) { options = EMPTY_OBJECT; }
|
|
913
|
+
if (globalStyles === void 0) { globalStyles = {}; }
|
|
914
|
+
this.options = tslib.__assign(tslib.__assign({}, defaultOptions), options);
|
|
915
|
+
this.gs = globalStyles;
|
|
916
|
+
this.names = new Map(names);
|
|
917
|
+
this.server = !!options.isServer;
|
|
918
|
+
// We rehydrate only once and use the sheet that is created first
|
|
919
|
+
if (!this.server && IS_BROWSER && SHOULD_REHYDRATE) {
|
|
920
|
+
SHOULD_REHYDRATE = false;
|
|
921
|
+
rehydrateSheet(this);
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
/** Register a group ID to give it an index */
|
|
925
|
+
StyleSheet.registerId = function (id) {
|
|
926
|
+
return getGroupForId(id);
|
|
927
|
+
};
|
|
928
|
+
StyleSheet.prototype.reconstructWithOptions = function (options, withNames) {
|
|
929
|
+
if (withNames === void 0) { withNames = true; }
|
|
930
|
+
return new StyleSheet(tslib.__assign(tslib.__assign({}, this.options), options), this.gs, (withNames && this.names) || undefined);
|
|
931
|
+
};
|
|
932
|
+
StyleSheet.prototype.allocateGSInstance = function (id) {
|
|
933
|
+
return (this.gs[id] = (this.gs[id] || 0) + 1);
|
|
934
|
+
};
|
|
935
|
+
/** Lazily initialises a GroupedTag for when it's actually needed */
|
|
936
|
+
StyleSheet.prototype.getTag = function () {
|
|
937
|
+
return this.tag || (this.tag = makeGroupedTag(makeTag(this.options)));
|
|
938
|
+
};
|
|
939
|
+
/** Check whether a name is known for caching */
|
|
940
|
+
StyleSheet.prototype.hasNameForId = function (id, name) {
|
|
941
|
+
return this.names.has(id) && this.names.get(id).has(name);
|
|
942
|
+
};
|
|
943
|
+
/** Mark a group's name as known for caching */
|
|
944
|
+
StyleSheet.prototype.registerName = function (id, name) {
|
|
945
|
+
getGroupForId(id);
|
|
946
|
+
if (!this.names.has(id)) {
|
|
947
|
+
var groupNames = new Set();
|
|
948
|
+
groupNames.add(name);
|
|
949
|
+
this.names.set(id, groupNames);
|
|
950
|
+
}
|
|
951
|
+
else {
|
|
952
|
+
this.names.get(id).add(name);
|
|
953
|
+
}
|
|
954
|
+
};
|
|
955
|
+
/** Insert new rules which also marks the name as known */
|
|
956
|
+
StyleSheet.prototype.insertRules = function (id, name, rules) {
|
|
957
|
+
this.registerName(id, name);
|
|
958
|
+
this.getTag().insertRules(getGroupForId(id), rules);
|
|
959
|
+
};
|
|
960
|
+
/** Clears all cached names for a given group ID */
|
|
961
|
+
StyleSheet.prototype.clearNames = function (id) {
|
|
962
|
+
if (this.names.has(id)) {
|
|
963
|
+
this.names.get(id).clear();
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
/** Clears all rules for a given group ID */
|
|
967
|
+
StyleSheet.prototype.clearRules = function (id) {
|
|
968
|
+
this.getTag().clearGroup(getGroupForId(id));
|
|
969
|
+
this.clearNames(id);
|
|
970
|
+
};
|
|
971
|
+
/** Clears the entire tag which deletes all rules but not its names */
|
|
972
|
+
StyleSheet.prototype.clearTag = function () {
|
|
973
|
+
// NOTE: This does not clear the names, since it's only used during SSR
|
|
974
|
+
// so that we can continuously output only new rules
|
|
975
|
+
this.tag = undefined;
|
|
976
|
+
};
|
|
977
|
+
/** Outputs the current sheet as a CSS string with markers for SSR */
|
|
978
|
+
StyleSheet.prototype.toString = function () {
|
|
979
|
+
return outputSheet(this);
|
|
980
|
+
};
|
|
981
|
+
return StyleSheet;
|
|
982
|
+
}());
|
|
983
|
+
|
|
984
|
+
var COMMENT_REGEX = /^\s*\/\/.*$/gm;
|
|
985
|
+
var COMPLEX_SELECTOR_PREFIX = [':', '[', '.', '#'];
|
|
986
|
+
/**
|
|
987
|
+
* Serialize stylis output as an array of css strings. It is important that rules are
|
|
988
|
+
* separated when using CSSOM injection.
|
|
989
|
+
*/
|
|
990
|
+
function serialize(children, callback) {
|
|
991
|
+
return children.map(function (c, i) { return callback(c, i, children, callback); }).filter(Boolean);
|
|
992
|
+
}
|
|
993
|
+
function createStylisInstance(_a) {
|
|
994
|
+
var _b = _a === void 0 ? EMPTY_OBJECT : _a, _c = _b.options, options = _c === void 0 ? EMPTY_OBJECT : _c, _d = _b.plugins, plugins = _d === void 0 ? EMPTY_ARRAY : _d;
|
|
995
|
+
var _componentId;
|
|
996
|
+
var _selector;
|
|
997
|
+
var _selectorRegexp;
|
|
998
|
+
var _consecutiveSelfRefRegExp;
|
|
999
|
+
var selfReferenceReplacer = function (match, offset, string) {
|
|
1000
|
+
if (
|
|
1001
|
+
// do not replace the first occurrence if it is complex (has a modifier)
|
|
1002
|
+
(offset === 0 ? !COMPLEX_SELECTOR_PREFIX.includes(string[_selector.length]) : true) && // no consecutive self refs (.b.b); that is a precedence boost and treated differently
|
|
1003
|
+
!string.match(_consecutiveSelfRefRegExp)) {
|
|
1004
|
+
return ".".concat(_componentId);
|
|
1005
|
+
}
|
|
1006
|
+
return match;
|
|
1007
|
+
};
|
|
1008
|
+
/**
|
|
1009
|
+
* When writing a style like
|
|
1010
|
+
*
|
|
1011
|
+
* & + & {
|
|
1012
|
+
* color: red;
|
|
1013
|
+
* }
|
|
1014
|
+
*
|
|
1015
|
+
* The second ampersand should be a reference to the static component class. stylis
|
|
1016
|
+
* has no knowledge of static class so we have to intelligently replace the base selector.
|
|
1017
|
+
*
|
|
1018
|
+
* https://github.com/thysultan/stylis.js/tree/v4.0.2#abstract-syntax-structure
|
|
1019
|
+
*/
|
|
1020
|
+
var selfReferenceReplacementPlugin = function (element) {
|
|
1021
|
+
if (element.type === stylis.RULESET && element.value.includes('&')) {
|
|
1022
|
+
var props = element.props;
|
|
1023
|
+
props[0] = props[0].replace(_selectorRegexp, selfReferenceReplacer);
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
var stringifyRules = function (css, selector, prefix, componentId) {
|
|
1027
|
+
if (selector === void 0) { selector = ''; }
|
|
1028
|
+
if (prefix === void 0) { prefix = ''; }
|
|
1029
|
+
if (componentId === void 0) { componentId = '&'; }
|
|
1030
|
+
var flatCSS = css.replace(COMMENT_REGEX, '');
|
|
1031
|
+
// stylis has no concept of state to be passed to plugins
|
|
1032
|
+
// but since JS is single-threaded, we can rely on that to ensure
|
|
1033
|
+
// these properties stay in sync with the current stylis run
|
|
1034
|
+
_componentId = componentId;
|
|
1035
|
+
_selector = selector;
|
|
1036
|
+
_selectorRegexp = new RegExp("\\".concat(_selector, "\\b"), 'g');
|
|
1037
|
+
_consecutiveSelfRefRegExp = new RegExp("(\\".concat(_selector, "\\b){2,}"));
|
|
1038
|
+
var middlewares = plugins.slice();
|
|
1039
|
+
if (options.prefix || options.prefix === undefined) {
|
|
1040
|
+
middlewares.unshift(stylis.prefixer);
|
|
1041
|
+
}
|
|
1042
|
+
middlewares.push(selfReferenceReplacementPlugin, stylis.stringify);
|
|
1043
|
+
return serialize(stylis.compile(prefix || selector ? "".concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }") : flatCSS), stylis.middleware(middlewares));
|
|
1044
|
+
};
|
|
1045
|
+
stringifyRules.hash = plugins.length
|
|
1046
|
+
? plugins
|
|
1047
|
+
.reduce(function (acc, plugin) {
|
|
1048
|
+
if (!plugin.name) {
|
|
1049
|
+
throwStyledComponentsError(15);
|
|
1050
|
+
}
|
|
1051
|
+
return phash(acc, plugin.name);
|
|
1052
|
+
}, SEED$1)
|
|
1053
|
+
.toString()
|
|
1054
|
+
: '';
|
|
1055
|
+
return stringifyRules;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
var StyleSheetContext = React__default["default"].createContext(undefined);
|
|
1059
|
+
var StyleSheetConsumer = StyleSheetContext.Consumer;
|
|
1060
|
+
var StylisContext = React__default["default"].createContext(undefined);
|
|
1061
|
+
StylisContext.Consumer;
|
|
1062
|
+
var mainSheet = new StyleSheet();
|
|
1063
|
+
var mainStylis = createStylisInstance();
|
|
1064
|
+
function useStyleSheet() {
|
|
1065
|
+
return React.useContext(StyleSheetContext) || mainSheet;
|
|
1066
|
+
}
|
|
1067
|
+
function useStylis() {
|
|
1068
|
+
return React.useContext(StylisContext) || mainStylis;
|
|
1069
|
+
}
|
|
1070
|
+
function StyleSheetManager(props) {
|
|
1071
|
+
var _a = React.useState(props.stylisPlugins), plugins = _a[0], setPlugins = _a[1];
|
|
1072
|
+
var contextStyleSheet = useStyleSheet();
|
|
1073
|
+
var styleSheet = React.useMemo(function () {
|
|
1074
|
+
var sheet = contextStyleSheet;
|
|
1075
|
+
if (props.sheet) {
|
|
1076
|
+
// eslint-disable-next-line prefer-destructuring
|
|
1077
|
+
sheet = props.sheet;
|
|
1078
|
+
}
|
|
1079
|
+
else if (props.target) {
|
|
1080
|
+
sheet = sheet.reconstructWithOptions({ target: props.target }, false);
|
|
1081
|
+
}
|
|
1082
|
+
if (props.disableCSSOMInjection) {
|
|
1083
|
+
sheet = sheet.reconstructWithOptions({ useCSSOMInjection: false });
|
|
1084
|
+
}
|
|
1085
|
+
return sheet;
|
|
1086
|
+
}, [props.disableCSSOMInjection, props.sheet, props.target]);
|
|
1087
|
+
var stylis = React.useMemo(function () {
|
|
1088
|
+
return createStylisInstance({
|
|
1089
|
+
options: { prefix: !props.disableVendorPrefixes },
|
|
1090
|
+
plugins: plugins,
|
|
1091
|
+
});
|
|
1092
|
+
}, [props.disableVendorPrefixes, plugins]);
|
|
1093
|
+
React.useEffect(function () {
|
|
1094
|
+
if (!shallowequal__default["default"](plugins, props.stylisPlugins))
|
|
1095
|
+
setPlugins(props.stylisPlugins);
|
|
1096
|
+
}, [props.stylisPlugins]);
|
|
1097
|
+
return (React__default["default"].createElement(StyleSheetContext.Provider, { value: styleSheet },
|
|
1098
|
+
React__default["default"].createElement(StylisContext.Provider, { value: stylis }, process.env.NODE_ENV !== 'production'
|
|
1099
|
+
? React__default["default"].Children.only(props.children)
|
|
1100
|
+
: props.children)));
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
var Keyframes = /** @class */ (function () {
|
|
1104
|
+
function Keyframes(name, rules) {
|
|
1105
|
+
var _this = this;
|
|
1106
|
+
this.inject = function (styleSheet, stylisInstance) {
|
|
1107
|
+
if (stylisInstance === void 0) { stylisInstance = mainStylis; }
|
|
1108
|
+
var resolvedName = _this.name + stylisInstance.hash;
|
|
1109
|
+
if (!styleSheet.hasNameForId(_this.id, resolvedName)) {
|
|
1110
|
+
styleSheet.insertRules(_this.id, resolvedName, stylisInstance(_this.rules, resolvedName, '@keyframes'));
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
this.toString = function () {
|
|
1114
|
+
throw throwStyledComponentsError(12, String(_this.name));
|
|
1115
|
+
};
|
|
1116
|
+
this.name = name;
|
|
1117
|
+
this.id = "sc-keyframes-".concat(name);
|
|
1118
|
+
this.rules = rules;
|
|
1119
|
+
}
|
|
1120
|
+
Keyframes.prototype.getName = function (stylisInstance) {
|
|
1121
|
+
if (stylisInstance === void 0) { stylisInstance = mainStylis; }
|
|
1122
|
+
return this.name + stylisInstance.hash;
|
|
1123
|
+
};
|
|
1124
|
+
return Keyframes;
|
|
1125
|
+
}());
|
|
1126
|
+
|
|
1127
|
+
// Taken from https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/shared/dangerousStyleValue.js
|
|
1128
|
+
function addUnitIfNeeded(name, value) {
|
|
1129
|
+
// https://github.com/amilajack/eslint-plugin-flowtype-errors/issues/133
|
|
1130
|
+
if (value == null || typeof value === 'boolean' || value === '') {
|
|
1131
|
+
return '';
|
|
1132
|
+
}
|
|
1133
|
+
if (typeof value === 'number' && value !== 0 && !(name in unitless__default["default"])) {
|
|
1134
|
+
return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers
|
|
1135
|
+
}
|
|
1136
|
+
return String(value).trim();
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* inlined version of
|
|
1141
|
+
* https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/hyphenateStyleName.js
|
|
1142
|
+
*/
|
|
1143
|
+
var uppercaseCheck = /([A-Z])/;
|
|
1144
|
+
var uppercasePattern = /([A-Z])/g;
|
|
1145
|
+
var msPattern = /^ms-/;
|
|
1146
|
+
var prefixAndLowerCase = function (char) { return "-".concat(char.toLowerCase()); };
|
|
1147
|
+
/**
|
|
1148
|
+
* Hyphenates a camelcased CSS property name, for example:
|
|
1149
|
+
*
|
|
1150
|
+
* > hyphenateStyleName('backgroundColor')
|
|
1151
|
+
* < "background-color"
|
|
1152
|
+
* > hyphenateStyleName('MozTransition')
|
|
1153
|
+
* < "-moz-transition"
|
|
1154
|
+
* > hyphenateStyleName('msTransition')
|
|
1155
|
+
* < "-ms-transition"
|
|
1156
|
+
*
|
|
1157
|
+
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
|
|
1158
|
+
* is converted to `-ms-`.
|
|
1159
|
+
*/
|
|
1160
|
+
function hyphenateStyleName(string) {
|
|
1161
|
+
return uppercaseCheck.test(string)
|
|
1162
|
+
? string.replace(uppercasePattern, prefixAndLowerCase).replace(msPattern, '-ms-')
|
|
1163
|
+
: string;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
function isFunction(test) {
|
|
1167
|
+
return typeof test === 'function';
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
function isStatelessFunction(test) {
|
|
1171
|
+
return typeof test === 'function' && !(test.prototype && test.prototype.isReactComponent);
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* It's falsish not falsy because 0 is allowed.
|
|
1176
|
+
*/
|
|
1177
|
+
var isFalsish = function (chunk) {
|
|
1178
|
+
return chunk === undefined || chunk === null || chunk === false || chunk === '';
|
|
1179
|
+
};
|
|
1180
|
+
var objToCssArray = function (obj, prevKey) {
|
|
1181
|
+
var rules = [];
|
|
1182
|
+
for (var key in obj) {
|
|
1183
|
+
if (!obj.hasOwnProperty(key) || isFalsish(obj[key]))
|
|
1184
|
+
continue;
|
|
1185
|
+
if ((Array.isArray(obj[key]) && obj[key].isCss) || isFunction(obj[key])) {
|
|
1186
|
+
rules.push("".concat(hyphenateStyleName(key), ":"), obj[key], ';');
|
|
1187
|
+
}
|
|
1188
|
+
else if (isPlainObject(obj[key])) {
|
|
1189
|
+
rules.push.apply(rules, objToCssArray(obj[key], key));
|
|
1190
|
+
}
|
|
1191
|
+
else {
|
|
1192
|
+
rules.push("".concat(hyphenateStyleName(key), ": ").concat(addUnitIfNeeded(key, obj[key]), ";"));
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
return prevKey ? tslib.__spreadArray(tslib.__spreadArray(["".concat(prevKey, " {")], rules, true), ['}'], false) : rules;
|
|
1196
|
+
};
|
|
1197
|
+
function flatten(chunk, executionContext, styleSheet, stylisInstance) {
|
|
1198
|
+
if (Array.isArray(chunk)) {
|
|
1199
|
+
var ruleSet = [];
|
|
1200
|
+
for (var i = 0, len = chunk.length, result = void 0; i < len; i += 1) {
|
|
1201
|
+
result = flatten(chunk[i], executionContext, styleSheet, stylisInstance);
|
|
1202
|
+
if (result === '')
|
|
1203
|
+
continue;
|
|
1204
|
+
else if (Array.isArray(result))
|
|
1205
|
+
ruleSet.push.apply(ruleSet, result);
|
|
1206
|
+
else
|
|
1207
|
+
ruleSet.push(result);
|
|
1208
|
+
}
|
|
1209
|
+
return ruleSet;
|
|
1210
|
+
}
|
|
1211
|
+
if (isFalsish(chunk)) {
|
|
1212
|
+
return '';
|
|
1213
|
+
}
|
|
1214
|
+
/* Handle other components */
|
|
1215
|
+
if (isStyledComponent(chunk)) {
|
|
1216
|
+
return ".".concat(chunk.styledComponentId);
|
|
1217
|
+
}
|
|
1218
|
+
/* Either execute or defer the function */
|
|
1219
|
+
if (isFunction(chunk)) {
|
|
1220
|
+
if (isStatelessFunction(chunk) && executionContext) {
|
|
1221
|
+
var chunkFn = chunk;
|
|
1222
|
+
var result = chunkFn(executionContext);
|
|
1223
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
1224
|
+
typeof result === 'object' &&
|
|
1225
|
+
!Array.isArray(result) &&
|
|
1226
|
+
!(result instanceof Keyframes) &&
|
|
1227
|
+
!isPlainObject(result)) {
|
|
1228
|
+
// eslint-disable-next-line no-console
|
|
1229
|
+
console.error("".concat(getComponentName(chunkFn), " 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."));
|
|
1230
|
+
}
|
|
1231
|
+
return flatten(result, executionContext, styleSheet, stylisInstance);
|
|
1232
|
+
}
|
|
1233
|
+
else
|
|
1234
|
+
return chunk;
|
|
1235
|
+
}
|
|
1236
|
+
if (chunk instanceof Keyframes) {
|
|
1237
|
+
if (styleSheet) {
|
|
1238
|
+
chunk.inject(styleSheet, stylisInstance);
|
|
1239
|
+
return chunk.getName(stylisInstance);
|
|
1240
|
+
}
|
|
1241
|
+
else
|
|
1242
|
+
return chunk;
|
|
1243
|
+
}
|
|
1244
|
+
/* Handle objects */
|
|
1245
|
+
return isPlainObject(chunk) ? objToCssArray(chunk) : chunk.toString();
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
function isStaticRules(rules) {
|
|
1249
|
+
for (var i = 0; i < rules.length; i += 1) {
|
|
1250
|
+
var rule = rules[i];
|
|
1251
|
+
if (isFunction(rule) &&
|
|
1252
|
+
!isStyledComponent(rule)) {
|
|
1253
|
+
// functions are allowed to be static if they're just being
|
|
1254
|
+
// used to get the classname of a nested styled component
|
|
1255
|
+
return false;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
return true;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
var SEED = hash(SC_VERSION);
|
|
1262
|
+
/**
|
|
1263
|
+
* ComponentStyle is all the CSS-specific stuff, not the React-specific stuff.
|
|
1264
|
+
*/
|
|
1265
|
+
var ComponentStyle = /** @class */ (function () {
|
|
1266
|
+
function ComponentStyle(rules, componentId, baseStyle) {
|
|
1267
|
+
this.names = [];
|
|
1268
|
+
this.rules = rules;
|
|
1269
|
+
this.staticRulesId = '';
|
|
1270
|
+
this.isStatic =
|
|
1271
|
+
process.env.NODE_ENV === 'production' &&
|
|
1272
|
+
(baseStyle === undefined || baseStyle.isStatic) &&
|
|
1273
|
+
isStaticRules(rules);
|
|
1274
|
+
this.componentId = componentId;
|
|
1275
|
+
// SC_VERSION gives us isolation between multiple runtimes on the page at once
|
|
1276
|
+
// this is improved further with use of the babel plugin "namespace" feature
|
|
1277
|
+
this.baseHash = phash(SEED, componentId);
|
|
1278
|
+
this.baseStyle = baseStyle;
|
|
1279
|
+
// NOTE: This registers the componentId, which ensures a consistent order
|
|
1280
|
+
// for this component's styles compared to others
|
|
1281
|
+
StyleSheet.registerId(componentId);
|
|
1282
|
+
}
|
|
1283
|
+
/*
|
|
1284
|
+
* Flattens a rule set into valid CSS
|
|
1285
|
+
* Hashes it, wraps the whole chunk in a .hash1234 {}
|
|
1286
|
+
* Returns the hash to be injected on render()
|
|
1287
|
+
* */
|
|
1288
|
+
ComponentStyle.prototype.generateAndInjectStyles = function (executionContext, styleSheet, stylis) {
|
|
1289
|
+
var componentId = this.componentId;
|
|
1290
|
+
this.names.length = 0;
|
|
1291
|
+
if (this.baseStyle) {
|
|
1292
|
+
this.names.push(this.baseStyle.generateAndInjectStyles(executionContext, styleSheet, stylis));
|
|
1293
|
+
}
|
|
1294
|
+
// force dynamic classnames if user-supplied stylis plugins are in use
|
|
1295
|
+
if (this.isStatic && !stylis.hash) {
|
|
1296
|
+
if (this.staticRulesId && styleSheet.hasNameForId(componentId, this.staticRulesId)) {
|
|
1297
|
+
this.names.push(this.staticRulesId);
|
|
1298
|
+
}
|
|
1299
|
+
else {
|
|
1300
|
+
var cssStatic = flatten(this.rules, executionContext, styleSheet, stylis).join('');
|
|
1301
|
+
var name_1 = generateAlphabeticName(phash(this.baseHash, cssStatic) >>> 0);
|
|
1302
|
+
if (!styleSheet.hasNameForId(componentId, name_1)) {
|
|
1303
|
+
var cssStaticFormatted = stylis(cssStatic, ".".concat(name_1), undefined, componentId);
|
|
1304
|
+
styleSheet.insertRules(componentId, name_1, cssStaticFormatted);
|
|
1305
|
+
}
|
|
1306
|
+
this.names.push(name_1);
|
|
1307
|
+
this.staticRulesId = name_1;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
else {
|
|
1311
|
+
var length_1 = this.rules.length;
|
|
1312
|
+
var dynamicHash = phash(this.baseHash, stylis.hash);
|
|
1313
|
+
var css = '';
|
|
1314
|
+
for (var i = 0; i < length_1; i++) {
|
|
1315
|
+
var partRule = this.rules[i];
|
|
1316
|
+
if (typeof partRule === 'string') {
|
|
1317
|
+
css += partRule;
|
|
1318
|
+
if (process.env.NODE_ENV !== 'production')
|
|
1319
|
+
dynamicHash = phash(dynamicHash, partRule);
|
|
1320
|
+
}
|
|
1321
|
+
else if (partRule) {
|
|
1322
|
+
var partChunk = flatten(partRule, executionContext, styleSheet, stylis);
|
|
1323
|
+
var partString = Array.isArray(partChunk) ? partChunk.join('') : partChunk;
|
|
1324
|
+
dynamicHash = phash(dynamicHash, partString);
|
|
1325
|
+
css += partString;
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
if (css) {
|
|
1329
|
+
var name_2 = generateAlphabeticName(dynamicHash >>> 0);
|
|
1330
|
+
if (!styleSheet.hasNameForId(componentId, name_2)) {
|
|
1331
|
+
var cssFormatted = stylis(css, ".".concat(name_2), undefined, componentId);
|
|
1332
|
+
styleSheet.insertRules(componentId, name_2, cssFormatted);
|
|
1333
|
+
}
|
|
1334
|
+
this.names.push(name_2);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
return this.names.join(' ');
|
|
1338
|
+
};
|
|
1339
|
+
return ComponentStyle;
|
|
1340
|
+
}());
|
|
1341
|
+
|
|
1342
|
+
var ThemeContext = React__default["default"].createContext(undefined);
|
|
1343
|
+
var ThemeConsumer = ThemeContext.Consumer;
|
|
1344
|
+
function mergeTheme(theme, outerTheme) {
|
|
1345
|
+
if (!theme) {
|
|
1346
|
+
throw throwStyledComponentsError(14);
|
|
1347
|
+
}
|
|
1348
|
+
if (isFunction(theme)) {
|
|
1349
|
+
var themeFn = theme;
|
|
1350
|
+
var mergedTheme = themeFn(outerTheme);
|
|
1351
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
1352
|
+
(mergedTheme === null || Array.isArray(mergedTheme) || typeof mergedTheme !== 'object')) {
|
|
1353
|
+
throw throwStyledComponentsError(7);
|
|
1354
|
+
}
|
|
1355
|
+
return mergedTheme;
|
|
1356
|
+
}
|
|
1357
|
+
if (Array.isArray(theme) || typeof theme !== 'object') {
|
|
1358
|
+
throw throwStyledComponentsError(8);
|
|
1359
|
+
}
|
|
1360
|
+
return outerTheme ? tslib.__assign(tslib.__assign({}, outerTheme), theme) : theme;
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* Provide a theme to an entire react component tree via context
|
|
1364
|
+
*/
|
|
1365
|
+
function ThemeProvider(props) {
|
|
1366
|
+
var outerTheme = React.useContext(ThemeContext);
|
|
1367
|
+
var themeContext = React.useMemo(function () { return mergeTheme(props.theme, outerTheme); }, [props.theme, outerTheme]);
|
|
1368
|
+
if (!props.children) {
|
|
1369
|
+
return null;
|
|
1370
|
+
}
|
|
1371
|
+
return React__default["default"].createElement(ThemeContext.Provider, { value: themeContext }, props.children);
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
var identifiers = {};
|
|
1375
|
+
/* We depend on components having unique IDs */
|
|
1376
|
+
function generateId(displayName, parentComponentId) {
|
|
1377
|
+
var name = typeof displayName !== 'string' ? 'sc' : escape(displayName);
|
|
1378
|
+
// Ensure that no displayName can lead to duplicate componentIds
|
|
1379
|
+
identifiers[name] = (identifiers[name] || 0) + 1;
|
|
1380
|
+
var componentId = "".concat(name, "-").concat(generateComponentId(
|
|
1381
|
+
// SC_VERSION gives us isolation between multiple runtimes on the page at once
|
|
1382
|
+
// this is improved further with use of the babel plugin "namespace" feature
|
|
1383
|
+
SC_VERSION + name + identifiers[name]));
|
|
1384
|
+
return parentComponentId ? "".concat(parentComponentId, "-").concat(componentId) : componentId;
|
|
1385
|
+
}
|
|
1386
|
+
function useResolvedAttrs(theme, props, attrs) {
|
|
1387
|
+
if (theme === void 0) { theme = EMPTY_OBJECT; }
|
|
1388
|
+
// NOTE: can't memoize this
|
|
1389
|
+
// returns [context, resolvedAttrs]
|
|
1390
|
+
// where resolvedAttrs is only the things injected by the attrs themselves
|
|
1391
|
+
var context = tslib.__assign(tslib.__assign({}, props), { theme: theme });
|
|
1392
|
+
attrs.forEach(function (attrDef) {
|
|
1393
|
+
// @ts-expect-error narrowing isn't working properly for some reason
|
|
1394
|
+
var resolvedAttrDef = typeof attrDef === 'function' ? attrDef(context) : attrDef;
|
|
1395
|
+
var key;
|
|
1396
|
+
/* eslint-disable guard-for-in */
|
|
1397
|
+
for (key in resolvedAttrDef) {
|
|
1398
|
+
// @ts-expect-error bad types
|
|
1399
|
+
context[key] =
|
|
1400
|
+
key === 'className'
|
|
1401
|
+
? joinStrings(context[key], resolvedAttrDef[key])
|
|
1402
|
+
: key === 'style'
|
|
1403
|
+
? tslib.__assign(tslib.__assign({}, context[key]), resolvedAttrDef[key]) : resolvedAttrDef[key];
|
|
1404
|
+
}
|
|
1405
|
+
/* eslint-enable guard-for-in */
|
|
1406
|
+
});
|
|
1407
|
+
return context;
|
|
1408
|
+
}
|
|
1409
|
+
function useInjectedStyle(componentStyle, isStatic, resolvedAttrs, warnTooManyClasses) {
|
|
1410
|
+
var styleSheet = useStyleSheet();
|
|
1411
|
+
var stylis = useStylis();
|
|
1412
|
+
var className = isStatic
|
|
1413
|
+
? componentStyle.generateAndInjectStyles(EMPTY_OBJECT, styleSheet, stylis)
|
|
1414
|
+
: componentStyle.generateAndInjectStyles(resolvedAttrs, styleSheet, stylis);
|
|
1415
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1416
|
+
if (process.env.NODE_ENV !== 'production')
|
|
1417
|
+
React.useDebugValue(className);
|
|
1418
|
+
if (process.env.NODE_ENV !== 'production' && !isStatic && warnTooManyClasses) {
|
|
1419
|
+
warnTooManyClasses(className);
|
|
1420
|
+
}
|
|
1421
|
+
return className;
|
|
1422
|
+
}
|
|
1423
|
+
function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStatic) {
|
|
1424
|
+
var componentAttrs = forwardedComponent.attrs, componentStyle = forwardedComponent.componentStyle, defaultProps = forwardedComponent.defaultProps, foldedComponentIds = forwardedComponent.foldedComponentIds, shouldForwardProp = forwardedComponent.shouldForwardProp, styledComponentId = forwardedComponent.styledComponentId, target = forwardedComponent.target;
|
|
1425
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1426
|
+
if (process.env.NODE_ENV !== 'production')
|
|
1427
|
+
React.useDebugValue(styledComponentId);
|
|
1428
|
+
// NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
|
|
1429
|
+
// but that'd be against the rules-of-hooks. We could be naughty and do it anyway as it
|
|
1430
|
+
// should be an immutable value, but behave for now.
|
|
1431
|
+
var theme = determineTheme(props, React.useContext(ThemeContext), defaultProps);
|
|
1432
|
+
var context = useResolvedAttrs(theme || EMPTY_OBJECT, props, componentAttrs);
|
|
1433
|
+
var generatedClassName = useInjectedStyle(componentStyle, isStatic, context, process.env.NODE_ENV !== 'production' ? forwardedComponent.warnTooManyClasses : undefined);
|
|
1434
|
+
var refToForward = forwardedRef;
|
|
1435
|
+
var elementToBeCreated = context.$as || context.as || target;
|
|
1436
|
+
var isTargetTag = isTag(elementToBeCreated);
|
|
1437
|
+
var propsForElement = {};
|
|
1438
|
+
// eslint-disable-next-line guard-for-in
|
|
1439
|
+
for (var key in context) {
|
|
1440
|
+
if (key[0] === '$' || key === 'as' || key === 'theme')
|
|
1441
|
+
continue;
|
|
1442
|
+
else if (key === 'forwardedAs') {
|
|
1443
|
+
propsForElement.as = context[key];
|
|
1444
|
+
}
|
|
1445
|
+
else if (shouldForwardProp ? shouldForwardProp(key, elementToBeCreated) : true) {
|
|
1446
|
+
// Don't pass through non HTML tags through to HTML elements
|
|
1447
|
+
propsForElement[key] = context[key];
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
propsForElement[
|
|
1451
|
+
// handle custom elements which React doesn't properly alias
|
|
1452
|
+
isTargetTag &&
|
|
1453
|
+
domElements.indexOf(elementToBeCreated) === -1
|
|
1454
|
+
? 'class'
|
|
1455
|
+
: 'className'] = foldedComponentIds
|
|
1456
|
+
.concat(styledComponentId, (generatedClassName !== styledComponentId ? generatedClassName : null), context.className)
|
|
1457
|
+
.filter(Boolean)
|
|
1458
|
+
.join(' ');
|
|
1459
|
+
propsForElement.ref = refToForward;
|
|
1460
|
+
return React.createElement(elementToBeCreated, propsForElement);
|
|
1461
|
+
}
|
|
1462
|
+
function createStyledComponent(target, options, rules) {
|
|
1463
|
+
var isTargetStyledComp = isStyledComponent(target);
|
|
1464
|
+
var styledComponentTarget = target;
|
|
1465
|
+
var isCompositeComponent = !isTag(target);
|
|
1466
|
+
var _a = options.attrs, attrs = _a === void 0 ? EMPTY_ARRAY : _a, _b = options.componentId, componentId = _b === void 0 ? generateId(options.displayName, options.parentComponentId) : _b, _c = options.displayName, displayName = _c === void 0 ? generateDisplayName(target) : _c;
|
|
1467
|
+
var styledComponentId = options.displayName && options.componentId
|
|
1468
|
+
? "".concat(escape(options.displayName), "-").concat(options.componentId)
|
|
1469
|
+
: options.componentId || componentId;
|
|
1470
|
+
// fold the underlying StyledComponent attrs up (implicit extend)
|
|
1471
|
+
var finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
|
|
1472
|
+
? styledComponentTarget.attrs.concat(attrs).filter(Boolean)
|
|
1473
|
+
: attrs;
|
|
1474
|
+
var shouldForwardProp = options.shouldForwardProp;
|
|
1475
|
+
if (isTargetStyledComp && styledComponentTarget.shouldForwardProp) {
|
|
1476
|
+
var shouldForwardPropFn_1 = styledComponentTarget.shouldForwardProp;
|
|
1477
|
+
if (options.shouldForwardProp) {
|
|
1478
|
+
var passedShouldForwardPropFn_1 = options.shouldForwardProp;
|
|
1479
|
+
// compose nested shouldForwardProp calls
|
|
1480
|
+
shouldForwardProp = function (prop, elementToBeCreated) {
|
|
1481
|
+
return shouldForwardPropFn_1(prop, elementToBeCreated) &&
|
|
1482
|
+
passedShouldForwardPropFn_1(prop, elementToBeCreated);
|
|
1483
|
+
};
|
|
1484
|
+
}
|
|
1485
|
+
else {
|
|
1486
|
+
shouldForwardProp = shouldForwardPropFn_1;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
var componentStyle = new ComponentStyle(rules, styledComponentId, isTargetStyledComp ? styledComponentTarget.componentStyle : undefined);
|
|
1490
|
+
// statically styled-components don't need to build an execution context object,
|
|
1491
|
+
// and shouldn't be increasing the number of class names
|
|
1492
|
+
var isStatic = componentStyle.isStatic && attrs.length === 0;
|
|
1493
|
+
function forwardRef(props, ref) {
|
|
1494
|
+
// eslint-disable-next-line
|
|
1495
|
+
return useStyledComponentImpl(WrappedStyledComponent, props, ref, isStatic);
|
|
1496
|
+
}
|
|
1497
|
+
forwardRef.displayName = displayName;
|
|
1498
|
+
/**
|
|
1499
|
+
* forwardRef creates a new interim component, which we'll take advantage of
|
|
1500
|
+
* instead of extending ParentComponent to create _another_ interim class
|
|
1501
|
+
*/
|
|
1502
|
+
var WrappedStyledComponent = React__default["default"].forwardRef(forwardRef);
|
|
1503
|
+
WrappedStyledComponent.attrs = finalAttrs;
|
|
1504
|
+
WrappedStyledComponent.componentStyle = componentStyle;
|
|
1505
|
+
WrappedStyledComponent.displayName = displayName;
|
|
1506
|
+
WrappedStyledComponent.shouldForwardProp = shouldForwardProp;
|
|
1507
|
+
// this static is used to preserve the cascade of static classes for component selector
|
|
1508
|
+
// purposes; this is especially important with usage of the css prop
|
|
1509
|
+
WrappedStyledComponent.foldedComponentIds = isTargetStyledComp
|
|
1510
|
+
? styledComponentTarget.foldedComponentIds.concat(styledComponentTarget.styledComponentId)
|
|
1511
|
+
: EMPTY_ARRAY;
|
|
1512
|
+
WrappedStyledComponent.styledComponentId = styledComponentId;
|
|
1513
|
+
// fold the underlying StyledComponent target up since we folded the styles
|
|
1514
|
+
WrappedStyledComponent.target = isTargetStyledComp ? styledComponentTarget.target : target;
|
|
1515
|
+
WrappedStyledComponent.withComponent = function withComponent(tag) {
|
|
1516
|
+
var previousComponentId = options.componentId, optionsToCopy = tslib.__rest(options, ["componentId"]);
|
|
1517
|
+
var newComponentId = previousComponentId &&
|
|
1518
|
+
"".concat(previousComponentId, "-").concat(isTag(tag) ? tag : escape(getComponentName(tag)));
|
|
1519
|
+
var newOptions = tslib.__assign(tslib.__assign({}, optionsToCopy), { attrs: finalAttrs, componentId: newComponentId });
|
|
1520
|
+
return createStyledComponent(tag, newOptions, rules);
|
|
1521
|
+
};
|
|
1522
|
+
Object.defineProperty(WrappedStyledComponent, 'defaultProps', {
|
|
1523
|
+
get: function () {
|
|
1524
|
+
return this._foldedDefaultProps;
|
|
1525
|
+
},
|
|
1526
|
+
set: function (obj) {
|
|
1527
|
+
this._foldedDefaultProps = isTargetStyledComp
|
|
1528
|
+
? mixinDeep({}, styledComponentTarget.defaultProps, obj)
|
|
1529
|
+
: obj;
|
|
1530
|
+
},
|
|
1531
|
+
});
|
|
1532
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1533
|
+
checkDynamicCreation(displayName, styledComponentId);
|
|
1534
|
+
WrappedStyledComponent.warnTooManyClasses = createWarnTooManyClasses(displayName, styledComponentId);
|
|
1535
|
+
}
|
|
1536
|
+
WrappedStyledComponent.toString = function () { return ".".concat(WrappedStyledComponent.styledComponentId); };
|
|
1537
|
+
if (isCompositeComponent) {
|
|
1538
|
+
var compositeComponentTarget = target;
|
|
1539
|
+
hoistNonReactStatics(WrappedStyledComponent, compositeComponentTarget, {
|
|
1540
|
+
// all SC-specific things should not be hoisted
|
|
1541
|
+
attrs: true,
|
|
1542
|
+
componentStyle: true,
|
|
1543
|
+
displayName: true,
|
|
1544
|
+
foldedComponentIds: true,
|
|
1545
|
+
shouldForwardProp: true,
|
|
1546
|
+
styledComponentId: true,
|
|
1547
|
+
target: true,
|
|
1548
|
+
withComponent: true,
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
return WrappedStyledComponent;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
function interleave(strings, interpolations) {
|
|
1555
|
+
var result = [strings[0]];
|
|
1556
|
+
for (var i = 0, len = interpolations.length; i < len; i += 1) {
|
|
1557
|
+
result.push(interpolations[i], strings[i + 1]);
|
|
1558
|
+
}
|
|
1559
|
+
return result;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
/**
|
|
1563
|
+
* Used when flattening object styles to determine if we should
|
|
1564
|
+
* expand an array of styles.
|
|
1565
|
+
*/
|
|
1566
|
+
var addTag = function (arg) {
|
|
1567
|
+
if (Array.isArray(arg)) {
|
|
1568
|
+
// eslint-disable-next-line no-param-reassign
|
|
1569
|
+
arg.isCss = true;
|
|
1570
|
+
}
|
|
1571
|
+
return arg;
|
|
1572
|
+
};
|
|
1573
|
+
function css(styles) {
|
|
1574
|
+
var interpolations = [];
|
|
1575
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1576
|
+
interpolations[_i - 1] = arguments[_i];
|
|
1577
|
+
}
|
|
1578
|
+
if (isFunction(styles) || isPlainObject(styles)) {
|
|
1579
|
+
var styleFunctionOrObject = styles;
|
|
1580
|
+
return addTag(flatten(interleave(EMPTY_ARRAY, tslib.__spreadArray([
|
|
1581
|
+
styleFunctionOrObject
|
|
1582
|
+
], interpolations, true))));
|
|
1583
|
+
}
|
|
1584
|
+
var styleStringArray = styles;
|
|
1585
|
+
if (interpolations.length === 0 &&
|
|
1586
|
+
styleStringArray.length === 1 &&
|
|
1587
|
+
typeof styleStringArray[0] === 'string') {
|
|
1588
|
+
return styleStringArray;
|
|
1589
|
+
}
|
|
1590
|
+
return addTag(flatten(interleave(styleStringArray, interpolations)));
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
function constructWithOptions(componentConstructor, tag, options) {
|
|
1594
|
+
if (options === void 0) { options = EMPTY_OBJECT; }
|
|
1595
|
+
// We trust that the tag is a valid component as long as it isn't falsish
|
|
1596
|
+
// Typically the tag here is a string or function (i.e. class or pure function component)
|
|
1597
|
+
// However a component may also be an object if it uses another utility, e.g. React.memo
|
|
1598
|
+
// React will output an appropriate warning however if the `tag` isn't valid
|
|
1599
|
+
if (!tag) {
|
|
1600
|
+
throw throwStyledComponentsError(1, tag);
|
|
1601
|
+
}
|
|
1602
|
+
/* This is callable directly as a template function */
|
|
1603
|
+
var templateFunction = function (initialStyles) {
|
|
1604
|
+
var interpolations = [];
|
|
1605
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1606
|
+
interpolations[_i - 1] = arguments[_i];
|
|
1607
|
+
}
|
|
1608
|
+
return componentConstructor(tag, options, css.apply(void 0, tslib.__spreadArray([initialStyles], interpolations, false)));
|
|
1609
|
+
};
|
|
1610
|
+
/* Modify/inject new props at runtime */
|
|
1611
|
+
templateFunction.attrs = function (attrs) {
|
|
1612
|
+
return constructWithOptions(componentConstructor, tag, tslib.__assign(tslib.__assign({}, options), { attrs: Array.prototype.concat(options.attrs, attrs).filter(Boolean) }));
|
|
1613
|
+
};
|
|
1614
|
+
/**
|
|
1615
|
+
* If config methods are called, wrap up a new template function and merge options */
|
|
1616
|
+
templateFunction.withConfig = function (config) {
|
|
1617
|
+
return constructWithOptions(componentConstructor, tag, tslib.__assign(tslib.__assign({}, options), config));
|
|
1618
|
+
};
|
|
1619
|
+
return templateFunction;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
var baseStyled = function (tag) {
|
|
1623
|
+
return constructWithOptions(createStyledComponent, tag);
|
|
1624
|
+
};
|
|
1625
|
+
var styled = baseStyled;
|
|
1626
|
+
// Shorthands for all valid HTML Elements
|
|
1627
|
+
domElements.forEach(function (domElement) {
|
|
1628
|
+
// @ts-expect-error someday they'll handle imperative assignment properly
|
|
1629
|
+
styled[domElement] = baseStyled(domElement);
|
|
1630
|
+
});
|
|
1631
|
+
|
|
1632
|
+
var GlobalStyle = /** @class */ (function () {
|
|
1633
|
+
function GlobalStyle(rules, componentId) {
|
|
1634
|
+
this.rules = rules;
|
|
1635
|
+
this.componentId = componentId;
|
|
1636
|
+
this.isStatic = isStaticRules(rules);
|
|
1637
|
+
// pre-register the first instance to ensure global styles
|
|
1638
|
+
// load before component ones
|
|
1639
|
+
StyleSheet.registerId(this.componentId + 1);
|
|
1640
|
+
}
|
|
1641
|
+
GlobalStyle.prototype.createStyles = function (instance, executionContext, styleSheet, stylis) {
|
|
1642
|
+
var flatCSS = flatten(this.rules, executionContext, styleSheet, stylis);
|
|
1643
|
+
var css = stylis(flatCSS.join(''), '');
|
|
1644
|
+
var id = this.componentId + instance;
|
|
1645
|
+
// NOTE: We use the id as a name as well, since these rules never change
|
|
1646
|
+
styleSheet.insertRules(id, id, css);
|
|
1647
|
+
};
|
|
1648
|
+
GlobalStyle.prototype.removeStyles = function (instance, styleSheet) {
|
|
1649
|
+
styleSheet.clearRules(this.componentId + instance);
|
|
1650
|
+
};
|
|
1651
|
+
GlobalStyle.prototype.renderStyles = function (instance, executionContext, styleSheet, stylis) {
|
|
1652
|
+
if (instance > 2)
|
|
1653
|
+
StyleSheet.registerId(this.componentId + instance);
|
|
1654
|
+
// NOTE: Remove old styles, then inject the new ones
|
|
1655
|
+
this.removeStyles(instance, styleSheet);
|
|
1656
|
+
this.createStyles(instance, executionContext, styleSheet, stylis);
|
|
1657
|
+
};
|
|
1658
|
+
return GlobalStyle;
|
|
1659
|
+
}());
|
|
1660
|
+
|
|
1661
|
+
function createGlobalStyle(strings) {
|
|
1662
|
+
var interpolations = [];
|
|
1663
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1664
|
+
interpolations[_i - 1] = arguments[_i];
|
|
1665
|
+
}
|
|
1666
|
+
var rules = css.apply(void 0, tslib.__spreadArray([strings], interpolations, false));
|
|
1667
|
+
var styledComponentId = "sc-global-".concat(generateComponentId(JSON.stringify(rules)));
|
|
1668
|
+
var globalStyle = new GlobalStyle(rules, styledComponentId);
|
|
1669
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1670
|
+
checkDynamicCreation(styledComponentId);
|
|
1671
|
+
}
|
|
1672
|
+
var GlobalStyleComponent = function (props) {
|
|
1673
|
+
var styleSheet = useStyleSheet();
|
|
1674
|
+
var stylis = useStylis();
|
|
1675
|
+
var theme = React__default["default"].useContext(ThemeContext);
|
|
1676
|
+
var instanceRef = React__default["default"].useRef(styleSheet.allocateGSInstance(styledComponentId));
|
|
1677
|
+
var instance = instanceRef.current;
|
|
1678
|
+
if (process.env.NODE_ENV !== 'production' && React__default["default"].Children.count(props.children)) {
|
|
1679
|
+
// eslint-disable-next-line no-console
|
|
1680
|
+
console.warn("The global style component ".concat(styledComponentId, " was given child JSX. createGlobalStyle does not render children."));
|
|
1681
|
+
}
|
|
1682
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
1683
|
+
rules.some(function (rule) { return typeof rule === 'string' && rule.indexOf('@import') !== -1; })) {
|
|
1684
|
+
// eslint-disable-next-line no-console
|
|
1685
|
+
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.");
|
|
1686
|
+
}
|
|
1687
|
+
if (styleSheet.server) {
|
|
1688
|
+
renderStyles(instance, props, styleSheet, theme, stylis);
|
|
1689
|
+
}
|
|
1690
|
+
{
|
|
1691
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1692
|
+
// @ts-expect-error still using React 17 types for the time being
|
|
1693
|
+
(React__default["default"].useInsertionEffect || React__default["default"].useLayoutEffect)(function () {
|
|
1694
|
+
if (!styleSheet.server) {
|
|
1695
|
+
renderStyles(instance, props, styleSheet, theme, stylis);
|
|
1696
|
+
return function () { return globalStyle.removeStyles(instance, styleSheet); };
|
|
1697
|
+
}
|
|
1698
|
+
}, [instance, props, styleSheet, theme, stylis]);
|
|
1699
|
+
}
|
|
1700
|
+
return null;
|
|
1701
|
+
};
|
|
1702
|
+
function renderStyles(instance, props, styleSheet, theme, stylis) {
|
|
1703
|
+
if (globalStyle.isStatic) {
|
|
1704
|
+
globalStyle.renderStyles(instance, STATIC_EXECUTION_CONTEXT, styleSheet, stylis);
|
|
1705
|
+
}
|
|
1706
|
+
else {
|
|
1707
|
+
var context = tslib.__assign(tslib.__assign({}, props), { theme: determineTheme(props, theme, GlobalStyleComponent.defaultProps) });
|
|
1708
|
+
globalStyle.renderStyles(instance, context, styleSheet, stylis);
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
return React__default["default"].memo(GlobalStyleComponent);
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
function keyframes(strings) {
|
|
1715
|
+
var interpolations = [];
|
|
1716
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1717
|
+
interpolations[_i - 1] = arguments[_i];
|
|
1718
|
+
}
|
|
1719
|
+
/* Warning if you've used keyframes on React Native */
|
|
1720
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
1721
|
+
typeof navigator !== 'undefined' &&
|
|
1722
|
+
navigator.product === 'ReactNative') {
|
|
1723
|
+
// eslint-disable-next-line no-console
|
|
1724
|
+
console.warn('`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.');
|
|
1725
|
+
}
|
|
1726
|
+
var rules = css.apply(void 0, tslib.__spreadArray([strings], interpolations, false)).join('');
|
|
1727
|
+
var name = generateComponentId(rules);
|
|
1728
|
+
return new Keyframes(name, rules);
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
function withTheme(Component) {
|
|
1732
|
+
var WithTheme = React__default["default"].forwardRef(function (props, ref) {
|
|
1733
|
+
var theme = React__default["default"].useContext(ThemeContext);
|
|
1734
|
+
var themeProp = determineTheme(props, theme, Component.defaultProps);
|
|
1735
|
+
if (process.env.NODE_ENV !== 'production' && themeProp === undefined) {
|
|
1736
|
+
// eslint-disable-next-line no-console
|
|
1737
|
+
console.warn("[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class \"".concat(getComponentName(Component), "\""));
|
|
1738
|
+
}
|
|
1739
|
+
return React__default["default"].createElement(Component, tslib.__assign({}, props, { theme: themeProp, ref: ref }));
|
|
1740
|
+
});
|
|
1741
|
+
WithTheme.displayName = "WithTheme(".concat(getComponentName(Component), ")");
|
|
1742
|
+
return hoistNonReactStatics(WithTheme, Component);
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
var useTheme = function () { return React.useContext(ThemeContext); };
|
|
1746
|
+
|
|
1747
|
+
var ServerStyleSheet = /** @class */ (function () {
|
|
1748
|
+
function ServerStyleSheet() {
|
|
1749
|
+
var _this = this;
|
|
1750
|
+
this._emitSheetCSS = function () {
|
|
1751
|
+
var css = _this.instance.toString();
|
|
1752
|
+
var nonce = getNonce();
|
|
1753
|
+
var attrs = [
|
|
1754
|
+
nonce && "nonce=\"".concat(nonce, "\""),
|
|
1755
|
+
"".concat(SC_ATTR, "=\"true\""),
|
|
1756
|
+
"".concat(SC_ATTR_VERSION, "=\"").concat(SC_VERSION, "\""),
|
|
1757
|
+
];
|
|
1758
|
+
var htmlAttr = attrs.filter(Boolean).join(' ');
|
|
1759
|
+
return "<style ".concat(htmlAttr, ">").concat(css, "</style>");
|
|
1760
|
+
};
|
|
1761
|
+
this.getStyleTags = function () {
|
|
1762
|
+
if (_this.sealed) {
|
|
1763
|
+
throw throwStyledComponentsError(2);
|
|
1764
|
+
}
|
|
1765
|
+
return _this._emitSheetCSS();
|
|
1766
|
+
};
|
|
1767
|
+
this.getStyleElement = function () {
|
|
1768
|
+
var _a;
|
|
1769
|
+
if (_this.sealed) {
|
|
1770
|
+
throw throwStyledComponentsError(2);
|
|
1771
|
+
}
|
|
1772
|
+
var props = (_a = {},
|
|
1773
|
+
_a[SC_ATTR] = '',
|
|
1774
|
+
_a[SC_ATTR_VERSION] = SC_VERSION,
|
|
1775
|
+
_a.dangerouslySetInnerHTML = {
|
|
1776
|
+
__html: _this.instance.toString(),
|
|
1777
|
+
},
|
|
1778
|
+
_a);
|
|
1779
|
+
var nonce = getNonce();
|
|
1780
|
+
if (nonce) {
|
|
1781
|
+
props.nonce = nonce;
|
|
1782
|
+
}
|
|
1783
|
+
// v4 returned an array for this fn, so we'll do the same for v5 for backward compat
|
|
1784
|
+
return [React__default["default"].createElement("style", tslib.__assign({}, props, { key: "sc-0-0" }))];
|
|
1785
|
+
};
|
|
1786
|
+
this.seal = function () {
|
|
1787
|
+
_this.sealed = true;
|
|
1788
|
+
};
|
|
1789
|
+
this.instance = new StyleSheet({ isServer: true });
|
|
1790
|
+
this.sealed = false;
|
|
1791
|
+
}
|
|
1792
|
+
ServerStyleSheet.prototype.collectStyles = function (children) {
|
|
1793
|
+
if (this.sealed) {
|
|
1794
|
+
throw throwStyledComponentsError(2);
|
|
1795
|
+
}
|
|
1796
|
+
return React__default["default"].createElement(StyleSheetManager, { sheet: this.instance }, children);
|
|
1797
|
+
};
|
|
1798
|
+
// eslint-disable-next-line consistent-return
|
|
1799
|
+
// @ts-expect-error alternate return types are not possible due to code transformation
|
|
1800
|
+
ServerStyleSheet.prototype.interleaveWithNodeStream = function (input) {
|
|
1801
|
+
{
|
|
1802
|
+
throw throwStyledComponentsError(3);
|
|
1803
|
+
}
|
|
1804
|
+
};
|
|
1805
|
+
return ServerStyleSheet;
|
|
1806
|
+
}());
|
|
1807
|
+
|
|
1808
|
+
/* eslint-disable */
|
|
1809
|
+
var __PRIVATE__ = {
|
|
1810
|
+
StyleSheet: StyleSheet,
|
|
1811
|
+
mainSheet: mainSheet,
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1814
|
+
/* Import singletons */
|
|
1815
|
+
/* Warning if you've imported this file on React Native */
|
|
1816
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
1817
|
+
typeof navigator !== 'undefined' &&
|
|
1818
|
+
navigator.product === 'ReactNative') {
|
|
1819
|
+
// eslint-disable-next-line no-console
|
|
1820
|
+
console.warn("It looks like you've imported 'styled-components' on React Native.\n" +
|
|
1821
|
+
"Perhaps you're looking to import 'styled-components/native'?\n" +
|
|
1822
|
+
'Read more about this at https://www.styled-components.com/docs/basics#react-native');
|
|
1823
|
+
}
|
|
1824
|
+
/* Warning if there are several instances of styled-components */
|
|
1825
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
1826
|
+
process.env.NODE_ENV !== 'test' &&
|
|
1827
|
+
typeof window !== 'undefined') {
|
|
1828
|
+
window['__styled-components-init__'] || (window['__styled-components-init__'] = 0);
|
|
1829
|
+
if (window['__styled-components-init__'] === 1) {
|
|
1830
|
+
// eslint-disable-next-line no-console
|
|
1831
|
+
console.warn("It looks like there are several instances of 'styled-components' initialized in this application. " +
|
|
1832
|
+
'This may cause dynamic styles to not render properly, errors during the rehydration process, ' +
|
|
1833
|
+
'a missing theme prop, and makes your application bigger without good reason.\n\n' +
|
|
1834
|
+
'See https://s-c.sh/2BAXzed for more info.');
|
|
1835
|
+
}
|
|
1836
|
+
window['__styled-components-init__'] += 1;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
exports.ServerStyleSheet = ServerStyleSheet;
|
|
1840
|
+
exports.StyleSheetConsumer = StyleSheetConsumer;
|
|
1841
|
+
exports.StyleSheetContext = StyleSheetContext;
|
|
1842
|
+
exports.StyleSheetManager = StyleSheetManager;
|
|
1843
|
+
exports.ThemeConsumer = ThemeConsumer;
|
|
1844
|
+
exports.ThemeContext = ThemeContext;
|
|
1845
|
+
exports.ThemeProvider = ThemeProvider;
|
|
1846
|
+
exports.__PRIVATE__ = __PRIVATE__;
|
|
1847
|
+
exports.createGlobalStyle = createGlobalStyle;
|
|
1848
|
+
exports.css = css;
|
|
1849
|
+
exports["default"] = styled;
|
|
1850
|
+
exports.isStyledComponent = isStyledComponent;
|
|
1851
|
+
exports.keyframes = keyframes;
|
|
1852
|
+
exports.useTheme = useTheme;
|
|
1853
|
+
exports.version = SC_VERSION;
|
|
1854
|
+
exports.withTheme = withTheme;
|
|
2
1855
|
//# sourceMappingURL=styled-components.browser.cjs.js.map
|