styled-components 6.0.0-beta.1 → 6.0.0-beta.10

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 (282) hide show
  1. package/dist/base.d.ts +3 -3
  2. package/dist/constructors/constructWithOptions.d.ts +24 -31
  3. package/dist/constructors/createGlobalStyle.d.ts +2 -2
  4. package/dist/constructors/css.d.ts +4 -4
  5. package/dist/constructors/keyframes.d.ts +1 -1
  6. package/dist/constructors/styled.d.ts +177 -181
  7. package/dist/hoc/withTheme.d.ts +2 -2
  8. package/dist/index.d.ts +2 -2
  9. package/dist/models/GlobalStyle.d.ts +1 -1
  10. package/dist/models/InlineStyle.d.ts +1 -1
  11. package/dist/models/StyleSheetManager.d.ts +58 -14
  12. package/dist/models/StyledComponent.d.ts +1 -1
  13. package/dist/models/StyledNativeComponent.d.ts +2 -2
  14. package/dist/models/ThemeProvider.d.ts +1 -1
  15. package/dist/native/index.d.ts +28 -32
  16. package/dist/styled-components-macro.cjs.js +46 -1
  17. package/dist/styled-components-macro.cjs.js.map +1 -1
  18. package/dist/styled-components-macro.esm.js +37 -1
  19. package/dist/styled-components-macro.esm.js.map +1 -1
  20. package/dist/styled-components.browser.cjs.js +1858 -1
  21. package/dist/styled-components.browser.cjs.js.map +1 -1
  22. package/dist/styled-components.browser.esm.js +1832 -1
  23. package/dist/styled-components.browser.esm.js.map +1 -1
  24. package/dist/styled-components.cjs.js +1879 -1
  25. package/dist/styled-components.cjs.js.map +1 -1
  26. package/dist/styled-components.esm.js +1853 -1
  27. package/dist/styled-components.esm.js.map +1 -1
  28. package/dist/styled-components.js +1978 -1
  29. package/dist/styled-components.js.map +1 -1
  30. package/dist/styled-components.min.js +1 -1
  31. package/dist/styled-components.min.js.map +1 -1
  32. package/dist/test/types.d.ts +1 -0
  33. package/dist/test/utils.d.ts +176 -180
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/dist/types.d.ts +81 -73
  36. package/dist/utils/determineTheme.d.ts +2 -2
  37. package/dist/utils/domElements.d.ts +1 -1
  38. package/dist/utils/empties.d.ts +2 -2
  39. package/dist/utils/flatten.d.ts +3 -3
  40. package/dist/utils/generateDisplayName.d.ts +1 -1
  41. package/dist/utils/getComponentName.d.ts +1 -1
  42. package/dist/utils/interleave.d.ts +1 -1
  43. package/dist/utils/isStaticRules.d.ts +1 -1
  44. package/dist/utils/isStyledComponent.d.ts +1 -1
  45. package/dist/utils/isTag.d.ts +1 -1
  46. package/dist/utils/joinStrings.d.ts +1 -1
  47. package/dist/utils/mixinDeep.d.ts +1 -2
  48. package/dist/utils/stylis.d.ts +3 -3
  49. package/native/dist/base.d.ts +3 -3
  50. package/native/dist/constructors/constructWithOptions.d.ts +24 -31
  51. package/native/dist/constructors/createGlobalStyle.d.ts +2 -2
  52. package/native/dist/constructors/css.d.ts +4 -4
  53. package/native/dist/constructors/keyframes.d.ts +1 -1
  54. package/native/dist/constructors/styled.d.ts +177 -181
  55. package/native/dist/hoc/withTheme.d.ts +2 -2
  56. package/native/dist/index.d.ts +2 -2
  57. package/native/dist/models/GlobalStyle.d.ts +1 -1
  58. package/native/dist/models/InlineStyle.d.ts +1 -1
  59. package/native/dist/models/StyleSheetManager.d.ts +58 -14
  60. package/native/dist/models/StyledComponent.d.ts +1 -1
  61. package/native/dist/models/StyledNativeComponent.d.ts +2 -2
  62. package/native/dist/models/ThemeProvider.d.ts +1 -1
  63. package/native/dist/native/index.d.ts +28 -32
  64. package/native/dist/styled-components.native.cjs.js +87 -81
  65. package/native/dist/styled-components.native.cjs.js.map +1 -1
  66. package/native/dist/styled-components.native.esm.js +74 -69
  67. package/native/dist/styled-components.native.esm.js.map +1 -1
  68. package/native/dist/test/types.d.ts +1 -0
  69. package/native/dist/test/utils.d.ts +176 -180
  70. package/native/dist/types.d.ts +81 -73
  71. package/native/dist/utils/determineTheme.d.ts +2 -2
  72. package/native/dist/utils/domElements.d.ts +1 -1
  73. package/native/dist/utils/empties.d.ts +2 -2
  74. package/native/dist/utils/flatten.d.ts +3 -3
  75. package/native/dist/utils/generateDisplayName.d.ts +1 -1
  76. package/native/dist/utils/getComponentName.d.ts +1 -1
  77. package/native/dist/utils/interleave.d.ts +1 -1
  78. package/native/dist/utils/isStaticRules.d.ts +1 -1
  79. package/native/dist/utils/isStyledComponent.d.ts +1 -1
  80. package/native/dist/utils/isTag.d.ts +1 -1
  81. package/native/dist/utils/joinStrings.d.ts +1 -1
  82. package/native/dist/utils/mixinDeep.d.ts +1 -2
  83. package/native/dist/utils/stylis.d.ts +3 -3
  84. package/package.json +40 -39
  85. package/test-utils/index.ts +10 -6
  86. package/native/dist/base.d.ts.map +0 -1
  87. package/native/dist/constants.d.ts.map +0 -1
  88. package/native/dist/constructors/constructWithOptions.d.ts.map +0 -1
  89. package/native/dist/constructors/createGlobalStyle.d.ts.map +0 -1
  90. package/native/dist/constructors/css.d.ts.map +0 -1
  91. package/native/dist/constructors/keyframes.d.ts.map +0 -1
  92. package/native/dist/constructors/styled.d.ts.map +0 -1
  93. package/native/dist/dist/base.d.ts +0 -18
  94. package/native/dist/dist/base.d.ts.map +0 -1
  95. package/native/dist/dist/constants.d.ts +0 -9
  96. package/native/dist/dist/constants.d.ts.map +0 -1
  97. package/native/dist/dist/constructors/constructWithOptions.d.ts +0 -20
  98. package/native/dist/dist/constructors/constructWithOptions.d.ts.map +0 -1
  99. package/native/dist/dist/constructors/createGlobalStyle.d.ts +0 -4
  100. package/native/dist/dist/constructors/createGlobalStyle.d.ts.map +0 -1
  101. package/native/dist/dist/constructors/css.d.ts +0 -5
  102. package/native/dist/dist/constructors/css.d.ts.map +0 -1
  103. package/native/dist/dist/constructors/keyframes.d.ts +0 -4
  104. package/native/dist/dist/constructors/keyframes.d.ts.map +0 -1
  105. package/native/dist/dist/constructors/styled.d.ts +0 -186
  106. package/native/dist/dist/constructors/styled.d.ts.map +0 -1
  107. package/native/dist/dist/hoc/withTheme.d.ts +0 -4
  108. package/native/dist/dist/hoc/withTheme.d.ts.map +0 -1
  109. package/native/dist/dist/hoc/withTheme.spec.d.ts +0 -2
  110. package/native/dist/dist/hoc/withTheme.spec.d.ts.map +0 -1
  111. package/native/dist/dist/hooks/useTheme.d.ts +0 -4
  112. package/native/dist/dist/hooks/useTheme.d.ts.map +0 -1
  113. package/native/dist/dist/index-standalone.d.ts +0 -3
  114. package/native/dist/dist/index-standalone.d.ts.map +0 -1
  115. package/native/dist/dist/index.d.ts +0 -4
  116. package/native/dist/dist/index.d.ts.map +0 -1
  117. package/native/dist/dist/macro/index.d.ts +0 -3
  118. package/native/dist/dist/macro/index.d.ts.map +0 -1
  119. package/native/dist/dist/macro/test/babel.config.d.ts +0 -1
  120. package/native/dist/dist/macro/test/babel.config.d.ts.map +0 -1
  121. package/native/dist/dist/models/ComponentStyle.d.ts +0 -16
  122. package/native/dist/dist/models/ComponentStyle.d.ts.map +0 -1
  123. package/native/dist/dist/models/GlobalStyle.d.ts +0 -12
  124. package/native/dist/dist/models/GlobalStyle.d.ts.map +0 -1
  125. package/native/dist/dist/models/InlineStyle.d.ts +0 -7
  126. package/native/dist/dist/models/InlineStyle.d.ts.map +0 -1
  127. package/native/dist/dist/models/Keyframes.d.ts +0 -12
  128. package/native/dist/dist/models/Keyframes.d.ts.map +0 -1
  129. package/native/dist/dist/models/ServerStyleSheet.d.ts +0 -16
  130. package/native/dist/dist/models/ServerStyleSheet.d.ts.map +0 -1
  131. package/native/dist/dist/models/StyleSheetManager.d.ts +0 -22
  132. package/native/dist/dist/models/StyleSheetManager.d.ts.map +0 -1
  133. package/native/dist/dist/models/StyledComponent.d.ts +0 -4
  134. package/native/dist/dist/models/StyledComponent.d.ts.map +0 -1
  135. package/native/dist/dist/models/StyledNativeComponent.d.ts +0 -4
  136. package/native/dist/dist/models/StyledNativeComponent.d.ts.map +0 -1
  137. package/native/dist/dist/models/ThemeProvider.d.ts +0 -18
  138. package/native/dist/dist/models/ThemeProvider.d.ts.map +0 -1
  139. package/native/dist/dist/native/index.d.ts +0 -65
  140. package/native/dist/dist/native/index.d.ts.map +0 -1
  141. package/native/dist/dist/primitives/index.d.ts +0 -23
  142. package/native/dist/dist/primitives/index.d.ts.map +0 -1
  143. package/native/dist/dist/secretInternals.d.ts +0 -6
  144. package/native/dist/dist/secretInternals.d.ts.map +0 -1
  145. package/native/dist/dist/sheet/GroupIDAllocator.d.ts +0 -5
  146. package/native/dist/dist/sheet/GroupIDAllocator.d.ts.map +0 -1
  147. package/native/dist/dist/sheet/GroupedTag.d.ts +0 -12
  148. package/native/dist/dist/sheet/GroupedTag.d.ts.map +0 -1
  149. package/native/dist/dist/sheet/Rehydration.d.ts +0 -4
  150. package/native/dist/dist/sheet/Rehydration.d.ts.map +0 -1
  151. package/native/dist/dist/sheet/Sheet.d.ts +0 -41
  152. package/native/dist/dist/sheet/Sheet.d.ts.map +0 -1
  153. package/native/dist/dist/sheet/Tag.d.ts +0 -55
  154. package/native/dist/dist/sheet/Tag.d.ts.map +0 -1
  155. package/native/dist/dist/sheet/dom.d.ts +0 -5
  156. package/native/dist/dist/sheet/dom.d.ts.map +0 -1
  157. package/native/dist/dist/sheet/index.d.ts +0 -2
  158. package/native/dist/dist/sheet/index.d.ts.map +0 -1
  159. package/native/dist/dist/sheet/types.d.ts +0 -35
  160. package/native/dist/dist/sheet/types.d.ts.map +0 -1
  161. package/native/dist/dist/test/globals.d.ts +0 -3
  162. package/native/dist/dist/test/globals.d.ts.map +0 -1
  163. package/native/dist/dist/test/utils.d.ts +0 -192
  164. package/native/dist/dist/test/utils.d.ts.map +0 -1
  165. package/native/dist/dist/types.d.ts +0 -121
  166. package/native/dist/dist/types.d.ts.map +0 -1
  167. package/native/dist/dist/utils/addUnitIfNeeded.d.ts +0 -2
  168. package/native/dist/dist/utils/addUnitIfNeeded.d.ts.map +0 -1
  169. package/native/dist/dist/utils/checkDynamicCreation.d.ts +0 -2
  170. package/native/dist/dist/utils/checkDynamicCreation.d.ts.map +0 -1
  171. package/native/dist/dist/utils/createWarnTooManyClasses.d.ts +0 -4
  172. package/native/dist/dist/utils/createWarnTooManyClasses.d.ts.map +0 -1
  173. package/native/dist/dist/utils/determineTheme.d.ts +0 -3
  174. package/native/dist/dist/utils/determineTheme.d.ts.map +0 -1
  175. package/native/dist/dist/utils/domElements.d.ts +0 -3
  176. package/native/dist/dist/utils/domElements.d.ts.map +0 -1
  177. package/native/dist/dist/utils/empties.d.ts +0 -4
  178. package/native/dist/dist/utils/empties.d.ts.map +0 -1
  179. package/native/dist/dist/utils/error.d.ts +0 -6
  180. package/native/dist/dist/utils/error.d.ts.map +0 -1
  181. package/native/dist/dist/utils/errors.d.ts +0 -21
  182. package/native/dist/dist/utils/errors.d.ts.map +0 -1
  183. package/native/dist/dist/utils/escape.d.ts +0 -6
  184. package/native/dist/dist/utils/escape.d.ts.map +0 -1
  185. package/native/dist/dist/utils/flatten.d.ts +0 -5
  186. package/native/dist/dist/utils/flatten.d.ts.map +0 -1
  187. package/native/dist/dist/utils/generateAlphabeticName.d.ts +0 -2
  188. package/native/dist/dist/utils/generateAlphabeticName.d.ts.map +0 -1
  189. package/native/dist/dist/utils/generateComponentId.d.ts +0 -2
  190. package/native/dist/dist/utils/generateComponentId.d.ts.map +0 -1
  191. package/native/dist/dist/utils/generateDisplayName.d.ts +0 -3
  192. package/native/dist/dist/utils/generateDisplayName.d.ts.map +0 -1
  193. package/native/dist/dist/utils/getComponentName.d.ts +0 -3
  194. package/native/dist/dist/utils/getComponentName.d.ts.map +0 -1
  195. package/native/dist/dist/utils/hash.d.ts +0 -4
  196. package/native/dist/dist/utils/hash.d.ts.map +0 -1
  197. package/native/dist/dist/utils/hoist.d.ts +0 -52
  198. package/native/dist/dist/utils/hoist.d.ts.map +0 -1
  199. package/native/dist/dist/utils/hyphenateStyleName.d.ts +0 -15
  200. package/native/dist/dist/utils/hyphenateStyleName.d.ts.map +0 -1
  201. package/native/dist/dist/utils/interleave.d.ts +0 -3
  202. package/native/dist/dist/utils/interleave.d.ts.map +0 -1
  203. package/native/dist/dist/utils/isFunction.d.ts +0 -2
  204. package/native/dist/dist/utils/isFunction.d.ts.map +0 -1
  205. package/native/dist/dist/utils/isPlainObject.d.ts +0 -2
  206. package/native/dist/dist/utils/isPlainObject.d.ts.map +0 -1
  207. package/native/dist/dist/utils/isStatelessFunction.d.ts +0 -2
  208. package/native/dist/dist/utils/isStatelessFunction.d.ts.map +0 -1
  209. package/native/dist/dist/utils/isStaticRules.d.ts +0 -3
  210. package/native/dist/dist/utils/isStaticRules.d.ts.map +0 -1
  211. package/native/dist/dist/utils/isStyledComponent.d.ts +0 -3
  212. package/native/dist/dist/utils/isStyledComponent.d.ts.map +0 -1
  213. package/native/dist/dist/utils/isTag.d.ts +0 -3
  214. package/native/dist/dist/utils/isTag.d.ts.map +0 -1
  215. package/native/dist/dist/utils/joinStrings.d.ts +0 -5
  216. package/native/dist/dist/utils/joinStrings.d.ts.map +0 -1
  217. package/native/dist/dist/utils/mixinDeep.d.ts +0 -8
  218. package/native/dist/dist/utils/mixinDeep.d.ts.map +0 -1
  219. package/native/dist/dist/utils/nonce.d.ts +0 -2
  220. package/native/dist/dist/utils/nonce.d.ts.map +0 -1
  221. package/native/dist/dist/utils/stylis.d.ts +0 -10
  222. package/native/dist/dist/utils/stylis.d.ts.map +0 -1
  223. package/native/dist/hoc/withTheme.d.ts.map +0 -1
  224. package/native/dist/hoc/withTheme.spec.d.ts.map +0 -1
  225. package/native/dist/hooks/useTheme.d.ts.map +0 -1
  226. package/native/dist/index-standalone.d.ts.map +0 -1
  227. package/native/dist/index.d.ts.map +0 -1
  228. package/native/dist/macro/index.d.ts.map +0 -1
  229. package/native/dist/macro/test/babel.config.d.ts +0 -1
  230. package/native/dist/macro/test/babel.config.d.ts.map +0 -1
  231. package/native/dist/models/ComponentStyle.d.ts.map +0 -1
  232. package/native/dist/models/GlobalStyle.d.ts.map +0 -1
  233. package/native/dist/models/InlineStyle.d.ts.map +0 -1
  234. package/native/dist/models/Keyframes.d.ts.map +0 -1
  235. package/native/dist/models/ServerStyleSheet.d.ts.map +0 -1
  236. package/native/dist/models/StyleSheetManager.d.ts.map +0 -1
  237. package/native/dist/models/StyledComponent.d.ts.map +0 -1
  238. package/native/dist/models/StyledNativeComponent.d.ts.map +0 -1
  239. package/native/dist/models/ThemeProvider.d.ts.map +0 -1
  240. package/native/dist/native/index.d.ts.map +0 -1
  241. package/native/dist/primitives/index.d.ts +0 -23
  242. package/native/dist/primitives/index.d.ts.map +0 -1
  243. package/native/dist/secretInternals.d.ts.map +0 -1
  244. package/native/dist/sheet/GroupIDAllocator.d.ts.map +0 -1
  245. package/native/dist/sheet/GroupedTag.d.ts.map +0 -1
  246. package/native/dist/sheet/Rehydration.d.ts.map +0 -1
  247. package/native/dist/sheet/Sheet.d.ts.map +0 -1
  248. package/native/dist/sheet/Tag.d.ts.map +0 -1
  249. package/native/dist/sheet/dom.d.ts.map +0 -1
  250. package/native/dist/sheet/index.d.ts.map +0 -1
  251. package/native/dist/sheet/types.d.ts.map +0 -1
  252. package/native/dist/test/globals.d.ts.map +0 -1
  253. package/native/dist/test/utils.d.ts.map +0 -1
  254. package/native/dist/types.d.ts.map +0 -1
  255. package/native/dist/utils/addUnitIfNeeded.d.ts.map +0 -1
  256. package/native/dist/utils/checkDynamicCreation.d.ts.map +0 -1
  257. package/native/dist/utils/createWarnTooManyClasses.d.ts.map +0 -1
  258. package/native/dist/utils/determineTheme.d.ts.map +0 -1
  259. package/native/dist/utils/domElements.d.ts.map +0 -1
  260. package/native/dist/utils/empties.d.ts.map +0 -1
  261. package/native/dist/utils/error.d.ts.map +0 -1
  262. package/native/dist/utils/errors.d.ts.map +0 -1
  263. package/native/dist/utils/escape.d.ts.map +0 -1
  264. package/native/dist/utils/flatten.d.ts.map +0 -1
  265. package/native/dist/utils/generateAlphabeticName.d.ts.map +0 -1
  266. package/native/dist/utils/generateComponentId.d.ts.map +0 -1
  267. package/native/dist/utils/generateDisplayName.d.ts.map +0 -1
  268. package/native/dist/utils/getComponentName.d.ts.map +0 -1
  269. package/native/dist/utils/hash.d.ts.map +0 -1
  270. package/native/dist/utils/hoist.d.ts.map +0 -1
  271. package/native/dist/utils/hyphenateStyleName.d.ts.map +0 -1
  272. package/native/dist/utils/interleave.d.ts.map +0 -1
  273. package/native/dist/utils/isFunction.d.ts.map +0 -1
  274. package/native/dist/utils/isPlainObject.d.ts.map +0 -1
  275. package/native/dist/utils/isStatelessFunction.d.ts.map +0 -1
  276. package/native/dist/utils/isStaticRules.d.ts.map +0 -1
  277. package/native/dist/utils/isStyledComponent.d.ts.map +0 -1
  278. package/native/dist/utils/isTag.d.ts.map +0 -1
  279. package/native/dist/utils/joinStrings.d.ts.map +0 -1
  280. package/native/dist/utils/mixinDeep.d.ts.map +0 -1
  281. package/native/dist/utils/nonce.d.ts.map +0 -1
  282. package/native/dist/utils/stylis.d.ts.map +0 -1
@@ -1,21 +1,65 @@
1
1
  import React from 'react';
2
2
  import StyleSheet from '../sheet';
3
- import { Stringifier } from '../types';
4
- declare type Props = {
5
- children?: React.ReactChild;
6
- disableCSSOMInjection?: boolean;
7
- disableVendorPrefixes?: boolean;
8
- sheet?: StyleSheet;
9
- stylisPlugins?: stylis.Middleware[];
10
- target?: HTMLElement;
3
+ import { ShouldForwardProp, Stringifier } from '../types';
4
+ export declare type IStyleSheetContext = {
5
+ shouldForwardProp?: ShouldForwardProp<'web'>;
6
+ styleSheet?: StyleSheet;
11
7
  };
12
- export declare const StyleSheetContext: React.Context<void | StyleSheet>;
13
- export declare const StyleSheetConsumer: React.Consumer<void | StyleSheet>;
14
- export declare const StylisContext: React.Context<void | Stringifier>;
15
- export declare const StylisConsumer: React.Consumer<void | Stringifier>;
8
+ export declare const StyleSheetContext: React.Context<IStyleSheetContext>;
9
+ export declare const StyleSheetConsumer: React.Consumer<IStyleSheetContext>;
10
+ export declare type IStylisContext = Stringifier | void;
11
+ export declare const StylisContext: React.Context<IStylisContext>;
12
+ export declare const StylisConsumer: React.Consumer<IStylisContext>;
16
13
  export declare const mainSheet: StyleSheet;
17
14
  export declare const mainStylis: Stringifier;
15
+ export declare function useShouldForwardProp(): ShouldForwardProp<"web"> | undefined;
18
16
  export declare function useStyleSheet(): StyleSheet;
19
17
  export declare function useStylis(): Stringifier;
20
- export default function StyleSheetManager(props: Props): JSX.Element;
21
- export {};
18
+ export declare type IStyleSheetManager = React.PropsWithChildren<{
19
+ /**
20
+ * If desired, you can pass this prop to disable "speedy" insertion mode, which
21
+ * uses the browser [CSSOM APIs](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet).
22
+ * When disabled, rules are inserted as simple text into style blocks.
23
+ */
24
+ disableCSSOMInjection?: boolean;
25
+ /**
26
+ * If you are working exclusively with modern browsers, vendor prefixes can often be omitted
27
+ * to reduce the weight of CSS on the page.
28
+ */
29
+ disableVendorPrefixes?: boolean;
30
+ /**
31
+ * Provide an optional selector to be prepended to all generated style rules.
32
+ */
33
+ namespace?: string;
34
+ /**
35
+ * Create and provide your own `StyleSheet` if necessary for advanced SSR scenarios.
36
+ */
37
+ sheet?: StyleSheet;
38
+ /**
39
+ * Starting in v6, styled-components no longer does its own prop validation
40
+ * and recommends use of transient props "$prop" to pass style-only props to
41
+ * components. If for some reason you are not able to use transient props, a
42
+ * prop validation function can be provided via `StyleSheetManager`, such as
43
+ * `@emotion/is-prop-valid`.
44
+ *
45
+ * When the return value is `true`, props will be forwarded to the DOM/underlying
46
+ * component. If return value is `false`, the prop will be discarded after styles
47
+ * are calculated.
48
+ *
49
+ * Manually composing `styled.{element}.withConfig({shouldForwardProp})` will
50
+ * override this default.
51
+ */
52
+ shouldForwardProp?: IStyleSheetContext['shouldForwardProp'];
53
+ /**
54
+ * An array of plugins to be run by stylis (style processor) during compilation.
55
+ * Check out [what's available on npm*](https://www.npmjs.com/search?q=keywords%3Astylis).
56
+ *
57
+ * \* The plugin(s) must be compatible with stylis v4 or above.
58
+ */
59
+ stylisPlugins?: stylis.Middleware[];
60
+ /**
61
+ * Provide an alternate DOM node to host generated styles; useful for iframes.
62
+ */
63
+ target?: HTMLElement;
64
+ }>;
65
+ export declare function StyleSheetManager(props: IStyleSheetManager): JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import type { IStyledComponentFactory, RuleSet, StyledOptions, WebTarget } from '../types';
2
- declare function createStyledComponent<Target extends WebTarget, OuterProps = unknown, Statics = unknown>(target: Target, options: StyledOptions<OuterProps>, rules: RuleSet<OuterProps>): ReturnType<IStyledComponentFactory<Target, OuterProps, Statics>>;
2
+ declare function createStyledComponent<Target extends WebTarget, OuterProps extends object, Statics extends object = object>(target: Target, options: StyledOptions<'web', OuterProps>, rules: RuleSet<OuterProps>): ReturnType<IStyledComponentFactory<'web', Target, OuterProps, Statics>>;
3
3
  export default createStyledComponent;
@@ -1,3 +1,3 @@
1
- import type { ExtensibleObject, IInlineStyleConstructor, IStyledNativeComponent, IStyledNativeComponentFactory, NativeTarget, RuleSet, StyledNativeOptions } from '../types';
2
- declare const _default: (InlineStyle: IInlineStyleConstructor<any>) => <Target extends NativeTarget, OuterProps extends ExtensibleObject, Statics = unknown>(target: Target, options: StyledNativeOptions<OuterProps>, rules: RuleSet<OuterProps>) => IStyledNativeComponent<Target, OuterProps> & Statics;
1
+ import type { ExecutionProps, IInlineStyleConstructor, IStyledComponent, IStyledComponentFactory, NativeTarget, RuleSet, StyledOptions } from '../types';
2
+ declare const _default: (InlineStyle: IInlineStyleConstructor<any>) => <Target extends NativeTarget, OuterProps extends ExecutionProps, Statics extends object = object>(target: Target, options: StyledOptions<"native", OuterProps>, rules: RuleSet<OuterProps>) => IStyledComponent<"native", Target, OuterProps & object> & Statics & object;
3
3
  export default _default;
@@ -27,7 +27,7 @@ export interface DefaultTheme {
27
27
  declare type ThemeFn = (outerTheme?: DefaultTheme) => DefaultTheme;
28
28
  declare type ThemeArgument = DefaultTheme | ThemeFn;
29
29
  declare type Props = {
30
- children?: React.ReactChild;
30
+ children?: React.ReactNode;
31
31
  theme: ThemeArgument;
32
32
  };
33
33
  export declare const ThemeContext: React.Context<DefaultTheme | undefined>;
@@ -1,41 +1,37 @@
1
1
  import React from 'react';
2
- import { NativeStyled } from '../constructors/constructWithOptions';
2
+ import { Styled } from '../constructors/constructWithOptions';
3
3
  import css from '../constructors/css';
4
4
  import withTheme from '../hoc/withTheme';
5
5
  import useTheme from '../hooks/useTheme';
6
6
  import ThemeProvider, { ThemeConsumer, ThemeContext } from '../models/ThemeProvider';
7
7
  import { NativeTarget } from '../types';
8
8
  import isStyledComponent from '../utils/isStyledComponent';
9
- declare const styled: (<Target extends NativeTarget>(tag: Target) => {
10
- <Props = unknown, Statics = unknown>(initialStyles: import("../types").Styles<(Target extends import("../types").KnownTarget ? React.ComponentProps<Target> : unknown) & Props>, ...interpolations: import("../types").Interpolation<import("../types").ExecutionContext & (Target extends import("../types").KnownTarget ? React.ComponentProps<Target> : unknown) & Props>[]): import("../types").IStyledNativeComponent<Target, (Target extends import("../types").KnownTarget ? React.ComponentProps<Target> : unknown) & Props> & Statics;
11
- attrs(attrs: import("../types").Attrs<import("../types").ExecutionContext & (Target extends import("../types").KnownTarget ? React.ComponentProps<Target> : unknown)>): any;
12
- withConfig(config: import("../types").StyledNativeOptions<Target extends import("../types").KnownTarget ? React.ComponentProps<Target> : unknown>): any;
13
- }) & {
14
- ActivityIndicator: NativeStyled<typeof import("react-native").ActivityIndicator, import("react-native").ActivityIndicatorProps, unknown, unknown>;
15
- Button: NativeStyled<typeof import("react-native").Button, import("react-native").ButtonProps, unknown, unknown>;
16
- DatePickerIOS: NativeStyled<typeof import("react-native").DatePickerIOS, import("react-native").DatePickerIOSProps, unknown, unknown>;
17
- DrawerLayoutAndroid: NativeStyled<typeof import("react-native").DrawerLayoutAndroid, import("react-native").DrawerLayoutAndroidProps, unknown, unknown>;
18
- FlatList: NativeStyled<typeof import("react-native").FlatList, import("react-native").FlatListProps<unknown>, unknown, unknown>;
19
- Image: NativeStyled<typeof import("react-native").Image, import("react-native").ImageProps, unknown, unknown>;
20
- ImageBackground: NativeStyled<typeof import("react-native").ImageBackground, import("react-native").ImageBackgroundProps, unknown, unknown>;
21
- KeyboardAvoidingView: NativeStyled<typeof import("react-native").KeyboardAvoidingView, import("react-native").KeyboardAvoidingViewProps, unknown, unknown>;
22
- Modal: NativeStyled<typeof import("react-native").Modal, import("react-native").ModalProps, unknown, unknown>;
23
- Pressable: NativeStyled<import("react").ForwardRefExoticComponent<import("react-native").PressableProps & import("react").RefAttributes<import("react-native").View>>, import("react-native").PressableProps & import("react").RefAttributes<import("react-native").View>, unknown, unknown>;
24
- ProgressBarAndroid: NativeStyled<typeof import("react-native").ProgressBarAndroid, import("react-native").ProgressBarAndroidProps, unknown, unknown>;
25
- ProgressViewIOS: NativeStyled<typeof import("react-native").ProgressViewIOS, import("react-native").ProgressViewIOSProps, unknown, unknown>;
26
- RefreshControl: NativeStyled<typeof import("react-native").RefreshControl, import("react-native").RefreshControlProps, unknown, unknown>;
27
- SafeAreaView: NativeStyled<typeof import("react-native").SafeAreaView, import("react-native").ViewProps, unknown, unknown>;
28
- ScrollView: NativeStyled<typeof import("react-native").ScrollView, import("react-native").ScrollViewProps, unknown, unknown>;
29
- SectionList: NativeStyled<typeof import("react-native").SectionList, import("react-native").SectionListProps<unknown, unknown>, unknown, unknown>;
30
- Slider: NativeStyled<typeof import("react-native").Slider, import("react-native").SliderProps, unknown, unknown>;
31
- Switch: NativeStyled<typeof import("react-native").Switch, import("react-native").SwitchProps, unknown, unknown>;
32
- Text: NativeStyled<typeof import("react-native").Text, import("react-native").TextProps, unknown, unknown>;
33
- TextInput: NativeStyled<typeof import("react-native").TextInput, import("react-native").TextInputProps, unknown, unknown>;
34
- TouchableHighlight: NativeStyled<typeof import("react-native").TouchableHighlight, import("react-native").TouchableHighlightProps, unknown, unknown>;
35
- TouchableOpacity: NativeStyled<typeof import("react-native").TouchableOpacity, import("react-native").TouchableOpacityProps, unknown, unknown>;
36
- View: NativeStyled<typeof import("react-native").View, import("react-native").ViewProps, unknown, unknown>;
37
- VirtualizedList: NativeStyled<typeof import("react-native").VirtualizedList, import("react-native").VirtualizedListProps<unknown>, unknown, unknown>;
9
+ declare const styled: (<Target extends NativeTarget>(tag: Target) => Styled<"native", Target, Target extends import("../types").KnownTarget ? React.ComponentPropsWithRef<Target> : object, object, object>) & {
10
+ ActivityIndicator: Styled<"native", typeof import("react-native").ActivityIndicator, object, object, object>;
11
+ Button: Styled<"native", typeof import("react-native").Button, object, object, object>;
12
+ DatePickerIOS: Styled<"native", typeof import("react-native").DatePickerIOS, object, object, object>;
13
+ DrawerLayoutAndroid: Styled<"native", typeof import("react-native").DrawerLayoutAndroid, object, object, object>;
14
+ FlatList: Styled<"native", typeof import("react-native").FlatList, object, object, object>;
15
+ Image: Styled<"native", typeof import("react-native").Image, object, object, object>;
16
+ ImageBackground: Styled<"native", typeof import("react-native").ImageBackground, object, object, object>;
17
+ KeyboardAvoidingView: Styled<"native", typeof import("react-native").KeyboardAvoidingView, object, object, object>;
18
+ Modal: Styled<"native", typeof import("react-native").Modal, object, object, object>;
19
+ Pressable: Styled<"native", import("react").ForwardRefExoticComponent<import("react-native").PressableProps & import("react").RefAttributes<import("react-native").View>>, object, object, object>;
20
+ ProgressBarAndroid: Styled<"native", typeof import("react-native").ProgressBarAndroid, object, object, object>;
21
+ ProgressViewIOS: Styled<"native", typeof import("react-native").ProgressViewIOS, object, object, object>;
22
+ RefreshControl: Styled<"native", typeof import("react-native").RefreshControl, object, object, object>;
23
+ SafeAreaView: Styled<"native", typeof import("react-native").SafeAreaView, object, object, object>;
24
+ ScrollView: Styled<"native", typeof import("react-native").ScrollView, object, object, object>;
25
+ SectionList: Styled<"native", typeof import("react-native").SectionList, object, object, object>;
26
+ Slider: Styled<"native", typeof import("react-native").Slider, object, object, object>;
27
+ Switch: Styled<"native", typeof import("react-native").Switch, object, object, object>;
28
+ Text: Styled<"native", typeof import("react-native").Text, object, object, object>;
29
+ TextInput: Styled<"native", typeof import("react-native").TextInput, object, object, object>;
30
+ TouchableHighlight: Styled<"native", typeof import("react-native").TouchableHighlight, object, object, object>;
31
+ TouchableOpacity: Styled<"native", typeof import("react-native").TouchableOpacity, object, object, object>;
32
+ View: Styled<"native", typeof import("react-native").View, object, object, object>;
33
+ VirtualizedList: Styled<"native", typeof import("react-native").VirtualizedList, object, object, object>;
38
34
  };
39
- export { IStyledNativeComponent, IStyledNativeComponentFactory, IStyledNativeStatics, NativeTarget, StyledNativeOptions, } from '../types';
35
+ export { DefaultTheme, ExecutionContext, ExecutionProps, IStyledComponent, IStyledComponentFactory, IStyledStatics, NativeTarget, PolymorphicComponent, PolymorphicComponentProps, Runtime, StyledObject, StyledOptions, } from '../types';
40
36
  export { css, isStyledComponent, ThemeProvider, ThemeConsumer, ThemeContext, withTheme, useTheme };
41
- export default styled;
37
+ export { styled, styled as default };
@@ -10,11 +10,11 @@ var unitless = require('@emotion/unitless');
10
10
  var transformDeclPairs = require('css-to-react-native');
11
11
  var postcss = require('postcss');
12
12
 
13
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
14
 
15
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
16
- var unitless__default = /*#__PURE__*/_interopDefaultLegacy(unitless);
17
- var transformDeclPairs__default = /*#__PURE__*/_interopDefaultLegacy(transformDeclPairs);
15
+ var React__default = /*#__PURE__*/_interopDefault(React);
16
+ var unitless__default = /*#__PURE__*/_interopDefault(unitless);
17
+ var transformDeclPairs__default = /*#__PURE__*/_interopDefault(transformDeclPairs);
18
18
 
19
19
  var EMPTY_ARRAY = Object.freeze([]);
20
20
  var EMPTY_OBJECT = Object.freeze({});
@@ -75,22 +75,24 @@ function throwStyledComponentsError(code) {
75
75
  }
76
76
  }
77
77
 
78
- var SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
78
+ var SC_ATTR = (typeof process !== 'undefined' && typeof process.env !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
79
79
  'data-styled';
80
80
  var SC_ATTR_ACTIVE = 'active';
81
81
  var SC_ATTR_VERSION = 'data-styled-version';
82
- var SC_VERSION = "6.0.0-beta.1";
82
+ var SC_VERSION = "6.0.0-beta.10";
83
83
  var SPLITTER = '/*!sc*/\n';
84
84
  var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
85
85
  var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
86
86
  ? SC_DISABLE_SPEEDY
87
87
  : typeof process !== 'undefined' &&
88
+ typeof process.env !== 'undefined' &&
88
89
  typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' &&
89
90
  process.env.REACT_APP_SC_DISABLE_SPEEDY !== ''
90
91
  ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false'
91
92
  ? false
92
93
  : process.env.REACT_APP_SC_DISABLE_SPEEDY
93
94
  : typeof process !== 'undefined' &&
95
+ typeof process.env !== 'undefined' &&
94
96
  typeof process.env.SC_DISABLE_SPEEDY !== 'undefined' &&
95
97
  process.env.SC_DISABLE_SPEEDY !== ''
96
98
  ? process.env.SC_DISABLE_SPEEDY === 'false'
@@ -239,7 +241,6 @@ var rehydrateNamesFromContent = function (sheet, id, content) {
239
241
  var names = content.split(',');
240
242
  var name;
241
243
  for (var i = 0, l = names.length; i < l; i++) {
242
- // eslint-disable-next-line
243
244
  if ((name = names[i])) {
244
245
  sheet.registerName(id, name);
245
246
  }
@@ -549,6 +550,27 @@ var COMPLEX_SELECTOR_PREFIX = [':', '[', '.', '#'];
549
550
  function serialize(children, callback) {
550
551
  return children.map(function (c, i) { return callback(c, i, children, callback); }).filter(Boolean);
551
552
  }
553
+ /**
554
+ * Takes an element and recurses through it's rules added the namespace to the start of each selector.
555
+ * Takes into account media queries by recursing through child rules if they are present.
556
+ */
557
+ function recursivelySetNamepace(compiled, namespace) {
558
+ return compiled.map(function (rule) {
559
+ if (rule.type === 'rule') {
560
+ // add the namespace to the start
561
+ rule.value = "".concat(namespace, " ").concat(rule.value);
562
+ // add the namespace after each comma for subsequent selectors.
563
+ rule.value = rule.value.replaceAll(',', ",".concat(namespace, " "));
564
+ rule.props = rule.props.map(function (prop) {
565
+ return "".concat(namespace, " ").concat(prop);
566
+ });
567
+ }
568
+ if (Array.isArray(rule.children)) {
569
+ rule.children = recursivelySetNamepace(rule.children, namespace);
570
+ }
571
+ return rule;
572
+ });
573
+ }
552
574
  function createStylisInstance(_a) {
553
575
  var _b = _a === void 0 ? EMPTY_OBJECT : _a, _c = _b.options, options = _c === void 0 ? EMPTY_OBJECT : _c, _d = _b.plugins, plugins = _d === void 0 ? EMPTY_ARRAY : _d;
554
576
  var _componentId;
@@ -582,7 +604,11 @@ function createStylisInstance(_a) {
582
604
  props[0] = props[0].replace(_selectorRegexp, selfReferenceReplacer);
583
605
  }
584
606
  };
585
- var stringifyRules = function (css, selector, prefix, componentId) {
607
+ var stringifyRules = function (css, selector,
608
+ /**
609
+ * This "prefix" referes to a _selector_ prefix.
610
+ */
611
+ prefix, componentId) {
586
612
  if (selector === void 0) { selector = ''; }
587
613
  if (prefix === void 0) { prefix = ''; }
588
614
  if (componentId === void 0) { componentId = '&'; }
@@ -595,11 +621,18 @@ function createStylisInstance(_a) {
595
621
  _selectorRegexp = new RegExp("\\".concat(_selector, "\\b"), 'g');
596
622
  _consecutiveSelfRefRegExp = new RegExp("(\\".concat(_selector, "\\b){2,}"));
597
623
  var middlewares = plugins.slice();
624
+ /**
625
+ * Enables automatic vendor-prefixing for styles.
626
+ */
598
627
  if (options.prefix || options.prefix === undefined) {
599
628
  middlewares.unshift(stylis.prefixer);
600
629
  }
601
630
  middlewares.push(selfReferenceReplacementPlugin, stylis.stringify);
602
- return serialize(stylis.compile(prefix || selector ? "".concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }") : flatCSS), stylis.middleware(middlewares));
631
+ var compiled = stylis.compile(prefix || selector ? "".concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }") : flatCSS);
632
+ if (options.namespace) {
633
+ compiled = recursivelySetNamepace(compiled, options.namespace);
634
+ }
635
+ return serialize(compiled, stylis.middleware(middlewares));
603
636
  };
604
637
  stringifyRules.hash = plugins.length
605
638
  ? plugins
@@ -614,9 +647,12 @@ function createStylisInstance(_a) {
614
647
  return stringifyRules;
615
648
  }
616
649
 
617
- var StyleSheetContext = React__default["default"].createContext(undefined);
650
+ var StyleSheetContext = React__default.default.createContext({
651
+ shouldForwardProp: undefined,
652
+ styleSheet: undefined,
653
+ });
618
654
  StyleSheetContext.Consumer;
619
- var StylisContext = React__default["default"].createContext(undefined);
655
+ var StylisContext = React__default.default.createContext(undefined);
620
656
  StylisContext.Consumer;
621
657
  new StyleSheet();
622
658
  var mainStylis = createStylisInstance();
@@ -651,7 +687,7 @@ function addUnitIfNeeded(name, value) {
651
687
  if (value == null || typeof value === 'boolean' || value === '') {
652
688
  return '';
653
689
  }
654
- if (typeof value === 'number' && value !== 0 && !(name in unitless__default["default"])) {
690
+ if (typeof value === 'number' && value !== 0 && !(name in unitless__default.default)) {
655
691
  return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers
656
692
  }
657
693
  return String(value).trim();
@@ -668,8 +704,8 @@ function getComponentName(target) {
668
704
  * inlined version of
669
705
  * https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/hyphenateStyleName.js
670
706
  */
671
- var uppercaseCheck = /([A-Z])/;
672
- var uppercasePattern = /([A-Z])/g;
707
+ var uppercaseCheck = /[A-Z]/;
708
+ var uppercasePattern = /[A-Z]/g;
673
709
  var msPattern = /^ms-/;
674
710
  var prefixAndLowerCase = function (char) { return "-".concat(char.toLowerCase()); };
675
711
  /**
@@ -686,7 +722,7 @@ var prefixAndLowerCase = function (char) { return "-".concat(char.toLowerCase())
686
722
  * is converted to `-ms-`.
687
723
  */
688
724
  function hyphenateStyleName(string) {
689
- return uppercaseCheck.test(string)
725
+ return uppercaseCheck.test(string) && !string.startsWith('--')
690
726
  ? string.replace(uppercasePattern, prefixAndLowerCase).replace(msPattern, '-ms-')
691
727
  : string;
692
728
  }
@@ -742,21 +778,18 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
742
778
  var ruleSet = [];
743
779
  for (var i = 0, len = chunk.length, result = void 0; i < len; i += 1) {
744
780
  result = flatten(chunk[i], executionContext, styleSheet, stylisInstance);
745
- if (result === '')
781
+ if (result.length === 0)
746
782
  continue;
747
- else if (Array.isArray(result))
748
- ruleSet.push.apply(ruleSet, result);
749
- else
750
- ruleSet.push(result);
783
+ ruleSet.push.apply(ruleSet, result);
751
784
  }
752
785
  return ruleSet;
753
786
  }
754
787
  if (isFalsish(chunk)) {
755
- return '';
788
+ return [];
756
789
  }
757
790
  /* Handle other components */
758
791
  if (isStyledComponent(chunk)) {
759
- return ".".concat(chunk.styledComponentId);
792
+ return [".".concat(chunk.styledComponentId)];
760
793
  }
761
794
  /* Either execute or defer the function */
762
795
  if (isFunction(chunk)) {
@@ -767,27 +800,27 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
767
800
  typeof result === 'object' &&
768
801
  !Array.isArray(result) &&
769
802
  !(result instanceof Keyframes) &&
770
- !isPlainObject(result)) {
771
- // eslint-disable-next-line no-console
772
- console.error("".concat(getComponentName(
773
- // @ts-expect-error handling unexpected input
774
- chunkFn), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details."));
803
+ !isPlainObject(result) &&
804
+ result !== null) {
805
+ console.error("".concat(getComponentName(chunkFn), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details."));
775
806
  }
776
807
  return flatten(result, executionContext, styleSheet, stylisInstance);
777
808
  }
778
- else
779
- return chunk;
809
+ else {
810
+ return [chunk];
811
+ }
780
812
  }
781
813
  if (chunk instanceof Keyframes) {
782
814
  if (styleSheet) {
783
815
  chunk.inject(styleSheet, stylisInstance);
784
- return chunk.getName(stylisInstance);
816
+ return [chunk.getName(stylisInstance)];
817
+ }
818
+ else {
819
+ return [chunk];
785
820
  }
786
- else
787
- return chunk;
788
821
  }
789
822
  /* Handle objects */
790
- return isPlainObject(chunk) ? objToCssArray(chunk) : chunk.toString();
823
+ return isPlainObject(chunk) ? objToCssArray(chunk) : [chunk.toString()];
791
824
  }
792
825
 
793
826
  function interleave(strings, interpolations) {
@@ -803,11 +836,7 @@ function interleave(strings, interpolations) {
803
836
  * expand an array of styles.
804
837
  */
805
838
  var addTag = function (arg) {
806
- if (Array.isArray(arg)) {
807
- // eslint-disable-next-line no-param-reassign
808
- arg.isCss = true;
809
- }
810
- return arg;
839
+ return Object.assign(arg, { isCss: true });
811
840
  };
812
841
  function css(styles) {
813
842
  var interpolations = [];
@@ -824,7 +853,7 @@ function css(styles) {
824
853
  if (interpolations.length === 0 &&
825
854
  styleStringArray.length === 1 &&
826
855
  typeof styleStringArray[0] === 'string') {
827
- return styleStringArray;
856
+ return flatten(styleStringArray);
828
857
  }
829
858
  return addTag(flatten(interleave(styleStringArray, interpolations)));
830
859
  }
@@ -858,7 +887,7 @@ function constructWithOptions(componentConstructor, tag, options) {
858
887
  return templateFunction;
859
888
  }
860
889
 
861
- var ThemeContext = React__default["default"].createContext(undefined);
890
+ var ThemeContext = React__default.default.createContext(undefined);
862
891
  var ThemeConsumer = ThemeContext.Consumer;
863
892
  function mergeTheme(theme, outerTheme) {
864
893
  if (!theme) {
@@ -887,7 +916,7 @@ function ThemeProvider(props) {
887
916
  if (!props.children) {
888
917
  return null;
889
918
  }
890
- return React__default["default"].createElement(ThemeContext.Provider, { value: themeContext }, props.children);
919
+ return React__default.default.createElement(ThemeContext.Provider, { value: themeContext }, props.children);
891
920
  }
892
921
 
893
922
  function determineTheme(props, providedTheme, defaultProps) {
@@ -1001,14 +1030,13 @@ function hoistNonReactStatics(targetComponent, sourceComponent, excludelist) {
1001
1030
  }
1002
1031
 
1003
1032
  function withTheme(Component) {
1004
- var WithTheme = React__default["default"].forwardRef(function (props, ref) {
1005
- var theme = React__default["default"].useContext(ThemeContext);
1033
+ var WithTheme = React__default.default.forwardRef(function (props, ref) {
1034
+ var theme = React__default.default.useContext(ThemeContext);
1006
1035
  var themeProp = determineTheme(props, theme, Component.defaultProps);
1007
1036
  if (process.env.NODE_ENV !== 'production' && themeProp === undefined) {
1008
- // eslint-disable-next-line no-console
1009
1037
  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), "\""));
1010
1038
  }
1011
- return React__default["default"].createElement(Component, tslib.__assign({}, props, { theme: themeProp, ref: ref }));
1039
+ return React__default.default.createElement(Component, tslib.__assign({}, props, { theme: themeProp, ref: ref }));
1012
1040
  });
1013
1041
  WithTheme.displayName = "WithTheme(".concat(getComponentName(Component), ")");
1014
1042
  return hoistNonReactStatics(WithTheme, Component);
@@ -1058,11 +1086,10 @@ function makeInlineStyleClass(styleSheet) {
1058
1086
  declPairs_1.push([node.prop, node.value]);
1059
1087
  }
1060
1088
  else if (process.env.NODE_ENV !== 'production' && node.type !== 'comment') {
1061
- /* eslint-disable no-console */
1062
1089
  console.warn("Node of type ".concat(node.type, " not supported as an inline style"));
1063
1090
  }
1064
1091
  });
1065
- var styleObject = transformDeclPairs__default["default"](declPairs_1);
1092
+ var styleObject = transformDeclPairs__default.default(declPairs_1);
1066
1093
  var styles = styleSheet.create({
1067
1094
  generated: styleObject,
1068
1095
  });
@@ -1111,7 +1138,6 @@ function mixinRecursively(target, source, forceMerge) {
1111
1138
  * Source objects applied left to right. Mutates & returns target. Similar to lodash merge.
1112
1139
  */
1113
1140
  function mixinDeep(target) {
1114
- if (target === void 0) { target = {}; }
1115
1141
  var sources = [];
1116
1142
  for (var _i = 1; _i < arguments.length; _i++) {
1117
1143
  sources[_i - 1] = arguments[_i];
@@ -1131,20 +1157,15 @@ function useResolvedAttrs(theme, props, attrs) {
1131
1157
  var context = tslib.__assign(tslib.__assign({}, props), { theme: theme });
1132
1158
  var resolvedAttrs = {};
1133
1159
  attrs.forEach(function (attrDef) {
1134
- // @ts-expect-error narrowing isn't working properly for some reason
1135
1160
  var resolvedAttrDef = typeof attrDef === 'function' ? attrDef(context) : attrDef;
1136
1161
  var key;
1137
- /* eslint-disable guard-for-in */
1138
1162
  for (key in resolvedAttrDef) {
1139
1163
  // @ts-expect-error bad types
1140
1164
  context[key] = resolvedAttrs[key] = resolvedAttrDef[key];
1141
1165
  }
1142
- /* eslint-enable guard-for-in */
1143
1166
  });
1144
1167
  return [context, resolvedAttrs];
1145
1168
  }
1146
- // Validator defaults to true if not in HTML/DOM env
1147
- var validAttr = function () { return true; };
1148
1169
  function useStyledComponentImpl(forwardedComponent, props, forwardedRef) {
1149
1170
  var componentAttrs = forwardedComponent.attrs, inlineStyle = forwardedComponent.inlineStyle, defaultProps = forwardedComponent.defaultProps, shouldForwardProp = forwardedComponent.shouldForwardProp, target = forwardedComponent.target;
1150
1171
  // NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
@@ -1154,32 +1175,25 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef) {
1154
1175
  var _a = useResolvedAttrs(theme || EMPTY_OBJECT, props, componentAttrs), context = _a[0], attrs = _a[1];
1155
1176
  var generatedStyles = inlineStyle.generateStyleObject(context);
1156
1177
  var refToForward = forwardedRef;
1157
- var elementToBeCreated = attrs.$as || props.$as || attrs.as || props.as || target;
1178
+ var elementToBeCreated = attrs.as || props.as || target;
1158
1179
  var computedProps = attrs !== props ? tslib.__assign(tslib.__assign({}, props), attrs) : props;
1159
1180
  var propsForElement = {};
1160
- // eslint-disable-next-line guard-for-in
1161
1181
  for (var key in computedProps) {
1162
1182
  if (key[0] === '$' || key === 'as')
1163
1183
  continue;
1164
1184
  else if (key === 'forwardedAs') {
1165
1185
  propsForElement.as = computedProps[key];
1166
1186
  }
1167
- else if (!shouldForwardProp || shouldForwardProp(key, validAttr, elementToBeCreated)) {
1187
+ else if (!shouldForwardProp || shouldForwardProp(key, elementToBeCreated)) {
1168
1188
  propsForElement[key] = computedProps[key];
1169
1189
  }
1170
1190
  }
1171
1191
  propsForElement.style = React.useMemo(function () {
1172
- if (typeof props.style === 'function') {
1173
- return function (state) {
1174
- return [generatedStyles].concat(props.style(state));
1175
- };
1176
- }
1177
- else if (props.style == null) {
1178
- return generatedStyles;
1179
- }
1180
- else {
1181
- return [generatedStyles].concat(props.style || []);
1182
- }
1192
+ return typeof props.style === 'function'
1193
+ ? function (state) { return [generatedStyles].concat(props.style(state)); }
1194
+ : props.style
1195
+ ? [generatedStyles].concat(props.style)
1196
+ : generatedStyles;
1183
1197
  }, [props.style, generatedStyles]);
1184
1198
  propsForElement.ref = refToForward;
1185
1199
  return React.createElement(elementToBeCreated, propsForElement);
@@ -1193,25 +1207,22 @@ var _StyledNativeComponent = (function (InlineStyle) {
1193
1207
  var finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
1194
1208
  ? styledComponentTarget.attrs.concat(attrs).filter(Boolean)
1195
1209
  : attrs;
1196
- // eslint-disable-next-line prefer-destructuring
1197
1210
  var shouldForwardProp = options.shouldForwardProp;
1198
1211
  if (isTargetStyledComp && styledComponentTarget.shouldForwardProp) {
1199
1212
  var shouldForwardPropFn_1 = styledComponentTarget.shouldForwardProp;
1200
1213
  if (options.shouldForwardProp) {
1201
1214
  var passedShouldForwardPropFn_1 = options.shouldForwardProp;
1202
1215
  // compose nested shouldForwardProp calls
1203
- shouldForwardProp = function (prop, filterFn, elementToBeCreated) {
1204
- return shouldForwardPropFn_1(prop, filterFn, elementToBeCreated) &&
1205
- passedShouldForwardPropFn_1(prop, filterFn, elementToBeCreated);
1216
+ shouldForwardProp = function (prop, elementToBeCreated) {
1217
+ return shouldForwardPropFn_1(prop, elementToBeCreated) &&
1218
+ passedShouldForwardPropFn_1(prop, elementToBeCreated);
1206
1219
  };
1207
1220
  }
1208
1221
  else {
1209
- // eslint-disable-next-line prefer-destructuring
1210
1222
  shouldForwardProp = shouldForwardPropFn_1;
1211
1223
  }
1212
1224
  }
1213
1225
  var forwardRef = function (props, ref) {
1214
- // eslint-disable-next-line react-hooks/rules-of-hooks
1215
1226
  return useStyledComponentImpl(WrappedStyledComponent, props, ref);
1216
1227
  };
1217
1228
  forwardRef.displayName = displayName;
@@ -1219,7 +1230,7 @@ var _StyledNativeComponent = (function (InlineStyle) {
1219
1230
  * forwardRef creates a new interim component, which we'll take advantage of
1220
1231
  * instead of extending ParentComponent to create _another_ interim class
1221
1232
  */
1222
- var WrappedStyledComponent = React__default["default"].forwardRef(forwardRef);
1233
+ var WrappedStyledComponent = React__default.default.forwardRef(forwardRef);
1223
1234
  WrappedStyledComponent.attrs = finalAttrs;
1224
1235
  WrappedStyledComponent.inlineStyle = new InlineStyle(isTargetStyledComp ? styledComponentTarget.inlineStyle.rules.concat(rules) : rules);
1225
1236
  WrappedStyledComponent.displayName = displayName;
@@ -1228,10 +1239,6 @@ var _StyledNativeComponent = (function (InlineStyle) {
1228
1239
  WrappedStyledComponent.styledComponentId = true;
1229
1240
  // fold the underlying StyledComponent target up since we folded the styles
1230
1241
  WrappedStyledComponent.target = isTargetStyledComp ? styledComponentTarget.target : target;
1231
- WrappedStyledComponent.withComponent = function withComponent(tag) {
1232
- var newOptions = tslib.__assign(tslib.__assign({}, options), { attrs: finalAttrs });
1233
- return createStyledNativeComponent(tag, newOptions, rules);
1234
- };
1235
1242
  Object.defineProperty(WrappedStyledComponent, 'defaultProps', {
1236
1243
  get: function () {
1237
1244
  return this._foldedDefaultProps;
@@ -1249,14 +1256,12 @@ var _StyledNativeComponent = (function (InlineStyle) {
1249
1256
  displayName: true,
1250
1257
  shouldForwardProp: true,
1251
1258
  target: true,
1252
- withComponent: true,
1253
1259
  });
1254
1260
  return WrappedStyledComponent;
1255
1261
  };
1256
1262
  return createStyledNativeComponent;
1257
1263
  });
1258
1264
 
1259
- // eslint-disable-next-line @typescript-eslint/no-var-requires
1260
1265
  var reactNative = require('react-native');
1261
1266
  var InlineStyle = makeInlineStyleClass(reactNative.StyleSheet);
1262
1267
  var StyledNativeComponent = _StyledNativeComponent(InlineStyle);
@@ -1311,8 +1316,9 @@ exports.ThemeConsumer = ThemeConsumer;
1311
1316
  exports.ThemeContext = ThemeContext;
1312
1317
  exports.ThemeProvider = ThemeProvider;
1313
1318
  exports.css = css;
1314
- exports["default"] = styled;
1319
+ exports.default = styled;
1315
1320
  exports.isStyledComponent = isStyledComponent;
1321
+ exports.styled = styled;
1316
1322
  exports.useTheme = useTheme;
1317
1323
  exports.withTheme = withTheme;
1318
1324
  //# sourceMappingURL=styled-components.native.cjs.js.map