react-native-css 3.0.0-nightly.df0f885 → 3.0.0-preview.0

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