react-native-unistyles 2.0.0-alpha.14 → 2.0.0-alpha.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. package/cxx/UnistylesRuntime.h +6 -6
  2. package/lib/commonjs/common.js +15 -15
  3. package/lib/commonjs/common.js.map +1 -1
  4. package/lib/commonjs/core/UnistylesRuntime.js +1 -1
  5. package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
  6. package/lib/commonjs/createStyleSheet.js +1 -6
  7. package/lib/commonjs/createStyleSheet.js.map +1 -1
  8. package/lib/commonjs/hooks/index.js +7 -0
  9. package/lib/commonjs/hooks/index.js.map +1 -1
  10. package/lib/commonjs/hooks/useUnistyles.js +4 -7
  11. package/lib/commonjs/hooks/useUnistyles.js.map +1 -1
  12. package/lib/commonjs/hooks/useVariants.js +24 -0
  13. package/lib/commonjs/hooks/useVariants.js.map +1 -0
  14. package/lib/commonjs/plugins/normalizer/normalizer.js +1 -1
  15. package/lib/commonjs/plugins/normalizer/normalizer.js.map +1 -1
  16. package/lib/commonjs/types/stylesheet.js +6 -0
  17. package/lib/commonjs/types/stylesheet.js.map +1 -0
  18. package/lib/commonjs/useStyles.js +5 -4
  19. package/lib/commonjs/useStyles.js.map +1 -1
  20. package/lib/commonjs/utils/index.js +24 -0
  21. package/lib/commonjs/utils/index.js.map +1 -1
  22. package/lib/commonjs/utils/mq.js +42 -28
  23. package/lib/commonjs/utils/mq.js.map +1 -1
  24. package/lib/commonjs/utils/styles.js +14 -8
  25. package/lib/commonjs/utils/styles.js.map +1 -1
  26. package/lib/commonjs/utils/variants.js +33 -13
  27. package/lib/commonjs/utils/variants.js.map +1 -1
  28. package/lib/module/common.js +14 -14
  29. package/lib/module/common.js.map +1 -1
  30. package/lib/module/core/UnistylesRuntime.js +1 -1
  31. package/lib/module/core/UnistylesRuntime.js.map +1 -1
  32. package/lib/module/createStyleSheet.js +1 -6
  33. package/lib/module/createStyleSheet.js.map +1 -1
  34. package/lib/module/hooks/index.js +1 -0
  35. package/lib/module/hooks/index.js.map +1 -1
  36. package/lib/module/hooks/useUnistyles.js +5 -8
  37. package/lib/module/hooks/useUnistyles.js.map +1 -1
  38. package/lib/module/hooks/useVariants.js +17 -0
  39. package/lib/module/hooks/useVariants.js.map +1 -0
  40. package/lib/module/plugins/normalizer/normalizer.js +1 -1
  41. package/lib/module/plugins/normalizer/normalizer.js.map +1 -1
  42. package/lib/module/types/stylesheet.js +2 -0
  43. package/lib/module/types/stylesheet.js.map +1 -0
  44. package/lib/module/useStyles.js +6 -5
  45. package/lib/module/useStyles.js.map +1 -1
  46. package/lib/module/utils/index.js +1 -1
  47. package/lib/module/utils/index.js.map +1 -1
  48. package/lib/module/utils/mq.js +41 -27
  49. package/lib/module/utils/mq.js.map +1 -1
  50. package/lib/module/utils/styles.js +15 -9
  51. package/lib/module/utils/styles.js.map +1 -1
  52. package/lib/module/utils/variants.js +31 -11
  53. package/lib/module/utils/variants.js.map +1 -1
  54. package/lib/typescript/src/common.d.ts +10 -10
  55. package/lib/typescript/src/common.d.ts.map +1 -1
  56. package/lib/typescript/src/createStyleSheet.d.ts +2 -2
  57. package/lib/typescript/src/createStyleSheet.d.ts.map +1 -1
  58. package/lib/typescript/src/global.d.ts.map +1 -1
  59. package/lib/typescript/src/hooks/index.d.ts +1 -0
  60. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  61. package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -1
  62. package/lib/typescript/src/hooks/useVariants.d.ts +3 -0
  63. package/lib/typescript/src/hooks/useVariants.d.ts.map +1 -0
  64. package/lib/typescript/src/plugins/normalizer/normalizer.d.ts.map +1 -1
  65. package/lib/typescript/src/types/breakpoints.d.ts +20 -14
  66. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  67. package/lib/typescript/src/types/core.d.ts +3 -26
  68. package/lib/typescript/src/types/core.d.ts.map +1 -1
  69. package/lib/typescript/src/types/index.d.ts +2 -1
  70. package/lib/typescript/src/types/index.d.ts.map +1 -1
  71. package/lib/typescript/src/types/mq.d.ts +2 -2
  72. package/lib/typescript/src/types/mq.d.ts.map +1 -1
  73. package/lib/typescript/src/types/stylesheet.d.ts +47 -0
  74. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -0
  75. package/lib/typescript/src/types/unistyles.d.ts +5 -6
  76. package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
  77. package/lib/typescript/src/types/variants.d.ts +13 -7
  78. package/lib/typescript/src/types/variants.d.ts.map +1 -1
  79. package/lib/typescript/src/useStyles.d.ts +3 -3
  80. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  81. package/lib/typescript/src/utils/index.d.ts +1 -1
  82. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  83. package/lib/typescript/src/utils/mq.d.ts +19 -13
  84. package/lib/typescript/src/utils/mq.d.ts.map +1 -1
  85. package/lib/typescript/src/utils/styles.d.ts +3 -3
  86. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  87. package/lib/typescript/src/utils/variants.d.ts +2 -2
  88. package/lib/typescript/src/utils/variants.d.ts.map +1 -1
  89. package/package.json +14 -14
  90. package/src/common.ts +10 -10
  91. package/src/core/UnistylesRuntime.ts +1 -1
  92. package/src/createStyleSheet.ts +2 -8
  93. package/src/global.ts +1 -0
  94. package/src/hooks/index.ts +1 -0
  95. package/src/hooks/useUnistyles.ts +5 -8
  96. package/src/hooks/useVariants.ts +23 -0
  97. package/src/plugins/normalizer/normalizer.ts +3 -3
  98. package/src/types/breakpoints.ts +47 -26
  99. package/src/types/core.ts +6 -42
  100. package/src/types/index.ts +1 -1
  101. package/src/types/mq.ts +2 -2
  102. package/src/types/stylesheet.ts +56 -0
  103. package/src/types/unistyles.ts +5 -6
  104. package/src/types/variants.ts +17 -9
  105. package/src/useStyles.ts +15 -15
  106. package/src/utils/index.ts +1 -1
  107. package/src/utils/mq.ts +56 -41
  108. package/src/utils/styles.ts +18 -17
  109. package/src/utils/variants.ts +41 -17
@@ -1 +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
+ {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;IAEjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -1,3 +1,4 @@
1
1
  export { useInitialTheme } from './useInitialTheme';
2
2
  export { useUnistyles } from './useUnistyles';
3
+ export { useVariants } from './useVariants';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
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;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;;CAmDxB,CAAA"}
1
+ {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;;CAgDxB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Optional } from '../types';
2
+ export declare const useVariants: (variantsMap?: Record<string, Optional<string>>) => Optional<Record<string, Optional<string>>>;
3
+ //# sourceMappingURL=useVariants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVariants.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useVariants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAaxC,eAAO,MAAM,WAAW,iBAAkB,OAAO,MAAM,EAAE,SAAS,MAAM,CAAC,CAAC,+CAQzE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/normalizer/normalizer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEpE,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
+ {"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/normalizer/normalizer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAY,MAAM,aAAa,CAAA;AAE9E,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,18 +1,24 @@
1
- import type { OpaqueColorValue } from 'react-native';
2
- import type { UnistylesBreakpoints } from '../global';
3
- import type { MediaQuery } from './mq';
1
+ import type { ColorValue, OpaqueColorValue } from 'react-native';
2
+ import type { UnistylesTheme } from '../types';
3
+ import type { AllAvailableKeys, BreakpointsOrMediaQueries } from './stylesheet';
4
4
  type WithEmptyObject<V> = keyof V extends never ? {} : V;
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];
5
+ type ExtractBreakpoints<T> = T extends Partial<Record<BreakpointsOrMediaQueries, infer R>> ? WithEmptyObject<R> : {
6
+ [K in keyof T]: T[K] extends object ? T[K] extends OpaqueColorValue ? ColorValue : ExtractBreakpoints<T[K]> : T[K];
7
7
  };
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]>;
13
- } : {
14
- [K in keyof T]: RemoveKeysWithPrefix<T[K]>;
15
- } : T;
16
- export type ReactNativeStyleSheet<T> = ExtractBreakpoints<RemoveKeysWithPrefix<T>>;
8
+ type ParseNestedObject<T> = T extends (...args: infer A) => infer R ? (...args: A) => ParseNestedObject<R> : keyof T extends AllAvailableKeys ? ExtractBreakpoints<T> : T extends {
9
+ variants: infer R;
10
+ } ? ParseVariants<FlattenVariants<R>> & ParseNestedObject<Omit<T, 'variants'>> : {
11
+ [K in keyof T]: T[K] extends object ? T[K] extends OpaqueColorValue ? ColorValue : ExtractBreakpoints<T[K]> : T[K];
12
+ };
13
+ type FlattenVariants<T> = T extends object ? {
14
+ [K in keyof T]: T[K] extends object ? {
15
+ [key in keyof T[K]]: T[K][key] extends object ? ParseNestedObject<T[K][key]> : never;
16
+ } : never;
17
+ } : never;
18
+ type ParseVariants<T> = T extends object ? T[keyof T] extends object ? ParseVariants<T[keyof T]> : T : T;
19
+ type ParseStyleKeys<T> = T extends object ? {
20
+ [K in keyof T]: ParseNestedObject<T[K]>;
21
+ } : never;
22
+ export type ReactNativeStyleSheet<T> = T extends (theme: UnistylesTheme) => infer R ? ParseStyleKeys<R> : ParseStyleKeys<T>;
17
23
  export {};
18
24
  //# 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,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAEtC,KAAK,eAAe,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,KAAK,GAAG,EAAE,GAAG,CAAC,CAAA;AAExD,KAAK,kBAAkB,CAAC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AAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC3C,KAAK,CAAA;AAEX,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,KAAK,MAAM,CAAC,GAC7E,cAAc,CAAC,CAAC,CAAC,GACjB,cAAc,CAAC,CAAC,CAAC,CAAA"}
@@ -2,42 +2,19 @@ import type { MatrixTransform, PerpectiveTransform, RotateTransform, RotateXTran
2
2
  import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
3
3
  import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
4
4
  import type { MediaQuery } from './mq';
5
- type ShadowOffset = {
5
+ export type ShadowOffset = {
6
6
  width: number;
7
7
  height: number;
8
8
  };
9
+ export type TransformStyles = PerpectiveTransform & RotateTransform & RotateXTransform & RotateYTransform & RotateZTransform & ScaleTransform & ScaleXTransform & ScaleYTransform & TranslateXTransform & TranslateYTransform & SkewXTransform & SkewYTransform & MatrixTransform;
9
10
  export type ScreenSize = {
10
11
  width: number;
11
12
  height: number;
12
13
  };
13
- type TransformStyles = PerpectiveTransform & RotateTransform & RotateXTransform & RotateYTransform & RotateZTransform & ScaleTransform & ScaleXTransform & ScaleYTransform & TranslateXTransform & TranslateYTransform & SkewXTransform & SkewYTransform & MatrixTransform;
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'>>;
19
- };
20
- type UniStyle<V> = {
21
- [innerKey in keyof UnistylesBreakpoints]?: V;
22
- } | {
23
- [innerKey in MediaQuery]: V;
24
- };
25
- type DeepUniStyle<T> = {
26
- [K in keyof T]?: UniStyle<T[K]> | T[K];
27
- };
28
- type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset';
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;
35
- };
36
14
  export type RNStyle = ViewStyle | TextStyle | ImageStyle;
37
15
  export type RNValue = number | string | undefined;
38
16
  export type NestedStyle = Record<keyof UnistylesBreakpoints | MediaQuery, RNValue>;
39
17
  export type NestedStylePairs = Array<[keyof UnistylesBreakpoints | MediaQuery, RNValue]>;
40
18
  export type UnistylesTheme = UnistylesThemes[keyof UnistylesThemes];
41
- export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST;
42
- export {};
19
+ export type CreateStylesFactory<ST> = (theme: UnistylesTheme) => ST;
43
20
  //# 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,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAEtC,KAAK,YAAY,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,C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AO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAEtC,MAAM,MAAM,YAAY,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,eAAe,GACrB,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,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAA;AACxD,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AACjD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,EAAE,OAAO,CAAC,CAAA;AAClF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,CAAC,MAAM,oBAAoB,GAAG,UAAU,EAAE,OAAO,CAAC,CAAC,CAAA;AACxF,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,eAAe,CAAC,CAAA;AACnE,MAAM,MAAM,mBAAmB,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,cAAc,KAAK,EAAE,CAAA"}
@@ -2,7 +2,8 @@ export * from './normalizer';
2
2
  export * from './unistyles';
3
3
  export type { Optional, Nullable } from './common';
4
4
  export type { MediaQuery } from './mq';
5
- export type { CustomNamedStyles, NestedStylePairs, UnistylesTheme, CreateStylesFactory, ScreenSize, NestedStyle, RNValue, RNStyle } from './core';
5
+ export type { NestedStylePairs, UnistylesTheme, CreateStylesFactory, ScreenSize, NestedStyle, RNValue, RNStyle } from './core';
6
+ export type { StyleSheetWithSuperPowers, StyleSheet } from './stylesheet';
6
7
  export type { ReactNativeStyleSheet } from './breakpoints';
7
8
  export type { ExtractVariantNames } from './variants';
8
9
  export type { UnistylesPlugin } from './plugin';
@@ -1 +1 @@
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,EACR,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,OAAO,EACP,OAAO,EACV,MAAM,QAAQ,CAAA;AACf,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA"}
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,EACR,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,OAAO,EACP,OAAO,EACV,MAAM,QAAQ,CAAA;AACf,YAAY,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzE,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA"}
@@ -1,3 +1,3 @@
1
- import { MQSymbol } from '../utils';
2
- export type MediaQuery = typeof MQSymbol;
1
+ import { MQSymbol, MQHeight, MQHeightAndWidth, MQWidth, MQWidthAndHeight } from '../utils';
2
+ export type MediaQuery = typeof MQSymbol | typeof MQHeight | typeof MQWidth | typeof MQHeightAndWidth | typeof MQWidthAndHeight;
3
3
  //# sourceMappingURL=mq.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"mq.d.ts","sourceRoot":"","sources":["../../../../src/types/mq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE1F,MAAM,MAAM,UAAU,GAAG,OAAO,QAAQ,GAAG,OAAO,QAAQ,GAAG,OAAO,OAAO,GAAG,OAAO,gBAAgB,GAAG,OAAO,gBAAgB,CAAA"}
@@ -0,0 +1,47 @@
1
+ import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
2
+ import type { ShadowOffset, TransformStyles, UnistylesTheme } from './core';
3
+ import type { UnistylesBreakpoints } from '../global';
4
+ import type { MediaQuery } from './mq';
5
+ type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset';
6
+ type UnistyleView = Omit<ViewStyle, NestedTypes>;
7
+ type UnistyleText = Omit<TextStyle, NestedTypes>;
8
+ type UnistyleImage = Omit<ImageStyle, NestedTypes>;
9
+ type UnistyleNestedStyles = {
10
+ shadowOffset?: ToDeepUnistyles<ShadowOffset>;
11
+ textShadowOffset?: ToDeepUnistyles<ShadowOffset>;
12
+ transform?: Array<ToDeepUnistyles<TransformStyles>>;
13
+ };
14
+ type Variants = {
15
+ variants?: {
16
+ [variantName: string]: {
17
+ [variant: string]: {
18
+ [propName in AllAvailableKeys]?: AllAvailableStyles[propName] | {
19
+ [key in BreakpointsOrMediaQueries]?: AllAvailableStyles[propName];
20
+ } & {
21
+ [propName in NestedTypes]?: UnistyleNestedStyles[propName];
22
+ };
23
+ };
24
+ };
25
+ };
26
+ };
27
+ type ToDeepUnistyles<T> = {
28
+ [K in keyof T]?: T[K] | {
29
+ [key in BreakpointsOrMediaQueries]?: T[K];
30
+ };
31
+ };
32
+ type AllAvailableStyles = UnistyleView & UnistyleText & UnistyleImage & UnistyleNestedStyles;
33
+ export type AllAvailableKeys = keyof (UnistyleView & UnistyleText & UnistyleImage);
34
+ export type BreakpointsOrMediaQueries = keyof UnistylesBreakpoints | MediaQuery;
35
+ export type UnistylesValues = {
36
+ [propName in AllAvailableKeys]?: AllAvailableStyles[propName] | {
37
+ [key in BreakpointsOrMediaQueries]?: AllAvailableStyles[propName];
38
+ };
39
+ } & Variants & {
40
+ [propName in NestedTypes]?: UnistyleNestedStyles[propName];
41
+ };
42
+ export type StyleSheet = {
43
+ [styleName: string]: UnistylesValues | ((...args: any) => UnistylesValues);
44
+ };
45
+ export type StyleSheetWithSuperPowers = ((theme: UnistylesTheme) => StyleSheet) | StyleSheet;
46
+ export {};
47
+ //# sourceMappingURL=stylesheet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../../../src/types/stylesheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM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AAY,GAAG,YAAY,GAAG,aAAa,CAAC,CAAA;AAClF,MAAM,MAAM,yBAAyB,GAAG,MAAM,oBAAoB,GAAG,UAAU,CAAA;AAE/E,MAAM,MAAM,eAAe,GAAG;KACzB,QAAQ,IAAI,gBAAgB,CAAC,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG;SAC3D,GAAG,IAAI,yBAAyB,CAAC,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC;KACpE;CACJ,GAAG,QAAQ,GAAG;KACV,QAAQ,IAAI,WAAW,CAAC,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC;CAC7D,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACrB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,eAAe,CAAC,CAAA;CAC7E,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,EAAE,cAAc,KAAK,UAAU,CAAC,GAAG,UAAU,CAAA"}
@@ -1,9 +1,8 @@
1
- import { CxxUnistylesEventTypes, ScreenOrientation } from '../common';
1
+ import { UnistylesEventType, ScreenOrientation } from '../common';
2
2
  import type { UnistylesThemes, UnistylesBreakpoints } from '../global';
3
3
  import type { ScreenSize } from './core';
4
- import type { Optional } from './common';
5
4
  import type { UnistylesPlugin } from './plugin';
6
- export type ColorSchemeName = Optional<'light' | 'dark'>;
5
+ export type ColorSchemeName = 'light' | 'dark' | 'unspecified';
7
6
  export type UnistylesConfig = {
8
7
  adaptiveThemes?: boolean;
9
8
  experimentalPlugins?: Array<UnistylesPlugin>;
@@ -26,13 +25,13 @@ export type UnistylesBridge = {
26
25
  removePlugin(pluginName: string): void;
27
26
  };
28
27
  export type UnistylesThemeEvent = {
29
- type: CxxUnistylesEventTypes.Theme;
28
+ type: UnistylesEventType.Theme;
30
29
  payload: {
31
30
  themeName: keyof UnistylesThemes;
32
31
  };
33
32
  };
34
33
  export type UnistylesMobileLayoutEvent = {
35
- type: CxxUnistylesEventTypes.Layout;
34
+ type: UnistylesEventType.Layout;
36
35
  payload: {
37
36
  screen: ScreenSize;
38
37
  breakpoint: keyof UnistylesBreakpoints;
@@ -40,7 +39,7 @@ export type UnistylesMobileLayoutEvent = {
40
39
  };
41
40
  };
42
41
  export type UnistylesPluginEvent = {
43
- type: CxxUnistylesEventTypes.Plugin;
42
+ type: UnistylesEventType.Plugin;
44
43
  };
45
44
  export type UnistylesEvents = UnistylesThemeEvent | UnistylesMobileLayoutEvent | UnistylesPluginEvent;
46
45
  //# sourceMappingURL=unistyles.d.ts.map
@@ -1 +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;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,CAAA;AAExD,MAAM,MAAM,eAAe,GAAG;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,eAAe,CAAA;CACvC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAE1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,MAAM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AA;CACzC,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,EAAE,kBAAkB,CAAC,KAAK,CAAC;IAC/B,OAAO,EAAE;QACL,SAAS,EAAE,MAAM,eAAe,CAAA;KACnC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC;IAChC,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC;QACnB,UAAU,EAAE,MAAM,oBAAoB,CAAC;QACvC,WAAW,EAAE,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAA;KACxE,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IAC/B,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,0BAA0B,GAAG,oBAAoB,CAAA"}
@@ -1,8 +1,14 @@
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;
1
+ export type ExtractVariantNames<T> = T extends (...args: any) => infer R ? ExtractVariantKeys<R> : ExtractVariantKeys<T>;
2
+ type ExtractVariantKeys<T> = T extends object ? ExtractVariant<T[keyof T]> : never;
3
+ type ExtractSubVariantKeys<T> = T extends object ? keyof Omit<T, 'default'> | undefined : never;
4
+ type ExtractVariant<T> = T extends (...args: any) => infer R ? R extends {
5
+ variants: infer V;
6
+ } ? {
7
+ [key in keyof V]?: ExtractSubVariantKeys<V[key]>;
8
+ } : never : T extends {
9
+ variants: infer V;
10
+ } ? {
11
+ [key in keyof V]?: ExtractSubVariantKeys<V[key]>;
12
+ } : never;
13
+ export {};
8
14
  //# sourceMappingURL=variants.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/types/variants.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC,GAClE,kBAAkB,CAAC,CAAC,CAAC,GACrB,kBAAkB,CAAC,CAAC,CAAC,CAAA;AAE3B,KAAK,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACvC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAC1B,KAAK,CAAA;AAEX,KAAK,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC1C,MAAM,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,SAAS,GACpC,KAAK,CAAA;AAEX,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC,GACtD,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;CAAE,GAC3B;KAAG,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAAE,GACpD,KAAK,GACT,CAAC,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;CAAE,GAC3B;KAAG,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAAE,GACpD,KAAK,CAAA"}
@@ -1,10 +1,10 @@
1
- import type { CreateStylesFactory, CustomNamedStyles, ExtractVariantNames, ReactNativeStyleSheet, UnistylesTheme } from './types';
2
1
  import type { UnistylesBreakpoints } from './global';
3
- type ParsedStylesheet<ST extends CustomNamedStyles<ST>> = {
2
+ import type { ExtractVariantNames, ReactNativeStyleSheet, StyleSheetWithSuperPowers, UnistylesTheme } from './types';
3
+ type ParsedStylesheet<ST extends StyleSheetWithSuperPowers> = {
4
4
  theme: UnistylesTheme;
5
5
  breakpoint: keyof UnistylesBreakpoints;
6
6
  styles: ReactNativeStyleSheet<ST>;
7
7
  };
8
- export declare const useStyles: <ST extends CustomNamedStyles<ST>>(stylesheet?: ST | CreateStylesFactory<ST, never> | undefined, variant?: (ExtractVariantNames<ST> & string) | undefined) => ParsedStylesheet<ST>;
8
+ export declare const useStyles: <ST extends StyleSheetWithSuperPowers>(stylesheet?: ST | undefined, variantsMap?: ExtractVariantNames<ST> | undefined) => ParsedStylesheet<ST>;
9
9
  export {};
10
10
  //# sourceMappingURL=useStyles.d.ts.map
@@ -1 +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;AAGpD,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,oLA+CrB,CAAA"}
1
+ {"version":3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../src/useStyles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,KAAK,EACR,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,cAAc,EACjB,MAAM,SAAS,CAAA;AAEhB,KAAK,gBAAgB,CAAC,EAAE,SAAS,yBAAyB,IAAI;IAC1D,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,MAAM,oBAAoB,CAAC;IACvC,MAAM,EAAE,qBAAqB,CAAC,EAAE,CAAC,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,SAAS,gJAgDrB,CAAA"}
@@ -1,4 +1,4 @@
1
- export { mq, MQSymbol } from './mq';
1
+ export { mq, MQSymbol, MQHeight, MQWidth, MQHeightAndWidth, MQWidthAndHeight } from './mq';
2
2
  export { getKeyForUnistylesMediaQuery, isWithinTheWidthAndHeight, isValidMq, parseMq } from './mqParser';
3
3
  export { getValueForBreakpoint } from './breakpoints';
4
4
  export { proxifyFunction, parseStyle } from './styles';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACxG,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAC1F,OAAO,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACxG,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA"}
@@ -1,21 +1,27 @@
1
- import type { MediaQuery, Nullable } from '../types';
1
+ import type { Nullable } from '../types';
2
2
  import type { UnistylesBreakpoints } from '../global';
3
3
  export declare const MQSymbol: unique symbol;
4
+ export declare const MQWidth: unique symbol;
5
+ export declare const MQHeight: unique symbol;
6
+ export declare const MQWidthAndHeight: unique symbol;
7
+ export declare const MQHeightAndWidth: unique symbol;
4
8
  type MQValue = keyof UnistylesBreakpoints | number;
5
9
  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
+ only: {
11
+ width(wMin?: Nullable<MQValue>, wMax?: MQValue): typeof MQWidth;
12
+ height(hMin?: Nullable<MQValue>, hMax?: MQValue): typeof MQHeight;
13
+ };
14
+ width(wMin?: Nullable<MQValue>, wMax?: MQValue): {
15
+ and: {
16
+ height(hMin?: Nullable<MQValue>, hMax?: MQValue): typeof MQWidthAndHeight;
17
+ };
18
+ };
19
+ height(hMin?: Nullable<MQValue>, hMax?: MQValue): {
20
+ and: {
21
+ width(wMin?: Nullable<MQValue>, wMax?: MQValue): typeof MQHeightAndWidth;
22
+ };
23
+ };
10
24
  };
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
25
  export declare const mq: MQHandler;
20
26
  export {};
21
27
  //# sourceMappingURL=mq.d.ts.map
@@ -1 +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,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGrD,eAAO,MAAM,QAAQ,eAAyB,CAAA;AAE9C,KAAK,OAAO,GAAG,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAElD,KAAK,SAAS,GAAG;IACb,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;IAC1D,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;IAC9D,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IAC3D,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,aAAa,CAAA;CAClE,CAAA;AAED,KAAK,aAAa,GAAG;IACjB,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE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,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG;QAC7C,GAAG,EAAE;YACD,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,gBAAgB,CAAA;SAC5E,CAAA;KACJ,CAAC;IACF,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG;QAC9C,GAAG,EAAE;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,gBAAgB,CAAA;SAC3E,CAAA;KACJ,CAAA;CACJ,CAAA;AA0ED,eAAO,MAAM,EAAE,WAmBb,CAAA"}
@@ -1,6 +1,6 @@
1
- import type { CustomNamedStyles, RNStyle, UnistylesPlugin } from '../types';
1
+ import type { UnistylesPlugin, StyleSheet, Optional } from '../types';
2
2
  import type { UnistylesRuntime } from '../core';
3
- export declare const proxifyFunction: (key: string, fn: Function, plugins: Array<UnistylesPlugin>, runtime: UnistylesRuntime, variant?: string) => Function;
3
+ export declare const proxifyFunction: (key: string, fn: Function, plugins: Array<UnistylesPlugin>, runtime: UnistylesRuntime, variant?: Record<string, Optional<string>>) => Function;
4
4
  export declare const isPlatformColor: <T extends {}>(value: T) => boolean;
5
- export declare const parseStyle: <T extends RNStyle>(key: string, style: CustomNamedStyles<T>, plugins: Array<UnistylesPlugin>, runtime: UnistylesRuntime, variant?: string) => T;
5
+ export declare const parseStyle: <T extends StyleSheet>(key: string, style: T, plugins: Array<UnistylesPlugin>, runtime: UnistylesRuntime, variant?: Record<string, Optional<string>>) => T;
6
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,iBAAiB,EAAe,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAExF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAK/C,eAAO,MAAM,eAAe,QACnB,MAAM,MACP,QAAQ,WACH,MAAM,eAAe,CAAC,WACtB,gBAAgB,YACf,MAAM,KACjB,QAGD,CAAA;AAEF,eAAO,MAAM,eAAe,8BAA6B,OAMxD,CAAA;AAED,eAAO,MAAM,UAAU,2BACd,MAAM,wCAEF,MAAM,eAAe,CAAC,WACtB,gBAAgB,YACf,MAAM,MAyCnB,CAAA"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAK/C,eAAO,MAAM,eAAe,QACnB,MAAM,MACP,QAAQ,WACH,MAAM,eAAe,CAAC,WACtB,gBAAgB,YACf,OAAO,MAAM,EAAE,SAAS,MAAM,CAAC,CAAC,KAC3C,QAGD,CAAA;AAEF,eAAO,MAAM,eAAe,8BAA6B,OAMxD,CAAA;AAED,eAAO,MAAM,UAAU,8BACd,MAAM,qBAEF,MAAM,eAAe,CAAC,WACtB,gBAAgB,YACf,OAAO,MAAM,EAAE,SAAS,MAAM,CAAC,CAAC,MA0C7C,CAAA"}
@@ -1,3 +1,3 @@
1
- import type { CustomNamedStyles } from '../types';
2
- export declare const getStyleWithVariant: <T>(style: CustomNamedStyles<T>, variant?: string) => CustomNamedStyles<T> | Omit<CustomNamedStyles<T> & Record<"variants", unknown>, "variants">;
1
+ import type { Optional, StyleSheet } from '../types';
2
+ export declare const getStyleWithVariants: (style: StyleSheet, variantValues?: Record<string, Optional<string>>) => StyleSheet;
3
3
  //# sourceMappingURL=variants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/utils/variants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,iBAAiB,EAAe,MAAM,UAAU,CAAA;AAcxE,eAAO,MAAM,mBAAmB,6CAElB,MAAM,gGAoBnB,CAAA"}
1
+ {"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/utils/variants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAe,MAAM,UAAU,CAAA;AAqCjE,eAAO,MAAM,oBAAoB,UACtB,UAAU,kBACD,OAAO,MAAM,EAAE,SAAS,MAAM,CAAC,CAAC,eAqBnD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "2.0.0-alpha.14",
3
+ "version": "2.0.0-alpha.15",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -50,23 +50,23 @@
50
50
  "registry": "https://registry.npmjs.org/"
51
51
  },
52
52
  "devDependencies": {
53
- "@commitlint/config-conventional": "18.1.0",
53
+ "@commitlint/config-conventional": "18.4.3",
54
54
  "@react-native/eslint-config": "0.74.0",
55
55
  "@react-native/normalize-colors": "0.74.1",
56
- "@release-it/conventional-changelog": "7.0.2",
56
+ "@release-it/conventional-changelog": "8.0.1",
57
57
  "@testing-library/react-hooks": "8.0.1",
58
- "@types/jest": "29.5.7",
59
- "@types/react": "18.2.34",
60
- "@typescript-eslint/eslint-plugin": "6.9.1",
61
- "@typescript-eslint/eslint-plugin-tslint": "6.9.1",
62
- "@typescript-eslint/parser": "6.9.1",
63
- "commitlint": "18.2.0",
58
+ "@types/jest": "29.5.10",
59
+ "@types/react": "18.2.38",
60
+ "@typescript-eslint/eslint-plugin": "6.12.0",
61
+ "@typescript-eslint/eslint-plugin-tslint": "6.12.0",
62
+ "@typescript-eslint/parser": "6.12.0",
63
+ "commitlint": "18.4.3",
64
64
  "concurrently": "8.2.2",
65
- "eslint": "8.53.0",
65
+ "eslint": "8.54.0",
66
66
  "eslint-config-codemask": "1.1.7",
67
67
  "eslint-plugin-functional": "6.0.0",
68
68
  "eslint-plugin-import": "2.29.0",
69
- "eslint-plugin-jsdoc": "46.8.2",
69
+ "eslint-plugin-jsdoc": "46.9.0",
70
70
  "eslint-plugin-jsx-a11y": "6.8.0",
71
71
  "eslint-plugin-nested-if": "1.0.0",
72
72
  "eslint-plugin-no-else": "0.2.2",
@@ -77,11 +77,11 @@
77
77
  "husky": "8.0.3",
78
78
  "jest": "29.7.0",
79
79
  "react": "18.2.0",
80
- "react-native": "0.72.6",
81
- "react-native-builder-bob": "0.23.1",
80
+ "react-native": "0.72.7",
81
+ "react-native-builder-bob": "0.23.2",
82
82
  "react-native-web": "0.19.9",
83
83
  "react-test-renderer": "18.2.0",
84
- "release-it": "16.2.1",
84
+ "release-it": "17.0.0",
85
85
  "typescript": "5.2.2"
86
86
  },
87
87
  "peerDependencies": {
package/src/common.ts CHANGED
@@ -15,20 +15,20 @@ export const ScreenOrientation = {
15
15
  Portrait: 'portrait'
16
16
  } as const
17
17
 
18
- export enum CxxUnistylesEventTypes {
18
+ export enum UnistylesEventType {
19
19
  Theme = 'theme',
20
20
  Layout = 'layout',
21
21
  Plugin = 'plugin'
22
22
  }
23
23
 
24
24
  export enum UnistylesError {
25
- RuntimeUnavailable = 'UNISTYLES_ERROR_RUNTIME_UNAVAILABLE',
26
- ThemeNotFound = 'UNISTYLES_ERROR_THEME_NOT_FOUND',
27
- ThemeNotRegistered = 'UNISTYLES_ERROR_THEME_NOT_REGISTERED',
28
- ThemesCannotBeEmpty = 'UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY',
29
- BreakpointsCannotBeEmpty = 'UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY',
30
- BreakpointsMustStartFromZero = 'UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO',
31
- InvalidPluginName = 'UNISTYLES_ERROR_INVALID_PLUGIN_NAME',
32
- DuplicatePluginName = 'UNISTYLES_ERROR_DUPLICATE_PLUGIN_NAME',
33
- CantRemoveInternalPlugin = 'UNISTYLES_ERROR_CANT_REMOVE_INTERNAL_PLUGIN'
25
+ RuntimeUnavailable = 'Unistyles runtime is not available. Make sure you followed the installation instructions.',
26
+ ThemeNotFound = 'You are trying to get a theme that is not registered.',
27
+ ThemeNotRegistered = 'You are trying to set a theme that is not registered.',
28
+ ThemesCannotBeEmpty = 'You are trying to register an empty themes object.',
29
+ BreakpointsCannotBeEmpty = 'You are trying to register an empty breakpoints object.',
30
+ BreakpointsMustStartFromZero = 'One breakpoint must start from 0.',
31
+ InvalidPluginName = 'Plugin name can\'t start from reserved prefix. Use another name.',
32
+ DuplicatePluginName = 'You are trying to register a plugin with a name that is already registered.',
33
+ CantRemoveInternalPlugin = 'You are trying to remove an internal unistyles plugin.'
34
34
  }
@@ -44,7 +44,7 @@ export class UnistylesRuntime {
44
44
  }
45
45
 
46
46
  public setTheme = (name: keyof UnistylesThemes) => {
47
- if (this.unistylesRegistry.hasTheme(name)) {
47
+ if (name !== this.themeName && this.unistylesRegistry.hasTheme(name)) {
48
48
  this.unistylesBridge.useTheme(name)
49
49
 
50
50
  return true
@@ -1,9 +1,3 @@
1
- import type { CustomNamedStyles, UnistylesTheme } from './types'
1
+ import type { StyleSheetWithSuperPowers } from './types'
2
2
 
3
- export const createStyleSheet = <S, X>(styles: S | CustomNamedStyles<S> | X | ((theme: UnistylesTheme) => X | CustomNamedStyles<X>)): S | X => {
4
- if (typeof styles === 'function') {
5
- return styles as X
6
- }
7
-
8
- return styles as S
9
- }
3
+ export const createStyleSheet = <S extends StyleSheetWithSuperPowers>(stylesheet: S): S => stylesheet
package/src/global.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export interface UnistylesThemes {}
2
2
  export interface UnistylesBreakpoints {
3
+ // these breakpoints are only available on mobile, when you didn't specify any breakpoints
3
4
  landscape?: number,
4
5
  portrait?: number,
5
6
  }
@@ -1,2 +1,3 @@
1
1
  export { useInitialTheme } from './useInitialTheme'
2
2
  export { useUnistyles } from './useUnistyles'
3
+ export { useVariants } from './useVariants'