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.
@@ -8,11 +8,17 @@ var shallowequal = require('shallowequal');
8
8
  var stylis = require('stylis');
9
9
  var unitless = require('@emotion/unitless');
10
10
 
11
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+
13
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
+ var shallowequal__default = /*#__PURE__*/_interopDefaultLegacy(shallowequal);
15
+ var unitless__default = /*#__PURE__*/_interopDefaultLegacy(unitless);
16
+
11
17
  var SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
12
18
  'data-styled';
13
19
  var SC_ATTR_ACTIVE = 'active';
14
20
  var SC_ATTR_VERSION = 'data-styled-version';
15
- var SC_VERSION = "6.0.0-beta.7";
21
+ var SC_VERSION = "6.0.0-beta.8";
16
22
  var SPLITTER = '/*!sc*/\n';
17
23
  var IS_BROWSER = typeof undefined !== 'undefined' ;
18
24
  var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
@@ -1061,9 +1067,9 @@ function createStylisInstance(_a) {
1061
1067
  return stringifyRules;
1062
1068
  }
1063
1069
 
1064
- var StyleSheetContext = React.createContext(undefined);
1070
+ var StyleSheetContext = React__default["default"].createContext(undefined);
1065
1071
  var StyleSheetConsumer = StyleSheetContext.Consumer;
1066
- var StylisContext = React.createContext(undefined);
1072
+ var StylisContext = React__default["default"].createContext(undefined);
1067
1073
  StylisContext.Consumer;
1068
1074
  var mainSheet = new StyleSheet();
1069
1075
  var mainStylis = createStylisInstance();
@@ -1097,12 +1103,12 @@ function StyleSheetManager(props) {
1097
1103
  });
1098
1104
  }, [props.disableVendorPrefixes, props.namespace, plugins]);
1099
1105
  React.useEffect(function () {
1100
- if (!shallowequal(plugins, props.stylisPlugins))
1106
+ if (!shallowequal__default["default"](plugins, props.stylisPlugins))
1101
1107
  setPlugins(props.stylisPlugins);
1102
1108
  }, [props.stylisPlugins]);
1103
- return (React.createElement(StyleSheetContext.Provider, { value: styleSheet },
1104
- React.createElement(StylisContext.Provider, { value: stylis }, process.env.NODE_ENV !== 'production'
1105
- ? React.Children.only(props.children)
1109
+ return (React__default["default"].createElement(StyleSheetContext.Provider, { value: styleSheet },
1110
+ React__default["default"].createElement(StylisContext.Provider, { value: stylis }, process.env.NODE_ENV !== 'production'
1111
+ ? React__default["default"].Children.only(props.children)
1106
1112
  : props.children)));
1107
1113
  }
1108
1114
 
@@ -1136,7 +1142,7 @@ function addUnitIfNeeded(name, value) {
1136
1142
  if (value == null || typeof value === 'boolean' || value === '') {
1137
1143
  return '';
1138
1144
  }
1139
- if (typeof value === 'number' && value !== 0 && !(name in unitless)) {
1145
+ if (typeof value === 'number' && value !== 0 && !(name in unitless__default["default"])) {
1140
1146
  return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers
1141
1147
  }
1142
1148
  return String(value).trim();
@@ -1343,7 +1349,7 @@ var ComponentStyle = /** @class */ (function () {
1343
1349
  return ComponentStyle;
1344
1350
  }());
1345
1351
 
1346
- var ThemeContext = React.createContext(undefined);
1352
+ var ThemeContext = React__default["default"].createContext(undefined);
1347
1353
  var ThemeConsumer = ThemeContext.Consumer;
1348
1354
  function mergeTheme(theme, outerTheme) {
1349
1355
  if (!theme) {
@@ -1372,7 +1378,7 @@ function ThemeProvider(props) {
1372
1378
  if (!props.children) {
1373
1379
  return null;
1374
1380
  }
1375
- return React.createElement(ThemeContext.Provider, { value: themeContext }, props.children);
1381
+ return React__default["default"].createElement(ThemeContext.Provider, { value: themeContext }, props.children);
1376
1382
  }
1377
1383
 
1378
1384
  var identifiers = {};
@@ -1494,7 +1500,7 @@ function createStyledComponent(target, options, rules) {
1494
1500
  * forwardRef creates a new interim component, which we'll take advantage of
1495
1501
  * instead of extending ParentComponent to create _another_ interim class
1496
1502
  */
1497
- var WrappedStyledComponent = React.forwardRef(forwardRef);
1503
+ var WrappedStyledComponent = React__default["default"].forwardRef(forwardRef);
1498
1504
  WrappedStyledComponent.attrs = finalAttrs;
1499
1505
  WrappedStyledComponent.componentStyle = componentStyle;
1500
1506
  WrappedStyledComponent.displayName = displayName;
@@ -1655,10 +1661,10 @@ function createGlobalStyle(strings) {
1655
1661
  var GlobalStyleComponent = function (props) {
1656
1662
  var styleSheet = useStyleSheet();
1657
1663
  var stylis = useStylis();
1658
- var theme = React.useContext(ThemeContext);
1659
- var instanceRef = React.useRef(styleSheet.allocateGSInstance(styledComponentId));
1664
+ var theme = React__default["default"].useContext(ThemeContext);
1665
+ var instanceRef = React__default["default"].useRef(styleSheet.allocateGSInstance(styledComponentId));
1660
1666
  var instance = instanceRef.current;
1661
- if (process.env.NODE_ENV !== 'production' && React.Children.count(props.children)) {
1667
+ if (process.env.NODE_ENV !== 'production' && React__default["default"].Children.count(props.children)) {
1662
1668
  // eslint-disable-next-line no-console
1663
1669
  console.warn("The global style component ".concat(styledComponentId, " was given child JSX. createGlobalStyle does not render children."));
1664
1670
  }
@@ -1681,7 +1687,7 @@ function createGlobalStyle(strings) {
1681
1687
  globalStyle.renderStyles(instance, context, styleSheet, stylis);
1682
1688
  }
1683
1689
  }
1684
- return React.memo(GlobalStyleComponent);
1690
+ return React__default["default"].memo(GlobalStyleComponent);
1685
1691
  }
1686
1692
 
1687
1693
  function keyframes(strings) {
@@ -1702,14 +1708,14 @@ function keyframes(strings) {
1702
1708
  }
1703
1709
 
1704
1710
  function withTheme(Component) {
1705
- var WithTheme = React.forwardRef(function (props, ref) {
1706
- var theme = React.useContext(ThemeContext);
1711
+ var WithTheme = React__default["default"].forwardRef(function (props, ref) {
1712
+ var theme = React__default["default"].useContext(ThemeContext);
1707
1713
  var themeProp = determineTheme(props, theme, Component.defaultProps);
1708
1714
  if (process.env.NODE_ENV !== 'production' && themeProp === undefined) {
1709
1715
  // eslint-disable-next-line no-console
1710
1716
  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), "\""));
1711
1717
  }
1712
- return React.createElement(Component, tslib.__assign({}, props, { theme: themeProp, ref: ref }));
1718
+ return React__default["default"].createElement(Component, tslib.__assign({}, props, { theme: themeProp, ref: ref }));
1713
1719
  });
1714
1720
  WithTheme.displayName = "WithTheme(".concat(getComponentName(Component), ")");
1715
1721
  return hoistNonReactStatics(WithTheme, Component);
@@ -1755,7 +1761,7 @@ var ServerStyleSheet = /** @class */ (function () {
1755
1761
  props.nonce = nonce;
1756
1762
  }
1757
1763
  // v4 returned an array for this fn, so we'll do the same for v5 for backward compat
1758
- return [React.createElement("style", tslib.__assign({}, props, { key: "sc-0-0" }))];
1764
+ return [React__default["default"].createElement("style", tslib.__assign({}, props, { key: "sc-0-0" }))];
1759
1765
  };
1760
1766
  this.seal = function () {
1761
1767
  _this.sealed = true;
@@ -1767,7 +1773,7 @@ var ServerStyleSheet = /** @class */ (function () {
1767
1773
  if (this.sealed) {
1768
1774
  throw throwStyledComponentsError(2);
1769
1775
  }
1770
- return React.createElement(StyleSheetManager, { sheet: this.instance }, children);
1776
+ return React__default["default"].createElement(StyleSheetManager, { sheet: this.instance }, children);
1771
1777
  };
1772
1778
  // eslint-disable-next-line consistent-return
1773
1779
  // @ts-expect-error alternate return types are not possible due to code transformation
@@ -1849,7 +1855,7 @@ exports.ThemeProvider = ThemeProvider;
1849
1855
  exports.__PRIVATE__ = __PRIVATE__;
1850
1856
  exports.createGlobalStyle = createGlobalStyle;
1851
1857
  exports.css = css;
1852
- exports.default = styled;
1858
+ exports["default"] = styled;
1853
1859
  exports.isStyledComponent = isStyledComponent;
1854
1860
  exports.keyframes = keyframes;
1855
1861
  exports.styled = styled;