styled-components 6.0.0-beta.7 → 6.0.0-beta.8

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.
@@ -4,11 +4,15 @@
4
4
  (global = global || self, global.styled = factory(global.React));
5
5
  })(this, (function (React) { 'use strict';
6
6
 
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
+
7
11
  var SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
8
12
  'data-styled';
9
13
  var SC_ATTR_ACTIVE = 'active';
10
14
  var SC_ATTR_VERSION = 'data-styled-version';
11
- var SC_VERSION = "6.0.0-beta.7";
15
+ var SC_VERSION = "6.0.0-beta.8";
12
16
  var SPLITTER = '/*!sc*/\n';
13
17
  var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
14
18
  var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
@@ -695,9 +699,9 @@
695
699
  return stringifyRules;
696
700
  }
697
701
 
698
- var StyleSheetContext = React.createContext(undefined);
702
+ var StyleSheetContext = React__default["default"].createContext(undefined);
699
703
  var StyleSheetConsumer = StyleSheetContext.Consumer;
700
- var StylisContext = React.createContext(undefined);
704
+ var StylisContext = React__default["default"].createContext(undefined);
701
705
  var mainSheet = new StyleSheet();
702
706
  var mainStylis = createStylisInstance();
703
707
  function useStyleSheet() {
@@ -733,8 +737,8 @@
733
737
  if (!shallowequal(plugins, props.stylisPlugins))
734
738
  setPlugins(props.stylisPlugins);
735
739
  }, [props.stylisPlugins]);
736
- return (React.createElement(StyleSheetContext.Provider, { value: styleSheet },
737
- React.createElement(StylisContext.Provider, { value: stylis }, React.Children.only(props.children)
740
+ return (React__default["default"].createElement(StyleSheetContext.Provider, { value: styleSheet },
741
+ React__default["default"].createElement(StylisContext.Provider, { value: stylis }, React__default["default"].Children.only(props.children)
738
742
  )));
739
743
  }
740
744
 
@@ -993,7 +997,7 @@
993
997
  return GlobalStyle;
994
998
  }());
995
999
 
996
- var ThemeContext = React.createContext(undefined);
1000
+ var ThemeContext = React__default["default"].createContext(undefined);
997
1001
  var ThemeConsumer = ThemeContext.Consumer;
998
1002
  function mergeTheme(theme, outerTheme) {
999
1003
  if (!theme) {
@@ -1021,7 +1025,7 @@
1021
1025
  if (!props.children) {
1022
1026
  return null;
1023
1027
  }
1024
- return React.createElement(ThemeContext.Provider, { value: themeContext }, props.children);
1028
+ return React__default["default"].createElement(ThemeContext.Provider, { value: themeContext }, props.children);
1025
1029
  }
1026
1030
 
1027
1031
  var invalidHookCallRe = /invalid hook call/i;
@@ -1153,10 +1157,10 @@
1153
1157
  var GlobalStyleComponent = function (props) {
1154
1158
  var styleSheet = useStyleSheet();
1155
1159
  var stylis = useStylis();
1156
- var theme = React.useContext(ThemeContext);
1157
- var instanceRef = React.useRef(styleSheet.allocateGSInstance(styledComponentId));
1160
+ var theme = React__default["default"].useContext(ThemeContext);
1161
+ var instanceRef = React__default["default"].useRef(styleSheet.allocateGSInstance(styledComponentId));
1158
1162
  var instance = instanceRef.current;
1159
- if (React.Children.count(props.children)) {
1163
+ if (React__default["default"].Children.count(props.children)) {
1160
1164
  // eslint-disable-next-line no-console
1161
1165
  console.warn("The global style component ".concat(styledComponentId, " was given child JSX. createGlobalStyle does not render children."));
1162
1166
  }
@@ -1170,7 +1174,7 @@
1170
1174
  {
1171
1175
  // eslint-disable-next-line react-hooks/rules-of-hooks
1172
1176
  // @ts-expect-error still using React 17 types for the time being
1173
- (React.useInsertionEffect || React.useLayoutEffect)(function () {
1177
+ (React__default["default"].useInsertionEffect || React__default["default"].useLayoutEffect)(function () {
1174
1178
  if (!styleSheet.server) {
1175
1179
  renderStyles(instance, props, styleSheet, theme, stylis);
1176
1180
  return function () { return globalStyle.removeStyles(instance, styleSheet); };
@@ -1188,7 +1192,7 @@
1188
1192
  globalStyle.renderStyles(instance, context, styleSheet, stylis);
1189
1193
  }
1190
1194
  }
1191
- return React.memo(GlobalStyleComponent);
1195
+ return React__default["default"].memo(GlobalStyleComponent);
1192
1196
  }
1193
1197
 
1194
1198
  function keyframes(strings) {
@@ -1313,14 +1317,14 @@
1313
1317
  }
1314
1318
 
1315
1319
  function withTheme(Component) {
1316
- var WithTheme = React.forwardRef(function (props, ref) {
1317
- var theme = React.useContext(ThemeContext);
1320
+ var WithTheme = React__default["default"].forwardRef(function (props, ref) {
1321
+ var theme = React__default["default"].useContext(ThemeContext);
1318
1322
  var themeProp = determineTheme(props, theme, Component.defaultProps);
1319
1323
  if (themeProp === undefined) {
1320
1324
  // eslint-disable-next-line no-console
1321
1325
  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), "\""));
1322
1326
  }
1323
- return React.createElement(Component, __assign({}, props, { theme: themeProp, ref: ref }));
1327
+ return React__default["default"].createElement(Component, __assign({}, props, { theme: themeProp, ref: ref }));
1324
1328
  });
1325
1329
  WithTheme.displayName = "WithTheme(".concat(getComponentName(Component), ")");
1326
1330
  return hoistNonReactStatics(WithTheme, Component);
@@ -1365,7 +1369,7 @@
1365
1369
  props.nonce = nonce;
1366
1370
  }
1367
1371
  // v4 returned an array for this fn, so we'll do the same for v5 for backward compat
1368
- return [React.createElement("style", __assign({}, props, { key: "sc-0-0" }))];
1372
+ return [React__default["default"].createElement("style", __assign({}, props, { key: "sc-0-0" }))];
1369
1373
  };
1370
1374
  this.seal = function () {
1371
1375
  _this.sealed = true;
@@ -1377,7 +1381,7 @@
1377
1381
  if (this.sealed) {
1378
1382
  throw throwStyledComponentsError(2);
1379
1383
  }
1380
- return React.createElement(StyleSheetManager, { sheet: this.instance }, children);
1384
+ return React__default["default"].createElement(StyleSheetManager, { sheet: this.instance }, children);
1381
1385
  };
1382
1386
  // eslint-disable-next-line consistent-return
1383
1387
  // @ts-expect-error alternate return types are not possible due to code transformation
@@ -1867,7 +1871,7 @@
1867
1871
  * forwardRef creates a new interim component, which we'll take advantage of
1868
1872
  * instead of extending ParentComponent to create _another_ interim class
1869
1873
  */
1870
- var WrappedStyledComponent = React.forwardRef(forwardRef);
1874
+ var WrappedStyledComponent = React__default["default"].forwardRef(forwardRef);
1871
1875
  WrappedStyledComponent.attrs = finalAttrs;
1872
1876
  WrappedStyledComponent.componentStyle = componentStyle;
1873
1877
  WrappedStyledComponent.displayName = displayName;