react-native-css 3.0.0-nightly.61014be → 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 (510) hide show
  1. package/dist/commonjs/compiler/atRules.js +16 -3
  2. package/dist/commonjs/compiler/atRules.js.map +1 -1
  3. package/dist/commonjs/compiler/compiler.js +34 -18
  4. package/dist/commonjs/compiler/compiler.js.map +1 -1
  5. package/dist/commonjs/compiler/declarations.js +214 -136
  6. package/dist/commonjs/compiler/declarations.js.map +1 -1
  7. package/dist/commonjs/compiler/inheritance.test.js +15 -15
  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 +501 -0
  14. package/dist/commonjs/compiler/selector-builder.js.map +1 -0
  15. package/dist/commonjs/compiler/selectors.js +10 -6
  16. package/dist/commonjs/compiler/selectors.js.map +1 -1
  17. package/dist/commonjs/compiler/stylesheet.js +137 -46
  18. package/dist/commonjs/compiler/stylesheet.js.map +1 -1
  19. package/dist/commonjs/compiler/supports.js +27 -0
  20. package/dist/commonjs/compiler/supports.js.map +1 -0
  21. package/dist/commonjs/components/ActivityIndicator.js +22 -0
  22. package/dist/commonjs/components/ActivityIndicator.js.map +1 -0
  23. package/dist/commonjs/components/Button.js +22 -0
  24. package/dist/commonjs/components/Button.js.map +1 -0
  25. package/dist/commonjs/components/FlatList.js +19 -0
  26. package/dist/commonjs/components/FlatList.js.map +1 -0
  27. package/dist/commonjs/components/Image.js +17 -0
  28. package/dist/commonjs/components/Image.js.map +1 -0
  29. package/dist/commonjs/components/Switch.js +17 -0
  30. package/dist/commonjs/components/Switch.js.map +1 -0
  31. package/dist/commonjs/components/TextInput.js +17 -0
  32. package/dist/commonjs/components/TextInput.js.map +1 -0
  33. package/dist/commonjs/components/index.js +48 -0
  34. package/dist/commonjs/components/index.js.map +1 -1
  35. package/dist/commonjs/jest/index.js +33 -10
  36. package/dist/commonjs/jest/index.js.map +1 -1
  37. package/dist/commonjs/metro/index.js +1 -1
  38. package/dist/commonjs/metro/index.js.map +1 -1
  39. package/dist/commonjs/poison.pill.js +4 -1
  40. package/dist/commonjs/poison.pill.js.map +1 -1
  41. package/dist/commonjs/runtime/native/conditions/attributes.js +42 -0
  42. package/dist/commonjs/runtime/native/conditions/attributes.js.map +1 -0
  43. package/dist/commonjs/runtime/native/conditions/container-query.js +28 -21
  44. package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -1
  45. package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -1
  46. package/dist/commonjs/runtime/native/conditions/index.js +12 -46
  47. package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
  48. package/dist/commonjs/runtime/native/conditions/media-query.js +26 -21
  49. package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
  50. package/dist/commonjs/runtime/native/injection.js +22 -20
  51. package/dist/commonjs/runtime/native/injection.js.map +1 -1
  52. package/dist/commonjs/runtime/native/react/interaction.js +10 -10
  53. package/dist/commonjs/runtime/native/react/interaction.js.map +1 -1
  54. package/dist/commonjs/runtime/native/react/rules.js +26 -24
  55. package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
  56. package/dist/commonjs/runtime/native/react/useNativeCss.js +3 -2
  57. package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -1
  58. package/dist/commonjs/runtime/native/reactivity.js +1 -12
  59. package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
  60. package/dist/commonjs/runtime/native/reanimated.js +17 -0
  61. package/dist/commonjs/runtime/native/reanimated.js.map +1 -0
  62. package/dist/commonjs/runtime/native/root.js +28 -0
  63. package/dist/commonjs/runtime/native/root.js.map +1 -0
  64. package/dist/commonjs/runtime/native/styles/calculate-props.js +63 -38
  65. package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -1
  66. package/dist/commonjs/runtime/native/styles/defaults.js +1 -1
  67. package/dist/commonjs/runtime/native/styles/defaults.js.map +1 -1
  68. package/dist/commonjs/runtime/native/styles/functions/animation-timing.js +34 -0
  69. package/dist/commonjs/runtime/native/styles/functions/animation-timing.js.map +1 -0
  70. package/dist/commonjs/runtime/native/styles/functions/calc.js +125 -0
  71. package/dist/commonjs/runtime/native/styles/functions/calc.js.map +1 -0
  72. package/dist/commonjs/runtime/native/styles/{filters.js → functions/filters.js} +3 -3
  73. package/dist/commonjs/runtime/native/styles/functions/filters.js.map +1 -0
  74. package/dist/commonjs/runtime/native/styles/functions/index.js +61 -0
  75. package/dist/commonjs/runtime/native/styles/functions/index.js.map +1 -0
  76. package/dist/commonjs/runtime/native/styles/{platform-functions.js → functions/platform-functions.js} +3 -3
  77. package/dist/commonjs/runtime/native/styles/functions/platform-functions.js.map +1 -0
  78. package/dist/commonjs/runtime/native/styles/functions/transform-functions.js +121 -0
  79. package/dist/commonjs/runtime/native/styles/functions/transform-functions.js.map +1 -0
  80. package/dist/commonjs/runtime/native/styles/index.js +12 -12
  81. package/dist/commonjs/runtime/native/styles/index.js.map +1 -1
  82. package/dist/commonjs/runtime/native/styles/resolve.js +21 -44
  83. package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -1
  84. package/dist/commonjs/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
  85. package/dist/commonjs/runtime/native/styles/shorthands/_handler.js.map +1 -0
  86. package/dist/commonjs/runtime/native/styles/{animation.js → shorthands/animation.js} +5 -36
  87. package/dist/commonjs/runtime/native/styles/shorthands/animation.js.map +1 -0
  88. package/dist/commonjs/runtime/native/styles/{border.js → shorthands/border.js} +2 -2
  89. package/dist/commonjs/runtime/native/styles/shorthands/border.js.map +1 -0
  90. package/dist/commonjs/runtime/native/styles/{box-shadow.js → shorthands/box-shadow.js} +3 -3
  91. package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
  92. package/dist/commonjs/runtime/native/styles/shorthands/index.js +61 -0
  93. package/dist/commonjs/runtime/native/styles/shorthands/index.js.map +1 -0
  94. package/dist/commonjs/runtime/native/styles/{text-shadow.js → shorthands/text-shadow.js} +2 -2
  95. package/dist/commonjs/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
  96. package/dist/commonjs/runtime/native/styles/{transform.js → shorthands/transform.js} +1 -1
  97. package/dist/commonjs/runtime/native/styles/shorthands/transform.js.map +1 -0
  98. package/dist/commonjs/runtime/native/styles/units.js +7 -4
  99. package/dist/commonjs/runtime/native/styles/units.js.map +1 -1
  100. package/dist/commonjs/runtime/native/styles/variables.js +3 -2
  101. package/dist/commonjs/runtime/native/styles/variables.js.map +1 -1
  102. package/dist/commonjs/runtime/utils/objects.js +14 -6
  103. package/dist/commonjs/runtime/utils/objects.js.map +1 -1
  104. package/dist/commonjs/runtime/utils/specificity.js +2 -1
  105. package/dist/commonjs/runtime/utils/specificity.js.map +1 -1
  106. package/dist/module/compiler/atRules.js +16 -3
  107. package/dist/module/compiler/atRules.js.map +1 -1
  108. package/dist/module/compiler/compiler.js +34 -18
  109. package/dist/module/compiler/compiler.js.map +1 -1
  110. package/dist/module/compiler/compiler.types.js.map +1 -1
  111. package/dist/module/compiler/declarations.js +209 -132
  112. package/dist/module/compiler/declarations.js.map +1 -1
  113. package/dist/module/compiler/inheritance.test.js +15 -15
  114. package/dist/module/compiler/inheritance.test.js.map +1 -1
  115. package/dist/module/compiler/keyframes.js +1 -1
  116. package/dist/module/compiler/keyframes.js.map +1 -1
  117. package/dist/module/compiler/pseudo-elements.js +44 -0
  118. package/dist/module/compiler/pseudo-elements.js.map +1 -0
  119. package/dist/module/compiler/selector-builder.js +496 -0
  120. package/dist/module/compiler/selector-builder.js.map +1 -0
  121. package/dist/module/compiler/selectors.js +10 -6
  122. package/dist/module/compiler/selectors.js.map +1 -1
  123. package/dist/module/compiler/stylesheet.js +136 -45
  124. package/dist/module/compiler/stylesheet.js.map +1 -1
  125. package/dist/module/compiler/supports.js +23 -0
  126. package/dist/module/compiler/supports.js.map +1 -0
  127. package/dist/module/components/ActivityIndicator.js +17 -0
  128. package/dist/module/components/ActivityIndicator.js.map +1 -0
  129. package/dist/module/components/Button.js +17 -0
  130. package/dist/module/components/Button.js.map +1 -0
  131. package/dist/module/components/FlatList.js +14 -0
  132. package/dist/module/components/FlatList.js.map +1 -0
  133. package/dist/module/components/Image.js +12 -0
  134. package/dist/module/components/Image.js.map +1 -0
  135. package/dist/module/components/Switch.js +12 -0
  136. package/dist/module/components/Switch.js.map +1 -0
  137. package/dist/module/components/TextInput.js +12 -0
  138. package/dist/module/components/TextInput.js.map +1 -0
  139. package/dist/module/components/index.js +6 -0
  140. package/dist/module/components/index.js.map +1 -1
  141. package/dist/module/jest/index.js +32 -10
  142. package/dist/module/jest/index.js.map +1 -1
  143. package/dist/module/metro/index.js +1 -1
  144. package/dist/module/metro/index.js.map +1 -1
  145. package/dist/module/poison.pill.js +4 -1
  146. package/dist/module/poison.pill.js.map +1 -1
  147. package/dist/module/runtime/native/conditions/attributes.js +38 -0
  148. package/dist/module/runtime/native/conditions/attributes.js.map +1 -0
  149. package/dist/module/runtime/native/conditions/container-query.js +28 -21
  150. package/dist/module/runtime/native/conditions/container-query.js.map +1 -1
  151. package/dist/module/runtime/native/conditions/guards.js.map +1 -1
  152. package/dist/module/runtime/native/conditions/index.js +12 -46
  153. package/dist/module/runtime/native/conditions/index.js.map +1 -1
  154. package/dist/module/runtime/native/conditions/media-query.js +27 -22
  155. package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
  156. package/dist/module/runtime/native/injection.js +21 -19
  157. package/dist/module/runtime/native/injection.js.map +1 -1
  158. package/dist/module/runtime/native/react/interaction.js +10 -10
  159. package/dist/module/runtime/native/react/interaction.js.map +1 -1
  160. package/dist/module/runtime/native/react/rules.js +26 -24
  161. package/dist/module/runtime/native/react/rules.js.map +1 -1
  162. package/dist/module/runtime/native/react/useNativeCss.js +2 -1
  163. package/dist/module/runtime/native/react/useNativeCss.js.map +1 -1
  164. package/dist/module/runtime/native/reactivity.js +0 -11
  165. package/dist/module/runtime/native/reactivity.js.map +1 -1
  166. package/dist/module/runtime/native/reanimated.js +13 -0
  167. package/dist/module/runtime/native/reanimated.js.map +1 -0
  168. package/dist/module/runtime/native/root.js +24 -0
  169. package/dist/module/runtime/native/root.js.map +1 -0
  170. package/dist/module/runtime/native/styles/calculate-props.js +64 -39
  171. package/dist/module/runtime/native/styles/calculate-props.js.map +1 -1
  172. package/dist/module/runtime/native/styles/defaults.js +1 -1
  173. package/dist/module/runtime/native/styles/defaults.js.map +1 -1
  174. package/dist/module/runtime/native/styles/functions/animation-timing.js +30 -0
  175. package/dist/module/runtime/native/styles/functions/animation-timing.js.map +1 -0
  176. package/dist/module/runtime/native/styles/functions/calc.js +120 -0
  177. package/dist/module/runtime/native/styles/functions/calc.js.map +1 -0
  178. package/dist/module/runtime/native/styles/{filters.js → functions/filters.js} +2 -2
  179. package/dist/module/runtime/native/styles/functions/filters.js.map +1 -0
  180. package/dist/module/runtime/native/styles/functions/index.js +8 -0
  181. package/dist/module/runtime/native/styles/functions/index.js.map +1 -0
  182. package/dist/module/runtime/native/styles/{platform-functions.js → functions/platform-functions.js} +1 -1
  183. package/dist/module/runtime/native/styles/functions/platform-functions.js.map +1 -0
  184. package/dist/module/runtime/native/styles/functions/transform-functions.js +114 -0
  185. package/dist/module/runtime/native/styles/functions/transform-functions.js.map +1 -0
  186. package/dist/module/runtime/native/styles/index.js +12 -12
  187. package/dist/module/runtime/native/styles/index.js.map +1 -1
  188. package/dist/module/runtime/native/styles/resolve.js +20 -44
  189. package/dist/module/runtime/native/styles/resolve.js.map +1 -1
  190. package/dist/module/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
  191. package/dist/module/runtime/native/styles/shorthands/_handler.js.map +1 -0
  192. package/dist/module/runtime/native/styles/{animation.js → shorthands/animation.js} +3 -34
  193. package/dist/module/runtime/native/styles/shorthands/animation.js.map +1 -0
  194. package/dist/module/runtime/native/styles/{border.js → shorthands/border.js} +1 -1
  195. package/dist/module/runtime/native/styles/shorthands/border.js.map +1 -0
  196. package/dist/module/runtime/native/styles/{box-shadow.js → shorthands/box-shadow.js} +2 -2
  197. package/dist/module/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
  198. package/dist/module/runtime/native/styles/shorthands/index.js +8 -0
  199. package/dist/module/runtime/native/styles/shorthands/index.js.map +1 -0
  200. package/dist/module/runtime/native/styles/{text-shadow.js → shorthands/text-shadow.js} +1 -1
  201. package/dist/module/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
  202. package/dist/module/runtime/native/styles/{transform.js → shorthands/transform.js} +1 -1
  203. package/dist/module/runtime/native/styles/shorthands/transform.js.map +1 -0
  204. package/dist/module/runtime/native/styles/units.js +7 -4
  205. package/dist/module/runtime/native/styles/units.js.map +1 -1
  206. package/dist/module/runtime/native/styles/variables.js +2 -1
  207. package/dist/module/runtime/native/styles/variables.js.map +1 -1
  208. package/dist/module/runtime/utils/objects.js +14 -6
  209. package/dist/module/runtime/utils/objects.js.map +1 -1
  210. package/dist/module/runtime/utils/specificity.js +2 -1
  211. package/dist/module/runtime/utils/specificity.js.map +1 -1
  212. package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -1
  213. package/dist/typescript/commonjs/src/compiler/compiler.d.ts +9 -2
  214. package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
  215. package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +7 -8
  216. package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
  217. package/dist/typescript/commonjs/src/compiler/declarations.d.ts +16 -19
  218. package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
  219. package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts +4 -0
  220. package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts.map +1 -0
  221. package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts +24 -0
  222. package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -0
  223. package/dist/typescript/commonjs/src/compiler/selectors.d.ts +3 -2
  224. package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -1
  225. package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +21 -7
  226. package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
  227. package/dist/typescript/commonjs/src/compiler/supports.d.ts +3 -0
  228. package/dist/typescript/commonjs/src/compiler/supports.d.ts.map +1 -0
  229. package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +13 -0
  230. package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +1 -0
  231. package/dist/typescript/commonjs/src/components/Button.d.ts +13 -0
  232. package/dist/typescript/commonjs/src/components/Button.d.ts.map +1 -0
  233. package/dist/typescript/commonjs/src/components/FlatList.d.ts +10 -0
  234. package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -0
  235. package/dist/typescript/commonjs/src/components/Image.d.ts +8 -0
  236. package/dist/typescript/commonjs/src/components/Image.d.ts.map +1 -0
  237. package/dist/typescript/commonjs/src/components/Switch.d.ts +8 -0
  238. package/dist/typescript/commonjs/src/components/Switch.d.ts.map +1 -0
  239. package/dist/typescript/commonjs/src/components/TextInput.d.ts +8 -0
  240. package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +1 -0
  241. package/dist/typescript/commonjs/src/components/index.d.ts +6 -0
  242. package/dist/typescript/commonjs/src/components/index.d.ts.map +1 -1
  243. package/dist/typescript/commonjs/src/jest/index.d.ts +20 -3
  244. package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
  245. package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
  246. package/dist/typescript/commonjs/src/poison.pill.d.ts.map +1 -1
  247. package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts +5 -0
  248. package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts.map +1 -0
  249. package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts +3 -3
  250. package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -1
  251. package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts +2 -2
  252. package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -1
  253. package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts +2 -2
  254. package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -1
  255. package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts +2 -2
  256. package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts.map +1 -1
  257. package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +1 -1
  258. package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts +2 -2
  259. package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts.map +1 -1
  260. package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +2 -2
  261. package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts.map +1 -1
  262. package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +2 -1
  263. package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
  264. package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +2 -10
  265. package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
  266. package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts +5 -0
  267. package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts.map +1 -0
  268. package/dist/typescript/commonjs/src/runtime/native/root.d.ts +11 -0
  269. package/dist/typescript/commonjs/src/runtime/native/root.d.ts.map +1 -0
  270. package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts +1 -1
  271. package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
  272. package/dist/typescript/commonjs/src/runtime/native/styles/defaults.d.ts.map +1 -1
  273. package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
  274. package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
  275. package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts +3 -0
  276. package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
  277. package/dist/typescript/commonjs/src/runtime/native/styles/{filters.d.ts → functions/filters.d.ts} +1 -1
  278. package/dist/typescript/commonjs/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
  279. package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts +6 -0
  280. package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts.map +1 -0
  281. package/dist/typescript/commonjs/src/runtime/native/styles/{platform-functions.d.ts → functions/platform-functions.d.ts} +2 -2
  282. package/dist/typescript/commonjs/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
  283. package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
  284. package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
  285. package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts.map +1 -1
  286. package/dist/typescript/commonjs/src/runtime/native/styles/{shorthand.d.ts → shorthands/_handler.d.ts} +2 -2
  287. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
  288. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
  289. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
  290. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts +2 -0
  291. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
  292. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
  293. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
  294. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts +6 -0
  295. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
  296. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
  297. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
  298. package/dist/typescript/commonjs/src/runtime/native/styles/{transform.d.ts → shorthands/transform.d.ts} +1 -1
  299. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
  300. package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -1
  301. package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -1
  302. package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -1
  303. package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts +1 -0
  304. package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts.map +1 -1
  305. package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -1
  306. package/dist/typescript/module/src/compiler/compiler.d.ts +9 -2
  307. package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
  308. package/dist/typescript/module/src/compiler/compiler.types.d.ts +7 -8
  309. package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
  310. package/dist/typescript/module/src/compiler/declarations.d.ts +16 -19
  311. package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
  312. package/dist/typescript/module/src/compiler/pseudo-elements.d.ts +4 -0
  313. package/dist/typescript/module/src/compiler/pseudo-elements.d.ts.map +1 -0
  314. package/dist/typescript/module/src/compiler/selector-builder.d.ts +24 -0
  315. package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -0
  316. package/dist/typescript/module/src/compiler/selectors.d.ts +3 -2
  317. package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
  318. package/dist/typescript/module/src/compiler/stylesheet.d.ts +21 -7
  319. package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
  320. package/dist/typescript/module/src/compiler/supports.d.ts +3 -0
  321. package/dist/typescript/module/src/compiler/supports.d.ts.map +1 -0
  322. package/dist/typescript/module/src/components/ActivityIndicator.d.ts +13 -0
  323. package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +1 -0
  324. package/dist/typescript/module/src/components/Button.d.ts +13 -0
  325. package/dist/typescript/module/src/components/Button.d.ts.map +1 -0
  326. package/dist/typescript/module/src/components/FlatList.d.ts +10 -0
  327. package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -0
  328. package/dist/typescript/module/src/components/Image.d.ts +8 -0
  329. package/dist/typescript/module/src/components/Image.d.ts.map +1 -0
  330. package/dist/typescript/module/src/components/Switch.d.ts +8 -0
  331. package/dist/typescript/module/src/components/Switch.d.ts.map +1 -0
  332. package/dist/typescript/module/src/components/TextInput.d.ts +8 -0
  333. package/dist/typescript/module/src/components/TextInput.d.ts.map +1 -0
  334. package/dist/typescript/module/src/components/index.d.ts +6 -0
  335. package/dist/typescript/module/src/components/index.d.ts.map +1 -1
  336. package/dist/typescript/module/src/jest/index.d.ts +20 -3
  337. package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
  338. package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
  339. package/dist/typescript/module/src/poison.pill.d.ts.map +1 -1
  340. package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts +5 -0
  341. package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts.map +1 -0
  342. package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts +3 -3
  343. package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -1
  344. package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts +2 -2
  345. package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -1
  346. package/dist/typescript/module/src/runtime/native/conditions/index.d.ts +2 -2
  347. package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -1
  348. package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts +2 -2
  349. package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts.map +1 -1
  350. package/dist/typescript/module/src/runtime/native/injection.d.ts.map +1 -1
  351. package/dist/typescript/module/src/runtime/native/react/interaction.d.ts +2 -2
  352. package/dist/typescript/module/src/runtime/native/react/interaction.d.ts.map +1 -1
  353. package/dist/typescript/module/src/runtime/native/react/rules.d.ts +2 -2
  354. package/dist/typescript/module/src/runtime/native/react/rules.d.ts.map +1 -1
  355. package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +2 -1
  356. package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
  357. package/dist/typescript/module/src/runtime/native/reactivity.d.ts +2 -10
  358. package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
  359. package/dist/typescript/module/src/runtime/native/reanimated.d.ts +5 -0
  360. package/dist/typescript/module/src/runtime/native/reanimated.d.ts.map +1 -0
  361. package/dist/typescript/module/src/runtime/native/root.d.ts +11 -0
  362. package/dist/typescript/module/src/runtime/native/root.d.ts.map +1 -0
  363. package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts +1 -1
  364. package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
  365. package/dist/typescript/module/src/runtime/native/styles/defaults.d.ts.map +1 -1
  366. package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
  367. package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
  368. package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts +3 -0
  369. package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
  370. package/dist/typescript/module/src/runtime/native/styles/{filters.d.ts → functions/filters.d.ts} +1 -1
  371. package/dist/typescript/module/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
  372. package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts +6 -0
  373. package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts.map +1 -0
  374. package/dist/typescript/module/src/runtime/native/styles/{platform-functions.d.ts → functions/platform-functions.d.ts} +2 -2
  375. package/dist/typescript/module/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
  376. package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
  377. package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
  378. package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts.map +1 -1
  379. package/dist/typescript/module/src/runtime/native/styles/{shorthand.d.ts → shorthands/_handler.d.ts} +2 -2
  380. package/dist/typescript/module/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
  381. package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
  382. package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
  383. package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts +2 -0
  384. package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
  385. package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
  386. package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
  387. package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts +6 -0
  388. package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
  389. package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
  390. package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
  391. package/dist/typescript/module/src/runtime/native/styles/{transform.d.ts → shorthands/transform.d.ts} +1 -1
  392. package/dist/typescript/module/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
  393. package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -1
  394. package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -1
  395. package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -1
  396. package/dist/typescript/module/src/runtime/utils/specificity.d.ts +1 -0
  397. package/dist/typescript/module/src/runtime/utils/specificity.d.ts.map +1 -1
  398. package/package.json +6 -3
  399. package/src/compiler/atRules.ts +17 -3
  400. package/src/compiler/compiler.ts +38 -32
  401. package/src/compiler/compiler.types.ts +9 -9
  402. package/src/compiler/declarations.ts +379 -166
  403. package/src/compiler/inheritance.test.ts +13 -13
  404. package/src/compiler/keyframes.ts +1 -1
  405. package/src/compiler/pseudo-elements.ts +54 -0
  406. package/src/compiler/selector-builder.ts +586 -0
  407. package/src/compiler/selectors.ts +20 -6
  408. package/src/compiler/stylesheet.ts +186 -51
  409. package/src/compiler/supports.ts +26 -0
  410. package/src/components/ActivityIndicator.tsx +27 -0
  411. package/src/components/Button.tsx +22 -0
  412. package/src/components/FlatList.tsx +21 -0
  413. package/src/components/Image.tsx +17 -0
  414. package/src/components/Switch.tsx +17 -0
  415. package/src/components/TextInput.tsx +17 -0
  416. package/src/components/index.tsx +6 -0
  417. package/src/jest/index.ts +41 -8
  418. package/src/metro/index.ts +6 -3
  419. package/src/poison.pill.ts +5 -1
  420. package/src/runtime/native/conditions/attributes.ts +52 -0
  421. package/src/runtime/native/conditions/container-query.ts +27 -22
  422. package/src/runtime/native/conditions/guards.ts +1 -2
  423. package/src/runtime/native/conditions/index.ts +14 -66
  424. package/src/runtime/native/conditions/media-query.ts +29 -25
  425. package/src/runtime/native/injection.ts +32 -31
  426. package/src/runtime/native/react/interaction.ts +12 -12
  427. package/src/runtime/native/react/rules.ts +27 -23
  428. package/src/runtime/native/react/useNativeCss.ts +4 -1
  429. package/src/runtime/native/reactivity.ts +2 -21
  430. package/src/runtime/native/reanimated.ts +22 -0
  431. package/src/runtime/native/root.ts +31 -0
  432. package/src/runtime/native/styles/calculate-props.ts +71 -39
  433. package/src/runtime/native/styles/defaults.ts +1 -0
  434. package/src/runtime/native/styles/functions/animation-timing.ts +44 -0
  435. package/src/runtime/native/styles/functions/calc.ts +121 -0
  436. package/src/runtime/native/styles/{filters.ts → functions/filters.ts} +3 -3
  437. package/src/runtime/native/styles/functions/index.ts +5 -0
  438. package/src/runtime/native/styles/{platform-functions.ts → functions/platform-functions.ts} +2 -2
  439. package/src/runtime/native/styles/functions/transform-functions.ts +84 -0
  440. package/src/runtime/native/styles/index.ts +12 -12
  441. package/src/runtime/native/styles/resolve.ts +20 -63
  442. package/src/runtime/native/styles/{shorthand.ts → shorthands/_handler.ts} +5 -5
  443. package/src/runtime/native/styles/{animation.ts → shorthands/animation.ts} +4 -63
  444. package/src/runtime/native/styles/{border.ts → shorthands/border.ts} +1 -1
  445. package/src/runtime/native/styles/{box-shadow.ts → shorthands/box-shadow.ts} +3 -3
  446. package/src/runtime/native/styles/shorthands/index.ts +5 -0
  447. package/src/runtime/native/styles/{text-shadow.ts → shorthands/text-shadow.ts} +1 -1
  448. package/src/runtime/native/styles/{transform.ts → shorthands/transform.ts} +4 -2
  449. package/src/runtime/native/styles/units.ts +8 -4
  450. package/src/runtime/native/styles/variables.ts +2 -6
  451. package/src/runtime/utils/objects.ts +16 -4
  452. package/src/runtime/utils/specificity.ts +1 -0
  453. package/dist/commonjs/compiler/attributes.test.js +0 -20
  454. package/dist/commonjs/compiler/attributes.test.js.map +0 -1
  455. package/dist/commonjs/runtime/native/styles/animation.js.map +0 -1
  456. package/dist/commonjs/runtime/native/styles/border.js.map +0 -1
  457. package/dist/commonjs/runtime/native/styles/box-shadow.js.map +0 -1
  458. package/dist/commonjs/runtime/native/styles/calc.js +0 -85
  459. package/dist/commonjs/runtime/native/styles/calc.js.map +0 -1
  460. package/dist/commonjs/runtime/native/styles/filters.js.map +0 -1
  461. package/dist/commonjs/runtime/native/styles/platform-functions.js.map +0 -1
  462. package/dist/commonjs/runtime/native/styles/shorthand.js.map +0 -1
  463. package/dist/commonjs/runtime/native/styles/text-shadow.js.map +0 -1
  464. package/dist/commonjs/runtime/native/styles/transform.js.map +0 -1
  465. package/dist/module/compiler/attributes.test.js +0 -20
  466. package/dist/module/compiler/attributes.test.js.map +0 -1
  467. package/dist/module/runtime/native/styles/animation.js.map +0 -1
  468. package/dist/module/runtime/native/styles/border.js.map +0 -1
  469. package/dist/module/runtime/native/styles/box-shadow.js.map +0 -1
  470. package/dist/module/runtime/native/styles/calc.js +0 -79
  471. package/dist/module/runtime/native/styles/calc.js.map +0 -1
  472. package/dist/module/runtime/native/styles/filters.js.map +0 -1
  473. package/dist/module/runtime/native/styles/platform-functions.js.map +0 -1
  474. package/dist/module/runtime/native/styles/shorthand.js.map +0 -1
  475. package/dist/module/runtime/native/styles/text-shadow.js.map +0 -1
  476. package/dist/module/runtime/native/styles/transform.js.map +0 -1
  477. package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts +0 -2
  478. package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts.map +0 -1
  479. package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts +0 -9
  480. package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts.map +0 -1
  481. package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts +0 -2
  482. package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts.map +0 -1
  483. package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts +0 -3
  484. package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts.map +0 -1
  485. package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts +0 -3
  486. package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts.map +0 -1
  487. package/dist/typescript/commonjs/src/runtime/native/styles/filters.d.ts.map +0 -1
  488. package/dist/typescript/commonjs/src/runtime/native/styles/platform-functions.d.ts.map +0 -1
  489. package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts.map +0 -1
  490. package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts +0 -2
  491. package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts.map +0 -1
  492. package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts.map +0 -1
  493. package/dist/typescript/module/src/compiler/attributes.test.d.ts +0 -2
  494. package/dist/typescript/module/src/compiler/attributes.test.d.ts.map +0 -1
  495. package/dist/typescript/module/src/runtime/native/styles/animation.d.ts +0 -9
  496. package/dist/typescript/module/src/runtime/native/styles/animation.d.ts.map +0 -1
  497. package/dist/typescript/module/src/runtime/native/styles/border.d.ts +0 -2
  498. package/dist/typescript/module/src/runtime/native/styles/border.d.ts.map +0 -1
  499. package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts +0 -3
  500. package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts.map +0 -1
  501. package/dist/typescript/module/src/runtime/native/styles/calc.d.ts +0 -3
  502. package/dist/typescript/module/src/runtime/native/styles/calc.d.ts.map +0 -1
  503. package/dist/typescript/module/src/runtime/native/styles/filters.d.ts.map +0 -1
  504. package/dist/typescript/module/src/runtime/native/styles/platform-functions.d.ts.map +0 -1
  505. package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts.map +0 -1
  506. package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts +0 -2
  507. package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts.map +0 -1
  508. package/dist/typescript/module/src/runtime/native/styles/transform.d.ts.map +0 -1
  509. package/src/compiler/attributes.test.ts +0 -28
  510. package/src/runtime/native/styles/calc.ts +0 -97
@@ -1,3 +1,5 @@
1
+ import type { SelectorList } from "lightningcss";
2
+
1
3
  import {
2
4
  isStyleDescriptorArray,
3
5
  Specificity,
@@ -17,8 +19,13 @@ import type {
17
19
  StyleRuleMapping,
18
20
  StyleRuleSet,
19
21
  VariableRecord,
22
+ VariableValue,
20
23
  } from "./compiler.types";
21
- import { toRNProperty, type NormalizeSelector } from "./selectors";
24
+ import {
25
+ modifyRuleForPlaceholder,
26
+ modifyRuleForSelection,
27
+ } from "./pseudo-elements";
28
+ import { getClassNameSelectors, toRNProperty } from "./selector-builder";
22
29
 
23
30
  type BuilderMode = "style" | "media" | "container" | "keyframes";
24
31
 
@@ -29,6 +36,8 @@ const staticDeclarations = new WeakMap<
29
36
 
30
37
  const extraRules = new WeakMap<StyleRule, Partial<StyleRule>[]>();
31
38
 
39
+ const keywords = new Set(["unset"]);
40
+
32
41
  export class StylesheetBuilder {
33
42
  animationFrames?: AnimationKeyframes_V2[];
34
43
  animationDeclarations: StyleDeclaration[] = [];
@@ -47,6 +56,7 @@ export class StylesheetBuilder {
47
56
  private ruleTemplate: StyleRule = {
48
57
  s: [],
49
58
  },
59
+ // Any default mapping should be included in the @prop parsing
50
60
  private mapping: StyleRuleMapping = {},
51
61
  public descriptorProperty?: string,
52
62
  private shared: {
@@ -56,15 +66,37 @@ export class StylesheetBuilder {
56
66
  animations?: AnimationRecord;
57
67
  rem: number;
58
68
  ruleOrder: number;
59
- } = { ruleSets: {}, rem: 14, ruleOrder: 0 },
60
- private selectors?: NormalizeSelector[],
69
+ warningProperty?: string;
70
+ warningProperties: string[];
71
+ warningValues: Record<string, unknown[]>;
72
+ warningFunctions: string[];
73
+ } = {
74
+ ruleSets: {},
75
+ rem: 14,
76
+ ruleOrder: 0,
77
+ warningProperties: [],
78
+ warningValues: {},
79
+ warningFunctions: [],
80
+ },
81
+ private selectors: SelectorList = [],
61
82
  ) {}
62
83
 
63
- fork(
64
- mode = this.mode,
65
- selectors: NormalizeSelector[] | undefined = this.selectors,
66
- ): StylesheetBuilder {
84
+ fork(mode = this.mode, selectors: SelectorList = []): StylesheetBuilder {
67
85
  this.shared.ruleOrder++;
86
+
87
+ /**
88
+ * If we already have selectors and we are added more
89
+ * Then these must be nested selectors.
90
+ *
91
+ * We need to extrapolate out the selectors to their full values
92
+ */
93
+ selectors =
94
+ this.selectors.length && selectors.length
95
+ ? this.selectors.flatMap((selectorA) => {
96
+ return selectors.map((selectorB) => [...selectorA, ...selectorB]);
97
+ })
98
+ : [...this.selectors, ...selectors];
99
+
68
100
  return new StylesheetBuilder(
69
101
  this.options,
70
102
  mode,
@@ -76,7 +108,7 @@ export class StylesheetBuilder {
76
108
  );
77
109
  }
78
110
 
79
- cloneRule({ ...rule } = this.rule): StyleRule {
111
+ cloneRule({ ...rule } = this.ruleTemplate): StyleRule {
80
112
  rule.s = [...rule.s];
81
113
  rule.aq &&= [...rule.aq];
82
114
  rule.c &&= [...rule.c];
@@ -128,11 +160,17 @@ export class StylesheetBuilder {
128
160
  }
129
161
 
130
162
  if (this.shared.rootVariables) {
131
- stylesheetOptions.vr = Object.entries(this.shared.rootVariables);
163
+ stylesheetOptions.vr = Object.entries(this.shared.rootVariables).map(
164
+ // Reverse these so the most specific variables are first
165
+ ([key, value]) => [key, value.reverse()] as const,
166
+ );
132
167
  }
133
168
 
134
169
  if (this.shared.universalVariables) {
135
- stylesheetOptions.vu = Object.entries(this.shared.universalVariables);
170
+ stylesheetOptions.vu = Object.entries(this.shared.universalVariables).map(
171
+ // Reverse these so the most specific variables are first
172
+ ([key, value]) => [key, value.reverse()] as const,
173
+ );
136
174
  }
137
175
 
138
176
  if (this.shared.animations) {
@@ -155,11 +193,64 @@ export class StylesheetBuilder {
155
193
  );
156
194
  }
157
195
 
196
+ setWarningProperty(property: string) {
197
+ this.shared.warningProperty = property;
198
+ }
199
+
200
+ addWarning(type: "property" | "value", property: string): void;
201
+ addWarning(type: "style", property: string, value: unknown): void;
158
202
  addWarning(
159
- _type: "property" | "value" | "function",
160
- _property: string | number,
203
+ type: "property" | "style" | "value",
204
+ property: string,
205
+ value?: unknown,
161
206
  ): void {
162
- // TODO
207
+ switch (type) {
208
+ case "property":
209
+ this.shared.warningProperties.push(property);
210
+ break;
211
+ case "value": {
212
+ value = property;
213
+ property = this.shared.warningProperty ?? "";
214
+
215
+ if (!property) {
216
+ return;
217
+ }
218
+
219
+ this.shared.warningValues[property] ??= [];
220
+ this.shared.warningValues[property]?.push(value);
221
+ break;
222
+ }
223
+ case "style":
224
+ this.shared.warningValues[property] ??= [];
225
+ this.shared.warningValues[property]?.push(value);
226
+ break;
227
+ }
228
+ }
229
+
230
+ getWarnings() {
231
+ const result: {
232
+ properties?: string[];
233
+ values?: Record<string, unknown[]>;
234
+ functions?: string[];
235
+ } = {};
236
+
237
+ if (this.shared.warningProperties.length) {
238
+ result.properties = this.shared.warningProperties;
239
+ }
240
+
241
+ if (Object.keys(this.shared.warningValues).length) {
242
+ result.values = this.shared.warningValues;
243
+ }
244
+
245
+ if (this.shared.warningFunctions.length) {
246
+ result.functions = this.shared.warningFunctions;
247
+ }
248
+
249
+ return result;
250
+ }
251
+
252
+ addMapping(mapping: StyleRuleMapping) {
253
+ this.mapping = { ...this.mapping, ...mapping };
163
254
  }
164
255
 
165
256
  newRule(mapping = this.mapping, { important = false } = {}) {
@@ -171,14 +262,12 @@ export class StylesheetBuilder {
171
262
  }
172
263
  }
173
264
 
174
- newRuleFork({ important = false } = {}) {
175
- this.rule = this.cloneRule(this.rule);
176
- this.rule.s[Specificity.Order] = this.shared.ruleOrder;
177
- if (important) {
178
- this.rule.s[Specificity.Important] = 1;
179
- }
265
+ /** Used by nested declarations (for example @media inside a RuleSet) */
266
+ newNestedRule({ important = false } = {}) {
267
+ this.newRule(this.mapping, { important });
180
268
  }
181
269
 
270
+ /** Hack for light-dark, which requires adding a new rule without changing the current rule */
182
271
  addExtraRule(rule: Partial<StyleRule>) {
183
272
  let extraRuleArray = extraRules.get(this.rule);
184
273
  if (!extraRuleArray) {
@@ -197,8 +286,8 @@ export class StylesheetBuilder {
197
286
  }
198
287
 
199
288
  addMediaQuery(condition: MediaCondition) {
200
- this.rule.m ??= [];
201
- this.rule.m.push(condition);
289
+ this.ruleTemplate.m ??= [];
290
+ this.ruleTemplate.m.push(condition);
202
291
  }
203
292
 
204
293
  addContainer(value: string[] | false) {
@@ -257,7 +346,10 @@ export class StylesheetBuilder {
257
346
  const [delayed, usesVariables] = postProcessStyleFunction(value);
258
347
 
259
348
  rule.d ??= [];
260
- if (value[1] === "@animation") {
349
+ if (
350
+ value[1].startsWith("animation") ||
351
+ value[1].startsWith("transition")
352
+ ) {
261
353
  rule.a ??= true;
262
354
  }
263
355
 
@@ -297,43 +389,46 @@ export class StylesheetBuilder {
297
389
  }
298
390
 
299
391
  private pushDescriptor(
300
- property: string,
392
+ rawProperty: string,
301
393
  value: StyleDescriptor,
302
394
  declarations: StyleDeclaration[],
303
395
  forceTuple = false,
304
396
  delayed = false,
305
397
  ) {
306
- property = toRNProperty(property);
398
+ const property = toRNProperty(rawProperty);
307
399
 
308
- let propPath: string | string[] =
309
- this.mapping[property] ?? this.mapping["*"] ?? property;
400
+ let propPath: string | string[] | undefined =
401
+ this.mapping[rawProperty] ?? this.mapping[property] ?? this.mapping["*"];
310
402
 
311
403
  if (Array.isArray(propPath)) {
312
- const first = propPath[0];
313
-
314
- if (!first) {
315
- // This should not happen, but if it does, we skip the property
316
- return;
317
- }
404
+ const [first, second] = propPath;
318
405
 
319
- if (propPath.length === 1) {
320
- propPath = first;
406
+ if (propPath.length === 2 && first === "*" && second) {
407
+ propPath = second;
321
408
  } else {
322
409
  forceTuple = true;
323
410
  }
411
+ } else if (propPath) {
412
+ forceTuple = true;
413
+ } else {
414
+ propPath = property;
324
415
  }
325
416
 
326
- if (isStyleFunction(value)) {
417
+ if (forceTuple && !Array.isArray(propPath)) {
418
+ propPath = [propPath];
419
+ }
420
+
421
+ if (isStyleFunction(value) || Array.isArray(propPath)) {
327
422
  if (delayed) {
328
423
  declarations.push([value, propPath, 1]);
329
424
  } else {
330
425
  declarations.push([value, propPath]);
331
426
  }
332
- } else if (forceTuple || Array.isArray(propPath)) {
333
- declarations.push([value, propPath]);
334
427
  } else if (Array.isArray(value) && value.some(isStyleFunction)) {
335
428
  declarations.push([value, propPath]);
336
- } else {
429
+ } else if (typeof value === "string" && keywords.has(value)) {
430
+ declarations.push([value, propPath]);
431
+ } else if (typeof propPath === "string") {
337
432
  let staticDeclarationRecord = staticDeclarations.get(declarations);
338
433
  if (!staticDeclarationRecord) {
339
434
  staticDeclarationRecord = {};
@@ -345,17 +440,35 @@ export class StylesheetBuilder {
345
440
  }
346
441
 
347
442
  applyRuleToSelectors(selectorList = this.selectors): void {
348
- if (!selectorList?.length) {
443
+ if (!selectorList.length) {
349
444
  // If there are no selectors, we cannot apply the rule
350
445
  return;
351
446
  }
352
447
 
353
- if (!this.rule.d && !this.rule.v) {
448
+ if (!this.rule.d && !this.rule.v && !this.rule.c) {
354
449
  return;
355
450
  }
356
451
 
357
- for (const selector of selectorList) {
358
- const rule = this.cloneRule();
452
+ const normalizedSelectors = getClassNameSelectors(
453
+ selectorList,
454
+ this.options,
455
+ );
456
+
457
+ for (const selector of normalizedSelectors) {
458
+ // We are going to be apply the current rule to n selectors, so we clone the rule
459
+ let rule: StyleRule | undefined = this.cloneRule(this.rule);
460
+
461
+ if (selector.type === "className" && selector.pseudoElementQuery) {
462
+ if (selector.pseudoElementQuery.includes("selection")) {
463
+ rule = modifyRuleForSelection(rule);
464
+ } else if (selector.pseudoElementQuery.includes("placeholder")) {
465
+ rule = modifyRuleForPlaceholder(rule);
466
+ }
467
+ }
468
+
469
+ if (!rule) {
470
+ continue;
471
+ }
359
472
 
360
473
  if (selector.type === "className") {
361
474
  const {
@@ -367,6 +480,10 @@ export class StylesheetBuilder {
367
480
  attributeQuery,
368
481
  } = selector;
369
482
 
483
+ if (!className) {
484
+ continue; // No className, nothing to do
485
+ }
486
+
370
487
  // Combine the specificity of the selector with the rule's specificity
371
488
  for (let i = 0; i < specificity.length; i++) {
372
489
  const spec = specificity[i];
@@ -390,14 +507,29 @@ export class StylesheetBuilder {
390
507
  continue;
391
508
  }
392
509
 
510
+ const [first, ...rest] = name.slice(2).split(".");
511
+
512
+ if (typeof first !== "string") {
513
+ continue;
514
+ }
515
+
393
516
  const containerRule: StyleRule = {
394
517
  // These are not "real" rules, so they use the lowest specificity
395
518
  s: [0],
396
519
  c: [name],
397
520
  };
398
521
 
522
+ if (rest.length) {
523
+ containerRule.aq = rest.map((attr) => [
524
+ "a",
525
+ "className",
526
+ "*=",
527
+ attr,
528
+ ]);
529
+ }
530
+
399
531
  // Create rules for the parent classes
400
- this.addRuleToRuleSet(name, containerRule);
532
+ this.addRuleToRuleSet(first, containerRule);
401
533
  }
402
534
  }
403
535
 
@@ -426,21 +558,24 @@ export class StylesheetBuilder {
426
558
  if (!this.rule.v) {
427
559
  continue;
428
560
  }
429
-
430
- const { type, subtype } = selector;
431
-
561
+ const { type } = selector;
432
562
  for (const [name, value] of this.rule.v) {
433
563
  this.shared[type] ??= {};
434
- this.shared[type][name] ??= [undefined];
435
- this.shared[type][name][subtype === "light" ? 0 : 1] = value;
564
+ this.shared[type][name] ??= [];
565
+ const mediaQueries = this.rule.m;
566
+ const variableValue: VariableValue = mediaQueries
567
+ ? [value, [...mediaQueries]]
568
+ : [value];
569
+ // Append extra media queries if they exist
570
+ this.shared[type][name].push(variableValue);
436
571
  }
437
572
  }
438
573
  }
439
574
  }
440
575
 
441
576
  addContainerQuery(query: ContainerQuery) {
442
- this.rule.cq ??= [];
443
- this.rule.cq.push(query);
577
+ this.ruleTemplate.cq ??= [];
578
+ this.ruleTemplate.cq.push(query);
444
579
  }
445
580
 
446
581
  newAnimationFrames(name: string) {
@@ -502,7 +637,7 @@ function postProcessStyleFunction(value: StyleDescriptor): [
502
637
  let [shouldDelay, usesVariables] = postProcessStyleFunction(value[2]);
503
638
 
504
639
  usesVariables ||= value[1] === "var";
505
- shouldDelay ||= value[3] === 1;
640
+ shouldDelay ||= value[3] === 1 || usesVariables;
506
641
 
507
642
  if (shouldDelay) {
508
643
  return [true, usesVariables];
@@ -0,0 +1,26 @@
1
+ import type { SupportsCondition } from "lightningcss";
2
+
3
+ export function supportsConditionValid(condition: SupportsCondition): boolean {
4
+ if (condition.type === "and") {
5
+ return condition.value.every((condition) => {
6
+ return supportsConditionValid(condition);
7
+ });
8
+ } else if (condition.type === "or") {
9
+ return condition.value.some((condition) => {
10
+ return supportsConditionValid(condition);
11
+ });
12
+ } else if (condition.type === "not") {
13
+ return !supportsConditionValid(condition.value);
14
+ } else if (condition.type === "declaration") {
15
+ return Boolean(
16
+ declarations[condition.propertyId.property]?.includes(condition.value),
17
+ );
18
+ }
19
+
20
+ return false;
21
+ }
22
+
23
+ const declarations: Record<string, string[]> = {
24
+ // We don't actually support this, but its needed for Tailwind CSS
25
+ "-moz-orient": ["inline"],
26
+ };
@@ -0,0 +1,27 @@
1
+ import {
2
+ ActivityIndicator as RNActivityIndicator,
3
+ type ActivityIndicatorProps,
4
+ } from "react-native";
5
+
6
+ import {
7
+ useCssElement,
8
+ type StyledConfiguration,
9
+ type StyledProps,
10
+ } from "../runtime";
11
+
12
+ const mapping = {
13
+ className: {
14
+ target: "style",
15
+ nativeStyleMapping: {
16
+ color: "color",
17
+ },
18
+ },
19
+ } satisfies StyledConfiguration<typeof RNActivityIndicator>;
20
+
21
+ export function ActivityIndicator(
22
+ props: StyledProps<ActivityIndicatorProps, typeof mapping>,
23
+ ) {
24
+ return useCssElement(RNActivityIndicator, props, mapping);
25
+ }
26
+
27
+ export default ActivityIndicator;
@@ -0,0 +1,22 @@
1
+ import { Button as RNButton, type ButtonProps } from "react-native";
2
+
3
+ import {
4
+ useCssElement,
5
+ type StyledConfiguration,
6
+ type StyledProps,
7
+ } from "../runtime";
8
+
9
+ const mapping = {
10
+ className: {
11
+ target: false,
12
+ nativeStyleMapping: {
13
+ color: "color",
14
+ },
15
+ },
16
+ } satisfies StyledConfiguration<typeof RNButton>;
17
+
18
+ export function Button(props: StyledProps<ButtonProps, typeof mapping>) {
19
+ return useCssElement(RNButton, props, mapping);
20
+ }
21
+
22
+ export default Button;
@@ -0,0 +1,21 @@
1
+ import { FlatList as RNFlatList, type FlatListProps } from "react-native";
2
+
3
+ import {
4
+ useCssElement,
5
+ type StyledConfiguration,
6
+ type StyledProps,
7
+ } from "../runtime";
8
+
9
+ const mapping = {
10
+ columnWrapperStyle: "columnWrapperStyle",
11
+ listFooterComponentClassName: "ListFooterComponentStyle",
12
+ listHeaderComponentClassName: "ListHeaderComponentStyle",
13
+ } satisfies StyledConfiguration<typeof RNFlatList>;
14
+
15
+ export function FlatList<ItemT>(
16
+ props: StyledProps<FlatListProps<ItemT>, typeof mapping>,
17
+ ) {
18
+ return useCssElement(RNFlatList, props, mapping);
19
+ }
20
+
21
+ export default FlatList;
@@ -0,0 +1,17 @@
1
+ import { Image as RNImage, type ImageProps } from "react-native";
2
+
3
+ import {
4
+ useCssElement,
5
+ type StyledConfiguration,
6
+ type StyledProps,
7
+ } from "../runtime";
8
+
9
+ const mapping = {
10
+ className: "style",
11
+ } satisfies StyledConfiguration<typeof RNImage>;
12
+
13
+ export function Image(props: StyledProps<ImageProps, typeof mapping>) {
14
+ return useCssElement(RNImage, props, mapping);
15
+ }
16
+
17
+ export default Image;
@@ -0,0 +1,17 @@
1
+ import { Switch as RNSwitch, type SwitchProps } from "react-native";
2
+
3
+ import {
4
+ useCssElement,
5
+ type StyledConfiguration,
6
+ type StyledProps,
7
+ } from "../runtime";
8
+
9
+ const mapping = {
10
+ className: "style",
11
+ } satisfies StyledConfiguration<typeof RNSwitch>;
12
+
13
+ export function Switch(props: StyledProps<SwitchProps, typeof mapping>) {
14
+ return useCssElement(RNSwitch, props, mapping);
15
+ }
16
+
17
+ export default Switch;
@@ -0,0 +1,17 @@
1
+ import { TextInput as RNTextInput, type TextInputProps } from "react-native";
2
+
3
+ import {
4
+ useCssElement,
5
+ type StyledConfiguration,
6
+ type StyledProps,
7
+ } from "../runtime";
8
+
9
+ const mapping = {
10
+ className: "style",
11
+ } satisfies StyledConfiguration<typeof RNTextInput>;
12
+
13
+ export function TextInput(props: StyledProps<TextInputProps, typeof mapping>) {
14
+ return useCssElement(RNTextInput, props, mapping);
15
+ }
16
+
17
+ export default TextInput;
@@ -1,4 +1,10 @@
1
1
  export * from "react-native";
2
2
 
3
+ export { ActivityIndicator } from "./ActivityIndicator";
4
+ export { Button } from "./Button";
5
+ export { FlatList } from "./FlatList";
6
+ export { Image } from "./Image";
7
+ export { Switch } from "./Switch";
3
8
  export { Text } from "./Text";
9
+ export { TextInput } from "./TextInput";
4
10
  export { View } from "./View";
package/src/jest/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { Appearance, Dimensions } from "react-native";
2
2
 
3
+ import { inspect } from "node:util";
4
+
3
5
  import { compile, type CompilerOptions } from "../compiler";
4
6
  import { StyleCollection } from "../runtime/native/injection";
5
7
  import { colorScheme, dimensions, rem } from "../runtime/native/reactivity";
@@ -23,19 +25,50 @@ beforeEach(() => {
23
25
  colorScheme.set(null);
24
26
  });
25
27
 
28
+ const debugDefault = Boolean(
29
+ process.env.REACT_NATIVE_CSS_TEST_DEBUG &&
30
+ process.env.NODE_OPTIONS?.includes("--inspect"),
31
+ );
32
+
26
33
  export function registerCSS(
27
34
  css: string,
28
- {
29
- debugCompiled = process.env.NODE_OPTIONS?.includes("--inspect"),
30
- ...options
31
- }: CompilerOptions & { debugCompiled?: boolean } = {},
35
+ options: CompilerOptions & { debug?: boolean } = {},
32
36
  ) {
33
- const compiled = compile(css, options);
34
- if (debugCompiled) {
35
- console.log(`Compiled styles:\n\n${JSON.stringify({ compiled }, null, 2)}`);
37
+ const { debug = debugDefault } = options;
38
+ const compiled = compileWithAutoDebug(css, options);
39
+
40
+ if (debug) {
41
+ console.log(
42
+ `Compiled:\n---\n${inspect(
43
+ {
44
+ stylesheet: compiled.stylesheet(),
45
+ warnings: compiled.warnings(),
46
+ },
47
+ { depth: null, colors: true, compact: false },
48
+ )}`,
49
+ );
36
50
  }
37
51
 
38
- StyleCollection.inject(compiled);
52
+ StyleCollection.inject(compiled.stylesheet());
39
53
 
40
54
  return compiled;
41
55
  }
56
+
57
+ export function compileWithAutoDebug(
58
+ css: string,
59
+ {
60
+ debug = debugDefault,
61
+ ...options
62
+ }: CompilerOptions & { debug?: boolean } = {},
63
+ ) {
64
+ const logger = debug
65
+ ? (text: string) => {
66
+ // Just log the rules
67
+ if (text.startsWith("[")) {
68
+ console.log(`Rules:\n---\n${text}`);
69
+ }
70
+ }
71
+ : undefined;
72
+
73
+ return compile(css, { ...options, logger });
74
+ }
@@ -6,7 +6,7 @@ import connect from "connect";
6
6
  import debug from "debug";
7
7
  import type { MetroConfig } from "metro-config";
8
8
 
9
- import type { CompilerOptions } from "../compiler";
9
+ import type { CompilerOptions, ReactNativeCssStyleSheet_V2 } from "../compiler";
10
10
  import { compile } from "../compiler/compiler";
11
11
  import { getNativeInjectionCode, getWebInjectionCode } from "./injection-code";
12
12
  import { nativeResolver, webResolver } from "./resolver";
@@ -93,7 +93,10 @@ export function withReactNativeCSS<
93
93
  if (!bundler.__react_native_css__patched) {
94
94
  bundler.__react_native_css__patched = true;
95
95
 
96
- const nativeCSSFiles = new Map();
96
+ const nativeCSSFiles = new Map<
97
+ string,
98
+ [string, ReactNativeCssStyleSheet_V2]
99
+ >();
97
100
  const webCSSFiles = new Set<string>();
98
101
 
99
102
  const nativeInjectionPath = require.resolve(
@@ -174,7 +177,7 @@ export function withReactNativeCSS<
174
177
  next,
175
178
  compile(next, {
176
179
  hexColors: options?.hexColors,
177
- }),
180
+ }).stylesheet(),
178
181
  ]);
179
182
 
180
183
  watcher.emit("change", {
@@ -1,4 +1,7 @@
1
- throw new Error(`react-native-css has encountered a setup error.
1
+ const canWarn = process.env.NODE_ENV !== "test";
2
+
3
+ if (canWarn) {
4
+ throw new Error(`react-native-css has encountered a setup error.
2
5
 
3
6
  ┌─────-─┐
4
7
  | Metro |
@@ -28,5 +31,6 @@ If you are using NativeWind with the 'withNativeWind' function, follow the Metro
28
31
 
29
32
  If you are using another bundler (Vite, Webpack, etc), or non-Metro framework (Next.js, Remix, etc), please ensure you have included 'react-native-css/babel' as a babel preset.
30
33
  `);
34
+ }
31
35
 
32
36
  export {};