react-native-unistyles 3.0.0-beta.3 → 3.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (496) hide show
  1. package/README.md +6 -3
  2. package/android/src/main/cxx/NativeUnistylesModule.cpp +1 -1
  3. package/android/src/main/cxx/NativeUnistylesModule.h +1 -1
  4. package/components/native/ActivityIndicator/package.json +2 -1
  5. package/components/native/FlatList/package.json +2 -1
  6. package/components/native/Image/package.json +2 -1
  7. package/components/native/ImageBackground/package.json +2 -1
  8. package/components/native/KeyboardAvoidingView/package.json +2 -1
  9. package/components/native/Pressable/package.json +1 -1
  10. package/components/native/RefreshControl/package.json +2 -1
  11. package/components/native/ScrollView/package.json +2 -1
  12. package/components/native/SectionList/package.json +2 -1
  13. package/components/native/Switch/package.json +2 -1
  14. package/components/native/Text/package.json +2 -1
  15. package/components/native/TextInput/package.json +2 -1
  16. package/components/native/TouchableHighlight/package.json +2 -1
  17. package/components/native/TouchableOpacity/package.json +2 -1
  18. package/components/native/View/package.json +2 -1
  19. package/components/native/VirtualizedList/package.json +2 -1
  20. package/cxx/common/Constants.h +4 -4
  21. package/cxx/common/Helpers.h +1 -1
  22. package/cxx/core/HashGenerator.cpp +23 -0
  23. package/cxx/core/HashGenerator.h +13 -0
  24. package/cxx/core/HostUnistyle.cpp +83 -0
  25. package/cxx/core/HostUnistyle.h +27 -0
  26. package/cxx/core/RNStyle.h +18 -0
  27. package/cxx/core/Unistyle.h +9 -4
  28. package/cxx/core/UnistyleWrapper.h +92 -47
  29. package/cxx/core/UnistylesRegistry.cpp +19 -11
  30. package/cxx/core/UnistylesRegistry.h +2 -4
  31. package/cxx/hybridObjects/HybridNavigationBar.cpp +3 -3
  32. package/cxx/hybridObjects/HybridNavigationBar.h +2 -2
  33. package/cxx/hybridObjects/HybridShadowRegistry.cpp +32 -45
  34. package/cxx/hybridObjects/HybridShadowRegistry.h +0 -10
  35. package/cxx/hybridObjects/HybridStatusBar.cpp +3 -3
  36. package/cxx/hybridObjects/HybridStatusBar.h +2 -2
  37. package/cxx/hybridObjects/HybridStyleSheet.cpp +25 -8
  38. package/cxx/hybridObjects/HybridStyleSheet.h +2 -1
  39. package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +15 -15
  40. package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -2
  41. package/cxx/parser/Parser.cpp +17 -24
  42. package/cxx/parser/Parser.h +2 -1
  43. package/ios/NativePlatform+ios.swift +5 -7
  44. package/ios/NativePlatform.swift +2 -2
  45. package/ios/UnistylesModuleOnLoad.mm +2 -1
  46. package/lib/commonjs/components/ScopedTheme.js.map +1 -1
  47. package/lib/commonjs/components/index.js +0 -7
  48. package/lib/commonjs/components/index.js.map +1 -1
  49. package/lib/commonjs/components/native/ImageBackground.js +45 -1
  50. package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
  51. package/lib/commonjs/components/native/ImageBackground.native.js +10 -0
  52. package/lib/commonjs/components/native/ImageBackground.native.js.map +1 -0
  53. package/lib/commonjs/components/native/Pressable.js +26 -51
  54. package/lib/commonjs/components/native/Pressable.js.map +1 -1
  55. package/lib/commonjs/components/native/Pressable.native.js +14 -11
  56. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  57. package/lib/commonjs/core/createUnistylesElement.js +29 -5
  58. package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
  59. package/lib/commonjs/core/createUnistylesElement.native.js +40 -0
  60. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -0
  61. package/lib/commonjs/core/createUnistylesImageBackground.js +36 -14
  62. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  63. package/lib/commonjs/core/getClassname.js +25 -0
  64. package/lib/commonjs/core/getClassname.js.map +1 -0
  65. package/lib/commonjs/core/getClassname.native.js +9 -0
  66. package/lib/commonjs/core/getClassname.native.js.map +1 -0
  67. package/lib/commonjs/core/index.js +14 -7
  68. package/lib/commonjs/core/index.js.map +1 -1
  69. package/lib/commonjs/core/passForwardRef.js +2 -2
  70. package/lib/commonjs/core/passForwardRef.js.map +1 -1
  71. package/lib/commonjs/core/useProxifiedUnistyles/index.js +13 -0
  72. package/lib/commonjs/core/useProxifiedUnistyles/index.js.map +1 -0
  73. package/lib/commonjs/core/useProxifiedUnistyles/listener.js +22 -0
  74. package/lib/commonjs/core/useProxifiedUnistyles/listener.js.map +1 -0
  75. package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js +26 -0
  76. package/lib/commonjs/core/useProxifiedUnistyles/listener.native.js.map +1 -0
  77. package/lib/commonjs/core/useProxifiedUnistyles/types.js +6 -0
  78. package/lib/commonjs/core/useProxifiedUnistyles/types.js.map +1 -0
  79. package/lib/commonjs/core/{withUnistyles/useDependencies.js → useProxifiedUnistyles/useProxifiedUnistyles.js} +22 -22
  80. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -0
  81. package/lib/commonjs/core/useUnistyles.js +19 -0
  82. package/lib/commonjs/core/useUnistyles.js.map +1 -0
  83. package/lib/commonjs/core/warn.js +16 -0
  84. package/lib/commonjs/core/warn.js.map +1 -0
  85. package/lib/commonjs/core/withUnistyles/withUnistyles.js +19 -55
  86. package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
  87. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +32 -65
  88. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  89. package/lib/commonjs/index.js +23 -4
  90. package/lib/commonjs/index.js.map +1 -1
  91. package/lib/commonjs/server/getServerUnistyles.js +38 -0
  92. package/lib/commonjs/server/getServerUnistyles.js.map +1 -0
  93. package/lib/commonjs/server/hydrateServerUnistyles.js +17 -0
  94. package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -0
  95. package/lib/commonjs/server/index.js +34 -0
  96. package/lib/commonjs/server/index.js.map +1 -0
  97. package/lib/commonjs/server/resetServerUnistyles.js +16 -0
  98. package/lib/commonjs/server/resetServerUnistyles.js.map +1 -0
  99. package/lib/commonjs/server/types.js +8 -0
  100. package/lib/commonjs/server/types.js.map +1 -0
  101. package/lib/commonjs/server/useServerUnistyles.js +27 -0
  102. package/lib/commonjs/server/useServerUnistyles.js.map +1 -0
  103. package/lib/commonjs/specs/ShadowRegistry/index.js +6 -3
  104. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  105. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  106. package/lib/commonjs/utils.js +4 -2
  107. package/lib/commonjs/utils.js.map +1 -1
  108. package/lib/commonjs/web/convert/object/filter.js +2 -2
  109. package/lib/commonjs/web/convert/object/filter.js.map +1 -1
  110. package/lib/commonjs/web/convert/style.js +4 -4
  111. package/lib/commonjs/web/convert/style.js.map +1 -1
  112. package/lib/commonjs/web/create.js +20 -15
  113. package/lib/commonjs/web/create.js.map +1 -1
  114. package/lib/commonjs/web/css/core.js +55 -0
  115. package/lib/commonjs/web/css/core.js.map +1 -0
  116. package/lib/commonjs/web/css/index.js +17 -0
  117. package/lib/commonjs/web/css/index.js.map +1 -0
  118. package/lib/commonjs/web/css/state.js +155 -0
  119. package/lib/commonjs/web/css/state.js.map +1 -0
  120. package/lib/commonjs/web/css/utils.js +47 -0
  121. package/lib/commonjs/web/css/utils.js.map +1 -0
  122. package/lib/commonjs/web/index.js +14 -18
  123. package/lib/commonjs/web/index.js.map +1 -1
  124. package/lib/commonjs/web/listener.js +9 -7
  125. package/lib/commonjs/web/listener.js.map +1 -1
  126. package/lib/commonjs/web/registry.js +44 -123
  127. package/lib/commonjs/web/registry.js.map +1 -1
  128. package/lib/commonjs/web/runtime.js +28 -21
  129. package/lib/commonjs/web/runtime.js.map +1 -1
  130. package/lib/commonjs/web/services.js +28 -0
  131. package/lib/commonjs/web/services.js.map +1 -0
  132. package/lib/commonjs/web/shadowRegistry.js +46 -93
  133. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  134. package/lib/commonjs/web/state.js +39 -9
  135. package/lib/commonjs/web/state.js.map +1 -1
  136. package/lib/commonjs/web/types.js +6 -0
  137. package/lib/commonjs/web/types.js.map +1 -0
  138. package/lib/commonjs/web/utils/common.js +29 -9
  139. package/lib/commonjs/web/utils/common.js.map +1 -1
  140. package/lib/commonjs/web/utils/unistyle.js +28 -19
  141. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  142. package/lib/commonjs/web/variants.js +25 -27
  143. package/lib/commonjs/web/variants.js.map +1 -1
  144. package/lib/module/components/ScopedTheme.js.map +1 -1
  145. package/lib/module/components/index.js +0 -1
  146. package/lib/module/components/index.js.map +1 -1
  147. package/lib/module/components/native/ImageBackground.js +45 -2
  148. package/lib/module/components/native/ImageBackground.js.map +1 -1
  149. package/lib/module/components/native/ImageBackground.native.js +6 -0
  150. package/lib/module/components/native/ImageBackground.native.js.map +1 -0
  151. package/lib/module/components/native/Pressable.js +27 -52
  152. package/lib/module/components/native/Pressable.js.map +1 -1
  153. package/lib/module/components/native/Pressable.native.js +15 -12
  154. package/lib/module/components/native/Pressable.native.js.map +1 -1
  155. package/lib/module/core/createUnistylesElement.js +29 -5
  156. package/lib/module/core/createUnistylesElement.js.map +1 -1
  157. package/lib/module/core/createUnistylesElement.native.js +33 -0
  158. package/lib/module/core/createUnistylesElement.native.js.map +1 -0
  159. package/lib/module/core/createUnistylesImageBackground.js +34 -13
  160. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  161. package/lib/module/core/getClassname.js +20 -0
  162. package/lib/module/core/getClassname.js.map +1 -0
  163. package/lib/module/core/getClassname.native.js +4 -0
  164. package/lib/module/core/getClassname.native.js.map +1 -0
  165. package/lib/module/core/index.js +2 -1
  166. package/lib/module/core/index.js.map +1 -1
  167. package/lib/module/core/passForwardRef.js +2 -2
  168. package/lib/module/core/passForwardRef.js.map +1 -1
  169. package/lib/module/core/useProxifiedUnistyles/index.js +4 -0
  170. package/lib/module/core/useProxifiedUnistyles/index.js.map +1 -0
  171. package/lib/module/core/useProxifiedUnistyles/listener.js +17 -0
  172. package/lib/module/core/useProxifiedUnistyles/listener.js.map +1 -0
  173. package/lib/module/core/useProxifiedUnistyles/listener.native.js +21 -0
  174. package/lib/module/core/useProxifiedUnistyles/listener.native.js.map +1 -0
  175. package/lib/module/core/useProxifiedUnistyles/types.js +4 -0
  176. package/lib/module/core/useProxifiedUnistyles/types.js.map +1 -0
  177. package/lib/module/core/{withUnistyles/useDependencies.js → useProxifiedUnistyles/useProxifiedUnistyles.js} +19 -19
  178. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -0
  179. package/lib/module/core/useUnistyles.js +14 -0
  180. package/lib/module/core/useUnistyles.js.map +1 -0
  181. package/lib/module/core/warn.js +11 -0
  182. package/lib/module/core/warn.js.map +1 -0
  183. package/lib/module/core/withUnistyles/withUnistyles.js +19 -55
  184. package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
  185. package/lib/module/core/withUnistyles/withUnistyles.native.js +33 -66
  186. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  187. package/lib/module/index.js +3 -2
  188. package/lib/module/index.js.map +1 -1
  189. package/lib/module/server/getServerUnistyles.js +32 -0
  190. package/lib/module/server/getServerUnistyles.js.map +1 -0
  191. package/lib/module/server/hydrateServerUnistyles.js +12 -0
  192. package/lib/module/server/hydrateServerUnistyles.js.map +1 -0
  193. package/lib/module/server/index.js +7 -0
  194. package/lib/module/server/index.js.map +1 -0
  195. package/lib/module/server/resetServerUnistyles.js +11 -0
  196. package/lib/module/server/resetServerUnistyles.js.map +1 -0
  197. package/lib/module/server/types.js +4 -0
  198. package/lib/module/server/types.js.map +1 -0
  199. package/lib/module/server/useServerUnistyles.js +22 -0
  200. package/lib/module/server/useServerUnistyles.js.map +1 -0
  201. package/lib/module/specs/ShadowRegistry/index.js +6 -3
  202. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  203. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  204. package/lib/module/utils.js +2 -1
  205. package/lib/module/utils.js.map +1 -1
  206. package/lib/module/web/convert/object/filter.js +2 -2
  207. package/lib/module/web/convert/object/filter.js.map +1 -1
  208. package/lib/module/web/convert/style.js +4 -4
  209. package/lib/module/web/convert/style.js.map +1 -1
  210. package/lib/module/web/create.js +20 -15
  211. package/lib/module/web/create.js.map +1 -1
  212. package/lib/module/web/css/core.js +50 -0
  213. package/lib/module/web/css/core.js.map +1 -0
  214. package/lib/module/web/css/index.js +4 -0
  215. package/lib/module/web/css/index.js.map +1 -0
  216. package/lib/module/web/css/state.js +150 -0
  217. package/lib/module/web/css/state.js.map +1 -0
  218. package/lib/module/web/css/utils.js +41 -0
  219. package/lib/module/web/css/utils.js.map +1 -0
  220. package/lib/module/web/index.js +10 -5
  221. package/lib/module/web/index.js.map +1 -1
  222. package/lib/module/web/listener.js +8 -7
  223. package/lib/module/web/listener.js.map +1 -1
  224. package/lib/module/web/registry.js +44 -124
  225. package/lib/module/web/registry.js.map +1 -1
  226. package/lib/module/web/runtime.js +27 -21
  227. package/lib/module/web/runtime.js.map +1 -1
  228. package/lib/module/web/services.js +23 -0
  229. package/lib/module/web/services.js.map +1 -0
  230. package/lib/module/web/shadowRegistry.js +46 -94
  231. package/lib/module/web/shadowRegistry.js.map +1 -1
  232. package/lib/module/web/state.js +39 -10
  233. package/lib/module/web/state.js.map +1 -1
  234. package/lib/module/web/types.js +4 -0
  235. package/lib/module/web/types.js.map +1 -0
  236. package/lib/module/web/utils/common.js +26 -7
  237. package/lib/module/web/utils/common.js.map +1 -1
  238. package/lib/module/web/utils/unistyle.js +27 -17
  239. package/lib/module/web/utils/unistyle.js.map +1 -1
  240. package/lib/module/web/variants.js +25 -27
  241. package/lib/module/web/variants.js.map +1 -1
  242. package/lib/typescript/src/components/index.d.ts +0 -1
  243. package/lib/typescript/src/components/index.d.ts.map +1 -1
  244. package/lib/typescript/src/components/native/ActivityIndicator.d.ts +3 -1
  245. package/lib/typescript/src/components/native/ActivityIndicator.d.ts.map +1 -1
  246. package/lib/typescript/src/components/native/FlatList.d.ts +3 -1
  247. package/lib/typescript/src/components/native/FlatList.d.ts.map +1 -1
  248. package/lib/typescript/src/components/native/Image.d.ts +3 -1
  249. package/lib/typescript/src/components/native/Image.d.ts.map +1 -1
  250. package/lib/typescript/src/components/native/ImageBackground.d.ts +8 -2
  251. package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
  252. package/lib/typescript/src/components/native/ImageBackground.native.d.ts +3 -0
  253. package/lib/typescript/src/components/native/ImageBackground.native.d.ts.map +1 -0
  254. package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts +3 -1
  255. package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts.map +1 -1
  256. package/lib/typescript/src/components/native/Pressable.d.ts +3 -2
  257. package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -1
  258. package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
  259. package/lib/typescript/src/components/native/RefreshControl.d.ts +3 -1
  260. package/lib/typescript/src/components/native/RefreshControl.d.ts.map +1 -1
  261. package/lib/typescript/src/components/native/ScrollView.d.ts +3 -1
  262. package/lib/typescript/src/components/native/ScrollView.d.ts.map +1 -1
  263. package/lib/typescript/src/components/native/SectionList.d.ts +3 -1
  264. package/lib/typescript/src/components/native/SectionList.d.ts.map +1 -1
  265. package/lib/typescript/src/components/native/Switch.d.ts +3 -1
  266. package/lib/typescript/src/components/native/Switch.d.ts.map +1 -1
  267. package/lib/typescript/src/components/native/Text.d.ts +3 -1
  268. package/lib/typescript/src/components/native/Text.d.ts.map +1 -1
  269. package/lib/typescript/src/components/native/TextInput.d.ts +3 -1
  270. package/lib/typescript/src/components/native/TextInput.d.ts.map +1 -1
  271. package/lib/typescript/src/components/native/TouchableHighlight.d.ts +3 -1
  272. package/lib/typescript/src/components/native/TouchableHighlight.d.ts.map +1 -1
  273. package/lib/typescript/src/components/native/TouchableOpacity.d.ts +3 -1
  274. package/lib/typescript/src/components/native/TouchableOpacity.d.ts.map +1 -1
  275. package/lib/typescript/src/components/native/View.d.ts +3 -1
  276. package/lib/typescript/src/components/native/View.d.ts.map +1 -1
  277. package/lib/typescript/src/components/native/VirtualizedList.d.ts +3 -1
  278. package/lib/typescript/src/components/native/VirtualizedList.d.ts.map +1 -1
  279. package/lib/typescript/src/core/createUnistylesElement.d.ts +6 -1
  280. package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
  281. package/lib/typescript/src/core/createUnistylesElement.native.d.ts +3 -0
  282. package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -0
  283. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
  284. package/lib/typescript/src/core/getClassname.d.ts +7 -0
  285. package/lib/typescript/src/core/getClassname.d.ts.map +1 -0
  286. package/lib/typescript/src/core/getClassname.native.d.ts +2 -0
  287. package/lib/typescript/src/core/getClassname.native.d.ts.map +1 -0
  288. package/lib/typescript/src/core/index.d.ts +2 -1
  289. package/lib/typescript/src/core/index.d.ts.map +1 -1
  290. package/lib/typescript/src/core/passForwardRef.d.ts.map +1 -1
  291. package/lib/typescript/src/core/useProxifiedUnistyles/index.d.ts +2 -0
  292. package/lib/typescript/src/core/useProxifiedUnistyles/index.d.ts.map +1 -0
  293. package/lib/typescript/src/core/useProxifiedUnistyles/listener.d.ts +3 -0
  294. package/lib/typescript/src/core/useProxifiedUnistyles/listener.d.ts.map +1 -0
  295. package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts +3 -0
  296. package/lib/typescript/src/core/useProxifiedUnistyles/listener.native.d.ts.map +1 -0
  297. package/lib/typescript/src/core/useProxifiedUnistyles/types.d.ts +7 -0
  298. package/lib/typescript/src/core/useProxifiedUnistyles/types.d.ts.map +1 -0
  299. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts +8 -0
  300. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -0
  301. package/lib/typescript/src/core/useUnistyles.d.ts +6 -0
  302. package/lib/typescript/src/core/useUnistyles.d.ts.map +1 -0
  303. package/lib/typescript/src/core/warn.d.ts +3 -0
  304. package/lib/typescript/src/core/warn.d.ts.map +1 -0
  305. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts +0 -3
  306. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
  307. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  308. package/lib/typescript/src/index.d.ts +3 -2
  309. package/lib/typescript/src/index.d.ts.map +1 -1
  310. package/lib/typescript/src/server/getServerUnistyles.d.ts +4 -0
  311. package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -0
  312. package/lib/typescript/src/server/hydrateServerUnistyles.d.ts +8 -0
  313. package/lib/typescript/src/server/hydrateServerUnistyles.d.ts.map +1 -0
  314. package/lib/typescript/src/server/index.d.ts +5 -0
  315. package/lib/typescript/src/server/index.d.ts.map +1 -0
  316. package/lib/typescript/src/server/resetServerUnistyles.d.ts +2 -0
  317. package/lib/typescript/src/server/resetServerUnistyles.d.ts.map +1 -0
  318. package/lib/typescript/src/server/types.d.ts +5 -0
  319. package/lib/typescript/src/server/types.d.ts.map +1 -0
  320. package/lib/typescript/src/server/useServerUnistyles.d.ts +4 -0
  321. package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -0
  322. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +0 -3
  323. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  324. package/lib/typescript/src/specs/StyleSheet/index.d.ts +4 -1
  325. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  326. package/lib/typescript/src/utils.d.ts +1 -0
  327. package/lib/typescript/src/utils.d.ts.map +1 -1
  328. package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
  329. package/lib/typescript/src/web/create.d.ts.map +1 -1
  330. package/lib/typescript/src/web/css/core.d.ts +3 -0
  331. package/lib/typescript/src/web/css/core.d.ts.map +1 -0
  332. package/lib/typescript/src/web/css/index.d.ts +2 -0
  333. package/lib/typescript/src/web/css/index.d.ts.map +1 -0
  334. package/lib/typescript/src/web/css/state.d.ts +30 -0
  335. package/lib/typescript/src/web/css/state.d.ts.map +1 -0
  336. package/lib/typescript/src/web/css/utils.d.ts +4 -0
  337. package/lib/typescript/src/web/css/utils.d.ts.map +1 -0
  338. package/lib/typescript/src/web/index.d.ts +7 -1
  339. package/lib/typescript/src/web/index.d.ts.map +1 -1
  340. package/lib/typescript/src/web/listener.d.ts +4 -3
  341. package/lib/typescript/src/web/listener.d.ts.map +1 -1
  342. package/lib/typescript/src/web/registry.d.ts +11 -8
  343. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  344. package/lib/typescript/src/web/runtime.d.ts +6 -4
  345. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  346. package/lib/typescript/src/web/services.d.ts +15 -0
  347. package/lib/typescript/src/web/services.d.ts.map +1 -0
  348. package/lib/typescript/src/web/shadowRegistry.d.ts +10 -13
  349. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  350. package/lib/typescript/src/web/state.d.ts +7 -3
  351. package/lib/typescript/src/web/state.d.ts.map +1 -1
  352. package/lib/typescript/src/web/types.d.ts +13 -0
  353. package/lib/typescript/src/web/types.d.ts.map +1 -0
  354. package/lib/typescript/src/web/utils/common.d.ts +2 -1
  355. package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
  356. package/lib/typescript/src/web/utils/unistyle.d.ts +5 -4
  357. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  358. package/lib/typescript/src/web/variants.d.ts +2 -2
  359. package/lib/typescript/src/web/variants.d.ts.map +1 -1
  360. package/nitrogen/generated/android/c++/JColorScheme.hpp +2 -1
  361. package/nitrogen/generated/android/c++/JDimensions.hpp +2 -1
  362. package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +36 -10
  363. package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +53 -19
  364. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +5 -5
  365. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +1 -1
  366. package/nitrogen/generated/android/c++/JInsets.hpp +2 -1
  367. package/nitrogen/generated/android/c++/JOrientation.hpp +2 -1
  368. package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +2 -1
  369. package/nitrogen/generated/android/c++/JUnistylesNativeMiniRuntime.hpp +2 -1
  370. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/ColorScheme.kt +1 -1
  371. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +10 -5
  372. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_UnistylesNativeMiniRuntime.kt +43 -14
  373. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +43 -14
  374. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +10 -10
  375. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +13 -8
  376. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Orientation.kt +1 -1
  377. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +1 -1
  378. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +19 -14
  379. package/nitrogen/generated/android/unistyles+autolinking.cmake +4 -1
  380. package/nitrogen/generated/android/unistyles+autolinking.gradle +1 -1
  381. package/nitrogen/generated/android/unistylesOnLoad.cpp +7 -3
  382. package/nitrogen/generated/android/unistylesOnLoad.hpp +1 -1
  383. package/nitrogen/generated/ios/Unistyles+autolinking.rb +1 -1
  384. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +21 -6
  385. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +105 -27
  386. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +5 -3
  387. package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.cpp +1 -1
  388. package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +92 -33
  389. package/nitrogen/generated/ios/swift/ColorScheme.swift +1 -1
  390. package/nitrogen/generated/ios/swift/Dimensions.swift +1 -1
  391. package/nitrogen/generated/ios/swift/Func_void_UnistylesNativeMiniRuntime.swift +46 -0
  392. package/nitrogen/generated/ios/swift/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.swift +46 -0
  393. package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +36 -23
  394. package/nitrogen/generated/ios/swift/HybridNativePlatformSpec_cxx.swift +327 -0
  395. package/nitrogen/generated/ios/swift/Insets.swift +1 -1
  396. package/nitrogen/generated/ios/swift/Orientation.swift +1 -1
  397. package/nitrogen/generated/ios/swift/UnistyleDependency.swift +1 -1
  398. package/nitrogen/generated/ios/swift/UnistylesNativeMiniRuntime.swift +1 -1
  399. package/nitrogen/generated/shared/c++/ColorScheme.hpp +1 -1
  400. package/nitrogen/generated/shared/c++/Dimensions.hpp +1 -1
  401. package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.cpp +1 -1
  402. package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +1 -1
  403. package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.cpp +1 -1
  404. package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +1 -1
  405. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +1 -1
  406. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +1 -1
  407. package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.cpp +1 -1
  408. package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +1 -1
  409. package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.cpp +1 -1
  410. package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +1 -1
  411. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +1 -1
  412. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
  413. package/nitrogen/generated/shared/c++/Insets.hpp +1 -1
  414. package/nitrogen/generated/shared/c++/Orientation.hpp +1 -1
  415. package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +2 -2
  416. package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -1
  417. package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +1 -1
  418. package/package.json +21 -12
  419. package/plugin/import.js +1 -21
  420. package/plugin/index.d.ts +41 -0
  421. package/plugin/index.js +44 -76
  422. package/plugin/stylesheet.js +17 -1
  423. package/plugin/variants.js +49 -75
  424. package/src/components/ScopedTheme.tsx +1 -1
  425. package/src/components/index.ts +0 -1
  426. package/src/components/native/ImageBackground.native.tsx +4 -0
  427. package/src/components/native/ImageBackground.tsx +54 -2
  428. package/src/components/native/Pressable.native.tsx +16 -17
  429. package/src/components/native/Pressable.tsx +35 -69
  430. package/src/core/createUnistylesElement.native.tsx +36 -0
  431. package/src/core/createUnistylesElement.tsx +42 -8
  432. package/src/core/createUnistylesImageBackground.tsx +40 -19
  433. package/src/core/getClassname.native.ts +1 -0
  434. package/src/core/getClassname.ts +13 -0
  435. package/src/core/index.ts +2 -1
  436. package/src/core/passForwardRef.ts +1 -2
  437. package/src/core/useProxifiedUnistyles/index.ts +1 -0
  438. package/src/core/useProxifiedUnistyles/listener.native.ts +18 -0
  439. package/src/core/useProxifiedUnistyles/listener.ts +13 -0
  440. package/src/core/useProxifiedUnistyles/types.ts +7 -0
  441. package/src/core/{withUnistyles/useDependencies.ts → useProxifiedUnistyles/useProxifiedUnistyles.ts} +19 -26
  442. package/src/core/useUnistyles.ts +11 -0
  443. package/src/core/warn.ts +13 -0
  444. package/src/core/withUnistyles/withUnistyles.native.tsx +39 -68
  445. package/src/core/withUnistyles/withUnistyles.tsx +19 -56
  446. package/src/index.ts +3 -2
  447. package/src/server/getServerUnistyles.tsx +20 -0
  448. package/src/server/hydrateServerUnistyles.ts +17 -0
  449. package/src/server/index.ts +5 -0
  450. package/src/server/resetServerUnistyles.ts +9 -0
  451. package/src/server/types.ts +4 -0
  452. package/src/server/useServerUnistyles.tsx +22 -0
  453. package/src/specs/ShadowRegistry/index.ts +12 -9
  454. package/src/specs/StyleSheet/index.ts +5 -1
  455. package/src/utils.ts +15 -11
  456. package/src/web/convert/object/filter.ts +2 -2
  457. package/src/web/convert/style.ts +8 -7
  458. package/src/web/create.ts +23 -18
  459. package/src/web/css/core.ts +58 -0
  460. package/src/web/css/index.ts +1 -0
  461. package/src/web/css/state.ts +191 -0
  462. package/src/web/css/utils.ts +54 -0
  463. package/src/web/index.ts +18 -5
  464. package/src/web/listener.ts +8 -8
  465. package/src/web/registry.ts +47 -152
  466. package/src/web/runtime.ts +32 -22
  467. package/src/web/services.ts +28 -0
  468. package/src/web/shadowRegistry.ts +46 -104
  469. package/src/web/state.ts +46 -11
  470. package/src/web/types.ts +13 -0
  471. package/src/web/utils/common.ts +32 -8
  472. package/src/web/utils/unistyle.ts +40 -25
  473. package/src/web/variants.ts +27 -27
  474. package/cxx/core/HostStyle.cpp +0 -73
  475. package/cxx/core/HostStyle.h +0 -34
  476. package/lib/commonjs/components/Variants.js +0 -36
  477. package/lib/commonjs/components/Variants.js.map +0 -1
  478. package/lib/commonjs/core/createUnistylesComponent.js +0 -16
  479. package/lib/commonjs/core/createUnistylesComponent.js.map +0 -1
  480. package/lib/commonjs/core/withUnistyles/useDependencies.js.map +0 -1
  481. package/lib/module/components/Variants.js +0 -29
  482. package/lib/module/components/Variants.js.map +0 -1
  483. package/lib/module/core/createUnistylesComponent.js +0 -11
  484. package/lib/module/core/createUnistylesComponent.js.map +0 -1
  485. package/lib/module/core/withUnistyles/useDependencies.js.map +0 -1
  486. package/lib/typescript/src/components/Variants.d.ts +0 -7
  487. package/lib/typescript/src/components/Variants.d.ts.map +0 -1
  488. package/lib/typescript/src/core/createUnistylesComponent.d.ts +0 -14
  489. package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +0 -1
  490. package/lib/typescript/src/core/withUnistyles/useDependencies.d.ts +0 -13
  491. package/lib/typescript/src/core/withUnistyles/useDependencies.d.ts.map +0 -1
  492. package/nitrogen/generated/android/unistylesOnLoad.kt +0 -1
  493. package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +0 -314
  494. package/plugin/style.js +0 -168
  495. package/src/components/Variants.tsx +0 -30
  496. package/src/core/createUnistylesComponent.tsx +0 -14
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ import { UnistylesShadowRegistry } from '../web';
4
+ export const getClassName = unistyle => {
5
+ if (!unistyle) {
6
+ return undefined;
7
+ }
8
+
9
+ // @ts-expect-error hidden from TS
10
+ const {
11
+ hash,
12
+ injectedClassName
13
+ } = UnistylesShadowRegistry.addStyles(Array.isArray(unistyle) ? unistyle : [unistyle]);
14
+ return hash ? {
15
+ $$css: true,
16
+ hash,
17
+ injectedClassName
18
+ } : undefined;
19
+ };
20
+ //# sourceMappingURL=getClassname.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnistylesShadowRegistry","getClassName","unistyle","undefined","hash","injectedClassName","addStyles","Array","isArray","$$css"],"sourceRoot":"../../../src","sources":["core/getClassname.ts"],"mappings":";;AACA,SAASA,uBAAuB,QAAQ,QAAQ;AAEhD,OAAO,MAAMC,YAAY,GAAIC,QAA8D,IAAK;EAC5F,IAAI,CAACA,QAAQ,EAAE;IACX,OAAOC,SAAS;EACpB;;EAEA;EACA,MAAM;IAAEC,IAAI;IAAEC;EAAkB,CAAC,GAAGL,uBAAuB,CAACM,SAAS,CAACC,KAAK,CAACC,OAAO,CAACN,QAAQ,CAAC,GAAGA,QAAQ,GAAG,CAACA,QAAQ,CAAC,CAAC;EAEtH,OAAOE,IAAI,GAAG;IAAEK,KAAK,EAAE,IAAI;IAAEL,IAAI;IAAEC;EAAkB,CAAC,GAAGF,SAAS;AACtE,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export const getClassName = () => undefined;
4
+ //# sourceMappingURL=getClassname.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getClassName","undefined"],"sourceRoot":"../../../src","sources":["core/getClassname.native.ts"],"mappings":";;AAAA,OAAO,MAAMA,YAAY,GAAGA,CAAA,KAAMC,SAAS","ignoreList":[]}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
 
3
- export { createUnistylesComponent } from './createUnistylesComponent';
4
3
  export { createUnistylesElement } from './createUnistylesElement';
5
4
  export { createUnistylesImageBackground } from './createUnistylesImageBackground';
6
5
  export { withUnistyles } from './withUnistyles';
7
6
  export { passForwardedRef } from './passForwardRef';
7
+ export { getClassName } from './getClassname';
8
+ export { useUnistyles } from './useUnistyles';
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createUnistylesComponent","createUnistylesElement","createUnistylesImageBackground","withUnistyles","passForwardedRef"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;AAAA,SAASA,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,8BAA8B,QAAQ,kCAAkC;AACjF,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,gBAAgB,QAAQ,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["createUnistylesElement","createUnistylesImageBackground","withUnistyles","passForwardedRef","getClassName","useUnistyles"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,8BAA8B,QAAQ,kCAAkC;AACjF,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,YAAY,QAAQ,gBAAgB","ignoreList":[]}
@@ -12,10 +12,10 @@ export const passForwardedRef = (props, ref, forwardedRef) => {
12
12
  return () => {};
13
13
  };
14
14
  const forwardedRefReturnFn = passForwardedRef();
15
+
16
+ // @ts-expect-error hidden from TS
15
17
  UnistylesShadowRegistry.add(ref, props.style);
16
18
  return () => {
17
- // @ts-expect-error - This is hidden from TS
18
- UnistylesShadowRegistry.remove(ref);
19
19
  forwardedRefReturnFn?.();
20
20
  };
21
21
  };
@@ -1 +1 @@
1
- {"version":3,"names":["UnistylesShadowRegistry","passForwardedRef","props","ref","forwardedRef","current","forwardedRefReturnFn","add","style","remove"],"sourceRoot":"../../../src","sources":["core/passForwardRef.ts"],"mappings":";;AACA,SAASA,uBAAuB,QAAQ,UAAU;AAElD,OAAO,MAAMC,gBAAgB,GAAGA,CAC5BC,KAAU,EACVC,GAAM,EACNC,YAAmC,KAClC;EACD,MAAMH,gBAAgB,GAAGA,CAAA,KAAM;IAC3B,IAAI,OAAOG,YAAY,KAAK,UAAU,EAAE;MACpC,OAAOA,YAAY,CAACD,GAAG,CAAC;IAC5B;IAEA,IAAIC,YAAY,EAAE;MACdA,YAAY,CAACC,OAAO,GAAGF,GAAG;IAC9B;IAEA,OAAO,MAAM,CAAC,CAAC;EACnB,CAAC;EACD,MAAMG,oBAAoB,GAAGL,gBAAgB,CAAC,CAAC;EAE/CD,uBAAuB,CAACO,GAAG,CAACJ,GAAG,EAAED,KAAK,CAACM,KAAK,CAAC;EAE7C,OAAO,MAAM;IACT;IACAR,uBAAuB,CAACS,MAAM,CAACN,GAAG,CAAC;IACnCG,oBAAoB,GAAG,CAAC;EAC5B,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["UnistylesShadowRegistry","passForwardedRef","props","ref","forwardedRef","current","forwardedRefReturnFn","add","style"],"sourceRoot":"../../../src","sources":["core/passForwardRef.ts"],"mappings":";;AACA,SAASA,uBAAuB,QAAQ,UAAU;AAElD,OAAO,MAAMC,gBAAgB,GAAGA,CAC5BC,KAAU,EACVC,GAAM,EACNC,YAAmC,KAClC;EACD,MAAMH,gBAAgB,GAAGA,CAAA,KAAM;IAC3B,IAAI,OAAOG,YAAY,KAAK,UAAU,EAAE;MACpC,OAAOA,YAAY,CAACD,GAAG,CAAC;IAC5B;IAEA,IAAIC,YAAY,EAAE;MACdA,YAAY,CAACC,OAAO,GAAGF,GAAG;IAC9B;IAEA,OAAO,MAAM,CAAC,CAAC;EACnB,CAAC;EACD,MAAMG,oBAAoB,GAAGL,gBAAgB,CAAC,CAAC;;EAE/C;EACAD,uBAAuB,CAACO,GAAG,CAACJ,GAAG,EAAED,KAAK,CAACM,KAAK,CAAC;EAE7C,OAAO,MAAM;IACTF,oBAAoB,GAAG,CAAC;EAC5B,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { useProxifiedUnistyles } from './useProxifiedUnistyles';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useProxifiedUnistyles"],"sourceRoot":"../../../../src","sources":["core/useProxifiedUnistyles/index.ts"],"mappings":";;AAAA,SAASA,qBAAqB,QAAQ,yBAAyB","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ import { UnistyleDependency } from '../../specs';
4
+ import { UnistylesWeb } from '../../web';
5
+ export const listener = ({
6
+ dependencies,
7
+ updateTheme,
8
+ updateRuntime
9
+ }) => {
10
+ const disposeTheme = UnistylesWeb.listener.addListeners(dependencies.filter(dependency => dependency === UnistyleDependency.Theme), updateTheme);
11
+ const disposeRuntime = UnistylesWeb.listener.addListeners(dependencies.filter(dependency => dependency !== UnistyleDependency.Theme), updateRuntime);
12
+ return () => {
13
+ disposeTheme();
14
+ disposeRuntime();
15
+ };
16
+ };
17
+ //# sourceMappingURL=listener.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnistyleDependency","UnistylesWeb","listener","dependencies","updateTheme","updateRuntime","disposeTheme","addListeners","filter","dependency","Theme","disposeRuntime"],"sourceRoot":"../../../../src","sources":["core/useProxifiedUnistyles/listener.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,aAAa;AAChD,SAASC,YAAY,QAAQ,WAAW;AAGxC,OAAO,MAAMC,QAAQ,GAAGA,CAAC;EAAEC,YAAY;EAAEC,WAAW;EAAEC;AAA6B,CAAC,KAAK;EACrF,MAAMC,YAAY,GAAGL,YAAY,CAACC,QAAQ,CAACK,YAAY,CAACJ,YAAY,CAACK,MAAM,CAACC,UAAU,IAAIA,UAAU,KAAKT,kBAAkB,CAACU,KAAK,CAAC,EAAEN,WAAW,CAAC;EAChJ,MAAMO,cAAc,GAAGV,YAAY,CAACC,QAAQ,CAACK,YAAY,CAACJ,YAAY,CAACK,MAAM,CAACC,UAAU,IAAIA,UAAU,KAAKT,kBAAkB,CAACU,KAAK,CAAC,EAAEL,aAAa,CAAC;EAEpJ,OAAO,MAAM;IACTC,YAAY,CAAC,CAAC;IACdK,cAAc,CAAC,CAAC;EACpB,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ import { StyleSheet, UnistyleDependency } from '../../specs';
4
+ export const listener = ({
5
+ dependencies,
6
+ updateTheme,
7
+ updateRuntime
8
+ }) => {
9
+ const listensToTheme = dependencies.includes(UnistyleDependency.Theme);
10
+ // @ts-expect-error - this is hidden from TS
11
+ const dispose = StyleSheet.addChangeListener(changedDependencies => {
12
+ if (listensToTheme && changedDependencies.includes(UnistyleDependency.Theme)) {
13
+ updateTheme();
14
+ }
15
+ if (changedDependencies.some(dependency => dependencies.includes(dependency))) {
16
+ updateRuntime();
17
+ }
18
+ });
19
+ return () => dispose();
20
+ };
21
+ //# sourceMappingURL=listener.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StyleSheet","UnistyleDependency","listener","dependencies","updateTheme","updateRuntime","listensToTheme","includes","Theme","dispose","addChangeListener","changedDependencies","some","dependency"],"sourceRoot":"../../../../src","sources":["core/useProxifiedUnistyles/listener.native.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,kBAAkB,QAAQ,aAAa;AAG5D,OAAO,MAAMC,QAAQ,GAAGA,CAAC;EAAEC,YAAY;EAAEC,WAAW;EAAEC;AAA6B,CAAC,KAAK;EACrF,MAAMC,cAAc,GAAGH,YAAY,CAACI,QAAQ,CAACN,kBAAkB,CAACO,KAAK,CAAC;EACtE;EACA,MAAMC,OAAO,GAAGT,UAAU,CAACU,iBAAiB,CAACC,mBAAmB,IAAI;IAChE,IAAIL,cAAc,IAAIK,mBAAmB,CAACJ,QAAQ,CAACN,kBAAkB,CAACO,KAAK,CAAC,EAAE;MAC1EJ,WAAW,CAAC,CAAC;IACjB;IAEA,IAAIO,mBAAmB,CAACC,IAAI,CAAEC,UAA8B,IAAKV,YAAY,CAACI,QAAQ,CAACM,UAAU,CAAC,CAAC,EAAE;MACjGR,aAAa,CAAC,CAAC;IACnB;EACJ,CAAC,CAAC;EAEF,OAAO,MAAMI,OAAO,CAAC,CAAC;AAC1B,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["core/useProxifiedUnistyles/types.ts"],"mappings":"","ignoreList":[]}
@@ -4,6 +4,7 @@ import { useEffect, useReducer, useRef, useState } from 'react';
4
4
  import { UnistylesRuntime, UnistylesShadowRegistry } from '../../specs';
5
5
  // It's imported that way because of circular dependency
6
6
  import { UnistyleDependency } from '../../specs/NativePlatform';
7
+ import { listener } from './listener';
7
8
  const getMiniRuntime = () => {
8
9
  // @ts-expect-error This is hidden from TS
9
10
  return UnistylesRuntime.miniRuntime;
@@ -23,7 +24,7 @@ const RTDependencyMap = {
23
24
  pixelRatio: UnistyleDependency.PixelRatio,
24
25
  themeName: UnistyleDependency.ThemeName
25
26
  };
26
- export const useDependencies = listener => {
27
+ export const useProxifiedUnistyles = () => {
27
28
  const scopedTheme = UnistylesShadowRegistry.getScopedTheme();
28
29
  const [dependencies] = useState(() => new Set());
29
30
  const [theme, setTheme] = useState(UnistylesRuntime.getTheme(scopedTheme));
@@ -46,24 +47,23 @@ export const useDependencies = listener => {
46
47
  reinitListener();
47
48
  return () => disposeRef.current?.();
48
49
  }, [dependencies.size]);
50
+ const proxifiedTheme = new Proxy(theme, {
51
+ get: (target, prop) => {
52
+ dependencies.add(UnistyleDependency.Theme);
53
+ return target[prop];
54
+ }
55
+ });
56
+ const proxifiedRuntime = new Proxy(getMiniRuntime(), {
57
+ get: (target, prop) => {
58
+ if (prop in RTDependencyMap) {
59
+ dependencies.add(RTDependencyMap[prop]);
60
+ }
61
+ return target[prop];
62
+ }
63
+ });
49
64
  return {
50
- mappingsCallback: callback => {
51
- const proxifiedTheme = new Proxy(theme, {
52
- get: (target, prop) => {
53
- dependencies.add(UnistyleDependency.Theme);
54
- return target[prop];
55
- }
56
- });
57
- const proxifiedRuntime = new Proxy(getMiniRuntime(), {
58
- get: (target, prop) => {
59
- if (prop in RTDependencyMap) {
60
- dependencies.add(RTDependencyMap[prop]);
61
- }
62
- return target[prop];
63
- }
64
- });
65
- return callback(proxifiedTheme, proxifiedRuntime);
66
- },
65
+ proxifiedTheme,
66
+ proxifiedRuntime,
67
67
  addDependencies: newDependencies => {
68
68
  const dependenciesSize = dependencies.size;
69
69
  newDependencies.forEach(dependency => {
@@ -76,4 +76,4 @@ export const useDependencies = listener => {
76
76
  }
77
77
  };
78
78
  };
79
- //# sourceMappingURL=useDependencies.js.map
79
+ //# sourceMappingURL=useProxifiedUnistyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useReducer","useRef","useState","UnistylesRuntime","UnistylesShadowRegistry","UnistyleDependency","listener","getMiniRuntime","miniRuntime","RTDependencyMap","breakpoint","Breakpoints","colorScheme","ColorScheme","contentSizeCategory","ContentSizeCategory","hasAdaptiveThemes","AdaptiveThemes","insets","Insets","fontScale","FontScale","isLandscape","Orientation","isPortrait","navigationBar","NavigationBar","screen","Dimensions","statusBar","StatusBar","pixelRatio","PixelRatio","themeName","ThemeName","useProxifiedUnistyles","scopedTheme","getScopedTheme","dependencies","Set","theme","setTheme","getTheme","_","runtimeChanged","disposeRef","reinitListener","current","Array","from","updateTheme","updateRuntime","size","proxifiedTheme","Proxy","get","target","prop","add","Theme","proxifiedRuntime","addDependencies","newDependencies","dependenciesSize","forEach","dependency"],"sourceRoot":"../../../../src","sources":["core/useProxifiedUnistyles/useProxifiedUnistyles.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/D,SAASC,gBAAgB,EAAEC,uBAAuB,QAAmC,aAAa;AAClG;AACA,SAASC,kBAAkB,QAAQ,4BAA4B;AAE/D,SAASC,QAAQ,QAAQ,YAAY;AAErC,MAAMC,cAAc,GAAGA,CAAA,KAA4B;EAC/C;EACA,OAAOJ,gBAAgB,CAACK,WAAW;AACvC,CAAC;AAED,MAAMC,eAAe,GAAG;EACpBC,UAAU,EAAEL,kBAAkB,CAACM,WAAW;EAC1CC,WAAW,EAAEP,kBAAkB,CAACQ,WAAW;EAC3CC,mBAAmB,EAAET,kBAAkB,CAACU,mBAAmB;EAC3DC,iBAAiB,EAAEX,kBAAkB,CAACY,cAAc;EACpDC,MAAM,EAAEb,kBAAkB,CAACc,MAAM;EACjCC,SAAS,EAAEf,kBAAkB,CAACgB,SAAS;EACvCC,WAAW,EAAEjB,kBAAkB,CAACkB,WAAW;EAC3CC,UAAU,EAAEnB,kBAAkB,CAACkB,WAAW;EAC1CE,aAAa,EAAEpB,kBAAkB,CAACqB,aAAa;EAC/CC,MAAM,EAAEtB,kBAAkB,CAACuB,UAAU;EACrCC,SAAS,EAAExB,kBAAkB,CAACyB,SAAS;EACvCC,UAAU,EAAE1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AAY,CAACoB,GAAG,CAACrD,kBAAkB,CAACsD,KAAK,CAAC;MAE1C,OAAOH,MAAM,CAACC,IAAI,CAAC;IACvB;EACJ,CAAC,CAAC;EACF,MAAMG,gBAAgB,GAAG,IAAIN,KAAK,CAAC/C,cAAc,CAAC,CAAC,EAAE;IACjDgD,GAAG,EAAEA,CAACC,MAAM,EAAEC,IAAI,KAAK;MACnB,IAAIA,IAAI,IAAIhD,eAAe,EAAE;QACzB6B,YAAY,CAACoB,GAAG,CAACjD,eAAe,CAACgD,IAAI,CAAiC,CAAC;MAC3E;MAEA,OAAOD,MAAM,CAACC,IAAI,CAAwB;IAC9C;EACJ,CAAC,CAAC;EAEF,OAAO;IACHJ,cAAc;IACdO,gBAAgB;IAChBC,eAAe,EAAGC,eAA0C,IAAK;MAC7D,MAAMC,gBAAgB,GAAGzB,YAAY,CAACc,IAAI;MAE1CU,eAAe,CAACE,OAAO,CAACC,UAAU,IAAI;QAClC3B,YAAY,CAACoB,GAAG,CAACO,UAAU,CAAC;MAChC,CAAC,CAAC;MAEF,IAAIF,gBAAgB,KAAKzB,YAAY,CAACc,IAAI,EAAE;QACxC;MACJ;MAEAN,cAAc,CAAC,CAAC;IACpB;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ import { useProxifiedUnistyles } from './useProxifiedUnistyles';
4
+ export const useUnistyles = () => {
5
+ const {
6
+ proxifiedRuntime,
7
+ proxifiedTheme
8
+ } = useProxifiedUnistyles();
9
+ return {
10
+ theme: proxifiedTheme,
11
+ rt: proxifiedRuntime
12
+ };
13
+ };
14
+ //# sourceMappingURL=useUnistyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useProxifiedUnistyles","useUnistyles","proxifiedRuntime","proxifiedTheme","theme","rt"],"sourceRoot":"../../../src","sources":["core/useUnistyles.ts"],"mappings":";;AACA,SAASA,qBAAqB,QAAQ,yBAAyB;AAE/D,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM;IAAEC,gBAAgB;IAAEC;EAAe,CAAC,GAAGH,qBAAqB,CAAC,CAAC;EAEpE,OAAO;IACHI,KAAK,EAAED,cAAgC;IACvCE,EAAE,EAAEH;EACR,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ export const maybeWarnAboutMultipleUnistyles = (style, displayName = 'Unknown') => {
4
+ if (__DEV__ && style && !Array.isArray(style)) {
5
+ const unistylesKeys = Object.keys(style).filter(key => key.startsWith('unistyles-'));
6
+ if (unistylesKeys.length > 1) {
7
+ console.warn(`Unistyles: we detected style object with ${unistylesKeys.length} unistyles styles. This might cause no updates or unpredictable behavior. Please check style prop for "${displayName}" and use array syntax instead of object syntax.`);
8
+ }
9
+ }
10
+ };
11
+ //# sourceMappingURL=warn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["maybeWarnAboutMultipleUnistyles","style","displayName","__DEV__","Array","isArray","unistylesKeys","Object","keys","filter","key","startsWith","length","console","warn"],"sourceRoot":"../../../src","sources":["core/warn.ts"],"mappings":";;AAEA,OAAO,MAAMA,+BAA+B,GAAGA,CAACC,KAAgB,EAAEC,WAAW,GAAG,SAAS,KAAK;EAC1F,IAAIC,OAAO,IAAIF,KAAK,IAAI,CAACG,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,EAAE;IAC3C,MAAMK,aAAa,GAAGC,MAAM,CACvBC,IAAI,CAACP,KAAK,CAAC,CACXQ,MAAM,CAACC,GAAG,IAAIA,GAAG,CAACC,UAAU,CAAC,YAAY,CAAC,CAAC;IAEhD,IAAIL,aAAa,CAACM,MAAM,GAAG,CAAC,EAAE;MAC1BC,OAAO,CAACC,IAAI,CAAC,4CAA4CR,aAAa,CAACM,MAAM,0GAA0GV,WAAW,kDAAkD,CAAC;IACzP;EACJ;AACJ,CAAC","ignoreList":[]}
@@ -1,76 +1,40 @@
1
1
  "use strict";
2
2
 
3
- import React, { useEffect, useState, forwardRef, useRef, useMemo } from 'react';
4
- import { UnistylesListener } from '../../web/listener';
5
- import { UnistylesShadowRegistry } from '../../web';
6
- import { equal } from '../../web/utils';
3
+ import React, { forwardRef } from 'react';
7
4
  import { deepMergeObjects } from '../../utils';
8
- import { useDependencies } from './useDependencies';
9
- import { UnistyleDependency } from '../../specs/NativePlatform';
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- const useShadowRegistry = style => {
12
- const [ref] = useState(document.createElement('div'));
13
- const oldClassNames = useRef([]);
14
- const classNames = useMemo(() => {
15
- if (!style) {
16
- return [];
17
- }
18
- const newClassNames = UnistylesShadowRegistry.add(ref, [style]) ?? [];
19
- if (equal(oldClassNames.current, newClassNames)) {
20
- return oldClassNames.current;
21
- }
22
- oldClassNames.current = newClassNames;
23
- return newClassNames;
24
- }, [style]);
25
- useEffect(() => () => {
26
- // Remove styles on unmount
27
- if (style) {
28
- UnistylesShadowRegistry.add(null, [style]);
29
- }
30
- });
31
- return classNames;
32
- };
5
+ import { getClassName } from '../getClassname';
6
+ import { maybeWarnAboutMultipleUnistyles } from '../warn';
7
+ import { useProxifiedUnistyles } from '../useProxifiedUnistyles';
33
8
 
34
9
  // @ts-expect-error
35
10
 
36
11
  // @ts-expect-error
37
-
12
+ import { jsx as _jsx } from "react/jsx-runtime";
38
13
  export const withUnistyles = (Component, mappings) => {
39
14
  return /*#__PURE__*/forwardRef((props, ref) => {
40
15
  const narrowedProps = props;
41
- const styleClassNames = useShadowRegistry(narrowedProps.style);
42
- const contentContainerStyleClassNames = useShadowRegistry(narrowedProps.contentContainerStyle);
16
+ const styleClassNames = getClassName(narrowedProps.style);
17
+ const contentContainerStyleClassNames = getClassName(narrowedProps.contentContainerStyle);
43
18
  const {
44
- mappingsCallback
45
- } = useDependencies(({
46
- dependencies,
47
- updateTheme,
48
- updateRuntime
49
- }) => {
50
- const disposeTheme = UnistylesListener.addListeners(dependencies.filter(dependency => dependency === UnistyleDependency.Theme), updateTheme);
51
- const disposeRuntime = UnistylesListener.addListeners(dependencies.filter(dependency => dependency !== UnistyleDependency.Theme), updateRuntime);
52
- return () => {
53
- disposeTheme();
54
- disposeRuntime();
55
- };
56
- });
57
- const mappingsProps = mappings ? mappingsCallback(mappings) : {};
58
- const unistyleProps = narrowedProps.uniProps ? mappingsCallback(narrowedProps.uniProps) : {};
19
+ proxifiedRuntime,
20
+ proxifiedTheme
21
+ } = useProxifiedUnistyles();
22
+ const mappingsProps = mappings ? mappings(proxifiedTheme, proxifiedRuntime) : {};
23
+ const unistyleProps = narrowedProps.uniProps ? narrowedProps.uniProps(proxifiedTheme, proxifiedRuntime) : {};
59
24
  const combinedProps = {
60
25
  ...deepMergeObjects(mappingsProps, unistyleProps, props),
61
26
  ...(narrowedProps.style ? {
62
- style: {
63
- $$css: true,
64
- 'unistyles': styleClassNames.join(' ')
65
- }
27
+ style: styleClassNames
66
28
  } : {}),
67
29
  ...(narrowedProps.contentContainerStyle ? {
68
- style: {
69
- $$css: true,
70
- 'unistyles': contentContainerStyleClassNames.join(' ')
71
- }
30
+ style: contentContainerStyleClassNames
72
31
  } : {})
73
32
  };
33
+
34
+ // @ts-ignore
35
+ maybeWarnAboutMultipleUnistyles(narrowedProps.style, `withUnistyles(${Component.displayName ?? Component.name ?? 'Unknown'})`);
36
+ // @ts-ignore
37
+ maybeWarnAboutMultipleUnistyles(narrowedProps.contentContainerStyle, `withUnistyles(${Component.displayName ?? Component.name ?? 'Unknown'})`);
74
38
  const NativeComponent = Component;
75
39
  return /*#__PURE__*/_jsx(NativeComponent, {
76
40
  ...combinedProps,
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useState","forwardRef","useRef","useMemo","UnistylesListener","UnistylesShadowRegistry","equal","deepMergeObjects","useDependencies","UnistyleDependency","jsx","_jsx","useShadowRegistry","style","ref","document","createElement","oldClassNames","classNames","newClassNames","add","current","withUnistyles","Component","mappings","props","narrowedProps","styleClassNames","contentContainerStyleClassNames","contentContainerStyle","mappingsCallback","dependencies","updateTheme","updateRuntime","disposeTheme","addListeners","filter","dependency","Theme","disposeRuntime","mappingsProps","unistyleProps","uniProps","combinedProps","$$css","join","NativeComponent"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAsBC,UAAU,EAAEC,MAAM,EAAEC,OAAO,QAAgD,OAAO;AAE3I,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,uBAAuB,QAAQ,WAAW;AACnD,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,gBAAgB,QAAQ,aAAa;AAE9C,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,kBAAkB,QAAQ,4BAA4B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAG/D,MAAMC,iBAAiB,GAAIC,KAA2B,IAAK;EACvD,MAAM,CAACC,GAAG,CAAC,GAAGd,QAAQ,CAACe,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CAAC;EACrD,MAAMC,aAAa,GAAGf,MAAM,CAAgB,EAAE,CAAC;EAC/C,MAAMgB,UAAU,GAAGf,OAAO,CAAC,MAAM;IAC7B,IAAI,CAACU,KAAK,EAAE;MACR,OAAO,EAAE;IACb;IAEA,MAAMM,aAAa,GAAGd,uBAAuB,CAACe,GAAG,CAACN,GAAG,EAAE,CAACD,KAAK,CAAC,CAAC,IAAI,EAAE;IAErE,IAAIP,KAAK,CAACW,aAAa,CAACI,OAAO,EAAEF,aAAa,CAAC,EAAE;MAC7C,OAAOF,aAAa,CAACI,OAAO;IAChC;IAEAJ,aAAa,CAACI,OAAO,GAAGF,aAAa;IAErC,OAAOA,aAAa;EACxB,CAAC,EAAE,CAACN,KAAK,CAAC,CAAC;EAEXd,SAAS,CAAC,MAAM,MAAM;IAClB;IACA,IAAIc,KAAK,EAAE;MACPR,uBAAuB,CAACe,GAAG,CAAC,IAAI,EAAE,CAACP,KAAK,CAAC,CAAC;I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AAG;QACrBA,KAAK,EAAE;UACH+B,KAAK,EAAE,IAAI;UACX,WAAW,EAAEjB,eAAe,CAACkB,IAAI,CAAC,GAAG;QACzC;MACJ,CAAC,GAAG,CAAC,CAAC;MACN,IAAGnB,aAAa,CAACG,qBAAqB,GAAG;QACrChB,KAAK,EAAE;UACH+B,KAAK,EAAE,IAAI;UACX,WAAW,EAAEhB,+BAA+B,CAACiB,IAAI,CAAC,GAAG;QACzD;MACJ,CAAC,GAAG,CAAC,CAAC;IACV,CAAQ;IAER,MAAMC,eAAe,GAAGvB,SAA0B;IAElD,oBAAOZ,IAAA,CAACmC,eAAe;MAAA,GAAKH,aAAa;MAAE7B,GAAG,EAAEA;IAAI,CAAE,CAAC;EAC3D,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","forwardRef","deepMergeObjects","getClassName","maybeWarnAboutMultipleUnistyles","useProxifiedUnistyles","jsx","_jsx","withUnistyles","Component","mappings","props","ref","narrowedProps","styleClassNames","style","contentContainerStyleClassNames","contentContainerStyle","proxifiedRuntime","proxifiedTheme","mappingsProps","unistyleProps","uniProps","combinedProps","displayName","name","NativeComponent"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAwBC,UAAU,QAAgD,OAAO;AAErG,SAASC,gBAAgB,QAAQ,aAAa;AAG9C,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,+BAA+B,QAAQ,SAAS;AACzD,SAASC,qBAAqB,QAAQ,0BAA0B;;AAEhE;;AAEA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGA,OAAO,MAAMC,aAAa,GAAGA,CAAkEC,SAAqB,EAAEC,QAA8B,KAAK;EAUrJ,oBAAOT,UAAU,CAAsD,CAACU,KAAK,EAAEC,GAAG,KAAK;IACnF,MAAMC,aAAa,GAAGF,KAA4C;IAClE,MAAMG,eAAe,GAAGX,YAAY,CAACU,aAAa,CAACE,KAAK,CAAC;IACzD,MAAMC,+BAA+B,GAAGb,YAAY,CAACU,aAAa,CAACI,qBAAqB,CAAC;IACzF,MAAM;MAAEC,gBAAgB;MAAEC;IAAe,CAAC,GAAGd,qBAAqB,CAAC,CAAC;IAEpE,MAAMe,aAAa,GAAGV,QAAQ,GAAGA,QAAQ,CAACS,cAAc,EAAED,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAChF,MAAMG,aAAa,GAAGR,aAAa,CAACS,QAAQ,GAAGT,aAAa,CAACS,QAAQ,CAACH,cAAc,EAAED,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAE5G,MAAMK,aAAa,GAAG;MAClB,GAAGrB,gBAAgB,CAACkB,aAAa,EAAEC,aAAa,EAAEV,KAAK,CAAC;MACxD,IAAGE,aAAa,CAACE,KAAK,GAAG;QACrBA,KAAK,EAAED;MACX,CAAC,GAAG,CAAC,CAAC;MACN,IAAGD,aAAa,CAACI,qBAAqB,GAAG;QACrCF,KAAK,EAAEC;MACX,CAAC,GAAG,CAAC,CAAC;IACV,CAAQ;;IAER;IACAZ,+BAA+B,CAACS,aAAa,CAACE,KAAK,EAAE,iBAAiBN,SAAS,CAACe,WAAW,IAAIf,SAAS,CAACgB,IAAI,IAAI,SAAS,GAAG,CAAC;IAC9H;IACArB,+BAA+B,CAACS,aAAa,CAACI,qBAAqB,EAAE,iBAAiBR,SAAS,CAACe,WAAW,IAAIf,SAAS,CAACgB,IAAI,IAAI,SAAS,GAAG,CAAC;IAE9I,MAAMC,eAAe,GAAGjB,SAA0B;IAElD,oBAAOF,IAAA,CAACmB,eAAe;MAAA,GAAKH,aAAa;MAAEX,GAAG,EAAEA;IAAI,CAAE,CAAC;EAC3D,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,86 +1,53 @@
1
1
  "use strict";
2
2
 
3
- import React, { forwardRef, useEffect, useRef } from 'react';
4
- import { StyleSheet, UnistyleDependency } from '../../specs';
3
+ import React, { forwardRef, useEffect } from 'react';
5
4
  import { deepMergeObjects } from '../../utils';
6
- import { SUPPORTED_STYLE_PROPS } from './types';
7
- import { useDependencies } from './useDependencies';
5
+ import { maybeWarnAboutMultipleUnistyles } from '../warn';
6
+ import { useProxifiedUnistyles } from '../useProxifiedUnistyles';
8
7
 
9
8
  // @ts-expect-error
10
9
 
11
10
  // @ts-expect-error
12
11
  import { jsx as _jsx } from "react/jsx-runtime";
13
12
  export const withUnistyles = (Component, mappings) => {
13
+ const getSecrets = (styleProps = {}) => {
14
+ const unistyleKey = Object.keys(styleProps).find(key => key.startsWith('unistyles-'));
15
+ return unistyleKey ? styleProps[unistyleKey] : {
16
+ uni__getStyles: () => styleProps,
17
+ uni__dependencies: []
18
+ };
19
+ };
14
20
  return /*#__PURE__*/forwardRef((props, ref) => {
15
21
  const narrowedProps = props;
16
- const stylesRef = useRef({});
17
- const isForcedRef = useRef(false);
18
22
  const NativeComponent = Component;
19
- if (!isForcedRef.current) {
20
- SUPPORTED_STYLE_PROPS.forEach(propName => {
21
- if (narrowedProps?.[propName]) {
22
- if (Array.isArray(narrowedProps[propName])) {
23
- console.error(`🦄 Unistyles: withUnistyles requires ${propName} to be an object. Please check props for component: ${NativeComponent.displayName}`);
24
- }
25
23
 
26
- // @ts-expect-error - this is hidden from TS
27
- if (props[propName].__unistyles_name && !props[propName].__proto__?.getStyle) {
28
- console.error(`🦄 Unistyles: withUnistyles received style that is not bound. You likely used the spread operator on a Unistyle style. Please check props for component: ${NativeComponent.displayName}`);
29
- }
30
- stylesRef.current = {
31
- ...stylesRef.current,
32
- // @ts-expect-error - this is hidden from TS
33
- [propName]: props[propName].__proto__?.getStyle?.() || props[propName]
34
- };
35
- }
36
- });
37
- }
24
+ // @ts-ignore we don't know the type of the component
25
+ maybeWarnAboutMultipleUnistyles(narrowedProps.style, `withUnistyles(${Component.displayName ?? Component.name ?? 'Unknown'})`);
26
+ // @ts-ignore we don't know the type of the component
27
+ maybeWarnAboutMultipleUnistyles(narrowedProps.contentContainerStyle, `withUnistyles(${Component.displayName ?? Component.name ?? 'Unknown'})`);
38
28
  const {
39
- mappingsCallback,
29
+ proxifiedRuntime,
30
+ proxifiedTheme,
40
31
  addDependencies
41
- } = useDependencies(({
42
- dependencies,
43
- updateTheme,
44
- updateRuntime
45
- }) => {
46
- const listensToTheme = dependencies.includes(UnistyleDependency.Theme);
47
- // @ts-expect-error - this is hidden from TS
48
- const dispose = StyleSheet.addChangeListener(changedDependencies => {
49
- if (listensToTheme && changedDependencies.includes(UnistyleDependency.Theme)) {
50
- updateTheme();
51
- }
52
- if (changedDependencies.some(dependency => dependencies.includes(dependency))) {
53
- SUPPORTED_STYLE_PROPS.forEach(propName => {
54
- if (narrowedProps?.[propName]) {
55
- stylesRef.current = {
56
- ...stylesRef.current,
57
- // @ts-expect-error - this is hidden from TS
58
- [propName]: props[propName].__proto__?.getStyle?.() || props[propName]
59
- };
60
- isForcedRef.current = true;
61
- }
62
- });
63
- updateRuntime();
64
- }
65
- });
66
- return () => dispose();
67
- });
32
+ } = useProxifiedUnistyles();
68
33
  useEffect(() => {
69
- const styleDependencies = narrowedProps.style?.__proto__.uni__dependencies ?? [];
70
- const contentContainerStyleDependencies = narrowedProps.contentContainerStyle?.__proto__.uni__dependencies ?? [];
71
- addDependencies([...styleDependencies, ...contentContainerStyleDependencies]);
34
+ const styleSecrets = getSecrets(narrowedProps.style);
35
+ const contentContainerStyleSecrets = getSecrets(narrowedProps.contentContainerStyle);
36
+ addDependencies(Array.from(new Set([...styleSecrets.uni__dependencies, ...contentContainerStyleSecrets.uni__dependencies])));
72
37
  }, [narrowedProps.style, narrowedProps.contentContainerStyle]);
73
- const mappingProps = mappings ? mappingsCallback(mappings) : {};
74
- const unistyleProps = narrowedProps.uniProps ? mappingsCallback(narrowedProps.uniProps) : {};
75
- const finalProps = deepMergeObjects(mappingProps, unistyleProps, props);
76
-
77
- // override with Unistyles styles
78
- SUPPORTED_STYLE_PROPS.forEach(propName => {
79
- if (finalProps[propName]) {
80
- finalProps[propName] = stylesRef.current[propName];
81
- }
82
- });
83
- isForcedRef.current = false;
38
+ const mappingsProps = mappings ? mappings(proxifiedTheme, proxifiedRuntime) : {};
39
+ const unistyleProps = narrowedProps.uniProps ? narrowedProps.uniProps(proxifiedTheme, proxifiedRuntime) : {};
40
+ const styleSecrets = getSecrets(narrowedProps.style);
41
+ const contentContainerStyleSecrets = getSecrets(narrowedProps.contentContainerStyle);
42
+ const finalProps = {
43
+ ...deepMergeObjects(mappingsProps, unistyleProps, props),
44
+ ...(narrowedProps.style ? {
45
+ style: styleSecrets.uni__getStyles()
46
+ } : {}),
47
+ ...(narrowedProps.contentContainerStyle ? {
48
+ contentContainerStyle: contentContainerStyleSecrets.uni__getStyles()
49
+ } : {})
50
+ };
84
51
  return /*#__PURE__*/_jsx(NativeComponent, {
85
52
  ...finalProps,
86
53
  ref: ref
@@ -1 +1 @@
1
- {"version":3,"names":["React","forwardRef","useEffect","useRef","StyleSheet","UnistyleDependency","deepMergeObjects","SUPPORTED_STYLE_PROPS","useDependencies","jsx","_jsx","withUnistyles","Component","mappings","props","ref","narrowedProps","stylesRef","isForcedRef","NativeComponent","current","forEach","propName","Array","isArray","console","error","displayName","__unistyles_name","__proto__","getStyle","mappingsCallback","addDependencies","dependencies","updateTheme","updateRuntime","listensToTheme","includes","Theme","dispose","addChangeListener","changedDependencies","some","dependency","styleDependencies","style","uni__dependencies","contentContainerStyleDependencies","contentContainerStyle","mappingProps","unistyleProps","uniProps","finalProps"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAA4B,OAAO;AAChF,SAASC,UAAU,EAAEC,kBAAkB,QAAQ,aAAa;AAE5D,SAASC,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,qBAAqB,QAAQ,SAAS;AAE/C,SAASC,eAAe,QAAQ,mBAAmB;;AAEnD;;AAEA;AAAA,SAAAC,GAAA,IAAAC,IAAA;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AAgB,CAAClB,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC/D,MAAMqC,aAAa,GAAGlC,aAAa,CAACmC,QAAQ,GAAGpB,gBAAgB,CAACf,aAAa,CAACmC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC5F,MAAMC,UAAU,GAAG9C,gBAAgB,CAAsB2C,YAAY,EAAEC,aAAa,EAAEpC,KAAK,CAAC;;IAE5F;IACAP,qBAAqB,CAACc,OAAO,CAACC,QAAQ,IAAI;MACtC,IAAI8B,UAAU,CAAC9B,QAAQ,CAAC,EAAE;QACtB8B,UAAU,CAAC9B,QAAQ,CAAC,GAAGL,SAAS,CAACG,OAAO,CAACE,QAAQ,CAAC;MACtD;IACJ,CAAC,CAAC;IAEFJ,WAAW,CAACE,OAAO,GAAG,KAAK;IAE3B,oBAAOV,IAAA,CAACS,eAAe;MAAA,GAAKiC,UAAU;MAAYrC,GAAG,EAAEA;IAAI,CAAE,CAAC;EAClE,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","forwardRef","useEffect","deepMergeObjects","maybeWarnAboutMultipleUnistyles","useProxifiedUnistyles","jsx","_jsx","withUnistyles","Component","mappings","getSecrets","styleProps","unistyleKey","Object","keys","find","key","startsWith","uni__getStyles","uni__dependencies","props","ref","narrowedProps","NativeComponent","style","displayName","name","contentContainerStyle","proxifiedRuntime","proxifiedTheme","addDependencies","styleSecrets","contentContainerStyleSecrets","Array","from","Set","mappingsProps","unistyleProps","uniProps","finalProps"],"sourceRoot":"../../../../src","sources":["core/withUnistyles/withUnistyles.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,QAA4B,OAAO;AAGxE,SAASC,gBAAgB,QAAQ,aAAa;AAE9C,SAASC,+BAA+B,QAAQ,SAAS;AACzD,SAASC,qBAAqB,QAAQ,0BAA0B;;AAEhE;;AAEA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGA,OAAO,MAAMC,aAAa,G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AACE,KAAK,EAAEF,aAAa,CAACK,qBAAqB,CAAC,CAAC;IAE9D,MAAMS,aAAa,GAAG3B,QAAQ,GAAGA,QAAQ,CAACoB,cAAc,EAAED,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAChF,MAAMS,aAAa,GAAGf,aAAa,CAACgB,QAAQ,GAAGhB,aAAa,CAACgB,QAAQ,CAACT,cAAc,EAAED,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAE5G,MAAMG,YAAY,GAAGrB,UAAU,CAACY,aAAa,CAACE,KAAK,CAAC;IACpD,MAAMQ,4BAA4B,GAAGtB,UAAU,CAACY,aAAa,CAACK,qBAAqB,CAAC;IAEpF,MAAMY,UAAU,GAAG;MACf,GAAGrC,gBAAgB,CAACkC,aAAa,EAAEC,aAAa,EAAEjB,KAAK,CAAC;MACxD,IAAGE,aAAa,CAACE,KAAK,GAAG;QACrBA,KAAK,EAAEO,YAAY,CAACb,cAAc,CAAC;MACvC,CAAC,GAAG,CAAC,CAAC;MACN,IAAGI,aAAa,CAACK,qBAAqB,GAAG;QACrCA,qBAAqB,EAAEK,4BAA4B,CAACd,cAAc,CAAC;MACvE,CAAC,GAAG,CAAC,CAAC;IACV,CAAQ;IAER,oBAAOZ,IAAA,CAACiB,eAAe;MAAA,GAAKgB,UAAU;MAAYlB,GAAG,EAAEA;IAAI,CAAE,CAAC;EAClE,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -2,6 +2,7 @@
2
2
 
3
3
  export { StyleSheet, UnistylesRuntime, StatusBar, NavigationBar } from './specs';
4
4
  export { mq } from './mq';
5
- export { createUnistylesComponent, withUnistyles } from './core';
6
- export { Display, Hide, Variants, ScopedTheme } from './components';
5
+ export { withUnistyles, useUnistyles } from './core';
6
+ export { Display, Hide, ScopedTheme } from './components';
7
+ export { useServerUnistyles, hydrateServerUnistyles, getServerUnistyles, resetServerUnistyles } from './server';
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["StyleSheet","UnistylesRuntime","StatusBar","NavigationBar","mq","createUnistylesComponent","withUnistyles","Display","Hide","Variants","ScopedTheme"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,gBAAgB,EAAEC,SAAS,EAAEC,aAAa,QAAQ,SAAS;AAChF,SAASC,EAAE,QAAQ,MAAM;AAEzB,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,QAAQ;AAEhE,SAASC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["StyleSheet","UnistylesRuntime","StatusBar","NavigationBar","mq","withUnistyles","useUnistyles","Display","Hide","ScopedTheme","useServerUnistyles","hydrateServerUnistyles","getServerUnistyles","resetServerUnistyles"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,gBAAgB,EAAEC,SAAS,EAAEC,aAAa,QAAQ,SAAS;AAChF,SAASC,EAAE,QAAQ,MAAM;AAEzB,SAASC,aAAa,EAAEC,YAAY,QAAQ,QAAQ;AAEpD,SAASC,OAAO,EAAEC,IAAI,EAAEC,WAAW,QAAQ,cAAc;AACzD,SAASC,kBAAkB,EAAEC,sBAAsB,EAAEC,kBAAkB,EAAEC,oBAAoB,QAAQ,UAAU","ignoreList":[]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ import React from 'react';
4
+ import { StyleSheet } from 'react-native';
5
+ import { error, isServer } from '../web/utils';
6
+ import { UnistylesWeb } from '../web';
7
+ import { DefaultServerUnistylesSettings } from './types';
8
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
9
+ export const getServerUnistyles = ({
10
+ includeRNWStyles = true
11
+ } = DefaultServerUnistylesSettings) => {
12
+ if (!isServer()) {
13
+ throw error('Server styles should only be read on the server');
14
+ }
15
+ // @ts-ignore
16
+ const rnwStyle = includeRNWStyles ? StyleSheet?.getSheet().textContent ?? '' : null;
17
+ const css = UnistylesWeb.registry.css.getStyles();
18
+ const state = UnistylesWeb.registry.css.getState();
19
+ return /*#__PURE__*/_jsxs(_Fragment, {
20
+ children: [rnwStyle && /*#__PURE__*/_jsx("style", {
21
+ id: "rnw-style",
22
+ children: rnwStyle
23
+ }), /*#__PURE__*/_jsx("style", {
24
+ id: "unistyles-web",
25
+ children: css
26
+ }), /*#__PURE__*/_jsx("script", {
27
+ id: "unistyles-script",
28
+ children: `window.__UNISTYLES_STATE__ = ${JSON.stringify(state)}`
29
+ })]
30
+ });
31
+ };
32
+ //# sourceMappingURL=getServerUnistyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","StyleSheet","error","isServer","UnistylesWeb","DefaultServerUnistylesSettings","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","getServerUnistyles","includeRNWStyles","rnwStyle","getSheet","textContent","css","registry","getStyles","state","getState","children","id","JSON","stringify"],"sourceRoot":"../../../src","sources":["server/getServerUnistyles.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,KAAK,EAAEC,QAAQ,QAAQ,cAAc;AAC9C,SAASC,YAAY,QAAQ,QAAQ;AACrC,SAASC,8BAA8B,QAAsC,SAAS;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtF,OAAO,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,gBAAgB,GAAG;AAA8B,CAAC,GAAGR,8BAA8B,KAAK;EACzH,IAAI,CAACF,QAAQ,CAAC,CAAC,EAAE;IACb,MAAMD,KAAK,CAAC,iDAAiD,CAAC;EAClE;EACA;EACA,MAAMY,QAAuB,GAAGD,gBAAgB,GAAIZ,UAAU,EAAEc,QAAQ,CAAC,CAAC,CAACC,WAAW,IAAI,EAAE,GAAI,IAAI;EACpG,MAAMC,GAAG,GAAGb,YAAY,CAACc,QAAQ,CAACD,GAAG,CAACE,SAAS,CAAC,CAAC;EACjD,MAAMC,KAAK,GAAGhB,YAAY,CAACc,QAAQ,CAACD,GAAG,CAACI,QAAQ,CAAC,CAAC;EAClD,oBAAOV,KAAA,CAAAF,SAAA;IAAAa,QAAA,GACFR,QAAQ,iBAAIP,IAAA;MAAOgB,EAAE,EAAC,WAAW;MAAAD,QAAA,EAAER;IAAQ,CAAQ,CAAC,eACrDP,IAAA;MAAOgB,EAAE,EAAC,eAAe;MAAAD,QAAA,EAAEL;IAAG,CAAQ,CAAC,eACvCV,IAAA;MAAQgB,EAAE,EAAC,kBAAkB;MAAAD,QAAA,EAAE,gCAAgCE,IAAI,CAACC,SAAS,CAACL,KAAK,CAAC;IAAE,CAAS,CAAC;EAAA,CAClG,CAAC;AACP,CAAC","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ import { error, isServer } from '../web/utils';
4
+ import { UnistylesWeb } from '../web';
5
+ export const hydrateServerUnistyles = () => {
6
+ if (isServer()) {
7
+ throw error('Server styles should only be hydrated on the client');
8
+ }
9
+ UnistylesWeb.registry.css.hydrate(window.__UNISTYLES_STATE__);
10
+ document.querySelector('#unistyles-script')?.remove();
11
+ };
12
+ //# sourceMappingURL=hydrateServerUnistyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["error","isServer","UnistylesWeb","hydrateServerUnistyles","registry","css","hydrate","window","__UNISTYLES_STATE__","document","querySelector","remove"],"sourceRoot":"../../../src","sources":["server/hydrateServerUnistyles.ts"],"mappings":";;AAAA,SAASA,KAAK,EAAEC,QAAQ,QAAQ,cAAc;AAC9C,SAASC,YAAY,QAAQ,QAAQ;AASrC,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EACxC,IAAIF,QAAQ,CAAC,CAAC,EAAE;IACZ,MAAMD,KAAK,CAAC,qDAAqD,CAAC;EACtE;EACAE,YAAY,CAACE,QAAQ,CAACC,GAAG,CAACC,OAAO,CAACC,MAAM,CAACC,mBAAmB,CAAC;EAC7DC,QAAQ,CAACC,aAAa,CAAC,mBAAmB,CAAC,EAAEC,MAAM,CAAC,CAAC;AACzD,CAAC","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ export { useServerUnistyles } from './useServerUnistyles';
4
+ export { getServerUnistyles } from './getServerUnistyles';
5
+ export { resetServerUnistyles } from './resetServerUnistyles';
6
+ export { hydrateServerUnistyles } from './hydrateServerUnistyles';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useServerUnistyles","getServerUnistyles","resetServerUnistyles","hydrateServerUnistyles"],"sourceRoot":"../../../src","sources":["server/index.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,sBAAsB,QAAQ,0BAA0B","ignoreList":[]}