styled-components 6.0.0-beta.3 → 6.0.0-beta.4

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 (240) hide show
  1. package/dist/base.d.ts +1 -1
  2. package/dist/constructors/constructWithOptions.d.ts +8 -14
  3. package/dist/constructors/createGlobalStyle.d.ts +1 -1
  4. package/dist/constructors/css.d.ts +4 -4
  5. package/dist/constructors/styled.d.ts +1 -1
  6. package/dist/native/index.d.ts +25 -25
  7. package/dist/styled-components.browser.cjs.js +38 -44
  8. package/dist/styled-components.browser.cjs.js.map +1 -1
  9. package/dist/styled-components.browser.esm.js +38 -44
  10. package/dist/styled-components.browser.esm.js.map +1 -1
  11. package/dist/styled-components.cjs.js +38 -44
  12. package/dist/styled-components.cjs.js.map +1 -1
  13. package/dist/styled-components.esm.js +38 -44
  14. package/dist/styled-components.esm.js.map +1 -1
  15. package/dist/styled-components.js +38 -44
  16. package/dist/styled-components.js.map +1 -1
  17. package/dist/styled-components.min.js +1 -1
  18. package/dist/styled-components.min.js.map +1 -1
  19. package/dist/test/utils.d.ts +1 -1
  20. package/dist/tsconfig.tsbuildinfo +1 -1
  21. package/dist/types.d.ts +22 -14
  22. package/dist/utils/flatten.d.ts +1 -1
  23. package/dist/utils/interleave.d.ts +1 -1
  24. package/dist/utils/joinStrings.d.ts +1 -1
  25. package/dist/utils/mixinDeep.d.ts +1 -2
  26. package/native/dist/base.d.ts +1 -1
  27. package/native/dist/constructors/constructWithOptions.d.ts +8 -14
  28. package/native/dist/constructors/createGlobalStyle.d.ts +1 -1
  29. package/native/dist/constructors/css.d.ts +4 -4
  30. package/native/dist/constructors/styled.d.ts +1 -1
  31. package/native/dist/native/index.d.ts +25 -25
  32. package/native/dist/styled-components.native.cjs.js +15 -21
  33. package/native/dist/styled-components.native.cjs.js.map +1 -1
  34. package/native/dist/styled-components.native.esm.js +15 -21
  35. package/native/dist/styled-components.native.esm.js.map +1 -1
  36. package/native/dist/test/utils.d.ts +1 -1
  37. package/native/dist/types.d.ts +22 -14
  38. package/native/dist/utils/flatten.d.ts +1 -1
  39. package/native/dist/utils/interleave.d.ts +1 -1
  40. package/native/dist/utils/joinStrings.d.ts +1 -1
  41. package/native/dist/utils/mixinDeep.d.ts +1 -2
  42. package/package.json +3 -3
  43. package/test-utils/index.ts +10 -6
  44. package/native/dist/base.d.ts.map +0 -1
  45. package/native/dist/constants.d.ts.map +0 -1
  46. package/native/dist/constructors/constructWithOptions.d.ts.map +0 -1
  47. package/native/dist/constructors/createGlobalStyle.d.ts.map +0 -1
  48. package/native/dist/constructors/css.d.ts.map +0 -1
  49. package/native/dist/constructors/keyframes.d.ts.map +0 -1
  50. package/native/dist/constructors/styled.d.ts.map +0 -1
  51. package/native/dist/dist/base.d.ts +0 -18
  52. package/native/dist/dist/base.d.ts.map +0 -1
  53. package/native/dist/dist/constants.d.ts +0 -9
  54. package/native/dist/dist/constants.d.ts.map +0 -1
  55. package/native/dist/dist/constructors/constructWithOptions.d.ts +0 -20
  56. package/native/dist/dist/constructors/constructWithOptions.d.ts.map +0 -1
  57. package/native/dist/dist/constructors/createGlobalStyle.d.ts +0 -4
  58. package/native/dist/dist/constructors/createGlobalStyle.d.ts.map +0 -1
  59. package/native/dist/dist/constructors/css.d.ts +0 -5
  60. package/native/dist/dist/constructors/css.d.ts.map +0 -1
  61. package/native/dist/dist/constructors/keyframes.d.ts +0 -4
  62. package/native/dist/dist/constructors/keyframes.d.ts.map +0 -1
  63. package/native/dist/dist/constructors/styled.d.ts +0 -186
  64. package/native/dist/dist/constructors/styled.d.ts.map +0 -1
  65. package/native/dist/dist/hoc/withTheme.d.ts +0 -4
  66. package/native/dist/dist/hoc/withTheme.d.ts.map +0 -1
  67. package/native/dist/dist/hoc/withTheme.spec.d.ts +0 -2
  68. package/native/dist/dist/hoc/withTheme.spec.d.ts.map +0 -1
  69. package/native/dist/dist/hooks/useTheme.d.ts +0 -4
  70. package/native/dist/dist/hooks/useTheme.d.ts.map +0 -1
  71. package/native/dist/dist/index-standalone.d.ts +0 -3
  72. package/native/dist/dist/index-standalone.d.ts.map +0 -1
  73. package/native/dist/dist/index.d.ts +0 -4
  74. package/native/dist/dist/index.d.ts.map +0 -1
  75. package/native/dist/dist/macro/index.d.ts +0 -3
  76. package/native/dist/dist/macro/index.d.ts.map +0 -1
  77. package/native/dist/dist/macro/test/babel.config.d.ts +0 -1
  78. package/native/dist/dist/macro/test/babel.config.d.ts.map +0 -1
  79. package/native/dist/dist/models/ComponentStyle.d.ts +0 -16
  80. package/native/dist/dist/models/ComponentStyle.d.ts.map +0 -1
  81. package/native/dist/dist/models/GlobalStyle.d.ts +0 -12
  82. package/native/dist/dist/models/GlobalStyle.d.ts.map +0 -1
  83. package/native/dist/dist/models/InlineStyle.d.ts +0 -7
  84. package/native/dist/dist/models/InlineStyle.d.ts.map +0 -1
  85. package/native/dist/dist/models/Keyframes.d.ts +0 -12
  86. package/native/dist/dist/models/Keyframes.d.ts.map +0 -1
  87. package/native/dist/dist/models/ServerStyleSheet.d.ts +0 -16
  88. package/native/dist/dist/models/ServerStyleSheet.d.ts.map +0 -1
  89. package/native/dist/dist/models/StyleSheetManager.d.ts +0 -22
  90. package/native/dist/dist/models/StyleSheetManager.d.ts.map +0 -1
  91. package/native/dist/dist/models/StyledComponent.d.ts +0 -4
  92. package/native/dist/dist/models/StyledComponent.d.ts.map +0 -1
  93. package/native/dist/dist/models/StyledNativeComponent.d.ts +0 -4
  94. package/native/dist/dist/models/StyledNativeComponent.d.ts.map +0 -1
  95. package/native/dist/dist/models/ThemeProvider.d.ts +0 -18
  96. package/native/dist/dist/models/ThemeProvider.d.ts.map +0 -1
  97. package/native/dist/dist/native/index.d.ts +0 -65
  98. package/native/dist/dist/native/index.d.ts.map +0 -1
  99. package/native/dist/dist/primitives/index.d.ts +0 -23
  100. package/native/dist/dist/primitives/index.d.ts.map +0 -1
  101. package/native/dist/dist/secretInternals.d.ts +0 -6
  102. package/native/dist/dist/secretInternals.d.ts.map +0 -1
  103. package/native/dist/dist/sheet/GroupIDAllocator.d.ts +0 -5
  104. package/native/dist/dist/sheet/GroupIDAllocator.d.ts.map +0 -1
  105. package/native/dist/dist/sheet/GroupedTag.d.ts +0 -12
  106. package/native/dist/dist/sheet/GroupedTag.d.ts.map +0 -1
  107. package/native/dist/dist/sheet/Rehydration.d.ts +0 -4
  108. package/native/dist/dist/sheet/Rehydration.d.ts.map +0 -1
  109. package/native/dist/dist/sheet/Sheet.d.ts +0 -41
  110. package/native/dist/dist/sheet/Sheet.d.ts.map +0 -1
  111. package/native/dist/dist/sheet/Tag.d.ts +0 -55
  112. package/native/dist/dist/sheet/Tag.d.ts.map +0 -1
  113. package/native/dist/dist/sheet/dom.d.ts +0 -5
  114. package/native/dist/dist/sheet/dom.d.ts.map +0 -1
  115. package/native/dist/dist/sheet/index.d.ts +0 -2
  116. package/native/dist/dist/sheet/index.d.ts.map +0 -1
  117. package/native/dist/dist/sheet/types.d.ts +0 -35
  118. package/native/dist/dist/sheet/types.d.ts.map +0 -1
  119. package/native/dist/dist/test/globals.d.ts +0 -3
  120. package/native/dist/dist/test/globals.d.ts.map +0 -1
  121. package/native/dist/dist/test/utils.d.ts +0 -192
  122. package/native/dist/dist/test/utils.d.ts.map +0 -1
  123. package/native/dist/dist/types.d.ts +0 -121
  124. package/native/dist/dist/types.d.ts.map +0 -1
  125. package/native/dist/dist/utils/addUnitIfNeeded.d.ts +0 -2
  126. package/native/dist/dist/utils/addUnitIfNeeded.d.ts.map +0 -1
  127. package/native/dist/dist/utils/checkDynamicCreation.d.ts +0 -2
  128. package/native/dist/dist/utils/checkDynamicCreation.d.ts.map +0 -1
  129. package/native/dist/dist/utils/createWarnTooManyClasses.d.ts +0 -4
  130. package/native/dist/dist/utils/createWarnTooManyClasses.d.ts.map +0 -1
  131. package/native/dist/dist/utils/determineTheme.d.ts +0 -3
  132. package/native/dist/dist/utils/determineTheme.d.ts.map +0 -1
  133. package/native/dist/dist/utils/domElements.d.ts +0 -3
  134. package/native/dist/dist/utils/domElements.d.ts.map +0 -1
  135. package/native/dist/dist/utils/empties.d.ts +0 -4
  136. package/native/dist/dist/utils/empties.d.ts.map +0 -1
  137. package/native/dist/dist/utils/error.d.ts +0 -6
  138. package/native/dist/dist/utils/error.d.ts.map +0 -1
  139. package/native/dist/dist/utils/errors.d.ts +0 -21
  140. package/native/dist/dist/utils/errors.d.ts.map +0 -1
  141. package/native/dist/dist/utils/escape.d.ts +0 -6
  142. package/native/dist/dist/utils/escape.d.ts.map +0 -1
  143. package/native/dist/dist/utils/flatten.d.ts +0 -5
  144. package/native/dist/dist/utils/flatten.d.ts.map +0 -1
  145. package/native/dist/dist/utils/generateAlphabeticName.d.ts +0 -2
  146. package/native/dist/dist/utils/generateAlphabeticName.d.ts.map +0 -1
  147. package/native/dist/dist/utils/generateComponentId.d.ts +0 -2
  148. package/native/dist/dist/utils/generateComponentId.d.ts.map +0 -1
  149. package/native/dist/dist/utils/generateDisplayName.d.ts +0 -3
  150. package/native/dist/dist/utils/generateDisplayName.d.ts.map +0 -1
  151. package/native/dist/dist/utils/getComponentName.d.ts +0 -3
  152. package/native/dist/dist/utils/getComponentName.d.ts.map +0 -1
  153. package/native/dist/dist/utils/hash.d.ts +0 -4
  154. package/native/dist/dist/utils/hash.d.ts.map +0 -1
  155. package/native/dist/dist/utils/hoist.d.ts +0 -52
  156. package/native/dist/dist/utils/hoist.d.ts.map +0 -1
  157. package/native/dist/dist/utils/hyphenateStyleName.d.ts +0 -15
  158. package/native/dist/dist/utils/hyphenateStyleName.d.ts.map +0 -1
  159. package/native/dist/dist/utils/interleave.d.ts +0 -3
  160. package/native/dist/dist/utils/interleave.d.ts.map +0 -1
  161. package/native/dist/dist/utils/isFunction.d.ts +0 -2
  162. package/native/dist/dist/utils/isFunction.d.ts.map +0 -1
  163. package/native/dist/dist/utils/isPlainObject.d.ts +0 -2
  164. package/native/dist/dist/utils/isPlainObject.d.ts.map +0 -1
  165. package/native/dist/dist/utils/isStatelessFunction.d.ts +0 -2
  166. package/native/dist/dist/utils/isStatelessFunction.d.ts.map +0 -1
  167. package/native/dist/dist/utils/isStaticRules.d.ts +0 -3
  168. package/native/dist/dist/utils/isStaticRules.d.ts.map +0 -1
  169. package/native/dist/dist/utils/isStyledComponent.d.ts +0 -3
  170. package/native/dist/dist/utils/isStyledComponent.d.ts.map +0 -1
  171. package/native/dist/dist/utils/isTag.d.ts +0 -3
  172. package/native/dist/dist/utils/isTag.d.ts.map +0 -1
  173. package/native/dist/dist/utils/joinStrings.d.ts +0 -5
  174. package/native/dist/dist/utils/joinStrings.d.ts.map +0 -1
  175. package/native/dist/dist/utils/mixinDeep.d.ts +0 -8
  176. package/native/dist/dist/utils/mixinDeep.d.ts.map +0 -1
  177. package/native/dist/dist/utils/nonce.d.ts +0 -2
  178. package/native/dist/dist/utils/nonce.d.ts.map +0 -1
  179. package/native/dist/dist/utils/stylis.d.ts +0 -10
  180. package/native/dist/dist/utils/stylis.d.ts.map +0 -1
  181. package/native/dist/hoc/withTheme.d.ts.map +0 -1
  182. package/native/dist/hoc/withTheme.spec.d.ts.map +0 -1
  183. package/native/dist/hooks/useTheme.d.ts.map +0 -1
  184. package/native/dist/index-standalone.d.ts.map +0 -1
  185. package/native/dist/index.d.ts.map +0 -1
  186. package/native/dist/macro/index.d.ts.map +0 -1
  187. package/native/dist/macro/test/babel.config.d.ts +0 -1
  188. package/native/dist/macro/test/babel.config.d.ts.map +0 -1
  189. package/native/dist/models/ComponentStyle.d.ts.map +0 -1
  190. package/native/dist/models/GlobalStyle.d.ts.map +0 -1
  191. package/native/dist/models/InlineStyle.d.ts.map +0 -1
  192. package/native/dist/models/Keyframes.d.ts.map +0 -1
  193. package/native/dist/models/ServerStyleSheet.d.ts.map +0 -1
  194. package/native/dist/models/StyleSheetManager.d.ts.map +0 -1
  195. package/native/dist/models/StyledComponent.d.ts.map +0 -1
  196. package/native/dist/models/StyledNativeComponent.d.ts.map +0 -1
  197. package/native/dist/models/ThemeProvider.d.ts.map +0 -1
  198. package/native/dist/native/index.d.ts.map +0 -1
  199. package/native/dist/primitives/index.d.ts +0 -23
  200. package/native/dist/primitives/index.d.ts.map +0 -1
  201. package/native/dist/secretInternals.d.ts.map +0 -1
  202. package/native/dist/sheet/GroupIDAllocator.d.ts.map +0 -1
  203. package/native/dist/sheet/GroupedTag.d.ts.map +0 -1
  204. package/native/dist/sheet/Rehydration.d.ts.map +0 -1
  205. package/native/dist/sheet/Sheet.d.ts.map +0 -1
  206. package/native/dist/sheet/Tag.d.ts.map +0 -1
  207. package/native/dist/sheet/dom.d.ts.map +0 -1
  208. package/native/dist/sheet/index.d.ts.map +0 -1
  209. package/native/dist/sheet/types.d.ts.map +0 -1
  210. package/native/dist/test/globals.d.ts.map +0 -1
  211. package/native/dist/test/utils.d.ts.map +0 -1
  212. package/native/dist/types.d.ts.map +0 -1
  213. package/native/dist/utils/addUnitIfNeeded.d.ts.map +0 -1
  214. package/native/dist/utils/checkDynamicCreation.d.ts.map +0 -1
  215. package/native/dist/utils/createWarnTooManyClasses.d.ts.map +0 -1
  216. package/native/dist/utils/determineTheme.d.ts.map +0 -1
  217. package/native/dist/utils/domElements.d.ts.map +0 -1
  218. package/native/dist/utils/empties.d.ts.map +0 -1
  219. package/native/dist/utils/error.d.ts.map +0 -1
  220. package/native/dist/utils/errors.d.ts.map +0 -1
  221. package/native/dist/utils/escape.d.ts.map +0 -1
  222. package/native/dist/utils/flatten.d.ts.map +0 -1
  223. package/native/dist/utils/generateAlphabeticName.d.ts.map +0 -1
  224. package/native/dist/utils/generateComponentId.d.ts.map +0 -1
  225. package/native/dist/utils/generateDisplayName.d.ts.map +0 -1
  226. package/native/dist/utils/getComponentName.d.ts.map +0 -1
  227. package/native/dist/utils/hash.d.ts.map +0 -1
  228. package/native/dist/utils/hoist.d.ts.map +0 -1
  229. package/native/dist/utils/hyphenateStyleName.d.ts.map +0 -1
  230. package/native/dist/utils/interleave.d.ts.map +0 -1
  231. package/native/dist/utils/isFunction.d.ts.map +0 -1
  232. package/native/dist/utils/isPlainObject.d.ts.map +0 -1
  233. package/native/dist/utils/isStatelessFunction.d.ts.map +0 -1
  234. package/native/dist/utils/isStaticRules.d.ts.map +0 -1
  235. package/native/dist/utils/isStyledComponent.d.ts.map +0 -1
  236. package/native/dist/utils/isTag.d.ts.map +0 -1
  237. package/native/dist/utils/joinStrings.d.ts.map +0 -1
  238. package/native/dist/utils/mixinDeep.d.ts.map +0 -1
  239. package/native/dist/utils/nonce.d.ts.map +0 -1
  240. package/native/dist/utils/stylis.d.ts.map +0 -1
package/dist/base.d.ts CHANGED
@@ -14,5 +14,5 @@ declare global {
14
14
  }
15
15
  }
16
16
  export * from './secretInternals';
17
- export { Attrs, DefaultTheme, ShouldForwardProp } from './types';
17
+ export { AttrsArg as Attrs, DefaultTheme, ShouldForwardProp } from './types';
18
18
  export { createGlobalStyle, css, isStyledComponent, keyframes, ServerStyleSheet, StyleSheetConsumer, StyleSheetContext, StyleSheetManager, ThemeConsumer, ThemeContext, ThemeProvider, useTheme, SC_VERSION as version, withTheme, };
@@ -1,28 +1,22 @@
1
- /// <reference types="react" />
2
- import { Attrs, Interpolation, IStyledComponent, IStyledComponentFactory, KnownTarget, Runtime, StyledOptions, StyledTarget, Styles } from '../types';
1
+ import React from 'react';
2
+ import { Attrs, AttrsArg, Interpolation, IStyledComponent, IStyledComponentFactory, KnownTarget, Runtime, StyledOptions, StyledTarget, Styles } from '../types';
3
3
  /**
4
4
  * for types a and b, if b shares a field with a, mark a's field as optional
5
5
  */
6
- declare type UnionWithOptionalIntersectedFields<A, B> = {
7
- [K in keyof (A | B)]: K extends keyof B ? A[K] | undefined : A[K];
6
+ declare type OptionalIntersection<A, B> = {
7
+ [K in Extract<keyof A, keyof B>]?: A[K];
8
8
  };
9
- /**
10
- * attrs can be an object or function that returns an object; attrs are always
11
- * optional and should hole-punch required base types if we're providing the
12
- * value via attrs
13
- */
14
- declare type InferAttrResultType<T extends Attrs<object>> = Partial<T extends (...args: any) => infer P ? P : T>;
15
9
  /**
16
10
  * If attrs type is a function (no type provided, inferring from usage), extract the return value
17
11
  * and merge it with the existing type to hole-punch any required fields that are satisfied as
18
12
  * a result of running attrs. Otherwise if we have a definite type then union the base props
19
13
  * with the passed attr type to capture any intended overrides.
20
14
  */
21
- declare type ApplyAttrResultToProps<T extends Attrs<object>, Props extends object> = T extends (...args: any) => object ? UnionWithOptionalIntersectedFields<Props, InferAttrResultType<T>> : Props & InferAttrResultType<T>;
22
- export interface Styled<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object = Target extends KnownTarget ? React.ComponentPropsWithRef<Target> : object, OuterStatics extends object = object> {
15
+ declare type MarkPropsSatisfiedByAttrs<T extends Attrs, Props extends object> = T extends (...args: any) => infer P ? Omit<Props, keyof P> & OptionalIntersection<Props, P> : Omit<Props, keyof T> & Partial<T>;
16
+ export interface Styled<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object = Target extends KnownTarget ? React.HTMLAttributes<Target> & React.ComponentPropsWithRef<Target> : object, OuterStatics extends object = object> {
23
17
  <Props extends object = object, Statics extends object = object>(initialStyles: Styles<OuterProps & Props>, ...interpolations: Interpolation<OuterProps & Props>[]): IStyledComponent<R, Target, OuterProps & Props> & OuterStatics & Statics;
24
- attrs: <T extends Attrs<object>>(attrs: Attrs<T extends object ? OuterProps & T : OuterProps>) => Styled<R, Target, ApplyAttrResultToProps<T, OuterProps>, OuterStatics>;
18
+ attrs: <T extends Attrs>(attrs: AttrsArg<T extends (...args: any) => infer P ? OuterProps & P : OuterProps & T>) => Styled<R, Target, MarkPropsSatisfiedByAttrs<T, OuterProps>, OuterStatics>;
25
19
  withConfig: (config: StyledOptions<R, OuterProps>) => Styled<R, Target, OuterProps, OuterStatics>;
26
20
  }
27
- export default function constructWithOptions<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object = Target extends KnownTarget ? React.ComponentPropsWithRef<Target> : object, OuterStatics extends object = object>(componentConstructor: IStyledComponentFactory<R, Target, OuterProps, OuterStatics>, tag: Target, options?: StyledOptions<R, OuterProps>): Styled<R, Target, OuterProps, OuterStatics>;
21
+ export default function constructWithOptions<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object = Target extends KnownTarget ? React.HTMLAttributes<Target> & React.ComponentPropsWithRef<Target> : object, OuterStatics extends object = object>(componentConstructor: IStyledComponentFactory<R, Target, OuterProps, OuterStatics>, tag: Target, options?: StyledOptions<R, OuterProps>): Styled<R, Target, OuterProps, OuterStatics>;
28
22
  export {};
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { ExecutionProps, Interpolation, Styles } from '../types';
3
- export default function createGlobalStyle<Props extends object>(strings: Styles<Props>, ...interpolations: Array<Interpolation<Props>>): React.NamedExoticComponent<ExecutionProps>;
3
+ export default function createGlobalStyle<Props extends object>(strings: Styles<Props>, ...interpolations: Array<Interpolation<Props>>): React.NamedExoticComponent<ExecutionProps & Props>;
@@ -1,4 +1,4 @@
1
- import { Interpolation, StyledObject, StyleFunction, Styles } from '../types';
2
- export default function css<Props extends object>(styles: Styles<Props>, ...interpolations: Interpolation<Props>[]): string | number | false | import("../types").Keyframes | import("../types").IStyledComponent<"web", any, any> | TemplateStringsArray | StyledObject<Props> | StyleFunction<Props> | (import("../types").RuleSet<Props> & {
3
- isCss?: boolean | undefined;
4
- }) | null | undefined;
1
+ import { Interpolation, RuleSet, Styles } from '../types';
2
+ declare function css(styles: Styles<object>, ...interpolations: Interpolation<object>[]): RuleSet<object>;
3
+ declare function css<Props extends object>(styles: Styles<Props>, ...interpolations: Interpolation<Props>[]): RuleSet<Props>;
4
+ export default css;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { WebTarget } from '../types';
3
3
  import { Styled } from './constructWithOptions';
4
- declare const styled: (<Target extends WebTarget>(tag: Target) => Styled<"web", Target, Target extends import("../types").KnownTarget ? import("react").ComponentPropsWithRef<Target> : object, object>) & {
4
+ declare const styled: (<Target extends WebTarget>(tag: Target) => Styled<"web", Target, Target extends import("../types").KnownTarget ? import("react").HTMLAttributes<Target> & import("react").ComponentPropsWithRef<Target> : object, object>) & {
5
5
  a: Styled<"web", "a", import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, object>;
6
6
  abbr: Styled<"web", "abbr", import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, object>;
7
7
  address: Styled<"web", "address", import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, object>;
@@ -6,31 +6,31 @@ 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) => Styled<"native", Target, Target extends import("../types").KnownTarget ? React.ComponentPropsWithRef<Target> : object, object>) & {
10
- ActivityIndicator: Styled<"native", typeof import("react-native").ActivityIndicator, import("react-native").ActivityIndicatorProps & React.RefAttributes<import("react-native").ActivityIndicator>, object>;
11
- Button: Styled<"native", typeof import("react-native").Button, import("react-native").ButtonProps & React.RefAttributes<import("react-native").Button>, object>;
12
- DatePickerIOS: Styled<"native", typeof import("react-native").DatePickerIOS, import("react-native").DatePickerIOSProps & React.RefAttributes<import("react-native").DatePickerIOS>, object>;
13
- DrawerLayoutAndroid: Styled<"native", typeof import("react-native").DrawerLayoutAndroid, import("react-native").DrawerLayoutAndroidProps & React.RefAttributes<import("react-native").DrawerLayoutAndroid>, object>;
14
- FlatList: Styled<"native", typeof import("react-native").FlatList, import("react-native").FlatListProps<unknown> & React.RefAttributes<import("react-native").FlatList<unknown>>, object>;
15
- Image: Styled<"native", typeof import("react-native").Image, import("react-native").ImageProps & React.RefAttributes<import("react-native").Image>, object>;
16
- ImageBackground: Styled<"native", typeof import("react-native").ImageBackground, import("react-native").ImageBackgroundProps & React.RefAttributes<import("react-native").ImageBackground>, object>;
17
- KeyboardAvoidingView: Styled<"native", typeof import("react-native").KeyboardAvoidingView, import("react-native").KeyboardAvoidingViewProps & React.RefAttributes<import("react-native").KeyboardAvoidingView>, object>;
18
- Modal: Styled<"native", typeof import("react-native").Modal, import("react-native").ModalBaseProps & import("react-native").ModalPropsIOS & import("react-native").ModalPropsAndroid & import("react-native").ViewProps & React.RefAttributes<import("react-native").Modal>, object>;
19
- Pressable: Styled<"native", 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>, object>;
20
- ProgressBarAndroid: Styled<"native", typeof import("react-native").ProgressBarAndroid, import("react-native").ProgressBarAndroidProps & React.RefAttributes<import("react-native").ProgressBarAndroid>, object>;
21
- ProgressViewIOS: Styled<"native", typeof import("react-native").ProgressViewIOS, import("react-native").ProgressViewIOSProps & React.RefAttributes<import("react-native").ProgressViewIOS>, object>;
22
- RefreshControl: Styled<"native", typeof import("react-native").RefreshControl, import("react-native").RefreshControlProps & React.RefAttributes<import("react-native").RefreshControl>, object>;
23
- SafeAreaView: Styled<"native", typeof import("react-native").SafeAreaView, import("react-native").ViewProps & React.RefAttributes<import("react-native").SafeAreaView>, object>;
24
- ScrollView: Styled<"native", typeof import("react-native").ScrollView, import("react-native").ScrollViewProps & React.RefAttributes<import("react-native").ScrollView>, object>;
25
- SectionList: Styled<"native", typeof import("react-native").SectionList, import("react-native").SectionListProps<unknown, unknown> & React.RefAttributes<import("react-native").SectionList<unknown, unknown>>, object>;
26
- Slider: Styled<"native", typeof import("react-native").Slider, import("react-native").SliderProps & React.RefAttributes<import("react-native").Slider>, object>;
27
- Switch: Styled<"native", typeof import("react-native").Switch, import("react-native").SwitchProps & React.RefAttributes<import("react-native").Switch>, object>;
28
- Text: Styled<"native", typeof import("react-native").Text, import("react-native").TextProps & React.RefAttributes<import("react-native").Text>, object>;
29
- TextInput: Styled<"native", typeof import("react-native").TextInput, import("react-native").TextInputProps & React.RefAttributes<import("react-native").TextInput>, object>;
30
- TouchableHighlight: Styled<"native", typeof import("react-native").TouchableHighlight, import("react-native").TouchableHighlightProps & React.RefAttributes<import("react-native").TouchableHighlight>, object>;
31
- TouchableOpacity: Styled<"native", typeof import("react-native").TouchableOpacity, import("react-native").TouchableOpacityProps & React.RefAttributes<import("react-native").TouchableOpacity>, object>;
32
- View: Styled<"native", typeof import("react-native").View, import("react-native").ViewProps & React.RefAttributes<import("react-native").View>, object>;
33
- VirtualizedList: Styled<"native", typeof import("react-native").VirtualizedList, import("react-native").VirtualizedListProps<unknown> & React.RefAttributes<import("react-native").VirtualizedList<unknown>>, object>;
9
+ declare const styled: (<Target extends NativeTarget>(tag: Target) => Styled<"native", Target, Target extends import("../types").KnownTarget ? React.HTMLAttributes<Target> & React.ComponentPropsWithRef<Target> : object, object>) & {
10
+ ActivityIndicator: Styled<"native", typeof import("react-native").ActivityIndicator, React.HTMLAttributes<typeof import("react-native").ActivityIndicator> & import("react-native").ActivityIndicatorProps & React.RefAttributes<import("react-native").ActivityIndicator>, object>;
11
+ Button: Styled<"native", typeof import("react-native").Button, React.HTMLAttributes<typeof import("react-native").Button> & import("react-native").ButtonProps & React.RefAttributes<import("react-native").Button>, object>;
12
+ DatePickerIOS: Styled<"native", typeof import("react-native").DatePickerIOS, React.HTMLAttributes<typeof import("react-native").DatePickerIOS> & import("react-native").DatePickerIOSProps & React.RefAttributes<import("react-native").DatePickerIOS>, object>;
13
+ DrawerLayoutAndroid: Styled<"native", typeof import("react-native").DrawerLayoutAndroid, React.HTMLAttributes<typeof import("react-native").DrawerLayoutAndroid> & import("react-native").DrawerLayoutAndroidProps & React.RefAttributes<import("react-native").DrawerLayoutAndroid>, object>;
14
+ FlatList: Styled<"native", typeof import("react-native").FlatList, React.HTMLAttributes<typeof import("react-native").FlatList> & import("react-native").FlatListProps<unknown> & React.RefAttributes<import("react-native").FlatList<unknown>>, object>;
15
+ Image: Styled<"native", typeof import("react-native").Image, React.HTMLAttributes<typeof import("react-native").Image> & import("react-native").ImageProps & React.RefAttributes<import("react-native").Image>, object>;
16
+ ImageBackground: Styled<"native", typeof import("react-native").ImageBackground, React.HTMLAttributes<typeof import("react-native").ImageBackground> & import("react-native").ImageBackgroundProps & React.RefAttributes<import("react-native").ImageBackground>, object>;
17
+ KeyboardAvoidingView: Styled<"native", typeof import("react-native").KeyboardAvoidingView, React.HTMLAttributes<typeof import("react-native").KeyboardAvoidingView> & import("react-native").KeyboardAvoidingViewProps & React.RefAttributes<import("react-native").KeyboardAvoidingView>, object>;
18
+ Modal: Styled<"native", typeof import("react-native").Modal, React.HTMLAttributes<typeof import("react-native").Modal> & import("react-native").ModalBaseProps & import("react-native").ModalPropsIOS & import("react-native").ModalPropsAndroid & import("react-native").ViewProps & React.RefAttributes<import("react-native").Modal>, object>;
19
+ Pressable: Styled<"native", import("react").ForwardRefExoticComponent<import("react-native").PressableProps & import("react").RefAttributes<import("react-native").View>>, React.HTMLAttributes<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>, object>;
20
+ ProgressBarAndroid: Styled<"native", typeof import("react-native").ProgressBarAndroid, React.HTMLAttributes<typeof import("react-native").ProgressBarAndroid> & import("react-native").ProgressBarAndroidProps & React.RefAttributes<import("react-native").ProgressBarAndroid>, object>;
21
+ ProgressViewIOS: Styled<"native", typeof import("react-native").ProgressViewIOS, React.HTMLAttributes<typeof import("react-native").ProgressViewIOS> & import("react-native").ProgressViewIOSProps & React.RefAttributes<import("react-native").ProgressViewIOS>, object>;
22
+ RefreshControl: Styled<"native", typeof import("react-native").RefreshControl, React.HTMLAttributes<typeof import("react-native").RefreshControl> & import("react-native").RefreshControlProps & React.RefAttributes<import("react-native").RefreshControl>, object>;
23
+ SafeAreaView: Styled<"native", typeof import("react-native").SafeAreaView, React.HTMLAttributes<typeof import("react-native").SafeAreaView> & import("react-native").ViewProps & React.RefAttributes<import("react-native").SafeAreaView>, object>;
24
+ ScrollView: Styled<"native", typeof import("react-native").ScrollView, React.HTMLAttributes<typeof import("react-native").ScrollView> & import("react-native").ScrollViewProps & React.RefAttributes<import("react-native").ScrollView>, object>;
25
+ SectionList: Styled<"native", typeof import("react-native").SectionList, React.HTMLAttributes<typeof import("react-native").SectionList> & import("react-native").SectionListProps<unknown, unknown> & React.RefAttributes<import("react-native").SectionList<unknown, unknown>>, object>;
26
+ Slider: Styled<"native", typeof import("react-native").Slider, React.HTMLAttributes<typeof import("react-native").Slider> & import("react-native").SliderProps & React.RefAttributes<import("react-native").Slider>, object>;
27
+ Switch: Styled<"native", typeof import("react-native").Switch, React.HTMLAttributes<typeof import("react-native").Switch> & import("react-native").SwitchProps & React.RefAttributes<import("react-native").Switch>, object>;
28
+ Text: Styled<"native", typeof import("react-native").Text, React.HTMLAttributes<typeof import("react-native").Text> & import("react-native").TextProps & React.RefAttributes<import("react-native").Text>, object>;
29
+ TextInput: Styled<"native", typeof import("react-native").TextInput, React.HTMLAttributes<typeof import("react-native").TextInput> & import("react-native").TextInputProps & React.RefAttributes<import("react-native").TextInput>, object>;
30
+ TouchableHighlight: Styled<"native", typeof import("react-native").TouchableHighlight, React.HTMLAttributes<typeof import("react-native").TouchableHighlight> & import("react-native").TouchableHighlightProps & React.RefAttributes<import("react-native").TouchableHighlight>, object>;
31
+ TouchableOpacity: Styled<"native", typeof import("react-native").TouchableOpacity, React.HTMLAttributes<typeof import("react-native").TouchableOpacity> & import("react-native").TouchableOpacityProps & React.RefAttributes<import("react-native").TouchableOpacity>, object>;
32
+ View: Styled<"native", typeof import("react-native").View, React.HTMLAttributes<typeof import("react-native").View> & import("react-native").ViewProps & React.RefAttributes<import("react-native").View>, object>;
33
+ VirtualizedList: Styled<"native", typeof import("react-native").VirtualizedList, React.HTMLAttributes<typeof import("react-native").VirtualizedList> & import("react-native").VirtualizedListProps<unknown> & React.RefAttributes<import("react-native").VirtualizedList<unknown>>, object>;
34
34
  };
35
35
  export { IStyledComponent, IStyledComponentFactory, IStyledStatics, NativeTarget, StyledOptions, } from '../types';
36
36
  export { css, isStyledComponent, ThemeProvider, ThemeConsumer, ThemeContext, withTheme, useTheme };
@@ -18,7 +18,7 @@ var SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR
18
18
  'data-styled';
19
19
  var SC_ATTR_ACTIVE = 'active';
20
20
  var SC_ATTR_VERSION = 'data-styled-version';
21
- var SC_VERSION = "6.0.0-beta.3";
21
+ var SC_VERSION = "6.0.0-beta.4";
22
22
  var SPLITTER = '/*!sc*/\n';
23
23
  var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
24
24
  var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
@@ -447,8 +447,12 @@ function isStyledComponent(target) {
447
447
  /**
448
448
  * Convenience function for joining strings to form className chains
449
449
  */
450
- function joinStrings(a, b) {
451
- return a && b ? "".concat(a, " ").concat(b) : a || b;
450
+ function joinStrings() {
451
+ var args = [];
452
+ for (var _i = 0; _i < arguments.length; _i++) {
453
+ args[_i] = arguments[_i];
454
+ }
455
+ return args.filter(Boolean).join(' ');
452
456
  }
453
457
 
454
458
  function isPlainObject(x) {
@@ -487,7 +491,6 @@ function mixinRecursively(target, source, forceMerge) {
487
491
  * Source objects applied left to right. Mutates & returns target. Similar to lodash merge.
488
492
  */
489
493
  function mixinDeep(target) {
490
- if (target === void 0) { target = {}; }
491
494
  var sources = [];
492
495
  for (var _i = 1; _i < arguments.length; _i++) {
493
496
  sources[_i - 1] = arguments[_i];
@@ -1199,21 +1202,18 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
1199
1202
  var ruleSet = [];
1200
1203
  for (var i = 0, len = chunk.length, result = void 0; i < len; i += 1) {
1201
1204
  result = flatten(chunk[i], executionContext, styleSheet, stylisInstance);
1202
- if (result === '')
1205
+ if (result.length === 0)
1203
1206
  continue;
1204
- else if (Array.isArray(result))
1205
- ruleSet.push.apply(ruleSet, result);
1206
- else
1207
- ruleSet.push(result);
1207
+ ruleSet.push.apply(ruleSet, result);
1208
1208
  }
1209
1209
  return ruleSet;
1210
1210
  }
1211
1211
  if (isFalsish(chunk)) {
1212
- return '';
1212
+ return [];
1213
1213
  }
1214
1214
  /* Handle other components */
1215
1215
  if (isStyledComponent(chunk)) {
1216
- return ".".concat(chunk.styledComponentId);
1216
+ return [".".concat(chunk.styledComponentId)];
1217
1217
  }
1218
1218
  /* Either execute or defer the function */
1219
1219
  if (isFunction(chunk)) {
@@ -1230,19 +1230,21 @@ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
1230
1230
  }
1231
1231
  return flatten(result, executionContext, styleSheet, stylisInstance);
1232
1232
  }
1233
- else
1234
- return chunk;
1233
+ else {
1234
+ return [chunk];
1235
+ }
1235
1236
  }
1236
1237
  if (chunk instanceof Keyframes) {
1237
1238
  if (styleSheet) {
1238
1239
  chunk.inject(styleSheet, stylisInstance);
1239
- return chunk.getName(stylisInstance);
1240
+ return [chunk.getName(stylisInstance)];
1241
+ }
1242
+ else {
1243
+ return [chunk];
1240
1244
  }
1241
- else
1242
- return chunk;
1243
1245
  }
1244
1246
  /* Handle objects */
1245
- return isPlainObject(chunk) ? objToCssArray(chunk) : chunk.toString();
1247
+ return isPlainObject(chunk) ? objToCssArray(chunk) : [chunk.toString()];
1246
1248
  }
1247
1249
 
1248
1250
  function isStaticRules(rules) {
@@ -1405,18 +1407,14 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStati
1405
1407
  var theme = determineTheme(props, React.useContext(ThemeContext), defaultProps) || EMPTY_OBJECT;
1406
1408
  var context = componentAttrs.reduce(function (p, attrDef) {
1407
1409
  var resolvedAttrDef = typeof attrDef === 'function' ? attrDef(p) : attrDef;
1408
- var key;
1409
1410
  /* eslint-disable guard-for-in */
1410
- for (key in resolvedAttrDef) {
1411
+ for (var key in resolvedAttrDef) {
1411
1412
  // @ts-expect-error bad types
1412
1413
  p[key] =
1413
1414
  key === 'className'
1414
- ? // @ts-expect-error bad types
1415
- joinStrings(p[key], resolvedAttrDef[key])
1415
+ ? joinStrings(p[key], resolvedAttrDef[key])
1416
1416
  : key === 'style'
1417
- ? // @ts-expect-error bad types
1418
- tslib.__assign(tslib.__assign({}, p[key]), resolvedAttrDef[key]) : // @ts-expect-error bad types
1419
- resolvedAttrDef[key];
1417
+ ? tslib.__assign(tslib.__assign({}, p[key]), resolvedAttrDef[key]) : resolvedAttrDef[key];
1420
1418
  }
1421
1419
  /* eslint-enable guard-for-in */
1422
1420
  return p;
@@ -1425,22 +1423,21 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStati
1425
1423
  var refToForward = forwardedRef;
1426
1424
  var elementToBeCreated = context.as || target;
1427
1425
  var isTargetTag = isTag(elementToBeCreated);
1426
+ var propsForElement = {};
1428
1427
  // eslint-disable-next-line guard-for-in
1429
1428
  for (var key in context) {
1430
- // @ts-expect-error type narrowing not working properly
1431
- if (key[0] === '$' || key === 'as' || key === 'theme')
1432
- context[key] = undefined;
1429
+ // @ts-expect-error for..in iterates strings instead of keyof
1430
+ if (context[key] === undefined) ;
1431
+ else if (key[0] === '$' || key === 'as' || key === 'theme') ;
1433
1432
  else if (key === 'forwardedAs') {
1434
- context.as = context[key];
1435
- context[key] = undefined;
1433
+ propsForElement.as = context.forwardedAs;
1436
1434
  }
1437
- else if (shouldForwardProp ? !shouldForwardProp(key, elementToBeCreated) : false) {
1438
- // Don't pass through non HTML tags through to HTML elements
1439
- // @ts-expect-error we don't know ahead of time
1440
- context[key] = undefined;
1435
+ else if (!shouldForwardProp || shouldForwardProp(key, elementToBeCreated)) {
1436
+ // @ts-expect-error for..in iterates strings instead of keyof
1437
+ propsForElement[key] = context[key];
1441
1438
  }
1442
1439
  }
1443
- context[
1440
+ propsForElement[
1444
1441
  // handle custom elements which React doesn't properly alias
1445
1442
  isTargetTag &&
1446
1443
  domElements.indexOf(elementToBeCreated) === -1
@@ -1449,9 +1446,8 @@ function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStati
1449
1446
  .concat(styledComponentId, generatedClassName !== styledComponentId ? generatedClassName : '', context.className || '')
1450
1447
  .filter(Boolean)
1451
1448
  .join(' ');
1452
- // @ts-expect-error idk the type is probably wrong in this file
1453
- context.ref = refToForward;
1454
- return React.createElement(elementToBeCreated, context);
1449
+ propsForElement.ref = refToForward;
1450
+ return React.createElement(elementToBeCreated, propsForElement);
1455
1451
  }
1456
1452
  function createStyledComponent(target, options, rules) {
1457
1453
  var isTargetStyledComp = isStyledComponent(target);
@@ -1463,7 +1459,9 @@ function createStyledComponent(target, options, rules) {
1463
1459
  : options.componentId || componentId;
1464
1460
  // fold the underlying StyledComponent attrs up (implicit extend)
1465
1461
  var finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
1466
- ? styledComponentTarget.attrs.concat(attrs).filter(Boolean)
1462
+ ? styledComponentTarget.attrs
1463
+ .concat(attrs)
1464
+ .filter(Boolean)
1467
1465
  : attrs;
1468
1466
  var shouldForwardProp = options.shouldForwardProp;
1469
1467
  if (isTargetStyledComp && styledComponentTarget.shouldForwardProp) {
@@ -1558,11 +1556,7 @@ function interleave(strings, interpolations) {
1558
1556
  * expand an array of styles.
1559
1557
  */
1560
1558
  var addTag = function (arg) {
1561
- if (Array.isArray(arg)) {
1562
- // eslint-disable-next-line no-param-reassign
1563
- arg.isCss = true;
1564
- }
1565
- return arg;
1559
+ return Object.assign(arg, { isCss: true });
1566
1560
  };
1567
1561
  function css(styles) {
1568
1562
  var interpolations = [];
@@ -1579,7 +1573,7 @@ function css(styles) {
1579
1573
  if (interpolations.length === 0 &&
1580
1574
  styleStringArray.length === 1 &&
1581
1575
  typeof styleStringArray[0] === 'string') {
1582
- return styleStringArray;
1576
+ return flatten(styleStringArray);
1583
1577
  }
1584
1578
  return addTag(flatten(interleave(styleStringArray, interpolations)));
1585
1579
  }