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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. package/cxx/UnistylesRuntime.cpp +24 -31
  2. package/cxx/UnistylesRuntime.h +11 -12
  3. package/ios/UnistylesModule.mm +20 -20
  4. package/lib/commonjs/{types/cxx.js → common.js} +6 -6
  5. package/lib/commonjs/common.js.map +1 -0
  6. package/lib/commonjs/{UnistyleRegistry.js → core/UnistyleRegistry.js} +1 -8
  7. package/lib/commonjs/core/UnistyleRegistry.js.map +1 -0
  8. package/lib/commonjs/{Unistyles.js → core/Unistyles.js} +2 -7
  9. package/lib/commonjs/core/Unistyles.js.map +1 -0
  10. package/lib/commonjs/core/UnistylesModule.js.map +1 -0
  11. package/lib/commonjs/{UnistylesRuntime.js → core/UnistylesRuntime.js} +6 -6
  12. package/lib/commonjs/core/UnistylesRuntime.js.map +1 -0
  13. package/lib/commonjs/core/index.js +13 -0
  14. package/lib/commonjs/core/index.js.map +1 -0
  15. package/lib/commonjs/hooks/index.js +10 -3
  16. package/lib/commonjs/hooks/index.js.map +1 -1
  17. package/lib/commonjs/{useInitialTheme.js → hooks/useInitialTheme.js} +6 -2
  18. package/lib/commonjs/hooks/useInitialTheme.js.map +1 -0
  19. package/lib/commonjs/hooks/useUnistyles.js +54 -0
  20. package/lib/commonjs/hooks/useUnistyles.js.map +1 -0
  21. package/lib/commonjs/index.js +10 -16
  22. package/lib/commonjs/index.js.map +1 -1
  23. package/lib/commonjs/types/common.js +2 -0
  24. package/lib/commonjs/types/{mediaQueries.js.map → common.js.map} +1 -1
  25. package/lib/commonjs/types/index.js +4 -4
  26. package/lib/commonjs/types/index.js.map +1 -1
  27. package/lib/commonjs/types/mq.js +6 -0
  28. package/lib/{module/types/mediaQueries.js.map → commonjs/types/mq.js.map} +1 -1
  29. package/lib/commonjs/types/unistyles.js +6 -0
  30. package/lib/commonjs/types/unistyles.js.map +1 -0
  31. package/lib/commonjs/useStyles.js +7 -4
  32. package/lib/commonjs/useStyles.js.map +1 -1
  33. package/lib/commonjs/utils/breakpoints.js +18 -20
  34. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  35. package/lib/commonjs/utils/index.js +10 -38
  36. package/lib/commonjs/utils/index.js.map +1 -1
  37. package/lib/commonjs/utils/mq.js +67 -53
  38. package/lib/commonjs/utils/mq.js.map +1 -1
  39. package/lib/commonjs/utils/mqParser.js +86 -0
  40. package/lib/commonjs/utils/mqParser.js.map +1 -0
  41. package/lib/commonjs/utils/styles.js.map +1 -1
  42. package/lib/module/{types/cxx.js → common.js} +8 -6
  43. package/lib/module/common.js.map +1 -0
  44. package/lib/module/{UnistyleRegistry.js → core/UnistyleRegistry.js} +1 -8
  45. package/lib/module/core/UnistyleRegistry.js.map +1 -0
  46. package/lib/module/{Unistyles.js → core/Unistyles.js} +1 -6
  47. package/lib/module/core/Unistyles.js.map +1 -0
  48. package/lib/module/core/UnistylesModule.js.map +1 -0
  49. package/lib/module/{UnistylesRuntime.js → core/UnistylesRuntime.js} +2 -2
  50. package/lib/module/core/UnistylesRuntime.js.map +1 -0
  51. package/lib/module/core/index.js +2 -0
  52. package/lib/module/core/index.js.map +1 -0
  53. package/lib/module/hooks/index.js +2 -1
  54. package/lib/module/hooks/index.js.map +1 -1
  55. package/lib/module/hooks/useInitialTheme.js +10 -0
  56. package/lib/module/hooks/useInitialTheme.js.map +1 -0
  57. package/lib/module/hooks/useUnistyles.js +47 -0
  58. package/lib/module/hooks/useUnistyles.js.map +1 -0
  59. package/lib/module/index.js +11 -18
  60. package/lib/module/index.js.map +1 -1
  61. package/lib/module/types/common.js +2 -0
  62. package/lib/module/types/common.js.map +1 -0
  63. package/lib/module/types/index.js +1 -1
  64. package/lib/module/types/index.js.map +1 -1
  65. package/lib/module/types/mq.js +2 -0
  66. package/lib/module/types/mq.js.map +1 -0
  67. package/lib/module/types/unistyles.js +2 -0
  68. package/lib/module/types/unistyles.js.map +1 -0
  69. package/lib/module/useStyles.js +6 -3
  70. package/lib/module/useStyles.js.map +1 -1
  71. package/lib/module/utils/breakpoints.js +14 -16
  72. package/lib/module/utils/breakpoints.js.map +1 -1
  73. package/lib/module/utils/index.js +2 -2
  74. package/lib/module/utils/index.js.map +1 -1
  75. package/lib/module/utils/mq.js +65 -51
  76. package/lib/module/utils/mq.js.map +1 -1
  77. package/lib/module/utils/mqParser.js +79 -0
  78. package/lib/module/utils/mqParser.js.map +1 -0
  79. package/lib/module/utils/styles.js.map +1 -1
  80. package/lib/typescript/src/common.d.ts +17 -0
  81. package/lib/typescript/src/common.d.ts.map +1 -0
  82. package/lib/typescript/src/{UnistyleRegistry.d.ts → core/UnistyleRegistry.d.ts} +2 -3
  83. package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -0
  84. package/lib/typescript/src/{Unistyles.d.ts → core/Unistyles.d.ts} +0 -3
  85. package/lib/typescript/src/core/Unistyles.d.ts.map +1 -0
  86. package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -0
  87. package/lib/typescript/src/{UnistylesRuntime.d.ts → core/UnistylesRuntime.d.ts} +6 -6
  88. package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -0
  89. package/lib/typescript/src/core/index.d.ts +2 -0
  90. package/lib/typescript/src/core/index.d.ts.map +1 -0
  91. package/lib/typescript/src/hooks/index.d.ts +2 -1
  92. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  93. package/lib/typescript/src/hooks/useInitialTheme.d.ts +3 -0
  94. package/lib/typescript/src/hooks/useInitialTheme.d.ts.map +1 -0
  95. package/lib/typescript/src/hooks/useUnistyles.d.ts +12 -0
  96. package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -0
  97. package/lib/typescript/src/index.d.ts +10 -12
  98. package/lib/typescript/src/index.d.ts.map +1 -1
  99. package/lib/typescript/src/types/breakpoints.d.ts +5 -9
  100. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  101. package/lib/typescript/src/types/common.d.ts +3 -0
  102. package/lib/typescript/src/types/common.d.ts.map +1 -0
  103. package/lib/typescript/src/types/core.d.ts +9 -4
  104. package/lib/typescript/src/types/core.d.ts.map +1 -1
  105. package/lib/typescript/src/types/index.d.ts +5 -4
  106. package/lib/typescript/src/types/index.d.ts.map +1 -1
  107. package/lib/typescript/src/types/mq.d.ts +3 -0
  108. package/lib/typescript/src/types/mq.d.ts.map +1 -0
  109. package/lib/typescript/src/types/{cxx.d.ts → unistyles.d.ts} +4 -23
  110. package/lib/typescript/src/types/unistyles.d.ts.map +1 -0
  111. package/lib/typescript/src/useStyles.d.ts +8 -6
  112. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  113. package/lib/typescript/src/utils/breakpoints.d.ts +2 -2
  114. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  115. package/lib/typescript/src/utils/index.d.ts +2 -2
  116. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  117. package/lib/typescript/src/utils/mq.d.ts +15 -9
  118. package/lib/typescript/src/utils/mq.d.ts.map +1 -1
  119. package/lib/typescript/src/utils/mqParser.d.ts +3 -0
  120. package/lib/typescript/src/utils/mqParser.d.ts.map +1 -0
  121. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  122. package/package.json +1 -1
  123. package/src/common.ts +19 -0
  124. package/src/{UnistyleRegistry.ts → core/UnistyleRegistry.ts} +3 -12
  125. package/src/{Unistyles.ts → core/Unistyles.ts} +2 -9
  126. package/src/{UnistylesRuntime.ts → core/UnistylesRuntime.ts} +4 -4
  127. package/src/core/index.ts +1 -0
  128. package/src/hooks/index.ts +2 -1
  129. package/src/hooks/useInitialTheme.ts +11 -0
  130. package/src/hooks/useUnistyles.ts +55 -0
  131. package/src/index.ts +17 -20
  132. package/src/types/breakpoints.ts +6 -11
  133. package/src/types/common.ts +2 -0
  134. package/src/types/core.ts +10 -4
  135. package/src/types/index.ts +5 -9
  136. package/src/types/mq.ts +3 -0
  137. package/src/types/{cxx.ts → unistyles.ts} +4 -28
  138. package/src/useStyles.ts +15 -8
  139. package/src/utils/breakpoints.ts +13 -12
  140. package/src/utils/index.ts +2 -9
  141. package/src/utils/mq.ts +75 -46
  142. package/src/utils/mqParser.ts +99 -0
  143. package/src/utils/styles.ts +2 -2
  144. package/lib/commonjs/UnistyleRegistry.js.map +0 -1
  145. package/lib/commonjs/Unistyles.js.map +0 -1
  146. package/lib/commonjs/UnistylesEngine.js +0 -26
  147. package/lib/commonjs/UnistylesEngine.js.map +0 -1
  148. package/lib/commonjs/UnistylesModule.js.map +0 -1
  149. package/lib/commonjs/UnistylesRuntime.js.map +0 -1
  150. package/lib/commonjs/hooks/useDimensions.js +0 -10
  151. package/lib/commonjs/hooks/useDimensions.js.map +0 -1
  152. package/lib/commonjs/hooks/useDimensions.web.js +0 -34
  153. package/lib/commonjs/hooks/useDimensions.web.js.map +0 -1
  154. package/lib/commonjs/types/cxx.js.map +0 -1
  155. package/lib/commonjs/types/mediaQueries.js +0 -2
  156. package/lib/commonjs/useInitialTheme.js.map +0 -1
  157. package/lib/commonjs/useUnistyles.js +0 -51
  158. package/lib/commonjs/useUnistyles.js.map +0 -1
  159. package/lib/commonjs/utils/mediaQueries.js +0 -98
  160. package/lib/commonjs/utils/mediaQueries.js.map +0 -1
  161. package/lib/module/UnistyleRegistry.js.map +0 -1
  162. package/lib/module/Unistyles.js.map +0 -1
  163. package/lib/module/UnistylesEngine.js +0 -19
  164. package/lib/module/UnistylesEngine.js.map +0 -1
  165. package/lib/module/UnistylesModule.js.map +0 -1
  166. package/lib/module/UnistylesRuntime.js.map +0 -1
  167. package/lib/module/hooks/useDimensions.js +0 -3
  168. package/lib/module/hooks/useDimensions.js.map +0 -1
  169. package/lib/module/hooks/useDimensions.web.js +0 -27
  170. package/lib/module/hooks/useDimensions.web.js.map +0 -1
  171. package/lib/module/types/cxx.js.map +0 -1
  172. package/lib/module/types/mediaQueries.js +0 -2
  173. package/lib/module/useInitialTheme.js +0 -6
  174. package/lib/module/useInitialTheme.js.map +0 -1
  175. package/lib/module/useUnistyles.js +0 -44
  176. package/lib/module/useUnistyles.js.map +0 -1
  177. package/lib/module/utils/mediaQueries.js +0 -85
  178. package/lib/module/utils/mediaQueries.js.map +0 -1
  179. package/lib/typescript/src/UnistyleRegistry.d.ts.map +0 -1
  180. package/lib/typescript/src/Unistyles.d.ts.map +0 -1
  181. package/lib/typescript/src/UnistylesEngine.d.ts +0 -11
  182. package/lib/typescript/src/UnistylesEngine.d.ts.map +0 -1
  183. package/lib/typescript/src/UnistylesModule.d.ts.map +0 -1
  184. package/lib/typescript/src/UnistylesRuntime.d.ts.map +0 -1
  185. package/lib/typescript/src/hooks/useDimensions.d.ts +0 -3
  186. package/lib/typescript/src/hooks/useDimensions.d.ts.map +0 -1
  187. package/lib/typescript/src/hooks/useDimensions.web.d.ts +0 -3
  188. package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +0 -1
  189. package/lib/typescript/src/types/cxx.d.ts.map +0 -1
  190. package/lib/typescript/src/types/mediaQueries.d.ts +0 -10
  191. package/lib/typescript/src/types/mediaQueries.d.ts.map +0 -1
  192. package/lib/typescript/src/useInitialTheme.d.ts +0 -3
  193. package/lib/typescript/src/useInitialTheme.d.ts.map +0 -1
  194. package/lib/typescript/src/useUnistyles.d.ts +0 -10
  195. package/lib/typescript/src/useUnistyles.d.ts.map +0 -1
  196. package/lib/typescript/src/utils/mediaQueries.d.ts +0 -11
  197. package/lib/typescript/src/utils/mediaQueries.d.ts.map +0 -1
  198. package/src/UnistylesEngine.ts +0 -24
  199. package/src/hooks/useDimensions.ts +0 -4
  200. package/src/hooks/useDimensions.web.ts +0 -34
  201. package/src/types/mediaQueries.ts +0 -15
  202. package/src/useInitialTheme.ts +0 -7
  203. package/src/useUnistyles.ts +0 -61
  204. package/src/utils/mediaQueries.ts +0 -152
  205. /package/lib/commonjs/{UnistylesModule.js → core/UnistylesModule.js} +0 -0
  206. /package/lib/module/{UnistylesModule.js → core/UnistylesModule.js} +0 -0
  207. /package/lib/typescript/src/{UnistylesModule.d.ts → core/UnistylesModule.d.ts} +0 -0
  208. /package/src/{UnistylesModule.ts → core/UnistylesModule.ts} +0 -0
@@ -1,15 +1,12 @@
1
1
  import { UnistylesRuntime } from './UnistylesRuntime';
2
- import { UnistylesBuiltInEngine } from './UnistylesEngine';
3
2
  import { UnistyleRegistry } from './UnistyleRegistry';
4
3
  declare class Unistyles {
5
4
  private _runtime;
6
- private _engine;
7
5
  private _registry;
8
6
  private _bridge;
9
7
  constructor();
10
8
  get registry(): UnistyleRegistry;
11
9
  get runtime(): UnistylesRuntime;
12
- get engine(): UnistylesBuiltInEngine;
13
10
  }
14
11
  export declare const unistyles: Unistyles;
15
12
  export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Unistyles.d.ts","sourceRoot":"","sources":["../../../../src/core/Unistyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAIrD,cAAM,SAAS;IACX,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAAiB;;IAehC,IAAW,QAAQ,qBAElB;IAED,IAAW,OAAO,qBAEjB;CACJ;AAED,eAAO,MAAM,SAAS,WAAkB,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnistylesModule.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IACzB,OAAO,IAAI,OAAO,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,eAAe,uBAAoD,CAAA"}
@@ -1,16 +1,16 @@
1
- import type { UnistylesBridge } from './types';
1
+ import { ScreenOrientation } from '../common';
2
+ import type { UnistylesBridge } from '../types';
3
+ import type { UnistylesThemes } from '../global';
2
4
  import type { UnistyleRegistry } from './UnistyleRegistry';
3
- import { ScreenOrientation } from './types';
4
- import type { UnistylesThemes } from './global';
5
5
  export declare class UnistylesRuntime {
6
6
  private unistylesBridge;
7
7
  private registry;
8
8
  constructor(unistylesBridge: UnistylesBridge, registry: UnistyleRegistry);
9
- get colorScheme(): import("./types").ColorSchemeName;
9
+ get colorScheme(): import("../types").ColorSchemeName;
10
10
  get hasAdaptiveThemes(): boolean;
11
- get sortedBreakpoints(): [keyof import("./global").UnistylesBreakpoints, number | undefined][];
11
+ get sortedBreakpoints(): [keyof import("../global").UnistylesBreakpoints, number | undefined][];
12
12
  get themeName(): never;
13
- get breakpoint(): keyof import("./global").UnistylesBreakpoints;
13
+ get breakpoint(): keyof import("../global").UnistylesBreakpoints;
14
14
  get screen(): {
15
15
  width: number;
16
16
  height: number;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,WAAW,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,QAAQ;gBAAlD,eAAe,EAAE,eAAe,EAAU,QAAQ,EAAE,gBAAgB;IAExF,IAAW,WAAW,uCAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,iBAAiB,2EAE3B;IAED,IAAW,SAAS,UAEnB;IAED,IAAW,UAAU,mDAEpB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,WAAW,sBAQrB;IAEM,QAAQ,SAAU,MAAM,eAAe,aAQ7C;IAEM,QAAQ,YAAa,MAAM,eAAe,WAUhD;IAEM,iBAAiB,WAAY,OAAO,UAE1C;IAED,OAAO,CAAC,QAAQ,CAAgE;CACnF"}
@@ -0,0 +1,2 @@
1
+ export { unistyles } from './Unistyles';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
@@ -1,2 +1,3 @@
1
- export { useDimensions } from './useDimensions';
1
+ export { useInitialTheme } from './useInitialTheme';
2
+ export { useUnistyles } from './useUnistyles';
2
3
  //# 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,aAAa,EAAE,MAAM,iBAAiB,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"}
@@ -0,0 +1,3 @@
1
+ import type { UnistylesThemes } from '../global';
2
+ export declare const useInitialTheme: (forName: keyof UnistylesThemes) => void;
3
+ //# sourceMappingURL=useInitialTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInitialTheme.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useInitialTheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEhD,eAAO,MAAM,eAAe,YAAa,MAAM,eAAe,SAM7D,CAAA"}
@@ -0,0 +1,12 @@
1
+ export declare const useUnistyles: () => {
2
+ theme: never;
3
+ layout: {
4
+ breakpoint: keyof import("..").UnistylesBreakpoints;
5
+ orientation: import("../common").ScreenOrientation;
6
+ screenSize: {
7
+ width: number;
8
+ height: number;
9
+ };
10
+ };
11
+ };
12
+ //# sourceMappingURL=useUnistyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;CA8CxB,CAAA"}
@@ -1,17 +1,15 @@
1
+ import { mq } from './utils';
2
+ import { useInitialTheme } from './hooks';
1
3
  import type { UnistylesThemes, UnistylesBreakpoints } from './global';
2
- import { ScreenOrientation } from './types';
3
- export { mq } from './utils';
4
- export { useInitialTheme } from './useInitialTheme';
5
- export { useStyles } from './useStyles';
6
- export { createStyleSheet } from './createStyleSheet';
7
- declare const UnistylesRuntime: import("./UnistylesRuntime").UnistylesRuntime;
4
+ import { ScreenOrientation } from './common';
5
+ import { useStyles } from './useStyles';
6
+ import { createStyleSheet } from './createStyleSheet';
8
7
  declare const UnistylesRegistry: {
9
- addThemes: (themes: UnistylesThemes) => import("./UnistyleRegistry").UnistyleRegistry;
10
- addBreakpoints: (breakpoints: UnistylesBreakpoints) => import("./UnistyleRegistry").UnistyleRegistry;
11
- addConfig: (config: import("./types").UnistylesConfig) => import("./UnistyleRegistry").UnistyleRegistry;
8
+ addThemes: (themes: UnistylesThemes) => import("./core/UnistyleRegistry").UnistyleRegistry;
9
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => import("./core/UnistyleRegistry").UnistyleRegistry;
10
+ addConfig: (config: import("./types").UnistylesConfig) => import("./core/UnistyleRegistry").UnistyleRegistry;
12
11
  };
13
- export declare const __dangerouslyUnregister: () => void;
14
- export { UnistylesRuntime, UnistylesRegistry };
15
- export { ScreenOrientation };
12
+ declare const UnistylesRuntime: import("./core/UnistylesRuntime").UnistylesRuntime;
13
+ export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, UnistylesRegistry, UnistylesRuntime };
16
14
  export type { UnistylesThemes, UnistylesBreakpoints };
17
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"m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15 @@
1
1
  import type { OpaqueColorValue } from 'react-native';
2
2
  import type { UnistylesBreakpoints } from '../global';
3
- import type { MediaQueries } from './mediaQueries';
4
- export type ScreenSize = {
5
- width: number;
6
- height: number;
7
- };
8
- export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST;
3
+ import type { MediaQuery } from './mq';
9
4
  type WithEmptyObject<V> = keyof V extends never ? {} : V;
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> : {
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> : {
11
6
  [K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R> : T[K] extends object ? ExtractBreakpoints<T[K]> : T[K];
12
7
  };
13
- 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> ? {
14
- [K in keyof T as K extends MediaQueries ? keyof UnistylesBreakpoints & string : K]: RemoveKeysWithPrefix<T[K]>;
8
+ 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> ? {
9
+ [K in keyof T as K extends MediaQuery ? keyof UnistylesBreakpoints & string : K]: RemoveKeysWithPrefix<T[K]>;
15
10
  } : {
16
11
  [K in keyof T]: RemoveKeysWithPrefix<T[K]>;
17
12
  } : T;
13
+ export type ReactNativeStyleSheet<T> = ExtractBreakpoints<RemoveKeysWithPrefix<T>>;
18
14
  export {};
19
15
  //# sourceMappingURL=breakpoints.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bre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,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,GACpD,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,GACrC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACf,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACxB,CAAC,CAAC,CAAC,CAAC;CACjB,CAAA;AAET,KAAK,oBAAoB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,GACnE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,CAAC,GACnD,CAAC,SAAS,MAAM,GACZ,CAAC,SAAS,gBAAgB,GACtB,MAAM,GACN,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAC9B;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,UAAU,GAAG,MAAM,oBAAoB,GAAG,MAAM,GAAG,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAChH;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtD,CAAC,CAAA;AAEX,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,kBAAkB,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export type Optional<T> = T | undefined;
2
+ export type Nullable<T> = T | null;
3
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/types/common.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAA;AACvC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA"}
@@ -1,11 +1,15 @@
1
1
  import type { MatrixTransform, PerpectiveTransform, RotateTransform, RotateXTransform, RotateYTransform, RotateZTransform, ScaleTransform, ScaleXTransform, ScaleYTransform, SkewXTransform, SkewYTransform, TranslateXTransform, TranslateYTransform } from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
2
2
  import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
3
- import type { MediaQueries } from './mediaQueries';
4
3
  import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
4
+ import type { MediaQuery } from './mq';
5
5
  type ShadowOffset = {
6
6
  width: number;
7
7
  height: number;
8
8
  };
9
+ export type ScreenSize = {
10
+ width: number;
11
+ height: number;
12
+ };
9
13
  type TransformStyles = PerpectiveTransform & RotateTransform & RotateXTransform & RotateYTransform & RotateZTransform & ScaleTransform & ScaleXTransform & ScaleYTransform & TranslateXTransform & TranslateYTransform & SkewXTransform & SkewYTransform & MatrixTransform;
10
14
  type UnistyleNested = {
11
15
  shadowOffset?: DeepUniStyle<ShadowOffset>;
@@ -13,9 +17,9 @@ type UnistyleNested = {
13
17
  transform?: Array<DeepUniStyle<TransformStyles>>;
14
18
  };
15
19
  type UniStyle<V> = {
16
- [innerKey in keyof UnistylesBreakpoints]: V;
20
+ [innerKey in keyof UnistylesBreakpoints]?: V;
17
21
  } | {
18
- [innerKey in MediaQueries]: V;
22
+ [innerKey in MediaQuery]: V;
19
23
  };
20
24
  type DeepUniStyle<T> = {
21
25
  [K in keyof T]?: UniStyle<T[K]> | T[K];
@@ -28,7 +32,8 @@ export type StaticStyles = UnistyleView | UnistyleText | UnistyleImage & Unistyl
28
32
  export type CustomNamedStyles<T> = {
29
33
  [K in keyof T]: T[K] extends (...args: infer A) => StaticStyles ? (...args: A) => StaticStyles : StaticStyles;
30
34
  };
31
- export type NestedKeys = Array<[keyof UnistylesBreakpoints | MediaQueries, string | number | undefined]>;
35
+ export type NestedKeys = Array<[keyof UnistylesBreakpoints | MediaQuery, string | number | undefined]>;
32
36
  export type UnistylesTheme = UnistylesThemes[keyof UnistylesThemes];
37
+ export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST;
33
38
  export {};
34
39
  //# 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,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEtE,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,GAAG;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IAC1C,gBAAgB,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IAC9C,SAAS,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAA;CACnD,CAAA;AAED,KAAK,QAAQ,CAAC,CAAC,IAAI;KACd,QAAQ,IAAI,M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CAAC,CAAC;CACzC,CAAA;AAGD,KAAK,WAAW,GAAG,cAAc,GAAG,WAAW,GAAG,kBAAkB,CAAA;AAEpE,KAAK,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAA;AAC9D,KAAK,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAA;AAC9D,KAAK,aAAa,GAAG,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAA;AAEhE,MAAM,MAAM,YAAY,GAClB,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,cAAc,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,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;AACtG,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,eAAe,CAAC,CAAA;AACnE,MAAM,MAAM,mBAAmB,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,EAAE,CAAA"}
@@ -1,6 +1,7 @@
1
1
  export * from './normalizer';
2
- export * from './cxx';
3
- export type { CustomNamedStyles, NestedKeys, UnistylesTheme } from './core';
4
- export type { MediaQueries } from './mediaQueries';
5
- export type { ScreenSize, CreateStylesFactory, ExtractBreakpoints, RemoveKeysWithPrefix } from './breakpoints';
2
+ export * from './unistyles';
3
+ export type { Optional, Nullable } from './common';
4
+ export type { MediaQuery } from './mq';
5
+ export type { CustomNamedStyles, NestedKeys, UnistylesTheme, CreateStylesFactory, ScreenSize } from './core';
6
+ export type { ReactNativeStyleSheet } from './breakpoints';
6
7
  //# 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,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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAClD,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACtC,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAC5G,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { MQSymbol } from '../utils';
2
+ export type MediaQuery = typeof MQSymbol;
3
+ //# sourceMappingURL=mq.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mq.d.ts","sourceRoot":"","sources":["../../../../src/types/mq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,MAAM,MAAM,UAAU,GAAG,OAAO,QAAQ,CAAA"}
@@ -1,16 +1,11 @@
1
+ import { CxxUnistylesEventTypes, ScreenOrientation } from '../common';
1
2
  import type { UnistylesThemes, UnistylesBreakpoints } from '../global';
2
- import type { ScreenSize } from './breakpoints';
3
- import type { NestedKeys } from './core';
4
- export type Optional<T> = T | undefined;
5
- export type Nullable<T> = T | null;
3
+ import type { NestedKeys, ScreenSize } from './core';
4
+ import type { Optional } from './common';
6
5
  export type ColorSchemeName = Optional<'light' | 'dark'>;
7
6
  export type UnistylesConfig = {
8
7
  adaptiveThemes?: boolean;
9
8
  };
10
- export declare enum ScreenOrientation {
11
- Portrait = 1,
12
- Landscape = 2
13
- }
14
9
  export type UnistylesBridge = {
15
10
  screenWidth: number;
16
11
  screenHeight: number;
@@ -23,12 +18,7 @@ export type UnistylesBridge = {
23
18
  useBreakpoints(breakpoints: UnistylesBreakpoints): void;
24
19
  useTheme(name: keyof UnistylesThemes): void;
25
20
  useAdaptiveThemes(enable: boolean): void;
26
- unregister(): void;
27
21
  };
28
- export declare enum CxxUnistylesEventTypes {
29
- Theme = "theme",
30
- Layout = "layout"
31
- }
32
22
  export type UnistylesThemeEvent = {
33
23
  type: CxxUnistylesEventTypes.Theme;
34
24
  payload: {
@@ -44,16 +34,7 @@ export type UnistylesMobileLayoutEvent = {
44
34
  };
45
35
  };
46
36
  export type UnistylesEvents = UnistylesThemeEvent | UnistylesMobileLayoutEvent;
47
- export declare enum UnistylesError {
48
- RuntimeUnavailable = "UNISTYLES_ERROR_RUNTIME_UNAVAILABLE",
49
- ThemeNotFound = "UNISTYLES_ERROR_THEME_NOT_FOUND",
50
- ThemeNotRegistered = "UNISTYLES_ERROR_THEME_NOT_REGISTERED",
51
- ThemesCannotBeEmpty = "UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY",
52
- BreakpointsCannotBeEmpty = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY",
53
- BreakpointsMustStartFromZero = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO"
54
- }
55
37
  export interface UnistylesEngine {
56
- isMediaQuery(key: string): boolean;
57
38
  didMatchMediaQuery(keys: NestedKeys): Optional<string>;
58
39
  }
59
- //# sourceMappingURL=cxx.d.ts.map
40
+ //# sourceMappingURL=unistyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unistyles.d.ts","sourceRoot":"","sources":["../../../../src/types/unistyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,CAAA;AAExD,MAAM,MAAM,eAAe,GAAG;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAE1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,MAAM,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,oBAAoB,CAAC;IACvC,WAAW,EAAE,eAAe,CAAC;IAC7B,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAG7G,MAAM,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC,CAAC;IACrC,cAAc,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;IAC5C,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,EAAE,sBAAsB,CAAC,KAAK,CAAC;IACnC,OAAO,EAAE;QACL,SAAS,EAAE,MAAM,eAAe,CAAA;KACnC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC;QACnB,UAAU,EAAE,MAAM,oBAAoB,CAAC;QACvC,WAAW,EAAE,iBAAiB,CAAA;KACjC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,0BAA0B,CAAA;AAE9E,MAAM,WAAW,eAAe;IAC5B,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC1D"}
@@ -1,8 +1,10 @@
1
- import type { CreateStylesFactory, CustomNamedStyles, ExtractBreakpoints, RemoveKeysWithPrefix } from './types';
2
- import type { UnistylesTheme } from './types';
3
- export declare const useStyles: <ST extends CustomNamedStyles<ST>>(stylesheet?: ST | CreateStylesFactory<ST, never> | undefined) => {
4
- theme: never;
5
- breakpoint: keyof import("./global").UnistylesBreakpoints;
6
- styles: ExtractBreakpoints<RemoveKeysWithPrefix<ST>>;
1
+ import type { CreateStylesFactory, CustomNamedStyles, ReactNativeStyleSheet, UnistylesTheme } from './types';
2
+ import type { UnistylesBreakpoints } from './global';
3
+ type ParsedStylesheet<ST extends CustomNamedStyles<ST>> = {
4
+ theme: UnistylesTheme;
5
+ breakpoint: keyof UnistylesBreakpoints;
6
+ styles: ReactNativeStyleSheet<ST>;
7
7
  };
8
+ export declare const useStyles: <ST extends CustomNamedStyles<ST>>(stylesheet?: ST | CreateStylesFactory<ST, never> | undefined) => ParsedStylesheet<ST>;
9
+ export {};
8
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,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
+ {"version":3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../src/useStyles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE5G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD,KAAK,gBAAgB,CAAC,EAAE,SAAS,iBAAiB,CAAC,EAAE,CAAC,IAAI;IACtD,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,MAAM,oBAAoB,CAAC;IACvC,MAAM,EAAE,qBAAqB,CAAC,EAAE,CAAC,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,SAAS,0HAuCrB,CAAA"}
@@ -1,6 +1,6 @@
1
- import type { MediaQueries } from '../types';
1
+ import type { MediaQuery } from '../types';
2
2
  import type { UnistylesBreakpoints } from '../global';
3
3
  export declare const sortAndValidateBreakpoints: (breakpoints: UnistylesBreakpoints) => UnistylesBreakpoints;
4
4
  export declare const getBreakpointFromScreenWidth: (width: number, breakpointEntries: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>) => keyof UnistylesBreakpoints & string;
5
- export declare const getValueForBreakpoint: (value: Record<keyof UnistylesBreakpoints | MediaQueries, string | number | undefined>) => string | number | undefined;
5
+ export declare const getValueForBreakpoint: (value: Record<keyof UnistylesBreakpoints | MediaQuery, string | number | undefined>) => string | number | undefined;
6
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,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"}
1
+ {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/utils/breakpoints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,UAAU,CAAA;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAIrD,eAAO,MAAM,0BAA0B,gBAAiB,oBAAoB,KAAG,oBAuB9E,CAAA;AAED,eAAO,MAAM,4BAA4B,UAAW,MAAM,qBAAqB,MAAM,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,KAAG,MAAM,oBAAoB,GAAG,MAcnM,CAAA;AAED,eAAO,MAAM,qBAAqB,UAAW,OAAO,MAAM,oBAAoB,GAAG,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,KAAG,MAAM,GAAG,MAAM,GAAG,SAmD7I,CAAA"}
@@ -1,8 +1,8 @@
1
1
  export { normalizeStyles } from './normalizeStyles';
2
2
  export * from './normalizer';
3
- export { mq } from './mq';
3
+ export { mq, MQSymbol } from './mq';
4
+ export { getKeyForUnistylesMediaQuery } from './mqParser';
4
5
  export { getBreakpointFromScreenWidth, sortAndValidateBreakpoints, getValueForBreakpoint } from './breakpoints';
5
6
  export { proxifyFunction, parseStyle } from './styles';
6
7
  export { isServer, Orientation } from './common';
7
- export { extractValues, getKeyForCustomMediaQuery, isMediaQuery, isWithinTheHeight, isWithinTheWidth, isWithinTheWidthAndHeight } from './mediaQueries';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC/G,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA"}
@@ -1,15 +1,21 @@
1
+ import type { MediaQuery, Nullable } from '../types';
1
2
  import type { UnistylesBreakpoints } from '../global';
2
- declare const MQSymbol: unique symbol;
3
+ export declare const MQSymbol: unique symbol;
3
4
  type MQValue = keyof UnistylesBreakpoints | number;
5
+ type MQHandler = {
6
+ w(wMin?: Nullable<MQValue>, wMax?: MQValue): WidthHandler;
7
+ width(wMin?: Nullable<MQValue>, wMax?: MQValue): WidthHandler;
8
+ h(hMin?: Nullable<MQValue>, hMax?: MQValue): HeightHandler;
9
+ height(hMin?: Nullable<MQValue>, hMax?: MQValue): HeightHandler;
10
+ };
4
11
  type HeightHandler = {
5
- width(wMin?: MQValue, wMax?: MQValue): typeof MQSymbol;
6
- } & typeof MQSymbol;
12
+ w(wMin?: Nullable<MQValue>, wMax?: MQValue): MediaQuery;
13
+ width(wMin?: Nullable<MQValue>, wMax?: MQValue): MediaQuery;
14
+ } & MediaQuery;
7
15
  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
- };
16
+ h(hMin?: Nullable<MQValue>, hMax?: MQValue): MediaQuery;
17
+ height(hMin?: Nullable<MQValue>, hMax?: MQValue): MediaQuery;
18
+ } & MediaQuery;
19
+ export declare const mq: MQHandler;
14
20
  export {};
15
21
  //# 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,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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AAE,OAAO,GAAG,UAAU,CAAC;IACxD,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAA;CAC9D,GAAG,UAAU,CAAA;AAEd,KAAK,YAAY,GAAG;IAChB,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IACxD,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAA;CAC/D,GAAG,UAAU,CAAA;AAsEd,eAAO,MAAM,EAAE,WAYb,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { NestedKeys, Optional, ScreenSize } from '../types';
2
+ export declare const getKeyForUnistylesMediaQuery: (mediaQueries: NestedKeys, screenSize: ScreenSize) => Optional<string>;
3
+ //# sourceMappingURL=mqParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mqParser.d.ts","sourceRoot":"","sources":["../../../../src/utils/mqParser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAkFhE,eAAO,MAAM,4BAA4B,yCAA0C,UAAU,qBAgB5F,CAAA"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAc,MAAM,UAAU,CAAA;AAGzE,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "2.0.0-alpha.7",
3
+ "version": "2.0.0-alpha.9",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
package/src/common.ts ADDED
@@ -0,0 +1,19 @@
1
+ export enum CxxUnistylesEventTypes {
2
+ Theme = 'theme',
3
+ Layout = 'layout'
4
+ }
5
+
6
+ export enum UnistylesError {
7
+ RuntimeUnavailable = 'UNISTYLES_ERROR_RUNTIME_UNAVAILABLE',
8
+ ThemeNotFound = 'UNISTYLES_ERROR_THEME_NOT_FOUND',
9
+ ThemeNotRegistered = 'UNISTYLES_ERROR_THEME_NOT_REGISTERED',
10
+ ThemesCannotBeEmpty = 'UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY',
11
+ BreakpointsCannotBeEmpty = 'UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY',
12
+ BreakpointsMustStartFromZero = 'UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO',
13
+ }
14
+
15
+ // todo to string?
16
+ export enum ScreenOrientation {
17
+ Portrait = 1,
18
+ Landscape = 2
19
+ }
@@ -1,5 +1,5 @@
1
- import type { UnistylesBridge, UnistylesConfig } from './types'
2
- import type { UnistylesThemes, UnistylesBreakpoints } from './global'
1
+ import type { UnistylesBridge, UnistylesConfig } from '../types'
2
+ import type { UnistylesBreakpoints, UnistylesThemes } from '../global'
3
3
 
4
4
  export class UnistyleRegistry {
5
5
  public config: UnistylesConfig = {}
@@ -22,6 +22,7 @@ export class UnistyleRegistry {
22
22
  }
23
23
 
24
24
  public addBreakpoints = (breakpoints: UnistylesBreakpoints) => {
25
+ this.breakpoints = breakpoints
25
26
  this.unistylesBridge.useBreakpoints(breakpoints)
26
27
  this.sortedBreakpointPairs = this.unistylesBridge.sortedBreakpointPairs
27
28
 
@@ -37,14 +38,4 @@ export class UnistyleRegistry {
37
38
 
38
39
  return this
39
40
  }
40
-
41
- public dangerouslyUnregister = () => {
42
- this.config = {}
43
- this.themeNames = []
44
- this.themes = {} as UnistylesThemes
45
- this.breakpoints = {} as UnistylesBreakpoints
46
- this.sortedBreakpointPairs = []
47
-
48
- this.unistylesBridge.unregister()
49
- }
50
41
  }
@@ -1,13 +1,11 @@
1
1
  import { UnistylesModule } from './UnistylesModule'
2
2
  import { UnistylesRuntime } from './UnistylesRuntime'
3
- import { UnistylesBuiltInEngine } from './UnistylesEngine'
4
3
  import { UnistyleRegistry } from './UnistyleRegistry'
5
- import type { UnistylesBridge } from './types'
6
- import { UnistylesError } from './types'
4
+ import type { UnistylesBridge } from '../types'
5
+ import { UnistylesError } from '../common'
7
6
 
8
7
  class Unistyles {
9
8
  private _runtime: UnistylesRuntime
10
- private _engine: UnistylesBuiltInEngine
11
9
  private _registry: UnistyleRegistry
12
10
  private _bridge: UnistylesBridge
13
11
 
@@ -22,7 +20,6 @@ class Unistyles {
22
20
  this._bridge = global.__UNISTYLES__ as UnistylesBridge
23
21
  this._registry = new UnistyleRegistry(this._bridge)
24
22
  this._runtime = new UnistylesRuntime(this._bridge, this._registry)
25
- this._engine = new UnistylesBuiltInEngine(this._registry, this._runtime)
26
23
  }
27
24
 
28
25
  public get registry() {
@@ -32,10 +29,6 @@ class Unistyles {
32
29
  public get runtime() {
33
30
  return this._runtime
34
31
  }
35
-
36
- public get engine() {
37
- return this._engine
38
- }
39
32
  }
40
33
 
41
34
  export const unistyles = new Unistyles()
@@ -1,7 +1,7 @@
1
- import type { UnistylesBridge } from './types'
1
+ import { ScreenOrientation, UnistylesError } from '../common'
2
+ import type { UnistylesBridge } from '../types'
3
+ import type { UnistylesThemes } from '../global'
2
4
  import type { UnistyleRegistry } from './UnistyleRegistry'
3
- import { ScreenOrientation, UnistylesError } from './types'
4
- import type { UnistylesThemes } from './global'
5
5
 
6
6
  export class UnistylesRuntime {
7
7
  constructor(private unistylesBridge: UnistylesBridge, private registry: UnistyleRegistry) {}
@@ -44,7 +44,7 @@ export class UnistylesRuntime {
44
44
  }
45
45
 
46
46
  public setTheme = (name: keyof UnistylesThemes) => {
47
- if (name !== this.themeName && this.hasTheme(name)) {
47
+ if (this.hasTheme(name)) {
48
48
  this.unistylesBridge.useTheme(name)
49
49
 
50
50
  return true
@@ -0,0 +1 @@
1
+ export { unistyles } from './Unistyles'
@@ -1 +1,2 @@
1
- export { useDimensions } from './useDimensions'
1
+ export { useInitialTheme } from './useInitialTheme'
2
+ export { useUnistyles } from './useUnistyles'
@@ -0,0 +1,11 @@
1
+ import { useMemo } from 'react'
2
+ import { unistyles } from '../core'
3
+ import type { UnistylesThemes } from '../global'
4
+
5
+ export const useInitialTheme = (forName: keyof UnistylesThemes) => {
6
+ useMemo(() => {
7
+ if (!unistyles.runtime.themeName) {
8
+ unistyles.runtime.setTheme(forName)
9
+ }
10
+ }, [])
11
+ }