@fluentic/style 0.1.0-beta.3 → 0.1.0-beta.5

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 (430) hide show
  1. package/CHANGELOG.md +55 -1
  2. package/README.md +10 -9
  3. package/atomic/className.ts +12 -12
  4. package/atomic/debug/className/className.ts +10 -15
  5. package/atomic/element.ts +1 -1
  6. package/atomic/rule.ts +8 -5
  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/atomic/utils/selector.ts +14 -1
  14. package/builder/classname/class_name_builder.ts +68 -24
  15. package/builder/classname/fns.ts +2 -2
  16. package/builder/classname/types.ts +7 -0
  17. package/builder/data/const.ts +7 -1
  18. package/builder/data/create.ts +42 -0
  19. package/builder/data/data.ts +20 -1
  20. package/builder/data/index.ts +0 -1
  21. package/builder/data/is.ts +23 -0
  22. package/builder/data/merge/scope.ts +20 -19
  23. package/builder/data/merge/style.ts +71 -21
  24. package/builder/data/state.ts +16 -2
  25. package/builder/extract/index.ts +1 -0
  26. package/builder/extract/sheet.ts +26 -0
  27. package/builder/extract/token.ts +30 -14
  28. package/builder/extract/utils.ts +2 -0
  29. package/builder/extract/withTokens.ts +2 -1
  30. package/builder/selector_override.noop.ts +11 -0
  31. package/builder/selector_override.ts +30 -0
  32. package/builder/selector_override_core.ts +66 -0
  33. package/builder/style_builder.ts +127 -3
  34. package/builder/style_data.ts +24 -0
  35. package/builder/style_fns.ts +24 -24
  36. package/builder/token/data.ts +30 -0
  37. package/builder/token/index.ts +3 -0
  38. package/builder/token/name.ts +54 -0
  39. package/builder/token/symbols.ts +6 -0
  40. package/builder/types/alias.ts +34 -6
  41. package/builder/types/fns.ts +13 -5
  42. package/builder/types/types.ts +32 -2
  43. package/builder/utils.ts +1 -0
  44. package/compiler/compiler/compiler.ts +4 -7
  45. package/compiler/compiler/constants.ts +6 -0
  46. package/compiler/compiler/index.ts +1 -0
  47. package/compiler/compiler/types.ts +2 -0
  48. package/compiler/cssProp.ts +35 -0
  49. package/compiler/index.ts +1 -0
  50. package/compiler/transform/cssProp/index.ts +1 -0
  51. package/compiler/transform/cssProp/plugin.ts +129 -0
  52. package/compiler/transform/debug/plugin.ts +85 -1
  53. package/compiler/transform/debug/transform.ts +2 -1
  54. package/compiler/transform/evaluator/evaluator.ts +106 -30
  55. package/compiler/transform/evaluator/tracer.ts +30 -2
  56. package/compiler/transform/extract/chain/chain.ts +541 -63
  57. package/compiler/transform/extract/chain/extract_chain.ts +12 -4
  58. package/compiler/transform/extract/chain/types.ts +1 -1
  59. package/compiler/transform/extract/plugin.ts +20 -4
  60. package/compiler/transform/extract/transform.ts +2 -1
  61. package/compiler/transform/extract/utils/replacement.ts +52 -2
  62. package/compiler/transform/extract/utils/state.ts +2 -0
  63. package/compiler/transform/extract/utils/theme.ts +6 -6
  64. package/compiler/transform/index.ts +1 -0
  65. package/compiler/transform/syntax/isStaticStyleValue.ts +15 -9
  66. package/compiler/transform/syntax/static_ids.ts +1 -1
  67. package/compiler/utils/constants.ts +8 -1
  68. package/compiler/utils/imports.ts +11 -1
  69. package/config/build.ts +1 -8
  70. package/config/config/css.ts +1 -0
  71. package/config/config/debug.ts +11 -0
  72. package/css/index.ts +2 -0
  73. package/css/sheet.ts +119 -0
  74. package/css/styleTarget.ts +251 -0
  75. package/dialect/namedTokens.ts +22 -5
  76. package/dist/adapter/preact.js +2 -0
  77. package/dist/adapter/react.js +2 -0
  78. package/dist/adapter/solid.js +2 -0
  79. package/dist/className-hiAsQ9V6.js +303 -0
  80. package/dist/className-hiAsQ9V6.js.map +1 -0
  81. package/dist/{style-Bw5ka-Nq.js → combine-Ca6LfFxv.js} +427 -722
  82. package/dist/combine-Ca6LfFxv.js.map +1 -0
  83. package/dist/compiler/index.mjs +2 -2
  84. package/dist/{compiler-D5v5tJXI.mjs → compiler-OgDBuqfs.mjs} +1635 -607
  85. package/dist/compiler-OgDBuqfs.mjs.map +1 -0
  86. package/dist/config/index.js +2 -2
  87. package/dist/config-B-KbXpIh.js +6 -0
  88. package/dist/{config-OXHoDUIo.js.map → config-B-KbXpIh.js.map} +1 -1
  89. package/dist/config-Barf8f4B.js +35 -0
  90. package/dist/config-Barf8f4B.js.map +1 -0
  91. package/dist/{config-BEvP7108.js → config-BtANtGAh.js} +4 -6
  92. package/dist/config-BtANtGAh.js.map +1 -0
  93. package/dist/config-CsB4MuFI.js +6 -0
  94. package/dist/config-CsB4MuFI.js.map +1 -0
  95. package/dist/config-DOWSNV8w.js +1 -0
  96. package/dist/{config-FIfi5aJ8.js → config-t76UljYv.js} +9 -7
  97. package/dist/config-t76UljYv.js.map +1 -0
  98. package/dist/createTransformElement-DDqld3RF.js +34 -0
  99. package/dist/createTransformElement-DDqld3RF.js.map +1 -0
  100. package/dist/css-CZwrac6F.js +3923 -0
  101. package/dist/css-CZwrac6F.js.map +1 -0
  102. package/dist/{global-zaCE-g1C.js → css-GtUPEO9U.js} +16 -3
  103. package/dist/css-GtUPEO9U.js.map +1 -0
  104. package/dist/css-YfHN_8Nk.js +479 -0
  105. package/dist/css-YfHN_8Nk.js.map +1 -0
  106. package/dist/css-a9O5so0b.js +1246 -0
  107. package/dist/css-a9O5so0b.js.map +1 -0
  108. package/dist/css.js +2 -2
  109. package/dist/{css_extra-DeTuIlcO.js → css_extra-BiG57TKN.js} +2 -2
  110. package/dist/{css_extra-DQdCrYoC.js.map → css_extra-BiG57TKN.js.map} +1 -1
  111. package/dist/{css_extra-DQdCrYoC.js → css_extra-CXXZAylc.js} +2 -2
  112. package/dist/{css_extra-DeTuIlcO.js.map → css_extra-CXXZAylc.js.map} +1 -1
  113. package/dist/data-CzHJg147.js +763 -0
  114. package/dist/data-CzHJg147.js.map +1 -0
  115. package/dist/{debug-D96KGgpH.js → debug-DkrxyknP.js} +80 -4
  116. package/dist/debug-DkrxyknP.js.map +1 -0
  117. package/dist/{runtime-BKChZZ2-.js → debug-DycdGrul.js} +20 -27
  118. package/dist/debug-DycdGrul.js.map +1 -0
  119. package/dist/dev/rsc.js +6 -9
  120. package/dist/dev/rsc.js.map +1 -1
  121. package/dist/{dev-fOtWB5K3.js → dev-z4laBwlS.js} +7 -6
  122. package/dist/{dev-fOtWB5K3.js.map → dev-z4laBwlS.js.map} +1 -1
  123. package/dist/dev.js +1 -1
  124. package/dist/dialect/extracted/index.js +1 -1
  125. package/dist/dialect/index.js +1 -1
  126. package/dist/{elementMarker-CvqqIb7J.js → elementMarker-CqhU_l_m.js} +95 -9
  127. package/dist/elementMarker-CqhU_l_m.js.map +1 -0
  128. package/dist/entry/dev/adapter/preact.js +12 -0
  129. package/dist/entry/dev/adapter/preact.js.map +1 -0
  130. package/dist/entry/dev/adapter/react.js +12 -0
  131. package/dist/entry/dev/adapter/react.js.map +1 -0
  132. package/dist/entry/dev/adapter/solid.js +12 -0
  133. package/dist/entry/dev/adapter/solid.js.map +1 -0
  134. package/dist/entry/dev/css.js +3 -3
  135. package/dist/entry/dev/jsx-dev-runtime.js +2 -2
  136. package/dist/entry/dev/jsx-runtime.js +2 -2
  137. package/dist/entry/dev.js +13 -12
  138. package/dist/entry/prod/adapter/preact.js +12 -0
  139. package/dist/entry/prod/adapter/preact.js.map +1 -0
  140. package/dist/entry/prod/adapter/react.js +12 -0
  141. package/dist/entry/prod/adapter/react.js.map +1 -0
  142. package/dist/entry/prod/adapter/solid.js +12 -0
  143. package/dist/entry/prod/adapter/solid.js.map +1 -0
  144. package/dist/entry/prod/css.js +3 -3
  145. package/dist/entry/prod/extract.js +240 -3
  146. package/dist/entry/prod/extract.js.map +1 -0
  147. package/dist/entry/prod/jsx-dev-runtime.js +2 -2
  148. package/dist/entry/prod/jsx-runtime.js +2 -2
  149. package/dist/entry/prod/runtime.js +3 -4
  150. package/dist/entry/prod.js +85 -1201
  151. package/dist/entry/prod.js.map +1 -1
  152. package/dist/entry/rsc-dev/adapter/preact.js +12 -0
  153. package/dist/entry/rsc-dev/adapter/preact.js.map +1 -0
  154. package/dist/entry/rsc-dev/adapter/react.js +12 -0
  155. package/dist/entry/rsc-dev/adapter/react.js.map +1 -0
  156. package/dist/entry/rsc-dev/adapter/solid.js +12 -0
  157. package/dist/entry/rsc-dev/adapter/solid.js.map +1 -0
  158. package/dist/entry/rsc-dev/css.js +3 -3
  159. package/dist/entry/rsc-dev/dev.js +6 -10
  160. package/dist/entry/rsc-dev/dev.js.map +1 -1
  161. package/dist/entry/rsc-dev/jsx-dev-runtime.js +2 -2
  162. package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
  163. package/dist/entry/rsc-dev.js +323 -615
  164. package/dist/entry/rsc-dev.js.map +1 -1
  165. package/dist/entry/rsc-prod/adapter/preact.js +2 -0
  166. package/dist/entry/rsc-prod/adapter/react.js +2 -0
  167. package/dist/entry/rsc-prod/adapter/solid.js +2 -0
  168. package/dist/entry/rsc-prod/css.js +9 -3
  169. package/dist/entry/rsc-prod/css.js.map +1 -0
  170. package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
  171. package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
  172. package/dist/entry/rsc-prod/runtime.js +3 -4
  173. package/dist/entry/rsc-prod.js +241 -10
  174. package/dist/entry/rsc-prod.js.map +1 -0
  175. package/dist/{styleStore-ydQcDBD4.js → env-Db2cRt-h.js} +1256 -355
  176. package/dist/env-Db2cRt-h.js.map +1 -0
  177. package/dist/{jsx-A4cK517J.js → getClassName-DKtQl5ZX.js} +5 -11
  178. package/dist/getClassName-DKtQl5ZX.js.map +1 -0
  179. package/dist/{utils-hoYnMiA7.js → getClassName-DaZF5nfJ.js} +28 -65
  180. package/dist/getClassName-DaZF5nfJ.js.map +1 -0
  181. package/dist/getClassName-a6p2uMFM.js +536 -0
  182. package/dist/getClassName-a6p2uMFM.js.map +1 -0
  183. package/dist/{getClassName-oiQ8CnkS.js → getClassName-aD9zqg9U.js} +56 -14
  184. package/dist/getClassName-aD9zqg9U.js.map +1 -0
  185. package/dist/global-zYTvWskP.js +10 -0
  186. package/dist/{global-Cul1dX8k.js.map → global-zYTvWskP.js.map} +1 -1
  187. package/dist/{hash-Bycpk3MR.js → hash-BOlQThNz.js} +48 -4
  188. package/dist/hash-BOlQThNz.js.map +1 -0
  189. package/dist/index.js +10 -10
  190. package/dist/jsx/jsx-dev-runtime.js +2 -2
  191. package/dist/jsx/jsx-dev-runtime.server.js +1 -1
  192. package/dist/jsx/jsx-runtime.js +2 -2
  193. package/dist/jsx/jsx-runtime.server.js +1 -1
  194. package/dist/jsx-C2pnWLcb.js +39 -0
  195. package/dist/jsx-C2pnWLcb.js.map +1 -0
  196. package/dist/{jsx_dev_runtime-BQcRzl5D.js → jsx_dev_runtime-kSrmu6b1.js} +2 -3
  197. package/dist/{jsx_dev_runtime-BQcRzl5D.js.map → jsx_dev_runtime-kSrmu6b1.js.map} +1 -1
  198. package/dist/{jsx_runtime-BXcbW8Yp.js → jsx_runtime-BgK90E2O.js} +2 -3
  199. package/dist/{jsx_runtime-BXcbW8Yp.js.map → jsx_runtime-BgK90E2O.js.map} +1 -1
  200. package/dist/{jsx_runtime-B9KEoAQN.js → jsx_runtime-XJSHujgI.js} +2 -2
  201. package/dist/{jsx_runtime-B9KEoAQN.js.map → jsx_runtime-XJSHujgI.js.map} +1 -1
  202. package/dist/{loader-BAth2yZ1.mjs → loader-DHvgp0fK.mjs} +3 -3
  203. package/dist/{loader-BAth2yZ1.mjs.map → loader-DHvgp0fK.mjs.map} +1 -1
  204. package/dist/{misc-DFBKJGLT.mjs → misc-BuSLnvx0.mjs} +4 -4
  205. package/dist/misc-BuSLnvx0.mjs.map +1 -0
  206. package/dist/{namedTokens-BUa6raTb.js → namedTokens-D3tt-joz.js} +8 -6
  207. package/dist/namedTokens-D3tt-joz.js.map +1 -0
  208. package/dist/plugin/farm/index.mjs +4 -3
  209. package/dist/plugin/farm/index.mjs.map +1 -1
  210. package/dist/plugin/nextjs/index.mjs +5 -5
  211. package/dist/plugin/nextjs/index.mjs.map +1 -1
  212. package/dist/plugin/nextjs/loader.mjs +4 -4
  213. package/dist/plugin/parcel/index.cjs +2 -0
  214. package/dist/plugin/parcel/index.mjs +3 -1
  215. package/dist/plugin/parcel/optimizer.cjs +3 -2
  216. package/dist/plugin/parcel/optimizer.cjs.map +1 -1
  217. package/dist/plugin/parcel/optimizer.mjs +3 -2
  218. package/dist/plugin/parcel/optimizer.mjs.map +1 -1
  219. package/dist/plugin/parcel/resolver.cjs +1 -1
  220. package/dist/plugin/parcel/resolver.mjs +2 -2
  221. package/dist/plugin/parcel/runtime.cjs +1 -1
  222. package/dist/plugin/parcel/runtime.mjs +1 -1
  223. package/dist/plugin/parcel/transformer.cjs +1 -1
  224. package/dist/plugin/parcel/transformer.mjs +2 -2
  225. package/dist/plugin/rspack/index.mjs +3 -2
  226. package/dist/plugin/rspack/index.mjs.map +1 -1
  227. package/dist/plugin/vite/index.mjs +6 -6
  228. package/dist/plugin/vite/index.mjs.map +1 -1
  229. package/dist/plugin/webpack/index.mjs +3 -2
  230. package/dist/plugin/webpack/loader.mjs +2 -2
  231. package/dist/presets/tailwind/index.js +9 -7
  232. package/dist/presets/tailwind/index.js.map +1 -1
  233. package/dist/{assert-BGdigdr5.js → presets-DSanixJV.js} +106 -2
  234. package/dist/presets-DSanixJV.js.map +1 -0
  235. package/dist/{registry-CiwvMfx8.mjs → registry-r3BKWqpI.mjs} +2 -2
  236. package/dist/{registry-CiwvMfx8.mjs.map → registry-r3BKWqpI.mjs.map} +1 -1
  237. package/dist/resolveClassNameRuntime-D5a37GNr.js +63 -0
  238. package/dist/resolveClassNameRuntime-D5a37GNr.js.map +1 -0
  239. package/dist/{rules-DlXcch7-.js → rules-B0_rKPfB.js} +598 -132
  240. package/dist/rules-B0_rKPfB.js.map +1 -0
  241. package/dist/scope-BSuRLice.js +601 -0
  242. package/dist/scope-BSuRLice.js.map +1 -0
  243. package/dist/selector/index.js +1 -2
  244. package/dist/server.js +15 -13
  245. package/dist/server.js.map +1 -1
  246. package/dist/{shared-yDD0nfm1.cjs → shared-8_Msr7Q5.cjs} +1630 -597
  247. package/dist/shared-8_Msr7Q5.cjs.map +1 -0
  248. package/dist/{shared-x59dI2NW.mjs → shared-BGO_05rW.mjs} +4 -4
  249. package/dist/{shared-x59dI2NW.mjs.map → shared-BGO_05rW.mjs.map} +1 -1
  250. package/dist/sheet-BpLZIIuO.js +7 -0
  251. package/dist/{sheet-B-uJfHRY.js.map → sheet-BpLZIIuO.js.map} +1 -1
  252. package/dist/{sidecar-CJ6i4wmn.mjs → sidecar-Bu2x35JE.mjs} +3 -3
  253. package/dist/{sidecar-CJ6i4wmn.mjs.map → sidecar-Bu2x35JE.mjs.map} +1 -1
  254. package/dist/{styleStore-DJ0Msgkh.js → styleStore-BDy5TH6N.js} +5 -6
  255. package/dist/{styleStore-DJ0Msgkh.js.map → styleStore-BDy5TH6N.js.map} +1 -1
  256. package/dist/styleStore-DX3z_UVK.js +51 -0
  257. package/dist/styleStore-DX3z_UVK.js.map +1 -0
  258. package/dist/token-BsW_S8fN.js +138 -0
  259. package/dist/token-BsW_S8fN.js.map +1 -0
  260. package/dist/{trace-D8j96G57.js → trace-BdKEpgME.js} +2 -2
  261. package/dist/{trace-D8j96G57.js.map → trace-BdKEpgME.js.map} +1 -1
  262. package/dist/{trace-CO36aenp.js → trace-DcuMxR45.js} +3 -3
  263. package/dist/{trace-CO36aenp.js.map → trace-DcuMxR45.js.map} +1 -1
  264. package/dist/{transform-BTJOg8Hg.js → transform-BkrLIiIR.js} +2 -2
  265. package/dist/{transform-BTJOg8Hg.js.map → transform-BkrLIiIR.js.map} +1 -1
  266. package/dist/{style-DFFK06Of.js → types-BEUgXuu2.js} +356 -129
  267. package/dist/types-BEUgXuu2.js.map +1 -0
  268. package/dist/{utils-D2fygyTm.mjs → utils-BPDxr-oc.mjs} +4 -4
  269. package/dist/{utils-D2fygyTm.mjs.map → utils-BPDxr-oc.mjs.map} +1 -1
  270. package/dist/utils-CLnpwhJd.js +83 -0
  271. package/dist/utils-CLnpwhJd.js.map +1 -0
  272. package/dist/utils-CUl1BU40.js +72 -0
  273. package/dist/utils-CUl1BU40.js.map +1 -0
  274. package/dist/{utils-DTXCTUlS.mjs → utils-DZjLTV4D.mjs} +3 -3
  275. package/dist/{utils-DTXCTUlS.mjs.map → utils-DZjLTV4D.mjs.map} +1 -1
  276. package/dist/utils-okFWrQsg.js +41 -0
  277. package/dist/utils-okFWrQsg.js.map +1 -0
  278. package/dist/{utils-DVFxZnVC.js → utils-sBVZEq4u.js} +190 -144
  279. package/dist/utils-sBVZEq4u.js.map +1 -0
  280. package/dist/utils.js +4 -4
  281. package/dist/utils.js.map +1 -1
  282. package/dist/value-CpJpQ00y.js +145 -0
  283. package/dist/value-CpJpQ00y.js.map +1 -0
  284. package/dist/{webpack-BOU7_xld.mjs → webpack-DTKgR-HY.mjs} +5 -5
  285. package/dist/webpack-DTKgR-HY.mjs.map +1 -0
  286. package/entry/dev/adapter/preact.ts +8 -0
  287. package/entry/dev/adapter/react.ts +8 -0
  288. package/entry/dev/adapter/solid.ts +8 -0
  289. package/entry/prod/adapter/preact.ts +8 -0
  290. package/entry/prod/adapter/react.ts +8 -0
  291. package/entry/prod/adapter/solid.ts +8 -0
  292. package/entry/prod/config_debug.ts +2 -0
  293. package/entry/prod/index.ts +1 -1
  294. package/entry/prod/runtime.ts +3 -1
  295. package/entry/rsc_dev/adapter/preact.ts +1 -0
  296. package/entry/rsc_dev/adapter/react.ts +1 -0
  297. package/entry/rsc_dev/adapter/solid.ts +1 -0
  298. package/entry/rsc_prod/adapter/preact.ts +1 -0
  299. package/entry/rsc_prod/adapter/react.ts +1 -0
  300. package/entry/rsc_prod/adapter/solid.ts +1 -0
  301. package/entry/rsc_prod/config_debug.ts +6 -0
  302. package/entry/rsc_prod/index.ts +1 -1
  303. package/entry/shared/config_debug.ts +9 -0
  304. package/entry/shared/config_dev.ts +9 -7
  305. package/jsx/types/index.ts +3 -0
  306. package/jsx/types/preact.ts +14 -0
  307. package/jsx/{types.ts → types/react.ts} +2 -2
  308. package/jsx/types/solid.ts +32 -0
  309. package/package.json +78 -12
  310. package/plugin/bundler/farm/plugin.ts +2 -0
  311. package/plugin/bundler/parcel/optimizer.ts +1 -0
  312. package/plugin/bundler/parcel/plugin.ts +2 -0
  313. package/plugin/bundler/rspack/plugin.ts +1 -0
  314. package/plugin/bundler/vite/plugin.ts +3 -8
  315. package/plugin/bundler/vite/state.ts +2 -2
  316. package/plugin/bundler/webpack/plugin.ts +2 -1
  317. package/plugin/nextjs/plugin.ts +3 -0
  318. package/plugin/utils/compiler.ts +2 -0
  319. package/plugin/utils/runtimeEntry.ts +2 -2
  320. package/presets/tailwind/style/transform.ts +9 -3
  321. package/runtime/adapter/utils.ts +94 -0
  322. package/runtime/core/cache/combine.ts +76 -28
  323. package/runtime/core/cache/combineRuntime.ts +4 -0
  324. package/runtime/core/cache/index.ts +2 -1
  325. package/runtime/core/cache/item.ts +32 -13
  326. package/runtime/core/cache/itemWithResolver.ts +44 -0
  327. package/runtime/core/cache/pool.ts +15 -30
  328. package/runtime/core/cache/prop.ts +10 -8
  329. package/runtime/core/cache/result.ts +2 -2
  330. package/runtime/core/cache/stateItem.ts +16 -1
  331. package/runtime/core/cache/token.ts +20 -0
  332. package/runtime/core/cache/tokenValues.ts +19 -11
  333. package/runtime/core/combinedStyle.ts +4 -4
  334. package/runtime/extract/combineStyle.ts +211 -0
  335. package/runtime/extract/getClassName.ts +54 -17
  336. package/runtime/extract/index.ts +3 -1
  337. package/runtime/extract/token.ts +41 -0
  338. package/runtime/extract/tokenResolver.ts +17 -0
  339. package/runtime/sheet/rule.ts +3 -10
  340. package/runtime/style/scope.ts +0 -24
  341. package/runtime/style/style.ts +181 -6
  342. package/runtime/types.ts +3 -3
  343. package/style/classname.ts +12 -6
  344. package/style/important.ts +19 -0
  345. package/style/index.ts +2 -0
  346. package/style/style.ts +17 -5
  347. package/style/theme.ts +0 -1
  348. package/style/token.ts +26 -21
  349. package/style/tokens.ts +18 -12
  350. package/style/transform.ts +1 -1
  351. package/style/types.ts +6 -4
  352. package/style/utils/expose.ts +4 -3
  353. package/style/value.ts +26 -11
  354. package/style/valueRef.ts +1 -1
  355. package/style/weight.ts +21 -0
  356. package/utils/global.ts +1 -3
  357. package/utils/symbol.ts +3 -0
  358. package/dist/assert-BGdigdr5.js.map +0 -1
  359. package/dist/className-CKo4TxuT.js +0 -144
  360. package/dist/className-CKo4TxuT.js.map +0 -1
  361. package/dist/className-ZJ5pBA-o.js +0 -263
  362. package/dist/className-ZJ5pBA-o.js.map +0 -1
  363. package/dist/compiler-D5v5tJXI.mjs.map +0 -1
  364. package/dist/config-BEvP7108.js.map +0 -1
  365. package/dist/config-B_cbG3S6.js +0 -1
  366. package/dist/config-FIfi5aJ8.js.map +0 -1
  367. package/dist/config-OXHoDUIo.js +0 -6
  368. package/dist/css-CELBp6Gu.js +0 -58
  369. package/dist/css-CELBp6Gu.js.map +0 -1
  370. package/dist/css-DcuJ_jSH.js +0 -243
  371. package/dist/css-DcuJ_jSH.js.map +0 -1
  372. package/dist/css-dPoZJDQH.js +0 -807
  373. package/dist/css-dPoZJDQH.js.map +0 -1
  374. package/dist/css-oOt6ZR54.js +0 -237
  375. package/dist/css-oOt6ZR54.js.map +0 -1
  376. package/dist/data-CeYstKMP.js +0 -482
  377. package/dist/data-CeYstKMP.js.map +0 -1
  378. package/dist/debug-D96KGgpH.js.map +0 -1
  379. package/dist/dev-p8tW7X-A.js +0 -81
  380. package/dist/dev-p8tW7X-A.js.map +0 -1
  381. package/dist/elementMarker-CvqqIb7J.js.map +0 -1
  382. package/dist/extract-CzWJeQi8.js +0 -121
  383. package/dist/extract-CzWJeQi8.js.map +0 -1
  384. package/dist/extract-DeOytHKW.js +0 -2
  385. package/dist/getClassName-oiQ8CnkS.js.map +0 -1
  386. package/dist/global-Cul1dX8k.js +0 -14
  387. package/dist/global-zaCE-g1C.js.map +0 -1
  388. package/dist/hash-Bycpk3MR.js.map +0 -1
  389. package/dist/jsx-A4cK517J.js.map +0 -1
  390. package/dist/jsx-Ba-XV33u.js +0 -39
  391. package/dist/jsx-Ba-XV33u.js.map +0 -1
  392. package/dist/layer-CbQzwZF-.js +0 -94
  393. package/dist/layer-CbQzwZF-.js.map +0 -1
  394. package/dist/misc-DFBKJGLT.mjs.map +0 -1
  395. package/dist/namedTokens-BUa6raTb.js.map +0 -1
  396. package/dist/presets-BhXa232U.js +0 -108
  397. package/dist/presets-BhXa232U.js.map +0 -1
  398. package/dist/property-CF6JgpTq.js +0 -406
  399. package/dist/property-CF6JgpTq.js.map +0 -1
  400. package/dist/rules-DlXcch7-.js.map +0 -1
  401. package/dist/runtime-BKChZZ2-.js.map +0 -1
  402. package/dist/shared-yDD0nfm1.cjs.map +0 -1
  403. package/dist/sheet-B-uJfHRY.js +0 -7
  404. package/dist/style-91J0B5ef.js +0 -771
  405. package/dist/style-91J0B5ef.js.map +0 -1
  406. package/dist/style-Bw5ka-Nq.js.map +0 -1
  407. package/dist/style-DFFK06Of.js.map +0 -1
  408. package/dist/style-pz8e5To1.js +0 -5
  409. package/dist/styleStore-ydQcDBD4.js.map +0 -1
  410. package/dist/token-CKXUECuU.js +0 -76
  411. package/dist/token-CKXUECuU.js.map +0 -1
  412. package/dist/token-DTOyFLmp.js +0 -58
  413. package/dist/token-DTOyFLmp.js.map +0 -1
  414. package/dist/token-DT_sCPtm.js +0 -298
  415. package/dist/token-DT_sCPtm.js.map +0 -1
  416. package/dist/utils-Bmw655wa.js +0 -170
  417. package/dist/utils-Bmw655wa.js.map +0 -1
  418. package/dist/utils-DVFxZnVC.js.map +0 -1
  419. package/dist/utils-hoYnMiA7.js.map +0 -1
  420. package/dist/value-D-ZcRzLA.js +0 -42
  421. package/dist/value-D-ZcRzLA.js.map +0 -1
  422. package/dist/value-DvFkGBy2.js +0 -1029
  423. package/dist/value-DvFkGBy2.js.map +0 -1
  424. package/dist/value-dG9LK0Gq.js +0 -85
  425. package/dist/value-dG9LK0Gq.js.map +0 -1
  426. package/dist/valueRef-CsLVJwjA.js +0 -16
  427. package/dist/valueRef-CsLVJwjA.js.map +0 -1
  428. package/dist/webpack-BOU7_xld.mjs.map +0 -1
  429. package/dist/withTokens-LRidu3Vc.js +0 -95
  430. package/dist/withTokens-LRidu3Vc.js.map +0 -1
@@ -1,771 +0,0 @@
1
- import { c as isStyleTokenData, d as globalData, l as isStyleTokenOverrideData, o as getStyleTokenId } from "./token-CKXUECuU.js";
2
- import { _ as CSS_CONFIG, c as sanitizeCssIdentName, f as RUNTIME_CONFIG, i as getIdentifierSafeHash, l as createNameFormatter, n as getTokenVar, t as getTokenOverrideValue, u as hashString } from "./token-DT_sCPtm.js";
3
- 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-CKo4TxuT.js";
4
- 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";
5
- //#region config/config/dev.ts
6
- const DEV_CONFIG_DEFAULT = {
7
- isDev: false,
8
- isCheckSelectorEnabled: true,
9
- isSourcemapEnabled: true,
10
- isLocalClassNameEnabled: true,
11
- sheetMaxRules: 1e3,
12
- sheetStyleTagNonce: null,
13
- hashLength: null,
14
- stylePriorityMode: "sort",
15
- sourcemapLocationMode: "style",
16
- isElementClassNameEnabled: true
17
- };
18
- globalData("config.dev.isDev", () => ({ isDev: false }));
19
- const DEV_CONFIG = globalData("config.dev", () => ({ ...DEV_CONFIG_DEFAULT }));
20
- globalData("config.dev.plugin", () => ({ config: null }));
21
- globalData("config.dev.base", () => ({ config: null }));
22
- globalData("config.dev.utils", () => ({ config: null }));
23
- //#endregion
24
- //#region builder/data/is.ts
25
- function getSlotId(data) {
26
- return data[BUILDER_SLOT_ID];
27
- }
28
- function getScopeTargetSlotId(data) {
29
- return data[BUILDER_SCOPE_ID];
30
- }
31
- function getScopeTargetScope(data) {
32
- return data[BUILDER_SCOPE];
33
- }
34
- function isStyleData(value) {
35
- return getBuilderType(value) === 1;
36
- }
37
- function isSlotData(value) {
38
- return getBuilderType(value) === 2;
39
- }
40
- function isSlotOverrideData(value) {
41
- return getBuilderType(value) === 3;
42
- }
43
- function isScopeData(value) {
44
- return getBuilderType(value) === 4;
45
- }
46
- function isScopeTargetData(value) {
47
- return getBuilderType(value) === 5;
48
- }
49
- function isThemeData(value) {
50
- return getBuilderType(value) === 6;
51
- }
52
- function getBuilderType(value) {
53
- if (!value || typeof value !== "object" && typeof value !== "function") return null;
54
- return value[BUILDER_TYPE];
55
- }
56
- const formatClassName = createNameFormatter([
57
- "atRule",
58
- "scopeSelector",
59
- "property",
60
- "selector",
61
- "value"
62
- ]);
63
- const formatScopeClassName = createNameFormatter(["className"]);
64
- const formatTransformClassName = createNameFormatter(["className"]);
65
- function getDebugClassName(format, hash, info) {
66
- return formatClassName(format || "[(atRule)-][(scopeSelector)-](property)[-(selector)][-(value)]--$hash", hash, info);
67
- }
68
- function getDebugTransformClassName(format, hash, info) {
69
- return formatTransformClassName(format || "(className)--$hash", hash, info);
70
- }
71
- function getDebugScopeClassName(format, info) {
72
- return formatScopeClassName(format || "-(className)", null, info);
73
- }
74
- //#endregion
75
- //#region atomic/utils/debug.ts
76
- function normalizeDebugKeywordValue(value) {
77
- const normalized = value.trim().toLowerCase();
78
- return /^[a-z][a-z0-9-]*$/.test(normalized) ? normalized : null;
79
- }
80
- function sanitizeDebugName(value) {
81
- if (!value) return "";
82
- return sanitizeCssIdentName(value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), "");
83
- }
84
- function normalizePropertyName(property) {
85
- return property.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
86
- }
87
- function sanitizeDebugPropertyName(property) {
88
- let name = property;
89
- if (name.charCodeAt(0) === 45 && name.charCodeAt(1) === 45) name = name.slice(2);
90
- return name.replace(/[^a-z0-9_-]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, "");
91
- }
92
- //#endregion
93
- //#region atomic/debug/value.ts
94
- function getDebugValueName(value) {
95
- if (!value) return {
96
- value: null,
97
- arbitraryValue: null
98
- };
99
- const normalized = value.trim().toLowerCase();
100
- if (!normalized) return {
101
- value: null,
102
- arbitraryValue: null
103
- };
104
- 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 {
105
- value: null,
106
- arbitraryValue: null
107
- };
108
- if (/^[a-z][a-z0-9-]*$/.test(normalized)) return {
109
- value: normalized,
110
- arbitraryValue: null
111
- };
112
- 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, "");
113
- if (!name) return {
114
- value: null,
115
- arbitraryValue: null
116
- };
117
- return {
118
- value: null,
119
- arbitraryValue: name
120
- };
121
- }
122
- //#endregion
123
- //#region atomic/debug/property/data.ts
124
- const PROPERTY_ALIASES = {
125
- "border-radius": "radius",
126
- "flex-direction": "flex",
127
- "font-style": "font",
128
- "font-weight": "font",
129
- "grid-template-columns": "grid-cols",
130
- "grid-template-rows": "grid-rows",
131
- "align-items": "items",
132
- "justify-content": "justify",
133
- "z-index": "zindex",
134
- "pointer-events": "pointer"
135
- };
136
- const KEYWORD_VALUE_PROPERTIES = new Set([
137
- "align-content",
138
- "align-items",
139
- "align-self",
140
- "background-repeat",
141
- "background-size",
142
- "border-collapse",
143
- "border-style",
144
- "box-sizing",
145
- "clear",
146
- "cursor",
147
- "display",
148
- "flex-direction",
149
- "flex-wrap",
150
- "float",
151
- "font-weight",
152
- "font-style",
153
- "justify-content",
154
- "justify-items",
155
- "justify-self",
156
- "list-style-position",
157
- "list-style-type",
158
- "object-fit",
159
- "object-position",
160
- "overflow",
161
- "overflow-x",
162
- "overflow-y",
163
- "pointer-events",
164
- "place-content",
165
- "place-items",
166
- "place-self",
167
- "position",
168
- "resize",
169
- "table-layout",
170
- "text-align",
171
- "text-decoration-line",
172
- "text-transform",
173
- "user-select",
174
- "vertical-align",
175
- "visibility",
176
- "white-space"
177
- ]);
178
- const ARBITRARY_VALUE_PROPERTIES = new Set(["font-weight"]);
179
- //#endregion
180
- //#region atomic/debug/property/property.ts
181
- function getDebugPropertyName(property, value) {
182
- if (!property) return null;
183
- const normalized = normalizePropertyName(property);
184
- const name = PROPERTY_ALIASES[normalized] || sanitizeDebugPropertyName(normalized);
185
- if (!name) return null;
186
- return {
187
- property: name,
188
- ...withKeywordValueFallback(normalized, value, withArbitraryValueFallback(normalized, getDebugValueName(value)))
189
- };
190
- }
191
- function withArbitraryValueFallback(property, valueName) {
192
- if (!valueName.arbitraryValue || ARBITRARY_VALUE_PROPERTIES.has(property)) return valueName;
193
- return {
194
- value: valueName.value,
195
- arbitraryValue: null
196
- };
197
- }
198
- function withKeywordValueFallback(property, value, valueName) {
199
- if (valueName.value || valueName.arbitraryValue) return valueName;
200
- if (!KEYWORD_VALUE_PROPERTIES.has(property)) return valueName;
201
- const normalized = normalizeDebugKeywordValue(value);
202
- if (!normalized) return valueName;
203
- return {
204
- value: normalized,
205
- arbitraryValue: null
206
- };
207
- }
208
- //#endregion
209
- //#region atomic/debug/selector.ts
210
- function getDebugSelectorName(selector) {
211
- if (!selector) return null;
212
- const normalized = selector.trim().toLowerCase();
213
- if (/^[a-z0-9]+$/.test(normalized)) return null;
214
- 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, ""));
215
- }
216
- function getDebugAtRuleName(selector) {
217
- if (!selector || Array.isArray(selector) && selector.length === 0) return null;
218
- return validateName((Array.isArray(selector) ? selector.map(parseAtRule).filter(Boolean).join("-") : parseAtRule(selector)).replace(/[-_]+/g, "-").replace(/^-+|-+$/g, ""));
219
- }
220
- function compressQuery(query) {
221
- 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, "");
222
- }
223
- function validateName(name) {
224
- if (!name || name === "selector" || name.length < 2) return null;
225
- return name;
226
- }
227
- function parseAtRule(rule) {
228
- const normalized = rule.trim().toLowerCase();
229
- if (normalized.startsWith("@media")) return compressQuery(normalized.slice(6));
230
- if (normalized.startsWith("@container")) return compressQuery(normalized.slice(10));
231
- if (normalized.startsWith("@supports")) return compressQuery(normalized.slice(9));
232
- return compressQuery(normalized);
233
- }
234
- //#endregion
235
- //#region atomic/utils/selector.ts
236
- function getSelectorText(selector) {
237
- return Array.isArray(selector) ? selector[0] : selector;
238
- }
239
- function getSelectorHash(selector) {
240
- return Array.isArray(selector) ? selector.join("|") : selector;
241
- }
242
- function getSelectorPriority(selector) {
243
- if (!selector) return 0;
244
- return Array.isArray(selector) ? selector[1] : 0;
245
- }
246
- //#endregion
247
- //#region atomic/className.ts
248
- function getAtomicClassName(property, priority, value, selector, parentSelector, atRule, callsite, localClassName, debugClassName, classNameFormat, transformClassName, transformClassNameFormat, hashLength = null) {
249
- let hash = property;
250
- hash += "\n" + (priority || "");
251
- hash += "\n" + value;
252
- hash += "\n" + (selector ? getSelectorHash(selector) : "");
253
- hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
254
- hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
255
- hash += "\n" + getCallsiteHash(callsite, localClassName);
256
- hash = getIdentifierSafeHash(hash, hashLength ?? getRuntimeClassNameHashLength(debugClassName));
257
- if (!debugClassName) return hash;
258
- if (transformClassName) return getDebugTransformClassName(transformClassNameFormat, hash, { className: transformClassName });
259
- const propertyName = getDebugPropertyName(property, value);
260
- return getDebugClassName(classNameFormat, hash, {
261
- atRule: atRule ? getDebugAtRuleName(atRule.map(getSelectorText)) : null,
262
- scopeSelector: parentSelector ? getDebugSelectorName(getSelectorText(parentSelector)) : null,
263
- selector: selector ? getDebugSelectorName(getSelectorText(selector)) : null,
264
- property: propertyName ? propertyName.property : property,
265
- value: propertyName ? propertyName.value ?? propertyName.arbitraryValue : null
266
- });
267
- }
268
- function getRuntimeClassNameHashLength(debugClassName) {
269
- if (debugClassName && DEV_CONFIG.isDev) return DEV_CONFIG.hashLength ?? CSS_CONFIG.hashLength ?? 3;
270
- return CSS_CONFIG.hashLength ?? 7;
271
- }
272
- function getScopeClassName(className, scopeClassNameFormat) {
273
- return getDebugScopeClassName(scopeClassNameFormat, { className });
274
- }
275
- function getClassNameDedupe(property, priority, selector, parentSelector, atRule) {
276
- let hash = property;
277
- hash += "\n" + (priority || "");
278
- hash += "\n" + (selector ? getSelectorHash(selector) : "");
279
- hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
280
- hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
281
- return hashString(hash);
282
- }
283
- function getCallsiteHash(callsite, localClassName) {
284
- if (!localClassName || !callsite) return "";
285
- return callsite.filePath + "\n" + callsite.line + ":" + callsite.column;
286
- }
287
- //#endregion
288
- //#region runtime/core/combinedStyle.ts
289
- const targets = globalData("runtime.combinedStyle.targets", () => /* @__PURE__ */ new WeakMap());
290
- function createCombinedStyle(meta, getField) {
291
- const target = {
292
- ...meta,
293
- cache: Object.create(null),
294
- getField
295
- };
296
- const proxyTarget = {};
297
- const proxy = new Proxy(proxyTarget, handlers);
298
- targets.set(proxyTarget, target);
299
- targets.set(proxy, target);
300
- return proxy;
301
- }
302
- function isCombinedStyle(value) {
303
- return !!value && typeof value === "object" && targets.has(value);
304
- }
305
- function getCombinedStyleStyles(style) {
306
- return getTarget(style).styles;
307
- }
308
- function getCombinedStyleScopes(style) {
309
- return getTarget(style).scopes;
310
- }
311
- function getCombinedStyleTokens(style) {
312
- return getTarget(style).tokens;
313
- }
314
- const handlers = { get(proxy, prop) {
315
- const target = getTarget(proxy);
316
- if (hasOwn(target.cache, prop)) return target.cache[prop];
317
- const value = target.getField(target, prop);
318
- if (value && typeof value === "object") target.cache[prop] = value;
319
- return value;
320
- } };
321
- function getTarget(value) {
322
- const target = targets.get(value);
323
- if (!target) throw new Error("[fluentic-style] Expected combined style.");
324
- return target;
325
- }
326
- //#endregion
327
- //#region runtime/core/cache/item.ts
328
- const directStyleItemCache = globalData("runtime.directStyleItemCache", () => /* @__PURE__ */ new WeakMap());
329
- function isResolvedStyleItem(value) {
330
- return isResolvedStyleItem$1(value);
331
- }
332
- function createResolvedStyleItem(data, scopes, tokens = null) {
333
- return createStyleItem({
334
- data,
335
- items: resolveItems(data, scopes)
336
- }, tokens);
337
- }
338
- function createResolvedStyleItemFromItems(item, tokens) {
339
- return createStyleItem({
340
- data: item.data,
341
- items: item.items
342
- }, tokens);
343
- }
344
- function getDirectStyleItem(item) {
345
- let cached = directStyleItemCache.get(item);
346
- if (!cached) {
347
- cached = createResolvedStyleItem(item, []);
348
- directStyleItemCache.set(item, cached);
349
- }
350
- return cached;
351
- }
352
- function getStyleTokenValues(value) {
353
- if (isCombinedStyle(value)) return getCombinedStyleTokens(value);
354
- return getResolvedStyleItemTokenValues(value);
355
- }
356
- function createCombinedStyleFacade(styles, scopes) {
357
- return createCombinedStyle({
358
- styles,
359
- scopes,
360
- tokens: null
361
- }, getStyleField);
362
- }
363
- function createCombinedStyleTokenWrapper(style, tokens) {
364
- return createCombinedStyle({
365
- styles: getCombinedStyleStyles(style),
366
- scopes: getCombinedStyleScopes(style),
367
- tokens
368
- }, getTokenField(style));
369
- }
370
- const getStyleField = (meta, prop) => {
371
- const value = meta.styles?.[prop] ?? null;
372
- if (isStyleData(value) || isSlotData(value)) return createResolvedStyleItem(value, meta.scopes);
373
- if (value && typeof value === "object") return createCombinedStyleFacade(value, meta.scopes);
374
- return value;
375
- };
376
- function getTokenField(base) {
377
- return (meta, prop) => {
378
- const value = base?.[prop] ?? null;
379
- if (isResolvedStyleItem(value)) return createStyleItem({
380
- data: value.data,
381
- items: value.items
382
- }, meta.tokens);
383
- if (isCombinedStyle(value)) return createCombinedStyleTokenWrapper(value, meta.tokens);
384
- return value;
385
- };
386
- }
387
- function createStyleItem(item, tokens = null) {
388
- markResolvedStyleItem(item);
389
- if (tokens) setResolvedStyleItemTokenValues(item, tokens);
390
- return item;
391
- }
392
- function resolveItems(data, scopes) {
393
- const items = [];
394
- const stateItems = data[BUILDER_STATE]?.items ?? [];
395
- const slotId = isSlotData(data) ? getSlotId(data) : null;
396
- for (let i = 0, len = stateItems.length; i < len; i++) {
397
- const item = stateItems[i];
398
- if (Array.isArray(item)) {
399
- items.push(item);
400
- continue;
401
- }
402
- if (isStyleTokenOverrideData(item)) continue;
403
- if (slotId && item.type !== 2) continue;
404
- items.push(item);
405
- }
406
- if (!slotId) return items;
407
- for (let i = 0, len = scopes.length; i < len; i++) {
408
- const boundScope = scopes[i];
409
- const scope = getScopeTargetScope(boundScope);
410
- if (!scope) continue;
411
- const scopeItems = scope[BUILDER_STATE]?.items;
412
- if (!scopeItems) continue;
413
- const targetSlotId = getScopeTargetSlotId(boundScope);
414
- for (let j = 0, len = scopeItems.length; j < len; j++) {
415
- const item = scopeItems[j];
416
- if (Array.isArray(item)) {
417
- if (item[1] === slotId) items.push(item);
418
- const hasParentSelector = isExtractedScopeParentMarker(item[4]) || isExtractedScopeParentMarker(item[5]);
419
- if (targetSlotId === slotId && hasParentSelector) items.push(getScopeParentItem(String(item[3])));
420
- continue;
421
- }
422
- if (isStyleTokenOverrideData(item)) continue;
423
- if (item.type !== 4) continue;
424
- if (item.slotId === slotId) items.push(item);
425
- if (item.parentSelector && targetSlotId === slotId) items.push(getScopeParentItem(item.className));
426
- }
427
- }
428
- return items;
429
- }
430
- function getScopeParentItem(className) {
431
- const parentClassName = getScopeClassName(className, CSS_CONFIG.scopeClassNameFormat || null);
432
- return [parentClassName, parentClassName];
433
- }
434
- function isExtractedScopeParentMarker(value) {
435
- return value === 1 || value === true;
436
- }
437
- //#endregion
438
- //#region runtime/core/cache/tokenValues.ts
439
- function createMutableTokenValues(base) {
440
- return {
441
- ids: base ? base.ids.slice() : null,
442
- values: base ? base.values.slice() : null,
443
- lookup: base ? { ...base.lookup } : null,
444
- index: base ? createTokenIndexLookup(base.ids) : null
445
- };
446
- }
447
- function addTokenOverride(values, item) {
448
- if (!isStyleTokenOverrideData(item)) return false;
449
- addTokenValue(values, getStyleTokenId(item), getTokenOverrideValue(item, CSS_CONFIG.tokenNameFormat ?? null));
450
- return true;
451
- }
452
- function addTokenValue(values, id, value) {
453
- if (!values.ids) values.ids = [];
454
- if (!values.values) values.values = [];
455
- if (!values.lookup) values.lookup = Object.create(null);
456
- if (!values.index) values.index = Object.create(null);
457
- const ids = values.ids;
458
- const tokenValues = values.values;
459
- const lookup = values.lookup;
460
- const indexLookup = values.index;
461
- const index = indexLookup[id];
462
- if (index === void 0) {
463
- indexLookup[id] = ids.push(id) - 1;
464
- tokenValues.push(value);
465
- } else tokenValues[index] = value;
466
- lookup[id] = value;
467
- }
468
- function addTokenValues(values, next) {
469
- if (!next) return;
470
- for (let i = 0, len = next.ids.length; i < len; i++) addTokenValue(values, next.ids[i], next.values[i]);
471
- }
472
- function addTokenOverrides(values, overrides) {
473
- for (let i = 0, len = overrides.length; i < len; i++) addTokenOverride(values, overrides[i]);
474
- }
475
- function finishTokenValues(base, values) {
476
- if (!values.ids || !values.values || !values.lookup) return null;
477
- if (isSameTokenValues(base, values.ids, values.values)) return base;
478
- return {
479
- ids: values.ids,
480
- values: values.values,
481
- lookup: values.lookup
482
- };
483
- }
484
- function mergeTokenValues(base, next) {
485
- if (!next) return base;
486
- if (!base) return next;
487
- const values = createMutableTokenValues(base);
488
- addTokenValues(values, next);
489
- return finishTokenValues(base, values);
490
- }
491
- function mergeTokenOverrides(base, overrides) {
492
- if (!overrides.length) return base;
493
- const values = createMutableTokenValues(base);
494
- addTokenOverrides(values, overrides);
495
- return finishTokenValues(base, values);
496
- }
497
- function createTokenIndexLookup(ids) {
498
- const lookup = Object.create(null);
499
- for (let i = 0, len = ids.length; i < len; i++) lookup[ids[i]] = i;
500
- return lookup;
501
- }
502
- function isSameTokenValues(base, ids, values) {
503
- if (!base || base.ids.length !== ids.length) return false;
504
- const baseLookup = base.lookup;
505
- for (let i = 0, len = ids.length; i < len; i++) {
506
- if (!hasOwn(baseLookup, ids[i])) return false;
507
- if (baseLookup[ids[i]] !== values[i]) return false;
508
- }
509
- return true;
510
- }
511
- //#endregion
512
- //#region runtime/core/getToken.ts
513
- function getToken(value) {
514
- if (isStyleTokenData(value)) return getTokenVar(value, CSS_CONFIG.tokenNameFormat ?? null);
515
- return value;
516
- }
517
- //#endregion
518
- //#region runtime/style/scope.ts
519
- function combineScope(...scopes) {
520
- const shortcut = resolveSingleScopeTarget(scopes);
521
- if (shortcut !== null) return (target) => shortcut(target);
522
- return (target) => resolveScopeTargets(target, scopes);
523
- }
524
- function bindScope(target, ...scopes) {
525
- const shortcut = resolveSingleScopeTarget(scopes);
526
- if (shortcut !== null) return shortcut(target);
527
- return resolveScopeTargets(target, scopes);
528
- }
529
- function resolveSingleScopeTarget(scopes) {
530
- if (scopes.length !== 1) return null;
531
- const scope = scopes[0];
532
- if (!scope) return () => [];
533
- if (Array.isArray(scope) || !isScopeData(scope)) return null;
534
- return (target) => [scope(target)];
535
- }
536
- function resolveScopeTargets(target, scopes) {
537
- const targets = [];
538
- const stack = scopes.slice();
539
- while (stack.length > 0) {
540
- const item = stack.pop();
541
- if (!item) continue;
542
- if (Array.isArray(item)) {
543
- for (let i = item.length - 1; i >= 0; i--) stack.push(item[i]);
544
- continue;
545
- }
546
- if (isScopeData(item)) targets.push(item(target));
547
- }
548
- return targets;
549
- }
550
- //#endregion
551
- //#region runtime/core/cache/pool.ts
552
- const DEFAULT_TTL = 1e3 * 60 * 5;
553
- const TOKEN_WRAPPER_CACHE_LIMIT = 32;
554
- let configuredPool = null;
555
- let configuredPoolTTL = -1;
556
- function getCombinedStylePool() {
557
- const ttl = RUNTIME_CONFIG.runtimeCacheTTL;
558
- if (!configuredPool || configuredPoolTTL !== ttl) {
559
- configuredPool = createCombinedStylePool(ttl);
560
- configuredPoolTTL = ttl;
561
- }
562
- return configuredPool;
563
- }
564
- function createCombinedStylePool(ttl = DEFAULT_TTL) {
565
- const root = createPoolNode();
566
- let timer = null;
567
- return {
568
- get(styles, inheritedScopes, items, prevTokensData = null) {
569
- if (ttl === 0) {
570
- const collected = collectItems(null, items, prevTokensData);
571
- return {
572
- style: createCombinedStyleFacade(styles, concatScopes(inheritedScopes, collected.scopes)),
573
- tokenCache: null,
574
- tokens: collected.tokens
575
- };
576
- }
577
- const now = Date.now();
578
- let node = getPoolChild(root, styles);
579
- node = walkScopes(node, inheritedScopes);
580
- const collected = collectItems(node, items, prevTokensData);
581
- node = collected.node ?? node;
582
- node.value.updatedAt = now;
583
- if (node.value.style) {
584
- scheduleCleanup();
585
- return {
586
- style: node.value.style,
587
- tokenCache: collected.tokens ? getTokenWrapperCache(node.value) : null,
588
- tokens: collected.tokens
589
- };
590
- }
591
- const allScopes = concatScopes(inheritedScopes, collected.scopes);
592
- node.value.style = createCombinedStyleFacade(styles, allScopes);
593
- scheduleCleanup();
594
- return {
595
- style: node.value.style,
596
- tokenCache: collected.tokens ? getTokenWrapperCache(node.value) : null,
597
- tokens: collected.tokens
598
- };
599
- },
600
- cleanup(now = Date.now()) {
601
- cleanupNode(root, now, ttl);
602
- }
603
- };
604
- function scheduleCleanup() {
605
- if (timer) return;
606
- timer = setTimeout(() => {
607
- timer = null;
608
- cleanupNode(root, Date.now(), ttl);
609
- }, Math.max(ttl, 0));
610
- timer.unref?.();
611
- }
612
- }
613
- function getCachedTokenWrapper(cache, tokens, create) {
614
- if (!cache) return create();
615
- const key = getTokenWrapperCacheKey(tokens);
616
- const cached = cache.get(key);
617
- if (cached) {
618
- cache.delete(key);
619
- cache.set(key, cached);
620
- return cached;
621
- }
622
- const value = create();
623
- cache.set(key, value);
624
- if (cache.size > TOKEN_WRAPPER_CACHE_LIMIT) {
625
- const oldest = cache.keys().next().value;
626
- if (oldest !== void 0) cache.delete(oldest);
627
- }
628
- return value;
629
- }
630
- function getTokenWrapperCache(node) {
631
- if (!node.tokenCache) node.tokenCache = /* @__PURE__ */ new Map();
632
- return node.tokenCache;
633
- }
634
- function getTokenWrapperCacheKey(tokens) {
635
- return tokens.ids.join("") + "" + tokens.values.join("");
636
- }
637
- function collectItems(node, items, prevTokensData) {
638
- const scopes = [];
639
- const tokens = createMutableTokenValues(prevTokensData);
640
- let currentNode = node;
641
- for (let i = 0, len = items.length; i < len; i++) {
642
- const item = items[i];
643
- if (addTokenOverride(tokens, item)) continue;
644
- if (isScopeTargetData(item)) {
645
- scopes.push(item);
646
- currentNode = currentNode ? walkScope(currentNode, item) : null;
647
- addTokenValues(tokens, getScopeTokenValues(currentNode, getScopeTargetScope(item)));
648
- }
649
- }
650
- const tokensData = finishTokenValues(prevTokensData, tokens);
651
- if (!tokensData) return {
652
- node: currentNode,
653
- scopes,
654
- tokens: null
655
- };
656
- return {
657
- node: currentNode,
658
- scopes,
659
- tokens: tokensData
660
- };
661
- }
662
- function walkScopes(node, scopes) {
663
- for (let i = 0, len = scopes.length; i < len; i++) {
664
- const scope = scopes[i];
665
- if (!scope) continue;
666
- node = walkScope(node, scope);
667
- }
668
- return node;
669
- }
670
- function walkScope(node, scope) {
671
- node = getPoolChild(node, getScopeTargetScope(scope));
672
- node = getPoolChild(node, getScopeTargetSlotId(scope));
673
- return node;
674
- }
675
- function getScopeTokenValues(node, scope) {
676
- const tokenNameFormat = CSS_CONFIG.tokenNameFormat;
677
- if (node && node.value.h && node.value.f === tokenNameFormat) return node.value.s;
678
- const values = createMutableTokenValues(null);
679
- const items = scope[BUILDER_STATE].items;
680
- for (let i = 0, len = items.length; i < len; i++) addTokenOverride(values, items[i]);
681
- const tokens = finishTokenValues(null, values);
682
- if (node) {
683
- node.value.h = true;
684
- node.value.s = tokens;
685
- node.value.f = tokenNameFormat;
686
- }
687
- return tokens;
688
- }
689
- function concatScopes(inheritedScopes, scopes) {
690
- const items = [];
691
- for (let i = 0, len = inheritedScopes.length; i < len; i++) {
692
- const item = inheritedScopes[i];
693
- if (item) items.push(item);
694
- }
695
- for (let i = 0, len = scopes.length; i < len; i++) {
696
- const item = scopes[i];
697
- if (item) items.push(item);
698
- }
699
- return items;
700
- }
701
- function getPoolChild(node, key) {
702
- return getCacheTreeChild(node, key, createPoolValue);
703
- }
704
- function createPoolNode() {
705
- return createCacheTreeNode(createPoolValue());
706
- }
707
- function createPoolValue() {
708
- return {
709
- style: null,
710
- tokenCache: null,
711
- h: false,
712
- s: null,
713
- f: void 0,
714
- updatedAt: Date.now()
715
- };
716
- }
717
- function cleanupNode(node, now, ttl) {
718
- for (const [key, child] of node.children) {
719
- cleanupNode(child, now, ttl);
720
- if (child.value.style && now - child.value.updatedAt >= ttl) child.value.style = null;
721
- if (!child.value.style && !child.children.size) node.children.delete(key);
722
- }
723
- }
724
- //#endregion
725
- //#region runtime/core/cache/combine.ts
726
- function getCombinedStyle(styles, args) {
727
- const normalized = normalizeStyleItems(styles, args);
728
- const result = getCombinedStylePool().get(styles, normalized.inheritedScopes, normalized.items, normalized.tokens);
729
- return result.tokens ? getCachedTokenWrapper(result.tokenCache, result.tokens, () => createCombinedStyleTokenWrapper(result.style, result.tokens)) : result.style;
730
- }
731
- function normalizeStyleItems(styles, args) {
732
- const result = {
733
- inheritedScopes: [],
734
- items: [],
735
- tokens: null
736
- };
737
- for (let i = 0, len = args.length; i < len; i++) collectStyleArg(styles, args[i], result);
738
- return result;
739
- }
740
- function collectStyleArg(styles, arg, result) {
741
- if (!arg) return;
742
- if (Array.isArray(arg)) {
743
- for (let i = 0, len = arg.length; i < len; i++) collectStyleArg(styles, arg[i], result);
744
- return;
745
- }
746
- if (RUNTIME_CONFIG.isHoist && isExtractedTokenBoundData(arg)) {
747
- const bound = getExtractedTokenBoundData(arg);
748
- result.tokens = mergeTokenOverrides(result.tokens, bound.tokens);
749
- collectStyleArg(styles, bound.data, result);
750
- return;
751
- }
752
- if (isCombinedStyle(arg)) {
753
- if (getCombinedStyleStyles(arg) !== styles) throw new TypeError("[fluentic-style] combineStyle can only carry a combined style created from the same styles object.");
754
- const scopes = getCombinedStyleScopes(arg);
755
- for (let i = 0, len = scopes.length; i < len; i++) result.inheritedScopes.push(scopes[i]);
756
- result.tokens = mergeTokenValues(result.tokens, getStyleTokenValues(arg));
757
- return;
758
- }
759
- result.items.push(arg);
760
- }
761
- //#endregion
762
- //#region runtime/style/style.ts
763
- const combineStyleBase = (styles, ...args) => getCombinedStyle(styles, args);
764
- const combineStyleFor = (styles) => {
765
- return (...args) => combineStyleBase(styles, ...args);
766
- };
767
- const combineStyle = Object.assign(combineStyleBase, { for: combineStyleFor });
768
- //#endregion
769
- 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, DEV_CONFIG as w, isSlotOverrideData as x, isScopeTargetData as y };
770
-
771
- //# sourceMappingURL=style-91J0B5ef.js.map