@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,785 @@
1
+ import { l as symbol, t as CSS_CONFIG } from "./css-DWBWsyxZ.js";
2
+ import { c as CHECK_CONFIG, t as DEBUG_CONFIG } from "./debug-BkVbf0Cz.js";
3
+ import { a as hashString, i as createNameFormatter, t as getIdentifierSafeHash } from "./hash-Cr-LCWDt.js";
4
+ import { g as DEV_CONFIG, i as sanitizeDebugPropertyName, l as getDebugFieldVarName, m as traceError, n as normalizePropertyName, s as getDebugFieldCallsite, t as normalizeDebugKeywordValue } from "./debug-YuhEIQVO.js";
5
+ import { C as BUILDER_SCOPE, D as BUILDER_SLOT_ID, E as BUILDER_SHEET_OPTIONS, O as BUILDER_STATE, S as BUILDER_CALLSITE, T as BUILDER_SELECTOR, a as getSelectorText$1, b as isStyleData, k as BUILDER_TYPE, n as shouldAppendCssPx, p as isScopeData, r as getSelectorHash, s as hasSheetSelectorAnchor, v as isSlotData, w as BUILDER_SCOPE_ID, y as isSlotOverrideData } from "./value-CK0-Xbov.js";
6
+ import { a as getCssVarRawFallback, f as getStyleTokenId, g as isStyleTokenOverrideData, h as isStyleTokenData, n as getTokenVar } from "./token-D33mKTka.js";
7
+ import { r as isClassNameValue } from "./transform-DSpimwwC.js";
8
+ //#region style/important.ts
9
+ const STYLE_IMPORTANT = symbol("style.important");
10
+ function importantValue(value) {
11
+ return {
12
+ [STYLE_IMPORTANT]: true,
13
+ value
14
+ };
15
+ }
16
+ function isStyleImportantValue(value) {
17
+ return !!value && typeof value === "object" && value[STYLE_IMPORTANT] === true;
18
+ }
19
+ //#endregion
20
+ //#region style/weight.ts
21
+ const STYLE_WEIGHT = symbol("style.weight");
22
+ function weightValue(value, weight) {
23
+ return {
24
+ [STYLE_WEIGHT]: true,
25
+ value,
26
+ weight
27
+ };
28
+ }
29
+ function isStyleWeightValue(value) {
30
+ return !!value && typeof value === "object" && value[STYLE_WEIGHT] === true;
31
+ }
32
+ //#endregion
33
+ //#region builder/data/create.ts
34
+ function createStyleData(callsite) {
35
+ return {
36
+ [BUILDER_TYPE]: 1,
37
+ [BUILDER_STATE]: {
38
+ items: [],
39
+ lookup: {}
40
+ },
41
+ [BUILDER_CALLSITE]: callsite
42
+ };
43
+ }
44
+ function createSheetData(callsite, options = {}) {
45
+ return {
46
+ [BUILDER_TYPE]: 9,
47
+ [BUILDER_STATE]: {
48
+ items: [],
49
+ lookup: {}
50
+ },
51
+ [BUILDER_CALLSITE]: callsite,
52
+ [BUILDER_SHEET_OPTIONS]: options
53
+ };
54
+ }
55
+ function createSlotData(callsite, slotId) {
56
+ return {
57
+ [BUILDER_TYPE]: 2,
58
+ [BUILDER_STATE]: {
59
+ items: [],
60
+ lookup: {}
61
+ },
62
+ [BUILDER_CALLSITE]: callsite,
63
+ [BUILDER_SLOT_ID]: slotId
64
+ };
65
+ }
66
+ function createSlotOverrideData(callsite, slotId) {
67
+ return {
68
+ [BUILDER_TYPE]: 3,
69
+ [BUILDER_STATE]: {
70
+ items: [],
71
+ lookup: {}
72
+ },
73
+ [BUILDER_CALLSITE]: callsite,
74
+ [BUILDER_SLOT_ID]: slotId
75
+ };
76
+ }
77
+ function createSelectorOverrideData(callsite, selectors) {
78
+ return {
79
+ [BUILDER_TYPE]: 8,
80
+ [BUILDER_STATE]: {
81
+ items: [],
82
+ lookup: {}
83
+ },
84
+ [BUILDER_CALLSITE]: callsite,
85
+ [BUILDER_SELECTOR]: selectors
86
+ };
87
+ }
88
+ function createSelectorData(callsite, selectors) {
89
+ return {
90
+ [BUILDER_TYPE]: 7,
91
+ [BUILDER_STATE]: {
92
+ items: [],
93
+ lookup: {}
94
+ },
95
+ [BUILDER_CALLSITE]: callsite,
96
+ [BUILDER_SELECTOR]: selectors
97
+ };
98
+ }
99
+ function createScopeData(callsite) {
100
+ return {
101
+ [BUILDER_TYPE]: 4,
102
+ [BUILDER_STATE]: {
103
+ items: [],
104
+ lookup: {}
105
+ },
106
+ [BUILDER_CALLSITE]: callsite
107
+ };
108
+ }
109
+ function createScopeTargetData(scope, slot) {
110
+ return {
111
+ [BUILDER_TYPE]: 5,
112
+ [BUILDER_SCOPE]: scope,
113
+ [BUILDER_SCOPE_ID]: slot[BUILDER_SLOT_ID]
114
+ };
115
+ }
116
+ function createThemeData(callsite, id, className, tokens) {
117
+ return {
118
+ [BUILDER_TYPE]: 6,
119
+ [BUILDER_STATE]: {
120
+ items: [],
121
+ lookup: {}
122
+ },
123
+ [BUILDER_CALLSITE]: callsite,
124
+ id,
125
+ className,
126
+ tokens
127
+ };
128
+ }
129
+ const formatClassName = createNameFormatter([
130
+ "atRule",
131
+ "scopeSelector",
132
+ "property",
133
+ "selector",
134
+ "value"
135
+ ]);
136
+ const formatTransformClassName = createNameFormatter(["className"]);
137
+ function getDebugClassName(format, hash, info) {
138
+ return formatClassName(format || "[(atRule)-][(scopeSelector)-](property)[-(selector)][-(value)]--$hash", hash, info);
139
+ }
140
+ function getDebugSheetClassName(format, hash, info) {
141
+ return formatClassName(format || "sheet-(property)[-(value)]--$hash", hash, info);
142
+ }
143
+ function getDebugTransformClassName(format, hash, info) {
144
+ return formatTransformClassName(format || "(className)--$hash", hash, info);
145
+ }
146
+ //#endregion
147
+ //#region atomic/debug/value.ts
148
+ function getDebugValueName(value) {
149
+ if (!value) return {
150
+ value: null,
151
+ arbitraryValue: null
152
+ };
153
+ const normalized = value.trim().toLowerCase();
154
+ if (!normalized) return {
155
+ value: null,
156
+ arbitraryValue: null
157
+ };
158
+ 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 {
159
+ value: null,
160
+ arbitraryValue: null
161
+ };
162
+ if (/^[a-z][a-z0-9-]*$/.test(normalized)) return {
163
+ value: normalized,
164
+ arbitraryValue: null
165
+ };
166
+ 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, "");
167
+ if (!name) return {
168
+ value: null,
169
+ arbitraryValue: null
170
+ };
171
+ return {
172
+ value: null,
173
+ arbitraryValue: name
174
+ };
175
+ }
176
+ //#endregion
177
+ //#region atomic/debug/property/data.ts
178
+ const PROPERTY_ALIASES = {
179
+ "border-radius": "radius",
180
+ "flex-direction": "flex",
181
+ "font-style": "font",
182
+ "font-weight": "font",
183
+ "grid-template-columns": "grid-cols",
184
+ "grid-template-rows": "grid-rows",
185
+ "align-items": "items",
186
+ "justify-content": "justify",
187
+ "z-index": "zindex",
188
+ "pointer-events": "pointer"
189
+ };
190
+ const KEYWORD_VALUE_PROPERTIES = new Set([
191
+ "align-content",
192
+ "align-items",
193
+ "align-self",
194
+ "background-repeat",
195
+ "background-size",
196
+ "border-collapse",
197
+ "border-style",
198
+ "box-sizing",
199
+ "clear",
200
+ "cursor",
201
+ "display",
202
+ "flex-direction",
203
+ "flex-wrap",
204
+ "float",
205
+ "font-weight",
206
+ "font-style",
207
+ "justify-content",
208
+ "justify-items",
209
+ "justify-self",
210
+ "list-style-position",
211
+ "list-style-type",
212
+ "object-fit",
213
+ "object-position",
214
+ "overflow",
215
+ "overflow-x",
216
+ "overflow-y",
217
+ "pointer-events",
218
+ "place-content",
219
+ "place-items",
220
+ "place-self",
221
+ "position",
222
+ "resize",
223
+ "table-layout",
224
+ "text-align",
225
+ "text-decoration-line",
226
+ "text-transform",
227
+ "user-select",
228
+ "vertical-align",
229
+ "visibility",
230
+ "white-space"
231
+ ]);
232
+ const ARBITRARY_VALUE_PROPERTIES = new Set(["font-weight"]);
233
+ //#endregion
234
+ //#region atomic/debug/property/property.ts
235
+ function getDebugPropertyName(property, value) {
236
+ if (!property) return null;
237
+ const normalized = normalizePropertyName(property);
238
+ const name = PROPERTY_ALIASES[normalized] || sanitizeDebugPropertyName(normalized);
239
+ if (!name) return null;
240
+ return {
241
+ property: name,
242
+ ...withKeywordValueFallback(normalized, value, withArbitraryValueFallback(normalized, getDebugValueName(value)))
243
+ };
244
+ }
245
+ function withArbitraryValueFallback(property, valueName) {
246
+ if (!valueName.arbitraryValue || ARBITRARY_VALUE_PROPERTIES.has(property)) return valueName;
247
+ return {
248
+ value: valueName.value,
249
+ arbitraryValue: null
250
+ };
251
+ }
252
+ function withKeywordValueFallback(property, value, valueName) {
253
+ if (valueName.value || valueName.arbitraryValue) return valueName;
254
+ if (!KEYWORD_VALUE_PROPERTIES.has(property)) return valueName;
255
+ const normalized = normalizeDebugKeywordValue(value);
256
+ if (!normalized) return valueName;
257
+ return {
258
+ value: normalized,
259
+ arbitraryValue: null
260
+ };
261
+ }
262
+ //#endregion
263
+ //#region atomic/debug/selector.ts
264
+ function getDebugSelectorName(selector) {
265
+ if (!selector) return null;
266
+ const normalized = selector.trim().toLowerCase();
267
+ if (/^[a-z0-9]+$/.test(normalized)) return null;
268
+ 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, ""));
269
+ }
270
+ function getDebugAtRuleName(selector) {
271
+ if (!selector || Array.isArray(selector) && selector.length === 0) return null;
272
+ return validateName((Array.isArray(selector) ? selector.map(parseAtRule).filter(Boolean).join("-") : parseAtRule(selector)).replace(/[-_]+/g, "-").replace(/^-+|-+$/g, ""));
273
+ }
274
+ function compressQuery(query) {
275
+ 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, "");
276
+ }
277
+ function validateName(name) {
278
+ if (!name || name === "selector" || name.length < 2) return null;
279
+ return name;
280
+ }
281
+ function parseAtRule(rule) {
282
+ const normalized = rule.trim().toLowerCase();
283
+ if (normalized.startsWith("@media")) return compressQuery(normalized.slice(6));
284
+ if (normalized.startsWith("@container")) return compressQuery(normalized.slice(10));
285
+ if (normalized.startsWith("@supports")) return compressQuery(normalized.slice(9));
286
+ return compressQuery(normalized);
287
+ }
288
+ //#endregion
289
+ //#region atomic/className.ts
290
+ function getAtomicClassName(property, priority, important, value, selector, parentSelector, atRule, callsite, localClassName, debugClassName, classNameFormat, transformClassName, transformClassNameFormat, sheetClassNameFormat = null, hashLength = null) {
291
+ let hash = property;
292
+ hash += "\n" + (priority || "");
293
+ if (important) hash += "\nimportant";
294
+ hash += "\n" + value;
295
+ hash += "\n" + (selector ? getSelectorHash(selector) : "");
296
+ hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
297
+ hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
298
+ hash += "\n" + getCallsiteHash(callsite, localClassName);
299
+ hash = getIdentifierSafeHash(hash, hashLength ?? getRuntimeClassNameHashLength(debugClassName));
300
+ if (!debugClassName) return hash;
301
+ if (transformClassName) return getDebugTransformClassName(transformClassNameFormat, hash, { className: transformClassName });
302
+ const propertyName = getDebugPropertyName(property, value);
303
+ const isSheetClassName = hasSheetSelectorAnchor(selector);
304
+ return (isSheetClassName ? getDebugSheetClassName : getDebugClassName)(isSheetClassName ? sheetClassNameFormat : classNameFormat, hash, {
305
+ atRule: atRule ? getDebugAtRuleName(atRule.map(getSelectorText$1)) : null,
306
+ scopeSelector: parentSelector ? getDebugSelectorName(getSelectorText$1(parentSelector)) : null,
307
+ selector: selector ? getDebugSelectorName(getSelectorText$1(selector)) : null,
308
+ property: propertyName ? propertyName.property : property,
309
+ value: propertyName ? propertyName.value ?? propertyName.arbitraryValue : null
310
+ });
311
+ }
312
+ function getRuntimeClassNameHashLength(debugClassName) {
313
+ return getClassNameHashLength({
314
+ debugClassName,
315
+ isDev: DEV_CONFIG.isDev,
316
+ devHashLength: DEV_CONFIG.hashLength,
317
+ cssHashLength: CSS_CONFIG.hashLength
318
+ });
319
+ }
320
+ function getClassNameHashLength(options) {
321
+ if (options.debugClassName && options.isDev) return options.devHashLength ?? options.cssHashLength ?? 5;
322
+ return options.cssHashLength ?? 7;
323
+ }
324
+ function getClassNameDedupe(property, priority, important, selector, parentSelector, atRule) {
325
+ let hash = property;
326
+ hash += "\n" + (priority || "");
327
+ if (important) hash += "\nimportant";
328
+ hash += "\n" + (selector ? getSelectorHash(selector) : "");
329
+ hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
330
+ hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
331
+ return hashString(hash);
332
+ }
333
+ function getCallsiteHash(callsite, localClassName) {
334
+ if (!localClassName || !callsite) return "";
335
+ return callsite.filePath + "\n" + callsite.line + ":" + callsite.column;
336
+ }
337
+ //#endregion
338
+ //#region builder/data/merge/utils.ts
339
+ function cloneData(data, source, debug, merge = true) {
340
+ const runtimeType = DEV_CONFIG.isDev ? debug ? -2 : -1 : -3;
341
+ const state = data[BUILDER_STATE];
342
+ state.items = merge ? source[BUILDER_STATE].items.slice() : [];
343
+ state.lookup = Object.assign(Object.create(null), merge ? source[BUILDER_STATE].lookup : null);
344
+ const lookup = state.lookup;
345
+ return [
346
+ runtimeType,
347
+ data,
348
+ state.items,
349
+ lookup
350
+ ];
351
+ }
352
+ function logInvalidData(message, data) {
353
+ console.log(traceError(message), "data:", data);
354
+ }
355
+ //#endregion
356
+ //#region builder/data/merge/scope.ts
357
+ function mergeScopeData(scope, callsite, items, debug, parentSelector, scopeAtRule) {
358
+ if (!items) return scope;
359
+ const sourceItems = Array.isArray(items) ? items : [items];
360
+ const [runtimeType, data, styles, lookup] = cloneData(scope, scope, debug);
361
+ let source;
362
+ let item;
363
+ let lookupIndex;
364
+ let weight;
365
+ let important;
366
+ let value;
367
+ let atRule;
368
+ let dedupe;
369
+ let className;
370
+ let itemDebug;
371
+ let itemCallsite;
372
+ for (let i = 0, len = sourceItems.length; i < len; i++) {
373
+ source = sourceItems[i];
374
+ if (!source) continue;
375
+ if (isStyleTokenOverrideData(source)) {
376
+ addTokenOverride(source, styles, lookup);
377
+ continue;
378
+ }
379
+ if (isScopeData(source)) {
380
+ const scopeItems = source[BUILDER_STATE].items;
381
+ for (let j = 0, len = scopeItems.length; j < len; j++) {
382
+ item = scopeItems[j];
383
+ if (isStyleTokenOverrideData(item)) {
384
+ addTokenOverride(item, styles, lookup);
385
+ continue;
386
+ }
387
+ if (Array.isArray(item) || item.type !== 4) {
388
+ logInvalidData("invalid scope data", {
389
+ source,
390
+ item
391
+ });
392
+ continue;
393
+ }
394
+ const sourceScopeItem = item;
395
+ atRule = scopeAtRule ? sourceScopeItem.atRule ? [scopeAtRule].concat(sourceScopeItem.atRule) : [scopeAtRule] : sourceScopeItem.atRule;
396
+ const scopeItem = {
397
+ ...sourceScopeItem,
398
+ runtime: runtimeType,
399
+ atRule,
400
+ parentSelector: parentSelector ?? sourceScopeItem.parentSelector
401
+ };
402
+ itemDebug = getMergedScopeDebug(debug, scopeItem);
403
+ itemCallsite = getDebugFieldCallsite(itemDebug ?? null, scopeItem.property) ?? callsite ?? scopeItem.callsite;
404
+ value = scopeItem.value;
405
+ weight = scopeItem.weight;
406
+ important = scopeItem.important;
407
+ dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule);
408
+ 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);
409
+ scopeItem.dedupe = dedupe;
410
+ scopeItem.className = className;
411
+ scopeItem.callsite = itemCallsite;
412
+ scopeItem.debug = itemDebug ?? null;
413
+ scopeItem.debugField = itemDebug ? scopeItem.property : null;
414
+ const lookupKey = getScopeLookupKey(scopeItem.slotId, dedupe);
415
+ lookupIndex = lookup[lookupKey];
416
+ if (typeof lookupIndex === "number") styles[lookupIndex] = scopeItem;
417
+ else lookup[lookupKey] = styles.push(scopeItem) - 1;
418
+ }
419
+ continue;
420
+ }
421
+ if (!isSlotOverrideData(source)) {
422
+ logInvalidData("invalid scope data", { source });
423
+ continue;
424
+ }
425
+ const slotId = source[BUILDER_SLOT_ID];
426
+ const overrideItems = source[BUILDER_STATE].items;
427
+ for (let j = 0, len = overrideItems.length; j < len; j++) {
428
+ item = overrideItems[j];
429
+ if (Array.isArray(item) || isStyleTokenOverrideData(item) || item.type !== 3) {
430
+ logInvalidData("invalid scope data", {
431
+ source,
432
+ item
433
+ });
434
+ continue;
435
+ }
436
+ const overrideItem = item;
437
+ atRule = scopeAtRule ? overrideItem.atRule ? [scopeAtRule].concat(overrideItem.atRule) : [scopeAtRule] : overrideItem.atRule;
438
+ const scopeItem = {
439
+ type: 4,
440
+ slotId,
441
+ runtime: runtimeType,
442
+ dedupe: "",
443
+ className: "",
444
+ property: overrideItem.property,
445
+ weight: overrideItem.weight,
446
+ important: overrideItem.important,
447
+ value: overrideItem.value,
448
+ transformClassName: overrideItem.transformClassName,
449
+ token: overrideItem.token,
450
+ selector: overrideItem.selector,
451
+ atRule,
452
+ callsite: overrideItem.callsite ?? callsite,
453
+ debug: overrideItem.debug,
454
+ debugField: overrideItem.debugField,
455
+ parentSelector
456
+ };
457
+ value = scopeItem.value;
458
+ weight = scopeItem.weight;
459
+ important = scopeItem.important;
460
+ dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, parentSelector, scopeItem.atRule);
461
+ 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);
462
+ scopeItem.dedupe = dedupe;
463
+ scopeItem.className = className;
464
+ const lookupKey = getScopeLookupKey(slotId, dedupe);
465
+ lookupIndex = lookup[lookupKey];
466
+ if (typeof lookupIndex === "number") styles[lookupIndex] = scopeItem;
467
+ else lookup[lookupKey] = styles.push(scopeItem) - 1;
468
+ }
469
+ }
470
+ return data;
471
+ }
472
+ function addTokenOverride(item, styles, lookup) {
473
+ const lookupKey = getTokenLookupKey(getStyleTokenId(item));
474
+ const lookupIndex = lookup[lookupKey];
475
+ if (typeof lookupIndex === "number") styles[lookupIndex] = item;
476
+ else lookup[lookupKey] = styles.push(item) - 1;
477
+ }
478
+ function getMergedScopeDebug(debug, item) {
479
+ if (!debug) return item.debug;
480
+ if (debug.fields?.[item.property]) return debug;
481
+ const valueLoc = getRuntimeScopeItemValueLoc(item);
482
+ if (!valueLoc) return debug;
483
+ return {
484
+ ...debug,
485
+ fields: {
486
+ ...debug.fields,
487
+ [item.property]: {
488
+ [0]: debug.loc,
489
+ [1]: valueLoc
490
+ }
491
+ }
492
+ };
493
+ }
494
+ function getRuntimeScopeItemValueLoc(item) {
495
+ if (item.debug && item.debugField) {
496
+ const loc = item.debug.fields?.[item.debugField];
497
+ if (Array.isArray(loc)) return withDebugSource$1(loc, item.debug.sourceUrl, item.debug.code);
498
+ if (loc) {
499
+ const valueLoc = loc[1] ?? loc[0] ?? null;
500
+ return valueLoc ? withDebugSource$1(valueLoc, item.debug.sourceUrl, item.debug.code) : null;
501
+ }
502
+ }
503
+ return item.callsite ? [
504
+ item.callsite.line,
505
+ item.callsite.column,
506
+ void 0,
507
+ item.callsite.sourceUrl,
508
+ item.callsite.sourceContent
509
+ ] : null;
510
+ }
511
+ function withDebugSource$1(loc, sourceUrl, sourceContent) {
512
+ return loc[3] ? loc : [
513
+ loc[0],
514
+ loc[1],
515
+ loc[2],
516
+ sourceUrl,
517
+ sourceContent
518
+ ];
519
+ }
520
+ function getScopeLookupKey(slotId, dedupe) {
521
+ return slotId + "\0" + dedupe;
522
+ }
523
+ function getTokenLookupKey(tokenId) {
524
+ return "token\0" + tokenId;
525
+ }
526
+ //#endregion
527
+ //#region style/valueRef.ts
528
+ const AT_RULE_REF = symbol("atRule.ref");
529
+ function createAtRuleRef(data) {
530
+ return {
531
+ [AT_RULE_REF]: true,
532
+ ...data
533
+ };
534
+ }
535
+ function isAtRuleRef(value) {
536
+ return !!value && typeof value === "object" && value[AT_RULE_REF] === true;
537
+ }
538
+ //#endregion
539
+ //#region builder/data/merge/style.ts
540
+ function mergeBuilderData(create, callsite, source, style, debug, selector, atRule, type) {
541
+ if (!style) return source;
542
+ const [runtimeType, data, styles, lookup] = cloneData(create(callsite, source), source, debug);
543
+ const slotId = isSlotData(source) || isSlotOverrideData(source) ? source[BUILDER_SLOT_ID] : null;
544
+ const items = [];
545
+ let item;
546
+ let itemData;
547
+ let valueRaw;
548
+ let value;
549
+ let weight;
550
+ let important;
551
+ let itemCallsite;
552
+ let className;
553
+ let dedupe;
554
+ let token;
555
+ let ref;
556
+ let variableName;
557
+ let transformClassName;
558
+ let lookupIndex;
559
+ if (isStyleData(style)) {
560
+ const stylesItems = style[BUILDER_STATE].items;
561
+ for (let i = 0, len = stylesItems.length; i < len; i++) {
562
+ item = stylesItems[i];
563
+ if (Array.isArray(item) || isStyleTokenOverrideData(item) || item.type !== 1) {
564
+ logInvalidData("invalid style data", {
565
+ item,
566
+ style
567
+ });
568
+ continue;
569
+ }
570
+ if (atRule) item = Object.assign({}, item, { atRule: item.atRule ? atRule.concat(item.atRule) : atRule });
571
+ if (selector) item = Object.assign({}, item, { selector: item.selector ? combineSelectors(selector, item.selector) : selector });
572
+ if (type === 2 && slotId !== null) item = Object.assign({}, item, {
573
+ type: 2,
574
+ slotId
575
+ });
576
+ else if (type === 3 && slotId !== null) item = Object.assign({}, item, {
577
+ type: 3,
578
+ slotId
579
+ });
580
+ else if (type === 8) item = Object.assign({}, item, { type: 1 });
581
+ const itemDebug = getMergedStyleDebug(debug, item);
582
+ const debugCallsite = getDebugFieldCallsite(itemDebug, item.property);
583
+ if (debugCallsite) item = Object.assign({}, item, {
584
+ callsite: debugCallsite,
585
+ debug: itemDebug,
586
+ debugField: item.property
587
+ });
588
+ items.push(item);
589
+ }
590
+ } else for (const property in style) {
591
+ valueRaw = style[property];
592
+ [valueRaw, weight, important] = unwrapAuthoredStyleValue(valueRaw);
593
+ const sourceType = source[BUILDER_TYPE];
594
+ checkImportantUsage(valueRaw, important, sourceType === 9 || sourceType === 8);
595
+ transformClassName = null;
596
+ if (isClassNameValue(valueRaw)) {
597
+ transformClassName = valueRaw.className;
598
+ valueRaw = valueRaw.value;
599
+ }
600
+ ref = isAtRuleRef(valueRaw) ? valueRaw : null;
601
+ if (ref) valueRaw = ref.value;
602
+ token = isStyleTokenData(valueRaw) ? valueRaw : null;
603
+ variableName = getDebugFieldVarName(debug, property);
604
+ value = variableName && token ? getCssVarRawFallback(variableName, getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null)) : token ? getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null) : String(valueRaw ?? "");
605
+ itemCallsite = getDebugFieldCallsite(debug, property) ?? callsite;
606
+ itemData = {
607
+ runtime: runtimeType,
608
+ debug,
609
+ debugField: property,
610
+ dedupe: "",
611
+ className: "",
612
+ property,
613
+ weight,
614
+ important,
615
+ value,
616
+ transformClassName,
617
+ variable: ref ? [3, ref] : variableName && token ? [
618
+ 1,
619
+ variableName,
620
+ valueRaw,
621
+ shouldAppendCssPx(property) ? 1 : void 0
622
+ ] : ref ? [3, ref] : void 0,
623
+ token,
624
+ selector,
625
+ atRule,
626
+ callsite: itemCallsite
627
+ };
628
+ if (type === 1 || type === 8) {
629
+ items.push({
630
+ ...itemData,
631
+ type: 1
632
+ });
633
+ continue;
634
+ }
635
+ if (slotId === null) {
636
+ logInvalidData("invalid style data", {
637
+ property,
638
+ style
639
+ });
640
+ continue;
641
+ }
642
+ if (type === 2) {
643
+ items.push({
644
+ ...itemData,
645
+ type: 2,
646
+ slotId
647
+ });
648
+ continue;
649
+ }
650
+ if (type === 3) {
651
+ items.push({
652
+ ...itemData,
653
+ type: 3,
654
+ slotId
655
+ });
656
+ continue;
657
+ }
658
+ logInvalidData("invalid style data", {
659
+ property,
660
+ style
661
+ });
662
+ }
663
+ if (!items.length) return data;
664
+ for (let i = 0, len = items.length; i < len; i++) {
665
+ item = items[i];
666
+ if (Array.isArray(item) || isStyleTokenOverrideData(item)) {
667
+ logInvalidData("invalid style data", {
668
+ item,
669
+ style
670
+ });
671
+ continue;
672
+ }
673
+ const runtimeItem = item;
674
+ value = runtimeItem.value;
675
+ weight = runtimeItem.weight;
676
+ important = runtimeItem.important;
677
+ dedupe = getClassNameDedupe(runtimeItem.property, weight, important, runtimeItem.selector, null, runtimeItem.atRule);
678
+ 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);
679
+ runtimeItem.dedupe = dedupe;
680
+ runtimeItem.className = className;
681
+ lookupIndex = lookup[dedupe];
682
+ if (typeof lookupIndex === "number") styles[lookupIndex] = runtimeItem;
683
+ else lookup[dedupe] = styles.push(runtimeItem) - 1;
684
+ }
685
+ return data;
686
+ }
687
+ function unwrapAuthoredStyleValue(value) {
688
+ let weight = null;
689
+ let important = false;
690
+ while (true) {
691
+ if (isStyleImportantValue(value)) {
692
+ important = true;
693
+ value = value.value;
694
+ continue;
695
+ }
696
+ if (isStyleWeightValue(value)) {
697
+ weight = value.weight;
698
+ value = value.value;
699
+ continue;
700
+ }
701
+ break;
702
+ }
703
+ return [
704
+ value,
705
+ weight,
706
+ important
707
+ ];
708
+ }
709
+ function checkImportantUsage(value, important, isSheet) {
710
+ const options = CHECK_CONFIG.important;
711
+ if (!options) return;
712
+ 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.");
713
+ if (important && !isSheet) reportImportantCheck(options.outsideSheet, "style.important(...) outside createSheet is discouraged. Prefer style.weight(...) for Fluentic style priority.");
714
+ }
715
+ function reportImportantCheck(level, message) {
716
+ if (!level) return;
717
+ if (level === "error") throw new Error(message);
718
+ if (DEV_CONFIG.isDev) console.warn("[fluentic-style] " + message);
719
+ }
720
+ function combineSelectors(parent, child) {
721
+ const parentText = getSelectorText(parent);
722
+ const childText = getSelectorText(child);
723
+ const priority = Math.max(getSelectorPriority(parent), getSelectorPriority(child));
724
+ const selector = parentText + childText;
725
+ return priority > 0 ? [selector, priority] : selector;
726
+ }
727
+ function getSelectorText(selector) {
728
+ return Array.isArray(selector) ? selector[0] : selector;
729
+ }
730
+ function getSelectorPriority(selector) {
731
+ return Array.isArray(selector) ? selector[1] : 0;
732
+ }
733
+ function getMergedStyleDebug(debug, item) {
734
+ if (!debug) return null;
735
+ if (debug.fields?.[item.property]) return debug;
736
+ const valueLoc = getMergedItemValueLoc(item);
737
+ if (!valueLoc) return debug;
738
+ return {
739
+ ...debug,
740
+ fields: {
741
+ ...debug.fields,
742
+ [item.property]: {
743
+ [0]: withDebugSource(debug.loc, debug),
744
+ [1]: valueLoc
745
+ }
746
+ }
747
+ };
748
+ }
749
+ function getMergedItemValueLoc(item) {
750
+ if (item.debug && item.debugField) {
751
+ const loc = item.debug.fields?.[item.debugField];
752
+ if (Array.isArray(loc)) return withDebugSource(loc, item.debug);
753
+ if (loc) {
754
+ const traceLoc = loc[1] ?? loc[0] ?? null;
755
+ return traceLoc ? withDebugSource(traceLoc, item.debug) : null;
756
+ }
757
+ }
758
+ return item.callsite ? [
759
+ item.callsite.line,
760
+ item.callsite.column,
761
+ void 0,
762
+ item.callsite.sourceUrl,
763
+ item.callsite.sourceContent
764
+ ] : null;
765
+ }
766
+ function withDebugSource(loc, debug) {
767
+ return loc[3] ? loc : [
768
+ loc[0],
769
+ loc[1],
770
+ loc[2],
771
+ debug.sourceUrl,
772
+ debug.code
773
+ ];
774
+ }
775
+ //#endregion
776
+ //#region builder/data/selector.ts
777
+ const SELECTOR_MEDIA = "@media";
778
+ const SELECTOR_CONTAINER = "@container";
779
+ function normalizeSelectorArg(arg) {
780
+ return arg.includes("\n") ? arg.replace(/\n/g, "") : arg;
781
+ }
782
+ //#endregion
783
+ export { createThemeData as _, AT_RULE_REF as a, importantValue as b, mergeScopeData as c, createSelectorData as d, createSelectorOverrideData as f, createStyleData as g, createSlotOverrideData as h, mergeBuilderData as i, createScopeData as l, createSlotData as m, SELECTOR_MEDIA as n, createAtRuleRef as o, createSheetData as p, normalizeSelectorArg as r, isAtRuleRef as s, SELECTOR_CONTAINER as t, createScopeTargetData as u, isStyleWeightValue as v, isStyleImportantValue as x, weightValue as y };
784
+
785
+ //# sourceMappingURL=data-CDrS1Bq4.js.map