@niibase/uniwind 1.6.4 → 1.7.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 (319) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/common/{css → bundler/artifacts/css}/index.js +1 -4
  3. package/dist/common/{css → bundler/artifacts/css}/themes.js +1 -1
  4. package/dist/common/{utils/buildDtsFile.js → bundler/artifacts/dts.js} +1 -2
  5. package/dist/common/bundler/config.js +69 -0
  6. package/dist/common/bundler/css-compiler/compileCSS.js +18 -0
  7. package/dist/common/bundler/css-compiler/compileNativeCSS.js +19 -0
  8. package/dist/common/bundler/css-compiler/compileTailwind.js +27 -0
  9. package/dist/common/bundler/css-compiler/compileWebCSS.js +15 -0
  10. package/dist/common/{vite → bundler/css-compiler}/index.js +4 -4
  11. package/dist/common/bundler/css-processor/addMetaToStylesTemplate.js +130 -0
  12. package/dist/common/bundler/css-processor/animation.js +112 -0
  13. package/dist/common/bundler/css-processor/color.js +66 -0
  14. package/dist/common/bundler/css-processor/css.js +510 -0
  15. package/dist/common/bundler/css-processor/functions.js +145 -0
  16. package/dist/common/bundler/css-processor/index.js +38 -0
  17. package/dist/common/bundler/css-processor/mq.js +87 -0
  18. package/dist/common/bundler/css-processor/processor.js +353 -0
  19. package/dist/common/bundler/css-processor/rn.js +356 -0
  20. package/dist/common/bundler/css-processor/serialize.js +86 -0
  21. package/dist/common/bundler/css-processor/types.js +1 -0
  22. package/dist/common/bundler/css-processor/units.js +55 -0
  23. package/dist/common/bundler/css-processor/utils.js +63 -0
  24. package/dist/common/bundler/css-processor/var.js +20 -0
  25. package/dist/common/{css-visitor → bundler/css-visitor}/rule-visitor.js +5 -5
  26. package/dist/common/{css-visitor → bundler/css-visitor}/visitor.js +5 -6
  27. package/dist/common/bundler/logger.js +41 -0
  28. package/dist/common/bundler/types.js +1 -0
  29. package/dist/common/common/consts.js +26 -2
  30. package/dist/common/components/web/rnw.js +2 -2
  31. package/dist/common/core/config/config.common.js +9 -9
  32. package/dist/common/core/config/config.js +2 -2
  33. package/dist/common/core/config/config.native.js +3 -3
  34. package/dist/common/core/listener.js +10 -10
  35. package/dist/common/core/native/runtime.js +7 -3
  36. package/dist/common/core/native/store.js +3 -4
  37. package/dist/common/core/web/cssListener.js +2 -2
  38. package/dist/common/hoc/withUniwind.js +5 -5
  39. package/dist/common/hoc/withUniwind.native.js +5 -5
  40. package/dist/common/hooks/useCSSVariable/useCSSVariable.js +6 -2
  41. package/dist/common/hooks/useUniwind.js +2 -2
  42. package/dist/metro/index.cjs +14 -24
  43. package/dist/metro/index.d.ts +2 -0
  44. package/dist/metro/index.mjs +7 -17
  45. package/dist/metro/{metro-transformer.cjs → transformer.cjs} +294 -174
  46. package/dist/metro/{metro-transformer.mjs → transformer.mjs} +236 -116
  47. package/dist/module/{css → bundler/artifacts/css}/index.d.ts +1 -1
  48. package/dist/module/{css → bundler/artifacts/css}/index.js +1 -4
  49. package/dist/module/{css → bundler/artifacts/css}/themes.js +1 -1
  50. package/dist/module/{utils/buildDtsFile.js → bundler/artifacts/dts.js} +3 -4
  51. package/dist/module/bundler/config.d.ts +16 -0
  52. package/dist/module/bundler/config.js +69 -0
  53. package/dist/module/bundler/css-compiler/compileCSS.d.ts +2 -0
  54. package/dist/module/bundler/css-compiler/compileCSS.js +11 -0
  55. package/dist/module/bundler/css-compiler/compileNativeCSS.d.ts +2 -0
  56. package/dist/module/bundler/css-compiler/compileNativeCSS.js +33 -0
  57. package/dist/module/bundler/css-compiler/compileTailwind.d.ts +2 -0
  58. package/dist/module/bundler/css-compiler/compileTailwind.js +22 -0
  59. package/dist/module/bundler/css-compiler/compileWebCSS.d.ts +2 -0
  60. package/dist/module/bundler/css-compiler/compileWebCSS.js +8 -0
  61. package/dist/module/bundler/css-compiler/index.d.ts +1 -0
  62. package/dist/module/bundler/css-compiler/index.js +1 -0
  63. package/dist/module/bundler/css-processor/addMetaToStylesTemplate.d.ts +3 -0
  64. package/dist/module/bundler/css-processor/addMetaToStylesTemplate.js +136 -0
  65. package/dist/module/bundler/css-processor/animation.d.ts +6 -0
  66. package/dist/module/bundler/css-processor/animation.js +112 -0
  67. package/dist/module/bundler/css-processor/color.d.ts +12 -0
  68. package/dist/module/bundler/css-processor/color.js +63 -0
  69. package/dist/module/bundler/css-processor/css.d.ts +23 -0
  70. package/dist/module/bundler/css-processor/css.js +566 -0
  71. package/dist/module/bundler/css-processor/functions.d.ts +12 -0
  72. package/dist/module/bundler/css-processor/functions.js +190 -0
  73. package/dist/module/bundler/css-processor/index.d.ts +3 -0
  74. package/dist/module/bundler/css-processor/index.js +3 -0
  75. package/dist/module/bundler/css-processor/mq.d.ts +12 -0
  76. package/dist/module/bundler/css-processor/mq.js +78 -0
  77. package/dist/module/bundler/css-processor/processor.d.ts +36 -0
  78. package/dist/module/bundler/css-processor/processor.js +336 -0
  79. package/dist/module/bundler/css-processor/rn.d.ts +10 -0
  80. package/dist/module/bundler/css-processor/rn.js +400 -0
  81. package/dist/module/bundler/css-processor/serialize.d.ts +2 -0
  82. package/dist/module/bundler/css-processor/serialize.js +101 -0
  83. package/dist/module/bundler/css-processor/types.d.ts +28 -0
  84. package/dist/module/bundler/css-processor/types.js +0 -0
  85. package/dist/module/bundler/css-processor/units.d.ts +10 -0
  86. package/dist/module/bundler/css-processor/units.js +48 -0
  87. package/dist/module/bundler/css-processor/utils.d.ts +24 -0
  88. package/dist/{shared/uniwind.PtWWxxnh.mjs → module/bundler/css-processor/utils.js} +11 -15
  89. package/dist/module/bundler/css-processor/var.d.ts +7 -0
  90. package/dist/module/bundler/css-processor/var.js +13 -0
  91. package/dist/module/{css-visitor → bundler/css-visitor}/function-visitor.d.ts +1 -1
  92. package/dist/module/{css-visitor → bundler/css-visitor}/rule-visitor.d.ts +4 -3
  93. package/dist/module/{css-visitor → bundler/css-visitor}/rule-visitor.js +5 -5
  94. package/dist/module/{css-visitor → bundler/css-visitor}/visitor.d.ts +3 -3
  95. package/dist/module/{css-visitor → bundler/css-visitor}/visitor.js +5 -6
  96. package/dist/module/bundler/logger.d.ts +11 -0
  97. package/dist/module/bundler/logger.js +34 -0
  98. package/dist/module/bundler/types.d.ts +15 -0
  99. package/dist/module/bundler/types.js +0 -0
  100. package/dist/module/common/consts.d.ts +21 -0
  101. package/dist/module/common/consts.js +24 -0
  102. package/dist/module/components/ScopedTheme/ScopedTheme.native.d.ts +1 -1
  103. package/dist/module/components/native/Pressable.d.ts +1 -1
  104. package/dist/module/components/native/TouchableHighlight.d.ts +1 -1
  105. package/dist/module/components/native/TouchableOpacity.d.ts +1 -1
  106. package/dist/module/components/native/useAccentColor.d.ts +1 -1
  107. package/dist/module/components/native/useStyle.d.ts +2 -2
  108. package/dist/module/components/react-native-gesture-handler/native/BaseButton.d.ts +1 -1
  109. package/dist/module/components/react-native-gesture-handler/native/BorderlessButton.d.ts +1 -1
  110. package/dist/module/components/react-native-gesture-handler/native/DrawerLayoutAndroid.d.ts +1 -1
  111. package/dist/module/components/react-native-gesture-handler/native/FlatList.d.ts +1 -1
  112. package/dist/module/components/react-native-gesture-handler/native/Pressable.d.ts +1 -1
  113. package/dist/module/components/react-native-gesture-handler/native/PureNativeButton.d.ts +1 -1
  114. package/dist/module/components/react-native-gesture-handler/native/RawButton.d.ts +1 -1
  115. package/dist/module/components/react-native-gesture-handler/native/RectButton.d.ts +1 -1
  116. package/dist/module/components/react-native-gesture-handler/native/RefreshControl.d.ts +1 -1
  117. package/dist/module/components/react-native-gesture-handler/native/ScrollView.d.ts +1 -1
  118. package/dist/module/components/react-native-gesture-handler/native/Switch.d.ts +1 -1
  119. package/dist/module/components/react-native-gesture-handler/native/TextInput.d.ts +1 -1
  120. package/dist/module/components/web/Pressable.d.ts +1 -1
  121. package/dist/module/components/web/TouchableHighlight.d.ts +1 -1
  122. package/dist/module/components/web/TouchableOpacity.d.ts +1 -1
  123. package/dist/module/components/web/rnw.js +1 -1
  124. package/dist/module/core/config/config.common.d.ts +6 -7
  125. package/dist/module/core/config/config.common.js +2 -2
  126. package/dist/module/core/config/config.d.ts +1 -1
  127. package/dist/module/core/config/config.js +1 -1
  128. package/dist/module/core/config/config.native.d.ts +2 -2
  129. package/dist/module/core/config/config.native.js +1 -1
  130. package/dist/module/core/listener.d.ts +1 -1
  131. package/dist/module/core/listener.js +1 -1
  132. package/dist/module/core/native/runtime.js +5 -1
  133. package/dist/module/core/native/store.d.ts +2 -2
  134. package/dist/module/core/native/store.js +1 -2
  135. package/dist/module/core/types.d.ts +6 -3
  136. package/dist/module/core/web/cssListener.js +1 -1
  137. package/dist/module/core/web/getWebStyles.d.ts +1 -1
  138. package/dist/module/hoc/types.d.ts +2 -2
  139. package/dist/module/hoc/withUniwind.d.ts +1 -1
  140. package/dist/module/hoc/withUniwind.js +5 -5
  141. package/dist/module/hoc/withUniwind.native.d.ts +1 -1
  142. package/dist/module/hoc/withUniwind.native.js +5 -5
  143. package/dist/module/hooks/useCSSVariable/getVariableValue.native.d.ts +1 -1
  144. package/dist/module/hooks/useCSSVariable/useCSSVariable.d.ts +1 -1
  145. package/dist/module/hooks/useCSSVariable/useCSSVariable.js +5 -1
  146. package/dist/module/hooks/useResolveClassNames.d.ts +1 -1
  147. package/dist/module/hooks/useUniwind.d.ts +1 -1
  148. package/dist/module/hooks/useUniwind.js +1 -1
  149. package/dist/module/index.d.ts +1 -2
  150. package/dist/shared/{uniwind.r2i22V6d.cjs → uniwind.CFiAZ3D-.cjs} +307 -217
  151. package/dist/shared/{uniwind.BGiqYvxb.mjs → uniwind.u-s1XVU8.mjs} +299 -214
  152. package/dist/vite/index.cjs +12 -22
  153. package/dist/vite/index.mjs +9 -19
  154. package/package.json +1 -1
  155. package/src/{metro → bundler/adapters/metro}/index.d.ts +2 -0
  156. package/src/bundler/adapters/metro/index.ts +1 -0
  157. package/src/{metro/withUniwindConfig.ts → bundler/adapters/metro/metro.ts} +7 -22
  158. package/src/{metro/metro-css-patches.ts → bundler/adapters/metro/patches.ts} +2 -1
  159. package/src/{metro → bundler/adapters/metro}/resolvers.ts +8 -8
  160. package/src/bundler/adapters/metro/transformer.ts +85 -0
  161. package/src/{vite → bundler/adapters/vite}/vite.ts +10 -28
  162. package/src/{css → bundler/artifacts/css}/extraUtilities.ts +1 -1
  163. package/src/{css → bundler/artifacts/css}/index.ts +1 -5
  164. package/src/{css → bundler/artifacts/css}/themes.ts +1 -1
  165. package/src/{utils/buildDtsFile.ts → bundler/artifacts/dts.ts} +3 -4
  166. package/src/bundler/config.ts +84 -0
  167. package/src/bundler/css-compiler/compileCSS.ts +15 -0
  168. package/src/bundler/css-compiler/compileNativeCSS.ts +41 -0
  169. package/src/bundler/css-compiler/compileTailwind.ts +25 -0
  170. package/src/bundler/css-compiler/compileWebCSS.ts +10 -0
  171. package/src/bundler/css-compiler/index.ts +1 -0
  172. package/src/{metro → bundler/css-processor}/addMetaToStylesTemplate.ts +33 -14
  173. package/src/{metro/processor → bundler/css-processor}/animation.ts +4 -4
  174. package/src/{metro/processor → bundler/css-processor}/color.ts +4 -3
  175. package/src/{metro/processor → bundler/css-processor}/css.ts +17 -9
  176. package/src/{metro/processor → bundler/css-processor}/functions.ts +2 -2
  177. package/src/bundler/css-processor/index.ts +3 -0
  178. package/src/{metro/processor → bundler/css-processor}/mq.ts +4 -4
  179. package/src/{metro/processor → bundler/css-processor}/processor.ts +13 -11
  180. package/src/{metro/processor → bundler/css-processor}/rn.ts +96 -3
  181. package/src/{metro/utils → bundler/css-processor}/serialize.ts +2 -2
  182. package/src/{metro → bundler/css-processor}/types.ts +3 -17
  183. package/src/{metro/processor → bundler/css-processor}/units.ts +1 -1
  184. package/src/{metro/processor → bundler/css-processor}/var.ts +1 -1
  185. package/src/{css-visitor → bundler/css-visitor}/function-visitor.ts +1 -1
  186. package/src/{css-visitor → bundler/css-visitor}/rule-visitor.ts +6 -5
  187. package/src/{css-visitor → bundler/css-visitor}/visitor.ts +4 -3
  188. package/src/bundler/types.ts +17 -0
  189. package/src/common/consts.ts +25 -0
  190. package/src/components/ScopedTheme/ScopedTheme.native.tsx +1 -1
  191. package/src/components/native/ActivityIndicator.tsx +2 -1
  192. package/src/components/native/Button.tsx +2 -1
  193. package/src/components/native/FlatList.tsx +2 -1
  194. package/src/components/native/Image.tsx +2 -1
  195. package/src/components/native/ImageBackground.tsx +2 -1
  196. package/src/components/native/InputAccessoryView.tsx +3 -2
  197. package/src/components/native/KeyboardAvoidingView.tsx +2 -1
  198. package/src/components/native/Modal.tsx +2 -1
  199. package/src/components/native/Pressable.tsx +1 -1
  200. package/src/components/native/RefreshControl.tsx +2 -1
  201. package/src/components/native/SafeAreaView.tsx +2 -1
  202. package/src/components/native/ScrollView.tsx +2 -1
  203. package/src/components/native/SectionList.tsx +2 -1
  204. package/src/components/native/Switch.tsx +3 -2
  205. package/src/components/native/Text.tsx +3 -2
  206. package/src/components/native/TextInput.tsx +3 -2
  207. package/src/components/native/TouchableHighlight.tsx +3 -2
  208. package/src/components/native/TouchableNativeFeedback.tsx +3 -2
  209. package/src/components/native/TouchableOpacity.tsx +3 -2
  210. package/src/components/native/TouchableWithoutFeedback.tsx +3 -2
  211. package/src/components/native/View.tsx +2 -1
  212. package/src/components/native/VirtualizedList.tsx +2 -1
  213. package/src/components/native/useAccentColor.ts +1 -1
  214. package/src/components/native/useStyle.ts +2 -2
  215. package/src/components/react-native-gesture-handler/native/BaseButton.tsx +1 -1
  216. package/src/components/react-native-gesture-handler/native/BorderlessButton.tsx +1 -1
  217. package/src/components/react-native-gesture-handler/native/DrawerLayoutAndroid.tsx +1 -1
  218. package/src/components/react-native-gesture-handler/native/FlatList.tsx +1 -1
  219. package/src/components/react-native-gesture-handler/native/GestureHandlerRootView.tsx +1 -1
  220. package/src/components/react-native-gesture-handler/native/Pressable.tsx +1 -1
  221. package/src/components/react-native-gesture-handler/native/PureNativeButton.tsx +1 -1
  222. package/src/components/react-native-gesture-handler/native/RawButton.tsx +1 -1
  223. package/src/components/react-native-gesture-handler/native/RectButton.tsx +1 -1
  224. package/src/components/react-native-gesture-handler/native/RefreshControl.tsx +1 -1
  225. package/src/components/react-native-gesture-handler/native/ScrollView.tsx +1 -1
  226. package/src/components/react-native-gesture-handler/native/Switch.tsx +2 -2
  227. package/src/components/react-native-gesture-handler/native/Text.tsx +2 -2
  228. package/src/components/react-native-gesture-handler/native/TextInput.tsx +2 -2
  229. package/src/components/react-native-gesture-handler/native/TouchableNativeFeedback.tsx +2 -2
  230. package/src/components/react-native-gesture-handler/native/TouchableOpacity.tsx +2 -2
  231. package/src/components/react-native-gesture-handler/native/TouchableWithoutFeedback.tsx +2 -2
  232. package/src/components/web/ActivityIndicator.tsx +2 -1
  233. package/src/components/web/Button.tsx +2 -1
  234. package/src/components/web/FlatList.tsx +2 -1
  235. package/src/components/web/Image.tsx +2 -1
  236. package/src/components/web/ImageBackground.tsx +2 -1
  237. package/src/components/web/KeyboardAvoidingView.tsx +2 -1
  238. package/src/components/web/Modal.tsx +2 -1
  239. package/src/components/web/Pressable.tsx +2 -1
  240. package/src/components/web/RefreshControl.tsx +2 -1
  241. package/src/components/web/SafeAreaView.tsx +2 -1
  242. package/src/components/web/ScrollView.tsx +2 -1
  243. package/src/components/web/SectionList.tsx +2 -1
  244. package/src/components/web/Switch.tsx +2 -1
  245. package/src/components/web/Text.tsx +2 -1
  246. package/src/components/web/TextInput.tsx +2 -1
  247. package/src/components/web/TouchableHighlight.tsx +2 -1
  248. package/src/components/web/TouchableOpacity.tsx +2 -1
  249. package/src/components/web/TouchableWithoutFeedback.tsx +2 -1
  250. package/src/components/web/View.tsx +2 -1
  251. package/src/components/web/VirtualizedList.tsx +2 -1
  252. package/src/components/web/rnw.ts +1 -1
  253. package/src/core/config/config.common.ts +11 -9
  254. package/src/core/config/config.native.ts +3 -3
  255. package/src/core/config/config.ts +2 -2
  256. package/src/core/listener.ts +1 -1
  257. package/src/core/native/runtime.ts +7 -2
  258. package/src/core/native/store.ts +3 -4
  259. package/src/core/types.ts +6 -3
  260. package/src/core/web/cssListener.ts +1 -1
  261. package/src/core/web/getWebStyles.ts +1 -1
  262. package/src/hoc/types.ts +2 -2
  263. package/src/hoc/withUniwind.native.tsx +4 -3
  264. package/src/hoc/withUniwind.tsx +3 -2
  265. package/src/hooks/useCSSVariable/getVariableValue.native.ts +1 -1
  266. package/src/hooks/useCSSVariable/useCSSVariable.ts +8 -2
  267. package/src/hooks/useResolveClassNames.ts +1 -1
  268. package/src/hooks/useUniwind.ts +2 -2
  269. package/src/index.ts +1 -2
  270. package/dist/common/types.js +0 -28
  271. package/dist/common/utils/stringifyThemes.js +0 -8
  272. package/dist/common/vite/vite.js +0 -95
  273. package/dist/module/types.d.ts +0 -21
  274. package/dist/module/types.js +0 -22
  275. package/dist/module/utils/stringifyThemes.d.ts +0 -1
  276. package/dist/module/utils/stringifyThemes.js +0 -1
  277. package/dist/module/vite/index.d.ts +0 -9
  278. package/dist/module/vite/index.js +0 -1
  279. package/dist/module/vite/vite.d.ts +0 -8
  280. package/dist/module/vite/vite.js +0 -98
  281. package/dist/shared/uniwind.B5q8hBGv.cjs +0 -18
  282. package/dist/shared/uniwind.Cv73KtI-.cjs +0 -86
  283. package/dist/shared/uniwind.JSWK3vHl.mjs +0 -14
  284. package/src/metro/compileVirtual.ts +0 -85
  285. package/src/metro/index.ts +0 -1
  286. package/src/metro/injectThemes.ts +0 -23
  287. package/src/metro/metro-transformer.ts +0 -116
  288. package/src/metro/processor/index.ts +0 -1
  289. package/src/metro/utils/index.ts +0 -2
  290. package/src/types.ts +0 -23
  291. package/src/utils/stringifyThemes.ts +0 -1
  292. package/src/vite/index.d.ts +0 -9
  293. /package/dist/common/{css → bundler/artifacts/css}/extraUtilities.js +0 -0
  294. /package/dist/common/{css → bundler/artifacts/css}/insets.js +0 -0
  295. /package/dist/common/{css → bundler/artifacts/css}/overwrite.js +0 -0
  296. /package/dist/common/{css → bundler/artifacts/css}/variants.js +0 -0
  297. /package/dist/common/{css-visitor → bundler/css-visitor}/function-visitor.js +0 -0
  298. /package/dist/common/{css-visitor → bundler/css-visitor}/index.js +0 -0
  299. /package/dist/module/{css → bundler/artifacts/css}/extraUtilities.d.ts +0 -0
  300. /package/dist/module/{css → bundler/artifacts/css}/extraUtilities.js +0 -0
  301. /package/dist/module/{css → bundler/artifacts/css}/insets.d.ts +0 -0
  302. /package/dist/module/{css → bundler/artifacts/css}/insets.js +0 -0
  303. /package/dist/module/{css → bundler/artifacts/css}/overwrite.d.ts +0 -0
  304. /package/dist/module/{css → bundler/artifacts/css}/overwrite.js +0 -0
  305. /package/dist/module/{css → bundler/artifacts/css}/themes.d.ts +0 -0
  306. /package/dist/module/{css → bundler/artifacts/css}/variants.d.ts +0 -0
  307. /package/dist/module/{css → bundler/artifacts/css}/variants.js +0 -0
  308. /package/dist/module/{utils/buildDtsFile.d.ts → bundler/artifacts/dts.d.ts} +0 -0
  309. /package/dist/module/{css-visitor → bundler/css-visitor}/function-visitor.js +0 -0
  310. /package/dist/module/{css-visitor → bundler/css-visitor}/index.d.ts +0 -0
  311. /package/dist/module/{css-visitor → bundler/css-visitor}/index.js +0 -0
  312. /package/{dist/common → src/bundler/adapters}/vite/index.d.ts +0 -0
  313. /package/src/{vite → bundler/adapters/vite}/index.ts +0 -0
  314. /package/src/{css → bundler/artifacts/css}/insets.ts +0 -0
  315. /package/src/{css → bundler/artifacts/css}/overwrite.ts +0 -0
  316. /package/src/{css → bundler/artifacts/css}/variants.ts +0 -0
  317. /package/src/{metro/utils/common.ts → bundler/css-processor/utils.ts} +0 -0
  318. /package/src/{css-visitor → bundler/css-visitor}/index.ts +0 -0
  319. /package/src/{metro → bundler}/logger.ts +0 -0
@@ -0,0 +1,400 @@
1
+ import { DEFAULT_SCREEN_HEIGHT, DEFAULT_SCREEN_WIDTH } from "@/common/consts";
2
+ import { isDefined } from "@/common/utils";
3
+ import { addMissingSpaces, pipe, removeKeys, toCamelCase } from "./utils.js";
4
+ const transitions = { overlay: '"overlayColor"' };
5
+ const cssToRNMap = {
6
+ backgroundSize: (value) => {
7
+ return {
8
+ resizeMode: value
9
+ };
10
+ },
11
+ transitionProperty: (value) => {
12
+ const properties = value.replace(/"/g, "").split(",").filter((token) => token !== "" && !token.startsWith("--")).map((token) => transitions[token.trim()] ?? `"${toCamelCase(token.trim())}"`);
13
+ if (properties.length === 1 && ['"allowDiscrete"', '"normal"'].includes(properties[0])) {
14
+ const behavior = properties[0] === '"allowDiscrete"' ? "allow-discrete" : "normal";
15
+ return {
16
+ transitionBehavior: `"${behavior}"`
17
+ };
18
+ }
19
+ return {
20
+ transitionProperty: properties
21
+ };
22
+ },
23
+ transitionDuration: (value) => {
24
+ return {
25
+ transitionDuration: value.includes('""') ? value.replace(/""/g, ",") : value
26
+ };
27
+ },
28
+ transitionTimingFunction: (value) => {
29
+ return {
30
+ transitionTimingFunction: value.includes('""') ? value.replace(/""/g, ",") : value
31
+ };
32
+ },
33
+ animation: (value) => {
34
+ if (Array.isArray(value)) {
35
+ const result = {};
36
+ for (const [key, val] of value) {
37
+ if (val === '"none"') {
38
+ continue;
39
+ }
40
+ const keyName = toCamelCase(`animation-${key.replace(/^"|"$/g, "")}`);
41
+ if (key === "name") {
42
+ result[keyName] = typeof val === "string" ? val.split(",").map((v) => v.startsWith('"') ? v : `"${v}"`) : val;
43
+ } else {
44
+ result[keyName] = val;
45
+ }
46
+ }
47
+ return result;
48
+ }
49
+ return {
50
+ animationName: value
51
+ };
52
+ },
53
+ flex: (value) => {
54
+ if (typeof value === "object") {
55
+ return value;
56
+ }
57
+ return {
58
+ flex: value
59
+ };
60
+ },
61
+ overflow: (value) => {
62
+ if (typeof value === "object") {
63
+ return value;
64
+ }
65
+ return {
66
+ overflow: value
67
+ };
68
+ },
69
+ backdropFilter: () => ({}),
70
+ filter: (value) => ({
71
+ filter: value
72
+ }),
73
+ backgroundImage: (value) => ({
74
+ experimental_backgroundImage: value
75
+ }),
76
+ borderSpacing: () => ({}),
77
+ translate: (value) => {
78
+ if (typeof value === "object" && "x" in value && "y" in value) {
79
+ return {
80
+ translateX: value.x,
81
+ translateY: value.y
82
+ };
83
+ }
84
+ if (typeof value === "string") {
85
+ const [x, y] = value.split(" ");
86
+ return {
87
+ translateX: x,
88
+ translateY: y ?? x
89
+ };
90
+ }
91
+ return {};
92
+ },
93
+ rotate: (value) => {
94
+ if (typeof value === "object") {
95
+ return value;
96
+ }
97
+ return {
98
+ rotate: value
99
+ };
100
+ },
101
+ scale: (value) => {
102
+ if (typeof value === "object") {
103
+ return {
104
+ scaleX: value.x,
105
+ scaleY: value.y,
106
+ scaleZ: value.z
107
+ };
108
+ }
109
+ if (typeof value === "string") {
110
+ const [x, y, z] = value.split(" ");
111
+ return {
112
+ scaleX: x,
113
+ scaleY: y,
114
+ scaleZ: z
115
+ };
116
+ }
117
+ return {};
118
+ },
119
+ transform: (value) => {
120
+ if (typeof value === "string" || Array.isArray(value)) {
121
+ return {
122
+ transform: value
123
+ };
124
+ }
125
+ if (typeof value === "object") {
126
+ return Object.keys(value).length === 0 ? { transform: [] } : value;
127
+ }
128
+ return {};
129
+ },
130
+ fontSize: (value) => {
131
+ return {
132
+ fontSize: value,
133
+ "--uniwind-em": value
134
+ };
135
+ },
136
+ borderInlineWidth: (value) => {
137
+ const borderWidth = typeof value === "object" ? Object.values(value)[0] : value;
138
+ return {
139
+ borderLeftWidth: borderWidth,
140
+ borderRightWidth: borderWidth
141
+ };
142
+ },
143
+ borderBlockWidth: (value) => {
144
+ const borderWidth = typeof value === "object" ? Object.values(value)[0] : value;
145
+ return {
146
+ borderTopWidth: borderWidth,
147
+ borderBottomWidth: borderWidth
148
+ };
149
+ },
150
+ borderInlineStyle: (value) => {
151
+ return {
152
+ borderStyle: value
153
+ };
154
+ },
155
+ borderBlockStyle: (value) => {
156
+ return {
157
+ borderStyle: value
158
+ };
159
+ },
160
+ borderStyle: (value) => {
161
+ const borderStyle = typeof value === "object" ? Object.values(value)[0] : value;
162
+ return {
163
+ borderStyle
164
+ };
165
+ },
166
+ transformOrigin: (value) => {
167
+ if (typeof value === "object") {
168
+ return {
169
+ transformOrigin: `${value.x} ${value.y}`
170
+ };
171
+ }
172
+ return {
173
+ transformOrigin: value
174
+ };
175
+ },
176
+ fontVariantNumeric: (value) => ({
177
+ fontVariant: value
178
+ }),
179
+ display: (value) => {
180
+ if (value === '"box"') {
181
+ return {
182
+ display: '"flex"'
183
+ };
184
+ }
185
+ return {
186
+ display: value
187
+ };
188
+ }
189
+ };
190
+ const BORDER_WIDTH_KEYS = ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"];
191
+ const BORDER_COLOR_KEYS = ["borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor"];
192
+ const BORDER_RADIUS_KEYS = ["borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius"];
193
+ const COMPONENT_RESPONSIVE_PROPS = /* @__PURE__ */ new Set([
194
+ "width",
195
+ "height",
196
+ "minWidth",
197
+ "maxWidth",
198
+ "minHeight",
199
+ "maxHeight",
200
+ "padding",
201
+ "paddingTop",
202
+ "paddingRight",
203
+ "paddingBottom",
204
+ "paddingLeft",
205
+ "paddingHorizontal",
206
+ "paddingVertical",
207
+ "paddingStart",
208
+ "paddingEnd",
209
+ "margin",
210
+ "marginTop",
211
+ "marginRight",
212
+ "marginBottom",
213
+ "marginLeft",
214
+ "marginHorizontal",
215
+ "marginVertical",
216
+ "marginStart",
217
+ "marginEnd",
218
+ "top",
219
+ "right",
220
+ "bottom",
221
+ "left",
222
+ "gap",
223
+ "rowGap",
224
+ "columnGap",
225
+ "borderWidth",
226
+ "borderTopWidth",
227
+ "borderRightWidth",
228
+ "borderBottomWidth",
229
+ "borderLeftWidth",
230
+ "borderStartWidth",
231
+ "borderEndWidth",
232
+ "borderRadius",
233
+ "borderTopLeftRadius",
234
+ "borderTopRightRadius",
235
+ "borderBottomLeftRadius",
236
+ "borderBottomRightRadius",
237
+ "borderTopStartRadius",
238
+ "borderTopEndRadius",
239
+ "borderBottomStartRadius",
240
+ "borderBottomEndRadius",
241
+ "flexBasis",
242
+ "translateX",
243
+ "translateY"
244
+ ]);
245
+ export class RN {
246
+ constructor(Processor) {
247
+ this.Processor = Processor;
248
+ }
249
+ cssToRN(property, value) {
250
+ const transformedProperty = property.startsWith("--") ? property : pipe(property)(
251
+ toCamelCase,
252
+ (x) => {
253
+ if (x.includes("padding") || x.includes("margin")) {
254
+ return x.replace("InlineStart", "Start").replace("InlineEnd", "End").replace("Inline", "Horizontal").replace("Block", "Vertical");
255
+ }
256
+ if (x.includes("border")) {
257
+ return x.replace("InlineStart", "Start").replace("InlineEnd", "End");
258
+ }
259
+ return x;
260
+ }
261
+ );
262
+ const rn = this.transformProperty(
263
+ transformedProperty,
264
+ typeof value === "string" ? addMissingSpaces(value) : value
265
+ );
266
+ const joinedStyles = this.joinStyles(rn);
267
+ return Object.entries(joinedStyles).filter(([, value2]) => isDefined(value2)).map(([prop, val]) => [prop, this.makeResponsive(prop, val)]);
268
+ }
269
+ makeResponsive(property, value) {
270
+ const mode = this.Processor.bundlerConfig.polyfills?.responsive;
271
+ if (!mode) {
272
+ return value;
273
+ }
274
+ if (typeof value === "string") {
275
+ const rawValue = value.startsWith('"') && value.endsWith('"') ? value.slice(1, -1) : value;
276
+ if (rawValue.endsWith("%")) {
277
+ const numValue = parseFloat(rawValue);
278
+ if (!isNaN(numValue)) {
279
+ return `rt.makeResponsive(${numValue}, 100, true)`;
280
+ }
281
+ }
282
+ }
283
+ if (typeof value !== "number") {
284
+ return value;
285
+ }
286
+ const isTextMode = mode === true || mode === "text";
287
+ const isComponentMode = mode === true || mode === "components";
288
+ if (isTextMode && (property === "fontSize" || property === "--uniwind-em")) {
289
+ return `rt.makeResponsive(${value}, ${DEFAULT_SCREEN_HEIGHT}, true)`;
290
+ }
291
+ if (isComponentMode && COMPONENT_RESPONSIVE_PROPS.has(property)) {
292
+ return `rt.makeResponsive(${value}, ${DEFAULT_SCREEN_WIDTH})`;
293
+ }
294
+ return value;
295
+ }
296
+ transformProperty(property, value) {
297
+ if (property in cssToRNMap) {
298
+ return cssToRNMap[property](value);
299
+ }
300
+ if (typeof value === "object") {
301
+ const transformed = this.transformObjectProperty(property, value);
302
+ if (transformed) {
303
+ return transformed;
304
+ }
305
+ }
306
+ return {
307
+ [property]: value
308
+ };
309
+ }
310
+ transformObjectProperty(property, value) {
311
+ const properties = Object.keys(value);
312
+ const propertyEnd = property.includes("border") ? property.split("border").at(-1) ?? "" : "";
313
+ const transformedProperty = property.replace(propertyEnd, "");
314
+ const isSpacing = property.includes("margin") || property.includes("padding");
315
+ const wrapProperty = (prop) => `${transformedProperty}${prop}${propertyEnd}`;
316
+ if (properties.every((property2) => ["row", "column"].includes(property2))) {
317
+ return {
318
+ rowGap: value.row,
319
+ columnGap: value.column
320
+ };
321
+ }
322
+ if (properties.every((property2) => ["start", "end"].includes(property2))) {
323
+ if (isSpacing && property.includes("Horizontal")) {
324
+ return {
325
+ [`${property.replace("Horizontal", "Left")}`]: value.start,
326
+ [`${property.replace("Horizontal", "Right")}`]: value.end
327
+ };
328
+ }
329
+ if (isSpacing && property.includes("Vertical")) {
330
+ return {
331
+ [`${property.replace("Vertical", "Top")}`]: value.start,
332
+ [`${property.replace("Vertical", "Bottom")}`]: value.end
333
+ };
334
+ }
335
+ return {
336
+ [wrapProperty("Start")]: value.start,
337
+ [wrapProperty("End")]: value.end
338
+ };
339
+ }
340
+ if (properties.every((property2) => ["top", "right", "bottom", "left"].includes(property2))) {
341
+ if (transformedProperty === "inset") {
342
+ const isEverySideSame = properties.every((property2) => value[property2] === value.top);
343
+ return isEverySideSame ? { inset: value.top } : value;
344
+ }
345
+ return {
346
+ [wrapProperty("Top")]: value.top,
347
+ [wrapProperty("Right")]: value.right,
348
+ [wrapProperty("Bottom")]: value.bottom,
349
+ [wrapProperty("Left")]: value.left
350
+ };
351
+ }
352
+ if (properties.every((property2) => ["topLeft", "topRight", "bottomRight", "bottomLeft"].includes(property2))) {
353
+ return {
354
+ [wrapProperty("TopLeft")]: value.topLeft,
355
+ [wrapProperty("TopRight")]: value.topRight,
356
+ [wrapProperty("BottomRight")]: value.bottomRight,
357
+ [wrapProperty("BottomLeft")]: value.bottomLeft
358
+ };
359
+ }
360
+ if (properties.every((property2) => ["style", "width", "color"].includes(property2))) {
361
+ return {
362
+ [wrapProperty("Style")]: value.style,
363
+ [wrapProperty("Width")]: value.width,
364
+ [wrapProperty("Color")]: value.color
365
+ };
366
+ }
367
+ }
368
+ // Used when they're multiple styles with the same value that could be joined
369
+ joinStyles(styles) {
370
+ const keys = Object.keys(styles);
371
+ if (BORDER_WIDTH_KEYS.every((key) => keys.includes(key))) {
372
+ const borderWidth = styles.borderTopWidth;
373
+ if (BORDER_WIDTH_KEYS.every((key) => styles[key] === borderWidth)) {
374
+ return {
375
+ ...removeKeys(styles, BORDER_WIDTH_KEYS),
376
+ borderWidth
377
+ };
378
+ }
379
+ }
380
+ if (BORDER_COLOR_KEYS.every((key) => keys.includes(key))) {
381
+ const borderColor = styles.borderTopColor;
382
+ if (BORDER_COLOR_KEYS.every((key) => styles[key] === borderColor)) {
383
+ return {
384
+ ...removeKeys(styles, BORDER_COLOR_KEYS),
385
+ borderColor
386
+ };
387
+ }
388
+ }
389
+ if (BORDER_RADIUS_KEYS.every((key) => keys.includes(key))) {
390
+ const borderRadius = styles.borderTopLeftRadius;
391
+ if (BORDER_RADIUS_KEYS.every((key) => styles[key] === borderRadius)) {
392
+ return {
393
+ ...removeKeys(styles, BORDER_RADIUS_KEYS),
394
+ borderRadius
395
+ };
396
+ }
397
+ }
398
+ return styles;
399
+ }
400
+ }
@@ -0,0 +1,2 @@
1
+ export declare const serialize: (value: any) => string;
2
+ export declare const serializeJSObject: (obj: Record<string, any>, serializer: (key: string, value: string) => string) => string;
@@ -0,0 +1,101 @@
1
+ import { Logger } from "@/bundler/logger";
2
+ import { addMissingSpaces, isNumber, isValidJSValue, pipe, roundToPrecision, smartSplit } from "./utils.js";
3
+ const parseStringValue = (value) => {
4
+ if (isValidJSValue(value)) {
5
+ return value;
6
+ }
7
+ if (value.startsWith("function")) {
8
+ return value;
9
+ }
10
+ const tokens = smartSplit(addMissingSpaces(value));
11
+ const parsedTokens = tokens.map((token) => {
12
+ if (token.startsWith('"')) {
13
+ return token.replace(/"/g, "");
14
+ }
15
+ if (/^[a-z]+$/i.test(token.replace(/,/g, ""))) {
16
+ return token;
17
+ }
18
+ if (isNumber(token)) {
19
+ return token;
20
+ }
21
+ const endsWithComma = token.endsWith(",");
22
+ const expr = endsWithComma ? token.slice(0, -1) : token;
23
+ if (!isValidJSValue(expr)) {
24
+ return token;
25
+ }
26
+ return [
27
+ "${",
28
+ expr,
29
+ "}",
30
+ endsWithComma ? "," : ""
31
+ ].join("");
32
+ });
33
+ return [
34
+ "`",
35
+ parsedTokens.join(" "),
36
+ "`"
37
+ ].join("");
38
+ };
39
+ export const serialize = (value) => {
40
+ const typeOfValue = typeof value;
41
+ switch (typeOfValue) {
42
+ case "string":
43
+ return parseStringValue(value);
44
+ case "symbol":
45
+ return String(value);
46
+ case "number":
47
+ case "bigint":
48
+ return String(roundToPrecision(value, 2));
49
+ case "boolean":
50
+ return value.toString();
51
+ case "object":
52
+ if (value === null) {
53
+ return "null";
54
+ }
55
+ if (Array.isArray(value)) {
56
+ return [
57
+ "[",
58
+ value.map(serialize).join(", "),
59
+ "]"
60
+ ].join("");
61
+ }
62
+ return [
63
+ "{",
64
+ Object.entries(value).map(([key, val]) => {
65
+ const serializedKey = isNumber(key) ? key : `"${key}"`;
66
+ return `${serializedKey}: ${serialize(val)}`;
67
+ }).join(", "),
68
+ "}"
69
+ ].join("");
70
+ case "undefined":
71
+ return "undefined";
72
+ case "function":
73
+ return "";
74
+ default:
75
+ typeOfValue;
76
+ return "";
77
+ }
78
+ };
79
+ export const serializeJSObject = (obj, serializer) => {
80
+ const serializedObject = pipe(obj)(
81
+ Object.entries,
82
+ (entries) => entries.map(([key, value]) => serializer(key, serialize(value))),
83
+ (serializedValues) => serializedValues.filter((serializedValue) => {
84
+ try {
85
+ new Function(`function validateJS() { const obj = ({ ${serializedValue} }) }`);
86
+ return true;
87
+ } catch {
88
+ Logger.error(`Failed to serialize ${serializedValue} as a valid JS object entry. Skipping.`);
89
+ return false;
90
+ }
91
+ }),
92
+ (entries) => entries.join(","),
93
+ (result) => {
94
+ if (result === "") {
95
+ return "";
96
+ }
97
+ return `${result},`;
98
+ }
99
+ );
100
+ return serializedObject;
101
+ };
@@ -0,0 +1,28 @@
1
+ import type { ColorScheme, Orientation, Platform } from '@/common/consts';
2
+ import type { AbsoluteFontWeight, Declaration, GradientItemFor_DimensionPercentageFor_LengthValue, LineDirection, MathFunctionFor_DimensionPercentageFor_LengthValue, MathFunctionFor_Length, MediaFeatureValue, ParsedComponent, Token, TokenOrValue, UnresolvedColor } from 'lightningcss';
3
+ export type MediaQueryResolver = {
4
+ maxWidth: number | null;
5
+ minWidth: number | null;
6
+ platform: Platform | null;
7
+ rtl: boolean | null;
8
+ important: boolean;
9
+ importantProperties?: Array<string>;
10
+ colorScheme: ColorScheme | null;
11
+ theme: string | null;
12
+ orientation: Orientation | null;
13
+ disabled: boolean | null;
14
+ active: boolean | null;
15
+ focus: boolean | null;
16
+ dataAttributes: Record<string, string> | null;
17
+ };
18
+ type TakeArray<T> = T extends Array<any> ? T : never;
19
+ export type DeclarationValues = Declaration['value'] | TakeArray<Declaration['value']>[number] | TokenOrValue | Token | ParsedComponent | Array<TokenOrValue> | MediaFeatureValue | MathFunctionFor_DimensionPercentageFor_LengthValue | MathFunctionFor_Length | LineDirection | GradientItemFor_DimensionPercentageFor_LengthValue | AbsoluteFontWeight | UnresolvedColor;
20
+ export type DeclarationProperty = Declaration['property'];
21
+ export type ProcessMetaValues = {
22
+ className?: string | null;
23
+ };
24
+ export type AnimationFrame = [Array<string | number>, Array<Record<string, any>>];
25
+ export type StyleSheetTemplate = {
26
+ [K: string]: Array<MediaQueryResolver & Record<string, unknown>>;
27
+ };
28
+ export {};
File without changes
@@ -0,0 +1,10 @@
1
+ import type { DimensionPercentageFor_LengthValue, Length, LengthValue } from 'lightningcss';
2
+ import type { ProcessorBuilder } from './processor';
3
+ export declare class Units {
4
+ private readonly Processor;
5
+ private readonly logger;
6
+ constructor(Processor: ProcessorBuilder);
7
+ processLength(length: LengthValue | DimensionPercentageFor_LengthValue | number): any;
8
+ processAnyLength(length: DimensionPercentageFor_LengthValue | Length | LengthValue): any;
9
+ replaceInfinity(value: any): any;
10
+ }
@@ -0,0 +1,48 @@
1
+ import { Logger } from "../logger.js";
2
+ export class Units {
3
+ constructor(Processor) {
4
+ this.Processor = Processor;
5
+ }
6
+ logger = new Logger("Units");
7
+ processLength(length) {
8
+ if (typeof length === "number") {
9
+ return length;
10
+ }
11
+ if ("unit" in length) {
12
+ switch (length.unit) {
13
+ case "px":
14
+ return this.replaceInfinity(length.value);
15
+ case "vw":
16
+ return `rt.screen.width * ${length.value / 100}`;
17
+ case "vh":
18
+ return `rt.screen.height * ${length.value / 100}`;
19
+ case "rem":
20
+ return length.value * this.Processor.vars["--uniwind-em"];
21
+ case "em":
22
+ return `this[\`--uniwind-em\`] * ${length.value}`;
23
+ default:
24
+ this.logger.warn(`Unsupported unit - ${length.unit}`);
25
+ return length.value;
26
+ }
27
+ }
28
+ return this.Processor.CSS.processValue(length);
29
+ }
30
+ processAnyLength(length) {
31
+ if ("type" in length) {
32
+ switch (length.type) {
33
+ case "value":
34
+ case "dimension":
35
+ return this.processLength(length.value);
36
+ case "percentage":
37
+ return `${length.value * 100}%`;
38
+ default:
39
+ this.logger.warn(`Unsupported length type - ${length.type}`);
40
+ return length.value;
41
+ }
42
+ }
43
+ return this.processLength(length);
44
+ }
45
+ replaceInfinity(value) {
46
+ return value === Infinity ? 99999 : value;
47
+ }
48
+ }
@@ -0,0 +1,24 @@
1
+ export declare const toCamelCase: (str: string) => string;
2
+ type P<I, O> = (data: I) => O;
3
+ type PipeFns<T> = {
4
+ <A>(a: P<T, A>): A;
5
+ <A, B>(a: P<T, A>, b: P<A, B>): B;
6
+ <A, B, C>(a: P<T, A>, b: P<A, B>, c: P<B, C>): C;
7
+ <A, B, C, D>(a: P<T, A>, b: P<A, B>, c: P<B, C>, d: P<C, D>): D;
8
+ <A, B, C, D, E>(a: P<T, A>, b: P<A, B>, c: P<B, C>, d: P<C, D>, e: P<D, E>): E;
9
+ <A, B, C, D, E, F>(a: P<T, A>, b: P<A, B>, c: P<B, C>, d: P<C, D>, e: P<D, E>, f: P<E, F>): F;
10
+ <A, B, C, D, E, F, G>(a: P<T, A>, b: P<A, B>, c: P<B, C>, d: P<C, D>, e: P<D, E>, f: P<E, F>, g: P<F, G>): G;
11
+ <A, B, C, D, E, F, G, H>(a: P<T, A>, b: P<A, B>, c: P<B, C>, d: P<C, D>, e: P<D, E>, f: P<E, F>, g: P<F, G>, h: P<G, H>): H;
12
+ (...fns: Array<P<T, T>>): T;
13
+ };
14
+ export declare const pipe: <T>(data: T) => PipeFns<T>;
15
+ export declare const isNumber: (data: any) => boolean;
16
+ export declare const smartSplit: (str: string, separator?: string | RegExp) => string[];
17
+ export declare const addMissingSpaces: (str: string) => string;
18
+ export declare const uniq: <T>(arr: Array<T>) => T[];
19
+ export declare const isValidJSValue: (jsValueString: string) => boolean;
20
+ export declare const shouldBeSerialized: (value: string) => boolean;
21
+ export declare const roundToPrecision: (value: number, precision: number) => number;
22
+ export declare const deepEqual: <T>(a: T, b: T) => boolean;
23
+ export declare const removeKeys: <TObj extends Record<PropertyKey, any>, TKey extends keyof TObj>(obj: TObj, keysToRemove: Array<TKey>) => Omit<TObj, TKey>;
24
+ export {};
@@ -1,8 +1,6 @@
1
- const name = "@niibase/uniwind";
2
-
3
- const toCamelCase = (str) => str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
4
- const pipe = (data) => ((...fns) => fns.reduce((acc, fn) => fn(acc), data));
5
- const isNumber = (data) => {
1
+ export const toCamelCase = (str) => str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
2
+ export const pipe = (data) => ((...fns) => fns.reduce((acc, fn) => fn(acc), data));
3
+ export const isNumber = (data) => {
6
4
  if (typeof data === "number") {
7
5
  return true;
8
6
  }
@@ -11,7 +9,7 @@ const isNumber = (data) => {
11
9
  }
12
10
  return false;
13
11
  };
14
- const smartSplit = (str, separator = " ") => {
12
+ export const smartSplit = (str, separator = " ") => {
15
13
  const escaper = "&&&";
16
14
  return pipe(str)(
17
15
  (x) => x.replace(/\s\?\?\s/g, `${escaper}??${escaper}`),
@@ -20,7 +18,7 @@ const smartSplit = (str, separator = " ") => {
20
18
  (x) => x.map((token) => token.replace(new RegExp(escaper, "g"), " "))
21
19
  );
22
20
  };
23
- const addMissingSpaces = (str) => pipe(str)(
21
+ export const addMissingSpaces = (str) => pipe(str)(
24
22
  (x) => x.trim(),
25
23
  (x) => x.replace(/([^ {])this/g, "$1 this"),
26
24
  (x) => x.replace(/\](?=\d)/g, "] "),
@@ -28,8 +26,8 @@ const addMissingSpaces = (str) => pipe(str)(
28
26
  (x) => x.replace(/\)(?=\S)/g, ") "),
29
27
  (x) => x.replace(/(?<!^)(?<!\s)"(?=\d)/g, '" ')
30
28
  );
31
- const uniq = (arr) => Array.from(new Set(arr));
32
- const isValidJSValue = (jsValueString) => {
29
+ export const uniq = (arr) => Array.from(new Set(arr));
30
+ export const isValidJSValue = (jsValueString) => {
33
31
  try {
34
32
  new Function(`const test = ${jsValueString}`);
35
33
  return true;
@@ -37,7 +35,7 @@ const isValidJSValue = (jsValueString) => {
37
35
  return false;
38
36
  }
39
37
  };
40
- const shouldBeSerialized = (value) => {
38
+ export const shouldBeSerialized = (value) => {
41
39
  if (value.includes("-")) {
42
40
  return value.split("-").some(shouldBeSerialized);
43
41
  }
@@ -52,8 +50,8 @@ const shouldBeSerialized = (value) => {
52
50
  value === ")"
53
51
  ].some(Boolean);
54
52
  };
55
- const roundToPrecision = (value, precision) => parseFloat(value.toFixed(precision));
56
- const deepEqual = (a, b) => {
53
+ export const roundToPrecision = (value, precision) => parseFloat(value.toFixed(precision));
54
+ export const deepEqual = (a, b) => {
57
55
  if (Object.is(a, b)) {
58
56
  return true;
59
57
  }
@@ -66,8 +64,6 @@ const deepEqual = (a, b) => {
66
64
  }
67
65
  return keysA.every((key) => deepEqual(a[key], b[key]) && Object.prototype.hasOwnProperty.call(b, key));
68
66
  };
69
- const removeKeys = (obj, keysToRemove) => Object.fromEntries(
67
+ export const removeKeys = (obj, keysToRemove) => Object.fromEntries(
70
68
  Object.entries(obj).filter(([key]) => !keysToRemove.includes(key))
71
69
  );
72
-
73
- export { isValidJSValue as a, addMissingSpaces as b, shouldBeSerialized as c, deepEqual as d, removeKeys as e, isNumber as i, name as n, pipe as p, roundToPrecision as r, smartSplit as s, toCamelCase as t, uniq as u };