styled-components 6.0.0-beta.12 → 6.0.0-beta.13

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,7 +8,7 @@ var SC_ATTR = (typeof process !== 'undefined' && typeof process.env !== 'undefin
8
8
  'data-styled';
9
9
  var SC_ATTR_ACTIVE = 'active';
10
10
  var SC_ATTR_VERSION = 'data-styled-version';
11
- var SC_VERSION = "6.0.0-beta.12";
11
+ var SC_VERSION = "6.0.0-beta.13";
12
12
  var SPLITTER = '/*!sc*/\n';
13
13
  var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
14
14
  var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
@@ -1541,7 +1541,11 @@ function createStyledComponent(target, options, rules) {
1541
1541
  checkDynamicCreation(displayName, styledComponentId);
1542
1542
  WrappedStyledComponent.warnTooManyClasses = createWarnTooManyClasses(displayName, styledComponentId);
1543
1543
  }
1544
- WrappedStyledComponent.toString = function () { return ".".concat(WrappedStyledComponent.styledComponentId); };
1544
+ // If the Object prototype is frozen, the "toString" property is non-writable. This means that any objects which inherit this property
1545
+ // cannot have the property changed using an assignment. If using strict mode, attempting that will cause an error. If not using strict
1546
+ // mode, attempting that will be silently ignored.
1547
+ // However, we can still explicitly shadow the prototype's "toString" property by defining a new "toString" property on this object.
1548
+ Object.defineProperty(WrappedStyledComponent, 'toString', { value: function () { return ".".concat(WrappedStyledComponent.styledComponentId); } });
1545
1549
  if (isCompositeComponent) {
1546
1550
  var compositeComponentTarget = target;
1547
1551
  hoistNonReactStatics(WrappedStyledComponent, compositeComponentTarget, {
@@ -1812,22 +1816,21 @@ var __PRIVATE__ = {
1812
1816
  if (process.env.NODE_ENV !== 'production' &&
1813
1817
  typeof navigator !== 'undefined' &&
1814
1818
  navigator.product === 'ReactNative') {
1815
- console.warn("It looks like you've imported 'styled-components' on React Native.\n" +
1816
- "Perhaps you're looking to import 'styled-components/native'?\n" +
1817
- 'Read more about this at https://www.styled-components.com/docs/basics#react-native');
1819
+ console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");
1818
1820
  }
1821
+ var windowGlobalKey = "__sc-".concat(SC_ATTR, "__");
1819
1822
  /* Warning if there are several instances of styled-components */
1820
1823
  if (process.env.NODE_ENV !== 'production' &&
1821
1824
  process.env.NODE_ENV !== 'test' &&
1822
1825
  typeof window !== 'undefined') {
1823
- window['__styled-components-init__'] || (window['__styled-components-init__'] = 0);
1824
- if (window['__styled-components-init__'] === 1) {
1825
- console.warn("It looks like there are several instances of 'styled-components' initialized in this application. " +
1826
- 'This may cause dynamic styles to not render properly, errors during the rehydration process, ' +
1827
- 'a missing theme prop, and makes your application bigger without good reason.\n\n' +
1828
- 'See https://s-c.sh/2BAXzed for more info.');
1829
- }
1830
- window['__styled-components-init__'] += 1;
1826
+ // @ts-expect-error dynamic key not in window object
1827
+ window[windowGlobalKey] || (window[windowGlobalKey] = 0);
1828
+ // @ts-expect-error dynamic key not in window object
1829
+ if (window[windowGlobalKey] === 1) {
1830
+ 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://s-c.sh/2BAXzed for more info.");
1831
+ }
1832
+ // @ts-expect-error dynamic key not in window object
1833
+ window[windowGlobalKey] += 1;
1831
1834
  }
1832
1835
 
1833
1836
  export { ServerStyleSheet, StyleSheetConsumer, StyleSheetContext, StyleSheetManager, ThemeConsumer, ThemeContext, ThemeProvider, __PRIVATE__, createGlobalStyle, css, styled as default, isStyledComponent, keyframes, styled, useTheme, SC_VERSION as version, withTheme };