react-native-unistyles 3.0.0-alpha.33 → 3.0.0-alpha.34

Sign up to get free protection for your applications and to get access to all the features.
Files changed (280) hide show
  1. package/cxx/common/Helpers.h +24 -2
  2. package/cxx/core/HostStyle.cpp +1 -1
  3. package/cxx/core/UnistyleWrapper.h +31 -1
  4. package/cxx/core/UnistylesMountHook.cpp +1 -1
  5. package/cxx/core/UnistylesMountHook.h +4 -2
  6. package/cxx/core/UnistylesRegistry.cpp +7 -1
  7. package/cxx/hybridObjects/HybridShadowRegistry.cpp +1 -2
  8. package/cxx/hybridObjects/HybridShadowRegistry.h +1 -3
  9. package/cxx/hybridObjects/HybridStyleSheet.cpp +4 -1
  10. package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +12 -0
  11. package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -0
  12. package/cxx/parser/Parser.cpp +6 -6
  13. package/cxx/parser/Parser.h +1 -1
  14. package/cxx/shadowTree/ShadowTrafficController.h +2 -0
  15. package/lib/commonjs/components/Display.js +18 -0
  16. package/lib/commonjs/components/Display.js.map +1 -0
  17. package/lib/commonjs/components/Hide.js +18 -0
  18. package/lib/commonjs/components/Hide.js.map +1 -0
  19. package/lib/commonjs/components/index.js +20 -0
  20. package/lib/commonjs/components/index.js.map +1 -0
  21. package/lib/commonjs/components/useMedia.js +59 -0
  22. package/lib/commonjs/components/useMedia.js.map +1 -0
  23. package/lib/commonjs/core/createUnistylesComponent.js +2 -1
  24. package/lib/commonjs/core/createUnistylesComponent.js.map +1 -1
  25. package/lib/commonjs/core/createUnistylesComponent.native.js +40 -2
  26. package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -1
  27. package/lib/commonjs/core/index.js +0 -14
  28. package/lib/commonjs/core/index.js.map +1 -1
  29. package/lib/commonjs/global.js +0 -4
  30. package/lib/commonjs/global.js.map +1 -1
  31. package/lib/commonjs/index.js +12 -14
  32. package/lib/commonjs/index.js.map +1 -1
  33. package/lib/commonjs/mq.js +27 -11
  34. package/lib/commonjs/mq.js.map +1 -2
  35. package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +0 -1
  36. package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -2
  37. package/lib/commonjs/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +1 -1
  38. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -2
  39. package/lib/commonjs/specs/ShadowRegistry/types.js +0 -4
  40. package/lib/commonjs/specs/ShadowRegistry/types.js.map +1 -1
  41. package/lib/commonjs/specs/StatusBar/index.js.map +1 -2
  42. package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js +4 -2
  43. package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +1 -1
  44. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js +3 -1
  45. package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -2
  46. package/lib/commonjs/specs/TurboUnistyles/index.js.map +1 -1
  47. package/lib/commonjs/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +1 -1
  48. package/lib/commonjs/specs/index.web.js.map +1 -2
  49. package/lib/commonjs/specs/types.js +10 -10
  50. package/lib/commonjs/specs/types.js.map +1 -1
  51. package/lib/commonjs/types/accessibility.js +9 -9
  52. package/lib/commonjs/types/accessibility.js.map +1 -1
  53. package/lib/commonjs/types/breakpoints.js.map +1 -1
  54. package/lib/commonjs/types/common.js +0 -4
  55. package/lib/commonjs/types/common.js.map +1 -1
  56. package/lib/commonjs/types/core.js.map +1 -1
  57. package/lib/commonjs/types/index.js.map +1 -2
  58. package/lib/commonjs/types/stylesheet.js +2 -1
  59. package/lib/commonjs/types/stylesheet.js.map +1 -2
  60. package/lib/commonjs/web/convert/index.js +7 -1
  61. package/lib/commonjs/web/convert/index.js.map +1 -2
  62. package/lib/commonjs/web/convert/pseudo.js.map +1 -2
  63. package/lib/commonjs/web/convert/shadow.js +5 -1
  64. package/lib/commonjs/web/convert/shadow.js.map +1 -2
  65. package/lib/commonjs/web/convert/style.js.map +1 -2
  66. package/lib/commonjs/web/convert/textShadow.js.map +1 -2
  67. package/lib/commonjs/web/convert/transform.js.map +1 -2
  68. package/lib/commonjs/web/convert/types.js.map +1 -1
  69. package/lib/commonjs/web/convert/utils.js +2 -1
  70. package/lib/commonjs/web/convert/utils.js.map +1 -2
  71. package/lib/commonjs/web/index.js.map +1 -2
  72. package/lib/commonjs/web/listener.js.map +1 -2
  73. package/lib/commonjs/web/mock.js.map +1 -2
  74. package/lib/commonjs/web/runtime.js.map +1 -2
  75. package/lib/commonjs/web/shadowRegistry.js +9 -1
  76. package/lib/commonjs/web/shadowRegistry.js.map +1 -2
  77. package/lib/commonjs/web/state.js +5 -1
  78. package/lib/commonjs/web/utils/common.js +3 -1
  79. package/lib/commonjs/web/utils/common.js.map +1 -2
  80. package/lib/commonjs/web/utils/index.js.map +1 -1
  81. package/lib/commonjs/web/utils/unistyle.js +1 -1
  82. package/lib/commonjs/web/variants/index.js.map +1 -1
  83. package/lib/module/common.js.map +1 -1
  84. package/lib/module/components/Display.js +13 -0
  85. package/lib/module/components/Display.js.map +1 -0
  86. package/lib/module/components/Hide.js +13 -0
  87. package/lib/module/components/Hide.js.map +1 -0
  88. package/lib/module/components/index.js +5 -0
  89. package/lib/module/components/index.js.map +1 -0
  90. package/lib/module/components/useMedia.js +54 -0
  91. package/lib/module/components/useMedia.js.map +1 -0
  92. package/lib/module/core/createUnistylesComponent.js +2 -1
  93. package/lib/module/core/createUnistylesComponent.js.map +1 -1
  94. package/lib/module/core/createUnistylesComponent.native.js +41 -3
  95. package/lib/module/core/createUnistylesComponent.native.js.map +1 -1
  96. package/lib/module/core/index.js +0 -2
  97. package/lib/module/core/index.js.map +1 -1
  98. package/lib/module/global.js +1 -1
  99. package/lib/module/global.js.map +0 -1
  100. package/lib/module/index.js +2 -1
  101. package/lib/module/index.js.map +1 -1
  102. package/lib/module/mq.js +21 -11
  103. package/lib/module/mq.js.map +1 -1
  104. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +0 -1
  105. package/lib/module/specs/NativePlatform/index.js.map +1 -1
  106. package/lib/module/specs/NavigtionBar/UnistylesNavigationBar.nitro.js.map +0 -1
  107. package/lib/module/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +0 -1
  108. package/lib/module/specs/ShadowRegistry/types.js +0 -2
  109. package/lib/module/specs/ShadowRegistry/types.js.map +1 -1
  110. package/lib/module/specs/StatusBar/UnistylesStatusBar.nitro.js.map +1 -1
  111. package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js +1 -1
  112. package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +0 -1
  113. package/lib/module/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +0 -1
  114. package/lib/module/specs/index.web.js.map +1 -2
  115. package/lib/module/specs/types.js.map +0 -1
  116. package/lib/module/types/accessibility.js +1 -1
  117. package/lib/module/types/accessibility.js.map +0 -1
  118. package/lib/module/types/breakpoints.js.map +0 -1
  119. package/lib/module/types/common.js +1 -1
  120. package/lib/module/types/common.js.map +0 -1
  121. package/lib/module/types/core.js.map +0 -1
  122. package/lib/module/types/index.js.map +1 -2
  123. package/lib/module/types/stylesheet.js +2 -2
  124. package/lib/module/types/stylesheet.js.map +1 -2
  125. package/lib/module/types/variants.js.map +0 -1
  126. package/lib/module/web/convert/boxShadow.js +4 -1
  127. package/lib/module/web/convert/boxShadow.js.map +1 -2
  128. package/lib/module/web/convert/index.js +7 -1
  129. package/lib/module/web/convert/shadow.js +5 -1
  130. package/lib/module/web/convert/shadow.js.map +1 -2
  131. package/lib/module/web/convert/textShadow.js +4 -1
  132. package/lib/module/web/convert/utils.js +2 -1
  133. package/lib/module/web/convert/utils.js.map +1 -2
  134. package/lib/module/web/create.js +5 -1
  135. package/lib/module/web/create.js.map +1 -2
  136. package/lib/module/web/index.js +2 -1
  137. package/lib/module/web/index.js.map +1 -2
  138. package/lib/module/web/listener.js.map +1 -2
  139. package/lib/module/web/registry.js +3 -1
  140. package/lib/module/web/shadowRegistry.js +9 -1
  141. package/lib/module/web/shadowRegistry.js.map +1 -2
  142. package/lib/module/web/state.js +5 -1
  143. package/lib/module/web/state.js.map +1 -2
  144. package/lib/module/web/utils/common.js +3 -1
  145. package/lib/module/web/utils/common.js.map +1 -2
  146. package/lib/module/web/utils/unistyle.js +1 -1
  147. package/lib/module/web/utils/unistyle.js.map +1 -1
  148. package/lib/module/web/variants/getVariants.js.map +1 -2
  149. package/lib/module/web/variants/index.js.map +1 -1
  150. package/lib/typescript/src/components/Display.d.ts +7 -0
  151. package/lib/typescript/src/components/Display.d.ts.map +1 -0
  152. package/lib/typescript/src/components/Hide.d.ts +7 -0
  153. package/lib/typescript/src/components/Hide.d.ts.map +1 -0
  154. package/lib/typescript/src/components/index.d.ts +3 -0
  155. package/lib/typescript/src/components/index.d.ts.map +1 -0
  156. package/lib/typescript/src/components/useMedia.d.ts +6 -0
  157. package/lib/typescript/src/components/useMedia.d.ts.map +1 -0
  158. package/lib/typescript/src/core/createUnistylesComponent.d.ts +3 -2
  159. package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -1
  160. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +3 -2
  161. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -1
  162. package/lib/typescript/src/core/index.d.ts +0 -2
  163. package/lib/typescript/src/core/index.d.ts.map +1 -1
  164. package/lib/typescript/src/index.d.ts +2 -1
  165. package/lib/typescript/src/index.d.ts.map +1 -1
  166. package/lib/typescript/src/mq.d.ts +8 -0
  167. package/lib/typescript/src/mq.d.ts.map +1 -1
  168. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -0
  169. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
  170. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +1 -0
  171. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +2 -0
  172. package/package.json +1 -1
  173. package/plugin/ref.js +4 -4
  174. package/plugin/style.js +15 -3
  175. package/src/components/Display.tsx +12 -0
  176. package/src/components/Hide.tsx +12 -0
  177. package/src/components/index.ts +2 -0
  178. package/src/components/useMedia.ts +64 -0
  179. package/src/core/createUnistylesComponent.native.tsx +48 -4
  180. package/src/core/createUnistylesComponent.tsx +4 -2
  181. package/src/core/index.ts +0 -2
  182. package/src/index.ts +2 -1
  183. package/src/mq.ts +27 -9
  184. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -0
  185. package/src/web/utils/unistyle.ts +1 -1
  186. package/lib/commonjs/core/useBreakpoint.js +0 -22
  187. package/lib/commonjs/core/useBreakpoint.js.map +0 -1
  188. package/lib/commonjs/core/useBreakpoint.native.js +0 -24
  189. package/lib/commonjs/core/useBreakpoint.native.js.map +0 -1
  190. package/lib/commonjs/core/useTheme.js +0 -22
  191. package/lib/commonjs/core/useTheme.js.map +0 -2
  192. package/lib/commonjs/core/useTheme.native.js +0 -24
  193. package/lib/commonjs/core/useTheme.native.js.map +0 -1
  194. package/lib/commonjs/web/mq.js +0 -23
  195. package/lib/commonjs/web/mq.js.map +0 -1
  196. package/lib/module/core/useBreakpoint.js +0 -17
  197. package/lib/module/core/useBreakpoint.js.map +0 -1
  198. package/lib/module/core/useBreakpoint.native.js +0 -19
  199. package/lib/module/core/useBreakpoint.native.js.map +0 -2
  200. package/lib/module/core/useTheme.js +0 -17
  201. package/lib/module/core/useTheme.js.map +0 -2
  202. package/lib/module/core/useTheme.native.js +0 -19
  203. package/lib/module/core/useTheme.native.js.map +0 -1
  204. package/lib/module/web/mq.js +0 -17
  205. package/lib/module/web/mq.js.map +0 -1
  206. package/lib/typescript/src/core/useBreakpoint.d.ts +0 -2
  207. package/lib/typescript/src/core/useBreakpoint.d.ts.map +0 -1
  208. package/lib/typescript/src/core/useBreakpoint.native.d.ts +0 -2
  209. package/lib/typescript/src/core/useBreakpoint.native.d.ts.map +0 -1
  210. package/lib/typescript/src/core/useTheme.d.ts +0 -3
  211. package/lib/typescript/src/core/useTheme.d.ts.map +0 -1
  212. package/lib/typescript/src/core/useTheme.native.d.ts +0 -3
  213. package/lib/typescript/src/core/useTheme.native.d.ts.map +0 -1
  214. package/lib/typescript/src/web/mq.d.ts +0 -8
  215. package/lib/typescript/src/web/mq.d.ts.map +0 -1
  216. package/src/common.js +0 -4
  217. package/src/core/createUnistylesComponent.js +0 -6
  218. package/src/core/createUnistylesComponent.native.js +0 -31
  219. package/src/core/index.js +0 -3
  220. package/src/core/useBreakpoint.js +0 -14
  221. package/src/core/useBreakpoint.native.js +0 -16
  222. package/src/core/useBreakpoint.native.ts +0 -21
  223. package/src/core/useBreakpoint.ts +0 -18
  224. package/src/core/useTheme.js +0 -14
  225. package/src/core/useTheme.native.js +0 -16
  226. package/src/core/useTheme.native.ts +0 -22
  227. package/src/core/useTheme.ts +0 -19
  228. package/src/global.js +0 -1
  229. package/src/index.js +0 -3
  230. package/src/mq.js +0 -38
  231. package/src/specs/NativePlatform/NativePlatform.nitro.js +0 -19
  232. package/src/specs/NativePlatform/index.js +0 -1
  233. package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.js +0 -1
  234. package/src/specs/NavigtionBar/index.js +0 -9
  235. package/src/specs/ShadowRegistry/ShadowRegistry.nitro.js +0 -1
  236. package/src/specs/ShadowRegistry/index.js +0 -26
  237. package/src/specs/ShadowRegistry/types.js +0 -1
  238. package/src/specs/StatusBar/UnistylesStatusBar.nitro.js +0 -1
  239. package/src/specs/StatusBar/index.js +0 -25
  240. package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.js +0 -1
  241. package/src/specs/StyleSheet/index.js +0 -13
  242. package/src/specs/TurboUnistyles/NativeTurboUnistyles.js +0 -2
  243. package/src/specs/TurboUnistyles/index.js +0 -1
  244. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.js +0 -1
  245. package/src/specs/UnistylesRuntime/index.js +0 -20
  246. package/src/specs/index.js +0 -8
  247. package/src/specs/index.web.js +0 -2
  248. package/src/specs/types.js +0 -17
  249. package/src/types/accessibility.js +0 -30
  250. package/src/types/breakpoints.js +0 -1
  251. package/src/types/common.js +0 -1
  252. package/src/types/core.js +0 -1
  253. package/src/types/index.js +0 -1
  254. package/src/types/stylesheet.js +0 -2
  255. package/src/types/variants.js +0 -1
  256. package/src/web/convert/boxShadow.js +0 -59
  257. package/src/web/convert/index.js +0 -56
  258. package/src/web/convert/pseudo.js +0 -131
  259. package/src/web/convert/shadow.js +0 -50
  260. package/src/web/convert/style.js +0 -137
  261. package/src/web/convert/textShadow.js +0 -56
  262. package/src/web/convert/transform.js +0 -65
  263. package/src/web/convert/types.js +0 -2
  264. package/src/web/convert/utils.js +0 -39
  265. package/src/web/create.js +0 -36
  266. package/src/web/index.js +0 -22
  267. package/src/web/listener.js +0 -26
  268. package/src/web/mock.js +0 -21
  269. package/src/web/mq.js +0 -14
  270. package/src/web/mq.ts +0 -17
  271. package/src/web/registry.js +0 -165
  272. package/src/web/runtime.js +0 -160
  273. package/src/web/shadowRegistry.js +0 -96
  274. package/src/web/state.js +0 -68
  275. package/src/web/utils/common.js +0 -79
  276. package/src/web/utils/index.js +0 -2
  277. package/src/web/utils/unistyle.js +0 -72
  278. package/src/web/variants/getVariants.js +0 -26
  279. package/src/web/variants/index.js +0 -2
  280. package/src/web/variants/useVariants.js +0 -50
@@ -96,7 +96,7 @@ inline bool isPlatformColor(jsi::Runtime& rt, jsi::Object& maybePlatformColor) {
96
96
  maybePlatformColor.getProperty(rt, "dynamic").isObject() &&
97
97
  maybePlatformColor.getProperty(rt, "dynamic").asObject(rt).hasProperty(rt, "dark") &&
98
98
  maybePlatformColor.getProperty(rt, "dynamic").asObject(rt).hasProperty(rt, "light");
99
-
99
+
100
100
  if (isIOSDynamicColor) {
101
101
  return true;
102
102
  }
@@ -127,6 +127,16 @@ inline Variants variantsToPairs(jsi::Runtime& rt, jsi::Object&& variants) {
127
127
  return pairs;
128
128
  }
129
129
 
130
+ inline jsi::Object pairsToVariantsValue(jsi::Runtime& rt, Variants& pairs) {
131
+ auto variantsValue = jsi::Object(rt);
132
+
133
+ std::for_each(pairs.begin(), pairs.end(), [&rt, &variantsValue](std::pair<std::string, std::string>& pair){
134
+ variantsValue.setProperty(rt, jsi::PropNameID::forUtf8(rt, pair.first), jsi::String::createFromUtf8(rt, pair.second));
135
+ });
136
+
137
+ return variantsValue;
138
+ }
139
+
130
140
  inline jsi::Object variantsToValue(jsi::Runtime& rt, Variants& variants) {
131
141
  jsi::Object rawVariants = jsi::Object(rt);
132
142
 
@@ -137,7 +147,7 @@ inline jsi::Object variantsToValue(jsi::Runtime& rt, Variants& variants) {
137
147
  return rawVariants;
138
148
  }
139
149
 
140
- inline std::vector<folly::dynamic> parseDynamicFunctionArguments(jsi::Runtime& rt, jsi::Array& arguments) {
150
+ inline std::vector<folly::dynamic> parseDynamicFunctionArguments(jsi::Runtime& rt, jsi::Array&& arguments) {
141
151
  std::vector<folly::dynamic> parsedArgument{};
142
152
  size_t count = arguments.size(rt);
143
153
 
@@ -193,6 +203,18 @@ inline std::vector<folly::dynamic> parseDynamicFunctionArguments(jsi::Runtime& r
193
203
  return parsedArgument;
194
204
  }
195
205
 
206
+ inline jsi::Array functionArgumentsToArray(jsi::Runtime& rt, const jsi::Value* args, size_t count) {
207
+ auto arr = jsi::Array(rt, count);
208
+
209
+ for (size_t i = 0; i < count; i++) {
210
+ const jsi::Value& arg = args[i];
211
+
212
+ arr.setValueAtIndex(rt, i, arg);
213
+ }
214
+
215
+ return arr;
216
+ }
217
+
196
218
  inline static jsi::Array dependenciesToJSIArray(jsi::Runtime& rt, const std::vector<UnistyleDependency>& vec) {
197
219
  jsi::Array result(rt, vec.size());
198
220
 
@@ -28,7 +28,7 @@ jsi::Value HostStyle::get(jsi::Runtime& rt, const jsi::PropNameID& propNameId) {
28
28
  }
29
29
 
30
30
  if (this->_styleSheet->unistyles.contains(propertyName)) {
31
- return valueFromUnistyle(rt, this->_styleSheet->unistyles[propertyName], this->_styleSheet->tag);
31
+ return valueFromUnistyle(rt, this->_unistylesRuntime, this->_styleSheet->unistyles[propertyName], this->_styleSheet->tag);
32
32
  }
33
33
 
34
34
  if (propertyName == helpers::STYLE_VARIANTS) {
@@ -4,7 +4,9 @@
4
4
  #include "Unistyle.h"
5
5
  #include "UnistylesRegistry.h"
6
6
  #include "Helpers.h"
7
+ #include "HybridUnistylesRuntime.h"
7
8
  #include "Constants.h"
9
+ #include "Parser.h"
8
10
 
9
11
  namespace margelo::nitro::unistyles::core {
10
12
 
@@ -57,6 +59,32 @@ customStyleProp={[styles.container, styles.otherProp]}
57
59
  Copying a Unistyle style outside of a JSX element will remove its internal C++ state, leading to unexpected behavior.)");
58
60
  }
59
61
 
62
+ inline static jsi::Object generateUnistylesPrototype(
63
+ jsi::Runtime& rt,
64
+ std::shared_ptr<HybridUnistylesRuntime> unistylesRuntime,
65
+ Unistyle::Shared unistyle,
66
+ std::optional<Variants> variants,
67
+ std::optional<jsi::Array> arguments
68
+ ) {
69
+ // add prototype metadata for createUnistylesComponent
70
+ auto proto = jsi::Object(rt);
71
+ auto hostFn = jsi::Function::createFromHostFunction(rt, jsi::PropNameID::forUtf8(rt, "getStyle"), 0, [unistyle, unistylesRuntime](jsi::Runtime &rt, const jsi::Value &thisValue, const jsi::Value *args, size_t count){
72
+ auto variants = helpers::variantsToPairs(rt, thisValue.asObject(rt).getProperty(rt, "variants").asObject(rt));
73
+ auto arguments = helpers::parseDynamicFunctionArguments(rt, thisValue.asObject(rt).getProperty(rt, "arguments").asObject(rt).asArray(rt));
74
+
75
+ parser::Parser(unistylesRuntime).rebuildUnistyle(rt, unistyle->parent, unistyle, variants, std::make_optional<std::vector<folly::dynamic>>(arguments));
76
+
77
+ return jsi::Value(rt, unistyle->parsedStyle.value()).asObject(rt);
78
+ });
79
+
80
+ proto.setProperty(rt, "getStyle", std::move(hostFn));
81
+ proto.setProperty(rt, "arguments", arguments.has_value() ? std::move(arguments.value()) : jsi::Array(rt, 0));
82
+ proto.setProperty(rt, "variants", variants.has_value() ? helpers::pairsToVariantsValue(rt, variants.value()) : jsi::Object(rt));
83
+ proto.setProperty(rt, helpers::STYLE_DEPENDENCIES.c_str(), helpers::dependenciesToJSIArray(rt, unistyle->dependencies));
84
+
85
+ return proto;
86
+ }
87
+
60
88
  inline static std::vector<Unistyle::Shared> unistyleFromValue(jsi::Runtime& rt, const jsi::Value& value) {
61
89
  if (value.isNull()) {
62
90
  return {};
@@ -72,7 +100,7 @@ inline static std::vector<Unistyle::Shared> unistyleFromValue(jsi::Runtime& rt,
72
100
  return {value.getObject(rt).getNativeState<UnistyleWrapper>(rt)->unistyle};
73
101
  }
74
102
 
75
- inline static jsi::Value valueFromUnistyle(jsi::Runtime& rt, Unistyle::Shared unistyle, int tag) {
103
+ inline static jsi::Value valueFromUnistyle(jsi::Runtime& rt, std::shared_ptr<HybridUnistylesRuntime> unistylesRuntime, Unistyle::Shared unistyle, int tag) {
76
104
  auto wrappedUnistyle = std::make_shared<UnistyleWrapper>(unistyle);
77
105
 
78
106
  if (unistyle->type == UnistyleType::Object) {
@@ -84,6 +112,8 @@ inline static jsi::Value valueFromUnistyle(jsi::Runtime& rt, Unistyle::Shared un
84
112
  helpers::defineHiddenProperty(rt, obj, helpers::STYLE_DEPENDENCIES.c_str(), helpers::dependenciesToJSIArray(rt, unistyle->dependencies));
85
113
  helpers::mergeJSIObjects(rt, obj, unistyle->parsedStyle.value());
86
114
 
115
+ obj.setProperty(rt, "__proto__", generateUnistylesPrototype(rt, unistylesRuntime, unistyle, std::nullopt, std::nullopt));
116
+
87
117
  return obj;
88
118
  }
89
119
 
@@ -23,6 +23,6 @@ void core::UnistylesMountHook::shadowTreeDidMount(RootShadowNode::Shared const &
23
23
  auto& registry = core::UnistylesRegistry::get();
24
24
 
25
25
  if (!registry.trafficController.shouldStop()) {
26
- shadow::ShadowTreeManager::updateShadowTree(*_rt);
26
+ shadow::ShadowTreeManager::updateShadowTree(this->_unistylesRuntime->getRuntime());
27
27
  }
28
28
  }
@@ -3,13 +3,15 @@
3
3
  #include <react/renderer/uimanager/UIManager.h>
4
4
  #include <react/renderer/uimanager/UIManagerMountHook.h>
5
5
  #include "ShadowTreeManager.h"
6
+ #include "HybridUnistylesRuntime.h"
6
7
 
7
8
  namespace margelo::nitro::unistyles::core {
8
9
 
9
10
  using namespace facebook::react;
10
11
 
11
12
  struct UnistylesMountHook : public UIManagerMountHook {
12
- UnistylesMountHook(std::shared_ptr<UIManager> uiManager, jsi::Runtime& rt) : _uiManager{uiManager}, _rt{&rt} {
13
+ UnistylesMountHook(std::shared_ptr<UIManager> uiManager, std::shared_ptr<HybridUnistylesRuntime> unistylesRuntime)
14
+ : _uiManager{uiManager}, _unistylesRuntime{unistylesRuntime} {
13
15
  _uiManager->registerMountHook(*this);
14
16
  }
15
17
 
@@ -19,7 +21,7 @@ struct UnistylesMountHook : public UIManagerMountHook {
19
21
 
20
22
  private:
21
23
  std::shared_ptr<UIManager> _uiManager;
22
- jsi::Runtime* _rt;
24
+ std::shared_ptr<HybridUnistylesRuntime> _unistylesRuntime;
23
25
  };
24
26
 
25
27
  }
@@ -88,7 +88,13 @@ void core::UnistylesRegistry::linkShadowNodeWithUnistyle(
88
88
  // add or update node for shadow leaf updates
89
89
  // dynamic functions are parsed later
90
90
  if (unistyle->type == UnistyleType::Object) {
91
- updates[shadowNodeFamily] = parser.parseUnistyleToShadowTreeStyles(rt, unistyle);
91
+ for (const auto& [family, unistyles] : this->_shadowRegistry[&rt]) {
92
+ for (const auto& unistyleData : unistyles) {
93
+ if (unistyleData->unistyle == unistyle && family == shadowNodeFamily) {
94
+ updates[family] = parser.parseStylesToShadowTreeStyles(rt, {unistyleData});
95
+ }
96
+ }
97
+ }
92
98
  }
93
99
  });
94
100
 
@@ -9,8 +9,7 @@ jsi::Value HybridShadowRegistry::link(jsi::Runtime &rt, const jsi::Value &thisVa
9
9
  ShadowNode::Shared shadowNodeWrapper = shadowNodeFromValue(rt, args[0]);
10
10
  std::vector<core::Unistyle::Shared> unistyleWrappers = core::unistyleFromValue(rt, args[1]);
11
11
  core::Variants variants = helpers::variantsToPairs(rt, args[2].asObject(rt));
12
- auto rawArguments = args[3].asObject(rt).asArray(rt);
13
- std::vector<folly::dynamic> arguments = helpers::parseDynamicFunctionArguments(rt, rawArguments);
12
+ std::vector<folly::dynamic> arguments = helpers::parseDynamicFunctionArguments(rt, args[3].asObject(rt).asArray(rt));
14
13
 
15
14
  auto& registry = core::UnistylesRegistry::get();
16
15
 
@@ -9,9 +9,7 @@
9
9
  namespace margelo::nitro::unistyles {
10
10
 
11
11
  struct HybridShadowRegistry: public HybridUnistylesShadowRegistrySpec {
12
- HybridShadowRegistry(): HybridObject(TAG) {
13
- core::UnistylesRegistry::get().trafficController.restore();
14
- }
12
+ HybridShadowRegistry(): HybridObject(TAG) {}
15
13
 
16
14
  jsi::Value link(jsi::Runtime& rt,
17
15
  const jsi::Value& thisValue,
@@ -230,8 +230,11 @@ void HybridStyleSheet::loadExternalMethods(const jsi::Value& thisValue, jsi::Run
230
230
  }
231
231
 
232
232
  void HybridStyleSheet::registerHooks(jsi::Runtime& rt) {
233
+ // cleanup Shadow updates
234
+ core::UnistylesRegistry::get().trafficController.restore();
235
+
233
236
  this->_unistylesCommitHook = std::make_shared<core::UnistylesCommitHook>(this->_uiManager);
234
- this->_unistylesMountHook = std::make_shared<core::UnistylesMountHook>(this->_uiManager, rt);
237
+ this->_unistylesMountHook = std::make_shared<core::UnistylesMountHook>(this->_uiManager, this->_unistylesRuntime);
235
238
  }
236
239
 
237
240
  void HybridStyleSheet::onPlatformDependenciesChange(std::vector<UnistyleDependency> unistylesDependencies) {
@@ -57,6 +57,18 @@ double HybridUnistylesRuntime::getFontScale() {
57
57
  return this->_nativePlatform.getFontScale();
58
58
  };
59
59
 
60
+ std::unordered_map<std::string, double> HybridUnistylesRuntime::getBreakpoints() {
61
+ auto& state = core::UnistylesRegistry::get().getState(*_rt);
62
+ auto sortedBreakpointPairs = state.getSortedBreakpointPairs();
63
+ std::unordered_map<std::string, double> breakpoints{};
64
+
65
+ std::for_each(sortedBreakpointPairs.begin(), sortedBreakpointPairs.end(), [&breakpoints](std::pair<std::string, double>& pair){
66
+ breakpoints[pair.first] = pair.second;
67
+ });
68
+
69
+ return breakpoints;
70
+ }
71
+
60
72
  void HybridUnistylesRuntime::setTheme(const std::string &themeName) {
61
73
  helpers::assertThat(*_rt, !this->getHasAdaptiveThemes(), "Unistyles: You're trying to set theme to: '" + themeName + "', but adaptiveThemes are enabled.");
62
74
 
@@ -64,6 +64,8 @@ struct HybridUnistylesRuntime: public HybridUnistylesRuntimeSpec {
64
64
  void setImmersiveMode(bool isEnabled) override;
65
65
  void setRootViewBackgroundColor(double color) override;
66
66
  UnistylesCxxMiniRuntime getMiniRuntime() override;
67
+ std::unordered_map<std::string, double> getBreakpoints() override;
68
+
67
69
  jsi::Value getMiniRuntimeAsValue(jsi::Runtime& rt);
68
70
  jsi::Runtime& getRuntime();
69
71
  void includeDependenciesForColorSchemeChange(std::vector<UnistyleDependency>& deps);
@@ -1,4 +1,5 @@
1
1
  #include "Parser.h"
2
+ #include "UnistyleWrapper.h"
2
3
 
3
4
  using namespace margelo::nitro::unistyles;
4
5
  using namespace facebook;
@@ -107,7 +108,7 @@ void parser::Parser::rebuildUnistylesInDependencyMap(jsi::Runtime& rt, Dependenc
107
108
  parsedStyleSheets.emplace(styleSheet, this->unwrapStyleSheet(rt, styleSheet));
108
109
  }
109
110
 
110
- // then parse all visible Unistyles
111
+ // then parse all visible Unistyles managed by Unistyle
111
112
  for (auto& [shadowNode, unistyles] : dependencyMap) {
112
113
  auto styleSheet = unistyles.begin()->get()->unistyle->parent;
113
114
 
@@ -155,13 +156,12 @@ void parser::Parser::rebuildUnistylesInDependencyMap(jsi::Runtime& rt, Dependenc
155
156
  }
156
157
  }
157
158
 
158
- // parse whatever left in StyleSheets
159
+ // parse whatever left in StyleSheets to be later accessible
160
+ // for createUnistylesComponent
159
161
  for (auto styleSheet : styleSheets) {
160
162
  for (auto& [_, unistyle] : styleSheet->unistyles) {
161
163
  if (!parsedUnistyles.contains(unistyle)) {
162
- parsedUnistyles.emplace(unistyle, true);
163
164
  unistyle->rawValue = parsedStyleSheets[styleSheet].asObject(rt).getProperty(rt, unistyle->styleKey.c_str()).asObject(rt);
164
- this->rebuildUnistyle(rt, styleSheet, unistyle, {}, std::nullopt);
165
165
  }
166
166
  }
167
167
  }
@@ -367,10 +367,10 @@ jsi::Function parser::Parser::createDynamicFunctionProxy(jsi::Runtime& rt, Unist
367
367
  unistyleFn->parsedStyle = this->parseFirstLevel(rt, unistyleFn, variants);
368
368
  unistyleFn->seal();
369
369
 
370
- // include dependencies for createUnistylesComponent
371
370
  jsi::Object style = jsi::Value(rt, unistyleFn->parsedStyle.value()).asObject(rt);
372
371
 
373
- helpers::defineHiddenProperty(rt, style, helpers::STYLE_DEPENDENCIES, helpers::dependenciesToJSIArray(rt, unistyle->dependencies));
372
+ // include dependencies for createUnistylesComponent
373
+ style.setProperty(rt, "__proto__", generateUnistylesPrototype(rt, unistylesRuntime, unistyle, variants, helpers::functionArgumentsToArray(rt, args, count)));
374
374
 
375
375
  // update shadow leaf updates to indicate newest changes
376
376
  auto& registry = core::UnistylesRegistry::get();
@@ -28,9 +28,9 @@ struct Parser {
28
28
  void rebuildShadowLeafUpdates(core::DependencyMap& dependencyMap);
29
29
  folly::dynamic parseUnistyleToShadowTreeStyles(jsi::Runtime& rt, const Unistyle::Shared unistyle);
30
30
  folly::dynamic parseStylesToShadowTreeStyles(jsi::Runtime& rt, const std::vector<std::shared_ptr<UnistyleData>>& unistyles);
31
+ void rebuildUnistyle(jsi::Runtime& rt, std::shared_ptr<StyleSheet> styleSheet, Unistyle::Shared unistyle, const Variants& variants, std::optional<std::vector<folly::dynamic>>);
31
32
 
32
33
  private:
33
- void rebuildUnistyle(jsi::Runtime& rt, std::shared_ptr<StyleSheet> styleSheet, Unistyle::Shared unistyle, const Variants& variants, std::optional<std::vector<folly::dynamic>>);
34
34
  jsi::Object unwrapStyleSheet(jsi::Runtime& rt, std::shared_ptr<StyleSheet> styleSheet);
35
35
  jsi::Object parseFirstLevel(jsi::Runtime& rt, Unistyle::Shared unistyle, std::optional<Variants> variants);
36
36
  jsi::Value parseSecondLevel(jsi::Runtime& rt, Unistyle::Shared unistyle, jsi::Value& nestedObject);
@@ -49,6 +49,8 @@ struct ShadowTrafficController {
49
49
  }
50
50
 
51
51
  inline void restore() {
52
+ std::lock_guard<std::mutex> lock(_mutex);
53
+
52
54
  _unistylesUpdates = {};
53
55
  _canCommit = false;
54
56
  }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Display = void 0;
7
+ var _useMedia = require("./useMedia");
8
+ const Display = ({
9
+ children,
10
+ ...props
11
+ }) => {
12
+ const {
13
+ isVisible
14
+ } = (0, _useMedia.useMedia)(props);
15
+ return isVisible ? children : null;
16
+ };
17
+ exports.Display = Display;
18
+ //# sourceMappingURL=Display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_useMedia","require","Display","children","props","isVisible","useMedia","exports"],"sourceRoot":"../../../src","sources":["components/Display.tsx"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAIO,MAAMC,OAA8C,GAAGA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,KAAK;EACtF,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,kBAAQ,EAACF,KAAK,CAAC;EAErC,OAAOC,SAAS,GACVF,QAAQ,GACR,IAAI;AACd,CAAC;AAAAI,OAAA,CAAAL,OAAA,GAAAA,OAAA","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Hide = void 0;
7
+ var _useMedia = require("./useMedia");
8
+ const Hide = ({
9
+ children,
10
+ ...props
11
+ }) => {
12
+ const {
13
+ isVisible
14
+ } = (0, _useMedia.useMedia)(props);
15
+ return !isVisible ? children : null;
16
+ };
17
+ exports.Hide = Hide;
18
+ //# sourceMappingURL=Hide.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_useMedia","require","Hide","children","props","isVisible","useMedia","exports"],"sourceRoot":"../../../src","sources":["components/Hide.tsx"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAIO,MAAMC,IAAwC,GAAGA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,KAAK;EAChF,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,kBAAQ,EAACF,KAAK,CAAC;EAErC,OAAO,CAACC,SAAS,GACXF,QAAQ,GACR,IAAI;AACd,CAAC;AAAAI,OAAA,CAAAL,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Display", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Display.Display;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "Hide", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _Hide.Hide;
16
+ }
17
+ });
18
+ var _Hide = require("./Hide");
19
+ var _Display = require("./Display");
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_Hide","require","_Display"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA","ignoreList":[]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useMedia = void 0;
7
+ var _react = require("react");
8
+ var _specs = require("../specs");
9
+ var _mq = require("../mq");
10
+ const useMedia = config => {
11
+ const computeIsVisible = () => {
12
+ const maybeMq = config.mq;
13
+ if (!(0, _mq.isUnistylesMq)(maybeMq)) {
14
+ console.error(`🦄 Unistyles: Received invalid mq: ${maybeMq}`);
15
+ return false;
16
+ }
17
+ const parsedMq = (0, _mq.parseMq)(maybeMq);
18
+ if (!(0, _mq.isValidMq)(parsedMq)) {
19
+ console.error(`🦄 Unistyles: Received invalid mq where min is greater than max: ${maybeMq}`);
20
+ return false;
21
+ }
22
+ const {
23
+ width,
24
+ height
25
+ } = _specs.UnistylesRuntime.screen;
26
+ if (parsedMq.minWidth !== undefined && width < parsedMq.minWidth) {
27
+ return false;
28
+ }
29
+ if (parsedMq.maxWidth !== undefined && width > parsedMq.maxWidth) {
30
+ return false;
31
+ }
32
+ if (parsedMq.minHeight !== undefined && height < parsedMq.minHeight) {
33
+ return false;
34
+ }
35
+ if (parsedMq.maxHeight !== undefined && height > parsedMq.maxHeight) {
36
+ return false;
37
+ }
38
+ return true;
39
+ };
40
+ const [isVisible, setIsVisible] = (0, _react.useState)(computeIsVisible());
41
+ (0, _react.useEffect)(() => {
42
+ setIsVisible(computeIsVisible());
43
+ }, [config.mq]);
44
+ (0, _react.useLayoutEffect)(() => {
45
+ const removeChangeListener = _specs.StyleSheet.addChangeListener(dependencies => {
46
+ if (dependencies.includes(_specs.UnistyleDependency.Breakpoints)) {
47
+ setIsVisible(computeIsVisible());
48
+ }
49
+ });
50
+ return () => {
51
+ removeChangeListener();
52
+ };
53
+ }, [config.mq]);
54
+ return {
55
+ isVisible
56
+ };
57
+ };
58
+ exports.useMedia = useMedia;
59
+ //# sourceMappingURL=useMedia.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_specs","_mq","useMedia","config","computeIsVisible","maybeMq","mq","isUnistylesMq","console","error","parsedMq","parseMq","isValidMq","width","height","UnistylesRuntime","screen","minWidth","undefined","maxWidth","minHeight","maxHeight","isVisible","setIsVisible","useState","useEffect","useLayoutEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","includes","Unisty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,EAAEC,YAAY,CAAC,GAAG,IAAAC,eAAQ,EAAiBpB,gBAAgB,CAAC,CAAC,CAAC;EAE9E,IAAAqB,gBAAS,EAAC,MAAM;IACZF,YAAY,CAACnB,gBAAgB,CAAC,CAAC,CAAC;EACpC,CAAC,EAAE,CAACD,MAAM,CAACG,EAAE,CAAC,CAAC;EAEf,IAAAoB,sBAAe,EAAC,MAAM;IAClB,MAAMC,oBAAoB,GAAIC,iBAAU,CAAyBC,iBAAiB,CAACC,YAAY,IAAI;MAC/F,IAAIA,YAAY,CAACC,QAAQ,CAACC,yBAAkB,CAACC,WAAW,CAAC,EAAE;QACvDV,YAAY,CAACnB,gBAAgB,CAAC,CAAC,CAAC;MACpC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTuB,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,CAACxB,MAAM,CAACG,EAAE,CAAC,CAAC;EAEf,OAAO;IACHgB;EACJ,CAAC;AACL,CAAC;AAAAY,OAAA,CAAAhC,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -7,7 +7,8 @@ exports.createUnistylesComponent = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _jsxRuntime = require("react/jsx-runtime");
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- const createUnistylesComponent = (Component, _) => {
10
+ const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
11
+ const createUnistylesComponent = (Component, _ = () => ({})) => {
11
12
  return props => {
12
13
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
13
14
  ...props
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_jsxRuntime","e","__esModule","default","createUnistylesComponent","Component","_","props","jsx","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAsE,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAK/D,MAAMG,wBAAwB,GAAGA,CAA+BC,SAAY,EAAEC,CAAc,KAAK;EACpG,OAAQC,KAAwB,IAAK;IACjC,oBAAO,IAAAP,WAAA,CAAAQ,GAAA,EAACH,SAAS;MAAA,GAAKE;IAAK,CAAG,CAAC;EACnC,CAAC;AACL,CAAC;AAAAE,OAAA,CAAAL,wBAAA,GAAAA,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_jsxRuntime","e","__esModule","default","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","_","props","jsx","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAsE,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKtE,MAAMG,qBAAqB,GAAG,CAAC,OAAO,EAAE,uBAAuB,CAAU;AAElE,MAAMC,wBAAwB,GAAGA,CAA+BC,SAAY,EAAEC,CAAc,GAAGA,CAAA,MAAO,CAAC,CAAC,CAAC,KAAK;EACjH,OAAQC,KAAwB,IAAK;IACjC,oBAAO,IAAAR,WAAA,CAAAS,GAAA,EAACH,SAAS;MAAA,GAAKE;IAAK,CAAG,CAAC;EACnC,CAAC;AACL,CAAC;AAAAE,OAAA,CAAAL,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -9,15 +9,45 @@ var _specs = require("../specs");
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
11
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
- const createUnistylesComponent = (Component, mappings) => {
12
+ const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
13
+ const createUnistylesComponent = (Component, mappings = () => ({})) => {
13
14
  return props => {
14
15
  const [theme, setTheme] = (0, _react.useState)(_specs.UnistylesRuntime.getTheme());
15
16
  const [, setRt] = (0, _react.useState)(0);
17
+ const stylesRef = (0, _react.useRef)({});
18
+ const isForcedRef = (0, _react.useRef)(false);
19
+ if (!isForcedRef.current) {
20
+ SUPPORTED_STYLE_PROPS.forEach(propName => {
21
+ if (props?.[propName]) {
22
+ if (Array.isArray(props[propName])) {
23
+ console.error(`🦄 Unistyles: createUnistylesComponent requires ${propName} to be an object. Please check props for component: ${Component.displayName}`);
24
+ }
25
+ if (props[propName].__unistyles_name && !props[propName].__proto__?.getStyle) {
26
+ console.error(`🦄 Unistyles: createUnistylesComponent received style that is not bound. You likely used the spread operator on a Unistyle style. Please check props for component: ${Component.displayName}`);
27
+ }
28
+ stylesRef.current = {
29
+ ...stylesRef.current,
30
+ [propName]: props[propName]
31
+ };
32
+ }
33
+ });
34
+ }
16
35
  (0, _react.useEffect)(() => {
17
36
  const removeChangeListener = _specs.StyleSheet.addChangeListener(dependencies => {
18
- const componentDependencies = props.style?.uni__dependencies || mappings(theme).style?.uni__dependencies;
37
+ const componentDependencies = props.style?.__proto__.uni__dependencies || mappings(theme).style?.__proto__.uni__dependencies;
19
38
  if (dependencies.includes(_specs.UnistyleDependency.Theme) && (!componentDependencies || componentDependencies.includes(_specs.UnistyleDependency.Theme))) {
20
39
  setTheme(_specs.UnistylesRuntime.getTheme());
40
+
41
+ // override with Unistyles styles
42
+ SUPPORTED_STYLE_PROPS.forEach(propName => {
43
+ if (props?.[propName]) {
44
+ stylesRef.current = {
45
+ ...stylesRef.current,
46
+ [propName]: props[propName].__proto__?.getStyle() || props[propName]
47
+ };
48
+ }
49
+ });
50
+ isForcedRef.current = true;
21
51
  }
22
52
  if (dependencies.some(dependency => dependency >= 2) && (!componentDependencies || componentDependencies.some(dependency => dependency >= 2))) {
23
53
  setRt(prevState => prevState + 1);
@@ -37,6 +67,14 @@ const createUnistylesComponent = (Component, mappings) => {
37
67
  }
38
68
  mergedProps[key] = props[key];
39
69
  });
70
+
71
+ // override with Unistyles styles
72
+ SUPPORTED_STYLE_PROPS.forEach(propName => {
73
+ if (mergedProps[propName]) {
74
+ mergedProps[propName] = stylesRef.current[propName];
75
+ }
76
+ });
77
+ isForcedRef.current = false;
40
78
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
41
79
  ...mergedProps
42
80
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createUnistylesComponent","Component","mappings","props","theme","setTheme","useState","UnistylesRuntime","getTheme","setRt","useEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","componentDependencies","style","uni__dependencies","includes","UnistyleDependency","Theme","some","dependency","prevState","mergedProps","keys","forEach","key","assign","jsx","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.native.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAAqG,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAG,yB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9D;MACJ;MAEAH,WAAW,CAACG,GAAG,CAAC,GAAGxB,KAAK,CAACwB,GAAG,CAAC;IACjC,CAAC,CAAC;IAEF,oBAAO,IAAAhD,WAAA,CAAAkD,GAAA,EAAC5B,SAAS;MAAA,GAAKuB;IAAW,CAAG,CAAC;EACzC,CAAC;AACL,CAAC;AAAAM,OAAA,CAAA9B,wBAAA,GAAAA,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_specs","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","mappings","props","theme","setTheme","useState","UnistylesRuntime","getTheme","setRt","stylesRef","useRef","isForcedRef","current","forEach","propName","Array","isArray","console","error","displayName","__unistyles_name","getStyle","useEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","componentDependencies","style","uni__dependencies","includes","UnistyleDependency","Theme","some","dependency","prevState","mergedProps","keys","key","assign","jsx","exports"],"sourceRoot":"../../../src","sources":["core/createUnistylesComponent.native.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAAqG,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBA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O,GAAG,KAAK;IAE3B,oBAAO,IAAAnC,WAAA,CAAA+D,GAAA,EAACxC,SAAS;MAAA,GAAKoC;IAAW,CAAG,CAAC;EACzC,CAAC;AACL,CAAC;AAAAK,OAAA,CAAA1C,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -9,19 +9,5 @@ Object.defineProperty(exports, "createUnistylesComponent", {
9
9
  return _createUnistylesComponent.createUnistylesComponent;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "useBreakpoint", {
13
- enumerable: true,
14
- get: function () {
15
- return _useBreakpoint.useBreakpoint;
16
- }
17
- });
18
- Object.defineProperty(exports, "useTheme", {
19
- enumerable: true,
20
- get: function () {
21
- return _useTheme.useTheme;
22
- }
23
- });
24
- var _useBreakpoint = require("./useBreakpoint");
25
- var _useTheme = require("./useTheme");
26
12
  var _createUnistylesComponent = require("./createUnistylesComponent");
27
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_useBreakpoint","require","_useTheme","_createUnistylesComponent"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_createUnistylesComponent","require"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA","ignoreList":[]}
@@ -1,6 +1,2 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
2
  //# sourceMappingURL=global.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["global.js"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["global.ts"],"mappings":"","ignoreList":[]}
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var _exportNames = {
7
7
  mq: true,
8
- useTheme: true,
9
- useBreakpoint: true,
10
8
  createUnistylesComponent: true
11
9
  };
12
10
  Object.defineProperty(exports, "createUnistylesComponent", {
@@ -21,18 +19,6 @@ Object.defineProperty(exports, "mq", {
21
19
  return _mq.mq;
22
20
  }
23
21
  });
24
- Object.defineProperty(exports, "useBreakpoint", {
25
- enumerable: true,
26
- get: function () {
27
- return _core.useBreakpoint;
28
- }
29
- });
30
- Object.defineProperty(exports, "useTheme", {
31
- enumerable: true,
32
- get: function () {
33
- return _core.useTheme;
34
- }
35
- });
36
22
  var _specs = require("./specs");
37
23
  Object.keys(_specs).forEach(function (key) {
38
24
  if (key === "default" || key === "__esModule") return;
@@ -47,4 +33,16 @@ Object.keys(_specs).forEach(function (key) {
47
33
  });
48
34
  var _mq = require("./mq");
49
35
  var _core = require("./core");
36
+ var _components = require("./components");
37
+ Object.keys(_components).forEach(function (key) {
38
+ if (key === "default" || key === "__esModule") return;
39
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
40
+ if (key in exports && exports[key] === _components[key]) return;
41
+ Object.defineProperty(exports, key, {
42
+ enumerable: true,
43
+ get: function () {
44
+ return _components[key];
45
+ }
46
+ });
47
+ });
50
48
  //# sourceMappingURL=index.js.map