react-native-css 2.1.2 → 3.0.0-nightly.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 (926) hide show
  1. package/{LICENSE.md → LICENSE} +6 -8
  2. package/README.md +177 -70
  3. package/dist/commonjs/babel/allowedModules.js +23 -0
  4. package/dist/commonjs/babel/allowedModules.js.map +1 -0
  5. package/dist/commonjs/babel/helpers.js +25 -0
  6. package/dist/commonjs/babel/helpers.js.map +1 -0
  7. package/dist/commonjs/babel/import-plugin.js +101 -0
  8. package/dist/commonjs/babel/import-plugin.js.map +1 -0
  9. package/dist/commonjs/babel/index.js +9 -0
  10. package/dist/commonjs/babel/index.js.map +1 -0
  11. package/dist/commonjs/babel/react-native-web.js +118 -0
  12. package/dist/commonjs/babel/react-native-web.js.map +1 -0
  13. package/dist/commonjs/babel/react-native.js +118 -0
  14. package/dist/commonjs/babel/react-native.js.map +1 -0
  15. package/dist/commonjs/compiler/atRules.js +114 -0
  16. package/dist/commonjs/compiler/atRules.js.map +1 -0
  17. package/dist/commonjs/compiler/compiler.js +281 -0
  18. package/dist/commonjs/compiler/compiler.js.map +1 -0
  19. package/dist/commonjs/compiler/compiler.types.js +4 -0
  20. package/dist/commonjs/compiler/compiler.types.js.map +1 -0
  21. package/dist/commonjs/compiler/container-query.js +63 -0
  22. package/dist/commonjs/compiler/container-query.js.map +1 -0
  23. package/dist/commonjs/compiler/declarations.js +2196 -0
  24. package/dist/commonjs/compiler/declarations.js.map +1 -0
  25. package/dist/commonjs/compiler/functions-web.js +44 -0
  26. package/dist/commonjs/compiler/functions-web.js.map +1 -0
  27. package/dist/commonjs/compiler/functions.js +59 -0
  28. package/dist/commonjs/compiler/functions.js.map +1 -0
  29. package/dist/commonjs/compiler/index.js +17 -0
  30. package/dist/commonjs/compiler/index.js.map +1 -0
  31. package/dist/commonjs/compiler/inheritance.test.js +78 -0
  32. package/dist/commonjs/compiler/inheritance.test.js.map +1 -0
  33. package/dist/commonjs/compiler/keyframes.js +60 -0
  34. package/dist/commonjs/compiler/keyframes.js.map +1 -0
  35. package/dist/commonjs/compiler/media-query.js +172 -0
  36. package/dist/commonjs/compiler/media-query.js.map +1 -0
  37. package/dist/commonjs/compiler/pseudo-elements.js +49 -0
  38. package/dist/commonjs/compiler/pseudo-elements.js.map +1 -0
  39. package/dist/commonjs/compiler/selector-builder.js +501 -0
  40. package/dist/commonjs/compiler/selector-builder.js.map +1 -0
  41. package/dist/commonjs/compiler/selectors.js +414 -0
  42. package/dist/commonjs/compiler/selectors.js.map +1 -0
  43. package/dist/commonjs/compiler/split-by-delimiter.js +21 -0
  44. package/dist/commonjs/compiler/split-by-delimiter.js.map +1 -0
  45. package/dist/commonjs/compiler/stylesheet.js +476 -0
  46. package/dist/commonjs/compiler/stylesheet.js.map +1 -0
  47. package/dist/commonjs/compiler/supports.js +27 -0
  48. package/dist/commonjs/compiler/supports.js.map +1 -0
  49. package/dist/commonjs/components/ActivityIndicator.js +22 -0
  50. package/dist/commonjs/components/ActivityIndicator.js.map +1 -0
  51. package/dist/commonjs/components/Button.js +22 -0
  52. package/dist/commonjs/components/Button.js.map +1 -0
  53. package/dist/commonjs/components/FlatList.js +19 -0
  54. package/dist/commonjs/components/FlatList.js.map +1 -0
  55. package/dist/commonjs/components/Image.js +17 -0
  56. package/dist/commonjs/components/Image.js.map +1 -0
  57. package/dist/commonjs/components/Switch.js +17 -0
  58. package/dist/commonjs/components/Switch.js.map +1 -0
  59. package/dist/commonjs/components/Text.js +17 -0
  60. package/dist/commonjs/components/Text.js.map +1 -0
  61. package/dist/commonjs/components/TextInput.js +17 -0
  62. package/dist/commonjs/components/TextInput.js.map +1 -0
  63. package/dist/commonjs/components/View.js +17 -0
  64. package/dist/commonjs/components/View.js.map +1 -0
  65. package/dist/commonjs/components/index.js +84 -0
  66. package/dist/commonjs/components/index.js.map +1 -0
  67. package/dist/commonjs/components/react-native-safe-area-context.js +17 -0
  68. package/dist/commonjs/components/react-native-safe-area-context.js.map +1 -0
  69. package/dist/commonjs/components/react-native-safe-area-context.native.js +53 -0
  70. package/dist/commonjs/components/react-native-safe-area-context.native.js.map +1 -0
  71. package/dist/commonjs/index.js +28 -0
  72. package/dist/commonjs/index.js.map +1 -0
  73. package/dist/commonjs/jest/expect.d.js +2 -0
  74. package/dist/commonjs/jest/expect.d.js.map +1 -0
  75. package/dist/commonjs/jest/index.js +56 -0
  76. package/dist/commonjs/jest/index.js.map +1 -0
  77. package/dist/commonjs/jest/setup.js +3 -0
  78. package/dist/commonjs/jest/setup.js.map +1 -0
  79. package/dist/commonjs/jest/setupAfterEnv.js +15 -0
  80. package/dist/commonjs/jest/setupAfterEnv.js.map +1 -0
  81. package/dist/commonjs/metro/index.js +170 -0
  82. package/dist/commonjs/metro/index.js.map +1 -0
  83. package/dist/commonjs/metro/injection-code.js +27 -0
  84. package/dist/commonjs/metro/injection-code.js.map +1 -0
  85. package/dist/commonjs/metro/metro-transformer.js +31 -0
  86. package/dist/commonjs/metro/metro-transformer.js.map +1 -0
  87. package/dist/commonjs/metro/picocolors.js +71 -0
  88. package/dist/commonjs/metro/picocolors.js.map +1 -0
  89. package/dist/commonjs/metro/resolver.js +65 -0
  90. package/dist/commonjs/metro/resolver.js.map +1 -0
  91. package/dist/commonjs/metro/stringify.js +59 -0
  92. package/dist/commonjs/metro/stringify.js.map +1 -0
  93. package/dist/commonjs/metro/typescript.js +47 -0
  94. package/dist/commonjs/metro/typescript.js.map +1 -0
  95. package/dist/commonjs/package.json +1 -0
  96. package/dist/commonjs/poison.pill.js +39 -0
  97. package/dist/commonjs/poison.pill.js.map +1 -0
  98. package/dist/commonjs/runtime/index.js +17 -0
  99. package/dist/commonjs/runtime/index.js.map +1 -0
  100. package/dist/commonjs/runtime/native/api.js +96 -0
  101. package/dist/commonjs/runtime/native/api.js.map +1 -0
  102. package/dist/commonjs/runtime/native/conditions/attributes.js +42 -0
  103. package/dist/commonjs/runtime/native/conditions/attributes.js.map +1 -0
  104. package/dist/commonjs/runtime/native/conditions/container-query.js +123 -0
  105. package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -0
  106. package/dist/commonjs/runtime/native/conditions/guards.js +33 -0
  107. package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -0
  108. package/dist/commonjs/runtime/native/conditions/index.js +40 -0
  109. package/dist/commonjs/runtime/native/conditions/index.js.map +1 -0
  110. package/dist/commonjs/runtime/native/conditions/media-query.js +98 -0
  111. package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -0
  112. package/dist/commonjs/runtime/native/index.js +28 -0
  113. package/dist/commonjs/runtime/native/index.js.map +1 -0
  114. package/dist/commonjs/runtime/native/metro.js +6 -0
  115. package/dist/commonjs/runtime/native/metro.js.map +1 -0
  116. package/dist/commonjs/runtime/native/react/interaction.js +63 -0
  117. package/dist/commonjs/runtime/native/react/interaction.js.map +1 -0
  118. package/dist/commonjs/runtime/native/react/rules.js +259 -0
  119. package/dist/commonjs/runtime/native/react/rules.js.map +1 -0
  120. package/dist/commonjs/runtime/native/react/useNativeCss.js +159 -0
  121. package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -0
  122. package/dist/commonjs/runtime/native/react/usePassthrough.js +50 -0
  123. package/dist/commonjs/runtime/native/react/usePassthrough.js.map +1 -0
  124. package/dist/commonjs/runtime/native/reactivity.js +189 -0
  125. package/dist/commonjs/runtime/native/reactivity.js.map +1 -0
  126. package/dist/commonjs/runtime/native/reanimated.js +17 -0
  127. package/dist/commonjs/runtime/native/reanimated.js.map +1 -0
  128. package/dist/commonjs/runtime/native/styles/calculate-props.js +148 -0
  129. package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -0
  130. package/dist/commonjs/runtime/native/styles/constants.js +9 -0
  131. package/dist/commonjs/runtime/native/styles/constants.js.map +1 -0
  132. package/dist/commonjs/runtime/native/styles/defaults.js +69 -0
  133. package/dist/commonjs/runtime/native/styles/defaults.js.map +1 -0
  134. package/dist/commonjs/runtime/native/styles/functions/animation-timing.js +34 -0
  135. package/dist/commonjs/runtime/native/styles/functions/animation-timing.js.map +1 -0
  136. package/dist/commonjs/runtime/native/styles/functions/calc.js +125 -0
  137. package/dist/commonjs/runtime/native/styles/functions/calc.js.map +1 -0
  138. package/dist/commonjs/runtime/native/styles/functions/filters.js +84 -0
  139. package/dist/commonjs/runtime/native/styles/functions/filters.js.map +1 -0
  140. package/dist/commonjs/runtime/native/styles/functions/index.js +83 -0
  141. package/dist/commonjs/runtime/native/styles/functions/index.js.map +1 -0
  142. package/dist/commonjs/runtime/native/styles/functions/numeric-functions.js +32 -0
  143. package/dist/commonjs/runtime/native/styles/functions/numeric-functions.js.map +1 -0
  144. package/dist/commonjs/runtime/native/styles/functions/platform-functions.js +46 -0
  145. package/dist/commonjs/runtime/native/styles/functions/platform-functions.js.map +1 -0
  146. package/dist/commonjs/runtime/native/styles/functions/string-functions.js +23 -0
  147. package/dist/commonjs/runtime/native/styles/functions/string-functions.js.map +1 -0
  148. package/dist/commonjs/runtime/native/styles/functions/transform-functions.js +121 -0
  149. package/dist/commonjs/runtime/native/styles/functions/transform-functions.js.map +1 -0
  150. package/dist/commonjs/runtime/native/styles/index.js +115 -0
  151. package/dist/commonjs/runtime/native/styles/index.js.map +1 -0
  152. package/dist/commonjs/runtime/native/styles/resolve.js +106 -0
  153. package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -0
  154. package/dist/commonjs/runtime/native/styles/shorthands/_handler.js +79 -0
  155. package/dist/commonjs/runtime/native/styles/shorthands/_handler.js.map +1 -0
  156. package/dist/commonjs/runtime/native/styles/shorthands/animation.js +57 -0
  157. package/dist/commonjs/runtime/native/styles/shorthands/animation.js.map +1 -0
  158. package/dist/commonjs/runtime/native/styles/shorthands/border.js +12 -0
  159. package/dist/commonjs/runtime/native/styles/shorthands/border.js.map +1 -0
  160. package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js +50 -0
  161. package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
  162. package/dist/commonjs/runtime/native/styles/shorthands/index.js +61 -0
  163. package/dist/commonjs/runtime/native/styles/shorthands/index.js.map +1 -0
  164. package/dist/commonjs/runtime/native/styles/shorthands/text-shadow.js +13 -0
  165. package/dist/commonjs/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
  166. package/dist/commonjs/runtime/native/styles/shorthands/transform.js +23 -0
  167. package/dist/commonjs/runtime/native/styles/shorthands/transform.js.map +1 -0
  168. package/dist/commonjs/runtime/native/styles/units.js +52 -0
  169. package/dist/commonjs/runtime/native/styles/units.js.map +1 -0
  170. package/dist/commonjs/runtime/native/styles/variables.js +79 -0
  171. package/dist/commonjs/runtime/native/styles/variables.js.map +1 -0
  172. package/dist/commonjs/runtime/runtime.js +17 -0
  173. package/dist/commonjs/runtime/runtime.js.map +1 -0
  174. package/dist/commonjs/runtime/runtime.native.js +17 -0
  175. package/dist/commonjs/runtime/runtime.native.js.map +1 -0
  176. package/dist/commonjs/runtime/runtime.types.js +6 -0
  177. package/dist/commonjs/runtime/runtime.types.js.map +1 -0
  178. package/dist/commonjs/runtime/utils/components.js +18 -0
  179. package/dist/commonjs/runtime/utils/components.js.map +1 -0
  180. package/dist/commonjs/runtime/utils/dot-notation.types.js +2 -0
  181. package/dist/commonjs/runtime/utils/dot-notation.types.js.map +1 -0
  182. package/dist/commonjs/runtime/utils/index.js +61 -0
  183. package/dist/commonjs/runtime/utils/index.js.map +1 -0
  184. package/dist/commonjs/runtime/utils/objects.js +92 -0
  185. package/dist/commonjs/runtime/utils/objects.js.map +1 -0
  186. package/dist/commonjs/runtime/utils/specificity.js +44 -0
  187. package/dist/commonjs/runtime/utils/specificity.js.map +1 -0
  188. package/dist/commonjs/runtime/utils/style-value.js +21 -0
  189. package/dist/commonjs/runtime/utils/style-value.js.map +1 -0
  190. package/dist/commonjs/runtime/utils/utils.types.js +6 -0
  191. package/dist/commonjs/runtime/utils/utils.types.js.map +1 -0
  192. package/dist/commonjs/runtime/web/api.js +68 -0
  193. package/dist/commonjs/runtime/web/api.js.map +1 -0
  194. package/dist/commonjs/runtime/web/assign-style.js +27 -0
  195. package/dist/commonjs/runtime/web/assign-style.js.map +1 -0
  196. package/dist/commonjs/runtime/web/index.js +18 -0
  197. package/dist/commonjs/runtime/web/index.js.map +1 -0
  198. package/dist/commonjs/runtime/web/metro.js +6 -0
  199. package/dist/commonjs/runtime/web/metro.js.map +1 -0
  200. package/dist/commonjs/style-collection/index.js +110 -0
  201. package/dist/commonjs/style-collection/index.js.map +1 -0
  202. package/dist/commonjs/style-collection/root.js +28 -0
  203. package/dist/commonjs/style-collection/root.js.map +1 -0
  204. package/dist/module/babel/allowedModules.js +19 -0
  205. package/dist/module/babel/allowedModules.js.map +1 -0
  206. package/dist/module/babel/helpers.js +21 -0
  207. package/dist/module/babel/helpers.js.map +1 -0
  208. package/dist/module/babel/import-plugin.js +97 -0
  209. package/dist/module/babel/import-plugin.js.map +1 -0
  210. package/dist/module/babel/index.js +9 -0
  211. package/dist/module/babel/index.js.map +1 -0
  212. package/dist/module/babel/react-native-web.js +112 -0
  213. package/dist/module/babel/react-native-web.js.map +1 -0
  214. package/dist/module/babel/react-native.js +112 -0
  215. package/dist/module/babel/react-native.js.map +1 -0
  216. package/dist/module/compiler/atRules.js +110 -0
  217. package/dist/module/compiler/atRules.js.map +1 -0
  218. package/dist/module/compiler/compiler.js +276 -0
  219. package/dist/module/compiler/compiler.js.map +1 -0
  220. package/dist/module/compiler/compiler.types.js +60 -0
  221. package/dist/module/compiler/compiler.types.js.map +1 -0
  222. package/dist/module/compiler/container-query.js +59 -0
  223. package/dist/module/compiler/container-query.js.map +1 -0
  224. package/dist/module/compiler/declarations.js +2121 -0
  225. package/dist/module/compiler/declarations.js.map +1 -0
  226. package/dist/module/compiler/functions-web.js +32 -0
  227. package/dist/module/compiler/functions-web.js.map +1 -0
  228. package/dist/module/compiler/functions.js +47 -0
  229. package/dist/module/compiler/functions.js.map +1 -0
  230. package/dist/module/compiler/index.js +9 -0
  231. package/dist/module/compiler/index.js.map +1 -0
  232. package/dist/module/compiler/inheritance.test.js +78 -0
  233. package/dist/module/compiler/inheritance.test.js.map +1 -0
  234. package/dist/module/compiler/keyframes.js +54 -0
  235. package/dist/module/compiler/keyframes.js.map +1 -0
  236. package/dist/module/compiler/media-query.js +166 -0
  237. package/dist/module/compiler/media-query.js.map +1 -0
  238. package/dist/module/compiler/pseudo-elements.js +44 -0
  239. package/dist/module/compiler/pseudo-elements.js.map +1 -0
  240. package/dist/module/compiler/selector-builder.js +496 -0
  241. package/dist/module/compiler/selector-builder.js.map +1 -0
  242. package/dist/module/compiler/selectors.js +409 -0
  243. package/dist/module/compiler/selectors.js.map +1 -0
  244. package/dist/module/compiler/split-by-delimiter.js +17 -0
  245. package/dist/module/compiler/split-by-delimiter.js.map +1 -0
  246. package/dist/module/compiler/stylesheet.js +471 -0
  247. package/dist/module/compiler/stylesheet.js.map +1 -0
  248. package/dist/module/compiler/supports.js +23 -0
  249. package/dist/module/compiler/supports.js.map +1 -0
  250. package/dist/module/components/ActivityIndicator.js +17 -0
  251. package/dist/module/components/ActivityIndicator.js.map +1 -0
  252. package/dist/module/components/Button.js +17 -0
  253. package/dist/module/components/Button.js.map +1 -0
  254. package/dist/module/components/FlatList.js +14 -0
  255. package/dist/module/components/FlatList.js.map +1 -0
  256. package/dist/module/components/Image.js +12 -0
  257. package/dist/module/components/Image.js.map +1 -0
  258. package/dist/module/components/Switch.js +12 -0
  259. package/dist/module/components/Switch.js.map +1 -0
  260. package/dist/module/components/Text.js +12 -0
  261. package/dist/module/components/Text.js.map +1 -0
  262. package/dist/module/components/TextInput.js +12 -0
  263. package/dist/module/components/TextInput.js.map +1 -0
  264. package/dist/module/components/View.js +12 -0
  265. package/dist/module/components/View.js.map +1 -0
  266. package/dist/module/components/index.js +12 -0
  267. package/dist/module/components/index.js.map +1 -0
  268. package/dist/module/components/react-native-safe-area-context.js +4 -0
  269. package/dist/module/components/react-native-safe-area-context.js.map +1 -0
  270. package/dist/module/components/react-native-safe-area-context.native.js +36 -0
  271. package/dist/module/components/react-native-safe-area-context.native.js.map +1 -0
  272. package/dist/module/index.js +5 -0
  273. package/dist/module/index.js.map +1 -0
  274. package/dist/module/jest/expect.d.js +2 -0
  275. package/dist/module/jest/expect.d.js.map +1 -0
  276. package/dist/module/jest/index.js +50 -0
  277. package/dist/module/jest/index.js.map +1 -0
  278. package/dist/module/jest/setup.js +3 -0
  279. package/dist/module/jest/setup.js.map +1 -0
  280. package/dist/module/jest/setupAfterEnv.js +15 -0
  281. package/dist/module/jest/setupAfterEnv.js.map +1 -0
  282. package/dist/module/metro/index.js +164 -0
  283. package/dist/module/metro/index.js.map +1 -0
  284. package/dist/module/metro/injection-code.js +22 -0
  285. package/dist/module/metro/injection-code.js.map +1 -0
  286. package/dist/module/metro/metro-transformer.js +27 -0
  287. package/dist/module/metro/metro-transformer.js.map +1 -0
  288. package/dist/module/metro/picocolors.js +67 -0
  289. package/dist/module/metro/picocolors.js.map +1 -0
  290. package/dist/module/metro/resolver.js +60 -0
  291. package/dist/module/metro/resolver.js.map +1 -0
  292. package/dist/module/metro/stringify.js +55 -0
  293. package/dist/module/metro/stringify.js.map +1 -0
  294. package/dist/module/metro/typescript.js +42 -0
  295. package/dist/module/metro/typescript.js.map +1 -0
  296. package/dist/module/package.json +1 -0
  297. package/dist/module/poison.pill.js +37 -0
  298. package/dist/module/poison.pill.js.map +1 -0
  299. package/dist/module/runtime/index.js +9 -0
  300. package/dist/module/runtime/index.js.map +1 -0
  301. package/dist/module/runtime/native/api.js +76 -0
  302. package/dist/module/runtime/native/api.js.map +1 -0
  303. package/dist/module/runtime/native/conditions/attributes.js +38 -0
  304. package/dist/module/runtime/native/conditions/attributes.js.map +1 -0
  305. package/dist/module/runtime/native/conditions/container-query.js +117 -0
  306. package/dist/module/runtime/native/conditions/container-query.js.map +1 -0
  307. package/dist/module/runtime/native/conditions/guards.js +29 -0
  308. package/dist/module/runtime/native/conditions/guards.js.map +1 -0
  309. package/dist/module/runtime/native/conditions/index.js +36 -0
  310. package/dist/module/runtime/native/conditions/index.js.map +1 -0
  311. package/dist/module/runtime/native/conditions/media-query.js +93 -0
  312. package/dist/module/runtime/native/conditions/media-query.js.map +1 -0
  313. package/dist/module/runtime/native/index.js +5 -0
  314. package/dist/module/runtime/native/index.js.map +1 -0
  315. package/dist/module/runtime/native/metro.js +5 -0
  316. package/dist/module/runtime/native/metro.js.map +1 -0
  317. package/dist/module/runtime/native/react/interaction.js +59 -0
  318. package/dist/module/runtime/native/react/interaction.js.map +1 -0
  319. package/dist/module/runtime/native/react/rules.js +251 -0
  320. package/dist/module/runtime/native/react/rules.js.map +1 -0
  321. package/dist/module/runtime/native/react/useNativeCss.js +153 -0
  322. package/dist/module/runtime/native/react/useNativeCss.js.map +1 -0
  323. package/dist/module/runtime/native/react/usePassthrough.js +45 -0
  324. package/dist/module/runtime/native/react/usePassthrough.js.map +1 -0
  325. package/dist/module/runtime/native/reactivity.js +177 -0
  326. package/dist/module/runtime/native/reactivity.js.map +1 -0
  327. package/dist/module/runtime/native/reanimated.js +13 -0
  328. package/dist/module/runtime/native/reanimated.js.map +1 -0
  329. package/dist/module/runtime/native/styles/calculate-props.js +143 -0
  330. package/dist/module/runtime/native/styles/calculate-props.js.map +1 -0
  331. package/dist/module/runtime/native/styles/constants.js +5 -0
  332. package/dist/module/runtime/native/styles/constants.js.map +1 -0
  333. package/dist/module/runtime/native/styles/defaults.js +65 -0
  334. package/dist/module/runtime/native/styles/defaults.js.map +1 -0
  335. package/dist/module/runtime/native/styles/functions/animation-timing.js +30 -0
  336. package/dist/module/runtime/native/styles/functions/animation-timing.js.map +1 -0
  337. package/dist/module/runtime/native/styles/functions/calc.js +120 -0
  338. package/dist/module/runtime/native/styles/functions/calc.js.map +1 -0
  339. package/dist/module/runtime/native/styles/functions/filters.js +70 -0
  340. package/dist/module/runtime/native/styles/functions/filters.js.map +1 -0
  341. package/dist/module/runtime/native/styles/functions/index.js +10 -0
  342. package/dist/module/runtime/native/styles/functions/index.js.map +1 -0
  343. package/dist/module/runtime/native/styles/functions/numeric-functions.js +25 -0
  344. package/dist/module/runtime/native/styles/functions/numeric-functions.js.map +1 -0
  345. package/dist/module/runtime/native/styles/functions/platform-functions.js +36 -0
  346. package/dist/module/runtime/native/styles/functions/platform-functions.js.map +1 -0
  347. package/dist/module/runtime/native/styles/functions/string-functions.js +18 -0
  348. package/dist/module/runtime/native/styles/functions/string-functions.js.map +1 -0
  349. package/dist/module/runtime/native/styles/functions/transform-functions.js +114 -0
  350. package/dist/module/runtime/native/styles/functions/transform-functions.js.map +1 -0
  351. package/dist/module/runtime/native/styles/index.js +110 -0
  352. package/dist/module/runtime/native/styles/index.js.map +1 -0
  353. package/dist/module/runtime/native/styles/resolve.js +101 -0
  354. package/dist/module/runtime/native/styles/resolve.js.map +1 -0
  355. package/dist/module/runtime/native/styles/shorthands/_handler.js +74 -0
  356. package/dist/module/runtime/native/styles/shorthands/_handler.js.map +1 -0
  357. package/dist/module/runtime/native/styles/shorthands/animation.js +51 -0
  358. package/dist/module/runtime/native/styles/shorthands/animation.js.map +1 -0
  359. package/dist/module/runtime/native/styles/shorthands/border.js +8 -0
  360. package/dist/module/runtime/native/styles/shorthands/border.js.map +1 -0
  361. package/dist/module/runtime/native/styles/shorthands/box-shadow.js +45 -0
  362. package/dist/module/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
  363. package/dist/module/runtime/native/styles/shorthands/index.js +8 -0
  364. package/dist/module/runtime/native/styles/shorthands/index.js.map +1 -0
  365. package/dist/module/runtime/native/styles/shorthands/text-shadow.js +9 -0
  366. package/dist/module/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
  367. package/dist/module/runtime/native/styles/shorthands/transform.js +18 -0
  368. package/dist/module/runtime/native/styles/shorthands/transform.js.map +1 -0
  369. package/dist/module/runtime/native/styles/units.js +43 -0
  370. package/dist/module/runtime/native/styles/units.js.map +1 -0
  371. package/dist/module/runtime/native/styles/variables.js +75 -0
  372. package/dist/module/runtime/native/styles/variables.js.map +1 -0
  373. package/dist/module/runtime/runtime.js +4 -0
  374. package/dist/module/runtime/runtime.js.map +1 -0
  375. package/dist/module/runtime/runtime.native.js +4 -0
  376. package/dist/module/runtime/runtime.native.js.map +1 -0
  377. package/dist/module/runtime/runtime.types.js +4 -0
  378. package/dist/module/runtime/runtime.types.js.map +1 -0
  379. package/dist/module/runtime/utils/components.js +14 -0
  380. package/dist/module/runtime/utils/components.js.map +1 -0
  381. package/dist/module/runtime/utils/dot-notation.types.js +2 -0
  382. package/dist/module/runtime/utils/dot-notation.types.js.map +1 -0
  383. package/dist/module/runtime/utils/index.js +8 -0
  384. package/dist/module/runtime/utils/index.js.map +1 -0
  385. package/dist/module/runtime/utils/objects.js +84 -0
  386. package/dist/module/runtime/utils/objects.js.map +1 -0
  387. package/dist/module/runtime/utils/specificity.js +39 -0
  388. package/dist/module/runtime/utils/specificity.js.map +1 -0
  389. package/dist/module/runtime/utils/style-value.js +16 -0
  390. package/dist/module/runtime/utils/style-value.js.map +1 -0
  391. package/dist/module/runtime/utils/utils.types.js +4 -0
  392. package/dist/module/runtime/utils/utils.types.js.map +1 -0
  393. package/dist/module/runtime/web/api.js +59 -0
  394. package/dist/module/runtime/web/api.js.map +1 -0
  395. package/dist/module/runtime/web/assign-style.js +23 -0
  396. package/dist/module/runtime/web/assign-style.js.map +1 -0
  397. package/dist/module/runtime/web/index.js +6 -0
  398. package/dist/module/runtime/web/index.js.map +1 -0
  399. package/dist/module/runtime/web/metro.js +5 -0
  400. package/dist/module/runtime/web/metro.js.map +1 -0
  401. package/dist/module/style-collection/index.js +95 -0
  402. package/dist/module/style-collection/index.js.map +1 -0
  403. package/dist/module/style-collection/root.js +24 -0
  404. package/dist/module/style-collection/root.js.map +1 -0
  405. package/dist/typescript/commonjs/example/app.config.d.ts +4 -0
  406. package/dist/typescript/commonjs/example/app.config.d.ts.map +1 -0
  407. package/dist/typescript/commonjs/example/src/App.d.ts +3 -0
  408. package/dist/typescript/commonjs/example/src/App.d.ts.map +1 -0
  409. package/dist/typescript/commonjs/package.json +1 -0
  410. package/dist/typescript/commonjs/src/babel/allowedModules.d.ts +2 -0
  411. package/dist/typescript/commonjs/src/babel/allowedModules.d.ts.map +1 -0
  412. package/dist/typescript/commonjs/src/babel/helpers.d.ts +13 -0
  413. package/dist/typescript/commonjs/src/babel/helpers.d.ts.map +1 -0
  414. package/dist/typescript/commonjs/src/babel/import-plugin.d.ts +6 -0
  415. package/dist/typescript/commonjs/src/babel/import-plugin.d.ts.map +1 -0
  416. package/dist/typescript/commonjs/src/babel/index.d.ts +1 -0
  417. package/dist/typescript/commonjs/src/babel/index.d.ts.map +1 -0
  418. package/dist/typescript/commonjs/src/babel/react-native-web.d.ts +8 -0
  419. package/dist/typescript/commonjs/src/babel/react-native-web.d.ts.map +1 -0
  420. package/dist/typescript/commonjs/src/babel/react-native.d.ts +8 -0
  421. package/dist/typescript/commonjs/src/babel/react-native.d.ts.map +1 -0
  422. package/dist/typescript/commonjs/src/compiler/atRules.d.ts +34 -0
  423. package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -0
  424. package/dist/typescript/commonjs/src/compiler/compiler.d.ts +17 -0
  425. package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -0
  426. package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +197 -0
  427. package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -0
  428. package/dist/typescript/commonjs/src/compiler/container-query.d.ts +5 -0
  429. package/dist/typescript/commonjs/src/compiler/container-query.d.ts.map +1 -0
  430. package/dist/typescript/commonjs/src/compiler/declarations.d.ts +120 -0
  431. package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -0
  432. package/dist/typescript/commonjs/src/compiler/functions-web.d.ts +11 -0
  433. package/dist/typescript/commonjs/src/compiler/functions-web.d.ts.map +1 -0
  434. package/dist/typescript/commonjs/src/compiler/functions.d.ts +11 -0
  435. package/dist/typescript/commonjs/src/compiler/functions.d.ts.map +1 -0
  436. package/dist/typescript/commonjs/src/compiler/index.d.ts +7 -0
  437. package/dist/typescript/commonjs/src/compiler/index.d.ts.map +1 -0
  438. package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts +2 -0
  439. package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts.map +1 -0
  440. package/dist/typescript/commonjs/src/compiler/keyframes.d.ts +7 -0
  441. package/dist/typescript/commonjs/src/compiler/keyframes.d.ts.map +1 -0
  442. package/dist/typescript/commonjs/src/compiler/media-query.d.ts +7 -0
  443. package/dist/typescript/commonjs/src/compiler/media-query.d.ts.map +1 -0
  444. package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts +4 -0
  445. package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts.map +1 -0
  446. package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts +24 -0
  447. package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -0
  448. package/dist/typescript/commonjs/src/compiler/selectors.d.ts +24 -0
  449. package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -0
  450. package/dist/typescript/commonjs/src/compiler/split-by-delimiter.d.ts +2 -0
  451. package/dist/typescript/commonjs/src/compiler/split-by-delimiter.d.ts.map +1 -0
  452. package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +68 -0
  453. package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -0
  454. package/dist/typescript/commonjs/src/compiler/supports.d.ts +3 -0
  455. package/dist/typescript/commonjs/src/compiler/supports.d.ts.map +1 -0
  456. package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +13 -0
  457. package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +1 -0
  458. package/dist/typescript/commonjs/src/components/Button.d.ts +13 -0
  459. package/dist/typescript/commonjs/src/components/Button.d.ts.map +1 -0
  460. package/dist/typescript/commonjs/src/components/FlatList.d.ts +10 -0
  461. package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -0
  462. package/dist/typescript/commonjs/src/components/Image.d.ts +8 -0
  463. package/dist/typescript/commonjs/src/components/Image.d.ts.map +1 -0
  464. package/dist/typescript/commonjs/src/components/Switch.d.ts +8 -0
  465. package/dist/typescript/commonjs/src/components/Switch.d.ts.map +1 -0
  466. package/dist/typescript/commonjs/src/components/Text.d.ts +8 -0
  467. package/dist/typescript/commonjs/src/components/Text.d.ts.map +1 -0
  468. package/dist/typescript/commonjs/src/components/TextInput.d.ts +8 -0
  469. package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +1 -0
  470. package/dist/typescript/commonjs/src/components/View.d.ts +8 -0
  471. package/dist/typescript/commonjs/src/components/View.d.ts.map +1 -0
  472. package/dist/typescript/commonjs/src/components/index.d.ts +10 -0
  473. package/dist/typescript/commonjs/src/components/index.d.ts.map +1 -0
  474. package/dist/typescript/commonjs/src/components/react-native-safe-area-context.d.ts +2 -0
  475. package/dist/typescript/commonjs/src/components/react-native-safe-area-context.d.ts.map +1 -0
  476. package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts +4 -0
  477. package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts.map +1 -0
  478. package/dist/typescript/commonjs/src/index.d.ts +3 -0
  479. package/dist/typescript/commonjs/src/index.d.ts.map +1 -0
  480. package/dist/typescript/commonjs/src/jest/index.d.ts +30 -0
  481. package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -0
  482. package/dist/typescript/commonjs/src/jest/setup.d.ts +1 -0
  483. package/dist/typescript/commonjs/src/jest/setup.d.ts.map +1 -0
  484. package/dist/typescript/commonjs/src/jest/setupAfterEnv.d.ts +1 -0
  485. package/dist/typescript/commonjs/src/jest/setupAfterEnv.d.ts.map +1 -0
  486. package/dist/typescript/commonjs/src/metro/index.d.ts +11 -0
  487. package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -0
  488. package/dist/typescript/commonjs/src/metro/injection-code.d.ts +13 -0
  489. package/dist/typescript/commonjs/src/metro/injection-code.d.ts.map +1 -0
  490. package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts +6 -0
  491. package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts.map +1 -0
  492. package/dist/typescript/commonjs/src/metro/picocolors.d.ts +27 -0
  493. package/dist/typescript/commonjs/src/metro/picocolors.d.ts.map +1 -0
  494. package/dist/typescript/commonjs/src/metro/resolver.d.ts +4 -0
  495. package/dist/typescript/commonjs/src/metro/resolver.d.ts.map +1 -0
  496. package/dist/typescript/commonjs/src/metro/stringify.d.ts +7 -0
  497. package/dist/typescript/commonjs/src/metro/stringify.d.ts.map +1 -0
  498. package/dist/typescript/commonjs/src/metro/typescript.d.ts +2 -0
  499. package/dist/typescript/commonjs/src/metro/typescript.d.ts.map +1 -0
  500. package/dist/typescript/commonjs/src/poison.pill.d.ts +2 -0
  501. package/dist/typescript/commonjs/src/poison.pill.d.ts.map +1 -0
  502. package/dist/typescript/commonjs/src/runtime/index.d.ts +7 -0
  503. package/dist/typescript/commonjs/src/runtime/index.d.ts.map +1 -0
  504. package/dist/typescript/commonjs/src/runtime/native/api.d.ts +19 -0
  505. package/dist/typescript/commonjs/src/runtime/native/api.d.ts.map +1 -0
  506. package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts +5 -0
  507. package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts.map +1 -0
  508. package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts +7 -0
  509. package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -0
  510. package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts +5 -0
  511. package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -0
  512. package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts +6 -0
  513. package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -0
  514. package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts +4 -0
  515. package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts.map +1 -0
  516. package/dist/typescript/commonjs/src/runtime/native/index.d.ts +4 -0
  517. package/dist/typescript/commonjs/src/runtime/native/index.d.ts.map +1 -0
  518. package/dist/typescript/commonjs/src/runtime/native/metro.d.ts +2 -0
  519. package/dist/typescript/commonjs/src/runtime/native/metro.d.ts.map +1 -0
  520. package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts +6 -0
  521. package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts.map +1 -0
  522. package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +7 -0
  523. package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts.map +1 -0
  524. package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +38 -0
  525. package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -0
  526. package/dist/typescript/commonjs/src/runtime/native/react/usePassthrough.d.ts +4 -0
  527. package/dist/typescript/commonjs/src/runtime/native/react/usePassthrough.d.ts.map +1 -0
  528. package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +55 -0
  529. package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -0
  530. package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts +5 -0
  531. package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts.map +1 -0
  532. package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts +10 -0
  533. package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -0
  534. package/dist/typescript/commonjs/src/runtime/native/styles/constants.d.ts +3 -0
  535. package/dist/typescript/commonjs/src/runtime/native/styles/constants.d.ts.map +1 -0
  536. package/dist/typescript/commonjs/src/runtime/native/styles/defaults.d.ts +3 -0
  537. package/dist/typescript/commonjs/src/runtime/native/styles/defaults.d.ts.map +1 -0
  538. package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
  539. package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
  540. package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts +3 -0
  541. package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
  542. package/dist/typescript/commonjs/src/runtime/native/styles/functions/filters.d.ts +12 -0
  543. package/dist/typescript/commonjs/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
  544. package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts +8 -0
  545. package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts.map +1 -0
  546. package/dist/typescript/commonjs/src/runtime/native/styles/functions/numeric-functions.d.ts +5 -0
  547. package/dist/typescript/commonjs/src/runtime/native/styles/functions/numeric-functions.d.ts.map +1 -0
  548. package/dist/typescript/commonjs/src/runtime/native/styles/functions/platform-functions.d.ts +8 -0
  549. package/dist/typescript/commonjs/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
  550. package/dist/typescript/commonjs/src/runtime/native/styles/functions/string-functions.d.ts +3 -0
  551. package/dist/typescript/commonjs/src/runtime/native/styles/functions/string-functions.d.ts.map +1 -0
  552. package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
  553. package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
  554. package/dist/typescript/commonjs/src/runtime/native/styles/index.d.ts +19 -0
  555. package/dist/typescript/commonjs/src/runtime/native/styles/index.d.ts.map +1 -0
  556. package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts +18 -0
  557. package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts.map +1 -0
  558. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/_handler.d.ts +11 -0
  559. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
  560. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
  561. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
  562. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts +2 -0
  563. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
  564. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
  565. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
  566. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts +6 -0
  567. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
  568. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
  569. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
  570. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/transform.d.ts +7 -0
  571. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
  572. package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts +6 -0
  573. package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -0
  574. package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts +5 -0
  575. package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -0
  576. package/dist/typescript/commonjs/src/runtime/runtime.d.ts +2 -0
  577. package/dist/typescript/commonjs/src/runtime/runtime.d.ts.map +1 -0
  578. package/dist/typescript/commonjs/src/runtime/runtime.native.d.ts +2 -0
  579. package/dist/typescript/commonjs/src/runtime/runtime.native.d.ts.map +1 -0
  580. package/dist/typescript/commonjs/src/runtime/runtime.types.d.ts +47 -0
  581. package/dist/typescript/commonjs/src/runtime/runtime.types.d.ts.map +1 -0
  582. package/dist/typescript/commonjs/src/runtime/utils/components.d.ts +2 -0
  583. package/dist/typescript/commonjs/src/runtime/utils/components.d.ts.map +1 -0
  584. package/dist/typescript/commonjs/src/runtime/utils/dot-notation.types.d.ts +23 -0
  585. package/dist/typescript/commonjs/src/runtime/utils/dot-notation.types.d.ts.map +1 -0
  586. package/dist/typescript/commonjs/src/runtime/utils/index.d.ts +6 -0
  587. package/dist/typescript/commonjs/src/runtime/utils/index.d.ts.map +1 -0
  588. package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts +5 -0
  589. package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -0
  590. package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts +13 -0
  591. package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts.map +1 -0
  592. package/dist/typescript/commonjs/src/runtime/utils/style-value.d.ts +4 -0
  593. package/dist/typescript/commonjs/src/runtime/utils/style-value.d.ts.map +1 -0
  594. package/dist/typescript/commonjs/src/runtime/utils/utils.types.d.ts +5 -0
  595. package/dist/typescript/commonjs/src/runtime/utils/utils.types.d.ts.map +1 -0
  596. package/dist/typescript/commonjs/src/runtime/web/api.d.ts +10 -0
  597. package/dist/typescript/commonjs/src/runtime/web/api.d.ts.map +1 -0
  598. package/dist/typescript/commonjs/src/runtime/web/assign-style.d.ts +2 -0
  599. package/dist/typescript/commonjs/src/runtime/web/assign-style.d.ts.map +1 -0
  600. package/dist/typescript/commonjs/src/runtime/web/index.d.ts +4 -0
  601. package/dist/typescript/commonjs/src/runtime/web/index.d.ts.map +1 -0
  602. package/dist/typescript/commonjs/src/runtime/web/metro.d.ts +2 -0
  603. package/dist/typescript/commonjs/src/runtime/web/metro.d.ts.map +1 -0
  604. package/dist/typescript/commonjs/src/style-collection/index.d.ts +14 -0
  605. package/dist/typescript/commonjs/src/style-collection/index.d.ts.map +1 -0
  606. package/dist/typescript/commonjs/src/style-collection/root.d.ts +11 -0
  607. package/dist/typescript/commonjs/src/style-collection/root.d.ts.map +1 -0
  608. package/dist/typescript/module/example/app.config.d.ts +4 -0
  609. package/dist/typescript/module/example/app.config.d.ts.map +1 -0
  610. package/dist/typescript/module/example/src/App.d.ts +3 -0
  611. package/dist/typescript/module/example/src/App.d.ts.map +1 -0
  612. package/dist/typescript/module/package.json +1 -0
  613. package/dist/typescript/module/src/babel/allowedModules.d.ts +2 -0
  614. package/dist/typescript/module/src/babel/allowedModules.d.ts.map +1 -0
  615. package/dist/typescript/module/src/babel/helpers.d.ts +13 -0
  616. package/dist/typescript/module/src/babel/helpers.d.ts.map +1 -0
  617. package/dist/typescript/module/src/babel/import-plugin.d.ts +6 -0
  618. package/dist/typescript/module/src/babel/import-plugin.d.ts.map +1 -0
  619. package/dist/typescript/module/src/babel/index.d.ts +1 -0
  620. package/dist/typescript/module/src/babel/index.d.ts.map +1 -0
  621. package/dist/typescript/module/src/babel/react-native-web.d.ts +8 -0
  622. package/dist/typescript/module/src/babel/react-native-web.d.ts.map +1 -0
  623. package/dist/typescript/module/src/babel/react-native.d.ts +8 -0
  624. package/dist/typescript/module/src/babel/react-native.d.ts.map +1 -0
  625. package/dist/typescript/module/src/compiler/atRules.d.ts +34 -0
  626. package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -0
  627. package/dist/typescript/module/src/compiler/compiler.d.ts +17 -0
  628. package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -0
  629. package/dist/typescript/module/src/compiler/compiler.types.d.ts +197 -0
  630. package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -0
  631. package/dist/typescript/module/src/compiler/container-query.d.ts +5 -0
  632. package/dist/typescript/module/src/compiler/container-query.d.ts.map +1 -0
  633. package/dist/typescript/module/src/compiler/declarations.d.ts +120 -0
  634. package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -0
  635. package/dist/typescript/module/src/compiler/functions-web.d.ts +11 -0
  636. package/dist/typescript/module/src/compiler/functions-web.d.ts.map +1 -0
  637. package/dist/typescript/module/src/compiler/functions.d.ts +11 -0
  638. package/dist/typescript/module/src/compiler/functions.d.ts.map +1 -0
  639. package/dist/typescript/module/src/compiler/index.d.ts +7 -0
  640. package/dist/typescript/module/src/compiler/index.d.ts.map +1 -0
  641. package/dist/typescript/module/src/compiler/inheritance.test.d.ts +2 -0
  642. package/dist/typescript/module/src/compiler/inheritance.test.d.ts.map +1 -0
  643. package/dist/typescript/module/src/compiler/keyframes.d.ts +7 -0
  644. package/dist/typescript/module/src/compiler/keyframes.d.ts.map +1 -0
  645. package/dist/typescript/module/src/compiler/media-query.d.ts +7 -0
  646. package/dist/typescript/module/src/compiler/media-query.d.ts.map +1 -0
  647. package/dist/typescript/module/src/compiler/pseudo-elements.d.ts +4 -0
  648. package/dist/typescript/module/src/compiler/pseudo-elements.d.ts.map +1 -0
  649. package/dist/typescript/module/src/compiler/selector-builder.d.ts +24 -0
  650. package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -0
  651. package/dist/typescript/module/src/compiler/selectors.d.ts +24 -0
  652. package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -0
  653. package/dist/typescript/module/src/compiler/split-by-delimiter.d.ts +2 -0
  654. package/dist/typescript/module/src/compiler/split-by-delimiter.d.ts.map +1 -0
  655. package/dist/typescript/module/src/compiler/stylesheet.d.ts +68 -0
  656. package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -0
  657. package/dist/typescript/module/src/compiler/supports.d.ts +3 -0
  658. package/dist/typescript/module/src/compiler/supports.d.ts.map +1 -0
  659. package/dist/typescript/module/src/components/ActivityIndicator.d.ts +13 -0
  660. package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +1 -0
  661. package/dist/typescript/module/src/components/Button.d.ts +13 -0
  662. package/dist/typescript/module/src/components/Button.d.ts.map +1 -0
  663. package/dist/typescript/module/src/components/FlatList.d.ts +10 -0
  664. package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -0
  665. package/dist/typescript/module/src/components/Image.d.ts +8 -0
  666. package/dist/typescript/module/src/components/Image.d.ts.map +1 -0
  667. package/dist/typescript/module/src/components/Switch.d.ts +8 -0
  668. package/dist/typescript/module/src/components/Switch.d.ts.map +1 -0
  669. package/dist/typescript/module/src/components/Text.d.ts +8 -0
  670. package/dist/typescript/module/src/components/Text.d.ts.map +1 -0
  671. package/dist/typescript/module/src/components/TextInput.d.ts +8 -0
  672. package/dist/typescript/module/src/components/TextInput.d.ts.map +1 -0
  673. package/dist/typescript/module/src/components/View.d.ts +8 -0
  674. package/dist/typescript/module/src/components/View.d.ts.map +1 -0
  675. package/dist/typescript/module/src/components/index.d.ts +10 -0
  676. package/dist/typescript/module/src/components/index.d.ts.map +1 -0
  677. package/dist/typescript/module/src/components/react-native-safe-area-context.d.ts +2 -0
  678. package/dist/typescript/module/src/components/react-native-safe-area-context.d.ts.map +1 -0
  679. package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts +4 -0
  680. package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts.map +1 -0
  681. package/dist/typescript/module/src/index.d.ts +3 -0
  682. package/dist/typescript/module/src/index.d.ts.map +1 -0
  683. package/dist/typescript/module/src/jest/index.d.ts +30 -0
  684. package/dist/typescript/module/src/jest/index.d.ts.map +1 -0
  685. package/dist/typescript/module/src/jest/setup.d.ts +1 -0
  686. package/dist/typescript/module/src/jest/setup.d.ts.map +1 -0
  687. package/dist/typescript/module/src/jest/setupAfterEnv.d.ts +1 -0
  688. package/dist/typescript/module/src/jest/setupAfterEnv.d.ts.map +1 -0
  689. package/dist/typescript/module/src/metro/index.d.ts +11 -0
  690. package/dist/typescript/module/src/metro/index.d.ts.map +1 -0
  691. package/dist/typescript/module/src/metro/injection-code.d.ts +13 -0
  692. package/dist/typescript/module/src/metro/injection-code.d.ts.map +1 -0
  693. package/dist/typescript/module/src/metro/metro-transformer.d.ts +6 -0
  694. package/dist/typescript/module/src/metro/metro-transformer.d.ts.map +1 -0
  695. package/dist/typescript/module/src/metro/picocolors.d.ts +27 -0
  696. package/dist/typescript/module/src/metro/picocolors.d.ts.map +1 -0
  697. package/dist/typescript/module/src/metro/resolver.d.ts +4 -0
  698. package/dist/typescript/module/src/metro/resolver.d.ts.map +1 -0
  699. package/dist/typescript/module/src/metro/stringify.d.ts +7 -0
  700. package/dist/typescript/module/src/metro/stringify.d.ts.map +1 -0
  701. package/dist/typescript/module/src/metro/typescript.d.ts +2 -0
  702. package/dist/typescript/module/src/metro/typescript.d.ts.map +1 -0
  703. package/dist/typescript/module/src/poison.pill.d.ts +2 -0
  704. package/dist/typescript/module/src/poison.pill.d.ts.map +1 -0
  705. package/dist/typescript/module/src/runtime/index.d.ts +7 -0
  706. package/dist/typescript/module/src/runtime/index.d.ts.map +1 -0
  707. package/dist/typescript/module/src/runtime/native/api.d.ts +19 -0
  708. package/dist/typescript/module/src/runtime/native/api.d.ts.map +1 -0
  709. package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts +5 -0
  710. package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts.map +1 -0
  711. package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts +7 -0
  712. package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -0
  713. package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts +5 -0
  714. package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -0
  715. package/dist/typescript/module/src/runtime/native/conditions/index.d.ts +6 -0
  716. package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -0
  717. package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts +4 -0
  718. package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts.map +1 -0
  719. package/dist/typescript/module/src/runtime/native/index.d.ts +4 -0
  720. package/dist/typescript/module/src/runtime/native/index.d.ts.map +1 -0
  721. package/dist/typescript/module/src/runtime/native/metro.d.ts +2 -0
  722. package/dist/typescript/module/src/runtime/native/metro.d.ts.map +1 -0
  723. package/dist/typescript/module/src/runtime/native/react/interaction.d.ts +6 -0
  724. package/dist/typescript/module/src/runtime/native/react/interaction.d.ts.map +1 -0
  725. package/dist/typescript/module/src/runtime/native/react/rules.d.ts +7 -0
  726. package/dist/typescript/module/src/runtime/native/react/rules.d.ts.map +1 -0
  727. package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +38 -0
  728. package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -0
  729. package/dist/typescript/module/src/runtime/native/react/usePassthrough.d.ts +4 -0
  730. package/dist/typescript/module/src/runtime/native/react/usePassthrough.d.ts.map +1 -0
  731. package/dist/typescript/module/src/runtime/native/reactivity.d.ts +55 -0
  732. package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -0
  733. package/dist/typescript/module/src/runtime/native/reanimated.d.ts +5 -0
  734. package/dist/typescript/module/src/runtime/native/reanimated.d.ts.map +1 -0
  735. package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts +10 -0
  736. package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -0
  737. package/dist/typescript/module/src/runtime/native/styles/constants.d.ts +3 -0
  738. package/dist/typescript/module/src/runtime/native/styles/constants.d.ts.map +1 -0
  739. package/dist/typescript/module/src/runtime/native/styles/defaults.d.ts +3 -0
  740. package/dist/typescript/module/src/runtime/native/styles/defaults.d.ts.map +1 -0
  741. package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
  742. package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
  743. package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts +3 -0
  744. package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
  745. package/dist/typescript/module/src/runtime/native/styles/functions/filters.d.ts +12 -0
  746. package/dist/typescript/module/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
  747. package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts +8 -0
  748. package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts.map +1 -0
  749. package/dist/typescript/module/src/runtime/native/styles/functions/numeric-functions.d.ts +5 -0
  750. package/dist/typescript/module/src/runtime/native/styles/functions/numeric-functions.d.ts.map +1 -0
  751. package/dist/typescript/module/src/runtime/native/styles/functions/platform-functions.d.ts +8 -0
  752. package/dist/typescript/module/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
  753. package/dist/typescript/module/src/runtime/native/styles/functions/string-functions.d.ts +3 -0
  754. package/dist/typescript/module/src/runtime/native/styles/functions/string-functions.d.ts.map +1 -0
  755. package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
  756. package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
  757. package/dist/typescript/module/src/runtime/native/styles/index.d.ts +19 -0
  758. package/dist/typescript/module/src/runtime/native/styles/index.d.ts.map +1 -0
  759. package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts +18 -0
  760. package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts.map +1 -0
  761. package/dist/typescript/module/src/runtime/native/styles/shorthands/_handler.d.ts +11 -0
  762. package/dist/typescript/module/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
  763. package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
  764. package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
  765. package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts +2 -0
  766. package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
  767. package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
  768. package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
  769. package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts +6 -0
  770. package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
  771. package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
  772. package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
  773. package/dist/typescript/module/src/runtime/native/styles/shorthands/transform.d.ts +7 -0
  774. package/dist/typescript/module/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
  775. package/dist/typescript/module/src/runtime/native/styles/units.d.ts +6 -0
  776. package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -0
  777. package/dist/typescript/module/src/runtime/native/styles/variables.d.ts +5 -0
  778. package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -0
  779. package/dist/typescript/module/src/runtime/runtime.d.ts +2 -0
  780. package/dist/typescript/module/src/runtime/runtime.d.ts.map +1 -0
  781. package/dist/typescript/module/src/runtime/runtime.native.d.ts +2 -0
  782. package/dist/typescript/module/src/runtime/runtime.native.d.ts.map +1 -0
  783. package/dist/typescript/module/src/runtime/runtime.types.d.ts +47 -0
  784. package/dist/typescript/module/src/runtime/runtime.types.d.ts.map +1 -0
  785. package/dist/typescript/module/src/runtime/utils/components.d.ts +2 -0
  786. package/dist/typescript/module/src/runtime/utils/components.d.ts.map +1 -0
  787. package/dist/typescript/module/src/runtime/utils/dot-notation.types.d.ts +23 -0
  788. package/dist/typescript/module/src/runtime/utils/dot-notation.types.d.ts.map +1 -0
  789. package/dist/typescript/module/src/runtime/utils/index.d.ts +6 -0
  790. package/dist/typescript/module/src/runtime/utils/index.d.ts.map +1 -0
  791. package/dist/typescript/module/src/runtime/utils/objects.d.ts +5 -0
  792. package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -0
  793. package/dist/typescript/module/src/runtime/utils/specificity.d.ts +13 -0
  794. package/dist/typescript/module/src/runtime/utils/specificity.d.ts.map +1 -0
  795. package/dist/typescript/module/src/runtime/utils/style-value.d.ts +4 -0
  796. package/dist/typescript/module/src/runtime/utils/style-value.d.ts.map +1 -0
  797. package/dist/typescript/module/src/runtime/utils/utils.types.d.ts +5 -0
  798. package/dist/typescript/module/src/runtime/utils/utils.types.d.ts.map +1 -0
  799. package/dist/typescript/module/src/runtime/web/api.d.ts +10 -0
  800. package/dist/typescript/module/src/runtime/web/api.d.ts.map +1 -0
  801. package/dist/typescript/module/src/runtime/web/assign-style.d.ts +2 -0
  802. package/dist/typescript/module/src/runtime/web/assign-style.d.ts.map +1 -0
  803. package/dist/typescript/module/src/runtime/web/index.d.ts +4 -0
  804. package/dist/typescript/module/src/runtime/web/index.d.ts.map +1 -0
  805. package/dist/typescript/module/src/runtime/web/metro.d.ts +2 -0
  806. package/dist/typescript/module/src/runtime/web/metro.d.ts.map +1 -0
  807. package/dist/typescript/module/src/style-collection/index.d.ts +14 -0
  808. package/dist/typescript/module/src/style-collection/index.d.ts.map +1 -0
  809. package/dist/typescript/module/src/style-collection/root.d.ts +11 -0
  810. package/dist/typescript/module/src/style-collection/root.d.ts.map +1 -0
  811. package/package.json +262 -47
  812. package/src/babel/allowedModules.ts +24 -0
  813. package/src/babel/helpers.ts +40 -0
  814. package/src/babel/import-plugin.ts +176 -0
  815. package/src/babel/index.ts +9 -0
  816. package/src/babel/react-native-web.ts +226 -0
  817. package/src/babel/react-native.ts +226 -0
  818. package/src/compiler/atRules.ts +158 -0
  819. package/src/compiler/compiler.ts +306 -0
  820. package/src/compiler/compiler.types.ts +266 -0
  821. package/src/compiler/container-query.ts +97 -0
  822. package/src/compiler/declarations.ts +3237 -0
  823. package/src/compiler/functions-web.ts +44 -0
  824. package/src/compiler/functions.ts +64 -0
  825. package/src/compiler/index.ts +7 -0
  826. package/src/compiler/inheritance.test.ts +121 -0
  827. package/src/compiler/keyframes.ts +86 -0
  828. package/src/compiler/media-query.ts +251 -0
  829. package/src/compiler/pseudo-elements.ts +54 -0
  830. package/src/compiler/selector-builder.ts +586 -0
  831. package/src/compiler/selectors.ts +505 -0
  832. package/src/compiler/split-by-delimiter.ts +19 -0
  833. package/src/compiler/stylesheet.ts +681 -0
  834. package/src/compiler/supports.ts +26 -0
  835. package/src/components/ActivityIndicator.tsx +27 -0
  836. package/src/components/Button.tsx +22 -0
  837. package/src/components/FlatList.tsx +21 -0
  838. package/src/components/Image.tsx +17 -0
  839. package/src/components/Switch.tsx +17 -0
  840. package/src/components/Text.tsx +17 -0
  841. package/src/components/TextInput.tsx +17 -0
  842. package/src/components/View.tsx +17 -0
  843. package/src/components/index.tsx +10 -0
  844. package/src/components/react-native-safe-area-context.native.tsx +40 -0
  845. package/src/components/react-native-safe-area-context.tsx +1 -0
  846. package/src/index.ts +3 -0
  847. package/src/jest/expect.d.ts +1 -0
  848. package/src/jest/index.ts +75 -0
  849. package/src/jest/setup.ts +1 -0
  850. package/src/jest/setupAfterEnv.ts +13 -0
  851. package/src/metro/index.ts +239 -0
  852. package/src/metro/injection-code.ts +34 -0
  853. package/src/metro/metro-transformer.ts +48 -0
  854. package/src/metro/picocolors.ts +77 -0
  855. package/src/metro/resolver.ts +97 -0
  856. package/src/metro/stringify.ts +59 -0
  857. package/src/metro/typescript.ts +73 -0
  858. package/src/poison.pill.ts +36 -0
  859. package/src/runtime/index.ts +7 -0
  860. package/src/runtime/native/api.ts +108 -0
  861. package/src/runtime/native/conditions/attributes.ts +52 -0
  862. package/src/runtime/native/conditions/container-query.ts +162 -0
  863. package/src/runtime/native/conditions/guards.ts +44 -0
  864. package/src/runtime/native/conditions/index.ts +54 -0
  865. package/src/runtime/native/conditions/media-query.ts +98 -0
  866. package/src/runtime/native/index.ts +4 -0
  867. package/src/runtime/native/metro.ts +2 -0
  868. package/src/runtime/native/react/interaction.ts +90 -0
  869. package/src/runtime/native/react/rules.ts +336 -0
  870. package/src/runtime/native/react/useNativeCss.ts +203 -0
  871. package/src/runtime/native/react/usePassthrough.ts +51 -0
  872. package/src/runtime/native/reactivity.ts +255 -0
  873. package/src/runtime/native/reanimated.ts +22 -0
  874. package/src/runtime/native/styles/calculate-props.ts +197 -0
  875. package/src/runtime/native/styles/constants.ts +2 -0
  876. package/src/runtime/native/styles/defaults.ts +79 -0
  877. package/src/runtime/native/styles/functions/animation-timing.ts +44 -0
  878. package/src/runtime/native/styles/functions/calc.ts +121 -0
  879. package/src/runtime/native/styles/functions/filters.ts +98 -0
  880. package/src/runtime/native/styles/functions/index.ts +7 -0
  881. package/src/runtime/native/styles/functions/numeric-functions.ts +38 -0
  882. package/src/runtime/native/styles/functions/platform-functions.ts +50 -0
  883. package/src/runtime/native/styles/functions/string-functions.ts +22 -0
  884. package/src/runtime/native/styles/functions/transform-functions.ts +84 -0
  885. package/src/runtime/native/styles/index.ts +197 -0
  886. package/src/runtime/native/styles/resolve.ts +162 -0
  887. package/src/runtime/native/styles/shorthands/_handler.ts +121 -0
  888. package/src/runtime/native/styles/shorthands/animation.ts +123 -0
  889. package/src/runtime/native/styles/shorthands/border.ts +10 -0
  890. package/src/runtime/native/styles/shorthands/box-shadow.ts +74 -0
  891. package/src/runtime/native/styles/shorthands/index.ts +5 -0
  892. package/src/runtime/native/styles/shorthands/text-shadow.ts +17 -0
  893. package/src/runtime/native/styles/shorthands/transform.ts +23 -0
  894. package/src/runtime/native/styles/units.ts +57 -0
  895. package/src/runtime/native/styles/variables.ts +88 -0
  896. package/src/runtime/runtime.native.ts +1 -0
  897. package/src/runtime/runtime.ts +1 -0
  898. package/src/runtime/runtime.types.ts +130 -0
  899. package/src/runtime/utils/components.ts +15 -0
  900. package/src/runtime/utils/dot-notation.types.ts +118 -0
  901. package/src/runtime/utils/index.ts +5 -0
  902. package/src/runtime/utils/objects.ts +109 -0
  903. package/src/runtime/utils/specificity.ts +45 -0
  904. package/src/runtime/utils/style-value.ts +24 -0
  905. package/src/runtime/utils/utils.types.ts +19 -0
  906. package/src/runtime/web/api.ts +88 -0
  907. package/src/runtime/web/assign-style.ts +26 -0
  908. package/src/runtime/web/index.ts +5 -0
  909. package/src/runtime/web/metro.ts +2 -0
  910. package/src/style-collection/index.ts +142 -0
  911. package/src/style-collection/root.ts +35 -0
  912. package/types.d.ts +70 -0
  913. package/.babelrc +0 -17
  914. package/.editorconfig +0 -17
  915. package/.eslintignore +0 -3
  916. package/.eslintrc +0 -39
  917. package/.npmignore +0 -7
  918. package/build/index.js +0 -299
  919. package/build/utils.js +0 -61
  920. package/circle.yml +0 -31
  921. package/jsconfig.json +0 -9
  922. package/login.sh +0 -11
  923. package/src/index.js +0 -184
  924. package/src/utils.js +0 -32
  925. package/test/rnc.test.js +0 -258
  926. package/yarn.lock +0 -3333
@@ -0,0 +1,3237 @@
1
+ // cSpell:ignore rcap,vmin,svmin,lvmin,dvmin,cqmin,vmax,svmax,lvmax,dvmax,cqmax,currentcolor,oklab,oklch,prophoto
2
+
3
+ import Color from "colorjs.io";
4
+ import type {
5
+ Angle,
6
+ BorderSideWidth,
7
+ BorderStyle,
8
+ ColorOrAuto,
9
+ CssColor,
10
+ CustomProperty,
11
+ Declaration,
12
+ DimensionPercentageFor_LengthValue,
13
+ EnvironmentVariable,
14
+ FontSize,
15
+ FontStyle,
16
+ FontVariantCaps,
17
+ FontWeight,
18
+ GapValue,
19
+ Gradient,
20
+ GradientItemFor_DimensionPercentageFor_LengthValue,
21
+ Length,
22
+ LengthPercentageOrAuto,
23
+ LengthValue,
24
+ LineDirection,
25
+ LineHeight,
26
+ LineStyle,
27
+ MaxSize,
28
+ NumberOrPercentage,
29
+ Scale,
30
+ Size,
31
+ Size2DFor_DimensionPercentageFor_LengthValue,
32
+ Time,
33
+ Token,
34
+ TokenOrValue,
35
+ Translate,
36
+ UnresolvedColor,
37
+ } from "lightningcss";
38
+
39
+ import type {
40
+ StyleDescriptor,
41
+ StyleFunction,
42
+ StyleRule,
43
+ } from "./compiler.types";
44
+ import { parseEasingFunction, parseIterationCount } from "./keyframes";
45
+ import { toRNProperty } from "./selectors";
46
+ import type { StylesheetBuilder } from "./stylesheet";
47
+
48
+ const CommaSeparator = Symbol("CommaSeparator");
49
+
50
+ type DeclarationType<P extends Declaration["property"]> = Extract<
51
+ Declaration,
52
+ { property: P }
53
+ >;
54
+
55
+ type Parser<T extends Declaration["property"] = Declaration["property"]> = (
56
+ declaration: Extract<Declaration, { property: T }>,
57
+ builder: StylesheetBuilder,
58
+ propertyName: string,
59
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
60
+ ) => StyleDescriptor | void;
61
+
62
+ const propertyRename: Record<string, string> = {
63
+ "background-image": "experimental_backgroundImage",
64
+ };
65
+
66
+ // TODO: We need a better way to handle this
67
+ const unparsedRuntimeParsing = new Set([
68
+ "animation",
69
+ "border",
70
+ "box-shadow",
71
+ "text-shadow",
72
+ "transform",
73
+ "scale",
74
+ "rotate",
75
+ "translate",
76
+ ]);
77
+
78
+ const parsers: {
79
+ [K in Declaration["property"]]?: Parser<K>;
80
+ } = {
81
+ "align-content": parseAlignContent,
82
+ "align-items": parseAlignItems,
83
+ "align-self": parseAlignSelf,
84
+ "animation": addAnimationValue,
85
+ "animation-delay": addAnimationValue,
86
+ "animation-direction": addAnimationValue,
87
+ "animation-duration": addAnimationValue,
88
+ "animation-fill-mode": addAnimationValue,
89
+ "animation-iteration-count": addAnimationValue,
90
+ "animation-name": addAnimationValue,
91
+ "animation-play-state": addAnimationValue,
92
+ "animation-timing-function": addAnimationValue,
93
+ "aspect-ratio": parseAspectRatio,
94
+ "background-color": parseColorDeclaration,
95
+ "background-image": parseBackgroundImage,
96
+ "block-size": parseSizeDeclaration,
97
+ "border": parseBorder,
98
+ "border-block": parseBorderBlock,
99
+ "border-block-color": parseBorderColor,
100
+ "border-block-end": parseBorderBlockEnd,
101
+ "border-block-end-color": parseColorDeclaration,
102
+ "border-block-end-width": parseBorderSideWidthDeclaration,
103
+ "border-block-start": parseBorderBlockStart,
104
+ "border-block-start-color": parseColorDeclaration,
105
+ "border-block-start-style": parseBorderStyleDeclaration,
106
+ "border-block-start-width": parseBorderSideWidthDeclaration,
107
+ "border-block-style": parseBorderBlockStyle,
108
+ "border-block-width": parseBorderBlockWidth,
109
+ "border-bottom": parseBorderSide,
110
+ "border-bottom-color": parseColorDeclaration,
111
+ "border-bottom-left-radius": parseSize2DDimensionPercentageDeclaration,
112
+ "border-bottom-right-radius": parseSize2DDimensionPercentageDeclaration,
113
+ "border-bottom-style": parseBorderStyleDeclaration,
114
+ "border-bottom-width": parseBorderSideWidthDeclaration,
115
+ "border-color": parseBorderColor,
116
+ "border-end-end-radius": parseSize2DDimensionPercentageDeclaration,
117
+ "border-end-start-radius": parseSize2DDimensionPercentageDeclaration,
118
+ "border-inline": parseBorderInline,
119
+ "border-inline-color": parseBorderColor,
120
+ "border-inline-end": parseBorderInlineEnd,
121
+ "border-inline-end-color": parseColorDeclaration,
122
+ "border-inline-end-style": parseBorderInlineStyle,
123
+ "border-inline-end-width": parseBorderSideWidthDeclaration,
124
+ "border-inline-start": parseBorderInlineStart,
125
+ "border-inline-start-color": parseColorDeclaration,
126
+ "border-inline-start-style": parseBorderInlineStyle,
127
+ "border-inline-start-width": parseBorderSideWidthDeclaration,
128
+ "border-inline-style": parseBorderInlineStyle,
129
+ "border-inline-width": parseBorderInlineWidth,
130
+ "border-left": parseBorderSide,
131
+ "border-left-color": parseColorDeclaration,
132
+ "border-left-style": parseBorderStyleDeclaration,
133
+ "border-left-width": parseBorderSideWidthDeclaration,
134
+ "border-radius": parseBorderRadius,
135
+ "border-right": parseBorderSide,
136
+ "border-right-color": parseColorDeclaration,
137
+ "border-right-style": parseBorderStyleDeclaration,
138
+ "border-right-width": parseBorderSideWidthDeclaration,
139
+ "border-start-end-radius": parseSize2DDimensionPercentageDeclaration,
140
+ "border-start-start-radius": parseSize2DDimensionPercentageDeclaration,
141
+ "border-style": parseBorderStyleDeclaration,
142
+ "border-top": parseBorderSide,
143
+ "border-top-color": parseColorDeclaration,
144
+ "border-top-left-radius": parseSize2DDimensionPercentageDeclaration,
145
+ "border-top-right-radius": parseSize2DDimensionPercentageDeclaration,
146
+ "border-top-style": parseBorderStyleDeclaration,
147
+ "border-top-width": parseBorderSideWidthDeclaration,
148
+ "border-width": parseBorderWidth,
149
+ "bottom": parseSizeDeclaration,
150
+ "box-shadow": parseBoxShadow,
151
+ "caret-color": parseColorOrAutoDeclaration,
152
+ "color": parseFontColorDeclaration,
153
+ "column-gap": parseGap,
154
+ "container": parseContainer,
155
+ "container-name": parseContainerName,
156
+ "container-type": parseContainerType,
157
+ "display": parseDisplay,
158
+ "fill": parseSVGPaint,
159
+ "filter": parseFilter,
160
+ "flex": parseFlex,
161
+ "flex-basis": parseLengthPercentageOrAutoDeclaration,
162
+ "flex-direction": ({ value }) => value,
163
+ "flex-flow": parseFlexFlow,
164
+ "flex-grow": ({ value }) => value,
165
+ "flex-shrink": ({ value }) => value,
166
+ "flex-wrap": ({ value }) => value,
167
+ "font": parseFont,
168
+ "font-family": parseFontFamily,
169
+ "font-size": parseFontSizeDeclaration,
170
+ "font-style": parseFontStyleDeclaration,
171
+ "font-variant-caps": parseFontVariantCapsDeclaration,
172
+ "font-weight": parseFontWeightDeclaration,
173
+ "gap": parseGap,
174
+ "height": parseSizeDeclaration,
175
+ "inline-size": parseSizeDeclaration,
176
+ "inset": parseInset,
177
+ "inset-block": parseInsetBlock,
178
+ "inset-block-end": parseLengthPercentageOrAutoDeclaration,
179
+ "inset-block-start": parseLengthPercentageOrAutoDeclaration,
180
+ "inset-inline": parseInsetInline,
181
+ "inset-inline-end": parseLengthPercentageOrAutoDeclaration,
182
+ "inset-inline-start": parseLengthPercentageOrAutoDeclaration,
183
+ "justify-content": parseJustifyContent,
184
+ "left": parseSizeDeclaration,
185
+ "letter-spacing": parseLetterSpacing,
186
+ "line-height": parseLineHeightDeclaration,
187
+ "margin": parseMargin,
188
+ "margin-block": parseMarginBlock,
189
+ "margin-block-end": parseLengthPercentageOrAutoDeclaration,
190
+ "margin-block-start": parseLengthPercentageOrAutoDeclaration,
191
+ "margin-bottom": parseSizeDeclaration,
192
+ "margin-inline": parseMarginInline,
193
+ "margin-inline-end": parseLengthPercentageOrAutoDeclaration,
194
+ "margin-inline-start": parseLengthPercentageOrAutoDeclaration,
195
+ "margin-left": parseSizeDeclaration,
196
+ "margin-right": parseSizeDeclaration,
197
+ "margin-top": parseSizeDeclaration,
198
+ "max-block-size": parseSizeDeclaration,
199
+ "max-height": parseSizeDeclaration,
200
+ "max-inline-size": parseSizeDeclaration,
201
+ "max-width": parseSizeDeclaration,
202
+ "min-block-size": parseSizeDeclaration,
203
+ "min-height": parseSizeDeclaration,
204
+ "min-inline-size": parseSizeDeclaration,
205
+ "min-width": parseSizeDeclaration,
206
+ "opacity": ({ value }) => value,
207
+ "overflow": parseOverflow,
208
+ "padding": parsePadding,
209
+ "padding-block": parsePaddingBlock,
210
+ "padding-block-end": parseLengthPercentageOrAutoDeclaration,
211
+ "padding-block-start": parseLengthPercentageOrAutoDeclaration,
212
+ "padding-bottom": parseSizeDeclaration,
213
+ "padding-inline": parsePaddingInline,
214
+ "padding-inline-end": parseLengthPercentageOrAutoDeclaration,
215
+ "padding-inline-start": parseLengthPercentageOrAutoDeclaration,
216
+ "padding-left": parseSizeDeclaration,
217
+ "padding-right": parseSizeDeclaration,
218
+ "padding-top": parseSizeDeclaration,
219
+ "position": parsePosition,
220
+ "right": parseSizeDeclaration,
221
+ "rotate": parseRotate,
222
+ "row-gap": parseGap,
223
+ "scale": parseScale,
224
+ "stroke": parseSVGPaint,
225
+ "stroke-width": parseLengthDeclaration,
226
+ "text-align": parseTextAlign,
227
+ "text-decoration": parseTextDecoration,
228
+ "text-decoration-color": parseColorDeclaration,
229
+ "text-decoration-line": parseTextDecorationLineDeclaration,
230
+ "text-decoration-style": parseTextDecorationStyle,
231
+ "text-shadow": parseTextShadow,
232
+ "text-transform": ({ value }) => value.case,
233
+ "top": parseSizeDeclaration,
234
+ "transform": parseTransform,
235
+ "transition": addTransitionValue,
236
+ "transition-delay": addTransitionValue,
237
+ "transition-duration": addTransitionValue,
238
+ "transition-property": addTransitionValue,
239
+ "transition-timing-function": addTransitionValue,
240
+ "translate": parseTranslate,
241
+ "user-select": parseUserSelect,
242
+ "vertical-align": parseVerticalAlign,
243
+ "visibility": parseVisibility,
244
+ "width": parseSizeDeclaration,
245
+ "z-index": parseZIndex,
246
+ };
247
+
248
+ // This is missing LightningCSS types
249
+ (parsers as Record<string, Parser>)["pointer-events"] =
250
+ parsePointerEvents as Parser;
251
+
252
+ const validProperties = new Set(Object.keys(parsers));
253
+
254
+ export function parseDeclaration(
255
+ declaration: Declaration,
256
+ builder: StylesheetBuilder,
257
+ ) {
258
+ if ("vendorPrefix" in declaration && declaration.vendorPrefix.length) {
259
+ return;
260
+ }
261
+
262
+ if (
263
+ "value" in declaration &&
264
+ typeof declaration.value === "object" &&
265
+ "vendorPrefix" in declaration.value &&
266
+ Array.isArray(declaration.value.vendorPrefix) &&
267
+ declaration.value.vendorPrefix.length
268
+ ) {
269
+ return;
270
+ }
271
+
272
+ if (declaration.property === "unparsed") {
273
+ parseUnparsedDeclaration(declaration, builder);
274
+ } else if (declaration.property === "custom") {
275
+ parseCustomDeclaration(declaration, builder);
276
+ } else {
277
+ parseWithParser(declaration, builder);
278
+ }
279
+ }
280
+
281
+ function parseWithParser(declaration: Declaration, builder: StylesheetBuilder) {
282
+ if (declaration.property in parsers) {
283
+ const parser = parsers[declaration.property] as Parser;
284
+
285
+ builder.descriptorProperty = declaration.property;
286
+
287
+ builder.setWarningProperty(declaration.property);
288
+ const value = parser(declaration, builder, declaration.property);
289
+
290
+ if (value !== undefined) {
291
+ builder.addDescriptor(
292
+ propertyRename[declaration.property] ?? declaration.property,
293
+ value,
294
+ );
295
+ }
296
+ } else {
297
+ builder.addWarning("property", declaration.property);
298
+ }
299
+ }
300
+
301
+ function parseInsetBlock(
302
+ { value }: DeclarationType<"inset-block">,
303
+ builder: StylesheetBuilder,
304
+ ) {
305
+ builder.addShorthand("inset-block", {
306
+ "inset-block-start": parseLengthPercentageOrAuto(value.blockStart, builder),
307
+ "inset-block-end": parseLengthPercentageOrAuto(value.blockEnd, builder),
308
+ });
309
+ }
310
+
311
+ function parseInsetInline(
312
+ { value }: DeclarationType<"inset-inline">,
313
+ builder: StylesheetBuilder,
314
+ ) {
315
+ builder.addShorthand("inset-inline", {
316
+ "inset-block-start": parseLengthPercentageOrAuto(
317
+ value.inlineStart,
318
+ builder,
319
+ ),
320
+ "inset-block-end": parseLengthPercentageOrAuto(value.inlineEnd, builder),
321
+ });
322
+ }
323
+
324
+ function parseInset(
325
+ { value }: DeclarationType<"inset">,
326
+ builder: StylesheetBuilder,
327
+ ) {
328
+ builder.addShorthand("inset", {
329
+ top: parseLengthPercentageOrAuto(value.top, builder),
330
+ bottom: parseLengthPercentageOrAuto(value.bottom, builder),
331
+ left: parseLengthPercentageOrAuto(value.left, builder),
332
+ right: parseLengthPercentageOrAuto(value.right, builder),
333
+ });
334
+ }
335
+
336
+ function parseBorderRadius(
337
+ { value }: DeclarationType<"border-radius">,
338
+ builder: StylesheetBuilder,
339
+ ) {
340
+ builder.addShorthand("border-radius", {
341
+ "border-bottom-left-radius": parseSize2DDimensionPercentage(
342
+ value.bottomLeft,
343
+ builder,
344
+ ),
345
+ "border-bottom-right-radius": parseSize2DDimensionPercentage(
346
+ value.bottomRight,
347
+ builder,
348
+ ),
349
+ "border-top-left-radius": parseSize2DDimensionPercentage(
350
+ value.topLeft,
351
+ builder,
352
+ ),
353
+ "border-top-right-radius": parseSize2DDimensionPercentage(
354
+ value.topRight,
355
+ builder,
356
+ ),
357
+ });
358
+ }
359
+
360
+ function parseBorderColor(
361
+ declaration: DeclarationType<
362
+ "border-color" | "border-block-color" | "border-inline-color"
363
+ >,
364
+ builder: StylesheetBuilder,
365
+ ) {
366
+ switch (declaration.property) {
367
+ case "border-color":
368
+ builder.addShorthand("border-color", {
369
+ "border-top-color": parseColor(declaration.value.top, builder),
370
+ "border-bottom-color": parseColor(declaration.value.bottom, builder),
371
+ "border-left-color": parseColor(declaration.value.left, builder),
372
+ "border-right-color": parseColor(declaration.value.right, builder),
373
+ });
374
+ break;
375
+ case "border-block-color":
376
+ builder.addDescriptor(
377
+ "border-top-color",
378
+ parseColor(declaration.value.start, builder),
379
+ );
380
+ builder.addDescriptor(
381
+ "border-bottom-color",
382
+ parseColor(declaration.value.end, builder),
383
+ );
384
+ break;
385
+ case "border-inline-color":
386
+ builder.addDescriptor(
387
+ "border-left-color",
388
+ parseColor(declaration.value.start, builder),
389
+ );
390
+ builder.addDescriptor(
391
+ "border-right-color",
392
+ parseColor(declaration.value.end, builder),
393
+ );
394
+ break;
395
+ }
396
+ }
397
+
398
+ function parseBorderWidth(
399
+ { value }: DeclarationType<"border-width">,
400
+ builder: StylesheetBuilder,
401
+ ) {
402
+ builder.addShorthand("border-width", {
403
+ "border-top-width": parseBorderSideWidth(value.top, builder),
404
+ "border-bottom-width": parseBorderSideWidth(value.bottom, builder),
405
+ "border-left-width": parseBorderSideWidth(value.left, builder),
406
+ "border-right-width": parseBorderSideWidth(value.right, builder),
407
+ });
408
+ }
409
+
410
+ function parseBorder(
411
+ { value }: DeclarationType<"border">,
412
+ builder: StylesheetBuilder,
413
+ ) {
414
+ builder.addShorthand("border", {
415
+ "border-width": parseBorderSideWidth(value.width, builder),
416
+ "border-style": parseBorderStyle(value.style, builder),
417
+ "border-color": parseColor(value.color, builder),
418
+ });
419
+ }
420
+
421
+ function parseBorderSide(
422
+ {
423
+ value,
424
+ property,
425
+ }: DeclarationType<
426
+ "border-top" | "border-bottom" | "border-left" | "border-right"
427
+ >,
428
+ builder: StylesheetBuilder,
429
+ ) {
430
+ builder.addDescriptor(property + "-color", parseColor(value.color, builder));
431
+ builder.addDescriptor(
432
+ property + "-width",
433
+ parseBorderSideWidth(value.width, builder),
434
+ );
435
+ }
436
+
437
+ function parseBorderBlock(
438
+ { value }: DeclarationType<"border-block">,
439
+ builder: StylesheetBuilder,
440
+ ) {
441
+ builder.addDescriptor("border-block-color", parseColor(value.color, builder));
442
+ builder.addDescriptor(
443
+ "border-block-width",
444
+ parseBorderSideWidth(value.width, builder),
445
+ );
446
+ builder.addDescriptor(
447
+ "border-block-style",
448
+ parseBorderStyle(value.style, builder),
449
+ );
450
+ }
451
+
452
+ function parseBorderBlockStart(
453
+ { value }: DeclarationType<"border-block-start">,
454
+ builder: StylesheetBuilder,
455
+ ) {
456
+ builder.addDescriptor(
457
+ "border-block-start-color",
458
+ parseColor(value.color, builder),
459
+ );
460
+ builder.addDescriptor(
461
+ "border-block-start-width",
462
+ parseBorderSideWidth(value.width, builder),
463
+ );
464
+ }
465
+
466
+ function parseBorderBlockEnd(
467
+ { value }: DeclarationType<"border-block-end">,
468
+ builder: StylesheetBuilder,
469
+ ) {
470
+ builder.addDescriptor(
471
+ "border-block-end-color",
472
+ parseColor(value.color, builder),
473
+ );
474
+ builder.addDescriptor(
475
+ "border-block-end-width",
476
+ parseBorderSideWidth(value.width, builder),
477
+ );
478
+ }
479
+
480
+ function parseBorderInline(
481
+ { value }: DeclarationType<"border-inline">,
482
+ builder: StylesheetBuilder,
483
+ ) {
484
+ builder.addDescriptor(
485
+ "border-inline-color",
486
+ parseColor(value.color, builder),
487
+ );
488
+ builder.addDescriptor(
489
+ "border-inline-width",
490
+ parseBorderSideWidth(value.width, builder),
491
+ );
492
+ builder.addDescriptor(
493
+ "border-inline-style",
494
+ parseBorderStyle(value.style, builder),
495
+ );
496
+ }
497
+
498
+ function parseBorderInlineStart(
499
+ { value }: DeclarationType<"border-inline-start">,
500
+ builder: StylesheetBuilder,
501
+ ) {
502
+ builder.addDescriptor(
503
+ "border-inline-start-color",
504
+ parseColor(value.color, builder),
505
+ );
506
+ builder.addDescriptor(
507
+ "border-inline-start-width",
508
+ parseBorderSideWidth(value.width, builder),
509
+ );
510
+ builder.addDescriptor(
511
+ "border-inline-start-style",
512
+ parseBorderStyle(value.style, builder),
513
+ );
514
+ }
515
+
516
+ function parseBorderInlineEnd(
517
+ { value }: DeclarationType<"border-inline-end">,
518
+ builder: StylesheetBuilder,
519
+ ) {
520
+ builder.addDescriptor(
521
+ "border-inline-end-color",
522
+ parseColor(value.color, builder),
523
+ );
524
+ builder.addDescriptor(
525
+ "border-inline-end-width",
526
+ parseBorderSideWidth(value.width, builder),
527
+ );
528
+ builder.addDescriptor(
529
+ "border-inline-end-style",
530
+ parseBorderStyle(value.style, builder),
531
+ );
532
+ }
533
+
534
+ export function parseBorderInlineWidth(
535
+ declaration: DeclarationType<"border-inline-width">,
536
+ builder: StylesheetBuilder,
537
+ ) {
538
+ builder.addDescriptor(
539
+ "border-inline-width",
540
+ parseBorderSideWidth(declaration.value.start, builder),
541
+ );
542
+ }
543
+
544
+ export function parseBorderInlineStyle(
545
+ declaration: DeclarationType<
546
+ | "border-inline-style"
547
+ | "border-inline-start-style"
548
+ | "border-inline-end-style"
549
+ >,
550
+ builder: StylesheetBuilder,
551
+ ) {
552
+ if (typeof declaration.value === "string") {
553
+ builder.addDescriptor(
554
+ declaration.property,
555
+ parseBorderStyle(declaration.value, builder),
556
+ );
557
+ } else if (declaration.value.start === declaration.value.end) {
558
+ builder.addDescriptor(
559
+ declaration.property,
560
+ parseBorderStyle(declaration.value.start, builder),
561
+ );
562
+ } else {
563
+ builder.addDescriptor(
564
+ "border-inline-start-style",
565
+ parseBorderStyle(declaration.value.start, builder),
566
+ );
567
+ builder.addDescriptor(
568
+ "border-inline-end-style",
569
+ parseBorderStyle(declaration.value.end, builder),
570
+ );
571
+ }
572
+ }
573
+
574
+ function parseFlexFlow(
575
+ { value }: DeclarationType<"flex-flow">,
576
+ builder: StylesheetBuilder,
577
+ ) {
578
+ builder.addDescriptor("flexWrap", value.wrap);
579
+ builder.addDescriptor("flexDirection", value.direction);
580
+ }
581
+
582
+ function parseFlex(
583
+ { value }: DeclarationType<"flex">,
584
+ builder: StylesheetBuilder,
585
+ ) {
586
+ builder.addDescriptor("flex-grow", value.grow);
587
+ builder.addDescriptor("flex-shrink", value.shrink);
588
+ builder.addDescriptor(
589
+ "flex-basis",
590
+ parseLengthPercentageOrAuto(value.basis, builder),
591
+ );
592
+ }
593
+
594
+ function parseMargin(
595
+ { value }: DeclarationType<"margin">,
596
+ builder: StylesheetBuilder,
597
+ ) {
598
+ builder.addShorthand("margin", {
599
+ "margin-top": parseSize(value.top, builder, { allowAuto: true }),
600
+ "margin-bottom": parseSize(value.bottom, builder, { allowAuto: true }),
601
+ "margin-left": parseSize(value.left, builder, { allowAuto: true }),
602
+ "margin-right": parseSize(value.right, builder, { allowAuto: true }),
603
+ });
604
+ }
605
+
606
+ function parseMarginBlock(
607
+ { value }: DeclarationType<"margin-block">,
608
+ builder: StylesheetBuilder,
609
+ ) {
610
+ builder.addShorthand("margin-block", {
611
+ "margin-block-start": parseLengthPercentageOrAuto(
612
+ value.blockStart,
613
+ builder,
614
+ ),
615
+ "margin-block-end": parseLengthPercentageOrAuto(value.blockEnd, builder),
616
+ });
617
+ }
618
+
619
+ function parseMarginInline(
620
+ { value }: DeclarationType<"margin-inline">,
621
+ builder: StylesheetBuilder,
622
+ ) {
623
+ builder.addShorthand("margin-inline", {
624
+ "margin-inline-start": parseLengthPercentageOrAuto(
625
+ value.inlineStart,
626
+ builder,
627
+ ),
628
+ "margin-inline-end": parseLengthPercentageOrAuto(value.inlineEnd, builder),
629
+ });
630
+ }
631
+
632
+ function parsePadding(
633
+ { value }: DeclarationType<"padding">,
634
+ builder: StylesheetBuilder,
635
+ ) {
636
+ builder.addShorthand("padding", {
637
+ "padding-top": parseSize(value.top, builder),
638
+ "padding-bottom": parseSize(value.bottom, builder),
639
+ "padding-left": parseSize(value.left, builder),
640
+ "padding-right": parseSize(value.right, builder),
641
+ });
642
+ }
643
+
644
+ function parsePaddingBlock(
645
+ { value }: DeclarationType<"padding-block">,
646
+ builder: StylesheetBuilder,
647
+ ) {
648
+ builder.addShorthand("padding-block", {
649
+ "padding-block-start": parseLengthPercentageOrAuto(
650
+ value.blockStart,
651
+ builder,
652
+ ),
653
+ "padding-block-end": parseLengthPercentageOrAuto(value.blockEnd, builder),
654
+ });
655
+ }
656
+
657
+ function parsePaddingInline(
658
+ { value }: DeclarationType<"padding-inline">,
659
+ builder: StylesheetBuilder,
660
+ ) {
661
+ builder.addShorthand("padding-inline", {
662
+ "padding-inline-start": parseLengthPercentageOrAuto(
663
+ value.inlineStart,
664
+ builder,
665
+ ),
666
+ "padding-inline-end": parseLengthPercentageOrAuto(value.inlineEnd, builder),
667
+ });
668
+ }
669
+
670
+ function parseFont(
671
+ { value }: DeclarationType<"font">,
672
+ builder: StylesheetBuilder,
673
+ ) {
674
+ builder.addDescriptor("font-family", value.family[0]);
675
+ builder.addDescriptor(
676
+ "line-height",
677
+ parseLineHeight(value.lineHeight, builder),
678
+ );
679
+ builder.addDescriptor("font-size", parseFontSize(value.size, builder));
680
+ builder.addDescriptor("font-style", parseFontStyle(value.style, builder));
681
+ builder.addDescriptor(
682
+ "font-variant-caps",
683
+ parseFontVariantCaps(value.variantCaps, builder),
684
+ );
685
+ builder.addDescriptor("font-weight", parseFontWeight(value.weight, builder));
686
+ }
687
+
688
+ function parseTransform(
689
+ { value }: DeclarationType<"transform">,
690
+ builder: StylesheetBuilder,
691
+ ) {
692
+ builder.addDescriptor("transform", [
693
+ {},
694
+ "transform",
695
+ value.flatMap((t): StyleDescriptor[] => {
696
+ switch (t.type) {
697
+ case "perspective":
698
+ return [[{}, "perspective", parseLength(t.value, builder)]];
699
+ case "translate":
700
+ return [
701
+ [
702
+ {},
703
+ "translateX",
704
+ parseLengthOrCoercePercentageToRuntime(t.value[0], builder),
705
+ ],
706
+ [
707
+ [
708
+ {},
709
+ "translateY",
710
+ parseLengthOrCoercePercentageToRuntime(t.value[1], builder),
711
+ ],
712
+ ],
713
+ ];
714
+ case "translateX":
715
+ return [
716
+ [
717
+ {},
718
+ "translateX",
719
+ parseLengthOrCoercePercentageToRuntime(t.value, builder),
720
+ ],
721
+ ];
722
+ case "translateY":
723
+ return [
724
+ [
725
+ {},
726
+ "translateY",
727
+ parseLengthOrCoercePercentageToRuntime(t.value, builder),
728
+ ],
729
+ ];
730
+ case "rotate":
731
+ return [[{}, "rotate", parseAngle(t.value, builder)]];
732
+ case "rotateX":
733
+ return [[{}, "rotateX", parseAngle(t.value, builder)]];
734
+ case "rotateY":
735
+ return [[{}, "rotateY", parseAngle(t.value, builder)]];
736
+ case "rotateZ":
737
+ return [[{}, "rotateZ", parseAngle(t.value, builder)]];
738
+ case "scale":
739
+ return [
740
+ [{}, "scaleX", parseLength(t.value[0], builder)],
741
+ [{}, "scaleY", parseLength(t.value[1], builder)],
742
+ ];
743
+ case "scaleX":
744
+ return [[{}, "scaleX", parseLength(t.value, builder)]];
745
+ case "scaleY":
746
+ return [[{}, "scaleY", parseLength(t.value, builder)]];
747
+ case "skew":
748
+ return [
749
+ [{}, "skewX", parseAngle(t.value[0], builder)],
750
+ [{}, "skewY", parseAngle(t.value[1], builder)],
751
+ ];
752
+ case "skewX":
753
+ return [[{}, "skewX", parseAngle(t.value, builder)]];
754
+ case "skewY":
755
+ return [[{}, "skewY", parseAngle(t.value, builder)]];
756
+ case "translateZ":
757
+ case "translate3d":
758
+ case "scaleZ":
759
+ case "scale3d":
760
+ case "rotate3d":
761
+ case "matrix":
762
+ case "matrix3d":
763
+ return [[]];
764
+ }
765
+ }),
766
+ ]);
767
+ return;
768
+ }
769
+
770
+ function parseTranslate(
771
+ { value }: DeclarationType<"translate">,
772
+ builder: StylesheetBuilder,
773
+ ) {
774
+ builder.addDescriptor("translateX", [
775
+ {},
776
+ "translateX",
777
+ parseTranslateProp(value, "x", builder),
778
+ ]);
779
+ builder.addDescriptor("translateY", [
780
+ {},
781
+ "translateY",
782
+ parseTranslateProp(value, "y", builder),
783
+ ]);
784
+ }
785
+
786
+ function parseRotate(
787
+ { value }: DeclarationType<"rotate">,
788
+ builder: StylesheetBuilder,
789
+ ) {
790
+ if (value.x) {
791
+ builder.addDescriptor("rotateX", [
792
+ {},
793
+ "rotateX",
794
+ parseAngle(value.angle, builder),
795
+ ]);
796
+ }
797
+
798
+ if (value.y) {
799
+ builder.addDescriptor("rotateY", [
800
+ {},
801
+ "rotateY",
802
+ parseAngle(value.angle, builder),
803
+ ]);
804
+ }
805
+
806
+ if (value.z) {
807
+ builder.addDescriptor("rotateZ", [
808
+ {},
809
+ "rotateZ",
810
+ parseAngle(value.angle, builder),
811
+ ]);
812
+ }
813
+ }
814
+
815
+ function parseScale(
816
+ { value }: DeclarationType<"scale">,
817
+ builder: StylesheetBuilder,
818
+ ) {
819
+ builder.addDescriptor("scaleX", [
820
+ {},
821
+ "scaleX",
822
+ parseScaleValue(value, "x", builder),
823
+ ]);
824
+ builder.addDescriptor("scaleY", [
825
+ {},
826
+ "scaleY",
827
+ parseScaleValue(value, "y", builder),
828
+ ]);
829
+ }
830
+
831
+ export function parseScaleValue(
832
+ translate: Scale,
833
+ prop: keyof Extract<Scale, object>,
834
+ builder: StylesheetBuilder,
835
+ ): StyleDescriptor {
836
+ if (translate === "none") {
837
+ return 0;
838
+ }
839
+
840
+ return parseLength(translate[prop], builder);
841
+ }
842
+
843
+ function parseLetterSpacing(
844
+ { value }: DeclarationType<"letter-spacing">,
845
+ builder: StylesheetBuilder,
846
+ ) {
847
+ if (value.type === "normal") {
848
+ return;
849
+ }
850
+ const descriptor = parseLength(value.value, builder);
851
+
852
+ if (
853
+ Array.isArray(descriptor) &&
854
+ descriptor[1] === "em" &&
855
+ typeof descriptor[2] === "number"
856
+ ) {
857
+ return descriptor[2];
858
+ }
859
+
860
+ return descriptor;
861
+ }
862
+
863
+ function parseTextDecoration(
864
+ { value }: DeclarationType<"text-decoration">,
865
+ builder: StylesheetBuilder,
866
+ ) {
867
+ builder.addDescriptor(
868
+ "text-decoration-color",
869
+ parseColor(value.color, builder),
870
+ );
871
+ builder.addDescriptor(
872
+ "text-decoration-line",
873
+ parseTextDecorationLine(value.line, builder),
874
+ );
875
+ }
876
+
877
+ function parseZIndex(
878
+ { value }: DeclarationType<"z-index">,
879
+ builder: StylesheetBuilder,
880
+ ): StyleDescriptor {
881
+ if (value.type === "integer") {
882
+ return parseLength(value.value, builder);
883
+ } else {
884
+ builder.addWarning("value", value.type);
885
+ return;
886
+ }
887
+ }
888
+
889
+ function parseContainerType(
890
+ _declaration: DeclarationType<"container-type">,
891
+ builder: StylesheetBuilder,
892
+ ) {
893
+ builder.addContainer(["___default___"]);
894
+ return;
895
+ }
896
+
897
+ function parseContainerName(
898
+ { value }: DeclarationType<"container-name">,
899
+ builder: StylesheetBuilder,
900
+ ) {
901
+ builder.addContainer(value.type === "none" ? false : value.value);
902
+ return;
903
+ }
904
+
905
+ function parseContainer(
906
+ { value }: DeclarationType<"container">,
907
+ builder: StylesheetBuilder,
908
+ ) {
909
+ builder.addContainer(value.name.type === "none" ? false : value.name.value);
910
+ return;
911
+ }
912
+
913
+ export function parseUnparsedDeclaration(
914
+ declaration: Extract<Declaration, { property: "unparsed" }>,
915
+ builder: StylesheetBuilder,
916
+ ) {
917
+ let property = declaration.value.propertyId.property;
918
+
919
+ if (!(property in parsers)) {
920
+ builder.addWarning("property", property);
921
+ return;
922
+ }
923
+
924
+ builder.setWarningProperty(property);
925
+
926
+ /**
927
+ * React Native doesn't support all the logical properties
928
+ */
929
+ const rename = propertyRename[property];
930
+ if (rename) {
931
+ property = rename;
932
+ }
933
+
934
+ /**
935
+ * Unparsed shorthand properties need to be parsed at runtime
936
+ */
937
+ builder.descriptorProperty = property;
938
+
939
+ if (unparsedRuntimeParsing.has(property)) {
940
+ const args = parseUnparsed(declaration.value.value, builder, property);
941
+
942
+ if (property === "animation") {
943
+ builder.addDescriptor("animation", [{}, property, args]);
944
+ } else {
945
+ builder.addDescriptor(property, [{}, toRNProperty(property), args, 1]);
946
+ }
947
+ } else {
948
+ const value = parseUnparsed(declaration.value.value, builder, property);
949
+
950
+ builder.addDescriptor(property, value);
951
+
952
+ if (property === "font-size") {
953
+ builder.addDescriptor("--__rn-css-em", value);
954
+ }
955
+
956
+ if (property === "color") {
957
+ builder.addDescriptor("--__rn-css-current-color", value);
958
+ }
959
+ }
960
+ }
961
+
962
+ export function parseCustomDeclaration(
963
+ declaration: Extract<Declaration, { property: "custom" }>,
964
+ builder: StylesheetBuilder,
965
+ ) {
966
+ const property = declaration.value.name;
967
+
968
+ if (property === "-webkit-line-clamp") {
969
+ builder.addDescriptor(
970
+ property,
971
+ parseUnparsed(declaration.value.value, builder, property),
972
+ );
973
+ } else if (property === "-rn-ripple-style") {
974
+ builder.addDescriptor(
975
+ property,
976
+ parseUnparsed(declaration.value.value, builder, property) ===
977
+ "borderless",
978
+ );
979
+ } else if (property === "object-fit") {
980
+ // https://github.com/parcel-bundler/lightningcss/issues/1046
981
+ parseObjectFit(declaration.value, builder);
982
+ } else if (property === "object-position") {
983
+ // https://github.com/parcel-bundler/lightningcss/issues/1047
984
+ parseObjectPosition(declaration.value, builder);
985
+ } else if (
986
+ validProperties.has(property) ||
987
+ property.startsWith("--") ||
988
+ property.startsWith("-rn-")
989
+ ) {
990
+ builder.addDescriptor(
991
+ property,
992
+ parseUnparsed(declaration.value.value, builder, property),
993
+ );
994
+ } else {
995
+ builder.addWarning("property", declaration.value.name);
996
+ }
997
+ }
998
+
999
+ export function reduceParseUnparsed(
1000
+ tokenOrValues: TokenOrValue[],
1001
+ builder: StylesheetBuilder,
1002
+ property: string,
1003
+ allowAuto: boolean,
1004
+ ): StyleDescriptor {
1005
+ const result = tokenOrValues
1006
+ .map((tokenOrValue) =>
1007
+ parseUnparsed(tokenOrValue, builder, property, allowAuto),
1008
+ )
1009
+ .filter((v) => v !== undefined);
1010
+
1011
+ if (result.length === 0) {
1012
+ return undefined;
1013
+ }
1014
+
1015
+ let currentGroup: StyleDescriptor = [];
1016
+ let groups: StyleDescriptor[] = [currentGroup];
1017
+
1018
+ for (const value of result) {
1019
+ if ((value as unknown) === CommaSeparator) {
1020
+ currentGroup = [];
1021
+ groups.push(currentGroup);
1022
+ } else {
1023
+ currentGroup.push(value);
1024
+ }
1025
+ }
1026
+
1027
+ // Groups are the tokens grouped together by comma location
1028
+ // If a group only has 1 item, it shouldn't be an array
1029
+ groups = groups.flatMap((group): StyleDescriptor[] => {
1030
+ if (!Array.isArray(group)) {
1031
+ return [];
1032
+ }
1033
+
1034
+ if (group.length === 0) {
1035
+ return [];
1036
+ } else if (group.length === 1) {
1037
+ const first = group[0];
1038
+
1039
+ if (first === undefined) {
1040
+ return [];
1041
+ } else {
1042
+ return [first];
1043
+ }
1044
+ } else if (
1045
+ // This is a special case for <ratio> values
1046
+ group.includes("/") &&
1047
+ group.every((item) =>
1048
+ typeof item === "string" && item === "/"
1049
+ ? item
1050
+ : typeof item === "number",
1051
+ )
1052
+ ) {
1053
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
1054
+ return [group.join(" ")];
1055
+ } else {
1056
+ return [group];
1057
+ }
1058
+ });
1059
+
1060
+ return groups.length === 1 ? groups[0] : groups;
1061
+ }
1062
+
1063
+ export function unparsedFunction(
1064
+ token: Extract<TokenOrValue, { type: "function" }>,
1065
+ builder: StylesheetBuilder,
1066
+ property: string,
1067
+ allowAuto: boolean,
1068
+ ): StyleFunction {
1069
+ return [
1070
+ {},
1071
+ toRNProperty(token.value.name),
1072
+ reduceParseUnparsed(token.value.arguments, builder, property, allowAuto),
1073
+ ];
1074
+ }
1075
+
1076
+ /**
1077
+ * When the CSS cannot be parsed (often due to a runtime condition like a CSS variable)
1078
+ * This export function best efforts parsing it into a export function that we can evaluate at runtime
1079
+ */
1080
+ export function parseUnparsed(
1081
+ tokenOrValue:
1082
+ | TokenOrValue
1083
+ | TokenOrValue[]
1084
+ | string
1085
+ | number
1086
+ | undefined
1087
+ | null,
1088
+ builder: StylesheetBuilder,
1089
+ property: string,
1090
+ allowAuto = allowAutoProperties.has(property),
1091
+ ): StyleDescriptor {
1092
+ if (tokenOrValue === undefined || tokenOrValue === null) {
1093
+ return;
1094
+ }
1095
+
1096
+ if (typeof tokenOrValue === "string") {
1097
+ if (tokenOrValue === "true") {
1098
+ return true;
1099
+ } else if (tokenOrValue === "false") {
1100
+ return false;
1101
+ } else if (tokenOrValue === "currentcolor") {
1102
+ return [{}, "var", "__rn-css-current-color"] as const;
1103
+ } else {
1104
+ return tokenOrValue;
1105
+ }
1106
+ }
1107
+
1108
+ if (typeof tokenOrValue === "number") {
1109
+ return round(tokenOrValue);
1110
+ }
1111
+
1112
+ if (Array.isArray(tokenOrValue)) {
1113
+ const args = reduceParseUnparsed(
1114
+ tokenOrValue,
1115
+ builder,
1116
+ property,
1117
+ allowAuto,
1118
+ );
1119
+ if (!args) return;
1120
+ if (Array.isArray(args) && args.length === 1) return args[0];
1121
+ return args;
1122
+ }
1123
+
1124
+ switch (tokenOrValue.type) {
1125
+ case "unresolved-color": {
1126
+ return parseUnresolvedColor(
1127
+ tokenOrValue.value,
1128
+ builder,
1129
+ property,
1130
+ allowAuto,
1131
+ );
1132
+ }
1133
+ case "var": {
1134
+ let args: StyleDescriptor = tokenOrValue.value.name.ident.slice(2);
1135
+ const fallback = parseUnparsed(
1136
+ tokenOrValue.value.fallback,
1137
+ builder,
1138
+ property,
1139
+ allowAuto,
1140
+ );
1141
+ if (fallback !== undefined) {
1142
+ args = [args, fallback];
1143
+ }
1144
+
1145
+ return [{}, "var", args, 1];
1146
+ }
1147
+ case "function": {
1148
+ switch (tokenOrValue.value.name) {
1149
+ case "blur":
1150
+ case "brightness":
1151
+ case "contrast":
1152
+ case "cubic-bezier":
1153
+ case "drop-shadow":
1154
+ case "fontScale":
1155
+ case "getPixelSizeForLayoutSize":
1156
+ case "grayscale":
1157
+ case "hsl":
1158
+ case "hsla":
1159
+ case "hue-rotate":
1160
+ case "invert":
1161
+ case "opacity":
1162
+ case "pixelScale":
1163
+ case "platformColor":
1164
+ case "rgb":
1165
+ case "rgba":
1166
+ case "rotate":
1167
+ case "rotateX":
1168
+ case "rotateY":
1169
+ case "roundToNearestPixel":
1170
+ case "saturate":
1171
+ case "scale":
1172
+ case "scaleX":
1173
+ case "scaleY":
1174
+ case "sepia":
1175
+ case "shadow":
1176
+ case "skewX":
1177
+ case "skewY":
1178
+ case "steps":
1179
+ case "translate":
1180
+ case "translateX":
1181
+ case "translateY":
1182
+ return unparsedFunction(tokenOrValue, builder, property, allowAuto);
1183
+ case "linear-gradient":
1184
+ case "radial-gradient":
1185
+ // These are special as React Native requires the '-' in their name
1186
+ return [
1187
+ {},
1188
+ tokenOrValue.value.name,
1189
+ reduceParseUnparsed(
1190
+ tokenOrValue.value.arguments,
1191
+ builder,
1192
+ property,
1193
+ allowAuto,
1194
+ ),
1195
+ ];
1196
+ case "hairlineWidth":
1197
+ return [{}, tokenOrValue.value.name, []];
1198
+ case "calc":
1199
+ case "max":
1200
+ case "min":
1201
+ case "clamp":
1202
+ return parseCalcFn(
1203
+ tokenOrValue.value.name,
1204
+ tokenOrValue.value.arguments,
1205
+ builder,
1206
+ property,
1207
+ );
1208
+ default: {
1209
+ builder.addWarning("value", `${tokenOrValue.value.name}()`);
1210
+ return;
1211
+ }
1212
+ }
1213
+ }
1214
+ case "length":
1215
+ return parseLength(tokenOrValue.value, builder);
1216
+ case "angle":
1217
+ return parseAngle(tokenOrValue.value, builder);
1218
+ case "token":
1219
+ switch (tokenOrValue.value.type) {
1220
+ case "string":
1221
+ case "ident": {
1222
+ const value = tokenOrValue.value.value;
1223
+ if (!allowAuto && value === "auto") {
1224
+ builder.addWarning("value", value);
1225
+ return;
1226
+ }
1227
+
1228
+ if (value === "inherit" || value === "initial") {
1229
+ builder.addWarning("value", value);
1230
+ return;
1231
+ } else if (value === "currentcolor") {
1232
+ return [{}, "var", "__rn-css-current-color"] as const;
1233
+ }
1234
+
1235
+ if (value === "true") {
1236
+ return true;
1237
+ } else if (value === "false") {
1238
+ return false;
1239
+ } else if (value === "infinity") {
1240
+ return Number.MAX_SAFE_INTEGER;
1241
+ } else {
1242
+ return value;
1243
+ }
1244
+ }
1245
+ case "number": {
1246
+ return round(tokenOrValue.value.value);
1247
+ }
1248
+ case "function":
1249
+ builder.addWarning("value", tokenOrValue.value.value);
1250
+ return;
1251
+ case "percentage":
1252
+ return `${round(tokenOrValue.value.value * 100)}%`;
1253
+ case "dimension":
1254
+ return parseDimension(tokenOrValue.value, builder);
1255
+ case "comma":
1256
+ return CommaSeparator as unknown as StyleDescriptor;
1257
+ case "delim": {
1258
+ if (tokenOrValue.value.value === "/") {
1259
+ return tokenOrValue.value.value;
1260
+ }
1261
+ return;
1262
+ }
1263
+ case "at-keyword":
1264
+ case "hash":
1265
+ case "id-hash":
1266
+ case "unquoted-url":
1267
+ case "white-space":
1268
+ case "comment":
1269
+ case "colon":
1270
+ case "semicolon":
1271
+ case "include-match":
1272
+ case "dash-match":
1273
+ case "prefix-match":
1274
+ case "suffix-match":
1275
+ case "substring-match":
1276
+ case "cdo":
1277
+ case "cdc":
1278
+ case "parenthesis-block":
1279
+ case "square-bracket-block":
1280
+ case "curly-bracket-block":
1281
+ case "bad-url":
1282
+ case "bad-string":
1283
+ case "close-parenthesis":
1284
+ case "close-square-bracket":
1285
+ case "close-curly-bracket":
1286
+ return;
1287
+ default: {
1288
+ tokenOrValue.value satisfies never;
1289
+ return;
1290
+ }
1291
+ }
1292
+ case "color":
1293
+ return parseColor(tokenOrValue.value, builder);
1294
+ case "env":
1295
+ return parseEnv(tokenOrValue.value, builder);
1296
+ case "time":
1297
+ return parseTime(tokenOrValue.value);
1298
+ case "url":
1299
+ case "resolution":
1300
+ case "dashed-ident":
1301
+ case "animation-name":
1302
+ return;
1303
+ default: {
1304
+ tokenOrValue satisfies never;
1305
+ }
1306
+ }
1307
+
1308
+ return;
1309
+ }
1310
+
1311
+ export function parseLengthDeclaration(
1312
+ declaration: {
1313
+ value:
1314
+ | number
1315
+ | Length
1316
+ | DimensionPercentageFor_LengthValue
1317
+ | NumberOrPercentage
1318
+ | LengthValue;
1319
+ },
1320
+ builder: StylesheetBuilder,
1321
+ ) {
1322
+ return parseLength(declaration.value, builder);
1323
+ }
1324
+
1325
+ export function parseLength(
1326
+ length:
1327
+ | number
1328
+ | Length
1329
+ | DimensionPercentageFor_LengthValue
1330
+ | NumberOrPercentage
1331
+ | LengthValue,
1332
+ builder: StylesheetBuilder,
1333
+ ): StyleDescriptor {
1334
+ const { inlineRem = 14 } = builder.getOptions();
1335
+
1336
+ if (typeof length === "number") {
1337
+ return round(length);
1338
+ }
1339
+
1340
+ if ("unit" in length) {
1341
+ switch (length.unit) {
1342
+ case "px": {
1343
+ if (length.value === Infinity) {
1344
+ return 9999;
1345
+ } else if (length.value === -Infinity) {
1346
+ return -9999;
1347
+ } else {
1348
+ // Normalize large values to safe integers, e.g. `calc(infinity * 1px)`
1349
+ const value = Math.max(
1350
+ Math.min(length.value, Number.MAX_SAFE_INTEGER),
1351
+ Number.MIN_SAFE_INTEGER,
1352
+ );
1353
+ return round(value);
1354
+ }
1355
+ }
1356
+ case "rem":
1357
+ if (typeof inlineRem === "number") {
1358
+ return length.value * inlineRem;
1359
+ } else {
1360
+ return [{}, "rem", round(length.value)];
1361
+ }
1362
+ case "vw":
1363
+ case "vh":
1364
+ case "em":
1365
+ return [{}, length.unit, round(length.value), 1];
1366
+ case "in":
1367
+ case "cm":
1368
+ case "mm":
1369
+ case "q":
1370
+ case "pt":
1371
+ case "pc":
1372
+ case "ex":
1373
+ case "rex":
1374
+ case "ch":
1375
+ case "rch":
1376
+ case "cap":
1377
+ case "rcap":
1378
+ case "ic":
1379
+ case "ric":
1380
+ case "lh":
1381
+ case "rlh":
1382
+ case "lvw":
1383
+ case "svw":
1384
+ case "dvw":
1385
+ case "cqw":
1386
+ case "lvh":
1387
+ case "svh":
1388
+ case "dvh":
1389
+ case "cqh":
1390
+ case "vi":
1391
+ case "svi":
1392
+ case "lvi":
1393
+ case "dvi":
1394
+ case "cqi":
1395
+ case "vb":
1396
+ case "svb":
1397
+ case "lvb":
1398
+ case "dvb":
1399
+ case "cqb":
1400
+ case "vmin":
1401
+ case "svmin":
1402
+ case "lvmin":
1403
+ case "dvmin":
1404
+ case "cqmin":
1405
+ case "vmax":
1406
+ case "svmax":
1407
+ case "lvmax":
1408
+ case "dvmax":
1409
+ case "cqmax":
1410
+ builder.addWarning("value", `${length.value}${length.unit}`);
1411
+ return undefined;
1412
+ default: {
1413
+ length.unit satisfies never;
1414
+ }
1415
+ }
1416
+ } else {
1417
+ switch (length.type) {
1418
+ case "calc": {
1419
+ // TODO: Add the calc polyfill
1420
+ return undefined;
1421
+ }
1422
+ case "number": {
1423
+ return round(length.value);
1424
+ }
1425
+ case "percentage": {
1426
+ return `${round(length.value * 100)}%`;
1427
+ }
1428
+ case "dimension":
1429
+ case "value": {
1430
+ return parseLength(length.value, builder);
1431
+ }
1432
+ }
1433
+ }
1434
+
1435
+ return;
1436
+ }
1437
+
1438
+ export function parseAngle(angle: Angle | number, builder: StylesheetBuilder) {
1439
+ if (typeof angle === "number") {
1440
+ return `${angle}deg`;
1441
+ }
1442
+
1443
+ switch (angle.type) {
1444
+ case "deg":
1445
+ case "rad":
1446
+ return `${angle.value}${angle.type}`;
1447
+ default:
1448
+ builder.addWarning("value", `${angle.value} ${angle.type}`);
1449
+ return undefined;
1450
+ }
1451
+ }
1452
+
1453
+ export function parseSizeDeclaration(
1454
+ declaration: { value: Size | MaxSize },
1455
+ builder: StylesheetBuilder,
1456
+ ) {
1457
+ return parseSize(declaration.value, builder);
1458
+ }
1459
+
1460
+ export function parsePointerEvents(
1461
+ { value }: { value: string },
1462
+ builder: StylesheetBuilder,
1463
+ ) {
1464
+ switch (value) {
1465
+ case "none":
1466
+ case "box-none":
1467
+ case "box-only":
1468
+ case "auto":
1469
+ return value;
1470
+ case "visible":
1471
+ case "visiblePainted":
1472
+ case "visibleFill":
1473
+ case "visibleStroke":
1474
+ case "painted":
1475
+ case "fill":
1476
+ case "stroke":
1477
+ builder.addWarning("value", value);
1478
+ }
1479
+
1480
+ return;
1481
+ }
1482
+
1483
+ export function parseSize(
1484
+ size: Size | MaxSize,
1485
+ builder: StylesheetBuilder,
1486
+ options?: { allowAuto?: boolean },
1487
+ ): StyleDescriptor;
1488
+ export function parseSize(
1489
+ size: Size | MaxSize,
1490
+ builder: StylesheetBuilder,
1491
+ property: string,
1492
+ options?: { allowAuto?: boolean },
1493
+ ): StyleDescriptor;
1494
+ export function parseSize(
1495
+ size: Size | MaxSize,
1496
+ builder: StylesheetBuilder,
1497
+ options?: string | { allowAuto?: boolean },
1498
+ { allowAuto = false } = {},
1499
+ ) {
1500
+ allowAuto =
1501
+ (typeof options === "object" ? options.allowAuto : allowAuto) ?? false;
1502
+
1503
+ switch (size.type) {
1504
+ case "length-percentage":
1505
+ return parseLength(size.value, builder);
1506
+ case "none":
1507
+ return size.type;
1508
+ case "auto":
1509
+ if (allowAuto) {
1510
+ return size.type;
1511
+ } else {
1512
+ builder.addWarning("value", size.type);
1513
+ return undefined;
1514
+ }
1515
+ case "min-content":
1516
+ case "max-content":
1517
+ case "fit-content":
1518
+ case "fit-content-function":
1519
+ case "stretch":
1520
+ case "contain":
1521
+ builder.addWarning("value", size.type);
1522
+ return undefined;
1523
+ default: {
1524
+ size satisfies never;
1525
+ }
1526
+ }
1527
+
1528
+ return;
1529
+ }
1530
+
1531
+ export function parseColorOrAutoDeclaration(
1532
+ { value }: { value: ColorOrAuto },
1533
+ builder: StylesheetBuilder,
1534
+ ) {
1535
+ if (value.type === "auto") {
1536
+ builder.addWarning("value", `Invalid color value ${value.type}`);
1537
+ return;
1538
+ } else {
1539
+ return parseColor(value.value, builder);
1540
+ }
1541
+ }
1542
+
1543
+ export function parseFontColorDeclaration(
1544
+ declaration: Extract<Declaration, { value: CssColor }>,
1545
+ builder: StylesheetBuilder,
1546
+ ) {
1547
+ parseColorDeclaration(declaration, builder);
1548
+
1549
+ builder.addDescriptor(
1550
+ "--__rn-css-color",
1551
+ parseColor(declaration.value, builder),
1552
+ );
1553
+ }
1554
+
1555
+ export function parseColorDeclaration(
1556
+ declaration: Extract<Declaration, { value: CssColor }>,
1557
+ builder: StylesheetBuilder,
1558
+ ) {
1559
+ builder.addDescriptor(
1560
+ declaration.property,
1561
+ parseColor(declaration.value, builder),
1562
+ );
1563
+ }
1564
+
1565
+ export function parseColor(cssColor: CssColor, builder: StylesheetBuilder) {
1566
+ if (typeof cssColor === "string") {
1567
+ if (namedColors.has(cssColor)) {
1568
+ return cssColor;
1569
+ }
1570
+ return;
1571
+ }
1572
+
1573
+ let color: Color | undefined;
1574
+
1575
+ const { hexColors = true, colorPrecision } = builder.getOptions();
1576
+
1577
+ switch (cssColor.type) {
1578
+ case "currentcolor":
1579
+ return [{}, "var", "__rn-css-current-color"] as const;
1580
+ case "light-dark": {
1581
+ const extraRule: StyleRule = {
1582
+ s: [],
1583
+ m: [["=", "prefers-color-scheme", "dark"]],
1584
+ };
1585
+
1586
+ builder.addUnnamedDescriptor(
1587
+ parseColor(cssColor.dark, builder),
1588
+ false,
1589
+ extraRule,
1590
+ );
1591
+ builder.addExtraRule(extraRule);
1592
+ return parseColor(cssColor.light, builder);
1593
+ }
1594
+ case "rgb": {
1595
+ color = new Color({
1596
+ space: "sRGB",
1597
+ coords: [cssColor.r / 255, cssColor.g / 255, cssColor.b / 255],
1598
+ alpha: cssColor.alpha,
1599
+ });
1600
+ break;
1601
+ }
1602
+ case "hsl":
1603
+ color = new Color({
1604
+ space: cssColor.type,
1605
+ coords: [cssColor.h, cssColor.s, cssColor.l],
1606
+ alpha: cssColor.alpha,
1607
+ });
1608
+ break;
1609
+ case "hwb":
1610
+ color = new Color({
1611
+ space: cssColor.type,
1612
+ coords: [cssColor.h, cssColor.w, cssColor.b],
1613
+ alpha: cssColor.alpha,
1614
+ });
1615
+ break;
1616
+ case "lab":
1617
+ color = new Color({
1618
+ space: cssColor.type,
1619
+ coords: [cssColor.l, cssColor.a, cssColor.b],
1620
+ alpha: cssColor.alpha,
1621
+ });
1622
+ break;
1623
+ case "lch":
1624
+ color = new Color({
1625
+ space: cssColor.type,
1626
+ coords: [cssColor.l, cssColor.c, cssColor.h],
1627
+ alpha: cssColor.alpha,
1628
+ });
1629
+ break;
1630
+ case "oklab":
1631
+ color = new Color({
1632
+ space: cssColor.type,
1633
+ coords: [cssColor.l, cssColor.a, cssColor.b],
1634
+ alpha: cssColor.alpha,
1635
+ });
1636
+ break;
1637
+ case "oklch":
1638
+ color = new Color({
1639
+ space: cssColor.type,
1640
+ coords: [cssColor.l, cssColor.c, cssColor.h],
1641
+ alpha: cssColor.alpha,
1642
+ });
1643
+ break;
1644
+ case "srgb":
1645
+ color = new Color({
1646
+ space: cssColor.type,
1647
+ coords: [cssColor.r, cssColor.g, cssColor.b],
1648
+ alpha: cssColor.alpha,
1649
+ });
1650
+ break;
1651
+ case "srgb-linear":
1652
+ color = new Color({
1653
+ space: cssColor.type,
1654
+ coords: [cssColor.r, cssColor.g, cssColor.b],
1655
+ alpha: cssColor.alpha,
1656
+ });
1657
+ break;
1658
+ case "display-p3":
1659
+ color = new Color({
1660
+ space: "p3",
1661
+ coords: [cssColor.r, cssColor.g, cssColor.b],
1662
+ alpha: cssColor.alpha,
1663
+ });
1664
+ break;
1665
+ case "a98-rgb":
1666
+ color = new Color({
1667
+ space: "a98rgb",
1668
+ coords: [cssColor.r, cssColor.g, cssColor.b],
1669
+ alpha: cssColor.alpha,
1670
+ });
1671
+ break;
1672
+ case "prophoto-rgb":
1673
+ color = new Color({
1674
+ space: "prophoto",
1675
+ coords: [cssColor.r, cssColor.g, cssColor.b],
1676
+ alpha: cssColor.alpha,
1677
+ });
1678
+ break;
1679
+ case "rec2020":
1680
+ color = new Color({
1681
+ space: cssColor.type,
1682
+ coords: [cssColor.r, cssColor.g, cssColor.b],
1683
+ alpha: cssColor.alpha,
1684
+ });
1685
+ break;
1686
+ case "xyz-d50":
1687
+ color = new Color({
1688
+ space: cssColor.type,
1689
+ coords: [cssColor.x, cssColor.y, cssColor.z],
1690
+ alpha: cssColor.alpha,
1691
+ });
1692
+ break;
1693
+ case "xyz-d65":
1694
+ color = new Color({
1695
+ space: cssColor.type,
1696
+ coords: [cssColor.x, cssColor.y, cssColor.z],
1697
+ alpha: cssColor.alpha,
1698
+ });
1699
+ break;
1700
+ default: {
1701
+ cssColor satisfies never;
1702
+ }
1703
+ }
1704
+
1705
+ if (!hexColors || colorPrecision) {
1706
+ return color?.toString({ precision: colorPrecision ?? 3 });
1707
+ } else {
1708
+ return color?.toString({ format: "hex" });
1709
+ }
1710
+ }
1711
+
1712
+ export function parseLengthPercentageOrAutoDeclaration(
1713
+ value: { value: LengthPercentageOrAuto },
1714
+ builder: StylesheetBuilder,
1715
+ ) {
1716
+ return parseLengthPercentageOrAuto(value.value, builder);
1717
+ }
1718
+
1719
+ export function parseLengthPercentageOrAuto(
1720
+ lengthPercentageOrAuto: LengthPercentageOrAuto,
1721
+ builder: StylesheetBuilder,
1722
+ { allowAuto = false } = {},
1723
+ ) {
1724
+ switch (lengthPercentageOrAuto.type) {
1725
+ case "auto":
1726
+ if (allowAuto) {
1727
+ return lengthPercentageOrAuto.type;
1728
+ } else {
1729
+ builder.addWarning("value", lengthPercentageOrAuto.type);
1730
+ return undefined;
1731
+ }
1732
+ case "length-percentage":
1733
+ return parseLength(lengthPercentageOrAuto.value, builder);
1734
+ default: {
1735
+ lengthPercentageOrAuto satisfies never;
1736
+ }
1737
+ }
1738
+
1739
+ return;
1740
+ }
1741
+
1742
+ export function parseJustifyContent(
1743
+ declaration: DeclarationType<"justify-content">,
1744
+ builder: StylesheetBuilder,
1745
+ ) {
1746
+ const allowed = new Set([
1747
+ "flex-start",
1748
+ "flex-end",
1749
+ "center",
1750
+ "space-between",
1751
+ "space-around",
1752
+ "space-evenly",
1753
+ ]);
1754
+
1755
+ let value: string | undefined;
1756
+
1757
+ switch (declaration.value.type) {
1758
+ case "normal":
1759
+ case "left":
1760
+ case "right":
1761
+ value = declaration.value.type;
1762
+ break;
1763
+ case "content-distribution":
1764
+ case "content-position":
1765
+ value = declaration.value.value;
1766
+ break;
1767
+ default: {
1768
+ declaration.value satisfies never;
1769
+ }
1770
+ }
1771
+
1772
+ if (value && !allowed.has(value)) {
1773
+ builder.addWarning("value", value);
1774
+ return;
1775
+ }
1776
+
1777
+ return value;
1778
+ }
1779
+
1780
+ export function parseAlignContent(
1781
+ declaration: DeclarationType<"align-content">,
1782
+ builder: StylesheetBuilder,
1783
+ ) {
1784
+ const allowed = new Set([
1785
+ "flex-start",
1786
+ "flex-end",
1787
+ "center",
1788
+ "stretch",
1789
+ "space-between",
1790
+ "space-around",
1791
+ ]);
1792
+
1793
+ let value: string | undefined;
1794
+
1795
+ switch (declaration.value.type) {
1796
+ case "normal":
1797
+ case "baseline-position":
1798
+ value = declaration.value.type;
1799
+ break;
1800
+ case "content-distribution":
1801
+ case "content-position":
1802
+ value = declaration.value.value;
1803
+ break;
1804
+ default: {
1805
+ declaration.value satisfies never;
1806
+ }
1807
+ }
1808
+
1809
+ if (value && !allowed.has(value)) {
1810
+ builder.addWarning("value", value);
1811
+ return;
1812
+ }
1813
+
1814
+ return value;
1815
+ }
1816
+
1817
+ export function parseAlignItems(
1818
+ alignItems: DeclarationType<"align-items">,
1819
+ builder: StylesheetBuilder,
1820
+ ) {
1821
+ const allowed = new Set([
1822
+ "auto",
1823
+ "flex-start",
1824
+ "flex-end",
1825
+ "center",
1826
+ "stretch",
1827
+ "baseline",
1828
+ ]);
1829
+
1830
+ let value: string | undefined;
1831
+
1832
+ switch (alignItems.value.type) {
1833
+ case "normal":
1834
+ value = "auto";
1835
+ break;
1836
+ case "stretch":
1837
+ value = alignItems.value.type;
1838
+ break;
1839
+ case "baseline-position":
1840
+ value = "baseline";
1841
+ break;
1842
+ case "self-position":
1843
+ value = alignItems.value.value;
1844
+ break;
1845
+ default: {
1846
+ alignItems.value satisfies never;
1847
+ }
1848
+ }
1849
+
1850
+ if (value && !allowed.has(value)) {
1851
+ builder.addWarning("value", value);
1852
+ return;
1853
+ }
1854
+
1855
+ return value;
1856
+ }
1857
+
1858
+ export function parseAlignSelf(
1859
+ alignSelf: DeclarationType<"align-self">,
1860
+ builder: StylesheetBuilder,
1861
+ ) {
1862
+ const allowed = new Set([
1863
+ "auto",
1864
+ "flex-start",
1865
+ "flex-end",
1866
+ "center",
1867
+ "stretch",
1868
+ "baseline",
1869
+ ]);
1870
+
1871
+ let value: string | undefined;
1872
+
1873
+ switch (alignSelf.value.type) {
1874
+ case "normal":
1875
+ case "auto":
1876
+ value = "auto";
1877
+ break;
1878
+ case "stretch":
1879
+ value = alignSelf.value.type;
1880
+ break;
1881
+ case "baseline-position":
1882
+ value = "baseline";
1883
+ break;
1884
+ case "self-position":
1885
+ value = alignSelf.value.value;
1886
+ break;
1887
+ default: {
1888
+ alignSelf.value satisfies never;
1889
+ }
1890
+ }
1891
+
1892
+ if (value && !allowed.has(value)) {
1893
+ builder.addWarning("value", value);
1894
+ return;
1895
+ }
1896
+
1897
+ return value;
1898
+ }
1899
+
1900
+ export function parseFontWeightDeclaration(
1901
+ declaration: DeclarationType<"font-weight">,
1902
+ builder: StylesheetBuilder,
1903
+ ) {
1904
+ return parseFontWeight(declaration.value, builder);
1905
+ }
1906
+
1907
+ export function parseFontWeight(
1908
+ fontWeight: FontWeight,
1909
+ builder: StylesheetBuilder,
1910
+ ) {
1911
+ switch (fontWeight.type) {
1912
+ case "absolute":
1913
+ if (fontWeight.value.type === "weight") {
1914
+ return fontWeight.value.value.toString();
1915
+ } else {
1916
+ return fontWeight.value.type;
1917
+ }
1918
+ case "bolder":
1919
+ case "lighter":
1920
+ builder.addWarning("value", fontWeight.type);
1921
+ return;
1922
+ default: {
1923
+ fontWeight satisfies never;
1924
+ }
1925
+ }
1926
+
1927
+ return;
1928
+ }
1929
+
1930
+ export function parseTextShadow(
1931
+ declaration: DeclarationType<"text-shadow">,
1932
+ builder: StylesheetBuilder,
1933
+ ) {
1934
+ const [textShadow] = declaration.value;
1935
+
1936
+ if (!textShadow) {
1937
+ return;
1938
+ }
1939
+ builder.addDescriptor(
1940
+ "textShadowColor",
1941
+ parseColor(textShadow.color, builder),
1942
+ );
1943
+ builder.addDescriptor(
1944
+ "textShadowOffset.width",
1945
+ parseLength(textShadow.xOffset, builder),
1946
+ );
1947
+ builder.addDescriptor(
1948
+ "textShadowOffset.height",
1949
+ parseLength(textShadow.yOffset, builder),
1950
+ );
1951
+ builder.addDescriptor(
1952
+ "textShadowRadius",
1953
+ parseLength(textShadow.blur, builder),
1954
+ );
1955
+ }
1956
+
1957
+ export function parseTextDecorationStyle(
1958
+ declaration: DeclarationType<"text-decoration-style">,
1959
+ builder: StylesheetBuilder,
1960
+ ) {
1961
+ const allowed = new Set(["solid", "double", "dotted", "dashed"]);
1962
+
1963
+ if (allowed.has(declaration.value)) {
1964
+ return declaration.value;
1965
+ }
1966
+
1967
+ builder.addWarning("value", declaration.value);
1968
+ return;
1969
+ }
1970
+
1971
+ export function parseTextDecorationLineDeclaration(
1972
+ declaration: DeclarationType<"text-decoration-line">,
1973
+ builder: StylesheetBuilder,
1974
+ ) {
1975
+ return parseTextDecorationLine(declaration.value, builder);
1976
+ }
1977
+
1978
+ export function parseTextDecorationLine(
1979
+ value: DeclarationType<"text-decoration-line">["value"],
1980
+ builder: StylesheetBuilder,
1981
+ ) {
1982
+ if (!Array.isArray(value)) {
1983
+ if (value === "none") {
1984
+ return value;
1985
+ }
1986
+ builder.addWarning("value", value);
1987
+ return;
1988
+ }
1989
+
1990
+ const set = new Set(value);
1991
+
1992
+ if (set.has("underline")) {
1993
+ if (set.has("line-through")) {
1994
+ return "underline line-through";
1995
+ } else {
1996
+ return "underline";
1997
+ }
1998
+ } else if (set.has("line-through")) {
1999
+ return "line-through";
2000
+ }
2001
+
2002
+ builder.addWarning("value", value.join(" "));
2003
+ return undefined;
2004
+ }
2005
+
2006
+ export function parsePosition(
2007
+ { value }: DeclarationType<"position">,
2008
+ builder: StylesheetBuilder,
2009
+ ) {
2010
+ if (value.type === "absolute" || value.type === "relative") {
2011
+ return value.type;
2012
+ }
2013
+
2014
+ builder.addWarning("value", value.type);
2015
+ return;
2016
+ }
2017
+
2018
+ export function parseOverflow(
2019
+ { value }: DeclarationType<"overflow">,
2020
+ builder: StylesheetBuilder,
2021
+ ) {
2022
+ const allowed = new Set(["visible", "hidden"]);
2023
+
2024
+ if (allowed.has(value.x)) {
2025
+ return value.x;
2026
+ }
2027
+
2028
+ builder.addWarning("value", value.x);
2029
+ return undefined;
2030
+ }
2031
+
2032
+ export function parseBorderStyleDeclaration(
2033
+ declaration: Extract<
2034
+ DeclarationType<Declaration["property"]>,
2035
+ { value: LineStyle | BorderStyle }
2036
+ >,
2037
+ builder: StylesheetBuilder,
2038
+ ) {
2039
+ return parseBorderStyle(declaration.value, builder);
2040
+ }
2041
+
2042
+ export function parseBorderStyle(
2043
+ value: BorderStyle | LineStyle,
2044
+ builder: StylesheetBuilder,
2045
+ ) {
2046
+ const allowed = new Set(["solid", "dotted", "dashed"]);
2047
+
2048
+ if (typeof value === "string") {
2049
+ if (allowed.has(value)) {
2050
+ return value;
2051
+ } else {
2052
+ builder.addWarning("value", value);
2053
+ return undefined;
2054
+ }
2055
+ } else if (
2056
+ value.top === value.bottom &&
2057
+ value.top === value.left &&
2058
+ value.top === value.right &&
2059
+ allowed.has(value.top)
2060
+ ) {
2061
+ return value.top;
2062
+ }
2063
+
2064
+ builder.addWarning("value", value.top);
2065
+
2066
+ return undefined;
2067
+ }
2068
+
2069
+ export function parseBorderBlockWidth(
2070
+ declaration: DeclarationType<"border-block-width">,
2071
+ builder: StylesheetBuilder,
2072
+ ) {
2073
+ const start = parseBorderSideWidth(declaration.value.start, builder);
2074
+ const end = parseBorderSideWidth(declaration.value.end, builder);
2075
+
2076
+ if (start === end) {
2077
+ builder.addDescriptor("border-block-width", start);
2078
+ } else {
2079
+ builder.addDescriptor("border-block-start-width", start);
2080
+ builder.addDescriptor("border-block-end-width", end);
2081
+ }
2082
+ }
2083
+
2084
+ function parseBorderBlockStyle(
2085
+ declaration: DeclarationType<"border-block-style">,
2086
+ builder: StylesheetBuilder,
2087
+ ) {
2088
+ const start = parseBorderStyle(declaration.value.start, builder);
2089
+ const end = parseBorderStyle(declaration.value.end, builder);
2090
+
2091
+ if (start == end) {
2092
+ builder.addDescriptor("border-block-style", start);
2093
+ } else {
2094
+ builder.addDescriptor("border-block-start-style", start);
2095
+ builder.addDescriptor("border-block-end-style", end);
2096
+ }
2097
+ }
2098
+
2099
+ export function parseBorderSideWidthDeclaration(
2100
+ declaration: DeclarationType<
2101
+ | "border-block-end-width"
2102
+ | "border-block-start-width"
2103
+ | "border-bottom-width"
2104
+ | "border-inline-end-width"
2105
+ | "border-inline-start-width"
2106
+ | "border-left-width"
2107
+ | "border-right-width"
2108
+ | "border-top-width"
2109
+ >,
2110
+ builder: StylesheetBuilder,
2111
+ ) {
2112
+ builder.addDescriptor(
2113
+ declaration.property,
2114
+ parseBorderSideWidth(declaration.value, builder),
2115
+ );
2116
+ }
2117
+
2118
+ export function parseBorderSideWidth(
2119
+ value: BorderSideWidth,
2120
+ builder: StylesheetBuilder,
2121
+ ) {
2122
+ if (value.type === "length") {
2123
+ return parseLength(value.value, builder);
2124
+ }
2125
+
2126
+ builder.addWarning("value", value.type);
2127
+ return undefined;
2128
+ }
2129
+
2130
+ export function parseVerticalAlign(
2131
+ { value }: DeclarationType<"vertical-align">,
2132
+ builder: StylesheetBuilder,
2133
+ ) {
2134
+ if (value.type === "length") {
2135
+ return undefined;
2136
+ }
2137
+
2138
+ const allowed = new Set(["auto", "top", "bottom", "middle"]);
2139
+
2140
+ if (allowed.has(value.value)) {
2141
+ return value.value;
2142
+ }
2143
+
2144
+ builder.addWarning("value", value.value);
2145
+ return undefined;
2146
+ }
2147
+
2148
+ function parseFontFamily({ value }: DeclarationType<"font-family">) {
2149
+ // React Native only allows one font family - better hope this is the right one :)
2150
+ return value[0];
2151
+ }
2152
+
2153
+ export function parseLineHeightDeclaration(
2154
+ declaration: DeclarationType<"line-height">,
2155
+ builder: StylesheetBuilder,
2156
+ ) {
2157
+ return parseLineHeight(declaration.value, builder);
2158
+ }
2159
+
2160
+ export function parseLineHeight(
2161
+ value: LineHeight,
2162
+ builder: StylesheetBuilder,
2163
+ ): StyleDescriptor {
2164
+ switch (value.type) {
2165
+ case "normal":
2166
+ return undefined;
2167
+ case "number":
2168
+ return [{}, "em", [value.value], 1];
2169
+ case "length": {
2170
+ const length = value.value;
2171
+
2172
+ switch (length.type) {
2173
+ case "dimension":
2174
+ return parseLength(length, builder);
2175
+ case "percentage":
2176
+ case "calc":
2177
+ builder.addWarning(
2178
+ "style",
2179
+ "line-height",
2180
+ typeof length.value === "number"
2181
+ ? length.value
2182
+ : JSON.stringify(length.value),
2183
+ );
2184
+ return;
2185
+ default: {
2186
+ length satisfies never;
2187
+ }
2188
+ }
2189
+
2190
+ return;
2191
+ }
2192
+ default: {
2193
+ value satisfies never;
2194
+ }
2195
+ }
2196
+
2197
+ return;
2198
+ }
2199
+
2200
+ export function parseFontSizeDeclaration(
2201
+ declaration: DeclarationType<"font-size">,
2202
+ builder: StylesheetBuilder,
2203
+ ) {
2204
+ const fontSize = parseFontSize(declaration.value, builder);
2205
+ builder.addDescriptor("fontSize", fontSize);
2206
+ builder.addDescriptor("--__rn-css-em", fontSize);
2207
+ }
2208
+
2209
+ export function parseFontSize(value: FontSize, builder: StylesheetBuilder) {
2210
+ switch (value.type) {
2211
+ case "length":
2212
+ return parseLength(value.value, builder);
2213
+ case "absolute":
2214
+ case "relative":
2215
+ builder.addWarning("value", value.value);
2216
+ return undefined;
2217
+ default: {
2218
+ value satisfies never;
2219
+ }
2220
+ }
2221
+
2222
+ return;
2223
+ }
2224
+
2225
+ export function parseFontStyleDeclaration(
2226
+ declaration: DeclarationType<"font-style">,
2227
+ builder: StylesheetBuilder,
2228
+ ) {
2229
+ return parseFontStyle(declaration.value, builder);
2230
+ }
2231
+
2232
+ export function parseFontStyle(value: FontStyle, builder: StylesheetBuilder) {
2233
+ switch (value.type) {
2234
+ case "normal":
2235
+ case "italic":
2236
+ return value.type;
2237
+ case "oblique":
2238
+ builder.addWarning("value", value.type);
2239
+ return undefined;
2240
+ default: {
2241
+ value satisfies never;
2242
+ }
2243
+ }
2244
+
2245
+ return;
2246
+ }
2247
+
2248
+ export function parseFontVariantCapsDeclaration(
2249
+ declaration: DeclarationType<"font-variant-caps">,
2250
+ builder: StylesheetBuilder,
2251
+ ) {
2252
+ return parseFontVariantCaps(declaration.value, builder);
2253
+ }
2254
+
2255
+ export function parseFontVariantCaps(
2256
+ value: FontVariantCaps,
2257
+ builder: StylesheetBuilder,
2258
+ ) {
2259
+ const allowed = new Set([
2260
+ "small-caps",
2261
+ "oldstyle-nums",
2262
+ "lining-nums",
2263
+ "tabular-nums",
2264
+ "proportional-nums",
2265
+ ]);
2266
+ if (allowed.has(value)) {
2267
+ return value;
2268
+ }
2269
+
2270
+ builder.addWarning("value", value);
2271
+ return undefined;
2272
+ }
2273
+
2274
+ export function parseLengthOrCoercePercentageToRuntime(
2275
+ value: Length | DimensionPercentageFor_LengthValue | NumberOrPercentage,
2276
+ builder: StylesheetBuilder,
2277
+ ): StyleDescriptor {
2278
+ return parseLength(value, builder);
2279
+ }
2280
+
2281
+ export function parseGap(
2282
+ declaration: DeclarationType<"gap" | "column-gap" | "row-gap">,
2283
+ builder: StylesheetBuilder,
2284
+ ) {
2285
+ if ("column" in declaration.value) {
2286
+ builder.addDescriptor(
2287
+ "row-gap",
2288
+ parseGapValue(declaration.value.row, builder),
2289
+ );
2290
+ builder.addDescriptor(
2291
+ "column-gap",
2292
+ parseGapValue(declaration.value.column, builder),
2293
+ );
2294
+
2295
+ return;
2296
+ } else {
2297
+ if (declaration.value.type === "normal") {
2298
+ builder.addWarning("value", declaration.value.type);
2299
+ return;
2300
+ }
2301
+
2302
+ return parseLength(declaration.value.value, builder);
2303
+ }
2304
+ }
2305
+
2306
+ function parseGapValue(
2307
+ value: GapValue,
2308
+ builder: StylesheetBuilder,
2309
+ ): StyleDescriptor {
2310
+ if (value.type === "normal") {
2311
+ return;
2312
+ } else {
2313
+ return parseLength(value.value, builder);
2314
+ }
2315
+ }
2316
+
2317
+ export function parseTextAlign(
2318
+ { value }: DeclarationType<"text-align">,
2319
+ builder: StylesheetBuilder,
2320
+ ) {
2321
+ const allowed = new Set(["auto", "left", "right", "center", "justify"]);
2322
+ if (allowed.has(value)) {
2323
+ return value;
2324
+ }
2325
+
2326
+ builder.addWarning("value", value);
2327
+ return undefined;
2328
+ }
2329
+
2330
+ export function parseBoxShadow(
2331
+ { value }: DeclarationType<"box-shadow">,
2332
+ builder: StylesheetBuilder,
2333
+ ) {
2334
+ for (const [index, shadow] of value.entries()) {
2335
+ builder.addDescriptor(
2336
+ `boxShadow.[${index}].color`,
2337
+ parseColor(shadow.color, builder),
2338
+ );
2339
+ builder.addDescriptor(
2340
+ `boxShadow.[${index}].offsetX`,
2341
+ parseLength(shadow.xOffset, builder),
2342
+ );
2343
+ builder.addDescriptor(
2344
+ `boxShadow.[${index}].offsetY`,
2345
+ parseLength(shadow.yOffset, builder),
2346
+ );
2347
+ builder.addDescriptor(
2348
+ `boxShadow.[${index}].blurRadius`,
2349
+ parseLength(shadow.blur, builder),
2350
+ );
2351
+ builder.addDescriptor(
2352
+ `boxShadow.[${index}].spreadDistance`,
2353
+ parseLength(shadow.spread, builder),
2354
+ );
2355
+ builder.addDescriptor(
2356
+ `boxShadow.[${index}].inset`,
2357
+ shadow.inset ? true : undefined,
2358
+ );
2359
+ }
2360
+ }
2361
+
2362
+ export function parseDisplay(
2363
+ { value }: DeclarationType<"display">,
2364
+ builder: StylesheetBuilder,
2365
+ ) {
2366
+ if (value.type === "keyword") {
2367
+ if (value.value === "none") {
2368
+ return value.value;
2369
+ } else {
2370
+ builder.addWarning("value", value.value);
2371
+ return;
2372
+ }
2373
+ } else {
2374
+ if (value.outside === "block") {
2375
+ switch (value.inside.type) {
2376
+ case "flow":
2377
+ if (value.isListItem) {
2378
+ builder.addWarning("value", "list-item");
2379
+ } else {
2380
+ builder.addWarning("value", "block");
2381
+ }
2382
+ return;
2383
+ case "flex":
2384
+ return value.inside.type;
2385
+ case "flow-root":
2386
+ case "table":
2387
+ case "box":
2388
+ case "grid":
2389
+ case "ruby":
2390
+ builder.addWarning("value", value.inside.type);
2391
+ return;
2392
+ }
2393
+ } else {
2394
+ switch (value.inside.type) {
2395
+ case "flow":
2396
+ builder.addWarning("value", "inline");
2397
+ return;
2398
+ case "flow-root":
2399
+ builder.addWarning("value", "inline-block");
2400
+ return;
2401
+ case "table":
2402
+ builder.addWarning("value", "inline-table");
2403
+ return;
2404
+ case "flex":
2405
+ builder.addWarning("value", "inline-flex");
2406
+ return;
2407
+ case "box":
2408
+ case "grid":
2409
+ builder.addWarning("value", "inline-grid");
2410
+ return;
2411
+ case "ruby":
2412
+ builder.addWarning("value", value.inside.type);
2413
+ return;
2414
+ }
2415
+ }
2416
+ }
2417
+ }
2418
+
2419
+ export function parseAspectRatio({
2420
+ value,
2421
+ }: DeclarationType<"aspect-ratio">): StyleDescriptor {
2422
+ if (!value.ratio) {
2423
+ return;
2424
+ } else if (value.auto) {
2425
+ return "auto";
2426
+ } else {
2427
+ const [width, height] = value.ratio;
2428
+ if (width === height) {
2429
+ return 1;
2430
+ } else {
2431
+ return `${width}/${height}`;
2432
+ }
2433
+ }
2434
+ }
2435
+
2436
+ export function parseDimension(
2437
+ { unit, value }: Extract<Token, { type: "dimension" }>,
2438
+ builder: StylesheetBuilder,
2439
+ ): StyleDescriptor {
2440
+ switch (unit) {
2441
+ case "px":
2442
+ if (value === Infinity) {
2443
+ return 9999;
2444
+ } else {
2445
+ return value;
2446
+ }
2447
+ case "%":
2448
+ return `${value}%`;
2449
+ case "rnh":
2450
+ case "rnw":
2451
+ return [{}, unit, [value / 100], 1];
2452
+ default: {
2453
+ builder.addWarning("value", `${value}${unit}`);
2454
+ return;
2455
+ }
2456
+ }
2457
+ }
2458
+
2459
+ export function parseUserSelect(
2460
+ { value }: DeclarationType<"user-select">,
2461
+ builder: StylesheetBuilder,
2462
+ ) {
2463
+ const allowed = ["auto", "text", "none", "contain", "all"];
2464
+ if (allowed.includes(value)) {
2465
+ return value;
2466
+ } else {
2467
+ builder.addWarning("value", value);
2468
+ return;
2469
+ }
2470
+ }
2471
+
2472
+ export function parseSVGPaint(
2473
+ { value, property }: DeclarationType<"fill" | "stroke">,
2474
+ builder: StylesheetBuilder,
2475
+ ) {
2476
+ let parsedValue: StyleDescriptor | undefined;
2477
+
2478
+ if (value.type === "none") {
2479
+ parsedValue = "transparent";
2480
+ } else if (value.type === "color") {
2481
+ parsedValue = parseColor(value.value, builder);
2482
+ } else {
2483
+ return;
2484
+ }
2485
+
2486
+ builder.addDescriptor(property, parsedValue);
2487
+ }
2488
+
2489
+ export function round(number: number) {
2490
+ return Math.round((number + Number.EPSILON) * 10000) / 10000;
2491
+ }
2492
+
2493
+ export function parseDimensionPercentageFor_LengthValue(
2494
+ value: DimensionPercentageFor_LengthValue,
2495
+ builder: StylesheetBuilder,
2496
+ ) {
2497
+ if (value.type === "calc") {
2498
+ return undefined;
2499
+ } else if (value.type === "percentage") {
2500
+ return `${value.value}%`;
2501
+ } else {
2502
+ return parseLength(value.value, builder);
2503
+ }
2504
+ }
2505
+
2506
+ const allowAutoProperties = new Set(["pointer-events"]);
2507
+
2508
+ export function parseEnv(
2509
+ value: EnvironmentVariable,
2510
+ builder: StylesheetBuilder,
2511
+ ): StyleFunction | undefined {
2512
+ switch (value.name.type) {
2513
+ case "ua":
2514
+ switch (value.name.value) {
2515
+ case "safe-area-inset-top":
2516
+ case "safe-area-inset-right":
2517
+ case "safe-area-inset-bottom":
2518
+ case "safe-area-inset-left":
2519
+ return [
2520
+ {},
2521
+ "var",
2522
+ [
2523
+ `--react-native-css-${value.name.value}`,
2524
+ parseUnparsed(value.fallback, builder, value.name.value),
2525
+ ],
2526
+ 1,
2527
+ ];
2528
+ case "viewport-segment-width":
2529
+ case "viewport-segment-height":
2530
+ case "viewport-segment-top":
2531
+ case "viewport-segment-left":
2532
+ case "viewport-segment-bottom":
2533
+ case "viewport-segment-right":
2534
+ }
2535
+ break;
2536
+ case "custom":
2537
+ case "unknown":
2538
+ }
2539
+
2540
+ return;
2541
+ }
2542
+
2543
+ export function parseCalcFn(
2544
+ name: string,
2545
+ tokens: TokenOrValue[],
2546
+ builder: StylesheetBuilder,
2547
+ property: string,
2548
+ ): StyleDescriptor {
2549
+ const args = parseCalcArguments(tokens, builder, property);
2550
+ if (args) {
2551
+ return [{}, name, args];
2552
+ }
2553
+
2554
+ return;
2555
+ }
2556
+
2557
+ export function parseCalcArguments(
2558
+ [...args]: TokenOrValue[],
2559
+ builder: StylesheetBuilder,
2560
+ property: string,
2561
+ ) {
2562
+ const parsed: StyleDescriptor[] = [];
2563
+
2564
+ for (const arg of args) {
2565
+ switch (arg.type) {
2566
+ case "env": {
2567
+ parsed.push(parseEnv(arg.value, builder));
2568
+ break;
2569
+ }
2570
+ case "var":
2571
+ case "function":
2572
+ case "unresolved-color": {
2573
+ const value = parseUnparsed(arg, builder, property);
2574
+
2575
+ if (value === undefined) {
2576
+ return undefined;
2577
+ }
2578
+
2579
+ parsed.push(value);
2580
+ break;
2581
+ }
2582
+ case "length": {
2583
+ const value = parseLength(arg.value, builder);
2584
+ if (value !== undefined) {
2585
+ parsed.push(value);
2586
+ }
2587
+ break;
2588
+ }
2589
+ case "color":
2590
+ case "url":
2591
+ case "angle":
2592
+ case "time":
2593
+ case "resolution":
2594
+ case "dashed-ident":
2595
+ break;
2596
+ case "token":
2597
+ switch (arg.value.type) {
2598
+ case "delim":
2599
+ switch (arg.value.value) {
2600
+ case "+":
2601
+ case "-":
2602
+ case "*":
2603
+ case "/":
2604
+ parsed.push(arg.value.value);
2605
+ break;
2606
+ }
2607
+ break;
2608
+ case "percentage":
2609
+ parsed.push(`${round(arg.value.value * 100)}%`);
2610
+ break;
2611
+ case "number": {
2612
+ parsed.push(round(arg.value.value));
2613
+ break;
2614
+ }
2615
+ case "parenthesis-block": {
2616
+ parsed.push("(");
2617
+ break;
2618
+ }
2619
+ case "close-parenthesis":
2620
+ parsed.push(")");
2621
+ break;
2622
+ case "string":
2623
+ case "function":
2624
+ case "ident":
2625
+ case "at-keyword":
2626
+ case "hash":
2627
+ case "id-hash":
2628
+ case "unquoted-url":
2629
+ case "dimension":
2630
+ case "white-space":
2631
+ case "comment":
2632
+ case "colon":
2633
+ case "semicolon":
2634
+ case "comma":
2635
+ case "include-match":
2636
+ case "dash-match":
2637
+ case "prefix-match":
2638
+ case "suffix-match":
2639
+ case "substring-match":
2640
+ case "cdo":
2641
+ case "cdc":
2642
+ case "square-bracket-block":
2643
+ case "curly-bracket-block":
2644
+ case "bad-url":
2645
+ case "bad-string":
2646
+ case "close-square-bracket":
2647
+ case "close-curly-bracket":
2648
+ }
2649
+ }
2650
+ }
2651
+
2652
+ return parsed;
2653
+ }
2654
+
2655
+ export function parseTranslateProp(
2656
+ value: Translate,
2657
+ prop: keyof Extract<Translate, object>,
2658
+ builder: StylesheetBuilder,
2659
+ ): StyleDescriptor {
2660
+ if (value === "none") {
2661
+ return 0;
2662
+ }
2663
+
2664
+ return parseLength(value[prop], builder);
2665
+ }
2666
+
2667
+ export function parseUnresolvedColor(
2668
+ color: UnresolvedColor,
2669
+ builder: StylesheetBuilder,
2670
+ property: string,
2671
+ allowAuto: boolean,
2672
+ ): StyleDescriptor {
2673
+ switch (color.type) {
2674
+ case "rgb":
2675
+ return [
2676
+ {},
2677
+ "rgba",
2678
+ [
2679
+ round(color.r * 255),
2680
+ round(color.g * 255),
2681
+ round(color.b * 255),
2682
+ parseUnparsed(color.alpha, builder, property),
2683
+ ],
2684
+ ];
2685
+ case "hsl":
2686
+ return [
2687
+ {},
2688
+ color.type,
2689
+ [
2690
+ color.h,
2691
+ color.s,
2692
+ color.l,
2693
+ parseUnparsed(color.alpha, builder, property),
2694
+ ],
2695
+ ];
2696
+ case "light-dark": {
2697
+ const extraRule = builder.extendRule({
2698
+ m: [["=", "prefers-color-scheme", "dark"]],
2699
+ });
2700
+ builder.addUnnamedDescriptor(
2701
+ reduceParseUnparsed(color.dark, builder, property, allowAuto),
2702
+ false,
2703
+ extraRule,
2704
+ );
2705
+ builder.addExtraRule(extraRule);
2706
+ return reduceParseUnparsed(color.light, builder, property, allowAuto);
2707
+ }
2708
+ default:
2709
+ color satisfies never;
2710
+ }
2711
+
2712
+ return;
2713
+ }
2714
+
2715
+ export function allEqual(...params: unknown[]) {
2716
+ return params.every((param, index, array) => {
2717
+ return index === 0 ? true : equal(array[0], param);
2718
+ });
2719
+ }
2720
+ export function equal(a: unknown, b: unknown) {
2721
+ if (a === b) return true;
2722
+ if (typeof a !== typeof b) return false;
2723
+ if (a === null || b === null) return false;
2724
+ if (Array.isArray(a) && Array.isArray(b)) {
2725
+ if (a.length !== b.length) return false;
2726
+ for (let i = 0; i < a.length; i++) {
2727
+ if (!equal(a[i], b[i])) return false;
2728
+ }
2729
+ return true;
2730
+ }
2731
+ if (typeof a === "object" && typeof b === "object") {
2732
+ if (Object.keys(a).length !== Object.keys(b).length) return false;
2733
+ for (const key in a) {
2734
+ if (
2735
+ !equal(
2736
+ (a as Record<string, unknown>)[key],
2737
+ (b as Record<string, unknown>)[key],
2738
+ )
2739
+ )
2740
+ return false;
2741
+ }
2742
+ return true;
2743
+ }
2744
+
2745
+ return false;
2746
+ }
2747
+
2748
+ export function parseTime(time: Time) {
2749
+ return time.type === "milliseconds" ? time.value : time.value * 1000;
2750
+ }
2751
+
2752
+ export function parseSize2DDimensionPercentageDeclaration(
2753
+ declaration: { value: Size2DFor_DimensionPercentageFor_LengthValue },
2754
+ builder: StylesheetBuilder,
2755
+ ) {
2756
+ return parseSize2DDimensionPercentage(declaration.value, builder);
2757
+ }
2758
+
2759
+ export function parseSize2DDimensionPercentage(
2760
+ value: Size2DFor_DimensionPercentageFor_LengthValue,
2761
+ builder: StylesheetBuilder,
2762
+ ) {
2763
+ return parseLength(value[0], builder);
2764
+ }
2765
+
2766
+ export function addTransitionValue(
2767
+ declaration: Extract<
2768
+ Declaration,
2769
+ { property: `transition${string}` | "transition" }
2770
+ >,
2771
+ builder: StylesheetBuilder,
2772
+ ) {
2773
+ switch (declaration.property) {
2774
+ case "transition": {
2775
+ const grouped: Record<string, unknown[]> = {};
2776
+
2777
+ for (const animation of declaration.value) {
2778
+ for (const [key, value] of Object.entries(animation)) {
2779
+ grouped[key] ??= [];
2780
+ grouped[key].push(value);
2781
+ }
2782
+ }
2783
+
2784
+ for (const [property, value] of Object.entries(grouped)) {
2785
+ addTransitionValue(
2786
+ {
2787
+ property: `transition-${kebabCase(property)}`,
2788
+ value,
2789
+ } as Extract<
2790
+ Declaration,
2791
+ { property: `transition${string}` | "transition" }
2792
+ >,
2793
+ builder,
2794
+ );
2795
+ }
2796
+ break;
2797
+ }
2798
+ case "transition-property": {
2799
+ builder.addDescriptor(
2800
+ declaration.property,
2801
+ declaration.value
2802
+ .map((v) => v.property)
2803
+ .filter(
2804
+ (v) =>
2805
+ (v in parsers && !["visibility"].includes(v)) ||
2806
+ v === "all" ||
2807
+ v === "none",
2808
+ )
2809
+ .map((v) => toRNProperty(v)),
2810
+ );
2811
+ return;
2812
+ }
2813
+ case "transition-duration":
2814
+ builder.addDescriptor(
2815
+ declaration.property,
2816
+ declaration.value.map((t) => parseTime(t)),
2817
+ );
2818
+ return;
2819
+ case "transition-delay":
2820
+ builder.addDescriptor(
2821
+ declaration.property,
2822
+ declaration.value.map((t) => parseTime(t)),
2823
+ );
2824
+ return;
2825
+ case "transition-timing-function":
2826
+ builder.addDescriptor(
2827
+ declaration.property,
2828
+ parseEasingFunction(declaration.value),
2829
+ );
2830
+ return;
2831
+ }
2832
+ }
2833
+
2834
+ export function addAnimationValue(
2835
+ declaration: Extract<
2836
+ Declaration,
2837
+ { property: `animation${string}` | "animation" }
2838
+ >,
2839
+ builder: StylesheetBuilder,
2840
+ ) {
2841
+ switch (declaration.property) {
2842
+ case "animation": {
2843
+ const grouped: Record<string, unknown[]> = {};
2844
+
2845
+ for (const animation of declaration.value) {
2846
+ for (const [key, value] of Object.entries(animation)) {
2847
+ grouped[key] ??= [];
2848
+ grouped[key].push(value);
2849
+ }
2850
+ }
2851
+
2852
+ for (const [property, value] of Object.entries(grouped)) {
2853
+ addAnimationValue(
2854
+ {
2855
+ property: `animation-${kebabCase(property)}`,
2856
+ value,
2857
+ } as Extract<
2858
+ Declaration,
2859
+ { property: `animation${string}` | "animation" }
2860
+ >,
2861
+ builder,
2862
+ );
2863
+ }
2864
+ break;
2865
+ }
2866
+ case "animation-delay": {
2867
+ builder.addDescriptor(
2868
+ declaration.property,
2869
+ declaration.value.map((t) => parseTime(t)),
2870
+ );
2871
+ break;
2872
+ }
2873
+ case "animation-direction": {
2874
+ builder.addDescriptor(declaration.property, declaration.value);
2875
+ break;
2876
+ }
2877
+ case "animation-duration": {
2878
+ builder.addDescriptor(
2879
+ declaration.property,
2880
+ declaration.value.map((t) => parseTime(t)),
2881
+ );
2882
+ break;
2883
+ }
2884
+ case "animation-fill-mode": {
2885
+ builder.addDescriptor(declaration.property, declaration.value);
2886
+ break;
2887
+ }
2888
+ case "animation-iteration-count": {
2889
+ builder.addDescriptor(
2890
+ declaration.property,
2891
+ parseIterationCount(declaration.value),
2892
+ );
2893
+ break;
2894
+ }
2895
+ case "animation-name": {
2896
+ builder.addDescriptor(
2897
+ declaration.property,
2898
+ declaration.value.map((v) =>
2899
+ v.type === "none"
2900
+ ? "none"
2901
+ : ([{}, "animationName", [v.value], 1] as StyleDescriptor),
2902
+ ),
2903
+ );
2904
+ break;
2905
+ }
2906
+ case "animation-play-state": {
2907
+ builder.addDescriptor(declaration.property, declaration.value);
2908
+ break;
2909
+ }
2910
+ case "animation-timing-function": {
2911
+ builder.addDescriptor(
2912
+ declaration.property,
2913
+ parseEasingFunction(declaration.value),
2914
+ );
2915
+ break;
2916
+ }
2917
+ }
2918
+ }
2919
+
2920
+ export function kebabCase(str: string) {
2921
+ return str.replace(
2922
+ /[A-Z]+(?![a-z])|[A-Z]/g,
2923
+ ($, ofs) => (ofs ? "-" : "") + $.toLowerCase(),
2924
+ );
2925
+ }
2926
+
2927
+ function parseBackgroundImage(
2928
+ declaration: DeclarationType<"background-image">,
2929
+ builder: StylesheetBuilder,
2930
+ ) {
2931
+ builder.addDescriptor(
2932
+ "experimental_backgroundImage",
2933
+ declaration.value.flatMap((image): StyleDescriptor[] => {
2934
+ switch (image.type) {
2935
+ case "gradient": {
2936
+ const gradient = parseGradient(image.value, builder);
2937
+ return gradient ? [gradient] : [];
2938
+ }
2939
+ case "none":
2940
+ return ["none"];
2941
+ }
2942
+
2943
+ return [];
2944
+ }),
2945
+ );
2946
+ return;
2947
+ }
2948
+
2949
+ function parseGradient(
2950
+ gradient: Gradient,
2951
+ builder: StylesheetBuilder,
2952
+ ): StyleDescriptor {
2953
+ switch (gradient.type) {
2954
+ case "linear": {
2955
+ return [
2956
+ {},
2957
+ "linear-gradient",
2958
+ [
2959
+ parseLineDirection(gradient.direction, builder),
2960
+ ...gradient.items.map((item) => parseGradientItem(item, builder)),
2961
+ ],
2962
+ ];
2963
+ }
2964
+ }
2965
+
2966
+ return;
2967
+ }
2968
+
2969
+ function parseLineDirection(
2970
+ lineDirection: LineDirection,
2971
+ builder: StylesheetBuilder,
2972
+ ): StyleDescriptor {
2973
+ switch (lineDirection.type) {
2974
+ case "corner":
2975
+ return `to ${lineDirection.horizontal} ${lineDirection.vertical}`;
2976
+ case "horizontal":
2977
+ case "vertical":
2978
+ return `to ${lineDirection.value}`;
2979
+ case "angle":
2980
+ return parseAngle(lineDirection.value, builder);
2981
+ default: {
2982
+ lineDirection satisfies never;
2983
+ }
2984
+ }
2985
+
2986
+ return;
2987
+ }
2988
+
2989
+ function parseGradientItem(
2990
+ item: GradientItemFor_DimensionPercentageFor_LengthValue,
2991
+ builder: StylesheetBuilder,
2992
+ ): StyleDescriptor {
2993
+ switch (item.type) {
2994
+ case "color-stop": {
2995
+ const args: StyleDescriptor[] = [parseColor(item.color, builder)];
2996
+ if (item.position) {
2997
+ args.push(parseLength(item.position, builder));
2998
+ }
2999
+
3000
+ return [{}, "@colorStop", args, 1];
3001
+ }
3002
+ case "hint":
3003
+ return parseLength(item.value, builder);
3004
+ }
3005
+ }
3006
+
3007
+ function parseObjectFit(
3008
+ declaration: CustomProperty,
3009
+ builder: StylesheetBuilder,
3010
+ ) {
3011
+ builder.addMapping({
3012
+ "object-fit": "contentFit",
3013
+ });
3014
+ builder.addDescriptor(
3015
+ "object-fit",
3016
+ parseUnparsed(declaration.value, builder, "object-fit"),
3017
+ );
3018
+ }
3019
+
3020
+ function parseObjectPosition(
3021
+ declaration: CustomProperty,
3022
+ builder: StylesheetBuilder,
3023
+ ) {
3024
+ builder.addMapping({
3025
+ "object-position": "contentPosition",
3026
+ });
3027
+ builder.addDescriptor("object-position", [
3028
+ {},
3029
+ "join",
3030
+ [parseUnparsed(declaration.value, builder, "object-position"), " "],
3031
+ ]);
3032
+ }
3033
+
3034
+ function parseVisibility(
3035
+ declaration: DeclarationType<"visibility">,
3036
+ builder: StylesheetBuilder,
3037
+ ) {
3038
+ if (declaration.value === "visible") {
3039
+ builder.addDescriptor("opacity", 1);
3040
+ } else if (declaration.value === "hidden") {
3041
+ builder.addDescriptor("opacity", 0);
3042
+ } else {
3043
+ builder.addWarning("value", declaration.value);
3044
+ }
3045
+ }
3046
+
3047
+ function parseFilter(
3048
+ declaration: DeclarationType<"filter">,
3049
+ builder: StylesheetBuilder,
3050
+ ) {
3051
+ if (declaration.value.type === "none") {
3052
+ return "unset";
3053
+ }
3054
+
3055
+ return declaration.value.value
3056
+ .map((value) => {
3057
+ switch (value.type) {
3058
+ case "opacity":
3059
+ case "blur":
3060
+ case "brightness":
3061
+ case "contrast":
3062
+ case "grayscale":
3063
+ case "invert":
3064
+ case "saturate":
3065
+ case "sepia":
3066
+ return {
3067
+ [value.type]: parseLength(value.value, builder),
3068
+ } as unknown as StyleDescriptor;
3069
+ case "hue-rotate":
3070
+ return {
3071
+ [value.type]: parseAngle(value.value, builder),
3072
+ } as unknown as StyleDescriptor;
3073
+ case "drop-shadow":
3074
+ return [
3075
+ {},
3076
+ toRNProperty(value.type),
3077
+ [
3078
+ parseLength(value.value.xOffset, builder),
3079
+ parseLength(value.value.yOffset, builder),
3080
+ parseLength(value.value.blur, builder),
3081
+ parseColor(value.value.color, builder),
3082
+ ],
3083
+ ] as unknown as StyleDescriptor;
3084
+ case "url":
3085
+ return;
3086
+ }
3087
+ })
3088
+ .filter((value) => value !== undefined);
3089
+ }
3090
+
3091
+ const namedColors = new Set([
3092
+ "aliceblue",
3093
+ "antiquewhite",
3094
+ "aqua",
3095
+ "aquamarine",
3096
+ "azure",
3097
+ "beige",
3098
+ "bisque",
3099
+ "black",
3100
+ "blanchedalmond",
3101
+ "blue",
3102
+ "blueviolet",
3103
+ "brown",
3104
+ "burlywood",
3105
+ "cadetblue",
3106
+ "chartreuse",
3107
+ "chocolate",
3108
+ "coral",
3109
+ "cornflowerblue",
3110
+ "cornsilk",
3111
+ "crimson",
3112
+ "cyan",
3113
+ "darkblue",
3114
+ "darkcyan",
3115
+ "darkgoldenrod",
3116
+ "darkgray",
3117
+ "darkgreen",
3118
+ "darkgrey",
3119
+ "darkkhaki",
3120
+ "darkmagenta",
3121
+ "darkolivegreen",
3122
+ "darkorange",
3123
+ "darkorchid",
3124
+ "darkred",
3125
+ "darksalmon",
3126
+ "darkseagreen",
3127
+ "darkslateblue",
3128
+ "darkslategrey",
3129
+ "darkturquoise",
3130
+ "darkviolet",
3131
+ "deeppink",
3132
+ "deepskyblue",
3133
+ "dimgray",
3134
+ "dimgrey",
3135
+ "dodgerblue",
3136
+ "firebrick",
3137
+ "floralwhite",
3138
+ "forestgreen",
3139
+ "fuchsia",
3140
+ "gainsboro",
3141
+ "ghostwhite",
3142
+ "gold",
3143
+ "goldenrod",
3144
+ "gray",
3145
+ "green",
3146
+ "greenyellow",
3147
+ "grey",
3148
+ "honeydew",
3149
+ "hotpink",
3150
+ "indianred",
3151
+ "indigo",
3152
+ "ivory",
3153
+ "khaki",
3154
+ "lavender",
3155
+ "lavenderblush",
3156
+ "lawngreen",
3157
+ "lemonchiffon",
3158
+ "lightblue",
3159
+ "lightcoral",
3160
+ "lightcyan",
3161
+ "lightgoldenrodyellow",
3162
+ "lightgray",
3163
+ "lightgreen",
3164
+ "lightgrey",
3165
+ "lightpink",
3166
+ "lightsalmon",
3167
+ "lightseagreen",
3168
+ "lightskyblue",
3169
+ "lightslategrey",
3170
+ "lightsteelblue",
3171
+ "lightyellow",
3172
+ "lime",
3173
+ "limegreen",
3174
+ "linen",
3175
+ "magenta",
3176
+ "maroon",
3177
+ "mediumaquamarine",
3178
+ "mediumblue",
3179
+ "mediumorchid",
3180
+ "mediumpurple",
3181
+ "mediumseagreen",
3182
+ "mediumslateblue",
3183
+ "mediumspringgreen",
3184
+ "mediumturquoise",
3185
+ "mediumvioletred",
3186
+ "midnightblue",
3187
+ "mintcream",
3188
+ "mistyrose",
3189
+ "moccasin",
3190
+ "navajowhite",
3191
+ "navy",
3192
+ "oldlace",
3193
+ "olive",
3194
+ "olivedrab",
3195
+ "orange",
3196
+ "orangered",
3197
+ "orchid",
3198
+ "palegoldenrod",
3199
+ "palegreen",
3200
+ "paleturquoise",
3201
+ "palevioletred",
3202
+ "papayawhip",
3203
+ "peachpuff",
3204
+ "peru",
3205
+ "pink",
3206
+ "plum",
3207
+ "powderblue",
3208
+ "purple",
3209
+ "rebeccapurple",
3210
+ "red",
3211
+ "rosybrown",
3212
+ "royalblue",
3213
+ "saddlebrown",
3214
+ "salmon",
3215
+ "sandybrown",
3216
+ "seagreen",
3217
+ "seashell",
3218
+ "sienna",
3219
+ "silver",
3220
+ "skyblue",
3221
+ "slateblue",
3222
+ "slategray",
3223
+ "snow",
3224
+ "springgreen",
3225
+ "steelblue",
3226
+ "tan",
3227
+ "teal",
3228
+ "thistle",
3229
+ "tomato",
3230
+ "turquoise",
3231
+ "violet",
3232
+ "wheat",
3233
+ "white",
3234
+ "whitesmoke",
3235
+ "yellow",
3236
+ "yellowgreen",
3237
+ ]);