theme.css 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. @import 'tailwindcss';
  2. @import 'tw-animate-css';
  3. @plugin '@tailwindcss/typography';
  4. @plugin '@iconify/tailwind4';
  5. /* Monorepo source detection: scan all packages and apps for utility classes */
  6. @source '../../../packages/';
  7. @source '../../../apps/';
  8. @source '../../../docs/';
  9. @source '../../../playground/';
  10. /* Dark mode uses .dark class selector, not prefers-color-scheme */
  11. @custom-variant dark (&:is(.dark *));
  12. /* Explicitly pin Tailwind v4 dynamic spacing for classes like w-150/h-55. */
  13. @theme {
  14. --spacing: 0.25rem;
  15. }
  16. @theme inline {
  17. /* Font */
  18. --font-sans: var(--font-family);
  19. /* Border Radius */
  20. --radius-sm: calc(var(--radius) - 4px);
  21. --radius-md: calc(var(--radius) - 2px);
  22. --radius-lg: var(--radius);
  23. --radius-xl: calc(var(--radius) + 4px);
  24. /* Box Shadow */
  25. --shadow-float:
  26. 0 6px 16px 0 rgb(0 0 0 / 8%), 0 3px 6px -4px rgb(0 0 0 / 12%),
  27. 0 9px 28px 8px rgb(0 0 0 / 5%);
  28. /* Animations */
  29. --animate-accordion-down: accordion-down 0.2s ease-out;
  30. --animate-accordion-up: accordion-up 0.2s ease-out;
  31. --animate-collapsible-down: collapsible-down 0.2s ease-in-out;
  32. --animate-collapsible-up: collapsible-up 0.2s ease-in-out;
  33. --animate-float: float 5s linear 0ms infinite;
  34. /* ===== Semantic Colors (shadcn-ui) ===== */
  35. --color-background: hsl(var(--background));
  36. --color-background-deep: hsl(var(--background-deep));
  37. --color-foreground: hsl(var(--foreground));
  38. --color-card: hsl(var(--card));
  39. --color-card-foreground: hsl(var(--card-foreground));
  40. --color-popover: hsl(var(--popover));
  41. --color-popover-foreground: hsl(var(--popover-foreground));
  42. --color-muted: hsl(var(--muted));
  43. --color-muted-foreground: hsl(var(--muted-foreground));
  44. --color-accent: hsl(var(--accent));
  45. --color-accent-foreground: hsl(var(--accent-foreground));
  46. --color-accent-hover: hsl(var(--accent-hover));
  47. --color-accent-lighter: hsl(var(--accent-lighter));
  48. --color-border: hsl(var(--border));
  49. --color-input: hsl(var(--input));
  50. --color-input-background: hsl(var(--input-background));
  51. --color-ring: hsl(var(--ring));
  52. --color-secondary: hsl(var(--secondary));
  53. --color-secondary-desc: hsl(var(--secondary-desc));
  54. --color-secondary-foreground: hsl(var(--secondary-foreground));
  55. /* ===== Custom Semantic Colors ===== */
  56. --color-header: hsl(var(--header));
  57. --color-heavy: hsl(var(--heavy));
  58. --color-heavy-foreground: hsl(var(--heavy-foreground));
  59. --color-main: hsl(var(--main));
  60. --color-overlay: hsl(var(--overlay));
  61. --color-overlay-content: hsl(var(--overlay-content));
  62. --color-sidebar: hsl(var(--sidebar));
  63. --color-sidebar-deep: hsl(var(--sidebar-deep));
  64. /* ===== Primary Palette ===== */
  65. --color-primary: hsl(var(--primary));
  66. --color-primary-foreground: hsl(var(--primary-foreground));
  67. --color-primary-50: hsl(var(--primary-50));
  68. --color-primary-100: hsl(var(--primary-100));
  69. --color-primary-200: hsl(var(--primary-200));
  70. --color-primary-300: hsl(var(--primary-300));
  71. --color-primary-400: hsl(var(--primary-400));
  72. --color-primary-500: hsl(var(--primary-500));
  73. --color-primary-600: hsl(var(--primary-600));
  74. --color-primary-700: hsl(var(--primary-700));
  75. --color-primary-active: hsl(var(--primary-700));
  76. --color-primary-background-light: hsl(var(--primary-200));
  77. --color-primary-background-lighter: hsl(var(--primary-100));
  78. --color-primary-background-lightest: hsl(var(--primary-50));
  79. --color-primary-border: hsl(var(--primary-400));
  80. --color-primary-border-light: hsl(var(--primary-300));
  81. --color-primary-hover: hsl(var(--primary-600));
  82. --color-primary-text: hsl(var(--primary-500));
  83. --color-primary-text-active: hsl(var(--primary-700));
  84. --color-primary-text-hover: hsl(var(--primary-600));
  85. /* ===== Destructive Palette ===== */
  86. --color-destructive: hsl(var(--destructive));
  87. --color-destructive-foreground: hsl(var(--destructive-foreground));
  88. --color-destructive-50: hsl(var(--destructive-50));
  89. --color-destructive-100: hsl(var(--destructive-100));
  90. --color-destructive-200: hsl(var(--destructive-200));
  91. --color-destructive-300: hsl(var(--destructive-300));
  92. --color-destructive-400: hsl(var(--destructive-400));
  93. --color-destructive-500: hsl(var(--destructive-500));
  94. --color-destructive-600: hsl(var(--destructive-600));
  95. --color-destructive-700: hsl(var(--destructive-700));
  96. --color-destructive-active: hsl(var(--destructive-700));
  97. --color-destructive-background-light: hsl(var(--destructive-200));
  98. --color-destructive-background-lighter: hsl(var(--destructive-100));
  99. --color-destructive-background-lightest: hsl(var(--destructive-50));
  100. --color-destructive-border: hsl(var(--destructive-400));
  101. --color-destructive-border-light: hsl(var(--destructive-300));
  102. --color-destructive-hover: hsl(var(--destructive-600));
  103. --color-destructive-text: hsl(var(--destructive-500));
  104. --color-destructive-text-active: hsl(var(--destructive-700));
  105. --color-destructive-text-hover: hsl(var(--destructive-600));
  106. /* ===== Success Palette ===== */
  107. --color-success: hsl(var(--success));
  108. --color-success-foreground: hsl(var(--success-foreground));
  109. --color-success-50: hsl(var(--success-50));
  110. --color-success-100: hsl(var(--success-100));
  111. --color-success-200: hsl(var(--success-200));
  112. --color-success-300: hsl(var(--success-300));
  113. --color-success-400: hsl(var(--success-400));
  114. --color-success-500: hsl(var(--success-500));
  115. --color-success-600: hsl(var(--success-600));
  116. --color-success-700: hsl(var(--success-700));
  117. --color-success-active: hsl(var(--success-700));
  118. --color-success-background-light: hsl(var(--success-200));
  119. --color-success-background-lighter: hsl(var(--success-100));
  120. --color-success-background-lightest: hsl(var(--success-50));
  121. --color-success-border: hsl(var(--success-400));
  122. --color-success-border-light: hsl(var(--success-300));
  123. --color-success-hover: hsl(var(--success-600));
  124. --color-success-text: hsl(var(--success-500));
  125. --color-success-text-active: hsl(var(--success-700));
  126. --color-success-text-hover: hsl(var(--success-600));
  127. /* ===== Warning Palette ===== */
  128. --color-warning: hsl(var(--warning));
  129. --color-warning-foreground: hsl(var(--warning-foreground));
  130. --color-warning-50: hsl(var(--warning-50));
  131. --color-warning-100: hsl(var(--warning-100));
  132. --color-warning-200: hsl(var(--warning-200));
  133. --color-warning-300: hsl(var(--warning-300));
  134. --color-warning-400: hsl(var(--warning-400));
  135. --color-warning-500: hsl(var(--warning-500));
  136. --color-warning-600: hsl(var(--warning-600));
  137. --color-warning-700: hsl(var(--warning-700));
  138. --color-warning-active: hsl(var(--warning-700));
  139. --color-warning-background-light: hsl(var(--warning-200));
  140. --color-warning-background-lighter: hsl(var(--warning-100));
  141. --color-warning-background-lightest: hsl(var(--warning-50));
  142. --color-warning-border: hsl(var(--warning-400));
  143. --color-warning-border-light: hsl(var(--warning-300));
  144. --color-warning-hover: hsl(var(--warning-600));
  145. --color-warning-text: hsl(var(--warning-500));
  146. --color-warning-text-active: hsl(var(--warning-700));
  147. --color-warning-text-hover: hsl(var(--warning-600));
  148. /* ===== Green Palette (alias for success shades) ===== */
  149. --color-green-50: hsl(var(--green-50));
  150. --color-green-100: hsl(var(--green-100));
  151. --color-green-200: hsl(var(--green-200));
  152. --color-green-300: hsl(var(--green-300));
  153. --color-green-400: hsl(var(--green-400));
  154. --color-green-500: hsl(var(--green-500));
  155. --color-green-600: hsl(var(--green-600));
  156. --color-green-700: hsl(var(--green-700));
  157. --color-green-active: hsl(var(--green-700));
  158. --color-green-background-light: hsl(var(--green-200));
  159. --color-green-background-lighter: hsl(var(--green-100));
  160. --color-green-background-lightest: hsl(var(--green-50));
  161. --color-green-border: hsl(var(--green-400));
  162. --color-green-border-light: hsl(var(--green-300));
  163. --color-green-foreground: hsl(var(--success-foreground));
  164. --color-green-hover: hsl(var(--green-600));
  165. --color-green-text: hsl(var(--green-500));
  166. --color-green-text-active: hsl(var(--green-700));
  167. --color-green-text-hover: hsl(var(--green-600));
  168. /* ===== Red Palette (alias for destructive shades) ===== */
  169. --color-red-50: hsl(var(--red-50));
  170. --color-red-100: hsl(var(--red-100));
  171. --color-red-200: hsl(var(--red-200));
  172. --color-red-300: hsl(var(--red-300));
  173. --color-red-400: hsl(var(--red-400));
  174. --color-red-500: hsl(var(--red-500));
  175. --color-red-600: hsl(var(--red-600));
  176. --color-red-700: hsl(var(--red-700));
  177. --color-red-active: hsl(var(--red-700));
  178. --color-red-background-light: hsl(var(--red-200));
  179. --color-red-background-lighter: hsl(var(--red-100));
  180. --color-red-background-lightest: hsl(var(--red-50));
  181. --color-red-border: hsl(var(--red-400));
  182. --color-red-border-light: hsl(var(--red-300));
  183. --color-red-foreground: hsl(var(--destructive-foreground));
  184. --color-red-hover: hsl(var(--red-600));
  185. --color-red-text: hsl(var(--red-500));
  186. --color-red-text-active: hsl(var(--red-700));
  187. --color-red-text-hover: hsl(var(--red-600));
  188. /* ===== Yellow Palette (alias for warning shades) ===== */
  189. --color-yellow-50: hsl(var(--yellow-50));
  190. --color-yellow-100: hsl(var(--yellow-100));
  191. --color-yellow-200: hsl(var(--yellow-200));
  192. --color-yellow-300: hsl(var(--yellow-300));
  193. --color-yellow-400: hsl(var(--yellow-400));
  194. --color-yellow-500: hsl(var(--yellow-500));
  195. --color-yellow-600: hsl(var(--yellow-600));
  196. --color-yellow-700: hsl(var(--yellow-700));
  197. --color-yellow-active: hsl(var(--yellow-700));
  198. --color-yellow-background-light: hsl(var(--yellow-200));
  199. --color-yellow-background-lighter: hsl(var(--yellow-100));
  200. --color-yellow-background-lightest: hsl(var(--yellow-50));
  201. --color-yellow-border: hsl(var(--yellow-400));
  202. --color-yellow-border-light: hsl(var(--yellow-300));
  203. --color-yellow-foreground: hsl(var(--warning-foreground));
  204. --color-yellow-hover: hsl(var(--yellow-600));
  205. --color-yellow-text: hsl(var(--yellow-500));
  206. --color-yellow-text-active: hsl(var(--yellow-700));
  207. --color-yellow-text-hover: hsl(var(--yellow-600));
  208. }
  209. /* Keyframes */
  210. @keyframes accordion-down {
  211. from {
  212. height: 0;
  213. }
  214. to {
  215. height: var(--reka-accordion-content-height);
  216. }
  217. }
  218. @keyframes accordion-up {
  219. from {
  220. height: var(--reka-accordion-content-height);
  221. }
  222. to {
  223. height: 0;
  224. }
  225. }
  226. @keyframes collapsible-down {
  227. from {
  228. height: 0;
  229. }
  230. to {
  231. height: var(--reka-collapsible-content-height);
  232. }
  233. }
  234. @keyframes collapsible-up {
  235. from {
  236. height: var(--reka-collapsible-content-height);
  237. }
  238. to {
  239. height: 0;
  240. }
  241. }
  242. @keyframes float {
  243. 0% {
  244. transform: translateY(0);
  245. }
  246. 50% {
  247. transform: translateY(-20px);
  248. }
  249. 100% {
  250. transform: translateY(0);
  251. }
  252. }
  253. /* Base styles */
  254. @layer base {
  255. *,
  256. ::after,
  257. ::before {
  258. @apply border-border outline-ring/50;
  259. box-sizing: border-box;
  260. border-style: solid;
  261. border-width: 0;
  262. }
  263. html {
  264. @apply text-foreground bg-background font-sans;
  265. scroll-behavior: smooth;
  266. font-size: var(--font-size-base, 16px);
  267. font-variation-settings: normal;
  268. font-synthesis-weight: none;
  269. line-height: 1.15;
  270. text-rendering: optimizelegibility;
  271. text-size-adjust: 100%;
  272. -webkit-tap-highlight-color: transparent;
  273. }
  274. #app,
  275. body,
  276. html {
  277. @apply size-full;
  278. }
  279. body {
  280. min-height: 100vh;
  281. }
  282. a,
  283. a:active,
  284. a:hover,
  285. a:link,
  286. a:visited {
  287. @apply no-underline;
  288. }
  289. ::view-transition-new(root),
  290. ::view-transition-old(root) {
  291. @apply animate-none mix-blend-normal;
  292. }
  293. ::view-transition-old(root) {
  294. @apply z-1;
  295. }
  296. ::view-transition-new(root) {
  297. @apply z-2147483646;
  298. }
  299. html.dark::view-transition-old(root) {
  300. @apply z-2147483646;
  301. }
  302. html.dark::view-transition-new(root) {
  303. @apply z-1;
  304. }
  305. input::placeholder,
  306. textarea::placeholder {
  307. @apply opacity-100;
  308. }
  309. input[type='number']::-webkit-inner-spin-button,
  310. input[type='number']::-webkit-outer-spin-button {
  311. @apply m-0 appearance-none;
  312. }
  313. /* Only adjust scrollbar for non-macOS */
  314. html:not([data-platform='macOs']) {
  315. ::-webkit-scrollbar {
  316. @apply h-2.5 w-2.5;
  317. }
  318. ::-webkit-scrollbar-thumb {
  319. @apply bg-border rounded-sm border-none;
  320. }
  321. ::-webkit-scrollbar-track {
  322. @apply rounded-sm border-none bg-transparent shadow-none;
  323. }
  324. ::-webkit-scrollbar-button {
  325. @apply hidden;
  326. }
  327. }
  328. /* Tailwind v4 Preflight 不再为 button 默认设置 pointer;见官方升级说明:
  329. * https://tailwindcss.com/docs/upgrade-guide#buttons-use-the-default-cursor */
  330. button:not(:disabled),
  331. [role='button']:not(:disabled) {
  332. @apply cursor-pointer;
  333. }
  334. }
  335. /* Custom utilities (v4 @utility syntax) */
  336. @utility flex-center {
  337. display: flex;
  338. align-items: center;
  339. justify-content: center;
  340. }
  341. @utility flex-col-center {
  342. display: flex;
  343. flex-direction: column;
  344. align-items: center;
  345. justify-content: center;
  346. }
  347. /* Tailwind v4 的 utilities 在 @layer 内;组件样式若留在 layer 外,会按层叠规则压过 py-4 等工具类。
  348. * 见:https://tailwindcss.com/docs/adding-custom-styles#using-css-and-layering */
  349. @layer components {
  350. .outline-box {
  351. @apply outline-border relative cursor-pointer rounded-md p-1 outline-1;
  352. }
  353. .outline-box::after {
  354. @apply absolute top-1/2 left-1/2 z-20 h-0 w-px rounded-sm opacity-0 outline-2 outline-transparent transition-all duration-300 content-[""];
  355. }
  356. .outline-box.outline-box-active {
  357. @apply outline-primary outline-2;
  358. }
  359. .outline-box.outline-box-active::after {
  360. display: none;
  361. }
  362. .outline-box:not(.outline-box-active):hover::after {
  363. @apply outline-primary top-0 left-0 h-full w-full p-1 opacity-100;
  364. }
  365. .vben-link {
  366. @apply text-primary hover:text-primary-hover active:text-primary-active cursor-pointer;
  367. }
  368. .card-box {
  369. @apply bg-card text-card-foreground border-border rounded-xl border;
  370. }
  371. }
  372. /* Enter animations (converted from enterAnimationPlugin) */
  373. @keyframes enter-x-animation {
  374. to {
  375. opacity: 1;
  376. transform: translateX(0);
  377. }
  378. }
  379. @keyframes enter-y-animation {
  380. to {
  381. opacity: 1;
  382. transform: translateY(0);
  383. }
  384. }
  385. .enter-x:nth-child(1) {
  386. opacity: 0;
  387. transform: translateX(50px);
  388. animation: enter-x-animation 0.3s ease-in-out 0.1s forwards;
  389. }
  390. .enter-x:nth-child(2) {
  391. opacity: 0;
  392. transform: translateX(50px);
  393. animation: enter-x-animation 0.3s ease-in-out 0.2s forwards;
  394. }
  395. .enter-x:nth-child(3) {
  396. opacity: 0;
  397. transform: translateX(50px);
  398. animation: enter-x-animation 0.3s ease-in-out 0.3s forwards;
  399. }
  400. .enter-x:nth-child(4) {
  401. opacity: 0;
  402. transform: translateX(50px);
  403. animation: enter-x-animation 0.3s ease-in-out 0.4s forwards;
  404. }
  405. .enter-x:nth-child(5) {
  406. opacity: 0;
  407. transform: translateX(50px);
  408. animation: enter-x-animation 0.3s ease-in-out 0.5s forwards;
  409. }
  410. .enter-y:nth-child(1) {
  411. opacity: 0;
  412. transform: translateY(50px);
  413. animation: enter-y-animation 0.3s ease-in-out 0.1s forwards;
  414. }
  415. .enter-y:nth-child(2) {
  416. opacity: 0;
  417. transform: translateY(50px);
  418. animation: enter-y-animation 0.3s ease-in-out 0.2s forwards;
  419. }
  420. .enter-y:nth-child(3) {
  421. opacity: 0;
  422. transform: translateY(50px);
  423. animation: enter-y-animation 0.3s ease-in-out 0.3s forwards;
  424. }
  425. .enter-y:nth-child(4) {
  426. opacity: 0;
  427. transform: translateY(50px);
  428. animation: enter-y-animation 0.3s ease-in-out 0.4s forwards;
  429. }
  430. .enter-y:nth-child(5) {
  431. opacity: 0;
  432. transform: translateY(50px);
  433. animation: enter-y-animation 0.3s ease-in-out 0.5s forwards;
  434. }
  435. .-enter-x:nth-child(1) {
  436. opacity: 0;
  437. transform: translateX(-50px);
  438. animation: enter-x-animation 0.3s ease-in-out 0.1s forwards;
  439. }
  440. .-enter-x:nth-child(2) {
  441. opacity: 0;
  442. transform: translateX(-50px);
  443. animation: enter-x-animation 0.3s ease-in-out 0.2s forwards;
  444. }
  445. .-enter-x:nth-child(3) {
  446. opacity: 0;
  447. transform: translateX(-50px);
  448. animation: enter-x-animation 0.3s ease-in-out 0.3s forwards;
  449. }
  450. .-enter-x:nth-child(4) {
  451. opacity: 0;
  452. transform: translateX(-50px);
  453. animation: enter-x-animation 0.3s ease-in-out 0.4s forwards;
  454. }
  455. .-enter-x:nth-child(5) {
  456. opacity: 0;
  457. transform: translateX(-50px);
  458. animation: enter-x-animation 0.3s ease-in-out 0.5s forwards;
  459. }
  460. .-enter-y:nth-child(1) {
  461. opacity: 0;
  462. transform: translateY(-50px);
  463. animation: enter-y-animation 0.3s ease-in-out 0.1s forwards;
  464. }
  465. .-enter-y:nth-child(2) {
  466. opacity: 0;
  467. transform: translateY(-50px);
  468. animation: enter-y-animation 0.3s ease-in-out 0.2s forwards;
  469. }
  470. .-enter-y:nth-child(3) {
  471. opacity: 0;
  472. transform: translateY(-50px);
  473. animation: enter-y-animation 0.3s ease-in-out 0.3s forwards;
  474. }
  475. .-enter-y:nth-child(4) {
  476. opacity: 0;
  477. transform: translateY(-50px);
  478. animation: enter-y-animation 0.3s ease-in-out 0.4s forwards;
  479. }
  480. .-enter-y:nth-child(5) {
  481. opacity: 0;
  482. transform: translateY(-50px);
  483. animation: enter-y-animation 0.3s ease-in-out 0.5s forwards;
  484. }
  485. html.invert-mode {
  486. @apply invert;
  487. }
  488. html.grayscale-mode {
  489. @apply grayscale;
  490. }