react-native-unistyles 2.0.0-alpha.5 → 2.0.0-alpha.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/cxx/UnistylesRuntime.cpp +262 -0
  2. package/cxx/UnistylesRuntime.h +61 -0
  3. package/lib/commonjs/Unistyles.js +1 -1
  4. package/lib/commonjs/Unistyles.js.map +1 -1
  5. package/lib/commonjs/UnistylesEngine.js +9 -5
  6. package/lib/commonjs/UnistylesEngine.js.map +1 -1
  7. package/lib/commonjs/createStyleSheet.js.map +1 -1
  8. package/lib/commonjs/index.js +7 -0
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/types/cxx.js.map +1 -1
  11. package/lib/commonjs/useStyles.js +0 -2
  12. package/lib/commonjs/useStyles.js.map +1 -1
  13. package/lib/commonjs/useUnistyles.js.map +1 -1
  14. package/lib/commonjs/utils/breakpoints.js +11 -68
  15. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  16. package/lib/commonjs/utils/common.js +3 -1
  17. package/lib/commonjs/utils/common.js.map +1 -1
  18. package/lib/commonjs/utils/index.js +8 -0
  19. package/lib/commonjs/utils/index.js.map +1 -1
  20. package/lib/commonjs/utils/mediaQueries.js +57 -155
  21. package/lib/commonjs/utils/mediaQueries.js.map +1 -1
  22. package/lib/commonjs/utils/mq.js +75 -0
  23. package/lib/commonjs/utils/mq.js.map +1 -0
  24. package/lib/commonjs/utils/styles.js +11 -51
  25. package/lib/commonjs/utils/styles.js.map +1 -1
  26. package/lib/module/Unistyles.js +2 -2
  27. package/lib/module/Unistyles.js.map +1 -1
  28. package/lib/module/UnistylesEngine.js +7 -3
  29. package/lib/module/UnistylesEngine.js.map +1 -1
  30. package/lib/module/createStyleSheet.js.map +1 -1
  31. package/lib/module/index.js +1 -0
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/module/types/cxx.js.map +1 -1
  34. package/lib/module/useStyles.js +0 -3
  35. package/lib/module/useStyles.js.map +1 -1
  36. package/lib/module/useUnistyles.js.map +1 -1
  37. package/lib/module/utils/breakpoints.js +11 -68
  38. package/lib/module/utils/breakpoints.js.map +1 -1
  39. package/lib/module/utils/common.js +2 -0
  40. package/lib/module/utils/common.js.map +1 -1
  41. package/lib/module/utils/index.js +1 -0
  42. package/lib/module/utils/index.js.map +1 -1
  43. package/lib/module/utils/mediaQueries.js +57 -155
  44. package/lib/module/utils/mediaQueries.js.map +1 -1
  45. package/lib/module/utils/mq.js +69 -0
  46. package/lib/module/utils/mq.js.map +1 -0
  47. package/lib/module/utils/styles.js +10 -51
  48. package/lib/module/utils/styles.js.map +1 -1
  49. package/lib/typescript/src/Unistyles.d.ts +2 -2
  50. package/lib/typescript/src/Unistyles.d.ts.map +1 -1
  51. package/lib/typescript/src/UnistylesEngine.d.ts +4 -1
  52. package/lib/typescript/src/UnistylesEngine.d.ts.map +1 -1
  53. package/lib/typescript/src/createStyleSheet.d.ts +2 -5
  54. package/lib/typescript/src/createStyleSheet.d.ts.map +1 -1
  55. package/lib/typescript/src/index.d.ts +1 -0
  56. package/lib/typescript/src/index.d.ts.map +1 -1
  57. package/lib/typescript/src/types/breakpoints.d.ts +2 -1
  58. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  59. package/lib/typescript/src/types/core.d.ts +18 -16
  60. package/lib/typescript/src/types/core.d.ts.map +1 -1
  61. package/lib/typescript/src/types/cxx.d.ts +7 -1
  62. package/lib/typescript/src/types/cxx.d.ts.map +1 -1
  63. package/lib/typescript/src/types/index.d.ts +1 -1
  64. package/lib/typescript/src/types/index.d.ts.map +1 -1
  65. package/lib/typescript/src/types/mediaQueries.d.ts +5 -3
  66. package/lib/typescript/src/types/mediaQueries.d.ts.map +1 -1
  67. package/lib/typescript/src/useStyles.d.ts +2 -4
  68. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  69. package/lib/typescript/src/useUnistyles.d.ts +4 -5
  70. package/lib/typescript/src/useUnistyles.d.ts.map +1 -1
  71. package/lib/typescript/src/utils/breakpoints.d.ts +2 -60
  72. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  73. package/lib/typescript/src/utils/common.d.ts +2 -0
  74. package/lib/typescript/src/utils/common.d.ts.map +1 -1
  75. package/lib/typescript/src/utils/index.d.ts +1 -0
  76. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  77. package/lib/typescript/src/utils/mediaQueries.d.ts +8 -127
  78. package/lib/typescript/src/utils/mediaQueries.d.ts.map +1 -1
  79. package/lib/typescript/src/utils/mq.d.ts +15 -0
  80. package/lib/typescript/src/utils/mq.d.ts.map +1 -0
  81. package/lib/typescript/src/utils/styles.d.ts +1 -46
  82. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  83. package/package.json +10 -1
  84. package/src/Unistyles.ts +3 -3
  85. package/src/UnistylesEngine.ts +12 -3
  86. package/src/createStyleSheet.ts +2 -5
  87. package/src/index.ts +1 -0
  88. package/src/types/breakpoints.ts +6 -3
  89. package/src/types/core.ts +25 -22
  90. package/src/types/cxx.ts +8 -1
  91. package/src/types/index.ts +1 -1
  92. package/src/types/mediaQueries.ts +9 -4
  93. package/src/useStyles.ts +3 -6
  94. package/src/useUnistyles.ts +11 -4
  95. package/src/utils/breakpoints.ts +14 -71
  96. package/src/utils/common.ts +2 -0
  97. package/src/utils/index.ts +1 -0
  98. package/src/utils/mediaQueries.ts +102 -163
  99. package/src/utils/mq.ts +77 -0
  100. package/src/utils/styles.ts +13 -55
@@ -1,5 +1,5 @@
1
1
  import { UnistylesRuntime } from './UnistylesRuntime';
2
- import { UnistylesEngine } from './UnistylesEngine';
2
+ import { UnistylesBuiltInEngine } from './UnistylesEngine';
3
3
  import { UnistyleRegistry } from './UnistyleRegistry';
4
4
  declare class Unistyles {
5
5
  private _runtime;
@@ -9,7 +9,7 @@ declare class Unistyles {
9
9
  constructor();
10
10
  get registry(): UnistyleRegistry;
11
11
  get runtime(): UnistylesRuntime;
12
- get engine(): UnistylesEngine;
12
+ get engine(): UnistylesBuiltInEngine;
13
13
  }
14
14
  export declare const unistyles: Unistyles;
15
15
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Unistyles.d.ts","sourceRoot":"","sources":["../../../src/Unistyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAIrD,cAAM,SAAS;IACX,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAAiB;;IAgBhC,IAAW,QAAQ,qBAElB;IAED,IAAW,OAAO,qBAEjB;IAED,IAAW,MAAM,oBAEhB;CACJ;AAED,eAAO,MAAM,SAAS,WAAkB,CAAA"}
1
+ {"version":3,"file":"Unistyles.d.ts","sourceRoot":"","sources":["../../../src/Unistyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAIrD,cAAM,SAAS;IACX,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAAiB;;IAgBhC,IAAW,QAAQ,qBAElB;IAED,IAAW,OAAO,qBAEjB;IAED,IAAW,MAAM,2BAEhB;CACJ;AAED,eAAO,MAAM,SAAS,WAAkB,CAAA"}
@@ -1,8 +1,11 @@
1
1
  import type { UnistyleRegistry } from './UnistyleRegistry';
2
2
  import type { UnistylesRuntime } from './UnistylesRuntime';
3
- export declare class UnistylesEngine {
3
+ import type { UnistylesEngine, NestedKeys } from './types';
4
+ export declare class UnistylesBuiltInEngine implements UnistylesEngine {
4
5
  private registry;
5
6
  private runtime;
6
7
  constructor(registry: UnistyleRegistry, runtime: UnistylesRuntime);
8
+ isMediaQuery: (key: string) => boolean;
9
+ didMatchMediaQuery: (keys: NestedKeys) => string | undefined;
7
10
  }
8
11
  //# sourceMappingURL=UnistylesEngine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnistylesEngine.d.ts","sourceRoot":"","sources":["../../../src/UnistylesEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAG1D,qBAAa,eAAe;IAEZ,OAAO,CAAC,QAAQ;IAAoB,OAAO,CAAC,OAAO;gBAA3C,QAAQ,EAAE,gBAAgB,EAAU,OAAO,EAAE,gBAAgB;CAQpF"}
1
+ {"version":3,"file":"UnistylesEngine.d.ts","sourceRoot":"","sources":["../../../src/UnistylesEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAE1D,qBAAa,sBAAuB,YAAW,eAAe;IAC9C,OAAO,CAAC,QAAQ;IAAoB,OAAO,CAAC,OAAO;gBAA3C,QAAQ,EAAE,gBAAgB,EAAU,OAAO,EAAE,gBAAgB;IAK1E,YAAY,QAAS,MAAM,aAIjC;IAEM,kBAAkB,2CAC0D;CAKtF"}
@@ -1,6 +1,3 @@
1
- import type { CustomNamedStyles } from './types';
2
- import type { UnistylesThemes } from './global';
3
- type T = UnistylesThemes[keyof UnistylesThemes];
4
- export declare const createStyleSheet: <S extends CustomNamedStyles<S>, X>(styles: S | X | CustomNamedStyles<S> | ((theme: T) => X | CustomNamedStyles<X>)) => S | X;
5
- export {};
1
+ import type { CustomNamedStyles, UnistylesTheme } from './types';
2
+ export declare const createStyleSheet: <S, X>(styles: S | X | CustomNamedStyles<S> | ((theme: UnistylesTheme) => X | CustomNamedStyles<X>)) => S | X;
6
3
  //# sourceMappingURL=createStyleSheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,CAAC,GAAG,eAAe,CAAC,MAAM,eAAe,CAAC,CAAA;AAE/C,eAAO,MAAM,gBAAgB,sFAAuF,CAAC,wCAMpH,CAAA"}
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"}
@@ -1,5 +1,6 @@
1
1
  import type { UnistylesThemes, UnistylesBreakpoints } from './global';
2
2
  import { ScreenOrientation } from './types';
3
+ export { mq } from './utils';
3
4
  export { useInitialTheme } from './useInitialTheme';
4
5
  export { useStyles } from './useStyles';
5
6
  export { createStyleSheet } from './createStyleSheet';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,QAAA,MAAM,gBAAgB,+CAAoB,CAAA;AAC1C,QAAA,MAAM,iBAAiB;;;;CAItB,CAAA;AAED,eAAO,MAAM,uBAAuB,YAA2C,CAAA;AAE/E,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACpB,CAAA;AAED,OAAO,EACH,iBAAiB,EACpB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACvB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,QAAA,MAAM,gBAAgB,+CAAoB,CAAA;AAC1C,QAAA,MAAM,iBAAiB;;;;CAItB,CAAA;AAED,eAAO,MAAM,uBAAuB,YAA2C,CAAA;AAE/E,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACpB,CAAA;AAED,OAAO,EACH,iBAAiB,EACpB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACvB,CAAA"}
@@ -1,3 +1,4 @@
1
+ import type { OpaqueColorValue } from 'react-native';
1
2
  import type { UnistylesBreakpoints } from '../global';
2
3
  import type { MediaQueries } from './mediaQueries';
3
4
  export type ScreenSize = {
@@ -9,7 +10,7 @@ type WithEmptyObject<V> = keyof V extends never ? {} : V;
9
10
  export 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> : {
10
11
  [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];
11
12
  };
12
- export type RemoveKeysWithPrefix<T> = T extends (...args: Array<any>) => infer R ? (...args: Parameters<T>) => RemoveKeysWithPrefix<R> : T extends object ? T extends Record<string, infer _V> ? {
13
+ export 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> ? {
13
14
  [K in keyof T as K extends MediaQueries ? keyof UnistylesBreakpoints & string : K]: RemoveKeysWithPrefix<T[K]>;
14
15
  } : {
15
16
  [K in keyof T]: RemoveKeysWithPrefix<T[K]>;
@@ -1 +1 @@
1
- {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/types/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,EAAE,CAAA;AAEjE,KAAK,eAAe,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,KAAK,GAAG,EAAE,GAAG,CAAC,CAAA;AAExD,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GACrG,eAAe,CAAC,CAAC,CAAC,GAClB,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,GACnC,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,GAC9B;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,YAAY,GAAG,MAAM,oBAAoB,GAAG,MAAM,GAAG,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAClH;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtD,CAAC,CAAA"}
@@ -1,32 +1,34 @@
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
3
  import type { MediaQueries } from './mediaQueries';
4
- import type { UnistylesBreakpoints } from '../global';
4
+ import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
5
5
  type ShadowOffset = {
6
6
  width: number;
7
7
  height: number;
8
8
  };
9
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>>;
10
+ type UnistyleNested = {
11
+ shadowOffset?: DeepUniStyle<ShadowOffset>;
12
+ textShadowOffset?: DeepUniStyle<ShadowOffset>;
13
+ transform?: Array<DeepUniStyle<TransformStyles>>;
14
14
  };
15
- type UniStyle<V, B> = {
16
- [innerKey in keyof B]?: V;
15
+ type UniStyle<V> = {
16
+ [innerKey in keyof UnistylesBreakpoints]: V;
17
17
  } | {
18
- [innerKey in MediaQueries]?: V;
19
- } | V;
20
- type DeepUniStyle<T, B> = {
21
- [K in keyof T]?: UniStyle<T[K], B>;
18
+ [innerKey in MediaQueries]: V;
19
+ };
20
+ type DeepUniStyle<T> = {
21
+ [K in keyof T]?: UniStyle<T[K]> | T[K];
22
22
  };
23
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> = UnistyleView<B> | UnistyleText<B> | UnistyleImage<B> & UnistyleNested<B>;
24
+ type UnistyleView = DeepUniStyle<Omit<ViewStyle, NestedTypes>>;
25
+ type UnistyleText = DeepUniStyle<Omit<TextStyle, NestedTypes>>;
26
+ type UnistyleImage = DeepUniStyle<Omit<ImageStyle, NestedTypes>>;
27
+ export type StaticStyles = UnistyleView | UnistyleText | UnistyleImage & UnistyleNested;
28
28
  export type CustomNamedStyles<T> = {
29
- [K in keyof T]: T[K] extends (...args: infer A) => StaticStyles<UnistylesBreakpoints> ? (...args: A) => StaticStyles<UnistylesBreakpoints> : StaticStyles<UnistylesBreakpoints>;
29
+ [K in keyof T]: T[K] extends (...args: infer A) => StaticStyles ? (...args: A) => StaticStyles : StaticStyles;
30
30
  };
31
+ export type NestedKeys = Array<[keyof UnistylesBreakpoints | MediaQueries, string | number | undefined]>;
32
+ export type UnistylesTheme = UnistylesThemes[keyof UnistylesThemes];
31
33
  export {};
32
34
  //# 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,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Ac,CAAA;AAEpB,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;KAC9B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,YAAY,GACzD,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,YAAY,GAC5B,YAAY;CACrB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,MAAM,oBAAoB,GAAG,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;AACxG,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,eAAe,CAAC,CAAA"}
@@ -1,7 +1,9 @@
1
1
  import type { UnistylesThemes, UnistylesBreakpoints } from '../global';
2
2
  import type { ScreenSize } from './breakpoints';
3
+ import type { NestedKeys } from './core';
4
+ export type Optional<T> = T | undefined;
3
5
  export type Nullable<T> = T | null;
4
- export type ColorSchemeName = 'light' | 'dark' | undefined;
6
+ export type ColorSchemeName = Optional<'light' | 'dark'>;
5
7
  export type UnistylesConfig = {
6
8
  adaptiveThemes?: boolean;
7
9
  };
@@ -50,4 +52,8 @@ export declare enum UnistylesError {
50
52
  BreakpointsCannotBeEmpty = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY",
51
53
  BreakpointsMustStartFromZero = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO"
52
54
  }
55
+ export interface UnistylesEngine {
56
+ isMediaQuery(key: string): boolean;
57
+ didMatchMediaQuery(keys: NestedKeys): Optional<string>;
58
+ }
53
59
  //# sourceMappingURL=cxx.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cxx.d.ts","sourceRoot":"","sources":["../../../../src/types/cxx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,E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from './core';
3
+ export type { CustomNamedStyles, NestedKeys, UnistylesTheme } from './core';
4
4
  export type { MediaQueries } from './mediaQueries';
5
5
  export type { ScreenSize, CreateStylesFactory, ExtractBreakpoints, RemoveKeysWithPrefix } from './breakpoints';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,OAAO,CAAA;AACrB,YAAY,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC/C,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,YAAY,EACR,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACvB,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,OAAO,CAAA;AACrB,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC3E,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,YAAY,EACR,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACvB,MAAM,eAAe,CAAA"}
@@ -1,8 +1,10 @@
1
1
  type Optional<TOptional extends string> = TOptional | '';
2
2
  type Separator = ',' | ', ';
3
- type MediaQuery = `[${Separator}${bigint}]` | `[${bigint}${Optional<`${Separator}${bigint}`>}]`;
4
- type WidthMediaQuery = `:w${MediaQuery}`;
5
- type HeightMediaQuery = `:h${MediaQuery}`;
3
+ type OpeningBracket = '(' | '[';
4
+ type ClosingBracket = ')' | ']';
5
+ type NumericMediaQuery = `${OpeningBracket}${Separator}${bigint}${ClosingBracket}` | `${OpeningBracket}${bigint}${Optional<`${Separator}${bigint}`>}${ClosingBracket}`;
6
+ type WidthMediaQuery = `:w${NumericMediaQuery}`;
7
+ type HeightMediaQuery = `:h${NumericMediaQuery}`;
6
8
  export type MediaQueries = `${WidthMediaQuery}${Optional<HeightMediaQuery>}` | `${HeightMediaQuery}${Optional<WidthMediaQuery>}`;
7
9
  export {};
8
10
  //# sourceMappingURL=mediaQueries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../../src/types/mediaQueries.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,CAAC,SAAS,SAAS,MAAM,IAAI,SAAS,GAAG,EAAE,CAAA;AACxD,KAAK,SAAS,GAAG,GAAG,GAAG,IAAI,CAAA;AAE3B,KAAK,UAAU,GAAG,IAAI,SAAS,GAAG,MAAM,GAAG,GAAG,IAAI,MAAM,GAAG,QAAQ,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,CAAC,GAAG,CAAA;AAC/F,KAAK,eAAe,GAAG,KAAK,UAAU,EAAE,CAAA;AACxC,KAAK,gBAAgB,GAAG,KAAK,UAAU,EAAE,CAAA;AAEzC,MAAM,MAAM,YAAY,GAClB,GAAG,eAAe,GAAG,QAAQ,CAAC,gBAAgB,CAAC,EAAE,GACjD,GAAG,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAA"}
1
+ {"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../../src/types/mediaQueries.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,CAAC,SAAS,SAAS,MAAM,IAAI,SAAS,GAAG,EAAE,CAAA;AACxD,KAAK,SAAS,GAAG,GAAG,GAAG,IAAI,CAAA;AAC3B,KAAK,cAAc,GAAG,GAAG,GAAG,GAAG,CAAA;AAC/B,KAAK,cAAc,GAAG,GAAG,GAAG,GAAG,CAAA;AAE/B,KAAK,iBAAiB,GAChB,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,cAAc,EAAE,GACzD,GAAG,cAAc,GAAG,MAAM,GAAG,QAAQ,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,CAAC,GAAG,cAAc,EAAE,CAAA;AAEvF,KAAK,eAAe,GAAG,KAAK,iBAAiB,EAAE,CAAA;AAC/C,KAAK,gBAAgB,GAAG,KAAK,iBAAiB,EAAE,CAAA;AAEhD,MAAM,MAAM,YAAY,GAClB,GAAG,eAAe,GAAG,QAAQ,CAAC,gBAAgB,CAAC,EAAE,GACjD,GAAG,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAA"}
@@ -1,10 +1,8 @@
1
1
  import type { CreateStylesFactory, CustomNamedStyles, ExtractBreakpoints, RemoveKeysWithPrefix } from './types';
2
- import type { UnistylesThemes } from './global';
3
- type T = UnistylesThemes[keyof UnistylesThemes];
2
+ import type { UnistylesTheme } from './types';
4
3
  export declare const useStyles: <ST extends CustomNamedStyles<ST>>(stylesheet?: ST | CreateStylesFactory<ST, never> | undefined) => {
5
4
  theme: never;
6
- breakpoint: "landscape" | "portrait";
5
+ breakpoint: keyof import("./global").UnistylesBreakpoints;
7
6
  styles: ExtractBreakpoints<RemoveKeysWithPrefix<ST>>;
8
7
  };
9
- export {};
10
8
  //# sourceMappingURL=useStyles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../src/useStyles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE/G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C,KAAK,CAAC,GAAG,eAAe,CAAC,MAAM,eAAe,CAAC,CAAA;AAE/C,eAAO,MAAM,SAAS;;;;CAsCrB,CAAA"}
1
+ {"version":3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../src/useStyles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE/G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,eAAO,MAAM,SAAS;;;;CAsCrB,CAAA"}
@@ -1,11 +1,10 @@
1
+ import type { ScreenSize } from './types';
1
2
  import { ScreenOrientation } from './types';
3
+ import type { UnistylesBreakpoints } from './global';
2
4
  export declare const useUnistyles: () => {
3
5
  theme: never;
4
6
  orientation: ScreenOrientation;
5
- breakpoint: "landscape" | "portrait";
6
- screenSize: {
7
- width: number;
8
- height: number;
9
- };
7
+ breakpoint: keyof UnistylesBreakpoints;
8
+ screenSize: ScreenSize;
10
9
  };
11
10
  //# sourceMappingURL=useUnistyles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../src/useUnistyles.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAKnE,eAAO,MAAM,YAAY;;;;;;;;CA6CxB,CAAA"}
1
+ {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../src/useUnistyles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIR,UAAU,EAEb,MAAM,SAAS,CAAA;AAChB,OAAO,EAA0B,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAIpD,eAAO,MAAM,YAAY;;;;;CA6CxB,CAAA"}
@@ -1,64 +1,6 @@
1
- import type { ScreenSize, MediaQueries } from '../types';
1
+ import type { MediaQueries } from '../types';
2
2
  import type { UnistylesBreakpoints } from '../global';
3
- /**
4
- * Sorts the breakpoints object based on its numeric values in ascending order and validates them.
5
- *
6
- * This function takes an object where keys represent breakpoint names and values are numeric.
7
- * It returns a new object with the same keys but sorted based on their corresponding numeric values.
8
- * Additionally, it validates that:
9
- * 1. The first breakpoint starts with a value of 0.
10
- * 2. No duplicate breakpoint values exist.
11
- *
12
- * If the validation fails, appropriate error messages are logged to the console.
13
- *
14
- * @template B - An object type where keys are strings and values are numbers.
15
- * @param {B} breakpoints - The breakpoints object to be sorted and validated.
16
- * @returns {B} A new object with sorted and validated breakpoints.
17
- *
18
- * @example
19
- * const input = { md: 768, lg: 1024, sm: 0 }
20
- * sortAndValidateBreakpoints(input) // returns { sm: 0, md: 768, lg: 1024 }
21
- */
22
3
  export declare const sortAndValidateBreakpoints: (breakpoints: UnistylesBreakpoints) => UnistylesBreakpoints;
23
- /**
24
- * Determines the appropriate breakpoint key for a given screen width based on provided breakpoints.
25
- *
26
- * This function takes a screen width and an object of breakpoints. It returns the key of the breakpoint
27
- * that the screen width falls into. The breakpoints are assumed to be sorted in ascending order.
28
- *
29
- * @template B - An object type where keys are strings and values are numbers representing screen widths.
30
- * @param {number} width - The screen width to determine the breakpoint for.
31
- * @param breakpointEntries - sorted pairs of breakpoints
32
- * @returns {keyof B & string} The key of the breakpoint that the screen width falls into.
33
- *
34
- * @example
35
- * const breakpoints = { sm: 0, md: 768, lg: 1024 }
36
- * getBreakpointFromScreenWidth(800, breakpoints) // returns 'md'
37
- */
38
4
  export declare const getBreakpointFromScreenWidth: (width: number, breakpointEntries: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>) => keyof UnistylesBreakpoints & string;
39
- /**
40
- * Retrieves the value associated with a given breakpoint or custom media query based on the provided screen size.
41
- *
42
- * The function first checks for custom media queries. If a matching custom media query is found, its associated value is returned.
43
- * If no custom media query matches, the function then checks for a direct breakpoint match.
44
- * If there's no direct breakpoint match, the function simulates CSS cascading to find the closest matching breakpoint.
45
- *
46
- * @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
47
- *
48
- * @param {Record<keyof B & string, string | number>} value - An object containing values associated with breakpoints or custom media queries.
49
- * @param {keyof B & string} breakpoint - The breakpoint name to check against.
50
- * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
51
- * @param breakpointPairs - sorted pairs of breakpoints
52
- *
53
- * @returns {string | number | undefined} Returns the value associated with the matching breakpoint or custom media query, or `undefined` if no match is found.
54
- *
55
- * @example
56
- *
57
- * const values = { ':w[200]': 'value1', sm: 'value2', md: 'value3' }
58
- * const screenSize = { width: 250, height: 400 }
59
- * const breakpoints = { sm: 300, md: 600, lg: 900 }
60
- *
61
- * getValueForBreakpoint(values, 'sm', screenSize, breakpoints); // 'value1'
62
- */
63
- export declare const getValueForBreakpoint: (value: Record<keyof UnistylesBreakpoints | MediaQueries, string | number | undefined>, breakpoint: keyof UnistylesBreakpoints, screenSize: ScreenSize) => string | number | undefined;
5
+ export declare const getValueForBreakpoint: (value: Record<keyof UnistylesBreakpoints | MediaQueries, string | number | undefined>) => string | number | undefined;
64
6
  //# sourceMappingURL=breakpoints.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/utils/breakpoints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,gBAAiB,oBAAoB,KAAG,oBAuB9E,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,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;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,qBAAqB,UACvB,OAAO,MAAM,oBAAoB,GAAG,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,cACzE,MAAM,oBAAoB,cAC1B,UAAU,KACvB,MAAM,GAAG,MAAM,GAAG,SA6CpB,CAAA"}
1
+ {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/utils/breakpoints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAErD,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,OAAO,MAAM,oBAAoB,GAAG,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,KAAG,MAAM,GAAG,MAAM,GAAG,SAmD/I,CAAA"}
@@ -2,6 +2,8 @@ export declare const throwError: (message: string) => never;
2
2
  export declare const warn: (message: string) => void;
3
3
  export declare const isMobile: boolean;
4
4
  export declare const isWeb: boolean;
5
+ export declare const isIOS: boolean;
6
+ export declare const isAndroid: boolean;
5
7
  export declare const isServer: boolean;
6
8
  export declare const Orientation: {
7
9
  readonly Landscape: "landscape";
@@ -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,QAAQ,SAAqD,CAAA;AAC1E,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,QAAQ,SAAgC,CAAA;AAErD,eAAO,MAAM,WAAW;;;CAGd,CAAA"}
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,6 @@
1
1
  export { normalizeStyles } from './normalizeStyles';
2
2
  export * from './normalizer';
3
+ export { mq } from './mq';
3
4
  export { getBreakpointFromScreenWidth, sortAndValidateBreakpoints, getValueForBreakpoint } from './breakpoints';
4
5
  export { proxifyFunction, parseStyle } from './styles';
5
6
  export { isServer, Orientation } from './common';
@@ -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,cAAc,cAAc,CAAA;AAC5B,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;AAChD,OAAO,EACH,aAAa,EACb,yBAAyB,EACzB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EAC5B,MAAM,gBAAgB,CAAA"}
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,MAAM,MAAM,CAAA;AACzB,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;AAChD,OAAO,EACH,aAAa,EACb,yBAAyB,EACzB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EAC5B,MAAM,gBAAgB,CAAA"}
@@ -1,130 +1,11 @@
1
+ import type { UnistylesBreakpoints } from 'react-native-unistyles';
1
2
  import type { ScreenSize } from '../types';
2
- /**
3
- * Extracts numeric values from a coded string.
4
- *
5
- * The function is designed to process strings that have a format like "w[100,200]" or "h[300]".
6
- * It removes characters 'w', 'h', '[', and ']' from the input string and then extracts the numbers.
7
- *
8
- * @param {string} codedValue - The input string to extract values from.
9
- * @returns {Array<number>} An array of extracted numbers. Can contain one or two numbers based on the input format.
10
- *
11
- * @example
12
- * extractValues("w[100,200]") // returns [100, 200]
13
- * extractValues("h[300]") // returns [300]
14
- * extractValues("h[,300]") // returns [0,300]
15
- * extractValues("h[100,]") // returns [100]
16
- */
17
- export declare const extractValues: (codedValue: string) => Array<number>;
18
- /**
19
- * Determines if the given screen size matches the specified breakpoint query.
20
- *
21
- * The function checks if the screen size (width and/or height) falls within the range
22
- * specified by the breakpoint query. The query can specify width (using 'w'), height (using 'h'),
23
- * or both.
24
- *
25
- * @param {string} query - The breakpoint query string. Examples: 'w[100,200]', 'h[300]', 'w[100,200]h[300,400]'.
26
- * @param {ScreenSize} screenSize - The screen size to check against the breakpoint query.
27
- * @returns {boolean} True if the screen size matches the breakpoint query, false otherwise.
28
- *
29
- * @example
30
- * const screenSize = { width: 150, height: 350 }
31
- * isWithinBreakpoint('w[100,200]', screenSize) // returns true
32
- * isWithinBreakpoint('h[400]', screenSize) // returns false
33
- */
34
- export declare const isWithinBreakpoint: (query: string, screenSize: ScreenSize) => boolean;
35
- /**
36
- * Determines if the given width matches the specified width range in the query.
37
- *
38
- * The function checks if the provided width falls within the range specified by the query.
39
- * The query specifies a width range using a format like 'w[100,200]'. If only one value is provided,
40
- * it's treated as a minimum width.
41
- *
42
- * @param {string} query - The width query string. Examples: 'w[100,200]' or 'w[100]'.
43
- * @param {number} width - The width to check against the query.
44
- * @returns {boolean} True if the width matches the query range, false otherwise.
45
- *
46
- * @example
47
- * isWithinTheWidth('w[100,200]', 150) // returns true
48
- * isWithinTheWidth('w[100]', 50) // returns false
49
- * isWithinTheWidth('w[100]', 150) // returns true
50
- */
51
- export declare const isWithinTheWidth: (query: string, width: number) => boolean;
52
- /**
53
- * Determines if the given height matches the specified height range in the query.
54
- *
55
- * The function checks if the provided height falls within the range specified by the query.
56
- * The query specifies a height range using a format like 'h[100,200]'. If only one value is provided,
57
- * it's treated as a minimum height.
58
- *
59
- * @param {string} query - The height query string. Examples: 'h[100,200]' or 'h[100]'.
60
- * @param {number} height - The height to check against the query.
61
- * @returns {boolean} True if the height matches the query range, false otherwise.
62
- *
63
- * @example
64
- * isWithinTheHeight('h[100,200]', 150) // returns true
65
- * isWithinTheHeight('h[100]', 50) // returns false
66
- * isWithinTheHeight('h[100]', 150) // returns true
67
- */
68
- export declare const isWithinTheHeight: (query: string, height: number) => boolean;
69
- /**
70
- * Determines if the given screen size matches both the specified width and height ranges in the query.
71
- *
72
- * The function checks if the provided screen size (both width and height) falls within the ranges
73
- * specified by the query. The query can specify both width and height using a format like 'w[100,200]:h[300,400]'.
74
- *
75
- * @param {string} query - The combined width and height query string. Example: 'w[100,200]:h[300,400]'.
76
- * @param {ScreenSize} screenSize - The screen size to check against the query.
77
- * @returns {boolean} True if the screen size matches both the width and height ranges in the query, false otherwise.
78
- *
79
- * @example
80
- * const screenSize = { width: 150, height: 350 }
81
- * isWithinTheWidthAndHeight('w[100,200]:h[300,400]', screenSize) // returns true
82
- * isWithinTheWidthAndHeight('w[100,200]:h[400,500]', screenSize) // returns false
83
- */
84
- export declare const isWithinTheWidthAndHeight: (query: string, screenSize: ScreenSize) => boolean;
85
- /**
86
- * Checks if the given query string is a valid custom media query.
87
- *
88
- * The valid custom media query formats include:
89
- * - :w[200]
90
- * - :w[0, 200]
91
- * - :w[, 300]
92
- * - :h[200]
93
- * - :h[0, 500]
94
- * - :h[,200]
95
- * - :w[100, 300]:h[200,500]
96
- * - :h[200,500]:w[100, 300]
97
- *
98
- * @param {string} query - The query string to be checked.
99
- * @returns {boolean} Returns `true` if the query is a valid custom media query, otherwise `false`.
100
- * @example
101
- *
102
- * isMediaQuery(':w[200]') // true
103
- * isMediaQuery(':w100]') // false
104
- */
3
+ import type { MediaQueries } from '../types';
4
+ export declare const extractValues: (pattern: string, breakpoints: UnistylesBreakpoints) => Array<number>;
5
+ export declare const isWithinBreakpoint: (query: string, screenSize: ScreenSize, breakpoints: UnistylesBreakpoints) => boolean;
6
+ export declare const isWithinTheWidth: (query: string, width: number, breakpoints: UnistylesBreakpoints) => boolean;
7
+ export declare const isWithinTheHeight: (query: string, height: number, breakpoints: UnistylesBreakpoints) => boolean;
8
+ export declare const isWithinTheWidthAndHeight: (query: string, screenSize: ScreenSize, breakpoints: UnistylesBreakpoints) => boolean;
105
9
  export declare const isMediaQuery: (query: string) => boolean;
106
- /**
107
- * Retrieves the first matching custom media query key based on the provided screen size.
108
- *
109
- * The function processes an array of media queries and returns the first query that matches
110
- * the given screen size. The media queries can be in formats like:
111
- * - w[200]
112
- * - w[0, 200]
113
- * - w[, 300]
114
- * - h[200]
115
- * - h[0, 500]
116
- * - h[,200]
117
- * - w[100, 300]:h[200,500]
118
- * - h[200,500]:w[100, 300]
119
- *
120
- * @param {Array<[string, string | number]>} mediaQueries - An array of tuples containing media query keys and associated values.
121
- * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
122
- * @returns {string | undefined} Returns the first matching media query key or `undefined` if no match is found.
123
- * @example
124
- *
125
- * const queries = [[':w[200]', 'value1'], [':h[300,500]', 'value2']]
126
- * const size = { width: 250, height: 400 }
127
- * getKeyForCustomMediaQuery(queries, size) // ':w[200]
128
- */
129
- export declare const getKeyForCustomMediaQuery: (mediaQueries: Array<[string, string | number | undefined]>, screenSize: ScreenSize) => string | undefined;
10
+ export declare const getKeyForCustomMediaQuery: (mediaQueries: Array<[keyof UnistylesBreakpoints | MediaQueries, string | number | undefined]>, screenSize: ScreenSize, breakpoints: UnistylesBreakpoints) => string | undefined;
130
11
  //# sourceMappingURL=mediaQueries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../../src/utils/mediaQueries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,eAAgB,MAAM,KAAG,MAAM,MAAM,CAoB9D,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB,UAAW,MAAM,cAAc,UAAU,KAAG,OAc1E,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,SAAS,MAAM,KAAG,OAQ/D,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,UAAW,MAAM,UAAU,MAAM,KAAG,OAQjE,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,UAAW,MAAM,cAAc,UAAU,KAAG,OAQjF,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,OAI5C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,yBAAyB,iBAAkB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC,cAAc,UAAU,KAAG,MAAM,GAAG,SAevI,CAAA"}
1
+ {"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../../src/utils/mediaQueries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAyD5C,eAAO,MAAM,aAAa,YAAa,MAAM,eAAe,oBAAoB,KAAG,MAAM,MAAM,CAyB9F,CAAA;AAED,eAAO,MAAM,kBAAkB,UAAW,MAAM,cAAc,UAAU,eAAe,oBAAoB,KAAG,OAiB7G,CAAA;AAED,eAAO,MAAM,gBAAgB,UAAW,MAAM,SAAS,MAAM,eAAe,oBAAoB,KAAG,OAQlG,CAAA;AAED,eAAO,MAAM,iBAAiB,UAAW,MAAM,UAAU,MAAM,eAAe,oBAAoB,KAAG,OAQpG,CAAA;AAED,eAAO,MAAM,yBAAyB,UAAW,MAAM,cAAc,UAAU,eAAe,oBAAoB,KAAG,OAQpH,CAAA;AAED,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,OAI5C,CAAA;AAED,eAAO,MAAM,yBAAyB,iBACpB,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC,cACjF,UAAU,eACT,oBAAoB,KAClC,MAAM,GAAG,SAMX,CAAA"}
@@ -0,0 +1,15 @@
1
+ import type { UnistylesBreakpoints } from '../global';
2
+ declare const MQSymbol: unique symbol;
3
+ type MQValue = keyof UnistylesBreakpoints | number;
4
+ type HeightHandler = {
5
+ width(wMin?: MQValue, wMax?: MQValue): typeof MQSymbol;
6
+ } & typeof MQSymbol;
7
+ type WidthHandler = {
8
+ height(hMin?: MQValue, hMax?: MQValue): typeof MQSymbol;
9
+ } & typeof MQSymbol;
10
+ export declare const mq: {
11
+ height: (hMin?: MQValue, hMax?: MQValue) => HeightHandler;
12
+ width: (wMin?: MQValue, wMax?: MQValue) => WidthHandler;
13
+ };
14
+ export {};
15
+ //# 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,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGrD,QAAA,MAAM,QAAQ,eAAyB,CAAA;AAEvC,KAAK,OAAO,GAAG,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAElD,KAAK,aAAa,GAAG;IACjB,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,QAAQ,CAAA;CACzD,GAAG,OAAO,QAAQ,CAAA;AAEnB,KAAK,YAAY,GAAG;IAChB,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,QAAQ,CAAA;CAC1D,GAAG,OAAO,QAAQ,CAAA;AAoBnB,eAAO,MAAM,EAAE;oBACI,OAAO,SAAY,OAAO;mBAqB3B,OAAO,SAAY,OAAO;CAqB3C,CAAA"}
@@ -1,51 +1,6 @@
1
1
  import type { CustomNamedStyles, ScreenSize } from '../types';
2
2
  import type { UnistylesBreakpoints } from '../global';
3
- /**
4
- * Proxies a function to parse its return value for custom media queries or breakpoints.
5
- *
6
- * @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
7
- *
8
- * @param {Function} fn - The function to be proxified.
9
- * @param {keyof B & string} breakpoint - The breakpoint name to check against.
10
- * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
11
- * @param breakpointPairs - sorted pairs of breakpoints
12
- *
13
- * @returns {Function} Returns the proxified function
14
- *
15
- * @example
16
- *
17
- * const myFunction = () => ({ ':w[200]': 'value1', sm: 'value2' })
18
- * const screenSize = { width: 250, height: 400 }
19
- * const breakpoints = { sm: 300, md: 600 }
20
- *
21
- * const proxifiedFunction = proxifyFunction(myFunction, 'sm', screenSize, breakpoints)
22
- * proxifiedFunction() // parsed style based on screenSize and breakpoints
23
- */
24
3
  export declare const proxifyFunction: (fn: Function, breakpoint: keyof UnistylesBreakpoints & string, screenSize: ScreenSize) => Function;
25
- /**
26
- * Parses a style object to resolve custom media queries or breakpoints based on the provided screen size and breakpoints.
27
- *
28
- * 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),
29
- * it is returned as-is. Otherwise, the function attempts to resolve the value based on the provided breakpoint, screen size, and defined breakpoints.
30
- *
31
- * @template T - The type of the style object.
32
- * @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
33
- *
34
- * @param {CustomNamedStyles<T, B>} style - The style object to be parsed.
35
- * @param {keyof B & string} breakpoint - The breakpoint name to check against.
36
- * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
37
- * @param breakpointPairs - sorted pairs of breakpoints
38
- *
39
- * @returns {Record<string, string | number | Function>} Returns the parsed style object with resolved custom media queries or breakpoints.
40
- *
41
- * @example
42
- *
43
- * const style = { fontSize: { sm: '12px', md: '16px' } }
44
- * const screenSize = { width: 300, height: 400 }
45
- * const breakpoints = { xs: 0, sm: 300, md: 600 }
46
- *
47
- * const parsedStyle = parseStyle(style, 'sm', screenSize, breakpoints)
48
- * // { fontSize: '12px' }
49
- */
4
+ export declare const isPlatformColor: <T extends {}>(value: T) => boolean;
50
5
  export declare const parseStyle: <T>(style: CustomNamedStyles<T>, breakpoint: keyof UnistylesBreakpoints & string, screenSize: ScreenSize) => T;
51
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,UAAU,EAAE,MAAM,UAAU,CAAA;AAI7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAErD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,eAAe,OACpB,QAAQ,cAAc,MAAM,oBAAoB,GAAG,MAAM,cACjD,UAAU,KACvB,QAGD,CAAA;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,UAAU,+CAEP,MAAM,oBAAoB,GAAG,MAAM,cACnC,UAAU,MAiDzB,CAAA"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAgB,UAAU,EAAE,MAAM,UAAU,CAAA;AAG3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGrD,eAAO,MAAM,eAAe,OACpB,QAAQ,cAAc,MAAM,oBAAoB,GAAG,MAAM,cACjD,UAAU,KACvB,QAGD,CAAA;AAEF,eAAO,MAAM,eAAe,8BAA6B,OAMxD,CAAA;AAED,eAAO,MAAM,UAAU,+CAEP,MAAM,oBAAoB,GAAG,MAAM,cACnC,UAAU,MA6CzB,CAAA"}