Files
SillyTavern_replica/frontend/src/components/SideBarLeft/tabs/Presets/Presets.css
2026-05-01 14:44:18 +08:00

736 lines
13 KiB
CSS

/* 主容器 */
.preset-panel {
display: flex;
flex-direction: column;
height: 100%;
padding: 12px;
gap: 12px;
background: var(--color-bg-subtle);
overflow-y: auto;
}
/* 工具提示 */
.tooltip {
position: fixed;
padding: 6px 10px;
background: rgba(0, 0, 0, 0.85);
color: white;
border-radius: 4px;
font-size: 11px;
font-weight: 500;
z-index: 1000;
pointer-events: none;
box-shadow: var(--shadow-md);
transform: translate(-50%, -100%);
margin-top: -6px;
}
/* 预设头部 */
.preset-header {
display: flex;
align-items: center;
gap: 10px;
padding: 10px;
background: var(--color-bg-elevated);
border-radius: 6px;
box-shadow: var(--shadow-sm);
}
.preset-select-container {
flex: 1;
display: flex;
align-items: center;
gap: 6px;
}
.preset-label {
font-size: 12px;
font-weight: 600;
color: var(--color-text-primary);
white-space: nowrap;
}
.preset-select {
flex: 1;
padding: 6px 10px;
background: var(--color-bg-tertiary);
border: 1px solid var(--color-border);
border-radius: 4px;
font-size: 12px;
color: var(--color-text-secondary);
cursor: pointer;
transition: all 0.2s ease;
}
.preset-select:hover {
border-color: var(--color-border-focus);
background: var(--color-bg-elevated);
}
.preset-select:focus {
outline: none;
border-color: var(--color-accent);
box-shadow: 0 0 0 2px var(--color-accent-light);
}
.preset-select:disabled {
background: #f1f3f5;
cursor: not-allowed;
color: #adb5bd;
}
/* 操作按钮 */
.preset-actions {
display: flex;
gap: 6px;
}
.preset-action-btn {
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
background: var(--color-bg-elevated);
border: 1px solid var(--color-border);
border-radius: 4px;
cursor: pointer;
transition: all 0.2s ease;
font-size: 14px;
}
.preset-action-btn:hover {
background: var(--color-bg-tertiary);
border-color: var(--color-border-focus);
transform: translateY(-1px);
box-shadow: var(--shadow-sm);
}
.preset-action-btn:active {
transform: translateY(0);
}
/* 对话框 */
.preset-save-dialog,
.preset-edit-dialog,
.preset-import-dialog {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: var(--color-bg-elevated);
padding: 16px;
border-radius: 6px;
box-shadow: var(--shadow-lg);
z-index: 1000;
min-width: 280px;
}
.preset-save-dialog input,
.preset-edit-dialog input {
width: 100%;
padding: 8px 10px;
margin-bottom: 12px;
background: var(--color-bg-tertiary);
border: 1px solid var(--color-border);
border-radius: 4px;
font-size: 13px;
transition: all 0.2s ease;
}
.preset-save-dialog input:focus,
.preset-edit-dialog input:focus {
outline: none;
border-color: #4a6cf7;
box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.1);
}
.preset-import-dialog textarea {
width: 100%;
padding: 8px 10px;
margin-bottom: 12px;
background: var(--color-bg-tertiary);
border: 1px solid var(--color-border);
border-radius: 4px;
font-size: 12px;
font-family: inherit;
resize: vertical;
min-height: 100px;
}
.preset-import-dialog textarea:focus {
outline: none;
border-color: #4a6cf7;
box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.1);
}
.dialog-buttons {
display: flex;
gap: 6px;
justify-content: flex-end;
}
.dialog-buttons button {
padding: 6px 12px;
border: none;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
}
.dialog-buttons button:first-child {
background: var(--color-accent);
color: white;
}
.dialog-buttons button:first-child:hover {
background: var(--color-accent-hover);
}
.dialog-buttons button:last-child {
background: var(--color-bg-secondary);
color: var(--color-text-secondary);
}
.dialog-buttons button:last-child:hover {
background: var(--color-bg-tertiary);
}
/* 组件编辑对话框 */
.component-edit-dialog {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: var(--color-bg-elevated);
border-radius: 6px;
box-shadow: var(--shadow-lg);
z-index: 1000;
min-width: 450px;
max-width: 80vw;
max-height: 80vh;
display: flex;
flex-direction: column;
}
.dialog-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
border-bottom: 1px solid var(--color-border);
}
.dialog-header h3 {
margin: 0;
font-size: 14px;
font-weight: 600;
color: #2c3e50;
}
.dialog-header .close-btn {
background: none;
border: none;
font-size: 20px;
color: #adb5bd;
cursor: pointer;
padding: 0;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
transition: color 0.2s ease;
}
.dialog-header .close-btn:hover {
color: #495057;
}
.dialog-content {
padding: 16px;
flex: 1;
overflow-y: auto;
}
.component-textarea {
width: 100%;
padding: 10px;
background: var(--color-bg-tertiary);
border: 1px solid var(--color-border);
border-radius: 4px;
font-size: 13px;
font-family: inherit;
line-height: 1.5;
resize: none;
transition: all 0.2s ease;
}
.component-textarea:focus {
outline: none;
border-color: #4a6cf7;
box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.1);
}
.component-textarea[readonly] {
background: #f1f3f5;
cursor: default;
}
.dialog-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
border-top: 1px solid var(--color-border);
}
.token-count {
font-size: 11px;
color: #6c757d;
font-weight: 500;
}
/* 参数设置区域 */
.preset-parameters-container {
background: var(--color-bg-elevated);
border-radius: 6px;
box-shadow: var(--shadow-xs);
overflow: hidden;
}
.parameters-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 12px;
background: var(--color-bg-tertiary);
cursor: pointer;
transition: background 0.2s ease;
}
.parameters-header:hover {
background: #f1f3f5;
}
.parameters-header span:first-child {
font-size: 13px;
font-weight: 600;
color: #2c3e50;
}
.expand-icon {
font-size: 10px;
color: #6c757d;
transition: transform 0.3s ease;
}
.expand-icon.expanded {
transform: rotate(180deg);
}
.preset-parameters {
padding: 12px;
}
.parameter-row {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 12px;
}
.parameter-row:last-child {
margin-bottom: 0;
}
.parameter-label {
width: 100px;
font-size: 12px;
font-weight: 500;
color: #495057;
}
.parameter-slider {
flex: 1;
-webkit-appearance: none;
height: 4px;
background: #e9ecef;
border-radius: 2px;
outline: none;
cursor: pointer;
}
.parameter-slider::-webkit-slider-thumb {
-webkit-appearance: none;
width: 14px;
height: 14px;
background: #4a6cf7;
border-radius: 50%;
cursor: pointer;
transition: all 0.2s ease;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.parameter-slider::-webkit-slider-thumb:hover {
background: #3a5ce5;
transform: scale(1.1);
}
.parameter-slider::-moz-range-thumb {
width: 14px;
height: 14px;
background: #4a6cf7;
border: none;
border-radius: 50%;
cursor: pointer;
transition: all 0.2s ease;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.parameter-slider::-moz-range-thumb:hover {
background: #3a5ce5;
transform: scale(1.1);
}
.parameter-number {
width: 60px;
padding: 4px 6px;
background: var(--color-bg-tertiary);
border: 1px solid var(--color-border);
border-radius: 4px;
font-size: 12px;
text-align: center;
transition: all 0.2s ease;
}
.parameter-number:focus {
outline: none;
border-color: #4a6cf7;
box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.1);
}
.parameter-input {
flex: 1;
padding: 6px 10px;
background: var(--color-bg-tertiary);
border: 1px solid var(--color-border);
border-radius: 4px;
font-size: 12px;
transition: all 0.2s ease;
}
.parameter-input:focus {
outline: none;
border-color: #4a6cf7;
box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.1);
}
.parameter-toggles {
display: flex;
flex-direction: column;
gap: 10px;
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid var(--color-border);
}
.toggle-row {
display: flex;
justify-content: space-between;
align-items: center;
}
.toggle-label {
font-size: 12px;
font-weight: 500;
color: #495057;
}
.toggle-checkbox {
width: 38px;
height: 20px;
-webkit-appearance: none;
background: #e9ecef;
border-radius: 10px;
position: relative;
cursor: pointer;
transition: all 0.3s ease;
}
.toggle-checkbox::after {
content: '';
position: absolute;
width: 16px;
height: 16px;
background: var(--color-bg-elevated);
border-radius: 50%;
top: 2px;
left: 2px;
transition: all 0.3s ease;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.toggle-checkbox:checked {
background: #4a6cf7;
}
.toggle-checkbox:checked::after {
left: 20px;
}
/* 预设组件区域 */
.preset-components-section {
flex: 1;
display: flex;
flex-direction: column;
background: var(--color-bg-elevated);
border-radius: 6px;
box-shadow: var(--shadow-xs);
overflow: hidden;
}
.components-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 12px;
background: var(--color-bg-tertiary);
border-bottom: 1px solid var(--color-border);
}
.components-header h3 {
margin: 0;
font-size: 13px;
font-weight: 600;
color: #2c3e50;
}
.add-component-btn {
padding: 4px 10px;
background: #4a6cf7;
color: white;
border: none;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
}
.add-component-btn:hover {
background: #3a5ce5;
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(74, 108, 247, 0.2);
}
.components-list {
flex: 1;
overflow-y: auto;
padding: 6px;
}
.drag-indicator {
height: 3px;
background: #4a6cf7;
border-radius: 2px;
opacity: 0;
transition: opacity 0.2s ease;
margin: 3px 0;
}
.drag-indicator.visible {
opacity: 0.5;
}
.prompt-component-item {
display: flex;
align-items: center;
padding: 8px 10px;
margin-bottom: 6px;
background: var(--color-bg-tertiary);
border: 1px solid var(--color-border);
border-radius: 4px;
transition: all 0.2s ease;
cursor: grab;
}
.prompt-component-item:hover {
background: var(--color-bg-elevated);
border-color: var(--color-border-focus);
box-shadow: var(--shadow-sm);
}
.prompt-component-item.disabled {
opacity: 0.6;
}
.prompt-component-item.marker {
background: rgba(74, 108, 247, 0.05);
border-color: rgba(74, 108, 247, 0.2);
}
.prompt-component-item.dragging {
opacity: 0.5;
cursor: grabbing;
}
.component-header {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}
.component-controls {
display: flex;
align-items: center;
gap: 6px;
flex: 1;
}
.drag-handle {
color: #adb5bd;
cursor: grab;
font-size: 12px;
user-select: none;
transition: color 0.2s ease;
}
.drag-handle:hover {
color: #6c757d;
}
.toggle-btn {
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
background: var(--color-bg-elevated);
border: 1px solid var(--color-border);
border-radius: 3px;
cursor: pointer;
font-size: 10px;
transition: all 0.2s ease;
}
.toggle-btn:hover {
border-color: var(--color-border-focus);
background: var(--color-bg-tertiary);
}
.toggle-btn.enabled {
background: #4a6cf7;
color: white;
border-color: #4a6cf7;
}
.toggle-btn.enabled:hover {
background: #3a5ce5;
}
.component-name {
font-size: 12px;
font-weight: 500;
color: #2c3e50;
flex: 1;
}
.component-marker-badge {
padding: 1px 6px;
background: rgba(74, 108, 247, 0.1);
color: #4a6cf7;
border-radius: 3px;
font-size: 10px;
font-weight: 600;
}
.component-actions {
display: flex;
align-items: center;
gap: 6px;
}
.edit-btn {
padding: 3px 6px;
background: var(--color-bg-elevated);
border: 1px solid var(--color-border);
border-radius: 3px;
font-size: 10px;
font-weight: 500;
color: #495057;
cursor: pointer;
transition: all 0.2s ease;
}
.edit-btn:hover {
background: var(--color-bg-tertiary);
border-color: var(--color-border-focus);
}
.delete-btn {
padding: 3px 6px;
background: var(--color-bg-elevated);
border: 1px solid var(--color-border);
border-radius: 3px;
font-size: 10px;
font-weight: 500;
color: #dc3545;
cursor: pointer;
transition: all 0.2s ease;
}
.delete-btn:hover {
background: #fff5f5;
border-color: #ff6b6b;
}
/* 滚动条样式 */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: var(--color-bg-tertiary);
border-radius: 3px;
}
::-webkit-scrollbar-thumb {
background: var(--color-scrollbar);
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--color-scrollbar-hover);
}
/* 响应式设计 */
@media (max-width: 768px) {
.preset-panel {
padding: 10px;
gap: 10px;
}
.preset-header {
flex-direction: column;
align-items: stretch;
}
.preset-select-container {
flex-direction: column;
align-items: stretch;
}
.preset-actions {
justify-content: center;
}
.component-edit-dialog {
min-width: 85vw;
}
}