react-native-css 2.1.1 → 3.0.0-nightly.27bd5e2

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