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

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 +1859 -1
  21. package/dist/styled-components.browser.cjs.js.map +1 -1
  22. package/dist/styled-components.browser.esm.js +1833 -1
  23. package/dist/styled-components.browser.esm.js.map +1 -1
  24. package/dist/styled-components.cjs.js +1880 -1
  25. package/dist/styled-components.cjs.js.map +1 -1
  26. package/dist/styled-components.esm.js +1854 -1
  27. package/dist/styled-components.esm.js.map +1 -1
  28. package/dist/styled-components.js +1979 -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 +88 -81
  65. package/native/dist/styled-components.native.cjs.js.map +1 -1
  66. package/native/dist/styled-components.native.esm.js +75 -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
@@ -2,47 +2,59 @@ import React from 'react';
2
2
  import ComponentStyle from './models/ComponentStyle';
3
3
  import { DefaultTheme } from './models/ThemeProvider';
4
4
  import createWarnTooManyClasses from './utils/createWarnTooManyClasses';
5
- interface ExoticComponentWithDisplayName<P = unknown> extends React.ExoticComponent<P> {
5
+ interface ExoticComponentWithDisplayName<P = any> extends React.ExoticComponent<P> {
6
6
  defaultProps?: Partial<P>;
7
7
  displayName?: string;
8
8
  }
9
+ export declare type OmitNever<T> = {
10
+ [K in keyof T as T[K] extends never ? never : K]: T[K];
11
+ };
12
+ export declare type Runtime = 'web' | 'native';
9
13
  export { DefaultTheme };
10
14
  export declare type AnyComponent<P = any> = ExoticComponentWithDisplayName<P> | React.ComponentType<P>;
11
- export interface StyledOptions<Props> {
12
- attrs?: Attrs<Props>[];
13
- componentId?: string;
14
- displayName?: string;
15
- parentComponentId?: string;
16
- shouldForwardProp?: ShouldForwardProp;
17
- }
18
- export interface StyledNativeOptions<Props> {
19
- attrs?: Attrs<Props>[];
20
- displayName?: string;
21
- shouldForwardProp?: ShouldForwardProp;
22
- }
23
15
  export declare type KnownTarget = keyof JSX.IntrinsicElements | AnyComponent;
24
16
  export declare type WebTarget = string | KnownTarget;
25
17
  export declare type NativeTarget = AnyComponent;
26
- export interface BaseExtensibleObject {
27
- [key: string]: any;
28
- }
29
- export interface ExtensibleObject extends BaseExtensibleObject {
30
- $as?: KnownTarget;
31
- $forwardedAs?: KnownTarget;
18
+ export declare type StyledTarget<R extends Runtime> = R extends 'web' ? WebTarget : NativeTarget;
19
+ export interface StyledOptions<R extends Runtime, Props extends object> {
20
+ attrs?: AttrsArg<Props>[];
21
+ componentId?: R extends 'web' ? string : never;
22
+ displayName?: string;
23
+ parentComponentId?: R extends 'web' ? string : never;
24
+ shouldForwardProp?: ShouldForwardProp<R>;
25
+ }
26
+ export declare type Dict<T> = {
27
+ [key: string]: T;
28
+ };
29
+ export interface ExecutionProps {
30
+ /**
31
+ * Dynamically adjust the rendered component or HTML tag, e.g.
32
+ * ```
33
+ * const StyledButton = styled.button``
34
+ *
35
+ * <StyledButton as="a" href="/foo">
36
+ * I'm an anchor now
37
+ * </StyledButton>
38
+ * ```
39
+ */
32
40
  as?: KnownTarget;
33
41
  forwardedAs?: KnownTarget;
34
42
  theme?: DefaultTheme;
35
43
  }
36
- export interface ExecutionContext extends ExtensibleObject {
44
+ /**
45
+ * ExecutionProps but with `theme` required.
46
+ */
47
+ export interface ExecutionContext extends ExecutionProps {
37
48
  theme: DefaultTheme;
38
49
  }
39
- export interface StyleFunction<Props = ExecutionContext> {
40
- (executionContext: Props): Interpolation<Props>;
50
+ export interface StyleFunction<Props extends object> {
51
+ (executionContext: ExecutionContext & Omit<Props, keyof ExecutionContext>): Interpolation<Props>;
41
52
  }
42
- export declare type Interpolation<Props> = StyleFunction<Props> | StyledObject<Props> | TemplateStringsArray | string | number | Keyframes | IStyledComponent<any, any> | Interpolation<Props>[];
43
- export declare type Attrs<Props> = (ExtensibleObject & Props) | ((props: Props) => Partial<Props>);
44
- export declare type RuleSet<Props> = Interpolation<Props>[];
45
- export declare type Styles<Props> = TemplateStringsArray | StyledObject<Props> | StyleFunction<Props>;
53
+ export declare type Interpolation<Props extends object> = StyleFunction<Props> | StyledObject<Props> | TemplateStringsArray | string | number | false | undefined | null | Keyframes | IStyledComponent<'web', any, any> | Interpolation<Props>[];
54
+ export declare type AttrsArg<Props extends object> = (Omit<ExecutionProps, keyof Props> & Props) | ((props: Omit<ExecutionContext, keyof Props> & Props) => Partial<Props>);
55
+ export declare type Attrs = object | ((...args: any) => object);
56
+ export declare type RuleSet<Props extends object> = Interpolation<Props>[];
57
+ export declare type Styles<Props extends object> = TemplateStringsArray | StyledObject<Props> | StyleFunction<Props>;
46
58
  export declare type NameGenerator = (hash: number) => string;
47
59
  export interface StyleSheet {
48
60
  create: Function;
@@ -52,68 +64,64 @@ export interface Keyframes {
52
64
  name: string;
53
65
  rules: string;
54
66
  }
55
- export interface Flattener<Props> {
67
+ export interface Flattener<Props extends object> {
56
68
  (chunks: Interpolation<Props>[], executionContext: Object | null | undefined, styleSheet: Object | null | undefined): Interpolation<Props>[];
57
69
  }
58
- export declare type FlattenerResult<Props> = RuleSet<Props> | number | string | string[] | IStyledComponent<any, any> | Keyframes;
70
+ export declare type FlattenerResult<Props extends object> = RuleSet<Props> | number | string | string[] | IStyledComponent<'web', any, any> | Keyframes;
59
71
  export interface Stringifier {
60
72
  (css: string, selector?: string, prefix?: string, componentId?: string): string[];
61
73
  hash: string;
62
74
  }
63
- export interface ShouldForwardProp {
64
- (prop: string, isValidAttr: (prop: string) => boolean, elementToBeCreated?: WebTarget | NativeTarget): boolean;
65
- }
66
- export interface CommonStatics<Props> {
67
- attrs: Attrs<Props>[];
68
- target: StyledTarget;
69
- shouldForwardProp?: ShouldForwardProp;
70
- withComponent: any;
71
- }
72
- export interface IStyledStatics<OuterProps = unknown> extends CommonStatics<OuterProps> {
73
- componentStyle: ComponentStyle;
74
- foldedComponentIds: Array<string>;
75
- target: WebTarget;
76
- styledComponentId: string;
77
- warnTooManyClasses?: ReturnType<typeof createWarnTooManyClasses>;
78
- withComponent: <Target extends WebTarget, Props = unknown>(tag: Target) => IStyledComponent<Target, OuterProps & Props>;
79
- }
80
- declare type PolymorphicComponentProps<ActualComponent extends StyledTarget, PropsToBeInjectedIntoActualComponent extends {}, ActualComponentProps = ActualComponent extends KnownTarget ? React.ComponentPropsWithRef<ActualComponent> : {}> = React.HTMLAttributes<ActualComponent> & Omit<PropsToBeInjectedIntoActualComponent, keyof ActualComponentProps | 'as' | '$as'> & ActualComponentProps & ({
81
- $as: ActualComponent;
82
- as?: AnyComponent;
83
- } | {
84
- as?: ActualComponent;
85
- });
86
- interface PolymorphicComponent<FallbackComponent extends StyledTarget, ExpectedProps = unknown, PropsToBeInjectedIntoActualComponent = unknown> extends React.ForwardRefExoticComponent<ExpectedProps> {
87
- <ActualComponent extends StyledTarget = FallbackComponent>(props: PolymorphicComponentProps<ActualComponent, ExpectedProps & PropsToBeInjectedIntoActualComponent>): React.ReactElement<PolymorphicComponentProps<ActualComponent, ExecutionContext & ExpectedProps & PropsToBeInjectedIntoActualComponent>, ActualComponent>;
88
- }
89
- export interface IStyledComponent<Target extends WebTarget, Props = unknown> extends PolymorphicComponent<Target, Props, ExecutionContext>, IStyledStatics<Props> {
90
- defaultProps?: Partial<ExtensibleObject & (Target extends KnownTarget ? React.ComponentProps<Target> : {}) & Props>;
91
- toString: () => string;
75
+ export interface ShouldForwardProp<R extends Runtime> {
76
+ (prop: string, elementToBeCreated: StyledTarget<R>): boolean;
77
+ }
78
+ export interface CommonStatics<R extends Runtime, Props extends object> {
79
+ attrs: AttrsArg<Props>[];
80
+ target: StyledTarget<R>;
81
+ shouldForwardProp?: ShouldForwardProp<R>;
92
82
  }
93
- export interface IStyledComponentFactory<Target extends WebTarget, Props = unknown, Statics = unknown> {
94
- (target: Target, options: StyledOptions<Props>, rules: RuleSet<Props>): IStyledComponent<Target, Props> & Statics;
83
+ export interface IStyledStatics<R extends Runtime, OuterProps extends object> extends CommonStatics<R, OuterProps> {
84
+ componentStyle: R extends 'web' ? ComponentStyle : never;
85
+ foldedComponentIds: R extends 'web' ? Array<string> : never;
86
+ inlineStyle: R extends 'native' ? InstanceType<IInlineStyleConstructor<OuterProps>> : never;
87
+ target: StyledTarget<R>;
88
+ styledComponentId: R extends 'web' ? string : never;
89
+ warnTooManyClasses?: R extends 'web' ? ReturnType<typeof createWarnTooManyClasses> : never;
95
90
  }
96
- export interface IStyledNativeStatics<OuterProps = unknown> extends CommonStatics<OuterProps> {
97
- inlineStyle: InstanceType<IInlineStyleConstructor<OuterProps>>;
98
- target: NativeTarget;
99
- withComponent: <Target extends NativeTarget, Props = unknown>(tag: Target) => IStyledNativeComponent<Target, OuterProps & Props>;
91
+ /**
92
+ * Used by PolymorphicComponent to define prop override cascading order.
93
+ */
94
+ export declare type PolymorphicComponentProps<R extends Runtime, E extends StyledTarget<R>, P extends object> = Omit<E extends KnownTarget ? P & Omit<React.ComponentPropsWithRef<E>, keyof P> : P, 'as' | 'theme'> & {
95
+ as?: P extends {
96
+ as?: string | AnyComponent;
97
+ } ? P['as'] : E;
98
+ theme?: DefaultTheme;
99
+ };
100
+ /**
101
+ * This type forms the signature for a forwardRef-enabled component that accepts
102
+ * the "as" prop to dynamically change the underlying rendered JSX. The interface will
103
+ * automatically attempt to extract props from the given rendering target to
104
+ * get proper typing for any specialized props in the target component.
105
+ */
106
+ export interface PolymorphicComponent<R extends Runtime, P extends object, FallbackComponent extends StyledTarget<R>> extends React.ForwardRefExoticComponent<object> {
107
+ <E extends StyledTarget<R> = FallbackComponent>(props: PolymorphicComponentProps<R, E, P>): React.ReactElement | null;
100
108
  }
101
- export interface IStyledNativeComponent<Target extends NativeTarget, Props = unknown> extends PolymorphicComponent<Target, Props, ExecutionContext>, IStyledNativeStatics<Props> {
102
- defaultProps?: Partial<ExtensibleObject & (Target extends KnownTarget ? React.ComponentProps<Target> : {}) & Props>;
109
+ export interface IStyledComponent<R extends Runtime, Target extends StyledTarget<R>, Props extends object> extends PolymorphicComponent<R, Props, Target>, IStyledStatics<R, Props> {
110
+ defaultProps?: Partial<(Target extends KnownTarget ? ExecutionProps & Omit<React.ComponentProps<Target>, keyof ExecutionProps> : ExecutionProps) & Props>;
111
+ toString: () => string;
103
112
  }
104
- export interface IStyledNativeComponentFactory<Target extends NativeTarget, Props = unknown, Statics = unknown> {
105
- (target: Target, options: StyledNativeOptions<Props>, rules: RuleSet<Props>): IStyledNativeComponent<Target, Props> & Statics;
113
+ export interface IStyledComponentFactory<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object, OuterStatics extends object = object> {
114
+ <Props extends object = object, Statics extends object = object>(target: Target, options: StyledOptions<R, OuterProps & Props>, rules: RuleSet<OuterProps & Props>): IStyledComponent<R, Target, OuterProps & Props> & OuterStatics & Statics;
106
115
  }
107
- export interface IInlineStyleConstructor<Props = unknown> {
116
+ export interface IInlineStyleConstructor<Props extends object> {
108
117
  new (rules: RuleSet<Props>): IInlineStyle<Props>;
109
118
  }
110
- export interface IInlineStyle<Props = unknown> {
119
+ export interface IInlineStyle<Props extends object> {
111
120
  rules: RuleSet<Props>;
112
121
  generateStyleObject(executionContext: Object): Object;
113
122
  }
114
- export declare type StyledTarget = WebTarget | NativeTarget;
115
- export interface StyledObject<Props = ExecutionContext> {
116
- [key: string]: BaseExtensibleObject | string | number | StyleFunction<Props>;
123
+ export interface StyledObject<Props extends object> {
124
+ [key: string]: Dict<any> | string | number | StyleFunction<Props> | StyledObject<Props>;
117
125
  }
118
126
  /**
119
127
  * Override DefaultTheme to get accurate typings for your project.
@@ -137,4 +145,4 @@ export interface StyledObject<Props = ExecutionContext> {
137
145
  * }
138
146
  * ```
139
147
  */
140
- export declare type CSSProp = string | StyledObject | StyleFunction;
148
+ export declare type CSSProp = string | StyledObject<any> | StyleFunction<any>;
@@ -1,2 +1,2 @@
1
- import { ExtensibleObject } from '../types';
2
- export default function determineTheme(props: ExtensibleObject, providedTheme: any, defaultProps?: any): any;
1
+ import { ExecutionProps } from '../types';
2
+ export default function determineTheme(props: ExecutionProps, providedTheme: any, defaultProps?: any): any;
@@ -1,2 +1,2 @@
1
- declare const _default: readonly ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"];
1
+ declare const _default: readonly ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "use", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"];
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
- import { ExtensibleObject } from '../types';
1
+ import { Dict } from '../types';
2
2
  export declare const EMPTY_ARRAY: readonly any[];
3
- export declare const EMPTY_OBJECT: Readonly<ExtensibleObject>;
3
+ export declare const EMPTY_OBJECT: Readonly<Dict<any>>;
@@ -1,4 +1,4 @@
1
1
  import StyleSheet from '../sheet';
2
- import { ExecutionContext, ExtensibleObject, Interpolation, Stringifier } from '../types';
3
- export declare const objToCssArray: (obj: ExtensibleObject, prevKey?: string) => string[];
4
- export default function flatten<Props = unknown>(chunk: Interpolation<Props>, executionContext?: ExecutionContext & Props, styleSheet?: StyleSheet, stylisInstance?: Stringifier): Interpolation<Props>;
2
+ import { Dict, ExecutionContext, Interpolation, RuleSet, Stringifier } from '../types';
3
+ export declare const objToCssArray: (obj: Dict<any>, prevKey?: string) => string[];
4
+ export default function flatten<Props extends object>(chunk: Interpolation<Props>, executionContext?: ExecutionContext & Props, styleSheet?: StyleSheet, stylisInstance?: Stringifier): RuleSet<Props>;
@@ -1,2 +1,2 @@
1
1
  import { StyledTarget } from '../types';
2
- export default function generateDisplayName(target: StyledTarget): string;
2
+ export default function generateDisplayName(target: StyledTarget<any>): string;
@@ -1,2 +1,2 @@
1
1
  import { StyledTarget } from '../types';
2
- export default function getComponentName(target: StyledTarget): string;
2
+ export default function getComponentName(target: StyledTarget<any>): string;
@@ -1,2 +1,2 @@
1
1
  import { Interpolation } from '../types';
2
- export default function interleave<Props = unknown>(strings: TemplateStringsArray, interpolations: Interpolation<Props>[]): Interpolation<Props>[];
2
+ export default function interleave<Props extends object>(strings: readonly string[], interpolations: Interpolation<Props>[]): Interpolation<Props>[];
@@ -1,2 +1,2 @@
1
1
  import { RuleSet } from '../types';
2
- export default function isStaticRules<Props = unknown>(rules: RuleSet<Props>): boolean;
2
+ export default function isStaticRules<Props extends object>(rules: RuleSet<Props>): boolean;
@@ -1,2 +1,2 @@
1
1
  import { IStyledComponent } from '../types';
2
- export default function isStyledComponent(target: any): target is IStyledComponent<any>;
2
+ export default function isStyledComponent(target: any): target is IStyledComponent<'web', any, any>;
@@ -1,2 +1,2 @@
1
1
  import { StyledTarget } from '../types';
2
- export default function isTag(target: StyledTarget): boolean;
2
+ export default function isTag(target: StyledTarget<'web'>): target is string;
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Convenience function for joining strings to form className chains
3
3
  */
4
- export default function joinStrings(a?: string, b?: string): string | undefined;
4
+ export default function joinStrings(...args: any[]): string;
@@ -1,7 +1,6 @@
1
- import { ExtensibleObject } from '../types';
2
1
  /**
3
2
  * Arrays & POJOs merged recursively, other objects and value types are overridden
4
3
  * If target is not a POJO or an Array, it will get source properties injected via shallow merge
5
4
  * Source objects applied left to right. Mutates & returns target. Similar to lodash merge.
6
5
  */
7
- export default function mixinDeep(target?: ExtensibleObject, ...sources: any[]): ExtensibleObject;
6
+ export default function mixinDeep(target: any, ...sources: any[]): any;
@@ -1,10 +1,10 @@
1
1
  import { Middleware } from 'stylis';
2
2
  import { Stringifier } from '../types';
3
- declare type StylisInstanceConstructorArgs = {
3
+ export declare type ICreateStylisInstance = {
4
4
  options?: {
5
+ namespace?: string;
5
6
  prefix?: boolean;
6
7
  };
7
8
  plugins?: Middleware[];
8
9
  };
9
- export default function createStylisInstance({ options, plugins, }?: StylisInstanceConstructorArgs): Stringifier;
10
- export {};
10
+ export default function createStylisInstance({ options, plugins, }?: ICreateStylisInstance): Stringifier;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "styled-components",
3
- "version": "6.0.0-beta.1",
3
+ "version": "6.0.0-beta.11",
4
4
  "description": "Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/styled-components.cjs.js",
@@ -20,11 +20,9 @@
20
20
  "postbuild": "yarn lint:size",
21
21
  "pretest": "yarn generateErrors",
22
22
  "test": "yarn test:web && yarn test:native",
23
- "test:web": "jest -c jest.config.main.js --forceExit",
23
+ "test:web": "jest -c jest.config.main.js",
24
24
  "test:native": "jest -c jest.config.native.js --forceExit",
25
25
  "test:integration": "jest -c jest.config.integration.js --runInBand --forceExit",
26
- "format": "eslint ./**/*.js --fix",
27
- "lint": "eslint src",
28
26
  "lint:size": "bundlewatch",
29
27
  "prettier": "prettier src/** --write",
30
28
  "prepublishOnly": "cp ../../README.md . && yarn build"
@@ -59,75 +57,78 @@
59
57
  },
60
58
  "homepage": "https://styled-components.com",
61
59
  "dependencies": {
62
- "@babel/cli": "^7.18.6",
63
- "@babel/core": "^7.18.6",
60
+ "@babel/cli": "^7.20.7",
61
+ "@babel/core": "^7.20.7",
64
62
  "@babel/helper-module-imports": "^7.18.6",
65
63
  "@babel/plugin-external-helpers": "^7.18.6",
66
64
  "@babel/plugin-proposal-class-properties": "^7.18.6",
67
- "@babel/plugin-proposal-object-rest-spread": "^7.18.6",
68
- "@babel/preset-env": "^7.18.6",
65
+ "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
66
+ "@babel/preset-env": "^7.20.2",
69
67
  "@babel/preset-react": "^7.18.6",
70
68
  "@babel/preset-typescript": "^7.18.6",
71
- "@babel/traverse": "^7.18.8",
72
- "@emotion/is-prop-valid": "^1.1.3",
73
- "@emotion/unitless": "^0.7.4",
69
+ "@babel/traverse": "^7.20.10",
70
+ "@emotion/unitless": "^0.8.0",
74
71
  "css-to-react-native": "^3.0.0",
75
72
  "shallowequal": "^1.1.0",
76
- "stylis": "^4.1.1"
73
+ "stylis": "^4.1.3",
74
+ "tslib": "^2.4.1"
77
75
  },
78
76
  "peerDependencies": {
79
77
  "babel-plugin-styled-components": ">= 2",
80
78
  "react": ">= 16.8.0",
81
- "react-dom": ">= 16.8.0"
79
+ "react-dom": ">= 16.8.0",
80
+ "shallowequal": ">= 1",
81
+ "stylis": "^4.0.0",
82
+ "tslib": "^2.0.0"
82
83
  },
83
84
  "peerDependenciesMeta": {
84
85
  "babel-plugin-styled-components": {
85
86
  "optional": true
87
+ },
88
+ "shallowequal": {
89
+ "optional": true
90
+ },
91
+ "stylis": {
92
+ "optional": true
93
+ },
94
+ "tslib": {
95
+ "optional": true
86
96
  }
87
97
  },
88
98
  "devDependencies": {
89
- "@babel/plugin-transform-flow-strip-types": "^7.18.6",
90
- "@rollup/plugin-typescript": "^8.3.3",
99
+ "@babel/plugin-transform-flow-strip-types": "^7.19.0",
100
+ "@rollup/plugin-typescript": "^10.0.1",
91
101
  "@types/babel-plugin-macros": "^2.8.4",
92
- "@types/enzyme": "^3.10.9",
93
- "@types/jest": "^28.1.6",
102
+ "@types/enzyme": "^3.10.12",
103
+ "@types/jest": "^29.2.4",
94
104
  "@types/js-beautify": "^1.13.1",
95
- "@types/node": "^14.0.0",
105
+ "@types/node": "^18.11.17",
96
106
  "@types/react": "^17.0.22",
97
107
  "@types/react-dom": "^17.0.9",
98
- "@types/react-frame-component": "^4.1.1",
108
+ "@types/react-frame-component": "^4.1.3",
99
109
  "@types/react-native": "^0.69.1",
100
110
  "@types/react-test-renderer": "^17.0.1",
101
111
  "@types/shallowequal": "^1.1.1",
102
112
  "@types/stylis": "^4.0.2",
103
- "@typescript-eslint/eslint-plugin": "^4.20.0",
104
- "@typescript-eslint/parser": "^4.20.0",
105
- "babel-eslint": "^10.0.1",
106
- "babel-jest": "^28.1.3",
113
+ "babel-jest": "^29.3.1",
107
114
  "babel-plugin-add-module-exports": "^1.0.4",
108
115
  "babel-plugin-macros": "^3.1.0",
109
- "babel-plugin-styled-components": "^2.0.5",
116
+ "babel-plugin-styled-components": "^2.0.7",
110
117
  "babel-plugin-tester": "^10.0.0",
111
- "bundlewatch": "^0.3.1",
112
- "eslint": "^7.23.0",
113
- "eslint-config-prettier": "^8.3.0",
114
- "eslint-plugin-prettier": "^4.0.0",
115
- "eslint-plugin-react": "^7.20.6",
116
- "eslint-plugin-react-hooks": "^4.2.0",
117
- "jest": "^28.1.3",
118
- "jest-environment-jsdom": "^28.1.3",
119
- "jest-image-snapshot": "^4.2.0",
118
+ "bundlewatch": "^0.3.3",
119
+ "jest": "^29.3.1",
120
+ "jest-environment-jsdom": "^29.3.1",
120
121
  "jest-serializer-html": "^7.0.0",
121
122
  "jest-watch-typeahead": "^2.0.0",
122
- "js-beautify": "^1.13.0",
123
- "prettier": "^2.2.0",
124
- "prop-types": "^15.7.2",
123
+ "js-beautify": "^1.14.7",
124
+ "prettier": "^2.8.1",
125
+ "prop-types": "^15.8.1",
125
126
  "react": "^17.0.2",
126
127
  "react-dom": "^17.0.2",
127
128
  "react-frame-component": "^4.0.2",
128
- "react-native": "^0.69.1",
129
+ "react-native": "^0.70.6",
129
130
  "react-test-renderer": "^17.0.2",
130
- "rollup": "^2.76.0",
131
+ "rollup": "^3.0.0",
131
132
  "rollup-plugin-commonjs": "^10.1.0",
132
133
  "rollup-plugin-json": "^4.0.0",
133
134
  "rollup-plugin-node-resolve": "^5.2.0",
@@ -135,7 +136,7 @@
135
136
  "rollup-plugin-sourcemaps": "^0.6.3",
136
137
  "rollup-plugin-terser": "^7.0.2",
137
138
  "stylis-plugin-rtl": "^2.1.1",
138
- "typescript": "^4.7.4",
139
+ "typescript": "^4.8.4",
139
140
  "utility-types": "^3.10.0"
140
141
  },
141
142
  "bundlewatch": {
@@ -1,5 +1,5 @@
1
- import { ReactWrapper } from "enzyme";
2
- import { IStyledComponent } from "../src/types";
1
+ import { ReactWrapper } from 'enzyme';
2
+ import { IStyledComponent } from '../src/types';
3
3
 
4
4
  function assertElement(element: any) {
5
5
  if (!(element instanceof HTMLElement)) {
@@ -9,7 +9,8 @@ function assertElement(element: any) {
9
9
 
10
10
  function assertStyledComponent(styledComponent: any) {
11
11
  if (
12
- !(styledComponent.styledComponentId && typeof styledComponent.styledComponentId === 'string')
12
+ !styledComponent?.styledComponentId ||
13
+ typeof styledComponent.styledComponentId !== 'string'
13
14
  ) {
14
15
  throw new Error(
15
16
  `${
@@ -19,19 +20,22 @@ function assertStyledComponent(styledComponent: any) {
19
20
  }
20
21
  }
21
22
 
22
- export function enzymeFind(wrapper: ReactWrapper, styledComponent: IStyledComponent) {
23
+ export function enzymeFind(
24
+ wrapper: ReactWrapper,
25
+ styledComponent: IStyledComponent<'web', any, any>
26
+ ) {
23
27
  assertStyledComponent(styledComponent);
24
28
 
25
29
  return wrapper.find(`.${styledComponent.styledComponentId}`);
26
30
  }
27
31
 
28
- export function find(element: Element, styledComponent: IStyledComponent) {
32
+ export function find(element: Element, styledComponent: IStyledComponent<'web', any, any>) {
29
33
  assertElement(element);
30
34
  assertStyledComponent(styledComponent);
31
35
  return element.querySelector(`.${styledComponent.styledComponentId}`);
32
36
  }
33
37
 
34
- export function findAll(element: Element, styledComponent: IStyledComponent) {
38
+ export function findAll(element: Element, styledComponent: IStyledComponent<'web', any, any>) {
35
39
  assertElement(element);
36
40
  assertStyledComponent(styledComponent);
37
41
  return element.querySelectorAll(`.${styledComponent.styledComponentId}`);
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["src/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AACjE,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,SAAS,MAAM,0BAA0B,CAAC;AAEjD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,OAAO,gBAAgB,MAAM,2BAA2B,CAAC;AACzD,OAAO,iBAAiB,EAAE,EACxB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,aAAa,EAAE,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAI1D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,4BAA4B,CAAC,EAAE,MAAM,CAAC;KACvC;CACF;AAsCD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EACL,iBAAiB,EACjB,GAAG,EACH,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,UAAU,IAAI,OAAO,EACrB,SAAS,GACV,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,EAAE,MAEP,CAAC;AAEhB,eAAO,MAAM,cAAc,WAAW,CAAC;AACvC,eAAO,MAAM,eAAe,wBAAwB,CAAC;AACrD,eAAO,MAAM,UAAU,QAAc,CAAC;AACtC,eAAO,MAAM,QAAQ,cAAc,CAAC;AAEpC,eAAO,MAAM,UAAU,SAA2D,CAAC;AAEnF,eAAO,MAAM,cAAc,SAgB1B,CAAC;AAGF,eAAO,MAAM,wBAAwB,IAAK,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constructWithOptions.d.ts","sourceRoot":"","sources":["../src/constructors/constructWithOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,6BAA6B,EAC7B,YAAY,EAEZ,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,MAAM,EACN,SAAS,EACV,MAAM,UAAU,CAAC;AAKlB,MAAM,WAAW,YAAY,CAC3B,MAAM,SAAS,YAAY,EAC3B,UAAU,GAAG,OAAO,EACpB,YAAY,GAAG,OAAO;IAEtB,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EACjC,aAAa,EAAE,MAAM,CAAC,UAAU,GAAG,KAAK,CAAC,EACzC,GAAG,cAAc,EAAE,OAAO,CAAC,aAAa,CAAC,UAAU,GAAG,KAAK,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,GACrF,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,KAAK,CAAC,GAAG,YAAY,GAAG,OAAO,CAAC;IAC/E,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAChF,UAAU,CACR,MAAM,EAAE,mBAAmB,CAAC,UAAU,CAAC,GACtC,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,SAAS,CAAC,MAAM,SAAS,SAAS,EAAE,UAAU,GAAG,OAAO,EAAE,YAAY,GAAG,OAAO;IAC/F,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EACjC,aAAa,EAAE,MAAM,CAAC,UAAU,GAAG,KAAK,CAAC,EACzC,GAAG,cAAc,EAAE,aAAa,CAAC,UAAU,GAAG,KAAK,CAAC,EAAE,GACrD,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,KAAK,CAAC,GAAG,YAAY,GAAG,OAAO,CAAC;IACzE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAC7E,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;CAC5F;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,WAAW,SAAS,KAAK,GAAG,QAAQ,EACpC,MAAM,SAAS,YAAY,EAC3B,UAAU,GAAG,OAAO,EAAE,yEAAyE;AAC/F,YAAY,GAAG,OAAO,EAEtB,oBAAoB,EAAE,WAAW,SAAS,KAAK,GAC3C,uBAAuB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACtC,6BAA6B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAChD,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAW,SAAS,KAAK,GAC9B,aAAa,CAAC,UAAU,CAAC,GACzB,mBAAmB,CAAC,UAAU,CAA6C;;iBA6B9C,MAAM,UAAU,CAAC;IAMlD;yFACqF;uBAE3E,WAAW,SAAS,KAAK,GAAG,cAAc,UAAU,CAAC,GAAG,oBAAoB,UAAU,CAAC;EAQlG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createGlobalStyle.d.ts","sourceRoot":"","sources":["../src/constructors/createGlobalStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAMnE,OAAO,EAEL,gBAAgB,EAChB,aAAa,EAGb,MAAM,EACP,MAAM,UAAU,CAAC;AAMlB,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,GAAG,OAAO,EACvD,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EACtB,GAAG,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,gDA6E/C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../src/constructors/css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA+B,MAAM,EAAE,MAAM,UAAU,CAAC;AAmB9E,MAAM,CAAC,OAAO,UAAU,GAAG,CAAC,KAAK,EAC/B,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,EACrB,GAAG,cAAc,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE;;GA0B1C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyframes.d.ts","sourceRoot":"","sources":["../src/constructors/keyframes.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIjD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,GAAG,OAAO,EAC/C,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EACtB,GAAG,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GAC7C,SAAS,CAgBX"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../src/constructors/styled.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAA6B,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAKzE,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEX,CAAC;AAQF,eAAe,MAAM,CAAC"}
@@ -1,18 +0,0 @@
1
- import { SC_VERSION } from './constants';
2
- import createGlobalStyle from './constructors/createGlobalStyle';
3
- import css from './constructors/css';
4
- import keyframes from './constructors/keyframes';
5
- import withTheme from './hoc/withTheme';
6
- import useTheme from './hooks/useTheme';
7
- import ServerStyleSheet from './models/ServerStyleSheet';
8
- import StyleSheetManager, { StyleSheetConsumer, StyleSheetContext } from './models/StyleSheetManager';
9
- import ThemeProvider, { ThemeConsumer, ThemeContext } from './models/ThemeProvider';
10
- import isStyledComponent from './utils/isStyledComponent';
11
- declare global {
12
- interface Window {
13
- '__styled-components-init__'?: number;
14
- }
15
- }
16
- export * from './secretInternals';
17
- export { createGlobalStyle, css, isStyledComponent, keyframes, ServerStyleSheet, StyleSheetConsumer, StyleSheetContext, StyleSheetManager, ThemeConsumer, ThemeContext, ThemeProvider, useTheme, SC_VERSION as version, withTheme, };
18
- //# sourceMappingURL=base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AACjE,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,SAAS,MAAM,0BAA0B,CAAC;AAEjD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,OAAO,gBAAgB,MAAM,2BAA2B,CAAC;AACzD,OAAO,iBAAiB,EAAE,EACxB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,aAAa,EAAE,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAI1D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,4BAA4B,CAAC,EAAE,MAAM,CAAC;KACvC;CACF;AAsCD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EACL,iBAAiB,EACjB,GAAG,EACH,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,UAAU,IAAI,OAAO,EACrB,SAAS,GACV,CAAC"}
@@ -1,9 +0,0 @@
1
- export declare const SC_ATTR: string;
2
- export declare const SC_ATTR_ACTIVE = "active";
3
- export declare const SC_ATTR_VERSION = "data-styled-version";
4
- export declare const SC_VERSION: string;
5
- export declare const SPLITTER = "/*!sc*/\n";
6
- export declare const IS_BROWSER: boolean;
7
- export declare const DISABLE_SPEEDY: boolean;
8
- export declare const STATIC_EXECUTION_CONTEXT: {};
9
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,EAAE,MAEP,CAAC;AAEhB,eAAO,MAAM,cAAc,WAAW,CAAC;AACvC,eAAO,MAAM,eAAe,wBAAwB,CAAC;AACrD,eAAO,MAAM,UAAU,QAAc,CAAC;AACtC,eAAO,MAAM,QAAQ,cAAc,CAAC;AAEpC,eAAO,MAAM,UAAU,SAA2D,CAAC;AAEnF,eAAO,MAAM,cAAc,SAgB1B,CAAC;AAGF,eAAO,MAAM,wBAAwB,IAAK,CAAC"}
@@ -1,20 +0,0 @@
1
- import { Attrs, Interpolation, IStyledComponent, IStyledComponentFactory, IStyledNativeComponent, IStyledNativeComponentFactory, NativeTarget, StyledNativeOptions, StyledOptions, StyledTarget, Styles, WebTarget } from '../types';
2
- export interface NativeStyled<Target extends NativeTarget, OuterProps = unknown, OuterStatics = unknown> {
3
- <Props = unknown, Statics = unknown>(initialStyles: Styles<OuterProps & Props>, ...interpolations: Exclude<Interpolation<OuterProps & Props>, IStyledComponent<any>>[]): IStyledNativeComponent<Target, OuterProps & Props> & OuterStatics & Statics;
4
- attrs(attrs: Attrs<OuterProps>): NativeStyled<Target, OuterProps, OuterStatics>;
5
- withConfig(config: StyledNativeOptions<OuterProps>): NativeStyled<Target, OuterProps, OuterStatics>;
6
- }
7
- export interface WebStyled<Target extends WebTarget, OuterProps = unknown, OuterStatics = unknown> {
8
- <Props = unknown, Statics = unknown>(initialStyles: Styles<OuterProps & Props>, ...interpolations: Interpolation<OuterProps & Props>[]): IStyledComponent<Target, OuterProps & Props> & OuterStatics & Statics;
9
- attrs(attrs: Attrs<OuterProps>): WebStyled<Target, OuterProps, OuterStatics>;
10
- withConfig(config: StyledOptions<OuterProps>): WebStyled<Target, OuterProps, OuterStatics>;
11
- }
12
- export default function constructWithOptions<Environment extends 'web' | 'native', Target extends StyledTarget, OuterProps = unknown, // used for styled<{}>().attrs() so attrs() gets the generic prop context
13
- OuterStatics = unknown>(componentConstructor: Environment extends 'web' ? IStyledComponentFactory<any, any, any> : IStyledNativeComponentFactory<any, any, any>, tag: Target, options?: Environment extends 'web' ? StyledOptions<OuterProps> : StyledNativeOptions<OuterProps>): {
14
- <Props = unknown, Statics = unknown>(initialStyles: Styles<OuterProps & Props>, ...interpolations: Interpolation<OuterProps & Props>[]): ReturnType<Environment extends "web" ? IStyledComponentFactory<Target, OuterProps & Props, OuterStatics & Statics> : IStyledNativeComponentFactory<Target, OuterProps & Props, OuterStatics & Statics>>;
15
- attrs(attrs: Attrs<OuterProps>): any;
16
- /**
17
- * If config methods are called, wrap up a new template function and merge options */
18
- withConfig(config: Environment extends 'web' ? StyledOptions<OuterProps> : StyledNativeOptions<OuterProps>): any;
19
- };
20
- //# sourceMappingURL=constructWithOptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constructWithOptions.d.ts","sourceRoot":"","sources":["../../src/constructors/constructWithOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,6BAA6B,EAC7B,YAAY,EAEZ,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,MAAM,EACN,SAAS,EACV,MAAM,UAAU,CAAC;AAKlB,MAAM,WAAW,YAAY,CAC3B,MAAM,SAAS,YAAY,EAC3B,UAAU,GAAG,OAAO,EACpB,YAAY,GAAG,OAAO;IAEtB,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EACjC,aAAa,EAAE,MAAM,CAAC,UAAU,GAAG,KAAK,CAAC,EACzC,GAAG,cAAc,EAAE,OAAO,CAAC,aAAa,CAAC,UAAU,GAAG,KAAK,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,GACrF,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,KAAK,CAAC,GAAG,YAAY,GAAG,OAAO,CAAC;IAC/E,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAChF,UAAU,CACR,MAAM,EAAE,mBAAmB,CAAC,UAAU,CAAC,GACtC,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,SAAS,CAAC,MAAM,SAAS,SAAS,EAAE,UAAU,GAAG,OAAO,EAAE,YAAY,GAAG,OAAO;IAC/F,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EACjC,aAAa,EAAE,MAAM,CAAC,UAAU,GAAG,KAAK,CAAC,EACzC,GAAG,cAAc,EAAE,aAAa,CAAC,UAAU,GAAG,KAAK,CAAC,EAAE,GACrD,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,KAAK,CAAC,GAAG,YAAY,GAAG,OAAO,CAAC;IACzE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAC7E,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;CAC5F;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,WAAW,SAAS,KAAK,GAAG,QAAQ,EACpC,MAAM,SAAS,YAAY,EAC3B,UAAU,GAAG,OAAO,EAAE,yEAAyE;AAC/F,YAAY,GAAG,OAAO,EAEtB,oBAAoB,EAAE,WAAW,SAAS,KAAK,GAC3C,uBAAuB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACtC,6BAA6B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAChD,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAW,SAAS,KAAK,GAC9B,aAAa,CAAC,UAAU,CAAC,GACzB,mBAAmB,CAAC,UAAU,CAA6C;;iBA6B9C,MAAM,UAAU,CAAC;IAMlD;yFACqF;uBAE3E,WAAW,SAAS,KAAK,GAAG,cAAc,UAAU,CAAC,GAAG,oBAAoB,UAAU,CAAC;EAQlG"}
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { ExtensibleObject, Interpolation, Styles } from '../types';
3
- export default function createGlobalStyle<Props = unknown>(strings: Styles<Props>, ...interpolations: Array<Interpolation<Props>>): React.NamedExoticComponent<ExtensibleObject>;
4
- //# sourceMappingURL=createGlobalStyle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createGlobalStyle.d.ts","sourceRoot":"","sources":["../../src/constructors/createGlobalStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAMnE,OAAO,EAEL,gBAAgB,EAChB,aAAa,EAGb,MAAM,EACP,MAAM,UAAU,CAAC;AAMlB,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,GAAG,OAAO,EACvD,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EACtB,GAAG,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,gDA6E/C"}
@@ -1,5 +0,0 @@
1
- import { Interpolation, Styles } from '../types';
2
- export default function css<Props>(styles: Styles<Props>, ...interpolations: Interpolation<Props>[]): TemplateStringsArray | (Interpolation<Props> & {
3
- isCss?: boolean | undefined;
4
- });
5
- //# sourceMappingURL=css.d.ts.map