@tenphi/tasty 0.0.0-snapshot.275370e → 0.0.0-snapshot.27b6708

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 (356) hide show
  1. package/README.md +175 -109
  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-BUQGeOXA.d.ts +83 -0
  5. package/dist/{ssr/collector.js → collector-DTahQUiV.js} +97 -28
  6. package/dist/collector-DTahQUiV.js.map +1 -0
  7. package/dist/{ssr/collector.d.ts → collector-DUaHCcTS.d.ts} +54 -7
  8. package/dist/config-B5kHzuNz.js +12269 -0
  9. package/dist/config-B5kHzuNz.js.map +1 -0
  10. package/dist/config-YsxGv4tq.d.ts +1263 -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-Dr4u1NVD.js +1566 -0
  16. package/dist/core-Dr4u1NVD.js.map +1 -0
  17. package/dist/{zero/extractor.js → css-writer-B-J87ncv.js} +148 -24
  18. package/dist/css-writer-B-J87ncv.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-DKOA-6qu.js} +59 -2
  22. package/dist/format-rules-DKOA-6qu.js.map +1 -0
  23. package/dist/{ssr/hydrate.js → hydrate-OeMX99We.js} +3 -11
  24. package/dist/hydrate-OeMX99We.js.map +1 -0
  25. package/dist/index-Cd45t5NM.d.ts +1521 -0
  26. package/dist/index-PqN-DIpn.d.ts +1911 -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-CV8azJf3.js +493 -0
  31. package/dist/keyframes-CV8azJf3.js.map +1 -0
  32. package/dist/{utils/merge-styles.d.ts → merge-styles-CU7JbEwg.d.ts} +3 -3
  33. package/dist/{utils/merge-styles.js → merge-styles-oklji0KB.js} +3 -4
  34. package/dist/merge-styles-oklji0KB.js.map +1 -0
  35. package/dist/{utils/resolve-recipes.js → resolve-recipes-DTG81rzl.js} +4 -6
  36. package/dist/resolve-recipes-DTG81rzl.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 +13 -7
  67. package/docs/adoption.md +53 -28
  68. package/docs/ai-agents.md +224 -0
  69. package/docs/comparison.md +59 -30
  70. package/docs/configuration.md +498 -69
  71. package/docs/debug.md +18 -16
  72. package/docs/design-system.md +43 -24
  73. package/docs/dsl.md +510 -177
  74. package/docs/getting-started.md +55 -34
  75. package/docs/injector.md +60 -7
  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 +349 -0
  80. package/docs/react-api.md +162 -38
  81. package/docs/ssr.md +45 -35
  82. package/docs/styles.md +65 -16
  83. package/docs/tasty-static.md +25 -8
  84. package/package.json +44 -21
  85. package/tasty.config.ts +6 -0
  86. package/dist/_virtual/_rolldown/runtime.js +0 -7
  87. package/dist/chunks/cacheKey.d.ts +0 -1
  88. package/dist/chunks/cacheKey.js +0 -77
  89. package/dist/chunks/cacheKey.js.map +0 -1
  90. package/dist/chunks/definitions.d.ts +0 -37
  91. package/dist/chunks/definitions.js +0 -258
  92. package/dist/chunks/definitions.js.map +0 -1
  93. package/dist/chunks/index.d.ts +0 -1
  94. package/dist/chunks/renderChunk.d.ts +0 -1
  95. package/dist/chunks/renderChunk.js +0 -59
  96. package/dist/chunks/renderChunk.js.map +0 -1
  97. package/dist/compute-styles.d.ts +0 -31
  98. package/dist/compute-styles.js +0 -322
  99. package/dist/compute-styles.js.map +0 -1
  100. package/dist/config.d.ts +0 -407
  101. package/dist/config.js +0 -591
  102. package/dist/config.js.map +0 -1
  103. package/dist/counter-style/index.js +0 -51
  104. package/dist/counter-style/index.js.map +0 -1
  105. package/dist/debug.d.ts +0 -89
  106. package/dist/debug.js +0 -453
  107. package/dist/debug.js.map +0 -1
  108. package/dist/font-face/index.js +0 -63
  109. package/dist/font-face/index.js.map +0 -1
  110. package/dist/hooks/index.d.ts +0 -7
  111. package/dist/hooks/useCounterStyle.d.ts +0 -36
  112. package/dist/hooks/useCounterStyle.js +0 -65
  113. package/dist/hooks/useCounterStyle.js.map +0 -1
  114. package/dist/hooks/useFontFace.d.ts +0 -45
  115. package/dist/hooks/useFontFace.js +0 -66
  116. package/dist/hooks/useFontFace.js.map +0 -1
  117. package/dist/hooks/useGlobalStyles.d.ts +0 -46
  118. package/dist/hooks/useGlobalStyles.js +0 -88
  119. package/dist/hooks/useGlobalStyles.js.map +0 -1
  120. package/dist/hooks/useKeyframes.d.ts +0 -58
  121. package/dist/hooks/useKeyframes.js +0 -55
  122. package/dist/hooks/useKeyframes.js.map +0 -1
  123. package/dist/hooks/useProperty.d.ts +0 -81
  124. package/dist/hooks/useProperty.js +0 -96
  125. package/dist/hooks/useProperty.js.map +0 -1
  126. package/dist/hooks/useRawCSS.d.ts +0 -22
  127. package/dist/hooks/useRawCSS.js +0 -103
  128. package/dist/hooks/useRawCSS.js.map +0 -1
  129. package/dist/hooks/useStyles.d.ts +0 -40
  130. package/dist/hooks/useStyles.js +0 -31
  131. package/dist/hooks/useStyles.js.map +0 -1
  132. package/dist/injector/index.d.ts +0 -182
  133. package/dist/injector/index.js +0 -185
  134. package/dist/injector/index.js.map +0 -1
  135. package/dist/injector/injector.d.ts +0 -198
  136. package/dist/injector/injector.js +0 -651
  137. package/dist/injector/injector.js.map +0 -1
  138. package/dist/injector/sheet-manager.d.ts +0 -132
  139. package/dist/injector/sheet-manager.js +0 -699
  140. package/dist/injector/sheet-manager.js.map +0 -1
  141. package/dist/injector/types.d.ts +0 -235
  142. package/dist/keyframes/index.js +0 -206
  143. package/dist/keyframes/index.js.map +0 -1
  144. package/dist/parser/classify.js +0 -319
  145. package/dist/parser/classify.js.map +0 -1
  146. package/dist/parser/const.js +0 -60
  147. package/dist/parser/const.js.map +0 -1
  148. package/dist/parser/lru.js +0 -109
  149. package/dist/parser/lru.js.map +0 -1
  150. package/dist/parser/parser.d.ts +0 -25
  151. package/dist/parser/parser.js +0 -115
  152. package/dist/parser/parser.js.map +0 -1
  153. package/dist/parser/tokenizer.js +0 -69
  154. package/dist/parser/tokenizer.js.map +0 -1
  155. package/dist/parser/types.d.ts +0 -51
  156. package/dist/parser/types.js +0 -46
  157. package/dist/parser/types.js.map +0 -1
  158. package/dist/pipeline/conditions.d.ts +0 -134
  159. package/dist/pipeline/conditions.js +0 -406
  160. package/dist/pipeline/conditions.js.map +0 -1
  161. package/dist/pipeline/exclusive.js +0 -285
  162. package/dist/pipeline/exclusive.js.map +0 -1
  163. package/dist/pipeline/index.d.ts +0 -55
  164. package/dist/pipeline/index.js +0 -708
  165. package/dist/pipeline/index.js.map +0 -1
  166. package/dist/pipeline/materialize.js +0 -1157
  167. package/dist/pipeline/materialize.js.map +0 -1
  168. package/dist/pipeline/parseStateKey.d.ts +0 -15
  169. package/dist/pipeline/parseStateKey.js +0 -446
  170. package/dist/pipeline/parseStateKey.js.map +0 -1
  171. package/dist/pipeline/simplify.js +0 -690
  172. package/dist/pipeline/simplify.js.map +0 -1
  173. package/dist/pipeline/warnings.js +0 -18
  174. package/dist/pipeline/warnings.js.map +0 -1
  175. package/dist/plugins/index.d.ts +0 -2
  176. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  177. package/dist/plugins/okhsl-plugin.js +0 -97
  178. package/dist/plugins/okhsl-plugin.js.map +0 -1
  179. package/dist/plugins/types.d.ts +0 -87
  180. package/dist/properties/index.js +0 -222
  181. package/dist/properties/index.js.map +0 -1
  182. package/dist/properties/property-type-resolver.d.ts +0 -24
  183. package/dist/properties/property-type-resolver.js +0 -90
  184. package/dist/properties/property-type-resolver.js.map +0 -1
  185. package/dist/rsc-cache.js +0 -79
  186. package/dist/rsc-cache.js.map +0 -1
  187. package/dist/ssr/async-storage.d.ts +0 -17
  188. package/dist/ssr/async-storage.js.map +0 -1
  189. package/dist/ssr/collect-auto-properties.js +0 -58
  190. package/dist/ssr/collect-auto-properties.js.map +0 -1
  191. package/dist/ssr/collector.js.map +0 -1
  192. package/dist/ssr/context.js.map +0 -1
  193. package/dist/ssr/format-global-rules.js.map +0 -1
  194. package/dist/ssr/format-keyframes.js +0 -69
  195. package/dist/ssr/format-keyframes.js.map +0 -1
  196. package/dist/ssr/format-property.js +0 -49
  197. package/dist/ssr/format-property.js.map +0 -1
  198. package/dist/ssr/format-rules.js.map +0 -1
  199. package/dist/ssr/hydrate.d.ts +0 -29
  200. package/dist/ssr/hydrate.js.map +0 -1
  201. package/dist/ssr/ssr-collector-ref.js +0 -29
  202. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  203. package/dist/states/index.d.ts +0 -49
  204. package/dist/states/index.js +0 -170
  205. package/dist/states/index.js.map +0 -1
  206. package/dist/static/tastyStatic.d.ts +0 -46
  207. package/dist/static/tastyStatic.js +0 -30
  208. package/dist/static/tastyStatic.js.map +0 -1
  209. package/dist/static/types.d.ts +0 -49
  210. package/dist/static/types.js +0 -24
  211. package/dist/static/types.js.map +0 -1
  212. package/dist/styles/border.d.ts +0 -25
  213. package/dist/styles/border.js +0 -120
  214. package/dist/styles/border.js.map +0 -1
  215. package/dist/styles/color.d.ts +0 -14
  216. package/dist/styles/color.js +0 -26
  217. package/dist/styles/color.js.map +0 -1
  218. package/dist/styles/const.js +0 -17
  219. package/dist/styles/const.js.map +0 -1
  220. package/dist/styles/createStyle.js +0 -79
  221. package/dist/styles/createStyle.js.map +0 -1
  222. package/dist/styles/dimension.js +0 -109
  223. package/dist/styles/dimension.js.map +0 -1
  224. package/dist/styles/directional.js +0 -133
  225. package/dist/styles/directional.js.map +0 -1
  226. package/dist/styles/display.d.ts +0 -30
  227. package/dist/styles/display.js +0 -73
  228. package/dist/styles/display.js.map +0 -1
  229. package/dist/styles/fade.d.ts +0 -15
  230. package/dist/styles/fade.js +0 -62
  231. package/dist/styles/fade.js.map +0 -1
  232. package/dist/styles/fill.d.ts +0 -42
  233. package/dist/styles/fill.js +0 -51
  234. package/dist/styles/fill.js.map +0 -1
  235. package/dist/styles/flow.d.ts +0 -16
  236. package/dist/styles/flow.js +0 -12
  237. package/dist/styles/flow.js.map +0 -1
  238. package/dist/styles/gap.d.ts +0 -31
  239. package/dist/styles/gap.js +0 -38
  240. package/dist/styles/gap.js.map +0 -1
  241. package/dist/styles/height.d.ts +0 -17
  242. package/dist/styles/height.js +0 -19
  243. package/dist/styles/height.js.map +0 -1
  244. package/dist/styles/index.d.ts +0 -1
  245. package/dist/styles/index.js +0 -8
  246. package/dist/styles/index.js.map +0 -1
  247. package/dist/styles/inset.d.ts +0 -24
  248. package/dist/styles/inset.js +0 -34
  249. package/dist/styles/inset.js.map +0 -1
  250. package/dist/styles/list.d.ts +0 -16
  251. package/dist/styles/list.js +0 -100
  252. package/dist/styles/list.js.map +0 -1
  253. package/dist/styles/margin.d.ts +0 -24
  254. package/dist/styles/margin.js +0 -32
  255. package/dist/styles/margin.js.map +0 -1
  256. package/dist/styles/outline.d.ts +0 -29
  257. package/dist/styles/outline.js +0 -55
  258. package/dist/styles/outline.js.map +0 -1
  259. package/dist/styles/padding.d.ts +0 -24
  260. package/dist/styles/padding.js +0 -32
  261. package/dist/styles/padding.js.map +0 -1
  262. package/dist/styles/placement.d.ts +0 -37
  263. package/dist/styles/placement.js +0 -74
  264. package/dist/styles/placement.js.map +0 -1
  265. package/dist/styles/predefined.d.ts +0 -71
  266. package/dist/styles/predefined.js +0 -237
  267. package/dist/styles/predefined.js.map +0 -1
  268. package/dist/styles/preset.d.ts +0 -52
  269. package/dist/styles/preset.js +0 -127
  270. package/dist/styles/preset.js.map +0 -1
  271. package/dist/styles/radius.d.ts +0 -12
  272. package/dist/styles/radius.js +0 -83
  273. package/dist/styles/radius.js.map +0 -1
  274. package/dist/styles/scrollMargin.d.ts +0 -24
  275. package/dist/styles/scrollMargin.js +0 -32
  276. package/dist/styles/scrollMargin.js.map +0 -1
  277. package/dist/styles/scrollbar.d.ts +0 -25
  278. package/dist/styles/scrollbar.js +0 -51
  279. package/dist/styles/scrollbar.js.map +0 -1
  280. package/dist/styles/shadow.d.ts +0 -14
  281. package/dist/styles/shadow.js +0 -25
  282. package/dist/styles/shadow.js.map +0 -1
  283. package/dist/styles/shared.js +0 -17
  284. package/dist/styles/shared.js.map +0 -1
  285. package/dist/styles/transition.d.ts +0 -14
  286. package/dist/styles/transition.js +0 -159
  287. package/dist/styles/transition.js.map +0 -1
  288. package/dist/styles/types.d.ts +0 -564
  289. package/dist/styles/width.d.ts +0 -17
  290. package/dist/styles/width.js +0 -19
  291. package/dist/styles/width.js.map +0 -1
  292. package/dist/tasty.d.ts +0 -134
  293. package/dist/tasty.js +0 -248
  294. package/dist/tasty.js.map +0 -1
  295. package/dist/types.d.ts +0 -184
  296. package/dist/utils/cache-wrapper.js +0 -21
  297. package/dist/utils/cache-wrapper.js.map +0 -1
  298. package/dist/utils/case-converter.js +0 -8
  299. package/dist/utils/case-converter.js.map +0 -1
  300. package/dist/utils/color-math.d.ts +0 -46
  301. package/dist/utils/color-math.js +0 -749
  302. package/dist/utils/color-math.js.map +0 -1
  303. package/dist/utils/color-space.d.ts +0 -5
  304. package/dist/utils/color-space.js +0 -228
  305. package/dist/utils/color-space.js.map +0 -1
  306. package/dist/utils/colors.d.ts +0 -5
  307. package/dist/utils/colors.js +0 -10
  308. package/dist/utils/colors.js.map +0 -1
  309. package/dist/utils/css-types.d.ts +0 -7
  310. package/dist/utils/deps-equal.js +0 -15
  311. package/dist/utils/deps-equal.js.map +0 -1
  312. package/dist/utils/dotize.d.ts +0 -26
  313. package/dist/utils/dotize.js +0 -122
  314. package/dist/utils/dotize.js.map +0 -1
  315. package/dist/utils/filter-base-props.d.ts +0 -15
  316. package/dist/utils/filter-base-props.js +0 -45
  317. package/dist/utils/filter-base-props.js.map +0 -1
  318. package/dist/utils/get-display-name.d.ts +0 -7
  319. package/dist/utils/get-display-name.js +0 -10
  320. package/dist/utils/get-display-name.js.map +0 -1
  321. package/dist/utils/has-keys.js +0 -13
  322. package/dist/utils/has-keys.js.map +0 -1
  323. package/dist/utils/hash.js +0 -14
  324. package/dist/utils/hash.js.map +0 -1
  325. package/dist/utils/is-dev-env.js +0 -19
  326. package/dist/utils/is-dev-env.js.map +0 -1
  327. package/dist/utils/is-valid-element-type.js +0 -15
  328. package/dist/utils/is-valid-element-type.js.map +0 -1
  329. package/dist/utils/merge-styles.js.map +0 -1
  330. package/dist/utils/mod-attrs.d.ts +0 -6
  331. package/dist/utils/mod-attrs.js +0 -20
  332. package/dist/utils/mod-attrs.js.map +0 -1
  333. package/dist/utils/process-tokens.d.ts +0 -17
  334. package/dist/utils/process-tokens.js +0 -83
  335. package/dist/utils/process-tokens.js.map +0 -1
  336. package/dist/utils/resolve-recipes.d.ts +0 -17
  337. package/dist/utils/resolve-recipes.js.map +0 -1
  338. package/dist/utils/selector-transform.js +0 -32
  339. package/dist/utils/selector-transform.js.map +0 -1
  340. package/dist/utils/string.js +0 -8
  341. package/dist/utils/string.js.map +0 -1
  342. package/dist/utils/styles.d.ts +0 -99
  343. package/dist/utils/styles.js +0 -220
  344. package/dist/utils/styles.js.map +0 -1
  345. package/dist/utils/typography.d.ts +0 -58
  346. package/dist/utils/typography.js +0 -51
  347. package/dist/utils/typography.js.map +0 -1
  348. package/dist/utils/warnings.d.ts +0 -16
  349. package/dist/utils/warnings.js +0 -16
  350. package/dist/utils/warnings.js.map +0 -1
  351. package/dist/zero/css-writer.d.ts +0 -45
  352. package/dist/zero/css-writer.js +0 -73
  353. package/dist/zero/css-writer.js.map +0 -1
  354. package/dist/zero/extractor.d.ts +0 -24
  355. package/dist/zero/extractor.js.map +0 -1
  356. package/docs/PIPELINE.md +0 -519
@@ -1,26 +0,0 @@
1
- import { getColorSpaceSuffix } from "../utils/color-space.js";
2
- import { parseColor } from "../utils/styles.js";
3
- import { convertColorChainToComponentChain } from "./createStyle.js";
4
- //#region src/styles/color.ts
5
- function colorStyle({ color }) {
6
- if (!color) return null;
7
- if (color === true) color = "currentColor";
8
- if (typeof color === "string" && (color.startsWith("#") || color.startsWith("(#"))) color = parseColor(color).color || color;
9
- const match = color.match(/var\(--(.+?)-color/);
10
- let name = "";
11
- if (match) name = match[1];
12
- const styles = { color };
13
- if (name && name !== "current") {
14
- const suffix = getColorSpaceSuffix();
15
- Object.assign(styles, {
16
- "--current-color": color,
17
- [`--current-color-${suffix}`]: convertColorChainToComponentChain(color)
18
- });
19
- }
20
- return styles;
21
- }
22
- colorStyle.__lookupStyles = ["color"];
23
- //#endregion
24
- export { colorStyle };
25
-
26
- //# sourceMappingURL=color.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"color.js","names":[],"sources":["../../src/styles/color.ts"],"sourcesContent":["import { getColorSpaceSuffix } from '../utils/color-space';\nimport { parseColor } from '../utils/styles';\n\nimport { convertColorChainToComponentChain } from './createStyle';\n\nexport function colorStyle({ color }: { color?: string | boolean }) {\n if (!color) return null;\n\n if (color === true) color = 'currentColor';\n\n if (\n typeof color === 'string' &&\n (color.startsWith('#') || color.startsWith('(#'))\n ) {\n color = parseColor(color).color || color;\n }\n\n const match = color.match(/var\\(--(.+?)-color/);\n let name = '';\n\n if (match) {\n name = match[1];\n }\n\n const styles = {\n color: color,\n };\n\n if (name && name !== 'current') {\n const suffix = getColorSpaceSuffix();\n Object.assign(styles, {\n '--current-color': color,\n [`--current-color-${suffix}`]: convertColorChainToComponentChain(color),\n });\n }\n\n return styles;\n}\n\ncolorStyle.__lookupStyles = ['color'];\n"],"mappings":";;;;AAKA,SAAgB,WAAW,EAAE,SAAuC;AAClE,KAAI,CAAC,MAAO,QAAO;AAEnB,KAAI,UAAU,KAAM,SAAQ;AAE5B,KACE,OAAO,UAAU,aAChB,MAAM,WAAW,IAAI,IAAI,MAAM,WAAW,KAAK,EAEhD,SAAQ,WAAW,MAAM,CAAC,SAAS;CAGrC,MAAM,QAAQ,MAAM,MAAM,qBAAqB;CAC/C,IAAI,OAAO;AAEX,KAAI,MACF,QAAO,MAAM;CAGf,MAAM,SAAS,EACN,OACR;AAED,KAAI,QAAQ,SAAS,WAAW;EAC9B,MAAM,SAAS,qBAAqB;AACpC,SAAO,OAAO,QAAQ;GACpB,mBAAmB;IAClB,mBAAmB,WAAW,kCAAkC,MAAM;GACxE,CAAC;;AAGJ,QAAO;;AAGT,WAAW,iBAAiB,CAAC,QAAQ"}
@@ -1,17 +0,0 @@
1
- //#region src/styles/const.ts
2
- const BORDER_STYLES = [
3
- "none",
4
- "hidden",
5
- "dotted",
6
- "dashed",
7
- "solid",
8
- "double",
9
- "groove",
10
- "ridge",
11
- "inset",
12
- "outset"
13
- ];
14
- //#endregion
15
- export { BORDER_STYLES };
16
-
17
- //# sourceMappingURL=const.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"const.js","names":[],"sources":["../../src/styles/const.ts"],"sourcesContent":["export const BORDER_STYLES = [\n 'none',\n 'hidden',\n 'dotted',\n 'dashed',\n 'solid',\n 'double',\n 'groove',\n 'ridge',\n 'inset',\n 'outset',\n] as const;\n"],"mappings":";AAAA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
@@ -1,79 +0,0 @@
1
- import { getColorSpaceComponents, getColorSpaceSuffix, strToColorSpace } from "../utils/color-space.js";
2
- import { normalizeColorTokenValue, parseColor, parseStyle } from "../utils/styles.js";
3
- import { toSnakeCase } from "../utils/string.js";
4
- //#region src/styles/createStyle.ts
5
- const CACHE = {};
6
- /**
7
- * Convert color fallback chain to component fallback chain.
8
- * Example: var(--primary-color, var(--secondary-color))
9
- * → var(--primary-color-oklch, var(--secondary-color-oklch))
10
- */
11
- function convertColorChainToComponentChain(colorValue) {
12
- const suffix = getColorSpaceSuffix();
13
- const componentVarMatch = colorValue.match(/^(?:rgb|hsl|oklch)a?\(\s*(var\(--[a-z0-9-]+-color-(?:rgb|hsl|oklch)\))\s*\//);
14
- if (componentVarMatch) return componentVarMatch[1];
15
- const match = colorValue.match(/var\(--([a-z0-9-]+)-color\s*(?:,\s*(.+))?\)/);
16
- if (!match) {
17
- const components = getColorSpaceComponents(colorValue);
18
- if (components !== colorValue) return components;
19
- return colorValue;
20
- }
21
- const [, name, fallback] = match;
22
- if (!fallback) return `var(--${name}-color-${suffix})`;
23
- return `var(--${name}-color-${suffix}, ${convertColorChainToComponentChain(fallback.trim())})`;
24
- }
25
- function createStyle(styleName, cssStyle, converter) {
26
- const key = `${styleName}.${cssStyle ?? ""}`;
27
- if (!CACHE[key]) {
28
- const styleHandler = (styleMap) => {
29
- let styleValue = styleMap[styleName];
30
- if (styleValue == null || styleValue === false) return null;
31
- let finalCssStyle;
32
- const isColorToken = !cssStyle && typeof styleName === "string" && styleName.startsWith("#");
33
- if (isColorToken) finalCssStyle = `--${toSnakeCase(styleName.slice(1)).replace(/^-+/, "")}-color`;
34
- else finalCssStyle = cssStyle || toSnakeCase(styleName).replace(/^\$/, "--");
35
- if (isColorToken) {
36
- const normalized = normalizeColorTokenValue(styleValue);
37
- if (normalized === null) return null;
38
- styleValue = normalized;
39
- }
40
- if (converter && typeof styleValue !== "string") {
41
- styleValue = converter(styleValue);
42
- if (!styleValue) return null;
43
- }
44
- if (typeof styleValue === "string" && finalCssStyle.startsWith("--") && finalCssStyle.endsWith("-color")) {
45
- styleValue = styleValue.trim();
46
- const suffix = getColorSpaceSuffix();
47
- const colorSpaceStr = strToColorSpace(styleValue);
48
- const { color, name } = parseColor(styleValue);
49
- if (name && colorSpaceStr) return {
50
- [finalCssStyle]: `var(--${name}-color, ${colorSpaceStr})`,
51
- [`${finalCssStyle}-${suffix}`]: `var(--${name}-color-${suffix}, ${getColorSpaceComponents(colorSpaceStr)})`
52
- };
53
- else if (name) {
54
- if (color) return {
55
- [finalCssStyle]: color,
56
- [`${finalCssStyle}-${suffix}`]: convertColorChainToComponentChain(color)
57
- };
58
- return {
59
- [finalCssStyle]: `var(--${name}-color)`,
60
- [`${finalCssStyle}-${suffix}`]: `var(--${name}-color-${suffix})`
61
- };
62
- } else if (colorSpaceStr) return {
63
- [finalCssStyle]: colorSpaceStr,
64
- [`${finalCssStyle}-${suffix}`]: getColorSpaceComponents(colorSpaceStr)
65
- };
66
- return { [finalCssStyle]: color ?? "" };
67
- }
68
- const processed = parseStyle(styleValue);
69
- return { [finalCssStyle]: processed.output };
70
- };
71
- styleHandler.__lookupStyles = [styleName];
72
- CACHE[key] = styleHandler;
73
- }
74
- return CACHE[key];
75
- }
76
- //#endregion
77
- export { convertColorChainToComponentChain, createStyle };
78
-
79
- //# sourceMappingURL=createStyle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createStyle.js","names":[],"sources":["../../src/styles/createStyle.ts"],"sourcesContent":["import {\n getColorSpaceComponents,\n getColorSpaceSuffix,\n strToColorSpace,\n} from '../utils/color-space';\nimport { toSnakeCase } from '../utils/string';\nimport {\n normalizeColorTokenValue,\n parseColor,\n parseStyle,\n} from '../utils/styles';\nimport type {\n CSSMap,\n StyleHandler,\n StyleValue,\n StyleValueStateMap,\n} from '../utils/styles';\n\nconst CACHE: Record<string, StyleHandler> = {};\n\n/**\n * Convert color fallback chain to component fallback chain.\n * Example: var(--primary-color, var(--secondary-color))\n * → var(--primary-color-oklch, var(--secondary-color-oklch))\n */\nexport function convertColorChainToComponentChain(colorValue: string): string {\n const suffix = getColorSpaceSuffix();\n\n // Handle func(var(--name-color-{suffix}) / alpha) pattern.\n // When #name.opacity is parsed, the classifier produces e.g.\n // oklch(var(--name-color-oklch) / .opacity).\n // The component chain should be just the inner var() reference.\n const componentVarMatch = colorValue.match(\n /^(?:rgb|hsl|oklch)a?\\(\\s*(var\\(--[a-z0-9-]+-color-(?:rgb|hsl|oklch)\\))\\s*\\//,\n );\n if (componentVarMatch) {\n return componentVarMatch[1];\n }\n\n // Match var(--name-color, ...) pattern\n const varPattern = /var\\(--([a-z0-9-]+)-color\\s*(?:,\\s*(.+))?\\)/;\n const match = colorValue.match(varPattern);\n\n if (!match) {\n // Not a color variable — try to convert to components\n const components = getColorSpaceComponents(colorValue);\n if (components !== colorValue) return components;\n return colorValue;\n }\n\n const [, name, fallback] = match;\n\n if (!fallback) {\n return `var(--${name}-color-${suffix})`;\n }\n\n const processedFallback = convertColorChainToComponentChain(fallback.trim());\n return `var(--${name}-color-${suffix}, ${processedFallback})`;\n}\n\nexport function createStyle(\n styleName: string,\n cssStyle?: string,\n converter?: (styleValue: string | number | true) => string | undefined,\n) {\n const key = `${styleName}.${cssStyle ?? ''}`;\n\n if (!CACHE[key]) {\n const styleHandler = (styleMap: StyleValueStateMap): CSSMap | null => {\n let styleValue = styleMap[styleName];\n\n if (styleValue == null || styleValue === false) return null;\n\n let finalCssStyle: string;\n const isColorToken =\n !cssStyle && typeof styleName === 'string' && styleName.startsWith('#');\n\n if (isColorToken) {\n const raw = styleName.slice(1);\n const name = toSnakeCase(raw).replace(/^-+/, '');\n finalCssStyle = `--${name}-color`;\n } else {\n finalCssStyle = cssStyle || toSnakeCase(styleName).replace(/^\\$/, '--');\n }\n\n if (isColorToken) {\n const normalized = normalizeColorTokenValue(styleValue);\n if (normalized === null) return null;\n styleValue = normalized;\n }\n\n if (converter && typeof styleValue !== 'string') {\n styleValue = converter(styleValue as string | number | true);\n\n if (!styleValue) return null;\n }\n\n if (\n typeof styleValue === 'string' &&\n finalCssStyle.startsWith('--') &&\n finalCssStyle.endsWith('-color')\n ) {\n styleValue = styleValue.trim();\n const suffix = getColorSpaceSuffix();\n\n const colorSpaceStr = strToColorSpace(styleValue as string);\n\n const { color, name } = parseColor(styleValue as string);\n\n if (name && colorSpaceStr) {\n return {\n [finalCssStyle]: `var(--${name}-color, ${colorSpaceStr})`,\n [`${finalCssStyle}-${suffix}`]: `var(--${name}-color-${suffix}, ${getColorSpaceComponents(\n colorSpaceStr,\n )})`,\n };\n } else if (name) {\n if (color) {\n return {\n [finalCssStyle]: color,\n [`${finalCssStyle}-${suffix}`]:\n convertColorChainToComponentChain(color),\n };\n }\n\n return {\n [finalCssStyle]: `var(--${name}-color)`,\n [`${finalCssStyle}-${suffix}`]: `var(--${name}-color-${suffix})`,\n };\n } else if (colorSpaceStr) {\n return {\n [finalCssStyle]: colorSpaceStr,\n [`${finalCssStyle}-${suffix}`]:\n getColorSpaceComponents(colorSpaceStr),\n };\n }\n\n return {\n [finalCssStyle]: color ?? '',\n };\n }\n\n const processed = parseStyle(styleValue as StyleValue);\n return { [finalCssStyle]: processed.output };\n };\n\n styleHandler.__look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;AACA,iBAAa,WAAW,MAAM;IAC9B,MAAM,SAAS,qBAAqB;IAEpC,MAAM,gBAAgB,gBAAgB,WAAqB;IAE3D,MAAM,EAAE,OAAO,SAAS,WAAW,WAAqB;AAExD,QAAI,QAAQ,cACV,QAAO;MACJ,gBAAgB,SAAS,KAAK,UAAU,cAAc;MACtD,GAAG,cAAc,GAAG,WAAW,SAAS,KAAK,SAAS,OAAO,IAAI,wBAChE,cACD,CAAC;KACH;aACQ,MAAM;AACf,SAAI,MACF,QAAO;OACJ,gBAAgB;OAChB,GAAG,cAAc,GAAG,WACnB,kCAAkC,MAAM;MAC3C;AAGH,YAAO;OACJ,gBAAgB,SAAS,KAAK;OAC9B,GAAG,cAAc,GAAG,WAAW,SAAS,KAAK,SAAS,OAAO;MAC/D;eACQ,cACT,QAAO;MACJ,gBAAgB;MAChB,GAAG,cAAc,GAAG,WACnB,wBAAwB,cAAc;KACzC;AAGH,WAAO,GACJ,gBAAgB,SAAS,IAC3B;;GAGH,MAAM,YAAY,WAAW,WAAyB;AACtD,UAAO,GAAG,gBAAgB,UAAU,QAAQ;;AAG9C,eAAa,iBAAiB,CAAC,UAAU;AAEzC,QAAM,OAAO;;AAGf,QAAO,MAAM"}
@@ -1,109 +0,0 @@
1
- import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
2
- import { makeEmptyDetails } from "../parser/types.js";
3
- import { parseStyle } from "../utils/styles.js";
4
- //#region src/styles/dimension.ts
5
- const DEFAULT_MIN_SIZE = "var(--gap)";
6
- const DEFAULT_MAX_SIZE = "100%";
7
- /**
8
- * Parse a dimension value (string, number, or boolean) into a CSS value
9
- */
10
- function parseDimensionValue(val) {
11
- if (val == null) return null;
12
- if (typeof val === "number") return `${val}px`;
13
- if (val === true) return "initial";
14
- return parseStyle(String(val)).groups[0]?.values[0] || null;
15
- }
16
- /**
17
- * Creates a dimension style handler for width or height.
18
- *
19
- * Supports:
20
- * - Main dimension prop (width/height) with syntax for min/max
21
- * - Separate min/max props (minWidth/maxWidth or minHeight/maxHeight)
22
- *
23
- * Priority: Individual min/max props override values from main prop syntax
24
- */
25
- function dimensionStyle(name) {
26
- const minStyle = `min-${name}`;
27
- const maxStyle = `max-${name}`;
28
- return ({ value, min, max }) => {
29
- if (value == null && min == null && max == null) return null;
30
- if (value != null && typeof value === "string" && CSS_WIDE_KEYWORDS.has(value)) {
31
- const styles = {
32
- [name]: value,
33
- [minStyle]: value,
34
- [maxStyle]: value
35
- };
36
- const minVal = parseDimensionValue(min);
37
- const maxVal = parseDimensionValue(max);
38
- if (minVal) styles[minStyle] = minVal;
39
- if (maxVal) styles[maxStyle] = maxVal;
40
- return styles;
41
- }
42
- if (value === true) {
43
- const styles = {
44
- [name]: "auto",
45
- [minStyle]: "initial",
46
- [maxStyle]: "initial"
47
- };
48
- const minVal = parseDimensionValue(min);
49
- const maxVal = parseDimensionValue(max);
50
- if (minVal) styles[minStyle] = minVal;
51
- if (maxVal) styles[maxStyle] = maxVal;
52
- return styles;
53
- }
54
- const styles = {
55
- [name]: "auto",
56
- [minStyle]: "initial",
57
- [maxStyle]: "initial"
58
- };
59
- if (value != null) {
60
- let val = value;
61
- if (typeof val === "number") val = `${val}px`;
62
- val = String(val);
63
- const { mods, values } = parseStyle(val).groups[0] ?? makeEmptyDetails();
64
- let flag = false;
65
- for (const mod of mods) switch (mod) {
66
- case "min":
67
- styles[minStyle] = values[0] || DEFAULT_MIN_SIZE;
68
- flag = true;
69
- break;
70
- case "max":
71
- styles[maxStyle] = values[0] || DEFAULT_MAX_SIZE;
72
- flag = true;
73
- break;
74
- case "fixed": {
75
- const fixedValue = values[0] || "max-content";
76
- styles[minStyle] = fixedValue;
77
- styles[name] = fixedValue;
78
- styles[maxStyle] = fixedValue;
79
- flag = true;
80
- break;
81
- }
82
- default: break;
83
- }
84
- if (!flag || !mods.length) if (values.length === 2) {
85
- styles[minStyle] = values[0];
86
- styles[maxStyle] = values[1];
87
- } else if (values.length === 3) {
88
- styles[minStyle] = values[0];
89
- styles[name] = values[1];
90
- styles[maxStyle] = values[2];
91
- } else styles[name] = values[0] || "auto";
92
- if (styles[name] === "stretch") if (name === "width") styles[name] = [
93
- "stretch",
94
- "-webkit-fill-available",
95
- "-moz-available"
96
- ];
97
- else styles[name] = "auto";
98
- }
99
- const minVal = parseDimensionValue(min);
100
- const maxVal = parseDimensionValue(max);
101
- if (minVal) styles[minStyle] = minVal;
102
- if (maxVal) styles[maxStyle] = maxVal;
103
- return styles;
104
- };
105
- }
106
- //#endregion
107
- export { dimensionStyle };
108
-
109
- //# sourceMappingURL=dimension.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dimension.js","names":[],"sources":["../../src/styles/dimension.ts"],"sourcesContent":["import { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport { makeEmptyDetails } from '../parser/types';\nimport { parseStyle } from '../utils/styles';\n\nconst DEFAULT_MIN_SIZE = 'var(--gap)';\nconst DEFAULT_MAX_SIZE = '100%';\n\n/**\n * Parse a dimension value (string, number, or boolean) into a CSS value\n */\nfunction parseDimensionValue(\n val: string | number | boolean | undefined,\n): string | null {\n if (val == null) return null;\n if (typeof val === 'number') return `${val}px`;\n if (val === true) return 'initial';\n\n const processed = parseStyle(String(val));\n return processed.groups[0]?.values[0] || null;\n}\n\ninterface DimensionProps {\n value?: string | number | boolean;\n min?: string | number | boolean;\n max?: string | number | boolean;\n}\n\n/**\n * Creates a dimension style handler for width or height.\n *\n * Supports:\n * - Main dimension prop (width/height) with syntax for min/max\n * - Separate min/max props (minWidth/maxWidth or minHeight/maxHeight)\n *\n * Priority: Individual min/max props override values from main prop syntax\n */\nexport function dimensionStyle(name: 'width' | 'height') {\n const minStyle = `min-${name}`;\n const maxStyle = `max-${name}`;\n\n return ({ value, min, max }: DimensionProps) => {\n if (value == null && min == null && max == null) return null;\n\n if (\n value != null &&\n typeof value === 'string' &&\n CSS_WIDE_KEYWORDS.has(value)\n ) {\n const styles: Record<string, string> = {\n [name]: value,\n [minStyle]: value,\n [maxStyle]: value,\n };\n\n const minVal = parseDimensionValue(min);\n const maxVal = parseDimensionValue(max);\n if (minVal) styles[minStyle] = minVal;\n if (maxVal) styles[maxStyle] = maxVal;\n\n return styles;\n }\n\n if (value === true) {\n const styles: Record<string, string | string[]> = {\n [name]: 'auto',\n [minStyle]: 'initial',\n [maxStyle]: 'initial',\n };\n\n // Apply individual min/max overrides\n const minVal = parseDimensionValue(min);\n const maxVal = parseDimensionValue(max);\n if (minVal) styles[minStyle] = minVal;\n if (maxVal) styles[maxStyle] = maxVal;\n\n return styles;\n }\n\n const styles: Record<string, string | string[]> = {\n [name]: 'auto',\n [minStyle]: 'initial',\n [maxStyle]: 'initial',\n };\n\n // Process main dimension value\n if (value != null) {\n let val = value;\n if (typeof val === 'number') {\n val = `${val}px`;\n }\n\n val = String(val);\n\n const processed = parseStyle(val);\n const { mods, values } = processed.groups[0] ?? makeEmptyDetails();\n\n let flag = false;\n\n for (const mod of mods) {\n switch (mod) {\n case 'min':\n styles[minStyle] = values[0] || DEFAULT_MIN_SIZE;\n flag = true;\n break;\n case 'max':\n styles[maxStyle] = values[0] || DEFAULT_MAX_SIZE;\n flag = true;\n break;\n case 'fixed': {\n // Fixed modifier: set all three dimensions to the same value\n const fixedValue = values[0] || 'max-content';\n styles[minStyle] = fixedValue;\n styles[name] = fixedValue;\n styles[maxStyle] = fixedValue;\n flag = true;\n break;\n }\n default:\n break;\n }\n }\n\n if (!flag || !mods.length) {\n if (values.length === 2) {\n styles[minStyle] = values[0];\n styles[maxStyle] = values[1];\n } else if (values.length === 3) {\n styles[minStyle] = values[0];\n styles[name] = values[1];\n styles[maxStyle] = values[2];\n } else {\n styles[name] = values[0] || 'auto';\n }\n }\n\n if (styles[name] === 'stretch') {\n if (name === 'width') {\n styles[name] = [\n 'stretch',\n '-webkit-fill-available',\n '-moz-available',\n ];\n } else {\n styles[name] = 'auto';\n }\n }\n }\n\n // Apply individual min/max props (higher priority, override main prop syntax)\n const minVal = parseDimensionValue(min);\n const maxVal = parseD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AI,CACE,OAAO,MAAM,kBAAkB;GAElE,IAAI,OAAO;AAEX,QAAK,MAAM,OAAO,KAChB,SAAQ,KAAR;IACE,KAAK;AACH,YAAO,YAAY,OAAO,MAAM;AAChC,YAAO;AACP;IACF,KAAK;AACH,YAAO,YAAY,OAAO,MAAM;AAChC,YAAO;AACP;IACF,KAAK,SAAS;KAEZ,MAAM,aAAa,OAAO,MAAM;AAChC,YAAO,YAAY;AACnB,YAAO,QAAQ;AACf,YAAO,YAAY;AACnB,YAAO;AACP;;IAEF,QACE;;AAIN,OAAI,CAAC,QAAQ,CAAC,KAAK,OACjB,KAAI,OAAO,WAAW,GAAG;AACvB,WAAO,YAAY,OAAO;AAC1B,WAAO,YAAY,OAAO;cACjB,OAAO,WAAW,GAAG;AAC9B,WAAO,YAAY,OAAO;AAC1B,WAAO,QAAQ,OAAO;AACtB,WAAO,YAAY,OAAO;SAE1B,QAAO,QAAQ,OAAO,MAAM;AAIhC,OAAI,OAAO,UAAU,UACnB,KAAI,SAAS,QACX,QAAO,QAAQ;IACb;IACA;IACA;IACD;OAED,QAAO,QAAQ;;EAMrB,MAAM,SAAS,oBAAoB,IAAI;EACvC,MAAM,SAAS,oBAAoB,IAAI;AACvC,MAAI,OAAQ,QAAO,YAAY;AAC/B,MAAI,OAAQ,QAAO,YAAY;AAE/B,SAAO"}
@@ -1,133 +0,0 @@
1
- import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
2
- import { DIRECTIONS, filterMods, parseStyle } from "../utils/styles.js";
3
- import { extractCSSWideKeyword } from "./shared.js";
4
- //#region src/styles/directional.ts
5
- function parseSingleValue(val, defaultValue, trueValue) {
6
- if (typeof val === "number") return `${val}px`;
7
- if (!val) return null;
8
- if (val === true) val = trueValue;
9
- const strVal = String(val);
10
- if (CSS_WIDE_KEYWORDS.has(strVal)) return strVal;
11
- const { values } = parseStyle(strVal).groups[0] ?? { values: [] };
12
- return values[0] || defaultValue;
13
- }
14
- function extractGroupData(group, defaultValue) {
15
- const { values = [], mods = [] } = group;
16
- return {
17
- values: values.length ? values : [defaultValue],
18
- directions: filterMods(mods, DIRECTIONS)
19
- };
20
- }
21
- function applyGroup(dirs, values, directions) {
22
- if (!values.length) return;
23
- if (directions.length === 0) {
24
- dirs.top = values[0];
25
- dirs.right = values[1] || values[0];
26
- dirs.bottom = values[2] || values[0];
27
- dirs.left = values[3] || values[1] || values[0];
28
- } else directions.forEach((dir, i) => {
29
- dirs[dir] = values[i] ?? values[0];
30
- });
31
- }
32
- function optimizeShorthand(property, dirs) {
33
- const { top, right, bottom, left } = dirs;
34
- if (top === right && right === bottom && bottom === left) return { [property]: top };
35
- if (top === bottom && left === right) return { [property]: `${top} ${left}` };
36
- return { [property]: `${top} ${right} ${bottom} ${left}` };
37
- }
38
- /**
39
- * Core directional style logic shared by padding, margin, inset, scrollMargin.
40
- */
41
- function processDirectionalStyle(config, props) {
42
- const { main, block, inline, top, right, bottom, left } = props;
43
- if (main == null && block == null && inline == null && top == null && right == null && bottom == null && left == null) return null;
44
- const { property, defaultValue, trueValue, defaultInit, individualOnly, directionProperty } = config;
45
- const dirProp = directionProperty ?? ((dir) => `${property}-${dir}`);
46
- if (individualOnly) {
47
- if (main == null && block == null && inline == null) {
48
- const result = {};
49
- if (top != null) {
50
- const val = parseSingleValue(top, defaultValue, trueValue);
51
- if (val) result[dirProp("top")] = val;
52
- }
53
- if (right != null) {
54
- const val = parseSingleValue(right, defaultValue, trueValue);
55
- if (val) result[dirProp("right")] = val;
56
- }
57
- if (bottom != null) {
58
- const val = parseSingleValue(bottom, defaultValue, trueValue);
59
- if (val) result[dirProp("bottom")] = val;
60
- }
61
- if (left != null) {
62
- const val = parseSingleValue(left, defaultValue, trueValue);
63
- if (val) result[dirProp("left")] = val;
64
- }
65
- return Object.keys(result).length > 0 ? result : null;
66
- }
67
- }
68
- const dirs = {
69
- top: defaultInit,
70
- right: defaultInit,
71
- bottom: defaultInit,
72
- left: defaultInit
73
- };
74
- let useLonghand = false;
75
- if (main != null) if (typeof main === "number") dirs.top = dirs.right = dirs.bottom = dirs.left = `${main}px`;
76
- else {
77
- const strMain = main === true ? trueValue : String(main);
78
- if (strMain) {
79
- const keyword = CSS_WIDE_KEYWORDS.has(strMain) ? strMain : null;
80
- if (keyword) dirs.top = dirs.right = dirs.bottom = dirs.left = keyword;
81
- else {
82
- const groups = parseStyle(strMain).groups ?? [];
83
- for (const group of groups) {
84
- if (group.mods.includes("longhand")) useLonghand = true;
85
- const kw = extractCSSWideKeyword(group);
86
- if (kw) {
87
- const groupDirs = filterMods(group.mods, DIRECTIONS);
88
- if (groupDirs.length === 0) dirs.top = dirs.right = dirs.bottom = dirs.left = kw;
89
- else for (const dir of groupDirs) dirs[dir] = kw;
90
- } else {
91
- const { values, directions } = extractGroupData(group, defaultValue);
92
- applyGroup(dirs, values, directions);
93
- }
94
- }
95
- }
96
- }
97
- }
98
- if (block != null) {
99
- const val = parseSingleValue(block, defaultValue, trueValue);
100
- if (val) dirs.top = dirs.bottom = val;
101
- }
102
- if (inline != null) {
103
- const val = parseSingleValue(inline, defaultValue, trueValue);
104
- if (val) dirs.left = dirs.right = val;
105
- }
106
- if (top != null) {
107
- const val = parseSingleValue(top, defaultValue, trueValue);
108
- if (val) dirs.top = val;
109
- }
110
- if (right != null) {
111
- const val = parseSingleValue(right, defaultValue, trueValue);
112
- if (val) dirs.right = val;
113
- }
114
- if (bottom != null) {
115
- const val = parseSingleValue(bottom, defaultValue, trueValue);
116
- if (val) dirs.bottom = val;
117
- }
118
- if (left != null) {
119
- const val = parseSingleValue(left, defaultValue, trueValue);
120
- if (val) dirs.left = val;
121
- }
122
- if (useLonghand) return {
123
- [dirProp("top")]: dirs.top,
124
- [dirProp("right")]: dirs.right,
125
- [dirProp("bottom")]: dirs.bottom,
126
- [dirProp("left")]: dirs.left
127
- };
128
- return optimizeShorthand(property, dirs);
129
- }
130
- //#endregion
131
- export { processDirectionalStyle };
132
-
133
- //# sourceMappingURL=directional.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"directional.js","names":[],"sources":["../../src/styles/directional.ts"],"sourcesContent":["import type { StyleDetails } from '../parser/types';\nimport { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport { DIRECTIONS, filterMods, parseStyle } from '../utils/styles';\nimport { extractCSSWideKeyword } from './shared';\n\ntype Direction = (typeof DIRECTIONS)[number];\n\nexport interface DirectionalConfig {\n /** CSS property name (e.g. 'padding', 'margin', 'inset', 'scroll-margin') */\n property: string;\n /** Default value when parsing yields empty (e.g. 'var(--gap)', '0') */\n defaultValue: string;\n /** Value used when the prop is `true` (e.g. '1x', '0') */\n trueValue: string;\n /** Default per-direction init value (e.g. '0', 'auto') */\n defaultInit: string;\n /**\n * When true, if only individual direction props are set (no shorthand,\n * no block/inline), output individual CSS properties instead of the\n * shorthand. Needed by inset for correct CSS cascade with modifiers.\n */\n individualOnly?: boolean;\n /**\n * Maps individual direction CSS property names. Defaults to\n * `${property}-top`, `${property}-right`, etc. For inset this is\n * `top`, `right`, `bottom`, `left`.\n */\n directionProperty?: (dir: Direction) => string;\n}\n\nexport function parseSingleValue(\n val: string | number | boolean,\n defaultValue: string,\n trueValue: string,\n): string | null {\n if (typeof val === 'number') return `${val}px`;\n if (!val) return null;\n if (val === true) val = trueValue;\n\n const strVal = String(val);\n\n if (CSS_WIDE_KEYWORDS.has(strVal)) return strVal;\n\n const { values } = parseStyle(strVal).groups[0] ?? { values: [] };\n\n return values[0] || defaultValue;\n}\n\nfunction extractGroupData(\n group: StyleDetails,\n defaultValue: string,\n): {\n values: string[];\n directions: Direction[];\n} {\n const { values = [], mods = [] } = group;\n\n return {\n values: values.length ? values : [defaultValue],\n directions: filterMods(mods, DIRECTIONS) as Direction[],\n };\n}\n\nfunction applyGroup(\n dirs: Record<Direction, string>,\n values: string[],\n directions: Direction[],\n): void {\n if (!values.length) return;\n\n if (directions.length === 0) {\n dirs.top = values[0];\n dirs.right = values[1] || values[0];\n dirs.bottom = values[2] || values[0];\n dirs.left = values[3] || values[1] || values[0];\n } else {\n directions.forEach((dir, i) => {\n dirs[dir] = values[i] ?? values[0];\n });\n }\n}\n\nfunction optimizeShorthand(\n property: string,\n dirs: Record<Direction, string>,\n): Record<string, string> {\n const { top, right, bottom, left } = dirs;\n\n if (top === right && right === bottom && bottom === left) {\n return { [property]: top };\n }\n if (top === bottom && left === right) {\n return { [property]: `${top} ${left}` };\n }\n\n return { [property]: `${top} ${right} ${bottom} ${left}` };\n}\n\nexport interface DirectionalProps {\n main?: string | number | boolean;\n block?: string | number | boolean;\n inline?: string | number | boolean;\n top?: string | number | boolean;\n right?: string | number | boolean;\n bottom?: string | number | boolean;\n left?: string | number | boolean;\n}\n\n/**\n * Core directional style logic shared by padding, margin, inset, scrollMargin.\n */\nexport function processDirectionalStyle(\n config: DirectionalConfig,\n props: DirectionalProps,\n): Record<string, string> | null {\n const { main, block, inline, top, right, bottom, left } = props;\n\n if (\n main == null &&\n block == null &&\n inline == null &&\n top == null &&\n right == null &&\n bottom == null &&\n left == null\n ) {\n return null;\n }\n\n const {\n property,\n defaultValue,\n trueValue,\n defaultInit,\n individualOnly,\n directionProperty,\n } = config;\n const dirProp =\n directionProperty ?? ((dir: Direction) => `${property}-${dir}`);\n\n if (individualOnly) {\n const onlyIndividualProps = main == null && block == null && inline == null;\n\n if (onlyIndividualProps) {\n const result: Record<string, string> = {};\n\n if (top != null) {\n const val = parseSingleValue(top, defaultValue, trueValue);\n if (val) result[dirProp('top')] = val;\n }\n if (right != null) {\n const val = parseSingleValue(right, defaultValue, trueValue);\n if (val) result[dirProp('right')] = val;\n }\n if (bottom != null) {\n const val = parseSingleValue(bottom, defaultValue, trueValue);\n if (val) result[dirProp('bottom')] = val;\n }\n if (left != null) {\n const val = parseSingleValue(left, defaultValue, trueValue);\n if (val) result[dirProp('left')] = val;\n }\n\n return Object.keys(result).length > 0 ? result : null;\n }\n }\n\n const dirs: Record<Direction, string> = {\n top: defaultInit,\n right: defaultInit,\n bottom: defaultInit,\n left: defaultInit,\n };\n\n let useLonghand = false;\n\n if (main != null) {\n if (typeof main === 'number') {\n const v = `${main}px`;\n dirs.top = dirs.right = dirs.bottom = dirs.left = v;\n } else {\n const strMain = main === true ? trueValue : String(main);\n\n if (strMain) {\n const keyword = CSS_WIDE_KEYWORDS.has(strMain) ? strMain : null;\n\n if (keyword) {\n dirs.top = dirs.right = dirs.bottom = dirs.left = keyword;\n } else {\n const processed = parseStyle(strMain);\n const groups = processed.groups ?? [];\n\n for (const group of groups) {\n if (group.mods.includes('longhand')) {\n useLonghand = true;\n }\n\n const kw = extractCSSWideKeyword(group);\n\n if (kw) {\n const groupDirs = filterMods(\n group.mods,\n DIRECTIONS,\n ) as Direction[];\n\n if (groupDirs.length === 0) {\n dirs.top = dirs.right = dirs.bottom = dirs.left = kw;\n } else {\n for (const dir of groupDirs) {\n dirs[dir] = kw;\n }\n }\n } else {\n const { values, directions } = extractGroupData(\n group,\n defaultValue,\n );\n applyGroup(dirs, values, directions);\n }\n }\n }\n }\n }\n }\n\n if (block != null) {\n const val = parseSingleValue(block, defaultValue, trueValue);\n if (val) dirs.top = dirs.bottom = val;\n }\n if (inline != null) {\n const val = parseSingleValue(inline, defaultValue, trueValue);\n if (val) dirs.left = dirs.right = val;\n }\n\n if (top != null) {\n const val = parseSingleValue(top, defaultValue, trueValue);\n if (val) dirs.top = val;\n }\n if (right != null) {\n const val = parseSingleValue(right, defaultValue, trueValue);\n if (val) dirs.right = val;\n }\n if (bottom != null) {\n const val = parseSingleValue(bottom, defaultValue, trueValue);\n if (val) dirs.bottom = val;\n }\n if (left != null) {\n const val = parseSingleValue(left, defaultValue, trueValue);\n if (val) dirs.left = val;\n }\n\n if (useLonghand) {\n return {\n [dirProp('top')]: dirs.top,\n [dirProp('right')]: dirs.right,\n [dirProp('bottom')]: dirs.bottom,\n [dirProp('left')]: dirs.left,\n };\n }\n\n return optimizeShorthand(property, dirs);\n}\n"],"mappings":";;;;AA8BA,SAAgB,iBACd,KACA,cACA,WACe;AACf,KAAI,OA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leProps {
3
- display?: string;
4
- hide?: boolean;
5
- textOverflow?: string | boolean;
6
- overflow?: string;
7
- whiteSpace?: string;
8
- }
9
- /**
10
- * Handles display, hide, textOverflow, overflow, and whiteSpace styles.
11
- *
12
- * Priority:
13
- * 1. `hide` takes precedence (display: none)
14
- * 2. Multi-line `textOverflow` forces display: -webkit-box
15
- * 3. Single-line `textOverflow` defaults white-space to nowrap
16
- * 4. Explicit `whiteSpace` overrides the default from `textOverflow`
17
- */
18
- declare function displayStyle({
19
- display,
20
- hide,
21
- textOverflow,
22
- overflow,
23
- whiteSpace
24
- }: DisplayStyleProps): Record<string, string | number> | null;
25
- declare namespace displayStyle {
26
- var __lookupStyles: string[];
27
- }
28
- //#endregion
29
- export { displayStyle };
30
- //# sourceMappingURL=display.d.ts.map
@@ -1,73 +0,0 @@
1
- import { parseStyle } from "../utils/styles.js";
2
- //#region src/styles/display.ts
3
- /**
4
- * Process textOverflow into CSS properties for truncation/clamping.
5
- *
6
- * - `ellipsis` — single-line truncation with ellipsis
7
- * - `ellipsis / 3` — multi-line clamping (3 lines) with ellipsis
8
- * - `clip` — single-line truncation with clip
9
- * - `clip / 2` — multi-line clip (2 lines)
10
- * - `true` or `initial` — reset to initial
11
- */
12
- function processTextOverflow(textOverflow, whiteSpace) {
13
- if (textOverflow === true || textOverflow === "initial") return { "text-overflow": "initial" };
14
- const group = parseStyle(String(textOverflow)).groups[0];
15
- if (!group) return null;
16
- const { parts } = group;
17
- const modePart = parts[0];
18
- const clampPart = parts[1];
19
- const hasEllipsis = modePart?.mods.includes("ellipsis");
20
- const hasClip = modePart?.mods.includes("clip");
21
- if (!hasEllipsis && !hasClip) return null;
22
- let clamp = 1;
23
- if (clampPart?.values[0]) {
24
- const parsed = parseInt(clampPart.values[0], 10);
25
- if (!isNaN(parsed) && parsed > 0) clamp = parsed;
26
- }
27
- const result = {
28
- overflow: "hidden",
29
- "text-overflow": hasEllipsis ? "ellipsis" : "clip"
30
- };
31
- if (clamp === 1) result["white-space"] = whiteSpace || "nowrap";
32
- else {
33
- result["display"] = "-webkit-box";
34
- result["-webkit-box-orient"] = "vertical";
35
- result["-webkit-line-clamp"] = clamp;
36
- result["line-clamp"] = clamp;
37
- result["white-space"] = whiteSpace || "initial";
38
- }
39
- return result;
40
- }
41
- /**
42
- * Handles display, hide, textOverflow, overflow, and whiteSpace styles.
43
- *
44
- * Priority:
45
- * 1. `hide` takes precedence (display: none)
46
- * 2. Multi-line `textOverflow` forces display: -webkit-box
47
- * 3. Single-line `textOverflow` defaults white-space to nowrap
48
- * 4. Explicit `whiteSpace` overrides the default from `textOverflow`
49
- */
50
- function displayStyle({ display, hide, textOverflow, overflow, whiteSpace }) {
51
- const result = {};
52
- if (textOverflow != null && textOverflow !== false) {
53
- const textResult = processTextOverflow(textOverflow, whiteSpace);
54
- if (textResult) Object.assign(result, textResult);
55
- }
56
- if (overflow && !result["overflow"]) result["overflow"] = overflow;
57
- if (whiteSpace && !result["white-space"]) result["white-space"] = whiteSpace;
58
- if (hide) result["display"] = "none";
59
- else if (!result["display"] && display) result["display"] = display;
60
- if (Object.keys(result).length === 0) return null;
61
- return result;
62
- }
63
- displayStyle.__lookupStyles = [
64
- "display",
65
- "hide",
66
- "textOverflow",
67
- "overflow",
68
- "whiteSpace"
69
- ];
70
- //#endregion
71
- export { displayStyle };
72
-
73
- //# sourceMappingURL=display.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"display.js","names":[],"sources":["../../src/styles/display.ts"],"sourcesContent":["import { parseStyle } from '../utils/styles';\n\ninterface DisplayStyleProps {\n display?: string;\n hide?: boolean;\n textOverflow?: string | boolean;\n overflow?: string;\n whiteSpace?: string;\n}\n\n/**\n * Process textOverflow into CSS properties for truncation/clamping.\n *\n * - `ellipsis` — single-line truncation with ellipsis\n * - `ellipsis / 3` — multi-line clamping (3 lines) with ellipsis\n * - `clip` — single-line truncation with clip\n * - `clip / 2` — multi-line clip (2 lines)\n * - `true` or `initial` — reset to initial\n */\nfunction processTextOverflow(\n textOverflow: string | boolean,\n whiteSpace?: string,\n): Record<string, string | number> | null {\n if (textOverflow === true || textOverflow === 'initial') {\n return { 'text-overflow': 'initial' };\n }\n\n const processed = parseStyle(String(textOverflow));\n const group = processed.groups[0];\n\n if (!group) return null;\n\n const { parts } = group;\n const modePart = parts[0];\n const clampPart = parts[1];\n\n const hasEllipsis = modePart?.mods.includes('ellipsis');\n const hasClip = modePart?.mods.includes('clip');\n\n if (!hasEllipsis && !hasClip) return null;\n\n let clamp = 1;\n\n if (clampPart?.values[0]) {\n const parsed = parseInt(clampPart.values[0], 10);\n\n if (!isNaN(parsed) && parsed > 0) {\n clamp = parsed;\n }\n }\n\n const result: Record<string, string | number> = {\n overflow: 'hidden',\n 'text-overflow': hasEllipsis ? 'ellipsis' : 'clip',\n };\n\n if (clamp === 1) {\n result['white-space'] = whiteSpace || 'nowrap';\n } else {\n result['display'] = '-webkit-box';\n result['-webkit-box-orient'] = 'vertical';\n result['-webkit-line-clamp'] = clamp;\n result['line-clamp'] = clamp;\n result['white-space'] = whiteSpace || 'initial';\n }\n\n return result;\n}\n\n/**\n * Handles display, hide, textOverflow, overflow, and whiteSpace styles.\n *\n * Priority:\n * 1. `hide` takes precedence (display: none)\n * 2. Multi-line `textOverflow` forces display: -webkit-box\n * 3. Single-line `textOverflow` defaults white-space to nowrap\n * 4. Explicit `whiteSpace` overrides the default from `textOverflow`\n */\nexport function displayStyle({\n display,\n hide,\n textOverflow,\n overflow,\n whiteSpace,\n}: DisplayStyleProps) {\n const result: Record<string, string | number> = {};\n\n if (textOverflow != null && textOverflow !== false) {\n const textResult = processTextOverflow(textOverflow, whiteSpace);\n\n if (textResult) Object.assign(result, textResult);\n }\n\n if (overflow && !result['overflow']) {\n result['overflow'] = overflow;\n }\n if (whiteSpace && !result['white-space']) {\n result['white-space'] = whiteSpace;\n }\n\n if (hide) {\n result['display'] = 'none';\n } else if (!result['display'] && display) {\n result['display'] = display;\n }\n\n if (Object.keys(result).length === 0) {\n return null;\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F,QAAO,aAAa;UACX,CAAC,OAAO,cAAc,QAC/B,QAAO,aAAa;AAGtB,KAAI,OAAO,KAAK,OAAO,CAAC,WAAW,EACjC,QAAO;AAGT,QAAO;;AAGT,aAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACD"}
@@ -1,15 +0,0 @@
1
- //#region src/styles/fade.d.ts
2
- declare function fadeStyle({
3
- fade
4
- }: {
5
- fade?: string;
6
- }): {
7
- mask: string;
8
- 'mask-composite': string;
9
- } | null;
10
- declare namespace fadeStyle {
11
- var __lookupStyles: string[];
12
- }
13
- //#endregion
14
- export { fadeStyle };
15
- //# sourceMappingURL=fade.d.ts.map
@@ -1,62 +0,0 @@
1
- import { CSS_WIDE_KEYWORDS } from "../parser/const.js";
2
- import { DIRECTIONS, filterMods, parseStyle } from "../utils/styles.js";
3
- //#region src/styles/fade.ts
4
- const DIRECTION_MAP = {
5
- right: "to left",
6
- left: "to right",
7
- top: "to bottom",
8
- bottom: "to top"
9
- };
10
- const DEFAULT_TRANSPARENT_COLOR = "rgb(0 0 0 / 0)";
11
- const DEFAULT_OPAQUE_COLOR = "rgb(0 0 0 / 1)";
12
- /**
13
- * Process a single group and return gradient strings for its directions.
14
- */
15
- function processGroup(group, isOnlyGroup) {
16
- let { values } = group;
17
- const { mods, colors } = group;
18
- let directions = filterMods(mods, DIRECTIONS);
19
- if (!values.length) values = ["calc(2 * var(--gap))"];
20
- if (!directions.length) if (isOnlyGroup) directions = [
21
- "top",
22
- "right",
23
- "bottom",
24
- "left"
25
- ];
26
- else return [];
27
- const transparentColor = colors?.[0] || DEFAULT_TRANSPARENT_COLOR;
28
- const opaqueColor = colors?.[1] || DEFAULT_OPAQUE_COLOR;
29
- return directions.map((direction, index) => {
30
- const size = values[index] || values[index % 2] || values[0];
31
- return `linear-gradient(${DIRECTION_MAP[direction]}, ${transparentColor} 0%, ${opaqueColor} ${size})`;
32
- });
33
- }
34
- function fadeStyle({ fade }) {
35
- if (!fade) return null;
36
- if (CSS_WIDE_KEYWORDS.has(fade)) return {
37
- mask: fade,
38
- "mask-composite": fade
39
- };
40
- const groups = parseStyle(fade).groups ?? [];
41
- if (!groups.length) return null;
42
- const isOnlyGroup = groups.length === 1;
43
- const gradients = [];
44
- for (const group of groups) {
45
- const groupGradients = processGroup({
46
- values: group.values ?? [],
47
- mods: group.mods ?? [],
48
- colors: group.colors ?? []
49
- }, isOnlyGroup);
50
- gradients.push(...groupGradients);
51
- }
52
- if (!gradients.length) return null;
53
- return {
54
- mask: gradients.join(", "),
55
- "mask-composite": "intersect"
56
- };
57
- }
58
- fadeStyle.__lookupStyles = ["fade"];
59
- //#endregion
60
- export { fadeStyle };
61
-
62
- //# sourceMappingURL=fade.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fade.js","names":[],"sources":["../../src/styles/fade.ts"],"sourcesContent":["import { CSS_WIDE_KEYWORDS } from '../parser/const';\nimport { DIRECTIONS, filterMods, parseStyle } from '../utils/styles';\n\nconst DIRECTION_MAP: Record<(typeof DIRECTIONS)[number], string> = {\n right: 'to left',\n left: 'to right',\n top: 'to bottom',\n bottom: 'to top',\n};\n\n// Default mask colors (standard black with alpha for gradient masks)\nconst DEFAULT_TRANSPARENT_COLOR = 'rgb(0 0 0 / 0)';\nconst DEFAULT_OPAQUE_COLOR = 'rgb(0 0 0 / 1)';\n\ninterface GroupData {\n values: string[];\n mods: string[];\n colors: string[];\n}\n\n/**\n * Process a single group and return gradient strings for its directions.\n */\nfunction processGroup(group: GroupData, isOnlyGroup: boolean): string[] {\n let { values } = group;\n const { mods, colors } = group;\n\n let directions = filterMods(\n mods,\n DIRECTIONS,\n ) as (typeof DIRECTIONS)[number][];\n\n if (!values.length) {\n values = ['calc(2 * var(--gap))'];\n }\n\n // If this is the only group and no directions specified, apply to all edges\n if (!directions.length) {\n if (isOnlyGroup) {\n directions = ['top', 'right', 'bottom', 'left'];\n } else {\n // For multi-group without explicit direction, skip this group\n return [];\n }\n }\n\n // Extract colors: first = transparent mask color, second = opaque mask color\n const transparentColor = colors?.[0] || DEFAULT_TRANSPARENT_COLOR;\n const opaqueColor = colors?.[1] || DEFAULT_OPAQUE_COLOR;\n\n return directions.map(\n (direction: (typeof DIRECTIONS)[number], index: number) => {\n const size = values[index] || values[index % 2] || values[0];\n\n return `linear-gradient(${DIRECTION_MAP[direction]}, ${transparentColor} 0%, ${opaqueColor} ${size})`;\n },\n );\n}\n\nexport function fadeStyle({ fade }: { fade?: string }) {\n if (!fade) return null;\n\n if (CSS_WIDE_KEYWORDS.has(fade)) {\n return { mask: fade, 'mask-composite': fade };\n }\n\n const processed = parseStyle(fade);\n const groups: GroupData[] = processed.groups ?? [];\n\n if (!groups.length) return null;\n\n const isOnlyGroup = groups.length === 1;\n\n // Process all groups and collect gradients\n const gradients: string[] = [];\n\n for (const group of groups) {\n const groupGradients = processGroup(\n {\n values: group.values ?? [],\n mods: group.mods ?? [],\n colors: group.colors ?? [],\n },\n isOnlyGroup,\n );\n gradients.push(...groupGradients);\n }\n\n if (!gradients.length) return null;\n\n return {\n mask: gradients.join(', '),\n 'mask-composite': 'intersect',\n };\n}\n\nfadeStyle.__lookupStyles = ['fade'];\n"],"mappings":";;;AAGA,MAAM,gBAA6D;CACjE,OAAO;CACP,MAAM;CACN,KAAK;CACL,QAAQ;CACT;AAGD,MAAM,4BAA4B;AAClC,MAAM,uBAAuB;;;;AAW7B,SAAS,aAAa,OAAkB,aAAgC;CACtE,IAAI,EAAE,WAAW;CACjB,MAAM,EAAE,MAAM,WAAW;CAEzB,IAAI,aAAa,WACf,MACA,WACD;AAED,KAAI,CAAC,OAAO,OACV,UAAS,CAAC,uBAAuB;AAInC,KAAI,CAAC,WAAW,OACd,KAAI,YACF,cAAa;EAAC;EAAO;EAAS;EAAU;EAAO;KAG/C,QAAO,EAAE;CAKb,MAAM,mBAAmB,SAAS,MAAM;CACxC,MAAM,cAAc,SAAS,MAAM;AAEnC,QAAO,WAAW,KACf,WAAwC,UAAkB;EACzD,MAAM,OAAO,O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