feat(ui): 创建共享 UI 组件包
将 web 和 desktop 的重复代码抽取到 @ai-assistant/ui 包: - 添加可配置的 API 客户端 (configureApiClient) - 迁移共享组件: ChatMessage, ChatInput, Sidebar, FileBrowser, ConfigPanel - 迁移共享 hook: useChat - 添加 responsive prop 支持响应式布局 - 更新 web/desktop 依赖并删除重复代码
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* Shared UI Styles
|
||||
*
|
||||
* 共享样式,供 web 和 desktop 包使用
|
||||
* 注意:使用此文件时,宿主项目需要配置 Tailwind CSS
|
||||
*/
|
||||
|
||||
/* iOS Safe Area Support */
|
||||
@supports (padding-bottom: env(safe-area-inset-bottom)) {
|
||||
.safe-area-pb {
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 0.5rem);
|
||||
}
|
||||
}
|
||||
|
||||
/* Prevent pull-to-refresh on mobile */
|
||||
html {
|
||||
overscroll-behavior: none;
|
||||
}
|
||||
|
||||
/* Touch action optimization */
|
||||
.touch-pan-x {
|
||||
touch-action: pan-x;
|
||||
}
|
||||
|
||||
.touch-pan-y {
|
||||
touch-action: pan-y;
|
||||
}
|
||||
|
||||
/* Custom scrollbar */
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #4b5563;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #6b7280;
|
||||
}
|
||||
|
||||
/* Message content */
|
||||
.message-content {
|
||||
max-width: none;
|
||||
color: #f3f4f6; /* text-gray-100 */
|
||||
}
|
||||
|
||||
.message-content pre {
|
||||
background: #1f2937; /* bg-gray-800 */
|
||||
border-radius: 0.5rem;
|
||||
padding: 1rem;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.message-content code {
|
||||
background: #1f2937; /* bg-gray-800 */
|
||||
padding: 0.125rem 0.375rem;
|
||||
border-radius: 0.25rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.message-content pre code {
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Typing indicator */
|
||||
.typing-indicator {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.typing-indicator span {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background: #6b7280;
|
||||
border-radius: 50%;
|
||||
animation: typing 1.4s infinite ease-in-out;
|
||||
}
|
||||
|
||||
.typing-indicator span:nth-child(1) {
|
||||
animation-delay: 0s;
|
||||
}
|
||||
|
||||
.typing-indicator span:nth-child(2) {
|
||||
animation-delay: 0.2s;
|
||||
}
|
||||
|
||||
.typing-indicator span:nth-child(3) {
|
||||
animation-delay: 0.4s;
|
||||
}
|
||||
|
||||
@keyframes typing {
|
||||
0%,
|
||||
80%,
|
||||
100% {
|
||||
transform: scale(1);
|
||||
opacity: 0.5;
|
||||
}
|
||||
40% {
|
||||
transform: scale(1.2);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* bg-gray-850 custom color */
|
||||
.bg-gray-850 {
|
||||
background-color: #1a1f2a;
|
||||
}
|
||||
Reference in New Issue
Block a user