@tenphi/tasty 0.0.0-snapshot.d2dcdeb → 0.0.0-snapshot.d4ccea8

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 (357) hide show
  1. package/README.md +181 -131
  2. package/dist/{ssr/async-storage.js → async-storage-DKK-wTD4.js} +2 -2
  3. package/dist/async-storage-DKK-wTD4.js.map +1 -0
  4. package/dist/babel-eMs_zZjM.d.ts +83 -0
  5. package/dist/{ssr/collector.js → collector-BjkQEtbh.js} +111 -38
  6. package/dist/collector-BjkQEtbh.js.map +1 -0
  7. package/dist/{ssr/collector.d.ts → collector-DzeNxHOq.d.ts} +58 -7
  8. package/dist/config-DMslHK_e.d.ts +1298 -0
  9. package/dist/config-DX126v_w.js +12318 -0
  10. package/dist/config-DX126v_w.js.map +1 -0
  11. package/dist/{ssr/context.js → context-CA8YKeMn.js} +11 -3
  12. package/dist/context-CA8YKeMn.js.map +1 -0
  13. package/dist/core/index.d.ts +5 -34
  14. package/dist/core/index.js +6 -27
  15. package/dist/core-CMn-Tj2X.js +1573 -0
  16. package/dist/core-CMn-Tj2X.js.map +1 -0
  17. package/dist/{zero/extractor.js → css-writer-C8ShXK5R.js} +148 -24
  18. package/dist/css-writer-C8ShXK5R.js.map +1 -0
  19. package/dist/{ssr/format-global-rules.js → format-global-rules-DklyaXv-.js} +2 -2
  20. package/dist/format-global-rules-DklyaXv-.js.map +1 -0
  21. package/dist/{ssr/format-rules.js → format-rules-BkstDvlN.js} +59 -2
  22. package/dist/format-rules-BkstDvlN.js.map +1 -0
  23. package/dist/{ssr/hydrate.js → hydrate-DXXWZgm0.js} +4 -12
  24. package/dist/hydrate-DXXWZgm0.js.map +1 -0
  25. package/dist/index-BcsaHo8x.d.ts +1568 -0
  26. package/dist/index-CC0wykKn.d.ts +1909 -0
  27. package/dist/index.d.ts +5 -51
  28. package/dist/index.js +922 -36
  29. package/dist/index.js.map +1 -0
  30. package/dist/keyframes-Z0YLVOWq.js +493 -0
  31. package/dist/keyframes-Z0YLVOWq.js.map +1 -0
  32. package/dist/{utils/merge-styles.d.ts → merge-styles-BTFAkYSD.d.ts} +3 -3
  33. package/dist/{utils/merge-styles.js → merge-styles-Dpueyn82.js} +3 -4
  34. package/dist/merge-styles-Dpueyn82.js.map +1 -0
  35. package/dist/{utils/resolve-recipes.js → resolve-recipes-B2Vjr7ET.js} +4 -6
  36. package/dist/resolve-recipes-B2Vjr7ET.js.map +1 -0
  37. package/dist/ssr/astro-client.js +1 -1
  38. package/dist/ssr/astro-client.js.map +1 -1
  39. package/dist/ssr/astro-middleware-static.d.ts +16 -0
  40. package/dist/ssr/astro-middleware-static.js +18 -0
  41. package/dist/ssr/astro-middleware-static.js.map +1 -0
  42. package/dist/ssr/astro-middleware.d.ts +8 -6
  43. package/dist/ssr/astro-middleware.js +10 -10
  44. package/dist/ssr/astro-middleware.js.map +1 -1
  45. package/dist/ssr/astro.d.ts +2 -17
  46. package/dist/ssr/astro.js +29 -21
  47. package/dist/ssr/astro.js.map +1 -1
  48. package/dist/ssr/index.d.ts +37 -4
  49. package/dist/ssr/index.js +5 -5
  50. package/dist/ssr/index.js.map +1 -1
  51. package/dist/ssr/next.d.ts +2 -3
  52. package/dist/ssr/next.js +7 -8
  53. package/dist/ssr/next.js.map +1 -1
  54. package/dist/static/index.d.ts +91 -5
  55. package/dist/static/index.js +49 -3
  56. package/dist/static/index.js.map +1 -0
  57. package/dist/static/inject.js.map +1 -1
  58. package/dist/zero/babel.d.ts +2 -81
  59. package/dist/zero/babel.js +45 -29
  60. package/dist/zero/babel.js.map +1 -1
  61. package/dist/zero/index.d.ts +81 -3
  62. package/dist/zero/index.js +2 -3
  63. package/dist/zero/next.d.ts +1 -1
  64. package/dist/zero/next.js +1 -1
  65. package/dist/zero/next.js.map +1 -1
  66. package/docs/README.md +18 -10
  67. package/docs/adoption.md +56 -31
  68. package/docs/ai-agents.md +224 -0
  69. package/docs/comparison.md +69 -40
  70. package/docs/configuration.md +501 -72
  71. package/docs/debug.md +22 -18
  72. package/docs/design-system.md +43 -24
  73. package/docs/dsl.md +512 -179
  74. package/docs/getting-started.md +60 -39
  75. package/docs/injector.md +110 -32
  76. package/docs/methodology.md +68 -36
  77. package/docs/migration-v3.md +285 -0
  78. package/docs/pipeline.md +741 -0
  79. package/docs/plugins.md +353 -0
  80. package/docs/react-api.md +164 -40
  81. package/docs/runtime-benchmarks.md +216 -0
  82. package/docs/ssr.md +92 -81
  83. package/docs/styles.md +65 -16
  84. package/docs/tasty-static.md +149 -99
  85. package/package.json +49 -21
  86. package/tasty.config.ts +6 -0
  87. package/dist/_virtual/_rolldown/runtime.js +0 -7
  88. package/dist/chunks/cacheKey.d.ts +0 -1
  89. package/dist/chunks/cacheKey.js +0 -77
  90. package/dist/chunks/cacheKey.js.map +0 -1
  91. package/dist/chunks/definitions.d.ts +0 -37
  92. package/dist/chunks/definitions.js +0 -258
  93. package/dist/chunks/definitions.js.map +0 -1
  94. package/dist/chunks/index.d.ts +0 -1
  95. package/dist/chunks/renderChunk.d.ts +0 -1
  96. package/dist/chunks/renderChunk.js +0 -59
  97. package/dist/chunks/renderChunk.js.map +0 -1
  98. package/dist/compute-styles.d.ts +0 -31
  99. package/dist/compute-styles.js +0 -335
  100. package/dist/compute-styles.js.map +0 -1
  101. package/dist/config.d.ts +0 -407
  102. package/dist/config.js +0 -587
  103. package/dist/config.js.map +0 -1
  104. package/dist/counter-style/index.js +0 -51
  105. package/dist/counter-style/index.js.map +0 -1
  106. package/dist/debug.d.ts +0 -89
  107. package/dist/debug.js +0 -453
  108. package/dist/debug.js.map +0 -1
  109. package/dist/font-face/index.js +0 -63
  110. package/dist/font-face/index.js.map +0 -1
  111. package/dist/hooks/index.d.ts +0 -7
  112. package/dist/hooks/useCounterStyle.d.ts +0 -36
  113. package/dist/hooks/useCounterStyle.js +0 -65
  114. package/dist/hooks/useCounterStyle.js.map +0 -1
  115. package/dist/hooks/useFontFace.d.ts +0 -45
  116. package/dist/hooks/useFontFace.js +0 -66
  117. package/dist/hooks/useFontFace.js.map +0 -1
  118. package/dist/hooks/useGlobalStyles.d.ts +0 -46
  119. package/dist/hooks/useGlobalStyles.js +0 -88
  120. package/dist/hooks/useGlobalStyles.js.map +0 -1
  121. package/dist/hooks/useKeyframes.d.ts +0 -58
  122. package/dist/hooks/useKeyframes.js +0 -55
  123. package/dist/hooks/useKeyframes.js.map +0 -1
  124. package/dist/hooks/useProperty.d.ts +0 -81
  125. package/dist/hooks/useProperty.js +0 -96
  126. package/dist/hooks/useProperty.js.map +0 -1
  127. package/dist/hooks/useRawCSS.d.ts +0 -22
  128. package/dist/hooks/useRawCSS.js +0 -103
  129. package/dist/hooks/useRawCSS.js.map +0 -1
  130. package/dist/hooks/useStyles.d.ts +0 -40
  131. package/dist/hooks/useStyles.js +0 -31
  132. package/dist/hooks/useStyles.js.map +0 -1
  133. package/dist/injector/index.d.ts +0 -182
  134. package/dist/injector/index.js +0 -185
  135. package/dist/injector/index.js.map +0 -1
  136. package/dist/injector/injector.d.ts +0 -198
  137. package/dist/injector/injector.js +0 -651
  138. package/dist/injector/injector.js.map +0 -1
  139. package/dist/injector/sheet-manager.d.ts +0 -132
  140. package/dist/injector/sheet-manager.js +0 -699
  141. package/dist/injector/sheet-manager.js.map +0 -1
  142. package/dist/injector/types.d.ts +0 -235
  143. package/dist/keyframes/index.js +0 -206
  144. package/dist/keyframes/index.js.map +0 -1
  145. package/dist/parser/classify.js +0 -319
  146. package/dist/parser/classify.js.map +0 -1
  147. package/dist/parser/const.js +0 -60
  148. package/dist/parser/const.js.map +0 -1
  149. package/dist/parser/lru.js +0 -109
  150. package/dist/parser/lru.js.map +0 -1
  151. package/dist/parser/parser.d.ts +0 -25
  152. package/dist/parser/parser.js +0 -115
  153. package/dist/parser/parser.js.map +0 -1
  154. package/dist/parser/tokenizer.js +0 -69
  155. package/dist/parser/tokenizer.js.map +0 -1
  156. package/dist/parser/types.d.ts +0 -51
  157. package/dist/parser/types.js +0 -46
  158. package/dist/parser/types.js.map +0 -1
  159. package/dist/pipeline/conditions.d.ts +0 -134
  160. package/dist/pipeline/conditions.js +0 -406
  161. package/dist/pipeline/conditions.js.map +0 -1
  162. package/dist/pipeline/exclusive.js +0 -230
  163. package/dist/pipeline/exclusive.js.map +0 -1
  164. package/dist/pipeline/index.d.ts +0 -55
  165. package/dist/pipeline/index.js +0 -708
  166. package/dist/pipeline/index.js.map +0 -1
  167. package/dist/pipeline/materialize.js +0 -1103
  168. package/dist/pipeline/materialize.js.map +0 -1
  169. package/dist/pipeline/parseStateKey.d.ts +0 -15
  170. package/dist/pipeline/parseStateKey.js +0 -446
  171. package/dist/pipeline/parseStateKey.js.map +0 -1
  172. package/dist/pipeline/simplify.js +0 -515
  173. package/dist/pipeline/simplify.js.map +0 -1
  174. package/dist/pipeline/warnings.js +0 -18
  175. package/dist/pipeline/warnings.js.map +0 -1
  176. package/dist/plugins/index.d.ts +0 -2
  177. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  178. package/dist/plugins/okhsl-plugin.js +0 -97
  179. package/dist/plugins/okhsl-plugin.js.map +0 -1
  180. package/dist/plugins/types.d.ts +0 -87
  181. package/dist/properties/index.js +0 -222
  182. package/dist/properties/index.js.map +0 -1
  183. package/dist/properties/property-type-resolver.d.ts +0 -24
  184. package/dist/properties/property-type-resolver.js +0 -90
  185. package/dist/properties/property-type-resolver.js.map +0 -1
  186. package/dist/rsc-cache.js +0 -79
  187. package/dist/rsc-cache.js.map +0 -1
  188. package/dist/ssr/async-storage.d.ts +0 -17
  189. package/dist/ssr/async-storage.js.map +0 -1
  190. package/dist/ssr/collect-auto-properties.js +0 -58
  191. package/dist/ssr/collect-auto-properties.js.map +0 -1
  192. package/dist/ssr/collector.js.map +0 -1
  193. package/dist/ssr/context.js.map +0 -1
  194. package/dist/ssr/format-global-rules.js.map +0 -1
  195. package/dist/ssr/format-keyframes.js +0 -69
  196. package/dist/ssr/format-keyframes.js.map +0 -1
  197. package/dist/ssr/format-property.js +0 -49
  198. package/dist/ssr/format-property.js.map +0 -1
  199. package/dist/ssr/format-rules.js.map +0 -1
  200. package/dist/ssr/hydrate.d.ts +0 -29
  201. package/dist/ssr/hydrate.js.map +0 -1
  202. package/dist/ssr/ssr-collector-ref.js +0 -29
  203. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  204. package/dist/states/index.d.ts +0 -49
  205. package/dist/states/index.js +0 -170
  206. package/dist/states/index.js.map +0 -1
  207. package/dist/static/tastyStatic.d.ts +0 -46
  208. package/dist/static/tastyStatic.js +0 -30
  209. package/dist/static/tastyStatic.js.map +0 -1
  210. package/dist/static/types.d.ts +0 -49
  211. package/dist/static/types.js +0 -24
  212. package/dist/static/types.js.map +0 -1
  213. package/dist/styles/border.d.ts +0 -25
  214. package/dist/styles/border.js +0 -120
  215. package/dist/styles/border.js.map +0 -1
  216. package/dist/styles/color.d.ts +0 -14
  217. package/dist/styles/color.js +0 -26
  218. package/dist/styles/color.js.map +0 -1
  219. package/dist/styles/const.js +0 -17
  220. package/dist/styles/const.js.map +0 -1
  221. package/dist/styles/createStyle.js +0 -79
  222. package/dist/styles/createStyle.js.map +0 -1
  223. package/dist/styles/dimension.js +0 -109
  224. package/dist/styles/dimension.js.map +0 -1
  225. package/dist/styles/directional.js +0 -133
  226. package/dist/styles/directional.js.map +0 -1
  227. package/dist/styles/display.d.ts +0 -30
  228. package/dist/styles/display.js +0 -73
  229. package/dist/styles/display.js.map +0 -1
  230. package/dist/styles/fade.d.ts +0 -15
  231. package/dist/styles/fade.js +0 -62
  232. package/dist/styles/fade.js.map +0 -1
  233. package/dist/styles/fill.d.ts +0 -42
  234. package/dist/styles/fill.js +0 -51
  235. package/dist/styles/fill.js.map +0 -1
  236. package/dist/styles/flow.d.ts +0 -16
  237. package/dist/styles/flow.js +0 -12
  238. package/dist/styles/flow.js.map +0 -1
  239. package/dist/styles/gap.d.ts +0 -31
  240. package/dist/styles/gap.js +0 -38
  241. package/dist/styles/gap.js.map +0 -1
  242. package/dist/styles/height.d.ts +0 -17
  243. package/dist/styles/height.js +0 -19
  244. package/dist/styles/height.js.map +0 -1
  245. package/dist/styles/index.d.ts +0 -1
  246. package/dist/styles/index.js +0 -8
  247. package/dist/styles/index.js.map +0 -1
  248. package/dist/styles/inset.d.ts +0 -24
  249. package/dist/styles/inset.js +0 -34
  250. package/dist/styles/inset.js.map +0 -1
  251. package/dist/styles/list.d.ts +0 -16
  252. package/dist/styles/list.js +0 -100
  253. package/dist/styles/list.js.map +0 -1
  254. package/dist/styles/margin.d.ts +0 -24
  255. package/dist/styles/margin.js +0 -32
  256. package/dist/styles/margin.js.map +0 -1
  257. package/dist/styles/outline.d.ts +0 -29
  258. package/dist/styles/outline.js +0 -55
  259. package/dist/styles/outline.js.map +0 -1
  260. package/dist/styles/padding.d.ts +0 -24
  261. package/dist/styles/padding.js +0 -32
  262. package/dist/styles/padding.js.map +0 -1
  263. package/dist/styles/placement.d.ts +0 -37
  264. package/dist/styles/placement.js +0 -74
  265. package/dist/styles/placement.js.map +0 -1
  266. package/dist/styles/predefined.d.ts +0 -71
  267. package/dist/styles/predefined.js +0 -237
  268. package/dist/styles/predefined.js.map +0 -1
  269. package/dist/styles/preset.d.ts +0 -52
  270. package/dist/styles/preset.js +0 -127
  271. package/dist/styles/preset.js.map +0 -1
  272. package/dist/styles/radius.d.ts +0 -12
  273. package/dist/styles/radius.js +0 -83
  274. package/dist/styles/radius.js.map +0 -1
  275. package/dist/styles/scrollMargin.d.ts +0 -24
  276. package/dist/styles/scrollMargin.js +0 -32
  277. package/dist/styles/scrollMargin.js.map +0 -1
  278. package/dist/styles/scrollbar.d.ts +0 -25
  279. package/dist/styles/scrollbar.js +0 -51
  280. package/dist/styles/scrollbar.js.map +0 -1
  281. package/dist/styles/shadow.d.ts +0 -14
  282. package/dist/styles/shadow.js +0 -25
  283. package/dist/styles/shadow.js.map +0 -1
  284. package/dist/styles/shared.js +0 -17
  285. package/dist/styles/shared.js.map +0 -1
  286. package/dist/styles/transition.d.ts +0 -14
  287. package/dist/styles/transition.js +0 -159
  288. package/dist/styles/transition.js.map +0 -1
  289. package/dist/styles/types.d.ts +0 -564
  290. package/dist/styles/width.d.ts +0 -17
  291. package/dist/styles/width.js +0 -19
  292. package/dist/styles/width.js.map +0 -1
  293. package/dist/tasty.d.ts +0 -134
  294. package/dist/tasty.js +0 -248
  295. package/dist/tasty.js.map +0 -1
  296. package/dist/types.d.ts +0 -184
  297. package/dist/utils/cache-wrapper.js +0 -21
  298. package/dist/utils/cache-wrapper.js.map +0 -1
  299. package/dist/utils/case-converter.js +0 -8
  300. package/dist/utils/case-converter.js.map +0 -1
  301. package/dist/utils/color-math.d.ts +0 -46
  302. package/dist/utils/color-math.js +0 -749
  303. package/dist/utils/color-math.js.map +0 -1
  304. package/dist/utils/color-space.d.ts +0 -5
  305. package/dist/utils/color-space.js +0 -228
  306. package/dist/utils/color-space.js.map +0 -1
  307. package/dist/utils/colors.d.ts +0 -5
  308. package/dist/utils/colors.js +0 -10
  309. package/dist/utils/colors.js.map +0 -1
  310. package/dist/utils/css-types.d.ts +0 -7
  311. package/dist/utils/deps-equal.js +0 -15
  312. package/dist/utils/deps-equal.js.map +0 -1
  313. package/dist/utils/dotize.d.ts +0 -26
  314. package/dist/utils/dotize.js +0 -122
  315. package/dist/utils/dotize.js.map +0 -1
  316. package/dist/utils/filter-base-props.d.ts +0 -15
  317. package/dist/utils/filter-base-props.js +0 -45
  318. package/dist/utils/filter-base-props.js.map +0 -1
  319. package/dist/utils/get-display-name.d.ts +0 -7
  320. package/dist/utils/get-display-name.js +0 -10
  321. package/dist/utils/get-display-name.js.map +0 -1
  322. package/dist/utils/has-keys.js +0 -13
  323. package/dist/utils/has-keys.js.map +0 -1
  324. package/dist/utils/hash.js +0 -14
  325. package/dist/utils/hash.js.map +0 -1
  326. package/dist/utils/is-dev-env.js +0 -19
  327. package/dist/utils/is-dev-env.js.map +0 -1
  328. package/dist/utils/is-valid-element-type.js +0 -15
  329. package/dist/utils/is-valid-element-type.js.map +0 -1
  330. package/dist/utils/merge-styles.js.map +0 -1
  331. package/dist/utils/mod-attrs.d.ts +0 -6
  332. package/dist/utils/mod-attrs.js +0 -20
  333. package/dist/utils/mod-attrs.js.map +0 -1
  334. package/dist/utils/process-tokens.d.ts +0 -17
  335. package/dist/utils/process-tokens.js +0 -83
  336. package/dist/utils/process-tokens.js.map +0 -1
  337. package/dist/utils/resolve-recipes.d.ts +0 -17
  338. package/dist/utils/resolve-recipes.js.map +0 -1
  339. package/dist/utils/selector-transform.js +0 -32
  340. package/dist/utils/selector-transform.js.map +0 -1
  341. package/dist/utils/string.js +0 -8
  342. package/dist/utils/string.js.map +0 -1
  343. package/dist/utils/styles.d.ts +0 -99
  344. package/dist/utils/styles.js +0 -220
  345. package/dist/utils/styles.js.map +0 -1
  346. package/dist/utils/typography.d.ts +0 -58
  347. package/dist/utils/typography.js +0 -51
  348. package/dist/utils/typography.js.map +0 -1
  349. package/dist/utils/warnings.d.ts +0 -16
  350. package/dist/utils/warnings.js +0 -16
  351. package/dist/utils/warnings.js.map +0 -1
  352. package/dist/zero/css-writer.d.ts +0 -45
  353. package/dist/zero/css-writer.js +0 -73
  354. package/dist/zero/css-writer.js.map +0 -1
  355. package/dist/zero/extractor.d.ts +0 -24
  356. package/dist/zero/extractor.js.map +0 -1
  357. package/docs/PIPELINE.md +0 -519
@@ -1,115 +0,0 @@
1
- import { Lru } from "./lru.js";
2
- import { Bucket, finalizeGroup, finalizePart, makeEmptyDetails, makeEmptyPart } from "./types.js";
3
- import { classify } from "./classify.js";
4
- import { scan } from "./tokenizer.js";
5
- //#region src/parser/parser.ts
6
- var StyleParser = class {
7
- cache;
8
- constructor(opts = {}) {
9
- this.opts = opts;
10
- this.cache = new Lru(this.opts.cacheSize ?? 1e3);
11
- }
12
- process(src) {
13
- const key = String(src);
14
- const hit = this.cache.get(key);
15
- if (hit) return hit;
16
- const stripped = src.replace(/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g, "").toLowerCase();
17
- const groups = [];
18
- let currentGroup = makeEmptyDetails();
19
- let currentPart = makeEmptyPart();
20
- let parts = [];
21
- const pushToken = (bucket, processed) => {
22
- if (!processed) return;
23
- const mergeIntoPrevUrl = () => {
24
- const lastIdx = currentPart.values.length - 1;
25
- currentPart.values[lastIdx] += ` ${processed}`;
26
- const lastAllIdx = currentPart.all.length - 1;
27
- currentPart.all[lastAllIdx] += ` ${processed}`;
28
- };
29
- if (currentPart.values.length > 0 && currentPart.values[currentPart.values.length - 1].startsWith("url(")) {
30
- mergeIntoPrevUrl();
31
- return;
32
- }
33
- switch (bucket) {
34
- case Bucket.Color:
35
- currentPart.colors.push(processed);
36
- break;
37
- case Bucket.Value:
38
- currentPart.values.push(processed);
39
- break;
40
- case Bucket.Mod:
41
- currentPart.mods.push(processed);
42
- break;
43
- }
44
- currentPart.all.push(processed);
45
- };
46
- const endPart = () => {
47
- if (currentPart.all.length > 0) {
48
- finalizePart(currentPart);
49
- parts.push(currentPart);
50
- }
51
- currentPart = makeEmptyPart();
52
- };
53
- const endGroup = () => {
54
- endPart();
55
- if (parts.length === 0) {
56
- parts.push(makeEmptyPart());
57
- finalizePart(parts[0]);
58
- }
59
- finalizeGroup(currentGroup, parts);
60
- groups.push(currentGroup);
61
- currentGroup = makeEmptyDetails();
62
- parts = [];
63
- currentPart = makeEmptyPart();
64
- };
65
- scan(stripped, (tok, isComma, isSlash, _prevChar) => {
66
- if (tok) {
67
- if (currentGroup.input) currentGroup.input += ` ${tok}`;
68
- else currentGroup.input = tok;
69
- const { bucket, processed } = classify(tok, this.opts, (sub) => this.process(sub));
70
- pushToken(bucket, processed);
71
- }
72
- if (isSlash) endPart();
73
- if (isComma) endGroup();
74
- });
75
- if (currentPart.all.length || parts.length || !groups.length) endGroup();
76
- const result = {
77
- output: groups.map((g) => g.output).join(", "),
78
- groups
79
- };
80
- Object.freeze(result);
81
- this.cache.set(key, result);
82
- return result;
83
- }
84
- setFuncs(funcs) {
85
- this.opts.funcs = funcs;
86
- this.cache.clear();
87
- }
88
- setUnits(units) {
89
- this.opts.units = units;
90
- this.cache.clear();
91
- }
92
- updateOptions(patch) {
93
- Object.assign(this.opts, patch);
94
- if (patch.cacheSize) this.cache = new Lru(patch.cacheSize);
95
- else this.cache.clear();
96
- }
97
- /**
98
- * Clear the parser cache.
99
- * Call this when external state that affects parsing results has changed
100
- * (e.g., predefined tokens).
101
- */
102
- clearCache() {
103
- this.cache.clear();
104
- }
105
- /**
106
- * Get the current units configuration.
107
- */
108
- getUnits() {
109
- return this.opts.units;
110
- }
111
- };
112
- //#endregion
113
- export { StyleParser };
114
-
115
- //# sourceMappingURL=parser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parser.js","names":[],"sources":["../../src/parser/parser.ts"],"sourcesContent":["import { classify } from './classify';\nimport { Lru } from './lru';\nimport { scan } from './tokenizer';\nimport type {\n ParserOptions,\n ProcessedStyle,\n StyleDetails,\n StyleDetailsPart,\n} from './types';\nimport {\n Bucket,\n finalizeGroup,\n finalizePart,\n makeEmptyDetails,\n makeEmptyPart,\n} from './types';\n\nexport class StyleParser {\n private cache: Lru<string, ProcessedStyle>;\n constructor(private opts: ParserOptions = {}) {\n this.cache = new Lru<string, ProcessedStyle>(this.opts.cacheSize ?? 1000);\n }\n\n /* ---------------- Public API ---------------- */\n process(src: string): ProcessedStyle {\n const key = String(src);\n const hit = this.cache.get(key);\n if (hit) return hit;\n\n // strip comments & lower-case once\n const stripped = src\n .replace(/\\/\\*[^*]*\\*+(?:[^/*][^*]*\\*+)*\\//g, '')\n .toLowerCase();\n\n const groups: StyleDetails[] = [];\n let currentGroup = makeEmptyDetails();\n let currentPart = makeEmptyPart();\n let parts: StyleDetailsPart[] = [];\n\n const pushToken = (bucket: Bucket, processed: string) => {\n if (!processed) return;\n\n // If the previous token was a url(...) value, merge this token into it so that\n // background layer segments like \"url(img) no-repeat center/cover\" are kept\n // as a single value entry.\n const mergeIntoPrevUrl = () => {\n const lastIdx = currentPart.values.length - 1;\n currentPart.values[lastIdx] += ` ${processed}`;\n const lastAllIdx = currentPart.all.length - 1;\n currentPart.all[lastAllIdx] += ` ${processed}`;\n };\n\n const prevIsUrlValue =\n currentPart.values.length > 0 &&\n currentPart.values[currentPart.values.length - 1].startsWith('url(');\n\n if (prevIsUrlValue) {\n // Extend the existing url(...) value regardless of current bucket.\n mergeIntoPrevUrl();\n // Additionally, for non-value buckets we need to remove their own storage.\n // So early return.\n return;\n }\n\n switch (bucket) {\n case Bucket.Color:\n currentPart.colors.push(processed);\n break;\n case Bucket.Value:\n currentPart.values.push(processed);\n break;\n case Bucket.Mod:\n currentPart.mods.push(processed);\n break;\n }\n currentPart.all.push(processed);\n };\n\n const endPart = () => {\n // Only add non-empty parts\n if (currentPart.all.length > 0) {\n finalizePart(currentPart);\n parts.push(currentPart);\n }\n currentPart = makeEmptyPart();\n };\n\n const endGroup = () => {\n endPart(); // finalize last part\n\n // Ensure at least one part exists (even if empty) for backward compat\n if (parts.length === 0) {\n parts.push(makeEmptyPart());\n finalizePart(parts[0]);\n }\n\n finalizeGroup(currentGroup, parts);\n groups.push(currentGroup);\n\n // Reset for next group\n currentGroup = makeEmptyDetails();\n parts = [];\n currentPart = makeEmptyPart();\n };\n\n scan(stripped, (tok, isComma, isSlash, _prevChar) => {\n if (tok) {\n // Accumulate raw token into currentGroup.input\n if (currentGroup.input) {\n currentGroup.input += ` ${tok}`;\n } else {\n currentGroup.input = tok;\n }\n\n const { bucket, processed } = classify(tok, this.opts, (sub) =>\n this.process(sub),\n );\n pushToken(bucket, processed);\n }\n if (isSlash) endPart();\n if (isComma) endGroup();\n });\n\n // push final group if not already\n if (currentPart.all.length || parts.length || !groups.length) endGroup();\n\n const output = groups.map((g) => g.output).join(', ');\n const result: ProcessedStyle = { output, groups };\n Object.freeze(result);\n this.cache.set(key, result);\n return result;\n }\n\n setFuncs(funcs: Required<ParserOptions>['funcs']): void {\n this.opts.funcs = funcs;\n this.cache.clear();\n }\n\n setUnits(units: Required<ParserOptions>['units']): void {\n this.opts.units = units;\n this.cache.clear();\n }\n\n updateOptions(patch: Partial<ParserOptions>): void {\n Object.assign(this.opts, patch);\n if (patch.cacheSize)\n this.cache = new Lru<string, ProcessedStyle>(patch.cacheSize);\n else this.cache.clear();\n }\n\n /**\n * Clear the parser cache.\n * Call this when external state that affects parsing results has changed\n * (e.g., predefined tokens).\n */\n clearCache(): void {\n this.cache.clear();\n }\n\n /**\n * Get the current units configuration.\n */\n getUnits(): ParserOptions['units'] {\n return this.opts.units;\n }\n}\n\n// Re-export\nexport type { StyleDetails, ProcessedStyle } from './types';\n"],"mappings":";;;;;AAiBA,IAAa,cAAb,MAAyB;CACvB;CACA,YAAY,OAA8B,EAAE,EAAE;AAA1B,OAAA,OAAA;AAClB,OAAK,QAAQ,IAAI,IAA4B,KAAK,KAAK,aAAa,IAAK;;CAI3E,QAAQ,KAA6B;EACnC,MAAM,MAAM,OAAO,IAAI;EACvB,MAAM,MAAM,KAAK,MAAM,IAAI,IAAI;AAC/B,MAAI,IAAK,QAAO;EAGhB,MAAM,WAAW,IACd,QAAQ,qCAAqC,GAAG,CAChD,aAAa;EAEhB,MAAM,SAAyB,EAAE;EACjC,IAAI,eAAe,kBAAkB;EACrC,IAAI,cAAc,eAAe;EACjC,IAAI,QAA4B,EAAE;EAElC,MAAM,aAAa,QAAgB,cAAsB;AACvD,OAAI,CAAC,UAAW;GAKhB,MAAM,yBAAyB;IAC7B,MAAM,UAAU,YAAY,OAAO,SAAS;AAC5C,gBAAY,OAAO,YAAY,IAAI;IACnC,MAAM,aAAa,YAAY,IAAI,SAAS;AAC5C,gBAAY,IAAI,eAAe,IAAI;;AAOrC,OAHE,YAAY,OAAO,SAAS,KAC5B,YAAY,OAAO,YAAY,OAAO,SAAS,GAAG,WAAW,OAAO,EAElD;AAElB,sBAAkB;AAGlB;;AAGF,WAAQ,QAAR;IACE,KAAK,OAAO;AACV,iBAAY,OAAO,KAAK,UAAU;AAClC;IACF,KAAK,OAAO;AACV,iBAAY,OAAO,KAAK,UAAU;AAClC;IACF,KAAK,OAAO;AACV,iBAAY,KAAK,KAAK,UAAU;AAChC;;AAEJ,eAAY,IAAI,KAAK,UAAU;;EAGjC,MAAM,gBAAgB;AAEpB,OAAI,YAAY,IAAI,SAAS,GAAG;AAC9B,iBAAa,YAAY;AACzB,UAAM,KAAK,YAAY;;AAEzB,iBAAc,eAAe;;EAG/B,MAAM,iBAAiB;AACrB,YAAS;AAGT,OAAI,MAAM,WAAW,GAAG;AACtB,UAAM,KAAK,eAAe,CAAC;AAC3B,iBAAa,MAAM,GAAG;;AAGxB,iBAAc,cAAc,MAAM;AAClC,UAAO,KAAK,aAAa;AAGzB,kBAAe,kBAAkB;AACjC,WAAQ,EAAE;AACV,iBAAc,eAAe;;AAG/B,OAAK,WAAW,KAAK,SAAS,SAAS,cAAc;AACnD,OAAI,KAAK;AAEP,QAAI,aAAa,MACf,cAAa,SAAS,IAAI;QAE1B,cAAa,QAAQ;IAGvB,MAAM,EAAE,QAAQ,cAAc,SAAS,KAAK,KAAK,OAAO,QACtD,KAAK,QAAQ,IAAI,CAClB;AACD,cAAU,QAAQ,UAAU;;AAE9B,OAAI,QAAS,UAAS;AACtB,OAAI,QAAS,WAAU;IACvB;AAGF,MAAI,YAAY,IAAI,UAAU,MAAM,UAAU,CAAC,OAAO,OAAQ,WAAU;EAGxE,MAAM,SAAyB;GAAE,QADlB,OAAO,KAAK,MAAM,EAAE,OAAO,CAAC,KAAK,KAAK;GACZ;GAAQ;AACjD,SAAO,OAAO,OAAO;AACrB,OAAK,MAAM,IAAI,KAAK,OAAO;AAC3B,SAAO;;CAGT,SAAS,OAA+C;AACtD,OAAK,KAAK,QAAQ;AAClB,OAAK,MAAM,OAAO;;CAGpB,SAAS,OAA+C;AACtD,OAAK,KAAK,QAAQ;AAClB,OAAK,MAAM,OAAO;;CAGpB,cAAc,OAAqC;AACjD,SAAO,OAAO,KAAK,MAAM,MAAM;AAC/B,MAAI,MAAM,UACR,MAAK,QAAQ,IAAI,IAA4B,MAAM,UAAU;MAC1D,MAAK,MAAM,OAAO;;;;;;;CAQzB,aAAmB;AACjB,OAAK,MAAM,OAAO;;;;;CAMpB,WAAmC;AACjC,SAAO,KAAK,KAAK"}
@@ -1,69 +0,0 @@
1
- //#region src/parser/tokenizer.ts
2
- const isWhitespace = (ch) => ch === " " || ch === "\n" || ch === " " || ch === "\r" || ch === "\f";
3
- function scan(src, cb) {
4
- let depth = 0;
5
- let inUrl = false;
6
- let inQuote = 0;
7
- let start = 0;
8
- let i = 0;
9
- let pendingSlash = false;
10
- const flush = (isComma, isSlash) => {
11
- const actualSlash = isSlash || pendingSlash;
12
- pendingSlash = false;
13
- if (start < i) {
14
- const prevChar = start > 0 ? src[start - 1] : null;
15
- cb(src.slice(start, i), isComma, actualSlash, prevChar);
16
- } else if (isComma) cb("", true, false, null);
17
- else if (actualSlash) cb("", false, true, null);
18
- start = i + 1;
19
- };
20
- for (; i < src.length; i++) {
21
- const ch = src[i];
22
- if (inQuote) {
23
- if (ch === inQuote && src[i - 1] !== "\\") inQuote = 0;
24
- continue;
25
- }
26
- if (ch === "\"" || ch === "'") {
27
- inQuote = ch;
28
- continue;
29
- }
30
- if (ch === "(") {
31
- if (!depth) {
32
- if (src.slice(Math.max(0, i - 3), i + 1) === "url(") inUrl = true;
33
- }
34
- depth++;
35
- continue;
36
- }
37
- if (ch === ")") {
38
- depth = Math.max(0, depth - 1);
39
- if (inUrl && depth === 0) inUrl = false;
40
- continue;
41
- }
42
- if (inUrl) continue;
43
- if (!depth) {
44
- if (ch === ",") {
45
- flush(true, false);
46
- continue;
47
- }
48
- if (ch === "/") {
49
- const prevIsWhitespace = isWhitespace(src[i - 1]);
50
- const nextIsWhitespace = isWhitespace(src[i + 1]);
51
- if (prevIsWhitespace && nextIsWhitespace) {
52
- pendingSlash = true;
53
- start = i + 1;
54
- continue;
55
- }
56
- continue;
57
- }
58
- if (isWhitespace(ch)) {
59
- flush(false, false);
60
- continue;
61
- }
62
- }
63
- }
64
- flush(false, false);
65
- }
66
- //#endregion
67
- export { scan };
68
-
69
- //# sourceMappingURL=tokenizer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokenizer.js","names":[],"sources":["../../src/parser/tokenizer.ts"],"sourcesContent":["export type TokenCallback = (\n token: string,\n isComma: boolean,\n isSlash: boolean,\n precedingChar: string | null,\n) => void;\n\nconst isWhitespace = (ch: string | undefined): boolean =>\n ch === ' ' || ch === '\\n' || ch === '\\t' || ch === '\\r' || ch === '\\f';\n\nexport function scan(src: string, cb: TokenCallback) {\n let depth = 0;\n let inUrl = false;\n let inQuote: string | 0 = 0;\n let start = 0;\n let i = 0;\n // Track if we just saw a standalone slash separator (whitespace before, whitespace after)\n let pendingSlash = false;\n\n const flush = (isComma: boolean, isSlash: boolean) => {\n // If we have a pending slash, emit the part break\n const actualSlash = isSlash || pendingSlash;\n pendingSlash = false;\n\n if (start < i) {\n const prevChar = start > 0 ? src[start - 1] : null;\n cb(src.slice(start, i), isComma, actualSlash, prevChar);\n } else if (isComma) {\n cb('', true, false, null); // empty token followed by comma => group break.\n } else if (actualSlash) {\n cb('', false, true, null); // empty token followed by slash => part break.\n }\n start = i + 1;\n };\n\n for (; i < src.length; i++) {\n const ch = src[i];\n\n // quote mode\n if (inQuote) {\n if (ch === inQuote && src[i - 1] !== '\\\\') inQuote = 0;\n continue;\n }\n if (ch === '\"' || ch === \"'\") {\n inQuote = ch;\n continue;\n }\n\n // paren & url tracking (not inside quotes)\n if (ch === '(') {\n // detect url(\n if (!depth) {\n const maybe = src.slice(Math.max(0, i - 3), i + 1);\n if (maybe === 'url(') inUrl = true;\n }\n depth++;\n continue;\n }\n if (ch === ')') {\n depth = Math.max(0, depth - 1);\n if (inUrl && depth === 0) inUrl = false;\n continue;\n }\n\n if (inUrl) continue; // inside url(...) treat everything as part of token\n\n if (!depth) {\n if (ch === ',') {\n flush(true, false);\n continue;\n }\n // Slash is only a separator when surrounded by whitespace (e.g., \"a / b\")\n // This preserves CSS patterns like \"center/cover\" as single tokens\n if (ch === '/') {\n const prevIsWhitespace = isWhitespace(src[i - 1]);\n const nextIsWhitespace = isWhitespace(src[i + 1]);\n if (prevIsWhitespace && nextIsWhitespace) {\n // Already flushed by whitespace before, mark pending slash\n pendingSlash = true;\n start = i + 1; // skip the slash character\n continue;\n }\n // Not surrounded by whitespace - treat as part of token\n continue;\n }\n if (isWhitespace(ch)) {\n flush(false, false);\n continue;\n }\n }\n }\n flush(false, false); // tail\n}\n"],"mappings":";AAOA,MAAM,gBAAgB,OACpB,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAQ,OAAO,QAAQ,OAAO;AAEpE,SAAgB,KAAK,KAAa,IAAmB;CACnD,IAAI,QAAQ;CACZ,IAAI,QAAQ;CACZ,IAAI,UAAsB;CAC1B,IAAI,QAAQ;CACZ,IAAI,IAAI;CAER,IAAI,eAAe;CAEnB,MAAM,SAAS,SAAkB,YAAqB;EAEpD,MAAM,cAAc,WAAW;AAC/B,iBAAe;AAEf,MAAI,QAAQ,GAAG;GACb,MAAM,WAAW,QAAQ,IAAI,IAAI,QAAQ,KAAK;AAC9C,MAAG,IAAI,MAAM,OAAO,EAAE,EAAE,SAAS,aAAa,SAAS;aAC9C,QACT,IAAG,IAAI,MAAM,OAAO,KAAK;WAChB,YACT,IAAG,IAAI,OAAO,MAAM,KAAK;AAE3B,UAAQ,IAAI;;AAGd,QAAO,IAAI,IAAI,QAAQ,KAAK;EAC1B,MAAM,KAAK,IAAI;AAGf,MAAI,SAAS;AACX,OAAI,OAAO,WAAW,IAAI,IAAI,OAAO,KAAM,WAAU;AACrD;;AAEF,MAAI,OAAO,QAAO,OAAO,KAAK;AAC5B,aAAU;AACV;;AAIF,MAAI,OAAO,KAAK;AAEd,OAAI,CAAC;QACW,IAAI,MAAM,KAAK,IAAI,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,KACpC,OAAQ,SAAQ;;AAEhC;AACA;;AAEF,MAAI,OAAO,KAAK;AACd,WAAQ,KAAK,IAAI,GAAG,QAAQ,EAAE;AAC9B,OAAI,SAAS,UAAU,EAAG,SAAQ;AAClC;;AAGF,MAAI,MAAO;AAEX,MAAI,CAAC,OAAO;AACV,OAAI,OAAO,KAAK;AACd,UAAM,MAAM,MAAM;AAClB;;AAIF,OAAI,OAAO,KAAK;IACd,MAAM,mBAAmB,aAAa,IAAI,IAAI,GAAG;IACjD,MAAM,mBAAmB,aAAa,IAAI,IAAI,GAAG;AACjD,QAAI,oBAAoB,kBAAkB;AAExC,oBAAe;AACf,aAAQ,IAAI;AACZ;;AAGF;;AAEF,OAAI,aAAa,GAAG,EAAE;AACpB,UAAM,OAAO,MAAM;AACnB;;;;AAIN,OAAM,OAAO,MAAM"}
@@ -1,51 +0,0 @@
1
- //#region src/parser/types.d.ts
2
- declare enum Bucket {
3
- Color = 0,
4
- Value = 1,
5
- Mod = 2
6
- }
7
- /**
8
- * A part within a group, representing a slash-separated segment.
9
- * For example, in `'2px solid #red / 4px'`, there are two parts:
10
- * - Part 0: `2px solid #red`
11
- * - Part 1: `4px`
12
- */
13
- interface StyleDetailsPart {
14
- mods: string[];
15
- values: string[];
16
- colors: string[];
17
- all: string[];
18
- output: string;
19
- }
20
- /**
21
- * A group of style details, representing a comma-separated segment.
22
- * Contains aggregated values from all parts for backward compatibility,
23
- * plus the structured `parts` array for handlers that need slash separation.
24
- */
25
- interface StyleDetails {
26
- input: string;
27
- output: string;
28
- /** Aggregated mods from all parts (backward compatible) */
29
- mods: string[];
30
- /** Aggregated values from all parts (backward compatible) */
31
- values: string[];
32
- /** Aggregated colors from all parts (backward compatible) */
33
- colors: string[];
34
- /** Aggregated all tokens from all parts (backward compatible) */
35
- all: string[];
36
- /** Slash-separated parts within this group */
37
- parts: StyleDetailsPart[];
38
- }
39
- interface ProcessedStyle {
40
- output: string;
41
- groups: StyleDetails[];
42
- }
43
- type UnitHandler = (scalar: number) => string;
44
- interface ParserOptions {
45
- funcs?: Record<string, (parsed: StyleDetails[]) => string>;
46
- units?: Record<string, string | UnitHandler>;
47
- cacheSize?: number;
48
- }
49
- //#endregion
50
- export { Bucket, ParserOptions, ProcessedStyle, StyleDetails, StyleDetailsPart, UnitHandler };
51
- //# sourceMappingURL=types.d.ts.map
@@ -1,46 +0,0 @@
1
- //#region src/parser/types.ts
2
- let Bucket = /* @__PURE__ */ function(Bucket) {
3
- Bucket[Bucket["Color"] = 0] = "Color";
4
- Bucket[Bucket["Value"] = 1] = "Value";
5
- Bucket[Bucket["Mod"] = 2] = "Mod";
6
- return Bucket;
7
- }({});
8
- const makeEmptyPart = () => ({
9
- mods: [],
10
- values: [],
11
- colors: [],
12
- all: [],
13
- output: ""
14
- });
15
- const makeEmptyDetails = () => ({
16
- input: "",
17
- output: "",
18
- mods: [],
19
- values: [],
20
- colors: [],
21
- all: [],
22
- parts: []
23
- });
24
- const finalizePart = (p) => {
25
- p.output = p.all.join(" ");
26
- return p;
27
- };
28
- /**
29
- * Aggregate parts into a StyleDetails group.
30
- * Combines all parts' arrays into group-level arrays for backward compatibility.
31
- */
32
- const finalizeGroup = (d, parts) => {
33
- d.parts = parts;
34
- for (const part of parts) {
35
- d.mods.push(...part.mods);
36
- d.values.push(...part.values);
37
- d.colors.push(...part.colors);
38
- d.all.push(...part.all);
39
- }
40
- d.output = parts.map((p) => p.output).join(" / ");
41
- return d;
42
- };
43
- //#endregion
44
- export { Bucket, finalizeGroup, finalizePart, makeEmptyDetails, makeEmptyPart };
45
-
46
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/parser/types.ts"],"sourcesContent":["export enum Bucket {\n Color,\n Value,\n Mod,\n}\n\n/**\n * A part within a group, representing a slash-separated segment.\n * For example, in `'2px solid #red / 4px'`, there are two parts:\n * - Part 0: `2px solid #red`\n * - Part 1: `4px`\n */\nexport interface StyleDetailsPart {\n mods: string[];\n values: string[];\n colors: string[];\n all: string[];\n output: string;\n}\n\n/**\n * A group of style details, representing a comma-separated segment.\n * Contains aggregated values from all parts for backward compatibility,\n * plus the structured `parts` array for handlers that need slash separation.\n */\nexport interface StyleDetails {\n input: string;\n output: string;\n /** Aggregated mods from all parts (backward compatible) */\n mods: string[];\n /** Aggregated values from all parts (backward compatible) */\n values: string[];\n /** Aggregated colors from all parts (backward compatible) */\n colors: string[];\n /** Aggregated all tokens from all parts (backward compatible) */\n all: string[];\n /** Slash-separated parts within this group */\n parts: StyleDetailsPart[];\n}\n\nexport interface ProcessedStyle {\n output: string;\n groups: StyleDetails[];\n}\n\nexport type UnitHandler = (scalar: number) => string;\n\nexport interface ParserOptions {\n funcs?: Record<string, (parsed: StyleDetails[]) => string>;\n units?: Record<string, string | UnitHandler>;\n cacheSize?: number;\n}\n\nexport const makeEmptyPart = (): StyleDetailsPart => ({\n mods: [],\n values: [],\n colors: [],\n all: [],\n output: '',\n});\n\nexport const makeEmptyDetails = (): StyleDetails => ({\n input: '',\n output: '',\n mods: [],\n values: [],\n colors: [],\n all: [],\n parts: [],\n});\n\nexport const finalizePart = (p: StyleDetailsPart): StyleDetailsPart => {\n p.output = p.all.join(' ');\n return p;\n};\n\n/**\n * Aggregate parts into a StyleDetails group.\n * Combines all parts' arrays into group-level arrays for backward compatibility.\n */\nexport const finalizeGroup = (\n d: StyleDetails,\n parts: StyleDetailsPart[],\n): StyleDetails => {\n // Store parts\n d.parts = parts;\n\n // Aggregate all parts into group-level arrays\n for (const part of parts) {\n d.mods.push(...part.mods);\n d.values.push(...part.values);\n d.colors.push(...part.colors);\n d.all.push(...part.all);\n }\n\n // Join parts' outputs with ' / ' for the group output\n d.output = parts.map((p) => p.output).join(' / ');\n\n return d;\n};\n"],"mappings":";AAAA,IAAY,SAAL,yBAAA,QAAA;AACL,QAAA,OAAA,WAAA,KAAA;AACA,QAAA,OAAA,WAAA,KAAA;AACA,QAAA,OAAA,SAAA,KAAA;;KACD;AAiDD,MAAa,uBAAyC;CACpD,MAAM,EAAE;CACR,QAAQ,EAAE;CACV,QAAQ,EAAE;CACV,KAAK,EAAE;CACP,QAAQ;CACT;AAED,MAAa,0BAAwC;CACnD,OAAO;CACP,QAAQ;CACR,MAAM,EAAE;CACR,QAAQ,EAAE;CACV,QAAQ,EAAE;CACV,KAAK,EAAE;CACP,OAAO,EAAE;CACV;AAED,MAAa,gBAAgB,MAA0C;AACrE,GAAE,SAAS,EAAE,IAAI,KAAK,IAAI;AAC1B,QAAO;;;;;;AAOT,MAAa,iBACX,GACA,UACiB;AAEjB,GAAE,QAAQ;AAGV,MAAK,MAAM,QAAQ,OAAO;AACxB,IAAE,KAAK,KAAK,GAAG,KAAK,KAAK;AACzB,IAAE,OAAO,KAAK,GAAG,KAAK,OAAO;AAC7B,IAAE,OAAO,KAAK,GAAG,KAAK,OAAO;AAC7B,IAAE,IAAI,KAAK,GAAG,KAAK,IAAI;;AAIzB,GAAE,SAAS,MAAM,KAAK,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM;AAEjD,QAAO"}
@@ -1,134 +0,0 @@
1
- //#region src/pipeline/conditions.d.ts
2
- /**
3
- * ConditionNode Types and Helpers
4
- *
5
- * Core data structures for representing style conditions as an abstract syntax tree.
6
- * Used throughout the pipeline for parsing, simplification, and CSS generation.
7
- */
8
- /**
9
- * Base interface for all state conditions (leaf nodes)
10
- */
11
- interface BaseStateCondition {
12
- kind: 'state';
13
- negated: boolean;
14
- raw: string;
15
- uniqueId: string;
16
- }
17
- /**
18
- * Modifier condition: [data-attr] or [data-attr="value"]
19
- */
20
- interface ModifierCondition extends BaseStateCondition {
21
- type: 'modifier';
22
- attribute: string;
23
- value?: string;
24
- operator?: '=' | '^=' | '$=' | '*=';
25
- }
26
- /**
27
- * Pseudo-class condition: :hover, :focus-visible
28
- */
29
- interface PseudoCondition extends BaseStateCondition {
30
- type: 'pseudo';
31
- pseudo: string;
32
- }
33
- /**
34
- * Numeric bound for dimension queries
35
- */
36
- interface NumericBound {
37
- value: string;
38
- valueNumeric: number | null;
39
- inclusive: boolean;
40
- }
41
- /**
42
- * Media query condition
43
- */
44
- interface MediaCondition extends BaseStateCondition {
45
- type: 'media';
46
- subtype: 'dimension' | 'feature' | 'type';
47
- dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
48
- lowerBound?: NumericBound;
49
- upperBound?: NumericBound;
50
- feature?: string;
51
- featureValue?: string;
52
- mediaType?: 'print' | 'screen' | 'all' | 'speech';
53
- }
54
- /**
55
- * Container query condition
56
- */
57
- interface ContainerCondition extends BaseStateCondition {
58
- type: 'container';
59
- subtype: 'dimension' | 'style' | 'raw';
60
- containerName?: string;
61
- dimension?: 'width' | 'height' | 'inline-size' | 'block-size';
62
- lowerBound?: NumericBound;
63
- upperBound?: NumericBound;
64
- property?: string;
65
- propertyValue?: string;
66
- rawCondition?: string;
67
- }
68
- /**
69
- * Root state condition: @root(theme=dark)
70
- */
71
- interface RootCondition extends BaseStateCondition {
72
- type: 'root';
73
- innerCondition: ConditionNode;
74
- }
75
- /**
76
- * Parent state condition: @parent(hovered), @parent(theme=dark, >)
77
- */
78
- interface ParentCondition extends BaseStateCondition {
79
- type: 'parent';
80
- innerCondition: ConditionNode;
81
- direct: boolean;
82
- }
83
- /**
84
- * Own state condition: @own(hovered)
85
- */
86
- interface OwnCondition extends BaseStateCondition {
87
- type: 'own';
88
- innerCondition: ConditionNode;
89
- }
90
- /**
91
- * Starting style condition: @starting
92
- */
93
- interface StartingCondition extends BaseStateCondition {
94
- type: 'starting';
95
- }
96
- /**
97
- * Supports query condition: @supports(display: grid), @supports($, :has(*))
98
- */
99
- interface SupportsCondition extends BaseStateCondition {
100
- type: 'supports';
101
- subtype: 'feature' | 'selector';
102
- condition: string;
103
- }
104
- /**
105
- * Union of all state condition types
106
- */
107
- type StateCondition = ModifierCondition | PseudoCondition | MediaCondition | ContainerCondition | RootCondition | ParentCondition | OwnCondition | StartingCondition | SupportsCondition;
108
- /**
109
- * Compound node: combines conditions with AND/OR
110
- */
111
- interface CompoundCondition {
112
- kind: 'compound';
113
- operator: 'AND' | 'OR';
114
- children: ConditionNode[];
115
- }
116
- /**
117
- * True condition (matches everything)
118
- */
119
- interface TrueCondition {
120
- kind: 'true';
121
- }
122
- /**
123
- * False condition (matches nothing - skip this rule)
124
- */
125
- interface FalseCondition {
126
- kind: 'false';
127
- }
128
- /**
129
- * Union of all condition node types
130
- */
131
- type ConditionNode = StateCondition | CompoundCondition | TrueCondition | FalseCondition;
132
- //#endregion
133
- export { ConditionNode };
134
- //# sourceMappingURL=conditions.d.ts.map