styled-components 6.1.19 → 6.2.1-prerelease.0
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 -1
- package/dist/styled-components.browser.cjs.js +1 -1
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +1 -1
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +1 -1
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +1 -1
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +186 -114
- 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/native/dist/constants.d.ts +5 -0
- package/native/dist/constructors/constructWithOptions.d.ts +0 -1
- package/native/dist/constructors/styled.d.ts +2 -135
- package/native/dist/dist/constants.d.ts +5 -0
- package/native/dist/dist/constructors/constructWithOptions.d.ts +0 -1
- package/native/dist/dist/constructors/styled.d.ts +2 -135
- package/native/dist/dist/hoc/withTheme.d.ts +1 -1
- package/native/dist/dist/index.d.ts +2 -2
- package/native/dist/dist/models/ComponentStyle.d.ts +4 -1
- package/native/dist/dist/models/ServerStyleSheet.d.ts +2 -3
- package/native/dist/dist/models/StyledComponent.d.ts +1 -1
- package/native/dist/dist/models/StyledNativeComponent.d.ts +1 -1
- package/native/dist/dist/native/index.d.ts +8 -26
- package/native/dist/dist/sheet/Tag.d.ts +4 -4
- package/native/dist/dist/test/utils.d.ts +35 -17
- package/native/dist/dist/types.d.ts +32 -24
- package/native/dist/dist/utils/domElements.d.ts +2 -2
- package/native/dist/dist/utils/empties.d.ts +1 -1
- package/native/dist/dist/utils/isRSC.d.ts +11 -0
- package/native/dist/hoc/withTheme.d.ts +1 -1
- package/native/dist/index.d.ts +2 -2
- package/native/dist/models/ComponentStyle.d.ts +4 -1
- package/native/dist/models/ServerStyleSheet.d.ts +2 -3
- package/native/dist/models/StyledComponent.d.ts +1 -1
- package/native/dist/models/StyledNativeComponent.d.ts +1 -1
- package/native/dist/native/index.d.ts +8 -26
- package/native/dist/sheet/Tag.d.ts +4 -4
- package/native/dist/styled-components.native.cjs.js +1 -1
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +1 -1
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/test/utils.d.ts +34 -16
- package/native/dist/types.d.ts +32 -24
- package/native/dist/utils/domElements.d.ts +2 -2
- package/native/dist/utils/empties.d.ts +1 -1
- package/native/dist/utils/isRSC.d.ts +11 -0
- package/package.json +60 -57
- package/test-utils/setupTestFramework.ts +7 -2
- package/dist/base.d.ts +0 -12
- package/dist/constants.d.ts +0 -8
- package/dist/constructors/constructWithOptions.d.ts +0 -18
- package/dist/constructors/createGlobalStyle.d.ts +0 -3
- package/dist/constructors/css.d.ts +0 -4
- package/dist/constructors/keyframes.d.ts +0 -3
- package/dist/constructors/styled.d.ts +0 -150
- package/dist/hoc/withTheme.d.ts +0 -4
- package/dist/hoc/withTheme.spec.d.ts +0 -1
- package/dist/index-standalone.d.ts +0 -2
- package/dist/index.d.ts +0 -4
- package/dist/models/ComponentStyle.d.ts +0 -15
- package/dist/models/GlobalStyle.d.ts +0 -11
- package/dist/models/InlineStyle.d.ts +0 -7
- package/dist/models/Keyframes.d.ts +0 -10
- package/dist/models/ServerStyleSheet.d.ts +0 -16
- package/dist/models/StyleSheetManager.d.ts +0 -65
- package/dist/models/StyledComponent.d.ts +0 -3
- package/dist/models/StyledNativeComponent.d.ts +0 -3
- package/dist/models/ThemeProvider.d.ts +0 -47
- package/dist/native/index.d.ts +0 -37
- package/dist/secretInternals.d.ts +0 -5
- package/dist/sheet/GroupIDAllocator.d.ts +0 -4
- package/dist/sheet/GroupedTag.d.ts +0 -11
- package/dist/sheet/Rehydration.d.ts +0 -3
- package/dist/sheet/Sheet.d.ts +0 -40
- package/dist/sheet/Tag.d.ts +0 -55
- package/dist/sheet/dom.d.ts +0 -5
- package/dist/sheet/index.d.ts +0 -1
- package/dist/sheet/types.d.ts +0 -36
- package/dist/test/globals.d.ts +0 -2
- package/dist/test/utils.d.ts +0 -145
- package/dist/test/veryLargeUnionType.d.ts +0 -1
- package/dist/types.d.ts +0 -204
- package/dist/utils/addUnitIfNeeded.d.ts +0 -1
- package/dist/utils/checkDynamicCreation.d.ts +0 -1
- package/dist/utils/createWarnTooManyClasses.d.ts +0 -3
- package/dist/utils/determineTheme.d.ts +0 -4
- package/dist/utils/domElements.d.ts +0 -4
- package/dist/utils/empties.d.ts +0 -3
- package/dist/utils/error.d.ts +0 -5
- package/dist/utils/errors.d.ts +0 -21
- package/dist/utils/escape.d.ts +0 -5
- package/dist/utils/flatten.d.ts +0 -4
- package/dist/utils/generateAlphabeticName.d.ts +0 -1
- package/dist/utils/generateComponentId.d.ts +0 -1
- package/dist/utils/generateDisplayName.d.ts +0 -2
- package/dist/utils/getComponentName.d.ts +0 -2
- package/dist/utils/hash.d.ts +0 -3
- package/dist/utils/hoist.d.ts +0 -51
- package/dist/utils/hyphenateStyleName.d.ts +0 -14
- package/dist/utils/interleave.d.ts +0 -2
- package/dist/utils/isFunction.d.ts +0 -1
- package/dist/utils/isPlainObject.d.ts +0 -1
- package/dist/utils/isStatelessFunction.d.ts +0 -1
- package/dist/utils/isStaticRules.d.ts +0 -2
- package/dist/utils/isStyledComponent.d.ts +0 -2
- package/dist/utils/isTag.d.ts +0 -2
- package/dist/utils/joinStrings.d.ts +0 -5
- package/dist/utils/mixinDeep.d.ts +0 -6
- package/dist/utils/nonce.d.ts +0 -1
- package/dist/utils/setToString.d.ts +0 -17
- package/dist/utils/stylis.d.ts +0 -10
|
@@ -10,9 +10,14 @@
|
|
|
10
10
|
'data-styled';
|
|
11
11
|
var SC_ATTR_ACTIVE = 'active';
|
|
12
12
|
var SC_ATTR_VERSION = 'data-styled-version';
|
|
13
|
-
var SC_VERSION = "6.1.
|
|
13
|
+
var SC_VERSION = "6.2.1-prerelease.0";
|
|
14
14
|
var SPLITTER = '/*!sc*/\n';
|
|
15
15
|
var IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
16
|
+
/**
|
|
17
|
+
* Detect if we're running in a React Server Component environment.
|
|
18
|
+
* RSC environments lack createContext, making this a reliable indicator.
|
|
19
|
+
*/
|
|
20
|
+
var IS_RSC = typeof React.createContext === 'undefined';
|
|
16
21
|
var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
|
|
17
22
|
? SC_DISABLE_SPEEDY
|
|
18
23
|
: typeof process !== 'undefined' &&
|
|
@@ -568,54 +573,7 @@
|
|
|
568
573
|
return StyleSheet;
|
|
569
574
|
}());
|
|
570
575
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
var shallowequal = function shallowEqual(objA, objB, compare, compareContext) {
|
|
574
|
-
var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
|
|
575
|
-
|
|
576
|
-
if (ret !== void 0) {
|
|
577
|
-
return !!ret;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
if (objA === objB) {
|
|
581
|
-
return true;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) {
|
|
585
|
-
return false;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
var keysA = Object.keys(objA);
|
|
589
|
-
var keysB = Object.keys(objB);
|
|
590
|
-
|
|
591
|
-
if (keysA.length !== keysB.length) {
|
|
592
|
-
return false;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
|
596
|
-
|
|
597
|
-
// Test for A's keys different from B.
|
|
598
|
-
for (var idx = 0; idx < keysA.length; idx++) {
|
|
599
|
-
var key = keysA[idx];
|
|
600
|
-
|
|
601
|
-
if (!bHasOwnProperty(key)) {
|
|
602
|
-
return false;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
var valueA = objA[key];
|
|
606
|
-
var valueB = objB[key];
|
|
607
|
-
|
|
608
|
-
ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
|
|
609
|
-
|
|
610
|
-
if (ret === false || (ret === void 0 && valueA !== valueB)) {
|
|
611
|
-
return false;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
return true;
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
var e="-ms-";var r="-moz-";var a="-webkit-";var n="comm";var c="rule";var s="decl";var i="@import";var h="@keyframes";var g="@layer";var $=Math.abs;var m=String.fromCharCode;var x=Object.assign;function y(e,r){return A(e,0)^45?(((r<<2^A(e,0))<<2^A(e,1))<<2^A(e,2))<<2^A(e,3):0}function j(e){return e.trim()}function z(e,r){return (e=r.exec(e))?e[0]:e}function C(e,r,a){return e.replace(r,a)}function O(e,r,a){return e.indexOf(r,a)}function A(e,r){return e.charCodeAt(r)|0}function M(e,r,a){return e.slice(r,a)}function S(e){return e.length}function q(e){return e.length}function B(e,r){return r.push(e),e}function D(e,r){return e.map(r).join("")}function E(e,r){return e.filter((function(e){return !z(e,r)}))}var F=1;var G=1;var H=0;var I=0;var J=0;var K="";function L(e,r,a,n,c,s,t,u){return {value:e,root:r,parent:a,type:n,props:c,children:s,line:F,column:G,length:t,return:"",siblings:u}}function N(e,r){return x(L("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},r)}function P(e){while(e.root)e=N(e.root,{children:[e]});B(e,e.siblings);}function Q(){return J}function R(){J=I>0?A(K,--I):0;if(G--,J===10)G=1,F--;return J}function T(){J=I<H?A(K,I++):0;if(G++,J===10)G=1,F++;return J}function U(){return A(K,I)}function V(){return I}function W(e,r){return M(K,e,r)}function X(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Y(e){return F=G=1,H=S(K=e),I=0,[]}function Z(e){return K="",e}function _(e){return j(W(I-1,ce(e===91?e+2:e===40?e+1:e)))}function re(e){while(J=U())if(J<33)T();else break;return X(e)>2||X(J)>3?"":" "}function ne(e,r){while(--r&&T())if(J<48||J>102||J>57&&J<65||J>70&&J<97)break;return W(e,V()+(r<6&&U()==32&&T()==32))}function ce(e){while(T())switch(J){case e:return I;case 34:case 39:if(e!==34&&e!==39)ce(J);break;case 40:if(e===41)ce(e);break;case 92:T();break}return I}function se(e,r){while(T())if(e+J===47+10)break;else if(e+J===42+42&&U()===47)break;return "/*"+W(r,I-1)+"*"+m(e===47?e:T())}function te(e){while(!X(U()))T();return W(e,I)}function ue(e){return Z(ie("",null,null,null,[""],e=Y(e),0,[0],e))}function ie(e,r,a,n,c,s,t,u,i){var f=0;var o=0;var l=t;var v=0;var p=0;var h=0;var b=1;var w=1;var d=1;var g=0;var k="";var x=c;var y=s;var j=n;var z=k;while(w)switch(h=g,g=T()){case 40:if(h!=108&&A(z,l-1)==58){if(O(z+=C(_(g),"&","&\f"),"&\f",$(f?u[f-1]:0))!=-1)d=-1;break}case 34:case 39:case 91:z+=_(g);break;case 9:case 10:case 13:case 32:z+=re(h);break;case 92:z+=ne(V()-1,7);continue;case 47:switch(U()){case 42:case 47:B(oe(se(T(),V()),r,a,i),i);break;default:z+="/";}break;case 123*b:u[f++]=S(z)*d;case 125*b:case 59:case 0:switch(g){case 0:case 125:w=0;case 59+o:if(d==-1)z=C(z,/\f/g,"");if(p>0&&S(z)-l)B(p>32?le(z+";",n,a,l-1,i):le(C(z," ","")+";",n,a,l-2,i),i);break;case 59:z+=";";default:B(j=fe(z,r,a,f,o,c,u,k,x=[],y=[],l,s),s);if(g===123)if(o===0)ie(z,r,j,j,x,s,l,u,y);else switch(v===99&&A(z,3)===110?100:v){case 100:case 108:case 109:case 115:ie(e,j,j,n&&B(fe(e,j,j,0,0,c,u,k,c,x=[],l,y),y),c,y,l,u,n?x:y);break;default:ie(z,j,j,j,[""],y,0,u,y);}}f=o=p=0,b=d=1,k=z="",l=t;break;case 58:l=1+S(z),p=h;default:if(b<1)if(g==123)--b;else if(g==125&&b++==0&&R()==125)continue;switch(z+=m(g),g*b){case 38:d=o>0?1:(z+="\f",-1);break;case 44:u[f++]=(S(z)-1)*d,d=1;break;case 64:if(U()===45)z+=_(T());v=U(),o=l=S(k=z+=te(V())),g++;break;case 45:if(h===45&&S(z)==2)b=0;}}return s}function fe(e,r,a,n,s,t,u,i,f,o,l,v){var p=s-1;var h=s===0?t:[""];var b=q(h);for(var w=0,d=0,g=0;w<n;++w)for(var k=0,m=M(e,p+1,p=$(d=u[w])),x=e;k<b;++k)if(x=j(d>0?h[k]+" "+m:C(m,/&\f/g,h[k])))f[g++]=x;return L(e,r,a,s===0?c:i,f,o,l,v)}function oe(e,r,a,c){return L(e,r,a,n,m(Q()),M(e,2,-2),0,c)}function le(e,r,a,n,c){return L(e,r,a,s,M(e,0,n),M(e,n+1,-1),n,c)}function ve(n,c,s){switch(y(n,c)){case 5103:return a+"print-"+n+n;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return a+n+n;case 4789:return r+n+n;case 5349:case 4246:case 4810:case 6968:case 2756:return a+n+r+n+e+n+n;case 5936:switch(A(n,c+11)){case 114:return a+n+e+C(n,/[svh]\w+-[tblr]{2}/,"tb")+n;case 108:return a+n+e+C(n,/[svh]\w+-[tblr]{2}/,"tb-rl")+n;case 45:return a+n+e+C(n,/[svh]\w+-[tblr]{2}/,"lr")+n}case 6828:case 4268:case 2903:return a+n+e+n+n;case 6165:return a+n+e+"flex-"+n+n;case 5187:return a+n+C(n,/(\w+).+(:[^]+)/,a+"box-$1$2"+e+"flex-$1$2")+n;case 5443:return a+n+e+"flex-item-"+C(n,/flex-|-self/g,"")+(!z(n,/flex-|baseline/)?e+"grid-row-"+C(n,/flex-|-self/g,""):"")+n;case 4675:return a+n+e+"flex-line-pack"+C(n,/align-content|flex-|-self/g,"")+n;case 5548:return a+n+e+C(n,"shrink","negative")+n;case 5292:return a+n+e+C(n,"basis","preferred-size")+n;case 6060:return a+"box-"+C(n,"-grow","")+a+n+e+C(n,"grow","positive")+n;case 4554:return a+C(n,/([^-])(transform)/g,"$1"+a+"$2")+n;case 6187:return C(C(C(n,/(zoom-|grab)/,a+"$1"),/(image-set)/,a+"$1"),n,"")+n;case 5495:case 3959:return C(n,/(image-set\([^]*)/,a+"$1"+"$`$1");case 4968:return C(C(n,/(.+:)(flex-)?(.*)/,a+"box-pack:$3"+e+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+a+n+n;case 4200:if(!z(n,/flex-|baseline/))return e+"grid-column-align"+M(n,c)+n;break;case 2592:case 3360:return e+C(n,"template-","")+n;case 4384:case 3616:if(s&&s.some((function(e,r){return c=r,z(e.props,/grid-\w+-end/)}))){return ~O(n+(s=s[c].value),"span",0)?n:e+C(n,"-start","")+n+e+"grid-row-span:"+(~O(s,"span",0)?z(s,/\d+/):+z(s,/\d+/)-+z(n,/\d+/))+";"}return e+C(n,"-start","")+n;case 4896:case 4128:return s&&s.some((function(e){return z(e.props,/grid-\w+-start/)}))?n:e+C(C(n,"-end","-span"),"span ","")+n;case 4095:case 3583:case 4068:case 2532:return C(n,/(.+)-inline(.+)/,a+"$1$2")+n;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(S(n)-1-c>6)switch(A(n,c+1)){case 109:if(A(n,c+4)!==45)break;case 102:return C(n,/(.+:)(.+)-([^]+)/,"$1"+a+"$2-$3"+"$1"+r+(A(n,c+3)==108?"$3":"$2-$3"))+n;case 115:return ~O(n,"stretch",0)?ve(C(n,"stretch","fill-available"),c,s)+n:n}break;case 5152:case 5920:return C(n,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(r,a,c,s,t,u,i){return e+a+":"+c+i+(s?e+a+"-span:"+(t?u:+u-+c)+i:"")+n}));case 4949:if(A(n,c+6)===121)return C(n,":",":"+a)+n;break;case 6444:switch(A(n,A(n,14)===45?18:11)){case 120:return C(n,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+a+(A(n,14)===45?"inline-":"")+"box$3"+"$1"+a+"$2$3"+"$1"+e+"$2box$3")+n;case 100:return C(n,":",":"+e)+n}break;case 5719:case 2647:case 2135:case 3927:case 2391:return C(n,"scroll-","scroll-snap-")+n}return n}function pe(e,r){var a="";for(var n=0;n<e.length;n++)a+=r(e[n],n,e,r)||"";return a}function he(e,r,a,t){switch(e.type){case g:if(e.children.length)break;case i:case s:return e.return=e.return||e.value;case n:return "";case h:return e.return=e.value+"{"+pe(e.children,t)+"}";case c:if(!S(e.value=e.props.join(",")))return ""}return S(a=pe(e.children,t))?e.return=e.value+"{"+a+"}":""}function be(e){var r=q(e);return function(a,n,c,s){var t="";for(var u=0;u<r;u++)t+=e[u](a,n,c,s)||"";return t}}function we(e){return function(r){if(!r.root)if(r=r.return)e(r);}}function de(n,t,u,i){if(n.length>-1)if(!n.return)switch(n.type){case s:n.return=ve(n.value,n.length,u);return;case h:return pe([N(n,{value:C(n.value,"@","@"+a)})],i);case c:if(n.length)return D(u=n.props,(function(c){switch(z(c,i=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":P(N(n,{props:[C(c,/:(read-\w+)/,":"+r+"$1")]}));P(N(n,{props:[c]}));x(n,{props:E(u,i)});break;case"::placeholder":P(N(n,{props:[C(c,/:(plac\w+)/,":"+a+"input-$1")]}));P(N(n,{props:[C(c,/:(plac\w+)/,":"+r+"$1")]}));P(N(n,{props:[C(c,/:(plac\w+)/,e+"input-$1")]}));P(N(n,{props:[c]}));x(n,{props:E(u,i)});break}return ""}))}}
|
|
576
|
+
var e="-ms-";var r="-moz-";var a="-webkit-";var c="comm";var n="rule";var s="decl";var i="@import";var v="@namespace";var b="@keyframes";var g="@layer";var $=Math.abs;var m=String.fromCharCode;var x=Object.assign;function y(e,r){return A(e,0)^45?(((r<<2^A(e,0))<<2^A(e,1))<<2^A(e,2))<<2^A(e,3):0}function j(e){return e.trim()}function z(e,r){return (e=r.exec(e))?e[0]:e}function C(e,r,a){return e.replace(r,a)}function O(e,r,a){return e.indexOf(r,a)}function A(e,r){return e.charCodeAt(r)|0}function M(e,r,a){return e.slice(r,a)}function S(e){return e.length}function q(e){return e.length}function B(e,r){return r.push(e),e}function D(e,r){return e.map(r).join("")}function E(e,r){return e.filter((function(e){return !z(e,r)}))}var F=1;var G=1;var H=0;var I=0;var J=0;var K="";function L(e,r,a,c,n,s,t,u){return {value:e,root:r,parent:a,type:c,props:n,children:s,line:F,column:G,length:t,return:"",siblings:u}}function N(e,r){return x(L("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},r)}function P(e){while(e.root)e=N(e.root,{children:[e]});B(e,e.siblings);}function Q(){return J}function R(){J=I>0?A(K,--I):0;if(G--,J===10)G=1,F--;return J}function T(){J=I<H?A(K,I++):0;if(G++,J===10)G=1,F++;return J}function U(){return A(K,I)}function V(){return I}function W(e,r){return M(K,e,r)}function X(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Y(e){return F=G=1,H=S(K=e),I=0,[]}function Z(e){return K="",e}function _(e){return j(W(I-1,ne(e===91?e+2:e===40?e+1:e)))}function re(e){while(J=U())if(J<33)T();else break;return X(e)>2||X(J)>3?"":" "}function ce(e,r){while(--r&&T())if(J<48||J>102||J>57&&J<65||J>70&&J<97)break;return W(e,V()+(r<6&&U()==32&&T()==32))}function ne(e){while(T())switch(J){case e:return I;case 34:case 39:if(e!==34&&e!==39)ne(J);break;case 40:if(e===41)ne(e);break;case 92:T();break}return I}function se(e,r){while(T())if(e+J===47+10)break;else if(e+J===42+42&&U()===47)break;return "/*"+W(r,I-1)+"*"+m(e===47?e:T())}function te(e){while(!X(U()))T();return W(e,I)}function ue(e){return Z(ie("",null,null,null,[""],e=Y(e),0,[0],e))}function ie(e,r,a,c,n,s,t,u,i){var f=0;var o=0;var l=t;var p=0;var v=0;var b=0;var h=1;var w=1;var d=1;var g=0;var k="";var x=n;var y=s;var j=c;var z=k;while(w)switch(b=g,g=T()){case 40:if(b!=108&&A(z,l-1)==58){if(O(z+=C(_(g),"&","&\f"),"&\f",$(f?u[f-1]:0))!=-1)d=-1;break}case 34:case 39:case 91:z+=_(g);break;case 9:case 10:case 13:case 32:z+=re(b);break;case 92:z+=ce(V()-1,7);continue;case 47:switch(U()){case 42:case 47:B(oe(se(T(),V()),r,a,i),i);if((X(b||1)==5||X(U()||1)==5)&&S(z)&&M(z,-1,void 0)!==" ")z+=" ";break;default:z+="/";}break;case 123*h:u[f++]=S(z)*d;case 125*h:case 59:case 0:switch(g){case 0:case 125:w=0;case 59+o:if(d==-1)z=C(z,/\f/g,"");if(v>0&&(S(z)-l||h===0&&b===47))B(v>32?le(z+";",c,a,l-1,i):le(C(z," ","")+";",c,a,l-2,i),i);break;case 59:z+=";";default:B(j=fe(z,r,a,f,o,n,u,k,x=[],y=[],l,s),s);if(g===123)if(o===0)ie(z,r,j,j,x,s,l,u,y);else {switch(p){case 99:if(A(z,3)===110)break;case 108:if(A(z,2)===97)break;default:o=0;case 100:case 109:case 115:}if(o)ie(e,j,j,c&&B(fe(e,j,j,0,0,n,u,k,n,x=[],l,y),y),n,y,l,u,c?x:y);else ie(z,j,j,j,[""],y,0,u,y);}}f=o=v=0,h=d=1,k=z="",l=t;break;case 58:l=1+S(z),v=b;default:if(h<1)if(g==123)--h;else if(g==125&&h++==0&&R()==125)continue;switch(z+=m(g),g*h){case 38:d=o>0?1:(z+="\f",-1);break;case 44:u[f++]=(S(z)-1)*d,d=1;break;case 64:if(U()===45)z+=_(T());p=U(),o=l=S(k=z+=te(V())),g++;break;case 45:if(b===45&&S(z)==2)h=0;}}return s}function fe(e,r,a,c,s,t,u,i,f,o,l,p){var v=s-1;var b=s===0?t:[""];var h=q(b);for(var w=0,d=0,g=0;w<c;++w)for(var k=0,m=M(e,v+1,v=$(d=u[w])),x=e;k<h;++k)if(x=j(d>0?b[k]+" "+m:C(m,/&\f/g,b[k])))f[g++]=x;return L(e,r,a,s===0?n:i,f,o,l,p)}function oe(e,r,a,n){return L(e,r,a,c,m(Q()),M(e,2,-2),0,n)}function le(e,r,a,c,n){return L(e,r,a,s,M(e,0,c),M(e,c+1,-1),c,n)}function pe(c,n,s){switch(y(c,n)){case 5103:return a+"print-"+c+c;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:case 6391:case 5879:case 5623:case 6135:case 4599:return a+c+c;case 4855:return a+c.replace("add","source-over").replace("substract","source-out").replace("intersect","source-in").replace("exclude","xor")+c;case 4789:return r+c+c;case 5349:case 4246:case 4810:case 6968:case 2756:return a+c+r+c+e+c+c;case 5936:switch(A(c,n+11)){case 114:return a+c+e+C(c,/[svh]\w+-[tblr]{2}/,"tb")+c;case 108:return a+c+e+C(c,/[svh]\w+-[tblr]{2}/,"tb-rl")+c;case 45:return a+c+e+C(c,/[svh]\w+-[tblr]{2}/,"lr")+c}case 6828:case 4268:case 2903:return a+c+e+c+c;case 6165:return a+c+e+"flex-"+c+c;case 5187:return a+c+C(c,/(\w+).+(:[^]+)/,a+"box-$1$2"+e+"flex-$1$2")+c;case 5443:return a+c+e+"flex-item-"+C(c,/flex-|-self/g,"")+(!z(c,/flex-|baseline/)?e+"grid-row-"+C(c,/flex-|-self/g,""):"")+c;case 4675:return a+c+e+"flex-line-pack"+C(c,/align-content|flex-|-self/g,"")+c;case 5548:return a+c+e+C(c,"shrink","negative")+c;case 5292:return a+c+e+C(c,"basis","preferred-size")+c;case 6060:return a+"box-"+C(c,"-grow","")+a+c+e+C(c,"grow","positive")+c;case 4554:return a+C(c,/([^-])(transform)/g,"$1"+a+"$2")+c;case 6187:return C(C(C(c,/(zoom-|grab)/,a+"$1"),/(image-set)/,a+"$1"),c,"")+c;case 5495:case 3959:return C(c,/(image-set\([^]*)/,a+"$1"+"$`$1");case 4968:return C(C(c,/(.+:)(flex-)?(.*)/,a+"box-pack:$3"+e+"flex-pack:$3"),/space-between/,"justify")+a+c+c;case 4200:if(!z(c,/flex-|baseline/))return e+"grid-column-align"+M(c,n)+c;break;case 2592:case 3360:return e+C(c,"template-","")+c;case 4384:case 3616:if(s&&s.some((function(e,r){return n=r,z(e.props,/grid-\w+-end/)}))){return ~O(c+(s=s[n].value),"span",0)?c:e+C(c,"-start","")+c+e+"grid-row-span:"+(~O(s,"span",0)?z(s,/\d+/):+z(s,/\d+/)-+z(c,/\d+/))+";"}return e+C(c,"-start","")+c;case 4896:case 4128:return s&&s.some((function(e){return z(e.props,/grid-\w+-start/)}))?c:e+C(C(c,"-end","-span"),"span ","")+c;case 4095:case 3583:case 4068:case 2532:return C(c,/(.+)-inline(.+)/,a+"$1$2")+c;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(S(c)-1-n>6)switch(A(c,n+1)){case 109:if(A(c,n+4)!==45)break;case 102:return C(c,/(.+:)(.+)-([^]+)/,"$1"+a+"$2-$3"+"$1"+r+(A(c,n+3)==108?"$3":"$2-$3"))+c;case 115:return ~O(c,"stretch",0)?pe(C(c,"stretch","fill-available"),n,s)+c:c}break;case 5152:case 5920:return C(c,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(r,a,n,s,t,u,i){return e+a+":"+n+i+(s?e+a+"-span:"+(t?u:+u-+n)+i:"")+c}));case 4949:if(A(c,n+6)===121)return C(c,":",":"+a)+c;break;case 6444:switch(A(c,A(c,14)===45?18:11)){case 120:return C(c,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+a+(A(c,14)===45?"inline-":"")+"box$3"+"$1"+a+"$2$3"+"$1"+e+"$2box$3")+c;case 100:return C(c,":",":"+e)+c}break;case 5719:case 2647:case 2135:case 3927:case 2391:return C(c,"scroll-","scroll-snap-")+c}return c}function ve(e,r){var a="";for(var c=0;c<e.length;c++)a+=r(e[c],c,e,r)||"";return a}function be(e,r,a,t){switch(e.type){case g:if(e.children.length)break;case i:case v:case s:return e.return=e.return||e.value;case c:return "";case b:return e.return=e.value+"{"+ve(e.children,t)+"}";case n:if(!S(e.value=e.props.join(",")))return ""}return S(a=ve(e.children,t))?e.return=e.value+"{"+a+"}":""}function he(e){var r=q(e);return function(a,c,n,s){var t="";for(var u=0;u<r;u++)t+=e[u](a,c,n,s)||"";return t}}function we(e){return function(r){if(!r.root)if(r=r.return)e(r);}}function de(c,t,u,i){if(c.length>-1)if(!c.return)switch(c.type){case s:c.return=pe(c.value,c.length,u);return;case b:return ve([N(c,{value:C(c.value,"@","@"+a)})],i);case n:if(c.length)return D(u=c.props,(function(n){switch(z(n,i=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":P(N(c,{props:[C(n,/:(read-\w+)/,":"+r+"$1")]}));P(N(c,{props:[n]}));x(c,{props:E(u,i)});break;case"::placeholder":P(N(c,{props:[C(n,/:(plac\w+)/,":"+a+"input-$1")]}));P(N(c,{props:[C(n,/:(plac\w+)/,":"+r+"$1")]}));P(N(c,{props:[C(n,/:(plac\w+)/,e+"input-$1")]}));P(N(c,{props:[n]}));x(c,{props:E(u,i)});break}return ""}))}}
|
|
619
577
|
|
|
620
578
|
var SEED$1 = 5381;
|
|
621
579
|
// When we have separate strings it's useful to run a progressive
|
|
@@ -687,7 +645,7 @@
|
|
|
687
645
|
* https://github.com/thysultan/stylis.js/tree/v4.0.2#abstract-syntax-structure
|
|
688
646
|
*/
|
|
689
647
|
var selfReferenceReplacementPlugin = function (element) {
|
|
690
|
-
if (element.type ===
|
|
648
|
+
if (element.type === n && element.value.includes('&')) {
|
|
691
649
|
element.props[0] = element.props[0]
|
|
692
650
|
// catch any hanging references that stylis missed
|
|
693
651
|
.replace(AMP_REGEX, _selector)
|
|
@@ -702,7 +660,7 @@
|
|
|
702
660
|
if (options.prefix) {
|
|
703
661
|
middlewares.push(de);
|
|
704
662
|
}
|
|
705
|
-
middlewares.push(
|
|
663
|
+
middlewares.push(be);
|
|
706
664
|
var stringifyRules = function (css, selector,
|
|
707
665
|
/**
|
|
708
666
|
* This "prefix" referes to a _selector_ prefix.
|
|
@@ -723,7 +681,7 @@
|
|
|
723
681
|
compiled = recursivelySetNamepace(compiled, options.namespace);
|
|
724
682
|
}
|
|
725
683
|
var stack = [];
|
|
726
|
-
|
|
684
|
+
ve(compiled, he(middlewares.concat(we(function (value) { return stack.push(value); }))));
|
|
727
685
|
return stack;
|
|
728
686
|
};
|
|
729
687
|
stringifyRules.hash = plugins.length
|
|
@@ -741,18 +699,46 @@
|
|
|
741
699
|
|
|
742
700
|
var mainSheet = new StyleSheet();
|
|
743
701
|
var mainStylis = createStylisInstance();
|
|
744
|
-
var
|
|
702
|
+
var defaultContextValue = {
|
|
745
703
|
shouldForwardProp: undefined,
|
|
746
704
|
styleSheet: mainSheet,
|
|
747
705
|
stylis: mainStylis,
|
|
748
|
-
}
|
|
706
|
+
};
|
|
707
|
+
// Create context only if createContext is available, otherwise create a fallback
|
|
708
|
+
var StyleSheetContext = !IS_RSC
|
|
709
|
+
? React.createContext(defaultContextValue)
|
|
710
|
+
: {
|
|
711
|
+
Provider: function (_a) {
|
|
712
|
+
var children = _a.children;
|
|
713
|
+
return children;
|
|
714
|
+
},
|
|
715
|
+
Consumer: function (_a) {
|
|
716
|
+
var children = _a.children;
|
|
717
|
+
return children(defaultContextValue);
|
|
718
|
+
},
|
|
719
|
+
};
|
|
749
720
|
var StyleSheetConsumer = StyleSheetContext.Consumer;
|
|
750
|
-
var StylisContext =
|
|
721
|
+
var StylisContext = !IS_RSC
|
|
722
|
+
? React.createContext(undefined)
|
|
723
|
+
: {
|
|
724
|
+
Provider: function (_a) {
|
|
725
|
+
var children = _a.children;
|
|
726
|
+
return children;
|
|
727
|
+
},
|
|
728
|
+
Consumer: function (_a) {
|
|
729
|
+
var children = _a.children;
|
|
730
|
+
return children(undefined);
|
|
731
|
+
},
|
|
732
|
+
};
|
|
751
733
|
function useStyleSheetContext() {
|
|
752
|
-
|
|
734
|
+
// Skip useContext if we're in an RSC environment without context support
|
|
735
|
+
return !IS_RSC && React.useContext ? React.useContext(StyleSheetContext) : defaultContextValue;
|
|
753
736
|
}
|
|
754
737
|
function StyleSheetManager(props) {
|
|
755
|
-
|
|
738
|
+
// In RSC environments without context support, StyleSheetManager becomes a no-op
|
|
739
|
+
if (IS_RSC || !React.useMemo) {
|
|
740
|
+
return props.children;
|
|
741
|
+
}
|
|
756
742
|
var styleSheet = useStyleSheetContext().styleSheet;
|
|
757
743
|
var resolvedStyleSheet = React.useMemo(function () {
|
|
758
744
|
var sheet = styleSheet;
|
|
@@ -770,13 +756,9 @@
|
|
|
770
756
|
var stylis = React.useMemo(function () {
|
|
771
757
|
return createStylisInstance({
|
|
772
758
|
options: { namespace: props.namespace, prefix: props.enableVendorPrefixes },
|
|
773
|
-
plugins:
|
|
759
|
+
plugins: props.stylisPlugins,
|
|
774
760
|
});
|
|
775
|
-
}, [props.enableVendorPrefixes, props.namespace,
|
|
776
|
-
React.useEffect(function () {
|
|
777
|
-
if (!shallowequal(plugins, props.stylisPlugins))
|
|
778
|
-
setPlugins(props.stylisPlugins);
|
|
779
|
-
}, [props.stylisPlugins]);
|
|
761
|
+
}, [props.enableVendorPrefixes, props.namespace, props.stylisPlugins]);
|
|
780
762
|
var styleSheetContextValue = React.useMemo(function () { return ({
|
|
781
763
|
shouldForwardProp: props.shouldForwardProp,
|
|
782
764
|
styleSheet: resolvedStyleSheet,
|
|
@@ -1063,7 +1045,19 @@
|
|
|
1063
1045
|
return GlobalStyle;
|
|
1064
1046
|
}());
|
|
1065
1047
|
|
|
1066
|
-
|
|
1048
|
+
// Create context only if createContext is available, otherwise create a fallback
|
|
1049
|
+
var ThemeContext = !IS_RSC
|
|
1050
|
+
? React.createContext(undefined)
|
|
1051
|
+
: {
|
|
1052
|
+
Provider: function (_a) {
|
|
1053
|
+
var children = _a.children;
|
|
1054
|
+
return children;
|
|
1055
|
+
},
|
|
1056
|
+
Consumer: function (_a) {
|
|
1057
|
+
var children = _a.children;
|
|
1058
|
+
return children(undefined);
|
|
1059
|
+
},
|
|
1060
|
+
};
|
|
1067
1061
|
var ThemeConsumer = ThemeContext.Consumer;
|
|
1068
1062
|
function mergeTheme(theme, outerTheme) {
|
|
1069
1063
|
if (!theme) {
|
|
@@ -1090,7 +1084,8 @@
|
|
|
1090
1084
|
* is no `ThemeProvider` ancestor.
|
|
1091
1085
|
*/
|
|
1092
1086
|
function useTheme() {
|
|
1093
|
-
|
|
1087
|
+
// Skip useContext if we're in an RSC environment without context support
|
|
1088
|
+
var theme = !IS_RSC && React.useContext ? React.useContext(ThemeContext) : undefined;
|
|
1094
1089
|
if (!theme) {
|
|
1095
1090
|
throw throwStyledComponentsError(18);
|
|
1096
1091
|
}
|
|
@@ -1100,6 +1095,10 @@
|
|
|
1100
1095
|
* Provide a theme to an entire react component tree via context
|
|
1101
1096
|
*/
|
|
1102
1097
|
function ThemeProvider(props) {
|
|
1098
|
+
// In RSC environments without context support, ThemeProvider becomes a no-op
|
|
1099
|
+
if (IS_RSC || !React.useContext || !React.useMemo) {
|
|
1100
|
+
return props.children;
|
|
1101
|
+
}
|
|
1103
1102
|
var outerTheme = React.useContext(ThemeContext);
|
|
1104
1103
|
var themeContext = React.useMemo(function () { return mergeTheme(props.theme, outerTheme); }, [props.theme, outerTheme]);
|
|
1105
1104
|
if (!props.children) {
|
|
@@ -1139,9 +1138,12 @@
|
|
|
1139
1138
|
originalConsoleError_1.apply(void 0, __spreadArray([consoleErrorMessage], consoleErrorArgs, false));
|
|
1140
1139
|
}
|
|
1141
1140
|
};
|
|
1142
|
-
// We purposefully call
|
|
1141
|
+
// We purposefully call a hook outside of a component and expect it to throw
|
|
1143
1142
|
// If it doesn't, then we're inside another component.
|
|
1144
|
-
|
|
1143
|
+
// Use useState instead of useRef to avoid importing useRef
|
|
1144
|
+
if (typeof React.useState === 'function') {
|
|
1145
|
+
React.useState(null);
|
|
1146
|
+
}
|
|
1145
1147
|
if (didNotCallInvalidHook_1 && !seen.has(message_1)) {
|
|
1146
1148
|
console.warn(message_1);
|
|
1147
1149
|
seen.add(message_1);
|
|
@@ -1233,27 +1235,54 @@
|
|
|
1233
1235
|
{
|
|
1234
1236
|
checkDynamicCreation(styledComponentId);
|
|
1235
1237
|
}
|
|
1238
|
+
// Use a WeakMap to maintain stable instances per stylesheet
|
|
1239
|
+
var instanceMap = new WeakMap();
|
|
1236
1240
|
var GlobalStyleComponent = function (props) {
|
|
1237
1241
|
var ssc = useStyleSheetContext();
|
|
1238
|
-
var theme = React.useContext(ThemeContext);
|
|
1239
|
-
|
|
1240
|
-
var instance =
|
|
1241
|
-
if (
|
|
1242
|
+
var theme = React.useContext ? React.useContext(ThemeContext) : undefined;
|
|
1243
|
+
// Get or create instance ID for this stylesheet
|
|
1244
|
+
var instance = instanceMap.get(ssc.styleSheet);
|
|
1245
|
+
if (instance === undefined) {
|
|
1246
|
+
instance = ssc.styleSheet.allocateGSInstance(styledComponentId);
|
|
1247
|
+
instanceMap.set(ssc.styleSheet, instance);
|
|
1248
|
+
}
|
|
1249
|
+
if (// @ts-expect-error invariant check
|
|
1250
|
+
React.Children.count(props.children)) {
|
|
1242
1251
|
console.warn("The global style component ".concat(styledComponentId, " was given child JSX. createGlobalStyle does not render children."));
|
|
1243
1252
|
}
|
|
1244
1253
|
if (rules.some(function (rule) { return typeof rule === 'string' && rule.indexOf('@import') !== -1; })) {
|
|
1245
1254
|
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.");
|
|
1246
1255
|
}
|
|
1247
|
-
|
|
1256
|
+
// Render styles during component execution
|
|
1257
|
+
// Use runtime check since false build constant may not match actual environment
|
|
1258
|
+
var shouldRenderStyles = typeof window === 'undefined' || !ssc.styleSheet.server;
|
|
1259
|
+
if (shouldRenderStyles) {
|
|
1248
1260
|
renderStyles(instance, props, ssc.styleSheet, theme, ssc.stylis);
|
|
1249
1261
|
}
|
|
1250
|
-
|
|
1262
|
+
// Client-side cleanup: conditionally use useLayoutEffect
|
|
1263
|
+
// The IS_RSC check is module-level and deterministic, so this doesn't violate rules of hooks
|
|
1264
|
+
if (!IS_RSC && typeof React.useLayoutEffect === 'function') {
|
|
1251
1265
|
React.useLayoutEffect(function () {
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1266
|
+
return function () {
|
|
1267
|
+
globalStyle.removeStyles(instance, ssc.styleSheet);
|
|
1268
|
+
};
|
|
1269
|
+
}, [instance, ssc.styleSheet]);
|
|
1270
|
+
}
|
|
1271
|
+
// RSC mode: output style tag
|
|
1272
|
+
if (IS_RSC) {
|
|
1273
|
+
var id = styledComponentId + instance;
|
|
1274
|
+
var css_1 = typeof window === 'undefined' ? ssc.styleSheet.getTag().getGroup(getGroupForId(id)) : '';
|
|
1275
|
+
if (css_1) {
|
|
1276
|
+
var cssHash = generateAlphabeticName(hash(css_1) >>> 0);
|
|
1277
|
+
var href = "sc-global-".concat(styledComponentId, "-").concat(instance, "-").concat(cssHash);
|
|
1278
|
+
return React.createElement('style', {
|
|
1279
|
+
key: href,
|
|
1280
|
+
'data-styled-global': styledComponentId,
|
|
1281
|
+
precedence: 'styled-components',
|
|
1282
|
+
href: href,
|
|
1283
|
+
children: css_1,
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1257
1286
|
}
|
|
1258
1287
|
return null;
|
|
1259
1288
|
};
|
|
@@ -1391,12 +1420,12 @@
|
|
|
1391
1420
|
|
|
1392
1421
|
function withTheme(Component) {
|
|
1393
1422
|
var WithTheme = React.forwardRef(function (props, ref) {
|
|
1394
|
-
var theme = React.useContext(ThemeContext);
|
|
1423
|
+
var theme = React.useContext ? React.useContext(ThemeContext) : undefined;
|
|
1395
1424
|
var themeProp = determineTheme(props, theme, Component.defaultProps);
|
|
1396
1425
|
if (themeProp === undefined) {
|
|
1397
1426
|
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), "\""));
|
|
1398
1427
|
}
|
|
1399
|
-
return React.createElement(Component, __assign({}, props, { theme: themeProp, ref: ref }));
|
|
1428
|
+
return React.createElement(Component, __assign(__assign({}, props), { theme: themeProp, ref: ref }));
|
|
1400
1429
|
});
|
|
1401
1430
|
WithTheme.displayName = "WithTheme(".concat(getComponentName(Component), ")");
|
|
1402
1431
|
return hoistNonReactStatics(WithTheme, Component);
|
|
@@ -1458,7 +1487,6 @@
|
|
|
1458
1487
|
}
|
|
1459
1488
|
return React.createElement(StyleSheetManager, { sheet: this.instance }, children);
|
|
1460
1489
|
};
|
|
1461
|
-
// @ts-expect-error alternate return types are not possible due to code transformation
|
|
1462
1490
|
ServerStyleSheet.prototype.interleaveWithNodeStream = function (input) {
|
|
1463
1491
|
{
|
|
1464
1492
|
throw throwStyledComponentsError(3);
|
|
@@ -1485,7 +1513,7 @@
|
|
|
1485
1513
|
window[windowGlobalKey] || (window[windowGlobalKey] = 0);
|
|
1486
1514
|
// @ts-expect-error dynamic key not in window object
|
|
1487
1515
|
if (window[windowGlobalKey] === 1) {
|
|
1488
|
-
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://
|
|
1516
|
+
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://styled-components.com/docs/faqs#why-am-i-getting-a-warning-about-several-instances-of-module-on-the-page for more info.");
|
|
1489
1517
|
}
|
|
1490
1518
|
// @ts-expect-error dynamic key not in window object
|
|
1491
1519
|
window[windowGlobalKey] += 1;
|
|
@@ -1556,7 +1584,6 @@
|
|
|
1556
1584
|
};
|
|
1557
1585
|
});
|
|
1558
1586
|
|
|
1559
|
-
// Thanks to ReactDOMFactories for this handy list!
|
|
1560
1587
|
var elements = [
|
|
1561
1588
|
'a',
|
|
1562
1589
|
'abbr',
|
|
@@ -1566,13 +1593,10 @@
|
|
|
1566
1593
|
'aside',
|
|
1567
1594
|
'audio',
|
|
1568
1595
|
'b',
|
|
1569
|
-
'base',
|
|
1570
1596
|
'bdi',
|
|
1571
1597
|
'bdo',
|
|
1572
|
-
'big',
|
|
1573
1598
|
'blockquote',
|
|
1574
1599
|
'body',
|
|
1575
|
-
'br',
|
|
1576
1600
|
'button',
|
|
1577
1601
|
'canvas',
|
|
1578
1602
|
'caption',
|
|
@@ -1613,27 +1637,21 @@
|
|
|
1613
1637
|
'input',
|
|
1614
1638
|
'ins',
|
|
1615
1639
|
'kbd',
|
|
1616
|
-
'keygen',
|
|
1617
1640
|
'label',
|
|
1618
1641
|
'legend',
|
|
1619
1642
|
'li',
|
|
1620
|
-
'link',
|
|
1621
1643
|
'main',
|
|
1622
1644
|
'map',
|
|
1623
1645
|
'mark',
|
|
1624
1646
|
'menu',
|
|
1625
|
-
'menuitem',
|
|
1626
|
-
'meta',
|
|
1627
1647
|
'meter',
|
|
1628
1648
|
'nav',
|
|
1629
|
-
'noscript',
|
|
1630
1649
|
'object',
|
|
1631
1650
|
'ol',
|
|
1632
1651
|
'optgroup',
|
|
1633
1652
|
'option',
|
|
1634
1653
|
'output',
|
|
1635
1654
|
'p',
|
|
1636
|
-
'param',
|
|
1637
1655
|
'picture',
|
|
1638
1656
|
'pre',
|
|
1639
1657
|
'progress',
|
|
@@ -1643,37 +1661,61 @@
|
|
|
1643
1661
|
'ruby',
|
|
1644
1662
|
's',
|
|
1645
1663
|
'samp',
|
|
1646
|
-
'
|
|
1664
|
+
'search',
|
|
1647
1665
|
'section',
|
|
1648
1666
|
'select',
|
|
1667
|
+
'slot',
|
|
1649
1668
|
'small',
|
|
1650
|
-
'source',
|
|
1651
1669
|
'span',
|
|
1652
1670
|
'strong',
|
|
1653
|
-
'style',
|
|
1654
1671
|
'sub',
|
|
1655
1672
|
'summary',
|
|
1656
1673
|
'sup',
|
|
1657
1674
|
'table',
|
|
1658
1675
|
'tbody',
|
|
1659
1676
|
'td',
|
|
1677
|
+
'template',
|
|
1660
1678
|
'textarea',
|
|
1661
1679
|
'tfoot',
|
|
1662
1680
|
'th',
|
|
1663
1681
|
'thead',
|
|
1664
1682
|
'time',
|
|
1665
1683
|
'tr',
|
|
1666
|
-
'track',
|
|
1667
1684
|
'u',
|
|
1668
1685
|
'ul',
|
|
1669
|
-
'use',
|
|
1670
1686
|
'var',
|
|
1671
1687
|
'video',
|
|
1672
|
-
'wbr',
|
|
1688
|
+
'wbr',
|
|
1673
1689
|
'circle',
|
|
1674
1690
|
'clipPath',
|
|
1675
1691
|
'defs',
|
|
1676
1692
|
'ellipse',
|
|
1693
|
+
'feBlend',
|
|
1694
|
+
'feColorMatrix',
|
|
1695
|
+
'feComponentTransfer',
|
|
1696
|
+
'feComposite',
|
|
1697
|
+
'feConvolveMatrix',
|
|
1698
|
+
'feDiffuseLighting',
|
|
1699
|
+
'feDisplacementMap',
|
|
1700
|
+
'feDistantLight',
|
|
1701
|
+
'feDropShadow',
|
|
1702
|
+
'feFlood',
|
|
1703
|
+
'feFuncA',
|
|
1704
|
+
'feFuncB',
|
|
1705
|
+
'feFuncG',
|
|
1706
|
+
'feFuncR',
|
|
1707
|
+
'feGaussianBlur',
|
|
1708
|
+
'feImage',
|
|
1709
|
+
'feMerge',
|
|
1710
|
+
'feMergeNode',
|
|
1711
|
+
'feMorphology',
|
|
1712
|
+
'feOffset',
|
|
1713
|
+
'fePointLight',
|
|
1714
|
+
'feSpecularLighting',
|
|
1715
|
+
'feSpotLight',
|
|
1716
|
+
'feTile',
|
|
1717
|
+
'feTurbulence',
|
|
1718
|
+
'filter',
|
|
1677
1719
|
'foreignObject',
|
|
1678
1720
|
'g',
|
|
1679
1721
|
'image',
|
|
@@ -1689,8 +1731,12 @@
|
|
|
1689
1731
|
'rect',
|
|
1690
1732
|
'stop',
|
|
1691
1733
|
'svg',
|
|
1734
|
+
'switch',
|
|
1735
|
+
'symbol',
|
|
1692
1736
|
'text',
|
|
1737
|
+
'textPath',
|
|
1693
1738
|
'tspan',
|
|
1739
|
+
'use',
|
|
1694
1740
|
];
|
|
1695
1741
|
var domElements = new Set(elements);
|
|
1696
1742
|
|
|
@@ -1773,7 +1819,7 @@
|
|
|
1773
1819
|
}
|
|
1774
1820
|
ComponentStyle.prototype.generateAndInjectStyles = function (executionContext, styleSheet, stylis) {
|
|
1775
1821
|
var names = this.baseStyle
|
|
1776
|
-
? this.baseStyle.generateAndInjectStyles(executionContext, styleSheet, stylis)
|
|
1822
|
+
? this.baseStyle.generateAndInjectStyles(executionContext, styleSheet, stylis).className
|
|
1777
1823
|
: '';
|
|
1778
1824
|
// force dynamic classnames if user-supplied stylis plugins are in use
|
|
1779
1825
|
if (this.isStatic && !stylis.hash) {
|
|
@@ -1810,12 +1856,17 @@
|
|
|
1810
1856
|
if (css) {
|
|
1811
1857
|
var name_2 = generateAlphabeticName(dynamicHash >>> 0);
|
|
1812
1858
|
if (!styleSheet.hasNameForId(this.componentId, name_2)) {
|
|
1813
|
-
|
|
1859
|
+
var cssFormatted = stylis(css, ".".concat(name_2), undefined, this.componentId);
|
|
1860
|
+
styleSheet.insertRules(this.componentId, name_2, cssFormatted);
|
|
1814
1861
|
}
|
|
1815
1862
|
names = joinStrings(names, name_2);
|
|
1816
1863
|
}
|
|
1817
1864
|
}
|
|
1818
|
-
|
|
1865
|
+
// Retrieve CSS from Tag for RSC rendering
|
|
1866
|
+
var generatedCSS = typeof window === 'undefined'
|
|
1867
|
+
? styleSheet.getTag().getGroup(getGroupForId(this.componentId))
|
|
1868
|
+
: '';
|
|
1869
|
+
return { className: names, css: generatedCSS };
|
|
1819
1870
|
};
|
|
1820
1871
|
return ComponentStyle;
|
|
1821
1872
|
}());
|
|
@@ -1834,9 +1885,11 @@
|
|
|
1834
1885
|
}
|
|
1835
1886
|
function useInjectedStyle(componentStyle, resolvedAttrs) {
|
|
1836
1887
|
var ssc = useStyleSheetContext();
|
|
1837
|
-
var
|
|
1838
|
-
React.useDebugValue
|
|
1839
|
-
|
|
1888
|
+
var result = componentStyle.generateAndInjectStyles(resolvedAttrs, ssc.styleSheet, ssc.stylis);
|
|
1889
|
+
if (React.useDebugValue) {
|
|
1890
|
+
React.useDebugValue(result.className);
|
|
1891
|
+
}
|
|
1892
|
+
return result;
|
|
1840
1893
|
}
|
|
1841
1894
|
function resolveContext(attrs, props, theme) {
|
|
1842
1895
|
var context = __assign(__assign({}, props), {
|
|
@@ -1847,14 +1900,19 @@
|
|
|
1847
1900
|
attrDef = attrs[i];
|
|
1848
1901
|
var resolvedAttrDef = isFunction(attrDef) ? attrDef(context) : attrDef;
|
|
1849
1902
|
for (var key in resolvedAttrDef) {
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1903
|
+
if (key === 'className') {
|
|
1904
|
+
context.className = joinStrings(context.className, resolvedAttrDef[key]);
|
|
1905
|
+
}
|
|
1906
|
+
else if (key === 'style') {
|
|
1907
|
+
context.style = __assign(__assign({}, context.style), resolvedAttrDef[key]);
|
|
1908
|
+
}
|
|
1909
|
+
else {
|
|
1910
|
+
// @ts-expect-error attrs can dynamically add arbitrary properties
|
|
1911
|
+
context[key] = resolvedAttrDef[key];
|
|
1912
|
+
}
|
|
1855
1913
|
}
|
|
1856
1914
|
}
|
|
1857
|
-
if (props.className) {
|
|
1915
|
+
if ('className' in props && typeof props.className === 'string') {
|
|
1858
1916
|
context.className = joinStrings(context.className, props.className);
|
|
1859
1917
|
}
|
|
1860
1918
|
return context;
|
|
@@ -1862,10 +1920,12 @@
|
|
|
1862
1920
|
var seenUnknownProps = new Set();
|
|
1863
1921
|
function useStyledComponentImpl(forwardedComponent, props, forwardedRef) {
|
|
1864
1922
|
var componentAttrs = forwardedComponent.attrs, componentStyle = forwardedComponent.componentStyle, defaultProps = forwardedComponent.defaultProps, foldedComponentIds = forwardedComponent.foldedComponentIds, styledComponentId = forwardedComponent.styledComponentId, target = forwardedComponent.target;
|
|
1865
|
-
var contextTheme = React.useContext(ThemeContext);
|
|
1923
|
+
var contextTheme = React.useContext ? React.useContext(ThemeContext) : undefined;
|
|
1866
1924
|
var ssc = useStyleSheetContext();
|
|
1867
1925
|
var shouldForwardProp = forwardedComponent.shouldForwardProp || ssc.shouldForwardProp;
|
|
1868
|
-
React.useDebugValue
|
|
1926
|
+
if (React.useDebugValue) {
|
|
1927
|
+
React.useDebugValue(styledComponentId);
|
|
1928
|
+
}
|
|
1869
1929
|
// NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
|
|
1870
1930
|
// but that'd be against the rules-of-hooks. We could be naughty and do it anyway as it
|
|
1871
1931
|
// should be an immutable value, but behave for now.
|
|
@@ -1874,12 +1934,14 @@
|
|
|
1874
1934
|
var elementToBeCreated = context.as || target;
|
|
1875
1935
|
var propsForElement = {};
|
|
1876
1936
|
for (var key in context) {
|
|
1937
|
+
// @ts-expect-error context may have arbitrary properties from attrs
|
|
1877
1938
|
if (context[key] === undefined) ;
|
|
1878
1939
|
else if (key[0] === '$' || key === 'as' || (key === 'theme' && context.theme === theme)) ;
|
|
1879
1940
|
else if (key === 'forwardedAs') {
|
|
1880
1941
|
propsForElement.as = context.forwardedAs;
|
|
1881
1942
|
}
|
|
1882
1943
|
else if (!shouldForwardProp || shouldForwardProp(key, elementToBeCreated)) {
|
|
1944
|
+
// @ts-expect-error context may have arbitrary properties from attrs
|
|
1883
1945
|
propsForElement[key] = context[key];
|
|
1884
1946
|
if (!shouldForwardProp &&
|
|
1885
1947
|
"development" === 'development' &&
|
|
@@ -1892,7 +1954,7 @@
|
|
|
1892
1954
|
}
|
|
1893
1955
|
}
|
|
1894
1956
|
}
|
|
1895
|
-
var
|
|
1957
|
+
var _a = useInjectedStyle(componentStyle, context), generatedClassName = _a.className, css = _a.css;
|
|
1896
1958
|
if (forwardedComponent.warnTooManyClasses) {
|
|
1897
1959
|
forwardedComponent.warnTooManyClasses(generatedClassName);
|
|
1898
1960
|
}
|
|
@@ -1915,7 +1977,17 @@
|
|
|
1915
1977
|
if (forwardedRef) {
|
|
1916
1978
|
propsForElement.ref = forwardedRef;
|
|
1917
1979
|
}
|
|
1918
|
-
|
|
1980
|
+
var element = React.createElement(elementToBeCreated, propsForElement);
|
|
1981
|
+
// RSC mode: output style tag alongside element
|
|
1982
|
+
// React 19's style hoisting will deduplicate by href and move to <head>
|
|
1983
|
+
if (IS_RSC && css) {
|
|
1984
|
+
return React.createElement(React.Fragment, null, React.createElement('style', {
|
|
1985
|
+
precedence: 'styled-components',
|
|
1986
|
+
href: "sc-".concat(styledComponentId, "-").concat(generatedClassName),
|
|
1987
|
+
children: css,
|
|
1988
|
+
}), element);
|
|
1989
|
+
}
|
|
1990
|
+
return element;
|
|
1919
1991
|
}
|
|
1920
1992
|
function createStyledComponent(target, options, rules) {
|
|
1921
1993
|
var isTargetStyledComp = isStyledComponent(target);
|