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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. package/lib/commonjs/{types/cxx.js → common.js} +6 -6
  2. package/lib/commonjs/common.js.map +1 -0
  3. package/lib/commonjs/core/UnistyleRegistry.js.map +1 -0
  4. package/lib/commonjs/{Unistyles.js → core/Unistyles.js} +2 -7
  5. package/lib/commonjs/core/Unistyles.js.map +1 -0
  6. package/lib/commonjs/core/UnistylesModule.js.map +1 -0
  7. package/lib/commonjs/{UnistylesRuntime.js → core/UnistylesRuntime.js} +5 -5
  8. package/lib/commonjs/core/UnistylesRuntime.js.map +1 -0
  9. package/lib/commonjs/core/index.js +13 -0
  10. package/lib/commonjs/core/index.js.map +1 -0
  11. package/lib/commonjs/hooks/index.js +10 -3
  12. package/lib/commonjs/hooks/index.js.map +1 -1
  13. package/lib/commonjs/{useInitialTheme.js → hooks/useInitialTheme.js} +2 -2
  14. package/lib/commonjs/hooks/useInitialTheme.js.map +1 -0
  15. package/lib/commonjs/hooks/useUnistyles.js +54 -0
  16. package/lib/commonjs/hooks/useUnistyles.js.map +1 -0
  17. package/lib/commonjs/index.js +8 -8
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/commonjs/types/common.js +2 -0
  20. package/lib/commonjs/types/{mediaQueries.js.map → common.js.map} +1 -1
  21. package/lib/commonjs/types/index.js +4 -4
  22. package/lib/commonjs/types/index.js.map +1 -1
  23. package/lib/commonjs/types/mq.js +6 -0
  24. package/lib/{module/types/mediaQueries.js.map → commonjs/types/mq.js.map} +1 -1
  25. package/lib/commonjs/types/unistyles.js +6 -0
  26. package/lib/commonjs/types/unistyles.js.map +1 -0
  27. package/lib/commonjs/useStyles.js +7 -4
  28. package/lib/commonjs/useStyles.js.map +1 -1
  29. package/lib/commonjs/utils/breakpoints.js +18 -20
  30. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  31. package/lib/commonjs/utils/index.js +10 -38
  32. package/lib/commonjs/utils/index.js.map +1 -1
  33. package/lib/commonjs/utils/mq.js +67 -53
  34. package/lib/commonjs/utils/mq.js.map +1 -1
  35. package/lib/commonjs/utils/mqParser.js +86 -0
  36. package/lib/commonjs/utils/mqParser.js.map +1 -0
  37. package/lib/commonjs/utils/styles.js.map +1 -1
  38. package/lib/module/{types/cxx.js → common.js} +6 -6
  39. package/lib/module/common.js.map +1 -0
  40. package/lib/module/core/UnistyleRegistry.js.map +1 -0
  41. package/lib/module/{Unistyles.js → core/Unistyles.js} +1 -6
  42. package/lib/module/core/Unistyles.js.map +1 -0
  43. package/lib/module/core/UnistylesModule.js.map +1 -0
  44. package/lib/module/{UnistylesRuntime.js → core/UnistylesRuntime.js} +1 -1
  45. package/lib/module/core/UnistylesRuntime.js.map +1 -0
  46. package/lib/module/core/index.js +2 -0
  47. package/lib/module/core/index.js.map +1 -0
  48. package/lib/module/hooks/index.js +2 -1
  49. package/lib/module/hooks/index.js.map +1 -1
  50. package/lib/module/{useInitialTheme.js → hooks/useInitialTheme.js} +1 -1
  51. package/lib/module/hooks/useInitialTheme.js.map +1 -0
  52. package/lib/module/hooks/useUnistyles.js +47 -0
  53. package/lib/module/hooks/useUnistyles.js.map +1 -0
  54. package/lib/module/index.js +7 -7
  55. package/lib/module/index.js.map +1 -1
  56. package/lib/module/types/common.js +2 -0
  57. package/lib/module/types/common.js.map +1 -0
  58. package/lib/module/types/index.js +1 -1
  59. package/lib/module/types/index.js.map +1 -1
  60. package/lib/module/types/mq.js +2 -0
  61. package/lib/module/types/mq.js.map +1 -0
  62. package/lib/module/types/unistyles.js +2 -0
  63. package/lib/module/types/unistyles.js.map +1 -0
  64. package/lib/module/useStyles.js +6 -3
  65. package/lib/module/useStyles.js.map +1 -1
  66. package/lib/module/utils/breakpoints.js +14 -16
  67. package/lib/module/utils/breakpoints.js.map +1 -1
  68. package/lib/module/utils/index.js +2 -2
  69. package/lib/module/utils/index.js.map +1 -1
  70. package/lib/module/utils/mq.js +65 -51
  71. package/lib/module/utils/mq.js.map +1 -1
  72. package/lib/module/utils/mqParser.js +79 -0
  73. package/lib/module/utils/mqParser.js.map +1 -0
  74. package/lib/module/utils/styles.js.map +1 -1
  75. package/lib/typescript/src/common.d.ts +17 -0
  76. package/lib/typescript/src/common.d.ts.map +1 -0
  77. package/lib/typescript/src/{UnistyleRegistry.d.ts → core/UnistyleRegistry.d.ts} +2 -2
  78. package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -0
  79. package/lib/typescript/src/{Unistyles.d.ts → core/Unistyles.d.ts} +0 -3
  80. package/lib/typescript/src/core/Unistyles.d.ts.map +1 -0
  81. package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -0
  82. package/lib/typescript/src/{UnistylesRuntime.d.ts → core/UnistylesRuntime.d.ts} +6 -6
  83. package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -0
  84. package/lib/typescript/src/core/index.d.ts +2 -0
  85. package/lib/typescript/src/core/index.d.ts.map +1 -0
  86. package/lib/typescript/src/hooks/index.d.ts +2 -1
  87. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  88. package/lib/typescript/src/hooks/useInitialTheme.d.ts +3 -0
  89. package/lib/typescript/src/hooks/useInitialTheme.d.ts.map +1 -0
  90. package/lib/typescript/src/hooks/useUnistyles.d.ts +12 -0
  91. package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -0
  92. package/lib/typescript/src/index.d.ts +10 -10
  93. package/lib/typescript/src/index.d.ts.map +1 -1
  94. package/lib/typescript/src/types/breakpoints.d.ts +5 -9
  95. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  96. package/lib/typescript/src/types/common.d.ts +3 -0
  97. package/lib/typescript/src/types/common.d.ts.map +1 -0
  98. package/lib/typescript/src/types/core.d.ts +9 -4
  99. package/lib/typescript/src/types/core.d.ts.map +1 -1
  100. package/lib/typescript/src/types/index.d.ts +5 -4
  101. package/lib/typescript/src/types/index.d.ts.map +1 -1
  102. package/lib/typescript/src/types/mq.d.ts +3 -0
  103. package/lib/typescript/src/types/mq.d.ts.map +1 -0
  104. package/lib/typescript/src/types/{cxx.d.ts → unistyles.d.ts} +4 -22
  105. package/lib/typescript/src/types/unistyles.d.ts.map +1 -0
  106. package/lib/typescript/src/useStyles.d.ts +8 -6
  107. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  108. package/lib/typescript/src/utils/breakpoints.d.ts +2 -2
  109. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  110. package/lib/typescript/src/utils/index.d.ts +2 -2
  111. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  112. package/lib/typescript/src/utils/mq.d.ts +15 -9
  113. package/lib/typescript/src/utils/mq.d.ts.map +1 -1
  114. package/lib/typescript/src/utils/mqParser.d.ts +3 -0
  115. package/lib/typescript/src/utils/mqParser.d.ts.map +1 -0
  116. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  117. package/package.json +1 -1
  118. package/src/common.ts +18 -0
  119. package/src/{UnistyleRegistry.ts → core/UnistyleRegistry.ts} +2 -2
  120. package/src/{Unistyles.ts → core/Unistyles.ts} +2 -9
  121. package/src/{UnistylesRuntime.ts → core/UnistylesRuntime.ts} +3 -3
  122. package/src/core/index.ts +1 -0
  123. package/src/hooks/index.ts +2 -1
  124. package/src/{useInitialTheme.ts → hooks/useInitialTheme.ts} +2 -2
  125. package/src/hooks/useUnistyles.ts +55 -0
  126. package/src/index.ts +10 -8
  127. package/src/types/breakpoints.ts +6 -11
  128. package/src/types/common.ts +2 -0
  129. package/src/types/core.ts +10 -4
  130. package/src/types/index.ts +5 -9
  131. package/src/types/mq.ts +3 -0
  132. package/src/types/{cxx.ts → unistyles.ts} +3 -24
  133. package/src/useStyles.ts +15 -8
  134. package/src/utils/breakpoints.ts +13 -12
  135. package/src/utils/index.ts +2 -9
  136. package/src/utils/mq.ts +75 -46
  137. package/src/utils/mqParser.ts +99 -0
  138. package/src/utils/styles.ts +2 -2
  139. package/lib/commonjs/UnistyleRegistry.js.map +0 -1
  140. package/lib/commonjs/Unistyles.js.map +0 -1
  141. package/lib/commonjs/UnistylesEngine.js +0 -26
  142. package/lib/commonjs/UnistylesEngine.js.map +0 -1
  143. package/lib/commonjs/UnistylesModule.js.map +0 -1
  144. package/lib/commonjs/UnistylesRuntime.js.map +0 -1
  145. package/lib/commonjs/hooks/useDimensions.js +0 -10
  146. package/lib/commonjs/hooks/useDimensions.js.map +0 -1
  147. package/lib/commonjs/hooks/useDimensions.web.js +0 -34
  148. package/lib/commonjs/hooks/useDimensions.web.js.map +0 -1
  149. package/lib/commonjs/types/cxx.js.map +0 -1
  150. package/lib/commonjs/types/mediaQueries.js +0 -2
  151. package/lib/commonjs/useInitialTheme.js.map +0 -1
  152. package/lib/commonjs/useUnistyles.js +0 -51
  153. package/lib/commonjs/useUnistyles.js.map +0 -1
  154. package/lib/commonjs/utils/mediaQueries.js +0 -98
  155. package/lib/commonjs/utils/mediaQueries.js.map +0 -1
  156. package/lib/module/UnistyleRegistry.js.map +0 -1
  157. package/lib/module/Unistyles.js.map +0 -1
  158. package/lib/module/UnistylesEngine.js +0 -19
  159. package/lib/module/UnistylesEngine.js.map +0 -1
  160. package/lib/module/UnistylesModule.js.map +0 -1
  161. package/lib/module/UnistylesRuntime.js.map +0 -1
  162. package/lib/module/hooks/useDimensions.js +0 -3
  163. package/lib/module/hooks/useDimensions.js.map +0 -1
  164. package/lib/module/hooks/useDimensions.web.js +0 -27
  165. package/lib/module/hooks/useDimensions.web.js.map +0 -1
  166. package/lib/module/types/cxx.js.map +0 -1
  167. package/lib/module/types/mediaQueries.js +0 -2
  168. package/lib/module/useInitialTheme.js.map +0 -1
  169. package/lib/module/useUnistyles.js +0 -44
  170. package/lib/module/useUnistyles.js.map +0 -1
  171. package/lib/module/utils/mediaQueries.js +0 -85
  172. package/lib/module/utils/mediaQueries.js.map +0 -1
  173. package/lib/typescript/src/UnistyleRegistry.d.ts.map +0 -1
  174. package/lib/typescript/src/Unistyles.d.ts.map +0 -1
  175. package/lib/typescript/src/UnistylesEngine.d.ts +0 -11
  176. package/lib/typescript/src/UnistylesEngine.d.ts.map +0 -1
  177. package/lib/typescript/src/UnistylesModule.d.ts.map +0 -1
  178. package/lib/typescript/src/UnistylesRuntime.d.ts.map +0 -1
  179. package/lib/typescript/src/hooks/useDimensions.d.ts +0 -3
  180. package/lib/typescript/src/hooks/useDimensions.d.ts.map +0 -1
  181. package/lib/typescript/src/hooks/useDimensions.web.d.ts +0 -3
  182. package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +0 -1
  183. package/lib/typescript/src/types/cxx.d.ts.map +0 -1
  184. package/lib/typescript/src/types/mediaQueries.d.ts +0 -10
  185. package/lib/typescript/src/types/mediaQueries.d.ts.map +0 -1
  186. package/lib/typescript/src/useInitialTheme.d.ts +0 -3
  187. package/lib/typescript/src/useInitialTheme.d.ts.map +0 -1
  188. package/lib/typescript/src/useUnistyles.d.ts +0 -10
  189. package/lib/typescript/src/useUnistyles.d.ts.map +0 -1
  190. package/lib/typescript/src/utils/mediaQueries.d.ts +0 -11
  191. package/lib/typescript/src/utils/mediaQueries.d.ts.map +0 -1
  192. package/src/UnistylesEngine.ts +0 -24
  193. package/src/hooks/useDimensions.ts +0 -4
  194. package/src/hooks/useDimensions.web.ts +0 -34
  195. package/src/types/mediaQueries.ts +0 -15
  196. package/src/useUnistyles.ts +0 -61
  197. package/src/utils/mediaQueries.ts +0 -152
  198. /package/lib/commonjs/{UnistyleRegistry.js → core/UnistyleRegistry.js} +0 -0
  199. /package/lib/commonjs/{UnistylesModule.js → core/UnistylesModule.js} +0 -0
  200. /package/lib/module/{UnistyleRegistry.js → core/UnistyleRegistry.js} +0 -0
  201. /package/lib/module/{UnistylesModule.js → core/UnistylesModule.js} +0 -0
  202. /package/lib/typescript/src/{UnistylesModule.d.ts → core/UnistylesModule.d.ts} +0 -0
  203. /package/src/{UnistylesModule.ts → core/UnistylesModule.ts} +0 -0
@@ -3,73 +3,87 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.mq = void 0;
7
- var _Unistyles = require("../Unistyles");
8
- const MQSymbol = Symbol('unistyles-mq');
6
+ exports.mq = exports.MQSymbol = void 0;
7
+ var _core = require("../core");
8
+ const MQSymbol = exports.MQSymbol = Symbol('unistyles-mq');
9
9
  var MQProp = /*#__PURE__*/function (MQProp) {
10
10
  MQProp["toString"] = "toString";
11
11
  MQProp["width"] = "width";
12
12
  MQProp["height"] = "height";
13
+ MQProp["shortW"] = "w";
14
+ MQProp["shortH"] = "h";
13
15
  return MQProp;
14
16
  }(MQProp || {});
15
17
  const getMQValue = value => {
16
18
  if (typeof value === 'number') {
17
19
  return value;
18
20
  }
19
- return _Unistyles.unistyles.registry.breakpoints[value] ?? 0;
21
+ if (value === null) {
22
+ return 0;
23
+ }
24
+ return _core.unistyles.registry.breakpoints[value] ?? 0;
20
25
  };
21
- const mq = exports.mq = {
22
- height: function () {
23
- let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
24
- let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
25
- return new Proxy({}, {
26
- get: (target, prop, receiver) => {
27
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
28
- return () => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
29
- }
30
- if (prop === MQProp.width) {
31
- return function () {
32
- let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
33
- let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
34
- return new Proxy({}, {
35
- get: (target, prop, receiver) => {
36
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
37
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
38
- }
39
- return Reflect.get(target, prop, receiver);
26
+ const widthHandler = function () {
27
+ let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
28
+ let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
29
+ return new Proxy({}, {
30
+ get: (target, prop, receiver) => {
31
+ if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
32
+ return () => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
33
+ }
34
+ if (prop === MQProp.width || prop === MQProp.shortW) {
35
+ return function () {
36
+ let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
37
+ let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
38
+ return new Proxy({}, {
39
+ get: (target, prop, receiver) => {
40
+ if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
41
+ return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
40
42
  }
41
- });
42
- };
43
- }
44
- return Reflect.get(target, prop, receiver);
43
+ return Reflect.get(target, prop, receiver);
44
+ }
45
+ });
46
+ };
47
+ }
48
+ return Reflect.get(target, prop, receiver);
49
+ }
50
+ });
51
+ };
52
+ const heightHandler = function () {
53
+ let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
54
+ let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
55
+ return new Proxy({}, {
56
+ get: (target, prop, receiver) => {
57
+ if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
58
+ return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
45
59
  }
46
- });
47
- },
48
- width: function () {
49
- let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
50
- let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
51
- return new Proxy({}, {
52
- get: (target, prop, receiver) => {
53
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
54
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
55
- }
56
- if (prop === MQProp.height) {
57
- return function () {
58
- let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
59
- let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
60
- return new Proxy({}, {
61
- get: (target, prop, receiver) => {
62
- if (prop === Symbol.toPrimitive || MQProp.toString) {
63
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
64
- }
65
- return Reflect.get(target, prop, receiver);
60
+ if (prop === MQProp.height || prop === MQProp.shortH) {
61
+ return function () {
62
+ let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
63
+ let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
64
+ return new Proxy({}, {
65
+ get: (target, prop, receiver) => {
66
+ if (prop === Symbol.toPrimitive || MQProp.toString) {
67
+ return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
66
68
  }
67
- });
68
- };
69
- }
70
- return Reflect.get(target, prop, receiver);
69
+ return Reflect.get(target, prop, receiver);
70
+ }
71
+ });
72
+ };
71
73
  }
72
- });
73
- }
74
+ return Reflect.get(target, prop, receiver);
75
+ }
76
+ });
74
77
  };
78
+ const mq = exports.mq = new Proxy({}, {
79
+ get: (target, prop, receiver) => {
80
+ if (prop === MQProp.shortW || prop === MQProp.width) {
81
+ return heightHandler;
82
+ }
83
+ if (prop === MQProp.shortH || prop === MQProp.height) {
84
+ return widthHandler;
85
+ }
86
+ return Reflect.get(target, prop, receiver);
87
+ }
88
+ });
75
89
  //# sourceMappingURL=mq.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_Unistyles","require","MQSymbol","Symbol","MQProp","getMQValue","value","unistyles","registry","breakpoints","mq","exports","height","hMin","arguments","length","undefined","hMax","Infinity","Proxy","get","target","prop","receiver","toPrimitive","toString","width","wMin","wMax","Reflect"],"sourceRoot":"../../../src","sources":["utils/mq.ts"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA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AE,SAAA,GAAAF,SAAA,MAAG,CAAC;YAAA,IAAEG,IAAa,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;YAAA,OAAK,IAAIC,KAAK,CAAe,CAAC,CAAC,EAAkB;cAChGC,GAAG,EAAEA,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,KAAK;gBAC7B,IAAID,IAAI,KAAKnB,MAAM,CAACqB,WAAW,IAAIpB,MAAM,CAACqB,QAAQ,EAAE;kBAChD,OAAO,MAAO,MAAKpB,UAAU,CAACsB,IAAI,CAAE,KAAItB,UAAU,CAACuB,IAAI,CAAE,OAAMvB,UAAU,CAACQ,IAAI,CAAE,KAAIR,UAAU,CAACY,IAAI,CAAE,GAAE;gBAC3G;gBAEA,OAAOY,OAAO,CAACT,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,CAAC;cAC9C;YACJ,CAAC,CAAC;UAAA;QACN;QAEA,OAAOM,OAAO,CAACT,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,CAAC;MAC9C;IACJ,CAAC,CAAC;EAAA;AACN,CAAC"}
1
+ {"version":3,"names":["_core","require","MQSymbol","exports","Symbol","MQProp","getMQValue","value","unistyles","registry","breakpoints","widthHandler","hMin","arguments","length","undefined","hMax","Infinity","Proxy","get","target","prop","receiver","toPrimitive","toString","width","shortW","wMin","wMax","Reflect","heightHandler","height","shortH","mq"],"sourceRoot":"../../../src","sources":["utils/mq.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAEO,MAAMC,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAGE,MAAM,CAAC,cAAc,CAAC;AAAA,IAyBzCC,MAAM,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA,EAANA,MAAM;AAQX,MAAMC,UAAU,GAAIC,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
+ });
6
+ exports.getKeyForUnistylesMediaQuery = void 0;
7
+ const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
8
+ const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/g;
9
+ const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/g;
10
+ const parseMq = mq => {
11
+ const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
12
+ const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
13
+ return {
14
+ width: width ? {
15
+ from: Number(fromW),
16
+ to: Number(toW)
17
+ } : undefined,
18
+ height: height ? {
19
+ from: Number(fromH),
20
+ to: Number(toH)
21
+ } : undefined
22
+ };
23
+ };
24
+ const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
25
+ const isValidMq = parsedMq => {
26
+ const {
27
+ width,
28
+ height
29
+ } = parsedMq;
30
+ if (width && height) {
31
+ return width.from <= width.to && height.from <= height.to;
32
+ }
33
+ if (width) {
34
+ return width.from <= width.to;
35
+ }
36
+ if (height) {
37
+ return height.from <= height.to;
38
+ }
39
+ return false;
40
+ };
41
+ const isWithinTheWidthAndHeight = (parsedMq, screenSize) => {
42
+ const {
43
+ width,
44
+ height
45
+ } = parsedMq;
46
+ if (width && height) {
47
+ return isWithinTheWidth(width, screenSize.width) && isWithinTheHeight(height, screenSize.height);
48
+ }
49
+ if (width) {
50
+ return isWithinTheWidth(width, screenSize.width);
51
+ }
52
+ if (height) {
53
+ return isWithinTheHeight(height, screenSize.height);
54
+ }
55
+ return false;
56
+ };
57
+ const isWithinTheWidth = (width, screenWidth) => {
58
+ const {
59
+ from,
60
+ to
61
+ } = width;
62
+ return screenWidth >= from && screenWidth <= to;
63
+ };
64
+ const isWithinTheHeight = (height, screenHeight) => {
65
+ const {
66
+ from,
67
+ to
68
+ } = height;
69
+ return screenHeight >= from && screenHeight <= to;
70
+ };
71
+ const getKeyForUnistylesMediaQuery = (mediaQueries, screenSize) => {
72
+ const mq = mediaQueries.find(_ref => {
73
+ let [key] = _ref;
74
+ if (!isUnistylesMq(key)) {
75
+ return false;
76
+ }
77
+ const parsedMq = parseMq(key);
78
+ if (!isValidMq(parsedMq)) {
79
+ return false;
80
+ }
81
+ return isWithinTheWidthAndHeight(parsedMq, screenSize);
82
+ });
83
+ return mq?.at(0);
84
+ };
85
+ exports.getKeyForUnistylesMediaQuery = getKeyForUnistylesMediaQuery;
86
+ //# sourceMappingURL=mqParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","from","Number","to","undefined","isUnistylesMq","test","isValidMq","parsedMq","isWithinTheWidthAndHeight","screenSize","isWithinTheWidth","isWithinTheHeight","screenWidth","screenHeight","getKeyForUnistylesMediaQuery","mediaQueries","find","_ref","key","at","exports"],"sourceRoot":"../../../src","sources":["utils/mqParser.ts"],"mappings":";;;;;;AAEA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,sCAAsC;AACpE,MAAMC,sBAAsB,GAAG,sCAAsC;AAYrE,MAAMC,OAAO,GAAIC,EAAU,IAAwB;EAC/C,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAEpE,OAAO;IACHC,KAAK,EAAEA,KAAK,GAAG;MACXO,IAAI,EAAEC,MAAM,CAACP,KAAK,CAAC;MACnBQ,EAAE,EAAED,MAAM,CAACN,GAAG;IAClB,CAAC,GAAGQ,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gB,GAAGA,CAACjB,KAAiC,EAAEmB,WAAmB,KAAc;EAC1F,MAAM;IAAEZ,IAAI;IAAEE;EAAG,CAAC,GAAGT,KAA0B;EAE/C,OAAOmB,WAAW,IAAIZ,IAAI,IAAIY,WAAW,IAAIV,EAAE;AACnD,CAAC;AAED,MAAMS,iBAAiB,GAAGA,CAACd,MAAmC,EAAEgB,YAAoB,KAAc;EAC9F,MAAM;IAAEb,IAAI;IAAEE;EAAG,CAAC,GAAGL,MAA2B;EAEhD,OAAOgB,YAAY,IAAIb,IAAI,IAAIa,YAAY,IAAIX,EAAE;AACrD,CAAC;AAEM,MAAMY,4BAA4B,GAAGA,CAACC,YAAwB,EAAEN,UAAsB,KAAK;EAC9F,MAAMjB,EAAE,GAAGuB,YAAY,CAACC,IAAI,CAACC,IAAA,IAAW;IAAA,IAAV,CAACC,GAAG,CAAC,GAAAD,IAAA;IAC/B,IAAI,CAACb,aAAa,CAACc,GAAa,CAAC,EAAE;MAC/B,OAAO,KAAK;IAChB;IAEA,MAAMX,QAAQ,GAAGhB,OAAO,CAAC2B,GAAa,CAAC;IAEvC,IAAI,CAACZ,SAAS,CAACC,QAAQ,CAAC,EAAE;MACtB,OAAO,KAAK;IAChB;IAEA,OAAOC,yBAAyB,CAACD,QAAQ,EAAEE,UAAU,CAAC;EAC1D,CAAC,CAAC;EAEF,OAAOjB,EAAE,EAAE2B,EAAE,CAAC,CAAC,CAAC;AACpB,CAAC;AAAAC,OAAA,CAAAN,4BAAA,GAAAA,4BAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["_breakpoints","require","_normalizeStyles","_common","proxifyFunction","fn","breakpoint","screenSize","Proxy","apply","target","thisArg","argumentsList","parseStyle","exports","isPlatformColor","value","isIOS","semantic","isAndroid","resource_paths","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle","getValueForBreakpoint","isWeb","normalizeStyles"],"sourceRoot":"../../../src","sources":["utils/styles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AEA,MAAMuB,WAAW,GAAGF,GAAG,KAAK,WAAW;IAEvC,IAAIE,WAAW,IAAIC,KAAK,CAACC,OAAO,CAAChB,KAAK,CAAC,EAAE;MACrC,OAAO,CACHY,GAAG,EACHZ,KAAK,CAACU,GAAG,CAACV,KAAK,IAAIH,UAAU,CAACG,KAAK,EAAEV,UAAU,EAAEC,UAAU,CAAC,CAAC,CAChE;IACL;IAEA,MAAM0B,iBAAiB,GAAG,OAAOjB,KAAK,KAAK,UAAU;IACrD,MAAMkB,YAAY,GAAG,OAAOlB,KAAK,KAAK,QAAQ,IAAID,eAAe,CAACC,KAAK,CAAC;IAExE,IAAIiB,iBAAiB,IAAIC,YAAY,EAAE;MACnC,OAAO,CAACN,GAAG,EAAEZ,KAAK,CAAC;IACvB;IAEA,OAAO,CACHY,GAAG,EACH,IAAAO,kCAAqB,EAACnB,KAAuF,CAAC,CACjH;EACL,CAAC,CACL,CAAC;EAEL,OAAOoB,aAAK,GACN,IAAAC,gCAAe,EAACb,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC;AAAAV,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
1
+ {"version":3,"names":["_breakpoints","require","_normalizeStyles","_common","proxifyFunction","fn","breakpoint","screenSize","Proxy","apply","target","thisArg","argumentsList","parseStyle","exports","isPlatformColor","value","isIOS","semantic","isAndroid","resource_paths","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle","getValueForBreakpoint","isWeb","normalizeStyles"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAEO,MAAMG,eAAe,GAAGA,CAC3BC,EAAY,EAAEC,UAA+C,EAC7DC,UAAsB,KACX,IAAIC,KAAK,CAACH,EAAE,EAAE;EACzBI,KAAK,EAAEA,CAACC,M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;IAEA,MAAM0B,iBAAiB,GAAG,OAAOjB,KAAK,KAAK,UAAU;IACrD,MAAMkB,YAAY,GAAG,OAAOlB,KAAK,KAAK,QAAQ,IAAID,eAAe,CAACC,KAAK,CAAC;IAExE,IAAIiB,iBAAiB,IAAIC,YAAY,EAAE;MACnC,OAAO,CAACN,GAAG,EAAEZ,KAAK,CAAC;IACvB;IAEA,OAAO,CACHY,GAAG,EACH,IAAAO,kCAAqB,EAACnB,KAAqF,CAAC,CAC/G;EACL,CAAC,CACL,CAAC;EAEL,OAAOoB,aAAK,GACN,IAAAC,gCAAe,EAACb,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC;AAAAV,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
@@ -1,8 +1,3 @@
1
- export let ScreenOrientation = /*#__PURE__*/function (ScreenOrientation) {
2
- ScreenOrientation[ScreenOrientation["Portrait"] = 1] = "Portrait";
3
- ScreenOrientation[ScreenOrientation["Landscape"] = 2] = "Landscape";
4
- return ScreenOrientation;
5
- }({});
6
1
  export let CxxUnistylesEventTypes = /*#__PURE__*/function (CxxUnistylesEventTypes) {
7
2
  CxxUnistylesEventTypes["Theme"] = "theme";
8
3
  CxxUnistylesEventTypes["Layout"] = "layout";
@@ -17,4 +12,9 @@ export let UnistylesError = /*#__PURE__*/function (UnistylesError) {
17
12
  UnistylesError["BreakpointsMustStartFromZero"] = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO";
18
13
  return UnistylesError;
19
14
  }({});
20
- //# sourceMappingURL=cxx.js.map
15
+ export let ScreenOrientation = /*#__PURE__*/function (ScreenOrientation) {
16
+ ScreenOrientation[ScreenOrientation["Portrait"] = 1] = "Portrait";
17
+ ScreenOrientation[ScreenOrientation["Landscape"] = 2] = "Landscape";
18
+ return ScreenOrientation;
19
+ }({});
20
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CxxUnistylesEventTypes","UnistylesError","ScreenOrientation"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":"AAAA,WAAYA,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAKlC,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAS1B,WAAYC,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnistyleRegistry","config","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","useBreakpoints","addConfig","adaptiveThemes","useAdaptiveThemes","dangerouslyUnregister","unregister"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":"AAGA,OAAO,MAAMA,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,UAAU,GAAiC,EAAE;EAC7CC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,WAAW,GAAyB,CAAC,CAAC;EACtCC,qBAAqB,GAA0F,EAAE;EAExHC,WAAWA,CAASC,eAAgC,EAAE;IAAA,KAAlCA,eAAgC,GAAhCA,eAAgC;EAAG;EAEhDC,SAAS,GAAIL,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACN,MAAM,CAAiC;IAEhE,IAAI,CAACI,eAAe,CAACJ,MAAM,GAAGM,IAAI;IAClC,IAAI,CAACP,UAAU,GAAGO,IAAI;IAEtB,OAAO,IAAI;EACf,CAAC;EAEME,cAAc,GAAIP,WAAiC,IAAK;IAC3D,IAAI,CAACG,eAAe,CAACK,cAAc,CAACR,WAAW,CAAC;IAChD,IAAI,CAACC,qBAAqB,GAAG,IAAI,CAACE,eAAe,CAACF,qBAAqB;IAEvE,OAAO,IAAI;EACf,CAAC;EAEMQ,SAAS,GAAIZ,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,IAAIA,MAAM,CAACa,cAAc,EAAE;MACvB,IAAI,CAACP,eAAe,CAACQ,iBAAiB,CAACd,MAAM,CAACa,cAAc,CAAC;IACjE;IAEA,OAAO,IAAI;EACf,CAAC;EAEME,qBAAqB,GAAGA,CAAA,KAAM;IACjC,IAAI,CAACf,MAAM,GAAG,CAAC,CAAC;IAChB,IAAI,CAACC,UAAU,GAAG,EAAE;IACpB,IAAI,CAACC,MAAM,GAAG,CAAC,CAAoB;IACnC,IAAI,CAACC,WAAW,GAAG,CAAC,CAAyB;IAC7C,IAAI,CAACC,qBAAqB,GAAG,EAAE;IAE/B,IAAI,CAACE,eAAe,CAACU,UAAU,CAAC,CAAC;EACrC,CAAC;AACL"}
@@ -1,8 +1,7 @@
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 { UnistylesError } from './types';
4
+ import { UnistylesError } from '../common';
6
5
  class Unistyles {
7
6
  constructor() {
8
7
  const isInstalled = UnistylesModule?.install() ?? false;
@@ -14,7 +13,6 @@ class Unistyles {
14
13
  this._bridge = global.__UNISTYLES__;
15
14
  this._registry = new UnistyleRegistry(this._bridge);
16
15
  this._runtime = new UnistylesRuntime(this._bridge, this._registry);
17
- this._engine = new UnistylesBuiltInEngine(this._registry, this._runtime);
18
16
  }
19
17
  get registry() {
20
18
  return this._registry;
@@ -22,9 +20,6 @@ class Unistyles {
22
20
  get runtime() {
23
21
  return this._runtime;
24
22
  }
25
- get engine() {
26
- return this._engine;
27
- }
28
23
  }
29
24
  export const unistyles = new Unistyles();
30
25
  //# sourceMappingURL=Unistyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnistylesModule","UnistylesRuntime","UnistyleRegistry","UnistylesError","Unistyles","constructor","isInstalled","install","Error","RuntimeUnavailable","_bridge","global","__UNISTYLES__","_registry","_runtime","registry","runtime","unistyles"],"sourceRoot":"../../../src","sources":["core/Unistyles.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,SAASC,cAAc,QAAQ,WAAW;AAE1C,MAAMC,SAAS,CAAC;EAKZC,WAAWA,CAAA,EAAG;IACV,MAAMC,WAAW,GAAGN,eAAe,EAAEO,OAAO,CAAC,CAAC,IAAI,KAAK;IAEvD,IAAI,CAACD,WAAW,EAAE;MACd,MAAM,IAAIE,KAAK,CAACL,cAAc,CAACM,kBAAkB,CAAC;IACtD;;IAEA;IACA,IAAI,CAACC,OAAO,GAAGC,MAAM,CAACC,aAAgC;IACtD,IAAI,CAACC,SAAS,GAAG,IAAIX,gBAAgB,CAAC,IAAI,CAACQ,OAAO,CAAC;IACnD,IAAI,CAACI,QAAQ,GAAG,IAAIb,gBAAgB,CAAC,IAAI,CAACS,OAAO,EAAE,IAAI,CAACG,SAAS,CAAC;EACtE;EAEA,IAAWE,QAAQA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACF,SAAS;EACzB;EAEA,IAAWG,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACF,QAAQ;EACxB;AACJ;AAEA,OAAO,MAAMG,SAAS,GAAG,IAAIb,SAAS,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","UnistylesModule","Unistyles"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAM5C,OAAO,MAAMC,eAAe,GAAGD,aAAa,EAAEE,SAAkC"}
@@ -1,4 +1,4 @@
1
- import { ScreenOrientation, UnistylesError } from './types';
1
+ import { ScreenOrientation, UnistylesError } from '../common';
2
2
  export class UnistylesRuntime {
3
3
  constructor(unistylesBridge, registry) {
4
4
  this.unistylesBridge = unistylesBridge;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ScreenOrientation","UnistylesError","UnistylesRuntime","constructor","unistylesBridge","registry","colorScheme","hasAdaptiveThemes","sortedBreakpoints","sortedBreakpointPairs","themeName","breakpoint","screen","width","screenWidth","height","screenHeight","orientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","ThemeNotRegistered","getTheme","forName","themeNames","length","ThemeNotFound","themes","setAdaptiveThemes","enable","useAdaptiveThemes"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":"AAAA,SAASA,iBAAiB,EAAEC,cAAc,QAAQ,WAAW;AAK7D,OAAO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,QAA0B,EAAE;IAAA,KAAtED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,QAA0B,GAA1BA,QAA0B;EAAG;EAE3F,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,QAAQ,CAACI,qBAAqB;EAC9C;EAEA,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACN,eAAe,CAACM,SAAS;EACzC;EAEA,IAAWC,UAAUA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACP,eAAe,CAACO,UAAU;EAC1C;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,KAAK,EAAE,IAAI,CAACT,eAAe,CAACU,WAAW;MACvCC,MAAM,EAAE,IAAI,CAACX,eAAe,CAACY;IACjC,CAAC;EACL;EAEA,IAAWC,WAAWA,CAAA,EAAG;IACrB,MAAM;MAAEJ,KAAK;MAAEE;IAAO,CAAC,GAAG,IAAI,CAACH,MAAM;IAErC,IAAIC,KAAK,GAAGE,MAAM,EAAE;MAChB,OAAOf,iBAAiB,CAACkB,SAAS;IACtC;IAEA,OAAOlB,iBAAiB,CAACmB,QAAQ;EACrC;EAEOC,QAAQ,GAAIC,IAA2B,IAAK;IAC/C,IAAIA,IAAI,KAAK,IAAI,CAACX,SAAS,IAAI,IAAI,CAACY,QAAQ,CAACD,IAAI,CAAC,EAAE;MAChD,IAAI,CAACjB,eAAe,CAACmB,QAAQ,CAACF,IAAI,CAAC;MAEnC,OAAO,IAAI;IACf;IAEA,MAAM,IAAIG,KAAK,CAACvB,cAAc,CAACwB,kBAAkB,CAAC;EACtD,CAAC;EAEMC,QAAQ,GAAIC,OAA8B,IAAK;IAClD,IAAI,IAAI,CAACtB,QAAQ,CAACuB,UAAU,CAACC,MAAM,KAAK,CAAC,EAAE;MACvC,OAAO,CAAC,CAAC;IACb;IAEA,IAAI,CAAC,IAAI,CAACP,QAAQ,CAACK,OAAO,CAAC,EAAE;MACzB,MAAM,IAAIH,KAAK,CAACvB,cAAc,CAAC6B,aAAa,CAAC;IACjD;IAEA,OAAO,IAAI,CAACzB,QAAQ,CAAC0B,MAAM,CAACJ,OAAO,CAAC;EACxC,CAAC;EAEMK,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAAC7B,eAAe,CAAC8B,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;EAEOX,QAAQ,GAAID,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAAChB,QAAQ,CAAC0B,MAAM;AACpF"}
@@ -0,0 +1,2 @@
1
+ export { unistyles } from './Unistyles';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["unistyles"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa"}
@@ -1,2 +1,3 @@
1
- export { useDimensions } from './useDimensions';
1
+ export { useInitialTheme } from './useInitialTheme';
2
+ export { useUnistyles } from './useUnistyles';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useDimensions"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,iBAAiB"}
1
+ {"version":3,"names":["useInitialTheme","useUnistyles"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,YAAY,QAAQ,gBAAgB"}
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from 'react';
2
- import { unistyles } from './Unistyles';
2
+ import { unistyles } from '../core';
3
3
  export const useInitialTheme = forName => {
4
4
  useMemo(() => unistyles.runtime.setTheme(forName), []);
5
5
  };
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useMemo","unistyles","useInitialTheme","forName","runtime","setTheme"],"sourceRoot":"../../../src","sources":["hooks/useInitialTheme.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,SAAS,QAAQ,SAAS;AAGnC,OAAO,MAAMC,eAAe,GAAIC,OAA8B,IAAK;EAC/DH,OAAO,CAAC,MAAMC,SAAS,CAACG,OAAO,CAACC,QAAQ,CAACF,OAAO,CAAC,EAAE,EAAE,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { NativeEventEmitter, NativeModules } from 'react-native';
2
+ import { useEffect, useState } from 'react';
3
+ import { unistyles } from '../core';
4
+ import { CxxUnistylesEventTypes } from '../common';
5
+ const unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles);
6
+ export const useUnistyles = () => {
7
+ const [theme, setTheme] = useState(unistyles.runtime.getTheme(unistyles.runtime.themeName));
8
+ const [layout, setLayout] = useState({
9
+ breakpoint: unistyles.runtime.breakpoint,
10
+ orientation: unistyles.runtime.orientation,
11
+ screenSize: {
12
+ width: unistyles.runtime.screen.width,
13
+ height: unistyles.runtime.screen.height
14
+ }
15
+ });
16
+ useEffect(() => {
17
+ const subscription = unistylesEvents.addListener('onChange', event => {
18
+ switch (event.type) {
19
+ case CxxUnistylesEventTypes.Theme:
20
+ {
21
+ const themeEvent = event;
22
+ return setTheme(unistyles.runtime.getTheme(themeEvent.payload.themeName));
23
+ }
24
+ case CxxUnistylesEventTypes.Layout:
25
+ {
26
+ const layoutEvent = event;
27
+ return setLayout({
28
+ breakpoint: layoutEvent.payload.breakpoint,
29
+ orientation: layoutEvent.payload.orientation,
30
+ screenSize: {
31
+ width: layoutEvent.payload.screen.width,
32
+ height: layoutEvent.payload.screen.height
33
+ }
34
+ });
35
+ }
36
+ default:
37
+ return;
38
+ }
39
+ });
40
+ return subscription.remove;
41
+ }, []);
42
+ return {
43
+ theme,
44
+ layout
45
+ };
46
+ };
47
+ //# sourceMappingURL=useUnistyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","unistyles","CxxUnistylesEventTypes","unistylesEvents","Unistyles","useUnistyles","theme","setTheme","runtime","getTheme","themeName","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","subscription","addListener","event","type","Theme","themeEvent","payload","Layout","layoutEvent","remove"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,SAAS,QAAQ,SAAS;AACnC,SAASC,sBAAsB,QAAQ,WAAW;AAGlD,MAAMC,eAAe,GAAG,IAAIN,kBAAkB,CAACC,aAAa,CAACM,SAAS,CAAC;AAEvE,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGP,QAAQ,CA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;IACLK;EACJ,CAAC;AACL,CAAC"}
@@ -1,9 +1,9 @@
1
- import { unistyles } from './Unistyles';
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';
1
+ import { unistyles } from './core';
2
+ import { mq } from './utils';
3
+ import { useInitialTheme } from './hooks';
4
+ import { ScreenOrientation } from './common';
5
+ import { useStyles } from './useStyles';
6
+ import { createStyleSheet } from './createStyleSheet';
7
7
  const {
8
8
  addThemes,
9
9
  addBreakpoints,
@@ -17,5 +17,5 @@ const UnistylesRegistry = {
17
17
  };
18
18
  export const __dangerouslyUnregister = unistyles.registry.dangerouslyUnregister;
19
19
  export { UnistylesRuntime, UnistylesRegistry };
20
- export { ScreenOrientation };
20
+ export { mq, useInitialTheme, useStyles, createStyleSheet, ScreenOrientation };
21
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["unistyles","ScreenOrientation","mq","useInitialTheme","useStyles","createStyleSheet","addThemes","addBreakpoints","addConfig","registry","UnistylesRuntime","runtime","UnistylesRegistry","__dangerouslyUnregister","dangerouslyUnregister"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AAEvC,SAASC,iBAAiB,QAAQ,SAAS;AAE3C,SAASC,EAAE,QAAQ,SAAS;AAC5B,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAM;EAAEC,SAAS;EAAEC,cAAc;EAAEC;AAAW,CAAC,GAAGR,SAAS,CAACS,QAAQ;AACpE,MAAMC,gBAAgB,GAAGV,SAAS,CAACW,OAAO;AAC1C,MAAMC,iBAAiB,GAAG;EACtBN,SAAS;EACTC,cAAc;EACdC;AACJ,CAAC;AAED,OAAO,MAAMK,uBAAuB,GAAGb,SAAS,CAACS,QAAQ,CAACK,qBAAqB;AAE/E,SACIJ,gBAAgB,EAChBE,iBAAiB;AAGrB,SACIX,iBAAiB"}
1
+ {"version":3,"names":["unistyles","mq","useInitialTheme","ScreenOrientation","useStyles","createStyleSheet","addThemes","addBreakpoints","addConfig","registry","UnistylesRuntime","runtime","UnistylesRegistry","__dangerouslyUnregister","dangerouslyUnregister"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,EAAE,QAAQ,SAAS;AAC5B,SAASC,eAAe,QAAQ,SAAS;AAEzC,SAASC,iBAAiB,QAAQ,UAAU;AAC5C,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAM;EAAEC,SAAS;EAAEC,cAAc;EAAEC;AAAW,CAAC,GAAGR,SAAS,CAACS,QAAQ;AACpE,MAAMC,gBAAgB,GAAGV,SAAS,CAACW,OAAO;AAC1C,MAAMC,iBAAiB,GAAG;EACtBN,SAAS;EACTC,cAAc;EACdC;AACJ,CAAC;AAED,OAAO,MAAMK,uBAAuB,GAAGb,SAAS,CAACS,QAAQ,CAACK,qBAAqB;AAE/E,SACIJ,gBAAgB,EAChBE,iBAAiB;AAGrB,SACIX,EAAE,EACFC,eAAe,EACfE,SAAS,EACTC,gBAAgB,EAChBF,iBAAiB"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/common.ts"],"mappings":""}
@@ -1,3 +1,3 @@
1
1
  export * from './normalizer';
2
- export * from './cxx';
2
+ export * from './unistyles';
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,OAAO"}
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,aAAa"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/mq.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=unistyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/unistyles.ts"],"mappings":""}
@@ -1,13 +1,16 @@
1
1
  import { useMemo } from 'react';
2
2
  import { StyleSheet } from 'react-native';
3
3
  import { parseStyle, proxifyFunction } from './utils';
4
- import { useUnistyles } from './useUnistyles';
4
+ import { useUnistyles } from './hooks';
5
5
  export const useStyles = stylesheet => {
6
6
  const {
7
7
  theme,
8
- breakpoint,
9
- screenSize
8
+ layout
10
9
  } = useUnistyles();
10
+ const {
11
+ screenSize,
12
+ breakpoint
13
+ } = layout;
11
14
  if (!stylesheet) {
12
15
  return {
13
16
  theme,
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","useUnistyles","useStyles","stylesheet","theme","breakpoint","screenSize","styles","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","style","create"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,QAAQ,SAAS;AAErD,SAASC,YAAY,QAAQ,gBAAgB;AAG7C,OAAO,MAAMC,SAAS,GAAsCC,UAAyD,IAAK;EACtH,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGL,YAAY,CAAC,CAAC;EAExD,IAAI,CAACE,UAAU,EAAE;IACb,OAAO;MACHC,KAAK;MACLC,UAAU;MACVE,MAAM,EAAE,CAAC;IACb,CAAC;EACL;EAEA,MAAMC,YAAY,GAAGX,OAAO,CAAC,MAAM,OAAOM,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACC,KAAK,CAAC,GACjBD,UAAU,EAAE,CAACC,KAAK,EAAED,UAAU,CAAC,CAAC;EAEtC,MAAMM,iBAAiB,GAAGZ,OAAO,CAAC,MAAMa,MAAM,CACzCC,OAAO,CAACH,YAAY,CAAC,CACrBI,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACtB,MAAMG,KAAK,GAAGD,KAA8B;IAE5C,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGH,GAAG;QACN,CAACE,GAAG,GAAGf,eAAe,CAACgB,KAAK,EAAEX,UAAU,EAAEC,UAAU;MACxD,CAAC;IACL;IAEA,OAAOR,UAAU,CAACoB,MAAM,CAAC;MACrB,GAAGL,GAAG;MACN,CAACE,GAAG,GAAGhB,UAAU,CAAKkB,KAAK,EAAEZ,UAAU,EAAEC,UAAU;IACvD,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAO,CAAC,EAAE,CAACD,UAAU,EAAEC,UAAU,EAAEE,YAAY,CAAC,CAAC;EAEzD,OAAO;IACHJ,KAAK;IACLC,UAAU;IACVE,MAAM,EAAEE;EACZ,CAAC;AACL,CAAC"}
1
+ {"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","useUnistyles","useStyles","stylesheet","theme","layout","screenSize","breakpoint","styles","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","style","create"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,QAAQ,SAAS;AAErD,SAASC,YAAY,QAAQ,SAAS;AAStC,OAAO,MAAMC,SAAS,GAAsCC,UAAyD,IAA2B;EAC5I,MAAM;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGJ,YAAY,CAAC,CAAC;EACxC,MAAM;IAAEK,UAAU;IAAEC;EAAW,CAAC,GAAGF,MAAM;EAEzC,IAAI,CAACF,UAAU,EAAE;IACb,OAAO;MACHC,KAAK;MACLG,UAAU;MACVC,MAAM,EAAE,CAAC;IACb,CAAC;EACL;EAEA,MAAMC,YAAY,GAAGZ,OAAO,CAAC,MAAM,OAAOM,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACC,KAAK,CAAC,GACjBD,UAAU,EAAE,CAACC,KAAK,EAAED,UAAU,CAAC,CAAC;EAEtC,MAAMO,iBAAiB,GAAGb,OAAO,CAAC,MAAMc,MAAM,CACzCC,OAAO,CAACH,YAAY,CAAC,CACrBI,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACtB,MAAMG,KAAK,GAAGD,KAA8B;IAE5C,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGH,GAAG;QACN,CAACE,GAAG,GAAGhB,eAAe,CAACiB,KAAK,EAAEV,UAAU,EAAED,UAAU;MACxD,CAAC;IACL;IAEA,OAAOR,UAAU,CAACqB,MAAM,CAAC;MACrB,GAAGL,GAAG;MACN,CAACE,GAAG,GAAGjB,UAAU,CAAKmB,KAAK,EAAEX,UAAU,EAAED,UAAU;IACvD,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAO,CAAC,EAAE,CAACC,UAAU,EAAED,UAAU,EAAEG,YAAY,CAAC,CAA8B;EAEtF,OAAO;IACHL,KAAK;IACLG,UAAU;IACVC,MAAM,EAAEE;EACZ,CAAC;AACL,CAAC"}
@@ -1,6 +1,7 @@
1
- import { unistyles } from '../Unistyles';
1
+ import { unistyles } from '../core';
2
2
  import { isMobile, Orientation, throwError } from './common';
3
- import { ScreenOrientation } from '../types';
3
+ import { ScreenOrientation } from '../common';
4
+ import { getKeyForUnistylesMediaQuery } from './mqParser';
4
5
  export const sortAndValidateBreakpoints = breakpoints => {
5
6
  const sortedPairs = Object.entries(breakpoints).sort((breakpoint1, breakpoint2) => {
6
7
  const [, value1] = breakpoint1;
@@ -32,13 +33,8 @@ export const getBreakpointFromScreenWidth = (width, breakpointEntries) => {
32
33
  };
33
34
  export const getValueForBreakpoint = value => {
34
35
  // the highest priority is for custom media queries
35
- const customMediaQueries = Object.entries(value).filter(_ref2 => {
36
- let [key] = _ref2;
37
- return unistyles.engine.isMediaQuery(key);
38
- });
39
- // const customMediaQueryKey = getKeyForCustomMediaQuery(customMediaQueries, screenSize) as keyof typeof value
40
- const customMediaQueryKey = unistyles.engine.didMatchMediaQuery(customMediaQueries);
41
- if (customMediaQueryKey && customMediaQueryKey in value) {
36
+ const customMediaQueryKey = getKeyForUnistylesMediaQuery(Object.entries(value), unistyles.runtime.screen);
37
+ if (customMediaQueryKey) {
42
38
  return value[customMediaQueryKey];
43
39
  }
44
40
 
@@ -46,10 +42,12 @@ export const getValueForBreakpoint = value => {
46
42
  // check if user defined any breakpoints
47
43
  const hasBreakpoints = unistyles.runtime.sortedBreakpoints.length > 0;
48
44
 
49
- // if not then we can fallback to horizontal and portrait (mobile only)
45
+ // if not then we can fall back to horizontal and portrait (mobile only)
50
46
  if (!hasBreakpoints && isMobile && (Orientation.Landscape in value || Orientation.Portrait in value)) {
51
47
  return value[unistyles.runtime.orientation === ScreenOrientation.Portrait ? Orientation.Portrait : Orientation.Landscape];
52
48
  }
49
+
50
+ // let's get the current breakpoint
53
51
  const breakpoint = unistyles.runtime.breakpoint;
54
52
  if (!breakpoint) {
55
53
  return undefined;
@@ -65,15 +63,15 @@ export const getValueForBreakpoint = value => {
65
63
 
66
64
  // there is no direct hit for breakpoint nor media-query, let's simulate CSS cascading
67
65
  const breakpointPairs = unistyles.runtime.sortedBreakpoints;
68
- const currentBreakpoint = breakpointPairs.findIndex(_ref3 => {
69
- let [key] = _ref3;
66
+ const currentBreakpoint = breakpointPairs.findIndex(_ref2 => {
67
+ let [key] = _ref2;
70
68
  return key === breakpoint;
71
69
  });
72
- const availableBreakpoints = breakpointPairs.filter((_ref4, index) => {
73
- let [key] = _ref4;
70
+ const availableBreakpoints = breakpointPairs.filter((_ref3, index) => {
71
+ let [key] = _ref3;
74
72
  return index < currentBreakpoint && key && key in value;
75
- }).map(_ref5 => {
76
- let [key] = _ref5;
73
+ }).map(_ref4 => {
74
+ let [key] = _ref4;
77
75
  return key;
78
76
  });
79
77
  return breakpointPairs.length > 0 ? value[availableBreakpoints[availableBreakpoints.length - 1]] : undefined;