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

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