架构 样式拆分为组件级LESS样式,添加全局样式文件

This commit is contained in:
2026-04-18 01:48:43 +08:00
parent 3577e139b9
commit 2d2804ef22
15 changed files with 2329 additions and 1613 deletions

702
src/styles/global.less Normal file
View File

@@ -0,0 +1,702 @@
// Global styles
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--bg-primary: #f8fafc;
--bg-secondary: #ffffff;
--bg-tertiary: #f1f5f9;
--bg-hover: #e2e8f0;
--text-primary: #0f172a;
--text-secondary: #475569;
--text-tertiary: #94a3b8;
--accent: #3b82f6;
--accent-hover: #2563eb;
--accent-light: #eff6ff;
--border: #e2e8f0;
--border-light: #f1f5f9;
--success: #10b981;
--danger: #ef4444;
--radius: 6px;
--radius-lg: 10px;
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateX(-10px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
@keyframes pulse {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.6;
}
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes slideInRight {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
height: 100vh;
overflow: hidden;
user-select: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.dark,
.solarized-dark {
--bg-primary: #1a1a2e;
--bg-secondary: #16213e;
--bg-tertiary: #0f3460;
--bg-hover: #1f4068;
--text-primary: #e4e4e7;
--text-secondary: #a1a1aa;
--text-tertiary: #71717a;
--accent: #60a5fa;
--accent-hover: #3b82f6;
--accent-light: rgba(96, 165, 250, 0.15);
--border: #2d2d44;
--border-light: #232338;
--success: #34d399;
--danger: #f87171;
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}
.solarized-dark {
--bg-primary: #002b36;
--bg-secondary: #073642;
--bg-tertiary: #094856;
--bg-hover: #0a5a6f;
--text-primary: #839496;
--text-secondary: #93a1a1;
--text-tertiary: #586e75;
--accent: #268bd2;
--accent-hover: #1a73c0;
--accent-light: rgba(38, 139, 210, 0.15);
--border: #1d3a47;
--border-light: #0d3a47;
--success: #2aa198;
--danger: #dc322f;
}
// Scrollbar styles
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: transparent;
border-radius: 4px;
}
::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 4px;
transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
background: var(--text-tertiary);
}
::-webkit-scrollbar-corner {
background: transparent;
}
* {
scrollbar-width: thin;
scrollbar-color: var(--border) transparent;
}
// Shared layout styles
.app {
display: flex;
flex-direction: column;
height: 100vh;
}
.main {
display: flex;
flex: 1;
overflow: hidden;
}
.content {
flex: 1;
padding: 28px 32px;
overflow-y: auto;
background: var(--bg-primary);
}
.content section {
animation: fadeIn 0.35s ease;
}
// Content header (shared across all views)
.content-header {
margin-bottom: 24px;
}
.content-title {
font-size: 22px;
font-weight: 600;
margin-bottom: 6px;
letter-spacing: -0.03em;
animation: slideIn 0.3s ease;
color: var(--text-primary);
}
.content-desc {
font-size: 14px;
color: var(--text-tertiary);
animation: fadeIn 0.4s ease 0.1s backwards;
margin-top: 6px;
line-height: 1.5;
}
.content-header {
margin-bottom: 28px;
}
// Card (shared across GeneralSettings and ApiConfig)
.card {
background: var(--bg-secondary);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
padding: 20px 24px;
margin-bottom: 20px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
animation: fadeIn 0.4s ease backwards;
}
.card:last-child {
margin-bottom: 0;
}
.card-title {
font-size: 14px;
font-weight: 600;
letter-spacing: -0.01em;
color: var(--text-primary);
margin-bottom: 14px;
padding-bottom: 12px;
border-bottom: 1px solid var(--border-light);
display: flex;
gap: 5px;
}
.card-title .iconpark-icon {
color: var(--accent);
}
.card:nth-child(1) {
animation-delay: 0.05s;
}
.card:nth-child(2) {
animation-delay: 0.1s;
}
.card:hover {
box-shadow: var(--shadow);
transform: translateY(-1px);
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateX(-10px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
// Form styles
.form-group {
margin-bottom: 18px;
}
.form-group:last-child {
margin-bottom: 0;
}
.form-label {
display: block;
font-size: 13px;
font-weight: 500;
margin-bottom: 8px;
color: var(--text-secondary);
letter-spacing: -0.01em;
}
.form-input {
width: 100%;
padding: 10px 14px;
border: 1px solid var(--border);
border-radius: var(--radius);
font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
font-size: 13px;
background: var(--bg-secondary);
color: var(--text-primary);
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
letter-spacing: -0.01em;
}
.form-input:hover {
border-color: var(--text-tertiary);
}
.form-input:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-light);
transform: translateY(-1px);
}
.form-input::placeholder {
color: var(--text-tertiary);
}
.form-row {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20px;
}
.form-select {
width: 100%;
padding: 10px 14px;
border: 1px solid var(--border);
border-radius: var(--radius);
font-family: inherit;
font-size: 13px;
font-weight: 400;
background: var(--bg-secondary);
color: var(--text-primary);
cursor: pointer;
appearance: none;
letter-spacing: -0.01em;
background-repeat: no-repeat;
background-position: right 12px center;
padding-right: 40px;
transition: all 0.2s ease;
position: relative;
}
.form-select:hover {
border-color: var(--text-tertiary);
background-color: var(--bg-tertiary);
}
.form-select:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-light);
}
.form-textarea {
width: 100%;
padding: 10px 14px;
border: 1px solid var(--border);
border-radius: var(--radius);
font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
font-size: 13px;
background: var(--bg-secondary);
color: var(--text-primary);
resize: vertical;
min-height: 80px;
line-height: 1.5;
transition: all 0.2s ease;
}
.form-textarea:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-light);
}
// Icon styles
.iconpark-icon {
display: inline-flex;
align-items: center;
justify-content: center;
vertical-align: -0.125em;
flex-shrink: 0;
}
.iconpark-icon svg {
display: block;
}
// Button styles
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 7px;
padding: 9px 18px;
border: none;
border-radius: var(--radius);
font-family: inherit;
font-size: 13px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
letter-spacing: -0.01em;
position: relative;
overflow: hidden;
}
.btn::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 0;
height: 0;
background: rgba(255, 255, 255, 0.2);
border-radius: 50%;
transform: translate(-50%, -50%);
transition:
width 0.4s ease,
height 0.4s ease;
}
.btn:active::after {
width: 200px;
height: 200px;
}
.btn-primary {
background: var(--accent);
color: white;
box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
background: var(--accent-hover);
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}
.btn-primary:active {
transform: translateY(0) scale(0.98);
}
.btn-secondary:hover {
background: var(--bg-tertiary);
color: var(--text-primary);
border-color: var(--text-tertiary);
}
.btn-secondary:active {
transform: scale(0.98);
}
.btn-danger {
background: var(--danger);
color: white;
box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
background: #dc2626;
transform: translateY(-1px);
}
.btn-danger:active {
transform: translateY(0) scale(0.98);
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none !important;
}
.btn-sm {
padding: 6px 12px;
font-size: 12px;
}
// Empty state
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 48px 24px;
text-align: center;
background: var(--bg-tertiary);
border-radius: var(--radius-lg);
}
.empty-state-icon {
font-size: 48px;
margin-bottom: 16px;
opacity: 0.3;
color: var(--text-tertiary);
}
.empty-state-title {
font-size: 15px;
font-weight: 500;
margin-bottom: 6px;
color: var(--text-secondary);
}
.empty-state-desc {
font-size: 13px;
color: var(--text-tertiary);
margin-bottom: 20px;
}
// Dialog overlay
.dialog-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(15, 23, 42, 0.6);
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
z-index: 1300;
animation: fadeIn 0.15s ease;
}
.dialog {
background: var(--bg-secondary);
border-radius: var(--radius-lg);
padding: 24px;
min-width: 360px;
max-width: 480px;
box-shadow: var(--shadow-lg);
animation: slideUp 0.2s ease;
}
.dialog-title {
font-size: 15px;
font-weight: 600;
margin-bottom: 18px;
letter-spacing: -0.01em;
}
.dialog-confirm-text {
font-size: 14px;
color: var(--text-secondary);
margin-bottom: 8px;
line-height: 1.5;
}
.dialog-actions {
display: flex;
justify-content: flex-end;
gap: 10px;
margin-top: 22px;
}
// Message dialog
.message-dialog {
position: relative;
text-align: center;
padding: 32px 24px;
z-index: 1400;
}
.message-dialog-icon {
width: 48px;
height: 48px;
margin: 0 auto 16px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.message-dialog-icon svg {
width: 24px;
height: 24px;
}
.message-dialog-icon-info {
background: rgba(59, 130, 246, 0.1);
color: var(--accent);
}
.message-dialog-icon-success {
background: rgba(16, 185, 129, 0.1);
color: var(--success);
}
.message-dialog-icon-warning {
background: rgba(245, 158, 11, 0.1);
color: #f59e0b;
}
.message-dialog-icon-error {
background: rgba(239, 68, 68, 0.1);
color: var(--danger);
}
.message-dialog-title {
font-size: 16px;
font-weight: 600;
margin-bottom: 8px;
color: var(--text-primary);
}
.message-dialog-message {
font-size: 14px;
color: var(--text-secondary);
line-height: 1.5;
}
.message-dialog .dialog-actions {
justify-content: center;
margin-top: 24px;
}
.message-dialog .dialog-actions .btn {
min-width: 100px;
}
// Server list (used by ApiConfig too)
.server-list {
border: 1px solid var(--border);
border-radius: var(--radius-lg);
overflow: hidden;
background: var(--bg-secondary);
}
.server-item {
display: flex;
align-items: center;
padding: 14px 18px;
border-bottom: 1px solid var(--border-light);
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
animation: fadeIn 0.3s ease backwards;
}
.server-item:nth-child(1) {
animation-delay: 0.02s;
}
.server-item:nth-child(2) {
animation-delay: 0.04s;
}
.server-item:nth-child(3) {
animation-delay: 0.06s;
}
.server-item:nth-child(4) {
animation-delay: 0.08s;
}
.server-item:nth-child(5) {
animation-delay: 0.1s;
}
.server-item:nth-child(6) {
animation-delay: 0.12s;
}
.server-item:nth-child(7) {
animation-delay: 0.14s;
}
.server-item:nth-child(8) {
animation-delay: 0.16s;
}
.server-item:last-child {
border-bottom: none;
}
.server-item:hover {
background: var(--bg-tertiary);
transform: translateX(4px);
}
.server-item.selected {
background: var(--accent-light);
border-left: 3px solid var(--accent);
padding-left: 15px;
}
.server-info {
flex: 1;
min-width: 0;
}
.server-name {
font-size: 13px;
font-weight: 500;
letter-spacing: -0.01em;
}
.server-desc {
font-size: 12px;
color: var(--text-tertiary);
margin-top: 3px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.server-status {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--success);
box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
animation: pulse 2s ease-in-out infinite;
}