@fluentic/style 0.1.0-beta.3 → 0.1.0-beta.5

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 (430) hide show
  1. package/CHANGELOG.md +55 -1
  2. package/README.md +10 -9
  3. package/atomic/className.ts +12 -12
  4. package/atomic/debug/className/className.ts +10 -15
  5. package/atomic/element.ts +1 -1
  6. package/atomic/rule.ts +8 -5
  7. package/atomic/scope.ts +19 -0
  8. package/atomic/theme.ts +41 -2
  9. package/atomic/token.ts +4 -3
  10. package/atomic/utils/{css.ts → cssIdent.ts} +0 -20
  11. package/atomic/utils/cssVar.ts +19 -0
  12. package/atomic/utils/debug.ts +1 -1
  13. package/atomic/utils/selector.ts +14 -1
  14. package/builder/classname/class_name_builder.ts +68 -24
  15. package/builder/classname/fns.ts +2 -2
  16. package/builder/classname/types.ts +7 -0
  17. package/builder/data/const.ts +7 -1
  18. package/builder/data/create.ts +42 -0
  19. package/builder/data/data.ts +20 -1
  20. package/builder/data/index.ts +0 -1
  21. package/builder/data/is.ts +23 -0
  22. package/builder/data/merge/scope.ts +20 -19
  23. package/builder/data/merge/style.ts +71 -21
  24. package/builder/data/state.ts +16 -2
  25. package/builder/extract/index.ts +1 -0
  26. package/builder/extract/sheet.ts +26 -0
  27. package/builder/extract/token.ts +30 -14
  28. package/builder/extract/utils.ts +2 -0
  29. package/builder/extract/withTokens.ts +2 -1
  30. package/builder/selector_override.noop.ts +11 -0
  31. package/builder/selector_override.ts +30 -0
  32. package/builder/selector_override_core.ts +66 -0
  33. package/builder/style_builder.ts +127 -3
  34. package/builder/style_data.ts +24 -0
  35. package/builder/style_fns.ts +24 -24
  36. package/builder/token/data.ts +30 -0
  37. package/builder/token/index.ts +3 -0
  38. package/builder/token/name.ts +54 -0
  39. package/builder/token/symbols.ts +6 -0
  40. package/builder/types/alias.ts +34 -6
  41. package/builder/types/fns.ts +13 -5
  42. package/builder/types/types.ts +32 -2
  43. package/builder/utils.ts +1 -0
  44. package/compiler/compiler/compiler.ts +4 -7
  45. package/compiler/compiler/constants.ts +6 -0
  46. package/compiler/compiler/index.ts +1 -0
  47. package/compiler/compiler/types.ts +2 -0
  48. package/compiler/cssProp.ts +35 -0
  49. package/compiler/index.ts +1 -0
  50. package/compiler/transform/cssProp/index.ts +1 -0
  51. package/compiler/transform/cssProp/plugin.ts +129 -0
  52. package/compiler/transform/debug/plugin.ts +85 -1
  53. package/compiler/transform/debug/transform.ts +2 -1
  54. package/compiler/transform/evaluator/evaluator.ts +106 -30
  55. package/compiler/transform/evaluator/tracer.ts +30 -2
  56. package/compiler/transform/extract/chain/chain.ts +541 -63
  57. package/compiler/transform/extract/chain/extract_chain.ts +12 -4
  58. package/compiler/transform/extract/chain/types.ts +1 -1
  59. package/compiler/transform/extract/plugin.ts +20 -4
  60. package/compiler/transform/extract/transform.ts +2 -1
  61. package/compiler/transform/extract/utils/replacement.ts +52 -2
  62. package/compiler/transform/extract/utils/state.ts +2 -0
  63. package/compiler/transform/extract/utils/theme.ts +6 -6
  64. package/compiler/transform/index.ts +1 -0
  65. package/compiler/transform/syntax/isStaticStyleValue.ts +15 -9
  66. package/compiler/transform/syntax/static_ids.ts +1 -1
  67. package/compiler/utils/constants.ts +8 -1
  68. package/compiler/utils/imports.ts +11 -1
  69. package/config/build.ts +1 -8
  70. package/config/config/css.ts +1 -0
  71. package/config/config/debug.ts +11 -0
  72. package/css/index.ts +2 -0
  73. package/css/sheet.ts +119 -0
  74. package/css/styleTarget.ts +251 -0
  75. package/dialect/namedTokens.ts +22 -5
  76. package/dist/adapter/preact.js +2 -0
  77. package/dist/adapter/react.js +2 -0
  78. package/dist/adapter/solid.js +2 -0
  79. package/dist/className-hiAsQ9V6.js +303 -0
  80. package/dist/className-hiAsQ9V6.js.map +1 -0
  81. package/dist/{style-Bw5ka-Nq.js → combine-Ca6LfFxv.js} +427 -722
  82. package/dist/combine-Ca6LfFxv.js.map +1 -0
  83. package/dist/compiler/index.mjs +2 -2
  84. package/dist/{compiler-D5v5tJXI.mjs → compiler-OgDBuqfs.mjs} +1635 -607
  85. package/dist/compiler-OgDBuqfs.mjs.map +1 -0
  86. package/dist/config/index.js +2 -2
  87. package/dist/config-B-KbXpIh.js +6 -0
  88. package/dist/{config-OXHoDUIo.js.map → config-B-KbXpIh.js.map} +1 -1
  89. package/dist/config-Barf8f4B.js +35 -0
  90. package/dist/config-Barf8f4B.js.map +1 -0
  91. package/dist/{config-BEvP7108.js → config-BtANtGAh.js} +4 -6
  92. package/dist/config-BtANtGAh.js.map +1 -0
  93. package/dist/config-CsB4MuFI.js +6 -0
  94. package/dist/config-CsB4MuFI.js.map +1 -0
  95. package/dist/config-DOWSNV8w.js +1 -0
  96. package/dist/{config-FIfi5aJ8.js → config-t76UljYv.js} +9 -7
  97. package/dist/config-t76UljYv.js.map +1 -0
  98. package/dist/createTransformElement-DDqld3RF.js +34 -0
  99. package/dist/createTransformElement-DDqld3RF.js.map +1 -0
  100. package/dist/css-CZwrac6F.js +3923 -0
  101. package/dist/css-CZwrac6F.js.map +1 -0
  102. package/dist/{global-zaCE-g1C.js → css-GtUPEO9U.js} +16 -3
  103. package/dist/css-GtUPEO9U.js.map +1 -0
  104. package/dist/css-YfHN_8Nk.js +479 -0
  105. package/dist/css-YfHN_8Nk.js.map +1 -0
  106. package/dist/css-a9O5so0b.js +1246 -0
  107. package/dist/css-a9O5so0b.js.map +1 -0
  108. package/dist/css.js +2 -2
  109. package/dist/{css_extra-DeTuIlcO.js → css_extra-BiG57TKN.js} +2 -2
  110. package/dist/{css_extra-DQdCrYoC.js.map → css_extra-BiG57TKN.js.map} +1 -1
  111. package/dist/{css_extra-DQdCrYoC.js → css_extra-CXXZAylc.js} +2 -2
  112. package/dist/{css_extra-DeTuIlcO.js.map → css_extra-CXXZAylc.js.map} +1 -1
  113. package/dist/data-CzHJg147.js +763 -0
  114. package/dist/data-CzHJg147.js.map +1 -0
  115. package/dist/{debug-D96KGgpH.js → debug-DkrxyknP.js} +80 -4
  116. package/dist/debug-DkrxyknP.js.map +1 -0
  117. package/dist/{runtime-BKChZZ2-.js → debug-DycdGrul.js} +20 -27
  118. package/dist/debug-DycdGrul.js.map +1 -0
  119. package/dist/dev/rsc.js +6 -9
  120. package/dist/dev/rsc.js.map +1 -1
  121. package/dist/{dev-fOtWB5K3.js → dev-z4laBwlS.js} +7 -6
  122. package/dist/{dev-fOtWB5K3.js.map → dev-z4laBwlS.js.map} +1 -1
  123. package/dist/dev.js +1 -1
  124. package/dist/dialect/extracted/index.js +1 -1
  125. package/dist/dialect/index.js +1 -1
  126. package/dist/{elementMarker-CvqqIb7J.js → elementMarker-CqhU_l_m.js} +95 -9
  127. package/dist/elementMarker-CqhU_l_m.js.map +1 -0
  128. package/dist/entry/dev/adapter/preact.js +12 -0
  129. package/dist/entry/dev/adapter/preact.js.map +1 -0
  130. package/dist/entry/dev/adapter/react.js +12 -0
  131. package/dist/entry/dev/adapter/react.js.map +1 -0
  132. package/dist/entry/dev/adapter/solid.js +12 -0
  133. package/dist/entry/dev/adapter/solid.js.map +1 -0
  134. package/dist/entry/dev/css.js +3 -3
  135. package/dist/entry/dev/jsx-dev-runtime.js +2 -2
  136. package/dist/entry/dev/jsx-runtime.js +2 -2
  137. package/dist/entry/dev.js +13 -12
  138. package/dist/entry/prod/adapter/preact.js +12 -0
  139. package/dist/entry/prod/adapter/preact.js.map +1 -0
  140. package/dist/entry/prod/adapter/react.js +12 -0
  141. package/dist/entry/prod/adapter/react.js.map +1 -0
  142. package/dist/entry/prod/adapter/solid.js +12 -0
  143. package/dist/entry/prod/adapter/solid.js.map +1 -0
  144. package/dist/entry/prod/css.js +3 -3
  145. package/dist/entry/prod/extract.js +240 -3
  146. package/dist/entry/prod/extract.js.map +1 -0
  147. package/dist/entry/prod/jsx-dev-runtime.js +2 -2
  148. package/dist/entry/prod/jsx-runtime.js +2 -2
  149. package/dist/entry/prod/runtime.js +3 -4
  150. package/dist/entry/prod.js +85 -1201
  151. package/dist/entry/prod.js.map +1 -1
  152. package/dist/entry/rsc-dev/adapter/preact.js +12 -0
  153. package/dist/entry/rsc-dev/adapter/preact.js.map +1 -0
  154. package/dist/entry/rsc-dev/adapter/react.js +12 -0
  155. package/dist/entry/rsc-dev/adapter/react.js.map +1 -0
  156. package/dist/entry/rsc-dev/adapter/solid.js +12 -0
  157. package/dist/entry/rsc-dev/adapter/solid.js.map +1 -0
  158. package/dist/entry/rsc-dev/css.js +3 -3
  159. package/dist/entry/rsc-dev/dev.js +6 -10
  160. package/dist/entry/rsc-dev/dev.js.map +1 -1
  161. package/dist/entry/rsc-dev/jsx-dev-runtime.js +2 -2
  162. package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
  163. package/dist/entry/rsc-dev.js +323 -615
  164. package/dist/entry/rsc-dev.js.map +1 -1
  165. package/dist/entry/rsc-prod/adapter/preact.js +2 -0
  166. package/dist/entry/rsc-prod/adapter/react.js +2 -0
  167. package/dist/entry/rsc-prod/adapter/solid.js +2 -0
  168. package/dist/entry/rsc-prod/css.js +9 -3
  169. package/dist/entry/rsc-prod/css.js.map +1 -0
  170. package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
  171. package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
  172. package/dist/entry/rsc-prod/runtime.js +3 -4
  173. package/dist/entry/rsc-prod.js +241 -10
  174. package/dist/entry/rsc-prod.js.map +1 -0
  175. package/dist/{styleStore-ydQcDBD4.js → env-Db2cRt-h.js} +1256 -355
  176. package/dist/env-Db2cRt-h.js.map +1 -0
  177. package/dist/{jsx-A4cK517J.js → getClassName-DKtQl5ZX.js} +5 -11
  178. package/dist/getClassName-DKtQl5ZX.js.map +1 -0
  179. package/dist/{utils-hoYnMiA7.js → getClassName-DaZF5nfJ.js} +28 -65
  180. package/dist/getClassName-DaZF5nfJ.js.map +1 -0
  181. package/dist/getClassName-a6p2uMFM.js +536 -0
  182. package/dist/getClassName-a6p2uMFM.js.map +1 -0
  183. package/dist/{getClassName-oiQ8CnkS.js → getClassName-aD9zqg9U.js} +56 -14
  184. package/dist/getClassName-aD9zqg9U.js.map +1 -0
  185. package/dist/global-zYTvWskP.js +10 -0
  186. package/dist/{global-Cul1dX8k.js.map → global-zYTvWskP.js.map} +1 -1
  187. package/dist/{hash-Bycpk3MR.js → hash-BOlQThNz.js} +48 -4
  188. package/dist/hash-BOlQThNz.js.map +1 -0
  189. package/dist/index.js +10 -10
  190. package/dist/jsx/jsx-dev-runtime.js +2 -2
  191. package/dist/jsx/jsx-dev-runtime.server.js +1 -1
  192. package/dist/jsx/jsx-runtime.js +2 -2
  193. package/dist/jsx/jsx-runtime.server.js +1 -1
  194. package/dist/jsx-C2pnWLcb.js +39 -0
  195. package/dist/jsx-C2pnWLcb.js.map +1 -0
  196. package/dist/{jsx_dev_runtime-BQcRzl5D.js → jsx_dev_runtime-kSrmu6b1.js} +2 -3
  197. package/dist/{jsx_dev_runtime-BQcRzl5D.js.map → jsx_dev_runtime-kSrmu6b1.js.map} +1 -1
  198. package/dist/{jsx_runtime-BXcbW8Yp.js → jsx_runtime-BgK90E2O.js} +2 -3
  199. package/dist/{jsx_runtime-BXcbW8Yp.js.map → jsx_runtime-BgK90E2O.js.map} +1 -1
  200. package/dist/{jsx_runtime-B9KEoAQN.js → jsx_runtime-XJSHujgI.js} +2 -2
  201. package/dist/{jsx_runtime-B9KEoAQN.js.map → jsx_runtime-XJSHujgI.js.map} +1 -1
  202. package/dist/{loader-BAth2yZ1.mjs → loader-DHvgp0fK.mjs} +3 -3
  203. package/dist/{loader-BAth2yZ1.mjs.map → loader-DHvgp0fK.mjs.map} +1 -1
  204. package/dist/{misc-DFBKJGLT.mjs → misc-BuSLnvx0.mjs} +4 -4
  205. package/dist/misc-BuSLnvx0.mjs.map +1 -0
  206. package/dist/{namedTokens-BUa6raTb.js → namedTokens-D3tt-joz.js} +8 -6
  207. package/dist/namedTokens-D3tt-joz.js.map +1 -0
  208. package/dist/plugin/farm/index.mjs +4 -3
  209. package/dist/plugin/farm/index.mjs.map +1 -1
  210. package/dist/plugin/nextjs/index.mjs +5 -5
  211. package/dist/plugin/nextjs/index.mjs.map +1 -1
  212. package/dist/plugin/nextjs/loader.mjs +4 -4
  213. package/dist/plugin/parcel/index.cjs +2 -0
  214. package/dist/plugin/parcel/index.mjs +3 -1
  215. package/dist/plugin/parcel/optimizer.cjs +3 -2
  216. package/dist/plugin/parcel/optimizer.cjs.map +1 -1
  217. package/dist/plugin/parcel/optimizer.mjs +3 -2
  218. package/dist/plugin/parcel/optimizer.mjs.map +1 -1
  219. package/dist/plugin/parcel/resolver.cjs +1 -1
  220. package/dist/plugin/parcel/resolver.mjs +2 -2
  221. package/dist/plugin/parcel/runtime.cjs +1 -1
  222. package/dist/plugin/parcel/runtime.mjs +1 -1
  223. package/dist/plugin/parcel/transformer.cjs +1 -1
  224. package/dist/plugin/parcel/transformer.mjs +2 -2
  225. package/dist/plugin/rspack/index.mjs +3 -2
  226. package/dist/plugin/rspack/index.mjs.map +1 -1
  227. package/dist/plugin/vite/index.mjs +6 -6
  228. package/dist/plugin/vite/index.mjs.map +1 -1
  229. package/dist/plugin/webpack/index.mjs +3 -2
  230. package/dist/plugin/webpack/loader.mjs +2 -2
  231. package/dist/presets/tailwind/index.js +9 -7
  232. package/dist/presets/tailwind/index.js.map +1 -1
  233. package/dist/{assert-BGdigdr5.js → presets-DSanixJV.js} +106 -2
  234. package/dist/presets-DSanixJV.js.map +1 -0
  235. package/dist/{registry-CiwvMfx8.mjs → registry-r3BKWqpI.mjs} +2 -2
  236. package/dist/{registry-CiwvMfx8.mjs.map → registry-r3BKWqpI.mjs.map} +1 -1
  237. package/dist/resolveClassNameRuntime-D5a37GNr.js +63 -0
  238. package/dist/resolveClassNameRuntime-D5a37GNr.js.map +1 -0
  239. package/dist/{rules-DlXcch7-.js → rules-B0_rKPfB.js} +598 -132
  240. package/dist/rules-B0_rKPfB.js.map +1 -0
  241. package/dist/scope-BSuRLice.js +601 -0
  242. package/dist/scope-BSuRLice.js.map +1 -0
  243. package/dist/selector/index.js +1 -2
  244. package/dist/server.js +15 -13
  245. package/dist/server.js.map +1 -1
  246. package/dist/{shared-yDD0nfm1.cjs → shared-8_Msr7Q5.cjs} +1630 -597
  247. package/dist/shared-8_Msr7Q5.cjs.map +1 -0
  248. package/dist/{shared-x59dI2NW.mjs → shared-BGO_05rW.mjs} +4 -4
  249. package/dist/{shared-x59dI2NW.mjs.map → shared-BGO_05rW.mjs.map} +1 -1
  250. package/dist/sheet-BpLZIIuO.js +7 -0
  251. package/dist/{sheet-B-uJfHRY.js.map → sheet-BpLZIIuO.js.map} +1 -1
  252. package/dist/{sidecar-CJ6i4wmn.mjs → sidecar-Bu2x35JE.mjs} +3 -3
  253. package/dist/{sidecar-CJ6i4wmn.mjs.map → sidecar-Bu2x35JE.mjs.map} +1 -1
  254. package/dist/{styleStore-DJ0Msgkh.js → styleStore-BDy5TH6N.js} +5 -6
  255. package/dist/{styleStore-DJ0Msgkh.js.map → styleStore-BDy5TH6N.js.map} +1 -1
  256. package/dist/styleStore-DX3z_UVK.js +51 -0
  257. package/dist/styleStore-DX3z_UVK.js.map +1 -0
  258. package/dist/token-BsW_S8fN.js +138 -0
  259. package/dist/token-BsW_S8fN.js.map +1 -0
  260. package/dist/{trace-D8j96G57.js → trace-BdKEpgME.js} +2 -2
  261. package/dist/{trace-D8j96G57.js.map → trace-BdKEpgME.js.map} +1 -1
  262. package/dist/{trace-CO36aenp.js → trace-DcuMxR45.js} +3 -3
  263. package/dist/{trace-CO36aenp.js.map → trace-DcuMxR45.js.map} +1 -1
  264. package/dist/{transform-BTJOg8Hg.js → transform-BkrLIiIR.js} +2 -2
  265. package/dist/{transform-BTJOg8Hg.js.map → transform-BkrLIiIR.js.map} +1 -1
  266. package/dist/{style-DFFK06Of.js → types-BEUgXuu2.js} +356 -129
  267. package/dist/types-BEUgXuu2.js.map +1 -0
  268. package/dist/{utils-D2fygyTm.mjs → utils-BPDxr-oc.mjs} +4 -4
  269. package/dist/{utils-D2fygyTm.mjs.map → utils-BPDxr-oc.mjs.map} +1 -1
  270. package/dist/utils-CLnpwhJd.js +83 -0
  271. package/dist/utils-CLnpwhJd.js.map +1 -0
  272. package/dist/utils-CUl1BU40.js +72 -0
  273. package/dist/utils-CUl1BU40.js.map +1 -0
  274. package/dist/{utils-DTXCTUlS.mjs → utils-DZjLTV4D.mjs} +3 -3
  275. package/dist/{utils-DTXCTUlS.mjs.map → utils-DZjLTV4D.mjs.map} +1 -1
  276. package/dist/utils-okFWrQsg.js +41 -0
  277. package/dist/utils-okFWrQsg.js.map +1 -0
  278. package/dist/{utils-DVFxZnVC.js → utils-sBVZEq4u.js} +190 -144
  279. package/dist/utils-sBVZEq4u.js.map +1 -0
  280. package/dist/utils.js +4 -4
  281. package/dist/utils.js.map +1 -1
  282. package/dist/value-CpJpQ00y.js +145 -0
  283. package/dist/value-CpJpQ00y.js.map +1 -0
  284. package/dist/{webpack-BOU7_xld.mjs → webpack-DTKgR-HY.mjs} +5 -5
  285. package/dist/webpack-DTKgR-HY.mjs.map +1 -0
  286. package/entry/dev/adapter/preact.ts +8 -0
  287. package/entry/dev/adapter/react.ts +8 -0
  288. package/entry/dev/adapter/solid.ts +8 -0
  289. package/entry/prod/adapter/preact.ts +8 -0
  290. package/entry/prod/adapter/react.ts +8 -0
  291. package/entry/prod/adapter/solid.ts +8 -0
  292. package/entry/prod/config_debug.ts +2 -0
  293. package/entry/prod/index.ts +1 -1
  294. package/entry/prod/runtime.ts +3 -1
  295. package/entry/rsc_dev/adapter/preact.ts +1 -0
  296. package/entry/rsc_dev/adapter/react.ts +1 -0
  297. package/entry/rsc_dev/adapter/solid.ts +1 -0
  298. package/entry/rsc_prod/adapter/preact.ts +1 -0
  299. package/entry/rsc_prod/adapter/react.ts +1 -0
  300. package/entry/rsc_prod/adapter/solid.ts +1 -0
  301. package/entry/rsc_prod/config_debug.ts +6 -0
  302. package/entry/rsc_prod/index.ts +1 -1
  303. package/entry/shared/config_debug.ts +9 -0
  304. package/entry/shared/config_dev.ts +9 -7
  305. package/jsx/types/index.ts +3 -0
  306. package/jsx/types/preact.ts +14 -0
  307. package/jsx/{types.ts → types/react.ts} +2 -2
  308. package/jsx/types/solid.ts +32 -0
  309. package/package.json +78 -12
  310. package/plugin/bundler/farm/plugin.ts +2 -0
  311. package/plugin/bundler/parcel/optimizer.ts +1 -0
  312. package/plugin/bundler/parcel/plugin.ts +2 -0
  313. package/plugin/bundler/rspack/plugin.ts +1 -0
  314. package/plugin/bundler/vite/plugin.ts +3 -8
  315. package/plugin/bundler/vite/state.ts +2 -2
  316. package/plugin/bundler/webpack/plugin.ts +2 -1
  317. package/plugin/nextjs/plugin.ts +3 -0
  318. package/plugin/utils/compiler.ts +2 -0
  319. package/plugin/utils/runtimeEntry.ts +2 -2
  320. package/presets/tailwind/style/transform.ts +9 -3
  321. package/runtime/adapter/utils.ts +94 -0
  322. package/runtime/core/cache/combine.ts +76 -28
  323. package/runtime/core/cache/combineRuntime.ts +4 -0
  324. package/runtime/core/cache/index.ts +2 -1
  325. package/runtime/core/cache/item.ts +32 -13
  326. package/runtime/core/cache/itemWithResolver.ts +44 -0
  327. package/runtime/core/cache/pool.ts +15 -30
  328. package/runtime/core/cache/prop.ts +10 -8
  329. package/runtime/core/cache/result.ts +2 -2
  330. package/runtime/core/cache/stateItem.ts +16 -1
  331. package/runtime/core/cache/token.ts +20 -0
  332. package/runtime/core/cache/tokenValues.ts +19 -11
  333. package/runtime/core/combinedStyle.ts +4 -4
  334. package/runtime/extract/combineStyle.ts +211 -0
  335. package/runtime/extract/getClassName.ts +54 -17
  336. package/runtime/extract/index.ts +3 -1
  337. package/runtime/extract/token.ts +41 -0
  338. package/runtime/extract/tokenResolver.ts +17 -0
  339. package/runtime/sheet/rule.ts +3 -10
  340. package/runtime/style/scope.ts +0 -24
  341. package/runtime/style/style.ts +181 -6
  342. package/runtime/types.ts +3 -3
  343. package/style/classname.ts +12 -6
  344. package/style/important.ts +19 -0
  345. package/style/index.ts +2 -0
  346. package/style/style.ts +17 -5
  347. package/style/theme.ts +0 -1
  348. package/style/token.ts +26 -21
  349. package/style/tokens.ts +18 -12
  350. package/style/transform.ts +1 -1
  351. package/style/types.ts +6 -4
  352. package/style/utils/expose.ts +4 -3
  353. package/style/value.ts +26 -11
  354. package/style/valueRef.ts +1 -1
  355. package/style/weight.ts +21 -0
  356. package/utils/global.ts +1 -3
  357. package/utils/symbol.ts +3 -0
  358. package/dist/assert-BGdigdr5.js.map +0 -1
  359. package/dist/className-CKo4TxuT.js +0 -144
  360. package/dist/className-CKo4TxuT.js.map +0 -1
  361. package/dist/className-ZJ5pBA-o.js +0 -263
  362. package/dist/className-ZJ5pBA-o.js.map +0 -1
  363. package/dist/compiler-D5v5tJXI.mjs.map +0 -1
  364. package/dist/config-BEvP7108.js.map +0 -1
  365. package/dist/config-B_cbG3S6.js +0 -1
  366. package/dist/config-FIfi5aJ8.js.map +0 -1
  367. package/dist/config-OXHoDUIo.js +0 -6
  368. package/dist/css-CELBp6Gu.js +0 -58
  369. package/dist/css-CELBp6Gu.js.map +0 -1
  370. package/dist/css-DcuJ_jSH.js +0 -243
  371. package/dist/css-DcuJ_jSH.js.map +0 -1
  372. package/dist/css-dPoZJDQH.js +0 -807
  373. package/dist/css-dPoZJDQH.js.map +0 -1
  374. package/dist/css-oOt6ZR54.js +0 -237
  375. package/dist/css-oOt6ZR54.js.map +0 -1
  376. package/dist/data-CeYstKMP.js +0 -482
  377. package/dist/data-CeYstKMP.js.map +0 -1
  378. package/dist/debug-D96KGgpH.js.map +0 -1
  379. package/dist/dev-p8tW7X-A.js +0 -81
  380. package/dist/dev-p8tW7X-A.js.map +0 -1
  381. package/dist/elementMarker-CvqqIb7J.js.map +0 -1
  382. package/dist/extract-CzWJeQi8.js +0 -121
  383. package/dist/extract-CzWJeQi8.js.map +0 -1
  384. package/dist/extract-DeOytHKW.js +0 -2
  385. package/dist/getClassName-oiQ8CnkS.js.map +0 -1
  386. package/dist/global-Cul1dX8k.js +0 -14
  387. package/dist/global-zaCE-g1C.js.map +0 -1
  388. package/dist/hash-Bycpk3MR.js.map +0 -1
  389. package/dist/jsx-A4cK517J.js.map +0 -1
  390. package/dist/jsx-Ba-XV33u.js +0 -39
  391. package/dist/jsx-Ba-XV33u.js.map +0 -1
  392. package/dist/layer-CbQzwZF-.js +0 -94
  393. package/dist/layer-CbQzwZF-.js.map +0 -1
  394. package/dist/misc-DFBKJGLT.mjs.map +0 -1
  395. package/dist/namedTokens-BUa6raTb.js.map +0 -1
  396. package/dist/presets-BhXa232U.js +0 -108
  397. package/dist/presets-BhXa232U.js.map +0 -1
  398. package/dist/property-CF6JgpTq.js +0 -406
  399. package/dist/property-CF6JgpTq.js.map +0 -1
  400. package/dist/rules-DlXcch7-.js.map +0 -1
  401. package/dist/runtime-BKChZZ2-.js.map +0 -1
  402. package/dist/shared-yDD0nfm1.cjs.map +0 -1
  403. package/dist/sheet-B-uJfHRY.js +0 -7
  404. package/dist/style-91J0B5ef.js +0 -771
  405. package/dist/style-91J0B5ef.js.map +0 -1
  406. package/dist/style-Bw5ka-Nq.js.map +0 -1
  407. package/dist/style-DFFK06Of.js.map +0 -1
  408. package/dist/style-pz8e5To1.js +0 -5
  409. package/dist/styleStore-ydQcDBD4.js.map +0 -1
  410. package/dist/token-CKXUECuU.js +0 -76
  411. package/dist/token-CKXUECuU.js.map +0 -1
  412. package/dist/token-DTOyFLmp.js +0 -58
  413. package/dist/token-DTOyFLmp.js.map +0 -1
  414. package/dist/token-DT_sCPtm.js +0 -298
  415. package/dist/token-DT_sCPtm.js.map +0 -1
  416. package/dist/utils-Bmw655wa.js +0 -170
  417. package/dist/utils-Bmw655wa.js.map +0 -1
  418. package/dist/utils-DVFxZnVC.js.map +0 -1
  419. package/dist/utils-hoYnMiA7.js.map +0 -1
  420. package/dist/value-D-ZcRzLA.js +0 -42
  421. package/dist/value-D-ZcRzLA.js.map +0 -1
  422. package/dist/value-DvFkGBy2.js +0 -1029
  423. package/dist/value-DvFkGBy2.js.map +0 -1
  424. package/dist/value-dG9LK0Gq.js +0 -85
  425. package/dist/value-dG9LK0Gq.js.map +0 -1
  426. package/dist/valueRef-CsLVJwjA.js +0 -16
  427. package/dist/valueRef-CsLVJwjA.js.map +0 -1
  428. package/dist/webpack-BOU7_xld.mjs.map +0 -1
  429. package/dist/withTokens-LRidu3Vc.js +0 -95
  430. package/dist/withTokens-LRidu3Vc.js.map +0 -1
@@ -2,7 +2,7 @@ import { getAtomicClassName, getClassNameDedupe } from '../../../../atomic/class
2
2
  import { LayerDefaultPriority } from '../../../../atomic/layer';
3
3
  import { buildAtomicRule, getAtomicRuleLayerPriority } from '../../../../atomic/rule';
4
4
  import { getTokenOverrideValue, getTokenVar, getTokenVarName } from '../../../../atomic/token';
5
- import { getCssVarRawFallback } from '../../../../atomic/utils/css';
5
+ import { getCssVarRawFallback } from '../../../../atomic/utils/cssVar';
6
6
  import { shouldAppendCssPx } from '../../../../atomic/value';
7
7
  import { getLocalVarName } from '../../../../atomic/var';
8
8
  import {
@@ -34,8 +34,10 @@ import type {
34
34
  RuntimeSlotOverrideItem,
35
35
  RuntimeStyleItem,
36
36
  } from '../../../../builder/data/state';
37
+ import { normalizeManualSelectors } from '../../../../builder/selector_override';
37
38
  import type { ClassNameFormat, TokenNameFormat, TransformClassNameFormat } from '../../../../config/types';
38
39
  import type { Selector } from '../../../../selector/types';
40
+ import { importantValue, isStyleImportantValue } from '../../../../style/important';
39
41
  import type { StyleFnMeta } from '../../../../style/style';
40
42
  import {
41
43
  getStyleTokenId,
@@ -50,8 +52,9 @@ import {
50
52
  type StyleTransform,
51
53
  } from '../../../../style/transform';
52
54
  import { isAtRuleRef } from '../../../../style/valueRef';
55
+ import { isStyleWeightValue, weightValue } from '../../../../style/weight';
53
56
  import { hashString } from '../../../../utils/hash';
54
- import { CompilerRuntimeMode } from '../../../compiler';
57
+ import { CompilerRuntimeMode } from '../../../compiler/constants';
55
58
  import type { CompilerOptions } from '../../../compiler/types';
56
59
  import { DEFAULT_CONFIG } from '../../../utils/constants';
57
60
  import {
@@ -83,6 +86,7 @@ type SelectorsMap = Record<string, Selector>;
83
86
 
84
87
  type CssConfig = {
85
88
  classNameFormat: ClassNameFormat | null;
89
+ sheetClassNameFormat: ClassNameFormat | null;
86
90
  transformClassNameFormat: TransformClassNameFormat | null;
87
91
  hashLength: number;
88
92
  tokenNameFormat: TokenNameFormat | null;
@@ -128,7 +132,8 @@ function transformRuntimeValues(
128
132
  let result: Record<string, unknown> | null = null;
129
133
 
130
134
  for (const [property, rawValue] of Object.entries(styleObj)) {
131
- const value = getPriorityTupleValue(rawValue);
135
+ const weighted = isStyleWeightValue(rawValue) ? rawValue : null;
136
+ const value = weighted ? weighted.value : rawValue;
132
137
  const runtimeValue = getCompiledRuntimeValue(value);
133
138
  if (!runtimeValue) continue;
134
139
 
@@ -136,20 +141,13 @@ function transformRuntimeValues(
136
141
  if (transformedRuntimeValue === runtimeValue) continue;
137
142
 
138
143
  result ??= cloneCompiledStyleObject(styleObj);
139
- result[property] = Array.isArray(rawValue) && rawValue.length === 2 && typeof rawValue[0] === 'number'
140
- ? [rawValue[0], createCompiledRuntimeValue(transformedRuntimeValue)]
141
- : createCompiledRuntimeValue(transformedRuntimeValue);
144
+ const transformed = createCompiledRuntimeValue(transformedRuntimeValue);
145
+ result[property] = weighted ? weightValue(transformed, weighted.weight) : transformed;
142
146
  }
143
147
 
144
148
  return result ?? styleObj;
145
149
  }
146
150
 
147
- function getPriorityTupleValue(value: unknown) {
148
- return Array.isArray(value) && value.length === 2 && typeof value[0] === 'number'
149
- ? value[1]
150
- : value;
151
- }
152
-
153
151
  function cloneCompiledStyleObject(
154
152
  styleObj: Record<string, unknown>,
155
153
  ): Record<string, unknown> {
@@ -327,11 +325,17 @@ export function compileChain(
327
325
  scope: EvalScope,
328
326
  opts: CompilerOptions,
329
327
  runtimeMode: CompilerRuntimeMode | null,
330
- meta: StyleFnMeta,
328
+ meta: StyleFnMeta | null,
331
329
  styleNames: Set<string> = new Set(),
332
330
  ): CompiledChainData | null {
333
331
  const css = getCssConfig(opts, runtimeMode);
334
332
 
333
+ if (chain.kind === 'sheet') {
334
+ return compileSheetChain(chain, fileId, scope, css, opts);
335
+ }
336
+
337
+ if (!meta) return null;
338
+
335
339
  if (meta.mode === 'ClassName') {
336
340
  if (chain.kind !== 'style') return null;
337
341
  return compileClassNameChain(chain, meta.selectors, fileId, scope, css, meta.transform, styleNames, opts);
@@ -356,6 +360,306 @@ export function compileChain(
356
360
  return null;
357
361
  }
358
362
 
363
+ function compileSheetChain(
364
+ chain: NonNullable<StyleChainParseResult>,
365
+ fileId: string,
366
+ scope: EvalScope,
367
+ cssConfig: CssConfig,
368
+ options: CompilerOptions,
369
+ ): CompiledChainData | null {
370
+ if (chain.methods.length > 0 || chain.baseArgs.length > 1) return null;
371
+
372
+ const items: CompiledItem[] = [];
373
+ const rules: CssExtractRule[] = [];
374
+ const sheetItems = chain.baseArgs[0];
375
+
376
+ if (sheetItems && !compileSheetItemsArg(sheetItems, fileId, scope, cssConfig, options, items, rules)) {
377
+ return null;
378
+ }
379
+
380
+ return { type: 'sheet', items, rules };
381
+ }
382
+
383
+ function compileSheetItemsArg(
384
+ node: BabelTypes.Node,
385
+ fileId: string,
386
+ scope: EvalScope,
387
+ cssConfig: CssConfig,
388
+ options: CompilerOptions,
389
+ items: CompiledItem[],
390
+ rules: CssExtractRule[],
391
+ ): boolean {
392
+ if (node.type === 'ArrayExpression') {
393
+ for (const element of node.elements) {
394
+ if (!element) continue;
395
+ if (element.type === 'SpreadElement') return false;
396
+ if (!compileSheetItemsArg(element, fileId, scope, cssConfig, options, items, rules)) return false;
397
+ }
398
+
399
+ return true;
400
+ }
401
+
402
+ const tokenOverride = evaluateNode(node, scope);
403
+ if (tokenOverride.ok && isStyleTokenOverrideData(tokenOverride.value)) {
404
+ addCompiledTokenItem(
405
+ getStyleTokenId(tokenOverride.value),
406
+ tokenOverride.value,
407
+ getCompiledRuntimeValue(tokenOverride.value) ?? node as BabelTypes.Expression,
408
+ items,
409
+ );
410
+ return true;
411
+ }
412
+
413
+ if (tokenOverride.ok && Array.isArray(tokenOverride.value)) {
414
+ for (let i = 0, len = tokenOverride.value.length; i < len; i++) {
415
+ const item = tokenOverride.value[i];
416
+ if (!item) continue;
417
+ if (!isStyleTokenOverrideData(item)) return false;
418
+
419
+ addCompiledTokenItem(
420
+ getStyleTokenId(item),
421
+ item,
422
+ getCompiledRuntimeValue(item) ?? null,
423
+ items,
424
+ );
425
+ }
426
+
427
+ return true;
428
+ }
429
+
430
+ const styleNames = scope.styleNames ?? new Set();
431
+ const sheetNames = scope.sheetNames ?? new Set();
432
+ const selectorChain = node.type === 'CallExpression'
433
+ ? extractStyleChain(node, styleNames, sheetNames) ??
434
+ getLocalSelectorTargetChain(node, scope, styleNames, sheetNames)
435
+ : getLocalStyleChainArg(node, scope, styleNames, sheetNames);
436
+ const selectorMeta = selectorChain ? scope.styleMetas?.get(selectorChain.rootName) : null;
437
+
438
+ if (selectorChain?.kind !== 'selector' || !selectorMeta || selectorMeta.mode !== 'StyleObject') {
439
+ return false;
440
+ }
441
+
442
+ return compileSelectorOverrideChain(
443
+ selectorChain,
444
+ selectorMeta.selectors,
445
+ fileId,
446
+ scope,
447
+ cssConfig,
448
+ selectorMeta.transform,
449
+ scope.styleNames ?? new Set(),
450
+ options,
451
+ items,
452
+ rules,
453
+ );
454
+ }
455
+
456
+ function compileSelectorOverrideChain(
457
+ chain: NonNullable<StyleChainParseResult>,
458
+ selectors: SelectorsMap,
459
+ fileId: string,
460
+ scope: EvalScope,
461
+ cssConfig: CssConfig,
462
+ transform: StyleTransform | null,
463
+ styleNames: Set<string>,
464
+ options: CompilerOptions,
465
+ items: CompiledItem[],
466
+ rules: CssExtractRule[],
467
+ ): boolean {
468
+ if (chain.baseArgs.length === 0 || chain.baseArgs.length > 2) return false;
469
+
470
+ const selectorArg = evaluateNode(chain.baseArgs[0], scope);
471
+ if (!selectorArg.ok) return false;
472
+
473
+ const manualSelectors = normalizeManualSelectors(
474
+ Array.isArray(selectorArg.value)
475
+ ? selectorArg.value.map(String)
476
+ : String(selectorArg.value ?? ''),
477
+ );
478
+
479
+ for (let i = 0, len = manualSelectors.length; i < len; i++) {
480
+ if (
481
+ !compileSelectorOverrideInto(
482
+ chain,
483
+ selectors,
484
+ fileId,
485
+ scope,
486
+ cssConfig,
487
+ transform,
488
+ styleNames,
489
+ options,
490
+ items,
491
+ rules,
492
+ manualSelectors[i],
493
+ )
494
+ ) {
495
+ return false;
496
+ }
497
+ }
498
+
499
+ return true;
500
+ }
501
+
502
+ function compileSelectorOverrideInto(
503
+ chain: NonNullable<StyleChainParseResult>,
504
+ selectors: SelectorsMap,
505
+ fileId: string,
506
+ scope: EvalScope,
507
+ cssConfig: CssConfig,
508
+ transform: StyleTransform | null,
509
+ styleNames: Set<string>,
510
+ options: CompilerOptions,
511
+ items: CompiledItem[],
512
+ rules: CssExtractRule[],
513
+ selectorPrefix: ItemSelector,
514
+ ): boolean {
515
+ if (chain.baseArgs[1]) {
516
+ if (
517
+ !compileSelectorStyleArg(
518
+ chain.baseArgs[1],
519
+ fileId,
520
+ scope,
521
+ cssConfig,
522
+ transform,
523
+ items,
524
+ rules,
525
+ styleNames,
526
+ options,
527
+ selectorPrefix,
528
+ )
529
+ ) {
530
+ return false;
531
+ }
532
+ }
533
+
534
+ let i = 0;
535
+ while (i < chain.methods.length) {
536
+ const method = chain.methods[i];
537
+ if (
538
+ !compileChainMethod(
539
+ method,
540
+ selectors,
541
+ null,
542
+ fileId,
543
+ scope,
544
+ BUILDER_TYPE_STYLE,
545
+ cssConfig,
546
+ items,
547
+ rules,
548
+ transform,
549
+ null,
550
+ styleNames,
551
+ options,
552
+ null,
553
+ selectorPrefix,
554
+ )
555
+ ) {
556
+ return false;
557
+ }
558
+ i++;
559
+ }
560
+
561
+ return true;
562
+ }
563
+
564
+ function compileSelectorStyleArg(
565
+ styleArgNode: BabelTypes.Node,
566
+ fileId: string,
567
+ scope: EvalScope,
568
+ cssConfig: CssConfig,
569
+ transform: StyleTransform | null,
570
+ items: CompiledItem[],
571
+ rules: CssExtractRule[],
572
+ styleNames: Set<string>,
573
+ options: CompilerOptions,
574
+ selectorPrefix: ItemSelector,
575
+ ): boolean {
576
+ const localChain = getLocalStyleChainArg(styleArgNode, scope, styleNames);
577
+ const localMeta = localChain ? scope.styleMetas?.get(localChain.rootName) : null;
578
+
579
+ if (localChain?.kind === 'style' && localMeta) {
580
+ return compileStyleChainInto(
581
+ localChain,
582
+ localMeta.selectors,
583
+ fileId,
584
+ scope,
585
+ cssConfig,
586
+ localMeta.transform,
587
+ BUILDER_TYPE_STYLE,
588
+ null,
589
+ null,
590
+ items,
591
+ rules,
592
+ styleNames,
593
+ options,
594
+ null,
595
+ selectorPrefix,
596
+ );
597
+ }
598
+
599
+ if (styleArgNode.type === 'CallExpression') {
600
+ const nestedChain = extractStyleChain(styleArgNode, styleNames);
601
+ const nestedMeta = nestedChain ? scope.styleMetas?.get(nestedChain.rootName) : null;
602
+
603
+ if (nestedChain?.kind === 'style' && nestedMeta) {
604
+ return compileStyleChainInto(
605
+ nestedChain,
606
+ nestedMeta.selectors,
607
+ fileId,
608
+ scope,
609
+ cssConfig,
610
+ nestedMeta.transform,
611
+ BUILDER_TYPE_STYLE,
612
+ null,
613
+ null,
614
+ items,
615
+ rules,
616
+ styleNames,
617
+ options,
618
+ null,
619
+ selectorPrefix,
620
+ );
621
+ }
622
+ }
623
+
624
+ const styleArg = evaluateNode(styleArgNode, scope);
625
+ if (!styleArg.ok) {
626
+ throwIfRequiredStaticStyleValue(styleArg);
627
+ return false;
628
+ }
629
+
630
+ if (isStyleData(styleArg.value)) {
631
+ return addStyleDataItems(
632
+ styleArg.value,
633
+ selectorPrefix,
634
+ null,
635
+ null,
636
+ fileId,
637
+ BUILDER_TYPE_STYLE,
638
+ null,
639
+ items,
640
+ rules,
641
+ cssConfig,
642
+ null,
643
+ );
644
+ }
645
+
646
+ const styleObj = applyTransform(styleArg.value as Record<string, unknown>, transform, cssConfig);
647
+
648
+ return addStyleItems(
649
+ styleObj,
650
+ selectorPrefix,
651
+ null,
652
+ null,
653
+ fileId,
654
+ BUILDER_TYPE_STYLE,
655
+ null,
656
+ items,
657
+ rules,
658
+ cssConfig,
659
+ null,
660
+ );
661
+ }
662
+
359
663
  function getCssConfig(
360
664
  opts: CompilerOptions,
361
665
  runtimeMode: CompilerRuntimeMode | null,
@@ -365,6 +669,7 @@ function getCssConfig(
365
669
 
366
670
  return {
367
671
  classNameFormat: css?.classNameFormat ?? DEFAULT_CONFIG.classNameFormat ?? null,
672
+ sheetClassNameFormat: css?.sheetClassNameFormat ?? DEFAULT_CONFIG.sheetClassNameFormat ?? null,
368
673
  transformClassNameFormat: css?.transformClassNameFormat ?? DEFAULT_CONFIG.transformClassNameFormat ?? null,
369
674
  hashLength: css?.hashLength ?? DEFAULT_CONFIG.hashLength ?? 7,
370
675
  tokenNameFormat: css?.tokenNameFormat ?? DEFAULT_CONFIG.tokenNameFormat ?? null,
@@ -702,20 +1007,29 @@ function decorateClassNameStyle(
702
1007
  continue;
703
1008
  }
704
1009
 
705
- if (Array.isArray(value) && value.length === 2 && typeof value[0] === 'number') {
706
- const rawValue = value[1];
707
- result[property] = isClassNameValue(rawValue)
708
- ? value
709
- : [value[0], classNameValue(rawValue, className)];
710
- continue;
711
- }
712
-
713
- result[property] = isClassNameValue(value) ? value : classNameValue(value, className);
1010
+ result[property] = decorateClassNameValue(value, className);
714
1011
  }
715
1012
 
716
1013
  return result;
717
1014
  }
718
1015
 
1016
+ function decorateClassNameValue(
1017
+ value: unknown,
1018
+ className: string,
1019
+ ): unknown {
1020
+ if (isClassNameValue(value)) return value;
1021
+
1022
+ if (isStyleImportantValue(value)) {
1023
+ return importantValue(decorateClassNameValue(value.value, className));
1024
+ }
1025
+
1026
+ if (isStyleWeightValue(value)) {
1027
+ return weightValue(decorateClassNameValue(value.value, className), value.weight);
1028
+ }
1029
+
1030
+ return classNameValue(value, className);
1031
+ }
1032
+
719
1033
  function isWeightedClassName(
720
1034
  value: unknown,
721
1035
  ): value is { className: string; weight: number; } {
@@ -737,11 +1051,7 @@ function applyClassNameWeight(
737
1051
  continue;
738
1052
  }
739
1053
 
740
- const rawValue = Array.isArray(value) && value.length === 2 && typeof value[0] === 'number'
741
- ? value[1]
742
- : value;
743
-
744
- weighted[property] = [weight, rawValue];
1054
+ weighted[property] = weightValue(value, weight);
745
1055
  }
746
1056
 
747
1057
  return weighted;
@@ -762,6 +1072,7 @@ function compileStyleChainInto(
762
1072
  styleNames: Set<string>,
763
1073
  options: CompilerOptions,
764
1074
  callsiteOverride: TraceCallsiteOverride = null,
1075
+ selectorPrefix: ItemSelector | null = null,
765
1076
  ): boolean {
766
1077
  if (chain.baseArgs.length > 0) {
767
1078
  const styleArg = evaluateNode(chain.baseArgs[0], scope);
@@ -773,7 +1084,7 @@ function compileStyleChainInto(
773
1084
  if (
774
1085
  !addStyleItems(
775
1086
  styleObj,
776
- null,
1087
+ selectorPrefix,
777
1088
  null,
778
1089
  atRules,
779
1090
  fileId,
@@ -808,6 +1119,7 @@ function compileStyleChainInto(
808
1119
  styleNames,
809
1120
  options,
810
1121
  callsiteOverride,
1122
+ selectorPrefix,
811
1123
  );
812
1124
  if (!result) return false;
813
1125
  i++;
@@ -941,6 +1253,7 @@ function compileScopeMethod(
941
1253
  transform: StyleTransform | null,
942
1254
  options: CompilerOptions,
943
1255
  callsiteOverride: TraceCallsiteOverride = null,
1256
+ _selectorPrefix: ItemSelector | null = null,
944
1257
  ): boolean {
945
1258
  const selector = selectors[method.name];
946
1259
  if (!selector) return false;
@@ -1595,6 +1908,7 @@ function compileChainMethod(
1595
1908
  styleNames: Set<string>,
1596
1909
  options: CompilerOptions,
1597
1910
  callsiteOverride: TraceCallsiteOverride = null,
1911
+ selectorPrefix: ItemSelector | null = null,
1598
1912
  ): boolean {
1599
1913
  if (method.name === STATIC_MERGE_METHOD) {
1600
1914
  const mergeCallsite = callsiteOverride ?? getMergeStyleCallsite(method.nameNode, scope, options);
@@ -1612,6 +1926,7 @@ function compileChainMethod(
1612
1926
  styleNames,
1613
1927
  options,
1614
1928
  mergeCallsite,
1929
+ selectorPrefix,
1615
1930
  );
1616
1931
  }
1617
1932
 
@@ -1637,6 +1952,7 @@ function compileChainMethod(
1637
1952
  styleNames,
1638
1953
  options,
1639
1954
  mergeCallsite,
1955
+ selectorPrefix,
1640
1956
  );
1641
1957
  }
1642
1958
 
@@ -1657,6 +1973,7 @@ function compileChainMethod(
1657
1973
  selectors,
1658
1974
  styleNames,
1659
1975
  options,
1976
+ selectorPrefix,
1660
1977
  );
1661
1978
  }
1662
1979
 
@@ -1675,12 +1992,14 @@ function compileChainMethod(
1675
1992
  transform,
1676
1993
  atRules,
1677
1994
  options,
1995
+ selectorPrefix,
1678
1996
  );
1679
1997
  }
1680
1998
 
1681
1999
  const itemSelector: ItemSelector = selector.priority !== null
1682
2000
  ? [selectorStr, selector.priority]
1683
2001
  : selectorStr;
2002
+ const compiledSelector = selectorPrefix ? combineSelectors(selectorPrefix, itemSelector) : itemSelector;
1684
2003
 
1685
2004
  const styleArg = evaluateNode(method.args[0], scope);
1686
2005
  if (!styleArg.ok) {
@@ -1691,7 +2010,7 @@ function compileChainMethod(
1691
2010
 
1692
2011
  return addStyleItems(
1693
2012
  styleObj,
1694
- itemSelector,
2013
+ compiledSelector,
1695
2014
  null,
1696
2015
  atRules,
1697
2016
  fileId,
@@ -1718,13 +2037,14 @@ function compileMergeArg(
1718
2037
  styleNames: Set<string>,
1719
2038
  options: CompilerOptions,
1720
2039
  callsiteOverride: TraceCallsiteOverride = null,
2040
+ selectorPrefix: ItemSelector | null = null,
1721
2041
  ): boolean {
1722
2042
  if (!styleArgNode) return false;
1723
2043
  const styleCallsite = callsiteOverride ?? getMergeStyleCallsite(mergeNode, scope, options);
1724
2044
  const localChain = getLocalStyleChainArg(styleArgNode, scope, styleNames);
1725
2045
  const localMeta = localChain ? scope.styleMetas?.get(localChain.rootName) : null;
1726
2046
 
1727
- if ((styleCallsite || options.dev?.sourcemapMode === 'value') && localChain?.kind === 'style' && localMeta) {
2047
+ if (localChain?.kind === 'style' && localMeta) {
1728
2048
  return compileStyleChainInto(
1729
2049
  localChain,
1730
2050
  localMeta.selectors,
@@ -1740,6 +2060,7 @@ function compileMergeArg(
1740
2060
  styleNames,
1741
2061
  options,
1742
2062
  styleCallsite,
2063
+ selectorPrefix,
1743
2064
  );
1744
2065
  }
1745
2066
 
@@ -1763,6 +2084,7 @@ function compileMergeArg(
1763
2084
  styleNames,
1764
2085
  options,
1765
2086
  styleCallsite,
2087
+ selectorPrefix,
1766
2088
  );
1767
2089
  }
1768
2090
  }
@@ -1777,7 +2099,7 @@ function compileMergeArg(
1777
2099
  return addStyleDataSpreadItems(
1778
2100
  styleArg.value,
1779
2101
  styleArgNode,
1780
- null,
2102
+ selectorPrefix,
1781
2103
  null,
1782
2104
  atRules,
1783
2105
  fileId,
@@ -1792,7 +2114,7 @@ function compileMergeArg(
1792
2114
 
1793
2115
  return addStyleDataItems(
1794
2116
  styleArg.value,
1795
- null,
2117
+ selectorPrefix,
1796
2118
  null,
1797
2119
  atRules,
1798
2120
  fileId,
@@ -1809,13 +2131,114 @@ function getLocalStyleChainArg(
1809
2131
  node: BabelTypes.Node,
1810
2132
  scope: EvalScope,
1811
2133
  styleNames: Set<string>,
2134
+ sheetNames: Set<string> = new Set(),
1812
2135
  ) {
1813
2136
  if (node.type !== 'Identifier') return null;
1814
2137
 
1815
2138
  const init = scope.bindingNodes?.get(node.name);
1816
2139
  if (!init) return null;
1817
2140
 
1818
- return extractStyleChain(init, styleNames);
2141
+ return extractStyleChain(init, styleNames, sheetNames);
2142
+ }
2143
+
2144
+ function getLocalSelectorTargetChain(
2145
+ node: BabelTypes.CallExpression,
2146
+ scope: EvalScope,
2147
+ styleNames: Set<string>,
2148
+ sheetNames: Set<string>,
2149
+ ): StyleChainParseResult {
2150
+ const callee = node.callee;
2151
+
2152
+ if (callee.type === 'Identifier') {
2153
+ const target = getLocalStyleChainArg(callee, scope, styleNames, sheetNames);
2154
+ if (!isBareSelectorTargetChain(target)) return null;
2155
+
2156
+ return {
2157
+ ...target,
2158
+ baseArgs: [...target.baseArgs, ...(node.arguments as BabelTypes.Node[])],
2159
+ };
2160
+ }
2161
+
2162
+ if (callee.type !== 'MemberExpression' || callee.computed) return null;
2163
+
2164
+ const memberTarget = getLocalMemberStyleChainArg(callee, scope, styleNames, sheetNames);
2165
+ if (isBareSelectorTargetChain(memberTarget)) {
2166
+ return {
2167
+ ...memberTarget,
2168
+ baseArgs: [...memberTarget.baseArgs, ...(node.arguments as BabelTypes.Node[])],
2169
+ };
2170
+ }
2171
+
2172
+ const methodName = callee.property.type === 'Identifier'
2173
+ ? callee.property.name
2174
+ : callee.property.type === 'StringLiteral'
2175
+ ? callee.property.value
2176
+ : null;
2177
+
2178
+ if (!methodName) return null;
2179
+
2180
+ const object = callee.object;
2181
+ const target = object.type === 'Identifier'
2182
+ ? getLocalStyleChainArg(object, scope, styleNames, sheetNames)
2183
+ : object.type === 'MemberExpression'
2184
+ ? getLocalMemberStyleChainArg(object, scope, styleNames, sheetNames)
2185
+ : object.type === 'CallExpression'
2186
+ ? getLocalSelectorTargetChain(object, scope, styleNames, sheetNames)
2187
+ : null;
2188
+
2189
+ if (target?.kind !== 'selector') return null;
2190
+
2191
+ return {
2192
+ ...target,
2193
+ methods: [
2194
+ ...target.methods,
2195
+ { name: methodName, args: node.arguments as BabelTypes.Node[], nameNode: callee.property },
2196
+ ],
2197
+ };
2198
+ }
2199
+
2200
+ function getLocalMemberStyleChainArg(
2201
+ node: BabelTypes.MemberExpression,
2202
+ scope: EvalScope,
2203
+ styleNames: Set<string>,
2204
+ sheetNames: Set<string>,
2205
+ ) {
2206
+ if (node.computed || node.object.type !== 'Identifier') return null;
2207
+
2208
+ const propertyName = node.property.type === 'Identifier'
2209
+ ? node.property.name
2210
+ : node.property.type === 'StringLiteral'
2211
+ ? node.property.value
2212
+ : null;
2213
+
2214
+ if (!propertyName) return null;
2215
+
2216
+ const objectInit = scope.bindingNodes?.get(node.object.name);
2217
+ if (objectInit?.type !== 'ObjectExpression') return null;
2218
+
2219
+ for (let i = 0, len = objectInit.properties.length; i < len; i++) {
2220
+ const property = objectInit.properties[i];
2221
+ if (property.type !== 'ObjectProperty') continue;
2222
+
2223
+ const key = property.key;
2224
+ const keyName = key.type === 'Identifier'
2225
+ ? key.name
2226
+ : key.type === 'StringLiteral'
2227
+ ? key.value
2228
+ : null;
2229
+
2230
+ if (keyName !== propertyName) continue;
2231
+
2232
+ return extractStyleChain(property.value as BabelTypes.Node, styleNames, sheetNames);
2233
+ }
2234
+
2235
+ return null;
2236
+ }
2237
+
2238
+ function isBareSelectorTargetChain(
2239
+ chain: StyleChainParseResult,
2240
+ ): chain is NonNullable<StyleChainParseResult> {
2241
+ return chain?.kind === 'selector' && chain.baseArgs.length === 1 && chain.methods.length === 0;
1819
2242
  }
1820
2243
 
1821
2244
  function getLocalBindingNode(
@@ -1878,6 +2301,7 @@ function compileAtRuleMethod(
1878
2301
  selectors: SelectorsMap,
1879
2302
  styleNames: Set<string>,
1880
2303
  options: CompilerOptions,
2304
+ selectorPrefix: ItemSelector | null = null,
1881
2305
  ): boolean {
1882
2306
  const isMedia = selectorStr.startsWith(SELECTOR_MEDIA) || selectorStr.startsWith(SELECTOR_CONTAINER);
1883
2307
  const hasArg = selectorStr.includes(SELECTOR_ARGS);
@@ -1932,6 +2356,8 @@ function compileAtRuleMethod(
1932
2356
  cssRules,
1933
2357
  styleNames,
1934
2358
  options,
2359
+ null,
2360
+ selectorPrefix,
1935
2361
  );
1936
2362
  }
1937
2363
  // Could not parse as chain — try to evaluate as static object
@@ -1942,7 +2368,7 @@ function compileAtRuleMethod(
1942
2368
  }
1943
2369
  return addStyleItems(
1944
2370
  applyTransform(evaled.value as Record<string, unknown>, transform, cssConfig),
1945
- null,
2371
+ selectorPrefix,
1946
2372
  null,
1947
2373
  nextAtRules,
1948
2374
  fileId,
@@ -1962,7 +2388,7 @@ function compileAtRuleMethod(
1962
2388
 
1963
2389
  return addStyleItems(
1964
2390
  applyTransform(styleResult.value as Record<string, unknown>, transform, cssConfig),
1965
- null,
2391
+ selectorPrefix,
1966
2392
  null,
1967
2393
  nextAtRules,
1968
2394
  fileId,
@@ -1987,6 +2413,7 @@ function compileArgMethod(
1987
2413
  transform: StyleTransform | null,
1988
2414
  atRules: ItemSelector[] | null,
1989
2415
  options: CompilerOptions,
2416
+ selectorPrefix: ItemSelector | null = null,
1990
2417
  ): boolean {
1991
2418
  const selectorStr = selector.selector.trim();
1992
2419
  validateSelectorDefinition(options.dev?.checkSelector, `style.${method.name}`, selector, method.nameNode);
@@ -2021,8 +2448,9 @@ function compileArgMethod(
2021
2448
  const compiledSelector: ItemSelector = selector.priority !== null
2022
2449
  ? [selectorText, selector.priority]
2023
2450
  : selectorText;
2451
+ const itemSelector = selectorPrefix ? combineSelectors(selectorPrefix, compiledSelector) : compiledSelector;
2024
2452
 
2025
- if (!addStyleItems(styleObj, compiledSelector, null, atRules, fileId, type, slotId, items, cssRules, cssConfig)) {
2453
+ if (!addStyleItems(styleObj, itemSelector, null, atRules, fileId, type, slotId, items, cssRules, cssConfig)) {
2026
2454
  return false;
2027
2455
  }
2028
2456
 
@@ -2165,6 +2593,8 @@ function addSlotOverrideDataItems(
2165
2593
  dedupe: overrideItem.dedupe,
2166
2594
  className: overrideItem.className,
2167
2595
  property: overrideItem.property,
2596
+ weight: overrideItem.weight,
2597
+ important: overrideItem.important,
2168
2598
  value: overrideItem.value,
2169
2599
  variable: overrideItem.variable,
2170
2600
  token: overrideItem.token,
@@ -2251,13 +2681,10 @@ function addRuntimeScopeItem(
2251
2681
  cssConfig: CssConfig,
2252
2682
  callsiteOverride: TraceCallsiteOverride = null,
2253
2683
  ) {
2254
- let priority: number | null = null;
2684
+ const weight = sourceItem.weight;
2685
+ let important = false;
2255
2686
  let value = sourceItem.value;
2256
-
2257
- if (Array.isArray(value)) {
2258
- priority = value[1];
2259
- value = value[0];
2260
- }
2687
+ important = sourceItem.important;
2261
2688
 
2262
2689
  const itemParentSelector = parentSelector ?? sourceItem.parentSelector;
2263
2690
  const itemAtRules = mergeAtRules(atRules, sourceItem.atRule);
@@ -2266,7 +2693,8 @@ function addRuntimeScopeItem(
2266
2693
 
2267
2694
  const dedupe = getClassNameDedupe(
2268
2695
  sourceItem.property,
2269
- priority,
2696
+ weight,
2697
+ important,
2270
2698
  sourceItem.selector,
2271
2699
  itemParentSelector,
2272
2700
  itemAtRules,
@@ -2274,7 +2702,8 @@ function addRuntimeScopeItem(
2274
2702
 
2275
2703
  const className = getAtomicClassName(
2276
2704
  sourceItem.property,
2277
- priority,
2705
+ weight,
2706
+ important,
2278
2707
  valueStr,
2279
2708
  sourceItem.selector,
2280
2709
  itemParentSelector,
@@ -2285,6 +2714,7 @@ function addRuntimeScopeItem(
2285
2714
  cssConfig.classNameFormat,
2286
2715
  sourceItem.transformClassName ?? null,
2287
2716
  cssConfig.transformClassNameFormat,
2717
+ cssConfig.sheetClassNameFormat,
2288
2718
  cssConfig.hashLength,
2289
2719
  );
2290
2720
 
@@ -2302,6 +2732,7 @@ function addRuntimeScopeItem(
2302
2732
  className,
2303
2733
  sourceItem.property,
2304
2734
  valueStr,
2735
+ important,
2305
2736
  sourceItem.selector,
2306
2737
  itemParentSelector,
2307
2738
  itemAtRules,
@@ -2310,7 +2741,7 @@ function addRuntimeScopeItem(
2310
2741
 
2311
2742
  const layerPriority = getAtomicRuleLayerPriority(
2312
2743
  sourceItem.property,
2313
- priority,
2744
+ weight,
2314
2745
  sourceItem.selector,
2315
2746
  itemParentSelector,
2316
2747
  itemAtRules,
@@ -2477,15 +2908,13 @@ function addRuntimeStyleItem(
2477
2908
  cssConfig: CssConfig,
2478
2909
  callsiteOverride: TraceCallsiteOverride = null,
2479
2910
  ) {
2480
- let priority: number | null = null;
2911
+ const weight = sourceItem.weight;
2912
+ const important = sourceItem.important;
2481
2913
  let value = sourceItem.value;
2482
2914
 
2483
- if (Array.isArray(value)) {
2484
- priority = value[1];
2485
- value = value[0];
2486
- }
2487
-
2488
- const itemSelector = selector ?? sourceItem.selector;
2915
+ const itemSelector = selector && sourceItem.selector
2916
+ ? combineSelectors(selector, sourceItem.selector)
2917
+ : selector ?? sourceItem.selector;
2489
2918
  const itemAtRules = mergeAtRules(atRules, sourceItem.atRule);
2490
2919
  const variable = sourceItem.variable;
2491
2920
  const runtimeValue = variable?.[0] === ITEM_VALUE_TYPE_VARIABLE
@@ -2503,7 +2932,8 @@ function addRuntimeStyleItem(
2503
2932
 
2504
2933
  const dedupe = getClassNameDedupe(
2505
2934
  sourceItem.property,
2506
- priority,
2935
+ weight,
2936
+ important,
2507
2937
  itemSelector,
2508
2938
  parentSelector,
2509
2939
  itemAtRules,
@@ -2513,7 +2943,8 @@ function addRuntimeStyleItem(
2513
2943
 
2514
2944
  const className = getAtomicClassName(
2515
2945
  sourceItem.property,
2516
- priority,
2946
+ weight,
2947
+ important,
2517
2948
  valueStr,
2518
2949
  itemSelector,
2519
2950
  parentSelector,
@@ -2524,6 +2955,7 @@ function addRuntimeStyleItem(
2524
2955
  cssConfig.classNameFormat,
2525
2956
  sourceItem.transformClassName ?? null,
2526
2957
  cssConfig.transformClassNameFormat,
2958
+ cssConfig.sheetClassNameFormat,
2527
2959
  cssConfig.hashLength,
2528
2960
  );
2529
2961
 
@@ -2547,6 +2979,7 @@ function addRuntimeStyleItem(
2547
2979
  className,
2548
2980
  sourceItem.property,
2549
2981
  valueStr,
2982
+ important,
2550
2983
  itemSelector,
2551
2984
  parentSelector,
2552
2985
  itemAtRules,
@@ -2555,7 +2988,7 @@ function addRuntimeStyleItem(
2555
2988
 
2556
2989
  const layerPriority = getAtomicRuleLayerPriority(
2557
2990
  sourceItem.property,
2558
- priority,
2991
+ weight,
2559
2992
  itemSelector,
2560
2993
  parentSelector,
2561
2994
  itemAtRules,
@@ -2577,6 +3010,26 @@ function addRuntimeStyleItem(
2577
3010
  });
2578
3011
  }
2579
3012
 
3013
+ function combineSelectors(
3014
+ parent: ItemSelector,
3015
+ child: ItemSelector,
3016
+ ): ItemSelector {
3017
+ const parentText = getItemSelectorText(parent);
3018
+ const childText = getItemSelectorText(child);
3019
+ const priority = Math.max(getItemSelectorPriority(parent), getItemSelectorPriority(child));
3020
+ const selector = parentText + childText;
3021
+
3022
+ return priority > 0 ? [selector, priority] : selector;
3023
+ }
3024
+
3025
+ function getItemSelectorText(selector: ItemSelector) {
3026
+ return Array.isArray(selector) ? selector[0] : selector;
3027
+ }
3028
+
3029
+ function getItemSelectorPriority(selector: ItemSelector) {
3030
+ return Array.isArray(selector) ? selector[1] : 0;
3031
+ }
3032
+
2580
3033
  function getRuntimeStyleItemSourceTrace(
2581
3034
  item: RuntimeStyleItem,
2582
3035
  fileId: string,
@@ -2658,14 +3111,12 @@ function addStyleItems(
2658
3111
  const property = keys[i];
2659
3112
  const rawValue = styleObj[property];
2660
3113
 
2661
- let priority: number | null = null;
3114
+ let weight: number | null = null;
3115
+ let important = false;
2662
3116
  let value: unknown = rawValue;
2663
3117
  let transformClassName: string | null = null;
2664
3118
 
2665
- if (Array.isArray(rawValue) && rawValue.length === 2 && typeof rawValue[0] === 'number') {
2666
- priority = rawValue[0];
2667
- value = rawValue[1];
2668
- }
3119
+ [value, weight, important] = unwrapStaticStyleValue(value);
2669
3120
 
2670
3121
  if (isClassNameValue(value)) {
2671
3122
  transformClassName = value.className;
@@ -2716,7 +3167,8 @@ function addStyleItems(
2716
3167
 
2717
3168
  const dedupe = getClassNameDedupe(
2718
3169
  property,
2719
- priority,
3170
+ weight,
3171
+ important,
2720
3172
  selector,
2721
3173
  parentSelector,
2722
3174
  atRules,
@@ -2724,7 +3176,8 @@ function addStyleItems(
2724
3176
 
2725
3177
  const className = getAtomicClassName(
2726
3178
  property,
2727
- priority,
3179
+ weight,
3180
+ important,
2728
3181
  valueStr,
2729
3182
  selector,
2730
3183
  parentSelector,
@@ -2735,6 +3188,7 @@ function addStyleItems(
2735
3188
  cssConfig.classNameFormat,
2736
3189
  transformClassName,
2737
3190
  cssConfig.transformClassNameFormat,
3191
+ cssConfig.sheetClassNameFormat,
2738
3192
  cssConfig.hashLength,
2739
3193
  );
2740
3194
 
@@ -2782,6 +3236,7 @@ function addStyleItems(
2782
3236
  className,
2783
3237
  property,
2784
3238
  valueStr,
3239
+ important,
2785
3240
  selector,
2786
3241
  parentSelector,
2787
3242
  atRules,
@@ -2790,7 +3245,7 @@ function addStyleItems(
2790
3245
 
2791
3246
  const layerPriority = getAtomicRuleLayerPriority(
2792
3247
  property,
2793
- priority,
3248
+ weight,
2794
3249
  selector,
2795
3250
  parentSelector,
2796
3251
  atRules,
@@ -2834,6 +3289,29 @@ function addStyleItems(
2834
3289
  return true;
2835
3290
  }
2836
3291
 
3292
+ function unwrapStaticStyleValue(value: unknown): [value: unknown, weight: number | null, important: boolean] {
3293
+ let weight: number | null = null;
3294
+ let important = false;
3295
+
3296
+ while (true) {
3297
+ if (isStyleImportantValue(value)) {
3298
+ important = true;
3299
+ value = value.value;
3300
+ continue;
3301
+ }
3302
+
3303
+ if (isStyleWeightValue(value)) {
3304
+ weight = value.weight;
3305
+ value = value.value;
3306
+ continue;
3307
+ }
3308
+
3309
+ break;
3310
+ }
3311
+
3312
+ return [value, weight, important];
3313
+ }
3314
+
2837
3315
  function throwIfRequiredStaticStyleValue(result: EvalResult) {
2838
3316
  if (result.ok) return;
2839
3317
  if (