react-native-unistyles 1.0.0-beta.5 → 1.0.0-beta.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/lib/commonjs/types/breakpoints.js +6 -0
  2. package/lib/commonjs/types/breakpoints.js.map +1 -0
  3. package/lib/commonjs/{types.js → types/core.js} +1 -1
  4. package/lib/commonjs/types/core.js.map +1 -0
  5. package/lib/commonjs/types/index.js +2 -0
  6. package/lib/commonjs/types/index.js.map +1 -0
  7. package/lib/commonjs/types/mediaQueries.js.map +1 -0
  8. package/lib/module/types/breakpoints.js +2 -0
  9. package/lib/module/types/breakpoints.js.map +1 -0
  10. package/lib/module/types/core.js +2 -0
  11. package/lib/module/types/core.js.map +1 -0
  12. package/lib/module/types/index.js +2 -0
  13. package/lib/module/types/index.js.map +1 -0
  14. package/lib/module/types/mediaQueries.js.map +1 -0
  15. package/lib/typescript/src/types/breakpoints.d.ts +19 -0
  16. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -0
  17. package/lib/typescript/src/types/core.d.ts +32 -0
  18. package/lib/typescript/src/types/core.d.ts.map +1 -0
  19. package/lib/typescript/src/types/index.d.ts +3 -0
  20. package/lib/typescript/src/types/index.d.ts.map +1 -0
  21. package/lib/typescript/src/types/mediaQueries.d.ts +2 -0
  22. package/lib/typescript/src/types/mediaQueries.d.ts.map +1 -0
  23. package/package.json +1 -1
  24. package/src/types/breakpoints.ts +33 -0
  25. package/src/types/core.ts +73 -0
  26. package/src/types/index.ts +9 -0
  27. package/src/types/mediaQueries.ts +69 -0
  28. package/lib/commonjs/mediaQueries.js.map +0 -1
  29. package/lib/commonjs/types.js.map +0 -1
  30. package/lib/module/mediaQueries.js.map +0 -1
  31. package/lib/module/types.js +0 -2
  32. package/lib/module/types.js.map +0 -1
  33. package/lib/typescript/src/mediaQueries.d.ts +0 -2
  34. package/lib/typescript/src/mediaQueries.d.ts.map +0 -1
  35. package/lib/typescript/src/types.d.ts +0 -67
  36. package/lib/typescript/src/types.d.ts.map +0 -1
  37. package/src/mediaQueries.ts +0 -33
  38. package/src/types.ts +0 -123
  39. /package/lib/commonjs/{mediaQueries.js → types/mediaQueries.js} +0 -0
  40. /package/lib/module/{mediaQueries.js → types/mediaQueries.js} +0 -0
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=breakpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/breakpoints.ts"],"mappings":""}
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- //# sourceMappingURL=types.js.map
6
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/core.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/mediaQueries.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=breakpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/breakpoints.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/core.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/mediaQueries.ts"],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import type { MediaQueries } from './mediaQueries';
2
+ export type Breakpoints = Record<string, number>;
3
+ export type SortedBreakpointEntries<B extends Breakpoints> = [[keyof B & string, number]];
4
+ export type ScreenSize = {
5
+ width: number;
6
+ height: number;
7
+ };
8
+ export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST;
9
+ type WithEmptyObject<V> = keyof V extends never ? {} : V;
10
+ export type ExtractBreakpoints<T, B extends Breakpoints> = T extends Partial<Record<keyof B & string, infer V>> ? WithEmptyObject<V> : T extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R, B> : {
11
+ [K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R, B> : T[K] extends object ? ExtractBreakpoints<T[K], B> : T[K];
12
+ };
13
+ export type RemoveKeysWithPrefix<T, B extends Breakpoints> = T extends (...args: Array<any>) => infer R ? (...args: Parameters<T>) => RemoveKeysWithPrefix<R, B> : T extends object ? T extends Record<string, infer _V> ? {
14
+ [K in keyof T as K extends MediaQueries ? keyof B & string : K]: RemoveKeysWithPrefix<T[K], B>;
15
+ } : {
16
+ [K in keyof T]: RemoveKeysWithPrefix<T[K], B>;
17
+ } : T;
18
+ export {};
19
+ //# sourceMappingURL=breakpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/types/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAChD,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAEzF,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,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MAAM,CAAC,IAAI,CAAC,SAAS,YAAY,GAAG,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;CAAE,GAClG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;CAAE,GACrD,CAAC,CAAA"}
@@ -0,0 +1,32 @@
1
+ import type { MatrixTransform, PerpectiveTransform, RotateTransform, RotateXTransform, RotateYTransform, RotateZTransform, ScaleTransform, ScaleXTransform, ScaleYTransform, SkewXTransform, SkewYTransform, TranslateXTransform, TranslateYTransform } from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
2
+ import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
3
+ import type { Breakpoints } from './breakpoints';
4
+ import type { MediaQueries } from './mediaQueries';
5
+ type ShadowOffset = {
6
+ width: number;
7
+ height: number;
8
+ };
9
+ type TransformStyles = PerpectiveTransform & RotateTransform & RotateXTransform & RotateYTransform & RotateZTransform & ScaleTransform & ScaleXTransform & ScaleYTransform & TranslateXTransform & TranslateYTransform & SkewXTransform & SkewYTransform & MatrixTransform;
10
+ type UnistyleNested<B> = {
11
+ shadowOffset?: DeepUniStyle<ShadowOffset, B>;
12
+ textShadowOffset?: DeepUniStyle<ShadowOffset, B>;
13
+ transform?: Array<DeepUniStyle<TransformStyles, B>>;
14
+ };
15
+ type UniStyle<V, B> = {
16
+ [innerKey in keyof B]?: V;
17
+ } | {
18
+ [innerKey in MediaQueries]?: V;
19
+ } | V;
20
+ type DeepUniStyle<T, B> = {
21
+ [K in keyof T]?: UniStyle<T[K], B>;
22
+ };
23
+ type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset';
24
+ type UnistyleView<B> = DeepUniStyle<Omit<ViewStyle, NestedTypes>, B>;
25
+ type UnistyleText<B> = DeepUniStyle<Omit<TextStyle, NestedTypes>, B>;
26
+ type UnistyleImage<B> = DeepUniStyle<Omit<ImageStyle, NestedTypes>, B>;
27
+ export type StaticStyles<B extends Breakpoints> = UnistyleView<B> | UnistyleText<B> | UnistyleImage<B> & UnistyleNested<B>;
28
+ export type CustomNamedStyles<T, B extends Breakpoints> = {
29
+ [K in keyof T]: T[K] extends (...args: infer A) => StaticStyles<B> ? (...args: A) => StaticStyles<B> : StaticStyles<B>;
30
+ };
31
+ export {};
32
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +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,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,KAAK,YAAY,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,KAAK,eAAe,GACd,mBAAmB,GACnB,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,eAAe,GACf,mBAAmB,GACnB,mBAAmB,GACnB,cAAc,GACd,cAAc,GACd,eAAe,CAAA;AAErB,KAAK,cAAc,CAAC,CAAC,IAAI;IACrB,YAAY,CAAC,EAAE,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IAC7C,gBAAgB,CAAC,EAAE,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;I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AAI,EAAE,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,GAC/B,YAAY,CAAC,CAAC,CAAC;CACxB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export type { CustomNamedStyles } from './core';
2
+ export type { ScreenSize, Breakpoints, CreateStylesFactory, ExtractBreakpoints, RemoveKeysWithPrefix, SortedBreakpointEntries } from './breakpoints';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC/C,YAAY,EACR,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EAC1B,MAAM,eAAe,CAAA"}
@@ -0,0 +1,2 @@
1
+ export type MediaQueries = `:w[${bigint}]` | `:w[,${bigint}]` | `:w[, ${bigint}]` | `:w[${bigint},${bigint}]` | `:w[${bigint}, ${bigint}]` | `:h[${bigint}]` | `:h[,${bigint}]` | `:h[, ${bigint}]` | `:h[${bigint},${bigint}]` | `:h[${bigint}, ${bigint}]` | `:w[${bigint}]:h[${bigint}]` | `:w[${bigint},${bigint}]:h[${bigint}]` | `:w[${bigint}, ${bigint}]:h[${bigint}]` | `:w[${bigint}]:h[${bigint},${bigint}]` | `:w[${bigint}]:h[${bigint}, ${bigint}]` | `:w[${bigint},${bigint}]:h[${bigint},${bigint}]` | `:w[${bigint}, ${bigint}]:h[${bigint},${bigint}]` | `:w[${bigint},${bigint}]:h[${bigint}, ${bigint}]` | `:w[${bigint}, ${bigint}]:h[${bigint}, ${bigint}]` | `:w[,${bigint}]:h[,${bigint}]` | `:w[, ${bigint}]:h[,${bigint}]` | `:w[,${bigint}]:h[, ${bigint}]` | `:w[, ${bigint}]:h[, ${bigint}]` | `:w[,${bigint}]:h[${bigint}]` | `:w[, ${bigint}]:h[${bigint}]` | `:w[${bigint}]:h[,${bigint}]` | `:w[${bigint}]:h[, ${bigint}]` | `:w[,${bigint}]:h[${bigint},${bigint}]` | `:w[, ${bigint}]:h[${bigint},${bigint}]` | `:w[,${bigint}]:h[${bigint}, ${bigint}]` | `:w[, ${bigint}]:h[${bigint}, ${bigint}]` | `:w[${bigint},${bigint}]:h[,${bigint}]` | `:w[${bigint}, ${bigint}]:h[,${bigint}]` | `:w[${bigint},${bigint}]:h[, ${bigint}]` | `:w[${bigint}, ${bigint}]:h[, ${bigint}]` | `:h[${bigint}]:w[${bigint}]` | `:h[${bigint},${bigint}]:w[${bigint}]` | `:h[${bigint}, ${bigint}]:w[${bigint}]` | `:h[${bigint}]:w[${bigint},${bigint}]` | `:h[${bigint}]:w[${bigint}, ${bigint}]` | `:h[${bigint},${bigint}]:w[${bigint},${bigint}]` | `:h[${bigint}, ${bigint}]:w[${bigint},${bigint}]` | `:h[${bigint},${bigint}]:w[${bigint}, ${bigint}]` | `:h[${bigint}, ${bigint}]:w[${bigint}, ${bigint}]` | `:h[,${bigint}]:w[,${bigint}]` | `:h[, ${bigint}]:w[,${bigint}]` | `:h[,${bigint}]:w[, ${bigint}]` | `:h[, ${bigint}]:w[, ${bigint}]` | `:h[,${bigint}]:w[${bigint}]` | `:h[, ${bigint}]:w[${bigint}]` | `:h[${bigint}]:w[,${bigint}]` | `:h[${bigint}]:w[, ${bigint}]` | `:h[,${bigint}]:w[${bigint},${bigint}]` | `:h[, ${bigint}]:w[${bigint},${bigint}]` | `:h[,${bigint}]:w[${bigint}, ${bigint}]` | `:h[, ${bigint}]:w[${bigint}, ${bigint}]` | `:h[${bigint},${bigint}]:w[,${bigint}]` | `:h[${bigint}, ${bigint}]:w[,${bigint}]` | `:h[${bigint},${bigint}]:w[, ${bigint}]` | `:h[${bigint}, ${bigint}]:w[, ${bigint}]`;
2
+ //# sourceMappingURL=mediaQueries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../../src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AK,MAAM,GAAG,GACzC,MAAM,MAAM,IAAI,MAAM,QAAQ,MAAM,GAAG,GACvC,MAAM,MAAM,KAAK,MAAM,QAAQ,MAAM,GAAG,GACxC,MAAM,MAAM,IAAI,MAAM,SAAS,MAAM,GAAG,GACxC,MAAM,MAAM,KAAK,MAAM,SAAS,MAAM,GAAG,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0-beta.6",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -0,0 +1,33 @@
1
+ import type { MediaQueries } from './mediaQueries'
2
+
3
+ export type Breakpoints = Record<string, number>
4
+ export type SortedBreakpointEntries<B extends Breakpoints> = [[keyof B & string, number]]
5
+
6
+ export type ScreenSize = {
7
+ width: number,
8
+ height: number
9
+ }
10
+
11
+ export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST
12
+
13
+ type WithEmptyObject<V> = keyof V extends never ? {} : V
14
+
15
+ export type ExtractBreakpoints<T, B extends Breakpoints> = T extends Partial<Record<keyof B & string, infer V>>
16
+ ? WithEmptyObject<V>
17
+ : T extends (...args: infer A) => infer R
18
+ ? (...args: A) => ExtractBreakpoints<R, B>
19
+ : {
20
+ [K in keyof T]: T[K] extends (...args: infer A) => infer R
21
+ ? (...args: A) => ExtractBreakpoints<R, B>
22
+ : T[K] extends object
23
+ ? ExtractBreakpoints<T[K], B>
24
+ : T[K]
25
+ }
26
+
27
+ export type RemoveKeysWithPrefix<T, B extends Breakpoints> = T extends (...args: Array<any>) => infer R
28
+ ? (...args: Parameters<T>) => RemoveKeysWithPrefix<R, B>
29
+ : T extends object
30
+ ? T extends Record<string, infer _V>
31
+ ? { [K in keyof T as K extends MediaQueries ? keyof B & string : K]: RemoveKeysWithPrefix<T[K], B> }
32
+ : { [K in keyof T]: RemoveKeysWithPrefix<T[K], B> }
33
+ : T
@@ -0,0 +1,73 @@
1
+ import type {
2
+ MatrixTransform,
3
+ PerpectiveTransform,
4
+ RotateTransform,
5
+ RotateXTransform,
6
+ RotateYTransform,
7
+ RotateZTransform,
8
+ ScaleTransform,
9
+ ScaleXTransform,
10
+ ScaleYTransform,
11
+ SkewXTransform,
12
+ SkewYTransform,
13
+ TranslateXTransform,
14
+ TranslateYTransform
15
+ } from 'react-native/Libraries/StyleSheet/StyleSheetTypes'
16
+ import type { ImageStyle, TextStyle, ViewStyle } from 'react-native'
17
+ import type { Breakpoints } from './breakpoints'
18
+ import type { MediaQueries } from './mediaQueries'
19
+
20
+ type ShadowOffset = {
21
+ width: number,
22
+ height: number
23
+ }
24
+
25
+ type TransformStyles =
26
+ & PerpectiveTransform
27
+ & RotateTransform
28
+ & RotateXTransform
29
+ & RotateYTransform
30
+ & RotateZTransform
31
+ & ScaleTransform
32
+ & ScaleXTransform
33
+ & ScaleYTransform
34
+ & TranslateXTransform
35
+ & TranslateYTransform
36
+ & SkewXTransform
37
+ & SkewYTransform
38
+ & MatrixTransform
39
+
40
+ type UnistyleNested<B> = {
41
+ shadowOffset?: DeepUniStyle<ShadowOffset, B>,
42
+ textShadowOffset?: DeepUniStyle<ShadowOffset, B>,
43
+ transform?: Array<DeepUniStyle<TransformStyles, B>>
44
+ }
45
+
46
+ type UniStyle<V, B> = {
47
+ [innerKey in keyof B]?: V
48
+ } | {
49
+ [innerKey in MediaQueries]?: V
50
+ } | V
51
+
52
+ type DeepUniStyle<T, B> = {
53
+ [K in keyof T]?: UniStyle<T[K], B>
54
+ }
55
+
56
+ // these props are treated differently to nest breakpoints and media queries
57
+ type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset'
58
+
59
+ type UnistyleView<B> = DeepUniStyle<Omit<ViewStyle, NestedTypes>, B>
60
+ type UnistyleText<B> = DeepUniStyle<Omit<TextStyle, NestedTypes>, B>
61
+ type UnistyleImage<B> = DeepUniStyle<Omit<ImageStyle, NestedTypes>, B>
62
+
63
+ export type StaticStyles<B extends Breakpoints> =
64
+ | UnistyleView<B>
65
+ | UnistyleText<B>
66
+ | UnistyleImage<B>
67
+ & UnistyleNested<B>
68
+
69
+ export type CustomNamedStyles<T, B extends Breakpoints> = {
70
+ [K in keyof T]: T[K] extends (...args: infer A) => StaticStyles<B>
71
+ ? (...args: A) => StaticStyles<B>
72
+ : StaticStyles<B>
73
+ }
@@ -0,0 +1,9 @@
1
+ export type { CustomNamedStyles } from './core'
2
+ export type {
3
+ ScreenSize,
4
+ Breakpoints,
5
+ CreateStylesFactory,
6
+ ExtractBreakpoints,
7
+ RemoveKeysWithPrefix,
8
+ SortedBreakpointEntries
9
+ } from './breakpoints'
@@ -0,0 +1,69 @@
1
+ // this is super weird, but number passes empty string and bigint does not
2
+ export type MediaQueries =
3
+ // For :w
4
+ `:w[${bigint}]` |
5
+ `:w[,${bigint}]` |
6
+ `:w[, ${bigint}]` |
7
+ `:w[${bigint},${bigint}]` |
8
+ `:w[${bigint}, ${bigint}]` |
9
+
10
+ // For :h
11
+ `:h[${bigint}]` |
12
+ `:h[,${bigint}]` |
13
+ `:h[, ${bigint}]` |
14
+ `:h[${bigint},${bigint}]` |
15
+ `:h[${bigint}, ${bigint}]` |
16
+
17
+ // Combinations of :w and :h
18
+ `:w[${bigint}]:h[${bigint}]` |
19
+ `:w[${bigint},${bigint}]:h[${bigint}]` |
20
+ `:w[${bigint}, ${bigint}]:h[${bigint}]` |
21
+ `:w[${bigint}]:h[${bigint},${bigint}]` |
22
+ `:w[${bigint}]:h[${bigint}, ${bigint}]` |
23
+ `:w[${bigint},${bigint}]:h[${bigint},${bigint}]` |
24
+ `:w[${bigint}, ${bigint}]:h[${bigint},${bigint}]` |
25
+ `:w[${bigint},${bigint}]:h[${bigint}, ${bigint}]` |
26
+ `:w[${bigint}, ${bigint}]:h[${bigint}, ${bigint}]` |
27
+ `:w[,${bigint}]:h[,${bigint}]` |
28
+ `:w[, ${bigint}]:h[,${bigint}]` |
29
+ `:w[,${bigint}]:h[, ${bigint}]` |
30
+ `:w[, ${bigint}]:h[, ${bigint}]` |
31
+ `:w[,${bigint}]:h[${bigint}]` |
32
+ `:w[, ${bigint}]:h[${bigint}]` |
33
+ `:w[${bigint}]:h[,${bigint}]` |
34
+ `:w[${bigint}]:h[, ${bigint}]` |
35
+ `:w[,${bigint}]:h[${bigint},${bigint}]` |
36
+ `:w[, ${bigint}]:h[${bigint},${bigint}]` |
37
+ `:w[,${bigint}]:h[${bigint}, ${bigint}]` |
38
+ `:w[, ${bigint}]:h[${bigint}, ${bigint}]` |
39
+ `:w[${bigint},${bigint}]:h[,${bigint}]` |
40
+ `:w[${bigint}, ${bigint}]:h[,${bigint}]` |
41
+ `:w[${bigint},${bigint}]:h[, ${bigint}]` |
42
+ `:w[${bigint}, ${bigint}]:h[, ${bigint}]` |
43
+
44
+ // Combinations of :h and :w
45
+ `:h[${bigint}]:w[${bigint}]` |
46
+ `:h[${bigint},${bigint}]:w[${bigint}]` |
47
+ `:h[${bigint}, ${bigint}]:w[${bigint}]` |
48
+ `:h[${bigint}]:w[${bigint},${bigint}]` |
49
+ `:h[${bigint}]:w[${bigint}, ${bigint}]` |
50
+ `:h[${bigint},${bigint}]:w[${bigint},${bigint}]` |
51
+ `:h[${bigint}, ${bigint}]:w[${bigint},${bigint}]` |
52
+ `:h[${bigint},${bigint}]:w[${bigint}, ${bigint}]` |
53
+ `:h[${bigint}, ${bigint}]:w[${bigint}, ${bigint}]` |
54
+ `:h[,${bigint}]:w[,${bigint}]` |
55
+ `:h[, ${bigint}]:w[,${bigint}]` |
56
+ `:h[,${bigint}]:w[, ${bigint}]` |
57
+ `:h[, ${bigint}]:w[, ${bigint}]` |
58
+ `:h[,${bigint}]:w[${bigint}]` |
59
+ `:h[, ${bigint}]:w[${bigint}]` |
60
+ `:h[${bigint}]:w[,${bigint}]` |
61
+ `:h[${bigint}]:w[, ${bigint}]` |
62
+ `:h[,${bigint}]:w[${bigint},${bigint}]` |
63
+ `:h[, ${bigint}]:w[${bigint},${bigint}]` |
64
+ `:h[,${bigint}]:w[${bigint}, ${bigint}]` |
65
+ `:h[, ${bigint}]:w[${bigint}, ${bigint}]` |
66
+ `:h[${bigint},${bigint}]:w[,${bigint}]` |
67
+ `:h[${bigint}, ${bigint}]:w[,${bigint}]` |
68
+ `:h[${bigint},${bigint}]:w[, ${bigint}]` |
69
+ `:h[${bigint}, ${bigint}]:w[, ${bigint}]`
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["mediaQueries.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["mediaQueries.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
- export type MediaQueries = `:w[${bigint}]` | `:w[,${bigint}]` | `:w[${bigint},${bigint}]` | `:h[${bigint}]` | `:h[,${bigint}]` | `:h[${bigint},${bigint}]` | `:w[${bigint}]:h[${bigint}]` | `:w[${bigint},${bigint}]:h[${bigint}]` | `:w[${bigint}]:h[${bigint},${bigint}]` | `:w[${bigint},${bigint}]:h[${bigint},${bigint}]` | `:w[,${bigint}]:h[,${bigint}]` | `:w[,${bigint}]:h[${bigint}]` | `:w[${bigint}]:h[,${bigint}]` | `:w[,${bigint}]:h[${bigint},${bigint}]` | `:w[${bigint},${bigint}]:h[,${bigint}]` | `:h[${bigint}]:w[${bigint}]` | `:h[${bigint},${bigint}]:w[${bigint}]` | `:h[${bigint}]:w[${bigint},${bigint}]` | `:h[${bigint},${bigint}]:w[${bigint},${bigint}]` | `:h[,${bigint}]:w[,${bigint}]` | `:h[,${bigint}]:w[${bigint}]` | `:h[${bigint}]:w[,${bigint}]` | `:h[,${bigint}]:w[${bigint},${bigint}]` | `:h[${bigint},${bigint}]:w[,${bigint}]`;
2
- //# sourceMappingURL=mediaQueries.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../src/mediaQueries.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,YAAY,GAExB,MAAM,MAAM,GAAG,GACf,OAAO,MAAM,GAAG,GAChB,MAAM,MAAM,IAAI,MAAM,GAAG,GAGzB,MAAM,MAAM,GAAG,GACf,OAAO,MAAM,GAAG,GAChB,MAAM,MAAM,IAAI,MAAM,GAAG,GAGzB,MAAM,MAAM,OAAO,MAAM,GAAG,GAC5B,MAAM,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,GACtC,MAAM,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG,GACtC,MAAM,MAAM,IAAI,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG,GAChD,OAAO,MAAM,QAAQ,MAAM,GAAG,GAC9B,OAAO,MAAM,OAAO,MAAM,GAAG,GAC7B,MAAM,MAAM,QAAQ,MAAM,GAAG,GAC7B,OAAO,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG,GACvC,MAAM,MAAM,IAAI,MAAM,QAAQ,MAAM,GAAG,GAGvC,MAAM,MAAM,OAAO,MAAM,GAAG,GAC5B,MAAM,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,GACtC,MAAM,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG,GACtC,MAAM,MAAM,IAAI,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG,GAChD,OAAO,MAAM,QAAQ,MAAM,GAAG,GAC9B,OAAO,MAAM,OAAO,MAAM,GAAG,GAC7B,MAAM,MAAM,QAAQ,MAAM,GAAG,GAC7B,OAAO,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG,GACvC,MAAM,MAAM,IAAI,MAAM,QAAQ,MAAM,GAAG,CAAA"}
@@ -1,67 +0,0 @@
1
- import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
2
- import type { MatrixTransform, PerpectiveTransform, RotateTransform, RotateXTransform, RotateYTransform, RotateZTransform, ScaleTransform, ScaleXTransform, ScaleYTransform, SkewXTransform, SkewYTransform, TranslateXTransform, TranslateYTransform } from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
3
- import type { MediaQueries } from './mediaQueries';
4
- export type Breakpoints = Record<string, number>;
5
- export type SortedBreakpointEntries<B extends Breakpoints> = [[keyof B & string, number]];
6
- export type ScreenSize = {
7
- width: number;
8
- height: number;
9
- };
10
- export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST;
11
- type StyleProperty<T, B extends Breakpoints> = {
12
- [K in keyof T]: {
13
- [innerKey in keyof B]?: T[K];
14
- } | {
15
- [innerKey in MediaQueries]?: T[K];
16
- } | T[K];
17
- };
18
- type ShadowOffsetProps<B> = {
19
- shadowOffset: {
20
- width: number | {
21
- [innerKey in keyof B]?: number;
22
- } | {
23
- [innerKey in MediaQueries]: number;
24
- };
25
- height: number | {
26
- [innerKey in keyof B]?: number;
27
- } | {
28
- [innerKey in MediaQueries]: number;
29
- };
30
- };
31
- };
32
- type TextShadowOffsetProps<B> = {
33
- textShadowOffset: {
34
- width: number | {
35
- [innerKey in keyof B]?: number;
36
- } | {
37
- [innerKey in MediaQueries]: number;
38
- };
39
- height: number | {
40
- [innerKey in keyof B]?: number;
41
- } | {
42
- [innerKey in MediaQueries]: number;
43
- };
44
- };
45
- };
46
- type TransformStyles<B extends Breakpoints> = PerpectiveTransform | StyleProperty<PerpectiveTransform, B> | RotateTransform | StyleProperty<RotateTransform, B> | RotateXTransform | StyleProperty<RotateXTransform, B> | RotateYTransform | StyleProperty<RotateYTransform, B> | RotateZTransform | StyleProperty<RotateZTransform, B> | ScaleTransform | StyleProperty<ScaleTransform, B> | ScaleXTransform | StyleProperty<ScaleXTransform, B> | ScaleYTransform | StyleProperty<ScaleYTransform, B> | TranslateXTransform | StyleProperty<TranslateXTransform, B> | TranslateYTransform | StyleProperty<TranslateYTransform, B> | SkewXTransform | StyleProperty<SkewXTransform, B> | SkewYTransform | StyleProperty<SkewYTransform, B> | MatrixTransform | StyleProperty<MatrixTransform, B>;
47
- type TransformProps<B extends Breakpoints> = {
48
- transform: Array<TransformStyles<B>>;
49
- };
50
- type UnistyleView = Omit<Omit<Omit<ViewStyle, 'shadowOffset'>, 'transform'>, 'textShadowOffset'>;
51
- type UnistyleText = Omit<Omit<Omit<TextStyle, 'shadowOffset'>, 'transform'>, 'textShadowOffset'>;
52
- type UnistyleImage = Omit<Omit<Omit<ImageStyle, 'shadowOffset'>, 'transform'>, 'textShadowOffset'>;
53
- export type StaticStyles<B extends Breakpoints> = (UnistyleView | StyleProperty<UnistyleView, B>) | (UnistyleText | StyleProperty<UnistyleText, B>) | (UnistyleImage | StyleProperty<UnistyleImage, B>) & TransformProps<B> & ShadowOffsetProps<B> & TextShadowOffsetProps<B>;
54
- export type CustomNamedStyles<T, B extends Breakpoints> = {
55
- [K in keyof T]: T[K] extends (...args: infer A) => unknown ? (...args: A) => StaticStyles<B> : StaticStyles<B>;
56
- };
57
- type WithEmptyObject<V> = keyof V extends never ? {} : V;
58
- export type ExtractBreakpoints<T, B extends Breakpoints> = T extends Partial<Record<keyof B & string, infer V>> ? WithEmptyObject<V> : T extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R, B> : {
59
- [K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R, B> : T[K] extends object ? ExtractBreakpoints<T[K], B> : T[K];
60
- };
61
- export type RemoveKeysWithPrefix<T, B extends Breakpoints> = T extends (...args: Array<any>) => infer R ? (...args: Parameters<T>) => RemoveKeysWithPrefix<R, B> : T extends object ? T extends Record<string, infer _V> ? {
62
- [K in keyof T as K extends MediaQueries ? keyof B & string : K]: RemoveKeysWithPrefix<T[K], B>;
63
- } : {
64
- [K in keyof T]: RemoveKeysWithPrefix<T[K], B>;
65
- } : T;
66
- export {};
67
- //# sourceMappingUR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AG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,YAAY,GAAG,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;CAAE,GAClG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;CAAE,GACrD,CAAC,CAAA"}
@@ -1,33 +0,0 @@
1
- // this is super weird, but number passes empty string and bigint does not
2
- export type MediaQueries =
3
- // For :w
4
- `:w[${bigint}]` |
5
- `:w[,${bigint}]` |
6
- `:w[${bigint},${bigint}]` |
7
-
8
- // For :h
9
- `:h[${bigint}]` |
10
- `:h[,${bigint}]` |
11
- `:h[${bigint},${bigint}]` |
12
-
13
- // Combinations of :w and :h
14
- `:w[${bigint}]:h[${bigint}]` |
15
- `:w[${bigint},${bigint}]:h[${bigint}]` |
16
- `:w[${bigint}]:h[${bigint},${bigint}]` |
17
- `:w[${bigint},${bigint}]:h[${bigint},${bigint}]` |
18
- `:w[,${bigint}]:h[,${bigint}]` |
19
- `:w[,${bigint}]:h[${bigint}]` |
20
- `:w[${bigint}]:h[,${bigint}]` |
21
- `:w[,${bigint}]:h[${bigint},${bigint}]` |
22
- `:w[${bigint},${bigint}]:h[,${bigint}]` |
23
-
24
- // Combinations of :h and :w
25
- `:h[${bigint}]:w[${bigint}]` |
26
- `:h[${bigint},${bigint}]:w[${bigint}]` |
27
- `:h[${bigint}]:w[${bigint},${bigint}]` |
28
- `:h[${bigint},${bigint}]:w[${bigint},${bigint}]` |
29
- `:h[,${bigint}]:w[,${bigint}]` |
30
- `:h[,${bigint}]:w[${bigint}]` |
31
- `:h[${bigint}]:w[,${bigint}]` |
32
- `:h[,${bigint}]:w[${bigint},${bigint}]` |
33
- `:h[${bigint},${bigint}]:w[,${bigint}]`
package/src/types.ts DELETED
@@ -1,123 +0,0 @@
1
- import type { ImageStyle, TextStyle, ViewStyle } from 'react-native'
2
- import type {
3
- MatrixTransform,
4
- PerpectiveTransform,
5
- RotateTransform,
6
- RotateXTransform,
7
- RotateYTransform,
8
- RotateZTransform,
9
- ScaleTransform,
10
- ScaleXTransform,
11
- ScaleYTransform,
12
- SkewXTransform,
13
- SkewYTransform,
14
- TranslateXTransform,
15
- TranslateYTransform
16
- } from 'react-native/Libraries/StyleSheet/StyleSheetTypes'
17
- import type { MediaQueries } from './mediaQueries'
18
-
19
- export type Breakpoints = Record<string, number>
20
-
21
- export type SortedBreakpointEntries<B extends Breakpoints> = [[keyof B & string, number]]
22
-
23
- export type ScreenSize = {
24
- width: number,
25
- height: number
26
- }
27
-
28
- export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST
29
-
30
- type StyleProperty<T, B extends Breakpoints> = {
31
- [K in keyof T]: {
32
- [innerKey in keyof B]?: T[K]
33
- } | {
34
- [innerKey in MediaQueries]?: T[K]
35
- } | T[K]
36
- }
37
-
38
- type ShadowOffsetProps<B> = {
39
- shadowOffset: {
40
- width: number | {
41
- [innerKey in keyof B]?: number
42
- } | {
43
- [innerKey in MediaQueries]: number
44
- },
45
- height: number | {
46
- [innerKey in keyof B]?: number
47
- } | {
48
- [innerKey in MediaQueries]: number
49
- }
50
- }
51
- }
52
-
53
- type TextShadowOffsetProps<B> = {
54
- textShadowOffset: {
55
- width: number | {
56
- [innerKey in keyof B]?: number
57
- } | {
58
- [innerKey in MediaQueries]: number
59
- },
60
- height: number | {
61
- [innerKey in keyof B]?: number
62
- } | {
63
- [innerKey in MediaQueries]: number
64
- }
65
- }
66
- }
67
-
68
- type TransformStyles<B extends Breakpoints> =
69
- PerpectiveTransform | StyleProperty<PerpectiveTransform, B>
70
- | RotateTransform | StyleProperty<RotateTransform, B>
71
- | RotateXTransform | StyleProperty<RotateXTransform, B>
72
- | RotateYTransform | StyleProperty<RotateYTransform, B>
73
- | RotateZTransform | StyleProperty<RotateZTransform, B>
74
- | ScaleTransform | StyleProperty<ScaleTransform, B>
75
- | ScaleXTransform | StyleProperty<ScaleXTransform, B>
76
- | ScaleYTransform | StyleProperty<ScaleYTransform, B>
77
- | TranslateXTransform | StyleProperty<TranslateXTransform, B>
78
- | TranslateYTransform | StyleProperty<TranslateYTransform, B>
79
- | SkewXTransform | StyleProperty<SkewXTransform, B>
80
- | SkewYTransform | StyleProperty<SkewYTransform, B>
81
- | MatrixTransform | StyleProperty<MatrixTransform, B>
82
-
83
- type TransformProps<B extends Breakpoints> = {
84
- transform: Array<TransformStyles<B>>
85
- }
86
-
87
- type UnistyleView = Omit<Omit<Omit<ViewStyle, 'shadowOffset'>, 'transform'>, 'textShadowOffset'>
88
- type UnistyleText = Omit<Omit<Omit<TextStyle, 'shadowOffset'>, 'transform'>, 'textShadowOffset'>
89
- type UnistyleImage = Omit<Omit<Omit<ImageStyle, 'shadowOffset'>, 'transform'>, 'textShadowOffset'>
90
-
91
- export type StaticStyles<B extends Breakpoints> =
92
- | (UnistyleView | StyleProperty<UnistyleView, B>)
93
- | (UnistyleText | StyleProperty<UnistyleText, B>)
94
- | (UnistyleImage | StyleProperty<UnistyleImage, B>)
95
- & TransformProps<B> & ShadowOffsetProps<B> & TextShadowOffsetProps<B>
96
-
97
- export type CustomNamedStyles<T, B extends Breakpoints> = {
98
- [K in keyof T]: T[K] extends (...args: infer A) => unknown
99
- ? (...args: A) => StaticStyles<B>
100
- : StaticStyles<B>
101
- }
102
-
103
- type WithEmptyObject<V> = keyof V extends never ? {} : V
104
-
105
- export type ExtractBreakpoints<T, B extends Breakpoints> = T extends Partial<Record<keyof B & string, infer V>>
106
- ? WithEmptyObject<V>
107
- : T extends (...args: infer A) => infer R
108
- ? (...args: A) => ExtractBreakpoints<R, B>
109
- : {
110
- [K in keyof T]: T[K] extends (...args: infer A) => infer R
111
- ? (...args: A) => ExtractBreakpoints<R, B>
112
- : T[K] extends object
113
- ? ExtractBreakpoints<T[K], B>
114
- : T[K]
115
- }
116
-
117
- export type RemoveKeysWithPrefix<T, B extends Breakpoints> = T extends (...args: Array<any>) => infer R
118
- ? (...args: Parameters<T>) => RemoveKeysWithPrefix<R, B>
119
- : T extends object
120
- ? T extends Record<string, infer _V>
121
- ? { [K in keyof T as K extends MediaQueries ? keyof B & string : K]: RemoveKeysWithPrefix<T[K], B> }
122
- : { [K in keyof T]: RemoveKeysWithPrefix<T[K], B> }
123
- : T