react-native-unistyles 3.0.0-beta.1 → 3.0.0-beta.2

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 (367) hide show
  1. package/README.md +4 -4
  2. package/Unistyles.podspec +7 -1
  3. package/android/build.gradle +6 -0
  4. package/android/src/main/cxx/NativeUnistylesModule.cpp +2 -2
  5. package/cxx/common/Constants.h +2 -0
  6. package/cxx/core/HostStyle.cpp +12 -7
  7. package/cxx/core/HostStyle.h +5 -0
  8. package/cxx/core/UnistyleData.h +3 -3
  9. package/cxx/core/UnistyleWrapper.h +8 -8
  10. package/cxx/core/UnistylesRegistry.cpp +23 -30
  11. package/cxx/core/UnistylesRegistry.h +8 -2
  12. package/cxx/hybridObjects/HybridShadowRegistry.cpp +108 -12
  13. package/cxx/hybridObjects/HybridShadowRegistry.h +21 -2
  14. package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +4 -0
  15. package/cxx/parser/Parser.cpp +182 -26
  16. package/cxx/parser/Parser.h +3 -1
  17. package/ios/UnistylesModuleOnLoad.mm +2 -2
  18. package/lib/commonjs/components/ScopedTheme.js +36 -0
  19. package/lib/commonjs/components/ScopedTheme.js.map +1 -0
  20. package/lib/commonjs/components/Variants.js +33 -0
  21. package/lib/commonjs/components/Variants.js.map +1 -0
  22. package/lib/commonjs/components/index.js +10 -3
  23. package/lib/commonjs/components/index.js.map +1 -1
  24. package/lib/commonjs/components/native/ActivityIndicator.js +10 -0
  25. package/lib/commonjs/components/native/ActivityIndicator.js.map +1 -0
  26. package/lib/commonjs/components/native/FlatList.js +10 -0
  27. package/lib/commonjs/components/native/FlatList.js.map +1 -0
  28. package/lib/commonjs/components/native/Image.js +10 -0
  29. package/lib/commonjs/components/native/Image.js.map +1 -0
  30. package/lib/commonjs/components/native/ImageBackground.js +10 -0
  31. package/lib/commonjs/components/native/ImageBackground.js.map +1 -0
  32. package/lib/commonjs/components/native/KeyboardAvoidingView.js +10 -0
  33. package/lib/commonjs/components/native/KeyboardAvoidingView.js.map +1 -0
  34. package/lib/commonjs/components/{Pressable.web.js → native/Pressable.js} +26 -66
  35. package/lib/commonjs/components/native/Pressable.js.map +1 -0
  36. package/lib/commonjs/components/native/Pressable.native.js +48 -0
  37. package/lib/commonjs/components/native/Pressable.native.js.map +1 -0
  38. package/lib/commonjs/components/native/RefreshControl.js +10 -0
  39. package/lib/commonjs/components/native/RefreshControl.js.map +1 -0
  40. package/lib/commonjs/components/native/ScrollView.js +10 -0
  41. package/lib/commonjs/components/native/ScrollView.js.map +1 -0
  42. package/lib/commonjs/components/native/SectionList.js +10 -0
  43. package/lib/commonjs/components/native/SectionList.js.map +1 -0
  44. package/lib/commonjs/components/native/Switch.js +10 -0
  45. package/lib/commonjs/components/native/Switch.js.map +1 -0
  46. package/lib/commonjs/components/native/Text.js +10 -0
  47. package/lib/commonjs/components/native/Text.js.map +1 -0
  48. package/lib/commonjs/components/native/TextInput.js +10 -0
  49. package/lib/commonjs/components/native/TextInput.js.map +1 -0
  50. package/lib/commonjs/components/native/TouchableHighlight.js +10 -0
  51. package/lib/commonjs/components/native/TouchableHighlight.js.map +1 -0
  52. package/lib/commonjs/components/native/TouchableOpacity.js +10 -0
  53. package/lib/commonjs/components/native/TouchableOpacity.js.map +1 -0
  54. package/lib/commonjs/components/native/View.js +10 -0
  55. package/lib/commonjs/components/native/View.js.map +1 -0
  56. package/lib/commonjs/components/native/VirtualizedList.js +10 -0
  57. package/lib/commonjs/components/native/VirtualizedList.js.map +1 -0
  58. package/lib/commonjs/core/createUnistylesComponent.js +5 -68
  59. package/lib/commonjs/core/createUnistylesComponent.js.map +1 -1
  60. package/lib/commonjs/core/createUnistylesElement.js +16 -0
  61. package/lib/commonjs/core/createUnistylesElement.js.map +1 -0
  62. package/lib/commonjs/core/createUnistylesImageBackground.js +27 -0
  63. package/lib/commonjs/core/createUnistylesImageBackground.js.map +1 -0
  64. package/lib/commonjs/core/index.js +20 -6
  65. package/lib/commonjs/core/index.js.map +1 -1
  66. package/lib/commonjs/core/passForwardRef.js +27 -0
  67. package/lib/commonjs/core/passForwardRef.js.map +1 -0
  68. package/lib/commonjs/core/withUnistyles/index.js +13 -0
  69. package/lib/commonjs/core/withUnistyles/index.js.map +1 -0
  70. package/lib/commonjs/core/withUnistyles/types.js +8 -0
  71. package/lib/commonjs/core/withUnistyles/types.js.map +1 -0
  72. package/lib/commonjs/core/withUnistyles/useDependencies.js +81 -0
  73. package/lib/commonjs/core/withUnistyles/useDependencies.js.map +1 -0
  74. package/lib/commonjs/core/withUnistyles/withUnistyles.js +88 -0
  75. package/lib/commonjs/core/withUnistyles/withUnistyles.js.map +1 -0
  76. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +96 -0
  77. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -0
  78. package/lib/commonjs/hooks/useMedia.js +17 -33
  79. package/lib/commonjs/hooks/useMedia.js.map +1 -1
  80. package/lib/commonjs/hooks/useMedia.native.js +60 -0
  81. package/lib/commonjs/hooks/useMedia.native.js.map +1 -0
  82. package/lib/commonjs/index.js +33 -16
  83. package/lib/commonjs/index.js.map +1 -1
  84. package/lib/commonjs/specs/ShadowRegistry/index.js +3 -3
  85. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  86. package/lib/commonjs/specs/index.js +14 -40
  87. package/lib/commonjs/specs/index.js.map +1 -1
  88. package/lib/commonjs/specs/index.native.js +54 -0
  89. package/lib/commonjs/specs/index.native.js.map +1 -0
  90. package/lib/commonjs/web/create.js +12 -33
  91. package/lib/commonjs/web/create.js.map +1 -1
  92. package/lib/commonjs/web/index.js.map +1 -1
  93. package/lib/commonjs/web/registry.js +10 -3
  94. package/lib/commonjs/web/registry.js.map +1 -1
  95. package/lib/commonjs/web/runtime.js +3 -1
  96. package/lib/commonjs/web/runtime.js.map +1 -1
  97. package/lib/commonjs/web/shadowRegistry.js +71 -64
  98. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  99. package/lib/commonjs/web/utils/unistyle.js +3 -3
  100. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  101. package/lib/module/components/ScopedTheme.js +29 -0
  102. package/lib/module/components/ScopedTheme.js.map +1 -0
  103. package/lib/module/components/Variants.js +26 -0
  104. package/lib/module/components/Variants.js.map +1 -0
  105. package/lib/module/components/index.js +2 -1
  106. package/lib/module/components/index.js.map +1 -1
  107. package/lib/module/components/native/ActivityIndicator.js +6 -0
  108. package/lib/module/components/native/ActivityIndicator.js.map +1 -0
  109. package/lib/module/components/native/FlatList.js +6 -0
  110. package/lib/module/components/native/FlatList.js.map +1 -0
  111. package/lib/module/components/native/Image.js +6 -0
  112. package/lib/module/components/native/Image.js.map +1 -0
  113. package/lib/module/components/native/ImageBackground.js +6 -0
  114. package/lib/module/components/native/ImageBackground.js.map +1 -0
  115. package/lib/module/components/native/KeyboardAvoidingView.js +6 -0
  116. package/lib/module/components/native/KeyboardAvoidingView.js.map +1 -0
  117. package/lib/module/components/native/Pressable.js +69 -0
  118. package/lib/module/components/native/Pressable.js.map +1 -0
  119. package/lib/module/components/native/Pressable.native.js +42 -0
  120. package/lib/module/components/native/Pressable.native.js.map +1 -0
  121. package/lib/module/components/native/RefreshControl.js +6 -0
  122. package/lib/module/components/native/RefreshControl.js.map +1 -0
  123. package/lib/module/components/native/ScrollView.js +6 -0
  124. package/lib/module/components/native/ScrollView.js.map +1 -0
  125. package/lib/module/components/native/SectionList.js +6 -0
  126. package/lib/module/components/native/SectionList.js.map +1 -0
  127. package/lib/module/components/native/Switch.js +6 -0
  128. package/lib/module/components/native/Switch.js.map +1 -0
  129. package/lib/module/components/native/Text.js +6 -0
  130. package/lib/module/components/native/Text.js.map +1 -0
  131. package/lib/module/components/native/TextInput.js +6 -0
  132. package/lib/module/components/native/TextInput.js.map +1 -0
  133. package/lib/module/components/native/TouchableHighlight.js +6 -0
  134. package/lib/module/components/native/TouchableHighlight.js.map +1 -0
  135. package/lib/module/components/native/TouchableOpacity.js +6 -0
  136. package/lib/module/components/native/TouchableOpacity.js.map +1 -0
  137. package/lib/module/components/native/View.js +6 -0
  138. package/lib/module/components/native/View.js.map +1 -0
  139. package/lib/module/components/native/VirtualizedList.js +6 -0
  140. package/lib/module/components/native/VirtualizedList.js.map +1 -0
  141. package/lib/module/core/createUnistylesComponent.js +5 -66
  142. package/lib/module/core/createUnistylesComponent.js.map +1 -1
  143. package/lib/module/core/createUnistylesElement.js +10 -0
  144. package/lib/module/core/createUnistylesElement.js.map +1 -0
  145. package/lib/module/core/createUnistylesImageBackground.js +21 -0
  146. package/lib/module/core/createUnistylesImageBackground.js.map +1 -0
  147. package/lib/module/core/index.js +4 -2
  148. package/lib/module/core/index.js.map +1 -1
  149. package/lib/module/core/passForwardRef.js +22 -0
  150. package/lib/module/core/passForwardRef.js.map +1 -0
  151. package/lib/module/core/withUnistyles/index.js +4 -0
  152. package/lib/module/core/withUnistyles/index.js.map +1 -0
  153. package/lib/module/core/withUnistyles/types.js +4 -0
  154. package/lib/module/core/withUnistyles/types.js.map +1 -0
  155. package/lib/module/core/withUnistyles/useDependencies.js +75 -0
  156. package/lib/module/core/withUnistyles/useDependencies.js.map +1 -0
  157. package/lib/module/core/withUnistyles/withUnistyles.js +81 -0
  158. package/lib/module/core/withUnistyles/withUnistyles.js.map +1 -0
  159. package/lib/module/core/withUnistyles/withUnistyles.native.js +89 -0
  160. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -0
  161. package/lib/module/hooks/useMedia.js +19 -35
  162. package/lib/module/hooks/useMedia.js.map +1 -1
  163. package/lib/module/hooks/useMedia.native.js +55 -0
  164. package/lib/module/hooks/useMedia.native.js.map +1 -0
  165. package/lib/module/index.js +2 -2
  166. package/lib/module/index.js.map +1 -1
  167. package/lib/module/specs/ShadowRegistry/index.js +3 -3
  168. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  169. package/lib/module/specs/index.js +2 -8
  170. package/lib/module/specs/index.js.map +1 -1
  171. package/lib/module/specs/index.native.js +11 -0
  172. package/lib/module/specs/index.native.js.map +1 -0
  173. package/lib/module/web/create.js +13 -34
  174. package/lib/module/web/create.js.map +1 -1
  175. package/lib/module/web/index.js +1 -1
  176. package/lib/module/web/index.js.map +1 -1
  177. package/lib/module/web/registry.js +11 -4
  178. package/lib/module/web/registry.js.map +1 -1
  179. package/lib/module/web/runtime.js +3 -1
  180. package/lib/module/web/runtime.js.map +1 -1
  181. package/lib/module/web/shadowRegistry.js +70 -63
  182. package/lib/module/web/shadowRegistry.js.map +1 -1
  183. package/lib/module/web/utils/unistyle.js +1 -1
  184. package/lib/module/web/utils/unistyle.js.map +1 -1
  185. package/lib/typescript/src/components/ScopedTheme.d.ts +8 -0
  186. package/lib/typescript/src/components/ScopedTheme.d.ts.map +1 -0
  187. package/lib/typescript/src/components/Variants.d.ts +7 -0
  188. package/lib/typescript/src/components/Variants.d.ts.map +1 -0
  189. package/lib/typescript/src/components/index.d.ts +2 -1
  190. package/lib/typescript/src/components/index.d.ts.map +1 -1
  191. package/lib/typescript/src/components/native/ActivityIndicator.d.ts +2 -0
  192. package/lib/typescript/src/components/native/ActivityIndicator.d.ts.map +1 -0
  193. package/lib/typescript/src/components/native/FlatList.d.ts +2 -0
  194. package/lib/typescript/src/components/native/FlatList.d.ts.map +1 -0
  195. package/lib/typescript/src/components/native/Image.d.ts +2 -0
  196. package/lib/typescript/src/components/native/Image.d.ts.map +1 -0
  197. package/lib/typescript/src/components/native/ImageBackground.d.ts +3 -0
  198. package/lib/typescript/src/components/native/ImageBackground.d.ts.map +1 -0
  199. package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts +2 -0
  200. package/lib/typescript/src/components/native/KeyboardAvoidingView.d.ts.map +1 -0
  201. package/lib/typescript/src/components/{Pressable.web.d.ts → native/Pressable.d.ts} +3 -2
  202. package/lib/typescript/src/components/native/Pressable.d.ts.map +1 -0
  203. package/lib/typescript/src/components/{Pressable.d.ts → native/Pressable.native.d.ts} +1 -3
  204. package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -0
  205. package/lib/typescript/src/components/native/RefreshControl.d.ts +2 -0
  206. package/lib/typescript/src/components/native/RefreshControl.d.ts.map +1 -0
  207. package/lib/typescript/src/components/native/ScrollView.d.ts +2 -0
  208. package/lib/typescript/src/components/native/ScrollView.d.ts.map +1 -0
  209. package/lib/typescript/src/components/native/SectionList.d.ts +2 -0
  210. package/lib/typescript/src/components/native/SectionList.d.ts.map +1 -0
  211. package/lib/typescript/src/components/native/Switch.d.ts +2 -0
  212. package/lib/typescript/src/components/native/Switch.d.ts.map +1 -0
  213. package/lib/typescript/src/components/native/Text.d.ts +2 -0
  214. package/lib/typescript/src/components/native/Text.d.ts.map +1 -0
  215. package/lib/typescript/src/components/native/TextInput.d.ts +2 -0
  216. package/lib/typescript/src/components/native/TextInput.d.ts.map +1 -0
  217. package/lib/typescript/src/components/native/TouchableHighlight.d.ts +2 -0
  218. package/lib/typescript/src/components/native/TouchableHighlight.d.ts.map +1 -0
  219. package/lib/typescript/src/components/native/TouchableOpacity.d.ts +2 -0
  220. package/lib/typescript/src/components/native/TouchableOpacity.d.ts.map +1 -0
  221. package/lib/typescript/src/components/native/View.d.ts +2 -0
  222. package/lib/typescript/src/components/native/View.d.ts.map +1 -0
  223. package/lib/typescript/src/components/native/VirtualizedList.d.ts +2 -0
  224. package/lib/typescript/src/components/native/VirtualizedList.d.ts.map +1 -0
  225. package/lib/typescript/src/core/createUnistylesComponent.d.ts +9 -3
  226. package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -1
  227. package/lib/typescript/src/core/createUnistylesElement.d.ts +3 -0
  228. package/lib/typescript/src/core/createUnistylesElement.d.ts.map +1 -0
  229. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts +4 -0
  230. package/lib/typescript/src/core/createUnistylesImageBackground.d.ts.map +1 -0
  231. package/lib/typescript/src/core/index.d.ts +4 -2
  232. package/lib/typescript/src/core/index.d.ts.map +1 -1
  233. package/lib/typescript/src/core/passForwardRef.d.ts +3 -0
  234. package/lib/typescript/src/core/passForwardRef.d.ts.map +1 -0
  235. package/lib/typescript/src/core/withUnistyles/index.d.ts +2 -0
  236. package/lib/typescript/src/core/withUnistyles/index.d.ts.map +1 -0
  237. package/lib/typescript/src/core/withUnistyles/types.d.ts +6 -0
  238. package/lib/typescript/src/core/withUnistyles/types.d.ts.map +1 -0
  239. package/lib/typescript/src/core/withUnistyles/useDependencies.d.ts +13 -0
  240. package/lib/typescript/src/core/withUnistyles/useDependencies.d.ts.map +1 -0
  241. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts +11 -0
  242. package/lib/typescript/src/core/withUnistyles/withUnistyles.d.ts.map +1 -0
  243. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts +8 -0
  244. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -0
  245. package/lib/typescript/src/hooks/useMedia.d.ts +1 -1
  246. package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -1
  247. package/lib/typescript/src/hooks/useMedia.native.d.ts +6 -0
  248. package/lib/typescript/src/hooks/useMedia.native.d.ts.map +1 -0
  249. package/lib/typescript/src/index.d.ts +2 -2
  250. package/lib/typescript/src/index.d.ts.map +1 -1
  251. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +7 -2
  252. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  253. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +17 -0
  254. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
  255. package/lib/typescript/src/specs/index.d.ts +3 -11
  256. package/lib/typescript/src/specs/index.d.ts.map +1 -1
  257. package/lib/typescript/src/specs/index.native.d.ts +12 -0
  258. package/lib/typescript/src/specs/index.native.d.ts.map +1 -0
  259. package/lib/typescript/src/web/create.d.ts +1 -1441
  260. package/lib/typescript/src/web/create.d.ts.map +1 -1
  261. package/lib/typescript/src/web/index.d.ts +2 -1441
  262. package/lib/typescript/src/web/index.d.ts.map +1 -1
  263. package/lib/typescript/src/web/registry.d.ts +2 -3
  264. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  265. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  266. package/lib/typescript/src/web/shadowRegistry.d.ts +11 -3
  267. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  268. package/lib/typescript/src/web/utils/unistyle.d.ts +1 -2
  269. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
  270. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +3 -0
  271. package/package.json +4 -4
  272. package/plugin/common.js +4 -6
  273. package/plugin/import.js +63 -26
  274. package/plugin/index.js +48 -28
  275. package/plugin/ref.js +0 -234
  276. package/plugin/style.js +4 -317
  277. package/plugin/stylesheet.js +25 -10
  278. package/plugin/variants.js +54 -1
  279. package/src/components/ScopedTheme.tsx +32 -0
  280. package/src/components/Variants.tsx +29 -0
  281. package/src/components/index.ts +2 -1
  282. package/src/components/native/ActivityIndicator.tsx +4 -0
  283. package/src/components/native/FlatList.tsx +4 -0
  284. package/src/components/native/Image.tsx +4 -0
  285. package/src/components/native/ImageBackground.tsx +4 -0
  286. package/src/components/native/KeyboardAvoidingView.tsx +4 -0
  287. package/src/components/native/Pressable.native.tsx +55 -0
  288. package/src/components/native/Pressable.tsx +98 -0
  289. package/src/components/native/RefreshControl.tsx +4 -0
  290. package/src/components/native/ScrollView.tsx +4 -0
  291. package/src/components/native/SectionList.tsx +4 -0
  292. package/src/components/native/Switch.tsx +4 -0
  293. package/src/components/native/Text.tsx +4 -0
  294. package/src/components/native/TextInput.tsx +4 -0
  295. package/src/components/native/TouchableHighlight.tsx +4 -0
  296. package/src/components/native/TouchableOpacity.tsx +4 -0
  297. package/src/components/native/View.tsx +4 -0
  298. package/src/components/native/VirtualizedList.tsx +4 -0
  299. package/src/core/createUnistylesComponent.tsx +6 -76
  300. package/src/core/createUnistylesElement.tsx +9 -0
  301. package/src/core/createUnistylesImageBackground.tsx +24 -0
  302. package/src/core/index.ts +4 -2
  303. package/src/core/passForwardRef.ts +29 -0
  304. package/src/core/withUnistyles/index.ts +1 -0
  305. package/src/core/withUnistyles/types.ts +7 -0
  306. package/src/core/withUnistyles/useDependencies.ts +93 -0
  307. package/src/core/withUnistyles/withUnistyles.native.tsx +96 -0
  308. package/src/core/withUnistyles/withUnistyles.tsx +90 -0
  309. package/src/hooks/useMedia.native.ts +65 -0
  310. package/src/hooks/useMedia.ts +19 -36
  311. package/src/index.ts +2 -2
  312. package/src/specs/ShadowRegistry/index.ts +14 -5
  313. package/src/specs/ShadowRegistry/types.ts +18 -1
  314. package/src/specs/index.native.ts +27 -0
  315. package/src/specs/index.ts +3 -27
  316. package/src/web/create.ts +14 -32
  317. package/src/web/index.ts +3 -2
  318. package/src/web/registry.ts +15 -6
  319. package/src/web/runtime.ts +3 -1
  320. package/src/web/shadowRegistry.ts +66 -52
  321. package/src/web/utils/unistyle.ts +1 -2
  322. package/lib/commonjs/components/Pressable.js +0 -74
  323. package/lib/commonjs/components/Pressable.js.map +0 -1
  324. package/lib/commonjs/components/Pressable.web.js.map +0 -1
  325. package/lib/commonjs/core/createUnistylesComponent.native.js +0 -82
  326. package/lib/commonjs/core/createUnistylesComponent.native.js.map +0 -1
  327. package/lib/commonjs/core/getBoundArgs.js +0 -18
  328. package/lib/commonjs/core/getBoundArgs.js.map +0 -1
  329. package/lib/commonjs/core/getId.js +0 -9
  330. package/lib/commonjs/core/getId.js.map +0 -1
  331. package/lib/commonjs/hooks/useMedia.web.js +0 -43
  332. package/lib/commonjs/hooks/useMedia.web.js.map +0 -1
  333. package/lib/commonjs/specs/index.web.js +0 -17
  334. package/lib/commonjs/specs/index.web.js.map +0 -1
  335. package/lib/module/components/Pressable.js +0 -68
  336. package/lib/module/components/Pressable.js.map +0 -1
  337. package/lib/module/components/Pressable.web.js +0 -109
  338. package/lib/module/components/Pressable.web.js.map +0 -1
  339. package/lib/module/core/createUnistylesComponent.native.js +0 -75
  340. package/lib/module/core/createUnistylesComponent.native.js.map +0 -1
  341. package/lib/module/core/getBoundArgs.js +0 -13
  342. package/lib/module/core/getBoundArgs.js.map +0 -1
  343. package/lib/module/core/getId.js +0 -4
  344. package/lib/module/core/getId.js.map +0 -1
  345. package/lib/module/hooks/useMedia.web.js +0 -38
  346. package/lib/module/hooks/useMedia.web.js.map +0 -1
  347. package/lib/module/specs/index.web.js +0 -4
  348. package/lib/module/specs/index.web.js.map +0 -1
  349. package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
  350. package/lib/typescript/src/components/Pressable.web.d.ts.map +0 -1
  351. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +0 -8
  352. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +0 -1
  353. package/lib/typescript/src/core/getBoundArgs.d.ts +0 -2
  354. package/lib/typescript/src/core/getBoundArgs.d.ts.map +0 -1
  355. package/lib/typescript/src/core/getId.d.ts +0 -2
  356. package/lib/typescript/src/core/getId.d.ts.map +0 -1
  357. package/lib/typescript/src/hooks/useMedia.web.d.ts +0 -6
  358. package/lib/typescript/src/hooks/useMedia.web.d.ts.map +0 -1
  359. package/lib/typescript/src/specs/index.web.d.ts +0 -2
  360. package/lib/typescript/src/specs/index.web.d.ts.map +0 -1
  361. package/src/components/Pressable.tsx +0 -89
  362. package/src/components/Pressable.web.tsx +0 -129
  363. package/src/core/createUnistylesComponent.native.tsx +0 -83
  364. package/src/core/getBoundArgs.ts +0 -15
  365. package/src/core/getId.ts +0 -1
  366. package/src/hooks/useMedia.web.ts +0 -47
  367. package/src/specs/index.web.ts +0 -1
@@ -1,109 +0,0 @@
1
- "use strict";
2
-
3
- import React, { forwardRef, useEffect, useRef } from 'react';
4
- import { Pressable as NativePressableReactNative } from 'react-native';
5
- import { UnistylesShadowRegistry } from '../specs';
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- const initialState = {
8
- pressed: false,
9
- hovered: false,
10
- focused: false
11
- };
12
- const events = {
13
- 'pointerdown': {
14
- pressed: true
15
- },
16
- 'pointerup': {
17
- pressed: false
18
- },
19
- 'pointerenter': {
20
- hovered: true
21
- },
22
- 'pointerleave': {
23
- hovered: false
24
- },
25
- 'focus': {
26
- focused: true
27
- },
28
- 'blur': {
29
- focused: false
30
- }
31
- };
32
- const isFunctionWithBoundArgs = fn => {
33
- return typeof fn === 'function' && 'getBoundArgs' in fn;
34
- };
35
- const extractFunctionArgs = styleResult => {
36
- return isFunctionWithBoundArgs(styleResult) ? [styleResult.getBoundArgs()] : Array.isArray(styleResult) ? styleResult.map(style => isFunctionWithBoundArgs(style) ? style.getBoundArgs() : []) : [];
37
- };
38
- const extractStyleResult = style => {
39
- return typeof style === 'function' ? [style()] : Array.isArray(style) ? style.map(style => typeof style === 'function' ? style() : style) : [style];
40
- };
41
- const updateStyles = ({
42
- ref,
43
- style,
44
- variants,
45
- state
46
- }) => {
47
- const styleResult = typeof style === 'function' ? style(state) : style;
48
- const fnArgs = extractFunctionArgs(styleResult);
49
- const extractedResult = extractStyleResult(styleResult);
50
-
51
- // @ts-expect-error - this is hidden from TS
52
- UnistylesShadowRegistry.add(ref, extractedResult, variants, fnArgs);
53
- };
54
- export const Pressable = /*#__PURE__*/forwardRef(({
55
- variants,
56
- style,
57
- ...props
58
- }, passedRef) => {
59
- const storedRef = useRef(null);
60
- const state = useRef(initialState);
61
- const styleRef = useRef(style);
62
- useEffect(() => {
63
- styleRef.current = style;
64
- }, [style]);
65
- useEffect(() => {
66
- const handler = newState => () => {
67
- state.current = {
68
- ...state.current,
69
- ...newState
70
- };
71
- updateStyles({
72
- ref: storedRef.current,
73
- style: styleRef.current,
74
- variants,
75
- state: state.current
76
- });
77
- };
78
- if (!storedRef.current) {
79
- return;
80
- }
81
-
82
- // ref on the web is dom element
83
- const ref = storedRef.current;
84
- Object.entries(events).forEach(([event, state]) => {
85
- ref.addEventListener(event, handler(state));
86
- });
87
- return () => {
88
- Object.entries(events).forEach(([event, state]) => {
89
- ref.removeEventListener(event, handler(state));
90
- });
91
- };
92
- }, []);
93
- return /*#__PURE__*/_jsx(NativePressableReactNative, {
94
- ...props,
95
- ref: ref => {
96
- storedRef.current = ref;
97
- updateStyles({
98
- ref,
99
- style: style,
100
- variants,
101
- state: initialState
102
- });
103
- if (typeof passedRef === 'object' && passedRef !== null) {
104
- passedRef.current = ref;
105
- }
106
- }
107
- });
108
- });
109
- //# sourceMappingURL=Pressable.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","forwardRef","useEffect","useRef","Pressable","NativePressableReactNative","UnistylesShadowRegistry","jsx","_jsx","initialState","pressed","hovered","focused","events","isFunctionWithBoundArgs","fn","extractFunctionArgs","styleResult","getBoundArgs","Array","isArray","map","style","extractStyleResult","updateStyles","ref","variants","state","fnArgs","extractedResult","add","props","passedRef","storedRef","styleRef","current","handler","newState","Object","entries","forEach","event","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["components/Pressable.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC5D,SAASC,SAAS,IAAIC,0BAA0B,QAAQ,cAAc;AAEtE,SAASC,uBAAuB,QAAQ,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAelD,MAAMC,YAA+B,GAAG;EACpCC,OAAO,EAAE,KAAK;EACdC,OAAO,EAAE,KAAK;EACdC,OAAO,EAAE;AACb,CAAC;AAED,MAAMC,MAAM,GAAG;EACX,aAAa,EAAE;IAAEH,OAAO,EAAE;EAAK,CAAC;EAChC,WAAW,EAAE;IAAEA,OAAO,EAAE;EAAM,CAAC;EAC/B,cAAc,EAAE;IAAEC,OAAO,EAAE;EAAK,CAAC;EACjC,cAAc,EAAE;IAAEA,OAAO,EAAE;EAAM,CAAC;EAClC,OAAO,EAAE;IAAEC,OAAO,EAAE;EAAK,CAAC;EAC1B,MAAM,EAAE;IAAEA,OAAO,EAAE;EAAM;AAC7B,CAAkF;AASlF,MAAME,uBAAuB,GAAIC,EAAO,IA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,0BAA0B;IAAA,GACnB0B,KAAK;IACTN,GAAG,EAAEA,GAAG,IAAI;MACRQ,SAAS,CAACE,OAAO,GAAGV,GAAG;MACvBD,YAAY,CAAC;QACTC,GAAG;QACHH,KAAK,EAAEA,KAA0B;QACjCI,QAAQ;QACRC,KAAK,EAAElB;MACX,CAAC,CAAC;MAEF,IAAI,OAAOuB,SAAS,KAAK,QAAQ,IAAIA,SAAS,KAAK,IAAI,EAAE;QACrDA,SAAS,CAACG,OAAO,GAAGV,GAAG;MAC3B;IACJ;EAAE,CACL,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
@@ -1,75 +0,0 @@
1
- "use strict";
2
-
3
- import React, { forwardRef, useEffect, useRef, useState } from 'react';
4
- import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
5
- import { deepMergeObjects } from '../utils';
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'];
8
- export const createUnistylesComponent = (Component, mappings) => {
9
- return /*#__PURE__*/forwardRef((props, ref) => {
10
- const narrowedProps = props;
11
- const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
12
- const [, setRt] = useState(0);
13
- const stylesRef = useRef({});
14
- const isForcedRef = useRef(false);
15
- if (!isForcedRef.current) {
16
- SUPPORTED_STYLE_PROPS.forEach(propName => {
17
- if (narrowedProps?.[propName]) {
18
- if (Array.isArray(narrowedProps[propName])) {
19
- console.error(`🦄 Unistyles: createUnistylesComponent requires ${propName} to be an object. Please check props for component: ${Component.displayName}`);
20
- }
21
-
22
- // @ts-expect-error - this is hidden from TS
23
- if (props[propName].__unistyles_name && !props[propName].__proto__?.getStyle) {
24
- console.error(`🦄 Unistyles: createUnistylesComponent received style that is not bound. You likely used the spread operator on a Unistyle style. Please check props for component: ${Component.displayName}`);
25
- }
26
- stylesRef.current = {
27
- ...stylesRef.current,
28
- [propName]: narrowedProps[propName]
29
- };
30
- }
31
- });
32
- }
33
- useEffect(() => {
34
- const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
35
- const componentDependencies = narrowedProps.style?.__proto__.uni__dependencies || mappings?.(theme).style?.__proto__.uni__dependencies;
36
- if (dependencies.includes(UnistyleDependency.Theme) && (!componentDependencies || componentDependencies.includes(UnistyleDependency.Theme))) {
37
- setTheme(UnistylesRuntime.getTheme());
38
-
39
- // override with Unistyles styles
40
- SUPPORTED_STYLE_PROPS.forEach(propName => {
41
- if (narrowedProps?.[propName]) {
42
- stylesRef.current = {
43
- ...stylesRef.current,
44
- // @ts-expect-error - this is hidden from TS
45
- [propName]: props[propName].__proto__?.getStyle?.() || props[propName]
46
- };
47
- }
48
- });
49
- isForcedRef.current = true;
50
- }
51
- if (dependencies.some(dependency => dependency >= 2) && (!componentDependencies || componentDependencies.some(dependency => dependency >= 2))) {
52
- setRt(prevState => prevState + 1);
53
- }
54
- });
55
- return () => {
56
- removeChangeListener();
57
- };
58
- }, []);
59
- const mergedProps = mappings?.(theme) ?? {};
60
- const finalProps = deepMergeObjects(mergedProps, props);
61
-
62
- // override with Unistyles styles
63
- SUPPORTED_STYLE_PROPS.forEach(propName => {
64
- if (finalProps[propName]) {
65
- finalProps[propName] = stylesRef.current[propName];
66
- }
67
- });
68
- isForcedRef.current = false;
69
- return /*#__PURE__*/_jsx(Component, {
70
- ...finalProps,
71
- ref: ref
72
- });
73
- });
74
- };
75
- //# sourceMappingURL=createUnistylesComponent.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","forwardRef","useEffect","useRef","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","deepMergeObjects","jsx","_jsx","SUPPORTED_STYLE_PROPS","createUnistylesComponent","Component","mappings","props","ref","narrowedProps","theme","setTheme","getTheme","setRt","stylesRef","isForcedRef","current","forEach","propName","Array","isArray","console","error","displayName","__unistyles_name","__proto__","getStyle","removeChangeListener","addChangeListener","dependencies","componentDependencies","style","uni__dependencies","includes","Theme","some","dependency","prevState","mergedProps","finalProps"],"sourceRoot":"../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,EAAE;UAC3IvB,KAAK,CAACwB,SAAS,IAAIA,SAAS,GAAG,CAAC,CAAC;QACrC;MACJ,CAAC,CAAC;MAEF,OAAO,MAAM;QACTV,oBAAoB,CAAC,CAAC;MAC1B,CAAC;IACL,CAAC,EAAE,EAAE,CAAC;IAEN,MAAMW,WAAW,GAAGhC,QAAQ,GAAGI,KAAK,CAAC,IAA2B,CAAC,CAAC;IAClE,MAAM6B,UAAU,GAAGvC,gBAAgB,CAACsC,WAAW,EAAE/B,KAAK,CAAC;;IAEvD;IACAJ,qBAAqB,CAACc,OAAO,CAACC,QAAQ,IAAI;MACtC,IAAIqB,UAAU,CAACrB,QAAQ,CAAC,EAAE;QACtBqB,UAAU,CAACrB,QAAQ,CAAC,GAAGJ,SAAS,CAACE,OAAO,CAACE,QAAQ,CAAC;MACtD;IACJ,CAAC,CAAC;IAEFH,WAAW,CAACC,OAAO,GAAG,KAAK;IAE3B,oBAAOd,IAAA,CAACG,SAAS;MAAA,GAAKkC,UAAU;MAAY/B,GAAG,EAAEA;IAAI,CAAE,CAAC;EAC5D,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- export const getBoundArgs = fn => {
4
- const boundArgs = [];
5
- fn.bind = (thisArg, ...args) => {
6
- boundArgs.push(...args);
7
- const newFn = Function.prototype.bind.apply(fn, [thisArg, ...args]);
8
- newFn.getBoundArgs = () => boundArgs;
9
- return newFn;
10
- };
11
- return fn;
12
- };
13
- //# sourceMappingURL=getBoundArgs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getBoundArgs","fn","boundArgs","bind","thisArg","args","push","newFn","Function","prototype","apply"],"sourceRoot":"../../../src","sources":["core/getBoundArgs.ts"],"mappings":";;AAAA,OAAO,MAAMA,YAAY,GAAIC,EAAY,IAAK;EAC1C,MAAMC,SAAS,GAAG,EAAgB;EAElCD,EAAE,CAACE,IAAI,GAAG,CAACC,OAAO,EAAE,GAAGC,IAAI,KAAK;IAC5BH,SAAS,CAACI,IAAI,CAAC,GAAGD,IAAI,CAAC;IAEvB,MAAME,KAAK,GAAGC,QAAQ,CAACC,SAAS,CAACN,IAAI,CAACO,KAAK,CAACT,EAAE,EAAE,CAACG,OAAO,EAAE,GAAGC,IAAI,CAAC,CAAC;IAEnEE,KAAK,CAACP,YAAY,GAAG,MAAME,SAAS;IAEpC,OAAOK,KAAK;EAChB,CAAC;EAED,OAAON,EAAE;AACb,CAAC","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export const getId = () => `${Math.random().toString(36).substring(2, 9)}`;
4
- //# sourceMappingURL=getId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getId","Math","random","toString","substring"],"sourceRoot":"../../../src","sources":["core/getId.ts"],"mappings":";;AAAA,OAAO,MAAMA,KAAK,GAAGA,CAAA,KAAM,GAAGC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE","ignoreList":[]}
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- import { useEffect, useRef, useState } from 'react';
4
- import { isUnistylesMq, isValidMq, parseMq } from '../mq';
5
- export const useMedia = config => {
6
- const disposeRef = useRef(() => {});
7
- const [isVisible, setIsVisible] = useState(() => {
8
- const maybeMq = config.mq;
9
- if (!isUnistylesMq(maybeMq)) {
10
- console.error(`🦄 Unistyles: Received invalid mq: ${maybeMq}`);
11
- return false;
12
- }
13
- const parsedMq = parseMq(maybeMq);
14
- if (!isValidMq(parsedMq)) {
15
- console.error(`🦄 Unistyles: Received invalid mq where min is greater than max: ${maybeMq}`);
16
- return false;
17
- }
18
- const {
19
- minWidth,
20
- maxWidth,
21
- minHeight,
22
- maxHeight
23
- } = parsedMq;
24
- const mediaQuery = [minWidth !== undefined ? `(min-width: ${minWidth}px)` : undefined, maxWidth !== undefined ? `(max-width: ${maxWidth}px)` : undefined, minHeight !== undefined ? `(min-height: ${minHeight}px)` : undefined, maxHeight !== undefined ? `(max-height: ${maxHeight}px)` : undefined].filter(Boolean).join(' and ');
25
- const media = window.matchMedia(mediaQuery);
26
- const handler = event => setIsVisible(event.matches);
27
- media.addEventListener('change', handler);
28
- disposeRef.current = () => media.removeEventListener('change', handler);
29
- return media.matches;
30
- });
31
-
32
- // Unmount
33
- useEffect(() => () => disposeRef.current(), []);
34
- return {
35
- isVisible
36
- };
37
- };
38
- //# sourceMappingURL=useMedia.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useEffect","useRef","useState","isUnistylesMq","isValidMq","parseMq","useMedia","config","disposeRef","isVisible","setIsVisible","maybeMq","mq","console","error","parsedMq","minWidth","maxWidth","minHeight","maxHeight","mediaQuery","undefined","filter","Boolean","join","media","window","matchMedia","handler","event","matches","addEventListener","current","removeEventListener"],"sourceRoot":"../../../src","sources":["hooks/useMedia.web.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACnD,SAASC,aAAa,EAAEC,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAEzD,OAAO,MAAMC,QAAQ,GAAIC,MAAsB,IAAK;EAChD,MAAMC,UAAU,GAAGP,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;EACnC,MAAM,CAACQ,SAAS,EAAEC,YAAY,CAAC,GAAGR,QAAQ,CAAC,MAAM;IAC7C,MAAMS,OAAO,GAAGJ,MAAM,CAACK,EAAuB;IAE9C,IAAI,CAACT,aAAa,CAACQ,OAAO,CAAC,EAAE;MACzBE,OAAO,CAACC,KAAK,CAAC,sCAAsCH,OAAO,EAAE,CAAC;MAE9D,OAAO,KAAK;IAChB;IAEA,MAAMI,QAAQ,GAAGV,OAAO,CAACM,OAAO,CAAC;IAEjC,IAAI,CAACP,SAAS,CAACW,QAAQ,CAAC,EAAE;MACtBF,OAAO,CAACC,KAAK,CAAC,oEAAoEH,OAAO,EAAE,CAAC;MAE5F,OAAO,KAAK;IAChB;IAEA,MAAM;MAAEK,QAAQ;MAAEC,QAAQ;MAAEC,SAAS;MAAEC;IAAU,CAAC,GAAGJ,QAAQ;IAE7D,MAAMK,UAAU,GAAG,CACfJ,QAAQ,KAAKK,SAAS,GAAG,eAAeL,QAAQ,KAAK,GAAGK,SAAS,EACjEJ,QAAQ,KAAKI,SAAS,GAAG,eAAeJ,QAAQ,KAAK,GAAGI,SAAS,EACjEH,SAAS,KAAKG,SAAS,GAAG,gBAAgBH,SAAS,KAAK,GAAGG,SAAS,EACpEF,SAAS,KAAKE,SAAS,GAAG,gBAAgBF,SAAS,KAAK,GAAGE,SAAS,CACvE,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,OAAO,CAAC;IAE/B,MAAMC,KAAK,GAAGC,MAAM,CAACC,UAAU,CAACP,UAAU,CAAC;IAC3C,MAAMQ,OAAO,GAAIC,KAA0B,IAAKnB,YAAY,CAACmB,KAAK,CAACC,OAAO,CAAC;IAE3EL,KAAK,CAACM,gBAAgB,CAAC,QAAQ,EAAEH,OAAO,CAAC;IACzCpB,UAAU,CAACwB,OAAO,GAAG,MAAMP,KAAK,CAACQ,mBAAmB,CAAC,QAAQ,EAAEL,OAAO,CAAC;IAEvE,OAAOH,KAAK,CAACK,OAAO;EACxB,CAAC,CAAC;;EAEF;EACA9B,SAAS,CAAC,MAAM,MAAMQ,UAAU,CAACwB,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC;EAE/C,OAAO;IACHvB;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export * from '../web';
4
- //# sourceMappingURL=index.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/index.web.ts"],"mappings":";;AAAA,cAAc,QAAQ","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../src/components/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAA;AACjD,OAAO,EAA2C,KAAK,0BAA0B,EAAE,MAAM,cAAc,CAAA;AACvG,OAAO,KAAK,EAAE,cAAc,IAAI,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AASjE,eAAO,MAAM,SAAS;eAJP,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,0BAA0B,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC;eAChE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;8BAgF7C,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Pressable.web.d.ts","sourceRoot":"","sources":["../../../../src/components/Pressable.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAA;AAE5D,OAAO,KAAK,EAAE,cAAc,IAAI,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAG5E,KAAK,iBAAiB,GAAG;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,KAAK,iBAAiB,GAAG,CAAC,CAAC,KAAK,EAAE,iBAAiB,KAAK,SAAS,CAAC,GAAG,SAAS,CAAA;AA4D9E,eAAO,MAAM,SAAS;eAzDP,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;YACnC,iBAAiB;8BAiH3B,CAAA"}
@@ -1,8 +0,0 @@
1
- import React, { type ComponentType } from 'react';
2
- import type { UnistylesTheme } from '../types';
3
- import type { PartialBy } from '../types/common';
4
- declare const SUPPORTED_STYLE_PROPS: readonly ["style", "contentContainerStyle"];
5
- type SupportedStyleProps = typeof SUPPORTED_STYLE_PROPS[number];
6
- export declare const createUnistylesComponent: <TProps extends Record<string, any>, TMappings extends Partial<Omit<TProps, SupportedStyleProps>>>(Component: ComponentType<TProps>, mappings?: (theme: UnistylesTheme) => TMappings) => React.ForwardRefExoticComponent<React.PropsWithoutRef<PartialBy<TProps, "style" | "contentContainerStyle" | keyof TMappings>> & React.RefAttributes<unknown>>;
7
- export {};
8
- //# sourceMappingURL=createUnistylesComponent.native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createUnistylesComponent.native.d.ts","sourceRoot":"","sources":["../../../../src/core/createUnistylesComponent.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,aAAa,EAA2C,MAAM,OAAO,CAAA;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGhD,QAAA,MAAM,qBAAqB,6CAA8C,CAAA;AACzE,KAAK,mBAAmB,GAAG,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAA;AAE/D,eAAO,MAAM,wBAAwB,GAAI,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,SAAS,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,aAAa,aAAa,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,cAAc,KAAK,SAAS,kKAyE3N,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const getBoundArgs: (fn: Function) => Function;
2
- //# sourceMappingURL=getBoundArgs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getBoundArgs.d.ts","sourceRoot":"","sources":["../../../../src/core/getBoundArgs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,OAAQ,QAAQ,aAcxC,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const getId: () => string;
2
- //# sourceMappingURL=getId.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getId.d.ts","sourceRoot":"","sources":["../../../../src/core/getId.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,cAAwD,CAAA"}
@@ -1,6 +0,0 @@
1
- export declare const useMedia: (config: {
2
- mq: symbol;
3
- }) => {
4
- isVisible: boolean;
5
- };
6
- //# sourceMappingURL=useMedia.web.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useMedia.web.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useMedia.web.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,WAAY;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;;CA2C9C,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from '../web';
2
- //# sourceMappingURL=index.web.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/specs/index.web.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
@@ -1,89 +0,0 @@
1
- import React, { forwardRef, useRef } from 'react'
2
- import { Pressable as NativePressableReactNative, type PressableStateCallbackType } from 'react-native'
3
- import type { PressableProps as Props, View } from 'react-native'
4
- import { UnistylesShadowRegistry } from '../specs'
5
- import { getId } from '../core'
6
-
7
- type PressableProps = Props & {
8
- rawStyle?: Array<any> | ((event: PressableStateCallbackType) => Array<any>)
9
- variants?: Record<string, string | boolean>
10
- }
11
-
12
- export const Pressable = forwardRef<View, PressableProps>(({ variants, style, rawStyle, ...props }, passedRef) => {
13
- const storedRef = useRef<View | null>()
14
-
15
- return (
16
- <NativePressableReactNative
17
- {...props}
18
- ref={ref => {
19
- storedRef.current = ref
20
- const styleResult = typeof style === 'function'
21
- ? style({ pressed: false })
22
- : style
23
- const fnArgs = typeof styleResult === 'function'
24
- // @ts-expect-error - this is hidden from TS
25
- ? styleResult.getBoundArgs()
26
- : Array.isArray(styleResult)
27
- ? styleResult
28
- // @ts-expect-error - this is hidden from TS
29
- .map(style => typeof style === 'function' ? style.getBoundArgs() : [])
30
- : []
31
-
32
- if (typeof passedRef === 'object' && passedRef !== null) {
33
- passedRef.current = ref
34
- }
35
-
36
- const returnFn = typeof passedRef === 'function'
37
- ? passedRef(ref)
38
- : () => {}
39
- const unistyles = typeof rawStyle === 'function'
40
- ? rawStyle({ pressed: false })
41
- : (rawStyle ?? [])
42
-
43
- // @ts-expect-error - this is hidden from TS
44
- UnistylesShadowRegistry.add(ref, unistyles, variants, Array.isArray(styleResult) ? fnArgs : [fnArgs])
45
-
46
- return () => {
47
- // @ts-expect-error - this is hidden from TS
48
- UnistylesShadowRegistry.remove(ref)
49
-
50
- if (typeof returnFn === 'function') {
51
- returnFn()
52
- }
53
- }
54
- }}
55
- style={state => {
56
- const styleResult = typeof style === 'function'
57
- ? style(state)
58
- : style
59
- const fnArgs = typeof styleResult === 'function'
60
- // @ts-expect-error - this is hidden from TS
61
- ? styleResult.getBoundArgs()
62
- : Array.isArray(styleResult)
63
- ? styleResult
64
- // @ts-expect-error - this is hidden from TS
65
- .map(style => typeof style === 'function' ? style.getBoundArgs() : [])
66
- : []
67
- const pressId = getId()
68
- const unistyles = typeof rawStyle === 'function'
69
- ? rawStyle(state)
70
- : (rawStyle ?? [])
71
-
72
- if (storedRef.current) {
73
- // @ts-expect-error - this is hidden from TS
74
- UnistylesShadowRegistry.remove(storedRef.current)
75
- // @ts-expect-error - this is hidden from TS
76
- UnistylesShadowRegistry.add(storedRef.current, unistyles, variants, Array.isArray(styleResult) ? fnArgs : [fnArgs], pressId)
77
- }
78
-
79
- return typeof styleResult === 'function'
80
- // @ts-expect-error - this is hidden from TS
81
- ? styleResult(pressId)
82
- : Array.isArray(styleResult)
83
- // @ts-expect-error - this is hidden from TS
84
- ? styleResult.map(style => typeof style === 'function' ? style(pressId) : style)
85
- : styleResult
86
- }}
87
- />
88
- )
89
- })
@@ -1,129 +0,0 @@
1
- import React, { forwardRef, useEffect, useRef } from 'react'
2
- import { Pressable as NativePressableReactNative } from 'react-native'
3
- import type { PressableProps as Props, View, ViewStyle } from 'react-native'
4
- import { UnistylesShadowRegistry } from '../specs'
5
-
6
- type WebPressableState = {
7
- pressed: boolean,
8
- hovered: boolean,
9
- focused: boolean
10
- }
11
-
12
- type WebPressableStyle = ((state: WebPressableState) => ViewStyle) | ViewStyle
13
-
14
- type PressableProps = Props & {
15
- variants?: Record<string, string | boolean>
16
- style?: WebPressableStyle,
17
- }
18
-
19
- const initialState: WebPressableState = {
20
- pressed: false,
21
- hovered: false,
22
- focused: false
23
- }
24
-
25
- const events = {
26
- 'pointerdown': { pressed: true },
27
- 'pointerup': { pressed: false },
28
- 'pointerenter': { hovered: true },
29
- 'pointerleave': { hovered: false },
30
- 'focus': { focused: true },
31
- 'blur': { focused: false }
32
- } satisfies Partial<Record<keyof HTMLElementEventMap, Partial<WebPressableState>>>
33
-
34
- type UpdateStylesProps = {
35
- ref: View | null,
36
- style: WebPressableStyle,
37
- variants?: Record<string, string | boolean>,
38
- state: WebPressableState
39
- }
40
-
41
- const isFunctionWithBoundArgs = (fn: any): fn is Function & { getBoundArgs: Function } => {
42
- return typeof fn === 'function' && 'getBoundArgs' in fn
43
- }
44
-
45
- const extractFunctionArgs = (styleResult: any) => {
46
- return isFunctionWithBoundArgs(styleResult)
47
- ? [styleResult.getBoundArgs()]
48
- : Array.isArray(styleResult)
49
- ? styleResult.map(style => isFunctionWithBoundArgs(style) ? style.getBoundArgs() : [])
50
- : []
51
- }
52
-
53
- const extractStyleResult = (style: any) => {
54
- return typeof style === 'function'
55
- ? [style()]
56
- : Array.isArray(style)
57
- ? style.map(style => typeof style === 'function' ? style() : style)
58
- : [style]
59
- }
60
-
61
- const updateStyles = ({ ref, style, variants, state }: UpdateStylesProps) => {
62
- const styleResult = typeof style === 'function'
63
- ? style(state)
64
- : style
65
- const fnArgs = extractFunctionArgs(styleResult)
66
- const extractedResult = extractStyleResult(styleResult)
67
-
68
- // @ts-expect-error - this is hidden from TS
69
- UnistylesShadowRegistry.add(ref, extractedResult, variants, fnArgs)
70
- }
71
-
72
- export const Pressable = forwardRef<View, PressableProps>(({ variants, style, ...props }, passedRef) => {
73
- const storedRef = useRef<View | null>(null)
74
- const state = useRef<WebPressableState>(initialState)
75
- const styleRef = useRef(style)
76
-
77
- useEffect(() => {
78
- styleRef.current = style
79
- }, [style])
80
-
81
- useEffect(() => {
82
- const handler = (newState: Partial<WebPressableState>) => () => {
83
- state.current = { ...state.current, ...newState }
84
-
85
- updateStyles({
86
- ref: storedRef.current,
87
- style: styleRef.current as WebPressableStyle,
88
- variants,
89
- state: state.current
90
- })
91
- }
92
-
93
- if (!storedRef.current) {
94
- return
95
- }
96
-
97
- // ref on the web is dom element
98
- const ref = storedRef.current as unknown as HTMLDivElement
99
-
100
- Object.entries(events).forEach(([event, state]) => {
101
- ref.addEventListener(event, handler(state))
102
- })
103
-
104
- return () => {
105
- Object.entries(events).forEach(([event, state]) => {
106
- ref.removeEventListener(event, handler(state))
107
- })
108
- }
109
- }, [])
110
-
111
- return (
112
- <NativePressableReactNative
113
- {...props}
114
- ref={ref => {
115
- storedRef.current = ref
116
- updateStyles({
117
- ref,
118
- style: style as WebPressableStyle,
119
- variants,
120
- state: initialState
121
- })
122
-
123
- if (typeof passedRef === 'object' && passedRef !== null) {
124
- passedRef.current = ref
125
- }
126
- }}
127
- />
128
- )
129
- })
@@ -1,83 +0,0 @@
1
- import React, { type ComponentType, forwardRef, useEffect, useRef, useState } from 'react'
2
- import type { UnistylesTheme } from '../types'
3
- import { StyleSheet, UnistyleDependency, UnistylesRuntime, type UnistylesStyleSheet } from '../specs'
4
- import type { PartialBy } from '../types/common'
5
- import { deepMergeObjects } from '../utils'
6
-
7
- const SUPPORTED_STYLE_PROPS = ['style', 'contentContainerStyle'] as const
8
- type SupportedStyleProps = typeof SUPPORTED_STYLE_PROPS[number]
9
-
10
- export const createUnistylesComponent = <TProps extends Record<string, any>, TMappings extends Partial<Omit<TProps, SupportedStyleProps>>>(Component: ComponentType<TProps>, mappings?: (theme: UnistylesTheme) => TMappings) => {
11
- return forwardRef<unknown, PartialBy<TProps, keyof TMappings | SupportedStyleProps>>((props, ref) => {
12
- const narrowedProps = props as PartialBy<TProps, keyof TMappings | SupportedStyleProps>
13
- const [theme, setTheme] = useState<UnistylesTheme>(UnistylesRuntime.getTheme())
14
- const [, setRt] = useState(0)
15
- const stylesRef = useRef<Record<string, any>>({})
16
- const isForcedRef = useRef(false)
17
-
18
- if (!isForcedRef.current) {
19
- SUPPORTED_STYLE_PROPS.forEach(propName => {
20
- if (narrowedProps?.[propName]) {
21
- if (Array.isArray(narrowedProps[propName])) {
22
- console.error(`🦄 Unistyles: createUnistylesComponent requires ${propName} to be an object. Please check props for component: ${Component.displayName}`)
23
- }
24
-
25
- // @ts-expect-error - this is hidden from TS
26
- if (props[propName].__unistyles_name && !props[propName].__proto__?.getStyle) {
27
- console.error(`🦄 Unistyles: createUnistylesComponent received style that is not bound. You likely used the spread operator on a Unistyle style. Please check props for component: ${Component.displayName}`)
28
- }
29
-
30
- stylesRef.current = {
31
- ...stylesRef.current,
32
- [propName]: narrowedProps[propName]
33
- }
34
- }
35
- })
36
- }
37
-
38
- useEffect(() => {
39
- const removeChangeListener = (StyleSheet as UnistylesStyleSheet).addChangeListener(dependencies => {
40
- const componentDependencies = (narrowedProps.style?.__proto__.uni__dependencies || mappings?.(theme).style?.__proto__.uni__dependencies) as Array<UnistyleDependency>
41
-
42
- if (dependencies.includes(UnistyleDependency.Theme) && (!componentDependencies ||componentDependencies.includes(UnistyleDependency.Theme))) {
43
- setTheme(UnistylesRuntime.getTheme())
44
-
45
- // override with Unistyles styles
46
- SUPPORTED_STYLE_PROPS.forEach(propName => {
47
- if (narrowedProps?.[propName]) {
48
- stylesRef.current = {
49
- ...stylesRef.current,
50
- // @ts-expect-error - this is hidden from TS
51
- [propName]: props[propName].__proto__?.getStyle?.() || props[propName]
52
- }
53
- }
54
- })
55
-
56
- isForcedRef.current = true
57
- }
58
-
59
- if (dependencies.some(dependency => dependency >= 2) && (!componentDependencies || componentDependencies.some(dependency => dependency >= 2))) {
60
- setRt(prevState => prevState + 1)
61
- }
62
- })
63
-
64
- return () => {
65
- removeChangeListener()
66
- }
67
- }, [])
68
-
69
- const mergedProps = mappings?.(theme) as Record<string, any> ?? {}
70
- const finalProps = deepMergeObjects(mergedProps, props)
71
-
72
- // override with Unistyles styles
73
- SUPPORTED_STYLE_PROPS.forEach(propName => {
74
- if (finalProps[propName]) {
75
- finalProps[propName] = stylesRef.current[propName]
76
- }
77
- })
78
-
79
- isForcedRef.current = false
80
-
81
- return <Component {...finalProps as TProps} ref={ref} />
82
- })
83
- }