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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/CHANGELOG.md +42 -1
  2. package/README.md +10 -9
  3. package/atomic/className.ts +10 -4
  4. package/atomic/debug/className/className.ts +10 -0
  5. package/atomic/rule.ts +6 -3
  6. package/atomic/utils/selector.ts +14 -1
  7. package/builder/classname/class_name_builder.ts +68 -24
  8. package/builder/classname/fns.ts +2 -2
  9. package/builder/classname/types.ts +7 -0
  10. package/builder/data/const.ts +6 -0
  11. package/builder/data/create.ts +42 -0
  12. package/builder/data/data.ts +20 -1
  13. package/builder/data/index.ts +0 -1
  14. package/builder/data/is.ts +23 -0
  15. package/builder/data/merge/scope.ts +20 -19
  16. package/builder/data/merge/style.ts +70 -20
  17. package/builder/data/state.ts +16 -2
  18. package/builder/extract/index.ts +1 -0
  19. package/builder/extract/sheet.ts +26 -0
  20. package/builder/extract/utils.ts +2 -0
  21. package/builder/extract/withTokens.ts +2 -1
  22. package/builder/selector_override.noop.ts +11 -0
  23. package/builder/selector_override.ts +30 -0
  24. package/builder/selector_override_core.ts +66 -0
  25. package/builder/style_builder.ts +127 -3
  26. package/builder/style_data.ts +24 -0
  27. package/builder/style_fns.ts +24 -24
  28. package/builder/types/alias.ts +34 -6
  29. package/builder/types/fns.ts +13 -5
  30. package/builder/types/types.ts +32 -2
  31. package/builder/utils.ts +1 -0
  32. package/compiler/compiler/compiler.ts +4 -7
  33. package/compiler/compiler/constants.ts +6 -0
  34. package/compiler/compiler/index.ts +1 -0
  35. package/compiler/compiler/types.ts +2 -0
  36. package/compiler/cssProp.ts +35 -0
  37. package/compiler/index.ts +1 -0
  38. package/compiler/transform/cssProp/index.ts +1 -0
  39. package/compiler/transform/cssProp/plugin.ts +129 -0
  40. package/compiler/transform/debug/plugin.ts +6 -0
  41. package/compiler/transform/debug/transform.ts +2 -1
  42. package/compiler/transform/evaluator/evaluator.ts +32 -4
  43. package/compiler/transform/evaluator/tracer.ts +30 -2
  44. package/compiler/transform/extract/chain/chain.ts +540 -62
  45. package/compiler/transform/extract/chain/extract_chain.ts +12 -4
  46. package/compiler/transform/extract/chain/types.ts +1 -1
  47. package/compiler/transform/extract/plugin.ts +20 -4
  48. package/compiler/transform/extract/transform.ts +2 -1
  49. package/compiler/transform/extract/utils/replacement.ts +47 -2
  50. package/compiler/transform/extract/utils/state.ts +2 -0
  51. package/compiler/transform/index.ts +1 -0
  52. package/compiler/transform/syntax/isStaticStyleValue.ts +15 -9
  53. package/compiler/utils/constants.ts +8 -1
  54. package/compiler/utils/imports.ts +11 -1
  55. package/config/config/css.ts +1 -0
  56. package/css/index.ts +2 -0
  57. package/css/sheet.ts +119 -0
  58. package/css/styleTarget.ts +251 -0
  59. package/dist/adapter/preact.js +2 -0
  60. package/dist/adapter/react.js +2 -0
  61. package/dist/adapter/solid.js +2 -0
  62. package/dist/className-hiAsQ9V6.js +303 -0
  63. package/dist/className-hiAsQ9V6.js.map +1 -0
  64. package/dist/combine-Ca6LfFxv.js +1279 -0
  65. package/dist/combine-Ca6LfFxv.js.map +1 -0
  66. package/dist/compiler/index.mjs +2 -2
  67. package/dist/{compiler-CE0ZgkdH.mjs → compiler-OgDBuqfs.mjs} +1427 -546
  68. package/dist/compiler-OgDBuqfs.mjs.map +1 -0
  69. package/dist/config-B-KbXpIh.js +6 -0
  70. package/dist/{config-oKOjOTWi.js.map → config-B-KbXpIh.js.map} +1 -1
  71. package/dist/config-Barf8f4B.js +35 -0
  72. package/dist/config-Barf8f4B.js.map +1 -0
  73. package/dist/{config-lJNLh7eM.js → config-CsB4MuFI.js} +2 -2
  74. package/dist/{config-lJNLh7eM.js.map → config-CsB4MuFI.js.map} +1 -1
  75. package/dist/config-DOWSNV8w.js +1 -0
  76. package/dist/{config-CduqubI8.js → config-t76UljYv.js} +3 -3
  77. package/dist/config-t76UljYv.js.map +1 -0
  78. package/dist/createTransformElement-DDqld3RF.js +34 -0
  79. package/dist/createTransformElement-DDqld3RF.js.map +1 -0
  80. package/dist/css-CZwrac6F.js +3923 -0
  81. package/dist/css-CZwrac6F.js.map +1 -0
  82. package/dist/css-GtUPEO9U.js.map +1 -1
  83. package/dist/css-YfHN_8Nk.js +479 -0
  84. package/dist/css-YfHN_8Nk.js.map +1 -0
  85. package/dist/css-a9O5so0b.js +1246 -0
  86. package/dist/css-a9O5so0b.js.map +1 -0
  87. package/dist/css.js +2 -2
  88. package/dist/{css_extra-DYtS3g6Z.js → css_extra-CXXZAylc.js} +2 -2
  89. package/dist/{css_extra-DYtS3g6Z.js.map → css_extra-CXXZAylc.js.map} +1 -1
  90. package/dist/{data-D7NFt4JG.js → data-CzHJg147.js} +145 -59
  91. package/dist/data-CzHJg147.js.map +1 -0
  92. package/dist/{debug-Cvpo5cVu.js → debug-DkrxyknP.js} +80 -5
  93. package/dist/debug-DkrxyknP.js.map +1 -0
  94. package/dist/dev/rsc.js +5 -8
  95. package/dist/dev/rsc.js.map +1 -1
  96. package/dist/{dev-DdRWa6dJ.js → dev-z4laBwlS.js} +4 -4
  97. package/dist/{dev-DdRWa6dJ.js.map → dev-z4laBwlS.js.map} +1 -1
  98. package/dist/dev.js +1 -1
  99. package/dist/dialect/extracted/index.js +1 -1
  100. package/dist/dialect/index.js +1 -1
  101. package/dist/{elementMarker-ng0y3fN0.js → elementMarker-CqhU_l_m.js} +94 -8
  102. package/dist/elementMarker-CqhU_l_m.js.map +1 -0
  103. package/dist/entry/dev/adapter/preact.js +12 -0
  104. package/dist/entry/dev/adapter/preact.js.map +1 -0
  105. package/dist/entry/dev/adapter/react.js +12 -0
  106. package/dist/entry/dev/adapter/react.js.map +1 -0
  107. package/dist/entry/dev/adapter/solid.js +12 -0
  108. package/dist/entry/dev/adapter/solid.js.map +1 -0
  109. package/dist/entry/dev/css.js +3 -3
  110. package/dist/entry/dev/jsx-dev-runtime.js +2 -2
  111. package/dist/entry/dev/jsx-runtime.js +2 -2
  112. package/dist/entry/dev.js +10 -8
  113. package/dist/entry/prod/adapter/preact.js +12 -0
  114. package/dist/entry/prod/adapter/preact.js.map +1 -0
  115. package/dist/entry/prod/adapter/react.js +12 -0
  116. package/dist/entry/prod/adapter/react.js.map +1 -0
  117. package/dist/entry/prod/adapter/solid.js +12 -0
  118. package/dist/entry/prod/adapter/solid.js.map +1 -0
  119. package/dist/entry/prod/css.js +3 -3
  120. package/dist/entry/prod/extract.js +240 -3
  121. package/dist/entry/prod/extract.js.map +1 -0
  122. package/dist/entry/prod/jsx-dev-runtime.js +2 -2
  123. package/dist/entry/prod/jsx-runtime.js +2 -2
  124. package/dist/entry/prod/runtime.js +3 -5
  125. package/dist/entry/prod.js +84 -1229
  126. package/dist/entry/prod.js.map +1 -1
  127. package/dist/entry/rsc-dev/adapter/preact.js +12 -0
  128. package/dist/entry/rsc-dev/adapter/preact.js.map +1 -0
  129. package/dist/entry/rsc-dev/adapter/react.js +12 -0
  130. package/dist/entry/rsc-dev/adapter/react.js.map +1 -0
  131. package/dist/entry/rsc-dev/adapter/solid.js +12 -0
  132. package/dist/entry/rsc-dev/adapter/solid.js.map +1 -0
  133. package/dist/entry/rsc-dev/css.js +3 -3
  134. package/dist/entry/rsc-dev/dev.js +6 -10
  135. package/dist/entry/rsc-dev/dev.js.map +1 -1
  136. package/dist/entry/rsc-dev/jsx-dev-runtime.js +2 -2
  137. package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
  138. package/dist/entry/rsc-dev.js +252 -750
  139. package/dist/entry/rsc-dev.js.map +1 -1
  140. package/dist/entry/rsc-prod/adapter/preact.js +2 -0
  141. package/dist/entry/rsc-prod/adapter/react.js +2 -0
  142. package/dist/entry/rsc-prod/adapter/solid.js +2 -0
  143. package/dist/entry/rsc-prod/css.js +9 -3
  144. package/dist/entry/rsc-prod/css.js.map +1 -0
  145. package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
  146. package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
  147. package/dist/entry/rsc-prod/runtime.js +3 -5
  148. package/dist/entry/rsc-prod.js +236 -11
  149. package/dist/entry/rsc-prod.js.map +1 -1
  150. package/dist/{styleStore-CajcAEPO.js → env-Db2cRt-h.js} +1185 -162
  151. package/dist/env-Db2cRt-h.js.map +1 -0
  152. package/dist/{jsx-DL-DEAz8.js → getClassName-DKtQl5ZX.js} +5 -12
  153. package/dist/getClassName-DKtQl5ZX.js.map +1 -0
  154. package/dist/{utils-B_VhPBHH.js → getClassName-DaZF5nfJ.js} +28 -65
  155. package/dist/getClassName-DaZF5nfJ.js.map +1 -0
  156. package/dist/getClassName-a6p2uMFM.js +536 -0
  157. package/dist/getClassName-a6p2uMFM.js.map +1 -0
  158. package/dist/{getClassName-CrNVjAoJ.js → getClassName-aD9zqg9U.js} +31 -10
  159. package/dist/getClassName-aD9zqg9U.js.map +1 -0
  160. package/dist/global-zYTvWskP.js +10 -0
  161. package/dist/{global-CZBlA9E7.js.map → global-zYTvWskP.js.map} +1 -1
  162. package/dist/{hash-BfeJDf5U.js → hash-BOlQThNz.js} +37 -2
  163. package/dist/hash-BOlQThNz.js.map +1 -0
  164. package/dist/index.js +7 -6
  165. package/dist/jsx/jsx-dev-runtime.js +2 -2
  166. package/dist/jsx/jsx-dev-runtime.server.js +1 -1
  167. package/dist/jsx/jsx-runtime.js +2 -2
  168. package/dist/jsx/jsx-runtime.server.js +1 -1
  169. package/dist/jsx-C2pnWLcb.js +39 -0
  170. package/dist/jsx-C2pnWLcb.js.map +1 -0
  171. package/dist/{jsx_dev_runtime-aAhNYDeS.js → jsx_dev_runtime-kSrmu6b1.js} +2 -3
  172. package/dist/{jsx_dev_runtime-aAhNYDeS.js.map → jsx_dev_runtime-kSrmu6b1.js.map} +1 -1
  173. package/dist/{jsx_runtime-D7Y5up6H.js → jsx_runtime-BgK90E2O.js} +2 -3
  174. package/dist/{jsx_runtime-D7Y5up6H.js.map → jsx_runtime-BgK90E2O.js.map} +1 -1
  175. package/dist/{jsx_runtime-C6i1bWlu.js → jsx_runtime-XJSHujgI.js} +2 -2
  176. package/dist/{jsx_runtime-C6i1bWlu.js.map → jsx_runtime-XJSHujgI.js.map} +1 -1
  177. package/dist/{loader-BmYS_Rju.mjs → loader-DHvgp0fK.mjs} +3 -3
  178. package/dist/{loader-BmYS_Rju.mjs.map → loader-DHvgp0fK.mjs.map} +1 -1
  179. package/dist/{misc-BIS_c7BJ.mjs → misc-BuSLnvx0.mjs} +4 -4
  180. package/dist/misc-BuSLnvx0.mjs.map +1 -0
  181. package/dist/{namedTokens-CN_yhhik.js → namedTokens-D3tt-joz.js} +3 -3
  182. package/dist/{namedTokens-CN_yhhik.js.map → namedTokens-D3tt-joz.js.map} +1 -1
  183. package/dist/plugin/farm/index.mjs +4 -3
  184. package/dist/plugin/farm/index.mjs.map +1 -1
  185. package/dist/plugin/nextjs/index.mjs +5 -5
  186. package/dist/plugin/nextjs/index.mjs.map +1 -1
  187. package/dist/plugin/nextjs/loader.mjs +4 -4
  188. package/dist/plugin/parcel/index.cjs +2 -0
  189. package/dist/plugin/parcel/index.mjs +3 -1
  190. package/dist/plugin/parcel/optimizer.cjs +1 -1
  191. package/dist/plugin/parcel/optimizer.mjs +2 -2
  192. package/dist/plugin/parcel/resolver.cjs +1 -1
  193. package/dist/plugin/parcel/resolver.mjs +2 -2
  194. package/dist/plugin/parcel/runtime.cjs +1 -1
  195. package/dist/plugin/parcel/runtime.mjs +1 -1
  196. package/dist/plugin/parcel/transformer.cjs +1 -1
  197. package/dist/plugin/parcel/transformer.mjs +2 -2
  198. package/dist/plugin/rspack/index.mjs +3 -2
  199. package/dist/plugin/rspack/index.mjs.map +1 -1
  200. package/dist/plugin/vite/index.mjs +6 -6
  201. package/dist/plugin/vite/index.mjs.map +1 -1
  202. package/dist/plugin/webpack/index.mjs +3 -2
  203. package/dist/plugin/webpack/loader.mjs +2 -2
  204. package/dist/presets/tailwind/index.js +3 -4
  205. package/dist/presets/tailwind/index.js.map +1 -1
  206. package/dist/{assert-BGdigdr5.js → presets-DSanixJV.js} +106 -2
  207. package/dist/presets-DSanixJV.js.map +1 -0
  208. package/dist/{registry-IaXmLQzA.mjs → registry-r3BKWqpI.mjs} +2 -2
  209. package/dist/{registry-IaXmLQzA.mjs.map → registry-r3BKWqpI.mjs.map} +1 -1
  210. package/dist/resolveClassNameRuntime-D5a37GNr.js +63 -0
  211. package/dist/resolveClassNameRuntime-D5a37GNr.js.map +1 -0
  212. package/dist/{rules-CxVzovt-.js → rules-B0_rKPfB.js} +583 -154
  213. package/dist/rules-B0_rKPfB.js.map +1 -0
  214. package/dist/{combine-C9vjpKCs.js → scope-BSuRLice.js} +239 -150
  215. package/dist/scope-BSuRLice.js.map +1 -0
  216. package/dist/selector/index.js +1 -2
  217. package/dist/server.js +12 -9
  218. package/dist/server.js.map +1 -1
  219. package/dist/{shared-CaJuvw03.cjs → shared-8_Msr7Q5.cjs} +1352 -466
  220. package/dist/shared-8_Msr7Q5.cjs.map +1 -0
  221. package/dist/{shared-DdPTZ0O3.mjs → shared-BGO_05rW.mjs} +4 -4
  222. package/dist/{shared-DdPTZ0O3.mjs.map → shared-BGO_05rW.mjs.map} +1 -1
  223. package/dist/sheet-BpLZIIuO.js +7 -0
  224. package/dist/{sheet-BWBzuy4D.js.map → sheet-BpLZIIuO.js.map} +1 -1
  225. package/dist/{sidecar-B3oCK9vC.mjs → sidecar-Bu2x35JE.mjs} +3 -3
  226. package/dist/{sidecar-B3oCK9vC.mjs.map → sidecar-Bu2x35JE.mjs.map} +1 -1
  227. package/dist/{styleStore-0fARJlZV.js → styleStore-BDy5TH6N.js} +3 -4
  228. package/dist/{styleStore-0fARJlZV.js.map → styleStore-BDy5TH6N.js.map} +1 -1
  229. package/dist/styleStore-DX3z_UVK.js +51 -0
  230. package/dist/styleStore-DX3z_UVK.js.map +1 -0
  231. package/dist/{token-D-S-4_mN.js → token-BsW_S8fN.js} +2 -2
  232. package/dist/{token-D-S-4_mN.js.map → token-BsW_S8fN.js.map} +1 -1
  233. package/dist/{trace-CFnhyCVf.js → trace-BdKEpgME.js} +2 -2
  234. package/dist/{trace-CFnhyCVf.js.map → trace-BdKEpgME.js.map} +1 -1
  235. package/dist/{trace-ZtgeY-8s.js → trace-DcuMxR45.js} +3 -3
  236. package/dist/{trace-ZtgeY-8s.js.map → trace-DcuMxR45.js.map} +1 -1
  237. package/dist/{style-CGaJndOl.js → types-BEUgXuu2.js} +268 -89
  238. package/dist/types-BEUgXuu2.js.map +1 -0
  239. package/dist/{utils-B5Xqf1lV.mjs → utils-BPDxr-oc.mjs} +4 -4
  240. package/dist/{utils-B5Xqf1lV.mjs.map → utils-BPDxr-oc.mjs.map} +1 -1
  241. package/dist/utils-CLnpwhJd.js +83 -0
  242. package/dist/utils-CLnpwhJd.js.map +1 -0
  243. package/dist/utils-CUl1BU40.js +72 -0
  244. package/dist/utils-CUl1BU40.js.map +1 -0
  245. package/dist/{utils-DaAiEEIG.mjs → utils-DZjLTV4D.mjs} +3 -3
  246. package/dist/{utils-DaAiEEIG.mjs.map → utils-DZjLTV4D.mjs.map} +1 -1
  247. package/dist/utils-okFWrQsg.js +41 -0
  248. package/dist/utils-okFWrQsg.js.map +1 -0
  249. package/dist/{utils-DzydRwYo.js → utils-sBVZEq4u.js} +141 -111
  250. package/dist/utils-sBVZEq4u.js.map +1 -0
  251. package/dist/utils.js +4 -4
  252. package/dist/utils.js.map +1 -1
  253. package/dist/value-CpJpQ00y.js +145 -0
  254. package/dist/value-CpJpQ00y.js.map +1 -0
  255. package/dist/{webpack-CHydnRXB.mjs → webpack-DTKgR-HY.mjs} +5 -5
  256. package/dist/webpack-DTKgR-HY.mjs.map +1 -0
  257. package/entry/dev/adapter/preact.ts +8 -0
  258. package/entry/dev/adapter/react.ts +8 -0
  259. package/entry/dev/adapter/solid.ts +8 -0
  260. package/entry/prod/adapter/preact.ts +8 -0
  261. package/entry/prod/adapter/react.ts +8 -0
  262. package/entry/prod/adapter/solid.ts +8 -0
  263. package/entry/rsc_dev/adapter/preact.ts +1 -0
  264. package/entry/rsc_dev/adapter/react.ts +1 -0
  265. package/entry/rsc_dev/adapter/solid.ts +1 -0
  266. package/entry/rsc_prod/adapter/preact.ts +1 -0
  267. package/entry/rsc_prod/adapter/react.ts +1 -0
  268. package/entry/rsc_prod/adapter/solid.ts +1 -0
  269. package/entry/shared/config_dev.ts +1 -1
  270. package/jsx/types/index.ts +3 -0
  271. package/jsx/types/preact.ts +14 -0
  272. package/jsx/{types.ts → types/react.ts} +2 -2
  273. package/jsx/types/solid.ts +32 -0
  274. package/package.json +78 -12
  275. package/plugin/bundler/farm/plugin.ts +2 -0
  276. package/plugin/bundler/parcel/plugin.ts +2 -0
  277. package/plugin/bundler/rspack/plugin.ts +1 -0
  278. package/plugin/bundler/vite/plugin.ts +3 -8
  279. package/plugin/bundler/vite/state.ts +2 -2
  280. package/plugin/bundler/webpack/plugin.ts +2 -1
  281. package/plugin/nextjs/plugin.ts +3 -0
  282. package/plugin/utils/compiler.ts +2 -0
  283. package/plugin/utils/runtimeEntry.ts +2 -2
  284. package/runtime/adapter/utils.ts +94 -0
  285. package/runtime/core/cache/combine.ts +33 -4
  286. package/runtime/core/cache/item.ts +31 -12
  287. package/runtime/core/cache/itemWithResolver.ts +44 -0
  288. package/runtime/core/cache/prop.ts +7 -6
  289. package/runtime/core/cache/result.ts +2 -2
  290. package/runtime/core/cache/stateItem.ts +16 -1
  291. package/runtime/core/combinedStyle.ts +4 -4
  292. package/runtime/extract/combineStyle.ts +179 -5
  293. package/runtime/extract/getClassName.ts +49 -6
  294. package/runtime/sheet/rule.ts +3 -10
  295. package/runtime/style/scope.ts +0 -24
  296. package/runtime/style/style.ts +179 -5
  297. package/runtime/types.ts +3 -3
  298. package/style/classname.ts +12 -6
  299. package/style/important.ts +19 -0
  300. package/style/index.ts +2 -0
  301. package/style/style.ts +16 -4
  302. package/style/types.ts +6 -4
  303. package/style/utils/expose.ts +4 -3
  304. package/style/weight.ts +21 -0
  305. package/dist/assert-BGdigdr5.js.map +0 -1
  306. package/dist/className-Do2Crx4b.js +0 -143
  307. package/dist/className-Do2Crx4b.js.map +0 -1
  308. package/dist/combine-C9vjpKCs.js.map +0 -1
  309. package/dist/combineStyle-DwAhsOmS.js +0 -26
  310. package/dist/combineStyle-DwAhsOmS.js.map +0 -1
  311. package/dist/compiler-CE0ZgkdH.mjs.map +0 -1
  312. package/dist/config-BE5D5x2N.js +0 -2
  313. package/dist/config-CduqubI8.js.map +0 -1
  314. package/dist/config-oKOjOTWi.js +0 -7
  315. package/dist/css-BewrRz3_.js +0 -243
  316. package/dist/css-BewrRz3_.js.map +0 -1
  317. package/dist/css-CiTI58yl.js +0 -1094
  318. package/dist/css-CiTI58yl.js.map +0 -1
  319. package/dist/css-Rc7ILf-3.js +0 -236
  320. package/dist/css-Rc7ILf-3.js.map +0 -1
  321. package/dist/cssIdent-BsyUXNNk.js +0 -38
  322. package/dist/cssIdent-BsyUXNNk.js.map +0 -1
  323. package/dist/cssVar-DGgQ2GIK.js +0 -92
  324. package/dist/cssVar-DGgQ2GIK.js.map +0 -1
  325. package/dist/data-D7NFt4JG.js.map +0 -1
  326. package/dist/debug-Cvpo5cVu.js.map +0 -1
  327. package/dist/dev-px0_6TNq.js +0 -81
  328. package/dist/dev-px0_6TNq.js.map +0 -1
  329. package/dist/elementMarker-ng0y3fN0.js.map +0 -1
  330. package/dist/extract-B-Vs88ME.js +0 -3
  331. package/dist/extract-CM8Fk2eK.js +0 -130
  332. package/dist/extract-CM8Fk2eK.js.map +0 -1
  333. package/dist/getClassName-CrNVjAoJ.js.map +0 -1
  334. package/dist/global-CZBlA9E7.js +0 -14
  335. package/dist/hash-BfeJDf5U.js.map +0 -1
  336. package/dist/jsx-BY1iFewe.js +0 -39
  337. package/dist/jsx-BY1iFewe.js.map +0 -1
  338. package/dist/jsx-DL-DEAz8.js.map +0 -1
  339. package/dist/layer-BSxAr-hy.js +0 -94
  340. package/dist/layer-BSxAr-hy.js.map +0 -1
  341. package/dist/misc-BIS_c7BJ.mjs.map +0 -1
  342. package/dist/presets-BhXa232U.js +0 -108
  343. package/dist/presets-BhXa232U.js.map +0 -1
  344. package/dist/property-BuLbzviK.js +0 -406
  345. package/dist/property-BuLbzviK.js.map +0 -1
  346. package/dist/rules-CxVzovt-.js.map +0 -1
  347. package/dist/selector-A-mRmMnI.js +0 -64
  348. package/dist/selector-A-mRmMnI.js.map +0 -1
  349. package/dist/shared-CaJuvw03.cjs.map +0 -1
  350. package/dist/sheet-BWBzuy4D.js +0 -7
  351. package/dist/style-CGaJndOl.js.map +0 -1
  352. package/dist/style-DDxjKdX0.js +0 -1891
  353. package/dist/style-DDxjKdX0.js.map +0 -1
  354. package/dist/style-S7LTQbRu.js +0 -5
  355. package/dist/styleStore-CajcAEPO.js.map +0 -1
  356. package/dist/symbols-Cp4ymzKF.js +0 -14
  357. package/dist/symbols-Cp4ymzKF.js.map +0 -1
  358. package/dist/utils-B_VhPBHH.js.map +0 -1
  359. package/dist/utils-CDUaX81o.js +0 -170
  360. package/dist/utils-CDUaX81o.js.map +0 -1
  361. package/dist/utils-DzydRwYo.js.map +0 -1
  362. package/dist/value-C0JRsyax.js +0 -64
  363. package/dist/value-C0JRsyax.js.map +0 -1
  364. package/dist/value-D08AocUs.js +0 -1053
  365. package/dist/value-D08AocUs.js.map +0 -1
  366. package/dist/valueRef-M3E1oza7.js +0 -16
  367. package/dist/valueRef-M3E1oza7.js.map +0 -1
  368. package/dist/webpack-CHydnRXB.mjs.map +0 -1
  369. package/dist/withTokens-DAzUIPvA.js +0 -95
  370. package/dist/withTokens-DAzUIPvA.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # @fluentic/style
2
2
 
3
+ ## 0.1.0-beta.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Add attachable selector sheets for styling fixed third-party class names
8
+ without emitting global CSS.
9
+
10
+ - Add `style.selector(...)` selector targets and `createSheet(...)` from
11
+ `@fluentic/style/css` for manual selector rules that still attach through
12
+ generated Fluentic classes.
13
+ - Support selector overrides and token overrides inside sheets so component
14
+ wrappers can expose local third-party themes with the same shape as
15
+ scoped style composition.
16
+ - Add `&` and `&?` selector handling for attached-element and portal-friendly
17
+ selector rules. Comma-separated selector strings are rejected; pass an
18
+ array when a rule should target multiple selectors.
19
+ - Add `createStyleTarget(...)` for applying style props to explicit DOM
20
+ targets such as `document.body`, with shared-target reference counting for
21
+ overlapping portal users.
22
+ - Make `combineStyle(...)` compose sheets directly, and add
23
+ `combineStyle.with(...)` plus array-only `combineStyle.multi(...)` for
24
+ cache-friendly style and sheet composition.
25
+ - Support selector sheet extraction, local token overrides, debug class
26
+ names, source tracing, and sourcemap data across runtime and extracted
27
+ builds.
28
+ - Add Preact css-prop support with a `CssPropPresets.Preact` compiler
29
+ preset, runtime adapters, JSX types, and a Vite example.
30
+ - Keep plugin css-prop configuration focused on `CssPropPresets` instead of
31
+ exporting each framework preset as a separate top-level plugin API.
32
+ - Add `style.important(...)` and `className.important(...)` for interop cases
33
+ that need emitted `!important` declarations, especially selector sheets
34
+ wrapping third-party CSS.
35
+ - Add `style.weight(...)` as the style-object counterpart to
36
+ `className.weight(...)`.
37
+ - Keep the extracted production runtime below 5 KB minified and gzipped with
38
+ `combineStyle` included, and keep selector parsing helpers out of the
39
+ extracted production entry.
40
+ - Add a React Select third-party selectors example, Preact integration docs,
41
+ and a clearer third-party styling guide for selector sheets, style targets,
42
+ portal menus, and the new `combineStyle` helpers.
43
+
3
44
  ## 0.1.0-beta.4
4
45
 
5
46
  ### Patch Changes
@@ -27,7 +68,7 @@ for transform-driven styling.
27
68
  ### Highlights
28
69
 
29
70
  - Add `createClassNameFn` for class-name-driven style builders.
30
- - Support nested class-name values, conditional falsey entries, weighted
71
+ - Support nested class-name values, conditional falsy entries, weighted
31
72
  class-name tokens, selector chaining, at-rules, and merges.
32
73
  - Add compiler extraction for class-name style chains.
33
74
  - Add Tailwind presets for both style-object and class-name authoring.
package/README.md CHANGED
@@ -1,17 +1,18 @@
1
1
  # Fluentic Style
2
2
 
3
- Component style composition for React.
3
+ Build your own styling language on top of a stable JSX styling model.
4
4
 
5
- React styling has a lot of good answers already: CSS files, utility classes,
5
+ Styling JSX apps has a lot of good answers already: CSS files, utility classes,
6
6
  CSS-in-JS, compiled CSS, design tokens, and component libraries. Fluentic
7
7
  explores a specific question inside that space: what if styles composed around
8
- React components the same way props and state do?
8
+ components the same way props and state do?
9
9
 
10
10
  With Fluentic, you start simple with type-safe `style(...)` and the JSX `css`
11
- prop. If your team prefers utility class names, you can also create class-name
12
- style chains, including a Tailwind-like preset. When a component needs variants,
13
- themes, nested parts, or consumer overrides, add slots, scopes, tokens, and
14
- `combineStyle(...)` so those styles stay organized around the component.
11
+ prop in React, Preact, Solid, and compatible JSX runtimes. If your team prefers
12
+ utility class names, you can also create class-name style chains, including a
13
+ Tailwind-like preset. When a component needs variants, themes, nested parts, or
14
+ consumer overrides, add slots, scopes, tokens, and `combineStyle(...)` so those
15
+ styles stay organized around the component.
15
16
 
16
17
  For production builds, styles are extracted into static atomic CSS output.
17
18
  Dynamic values from props and state still work as usual.
@@ -35,7 +36,7 @@ Or with pnpm:
35
36
  pnpm add @fluentic/style@beta
36
37
  ```
37
38
 
38
- Use Fluentic in a React app. Add a bundler plugin later when you want production
39
+ Use Fluentic in a JSX app. Add a bundler plugin later when you want production
39
40
  extraction.
40
41
 
41
42
  ## Configure Runtime JSX
@@ -380,7 +381,7 @@ production builds. Current benchmark snapshots:
380
381
  The main production checks are runtime cost and bundle size. In the production
381
382
  path most apps use, Fluentic extracts CSS at build time and ships the extracted
382
383
  production runtime for `css` prop composition, dynamic values, class-name
383
- merging, and token resolution. That runtime entry currently reports `4.45 KB`
384
+ merging, and token resolution. That runtime entry currently reports `4.92 KB`
384
385
  min+gzip.
385
386
  Browser and SSR benchmarks track whether style resolution stays fast in
386
387
  app-shaped renders. See the
@@ -3,16 +3,17 @@ import { CSS_CONFIG } from '../config/config/css';
3
3
  import { DEV_CONFIG } from '../config/config/dev';
4
4
  import type { ClassNameFormat, TransformClassNameFormat } from '../config/types';
5
5
  import { hashString } from '../utils/hash';
6
- import { getDebugClassName, getDebugTransformClassName } from './debug/className';
6
+ import { getDebugClassName, getDebugSheetClassName, getDebugTransformClassName } from './debug/className';
7
7
  import { getDebugPropertyName } from './debug/property';
8
8
  import { getDebugAtRuleName, getDebugSelectorName } from './debug/selector';
9
9
  export { getScopeClassName } from './scope';
10
10
  import { getIdentifierSafeHash } from './utils/hash';
11
- import { getSelectorHash, getSelectorText } from './utils/selector';
11
+ import { getSelectorHash, getSelectorText, hasSheetSelectorAnchor } from './utils/selector';
12
12
 
13
13
  export function getAtomicClassName(
14
14
  property: string,
15
15
  priority: number | null,
16
+ important: boolean,
16
17
  value: string,
17
18
  selector: ItemSelector | null,
18
19
  parentSelector: ItemSelector | null,
@@ -23,11 +24,13 @@ export function getAtomicClassName(
23
24
  classNameFormat: ClassNameFormat | null,
24
25
  transformClassName: string | null,
25
26
  transformClassNameFormat: TransformClassNameFormat | null,
27
+ sheetClassNameFormat: ClassNameFormat | null = null,
26
28
  hashLength: number | null = null,
27
29
  ) {
28
30
  let hash = property;
29
31
 
30
32
  hash += '\n' + (priority || '');
33
+ if (important) hash += '\nimportant';
31
34
  hash += '\n' + value;
32
35
  hash += '\n' + (selector ? getSelectorHash(selector) : '');
33
36
  hash += '\n' + (parentSelector ? getSelectorHash(parentSelector) : '');
@@ -51,8 +54,9 @@ export function getAtomicClassName(
51
54
 
52
55
  const propertyName = getDebugPropertyName(property, value);
53
56
 
54
- const className = getDebugClassName(
55
- classNameFormat,
57
+ const isSheetClassName = hasSheetSelectorAnchor(selector);
58
+ const className = (isSheetClassName ? getDebugSheetClassName : getDebugClassName)(
59
+ isSheetClassName ? sheetClassNameFormat : classNameFormat,
56
60
  hash,
57
61
  {
58
62
  atRule: atRule
@@ -84,6 +88,7 @@ function getRuntimeClassNameHashLength(debugClassName: boolean) {
84
88
  export function getClassNameDedupe(
85
89
  property: string,
86
90
  priority: number | null,
91
+ important: boolean,
87
92
  selector: ItemSelector | null,
88
93
  parentSelector: ItemSelector | null,
89
94
  atRule: ItemSelector[] | null,
@@ -91,6 +96,7 @@ export function getClassNameDedupe(
91
96
  let hash = property;
92
97
 
93
98
  hash += '\n' + (priority || '');
99
+ if (important) hash += '\nimportant';
94
100
  hash += '\n' + (selector ? getSelectorHash(selector) : '');
95
101
  hash += '\n' + (parentSelector ? getSelectorHash(parentSelector) : '');
96
102
  hash += '\n' + (atRule ? atRule.map(getSelectorHash).join('\n') : '');
@@ -8,6 +8,8 @@ import { createNameFormatter } from '../../utils/format';
8
8
 
9
9
  export const CLASS_NAME_FORMAT = '[(atRule)-][(scopeSelector)-](property)[-(selector)][-(value)]--$hash';
10
10
 
11
+ export const SHEET_CLASS_NAME_FORMAT = 'sheet-(property)[-(value)]--$hash';
12
+
11
13
  export const TRANSFORM_CLASS_NAME_FORMAT = '(className)--$hash';
12
14
 
13
15
  export const formatClassName = createNameFormatter<ClassNameInfo>([
@@ -30,6 +32,14 @@ export function getDebugClassName(
30
32
  return formatClassName(format || CLASS_NAME_FORMAT, hash, info);
31
33
  }
32
34
 
35
+ export function getDebugSheetClassName(
36
+ format: ClassNameFormat | null,
37
+ hash: string,
38
+ info: ClassNameInfo,
39
+ ) {
40
+ return formatClassName(format || SHEET_CLASS_NAME_FORMAT, hash, info);
41
+ }
42
+
33
43
  export function getDebugTransformClassName(
34
44
  format: TransformClassNameFormat | null,
35
45
  hash: string,
package/atomic/rule.ts CHANGED
@@ -4,23 +4,26 @@ import { LayerMediaPriorities, type LayerPriority, LayerSelectorPriorities } fro
4
4
  import { getCssPropertyName, getPropertyPriority } from './property';
5
5
  import { getScopeClassName } from './scope';
6
6
  import { escapeCssIdent } from './utils/cssIdent';
7
- import { getSelectorPriority, getSelectorText } from './utils/selector';
7
+ import { getSelectorPriority, getSelectorText, hasSheetSelectorAnchor } from './utils/selector';
8
8
  import { getCssPropertyValue } from './value';
9
9
 
10
10
  export function buildAtomicRule(
11
11
  className: string,
12
12
  property: string,
13
13
  value: string,
14
+ important: boolean,
14
15
  selector: ItemSelector | null,
15
16
  parentSelector: ItemSelector | null,
16
17
  atRules: ItemSelector[] | null,
17
18
  scopeClassNameFormat: ScopeClassNameFormat | null,
18
19
  ): string {
19
20
  const cssProp = getCssPropertyName(property);
20
- const cssValue = getCssPropertyValue(property, value);
21
+ const cssValue = getCssPropertyValue(property, value) + (important ? ' !important' : '');
21
22
  const escapedClass = escapeCssIdent(className);
22
23
 
23
- const classSelector = '.' + escapedClass;
24
+ const classSelector = hasSheetSelectorAnchor(selector)
25
+ ? `:where(.${escapedClass})`
26
+ : '.' + escapedClass;
24
27
  const itemSelector = selector ? getSelectorText(selector) : '';
25
28
 
26
29
  let selectorStr = classSelector + itemSelector;
@@ -1,7 +1,9 @@
1
+ import { SHEET_SELECTOR_ANCHOR } from '../../builder/data/const';
1
2
  import type { ItemSelector } from '../../builder/data/state';
2
3
 
3
4
  export function getSelectorText(selector: ItemSelector): string {
4
- return Array.isArray(selector) ? selector[0] : selector;
5
+ const text = Array.isArray(selector) ? selector[0] : selector;
6
+ return stripSheetSelectorAnchor(text);
5
7
  }
6
8
 
7
9
  export function getSelectorHash(selector: ItemSelector): string {
@@ -12,3 +14,14 @@ export function getSelectorPriority(selector: ItemSelector | null): number {
12
14
  if (!selector) return 0;
13
15
  return Array.isArray(selector) ? selector[1] : 0;
14
16
  }
17
+
18
+ export function hasSheetSelectorAnchor(selector: ItemSelector | null): boolean {
19
+ const text = selector ? Array.isArray(selector) ? selector[0] : selector : '';
20
+ return text.startsWith(SHEET_SELECTOR_ANCHOR);
21
+ }
22
+
23
+ function stripSheetSelectorAnchor(selector: string) {
24
+ return selector.startsWith(SHEET_SELECTOR_ANCHOR)
25
+ ? selector.slice(SHEET_SELECTOR_ANCHOR.length)
26
+ : selector;
27
+ }
@@ -1,7 +1,8 @@
1
1
  import { DEV_CONFIG } from '../../config/config/dev';
2
2
  import type { Selector } from '../../selector';
3
- import { type ClassNameTransform, classNameValue, isClassNameValue } from '../../style';
4
- import type { StyleValueTuple } from '../../style/types';
3
+ import { type ClassNameTransform, classNameValue, importantValue, isClassNameValue } from '../../style';
4
+ import { isStyleImportantValue } from '../../style/important';
5
+ import { isStyleWeightValue, weightValue } from '../../style/weight';
5
6
  import { traceMarker } from '../../utils/trace';
6
7
  import {
7
8
  createStyleData,
@@ -21,11 +22,19 @@ import { mergeStyleData } from '../style_data';
21
22
  import { createDefaultFnResult, createFns } from '../style_fns';
22
23
  import type { SelectorsRecord } from '../types';
23
24
  import { FnPrefixStyle, resolveCallsite } from '../utils';
24
- import type { ClassNameBuilder, ClassNameFn, ClassNameItem, ClassNameMergeData, WeightedClassName } from './types';
25
+ import type {
26
+ ClassNameBuilder,
27
+ ClassNameFn,
28
+ ClassNameItem,
29
+ ClassNameMergeData,
30
+ ImportantClassName,
31
+ WeightedClassName,
32
+ } from './types';
25
33
 
26
34
  type StyleRecord = Record<string, unknown>;
27
35
  type FlattenedClassName<ClassName extends string> = {
28
36
  className: ClassName;
37
+ important: boolean;
29
38
  weight: number | null;
30
39
  };
31
40
 
@@ -144,11 +153,11 @@ function createAtRuleFn<ClassName extends string>(
144
153
 
145
154
  let arg: string | readonly string[];
146
155
  let items: readonly ClassNameItem<ClassName>[];
147
- let priority: number | null = null;
156
+ let weight: number | null = null;
148
157
 
149
158
  if (hasArg) {
150
159
  if (isMedia && typeof withoutDebug[0] === 'number') {
151
- priority = withoutDebug[0];
160
+ weight = withoutDebug[0];
152
161
  arg = withoutDebug[1] as string | readonly string[];
153
162
  items = withoutDebug.slice(2) as readonly ClassNameItem<ClassName>[];
154
163
  } else {
@@ -156,7 +165,7 @@ function createAtRuleFn<ClassName extends string>(
156
165
  items = withoutDebug.slice(1) as readonly ClassNameItem<ClassName>[];
157
166
  }
158
167
  } else if (isMedia && typeof withoutDebug[0] === 'number') {
159
- priority = withoutDebug[0];
168
+ weight = withoutDebug[0];
160
169
  arg = fnSelector.selector;
161
170
  items = withoutDebug.slice(1) as readonly ClassNameItem<ClassName>[];
162
171
  } else {
@@ -187,7 +196,7 @@ function createAtRuleFn<ClassName extends string>(
187
196
  classNameStyle.style,
188
197
  classNameStyle.debug,
189
198
  null,
190
- [priority !== null ? [selector, priority] : selector],
199
+ [weight !== null ? [selector, weight] : selector],
191
200
  );
192
201
  }
193
202
 
@@ -321,8 +330,9 @@ function classNameItemsToStyle<ClassName extends string>(
321
330
  const weighted: StyleRecord = item.weight === null
322
331
  ? transformed
323
332
  : applyClassNameWeight(transformed, item.weight);
333
+ const nextStyle = item.important ? applyClassNameImportant(weighted) : weighted;
324
334
 
325
- style = style ? Object.assign({}, style, weighted) : weighted;
335
+ style = style ? Object.assign({}, style, nextStyle) : nextStyle;
326
336
 
327
337
  const loc = debug?.classNames?.[item.className];
328
338
  if (loc) {
@@ -359,20 +369,29 @@ function decorateClassNameStyle<ClassName extends string>(
359
369
  continue;
360
370
  }
361
371
 
362
- if (Array.isArray(value) && value.length === 2 && typeof value[0] === 'number') {
363
- const rawValue = (value as StyleValueTuple)[1];
364
- result[property] = isClassNameValue(rawValue)
365
- ? value
366
- : [(value as StyleValueTuple)[0], classNameValue(rawValue, className)];
367
- continue;
368
- }
369
-
370
- result[property] = isClassNameValue(value) ? value : classNameValue(value, className);
372
+ result[property] = decorateClassNameValue(value, className);
371
373
  }
372
374
 
373
375
  return result;
374
376
  }
375
377
 
378
+ function decorateClassNameValue<ClassName extends string>(
379
+ value: unknown,
380
+ className: ClassName,
381
+ ): unknown {
382
+ if (isClassNameValue(value)) return value;
383
+
384
+ if (isStyleImportantValue(value)) {
385
+ return importantValue(decorateClassNameValue(value.value, className));
386
+ }
387
+
388
+ if (isStyleWeightValue(value)) {
389
+ return weightValue(decorateClassNameValue(value.value, className), value.weight);
390
+ }
391
+
392
+ return classNameValue(value, className);
393
+ }
394
+
376
395
  function flattenClassNameItems<ClassName extends string>(
377
396
  items: readonly ClassNameItem<ClassName>[],
378
397
  ): FlattenedClassName<ClassName>[] {
@@ -392,7 +411,7 @@ function collectClassNameItem<ClassName extends string>(
392
411
  if (!item) return;
393
412
 
394
413
  if (typeof item === 'string') {
395
- result.push({ className: item, weight: null });
414
+ result.push({ className: item, important: false, weight: null });
396
415
  return;
397
416
  }
398
417
 
@@ -402,7 +421,12 @@ function collectClassNameItem<ClassName extends string>(
402
421
  }
403
422
 
404
423
  if (isWeightedClassName(item)) {
405
- result.push(item);
424
+ result.push({ ...item, important: false });
425
+ return;
426
+ }
427
+
428
+ if (isImportantClassName(item)) {
429
+ result.push({ className: item.className, important: true, weight: null });
406
430
  }
407
431
  }
408
432
 
@@ -415,6 +439,15 @@ function isWeightedClassName<ClassName extends string>(
415
439
  return typeof weighted.className === 'string' && typeof weighted.weight === 'number';
416
440
  }
417
441
 
442
+ function isImportantClassName<ClassName extends string>(
443
+ item: unknown,
444
+ ): item is ImportantClassName<ClassName> {
445
+ if (!item || typeof item !== 'object') return false;
446
+
447
+ const important = item as Partial<ImportantClassName<ClassName>>;
448
+ return typeof important.className === 'string' && important.important === true;
449
+ }
450
+
418
451
  function applyClassNameWeight(
419
452
  style: StyleRecord,
420
453
  weight: number,
@@ -427,16 +460,27 @@ function applyClassNameWeight(
427
460
  continue;
428
461
  }
429
462
 
430
- const rawValue = Array.isArray(value) && value.length === 2 && typeof value[0] === 'number'
431
- ? value[1]
432
- : value;
433
-
434
- weighted[property] = [weight, rawValue];
463
+ weighted[property] = weightValue(value, weight);
435
464
  }
436
465
 
437
466
  return weighted;
438
467
  }
439
468
 
469
+ function applyClassNameImportant(style: StyleRecord): StyleRecord {
470
+ const important: StyleRecord = {};
471
+
472
+ for (const [property, value] of Object.entries(style)) {
473
+ if (value === null || value === undefined) {
474
+ important[property] = value;
475
+ continue;
476
+ }
477
+
478
+ important[property] = importantValue(value);
479
+ }
480
+
481
+ return important;
482
+ }
483
+
440
484
  function splitDebug<T>(
441
485
  params: readonly T[],
442
486
  ): [items: T[], debug: DebugData | undefined] {
@@ -29,11 +29,11 @@ type ClassNameAtRuleNoArgFn<ClassName extends string, Self> = {
29
29
  };
30
30
 
31
31
  type ClassNameMediaFn<ClassName extends string, Self, Arg> = ClassNameAtRuleFn<ClassName, Self, Arg> & {
32
- (priority: number, selector: Arg, ...items: ClassNameItems<ClassName>): Self;
32
+ (weight: number, selector: Arg, ...items: ClassNameItems<ClassName>): Self;
33
33
  };
34
34
 
35
35
  type ClassNameMediaNoArgFn<ClassName extends string, Self> = ClassNameAtRuleNoArgFn<ClassName, Self> & {
36
- (priority: number, ...items: ClassNameItems<ClassName>): Self;
36
+ (weight: number, ...items: ClassNameItems<ClassName>): Self;
37
37
  };
38
38
 
39
39
  type ClassNameAtRuleArgFn<ClassName extends string, Self, Arg extends string> = ClassNameAtRuleFn<ClassName, Self, Arg>;
@@ -6,12 +6,18 @@ export type WeightedClassName<ClassName extends string = string> = {
6
6
  readonly weight: number;
7
7
  };
8
8
 
9
+ export type ImportantClassName<ClassName extends string = string> = {
10
+ readonly className: ClassName;
11
+ readonly important: true;
12
+ };
13
+
9
14
  export type ClassNameItem<ClassName extends string = string> =
10
15
  | ClassName
11
16
  | false
12
17
  | null
13
18
  | undefined
14
19
  | WeightedClassName<ClassName>
20
+ | ImportantClassName<ClassName>
15
21
  | readonly ClassNameItem<ClassName>[];
16
22
 
17
23
  export type ClassNameMergeData<ClassName extends string = string> =
@@ -31,4 +37,5 @@ export type ClassNameFn<ClassName extends string, Selectors> =
31
37
  & ClassNameSelfFn<ClassName, Selectors>
32
38
  & {
33
39
  weight(className: ClassName, weight: number): WeightedClassName<ClassName>;
40
+ important(className: ClassName): ImportantClassName<ClassName>;
34
41
  };
@@ -6,6 +6,7 @@ export const BUILDER_CALLSITE: unique symbol = symbol('builder.callsite');
6
6
  export const BUILDER_SLOT_ID: unique symbol = symbol('builder.slotId');
7
7
  export const BUILDER_SCOPE_ID: unique symbol = symbol('builder.scopeId');
8
8
  export const BUILDER_SCOPE: unique symbol = symbol('builder.scope');
9
+ export const BUILDER_SELECTOR: unique symbol = symbol('builder.selector');
9
10
 
10
11
  export const BUILDER_TYPE_STYLE = 1;
11
12
  export const BUILDER_TYPE_SLOT = 2;
@@ -13,6 +14,9 @@ export const BUILDER_TYPE_SLOT_OVERRIDE = 3;
13
14
  export const BUILDER_TYPE_SCOPE = 4;
14
15
  export const BUILDER_TYPE_SCOPE_TARGET = 5;
15
16
  export const BUILDER_TYPE_THEME = 6;
17
+ export const BUILDER_TYPE_SELECTOR = 7;
18
+ export const BUILDER_TYPE_SELECTOR_OVERRIDE = 8;
19
+ export const BUILDER_TYPE_SHEET = 9;
16
20
 
17
21
  export const ITEM_RUNTIME_DEV = -1;
18
22
  export const ITEM_RUNTIME_DEV_PLUGIN = -2;
@@ -23,3 +27,5 @@ export const ITEM_VALUE_TYPE_VARIABLE = 1;
23
27
  export const ITEM_VALUE_TYPE_STYLE_DATA = 2;
24
28
  export const ITEM_VALUE_NUMBER_PX = 1;
25
29
  export const ITEM_VALUE_TYPE_AT_RULE_REF = 3;
30
+
31
+ export const SHEET_SELECTOR_ANCHOR = '\0sheet';
@@ -3,11 +3,15 @@ import {
3
3
  BUILDER_CALLSITE,
4
4
  BUILDER_SCOPE,
5
5
  BUILDER_SCOPE_ID,
6
+ BUILDER_SELECTOR,
6
7
  BUILDER_SLOT_ID,
7
8
  BUILDER_STATE,
8
9
  BUILDER_TYPE,
9
10
  BUILDER_TYPE_SCOPE,
10
11
  BUILDER_TYPE_SCOPE_TARGET,
12
+ BUILDER_TYPE_SELECTOR,
13
+ BUILDER_TYPE_SELECTOR_OVERRIDE,
14
+ BUILDER_TYPE_SHEET,
11
15
  BUILDER_TYPE_SLOT,
12
16
  BUILDER_TYPE_SLOT_OVERRIDE,
13
17
  BUILDER_TYPE_STYLE,
@@ -18,11 +22,15 @@ import type {
18
22
  BuilderData,
19
23
  ScopeData,
20
24
  ScopeTargetData,
25
+ SelectorData,
26
+ SelectorOverrideData,
27
+ SheetData,
21
28
  SlotData,
22
29
  SlotOverrideData,
23
30
  StyleData,
24
31
  ThemeData,
25
32
  } from './data';
33
+ import type { ItemSelector } from './state';
26
34
 
27
35
  export function createStyleData<Style>(
28
36
  callsite: BuilderCallsite | null,
@@ -34,6 +42,16 @@ export function createStyleData<Style>(
34
42
  };
35
43
  }
36
44
 
45
+ export function createSheetData<Style>(
46
+ callsite: BuilderCallsite | null,
47
+ ): SheetData<Style> {
48
+ return {
49
+ [BUILDER_TYPE]: BUILDER_TYPE_SHEET,
50
+ [BUILDER_STATE]: { items: [], lookup: {} },
51
+ [BUILDER_CALLSITE]: callsite,
52
+ };
53
+ }
54
+
37
55
  export function createSlotData<Style>(
38
56
  callsite: BuilderCallsite | null,
39
57
  slotId: string,
@@ -58,6 +76,30 @@ export function createSlotOverrideData<Style>(
58
76
  };
59
77
  }
60
78
 
79
+ export function createSelectorOverrideData<Style>(
80
+ callsite: BuilderCallsite | null,
81
+ selectors: readonly ItemSelector[],
82
+ ): SelectorOverrideData<Style> {
83
+ return {
84
+ [BUILDER_TYPE]: BUILDER_TYPE_SELECTOR_OVERRIDE,
85
+ [BUILDER_STATE]: { items: [], lookup: {} },
86
+ [BUILDER_CALLSITE]: callsite,
87
+ [BUILDER_SELECTOR]: selectors,
88
+ };
89
+ }
90
+
91
+ export function createSelectorData<Style>(
92
+ callsite: BuilderCallsite | null,
93
+ selectors: readonly ItemSelector[],
94
+ ): SelectorData<Style> {
95
+ return {
96
+ [BUILDER_TYPE]: BUILDER_TYPE_SELECTOR,
97
+ [BUILDER_STATE]: { items: [], lookup: {} },
98
+ [BUILDER_CALLSITE]: callsite,
99
+ [BUILDER_SELECTOR]: selectors,
100
+ };
101
+ }
102
+
61
103
  export function createScopeData(
62
104
  callsite: BuilderCallsite | null,
63
105
  ): BuilderData<unknown, typeof BUILDER_TYPE_SCOPE> {
@@ -4,17 +4,21 @@ import type {
4
4
  BUILDER_CALLSITE,
5
5
  BUILDER_SCOPE,
6
6
  BUILDER_SCOPE_ID,
7
+ BUILDER_SELECTOR,
7
8
  BUILDER_SLOT_ID,
8
9
  BUILDER_STATE,
9
10
  BUILDER_TYPE,
10
11
  BUILDER_TYPE_SCOPE,
11
12
  BUILDER_TYPE_SCOPE_TARGET,
13
+ BUILDER_TYPE_SELECTOR,
14
+ BUILDER_TYPE_SELECTOR_OVERRIDE,
15
+ BUILDER_TYPE_SHEET,
12
16
  BUILDER_TYPE_SLOT,
13
17
  BUILDER_TYPE_SLOT_OVERRIDE,
14
18
  BUILDER_TYPE_STYLE,
15
19
  BUILDER_TYPE_THEME,
16
20
  } from './const';
17
- import type { BuilderState } from './state';
21
+ import type { BuilderState, ItemSelector } from './state';
18
22
 
19
23
  export type BuilderCallsite = TraceCallsite;
20
24
 
@@ -28,6 +32,9 @@ export type AnyBuilderData<Style = unknown> =
28
32
  | StyleData<Style>
29
33
  | SlotData<Style>
30
34
  | SlotOverrideData<Style>
35
+ | SelectorData<Style>
36
+ | SelectorOverrideData<Style>
37
+ | SheetData<Style>
31
38
  | ScopeData
32
39
  | ScopeTargetData
33
40
  | ThemeData;
@@ -44,6 +51,18 @@ export type SlotOverrideData<Style = unknown> =
44
51
  & BuilderData<Style, typeof BUILDER_TYPE_SLOT_OVERRIDE>
45
52
  & { [BUILDER_SLOT_ID]: string; };
46
53
 
54
+ export type SelectorData<Style = unknown> =
55
+ & BuilderData<Style, typeof BUILDER_TYPE_SELECTOR>
56
+ & { [BUILDER_SELECTOR]: readonly ItemSelector[]; };
57
+
58
+ export type SelectorOverrideData<Style = unknown> =
59
+ & BuilderData<Style, typeof BUILDER_TYPE_SELECTOR_OVERRIDE>
60
+ & { [BUILDER_SELECTOR]: readonly ItemSelector[]; };
61
+
62
+ export type SheetData<Style = unknown> =
63
+ & BuilderData<Style, typeof BUILDER_TYPE_SHEET>
64
+ & {};
65
+
47
66
  export type ScopeData =
48
67
  & BuilderData<unknown, typeof BUILDER_TYPE_SCOPE>
49
68
  & {
@@ -1,4 +1,3 @@
1
- export * from './check_selector';
2
1
  export * from './const';
3
2
  export * from './create';
4
3
  export * from './data';
@@ -2,10 +2,14 @@ import type { StyleValue } from '../../style/types';
2
2
  import {
3
3
  BUILDER_SCOPE,
4
4
  BUILDER_SCOPE_ID,
5
+ BUILDER_SELECTOR,
5
6
  BUILDER_SLOT_ID,
6
7
  BUILDER_TYPE,
7
8
  BUILDER_TYPE_SCOPE,
8
9
  BUILDER_TYPE_SCOPE_TARGET,
10
+ BUILDER_TYPE_SELECTOR,
11
+ BUILDER_TYPE_SELECTOR_OVERRIDE,
12
+ BUILDER_TYPE_SHEET,
9
13
  BUILDER_TYPE_SLOT,
10
14
  BUILDER_TYPE_SLOT_OVERRIDE,
11
15
  BUILDER_TYPE_STYLE,
@@ -15,6 +19,9 @@ import {
15
19
  type BuilderData,
16
20
  type ScopeData,
17
21
  type ScopeTargetData,
22
+ type SelectorData,
23
+ type SelectorOverrideData,
24
+ type SheetData,
18
25
  type SlotData,
19
26
  type SlotOverrideData,
20
27
  type StyleData,
@@ -33,6 +40,10 @@ export function getScopeTargetScope(data: ScopeTargetData) {
33
40
  return data[BUILDER_SCOPE];
34
41
  }
35
42
 
43
+ export function getSelectorSelectors(data: SelectorData | SelectorOverrideData) {
44
+ return data[BUILDER_SELECTOR];
45
+ }
46
+
36
47
  export function isStyleValue<T>(value: unknown): value is StyleValue<T> {
37
48
  return Array.isArray(value);
38
49
  }
@@ -49,6 +60,18 @@ export function isSlotOverrideData<Style>(value: unknown): value is SlotOverride
49
60
  return getBuilderType(value) === BUILDER_TYPE_SLOT_OVERRIDE;
50
61
  }
51
62
 
63
+ export function isSelectorData<Style>(value: unknown): value is SelectorData<Style> {
64
+ return getBuilderType(value) === BUILDER_TYPE_SELECTOR;
65
+ }
66
+
67
+ export function isSelectorOverrideData<Style>(value: unknown): value is SelectorOverrideData<Style> {
68
+ return getBuilderType(value) === BUILDER_TYPE_SELECTOR_OVERRIDE;
69
+ }
70
+
71
+ export function isSheetData<Style>(value: unknown): value is SheetData<Style> {
72
+ return getBuilderType(value) === BUILDER_TYPE_SHEET;
73
+ }
74
+
52
75
  export function isScopeData(value: unknown): value is ScopeData {
53
76
  return getBuilderType(value) === BUILDER_TYPE_SCOPE;
54
77
  }