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

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 (340) hide show
  1. package/README.md +17 -2
  2. package/android/CMakeLists.txt +1 -1
  3. package/android/src/main/cxx/NativeUnistylesModule.cpp +1 -1
  4. package/android/src/main/java/com/unistyles/NativePlatform+android.kt +5 -2
  5. package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +24 -1
  6. package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +6 -1
  7. package/android/src/main/java/com/unistyles/UnistylesModule.kt +5 -4
  8. package/android/src/main/java/com/unistyles/UnistylesPackage.kt +6 -6
  9. package/components/native/Animated/package.json +5 -0
  10. package/components/native/NativeText/package.json +5 -0
  11. package/components/native/NativeView/package.json +5 -0
  12. package/cxx/core/HashGenerator.cpp +1 -1
  13. package/cxx/core/HostUnistyle.cpp +28 -4
  14. package/cxx/core/HostUnistyle.h +1 -0
  15. package/cxx/core/Unistyle.h +4 -0
  16. package/cxx/core/UnistyleWrapper.h +6 -6
  17. package/cxx/core/UnistylesRegistry.cpp +24 -3
  18. package/cxx/core/UnistylesRegistry.h +3 -0
  19. package/cxx/hybridObjects/HybridShadowRegistry.cpp +7 -0
  20. package/cxx/hybridObjects/HybridStyleSheet.cpp +27 -2
  21. package/cxx/parser/Parser.cpp +13 -7
  22. package/ios/NativePlatform+ios.swift +16 -4
  23. package/ios/UnistylesModuleOnLoad.h +4 -4
  24. package/ios/UnistylesModuleOnLoad.mm +4 -8
  25. package/lib/commonjs/components/native/Animated.js +23 -0
  26. package/lib/commonjs/components/native/Animated.js.map +1 -0
  27. package/lib/commonjs/components/native/ImageBackground.js +6 -4
  28. package/lib/commonjs/components/native/ImageBackground.js.map +1 -1
  29. package/lib/commonjs/components/native/NativeText.js +13 -0
  30. package/lib/commonjs/components/native/NativeText.js.map +1 -0
  31. package/lib/commonjs/components/native/NativeText.native.js +18 -0
  32. package/lib/commonjs/components/native/NativeText.native.js.map +1 -0
  33. package/lib/commonjs/components/native/NativeView.js +9 -0
  34. package/lib/commonjs/components/native/NativeView.js.map +1 -0
  35. package/lib/commonjs/components/native/NativeView.native.js +20 -0
  36. package/lib/commonjs/components/native/NativeView.native.js.map +1 -0
  37. package/lib/commonjs/components/native/Pressable.js +1 -1
  38. package/lib/commonjs/components/native/Pressable.js.map +1 -1
  39. package/lib/commonjs/components/native/Pressable.native.js +18 -9
  40. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  41. package/lib/commonjs/core/createUnistylesElement.js +28 -24
  42. package/lib/commonjs/core/createUnistylesElement.js.map +1 -1
  43. package/lib/commonjs/core/createUnistylesElement.native.js +37 -23
  44. package/lib/commonjs/core/createUnistylesElement.native.js.map +1 -1
  45. package/lib/commonjs/core/createUnistylesImageBackground.js +34 -30
  46. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -1
  47. package/lib/commonjs/core/getClassname.js +1 -3
  48. package/lib/commonjs/core/getClassname.js.map +1 -1
  49. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js +2 -2
  50. package/lib/commonjs/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  51. package/lib/commonjs/core/warn.js +1 -1
  52. package/lib/commonjs/core/withUnistyles/withUnistyles.js +2 -2
  53. package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -1
  54. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +5 -3
  55. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  56. package/lib/commonjs/hooks/useMedia.native.js +1 -1
  57. package/lib/commonjs/hooks/useMedia.native.js.map +1 -1
  58. package/lib/commonjs/mq.js.map +1 -1
  59. package/lib/commonjs/server/getServerUnistyles.js +4 -2
  60. package/lib/commonjs/server/getServerUnistyles.js.map +1 -1
  61. package/lib/commonjs/server/hydrateServerUnistyles.js +1 -1
  62. package/lib/commonjs/server/hydrateServerUnistyles.js.map +1 -1
  63. package/lib/commonjs/server/resetServerUnistyles.js +1 -1
  64. package/lib/commonjs/server/resetServerUnistyles.js.map +1 -1
  65. package/lib/commonjs/server/useServerUnistyles.js +2 -2
  66. package/lib/commonjs/server/useServerUnistyles.js.map +1 -1
  67. package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
  68. package/lib/commonjs/specs/StyleSheet/index.js +1 -1
  69. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  70. package/lib/commonjs/specs/UnistylesRuntime/index.js +1 -1
  71. package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
  72. package/lib/commonjs/specs/index.native.js +3 -3
  73. package/lib/commonjs/specs/index.native.js.map +1 -1
  74. package/lib/commonjs/utils.js +16 -1
  75. package/lib/commonjs/utils.js.map +1 -1
  76. package/lib/commonjs/web/convert/index.js +4 -4
  77. package/lib/commonjs/web/convert/index.js.map +1 -1
  78. package/lib/commonjs/web/convert/object/boxShadow.js +4 -4
  79. package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -1
  80. package/lib/commonjs/web/convert/object/filter.js +3 -3
  81. package/lib/commonjs/web/convert/object/filter.js.map +1 -1
  82. package/lib/commonjs/web/convert/object/transform.js +1 -1
  83. package/lib/commonjs/web/convert/object/transform.js.map +1 -1
  84. package/lib/commonjs/web/convert/utils.js.map +1 -1
  85. package/lib/commonjs/web/index.js +1 -1
  86. package/lib/commonjs/web/index.js.map +1 -1
  87. package/lib/commonjs/web/registry.js +1 -1
  88. package/lib/commonjs/web/registry.js.map +1 -1
  89. package/lib/commonjs/web/runtime.js.map +1 -1
  90. package/lib/commonjs/web/shadowRegistry.js +1 -1
  91. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  92. package/lib/commonjs/web/state.js +1 -1
  93. package/lib/commonjs/web/state.js.map +1 -1
  94. package/lib/commonjs/web/utils/common.js +1 -1
  95. package/lib/commonjs/web/utils/unistyle.js +10 -6
  96. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  97. package/lib/module/components/native/Animated.js +19 -0
  98. package/lib/module/components/native/Animated.js.map +1 -0
  99. package/lib/module/components/native/ImageBackground.js +5 -3
  100. package/lib/module/components/native/ImageBackground.js.map +1 -1
  101. package/lib/module/components/native/NativeText.js +4 -0
  102. package/lib/module/components/native/NativeText.js.map +1 -0
  103. package/lib/module/components/native/NativeText.native.js +15 -0
  104. package/lib/module/components/native/NativeText.native.js.map +1 -0
  105. package/lib/module/components/native/NativeView.js +5 -0
  106. package/lib/module/components/native/NativeView.js.map +1 -0
  107. package/lib/module/components/native/NativeView.native.js +17 -0
  108. package/lib/module/components/native/NativeView.native.js.map +1 -0
  109. package/lib/module/components/native/Pressable.js +1 -1
  110. package/lib/module/components/native/Pressable.js.map +1 -1
  111. package/lib/module/components/native/Pressable.native.js +19 -10
  112. package/lib/module/components/native/Pressable.native.js.map +1 -1
  113. package/lib/module/core/createUnistylesElement.js +28 -24
  114. package/lib/module/core/createUnistylesElement.js.map +1 -1
  115. package/lib/module/core/createUnistylesElement.native.js +38 -24
  116. package/lib/module/core/createUnistylesElement.native.js.map +1 -1
  117. package/lib/module/core/createUnistylesImageBackground.js +35 -31
  118. package/lib/module/core/createUnistylesImageBackground.js.map +1 -1
  119. package/lib/module/core/getClassname.js +2 -4
  120. package/lib/module/core/getClassname.js.map +1 -1
  121. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js +2 -2
  122. package/lib/module/core/useProxifiedUnistyles/useProxifiedUnistyles.js.map +1 -1
  123. package/lib/module/core/warn.js +1 -1
  124. package/lib/module/core/withUnistyles/withUnistyles.js +2 -2
  125. package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -1
  126. package/lib/module/core/withUnistyles/withUnistyles.native.js +6 -4
  127. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  128. package/lib/module/hooks/useMedia.native.js +1 -1
  129. package/lib/module/hooks/useMedia.native.js.map +1 -1
  130. package/lib/module/mq.js.map +1 -1
  131. package/lib/module/server/getServerUnistyles.js +4 -2
  132. package/lib/module/server/getServerUnistyles.js.map +1 -1
  133. package/lib/module/server/hydrateServerUnistyles.js +1 -1
  134. package/lib/module/server/hydrateServerUnistyles.js.map +1 -1
  135. package/lib/module/server/resetServerUnistyles.js +1 -1
  136. package/lib/module/server/resetServerUnistyles.js.map +1 -1
  137. package/lib/module/server/useServerUnistyles.js +2 -2
  138. package/lib/module/server/useServerUnistyles.js.map +1 -1
  139. package/lib/module/specs/StatusBar/index.js.map +1 -1
  140. package/lib/module/specs/StyleSheet/index.js +1 -1
  141. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  142. package/lib/module/specs/UnistylesRuntime/index.js +1 -1
  143. package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
  144. package/lib/module/specs/index.native.js +4 -4
  145. package/lib/module/specs/index.native.js.map +1 -1
  146. package/lib/module/utils.js +14 -0
  147. package/lib/module/utils.js.map +1 -1
  148. package/lib/module/web/convert/index.js +5 -5
  149. package/lib/module/web/convert/index.js.map +1 -1
  150. package/lib/module/web/convert/object/boxShadow.js +2 -2
  151. package/lib/module/web/convert/object/boxShadow.js.map +1 -1
  152. package/lib/module/web/convert/object/filter.js +3 -3
  153. package/lib/module/web/convert/object/filter.js.map +1 -1
  154. package/lib/module/web/convert/object/transform.js +1 -1
  155. package/lib/module/web/convert/object/transform.js.map +1 -1
  156. package/lib/module/web/convert/utils.js.map +1 -1
  157. package/lib/module/web/index.js +1 -1
  158. package/lib/module/web/index.js.map +1 -1
  159. package/lib/module/web/registry.js +1 -1
  160. package/lib/module/web/registry.js.map +1 -1
  161. package/lib/module/web/runtime.js.map +1 -1
  162. package/lib/module/web/shadowRegistry.js +1 -1
  163. package/lib/module/web/shadowRegistry.js.map +1 -1
  164. package/lib/module/web/state.js +1 -1
  165. package/lib/module/web/state.js.map +1 -1
  166. package/lib/module/web/utils/common.js +1 -1
  167. package/lib/module/web/utils/unistyle.js +10 -6
  168. package/lib/module/web/utils/unistyle.js.map +1 -1
  169. package/lib/typescript/src/components/native/ActivityIndicator.d.ts +1 -3
  170. package/lib/typescript/src/components/native/ActivityIndicator.d.ts.map +1 -1
  171. package/lib/typescript/src/components/native/Animated.d.ts +39 -0
  172. package/lib/typescript/src/components/native/Animated.d.ts.map +1 -0
  173. package/lib/typescript/src/components/native/FlatList.d.ts +1 -3
  174. package/lib/typescript/src/components/native/FlatList.d.ts.map +1 -1
  175. package/lib/typescript/src/components/native/Image.d.ts +1 -3
  176. package/lib/typescript/src/components/native/Image.d.ts.map +1 -1
  177. package/lib/typescript/src/components/native/ImageBackground.d.ts +1 -8
  178. package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -1
  179. package/lib/typescript/src/components/native/ImageBackground.native.d.ts +1 -2
  180. package/lib/typescript/src/components/native/ImageBackground.native.d.ts.map +1 -1
  181. package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts +1 -3
  182. package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts.map +1 -1
  183. package/lib/typescript/src/components/native/NativeText.d.ts +2 -0
  184. package/lib/typescript/src/components/native/NativeText.d.ts.map +1 -0
  185. package/lib/typescript/src/components/native/NativeText.native.d.ts +2 -0
  186. package/lib/typescript/src/components/native/NativeText.native.d.ts.map +1 -0
  187. package/lib/typescript/src/components/native/NativeView.d.ts +3 -0
  188. package/lib/typescript/src/components/native/NativeView.d.ts.map +1 -0
  189. package/lib/typescript/src/components/native/NativeView.native.d.ts +3 -0
  190. package/lib/typescript/src/components/native/NativeView.native.d.ts.map +1 -0
  191. package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -1
  192. package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
  193. package/lib/typescript/src/components/native/RefreshControl.d.ts +1 -3
  194. package/lib/typescript/src/components/native/RefreshControl.d.ts.map +1 -1
  195. package/lib/typescript/src/components/native/ScrollView.d.ts +1 -3
  196. package/lib/typescript/src/components/native/ScrollView.d.ts.map +1 -1
  197. package/lib/typescript/src/components/native/SectionList.d.ts +1 -3
  198. package/lib/typescript/src/components/native/SectionList.d.ts.map +1 -1
  199. package/lib/typescript/src/components/native/Switch.d.ts +1 -3
  200. package/lib/typescript/src/components/native/Switch.d.ts.map +1 -1
  201. package/lib/typescript/src/components/native/Text.d.ts +1 -3
  202. package/lib/typescript/src/components/native/Text.d.ts.map +1 -1
  203. package/lib/typescript/src/components/native/TextInput.d.ts +1 -3
  204. package/lib/typescript/src/components/native/TextInput.d.ts.map +1 -1
  205. package/lib/typescript/src/components/native/TouchableHighlight.d.ts +1 -3
  206. package/lib/typescript/src/components/native/TouchableHighlight.d.ts.map +1 -1
  207. package/lib/typescript/src/components/native/TouchableOpacity.d.ts +1 -3
  208. package/lib/typescript/src/components/native/TouchableOpacity.d.ts.map +1 -1
  209. package/lib/typescript/src/components/native/View.d.ts +1 -3
  210. package/lib/typescript/src/components/native/View.d.ts.map +1 -1
  211. package/lib/typescript/src/components/native/VirtualizedList.d.ts +1 -3
  212. package/lib/typescript/src/components/native/VirtualizedList.d.ts.map +1 -1
  213. package/lib/typescript/src/core/createUnistylesElement.d.ts +1 -7
  214. package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -1
  215. package/lib/typescript/src/core/createUnistylesElement.native.d.ts +1 -2
  216. package/lib/typescript/src/core/createUnistylesElement.native.d.ts.map +1 -1
  217. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts +2 -3
  218. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -1
  219. package/lib/typescript/src/core/getClassname.d.ts +2 -2
  220. package/lib/typescript/src/core/getClassname.d.ts.map +1 -1
  221. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts +2 -1
  222. package/lib/typescript/src/core/useProxifiedUnistyles/useProxifiedUnistyles.d.ts.map +1 -1
  223. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -1
  224. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  225. package/lib/typescript/src/mq.d.ts +1 -1
  226. package/lib/typescript/src/mq.d.ts.map +1 -1
  227. package/lib/typescript/src/server/getServerUnistyles.d.ts.map +1 -1
  228. package/lib/typescript/src/server/hydrateServerUnistyles.d.ts.map +1 -1
  229. package/lib/typescript/src/server/useServerUnistyles.d.ts.map +1 -1
  230. package/lib/typescript/src/specs/StatusBar/index.d.ts +1 -1
  231. package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
  232. package/lib/typescript/src/specs/StyleSheet/index.d.ts +2 -1
  233. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  234. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -1
  235. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
  236. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +5 -5
  237. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
  238. package/lib/typescript/src/specs/index.native.d.ts +4 -4
  239. package/lib/typescript/src/specs/index.native.d.ts.map +1 -1
  240. package/lib/typescript/src/types/breakpoints.d.ts +2 -2
  241. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  242. package/lib/typescript/src/types/core.d.ts +1 -1
  243. package/lib/typescript/src/types/core.d.ts.map +1 -1
  244. package/lib/typescript/src/types/stylesheet.d.ts +4 -4
  245. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  246. package/lib/typescript/src/utils.d.ts +1 -0
  247. package/lib/typescript/src/utils.d.ts.map +1 -1
  248. package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -1
  249. package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -1
  250. package/lib/typescript/src/web/convert/types.d.ts +1 -1
  251. package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
  252. package/lib/typescript/src/web/convert/utils.d.ts +2 -2
  253. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
  254. package/lib/typescript/src/web/create.d.ts +1 -1
  255. package/lib/typescript/src/web/create.d.ts.map +1 -1
  256. package/lib/typescript/src/web/index.d.ts +1 -1
  257. package/lib/typescript/src/web/index.d.ts.map +1 -1
  258. package/lib/typescript/src/web/registry.d.ts +1 -1
  259. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  260. package/lib/typescript/src/web/runtime.d.ts +1 -1
  261. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  262. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  263. package/lib/typescript/src/web/state.d.ts +1 -1
  264. package/lib/typescript/src/web/state.d.ts.map +1 -1
  265. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  266. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +1 -1
  267. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +23 -39
  268. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/unistylesOnLoad.kt +35 -0
  269. package/nitrogen/generated/ios/Unistyles+autolinking.rb +2 -0
  270. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +1 -1
  271. package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +3 -1
  272. package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +2 -3
  273. package/nitrogen/generated/ios/swift/HybridNativePlatformSpec_cxx.swift +18 -18
  274. package/nitrogen/generated/shared/c++/ColorScheme.hpp +1 -1
  275. package/nitrogen/generated/shared/c++/Dimensions.hpp +1 -1
  276. package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +1 -1
  277. package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +1 -1
  278. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +1 -1
  279. package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +1 -1
  280. package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +1 -1
  281. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
  282. package/nitrogen/generated/shared/c++/Insets.hpp +1 -1
  283. package/nitrogen/generated/shared/c++/Orientation.hpp +1 -1
  284. package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +1 -1
  285. package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +1 -1
  286. package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +1 -1
  287. package/package.json +16 -12
  288. package/plugin/consts.js +63 -0
  289. package/plugin/exotic.js +54 -0
  290. package/plugin/import.js +1 -1
  291. package/plugin/index.d.ts +84 -36
  292. package/plugin/index.js +48 -65
  293. package/plugin/stylesheet.js +454 -117
  294. package/plugin/variants.js +1 -1
  295. package/src/components/native/Animated.tsx +17 -0
  296. package/src/components/native/ImageBackground.tsx +7 -4
  297. package/src/components/native/NativeText.native.tsx +12 -0
  298. package/src/components/native/NativeText.tsx +1 -0
  299. package/src/components/native/NativeView.native.tsx +13 -0
  300. package/src/components/native/NativeView.tsx +3 -0
  301. package/src/components/native/Pressable.native.tsx +26 -13
  302. package/src/components/native/Pressable.tsx +1 -1
  303. package/src/core/createUnistylesElement.native.tsx +42 -27
  304. package/src/core/createUnistylesElement.tsx +36 -31
  305. package/src/core/createUnistylesImageBackground.tsx +39 -34
  306. package/src/core/getClassname.ts +5 -4
  307. package/src/core/useProxifiedUnistyles/useProxifiedUnistyles.ts +3 -3
  308. package/src/core/warn.ts +1 -1
  309. package/src/core/withUnistyles/withUnistyles.native.tsx +8 -6
  310. package/src/core/withUnistyles/withUnistyles.tsx +4 -4
  311. package/src/hooks/useMedia.native.ts +1 -1
  312. package/src/mq.ts +1 -1
  313. package/src/server/getServerUnistyles.tsx +3 -2
  314. package/src/server/hydrateServerUnistyles.ts +1 -1
  315. package/src/server/resetServerUnistyles.ts +1 -1
  316. package/src/server/useServerUnistyles.tsx +2 -2
  317. package/src/specs/StatusBar/index.ts +1 -1
  318. package/src/specs/StyleSheet/index.ts +5 -4
  319. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
  320. package/src/specs/UnistylesRuntime/index.ts +5 -5
  321. package/src/specs/index.native.ts +4 -4
  322. package/src/types/breakpoints.ts +2 -2
  323. package/src/types/core.ts +1 -1
  324. package/src/types/stylesheet.ts +4 -4
  325. package/src/utils.ts +17 -0
  326. package/src/web/convert/index.ts +5 -5
  327. package/src/web/convert/object/boxShadow.ts +2 -2
  328. package/src/web/convert/object/filter.ts +3 -3
  329. package/src/web/convert/object/transform.ts +2 -2
  330. package/src/web/convert/types.ts +1 -1
  331. package/src/web/convert/utils.ts +2 -2
  332. package/src/web/create.ts +1 -1
  333. package/src/web/index.ts +3 -3
  334. package/src/web/registry.ts +2 -2
  335. package/src/web/runtime.ts +2 -2
  336. package/src/web/shadowRegistry.ts +2 -2
  337. package/src/web/state.ts +4 -4
  338. package/src/web/utils/common.ts +1 -1
  339. package/src/web/utils/unistyle.ts +13 -7
  340. package/plugin/common.js +0 -142
@@ -1,12 +1,12 @@
1
1
  import './TurboUnistyles'
2
2
 
3
- import { Runtime } from './UnistylesRuntime'
3
+ import { UnistyleDependency } from './NativePlatform'
4
+ import { UnistylesShadowRegistry } from './ShadowRegistry'
4
5
  import { StyleSheet } from './StyleSheet'
5
6
  import type { UnistylesStyleSheet } from './StyleSheet'
6
- import { UnistylesShadowRegistry } from './ShadowRegistry'
7
+ import { Runtime } from './UnistylesRuntime'
7
8
  import type { UnistylesMiniRuntime } from './UnistylesRuntime'
8
- import { StatusBarStyle, ColorScheme, Orientation } from './types'
9
- import { UnistyleDependency } from './NativePlatform'
9
+ import { ColorScheme, Orientation, StatusBarStyle } from './types'
10
10
 
11
11
  export {
12
12
  StatusBarStyle,
@@ -1,7 +1,7 @@
1
1
  import type { ColorValue, OpaqueColorValue } from 'react-native'
2
- import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet'
3
- import type { TransformStyles } from './core'
4
2
  import type { SafeReturnType } from './common'
3
+ import type { TransformStyles } from './core'
4
+ import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet'
5
5
 
6
6
  type ExtractTransformArray<T> = T extends object
7
7
  ? { [K in keyof T]: ExtractBreakpoints<T[K]> }
package/src/types/core.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ImageStyle, TextStyle, ViewStyle } from 'react-native'
1
2
  import type {
2
3
  MatrixTransform,
3
4
  PerspectiveTransform,
@@ -13,7 +14,6 @@ import type {
13
14
  TranslateXTransform,
14
15
  TranslateYTransform
15
16
  } from 'react-native/Libraries/StyleSheet/StyleSheetTypes'
16
- import type { ImageStyle, TextStyle, ViewStyle } from 'react-native'
17
17
  import type { UnistylesBreakpoints, UnistylesThemes } from '../global'
18
18
 
19
19
  export type ShadowOffset = {
@@ -1,11 +1,11 @@
1
- import type { BoxShadowValue, ImageStyle, TextStyle, ViewStyle, FilterFunction } from 'react-native'
2
- import type { ShadowOffset, TransformStyles, UnistylesTheme } from './core'
1
+ import type { CSSProperties } from 'react'
2
+ import type { BoxShadowValue, FilterFunction, ImageStyle, TextStyle, ViewStyle } from 'react-native'
3
3
  import type { UnistylesBreakpoints } from '../global'
4
4
  import type { UnistylesMiniRuntime } from '../specs'
5
+ import type { Pseudo } from '../web/convert/pseudo'
5
6
  import type { ReactNativeStyleSheet } from './breakpoints'
7
+ import type { ShadowOffset, TransformStyles, UnistylesTheme } from './core'
6
8
  import type { ExtractVariantNames } from './variants'
7
- import type { CSSProperties } from 'react'
8
- import type { Pseudo } from '../web/convert/pseudo'
9
9
 
10
10
  // these props are treated differently to nest breakpoints and media queries
11
11
  type NestedKeys = 'shadowOffset' | 'transform' | 'textShadowOffset' | 'boxShadow' | 'filter'
package/src/utils.ts CHANGED
@@ -24,3 +24,20 @@ export const deepMergeObjects = <T extends Record<PropertyKey, any>>(...sources:
24
24
 
25
25
  return target
26
26
  }
27
+
28
+ export const copyComponentProperties = (Component: any, UnistylesComponent: any) => {
29
+ Object.entries(Component).forEach(([key, value]) => {
30
+ // Filter out the keys we don't want to copy
31
+ if (['$$typeof', 'render'].includes(key)) {
32
+ return
33
+ }
34
+
35
+ UnistylesComponent[key] = value
36
+ })
37
+
38
+ // Those are not enumerable, so we need to copy them manually
39
+ UnistylesComponent.displayName = Component.displayName
40
+ UnistylesComponent.name = Component.name
41
+
42
+ return UnistylesComponent
43
+ }
@@ -1,10 +1,10 @@
1
1
  import type { UnistylesValues } from '../../types'
2
+ import { deepMergeObjects } from '../../utils'
3
+ import { getBoxShadow, getFilterStyle, getTransformStyle } from './object'
2
4
  import { isPseudo } from './pseudo'
5
+ import { getBoxShadowStyle, getTextShadowStyle } from './shadow'
3
6
  import { getStyle } from './style'
4
- import { deepMergeObjects } from '../../utils'
5
- import { getTransformStyle, getBoxShadow, getFilterStyle } from './object'
6
- import { isShadow, isFilter, isTextShadow, isTransform, isBoxShadow } from './utils'
7
- import { getTextShadowStyle, getBoxShadowStyle } from './shadow'
7
+ import { isBoxShadow, isFilter, isShadow, isTextShadow, isTransform } from './utils'
8
8
 
9
9
  export const convertUnistyles = (value: UnistylesValues) => {
10
10
  // Flag to mark if textShadow is already created
@@ -17,7 +17,7 @@ export const convertUnistyles = (value: UnistylesValues) => {
17
17
  ...value._web
18
18
  }).flatMap(([unistylesKey, unistylesValue]) => {
19
19
  // Keys to omit
20
- if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies', '__unistyles-secrets__'].includes(unistylesKey) || unistylesKey.startsWith('variant-')) {
20
+ if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies'].includes(unistylesKey) || unistylesKey.startsWith('unistyles_')) {
21
21
  return []
22
22
  }
23
23
 
@@ -1,7 +1,7 @@
1
1
  import type { BoxShadowValue } from 'react-native'
2
- import { normalizeNumericValue } from '../utils'
3
- import { keyInObject } from '../../utils'
4
2
  import { deepMergeObjects } from '../../../utils'
3
+ import { keyInObject } from '../../utils'
4
+ import { normalizeNumericValue } from '../utils'
5
5
 
6
6
  const createBoxShadowValue = (style: BoxShadowValue) => {
7
7
  const { offsetX, offsetY, blurRadius = 0, spreadDistance = 0, color = '#000', inset } = style
@@ -1,10 +1,10 @@
1
1
  import type { DropShadowValue } from 'react-native'
2
+ import { isUnistylesMq } from '../../../mq'
3
+ import { UnistylesWeb } from '../../index'
2
4
  import { hyphenate } from '../../utils'
3
5
  import type { Filters } from '../types'
4
- import { getObjectStyle } from './objectStyle'
5
6
  import { normalizeColor, normalizeNumericValue } from '../utils'
6
- import { isUnistylesMq } from '../../../mq'
7
- import { UnistylesWeb } from '../../index'
7
+ import { getObjectStyle } from './objectStyle'
8
8
 
9
9
  const getDropShadowStyle = (dropShadow: DropShadowValue) => {
10
10
  const { offsetX = 0, offsetY = 0, standardDeviation = 0, color = '#000' } = dropShadow
@@ -1,6 +1,6 @@
1
- import { getObjectStyle } from './objectStyle'
2
- import { normalizeNumericValue } from '../utils'
3
1
  import type { TransformStyles } from '../../../types/core'
2
+ import { normalizeNumericValue } from '../utils'
3
+ import { getObjectStyle } from './objectStyle'
4
4
 
5
5
  const normalizeTransform = (key: string, value: any) => {
6
6
  if (key.includes('scale')) {
@@ -1,6 +1,6 @@
1
1
  import type { FilterFunction, TextStyle, ViewStyle } from 'react-native'
2
- import type { ToDeepUnistyles } from '../../types/stylesheet'
3
2
  import type { UnionToIntersection } from '../../types'
3
+ import type { ToDeepUnistyles } from '../../types/stylesheet'
4
4
 
5
5
  export type ShadowOffset = ToDeepUnistyles<{ width: number, height: number }>
6
6
 
@@ -1,9 +1,9 @@
1
1
  // based on react-native-web normalizer
2
2
  // https://github.com/necolas/react-native-web
3
3
  import normalizeColors from '@react-native/normalize-colors'
4
- import { BOX_SHADOW_STYLES, TEXT_SHADOW_STYLES, type AllShadow, type AllShadowKeys, type Filters } from './types'
5
- import type { TransformStyles } from '../../types/core'
6
4
  import type { BoxShadowValue } from 'react-native'
5
+ import type { TransformStyles } from '../../types/core'
6
+ import { type AllShadow, type AllShadowKeys, BOX_SHADOW_STYLES, type Filters, TEXT_SHADOW_STYLES } from './types'
7
7
 
8
8
  export const isTransform = (key: string, value: any): value is Array<TransformStyles> => key === 'transform' && Array.isArray(value)
9
9
 
package/src/web/create.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { StyleSheetWithSuperPowers, StyleSheet } from '../types/stylesheet'
1
+ import type { StyleSheet, StyleSheetWithSuperPowers } from '../types/stylesheet'
2
2
  import { UnistylesWeb } from './index'
3
3
  import { assignSecrets, error, removeInlineStyles } from './utils'
4
4
 
package/src/web/index.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { create } from './create'
2
- import { deepMergeObjects } from '../utils'
1
+ import type { UnistylesShadowRegistry as NativeUnistylesShadowRegistry } from '../specs/ShadowRegistry'
3
2
  import type { StyleSheet as NativeStyleSheet } from '../specs/StyleSheet'
4
3
  import type { Runtime as NativeUnistylesRuntime } from '../specs/UnistylesRuntime'
5
- import type { UnistylesShadowRegistry as NativeUnistylesShadowRegistry } from '../specs/ShadowRegistry'
4
+ import { deepMergeObjects } from '../utils'
5
+ import { create } from './create'
6
6
  import { UnistylesServices } from './services'
7
7
  import { isServer } from './utils'
8
8
 
@@ -1,9 +1,9 @@
1
+ import type { UnistyleDependency, UnistylesMiniRuntime } from '../specs'
1
2
  import type { UnistylesTheme, UnistylesValues } from '../types'
2
3
  import type { StyleSheet, StyleSheetWithSuperPowers } from '../types/stylesheet'
3
- import { generateHash, extractUnistyleDependencies, error } from './utils'
4
- import type { UnistylesMiniRuntime, UnistyleDependency } from '../specs'
5
4
  import { CSSState } from './css'
6
5
  import type { UnistylesServices } from './types'
6
+ import { error, extractUnistyleDependencies, generateHash } from './utils'
7
7
 
8
8
  export class UnistylesRegistry {
9
9
  private readonly stylesheets = new Map<StyleSheetWithSuperPowers<StyleSheet>, StyleSheet>()
@@ -1,10 +1,10 @@
1
1
  import { UnistyleDependency } from '../specs/NativePlatform'
2
- import { ColorScheme, Orientation, type AppTheme, type AppThemeName } from '../specs/types'
3
2
  import type { UnistylesMiniRuntime } from '../specs/UnistylesRuntime'
3
+ import { type AppTheme, type AppThemeName, ColorScheme, Orientation } from '../specs/types'
4
4
  import { WebContentSizeCategory } from '../types'
5
5
  import { NavigationBar, StatusBar } from './mock'
6
- import { error, isServer, schemeToTheme } from './utils'
7
6
  import type { UnistylesServices } from './types'
7
+ import { error, isServer, schemeToTheme } from './utils'
8
8
 
9
9
  export class UnistylesRuntime {
10
10
  lightMedia = this.getLightMedia()
@@ -1,9 +1,9 @@
1
+ import { UnistyleDependency } from '../specs'
1
2
  import type { UnistylesTheme, UnistylesValues } from '../types'
2
3
  import { deepMergeObjects } from '../utils'
4
+ import type { UnistylesServices } from './types'
3
5
  import { extractSecrets, extractUnistyleDependencies } from './utils'
4
6
  import { getVariants } from './variants'
5
- import type { UnistylesServices } from './types'
6
- import { UnistyleDependency } from '../specs'
7
7
 
8
8
  export class UnistylesShadowRegistry {
9
9
  // MOCKS
package/src/web/state.ts CHANGED
@@ -1,11 +1,11 @@
1
- import type { UnistylesTheme } from '../types'
2
- import type { UnistylesConfig } from '../specs/StyleSheet'
3
- import type { AppBreakpoint, AppTheme, AppThemeName } from '../specs/types'
4
1
  import type { UnistylesBreakpoints, UnistylesThemes } from '../global'
5
- import { error, hyphenate, isServer, schemeToTheme } from './utils'
6
2
  import { UnistyleDependency } from '../specs/NativePlatform'
3
+ import type { UnistylesConfig } from '../specs/StyleSheet'
4
+ import type { AppBreakpoint, AppTheme, AppThemeName } from '../specs/types'
5
+ import type { UnistylesTheme } from '../types'
7
6
  import type { UnionToIntersection } from '../types'
8
7
  import type { UnistylesServices } from './types'
8
+ import { error, hyphenate, isServer, schemeToTheme } from './utils'
9
9
 
10
10
  type UnistylesSettings = Partial<UnionToIntersection<Required<UnistylesConfig>['settings']>>
11
11
 
@@ -65,5 +65,5 @@ const cyrb53 = (data: string, seed = 0) => {
65
65
  export const generateHash = (value: any) => {
66
66
  const serialized = serialize(value)
67
67
 
68
- return `unistyles-${cyrb53(serialized).toString(36)}`
68
+ return `unistyles_${cyrb53(serialized).toString(36)}`
69
69
  }
@@ -1,10 +1,10 @@
1
+ import type { UnistylesBreakpoints } from '../../global'
2
+ import { isUnistylesMq, parseMq } from '../../mq'
1
3
  import type { UnistyleDependency } from '../../specs/NativePlatform'
2
4
  import { ColorScheme, Orientation } from '../../specs/types'
3
5
  import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../../types/stylesheet'
4
- import { isUnistylesMq, parseMq } from '../../mq'
5
- import { keyInObject, reduceObject } from './common'
6
- import type { UnistylesBreakpoints } from '../../global'
7
6
  import { UnistylesWeb } from '../index'
7
+ import { keyInObject, reduceObject } from './common'
8
8
 
9
9
  export const schemeToTheme = (scheme: ColorScheme) => {
10
10
  switch (scheme) {
@@ -27,9 +27,9 @@ export const assignSecrets = <T>(object: T, secrets: UnistyleSecrets) => {
27
27
  const secretsId = Math.random().toString(36).slice(8)
28
28
 
29
29
  // @ts-expect-error assign hidden secrets
30
- object[`unistyles-${secretsId}`] = {}
30
+ object[`unistyles_${secretsId}`] = {}
31
31
  // @ts-expect-error assign hidden secrets
32
- Object.defineProperties(object[`unistyles-${secretsId}`], reduceObject(secrets, secret => ({
32
+ Object.defineProperties(object[`unistyles_${secretsId}`], reduceObject(secrets, secret => ({
33
33
  value: secret,
34
34
  enumerable: false,
35
35
  configurable: true
@@ -43,13 +43,19 @@ export const extractSecrets = (object: any) => {
43
43
  return undefined
44
44
  }
45
45
 
46
- const [, secrets] = Object.entries(object).find(([key]) => key.startsWith('unistyles-')) ?? []
46
+ const [, secrets] = Object.entries(object).find(([key]) => key.startsWith('unistyles_')) ?? []
47
47
 
48
48
  if (!secrets) {
49
49
  return undefined
50
50
  }
51
51
 
52
- return reduceObject(Object.getOwnPropertyDescriptors(secrets), secret => secret.value)
52
+ const hiddenSecrets = Object.getOwnPropertyDescriptors(secrets)
53
+
54
+ if (Object.keys(hiddenSecrets).length === 0) {
55
+ return undefined
56
+ }
57
+
58
+ return reduceObject(hiddenSecrets, secret => secret.value)
53
59
  }
54
60
 
55
61
  export const removeInlineStyles = (values: UnistylesValues) => {
package/plugin/common.js DELETED
@@ -1,142 +0,0 @@
1
- function getIdentifierNameFromExpression(t, memberExpression) {
2
- if (t.isMemberExpression(memberExpression)) {
3
- if (memberExpression.computed) {
4
- return [
5
- getIdentifierNameFromExpression(t, memberExpression.property),
6
- getIdentifierNameFromExpression(t, memberExpression.object)
7
- ].flat()
8
- }
9
-
10
- const object = memberExpression.object
11
-
12
- // If the object is an Identifier, return its name
13
- if (t.isIdentifier(object)) {
14
- return [object.name]
15
- }
16
-
17
- // If the object is another MemberExpression, recursively get the identifier
18
- if (t.isMemberExpression(object)) {
19
- return getIdentifierNameFromExpression(t, object).flat()
20
- }
21
- }
22
-
23
- if (t.isBinaryExpression(memberExpression)) {
24
- return [
25
- getIdentifierNameFromExpression(t, memberExpression.left),
26
- getIdentifierNameFromExpression(t, memberExpression.right)
27
- ].flat()
28
- }
29
-
30
- if (t.isCallExpression(memberExpression)) {
31
- return getIdentifierNameFromExpression(t, memberExpression.callee)
32
- }
33
-
34
- if (t.isConditionalExpression(memberExpression)) {
35
- return [
36
- getIdentifierNameFromExpression(t, memberExpression.test.left),
37
- getIdentifierNameFromExpression(t, memberExpression.test.right),
38
- getIdentifierNameFromExpression(t, memberExpression.alternate),
39
- getIdentifierNameFromExpression(t, memberExpression.consequent),
40
- getIdentifierNameFromExpression(t, memberExpression.test)
41
- ].flat()
42
- }
43
-
44
- if (t.isArrayExpression(memberExpression)) {
45
- return memberExpression.elements.map(expression => getIdentifierNameFromExpression(t, expression)).flat()
46
- }
47
-
48
- if (t.isArrowFunctionExpression(memberExpression)) {
49
- return memberExpression.body.properties.map(prop => getIdentifierNameFromExpression(t, prop.value)).flat()
50
- }
51
-
52
- if (t.isTemplateLiteral(memberExpression)) {
53
- return memberExpression.expressions.map(expression => getIdentifierNameFromExpression(t, expression)).flat()
54
- }
55
-
56
- if (t.isObjectExpression(memberExpression)) {
57
- return memberExpression.properties
58
- .filter(property => t.isObjectProperty(property))
59
- .flatMap(property => getIdentifierNameFromExpression(t, property.value))
60
- }
61
-
62
- if (t.isUnaryExpression(memberExpression)) {
63
- return getIdentifierNameFromExpression(t, memberExpression.argument.object)
64
- }
65
-
66
- return []
67
- }
68
-
69
- function getSecondPropertyName(t, memberExpression) {
70
- if (t.isUnaryExpression(memberExpression)) {
71
- return getSecondPropertyName(t, memberExpression.argument.object)
72
- }
73
-
74
- if (t.isConditionalExpression(memberExpression)) {
75
- return [
76
- getSecondPropertyName(t, memberExpression.test.left),
77
- getSecondPropertyName(t, memberExpression.test.right),
78
- getSecondPropertyName(t, memberExpression.alternate),
79
- getSecondPropertyName(t, memberExpression.consequent),
80
- getSecondPropertyName(t, memberExpression.test)
81
- ].flat()
82
- }
83
-
84
- if (t.isTemplateLiteral(memberExpression)) {
85
- return memberExpression.expressions.map(expression => getSecondPropertyName(t, expression)).flat()
86
- }
87
-
88
- if (t.isBinaryExpression(memberExpression)) {
89
- return [
90
- getSecondPropertyName(t, memberExpression.left),
91
- getSecondPropertyName(t, memberExpression.right)
92
- ].flat()
93
- }
94
-
95
- if (t.isObjectExpression(memberExpression)) {
96
- return memberExpression.properties
97
- .filter(property => t.isObjectProperty(property))
98
- .flatMap(property => getSecondPropertyName(t, property.value))
99
- }
100
-
101
- if (t.isArrayExpression(memberExpression)) {
102
- return memberExpression.elements.map(expression => getSecondPropertyName(t, expression)).flat()
103
- }
104
-
105
- if (!t.isMemberExpression(memberExpression)) {
106
- return []
107
- }
108
-
109
- let current = memberExpression.computed
110
- ? memberExpression.property
111
- : memberExpression
112
- let propertyName = null
113
-
114
- while (t.isMemberExpression(current)) {
115
- propertyName = current.property
116
- current = current.object
117
- }
118
-
119
- // special case for IME
120
- if (propertyName && t.isIdentifier(propertyName) && propertyName.name === 'insets') {
121
- if (t.isIdentifier(memberExpression.property) && memberExpression.property.name === "ime") {
122
- return [memberExpression.property.name]
123
- }
124
-
125
- return [propertyName.name]
126
- }
127
-
128
- if (propertyName && t.isIdentifier(propertyName)) {
129
- return [propertyName.name]
130
- }
131
-
132
- if (propertyName) {
133
- return [propertyName.value]
134
- }
135
-
136
- return []
137
- }
138
-
139
- module.exports = {
140
- getIdentifierNameFromExpression,
141
- getSecondPropertyName
142
- }