styled-components 6.4.0-prerelease.5 → 6.4.0-prerelease.8
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.
- package/README.md +4 -0
- package/dist/constructors/createGlobalStyle.d.ts +10 -0
- package/dist/constructors/css.d.ts +12 -0
- package/dist/constructors/keyframes.d.ts +11 -0
- package/dist/constructors/styled.d.ts +8 -0
- package/dist/hoc/withTheme.d.ts +1 -0
- package/dist/models/ComponentStyle.d.ts +1 -2
- package/dist/models/InlineStyle.d.ts +11 -0
- package/dist/models/ServerStyleSheet.d.ts +10 -0
- package/dist/models/StyleSheetManager.d.ts +1 -0
- package/dist/native/index.d.ts +18 -2
- package/dist/styled-components.browser.cjs.js +3 -3
- package/dist/styled-components.browser.cjs.js.map +1 -1
- package/dist/styled-components.browser.esm.js +2 -2
- package/dist/styled-components.browser.esm.js.map +1 -1
- package/dist/styled-components.cjs.js +3 -3
- package/dist/styled-components.cjs.js.map +1 -1
- package/dist/styled-components.esm.js +3 -3
- package/dist/styled-components.esm.js.map +1 -1
- package/dist/styled-components.js +183 -90
- package/dist/styled-components.js.map +1 -1
- package/dist/styled-components.min.js +3 -3
- package/dist/styled-components.min.js.map +1 -1
- package/dist/utils/escape.d.ts +0 -4
- package/dist/utils/hash.d.ts +1 -0
- package/dist/utils/isStyledComponent.d.ts +1 -0
- package/native/dist/constructors/createGlobalStyle.d.ts +10 -0
- package/native/dist/constructors/css.d.ts +12 -0
- package/native/dist/constructors/keyframes.d.ts +11 -0
- package/native/dist/constructors/styled.d.ts +8 -0
- package/native/dist/dist/constructors/createGlobalStyle.d.ts +10 -0
- package/native/dist/dist/constructors/css.d.ts +12 -0
- package/native/dist/dist/constructors/keyframes.d.ts +11 -0
- package/native/dist/dist/constructors/styled.d.ts +8 -0
- package/native/dist/dist/hoc/withTheme.d.ts +1 -0
- package/native/dist/dist/models/ComponentStyle.d.ts +1 -2
- package/native/dist/dist/models/InlineStyle.d.ts +11 -0
- package/native/dist/dist/models/ServerStyleSheet.d.ts +10 -0
- package/native/dist/dist/models/StyleSheetManager.d.ts +1 -0
- package/native/dist/dist/native/index.d.ts +18 -2
- package/native/dist/dist/utils/escape.d.ts +0 -4
- package/native/dist/dist/utils/hash.d.ts +1 -0
- package/native/dist/dist/utils/isStyledComponent.d.ts +1 -0
- package/native/dist/hoc/withTheme.d.ts +1 -0
- package/native/dist/models/ComponentStyle.d.ts +1 -2
- package/native/dist/models/InlineStyle.d.ts +11 -0
- package/native/dist/models/ServerStyleSheet.d.ts +10 -0
- package/native/dist/models/StyleSheetManager.d.ts +1 -0
- package/native/dist/native/index.d.ts +18 -2
- package/native/dist/styled-components.native.cjs.js +1 -1
- package/native/dist/styled-components.native.cjs.js.map +1 -1
- package/native/dist/styled-components.native.esm.js +1 -1
- package/native/dist/styled-components.native.esm.js.map +1 -1
- package/native/dist/utils/escape.d.ts +0 -4
- package/native/dist/utils/hash.d.ts +1 -0
- package/native/dist/utils/isStyledComponent.d.ts +1 -0
- package/native/package.json +7 -2
- package/package.json +5 -5
package/dist/utils/escape.d.ts
CHANGED
package/dist/utils/hash.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ExecutionProps, Interpolation, Styles } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Create a component that injects global CSS when mounted. Supports theming and dynamic props.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const GlobalStyle = createGlobalStyle`
|
|
8
|
+
* body { margin: 0; font-family: system-ui; }
|
|
9
|
+
* `;
|
|
10
|
+
* // Render <GlobalStyle /> at the root of your app
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
3
13
|
export default function createGlobalStyle<Props extends object>(strings: Styles<Props>, ...interpolations: Array<Interpolation<Props>>): React.NamedExoticComponent<ExecutionProps & Props>;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { Interpolation, RuleSet, Styles } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Tag a CSS template literal for use in styled components, createGlobalStyle, or attrs.
|
|
4
|
+
* Enables interpolation type-checking and shared style blocks.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const truncate = css`
|
|
8
|
+
* white-space: nowrap;
|
|
9
|
+
* overflow: hidden;
|
|
10
|
+
* text-overflow: ellipsis;
|
|
11
|
+
* `;
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
2
14
|
declare function css(styles: Styles<object>, ...interpolations: Interpolation<object>[]): RuleSet<object>;
|
|
3
15
|
declare function css<Props extends object>(styles: Styles<NoInfer<Props>>, ...interpolations: Interpolation<NoInfer<Props>>[]): RuleSet<NoInfer<Props>>;
|
|
4
16
|
export default css;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import Keyframes from '../models/Keyframes';
|
|
2
2
|
import { Interpolation, Styles } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Define a CSS `@keyframes` animation with an automatically scoped name.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const rotate = keyframes`
|
|
8
|
+
* from { transform: rotate(0deg); }
|
|
9
|
+
* to { transform: rotate(360deg); }
|
|
10
|
+
* `;
|
|
11
|
+
* const Spinner = styled.div`animation: ${rotate} 1s linear infinite;`;
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
3
14
|
export default function keyframes<Props extends object = {}>(strings: Styles<Props>, ...interpolations: Array<Interpolation<Props>>): Keyframes;
|
|
@@ -2,6 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import { BaseObject, KnownTarget, WebTarget } from '../types';
|
|
3
3
|
import { SupportedHTMLElements } from '../utils/domElements';
|
|
4
4
|
import { Styled as StyledInstance } from './constructWithOptions';
|
|
5
|
+
/**
|
|
6
|
+
* Create a styled component from an HTML element or React component.
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const Button = styled.button`color: red;`;
|
|
10
|
+
* const Link = styled(RouterLink)`text-decoration: none;`;
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
5
13
|
declare const baseStyled: <Target extends WebTarget, InjectedProps extends object = BaseObject>(tag: Target) => StyledInstance<"web", Target, Target extends KnownTarget ? React.ComponentPropsWithRef<Target> & InjectedProps : InjectedProps, BaseObject, never>;
|
|
6
14
|
declare const styled: typeof baseStyled & { [E in SupportedHTMLElements]: StyledInstance<"web", E, React.JSX.IntrinsicElements[E]>; };
|
|
7
15
|
export default styled;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ExecutionProps, Interpolation, Styles } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Create a component that injects global CSS when mounted. Supports theming and dynamic props.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const GlobalStyle = createGlobalStyle`
|
|
8
|
+
* body { margin: 0; font-family: system-ui; }
|
|
9
|
+
* `;
|
|
10
|
+
* // Render <GlobalStyle /> at the root of your app
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
3
13
|
export default function createGlobalStyle<Props extends object>(strings: Styles<Props>, ...interpolations: Array<Interpolation<Props>>): React.NamedExoticComponent<ExecutionProps & Props>;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { Interpolation, RuleSet, Styles } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Tag a CSS template literal for use in styled components, createGlobalStyle, or attrs.
|
|
4
|
+
* Enables interpolation type-checking and shared style blocks.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const truncate = css`
|
|
8
|
+
* white-space: nowrap;
|
|
9
|
+
* overflow: hidden;
|
|
10
|
+
* text-overflow: ellipsis;
|
|
11
|
+
* `;
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
2
14
|
declare function css(styles: Styles<object>, ...interpolations: Interpolation<object>[]): RuleSet<object>;
|
|
3
15
|
declare function css<Props extends object>(styles: Styles<NoInfer<Props>>, ...interpolations: Interpolation<NoInfer<Props>>[]): RuleSet<NoInfer<Props>>;
|
|
4
16
|
export default css;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import Keyframes from '../models/Keyframes';
|
|
2
2
|
import { Interpolation, Styles } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Define a CSS `@keyframes` animation with an automatically scoped name.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const rotate = keyframes`
|
|
8
|
+
* from { transform: rotate(0deg); }
|
|
9
|
+
* to { transform: rotate(360deg); }
|
|
10
|
+
* `;
|
|
11
|
+
* const Spinner = styled.div`animation: ${rotate} 1s linear infinite;`;
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
3
14
|
export default function keyframes<Props extends object = {}>(strings: Styles<Props>, ...interpolations: Array<Interpolation<Props>>): Keyframes;
|
|
@@ -2,6 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import { BaseObject, KnownTarget, WebTarget } from '../types';
|
|
3
3
|
import { SupportedHTMLElements } from '../utils/domElements';
|
|
4
4
|
import { Styled as StyledInstance } from './constructWithOptions';
|
|
5
|
+
/**
|
|
6
|
+
* Create a styled component from an HTML element or React component.
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const Button = styled.button`color: red;`;
|
|
10
|
+
* const Link = styled(RouterLink)`text-decoration: none;`;
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
5
13
|
declare const baseStyled: <Target extends WebTarget, InjectedProps extends object = BaseObject>(tag: Target) => StyledInstance<"web", Target, Target extends KnownTarget ? React.ComponentPropsWithRef<Target> & InjectedProps : InjectedProps, BaseObject, never>;
|
|
6
14
|
declare const styled: typeof baseStyled & { [E in SupportedHTMLElements]: StyledInstance<"web", E, React.JSX.IntrinsicElements[E]>; };
|
|
7
15
|
export default styled;
|
|
@@ -2,5 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { AnyComponent, ExecutionProps } from '../types';
|
|
3
3
|
import { NonReactStatics } from '../utils/hoist';
|
|
4
4
|
type WithThemeOuterProps<T extends AnyComponent> = Omit<React.ComponentPropsWithRef<T>, keyof ExecutionProps> & ExecutionProps;
|
|
5
|
+
/** Higher-order component that injects the current theme as a prop. Prefer `useTheme` in function components. */
|
|
5
6
|
export default function withTheme<T extends AnyComponent>(Component: T): React.ForwardRefExoticComponent<React.PropsWithoutRef<WithThemeOuterProps<T>> & React.RefAttributes<any>> & NonReactStatics<T>;
|
|
6
7
|
export {};
|
|
@@ -7,9 +7,8 @@ export default class ComponentStyle {
|
|
|
7
7
|
baseHash: number;
|
|
8
8
|
baseStyle: ComponentStyle | null | undefined;
|
|
9
9
|
componentId: string;
|
|
10
|
-
isStatic: boolean;
|
|
11
10
|
rules: RuleSet<any>;
|
|
12
|
-
|
|
11
|
+
dynamicNameCache: Map<string, string> | undefined;
|
|
13
12
|
constructor(rules: RuleSet<any>, componentId: string, baseStyle?: ComponentStyle | undefined);
|
|
14
13
|
generateAndInjectStyles(executionContext: ExecutionContext, styleSheet: StyleSheet, stylis: Stringifier): string;
|
|
15
14
|
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { IInlineStyleConstructor, StyleSheet } from '../types';
|
|
2
2
|
export declare const RN_UNSUPPORTED_VALUES: string[];
|
|
3
|
+
/**
|
|
4
|
+
* Extract CSS declaration pairs from flat CSS text.
|
|
5
|
+
* Only handles `property: value;` — selectors, at-rules, and nesting
|
|
6
|
+
* are not supported (and not expected in the native inline style path).
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseCSSDeclarations(rawCss: string): [string, string][];
|
|
9
|
+
/** Clear the cached CSS-to-style-object mappings. Useful in tests or long-running RN apps with highly dynamic styles. */
|
|
3
10
|
export declare const resetStyleCache: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Parse flat CSS into a style object via css-to-react-native, with caching.
|
|
13
|
+
*/
|
|
14
|
+
export declare function cssToStyleObject(flatCSS: string, styleSheet: StyleSheet): any;
|
|
4
15
|
/**
|
|
5
16
|
* InlineStyle takes arbitrary CSS and generates a flat object
|
|
6
17
|
*/
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type PipeableStream } from 'react-dom/server';
|
|
3
3
|
import StyleSheet from '../sheet';
|
|
4
|
+
/**
|
|
5
|
+
* Collect styled-components CSS during server-side rendering.
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const sheet = new ServerStyleSheet();
|
|
9
|
+
* const html = renderToString(sheet.collectStyles(<App />));
|
|
10
|
+
* const styleTags = sheet.getStyleTags();
|
|
11
|
+
* sheet.seal();
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
4
14
|
export default class ServerStyleSheet {
|
|
5
15
|
instance: StyleSheet;
|
|
6
16
|
sealed: boolean;
|
|
@@ -68,4 +68,5 @@ export type IStyleSheetManager = React.PropsWithChildren<{
|
|
|
68
68
|
*/
|
|
69
69
|
target?: undefined | InsertionTarget;
|
|
70
70
|
}>;
|
|
71
|
+
/** Configure style injection for descendant styled components (target element, stylis plugins, prop forwarding). */
|
|
71
72
|
export declare function StyleSheetManager(props: IStyleSheetManager): React.JSX.Element;
|
|
@@ -6,14 +6,30 @@ import ThemeProvider, { ThemeConsumer, ThemeContext, useTheme } from '../models/
|
|
|
6
6
|
import { NativeTarget, RuleSet } from '../types';
|
|
7
7
|
import isStyledComponent from '../utils/isStyledComponent';
|
|
8
8
|
declare const reactNative: Awaited<typeof import("react-native")>;
|
|
9
|
+
/**
|
|
10
|
+
* Create a styled component for React Native.
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const Card = styled.View`padding: 16px; background-color: white;`;
|
|
14
|
+
* const Label = styled(Text)`font-size: 14px;`;
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
9
17
|
declare const baseStyled: <Target extends NativeTarget>(tag: Target) => Styled<"native", Target, Target extends import("../types").KnownTarget ? React.ComponentPropsWithRef<Target> : import("../types").BaseObject, import("../types").BaseObject, never>;
|
|
10
|
-
declare const aliases: readonly ["ActivityIndicator", "Button", "
|
|
18
|
+
declare const aliases: readonly ["ActivityIndicator", "Button", "FlatList", "Image", "ImageBackground", "InputAccessoryView", "KeyboardAvoidingView", "Modal", "Pressable", "RefreshControl", "SafeAreaView", "ScrollView", "SectionList", "StatusBar", "Switch", "Text", "TextInput", "TouchableHighlight", "TouchableNativeFeedback", "TouchableOpacity", "TouchableWithoutFeedback", "View", "VirtualizedList"];
|
|
11
19
|
type KnownComponents = (typeof aliases)[number];
|
|
12
20
|
/** Isolates RN-provided components since they don't expose a helper type for this. */
|
|
13
21
|
type RNComponents = {
|
|
14
22
|
[K in keyof typeof reactNative]: (typeof reactNative)[K] extends React.ComponentType<any> ? (typeof reactNative)[K] : never;
|
|
15
23
|
};
|
|
16
24
|
declare const styled: typeof baseStyled & { [E in KnownComponents]: Styled<"native", RNComponents[E], React.ComponentProps<RNComponents[E]>>; };
|
|
17
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Convert a `css` tagged template to a React Native StyleSheet object.
|
|
27
|
+
*
|
|
28
|
+
* ```tsx
|
|
29
|
+
* const styles = toStyleSheet(css`background-color: red; padding: 10px;`);
|
|
30
|
+
* // { backgroundColor: 'red', paddingTop: 10, ... }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare const toStyleSheet: (rules: RuleSet<object>) => any;
|
|
18
34
|
export { CSSKeyframes, CSSObject, CSSProperties, CSSPseudos, DefaultTheme, ExecutionContext, ExecutionProps, IStyledComponent, IStyledComponentFactory, IStyledStatics, NativeTarget, PolymorphicComponent, PolymorphicComponentProps, Runtime, StyledObject, StyledOptions, } from '../types';
|
|
19
35
|
export { css, styled as default, isStyledComponent, styled, ThemeConsumer, ThemeContext, ThemeProvider, toStyleSheet, useTheme, withTheme, };
|
|
@@ -2,5 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { AnyComponent, ExecutionProps } from '../types';
|
|
3
3
|
import { NonReactStatics } from '../utils/hoist';
|
|
4
4
|
type WithThemeOuterProps<T extends AnyComponent> = Omit<React.ComponentPropsWithRef<T>, keyof ExecutionProps> & ExecutionProps;
|
|
5
|
+
/** Higher-order component that injects the current theme as a prop. Prefer `useTheme` in function components. */
|
|
5
6
|
export default function withTheme<T extends AnyComponent>(Component: T): React.ForwardRefExoticComponent<React.PropsWithoutRef<WithThemeOuterProps<T>> & React.RefAttributes<any>> & NonReactStatics<T>;
|
|
6
7
|
export {};
|
|
@@ -7,9 +7,8 @@ export default class ComponentStyle {
|
|
|
7
7
|
baseHash: number;
|
|
8
8
|
baseStyle: ComponentStyle | null | undefined;
|
|
9
9
|
componentId: string;
|
|
10
|
-
isStatic: boolean;
|
|
11
10
|
rules: RuleSet<any>;
|
|
12
|
-
|
|
11
|
+
dynamicNameCache: Map<string, string> | undefined;
|
|
13
12
|
constructor(rules: RuleSet<any>, componentId: string, baseStyle?: ComponentStyle | undefined);
|
|
14
13
|
generateAndInjectStyles(executionContext: ExecutionContext, styleSheet: StyleSheet, stylis: Stringifier): string;
|
|
15
14
|
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { IInlineStyleConstructor, StyleSheet } from '../types';
|
|
2
2
|
export declare const RN_UNSUPPORTED_VALUES: string[];
|
|
3
|
+
/**
|
|
4
|
+
* Extract CSS declaration pairs from flat CSS text.
|
|
5
|
+
* Only handles `property: value;` — selectors, at-rules, and nesting
|
|
6
|
+
* are not supported (and not expected in the native inline style path).
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseCSSDeclarations(rawCss: string): [string, string][];
|
|
9
|
+
/** Clear the cached CSS-to-style-object mappings. Useful in tests or long-running RN apps with highly dynamic styles. */
|
|
3
10
|
export declare const resetStyleCache: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Parse flat CSS into a style object via css-to-react-native, with caching.
|
|
13
|
+
*/
|
|
14
|
+
export declare function cssToStyleObject(flatCSS: string, styleSheet: StyleSheet): any;
|
|
4
15
|
/**
|
|
5
16
|
* InlineStyle takes arbitrary CSS and generates a flat object
|
|
6
17
|
*/
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type PipeableStream } from 'react-dom/server';
|
|
3
3
|
import StyleSheet from '../sheet';
|
|
4
|
+
/**
|
|
5
|
+
* Collect styled-components CSS during server-side rendering.
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const sheet = new ServerStyleSheet();
|
|
9
|
+
* const html = renderToString(sheet.collectStyles(<App />));
|
|
10
|
+
* const styleTags = sheet.getStyleTags();
|
|
11
|
+
* sheet.seal();
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
4
14
|
export default class ServerStyleSheet {
|
|
5
15
|
instance: StyleSheet;
|
|
6
16
|
sealed: boolean;
|
|
@@ -68,4 +68,5 @@ export type IStyleSheetManager = React.PropsWithChildren<{
|
|
|
68
68
|
*/
|
|
69
69
|
target?: undefined | InsertionTarget;
|
|
70
70
|
}>;
|
|
71
|
+
/** Configure style injection for descendant styled components (target element, stylis plugins, prop forwarding). */
|
|
71
72
|
export declare function StyleSheetManager(props: IStyleSheetManager): React.JSX.Element;
|
|
@@ -6,14 +6,30 @@ import ThemeProvider, { ThemeConsumer, ThemeContext, useTheme } from '../models/
|
|
|
6
6
|
import { NativeTarget, RuleSet } from '../types';
|
|
7
7
|
import isStyledComponent from '../utils/isStyledComponent';
|
|
8
8
|
declare const reactNative: Awaited<typeof import("react-native")>;
|
|
9
|
+
/**
|
|
10
|
+
* Create a styled component for React Native.
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const Card = styled.View`padding: 16px; background-color: white;`;
|
|
14
|
+
* const Label = styled(Text)`font-size: 14px;`;
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
9
17
|
declare const baseStyled: <Target extends NativeTarget>(tag: Target) => Styled<"native", Target, Target extends import("../types").KnownTarget ? React.ComponentPropsWithRef<Target> : import("../types").BaseObject, import("../types").BaseObject, never>;
|
|
10
|
-
declare const aliases: readonly ["ActivityIndicator", "Button", "
|
|
18
|
+
declare const aliases: readonly ["ActivityIndicator", "Button", "FlatList", "Image", "ImageBackground", "InputAccessoryView", "KeyboardAvoidingView", "Modal", "Pressable", "RefreshControl", "SafeAreaView", "ScrollView", "SectionList", "StatusBar", "Switch", "Text", "TextInput", "TouchableHighlight", "TouchableNativeFeedback", "TouchableOpacity", "TouchableWithoutFeedback", "View", "VirtualizedList"];
|
|
11
19
|
type KnownComponents = (typeof aliases)[number];
|
|
12
20
|
/** Isolates RN-provided components since they don't expose a helper type for this. */
|
|
13
21
|
type RNComponents = {
|
|
14
22
|
[K in keyof typeof reactNative]: (typeof reactNative)[K] extends React.ComponentType<any> ? (typeof reactNative)[K] : never;
|
|
15
23
|
};
|
|
16
24
|
declare const styled: typeof baseStyled & { [E in KnownComponents]: Styled<"native", RNComponents[E], React.ComponentProps<RNComponents[E]>>; };
|
|
17
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Convert a `css` tagged template to a React Native StyleSheet object.
|
|
27
|
+
*
|
|
28
|
+
* ```tsx
|
|
29
|
+
* const styles = toStyleSheet(css`background-color: red; padding: 10px;`);
|
|
30
|
+
* // { backgroundColor: 'red', paddingTop: 10, ... }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare const toStyleSheet: (rules: RuleSet<object>) => any;
|
|
18
34
|
export { CSSKeyframes, CSSObject, CSSProperties, CSSPseudos, DefaultTheme, ExecutionContext, ExecutionProps, IStyledComponent, IStyledComponentFactory, IStyledStatics, NativeTarget, PolymorphicComponent, PolymorphicComponentProps, Runtime, StyledObject, StyledOptions, } from '../types';
|
|
19
35
|
export { css, styled as default, isStyledComponent, styled, ThemeConsumer, ThemeContext, ThemeProvider, toStyleSheet, useTheme, withTheme, };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("css-to-react-native"),t=require("postcss"),n=require("react");function o(e){return e&&e.__esModule?e:{default:e}}var r=/*#__PURE__*/o(e),s=/*#__PURE__*/o(n);const i=Object.freeze([]),a=Object.freeze({}),c="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function l(e,...t){return"production"===process.env.NODE_ENV?new Error(`An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#${e} for more information.${t.length>0?` Args: ${t.join(", ")}`:""}`):new Error(function(...e){let t=e[0];const n=[];for(let t=1,o=e.length;t<o;t+=1)n.push(e[t]);return n.forEach(e=>{t=t.replace(/%[a-z]/,e)}),t}(c[e],...t).trim())}const u={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexShrink:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function p(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||e in u||e.startsWith("--")?String(t).trim():`${t}px`}function d(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}const f=e=>e>="A"&&e<="Z";function y(e){let t="";for(let n=0;n<e.length;n++){const o=e[n];if(1===n&&"-"===o&&"-"===e[0])return e;f(o)?t+="-"+o.toLowerCase():t+=o}return t.startsWith("ms-")?"-"+t:t}function h(e){return"function"==typeof e}const m=Symbol.for("sc-keyframes");function g(e){return"object"==typeof e&&null!==e&&m in e}function v(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function b(e){return"object"==typeof e&&"styledComponentId"in e}const w=e=>null==e||!1===e||""===e,S=e=>{const t=[];for(const n in e){const o=e[n];e.hasOwnProperty(n)&&!w(o)&&(Array.isArray(o)&&o.isCss||h(o)?t.push(`${y(n)}:`,o,";"):v(o)?t.push(`${n} {`,...S(o),"}"):t.push(`${y(n)}: ${p(n,o)};`))}return t};function P(e,t,n,o,r=[]){if("string"==typeof e)return e&&r.push(e),r;if(w(e))return r;if(b(e))return r.push(`.${e.styledComponentId}`),r;if(h(e)){if(!h(s=e)||s.prototype&&s.prototype.isReactComponent||!t)return r.push(e),r;{const s=e(t);return"production"===process.env.NODE_ENV||"object"!=typeof s||Array.isArray(s)||g(s)||v(s)||null===s||console.error(`${d(e)} is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.`),P(s,t,n,o,r)}}var s;if(g(e))return n?(e.inject(n,o),r.push(e.getName(o))):r.push(e),r;if(v(e)){const t=S(e);for(let e=0;e<t.length;e++)r.push(t[e]);return r}if(!Array.isArray(e))return r.push(e.toString()),r;for(let s=0;s<e.length;s++)P(e[s],t,n,o,r);return r}function O(e,t){const n=[e[0]];for(let o=0,r=t.length;o<r;o+=1)n.push(t[o],e[o+1]);return n}const E=e=>Object.assign(e,{isCss:!0});function C(e,...t){if(h(e)||v(e))return E(P(O(i,[e,...t])));const n=e;return 0===t.length&&1===n.length&&"string"==typeof n[0]?P(n):E(P(O(n,t)))}function j(e,t,n=a){if(!t)throw l(1,t);const o=(o,...r)=>e(t,n,C(o,...r));return o.attrs=o=>j(e,t,Object.assign(Object.assign({},n),{attrs:Array.prototype.concat(n.attrs,o).filter(Boolean)})),o.withConfig=o=>j(e,t,Object.assign(Object.assign({},n),o)),o}var A,N;function $(e){if("undefined"!=typeof process&&void 0!==process.env){const t=process.env[e];if(void 0!==t&&""!==t)return"false"!==t}}"undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process),Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:null!==(N=null!==(A=$("REACT_APP_SC_DISABLE_SPEEDY"))&&void 0!==A?A:$("SC_DISABLE_SPEEDY"))&&void 0!==N?N:"undefined"==typeof process||void 0===process.env||"production"!==process.env.NODE_ENV);const _=s.default.createContext(void 0),T=_.Consumer;function D(e,t,n=a){return e.theme!==n.theme&&e.theme||t||n.theme}const x=Symbol.for("react.memo"),I=Symbol.for("react.forward_ref"),k={contextType:!0,defaultProps:!0,displayName:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,propTypes:!0,type:!0},V={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},R={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},F={[I]:{$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},[x]:R};function L(e){return("type"in(t=e)&&t.type.$$typeof)===x?R:"$$typeof"in e?F[e.$$typeof]:k;var t}const M=Object.defineProperty,B=Object.getOwnPropertyNames,W=Object.getOwnPropertySymbols,q=Object.getOwnPropertyDescriptor,z=Object.getPrototypeOf,Y=Object.prototype;function H(e,t,n){if("string"!=typeof t){const o=z(t);o&&o!==Y&&H(e,o,n);const r=B(t).concat(W(t)),s=L(e),i=L(t);for(let o=0;o<r.length;++o){const a=r[o];if(!(a in V||n&&n[a]||i&&a in i||s&&a in s)){const n=q(t,a);try{M(e,a,n)}catch(e){}}}}return e}const G=/(a)(d)/gi,K=e=>String.fromCharCode(e+(e>25?39:97));function U(e,t){return e.join(t||"")}const Z=["fit-content","min-content","max-content"];let J={};function Q(e){return function(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}(e)?`styled.${e}`:`Styled(${d(e)})`}function X(e,t,n=!1){if(!n&&!v(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(let n=0;n<t.length;n++)e[n]=X(e[n],t[n]);else if(v(t))for(const n in t)e[n]=X(e[n],t[n]);return e}const ee=require("react-native");var te;const ne=(te=ee.StyleSheet,re=class{constructor(e){this.rules=e}generateStyleObject(e){const n=U(P(this.rules,e)),o=function(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=K(t%52)+n;return(K(t%52)+n).replace(G,"$1-$2")}(((e,t)=>{let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e})(5381,n)>>>0);if(!J[o]){let e;try{e=t.parse(n)}catch(e){return"production"!==process.env.NODE_ENV&&console.warn(`[styled-components/native] Failed to parse CSS: ${e instanceof Error?e.message:e}`),J[o]={},J[o]}const s=[];e.each(e=>{if("decl"===e.type){if(Z.includes(e.value))return void("production"!==process.env.NODE_ENV&&console.warn(`[styled-components/native] The value "${e.value}" for property "${e.prop}" is not supported in React Native and will be ignored.`));s.push([e.prop,e.value])}else"production"!==process.env.NODE_ENV&&"comment"!==e.type&&console.warn(`Node of type ${e.type} not supported as an inline style`)});const i=r.default(s,["borderWidth","borderColor"]),a=te.create({generated:i});J[o]=a.generated}return J[o]}},(e,t,o)=>{const r=b(e),c=e,{displayName:l=Q(e),attrs:u=i}=t,p=r&&c.attrs?c.attrs.concat(u).filter(Boolean):u;let d=t.shouldForwardProp;if(r&&c.shouldForwardProp){const e=c.shouldForwardProp;if(t.shouldForwardProp){const n=t.shouldForwardProp;d=(t,o)=>e(t,o)&&n(t,o)}else d=e}const f=(e,t)=>function(e,t,o){const{attrs:r,inlineStyle:i,defaultProps:c,shouldForwardProp:l,target:u}=e,p=s.default.useContext?s.default.useContext(_):void 0,d=D(t,p,c),[f,y]=function(e=a,t,n){const o=Object.assign(Object.assign({},t),{theme:e}),r={};return n.forEach(e=>{let t,n=h(e)?e(o):e;for(t in n)o[t]=r[t]=n[t]}),[o,r]}(d||a,t,r),m=i.generateStyleObject(f),g=o,v=y.as||t.as||u,b=y!==t?Object.assign(Object.assign({},t),y):t,w={};for(const e in b)"$"!==e[0]&&"as"!==e&&("forwardedAs"===e?w.as=b[e]:l&&!l(e,v)||(w[e]=b[e]));return w.style=s.default.useMemo?s.default.useMemo(()=>h(t.style)?e=>[m].concat(t.style(e)):t.style?[m].concat(t.style):m,[t.style,m]):h(t.style)?e=>[m].concat(t.style(e)):t.style?[m].concat(t.style):m,o&&(w.ref=g),n.createElement(v,w)}(y,e,t);f.displayName=l;let y=s.default.forwardRef(f);return y.attrs=p,y.inlineStyle=new re(r?c.inlineStyle.rules.concat(o):o),y.displayName=l,y.shouldForwardProp=d,y.styledComponentId=!0,y.target=r?c.target:e,Object.defineProperty(y,"defaultProps",{get(){return this._foldedDefaultProps},set(e){this._foldedDefaultProps=r?function(e,...t){for(const n of t)X(e,n,!0);return e}({},c.defaultProps,e):e}}),H(y,e,{attrs:!0,inlineStyle:!0,displayName:!0,shouldForwardProp:!0,target:!0}),y}),oe=e=>j(ne,e);var re;["ActivityIndicator","Button","DatePickerIOS","DrawerLayoutAndroid","FlatList","Image","ImageBackground","KeyboardAvoidingView","Modal","Pressable","ProgressBarAndroid","ProgressViewIOS","RefreshControl","SafeAreaView","ScrollView","SectionList","Slider","Switch","Text","TextInput","TouchableHighlight","TouchableOpacity","View","VirtualizedList"].forEach(e=>Object.defineProperty(oe,e,{enumerable:!0,configurable:!1,get(){if(e in ee&&ee[e])return oe(ee[e]);throw new Error(`${e} is not available in the currently-installed version of react-native`)}})),exports.ThemeConsumer=T,exports.ThemeContext=_,exports.ThemeProvider=function(e){const t=s.default.useContext(_),n=s.default.useMemo(()=>function(e,t){if(!e)throw l(14);if(h(e)){const n=e(t);if("production"!==process.env.NODE_ENV&&(null===n||Array.isArray(n)||"object"!=typeof n))throw l(7);return n}if(Array.isArray(e)||"object"!=typeof e)throw l(8);return t?Object.assign(Object.assign({},t),e):e}(e.theme,t),[e.theme,t]);return e.children?s.default.createElement(_.Provider,{value:n},e.children):null},exports.css=C,exports.default=oe,exports.isStyledComponent=b,exports.styled=oe,exports.toStyleSheet=e=>{const n=U(P(e)),o=t.parse(n),s=[];o.each(e=>{"decl"===e.type?s.push([e.prop,e.value]):"production"!==process.env.NODE_ENV&&"comment"!==e.type&&console.warn(`Node of type ${e.type} not supported as an inline style`)});const i=r.default(s,["borderWidth","borderColor"]);return ee.StyleSheet.create({style:i}).style},exports.useTheme=function(){const e=s.default.useContext(_);if(!e)throw l(18);return e},exports.withTheme=function(e){const t=s.default.forwardRef((t,n)=>{const o=D(t,s.default.useContext(_),e.defaultProps);return"production"!==process.env.NODE_ENV&&void 0===o&&console.warn(`[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class "${d(e)}"`),s.default.createElement(e,Object.assign(Object.assign({},t),{theme:o,ref:n}))});return t.displayName=`WithTheme(${d(e)})`,H(t,e)};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("css-to-react-native");function n(e){return e&&e.__esModule?e:{default:e}}var o=/*#__PURE__*/n(e),r=/*#__PURE__*/n(t);const s=Object.freeze([]),i=Object.freeze({}),a="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function c(e,...t){return"production"===process.env.NODE_ENV?new Error(`An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#${e} for more information.${t.length>0?` Args: ${t.join(", ")}`:""}`):new Error(function(...e){let t=e[0];const n=[];for(let t=1,o=e.length;t<o;t+=1)n.push(e[t]);return n.forEach(e=>{t=t.replace(/%[a-z]/,e)}),t}(a[e],...t).trim())}const l={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexShrink:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function u(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||e in l||e.startsWith("--")?String(t).trim():t+"px"}function d(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}const p=e=>e>="A"&&e<="Z";function f(e){let t="";for(let n=0;n<e.length;n++){const o=e[n];if(1===n&&"-"===o&&"-"===e[0])return e;p(o)?t+="-"+o.toLowerCase():t+=o}return t.startsWith("ms-")?"-"+t:t}function y(e){return"function"==typeof e}const h=Symbol.for("sc-keyframes");function m(e){return"object"==typeof e&&null!==e&&h in e}function g(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function b(e){return"object"==typeof e&&"styledComponentId"in e}const v=e=>null==e||!1===e||""===e,w=e=>{const t=[];for(const n in e){const o=e[n];e.hasOwnProperty(n)&&!v(o)&&(Array.isArray(o)&&o.isCss||y(o)?t.push(f(n)+":",o,";"):g(o)?t.push(n+" {",...w(o),"}"):t.push(f(n)+": "+u(n,o)+";"))}return t};function S(e,t,n,o,r=[]){if("string"==typeof e)return e&&r.push(e),r;if(v(e))return r;if(b(e))return r.push(`.${e.styledComponentId}`),r;if(y(e)){if(!y(s=e)||s.prototype&&s.prototype.isReactComponent||!t)return r.push(e),r;{const s=e(t);return"production"===process.env.NODE_ENV||"object"!=typeof s||Array.isArray(s)||m(s)||g(s)||null===s||console.error(`${d(e)} is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.`),S(s,t,n,o,r)}}var s;if(m(e))return n?(e.inject(n,o),r.push(e.getName(o))):r.push(e),r;if(g(e)){const t=w(e);for(let e=0;e<t.length;e++)r.push(t[e]);return r}if(!Array.isArray(e))return r.push(e.toString()),r;for(let s=0;s<e.length;s++)S(e[s],t,n,o,r);return r}function O(e,t){const n=[e[0]];for(let o=0,r=t.length;o<r;o+=1)n.push(t[o],e[o+1]);return n}const P=e=>Object.assign(e,{isCss:!0});function C(e,...t){if(y(e)||g(e))return P(S(O(s,[e,...t])));const n=e;return 0===t.length&&1===n.length&&"string"==typeof n[0]?S(n):P(S(O(n,t)))}function E(e,t,n=i){if(!t)throw c(1,t);const o=(o,...r)=>e(t,n,C(o,...r));return o.attrs=o=>E(e,t,Object.assign(Object.assign({},n),{attrs:Array.prototype.concat(n.attrs,o).filter(Boolean)})),o.withConfig=o=>E(e,t,Object.assign(Object.assign({},n),o)),o}var j,A;function N(e){if("undefined"!=typeof process&&void 0!==process.env){const t=process.env[e];if(void 0!==t&&""!==t)return"false"!==t}}"undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process),Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:null!==(A=null!==(j=N("REACT_APP_SC_DISABLE_SPEEDY"))&&void 0!==j?j:N("SC_DISABLE_SPEEDY"))&&void 0!==A?A:"undefined"==typeof process||void 0===process.env||"production"!==process.env.NODE_ENV);const T=o.default.createContext(void 0),x=T.Consumer;function _(e,t,n=i){return e.theme!==n.theme&&e.theme||t||n.theme}const D=Symbol.for("react.memo"),$=Symbol.for("react.forward_ref"),k={contextType:!0,defaultProps:!0,displayName:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,propTypes:!0,type:!0},I={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},R={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},V={[$]:{$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},[D]:R};function F(e){return("type"in(t=e)&&t.type.$$typeof)===D?R:"$$typeof"in e?V[e.$$typeof]:k;var t}const M=Object.defineProperty,B=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols,W=Object.getOwnPropertyDescriptor,z=Object.getPrototypeOf,q=Object.prototype;function Y(e,t,n){if("string"!=typeof t){const o=z(t);o&&o!==q&&Y(e,o,n);const r=B(t).concat(L(t)),s=F(e),i=F(t);for(let o=0;o<r.length;++o){const a=r[o];if(!(a in I||n&&n[a]||i&&a in i||s&&a in s)){const n=W(t,a);try{M(e,a,n)}catch(e){}}}}return e}const H=/(a)(d)/gi,G=e=>String.fromCharCode(e+(e>25?39:97));function K(e,t){return e.join(t||"")}const U=["fit-content","min-content","max-content"];let Z={};function J(e,t){const n=function(e){let t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=G(t%52)+n;return(G(t%52)+n).replace(H,"$1-$2")}(((e,t)=>{let n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e})(5381,e)>>>0);if(!Z[n]){const o=[];for(const[t,n]of function(e){const t=function(e){if(-1===e.indexOf("/*"))return e;let t="",n=0,o=0;const r=e.length;for(;n<r;){const r=e.charCodeAt(n);if(o){if(92===r){t+=e.substring(n,n+2),n+=2;continue}r===o&&(o=0),t+=e[n],n++}else if(34===r||39===r)o=r,t+=e[n],n++;else if(47===r&&42===e.charCodeAt(n+1)){const t=e.indexOf("*/",n+2);if(-1===t)break;n=t+2}else t+=e[n],n++}return t}(e),n=[],o=t.length;let r=0;for(;r<o;){for(;r<o&&(" "===t[r]||"\n"===t[r]||"\r"===t[r]||"\t"===t[r]||";"===t[r]||"{"===t[r]||"}"===t[r]);)r++;if(r>=o)break;const e=t.indexOf(":",r);if(-1===e)break;const s=t.substring(r,e).trim();let i=0,a=0,c=e+1;for(;c<o;){const e=t.charCodeAt(c);if(a)92===e?c++:e===a&&(a=0);else if(34===e||39===e)a=e;else if(40===e)i++;else if(41===e)i>0&&i--;else if(59===e&&0===i)break;c++}if(c>=o&&(0!==a||i>0)){"production"!==process.env.NODE_ENV&&console.warn(`[styled-components/native] Invalid CSS in declaration "${s}": `+(a?"unterminated string":"unclosed parenthesis")+". This declaration was dropped.");const n=t.indexOf(";",e+1);r=-1!==n?n+1:o;continue}const l=t.substring(e+1,c).trim();s&&l&&("production"===process.env.NODE_ENV||"@"!==s[0]&&-1===s.indexOf("{")?n.push([s,l]):console.warn(`[styled-components/native] "${s}" is not supported as an inline style and will be ignored. Only CSS declarations (property: value) are supported in React Native.`)),r=c+1}return n}(e))U.includes(n)?"production"!==process.env.NODE_ENV&&console.warn(`[styled-components/native] The value "${n}" for property "${t}" is not supported in React Native and will be ignored.`):o.push([t,n]);const s=r.default(o,["borderWidth","borderColor"]);Z[n]=t.create({generated:s}).generated}return Z[n]}function Q(e){return function(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}(e)?`styled.${e}`:`Styled(${d(e)})`}function X(e,t,n=!1){if(!n&&!g(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(let n=0;n<t.length;n++)e[n]=X(e[n],t[n]);else if(g(t))for(const n in t)e[n]=X(e[n],t[n]);return e}const ee=Object.prototype.hasOwnProperty,te=require("react-native");var ne;const oe=(ne=te.StyleSheet,se=class{constructor(e){this.rules=e}generateStyleObject(e){return J(K(S(this.rules,e)),ne)}},(t,n,r)=>{const a=b(t),c=t,{displayName:l=Q(t),attrs:u=s}=n,d=a&&c.attrs?c.attrs.concat(u).filter(Boolean):u;let p=n.shouldForwardProp;if(a&&c.shouldForwardProp){const e=c.shouldForwardProp;if(n.shouldForwardProp){const t=n.shouldForwardProp;p=(n,o)=>e(n,o)&&t(n,o)}else p=e}const f=(t,n)=>function(t,n,r){const{attrs:s,inlineStyle:a,defaultProps:c,shouldForwardProp:l,target:u}=t,d=o.default.useContext?o.default.useContext(T):void 0,p=_(n,d,c)||i;let f,h;const m=o.default.useRef?o.default.useRef(null):{current:null},g=m.current;if(null!==g&&g[1]===p&&function(e,t,n){const o=e,r=t;let s=0;for(const e in r)if(ee.call(r,e)&&(s++,o[e]!==r[e]))return!1;return s===n}(g[0],n,g[2]))f=g[3],h=g[4];else{f=function(e=i,t,n){const o=Object.assign(Object.assign({},t),{theme:e});for(let e=0;e<n.length;e++){const t=y(n[e])?n[e](Object.assign({},o)):n[e];for(const e in t)o[e]=t[e]}return o}(p,n,s),h=a.generateStyleObject(f);let e=0;for(const t in n)ee.call(n,t)&&e++;m.current=[n,p,e,f,h]}const b=f.as||n.as||u,v=function(e,t,n){const o={};for(const r in e)"$"!==r[0]&&"as"!==r&&"theme"!==r&&("forwardedAs"===r?o.as=e[r]:n&&!n(r,t)||(o[r]=e[r]));return o}(f,b,l);return v.style=o.default.useMemo?o.default.useMemo(()=>y(n.style)?e=>[h].concat(n.style(e)):n.style?[h].concat(n.style):h,[n.style,h]):y(n.style)?e=>[h].concat(n.style(e)):n.style?[h].concat(n.style):h,r&&(v.ref=r),e.createElement(b,v)}(h,t,n);f.displayName=l;let h=o.default.forwardRef(f);return h.attrs=d,h.inlineStyle=new se(a?c.inlineStyle.rules.concat(r):r),h.displayName=l,h.shouldForwardProp=p,h.styledComponentId=!0,h.target=a?c.target:t,Object.defineProperty(h,"defaultProps",{get(){return this._foldedDefaultProps},set(e){this._foldedDefaultProps=a?function(e,...t){for(const n of t)X(e,n,!0);return e}({},c.defaultProps,e):e}}),Y(h,t,{attrs:!0,inlineStyle:!0,displayName:!0,shouldForwardProp:!0,target:!0}),h}),re=e=>E(oe,e);var se;["ActivityIndicator","Button","FlatList","Image","ImageBackground","InputAccessoryView","KeyboardAvoidingView","Modal","Pressable","RefreshControl","SafeAreaView","ScrollView","SectionList","StatusBar","Switch","Text","TextInput","TouchableHighlight","TouchableNativeFeedback","TouchableOpacity","TouchableWithoutFeedback","View","VirtualizedList"].forEach(e=>Object.defineProperty(re,e,{enumerable:!0,configurable:!1,get(){if(e in te&&te[e])return re(te[e]);throw new Error(`${e} is not available in the currently-installed version of react-native`)}})),exports.ThemeConsumer=x,exports.ThemeContext=T,exports.ThemeProvider=function(e){const t=o.default.useContext(T),n=o.default.useMemo(()=>function(e,t){if(!e)throw c(14);if(y(e)){const n=e(t);if("production"!==process.env.NODE_ENV&&(null===n||Array.isArray(n)||"object"!=typeof n))throw c(7);return n}if(Array.isArray(e)||"object"!=typeof e)throw c(8);return t?Object.assign(Object.assign({},t),e):e}(e.theme,t),[e.theme,t]);return e.children?o.default.createElement(T.Provider,{value:n},e.children):null},exports.css=C,exports.default=re,exports.isStyledComponent=b,exports.styled=re,exports.toStyleSheet=e=>J(K(S(e)),te.StyleSheet),exports.useTheme=function(){const e=o.default.useContext(T);if(!e)throw c(18);return e},exports.withTheme=function(e){const t=o.default.forwardRef((t,n)=>{const r=_(t,o.default.useContext(T),e.defaultProps);return"production"!==process.env.NODE_ENV&&void 0===r&&console.warn(`[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class "${d(e)}"`),o.default.createElement(e,Object.assign(Object.assign({},t),{theme:r,ref:n}))});return t.displayName=`WithTheme(${d(e)})`,Y(t,e)};
|
|
2
2
|
//# sourceMappingURL=styled-components.native.cjs.js.map
|