react-native-css 3.0.0-nightly.8dd703d → 3.0.0-nightly.9c84741

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 (368) hide show
  1. package/dist/commonjs/compiler/compiler.js +12 -5
  2. package/dist/commonjs/compiler/compiler.js.map +1 -1
  3. package/dist/commonjs/compiler/declarations.js +89 -82
  4. package/dist/commonjs/compiler/declarations.js.map +1 -1
  5. package/dist/commonjs/compiler/inheritance.test.js +10 -10
  6. package/dist/commonjs/compiler/inheritance.test.js.map +1 -1
  7. package/dist/commonjs/compiler/pseudo-elements.js +49 -0
  8. package/dist/commonjs/compiler/pseudo-elements.js.map +1 -0
  9. package/dist/commonjs/compiler/selector-builder.js +124 -80
  10. package/dist/commonjs/compiler/selector-builder.js.map +1 -1
  11. package/dist/commonjs/compiler/stylesheet.js +18 -6
  12. package/dist/commonjs/compiler/stylesheet.js.map +1 -1
  13. package/dist/commonjs/compiler/supports.js +27 -0
  14. package/dist/commonjs/compiler/supports.js.map +1 -0
  15. package/dist/commonjs/components/ActivityIndicator.js +22 -0
  16. package/dist/commonjs/components/ActivityIndicator.js.map +1 -0
  17. package/dist/commonjs/components/Button.js +22 -0
  18. package/dist/commonjs/components/Button.js.map +1 -0
  19. package/dist/commonjs/components/FlatList.js +19 -0
  20. package/dist/commonjs/components/FlatList.js.map +1 -0
  21. package/dist/commonjs/components/Image.js +17 -0
  22. package/dist/commonjs/components/Image.js.map +1 -0
  23. package/dist/commonjs/components/Switch.js +17 -0
  24. package/dist/commonjs/components/Switch.js.map +1 -0
  25. package/dist/commonjs/components/TextInput.js +17 -0
  26. package/dist/commonjs/components/TextInput.js.map +1 -0
  27. package/dist/commonjs/components/index.js +48 -0
  28. package/dist/commonjs/components/index.js.map +1 -1
  29. package/dist/commonjs/components/react-native-safe-area-context.js +17 -0
  30. package/dist/commonjs/components/react-native-safe-area-context.js.map +1 -0
  31. package/dist/commonjs/components/react-native-safe-area-context.native.js +53 -0
  32. package/dist/commonjs/components/react-native-safe-area-context.native.js.map +1 -0
  33. package/dist/commonjs/jest/index.js +5 -5
  34. package/dist/commonjs/jest/index.js.map +1 -1
  35. package/dist/commonjs/metro/index.js +6 -3
  36. package/dist/commonjs/metro/index.js.map +1 -1
  37. package/dist/commonjs/metro/injection-code.js +5 -10
  38. package/dist/commonjs/metro/injection-code.js.map +1 -1
  39. package/dist/commonjs/metro/metro-transformer.js +18 -8
  40. package/dist/commonjs/metro/metro-transformer.js.map +1 -1
  41. package/dist/commonjs/metro/resolver.js +3 -0
  42. package/dist/commonjs/metro/resolver.js.map +1 -1
  43. package/dist/commonjs/poison.pill.js +10 -10
  44. package/dist/commonjs/runtime/native/api.js +8 -2
  45. package/dist/commonjs/runtime/native/api.js.map +1 -1
  46. package/dist/commonjs/runtime/native/conditions/index.js +4 -2
  47. package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
  48. package/dist/commonjs/runtime/native/conditions/media-query.js +14 -11
  49. package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
  50. package/dist/commonjs/runtime/native/react/rules.js +26 -20
  51. package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
  52. package/dist/commonjs/runtime/native/reactivity.js +11 -0
  53. package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
  54. package/dist/commonjs/runtime/native/styles/calculate-props.js +25 -8
  55. package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -1
  56. package/dist/commonjs/runtime/native/styles/functions/calc.js +97 -57
  57. package/dist/commonjs/runtime/native/styles/functions/calc.js.map +1 -1
  58. package/dist/commonjs/runtime/native/styles/functions/index.js +22 -0
  59. package/dist/commonjs/runtime/native/styles/functions/index.js.map +1 -1
  60. package/dist/commonjs/runtime/native/styles/functions/numeric-functions.js +32 -0
  61. package/dist/commonjs/runtime/native/styles/functions/numeric-functions.js.map +1 -0
  62. package/dist/commonjs/runtime/native/styles/functions/string-functions.js +23 -0
  63. package/dist/commonjs/runtime/native/styles/functions/string-functions.js.map +1 -0
  64. package/dist/commonjs/runtime/native/styles/functions/transform-functions.js +91 -53
  65. package/dist/commonjs/runtime/native/styles/functions/transform-functions.js.map +1 -1
  66. package/dist/commonjs/runtime/native/styles/shorthands/animation.js +2 -2
  67. package/dist/commonjs/runtime/native/styles/shorthands/animation.js.map +1 -1
  68. package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js +14 -4
  69. package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js.map +1 -1
  70. package/dist/commonjs/runtime/native/styles/shorthands/transform.js +1 -1
  71. package/dist/commonjs/runtime/native/styles/shorthands/transform.js.map +1 -1
  72. package/dist/commonjs/runtime/native/styles/variables.js +3 -3
  73. package/dist/commonjs/runtime/native/styles/variables.js.map +1 -1
  74. package/dist/commonjs/runtime/utils/objects.js +6 -18
  75. package/dist/commonjs/runtime/utils/objects.js.map +1 -1
  76. package/dist/commonjs/runtime/web/api.js.map +1 -1
  77. package/dist/commonjs/style-collection/index.js +110 -0
  78. package/dist/commonjs/style-collection/index.js.map +1 -0
  79. package/dist/commonjs/{runtime/native → style-collection}/root.js +2 -2
  80. package/dist/commonjs/style-collection/root.js.map +1 -0
  81. package/dist/module/compiler/compiler.js +12 -5
  82. package/dist/module/compiler/compiler.js.map +1 -1
  83. package/dist/module/compiler/compiler.types.js +1 -1
  84. package/dist/module/compiler/compiler.types.js.map +1 -1
  85. package/dist/module/compiler/declarations.js +89 -82
  86. package/dist/module/compiler/declarations.js.map +1 -1
  87. package/dist/module/compiler/inheritance.test.js +10 -10
  88. package/dist/module/compiler/inheritance.test.js.map +1 -1
  89. package/dist/module/compiler/pseudo-elements.js +44 -0
  90. package/dist/module/compiler/pseudo-elements.js.map +1 -0
  91. package/dist/module/compiler/selector-builder.js +124 -80
  92. package/dist/module/compiler/selector-builder.js.map +1 -1
  93. package/dist/module/compiler/stylesheet.js +18 -6
  94. package/dist/module/compiler/stylesheet.js.map +1 -1
  95. package/dist/module/compiler/supports.js +23 -0
  96. package/dist/module/compiler/supports.js.map +1 -0
  97. package/dist/module/components/ActivityIndicator.js +17 -0
  98. package/dist/module/components/ActivityIndicator.js.map +1 -0
  99. package/dist/module/components/Button.js +17 -0
  100. package/dist/module/components/Button.js.map +1 -0
  101. package/dist/module/components/FlatList.js +14 -0
  102. package/dist/module/components/FlatList.js.map +1 -0
  103. package/dist/module/components/Image.js +12 -0
  104. package/dist/module/components/Image.js.map +1 -0
  105. package/dist/module/components/Switch.js +12 -0
  106. package/dist/module/components/Switch.js.map +1 -0
  107. package/dist/module/components/TextInput.js +12 -0
  108. package/dist/module/components/TextInput.js.map +1 -0
  109. package/dist/module/components/index.js +6 -0
  110. package/dist/module/components/index.js.map +1 -1
  111. package/dist/module/components/react-native-safe-area-context.js +4 -0
  112. package/dist/module/components/react-native-safe-area-context.js.map +1 -0
  113. package/dist/module/components/react-native-safe-area-context.native.js +36 -0
  114. package/dist/module/components/react-native-safe-area-context.native.js.map +1 -0
  115. package/dist/module/jest/index.js +2 -2
  116. package/dist/module/jest/index.js.map +1 -1
  117. package/dist/module/metro/index.js +6 -3
  118. package/dist/module/metro/index.js.map +1 -1
  119. package/dist/module/metro/injection-code.js +5 -10
  120. package/dist/module/metro/injection-code.js.map +1 -1
  121. package/dist/module/metro/metro-transformer.js +18 -8
  122. package/dist/module/metro/metro-transformer.js.map +1 -1
  123. package/dist/module/metro/resolver.js +3 -0
  124. package/dist/module/metro/resolver.js.map +1 -1
  125. package/dist/module/poison.pill.js +10 -10
  126. package/dist/module/runtime/native/api.js +2 -1
  127. package/dist/module/runtime/native/api.js.map +1 -1
  128. package/dist/module/runtime/native/conditions/index.js +4 -2
  129. package/dist/module/runtime/native/conditions/index.js.map +1 -1
  130. package/dist/module/runtime/native/conditions/media-query.js +15 -12
  131. package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
  132. package/dist/module/runtime/native/react/rules.js +24 -19
  133. package/dist/module/runtime/native/react/rules.js.map +1 -1
  134. package/dist/module/runtime/native/reactivity.js +11 -0
  135. package/dist/module/runtime/native/reactivity.js.map +1 -1
  136. package/dist/module/runtime/native/styles/calculate-props.js +25 -8
  137. package/dist/module/runtime/native/styles/calculate-props.js.map +1 -1
  138. package/dist/module/runtime/native/styles/functions/calc.js +97 -56
  139. package/dist/module/runtime/native/styles/functions/calc.js.map +1 -1
  140. package/dist/module/runtime/native/styles/functions/index.js +2 -0
  141. package/dist/module/runtime/native/styles/functions/index.js.map +1 -1
  142. package/dist/module/runtime/native/styles/functions/numeric-functions.js +25 -0
  143. package/dist/module/runtime/native/styles/functions/numeric-functions.js.map +1 -0
  144. package/dist/module/runtime/native/styles/functions/string-functions.js +18 -0
  145. package/dist/module/runtime/native/styles/functions/string-functions.js.map +1 -0
  146. package/dist/module/runtime/native/styles/functions/transform-functions.js +91 -53
  147. package/dist/module/runtime/native/styles/functions/transform-functions.js.map +1 -1
  148. package/dist/module/runtime/native/styles/shorthands/animation.js +1 -1
  149. package/dist/module/runtime/native/styles/shorthands/animation.js.map +1 -1
  150. package/dist/module/runtime/native/styles/shorthands/box-shadow.js +14 -4
  151. package/dist/module/runtime/native/styles/shorthands/box-shadow.js.map +1 -1
  152. package/dist/module/runtime/native/styles/shorthands/transform.js +1 -1
  153. package/dist/module/runtime/native/styles/shorthands/transform.js.map +1 -1
  154. package/dist/module/runtime/native/styles/variables.js +1 -1
  155. package/dist/module/runtime/native/styles/variables.js.map +1 -1
  156. package/dist/module/runtime/utils/objects.js +6 -18
  157. package/dist/module/runtime/utils/objects.js.map +1 -1
  158. package/dist/module/runtime/web/api.js.map +1 -1
  159. package/dist/module/style-collection/index.js +95 -0
  160. package/dist/module/style-collection/index.js.map +1 -0
  161. package/dist/module/{runtime/native → style-collection}/root.js +2 -2
  162. package/dist/module/style-collection/root.js.map +1 -0
  163. package/dist/typescript/commonjs/src/compiler/compiler.d.ts +1 -1
  164. package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
  165. package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +11 -13
  166. package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
  167. package/dist/typescript/commonjs/src/compiler/declarations.d.ts +4 -2
  168. package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
  169. package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts +4 -0
  170. package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts.map +1 -0
  171. package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts +1 -0
  172. package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -1
  173. package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +2 -2
  174. package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
  175. package/dist/typescript/commonjs/src/compiler/supports.d.ts +3 -0
  176. package/dist/typescript/commonjs/src/compiler/supports.d.ts.map +1 -0
  177. package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +13 -0
  178. package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +1 -0
  179. package/dist/typescript/commonjs/src/components/Button.d.ts +13 -0
  180. package/dist/typescript/commonjs/src/components/Button.d.ts.map +1 -0
  181. package/dist/typescript/commonjs/src/components/FlatList.d.ts +10 -0
  182. package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -0
  183. package/dist/typescript/commonjs/src/components/Image.d.ts +8 -0
  184. package/dist/typescript/commonjs/src/components/Image.d.ts.map +1 -0
  185. package/dist/typescript/commonjs/src/components/Switch.d.ts +8 -0
  186. package/dist/typescript/commonjs/src/components/Switch.d.ts.map +1 -0
  187. package/dist/typescript/commonjs/src/components/TextInput.d.ts +8 -0
  188. package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +1 -0
  189. package/dist/typescript/commonjs/src/components/index.d.ts +6 -0
  190. package/dist/typescript/commonjs/src/components/index.d.ts.map +1 -1
  191. package/dist/typescript/commonjs/src/components/react-native-safe-area-context.d.ts +2 -0
  192. package/dist/typescript/commonjs/src/components/react-native-safe-area-context.d.ts.map +1 -0
  193. package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts +4 -0
  194. package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts.map +1 -0
  195. package/dist/typescript/commonjs/src/jest/index.d.ts +3 -3
  196. package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
  197. package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
  198. package/dist/typescript/commonjs/src/metro/injection-code.d.ts +4 -7
  199. package/dist/typescript/commonjs/src/metro/injection-code.d.ts.map +1 -1
  200. package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts +4 -1
  201. package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts.map +1 -1
  202. package/dist/typescript/commonjs/src/metro/resolver.d.ts.map +1 -1
  203. package/dist/typescript/commonjs/src/runtime/native/api.d.ts +3 -1
  204. package/dist/typescript/commonjs/src/runtime/native/api.d.ts.map +1 -1
  205. package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +2 -2
  206. package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts.map +1 -1
  207. package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
  208. package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts +1 -1
  209. package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
  210. package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts.map +1 -1
  211. package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts +2 -0
  212. package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts.map +1 -1
  213. package/dist/typescript/commonjs/src/runtime/native/styles/functions/numeric-functions.d.ts +5 -0
  214. package/dist/typescript/commonjs/src/runtime/native/styles/functions/numeric-functions.d.ts.map +1 -0
  215. package/dist/typescript/commonjs/src/runtime/native/styles/functions/string-functions.d.ts +3 -0
  216. package/dist/typescript/commonjs/src/runtime/native/styles/functions/string-functions.d.ts.map +1 -0
  217. package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -1
  218. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -1
  219. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -1
  220. package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -1
  221. package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -1
  222. package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -1
  223. package/dist/typescript/commonjs/src/runtime/web/api.d.ts +1 -1
  224. package/dist/typescript/commonjs/src/runtime/web/api.d.ts.map +1 -1
  225. package/dist/typescript/commonjs/src/style-collection/index.d.ts +14 -0
  226. package/dist/typescript/commonjs/src/style-collection/index.d.ts.map +1 -0
  227. package/dist/typescript/commonjs/src/{runtime/native → style-collection}/root.d.ts +1 -1
  228. package/dist/typescript/commonjs/src/style-collection/root.d.ts.map +1 -0
  229. package/dist/typescript/module/src/compiler/compiler.d.ts +1 -1
  230. package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
  231. package/dist/typescript/module/src/compiler/compiler.types.d.ts +11 -13
  232. package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
  233. package/dist/typescript/module/src/compiler/declarations.d.ts +4 -2
  234. package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
  235. package/dist/typescript/module/src/compiler/pseudo-elements.d.ts +4 -0
  236. package/dist/typescript/module/src/compiler/pseudo-elements.d.ts.map +1 -0
  237. package/dist/typescript/module/src/compiler/selector-builder.d.ts +1 -0
  238. package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -1
  239. package/dist/typescript/module/src/compiler/stylesheet.d.ts +2 -2
  240. package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
  241. package/dist/typescript/module/src/compiler/supports.d.ts +3 -0
  242. package/dist/typescript/module/src/compiler/supports.d.ts.map +1 -0
  243. package/dist/typescript/module/src/components/ActivityIndicator.d.ts +13 -0
  244. package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +1 -0
  245. package/dist/typescript/module/src/components/Button.d.ts +13 -0
  246. package/dist/typescript/module/src/components/Button.d.ts.map +1 -0
  247. package/dist/typescript/module/src/components/FlatList.d.ts +10 -0
  248. package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -0
  249. package/dist/typescript/module/src/components/Image.d.ts +8 -0
  250. package/dist/typescript/module/src/components/Image.d.ts.map +1 -0
  251. package/dist/typescript/module/src/components/Switch.d.ts +8 -0
  252. package/dist/typescript/module/src/components/Switch.d.ts.map +1 -0
  253. package/dist/typescript/module/src/components/TextInput.d.ts +8 -0
  254. package/dist/typescript/module/src/components/TextInput.d.ts.map +1 -0
  255. package/dist/typescript/module/src/components/index.d.ts +6 -0
  256. package/dist/typescript/module/src/components/index.d.ts.map +1 -1
  257. package/dist/typescript/module/src/components/react-native-safe-area-context.d.ts +2 -0
  258. package/dist/typescript/module/src/components/react-native-safe-area-context.d.ts.map +1 -0
  259. package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts +4 -0
  260. package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts.map +1 -0
  261. package/dist/typescript/module/src/jest/index.d.ts +3 -3
  262. package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
  263. package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
  264. package/dist/typescript/module/src/metro/injection-code.d.ts +4 -7
  265. package/dist/typescript/module/src/metro/injection-code.d.ts.map +1 -1
  266. package/dist/typescript/module/src/metro/metro-transformer.d.ts +4 -1
  267. package/dist/typescript/module/src/metro/metro-transformer.d.ts.map +1 -1
  268. package/dist/typescript/module/src/metro/resolver.d.ts.map +1 -1
  269. package/dist/typescript/module/src/runtime/native/api.d.ts +3 -1
  270. package/dist/typescript/module/src/runtime/native/api.d.ts.map +1 -1
  271. package/dist/typescript/module/src/runtime/native/react/rules.d.ts +2 -2
  272. package/dist/typescript/module/src/runtime/native/react/rules.d.ts.map +1 -1
  273. package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
  274. package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts +1 -1
  275. package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
  276. package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts.map +1 -1
  277. package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts +2 -0
  278. package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts.map +1 -1
  279. package/dist/typescript/module/src/runtime/native/styles/functions/numeric-functions.d.ts +5 -0
  280. package/dist/typescript/module/src/runtime/native/styles/functions/numeric-functions.d.ts.map +1 -0
  281. package/dist/typescript/module/src/runtime/native/styles/functions/string-functions.d.ts +3 -0
  282. package/dist/typescript/module/src/runtime/native/styles/functions/string-functions.d.ts.map +1 -0
  283. package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -1
  284. package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -1
  285. package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -1
  286. package/dist/typescript/module/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -1
  287. package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -1
  288. package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -1
  289. package/dist/typescript/module/src/runtime/web/api.d.ts +1 -1
  290. package/dist/typescript/module/src/runtime/web/api.d.ts.map +1 -1
  291. package/dist/typescript/module/src/style-collection/index.d.ts +14 -0
  292. package/dist/typescript/module/src/style-collection/index.d.ts.map +1 -0
  293. package/dist/typescript/module/src/{runtime/native → style-collection}/root.d.ts +1 -1
  294. package/dist/typescript/module/src/style-collection/root.d.ts.map +1 -0
  295. package/package.json +30 -14
  296. package/src/compiler/compiler.ts +11 -3
  297. package/src/compiler/compiler.types.ts +11 -14
  298. package/src/compiler/declarations.ts +157 -121
  299. package/src/compiler/inheritance.test.ts +9 -9
  300. package/src/compiler/pseudo-elements.ts +54 -0
  301. package/src/compiler/selector-builder.ts +136 -81
  302. package/src/compiler/stylesheet.ts +26 -11
  303. package/src/compiler/supports.ts +26 -0
  304. package/src/components/ActivityIndicator.tsx +27 -0
  305. package/src/components/Button.tsx +22 -0
  306. package/src/components/FlatList.tsx +21 -0
  307. package/src/components/Image.tsx +17 -0
  308. package/src/components/Switch.tsx +17 -0
  309. package/src/components/TextInput.tsx +17 -0
  310. package/src/components/index.tsx +6 -0
  311. package/src/components/react-native-safe-area-context.native.tsx +40 -0
  312. package/src/components/react-native-safe-area-context.tsx +1 -0
  313. package/src/jest/index.ts +3 -2
  314. package/src/metro/index.ts +8 -6
  315. package/src/metro/injection-code.ts +6 -10
  316. package/src/metro/metro-transformer.ts +27 -10
  317. package/src/metro/resolver.ts +8 -0
  318. package/src/poison.pill.ts +10 -10
  319. package/src/runtime/native/api.ts +3 -1
  320. package/src/runtime/native/conditions/index.ts +4 -2
  321. package/src/runtime/native/conditions/media-query.ts +16 -12
  322. package/src/runtime/native/react/rules.ts +27 -17
  323. package/src/runtime/native/reactivity.ts +12 -0
  324. package/src/runtime/native/styles/calculate-props.ts +27 -6
  325. package/src/runtime/native/styles/functions/calc.ts +94 -70
  326. package/src/runtime/native/styles/functions/index.ts +2 -0
  327. package/src/runtime/native/styles/functions/numeric-functions.ts +38 -0
  328. package/src/runtime/native/styles/functions/string-functions.ts +22 -0
  329. package/src/runtime/native/styles/functions/transform-functions.ts +68 -35
  330. package/src/runtime/native/styles/shorthands/animation.ts +2 -1
  331. package/src/runtime/native/styles/shorthands/box-shadow.ts +34 -14
  332. package/src/runtime/native/styles/shorthands/transform.ts +3 -1
  333. package/src/runtime/native/styles/variables.ts +5 -1
  334. package/src/runtime/utils/objects.ts +10 -19
  335. package/src/runtime/web/api.ts +1 -1
  336. package/src/style-collection/index.ts +142 -0
  337. package/src/{runtime/native → style-collection}/root.ts +6 -2
  338. package/dist/commonjs/compiler/attributes.test.js +0 -20
  339. package/dist/commonjs/compiler/attributes.test.js.map +0 -1
  340. package/dist/commonjs/doctor/index.js +0 -6
  341. package/dist/commonjs/doctor/index.js.map +0 -1
  342. package/dist/commonjs/runtime/native/injection.js +0 -99
  343. package/dist/commonjs/runtime/native/injection.js.map +0 -1
  344. package/dist/commonjs/runtime/native/root.js.map +0 -1
  345. package/dist/module/compiler/attributes.test.js +0 -20
  346. package/dist/module/compiler/attributes.test.js.map +0 -1
  347. package/dist/module/doctor/index.js +0 -4
  348. package/dist/module/doctor/index.js.map +0 -1
  349. package/dist/module/runtime/native/injection.js +0 -94
  350. package/dist/module/runtime/native/injection.js.map +0 -1
  351. package/dist/module/runtime/native/root.js.map +0 -1
  352. package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts +0 -2
  353. package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts.map +0 -1
  354. package/dist/typescript/commonjs/src/doctor/index.d.ts +0 -2
  355. package/dist/typescript/commonjs/src/doctor/index.d.ts.map +0 -1
  356. package/dist/typescript/commonjs/src/runtime/native/injection.d.ts +0 -16
  357. package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +0 -1
  358. package/dist/typescript/commonjs/src/runtime/native/root.d.ts.map +0 -1
  359. package/dist/typescript/module/src/compiler/attributes.test.d.ts +0 -2
  360. package/dist/typescript/module/src/compiler/attributes.test.d.ts.map +0 -1
  361. package/dist/typescript/module/src/doctor/index.d.ts +0 -2
  362. package/dist/typescript/module/src/doctor/index.d.ts.map +0 -1
  363. package/dist/typescript/module/src/runtime/native/injection.d.ts +0 -16
  364. package/dist/typescript/module/src/runtime/native/injection.d.ts.map +0 -1
  365. package/dist/typescript/module/src/runtime/native/root.d.ts.map +0 -1
  366. package/src/compiler/attributes.test.ts +0 -28
  367. package/src/doctor/index.ts +0 -1
  368. package/src/runtime/native/injection.ts +0 -131
@@ -7,6 +7,7 @@ import type {
7
7
  BorderStyle,
8
8
  ColorOrAuto,
9
9
  CssColor,
10
+ CustomProperty,
10
11
  Declaration,
11
12
  DimensionPercentageFor_LengthValue,
12
13
  EnvironmentVariable,
@@ -101,6 +102,7 @@ const parsers: {
101
102
  "border-block-end-width": parseBorderSideWidthDeclaration,
102
103
  "border-block-start": parseBorderBlockStart,
103
104
  "border-block-start-color": parseColorDeclaration,
105
+ "border-block-start-style": parseBorderStyleDeclaration,
104
106
  "border-block-start-width": parseBorderSideWidthDeclaration,
105
107
  "border-block-style": parseBorderBlockStyle,
106
108
  "border-block-width": parseBorderBlockWidth,
@@ -238,6 +240,7 @@ const parsers: {
238
240
  "translate": parseTranslate,
239
241
  "user-select": parseUserSelect,
240
242
  "vertical-align": parseVerticalAlign,
243
+ "visibility": parseVisibility,
241
244
  "width": parseSizeDeclaration,
242
245
  "z-index": parseZIndex,
243
246
  };
@@ -435,18 +438,14 @@ function parseBorderBlock(
435
438
  { value }: DeclarationType<"border-block">,
436
439
  builder: StylesheetBuilder,
437
440
  ) {
438
- builder.addDescriptor("border-top-color", parseColor(value.color, builder));
441
+ builder.addDescriptor("border-block-color", parseColor(value.color, builder));
439
442
  builder.addDescriptor(
440
- "border-bottom-color",
441
- parseColor(value.color, builder),
442
- );
443
- builder.addDescriptor(
444
- "border-top-width",
443
+ "border-block-width",
445
444
  parseBorderSideWidth(value.width, builder),
446
445
  );
447
446
  builder.addDescriptor(
448
- "border-bottom-width",
449
- parseBorderSideWidth(value.width, builder),
447
+ "border-block-style",
448
+ parseBorderStyle(value.style, builder),
450
449
  );
451
450
  }
452
451
 
@@ -454,9 +453,12 @@ function parseBorderBlockStart(
454
453
  { value }: DeclarationType<"border-block-start">,
455
454
  builder: StylesheetBuilder,
456
455
  ) {
457
- builder.addDescriptor("border-top-color", parseColor(value.color, builder));
458
456
  builder.addDescriptor(
459
- "border-top-width",
457
+ "border-block-start-color",
458
+ parseColor(value.color, builder),
459
+ );
460
+ builder.addDescriptor(
461
+ "border-block-start-width",
460
462
  parseBorderSideWidth(value.width, builder),
461
463
  );
462
464
  }
@@ -466,11 +468,11 @@ function parseBorderBlockEnd(
466
468
  builder: StylesheetBuilder,
467
469
  ) {
468
470
  builder.addDescriptor(
469
- "border-bottom-color",
471
+ "border-block-end-color",
470
472
  parseColor(value.color, builder),
471
473
  );
472
474
  builder.addDescriptor(
473
- "border-bottom-width",
475
+ "border-block-end-width",
474
476
  parseBorderSideWidth(value.width, builder),
475
477
  );
476
478
  }
@@ -479,38 +481,54 @@ function parseBorderInline(
479
481
  { value }: DeclarationType<"border-inline">,
480
482
  builder: StylesheetBuilder,
481
483
  ) {
482
- builder.addDescriptor("border-left-color", parseColor(value.color, builder));
483
- builder.addDescriptor("border-right-color", parseColor(value.color, builder));
484
484
  builder.addDescriptor(
485
- "border-left-width",
486
- parseBorderSideWidth(value.width, builder),
485
+ "border-inline-color",
486
+ parseColor(value.color, builder),
487
487
  );
488
488
  builder.addDescriptor(
489
- "border-right-width",
489
+ "border-inline-width",
490
490
  parseBorderSideWidth(value.width, builder),
491
491
  );
492
+ builder.addDescriptor(
493
+ "border-inline-style",
494
+ parseBorderStyle(value.style, builder),
495
+ );
492
496
  }
493
497
 
494
498
  function parseBorderInlineStart(
495
499
  { value }: DeclarationType<"border-inline-start">,
496
500
  builder: StylesheetBuilder,
497
501
  ) {
498
- builder.addDescriptor("border-left-color", parseColor(value.color, builder));
499
502
  builder.addDescriptor(
500
- "border-left-width",
503
+ "border-inline-start-color",
504
+ parseColor(value.color, builder),
505
+ );
506
+ builder.addDescriptor(
507
+ "border-inline-start-width",
501
508
  parseBorderSideWidth(value.width, builder),
502
509
  );
510
+ builder.addDescriptor(
511
+ "border-inline-start-style",
512
+ parseBorderStyle(value.style, builder),
513
+ );
503
514
  }
504
515
 
505
516
  function parseBorderInlineEnd(
506
517
  { value }: DeclarationType<"border-inline-end">,
507
518
  builder: StylesheetBuilder,
508
519
  ) {
509
- builder.addDescriptor("border-right-color", parseColor(value.color, builder));
510
520
  builder.addDescriptor(
511
- "border-right-width",
521
+ "border-inline-end-color",
522
+ parseColor(value.color, builder),
523
+ );
524
+ builder.addDescriptor(
525
+ "border-inline-end-width",
512
526
  parseBorderSideWidth(value.width, builder),
513
527
  );
528
+ builder.addDescriptor(
529
+ "border-inline-end-style",
530
+ parseBorderStyle(value.style, builder),
531
+ );
514
532
  }
515
533
 
516
534
  export function parseBorderInlineWidth(
@@ -518,13 +536,9 @@ export function parseBorderInlineWidth(
518
536
  builder: StylesheetBuilder,
519
537
  ) {
520
538
  builder.addDescriptor(
521
- "border-left-width",
539
+ "border-inline-width",
522
540
  parseBorderSideWidth(declaration.value.start, builder),
523
541
  );
524
- builder.addDescriptor(
525
- "border-right-width",
526
- parseBorderSideWidth(declaration.value.end, builder),
527
- );
528
542
  }
529
543
 
530
544
  export function parseBorderInlineStyle(
@@ -537,16 +551,23 @@ export function parseBorderInlineStyle(
537
551
  ) {
538
552
  if (typeof declaration.value === "string") {
539
553
  builder.addDescriptor(
540
- "border-style",
554
+ declaration.property,
541
555
  parseBorderStyle(declaration.value, builder),
542
556
  );
543
557
  } else if (declaration.value.start === declaration.value.end) {
544
558
  builder.addDescriptor(
545
- "border-style",
559
+ declaration.property,
546
560
  parseBorderStyle(declaration.value.start, builder),
547
561
  );
548
562
  } else {
549
- builder.addWarning("property", "border-inline-style");
563
+ builder.addDescriptor(
564
+ "border-inline-start-style",
565
+ parseBorderStyle(declaration.value.start, builder),
566
+ );
567
+ builder.addDescriptor(
568
+ "border-inline-end-style",
569
+ parseBorderStyle(declaration.value.end, builder),
570
+ );
550
571
  }
551
572
  }
552
573
 
@@ -955,6 +976,12 @@ export function parseCustomDeclaration(
955
976
  parseUnparsed(declaration.value.value, builder, property) ===
956
977
  "borderless",
957
978
  );
979
+ } else if (property === "object-fit") {
980
+ // https://github.com/parcel-bundler/lightningcss/issues/1046
981
+ parseObjectFit(declaration.value, builder);
982
+ } else if (property === "object-position") {
983
+ // https://github.com/parcel-bundler/lightningcss/issues/1047
984
+ parseObjectPosition(declaration.value, builder);
958
985
  } else if (
959
986
  validProperties.has(property) ||
960
987
  property.startsWith("--") ||
@@ -1119,43 +1146,53 @@ export function parseUnparsed(
1119
1146
  }
1120
1147
  case "function": {
1121
1148
  switch (tokenOrValue.value.name) {
1122
- case "translate":
1123
- case "rotate":
1124
- case "rotateX":
1125
- case "rotateY":
1126
- case "skewX":
1127
- case "skewY":
1128
- case "scale":
1129
- case "scaleX":
1130
- case "scaleY":
1131
- case "translateX":
1132
- case "translateY":
1133
- return unparsedFunction(tokenOrValue, builder, property, allowAuto);
1134
1149
  case "blur":
1135
1150
  case "brightness":
1136
1151
  case "contrast":
1137
1152
  case "cubic-bezier":
1138
1153
  case "drop-shadow":
1139
1154
  case "fontScale":
1155
+ case "getPixelSizeForLayoutSize":
1140
1156
  case "grayscale":
1141
1157
  case "hsl":
1142
1158
  case "hsla":
1143
1159
  case "hue-rotate":
1144
1160
  case "invert":
1145
- case "linear-gradient":
1146
1161
  case "opacity":
1147
1162
  case "pixelScale":
1148
- case "getPixelSizeForLayoutSize":
1149
1163
  case "platformColor":
1150
- case "radial-gradient":
1151
1164
  case "rgb":
1152
1165
  case "rgba":
1166
+ case "rotate":
1167
+ case "rotateX":
1168
+ case "rotateY":
1153
1169
  case "roundToNearestPixel":
1154
1170
  case "saturate":
1171
+ case "scale":
1172
+ case "scaleX":
1173
+ case "scaleY":
1155
1174
  case "sepia":
1156
1175
  case "shadow":
1176
+ case "skewX":
1177
+ case "skewY":
1157
1178
  case "steps":
1179
+ case "translate":
1180
+ case "translateX":
1181
+ case "translateY":
1158
1182
  return unparsedFunction(tokenOrValue, builder, property, allowAuto);
1183
+ case "linear-gradient":
1184
+ case "radial-gradient":
1185
+ // These are special as React Native requires the '-' in their name
1186
+ return [
1187
+ {},
1188
+ tokenOrValue.value.name,
1189
+ reduceParseUnparsed(
1190
+ tokenOrValue.value.arguments,
1191
+ builder,
1192
+ property,
1193
+ allowAuto,
1194
+ ),
1195
+ ];
1159
1196
  case "hairlineWidth":
1160
1197
  return [{}, tokenOrValue.value.name, []];
1161
1198
  case "calc":
@@ -1188,7 +1225,7 @@ export function parseUnparsed(
1188
1225
  return;
1189
1226
  }
1190
1227
 
1191
- if (value === "inherit") {
1228
+ if (value === "inherit" || value === "initial") {
1192
1229
  builder.addWarning("value", value);
1193
1230
  return;
1194
1231
  } else if (value === "currentcolor") {
@@ -1993,12 +2030,9 @@ export function parseOverflow(
1993
2030
  }
1994
2031
 
1995
2032
  export function parseBorderStyleDeclaration(
1996
- declaration: DeclarationType<
1997
- | "border-style"
1998
- | "border-left-style"
1999
- | "border-right-style"
2000
- | "border-top-style"
2001
- | "border-bottom-style"
2033
+ declaration: Extract<
2034
+ DeclarationType<Declaration["property"]>,
2035
+ { value: LineStyle | BorderStyle }
2002
2036
  >,
2003
2037
  builder: StylesheetBuilder,
2004
2038
  ) {
@@ -2036,27 +2070,29 @@ export function parseBorderBlockWidth(
2036
2070
  declaration: DeclarationType<"border-block-width">,
2037
2071
  builder: StylesheetBuilder,
2038
2072
  ) {
2039
- builder.addDescriptor(
2040
- "border-top-width",
2041
- parseBorderSideWidth(declaration.value.start, builder),
2042
- );
2043
- builder.addDescriptor(
2044
- "border-bottom-width",
2045
- parseBorderSideWidth(declaration.value.end, builder),
2046
- );
2073
+ const start = parseBorderSideWidth(declaration.value.start, builder);
2074
+ const end = parseBorderSideWidth(declaration.value.end, builder);
2075
+
2076
+ if (start === end) {
2077
+ builder.addDescriptor("border-block-width", start);
2078
+ } else {
2079
+ builder.addDescriptor("border-block-start-width", start);
2080
+ builder.addDescriptor("border-block-end-width", end);
2081
+ }
2047
2082
  }
2048
2083
 
2049
2084
  function parseBorderBlockStyle(
2050
2085
  declaration: DeclarationType<"border-block-style">,
2051
2086
  builder: StylesheetBuilder,
2052
2087
  ) {
2053
- if (declaration.value.start === declaration.value.end) {
2054
- builder.addDescriptor(
2055
- "border-style",
2056
- parseBorderStyle(declaration.value.start, builder),
2057
- );
2088
+ const start = parseBorderStyle(declaration.value.start, builder);
2089
+ const end = parseBorderStyle(declaration.value.end, builder);
2090
+
2091
+ if (start == end) {
2092
+ builder.addDescriptor("border-block-style", start);
2058
2093
  } else {
2059
- builder.addWarning("property", "border-block-style");
2094
+ builder.addDescriptor("border-block-start-style", start);
2095
+ builder.addDescriptor("border-block-end-style", end);
2060
2096
  }
2061
2097
  }
2062
2098
 
@@ -2073,21 +2109,10 @@ export function parseBorderSideWidthDeclaration(
2073
2109
  >,
2074
2110
  builder: StylesheetBuilder,
2075
2111
  ) {
2076
- if (declaration.property.includes("block")) {
2077
- builder.addDescriptor(
2078
- `border-${declaration.property.includes("start") ? "top" : "bottom"}-width`,
2079
- parseBorderSideWidth(declaration.value, builder),
2080
- );
2081
- return;
2082
- } else if (declaration.property.includes("inline")) {
2083
- builder.addDescriptor(
2084
- `border-${declaration.property.includes("start") ? "left" : "right"}-width`,
2085
- parseBorderSideWidth(declaration.value, builder),
2086
- );
2087
- return;
2088
- } else {
2089
- return parseBorderSideWidth(declaration.value, builder);
2090
- }
2112
+ builder.addDescriptor(
2113
+ declaration.property,
2114
+ parseBorderSideWidth(declaration.value, builder),
2115
+ );
2091
2116
  }
2092
2117
 
2093
2118
  export function parseBorderSideWidth(
@@ -2536,9 +2561,7 @@ export function parseCalcArguments(
2536
2561
  ) {
2537
2562
  const parsed: StyleDescriptor[] = [];
2538
2563
 
2539
- let mode: "number" | "percentage" | undefined;
2540
-
2541
- for (const [currentIndex, arg] of args.entries()) {
2564
+ for (const arg of args) {
2542
2565
  switch (arg.type) {
2543
2566
  case "env": {
2544
2567
  parsed.push(parseEnv(arg.value, builder));
@@ -2558,11 +2581,9 @@ export function parseCalcArguments(
2558
2581
  }
2559
2582
  case "length": {
2560
2583
  const value = parseLength(arg.value, builder);
2561
-
2562
2584
  if (value !== undefined) {
2563
2585
  parsed.push(value);
2564
2586
  }
2565
-
2566
2587
  break;
2567
2588
  }
2568
2589
  case "color":
@@ -2585,49 +2606,19 @@ export function parseCalcArguments(
2585
2606
  }
2586
2607
  break;
2587
2608
  case "percentage":
2588
- mode ??= "percentage";
2589
- if (mode !== "percentage") return;
2590
- parsed.push(`${arg.value.value * 100}%`);
2609
+ parsed.push(`${round(arg.value.value * 100)}%`);
2591
2610
  break;
2592
2611
  case "number": {
2593
- mode ??= "number";
2594
- if (mode !== "number") return;
2595
- parsed.push(arg.value.value);
2612
+ parsed.push(round(arg.value.value));
2596
2613
  break;
2597
2614
  }
2598
2615
  case "parenthesis-block": {
2599
- /**
2600
- * If we have a parenthesis block, we just treat it as a nested calc function
2601
- * Because there could be multiple parenthesis blocks, this is recursive
2602
- */
2603
- let closeParenthesisIndex = -1;
2604
- for (let index = args.length - 1; index > 0; index--) {
2605
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2606
- const value = args[index]!;
2607
- if (
2608
- value.type === "token" &&
2609
- value.value.type === "close-parenthesis"
2610
- ) {
2611
- closeParenthesisIndex = index;
2612
- break;
2613
- }
2614
- }
2615
-
2616
- if (closeParenthesisIndex === -1) {
2617
- return;
2618
- }
2619
-
2620
- const innerCalcArgs = args
2621
- // Extract the inner calcArgs including the parenthesis. This mutates args
2622
- .splice(currentIndex, closeParenthesisIndex - currentIndex + 1)
2623
- // Then drop the surrounding parenthesis
2624
- .slice(1, -1);
2625
-
2626
- parsed.push(parseCalcFn("calc", innerCalcArgs, builder, property));
2627
-
2616
+ parsed.push("(");
2628
2617
  break;
2629
2618
  }
2630
2619
  case "close-parenthesis":
2620
+ parsed.push(")");
2621
+ break;
2631
2622
  case "string":
2632
2623
  case "function":
2633
2624
  case "ident":
@@ -2809,7 +2800,12 @@ export function addTransitionValue(
2809
2800
  declaration.property,
2810
2801
  declaration.value
2811
2802
  .map((v) => v.property)
2812
- .filter((v) => v in parsers || v === "all" || v === "none")
2803
+ .filter(
2804
+ (v) =>
2805
+ (v in parsers && !["visibility"].includes(v)) ||
2806
+ v === "all" ||
2807
+ v === "none",
2808
+ )
2813
2809
  .map((v) => toRNProperty(v)),
2814
2810
  );
2815
2811
  return;
@@ -3008,6 +3004,46 @@ function parseGradientItem(
3008
3004
  }
3009
3005
  }
3010
3006
 
3007
+ function parseObjectFit(
3008
+ declaration: CustomProperty,
3009
+ builder: StylesheetBuilder,
3010
+ ) {
3011
+ builder.addMapping({
3012
+ "object-fit": "contentFit",
3013
+ });
3014
+ builder.addDescriptor(
3015
+ "object-fit",
3016
+ parseUnparsed(declaration.value, builder, "object-fit"),
3017
+ );
3018
+ }
3019
+
3020
+ function parseObjectPosition(
3021
+ declaration: CustomProperty,
3022
+ builder: StylesheetBuilder,
3023
+ ) {
3024
+ builder.addMapping({
3025
+ "object-position": "contentPosition",
3026
+ });
3027
+ builder.addDescriptor("object-position", [
3028
+ {},
3029
+ "join",
3030
+ [parseUnparsed(declaration.value, builder, "object-position"), " "],
3031
+ ]);
3032
+ }
3033
+
3034
+ function parseVisibility(
3035
+ declaration: DeclarationType<"visibility">,
3036
+ builder: StylesheetBuilder,
3037
+ ) {
3038
+ if (declaration.value === "visible") {
3039
+ builder.addDescriptor("opacity", 1);
3040
+ } else if (declaration.value === "hidden") {
3041
+ builder.addDescriptor("opacity", 0);
3042
+ } else {
3043
+ builder.addWarning("value", declaration.value);
3044
+ }
3045
+ }
3046
+
3011
3047
  function parseFilter(
3012
3048
  declaration: DeclarationType<"filter">,
3013
3049
  builder: StylesheetBuilder,
@@ -12,7 +12,7 @@ test("nested classes", () => {
12
12
  "my-class",
13
13
  [
14
14
  {
15
- c: ["my-class"],
15
+ c: ["g:my-class"],
16
16
  s: [0],
17
17
  },
18
18
  ],
@@ -21,7 +21,7 @@ test("nested classes", () => {
21
21
  "test",
22
22
  [
23
23
  {
24
- cq: [{ n: "my-class" }],
24
+ cq: [{ n: "g:my-class" }],
25
25
  d: [{ color: "#f00" }],
26
26
  v: [["__rn-css-color", "#f00"]],
27
27
  s: [1, 2],
@@ -44,7 +44,7 @@ test("multiple tiers classes", () => {
44
44
  "one",
45
45
  [
46
46
  {
47
- c: ["one"],
47
+ c: ["g:one"],
48
48
  s: [0],
49
49
  },
50
50
  ],
@@ -53,7 +53,7 @@ test("multiple tiers classes", () => {
53
53
  "two",
54
54
  [
55
55
  {
56
- c: ["two"],
56
+ c: ["g:two"],
57
57
  s: [0],
58
58
  },
59
59
  ],
@@ -62,7 +62,7 @@ test("multiple tiers classes", () => {
62
62
  "test",
63
63
  [
64
64
  {
65
- cq: [{ n: "one" }, { n: "two" }],
65
+ cq: [{ n: "g:one" }, { n: "g:two" }],
66
66
  d: [{ color: "#f00" }],
67
67
  v: [["__rn-css-color", "#f00"]],
68
68
  s: [1, 3],
@@ -85,7 +85,7 @@ test("tiers with multiple classes", () => {
85
85
  "one",
86
86
  [
87
87
  {
88
- c: ["one"],
88
+ c: ["g:one"],
89
89
  s: [0],
90
90
  },
91
91
  ],
@@ -94,7 +94,7 @@ test("tiers with multiple classes", () => {
94
94
  "three",
95
95
  [
96
96
  {
97
- c: ["three.two"],
97
+ c: ["g:three.two"],
98
98
  s: [0],
99
99
  aq: [["a", "className", "*=", "two"]],
100
100
  },
@@ -105,9 +105,9 @@ test("tiers with multiple classes", () => {
105
105
  [
106
106
  {
107
107
  cq: [
108
- { n: "one" },
108
+ { n: "g:one" },
109
109
  {
110
- n: "three.two",
110
+ n: "g:three.two",
111
111
  },
112
112
  ],
113
113
  d: [{ color: "#f00" }],
@@ -0,0 +1,54 @@
1
+ import { isStyleFunction } from "../runtime/utils";
2
+ import type { StyleDeclaration, StyleRule } from "./compiler.types";
3
+
4
+ export function modifyRuleForSelection(rule: StyleRule): StyleRule | undefined {
5
+ if (!rule.d) {
6
+ return;
7
+ }
8
+
9
+ rule.d = rule.d.flatMap((declaration): StyleDeclaration[] => {
10
+ return modifyStyleDeclaration(declaration, "color", "selectionColor");
11
+ });
12
+
13
+ return rule;
14
+ }
15
+
16
+ export function modifyRuleForPlaceholder(
17
+ rule: StyleRule,
18
+ ): StyleRule | undefined {
19
+ if (!rule.d) {
20
+ return;
21
+ }
22
+
23
+ rule.d = rule.d.flatMap((declaration): StyleDeclaration[] => {
24
+ return modifyStyleDeclaration(declaration, "color", "placeholderTextColor");
25
+ });
26
+
27
+ return rule;
28
+ }
29
+
30
+ function modifyStyleDeclaration(
31
+ declaration: StyleDeclaration,
32
+ from: string,
33
+ to: string,
34
+ ): StyleDeclaration[] {
35
+ if (Array.isArray(declaration)) {
36
+ if (isStyleFunction(declaration) && declaration[2] === from) {
37
+ declaration = [...declaration] as StyleDeclaration;
38
+ declaration[2] = [to];
39
+ return [declaration];
40
+ } else if (declaration[1] === from) {
41
+ declaration = [...declaration] as StyleDeclaration;
42
+ declaration[1] = [to];
43
+ return [declaration];
44
+ }
45
+ } else if (typeof declaration === "object") {
46
+ const { color: selectionColor, ...rest } = declaration;
47
+
48
+ if (selectionColor) {
49
+ return [rest, [selectionColor, [to]]] as StyleDeclaration[];
50
+ }
51
+ }
52
+
53
+ return [declaration];
54
+ }