styled-components 6.2.0 → 6.3.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.
Files changed (94) hide show
  1. package/README.md +2 -1
  2. package/dist/styled-components.browser.cjs.js +1 -1
  3. package/dist/styled-components.browser.cjs.js.map +1 -1
  4. package/dist/styled-components.browser.esm.js +1 -1
  5. package/dist/styled-components.browser.esm.js.map +1 -1
  6. package/dist/styled-components.cjs.js +1 -1
  7. package/dist/styled-components.cjs.js.map +1 -1
  8. package/dist/styled-components.esm.js +1 -1
  9. package/dist/styled-components.esm.js.map +1 -1
  10. package/dist/styled-components.js +169 -102
  11. package/dist/styled-components.js.map +1 -1
  12. package/dist/styled-components.min.js +1 -1
  13. package/dist/styled-components.min.js.map +1 -1
  14. package/native/dist/constants.d.ts +5 -0
  15. package/native/dist/dist/constants.d.ts +5 -0
  16. package/native/dist/dist/index.d.ts +2 -2
  17. package/native/dist/dist/models/ComponentStyle.d.ts +4 -1
  18. package/native/dist/dist/sheet/Tag.d.ts +4 -4
  19. package/native/dist/dist/test/utils.d.ts +32 -13
  20. package/native/dist/dist/types.d.ts +11 -3
  21. package/native/dist/dist/utils/domElements.d.ts +2 -2
  22. package/native/dist/index.d.ts +2 -2
  23. package/native/dist/models/ComponentStyle.d.ts +4 -1
  24. package/native/dist/sheet/Tag.d.ts +4 -4
  25. package/native/dist/styled-components.native.cjs.js +1 -1
  26. package/native/dist/styled-components.native.cjs.js.map +1 -1
  27. package/native/dist/styled-components.native.esm.js +1 -1
  28. package/native/dist/styled-components.native.esm.js.map +1 -1
  29. package/native/dist/test/utils.d.ts +32 -13
  30. package/native/dist/types.d.ts +11 -3
  31. package/native/dist/utils/domElements.d.ts +2 -2
  32. package/package.json +19 -20
  33. package/dist/base.d.ts +0 -12
  34. package/dist/constants.d.ts +0 -8
  35. package/dist/constructors/constructWithOptions.d.ts +0 -17
  36. package/dist/constructors/createGlobalStyle.d.ts +0 -3
  37. package/dist/constructors/css.d.ts +0 -4
  38. package/dist/constructors/keyframes.d.ts +0 -3
  39. package/dist/constructors/styled.d.ts +0 -17
  40. package/dist/hoc/withTheme.d.ts +0 -4
  41. package/dist/index-standalone.d.ts +0 -2
  42. package/dist/index.d.ts +0 -4
  43. package/dist/models/ComponentStyle.d.ts +0 -15
  44. package/dist/models/GlobalStyle.d.ts +0 -11
  45. package/dist/models/InlineStyle.d.ts +0 -7
  46. package/dist/models/Keyframes.d.ts +0 -10
  47. package/dist/models/ServerStyleSheet.d.ts +0 -15
  48. package/dist/models/StyleSheetManager.d.ts +0 -65
  49. package/dist/models/StyledComponent.d.ts +0 -3
  50. package/dist/models/StyledNativeComponent.d.ts +0 -3
  51. package/dist/models/ThemeProvider.d.ts +0 -47
  52. package/dist/native/index.d.ts +0 -19
  53. package/dist/secretInternals.d.ts +0 -5
  54. package/dist/sheet/GroupIDAllocator.d.ts +0 -4
  55. package/dist/sheet/GroupedTag.d.ts +0 -11
  56. package/dist/sheet/Rehydration.d.ts +0 -3
  57. package/dist/sheet/Sheet.d.ts +0 -40
  58. package/dist/sheet/Tag.d.ts +0 -55
  59. package/dist/sheet/dom.d.ts +0 -5
  60. package/dist/sheet/index.d.ts +0 -1
  61. package/dist/sheet/types.d.ts +0 -36
  62. package/dist/test/globals.d.ts +0 -2
  63. package/dist/test/utils.d.ts +0 -144
  64. package/dist/test/veryLargeUnionType.d.ts +0 -1
  65. package/dist/types.d.ts +0 -204
  66. package/dist/utils/addUnitIfNeeded.d.ts +0 -1
  67. package/dist/utils/checkDynamicCreation.d.ts +0 -1
  68. package/dist/utils/createWarnTooManyClasses.d.ts +0 -3
  69. package/dist/utils/determineTheme.d.ts +0 -4
  70. package/dist/utils/domElements.d.ts +0 -4
  71. package/dist/utils/empties.d.ts +0 -3
  72. package/dist/utils/error.d.ts +0 -5
  73. package/dist/utils/errors.d.ts +0 -21
  74. package/dist/utils/escape.d.ts +0 -5
  75. package/dist/utils/flatten.d.ts +0 -4
  76. package/dist/utils/generateAlphabeticName.d.ts +0 -1
  77. package/dist/utils/generateComponentId.d.ts +0 -1
  78. package/dist/utils/generateDisplayName.d.ts +0 -2
  79. package/dist/utils/getComponentName.d.ts +0 -2
  80. package/dist/utils/hash.d.ts +0 -3
  81. package/dist/utils/hoist.d.ts +0 -51
  82. package/dist/utils/hyphenateStyleName.d.ts +0 -14
  83. package/dist/utils/interleave.d.ts +0 -2
  84. package/dist/utils/isFunction.d.ts +0 -1
  85. package/dist/utils/isPlainObject.d.ts +0 -1
  86. package/dist/utils/isStatelessFunction.d.ts +0 -1
  87. package/dist/utils/isStaticRules.d.ts +0 -2
  88. package/dist/utils/isStyledComponent.d.ts +0 -2
  89. package/dist/utils/isTag.d.ts +0 -2
  90. package/dist/utils/joinStrings.d.ts +0 -5
  91. package/dist/utils/mixinDeep.d.ts +0 -6
  92. package/dist/utils/nonce.d.ts +0 -1
  93. package/dist/utils/setToString.d.ts +0 -17
  94. 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.2.0";
13
+ var SC_VERSION = "6.3.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' &&
@@ -47,7 +52,7 @@
47
52
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
48
53
  PERFORMANCE OF THIS SOFTWARE.
49
54
  ***************************************************************************** */
50
- /* global Reflect, Promise, SuppressedError, Symbol */
55
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
51
56
 
52
57
 
53
58
  var __assign = function() {
@@ -568,53 +573,6 @@
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
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;
@@ -741,18 +699,46 @@
741
699
 
742
700
  var mainSheet = new StyleSheet();
743
701
  var mainStylis = createStylisInstance();
744
- var StyleSheetContext = React.createContext({
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 = React.createContext(undefined);
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
- return React.useContext(StyleSheetContext);
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
- var _a = React.useState(props.stylisPlugins), plugins = _a[0], setPlugins = _a[1];
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: plugins,
759
+ plugins: props.stylisPlugins,
774
760
  });
775
- }, [props.enableVendorPrefixes, props.namespace, plugins]);
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,
@@ -844,6 +826,7 @@
844
826
  opacity: 1,
845
827
  order: 1,
846
828
  orphans: 1,
829
+ scale: 1,
847
830
  tabSize: 1,
848
831
  widows: 1,
849
832
  zIndex: 1,
@@ -1063,7 +1046,19 @@
1063
1046
  return GlobalStyle;
1064
1047
  }());
1065
1048
 
1066
- var ThemeContext = React.createContext(undefined);
1049
+ // Create context only if createContext is available, otherwise create a fallback
1050
+ var ThemeContext = !IS_RSC
1051
+ ? React.createContext(undefined)
1052
+ : {
1053
+ Provider: function (_a) {
1054
+ var children = _a.children;
1055
+ return children;
1056
+ },
1057
+ Consumer: function (_a) {
1058
+ var children = _a.children;
1059
+ return children(undefined);
1060
+ },
1061
+ };
1067
1062
  var ThemeConsumer = ThemeContext.Consumer;
1068
1063
  function mergeTheme(theme, outerTheme) {
1069
1064
  if (!theme) {
@@ -1090,7 +1085,8 @@
1090
1085
  * is no `ThemeProvider` ancestor.
1091
1086
  */
1092
1087
  function useTheme() {
1093
- var theme = React.useContext(ThemeContext);
1088
+ // Skip useContext if we're in an RSC environment without context support
1089
+ var theme = !IS_RSC && React.useContext ? React.useContext(ThemeContext) : undefined;
1094
1090
  if (!theme) {
1095
1091
  throw throwStyledComponentsError(18);
1096
1092
  }
@@ -1100,6 +1096,10 @@
1100
1096
  * Provide a theme to an entire react component tree via context
1101
1097
  */
1102
1098
  function ThemeProvider(props) {
1099
+ // In RSC environments without context support, ThemeProvider becomes a no-op
1100
+ if (IS_RSC || !React.useContext || !React.useMemo) {
1101
+ return props.children;
1102
+ }
1103
1103
  var outerTheme = React.useContext(ThemeContext);
1104
1104
  var themeContext = React.useMemo(function () { return mergeTheme(props.theme, outerTheme); }, [props.theme, outerTheme]);
1105
1105
  if (!props.children) {
@@ -1139,9 +1139,12 @@
1139
1139
  originalConsoleError_1.apply(void 0, __spreadArray([consoleErrorMessage], consoleErrorArgs, false));
1140
1140
  }
1141
1141
  };
1142
- // We purposefully call `useRef` outside of a component and expect it to throw
1142
+ // We purposefully call a hook outside of a component and expect it to throw
1143
1143
  // If it doesn't, then we're inside another component.
1144
- React.useRef();
1144
+ // Use useState instead of useRef to avoid importing useRef
1145
+ if (typeof React.useState === 'function') {
1146
+ React.useState(null);
1147
+ }
1145
1148
  if (didNotCallInvalidHook_1 && !seen.has(message_1)) {
1146
1149
  console.warn(message_1);
1147
1150
  seen.add(message_1);
@@ -1233,11 +1236,17 @@
1233
1236
  {
1234
1237
  checkDynamicCreation(styledComponentId);
1235
1238
  }
1239
+ // Use a WeakMap to maintain stable instances per stylesheet
1240
+ var instanceMap = new WeakMap();
1236
1241
  var GlobalStyleComponent = function (props) {
1237
1242
  var ssc = useStyleSheetContext();
1238
- var theme = React.useContext(ThemeContext);
1239
- var instanceRef = React.useRef(ssc.styleSheet.allocateGSInstance(styledComponentId));
1240
- var instance = instanceRef.current;
1243
+ var theme = React.useContext ? React.useContext(ThemeContext) : undefined;
1244
+ // Get or create instance ID for this stylesheet
1245
+ var instance = instanceMap.get(ssc.styleSheet);
1246
+ if (instance === undefined) {
1247
+ instance = ssc.styleSheet.allocateGSInstance(styledComponentId);
1248
+ instanceMap.set(ssc.styleSheet, instance);
1249
+ }
1241
1250
  if (// @ts-expect-error invariant check
1242
1251
  React.Children.count(props.children)) {
1243
1252
  console.warn("The global style component ".concat(styledComponentId, " was given child JSX. createGlobalStyle does not render children."));
@@ -1245,16 +1254,36 @@
1245
1254
  if (rules.some(function (rule) { return typeof rule === 'string' && rule.indexOf('@import') !== -1; })) {
1246
1255
  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.");
1247
1256
  }
1248
- if (ssc.styleSheet.server) {
1257
+ // Render styles during component execution
1258
+ // Use runtime check since false build constant may not match actual environment
1259
+ var shouldRenderStyles = typeof window === 'undefined' || !ssc.styleSheet.server;
1260
+ if (shouldRenderStyles) {
1249
1261
  renderStyles(instance, props, ssc.styleSheet, theme, ssc.stylis);
1250
1262
  }
1251
- {
1263
+ // Client-side cleanup: conditionally use useLayoutEffect
1264
+ // The IS_RSC check is module-level and deterministic, so this doesn't violate rules of hooks
1265
+ if (!IS_RSC && typeof React.useLayoutEffect === 'function') {
1252
1266
  React.useLayoutEffect(function () {
1253
- if (!ssc.styleSheet.server) {
1254
- renderStyles(instance, props, ssc.styleSheet, theme, ssc.stylis);
1255
- return function () { return globalStyle.removeStyles(instance, ssc.styleSheet); };
1256
- }
1257
- }, [instance, props, ssc.styleSheet, theme, ssc.stylis]);
1267
+ return function () {
1268
+ globalStyle.removeStyles(instance, ssc.styleSheet);
1269
+ };
1270
+ }, [instance, ssc.styleSheet]);
1271
+ }
1272
+ // RSC mode: output style tag
1273
+ if (IS_RSC) {
1274
+ var id = styledComponentId + instance;
1275
+ var css_1 = typeof window === 'undefined' ? ssc.styleSheet.getTag().getGroup(getGroupForId(id)) : '';
1276
+ if (css_1) {
1277
+ var cssHash = generateAlphabeticName(hash(css_1) >>> 0);
1278
+ var href = "sc-global-".concat(styledComponentId, "-").concat(instance, "-").concat(cssHash);
1279
+ return React.createElement('style', {
1280
+ key: href,
1281
+ 'data-styled-global': styledComponentId,
1282
+ precedence: 'styled-components',
1283
+ href: href,
1284
+ children: css_1,
1285
+ });
1286
+ }
1258
1287
  }
1259
1288
  return null;
1260
1289
  };
@@ -1392,7 +1421,7 @@
1392
1421
 
1393
1422
  function withTheme(Component) {
1394
1423
  var WithTheme = React.forwardRef(function (props, ref) {
1395
- var theme = React.useContext(ThemeContext);
1424
+ var theme = React.useContext ? React.useContext(ThemeContext) : undefined;
1396
1425
  var themeProp = determineTheme(props, theme, Component.defaultProps);
1397
1426
  if (themeProp === undefined) {
1398
1427
  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), "\""));
@@ -1518,7 +1547,8 @@
1518
1547
  };
1519
1548
  }
1520
1549
 
1521
- var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
1550
+ // eslint-disable-next-line no-undef
1551
+ var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
1522
1552
 
1523
1553
  var isPropValid = /* #__PURE__ */memoize(function (prop) {
1524
1554
  return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
@@ -1556,7 +1586,6 @@
1556
1586
  };
1557
1587
  });
1558
1588
 
1559
- // Thanks to ReactDOMFactories for this handy list!
1560
1589
  var elements = [
1561
1590
  'a',
1562
1591
  'abbr',
@@ -1566,13 +1595,10 @@
1566
1595
  'aside',
1567
1596
  'audio',
1568
1597
  'b',
1569
- 'base',
1570
1598
  'bdi',
1571
1599
  'bdo',
1572
- 'big',
1573
1600
  'blockquote',
1574
1601
  'body',
1575
- 'br',
1576
1602
  'button',
1577
1603
  'canvas',
1578
1604
  'caption',
@@ -1613,27 +1639,21 @@
1613
1639
  'input',
1614
1640
  'ins',
1615
1641
  'kbd',
1616
- 'keygen',
1617
1642
  'label',
1618
1643
  'legend',
1619
1644
  'li',
1620
- 'link',
1621
1645
  'main',
1622
1646
  'map',
1623
1647
  'mark',
1624
1648
  'menu',
1625
- 'menuitem',
1626
- 'meta',
1627
1649
  'meter',
1628
1650
  'nav',
1629
- 'noscript',
1630
1651
  'object',
1631
1652
  'ol',
1632
1653
  'optgroup',
1633
1654
  'option',
1634
1655
  'output',
1635
1656
  'p',
1636
- 'param',
1637
1657
  'picture',
1638
1658
  'pre',
1639
1659
  'progress',
@@ -1643,37 +1663,61 @@
1643
1663
  'ruby',
1644
1664
  's',
1645
1665
  'samp',
1646
- 'script',
1666
+ 'search',
1647
1667
  'section',
1648
1668
  'select',
1669
+ 'slot',
1649
1670
  'small',
1650
- 'source',
1651
1671
  'span',
1652
1672
  'strong',
1653
- 'style',
1654
1673
  'sub',
1655
1674
  'summary',
1656
1675
  'sup',
1657
1676
  'table',
1658
1677
  'tbody',
1659
1678
  'td',
1679
+ 'template',
1660
1680
  'textarea',
1661
1681
  'tfoot',
1662
1682
  'th',
1663
1683
  'thead',
1664
1684
  'time',
1665
1685
  'tr',
1666
- 'track',
1667
1686
  'u',
1668
1687
  'ul',
1669
- 'use',
1670
1688
  'var',
1671
1689
  'video',
1672
- 'wbr', // SVG
1690
+ 'wbr',
1673
1691
  'circle',
1674
1692
  'clipPath',
1675
1693
  'defs',
1676
1694
  'ellipse',
1695
+ 'feBlend',
1696
+ 'feColorMatrix',
1697
+ 'feComponentTransfer',
1698
+ 'feComposite',
1699
+ 'feConvolveMatrix',
1700
+ 'feDiffuseLighting',
1701
+ 'feDisplacementMap',
1702
+ 'feDistantLight',
1703
+ 'feDropShadow',
1704
+ 'feFlood',
1705
+ 'feFuncA',
1706
+ 'feFuncB',
1707
+ 'feFuncG',
1708
+ 'feFuncR',
1709
+ 'feGaussianBlur',
1710
+ 'feImage',
1711
+ 'feMerge',
1712
+ 'feMergeNode',
1713
+ 'feMorphology',
1714
+ 'feOffset',
1715
+ 'fePointLight',
1716
+ 'feSpecularLighting',
1717
+ 'feSpotLight',
1718
+ 'feTile',
1719
+ 'feTurbulence',
1720
+ 'filter',
1677
1721
  'foreignObject',
1678
1722
  'g',
1679
1723
  'image',
@@ -1689,8 +1733,12 @@
1689
1733
  'rect',
1690
1734
  'stop',
1691
1735
  'svg',
1736
+ 'switch',
1737
+ 'symbol',
1692
1738
  'text',
1739
+ 'textPath',
1693
1740
  'tspan',
1741
+ 'use',
1694
1742
  ];
1695
1743
  var domElements = new Set(elements);
1696
1744
 
@@ -1773,7 +1821,7 @@
1773
1821
  }
1774
1822
  ComponentStyle.prototype.generateAndInjectStyles = function (executionContext, styleSheet, stylis) {
1775
1823
  var names = this.baseStyle
1776
- ? this.baseStyle.generateAndInjectStyles(executionContext, styleSheet, stylis)
1824
+ ? this.baseStyle.generateAndInjectStyles(executionContext, styleSheet, stylis).className
1777
1825
  : '';
1778
1826
  // force dynamic classnames if user-supplied stylis plugins are in use
1779
1827
  if (this.isStatic && !stylis.hash) {
@@ -1810,12 +1858,17 @@
1810
1858
  if (css) {
1811
1859
  var name_2 = generateAlphabeticName(dynamicHash >>> 0);
1812
1860
  if (!styleSheet.hasNameForId(this.componentId, name_2)) {
1813
- styleSheet.insertRules(this.componentId, name_2, stylis(css, ".".concat(name_2), undefined, this.componentId));
1861
+ var cssFormatted = stylis(css, ".".concat(name_2), undefined, this.componentId);
1862
+ styleSheet.insertRules(this.componentId, name_2, cssFormatted);
1814
1863
  }
1815
1864
  names = joinStrings(names, name_2);
1816
1865
  }
1817
1866
  }
1818
- return names;
1867
+ // Retrieve CSS from Tag for RSC rendering
1868
+ var generatedCSS = typeof window === 'undefined'
1869
+ ? styleSheet.getTag().getGroup(getGroupForId(this.componentId))
1870
+ : '';
1871
+ return { className: names, css: generatedCSS };
1819
1872
  };
1820
1873
  return ComponentStyle;
1821
1874
  }());
@@ -1834,9 +1887,11 @@
1834
1887
  }
1835
1888
  function useInjectedStyle(componentStyle, resolvedAttrs) {
1836
1889
  var ssc = useStyleSheetContext();
1837
- var className = componentStyle.generateAndInjectStyles(resolvedAttrs, ssc.styleSheet, ssc.stylis);
1838
- React.useDebugValue(className);
1839
- return className;
1890
+ var result = componentStyle.generateAndInjectStyles(resolvedAttrs, ssc.styleSheet, ssc.stylis);
1891
+ if (React.useDebugValue) {
1892
+ React.useDebugValue(result.className);
1893
+ }
1894
+ return result;
1840
1895
  }
1841
1896
  function resolveContext(attrs, props, theme) {
1842
1897
  var context = __assign(__assign({}, props), {
@@ -1867,10 +1922,12 @@
1867
1922
  var seenUnknownProps = new Set();
1868
1923
  function useStyledComponentImpl(forwardedComponent, props, forwardedRef) {
1869
1924
  var componentAttrs = forwardedComponent.attrs, componentStyle = forwardedComponent.componentStyle, defaultProps = forwardedComponent.defaultProps, foldedComponentIds = forwardedComponent.foldedComponentIds, styledComponentId = forwardedComponent.styledComponentId, target = forwardedComponent.target;
1870
- var contextTheme = React.useContext(ThemeContext);
1925
+ var contextTheme = React.useContext ? React.useContext(ThemeContext) : undefined;
1871
1926
  var ssc = useStyleSheetContext();
1872
1927
  var shouldForwardProp = forwardedComponent.shouldForwardProp || ssc.shouldForwardProp;
1873
- React.useDebugValue(styledComponentId);
1928
+ if (React.useDebugValue) {
1929
+ React.useDebugValue(styledComponentId);
1930
+ }
1874
1931
  // NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
1875
1932
  // but that'd be against the rules-of-hooks. We could be naughty and do it anyway as it
1876
1933
  // should be an immutable value, but behave for now.
@@ -1899,7 +1956,7 @@
1899
1956
  }
1900
1957
  }
1901
1958
  }
1902
- var generatedClassName = useInjectedStyle(componentStyle, context);
1959
+ var _a = useInjectedStyle(componentStyle, context), generatedClassName = _a.className, css = _a.css;
1903
1960
  if (forwardedComponent.warnTooManyClasses) {
1904
1961
  forwardedComponent.warnTooManyClasses(generatedClassName);
1905
1962
  }
@@ -1922,7 +1979,17 @@
1922
1979
  if (forwardedRef) {
1923
1980
  propsForElement.ref = forwardedRef;
1924
1981
  }
1925
- return React.createElement(elementToBeCreated, propsForElement);
1982
+ var element = React.createElement(elementToBeCreated, propsForElement);
1983
+ // RSC mode: output style tag alongside element
1984
+ // React 19's style hoisting will deduplicate by href and move to <head>
1985
+ if (IS_RSC && css) {
1986
+ return React.createElement(React.Fragment, null, React.createElement('style', {
1987
+ precedence: 'styled-components',
1988
+ href: "sc-".concat(styledComponentId, "-").concat(generatedClassName),
1989
+ children: css,
1990
+ }), element);
1991
+ }
1992
+ return element;
1926
1993
  }
1927
1994
  function createStyledComponent(target, options, rules) {
1928
1995
  var isTargetStyledComp = isStyledComponent(target);