@tenphi/tasty 0.1.0

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 (359) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +236 -0
  3. package/dist/_virtual/_rolldown/runtime.mjs +7 -0
  4. package/dist/chunks/cacheKey.d.ts +1 -0
  5. package/dist/chunks/cacheKey.js +70 -0
  6. package/dist/chunks/cacheKey.js.map +1 -0
  7. package/dist/chunks/cacheKey.mjs +70 -0
  8. package/dist/chunks/cacheKey.mjs.map +1 -0
  9. package/dist/chunks/definitions.d.ts +37 -0
  10. package/dist/chunks/definitions.js +260 -0
  11. package/dist/chunks/definitions.js.map +1 -0
  12. package/dist/chunks/definitions.mjs +260 -0
  13. package/dist/chunks/definitions.mjs.map +1 -0
  14. package/dist/chunks/index.d.ts +3 -0
  15. package/dist/chunks/renderChunk.d.ts +2 -0
  16. package/dist/chunks/renderChunk.js +61 -0
  17. package/dist/chunks/renderChunk.js.map +1 -0
  18. package/dist/chunks/renderChunk.mjs +61 -0
  19. package/dist/chunks/renderChunk.mjs.map +1 -0
  20. package/dist/config.d.ts +279 -0
  21. package/dist/config.js +400 -0
  22. package/dist/config.js.map +1 -0
  23. package/dist/config.mjs +231 -0
  24. package/dist/config.mjs.map +1 -0
  25. package/dist/css-writer.d.mts +45 -0
  26. package/dist/css-writer.mjs +74 -0
  27. package/dist/css-writer.mjs.map +1 -0
  28. package/dist/debug.d.ts +204 -0
  29. package/dist/debug.js +733 -0
  30. package/dist/debug.js.map +1 -0
  31. package/dist/extractor.d.mts +24 -0
  32. package/dist/extractor.mjs +150 -0
  33. package/dist/extractor.mjs.map +1 -0
  34. package/dist/hooks/index.d.ts +5 -0
  35. package/dist/hooks/useGlobalStyles.d.ts +27 -0
  36. package/dist/hooks/useGlobalStyles.js +56 -0
  37. package/dist/hooks/useGlobalStyles.js.map +1 -0
  38. package/dist/hooks/useKeyframes.d.ts +56 -0
  39. package/dist/hooks/useKeyframes.js +54 -0
  40. package/dist/hooks/useKeyframes.js.map +1 -0
  41. package/dist/hooks/useProperty.d.ts +79 -0
  42. package/dist/hooks/useProperty.js +91 -0
  43. package/dist/hooks/useProperty.js.map +1 -0
  44. package/dist/hooks/useRawCSS.d.ts +53 -0
  45. package/dist/hooks/useRawCSS.js +28 -0
  46. package/dist/hooks/useRawCSS.js.map +1 -0
  47. package/dist/hooks/useStyles.d.ts +40 -0
  48. package/dist/hooks/useStyles.js +169 -0
  49. package/dist/hooks/useStyles.js.map +1 -0
  50. package/dist/index.d.ts +38 -0
  51. package/dist/index.js +30 -0
  52. package/dist/injector/index.d.ts +157 -0
  53. package/dist/injector/index.js +154 -0
  54. package/dist/injector/index.js.map +1 -0
  55. package/dist/injector/injector.d.ts +139 -0
  56. package/dist/injector/injector.js +404 -0
  57. package/dist/injector/injector.js.map +1 -0
  58. package/dist/injector/injector.mjs +404 -0
  59. package/dist/injector/injector.mjs.map +1 -0
  60. package/dist/injector/sheet-manager.d.ts +127 -0
  61. package/dist/injector/sheet-manager.js +714 -0
  62. package/dist/injector/sheet-manager.js.map +1 -0
  63. package/dist/injector/sheet-manager.mjs +714 -0
  64. package/dist/injector/sheet-manager.mjs.map +1 -0
  65. package/dist/injector/types.d.mts +18 -0
  66. package/dist/injector/types.d.ts +135 -0
  67. package/dist/keyframes/index.js +206 -0
  68. package/dist/keyframes/index.js.map +1 -0
  69. package/dist/keyframes/index.mjs +156 -0
  70. package/dist/keyframes/index.mjs.map +1 -0
  71. package/dist/parser/classify.js +319 -0
  72. package/dist/parser/classify.js.map +1 -0
  73. package/dist/parser/classify.mjs +319 -0
  74. package/dist/parser/classify.mjs.map +1 -0
  75. package/dist/parser/const.js +33 -0
  76. package/dist/parser/const.js.map +1 -0
  77. package/dist/parser/const.mjs +33 -0
  78. package/dist/parser/const.mjs.map +1 -0
  79. package/dist/parser/lru.js +109 -0
  80. package/dist/parser/lru.js.map +1 -0
  81. package/dist/parser/lru.mjs +109 -0
  82. package/dist/parser/lru.mjs.map +1 -0
  83. package/dist/parser/parser.d.ts +25 -0
  84. package/dist/parser/parser.js +116 -0
  85. package/dist/parser/parser.js.map +1 -0
  86. package/dist/parser/parser.mjs +116 -0
  87. package/dist/parser/parser.mjs.map +1 -0
  88. package/dist/parser/tokenizer.js +69 -0
  89. package/dist/parser/tokenizer.js.map +1 -0
  90. package/dist/parser/tokenizer.mjs +69 -0
  91. package/dist/parser/tokenizer.mjs.map +1 -0
  92. package/dist/parser/types.d.mts +37 -0
  93. package/dist/parser/types.d.ts +46 -0
  94. package/dist/parser/types.js +46 -0
  95. package/dist/parser/types.js.map +1 -0
  96. package/dist/parser/types.mjs +46 -0
  97. package/dist/parser/types.mjs.map +1 -0
  98. package/dist/pipeline/conditions.js +377 -0
  99. package/dist/pipeline/conditions.js.map +1 -0
  100. package/dist/pipeline/conditions.mjs +377 -0
  101. package/dist/pipeline/conditions.mjs.map +1 -0
  102. package/dist/pipeline/exclusive.d.ts +1 -0
  103. package/dist/pipeline/exclusive.js +231 -0
  104. package/dist/pipeline/exclusive.js.map +1 -0
  105. package/dist/pipeline/exclusive.mjs +231 -0
  106. package/dist/pipeline/exclusive.mjs.map +1 -0
  107. package/dist/pipeline/index.d.ts +53 -0
  108. package/dist/pipeline/index.js +641 -0
  109. package/dist/pipeline/index.js.map +1 -0
  110. package/dist/pipeline/index.mjs +635 -0
  111. package/dist/pipeline/index.mjs.map +1 -0
  112. package/dist/pipeline/materialize.js +821 -0
  113. package/dist/pipeline/materialize.js.map +1 -0
  114. package/dist/pipeline/materialize.mjs +821 -0
  115. package/dist/pipeline/materialize.mjs.map +1 -0
  116. package/dist/pipeline/parseStateKey.d.ts +1 -0
  117. package/dist/pipeline/parseStateKey.js +418 -0
  118. package/dist/pipeline/parseStateKey.js.map +1 -0
  119. package/dist/pipeline/parseStateKey.mjs +418 -0
  120. package/dist/pipeline/parseStateKey.mjs.map +1 -0
  121. package/dist/pipeline/simplify.js +557 -0
  122. package/dist/pipeline/simplify.js.map +1 -0
  123. package/dist/pipeline/simplify.mjs +557 -0
  124. package/dist/pipeline/simplify.mjs.map +1 -0
  125. package/dist/plugins/index.d.ts +2 -0
  126. package/dist/plugins/okhsl-plugin.d.ts +35 -0
  127. package/dist/plugins/okhsl-plugin.js +371 -0
  128. package/dist/plugins/okhsl-plugin.js.map +1 -0
  129. package/dist/plugins/okhsl-plugin.mjs +345 -0
  130. package/dist/plugins/okhsl-plugin.mjs.map +1 -0
  131. package/dist/plugins/types.d.mts +49 -0
  132. package/dist/plugins/types.d.ts +69 -0
  133. package/dist/properties/index.js +158 -0
  134. package/dist/properties/index.js.map +1 -0
  135. package/dist/properties/index.mjs +141 -0
  136. package/dist/properties/index.mjs.map +1 -0
  137. package/dist/states/index.d.ts +45 -0
  138. package/dist/states/index.js +389 -0
  139. package/dist/states/index.js.map +1 -0
  140. package/dist/states/index.mjs +161 -0
  141. package/dist/states/index.mjs.map +1 -0
  142. package/dist/static/index.d.ts +5 -0
  143. package/dist/static/index.js +5 -0
  144. package/dist/static/tastyStatic.d.ts +46 -0
  145. package/dist/static/tastyStatic.js +31 -0
  146. package/dist/static/tastyStatic.js.map +1 -0
  147. package/dist/static/types.d.ts +49 -0
  148. package/dist/static/types.js +24 -0
  149. package/dist/static/types.js.map +1 -0
  150. package/dist/styles/align.d.ts +15 -0
  151. package/dist/styles/align.js +14 -0
  152. package/dist/styles/align.js.map +1 -0
  153. package/dist/styles/align.mjs +14 -0
  154. package/dist/styles/align.mjs.map +1 -0
  155. package/dist/styles/border.d.ts +25 -0
  156. package/dist/styles/border.js +114 -0
  157. package/dist/styles/border.js.map +1 -0
  158. package/dist/styles/border.mjs +114 -0
  159. package/dist/styles/border.mjs.map +1 -0
  160. package/dist/styles/color.d.ts +14 -0
  161. package/dist/styles/color.js +23 -0
  162. package/dist/styles/color.js.map +1 -0
  163. package/dist/styles/color.mjs +23 -0
  164. package/dist/styles/color.mjs.map +1 -0
  165. package/dist/styles/createStyle.js +77 -0
  166. package/dist/styles/createStyle.js.map +1 -0
  167. package/dist/styles/createStyle.mjs +77 -0
  168. package/dist/styles/createStyle.mjs.map +1 -0
  169. package/dist/styles/dimension.js +97 -0
  170. package/dist/styles/dimension.js.map +1 -0
  171. package/dist/styles/dimension.mjs +97 -0
  172. package/dist/styles/dimension.mjs.map +1 -0
  173. package/dist/styles/display.d.ts +37 -0
  174. package/dist/styles/display.js +67 -0
  175. package/dist/styles/display.js.map +1 -0
  176. package/dist/styles/display.mjs +67 -0
  177. package/dist/styles/display.mjs.map +1 -0
  178. package/dist/styles/fade.d.ts +15 -0
  179. package/dist/styles/fade.js +58 -0
  180. package/dist/styles/fade.js.map +1 -0
  181. package/dist/styles/fade.mjs +58 -0
  182. package/dist/styles/fade.mjs.map +1 -0
  183. package/dist/styles/fill.d.ts +44 -0
  184. package/dist/styles/fill.js +51 -0
  185. package/dist/styles/fill.js.map +1 -0
  186. package/dist/styles/fill.mjs +51 -0
  187. package/dist/styles/fill.mjs.map +1 -0
  188. package/dist/styles/flow.d.ts +16 -0
  189. package/dist/styles/flow.js +12 -0
  190. package/dist/styles/flow.js.map +1 -0
  191. package/dist/styles/flow.mjs +12 -0
  192. package/dist/styles/flow.mjs.map +1 -0
  193. package/dist/styles/gap.d.ts +31 -0
  194. package/dist/styles/gap.js +37 -0
  195. package/dist/styles/gap.js.map +1 -0
  196. package/dist/styles/gap.mjs +37 -0
  197. package/dist/styles/gap.mjs.map +1 -0
  198. package/dist/styles/height.d.ts +17 -0
  199. package/dist/styles/height.js +20 -0
  200. package/dist/styles/height.js.map +1 -0
  201. package/dist/styles/height.mjs +20 -0
  202. package/dist/styles/height.mjs.map +1 -0
  203. package/dist/styles/index.d.ts +2 -0
  204. package/dist/styles/index.js +9 -0
  205. package/dist/styles/index.js.map +1 -0
  206. package/dist/styles/index.mjs +9 -0
  207. package/dist/styles/index.mjs.map +1 -0
  208. package/dist/styles/inset.d.ts +50 -0
  209. package/dist/styles/inset.js +142 -0
  210. package/dist/styles/inset.js.map +1 -0
  211. package/dist/styles/inset.mjs +142 -0
  212. package/dist/styles/inset.mjs.map +1 -0
  213. package/dist/styles/justify.d.ts +15 -0
  214. package/dist/styles/justify.js +14 -0
  215. package/dist/styles/justify.js.map +1 -0
  216. package/dist/styles/justify.mjs +14 -0
  217. package/dist/styles/justify.mjs.map +1 -0
  218. package/dist/styles/list.d.ts +16 -0
  219. package/dist/styles/list.js +98 -0
  220. package/dist/styles/list.js.map +1 -0
  221. package/dist/styles/margin.d.ts +28 -0
  222. package/dist/styles/margin.js +96 -0
  223. package/dist/styles/margin.js.map +1 -0
  224. package/dist/styles/margin.mjs +96 -0
  225. package/dist/styles/margin.mjs.map +1 -0
  226. package/dist/styles/outline.d.ts +29 -0
  227. package/dist/styles/outline.js +65 -0
  228. package/dist/styles/outline.js.map +1 -0
  229. package/dist/styles/outline.mjs +65 -0
  230. package/dist/styles/outline.mjs.map +1 -0
  231. package/dist/styles/padding.d.ts +28 -0
  232. package/dist/styles/padding.js +96 -0
  233. package/dist/styles/padding.js.map +1 -0
  234. package/dist/styles/padding.mjs +96 -0
  235. package/dist/styles/padding.mjs.map +1 -0
  236. package/dist/styles/predefined.d.ts +74 -0
  237. package/dist/styles/predefined.js +241 -0
  238. package/dist/styles/predefined.js.map +1 -0
  239. package/dist/styles/predefined.mjs +232 -0
  240. package/dist/styles/predefined.mjs.map +1 -0
  241. package/dist/styles/preset.d.ts +47 -0
  242. package/dist/styles/preset.js +126 -0
  243. package/dist/styles/preset.js.map +1 -0
  244. package/dist/styles/preset.mjs +126 -0
  245. package/dist/styles/preset.mjs.map +1 -0
  246. package/dist/styles/radius.d.ts +14 -0
  247. package/dist/styles/radius.js +51 -0
  248. package/dist/styles/radius.js.map +1 -0
  249. package/dist/styles/radius.mjs +51 -0
  250. package/dist/styles/radius.mjs.map +1 -0
  251. package/dist/styles/scrollbar.d.ts +21 -0
  252. package/dist/styles/scrollbar.js +105 -0
  253. package/dist/styles/scrollbar.js.map +1 -0
  254. package/dist/styles/scrollbar.mjs +105 -0
  255. package/dist/styles/scrollbar.mjs.map +1 -0
  256. package/dist/styles/shadow.d.ts +14 -0
  257. package/dist/styles/shadow.js +24 -0
  258. package/dist/styles/shadow.js.map +1 -0
  259. package/dist/styles/shadow.mjs +24 -0
  260. package/dist/styles/shadow.mjs.map +1 -0
  261. package/dist/styles/styledScrollbar.d.ts +47 -0
  262. package/dist/styles/styledScrollbar.js +38 -0
  263. package/dist/styles/styledScrollbar.js.map +1 -0
  264. package/dist/styles/styledScrollbar.mjs +38 -0
  265. package/dist/styles/styledScrollbar.mjs.map +1 -0
  266. package/dist/styles/transition.d.ts +14 -0
  267. package/dist/styles/transition.js +138 -0
  268. package/dist/styles/transition.js.map +1 -0
  269. package/dist/styles/transition.mjs +138 -0
  270. package/dist/styles/transition.mjs.map +1 -0
  271. package/dist/styles/types.d.mts +492 -0
  272. package/dist/styles/types.d.ts +496 -0
  273. package/dist/styles/width.d.ts +17 -0
  274. package/dist/styles/width.js +20 -0
  275. package/dist/styles/width.js.map +1 -0
  276. package/dist/styles/width.mjs +20 -0
  277. package/dist/styles/width.mjs.map +1 -0
  278. package/dist/tasty.d.ts +983 -0
  279. package/dist/tasty.js +191 -0
  280. package/dist/tasty.js.map +1 -0
  281. package/dist/tokens/typography.d.ts +19 -0
  282. package/dist/tokens/typography.js +237 -0
  283. package/dist/tokens/typography.js.map +1 -0
  284. package/dist/types.d.ts +182 -0
  285. package/dist/utils/cache-wrapper.js +26 -0
  286. package/dist/utils/cache-wrapper.js.map +1 -0
  287. package/dist/utils/cache-wrapper.mjs +26 -0
  288. package/dist/utils/cache-wrapper.mjs.map +1 -0
  289. package/dist/utils/case-converter.js +8 -0
  290. package/dist/utils/case-converter.js.map +1 -0
  291. package/dist/utils/case-converter.mjs +8 -0
  292. package/dist/utils/case-converter.mjs.map +1 -0
  293. package/dist/utils/colors.d.ts +5 -0
  294. package/dist/utils/colors.js +9 -0
  295. package/dist/utils/colors.js.map +1 -0
  296. package/dist/utils/dotize.d.ts +26 -0
  297. package/dist/utils/dotize.js +122 -0
  298. package/dist/utils/dotize.js.map +1 -0
  299. package/dist/utils/filter-base-props.d.ts +15 -0
  300. package/dist/utils/filter-base-props.js +45 -0
  301. package/dist/utils/filter-base-props.js.map +1 -0
  302. package/dist/utils/get-display-name.d.ts +7 -0
  303. package/dist/utils/get-display-name.js +10 -0
  304. package/dist/utils/get-display-name.js.map +1 -0
  305. package/dist/utils/hsl-to-rgb.js +38 -0
  306. package/dist/utils/hsl-to-rgb.js.map +1 -0
  307. package/dist/utils/hsl-to-rgb.mjs +38 -0
  308. package/dist/utils/hsl-to-rgb.mjs.map +1 -0
  309. package/dist/utils/is-dev-env.js +19 -0
  310. package/dist/utils/is-dev-env.js.map +1 -0
  311. package/dist/utils/is-dev-env.mjs +19 -0
  312. package/dist/utils/is-dev-env.mjs.map +1 -0
  313. package/dist/utils/merge-styles.d.ts +7 -0
  314. package/dist/utils/merge-styles.js +146 -0
  315. package/dist/utils/merge-styles.js.map +1 -0
  316. package/dist/utils/merge-styles.mjs +146 -0
  317. package/dist/utils/merge-styles.mjs.map +1 -0
  318. package/dist/utils/mod-attrs.d.ts +8 -0
  319. package/dist/utils/mod-attrs.js +21 -0
  320. package/dist/utils/mod-attrs.js.map +1 -0
  321. package/dist/utils/okhsl-to-rgb.js +296 -0
  322. package/dist/utils/okhsl-to-rgb.js.map +1 -0
  323. package/dist/utils/okhsl-to-rgb.mjs +296 -0
  324. package/dist/utils/okhsl-to-rgb.mjs.map +1 -0
  325. package/dist/utils/process-tokens.d.ts +31 -0
  326. package/dist/utils/process-tokens.js +171 -0
  327. package/dist/utils/process-tokens.js.map +1 -0
  328. package/dist/utils/process-tokens.mjs +28 -0
  329. package/dist/utils/process-tokens.mjs.map +1 -0
  330. package/dist/utils/resolve-recipes.d.ts +17 -0
  331. package/dist/utils/resolve-recipes.js +143 -0
  332. package/dist/utils/resolve-recipes.js.map +1 -0
  333. package/dist/utils/resolve-recipes.mjs +143 -0
  334. package/dist/utils/resolve-recipes.mjs.map +1 -0
  335. package/dist/utils/string.js +8 -0
  336. package/dist/utils/string.js.map +1 -0
  337. package/dist/utils/string.mjs +8 -0
  338. package/dist/utils/string.mjs.map +1 -0
  339. package/dist/utils/styles.d.mts +18 -0
  340. package/dist/utils/styles.d.ts +183 -0
  341. package/dist/utils/styles.js +585 -0
  342. package/dist/utils/styles.js.map +1 -0
  343. package/dist/utils/styles.mjs +346 -0
  344. package/dist/utils/styles.mjs.map +1 -0
  345. package/dist/utils/typography.d.ts +36 -0
  346. package/dist/utils/typography.js +53 -0
  347. package/dist/utils/typography.js.map +1 -0
  348. package/dist/utils/warnings.d.ts +16 -0
  349. package/dist/utils/warnings.js +16 -0
  350. package/dist/utils/warnings.js.map +1 -0
  351. package/dist/zero/babel.d.mts +108 -0
  352. package/dist/zero/babel.mjs +282 -0
  353. package/dist/zero/babel.mjs.map +1 -0
  354. package/dist/zero/index.d.mts +3 -0
  355. package/dist/zero/index.mjs +4 -0
  356. package/dist/zero/next.d.mts +60 -0
  357. package/dist/zero/next.mjs +78 -0
  358. package/dist/zero/next.mjs.map +1 -0
  359. package/package.json +127 -0
@@ -0,0 +1,377 @@
1
+ //#region src/pipeline/conditions.ts
2
+ /**
3
+ * Create a TRUE condition (matches everything)
4
+ */
5
+ function trueCondition() {
6
+ return { kind: "true" };
7
+ }
8
+ /**
9
+ * Create a FALSE condition (matches nothing)
10
+ */
11
+ function falseCondition() {
12
+ return { kind: "false" };
13
+ }
14
+ /**
15
+ * Create an AND compound condition
16
+ */
17
+ function and(...children) {
18
+ const filtered = [];
19
+ for (const child of children) {
20
+ if (child.kind === "false") return falseCondition();
21
+ if (child.kind === "true") continue;
22
+ if (child.kind === "compound" && child.operator === "AND") filtered.push(...child.children);
23
+ else filtered.push(child);
24
+ }
25
+ if (filtered.length === 0) return trueCondition();
26
+ if (filtered.length === 1) return filtered[0];
27
+ return {
28
+ kind: "compound",
29
+ operator: "AND",
30
+ children: filtered
31
+ };
32
+ }
33
+ /**
34
+ * Create an OR compound condition
35
+ */
36
+ function or(...children) {
37
+ const filtered = [];
38
+ for (const child of children) {
39
+ if (child.kind === "true") return trueCondition();
40
+ if (child.kind === "false") continue;
41
+ if (child.kind === "compound" && child.operator === "OR") filtered.push(...child.children);
42
+ else filtered.push(child);
43
+ }
44
+ if (filtered.length === 0) return falseCondition();
45
+ if (filtered.length === 1) return filtered[0];
46
+ return {
47
+ kind: "compound",
48
+ operator: "OR",
49
+ children: filtered
50
+ };
51
+ }
52
+ /**
53
+ * Negate a condition
54
+ */
55
+ function not(node) {
56
+ if (node.kind === "true") return falseCondition();
57
+ if (node.kind === "false") return trueCondition();
58
+ if (node.kind === "state") return {
59
+ ...node,
60
+ negated: !node.negated,
61
+ uniqueId: node.negated ? node.uniqueId.replace(/^!/, "") : `!${node.uniqueId}`
62
+ };
63
+ if (node.kind === "compound" && node.operator === "AND") return or(...node.children.map((c) => not(c)));
64
+ if (node.kind === "compound" && node.operator === "OR") return and(...node.children.map((c) => not(c)));
65
+ return node;
66
+ }
67
+ /**
68
+ * Check if a condition is a compound condition
69
+ */
70
+ function isCompoundCondition(node) {
71
+ return node.kind === "compound";
72
+ }
73
+ /**
74
+ * Generate a normalized unique ID for a modifier condition
75
+ */
76
+ function modifierUniqueId(attribute, value, operator = "=", negated = false) {
77
+ const base = value ? `mod:${attribute}${operator}${value}` : `mod:${attribute}`;
78
+ return negated ? `!${base}` : base;
79
+ }
80
+ /**
81
+ * Generate a normalized unique ID for a pseudo condition
82
+ */
83
+ function pseudoUniqueId(pseudo, negated = false) {
84
+ const base = `pseudo:${pseudo}`;
85
+ return negated ? `!${base}` : base;
86
+ }
87
+ /**
88
+ * Generate a normalized unique ID for a media condition
89
+ */
90
+ function mediaUniqueId(subtype, props, negated = false) {
91
+ let base;
92
+ if (subtype === "dimension") {
93
+ const parts = [
94
+ "media",
95
+ "dim",
96
+ props.dimension
97
+ ];
98
+ if (props.lowerBound) {
99
+ parts.push(props.lowerBound.inclusive ? ">=" : ">");
100
+ parts.push(props.lowerBound.value);
101
+ }
102
+ if (props.upperBound) {
103
+ parts.push(props.upperBound.inclusive ? "<=" : "<");
104
+ parts.push(props.upperBound.value);
105
+ }
106
+ base = parts.join(":");
107
+ } else if (subtype === "feature") base = props.featureValue ? `media:feat:${props.feature}:${props.featureValue}` : `media:feat:${props.feature}`;
108
+ else base = `media:type:${props.mediaType}`;
109
+ return negated ? `!${base}` : base;
110
+ }
111
+ /**
112
+ * Generate a normalized unique ID for a container condition
113
+ */
114
+ function containerUniqueId(subtype, props, negated = false) {
115
+ let base;
116
+ const name = props.containerName || "_";
117
+ if (subtype === "dimension") {
118
+ const parts = [
119
+ "container",
120
+ "dim",
121
+ name,
122
+ props.dimension
123
+ ];
124
+ if (props.lowerBound) {
125
+ parts.push(props.lowerBound.inclusive ? ">=" : ">");
126
+ parts.push(props.lowerBound.value);
127
+ }
128
+ if (props.upperBound) {
129
+ parts.push(props.upperBound.inclusive ? "<=" : "<");
130
+ parts.push(props.upperBound.value);
131
+ }
132
+ base = parts.join(":");
133
+ } else if (subtype === "raw") base = `container:raw:${name}:${props.rawCondition}`;
134
+ else base = props.propertyValue ? `container:style:${name}:--${props.property}:${props.propertyValue}` : `container:style:${name}:--${props.property}`;
135
+ return negated ? `!${base}` : base;
136
+ }
137
+ /**
138
+ * Generate a normalized unique ID for a root condition
139
+ */
140
+ function rootUniqueId(selector, negated = false) {
141
+ const base = `root:${selector}`;
142
+ return negated ? `!${base}` : base;
143
+ }
144
+ /**
145
+ * Generate a normalized unique ID for an own condition
146
+ */
147
+ function ownUniqueId(innerUniqueId, negated = false) {
148
+ const base = `own:${innerUniqueId}`;
149
+ return negated ? `!${base}` : base;
150
+ }
151
+ /**
152
+ * Generate a normalized unique ID for a starting condition
153
+ */
154
+ function startingUniqueId(negated = false) {
155
+ return negated ? "!starting" : "starting";
156
+ }
157
+ /**
158
+ * Generate a normalized unique ID for a supports condition
159
+ */
160
+ function supportsUniqueId(subtype, condition, negated = false) {
161
+ const base = `supports:${subtype}:${condition}`;
162
+ return negated ? `!${base}` : base;
163
+ }
164
+ /**
165
+ * Create a modifier condition
166
+ */
167
+ function createModifierCondition(attribute, value, operator = "=", negated = false, raw) {
168
+ return {
169
+ kind: "state",
170
+ type: "modifier",
171
+ negated,
172
+ raw: raw || (value ? `${attribute}${operator}${value}` : attribute),
173
+ uniqueId: modifierUniqueId(attribute, value, operator, negated),
174
+ attribute,
175
+ value,
176
+ operator: value ? operator : void 0
177
+ };
178
+ }
179
+ /**
180
+ * Create a pseudo condition
181
+ */
182
+ function createPseudoCondition(pseudo, negated = false, raw) {
183
+ return {
184
+ kind: "state",
185
+ type: "pseudo",
186
+ negated,
187
+ raw: raw || pseudo,
188
+ uniqueId: pseudoUniqueId(pseudo, negated),
189
+ pseudo
190
+ };
191
+ }
192
+ /**
193
+ * Create a media dimension condition
194
+ */
195
+ function createMediaDimensionCondition(dimension, lowerBound, upperBound, negated = false, raw) {
196
+ return {
197
+ kind: "state",
198
+ type: "media",
199
+ subtype: "dimension",
200
+ negated,
201
+ raw: raw || `@media(${dimension})`,
202
+ uniqueId: mediaUniqueId("dimension", {
203
+ dimension,
204
+ lowerBound,
205
+ upperBound
206
+ }, negated),
207
+ dimension,
208
+ lowerBound,
209
+ upperBound
210
+ };
211
+ }
212
+ /**
213
+ * Create a media feature condition
214
+ */
215
+ function createMediaFeatureCondition(feature, featureValue, negated = false, raw) {
216
+ return {
217
+ kind: "state",
218
+ type: "media",
219
+ subtype: "feature",
220
+ negated,
221
+ raw: raw || `@media(${feature}${featureValue ? `: ${featureValue}` : ""})`,
222
+ uniqueId: mediaUniqueId("feature", {
223
+ feature,
224
+ featureValue
225
+ }, negated),
226
+ feature,
227
+ featureValue
228
+ };
229
+ }
230
+ /**
231
+ * Create a media type condition
232
+ */
233
+ function createMediaTypeCondition(mediaType, negated = false, raw) {
234
+ return {
235
+ kind: "state",
236
+ type: "media",
237
+ subtype: "type",
238
+ negated,
239
+ raw: raw || `@media:${mediaType}`,
240
+ uniqueId: mediaUniqueId("type", { mediaType }, negated),
241
+ mediaType
242
+ };
243
+ }
244
+ /**
245
+ * Create a container dimension condition
246
+ */
247
+ function createContainerDimensionCondition(dimension, lowerBound, upperBound, containerName, negated = false, raw) {
248
+ return {
249
+ kind: "state",
250
+ type: "container",
251
+ subtype: "dimension",
252
+ negated,
253
+ raw: raw || `@(${containerName ? containerName + ", " : ""}${dimension})`,
254
+ uniqueId: containerUniqueId("dimension", {
255
+ containerName,
256
+ dimension,
257
+ lowerBound,
258
+ upperBound
259
+ }, negated),
260
+ containerName,
261
+ dimension,
262
+ lowerBound,
263
+ upperBound
264
+ };
265
+ }
266
+ /**
267
+ * Create a container style condition
268
+ */
269
+ function createContainerStyleCondition(property, propertyValue, containerName, negated = false, raw) {
270
+ return {
271
+ kind: "state",
272
+ type: "container",
273
+ subtype: "style",
274
+ negated,
275
+ raw: raw || `@(${containerName ? containerName + ", " : ""}$${property}${propertyValue ? "=" + propertyValue : ""})`,
276
+ uniqueId: containerUniqueId("style", {
277
+ containerName,
278
+ property,
279
+ propertyValue
280
+ }, negated),
281
+ containerName,
282
+ property,
283
+ propertyValue
284
+ };
285
+ }
286
+ /**
287
+ * Create a container raw function condition (e.g., scroll-state(), style(), etc.)
288
+ * The condition string is passed through to CSS verbatim.
289
+ */
290
+ function createContainerRawCondition(rawCondition, containerName, negated = false, raw) {
291
+ return {
292
+ kind: "state",
293
+ type: "container",
294
+ subtype: "raw",
295
+ negated,
296
+ raw: raw || `@(${containerName ? containerName + ", " : ""}${rawCondition})`,
297
+ uniqueId: containerUniqueId("raw", {
298
+ containerName,
299
+ rawCondition
300
+ }, negated),
301
+ containerName,
302
+ rawCondition
303
+ };
304
+ }
305
+ /**
306
+ * Create a root condition
307
+ */
308
+ function createRootCondition(selector, negated = false, raw) {
309
+ return {
310
+ kind: "state",
311
+ type: "root",
312
+ negated,
313
+ raw: raw || `@root(${selector})`,
314
+ uniqueId: rootUniqueId(selector, negated),
315
+ selector
316
+ };
317
+ }
318
+ /**
319
+ * Create an own condition
320
+ */
321
+ function createOwnCondition(innerCondition, negated = false, raw) {
322
+ const innerUniqueId = getConditionUniqueId(innerCondition);
323
+ return {
324
+ kind: "state",
325
+ type: "own",
326
+ negated,
327
+ raw: raw || `@own(...)`,
328
+ uniqueId: ownUniqueId(innerUniqueId, negated),
329
+ innerCondition
330
+ };
331
+ }
332
+ /**
333
+ * Create a starting condition
334
+ */
335
+ function createStartingCondition(negated = false, raw) {
336
+ return {
337
+ kind: "state",
338
+ type: "starting",
339
+ negated,
340
+ raw: raw || "@starting",
341
+ uniqueId: startingUniqueId(negated)
342
+ };
343
+ }
344
+ /**
345
+ * Create a supports condition
346
+ *
347
+ * @param subtype 'feature' for @supports(display: grid), 'selector' for @supports($, :has(*))
348
+ * @param condition The condition string (e.g., "display: grid" or ":has(*)")
349
+ */
350
+ function createSupportsCondition(subtype, condition, negated = false, raw) {
351
+ return {
352
+ kind: "state",
353
+ type: "supports",
354
+ subtype,
355
+ negated,
356
+ raw: raw || `@supports(${condition})`,
357
+ uniqueId: supportsUniqueId(subtype, condition, negated),
358
+ condition
359
+ };
360
+ }
361
+ /**
362
+ * Get the unique ID for any condition node
363
+ */
364
+ function getConditionUniqueId(node) {
365
+ if (node.kind === "true") return "TRUE";
366
+ if (node.kind === "false") return "FALSE";
367
+ if (node.kind === "state") return node.uniqueId;
368
+ if (node.kind === "compound") {
369
+ const childIds = node.children.map(getConditionUniqueId).sort();
370
+ return `${node.operator}(${childIds.join(",")})`;
371
+ }
372
+ return "UNKNOWN";
373
+ }
374
+
375
+ //#endregion
376
+ export { and, createContainerDimensionCondition, createContainerRawCondition, createContainerStyleCondition, createMediaDimensionCondition, createMediaFeatureCondition, createMediaTypeCondition, createModifierCondition, createOwnCondition, createPseudoCondition, createRootCondition, createStartingCondition, createSupportsCondition, falseCondition, getConditionUniqueId, isCompoundCondition, not, or, trueCondition };
377
+ //# sourceMappingURL=conditions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.mjs","names":[],"sources":["../../src/pipeline/conditions.ts"],"sourcesContent":["/**\n * ConditionNode Types and Helpers\n *\n * Core data structures for representing style conditions as an abstract syntax tree.\n * Used throughout the pipeline for parsing, simplification, and CSS generation.\n */\n\n// ============================================================================\n// Core ConditionNode Types\n// ============================================================================\n\n/**\n * Base interface for all state conditions (leaf nodes)\n */\ninterface BaseStateCondition {\n kind: 'state';\n negated: boolean;\n raw: string; // Original string for debugging/caching\n uniqueId: string; // Normalized ID for comparison (built from props)\n}\n\n/**\n * Modifier condition: [data-attr] or [data-attr=\"value\"]\n */\nexport interface ModifierCondition extends BaseStateCondition {\n type: 'modifier';\n attribute: string; // e.g., 'data-theme', 'data-size'\n value?: string; // e.g., 'danger', 'large' (undefined = boolean attr)\n operator?: '=' | '^=' | '$=' | '*='; // Attribute match operator\n}\n\n/**\n * Pseudo-class condition: :hover, :focus-visible\n */\nexport interface PseudoCondition extends BaseStateCondition {\n type: 'pseudo';\n pseudo: string; // e.g., ':hover', ':focus-visible', ':nth-child(2n)'\n}\n\n/**\n * Numeric bound for dimension queries\n */\nexport interface NumericBound {\n value: string; // e.g., '768px', 'calc(var(--gap) * 40)'\n valueNumeric: number | null; // Parsed numeric value for comparison\n inclusive: boolean; // true for >=/<= , false for >/<\n}\n\n/**\n * Media query condition\n */\nexport interface MediaCondition extends BaseStateCondition {\n type: 'media';\n subtype: 'dimension' | 'feature' | 'type';\n\n // For dimension queries: @media(w < 768px), @media(600px <= w < 1200px)\n dimension?: 'width' | 'height' | 'inline-size' | 'block-size';\n lowerBound?: NumericBound; // >= or >\n upperBound?: NumericBound; // <= or <\n\n // For feature queries: @media(prefers-contrast: high)\n feature?: string; // e.g., 'prefers-contrast', 'prefers-color-scheme'\n featureValue?: string; // e.g., 'high', 'dark' (undefined = boolean feature)\n\n // For type queries: @media:print\n mediaType?: 'print' | 'screen' | 'all' | 'speech';\n}\n\n/**\n * Container query condition\n */\nexport interface ContainerCondition extends BaseStateCondition {\n type: 'container';\n subtype: 'dimension' | 'style' | 'raw';\n containerName?: string; // e.g., 'layout', 'sidebar' (undefined = nearest)\n\n // For dimension queries: @(w < 600px), @(layout, w < 600px)\n dimension?: 'width' | 'height' | 'inline-size' | 'block-size';\n lowerBound?: NumericBound;\n upperBound?: NumericBound;\n\n // For style queries: @(layout, $variant=danger), @($theme)\n property?: string; // CSS custom property name (without --)\n propertyValue?: string; // e.g., 'danger' (undefined = existence check)\n\n // For raw function queries: @(scroll-state(stuck: top)), @(style(display: flex))\n rawCondition?: string; // Verbatim CSS condition string\n}\n\n/**\n * Root state condition: @root(theme=dark)\n */\nexport interface RootCondition extends BaseStateCondition {\n type: 'root';\n selector: string; // e.g., '[data-theme=\"dark\"]'\n}\n\n/**\n * Own state condition: @own(hovered)\n */\nexport interface OwnCondition extends BaseStateCondition {\n type: 'own';\n innerCondition: ConditionNode; // The parsed inner condition\n}\n\n/**\n * Starting style condition: @starting\n */\nexport interface StartingCondition extends BaseStateCondition {\n type: 'starting';\n}\n\n/**\n * Supports query condition: @supports(display: grid), @supports($, :has(*))\n */\nexport interface SupportsCondition extends BaseStateCondition {\n type: 'supports';\n subtype: 'feature' | 'selector';\n // The raw condition string (e.g., \"display: grid\" or \":has(*)\")\n condition: string;\n}\n\n/**\n * Union of all state condition types\n */\nexport type StateCondition =\n | ModifierCondition\n | PseudoCondition\n | MediaCondition\n | ContainerCondition\n | RootCondition\n | OwnCondition\n | StartingCondition\n | SupportsCondition;\n\n/**\n * Compound node: combines conditions with AND/OR\n */\nexport interface CompoundCondition {\n kind: 'compound';\n operator: 'AND' | 'OR';\n children: ConditionNode[];\n}\n\n/**\n * True condition (matches everything)\n */\nexport interface TrueCondition {\n kind: 'true';\n}\n\n/**\n * False condition (matches nothing - skip this rule)\n */\nexport interface FalseCondition {\n kind: 'false';\n}\n\n/**\n * Union of all condition node types\n */\nexport type ConditionNode =\n | StateCondition\n | CompoundCondition\n | TrueCondition\n | FalseCondition;\n\n// ============================================================================\n// Constructor Functions\n// ============================================================================\n\n/**\n * Create a TRUE condition (matches everything)\n */\nexport function trueCondition(): TrueCondition {\n return { kind: 'true' };\n}\n\n/**\n * Create a FALSE condition (matches nothing)\n */\nexport function falseCondition(): FalseCondition {\n return { kind: 'false' };\n}\n\n/**\n * Create an AND compound condition\n */\nexport function and(...children: ConditionNode[]): ConditionNode {\n const filtered: ConditionNode[] = [];\n\n for (const child of children) {\n // Short-circuit on FALSE\n if (child.kind === 'false') {\n return falseCondition();\n }\n // Skip TRUE (identity for AND)\n if (child.kind === 'true') {\n continue;\n }\n // Flatten nested ANDs\n if (child.kind === 'compound' && child.operator === 'AND') {\n filtered.push(...child.children);\n } else {\n filtered.push(child);\n }\n }\n\n if (filtered.length === 0) {\n return trueCondition();\n }\n if (filtered.length === 1) {\n return filtered[0];\n }\n\n return {\n kind: 'compound',\n operator: 'AND',\n children: filtered,\n };\n}\n\n/**\n * Create an OR compound condition\n */\nexport function or(...children: ConditionNode[]): ConditionNode {\n const filtered: ConditionNode[] = [];\n\n for (const child of children) {\n // Short-circuit on TRUE\n if (child.kind === 'true') {\n return trueCondition();\n }\n // Skip FALSE (identity for OR)\n if (child.kind === 'false') {\n continue;\n }\n // Flatten nested ORs\n if (child.kind === 'compound' && child.operator === 'OR') {\n filtered.push(...child.children);\n } else {\n filtered.push(child);\n }\n }\n\n if (filtered.length === 0) {\n return falseCondition();\n }\n if (filtered.length === 1) {\n return filtered[0];\n }\n\n return {\n kind: 'compound',\n operator: 'OR',\n children: filtered,\n };\n}\n\n/**\n * Negate a condition\n */\nexport function not(node: ConditionNode): ConditionNode {\n // NOT(TRUE) = FALSE\n if (node.kind === 'true') {\n return falseCondition();\n }\n\n // NOT(FALSE) = TRUE\n if (node.kind === 'false') {\n return trueCondition();\n }\n\n // NOT(state) = toggle negated flag\n if (node.kind === 'state') {\n return {\n ...node,\n negated: !node.negated,\n uniqueId: node.negated\n ? node.uniqueId.replace(/^!/, '')\n : `!${node.uniqueId}`,\n };\n }\n\n // NOT(AND(a, b, ...)) = OR(NOT(a), NOT(b), ...) - De Morgan's law\n if (node.kind === 'compound' && node.operator === 'AND') {\n return or(...node.children.map((c) => not(c)));\n }\n\n // NOT(OR(a, b, ...)) = AND(NOT(a), NOT(b), ...) - De Morgan's law\n if (node.kind === 'compound' && node.operator === 'OR') {\n return and(...node.children.map((c) => not(c)));\n }\n\n // Fallback - should not reach here\n return node;\n}\n\n// ============================================================================\n// Condition Type Checking\n// ============================================================================\n\n/**\n * Check if a condition is a compound condition\n */\nexport function isCompoundCondition(\n node: ConditionNode,\n): node is CompoundCondition {\n return node.kind === 'compound';\n}\n\n// ============================================================================\n// UniqueId Generation\n// ============================================================================\n\n/**\n * Generate a normalized unique ID for a modifier condition\n */\nexport function modifierUniqueId(\n attribute: string,\n value?: string,\n operator = '=',\n negated = false,\n): string {\n const base = value\n ? `mod:${attribute}${operator}${value}`\n : `mod:${attribute}`;\n return negated ? `!${base}` : base;\n}\n\n/**\n * Generate a normalized unique ID for a pseudo condition\n */\nexport function pseudoUniqueId(\n pseudo: string,\n negated = false,\n): string {\n const base = `pseudo:${pseudo}`;\n return negated ? `!${base}` : base;\n}\n\n/**\n * Generate a normalized unique ID for a media condition\n */\nexport function mediaUniqueId(\n subtype: 'dimension' | 'feature' | 'type',\n props: {\n dimension?: string;\n lowerBound?: NumericBound;\n upperBound?: NumericBound;\n feature?: string;\n featureValue?: string;\n mediaType?: string;\n },\n negated = false,\n): string {\n let base: string;\n\n if (subtype === 'dimension') {\n const parts = ['media', 'dim', props.dimension];\n if (props.lowerBound) {\n parts.push(props.lowerBound.inclusive ? '>=' : '>');\n parts.push(props.lowerBound.value);\n }\n if (props.upperBound) {\n parts.push(props.upperBound.inclusive ? '<=' : '<');\n parts.push(props.upperBound.value);\n }\n base = parts.join(':');\n } else if (subtype === 'feature') {\n base = props.featureValue\n ? `media:feat:${props.feature}:${props.featureValue}`\n : `media:feat:${props.feature}`;\n } else {\n base = `media:type:${props.mediaType}`;\n }\n\n return negated ? `!${base}` : base;\n}\n\n/**\n * Generate a normalized unique ID for a container condition\n */\nexport function containerUniqueId(\n subtype: 'dimension' | 'style' | 'raw',\n props: {\n containerName?: string;\n dimension?: string;\n lowerBound?: NumericBound;\n upperBound?: NumericBound;\n property?: string;\n propertyValue?: string;\n rawCondition?: string;\n },\n negated = false,\n): string {\n let base: string;\n const name = props.containerName || '_';\n\n if (subtype === 'dimension') {\n const parts = ['container', 'dim', name, props.dimension];\n if (props.lowerBound) {\n parts.push(props.lowerBound.inclusive ? '>=' : '>');\n parts.push(props.lowerBound.value);\n }\n if (props.upperBound) {\n parts.push(props.upperBound.inclusive ? '<=' : '<');\n parts.push(props.upperBound.value);\n }\n base = parts.join(':');\n } else if (subtype === 'raw') {\n base = `container:raw:${name}:${props.rawCondition}`;\n } else {\n base = props.propertyValue\n ? `container:style:${name}:--${props.property}:${props.propertyValue}`\n : `container:style:${name}:--${props.property}`;\n }\n\n return negated ? `!${base}` : base;\n}\n\n/**\n * Generate a normalized unique ID for a root condition\n */\nexport function rootUniqueId(\n selector: string,\n negated = false,\n): string {\n const base = `root:${selector}`;\n return negated ? `!${base}` : base;\n}\n\n/**\n * Generate a normalized unique ID for an own condition\n */\nexport function ownUniqueId(\n innerUniqueId: string,\n negated = false,\n): string {\n const base = `own:${innerUniqueId}`;\n return negated ? `!${base}` : base;\n}\n\n/**\n * Generate a normalized unique ID for a starting condition\n */\nexport function startingUniqueId(negated = false): string {\n return negated ? '!starting' : 'starting';\n}\n\n/**\n * Generate a normalized unique ID for a supports condition\n */\nexport function supportsUniqueId(\n subtype: 'feature' | 'selector',\n condition: string,\n negated = false,\n): string {\n const base = `supports:${subtype}:${condition}`;\n return negated ? `!${base}` : base;\n}\n\n// ============================================================================\n// Condition Creation Helpers\n// ============================================================================\n\n/**\n * Create a modifier condition\n */\nexport function createModifierCondition(\n attribute: string,\n value?: string,\n operator: '=' | '^=' | '$=' | '*=' = '=',\n negated = false,\n raw?: string,\n): ModifierCondition {\n return {\n kind: 'state',\n type: 'modifier',\n negated,\n raw: raw || (value ? `${attribute}${operator}${value}` : attribute),\n uniqueId: modifierUniqueId(attribute, value, operator, negated),\n attribute,\n value,\n operator: value ? operator : undefined,\n };\n}\n\n/**\n * Create a pseudo condition\n */\nexport function createPseudoCondition(\n pseudo: string,\n negated = false,\n raw?: string,\n): PseudoCondition {\n return {\n kind: 'state',\n type: 'pseudo',\n negated,\n raw: raw || pseudo,\n uniqueId: pseudoUniqueId(pseudo, negated),\n pseudo,\n };\n}\n\n/**\n * Create a media dimension condition\n */\nexport function createMediaDimensionCondition(\n dimension: 'width' | 'height' | 'inline-size' | 'block-size',\n lowerBound?: NumericBound,\n upperBound?: NumericBound,\n negated = false,\n raw?: string,\n): MediaCondition {\n return {\n kind: 'state',\n type: 'media',\n subtype: 'dimension',\n negated,\n raw: raw || `@media(${dimension})`,\n uniqueId: mediaUniqueId(\n 'dimension',\n { dimension, lowerBound, upperBound },\n negated,\n ),\n dimension,\n lowerBound,\n upperBound,\n };\n}\n\n/**\n * Create a media feature condition\n */\nexport function createMediaFeatureCondition(\n feature: string,\n featureValue?: string,\n negated = false,\n raw?: string,\n): MediaCondition {\n return {\n kind: 'state',\n type: 'media',\n subtype: 'feature',\n negated,\n raw: raw || `@media(${feature}${featureValue ? `: ${featureValue}` : ''})`,\n uniqueId: mediaUniqueId('feature', { feature, featureValue }, negated),\n feature,\n featureValue,\n };\n}\n\n/**\n * Create a media type condition\n */\nexport function createMediaTypeCondition(\n mediaType: 'print' | 'screen' | 'all' | 'speech',\n negated = false,\n raw?: string,\n): MediaCondition {\n return {\n kind: 'state',\n type: 'media',\n subtype: 'type',\n negated,\n raw: raw || `@media:${mediaType}`,\n uniqueId: mediaUniqueId('type', { mediaType }, negated),\n mediaType,\n };\n}\n\n/**\n * Create a container dimension condition\n */\nexport function createContainerDimensionCondition(\n dimension: 'width' | 'height' | 'inline-size' | 'block-size',\n lowerBound?: NumericBound,\n upperBound?: NumericBound,\n containerName?: string,\n negated = false,\n raw?: string,\n): ContainerCondition {\n return {\n kind: 'state',\n type: 'container',\n subtype: 'dimension',\n negated,\n raw: raw || `@(${containerName ? containerName + ', ' : ''}${dimension})`,\n uniqueId: containerUniqueId(\n 'dimension',\n { containerName, dimension, lowerBound, upperBound },\n negated,\n ),\n containerName,\n dimension,\n lowerBound,\n upperBound,\n };\n}\n\n/**\n * Create a container style condition\n */\nexport function createContainerStyleCondition(\n property: string,\n propertyValue?: string,\n containerName?: string,\n negated = false,\n raw?: string,\n): ContainerCondition {\n return {\n kind: 'state',\n type: 'container',\n subtype: 'style',\n negated,\n raw:\n raw ||\n `@(${containerName ? containerName + ', ' : ''}$${property}${propertyValue ? '=' + propertyValue : ''})`,\n uniqueId: containerUniqueId(\n 'style',\n { containerName, property, propertyValue },\n negated,\n ),\n containerName,\n property,\n propertyValue,\n };\n}\n\n/**\n * Create a container raw function condition (e.g., scroll-state(), style(), etc.)\n * The condition string is passed through to CSS verbatim.\n */\nexport function createContainerRawCondition(\n rawCondition: string,\n containerName?: string,\n negated = false,\n raw?: string,\n): ContainerCondition {\n return {\n kind: 'state',\n type: 'container',\n subtype: 'raw',\n negated,\n raw:\n raw || `@(${containerName ? containerName + ', ' : ''}${rawCondition})`,\n uniqueId: containerUniqueId(\n 'raw',\n { containerName, rawCondition },\n negated,\n ),\n containerName,\n rawCondition,\n };\n}\n\n/**\n * Create a root condition\n */\nexport function createRootCondition(\n selector: string,\n negated = false,\n raw?: string,\n): RootCondition {\n return {\n kind: 'state',\n type: 'root',\n negated,\n raw: raw || `@root(${selector})`,\n uniqueId: rootUniqueId(selector, negated),\n selector,\n };\n}\n\n/**\n * Create an own condition\n */\nexport function createOwnCondition(\n innerCondition: ConditionNode,\n negated = false,\n raw?: string,\n): OwnCondition {\n const innerUniqueId = getConditionUniqueId(innerCondition);\n return {\n kind: 'state',\n type: 'own',\n negated,\n raw: raw || `@own(...)`,\n uniqueId: ownUniqueId(innerUniqueId, negated),\n innerCondition,\n };\n}\n\n/**\n * Create a starting condition\n */\nexport function createStartingCondition(\n negated = false,\n raw?: string,\n): StartingCondition {\n return {\n kind: 'state',\n type: 'starting',\n negated,\n raw: raw || '@starting',\n uniqueId: startingUniqueId(negated),\n };\n}\n\n/**\n * Create a supports condition\n *\n * @param subtype 'feature' for @supports(display: grid), 'selector' for @supports($, :has(*))\n * @param condition The condition string (e.g., \"display: grid\" or \":has(*)\")\n */\nexport function createSupportsCondition(\n subtype: 'feature' | 'selector',\n condition: string,\n negated = false,\n raw?: string,\n): SupportsCondition {\n return {\n kind: 'state',\n type: 'supports',\n subtype,\n negated,\n raw: raw || `@supports(${condition})`,\n uniqueId: supportsUniqueId(subtype, condition, negated),\n condition,\n };\n}\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\n/**\n * Get the unique ID for any condition node\n */\nexport function getConditionUniqueId(node: ConditionNode): string {\n if (node.kind === 'true') {\n return 'TRUE';\n }\n if (node.kind === 'false') {\n return 'FALSE';\n }\n if (node.kind === 'state') {\n return node.uniqueId;\n }\n if (node.kind === 'compound') {\n const childIds = node.children.map(getConditionUniqueId).sort();\n return `${node.operator}(${childIds.join(',')})`;\n }\n return 'UNKNOWN';\n}\n"],"mappings":";;;;AA8KA,SAAgB,gBAA+B;AAC7C,QAAO,EAAE,MAAM,QAAQ;;;;;AAMzB,SAAgB,iBAAiC;AAC/C,QAAO,EAAE,MAAM,SAAS;;;;;AAM1B,SAAgB,IAAI,GAAG,UAA0C;CAC/D,MAAM,WAA4B,EAAE;AAEpC,MAAK,MAAM,SAAS,UAAU;AAE5B,MAAI,MAAM,SAAS,QACjB,QAAO,gBAAgB;AAGzB,MAAI,MAAM,SAAS,OACjB;AAGF,MAAI,MAAM,SAAS,cAAc,MAAM,aAAa,MAClD,UAAS,KAAK,GAAG,MAAM,SAAS;MAEhC,UAAS,KAAK,MAAM;;AAIxB,KAAI,SAAS,WAAW,EACtB,QAAO,eAAe;AAExB,KAAI,SAAS,WAAW,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N,MAAM;EACN;EACA,KAAK,OAAO;EACZ,UAAU,iBAAiB,QAAQ;EACpC;;;;;;;;AASH,SAAgB,wBACd,SACA,WACA,UAAU,OACV,KACmB;AACnB,QAAO;EACL,MAAM;EACN,MAAM;EACN;EACA;EACA,KAAK,OAAO,aAAa,UAAU;EACnC,UAAU,iBAAiB,SAAS,WAAW,QAAQ;EACvD;EACD;;;;;AAUH,SAAgB,qBAAqB,MAA6B;AAChE,KAAI,KAAK,SAAS,OAChB,QAAO;AAET,KAAI,KAAK,SAAS,QAChB,QAAO;AAET,KAAI,KAAK,SAAS,QAChB,QAAO,KAAK;AAEd,KAAI,KAAK,SAAS,YAAY;EAC5B,MAAM,WAAW,KAAK,SAAS,IAAI,qBAAqB,CAAC,MAAM;AAC/D,SAAO,GAAG,KAAK,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC;;AAEhD,QAAO"}
@@ -0,0 +1 @@
1
+ import "../utils/styles.js";
@@ -0,0 +1,231 @@
1
+ import { and, isCompoundCondition, not, trueCondition } from "./conditions.js";
2
+ import { simplifyCondition } from "./simplify.js";
3
+
4
+ //#region src/pipeline/exclusive.ts
5
+ /**
6
+ * Build exclusive conditions for a list of parsed style entries.
7
+ *
8
+ * The entries should be ordered by priority (highest priority first).
9
+ *
10
+ * For each entry, we compute:
11
+ * exclusiveCondition = condition & !prior[0] & !prior[1] & ...
12
+ *
13
+ * This ensures exactly one condition matches at any time.
14
+ *
15
+ * Example:
16
+ * Input (ordered highest to lowest priority):
17
+ * A: value1 (priority 2)
18
+ * B: value2 (priority 1)
19
+ * C: value3 (priority 0)
20
+ *
21
+ * Output:
22
+ * A: A
23
+ * B: B & !A
24
+ * C: C & !A & !B
25
+ *
26
+ * @param entries Parsed style entries ordered by priority (highest first)
27
+ * @returns Entries with exclusive conditions, filtered to remove impossible ones
28
+ */
29
+ function buildExclusiveConditions(entries) {
30
+ const result = [];
31
+ const priorConditions = [];
32
+ for (const entry of entries) {
33
+ let exclusive = entry.condition;
34
+ for (const prior of priorConditions) if (prior.kind !== "true") exclusive = and(exclusive, not(prior));
35
+ const simplified = simplifyCondition(exclusive);
36
+ if (simplified.kind === "false") continue;
37
+ result.push({
38
+ ...entry,
39
+ exclusiveCondition: simplified
40
+ });
41
+ if (entry.condition.kind !== "true") priorConditions.push(entry.condition);
42
+ }
43
+ return result;
44
+ }
45
+ /**
46
+ * Parse style entries from a value mapping object.
47
+ *
48
+ * @param styleKey The style key (e.g., 'padding')
49
+ * @param valueMap The value mapping { '': '2x', 'compact': '1x', '@media(w < 768px)': '0.5x' }
50
+ * @param parseCondition Function to parse state keys into conditions
51
+ * @returns Parsed entries ordered by priority (highest first)
52
+ */
53
+ function parseStyleEntries(styleKey, valueMap, parseCondition) {
54
+ const entries = [];
55
+ Object.keys(valueMap).forEach((stateKey, index) => {
56
+ const value = valueMap[stateKey];
57
+ const condition = stateKey === "" ? trueCondition() : parseCondition(stateKey);
58
+ entries.push({
59
+ styleKey,
60
+ stateKey,
61
+ value,
62
+ condition,
63
+ priority: index
64
+ });
65
+ });
66
+ entries.reverse();
67
+ return entries;
68
+ }
69
+ /**
70
+ * Check if a value is a style value mapping (object with state keys)
71
+ */
72
+ function isValueMapping(value) {
73
+ return value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date);
74
+ }
75
+ /**
76
+ * Expand OR conditions in parsed entries into multiple exclusive entries.
77
+ *
78
+ * For an entry with condition `A | B | C`, this creates 3 entries:
79
+ * - condition: A
80
+ * - condition: B & !A
81
+ * - condition: C & !A & !B
82
+ *
83
+ * This ensures OR branches are mutually exclusive BEFORE the main
84
+ * exclusive condition building pass.
85
+ *
86
+ * @param entries Parsed entries (may contain OR conditions)
87
+ * @returns Expanded entries with OR branches made exclusive
88
+ */
89
+ function expandOrConditions(entries) {
90
+ const result = [];
91
+ for (const entry of entries) {
92
+ const expanded = expandSingleEntry(entry);
93
+ result.push(...expanded);
94
+ }
95
+ return result;
96
+ }
97
+ /**
98
+ * Expand a single entry's OR condition into multiple exclusive entries
99
+ */
100
+ function expandSingleEntry(entry) {
101
+ const orBranches = collectOrBranches(entry.condition);
102
+ if (orBranches.length <= 1) return [entry];
103
+ const result = [];
104
+ const priorBranches = [];
105
+ for (let i = 0; i < orBranches.length; i++) {
106
+ const branch = orBranches[i];
107
+ let exclusiveBranch = branch;
108
+ for (const prior of priorBranches) exclusiveBranch = and(exclusiveBranch, not(prior));
109
+ const simplified = simplifyCondition(exclusiveBranch);
110
+ if (simplified.kind === "false") {
111
+ priorBranches.push(branch);
112
+ continue;
113
+ }
114
+ result.push({
115
+ ...entry,
116
+ stateKey: `${entry.stateKey}[${i}]`,
117
+ condition: simplified
118
+ });
119
+ priorBranches.push(branch);
120
+ }
121
+ return result;
122
+ }
123
+ /**
124
+ * Collect top-level OR branches from a condition.
125
+ *
126
+ * For `A | B | C`, returns [A, B, C]
127
+ * For `A & B`, returns [A & B] (single branch)
128
+ * For `A | (B & C)`, returns [A, B & C]
129
+ */
130
+ function collectOrBranches(condition) {
131
+ if (condition.kind === "true" || condition.kind === "false") return [condition];
132
+ if (isCompoundCondition(condition) && condition.operator === "OR") {
133
+ const branches = [];
134
+ for (const child of condition.children) branches.push(...collectOrBranches(child));
135
+ return branches;
136
+ }
137
+ return [condition];
138
+ }
139
+ /**
140
+ * Expand OR conditions in exclusive entries AFTER buildExclusiveConditions.
141
+ *
142
+ * This handles ORs that arise from De Morgan expansion during negation:
143
+ * !(A & B) = !A | !B
144
+ *
145
+ * These ORs need to be made exclusive to avoid overlapping CSS rules:
146
+ * !A | !B → !A | (A & !B)
147
+ *
148
+ * This is logically equivalent but ensures each branch has proper context.
149
+ *
150
+ * Example:
151
+ * Input: { "": V1, "@supports(...) & :has()": V2 }
152
+ * V2's exclusive = @supports & :has
153
+ * V1's exclusive = !(@supports & :has) = !@supports | !:has
154
+ *
155
+ * Without this fix: V1 gets two rules:
156
+ * - @supports (not ...) → V1 ✓
157
+ * - :not(:has()) → V1 ✗ (missing @supports context!)
158
+ *
159
+ * With this fix: V1 gets two exclusive rules:
160
+ * - @supports (not ...) → V1 ✓
161
+ * - @supports (...) { :not(:has()) } → V1 ✓ (proper context!)
162
+ */
163
+ function expandExclusiveOrs(entries) {
164
+ const result = [];
165
+ for (const entry of entries) {
166
+ const expanded = expandExclusiveConditionOrs(entry);
167
+ result.push(...expanded);
168
+ }
169
+ return result;
170
+ }
171
+ /**
172
+ * Check if a condition involves at-rules (media, container, supports, starting)
173
+ */
174
+ function hasAtRuleContext(node) {
175
+ if (node.kind === "true" || node.kind === "false") return false;
176
+ if (node.kind === "state") return node.type === "media" || node.type === "container" || node.type === "supports" || node.type === "starting";
177
+ if (node.kind === "compound") return node.children.some(hasAtRuleContext);
178
+ return false;
179
+ }
180
+ /**
181
+ * Sort OR branches to prioritize at-rule conditions first.
182
+ *
183
+ * This is critical for correct CSS generation. For `!A | !B` where A is at-rule
184
+ * and B is modifier, we want:
185
+ * - Branch 0: !A (at-rule negation - covers "no @supports/media" case)
186
+ * - Branch 1: A & !B (modifier negation with at-rule context)
187
+ *
188
+ * If we process in wrong order (!B first), we'd get:
189
+ * - Branch 0: !B (modifier negation WITHOUT at-rule context - WRONG!)
190
+ * - Branch 1: B & !A (at-rule negation with modifier - incomplete coverage)
191
+ */
192
+ function sortOrBranchesForExpansion(branches) {
193
+ return [...branches].sort((a, b) => {
194
+ const aHasAtRule = hasAtRuleContext(a);
195
+ const bHasAtRule = hasAtRuleContext(b);
196
+ if (aHasAtRule && !bHasAtRule) return -1;
197
+ if (!aHasAtRule && bHasAtRule) return 1;
198
+ return 0;
199
+ });
200
+ }
201
+ /**
202
+ * Expand ORs in a single entry's exclusive condition
203
+ */
204
+ function expandExclusiveConditionOrs(entry) {
205
+ let orBranches = collectOrBranches(entry.exclusiveCondition);
206
+ if (orBranches.length <= 1) return [entry];
207
+ orBranches = sortOrBranchesForExpansion(orBranches);
208
+ const result = [];
209
+ const priorBranches = [];
210
+ for (let i = 0; i < orBranches.length; i++) {
211
+ const branch = orBranches[i];
212
+ let exclusiveBranch = branch;
213
+ for (const prior of priorBranches) exclusiveBranch = and(exclusiveBranch, not(prior));
214
+ const simplified = simplifyCondition(exclusiveBranch);
215
+ if (simplified.kind === "false") {
216
+ priorBranches.push(branch);
217
+ continue;
218
+ }
219
+ result.push({
220
+ ...entry,
221
+ stateKey: `${entry.stateKey}[or:${i}]`,
222
+ exclusiveCondition: simplified
223
+ });
224
+ priorBranches.push(branch);
225
+ }
226
+ return result;
227
+ }
228
+
229
+ //#endregion
230
+ export { buildExclusiveConditions, expandExclusiveOrs, expandOrConditions, isValueMapping, parseStyleEntries };
231
+ //# sourceMappingURL=exclusive.js.map