react-native-unistyles 1.2.0 → 2.0.0-alpha.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (253) hide show
  1. package/cxx/UnistylesRuntime.cpp +255 -0
  2. package/cxx/UnistylesRuntime.h +60 -0
  3. package/ios/UnistylesHelpers.h +4 -0
  4. package/ios/UnistylesHelpers.mm +20 -0
  5. package/ios/UnistylesModule.h +10 -0
  6. package/ios/UnistylesModule.mm +158 -0
  7. package/lib/commonjs/common.js +26 -0
  8. package/lib/commonjs/common.js.map +1 -0
  9. package/lib/commonjs/core/UnistyleRegistry.js +38 -0
  10. package/lib/commonjs/core/UnistyleRegistry.js.map +1 -0
  11. package/lib/commonjs/core/Unistyles.js +31 -0
  12. package/lib/commonjs/core/Unistyles.js.map +1 -0
  13. package/lib/commonjs/core/UnistylesModule.js +9 -0
  14. package/lib/commonjs/core/UnistylesModule.js.map +1 -0
  15. package/lib/commonjs/core/UnistylesRuntime.js +66 -0
  16. package/lib/commonjs/core/UnistylesRuntime.js.map +1 -0
  17. package/lib/commonjs/core/index.js +13 -0
  18. package/lib/commonjs/core/index.js.map +1 -0
  19. package/lib/commonjs/createStyleSheet.js +14 -0
  20. package/lib/commonjs/createStyleSheet.js.map +1 -0
  21. package/lib/commonjs/global.js +2 -0
  22. package/lib/commonjs/global.js.map +1 -0
  23. package/lib/commonjs/hooks/index.js +10 -3
  24. package/lib/commonjs/hooks/index.js.map +1 -1
  25. package/lib/commonjs/hooks/useInitialTheme.js +17 -0
  26. package/lib/commonjs/hooks/useInitialTheme.js.map +1 -0
  27. package/lib/commonjs/hooks/useUnistyles.js +54 -0
  28. package/lib/commonjs/hooks/useUnistyles.js.map +1 -0
  29. package/lib/commonjs/index.js +35 -6
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/types/common.js +2 -0
  32. package/lib/commonjs/types/{mediaQueries.js.map → common.js.map} +1 -1
  33. package/lib/commonjs/types/index.js +11 -0
  34. package/lib/commonjs/types/index.js.map +1 -1
  35. package/lib/commonjs/types/mq.js +6 -0
  36. package/lib/{module/types/mediaQueries.js.map → commonjs/types/mq.js.map} +1 -1
  37. package/lib/commonjs/types/unistyles.js +6 -0
  38. package/lib/commonjs/types/unistyles.js.map +1 -0
  39. package/lib/commonjs/useStyles.js +49 -0
  40. package/lib/commonjs/useStyles.js.map +1 -0
  41. package/lib/commonjs/utils/breakpoints.js +44 -82
  42. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  43. package/lib/commonjs/utils/common.js +6 -1
  44. package/lib/commonjs/utils/common.js.map +1 -1
  45. package/lib/commonjs/utils/index.js +25 -30
  46. package/lib/commonjs/utils/index.js.map +1 -1
  47. package/lib/commonjs/utils/mq.js +89 -0
  48. package/lib/commonjs/utils/mq.js.map +1 -0
  49. package/lib/commonjs/utils/mqParser.js +86 -0
  50. package/lib/commonjs/utils/mqParser.js.map +1 -0
  51. package/lib/commonjs/utils/styles.js +6 -53
  52. package/lib/commonjs/utils/styles.js.map +1 -1
  53. package/lib/commonjs/utils/variants.js +20 -0
  54. package/lib/commonjs/utils/variants.js.map +1 -0
  55. package/lib/module/common.js +22 -0
  56. package/lib/module/common.js.map +1 -0
  57. package/lib/module/core/UnistyleRegistry.js +31 -0
  58. package/lib/module/core/UnistyleRegistry.js.map +1 -0
  59. package/lib/module/core/Unistyles.js +25 -0
  60. package/lib/module/core/Unistyles.js.map +1 -0
  61. package/lib/module/core/UnistylesModule.js +3 -0
  62. package/lib/module/core/UnistylesModule.js.map +1 -0
  63. package/lib/module/core/UnistylesRuntime.js +59 -0
  64. package/lib/module/core/UnistylesRuntime.js.map +1 -0
  65. package/lib/module/core/index.js +2 -0
  66. package/lib/module/core/index.js.map +1 -0
  67. package/lib/module/createStyleSheet.js +7 -0
  68. package/lib/module/createStyleSheet.js.map +1 -0
  69. package/lib/module/global.js +2 -0
  70. package/lib/module/global.js.map +1 -0
  71. package/lib/module/hooks/index.js +2 -1
  72. package/lib/module/hooks/index.js.map +1 -1
  73. package/lib/module/hooks/useInitialTheme.js +10 -0
  74. package/lib/module/hooks/useInitialTheme.js.map +1 -0
  75. package/lib/module/hooks/useUnistyles.js +47 -0
  76. package/lib/module/hooks/useUnistyles.js.map +1 -0
  77. package/lib/module/index.js +13 -2
  78. package/lib/module/index.js.map +1 -1
  79. package/lib/module/types/common.js +2 -0
  80. package/lib/module/types/common.js.map +1 -0
  81. package/lib/module/types/index.js +1 -0
  82. package/lib/module/types/index.js.map +1 -1
  83. package/lib/module/types/mq.js +2 -0
  84. package/lib/module/types/mq.js.map +1 -0
  85. package/lib/module/types/unistyles.js +2 -0
  86. package/lib/module/types/unistyles.js.map +1 -0
  87. package/lib/module/useStyles.js +42 -0
  88. package/lib/module/useStyles.js.map +1 -0
  89. package/lib/module/utils/breakpoints.js +43 -82
  90. package/lib/module/utils/breakpoints.js.map +1 -1
  91. package/lib/module/utils/common.js +5 -0
  92. package/lib/module/utils/common.js.map +1 -1
  93. package/lib/module/utils/index.js +5 -3
  94. package/lib/module/utils/index.js.map +1 -1
  95. package/lib/module/utils/mq.js +83 -0
  96. package/lib/module/utils/mq.js.map +1 -0
  97. package/lib/module/utils/mqParser.js +79 -0
  98. package/lib/module/utils/mqParser.js.map +1 -0
  99. package/lib/module/utils/styles.js +7 -55
  100. package/lib/module/utils/styles.js.map +1 -1
  101. package/lib/module/utils/variants.js +13 -0
  102. package/lib/module/utils/variants.js.map +1 -0
  103. package/lib/typescript/src/common.d.ts +17 -0
  104. package/lib/typescript/src/common.d.ts.map +1 -0
  105. package/lib/typescript/src/core/UnistyleRegistry.d.ts +15 -0
  106. package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -0
  107. package/lib/typescript/src/core/Unistyles.d.ts +13 -0
  108. package/lib/typescript/src/core/Unistyles.d.ts.map +1 -0
  109. package/lib/typescript/src/core/UnistylesModule.d.ts +6 -0
  110. package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -0
  111. package/lib/typescript/src/core/UnistylesRuntime.d.ts +24 -0
  112. package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -0
  113. package/lib/typescript/src/core/index.d.ts +2 -0
  114. package/lib/typescript/src/core/index.d.ts.map +1 -0
  115. package/lib/typescript/src/createStyleSheet.d.ts +3 -0
  116. package/lib/typescript/src/createStyleSheet.d.ts.map +1 -0
  117. package/lib/typescript/src/global.d.ts +7 -0
  118. package/lib/typescript/src/global.d.ts.map +1 -0
  119. package/lib/typescript/src/hooks/index.d.ts +2 -1
  120. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  121. package/lib/typescript/src/hooks/useInitialTheme.d.ts +3 -0
  122. package/lib/typescript/src/hooks/useInitialTheme.d.ts.map +1 -0
  123. package/lib/typescript/src/hooks/useUnistyles.d.ts +12 -0
  124. package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -0
  125. package/lib/typescript/src/index.d.ts +14 -2
  126. package/lib/typescript/src/index.d.ts.map +1 -1
  127. package/lib/typescript/src/types/breakpoints.d.ts +12 -13
  128. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  129. package/lib/typescript/src/types/common.d.ts +3 -0
  130. package/lib/typescript/src/types/common.d.ts.map +1 -0
  131. package/lib/typescript/src/types/core.d.ts +34 -18
  132. package/lib/typescript/src/types/core.d.ts.map +1 -1
  133. package/lib/typescript/src/types/index.d.ts +5 -2
  134. package/lib/typescript/src/types/index.d.ts.map +1 -1
  135. package/lib/typescript/src/types/mq.d.ts +3 -0
  136. package/lib/typescript/src/types/mq.d.ts.map +1 -0
  137. package/lib/typescript/src/types/unistyles.d.ts +37 -0
  138. package/lib/typescript/src/types/unistyles.d.ts.map +1 -0
  139. package/lib/typescript/src/useStyles.d.ts +10 -0
  140. package/lib/typescript/src/useStyles.d.ts.map +1 -0
  141. package/lib/typescript/src/utils/breakpoints.d.ts +5 -62
  142. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  143. package/lib/typescript/src/utils/common.d.ts +5 -0
  144. package/lib/typescript/src/utils/common.d.ts.map +1 -1
  145. package/lib/typescript/src/utils/index.d.ts +5 -3
  146. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  147. package/lib/typescript/src/utils/mq.d.ts +21 -0
  148. package/lib/typescript/src/utils/mq.d.ts.map +1 -0
  149. package/lib/typescript/src/utils/mqParser.d.ts +3 -0
  150. package/lib/typescript/src/utils/mqParser.d.ts.map +1 -0
  151. package/lib/typescript/src/utils/styles.d.ts +4 -49
  152. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  153. package/lib/typescript/src/utils/variants.d.ts +3 -0
  154. package/lib/typescript/src/utils/variants.d.ts.map +1 -0
  155. package/package.json +30 -19
  156. package/react-native-unistyles.podspec +22 -0
  157. package/src/common.ts +19 -0
  158. package/src/core/UnistyleRegistry.ts +41 -0
  159. package/src/core/Unistyles.ts +34 -0
  160. package/src/core/UnistylesModule.ts +7 -0
  161. package/src/core/UnistylesRuntime.ts +73 -0
  162. package/src/core/index.ts +1 -0
  163. package/src/createStyleSheet.ts +9 -0
  164. package/src/global.ts +5 -0
  165. package/src/hooks/index.ts +2 -1
  166. package/src/hooks/useInitialTheme.ts +11 -0
  167. package/src/hooks/useUnistyles.ts +55 -0
  168. package/src/index.ts +30 -2
  169. package/src/types/breakpoints.ts +16 -19
  170. package/src/types/common.ts +2 -0
  171. package/src/types/core.ts +42 -24
  172. package/src/types/index.ts +5 -9
  173. package/src/types/mq.ts +3 -0
  174. package/src/types/unistyles.ts +45 -0
  175. package/src/useStyles.ts +56 -0
  176. package/src/utils/breakpoints.ts +57 -88
  177. package/src/utils/common.ts +6 -0
  178. package/src/utils/index.ts +5 -10
  179. package/src/utils/mq.ts +106 -0
  180. package/src/utils/mqParser.ts +99 -0
  181. package/src/utils/styles.ts +17 -64
  182. package/src/utils/variants.ts +17 -0
  183. package/lib/commonjs/UnistylesTheme.js +0 -21
  184. package/lib/commonjs/UnistylesTheme.js.map +0 -1
  185. package/lib/commonjs/createUnistyles.js +0 -57
  186. package/lib/commonjs/createUnistyles.js.map +0 -1
  187. package/lib/commonjs/hooks/useDimensions.js +0 -10
  188. package/lib/commonjs/hooks/useDimensions.js.map +0 -1
  189. package/lib/commonjs/hooks/useDimensions.web.js +0 -34
  190. package/lib/commonjs/hooks/useDimensions.web.js.map +0 -1
  191. package/lib/commonjs/types/mediaQueries.js +0 -2
  192. package/lib/commonjs/utils/mediaQueries.js +0 -189
  193. package/lib/commonjs/utils/mediaQueries.js.map +0 -1
  194. package/lib/module/UnistylesTheme.js +0 -12
  195. package/lib/module/UnistylesTheme.js.map +0 -1
  196. package/lib/module/createUnistyles.js +0 -50
  197. package/lib/module/createUnistyles.js.map +0 -1
  198. package/lib/module/hooks/useDimensions.js +0 -3
  199. package/lib/module/hooks/useDimensions.js.map +0 -1
  200. package/lib/module/hooks/useDimensions.web.js +0 -27
  201. package/lib/module/hooks/useDimensions.web.js.map +0 -1
  202. package/lib/module/types/mediaQueries.js +0 -2
  203. package/lib/module/utils/mediaQueries.js +0 -176
  204. package/lib/module/utils/mediaQueries.js.map +0 -1
  205. package/lib/typescript/examples/expo/src/App.d.ts +0 -3
  206. package/lib/typescript/examples/expo/src/App.d.ts.map +0 -1
  207. package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts +0 -3
  208. package/lib/typescript/examples/expo/src/examples/Breakpoints.d.ts.map +0 -1
  209. package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts +0 -3
  210. package/lib/typescript/examples/expo/src/examples/EmptyStyles.d.ts.map +0 -1
  211. package/lib/typescript/examples/expo/src/examples/Extreme.d.ts +0 -7
  212. package/lib/typescript/examples/expo/src/examples/Extreme.d.ts.map +0 -1
  213. package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts +0 -3
  214. package/lib/typescript/examples/expo/src/examples/MediaQueries.d.ts.map +0 -1
  215. package/lib/typescript/examples/expo/src/examples/Memoization.d.ts +0 -3
  216. package/lib/typescript/examples/expo/src/examples/Memoization.d.ts.map +0 -1
  217. package/lib/typescript/examples/expo/src/examples/Minimal.d.ts +0 -3
  218. package/lib/typescript/examples/expo/src/examples/Minimal.d.ts.map +0 -1
  219. package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts +0 -3
  220. package/lib/typescript/examples/expo/src/examples/MinimalWithCreateStyleSheet.d.ts.map +0 -1
  221. package/lib/typescript/examples/expo/src/examples/PlatformColors.d.ts +0 -3
  222. package/lib/typescript/examples/expo/src/examples/PlatformColors.d.ts.map +0 -1
  223. package/lib/typescript/examples/expo/src/examples/Theme.d.ts +0 -3
  224. package/lib/typescript/examples/expo/src/examples/Theme.d.ts.map +0 -1
  225. package/lib/typescript/examples/expo/src/examples/index.d.ts +0 -9
  226. package/lib/typescript/examples/expo/src/examples/index.d.ts.map +0 -1
  227. package/lib/typescript/examples/expo/src/index.d.ts +0 -2
  228. package/lib/typescript/examples/expo/src/index.d.ts.map +0 -1
  229. package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts +0 -8
  230. package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts.map +0 -1
  231. package/lib/typescript/examples/expo/src/styles/index.d.ts +0 -46
  232. package/lib/typescript/examples/expo/src/styles/index.d.ts.map +0 -1
  233. package/lib/typescript/examples/expo/src/styles/theme.d.ts +0 -24
  234. package/lib/typescript/examples/expo/src/styles/theme.d.ts.map +0 -1
  235. package/lib/typescript/src/UnistylesTheme.d.ts +0 -9
  236. package/lib/typescript/src/UnistylesTheme.d.ts.map +0 -1
  237. package/lib/typescript/src/createUnistyles.d.ts +0 -10
  238. package/lib/typescript/src/createUnistyles.d.ts.map +0 -1
  239. package/lib/typescript/src/hooks/useDimensions.d.ts +0 -3
  240. package/lib/typescript/src/hooks/useDimensions.d.ts.map +0 -1
  241. package/lib/typescript/src/hooks/useDimensions.web.d.ts +0 -3
  242. package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +0 -1
  243. package/lib/typescript/src/types/mediaQueries.d.ts +0 -8
  244. package/lib/typescript/src/types/mediaQueries.d.ts.map +0 -1
  245. package/lib/typescript/src/utils/mediaQueries.d.ts +0 -130
  246. package/lib/typescript/src/utils/mediaQueries.d.ts.map +0 -1
  247. package/src/UnistylesTheme.tsx +0 -17
  248. package/src/__tests__/createUnistyles.spec.tsx +0 -192
  249. package/src/createUnistyles.ts +0 -70
  250. package/src/hooks/useDimensions.ts +0 -4
  251. package/src/hooks/useDimensions.web.ts +0 -34
  252. package/src/types/mediaQueries.ts +0 -10
  253. package/src/utils/mediaQueries.ts +0 -201
@@ -0,0 +1,255 @@
1
+ #include "UnistylesRuntime.h"
2
+
3
+ #include <string>
4
+ #include <vector>
5
+
6
+ #pragma region HostObject
7
+
8
+ std::vector<jsi::PropNameID> UnistylesRuntime::getPropertyNames(jsi::Runtime& runtime) {
9
+ std::vector<jsi::PropNameID> properties;
10
+
11
+ // getters
12
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("screenWidth")));
13
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("screenHeight")));
14
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("hasAdaptiveThemes")));
15
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("themeName")));
16
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("breakpoint")));
17
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("colorScheme")));
18
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("sortedBreakpointPairs")));
19
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("useBreakpoints")));
20
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("useTheme")));
21
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("useAdaptiveThemes")));
22
+
23
+ // setters
24
+ properties.push_back(jsi::PropNameID::forUtf8(runtime, std::string("themes")));
25
+
26
+ return properties;
27
+ }
28
+
29
+
30
+ jsi::Value UnistylesRuntime::get(jsi::Runtime& runtime, const jsi::PropNameID& propNameId) {
31
+ std::string propName = propNameId.utf8(runtime);
32
+
33
+ if (propName == "screenWidth") {
34
+ return jsi::Value(this->screenWidth);
35
+ }
36
+
37
+ if (propName == "screenHeight") {
38
+ return jsi::Value(this->screenHeight);
39
+ }
40
+
41
+ if (propName == "hasAdaptiveThemes") {
42
+ return jsi::Value(this->hasAdaptiveThemes);
43
+ }
44
+
45
+ if (propName == "themeName") {
46
+ return !this->themeName.empty()
47
+ ? jsi::Value(jsi::String::createFromUtf8(runtime, this->themeName))
48
+ : this->getThemeOrFail(runtime);
49
+ }
50
+
51
+ if (propName == "breakpoint") {
52
+ return !this->breakpoint.empty()
53
+ ? jsi::Value(jsi::String::createFromUtf8(runtime, this->breakpoint))
54
+ : jsi::Value::undefined();
55
+ }
56
+
57
+ if (propName == "colorScheme") {
58
+ return jsi::Value(jsi::String::createFromUtf8(runtime, this->colorScheme));
59
+ }
60
+
61
+ if (propName == "sortedBreakpointPairs") {
62
+ std::unique_ptr<jsi::Array> sortedBreakpointEntriesArray = std::make_unique<jsi::Array>(runtime, this->sortedBreakpointPairs.size());
63
+
64
+ for (size_t i = 0; i < this->sortedBreakpointPairs.size(); ++i) {
65
+ std::unique_ptr<jsi::Array> pairArray = std::make_unique<jsi::Array>(runtime, 2);
66
+ jsi::String nameValue = jsi::String::createFromUtf8(runtime, this->sortedBreakpointPairs[i].first);
67
+
68
+ pairArray->setValueAtIndex(runtime, 0, nameValue);
69
+ pairArray->setValueAtIndex(runtime, 1, jsi::Value(this->sortedBreakpointPairs[i].second));
70
+ sortedBreakpointEntriesArray->setValueAtIndex(runtime, i, *pairArray);
71
+ }
72
+
73
+ return jsi::Value(runtime, *sortedBreakpointEntriesArray);
74
+ }
75
+
76
+ if (propName == "useBreakpoints") {
77
+ return jsi::Function::createFromHostFunction(
78
+ runtime,
79
+ jsi::PropNameID::forAscii(runtime, "useBreakpoints"),
80
+ 1,
81
+ [this](jsi::Runtime &runtime, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count) -> jsi::Value {
82
+ jsi::Object breakpointsObj = arguments[0].asObject(runtime);
83
+ jsi::Array propertyNames = breakpointsObj.getPropertyNames(runtime);
84
+ std::vector<std::pair<std::string, double>> sortedBreakpointEntriesVec;
85
+
86
+ for (size_t i = 0; i < propertyNames.size(runtime); ++i) {
87
+ jsi::Value propNameValue = propertyNames.getValueAtIndex(runtime, i);
88
+ std::string name = propNameValue.asString(runtime).utf8(runtime);
89
+ jsi::PropNameID propNameID = jsi::PropNameID::forUtf8(runtime, name);
90
+ jsi::Value value = breakpointsObj.getProperty(runtime, propNameID);
91
+
92
+ if (value.isNumber()) {
93
+ double breakpointValue = value.asNumber();
94
+ sortedBreakpointEntriesVec.push_back(std::make_pair(name, breakpointValue));
95
+ }
96
+ }
97
+
98
+ std::sort(sortedBreakpointEntriesVec.begin(), sortedBreakpointEntriesVec.end(), [](const std::pair<std::string, double>& a, const std::pair<std::string, double>& b) {
99
+ return a.second < b.second;
100
+ });
101
+
102
+ if (sortedBreakpointEntriesVec.size() == 0) {
103
+ throw jsi::JSError(runtime, UnistylesErrorBreakpointsCannotBeEmpty);
104
+ }
105
+
106
+ if (sortedBreakpointEntriesVec.at(0).second != 0) {
107
+ throw jsi::JSError(runtime, UnistylesErrorBreakpointsMustStartFromZero);
108
+ }
109
+
110
+ this->sortedBreakpointPairs = sortedBreakpointEntriesVec;
111
+
112
+ std::string breakpoint = this->getBreakpointFromScreenWidth(this->screenWidth, sortedBreakpointEntriesVec);
113
+
114
+ this->breakpoint = breakpoint;
115
+
116
+ return jsi::Value::undefined();
117
+ }
118
+ );
119
+ }
120
+
121
+ if (propName == "useTheme") {
122
+ return jsi::Function::createFromHostFunction(runtime,
123
+ jsi::PropNameID::forAscii(runtime, "useTheme"),
124
+ 1,
125
+ [this](jsi::Runtime &runtime, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count) -> jsi::Value {
126
+ std::string themeName = arguments[0].asString(runtime).utf8(runtime);
127
+
128
+ if (this->themeName != themeName) {
129
+ this->themeName = themeName;
130
+ this->onThemeChangeCallback(themeName);
131
+ }
132
+
133
+ return jsi::Value::undefined();
134
+ }
135
+ );
136
+ }
137
+
138
+ if (propName == "useAdaptiveThemes") {
139
+ return jsi::Function::createFromHostFunction(runtime,
140
+ jsi::PropNameID::forAscii(runtime, "useAdaptiveThemes"),
141
+ 1,
142
+ [this](jsi::Runtime &runtime, const jsi::Value &thisVal, const jsi::Value *arguments, size_t count) -> jsi::Value {
143
+ bool enableAdaptiveThemes = arguments[0].asBool();
144
+
145
+ this->hasAdaptiveThemes = enableAdaptiveThemes;
146
+
147
+ if (!enableAdaptiveThemes || !this->supportsAutomaticColorScheme) {
148
+ return jsi::Value::undefined();
149
+ }
150
+
151
+ if (this->themeName != this->colorScheme) {
152
+ this->themeName = this->colorScheme;
153
+ this->onThemeChangeCallback(this->themeName);
154
+ }
155
+
156
+ return jsi::Value::undefined();
157
+ }
158
+ );
159
+ }
160
+
161
+ return jsi::Value::undefined();
162
+ }
163
+
164
+ void UnistylesRuntime::set(jsi::Runtime& runtime, const jsi::PropNameID& propNameId, const jsi::Value& value) {
165
+ std::string propName = propNameId.utf8(runtime);
166
+
167
+ if (propName == "themes" && value.isObject()) {
168
+ jsi::Array themes = value.asObject(runtime).asArray(runtime);
169
+ std::vector<std::string> themesVector;
170
+ size_t length = themes.size(runtime);
171
+
172
+ for (size_t i = 0; i < length; ++i) {
173
+ jsi::Value element = themes.getValueAtIndex(runtime, i);
174
+
175
+ if (element.isString()) {
176
+ std::string theme = element.asString(runtime).utf8(runtime);
177
+ themesVector.push_back(theme);
178
+ }
179
+ }
180
+
181
+ if (themesVector.size() == 0) {
182
+ throw jsi::JSError(runtime, UnistylesErrorThemesCannotBeEmpty);
183
+ }
184
+
185
+ this->themes = themesVector;
186
+ this->themeName = "";
187
+
188
+ bool hasLightTheme = std::find(themesVector.begin(), themesVector.end(), "light") != themesVector.end();
189
+ bool hasDarkTheme = std::find(themesVector.begin(), themesVector.end(), "dark") != themesVector.end();
190
+
191
+ this->supportsAutomaticColorScheme = hasLightTheme && hasDarkTheme;
192
+
193
+ return;
194
+ }
195
+ }
196
+
197
+ #pragma endregion
198
+ #pragma region Helpers
199
+
200
+ std::string UnistylesRuntime::getBreakpointFromScreenWidth(int width, const std::vector<std::pair<std::string, double>>& sortedBreakpointPairs) {
201
+ for (size_t i = 0; i < sortedBreakpointPairs.size(); ++i) {
202
+ const auto& [key, value] = sortedBreakpointPairs[i];
203
+ const double maxVal = (i + 1 < sortedBreakpointPairs.size()) ? sortedBreakpointPairs[i + 1].second : std::numeric_limits<double>::infinity();
204
+
205
+ if (width >= value && width < maxVal) {
206
+ return key;
207
+ }
208
+ }
209
+
210
+ return sortedBreakpointPairs.empty() ? "" : sortedBreakpointPairs.back().first;
211
+ }
212
+
213
+ void UnistylesRuntime::handleScreenSizeChange(int width, int height) {
214
+ std::string breakpoint = this->getBreakpointFromScreenWidth(width, this->sortedBreakpointPairs);
215
+ bool shouldNotify = this->breakpoint != breakpoint || this->screenWidth != width || this->screenHeight != height;
216
+
217
+ this->breakpoint = breakpoint;
218
+ this->screenWidth = width;
219
+ this->screenHeight = height;
220
+
221
+ int orientation = width > height
222
+ ? UnistylesOrientationLandscape
223
+ : UnistylesOrientationPortrait;
224
+
225
+ if (shouldNotify) {
226
+ this->onLayoutChangeCallback(breakpoint, orientation, width, height);
227
+ }
228
+ }
229
+
230
+ void UnistylesRuntime::handleAppearanceChange(std::string colorScheme) {
231
+ this->colorScheme = colorScheme;
232
+
233
+ if (!this->supportsAutomaticColorScheme || !this->hasAdaptiveThemes) {
234
+ return;
235
+ }
236
+
237
+ if (this->themeName != this->colorScheme) {
238
+ this->onThemeChangeCallback(this->colorScheme);
239
+ this->themeName = this->colorScheme;
240
+ }
241
+ }
242
+
243
+ jsi::Value UnistylesRuntime::getThemeOrFail(jsi::Runtime& runtime) {
244
+ if (this->themes.size() == 1) {
245
+ std::string themeName = this->themes.at(0);
246
+
247
+ this->themeName = themeName;
248
+
249
+ return jsi::String::createFromUtf8(runtime, themeName);
250
+ }
251
+
252
+ return jsi::Value().undefined();
253
+ }
254
+
255
+ #pragma endregion
@@ -0,0 +1,60 @@
1
+ #pragma once
2
+
3
+ #include <jsi/jsi.h>
4
+ #include <vector>
5
+
6
+ using namespace facebook;
7
+
8
+ const int UnistylesOrientationPortrait = 1;
9
+ const int UnistylesOrientationLandscape = 2;
10
+
11
+ const std::string UnistylesDarkScheme = "dark";
12
+ const std::string UnistylesLightScheme = "light";
13
+ const std::string UnistylesUnspecifiedScheme = "unspecified";
14
+
15
+ const std::string UnistylesErrorBreakpointsCannotBeEmpty = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY'";
16
+ const std::string UnistylesErrorBreakpointsMustStartFromZero = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZER0";
17
+ const std::string UnistylesErrorThemesCannotBeEmpty = "UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY";
18
+
19
+ class JSI_EXPORT UnistylesRuntime : public jsi::HostObject {
20
+ private:
21
+ std::function<void(std::string)> onThemeChangeCallback;
22
+ std::function<void(std::string breakpoint, int layout, int screenWidth, int screenHeight)> onLayoutChangeCallback;
23
+
24
+ int screenWidth;
25
+ int screenHeight;
26
+ std::string colorScheme;
27
+
28
+ public:
29
+ UnistylesRuntime(
30
+ int screenWidth,
31
+ int screenHeight,
32
+ std::string colorScheme
33
+ ): screenWidth(screenWidth), screenHeight(screenHeight), colorScheme(colorScheme) {}
34
+
35
+ bool hasAdaptiveThemes;
36
+ bool supportsAutomaticColorScheme;
37
+
38
+ std::string themeName;
39
+ std::string breakpoint;
40
+ std::vector<std::string> themes;
41
+ std::vector<std::pair<std::string, double>> sortedBreakpointPairs;
42
+
43
+ void onThemeChange(std::function<void(std::string)> callback) {
44
+ this->onThemeChangeCallback = callback;
45
+ }
46
+
47
+ void onLayoutChange(std::function<void(std::string breakpoint, int layout, int screenWidth, int screenHeight)> callback) {
48
+ this->onLayoutChangeCallback = callback;
49
+ }
50
+
51
+ jsi::Value get(jsi::Runtime&, const jsi::PropNameID& name) override;
52
+ void set(jsi::Runtime& runtime, const jsi::PropNameID& propNameId, const jsi::Value& value) override;
53
+ std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override;
54
+
55
+ void handleScreenSizeChange(int width, int height);
56
+ void handleAppearanceChange(std::string colorScheme);
57
+
58
+ jsi::Value getThemeOrFail(jsi::Runtime&);
59
+ std::string getBreakpointFromScreenWidth(int width, const std::vector<std::pair<std::string, double>>& sortedBreakpointEntries);
60
+ };
@@ -0,0 +1,4 @@
1
+ #include <string>
2
+
3
+ std::string getColorScheme();
4
+ NSString* cxxStringToNSString(std::string);
@@ -0,0 +1,20 @@
1
+ #import "UnistylesHelpers.h"
2
+ #import "UnistylesRuntime.h"
3
+
4
+ std::string getColorScheme() {
5
+ UIUserInterfaceStyle colorScheme = [UIScreen mainScreen].traitCollection.userInterfaceStyle;
6
+
7
+ switch (colorScheme) {
8
+ case UIUserInterfaceStyleLight:
9
+ return UnistylesLightScheme;
10
+ case UIUserInterfaceStyleDark:
11
+ return UnistylesDarkScheme;
12
+ case UIUserInterfaceStyleUnspecified:
13
+ default:
14
+ return UnistylesUnspecifiedScheme;
15
+ }
16
+ }
17
+
18
+ NSString* cxxStringToNSString(std::string cxxString) {
19
+ return [NSString stringWithUTF8String:cxxString.c_str()];
20
+ }
@@ -0,0 +1,10 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTEventEmitter.h>
3
+ #import <string>
4
+
5
+ @interface UnistylesModule : RCTEventEmitter<RCTBridgeModule>
6
+
7
+ @property (nonatomic, assign) BOOL hasListeners;
8
+ @property (nonatomic, assign) void* unistylesRuntime;
9
+
10
+ @end
@@ -0,0 +1,158 @@
1
+ #import "UnistylesModule.h"
2
+ #import "UnistylesHelpers.h"
3
+ #import "UnistylesRuntime.h"
4
+
5
+ #import <React/RCTAppearance.h>
6
+ #import <React/RCTBridge+Private.h>
7
+ #import <jsi/jsi.h>
8
+
9
+ using namespace facebook;
10
+
11
+ @implementation UnistylesModule
12
+
13
+ RCT_EXPORT_MODULE(Unistyles)
14
+
15
+ #pragma mark - Lifecycle
16
+
17
+ - (instancetype)init {
18
+ if ((self = [super init])) {
19
+ [[NSNotificationCenter defaultCenter] addObserver:self
20
+ selector:@selector(handleOrientationChange:)
21
+ name:UIDeviceOrientationDidChangeNotification
22
+ object:nil];
23
+ [[NSNotificationCenter defaultCenter] addObserver:self
24
+ selector:@selector(appearanceChanged:)
25
+ name:RCTUserInterfaceStyleDidChangeNotification
26
+ object:nil];
27
+ }
28
+
29
+ return self;
30
+ }
31
+
32
+ - (void)dealloc {
33
+ if (self.unistylesRuntime != nullptr) {
34
+ self.unistylesRuntime = nullptr;
35
+ }
36
+
37
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
38
+ }
39
+
40
+
41
+ + (BOOL)requiresMainQueueSetup {
42
+ return YES;
43
+ }
44
+
45
+ #pragma mark - Event handlers
46
+
47
+ - (void)handleOrientationChange:(NSNotification *)notification {
48
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
49
+ CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
50
+ CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
51
+
52
+ if (self.unistylesRuntime != nullptr) {
53
+ ((UnistylesRuntime*)self.unistylesRuntime)->handleScreenSizeChange((int)screenWidth, (int)screenHeight);
54
+ }
55
+ });
56
+ }
57
+
58
+ - (void)appearanceChanged:(NSNotification *)notification {
59
+ std::string colorScheme = getColorScheme();
60
+
61
+ if (self.unistylesRuntime != nullptr) {
62
+ ((UnistylesRuntime*)self.unistylesRuntime)->handleAppearanceChange(colorScheme);
63
+ }
64
+ }
65
+
66
+ #pragma mark - Event emitter
67
+ - (NSArray<NSString *> *)supportedEvents {
68
+ return @[@"onChange"];
69
+ }
70
+
71
+ - (void)startObserving {
72
+ self.hasListeners = YES;
73
+ }
74
+
75
+ - (void)stopObserving {
76
+ self.hasListeners = NO;
77
+ }
78
+
79
+ - (void)emitEvent:(NSString *)eventName withBody:(NSDictionary *)body {
80
+ if (self.hasListeners) {
81
+ [self sendEventWithName:@"onChange" body:body];
82
+ }
83
+ }
84
+
85
+ #pragma mark - Core
86
+
87
+ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) {
88
+ RCTBridge* bridge = [RCTBridge currentBridge];
89
+ RCTCxxBridge* cxxBridge = (RCTCxxBridge*)bridge;
90
+
91
+ if (cxxBridge == nil) {
92
+ return @false;
93
+ }
94
+
95
+ auto jsiRuntime = (jsi::Runtime*)cxxBridge.runtime;
96
+
97
+ if (jsiRuntime == nil) {
98
+ return @false;
99
+ }
100
+
101
+ auto& runtime = *jsiRuntime;
102
+ UnistylesModule *__weak weakSelf = self;
103
+
104
+ registerUnistylesHostObject(runtime, weakSelf);
105
+
106
+ NSLog(@"Installed Unistyles 🦄!");
107
+
108
+ return @true;
109
+ }
110
+
111
+ void registerUnistylesHostObject(jsi::Runtime &runtime, UnistylesModule* weakSelf) {
112
+ CGFloat initialScreenWidth = [UIScreen mainScreen].bounds.size.width;
113
+ CGFloat initialScreenHeight = [UIScreen mainScreen].bounds.size.height;
114
+ std::string initialColorScheme = getColorScheme();
115
+
116
+ auto unistylesRuntime = std::make_shared<UnistylesRuntime>(
117
+ (int)initialScreenWidth,
118
+ (int)initialScreenHeight,
119
+ initialColorScheme
120
+ );
121
+
122
+ unistylesRuntime.get()->onThemeChange([=](std::string theme) {
123
+ NSDictionary *body = @{
124
+ @"type": @"theme",
125
+ @"payload": @{
126
+ @"themeName": cxxStringToNSString(theme)
127
+ }
128
+ };
129
+
130
+ [weakSelf emitEvent:@"onChange" withBody:body];
131
+ });
132
+
133
+ unistylesRuntime.get()->onLayoutChange([=](std::string breakpoint, int orientation, int width, int height) {
134
+ NSDictionary *body = @{
135
+ @"type": @"layout",
136
+ @"payload": @{
137
+ @"breakpoint": cxxStringToNSString(breakpoint),
138
+ @"orientation": @(orientation),
139
+ @"screen": @{
140
+ @"width": @(width),
141
+ @"height": @(height)
142
+ }
143
+ }
144
+ };
145
+
146
+ [weakSelf emitEvent:@"onChange" withBody:body];
147
+ });
148
+
149
+ weakSelf.unistylesRuntime = unistylesRuntime.get();
150
+
151
+ auto hostObject = jsi::Object::createFromHostObject(runtime, unistylesRuntime);
152
+
153
+ runtime.global().setProperty(runtime, "__UNISTYLES__", std::move(hostObject));
154
+ }
155
+
156
+ @end
157
+
158
+ #pragma mark - End
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UnistylesError = exports.ScreenOrientation = exports.CxxUnistylesEventTypes = void 0;
7
+ let CxxUnistylesEventTypes = exports.CxxUnistylesEventTypes = /*#__PURE__*/function (CxxUnistylesEventTypes) {
8
+ CxxUnistylesEventTypes["Theme"] = "theme";
9
+ CxxUnistylesEventTypes["Layout"] = "layout";
10
+ return CxxUnistylesEventTypes;
11
+ }({});
12
+ let UnistylesError = exports.UnistylesError = /*#__PURE__*/function (UnistylesError) {
13
+ UnistylesError["RuntimeUnavailable"] = "UNISTYLES_ERROR_RUNTIME_UNAVAILABLE";
14
+ UnistylesError["ThemeNotFound"] = "UNISTYLES_ERROR_THEME_NOT_FOUND";
15
+ UnistylesError["ThemeNotRegistered"] = "UNISTYLES_ERROR_THEME_NOT_REGISTERED";
16
+ UnistylesError["ThemesCannotBeEmpty"] = "UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY";
17
+ UnistylesError["BreakpointsCannotBeEmpty"] = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY";
18
+ UnistylesError["BreakpointsMustStartFromZero"] = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO";
19
+ return UnistylesError;
20
+ }({}); // todo to string?
21
+ let ScreenOrientation = exports.ScreenOrientation = /*#__PURE__*/function (ScreenOrientation) {
22
+ ScreenOrientation[ScreenOrientation["Portrait"] = 1] = "Portrait";
23
+ ScreenOrientation[ScreenOrientation["Landscape"] = 2] = "Landscape";
24
+ return ScreenOrientation;
25
+ }({});
26
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CxxUnistylesEventTypes","exports","UnistylesError","ScreenOrientation"],"sourceRoot":"../../src","sources":["common.ts"],"mappings":";;;;;;IAAYA,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAAA,IAKtBE,cAAc,GAAAD,OAAA,CAAAC,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA,OAS1B;AAAA,IACYC,iBAAiB,GAAAF,OAAA,CAAAE,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UnistyleRegistry = void 0;
7
+ class UnistyleRegistry {
8
+ config = {};
9
+ themeNames = [];
10
+ themes = {};
11
+ breakpoints = {};
12
+ sortedBreakpointPairs = [];
13
+ constructor(unistylesBridge) {
14
+ this.unistylesBridge = unistylesBridge;
15
+ }
16
+ addThemes = themes => {
17
+ this.themes = themes;
18
+ const keys = Object.keys(themes);
19
+ this.unistylesBridge.themes = keys;
20
+ this.themeNames = keys;
21
+ return this;
22
+ };
23
+ addBreakpoints = breakpoints => {
24
+ this.breakpoints = breakpoints;
25
+ this.unistylesBridge.useBreakpoints(breakpoints);
26
+ this.sortedBreakpointPairs = this.unistylesBridge.sortedBreakpointPairs;
27
+ return this;
28
+ };
29
+ addConfig = config => {
30
+ this.config = config;
31
+ if (config.adaptiveThemes) {
32
+ this.unistylesBridge.useAdaptiveThemes(config.adaptiveThemes);
33
+ }
34
+ return this;
35
+ };
36
+ }
37
+ exports.UnistyleRegistry = UnistyleRegistry;
38
+ //# sourceMappingURL=UnistyleRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnistyleRegistry","config","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","useBreakpoints","addConfig","adaptiveThemes","useAdaptiveThemes","exports"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":";;;;;;AAGO,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,CAACA,WAAW,GAAGA,WAAW;IAC9B,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;AACL;AAACE,OAAA,CAAAhB,gBAAA,GAAAA,gBAAA"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.unistyles = void 0;
7
+ var _UnistylesModule = require("./UnistylesModule");
8
+ var _UnistylesRuntime = require("./UnistylesRuntime");
9
+ var _UnistyleRegistry = require("./UnistyleRegistry");
10
+ var _common = require("../common");
11
+ class Unistyles {
12
+ constructor() {
13
+ const isInstalled = _UnistylesModule.UnistylesModule?.install() ?? false;
14
+ if (!isInstalled) {
15
+ throw new Error(_common.UnistylesError.RuntimeUnavailable);
16
+ }
17
+
18
+ // @ts-ignore
19
+ this._bridge = global.__UNISTYLES__;
20
+ this._registry = new _UnistyleRegistry.UnistyleRegistry(this._bridge);
21
+ this._runtime = new _UnistylesRuntime.UnistylesRuntime(this._bridge, this._registry);
22
+ }
23
+ get registry() {
24
+ return this._registry;
25
+ }
26
+ get runtime() {
27
+ return this._runtime;
28
+ }
29
+ }
30
+ const unistyles = exports.unistyles = new Unistyles();
31
+ //# sourceMappingURL=Unistyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_UnistylesModule","require","_UnistylesRuntime","_UnistyleRegistry","_common","Unistyles","constructor","isInstalled","UnistylesModule","install","Error","UnistylesError","RuntimeUnavailable","_bridge","global","__UNISTYLES__","_registry","UnistyleRegistry","_runtime","UnistylesRuntime","registry","runtime","unistyles","exports"],"sourceRoot":"../../../src","sources":["core/Unistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,SAAS,CAAC;EAKZC,WAAWA,CAAA,EAAG;IACV,MAAMC,WAAW,GAAGC,gCAAe,EAAEC,OAAO,CAAC,CAAC,IAAI,KAAK;IAEvD,IAAI,CAACF,WAAW,EAAE;MACd,MAAM,IAAIG,KAAK,CAACC,sBAAc,CAACC,kBAAkB,CAAC;IACtD;;IAEA;IACA,IAAI,CAACC,OAAO,GAAGC,MAAM,CAACC,aAAgC;IACtD,IAAI,CAACC,SAAS,GAAG,IAAIC,kCAAgB,CAAC,IAAI,CAACJ,OAAO,CAAC;IACnD,IAAI,CAACK,QAAQ,GAAG,IAAIC,kCAAgB,CAAC,IAAI,CAACN,OAAO,EAAE,IAAI,CAACG,SAAS,CAAC;EACtE;EAEA,IAAWI,QAAQA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACJ,SAAS;EACzB;EAEA,IAAWK,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACH,QAAQ;EACxB;AACJ;AAEO,MAAMI,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,IAAIjB,SAAS,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UnistylesModule = void 0;
7
+ var _reactNative = require("react-native");
8
+ const UnistylesModule = exports.UnistylesModule = _reactNative.NativeModules?.Unistyles;
9
+ //# sourceMappingURL=UnistylesModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","UnistylesModule","exports","NativeModules","Unistyles"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMO,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAGE,0BAAa,EAAEC,SAAkC"}