ai-chat-ui-kit 0.1.0
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/.eslintrc.cjs +74 -0
- package/.github/actions/screenshot/action.yml +35 -0
- package/.github/workflows/pages.yml +46 -0
- package/README.md +285 -0
- package/docs/README.md +176 -0
- package/docs/api/components.md +344 -0
- package/docs/api/core.md +349 -0
- package/docs/chat-style-1-minimal.html +78 -0
- package/docs/chat-style-2-neon.html +74 -0
- package/docs/chat-style-3-glass.html +73 -0
- package/docs/chat-style-4-terminal.html +84 -0
- package/docs/chat-style-5-gradient.html +69 -0
- package/docs/chat-style-6-corporate.html +116 -0
- package/docs/examples/basic-chat.md +291 -0
- package/docs/examples/custom-plugins.md +431 -0
- package/docs/examples/multi-model.md +466 -0
- package/docs/guide/api-adapters.md +431 -0
- package/docs/guide/getting-started.md +244 -0
- package/docs/guide/headless-mode.md +508 -0
- package/docs/guide/plugins.md +416 -0
- package/docs/guide/themes.md +327 -0
- package/docs/index.html +256 -0
- package/docs/theme-preview-1-minimal.html +74 -0
- package/docs/theme-preview-2-neon.html +73 -0
- package/docs/theme-preview-3-glass.html +77 -0
- package/docs/theme-preview-4-terminal.html +86 -0
- package/docs/theme-preview-5-gradient.html +79 -0
- package/docs/theme-preview-6-corporate.html +71 -0
- package/examples/index.html +414 -0
- package/examples/react-app/App.tsx +131 -0
- package/examples/react-app/index.html +12 -0
- package/examples/react-app/main.tsx +15 -0
- package/examples/react-app/package.json +24 -0
- package/examples/vue-app/index.html +12 -0
- package/examples/vue-app/package.json +22 -0
- package/examples/vue-app/src/App.vue +145 -0
- package/examples/vue-app/src/main.ts +9 -0
- package/package.json +44 -0
- package/packages/components/package.json +25 -0
- package/packages/components/src/chat/chat.css +80 -0
- package/packages/components/src/chat/chat.ts +236 -0
- package/packages/components/src/index.ts +36 -0
- package/packages/components/src/input/input.css +52 -0
- package/packages/components/src/input/input.ts +116 -0
- package/packages/components/src/markdown/markdown.css +118 -0
- package/packages/components/src/markdown/markdown.ts +229 -0
- package/packages/components/src/message/message.css +56 -0
- package/packages/components/src/message/message.ts +72 -0
- package/packages/components/src/styles/global.css +43 -0
- package/packages/components/src/tool-call/tool-call.css +98 -0
- package/packages/components/src/tool-call/tool-call.ts +171 -0
- package/packages/components/src/types.ts +55 -0
- package/packages/components/src/utils/helpers.ts +128 -0
- package/packages/components/tsconfig.json +25 -0
- package/packages/components/tsup.config.ts +18 -0
- package/packages/core/package.json +47 -0
- package/packages/core/pnpm-lock.yaml +2032 -0
- package/packages/core/pnpm-workspace.yaml +2 -0
- package/packages/core/src/api/adapters.ts +717 -0
- package/packages/core/src/api/base.ts +210 -0
- package/packages/core/src/api/index.ts +54 -0
- package/packages/core/src/index.ts +93 -0
- package/packages/core/src/parser/latex.ts +274 -0
- package/packages/core/src/parser/markdown.test.ts +58 -0
- package/packages/core/src/parser/markdown.ts +206 -0
- package/packages/core/src/parser/mermaid.ts +276 -0
- package/packages/core/src/plugins/PluginManager.ts +232 -0
- package/packages/core/src/plugins/builtin.ts +406 -0
- package/packages/core/src/store/ChatStore.ts +163 -0
- package/packages/core/src/store/ModelConfigStore.ts +136 -0
- package/packages/core/src/store/ToolCallStore.ts +164 -0
- package/packages/core/src/store/base.ts +75 -0
- package/packages/core/src/types/index.ts +133 -0
- package/packages/core/tsup.config.ts +18 -0
- package/packages/themes/package.json +33 -0
- package/packages/themes/src/corporate/index.ts +52 -0
- package/packages/themes/src/corporate/theme.css +228 -0
- package/packages/themes/src/glass/index.ts +52 -0
- package/packages/themes/src/glass/theme.css +237 -0
- package/packages/themes/src/gradient/index.ts +53 -0
- package/packages/themes/src/gradient/theme.css +218 -0
- package/packages/themes/src/index.ts +13 -0
- package/packages/themes/src/minimal/index.ts +52 -0
- package/packages/themes/src/minimal/theme.css +198 -0
- package/packages/themes/src/neon/index.ts +52 -0
- package/packages/themes/src/neon/theme.css +233 -0
- package/packages/themes/src/terminal/index.ts +52 -0
- package/packages/themes/src/terminal/theme.css +235 -0
- package/packages/themes/src/types.ts +10 -0
- package/packages/themes/src/vite-env.d.ts +9 -0
- package/packages/themes/tsup.config.ts +21 -0
- package/pnpm-workspace.yaml +4 -0
- package/tsconfig.json +27 -0
- package/vite.config.ts +25 -0
- package/vitest.config.ts +28 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated-by AI: edenxpzhang
|
|
3
|
+
* @generated-date 2026-05-13
|
|
4
|
+
*
|
|
5
|
+
* Retro Terminal —— 复古终端
|
|
6
|
+
* 对齐 docs/chat-style-4-terminal.html
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
:root[data-theme='terminal'],
|
|
10
|
+
.ai-theme-terminal {
|
|
11
|
+
--ai-primary: #00ff00;
|
|
12
|
+
--ai-bg-primary: #0a0a0a;
|
|
13
|
+
--ai-text-primary: #00ff00;
|
|
14
|
+
--ai-text-secondary: #008000;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* 全局 body 配置 + 扫描线 */
|
|
18
|
+
.ai-theme-terminal-host,
|
|
19
|
+
body[data-theme='terminal'] {
|
|
20
|
+
background: #0c0c0c;
|
|
21
|
+
}
|
|
22
|
+
.ai-theme-terminal-host::after,
|
|
23
|
+
body[data-theme='terminal']::after {
|
|
24
|
+
content: '';
|
|
25
|
+
position: fixed;
|
|
26
|
+
inset: 0;
|
|
27
|
+
background: repeating-linear-gradient(
|
|
28
|
+
0deg,
|
|
29
|
+
rgba(0, 255, 0, 0.03) 0px,
|
|
30
|
+
rgba(0, 255, 0, 0.03) 1px,
|
|
31
|
+
transparent 1px,
|
|
32
|
+
transparent 2px
|
|
33
|
+
);
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
z-index: 100;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* 容器 */
|
|
39
|
+
.ai-theme-terminal .ai-chat,
|
|
40
|
+
[data-theme='terminal'] .ai-chat {
|
|
41
|
+
background: #0a0a0a;
|
|
42
|
+
border: 2px solid #00ff00;
|
|
43
|
+
border-radius: 8px;
|
|
44
|
+
box-shadow:
|
|
45
|
+
0 0 30px rgba(0, 255, 0, 0.3),
|
|
46
|
+
inset 0 0 30px rgba(0, 255, 0, 0.05);
|
|
47
|
+
font-family: 'Courier New', monospace;
|
|
48
|
+
position: relative;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Header */
|
|
52
|
+
.ai-theme-terminal .ai-chat__header,
|
|
53
|
+
[data-theme='terminal'] .ai-chat__header {
|
|
54
|
+
padding: 16px 20px;
|
|
55
|
+
background: #0a0a0a;
|
|
56
|
+
border-bottom: 1px solid #00ff00;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: 12px;
|
|
60
|
+
}
|
|
61
|
+
.ai-theme-terminal .ai-chat__avatar,
|
|
62
|
+
[data-theme='terminal'] .ai-chat__avatar {
|
|
63
|
+
background: transparent;
|
|
64
|
+
color: #00ff00;
|
|
65
|
+
font-size: 20px;
|
|
66
|
+
width: auto;
|
|
67
|
+
height: auto;
|
|
68
|
+
animation: ai-terminal-blink 1s infinite;
|
|
69
|
+
}
|
|
70
|
+
.ai-theme-terminal .ai-chat__title,
|
|
71
|
+
[data-theme='terminal'] .ai-chat__title {
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
font-weight: normal;
|
|
74
|
+
color: #00ff00;
|
|
75
|
+
letter-spacing: 2px;
|
|
76
|
+
}
|
|
77
|
+
.ai-theme-terminal .ai-chat__subtitle,
|
|
78
|
+
[data-theme='terminal'] .ai-chat__subtitle {
|
|
79
|
+
font-size: 11px;
|
|
80
|
+
color: #008000;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@keyframes ai-terminal-blink {
|
|
84
|
+
0%, 100% { opacity: 1; }
|
|
85
|
+
50% { opacity: 0.3; }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Messages */
|
|
89
|
+
.ai-theme-terminal .ai-chat__messages,
|
|
90
|
+
[data-theme='terminal'] .ai-chat__messages {
|
|
91
|
+
background: #0a0a0a;
|
|
92
|
+
padding: 20px;
|
|
93
|
+
gap: 12px;
|
|
94
|
+
}
|
|
95
|
+
.ai-theme-terminal .ai-chat__messages::-webkit-scrollbar,
|
|
96
|
+
[data-theme='terminal'] .ai-chat__messages::-webkit-scrollbar { width: 8px; }
|
|
97
|
+
.ai-theme-terminal .ai-chat__messages::-webkit-scrollbar-thumb,
|
|
98
|
+
[data-theme='terminal'] .ai-chat__messages::-webkit-scrollbar-thumb {
|
|
99
|
+
background: #00ff00;
|
|
100
|
+
border-radius: 0;
|
|
101
|
+
}
|
|
102
|
+
.ai-theme-terminal .ai-chat__messages::-webkit-scrollbar-track,
|
|
103
|
+
[data-theme='terminal'] .ai-chat__messages::-webkit-scrollbar-track { background: #0a0a0a; }
|
|
104
|
+
|
|
105
|
+
/* Message —— terminal 风格强调单行命令式 */
|
|
106
|
+
.ai-theme-terminal .ai-message,
|
|
107
|
+
[data-theme='terminal'] .ai-message {
|
|
108
|
+
display: block;
|
|
109
|
+
max-width: 100%;
|
|
110
|
+
font-size: 13px;
|
|
111
|
+
line-height: 1.6;
|
|
112
|
+
padding: 8px 0 8px 12px;
|
|
113
|
+
border-left: 2px solid transparent;
|
|
114
|
+
margin: 0 !important;
|
|
115
|
+
}
|
|
116
|
+
.ai-theme-terminal .ai-message--user,
|
|
117
|
+
[data-theme='terminal'] .ai-message--user {
|
|
118
|
+
color: #00ffff;
|
|
119
|
+
border-left-color: #00ffff;
|
|
120
|
+
}
|
|
121
|
+
.ai-theme-terminal .ai-message--assistant,
|
|
122
|
+
[data-theme='terminal'] .ai-message--assistant {
|
|
123
|
+
color: #00ff00;
|
|
124
|
+
border-left-color: #00ff00;
|
|
125
|
+
}
|
|
126
|
+
.ai-theme-terminal .ai-message__avatar,
|
|
127
|
+
[data-theme='terminal'] .ai-message__avatar { display: none; }
|
|
128
|
+
.ai-theme-terminal .ai-message__content,
|
|
129
|
+
[data-theme='terminal'] .ai-message__content {
|
|
130
|
+
padding: 0;
|
|
131
|
+
background: transparent !important;
|
|
132
|
+
border: none !important;
|
|
133
|
+
box-shadow: none !important;
|
|
134
|
+
color: inherit;
|
|
135
|
+
border-radius: 0;
|
|
136
|
+
}
|
|
137
|
+
.ai-theme-terminal .ai-message--user .ai-message__content::before,
|
|
138
|
+
[data-theme='terminal'] .ai-message--user .ai-message__content::before {
|
|
139
|
+
content: 'USER> ';
|
|
140
|
+
font-weight: bold;
|
|
141
|
+
margin-right: 4px;
|
|
142
|
+
}
|
|
143
|
+
.ai-theme-terminal .ai-message--assistant .ai-message__content::before,
|
|
144
|
+
[data-theme='terminal'] .ai-message--assistant .ai-message__content::before {
|
|
145
|
+
content: 'AI> ';
|
|
146
|
+
font-weight: bold;
|
|
147
|
+
margin-right: 4px;
|
|
148
|
+
}
|
|
149
|
+
.ai-theme-terminal .ai-message__time,
|
|
150
|
+
[data-theme='terminal'] .ai-message__time { display: none; }
|
|
151
|
+
|
|
152
|
+
/* Input */
|
|
153
|
+
.ai-theme-terminal .ai-input,
|
|
154
|
+
[data-theme='terminal'] .ai-input {
|
|
155
|
+
padding: 16px 20px;
|
|
156
|
+
background: #0a0a0a;
|
|
157
|
+
border-top: 1px solid #00ff00;
|
|
158
|
+
}
|
|
159
|
+
.ai-theme-terminal .ai-input__wrapper,
|
|
160
|
+
[data-theme='terminal'] .ai-input__wrapper {
|
|
161
|
+
display: flex;
|
|
162
|
+
gap: 12px;
|
|
163
|
+
align-items: center;
|
|
164
|
+
}
|
|
165
|
+
.ai-theme-terminal .ai-input__wrapper::before,
|
|
166
|
+
[data-theme='terminal'] .ai-input__wrapper::before {
|
|
167
|
+
content: 'USER>';
|
|
168
|
+
color: #00ff00;
|
|
169
|
+
font-size: 14px;
|
|
170
|
+
font-family: 'Courier New', monospace;
|
|
171
|
+
flex-shrink: 0;
|
|
172
|
+
}
|
|
173
|
+
.ai-theme-terminal .ai-input__textarea,
|
|
174
|
+
[data-theme='terminal'] .ai-input__textarea {
|
|
175
|
+
flex: 1;
|
|
176
|
+
background: transparent;
|
|
177
|
+
border: none;
|
|
178
|
+
color: #00ff00;
|
|
179
|
+
font-family: 'Courier New', monospace;
|
|
180
|
+
font-size: 14px;
|
|
181
|
+
outline: none;
|
|
182
|
+
resize: none;
|
|
183
|
+
caret-color: #00ff00;
|
|
184
|
+
min-height: 24px;
|
|
185
|
+
max-height: 120px;
|
|
186
|
+
padding: 0;
|
|
187
|
+
}
|
|
188
|
+
.ai-theme-terminal .ai-input__textarea::placeholder,
|
|
189
|
+
[data-theme='terminal'] .ai-input__textarea::placeholder { color: #006600; }
|
|
190
|
+
.ai-theme-terminal .ai-input__send,
|
|
191
|
+
[data-theme='terminal'] .ai-input__send {
|
|
192
|
+
background: transparent;
|
|
193
|
+
border: 1px solid #00ff00;
|
|
194
|
+
color: #00ff00;
|
|
195
|
+
padding: 8px 16px;
|
|
196
|
+
cursor: pointer;
|
|
197
|
+
font-family: 'Courier New', monospace;
|
|
198
|
+
font-size: 12px;
|
|
199
|
+
letter-spacing: 2px;
|
|
200
|
+
transition: all 0.3s;
|
|
201
|
+
border-radius: 0;
|
|
202
|
+
}
|
|
203
|
+
.ai-theme-terminal .ai-input__send:hover:not(:disabled),
|
|
204
|
+
[data-theme='terminal'] .ai-input__send:hover:not(:disabled) {
|
|
205
|
+
background: #00ff00;
|
|
206
|
+
color: #0a0a0a;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* Typing */
|
|
210
|
+
.ai-theme-terminal .ai-typing-indicator,
|
|
211
|
+
[data-theme='terminal'] .ai-typing-indicator {
|
|
212
|
+
display: flex;
|
|
213
|
+
gap: 6px;
|
|
214
|
+
padding: 8px 0 8px 12px;
|
|
215
|
+
border-left: 2px solid #00ff00;
|
|
216
|
+
}
|
|
217
|
+
.ai-theme-terminal .ai-typing-indicator::before,
|
|
218
|
+
[data-theme='terminal'] .ai-typing-indicator::before {
|
|
219
|
+
content: 'AI> ';
|
|
220
|
+
color: #00ff00;
|
|
221
|
+
font-weight: bold;
|
|
222
|
+
margin-right: 4px;
|
|
223
|
+
}
|
|
224
|
+
.ai-theme-terminal .ai-typing-indicator__dot,
|
|
225
|
+
[data-theme='terminal'] .ai-typing-indicator__dot {
|
|
226
|
+
width: 8px;
|
|
227
|
+
height: 8px;
|
|
228
|
+
background: #00ff00;
|
|
229
|
+
border-radius: 0;
|
|
230
|
+
animation: ai-terminal-blink 1.4s infinite;
|
|
231
|
+
}
|
|
232
|
+
.ai-theme-terminal .ai-typing-indicator__dot:nth-child(2),
|
|
233
|
+
[data-theme='terminal'] .ai-typing-indicator__dot:nth-child(2) { animation-delay: 0.2s; }
|
|
234
|
+
.ai-theme-terminal .ai-typing-indicator__dot:nth-child(3),
|
|
235
|
+
[data-theme='terminal'] .ai-typing-indicator__dot:nth-child(3) { animation-delay: 0.4s; }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated-by AI: edenxpzhang
|
|
3
|
+
* @generated-date 2026-05-13
|
|
4
|
+
*/
|
|
5
|
+
import { defineConfig } from 'tsup';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
entry: ['src/index.ts', 'src/default/index.ts', 'src/bubble/index.ts', 'src/flat/index.ts'],
|
|
9
|
+
outDir: 'dist',
|
|
10
|
+
format: ['esm'],
|
|
11
|
+
target: 'es2020',
|
|
12
|
+
splitting: true,
|
|
13
|
+
clean: true,
|
|
14
|
+
dts: true,
|
|
15
|
+
sourcemap: false,
|
|
16
|
+
treeshake: false,
|
|
17
|
+
external: [],
|
|
18
|
+
loader: {
|
|
19
|
+
'.css': 'copy',
|
|
20
|
+
},
|
|
21
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"declarationMap": true,
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
"baseUrl": ".",
|
|
19
|
+
"paths": {
|
|
20
|
+
"@ai-chat/core": ["packages/core/src"],
|
|
21
|
+
"@ai-chat/components": ["packages/components/src"],
|
|
22
|
+
"@ai-chat/themes/*": ["packages/themes/src/*"]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"include": ["packages/*/src"],
|
|
26
|
+
"exclude": ["node_modules", "dist", "packages/*/dist"]
|
|
27
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated-by AI: edenxpzhang
|
|
3
|
+
* @generated-date 2026-05-13
|
|
4
|
+
*/
|
|
5
|
+
import { defineConfig } from 'vite';
|
|
6
|
+
import { resolve } from 'path';
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
root: resolve(__dirname, 'examples'),
|
|
10
|
+
publicDir: resolve(__dirname, 'packages'),
|
|
11
|
+
server: {
|
|
12
|
+
port: 3000,
|
|
13
|
+
open: '/index.html',
|
|
14
|
+
},
|
|
15
|
+
build: {
|
|
16
|
+
outDir: resolve(__dirname, 'dist-examples'),
|
|
17
|
+
},
|
|
18
|
+
resolve: {
|
|
19
|
+
alias: {
|
|
20
|
+
'@ai-chat/core': resolve(__dirname, 'packages/core/src'),
|
|
21
|
+
'@ai-chat/components': resolve(__dirname, 'packages/components/src'),
|
|
22
|
+
'@ai-chat/themes': resolve(__dirname, 'packages/themes/src'),
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated-by AI: edenxpzhang
|
|
3
|
+
* @generated-date 2026-05-13
|
|
4
|
+
*/
|
|
5
|
+
import { defineConfig } from 'vitest/config';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
test: {
|
|
10
|
+
globals: true,
|
|
11
|
+
environment: 'node',
|
|
12
|
+
include: ['packages/*/src/**/*.test.{ts,tsx}'],
|
|
13
|
+
exclude: ['node_modules', 'dist', 'packages/*/dist'],
|
|
14
|
+
coverage: {
|
|
15
|
+
provider: 'v8',
|
|
16
|
+
reporter: ['text', 'json', 'html'],
|
|
17
|
+
include: ['packages/*/src/**/*.ts'],
|
|
18
|
+
exclude: ['packages/*/src/**/*.test.ts', 'packages/*/src/types/**'],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
resolve: {
|
|
22
|
+
alias: {
|
|
23
|
+
'@ai-chat/core': path.resolve(__dirname, 'packages/core/src'),
|
|
24
|
+
'@ai-chat/components': path.resolve(__dirname, 'packages/components/src'),
|
|
25
|
+
'@ai-chat/themes': path.resolve(__dirname, 'packages/themes/src'),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|