@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
@@ -34,10 +34,12 @@ _babel_core = __toESM(_babel_core, 1);
34
34
  let oxc_resolver = require("oxc-resolver");
35
35
  require("@parcel/plugin");
36
36
  let node_http = require("node:http");
37
- //#region utils/global.ts
37
+ //#region utils/symbol.ts
38
38
  function symbol(name) {
39
39
  return Symbol.for(`@fluentic/style.${name}`);
40
40
  }
41
+ //#endregion
42
+ //#region utils/global.ts
41
43
  function globalData(key, data) {
42
44
  const id = symbol(key);
43
45
  const root = globalThis;
@@ -78,6 +80,18 @@ const RUNTIME_CONFIG_DEFAULT = {
78
80
  globalData("config.runtime", () => ({ ...RUNTIME_CONFIG_DEFAULT }));
79
81
  globalData("config.build", () => ({ current: null }));
80
82
  //#endregion
83
+ //#region config/config/debug.ts
84
+ const DEFAULT_DEBUG_CONFIG = {
85
+ isDebugClassNameEnabled: false,
86
+ isDebugClassNameConfigured: false,
87
+ maxPropertyLength: 24,
88
+ maxValueLength: 8,
89
+ maxSelectorLength: 8,
90
+ maxParentSelectorLength: 8,
91
+ maxAtRuleLength: 10
92
+ };
93
+ const DEBUG_CONFIG = globalData("config.debug", () => ({ ...DEFAULT_DEBUG_CONFIG }));
94
+ //#endregion
81
95
  //#region utils/hash.ts
82
96
  function hashString(str) {
83
97
  let hash = 2166136261;
@@ -159,44 +173,6 @@ function createCssCollector() {
159
173
  }
160
174
  };
161
175
  }
162
- //#endregion
163
- //#region config/config/debug.ts
164
- const DEFAULT_DEBUG_CONFIG = {
165
- isDebugClassNameEnabled: true,
166
- maxPropertyLength: 24,
167
- maxValueLength: 8,
168
- maxSelectorLength: 8,
169
- maxParentSelectorLength: 8,
170
- maxAtRuleLength: 10
171
- };
172
- const DEBUG_CONFIG = globalData("config.debug", () => ({ ...DEFAULT_DEBUG_CONFIG }));
173
- //#endregion
174
- //#region utils/object.ts
175
- function toArray(value) {
176
- return Array.isArray(value) ? value : value ? [value] : [];
177
- }
178
- function isFunction(value) {
179
- return typeof value === "function";
180
- }
181
- //#endregion
182
- //#region config/config/dev.ts
183
- const DEV_CONFIG_DEFAULT = {
184
- isDev: false,
185
- isCheckSelectorEnabled: true,
186
- isSourcemapEnabled: true,
187
- isLocalClassNameEnabled: true,
188
- sheetMaxRules: 1e3,
189
- sheetStyleTagNonce: null,
190
- hashLength: null,
191
- stylePriorityMode: "sort",
192
- sourcemapLocationMode: "style",
193
- isElementClassNameEnabled: true
194
- };
195
- globalData("config.dev.isDev", () => ({ isDev: false }));
196
- const DEV_CONFIG = globalData("config.dev", () => ({ ...DEV_CONFIG_DEFAULT }));
197
- globalData("config.dev.plugin", () => ({ config: null }));
198
- globalData("config.dev.base", () => ({ config: null }));
199
- globalData("config.dev.utils", () => ({ config: null }));
200
176
  const STYLE_IMPORT_PATH = "@fluentic/style";
201
177
  const STYLE_CSS_IMPORT_PATH = "@fluentic/style/css";
202
178
  const STYLE_DIALECT_IMPORT_PATH = "@fluentic/style/dialect";
@@ -204,11 +180,7 @@ const STYLE_DEV_RSC_IMPORT_PATH = "@fluentic/style/dev/rsc";
204
180
  const STYLE_ENTRY_PROD_EXTRACT_IMPORT_PATH = "@fluentic/style/entry/prod/extract";
205
181
  const STYLE_EXTRACT_RUNTIME_IMPORT_PATH = "@fluentic/style/entry/prod/runtime";
206
182
  const STYLE_RSC_EXTRACT_RUNTIME_IMPORT_PATH = "@fluentic/style/entry/rsc-prod/runtime";
207
- const DEFAULT_CONFIG = {
208
- ...CSS_CONFIG_DEFAULT,
209
- localClassName: DEV_CONFIG_DEFAULT.isLocalClassNameEnabled,
210
- debugClassName: DEFAULT_DEBUG_CONFIG.isDebugClassNameEnabled
211
- };
183
+ const DEFAULT_CONFIG = { ...CSS_CONFIG_DEFAULT };
212
184
  const IMPORT_PATHS = [
213
185
  STYLE_IMPORT_PATH,
214
186
  STYLE_CSS_IMPORT_PATH,
@@ -462,6 +434,33 @@ const BUILDER_SLOT_ID = symbol("builder.slotId");
462
434
  const BUILDER_SCOPE_ID = symbol("builder.scopeId");
463
435
  const BUILDER_SCOPE = symbol("builder.scope");
464
436
  //#endregion
437
+ //#region utils/object.ts
438
+ function toArray(value) {
439
+ return Array.isArray(value) ? value : value ? [value] : [];
440
+ }
441
+ function isFunction(value) {
442
+ return typeof value === "function";
443
+ }
444
+ //#endregion
445
+ //#region config/config/dev.ts
446
+ const DEV_CONFIG_DEFAULT = {
447
+ isDev: false,
448
+ isCheckSelectorEnabled: true,
449
+ isSourcemapEnabled: true,
450
+ isLocalClassNameEnabled: true,
451
+ sheetMaxRules: 1e3,
452
+ sheetStyleTagNonce: null,
453
+ hashLength: null,
454
+ stylePriorityMode: "sort",
455
+ sourcemapLocationMode: "style",
456
+ isElementClassNameEnabled: true
457
+ };
458
+ globalData("config.dev.isDev", () => ({ isDev: false }));
459
+ const DEV_CONFIG = globalData("config.dev", () => ({ ...DEV_CONFIG_DEFAULT }));
460
+ globalData("config.dev.plugin", () => ({ config: null }));
461
+ globalData("config.dev.base", () => ({ config: null }));
462
+ globalData("config.dev.utils", () => ({ config: null }));
463
+ //#endregion
465
464
  //#region utils/trace.ts
466
465
  const FN_MARKER = "$fn_";
467
466
  function traceMarker(fn, name) {
@@ -632,16 +631,70 @@ function normalizeSelectorArg(arg) {
632
631
  return arg.includes("\n") ? arg.replace(/\n/g, "") : arg;
633
632
  }
634
633
  //#endregion
635
- //#region style/token.ts
634
+ //#region builder/token/symbols.ts
636
635
  const TOKEN_ID = symbol("style:token");
637
636
  const TOKEN_OVERRIDE = symbol("style:token.override");
637
+ const TOKEN_NAME = symbol("style:token.name");
638
+ const TOKEN_VAR_NAME = symbol("style:token.varName");
639
+ //#endregion
640
+ //#region builder/token/data.ts
641
+ function isStyleTokenData(value) {
642
+ return !!value && typeof value[TOKEN_ID] === "string" && value[TOKEN_OVERRIDE] !== true;
643
+ }
644
+ function isStyleTokenOverrideData(value) {
645
+ return !!value && typeof value[TOKEN_ID] === "string" && value[TOKEN_OVERRIDE] === true;
646
+ }
647
+ function getStyleTokenId(token) {
648
+ return token[TOKEN_ID];
649
+ }
650
+ function getStyleTokenName(token) {
651
+ return token[TOKEN_NAME] ?? null;
652
+ }
653
+ //#endregion
654
+ //#region builder/token/name.ts
655
+ function getStyleTokenNameFromId(id) {
656
+ if (!id) return null;
657
+ const parts = id.split("--");
658
+ const first = normalizeStyleTokenName(parts[0]);
659
+ if (!first) return parts.length > 1 ? normalizeStyleTokenName(parts.slice(1).join("--")) : null;
660
+ return normalizeStyleTokenName([first, ...parts.slice(1)].join("--"));
661
+ }
662
+ function getChildStyleTokenName(name, child) {
663
+ const childName = normalizeStyleTokenName(child);
664
+ if (!childName) return normalizeStyleTokenName(name);
665
+ const parentName = normalizeStyleTokenName(name);
666
+ return parentName ? parentName + "--" + childName : childName;
667
+ }
668
+ function normalizeStyleTokenName(value) {
669
+ if (!value) return null;
670
+ value = value.trim();
671
+ if (!value) return null;
672
+ if (/^\d+$/.test(value)) return null;
673
+ if (isGeneratedTokenHash(value)) return null;
674
+ value = stripGenericTokenPrefix(value);
675
+ if (!value) return null;
676
+ const stableSuffix = value.match(/^(.+)-[a-z0-9]{7}$/);
677
+ if (stableSuffix?.[1] && isGeneratedTokenHash(value.slice(-7))) return normalizeStyleTokenName(stableSuffix[1]);
678
+ return value;
679
+ }
680
+ function isGeneratedTokenHash(value) {
681
+ return /^[a-z0-9]{7}$/.test(value) && /\d/.test(value);
682
+ }
683
+ function stripGenericTokenPrefix(value) {
684
+ const parts = value.split("--");
685
+ while (parts[0] === "token" || parts[0] === "tokens") parts.shift();
686
+ return parts.join("--");
687
+ }
688
+ //#endregion
689
+ //#region style/token.ts
638
690
  const TOKEN_DEBUG = symbol("style:token.debug");
639
691
  const idCounter$6 = globalData("style.token.idCounter", () => ({ value: 0 }));
640
- function createStyleToken(value, debugId) {
692
+ function createStyleToken(value, stableId, debugName) {
641
693
  const token = (value, debug) => {
642
694
  return createStyleTokenOverride(token, value, debug);
643
695
  };
644
- token[TOKEN_ID] = debugId || String(idCounter$6.value++);
696
+ token[TOKEN_ID] = stableId || String(idCounter$6.value++);
697
+ token[TOKEN_NAME] = debugName === void 0 ? getStyleTokenNameFromId(stableId) : normalizeStyleTokenName(debugName);
645
698
  if (isStyleTokenData(value)) {
646
699
  token.value = value.value;
647
700
  token.ref = value;
@@ -655,11 +708,13 @@ function createStyleTokenOverride(token, value, debug) {
655
708
  const override = isStyleTokenData(value) ? {
656
709
  [TOKEN_ID]: getStyleTokenId(token),
657
710
  [TOKEN_OVERRIDE]: true,
711
+ [TOKEN_NAME]: getStyleTokenName(token),
658
712
  value: value.value,
659
713
  ref: value
660
714
  } : {
661
715
  [TOKEN_ID]: getStyleTokenId(token),
662
716
  [TOKEN_OVERRIDE]: true,
717
+ [TOKEN_NAME]: getStyleTokenName(token),
663
718
  value,
664
719
  ref: null
665
720
  };
@@ -670,15 +725,6 @@ function createStyleTokenOverride(token, value, debug) {
670
725
  });
671
726
  return override;
672
727
  }
673
- function isStyleTokenData(value) {
674
- return !!value && typeof value[TOKEN_ID] === "string" && value[TOKEN_OVERRIDE] !== true;
675
- }
676
- function isStyleTokenOverrideData(value) {
677
- return !!value && typeof value[TOKEN_ID] === "string" && value[TOKEN_OVERRIDE] === true;
678
- }
679
- function getStyleTokenId(token) {
680
- return token[TOKEN_ID];
681
- }
682
728
  //#endregion
683
729
  //#region selector/selector.ts
684
730
  function selector(selector, ...args) {
@@ -1085,7 +1131,6 @@ const formatClassName = createNameFormatter([
1085
1131
  "selector",
1086
1132
  "value"
1087
1133
  ]);
1088
- const formatScopeClassName = createNameFormatter(["className"]);
1089
1134
  const formatTransformClassName = createNameFormatter(["className"]);
1090
1135
  function getDebugClassName(format, hash, info) {
1091
1136
  return formatClassName(format || "[(atRule)-][(scopeSelector)-](property)[-(selector)][-(value)]--$hash", hash, info);
@@ -1093,21 +1138,8 @@ function getDebugClassName(format, hash, info) {
1093
1138
  function getDebugTransformClassName(format, hash, info) {
1094
1139
  return formatTransformClassName(format || "(className)--$hash", hash, info);
1095
1140
  }
1096
- function getDebugScopeClassName(format, info) {
1097
- return formatScopeClassName(format || "-(className)", null, info);
1098
- }
1099
1141
  //#endregion
1100
- //#region atomic/utils/css.ts
1101
- function getCssVar(varName, value) {
1102
- return "var(" + varName + ", " + escapeCssValue(value) + ")";
1103
- }
1104
- function getCssVarRawFallback(varName, fallbackCss) {
1105
- return "var(" + varName + ", " + fallbackCss + ")";
1106
- }
1107
- function escapeCssValue(value) {
1108
- if (!value) return "";
1109
- return value.trim().replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/'/g, "\\'").replace(/;/g, "\\;");
1110
- }
1142
+ //#region atomic/utils/cssIdent.ts
1111
1143
  function escapeCssIdent(ident) {
1112
1144
  let result = "";
1113
1145
  for (let i = 0; i < ident.length; i++) {
@@ -1297,6 +1329,13 @@ function parseAtRule(rule) {
1297
1329
  if (normalized.startsWith("@supports")) return compressQuery(normalized.slice(9));
1298
1330
  return compressQuery(normalized);
1299
1331
  }
1332
+ function getScopeClassName(className, scopeClassNameFormat) {
1333
+ return formatScopeClassName(scopeClassNameFormat || "-(className)", { className });
1334
+ }
1335
+ function formatScopeClassName(format, info) {
1336
+ if (typeof format === "function") return format(info);
1337
+ return format.replace(/\[|\]/g, "").replace(/\(className\)/g, info.className);
1338
+ }
1300
1339
  //#endregion
1301
1340
  //#region atomic/utils/hash.ts
1302
1341
  const POOLED_HASH_STATE = globalData("atomic.hashPool", () => ({
@@ -1383,9 +1422,6 @@ function getRuntimeClassNameHashLength(debugClassName) {
1383
1422
  if (debugClassName && DEV_CONFIG.isDev) return DEV_CONFIG.hashLength ?? CSS_CONFIG.hashLength ?? 3;
1384
1423
  return CSS_CONFIG.hashLength ?? 7;
1385
1424
  }
1386
- function getScopeClassName(className, scopeClassNameFormat) {
1387
- return getDebugScopeClassName(scopeClassNameFormat, { className });
1388
- }
1389
1425
  function getClassNameDedupe(property, priority, selector, parentSelector, atRule) {
1390
1426
  let hash = property;
1391
1427
  hash += "\n" + (priority || "");
@@ -1590,10 +1626,23 @@ function getScopeLookupKey(slotId, dedupe) {
1590
1626
  function getTokenLookupKey(tokenId) {
1591
1627
  return "token\0" + tokenId;
1592
1628
  }
1629
+ //#endregion
1630
+ //#region atomic/utils/cssVar.ts
1631
+ function getCssVar(varName, value) {
1632
+ return "var(" + varName + ", " + escapeCssValue(value) + ")";
1633
+ }
1634
+ function getCssVarRawFallback(varName, fallbackCss) {
1635
+ return "var(" + varName + ", " + fallbackCss + ")";
1636
+ }
1637
+ function escapeCssValue(value) {
1638
+ if (!value) return "";
1639
+ return value.trim().replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/'/g, "\\'").replace(/;/g, "\\;");
1640
+ }
1593
1641
  const formatTokenName = createNameFormatter(["name"]);
1594
1642
  function getTokenVarName(token, format) {
1595
1643
  const id = getStyleTokenId(token);
1596
- return "--" + formatTokenName(format || "token[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: id });
1644
+ const debugName = getStyleTokenName(token);
1645
+ return "--" + formatTokenName(format || "token[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: debugName });
1597
1646
  }
1598
1647
  function getTokenVar(token, format) {
1599
1648
  return getTokenVarFallback(token, format);
@@ -3117,15 +3166,12 @@ function appendExtractedStyleTuples(target, source) {
3117
3166
  }
3118
3167
  }
3119
3168
  //#endregion
3120
- //#region style/value.ts
3121
- function createToken(value, debugId) {
3122
- return createStyleToken(value, debugId);
3123
- }
3124
- //#endregion
3125
3169
  //#region dialect/namedTokens.ts
3126
3170
  const ROOT = Symbol("fluentic.namedTokens.root");
3127
3171
  function createNamedToken(id, value) {
3128
- return createToken(value, createNamedTokenId(id));
3172
+ const token = createStyleToken(value, createNamedTokenId(id));
3173
+ token[TOKEN_VAR_NAME] = getTokenVarName(token, CSS_CONFIG.tokenNameFormat ?? null);
3174
+ return token;
3129
3175
  }
3130
3176
  function createNamedTokens(namespace, values) {
3131
3177
  return createNamedTokenProxy({
@@ -3144,7 +3190,7 @@ function createNamedTokenProxy(root, path) {
3144
3190
  if (property === ROOT) return root;
3145
3191
  if (property === "then") return void 0;
3146
3192
  if (property === Symbol.toStringTag) return "NamedTokens";
3147
- if (property === TOKEN_ID || property === TOKEN_OVERRIDE || property === "value" || property === "ref") {
3193
+ if (property === TOKEN_ID || property === TOKEN_NAME || property === TOKEN_VAR_NAME || property === TOKEN_OVERRIDE || property === "value" || property === "ref") {
3148
3194
  if (!path.length) return void 0;
3149
3195
  return getNamedTokenAtPath(root, path)[property];
3150
3196
  }
@@ -3435,9 +3481,9 @@ function evaluateCall(node, scope) {
3435
3481
  if (imp && STYLE_IMPORT_PATHS.has(imp.source) && imp.name === "createToken") {
3436
3482
  const value = evaluateNode(node.arguments[0], scope);
3437
3483
  if (!value.ok) return value;
3438
- const debugId = evaluateOptionalDebugId(node.arguments[1], scope);
3439
- if (!debugId.ok) return debugId;
3440
- return evalOk(createCompiledToken(value.value, scope, node.loc?.start, node, debugId.value));
3484
+ const stableId = evaluateOptionalStableTokenId(node.arguments[1], scope);
3485
+ if (!stableId.ok) return stableId;
3486
+ return evalOk(createCompiledToken(value.value, scope, node.loc?.start, node, stableId.value));
3441
3487
  }
3442
3488
  if (imp && STYLE_IMPORT_PATHS.has(imp.source) && imp.name === "createKeyframes") {
3443
3489
  const frames = evaluateNode(node.arguments[0], scope);
@@ -3504,16 +3550,16 @@ function evaluateCall(node, scope) {
3504
3550
  const url = evaluateNode(node.arguments[0], scope);
3505
3551
  if (!url.ok) return evalFail(`fontSrc url must be statically analyzable: ${url.reason}`);
3506
3552
  if (typeof url.value !== "string") return evalFail("fontSrc url must be a static string");
3507
- const format = evaluateOptionalDebugId(node.arguments[1], scope);
3553
+ const format = evaluateOptionalString(node.arguments[1], scope);
3508
3554
  if (!format.ok) return evalFail(`fontSrc format must be statically analyzable: ${format.reason}`);
3509
3555
  return evalOk(fontSrc(url.value, format.value));
3510
3556
  }
3511
3557
  if (imp && STYLE_IMPORT_PATHS.has(imp.source) && imp.name === "createTokens") {
3512
3558
  const value = evaluateNode(node.arguments[0], scope);
3513
3559
  if (!value.ok) return value;
3514
- const debugId = evaluateOptionalDebugId(node.arguments[1], scope);
3515
- if (!debugId.ok) return debugId;
3516
- return evalOk(createCompiledTokens(value.value, scope, node.loc?.start, node, debugId.value));
3560
+ const stableId = evaluateOptionalStableTokenId(node.arguments[1], scope);
3561
+ if (!stableId.ok) return stableId;
3562
+ return evalOk(createCompiledTokens(value.value, scope, node.loc?.start, node, stableId.value));
3517
3563
  }
3518
3564
  if (imp && STYLE_IMPORT_PATHS.has(imp.source) && imp.name === "createNamedToken") {
3519
3565
  const id = evaluateNode(node.arguments[0], scope);
@@ -3541,13 +3587,13 @@ function evaluateCall(node, scope) {
3541
3587
  if (imp && STYLE_IMPORT_PATHS.has(imp.source) && imp.name === "createValues") {
3542
3588
  const hasNumberArg = node.arguments[0]?.type === "Identifier" && node.arguments[0].name === "Number";
3543
3589
  const valuesNode = hasNumberArg ? node.arguments[1] : node.arguments[0];
3544
- const debugNode = hasNumberArg ? node.arguments[2] : node.arguments[1];
3590
+ const stableIdNode = hasNumberArg ? node.arguments[2] : node.arguments[1];
3545
3591
  const values = evaluateNode(valuesNode, scope);
3546
3592
  if (!values.ok) return values;
3547
- const debugId = evaluateOptionalDebugId(debugNode, scope);
3548
- if (!debugId.ok) return debugId;
3593
+ const stableId = evaluateOptionalStableTokenId(stableIdNode, scope);
3594
+ if (!stableId.ok) return stableId;
3549
3595
  if (!Array.isArray(values.value)) return evalFail("createValues values must be an array");
3550
- return evalOk(createCompiledValues(values.value, scope, node.loc?.start, node, debugId.value, hasNumberArg));
3596
+ return evalOk(createCompiledValues(values.value, scope, node.loc?.start, node, stableId.value, hasNumberArg));
3551
3597
  }
3552
3598
  }
3553
3599
  if (node.callee.type === "Identifier") {
@@ -3635,38 +3681,48 @@ function createCompiledTokenOverride(token, value, runtimeValue) {
3635
3681
  if (isStyleTokenData(value)) return withRuntimeValue(runtimeValue, {
3636
3682
  [TOKEN_ID]: getStyleTokenId(token),
3637
3683
  [TOKEN_OVERRIDE]: true,
3684
+ [TOKEN_NAME]: getStyleTokenName(token),
3638
3685
  value: value.value,
3639
3686
  ref: value
3640
3687
  });
3641
3688
  return withRuntimeValue(runtimeValue, {
3642
3689
  [TOKEN_ID]: getStyleTokenId(token),
3643
3690
  [TOKEN_OVERRIDE]: true,
3691
+ [TOKEN_NAME]: getStyleTokenName(token),
3644
3692
  value,
3645
3693
  ref: null
3646
3694
  });
3647
3695
  }
3648
- function createCompiledToken(value, scope, loc, runtimeValue, debugId) {
3649
- let tokenId = debugId;
3696
+ function createCompiledToken(value, scope, loc, runtimeValue, stableId, debugName) {
3697
+ let tokenId = stableId;
3650
3698
  if (!tokenId) tokenId = hashString((scope.styleFilePath ?? scope.filePath) + "\n" + (loc ? loc.line + ":" + loc.column : String(value)));
3699
+ if (isStyleTokenData(value)) return withRuntimeValue(runtimeValue, {
3700
+ [TOKEN_ID]: tokenId,
3701
+ [TOKEN_NAME]: debugName === void 0 ? getStyleTokenNameFromId(stableId) : normalizeStyleTokenName(debugName),
3702
+ value: value.value,
3703
+ ref: value
3704
+ });
3651
3705
  return withRuntimeValue(runtimeValue, {
3652
3706
  [TOKEN_ID]: tokenId,
3707
+ [TOKEN_NAME]: debugName === void 0 ? getStyleTokenNameFromId(stableId) : normalizeStyleTokenName(debugName),
3653
3708
  value,
3654
3709
  ref: null
3655
3710
  });
3656
3711
  }
3657
- function createCompiledTokens(value, scope, loc, runtimeValue, debugId) {
3658
- const tokenGroupId = debugId ?? createCompiledTokenGroupId(scope, loc);
3712
+ function createCompiledTokens(value, scope, loc, runtimeValue, stableId) {
3713
+ const tokenGroupId = stableId ?? createCompiledTokenGroupId(scope, loc);
3714
+ const tokenGroupName = getStyleTokenNameFromId(stableId);
3659
3715
  if (Array.isArray(value)) {
3660
3716
  const result = {};
3661
3717
  for (let i = 0, len = value.length; i < len; i++) {
3662
3718
  const item = value[i];
3663
- result[item] = createCompiledToken(item, scope, loc, runtimeValue, getChildDebugId(tokenGroupId, String(i)));
3719
+ result[item] = createCompiledToken(item, scope, loc, runtimeValue, getChildStableId(tokenGroupId, String(i)), getChildStyleTokenName(tokenGroupName, String(i)));
3664
3720
  }
3665
3721
  return result;
3666
3722
  }
3667
3723
  if (!value || typeof value !== "object") return {};
3668
3724
  const result = {};
3669
- assignCompiledTokenRecord(result, value, scope, loc, runtimeValue, tokenGroupId);
3725
+ assignCompiledTokenRecord(result, value, scope, loc, runtimeValue, tokenGroupId, tokenGroupName);
3670
3726
  return result;
3671
3727
  }
3672
3728
  function createCompiledTokenGroupId(scope, loc) {
@@ -3678,22 +3734,24 @@ function createCompiledAtRuleStableId(scope, loc, value) {
3678
3734
  id: (scope.styleFilePath ?? scope.filePath) + "\n" + (loc ? loc.line + ":" + loc.column : String(value))
3679
3735
  };
3680
3736
  }
3681
- function assignCompiledTokenRecord(target, value, scope, loc, runtimeValue, debugId) {
3737
+ function assignCompiledTokenRecord(target, value, scope, loc, runtimeValue, stableId, debugName) {
3682
3738
  for (const key of Object.keys(value)) {
3683
3739
  const item = value[key];
3684
- const itemDebugId = getChildDebugId(debugId, key);
3740
+ const itemStableId = getChildStableId(stableId, key);
3741
+ const itemDebugName = getChildStyleTokenName(debugName, key);
3685
3742
  if (item && typeof item === "object" && !Array.isArray(item) && !isStyleTokenData(item)) {
3686
3743
  const child = {};
3687
3744
  target[key] = child;
3688
- assignCompiledTokenRecord(child, item, scope, loc, runtimeValue, itemDebugId);
3689
- } else target[key] = createCompiledToken(item, scope, loc, runtimeValue, itemDebugId);
3745
+ assignCompiledTokenRecord(child, item, scope, loc, runtimeValue, itemStableId, itemDebugName);
3746
+ } else target[key] = createCompiledToken(item, scope, loc, runtimeValue, itemStableId, itemDebugName);
3690
3747
  }
3691
3748
  }
3692
- function createCompiledValues(values, scope, loc, runtimeValue, debugId, isNumber) {
3749
+ function createCompiledValues(values, scope, loc, runtimeValue, stableId, isNumber) {
3693
3750
  const tokens = /* @__PURE__ */ new Map();
3751
+ const groupName = getStyleTokenNameFromId(stableId);
3694
3752
  for (let i = 0, len = values.length; i < len; i++) {
3695
3753
  const value = values[i];
3696
- tokens.set(value, createCompiledToken(parseCompiledValue(value, isNumber), scope, loc, runtimeValue, getChildDebugId(debugId, hashString(String(value)))));
3754
+ tokens.set(value, createCompiledToken(parseCompiledValue(value, isNumber), scope, loc, runtimeValue, getChildStableId(stableId, hashString(String(value))), getChildStyleTokenName(groupName, getValueDebugName(value))));
3697
3755
  }
3698
3756
  return {
3699
3757
  [COMPILED_TOKEN_FACTORY]: true,
@@ -3711,7 +3769,10 @@ function parseCompiledValue(value, isNumber) {
3711
3769
  function isCompiledTokenFactory(value) {
3712
3770
  return !!value && typeof value === "object" && value[COMPILED_TOKEN_FACTORY] === true;
3713
3771
  }
3714
- function evaluateOptionalDebugId(node, scope) {
3772
+ function evaluateOptionalStableTokenId(node, scope) {
3773
+ return evaluateOptionalString(node, scope);
3774
+ }
3775
+ function evaluateOptionalString(node, scope) {
3715
3776
  if (!node) return evalOk(void 0);
3716
3777
  const value = evaluateNode(node, scope);
3717
3778
  if (!value.ok) return value;
@@ -3735,12 +3796,24 @@ function evaluateOptionalStableId(node, scope) {
3735
3796
  id: stableId.id
3736
3797
  });
3737
3798
  }
3738
- function getChildDebugId(debugId, child) {
3739
- return debugId ? debugId + "--" + child : void 0;
3799
+ function getChildStableId(stableId, child) {
3800
+ return stableId ? stableId + "--" + child : void 0;
3801
+ }
3802
+ function getValueDebugName(value) {
3803
+ if (typeof value === "number") return String(value);
3804
+ if (typeof value !== "string") return null;
3805
+ const parts = value.split(/[;|]/);
3806
+ const label = parts[1]?.trim();
3807
+ if (label) return sanitizeTokenDebugName(label);
3808
+ return sanitizeTokenDebugName(parts[0]?.trim() ?? "");
3809
+ }
3810
+ function sanitizeTokenDebugName(value) {
3811
+ return value.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || null;
3740
3812
  }
3741
3813
  function withRuntimeValue(runtimeValue, token) {
3742
3814
  return Object.assign({}, token, {
3743
3815
  [TOKEN_ID]: token[TOKEN_ID],
3816
+ [TOKEN_NAME]: token[TOKEN_NAME] ?? null,
3744
3817
  [COMPILED_RUNTIME_VALUE]: runtimeValue
3745
3818
  });
3746
3819
  }
@@ -3800,7 +3873,7 @@ function isStyleChainCall(callee, styleNames) {
3800
3873
  }
3801
3874
  const formatThemeName = createNameFormatter(["name"]);
3802
3875
  function createThemeClassName(name, id, themeNameFormat) {
3803
- return formatThemeName(themeNameFormat || "theme[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name });
3876
+ return formatThemeName(themeNameFormat || "theme[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: normalizeThemeName(name) });
3804
3877
  }
3805
3878
  function getThemeRuleCss(className, tokens, tokenNameFormat) {
3806
3879
  const declarations = [];
@@ -3812,6 +3885,29 @@ function getThemeDeclaration(token, tokenNameFormat) {
3812
3885
  const value = token.ref ? getTokenOverrideValue(token, tokenNameFormat) : escapeCssValue(String(token.value ?? ""));
3813
3886
  return name + ":" + value;
3814
3887
  }
3888
+ function normalizeThemeName(value) {
3889
+ if (!value) return null;
3890
+ value = value.trim();
3891
+ if (!value) return null;
3892
+ if (/^\d+$/.test(value)) return null;
3893
+ if (isGeneratedNameHash(value)) return null;
3894
+ const stableSuffix = value.match(/^(.+)-[a-z0-9]{7}$/);
3895
+ if (stableSuffix?.[1] && isGeneratedNameHash(value.slice(-7))) return normalizeThemeName(stableSuffix[1]);
3896
+ value = stripGenericThemePrefix(value);
3897
+ if (!value) return null;
3898
+ return value;
3899
+ }
3900
+ function stripGenericThemePrefix(value) {
3901
+ const parts = value.split("--");
3902
+ while (parts[0] === "theme" || parts[0] === "themes") parts.shift();
3903
+ value = parts.join("--");
3904
+ if (value.startsWith("theme-")) return value.slice(6);
3905
+ if (value.startsWith("themes-")) return value.slice(7);
3906
+ return value;
3907
+ }
3908
+ function isGeneratedNameHash(value) {
3909
+ return /^[a-z0-9]{7}$/.test(value) && /\d/.test(value);
3910
+ }
3815
3911
  //#endregion
3816
3912
  //#region compiler/transform/syntax/utils.ts
3817
3913
  function getCallLabel(callee) {
@@ -4509,8 +4605,9 @@ function getSelectorMethodPath(path) {
4509
4605
  function getDebugStyleArg(t, path, state, sourcemapTrace) {
4510
4606
  const arg = getStyleObjectArg(path, state);
4511
4607
  if (!arg) return arg;
4608
+ const meta = getStyleCallMeta(path, state);
4512
4609
  if (arg.type !== "ObjectExpression") return resolveDebugMergeObject(t, arg, path, state, sourcemapTrace) ?? arg;
4513
- return flattenDebugObjectExpression(t, arg, path, state, sourcemapTrace, /* @__PURE__ */ new Set());
4610
+ return appendTransformDebugFieldAliases(t, flattenDebugObjectExpression(t, arg, path, state, sourcemapTrace, /* @__PURE__ */ new Set()), meta, state);
4514
4611
  }
4515
4612
  function getDebugCallLoc(path, state) {
4516
4613
  return isSelectorStyleCall(path, state) || isScopeItemSelectorCall(path, state) ? getMergeStyleLoc(path.node.callee) : null;
@@ -4524,6 +4621,10 @@ function getStyleObjectArg(path, state) {
4524
4621
  const styleArgIndex = selectorArgIndex === null ? 0 : selectorArgIndex + 1;
4525
4622
  return path.node.arguments[styleArgIndex];
4526
4623
  }
4624
+ function getStyleCallMeta(path, state) {
4625
+ const rootName = getStyleChainRootName(path.node.callee, state.styleNames);
4626
+ return rootName ? state.styleMetas.get(rootName) ?? null : null;
4627
+ }
4527
4628
  function isSelectorStyleCall(path, state) {
4528
4629
  const methodName = getSelectorMethodName(path.node.callee);
4529
4630
  if (!methodName) return false;
@@ -4628,6 +4729,46 @@ function flattenDebugObjectExpression(t, node, path, state, sourcemapTrace, seen
4628
4729
  }
4629
4730
  return t.objectExpression(properties);
4630
4731
  }
4732
+ function appendTransformDebugFieldAliases(t, node, meta, state) {
4733
+ if (!meta || meta.mode !== "StyleObject" || !meta.transform) return node;
4734
+ const existing = /* @__PURE__ */ new Set();
4735
+ for (const property of node.properties) {
4736
+ if (property.type !== "ObjectProperty" || property.computed) continue;
4737
+ const key = getObjectPropertyKey$1(property);
4738
+ if (key) existing.add(key);
4739
+ }
4740
+ const aliases = [];
4741
+ for (const property of node.properties) {
4742
+ if (property.type !== "ObjectProperty" || property.computed) continue;
4743
+ const key = getObjectPropertyKey$1(property);
4744
+ if (!key) continue;
4745
+ const value = evaluateNode(property.value, getDebugEvalScope(state));
4746
+ if (!value.ok) continue;
4747
+ let transformed;
4748
+ try {
4749
+ transformed = meta.transform.transform({ [key]: value.value });
4750
+ } catch {
4751
+ continue;
4752
+ }
4753
+ for (const transformedKey of Object.keys(transformed)) {
4754
+ if (existing.has(transformedKey)) continue;
4755
+ existing.add(transformedKey);
4756
+ aliases.push(createDebugFieldAlias(t, transformedKey, property));
4757
+ }
4758
+ }
4759
+ if (!aliases.length) return node;
4760
+ return t.objectExpression([...node.properties, ...aliases]);
4761
+ }
4762
+ function createDebugFieldAlias(t, key, source) {
4763
+ const alias = t.objectProperty(t.stringLiteral(key), t.nullLiteral());
4764
+ const sourceTrace = source;
4765
+ alias.loc = source.loc;
4766
+ alias.__styleSourcemapStyleLoc = sourceTrace.__styleSourcemapStyleLoc;
4767
+ alias.__styleSourcemapStyleSourceUrl = sourceTrace.__styleSourcemapStyleSourceUrl;
4768
+ alias.__styleSourcemapValueLoc = sourceTrace.__styleSourcemapValueLoc;
4769
+ alias.__styleSourcemapValueSourceUrl = sourceTrace.__styleSourcemapValueSourceUrl;
4770
+ return alias;
4771
+ }
4631
4772
  function resolveDebugSpreadObject(t, spread, path, state, sourcemapTrace, seen) {
4632
4773
  const node = spread.argument;
4633
4774
  if (node.type !== "Identifier") return null;
@@ -5175,8 +5316,8 @@ function carryTransformedLocations(input, transformed, transform) {
5175
5316
  * Compile a parsed chain into extracted items and CSS rules.
5176
5317
  * Returns null if any argument cannot be statically evaluated.
5177
5318
  */
5178
- function compileChain(chain, fileId, nodeLoc, scope, opts, meta, styleNames = /* @__PURE__ */ new Set()) {
5179
- const css = getCssConfig(opts);
5319
+ function compileChain(chain, fileId, nodeLoc, scope, opts, runtimeMode, meta, styleNames = /* @__PURE__ */ new Set()) {
5320
+ const css = getCssConfig(opts, runtimeMode);
5180
5321
  if (meta.mode === "ClassName") {
5181
5322
  if (chain.kind !== "style") return null;
5182
5323
  return compileClassNameChain(chain, meta.selectors, fileId, scope, css, meta.transform, styleNames, opts);
@@ -5188,15 +5329,16 @@ function compileChain(chain, fileId, nodeLoc, scope, opts, meta, styleNames = /*
5188
5329
  if (chain.kind === "scope") return compileScopeChain(chain, selectors, fileId, scope, css, transform, opts);
5189
5330
  return null;
5190
5331
  }
5191
- function getCssConfig(opts) {
5332
+ function getCssConfig(opts, runtimeMode) {
5192
5333
  const css = opts.css;
5334
+ const isDevRuntimeMode = runtimeMode === "dev" || runtimeMode === "rsc-dev";
5193
5335
  return {
5194
5336
  classNameFormat: css?.classNameFormat ?? DEFAULT_CONFIG.classNameFormat ?? null,
5195
5337
  transformClassNameFormat: css?.transformClassNameFormat ?? DEFAULT_CONFIG.transformClassNameFormat ?? null,
5196
5338
  hashLength: css?.hashLength ?? DEFAULT_CONFIG.hashLength ?? 7,
5197
5339
  tokenNameFormat: css?.tokenNameFormat ?? DEFAULT_CONFIG.tokenNameFormat ?? null,
5198
- localClassName: css?.localClassName ?? DEFAULT_CONFIG.localClassName,
5199
- debugClassName: css?.debugClassName ?? DEFAULT_CONFIG.debugClassName,
5340
+ localClassName: isDevRuntimeMode,
5341
+ debugClassName: css?.debugClassName ?? isDevRuntimeMode,
5200
5342
  scopeTargetPrefix: css?.scopeTargetPrefix ?? ""
5201
5343
  };
5202
5344
  }
@@ -6391,7 +6533,7 @@ function evaluateResolvedNode(node, scope, styleNames, fileId, options) {
6391
6533
  if (chain?.kind === "style" || chain?.kind === "scope") try {
6392
6534
  const meta = scope.styleMetas?.get(chain.rootName);
6393
6535
  if (!meta) return evalFail("Cannot resolve imported style function");
6394
- const result = compileChain(chain, fileId, node.loc?.start, scope, options, meta, styleNames);
6536
+ const result = compileChain(chain, fileId, node.loc?.start, scope, options, scope.runtimeMode ?? null, meta, styleNames);
6395
6537
  if (!result) return evalFail("Cannot compile imported style chain");
6396
6538
  const extracted = createExtractedChainValue(result, options.dev?.sourcemapMode === "value" ? result : compileChain(chain, fileId, node.loc?.start, scope, {
6397
6539
  ...options,
@@ -6399,7 +6541,7 @@ function evaluateResolvedNode(node, scope, styleNames, fileId, options) {
6399
6541
  ...options.dev,
6400
6542
  sourcemapMode: "value"
6401
6543
  }
6402
- }, meta, styleNames) ?? result);
6544
+ }, scope.runtimeMode ?? null, meta, styleNames) ?? result);
6403
6545
  if (!extracted) return evalFail("Cannot extract imported style chain");
6404
6546
  return evalOk(extracted);
6405
6547
  } catch (error) {
@@ -6790,10 +6932,13 @@ function buildVariableValueExpression(t, value, state, item, options) {
6790
6932
  }
6791
6933
  function buildExtractedTokenExpression(t, token, state) {
6792
6934
  state.usedHelpers.add(FN_CREATE_EXTRACTED_TOKEN);
6935
+ const tokenNameFormat = state.options.css?.tokenNameFormat ?? DEFAULT_CONFIG.tokenNameFormat ?? null;
6793
6936
  return t.callExpression(t.identifier(FN_CREATE_EXTRACTED_TOKEN), [
6794
6937
  t.stringLiteral(getStyleTokenId(token)),
6795
6938
  literalExpression(t, token.value),
6796
- token.ref ? buildExtractedTokenExpression(t, token.ref, state) : t.nullLiteral()
6939
+ token.ref ? buildExtractedTokenExpression(t, token.ref, state) : t.nullLiteral(),
6940
+ getStyleTokenName(token) ? t.stringLiteral(getStyleTokenName(token)) : t.nullLiteral(),
6941
+ t.stringLiteral(getTokenVarName(token, tokenNameFormat))
6797
6942
  ]);
6798
6943
  }
6799
6944
  function literalExpression(t, value) {
@@ -6918,7 +7063,8 @@ function getEvalScope(state) {
6918
7063
  sourcemapTrace: state.sourcemapTrace,
6919
7064
  styleNames: state.styleNames,
6920
7065
  styleMetas: state.styleMetas,
6921
- bindingNodes: state.bindingNodes
7066
+ bindingNodes: state.bindingNodes,
7067
+ runtimeMode: state.runtimeMode
6922
7068
  };
6923
7069
  }
6924
7070
  //#endregion
@@ -6932,8 +7078,8 @@ function compileThemeCall(path, state, opts) {
6932
7078
  const tokenArg = evaluateNode(path.node.arguments[0], scope);
6933
7079
  if (!tokenArg.ok) throw path.buildCodeFrameError(`createTheme tokens must be statically analyzable: ${tokenArg.reason}`);
6934
7080
  if (!Array.isArray(tokenArg.value)) throw path.buildCodeFrameError("createTheme first argument must be a static array of token overrides.");
6935
- const debugIdArg = evaluateNode(path.node.arguments[1], scope);
6936
- if (path.node.arguments[1] && !debugIdArg.ok) throw path.buildCodeFrameError(`createTheme debugId must be statically analyzable: ${debugIdArg.reason}`);
7081
+ const stableIdArg = evaluateNode(path.node.arguments[1], scope);
7082
+ if (path.node.arguments[1] && !stableIdArg.ok) throw path.buildCodeFrameError(`createTheme stableId must be statically analyzable: ${stableIdArg.reason}`);
6937
7083
  const tokens = [];
6938
7084
  for (let i = 0, len = tokenArg.value.length; i < len; i++) {
6939
7085
  const token = tokenArg.value[i];
@@ -6941,7 +7087,7 @@ function compileThemeCall(path, state, opts) {
6941
7087
  tokens.push(token);
6942
7088
  }
6943
7089
  const loc = path.node.loc?.start;
6944
- const id = debugIdArg.ok && debugIdArg.value !== void 0 ? String(debugIdArg.value) : getStableThemeId(state.fileId, loc ? loc.line + ":" + loc.column : "createTheme");
7090
+ const id = stableIdArg.ok && stableIdArg.value !== void 0 ? String(stableIdArg.value) : getStableThemeId(state.fileId, loc ? loc.line + ":" + loc.column : "createTheme");
6945
7091
  const themeNameFormat = opts.css?.themeNameFormat || CSS_CONFIG.themeNameFormat || null;
6946
7092
  const className = getStableThemeClassName(id, themeNameFormat);
6947
7093
  return {
@@ -7075,7 +7221,7 @@ function createExtractPlugin(args) {
7075
7221
  if (!meta) return;
7076
7222
  let result;
7077
7223
  try {
7078
- result = compileChain(chain, state.fileId, loc, scope, options, meta, state.styleNames);
7224
+ result = compileChain(chain, state.fileId, loc, scope, options, state.runtimeMode, meta, state.styleNames);
7079
7225
  } catch (error) {
7080
7226
  const message = error instanceof Error ? error.message : String(error);
7081
7227
  throw buildCodeFrameError(path, getSelectorCompileErrorNode(error) ?? path.node, message);
@@ -8142,4 +8288,4 @@ Object.defineProperty(exports, "writeParcelVirtualRuntimeFile", {
8142
8288
  }
8143
8289
  });
8144
8290
 
8145
- //# sourceMappingURL=shared-B_gJf5uj.cjs.map
8291
+ //# sourceMappingURL=shared-CaJuvw03.cjs.map