styled-components 5.3.9 → 5.3.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 (236) hide show
  1. package/dist/styled-components.browser.cjs.js +1 -1
  2. package/dist/styled-components.browser.cjs.js.map +1 -1
  3. package/dist/styled-components.browser.esm.js +1 -1
  4. package/dist/styled-components.browser.esm.js.map +1 -1
  5. package/dist/styled-components.cjs.js +1 -1
  6. package/dist/styled-components.cjs.js.map +1 -1
  7. package/dist/styled-components.esm.js +1 -1
  8. package/dist/styled-components.esm.js.map +1 -1
  9. package/dist/styled-components.js +1 -1
  10. package/dist/styled-components.js.map +1 -1
  11. package/dist/styled-components.min.js +1 -1
  12. package/dist/styled-components.min.js.map +1 -1
  13. package/native/dist/base.d.ts +2 -3
  14. package/native/dist/constructors/constructWithOptions.d.ts +18 -3
  15. package/native/dist/index.d.ts +1 -1
  16. package/native/dist/models/ComponentStyle.d.ts +0 -1
  17. package/native/dist/models/StyleSheetManager.d.ts +6 -7
  18. package/native/dist/models/ThemeProvider.d.ts +1 -0
  19. package/native/dist/native/index.d.ts +25 -26
  20. package/native/dist/sheet/GroupedTag.d.ts +1 -1
  21. package/native/dist/styled-components.native.cjs.js +3 -3
  22. package/native/dist/styled-components.native.cjs.js.map +1 -1
  23. package/native/dist/styled-components.native.esm.js +3 -3
  24. package/native/dist/styled-components.native.esm.js.map +1 -1
  25. package/native/dist/test/types.d.ts +9 -1
  26. package/native/dist/test/veryLargeUnionType.d.ts +1 -0
  27. package/native/dist/types.d.ts +28 -23
  28. package/native/dist/utils/determineTheme.d.ts +4 -2
  29. package/native/dist/utils/domElements.d.ts +1 -1
  30. package/native/dist/utils/flatten.d.ts +1 -1
  31. package/native/dist/utils/isPlainObject.d.ts +1 -1
  32. package/native/dist/utils/isStatelessFunction.d.ts +1 -1
  33. package/native/dist/utils/joinStrings.d.ts +2 -1
  34. package/package.json +1 -1
  35. package/primitives/dist/styled-components-primitives.cjs.js +3 -3
  36. package/primitives/dist/styled-components-primitives.cjs.js.map +1 -1
  37. package/primitives/dist/styled-components-primitives.esm.js +3 -3
  38. package/primitives/dist/styled-components-primitives.esm.js.map +1 -1
  39. package/native/dist/base.d.ts.map +0 -1
  40. package/native/dist/constants.d.ts.map +0 -1
  41. package/native/dist/constructors/constructWithOptions.d.ts.map +0 -1
  42. package/native/dist/constructors/createGlobalStyle.d.ts.map +0 -1
  43. package/native/dist/constructors/css.d.ts.map +0 -1
  44. package/native/dist/constructors/keyframes.d.ts.map +0 -1
  45. package/native/dist/constructors/styled.d.ts.map +0 -1
  46. package/native/dist/dist/base.d.ts +0 -18
  47. package/native/dist/dist/base.d.ts.map +0 -1
  48. package/native/dist/dist/constants.d.ts +0 -9
  49. package/native/dist/dist/constants.d.ts.map +0 -1
  50. package/native/dist/dist/constructors/constructWithOptions.d.ts +0 -20
  51. package/native/dist/dist/constructors/constructWithOptions.d.ts.map +0 -1
  52. package/native/dist/dist/constructors/createGlobalStyle.d.ts +0 -4
  53. package/native/dist/dist/constructors/createGlobalStyle.d.ts.map +0 -1
  54. package/native/dist/dist/constructors/css.d.ts +0 -5
  55. package/native/dist/dist/constructors/css.d.ts.map +0 -1
  56. package/native/dist/dist/constructors/keyframes.d.ts +0 -4
  57. package/native/dist/dist/constructors/keyframes.d.ts.map +0 -1
  58. package/native/dist/dist/constructors/styled.d.ts +0 -186
  59. package/native/dist/dist/constructors/styled.d.ts.map +0 -1
  60. package/native/dist/dist/hoc/withTheme.d.ts +0 -4
  61. package/native/dist/dist/hoc/withTheme.d.ts.map +0 -1
  62. package/native/dist/dist/hoc/withTheme.spec.d.ts +0 -2
  63. package/native/dist/dist/hoc/withTheme.spec.d.ts.map +0 -1
  64. package/native/dist/dist/hooks/useTheme.d.ts +0 -4
  65. package/native/dist/dist/hooks/useTheme.d.ts.map +0 -1
  66. package/native/dist/dist/index-standalone.d.ts +0 -3
  67. package/native/dist/dist/index-standalone.d.ts.map +0 -1
  68. package/native/dist/dist/index.d.ts +0 -4
  69. package/native/dist/dist/index.d.ts.map +0 -1
  70. package/native/dist/dist/macro/index.d.ts +0 -3
  71. package/native/dist/dist/macro/index.d.ts.map +0 -1
  72. package/native/dist/dist/macro/test/babel.config.d.ts +0 -1
  73. package/native/dist/dist/macro/test/babel.config.d.ts.map +0 -1
  74. package/native/dist/dist/models/ComponentStyle.d.ts +0 -16
  75. package/native/dist/dist/models/ComponentStyle.d.ts.map +0 -1
  76. package/native/dist/dist/models/GlobalStyle.d.ts +0 -12
  77. package/native/dist/dist/models/GlobalStyle.d.ts.map +0 -1
  78. package/native/dist/dist/models/InlineStyle.d.ts +0 -7
  79. package/native/dist/dist/models/InlineStyle.d.ts.map +0 -1
  80. package/native/dist/dist/models/Keyframes.d.ts +0 -12
  81. package/native/dist/dist/models/Keyframes.d.ts.map +0 -1
  82. package/native/dist/dist/models/ServerStyleSheet.d.ts +0 -16
  83. package/native/dist/dist/models/ServerStyleSheet.d.ts.map +0 -1
  84. package/native/dist/dist/models/StyleSheetManager.d.ts +0 -22
  85. package/native/dist/dist/models/StyleSheetManager.d.ts.map +0 -1
  86. package/native/dist/dist/models/StyledComponent.d.ts +0 -4
  87. package/native/dist/dist/models/StyledComponent.d.ts.map +0 -1
  88. package/native/dist/dist/models/StyledNativeComponent.d.ts +0 -4
  89. package/native/dist/dist/models/StyledNativeComponent.d.ts.map +0 -1
  90. package/native/dist/dist/models/ThemeProvider.d.ts +0 -18
  91. package/native/dist/dist/models/ThemeProvider.d.ts.map +0 -1
  92. package/native/dist/dist/native/index.d.ts +0 -65
  93. package/native/dist/dist/native/index.d.ts.map +0 -1
  94. package/native/dist/dist/primitives/index.d.ts +0 -23
  95. package/native/dist/dist/primitives/index.d.ts.map +0 -1
  96. package/native/dist/dist/secretInternals.d.ts +0 -6
  97. package/native/dist/dist/secretInternals.d.ts.map +0 -1
  98. package/native/dist/dist/sheet/GroupIDAllocator.d.ts +0 -5
  99. package/native/dist/dist/sheet/GroupIDAllocator.d.ts.map +0 -1
  100. package/native/dist/dist/sheet/GroupedTag.d.ts +0 -12
  101. package/native/dist/dist/sheet/GroupedTag.d.ts.map +0 -1
  102. package/native/dist/dist/sheet/Rehydration.d.ts +0 -4
  103. package/native/dist/dist/sheet/Rehydration.d.ts.map +0 -1
  104. package/native/dist/dist/sheet/Sheet.d.ts +0 -41
  105. package/native/dist/dist/sheet/Sheet.d.ts.map +0 -1
  106. package/native/dist/dist/sheet/Tag.d.ts +0 -55
  107. package/native/dist/dist/sheet/Tag.d.ts.map +0 -1
  108. package/native/dist/dist/sheet/dom.d.ts +0 -5
  109. package/native/dist/dist/sheet/dom.d.ts.map +0 -1
  110. package/native/dist/dist/sheet/index.d.ts +0 -2
  111. package/native/dist/dist/sheet/index.d.ts.map +0 -1
  112. package/native/dist/dist/sheet/types.d.ts +0 -35
  113. package/native/dist/dist/sheet/types.d.ts.map +0 -1
  114. package/native/dist/dist/test/globals.d.ts +0 -3
  115. package/native/dist/dist/test/globals.d.ts.map +0 -1
  116. package/native/dist/dist/test/utils.d.ts +0 -192
  117. package/native/dist/dist/test/utils.d.ts.map +0 -1
  118. package/native/dist/dist/types.d.ts +0 -121
  119. package/native/dist/dist/types.d.ts.map +0 -1
  120. package/native/dist/dist/utils/addUnitIfNeeded.d.ts +0 -2
  121. package/native/dist/dist/utils/addUnitIfNeeded.d.ts.map +0 -1
  122. package/native/dist/dist/utils/checkDynamicCreation.d.ts +0 -2
  123. package/native/dist/dist/utils/checkDynamicCreation.d.ts.map +0 -1
  124. package/native/dist/dist/utils/createWarnTooManyClasses.d.ts +0 -4
  125. package/native/dist/dist/utils/createWarnTooManyClasses.d.ts.map +0 -1
  126. package/native/dist/dist/utils/determineTheme.d.ts +0 -3
  127. package/native/dist/dist/utils/determineTheme.d.ts.map +0 -1
  128. package/native/dist/dist/utils/domElements.d.ts +0 -3
  129. package/native/dist/dist/utils/domElements.d.ts.map +0 -1
  130. package/native/dist/dist/utils/empties.d.ts +0 -4
  131. package/native/dist/dist/utils/empties.d.ts.map +0 -1
  132. package/native/dist/dist/utils/error.d.ts +0 -6
  133. package/native/dist/dist/utils/error.d.ts.map +0 -1
  134. package/native/dist/dist/utils/errors.d.ts +0 -21
  135. package/native/dist/dist/utils/errors.d.ts.map +0 -1
  136. package/native/dist/dist/utils/escape.d.ts +0 -6
  137. package/native/dist/dist/utils/escape.d.ts.map +0 -1
  138. package/native/dist/dist/utils/flatten.d.ts +0 -5
  139. package/native/dist/dist/utils/flatten.d.ts.map +0 -1
  140. package/native/dist/dist/utils/generateAlphabeticName.d.ts +0 -2
  141. package/native/dist/dist/utils/generateAlphabeticName.d.ts.map +0 -1
  142. package/native/dist/dist/utils/generateComponentId.d.ts +0 -2
  143. package/native/dist/dist/utils/generateComponentId.d.ts.map +0 -1
  144. package/native/dist/dist/utils/generateDisplayName.d.ts +0 -3
  145. package/native/dist/dist/utils/generateDisplayName.d.ts.map +0 -1
  146. package/native/dist/dist/utils/getComponentName.d.ts +0 -3
  147. package/native/dist/dist/utils/getComponentName.d.ts.map +0 -1
  148. package/native/dist/dist/utils/hash.d.ts +0 -4
  149. package/native/dist/dist/utils/hash.d.ts.map +0 -1
  150. package/native/dist/dist/utils/hoist.d.ts +0 -52
  151. package/native/dist/dist/utils/hoist.d.ts.map +0 -1
  152. package/native/dist/dist/utils/hyphenateStyleName.d.ts +0 -15
  153. package/native/dist/dist/utils/hyphenateStyleName.d.ts.map +0 -1
  154. package/native/dist/dist/utils/interleave.d.ts +0 -3
  155. package/native/dist/dist/utils/interleave.d.ts.map +0 -1
  156. package/native/dist/dist/utils/isFunction.d.ts +0 -2
  157. package/native/dist/dist/utils/isFunction.d.ts.map +0 -1
  158. package/native/dist/dist/utils/isPlainObject.d.ts +0 -2
  159. package/native/dist/dist/utils/isPlainObject.d.ts.map +0 -1
  160. package/native/dist/dist/utils/isStatelessFunction.d.ts +0 -2
  161. package/native/dist/dist/utils/isStatelessFunction.d.ts.map +0 -1
  162. package/native/dist/dist/utils/isStaticRules.d.ts +0 -3
  163. package/native/dist/dist/utils/isStaticRules.d.ts.map +0 -1
  164. package/native/dist/dist/utils/isStyledComponent.d.ts +0 -3
  165. package/native/dist/dist/utils/isStyledComponent.d.ts.map +0 -1
  166. package/native/dist/dist/utils/isTag.d.ts +0 -3
  167. package/native/dist/dist/utils/isTag.d.ts.map +0 -1
  168. package/native/dist/dist/utils/joinStrings.d.ts +0 -5
  169. package/native/dist/dist/utils/joinStrings.d.ts.map +0 -1
  170. package/native/dist/dist/utils/mixinDeep.d.ts +0 -8
  171. package/native/dist/dist/utils/mixinDeep.d.ts.map +0 -1
  172. package/native/dist/dist/utils/nonce.d.ts +0 -2
  173. package/native/dist/dist/utils/nonce.d.ts.map +0 -1
  174. package/native/dist/dist/utils/stylis.d.ts +0 -10
  175. package/native/dist/dist/utils/stylis.d.ts.map +0 -1
  176. package/native/dist/hoc/withTheme.d.ts.map +0 -1
  177. package/native/dist/hoc/withTheme.spec.d.ts.map +0 -1
  178. package/native/dist/hooks/useTheme.d.ts +0 -3
  179. package/native/dist/hooks/useTheme.d.ts.map +0 -1
  180. package/native/dist/index-standalone.d.ts.map +0 -1
  181. package/native/dist/index.d.ts.map +0 -1
  182. package/native/dist/macro/index.d.ts.map +0 -1
  183. package/native/dist/macro/test/babel.config.d.ts +0 -1
  184. package/native/dist/macro/test/babel.config.d.ts.map +0 -1
  185. package/native/dist/models/ComponentStyle.d.ts.map +0 -1
  186. package/native/dist/models/GlobalStyle.d.ts.map +0 -1
  187. package/native/dist/models/InlineStyle.d.ts.map +0 -1
  188. package/native/dist/models/Keyframes.d.ts.map +0 -1
  189. package/native/dist/models/ServerStyleSheet.d.ts.map +0 -1
  190. package/native/dist/models/StyleSheetManager.d.ts.map +0 -1
  191. package/native/dist/models/StyledComponent.d.ts.map +0 -1
  192. package/native/dist/models/StyledNativeComponent.d.ts.map +0 -1
  193. package/native/dist/models/ThemeProvider.d.ts.map +0 -1
  194. package/native/dist/native/index.d.ts.map +0 -1
  195. package/native/dist/primitives/index.d.ts +0 -23
  196. package/native/dist/primitives/index.d.ts.map +0 -1
  197. package/native/dist/secretInternals.d.ts.map +0 -1
  198. package/native/dist/sheet/GroupIDAllocator.d.ts.map +0 -1
  199. package/native/dist/sheet/GroupedTag.d.ts.map +0 -1
  200. package/native/dist/sheet/Rehydration.d.ts.map +0 -1
  201. package/native/dist/sheet/Sheet.d.ts.map +0 -1
  202. package/native/dist/sheet/Tag.d.ts.map +0 -1
  203. package/native/dist/sheet/dom.d.ts.map +0 -1
  204. package/native/dist/sheet/index.d.ts.map +0 -1
  205. package/native/dist/sheet/types.d.ts.map +0 -1
  206. package/native/dist/test/globals.d.ts.map +0 -1
  207. package/native/dist/test/utils.d.ts.map +0 -1
  208. package/native/dist/types.d.ts.map +0 -1
  209. package/native/dist/utils/addUnitIfNeeded.d.ts.map +0 -1
  210. package/native/dist/utils/checkDynamicCreation.d.ts.map +0 -1
  211. package/native/dist/utils/createWarnTooManyClasses.d.ts.map +0 -1
  212. package/native/dist/utils/determineTheme.d.ts.map +0 -1
  213. package/native/dist/utils/domElements.d.ts.map +0 -1
  214. package/native/dist/utils/empties.d.ts.map +0 -1
  215. package/native/dist/utils/error.d.ts.map +0 -1
  216. package/native/dist/utils/errors.d.ts.map +0 -1
  217. package/native/dist/utils/escape.d.ts.map +0 -1
  218. package/native/dist/utils/flatten.d.ts.map +0 -1
  219. package/native/dist/utils/generateAlphabeticName.d.ts.map +0 -1
  220. package/native/dist/utils/generateComponentId.d.ts.map +0 -1
  221. package/native/dist/utils/generateDisplayName.d.ts.map +0 -1
  222. package/native/dist/utils/getComponentName.d.ts.map +0 -1
  223. package/native/dist/utils/hash.d.ts.map +0 -1
  224. package/native/dist/utils/hoist.d.ts.map +0 -1
  225. package/native/dist/utils/hyphenateStyleName.d.ts.map +0 -1
  226. package/native/dist/utils/interleave.d.ts.map +0 -1
  227. package/native/dist/utils/isFunction.d.ts.map +0 -1
  228. package/native/dist/utils/isPlainObject.d.ts.map +0 -1
  229. package/native/dist/utils/isStatelessFunction.d.ts.map +0 -1
  230. package/native/dist/utils/isStaticRules.d.ts.map +0 -1
  231. package/native/dist/utils/isStyledComponent.d.ts.map +0 -1
  232. package/native/dist/utils/isTag.d.ts.map +0 -1
  233. package/native/dist/utils/joinStrings.d.ts.map +0 -1
  234. package/native/dist/utils/mixinDeep.d.ts.map +0 -1
  235. package/native/dist/utils/nonce.d.ts.map +0 -1
  236. package/native/dist/utils/stylis.d.ts.map +0 -1
@@ -3,11 +3,10 @@ import createGlobalStyle from './constructors/createGlobalStyle';
3
3
  import css from './constructors/css';
4
4
  import keyframes from './constructors/keyframes';
5
5
  import withTheme from './hoc/withTheme';
6
- import useTheme from './hooks/useTheme';
7
6
  import ServerStyleSheet from './models/ServerStyleSheet';
8
7
  import { IStyleSheetContext, IStyleSheetManager, IStylisContext, StyleSheetConsumer, StyleSheetContext, StyleSheetManager } from './models/StyleSheetManager';
9
- import ThemeProvider, { ThemeConsumer, ThemeContext } from './models/ThemeProvider';
8
+ import ThemeProvider, { ThemeConsumer, ThemeContext, useTheme } from './models/ThemeProvider';
10
9
  import isStyledComponent from './utils/isStyledComponent';
11
10
  export * from './secretInternals';
12
- export { AttrsArg as Attrs, DefaultTheme, ShouldForwardProp } from './types';
11
+ export { Attrs, DefaultTheme, ShouldForwardProp } from './types';
13
12
  export { createGlobalStyle, css, isStyledComponent, IStyleSheetManager, IStyleSheetContext, IStylisContext, keyframes, ServerStyleSheet, StyleSheetConsumer, StyleSheetContext, StyleSheetManager, ThemeConsumer, ThemeContext, ThemeProvider, useTheme, SC_VERSION as version, withTheme, };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Attrs, AttrsArg, ExecutionProps, Interpolation, IStyledComponent, IStyledComponentFactory, KnownTarget, Runtime, StyledOptions, StyledTarget, Styles } from '../types';
2
+ import { Attrs, DataAttributes, ExecutionContext, ExecutionProps, Interpolation, IStyledComponent, IStyledComponentFactory, KnownTarget, NoInfer, Runtime, StyledOptions, StyledTarget, Styles, SubsetOnly } 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
  */
@@ -15,10 +15,25 @@ type ExtractAttrsTarget<R extends Runtime, P extends ExecutionProps, DefaultTarg
15
15
  * with the passed attr type to capture any intended overrides.
16
16
  */
17
17
  type PropsSatisfiedByAttrs<T extends Attrs, Props extends object, Result extends ExecutionProps = AttrsResult<T>> = Omit<Props, keyof Result> & OptionalIntersection<Props, Result> & Partial<Omit<Result, keyof Props | 'as'>>;
18
+ /**
19
+ * Rejects an attr factory function argument (T) if it returns any properties not defined in Props.
20
+ */
21
+ type StrictAttrFactory<T, Props> = T extends ((props: ExecutionContext & Props) => infer TResult) ? TResult extends SubsetOnly<TResult, (Partial<Props> & ExecutionProps & DataAttributes & React.AriaAttributes)> ? (props: ExecutionContext & Props) => TResult : never : never;
18
22
  export interface Styled<R extends Runtime, Target extends StyledTarget<R>, OuterProps extends object = object, OuterStatics extends object = object, RuntimeInjectedProps extends ExecutionProps = object> {
19
- <Props extends object = object, Statics extends object = object>(initialStyles: Styles<OuterProps & RuntimeInjectedProps & Props>, ...interpolations: Interpolation<OuterProps & RuntimeInjectedProps & Props>[]): // @ts-expect-error KnownTarget is a subset of StyledTarget<R>
23
+ <Props extends object = object, Statics extends object = object>(initialStyles: Styles<OuterProps & RuntimeInjectedProps & NoInfer<Props>>, ...interpolations: Interpolation<OuterProps & RuntimeInjectedProps & NoInfer<Props>>[]): // @ts-expect-error KnownTarget is a subset of StyledTarget<R>
20
24
  IStyledComponent<R, ExtractAttrsTarget<R, RuntimeInjectedProps, Target>, OuterProps & Props> & OuterStatics & Statics;
21
- attrs: <T extends Attrs, TResult extends ExecutionProps = AttrsResult<T>, TTarget extends StyledTarget<R> = ExtractAttrsTarget<R, TResult, Target>>(attrs: AttrsArg<T extends (...args: any) => infer P ? OuterProps & P : OuterProps & T>) => Styled<R, TTarget, PropsSatisfiedByAttrs<T, OuterProps>, OuterStatics, Omit<RuntimeInjectedProps, keyof TResult> & TResult>;
25
+ /**
26
+ * This is a chainable method that attaches some props to a styled component.
27
+ * @param props An object containing prop values that will be merged into the rest of the component's props
28
+ * @argument Props Additional props being injected in `props`
29
+ */
30
+ attrs<Props extends object = object, PropValues extends Partial<OuterProps> & ExecutionProps & DataAttributes & React.AriaAttributes & NoInfer<Props> = Partial<OuterProps> & ExecutionProps & DataAttributes & React.AriaAttributes & NoInfer<Props>>(props: PropValues & SubsetOnly<PropValues, Partial<OuterProps> & ExecutionProps & DataAttributes & React.AriaAttributes & NoInfer<Props>>): Styled<R, Target, PropsSatisfiedByAttrs<PropValues, OuterProps>, OuterStatics, Omit<RuntimeInjectedProps, keyof PropValues> & PropValues>;
31
+ /**
32
+ * This is a chainable method that attaches some props to a styled component.
33
+ * @param propFactory A function that receives the props that are passed into the component and computes a value, that is then going to be merged into the existing component props.
34
+ * @argument Props Additional props being returned by `propFactory`
35
+ */
36
+ attrs<Props extends object = object, Factory extends ((...args: any[]) => any) = (...args: any[]) => any, TTarget extends StyledTarget<R> = ExtractAttrsTarget<R, AttrsResult<Factory>, Target>>(propFactory: Factory & StrictAttrFactory<Factory, OuterProps & NoInfer<Props>>): Styled<R, TTarget, PropsSatisfiedByAttrs<Factory, OuterProps>, OuterStatics, Omit<RuntimeInjectedProps, keyof AttrsResult<Factory>> & AttrsResult<Factory>>;
22
37
  withConfig: (config: StyledOptions<R, OuterProps>) => Styled<R, Target, OuterProps, OuterStatics>;
23
38
  }
24
39
  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>;
@@ -1,4 +1,4 @@
1
1
  import styled from './constructors/styled';
2
2
  export * from './base';
3
- export { CSSProp, DefaultTheme, ExecutionContext, ExecutionProps, IStyledComponent, IStyledComponentFactory, IStyledStatics, PolymorphicComponent, PolymorphicComponentProps, Runtime, StyledObject, StyledOptions, WebTarget, } from './types';
3
+ export { CSSProp, DefaultTheme, ExecutionContext, ExecutionProps, IStyledComponent, IStyledComponentFactory, IStyledStatics, PolymorphicComponent, PolymorphicComponentProps, RuleSet, Runtime, StyledObject, StyledOptions, WebTarget, } from './types';
4
4
  export { styled, styled as default };
@@ -8,7 +8,6 @@ export default class ComponentStyle {
8
8
  baseStyle: ComponentStyle | null | undefined;
9
9
  componentId: string;
10
10
  isStatic: boolean;
11
- names: string[];
12
11
  rules: RuleSet<any>;
13
12
  staticRulesId: string;
14
13
  constructor(rules: RuleSet<any>, componentId: string, baseStyle?: ComponentStyle);
@@ -1,20 +1,19 @@
1
1
  import React from 'react';
2
2
  import StyleSheet from '../sheet';
3
3
  import { ShouldForwardProp, Stringifier } from '../types';
4
+ export declare const mainSheet: StyleSheet;
5
+ export declare const mainStylis: Stringifier;
4
6
  export type IStyleSheetContext = {
5
7
  shouldForwardProp?: ShouldForwardProp<'web'>;
6
- styleSheet?: StyleSheet;
8
+ styleSheet: StyleSheet;
9
+ stylis: Stringifier;
7
10
  };
8
11
  export declare const StyleSheetContext: React.Context<IStyleSheetContext>;
9
12
  export declare const StyleSheetConsumer: React.Consumer<IStyleSheetContext>;
10
13
  export type IStylisContext = Stringifier | void;
11
14
  export declare const StylisContext: React.Context<IStylisContext>;
12
15
  export declare const StylisConsumer: React.Consumer<IStylisContext>;
13
- export declare const mainSheet: StyleSheet;
14
- export declare const mainStylis: Stringifier;
15
- export declare function useShouldForwardProp(): ShouldForwardProp<"web"> | undefined;
16
- export declare function useStyleSheet(): StyleSheet;
17
- export declare function useStylis(): Stringifier;
16
+ export declare function useStyleSheetContext(): IStyleSheetContext;
18
17
  export type IStyleSheetManager = React.PropsWithChildren<{
19
18
  /**
20
19
  * If desired, you can pass this prop to disable "speedy" insertion mode, which
@@ -26,7 +25,7 @@ export type IStyleSheetManager = React.PropsWithChildren<{
26
25
  * If you are working exclusively with modern browsers, vendor prefixes can often be omitted
27
26
  * to reduce the weight of CSS on the page.
28
27
  */
29
- disableVendorPrefixes?: boolean;
28
+ enableVendorPrefixes?: boolean;
30
29
  /**
31
30
  * Provide an optional selector to be prepended to all generated style rules.
32
31
  */
@@ -32,6 +32,7 @@ type Props = {
32
32
  };
33
33
  export declare const ThemeContext: React.Context<DefaultTheme | undefined>;
34
34
  export declare const ThemeConsumer: React.Consumer<DefaultTheme | undefined>;
35
+ export declare function useTheme(): DefaultTheme | undefined;
35
36
  /**
36
37
  * Provide a theme to an entire react component tree via context
37
38
  */
@@ -2,35 +2,34 @@ import React from 'react';
2
2
  import { Styled } from '../constructors/constructWithOptions';
3
3
  import css from '../constructors/css';
4
4
  import withTheme from '../hoc/withTheme';
5
- import useTheme from '../hooks/useTheme';
6
- import ThemeProvider, { ThemeConsumer, ThemeContext } from '../models/ThemeProvider';
5
+ import ThemeProvider, { ThemeConsumer, ThemeContext, useTheme } from '../models/ThemeProvider';
7
6
  import { NativeTarget } from '../types';
8
7
  import isStyledComponent from '../utils/isStyledComponent';
9
8
  declare const styled: (<Target extends NativeTarget>(tag: Target) => Styled<"native", Target, Target extends import("../types").KnownTarget ? React.ComponentPropsWithRef<Target> : object, object, object>) & {
10
- ActivityIndicator: Styled<"native", typeof import("react-native").ActivityIndicator, object, object, object>;
11
- Button: Styled<"native", typeof import("react-native").Button, object, object, object>;
12
- DatePickerIOS: Styled<"native", typeof import("react-native").DatePickerIOS, object, object, object>;
13
- DrawerLayoutAndroid: Styled<"native", typeof import("react-native").DrawerLayoutAndroid, object, object, object>;
14
- FlatList: Styled<"native", typeof import("react-native").FlatList, object, object, object>;
15
- Image: Styled<"native", typeof import("react-native").Image, object, object, object>;
16
- ImageBackground: Styled<"native", typeof import("react-native").ImageBackground, object, object, object>;
17
- KeyboardAvoidingView: Styled<"native", typeof import("react-native").KeyboardAvoidingView, object, object, object>;
18
- Modal: Styled<"native", typeof import("react-native").Modal, object, object, object>;
19
- Pressable: Styled<"native", import("react").ForwardRefExoticComponent<import("react-native").PressableProps & import("react").RefAttributes<import("react-native").View>>, object, object, object>;
20
- ProgressBarAndroid: Styled<"native", typeof import("react-native").ProgressBarAndroid, object, object, object>;
21
- ProgressViewIOS: Styled<"native", typeof import("react-native").ProgressViewIOS, object, object, object>;
22
- RefreshControl: Styled<"native", typeof import("react-native").RefreshControl, object, object, object>;
23
- SafeAreaView: Styled<"native", typeof import("react-native").SafeAreaView, object, object, object>;
24
- ScrollView: Styled<"native", typeof import("react-native").ScrollView, object, object, object>;
25
- SectionList: Styled<"native", typeof import("react-native").SectionList, object, object, object>;
26
- Slider: Styled<"native", typeof import("react-native").Slider, object, object, object>;
27
- Switch: Styled<"native", typeof import("react-native").Switch, object, object, object>;
28
- Text: Styled<"native", typeof import("react-native").Text, object, object, object>;
29
- TextInput: Styled<"native", typeof import("react-native").TextInput, object, object, object>;
30
- TouchableHighlight: Styled<"native", typeof import("react-native").TouchableHighlight, object, object, object>;
31
- TouchableOpacity: Styled<"native", typeof import("react-native").TouchableOpacity, object, object, object>;
32
- View: Styled<"native", typeof import("react-native").View, object, object, object>;
33
- VirtualizedList: Styled<"native", typeof import("react-native").VirtualizedList, object, object, object>;
9
+ ActivityIndicator: Styled<"native", typeof import("react-native").ActivityIndicator, import("react-native").ActivityIndicatorProps, object, object>;
10
+ Button: Styled<"native", typeof import("react-native").Button, import("react-native").ButtonProps, object, object>;
11
+ DatePickerIOS: Styled<"native", typeof import("react-native").DatePickerIOS, import("react-native").DatePickerIOSProps, object, object>;
12
+ DrawerLayoutAndroid: Styled<"native", typeof import("react-native").DrawerLayoutAndroid, import("react-native").DrawerLayoutAndroidProps, object, object>;
13
+ FlatList: Styled<"native", typeof import("react-native").FlatList, import("react-native").FlatListProps<unknown>, object, object>;
14
+ Image: Styled<"native", typeof import("react-native").Image, import("react-native").ImageProps, object, object>;
15
+ ImageBackground: Styled<"native", typeof import("react-native").ImageBackground, import("react-native").ImageBackgroundProps, object, object>;
16
+ KeyboardAvoidingView: Styled<"native", typeof import("react-native").KeyboardAvoidingView, import("react-native").KeyboardAvoidingViewProps, object, object>;
17
+ Modal: Styled<"native", typeof import("react-native").Modal, import("react-native").ModalBaseProps & import("react-native").ModalPropsIOS & import("react-native").ModalPropsAndroid & import("react-native").ViewProps, object, object>;
18
+ 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, object>;
19
+ ProgressBarAndroid: Styled<"native", typeof import("react-native").ProgressBarAndroid, import("react-native").ProgressBarAndroidProps, object, object>;
20
+ ProgressViewIOS: Styled<"native", typeof import("react-native").ProgressViewIOS, import("react-native").ProgressViewIOSProps, object, object>;
21
+ RefreshControl: Styled<"native", typeof import("react-native").RefreshControl, import("react-native").RefreshControlProps, object, object>;
22
+ SafeAreaView: Styled<"native", typeof import("react-native").SafeAreaView, import("react-native").ViewProps, object, object>;
23
+ ScrollView: Styled<"native", typeof import("react-native").ScrollView, import("react-native").ScrollViewProps, object, object>;
24
+ SectionList: Styled<"native", typeof import("react-native").SectionList, import("react-native").SectionListProps<unknown, unknown>, object, object>;
25
+ Slider: Styled<"native", typeof import("react-native").Slider, import("react-native").SliderProps, object, object>;
26
+ Switch: Styled<"native", typeof import("react-native").Switch, import("react-native").SwitchProps, object, object>;
27
+ Text: Styled<"native", typeof import("react-native").Text, import("react-native").TextProps, object, object>;
28
+ TextInput: Styled<"native", typeof import("react-native").TextInput, import("react-native").TextInputProps, object, object>;
29
+ TouchableHighlight: Styled<"native", typeof import("react-native").TouchableHighlight, import("react-native").TouchableHighlightProps, object, object>;
30
+ TouchableOpacity: Styled<"native", typeof import("react-native").TouchableOpacity, import("react-native").TouchableOpacityProps, object, object>;
31
+ View: Styled<"native", typeof import("react-native").View, import("react-native").ViewProps, object, object>;
32
+ VirtualizedList: Styled<"native", typeof import("react-native").VirtualizedList, import("react-native").VirtualizedListProps<unknown>, object, object>;
34
33
  };
35
34
  export { DefaultTheme, ExecutionContext, ExecutionProps, IStyledComponent, IStyledComponentFactory, IStyledStatics, NativeTarget, PolymorphicComponent, PolymorphicComponentProps, Runtime, StyledObject, StyledOptions, } from '../types';
36
35
  export { css, isStyledComponent, ThemeProvider, ThemeConsumer, ThemeContext, withTheme, useTheme };
@@ -5,7 +5,7 @@ export declare const makeGroupedTag: (tag: Tag) => {
5
5
  length: number;
6
6
  tag: Tag;
7
7
  indexOfGroup(group: number): number;
8
- insertRules(group: number, rules: string | string[]): void;
8
+ insertRules(group: number, rules: string[]): void;
9
9
  clearGroup(group: number): void;
10
10
  getGroup(group: number): string;
11
11
  };
@@ -154,7 +154,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
154
154
  var SC_ATTR = typeof process !== 'undefined' && typeof process.env !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || 'data-styled';
155
155
  var SC_ATTR_ACTIVE = 'active';
156
156
  var SC_ATTR_VERSION = 'data-styled-version';
157
- var SC_VERSION = "5.3.9";
157
+ var SC_VERSION = "5.3.11";
158
158
  var SPLITTER = '/*!sc*/\n';
159
159
  var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
160
160
  var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean' ? SC_DISABLE_SPEEDY : typeof process !== 'undefined' && typeof process.env !== 'undefined' ? typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' && process.env.REACT_APP_SC_DISABLE_SPEEDY !== '' ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false' ? false : process.env.REACT_APP_SC_DISABLE_SPEEDY : typeof process.env.SC_DISABLE_SPEEDY !== 'undefined' && process.env.SC_DISABLE_SPEEDY !== '' ? process.env.SC_DISABLE_SPEEDY === 'false' ? false : process.env.SC_DISABLE_SPEEDY : process.env.NODE_ENV !== 'production' : false); // Shared empty execution context when generating static styles
@@ -997,8 +997,8 @@ function addUnitIfNeeded(name, value) {
997
997
  return '';
998
998
  }
999
999
 
1000
- if (typeof value === 'number' && value !== 0 && !(name in unitless)) {
1001
- return value + "px"; // Presumes implicit 'px' suffix for unitless numbers
1000
+ if (typeof value === 'number' && value !== 0 && !(name in unitless) && !name.startsWith('--')) {
1001
+ return value + "px"; // Presumes implicit 'px' suffix for unitless numbers except for CSS variables
1002
1002
  }
1003
1003
 
1004
1004
  return String(value).trim();