@fluentic/style 0.1.0-beta.3 → 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 (281) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +1 -1
  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/transform/debug/plugin.ts +79 -1
  21. package/compiler/transform/evaluator/evaluator.ts +74 -26
  22. package/compiler/transform/extract/chain/chain.ts +1 -1
  23. package/compiler/transform/extract/utils/replacement.ts +6 -1
  24. package/compiler/transform/extract/utils/theme.ts +6 -6
  25. package/compiler/transform/syntax/static_ids.ts +1 -1
  26. package/config/build.ts +1 -8
  27. package/config/config/debug.ts +11 -0
  28. package/dialect/namedTokens.ts +22 -5
  29. package/dist/{className-CKo4TxuT.js → className-Do2Crx4b.js} +2 -3
  30. package/dist/{className-CKo4TxuT.js.map → className-Do2Crx4b.js.map} +1 -1
  31. package/dist/{style-91J0B5ef.js → combine-C9vjpKCs.js} +45 -304
  32. package/dist/combine-C9vjpKCs.js.map +1 -0
  33. package/dist/combineStyle-DwAhsOmS.js +26 -0
  34. package/dist/combineStyle-DwAhsOmS.js.map +1 -0
  35. package/dist/compiler/index.mjs +1 -1
  36. package/dist/{compiler-D5v5tJXI.mjs → compiler-CE0ZgkdH.mjs} +231 -84
  37. package/dist/compiler-CE0ZgkdH.mjs.map +1 -0
  38. package/dist/config/index.js +2 -2
  39. package/dist/config-BE5D5x2N.js +2 -0
  40. package/dist/{config-BEvP7108.js → config-BtANtGAh.js} +4 -6
  41. package/dist/config-BtANtGAh.js.map +1 -0
  42. package/dist/{config-FIfi5aJ8.js → config-CduqubI8.js} +8 -6
  43. package/dist/config-CduqubI8.js.map +1 -0
  44. package/dist/config-lJNLh7eM.js +6 -0
  45. package/dist/config-lJNLh7eM.js.map +1 -0
  46. package/dist/config-oKOjOTWi.js +7 -0
  47. package/dist/{config-OXHoDUIo.js.map → config-oKOjOTWi.js.map} +1 -1
  48. package/dist/{css-DcuJ_jSH.js → css-BewrRz3_.js} +3 -3
  49. package/dist/{css-DcuJ_jSH.js.map → css-BewrRz3_.js.map} +1 -1
  50. package/dist/{css-dPoZJDQH.js → css-CiTI58yl.js} +291 -4
  51. package/dist/css-CiTI58yl.js.map +1 -0
  52. package/dist/{global-zaCE-g1C.js → css-GtUPEO9U.js} +16 -3
  53. package/dist/css-GtUPEO9U.js.map +1 -0
  54. package/dist/{css-oOt6ZR54.js → css-Rc7ILf-3.js} +8 -9
  55. package/dist/{css-oOt6ZR54.js.map → css-Rc7ILf-3.js.map} +1 -1
  56. package/dist/css.js +1 -1
  57. package/dist/{css-CELBp6Gu.js → cssIdent-BsyUXNNk.js} +3 -23
  58. package/dist/cssIdent-BsyUXNNk.js.map +1 -0
  59. package/dist/cssVar-DGgQ2GIK.js +92 -0
  60. package/dist/cssVar-DGgQ2GIK.js.map +1 -0
  61. package/dist/{css_extra-DeTuIlcO.js → css_extra-BiG57TKN.js} +2 -2
  62. package/dist/{css_extra-DQdCrYoC.js.map → css_extra-BiG57TKN.js.map} +1 -1
  63. package/dist/{css_extra-DQdCrYoC.js → css_extra-DYtS3g6Z.js} +2 -2
  64. package/dist/{css_extra-DeTuIlcO.js.map → css_extra-DYtS3g6Z.js.map} +1 -1
  65. package/dist/{data-CeYstKMP.js → data-D7NFt4JG.js} +205 -10
  66. package/dist/data-D7NFt4JG.js.map +1 -0
  67. package/dist/{debug-D96KGgpH.js → debug-Cvpo5cVu.js} +4 -3
  68. package/dist/{debug-D96KGgpH.js.map → debug-Cvpo5cVu.js.map} +1 -1
  69. package/dist/{runtime-BKChZZ2-.js → debug-DycdGrul.js} +20 -27
  70. package/dist/debug-DycdGrul.js.map +1 -0
  71. package/dist/dev/rsc.js +9 -9
  72. package/dist/{dev-fOtWB5K3.js → dev-DdRWa6dJ.js} +7 -6
  73. package/dist/{dev-fOtWB5K3.js.map → dev-DdRWa6dJ.js.map} +1 -1
  74. package/dist/{dev-p8tW7X-A.js → dev-px0_6TNq.js} +4 -4
  75. package/dist/{dev-p8tW7X-A.js.map → dev-px0_6TNq.js.map} +1 -1
  76. package/dist/dev.js +1 -1
  77. package/dist/dialect/extracted/index.js +1 -1
  78. package/dist/dialect/index.js +1 -1
  79. package/dist/{elementMarker-CvqqIb7J.js → elementMarker-ng0y3fN0.js} +8 -8
  80. package/dist/{elementMarker-CvqqIb7J.js.map → elementMarker-ng0y3fN0.js.map} +1 -1
  81. package/dist/entry/dev/css.js +2 -2
  82. package/dist/entry/dev/jsx-dev-runtime.js +2 -2
  83. package/dist/entry/dev/jsx-runtime.js +2 -2
  84. package/dist/entry/dev.js +11 -12
  85. package/dist/entry/prod/css.js +2 -2
  86. package/dist/entry/prod/extract.js +2 -2
  87. package/dist/entry/prod/jsx-dev-runtime.js +2 -2
  88. package/dist/entry/prod/jsx-runtime.js +2 -2
  89. package/dist/entry/prod/runtime.js +5 -4
  90. package/dist/entry/prod.js +40 -11
  91. package/dist/entry/prod.js.map +1 -1
  92. package/dist/entry/rsc-dev/css.js +2 -2
  93. package/dist/entry/rsc-dev/dev.js +4 -4
  94. package/dist/entry/rsc-dev/jsx-dev-runtime.js +2 -2
  95. package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
  96. package/dist/entry/rsc-dev.js +274 -68
  97. package/dist/entry/rsc-dev.js.map +1 -1
  98. package/dist/entry/rsc-prod/css.js +2 -2
  99. package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
  100. package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
  101. package/dist/entry/rsc-prod/runtime.js +5 -4
  102. package/dist/entry/rsc-prod.js +16 -10
  103. package/dist/entry/rsc-prod.js.map +1 -0
  104. package/dist/extract-B-Vs88ME.js +3 -0
  105. package/dist/{extract-CzWJeQi8.js → extract-CM8Fk2eK.js} +24 -15
  106. package/dist/{extract-CzWJeQi8.js.map → extract-CM8Fk2eK.js.map} +1 -1
  107. package/dist/{getClassName-oiQ8CnkS.js → getClassName-CrNVjAoJ.js} +29 -8
  108. package/dist/getClassName-CrNVjAoJ.js.map +1 -0
  109. package/dist/{global-Cul1dX8k.js → global-CZBlA9E7.js} +3 -3
  110. package/dist/{global-Cul1dX8k.js.map → global-CZBlA9E7.js.map} +1 -1
  111. package/dist/{hash-Bycpk3MR.js → hash-BfeJDf5U.js} +13 -4
  112. package/dist/hash-BfeJDf5U.js.map +1 -0
  113. package/dist/index.js +9 -10
  114. package/dist/jsx/jsx-dev-runtime.js +2 -2
  115. package/dist/jsx/jsx-dev-runtime.server.js +1 -1
  116. package/dist/jsx/jsx-runtime.js +2 -2
  117. package/dist/jsx/jsx-runtime.server.js +1 -1
  118. package/dist/{jsx-Ba-XV33u.js → jsx-BY1iFewe.js} +3 -3
  119. package/dist/{jsx-Ba-XV33u.js.map → jsx-BY1iFewe.js.map} +1 -1
  120. package/dist/{jsx-A4cK517J.js → jsx-DL-DEAz8.js} +8 -7
  121. package/dist/{jsx-A4cK517J.js.map → jsx-DL-DEAz8.js.map} +1 -1
  122. package/dist/{jsx_dev_runtime-BQcRzl5D.js → jsx_dev_runtime-aAhNYDeS.js} +2 -2
  123. package/dist/{jsx_dev_runtime-BQcRzl5D.js.map → jsx_dev_runtime-aAhNYDeS.js.map} +1 -1
  124. package/dist/{jsx_runtime-B9KEoAQN.js → jsx_runtime-C6i1bWlu.js} +2 -2
  125. package/dist/{jsx_runtime-B9KEoAQN.js.map → jsx_runtime-C6i1bWlu.js.map} +1 -1
  126. package/dist/{jsx_runtime-BXcbW8Yp.js → jsx_runtime-D7Y5up6H.js} +2 -2
  127. package/dist/{jsx_runtime-BXcbW8Yp.js.map → jsx_runtime-D7Y5up6H.js.map} +1 -1
  128. package/dist/{layer-CbQzwZF-.js → layer-BSxAr-hy.js} +4 -4
  129. package/dist/{layer-CbQzwZF-.js.map → layer-BSxAr-hy.js.map} +1 -1
  130. package/dist/{loader-BAth2yZ1.mjs → loader-BmYS_Rju.mjs} +3 -3
  131. package/dist/{loader-BAth2yZ1.mjs.map → loader-BmYS_Rju.mjs.map} +1 -1
  132. package/dist/{misc-DFBKJGLT.mjs → misc-BIS_c7BJ.mjs} +2 -2
  133. package/dist/{misc-DFBKJGLT.mjs.map → misc-BIS_c7BJ.mjs.map} +1 -1
  134. package/dist/{namedTokens-BUa6raTb.js → namedTokens-CN_yhhik.js} +8 -6
  135. package/dist/namedTokens-CN_yhhik.js.map +1 -0
  136. package/dist/plugin/farm/index.mjs +2 -2
  137. package/dist/plugin/nextjs/index.mjs +4 -4
  138. package/dist/plugin/nextjs/loader.mjs +4 -4
  139. package/dist/plugin/parcel/optimizer.cjs +3 -2
  140. package/dist/plugin/parcel/optimizer.cjs.map +1 -1
  141. package/dist/plugin/parcel/optimizer.mjs +3 -2
  142. package/dist/plugin/parcel/optimizer.mjs.map +1 -1
  143. package/dist/plugin/parcel/resolver.cjs +1 -1
  144. package/dist/plugin/parcel/resolver.mjs +2 -2
  145. package/dist/plugin/parcel/runtime.cjs +1 -1
  146. package/dist/plugin/parcel/runtime.mjs +1 -1
  147. package/dist/plugin/parcel/transformer.cjs +1 -1
  148. package/dist/plugin/parcel/transformer.mjs +2 -2
  149. package/dist/plugin/rspack/index.mjs +1 -1
  150. package/dist/plugin/vite/index.mjs +3 -3
  151. package/dist/plugin/webpack/index.mjs +1 -1
  152. package/dist/plugin/webpack/loader.mjs +2 -2
  153. package/dist/presets/tailwind/index.js +8 -5
  154. package/dist/presets/tailwind/index.js.map +1 -1
  155. package/dist/{property-CF6JgpTq.js → property-BuLbzviK.js} +2 -2
  156. package/dist/{property-CF6JgpTq.js.map → property-BuLbzviK.js.map} +1 -1
  157. package/dist/{registry-CiwvMfx8.mjs → registry-IaXmLQzA.mjs} +2 -2
  158. package/dist/{registry-CiwvMfx8.mjs.map → registry-IaXmLQzA.mjs.map} +1 -1
  159. package/dist/{rules-DlXcch7-.js → rules-CxVzovt-.js} +60 -23
  160. package/dist/rules-CxVzovt-.js.map +1 -0
  161. package/dist/selector-A-mRmMnI.js +64 -0
  162. package/dist/selector-A-mRmMnI.js.map +1 -0
  163. package/dist/server.js +12 -13
  164. package/dist/server.js.map +1 -1
  165. package/dist/{shared-yDD0nfm1.cjs → shared-CaJuvw03.cjs} +231 -84
  166. package/dist/shared-CaJuvw03.cjs.map +1 -0
  167. package/dist/{shared-x59dI2NW.mjs → shared-DdPTZ0O3.mjs} +4 -4
  168. package/dist/{shared-x59dI2NW.mjs.map → shared-DdPTZ0O3.mjs.map} +1 -1
  169. package/dist/sheet-BWBzuy4D.js +7 -0
  170. package/dist/{sheet-B-uJfHRY.js.map → sheet-BWBzuy4D.js.map} +1 -1
  171. package/dist/{sidecar-CJ6i4wmn.mjs → sidecar-B3oCK9vC.mjs} +3 -3
  172. package/dist/{sidecar-CJ6i4wmn.mjs.map → sidecar-B3oCK9vC.mjs.map} +1 -1
  173. package/dist/{style-DFFK06Of.js → style-CGaJndOl.js} +102 -54
  174. package/dist/style-CGaJndOl.js.map +1 -0
  175. package/dist/{style-Bw5ka-Nq.js → style-DDxjKdX0.js} +356 -39
  176. package/dist/style-DDxjKdX0.js.map +1 -0
  177. package/dist/style-S7LTQbRu.js +5 -0
  178. package/dist/{styleStore-DJ0Msgkh.js → styleStore-0fARJlZV.js} +6 -6
  179. package/dist/{styleStore-DJ0Msgkh.js.map → styleStore-0fARJlZV.js.map} +1 -1
  180. package/dist/{styleStore-ydQcDBD4.js → styleStore-CajcAEPO.js} +101 -223
  181. package/dist/styleStore-CajcAEPO.js.map +1 -0
  182. package/dist/symbols-Cp4ymzKF.js +14 -0
  183. package/dist/symbols-Cp4ymzKF.js.map +1 -0
  184. package/dist/token-D-S-4_mN.js +138 -0
  185. package/dist/token-D-S-4_mN.js.map +1 -0
  186. package/dist/{trace-D8j96G57.js → trace-CFnhyCVf.js} +2 -2
  187. package/dist/{trace-D8j96G57.js.map → trace-CFnhyCVf.js.map} +1 -1
  188. package/dist/{trace-CO36aenp.js → trace-ZtgeY-8s.js} +3 -3
  189. package/dist/{trace-CO36aenp.js.map → trace-ZtgeY-8s.js.map} +1 -1
  190. package/dist/{transform-BTJOg8Hg.js → transform-BkrLIiIR.js} +2 -2
  191. package/dist/{transform-BTJOg8Hg.js.map → transform-BkrLIiIR.js.map} +1 -1
  192. package/dist/{utils-D2fygyTm.mjs → utils-B5Xqf1lV.mjs} +4 -4
  193. package/dist/{utils-D2fygyTm.mjs.map → utils-B5Xqf1lV.mjs.map} +1 -1
  194. package/dist/{utils-hoYnMiA7.js → utils-B_VhPBHH.js} +4 -4
  195. package/dist/{utils-hoYnMiA7.js.map → utils-B_VhPBHH.js.map} +1 -1
  196. package/dist/{utils-Bmw655wa.js → utils-CDUaX81o.js} +3 -3
  197. package/dist/{utils-Bmw655wa.js.map → utils-CDUaX81o.js.map} +1 -1
  198. package/dist/{utils-DTXCTUlS.mjs → utils-DaAiEEIG.mjs} +3 -3
  199. package/dist/{utils-DTXCTUlS.mjs.map → utils-DaAiEEIG.mjs.map} +1 -1
  200. package/dist/{utils-DVFxZnVC.js → utils-DzydRwYo.js} +65 -49
  201. package/dist/utils-DzydRwYo.js.map +1 -0
  202. package/dist/utils.js +3 -3
  203. package/dist/value-C0JRsyax.js +64 -0
  204. package/dist/value-C0JRsyax.js.map +1 -0
  205. package/dist/{value-DvFkGBy2.js → value-D08AocUs.js} +96 -72
  206. package/dist/value-D08AocUs.js.map +1 -0
  207. package/dist/{valueRef-CsLVJwjA.js → valueRef-M3E1oza7.js} +2 -2
  208. package/dist/{valueRef-CsLVJwjA.js.map → valueRef-M3E1oza7.js.map} +1 -1
  209. package/dist/{webpack-BOU7_xld.mjs → webpack-CHydnRXB.mjs} +5 -5
  210. package/dist/{webpack-BOU7_xld.mjs.map → webpack-CHydnRXB.mjs.map} +1 -1
  211. package/dist/{withTokens-LRidu3Vc.js → withTokens-DAzUIPvA.js} +2 -2
  212. package/dist/{withTokens-LRidu3Vc.js.map → withTokens-DAzUIPvA.js.map} +1 -1
  213. package/entry/prod/config_debug.ts +2 -0
  214. package/entry/prod/index.ts +1 -1
  215. package/entry/prod/runtime.ts +3 -1
  216. package/entry/rsc_prod/config_debug.ts +6 -0
  217. package/entry/rsc_prod/index.ts +1 -1
  218. package/entry/shared/config_debug.ts +9 -0
  219. package/entry/shared/config_dev.ts +9 -7
  220. package/package.json +1 -1
  221. package/plugin/bundler/parcel/optimizer.ts +1 -0
  222. package/presets/tailwind/style/transform.ts +9 -3
  223. package/runtime/core/cache/combine.ts +44 -25
  224. package/runtime/core/cache/combineRuntime.ts +4 -0
  225. package/runtime/core/cache/index.ts +2 -1
  226. package/runtime/core/cache/item.ts +2 -2
  227. package/runtime/core/cache/pool.ts +15 -30
  228. package/runtime/core/cache/prop.ts +3 -2
  229. package/runtime/core/cache/token.ts +20 -0
  230. package/runtime/core/cache/tokenValues.ts +19 -11
  231. package/runtime/extract/combineStyle.ts +37 -0
  232. package/runtime/extract/getClassName.ts +5 -11
  233. package/runtime/extract/index.ts +3 -1
  234. package/runtime/extract/token.ts +41 -0
  235. package/runtime/extract/tokenResolver.ts +17 -0
  236. package/runtime/style/style.ts +2 -1
  237. package/style/style.ts +1 -1
  238. package/style/theme.ts +0 -1
  239. package/style/token.ts +26 -21
  240. package/style/tokens.ts +18 -12
  241. package/style/transform.ts +1 -1
  242. package/style/value.ts +26 -11
  243. package/style/valueRef.ts +1 -1
  244. package/utils/global.ts +1 -3
  245. package/utils/symbol.ts +3 -0
  246. package/dist/className-ZJ5pBA-o.js +0 -263
  247. package/dist/className-ZJ5pBA-o.js.map +0 -1
  248. package/dist/compiler-D5v5tJXI.mjs.map +0 -1
  249. package/dist/config-BEvP7108.js.map +0 -1
  250. package/dist/config-B_cbG3S6.js +0 -1
  251. package/dist/config-FIfi5aJ8.js.map +0 -1
  252. package/dist/config-OXHoDUIo.js +0 -6
  253. package/dist/css-CELBp6Gu.js.map +0 -1
  254. package/dist/css-dPoZJDQH.js.map +0 -1
  255. package/dist/data-CeYstKMP.js.map +0 -1
  256. package/dist/extract-DeOytHKW.js +0 -2
  257. package/dist/getClassName-oiQ8CnkS.js.map +0 -1
  258. package/dist/global-zaCE-g1C.js.map +0 -1
  259. package/dist/hash-Bycpk3MR.js.map +0 -1
  260. package/dist/namedTokens-BUa6raTb.js.map +0 -1
  261. package/dist/rules-DlXcch7-.js.map +0 -1
  262. package/dist/runtime-BKChZZ2-.js.map +0 -1
  263. package/dist/shared-yDD0nfm1.cjs.map +0 -1
  264. package/dist/sheet-B-uJfHRY.js +0 -7
  265. package/dist/style-91J0B5ef.js.map +0 -1
  266. package/dist/style-Bw5ka-Nq.js.map +0 -1
  267. package/dist/style-DFFK06Of.js.map +0 -1
  268. package/dist/style-pz8e5To1.js +0 -5
  269. package/dist/styleStore-ydQcDBD4.js.map +0 -1
  270. package/dist/token-CKXUECuU.js +0 -76
  271. package/dist/token-CKXUECuU.js.map +0 -1
  272. package/dist/token-DTOyFLmp.js +0 -58
  273. package/dist/token-DTOyFLmp.js.map +0 -1
  274. package/dist/token-DT_sCPtm.js +0 -298
  275. package/dist/token-DT_sCPtm.js.map +0 -1
  276. package/dist/utils-DVFxZnVC.js.map +0 -1
  277. package/dist/value-D-ZcRzLA.js +0 -42
  278. package/dist/value-D-ZcRzLA.js.map +0 -1
  279. package/dist/value-DvFkGBy2.js.map +0 -1
  280. package/dist/value-dG9LK0Gq.js +0 -85
  281. package/dist/value-dG9LK0Gq.js.map +0 -1
@@ -97,10 +97,12 @@ function createCssCollector() {
97
97
  };
98
98
  }
99
99
  //#endregion
100
- //#region utils/global.ts
100
+ //#region utils/symbol.ts
101
101
  function symbol(name) {
102
102
  return Symbol.for(`@fluentic/style.${name}`);
103
103
  }
104
+ //#endregion
105
+ //#region utils/global.ts
104
106
  function globalData(key, data) {
105
107
  const id = symbol(key);
106
108
  const root = globalThis;
@@ -124,18 +126,6 @@ const CSS_CONFIG_DEFAULT = {
124
126
  };
125
127
  const CSS_CONFIG = globalData("config.css", () => ({ ...CSS_CONFIG_DEFAULT }));
126
128
  //#endregion
127
- //#region config/config/debug.ts
128
- const DEFAULT_DEBUG_CONFIG = {
129
- isDebugClassNameEnabled: false,
130
- isDebugClassNameConfigured: false,
131
- maxPropertyLength: 24,
132
- maxValueLength: 8,
133
- maxSelectorLength: 8,
134
- maxParentSelectorLength: 8,
135
- maxAtRuleLength: 10
136
- };
137
- const DEBUG_CONFIG = globalData("config.debug", () => ({ ...DEFAULT_DEBUG_CONFIG }));
138
- //#endregion
139
129
  //#region config/utils.ts
140
130
  const SIDECAR_URL_GLOBAL_SYMBOL = "FLUENTIC_STYLE_SIDECAR_URL";
141
131
  function getCacheTTL(cache) {
@@ -154,6 +144,18 @@ const RUNTIME_CONFIG_DEFAULT = {
154
144
  globalData("config.runtime", () => ({ ...RUNTIME_CONFIG_DEFAULT }));
155
145
  globalData("config.build", () => ({ current: null }));
156
146
  //#endregion
147
+ //#region config/config/debug.ts
148
+ const DEFAULT_DEBUG_CONFIG = {
149
+ isDebugClassNameEnabled: false,
150
+ isDebugClassNameConfigured: false,
151
+ maxPropertyLength: 24,
152
+ maxValueLength: 8,
153
+ maxSelectorLength: 8,
154
+ maxParentSelectorLength: 8,
155
+ maxAtRuleLength: 10
156
+ };
157
+ const DEBUG_CONFIG = globalData("config.debug", () => ({ ...DEFAULT_DEBUG_CONFIG }));
158
+ //#endregion
157
159
  //#region utils/hash.ts
158
160
  function hashString(str) {
159
161
  let hash = 2166136261;
@@ -479,16 +481,70 @@ function normalizeSelectorArg(arg) {
479
481
  return arg.includes("\n") ? arg.replace(/\n/g, "") : arg;
480
482
  }
481
483
  //#endregion
482
- //#region style/token.ts
484
+ //#region builder/token/symbols.ts
483
485
  const TOKEN_ID = symbol("style:token");
484
486
  const TOKEN_OVERRIDE = symbol("style:token.override");
487
+ const TOKEN_NAME = symbol("style:token.name");
488
+ const TOKEN_VAR_NAME = symbol("style:token.varName");
489
+ //#endregion
490
+ //#region builder/token/data.ts
491
+ function isStyleTokenData(value) {
492
+ return !!value && typeof value[TOKEN_ID] === "string" && value[TOKEN_OVERRIDE] !== true;
493
+ }
494
+ function isStyleTokenOverrideData(value) {
495
+ return !!value && typeof value[TOKEN_ID] === "string" && value[TOKEN_OVERRIDE] === true;
496
+ }
497
+ function getStyleTokenId(token) {
498
+ return token[TOKEN_ID];
499
+ }
500
+ function getStyleTokenName(token) {
501
+ return token[TOKEN_NAME] ?? null;
502
+ }
503
+ //#endregion
504
+ //#region builder/token/name.ts
505
+ function getStyleTokenNameFromId(id) {
506
+ if (!id) return null;
507
+ const parts = id.split("--");
508
+ const first = normalizeStyleTokenName(parts[0]);
509
+ if (!first) return parts.length > 1 ? normalizeStyleTokenName(parts.slice(1).join("--")) : null;
510
+ return normalizeStyleTokenName([first, ...parts.slice(1)].join("--"));
511
+ }
512
+ function getChildStyleTokenName(name, child) {
513
+ const childName = normalizeStyleTokenName(child);
514
+ if (!childName) return normalizeStyleTokenName(name);
515
+ const parentName = normalizeStyleTokenName(name);
516
+ return parentName ? parentName + "--" + childName : childName;
517
+ }
518
+ function normalizeStyleTokenName(value) {
519
+ if (!value) return null;
520
+ value = value.trim();
521
+ if (!value) return null;
522
+ if (/^\d+$/.test(value)) return null;
523
+ if (isGeneratedTokenHash(value)) return null;
524
+ value = stripGenericTokenPrefix(value);
525
+ if (!value) return null;
526
+ const stableSuffix = value.match(/^(.+)-[a-z0-9]{7}$/);
527
+ if (stableSuffix?.[1] && isGeneratedTokenHash(value.slice(-7))) return normalizeStyleTokenName(stableSuffix[1]);
528
+ return value;
529
+ }
530
+ function isGeneratedTokenHash(value) {
531
+ return /^[a-z0-9]{7}$/.test(value) && /\d/.test(value);
532
+ }
533
+ function stripGenericTokenPrefix(value) {
534
+ const parts = value.split("--");
535
+ while (parts[0] === "token" || parts[0] === "tokens") parts.shift();
536
+ return parts.join("--");
537
+ }
538
+ //#endregion
539
+ //#region style/token.ts
485
540
  const TOKEN_DEBUG = symbol("style:token.debug");
486
541
  const idCounter$6 = globalData("style.token.idCounter", () => ({ value: 0 }));
487
- function createStyleToken(value, debugId) {
542
+ function createStyleToken(value, stableId, debugName) {
488
543
  const token = (value, debug) => {
489
544
  return createStyleTokenOverride(token, value, debug);
490
545
  };
491
- token[TOKEN_ID] = debugId || String(idCounter$6.value++);
546
+ token[TOKEN_ID] = stableId || String(idCounter$6.value++);
547
+ token[TOKEN_NAME] = debugName === void 0 ? getStyleTokenNameFromId(stableId) : normalizeStyleTokenName(debugName);
492
548
  if (isStyleTokenData(value)) {
493
549
  token.value = value.value;
494
550
  token.ref = value;
@@ -502,11 +558,13 @@ function createStyleTokenOverride(token, value, debug) {
502
558
  const override = isStyleTokenData(value) ? {
503
559
  [TOKEN_ID]: getStyleTokenId(token),
504
560
  [TOKEN_OVERRIDE]: true,
561
+ [TOKEN_NAME]: getStyleTokenName(token),
505
562
  value: value.value,
506
563
  ref: value
507
564
  } : {
508
565
  [TOKEN_ID]: getStyleTokenId(token),
509
566
  [TOKEN_OVERRIDE]: true,
567
+ [TOKEN_NAME]: getStyleTokenName(token),
510
568
  value,
511
569
  ref: null
512
570
  };
@@ -517,15 +575,6 @@ function createStyleTokenOverride(token, value, debug) {
517
575
  });
518
576
  return override;
519
577
  }
520
- function isStyleTokenData(value) {
521
- return !!value && typeof value[TOKEN_ID] === "string" && value[TOKEN_OVERRIDE] !== true;
522
- }
523
- function isStyleTokenOverrideData(value) {
524
- return !!value && typeof value[TOKEN_ID] === "string" && value[TOKEN_OVERRIDE] === true;
525
- }
526
- function getStyleTokenId(token) {
527
- return token[TOKEN_ID];
528
- }
529
578
  //#endregion
530
579
  //#region selector/selector.ts
531
580
  function selector(selector, ...args) {
@@ -932,7 +981,6 @@ const formatClassName = createNameFormatter([
932
981
  "selector",
933
982
  "value"
934
983
  ]);
935
- const formatScopeClassName = createNameFormatter(["className"]);
936
984
  const formatTransformClassName = createNameFormatter(["className"]);
937
985
  function getDebugClassName(format, hash, info) {
938
986
  return formatClassName(format || "[(atRule)-][(scopeSelector)-](property)[-(selector)][-(value)]--$hash", hash, info);
@@ -940,21 +988,8 @@ function getDebugClassName(format, hash, info) {
940
988
  function getDebugTransformClassName(format, hash, info) {
941
989
  return formatTransformClassName(format || "(className)--$hash", hash, info);
942
990
  }
943
- function getDebugScopeClassName(format, info) {
944
- return formatScopeClassName(format || "-(className)", null, info);
945
- }
946
991
  //#endregion
947
- //#region atomic/utils/css.ts
948
- function getCssVar(varName, value) {
949
- return "var(" + varName + ", " + escapeCssValue(value) + ")";
950
- }
951
- function getCssVarRawFallback(varName, fallbackCss) {
952
- return "var(" + varName + ", " + fallbackCss + ")";
953
- }
954
- function escapeCssValue(value) {
955
- if (!value) return "";
956
- return value.trim().replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/'/g, "\\'").replace(/;/g, "\\;");
957
- }
992
+ //#region atomic/utils/cssIdent.ts
958
993
  function escapeCssIdent(ident) {
959
994
  let result = "";
960
995
  for (let i = 0; i < ident.length; i++) {
@@ -1144,6 +1179,13 @@ function parseAtRule(rule) {
1144
1179
  if (normalized.startsWith("@supports")) return compressQuery(normalized.slice(9));
1145
1180
  return compressQuery(normalized);
1146
1181
  }
1182
+ function getScopeClassName(className, scopeClassNameFormat) {
1183
+ return formatScopeClassName(scopeClassNameFormat || "-(className)", { className });
1184
+ }
1185
+ function formatScopeClassName(format, info) {
1186
+ if (typeof format === "function") return format(info);
1187
+ return format.replace(/\[|\]/g, "").replace(/\(className\)/g, info.className);
1188
+ }
1147
1189
  //#endregion
1148
1190
  //#region atomic/utils/hash.ts
1149
1191
  const POOLED_HASH_STATE = globalData("atomic.hashPool", () => ({
@@ -1230,9 +1272,6 @@ function getRuntimeClassNameHashLength(debugClassName) {
1230
1272
  if (debugClassName && DEV_CONFIG.isDev) return DEV_CONFIG.hashLength ?? CSS_CONFIG.hashLength ?? 3;
1231
1273
  return CSS_CONFIG.hashLength ?? 7;
1232
1274
  }
1233
- function getScopeClassName(className, scopeClassNameFormat) {
1234
- return getDebugScopeClassName(scopeClassNameFormat, { className });
1235
- }
1236
1275
  function getClassNameDedupe(property, priority, selector, parentSelector, atRule) {
1237
1276
  let hash = property;
1238
1277
  hash += "\n" + (priority || "");
@@ -1437,10 +1476,23 @@ function getScopeLookupKey(slotId, dedupe) {
1437
1476
  function getTokenLookupKey(tokenId) {
1438
1477
  return "token\0" + tokenId;
1439
1478
  }
1479
+ //#endregion
1480
+ //#region atomic/utils/cssVar.ts
1481
+ function getCssVar(varName, value) {
1482
+ return "var(" + varName + ", " + escapeCssValue(value) + ")";
1483
+ }
1484
+ function getCssVarRawFallback(varName, fallbackCss) {
1485
+ return "var(" + varName + ", " + fallbackCss + ")";
1486
+ }
1487
+ function escapeCssValue(value) {
1488
+ if (!value) return "";
1489
+ return value.trim().replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/'/g, "\\'").replace(/;/g, "\\;");
1490
+ }
1440
1491
  const formatTokenName = createNameFormatter(["name"]);
1441
1492
  function getTokenVarName(token, format) {
1442
1493
  const id = getStyleTokenId(token);
1443
- return "--" + formatTokenName(format || "token[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: id });
1494
+ const debugName = getStyleTokenName(token);
1495
+ return "--" + formatTokenName(format || "token[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: debugName });
1444
1496
  }
1445
1497
  function getTokenVar(token, format) {
1446
1498
  return getTokenVarFallback(token, format);
@@ -2964,15 +3016,12 @@ function appendExtractedStyleTuples(target, source) {
2964
3016
  }
2965
3017
  }
2966
3018
  //#endregion
2967
- //#region style/value.ts
2968
- function createToken(value, debugId) {
2969
- return createStyleToken(value, debugId);
2970
- }
2971
- //#endregion
2972
3019
  //#region dialect/namedTokens.ts
2973
3020
  const ROOT = Symbol("fluentic.namedTokens.root");
2974
3021
  function createNamedToken(id, value) {
2975
- return createToken(value, createNamedTokenId(id));
3022
+ const token = createStyleToken(value, createNamedTokenId(id));
3023
+ token[TOKEN_VAR_NAME] = getTokenVarName(token, CSS_CONFIG.tokenNameFormat ?? null);
3024
+ return token;
2976
3025
  }
2977
3026
  function createNamedTokens(namespace, values) {
2978
3027
  return createNamedTokenProxy({
@@ -2991,7 +3040,7 @@ function createNamedTokenProxy(root, path) {
2991
3040
  if (property === ROOT) return root;
2992
3041
  if (property === "then") return void 0;
2993
3042
  if (property === Symbol.toStringTag) return "NamedTokens";
2994
- if (property === TOKEN_ID || property === TOKEN_OVERRIDE || property === "value" || property === "ref") {
3043
+ if (property === TOKEN_ID || property === TOKEN_NAME || property === TOKEN_VAR_NAME || property === TOKEN_OVERRIDE || property === "value" || property === "ref") {
2995
3044
  if (!path.length) return void 0;
2996
3045
  return getNamedTokenAtPath(root, path)[property];
2997
3046
  }
@@ -3282,9 +3331,9 @@ function evaluateCall(node, scope) {
3282
3331
  if (imp && STYLE_IMPORT_PATHS.has(imp.source) && imp.name === "createToken") {
3283
3332
  const value = evaluateNode(node.arguments[0], scope);
3284
3333
  if (!value.ok) return value;
3285
- const debugId = evaluateOptionalDebugId(node.arguments[1], scope);
3286
- if (!debugId.ok) return debugId;
3287
- return evalOk(createCompiledToken(value.value, scope, node.loc?.start, node, debugId.value));
3334
+ const stableId = evaluateOptionalStableTokenId(node.arguments[1], scope);
3335
+ if (!stableId.ok) return stableId;
3336
+ return evalOk(createCompiledToken(value.value, scope, node.loc?.start, node, stableId.value));
3288
3337
  }
3289
3338
  if (imp && STYLE_IMPORT_PATHS.has(imp.source) && imp.name === "createKeyframes") {
3290
3339
  const frames = evaluateNode(node.arguments[0], scope);
@@ -3351,16 +3400,16 @@ function evaluateCall(node, scope) {
3351
3400
  const url = evaluateNode(node.arguments[0], scope);
3352
3401
  if (!url.ok) return evalFail(`fontSrc url must be statically analyzable: ${url.reason}`);
3353
3402
  if (typeof url.value !== "string") return evalFail("fontSrc url must be a static string");
3354
- const format = evaluateOptionalDebugId(node.arguments[1], scope);
3403
+ const format = evaluateOptionalString(node.arguments[1], scope);
3355
3404
  if (!format.ok) return evalFail(`fontSrc format must be statically analyzable: ${format.reason}`);
3356
3405
  return evalOk(fontSrc(url.value, format.value));
3357
3406
  }
3358
3407
  if (imp && STYLE_IMPORT_PATHS.has(imp.source) && imp.name === "createTokens") {
3359
3408
  const value = evaluateNode(node.arguments[0], scope);
3360
3409
  if (!value.ok) return value;
3361
- const debugId = evaluateOptionalDebugId(node.arguments[1], scope);
3362
- if (!debugId.ok) return debugId;
3363
- return evalOk(createCompiledTokens(value.value, scope, node.loc?.start, node, debugId.value));
3410
+ const stableId = evaluateOptionalStableTokenId(node.arguments[1], scope);
3411
+ if (!stableId.ok) return stableId;
3412
+ return evalOk(createCompiledTokens(value.value, scope, node.loc?.start, node, stableId.value));
3364
3413
  }
3365
3414
  if (imp && STYLE_IMPORT_PATHS.has(imp.source) && imp.name === "createNamedToken") {
3366
3415
  const id = evaluateNode(node.arguments[0], scope);
@@ -3388,13 +3437,13 @@ function evaluateCall(node, scope) {
3388
3437
  if (imp && STYLE_IMPORT_PATHS.has(imp.source) && imp.name === "createValues") {
3389
3438
  const hasNumberArg = node.arguments[0]?.type === "Identifier" && node.arguments[0].name === "Number";
3390
3439
  const valuesNode = hasNumberArg ? node.arguments[1] : node.arguments[0];
3391
- const debugNode = hasNumberArg ? node.arguments[2] : node.arguments[1];
3440
+ const stableIdNode = hasNumberArg ? node.arguments[2] : node.arguments[1];
3392
3441
  const values = evaluateNode(valuesNode, scope);
3393
3442
  if (!values.ok) return values;
3394
- const debugId = evaluateOptionalDebugId(debugNode, scope);
3395
- if (!debugId.ok) return debugId;
3443
+ const stableId = evaluateOptionalStableTokenId(stableIdNode, scope);
3444
+ if (!stableId.ok) return stableId;
3396
3445
  if (!Array.isArray(values.value)) return evalFail("createValues values must be an array");
3397
- return evalOk(createCompiledValues(values.value, scope, node.loc?.start, node, debugId.value, hasNumberArg));
3446
+ return evalOk(createCompiledValues(values.value, scope, node.loc?.start, node, stableId.value, hasNumberArg));
3398
3447
  }
3399
3448
  }
3400
3449
  if (node.callee.type === "Identifier") {
@@ -3482,38 +3531,48 @@ function createCompiledTokenOverride(token, value, runtimeValue) {
3482
3531
  if (isStyleTokenData(value)) return withRuntimeValue(runtimeValue, {
3483
3532
  [TOKEN_ID]: getStyleTokenId(token),
3484
3533
  [TOKEN_OVERRIDE]: true,
3534
+ [TOKEN_NAME]: getStyleTokenName(token),
3485
3535
  value: value.value,
3486
3536
  ref: value
3487
3537
  });
3488
3538
  return withRuntimeValue(runtimeValue, {
3489
3539
  [TOKEN_ID]: getStyleTokenId(token),
3490
3540
  [TOKEN_OVERRIDE]: true,
3541
+ [TOKEN_NAME]: getStyleTokenName(token),
3491
3542
  value,
3492
3543
  ref: null
3493
3544
  });
3494
3545
  }
3495
- function createCompiledToken(value, scope, loc, runtimeValue, debugId) {
3496
- let tokenId = debugId;
3546
+ function createCompiledToken(value, scope, loc, runtimeValue, stableId, debugName) {
3547
+ let tokenId = stableId;
3497
3548
  if (!tokenId) tokenId = hashString((scope.styleFilePath ?? scope.filePath) + "\n" + (loc ? loc.line + ":" + loc.column : String(value)));
3549
+ if (isStyleTokenData(value)) return withRuntimeValue(runtimeValue, {
3550
+ [TOKEN_ID]: tokenId,
3551
+ [TOKEN_NAME]: debugName === void 0 ? getStyleTokenNameFromId(stableId) : normalizeStyleTokenName(debugName),
3552
+ value: value.value,
3553
+ ref: value
3554
+ });
3498
3555
  return withRuntimeValue(runtimeValue, {
3499
3556
  [TOKEN_ID]: tokenId,
3557
+ [TOKEN_NAME]: debugName === void 0 ? getStyleTokenNameFromId(stableId) : normalizeStyleTokenName(debugName),
3500
3558
  value,
3501
3559
  ref: null
3502
3560
  });
3503
3561
  }
3504
- function createCompiledTokens(value, scope, loc, runtimeValue, debugId) {
3505
- const tokenGroupId = debugId ?? createCompiledTokenGroupId(scope, loc);
3562
+ function createCompiledTokens(value, scope, loc, runtimeValue, stableId) {
3563
+ const tokenGroupId = stableId ?? createCompiledTokenGroupId(scope, loc);
3564
+ const tokenGroupName = getStyleTokenNameFromId(stableId);
3506
3565
  if (Array.isArray(value)) {
3507
3566
  const result = {};
3508
3567
  for (let i = 0, len = value.length; i < len; i++) {
3509
3568
  const item = value[i];
3510
- result[item] = createCompiledToken(item, scope, loc, runtimeValue, getChildDebugId(tokenGroupId, String(i)));
3569
+ result[item] = createCompiledToken(item, scope, loc, runtimeValue, getChildStableId(tokenGroupId, String(i)), getChildStyleTokenName(tokenGroupName, String(i)));
3511
3570
  }
3512
3571
  return result;
3513
3572
  }
3514
3573
  if (!value || typeof value !== "object") return {};
3515
3574
  const result = {};
3516
- assignCompiledTokenRecord(result, value, scope, loc, runtimeValue, tokenGroupId);
3575
+ assignCompiledTokenRecord(result, value, scope, loc, runtimeValue, tokenGroupId, tokenGroupName);
3517
3576
  return result;
3518
3577
  }
3519
3578
  function createCompiledTokenGroupId(scope, loc) {
@@ -3525,22 +3584,24 @@ function createCompiledAtRuleStableId(scope, loc, value) {
3525
3584
  id: (scope.styleFilePath ?? scope.filePath) + "\n" + (loc ? loc.line + ":" + loc.column : String(value))
3526
3585
  };
3527
3586
  }
3528
- function assignCompiledTokenRecord(target, value, scope, loc, runtimeValue, debugId) {
3587
+ function assignCompiledTokenRecord(target, value, scope, loc, runtimeValue, stableId, debugName) {
3529
3588
  for (const key of Object.keys(value)) {
3530
3589
  const item = value[key];
3531
- const itemDebugId = getChildDebugId(debugId, key);
3590
+ const itemStableId = getChildStableId(stableId, key);
3591
+ const itemDebugName = getChildStyleTokenName(debugName, key);
3532
3592
  if (item && typeof item === "object" && !Array.isArray(item) && !isStyleTokenData(item)) {
3533
3593
  const child = {};
3534
3594
  target[key] = child;
3535
- assignCompiledTokenRecord(child, item, scope, loc, runtimeValue, itemDebugId);
3536
- } else target[key] = createCompiledToken(item, scope, loc, runtimeValue, itemDebugId);
3595
+ assignCompiledTokenRecord(child, item, scope, loc, runtimeValue, itemStableId, itemDebugName);
3596
+ } else target[key] = createCompiledToken(item, scope, loc, runtimeValue, itemStableId, itemDebugName);
3537
3597
  }
3538
3598
  }
3539
- function createCompiledValues(values, scope, loc, runtimeValue, debugId, isNumber) {
3599
+ function createCompiledValues(values, scope, loc, runtimeValue, stableId, isNumber) {
3540
3600
  const tokens = /* @__PURE__ */ new Map();
3601
+ const groupName = getStyleTokenNameFromId(stableId);
3541
3602
  for (let i = 0, len = values.length; i < len; i++) {
3542
3603
  const value = values[i];
3543
- tokens.set(value, createCompiledToken(parseCompiledValue(value, isNumber), scope, loc, runtimeValue, getChildDebugId(debugId, hashString(String(value)))));
3604
+ tokens.set(value, createCompiledToken(parseCompiledValue(value, isNumber), scope, loc, runtimeValue, getChildStableId(stableId, hashString(String(value))), getChildStyleTokenName(groupName, getValueDebugName(value))));
3544
3605
  }
3545
3606
  return {
3546
3607
  [COMPILED_TOKEN_FACTORY]: true,
@@ -3558,7 +3619,10 @@ function parseCompiledValue(value, isNumber) {
3558
3619
  function isCompiledTokenFactory(value) {
3559
3620
  return !!value && typeof value === "object" && value[COMPILED_TOKEN_FACTORY] === true;
3560
3621
  }
3561
- function evaluateOptionalDebugId(node, scope) {
3622
+ function evaluateOptionalStableTokenId(node, scope) {
3623
+ return evaluateOptionalString(node, scope);
3624
+ }
3625
+ function evaluateOptionalString(node, scope) {
3562
3626
  if (!node) return evalOk(void 0);
3563
3627
  const value = evaluateNode(node, scope);
3564
3628
  if (!value.ok) return value;
@@ -3582,12 +3646,24 @@ function evaluateOptionalStableId(node, scope) {
3582
3646
  id: stableId.id
3583
3647
  });
3584
3648
  }
3585
- function getChildDebugId(debugId, child) {
3586
- return debugId ? debugId + "--" + child : void 0;
3649
+ function getChildStableId(stableId, child) {
3650
+ return stableId ? stableId + "--" + child : void 0;
3651
+ }
3652
+ function getValueDebugName(value) {
3653
+ if (typeof value === "number") return String(value);
3654
+ if (typeof value !== "string") return null;
3655
+ const parts = value.split(/[;|]/);
3656
+ const label = parts[1]?.trim();
3657
+ if (label) return sanitizeTokenDebugName(label);
3658
+ return sanitizeTokenDebugName(parts[0]?.trim() ?? "");
3659
+ }
3660
+ function sanitizeTokenDebugName(value) {
3661
+ return value.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || null;
3587
3662
  }
3588
3663
  function withRuntimeValue(runtimeValue, token) {
3589
3664
  return Object.assign({}, token, {
3590
3665
  [TOKEN_ID]: token[TOKEN_ID],
3666
+ [TOKEN_NAME]: token[TOKEN_NAME] ?? null,
3591
3667
  [COMPILED_RUNTIME_VALUE]: runtimeValue
3592
3668
  });
3593
3669
  }
@@ -3647,7 +3723,7 @@ function isStyleChainCall(callee, styleNames) {
3647
3723
  }
3648
3724
  const formatThemeName = createNameFormatter(["name"]);
3649
3725
  function createThemeClassName(name, id, themeNameFormat) {
3650
- return formatThemeName(themeNameFormat || "theme[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name });
3726
+ return formatThemeName(themeNameFormat || "theme[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: normalizeThemeName(name) });
3651
3727
  }
3652
3728
  function getThemeRuleCss(className, tokens, tokenNameFormat) {
3653
3729
  const declarations = [];
@@ -3659,6 +3735,29 @@ function getThemeDeclaration(token, tokenNameFormat) {
3659
3735
  const value = token.ref ? getTokenOverrideValue(token, tokenNameFormat) : escapeCssValue(String(token.value ?? ""));
3660
3736
  return name + ":" + value;
3661
3737
  }
3738
+ function normalizeThemeName(value) {
3739
+ if (!value) return null;
3740
+ value = value.trim();
3741
+ if (!value) return null;
3742
+ if (/^\d+$/.test(value)) return null;
3743
+ if (isGeneratedNameHash(value)) return null;
3744
+ const stableSuffix = value.match(/^(.+)-[a-z0-9]{7}$/);
3745
+ if (stableSuffix?.[1] && isGeneratedNameHash(value.slice(-7))) return normalizeThemeName(stableSuffix[1]);
3746
+ value = stripGenericThemePrefix(value);
3747
+ if (!value) return null;
3748
+ return value;
3749
+ }
3750
+ function stripGenericThemePrefix(value) {
3751
+ const parts = value.split("--");
3752
+ while (parts[0] === "theme" || parts[0] === "themes") parts.shift();
3753
+ value = parts.join("--");
3754
+ if (value.startsWith("theme-")) return value.slice(6);
3755
+ if (value.startsWith("themes-")) return value.slice(7);
3756
+ return value;
3757
+ }
3758
+ function isGeneratedNameHash(value) {
3759
+ return /^[a-z0-9]{7}$/.test(value) && /\d/.test(value);
3760
+ }
3662
3761
  //#endregion
3663
3762
  //#region compiler/transform/syntax/utils.ts
3664
3763
  function getCallLabel(callee) {
@@ -4384,8 +4483,9 @@ function getSelectorMethodPath(path) {
4384
4483
  function getDebugStyleArg(t, path, state, sourcemapTrace) {
4385
4484
  const arg = getStyleObjectArg(path, state);
4386
4485
  if (!arg) return arg;
4486
+ const meta = getStyleCallMeta(path, state);
4387
4487
  if (arg.type !== "ObjectExpression") return resolveDebugMergeObject(t, arg, path, state, sourcemapTrace) ?? arg;
4388
- return flattenDebugObjectExpression(t, arg, path, state, sourcemapTrace, /* @__PURE__ */ new Set());
4488
+ return appendTransformDebugFieldAliases(t, flattenDebugObjectExpression(t, arg, path, state, sourcemapTrace, /* @__PURE__ */ new Set()), meta, state);
4389
4489
  }
4390
4490
  function getDebugCallLoc(path, state) {
4391
4491
  return isSelectorStyleCall(path, state) || isScopeItemSelectorCall(path, state) ? getMergeStyleLoc(path.node.callee) : null;
@@ -4399,6 +4499,10 @@ function getStyleObjectArg(path, state) {
4399
4499
  const styleArgIndex = selectorArgIndex === null ? 0 : selectorArgIndex + 1;
4400
4500
  return path.node.arguments[styleArgIndex];
4401
4501
  }
4502
+ function getStyleCallMeta(path, state) {
4503
+ const rootName = getStyleChainRootName(path.node.callee, state.styleNames);
4504
+ return rootName ? state.styleMetas.get(rootName) ?? null : null;
4505
+ }
4402
4506
  function isSelectorStyleCall(path, state) {
4403
4507
  const methodName = getSelectorMethodName(path.node.callee);
4404
4508
  if (!methodName) return false;
@@ -4503,6 +4607,46 @@ function flattenDebugObjectExpression(t, node, path, state, sourcemapTrace, seen
4503
4607
  }
4504
4608
  return t.objectExpression(properties);
4505
4609
  }
4610
+ function appendTransformDebugFieldAliases(t, node, meta, state) {
4611
+ if (!meta || meta.mode !== "StyleObject" || !meta.transform) return node;
4612
+ const existing = /* @__PURE__ */ new Set();
4613
+ for (const property of node.properties) {
4614
+ if (property.type !== "ObjectProperty" || property.computed) continue;
4615
+ const key = getObjectPropertyKey$1(property);
4616
+ if (key) existing.add(key);
4617
+ }
4618
+ const aliases = [];
4619
+ for (const property of node.properties) {
4620
+ if (property.type !== "ObjectProperty" || property.computed) continue;
4621
+ const key = getObjectPropertyKey$1(property);
4622
+ if (!key) continue;
4623
+ const value = evaluateNode(property.value, getDebugEvalScope(state));
4624
+ if (!value.ok) continue;
4625
+ let transformed;
4626
+ try {
4627
+ transformed = meta.transform.transform({ [key]: value.value });
4628
+ } catch {
4629
+ continue;
4630
+ }
4631
+ for (const transformedKey of Object.keys(transformed)) {
4632
+ if (existing.has(transformedKey)) continue;
4633
+ existing.add(transformedKey);
4634
+ aliases.push(createDebugFieldAlias(t, transformedKey, property));
4635
+ }
4636
+ }
4637
+ if (!aliases.length) return node;
4638
+ return t.objectExpression([...node.properties, ...aliases]);
4639
+ }
4640
+ function createDebugFieldAlias(t, key, source) {
4641
+ const alias = t.objectProperty(t.stringLiteral(key), t.nullLiteral());
4642
+ const sourceTrace = source;
4643
+ alias.loc = source.loc;
4644
+ alias.__styleSourcemapStyleLoc = sourceTrace.__styleSourcemapStyleLoc;
4645
+ alias.__styleSourcemapStyleSourceUrl = sourceTrace.__styleSourcemapStyleSourceUrl;
4646
+ alias.__styleSourcemapValueLoc = sourceTrace.__styleSourcemapValueLoc;
4647
+ alias.__styleSourcemapValueSourceUrl = sourceTrace.__styleSourcemapValueSourceUrl;
4648
+ return alias;
4649
+ }
4506
4650
  function resolveDebugSpreadObject(t, spread, path, state, sourcemapTrace, seen) {
4507
4651
  const node = spread.argument;
4508
4652
  if (node.type !== "Identifier") return null;
@@ -6666,10 +6810,13 @@ function buildVariableValueExpression(t, value, state, item, options) {
6666
6810
  }
6667
6811
  function buildExtractedTokenExpression(t, token, state) {
6668
6812
  state.usedHelpers.add(FN_CREATE_EXTRACTED_TOKEN);
6813
+ const tokenNameFormat = state.options.css?.tokenNameFormat ?? DEFAULT_CONFIG.tokenNameFormat ?? null;
6669
6814
  return t.callExpression(t.identifier(FN_CREATE_EXTRACTED_TOKEN), [
6670
6815
  t.stringLiteral(getStyleTokenId(token)),
6671
6816
  literalExpression(t, token.value),
6672
- token.ref ? buildExtractedTokenExpression(t, token.ref, state) : t.nullLiteral()
6817
+ token.ref ? buildExtractedTokenExpression(t, token.ref, state) : t.nullLiteral(),
6818
+ getStyleTokenName(token) ? t.stringLiteral(getStyleTokenName(token)) : t.nullLiteral(),
6819
+ t.stringLiteral(getTokenVarName(token, tokenNameFormat))
6673
6820
  ]);
6674
6821
  }
6675
6822
  function literalExpression(t, value) {
@@ -6809,8 +6956,8 @@ function compileThemeCall(path, state, opts) {
6809
6956
  const tokenArg = evaluateNode(path.node.arguments[0], scope);
6810
6957
  if (!tokenArg.ok) throw path.buildCodeFrameError(`createTheme tokens must be statically analyzable: ${tokenArg.reason}`);
6811
6958
  if (!Array.isArray(tokenArg.value)) throw path.buildCodeFrameError("createTheme first argument must be a static array of token overrides.");
6812
- const debugIdArg = evaluateNode(path.node.arguments[1], scope);
6813
- if (path.node.arguments[1] && !debugIdArg.ok) throw path.buildCodeFrameError(`createTheme debugId must be statically analyzable: ${debugIdArg.reason}`);
6959
+ const stableIdArg = evaluateNode(path.node.arguments[1], scope);
6960
+ if (path.node.arguments[1] && !stableIdArg.ok) throw path.buildCodeFrameError(`createTheme stableId must be statically analyzable: ${stableIdArg.reason}`);
6814
6961
  const tokens = [];
6815
6962
  for (let i = 0, len = tokenArg.value.length; i < len; i++) {
6816
6963
  const token = tokenArg.value[i];
@@ -6818,7 +6965,7 @@ function compileThemeCall(path, state, opts) {
6818
6965
  tokens.push(token);
6819
6966
  }
6820
6967
  const loc = path.node.loc?.start;
6821
- const id = debugIdArg.ok && debugIdArg.value !== void 0 ? String(debugIdArg.value) : getStableThemeId(state.fileId, loc ? loc.line + ":" + loc.column : "createTheme");
6968
+ const id = stableIdArg.ok && stableIdArg.value !== void 0 ? String(stableIdArg.value) : getStableThemeId(state.fileId, loc ? loc.line + ":" + loc.column : "createTheme");
6822
6969
  const themeNameFormat = opts.css?.themeNameFormat || CSS_CONFIG.themeNameFormat || null;
6823
6970
  const className = getStableThemeClassName(id, themeNameFormat);
6824
6971
  return {
@@ -7342,4 +7489,4 @@ function getCompilerRuntimeImportSource(source, runtimeMode) {
7342
7489
  //#endregion
7343
7490
  export { normalizeSourcemapSourcePath as a, babelTransform as c, compareLayerPriority as d, SIDECAR_URL_GLOBAL_SYMBOL as f, getDefaultSourcemapUrl as i, isPromiseLike as l, createCompilerCache as m, createCompiler as n, normalizePath as o, globalData as p, getStyleRuntimeImportPath as r, babelPlugin as s, CompilerRuntimeMode as t, extractCss as u };
7344
7491
 
7345
- //# sourceMappingURL=compiler-D5v5tJXI.mjs.map
7492
+ //# sourceMappingURL=compiler-CE0ZgkdH.mjs.map