@fluentic/style 0.1.0-beta.0 → 0.1.0-beta.10

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 (494) hide show
  1. package/CHANGELOG.md +154 -0
  2. package/README.md +181 -49
  3. package/atomic/atRule/utils.ts +3 -2
  4. package/atomic/className.ts +50 -12
  5. package/atomic/debug/className/className.ts +24 -8
  6. package/atomic/element.ts +5 -2
  7. package/atomic/rule.ts +11 -5
  8. package/atomic/scope.ts +19 -0
  9. package/atomic/theme.ts +44 -3
  10. package/atomic/token.ts +7 -4
  11. package/atomic/utils/cssIdent.ts +54 -0
  12. package/atomic/utils/cssVar.ts +19 -0
  13. package/atomic/utils/debug.ts +1 -1
  14. package/atomic/utils/format.ts +1 -1
  15. package/atomic/utils/hash.ts +14 -0
  16. package/atomic/utils/selector.ts +31 -1
  17. package/atomic/var.ts +3 -2
  18. package/builder/classname/class_name_builder.ts +491 -0
  19. package/builder/classname/fns.ts +77 -0
  20. package/builder/classname/index.ts +3 -0
  21. package/builder/classname/types.ts +41 -0
  22. package/builder/data/const.ts +8 -1
  23. package/builder/data/create.ts +52 -6
  24. package/builder/data/data.ts +33 -8
  25. package/builder/data/debug.ts +1 -0
  26. package/builder/data/index.ts +0 -1
  27. package/builder/data/is.ts +26 -3
  28. package/builder/data/merge/scope.ts +38 -38
  29. package/builder/data/merge/style.ts +115 -20
  30. package/builder/data/state.ts +17 -2
  31. package/builder/extract/index.ts +1 -0
  32. package/builder/extract/sheet.ts +30 -0
  33. package/builder/extract/token.ts +30 -14
  34. package/builder/extract/utils.ts +2 -0
  35. package/builder/extract/withTokens.ts +2 -1
  36. package/builder/selector_override.noop.ts +11 -0
  37. package/builder/selector_override.ts +31 -0
  38. package/builder/selector_override_core.ts +79 -0
  39. package/builder/style_builder.ts +144 -20
  40. package/builder/style_data.ts +25 -0
  41. package/builder/style_fns.ts +57 -57
  42. package/builder/token/data.ts +30 -0
  43. package/builder/token/index.ts +3 -0
  44. package/builder/token/name.ts +54 -0
  45. package/builder/token/symbols.ts +6 -0
  46. package/builder/types/alias.ts +44 -16
  47. package/builder/types/fns.ts +24 -16
  48. package/builder/types/types.ts +37 -7
  49. package/builder/utils.ts +1 -0
  50. package/compiler/compiler/compiler.ts +88 -14
  51. package/compiler/compiler/constants.ts +6 -0
  52. package/compiler/compiler/index.ts +1 -0
  53. package/compiler/compiler/types.ts +4 -1
  54. package/compiler/cssProp.ts +21 -0
  55. package/compiler/extract/extract.ts +42 -14
  56. package/compiler/extract/types.ts +2 -0
  57. package/compiler/index.ts +1 -0
  58. package/compiler/transform/cssProp/index.ts +1 -0
  59. package/compiler/transform/cssProp/plugin.ts +161 -0
  60. package/compiler/transform/debug/plugin.ts +93 -4
  61. package/compiler/transform/debug/transform.ts +2 -1
  62. package/compiler/transform/debug/utils/debug_data.ts +73 -0
  63. package/compiler/transform/evaluator/evaluator.ts +173 -32
  64. package/compiler/transform/evaluator/tracer.ts +48 -11
  65. package/compiler/transform/extract/chain/chain.ts +1370 -162
  66. package/compiler/transform/extract/chain/extract_chain.ts +12 -4
  67. package/compiler/transform/extract/chain/types.ts +3 -1
  68. package/compiler/transform/extract/plugin.ts +64 -6
  69. package/compiler/transform/extract/transform.ts +2 -1
  70. package/compiler/transform/extract/utils/replacement.ts +72 -2
  71. package/compiler/transform/extract/utils/state.ts +3 -0
  72. package/compiler/transform/extract/utils/theme.ts +6 -6
  73. package/compiler/transform/index.ts +1 -0
  74. package/compiler/transform/syntax/isStaticStyleValue.ts +15 -9
  75. package/compiler/transform/syntax/static_ids.ts +1 -1
  76. package/compiler/utils/constants.ts +12 -5
  77. package/compiler/utils/file_resolver.ts +2 -0
  78. package/compiler/utils/import_source.ts +19 -8
  79. package/compiler/utils/imports.ts +11 -1
  80. package/config/build.ts +9 -2
  81. package/config/config/check.ts +25 -0
  82. package/config/config/css.ts +18 -1
  83. package/config/config/debug.ts +24 -1
  84. package/config/config/dev.ts +17 -1
  85. package/config/configure.ts +19 -2
  86. package/config/types.ts +7 -0
  87. package/css/index.ts +2 -0
  88. package/css/sheet.ts +152 -0
  89. package/css/styleTarget.ts +251 -0
  90. package/dev/config.ts +2 -3
  91. package/dev/utils.ts +3 -3
  92. package/dialect/extracted/index.ts +5 -0
  93. package/dialect/index.ts +1 -0
  94. package/dialect/namedTokens.ts +153 -0
  95. package/dist/adapter/preact.js +2 -0
  96. package/dist/adapter/react.js +2 -0
  97. package/dist/adapter/solid.js +2 -0
  98. package/dist/className-yhJCGT0F.js +304 -0
  99. package/dist/className-yhJCGT0F.js.map +1 -0
  100. package/dist/combine-Bww7VnSr.js +1254 -0
  101. package/dist/combine-Bww7VnSr.js.map +1 -0
  102. package/dist/compiler/index.mjs +2 -2
  103. package/dist/{compiler-DweanHoB.mjs → compiler-C3CEGGtI.mjs} +2349 -647
  104. package/dist/compiler-C3CEGGtI.mjs.map +1 -0
  105. package/dist/config/index.js +2 -2
  106. package/dist/config-BAEzRmSJ.js +6 -0
  107. package/dist/{config-Di2VYYKV.js.map → config-BAEzRmSJ.js.map} +1 -1
  108. package/dist/config-BKP5LOkt.js +35 -0
  109. package/dist/config-BKP5LOkt.js.map +1 -0
  110. package/dist/config-C5VWvTav.js +34 -0
  111. package/dist/config-C5VWvTav.js.map +1 -0
  112. package/dist/config-CB4lm2tM.js +1 -0
  113. package/dist/config-CDjbHwb-.js +6 -0
  114. package/dist/config-CDjbHwb-.js.map +1 -0
  115. package/dist/config-DNEnHEf3.js +36 -0
  116. package/dist/config-DNEnHEf3.js.map +1 -0
  117. package/dist/createTransformElement-D8fXZ3wA.js +34 -0
  118. package/dist/createTransformElement-D8fXZ3wA.js.map +1 -0
  119. package/dist/css-BDn0epJ8.js +1339 -0
  120. package/dist/css-BDn0epJ8.js.map +1 -0
  121. package/dist/css-CFxNrYt3.js +4040 -0
  122. package/dist/css-CFxNrYt3.js.map +1 -0
  123. package/dist/css-DEYgrj76.js +524 -0
  124. package/dist/css-DEYgrj76.js.map +1 -0
  125. package/dist/{runtime-CYqNCiaM.js → css-DWBWsyxZ.js} +16 -19
  126. package/dist/css-DWBWsyxZ.js.map +1 -0
  127. package/dist/css.js +2 -2
  128. package/dist/{css_extra-oIi3UEPK.js → css_extra-nTq_Gw0E.js} +2 -2
  129. package/dist/{css_extra-DlOnsnR1.js.map → css_extra-nTq_Gw0E.js.map} +1 -1
  130. package/dist/data-CDrS1Bq4.js +785 -0
  131. package/dist/data-CDrS1Bq4.js.map +1 -0
  132. package/dist/debug-BkVbf0Cz.js +52 -0
  133. package/dist/debug-BkVbf0Cz.js.map +1 -0
  134. package/dist/{debug-n2aZQBSa.js → debug-YuhEIQVO.js} +80 -4
  135. package/dist/debug-YuhEIQVO.js.map +1 -0
  136. package/dist/dev/rsc.js +10 -9
  137. package/dist/dev/rsc.js.map +1 -1
  138. package/dist/{dev-CcphAa3R.js → dev-0imWmSVb.js} +10 -10
  139. package/dist/dev-0imWmSVb.js.map +1 -0
  140. package/dist/dev.js +1 -1
  141. package/dist/dialect/extracted/index.js +2 -0
  142. package/dist/dialect/index.js +2 -0
  143. package/dist/{elementMarker-Bu7gDAkE.js → elementMarker-kvpMjB49.js} +164 -30
  144. package/dist/elementMarker-kvpMjB49.js.map +1 -0
  145. package/dist/entry/dev/adapter/preact.js +12 -0
  146. package/dist/entry/dev/adapter/preact.js.map +1 -0
  147. package/dist/entry/dev/adapter/react.js +12 -0
  148. package/dist/entry/dev/adapter/react.js.map +1 -0
  149. package/dist/entry/dev/adapter/solid.js +12 -0
  150. package/dist/entry/dev/adapter/solid.js.map +1 -0
  151. package/dist/entry/dev/css.js +3 -3
  152. package/dist/entry/dev/jsx-dev-runtime.js +2 -1
  153. package/dist/entry/dev/jsx-runtime.js +2 -1
  154. package/dist/entry/dev.js +13 -9
  155. package/dist/entry/prod/adapter/preact.js +12 -0
  156. package/dist/entry/prod/adapter/preact.js.map +1 -0
  157. package/dist/entry/prod/adapter/react.js +12 -0
  158. package/dist/entry/prod/adapter/react.js.map +1 -0
  159. package/dist/entry/prod/adapter/solid.js +12 -0
  160. package/dist/entry/prod/adapter/solid.js.map +1 -0
  161. package/dist/entry/prod/css.js +3 -3
  162. package/dist/entry/prod/extract.js +242 -3
  163. package/dist/entry/prod/extract.js.map +1 -0
  164. package/dist/entry/prod/jsx-dev-runtime.js +2 -2
  165. package/dist/entry/prod/jsx-runtime.js +2 -2
  166. package/dist/entry/prod/runtime.js +3 -4
  167. package/dist/entry/prod.js +84 -1201
  168. package/dist/entry/prod.js.map +1 -1
  169. package/dist/entry/rsc-dev/adapter/preact.js +13 -0
  170. package/dist/entry/rsc-dev/adapter/preact.js.map +1 -0
  171. package/dist/entry/rsc-dev/adapter/react.js +13 -0
  172. package/dist/entry/rsc-dev/adapter/react.js.map +1 -0
  173. package/dist/entry/rsc-dev/adapter/solid.js +13 -0
  174. package/dist/entry/rsc-dev/adapter/solid.js.map +1 -0
  175. package/dist/entry/rsc-dev/css.js +3 -3
  176. package/dist/entry/rsc-dev/dev.js +11 -13
  177. package/dist/entry/rsc-dev/dev.js.map +1 -1
  178. package/dist/entry/rsc-dev/jsx-dev-runtime.js +2 -2
  179. package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
  180. package/dist/entry/rsc-dev.js +634 -713
  181. package/dist/entry/rsc-dev.js.map +1 -1
  182. package/dist/entry/rsc-prod/adapter/preact.js +2 -0
  183. package/dist/entry/rsc-prod/adapter/react.js +2 -0
  184. package/dist/entry/rsc-prod/adapter/solid.js +2 -0
  185. package/dist/entry/rsc-prod/css.js +9 -3
  186. package/dist/entry/rsc-prod/css.js.map +1 -0
  187. package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
  188. package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
  189. package/dist/entry/rsc-prod/runtime.js +3 -4
  190. package/dist/entry/rsc-prod.js +242 -10
  191. package/dist/entry/rsc-prod.js.map +1 -0
  192. package/dist/{styleStore-Dea_WVbr.js → env-Cz8frh6e.js} +1335 -372
  193. package/dist/env-Cz8frh6e.js.map +1 -0
  194. package/dist/getClassName-9CsXbNls.js +545 -0
  195. package/dist/getClassName-9CsXbNls.js.map +1 -0
  196. package/dist/{utils-D7FAOyg6.js → getClassName-DGm-VNDo.js} +28 -65
  197. package/dist/getClassName-DGm-VNDo.js.map +1 -0
  198. package/dist/getClassName-Dtc4yyYI.js +47 -0
  199. package/dist/getClassName-Dtc4yyYI.js.map +1 -0
  200. package/dist/{getClassName-BlvXHYuf.js → getClassName-DtkplEIt.js} +56 -14
  201. package/dist/getClassName-DtkplEIt.js.map +1 -0
  202. package/dist/global-CAc9OjKx.js +14 -0
  203. package/dist/global-CAc9OjKx.js.map +1 -0
  204. package/dist/{format-3nKBE_5t.js → hash-Cr-LCWDt.js} +51 -29
  205. package/dist/hash-Cr-LCWDt.js.map +1 -0
  206. package/dist/index.js +10 -8
  207. package/dist/jsx/jsx-dev-runtime.js +2 -2
  208. package/dist/jsx/jsx-dev-runtime.server.js +1 -1
  209. package/dist/jsx/jsx-runtime.js +2 -2
  210. package/dist/jsx/jsx-runtime.server.js +1 -1
  211. package/dist/jsx-CVxpkS04.js +39 -0
  212. package/dist/jsx-CVxpkS04.js.map +1 -0
  213. package/dist/{jsx_dev_runtime-B6xs4by8.js → jsx_dev_runtime-D068tAsT.js} +2 -3
  214. package/dist/{jsx_dev_runtime-B6xs4by8.js.map → jsx_dev_runtime-D068tAsT.js.map} +1 -1
  215. package/dist/{jsx_runtime-iHLDwpcW.js → jsx_runtime-6Qa1lmz2.js} +2 -2
  216. package/dist/{jsx_runtime-iHLDwpcW.js.map → jsx_runtime-6Qa1lmz2.js.map} +1 -1
  217. package/dist/{jsx_runtime-04xfnsi7.js → jsx_runtime-DT1Tr9cH.js} +2 -3
  218. package/dist/{jsx_runtime-04xfnsi7.js.map → jsx_runtime-DT1Tr9cH.js.map} +1 -1
  219. package/dist/{loader-DS61nRqr.mjs → loader-_-VjzlrX.mjs} +13 -14
  220. package/dist/loader-_-VjzlrX.mjs.map +1 -0
  221. package/dist/{misc-B9kqEb2N.mjs → misc-B76PUnWe.mjs} +11 -6
  222. package/dist/misc-B76PUnWe.mjs.map +1 -0
  223. package/dist/namedTokens-5AayGokX.js +85 -0
  224. package/dist/namedTokens-5AayGokX.js.map +1 -0
  225. package/dist/plugin/farm/index.mjs +4 -3
  226. package/dist/plugin/farm/index.mjs.map +1 -1
  227. package/dist/plugin/nextjs/index.mjs +121 -17
  228. package/dist/plugin/nextjs/index.mjs.map +1 -1
  229. package/dist/plugin/nextjs/loader.mjs +4 -4
  230. package/dist/plugin/parcel/index.cjs +2 -0
  231. package/dist/plugin/parcel/index.mjs +3 -1
  232. package/dist/plugin/parcel/optimizer.cjs +3 -2
  233. package/dist/plugin/parcel/optimizer.cjs.map +1 -1
  234. package/dist/plugin/parcel/optimizer.mjs +3 -2
  235. package/dist/plugin/parcel/optimizer.mjs.map +1 -1
  236. package/dist/plugin/parcel/resolver.cjs +1 -1
  237. package/dist/plugin/parcel/resolver.mjs +2 -2
  238. package/dist/plugin/parcel/runtime.cjs +1 -1
  239. package/dist/plugin/parcel/runtime.mjs +1 -1
  240. package/dist/plugin/parcel/transformer.cjs +1 -1
  241. package/dist/plugin/parcel/transformer.mjs +2 -2
  242. package/dist/plugin/rspack/index.mjs +3 -2
  243. package/dist/plugin/rspack/index.mjs.map +1 -1
  244. package/dist/plugin/vite/index.mjs +13 -10
  245. package/dist/plugin/vite/index.mjs.map +1 -1
  246. package/dist/plugin/webpack/index.mjs +3 -2
  247. package/dist/plugin/webpack/loader.mjs +2 -2
  248. package/dist/presets/tailwind/index.js +995 -0
  249. package/dist/presets/tailwind/index.js.map +1 -0
  250. package/dist/presets-DSanixJV.js +243 -0
  251. package/dist/presets-DSanixJV.js.map +1 -0
  252. package/dist/{registry-CyIj8LYK.mjs → registry-w8ET5R7v.mjs} +2 -2
  253. package/dist/{registry-CyIj8LYK.mjs.map → registry-w8ET5R7v.mjs.map} +1 -1
  254. package/dist/resolveClassNameRuntime-CJjlUP93.js +63 -0
  255. package/dist/resolveClassNameRuntime-CJjlUP93.js.map +1 -0
  256. package/dist/{rules-9HSO1pxL.js → rules-DaMaMHgb.js} +618 -138
  257. package/dist/rules-DaMaMHgb.js.map +1 -0
  258. package/dist/scope-CZdGAnl_.js +601 -0
  259. package/dist/scope-CZdGAnl_.js.map +1 -0
  260. package/dist/selector/index.js +2 -3
  261. package/dist/server.js +17 -11
  262. package/dist/server.js.map +1 -1
  263. package/dist/{shared-CCpq1zqA.mjs → shared-C_cYxNzz.mjs} +4 -4
  264. package/dist/{shared-CCpq1zqA.mjs.map → shared-C_cYxNzz.mjs.map} +1 -1
  265. package/dist/{shared-BAL9peIw.cjs → shared-PK52rW6T.cjs} +2352 -644
  266. package/dist/shared-PK52rW6T.cjs.map +1 -0
  267. package/dist/sheet-CxkO1Hwt.js +7 -0
  268. package/dist/sheet-CxkO1Hwt.js.map +1 -0
  269. package/dist/{sidecar-4u6GnlQG.mjs → sidecar-BhvmXYsD.mjs} +3 -3
  270. package/dist/{sidecar-4u6GnlQG.mjs.map → sidecar-BhvmXYsD.mjs.map} +1 -1
  271. package/dist/style-CAhAnRni.js +1129 -0
  272. package/dist/style-CAhAnRni.js.map +1 -0
  273. package/dist/{styleStore-DyNXBcUK.js → styleStore-BzLZwpwy.js} +8 -7
  274. package/dist/styleStore-BzLZwpwy.js.map +1 -0
  275. package/dist/styleStore-DaIJ4OPV.js +58 -0
  276. package/dist/styleStore-DaIJ4OPV.js.map +1 -0
  277. package/dist/token-D33mKTka.js +138 -0
  278. package/dist/token-D33mKTka.js.map +1 -0
  279. package/dist/{trace-Bu_qOqRy.js → trace-B3dpTRJp.js} +3 -3
  280. package/dist/{trace-Bu_qOqRy.js.map → trace-B3dpTRJp.js.map} +1 -1
  281. package/dist/{trace-CU0rvNYr.js → trace-c2WmBbmX.js} +2 -2
  282. package/dist/{trace-CU0rvNYr.js.map → trace-c2WmBbmX.js.map} +1 -1
  283. package/dist/transform-DSpimwwC.js +23 -0
  284. package/dist/transform-DSpimwwC.js.map +1 -0
  285. package/dist/{utils-DMFgOOtA.mjs → utils-DND33M6y.mjs} +3 -3
  286. package/dist/{utils-DMFgOOtA.mjs.map → utils-DND33M6y.mjs.map} +1 -1
  287. package/dist/utils-DZK0mfmY.js +42 -0
  288. package/dist/utils-DZK0mfmY.js.map +1 -0
  289. package/dist/utils-D_XgtMtn.js +72 -0
  290. package/dist/utils-D_XgtMtn.js.map +1 -0
  291. package/dist/utils-DxCpyV2E.js +62 -0
  292. package/dist/utils-DxCpyV2E.js.map +1 -0
  293. package/dist/{utils-BbehLOby.js → utils-H1VInWpd.js} +407 -234
  294. package/dist/utils-H1VInWpd.js.map +1 -0
  295. package/dist/utils-NdisireF.mjs +182 -0
  296. package/dist/utils-NdisireF.mjs.map +1 -0
  297. package/dist/utils.js +4 -4
  298. package/dist/utils.js.map +1 -1
  299. package/dist/value-CK0-Xbov.js +160 -0
  300. package/dist/value-CK0-Xbov.js.map +1 -0
  301. package/dist/{webpack-CxS2FDYU.mjs → webpack-D7QO0bKN.mjs} +5 -5
  302. package/dist/webpack-D7QO0bKN.mjs.map +1 -0
  303. package/entry/dev/adapter/preact.ts +8 -0
  304. package/entry/dev/adapter/react.ts +8 -0
  305. package/entry/dev/adapter/solid.ts +8 -0
  306. package/entry/dev/config.ts +1 -1
  307. package/entry/dev/index.ts +1 -0
  308. package/entry/dev/jsx_dev_runtime.ts +1 -0
  309. package/entry/dev/jsx_runtime.ts +1 -0
  310. package/entry/dev/sheet.ts +4 -0
  311. package/entry/prod/adapter/preact.ts +8 -0
  312. package/entry/prod/adapter/react.ts +8 -0
  313. package/entry/prod/adapter/solid.ts +8 -0
  314. package/entry/prod/config_debug.ts +2 -0
  315. package/entry/prod/index.ts +1 -1
  316. package/entry/prod/runtime.ts +4 -2
  317. package/entry/rsc_dev/adapter/preact.ts +9 -0
  318. package/entry/rsc_dev/adapter/react.ts +9 -0
  319. package/entry/rsc_dev/adapter/solid.ts +9 -0
  320. package/entry/rsc_dev/config.ts +1 -1
  321. package/entry/rsc_dev/server.ts +1 -1
  322. package/entry/rsc_prod/adapter/preact.ts +1 -0
  323. package/entry/rsc_prod/adapter/react.ts +1 -0
  324. package/entry/rsc_prod/adapter/solid.ts +1 -0
  325. package/entry/rsc_prod/config_debug.ts +6 -0
  326. package/entry/rsc_prod/index.ts +1 -1
  327. package/entry/rsc_prod/runtime.ts +1 -1
  328. package/entry/rsc_prod/server.ts +1 -1
  329. package/entry/shared/config_debug.ts +9 -0
  330. package/entry/shared/config_dev.ts +14 -0
  331. package/entry/shared/dev.ts +11 -2
  332. package/entry/shared/utils.ts +28 -0
  333. package/jsx/types/index.ts +1 -0
  334. package/jsx/types/preact.ts +14 -0
  335. package/jsx/{types.ts → types/react.ts} +2 -2
  336. package/jsx/types/solid.ts +32 -0
  337. package/package.json +118 -18
  338. package/plugin/bundler/farm/plugin.ts +2 -0
  339. package/plugin/bundler/parcel/optimizer.ts +1 -0
  340. package/plugin/bundler/parcel/plugin.ts +2 -0
  341. package/plugin/bundler/rspack/plugin.ts +1 -0
  342. package/plugin/bundler/vite/plugin.ts +5 -9
  343. package/plugin/bundler/vite/state.ts +12 -7
  344. package/plugin/bundler/webpack/plugin.ts +2 -1
  345. package/plugin/bundler/webpack/shared/loader.ts +9 -7
  346. package/plugin/nextjs/plugin.ts +208 -15
  347. package/plugin/nextjs/types.ts +1 -2
  348. package/plugin/nextjs/utils.ts +121 -0
  349. package/plugin/utils/compiler.ts +2 -0
  350. package/plugin/utils/runtimeEntry.ts +15 -2
  351. package/presets/tailwind/classname/index.ts +2 -0
  352. package/presets/tailwind/classname/transform.ts +239 -0
  353. package/presets/tailwind/classname/types.ts +124 -0
  354. package/presets/tailwind/index.ts +5 -0
  355. package/presets/tailwind/selectors.ts +27 -0
  356. package/presets/tailwind/style/index.ts +2 -0
  357. package/presets/tailwind/style/transform.ts +436 -0
  358. package/presets/tailwind/style/types.ts +346 -0
  359. package/presets/tailwind/theme.ts +479 -0
  360. package/presets/tailwind/types.ts +147 -0
  361. package/runtime/adapter/utils.ts +120 -0
  362. package/runtime/core/cache/combine.ts +76 -28
  363. package/runtime/core/cache/combineRuntime.ts +4 -0
  364. package/runtime/core/cache/index.ts +2 -1
  365. package/runtime/core/cache/item.ts +32 -13
  366. package/runtime/core/cache/itemWithResolver.ts +44 -0
  367. package/runtime/core/cache/pool.ts +16 -31
  368. package/runtime/core/cache/prop.ts +10 -8
  369. package/runtime/core/cache/result.ts +2 -2
  370. package/runtime/core/cache/stateItem.ts +16 -1
  371. package/runtime/core/cache/token.ts +20 -0
  372. package/runtime/core/cache/tokenValues.ts +19 -11
  373. package/runtime/core/combinedStyle.ts +4 -4
  374. package/runtime/extract/combineStyle.ts +211 -0
  375. package/runtime/extract/getClassName.ts +55 -23
  376. package/runtime/extract/index.ts +4 -2
  377. package/runtime/extract/token.ts +41 -0
  378. package/runtime/extract/tokenResolver.ts +17 -0
  379. package/runtime/index.ts +8 -1
  380. package/runtime/rsc/getClassName.ts +4 -0
  381. package/runtime/rsc/observer.ts +4 -0
  382. package/runtime/rsc/styleStore.ts +18 -7
  383. package/runtime/sheet/rule.ts +16 -12
  384. package/runtime/sheet/rules.ts +8 -3
  385. package/runtime/style/scope.ts +0 -24
  386. package/runtime/style/style.ts +181 -6
  387. package/runtime/types.ts +6 -4
  388. package/selector/assert.ts +24 -25
  389. package/selector/selector.ts +6 -0
  390. package/sheet/dev/dev_layer.ts +18 -7
  391. package/sheet/dev/dev_sort.ts +45 -11
  392. package/sheet/prod.ts +18 -7
  393. package/sheet/types.ts +2 -0
  394. package/sheet/utils/layer.ts +33 -0
  395. package/style/classname.ts +47 -0
  396. package/style/important.ts +19 -0
  397. package/style/index.ts +3 -0
  398. package/style/style.ts +47 -16
  399. package/style/theme.ts +4 -3
  400. package/style/token.ts +26 -21
  401. package/style/tokens.ts +18 -12
  402. package/style/transform.ts +41 -2
  403. package/style/types.ts +6 -4
  404. package/style/utils/expose.ts +4 -3
  405. package/style/value.ts +26 -11
  406. package/style/valueRef.ts +1 -1
  407. package/style/weight.ts +21 -0
  408. package/utils/global.ts +1 -3
  409. package/utils/hash.ts +4 -0
  410. package/utils/symbol.ts +3 -0
  411. package/atomic/layer/README.md +0 -116
  412. package/atomic/utils/css.ts +0 -49
  413. package/dist/assert-h_Zkqc4E.js +0 -105
  414. package/dist/assert-h_Zkqc4E.js.map +0 -1
  415. package/dist/className-C1Ht5Wvv.js +0 -144
  416. package/dist/className-C1Ht5Wvv.js.map +0 -1
  417. package/dist/className-DC2Cq8p3.js +0 -251
  418. package/dist/className-DC2Cq8p3.js.map +0 -1
  419. package/dist/compiler-DweanHoB.mjs.map +0 -1
  420. package/dist/config-BryWDfQX.js +0 -25
  421. package/dist/config-BryWDfQX.js.map +0 -1
  422. package/dist/config-DKHXWhe1.js +0 -1
  423. package/dist/config-Di2VYYKV.js +0 -6
  424. package/dist/config-DloHOG6I.js +0 -13
  425. package/dist/config-DloHOG6I.js.map +0 -1
  426. package/dist/css-BowBszUt.js +0 -243
  427. package/dist/css-BowBszUt.js.map +0 -1
  428. package/dist/css-ByOrugEX.js +0 -805
  429. package/dist/css-ByOrugEX.js.map +0 -1
  430. package/dist/css-DcazYor9.js +0 -235
  431. package/dist/css-DcazYor9.js.map +0 -1
  432. package/dist/css_extra-DlOnsnR1.js +0 -8
  433. package/dist/css_extra-oIi3UEPK.js.map +0 -1
  434. package/dist/data-_te7t0M4.js +0 -473
  435. package/dist/data-_te7t0M4.js.map +0 -1
  436. package/dist/debug-BAw63qX6.js +0 -15
  437. package/dist/debug-BAw63qX6.js.map +0 -1
  438. package/dist/debug-DGki_v7g.js +0 -15
  439. package/dist/debug-DGki_v7g.js.map +0 -1
  440. package/dist/debug-n2aZQBSa.js.map +0 -1
  441. package/dist/dev-CcphAa3R.js.map +0 -1
  442. package/dist/dev-DfBbuLeE.js +0 -71
  443. package/dist/dev-DfBbuLeE.js.map +0 -1
  444. package/dist/elementMarker-Bu7gDAkE.js.map +0 -1
  445. package/dist/extract-CzWJeQi8.js +0 -121
  446. package/dist/extract-CzWJeQi8.js.map +0 -1
  447. package/dist/extract-DEwSDJ9Z.js +0 -2
  448. package/dist/format-3nKBE_5t.js.map +0 -1
  449. package/dist/getClassName-BlvXHYuf.js.map +0 -1
  450. package/dist/global-CvfmFLsK.js +0 -11
  451. package/dist/global-CvfmFLsK.js.map +0 -1
  452. package/dist/jsx-CwTeyUxr.js +0 -39
  453. package/dist/jsx-CwTeyUxr.js.map +0 -1
  454. package/dist/jsx-D2BksHSv.js +0 -38
  455. package/dist/jsx-D2BksHSv.js.map +0 -1
  456. package/dist/layer-D1SaH07m.js +0 -94
  457. package/dist/layer-D1SaH07m.js.map +0 -1
  458. package/dist/loader-DS61nRqr.mjs.map +0 -1
  459. package/dist/misc-B9kqEb2N.mjs.map +0 -1
  460. package/dist/presets-Bye3ea2x.js +0 -139
  461. package/dist/presets-Bye3ea2x.js.map +0 -1
  462. package/dist/property-CnLFt5kx.js +0 -406
  463. package/dist/property-CnLFt5kx.js.map +0 -1
  464. package/dist/rules-9HSO1pxL.js.map +0 -1
  465. package/dist/runtime-CYqNCiaM.js.map +0 -1
  466. package/dist/shared-BAL9peIw.cjs.map +0 -1
  467. package/dist/style-4rFUy-zW.js +0 -752
  468. package/dist/style-4rFUy-zW.js.map +0 -1
  469. package/dist/style-B1UUqjj5.js +0 -743
  470. package/dist/style-B1UUqjj5.js.map +0 -1
  471. package/dist/style-Cw3NtvR0.js +0 -5
  472. package/dist/style-DNqQ6H-7.js +0 -1255
  473. package/dist/style-DNqQ6H-7.js.map +0 -1
  474. package/dist/styleStore-Dea_WVbr.js.map +0 -1
  475. package/dist/styleStore-DyNXBcUK.js.map +0 -1
  476. package/dist/token-CKXUECuU.js +0 -76
  477. package/dist/token-CKXUECuU.js.map +0 -1
  478. package/dist/token-u_tM-mtg.js +0 -204
  479. package/dist/token-u_tM-mtg.js.map +0 -1
  480. package/dist/utils-BbehLOby.js.map +0 -1
  481. package/dist/utils-C7xfDxtM.mjs +0 -97
  482. package/dist/utils-C7xfDxtM.mjs.map +0 -1
  483. package/dist/utils-CWNHx4EC.js +0 -170
  484. package/dist/utils-CWNHx4EC.js.map +0 -1
  485. package/dist/utils-D7FAOyg6.js.map +0 -1
  486. package/dist/value-BR4e2MKt.js +0 -910
  487. package/dist/value-BR4e2MKt.js.map +0 -1
  488. package/dist/value-E8rEv2Oe.js +0 -136
  489. package/dist/value-E8rEv2Oe.js.map +0 -1
  490. package/dist/valueRef-lshFk1Cs.js +0 -16
  491. package/dist/valueRef-lshFk1Cs.js.map +0 -1
  492. package/dist/webpack-CxS2FDYU.mjs.map +0 -1
  493. package/dist/withTokens-LRidu3Vc.js +0 -95
  494. package/dist/withTokens-LRidu3Vc.js.map +0 -1
@@ -1,743 +0,0 @@
1
- import { c as isStyleTokenData, d as globalData, l as isStyleTokenOverrideData, o as getStyleTokenId } from "./token-CKXUECuU.js";
2
- import { c as getIdentifierSafeHash, f as RUNTIME_CONFIG, h as CSS_CONFIG, i as createNameFormatter, l as sanitizeCssIdentName, n as getTokenVar, t as getTokenOverrideValue, u as hashString } from "./token-u_tM-mtg.js";
3
- import { d as BUILDER_SLOT_ID, f as BUILDER_STATE, l as BUILDER_SCOPE, n as isExtractedTokenBoundData, p as BUILDER_TYPE, t as getExtractedTokenBoundData, u as BUILDER_SCOPE_ID } from "./withTokens-LRidu3Vc.js";
4
- import { d as getResolvedStyleItemTokenValues, f as isResolvedStyleItem$1, h as hasOwn, l as createCacheTreeNode, m as setResolvedStyleItemTokenValues, p as markResolvedStyleItem, u as getCacheTreeChild } from "./className-C1Ht5Wvv.js";
5
- //#region builder/data/is.ts
6
- function getSlotId(data) {
7
- return data[BUILDER_SLOT_ID];
8
- }
9
- function getScopeTargetSlotId(data) {
10
- return data[BUILDER_SCOPE_ID];
11
- }
12
- function getScopeTargetScope(data) {
13
- return data[BUILDER_SCOPE];
14
- }
15
- function isStyleData(value) {
16
- return getBuilderType(value) === 1;
17
- }
18
- function isSlotData(value) {
19
- return getBuilderType(value) === 2;
20
- }
21
- function isSlotOverrideData(value) {
22
- return getBuilderType(value) === 3;
23
- }
24
- function isScopeData(value) {
25
- return getBuilderType(value) === 4;
26
- }
27
- function isScopeTargetData(value) {
28
- return getBuilderType(value) === 5;
29
- }
30
- function isThemeData(value) {
31
- return getBuilderType(value) === 6;
32
- }
33
- function getBuilderType(value) {
34
- if (!value || typeof value !== "object" && typeof value !== "function") return null;
35
- return value[BUILDER_TYPE];
36
- }
37
- const formatClassName = createNameFormatter([
38
- "atRule",
39
- "scopeSelector",
40
- "property",
41
- "selector",
42
- "value"
43
- ]);
44
- const formatScopeClassName = createNameFormatter(["className"]);
45
- function getDebugClassName(format, hash, info) {
46
- return formatClassName(format || "[(atRule)-][(scopeSelector)-](property)[-(selector)][-(value)]-$hash", hash, info);
47
- }
48
- function getDebugScopeClassName(format, info) {
49
- return formatScopeClassName(format || "-(className)", null, info);
50
- }
51
- //#endregion
52
- //#region atomic/utils/debug.ts
53
- function normalizeDebugKeywordValue(value) {
54
- const normalized = value.trim().toLowerCase();
55
- return /^[a-z][a-z0-9-]*$/.test(normalized) ? normalized : null;
56
- }
57
- function sanitizeDebugName(value) {
58
- if (!value) return "";
59
- return sanitizeCssIdentName(value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), "");
60
- }
61
- function normalizePropertyName(property) {
62
- return property.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
63
- }
64
- function sanitizeDebugPropertyName(property) {
65
- let name = property;
66
- if (name.charCodeAt(0) === 45 && name.charCodeAt(1) === 45) name = name.slice(2);
67
- return name.replace(/[^a-z0-9_-]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, "");
68
- }
69
- //#endregion
70
- //#region atomic/debug/value.ts
71
- function getDebugValueName(value) {
72
- if (!value) return {
73
- value: null,
74
- arbitraryValue: null
75
- };
76
- const normalized = value.trim().toLowerCase();
77
- if (!normalized) return {
78
- value: null,
79
- arbitraryValue: null
80
- };
81
- if (normalized.startsWith("url") || normalized.includes("gradient") || normalized.startsWith("image") || normalized.startsWith("calc(") || normalized.startsWith("var(") || normalized.startsWith("env(") || normalized.startsWith("rgb") || normalized.startsWith("hsl")) return {
82
- value: null,
83
- arbitraryValue: null
84
- };
85
- if (/^[a-z][a-z0-9-]*$/.test(normalized)) return {
86
- value: normalized,
87
- arbitraryValue: null
88
- };
89
- const name = normalized.replace(/px/g, "").replace(/rem/g, "rem").replace(/em/g, "em").replace(/%/g, "pct").replace(/fr/g, "fr").replace(/[,()"'#]/g, "-").replace(/\s+/g, "-").replace(/[^a-z0-9._%-]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, "");
90
- if (!name) return {
91
- value: null,
92
- arbitraryValue: null
93
- };
94
- return {
95
- value: null,
96
- arbitraryValue: name
97
- };
98
- }
99
- //#endregion
100
- //#region atomic/debug/property/data.ts
101
- const PROPERTY_ALIASES = {
102
- "border-radius": "radius",
103
- "flex-direction": "flex",
104
- "font-style": "font",
105
- "font-weight": "font",
106
- "grid-template-columns": "grid-cols",
107
- "grid-template-rows": "grid-rows",
108
- "align-items": "items",
109
- "justify-content": "justify",
110
- "z-index": "zindex",
111
- "pointer-events": "pointer"
112
- };
113
- const KEYWORD_VALUE_PROPERTIES = new Set([
114
- "align-content",
115
- "align-items",
116
- "align-self",
117
- "background-repeat",
118
- "background-size",
119
- "border-collapse",
120
- "border-style",
121
- "box-sizing",
122
- "clear",
123
- "cursor",
124
- "display",
125
- "flex-direction",
126
- "flex-wrap",
127
- "float",
128
- "font-weight",
129
- "font-style",
130
- "justify-content",
131
- "justify-items",
132
- "justify-self",
133
- "list-style-position",
134
- "list-style-type",
135
- "object-fit",
136
- "object-position",
137
- "overflow",
138
- "overflow-x",
139
- "overflow-y",
140
- "pointer-events",
141
- "place-content",
142
- "place-items",
143
- "place-self",
144
- "position",
145
- "resize",
146
- "table-layout",
147
- "text-align",
148
- "text-decoration-line",
149
- "text-transform",
150
- "user-select",
151
- "vertical-align",
152
- "visibility",
153
- "white-space"
154
- ]);
155
- const ARBITRARY_VALUE_PROPERTIES = new Set(["font-weight"]);
156
- //#endregion
157
- //#region atomic/debug/property/property.ts
158
- function getDebugPropertyName(property, value) {
159
- if (!property) return null;
160
- const normalized = normalizePropertyName(property);
161
- const name = PROPERTY_ALIASES[normalized] || sanitizeDebugPropertyName(normalized);
162
- if (!name) return null;
163
- return {
164
- property: name,
165
- ...withKeywordValueFallback(normalized, value, withArbitraryValueFallback(normalized, getDebugValueName(value)))
166
- };
167
- }
168
- function withArbitraryValueFallback(property, valueName) {
169
- if (!valueName.arbitraryValue || ARBITRARY_VALUE_PROPERTIES.has(property)) return valueName;
170
- return {
171
- value: valueName.value,
172
- arbitraryValue: null
173
- };
174
- }
175
- function withKeywordValueFallback(property, value, valueName) {
176
- if (valueName.value || valueName.arbitraryValue) return valueName;
177
- if (!KEYWORD_VALUE_PROPERTIES.has(property)) return valueName;
178
- const normalized = normalizeDebugKeywordValue(value);
179
- if (!normalized) return valueName;
180
- return {
181
- value: normalized,
182
- arbitraryValue: null
183
- };
184
- }
185
- //#endregion
186
- //#region atomic/debug/selector.ts
187
- function getDebugSelectorName(selector) {
188
- if (!selector) return null;
189
- const normalized = selector.trim().toLowerCase();
190
- if (/^[a-z0-9]+$/.test(normalized)) return null;
191
- return validateName(normalized.replace(/\$\$/g, "args").replace(/\$/g, "arg").replace(/\.\.\./g, "merge").replace(/:not\(/g, "not-").replace(/:(is|where|has)\(/g, "$1-").replace(/:nth-(child|of-type)\(/g, "nth-").replace(/[.#]/g, "-").replace(/[[\]()]/g, "-").replace(/:+/g, "-").replace(/\s+/g, "-").replace(/[^a-z0-9_-]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, ""));
192
- }
193
- function getDebugAtRuleName(selector) {
194
- if (!selector || Array.isArray(selector) && selector.length === 0) return null;
195
- return validateName((Array.isArray(selector) ? selector.map(parseAtRule).filter(Boolean).join("-") : parseAtRule(selector)).replace(/[-_]+/g, "-").replace(/^-+|-+$/g, ""));
196
- }
197
- function compressQuery(query) {
198
- return query.trim().toLowerCase().replace(/prefers-color-scheme\s*:\s*dark/g, "dark").replace(/prefers-color-scheme\s*:\s*light/g, "light").replace(/min-width\s*:\s*/g, "min-").replace(/max-width\s*:\s*/g, "max-").replace(/min-height\s*:\s*/g, "minh-").replace(/max-height\s*:\s*/g, "maxh-").replace(/inline-size/g, "inline").replace(/\b(and|or|only|not)\b/g, "").replace(/>=/g, "-gte-").replace(/<=/g, "-lte-").replace(/>/g, "-gt-").replace(/</g, "-lt-").replace(/[():=\s]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, "");
199
- }
200
- function validateName(name) {
201
- if (!name || name === "selector" || name.length < 2) return null;
202
- return name;
203
- }
204
- function parseAtRule(rule) {
205
- const normalized = rule.trim().toLowerCase();
206
- if (normalized.startsWith("@media")) return compressQuery(normalized.slice(6));
207
- if (normalized.startsWith("@container")) return compressQuery(normalized.slice(10));
208
- if (normalized.startsWith("@supports")) return compressQuery(normalized.slice(9));
209
- return compressQuery(normalized);
210
- }
211
- //#endregion
212
- //#region atomic/utils/selector.ts
213
- function getSelectorText(selector) {
214
- return Array.isArray(selector) ? selector[0] : selector;
215
- }
216
- function getSelectorHash(selector) {
217
- return Array.isArray(selector) ? selector.join("|") : selector;
218
- }
219
- function getSelectorPriority(selector) {
220
- if (!selector) return 0;
221
- return Array.isArray(selector) ? selector[1] : 0;
222
- }
223
- //#endregion
224
- //#region atomic/className.ts
225
- function getAtomicClassName(property, priority, value, selector, parentSelector, atRule, callsite, localClassName, debugClassName, classNameFormat) {
226
- let hash = property;
227
- hash += "\n" + (priority || "");
228
- hash += "\n" + value;
229
- hash += "\n" + (selector ? getSelectorHash(selector) : "");
230
- hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
231
- hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
232
- hash += "\n" + getCallsiteHash(callsite, localClassName);
233
- hash = getIdentifierSafeHash(hash);
234
- if (!debugClassName) return hash;
235
- const propertyName = getDebugPropertyName(property, value);
236
- return getDebugClassName(classNameFormat, hash, {
237
- atRule: atRule ? getDebugAtRuleName(atRule.map(getSelectorText)) : null,
238
- scopeSelector: parentSelector ? getDebugSelectorName(getSelectorText(parentSelector)) : null,
239
- selector: selector ? getDebugSelectorName(getSelectorText(selector)) : null,
240
- property: propertyName ? propertyName.property : property,
241
- value: propertyName ? propertyName.value ?? propertyName.arbitraryValue : null
242
- });
243
- }
244
- function getScopeClassName(className, scopeClassNameFormat) {
245
- return getDebugScopeClassName(scopeClassNameFormat, { className });
246
- }
247
- function getClassNameDedupe(property, priority, selector, parentSelector, atRule) {
248
- let hash = property;
249
- hash += "\n" + (priority || "");
250
- hash += "\n" + (selector ? getSelectorHash(selector) : "");
251
- hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
252
- hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
253
- return hashString(hash);
254
- }
255
- function getCallsiteHash(callsite, localClassName) {
256
- if (!localClassName || !callsite) return "";
257
- return callsite.filePath + "\n" + callsite.line + ":" + callsite.column;
258
- }
259
- //#endregion
260
- //#region runtime/core/combinedStyle.ts
261
- const targets = globalData("runtime.combinedStyle.targets", () => /* @__PURE__ */ new WeakMap());
262
- function createCombinedStyle(meta, getField) {
263
- const target = {
264
- ...meta,
265
- cache: Object.create(null),
266
- getField
267
- };
268
- const proxyTarget = {};
269
- const proxy = new Proxy(proxyTarget, handlers);
270
- targets.set(proxyTarget, target);
271
- targets.set(proxy, target);
272
- return proxy;
273
- }
274
- function isCombinedStyle(value) {
275
- return !!value && typeof value === "object" && targets.has(value);
276
- }
277
- function getCombinedStyleStyles(style) {
278
- return getTarget(style).styles;
279
- }
280
- function getCombinedStyleScopes(style) {
281
- return getTarget(style).scopes;
282
- }
283
- function getCombinedStyleTokens(style) {
284
- return getTarget(style).tokens;
285
- }
286
- const handlers = { get(proxy, prop) {
287
- const target = getTarget(proxy);
288
- if (hasOwn(target.cache, prop)) return target.cache[prop];
289
- const value = target.getField(target, prop);
290
- if (value && typeof value === "object") target.cache[prop] = value;
291
- return value;
292
- } };
293
- function getTarget(value) {
294
- const target = targets.get(value);
295
- if (!target) throw new Error("[fluentic-style] Expected combined style.");
296
- return target;
297
- }
298
- //#endregion
299
- //#region runtime/core/cache/item.ts
300
- const directStyleItemCache = globalData("runtime.directStyleItemCache", () => /* @__PURE__ */ new WeakMap());
301
- function isResolvedStyleItem(value) {
302
- return isResolvedStyleItem$1(value);
303
- }
304
- function createResolvedStyleItem(data, scopes, tokens = null) {
305
- return createStyleItem({
306
- data,
307
- items: resolveItems(data, scopes)
308
- }, tokens);
309
- }
310
- function createResolvedStyleItemFromItems(item, tokens) {
311
- return createStyleItem({
312
- data: item.data,
313
- items: item.items
314
- }, tokens);
315
- }
316
- function getDirectStyleItem(item) {
317
- let cached = directStyleItemCache.get(item);
318
- if (!cached) {
319
- cached = createResolvedStyleItem(item, []);
320
- directStyleItemCache.set(item, cached);
321
- }
322
- return cached;
323
- }
324
- function getStyleTokenValues(value) {
325
- if (isCombinedStyle(value)) return getCombinedStyleTokens(value);
326
- return getResolvedStyleItemTokenValues(value);
327
- }
328
- function createCombinedStyleFacade(styles, scopes) {
329
- return createCombinedStyle({
330
- styles,
331
- scopes,
332
- tokens: null
333
- }, getStyleField);
334
- }
335
- function createCombinedStyleTokenWrapper(style, tokens) {
336
- return createCombinedStyle({
337
- styles: getCombinedStyleStyles(style),
338
- scopes: getCombinedStyleScopes(style),
339
- tokens
340
- }, getTokenField(style));
341
- }
342
- const getStyleField = (meta, prop) => {
343
- const value = meta.styles?.[prop] ?? null;
344
- if (isStyleData(value) || isSlotData(value)) return createResolvedStyleItem(value, meta.scopes);
345
- if (value && typeof value === "object") return createCombinedStyleFacade(value, meta.scopes);
346
- return value;
347
- };
348
- function getTokenField(base) {
349
- return (meta, prop) => {
350
- const value = base?.[prop] ?? null;
351
- if (isResolvedStyleItem(value)) return createStyleItem({
352
- data: value.data,
353
- items: value.items
354
- }, meta.tokens);
355
- if (isCombinedStyle(value)) return createCombinedStyleTokenWrapper(value, meta.tokens);
356
- return value;
357
- };
358
- }
359
- function createStyleItem(item, tokens = null) {
360
- markResolvedStyleItem(item);
361
- if (tokens) setResolvedStyleItemTokenValues(item, tokens);
362
- return item;
363
- }
364
- function resolveItems(data, scopes) {
365
- const items = [];
366
- const stateItems = data[BUILDER_STATE]?.items ?? [];
367
- const slotId = isSlotData(data) ? getSlotId(data) : null;
368
- for (let i = 0, len = stateItems.length; i < len; i++) {
369
- const item = stateItems[i];
370
- if (Array.isArray(item)) {
371
- items.push(item);
372
- continue;
373
- }
374
- if (isStyleTokenOverrideData(item)) continue;
375
- if (slotId && item.type !== 2) continue;
376
- items.push(item);
377
- }
378
- if (!slotId) return items;
379
- for (let i = 0, len = scopes.length; i < len; i++) {
380
- const boundScope = scopes[i];
381
- const scope = getScopeTargetScope(boundScope);
382
- if (!scope) continue;
383
- const scopeItems = scope[BUILDER_STATE]?.items;
384
- if (!scopeItems) continue;
385
- const targetSlotId = getScopeTargetSlotId(boundScope);
386
- for (let j = 0, len = scopeItems.length; j < len; j++) {
387
- const item = scopeItems[j];
388
- if (Array.isArray(item)) {
389
- if (item[1] === slotId) items.push(item);
390
- const hasParentSelector = isExtractedScopeParentMarker(item[4]) || isExtractedScopeParentMarker(item[5]);
391
- if (targetSlotId === slotId && hasParentSelector) items.push(getScopeParentItem(String(item[3])));
392
- continue;
393
- }
394
- if (isStyleTokenOverrideData(item)) continue;
395
- if (item.type !== 4) continue;
396
- if (item.slotId === slotId) items.push(item);
397
- if (item.parentSelector && targetSlotId === slotId) items.push(getScopeParentItem(item.className));
398
- }
399
- }
400
- return items;
401
- }
402
- function getScopeParentItem(className) {
403
- const parentClassName = getScopeClassName(className, CSS_CONFIG.scopeClassNameFormat || null);
404
- return [parentClassName, parentClassName];
405
- }
406
- function isExtractedScopeParentMarker(value) {
407
- return value === 1 || value === true;
408
- }
409
- //#endregion
410
- //#region runtime/core/cache/tokenValues.ts
411
- function createMutableTokenValues(base) {
412
- return {
413
- ids: base ? base.ids.slice() : null,
414
- values: base ? base.values.slice() : null,
415
- lookup: base ? { ...base.lookup } : null,
416
- index: base ? createTokenIndexLookup(base.ids) : null
417
- };
418
- }
419
- function addTokenOverride(values, item) {
420
- if (!isStyleTokenOverrideData(item)) return false;
421
- addTokenValue(values, getStyleTokenId(item), getTokenOverrideValue(item, CSS_CONFIG.tokenNameFormat ?? null));
422
- return true;
423
- }
424
- function addTokenValue(values, id, value) {
425
- if (!values.ids) values.ids = [];
426
- if (!values.values) values.values = [];
427
- if (!values.lookup) values.lookup = Object.create(null);
428
- if (!values.index) values.index = Object.create(null);
429
- const ids = values.ids;
430
- const tokenValues = values.values;
431
- const lookup = values.lookup;
432
- const indexLookup = values.index;
433
- const index = indexLookup[id];
434
- if (index === void 0) {
435
- indexLookup[id] = ids.push(id) - 1;
436
- tokenValues.push(value);
437
- } else tokenValues[index] = value;
438
- lookup[id] = value;
439
- }
440
- function addTokenValues(values, next) {
441
- if (!next) return;
442
- for (let i = 0, len = next.ids.length; i < len; i++) addTokenValue(values, next.ids[i], next.values[i]);
443
- }
444
- function addTokenOverrides(values, overrides) {
445
- for (let i = 0, len = overrides.length; i < len; i++) addTokenOverride(values, overrides[i]);
446
- }
447
- function finishTokenValues(base, values) {
448
- if (!values.ids || !values.values || !values.lookup) return null;
449
- if (isSameTokenValues(base, values.ids, values.values)) return base;
450
- return {
451
- ids: values.ids,
452
- values: values.values,
453
- lookup: values.lookup
454
- };
455
- }
456
- function mergeTokenValues(base, next) {
457
- if (!next) return base;
458
- if (!base) return next;
459
- const values = createMutableTokenValues(base);
460
- addTokenValues(values, next);
461
- return finishTokenValues(base, values);
462
- }
463
- function mergeTokenOverrides(base, overrides) {
464
- if (!overrides.length) return base;
465
- const values = createMutableTokenValues(base);
466
- addTokenOverrides(values, overrides);
467
- return finishTokenValues(base, values);
468
- }
469
- function createTokenIndexLookup(ids) {
470
- const lookup = Object.create(null);
471
- for (let i = 0, len = ids.length; i < len; i++) lookup[ids[i]] = i;
472
- return lookup;
473
- }
474
- function isSameTokenValues(base, ids, values) {
475
- if (!base || base.ids.length !== ids.length) return false;
476
- const baseLookup = base.lookup;
477
- for (let i = 0, len = ids.length; i < len; i++) {
478
- if (!hasOwn(baseLookup, ids[i])) return false;
479
- if (baseLookup[ids[i]] !== values[i]) return false;
480
- }
481
- return true;
482
- }
483
- //#endregion
484
- //#region runtime/core/getToken.ts
485
- function getToken(value) {
486
- if (isStyleTokenData(value)) return getTokenVar(value, CSS_CONFIG.tokenNameFormat ?? null);
487
- return value;
488
- }
489
- //#endregion
490
- //#region runtime/style/scope.ts
491
- function combineScope(...scopes) {
492
- const shortcut = resolveSingleScopeTarget(scopes);
493
- if (shortcut !== null) return (target) => shortcut(target);
494
- return (target) => resolveScopeTargets(target, scopes);
495
- }
496
- function bindScope(target, ...scopes) {
497
- const shortcut = resolveSingleScopeTarget(scopes);
498
- if (shortcut !== null) return shortcut(target);
499
- return resolveScopeTargets(target, scopes);
500
- }
501
- function resolveSingleScopeTarget(scopes) {
502
- if (scopes.length !== 1) return null;
503
- const scope = scopes[0];
504
- if (!scope) return () => [];
505
- if (Array.isArray(scope) || !isScopeData(scope)) return null;
506
- return (target) => [scope(target)];
507
- }
508
- function resolveScopeTargets(target, scopes) {
509
- const targets = [];
510
- const stack = scopes.slice();
511
- while (stack.length > 0) {
512
- const item = stack.pop();
513
- if (!item) continue;
514
- if (Array.isArray(item)) {
515
- for (let i = item.length - 1; i >= 0; i--) stack.push(item[i]);
516
- continue;
517
- }
518
- if (isScopeData(item)) targets.push(item(target));
519
- }
520
- return targets;
521
- }
522
- //#endregion
523
- //#region runtime/core/cache/pool.ts
524
- const DEFAULT_TTL = 1e3 * 60 * 5;
525
- const TOKEN_WRAPPER_CACHE_LIMIT = 32;
526
- let configuredPool = null;
527
- let configuredPoolTTL = -1;
528
- function getCombinedStylePool() {
529
- const ttl = RUNTIME_CONFIG.runtimeCacheTTL;
530
- if (!configuredPool || configuredPoolTTL !== ttl) {
531
- configuredPool = createCombinedStylePool(ttl);
532
- configuredPoolTTL = ttl;
533
- }
534
- return configuredPool;
535
- }
536
- function createCombinedStylePool(ttl = DEFAULT_TTL) {
537
- const root = createPoolNode();
538
- let timer = null;
539
- return {
540
- get(styles, inheritedScopes, items, prevTokensData = null) {
541
- if (ttl === 0) {
542
- const collected = collectItems(null, items, prevTokensData);
543
- return {
544
- style: createCombinedStyleFacade(styles, concatScopes(inheritedScopes, collected.scopes)),
545
- tokenCache: null,
546
- tokens: collected.tokens
547
- };
548
- }
549
- const now = Date.now();
550
- let node = getPoolChild(root, styles);
551
- node = walkScopes(node, inheritedScopes);
552
- const collected = collectItems(node, items, prevTokensData);
553
- node = collected.node ?? node;
554
- node.value.updatedAt = now;
555
- if (node.value.style) {
556
- scheduleCleanup();
557
- return {
558
- style: node.value.style,
559
- tokenCache: collected.tokens ? getTokenWrapperCache(node.value) : null,
560
- tokens: collected.tokens
561
- };
562
- }
563
- const allScopes = concatScopes(inheritedScopes, collected.scopes);
564
- node.value.style = createCombinedStyleFacade(styles, allScopes);
565
- scheduleCleanup();
566
- return {
567
- style: node.value.style,
568
- tokenCache: collected.tokens ? getTokenWrapperCache(node.value) : null,
569
- tokens: collected.tokens
570
- };
571
- },
572
- cleanup(now = Date.now()) {
573
- cleanupNode(root, now, ttl);
574
- }
575
- };
576
- function scheduleCleanup() {
577
- if (timer) return;
578
- timer = setTimeout(() => {
579
- timer = null;
580
- cleanupNode(root, Date.now(), ttl);
581
- }, Math.max(ttl, 0));
582
- timer.unref?.();
583
- }
584
- }
585
- function getCachedTokenWrapper(cache, tokens, create) {
586
- if (!cache) return create();
587
- const key = getTokenWrapperCacheKey(tokens);
588
- const cached = cache.get(key);
589
- if (cached) {
590
- cache.delete(key);
591
- cache.set(key, cached);
592
- return cached;
593
- }
594
- const value = create();
595
- cache.set(key, value);
596
- if (cache.size > TOKEN_WRAPPER_CACHE_LIMIT) {
597
- const oldest = cache.keys().next().value;
598
- if (oldest !== void 0) cache.delete(oldest);
599
- }
600
- return value;
601
- }
602
- function getTokenWrapperCache(node) {
603
- if (!node.tokenCache) node.tokenCache = /* @__PURE__ */ new Map();
604
- return node.tokenCache;
605
- }
606
- function getTokenWrapperCacheKey(tokens) {
607
- return tokens.ids.join("") + "" + tokens.values.join("");
608
- }
609
- function collectItems(node, items, prevTokensData) {
610
- const scopes = [];
611
- const tokens = createMutableTokenValues(prevTokensData);
612
- let currentNode = node;
613
- for (let i = 0, len = items.length; i < len; i++) {
614
- const item = items[i];
615
- if (addTokenOverride(tokens, item)) continue;
616
- if (isScopeTargetData(item)) {
617
- scopes.push(item);
618
- currentNode = currentNode ? walkScope(currentNode, item) : null;
619
- addTokenValues(tokens, getScopeTokenValues(currentNode, getScopeTargetScope(item)));
620
- }
621
- }
622
- const tokensData = finishTokenValues(prevTokensData, tokens);
623
- if (!tokensData) return {
624
- node: currentNode,
625
- scopes,
626
- tokens: null
627
- };
628
- return {
629
- node: currentNode,
630
- scopes,
631
- tokens: tokensData
632
- };
633
- }
634
- function walkScopes(node, scopes) {
635
- for (let i = 0, len = scopes.length; i < len; i++) {
636
- const scope = scopes[i];
637
- if (!scope) continue;
638
- node = walkScope(node, scope);
639
- }
640
- return node;
641
- }
642
- function walkScope(node, scope) {
643
- node = getPoolChild(node, getScopeTargetScope(scope));
644
- node = getPoolChild(node, getScopeTargetSlotId(scope));
645
- return node;
646
- }
647
- function getScopeTokenValues(node, scope) {
648
- const tokenNameFormat = CSS_CONFIG.tokenNameFormat;
649
- if (node && node.value.h && node.value.f === tokenNameFormat) return node.value.s;
650
- const values = createMutableTokenValues(null);
651
- const items = scope[BUILDER_STATE].items;
652
- for (let i = 0, len = items.length; i < len; i++) addTokenOverride(values, items[i]);
653
- const tokens = finishTokenValues(null, values);
654
- if (node) {
655
- node.value.h = true;
656
- node.value.s = tokens;
657
- node.value.f = tokenNameFormat;
658
- }
659
- return tokens;
660
- }
661
- function concatScopes(inheritedScopes, scopes) {
662
- const items = [];
663
- for (let i = 0, len = inheritedScopes.length; i < len; i++) {
664
- const item = inheritedScopes[i];
665
- if (item) items.push(item);
666
- }
667
- for (let i = 0, len = scopes.length; i < len; i++) {
668
- const item = scopes[i];
669
- if (item) items.push(item);
670
- }
671
- return items;
672
- }
673
- function getPoolChild(node, key) {
674
- return getCacheTreeChild(node, key, createPoolValue);
675
- }
676
- function createPoolNode() {
677
- return createCacheTreeNode(createPoolValue());
678
- }
679
- function createPoolValue() {
680
- return {
681
- style: null,
682
- tokenCache: null,
683
- h: false,
684
- s: null,
685
- f: void 0,
686
- updatedAt: Date.now()
687
- };
688
- }
689
- function cleanupNode(node, now, ttl) {
690
- for (const [key, child] of node.children) {
691
- cleanupNode(child, now, ttl);
692
- if (child.value.style && now - child.value.updatedAt >= ttl) child.value.style = null;
693
- if (!child.value.style && !child.children.size) node.children.delete(key);
694
- }
695
- }
696
- //#endregion
697
- //#region runtime/core/cache/combine.ts
698
- function getCombinedStyle(styles, args) {
699
- const normalized = normalizeStyleItems(styles, args);
700
- const result = getCombinedStylePool().get(styles, normalized.inheritedScopes, normalized.items, normalized.tokens);
701
- return result.tokens ? getCachedTokenWrapper(result.tokenCache, result.tokens, () => createCombinedStyleTokenWrapper(result.style, result.tokens)) : result.style;
702
- }
703
- function normalizeStyleItems(styles, args) {
704
- const result = {
705
- inheritedScopes: [],
706
- items: [],
707
- tokens: null
708
- };
709
- for (let i = 0, len = args.length; i < len; i++) collectStyleArg(styles, args[i], result);
710
- return result;
711
- }
712
- function collectStyleArg(styles, arg, result) {
713
- if (!arg) return;
714
- if (Array.isArray(arg)) {
715
- for (let i = 0, len = arg.length; i < len; i++) collectStyleArg(styles, arg[i], result);
716
- return;
717
- }
718
- if (RUNTIME_CONFIG.isHoist && isExtractedTokenBoundData(arg)) {
719
- const bound = getExtractedTokenBoundData(arg);
720
- result.tokens = mergeTokenOverrides(result.tokens, bound.tokens);
721
- collectStyleArg(styles, bound.data, result);
722
- return;
723
- }
724
- if (isCombinedStyle(arg)) {
725
- if (getCombinedStyleStyles(arg) !== styles) throw new TypeError("[fluentic-style] combineStyle can only carry a combined style created from the same styles object.");
726
- const scopes = getCombinedStyleScopes(arg);
727
- for (let i = 0, len = scopes.length; i < len; i++) result.inheritedScopes.push(scopes[i]);
728
- result.tokens = mergeTokenValues(result.tokens, getStyleTokenValues(arg));
729
- return;
730
- }
731
- result.items.push(arg);
732
- }
733
- //#endregion
734
- //#region runtime/style/style.ts
735
- const combineStyleBase = (styles, ...args) => getCombinedStyle(styles, args);
736
- const combineStyleFor = (styles) => {
737
- return (...args) => combineStyleBase(styles, ...args);
738
- };
739
- const combineStyle = Object.assign(combineStyleBase, { for: combineStyleFor });
740
- //#endregion
741
- export { isThemeData as C, isStyleData as S, sanitizeDebugName as _, mergeTokenOverrides as a, isSlotData as b, createResolvedStyleItemFromItems as c, isResolvedStyleItem as d, getAtomicClassName as f, getSelectorText as g, getSelectorPriority as h, getToken as i, getDirectStyleItem as l, getScopeClassName as m, bindScope as n, mergeTokenValues as o, getClassNameDedupe as p, combineScope as r, createResolvedStyleItem as s, combineStyle as t, getStyleTokenValues as u, isScopeData as v, isSlotOverrideData as x, isScopeTargetData as y };
742
-
743
- //# sourceMappingURL=style-B1UUqjj5.js.map