react-native-unistyles 2.0.0-alpha.9 → 2.0.0-beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. package/android/CMakeLists.txt +28 -0
  2. package/android/build.gradle +40 -0
  3. package/android/src/main/cxx/cpp-adapter.cpp +108 -0
  4. package/android/src/main/java/com/unistyles/UnistylesModule.kt +159 -0
  5. package/android/src/main/java/com/unistyles/UnistylesPackage.kt +18 -0
  6. package/cxx/UnistylesRuntime.cpp +55 -2
  7. package/cxx/UnistylesRuntime.h +15 -9
  8. package/ios/UnistylesModule.mm +12 -2
  9. package/lib/commonjs/common.js +30 -16
  10. package/lib/commonjs/common.js.map +1 -1
  11. package/lib/commonjs/core/UnistyleRegistry.js +65 -3
  12. package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
  13. package/lib/commonjs/core/UnistylesRuntime.js +15 -16
  14. package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
  15. package/lib/commonjs/createStyleSheet.js +1 -6
  16. package/lib/commonjs/createStyleSheet.js.map +1 -1
  17. package/lib/commonjs/hooks/index.js +7 -0
  18. package/lib/commonjs/hooks/index.js.map +1 -1
  19. package/lib/commonjs/hooks/useUnistyles.js +11 -8
  20. package/lib/commonjs/hooks/useUnistyles.js.map +1 -1
  21. package/lib/commonjs/hooks/useVariants.js +14 -0
  22. package/lib/commonjs/hooks/useVariants.js.map +1 -0
  23. package/lib/commonjs/index.js.map +1 -1
  24. package/lib/commonjs/plugins/index.js +38 -0
  25. package/lib/commonjs/plugins/index.js.map +1 -0
  26. package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +12 -0
  27. package/lib/commonjs/plugins/normalizeWebStylesPlugin.js.map +1 -0
  28. package/lib/commonjs/plugins/normalizer/index.js +32 -0
  29. package/lib/commonjs/plugins/normalizer/index.js.map +1 -0
  30. package/lib/commonjs/plugins/normalizer/module.d.js.map +1 -0
  31. package/lib/commonjs/{utils/normalizeStyles.web.js → plugins/normalizer/normalizeStyle.js} +5 -5
  32. package/lib/commonjs/plugins/normalizer/normalizeStyle.js.map +1 -0
  33. package/lib/commonjs/{utils → plugins/normalizer}/normalizer.js +1 -1
  34. package/lib/commonjs/plugins/normalizer/normalizer.js.map +1 -0
  35. package/lib/commonjs/types/{mq.js → plugin.js} +1 -1
  36. package/lib/commonjs/types/{mq.js.map → plugin.js.map} +1 -1
  37. package/lib/commonjs/types/stylesheet.js +6 -0
  38. package/lib/commonjs/types/stylesheet.js.map +1 -0
  39. package/lib/commonjs/types/variants.js +2 -0
  40. package/lib/commonjs/{utils/module.d.js.map → types/variants.js.map} +1 -1
  41. package/lib/commonjs/useStyles.js +10 -20
  42. package/lib/commonjs/useStyles.js.map +1 -1
  43. package/lib/commonjs/utils/breakpoints.js +13 -59
  44. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  45. package/lib/commonjs/utils/index.js +13 -51
  46. package/lib/commonjs/utils/index.js.map +1 -1
  47. package/lib/commonjs/utils/mq.js +36 -68
  48. package/lib/commonjs/utils/mq.js.map +1 -1
  49. package/lib/commonjs/utils/mqParser.js +4 -1
  50. package/lib/commonjs/utils/mqParser.js.map +1 -1
  51. package/lib/commonjs/utils/styles.js +35 -20
  52. package/lib/commonjs/utils/styles.js.map +1 -1
  53. package/lib/commonjs/utils/withPlugins.js +15 -0
  54. package/lib/commonjs/utils/withPlugins.js.map +1 -0
  55. package/lib/module/common.js +28 -17
  56. package/lib/module/common.js.map +1 -1
  57. package/lib/module/core/UnistyleRegistry.js +65 -3
  58. package/lib/module/core/UnistyleRegistry.js.map +1 -1
  59. package/lib/module/core/UnistylesRuntime.js +15 -16
  60. package/lib/module/core/UnistylesRuntime.js.map +1 -1
  61. package/lib/module/createStyleSheet.js +1 -6
  62. package/lib/module/createStyleSheet.js.map +1 -1
  63. package/lib/module/hooks/index.js +1 -0
  64. package/lib/module/hooks/index.js.map +1 -1
  65. package/lib/module/hooks/useUnistyles.js +12 -9
  66. package/lib/module/hooks/useUnistyles.js.map +1 -1
  67. package/lib/module/hooks/useVariants.js +7 -0
  68. package/lib/module/hooks/useVariants.js.map +1 -0
  69. package/lib/module/index.js.map +1 -1
  70. package/lib/module/plugins/index.js +3 -0
  71. package/lib/module/plugins/index.js.map +1 -0
  72. package/lib/module/plugins/normalizeWebStylesPlugin.js +6 -0
  73. package/lib/module/plugins/normalizeWebStylesPlugin.js.map +1 -0
  74. package/lib/module/plugins/normalizer/index.js +3 -0
  75. package/lib/module/plugins/normalizer/index.js.map +1 -0
  76. package/lib/module/plugins/normalizer/module.d.js.map +1 -0
  77. package/lib/module/{utils/normalizeStyles.web.js → plugins/normalizer/normalizeStyle.js} +3 -3
  78. package/lib/module/plugins/normalizer/normalizeStyle.js.map +1 -0
  79. package/lib/module/{utils → plugins/normalizer}/normalizer.js +1 -1
  80. package/lib/module/plugins/normalizer/normalizer.js.map +1 -0
  81. package/lib/module/types/plugin.js +2 -0
  82. package/lib/module/types/{mq.js.map → plugin.js.map} +1 -1
  83. package/lib/module/types/stylesheet.js +2 -0
  84. package/lib/module/types/stylesheet.js.map +1 -0
  85. package/lib/module/types/variants.js +2 -0
  86. package/lib/module/{utils/module.d.js.map → types/variants.js.map} +1 -1
  87. package/lib/module/useStyles.js +12 -22
  88. package/lib/module/useStyles.js.map +1 -1
  89. package/lib/module/utils/breakpoints.js +12 -56
  90. package/lib/module/utils/breakpoints.js.map +1 -1
  91. package/lib/module/utils/index.js +4 -6
  92. package/lib/module/utils/index.js.map +1 -1
  93. package/lib/module/utils/mq.js +35 -67
  94. package/lib/module/utils/mq.js.map +1 -1
  95. package/lib/module/utils/mqParser.js +3 -3
  96. package/lib/module/utils/mqParser.js.map +1 -1
  97. package/lib/module/utils/styles.js +35 -20
  98. package/lib/module/utils/styles.js.map +1 -1
  99. package/lib/module/utils/withPlugins.js +8 -0
  100. package/lib/module/utils/withPlugins.js.map +1 -0
  101. package/lib/typescript/src/common.d.ts +23 -12
  102. package/lib/typescript/src/common.d.ts.map +1 -1
  103. package/lib/typescript/src/core/UnistyleRegistry.d.ts +45 -4
  104. package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
  105. package/lib/typescript/src/core/UnistylesRuntime.d.ts +8 -9
  106. package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
  107. package/lib/typescript/src/core/index.d.ts +1 -0
  108. package/lib/typescript/src/core/index.d.ts.map +1 -1
  109. package/lib/typescript/src/createStyleSheet.d.ts +2 -2
  110. package/lib/typescript/src/createStyleSheet.d.ts.map +1 -1
  111. package/lib/typescript/src/global.d.ts.map +1 -1
  112. package/lib/typescript/src/hooks/index.d.ts +1 -0
  113. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  114. package/lib/typescript/src/hooks/useUnistyles.d.ts +2 -1
  115. package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -1
  116. package/lib/typescript/src/hooks/useVariants.d.ts +3 -0
  117. package/lib/typescript/src/hooks/useVariants.d.ts.map +1 -0
  118. package/lib/typescript/src/index.d.ts +51 -5
  119. package/lib/typescript/src/index.d.ts.map +1 -1
  120. package/lib/typescript/src/plugins/index.d.ts +3 -0
  121. package/lib/typescript/src/plugins/index.d.ts.map +1 -0
  122. package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts +3 -0
  123. package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts.map +1 -0
  124. package/lib/typescript/src/plugins/normalizer/index.d.ts +3 -0
  125. package/lib/typescript/src/plugins/normalizer/index.d.ts.map +1 -0
  126. package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts +3 -0
  127. package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts.map +1 -0
  128. package/lib/typescript/src/{utils → plugins/normalizer}/normalizer.d.ts +1 -1
  129. package/lib/typescript/src/plugins/normalizer/normalizer.d.ts.map +1 -0
  130. package/lib/typescript/src/types/breakpoints.d.ts +25 -12
  131. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  132. package/lib/typescript/src/types/core.d.ts +6 -27
  133. package/lib/typescript/src/types/core.d.ts.map +1 -1
  134. package/lib/typescript/src/types/index.d.ts +4 -2
  135. package/lib/typescript/src/types/index.d.ts.map +1 -1
  136. package/lib/typescript/src/types/plugin.d.ts +7 -0
  137. package/lib/typescript/src/types/plugin.d.ts.map +1 -0
  138. package/lib/typescript/src/types/stylesheet.d.ts +40 -0
  139. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -0
  140. package/lib/typescript/src/types/unistyles.d.ts +16 -11
  141. package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
  142. package/lib/typescript/src/types/variants.d.ts +14 -0
  143. package/lib/typescript/src/types/variants.d.ts.map +1 -0
  144. package/lib/typescript/src/useStyles.d.ts +3 -3
  145. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  146. package/lib/typescript/src/utils/breakpoints.d.ts +2 -5
  147. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  148. package/lib/typescript/src/utils/index.d.ts +4 -6
  149. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  150. package/lib/typescript/src/utils/mq.d.ts +15 -14
  151. package/lib/typescript/src/utils/mq.d.ts.map +1 -1
  152. package/lib/typescript/src/utils/mqParser.d.ts +14 -2
  153. package/lib/typescript/src/utils/mqParser.d.ts.map +1 -1
  154. package/lib/typescript/src/utils/styles.d.ts +3 -4
  155. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  156. package/lib/typescript/src/utils/withPlugins.d.ts +3 -0
  157. package/lib/typescript/src/utils/withPlugins.d.ts.map +1 -0
  158. package/package.json +19 -16
  159. package/src/__tests__/mocks.ts +24 -0
  160. package/src/common.ts +30 -14
  161. package/src/core/UnistyleRegistry.ts +66 -4
  162. package/src/core/UnistylesRuntime.ts +18 -20
  163. package/src/core/index.ts +1 -0
  164. package/src/createStyleSheet.ts +2 -8
  165. package/src/global.ts +1 -0
  166. package/src/hooks/index.ts +1 -0
  167. package/src/hooks/useUnistyles.ts +11 -9
  168. package/src/hooks/useVariants.ts +10 -0
  169. package/src/index.ts +3 -1
  170. package/src/plugins/index.ts +2 -0
  171. package/src/plugins/normalizeWebStylesPlugin.ts +7 -0
  172. package/src/plugins/normalizer/index.ts +2 -0
  173. package/src/{utils/normalizeStyles.web.ts → plugins/normalizer/normalizeStyle.ts} +3 -3
  174. package/src/{utils → plugins/normalizer}/normalizer.ts +3 -3
  175. package/src/types/breakpoints.ts +57 -25
  176. package/src/types/core.ts +9 -43
  177. package/src/types/index.ts +11 -2
  178. package/src/types/plugin.ts +7 -0
  179. package/src/types/stylesheet.ts +49 -0
  180. package/src/types/unistyles.ts +18 -13
  181. package/src/types/variants.ts +19 -0
  182. package/src/useStyles.ts +18 -25
  183. package/src/utils/breakpoints.ts +11 -67
  184. package/src/utils/index.ts +4 -6
  185. package/src/utils/mq.ts +31 -84
  186. package/src/utils/mqParser.ts +5 -5
  187. package/src/utils/styles.ts +44 -50
  188. package/src/utils/withPlugins.ts +13 -0
  189. package/lib/commonjs/utils/common.js +0 -25
  190. package/lib/commonjs/utils/common.js.map +0 -1
  191. package/lib/commonjs/utils/normalizeStyles.js +0 -10
  192. package/lib/commonjs/utils/normalizeStyles.js.map +0 -1
  193. package/lib/commonjs/utils/normalizeStyles.web.js.map +0 -1
  194. package/lib/commonjs/utils/normalizer.js.map +0 -1
  195. package/lib/module/types/mq.js +0 -2
  196. package/lib/module/utils/common.js +0 -17
  197. package/lib/module/utils/common.js.map +0 -1
  198. package/lib/module/utils/normalizeStyles.js +0 -3
  199. package/lib/module/utils/normalizeStyles.js.map +0 -1
  200. package/lib/module/utils/normalizeStyles.web.js.map +0 -1
  201. package/lib/module/utils/normalizer.js.map +0 -1
  202. package/lib/typescript/src/types/mq.d.ts +0 -3
  203. package/lib/typescript/src/types/mq.d.ts.map +0 -1
  204. package/lib/typescript/src/utils/common.d.ts +0 -12
  205. package/lib/typescript/src/utils/common.d.ts.map +0 -1
  206. package/lib/typescript/src/utils/normalizeStyles.d.ts +0 -2
  207. package/lib/typescript/src/utils/normalizeStyles.d.ts.map +0 -1
  208. package/lib/typescript/src/utils/normalizeStyles.web.d.ts +0 -5
  209. package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +0 -1
  210. package/lib/typescript/src/utils/normalizer.d.ts.map +0 -1
  211. package/src/types/mq.ts +0 -3
  212. package/src/utils/common.ts +0 -20
  213. package/src/utils/normalizeStyles.ts +0 -2
  214. /package/lib/commonjs/{utils → plugins/normalizer}/module.d.js +0 -0
  215. /package/lib/module/{utils → plugins/normalizer}/module.d.js +0 -0
  216. /package/src/{utils → plugins/normalizer}/module.d.ts +0 -0
@@ -1,13 +1,4 @@
1
1
  import { unistyles } from '../core';
2
- export const MQSymbol = Symbol('unistyles-mq');
3
- var MQProp = /*#__PURE__*/function (MQProp) {
4
- MQProp["toString"] = "toString";
5
- MQProp["width"] = "width";
6
- MQProp["height"] = "height";
7
- MQProp["shortW"] = "w";
8
- MQProp["shortH"] = "h";
9
- return MQProp;
10
- }(MQProp || {});
11
2
  const getMQValue = value => {
12
3
  if (typeof value === 'number') {
13
4
  return value;
@@ -17,67 +8,44 @@ const getMQValue = value => {
17
8
  }
18
9
  return unistyles.registry.breakpoints[value] ?? 0;
19
10
  };
20
- const widthHandler = function () {
21
- let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
22
- let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
23
- return new Proxy({}, {
24
- get: (target, prop, receiver) => {
25
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
26
- return () => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
27
- }
28
- if (prop === MQProp.width || prop === MQProp.shortW) {
29
- return function () {
30
- let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
31
- let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
32
- return new Proxy({}, {
33
- get: (target, prop, receiver) => {
34
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
35
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
36
- }
37
- return Reflect.get(target, prop, receiver);
38
- }
39
- });
40
- };
41
- }
42
- return Reflect.get(target, prop, receiver);
11
+ export const mq = {
12
+ only: {
13
+ width: function () {
14
+ let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
15
+ let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
16
+ return `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
17
+ },
18
+ height: function () {
19
+ let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
20
+ let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
21
+ return `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
43
22
  }
44
- });
45
- };
46
- const heightHandler = function () {
47
- let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
48
- let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
49
- return new Proxy({}, {
50
- get: (target, prop, receiver) => {
51
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
52
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
53
- }
54
- if (prop === MQProp.height || prop === MQProp.shortH) {
55
- return function () {
23
+ },
24
+ width: function () {
25
+ let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
26
+ let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
27
+ return {
28
+ and: {
29
+ height: function () {
56
30
  let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
57
31
  let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
58
- return new Proxy({}, {
59
- get: (target, prop, receiver) => {
60
- if (prop === Symbol.toPrimitive || MQProp.toString) {
61
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
62
- }
63
- return Reflect.get(target, prop, receiver);
64
- }
65
- });
66
- };
32
+ return `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
33
+ }
67
34
  }
68
- return Reflect.get(target, prop, receiver);
69
- }
70
- });
71
- };
72
- export const mq = new Proxy({}, {
73
- get: (target, prop, receiver) => {
74
- if (prop === MQProp.shortW || prop === MQProp.width) {
75
- return heightHandler;
76
- }
77
- if (prop === MQProp.shortH || prop === MQProp.height) {
78
- return widthHandler;
79
- }
80
- return Reflect.get(target, prop, receiver);
35
+ };
36
+ },
37
+ height: function () {
38
+ let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
39
+ let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
40
+ return {
41
+ and: {
42
+ width: function () {
43
+ let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
44
+ let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
45
+ return `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
46
+ }
47
+ }
48
+ };
81
49
  }
82
- });
50
+ };
83
51
  //# sourceMappingURL=mq.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["unistyles","MQSymbol","Symbol","MQProp","getMQValue","value","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,SAASA,SAAS,QAAQ,SAAS;AAEnC,OAAO,MAAMC,QAAQ,GAAGC,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;AA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,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;UAAA,OAAK,IAAIC,KAAK,CAAe,CAAC,CAAC,EAAkB;YAChGC,GAAG,EAAEA,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,KAAK;cAC7B,IAAID,IAAI,KAAKhB,MAAM,CAACkB,WAAW,IAAIjB,MAAM,CAACkB,QAAQ,EAAE;gBAChD,OAAO,MAAO,MAAKjB,UAAU,CAACoB,IAAI,CAAE,KAAIpB,UAAU,CAACqB,IAAI,CAAE,OAAMrB,UAAU,CAACK,IAAI,CAAE,KAAIL,UAAU,CAACS,IAAI,CAAE,GAAE;cAC3G;cAEA,OAAOa,OAAO,CAACV,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,CAAC;YAC9C;UACJ,CAAC,CAAC;QAAA;MACN;MAEA,OAAOO,OAAO,CAACV,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,CAAC;IAC9C;EACJ,CAAC,CAAC;AAAA;AAEF,OAAO,MAAMW,EAAE,GAAG,IAAIf,KAAK,CAAC,CAAC,CAAC,EAAe;EACzCC,GAAG,EAAEA,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,KAAK;IAC7B,IAAID,IAAI,KAAKf,MAAM,CAACoB,MAAM,IAAIL,IAAI,KAAKf,MAAM,CAACmB,KAAK,EAAE;MACjD,OAAOK,aAAa;IACxB;IAEA,IAAIT,IAAI,KAAKf,MAAM,CAAC0B,MAAM,IAAIX,IAAI,KAAKf,MAAM,CAACyB,MAAM,EAAE;MAClD,OAAOpB,YAAY;IACvB;IAEA,OAAOkB,OAAO,CAACV,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,CAAC;EAC9C;AACJ,CAAC,CAAC"}
1
+ {"version":3,"names":["unistyles","getMQValue","value","registry","breakpoints","mq","only","width","wMin","arguments","length","undefined","wMax","Infinity","height","hMin","hMax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ity))?]/;
2
2
  const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
3
3
  const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
4
- const parseMq = mq => {
4
+ export const parseMq = mq => {
5
5
  const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
6
6
  const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
7
7
  return {
@@ -16,7 +16,7 @@ const parseMq = mq => {
16
16
  };
17
17
  };
18
18
  const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
19
- const isValidMq = parsedMq => {
19
+ export const isValidMq = parsedMq => {
20
20
  const {
21
21
  width,
22
22
  height
@@ -32,7 +32,7 @@ const isValidMq = parsedMq => {
32
32
  }
33
33
  return false;
34
34
  };
35
- const isWithinTheWidthAndHeight = (parsedMq, screenSize) => {
35
+ export const isWithinTheWidthAndHeight = (parsedMq, screenSize) => {
36
36
  const {
37
37
  width,
38
38
  height
@@ -1 +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"],"sourceRoot":"../../../src","sources":["utils/mqParser.ts"],"mappings":"AAEA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAYpE,MAAMC,OAAO,GAAIC,EAAU,IAAwB;EAC/C,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAA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_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"],"sourceRoot":"../../../src","sources":["utils/mqParser.ts"],"mappings":"AAEA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAYpE,OAAO,MAAMC,OAAO,GAAIC,EAAU,IAAwB;EACtD,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,SAAS;IACbN,MAAM,EAAEA,MAAM,GAAG;MACbG,IAAI,EAAEC,MAAM,CAACH,KAAK,CAAC;MACnBI,EAAE,EAAED,MAAM,CAACF,GAAG;IAClB,CAAC,GAAGI;EACR,CAAC;AACL,CAAC;AAED,MAAMC,aAAa,GAAIZ,EAAU,IAAKJ,kBAAkB,CAACiB,IAAI,CAACb,EAAE,CAAC;AAEjE,OAAO,MAAMc,SAAS,GAAIC,QAA2B,IAAK;EACtD,MAAM;IAAEd,KAAK;IAAEI;EAAO,CAAC,GAAGU,QAAQ;EAElC,IAAId,KAAK,IAAII,MAAM,EAAE;IACjB,OAAOJ,KAAK,CAACO,IAAI,IAAIP,KAAK,CAACS,EAAE,IA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N,UAAsB,KAAuB;EAC9H,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"}
@@ -1,8 +1,8 @@
1
1
  import { getValueForBreakpoint } from './breakpoints';
2
- import { normalizeStyles } from './normalizeStyles';
3
- import { isAndroid, isIOS, isWeb } from './common';
4
- export const proxifyFunction = (fn, breakpoint, screenSize) => new Proxy(fn, {
5
- apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize)
2
+ import { isAndroid, isIOS } from '../common';
3
+ import { withPlugins } from './withPlugins';
4
+ export const proxifyFunction = (key, fn, variant) => new Proxy(fn, {
5
+ apply: (target, thisArg, argumentsList) => withPlugins(key, parseStyle(target.apply(thisArg, argumentsList), variant))
6
6
  });
7
7
  export const isPlatformColor = value => {
8
8
  if (isIOS) {
@@ -10,25 +10,40 @@ export const isPlatformColor = value => {
10
10
  }
11
11
  return isAndroid && 'resource_paths' in value && typeof value.resource_paths === 'object';
12
12
  };
13
- export const parseStyle = (style, breakpoint, screenSize) => {
14
- const entries = Object.entries(style || {});
15
- const parsedStyles = Object.fromEntries(entries.map(_ref => {
13
+ export const parseStyle = function (style) {
14
+ let variant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
15
+ return Object.entries(style || {}).reduce((acc, _ref) => {
16
16
  let [key, value] = _ref;
17
- const hasNestedProperties = key === 'shadowOffset' || key === 'textShadowOffset';
18
- if (hasNestedProperties) {
19
- return [key, parseStyle(value, breakpoint, screenSize)];
17
+ // nested objects
18
+ if (key === 'shadowOffset' || key === 'textShadowOffset') {
19
+ acc[key] = parseStyle(value, variant);
20
+ return acc;
20
21
  }
21
- const isTransform = key === 'transform';
22
- if (isTransform && Array.isArray(value)) {
23
- return [key, value.map(value => parseStyle(value, breakpoint, screenSize))];
22
+
23
+ // transforms
24
+ if (key === 'transform' && Array.isArray(value)) {
25
+ acc[key] = value.map(value => parseStyle(value, variant));
26
+ return acc;
24
27
  }
25
- const isDynamicFunction = typeof value === 'function';
26
- const isValidStyle = typeof value !== 'object' || isPlatformColor(value);
27
- if (isDynamicFunction || isValidStyle) {
28
- return [key, value];
28
+
29
+ // values or platform colors
30
+ if (typeof value !== 'object' || isPlatformColor(value)) {
31
+ acc[key] = value;
32
+ return acc;
29
33
  }
30
- return [key, getValueForBreakpoint(value)];
31
- }));
32
- return isWeb ? normalizeStyles(parsedStyles) : parsedStyles;
34
+ if (key === 'variants') {
35
+ return {
36
+ ...acc,
37
+ ...Object.keys(value).reduce((acc, key) => ({
38
+ ...acc,
39
+ ...parseStyle(value[key][variant[key] || 'default'] ?? {})
40
+ }), {})
41
+ };
42
+ }
43
+ return {
44
+ ...acc,
45
+ [key]: getValueForBreakpoint(value)
46
+ };
47
+ }, {});
33
48
  };
34
49
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getValueForBreakpoint","normalizeStyles","isAndroid","isIOS","isWeb","proxifyFunction","fn","breakpoint","screenSize","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAASC,eAAe,QAA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,EAAE;MACrC,OAAO,CACHU,GAAG,EACHV,KAAK,CAACQ,GAAG,CAACR,KAAK,IAAIF,UAAU,CAACE,KAAK,EAAET,UAAU,EAAEC,UAAU,CAAC,CAAC,CAChE;IACL;IAEA,MAAMuB,iBAAiB,GAAG,OAAOf,KAAK,KAAK,UAAU;IACrD,MAAMgB,YAAY,GAAG,OAAOhB,KAAK,KAAK,QAAQ,IAAID,eAAe,CAACC,KAAK,CAAC;IAExE,IAAIe,iBAAiB,IAAIC,YAAY,EAAE;MACnC,OAAO,CAACN,GAAG,EAAEV,KAAK,CAAC;IACvB;IAEA,OAAO,CACHU,GAAG,EACH1B,qBAAqB,CAACgB,KAAqF,CAAC,CAC/G;EACL,CAAC,CACL,CAAC;EAEL,OAAOZ,KAAK,GACNH,eAAe,CAACqB,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC"}
1
+ {"version":3,"names":["getValueForBreakpoint","isAndroid","isIOS","withPlugins","proxifyFunction","key","fn","variant","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","arguments","length","undefined","Object","entries","reduce","acc","_ref","Array","isArray","map","keys"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAASC,SAAS,EAAEC,KAAK,QAAQ,WAAW;AAC5C,SAASC,WAAW,QAAQ,eAAe;AAE3C,OAAO,MAAMC,eAAe,GAAGA,CAC3BC,GAAW,EACXC,EAAY,EACZC,OAA0C,KAC/B,IAAIC,KAAK,CAACF,EAAE,EAAE;EACzBG,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAAKT,WAAW,CAACE,GAAG,EAAEQ,UAAU,CAACH,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEL,OAAO,CAAC;AACzH,CAAC,CAAC;AAEF,OAAO,MAAMO,eAAe,GAAkBC,KAAQ,IAAc;EAChE,IAAIb,K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CAACC,GAAG,EAAEpB,GAAG,MAAM;UACnB,GAAGoB,GAAG;UACN,GAAGZ,UAAU,CAAEE,KAAK,CAAEV,GAAG,CAAC,CAACE,OAAO,CAACF,GAAG,CAAyB,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;QACvF,CAAC,CAAC,EAAE,CAAC,CAAC;MACd,CAAC;IACL;IAEA,OAAO;MACH,GAAGoB,GAAG;MACN,CAACpB,GAAG,GAAGL,qBAAqB,CAACe,KAAgC;IACjE,CAAC;EACL,CAAC,EAAE,CAAC,CAAM,CAAC;AAAA"}
@@ -0,0 +1,8 @@
1
+ import { unistyles } from '../core';
2
+ export const withPlugins = (key, style) => unistyles.registry.plugins.reduce((acc, plugin) => {
3
+ if (plugin.onParsedStyle) {
4
+ return plugin.onParsedStyle(key, style, unistyles.runtime);
5
+ }
6
+ return acc;
7
+ }, style);
8
+ //# sourceMappingURL=withPlugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["unistyles","withPlugins","key","style","registry","plugins","reduce","acc","plugin","onParsedStyle","runtime"],"sourceRoot":"../../../src","sources":["utils/withPlugins.ts"],"mappings":"AACA,SAASA,SAAS,QAAQ,SAAS;AAEnC,OAAO,MAAMC,WAAW,GAAGA,CACvBC,GAAW,EACXC,KAAc,KACbH,SAAS,CAACI,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;EACpD,IAAIA,MAAM,CAACC,aAAa,EAAE;IACtB,OAAOD,MAAM,CAACC,aAAa,CAACP,GAAG,EAAEC,KAAK,EAAEH,SAAS,CAACU,OAAO,CAAC;EAC9D;EAEA,OAAOH,GAAG;AACd,CAAC,EAAEJ,KAAK,CAAC"}
@@ -1,17 +1,28 @@
1
- export declare enum CxxUnistylesEventTypes {
1
+ export declare const warn: (message: string) => void;
2
+ export declare const isWeb: boolean;
3
+ export declare const isIOS: boolean;
4
+ export declare const isAndroid: boolean;
5
+ export declare const isMobile: boolean;
6
+ export declare const isServer: boolean;
7
+ export declare const ScreenOrientation: {
8
+ readonly Landscape: "landscape";
9
+ readonly Portrait: "portrait";
10
+ };
11
+ export declare enum UnistylesEventType {
2
12
  Theme = "theme",
3
- Layout = "layout"
13
+ Layout = "layout",
14
+ Plugin = "plugin"
4
15
  }
5
16
  export declare enum UnistylesError {
6
- RuntimeUnavailable = "UNISTYLES_ERROR_RUNTIME_UNAVAILABLE",
7
- ThemeNotFound = "UNISTYLES_ERROR_THEME_NOT_FOUND",
8
- ThemeNotRegistered = "UNISTYLES_ERROR_THEME_NOT_REGISTERED",
9
- ThemesCannotBeEmpty = "UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY",
10
- BreakpointsCannotBeEmpty = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY",
11
- BreakpointsMustStartFromZero = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO"
12
- }
13
- export declare enum ScreenOrientation {
14
- Portrait = 1,
15
- Landscape = 2
17
+ RuntimeUnavailable = "Unistyles runtime is not available. Make sure you followed the installation instructions",
18
+ ThemeNotFound = "You are trying to get a theme that is not registered with UnistylesRegistry",
19
+ ThemeNotRegistered = "You are trying to set a theme that was not registered with UnistylesRegistry",
20
+ ThemeNotSelected = "Your themes are registered, but you didn't select the initial theme",
21
+ ThemesCannotBeEmpty = "You are trying to register empty themes object",
22
+ BreakpointsCannotBeEmpty = "You are trying to register empty breakpoints object",
23
+ BreakpointsMustStartFromZero = "You are trying to register breakpoints that don't start from 0",
24
+ InvalidPluginName = "Plugin name can't start from reserved prefix __unistyles",
25
+ DuplicatePluginName = "You are trying to register a plugin with a name that is already registered",
26
+ CantRemoveInternalPlugin = "You are trying to remove an internal unistyles plugin"
16
27
  }
17
28
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAAA,oBAAY,sBAAsB;IAC9B,KAAK,UAAU;IACf,MAAM,WAAW;CACpB;AAED,oBAAY,cAAc;IACtB,kBAAkB,wCAAwC;IAC1D,aAAa,oCAAoC;IACjD,kBAAkB,yCAAyC;IAC3D,mBAAmB,2CAA2C;IAC9D,wBAAwB,gDAAgD;IACxE,4BAA4B,qDAAqD;CACpF;AAGD,oBAAY,iBAAiB;IACzB,QAAQ,IAAI;IACZ,SAAS,IAAI;CAChB"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,SAAS,SAA4B,CAAA;AAClD,eAAO,MAAM,QAAQ,SAAqB,CAAA;AAC1C,eAAO,MAAM,QAAQ,SAAgC,CAAA;AAErD,eAAO,MAAM,iBAAiB;;;CAGpB,CAAA;AAEV,oBAAY,kBAAkB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;CACpB;AAED,oBAAY,cAAc;IACtB,kBAAkB,6FAA6F;IAC/G,aAAa,gFAAgF;IAC7F,kBAAkB,iFAAiF;IACnG,gBAAgB,wEAAyE;IACzF,mBAAmB,mDAAmD;IACtE,wBAAwB,wDAAwD;IAChF,4BAA4B,mEAAoE;IAChG,iBAAiB,6DAA8D;IAC/E,mBAAmB,+EAA+E;IAClG,wBAAwB,0DAA0D;CACrF"}
@@ -1,15 +1,56 @@
1
- import type { UnistylesBridge, UnistylesConfig } from '../types';
1
+ import type { UnistylesBridge, UnistylesConfig, UnistylesPlugin } from '../types';
2
2
  import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
3
3
  export declare class UnistyleRegistry {
4
4
  private unistylesBridge;
5
5
  config: UnistylesConfig;
6
+ plugins: Array<UnistylesPlugin>;
6
7
  themeNames: Array<keyof UnistylesThemes>;
7
8
  themes: UnistylesThemes;
8
9
  breakpoints: UnistylesBreakpoints;
9
10
  sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
10
11
  constructor(unistylesBridge: UnistylesBridge);
11
- addThemes: (themes: UnistylesThemes) => this;
12
- addBreakpoints: (breakpoints: UnistylesBreakpoints) => this;
13
- addConfig: (config: UnistylesConfig) => this;
12
+ addThemes: (themes: UnistylesThemes) => {
13
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
14
+ addThemes: any;
15
+ addConfig: (config: UnistylesConfig) => {
16
+ addBreakpoints: any;
17
+ addThemes: any;
18
+ };
19
+ };
20
+ addConfig: (config: UnistylesConfig) => {
21
+ addBreakpoints: any;
22
+ addThemes: any;
23
+ };
24
+ };
25
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
26
+ addThemes: (themes: UnistylesThemes) => {
27
+ addBreakpoints: any;
28
+ addConfig: (config: UnistylesConfig) => {
29
+ addBreakpoints: any;
30
+ addThemes: any;
31
+ };
32
+ };
33
+ addConfig: (config: UnistylesConfig) => {
34
+ addBreakpoints: any;
35
+ addThemes: any;
36
+ };
37
+ };
38
+ addConfig: (config: UnistylesConfig) => {
39
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
40
+ addThemes: (themes: UnistylesThemes) => {
41
+ addBreakpoints: any;
42
+ addConfig: any;
43
+ };
44
+ addConfig: any;
45
+ };
46
+ addThemes: (themes: UnistylesThemes) => {
47
+ addBreakpoints: any;
48
+ addConfig: any;
49
+ };
50
+ };
51
+ getTheme: (forName: keyof UnistylesThemes) => never;
52
+ addPlugin: (plugin: UnistylesPlugin, notify?: boolean) => void;
53
+ removePlugin: (plugin: UnistylesPlugin) => void;
54
+ hasTheme: (name: keyof UnistylesThemes) => boolean;
14
55
  }
15
56
  //# sourceMappingURL=UnistyleRegistry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../../src/core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E,eAAe;IAE7C,SAAS,WAAY,eAAe;sCAcL,oBAAoB;;gCAW9B,eAAe;;;;;4BAAf,eAAe;;;;MAb1C;IAEM,cAAc,gBAAiB,oBAAoB;4BAd9B,eAAe;;gCAyBf,eAAe;;;;;4BAAf,eAAe;;;;MAF1C;IAEM,SAAS,WAAY,eAAe;sCAXL,oBAAoB;gCAd9B,eAAe;;;;;;4BAAf,eAAe;;;;MA4C1C;IAEM,QAAQ,YAAa,MAAM,eAAe,WAchD;IAEM,SAAS,WAAY,eAAe,WAAU,OAAO,UAW3D;IAEM,YAAY,WAAY,eAAe,UAO7C;IAEM,QAAQ,SAAU,MAAM,eAAe,aAAwB;CACzE"}
@@ -1,24 +1,23 @@
1
- import { ScreenOrientation } from '../common';
2
- import type { UnistylesBridge } from '../types';
1
+ import type { UnistylesBridge, UnistylesPlugin } from '../types';
3
2
  import type { UnistylesThemes } from '../global';
4
3
  import type { UnistyleRegistry } from './UnistyleRegistry';
5
4
  export declare class UnistylesRuntime {
6
5
  private unistylesBridge;
7
- private registry;
8
- constructor(unistylesBridge: UnistylesBridge, registry: UnistyleRegistry);
6
+ private unistylesRegistry;
7
+ constructor(unistylesBridge: UnistylesBridge, unistylesRegistry: UnistyleRegistry);
9
8
  get colorScheme(): import("../types").ColorSchemeName;
10
9
  get hasAdaptiveThemes(): boolean;
11
- get sortedBreakpoints(): [keyof import("../global").UnistylesBreakpoints, number | undefined][];
12
10
  get themeName(): never;
13
11
  get breakpoint(): keyof import("../global").UnistylesBreakpoints;
12
+ get enabledPlugins(): string[];
14
13
  get screen(): {
15
14
  width: number;
16
15
  height: number;
17
16
  };
18
- get orientation(): ScreenOrientation;
19
- setTheme: (name: keyof UnistylesThemes) => boolean;
20
- getTheme: (forName: keyof UnistylesThemes) => never;
17
+ get orientation(): "landscape" | "portrait";
18
+ setTheme: (name: keyof UnistylesThemes) => true | undefined;
21
19
  setAdaptiveThemes: (enable: boolean) => void;
22
- private hasTheme;
20
+ addPlugin: (plugin: UnistylesPlugin) => void;
21
+ removePlugin: (plugin: UnistylesPlugin) => void;
23
22
  }
24
23
  //# sourceMappingURL=UnistylesRuntime.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,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,iBAAiB;gBAA3D,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAEjG,IAAW,WAAW,uCAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,SAAS,UAEnB;IAED,IAAW,UAAU,mDAEpB;IAED,IAAW,cAAc,aAExB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,WAAW,6BAQrB;IAEM,QAAQ,SAAU,MAAM,eAAe,sBAY7C;IAEM,iBAAiB,WAAY,OAAO,UAE1C;IAEM,SAAS,WAAY,eAAe,UAE1C;IAEM,YAAY,WAAY,eAAe,UAE7C;CACJ"}
@@ -1,2 +1,3 @@
1
1
  export { unistyles } from './Unistyles';
2
+ export type { UnistylesRuntime } from './UnistylesRuntime';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
@@ -1,3 +1,3 @@
1
- import type { CustomNamedStyles, UnistylesTheme } from './types';
2
- export declare const createStyleSheet: <S, X>(styles: S | X | CustomNamedStyles<S> | ((theme: UnistylesTheme) => X | CustomNamedStyles<X>)) => S | X;
1
+ import type { StyleSheetWithSuperPowers } from './types';
2
+ export declare const createStyleSheet: <S extends StyleSheetWithSuperPowers>(stylesheet: S) => S;
3
3
  //# sourceMappingURL=createStyleSheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEhE,eAAO,MAAM,gBAAgB,yDAA0D,cAAc,wCAMpG,CAAA"}
1
+ {"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAExD,eAAO,MAAM,gBAAgB,2DAAwE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
1
+ {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;IAEjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -1,3 +1,4 @@
1
1
  export { useInitialTheme } from './useInitialTheme';
2
2
  export { useUnistyles } from './useUnistyles';
3
+ export { useVariants } from './useVariants';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
@@ -1,8 +1,9 @@
1
1
  export declare const useUnistyles: () => {
2
+ plugins: string[];
2
3
  theme: never;
3
4
  layout: {
4
5
  breakpoint: keyof import("..").UnistylesBreakpoints;
5
- orientation: import("../common").ScreenOrientation;
6
+ orientation: "landscape" | "portrait";
6
7
  screenSize: {
7
8
  width: number;
8
9
  height: number;
@@ -1 +1 @@
1
- {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;CA8CxB,CAAA"}
1
+ {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;;CAgDxB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Optional } from '../types';
2
+ export declare const useVariants: (variantsMap?: Record<string, Optional<string>>) => Optional<Record<string, Optional<string>>>;
3
+ //# sourceMappingURL=useVariants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVariants.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useVariants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,eAAO,MAAM,WAAW,iBAAkB,OAAO,MAAM,EAAE,SAAS,MAAM,CAAC,CAAC,+CAMzE,CAAA"}
@@ -1,15 +1,61 @@
1
1
  import { mq } from './utils';
2
2
  import { useInitialTheme } from './hooks';
3
+ import type { UnistylesPlugin } from './types';
3
4
  import type { UnistylesThemes, UnistylesBreakpoints } from './global';
4
5
  import { ScreenOrientation } from './common';
5
6
  import { useStyles } from './useStyles';
6
7
  import { createStyleSheet } from './createStyleSheet';
7
8
  declare const UnistylesRegistry: {
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;
9
+ addThemes: (themes: UnistylesThemes) => {
10
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
11
+ addThemes: any;
12
+ addConfig: (config: import("./types").UnistylesConfig) => {
13
+ addBreakpoints: any;
14
+ addThemes: any;
15
+ };
16
+ };
17
+ addConfig: (config: import("./types").UnistylesConfig) => {
18
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
19
+ addThemes: any;
20
+ addConfig: any;
21
+ };
22
+ addThemes: any;
23
+ };
24
+ };
25
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
26
+ addThemes: (themes: UnistylesThemes) => {
27
+ addBreakpoints: any;
28
+ addConfig: (config: import("./types").UnistylesConfig) => {
29
+ addBreakpoints: any;
30
+ addThemes: any;
31
+ };
32
+ };
33
+ addConfig: (config: import("./types").UnistylesConfig) => {
34
+ addBreakpoints: any;
35
+ addThemes: (themes: UnistylesThemes) => {
36
+ addBreakpoints: any;
37
+ addConfig: any;
38
+ };
39
+ };
40
+ };
41
+ addConfig: (config: import("./types").UnistylesConfig) => {
42
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
43
+ addThemes: (themes: UnistylesThemes) => {
44
+ addBreakpoints: any;
45
+ addConfig: any;
46
+ };
47
+ addConfig: any;
48
+ };
49
+ addThemes: (themes: UnistylesThemes) => {
50
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
51
+ addThemes: any;
52
+ addConfig: any;
53
+ };
54
+ addConfig: any;
55
+ };
56
+ };
11
57
  };
12
- declare const UnistylesRuntime: import("./core/UnistylesRuntime").UnistylesRuntime;
58
+ declare const UnistylesRuntime: import("./core").UnistylesRuntime;
13
59
  export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, UnistylesRegistry, UnistylesRuntime };
14
- export type { UnistylesThemes, UnistylesBreakpoints };
60
+ export type { UnistylesThemes, UnistylesBreakpoints, UnistylesPlugin };
15
61
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,QAAA,MAAM,iBAAiB;;;;CAItB,CAAA;AAED,QAAA,MAAM,gBAAgB,oDAAoB,CAAA;AAE1C,OAAO,EACH,EAAE,EACF,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EACnB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACvB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAItB,CAAA;AAED,QAAA,MAAM,gBAAgB,mCAAoB,CAAA;AAE1C,OAAO,EACH,EAAE,EACF,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EACnB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACpB,eAAe,EAClB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { normalizeWebStylesPlugin } from './normalizeWebStylesPlugin';
2
+ export { preprocessor, normalizeNumericValue, normalizeColor, normalizeStyle } from './normalizer';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { UnistylesPlugin } from '../types';
2
+ export declare const normalizeWebStylesPlugin: UnistylesPlugin;
3
+ //# sourceMappingURL=normalizeWebStylesPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeWebStylesPlugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/normalizeWebStylesPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C,eAAO,MAAM,wBAAwB,EAAE,eAGtC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { normalizeStyle } from './normalizeStyle';
2
+ export { preprocessor, normalizeNumericValue, normalizeColor } from './normalizer';
3
+ //# sourceMappingURL=index.d.ts.map