react-native-unistyles 2.0.0-alpha.1 → 2.0.0-alpha.11
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -4
- package/cxx/UnistylesRuntime.cpp +255 -0
- package/cxx/UnistylesRuntime.h +60 -0
- package/ios/UnistylesHelpers.h +4 -0
- package/ios/UnistylesHelpers.mm +20 -0
- package/ios/UnistylesModule.h +10 -0
- package/ios/UnistylesModule.mm +158 -0
- package/lib/commonjs/common.js +26 -0
- package/lib/commonjs/common.js.map +1 -0
- package/lib/commonjs/core/UnistyleRegistry.js +38 -0
- package/lib/commonjs/core/UnistyleRegistry.js.map +1 -0
- package/lib/commonjs/core/Unistyles.js +31 -0
- package/lib/commonjs/core/Unistyles.js.map +1 -0
- package/lib/commonjs/core/UnistylesModule.js +9 -0
- package/lib/commonjs/core/UnistylesModule.js.map +1 -0
- package/lib/commonjs/core/UnistylesRuntime.js +66 -0
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -0
- package/lib/commonjs/core/index.js +13 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/createStyleSheet.js +14 -0
- package/lib/commonjs/createStyleSheet.js.map +1 -0
- package/lib/commonjs/global.js +2 -0
- package/lib/commonjs/global.js.map +1 -0
- package/lib/commonjs/hooks/index.js +10 -3
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useInitialTheme.js +17 -0
- package/lib/commonjs/hooks/useInitialTheme.js.map +1 -0
- package/lib/commonjs/hooks/useUnistyles.js +54 -0
- package/lib/commonjs/hooks/useUnistyles.js.map +1 -0
- package/lib/commonjs/index.js +35 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/common.js +2 -0
- package/lib/commonjs/types/{mediaQueries.js.map → common.js.map} +1 -1
- package/lib/commonjs/types/index.js +26 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/mq.js +6 -0
- package/lib/{module/types/mediaQueries.js.map → commonjs/types/mq.js.map} +1 -1
- package/lib/commonjs/types/normalizer.js +6 -0
- package/lib/commonjs/types/normalizer.js.map +1 -0
- package/lib/commonjs/types/unistyles.js +6 -0
- package/lib/commonjs/types/unistyles.js.map +1 -0
- package/lib/commonjs/types/variants.js +2 -0
- package/lib/commonjs/types/variants.js.map +1 -0
- package/lib/commonjs/useStyles.js +49 -0
- package/lib/commonjs/useStyles.js.map +1 -0
- package/lib/commonjs/utils/breakpoints.js +33 -80
- package/lib/commonjs/utils/breakpoints.js.map +1 -1
- package/lib/commonjs/utils/common.js +10 -3
- package/lib/commonjs/utils/common.js.map +1 -1
- package/lib/commonjs/utils/index.js +46 -17
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/module.d.js +2 -0
- package/lib/commonjs/utils/module.d.js.map +1 -0
- package/lib/commonjs/utils/mq.js +89 -0
- package/lib/commonjs/utils/mq.js.map +1 -0
- package/lib/commonjs/utils/mqParser.js +86 -0
- package/lib/commonjs/utils/mqParser.js.map +1 -0
- package/lib/commonjs/utils/normalizeStyles.web.js +13 -13
- package/lib/commonjs/utils/normalizeStyles.web.js.map +1 -1
- package/lib/commonjs/utils/normalizer.js +89 -0
- package/lib/commonjs/utils/normalizer.js.map +1 -0
- package/lib/commonjs/utils/styles.js +29 -58
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/commonjs/utils/variants.js +17 -0
- package/lib/commonjs/utils/variants.js.map +1 -0
- package/lib/module/common.js +22 -0
- package/lib/module/common.js.map +1 -0
- package/lib/module/core/UnistyleRegistry.js +31 -0
- package/lib/module/core/UnistyleRegistry.js.map +1 -0
- package/lib/module/core/Unistyles.js +25 -0
- package/lib/module/core/Unistyles.js.map +1 -0
- package/lib/module/core/UnistylesModule.js +3 -0
- package/lib/module/core/UnistylesModule.js.map +1 -0
- package/lib/module/core/UnistylesRuntime.js +59 -0
- package/lib/module/core/UnistylesRuntime.js.map +1 -0
- package/lib/module/core/index.js +2 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/createStyleSheet.js +7 -0
- package/lib/module/createStyleSheet.js.map +1 -0
- package/lib/module/global.js +2 -0
- package/lib/module/global.js.map +1 -0
- package/lib/module/hooks/index.js +2 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useInitialTheme.js +10 -0
- package/lib/module/hooks/useInitialTheme.js.map +1 -0
- package/lib/module/hooks/useUnistyles.js +47 -0
- package/lib/module/hooks/useUnistyles.js.map +1 -0
- package/lib/module/index.js +13 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/common.js +2 -0
- package/lib/module/types/common.js.map +1 -0
- package/lib/module/types/index.js +2 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/mq.js +2 -0
- package/lib/module/types/mq.js.map +1 -0
- package/lib/module/types/normalizer.js +2 -0
- package/lib/module/types/normalizer.js.map +1 -0
- package/lib/module/types/unistyles.js +2 -0
- package/lib/module/types/unistyles.js.map +1 -0
- package/lib/module/types/variants.js +2 -0
- package/lib/module/types/variants.js.map +1 -0
- package/lib/module/useStyles.js +42 -0
- package/lib/module/useStyles.js.map +1 -0
- package/lib/module/utils/breakpoints.js +34 -82
- package/lib/module/utils/breakpoints.js.map +1 -1
- package/lib/module/utils/common.js +9 -1
- package/lib/module/utils/common.js.map +1 -1
- package/lib/module/utils/index.js +5 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/module.d.js +2 -0
- package/lib/module/utils/module.d.js.map +1 -0
- package/lib/module/utils/mq.js +83 -0
- package/lib/module/utils/mq.js.map +1 -0
- package/lib/module/utils/mqParser.js +79 -0
- package/lib/module/utils/mqParser.js.map +1 -0
- package/lib/module/utils/normalizeStyles.web.js +13 -13
- package/lib/module/utils/normalizeStyles.web.js.map +1 -1
- package/lib/module/utils/normalizer.js +79 -0
- package/lib/module/utils/normalizer.js.map +1 -0
- package/lib/module/utils/styles.js +28 -59
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/module/utils/variants.js +10 -0
- package/lib/module/utils/variants.js.map +1 -0
- package/lib/typescript/src/common.d.ts +17 -0
- package/lib/typescript/src/common.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistyleRegistry.d.ts +15 -0
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -0
- package/lib/typescript/src/core/Unistyles.d.ts +13 -0
- package/lib/typescript/src/core/Unistyles.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesModule.d.ts +6 -0
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +24 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +2 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/createStyleSheet.d.ts +3 -0
- package/lib/typescript/src/createStyleSheet.d.ts.map +1 -0
- package/lib/typescript/src/global.d.ts +7 -0
- package/lib/typescript/src/global.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +2 -1
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useInitialTheme.d.ts +3 -0
- package/lib/typescript/src/hooks/useInitialTheme.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useUnistyles.d.ts +12 -0
- package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +14 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/breakpoints.d.ts +12 -13
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +3 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -0
- package/lib/typescript/src/types/core.d.ts +28 -18
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +7 -2
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/mq.d.ts +3 -0
- package/lib/typescript/src/types/mq.d.ts.map +1 -0
- package/lib/typescript/src/types/normalizer.d.ts +20 -0
- package/lib/typescript/src/types/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/types/unistyles.d.ts +37 -0
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -0
- package/lib/typescript/src/types/variants.d.ts +8 -0
- package/lib/typescript/src/types/variants.d.ts.map +1 -0
- package/lib/typescript/src/useStyles.d.ts +10 -0
- package/lib/typescript/src/useStyles.d.ts.map +1 -0
- package/lib/typescript/src/utils/breakpoints.d.ts +5 -62
- package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/utils/common.d.ts +9 -1
- package/lib/typescript/src/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +5 -1
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mq.d.ts +21 -0
- package/lib/typescript/src/utils/mq.d.ts.map +1 -0
- package/lib/typescript/src/utils/mqParser.d.ts +3 -0
- package/lib/typescript/src/utils/mqParser.d.ts.map +1 -0
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts +4 -1
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +1 -1
- package/lib/typescript/src/utils/normalizer.d.ts +11 -0
- package/lib/typescript/src/utils/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/utils/styles.d.ts +5 -49
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/lib/typescript/src/utils/variants.d.ts +3 -0
- package/lib/typescript/src/utils/variants.d.ts.map +1 -0
- package/package.json +33 -15
- package/react-native-unistyles.podspec +22 -0
- package/src/common.ts +19 -0
- package/src/core/UnistyleRegistry.ts +41 -0
- package/src/core/Unistyles.ts +34 -0
- package/src/core/UnistylesModule.ts +7 -0
- package/src/core/UnistylesRuntime.ts +73 -0
- package/src/core/index.ts +1 -0
- package/src/createStyleSheet.ts +9 -0
- package/src/global.ts +5 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useInitialTheme.ts +11 -0
- package/src/hooks/useUnistyles.ts +55 -0
- package/src/index.ts +30 -2
- package/src/types/breakpoints.ts +21 -20
- package/src/types/common.ts +2 -0
- package/src/types/core.ts +36 -24
- package/src/types/index.ts +7 -9
- package/src/types/mq.ts +3 -0
- package/src/types/normalizer.ts +29 -0
- package/src/types/unistyles.ts +45 -0
- package/src/types/variants.ts +11 -0
- package/src/useStyles.ts +62 -0
- package/src/utils/breakpoints.ts +46 -86
- package/src/utils/common.ts +10 -1
- package/src/utils/index.ts +5 -8
- package/src/utils/module.d.ts +3 -0
- package/src/utils/mq.ts +106 -0
- package/src/utils/mqParser.ts +99 -0
- package/src/utils/normalizeStyles.web.ts +21 -42
- package/src/utils/normalizer.ts +99 -0
- package/src/utils/styles.ts +46 -70
- package/src/utils/variants.ts +13 -0
- package/lib/commonjs/UnistylesTheme.js +0 -21
- package/lib/commonjs/UnistylesTheme.js.map +0 -1
- package/lib/commonjs/createUnistyles.js +0 -57
- package/lib/commonjs/createUnistyles.js.map +0 -1
- package/lib/commonjs/hooks/useDimensions.js +0 -10
- package/lib/commonjs/hooks/useDimensions.js.map +0 -1
- package/lib/commonjs/hooks/useDimensions.web.js +0 -31
- package/lib/commonjs/hooks/useDimensions.web.js.map +0 -1
- package/lib/commonjs/types/mediaQueries.js +0 -2
- package/lib/commonjs/utils/mediaQueries.js +0 -189
- package/lib/commonjs/utils/mediaQueries.js.map +0 -1
- package/lib/module/UnistylesTheme.js +0 -12
- package/lib/module/UnistylesTheme.js.map +0 -1
- package/lib/module/createUnistyles.js +0 -50
- package/lib/module/createUnistyles.js.map +0 -1
- package/lib/module/hooks/useDimensions.js +0 -3
- package/lib/module/hooks/useDimensions.js.map +0 -1
- package/lib/module/hooks/useDimensions.web.js +0 -24
- package/lib/module/hooks/useDimensions.web.js.map +0 -1
- package/lib/module/types/mediaQueries.js +0 -2
- package/lib/module/utils/mediaQueries.js +0 -176
- package/lib/module/utils/mediaQueries.js.map +0 -1
- package/lib/typescript/src/UnistylesTheme.d.ts +0 -9
- package/lib/typescript/src/UnistylesTheme.d.ts.map +0 -1
- package/lib/typescript/src/createUnistyles.d.ts +0 -10
- package/lib/typescript/src/createUnistyles.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useDimensions.d.ts +0 -3
- package/lib/typescript/src/hooks/useDimensions.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useDimensions.web.d.ts +0 -3
- package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +0 -1
- package/lib/typescript/src/types/mediaQueries.d.ts +0 -8
- package/lib/typescript/src/types/mediaQueries.d.ts.map +0 -1
- package/lib/typescript/src/utils/mediaQueries.d.ts +0 -130
- package/lib/typescript/src/utils/mediaQueries.d.ts.map +0 -1
- package/src/UnistylesTheme.tsx +0 -17
- package/src/__tests__/createUnistyles.spec.tsx +0 -192
- package/src/createUnistyles.ts +0 -70
- package/src/hooks/useDimensions.ts +0 -4
- package/src/hooks/useDimensions.web.ts +0 -30
- package/src/types/mediaQueries.ts +0 -10
- package/src/utils/mediaQueries.ts +0 -201
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEhE,eAAO,MAAM,gBAAgB,yDAA0D,cAAc,wCAMpG,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useInitialTheme.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useInitialTheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEhD,eAAO,MAAM,eAAe,YAAa,MAAM,eAAe,SAM7D,CAAA"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export declare const useUnistyles: () => {
|
2
|
+
theme: never;
|
3
|
+
layout: {
|
4
|
+
breakpoint: keyof import("..").UnistylesBreakpoints;
|
5
|
+
orientation: import("../common").ScreenOrientation;
|
6
|
+
screenSize: {
|
7
|
+
width: number;
|
8
|
+
height: number;
|
9
|
+
};
|
10
|
+
};
|
11
|
+
};
|
12
|
+
//# sourceMappingURL=useUnistyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;CA8CxB,CAAA"}
|
@@ -1,3 +1,15 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import { mq } from './utils';
|
2
|
+
import { useInitialTheme } from './hooks';
|
3
|
+
import type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
4
|
+
import { ScreenOrientation } from './common';
|
5
|
+
import { useStyles } from './useStyles';
|
6
|
+
import { createStyleSheet } from './createStyleSheet';
|
7
|
+
declare const UnistylesRegistry: {
|
8
|
+
addThemes: (themes: UnistylesThemes) => import("./core/UnistyleRegistry").UnistyleRegistry;
|
9
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => import("./core/UnistyleRegistry").UnistyleRegistry;
|
10
|
+
addConfig: (config: import("./types").UnistylesConfig) => import("./core/UnistyleRegistry").UnistyleRegistry;
|
11
|
+
};
|
12
|
+
declare const UnistylesRuntime: import("./core/UnistylesRuntime").UnistylesRuntime;
|
13
|
+
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, UnistylesRegistry, UnistylesRuntime };
|
14
|
+
export type { UnistylesThemes, UnistylesBreakpoints };
|
3
15
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,QAAA,MAAM,iBAAiB;;;;CAItB,CAAA;AAED,QAAA,MAAM,gBAAgB,oDAAoB,CAAA;AAE1C,OAAO,EACH,EAAE,EACF,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EACnB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACvB,CAAA"}
|
@@ -1,19 +1,18 @@
|
|
1
|
-
import type {
|
2
|
-
|
3
|
-
|
4
|
-
export type ScreenSize = {
|
5
|
-
width: number;
|
6
|
-
height: number;
|
7
|
-
};
|
8
|
-
export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST;
|
1
|
+
import type { OpaqueColorValue } from 'react-native';
|
2
|
+
import type { UnistylesBreakpoints } from '../global';
|
3
|
+
import type { MediaQuery } from './mq';
|
9
4
|
type WithEmptyObject<V> = keyof V extends never ? {} : V;
|
10
|
-
|
11
|
-
[K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R
|
5
|
+
type ExtractBreakpoints<T> = T extends Partial<Record<keyof UnistylesBreakpoints & string, infer V>> ? WithEmptyObject<V> : T extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R> : {
|
6
|
+
[K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R> : T[K] extends object ? ExtractBreakpoints<T[K]> : T[K];
|
12
7
|
};
|
13
|
-
|
14
|
-
|
8
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
9
|
+
type RemoveKeysWithPrefix<T> = T extends (...args: Array<any>) => infer R ? (...args: Parameters<T>) => RemoveKeysWithPrefix<R> : T extends object ? T extends OpaqueColorValue ? string : T extends Record<string, infer _V> ? T extends {
|
10
|
+
variants: infer _V;
|
11
|
+
} ? Omit<T, 'variants'> & UnionToIntersection<_V[keyof _V]> : {
|
12
|
+
[K in keyof T as K extends MediaQuery ? keyof UnistylesBreakpoints & string : K]: RemoveKeysWithPrefix<T[K]>;
|
15
13
|
} : {
|
16
|
-
[K in keyof T]: RemoveKeysWithPrefix<T[K]
|
14
|
+
[K in keyof T]: RemoveKeysWithPrefix<T[K]>;
|
17
15
|
} : T;
|
16
|
+
export type ReactNativeStyleSheet<T> = ExtractBreakpoints<RemoveKeysWithPrefix<T>>;
|
18
17
|
export {};
|
19
18
|
//# sourceMappingURL=breakpoints.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/types/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/types/breakpoints.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AC,GACnE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,CAAC,GACnD,CAAC,SAAS,MAAM,GACZ,CAAC,SAAS,gBAAgB,GACtB,MAAM,GACN,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAC9B,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GAC5B,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,GACvD;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,UAAU,GAAG,MAAM,oBAAoB,GAAG,MAAM,GAAG,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACpH;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtD,CAAC,CAAA;AAEX,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,kBAAkB,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/types/common.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAA;AACvC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA"}
|
@@ -1,32 +1,42 @@
|
|
1
1
|
import type { MatrixTransform, PerpectiveTransform, RotateTransform, RotateXTransform, RotateYTransform, RotateZTransform, ScaleTransform, ScaleXTransform, ScaleYTransform, SkewXTransform, SkewYTransform, TranslateXTransform, TranslateYTransform } from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
|
2
2
|
import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
|
3
|
-
import type {
|
4
|
-
import type {
|
3
|
+
import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
|
4
|
+
import type { MediaQuery } from './mq';
|
5
5
|
type ShadowOffset = {
|
6
6
|
width: number;
|
7
7
|
height: number;
|
8
8
|
};
|
9
|
+
export type ScreenSize = {
|
10
|
+
width: number;
|
11
|
+
height: number;
|
12
|
+
};
|
9
13
|
type TransformStyles = PerpectiveTransform & RotateTransform & RotateXTransform & RotateYTransform & RotateZTransform & ScaleTransform & ScaleXTransform & ScaleYTransform & TranslateXTransform & TranslateYTransform & SkewXTransform & SkewYTransform & MatrixTransform;
|
10
|
-
type UnistyleNested
|
11
|
-
shadowOffset?: DeepUniStyle<ShadowOffset
|
12
|
-
textShadowOffset?: DeepUniStyle<ShadowOffset
|
13
|
-
transform?: Array<DeepUniStyle<TransformStyles
|
14
|
+
type UnistyleNested = {
|
15
|
+
shadowOffset?: DeepUniStyle<ShadowOffset>;
|
16
|
+
textShadowOffset?: DeepUniStyle<ShadowOffset>;
|
17
|
+
transform?: Array<DeepUniStyle<TransformStyles>>;
|
18
|
+
variants?: Record<string, UnistyleView | UnistyleText | UnistyleImage & Omit<UnistyleNested, 'variants'>>;
|
14
19
|
};
|
15
|
-
type UniStyle<V
|
16
|
-
[innerKey in keyof
|
20
|
+
type UniStyle<V> = {
|
21
|
+
[innerKey in keyof UnistylesBreakpoints]?: V;
|
17
22
|
} | {
|
18
|
-
[innerKey in
|
19
|
-
}
|
20
|
-
type DeepUniStyle<T
|
21
|
-
[K in keyof T]?: UniStyle<T[K]
|
23
|
+
[innerKey in MediaQuery]: V;
|
24
|
+
};
|
25
|
+
type DeepUniStyle<T> = {
|
26
|
+
[K in keyof T]?: UniStyle<T[K]> | T[K];
|
22
27
|
};
|
23
28
|
type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset';
|
24
|
-
type UnistyleView
|
25
|
-
type UnistyleText
|
26
|
-
type UnistyleImage
|
27
|
-
export type StaticStyles
|
28
|
-
export type CustomNamedStyles<T
|
29
|
-
[K in keyof T]: T[K] extends (...args: infer A) => StaticStyles
|
29
|
+
type UnistyleView = DeepUniStyle<Omit<ViewStyle, NestedTypes>>;
|
30
|
+
type UnistyleText = DeepUniStyle<Omit<TextStyle, NestedTypes>>;
|
31
|
+
type UnistyleImage = DeepUniStyle<Omit<ImageStyle, NestedTypes>>;
|
32
|
+
export type StaticStyles = UnistyleView | UnistyleText | UnistyleImage & UnistyleNested;
|
33
|
+
export type CustomNamedStyles<T> = {
|
34
|
+
[K in keyof T]: T[K] extends (...args: infer A) => StaticStyles ? (...args: A) => StaticStyles : StaticStyles;
|
30
35
|
};
|
36
|
+
export type RNValue = number | string | undefined;
|
37
|
+
export type NestedStyle = Record<keyof UnistylesBreakpoints | MediaQuery, RNValue>;
|
38
|
+
export type NestedStylePairs = Array<[keyof UnistylesBreakpoints | MediaQuery, RNValue]>;
|
39
|
+
export type UnistylesTheme = UnistylesThemes[keyof UnistylesThemes];
|
40
|
+
export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST;
|
31
41
|
export {};
|
32
42
|
//# sourceMappingURL=core.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,mDAAmD,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,eAAe,EACf,mBAAmB,EACn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K,KAAK,EAAE,CAAA"}
|
@@ -1,3 +1,8 @@
|
|
1
|
-
export
|
2
|
-
export
|
1
|
+
export * from './normalizer';
|
2
|
+
export * from './unistyles';
|
3
|
+
export type { Optional, Nullable } from './common';
|
4
|
+
export type { MediaQuery } from './mq';
|
5
|
+
export type { CustomNamedStyles, NestedStylePairs, UnistylesTheme, CreateStylesFactory, ScreenSize, NestedStyle, RNValue } from './core';
|
6
|
+
export type { ReactNativeStyleSheet } from './breakpoints';
|
7
|
+
export type { ExtractVariantNames } from './variants';
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAClD,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACtC,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,mBAAmB,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACxI,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mq.d.ts","sourceRoot":"","sources":["../../../../src/types/mq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,MAAM,MAAM,UAAU,GAAG,OAAO,QAAQ,CAAA"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import type { ShadowStyleIOS, TextStyle, TransformsStyle } from 'react-native';
|
2
|
+
type TransformArrayElement<T> = T extends Array<infer U> ? U : never;
|
3
|
+
type BoxShadow = Required<ShadowStyleIOS>;
|
4
|
+
type TextShadow = Required<Pick<TextStyle, 'textShadowColor' | 'textShadowOffset' | 'textShadowRadius'>>;
|
5
|
+
type Transforms = Array<TransformArrayElement<TransformsStyle['transform']>>;
|
6
|
+
type NormalizedBoxShadow = {
|
7
|
+
shadowColor: undefined;
|
8
|
+
shadowOffset: undefined;
|
9
|
+
shadowOpacity: undefined;
|
10
|
+
shadowRadius: undefined;
|
11
|
+
boxShadow?: string;
|
12
|
+
};
|
13
|
+
type NormalizedTextShadow = {
|
14
|
+
textShadowColor: undefined;
|
15
|
+
textShadowOffset: undefined;
|
16
|
+
textShadowRadius: undefined;
|
17
|
+
textShadow?: string;
|
18
|
+
};
|
19
|
+
export type { BoxShadow, TextShadow, Transforms, NormalizedBoxShadow, NormalizedTextShadow };
|
20
|
+
//# sourceMappingURL=normalizer.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../../src/types/normalizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9E,KAAK,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AACpE,KAAK,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAA;AACzC,KAAK,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,kBAAkB,CAAC,CAAC,CAAA;AACxG,KAAK,UAAU,GAAG,KAAK,CAAC,qBAAqB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;AAE5E,KAAK,mBAAmB,GAAG;IACvB,WAAW,EAAE,SAAS,CAAC;IACvB,YAAY,EAAE,SAAS,CAAC;IACxB,aAAa,EAAE,SAAS,CAAC;IACzB,YAAY,EAAE,SAAS,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,KAAK,oBAAoB,GAAG;IACxB,eAAe,EAAE,SAAS,CAAA;IAC1B,gBAAgB,EAAE,SAAS,CAAA;IAC3B,gBAAgB,EAAE,SAAS,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,YAAY,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,oBAAoB,EACvB,CAAA"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { CxxUnistylesEventTypes, ScreenOrientation } from '../common';
|
2
|
+
import type { UnistylesThemes, UnistylesBreakpoints } from '../global';
|
3
|
+
import type { ScreenSize } from './core';
|
4
|
+
import type { Optional } from './common';
|
5
|
+
export type ColorSchemeName = Optional<'light' | 'dark'>;
|
6
|
+
export type UnistylesConfig = {
|
7
|
+
adaptiveThemes?: boolean;
|
8
|
+
};
|
9
|
+
export type UnistylesBridge = {
|
10
|
+
screenWidth: number;
|
11
|
+
screenHeight: number;
|
12
|
+
hasAdaptiveThemes: boolean;
|
13
|
+
themeName: keyof UnistylesThemes;
|
14
|
+
breakpoint: keyof UnistylesBreakpoints;
|
15
|
+
colorScheme: ColorSchemeName;
|
16
|
+
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
17
|
+
themes: Array<keyof UnistylesThemes>;
|
18
|
+
useBreakpoints(breakpoints: UnistylesBreakpoints): void;
|
19
|
+
useTheme(name: keyof UnistylesThemes): void;
|
20
|
+
useAdaptiveThemes(enable: boolean): void;
|
21
|
+
};
|
22
|
+
export type UnistylesThemeEvent = {
|
23
|
+
type: CxxUnistylesEventTypes.Theme;
|
24
|
+
payload: {
|
25
|
+
themeName: keyof UnistylesThemes;
|
26
|
+
};
|
27
|
+
};
|
28
|
+
export type UnistylesMobileLayoutEvent = {
|
29
|
+
type: CxxUnistylesEventTypes.Layout;
|
30
|
+
payload: {
|
31
|
+
screen: ScreenSize;
|
32
|
+
breakpoint: keyof UnistylesBreakpoints;
|
33
|
+
orientation: ScreenOrientation;
|
34
|
+
};
|
35
|
+
};
|
36
|
+
export type UnistylesEvents = UnistylesThemeEvent | UnistylesMobileLayoutEvent;
|
37
|
+
//# sourceMappingURL=unistyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"unistyles.d.ts","sourceRoot":"","sources":["../../../../src/types/unistyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,CAAA;AAExD,MAAM,MAAM,eAAe,GAAG;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAE1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,MAAM,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,oBAAoB,CAAC;IACvC,WAAW,EAAE,eAAe,CAAC;IAC7B,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAG7G,MAAM,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC,CAAC;IACrC,cAAc,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;IAC5C,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,EAAE,sBAAsB,CAAC,KAAK,CAAC;IACnC,OAAO,EAAE;QACL,SAAS,EAAE,MAAM,eAAe,CAAA;KACnC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC;QACnB,UAAU,EAAE,MAAM,oBAAoB,CAAC;QACvC,WAAW,EAAE,iBAAiB,CAAA;KACjC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,0BAA0B,CAAA"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export type ExtractVariantNames<T> = T extends object ? {
|
2
|
+
[K in keyof T]: T[K] extends {
|
3
|
+
variants: infer V;
|
4
|
+
} ? V extends object ? {
|
5
|
+
[VK in keyof V]: VK extends 'default' ? never : VK;
|
6
|
+
}[keyof V] | ExtractVariantNames<V> : never : ExtractVariantNames<T[K]>;
|
7
|
+
}[keyof T] : never;
|
8
|
+
//# sourceMappingURL=variants.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/types/variants.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC/C;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;QAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;KAAE,GAC5C,CAAC,SAAS,MAAM,GACX;SAAG,EAAE,IAAI,MAAM,CAAC,GAAG,EAAE,SAAS,SAAS,GACpC,KAAK,GAAG,EAAE;KAAE,CAAC,MAAM,CAAC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,GAClD,KAAK,GACT,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,MAAM,CAAC,CAAC,GACR,KAAK,CAAA"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { CreateStylesFactory, CustomNamedStyles, ExtractVariantNames, ReactNativeStyleSheet, UnistylesTheme } from './types';
|
2
|
+
import type { UnistylesBreakpoints } from './global';
|
3
|
+
type ParsedStylesheet<ST extends CustomNamedStyles<ST>> = {
|
4
|
+
theme: UnistylesTheme;
|
5
|
+
breakpoint: keyof UnistylesBreakpoints;
|
6
|
+
styles: ReactNativeStyleSheet<ST>;
|
7
|
+
};
|
8
|
+
export declare const useStyles: <ST extends CustomNamedStyles<ST>>(stylesheet?: ST | CreateStylesFactory<ST, never> | undefined, variant?: (ExtractVariantNames<ST> & string) | undefined) => ParsedStylesheet<ST>;
|
9
|
+
export {};
|
10
|
+
//# sourceMappingURL=useStyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../src/useStyles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACjB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD,KAAK,gBAAgB,CAAC,EAAE,SAAS,iBAAiB,CAAC,EAAE,CAAC,IAAI;IACtD,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,MAAM,oBAAoB,CAAC;IACvC,MAAM,EAAE,qBAAqB,CAAC,EAAE,CAAC,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,SAAS,oLA0CrB,CAAA"}
|
@@ -1,63 +1,6 @@
|
|
1
|
-
import type {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
* It returns a new object with the same keys but sorted based on their corresponding numeric values.
|
7
|
-
* Additionally, it validates that:
|
8
|
-
* 1. The first breakpoint starts with a value of 0.
|
9
|
-
* 2. No duplicate breakpoint values exist.
|
10
|
-
*
|
11
|
-
* If the validation fails, appropriate error messages are logged to the console.
|
12
|
-
*
|
13
|
-
* @template B - An object type where keys are strings and values are numbers.
|
14
|
-
* @param {B} breakpoints - The breakpoints object to be sorted and validated.
|
15
|
-
* @returns {B} A new object with sorted and validated breakpoints.
|
16
|
-
*
|
17
|
-
* @example
|
18
|
-
* const input = { md: 768, lg: 1024, sm: 0 }
|
19
|
-
* sortAndValidateBreakpoints(input) // returns { sm: 0, md: 768, lg: 1024 }
|
20
|
-
*/
|
21
|
-
export declare const sortAndValidateBreakpoints: <B extends Breakpoints>(breakpoints: B) => B;
|
22
|
-
/**
|
23
|
-
* Determines the appropriate breakpoint key for a given screen width based on provided breakpoints.
|
24
|
-
*
|
25
|
-
* This function takes a screen width and an object of breakpoints. It returns the key of the breakpoint
|
26
|
-
* that the screen width falls into. The breakpoints are assumed to be sorted in ascending order.
|
27
|
-
*
|
28
|
-
* @template B - An object type where keys are strings and values are numbers representing screen widths.
|
29
|
-
* @param {number} width - The screen width to determine the breakpoint for.
|
30
|
-
* @param breakpointEntries - sorted pairs of breakpoints
|
31
|
-
* @returns {keyof B & string} The key of the breakpoint that the screen width falls into.
|
32
|
-
*
|
33
|
-
* @example
|
34
|
-
* const breakpoints = { sm: 0, md: 768, lg: 1024 }
|
35
|
-
* getBreakpointFromScreenWidth(800, breakpoints) // returns 'md'
|
36
|
-
*/
|
37
|
-
export declare const getBreakpointFromScreenWidth: <B extends Breakpoints>(width: number, breakpointEntries: SortedBreakpointEntries<B>) => keyof B & string;
|
38
|
-
/**
|
39
|
-
* Retrieves the value associated with a given breakpoint or custom media query based on the provided screen size.
|
40
|
-
*
|
41
|
-
* The function first checks for custom media queries. If a matching custom media query is found, its associated value is returned.
|
42
|
-
* If no custom media query matches, the function then checks for a direct breakpoint match.
|
43
|
-
* If there's no direct breakpoint match, the function simulates CSS cascading to find the closest matching breakpoint.
|
44
|
-
*
|
45
|
-
* @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
|
46
|
-
*
|
47
|
-
* @param {Record<keyof B & string, string | number>} value - An object containing values associated with breakpoints or custom media queries.
|
48
|
-
* @param {keyof B & string} breakpoint - The breakpoint name to check against.
|
49
|
-
* @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
|
50
|
-
* @param breakpointPairs - sorted pairs of breakpoints
|
51
|
-
*
|
52
|
-
* @returns {string | number | undefined} Returns the value associated with the matching breakpoint or custom media query, or `undefined` if no match is found.
|
53
|
-
*
|
54
|
-
* @example
|
55
|
-
*
|
56
|
-
* const values = { ':w[200]': 'value1', sm: 'value2', md: 'value3' }
|
57
|
-
* const screenSize = { width: 250, height: 400 }
|
58
|
-
* const breakpoints = { sm: 300, md: 600, lg: 900 }
|
59
|
-
*
|
60
|
-
* getValueForBreakpoint(values, 'sm', screenSize, breakpoints); // 'value1'
|
61
|
-
*/
|
62
|
-
export declare const getValueForBreakpoint: <B extends Breakpoints>(value: Record<keyof B & string, string | number | undefined>, breakpoint: keyof B & string, screenSize: ScreenSize, breakpointPairs: SortedBreakpointEntries<B>) => string | number | undefined;
|
1
|
+
import type { NestedStyle, RNValue } from '../types';
|
2
|
+
import type { UnistylesBreakpoints } from '../global';
|
3
|
+
export declare const sortAndValidateBreakpoints: (breakpoints: UnistylesBreakpoints) => UnistylesBreakpoints;
|
4
|
+
export declare const getBreakpointFromScreenWidth: (width: number, breakpointEntries: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>) => keyof UnistylesBreakpoints & string;
|
5
|
+
export declare const getValueForBreakpoint: (value: NestedStyle) => RNValue;
|
63
6
|
//# sourceMappingURL=breakpoints.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/utils/breakpoints.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/utils/breakpoints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAoB,OAAO,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAIrD,eAAO,MAAM,0BAA0B,gBAAiB,oBAAoB,KAAG,oBAuB9E,CAAA;AAED,eAAO,MAAM,4BAA4B,UAAW,MAAM,qBAAqB,MAAM,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,KAAG,MAAM,oBAAoB,GAAG,MAcnM,CAAA;AAED,eAAO,MAAM,qBAAqB,UAAW,WAAW,KAAG,OAmD1D,CAAA"}
|
@@ -1,4 +1,12 @@
|
|
1
1
|
export declare const throwError: (message: string) => never;
|
2
2
|
export declare const warn: (message: string) => void;
|
3
|
-
export declare const
|
3
|
+
export declare const isMobile: boolean;
|
4
|
+
export declare const isWeb: boolean;
|
5
|
+
export declare const isIOS: boolean;
|
6
|
+
export declare const isAndroid: boolean;
|
7
|
+
export declare const isServer: boolean;
|
8
|
+
export declare const Orientation: {
|
9
|
+
readonly Landscape: "landscape";
|
10
|
+
readonly Portrait: "portrait";
|
11
|
+
};
|
4
12
|
//# sourceMappingURL=common.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/utils/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,YAAa,MAAM,UAEzC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,KAAK,
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/utils/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,YAAa,MAAM,UAEzC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,QAAQ,SAAqD,CAAA;AAC1E,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,SAAS,SAA4B,CAAA;AAClD,eAAO,MAAM,QAAQ,SAAgC,CAAA;AAErD,eAAO,MAAM,WAAW;;;CAGd,CAAA"}
|
@@ -1,5 +1,9 @@
|
|
1
1
|
export { normalizeStyles } from './normalizeStyles';
|
2
|
+
export * from './normalizer';
|
3
|
+
export { mq, MQSymbol } from './mq';
|
4
|
+
export { getKeyForVariant } from './variants';
|
5
|
+
export { getKeyForUnistylesMediaQuery } from './mqParser';
|
2
6
|
export { getBreakpointFromScreenWidth, sortAndValidateBreakpoints, getValueForBreakpoint } from './breakpoints';
|
3
7
|
export { proxifyFunction, parseStyle } from './styles';
|
4
|
-
export {
|
8
|
+
export { isServer, Orientation } from './common';
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC/G,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC/G,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { MediaQuery, Nullable } from '../types';
|
2
|
+
import type { UnistylesBreakpoints } from '../global';
|
3
|
+
export declare const MQSymbol: unique symbol;
|
4
|
+
type MQValue = keyof UnistylesBreakpoints | number;
|
5
|
+
type MQHandler = {
|
6
|
+
w(wMin?: Nullable<MQValue>, wMax?: MQValue): WidthHandler;
|
7
|
+
width(wMin?: Nullable<MQValue>, wMax?: MQValue): WidthHandler;
|
8
|
+
h(hMin?: Nullable<MQValue>, hMax?: MQValue): HeightHandler;
|
9
|
+
height(hMin?: Nullable<MQValue>, hMax?: MQValue): HeightHandler;
|
10
|
+
};
|
11
|
+
type HeightHandler = {
|
12
|
+
w(wMin?: Nullable<MQValue>, wMax?: MQValue): MediaQuery;
|
13
|
+
width(wMin?: Nullable<MQValue>, wMax?: MQValue): MediaQuery;
|
14
|
+
} & MediaQuery;
|
15
|
+
type WidthHandler = {
|
16
|
+
h(hMin?: Nullable<MQValue>, hMax?: MQValue): MediaQuery;
|
17
|
+
height(hMin?: Nullable<MQValue>, hMax?: MQValue): MediaQuery;
|
18
|
+
} & MediaQuery;
|
19
|
+
export declare const mq: MQHandler;
|
20
|
+
export {};
|
21
|
+
//# sourceMappingURL=mq.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mq.d.ts","sourceRoot":"","sources":["../../../../src/utils/mq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,K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file":"mqParser.d.ts","sourceRoot":"","sources":["../../../../src/utils/mqParser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAkFtE,eAAO,MAAM,4BAA4B,+CAAgD,UAAU,qBAgBlG,CAAA"}
|
@@ -1,2 +1,5 @@
|
|
1
|
-
|
1
|
+
import type { Transforms } from '../types';
|
2
|
+
export declare const normalizeStyles: <T extends Required<import("react-native").ShadowStyleIOS> | Required<Pick<import("react-native").TextStyle, "textShadowColor" | "textShadowOffset" | "textShadowRadius">> | {
|
3
|
+
transform: Transforms;
|
4
|
+
}>(style: T) => T;
|
2
5
|
//# sourceMappingURL=normalizeStyles.web.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"normalizeStyles.web.d.ts","sourceRoot":"","sources":["../../../../src/utils/normalizeStyles.web.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"normalizeStyles.web.d.ts","sourceRoot":"","sources":["../../../../src/utils/normalizeStyles.web.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoE,UAAU,EAAE,MAAM,UAAU,CAAA;AAuD5G,eAAO,MAAM,eAAe;;iBAwB3B,CAAA"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { TextShadow, Transforms, BoxShadow } from '../types';
|
2
|
+
type Preprocessor = {
|
3
|
+
createTextShadowValue(style: TextShadow): string;
|
4
|
+
createBoxShadowValue(style: Required<BoxShadow>): string;
|
5
|
+
createTransformValue(transforms: Required<Transforms>): string;
|
6
|
+
};
|
7
|
+
export declare const normalizeColor: (color: string, opacity?: number) => string;
|
8
|
+
export declare const normalizeNumericValue: (value: number) => string | number;
|
9
|
+
export declare const preprocessor: Preprocessor;
|
10
|
+
export {};
|
11
|
+
//# sourceMappingURL=normalizer.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../../src/utils/normalizer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEjE,KAAK,YAAY,GAAG;IAChB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC;IACjD,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;IACzD,oBAAoB,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;CAClE,CAAA;AAED,eAAO,MAAM,cAAc,UAAW,MAAM,YAAW,MAAM,WAyB5D,CAAA;AAED,eAAO,MAAM,qBAAqB,UAAW,MAAM,oBAAiC,CAAA;AAwDpF,eAAO,MAAM,YAAY,EAAE,YAI1B,CAAA"}
|
@@ -1,50 +1,6 @@
|
|
1
|
-
import type {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
*
|
7
|
-
* @param {Function} fn - The function to be proxified.
|
8
|
-
* @param {keyof B & string} breakpoint - The breakpoint name to check against.
|
9
|
-
* @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
|
10
|
-
* @param breakpointPairs - sorted pairs of breakpoints
|
11
|
-
*
|
12
|
-
* @returns {Function} Returns the proxified function
|
13
|
-
*
|
14
|
-
* @example
|
15
|
-
*
|
16
|
-
* const myFunction = () => ({ ':w[200]': 'value1', sm: 'value2' })
|
17
|
-
* const screenSize = { width: 250, height: 400 }
|
18
|
-
* const breakpoints = { sm: 300, md: 600 }
|
19
|
-
*
|
20
|
-
* const proxifiedFunction = proxifyFunction(myFunction, 'sm', screenSize, breakpoints)
|
21
|
-
* proxifiedFunction() // parsed style based on screenSize and breakpoints
|
22
|
-
*/
|
23
|
-
export declare const proxifyFunction: <B extends Breakpoints>(fn: Function, breakpoint: keyof B & string, screenSize: ScreenSize, breakpointPairs: SortedBreakpointEntries<B>) => Function;
|
24
|
-
/**
|
25
|
-
* Parses a style object to resolve custom media queries or breakpoints based on the provided screen size and breakpoints.
|
26
|
-
*
|
27
|
-
* The function processes each key-value pair in the style object. If the value is a function or a valid style (not an object or a 'transform' key),
|
28
|
-
* it is returned as-is. Otherwise, the function attempts to resolve the value based on the provided breakpoint, screen size, and defined breakpoints.
|
29
|
-
*
|
30
|
-
* @template T - The type of the style object.
|
31
|
-
* @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
|
32
|
-
*
|
33
|
-
* @param {CustomNamedStyles<T, B>} style - The style object to be parsed.
|
34
|
-
* @param {keyof B & string} breakpoint - The breakpoint name to check against.
|
35
|
-
* @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
|
36
|
-
* @param breakpointPairs - sorted pairs of breakpoints
|
37
|
-
*
|
38
|
-
* @returns {Record<string, string | number | Function>} Returns the parsed style object with resolved custom media queries or breakpoints.
|
39
|
-
*
|
40
|
-
* @example
|
41
|
-
*
|
42
|
-
* const style = { fontSize: { sm: '12px', md: '16px' } }
|
43
|
-
* const screenSize = { width: 300, height: 400 }
|
44
|
-
* const breakpoints = { xs: 0, sm: 300, md: 600 }
|
45
|
-
*
|
46
|
-
* const parsedStyle = parseStyle(style, 'sm', screenSize, breakpoints)
|
47
|
-
* // { fontSize: '12px' }
|
48
|
-
*/
|
49
|
-
export declare const parseStyle: <T, B extends Breakpoints>(style: CustomNamedStyles<T, B>, breakpoint: keyof B & string, screenSize: ScreenSize, breakpointPairs: SortedBreakpointEntries<B>) => T;
|
1
|
+
import type { CustomNamedStyles, ScreenSize } from '../types';
|
2
|
+
import type { UnistylesBreakpoints } from '../global';
|
3
|
+
export declare const proxifyFunction: (fn: Function, breakpoint: keyof UnistylesBreakpoints & string, screenSize: ScreenSize, variant?: string) => Function;
|
4
|
+
export declare const isPlatformColor: <T extends {}>(value: T) => boolean;
|
5
|
+
export declare const parseStyle: <T>(style: CustomNamedStyles<T>, breakpoint: keyof UnistylesBreakpoints & string, screenSize: ScreenSize, variant?: string) => T;
|
50
6
|
//# sourceMappingURL=styles.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAe,MAAM,UAAU,CAAA;AAG1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAIrD,eAAO,MAAM,eAAe,OACpB,QAAQ,cAAc,MAAM,oBAAoB,GAAG,MAAM,cACjD,UAAU,YACZ,MAAM,KACjB,QAGD,CAAA;AAEF,eAAO,MAAM,eAAe,8BAA6B,OAMxD,CAAA;AAED,eAAO,MAAM,UAAU,+CAEP,MAAM,oBAAoB,GAAG,MAAM,cACnC,UAAU,YACZ,MAAM,MA8DnB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/utils/variants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAErD,eAAO,MAAM,gBAAgB,UAAW,WAAW,YAAY,MAAM,KAAG,SAAS,MAAM,CAUtF,CAAA"}
|