@panosen/agent-ui 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,143 @@
1
+ # @panosen/rc-button
2
+
3
+ 一个现代化的 React 按钮组件,支持自定义颜色和渐变效果。
4
+
5
+ ## 特性
6
+
7
+ - 🎨 **自定义颜色** - 支持通过 `color` 属性自定义按钮颜色
8
+ - ✨ **现代化设计** - 优雅的渐变和悬停效果
9
+ - 🎯 **完整的交互状态** - 支持 hover、active、focus、disabled 状态
10
+ - 📦 **轻量级** - 零依赖(除了 React)
11
+ - 🔧 **TypeScript 支持** - 完整的类型定义
12
+ - 🎭 **灵活配置** - 支持图标、自定义样式等
13
+
14
+ ## 安装
15
+
16
+ ```bash
17
+ npm install @panosen/rc-button
18
+ ```
19
+
20
+ 或使用 pnpm:
21
+
22
+ ```bash
23
+ pnpm add @panosen/rc-button
24
+ ```
25
+
26
+ 或使用 yarn:
27
+
28
+ ```bash
29
+ yarn add @panosen/rc-button
30
+ ```
31
+
32
+ ## 使用
33
+
34
+ ### 基础用法
35
+
36
+ ```tsx
37
+ import { Button } from '@panosen/rc-button';
38
+ import '@panosen/rc-button/style.css';
39
+
40
+ function App() {
41
+ return (
42
+ <Button onClick={() => console.log('clicked')}>
43
+ Click Me
44
+ </Button>
45
+ );
46
+ }
47
+ ```
48
+
49
+ ### 自定义颜色
50
+
51
+ ```tsx
52
+ <Button color="#FF5733">Red Orange</Button>
53
+ <Button color="#33FF57">Lime Green</Button>
54
+ <Button color="#3357FF">Royal Blue</Button>
55
+ ```
56
+
57
+ ### 带图标
58
+
59
+ ```tsx
60
+ <Button icon={<YourIcon />}>
61
+ Button with Icon
62
+ </Button>
63
+ ```
64
+
65
+ ### 自定义样式
66
+
67
+ ```tsx
68
+ <Button
69
+ className="my-custom-class"
70
+ style={{ fontSize: '1.2rem' }}
71
+ >
72
+ Custom Style
73
+ </Button>
74
+ ```
75
+
76
+ ## API
77
+
78
+ ### Button Props
79
+
80
+ | 属性 | 类型 | 默认值 | 描述 |
81
+ |------|------|--------|------|
82
+ | `children` | `React.ReactNode` | - | 按钮内容 |
83
+ | `icon` | `React.ReactNode` | - | 按钮图标 |
84
+ | `className` | `string` | - | 自定义类名 |
85
+ | `style` | `React.CSSProperties` | - | 自定义样式 |
86
+ | `color` | `string` | `#667eea` | 按钮主题颜色(支持 hex 格式) |
87
+ | `onClick` | `React.MouseEventHandler` | - | 点击事件处理函数 |
88
+
89
+ 组件使用 `React.forwardRef`,支持传递 ref 到按钮元素。
90
+
91
+ ## 颜色系统
92
+
93
+ 按钮使用 CSS 变量来实现动态颜色系统:
94
+
95
+ - `--button-color`: 主题色
96
+ - `--button-hover-color`: 悬停颜色(自动计算为较暗的颜色)
97
+ - `--button-active-color`: 激活颜色(自动计算为更暗的颜色)
98
+
99
+ 当你传入 `color` 属性时,组件会自动计算 hover 和 active 状态的颜色。
100
+
101
+ ## 样式特性
102
+
103
+ - **渐变背景** - 悬停时显示微妙的渐变效果
104
+ - **阴影效果** - 悬停和聚焦时的柔和阴影
105
+ - **平滑过渡** - 所有状态变化都有流畅的过渡动画
106
+ - **无障碍支持** - 完整的键盘导航和焦点管理
107
+
108
+ ## 开发
109
+
110
+ ```bash
111
+ # 安装依赖
112
+ pnpm install
113
+
114
+ # 开发模式
115
+ pnpm dev
116
+
117
+ # 构建
118
+ pnpm build
119
+
120
+ # 代码检查
121
+ pnpm lint
122
+ ```
123
+
124
+ ## 技术栈
125
+
126
+ - React 18/19
127
+ - TypeScript
128
+ - Vite
129
+ - SCSS Modules
130
+
131
+ ## 浏览器支持
132
+
133
+ 支持所有现代浏览器:
134
+
135
+ - Chrome (最新版本)
136
+ - Firefox (最新版本)
137
+ - Safari (最新版本)
138
+ - Edge (最新版本)
139
+
140
+ ## 相关链接
141
+
142
+ - [GitHub Repository](https://github.com/panosen-react/panosen-rc-button)
143
+ - [npm Package](https://www.npmjs.com/package/@panosen/rc-button)
@@ -0,0 +1,217 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { default as default_2 } from 'react';
3
+ import { InternalAxiosRequestConfig } from 'axios';
4
+
5
+ /**
6
+ * 对话
7
+ */
8
+ export declare const API_USE_DEEP_SEEK = "useDeepSeek";
9
+
10
+ declare interface BaseMessage {
11
+ id: string;
12
+ timestamp: number;
13
+ type: MessageType;
14
+ role: MessageRole;
15
+ }
16
+
17
+ /**
18
+ * 基础请求
19
+ */
20
+ export declare interface BaseRequest {
21
+ }
22
+
23
+ /**
24
+ * 基础返回
25
+ */
26
+ export declare interface BaseResponse {
27
+ /**
28
+ * 状态码
29
+ */
30
+ code?: number | null;
31
+ /**
32
+ * 消息
33
+ */
34
+ message?: string | null;
35
+ }
36
+
37
+ export declare const ChatApp: default_2.FC<ChatAppProps>;
38
+
39
+ export declare interface ChatAppProps {
40
+ theme?: Theme;
41
+ }
42
+
43
+ export declare interface ChatHistory {
44
+ messages: Message[];
45
+ currentSessionId: string;
46
+ }
47
+
48
+ /**
49
+ * 解析主题配置并返回完整的主题 tokens
50
+ * @param theme 主题配置 ('light' | 'dark' | CustomTheme)
51
+ * @returns 完整的主题 tokens
52
+ */
53
+ export declare const computeThemeTokens: (theme: Theme) => ThemeTokens;
54
+
55
+ /**
56
+ * 自定义主题
57
+ */
58
+ export declare interface CustomTheme {
59
+ /**
60
+ * 主题名称
61
+ */
62
+ name: string;
63
+ /**
64
+ * 基础主题
65
+ */
66
+ base: Theme;
67
+ /**
68
+ * 覆盖的 token
69
+ */
70
+ tokens: Partial<ThemeTokens>;
71
+ }
72
+
73
+ export declare interface LoadingMessage extends BaseMessage {
74
+ type: typeof MESSAGE_TYPE_LOADING;
75
+ content: string;
76
+ }
77
+
78
+ export declare type Message = LoadingMessage | TextMessage | ToolMessage;
79
+
80
+ export declare const MESSAGE_ROLE_ASSISTANT = "assistant";
81
+
82
+ export declare const MESSAGE_ROLE_TOOL = "tool";
83
+
84
+ export declare const MESSAGE_ROLE_USER = "user";
85
+
86
+ export declare const MESSAGE_TYPE_LOADING = "loading";
87
+
88
+ export declare const MESSAGE_TYPE_TEXT = "text";
89
+
90
+ export declare const MESSAGE_TYPE_TOOL = "tool";
91
+
92
+ export declare type MessageRole = typeof MESSAGE_ROLE_USER | typeof MESSAGE_ROLE_ASSISTANT | typeof MESSAGE_ROLE_TOOL;
93
+
94
+ export declare type MessageType = typeof MESSAGE_TYPE_LOADING | typeof MESSAGE_TYPE_TEXT | typeof MESSAGE_TYPE_TOOL;
95
+
96
+ export declare const simpleSampleService: SimpleSampleServiceClient;
97
+
98
+ /**
99
+ * 简单示例服务
100
+ */
101
+ declare class SimpleSampleServiceClient {
102
+ private axios;
103
+ constructor(baseURL: string, options?: SimpleSampleServiceClientOptions);
104
+ httpPost<T = any>(api: string, request: any): Promise<T>;
105
+ httpPostSse<T = any>(api: string, request: any, handleResponse: (response: any) => void): Promise<AxiosResponse<T>>;
106
+ parseAndEmit(chunk: string, handleResponse: (chunk: string) => void): void;
107
+ processStreamResponse(response: AxiosResponse<ReadableStream>, handleResponse: (chunk: string) => void): Promise<void>;
108
+ }
109
+
110
+ declare interface SimpleSampleServiceClientOptions {
111
+ interceptorsRequest?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig;
112
+ interceptorsResponse?: (response: AxiosResponse) => AxiosResponse;
113
+ interceptorsRequestException?: (error: any) => any;
114
+ interceptorsResponseException?: (error: any) => any;
115
+ }
116
+
117
+ export declare interface TextMessage extends BaseMessage {
118
+ type: typeof MESSAGE_TYPE_TEXT;
119
+ content: string;
120
+ }
121
+
122
+ export declare type Theme = 'light' | 'dark' | CustomTheme;
123
+
124
+ export declare interface ThemeTokens {
125
+ backgroundColor?: string;
126
+ textColor?: string;
127
+ errorBackground?: string;
128
+ errorColor?: string;
129
+ errorBorder?: string;
130
+ errorBorderLeft?: string;
131
+ animationGradientStart?: string;
132
+ animationGradientMid?: string;
133
+ animationGradientEnd?: string;
134
+ messageLoading?: string;
135
+ messageUser?: string;
136
+ messageAssistant?: string;
137
+ messageTool?: string;
138
+ inputBorder?: string;
139
+ inputColor?: string;
140
+ inputPlaceholderColor?: string;
141
+ inputShadow?: string;
142
+ inputDisabledBackground?: string;
143
+ inputDisabledColor?: string;
144
+ inputDisabledBorder?: string;
145
+ submitBackground?: string;
146
+ submitBorder?: string;
147
+ submitColor?: string;
148
+ submitHoverBackground?: string;
149
+ listScrollbarTrack?: string;
150
+ listScrollbarThumb?: string;
151
+ listScrollbarThumbHover?: string;
152
+ listScrollbarGlow?: string;
153
+ listWelcomeColor?: string;
154
+ listWelcomeTitleGradientStart?: string;
155
+ listWelcomeTitleGradientMid?: string;
156
+ listWelcomeTitleGradientEnd?: string;
157
+ listWelcomeTitleTextShadow?: string;
158
+ listWelcomeContentColor?: string;
159
+ }
160
+
161
+ export declare const TOOL_STATUS_COMPLETED = "completed";
162
+
163
+ export declare const TOOL_STATUS_PREPARING = "preparing";
164
+
165
+ export declare const TOOL_STATUS_PROCESSING = "processing";
166
+
167
+ export declare interface ToolMessage extends BaseMessage {
168
+ type: typeof MESSAGE_TYPE_TOOL;
169
+ toolStatus: ToolStatus;
170
+ name: string;
171
+ }
172
+
173
+ export declare type ToolStatus = typeof TOOL_STATUS_PREPARING | typeof TOOL_STATUS_PROCESSING | typeof TOOL_STATUS_COMPLETED;
174
+
175
+ /**
176
+ * 工具调用
177
+ */
178
+ export declare interface ToolUsage {
179
+ /**
180
+ * 编号
181
+ */
182
+ id?: string | null;
183
+ /**
184
+ * 名称
185
+ */
186
+ name?: string | null;
187
+ /**
188
+ * 状态 preparing(创建) processing(调用) completed(完成)
189
+ */
190
+ status?: string | null;
191
+ }
192
+
193
+ /**
194
+ * 对话请求体
195
+ */
196
+ export declare interface UseDeepSeekRequest extends BaseRequest {
197
+ /**
198
+ * 内容
199
+ */
200
+ content?: string | null;
201
+ }
202
+
203
+ /**
204
+ * 对话返回体
205
+ */
206
+ export declare interface UseDeepSeekResponse extends BaseResponse {
207
+ /**
208
+ * 内容
209
+ */
210
+ content?: string | null;
211
+ /**
212
+ * 工具调用
213
+ */
214
+ toolUsage?: ToolUsage | null;
215
+ }
216
+
217
+ export { }