@fluentic/style 0.1.0-beta.2 → 0.1.0-beta.4

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 (296) hide show
  1. package/CHANGELOG.md +38 -16
  2. package/README.md +80 -23
  3. package/atomic/className.ts +3 -9
  4. package/atomic/debug/className/className.ts +0 -15
  5. package/atomic/element.ts +1 -1
  6. package/atomic/rule.ts +2 -2
  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/builder/data/const.ts +1 -1
  14. package/builder/data/merge/style.ts +1 -1
  15. package/builder/extract/token.ts +30 -14
  16. package/builder/token/data.ts +30 -0
  17. package/builder/token/index.ts +3 -0
  18. package/builder/token/name.ts +54 -0
  19. package/builder/token/symbols.ts +6 -0
  20. package/compiler/compiler/types.ts +0 -1
  21. package/compiler/transform/debug/plugin.ts +79 -1
  22. package/compiler/transform/evaluator/evaluator.ts +76 -26
  23. package/compiler/transform/evaluator/tracer.ts +11 -1
  24. package/compiler/transform/extract/chain/chain.ts +8 -5
  25. package/compiler/transform/extract/plugin.ts +1 -1
  26. package/compiler/transform/extract/utils/replacement.ts +6 -1
  27. package/compiler/transform/extract/utils/state.ts +1 -0
  28. package/compiler/transform/extract/utils/theme.ts +6 -6
  29. package/compiler/transform/syntax/static_ids.ts +1 -1
  30. package/compiler/utils/constants.ts +0 -4
  31. package/config/build.ts +5 -2
  32. package/config/config/debug.ts +24 -1
  33. package/config/config/dev.ts +8 -0
  34. package/config/configure.ts +10 -2
  35. package/dev/config.ts +2 -3
  36. package/dialect/namedTokens.ts +22 -5
  37. package/dist/{className-W2kDyeVl.js → className-Do2Crx4b.js} +2 -3
  38. package/dist/{className-W2kDyeVl.js.map → className-Do2Crx4b.js.map} +1 -1
  39. package/dist/{style-CYXTs1iu.js → combine-C9vjpKCs.js} +45 -304
  40. package/dist/combine-C9vjpKCs.js.map +1 -0
  41. package/dist/combineStyle-DwAhsOmS.js +26 -0
  42. package/dist/combineStyle-DwAhsOmS.js.map +1 -0
  43. package/dist/compiler/index.mjs +1 -1
  44. package/dist/{compiler-BXcGyZUP.mjs → compiler-CE0ZgkdH.mjs} +274 -128
  45. package/dist/compiler-CE0ZgkdH.mjs.map +1 -0
  46. package/dist/config/index.js +2 -2
  47. package/dist/config-BE5D5x2N.js +2 -0
  48. package/dist/{config-CLYMN3_p.js → config-BtANtGAh.js} +10 -5
  49. package/dist/config-BtANtGAh.js.map +1 -0
  50. package/dist/{config-C1k9vUrM.js → config-CduqubI8.js} +8 -6
  51. package/dist/config-CduqubI8.js.map +1 -0
  52. package/dist/config-lJNLh7eM.js +6 -0
  53. package/dist/config-lJNLh7eM.js.map +1 -0
  54. package/dist/config-oKOjOTWi.js +7 -0
  55. package/dist/{config-DcYrUB-M.js.map → config-oKOjOTWi.js.map} +1 -1
  56. package/dist/{css-CohHH2tn.js → css-BewrRz3_.js} +3 -3
  57. package/dist/{css-CohHH2tn.js.map → css-BewrRz3_.js.map} +1 -1
  58. package/dist/{css-DfH4Gb1c.js → css-CiTI58yl.js} +294 -5
  59. package/dist/css-CiTI58yl.js.map +1 -0
  60. package/dist/{global-zaCE-g1C.js → css-GtUPEO9U.js} +16 -3
  61. package/dist/css-GtUPEO9U.js.map +1 -0
  62. package/dist/{css-D_DL1yOz.js → css-Rc7ILf-3.js} +8 -9
  63. package/dist/{css-D_DL1yOz.js.map → css-Rc7ILf-3.js.map} +1 -1
  64. package/dist/css.js +1 -1
  65. package/dist/{css-CELBp6Gu.js → cssIdent-BsyUXNNk.js} +3 -23
  66. package/dist/cssIdent-BsyUXNNk.js.map +1 -0
  67. package/dist/cssVar-DGgQ2GIK.js +92 -0
  68. package/dist/cssVar-DGgQ2GIK.js.map +1 -0
  69. package/dist/{css_extra-9BZ_jVET.js → css_extra-BiG57TKN.js} +2 -2
  70. package/dist/{css_extra-9BZ_jVET.js.map → css_extra-BiG57TKN.js.map} +1 -1
  71. package/dist/{css_extra-DQdCrYoC.js → css_extra-DYtS3g6Z.js} +2 -2
  72. package/dist/{css_extra-DQdCrYoC.js.map → css_extra-DYtS3g6Z.js.map} +1 -1
  73. package/dist/{data-Ze8GNiJm.js → data-D7NFt4JG.js} +205 -11
  74. package/dist/data-D7NFt4JG.js.map +1 -0
  75. package/dist/{debug-DLmUG3Vh.js → debug-Cvpo5cVu.js} +4 -3
  76. package/dist/{debug-DLmUG3Vh.js.map → debug-Cvpo5cVu.js.map} +1 -1
  77. package/dist/debug-DycdGrul.js +45 -0
  78. package/dist/debug-DycdGrul.js.map +1 -0
  79. package/dist/dev/rsc.js +9 -9
  80. package/dist/{dev-C2u78xuv.js → dev-DdRWa6dJ.js} +8 -8
  81. package/dist/{dev-C2u78xuv.js.map → dev-DdRWa6dJ.js.map} +1 -1
  82. package/dist/{dev-4TqJORRn.js → dev-px0_6TNq.js} +11 -5
  83. package/dist/dev-px0_6TNq.js.map +1 -0
  84. package/dist/dev.js +1 -1
  85. package/dist/dialect/extracted/index.js +1 -1
  86. package/dist/dialect/index.js +1 -1
  87. package/dist/{elementMarker-BKzZyg5V.js → elementMarker-ng0y3fN0.js} +8 -8
  88. package/dist/{elementMarker-BKzZyg5V.js.map → elementMarker-ng0y3fN0.js.map} +1 -1
  89. package/dist/entry/dev/css.js +2 -2
  90. package/dist/entry/dev/jsx-dev-runtime.js +2 -2
  91. package/dist/entry/dev/jsx-runtime.js +2 -2
  92. package/dist/entry/dev.js +11 -12
  93. package/dist/entry/prod/css.js +2 -2
  94. package/dist/entry/prod/extract.js +2 -2
  95. package/dist/entry/prod/jsx-dev-runtime.js +2 -2
  96. package/dist/entry/prod/jsx-runtime.js +2 -2
  97. package/dist/entry/prod/runtime.js +5 -4
  98. package/dist/entry/prod.js +40 -11
  99. package/dist/entry/prod.js.map +1 -1
  100. package/dist/entry/rsc-dev/css.js +2 -2
  101. package/dist/entry/rsc-dev/dev.js +4 -5
  102. package/dist/entry/rsc-dev/dev.js.map +1 -1
  103. package/dist/entry/rsc-dev/jsx-dev-runtime.js +2 -2
  104. package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
  105. package/dist/entry/rsc-dev.js +274 -69
  106. package/dist/entry/rsc-dev.js.map +1 -1
  107. package/dist/entry/rsc-prod/css.js +2 -2
  108. package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
  109. package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
  110. package/dist/entry/rsc-prod/runtime.js +5 -4
  111. package/dist/entry/rsc-prod.js +16 -10
  112. package/dist/entry/rsc-prod.js.map +1 -0
  113. package/dist/extract-B-Vs88ME.js +3 -0
  114. package/dist/{extract-CzWJeQi8.js → extract-CM8Fk2eK.js} +24 -15
  115. package/dist/{extract-CzWJeQi8.js.map → extract-CM8Fk2eK.js.map} +1 -1
  116. package/dist/{getClassName-C6690_nr.js → getClassName-CrNVjAoJ.js} +29 -8
  117. package/dist/getClassName-CrNVjAoJ.js.map +1 -0
  118. package/dist/{global-C7GsCW6Y.js → global-CZBlA9E7.js} +3 -3
  119. package/dist/{global-C7GsCW6Y.js.map → global-CZBlA9E7.js.map} +1 -1
  120. package/dist/{hash-Bycpk3MR.js → hash-BfeJDf5U.js} +13 -4
  121. package/dist/hash-BfeJDf5U.js.map +1 -0
  122. package/dist/index.js +9 -10
  123. package/dist/jsx/jsx-dev-runtime.js +2 -2
  124. package/dist/jsx/jsx-dev-runtime.server.js +1 -1
  125. package/dist/jsx/jsx-runtime.js +2 -2
  126. package/dist/jsx/jsx-runtime.server.js +1 -1
  127. package/dist/{jsx-Berx-L-r.js → jsx-BY1iFewe.js} +3 -3
  128. package/dist/{jsx-Berx-L-r.js.map → jsx-BY1iFewe.js.map} +1 -1
  129. package/dist/{jsx-DsMajv_M.js → jsx-DL-DEAz8.js} +8 -7
  130. package/dist/{jsx-DsMajv_M.js.map → jsx-DL-DEAz8.js.map} +1 -1
  131. package/dist/{jsx_dev_runtime-DXlSD6kV.js → jsx_dev_runtime-aAhNYDeS.js} +2 -2
  132. package/dist/{jsx_dev_runtime-DXlSD6kV.js.map → jsx_dev_runtime-aAhNYDeS.js.map} +1 -1
  133. package/dist/{jsx_runtime-DPWo5qvV.js → jsx_runtime-C6i1bWlu.js} +2 -2
  134. package/dist/{jsx_runtime-DPWo5qvV.js.map → jsx_runtime-C6i1bWlu.js.map} +1 -1
  135. package/dist/{jsx_runtime-CMdEXGNZ.js → jsx_runtime-D7Y5up6H.js} +2 -2
  136. package/dist/{jsx_runtime-CMdEXGNZ.js.map → jsx_runtime-D7Y5up6H.js.map} +1 -1
  137. package/dist/{layer-DiNeeTgG.js → layer-BSxAr-hy.js} +4 -4
  138. package/dist/{layer-DiNeeTgG.js.map → layer-BSxAr-hy.js.map} +1 -1
  139. package/dist/{loader-DCT1Q9yi.mjs → loader-BmYS_Rju.mjs} +3 -3
  140. package/dist/{loader-DCT1Q9yi.mjs.map → loader-BmYS_Rju.mjs.map} +1 -1
  141. package/dist/{misc-o8pviMUi.mjs → misc-BIS_c7BJ.mjs} +2 -2
  142. package/dist/{misc-o8pviMUi.mjs.map → misc-BIS_c7BJ.mjs.map} +1 -1
  143. package/dist/{namedTokens-BUa6raTb.js → namedTokens-CN_yhhik.js} +8 -6
  144. package/dist/namedTokens-CN_yhhik.js.map +1 -0
  145. package/dist/plugin/farm/index.mjs +2 -2
  146. package/dist/plugin/nextjs/index.mjs +4 -4
  147. package/dist/plugin/nextjs/loader.mjs +4 -4
  148. package/dist/plugin/parcel/optimizer.cjs +3 -2
  149. package/dist/plugin/parcel/optimizer.cjs.map +1 -1
  150. package/dist/plugin/parcel/optimizer.mjs +3 -2
  151. package/dist/plugin/parcel/optimizer.mjs.map +1 -1
  152. package/dist/plugin/parcel/resolver.cjs +1 -1
  153. package/dist/plugin/parcel/resolver.mjs +2 -2
  154. package/dist/plugin/parcel/runtime.cjs +1 -1
  155. package/dist/plugin/parcel/runtime.mjs +1 -1
  156. package/dist/plugin/parcel/transformer.cjs +1 -1
  157. package/dist/plugin/parcel/transformer.mjs +2 -2
  158. package/dist/plugin/rspack/index.mjs +1 -1
  159. package/dist/plugin/vite/index.mjs +3 -3
  160. package/dist/plugin/webpack/index.mjs +1 -1
  161. package/dist/plugin/webpack/loader.mjs +2 -2
  162. package/dist/presets/tailwind/index.js +8 -5
  163. package/dist/presets/tailwind/index.js.map +1 -1
  164. package/dist/{property-BzZSTVIh.js → property-BuLbzviK.js} +2 -2
  165. package/dist/{property-BzZSTVIh.js.map → property-BuLbzviK.js.map} +1 -1
  166. package/dist/{registry-D3x1EDJm.mjs → registry-IaXmLQzA.mjs} +2 -2
  167. package/dist/{registry-D3x1EDJm.mjs.map → registry-IaXmLQzA.mjs.map} +1 -1
  168. package/dist/{rules-Dz7Pu2K6.js → rules-CxVzovt-.js} +60 -23
  169. package/dist/rules-CxVzovt-.js.map +1 -0
  170. package/dist/selector-A-mRmMnI.js +64 -0
  171. package/dist/selector-A-mRmMnI.js.map +1 -0
  172. package/dist/server.js +12 -13
  173. package/dist/server.js.map +1 -1
  174. package/dist/{shared-B_gJf5uj.cjs → shared-CaJuvw03.cjs} +270 -124
  175. package/dist/shared-CaJuvw03.cjs.map +1 -0
  176. package/dist/{shared-uAzFeq0x.mjs → shared-DdPTZ0O3.mjs} +4 -4
  177. package/dist/{shared-uAzFeq0x.mjs.map → shared-DdPTZ0O3.mjs.map} +1 -1
  178. package/dist/sheet-BWBzuy4D.js +7 -0
  179. package/dist/{sheet-DasbRnvy.js.map → sheet-BWBzuy4D.js.map} +1 -1
  180. package/dist/{sidecar-BUO1hKXu.mjs → sidecar-B3oCK9vC.mjs} +3 -3
  181. package/dist/{sidecar-BUO1hKXu.mjs.map → sidecar-B3oCK9vC.mjs.map} +1 -1
  182. package/dist/{style-BkeAZl0n.js → style-CGaJndOl.js} +102 -54
  183. package/dist/style-CGaJndOl.js.map +1 -0
  184. package/dist/{style-DUztHzBz.js → style-DDxjKdX0.js} +354 -48
  185. package/dist/style-DDxjKdX0.js.map +1 -0
  186. package/dist/style-S7LTQbRu.js +5 -0
  187. package/dist/{styleStore-DVDp-gI-.js → styleStore-0fARJlZV.js} +6 -6
  188. package/dist/{styleStore-DVDp-gI-.js.map → styleStore-0fARJlZV.js.map} +1 -1
  189. package/dist/{styleStore-BGJ2ZYtK.js → styleStore-CajcAEPO.js} +101 -223
  190. package/dist/styleStore-CajcAEPO.js.map +1 -0
  191. package/dist/symbols-Cp4ymzKF.js +14 -0
  192. package/dist/symbols-Cp4ymzKF.js.map +1 -0
  193. package/dist/token-D-S-4_mN.js +138 -0
  194. package/dist/token-D-S-4_mN.js.map +1 -0
  195. package/dist/{trace-D0IL6JT8.js → trace-CFnhyCVf.js} +2 -2
  196. package/dist/{trace-D0IL6JT8.js.map → trace-CFnhyCVf.js.map} +1 -1
  197. package/dist/{trace-DR7_Rpkg.js → trace-ZtgeY-8s.js} +3 -3
  198. package/dist/{trace-DR7_Rpkg.js.map → trace-ZtgeY-8s.js.map} +1 -1
  199. package/dist/{transform-BTJOg8Hg.js → transform-BkrLIiIR.js} +2 -2
  200. package/dist/{transform-BTJOg8Hg.js.map → transform-BkrLIiIR.js.map} +1 -1
  201. package/dist/{utils-CpA-dSpY.mjs → utils-B5Xqf1lV.mjs} +4 -4
  202. package/dist/{utils-CpA-dSpY.mjs.map → utils-B5Xqf1lV.mjs.map} +1 -1
  203. package/dist/{utils-D4YWF2K0.js → utils-B_VhPBHH.js} +4 -4
  204. package/dist/{utils-D4YWF2K0.js.map → utils-B_VhPBHH.js.map} +1 -1
  205. package/dist/{utils-R6QadAsY.js → utils-CDUaX81o.js} +3 -3
  206. package/dist/{utils-R6QadAsY.js.map → utils-CDUaX81o.js.map} +1 -1
  207. package/dist/{utils-DQGa0uzS.mjs → utils-DaAiEEIG.mjs} +3 -3
  208. package/dist/{utils-DQGa0uzS.mjs.map → utils-DaAiEEIG.mjs.map} +1 -1
  209. package/dist/{utils-BsbfH6cd.js → utils-DzydRwYo.js} +77 -49
  210. package/dist/utils-DzydRwYo.js.map +1 -0
  211. package/dist/utils.js +3 -3
  212. package/dist/value-C0JRsyax.js +64 -0
  213. package/dist/value-C0JRsyax.js.map +1 -0
  214. package/dist/{value-DBtSe-9B.js → value-D08AocUs.js} +115 -62
  215. package/dist/value-D08AocUs.js.map +1 -0
  216. package/dist/{valueRef-CsLVJwjA.js → valueRef-M3E1oza7.js} +2 -2
  217. package/dist/{valueRef-CsLVJwjA.js.map → valueRef-M3E1oza7.js.map} +1 -1
  218. package/dist/{webpack-Fb9xF5jS.mjs → webpack-CHydnRXB.mjs} +5 -5
  219. package/dist/{webpack-Fb9xF5jS.mjs.map → webpack-CHydnRXB.mjs.map} +1 -1
  220. package/dist/{withTokens-LRidu3Vc.js → withTokens-DAzUIPvA.js} +2 -2
  221. package/dist/{withTokens-LRidu3Vc.js.map → withTokens-DAzUIPvA.js.map} +1 -1
  222. package/entry/prod/config_debug.ts +2 -0
  223. package/entry/prod/index.ts +1 -1
  224. package/entry/prod/runtime.ts +3 -1
  225. package/entry/rsc_prod/config_debug.ts +6 -0
  226. package/entry/rsc_prod/index.ts +1 -1
  227. package/entry/shared/config_debug.ts +9 -0
  228. package/entry/shared/config_dev.ts +9 -7
  229. package/package.json +1 -1
  230. package/plugin/bundler/parcel/optimizer.ts +1 -0
  231. package/presets/tailwind/style/transform.ts +9 -3
  232. package/runtime/core/cache/combine.ts +44 -25
  233. package/runtime/core/cache/combineRuntime.ts +4 -0
  234. package/runtime/core/cache/index.ts +2 -1
  235. package/runtime/core/cache/item.ts +2 -2
  236. package/runtime/core/cache/pool.ts +15 -30
  237. package/runtime/core/cache/prop.ts +3 -2
  238. package/runtime/core/cache/token.ts +20 -0
  239. package/runtime/core/cache/tokenValues.ts +19 -11
  240. package/runtime/extract/combineStyle.ts +37 -0
  241. package/runtime/extract/getClassName.ts +5 -11
  242. package/runtime/extract/index.ts +3 -1
  243. package/runtime/extract/token.ts +41 -0
  244. package/runtime/extract/tokenResolver.ts +17 -0
  245. package/runtime/style/style.ts +2 -1
  246. package/style/style.ts +1 -1
  247. package/style/theme.ts +0 -1
  248. package/style/token.ts +26 -21
  249. package/style/tokens.ts +18 -12
  250. package/style/transform.ts +1 -1
  251. package/style/value.ts +26 -11
  252. package/style/valueRef.ts +1 -1
  253. package/utils/global.ts +1 -3
  254. package/utils/symbol.ts +3 -0
  255. package/dist/className-Cuh2JNxO.js +0 -263
  256. package/dist/className-Cuh2JNxO.js.map +0 -1
  257. package/dist/compiler-BXcGyZUP.mjs.map +0 -1
  258. package/dist/config-C1k9vUrM.js.map +0 -1
  259. package/dist/config-CLYMN3_p.js.map +0 -1
  260. package/dist/config-DcYrUB-M.js +0 -6
  261. package/dist/config-oI_yS50f.js +0 -1
  262. package/dist/css-CELBp6Gu.js.map +0 -1
  263. package/dist/css-DfH4Gb1c.js.map +0 -1
  264. package/dist/data-Ze8GNiJm.js.map +0 -1
  265. package/dist/debug-BefbXMq1.js +0 -15
  266. package/dist/debug-BefbXMq1.js.map +0 -1
  267. package/dist/debug-OG2wSB5R.js +0 -15
  268. package/dist/debug-OG2wSB5R.js.map +0 -1
  269. package/dist/dev-4TqJORRn.js.map +0 -1
  270. package/dist/extract-B9j4TBkU.js +0 -2
  271. package/dist/getClassName-C6690_nr.js.map +0 -1
  272. package/dist/global-zaCE-g1C.js.map +0 -1
  273. package/dist/hash-Bycpk3MR.js.map +0 -1
  274. package/dist/namedTokens-BUa6raTb.js.map +0 -1
  275. package/dist/rules-Dz7Pu2K6.js.map +0 -1
  276. package/dist/runtime-B3jHW9B1.js +0 -32
  277. package/dist/runtime-B3jHW9B1.js.map +0 -1
  278. package/dist/shared-B_gJf5uj.cjs.map +0 -1
  279. package/dist/sheet-DasbRnvy.js +0 -7
  280. package/dist/style-B0F1sgRZ.js +0 -5
  281. package/dist/style-BkeAZl0n.js.map +0 -1
  282. package/dist/style-CYXTs1iu.js.map +0 -1
  283. package/dist/style-DUztHzBz.js.map +0 -1
  284. package/dist/styleStore-BGJ2ZYtK.js.map +0 -1
  285. package/dist/token-CA1j7suG.js +0 -273
  286. package/dist/token-CA1j7suG.js.map +0 -1
  287. package/dist/token-CKXUECuU.js +0 -76
  288. package/dist/token-CKXUECuU.js.map +0 -1
  289. package/dist/token-DTOyFLmp.js +0 -58
  290. package/dist/token-DTOyFLmp.js.map +0 -1
  291. package/dist/utils-BsbfH6cd.js.map +0 -1
  292. package/dist/value-CJG6EWe8.js +0 -85
  293. package/dist/value-CJG6EWe8.js.map +0 -1
  294. package/dist/value-D-ZcRzLA.js +0 -42
  295. package/dist/value-D-ZcRzLA.js.map +0 -1
  296. package/dist/value-DBtSe-9B.js.map +0 -1
@@ -8,7 +8,6 @@ import type { ImportSource } from '../utils/import_source';
8
8
  import type { GetSourcemapFilePathFn } from '../utils/sourcemap';
9
9
 
10
10
  export type CompilerCssOptions = Partial<CssConfig> & {
11
- localClassName?: boolean;
12
11
  debugClassName?: boolean;
13
12
  };
14
13
 
@@ -34,6 +34,7 @@ import {
34
34
  annotateThemeCall,
35
35
  annotateTokenDeclaration,
36
36
  getImportedName,
37
+ getObjectPropertyKey,
37
38
  isStyleChainCall,
38
39
  } from '../syntax';
39
40
  import type { BabelCore, BabelTypes, NodePath } from '../utils/babel';
@@ -552,12 +553,13 @@ function getDebugStyleArg(
552
553
  ) {
553
554
  const arg = getStyleObjectArg(path, state);
554
555
  if (!arg) return arg;
556
+ const meta = getStyleCallMeta(path, state);
555
557
 
556
558
  if (arg.type !== 'ObjectExpression') {
557
559
  return resolveDebugMergeObject(t, arg, path, state, sourcemapTrace) ?? arg;
558
560
  }
559
561
 
560
- return flattenDebugObjectExpression(
562
+ const flattened = flattenDebugObjectExpression(
561
563
  t,
562
564
  arg,
563
565
  path,
@@ -565,6 +567,8 @@ function getDebugStyleArg(
565
567
  sourcemapTrace,
566
568
  new Set(),
567
569
  );
570
+
571
+ return appendTransformDebugFieldAliases(t, flattened, meta, state);
568
572
  }
569
573
 
570
574
  function getDebugCallLoc(
@@ -594,6 +598,14 @@ function getStyleObjectArg(
594
598
  return path.node.arguments[styleArgIndex];
595
599
  }
596
600
 
601
+ function getStyleCallMeta(
602
+ path: NodePath<BabelTypes.CallExpression>,
603
+ state: PluginState,
604
+ ) {
605
+ const rootName = getStyleChainRootName(path.node.callee, state.styleNames);
606
+ return rootName ? state.styleMetas.get(rootName) ?? null : null;
607
+ }
608
+
597
609
  function isSelectorStyleCall(
598
610
  path: NodePath<BabelTypes.CallExpression>,
599
611
  state: PluginState,
@@ -836,6 +848,72 @@ function flattenDebugObjectExpression(
836
848
  return t.objectExpression(properties);
837
849
  }
838
850
 
851
+ function appendTransformDebugFieldAliases(
852
+ t: typeof BabelTypes,
853
+ node: BabelTypes.ObjectExpression,
854
+ meta: StyleFnMeta | null,
855
+ state: PluginState,
856
+ ) {
857
+ if (!meta || meta.mode !== 'StyleObject' || !meta.transform) return node;
858
+
859
+ const existing = new Set<string>();
860
+ for (const property of node.properties) {
861
+ if (property.type !== 'ObjectProperty' || property.computed) continue;
862
+ const key = getObjectPropertyKey(property);
863
+ if (key) existing.add(key);
864
+ }
865
+
866
+ const aliases: BabelTypes.ObjectProperty[] = [];
867
+
868
+ for (const property of node.properties) {
869
+ if (property.type !== 'ObjectProperty' || property.computed) continue;
870
+
871
+ const key = getObjectPropertyKey(property);
872
+ if (!key) continue;
873
+
874
+ const value = evaluateNode(property.value, getDebugEvalScope(state));
875
+ if (!value.ok) continue;
876
+
877
+ let transformed: Record<string, unknown>;
878
+ try {
879
+ transformed = meta.transform.transform({ [key]: value.value }) as Record<string, unknown>;
880
+ } catch {
881
+ continue;
882
+ }
883
+
884
+ for (const transformedKey of Object.keys(transformed)) {
885
+ if (existing.has(transformedKey)) continue;
886
+
887
+ existing.add(transformedKey);
888
+ aliases.push(createDebugFieldAlias(t, transformedKey, property));
889
+ }
890
+ }
891
+
892
+ if (!aliases.length) return node;
893
+
894
+ return t.objectExpression([
895
+ ...node.properties,
896
+ ...aliases,
897
+ ]);
898
+ }
899
+
900
+ function createDebugFieldAlias(
901
+ t: typeof BabelTypes,
902
+ key: string,
903
+ source: BabelTypes.ObjectProperty,
904
+ ) {
905
+ const alias = t.objectProperty(t.stringLiteral(key), t.nullLiteral()) as DebugTraceProperty;
906
+ const sourceTrace = source as DebugTraceProperty;
907
+
908
+ alias.loc = source.loc;
909
+ alias.__styleSourcemapStyleLoc = sourceTrace.__styleSourcemapStyleLoc;
910
+ alias.__styleSourcemapStyleSourceUrl = sourceTrace.__styleSourcemapStyleSourceUrl;
911
+ alias.__styleSourcemapValueLoc = sourceTrace.__styleSourcemapValueLoc;
912
+ alias.__styleSourcemapValueSourceUrl = sourceTrace.__styleSourcemapValueSourceUrl;
913
+
914
+ return alias;
915
+ }
916
+
839
917
  function resolveDebugSpreadObject(
840
918
  t: typeof BabelTypes,
841
919
  spread: BabelTypes.SpreadElement,
@@ -13,6 +13,7 @@ import {
13
13
  createExtractedStyleMerge,
14
14
  getExtractedStyleItems,
15
15
  } from '../../../builder/extract';
16
+ import { getChildStyleTokenName, getStyleTokenNameFromId, normalizeStyleTokenName } from '../../../builder/token/name';
16
17
  import { CSS_CONFIG } from '../../../config/config/css';
17
18
  import { CSS_EXTRA_CONFIG } from '../../../config/config/css_extra';
18
19
  import type { NamedAtRuleFormat, TokenNameFormat } from '../../../config/types';
@@ -21,10 +22,12 @@ import { transformKeyframes } from '../../../style/keyframes';
21
22
  import type { StyleFnMeta } from '../../../style/style';
22
23
  import {
23
24
  getStyleTokenId,
25
+ getStyleTokenName,
24
26
  isStyleTokenData,
25
27
  type StyleTokenData,
26
28
  type StyleTokenOverride,
27
29
  TOKEN_ID,
30
+ TOKEN_NAME,
28
31
  TOKEN_OVERRIDE,
29
32
  } from '../../../style/token';
30
33
  import type { StyleTransform } from '../../../style/transform';
@@ -32,6 +35,7 @@ import { exposeStyle } from '../../../style/utils';
32
35
  import { type AtRuleRef, createAtRuleRef } from '../../../style/valueRef';
33
36
  import { hashString } from '../../../utils/hash';
34
37
  import type { StableId } from '../../../utils/id';
38
+ import type { CompilerRuntimeMode } from '../../compiler';
35
39
  import {
36
40
  FN_CREATE_COUNTER_STYLE,
37
41
  FN_CREATE_EXTRACTED_SCOPE,
@@ -107,6 +111,7 @@ export type EvalScope = {
107
111
  bindingNodes?: Map<string, BabelTypes.Node>;
108
112
  styleTransform?: StyleTransform | null;
109
113
  sourcemapTrace?: 'style' | 'value';
114
+ runtimeMode?: CompilerRuntimeMode | null;
110
115
  };
111
116
 
112
117
  export function evaluateNode(
@@ -471,10 +476,10 @@ function evaluateCall(node: BabelTypes.CallExpression, scope: EvalScope): EvalRe
471
476
  const value = evaluateNode(node.arguments[0] as BabelTypes.Node, scope);
472
477
  if (!value.ok) return value;
473
478
 
474
- const debugId = evaluateOptionalDebugId(node.arguments[1] as BabelTypes.Node, scope);
475
- if (!debugId.ok) return debugId;
479
+ const stableId = evaluateOptionalStableTokenId(node.arguments[1] as BabelTypes.Node, scope);
480
+ if (!stableId.ok) return stableId;
476
481
 
477
- return evalOk(createCompiledToken(value.value, scope, node.loc?.start, node, debugId.value));
482
+ return evalOk(createCompiledToken(value.value, scope, node.loc?.start, node, stableId.value));
478
483
  }
479
484
 
480
485
  if (imp && STYLE_IMPORT_PATHS.has(imp.source) && imp.name === FN_CREATE_KEYFRAMES) {
@@ -595,7 +600,7 @@ function evaluateCall(node: BabelTypes.CallExpression, scope: EvalScope): EvalRe
595
600
  if (!url.ok) return evalFail(`fontSrc url must be statically analyzable: ${url.reason}`);
596
601
  if (typeof url.value !== 'string') return evalFail('fontSrc url must be a static string');
597
602
 
598
- const format = evaluateOptionalDebugId(node.arguments[1] as BabelTypes.Node, scope);
603
+ const format = evaluateOptionalString(node.arguments[1] as BabelTypes.Node, scope);
599
604
  if (!format.ok) return evalFail(`fontSrc format must be statically analyzable: ${format.reason}`);
600
605
 
601
606
  return evalOk(fontSrc(url.value, format.value));
@@ -605,10 +610,10 @@ function evaluateCall(node: BabelTypes.CallExpression, scope: EvalScope): EvalRe
605
610
  const value = evaluateNode(node.arguments[0] as BabelTypes.Node, scope);
606
611
  if (!value.ok) return value;
607
612
 
608
- const debugId = evaluateOptionalDebugId(node.arguments[1] as BabelTypes.Node, scope);
609
- if (!debugId.ok) return debugId;
613
+ const stableId = evaluateOptionalStableTokenId(node.arguments[1] as BabelTypes.Node, scope);
614
+ if (!stableId.ok) return stableId;
610
615
 
611
- return evalOk(createCompiledTokens(value.value, scope, node.loc?.start, node, debugId.value));
616
+ return evalOk(createCompiledTokens(value.value, scope, node.loc?.start, node, stableId.value));
612
617
  }
613
618
 
614
619
  if (imp && STYLE_IMPORT_PATHS.has(imp.source) && imp.name === FN_CREATE_NAMED_TOKEN) {
@@ -651,19 +656,19 @@ function evaluateCall(node: BabelTypes.CallExpression, scope: EvalScope): EvalRe
651
656
  (node.arguments[0] as BabelTypes.Identifier).name === 'Number';
652
657
 
653
658
  const valuesNode = hasNumberArg ? node.arguments[1] : node.arguments[0];
654
- const debugNode = hasNumberArg ? node.arguments[2] : node.arguments[1];
659
+ const stableIdNode = hasNumberArg ? node.arguments[2] : node.arguments[1];
655
660
 
656
661
  const values = evaluateNode(valuesNode as BabelTypes.Node, scope);
657
662
  if (!values.ok) return values;
658
663
 
659
- const debugId = evaluateOptionalDebugId(debugNode as BabelTypes.Node, scope);
660
- if (!debugId.ok) return debugId;
664
+ const stableId = evaluateOptionalStableTokenId(stableIdNode as BabelTypes.Node, scope);
665
+ if (!stableId.ok) return stableId;
661
666
 
662
667
  if (!Array.isArray(values.value)) {
663
668
  return evalFail('createValues values must be an array');
664
669
  }
665
670
 
666
- return evalOk(createCompiledValues(values.value, scope, node.loc?.start, node, debugId.value, hasNumberArg));
671
+ return evalOk(createCompiledValues(values.value, scope, node.loc?.start, node, stableId.value, hasNumberArg));
667
672
  }
668
673
  }
669
674
 
@@ -877,6 +882,7 @@ function createCompiledTokenOverride(
877
882
  return withRuntimeValue(runtimeValue, {
878
883
  [TOKEN_ID]: getStyleTokenId(token),
879
884
  [TOKEN_OVERRIDE]: true,
885
+ [TOKEN_NAME]: getStyleTokenName(token),
880
886
  value: value.value,
881
887
  ref: value,
882
888
  });
@@ -885,6 +891,7 @@ function createCompiledTokenOverride(
885
891
  return withRuntimeValue(runtimeValue, {
886
892
  [TOKEN_ID]: getStyleTokenId(token),
887
893
  [TOKEN_OVERRIDE]: true,
894
+ [TOKEN_NAME]: getStyleTokenName(token),
888
895
  value,
889
896
  ref: null,
890
897
  });
@@ -895,9 +902,10 @@ function createCompiledToken(
895
902
  scope: EvalScope,
896
903
  loc: { line: number; column: number; } | null | undefined,
897
904
  runtimeValue: BabelTypes.Expression,
898
- debugId?: string,
905
+ stableId?: string,
906
+ debugName?: string | null,
899
907
  ): StyleTokenData {
900
- let tokenId = debugId;
908
+ let tokenId = stableId;
901
909
 
902
910
  if (!tokenId) {
903
911
  const hash = (scope.styleFilePath ?? scope.filePath) + '\n' +
@@ -906,8 +914,18 @@ function createCompiledToken(
906
914
  tokenId = hashString(hash);
907
915
  }
908
916
 
917
+ if (isStyleTokenData(value)) {
918
+ return withRuntimeValue(runtimeValue, {
919
+ [TOKEN_ID]: tokenId,
920
+ [TOKEN_NAME]: debugName === undefined ? getStyleTokenNameFromId(stableId) : normalizeStyleTokenName(debugName),
921
+ value: value.value,
922
+ ref: value,
923
+ });
924
+ }
925
+
909
926
  return withRuntimeValue(runtimeValue, {
910
927
  [TOKEN_ID]: tokenId,
928
+ [TOKEN_NAME]: debugName === undefined ? getStyleTokenNameFromId(stableId) : normalizeStyleTokenName(debugName),
911
929
  value,
912
930
  ref: null,
913
931
  });
@@ -918,9 +936,10 @@ function createCompiledTokens(
918
936
  scope: EvalScope,
919
937
  loc: { line: number; column: number; } | null | undefined,
920
938
  runtimeValue: BabelTypes.Expression,
921
- debugId?: string,
939
+ stableId?: string,
922
940
  ) {
923
- const tokenGroupId = debugId ?? createCompiledTokenGroupId(scope, loc);
941
+ const tokenGroupId = stableId ?? createCompiledTokenGroupId(scope, loc);
942
+ const tokenGroupName = getStyleTokenNameFromId(stableId);
924
943
 
925
944
  if (Array.isArray(value)) {
926
945
  const result: Record<PropertyKey, unknown> = {};
@@ -933,7 +952,8 @@ function createCompiledTokens(
933
952
  scope,
934
953
  loc,
935
954
  runtimeValue,
936
- getChildDebugId(tokenGroupId, String(i)),
955
+ getChildStableId(tokenGroupId, String(i)),
956
+ getChildStyleTokenName(tokenGroupName, String(i)),
937
957
  );
938
958
  }
939
959
 
@@ -953,6 +973,7 @@ function createCompiledTokens(
953
973
  loc,
954
974
  runtimeValue,
955
975
  tokenGroupId,
976
+ tokenGroupName,
956
977
  );
957
978
 
958
979
  return result;
@@ -986,11 +1007,13 @@ function assignCompiledTokenRecord(
986
1007
  scope: EvalScope,
987
1008
  loc: { line: number; column: number; } | null | undefined,
988
1009
  runtimeValue: BabelTypes.Expression,
989
- debugId?: string,
1010
+ stableId?: string,
1011
+ debugName?: string | null,
990
1012
  ) {
991
1013
  for (const key of Object.keys(value)) {
992
1014
  const item = value[key];
993
- const itemDebugId = getChildDebugId(debugId, key);
1015
+ const itemStableId = getChildStableId(stableId, key);
1016
+ const itemDebugName = getChildStyleTokenName(debugName, key);
994
1017
 
995
1018
  if (item && typeof item === 'object' && !Array.isArray(item) && !isStyleTokenData(item)) {
996
1019
  const child: Record<PropertyKey, unknown> = {};
@@ -1003,7 +1026,8 @@ function assignCompiledTokenRecord(
1003
1026
  scope,
1004
1027
  loc,
1005
1028
  runtimeValue,
1006
- itemDebugId,
1029
+ itemStableId,
1030
+ itemDebugName,
1007
1031
  );
1008
1032
  } else {
1009
1033
  target[key] = createCompiledToken(
@@ -1011,7 +1035,8 @@ function assignCompiledTokenRecord(
1011
1035
  scope,
1012
1036
  loc,
1013
1037
  runtimeValue,
1014
- itemDebugId,
1038
+ itemStableId,
1039
+ itemDebugName,
1015
1040
  );
1016
1041
  }
1017
1042
  }
@@ -1022,10 +1047,11 @@ function createCompiledValues(
1022
1047
  scope: EvalScope,
1023
1048
  loc: { line: number; column: number; } | null | undefined,
1024
1049
  runtimeValue: BabelTypes.Expression,
1025
- debugId: string | undefined,
1050
+ stableId: string | undefined,
1026
1051
  isNumber: boolean,
1027
1052
  ): CompiledTokenFactory {
1028
1053
  const tokens = new Map<unknown, StyleTokenData>();
1054
+ const groupName = getStyleTokenNameFromId(stableId);
1029
1055
 
1030
1056
  for (let i = 0, len = values.length; i < len; i++) {
1031
1057
  const value = values[i];
@@ -1037,7 +1063,8 @@ function createCompiledValues(
1037
1063
  scope,
1038
1064
  loc,
1039
1065
  runtimeValue,
1040
- getChildDebugId(debugId, hashString(String(value))),
1066
+ getChildStableId(stableId, hashString(String(value))),
1067
+ getChildStyleTokenName(groupName, getValueDebugName(value)),
1041
1068
  ),
1042
1069
  );
1043
1070
  }
@@ -1062,7 +1089,14 @@ function isCompiledTokenFactory(value: unknown): value is CompiledTokenFactory {
1062
1089
  return !!value && typeof value === 'object' && (value as CompiledTokenFactory)[COMPILED_TOKEN_FACTORY] === true;
1063
1090
  }
1064
1091
 
1065
- function evaluateOptionalDebugId(
1092
+ function evaluateOptionalStableTokenId(
1093
+ node: BabelTypes.Node | null | undefined,
1094
+ scope: EvalScope,
1095
+ ): EvalResult & { value?: string; } {
1096
+ return evaluateOptionalString(node, scope);
1097
+ }
1098
+
1099
+ function evaluateOptionalString(
1066
1100
  node: BabelTypes.Node | null | undefined,
1067
1101
  scope: EvalScope,
1068
1102
  ): EvalResult & { value?: string; } {
@@ -1106,11 +1140,26 @@ function evaluateOptionalStableId(
1106
1140
  }) as EvalResult & { value?: StableId; };
1107
1141
  }
1108
1142
 
1109
- function getChildDebugId(
1110
- debugId: string | undefined,
1143
+ function getChildStableId(
1144
+ stableId: string | undefined,
1111
1145
  child: string,
1112
1146
  ) {
1113
- return debugId ? debugId + '--' + child : undefined;
1147
+ return stableId ? stableId + '--' + child : undefined;
1148
+ }
1149
+
1150
+ function getValueDebugName(value: unknown) {
1151
+ if (typeof value === 'number') return String(value);
1152
+ if (typeof value !== 'string') return null;
1153
+
1154
+ const parts = value.split(/[;|]/);
1155
+ const label = parts[1]?.trim();
1156
+ if (label) return sanitizeTokenDebugName(label);
1157
+
1158
+ return sanitizeTokenDebugName(parts[0]?.trim() ?? '');
1159
+ }
1160
+
1161
+ function sanitizeTokenDebugName(value: string) {
1162
+ return value.replace(/[^a-zA-Z0-9_-]+/g, '-').replace(/^-+|-+$/g, '') || null;
1114
1163
  }
1115
1164
 
1116
1165
  function withRuntimeValue<T extends StyleTokenData | StyleTokenOverride>(
@@ -1119,6 +1168,7 @@ function withRuntimeValue<T extends StyleTokenData | StyleTokenOverride>(
1119
1168
  ): T {
1120
1169
  return Object.assign({}, token, {
1121
1170
  [TOKEN_ID]: token[TOKEN_ID],
1171
+ [TOKEN_NAME]: token[TOKEN_NAME] ?? null,
1122
1172
  [COMPILED_RUNTIME_VALUE]: runtimeValue,
1123
1173
  });
1124
1174
  }
@@ -312,7 +312,16 @@ function evaluateResolvedNode(
312
312
  const meta = scope.styleMetas?.get(chain.rootName);
313
313
  if (!meta) return evalFail('Cannot resolve imported style function');
314
314
 
315
- const result = compileChain(chain, fileId, node.loc?.start, scope, options, meta, styleNames);
315
+ const result = compileChain(
316
+ chain,
317
+ fileId,
318
+ node.loc?.start,
319
+ scope,
320
+ options,
321
+ scope.runtimeMode ?? null,
322
+ meta,
323
+ styleNames,
324
+ );
316
325
  if (!result) return evalFail('Cannot compile imported style chain');
317
326
 
318
327
  const traceResult = options.dev?.sourcemapMode === 'value'
@@ -329,6 +338,7 @@ function evaluateResolvedNode(
329
338
  sourcemapMode: 'value',
330
339
  },
331
340
  },
341
+ scope.runtimeMode ?? null,
332
342
  meta,
333
343
  styleNames,
334
344
  ) ?? result;
@@ -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 {
@@ -51,6 +51,7 @@ import {
51
51
  } from '../../../../style/transform';
52
52
  import { isAtRuleRef } from '../../../../style/valueRef';
53
53
  import { hashString } from '../../../../utils/hash';
54
+ import { CompilerRuntimeMode } from '../../../compiler';
54
55
  import type { CompilerOptions } from '../../../compiler/types';
55
56
  import { DEFAULT_CONFIG } from '../../../utils/constants';
56
57
  import {
@@ -91,7 +92,6 @@ type CssConfig = {
91
92
  };
92
93
 
93
94
  type ExtractCssOptions = NonNullable<CompilerOptions['css']> & {
94
- localClassName?: boolean;
95
95
  debugClassName?: boolean;
96
96
  scopeTargetPrefix?: string;
97
97
  };
@@ -326,10 +326,11 @@ export function compileChain(
326
326
  nodeLoc: { line: number; column: number; } | null | undefined,
327
327
  scope: EvalScope,
328
328
  opts: CompilerOptions,
329
+ runtimeMode: CompilerRuntimeMode | null,
329
330
  meta: StyleFnMeta,
330
331
  styleNames: Set<string> = new Set(),
331
332
  ): CompiledChainData | null {
332
- const css = getCssConfig(opts);
333
+ const css = getCssConfig(opts, runtimeMode);
333
334
 
334
335
  if (meta.mode === 'ClassName') {
335
336
  if (chain.kind !== 'style') return null;
@@ -357,16 +358,18 @@ export function compileChain(
357
358
 
358
359
  function getCssConfig(
359
360
  opts: CompilerOptions,
361
+ runtimeMode: CompilerRuntimeMode | null,
360
362
  ): CssConfig {
361
363
  const css = opts.css as ExtractCssOptions | undefined;
364
+ const isDevRuntimeMode = runtimeMode === CompilerRuntimeMode.Dev || runtimeMode === CompilerRuntimeMode.RscDev;
362
365
 
363
366
  return {
364
367
  classNameFormat: css?.classNameFormat ?? DEFAULT_CONFIG.classNameFormat ?? null,
365
368
  transformClassNameFormat: css?.transformClassNameFormat ?? DEFAULT_CONFIG.transformClassNameFormat ?? null,
366
369
  hashLength: css?.hashLength ?? DEFAULT_CONFIG.hashLength ?? 7,
367
370
  tokenNameFormat: css?.tokenNameFormat ?? DEFAULT_CONFIG.tokenNameFormat ?? null,
368
- localClassName: css?.localClassName ?? DEFAULT_CONFIG.localClassName,
369
- debugClassName: css?.debugClassName ?? DEFAULT_CONFIG.debugClassName,
371
+ localClassName: isDevRuntimeMode,
372
+ debugClassName: css?.debugClassName ?? isDevRuntimeMode,
370
373
  scopeTargetPrefix: css?.scopeTargetPrefix ?? '',
371
374
  };
372
375
  }
@@ -202,7 +202,7 @@ export function createExtractPlugin(args: PluginArgs) {
202
202
 
203
203
  let result: ReturnType<typeof compileChain>;
204
204
  try {
205
- result = compileChain(chain, state.fileId, loc, scope, options, meta, state.styleNames);
205
+ result = compileChain(chain, state.fileId, loc, scope, options, state.runtimeMode, meta, state.styleNames);
206
206
  } catch (error) {
207
207
  const message = error instanceof Error ? error.message : String(error);
208
208
  const node = getSelectorCompileErrorNode(error);
@@ -1,3 +1,4 @@
1
+ import { getTokenVarName } from '../../../../atomic/token';
1
2
  import {
2
3
  BUILDER_TYPE_SCOPE,
3
4
  BUILDER_TYPE_SLOT,
@@ -8,8 +9,9 @@ import {
8
9
  ITEM_VALUE_TYPE_VARIABLE,
9
10
  } from '../../../../builder/data/const';
10
11
  import type { BuilderType, ExtractedItemValue } from '../../../../builder/data/state';
11
- import { getStyleTokenId, isStyleTokenData, type StyleTokenData } from '../../../../style/token';
12
+ import { getStyleTokenId, getStyleTokenName, isStyleTokenData, type StyleTokenData } from '../../../../style/token';
12
13
  import type { AtRuleRefData } from '../../../../style/valueRef';
14
+ import { DEFAULT_CONFIG } from '../../../utils/constants';
13
15
  import {
14
16
  FN_CREATE_EXTRACTED_SCOPE,
15
17
  FN_CREATE_EXTRACTED_SLOT,
@@ -325,6 +327,7 @@ function buildExtractedTokenExpression(
325
327
  state: ExtractPluginState,
326
328
  ): BabelTypes.Expression {
327
329
  state.usedHelpers.add(FN_CREATE_EXTRACTED_TOKEN);
330
+ const tokenNameFormat = state.options.css?.tokenNameFormat ?? DEFAULT_CONFIG.tokenNameFormat ?? null;
328
331
 
329
332
  return t.callExpression(
330
333
  t.identifier(FN_CREATE_EXTRACTED_TOKEN),
@@ -332,6 +335,8 @@ function buildExtractedTokenExpression(
332
335
  t.stringLiteral(getStyleTokenId(token)),
333
336
  literalExpression(t, token.value),
334
337
  token.ref ? buildExtractedTokenExpression(t, token.ref, state) : t.nullLiteral(),
338
+ getStyleTokenName(token) ? t.stringLiteral(getStyleTokenName(token)!) : t.nullLiteral(),
339
+ t.stringLiteral(getTokenVarName(token, tokenNameFormat)),
335
340
  ],
336
341
  );
337
342
  }
@@ -44,5 +44,6 @@ export function getEvalScope(state: ExtractPluginState): EvalScope {
44
44
  styleNames: state.styleNames,
45
45
  styleMetas: state.styleMetas,
46
46
  bindingNodes: state.bindingNodes,
47
+ runtimeMode: state.runtimeMode,
47
48
  };
48
49
  }
@@ -34,10 +34,10 @@ export function compileThemeCall(
34
34
  throw path.buildCodeFrameError('createTheme first argument must be a static array of token overrides.');
35
35
  }
36
36
 
37
- const debugIdArg = evaluateNode(path.node.arguments[1] as BabelTypes.Node, scope);
37
+ const stableIdArg = evaluateNode(path.node.arguments[1] as BabelTypes.Node, scope);
38
38
 
39
- if (path.node.arguments[1] && !debugIdArg.ok) {
40
- throw path.buildCodeFrameError(`createTheme debugId must be statically analyzable: ${debugIdArg.reason}`);
39
+ if (path.node.arguments[1] && !stableIdArg.ok) {
40
+ throw path.buildCodeFrameError(`createTheme stableId must be statically analyzable: ${stableIdArg.reason}`);
41
41
  }
42
42
 
43
43
  const tokens: StyleTokenOverride[] = [];
@@ -54,11 +54,11 @@ export function compileThemeCall(
54
54
 
55
55
  const loc = path.node.loc?.start;
56
56
 
57
- const debugId = debugIdArg.ok && debugIdArg.value !== undefined
58
- ? String(debugIdArg.value)
57
+ const stableId = stableIdArg.ok && stableIdArg.value !== undefined
58
+ ? String(stableIdArg.value)
59
59
  : getStableThemeId(state.fileId, loc ? loc.line + ':' + loc.column : 'createTheme');
60
60
 
61
- const id = debugId;
61
+ const id = stableId;
62
62
 
63
63
  const themeNameFormat = opts.css?.themeNameFormat || CSS_CONFIG.themeNameFormat || null;
64
64
 
@@ -1,5 +1,5 @@
1
1
  import { createThemeClassName } from '../../../atomic/theme';
2
- import { sanitizeCssIdentName } from '../../../atomic/utils/css';
2
+ import { sanitizeCssIdentName } from '../../../atomic/utils/cssIdent';
3
3
  import type { ThemeNameFormat } from '../../../config/types';
4
4
  import { hashString } from '../../../utils/hash';
5
5
  import {
@@ -1,6 +1,4 @@
1
1
  import { CSS_CONFIG_DEFAULT } from '../../config/config/css';
2
- import { DEFAULT_DEBUG_CONFIG } from '../../config/config/debug';
3
- import { DEV_CONFIG_DEFAULT } from '../../config/config/dev';
4
2
 
5
3
  const pkg = '@fluentic/style';
6
4
 
@@ -15,8 +13,6 @@ export const STYLE_RSC_EXTRACT_RUNTIME_IMPORT_PATH = pkg + '/entry/rsc-prod/runt
15
13
 
16
14
  export const DEFAULT_CONFIG = {
17
15
  ...CSS_CONFIG_DEFAULT,
18
- localClassName: DEV_CONFIG_DEFAULT.isLocalClassNameEnabled,
19
- debugClassName: DEFAULT_DEBUG_CONFIG.isDebugClassNameEnabled,
20
16
  };
21
17
 
22
18
  export const IMPORT_PATHS = [
package/config/build.ts CHANGED
@@ -5,7 +5,9 @@ import type { DevRuntimeOptions } from './config/dev';
5
5
  import { RUNTIME_CONFIG } from './config/runtime';
6
6
  import type { CheckSelectorMode } from './types';
7
7
 
8
- export type BuildCssConfig = Partial<CssConfig>;
8
+ export type BuildCssConfig = Partial<CssConfig> & {
9
+ debugClassName?: boolean;
10
+ };
9
11
 
10
12
  export type BuildDevConfig = ReplaceProps<DevRuntimeOptions, {
11
13
  checkSelector?: CheckSelectorMode;
@@ -27,6 +29,7 @@ export function setBuildConfig(config: BuildConfig) {
27
29
  RUNTIME_CONFIG.isHoist = config.hoist;
28
30
 
29
31
  if (config.css) {
30
- Object.assign(CSS_CONFIG, config.css);
32
+ const { debugClassName: _debugClassName, ...css } = config.css;
33
+ Object.assign(CSS_CONFIG, css);
31
34
  }
32
35
  }
@@ -2,6 +2,7 @@ import { globalData } from '../../utils/global';
2
2
 
3
3
  export type DebugConfig = {
4
4
  isDebugClassNameEnabled: boolean;
5
+ isDebugClassNameConfigured: boolean;
5
6
 
6
7
  maxPropertyLength: number;
7
8
  maxValueLength: number;
@@ -11,7 +12,8 @@ export type DebugConfig = {
11
12
  };
12
13
 
13
14
  export const DEFAULT_DEBUG_CONFIG: DebugConfig = {
14
- isDebugClassNameEnabled: true,
15
+ isDebugClassNameEnabled: false,
16
+ isDebugClassNameConfigured: false,
15
17
 
16
18
  maxPropertyLength: 24,
17
19
  maxValueLength: 8,
@@ -24,3 +26,24 @@ export const DEBUG_CONFIG = globalData<DebugConfig>(
24
26
  'config.debug',
25
27
  () => ({ ...DEFAULT_DEBUG_CONFIG }),
26
28
  );
29
+
30
+ export function setDebugClassNameEnabled(value: boolean) {
31
+ DEBUG_CONFIG.isDebugClassNameEnabled = value;
32
+ DEBUG_CONFIG.isDebugClassNameConfigured = true;
33
+ }
34
+
35
+ export function setDebugClassNameDefault(value: boolean) {
36
+ if (DEBUG_CONFIG.isDebugClassNameConfigured) return;
37
+ DEBUG_CONFIG.isDebugClassNameEnabled = value;
38
+ }
39
+
40
+ export function setBuildDebugClassName(
41
+ value: boolean | undefined,
42
+ fallback: boolean,
43
+ ) {
44
+ if (typeof value === 'boolean') {
45
+ setDebugClassNameEnabled(value);
46
+ } else {
47
+ setDebugClassNameDefault(fallback);
48
+ }
49
+ }