react-native-css 3.0.0-nightly.4af17f5 → 3.0.0-nightly.67b5d08

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 (396) hide show
  1. package/dist/commonjs/compiler/atRules.js +10 -1
  2. package/dist/commonjs/compiler/atRules.js.map +1 -1
  3. package/dist/commonjs/compiler/compiler.js +9 -2
  4. package/dist/commonjs/compiler/compiler.js.map +1 -1
  5. package/dist/commonjs/compiler/declarations.js +55 -80
  6. package/dist/commonjs/compiler/declarations.js.map +1 -1
  7. package/dist/commonjs/compiler/inheritance.test.js +10 -10
  8. package/dist/commonjs/compiler/inheritance.test.js.map +1 -1
  9. package/dist/commonjs/compiler/keyframes.js +1 -1
  10. package/dist/commonjs/compiler/keyframes.js.map +1 -1
  11. package/dist/commonjs/compiler/pseudo-elements.js +49 -0
  12. package/dist/commonjs/compiler/pseudo-elements.js.map +1 -0
  13. package/dist/commonjs/compiler/selector-builder.js +124 -80
  14. package/dist/commonjs/compiler/selector-builder.js.map +1 -1
  15. package/dist/commonjs/compiler/stylesheet.js +25 -8
  16. package/dist/commonjs/compiler/stylesheet.js.map +1 -1
  17. package/dist/commonjs/compiler/supports.js +27 -0
  18. package/dist/commonjs/compiler/supports.js.map +1 -0
  19. package/dist/commonjs/components/ActivityIndicator.js +22 -0
  20. package/dist/commonjs/components/ActivityIndicator.js.map +1 -0
  21. package/dist/commonjs/components/Button.js +22 -0
  22. package/dist/commonjs/components/Button.js.map +1 -0
  23. package/dist/commonjs/components/FlatList.js +19 -0
  24. package/dist/commonjs/components/FlatList.js.map +1 -0
  25. package/dist/commonjs/components/Image.js +17 -0
  26. package/dist/commonjs/components/Image.js.map +1 -0
  27. package/dist/commonjs/components/Switch.js +17 -0
  28. package/dist/commonjs/components/Switch.js.map +1 -0
  29. package/dist/commonjs/components/TextInput.js +17 -0
  30. package/dist/commonjs/components/TextInput.js.map +1 -0
  31. package/dist/commonjs/components/index.js +48 -0
  32. package/dist/commonjs/components/index.js.map +1 -1
  33. package/dist/commonjs/jest/index.js +21 -14
  34. package/dist/commonjs/jest/index.js.map +1 -1
  35. package/dist/commonjs/runtime/native/conditions/index.js +4 -2
  36. package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
  37. package/dist/commonjs/runtime/native/conditions/media-query.js +16 -11
  38. package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
  39. package/dist/commonjs/runtime/native/injection.js +19 -18
  40. package/dist/commonjs/runtime/native/injection.js.map +1 -1
  41. package/dist/commonjs/runtime/native/react/rules.js +19 -17
  42. package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
  43. package/dist/commonjs/runtime/native/react/useNativeCss.js +2 -2
  44. package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -1
  45. package/dist/commonjs/runtime/native/reanimated.js +17 -0
  46. package/dist/commonjs/runtime/native/reanimated.js.map +1 -0
  47. package/dist/commonjs/runtime/native/styles/calculate-props.js +29 -9
  48. package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -1
  49. package/dist/commonjs/runtime/native/styles/defaults.js +1 -1
  50. package/dist/commonjs/runtime/native/styles/defaults.js.map +1 -1
  51. package/dist/commonjs/runtime/native/styles/functions/animation-timing.js +34 -0
  52. package/dist/commonjs/runtime/native/styles/functions/animation-timing.js.map +1 -0
  53. package/dist/commonjs/runtime/native/styles/functions/calc.js +125 -0
  54. package/dist/commonjs/runtime/native/styles/functions/calc.js.map +1 -0
  55. package/dist/commonjs/runtime/native/styles/{filters.js → functions/filters.js} +3 -3
  56. package/dist/commonjs/runtime/native/styles/functions/filters.js.map +1 -0
  57. package/dist/commonjs/runtime/native/styles/functions/index.js +61 -0
  58. package/dist/commonjs/runtime/native/styles/functions/index.js.map +1 -0
  59. package/dist/commonjs/runtime/native/styles/{platform-functions.js → functions/platform-functions.js} +3 -3
  60. package/dist/commonjs/runtime/native/styles/functions/platform-functions.js.map +1 -0
  61. package/dist/commonjs/runtime/native/styles/functions/transform-functions.js +121 -0
  62. package/dist/commonjs/runtime/native/styles/functions/transform-functions.js.map +1 -0
  63. package/dist/commonjs/runtime/native/styles/resolve.js +21 -44
  64. package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -1
  65. package/dist/commonjs/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
  66. package/dist/commonjs/runtime/native/styles/shorthands/_handler.js.map +1 -0
  67. package/dist/commonjs/runtime/native/styles/{animation.js → shorthands/animation.js} +5 -36
  68. package/dist/commonjs/runtime/native/styles/shorthands/animation.js.map +1 -0
  69. package/dist/commonjs/runtime/native/styles/{border.js → shorthands/border.js} +2 -2
  70. package/dist/commonjs/runtime/native/styles/shorthands/border.js.map +1 -0
  71. package/dist/commonjs/runtime/native/styles/{box-shadow.js → shorthands/box-shadow.js} +3 -3
  72. package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
  73. package/dist/commonjs/runtime/native/styles/shorthands/index.js +61 -0
  74. package/dist/commonjs/runtime/native/styles/shorthands/index.js.map +1 -0
  75. package/dist/commonjs/runtime/native/styles/{text-shadow.js → shorthands/text-shadow.js} +2 -2
  76. package/dist/commonjs/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
  77. package/dist/commonjs/runtime/native/styles/{transform.js → shorthands/transform.js} +1 -1
  78. package/dist/commonjs/runtime/native/styles/shorthands/transform.js.map +1 -0
  79. package/dist/commonjs/runtime/native/styles/units.js +1 -1
  80. package/dist/commonjs/runtime/native/styles/units.js.map +1 -1
  81. package/dist/commonjs/runtime/utils/objects.js +14 -6
  82. package/dist/commonjs/runtime/utils/objects.js.map +1 -1
  83. package/dist/module/compiler/atRules.js +10 -1
  84. package/dist/module/compiler/atRules.js.map +1 -1
  85. package/dist/module/compiler/compiler.js +9 -2
  86. package/dist/module/compiler/compiler.js.map +1 -1
  87. package/dist/module/compiler/compiler.types.js.map +1 -1
  88. package/dist/module/compiler/declarations.js +55 -80
  89. package/dist/module/compiler/declarations.js.map +1 -1
  90. package/dist/module/compiler/inheritance.test.js +10 -10
  91. package/dist/module/compiler/inheritance.test.js.map +1 -1
  92. package/dist/module/compiler/keyframes.js +1 -1
  93. package/dist/module/compiler/keyframes.js.map +1 -1
  94. package/dist/module/compiler/pseudo-elements.js +44 -0
  95. package/dist/module/compiler/pseudo-elements.js.map +1 -0
  96. package/dist/module/compiler/selector-builder.js +124 -80
  97. package/dist/module/compiler/selector-builder.js.map +1 -1
  98. package/dist/module/compiler/stylesheet.js +25 -8
  99. package/dist/module/compiler/stylesheet.js.map +1 -1
  100. package/dist/module/compiler/supports.js +23 -0
  101. package/dist/module/compiler/supports.js.map +1 -0
  102. package/dist/module/components/ActivityIndicator.js +17 -0
  103. package/dist/module/components/ActivityIndicator.js.map +1 -0
  104. package/dist/module/components/Button.js +17 -0
  105. package/dist/module/components/Button.js.map +1 -0
  106. package/dist/module/components/FlatList.js +14 -0
  107. package/dist/module/components/FlatList.js.map +1 -0
  108. package/dist/module/components/Image.js +12 -0
  109. package/dist/module/components/Image.js.map +1 -0
  110. package/dist/module/components/Switch.js +12 -0
  111. package/dist/module/components/Switch.js.map +1 -0
  112. package/dist/module/components/TextInput.js +12 -0
  113. package/dist/module/components/TextInput.js.map +1 -0
  114. package/dist/module/components/index.js +6 -0
  115. package/dist/module/components/index.js.map +1 -1
  116. package/dist/module/jest/index.js +20 -14
  117. package/dist/module/jest/index.js.map +1 -1
  118. package/dist/module/runtime/native/conditions/index.js +4 -2
  119. package/dist/module/runtime/native/conditions/index.js.map +1 -1
  120. package/dist/module/runtime/native/conditions/media-query.js +17 -12
  121. package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
  122. package/dist/module/runtime/native/injection.js +19 -18
  123. package/dist/module/runtime/native/injection.js.map +1 -1
  124. package/dist/module/runtime/native/react/rules.js +19 -17
  125. package/dist/module/runtime/native/react/rules.js.map +1 -1
  126. package/dist/module/runtime/native/react/useNativeCss.js +1 -1
  127. package/dist/module/runtime/native/react/useNativeCss.js.map +1 -1
  128. package/dist/module/runtime/native/reanimated.js +13 -0
  129. package/dist/module/runtime/native/reanimated.js.map +1 -0
  130. package/dist/module/runtime/native/styles/calculate-props.js +30 -10
  131. package/dist/module/runtime/native/styles/calculate-props.js.map +1 -1
  132. package/dist/module/runtime/native/styles/defaults.js +1 -1
  133. package/dist/module/runtime/native/styles/defaults.js.map +1 -1
  134. package/dist/module/runtime/native/styles/functions/animation-timing.js +30 -0
  135. package/dist/module/runtime/native/styles/functions/animation-timing.js.map +1 -0
  136. package/dist/module/runtime/native/styles/functions/calc.js +120 -0
  137. package/dist/module/runtime/native/styles/functions/calc.js.map +1 -0
  138. package/dist/module/runtime/native/styles/{filters.js → functions/filters.js} +2 -2
  139. package/dist/module/runtime/native/styles/functions/filters.js.map +1 -0
  140. package/dist/module/runtime/native/styles/functions/index.js +8 -0
  141. package/dist/module/runtime/native/styles/functions/index.js.map +1 -0
  142. package/dist/module/runtime/native/styles/{platform-functions.js → functions/platform-functions.js} +1 -1
  143. package/dist/module/runtime/native/styles/functions/platform-functions.js.map +1 -0
  144. package/dist/module/runtime/native/styles/functions/transform-functions.js +114 -0
  145. package/dist/module/runtime/native/styles/functions/transform-functions.js.map +1 -0
  146. package/dist/module/runtime/native/styles/resolve.js +20 -44
  147. package/dist/module/runtime/native/styles/resolve.js.map +1 -1
  148. package/dist/module/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
  149. package/dist/module/runtime/native/styles/shorthands/_handler.js.map +1 -0
  150. package/dist/module/runtime/native/styles/{animation.js → shorthands/animation.js} +3 -34
  151. package/dist/module/runtime/native/styles/shorthands/animation.js.map +1 -0
  152. package/dist/module/runtime/native/styles/{border.js → shorthands/border.js} +1 -1
  153. package/dist/module/runtime/native/styles/shorthands/border.js.map +1 -0
  154. package/dist/module/runtime/native/styles/{box-shadow.js → shorthands/box-shadow.js} +2 -2
  155. package/dist/module/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
  156. package/dist/module/runtime/native/styles/shorthands/index.js +8 -0
  157. package/dist/module/runtime/native/styles/shorthands/index.js.map +1 -0
  158. package/dist/module/runtime/native/styles/{text-shadow.js → shorthands/text-shadow.js} +1 -1
  159. package/dist/module/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
  160. package/dist/module/runtime/native/styles/{transform.js → shorthands/transform.js} +1 -1
  161. package/dist/module/runtime/native/styles/shorthands/transform.js.map +1 -0
  162. package/dist/module/runtime/native/styles/units.js +1 -1
  163. package/dist/module/runtime/native/styles/units.js.map +1 -1
  164. package/dist/module/runtime/utils/objects.js +14 -6
  165. package/dist/module/runtime/utils/objects.js.map +1 -1
  166. package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -1
  167. package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
  168. package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +2 -4
  169. package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
  170. package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
  171. package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts +4 -0
  172. package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts.map +1 -0
  173. package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts +1 -0
  174. package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -1
  175. package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
  176. package/dist/typescript/commonjs/src/compiler/supports.d.ts +3 -0
  177. package/dist/typescript/commonjs/src/compiler/supports.d.ts.map +1 -0
  178. package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +13 -0
  179. package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +1 -0
  180. package/dist/typescript/commonjs/src/components/Button.d.ts +13 -0
  181. package/dist/typescript/commonjs/src/components/Button.d.ts.map +1 -0
  182. package/dist/typescript/commonjs/src/components/FlatList.d.ts +10 -0
  183. package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -0
  184. package/dist/typescript/commonjs/src/components/Image.d.ts +8 -0
  185. package/dist/typescript/commonjs/src/components/Image.d.ts.map +1 -0
  186. package/dist/typescript/commonjs/src/components/Switch.d.ts +8 -0
  187. package/dist/typescript/commonjs/src/components/Switch.d.ts.map +1 -0
  188. package/dist/typescript/commonjs/src/components/TextInput.d.ts +8 -0
  189. package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +1 -0
  190. package/dist/typescript/commonjs/src/components/index.d.ts +6 -0
  191. package/dist/typescript/commonjs/src/components/index.d.ts.map +1 -1
  192. package/dist/typescript/commonjs/src/jest/index.d.ts +11 -1
  193. package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
  194. package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +1 -1
  195. package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +2 -2
  196. package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts.map +1 -1
  197. package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
  198. package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts +5 -0
  199. package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts.map +1 -0
  200. package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts +1 -1
  201. package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
  202. package/dist/typescript/commonjs/src/runtime/native/styles/defaults.d.ts.map +1 -1
  203. package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
  204. package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
  205. package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts +3 -0
  206. package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
  207. package/dist/typescript/commonjs/src/runtime/native/styles/{filters.d.ts → functions/filters.d.ts} +1 -1
  208. package/dist/typescript/commonjs/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
  209. package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts +6 -0
  210. package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts.map +1 -0
  211. package/dist/typescript/commonjs/src/runtime/native/styles/{platform-functions.d.ts → functions/platform-functions.d.ts} +2 -2
  212. package/dist/typescript/commonjs/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
  213. package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
  214. package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
  215. package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts.map +1 -1
  216. package/dist/typescript/commonjs/src/runtime/native/styles/{shorthand.d.ts → shorthands/_handler.d.ts} +2 -2
  217. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
  218. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
  219. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
  220. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts +2 -0
  221. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
  222. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
  223. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
  224. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts +6 -0
  225. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
  226. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
  227. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
  228. package/dist/typescript/commonjs/src/runtime/native/styles/{transform.d.ts → shorthands/transform.d.ts} +1 -1
  229. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
  230. package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -1
  231. package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -1
  232. package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
  233. package/dist/typescript/module/src/compiler/compiler.types.d.ts +2 -4
  234. package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
  235. package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
  236. package/dist/typescript/module/src/compiler/pseudo-elements.d.ts +4 -0
  237. package/dist/typescript/module/src/compiler/pseudo-elements.d.ts.map +1 -0
  238. package/dist/typescript/module/src/compiler/selector-builder.d.ts +1 -0
  239. package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -1
  240. package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
  241. package/dist/typescript/module/src/compiler/supports.d.ts +3 -0
  242. package/dist/typescript/module/src/compiler/supports.d.ts.map +1 -0
  243. package/dist/typescript/module/src/components/ActivityIndicator.d.ts +13 -0
  244. package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +1 -0
  245. package/dist/typescript/module/src/components/Button.d.ts +13 -0
  246. package/dist/typescript/module/src/components/Button.d.ts.map +1 -0
  247. package/dist/typescript/module/src/components/FlatList.d.ts +10 -0
  248. package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -0
  249. package/dist/typescript/module/src/components/Image.d.ts +8 -0
  250. package/dist/typescript/module/src/components/Image.d.ts.map +1 -0
  251. package/dist/typescript/module/src/components/Switch.d.ts +8 -0
  252. package/dist/typescript/module/src/components/Switch.d.ts.map +1 -0
  253. package/dist/typescript/module/src/components/TextInput.d.ts +8 -0
  254. package/dist/typescript/module/src/components/TextInput.d.ts.map +1 -0
  255. package/dist/typescript/module/src/components/index.d.ts +6 -0
  256. package/dist/typescript/module/src/components/index.d.ts.map +1 -1
  257. package/dist/typescript/module/src/jest/index.d.ts +11 -1
  258. package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
  259. package/dist/typescript/module/src/runtime/native/injection.d.ts.map +1 -1
  260. package/dist/typescript/module/src/runtime/native/react/rules.d.ts +2 -2
  261. package/dist/typescript/module/src/runtime/native/react/rules.d.ts.map +1 -1
  262. package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
  263. package/dist/typescript/module/src/runtime/native/reanimated.d.ts +5 -0
  264. package/dist/typescript/module/src/runtime/native/reanimated.d.ts.map +1 -0
  265. package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts +1 -1
  266. package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
  267. package/dist/typescript/module/src/runtime/native/styles/defaults.d.ts.map +1 -1
  268. package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
  269. package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
  270. package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts +3 -0
  271. package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
  272. package/dist/typescript/module/src/runtime/native/styles/{filters.d.ts → functions/filters.d.ts} +1 -1
  273. package/dist/typescript/module/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
  274. package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts +6 -0
  275. package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts.map +1 -0
  276. package/dist/typescript/module/src/runtime/native/styles/{platform-functions.d.ts → functions/platform-functions.d.ts} +2 -2
  277. package/dist/typescript/module/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
  278. package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
  279. package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
  280. package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts.map +1 -1
  281. package/dist/typescript/module/src/runtime/native/styles/{shorthand.d.ts → shorthands/_handler.d.ts} +2 -2
  282. package/dist/typescript/module/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
  283. package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
  284. package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
  285. package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts +2 -0
  286. package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
  287. package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
  288. package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
  289. package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts +6 -0
  290. package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
  291. package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
  292. package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
  293. package/dist/typescript/module/src/runtime/native/styles/{transform.d.ts → shorthands/transform.d.ts} +1 -1
  294. package/dist/typescript/module/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
  295. package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -1
  296. package/package.json +3 -1
  297. package/src/compiler/atRules.ts +10 -1
  298. package/src/compiler/compiler.ts +9 -2
  299. package/src/compiler/compiler.types.ts +2 -4
  300. package/src/compiler/declarations.ts +101 -119
  301. package/src/compiler/inheritance.test.ts +9 -9
  302. package/src/compiler/keyframes.ts +1 -1
  303. package/src/compiler/pseudo-elements.ts +54 -0
  304. package/src/compiler/selector-builder.ts +136 -81
  305. package/src/compiler/stylesheet.ts +33 -10
  306. package/src/compiler/supports.ts +26 -0
  307. package/src/components/ActivityIndicator.tsx +27 -0
  308. package/src/components/Button.tsx +22 -0
  309. package/src/components/FlatList.tsx +21 -0
  310. package/src/components/Image.tsx +17 -0
  311. package/src/components/Switch.tsx +17 -0
  312. package/src/components/TextInput.tsx +17 -0
  313. package/src/components/index.tsx +6 -0
  314. package/src/jest/index.ts +22 -13
  315. package/src/runtime/native/conditions/index.ts +4 -2
  316. package/src/runtime/native/conditions/media-query.ts +18 -12
  317. package/src/runtime/native/injection.ts +31 -30
  318. package/src/runtime/native/react/rules.ts +20 -16
  319. package/src/runtime/native/react/useNativeCss.ts +1 -1
  320. package/src/runtime/native/reanimated.ts +22 -0
  321. package/src/runtime/native/styles/calculate-props.ts +30 -8
  322. package/src/runtime/native/styles/defaults.ts +1 -0
  323. package/src/runtime/native/styles/functions/animation-timing.ts +44 -0
  324. package/src/runtime/native/styles/functions/calc.ts +121 -0
  325. package/src/runtime/native/styles/{filters.ts → functions/filters.ts} +3 -3
  326. package/src/runtime/native/styles/functions/index.ts +5 -0
  327. package/src/runtime/native/styles/{platform-functions.ts → functions/platform-functions.ts} +2 -2
  328. package/src/runtime/native/styles/functions/transform-functions.ts +84 -0
  329. package/src/runtime/native/styles/resolve.ts +20 -63
  330. package/src/runtime/native/styles/{shorthand.ts → shorthands/_handler.ts} +5 -5
  331. package/src/runtime/native/styles/{animation.ts → shorthands/animation.ts} +4 -63
  332. package/src/runtime/native/styles/{border.ts → shorthands/border.ts} +1 -1
  333. package/src/runtime/native/styles/{box-shadow.ts → shorthands/box-shadow.ts} +3 -3
  334. package/src/runtime/native/styles/shorthands/index.ts +5 -0
  335. package/src/runtime/native/styles/{text-shadow.ts → shorthands/text-shadow.ts} +1 -1
  336. package/src/runtime/native/styles/{transform.ts → shorthands/transform.ts} +4 -2
  337. package/src/runtime/native/styles/units.ts +1 -1
  338. package/src/runtime/utils/objects.ts +16 -4
  339. package/dist/commonjs/compiler/attributes.test.js +0 -20
  340. package/dist/commonjs/compiler/attributes.test.js.map +0 -1
  341. package/dist/commonjs/runtime/native/styles/animation.js.map +0 -1
  342. package/dist/commonjs/runtime/native/styles/border.js.map +0 -1
  343. package/dist/commonjs/runtime/native/styles/box-shadow.js.map +0 -1
  344. package/dist/commonjs/runtime/native/styles/calc.js +0 -85
  345. package/dist/commonjs/runtime/native/styles/calc.js.map +0 -1
  346. package/dist/commonjs/runtime/native/styles/filters.js.map +0 -1
  347. package/dist/commonjs/runtime/native/styles/platform-functions.js.map +0 -1
  348. package/dist/commonjs/runtime/native/styles/shorthand.js.map +0 -1
  349. package/dist/commonjs/runtime/native/styles/text-shadow.js.map +0 -1
  350. package/dist/commonjs/runtime/native/styles/transform.js.map +0 -1
  351. package/dist/module/compiler/attributes.test.js +0 -20
  352. package/dist/module/compiler/attributes.test.js.map +0 -1
  353. package/dist/module/runtime/native/styles/animation.js.map +0 -1
  354. package/dist/module/runtime/native/styles/border.js.map +0 -1
  355. package/dist/module/runtime/native/styles/box-shadow.js.map +0 -1
  356. package/dist/module/runtime/native/styles/calc.js +0 -79
  357. package/dist/module/runtime/native/styles/calc.js.map +0 -1
  358. package/dist/module/runtime/native/styles/filters.js.map +0 -1
  359. package/dist/module/runtime/native/styles/platform-functions.js.map +0 -1
  360. package/dist/module/runtime/native/styles/shorthand.js.map +0 -1
  361. package/dist/module/runtime/native/styles/text-shadow.js.map +0 -1
  362. package/dist/module/runtime/native/styles/transform.js.map +0 -1
  363. package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts +0 -2
  364. package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts.map +0 -1
  365. package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts +0 -9
  366. package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts.map +0 -1
  367. package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts +0 -2
  368. package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts.map +0 -1
  369. package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts +0 -3
  370. package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts.map +0 -1
  371. package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts +0 -3
  372. package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts.map +0 -1
  373. package/dist/typescript/commonjs/src/runtime/native/styles/filters.d.ts.map +0 -1
  374. package/dist/typescript/commonjs/src/runtime/native/styles/platform-functions.d.ts.map +0 -1
  375. package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts.map +0 -1
  376. package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts +0 -2
  377. package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts.map +0 -1
  378. package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts.map +0 -1
  379. package/dist/typescript/module/src/compiler/attributes.test.d.ts +0 -2
  380. package/dist/typescript/module/src/compiler/attributes.test.d.ts.map +0 -1
  381. package/dist/typescript/module/src/runtime/native/styles/animation.d.ts +0 -9
  382. package/dist/typescript/module/src/runtime/native/styles/animation.d.ts.map +0 -1
  383. package/dist/typescript/module/src/runtime/native/styles/border.d.ts +0 -2
  384. package/dist/typescript/module/src/runtime/native/styles/border.d.ts.map +0 -1
  385. package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts +0 -3
  386. package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts.map +0 -1
  387. package/dist/typescript/module/src/runtime/native/styles/calc.d.ts +0 -3
  388. package/dist/typescript/module/src/runtime/native/styles/calc.d.ts.map +0 -1
  389. package/dist/typescript/module/src/runtime/native/styles/filters.d.ts.map +0 -1
  390. package/dist/typescript/module/src/runtime/native/styles/platform-functions.d.ts.map +0 -1
  391. package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts.map +0 -1
  392. package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts +0 -2
  393. package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts.map +0 -1
  394. package/dist/typescript/module/src/runtime/native/styles/transform.d.ts.map +0 -1
  395. package/src/compiler/attributes.test.ts +0 -28
  396. package/src/runtime/native/styles/calc.ts +0 -97
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
- import { PixelRatio, Platform } from "react-native";
2
+ import { I18nManager, PixelRatio, Platform } from "react-native";
3
3
 
4
4
  import type { MediaCondition } from "../../../compiler";
5
5
  import { colorScheme, vh, vw, type Getter } from "../reactivity";
@@ -34,33 +34,39 @@ function test(mediaQuery: MediaCondition, get: Getter): Boolean {
34
34
  }
35
35
 
36
36
  function testComparison(mediaQuery: MediaCondition, get: Getter): Boolean {
37
- let left: number | undefined;
38
- const right = mediaQuery[2];
37
+ const value = mediaQuery[2];
39
38
 
40
39
  switch (mediaQuery[1]) {
40
+ case "dir":
41
+ return (I18nManager.isRTL && value === "rtl") || value === "ltr";
42
+ case "hover":
43
+ return true;
41
44
  case "platform":
42
- return right === "native" || right === Platform.OS;
45
+ return value === "native" || value === Platform.OS;
43
46
  case "prefers-color-scheme": {
44
- return right === get(colorScheme);
47
+ return value === get(colorScheme);
45
48
  }
46
49
  case "display-mode":
47
- return right === "native" || Platform.OS === right;
50
+ return value === "native" || Platform.OS === value;
48
51
  case "min-width":
49
- return typeof right === "number" && get(vw) >= right;
52
+ return typeof value === "number" && get(vw) >= value;
50
53
  case "max-width":
51
- return typeof right === "number" && get(vw) <= right;
54
+ return typeof value === "number" && get(vw) <= value;
52
55
  case "min-height":
53
- return typeof right === "number" && get(vh) >= right;
56
+ return typeof value === "number" && get(vh) >= value;
54
57
  case "max-height":
55
- return typeof right === "number" && get(vh) <= right;
58
+ return typeof value === "number" && get(vh) <= value;
56
59
  case "orientation":
57
- return right === "landscape" ? get(vh) < get(vw) : get(vh) >= get(vw);
60
+ return value === "landscape" ? get(vh) < get(vw) : get(vh) >= get(vw);
58
61
  }
59
62
 
60
- if (typeof right !== "number") {
63
+ if (typeof value !== "number") {
61
64
  return false;
62
65
  }
63
66
 
67
+ let left: number | undefined;
68
+ const right = value;
69
+
64
70
  switch (mediaQuery[1]) {
65
71
  case "width":
66
72
  left = get(vw);
@@ -3,6 +3,7 @@ import type {
3
3
  ReactNativeCssStyleSheet,
4
4
  StyleRuleSet,
5
5
  } from "../../compiler";
6
+ import { DEFAULT_CONTAINER_NAME } from "./conditions/container-query";
6
7
  import {
7
8
  family,
8
9
  observable,
@@ -27,6 +28,36 @@ StyleCollection.keyframes = family<string, Observable<Animation_V2[1]>>(() => {
27
28
  StyleCollection.inject = function (options: ReactNativeCssStyleSheet) {
28
29
  observableBatch.current = new Set();
29
30
 
31
+ StyleCollection.styles("will-change-variable").set([
32
+ {
33
+ s: [0],
34
+ v: [],
35
+ },
36
+ ]);
37
+
38
+ StyleCollection.styles("will-change-container").set([
39
+ {
40
+ s: [0],
41
+ c: [DEFAULT_CONTAINER_NAME],
42
+ },
43
+ ]);
44
+
45
+ StyleCollection.styles("will-change-animation").set([
46
+ {
47
+ s: [0],
48
+ a: true,
49
+ },
50
+ ]);
51
+
52
+ StyleCollection.styles("will-change-pressable").set([
53
+ {
54
+ s: [0],
55
+ p: {
56
+ h: 1,
57
+ },
58
+ },
59
+ ]);
60
+
30
61
  if (options.s) {
31
62
  for (const style of options.s) {
32
63
  StyleCollection.styles(style[0]).set(style[1]);
@@ -99,33 +130,3 @@ function isDeepEqual(a: unknown, b: unknown): boolean {
99
130
 
100
131
  return true;
101
132
  }
102
-
103
- StyleCollection.styles("will-change-variable").set([
104
- {
105
- s: [0],
106
- v: [],
107
- },
108
- ]);
109
-
110
- StyleCollection.styles("will-change-container").set([
111
- {
112
- s: [0],
113
- c: [],
114
- },
115
- ]);
116
-
117
- StyleCollection.styles("will-change-animation").set([
118
- {
119
- s: [0],
120
- a: true,
121
- },
122
- ]);
123
-
124
- StyleCollection.styles("will-change-pressable").set([
125
- {
126
- s: [0],
127
- p: {
128
- h: 1,
129
- },
130
- },
131
- ]);
@@ -12,6 +12,7 @@ import {
12
12
  hoverFamily,
13
13
  VAR_SYMBOL,
14
14
  weakFamily,
15
+ type ContainerContextValue,
15
16
  type VariableContextValue,
16
17
  } from "../reactivity";
17
18
  import { stylesFamily } from "../styles";
@@ -36,11 +37,12 @@ export function updateRules(
36
37
 
37
38
  let usesVariables = false;
38
39
 
39
- let variables = state.variables ? inheritedVariables : undefined;
40
- let containers = state.containers ? inheritedContainers : undefined;
40
+ let variables: VariableContextValue | undefined;
41
+ let containers: ContainerContextValue | undefined;
41
42
  const inlineVariables = new Set<InlineVariable>();
42
43
 
43
44
  let animated = false;
45
+ let pressable = false;
44
46
 
45
47
  for (const config of state.configs) {
46
48
  const source = currentProps?.[config.source];
@@ -93,13 +95,20 @@ export function updateRules(
93
95
  }
94
96
 
95
97
  for (let rule of styleRuleSet) {
96
- // Even if a rule does not match, make sure we register that it could set
97
- // a variable or container or be animated.
98
- if (rule.v) usesVariables = true;
99
- if (rule.c) containers ??= inheritedContainers;
98
+ usesVariables ||= Boolean(rule.dv);
99
+
100
+ // We do this even if the rule doesn't match so we can maintain a consistent render tree
101
+ // We we need to inject React context
100
102
  if (rule.a) animated = true;
101
103
 
102
- usesVariables ||= Boolean(rule.dv);
104
+ if (rule.v) {
105
+ variables ??= inheritedVariables;
106
+ }
107
+
108
+ if (rule.c) {
109
+ containers ??= inheritedContainers;
110
+ activeFamily(state.ruleEffectGetter);
111
+ }
103
112
 
104
113
  if (
105
114
  !testRule(
@@ -114,11 +123,8 @@ export function updateRules(
114
123
  }
115
124
 
116
125
  if (rule.v) {
117
- // We're going to set a value, so we need to create a new object
118
126
  if (variables === inheritedVariables) {
119
127
  variables = { ...inheritedVariables };
120
- } else {
121
- variables ??= { ...inheritedVariables };
122
128
  }
123
129
 
124
130
  for (const v of rule.v) {
@@ -163,7 +169,7 @@ export function updateRules(
163
169
 
164
170
  if (process.env.NODE_ENV !== "production") {
165
171
  if (isRerender) {
166
- let pressable = activeFamily.has(state.ruleEffectGetter);
172
+ const pressable = activeFamily.has(state.ruleEffectGetter);
167
173
 
168
174
  if (Boolean(variables) !== Boolean(state.variables)) {
169
175
  console.log(
@@ -186,11 +192,7 @@ export function updateRules(
186
192
  }
187
193
  }
188
194
 
189
- // We only track this in development
190
- let pressable =
191
- process.env.NODE_ENV === "production"
192
- ? undefined
193
- : activeFamily.has(state.ruleEffectGetter);
195
+ pressable = activeFamily.has(state.ruleEffectGetter);
194
196
 
195
197
  if (!rules.size && !state.stylesObs && !inlineVariables.size) {
196
198
  return {
@@ -199,6 +201,8 @@ export function updateRules(
199
201
  guards,
200
202
  animated,
201
203
  pressable,
204
+ variables,
205
+ containers,
202
206
  };
203
207
  }
204
208
 
@@ -20,8 +20,8 @@ import {
20
20
  type Getter,
21
21
  type VariableContextValue,
22
22
  } from "../reactivity";
23
+ import { animatedComponentFamily } from "../reanimated";
23
24
  import { getStyledProps, stylesFamily } from "../styles";
24
- import { animatedComponentFamily } from "../styles/animation";
25
25
  import { updateRules } from "./rules";
26
26
 
27
27
  export type Config = {
@@ -0,0 +1,22 @@
1
+ import type { ComponentType } from "react";
2
+
3
+ import { weakFamily } from "./reactivity";
4
+
5
+ export const animatedComponentFamily = weakFamily(
6
+ (component: ComponentType) => {
7
+ if (
8
+ "displayName" in component &&
9
+ component.displayName?.startsWith("Animated.")
10
+ ) {
11
+ return component;
12
+ }
13
+
14
+ const createAnimatedComponent =
15
+ // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-member-access
16
+ require("react-native-reanimated").createAnimatedComponent as (
17
+ component: ComponentType,
18
+ ) => ComponentType;
19
+
20
+ return createAnimatedComponent(component);
21
+ },
22
+ );
@@ -4,13 +4,14 @@ import type {
4
4
  StyleDeclaration,
5
5
  StyleRule,
6
6
  } from "../../../compiler";
7
- import { applyValue, Specificity as S } from "../../utils";
7
+ import { applyValue, getDeepPath, Specificity as S } from "../../utils";
8
8
  import type { RenderGuard } from "../conditions/guards";
9
9
  import {
10
10
  VAR_SYMBOL,
11
11
  type Getter,
12
12
  type VariableContextValue,
13
13
  } from "../reactivity";
14
+ import { transformKeys } from "./defaults";
14
15
  import { resolveValue } from "./resolve";
15
16
 
16
17
  export function calculateProps(
@@ -28,6 +29,7 @@ export function calculateProps(
28
29
  let important: Record<string, any> | undefined;
29
30
 
30
31
  const delayedStyles: (() => void)[] = [];
32
+ const transformStyles: (() => void)[] = [];
31
33
 
32
34
  for (const rule of rules) {
33
35
  if (VAR_SYMBOL in rule) {
@@ -67,6 +69,7 @@ export function calculateProps(
67
69
  inlineVariables,
68
70
  inheritedVariables,
69
71
  delayedStyles,
72
+ transformStyles,
70
73
  guards,
71
74
  target,
72
75
  topLevelTarget,
@@ -78,6 +81,10 @@ export function calculateProps(
78
81
  delayedStyle();
79
82
  }
80
83
 
84
+ for (const transformStyle of transformStyles) {
85
+ transformStyle();
86
+ }
87
+
81
88
  return {
82
89
  normal,
83
90
  guards,
@@ -91,6 +98,7 @@ export function applyDeclarations(
91
98
  inlineVariables: InlineVariable,
92
99
  inheritedVariables: VariableContextValue,
93
100
  delayedStyles: (() => void)[] = [],
101
+ transformStyles: (() => void)[] = [],
94
102
  guards: RenderGuard[] = [],
95
103
  target: Record<string, any> = {},
96
104
  topLevelTarget = target,
@@ -136,7 +144,7 @@ export function applyDeclarations(
136
144
 
137
145
  const shouldDelay = declaration[2];
138
146
 
139
- if (shouldDelay) {
147
+ if (shouldDelay || transformKeys.has(prop)) {
140
148
  /**
141
149
  * We need to delay the resolution of this value until after all
142
150
  * styles have been calculated. But another style might override
@@ -147,10 +155,11 @@ export function applyDeclarations(
147
155
  * mutate the props object and not create a new one
148
156
  */
149
157
  const originalValue = value;
150
- value = {};
151
- delayedStyles.push(() => {
152
- if (target[prop] === value) {
153
- delete target[prop];
158
+ // This needs to be a object with the [prop] so we can discover in transform arrays
159
+ value = { [prop]: true };
160
+
161
+ if (transformKeys.has(prop)) {
162
+ transformStyles.push(() => {
154
163
  value = resolveValue(originalValue, get, {
155
164
  inlineVariables,
156
165
  inheritedVariables,
@@ -158,8 +167,21 @@ export function applyDeclarations(
158
167
  calculateProps,
159
168
  });
160
169
  applyValue(target, prop, value);
161
- }
162
- });
170
+ });
171
+ } else {
172
+ delayedStyles.push(() => {
173
+ if (getDeepPath(target, prop) === value) {
174
+ delete target[prop];
175
+ value = resolveValue(originalValue, get, {
176
+ inlineVariables,
177
+ inheritedVariables,
178
+ renderGuards: guards,
179
+ calculateProps,
180
+ });
181
+ applyValue(target, prop, value);
182
+ }
183
+ });
184
+ }
163
185
  } else {
164
186
  value = resolveValue(value, get, {
165
187
  inlineVariables,
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable */
2
2
  export const transformKeys = new Set([
3
+ "translate",
3
4
  "translateX",
4
5
  "translateY",
5
6
  "scale",
@@ -0,0 +1,44 @@
1
+ import type { StyleFunctionResolver } from "../resolve";
2
+
3
+ /* eslint-disable @typescript-eslint/no-require-imports */
4
+ const advancedTimingFunctions: Record<
5
+ string,
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ () => (...args: any[]) => unknown
8
+ > = {
9
+ cubicBezier: () => {
10
+ return (
11
+ require("react-native-reanimated") as typeof import("react-native-reanimated")
12
+ ).cubicBezier;
13
+ },
14
+ steps: () => {
15
+ return (
16
+ require("react-native-reanimated") as typeof import("react-native-reanimated")
17
+ ).steps;
18
+ },
19
+ };
20
+
21
+ const timingFunctionResolver: StyleFunctionResolver = (resolveValue, value) => {
22
+ const name = value[1];
23
+ const resolver = advancedTimingFunctions[name];
24
+
25
+ if (!resolver) {
26
+ return;
27
+ }
28
+
29
+ const args = resolveValue(value[2]);
30
+
31
+ if (!Array.isArray(args)) {
32
+ return;
33
+ }
34
+
35
+ const fn = resolver();
36
+
37
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
38
+ const result = fn(...args);
39
+
40
+ return result;
41
+ };
42
+
43
+ export const cubicBezier = timingFunctionResolver;
44
+ export const steps = timingFunctionResolver;
@@ -0,0 +1,121 @@
1
+ import type { StyleFunctionResolver } from "../resolve";
2
+
3
+ interface Value {
4
+ value: number;
5
+ isPercent: boolean;
6
+ }
7
+
8
+ const precedence: Record<string, number> = { "+": 1, "-": 1, "*": 2, "/": 2 };
9
+
10
+ export const calc: StyleFunctionResolver = (resolveValue, func) => {
11
+ const tokens = resolveValue(func[2]);
12
+
13
+ if (!Array.isArray(tokens)) {
14
+ return tokens;
15
+ }
16
+
17
+ // --- Step 1: Convert to RPN (Shunting-Yard) ---
18
+ const output: (string | Value)[] = [];
19
+ const ops: string[] = [];
20
+
21
+ for (const t of tokens) {
22
+ if (typeof t === "number") {
23
+ output.push({ value: round(t), isPercent: false });
24
+ } else if (typeof t === "string") {
25
+ if (t.endsWith("%")) {
26
+ const num = parseFloat(t.slice(0, -1));
27
+ if (Number.isNaN(num)) return undefined;
28
+ output.push({ value: round(num / 100), isPercent: true });
29
+ } else if (t === "+" || t === "-" || t === "*" || t === "/") {
30
+ while (
31
+ ops.length &&
32
+ (ops[ops.length - 1] === "+" ||
33
+ ops[ops.length - 1] === "-" ||
34
+ ops[ops.length - 1] === "*" ||
35
+ ops[ops.length - 1] === "/") &&
36
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
37
+ (precedence[ops[ops.length - 1]!] ?? 0) >= (precedence[t] ?? 0)
38
+ ) {
39
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
40
+ output.push(ops.pop()!);
41
+ }
42
+ ops.push(t);
43
+ } else if (t === "(") {
44
+ ops.push(t);
45
+ } else if (t === ")") {
46
+ while (ops.length && ops[ops.length - 1] !== "(") {
47
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
48
+ output.push(ops.pop()!);
49
+ }
50
+ if (ops.pop() !== "(") return undefined; // mismatched parens
51
+ } else {
52
+ return undefined; // invalid token
53
+ }
54
+ } else {
55
+ return undefined;
56
+ }
57
+ }
58
+ while (ops.length) {
59
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
60
+ const op = ops.pop()!;
61
+ if (op === "(" || op === ")") return undefined;
62
+ output.push(op);
63
+ }
64
+
65
+ // --- Step 2: Evaluate RPN ---
66
+ const stack: Value[] = [];
67
+ for (const t of output) {
68
+ if (typeof t !== "string") {
69
+ stack.push(t);
70
+ } else {
71
+ const b = stack.pop();
72
+ const a = stack.pop();
73
+ if (!a || !b) return undefined;
74
+
75
+ const res: Value = { value: 0, isPercent: false };
76
+
77
+ switch (t) {
78
+ case "+":
79
+ case "-": {
80
+ if (a.isPercent !== b.isPercent) return undefined; // cannot mix
81
+ res.isPercent = a.isPercent;
82
+ res.value =
83
+ t === "+" ? round(a.value + b.value) : round(a.value - b.value);
84
+ break;
85
+ }
86
+ case "*": {
87
+ if (a.isPercent && b.isPercent) return undefined; // ambiguous
88
+ res.isPercent = a.isPercent || b.isPercent;
89
+ res.value = round(a.value * b.value);
90
+ break;
91
+ }
92
+ case "/": {
93
+ if (b.value === 0) return undefined;
94
+ if (a.isPercent && b.isPercent) {
95
+ // % / % → plain number ratio
96
+ res.isPercent = false;
97
+ res.value = round(a.value / b.value);
98
+ } else {
99
+ res.isPercent = a.isPercent || b.isPercent;
100
+ res.value = round(a.value / b.value);
101
+ }
102
+ break;
103
+ }
104
+ }
105
+ stack.push(res);
106
+ }
107
+ }
108
+
109
+ if (stack.length !== 1) return undefined;
110
+
111
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
112
+ const final = stack[0]!;
113
+ if (final.isPercent) {
114
+ return `${final.value * 100}%`;
115
+ }
116
+ return final.value;
117
+ };
118
+
119
+ function round(number: number) {
120
+ return Math.round((number + Number.EPSILON) * 10000) / 10000;
121
+ }
@@ -1,6 +1,6 @@
1
- import { isStyleDescriptorArray } from "../../utils";
2
- import type { StyleFunctionResolver } from "./resolve";
3
- import { shorthandHandler } from "./shorthand";
1
+ import { isStyleDescriptorArray } from "../../../utils";
2
+ import type { StyleFunctionResolver } from "../resolve";
3
+ import { shorthandHandler } from "../shorthands/_handler";
4
4
 
5
5
  export const blur: StyleFunctionResolver = (resolveValue, value) => {
6
6
  const args = resolveValue(value[2]);
@@ -0,0 +1,5 @@
1
+ export * from "./animation-timing";
2
+ export * from "./calc";
3
+ export * from "./filters";
4
+ export * from "./platform-functions";
5
+ export * from "./transform-functions";
@@ -1,6 +1,6 @@
1
1
  import { PixelRatio, PlatformColor, StyleSheet } from "react-native";
2
2
 
3
- import type { StyleFunctionResolver } from "./resolve";
3
+ import type { StyleFunctionResolver } from "../resolve";
4
4
 
5
5
  export const platformColor: StyleFunctionResolver = (resolveValue, value) => {
6
6
  const color: unknown = resolveValue(value[2]);
@@ -25,7 +25,7 @@ export const fontScale: StyleFunctionResolver = () => {
25
25
  return PixelRatio.getFontScale();
26
26
  };
27
27
 
28
- export const pixelSizeForLayoutSize: StyleFunctionResolver = (
28
+ export const getPixelSizeForLayoutSize: StyleFunctionResolver = (
29
29
  resolveValue,
30
30
  value,
31
31
  ) => {
@@ -0,0 +1,84 @@
1
+ import { isStyleDescriptorArray } from "../../../utils";
2
+ import type { StyleFunctionResolver } from "../resolve";
3
+
4
+ export const scale: StyleFunctionResolver = (resolveValue, descriptor) => {
5
+ const args = descriptor[2];
6
+
7
+ if (!isStyleDescriptorArray(args)) {
8
+ return { scale: resolveValue(args) };
9
+ }
10
+
11
+ const x = resolveValue(args[0]);
12
+ const y = resolveValue(args[1]);
13
+
14
+ const isXValid = typeof x === "string" || typeof x === "number";
15
+ const isYValid = typeof y === "string" || typeof y === "number";
16
+
17
+ if (isXValid && isYValid) {
18
+ return x === y ? { scale: x } : [{ scaleX: x }, { scaleY: y }];
19
+ } else if (isXValid) {
20
+ return { scaleX: x };
21
+ } else if (isYValid) {
22
+ return { scaleY: y };
23
+ }
24
+
25
+ return;
26
+ };
27
+
28
+ export const rotate: StyleFunctionResolver = (resolveValue, descriptor) => {
29
+ const args = descriptor[2];
30
+
31
+ if (!isStyleDescriptorArray(args)) {
32
+ return { rotate: resolveValue(args) };
33
+ }
34
+
35
+ const x = resolveValue(args[0]);
36
+ const y = resolveValue(args[1]);
37
+ const z = resolveValue(args[2]);
38
+
39
+ const isXValid = typeof x === "string" || typeof x === "number";
40
+ const isYValid = typeof y === "string" || typeof y === "number";
41
+ const isZValid = typeof z === "string" || typeof z === "number";
42
+
43
+ if (isXValid && isYValid && isZValid) {
44
+ return [{ rotateX: x }, { rotateY: y }, { rotateZ: z }];
45
+ } else if (isXValid && isYValid) {
46
+ return [{ rotateX: x }, { rotateY: y }];
47
+ } else if (isXValid && isZValid) {
48
+ return [{ rotateX: x }, { rotateZ: z }];
49
+ } else if (isYValid && isZValid) {
50
+ return [{ rotateY: y }, { rotateZ: z }];
51
+ } else if (isXValid) {
52
+ return { rotateX: x };
53
+ } else if (isYValid) {
54
+ return { rotateY: y };
55
+ } else if (isZValid) {
56
+ return { rotateZ: z };
57
+ }
58
+
59
+ return;
60
+ };
61
+
62
+ export const translate: StyleFunctionResolver = (resolveValue, descriptor) => {
63
+ const args = descriptor[2];
64
+
65
+ if (!isStyleDescriptorArray(args)) {
66
+ return;
67
+ }
68
+
69
+ const x = resolveValue(args[0]);
70
+ const y = resolveValue(args[1]);
71
+
72
+ const isXValid = typeof x === "string" || typeof x === "number";
73
+ const isYValid = typeof y === "string" || typeof y === "number";
74
+
75
+ if (isXValid && isYValid) {
76
+ return [{ translateX: x }, { translateY: y }];
77
+ } else if (isXValid) {
78
+ return { translateX: x };
79
+ } else if (isYValid) {
80
+ return { translateY: y };
81
+ }
82
+
83
+ return;
84
+ };