重构: AiChat 样式同步到子组件 scoped + 复用抽取(God 拆分遗漏修复)
根因:AiChat God 拆分(抽 ConversationSidebar/ChatInput/MessageList)时样式没移子组件, 留 AiChat <style scoped>。Vue scoped 不匹配子组件内部元素(子元素无父 data-v)→ 对话列表/输入框样式丢失 → 布局塌陷(主导航被覆盖点击无反应 + 样式乱)。 修复(纯样式移动,不改选择器/属性/值): - AiChat <style scoped> 886→151 行(瘦身 83%) - 侧栏 .ai-conv-* 47 选择器 → ConversationSidebar <style scoped>(新建) - 输入框 .ai-input-*/.ai-skill-*/.ai-mention-*/.ai-send-btn 40 → ChatInput <style scoped>(新建) - 复用 .ai-btn-icon* 6 处 → components.css(全局,TopBar+ConversationSidebar 共用) - 容器 .ai-panel/.ai-chat-area/.ai-queue-*/.ai-toast* 32 → AiChat 保留 scoped - 清理 TopBar 重复块(AiChat 漏删死代码,零视觉变更)+ 删 TEMP DEBUG 参考线 自验: vite build ✓ + vue-tsc EXIT 0 + AiChat scoped CLEAN(0 子组件类)
This commit is contained in:
@@ -656,3 +656,237 @@ defineExpose({
|
||||
sendExamplePrompt,
|
||||
})
|
||||
</script>
|
||||
|
||||
<!-- ═══ ChatInput scoped 样式(第二批抽离遗漏修复: 从 AiChat.vue <style scoped> 迁移,
|
||||
零视觉变更。原 AiChat scoped 不渗透子组件根,输入框/技能联想/发送按钮元素失配 → 本组件自持。
|
||||
CSS 变量(--df-*)由根级 global.css 提供,共享同一份。.ai-input-area 容器留父级 AiChat scoped。) ═══ -->
|
||||
<style scoped>
|
||||
.ai-input-wrap {
|
||||
position: relative;
|
||||
display: flex;
|
||||
/* F-260614-05 Phase 2b: flex-wrap 让全宽的图片预览行强制 textarea+按钮换行到下一行 */
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: var(--df-bg-card);
|
||||
border: 0.5px solid var(--df-border);
|
||||
border-radius: var(--df-radius-lg);
|
||||
padding: 6px 8px;
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
|
||||
/* F-260614-05 Phase 2b: 待发送图片预览行(粘贴/拖拽加入,发送前可移除) */
|
||||
.ai-img-preview-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
width: 100%; /* 全宽强制后续 textarea+按钮换行 */
|
||||
padding-bottom: 4px;
|
||||
border-bottom: 0.5px solid var(--df-border);
|
||||
}
|
||||
.ai-img-preview {
|
||||
position: relative;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: var(--df-radius);
|
||||
overflow: hidden;
|
||||
border: 0.5px solid var(--df-border);
|
||||
background: var(--df-bg);
|
||||
}
|
||||
.ai-img-preview-thumb {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
.ai-img-preview-x {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
background: color-mix(in srgb, var(--df-bg) 80%, transparent);
|
||||
color: var(--df-text-dim);
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
transition: background 0.15s, color 0.15s;
|
||||
}
|
||||
.ai-img-preview-x:hover {
|
||||
background: var(--df-danger);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ai-input-wrap:focus-within {
|
||||
border-color: color-mix(in srgb, var(--df-accent) 40%, transparent);
|
||||
}
|
||||
|
||||
/* ── 技能 chip / 联想浮层 ── */
|
||||
.ai-skill-chip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-bottom: 6px;
|
||||
padding: 3px 8px;
|
||||
background: color-mix(in srgb, var(--df-accent) 16%, transparent);
|
||||
border: 0.5px solid color-mix(in srgb, var(--df-accent) 40%, transparent);
|
||||
border-radius: var(--df-radius);
|
||||
font-size: 12px;
|
||||
}
|
||||
.ai-skill-chip-name { color: var(--df-accent); font-weight: 600; flex-shrink: 0; }
|
||||
.ai-skill-chip-desc { color: var(--df-text-dim); flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
/* 参数格式提示(技能自带 argument_hint 数据,不进 i18n) */
|
||||
.ai-skill-chip-main { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; flex-wrap: wrap; }
|
||||
.ai-skill-chip-hint {
|
||||
color: var(--df-text-dim);
|
||||
font-family: var(--df-font-mono, ui-monospace, monospace);
|
||||
font-size: 11px;
|
||||
background: color-mix(in srgb, var(--df-text-dim) 14%, transparent);
|
||||
padding: 1px 5px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.ai-skill-chip-x { background: none; border: none; color: var(--df-text-dim); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; flex-shrink: 0; }
|
||||
.ai-skill-chip-x:hover { color: var(--df-text); }
|
||||
|
||||
.ai-skill-popover {
|
||||
position: absolute;
|
||||
bottom: calc(100% + 4px);
|
||||
left: 0;
|
||||
right: 0;
|
||||
max-height: 240px;
|
||||
overflow-y: auto;
|
||||
background: var(--df-bg-card);
|
||||
border: 0.5px solid var(--df-border);
|
||||
border-radius: var(--df-radius);
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
|
||||
z-index: 20;
|
||||
}
|
||||
.ai-skill-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
padding: 6px 10px;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
}
|
||||
.ai-skill-item-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
||||
.ai-skill-item--active,
|
||||
.ai-skill-item:hover {
|
||||
background: color-mix(in srgb, var(--df-accent) 14%, transparent);
|
||||
}
|
||||
.ai-skill-item-name { color: var(--df-accent); font-weight: 600; min-width: 90px; }
|
||||
.ai-skill-item-desc { color: var(--df-text-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.ai-skill-item-src { color: var(--df-text-dim); opacity: 0.6; font-size: 10px; text-transform: uppercase; }
|
||||
/* 浮层内参数格式提示(等宽 dim 小字,仅在 skill.argument_hint 有值时显) */
|
||||
.ai-skill-item-hint {
|
||||
color: var(--df-text-dim);
|
||||
font-family: var(--df-font-mono, ui-monospace, monospace);
|
||||
font-size: 11px;
|
||||
opacity: 0.85;
|
||||
word-break: break-all;
|
||||
}
|
||||
.ai-skill-empty { padding: 8px 12px; color: var(--df-text-dim); opacity: 0.7; font-size: 12px; }
|
||||
|
||||
/* ── UX-10 §1.4: @ 实体引用浮层(复用 .ai-skill-popover 容器,仅新增组标题/类型标签) ── */
|
||||
.ai-mention-popover { /* 同 .ai-skill-popover 定位,这里仅为语义占位,样式继承 */ }
|
||||
.ai-mention-group {
|
||||
padding: 4px 10px 2px;
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
color: var(--df-text-dim);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
user-select: none;
|
||||
}
|
||||
.ai-mention-item-name { color: var(--df-text); font-weight: 500; flex-shrink: 0; }
|
||||
.ai-mention-item-desc {
|
||||
color: var(--df-text-dim);
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* 类型标签小色块(项目/任务区分) */
|
||||
.ai-mention-item-type {
|
||||
flex-shrink: 0;
|
||||
padding: 1px 5px;
|
||||
border-radius: var(--df-radius-sm);
|
||||
font-size: 9px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.3px;
|
||||
background: var(--df-bg-hover);
|
||||
color: var(--df-text-dim);
|
||||
}
|
||||
.ai-mention-item-type--project {
|
||||
background: color-mix(in srgb, var(--df-accent) 16%, transparent);
|
||||
color: var(--df-accent);
|
||||
}
|
||||
.ai-mention-item-type--task {
|
||||
background: color-mix(in srgb, var(--df-success) 16%, transparent);
|
||||
color: var(--df-success);
|
||||
}
|
||||
|
||||
.ai-input {
|
||||
flex: 1;
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
color: var(--df-text);
|
||||
font-size: 13px;
|
||||
font-family: var(--df-font-sans);
|
||||
line-height: 1.5;
|
||||
resize: vertical;
|
||||
min-height: 20px;
|
||||
height: 20px;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.ai-input::placeholder {
|
||||
color: var(--df-text-dim);
|
||||
}
|
||||
.ai-send-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: none;
|
||||
border-radius: var(--df-radius);
|
||||
background: var(--df-bg-raised);
|
||||
color: var(--df-text-dim);
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.ai-send-btn--active {
|
||||
background: var(--df-accent);
|
||||
color: #fff;
|
||||
}
|
||||
.ai-send-btn--active:hover {
|
||||
background: var(--df-accent-hover);
|
||||
}
|
||||
.ai-send-btn:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.ai-send-btn--stop {
|
||||
background: #e5484d;
|
||||
color: #fff;
|
||||
}
|
||||
.ai-send-btn--stop:hover {
|
||||
background: #d63a3f;
|
||||
}
|
||||
.ai-input-hint {
|
||||
font-size: 10px;
|
||||
color: var(--df-text-dim);
|
||||
text-align: right;
|
||||
margin-top: 4px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user