@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
@@ -1,12 +1,14 @@
1
- import { setBuildConfig } from '../../config/build';
1
+ import { type BuildConfig, setBuildConfig } from '../../config/build';
2
+ import { setBuildDebugClassName } from '../../config/config/debug';
2
3
  import { readEntryJsonDefine } from './utils';
3
4
 
4
5
  declare const FLUENTIC_STYLE_BUILD_CONFIG: string;
5
6
 
6
- setBuildConfig(
7
- readEntryJsonDefine(
8
- 'FLUENTIC_STYLE_BUILD_CONFIG',
9
- () => FLUENTIC_STYLE_BUILD_CONFIG,
10
- { hoist: true, css: {} },
11
- ),
7
+ const buildConfig = readEntryJsonDefine<BuildConfig>(
8
+ 'FLUENTIC_STYLE_BUILD_CONFIG',
9
+ () => FLUENTIC_STYLE_BUILD_CONFIG,
10
+ { hoist: true, css: {} } satisfies BuildConfig,
12
11
  );
12
+
13
+ setBuildConfig(buildConfig);
14
+ setBuildDebugClassName(buildConfig.css?.debugClassName, false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentic/style",
3
- "version": "0.1.0-beta.3",
3
+ "version": "0.1.0-beta.4",
4
4
  "description": "Type-safe styles that scale with your components.",
5
5
  "homepage": "https://fluenticstack.com/style",
6
6
  "repository": {
@@ -1,3 +1,4 @@
1
+ import { Buffer } from 'node:buffer';
1
2
  import { EXTRACTED_CSS_MARKER, transformCssOutput } from '../../utils';
2
3
  import { replaceCssMarker } from '../../utils/cssMarker';
3
4
  import { ensureParcelSidecarStarted, getParcelExtractedCss, getParcelState, Optimizer } from './shared';
@@ -1,5 +1,5 @@
1
+ import { TOKEN_ID, TOKEN_OVERRIDE } from '../../../builder/token/symbols';
1
2
  import { getNamedToken } from '../../../dialect';
2
- import { isStyleTokenData } from '../../../style/token';
3
3
  import { styleTransform } from '../../../style/transform';
4
4
  import type { CSSProperties } from '../../../style/types';
5
5
  import { defaultTailwindTheme } from '../theme';
@@ -372,7 +372,7 @@ function mapUtility(property: string, values: Record<string, unknown>): UtilityR
372
372
  }
373
373
 
374
374
  function resolveScale(scale: TailwindScale | undefined, value: unknown) {
375
- if (!scale || isStyleTokenData(value)) return value;
375
+ if (!scale || isTailwindStyleTokenData(value)) return value;
376
376
  if (Array.isArray(scale)) return resolveScales(scale, value);
377
377
 
378
378
  const key = getScaleRef(value);
@@ -388,7 +388,7 @@ function resolveScale(scale: TailwindScale | undefined, value: unknown) {
388
388
  }
389
389
 
390
390
  function resolveScales(scales: (TailwindScale | undefined)[], value: unknown) {
391
- if (isStyleTokenData(value)) return value;
391
+ if (isTailwindStyleTokenData(value)) return value;
392
392
 
393
393
  const key = getScaleRef(value);
394
394
  if (key === null) return value;
@@ -407,6 +407,12 @@ function resolveScales(scales: (TailwindScale | undefined)[], value: unknown) {
407
407
  return value;
408
408
  }
409
409
 
410
+ function isTailwindStyleTokenData(value: unknown) {
411
+ return !!value &&
412
+ typeof (value as { [TOKEN_ID]?: unknown; })[TOKEN_ID] === 'string' &&
413
+ (value as { [TOKEN_OVERRIDE]?: true; })[TOKEN_OVERRIDE] !== true;
414
+ }
415
+
410
416
  function getScaleValue(scale: TailwindScale, key: string) {
411
417
  if (key in scale) return { found: true, value: scale[key] };
412
418
 
@@ -4,8 +4,8 @@ import { RUNTIME_CONFIG } from '../../../config/config/runtime';
4
4
  import type { Falsy, StyleItem } from '../../types';
5
5
  import { type CombinedStyle, getCombinedStyleScopes, getCombinedStyleStyles, isCombinedStyle } from '../combinedStyle';
6
6
  import { createCombinedStyleTokenWrapper, getStyleTokenValues } from './item';
7
- import { getCachedTokenWrapper, getCombinedStylePool } from './pool';
8
- import { mergeTokenOverrides, mergeTokenValues, type StyleTokenValues } from './tokenValues';
7
+ import { type CombinedStylePool, createCombinedStylePool, getCachedTokenWrapper } from './pool';
8
+ import { mergeTokenOverrides, mergeTokenValues, type StyleTokenValues, type TokenValueResolver } from './tokenValues';
9
9
 
10
10
  export type CombinedStyleArg<T extends object> =
11
11
  | Falsy
@@ -19,30 +19,48 @@ type NormalizedStyleItems = {
19
19
  tokens: StyleTokenValues | null;
20
20
  };
21
21
 
22
- export function getCombinedStyle<T extends object>(
23
- styles: T,
24
- args: readonly CombinedStyleArg<T>[],
25
- ): CombinedStyle<T> {
26
- const normalized = normalizeStyleItems(styles, args);
27
- const result = getCombinedStylePool().get(
28
- styles,
29
- normalized.inheritedScopes,
30
- normalized.items,
31
- normalized.tokens,
32
- );
33
-
34
- return result.tokens
35
- ? getCachedTokenWrapper(
36
- result.tokenCache,
37
- result.tokens,
38
- () => createCombinedStyleTokenWrapper(result.style, result.tokens!),
39
- )
40
- : result.style;
22
+ export function createCombinedStyleGetter(
23
+ resolver: TokenValueResolver,
24
+ ) {
25
+ let configuredPool: CombinedStylePool | null = null;
26
+ let configuredPoolTTL = -1;
27
+
28
+ return function getConfiguredCombinedStyle<T extends object>(
29
+ styles: T,
30
+ args: readonly CombinedStyleArg<T>[],
31
+ ): CombinedStyle<T> {
32
+ const ttl = RUNTIME_CONFIG.runtimeCacheTTL;
33
+
34
+ if (
35
+ !configuredPool ||
36
+ configuredPoolTTL !== ttl
37
+ ) {
38
+ configuredPool = createCombinedStylePool(resolver, ttl);
39
+ configuredPoolTTL = ttl;
40
+ }
41
+
42
+ const normalized = normalizeStyleItems(styles, args, resolver);
43
+ const result = configuredPool.get(
44
+ styles,
45
+ normalized.inheritedScopes,
46
+ normalized.items,
47
+ normalized.tokens,
48
+ );
49
+
50
+ return result.tokens
51
+ ? getCachedTokenWrapper(
52
+ result.tokenCache,
53
+ result.tokens,
54
+ () => createCombinedStyleTokenWrapper(result.style, result.tokens!),
55
+ )
56
+ : result.style;
57
+ };
41
58
  }
42
59
 
43
60
  function normalizeStyleItems<T extends object>(
44
61
  styles: T,
45
62
  args: readonly CombinedStyleArg<T>[],
63
+ resolver: TokenValueResolver,
46
64
  ): NormalizedStyleItems {
47
65
  const result: NormalizedStyleItems = {
48
66
  inheritedScopes: [],
@@ -51,7 +69,7 @@ function normalizeStyleItems<T extends object>(
51
69
  };
52
70
 
53
71
  for (let i = 0, len = args.length; i < len; i++) {
54
- collectStyleArg(styles, args[i], result);
72
+ collectStyleArg(styles, args[i], result, resolver);
55
73
  }
56
74
 
57
75
  return result;
@@ -61,12 +79,13 @@ function collectStyleArg<T extends object>(
61
79
  styles: T,
62
80
  arg: CombinedStyleArg<T>,
63
81
  result: NormalizedStyleItems,
82
+ resolver: TokenValueResolver,
64
83
  ) {
65
84
  if (!arg) return;
66
85
 
67
86
  if (Array.isArray(arg)) {
68
87
  for (let i = 0, len = arg.length; i < len; i++) {
69
- collectStyleArg(styles, arg[i], result);
88
+ collectStyleArg(styles, arg[i], result, resolver);
70
89
  }
71
90
 
72
91
  return;
@@ -75,9 +94,9 @@ function collectStyleArg<T extends object>(
75
94
  if (RUNTIME_CONFIG.isHoist && isExtractedTokenBoundData(arg)) {
76
95
  const bound = getExtractedTokenBoundData(arg);
77
96
 
78
- result.tokens = mergeTokenOverrides(result.tokens, bound.tokens);
97
+ result.tokens = mergeTokenOverrides(result.tokens, bound.tokens, resolver);
79
98
 
80
- collectStyleArg(styles, bound.data as CombinedStyleArg<T>, result);
99
+ collectStyleArg(styles, bound.data as CombinedStyleArg<T>, result, resolver);
81
100
  return;
82
101
  }
83
102
 
@@ -0,0 +1,4 @@
1
+ import { createCombinedStyleGetter } from './combine';
2
+ import { runtimeTokenValueResolver } from './token';
3
+
4
+ export const getCombinedStyle = createCombinedStyleGetter(runtimeTokenValueResolver);
@@ -1,4 +1,5 @@
1
- export { type CombinedStyleArg, getCombinedStyle } from './combine';
1
+ export type { CombinedStyleArg } from './combine';
2
+ export { getCombinedStyle } from './combineRuntime';
2
3
  export type { ResolvedStyleItem } from './item';
3
4
  export { type CombinedStylePool, createCombinedStylePool } from './pool';
4
5
  export { type ResolvedStylePropRuntime, resolveStyleProp } from './prop';
@@ -1,4 +1,4 @@
1
- import { getScopeClassName } from '../../../atomic/className';
1
+ import { getScopeClassName } from '../../../atomic/scope';
2
2
  import { BUILDER_STATE, BUILDER_TYPE_SCOPE, BUILDER_TYPE_SLOT } from '../../../builder/data/const';
3
3
  import type { ScopeTargetData, SlotData, StyleData } from '../../../builder/data/data';
4
4
  import {
@@ -9,8 +9,8 @@ import {
9
9
  isStyleData,
10
10
  } from '../../../builder/data/is';
11
11
  import type { StateItem } from '../../../builder/data/state';
12
+ import { isStyleTokenOverrideData } from '../../../builder/token/data';
12
13
  import { CSS_CONFIG } from '../../../config/config/css';
13
- import { isStyleTokenOverrideData } from '../../../style/token';
14
14
  import { globalData } from '../../../utils/global';
15
15
  import {
16
16
  type CombinedStyle,
@@ -1,8 +1,6 @@
1
1
  import { BUILDER_STATE } from '../../../builder/data/const';
2
2
  import type { ScopeData, ScopeTargetData } from '../../../builder/data/data';
3
3
  import { getScopeTargetScope, getScopeTargetSlotId, isScopeTargetData } from '../../../builder/data/is';
4
- import { CSS_CONFIG } from '../../../config/config/css';
5
- import { RUNTIME_CONFIG } from '../../../config/config/runtime';
6
4
  import type { Falsy, StyleItem } from '../../types';
7
5
  import type { CombinedStyle } from '../combinedStyle';
8
6
  import { createCombinedStyleFacade } from './item';
@@ -12,6 +10,7 @@ import {
12
10
  createMutableTokenValues,
13
11
  finishTokenValues,
14
12
  type StyleTokenValues,
13
+ type TokenValueResolver,
15
14
  } from './tokenValues';
16
15
  import { type CacheTreeNode, createCacheTreeNode, getCacheTreeChild } from './utils/tree';
17
16
 
@@ -38,7 +37,7 @@ type PoolValue = {
38
37
  tokenCache: TokenWrapperCache | null;
39
38
  h: boolean;
40
39
  s: StyleTokenValues | null;
41
- f: typeof CSS_CONFIG.tokenNameFormat;
40
+ f: unknown;
42
41
  updatedAt: number;
43
42
  };
44
43
 
@@ -47,31 +46,17 @@ type PoolNode = CacheTreeNode<unknown, PoolValue>;
47
46
  const DEFAULT_TTL = 1000 * 60 * 5;
48
47
  const TOKEN_WRAPPER_CACHE_LIMIT = 32;
49
48
 
50
- let configuredPool: CombinedStylePool | null = null;
51
- let configuredPoolTTL = -1;
52
-
53
- export function getCombinedStylePool() {
54
- const ttl = RUNTIME_CONFIG.runtimeCacheTTL;
55
-
56
- if (
57
- !configuredPool ||
58
- configuredPoolTTL !== ttl
59
- ) {
60
- configuredPool = createCombinedStylePool(ttl);
61
- configuredPoolTTL = ttl;
62
- }
63
-
64
- return configuredPool;
65
- }
66
-
67
- export function createCombinedStylePool(ttl = DEFAULT_TTL): CombinedStylePool {
49
+ export function createCombinedStylePool(
50
+ resolver: TokenValueResolver,
51
+ ttl = DEFAULT_TTL,
52
+ ): CombinedStylePool {
68
53
  const root = createPoolNode();
69
54
  let timer: ReturnType<typeof setTimeout> | null = null;
70
55
 
71
56
  return {
72
57
  get(styles, inheritedScopes, items, prevTokensData = null) {
73
58
  if (ttl === 0) {
74
- const collected = collectItems(null, items, prevTokensData);
59
+ const collected = collectItems(null, items, prevTokensData, resolver);
75
60
  const allScopes = concatScopes(inheritedScopes, collected.scopes);
76
61
 
77
62
  return {
@@ -86,7 +71,7 @@ export function createCombinedStylePool(ttl = DEFAULT_TTL): CombinedStylePool {
86
71
 
87
72
  node = walkScopes(node, inheritedScopes);
88
73
 
89
- const collected = collectItems(node, items, prevTokensData);
74
+ const collected = collectItems(node, items, prevTokensData, resolver);
90
75
  node = collected.node ?? node;
91
76
  node.value.updatedAt = now;
92
77
 
@@ -171,6 +156,7 @@ function collectItems(
171
156
  node: PoolNode | null,
172
157
  items: readonly (StyleItem | Falsy)[],
173
158
  prevTokensData: StyleTokenValues | null,
159
+ resolver: TokenValueResolver,
174
160
  ) {
175
161
  const scopes: ScopeTargetData[] = [];
176
162
  const tokens = createMutableTokenValues(prevTokensData);
@@ -179,12 +165,12 @@ function collectItems(
179
165
  for (let i = 0, len = items.length; i < len; i++) {
180
166
  const item = items[i];
181
167
 
182
- if (addTokenOverride(tokens, item)) continue;
168
+ if (addTokenOverride(tokens, item, resolver)) continue;
183
169
 
184
170
  if (isScopeTargetData(item)) {
185
171
  scopes.push(item);
186
172
  currentNode = currentNode ? walkScope(currentNode, item) : null;
187
- addTokenValues(tokens, getScopeTokenValues(currentNode, getScopeTargetScope(item)));
173
+ addTokenValues(tokens, getScopeTokenValues(currentNode, getScopeTargetScope(item), resolver));
188
174
  }
189
175
  }
190
176
 
@@ -232,10 +218,9 @@ function walkScope(
232
218
  function getScopeTokenValues(
233
219
  node: PoolNode | null,
234
220
  scope: ScopeData,
221
+ resolver: TokenValueResolver,
235
222
  ) {
236
- const tokenNameFormat = CSS_CONFIG.tokenNameFormat;
237
-
238
- if (node && node.value.h && node.value.f === tokenNameFormat) {
223
+ if (node && node.value.h && node.value.f === resolver.key) {
239
224
  return node.value.s;
240
225
  }
241
226
 
@@ -243,7 +228,7 @@ function getScopeTokenValues(
243
228
  const items = scope[BUILDER_STATE].items;
244
229
 
245
230
  for (let i = 0, len = items.length; i < len; i++) {
246
- addTokenOverride(values, items[i]);
231
+ addTokenOverride(values, items[i], resolver);
247
232
  }
248
233
 
249
234
  const tokens = finishTokenValues(null, values);
@@ -251,7 +236,7 @@ function getScopeTokenValues(
251
236
  if (node) {
252
237
  node.value.h = true;
253
238
  node.value.s = tokens;
254
- node.value.f = tokenNameFormat;
239
+ node.value.f = resolver.key;
255
240
  }
256
241
 
257
242
  return tokens;
@@ -24,6 +24,7 @@ import {
24
24
  } from './item';
25
25
  import { getStylePropCacheValue } from './propCache';
26
26
  import { createStylePropResult, emptyStylePropResult, type ResolvedStyleProp } from './result';
27
+ import { runtimeTokenValueResolver } from './token';
27
28
  import { mergeTokenOverrides, mergeTokenValues, type StyleTokenValues } from './tokenValues';
28
29
  import { walkRecursiveItems } from './utils/walk';
29
30
 
@@ -197,7 +198,7 @@ function normalizeStylePropItem(
197
198
  const bound = getExtractedTokenBoundData(item);
198
199
  if (stableTokenBound) return normalizeStylePropItem(bound.data, true);
199
200
 
200
- const tokens = mergeTokenOverrides(null, bound.tokens);
201
+ const tokens = mergeTokenOverrides(null, bound.tokens, runtimeTokenValueResolver);
201
202
 
202
203
  if (isStyleData(bound.data) || isSlotData(bound.data)) {
203
204
  return createResolvedStyleItem(bound.data, [], tokens);
@@ -224,7 +225,7 @@ function getStylePropCacheKey(
224
225
  if (RUNTIME_CONFIG.isHoist && isExtractedTokenBoundData(item)) {
225
226
  const bound = getExtractedTokenBoundData(item);
226
227
  const key = getStylePropCacheKey(bound.data, tokenBindings);
227
- const tokens = mergeTokenOverrides(null, bound.tokens);
228
+ const tokens = mergeTokenOverrides(null, bound.tokens, runtimeTokenValueResolver);
228
229
 
229
230
  if (key && tokens) {
230
231
  tokenBindings.push({ data: key, tokens });
@@ -0,0 +1,20 @@
1
+ import { getTokenOverrideValue } from '../../../atomic/token';
2
+ import { CSS_CONFIG } from '../../../config/config/css';
3
+ import { getStyleTokenId, isStyleTokenOverrideData } from '../../../style/token';
4
+ import type { TokenValueResolver } from './tokenValues';
5
+
6
+ export const runtimeTokenValueResolver: TokenValueResolver = {
7
+ get key() {
8
+ return CSS_CONFIG.tokenNameFormat;
9
+ },
10
+
11
+ is: isStyleTokenOverrideData,
12
+
13
+ id(token) {
14
+ return getStyleTokenId(token);
15
+ },
16
+
17
+ value(token) {
18
+ return getTokenOverrideValue(token, CSS_CONFIG.tokenNameFormat ?? null);
19
+ },
20
+ };
@@ -1,6 +1,4 @@
1
- import { getTokenOverrideValue } from '../../../atomic/token';
2
- import { CSS_CONFIG } from '../../../config/config/css';
3
- import { getStyleTokenId, isStyleTokenOverrideData, type StyleTokenOverride } from '../../../style/token';
1
+ import type { StyleTokenOverride } from '../../../style/token';
4
2
  import { hasOwn } from '../../../utils/object';
5
3
 
6
4
  export type StyleTokenValues = {
@@ -16,6 +14,13 @@ export type MutableTokenValues = {
16
14
  index: Record<string, number> | null;
17
15
  };
18
16
 
17
+ export type TokenValueResolver = {
18
+ key: unknown;
19
+ is(item: unknown): item is StyleTokenOverride;
20
+ id(token: StyleTokenOverride): string;
21
+ value(token: StyleTokenOverride): unknown;
22
+ };
23
+
19
24
  export function createMutableTokenValues(base: StyleTokenValues | null): MutableTokenValues {
20
25
  return {
21
26
  ids: base ? base.ids.slice() : null,
@@ -25,13 +30,14 @@ export function createMutableTokenValues(base: StyleTokenValues | null): Mutable
25
30
  };
26
31
  }
27
32
 
28
- export function addTokenOverride(values: MutableTokenValues, item: unknown) {
29
- if (!isStyleTokenOverrideData(item)) return false;
30
-
31
- const id = getStyleTokenId(item);
32
- const value = getTokenOverrideValue(item, CSS_CONFIG.tokenNameFormat ?? null);
33
+ export function addTokenOverride(
34
+ values: MutableTokenValues,
35
+ item: unknown,
36
+ resolver: TokenValueResolver,
37
+ ) {
38
+ if (!resolver.is(item)) return false;
33
39
 
34
- addTokenValue(values, id, value);
40
+ addTokenValue(values, resolver.id(item), resolver.value(item));
35
41
  return true;
36
42
  }
37
43
 
@@ -75,9 +81,10 @@ export function addTokenValues(
75
81
  export function addTokenOverrides(
76
82
  values: MutableTokenValues,
77
83
  overrides: readonly StyleTokenOverride[],
84
+ resolver: TokenValueResolver,
78
85
  ) {
79
86
  for (let i = 0, len = overrides.length; i < len; i++) {
80
- addTokenOverride(values, overrides[i]);
87
+ addTokenOverride(values, overrides[i], resolver);
81
88
  }
82
89
  }
83
90
 
@@ -112,12 +119,13 @@ export function mergeTokenValues(
112
119
  export function mergeTokenOverrides(
113
120
  base: StyleTokenValues | null,
114
121
  overrides: readonly StyleTokenOverride[],
122
+ resolver: TokenValueResolver,
115
123
  ): StyleTokenValues | null {
116
124
  if (!overrides.length) return base;
117
125
 
118
126
  const values = createMutableTokenValues(base);
119
127
 
120
- addTokenOverrides(values, overrides);
128
+ addTokenOverrides(values, overrides, resolver);
121
129
 
122
130
  return finishTokenValues(base, values);
123
131
  }
@@ -0,0 +1,37 @@
1
+ import { type CombinedStyleArg, createCombinedStyleGetter } from '../core/cache/combine';
2
+ import type { CombinedStyle } from '../core/combinedStyle';
3
+ import { extractedTokenValueResolver } from './tokenResolver';
4
+
5
+ export type StyleCombiner<T extends object> = (
6
+ ...args: CombinedStyleArg<T>[]
7
+ ) => CombinedStyle<T>;
8
+
9
+ export type CombinedStyleFor<T extends object | StyleCombiner<any>> = CombinedStyleArg<InferStyleCombinerStyles<T>>;
10
+
11
+ type InferStyleCombinerStyles<T extends object | StyleCombiner<any>> = T extends StyleCombiner<infer Styles> ? Styles
12
+ : T extends object ? T
13
+ : never;
14
+
15
+ type CombineStyleFn = <T extends object>(
16
+ styles: T,
17
+ ...args: CombinedStyleArg<T>[]
18
+ ) => CombinedStyle<T>;
19
+
20
+ type CombineStyle = CombineStyleFn & {
21
+ for<T extends object>(styles: T): StyleCombiner<T>;
22
+ };
23
+
24
+ const combineStyleBase = <T extends object>(
25
+ styles: T,
26
+ ...args: CombinedStyleArg<T>[]
27
+ ): CombinedStyle<T> => getExtractedCombinedStyle(styles, args);
28
+
29
+ const combineStyleFor = <T extends object>(styles: T): StyleCombiner<T> => {
30
+ return (...args: CombinedStyleArg<T>[]) => combineStyleBase(styles, ...args);
31
+ };
32
+
33
+ export const combineStyle = Object.assign(combineStyleBase, {
34
+ for: combineStyleFor,
35
+ }) as CombineStyle;
36
+
37
+ const getExtractedCombinedStyle = createCombinedStyleGetter(extractedTokenValueResolver);
@@ -1,4 +1,3 @@
1
- import { getTokenVar as getAtomicTokenVar, getTokenVarName as getAtomicTokenVarName } from '../../atomic/token';
2
1
  import {
3
2
  BUILDER_STATE,
4
3
  BUILDER_TYPE,
@@ -12,20 +11,15 @@ import {
12
11
  } from '../../builder/data/const';
13
12
  import type { StateItem } from '../../builder/data/state';
14
13
  import { getExtractedTokenBoundData, isExtractedTokenBoundData } from '../../builder/extract/withTokens';
15
- import { CSS_CONFIG } from '../../config/config/css';
14
+ import { getStyleTokenId, isStyleTokenData, isStyleTokenOverrideData } from '../../builder/token/data';
16
15
  import { RUNTIME_CONFIG } from '../../config/config/runtime';
17
- import {
18
- getStyleTokenId,
19
- isStyleTokenData,
20
- isStyleTokenOverrideData,
21
- type StyleTokenData,
22
- type StyleTokenOverride,
23
- } from '../../style/token';
16
+ import type { StyleTokenData, StyleTokenOverride } from '../../style/token';
24
17
  import { getStylePropCacheValue } from '../core/cache/propCache';
25
18
  import { getResolvedStyleItemTokenValues, isResolvedStyleItem } from '../core/cache/resolvedItem';
26
19
  import { walkRecursiveItems } from '../core/cache/utils/walk';
27
20
  import { type ClassNameProps, type ClassNameResult, mergeClassName, mergeStyle } from '../core/className';
28
21
  import type { StyleProp } from '../types';
22
+ import { getExtractedTokenVar, getExtractedTokenVarName } from './token';
29
23
 
30
24
  type TokenValues = Record<string, unknown> | null;
31
25
 
@@ -453,11 +447,11 @@ function mergeResolvedTokenValues(
453
447
  }
454
448
 
455
449
  function getTokenVarName(token: StyleTokenData | StyleTokenOverride) {
456
- return getAtomicTokenVarName(token, CSS_CONFIG.tokenNameFormat ?? null);
450
+ return getExtractedTokenVarName(token);
457
451
  }
458
452
 
459
453
  function getTokenVar(token: StyleTokenData): string {
460
- return getAtomicTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null);
454
+ return getExtractedTokenVar(token);
461
455
  }
462
456
 
463
457
  function setStyleValue(
@@ -1,4 +1,6 @@
1
1
  export type { CombinedStyle } from '../core/combinedStyle';
2
- export { bindScope, type CombinedStyleFor, combineScope, combineStyle, getToken } from '../style';
2
+ export { bindScope, combineScope } from '../style/scope';
3
3
  export type { StyleProp, StyleTheme, StyleTokenInput, TokenTheme } from '../types';
4
+ export { type CombinedStyleFor, combineStyle } from './combineStyle';
4
5
  export { type ClassNameProps, type ClassNameResult, getClassName, mergeClassName, mergeStyle } from './getClassName';
6
+ export { getToken } from './token';
@@ -0,0 +1,41 @@
1
+ import { getCssVar, getCssVarRawFallback } from '../../atomic/utils/cssVar';
2
+ import { getStyleTokenId, getStyleTokenVarName, isStyleTokenData } from '../../builder/token/data';
3
+ import type { StyleTokenData, StyleTokenOverride } from '../../style/token';
4
+
5
+ export function getToken(value: unknown): unknown {
6
+ if (isStyleTokenData(value)) {
7
+ return getExtractedTokenVar(value);
8
+ }
9
+
10
+ return value;
11
+ }
12
+
13
+ export function getExtractedTokenVarName(
14
+ token: StyleTokenData | StyleTokenOverride,
15
+ ) {
16
+ const varName = getStyleTokenVarName(token);
17
+ if (varName) return varName;
18
+
19
+ throw new Error(`Missing extracted token var name for token "${getStyleTokenId(token)}"`);
20
+ }
21
+
22
+ export function getExtractedTokenVar(token: StyleTokenData): string {
23
+ return getExtractedTokenVarFallback(token);
24
+ }
25
+
26
+ export function getExtractedTokenOverrideValue(token: StyleTokenOverride) {
27
+ return token.ref ? getExtractedTokenVar(token.ref) : token.value;
28
+ }
29
+
30
+ function getExtractedTokenVarFallback(token: StyleTokenData): string {
31
+ const varName = getExtractedTokenVarName(token);
32
+
33
+ if (token.ref) {
34
+ return getCssVarRawFallback(
35
+ varName,
36
+ getExtractedTokenVarFallback(token.ref),
37
+ );
38
+ }
39
+
40
+ return getCssVar(varName, String(token.value ?? ''));
41
+ }
@@ -0,0 +1,17 @@
1
+ import { getStyleTokenId, isStyleTokenOverrideData } from '../../builder/token/data';
2
+ import type { TokenValueResolver } from '../core/cache/tokenValues';
3
+ import { getExtractedTokenOverrideValue } from './token';
4
+
5
+ export const extractedTokenValueResolver: TokenValueResolver = {
6
+ key: null,
7
+
8
+ is: isStyleTokenOverrideData,
9
+
10
+ id(token) {
11
+ return getStyleTokenId(token);
12
+ },
13
+
14
+ value(token) {
15
+ return getExtractedTokenOverrideValue(token);
16
+ },
17
+ };
@@ -1,4 +1,5 @@
1
- import { type CombinedStyleArg, getCombinedStyle } from '../core/cache/combine';
1
+ import type { CombinedStyleArg } from '../core/cache/combine';
2
+ import { getCombinedStyle } from '../core/cache/combineRuntime';
2
3
  import type { CombinedStyle } from '../core/combinedStyle';
3
4
 
4
5
  export type StyleCombiner<T extends object> = (
package/style/style.ts CHANGED
@@ -6,7 +6,7 @@ import { createDefaultFnResult } from '../builder/style_fns';
6
6
  import type { typeAliases } from '../builder/types/alias';
7
7
  import type { StableIdInput } from '../css/utils';
8
8
  import { PrioritySelectors } from '../selector/presets';
9
- import { symbol } from '../utils/global';
9
+ import { symbol } from '../utils/symbol';
10
10
  import { type } from '../utils/type';
11
11
  import type { Type } from '../utils/type';
12
12
  import { createStyleKeyframes } from './keyframes';
package/style/theme.ts CHANGED
@@ -16,7 +16,6 @@ export function resetStyleThemeIdCounter() {
16
16
 
17
17
  export function createTheme(
18
18
  tokens: readonly StyleTokenOverride[],
19
- stableId?: StableId | string,
20
19
  ): TokenTheme;
21
20
  export function createTheme(
22
21
  tokens: readonly StyleTokenOverride[],