react-native-css 3.0.0-nightly.75f8b74 → 3.0.0-nightly.8dd703d

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 (416) 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/attributes.test.js +1 -1
  4. package/dist/commonjs/compiler/attributes.test.js.map +1 -1
  5. package/dist/commonjs/compiler/compiler.js +26 -17
  6. package/dist/commonjs/compiler/compiler.js.map +1 -1
  7. package/dist/commonjs/compiler/declarations.js +186 -92
  8. package/dist/commonjs/compiler/declarations.js.map +1 -1
  9. package/dist/commonjs/compiler/inheritance.test.js +7 -7
  10. package/dist/commonjs/compiler/inheritance.test.js.map +1 -1
  11. package/dist/commonjs/compiler/keyframes.js +1 -1
  12. package/dist/commonjs/compiler/keyframes.js.map +1 -1
  13. package/dist/commonjs/compiler/selector-builder.js +457 -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 +122 -43
  18. package/dist/commonjs/compiler/stylesheet.js.map +1 -1
  19. package/dist/commonjs/jest/index.js +27 -9
  20. package/dist/commonjs/jest/index.js.map +1 -1
  21. package/dist/commonjs/metro/index.js +1 -1
  22. package/dist/commonjs/metro/index.js.map +1 -1
  23. package/dist/commonjs/poison.pill.js +4 -1
  24. package/dist/commonjs/poison.pill.js.map +1 -1
  25. package/dist/commonjs/runtime/native/conditions/attributes.js +42 -0
  26. package/dist/commonjs/runtime/native/conditions/attributes.js.map +1 -0
  27. package/dist/commonjs/runtime/native/conditions/container-query.js +28 -21
  28. package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -1
  29. package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -1
  30. package/dist/commonjs/runtime/native/conditions/index.js +10 -46
  31. package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
  32. package/dist/commonjs/runtime/native/conditions/media-query.js +19 -17
  33. package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
  34. package/dist/commonjs/runtime/native/injection.js +3 -2
  35. package/dist/commonjs/runtime/native/injection.js.map +1 -1
  36. package/dist/commonjs/runtime/native/react/interaction.js +10 -10
  37. package/dist/commonjs/runtime/native/react/interaction.js.map +1 -1
  38. package/dist/commonjs/runtime/native/react/rules.js +9 -9
  39. package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
  40. package/dist/commonjs/runtime/native/react/useNativeCss.js +3 -2
  41. package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -1
  42. package/dist/commonjs/runtime/native/reactivity.js +1 -12
  43. package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
  44. package/dist/commonjs/runtime/native/reanimated.js +17 -0
  45. package/dist/commonjs/runtime/native/reanimated.js.map +1 -0
  46. package/dist/commonjs/runtime/native/root.js +28 -0
  47. package/dist/commonjs/runtime/native/root.js.map +1 -0
  48. package/dist/commonjs/runtime/native/styles/calculate-props.js +56 -48
  49. package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -1
  50. package/dist/commonjs/runtime/native/styles/defaults.js +1 -1
  51. package/dist/commonjs/runtime/native/styles/defaults.js.map +1 -1
  52. package/dist/commonjs/runtime/native/styles/functions/animation-timing.js +34 -0
  53. package/dist/commonjs/runtime/native/styles/functions/animation-timing.js.map +1 -0
  54. package/dist/commonjs/runtime/native/styles/{calc.js → functions/calc.js} +1 -1
  55. package/dist/commonjs/runtime/native/styles/functions/calc.js.map +1 -0
  56. package/dist/commonjs/runtime/native/styles/{filters.js → functions/filters.js} +3 -3
  57. package/dist/commonjs/runtime/native/styles/functions/filters.js.map +1 -0
  58. package/dist/commonjs/runtime/native/styles/functions/index.js +61 -0
  59. package/dist/commonjs/runtime/native/styles/functions/index.js.map +1 -0
  60. package/dist/commonjs/runtime/native/styles/{platform-functions.js → functions/platform-functions.js} +3 -3
  61. package/dist/commonjs/runtime/native/styles/functions/platform-functions.js.map +1 -0
  62. package/dist/commonjs/runtime/native/styles/functions/transform-functions.js +83 -0
  63. package/dist/commonjs/runtime/native/styles/functions/transform-functions.js.map +1 -0
  64. package/dist/commonjs/runtime/native/styles/index.js +12 -12
  65. package/dist/commonjs/runtime/native/styles/index.js.map +1 -1
  66. package/dist/commonjs/runtime/native/styles/resolve.js +21 -44
  67. package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -1
  68. package/dist/commonjs/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
  69. package/dist/commonjs/runtime/native/styles/shorthands/_handler.js.map +1 -0
  70. package/dist/commonjs/runtime/native/styles/{animation.js → shorthands/animation.js} +5 -36
  71. package/dist/commonjs/runtime/native/styles/shorthands/animation.js.map +1 -0
  72. package/dist/commonjs/runtime/native/styles/{border.js → shorthands/border.js} +2 -2
  73. package/dist/commonjs/runtime/native/styles/shorthands/border.js.map +1 -0
  74. package/dist/commonjs/runtime/native/styles/{box-shadow.js → shorthands/box-shadow.js} +3 -3
  75. package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
  76. package/dist/commonjs/runtime/native/styles/shorthands/index.js +61 -0
  77. package/dist/commonjs/runtime/native/styles/shorthands/index.js.map +1 -0
  78. package/dist/commonjs/runtime/native/styles/{text-shadow.js → shorthands/text-shadow.js} +2 -2
  79. package/dist/commonjs/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
  80. package/dist/commonjs/runtime/native/styles/shorthands/transform.js.map +1 -0
  81. package/dist/commonjs/runtime/native/styles/units.js +7 -4
  82. package/dist/commonjs/runtime/native/styles/units.js.map +1 -1
  83. package/dist/commonjs/runtime/native/styles/variables.js +3 -2
  84. package/dist/commonjs/runtime/native/styles/variables.js.map +1 -1
  85. package/dist/commonjs/runtime/utils/objects.js +25 -5
  86. package/dist/commonjs/runtime/utils/objects.js.map +1 -1
  87. package/dist/commonjs/runtime/utils/specificity.js +2 -1
  88. package/dist/commonjs/runtime/utils/specificity.js.map +1 -1
  89. package/dist/module/compiler/atRules.js +16 -3
  90. package/dist/module/compiler/atRules.js.map +1 -1
  91. package/dist/module/compiler/attributes.test.js +1 -1
  92. package/dist/module/compiler/attributes.test.js.map +1 -1
  93. package/dist/module/compiler/compiler.js +26 -17
  94. package/dist/module/compiler/compiler.js.map +1 -1
  95. package/dist/module/compiler/compiler.types.js.map +1 -1
  96. package/dist/module/compiler/declarations.js +181 -88
  97. package/dist/module/compiler/declarations.js.map +1 -1
  98. package/dist/module/compiler/inheritance.test.js +7 -7
  99. package/dist/module/compiler/inheritance.test.js.map +1 -1
  100. package/dist/module/compiler/keyframes.js +1 -1
  101. package/dist/module/compiler/keyframes.js.map +1 -1
  102. package/dist/module/compiler/selector-builder.js +452 -0
  103. package/dist/module/compiler/selector-builder.js.map +1 -0
  104. package/dist/module/compiler/selectors.js +10 -6
  105. package/dist/module/compiler/selectors.js.map +1 -1
  106. package/dist/module/compiler/stylesheet.js +121 -42
  107. package/dist/module/compiler/stylesheet.js.map +1 -1
  108. package/dist/module/jest/index.js +26 -8
  109. package/dist/module/jest/index.js.map +1 -1
  110. package/dist/module/metro/index.js +1 -1
  111. package/dist/module/metro/index.js.map +1 -1
  112. package/dist/module/poison.pill.js +4 -1
  113. package/dist/module/poison.pill.js.map +1 -1
  114. package/dist/module/runtime/native/conditions/attributes.js +38 -0
  115. package/dist/module/runtime/native/conditions/attributes.js.map +1 -0
  116. package/dist/module/runtime/native/conditions/container-query.js +28 -21
  117. package/dist/module/runtime/native/conditions/container-query.js.map +1 -1
  118. package/dist/module/runtime/native/conditions/guards.js.map +1 -1
  119. package/dist/module/runtime/native/conditions/index.js +10 -46
  120. package/dist/module/runtime/native/conditions/index.js.map +1 -1
  121. package/dist/module/runtime/native/conditions/media-query.js +19 -17
  122. package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
  123. package/dist/module/runtime/native/injection.js +2 -1
  124. package/dist/module/runtime/native/injection.js.map +1 -1
  125. package/dist/module/runtime/native/react/interaction.js +10 -10
  126. package/dist/module/runtime/native/react/interaction.js.map +1 -1
  127. package/dist/module/runtime/native/react/rules.js +9 -9
  128. package/dist/module/runtime/native/react/rules.js.map +1 -1
  129. package/dist/module/runtime/native/react/useNativeCss.js +2 -1
  130. package/dist/module/runtime/native/react/useNativeCss.js.map +1 -1
  131. package/dist/module/runtime/native/reactivity.js +0 -11
  132. package/dist/module/runtime/native/reactivity.js.map +1 -1
  133. package/dist/module/runtime/native/reanimated.js +13 -0
  134. package/dist/module/runtime/native/reanimated.js.map +1 -0
  135. package/dist/module/runtime/native/root.js +24 -0
  136. package/dist/module/runtime/native/root.js.map +1 -0
  137. package/dist/module/runtime/native/styles/calculate-props.js +57 -49
  138. package/dist/module/runtime/native/styles/calculate-props.js.map +1 -1
  139. package/dist/module/runtime/native/styles/defaults.js +1 -1
  140. package/dist/module/runtime/native/styles/defaults.js.map +1 -1
  141. package/dist/module/runtime/native/styles/functions/animation-timing.js +30 -0
  142. package/dist/module/runtime/native/styles/functions/animation-timing.js.map +1 -0
  143. package/dist/module/runtime/native/styles/{calc.js → functions/calc.js} +1 -1
  144. package/dist/module/runtime/native/styles/functions/calc.js.map +1 -0
  145. package/dist/module/runtime/native/styles/{filters.js → functions/filters.js} +2 -2
  146. package/dist/module/runtime/native/styles/functions/filters.js.map +1 -0
  147. package/dist/module/runtime/native/styles/functions/index.js +8 -0
  148. package/dist/module/runtime/native/styles/functions/index.js.map +1 -0
  149. package/dist/module/runtime/native/styles/{platform-functions.js → functions/platform-functions.js} +1 -1
  150. package/dist/module/runtime/native/styles/functions/platform-functions.js.map +1 -0
  151. package/dist/module/runtime/native/styles/functions/transform-functions.js +76 -0
  152. package/dist/module/runtime/native/styles/functions/transform-functions.js.map +1 -0
  153. package/dist/module/runtime/native/styles/index.js +12 -12
  154. package/dist/module/runtime/native/styles/index.js.map +1 -1
  155. package/dist/module/runtime/native/styles/resolve.js +20 -44
  156. package/dist/module/runtime/native/styles/resolve.js.map +1 -1
  157. package/dist/module/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
  158. package/dist/module/runtime/native/styles/shorthands/_handler.js.map +1 -0
  159. package/dist/module/runtime/native/styles/{animation.js → shorthands/animation.js} +3 -34
  160. package/dist/module/runtime/native/styles/shorthands/animation.js.map +1 -0
  161. package/dist/module/runtime/native/styles/{border.js → shorthands/border.js} +1 -1
  162. package/dist/module/runtime/native/styles/shorthands/border.js.map +1 -0
  163. package/dist/module/runtime/native/styles/{box-shadow.js → shorthands/box-shadow.js} +2 -2
  164. package/dist/module/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
  165. package/dist/module/runtime/native/styles/shorthands/index.js +8 -0
  166. package/dist/module/runtime/native/styles/shorthands/index.js.map +1 -0
  167. package/dist/module/runtime/native/styles/{text-shadow.js → shorthands/text-shadow.js} +1 -1
  168. package/dist/module/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
  169. package/dist/module/runtime/native/styles/shorthands/transform.js.map +1 -0
  170. package/dist/module/runtime/native/styles/units.js +7 -4
  171. package/dist/module/runtime/native/styles/units.js.map +1 -1
  172. package/dist/module/runtime/native/styles/variables.js +2 -1
  173. package/dist/module/runtime/native/styles/variables.js.map +1 -1
  174. package/dist/module/runtime/utils/objects.js +25 -5
  175. package/dist/module/runtime/utils/objects.js.map +1 -1
  176. package/dist/module/runtime/utils/specificity.js +2 -1
  177. package/dist/module/runtime/utils/specificity.js.map +1 -1
  178. package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -1
  179. package/dist/typescript/commonjs/src/compiler/compiler.d.ts +9 -2
  180. package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
  181. package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +5 -4
  182. package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
  183. package/dist/typescript/commonjs/src/compiler/declarations.d.ts +16 -19
  184. package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
  185. package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts +23 -0
  186. package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -0
  187. package/dist/typescript/commonjs/src/compiler/selectors.d.ts +3 -2
  188. package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -1
  189. package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +21 -7
  190. package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
  191. package/dist/typescript/commonjs/src/jest/index.d.ts +19 -2
  192. package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
  193. package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
  194. package/dist/typescript/commonjs/src/poison.pill.d.ts.map +1 -1
  195. package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts +5 -0
  196. package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts.map +1 -0
  197. package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts +3 -3
  198. package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -1
  199. package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts +2 -2
  200. package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -1
  201. package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts +2 -2
  202. package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -1
  203. package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts +2 -2
  204. package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts.map +1 -1
  205. package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +1 -1
  206. package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts +2 -2
  207. package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts.map +1 -1
  208. package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +2 -1
  209. package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
  210. package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +2 -10
  211. package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
  212. package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts +5 -0
  213. package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts.map +1 -0
  214. package/dist/typescript/commonjs/src/runtime/native/root.d.ts +11 -0
  215. package/dist/typescript/commonjs/src/runtime/native/root.d.ts.map +1 -0
  216. package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
  217. package/dist/typescript/commonjs/src/runtime/native/styles/defaults.d.ts.map +1 -1
  218. package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
  219. package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
  220. package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts +3 -0
  221. package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
  222. package/dist/typescript/commonjs/src/runtime/native/styles/{filters.d.ts → functions/filters.d.ts} +1 -1
  223. package/dist/typescript/commonjs/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
  224. package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts +6 -0
  225. package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts.map +1 -0
  226. package/dist/typescript/commonjs/src/runtime/native/styles/{platform-functions.d.ts → functions/platform-functions.d.ts} +2 -2
  227. package/dist/typescript/commonjs/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
  228. package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
  229. package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
  230. package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts.map +1 -1
  231. package/dist/typescript/commonjs/src/runtime/native/styles/{shorthand.d.ts → shorthands/_handler.d.ts} +2 -2
  232. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
  233. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
  234. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
  235. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts +2 -0
  236. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
  237. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
  238. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
  239. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts +6 -0
  240. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
  241. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
  242. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
  243. package/dist/typescript/commonjs/src/runtime/native/styles/{transform.d.ts → shorthands/transform.d.ts} +1 -1
  244. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
  245. package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -1
  246. package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -1
  247. package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -1
  248. package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts +1 -0
  249. package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts.map +1 -1
  250. package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -1
  251. package/dist/typescript/module/src/compiler/compiler.d.ts +9 -2
  252. package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
  253. package/dist/typescript/module/src/compiler/compiler.types.d.ts +5 -4
  254. package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
  255. package/dist/typescript/module/src/compiler/declarations.d.ts +16 -19
  256. package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
  257. package/dist/typescript/module/src/compiler/selector-builder.d.ts +23 -0
  258. package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -0
  259. package/dist/typescript/module/src/compiler/selectors.d.ts +3 -2
  260. package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
  261. package/dist/typescript/module/src/compiler/stylesheet.d.ts +21 -7
  262. package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
  263. package/dist/typescript/module/src/jest/index.d.ts +19 -2
  264. package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
  265. package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
  266. package/dist/typescript/module/src/poison.pill.d.ts.map +1 -1
  267. package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts +5 -0
  268. package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts.map +1 -0
  269. package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts +3 -3
  270. package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -1
  271. package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts +2 -2
  272. package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -1
  273. package/dist/typescript/module/src/runtime/native/conditions/index.d.ts +2 -2
  274. package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -1
  275. package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts +2 -2
  276. package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts.map +1 -1
  277. package/dist/typescript/module/src/runtime/native/injection.d.ts.map +1 -1
  278. package/dist/typescript/module/src/runtime/native/react/interaction.d.ts +2 -2
  279. package/dist/typescript/module/src/runtime/native/react/interaction.d.ts.map +1 -1
  280. package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +2 -1
  281. package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
  282. package/dist/typescript/module/src/runtime/native/reactivity.d.ts +2 -10
  283. package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
  284. package/dist/typescript/module/src/runtime/native/reanimated.d.ts +5 -0
  285. package/dist/typescript/module/src/runtime/native/reanimated.d.ts.map +1 -0
  286. package/dist/typescript/module/src/runtime/native/root.d.ts +11 -0
  287. package/dist/typescript/module/src/runtime/native/root.d.ts.map +1 -0
  288. package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
  289. package/dist/typescript/module/src/runtime/native/styles/defaults.d.ts.map +1 -1
  290. package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
  291. package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
  292. package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts +3 -0
  293. package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
  294. package/dist/typescript/module/src/runtime/native/styles/{filters.d.ts → functions/filters.d.ts} +1 -1
  295. package/dist/typescript/module/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
  296. package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts +6 -0
  297. package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts.map +1 -0
  298. package/dist/typescript/module/src/runtime/native/styles/{platform-functions.d.ts → functions/platform-functions.d.ts} +2 -2
  299. package/dist/typescript/module/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
  300. package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
  301. package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
  302. package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts.map +1 -1
  303. package/dist/typescript/module/src/runtime/native/styles/{shorthand.d.ts → shorthands/_handler.d.ts} +2 -2
  304. package/dist/typescript/module/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
  305. package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
  306. package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
  307. package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts +2 -0
  308. package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
  309. package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
  310. package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
  311. package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts +6 -0
  312. package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
  313. package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
  314. package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
  315. package/dist/typescript/module/src/runtime/native/styles/{transform.d.ts → shorthands/transform.d.ts} +1 -1
  316. package/dist/typescript/module/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
  317. package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -1
  318. package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -1
  319. package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -1
  320. package/dist/typescript/module/src/runtime/utils/specificity.d.ts +1 -0
  321. package/dist/typescript/module/src/runtime/utils/specificity.d.ts.map +1 -1
  322. package/package.json +3 -3
  323. package/src/compiler/atRules.ts +17 -3
  324. package/src/compiler/attributes.test.ts +1 -1
  325. package/src/compiler/compiler.ts +30 -31
  326. package/src/compiler/compiler.types.ts +7 -5
  327. package/src/compiler/declarations.ts +331 -112
  328. package/src/compiler/inheritance.test.ts +6 -6
  329. package/src/compiler/keyframes.ts +1 -1
  330. package/src/compiler/selector-builder.ts +531 -0
  331. package/src/compiler/selectors.ts +20 -6
  332. package/src/compiler/stylesheet.ts +168 -48
  333. package/src/jest/index.ts +32 -8
  334. package/src/metro/index.ts +6 -3
  335. package/src/poison.pill.ts +5 -1
  336. package/src/runtime/native/conditions/attributes.ts +52 -0
  337. package/src/runtime/native/conditions/container-query.ts +27 -22
  338. package/src/runtime/native/conditions/guards.ts +1 -2
  339. package/src/runtime/native/conditions/index.ts +12 -66
  340. package/src/runtime/native/conditions/media-query.ts +20 -20
  341. package/src/runtime/native/injection.ts +1 -1
  342. package/src/runtime/native/react/interaction.ts +12 -12
  343. package/src/runtime/native/react/rules.ts +9 -9
  344. package/src/runtime/native/react/useNativeCss.ts +4 -1
  345. package/src/runtime/native/reactivity.ts +2 -21
  346. package/src/runtime/native/reanimated.ts +22 -0
  347. package/src/runtime/native/root.ts +31 -0
  348. package/src/runtime/native/styles/calculate-props.ts +61 -50
  349. package/src/runtime/native/styles/defaults.ts +1 -0
  350. package/src/runtime/native/styles/functions/animation-timing.ts +44 -0
  351. package/src/runtime/native/styles/{calc.ts → functions/calc.ts} +2 -2
  352. package/src/runtime/native/styles/{filters.ts → functions/filters.ts} +3 -3
  353. package/src/runtime/native/styles/functions/index.ts +5 -0
  354. package/src/runtime/native/styles/{platform-functions.ts → functions/platform-functions.ts} +2 -2
  355. package/src/runtime/native/styles/functions/transform-functions.ts +51 -0
  356. package/src/runtime/native/styles/index.ts +12 -12
  357. package/src/runtime/native/styles/resolve.ts +20 -63
  358. package/src/runtime/native/styles/{shorthand.ts → shorthands/_handler.ts} +5 -5
  359. package/src/runtime/native/styles/{animation.ts → shorthands/animation.ts} +4 -63
  360. package/src/runtime/native/styles/{border.ts → shorthands/border.ts} +1 -1
  361. package/src/runtime/native/styles/{box-shadow.ts → shorthands/box-shadow.ts} +3 -3
  362. package/src/runtime/native/styles/shorthands/index.ts +5 -0
  363. package/src/runtime/native/styles/{text-shadow.ts → shorthands/text-shadow.ts} +1 -1
  364. package/src/runtime/native/styles/{transform.ts → shorthands/transform.ts} +1 -1
  365. package/src/runtime/native/styles/units.ts +8 -4
  366. package/src/runtime/native/styles/variables.ts +2 -6
  367. package/src/runtime/utils/objects.ts +24 -3
  368. package/src/runtime/utils/specificity.ts +1 -0
  369. package/dist/commonjs/runtime/native/styles/animation.js.map +0 -1
  370. package/dist/commonjs/runtime/native/styles/border.js.map +0 -1
  371. package/dist/commonjs/runtime/native/styles/box-shadow.js.map +0 -1
  372. package/dist/commonjs/runtime/native/styles/calc.js.map +0 -1
  373. package/dist/commonjs/runtime/native/styles/filters.js.map +0 -1
  374. package/dist/commonjs/runtime/native/styles/platform-functions.js.map +0 -1
  375. package/dist/commonjs/runtime/native/styles/shorthand.js.map +0 -1
  376. package/dist/commonjs/runtime/native/styles/text-shadow.js.map +0 -1
  377. package/dist/commonjs/runtime/native/styles/transform.js.map +0 -1
  378. package/dist/module/runtime/native/styles/animation.js.map +0 -1
  379. package/dist/module/runtime/native/styles/border.js.map +0 -1
  380. package/dist/module/runtime/native/styles/box-shadow.js.map +0 -1
  381. package/dist/module/runtime/native/styles/calc.js.map +0 -1
  382. package/dist/module/runtime/native/styles/filters.js.map +0 -1
  383. package/dist/module/runtime/native/styles/platform-functions.js.map +0 -1
  384. package/dist/module/runtime/native/styles/shorthand.js.map +0 -1
  385. package/dist/module/runtime/native/styles/text-shadow.js.map +0 -1
  386. package/dist/module/runtime/native/styles/transform.js.map +0 -1
  387. package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts +0 -9
  388. package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts.map +0 -1
  389. package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts +0 -2
  390. package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts.map +0 -1
  391. package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts +0 -3
  392. package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts.map +0 -1
  393. package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts +0 -3
  394. package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts.map +0 -1
  395. package/dist/typescript/commonjs/src/runtime/native/styles/filters.d.ts.map +0 -1
  396. package/dist/typescript/commonjs/src/runtime/native/styles/platform-functions.d.ts.map +0 -1
  397. package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts.map +0 -1
  398. package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts +0 -2
  399. package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts.map +0 -1
  400. package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts.map +0 -1
  401. package/dist/typescript/module/src/runtime/native/styles/animation.d.ts +0 -9
  402. package/dist/typescript/module/src/runtime/native/styles/animation.d.ts.map +0 -1
  403. package/dist/typescript/module/src/runtime/native/styles/border.d.ts +0 -2
  404. package/dist/typescript/module/src/runtime/native/styles/border.d.ts.map +0 -1
  405. package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts +0 -3
  406. package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts.map +0 -1
  407. package/dist/typescript/module/src/runtime/native/styles/calc.d.ts +0 -3
  408. package/dist/typescript/module/src/runtime/native/styles/calc.d.ts.map +0 -1
  409. package/dist/typescript/module/src/runtime/native/styles/filters.d.ts.map +0 -1
  410. package/dist/typescript/module/src/runtime/native/styles/platform-functions.d.ts.map +0 -1
  411. package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts.map +0 -1
  412. package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts +0 -2
  413. package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts.map +0 -1
  414. package/dist/typescript/module/src/runtime/native/styles/transform.d.ts.map +0 -1
  415. /package/dist/commonjs/runtime/native/styles/{transform.js → shorthands/transform.js} +0 -0
  416. /package/dist/module/runtime/native/styles/{transform.js → shorthands/transform.js} +0 -0
@@ -6,7 +6,7 @@ test("nested classes", () => {
6
6
  color: red;
7
7
  }`);
8
8
 
9
- expect(compiled).toStrictEqual({
9
+ expect(compiled.stylesheet()).toStrictEqual({
10
10
  s: [
11
11
  [
12
12
  "my-class",
@@ -38,7 +38,7 @@ test("multiple tiers classes", () => {
38
38
  color: red;
39
39
  }`);
40
40
 
41
- expect(compiled).toStrictEqual({
41
+ expect(compiled.stylesheet()).toStrictEqual({
42
42
  s: [
43
43
  [
44
44
  "one",
@@ -79,7 +79,7 @@ test("tiers with multiple classes", () => {
79
79
  color: red;
80
80
  }`);
81
81
 
82
- expect(compiled).toStrictEqual({
82
+ expect(compiled.stylesheet()).toStrictEqual({
83
83
  s: [
84
84
  [
85
85
  "one",
@@ -94,8 +94,9 @@ test("tiers with multiple classes", () => {
94
94
  "three",
95
95
  [
96
96
  {
97
- c: ["three"],
97
+ c: ["three.two"],
98
98
  s: [0],
99
+ aq: [["a", "className", "*=", "two"]],
99
100
  },
100
101
  ],
101
102
  ],
@@ -106,8 +107,7 @@ test("tiers with multiple classes", () => {
106
107
  cq: [
107
108
  { n: "one" },
108
109
  {
109
- a: [["a", "className", "*=", "two"]],
110
- n: "three",
110
+ n: "three.two",
111
111
  },
112
112
  ],
113
113
  d: [{ color: "#f00" }],
@@ -30,7 +30,7 @@ export function parseEasingFunction(
30
30
  case "cubic-bezier":
31
31
  return [
32
32
  {},
33
- "cubic-bezier",
33
+ "cubicBezier",
34
34
  [value.x1, value.y1, value.x2, value.y2],
35
35
  ] as const;
36
36
  case "steps":
@@ -0,0 +1,531 @@
1
+ import type { Selector, SelectorList } from "lightningcss";
2
+
3
+ import { Specificity } from "../runtime/utils";
4
+ import type {
5
+ AttributeQuery,
6
+ AttrSelectorOperator,
7
+ CompilerOptions,
8
+ ContainerQuery,
9
+ MediaCondition,
10
+ PseudoClassesQuery,
11
+ SpecificityArray,
12
+ } from "./compiler.types";
13
+
14
+ interface ReactNativeClassNameSelector {
15
+ type: "className";
16
+ specificity: SpecificityArray;
17
+ className: string;
18
+ mediaQuery?: MediaCondition[];
19
+ containerQuery?: ContainerQuery[];
20
+ pseudoClassesQuery?: PseudoClassesQuery;
21
+ attributeQuery?: AttributeQuery[];
22
+ }
23
+
24
+ interface ReactNativeGlobalSelector {
25
+ type: "rootVariables" | "universalVariables";
26
+ }
27
+
28
+ type PartialSelector = Partial<ReactNativeClassNameSelector> & {
29
+ type: "className";
30
+ specificity: SpecificityArray;
31
+ };
32
+
33
+ const containerQueryMap = new WeakMap<WeakKey, ContainerQuery[]>();
34
+ const attributeQueryMap = new WeakMap<WeakKey, AttributeQuery[]>();
35
+ const pseudoClassesQueryMap = new WeakMap<WeakKey, PseudoClassesQuery>();
36
+
37
+ type ContainerQueryWithSpecificity = ContainerQuery & {
38
+ specificity: SpecificityArray;
39
+ };
40
+
41
+ export function getClassNameSelectors(
42
+ selectors: SelectorList,
43
+ options: CompilerOptions = {},
44
+ specificity: SpecificityArray = [0],
45
+ root: PartialSelector = {
46
+ type: "className",
47
+ specificity: [],
48
+ },
49
+ ) {
50
+ if (!selectors.length) {
51
+ return [];
52
+ }
53
+
54
+ return selectors.flatMap(
55
+ (selector): (ReactNativeGlobalSelector | PartialSelector)[] => {
56
+ if (isRootVariableSelector(selector)) {
57
+ return [{ type: "rootVariables" }];
58
+ } else {
59
+ return (
60
+ parseComponents(
61
+ selector.reverse(),
62
+ options,
63
+ root,
64
+ root,
65
+ specificity,
66
+ ) ?? []
67
+ );
68
+ }
69
+ },
70
+ );
71
+ }
72
+
73
+ function parseComponents(
74
+ [component, ...rest]: Selector,
75
+ options: CompilerOptions,
76
+ root: PartialSelector,
77
+ ref: PartialSelector | ContainerQuery,
78
+ specificity: SpecificityArray,
79
+ ): PartialSelector[] | null {
80
+ if (!component || Array.isArray(component.type)) {
81
+ // Merge the specificity with the root specificity
82
+ for (let i = 0; i < specificity.length; i++) {
83
+ const value = specificity[i];
84
+ if (value !== undefined) {
85
+ root.specificity[i] = (root.specificity[i] ?? 0) + value;
86
+ }
87
+ }
88
+
89
+ // Return the root
90
+ return [root];
91
+ }
92
+
93
+ switch (component.type) {
94
+ case "id": // #id
95
+ case "namespace": // @namespace
96
+ case "universal": // * - universal selector
97
+ return null;
98
+ case "type": {
99
+ // div, span
100
+ if (
101
+ component.name === options.selectorPrefix ||
102
+ component.name === "html"
103
+ ) {
104
+ return parseComponents(rest, options, root, ref, specificity);
105
+ } else {
106
+ return null;
107
+ }
108
+ }
109
+ case "nesting":
110
+ // &
111
+ // The SelectorList should be flattened, so we can skip these
112
+ return parseComponents(rest, options, root, ref, specificity);
113
+ case "combinator": {
114
+ // We only support the descendant combinator
115
+ if (component.value === "descendant") {
116
+ // Switch to now parsing a container query
117
+ ref = {};
118
+ return parseComponents(rest, options, root, ref, specificity);
119
+ }
120
+
121
+ return [];
122
+ }
123
+ case "pseudo-element": {
124
+ // TODO: Support ::selection, ::placeholder, etc
125
+ return [];
126
+ }
127
+ case "pseudo-class": {
128
+ switch (component.kind) {
129
+ case "hover": {
130
+ getPseudoClassesQuery(ref).h = 1;
131
+ specificity[Specificity.PseudoClass] =
132
+ (specificity[Specificity.PseudoClass] ?? 0) + 1;
133
+ return parseComponents(rest, options, root, ref, specificity);
134
+ }
135
+ case "active": {
136
+ getPseudoClassesQuery(ref).a = 1;
137
+ specificity[Specificity.PseudoClass] =
138
+ (specificity[Specificity.PseudoClass] ?? 0) + 1;
139
+ return parseComponents(rest, options, root, ref, specificity);
140
+ }
141
+ case "focus": {
142
+ getPseudoClassesQuery(ref).f = 1;
143
+ specificity[Specificity.PseudoClass] =
144
+ (specificity[Specificity.PseudoClass] ?? 0) + 1;
145
+ return parseComponents(rest, options, root, ref, specificity);
146
+ }
147
+ case "disabled": {
148
+ getAttributeQuery(ref).push(["a", "disabled"]);
149
+ specificity[Specificity.PseudoClass] =
150
+ (specificity[Specificity.PseudoClass] ?? 0) + 1;
151
+ return parseComponents(rest, options, root, ref, specificity);
152
+ }
153
+ case "empty": {
154
+ getAttributeQuery(ref).push(["a", "children", "!"]);
155
+ specificity[Specificity.PseudoClass] =
156
+ (specificity[Specificity.PseudoClass] ?? 0) + 1;
157
+ return parseComponents(rest, options, root, ref, specificity);
158
+ }
159
+ case "where":
160
+ case "is": {
161
+ // Now get the selectors inside the `is` or `where` pseudo-class
162
+ const isWhereContainerQueries = component.selectors.flatMap(
163
+ (selector) => {
164
+ return parseIsWhereComponents(component.kind, selector) ?? [];
165
+ },
166
+ );
167
+
168
+ // Remember we're looping in reverse order,
169
+ // So `rest` contains the selectors BEFORE this one
170
+ const parents = parseComponents(
171
+ rest,
172
+ options,
173
+ root,
174
+ ref,
175
+ specificity,
176
+ );
177
+
178
+ if (!parents) {
179
+ return null;
180
+ }
181
+
182
+ // Each parent selector should be combined with each pseudo-class selector
183
+ return parents.flatMap((parent) => {
184
+ const originalParent = { ...parent };
185
+
186
+ return isWhereContainerQueries.map(({ specificity, ...query }) => {
187
+ parent = { ...originalParent };
188
+ parent.specificity = [...originalParent.specificity];
189
+ parent.containerQuery = [
190
+ ...(originalParent.containerQuery ?? []),
191
+ ];
192
+
193
+ if (component.kind === "is") {
194
+ for (let i = 0; i < specificity.length; i++) {
195
+ const value = specificity[i];
196
+ if (value !== undefined) {
197
+ parent.specificity[i] =
198
+ (parent.specificity[i] ?? 0) + value;
199
+ }
200
+ }
201
+ }
202
+
203
+ parent.containerQuery.push(query);
204
+
205
+ return parent;
206
+ });
207
+ });
208
+ }
209
+ default: {
210
+ return [];
211
+ }
212
+ }
213
+ }
214
+ case "attribute": {
215
+ // specificity[Specificity.ClassName] =
216
+ // (specificity[Specificity.ClassName] ?? 0) + 1;
217
+ const attributeQuery: AttributeQuery = component.name.startsWith("data-")
218
+ ? // [data-*] are turned into `dataSet` queries
219
+ ["d", toRNProperty(component.name.replace("data-", ""))]
220
+ : // Everything else is turned into `attribute` queries
221
+ ["a", toRNProperty(component.name)];
222
+ if (component.operation) {
223
+ let operator: AttrSelectorOperator | undefined;
224
+ switch (component.operation.operator) {
225
+ case "equal":
226
+ operator = "=";
227
+ break;
228
+ case "includes":
229
+ operator = "~=";
230
+ break;
231
+ case "dash-match":
232
+ operator = "|=";
233
+ break;
234
+ case "prefix":
235
+ operator = "^=";
236
+ break;
237
+ case "substring":
238
+ operator = "*=";
239
+ break;
240
+ case "suffix":
241
+ operator = "$=";
242
+ break;
243
+ default:
244
+ component.operation.operator satisfies never;
245
+ break;
246
+ }
247
+ if (operator) {
248
+ // Append the operator onto the attribute query
249
+ attributeQuery.push(operator, component.operation.value);
250
+ }
251
+ }
252
+ getAttributeQuery(ref).push(attributeQuery);
253
+ specificity[Specificity.ClassName] =
254
+ (specificity[Specificity.ClassName] ?? 0) + 1;
255
+ return parseComponents(rest, options, root, ref, specificity);
256
+ }
257
+ case "class": {
258
+ if (component.name === options.selectorPrefix) {
259
+ // Skip this one
260
+ return parseComponents(rest, options, root, ref, specificity);
261
+ } else if (!isContainerQuery(ref) && !ref.className) {
262
+ ref.className = component.name;
263
+ specificity[Specificity.ClassName] =
264
+ (specificity[Specificity.ClassName] ?? 0) + 1;
265
+ return parseComponents(rest, options, root, ref, specificity);
266
+ } else if (!isContainerQuery(ref)) {
267
+ // Only the first className is used, the rest are attribute queries
268
+ getAttributeQuery(ref).unshift([
269
+ "a",
270
+ "className",
271
+ "*=",
272
+ component.name,
273
+ ]);
274
+ } else {
275
+ let containerQueries = containerQueryMap.get(root);
276
+ if (!containerQueries) {
277
+ containerQueries = [];
278
+ root.containerQuery = containerQueries;
279
+ containerQueryMap.set(root, containerQueries);
280
+ }
281
+ if (!ref.n) {
282
+ containerQueries.unshift(ref);
283
+ }
284
+
285
+ ref.n = ref.n ? `${ref.n}.${component.name}` : component.name;
286
+ }
287
+
288
+ specificity[Specificity.ClassName] =
289
+ (specificity[Specificity.ClassName] ?? 0) + 1;
290
+ return parseComponents(rest, options, root, ref, specificity);
291
+ }
292
+ }
293
+ }
294
+
295
+ function parseIsWhereComponents(
296
+ type: "is" | "where",
297
+ selector: Selector,
298
+ index = 0,
299
+ queries?: ContainerQueryWithSpecificity[],
300
+ ): ContainerQueryWithSpecificity[] | null {
301
+ const component = selector[index];
302
+
303
+ if (!component || Array.isArray(component.type)) {
304
+ return queries ?? [];
305
+ }
306
+
307
+ switch (component.type) {
308
+ // These are not allowed in `is()` or `where()`
309
+ case "id": // #id
310
+ case "namespace": // @namespace
311
+ case "type": // div, span
312
+ case "nesting": // &
313
+ case "pseudo-element": // ::selection, ::placeholder, etc
314
+ return null;
315
+ case "combinator": {
316
+ // We only support the descendant combinator
317
+ if (component.value === "descendant") {
318
+ // Each "block" is a new container query
319
+ const children = parseIsWhereComponents(type, selector, index + 1);
320
+ return children && queries ? [...queries, ...children] : children;
321
+ }
322
+ return null;
323
+ }
324
+ case "universal": {
325
+ // * - universal selector
326
+ if (index !== selector.length - 1) {
327
+ // We only accept it in the last position
328
+ return null;
329
+ }
330
+
331
+ // This was the only component, so we return the ref
332
+ if (selector.length === 1) {
333
+ return queries ?? [{ specificity: [] }];
334
+ }
335
+
336
+ const previous = selector[index - 1];
337
+
338
+ // If the previous component is not a descendant combinator,
339
+ if (
340
+ !previous ||
341
+ previous.type !== "combinator" ||
342
+ previous.value !== "descendant"
343
+ ) {
344
+ return null;
345
+ }
346
+
347
+ return parseIsWhereComponents(type, selector, index + 1, queries);
348
+ }
349
+ case "pseudo-class": {
350
+ // const specificity = ref.specificity;
351
+
352
+ // specificity[Specificity.ClassName] =
353
+ // (specificity[Specificity.ClassName] ?? 0) + 1;
354
+ switch (component.kind) {
355
+ case "hover": {
356
+ queries ??= [{ specificity: [] }];
357
+ queries.forEach((query) => {
358
+ getPseudoClassesQuery(query).h = 1;
359
+ });
360
+ return parseIsWhereComponents(type, selector, index + 1, queries);
361
+ }
362
+ case "active": {
363
+ queries ??= [{ specificity: [] }];
364
+ queries.forEach((query) => {
365
+ getPseudoClassesQuery(query).a = 1;
366
+ });
367
+ return parseIsWhereComponents(type, selector, index + 1, queries);
368
+ }
369
+ case "focus": {
370
+ queries ??= [{ specificity: [] }];
371
+ queries.forEach((query) => {
372
+ getPseudoClassesQuery(query).f = 1;
373
+ });
374
+ return parseIsWhereComponents(type, selector, index + 1, queries);
375
+ }
376
+ case "disabled": {
377
+ queries ??= [{ specificity: [] }];
378
+ queries.forEach((query) => {
379
+ getAttributeQuery(query).push(["a", "disabled"]);
380
+ });
381
+ return parseIsWhereComponents(type, selector, index + 1, queries);
382
+ }
383
+ case "empty": {
384
+ queries ??= [{ specificity: [] }];
385
+ queries.forEach((query) => {
386
+ getAttributeQuery(query).push(["a", "children", "!"]);
387
+ });
388
+ return parseIsWhereComponents(type, selector, index + 1, queries);
389
+ }
390
+ case "where":
391
+ case "is": {
392
+ // :is() and :where() need to be at the start of the selector,
393
+ if (index !== 0) {
394
+ return null;
395
+ }
396
+
397
+ // Now get the selectors inside the `is` or `where` pseudo-class
398
+ queries = component.selectors.flatMap((selector) => {
399
+ return parseIsWhereComponents(type, selector, 0, queries) ?? [];
400
+ });
401
+
402
+ return parseIsWhereComponents(type, selector, index + 1, queries);
403
+ }
404
+ default: {
405
+ return null;
406
+ }
407
+ }
408
+ }
409
+ case "attribute": {
410
+ if (type !== "where") {
411
+ // specificity[Specificity.ClassName] =
412
+ // (specificity[Specificity.ClassName] ?? 0) + 1;
413
+ }
414
+ const attributeQuery: AttributeQuery = component.name.startsWith("data-")
415
+ ? // [data-*] are turned into `dataSet` queries
416
+ ["d", toRNProperty(component.name.replace("data-", ""))]
417
+ : // Everything else is turned into `attribute` queries
418
+ ["a", toRNProperty(component.name)];
419
+ if (component.operation) {
420
+ let operator: AttrSelectorOperator | undefined;
421
+ switch (component.operation.operator) {
422
+ case "equal":
423
+ operator = "=";
424
+ break;
425
+ case "includes":
426
+ operator = "~=";
427
+ break;
428
+ case "dash-match":
429
+ operator = "|=";
430
+ break;
431
+ case "prefix":
432
+ operator = "^=";
433
+ break;
434
+ case "substring":
435
+ operator = "*=";
436
+ break;
437
+ case "suffix":
438
+ operator = "$=";
439
+ break;
440
+ default:
441
+ component.operation.operator satisfies never;
442
+ break;
443
+ }
444
+ if (operator) {
445
+ // Append the operator onto the attribute query
446
+ attributeQuery.push(operator, component.operation.value);
447
+ }
448
+ }
449
+ queries ??= [{ specificity: [] }];
450
+ for (const query of queries) {
451
+ if (type === "is") {
452
+ query.specificity[Specificity.ClassName] =
453
+ (query.specificity[Specificity.ClassName] ?? 0) + 1;
454
+ }
455
+ getAttributeQuery(query).push(attributeQuery);
456
+ }
457
+ return parseIsWhereComponents(type, selector, index + 1, queries);
458
+ }
459
+ case "class": {
460
+ // In `is` and `where` selectors, the ref will always be a container query
461
+ queries ??= [{ specificity: [] }];
462
+ for (const query of queries) {
463
+ if (type === "is") {
464
+ query.specificity[Specificity.ClassName] =
465
+ (query.specificity[Specificity.ClassName] ?? 0) + 1;
466
+ }
467
+
468
+ query.n = query.n ? `${query.n}.${component.name}` : component.name;
469
+ }
470
+
471
+ return parseIsWhereComponents(type, selector, index + 1, queries);
472
+ }
473
+ }
474
+ }
475
+
476
+ function isContainerQuery(
477
+ value: PartialSelector | ContainerQuery,
478
+ ): value is ContainerQuery {
479
+ return !("type" in value);
480
+ }
481
+
482
+ function getPseudoClassesQuery(key: PartialSelector | ContainerQuery) {
483
+ let pseudoClassesQuery = pseudoClassesQueryMap.get(key);
484
+ if (!pseudoClassesQuery) {
485
+ if ("type" in key) {
486
+ pseudoClassesQuery = {};
487
+ key.pseudoClassesQuery = pseudoClassesQuery;
488
+ } else {
489
+ key.p ??= {};
490
+ pseudoClassesQuery = key.p;
491
+ }
492
+ pseudoClassesQueryMap.set(key, pseudoClassesQuery);
493
+ }
494
+
495
+ return pseudoClassesQuery;
496
+ }
497
+
498
+ function getAttributeQuery(
499
+ key: PartialSelector | ContainerQuery,
500
+ ): AttributeQuery[] {
501
+ let attributeQuery = attributeQueryMap.get(key);
502
+ if (!attributeQuery) {
503
+ if ("type" in key) {
504
+ attributeQuery = [];
505
+ key.attributeQuery = attributeQuery;
506
+ } else {
507
+ key.a ??= [];
508
+ attributeQuery = key.a;
509
+ }
510
+ attributeQueryMap.set(key, attributeQuery);
511
+ }
512
+
513
+ return attributeQuery;
514
+ }
515
+
516
+ function isRootVariableSelector([first, second]: Selector) {
517
+ return (
518
+ first && !second && first.type === "pseudo-class" && first.kind === "root"
519
+ );
520
+ }
521
+
522
+ export function toRNProperty<T extends string>(str: T) {
523
+ return str
524
+ .replace(/^-rn-/, "")
525
+ .replace(/-./g, (x) => x[1]?.toUpperCase() ?? "") as CamelCase<T>;
526
+ }
527
+
528
+ type CamelCase<S extends string> =
529
+ S extends `${infer P1}-${infer P2}${infer P3}`
530
+ ? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}`
531
+ : Lowercase<S>;
@@ -11,6 +11,7 @@ import type {
11
11
  PseudoClassesQuery,
12
12
  SpecificityArray,
13
13
  } from "./compiler.types";
14
+ import { StylesheetBuilder } from "./stylesheet";
14
15
 
15
16
  export type NormalizeSelector =
16
17
  | ClassNameSelector
@@ -35,13 +36,13 @@ type ClassNameSelector = {
35
36
  export function getSelectors(
36
37
  selectorList: SelectorList,
37
38
  isDarkMode: boolean,
38
- options: CompilerOptions,
39
+ builder: StylesheetBuilder,
39
40
  selectors: NormalizeSelector[] = [],
40
41
  ) {
41
42
  for (let cssSelector of selectorList) {
42
- // Ignore `:is()`, and just process its selectors
43
- if (isIsPseudoClass(cssSelector)) {
44
- getSelectors(cssSelector[0].selectors, isDarkMode, options, selectors);
43
+ // Ignore `:is()` & `:where()`, and just process its selectors
44
+ if (isIsPseudoClass(cssSelector) || isWherePseudoClass(cssSelector)) {
45
+ getSelectors(cssSelector[0].selectors, isDarkMode, builder, selectors);
45
46
  } else if (
46
47
  // Matches: :root {}
47
48
  isRootVariableSelector(cssSelector)
@@ -110,7 +111,7 @@ export function getSelectors(
110
111
  // ["=", "prefers-color-scheme", "dark"],
111
112
  // ]);
112
113
  } else {
113
- const selector = classNameSelector(cssSelector, options);
114
+ const selector = classNameSelector(cssSelector, builder.getOptions());
114
115
 
115
116
  if (selector === null) {
116
117
  continue;
@@ -178,11 +179,12 @@ function classNameSelector(
178
179
  switch (component.type) {
179
180
  case "universal":
180
181
  case "namespace":
181
- case "nesting":
182
182
  case "id":
183
183
  case "pseudo-element":
184
184
  // We don't support these selectors at all
185
185
  return null;
186
+ case "nesting":
187
+ continue;
186
188
  case "class": {
187
189
  if (!primaryClassName) {
188
190
  primaryClassName = component.name;
@@ -371,6 +373,18 @@ function isIsPseudoClass(
371
373
  );
372
374
  }
373
375
 
376
+ function isWherePseudoClass(
377
+ selector: Selector,
378
+ ): selector is [
379
+ { type: "pseudo-class"; kind: "where"; selectors: Selector[] },
380
+ ] {
381
+ return (
382
+ selector.length === 1 &&
383
+ selector[0]?.type === "pseudo-class" &&
384
+ selector[0].kind === "where"
385
+ );
386
+ }
387
+
374
388
  // function isDarkModeMediaQuery(query?: MediaCondition): boolean {
375
389
  // if (!query) return false;
376
390