@niibase/uniwind 1.0.0

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 (439) hide show
  1. package/LICENSE +20 -0
  2. package/dist/common/components/index.js +314 -0
  3. package/dist/common/components/native/ActivityIndicator.js +21 -0
  4. package/dist/common/components/native/Button.js +18 -0
  5. package/dist/common/components/native/FlatList.js +30 -0
  6. package/dist/common/components/native/Image.js +21 -0
  7. package/dist/common/components/native/ImageBackground.js +23 -0
  8. package/dist/common/components/native/InputAccessoryView.js +21 -0
  9. package/dist/common/components/native/KeyboardAvoidingView.js +20 -0
  10. package/dist/common/components/native/Modal.js +21 -0
  11. package/dist/common/components/native/Pressable.js +29 -0
  12. package/dist/common/components/native/RefreshControl.js +27 -0
  13. package/dist/common/components/native/SafeAreaView.js +18 -0
  14. package/dist/common/components/native/ScrollView.js +23 -0
  15. package/dist/common/components/native/SectionList.js +27 -0
  16. package/dist/common/components/native/Switch.js +32 -0
  17. package/dist/common/components/native/Text.js +36 -0
  18. package/dist/common/components/native/TextInput.js +53 -0
  19. package/dist/common/components/native/TouchableHighlight.js +35 -0
  20. package/dist/common/components/native/TouchableNativeFeedback.js +32 -0
  21. package/dist/common/components/native/TouchableOpacity.js +32 -0
  22. package/dist/common/components/native/TouchableWithoutFeedback.js +32 -0
  23. package/dist/common/components/native/View.js +18 -0
  24. package/dist/common/components/native/VirtualizedList.js +27 -0
  25. package/dist/common/components/native/useStyle.js +29 -0
  26. package/dist/common/components/utils.js +18 -0
  27. package/dist/common/components/web/ActivityIndicator.js +20 -0
  28. package/dist/common/components/web/Button.js +18 -0
  29. package/dist/common/components/web/FlatList.js +22 -0
  30. package/dist/common/components/web/Image.js +20 -0
  31. package/dist/common/components/web/ImageBackground.js +21 -0
  32. package/dist/common/components/web/KeyboardAvoidingView.js +18 -0
  33. package/dist/common/components/web/Modal.js +17 -0
  34. package/dist/common/components/web/Pressable.js +17 -0
  35. package/dist/common/components/web/RefreshControl.js +17 -0
  36. package/dist/common/components/web/SafeAreaView.js +17 -0
  37. package/dist/common/components/web/ScrollView.js +18 -0
  38. package/dist/common/components/web/SectionList.js +20 -0
  39. package/dist/common/components/web/Switch.js +26 -0
  40. package/dist/common/components/web/Text.js +17 -0
  41. package/dist/common/components/web/TextInput.js +17 -0
  42. package/dist/common/components/web/TouchableHighlight.js +20 -0
  43. package/dist/common/components/web/TouchableNativeFeedback.js +13 -0
  44. package/dist/common/components/web/TouchableOpacity.js +17 -0
  45. package/dist/common/components/web/TouchableWithoutFeedback.js +17 -0
  46. package/dist/common/components/web/View.js +17 -0
  47. package/dist/common/components/web/VirtualizedList.js +20 -0
  48. package/dist/common/components/web/index.js +187 -0
  49. package/dist/common/components/web/metro-injected.js +1 -0
  50. package/dist/common/components/web/rnw.js +42 -0
  51. package/dist/common/core/config/config.common.js +80 -0
  52. package/dist/common/core/config/config.js +51 -0
  53. package/dist/common/core/config/config.native.js +67 -0
  54. package/dist/common/core/config/index.js +16 -0
  55. package/dist/common/core/index.js +16 -0
  56. package/dist/common/core/listener.js +51 -0
  57. package/dist/common/core/logger.js +18 -0
  58. package/dist/common/core/native/index.js +27 -0
  59. package/dist/common/core/native/native-utils.js +36 -0
  60. package/dist/common/core/native/parsers/boxShadow.js +10 -0
  61. package/dist/common/core/native/parsers/fontVariant.js +8 -0
  62. package/dist/common/core/native/parsers/gradient.js +31 -0
  63. package/dist/common/core/native/parsers/index.js +60 -0
  64. package/dist/common/core/native/parsers/textShadow.js +39 -0
  65. package/dist/common/core/native/parsers/transforms.js +44 -0
  66. package/dist/common/core/native/runtime.js +34 -0
  67. package/dist/common/core/native/store.js +181 -0
  68. package/dist/common/core/types.js +1 -0
  69. package/dist/common/core/web/cssListener.js +146 -0
  70. package/dist/common/core/web/formatColor.js +15 -0
  71. package/dist/common/core/web/getWebStyles.js +51 -0
  72. package/dist/common/core/web/index.js +49 -0
  73. package/dist/common/core/web/parseCSSValue.js +15 -0
  74. package/dist/common/css/index.js +26 -0
  75. package/dist/common/css/insets.js +64 -0
  76. package/dist/common/css/processFunctions.js +54 -0
  77. package/dist/common/css/themes.js +95 -0
  78. package/dist/common/css/variants.js +16 -0
  79. package/dist/common/hoc/index.js +16 -0
  80. package/dist/common/hoc/types.js +1 -0
  81. package/dist/common/hoc/withUniwind.js +95 -0
  82. package/dist/common/hoc/withUniwind.native.js +106 -0
  83. package/dist/common/hoc/withUniwindUtils.js +16 -0
  84. package/dist/common/hooks/index.js +49 -0
  85. package/dist/common/hooks/useCSSVariable/getVariableValue.js +19 -0
  86. package/dist/common/hooks/useCSSVariable/getVariableValue.native.js +9 -0
  87. package/dist/common/hooks/useCSSVariable/index.js +16 -0
  88. package/dist/common/hooks/useCSSVariable/useCSSVariable.js +58 -0
  89. package/dist/common/hooks/useResolveClassNames.js +22 -0
  90. package/dist/common/hooks/useResolveClassNames.native.js +29 -0
  91. package/dist/common/hooks/useUniwind.js +28 -0
  92. package/dist/common/hooks/useUniwindAccent.js +13 -0
  93. package/dist/common/hooks/useUniwindAccent.native.js +12 -0
  94. package/dist/common/index.js +38 -0
  95. package/dist/common/types.js +28 -0
  96. package/dist/common/utils/buildDtsFile.js +18 -0
  97. package/dist/common/utils/stringifyThemes.js +8 -0
  98. package/dist/common/vite/index.d.ts +9 -0
  99. package/dist/common/vite/index.js +16 -0
  100. package/dist/common/vite/vite.js +72 -0
  101. package/dist/metro/index.cjs +166 -0
  102. package/dist/metro/index.d.ts +15 -0
  103. package/dist/metro/index.mjs +158 -0
  104. package/dist/metro/metro-transformer.cjs +1565 -0
  105. package/dist/metro/metro-transformer.mjs +1558 -0
  106. package/dist/module/components/index.d.ts +0 -0
  107. package/dist/module/components/index.js +312 -0
  108. package/dist/module/components/native/ActivityIndicator.d.ts +3 -0
  109. package/dist/module/components/native/ActivityIndicator.js +18 -0
  110. package/dist/module/components/native/Button.d.ts +3 -0
  111. package/dist/module/components/native/Button.js +15 -0
  112. package/dist/module/components/native/FlatList.d.ts +3 -0
  113. package/dist/module/components/native/FlatList.js +27 -0
  114. package/dist/module/components/native/Image.d.ts +3 -0
  115. package/dist/module/components/native/Image.js +18 -0
  116. package/dist/module/components/native/ImageBackground.d.ts +3 -0
  117. package/dist/module/components/native/ImageBackground.js +20 -0
  118. package/dist/module/components/native/InputAccessoryView.d.ts +3 -0
  119. package/dist/module/components/native/InputAccessoryView.js +21 -0
  120. package/dist/module/components/native/KeyboardAvoidingView.d.ts +3 -0
  121. package/dist/module/components/native/KeyboardAvoidingView.js +17 -0
  122. package/dist/module/components/native/Modal.d.ts +3 -0
  123. package/dist/module/components/native/Modal.js +18 -0
  124. package/dist/module/components/native/Pressable.d.ts +3 -0
  125. package/dist/module/components/native/Pressable.js +29 -0
  126. package/dist/module/components/native/RefreshControl.d.ts +3 -0
  127. package/dist/module/components/native/RefreshControl.js +24 -0
  128. package/dist/module/components/native/SafeAreaView.d.ts +3 -0
  129. package/dist/module/components/native/SafeAreaView.js +15 -0
  130. package/dist/module/components/native/ScrollView.d.ts +3 -0
  131. package/dist/module/components/native/ScrollView.js +20 -0
  132. package/dist/module/components/native/SectionList.d.ts +3 -0
  133. package/dist/module/components/native/SectionList.js +24 -0
  134. package/dist/module/components/native/Switch.d.ts +3 -0
  135. package/dist/module/components/native/Switch.js +26 -0
  136. package/dist/module/components/native/Text.d.ts +3 -0
  137. package/dist/module/components/native/Text.js +33 -0
  138. package/dist/module/components/native/TextInput.d.ts +3 -0
  139. package/dist/module/components/native/TextInput.js +50 -0
  140. package/dist/module/components/native/TouchableHighlight.d.ts +3 -0
  141. package/dist/module/components/native/TouchableHighlight.js +32 -0
  142. package/dist/module/components/native/TouchableNativeFeedback.d.ts +3 -0
  143. package/dist/module/components/native/TouchableNativeFeedback.js +29 -0
  144. package/dist/module/components/native/TouchableOpacity.d.ts +3 -0
  145. package/dist/module/components/native/TouchableOpacity.js +29 -0
  146. package/dist/module/components/native/TouchableWithoutFeedback.d.ts +3 -0
  147. package/dist/module/components/native/TouchableWithoutFeedback.js +29 -0
  148. package/dist/module/components/native/View.d.ts +3 -0
  149. package/dist/module/components/native/View.js +15 -0
  150. package/dist/module/components/native/VirtualizedList.d.ts +3 -0
  151. package/dist/module/components/native/VirtualizedList.js +24 -0
  152. package/dist/module/components/native/useStyle.d.ts +2 -0
  153. package/dist/module/components/native/useStyle.js +22 -0
  154. package/dist/module/components/utils.d.ts +1 -0
  155. package/dist/module/components/utils.js +11 -0
  156. package/dist/module/components/web/ActivityIndicator.d.ts +3 -0
  157. package/dist/module/components/web/ActivityIndicator.js +17 -0
  158. package/dist/module/components/web/Button.d.ts +3 -0
  159. package/dist/module/components/web/Button.js +15 -0
  160. package/dist/module/components/web/FlatList.d.ts +3 -0
  161. package/dist/module/components/web/FlatList.js +19 -0
  162. package/dist/module/components/web/Image.d.ts +3 -0
  163. package/dist/module/components/web/Image.js +17 -0
  164. package/dist/module/components/web/ImageBackground.d.ts +3 -0
  165. package/dist/module/components/web/ImageBackground.js +18 -0
  166. package/dist/module/components/web/KeyboardAvoidingView.d.ts +3 -0
  167. package/dist/module/components/web/KeyboardAvoidingView.js +15 -0
  168. package/dist/module/components/web/Modal.d.ts +3 -0
  169. package/dist/module/components/web/Modal.js +14 -0
  170. package/dist/module/components/web/Pressable.d.ts +3 -0
  171. package/dist/module/components/web/Pressable.js +14 -0
  172. package/dist/module/components/web/RefreshControl.d.ts +3 -0
  173. package/dist/module/components/web/RefreshControl.js +14 -0
  174. package/dist/module/components/web/SafeAreaView.d.ts +3 -0
  175. package/dist/module/components/web/SafeAreaView.js +14 -0
  176. package/dist/module/components/web/ScrollView.d.ts +3 -0
  177. package/dist/module/components/web/ScrollView.js +15 -0
  178. package/dist/module/components/web/SectionList.d.ts +3 -0
  179. package/dist/module/components/web/SectionList.js +17 -0
  180. package/dist/module/components/web/Switch.d.ts +3 -0
  181. package/dist/module/components/web/Switch.js +20 -0
  182. package/dist/module/components/web/Text.d.ts +3 -0
  183. package/dist/module/components/web/Text.js +14 -0
  184. package/dist/module/components/web/TextInput.d.ts +3 -0
  185. package/dist/module/components/web/TextInput.js +14 -0
  186. package/dist/module/components/web/TouchableHighlight.d.ts +3 -0
  187. package/dist/module/components/web/TouchableHighlight.js +17 -0
  188. package/dist/module/components/web/TouchableNativeFeedback.d.ts +2 -0
  189. package/dist/module/components/web/TouchableNativeFeedback.js +2 -0
  190. package/dist/module/components/web/TouchableOpacity.d.ts +3 -0
  191. package/dist/module/components/web/TouchableOpacity.js +14 -0
  192. package/dist/module/components/web/TouchableWithoutFeedback.d.ts +3 -0
  193. package/dist/module/components/web/TouchableWithoutFeedback.js +14 -0
  194. package/dist/module/components/web/View.d.ts +3 -0
  195. package/dist/module/components/web/View.js +14 -0
  196. package/dist/module/components/web/VirtualizedList.d.ts +3 -0
  197. package/dist/module/components/web/VirtualizedList.js +17 -0
  198. package/dist/module/components/web/index.d.ts +22 -0
  199. package/dist/module/components/web/index.js +22 -0
  200. package/dist/module/components/web/metro-injected.d.ts +0 -0
  201. package/dist/module/components/web/metro-injected.js +0 -0
  202. package/dist/module/components/web/rnw.d.ts +2 -0
  203. package/dist/module/components/web/rnw.js +35 -0
  204. package/dist/module/core/config/config.common.d.ts +18 -0
  205. package/dist/module/core/config/config.common.js +74 -0
  206. package/dist/module/core/config/config.d.ts +11 -0
  207. package/dist/module/core/config/config.js +48 -0
  208. package/dist/module/core/config/config.native.d.ts +12 -0
  209. package/dist/module/core/config/config.native.js +61 -0
  210. package/dist/module/core/config/index.d.ts +1 -0
  211. package/dist/module/core/config/index.js +1 -0
  212. package/dist/module/core/index.d.ts +1 -0
  213. package/dist/module/core/index.js +1 -0
  214. package/dist/module/core/listener.d.ts +12 -0
  215. package/dist/module/core/listener.js +45 -0
  216. package/dist/module/core/logger.d.ts +5 -0
  217. package/dist/module/core/logger.js +11 -0
  218. package/dist/module/core/native/index.d.ts +2 -0
  219. package/dist/module/core/native/index.js +2 -0
  220. package/dist/module/core/native/native-utils.d.ts +4 -0
  221. package/dist/module/core/native/native-utils.js +27 -0
  222. package/dist/module/core/native/parsers/boxShadow.d.ts +1 -0
  223. package/dist/module/core/native/parsers/boxShadow.js +3 -0
  224. package/dist/module/core/native/parsers/fontVariant.d.ts +1 -0
  225. package/dist/module/core/native/parsers/fontVariant.js +1 -0
  226. package/dist/module/core/native/parsers/gradient.d.ts +8 -0
  227. package/dist/module/core/native/parsers/gradient.js +26 -0
  228. package/dist/module/core/native/parsers/index.d.ts +5 -0
  229. package/dist/module/core/native/parsers/index.js +5 -0
  230. package/dist/module/core/native/parsers/textShadow.d.ts +1 -0
  231. package/dist/module/core/native/parsers/textShadow.js +32 -0
  232. package/dist/module/core/native/parsers/transforms.d.ts +1 -0
  233. package/dist/module/core/native/parsers/transforms.js +48 -0
  234. package/dist/module/core/native/runtime.d.ts +2 -0
  235. package/dist/module/core/native/runtime.js +28 -0
  236. package/dist/module/core/native/store.d.ts +19 -0
  237. package/dist/module/core/native/store.js +172 -0
  238. package/dist/module/core/types.d.ts +73 -0
  239. package/dist/module/core/types.js +0 -0
  240. package/dist/module/core/web/cssListener.d.ts +19 -0
  241. package/dist/module/core/web/cssListener.js +137 -0
  242. package/dist/module/core/web/formatColor.d.ts +1 -0
  243. package/dist/module/core/web/formatColor.js +8 -0
  244. package/dist/module/core/web/getWebStyles.d.ts +2 -0
  245. package/dist/module/core/web/getWebStyles.js +49 -0
  246. package/dist/module/core/web/index.d.ts +4 -0
  247. package/dist/module/core/web/index.js +4 -0
  248. package/dist/module/core/web/parseCSSValue.d.ts +1 -0
  249. package/dist/module/core/web/parseCSSValue.js +8 -0
  250. package/dist/module/css/index.d.ts +1 -0
  251. package/dist/module/css/index.js +25 -0
  252. package/dist/module/css/insets.d.ts +1 -0
  253. package/dist/module/css/insets.js +63 -0
  254. package/dist/module/css/processFunctions.d.ts +2 -0
  255. package/dist/module/css/processFunctions.js +36 -0
  256. package/dist/module/css/themes.d.ts +1 -0
  257. package/dist/module/css/themes.js +97 -0
  258. package/dist/module/css/variants.d.ts +1 -0
  259. package/dist/module/css/variants.js +9 -0
  260. package/dist/module/hoc/index.d.ts +1 -0
  261. package/dist/module/hoc/index.js +1 -0
  262. package/dist/module/hoc/types.d.ts +27 -0
  263. package/dist/module/hoc/types.js +0 -0
  264. package/dist/module/hoc/withUniwind.d.ts +2 -0
  265. package/dist/module/hoc/withUniwind.js +76 -0
  266. package/dist/module/hoc/withUniwind.native.d.ts +2 -0
  267. package/dist/module/hoc/withUniwind.native.js +81 -0
  268. package/dist/module/hoc/withUniwindUtils.d.ts +5 -0
  269. package/dist/module/hoc/withUniwindUtils.js +5 -0
  270. package/dist/module/hooks/index.d.ts +4 -0
  271. package/dist/module/hooks/index.js +4 -0
  272. package/dist/module/hooks/useCSSVariable/getVariableValue.d.ts +1 -0
  273. package/dist/module/hooks/useCSSVariable/getVariableValue.js +12 -0
  274. package/dist/module/hooks/useCSSVariable/getVariableValue.native.d.ts +1 -0
  275. package/dist/module/hooks/useCSSVariable/getVariableValue.native.js +2 -0
  276. package/dist/module/hooks/useCSSVariable/index.d.ts +1 -0
  277. package/dist/module/hooks/useCSSVariable/index.js +1 -0
  278. package/dist/module/hooks/useCSSVariable/useCSSVariable.d.ts +13 -0
  279. package/dist/module/hooks/useCSSVariable/useCSSVariable.js +56 -0
  280. package/dist/module/hooks/useResolveClassNames.d.ts +2 -0
  281. package/dist/module/hooks/useResolveClassNames.js +18 -0
  282. package/dist/module/hooks/useResolveClassNames.native.d.ts +2 -0
  283. package/dist/module/hooks/useResolveClassNames.native.js +22 -0
  284. package/dist/module/hooks/useUniwind.d.ts +5 -0
  285. package/dist/module/hooks/useUniwind.js +21 -0
  286. package/dist/module/hooks/useUniwindAccent.d.ts +1 -0
  287. package/dist/module/hooks/useUniwindAccent.js +6 -0
  288. package/dist/module/hooks/useUniwindAccent.native.d.ts +2 -0
  289. package/dist/module/hooks/useUniwindAccent.native.js +5 -0
  290. package/dist/module/index.d.ts +5 -0
  291. package/dist/module/index.js +3 -0
  292. package/dist/module/types.d.ts +21 -0
  293. package/dist/module/types.js +22 -0
  294. package/dist/module/utils/buildDtsFile.d.ts +1 -0
  295. package/dist/module/utils/buildDtsFile.js +22 -0
  296. package/dist/module/utils/stringifyThemes.d.ts +1 -0
  297. package/dist/module/utils/stringifyThemes.js +1 -0
  298. package/dist/module/vite/index.d.ts +9 -0
  299. package/dist/module/vite/index.js +1 -0
  300. package/dist/module/vite/vite.d.ts +8 -0
  301. package/dist/module/vite/vite.js +73 -0
  302. package/dist/shared/uniwind.BZIuaszw.cjs +11 -0
  303. package/dist/shared/uniwind.BgZDHdUR.cjs +81 -0
  304. package/dist/shared/uniwind.Bt3kqZo6.mjs +290 -0
  305. package/dist/shared/uniwind.CyoRUwOj.mjs +9 -0
  306. package/dist/shared/uniwind.D3fvrgEG.mjs +68 -0
  307. package/dist/shared/uniwind.D_6s2EM-.cjs +301 -0
  308. package/dist/vite/index.cjs +80 -0
  309. package/dist/vite/index.d.ts +9 -0
  310. package/dist/vite/index.mjs +74 -0
  311. package/metro/package.json +3 -0
  312. package/package.json +106 -0
  313. package/readme.md +71 -0
  314. package/src/components/index.ts +313 -0
  315. package/src/components/native/ActivityIndicator.tsx +19 -0
  316. package/src/components/native/Button.tsx +16 -0
  317. package/src/components/native/FlatList.tsx +28 -0
  318. package/src/components/native/Image.tsx +19 -0
  319. package/src/components/native/ImageBackground.tsx +21 -0
  320. package/src/components/native/InputAccessoryView.tsx +23 -0
  321. package/src/components/native/KeyboardAvoidingView.tsx +18 -0
  322. package/src/components/native/Modal.tsx +19 -0
  323. package/src/components/native/Pressable.tsx +31 -0
  324. package/src/components/native/RefreshControl.tsx +25 -0
  325. package/src/components/native/SafeAreaView.tsx +16 -0
  326. package/src/components/native/ScrollView.tsx +21 -0
  327. package/src/components/native/SectionList.tsx +25 -0
  328. package/src/components/native/Switch.tsx +28 -0
  329. package/src/components/native/Text.tsx +39 -0
  330. package/src/components/native/TextInput.tsx +52 -0
  331. package/src/components/native/TouchableHighlight.tsx +34 -0
  332. package/src/components/native/TouchableNativeFeedback.tsx +31 -0
  333. package/src/components/native/TouchableOpacity.tsx +31 -0
  334. package/src/components/native/TouchableWithoutFeedback.tsx +31 -0
  335. package/src/components/native/View.tsx +16 -0
  336. package/src/components/native/VirtualizedList.tsx +25 -0
  337. package/src/components/native/useStyle.ts +33 -0
  338. package/src/components/utils.ts +16 -0
  339. package/src/components/web/ActivityIndicator.tsx +18 -0
  340. package/src/components/web/Button.tsx +16 -0
  341. package/src/components/web/FlatList.tsx +20 -0
  342. package/src/components/web/Image.tsx +18 -0
  343. package/src/components/web/ImageBackground.tsx +19 -0
  344. package/src/components/web/KeyboardAvoidingView.tsx +15 -0
  345. package/src/components/web/Modal.tsx +14 -0
  346. package/src/components/web/Pressable.tsx +14 -0
  347. package/src/components/web/RefreshControl.tsx +14 -0
  348. package/src/components/web/SafeAreaView.tsx +14 -0
  349. package/src/components/web/ScrollView.tsx +15 -0
  350. package/src/components/web/SectionList.tsx +17 -0
  351. package/src/components/web/Switch.tsx +21 -0
  352. package/src/components/web/Text.tsx +14 -0
  353. package/src/components/web/TextInput.tsx +14 -0
  354. package/src/components/web/TouchableHighlight.tsx +18 -0
  355. package/src/components/web/TouchableNativeFeedback.tsx +2 -0
  356. package/src/components/web/TouchableOpacity.tsx +14 -0
  357. package/src/components/web/TouchableWithoutFeedback.tsx +14 -0
  358. package/src/components/web/View.tsx +14 -0
  359. package/src/components/web/VirtualizedList.tsx +17 -0
  360. package/src/components/web/index.ts +22 -0
  361. package/src/components/web/metro-injected.ts +1 -0
  362. package/src/components/web/rnw.ts +52 -0
  363. package/src/core/config/config.common.ts +98 -0
  364. package/src/core/config/config.native.ts +79 -0
  365. package/src/core/config/config.ts +64 -0
  366. package/src/core/config/index.ts +1 -0
  367. package/src/core/index.ts +1 -0
  368. package/src/core/listener.ts +59 -0
  369. package/src/core/logger.ts +15 -0
  370. package/src/core/native/index.ts +2 -0
  371. package/src/core/native/native-utils.ts +41 -0
  372. package/src/core/native/parsers/boxShadow.ts +7 -0
  373. package/src/core/native/parsers/fontVariant.ts +3 -0
  374. package/src/core/native/parsers/gradient.ts +39 -0
  375. package/src/core/native/parsers/index.ts +5 -0
  376. package/src/core/native/parsers/textShadow.ts +37 -0
  377. package/src/core/native/parsers/transforms.ts +64 -0
  378. package/src/core/native/runtime.ts +32 -0
  379. package/src/core/native/store.ts +238 -0
  380. package/src/core/types.ts +92 -0
  381. package/src/core/web/cssListener.ts +185 -0
  382. package/src/core/web/formatColor.ts +13 -0
  383. package/src/core/web/getWebStyles.ts +76 -0
  384. package/src/core/web/index.ts +4 -0
  385. package/src/core/web/parseCSSValue.ts +10 -0
  386. package/src/css/index.ts +32 -0
  387. package/src/css/insets.ts +73 -0
  388. package/src/css/processFunctions.ts +39 -0
  389. package/src/css/themes.ts +130 -0
  390. package/src/css/variants.ts +11 -0
  391. package/src/hoc/index.ts +1 -0
  392. package/src/hoc/types.ts +45 -0
  393. package/src/hoc/withUniwind.native.tsx +118 -0
  394. package/src/hoc/withUniwind.tsx +115 -0
  395. package/src/hoc/withUniwindUtils.ts +10 -0
  396. package/src/hooks/index.ts +4 -0
  397. package/src/hooks/useCSSVariable/getVariableValue.native.ts +3 -0
  398. package/src/hooks/useCSSVariable/getVariableValue.ts +19 -0
  399. package/src/hooks/useCSSVariable/index.ts +1 -0
  400. package/src/hooks/useCSSVariable/useCSSVariable.ts +89 -0
  401. package/src/hooks/useResolveClassNames.native.ts +29 -0
  402. package/src/hooks/useResolveClassNames.ts +26 -0
  403. package/src/hooks/useUniwind.ts +26 -0
  404. package/src/hooks/useUniwindAccent.native.ts +8 -0
  405. package/src/hooks/useUniwindAccent.ts +10 -0
  406. package/src/index.ts +5 -0
  407. package/src/metro/addMetaToStylesTemplate.ts +152 -0
  408. package/src/metro/compileVirtual.ts +74 -0
  409. package/src/metro/index.d.ts +15 -0
  410. package/src/metro/index.ts +1 -0
  411. package/src/metro/injectThemes.ts +23 -0
  412. package/src/metro/logger.ts +44 -0
  413. package/src/metro/metro-css-patches.ts +57 -0
  414. package/src/metro/metro-transformer.ts +99 -0
  415. package/src/metro/polyfillWeb.ts +14 -0
  416. package/src/metro/processor/color.ts +76 -0
  417. package/src/metro/processor/css.ts +541 -0
  418. package/src/metro/processor/functions.ts +199 -0
  419. package/src/metro/processor/index.ts +1 -0
  420. package/src/metro/processor/mq.ts +82 -0
  421. package/src/metro/processor/processor.ts +249 -0
  422. package/src/metro/processor/rn.ts +277 -0
  423. package/src/metro/processor/units.ts +58 -0
  424. package/src/metro/processor/var.ts +18 -0
  425. package/src/metro/resolvers.ts +101 -0
  426. package/src/metro/types.ts +74 -0
  427. package/src/metro/utils/common.ts +103 -0
  428. package/src/metro/utils/index.ts +2 -0
  429. package/src/metro/utils/serialize.ts +116 -0
  430. package/src/metro/withUniwindConfig.ts +60 -0
  431. package/src/types.ts +24 -0
  432. package/src/utils/buildDtsFile.ts +27 -0
  433. package/src/utils/stringifyThemes.ts +1 -0
  434. package/src/vite/index.d.ts +9 -0
  435. package/src/vite/index.ts +1 -0
  436. package/src/vite/vite.ts +86 -0
  437. package/types.d.ts +109 -0
  438. package/uniwind.css +262 -0
  439. package/vite/package.json +3 -0
@@ -0,0 +1,20 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Switch as RNSwitch } from "react-native";
3
+ import { useUniwindAccent } from "../../hooks/index.js";
4
+ import { copyComponentProperties } from "../utils.js";
5
+ import { toRNWClassName } from "./rnw.js";
6
+ export const Switch = copyComponentProperties(RNSwitch, (props) => {
7
+ const trackColorOn = useUniwindAccent(props.trackColorOnClassName);
8
+ const trackColorOff = useUniwindAccent(props.trackColorOffClassName);
9
+ const thumbColor = useUniwindAccent(props.thumbColorClassName);
10
+ return /* @__PURE__ */ jsx(
11
+ RNSwitch,
12
+ {
13
+ ...props,
14
+ style: [toRNWClassName(props.className), props.style],
15
+ thumbColor: props.thumbColor ?? thumbColor,
16
+ trackColor: { true: props.trackColor?.true ?? trackColorOn, false: props.trackColor?.false ?? trackColorOff }
17
+ }
18
+ );
19
+ });
20
+ export default Switch;
@@ -0,0 +1,3 @@
1
+ import { Text as RNText } from 'react-native';
2
+ export declare const Text: typeof RNText;
3
+ export default Text;
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Text as RNText } from "react-native";
3
+ import { copyComponentProperties } from "../utils.js";
4
+ import { toRNWClassName } from "./rnw.js";
5
+ export const Text = copyComponentProperties(RNText, (props) => {
6
+ return /* @__PURE__ */ jsx(
7
+ RNText,
8
+ {
9
+ ...props,
10
+ style: [toRNWClassName(props.className), props.style]
11
+ }
12
+ );
13
+ });
14
+ export default Text;
@@ -0,0 +1,3 @@
1
+ import { TextInput as RNTextInput } from 'react-native';
2
+ export declare const TextInput: typeof RNTextInput;
3
+ export default TextInput;
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { TextInput as RNTextInput } from "react-native";
3
+ import { copyComponentProperties } from "../utils.js";
4
+ import { toRNWClassName } from "./rnw.js";
5
+ export const TextInput = copyComponentProperties(RNTextInput, (props) => {
6
+ return /* @__PURE__ */ jsx(
7
+ RNTextInput,
8
+ {
9
+ ...props,
10
+ style: [toRNWClassName(props.className), props.style]
11
+ }
12
+ );
13
+ });
14
+ export default TextInput;
@@ -0,0 +1,3 @@
1
+ import { TouchableHighlightProps } from 'react-native';
2
+ export declare const TouchableHighlight: import("react").ForwardRefExoticComponent<TouchableHighlightProps & import("react").RefAttributes<import("react-native").View>>;
3
+ export default TouchableHighlight;
@@ -0,0 +1,17 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { TouchableHighlight as RNTouchableHighlight } from "react-native";
3
+ import { useUniwindAccent } from "../../hooks/index.js";
4
+ import { copyComponentProperties } from "../utils.js";
5
+ import { toRNWClassName } from "./rnw.js";
6
+ export const TouchableHighlight = copyComponentProperties(RNTouchableHighlight, (props) => {
7
+ const underlayColor = useUniwindAccent(props.underlayColorClassName);
8
+ return /* @__PURE__ */ jsx(
9
+ RNTouchableHighlight,
10
+ {
11
+ ...props,
12
+ style: [toRNWClassName(props.className), props.style],
13
+ underlayColor: props.underlayColor ?? underlayColor
14
+ }
15
+ );
16
+ });
17
+ export default TouchableHighlight;
@@ -0,0 +1,2 @@
1
+ import './rnw';
2
+ export { TouchableNativeFeedback } from 'react-native';
@@ -0,0 +1,2 @@
1
+ import "./rnw";
2
+ export { TouchableNativeFeedback } from "react-native";
@@ -0,0 +1,3 @@
1
+ import { TouchableOpacityProps } from 'react-native';
2
+ export declare const TouchableOpacity: import("react").ForwardRefExoticComponent<TouchableOpacityProps & import("react").RefAttributes<import("react-native").View>>;
3
+ export default TouchableOpacity;
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { TouchableOpacity as RNTouchableOpacity } from "react-native";
3
+ import { copyComponentProperties } from "../utils.js";
4
+ import { toRNWClassName } from "./rnw.js";
5
+ export const TouchableOpacity = copyComponentProperties(RNTouchableOpacity, (props) => {
6
+ return /* @__PURE__ */ jsx(
7
+ RNTouchableOpacity,
8
+ {
9
+ ...props,
10
+ style: [toRNWClassName(props.className), props.style]
11
+ }
12
+ );
13
+ });
14
+ export default TouchableOpacity;
@@ -0,0 +1,3 @@
1
+ import { TouchableWithoutFeedback as RNTouchableWithoutFeedback } from 'react-native';
2
+ export declare const TouchableWithoutFeedback: typeof RNTouchableWithoutFeedback;
3
+ export default TouchableWithoutFeedback;
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { TouchableWithoutFeedback as RNTouchableWithoutFeedback } from "react-native";
3
+ import { copyComponentProperties } from "../utils.js";
4
+ import { toRNWClassName } from "./rnw.js";
5
+ export const TouchableWithoutFeedback = copyComponentProperties(RNTouchableWithoutFeedback, (props) => {
6
+ return /* @__PURE__ */ jsx(
7
+ RNTouchableWithoutFeedback,
8
+ {
9
+ ...props,
10
+ style: [toRNWClassName(props.className), props.style]
11
+ }
12
+ );
13
+ });
14
+ export default TouchableWithoutFeedback;
@@ -0,0 +1,3 @@
1
+ import { View as RNView } from 'react-native';
2
+ export declare const View: typeof RNView;
3
+ export default View;
@@ -0,0 +1,14 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { View as RNView } from "react-native";
3
+ import { copyComponentProperties } from "../utils.js";
4
+ import { toRNWClassName } from "./rnw.js";
5
+ export const View = copyComponentProperties(RNView, (props) => {
6
+ return /* @__PURE__ */ jsx(
7
+ RNView,
8
+ {
9
+ ...props,
10
+ style: [toRNWClassName(props.className), props.style]
11
+ }
12
+ );
13
+ });
14
+ export default View;
@@ -0,0 +1,3 @@
1
+ import { VirtualizedList as RNVirtualizedList } from 'react-native';
2
+ export declare const VirtualizedList: typeof RNVirtualizedList;
3
+ export default VirtualizedList;
@@ -0,0 +1,17 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { VirtualizedList as RNVirtualizedList } from "react-native";
3
+ import { copyComponentProperties } from "../utils.js";
4
+ import { toRNWClassName } from "./rnw.js";
5
+ export const VirtualizedList = copyComponentProperties(RNVirtualizedList, (props) => {
6
+ return /* @__PURE__ */ jsx(
7
+ RNVirtualizedList,
8
+ {
9
+ ...props,
10
+ style: [toRNWClassName(props.className), props.style],
11
+ contentContainerStyle: [toRNWClassName(props.contentContainerClassName), props.contentContainerStyle],
12
+ ListFooterComponentStyle: [toRNWClassName(props.ListFooterComponentClassName), props.ListFooterComponentStyle],
13
+ ListHeaderComponentStyle: [toRNWClassName(props.ListHeaderComponentClassName), props.ListHeaderComponentStyle]
14
+ }
15
+ );
16
+ });
17
+ export default VirtualizedList;
@@ -0,0 +1,22 @@
1
+ export * from 'react-native';
2
+ export { ActivityIndicator } from './ActivityIndicator';
3
+ export { Button } from './Button';
4
+ export { FlatList } from './FlatList';
5
+ export { Image } from './Image';
6
+ export { ImageBackground } from './ImageBackground';
7
+ export { KeyboardAvoidingView } from './KeyboardAvoidingView';
8
+ export { Modal } from './Modal';
9
+ export { Pressable } from './Pressable';
10
+ export { RefreshControl } from './RefreshControl';
11
+ export { SafeAreaView } from './SafeAreaView';
12
+ export { ScrollView } from './ScrollView';
13
+ export { SectionList } from './SectionList';
14
+ export { Switch } from './Switch';
15
+ export { Text } from './Text';
16
+ export { TextInput } from './TextInput';
17
+ export { TouchableHighlight } from './TouchableHighlight';
18
+ export { TouchableNativeFeedback } from './TouchableNativeFeedback';
19
+ export { TouchableOpacity } from './TouchableOpacity';
20
+ export { TouchableWithoutFeedback } from './TouchableWithoutFeedback';
21
+ export { View } from './View';
22
+ export { VirtualizedList } from './VirtualizedList';
@@ -0,0 +1,22 @@
1
+ export * from "react-native";
2
+ export { ActivityIndicator } from "./ActivityIndicator.js";
3
+ export { Button } from "./Button.js";
4
+ export { FlatList } from "./FlatList.js";
5
+ export { Image } from "./Image.js";
6
+ export { ImageBackground } from "./ImageBackground.js";
7
+ export { KeyboardAvoidingView } from "./KeyboardAvoidingView.js";
8
+ export { Modal } from "./Modal.js";
9
+ export { Pressable } from "./Pressable.js";
10
+ export { RefreshControl } from "./RefreshControl.js";
11
+ export { SafeAreaView } from "./SafeAreaView.js";
12
+ export { ScrollView } from "./ScrollView.js";
13
+ export { SectionList } from "./SectionList.js";
14
+ export { Switch } from "./Switch.js";
15
+ export { Text } from "./Text.js";
16
+ export { TextInput } from "./TextInput.js";
17
+ export { TouchableHighlight } from "./TouchableHighlight.js";
18
+ export { TouchableNativeFeedback } from "./TouchableNativeFeedback.js";
19
+ export { TouchableOpacity } from "./TouchableOpacity.js";
20
+ export { TouchableWithoutFeedback } from "./TouchableWithoutFeedback.js";
21
+ export { View } from "./View.js";
22
+ export { VirtualizedList } from "./VirtualizedList.js";
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ import './metro-injected';
2
+ export declare const toRNWClassName: (className?: string) => {};
@@ -0,0 +1,35 @@
1
+ import { Uniwind } from "../../core/index.js";
2
+ import { UniwindListener } from "../../core/listener.js";
3
+ import { StyleDependency } from "../../types.js";
4
+ import "./metro-injected";
5
+ const moveCssRulesToUtilitiesLayer = (sourceSheet) => {
6
+ const layerRuleIndex = sourceSheet.insertRule(
7
+ "@layer rnw {}",
8
+ 0
9
+ );
10
+ const layerRule = sourceSheet.cssRules[layerRuleIndex];
11
+ while (sourceSheet.cssRules.length > 1) {
12
+ const nextRule = sourceSheet.cssRules[1];
13
+ layerRule.insertRule(nextRule.cssText, layerRule.cssRules.length);
14
+ sourceSheet.deleteRule(1);
15
+ }
16
+ };
17
+ if (typeof window !== "undefined" && typeof document !== "undefined") {
18
+ const rnwStyleSheet = document.querySelector("#react-native-stylesheet");
19
+ if (rnwStyleSheet?.sheet) {
20
+ moveCssRulesToUtilitiesLayer(rnwStyleSheet.sheet);
21
+ }
22
+ }
23
+ const addClassNameToRoot = () => {
24
+ if (typeof document === "undefined") {
25
+ return;
26
+ }
27
+ const root = document.documentElement;
28
+ Uniwind.themes.forEach((theme) => root.classList.remove(theme));
29
+ root.classList.add(Uniwind.currentTheme);
30
+ };
31
+ UniwindListener.subscribe(() => {
32
+ addClassNameToRoot();
33
+ }, [StyleDependency.Theme]);
34
+ addClassNameToRoot();
35
+ export const toRNWClassName = (className) => className !== void 0 ? { $$css: true, tailwind: className } : {};
@@ -0,0 +1,18 @@
1
+ import { Insets } from 'react-native';
2
+ import { CSSVariables, GenerateStyleSheetsCallback, ThemeName } from '../types';
3
+ declare const SYSTEM_THEME: "system";
4
+ export declare class UniwindConfigBuilder {
5
+ #private;
6
+ protected themes: string[];
7
+ constructor();
8
+ get hasAdaptiveThemes(): boolean;
9
+ get currentTheme(): ThemeName;
10
+ private get colorScheme();
11
+ setTheme(theme: ThemeName | typeof SYSTEM_THEME): void;
12
+ updateCSSVariables(theme: ThemeName, variables: CSSVariables): void;
13
+ updateInsets(insets: Insets): void;
14
+ protected __reinit(_: GenerateStyleSheetsCallback, themes: Array<string>): void;
15
+ protected onThemeChange(): void;
16
+ }
17
+ export declare const Uniwind: UniwindConfigBuilder;
18
+ export {};
@@ -0,0 +1,74 @@
1
+ import { Appearance, Platform } from "react-native";
2
+ import { ColorScheme, StyleDependency } from "../../types.js";
3
+ import { UniwindListener } from "../listener.js";
4
+ const SYSTEM_THEME = "system";
5
+ export class UniwindConfigBuilder {
6
+ themes = ["light", "dark"];
7
+ #hasAdaptiveThemes = true;
8
+ #currentTheme = this.colorScheme;
9
+ constructor() {
10
+ Appearance.addChangeListener((event) => {
11
+ const colorScheme = event.colorScheme ?? ColorScheme.Light;
12
+ const prevTheme = this.#currentTheme;
13
+ if (this.#hasAdaptiveThemes && prevTheme !== colorScheme) {
14
+ this.#currentTheme = colorScheme;
15
+ this.onThemeChange();
16
+ UniwindListener.notify([StyleDependency.Theme]);
17
+ }
18
+ });
19
+ }
20
+ get hasAdaptiveThemes() {
21
+ return this.#hasAdaptiveThemes;
22
+ }
23
+ get currentTheme() {
24
+ return this.#currentTheme;
25
+ }
26
+ get colorScheme() {
27
+ return Appearance.getColorScheme() ?? ColorScheme.Light;
28
+ }
29
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
30
+ setTheme(theme) {
31
+ const prevTheme = this.#currentTheme;
32
+ const prevHasAdaptiveThemes = this.#hasAdaptiveThemes;
33
+ const isAdaptiveTheme = ["light", "dark"].includes(theme);
34
+ try {
35
+ if (theme === SYSTEM_THEME) {
36
+ this.#hasAdaptiveThemes = true;
37
+ this.#currentTheme = this.colorScheme;
38
+ if (Platform.OS !== "web") {
39
+ Appearance.setColorScheme(void 0);
40
+ }
41
+ return;
42
+ }
43
+ if (!this.themes.includes(theme)) {
44
+ throw new Error(`Uniwind: You're trying to setTheme to '${theme}', but it was not registered.`);
45
+ }
46
+ this.#hasAdaptiveThemes = false;
47
+ this.#currentTheme = theme;
48
+ if (Platform.OS !== "web") {
49
+ Appearance.setColorScheme(isAdaptiveTheme ? this.#currentTheme : void 0);
50
+ }
51
+ } finally {
52
+ if (prevTheme !== this.#currentTheme) {
53
+ this.onThemeChange();
54
+ UniwindListener.notify([StyleDependency.Theme]);
55
+ }
56
+ if (prevHasAdaptiveThemes !== this.#hasAdaptiveThemes) {
57
+ UniwindListener.notify([StyleDependency.AdaptiveThemes]);
58
+ }
59
+ }
60
+ }
61
+ updateCSSVariables(theme, variables) {
62
+ theme;
63
+ variables;
64
+ }
65
+ updateInsets(insets) {
66
+ insets;
67
+ }
68
+ __reinit(_, themes) {
69
+ this.themes = themes;
70
+ }
71
+ onThemeChange() {
72
+ }
73
+ }
74
+ export const Uniwind = new UniwindConfigBuilder();
@@ -0,0 +1,11 @@
1
+ import { CSSVariables, ThemeName } from '../types';
2
+ import { UniwindConfigBuilder as UniwindConfigBuilderBase } from './config.common';
3
+ declare class UniwindConfigBuilder extends UniwindConfigBuilderBase {
4
+ private runtimeCSSVariables;
5
+ constructor();
6
+ onThemeChange(): void;
7
+ updateCSSVariables(theme: ThemeName, variables: CSSVariables): void;
8
+ private applyCSSVariable;
9
+ }
10
+ export declare const Uniwind: UniwindConfigBuilder;
11
+ export {};
@@ -0,0 +1,48 @@
1
+ import { StyleDependency } from "../../types.js";
2
+ import { UniwindListener } from "../listener.js";
3
+ import { Logger } from "../logger.js";
4
+ import { UniwindConfigBuilder as UniwindConfigBuilderBase } from "./config.common.js";
5
+ class UniwindConfigBuilder extends UniwindConfigBuilderBase {
6
+ runtimeCSSVariables = /* @__PURE__ */ new Map();
7
+ constructor() {
8
+ super();
9
+ }
10
+ onThemeChange() {
11
+ if (typeof document === "undefined") {
12
+ return;
13
+ }
14
+ document.documentElement.removeAttribute("style");
15
+ const runtimeCSSVariables = this.runtimeCSSVariables.get(this.currentTheme);
16
+ if (!runtimeCSSVariables) {
17
+ return;
18
+ }
19
+ Object.entries(runtimeCSSVariables).forEach(([varName, varValue]) => {
20
+ this.applyCSSVariable(varName, varValue);
21
+ });
22
+ }
23
+ updateCSSVariables(theme, variables) {
24
+ Object.entries(variables).forEach(([varName, varValue]) => {
25
+ if (!varName.startsWith("--") && __DEV__) {
26
+ Logger.error(`CSS variable name must start with "--", instead got: ${varName}`);
27
+ return;
28
+ }
29
+ const runtimeCSSVariables = this.runtimeCSSVariables.get(theme) ?? {};
30
+ runtimeCSSVariables[varName] = varValue;
31
+ this.runtimeCSSVariables.set(theme, runtimeCSSVariables);
32
+ this.applyCSSVariable(varName, varValue);
33
+ });
34
+ if (theme === this.currentTheme) {
35
+ UniwindListener.notify([StyleDependency.Variables]);
36
+ }
37
+ }
38
+ applyCSSVariable(varName, varValue) {
39
+ if (typeof document === "undefined") {
40
+ return;
41
+ }
42
+ document.documentElement.style.setProperty(
43
+ varName,
44
+ typeof varValue === "number" ? `${varValue}px` : varValue
45
+ );
46
+ }
47
+ }
48
+ export const Uniwind = new UniwindConfigBuilder();
@@ -0,0 +1,12 @@
1
+ import { Insets } from 'react-native';
2
+ import { CSSVariables, GenerateStyleSheetsCallback, ThemeName } from '../types';
3
+ import { UniwindConfigBuilder as UniwindConfigBuilderBase } from './config.common';
4
+ declare class UniwindConfigBuilder extends UniwindConfigBuilderBase {
5
+ constructor();
6
+ __reinit(generateStyleSheetCallback: GenerateStyleSheetsCallback, themes: Array<string>): void;
7
+ onThemeChange(): void;
8
+ updateCSSVariables(theme: ThemeName, variables: CSSVariables): void;
9
+ updateInsets(insets: Insets): void;
10
+ }
11
+ export declare const Uniwind: UniwindConfigBuilder;
12
+ export {};
@@ -0,0 +1,61 @@
1
+ import { formatHex, formatHex8, parse } from "culori";
2
+ import { StyleDependency } from "../../types.js";
3
+ import { UniwindListener } from "../listener.js";
4
+ import { Logger } from "../logger.js";
5
+ import { UniwindStore } from "../native/index.js";
6
+ import { UniwindConfigBuilder as UniwindConfigBuilderBase } from "./config.common.js";
7
+ class UniwindConfigBuilder extends UniwindConfigBuilderBase {
8
+ constructor() {
9
+ super();
10
+ }
11
+ __reinit(generateStyleSheetCallback, themes) {
12
+ super.__reinit(generateStyleSheetCallback, themes);
13
+ UniwindStore.reinit(generateStyleSheetCallback);
14
+ }
15
+ onThemeChange() {
16
+ UniwindStore.runtime.currentThemeName = this.currentTheme;
17
+ UniwindStore.reinit();
18
+ }
19
+ updateCSSVariables(theme, variables) {
20
+ Object.entries(variables).forEach(([varName, varValue]) => {
21
+ if (!varName.startsWith("--") && __DEV__) {
22
+ Logger.error(`CSS variable name must start with "--", instead got: ${varName}`);
23
+ return;
24
+ }
25
+ const getValue = () => {
26
+ if (typeof varValue === "number") {
27
+ return varValue;
28
+ }
29
+ const parsedColor = parse(varValue);
30
+ if (parsedColor) {
31
+ return parsedColor.alpha === void 0 || parsedColor.alpha === 1 ? formatHex(parsedColor) : formatHex8(parsedColor);
32
+ }
33
+ return varValue;
34
+ };
35
+ const value = getValue();
36
+ const runtimeThemeVariables = UniwindStore.runtimeThemeVariables.get(theme) ?? {};
37
+ Object.defineProperty(UniwindStore.vars, varName, {
38
+ configurable: true,
39
+ enumerable: true,
40
+ get: () => value
41
+ });
42
+ Object.defineProperty(runtimeThemeVariables, varName, {
43
+ configurable: true,
44
+ enumerable: true,
45
+ get: () => value
46
+ });
47
+ UniwindStore.runtimeThemeVariables.set(theme, runtimeThemeVariables);
48
+ });
49
+ if (theme === this.currentTheme) {
50
+ UniwindListener.notify([StyleDependency.Variables]);
51
+ }
52
+ }
53
+ updateInsets(insets) {
54
+ UniwindStore.runtime.insets.bottom = insets.bottom ?? 0;
55
+ UniwindStore.runtime.insets.top = insets.top ?? 0;
56
+ UniwindStore.runtime.insets.left = insets.left ?? 0;
57
+ UniwindStore.runtime.insets.right = insets.right ?? 0;
58
+ UniwindListener.notify([StyleDependency.Insets]);
59
+ }
60
+ }
61
+ export const Uniwind = new UniwindConfigBuilder();
@@ -0,0 +1 @@
1
+ export * from './config';
@@ -0,0 +1 @@
1
+ export * from "./config.js";
@@ -0,0 +1 @@
1
+ export * from './config';
@@ -0,0 +1 @@
1
+ export * from "./config/index.js";
@@ -0,0 +1,12 @@
1
+ import { StyleDependency } from '../types';
2
+ type SubscribeOptions = {
3
+ once?: boolean;
4
+ };
5
+ declare class UniwindListenerBuilder {
6
+ private listeners;
7
+ notify(dependencies: Array<StyleDependency>): void;
8
+ notifyAll(): void;
9
+ subscribe(listener: () => void, dependencies: Array<StyleDependency>, options?: SubscribeOptions): () => void;
10
+ }
11
+ export declare const UniwindListener: UniwindListenerBuilder;
12
+ export {};
@@ -0,0 +1,45 @@
1
+ import { StyleDependency } from "../types.js";
2
+ class UniwindListenerBuilder {
3
+ listeners = {
4
+ [StyleDependency.ColorScheme]: /* @__PURE__ */ new Set(),
5
+ [StyleDependency.Theme]: /* @__PURE__ */ new Set(),
6
+ [StyleDependency.Dimensions]: /* @__PURE__ */ new Set(),
7
+ [StyleDependency.Orientation]: /* @__PURE__ */ new Set(),
8
+ [StyleDependency.Insets]: /* @__PURE__ */ new Set(),
9
+ [StyleDependency.FontScale]: /* @__PURE__ */ new Set(),
10
+ [StyleDependency.Rtl]: /* @__PURE__ */ new Set(),
11
+ [StyleDependency.AdaptiveThemes]: /* @__PURE__ */ new Set(),
12
+ [StyleDependency.Variables]: /* @__PURE__ */ new Set()
13
+ };
14
+ notify(dependencies) {
15
+ dependencies.forEach((dep) => {
16
+ this.listeners[dep].forEach((callback) => callback());
17
+ });
18
+ }
19
+ notifyAll() {
20
+ Object.values(this.listeners).forEach((listenerSet) => {
21
+ listenerSet.forEach((callback) => callback());
22
+ });
23
+ }
24
+ subscribe(listener, dependencies, options) {
25
+ const wrappedListeners = /* @__PURE__ */ new Map();
26
+ const dispose = () => {
27
+ wrappedListeners.forEach((wrappedListener, dep) => {
28
+ this.listeners[dep].delete(wrappedListener);
29
+ });
30
+ wrappedListeners.clear();
31
+ };
32
+ dependencies.forEach((dep) => {
33
+ const wrappedListener = () => {
34
+ listener();
35
+ if (options?.once) {
36
+ dispose();
37
+ }
38
+ };
39
+ wrappedListeners.set(dep, wrappedListener);
40
+ this.listeners[dep].add(wrappedListener);
41
+ });
42
+ return dispose;
43
+ }
44
+ }
45
+ export const UniwindListener = new UniwindListenerBuilder();
@@ -0,0 +1,5 @@
1
+ export declare class Logger {
2
+ static log(message: string): void;
3
+ static error(message: string): void;
4
+ static warn(message: string): void;
5
+ }
@@ -0,0 +1,11 @@
1
+ export class Logger {
2
+ static log(message) {
3
+ console.log(`Uniwind - ${message}`);
4
+ }
5
+ static error(message) {
6
+ console.error(`Uniwind - ${message}`);
7
+ }
8
+ static warn(message) {
9
+ console.warn(`Uniwind - ${message}`);
10
+ }
11
+ }
@@ -0,0 +1,2 @@
1
+ export * from './runtime';
2
+ export * from './store';
@@ -0,0 +1,2 @@
1
+ export * from "./runtime.js";
2
+ export * from "./store.js";
@@ -0,0 +1,4 @@
1
+ import type { UniwindRuntime } from '../types';
2
+ export declare const colorMix: (color: string, weight: number | string, mixColor: string) => string;
3
+ export declare function lightDark(this: UniwindRuntime, light: string, dark: string): string;
4
+ export declare const cloneWithAccessors: <T extends object>(obj: T) => any;
@@ -0,0 +1,27 @@
1
+ import { formatHex, formatHex8, interpolate, parse } from "culori";
2
+ export const colorMix = (color, weight, mixColor) => {
3
+ const parsedWeight = typeof weight === "string" ? parseFloat(weight) / 100 : weight;
4
+ if (mixColor === "#00000000") {
5
+ const parsedColor = parse(color);
6
+ if (parsedColor === void 0) {
7
+ return color;
8
+ }
9
+ return formatHex8({
10
+ ...parsedColor,
11
+ alpha: parsedWeight * (parsedColor.alpha ?? 1)
12
+ });
13
+ }
14
+ return formatHex(interpolate([mixColor, color])(parsedWeight));
15
+ };
16
+ export function lightDark(light, dark) {
17
+ if (this.currentThemeName === "dark") {
18
+ return dark;
19
+ }
20
+ return light;
21
+ }
22
+ export const cloneWithAccessors = (obj) => {
23
+ const proto = Object.getPrototypeOf(obj);
24
+ const clone = Object.create(proto);
25
+ Object.defineProperties(clone, Object.getOwnPropertyDescriptors(obj));
26
+ return clone;
27
+ };
@@ -0,0 +1 @@
1
+ export declare const parseBoxShadow: (boxShadow: string) => string;
@@ -0,0 +1,3 @@
1
+ const boxShadowRegex = /(?<![#\w.-])[+-]?(?:\d*\.\d+|\d+)(?![\w-])/g;
2
+ const undefinedRegex = /undefined/g;
3
+ export const parseBoxShadow = (boxShadow) => boxShadow.replace(boxShadowRegex, (match) => `${match}px`).replace(undefinedRegex, "");
@@ -0,0 +1 @@
1
+ export declare const parseFontVariant: (fontVariant: string) => string[];