react-native-css 2.1.2 → 3.0.0-nightly.4723140

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