@fluentic/style 0.1.0-beta.1 → 0.1.0-beta.11

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 (491) hide show
  1. package/CHANGELOG.md +156 -2
  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 +169 -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-DENc3a2R.mjs → compiler-C3CEGGtI.mjs} +2335 -638
  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 +582 -664
  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-B5Kw0DD-.mjs → loader-_-VjzlrX.mjs} +13 -14
  220. package/dist/loader-_-VjzlrX.mjs.map +1 -0
  221. package/dist/{misc-DCdYYyhK.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 +151 -31
  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/{assert-BGdigdr5.js → presets-DSanixJV.js} +106 -2
  251. package/dist/presets-DSanixJV.js.map +1 -0
  252. package/dist/{registry-yHLRxyoo.mjs → registry-w8ET5R7v.mjs} +2 -2
  253. package/dist/{registry-yHLRxyoo.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 +1 -2
  261. package/dist/server.js +17 -11
  262. package/dist/server.js.map +1 -1
  263. package/dist/{shared-CxbHR89f.mjs → shared-C_cYxNzz.mjs} +4 -4
  264. package/dist/{shared-CxbHR89f.mjs.map → shared-C_cYxNzz.mjs.map} +1 -1
  265. package/dist/{shared-CBArHB9-.cjs → shared-PK52rW6T.cjs} +2338 -635
  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-BFakLl0X.mjs → sidecar-BhvmXYsD.mjs} +3 -3
  270. package/dist/{sidecar-BFakLl0X.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-Bdbqn0f8.mjs → utils-DND33M6y.mjs} +3 -3
  286. package/dist/{utils-Bdbqn0f8.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-Dh6lox2l.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 +110 -8
  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 +11 -6
  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 +249 -35
  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/sheet/dev/dev_layer.ts +18 -7
  389. package/sheet/dev/dev_sort.ts +45 -11
  390. package/sheet/prod.ts +18 -7
  391. package/sheet/types.ts +2 -0
  392. package/sheet/utils/layer.ts +33 -0
  393. package/style/classname.ts +47 -0
  394. package/style/important.ts +19 -0
  395. package/style/index.ts +3 -0
  396. package/style/style.ts +47 -16
  397. package/style/theme.ts +4 -3
  398. package/style/token.ts +26 -21
  399. package/style/tokens.ts +18 -12
  400. package/style/transform.ts +41 -2
  401. package/style/types.ts +6 -4
  402. package/style/utils/expose.ts +4 -3
  403. package/style/value.ts +26 -11
  404. package/style/valueRef.ts +1 -1
  405. package/style/weight.ts +21 -0
  406. package/utils/global.ts +1 -3
  407. package/utils/hash.ts +4 -0
  408. package/utils/symbol.ts +3 -0
  409. package/atomic/layer/README.md +0 -116
  410. package/atomic/utils/css.ts +0 -49
  411. package/dist/assert-BGdigdr5.js.map +0 -1
  412. package/dist/className-C1Ht5Wvv.js +0 -144
  413. package/dist/className-C1Ht5Wvv.js.map +0 -1
  414. package/dist/className-DC2Cq8p3.js +0 -251
  415. package/dist/className-DC2Cq8p3.js.map +0 -1
  416. package/dist/compiler-DENc3a2R.mjs.map +0 -1
  417. package/dist/config-BryWDfQX.js +0 -25
  418. package/dist/config-BryWDfQX.js.map +0 -1
  419. package/dist/config-DKHXWhe1.js +0 -1
  420. package/dist/config-Di2VYYKV.js +0 -6
  421. package/dist/config-DloHOG6I.js +0 -13
  422. package/dist/config-DloHOG6I.js.map +0 -1
  423. package/dist/css-BowBszUt.js +0 -243
  424. package/dist/css-BowBszUt.js.map +0 -1
  425. package/dist/css-ByOrugEX.js +0 -805
  426. package/dist/css-ByOrugEX.js.map +0 -1
  427. package/dist/css-DcazYor9.js +0 -235
  428. package/dist/css-DcazYor9.js.map +0 -1
  429. package/dist/css_extra-DlOnsnR1.js +0 -8
  430. package/dist/css_extra-oIi3UEPK.js.map +0 -1
  431. package/dist/data-BsqOa5br.js +0 -473
  432. package/dist/data-BsqOa5br.js.map +0 -1
  433. package/dist/debug-BAw63qX6.js +0 -15
  434. package/dist/debug-BAw63qX6.js.map +0 -1
  435. package/dist/debug-DGki_v7g.js +0 -15
  436. package/dist/debug-DGki_v7g.js.map +0 -1
  437. package/dist/debug-n2aZQBSa.js.map +0 -1
  438. package/dist/dev-CcphAa3R.js.map +0 -1
  439. package/dist/dev-DfBbuLeE.js +0 -71
  440. package/dist/dev-DfBbuLeE.js.map +0 -1
  441. package/dist/elementMarker-Bu7gDAkE.js.map +0 -1
  442. package/dist/extract-CzWJeQi8.js +0 -121
  443. package/dist/extract-CzWJeQi8.js.map +0 -1
  444. package/dist/extract-DEwSDJ9Z.js +0 -2
  445. package/dist/format-3nKBE_5t.js.map +0 -1
  446. package/dist/getClassName-BlvXHYuf.js.map +0 -1
  447. package/dist/global-CvfmFLsK.js +0 -11
  448. package/dist/global-CvfmFLsK.js.map +0 -1
  449. package/dist/jsx-CwTeyUxr.js +0 -39
  450. package/dist/jsx-CwTeyUxr.js.map +0 -1
  451. package/dist/jsx-D2BksHSv.js +0 -38
  452. package/dist/jsx-D2BksHSv.js.map +0 -1
  453. package/dist/layer-D1SaH07m.js +0 -94
  454. package/dist/layer-D1SaH07m.js.map +0 -1
  455. package/dist/loader-B5Kw0DD-.mjs.map +0 -1
  456. package/dist/misc-DCdYYyhK.mjs.map +0 -1
  457. package/dist/presets-BhXa232U.js +0 -108
  458. package/dist/presets-BhXa232U.js.map +0 -1
  459. package/dist/property-CnLFt5kx.js +0 -406
  460. package/dist/property-CnLFt5kx.js.map +0 -1
  461. package/dist/rules-9HSO1pxL.js.map +0 -1
  462. package/dist/runtime-CYqNCiaM.js.map +0 -1
  463. package/dist/shared-CBArHB9-.cjs.map +0 -1
  464. package/dist/style-B-6jHipw.js +0 -5
  465. package/dist/style-B1UUqjj5.js +0 -743
  466. package/dist/style-B1UUqjj5.js.map +0 -1
  467. package/dist/style-DgHbdbdF.js +0 -752
  468. package/dist/style-DgHbdbdF.js.map +0 -1
  469. package/dist/style-v2bf70TZ.js +0 -1269
  470. package/dist/style-v2bf70TZ.js.map +0 -1
  471. package/dist/styleStore-Dea_WVbr.js.map +0 -1
  472. package/dist/styleStore-DyNXBcUK.js.map +0 -1
  473. package/dist/token-CKXUECuU.js +0 -76
  474. package/dist/token-CKXUECuU.js.map +0 -1
  475. package/dist/token-u_tM-mtg.js +0 -204
  476. package/dist/token-u_tM-mtg.js.map +0 -1
  477. package/dist/utils-BbehLOby.js.map +0 -1
  478. package/dist/utils-CEaq_c-A.mjs +0 -97
  479. package/dist/utils-CEaq_c-A.mjs.map +0 -1
  480. package/dist/utils-CWNHx4EC.js +0 -170
  481. package/dist/utils-CWNHx4EC.js.map +0 -1
  482. package/dist/utils-D7FAOyg6.js.map +0 -1
  483. package/dist/value-BR4e2MKt.js +0 -910
  484. package/dist/value-BR4e2MKt.js.map +0 -1
  485. package/dist/value-E8rEv2Oe.js +0 -136
  486. package/dist/value-E8rEv2Oe.js.map +0 -1
  487. package/dist/valueRef-lshFk1Cs.js +0 -16
  488. package/dist/valueRef-lshFk1Cs.js.map +0 -1
  489. package/dist/webpack-Dh6lox2l.mjs.map +0 -1
  490. package/dist/withTokens-LRidu3Vc.js +0 -95
  491. package/dist/withTokens-LRidu3Vc.js.map +0 -1
@@ -0,0 +1,1339 @@
1
+ import { $ as isSelectorData, At as getDebugFieldVarName, B as isStyleTokenData, Dt as getDebugCallsite, Ft as traceError, Gt as getIdentifierSafeHash, Jt as normalizePropertyName, Kt as createNameFormatter, L as getStyleTokenId, Pt as traceCallsite, V as isStyleTokenOverrideData, Wt as LayerDefaultLayers, X as getSelectorSelectors, Yt as sanitizeDebugPropertyName, Z as isScopeData, Zt as DEV_CONFIG, a as insertRuntimeThemeRule, at as BUILDER_CALLSITE, bt as splitElementMarkerStyleProp, c as shouldAppendCssPx, ct as BUILDER_SELECTOR, d as hasSheetSelectorAnchor, dn as CHECK_CONFIG, dt as BUILDER_STATE, et as isSelectorOverrideData, f as getCssPropertyName, fn as RUNTIME_CONFIG, ft as BUILDER_TYPE, g as getCssVarRawFallback, gn as symbol, h as getTokenVar, hn as globalData, ht as createElementMarkerClassName, i as walkStylePropItemsSheetRules, in as DEBUG_CONFIG, it as isStyleData, kt as getDebugFieldCallsite, l as getSelectorHash, lt as BUILDER_SHEET_OPTIONS, n as isServerRSC, nt as isSlotData, ot as BUILDER_SCOPE, pt as SHEET_SELECTOR_ANCHOR, qt as normalizeDebugKeywordValue, rn as hashString, rt as isSlotOverrideData, s as getCssPropertyValue, sn as CSS_CONFIG, st as BUILDER_SCOPE_ID, u as getSelectorText$1, ut as BUILDER_SLOT_ID } from "./env-Cz8frh6e.js";
2
+ import { t as resolveClassNameRuntime } from "./resolveClassNameRuntime-CJjlUP93.js";
3
+ import { n as CSS_EXTRA_CONFIG, t as getGlobalSheet } from "./global-CAc9OjKx.js";
4
+ import { t as createTransformElement } from "./createTransformElement-D8fXZ3wA.js";
5
+ //#region builder/data/create.ts
6
+ function createStyleData(callsite) {
7
+ return {
8
+ [BUILDER_TYPE]: 1,
9
+ [BUILDER_STATE]: {
10
+ items: [],
11
+ lookup: {}
12
+ },
13
+ [BUILDER_CALLSITE]: callsite
14
+ };
15
+ }
16
+ function createSheetData(callsite, options = {}) {
17
+ return {
18
+ [BUILDER_TYPE]: 9,
19
+ [BUILDER_STATE]: {
20
+ items: [],
21
+ lookup: {}
22
+ },
23
+ [BUILDER_CALLSITE]: callsite,
24
+ [BUILDER_SHEET_OPTIONS]: options
25
+ };
26
+ }
27
+ function createSlotData(callsite, slotId) {
28
+ return {
29
+ [BUILDER_TYPE]: 2,
30
+ [BUILDER_STATE]: {
31
+ items: [],
32
+ lookup: {}
33
+ },
34
+ [BUILDER_CALLSITE]: callsite,
35
+ [BUILDER_SLOT_ID]: slotId
36
+ };
37
+ }
38
+ function createSlotOverrideData(callsite, slotId) {
39
+ return {
40
+ [BUILDER_TYPE]: 3,
41
+ [BUILDER_STATE]: {
42
+ items: [],
43
+ lookup: {}
44
+ },
45
+ [BUILDER_CALLSITE]: callsite,
46
+ [BUILDER_SLOT_ID]: slotId
47
+ };
48
+ }
49
+ function createSelectorOverrideData(callsite, selectors) {
50
+ return {
51
+ [BUILDER_TYPE]: 8,
52
+ [BUILDER_STATE]: {
53
+ items: [],
54
+ lookup: {}
55
+ },
56
+ [BUILDER_CALLSITE]: callsite,
57
+ [BUILDER_SELECTOR]: selectors
58
+ };
59
+ }
60
+ function createSelectorData(callsite, selectors) {
61
+ return {
62
+ [BUILDER_TYPE]: 7,
63
+ [BUILDER_STATE]: {
64
+ items: [],
65
+ lookup: {}
66
+ },
67
+ [BUILDER_CALLSITE]: callsite,
68
+ [BUILDER_SELECTOR]: selectors
69
+ };
70
+ }
71
+ function createScopeData(callsite) {
72
+ return {
73
+ [BUILDER_TYPE]: 4,
74
+ [BUILDER_STATE]: {
75
+ items: [],
76
+ lookup: {}
77
+ },
78
+ [BUILDER_CALLSITE]: callsite
79
+ };
80
+ }
81
+ function createScopeTargetData(scope, slot) {
82
+ return {
83
+ [BUILDER_TYPE]: 5,
84
+ [BUILDER_SCOPE]: scope,
85
+ [BUILDER_SCOPE_ID]: slot[BUILDER_SLOT_ID]
86
+ };
87
+ }
88
+ function createThemeData(callsite, id, className, tokens) {
89
+ return {
90
+ [BUILDER_TYPE]: 6,
91
+ [BUILDER_STATE]: {
92
+ items: [],
93
+ lookup: {}
94
+ },
95
+ [BUILDER_CALLSITE]: callsite,
96
+ id,
97
+ className,
98
+ tokens
99
+ };
100
+ }
101
+ const formatClassName = createNameFormatter([
102
+ "atRule",
103
+ "scopeSelector",
104
+ "property",
105
+ "selector",
106
+ "value"
107
+ ]);
108
+ const formatTransformClassName = createNameFormatter(["className"]);
109
+ function getDebugClassName(format, hash, info) {
110
+ return formatClassName(format || "[(atRule)-][(scopeSelector)-](property)[-(selector)][-(value)]--$hash", hash, info);
111
+ }
112
+ function getDebugSheetClassName(format, hash, info) {
113
+ return formatClassName(format || "sheet-(property)[-(value)]--$hash", hash, info);
114
+ }
115
+ function getDebugTransformClassName(format, hash, info) {
116
+ return formatTransformClassName(format || "(className)--$hash", hash, info);
117
+ }
118
+ //#endregion
119
+ //#region atomic/debug/value.ts
120
+ function getDebugValueName(value) {
121
+ if (!value) return {
122
+ value: null,
123
+ arbitraryValue: null
124
+ };
125
+ const normalized = value.trim().toLowerCase();
126
+ if (!normalized) return {
127
+ value: null,
128
+ arbitraryValue: null
129
+ };
130
+ 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 {
131
+ value: null,
132
+ arbitraryValue: null
133
+ };
134
+ if (/^[a-z][a-z0-9-]*$/.test(normalized)) return {
135
+ value: normalized,
136
+ arbitraryValue: null
137
+ };
138
+ 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, "");
139
+ if (!name) return {
140
+ value: null,
141
+ arbitraryValue: null
142
+ };
143
+ return {
144
+ value: null,
145
+ arbitraryValue: name
146
+ };
147
+ }
148
+ //#endregion
149
+ //#region atomic/debug/property/data.ts
150
+ const PROPERTY_ALIASES = {
151
+ "border-radius": "radius",
152
+ "flex-direction": "flex",
153
+ "font-style": "font",
154
+ "font-weight": "font",
155
+ "grid-template-columns": "grid-cols",
156
+ "grid-template-rows": "grid-rows",
157
+ "align-items": "items",
158
+ "justify-content": "justify",
159
+ "z-index": "zindex",
160
+ "pointer-events": "pointer"
161
+ };
162
+ const KEYWORD_VALUE_PROPERTIES = new Set([
163
+ "align-content",
164
+ "align-items",
165
+ "align-self",
166
+ "background-repeat",
167
+ "background-size",
168
+ "border-collapse",
169
+ "border-style",
170
+ "box-sizing",
171
+ "clear",
172
+ "cursor",
173
+ "display",
174
+ "flex-direction",
175
+ "flex-wrap",
176
+ "float",
177
+ "font-weight",
178
+ "font-style",
179
+ "justify-content",
180
+ "justify-items",
181
+ "justify-self",
182
+ "list-style-position",
183
+ "list-style-type",
184
+ "object-fit",
185
+ "object-position",
186
+ "overflow",
187
+ "overflow-x",
188
+ "overflow-y",
189
+ "pointer-events",
190
+ "place-content",
191
+ "place-items",
192
+ "place-self",
193
+ "position",
194
+ "resize",
195
+ "table-layout",
196
+ "text-align",
197
+ "text-decoration-line",
198
+ "text-transform",
199
+ "user-select",
200
+ "vertical-align",
201
+ "visibility",
202
+ "white-space"
203
+ ]);
204
+ const ARBITRARY_VALUE_PROPERTIES = new Set(["font-weight"]);
205
+ //#endregion
206
+ //#region atomic/debug/property/property.ts
207
+ function getDebugPropertyName(property, value) {
208
+ if (!property) return null;
209
+ const normalized = normalizePropertyName(property);
210
+ const name = PROPERTY_ALIASES[normalized] || sanitizeDebugPropertyName(normalized);
211
+ if (!name) return null;
212
+ return {
213
+ property: name,
214
+ ...withKeywordValueFallback(normalized, value, withArbitraryValueFallback(normalized, getDebugValueName(value)))
215
+ };
216
+ }
217
+ function withArbitraryValueFallback(property, valueName) {
218
+ if (!valueName.arbitraryValue || ARBITRARY_VALUE_PROPERTIES.has(property)) return valueName;
219
+ return {
220
+ value: valueName.value,
221
+ arbitraryValue: null
222
+ };
223
+ }
224
+ function withKeywordValueFallback(property, value, valueName) {
225
+ if (valueName.value || valueName.arbitraryValue) return valueName;
226
+ if (!KEYWORD_VALUE_PROPERTIES.has(property)) return valueName;
227
+ const normalized = normalizeDebugKeywordValue(value);
228
+ if (!normalized) return valueName;
229
+ return {
230
+ value: normalized,
231
+ arbitraryValue: null
232
+ };
233
+ }
234
+ //#endregion
235
+ //#region atomic/debug/selector.ts
236
+ function getDebugSelectorName(selector) {
237
+ if (!selector) return null;
238
+ const normalized = selector.trim().toLowerCase();
239
+ if (/^[a-z0-9]+$/.test(normalized)) return null;
240
+ 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, ""));
241
+ }
242
+ function getDebugAtRuleName(selector) {
243
+ if (!selector || Array.isArray(selector) && selector.length === 0) return null;
244
+ return validateName((Array.isArray(selector) ? selector.map(parseAtRule).filter(Boolean).join("-") : parseAtRule(selector)).replace(/[-_]+/g, "-").replace(/^-+|-+$/g, ""));
245
+ }
246
+ function compressQuery(query) {
247
+ 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, "");
248
+ }
249
+ function validateName(name) {
250
+ if (!name || name === "selector" || name.length < 2) return null;
251
+ return name;
252
+ }
253
+ function parseAtRule(rule) {
254
+ const normalized = rule.trim().toLowerCase();
255
+ if (normalized.startsWith("@media")) return compressQuery(normalized.slice(6));
256
+ if (normalized.startsWith("@container")) return compressQuery(normalized.slice(10));
257
+ if (normalized.startsWith("@supports")) return compressQuery(normalized.slice(9));
258
+ return compressQuery(normalized);
259
+ }
260
+ //#endregion
261
+ //#region atomic/className.ts
262
+ function getAtomicClassName(property, priority, important, value, selector, parentSelector, atRule, callsite, localClassName, debugClassName, classNameFormat, transformClassName, transformClassNameFormat, sheetClassNameFormat = null, hashLength = null) {
263
+ let hash = property;
264
+ hash += "\n" + (priority || "");
265
+ if (important) hash += "\nimportant";
266
+ hash += "\n" + value;
267
+ hash += "\n" + (selector ? getSelectorHash(selector) : "");
268
+ hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
269
+ hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
270
+ hash += "\n" + getCallsiteHash(callsite, localClassName);
271
+ hash = getIdentifierSafeHash(hash, hashLength ?? getRuntimeClassNameHashLength(debugClassName));
272
+ if (!debugClassName) return hash;
273
+ if (transformClassName) return getDebugTransformClassName(transformClassNameFormat, hash, { className: transformClassName });
274
+ const propertyName = getDebugPropertyName(property, value);
275
+ const isSheetClassName = hasSheetSelectorAnchor(selector);
276
+ return (isSheetClassName ? getDebugSheetClassName : getDebugClassName)(isSheetClassName ? sheetClassNameFormat : classNameFormat, hash, {
277
+ atRule: atRule ? getDebugAtRuleName(atRule.map(getSelectorText$1)) : null,
278
+ scopeSelector: parentSelector ? getDebugSelectorName(getSelectorText$1(parentSelector)) : null,
279
+ selector: selector ? getDebugSelectorName(getSelectorText$1(selector)) : null,
280
+ property: propertyName ? propertyName.property : property,
281
+ value: propertyName ? propertyName.value ?? propertyName.arbitraryValue : null
282
+ });
283
+ }
284
+ function getRuntimeClassNameHashLength(debugClassName) {
285
+ return getClassNameHashLength({
286
+ debugClassName,
287
+ isDev: DEV_CONFIG.isDev,
288
+ devHashLength: DEV_CONFIG.hashLength,
289
+ cssHashLength: CSS_CONFIG.hashLength
290
+ });
291
+ }
292
+ function getClassNameHashLength(options) {
293
+ if (options.debugClassName && options.isDev) return options.devHashLength ?? options.cssHashLength ?? 5;
294
+ return options.cssHashLength ?? 7;
295
+ }
296
+ function getClassNameDedupe(property, priority, important, selector, parentSelector, atRule) {
297
+ let hash = property;
298
+ hash += "\n" + (priority || "");
299
+ if (important) hash += "\nimportant";
300
+ hash += "\n" + (selector ? getSelectorHash(selector) : "");
301
+ hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
302
+ hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
303
+ return hashString(hash);
304
+ }
305
+ function getCallsiteHash(callsite, localClassName) {
306
+ if (!localClassName || !callsite) return "";
307
+ return callsite.filePath + "\n" + callsite.line + ":" + callsite.column;
308
+ }
309
+ //#endregion
310
+ //#region builder/data/merge/utils.ts
311
+ function cloneData(data, source, debug, merge = true) {
312
+ const runtimeType = DEV_CONFIG.isDev ? debug ? -2 : -1 : -3;
313
+ const state = data[BUILDER_STATE];
314
+ state.items = merge ? source[BUILDER_STATE].items.slice() : [];
315
+ state.lookup = Object.assign(Object.create(null), merge ? source[BUILDER_STATE].lookup : null);
316
+ const lookup = state.lookup;
317
+ return [
318
+ runtimeType,
319
+ data,
320
+ state.items,
321
+ lookup
322
+ ];
323
+ }
324
+ function logInvalidData(message, data) {
325
+ console.log(traceError(message), "data:", data);
326
+ }
327
+ //#endregion
328
+ //#region builder/data/merge/scope.ts
329
+ function mergeScopeData(scope, callsite, items, debug, parentSelector, scopeAtRule) {
330
+ if (!items) return scope;
331
+ const sourceItems = Array.isArray(items) ? items : [items];
332
+ const [runtimeType, data, styles, lookup] = cloneData(scope, scope, debug);
333
+ let source;
334
+ let item;
335
+ let lookupIndex;
336
+ let weight;
337
+ let important;
338
+ let value;
339
+ let atRule;
340
+ let dedupe;
341
+ let className;
342
+ let itemDebug;
343
+ let itemCallsite;
344
+ for (let i = 0, len = sourceItems.length; i < len; i++) {
345
+ source = sourceItems[i];
346
+ if (!source) continue;
347
+ if (isStyleTokenOverrideData(source)) {
348
+ addTokenOverride(source, styles, lookup);
349
+ continue;
350
+ }
351
+ if (isScopeData(source)) {
352
+ const scopeItems = source[BUILDER_STATE].items;
353
+ for (let j = 0, len = scopeItems.length; j < len; j++) {
354
+ item = scopeItems[j];
355
+ if (isStyleTokenOverrideData(item)) {
356
+ addTokenOverride(item, styles, lookup);
357
+ continue;
358
+ }
359
+ if (Array.isArray(item) || item.type !== 4) {
360
+ logInvalidData("invalid scope data", {
361
+ source,
362
+ item
363
+ });
364
+ continue;
365
+ }
366
+ const sourceScopeItem = item;
367
+ atRule = scopeAtRule ? sourceScopeItem.atRule ? [scopeAtRule].concat(sourceScopeItem.atRule) : [scopeAtRule] : sourceScopeItem.atRule;
368
+ const scopeItem = {
369
+ ...sourceScopeItem,
370
+ runtime: runtimeType,
371
+ atRule,
372
+ parentSelector: parentSelector ?? sourceScopeItem.parentSelector
373
+ };
374
+ itemDebug = getMergedScopeDebug(debug, scopeItem);
375
+ itemCallsite = getDebugFieldCallsite(itemDebug ?? null, scopeItem.property) ?? callsite ?? scopeItem.callsite;
376
+ value = scopeItem.value;
377
+ weight = scopeItem.weight;
378
+ important = scopeItem.important;
379
+ dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule);
380
+ className = getAtomicClassName(scopeItem.property, weight, important, value, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule, itemCallsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, scopeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null, CSS_CONFIG.sheetClassNameFormat ?? null);
381
+ scopeItem.dedupe = dedupe;
382
+ scopeItem.className = className;
383
+ scopeItem.callsite = itemCallsite;
384
+ scopeItem.debug = itemDebug ?? null;
385
+ scopeItem.debugField = itemDebug ? scopeItem.property : null;
386
+ const lookupKey = getScopeLookupKey(scopeItem.slotId, dedupe);
387
+ lookupIndex = lookup[lookupKey];
388
+ if (typeof lookupIndex === "number") styles[lookupIndex] = scopeItem;
389
+ else lookup[lookupKey] = styles.push(scopeItem) - 1;
390
+ }
391
+ continue;
392
+ }
393
+ if (!isSlotOverrideData(source)) {
394
+ logInvalidData("invalid scope data", { source });
395
+ continue;
396
+ }
397
+ const slotId = source[BUILDER_SLOT_ID];
398
+ const overrideItems = source[BUILDER_STATE].items;
399
+ for (let j = 0, len = overrideItems.length; j < len; j++) {
400
+ item = overrideItems[j];
401
+ if (Array.isArray(item) || isStyleTokenOverrideData(item) || item.type !== 3) {
402
+ logInvalidData("invalid scope data", {
403
+ source,
404
+ item
405
+ });
406
+ continue;
407
+ }
408
+ const overrideItem = item;
409
+ atRule = scopeAtRule ? overrideItem.atRule ? [scopeAtRule].concat(overrideItem.atRule) : [scopeAtRule] : overrideItem.atRule;
410
+ const scopeItem = {
411
+ type: 4,
412
+ slotId,
413
+ runtime: runtimeType,
414
+ dedupe: "",
415
+ className: "",
416
+ property: overrideItem.property,
417
+ weight: overrideItem.weight,
418
+ important: overrideItem.important,
419
+ value: overrideItem.value,
420
+ transformClassName: overrideItem.transformClassName,
421
+ token: overrideItem.token,
422
+ selector: overrideItem.selector,
423
+ atRule,
424
+ callsite: overrideItem.callsite ?? callsite,
425
+ debug: overrideItem.debug,
426
+ debugField: overrideItem.debugField,
427
+ parentSelector
428
+ };
429
+ value = scopeItem.value;
430
+ weight = scopeItem.weight;
431
+ important = scopeItem.important;
432
+ dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, parentSelector, scopeItem.atRule);
433
+ className = getAtomicClassName(scopeItem.property, weight, important, value, scopeItem.selector, parentSelector, scopeItem.atRule, scopeItem.callsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, scopeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null, CSS_CONFIG.sheetClassNameFormat ?? null);
434
+ scopeItem.dedupe = dedupe;
435
+ scopeItem.className = className;
436
+ const lookupKey = getScopeLookupKey(slotId, dedupe);
437
+ lookupIndex = lookup[lookupKey];
438
+ if (typeof lookupIndex === "number") styles[lookupIndex] = scopeItem;
439
+ else lookup[lookupKey] = styles.push(scopeItem) - 1;
440
+ }
441
+ }
442
+ return data;
443
+ }
444
+ function addTokenOverride(item, styles, lookup) {
445
+ const lookupKey = getTokenLookupKey(getStyleTokenId(item));
446
+ const lookupIndex = lookup[lookupKey];
447
+ if (typeof lookupIndex === "number") styles[lookupIndex] = item;
448
+ else lookup[lookupKey] = styles.push(item) - 1;
449
+ }
450
+ function getMergedScopeDebug(debug, item) {
451
+ if (!debug) return item.debug;
452
+ if (debug.fields?.[item.property]) return debug;
453
+ const valueLoc = getRuntimeScopeItemValueLoc(item);
454
+ if (!valueLoc) return debug;
455
+ return {
456
+ ...debug,
457
+ fields: {
458
+ ...debug.fields,
459
+ [item.property]: {
460
+ [0]: debug.loc,
461
+ [1]: valueLoc
462
+ }
463
+ }
464
+ };
465
+ }
466
+ function getRuntimeScopeItemValueLoc(item) {
467
+ if (item.debug && item.debugField) {
468
+ const loc = item.debug.fields?.[item.debugField];
469
+ if (Array.isArray(loc)) return withDebugSource$1(loc, item.debug.sourceUrl, item.debug.code);
470
+ if (loc) {
471
+ const valueLoc = loc[1] ?? loc[0] ?? null;
472
+ return valueLoc ? withDebugSource$1(valueLoc, item.debug.sourceUrl, item.debug.code) : null;
473
+ }
474
+ }
475
+ return item.callsite ? [
476
+ item.callsite.line,
477
+ item.callsite.column,
478
+ void 0,
479
+ item.callsite.sourceUrl,
480
+ item.callsite.sourceContent
481
+ ] : null;
482
+ }
483
+ function withDebugSource$1(loc, sourceUrl, sourceContent) {
484
+ return loc[3] ? loc : [
485
+ loc[0],
486
+ loc[1],
487
+ loc[2],
488
+ sourceUrl,
489
+ sourceContent
490
+ ];
491
+ }
492
+ function getScopeLookupKey(slotId, dedupe) {
493
+ return slotId + "\0" + dedupe;
494
+ }
495
+ function getTokenLookupKey(tokenId) {
496
+ return "token\0" + tokenId;
497
+ }
498
+ //#endregion
499
+ //#region style/important.ts
500
+ const STYLE_IMPORTANT = symbol("style.important");
501
+ function importantValue(value) {
502
+ return {
503
+ [STYLE_IMPORTANT]: true,
504
+ value
505
+ };
506
+ }
507
+ function isStyleImportantValue(value) {
508
+ return !!value && typeof value === "object" && value[STYLE_IMPORTANT] === true;
509
+ }
510
+ //#endregion
511
+ //#region style/transform.ts
512
+ const CLASS_NAME_VALUE = symbol("transform.classNameValue");
513
+ function classNameValue(value, className) {
514
+ return {
515
+ [CLASS_NAME_VALUE]: true,
516
+ value,
517
+ className
518
+ };
519
+ }
520
+ function isClassNameValue(value) {
521
+ return !!value && typeof value === "object" && value[CLASS_NAME_VALUE] === true && typeof value.className === "string";
522
+ }
523
+ function styleTransform(options) {
524
+ return options;
525
+ }
526
+ function classNameTransform(options) {
527
+ return options;
528
+ }
529
+ //#endregion
530
+ //#region style/valueRef.ts
531
+ const AT_RULE_REF = symbol("atRule.ref");
532
+ function createAtRuleRef(data) {
533
+ return {
534
+ [AT_RULE_REF]: true,
535
+ ...data
536
+ };
537
+ }
538
+ function isAtRuleRef(value) {
539
+ return !!value && typeof value === "object" && value[AT_RULE_REF] === true;
540
+ }
541
+ //#endregion
542
+ //#region style/weight.ts
543
+ const STYLE_WEIGHT = symbol("style.weight");
544
+ function weightValue(value, weight) {
545
+ return {
546
+ [STYLE_WEIGHT]: true,
547
+ value,
548
+ weight
549
+ };
550
+ }
551
+ function isStyleWeightValue(value) {
552
+ return !!value && typeof value === "object" && value[STYLE_WEIGHT] === true;
553
+ }
554
+ //#endregion
555
+ //#region builder/data/merge/style.ts
556
+ function mergeBuilderData(create, callsite, source, style, debug, selector, atRule, type) {
557
+ if (!style) return source;
558
+ const [runtimeType, data, styles, lookup] = cloneData(create(callsite, source), source, debug);
559
+ const slotId = isSlotData(source) || isSlotOverrideData(source) ? source[BUILDER_SLOT_ID] : null;
560
+ const items = [];
561
+ let item;
562
+ let itemData;
563
+ let valueRaw;
564
+ let value;
565
+ let weight;
566
+ let important;
567
+ let itemCallsite;
568
+ let className;
569
+ let dedupe;
570
+ let token;
571
+ let ref;
572
+ let variableName;
573
+ let transformClassName;
574
+ let lookupIndex;
575
+ if (isStyleData(style)) {
576
+ const stylesItems = style[BUILDER_STATE].items;
577
+ for (let i = 0, len = stylesItems.length; i < len; i++) {
578
+ item = stylesItems[i];
579
+ if (Array.isArray(item) || isStyleTokenOverrideData(item) || item.type !== 1) {
580
+ logInvalidData("invalid style data", {
581
+ item,
582
+ style
583
+ });
584
+ continue;
585
+ }
586
+ if (atRule) item = Object.assign({}, item, { atRule: item.atRule ? atRule.concat(item.atRule) : atRule });
587
+ if (selector) item = Object.assign({}, item, { selector: item.selector ? combineSelectors(selector, item.selector) : selector });
588
+ if (type === 2 && slotId !== null) item = Object.assign({}, item, {
589
+ type: 2,
590
+ slotId
591
+ });
592
+ else if (type === 3 && slotId !== null) item = Object.assign({}, item, {
593
+ type: 3,
594
+ slotId
595
+ });
596
+ else if (type === 8) item = Object.assign({}, item, { type: 1 });
597
+ const itemDebug = getMergedStyleDebug(debug, item);
598
+ const debugCallsite = getDebugFieldCallsite(itemDebug, item.property);
599
+ if (debugCallsite) item = Object.assign({}, item, {
600
+ callsite: debugCallsite,
601
+ debug: itemDebug,
602
+ debugField: item.property
603
+ });
604
+ items.push(item);
605
+ }
606
+ } else for (const property in style) {
607
+ valueRaw = style[property];
608
+ [valueRaw, weight, important] = unwrapAuthoredStyleValue(valueRaw);
609
+ const sourceType = source[BUILDER_TYPE];
610
+ checkImportantUsage(valueRaw, important, sourceType === 9 || sourceType === 8);
611
+ transformClassName = null;
612
+ if (isClassNameValue(valueRaw)) {
613
+ transformClassName = valueRaw.className;
614
+ valueRaw = valueRaw.value;
615
+ }
616
+ ref = isAtRuleRef(valueRaw) ? valueRaw : null;
617
+ if (ref) valueRaw = ref.value;
618
+ token = isStyleTokenData(valueRaw) ? valueRaw : null;
619
+ variableName = getDebugFieldVarName(debug, property);
620
+ value = variableName && token ? getCssVarRawFallback(variableName, getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null)) : token ? getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null) : String(valueRaw ?? "");
621
+ itemCallsite = getDebugFieldCallsite(debug, property) ?? callsite;
622
+ itemData = {
623
+ runtime: runtimeType,
624
+ debug,
625
+ debugField: property,
626
+ dedupe: "",
627
+ className: "",
628
+ property,
629
+ weight,
630
+ important,
631
+ value,
632
+ transformClassName,
633
+ variable: ref ? [3, ref] : variableName && token ? [
634
+ 1,
635
+ variableName,
636
+ valueRaw,
637
+ shouldAppendCssPx(property) ? 1 : void 0
638
+ ] : ref ? [3, ref] : void 0,
639
+ token,
640
+ selector,
641
+ atRule,
642
+ callsite: itemCallsite
643
+ };
644
+ if (type === 1 || type === 8) {
645
+ items.push({
646
+ ...itemData,
647
+ type: 1
648
+ });
649
+ continue;
650
+ }
651
+ if (slotId === null) {
652
+ logInvalidData("invalid style data", {
653
+ property,
654
+ style
655
+ });
656
+ continue;
657
+ }
658
+ if (type === 2) {
659
+ items.push({
660
+ ...itemData,
661
+ type: 2,
662
+ slotId
663
+ });
664
+ continue;
665
+ }
666
+ if (type === 3) {
667
+ items.push({
668
+ ...itemData,
669
+ type: 3,
670
+ slotId
671
+ });
672
+ continue;
673
+ }
674
+ logInvalidData("invalid style data", {
675
+ property,
676
+ style
677
+ });
678
+ }
679
+ if (!items.length) return data;
680
+ for (let i = 0, len = items.length; i < len; i++) {
681
+ item = items[i];
682
+ if (Array.isArray(item) || isStyleTokenOverrideData(item)) {
683
+ logInvalidData("invalid style data", {
684
+ item,
685
+ style
686
+ });
687
+ continue;
688
+ }
689
+ const runtimeItem = item;
690
+ value = runtimeItem.value;
691
+ weight = runtimeItem.weight;
692
+ important = runtimeItem.important;
693
+ dedupe = getClassNameDedupe(runtimeItem.property, weight, important, runtimeItem.selector, null, runtimeItem.atRule);
694
+ className = getAtomicClassName(runtimeItem.property, weight, important, value, runtimeItem.selector, null, runtimeItem.atRule, runtimeItem.callsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, runtimeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null, CSS_CONFIG.sheetClassNameFormat ?? null);
695
+ runtimeItem.dedupe = dedupe;
696
+ runtimeItem.className = className;
697
+ lookupIndex = lookup[dedupe];
698
+ if (typeof lookupIndex === "number") styles[lookupIndex] = runtimeItem;
699
+ else lookup[dedupe] = styles.push(runtimeItem) - 1;
700
+ }
701
+ return data;
702
+ }
703
+ function unwrapAuthoredStyleValue(value) {
704
+ let weight = null;
705
+ let important = false;
706
+ while (true) {
707
+ if (isStyleImportantValue(value)) {
708
+ important = true;
709
+ value = value.value;
710
+ continue;
711
+ }
712
+ if (isStyleWeightValue(value)) {
713
+ weight = value.weight;
714
+ value = value.value;
715
+ continue;
716
+ }
717
+ break;
718
+ }
719
+ return [
720
+ value,
721
+ weight,
722
+ important
723
+ ];
724
+ }
725
+ function checkImportantUsage(value, important, isSheet) {
726
+ const options = CHECK_CONFIG.important;
727
+ if (!options) return;
728
+ if (typeof value === "string" && /!\s*important\b/i.test(value)) reportImportantCheck(options.rawValue, "Do not write raw \"!important\" values. Wrap the value with style.important(...) instead.");
729
+ if (important && !isSheet) reportImportantCheck(options.outsideSheet, "style.important(...) outside createSheet is discouraged. Prefer style.weight(...) for Fluentic style priority.");
730
+ }
731
+ function reportImportantCheck(level, message) {
732
+ if (!level) return;
733
+ if (level === "error") throw new Error(message);
734
+ if (DEV_CONFIG.isDev) console.warn("[fluentic-style] " + message);
735
+ }
736
+ function combineSelectors(parent, child) {
737
+ const parentText = getSelectorText(parent);
738
+ const childText = getSelectorText(child);
739
+ const priority = Math.max(getSelectorPriority(parent), getSelectorPriority(child));
740
+ const selector = parentText + childText;
741
+ return priority > 0 ? [selector, priority] : selector;
742
+ }
743
+ function getSelectorText(selector) {
744
+ return Array.isArray(selector) ? selector[0] : selector;
745
+ }
746
+ function getSelectorPriority(selector) {
747
+ return Array.isArray(selector) ? selector[1] : 0;
748
+ }
749
+ function getMergedStyleDebug(debug, item) {
750
+ if (!debug) return null;
751
+ if (debug.fields?.[item.property]) return debug;
752
+ const valueLoc = getMergedItemValueLoc(item);
753
+ if (!valueLoc) return debug;
754
+ return {
755
+ ...debug,
756
+ fields: {
757
+ ...debug.fields,
758
+ [item.property]: {
759
+ [0]: withDebugSource(debug.loc, debug),
760
+ [1]: valueLoc
761
+ }
762
+ }
763
+ };
764
+ }
765
+ function getMergedItemValueLoc(item) {
766
+ if (item.debug && item.debugField) {
767
+ const loc = item.debug.fields?.[item.debugField];
768
+ if (Array.isArray(loc)) return withDebugSource(loc, item.debug);
769
+ if (loc) {
770
+ const traceLoc = loc[1] ?? loc[0] ?? null;
771
+ return traceLoc ? withDebugSource(traceLoc, item.debug) : null;
772
+ }
773
+ }
774
+ return item.callsite ? [
775
+ item.callsite.line,
776
+ item.callsite.column,
777
+ void 0,
778
+ item.callsite.sourceUrl,
779
+ item.callsite.sourceContent
780
+ ] : null;
781
+ }
782
+ function withDebugSource(loc, debug) {
783
+ return loc[3] ? loc : [
784
+ loc[0],
785
+ loc[1],
786
+ loc[2],
787
+ debug.sourceUrl,
788
+ debug.code
789
+ ];
790
+ }
791
+ //#endregion
792
+ //#region builder/data/selector.ts
793
+ const SELECTOR_MEDIA = "@media";
794
+ const SELECTOR_CONTAINER = "@container";
795
+ function normalizeSelectorArg(arg) {
796
+ return arg.includes("\n") ? arg.replace(/\n/g, "") : arg;
797
+ }
798
+ //#endregion
799
+ //#region runtime/core/getToken.ts
800
+ function getToken(value) {
801
+ if (isStyleTokenData(value)) return getTokenVar(value, CSS_CONFIG.tokenNameFormat ?? null);
802
+ return value;
803
+ }
804
+ //#endregion
805
+ //#region builder/style_data.ts
806
+ const mergeStyleCreate = (callsite) => {
807
+ return createStyleData(callsite);
808
+ };
809
+ const mergeStyleData = createMerge(mergeStyleCreate, 1);
810
+ const mergeSheetCreate = (callsite, data) => {
811
+ return createSheetData(callsite, data[BUILDER_SHEET_OPTIONS]);
812
+ };
813
+ const mergeSheetData = createMerge(mergeSheetCreate, 1);
814
+ const mergeSlotCreate = (callsite, data) => {
815
+ return createSlotData(callsite, data[BUILDER_SLOT_ID]);
816
+ };
817
+ const mergeSlotData = createMerge(mergeSlotCreate, 2);
818
+ const mergeSlotOverrideCreate = (callsite, data) => {
819
+ return createSlotOverrideData(callsite, data[BUILDER_SLOT_ID]);
820
+ };
821
+ const mergeSlotOverrideData = createMerge(mergeSlotOverrideCreate, 3);
822
+ const mergeSelectorOverrideCreate = (callsite, data) => {
823
+ return createSelectorOverrideData(callsite, data[BUILDER_SELECTOR]);
824
+ };
825
+ const mergeSelectorOverrideData = createMerge(mergeSelectorOverrideCreate, 8);
826
+ function createMerge(create, type) {
827
+ return (data, callsite, style, debug, selector, atRule) => {
828
+ return mergeBuilderData(create, callsite, data, style, debug, selector, atRule, type);
829
+ };
830
+ }
831
+ //#endregion
832
+ //#region builder/utils.ts
833
+ const FnPrefixStyle = "style.";
834
+ const FnPrefixSlot = "slot.";
835
+ const FnPrefixScope = "scope.";
836
+ const FnPrefixSelector = "selector.";
837
+ function runtimeCallsite() {
838
+ return traceCallsite();
839
+ }
840
+ function resolveCallsite(debug) {
841
+ return debug ? getDebugCallsite(debug) : runtimeCallsite();
842
+ }
843
+ function transformStyle(style, transform) {
844
+ return transform ? transform.transform(style) : style;
845
+ }
846
+ //#endregion
847
+ //#region builder/selector_override_core.ts
848
+ function normalizeManualSelectors(input, assertManualSelector) {
849
+ const selectors = Array.isArray(input) ? input : [input];
850
+ if (!selectors.length) throw new Error("selector array cannot be empty");
851
+ return selectors.flatMap((selector) => normalizeManualSelector(selector, assertManualSelector));
852
+ }
853
+ function assertManualSelectorSyntax(selector) {
854
+ if (!selector) throw new Error("selector cannot be empty");
855
+ if (selector.includes("{") || selector.includes("}")) throw new Error("selector must not contain \"{\" or \"}\"");
856
+ if (selector.includes(",")) throw new Error("selector must not contain \",\"; use an array of selectors instead");
857
+ const ampersandIndex = selector.indexOf("&");
858
+ if (ampersandIndex > 0) throw new Error("selector can only use \"&\" at the beginning");
859
+ const ampersandSelector = selector.startsWith("&?") ? selector.slice(2) : selector.slice(1);
860
+ if (ampersandIndex === 0 && ampersandSelector && /^\s/.test(ampersandSelector)) throw new Error("selector cannot have whitespace after \"&\"; omit \"&\" for descendant selectors");
861
+ }
862
+ function setSheetSelectorOptions(selector, options) {
863
+ if (options.weight === void 0 && options.layer === void 0) return selector;
864
+ const text = Array.isArray(selector) ? selector[0] : selector;
865
+ const weighted = SHEET_SELECTOR_ANCHOR + (":" + (options.weight ?? "") + ":" + (options.layer === void 0 ? "" : options.layer ? "1" : "0")) + "\0" + text.slice(SHEET_SELECTOR_ANCHOR.length);
866
+ return Array.isArray(selector) ? [weighted, selector[1]] : weighted;
867
+ }
868
+ function normalizeManualSelector(selector, assertManualSelector) {
869
+ const value = selector.trim();
870
+ assertManualSelector(value);
871
+ if (value.startsWith("&?")) {
872
+ const suffix = value.slice(2);
873
+ return suffix ? [SHEET_SELECTOR_ANCHOR + suffix, SHEET_SELECTOR_ANCHOR + " " + suffix] : [SHEET_SELECTOR_ANCHOR];
874
+ }
875
+ return [SHEET_SELECTOR_ANCHOR + (value.startsWith("&") ? value.slice(1) : " " + value)];
876
+ }
877
+ //#endregion
878
+ //#region atomic/atRule/utils.ts
879
+ function createAtRuleNameFormatter(defaultFormat, prefix) {
880
+ const formatter = createNameFormatter(["name"]);
881
+ return (format, id, info) => {
882
+ const hash = getIdentifierSafeHash(id, CSS_CONFIG.hashLength);
883
+ const name = formatter(format || defaultFormat, hash, info);
884
+ if (!prefix) return name;
885
+ return name.startsWith(prefix) ? name : prefix + name;
886
+ };
887
+ }
888
+ function buildNamedAtRuleCss(atRule, name, descriptors, tokens, tokenLookup, tokenNameFormat) {
889
+ return `@${atRule} ${name} {${buildAtRuleDeclarationCss(descriptors, tokens, tokenLookup, tokenNameFormat, true)}}`;
890
+ }
891
+ function buildAtRuleDeclarationCss(style, tokens, tokenLookup, tokenNameFormat, rawValue, shouldInclude) {
892
+ let css = "";
893
+ for (const property in style) {
894
+ if (shouldInclude && !shouldInclude(property)) continue;
895
+ let value = style[property];
896
+ if (Array.isArray(value) && value.length === 2 && typeof value[0] === "number") value = value[1];
897
+ if (isStyleTokenData(value)) {
898
+ const tokenId = getStyleTokenId(value);
899
+ if (!tokenLookup.has(tokenId)) {
900
+ tokenLookup.add(tokenId);
901
+ tokens.push(value);
902
+ }
903
+ css += `${getCssPropertyName(property)}: ${getTokenVar(value, tokenNameFormat)};`;
904
+ continue;
905
+ }
906
+ const valueString = String(value ?? "");
907
+ css += `${getCssPropertyName(property)}: ${rawValue ? valueString : getCssPropertyValue(property, valueString)};`;
908
+ }
909
+ return css;
910
+ }
911
+ //#endregion
912
+ //#region atomic/atRule/counterStyle.ts
913
+ const COUNTER_STYLE_AT_RULE = "counter-style";
914
+ const formatCounterStyleName = createAtRuleNameFormatter("counter-style[-(name)]-$hash");
915
+ function buildCounterStyleCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
916
+ name = formatCounterStyleName(format, id, { name });
917
+ const css = buildNamedAtRuleCss(COUNTER_STYLE_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat);
918
+ return {
919
+ name,
920
+ css
921
+ };
922
+ }
923
+ //#endregion
924
+ //#region utils/id.ts
925
+ function createIdCounter(name) {
926
+ return globalData("idCounter." + name, () => ({ value: 0 }));
927
+ }
928
+ function getId(idCounter, stableId) {
929
+ return stableId || {
930
+ name: null,
931
+ id: String(idCounter.value++)
932
+ };
933
+ }
934
+ //#endregion
935
+ //#region css/utils.ts
936
+ function createNamedAtRuleRef(config) {
937
+ const { id, name } = getId(config.idCounter, config.stableId || null);
938
+ const tokens = [];
939
+ const tokenLookup = /* @__PURE__ */ new Set();
940
+ const css = config.buildCss(config.format || null, name, id, config.value, tokens, tokenLookup, CSS_CONFIG.tokenNameFormat || null);
941
+ return createAtRuleRef({
942
+ key: css.name,
943
+ value: css.name,
944
+ css: css.css,
945
+ tokens: tokens.length ? tokens : void 0
946
+ });
947
+ }
948
+ //#endregion
949
+ //#region css/counterStyle.ts
950
+ const idCounter$5 = createIdCounter("counterStyle");
951
+ function createCounterStyle(descriptors, stableId) {
952
+ return createNamedAtRuleRef({
953
+ format: CSS_EXTRA_CONFIG.namedRuleFormat.counterStyle,
954
+ buildCss: buildCounterStyleCss,
955
+ value: descriptors,
956
+ idCounter: idCounter$5,
957
+ stableId
958
+ });
959
+ }
960
+ //#endregion
961
+ //#region atomic/atRule/fontFace.ts
962
+ const FONT_FACE_AT_RULE = "font-face";
963
+ const formatFontFaceName = createAtRuleNameFormatter("font[-(name)]-$hash");
964
+ function buildFontFaceCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
965
+ name = formatFontFaceName(format, id, { name });
966
+ let css = buildAtRuleDeclarationCss(descriptors, tokens, tokenLookup, tokenNameFormat, true, (property) => property !== "fontFamily");
967
+ css = `@${FONT_FACE_AT_RULE} { font-family: ${name}; ${css} }`;
968
+ return {
969
+ name,
970
+ css
971
+ };
972
+ }
973
+ //#endregion
974
+ //#region atomic/atRule/fontSrc.ts
975
+ function fontSrc(url, format) {
976
+ if (typeof url !== "string") throw new Error("fontSrc url must be a static string");
977
+ const src = `url("${escapeFontSrcPart(url)}")`;
978
+ return format ? `${src} format("${escapeFontSrcPart(format)}")` : src;
979
+ }
980
+ function escapeFontSrcPart(value) {
981
+ return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
982
+ }
983
+ //#endregion
984
+ //#region css/fontFace.ts
985
+ const idCounter$4 = createIdCounter("fontFace");
986
+ function createFontFace(descriptors, stableId) {
987
+ if (typeof descriptors.src !== "string") throw new Error("createFontFace \"src\" must be a static string");
988
+ return createNamedAtRuleRef({
989
+ format: CSS_EXTRA_CONFIG.namedRuleFormat.fontFace,
990
+ buildCss: buildFontFaceCss,
991
+ value: descriptors,
992
+ idCounter: idCounter$4,
993
+ stableId
994
+ });
995
+ }
996
+ //#endregion
997
+ //#region atomic/atRule/fontPaletteValues.ts
998
+ const FONT_PALETTE_VALUES_AT_RULE = "font-palette-values";
999
+ const formatFontPaletteValuesName = createAtRuleNameFormatter("font-palettle[-(name)]-$hash", "--");
1000
+ function buildFontPaletteValuesCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
1001
+ name = formatFontPaletteValuesName(format, id, { name });
1002
+ const css = buildNamedAtRuleCss(FONT_PALETTE_VALUES_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat);
1003
+ return {
1004
+ name,
1005
+ css
1006
+ };
1007
+ }
1008
+ //#endregion
1009
+ //#region css/fontPaletteValues.ts
1010
+ const idCounter$3 = createIdCounter("fontPaletteValues");
1011
+ function createFontPaletteValues(descriptors, stableId) {
1012
+ return createNamedAtRuleRef({
1013
+ format: CSS_EXTRA_CONFIG.namedRuleFormat.fontPaletteValues,
1014
+ buildCss: buildFontPaletteValuesCss,
1015
+ value: descriptors,
1016
+ idCounter: idCounter$3,
1017
+ stableId
1018
+ });
1019
+ }
1020
+ //#endregion
1021
+ //#region atomic/atRule/keyframes.ts
1022
+ const KEYFRAMES_AT_RULE = "keyframes";
1023
+ const formatKeyFramesName = createAtRuleNameFormatter("keyframes[-(name)]-$hash");
1024
+ function buildKeyframesCss(format, name, id, frames, tokens, tokenLookup, tokenNameFormat) {
1025
+ name = formatKeyFramesName(format, id, { name });
1026
+ let css = `@${KEYFRAMES_AT_RULE} ${name} {`;
1027
+ for (const selector in frames) {
1028
+ const frame = frames[selector];
1029
+ if (!frame) continue;
1030
+ css += selector + "{";
1031
+ css += buildAtRuleDeclarationCss(frame, tokens, tokenLookup, tokenNameFormat, false);
1032
+ css += "}";
1033
+ }
1034
+ css += "}";
1035
+ return {
1036
+ name,
1037
+ css
1038
+ };
1039
+ }
1040
+ //#endregion
1041
+ //#region css/keyframes.ts
1042
+ const idCounter$2 = createIdCounter("keyframes");
1043
+ function createKeyframes(frames, stableId) {
1044
+ return createNamedAtRuleRef({
1045
+ format: CSS_EXTRA_CONFIG.namedRuleFormat.keyframes,
1046
+ buildCss: buildKeyframesCss,
1047
+ value: frames,
1048
+ idCounter: idCounter$2,
1049
+ stableId
1050
+ });
1051
+ }
1052
+ //#endregion
1053
+ //#region atomic/atRule/positionTry.ts
1054
+ const POSITION_TRY_AT_RULE = "position-try";
1055
+ const formatPositionTryName = createAtRuleNameFormatter("position-try[-(name)]-$hash", "--");
1056
+ function buildPositionTryCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
1057
+ name = formatPositionTryName(format, id, { name });
1058
+ const css = buildNamedAtRuleCss(POSITION_TRY_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat);
1059
+ return {
1060
+ name,
1061
+ css
1062
+ };
1063
+ }
1064
+ //#endregion
1065
+ //#region css/positionTry.ts
1066
+ const idCounter$1 = createIdCounter("positionTry");
1067
+ function createPositionTry(descriptors, stableId) {
1068
+ return createNamedAtRuleRef({
1069
+ format: CSS_EXTRA_CONFIG.namedRuleFormat.positionTry,
1070
+ buildCss: buildPositionTryCss,
1071
+ value: descriptors,
1072
+ idCounter: idCounter$1,
1073
+ stableId
1074
+ });
1075
+ }
1076
+ //#endregion
1077
+ //#region atomic/atRule/property.ts
1078
+ const PROPERTY_AT_RULE = "property";
1079
+ const formatPropertyName = createAtRuleNameFormatter("[-(name)]-$hash", "--");
1080
+ function buildPropertyCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
1081
+ name = formatPropertyName(format, id, { name });
1082
+ return {
1083
+ css: buildNamedAtRuleCss(PROPERTY_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat),
1084
+ name
1085
+ };
1086
+ }
1087
+ //#endregion
1088
+ //#region css/property.ts
1089
+ const idCounter = createIdCounter("property");
1090
+ function createProperty(nameOrDescriptors, descriptorsOrStableId) {
1091
+ const descriptors = typeof nameOrDescriptors === "string" ? descriptorsOrStableId : nameOrDescriptors;
1092
+ return createNamedAtRuleRef({
1093
+ idCounter,
1094
+ stableId: typeof nameOrDescriptors === "string" ? {
1095
+ name: nameOrDescriptors,
1096
+ id: nameOrDescriptors
1097
+ } : descriptorsOrStableId,
1098
+ format: CSS_EXTRA_CONFIG.namedRuleFormat.property,
1099
+ value: descriptors,
1100
+ buildCss: buildPropertyCss
1101
+ });
1102
+ }
1103
+ //#endregion
1104
+ //#region css/sheet.ts
1105
+ function createSheet(optionsOrItems, itemsOrDebug, debug) {
1106
+ const hasOptions = isCreateSheetOptions(optionsOrItems) && arguments.length >= 2;
1107
+ const options = hasOptions ? optionsOrItems : {};
1108
+ const items = hasOptions ? itemsOrDebug : optionsOrItems;
1109
+ const resolvedDebug = hasOptions ? debug : itemsOrDebug;
1110
+ assertCreateSheetOptions(options);
1111
+ const callsite = resolveCallsite(resolvedDebug);
1112
+ let data = createSheetData(callsite, options);
1113
+ if (items) data = mergeSheetItems(data, callsite, items);
1114
+ return data;
1115
+ }
1116
+ function mergeSheetItems(data, callsite, items) {
1117
+ if (!items) return data;
1118
+ if (Array.isArray(items)) {
1119
+ let next = data;
1120
+ for (let i = 0, len = items.length; i < len; i++) next = mergeSheetItems(next, callsite, items[i]);
1121
+ return next;
1122
+ }
1123
+ if (isStyleTokenOverrideData(items)) {
1124
+ addSheetTokenOverride(data, items);
1125
+ return data;
1126
+ }
1127
+ if (!isSelectorData(items) && !isSelectorOverrideData(items)) throw new Error("createSheet(items) requires selector items from style.selector(...) or token overrides");
1128
+ const selectorItem = items;
1129
+ const selectors = getSelectorSelectors(selectorItem);
1130
+ const options = data[BUILDER_SHEET_OPTIONS];
1131
+ let next = data;
1132
+ if (isSelectorData(selectorItem)) return next;
1133
+ for (let i = 0, len = selectors.length; i < len; i++) next = mergeSheetData(next, callsite, getSelectorItemStyleData(selectorItem), null, setSheetSelectorOptions(selectors[i], options), null);
1134
+ return next;
1135
+ }
1136
+ function isCreateSheetOptions(value) {
1137
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
1138
+ return "layer" in value || "weight" in value || Object.keys(value).length === 0;
1139
+ }
1140
+ function assertCreateSheetOptions(options) {
1141
+ if (options.layer !== void 0 && typeof options.layer !== "boolean") throw new Error("createSheet options.layer must be a boolean");
1142
+ if (options.weight !== void 0 && (!Number.isInteger(options.weight) || options.weight < 1)) throw new Error("createSheet options.weight must be a positive integer");
1143
+ }
1144
+ function addSheetTokenOverride(data, item) {
1145
+ const state = data[BUILDER_STATE];
1146
+ const lookup = state.lookup ??= {};
1147
+ const lookupKey = getSheetTokenLookupKey(getStyleTokenId(item));
1148
+ const lookupIndex = lookup[lookupKey];
1149
+ if (typeof lookupIndex === "number") state.items[lookupIndex] = item;
1150
+ else lookup[lookupKey] = state.items.push(item) - 1;
1151
+ }
1152
+ function getSelectorItemStyleData(data) {
1153
+ return {
1154
+ [BUILDER_TYPE]: 1,
1155
+ [BUILDER_STATE]: data[BUILDER_STATE],
1156
+ [BUILDER_CALLSITE]: data[BUILDER_CALLSITE]
1157
+ };
1158
+ }
1159
+ function getSheetTokenLookupKey(tokenId) {
1160
+ return "token\0" + tokenId;
1161
+ }
1162
+ //#endregion
1163
+ //#region runtime/sheet/insert.ts
1164
+ function insertStylePropRuntimeItems(sheet, items) {
1165
+ if (!items.length) return;
1166
+ sheet.updateLayers(CSS_CONFIG.layers || LayerDefaultLayers);
1167
+ walkStylePropItemsSheetRules(items, (rule) => sheet.insert(rule), (theme) => insertRuntimeThemeRule(sheet, theme));
1168
+ }
1169
+ //#endregion
1170
+ //#region runtime/core/getClassName.ts
1171
+ function getClassName(styleProp, props = {}) {
1172
+ const marker = splitElementMarkerStyleProp(styleProp);
1173
+ const resolved = resolveClassNameRuntime(marker.styleProp, props);
1174
+ if (resolved.items.length) {
1175
+ if (!RUNTIME_CONFIG.isExtracted && !isServerRSC()) {
1176
+ const sheet = getGlobalSheet();
1177
+ insertStylePropRuntimeItems(sheet, resolved.items);
1178
+ sheet.flush();
1179
+ }
1180
+ }
1181
+ prependClassName(resolved.result, createElementMarkerClassName(marker.debug));
1182
+ return resolved.result;
1183
+ }
1184
+ function prependClassName(result, className) {
1185
+ if (!className) return;
1186
+ result.className = result.className ? `${className} ${result.className}` : className;
1187
+ }
1188
+ createTransformElement(getClassName);
1189
+ //#endregion
1190
+ //#region css/styleTarget.ts
1191
+ const sharedTargets = /* @__PURE__ */ new WeakMap();
1192
+ function createStyleTarget() {
1193
+ const owner = {};
1194
+ const targets = /* @__PURE__ */ new Map();
1195
+ return {
1196
+ apply(target, css, options) {
1197
+ if (!target) return;
1198
+ if (options?.enabled === false) {
1199
+ clearTarget(targets, owner, target);
1200
+ return;
1201
+ }
1202
+ const result = getClassName(css);
1203
+ const classNames = new Set(result.className?.split(/\s+/).filter(Boolean) ?? []);
1204
+ const styleEntries = Object.entries(result.style ?? {});
1205
+ const signature = createSignature(classNames, styleEntries);
1206
+ const previous = targets.get(target);
1207
+ if (previous?.signature === signature) return;
1208
+ const state = previous ?? {
1209
+ classNames: /* @__PURE__ */ new Set(),
1210
+ styleValues: /* @__PURE__ */ new Map(),
1211
+ signature: ""
1212
+ };
1213
+ updateClasses(target, state.classNames, classNames);
1214
+ updateStyles(target, owner, state.styleValues, styleEntries);
1215
+ state.classNames = classNames;
1216
+ state.signature = signature;
1217
+ targets.set(target, state);
1218
+ },
1219
+ destroy() {
1220
+ targets.forEach((_, target) => clearTarget(targets, owner, target));
1221
+ }
1222
+ };
1223
+ }
1224
+ function createSignature(classNames, styleEntries) {
1225
+ let signature = [...classNames].sort().join(" ");
1226
+ for (let i = 0, len = styleEntries.length; i < len; i++) {
1227
+ const [name, value] = styleEntries[i];
1228
+ signature += `\n${name}:${String(value)}`;
1229
+ }
1230
+ return signature;
1231
+ }
1232
+ function updateClasses(target, previous, next) {
1233
+ previous.forEach((className) => {
1234
+ if (!next.has(className)) removeClassName(target, className);
1235
+ });
1236
+ next.forEach((className) => {
1237
+ if (!previous.has(className)) addClassName(target, className);
1238
+ });
1239
+ }
1240
+ function addClassName(target, className) {
1241
+ const state = getSharedTargetState(target);
1242
+ const count = state.classNames.get(className) ?? 0;
1243
+ if (count === 0) target.classList.add(className);
1244
+ state.classNames.set(className, count + 1);
1245
+ }
1246
+ function removeClassName(target, className) {
1247
+ const state = getSharedTargetState(target);
1248
+ const count = state.classNames.get(className) ?? 0;
1249
+ if (count <= 1) {
1250
+ state.classNames.delete(className);
1251
+ target.classList.remove(className);
1252
+ deleteSharedStateIfEmpty(target, state);
1253
+ return;
1254
+ }
1255
+ state.classNames.set(className, count - 1);
1256
+ }
1257
+ function updateStyles(target, owner, previousValues, nextEntries) {
1258
+ const nextNames = /* @__PURE__ */ new Set();
1259
+ for (let i = 0, len = nextEntries.length; i < len; i++) {
1260
+ const [name, value] = nextEntries[i];
1261
+ const nextValue = String(value);
1262
+ nextNames.add(name);
1263
+ if (previousValues.get(name) !== nextValue) {
1264
+ setStyleValue(target, owner, name, nextValue);
1265
+ previousValues.set(name, nextValue);
1266
+ }
1267
+ }
1268
+ previousValues.forEach((_, name) => {
1269
+ if (nextNames.has(name)) return;
1270
+ removeStyleValue(target, owner, name);
1271
+ previousValues.delete(name);
1272
+ });
1273
+ }
1274
+ function clearTarget(targets, owner, target) {
1275
+ const state = targets.get(target);
1276
+ if (!state) return;
1277
+ state.classNames.forEach((className) => removeClassName(target, className));
1278
+ state.styleValues.forEach((_, name) => {
1279
+ removeStyleValue(target, owner, name);
1280
+ });
1281
+ targets.delete(target);
1282
+ }
1283
+ function setStyleValue(target, owner, name, value) {
1284
+ const targetState = getSharedTargetState(target);
1285
+ let styleState = targetState.styleNames.get(name);
1286
+ if (!styleState) {
1287
+ styleState = {
1288
+ initialValue: target.style.getPropertyValue(name),
1289
+ owners: /* @__PURE__ */ new Map()
1290
+ };
1291
+ targetState.styleNames.set(name, styleState);
1292
+ }
1293
+ styleState.owners.delete(owner);
1294
+ styleState.owners.set(owner, value);
1295
+ target.style.setProperty(name, value);
1296
+ }
1297
+ function removeStyleValue(target, owner, name) {
1298
+ const targetState = getSharedTargetState(target);
1299
+ const styleState = targetState.styleNames.get(name);
1300
+ if (!styleState) return;
1301
+ styleState.owners.delete(owner);
1302
+ const currentValue = getLastStyleValue(styleState);
1303
+ if (currentValue !== null) {
1304
+ target.style.setProperty(name, currentValue);
1305
+ return;
1306
+ }
1307
+ targetState.styleNames.delete(name);
1308
+ restoreStyleValue(target, name, styleState.initialValue);
1309
+ deleteSharedStateIfEmpty(target, targetState);
1310
+ }
1311
+ function getLastStyleValue(styleState) {
1312
+ let value = null;
1313
+ styleState.owners.forEach((ownerValue) => {
1314
+ value = ownerValue;
1315
+ });
1316
+ return value;
1317
+ }
1318
+ function getSharedTargetState(target) {
1319
+ let state = sharedTargets.get(target);
1320
+ if (!state) {
1321
+ state = {
1322
+ classNames: /* @__PURE__ */ new Map(),
1323
+ styleNames: /* @__PURE__ */ new Map()
1324
+ };
1325
+ sharedTargets.set(target, state);
1326
+ }
1327
+ return state;
1328
+ }
1329
+ function deleteSharedStateIfEmpty(target, state) {
1330
+ if (!state.classNames.size && !state.styleNames.size) sharedTargets.delete(target);
1331
+ }
1332
+ function restoreStyleValue(target, name, value) {
1333
+ if (value) target.style.setProperty(name, value);
1334
+ else target.style.removeProperty(name);
1335
+ }
1336
+ //#endregion
1337
+ export { AT_RULE_REF as A, createScopeData as B, mergeStyleData as C, normalizeSelectorArg as D, SELECTOR_MEDIA as E, isClassNameValue as F, createSlotOverrideData as G, createSelectorData as H, styleTransform as I, createStyleData as K, importantValue as L, isAtRuleRef as M, classNameTransform as N, isStyleWeightValue as O, classNameValue as P, isStyleImportantValue as R, mergeSlotOverrideData as S, SELECTOR_CONTAINER as T, createSelectorOverrideData as U, createScopeTargetData as V, createSlotData as W, FnPrefixStyle as _, createKeyframes as a, mergeSelectorOverrideData as b, fontSrc as c, getId as d, assertManualSelectorSyntax as f, FnPrefixSlot as g, FnPrefixSelector as h, createPositionTry as i, createAtRuleRef as j, weightValue as k, createCounterStyle as l, FnPrefixScope as m, createSheet as n, createFontPaletteValues as o, normalizeManualSelectors as p, createThemeData as q, createProperty as r, createFontFace as s, createStyleTarget as t, createIdCounter as u, resolveCallsite as v, getToken as w, mergeSlotData as x, transformStyle as y, mergeScopeData as z };
1338
+
1339
+ //# sourceMappingURL=css-BDn0epJ8.js.map