@designa8/vibedesign-v6 1.10.5 → 1.10.7
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 +1 -1
- package/dist/index.cjs +186 -277
- package/dist/index.js +186 -277
- package/dist/styles.css +15 -54
- package/package.json +1 -1
- package/src/atoms/ChatScreen/ChatScreen.tsx +205 -263
- package/src/atoms/ChatScreen/preview.tsx +39 -210
- package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +34 -7
- package/src/atoms/HomePageTemplate/index.ts +1 -0
|
@@ -1,239 +1,68 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ChatScreen, ChatMessage } from "./ChatScreen";
|
|
3
|
-
import { Button } from "../Button";
|
|
4
|
-
import { Input } from "../Input";
|
|
5
3
|
|
|
6
|
-
const
|
|
7
|
-
{ id: "gpt-4o", name: "GPT-4o", tier: "Pro", description: "Most capable model" },
|
|
8
|
-
{ id: "gpt-4o-mini", name: "GPT-4o mini", tier: "Free", description: "Fast and efficient" },
|
|
9
|
-
{ id: "claude-3-5", name: "Claude 3.5 Sonnet", tier: "Pro", description: "Great for coding" },
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
/** A minimal custom footer to demo the renderFooter prop */
|
|
13
|
-
const CustomFooter: React.FC = () => (
|
|
14
|
-
<div className="w-full px-lg py-md border-t border-hairline-soft bg-surface-soft flex items-center gap-md">
|
|
15
|
-
<Input
|
|
16
|
-
placeholder="Custom footer input…"
|
|
17
|
-
size="sm"
|
|
18
|
-
fullWidth
|
|
19
|
-
/>
|
|
20
|
-
<Button size="sm">Send</Button>
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
// ─── Messages for the live-agent demo ────────────────────────────────────────
|
|
25
|
-
|
|
26
|
-
const LIVE_AGENT_MESSAGES: ChatMessage[] = [
|
|
4
|
+
const messagesWithTimeline: ChatMessage[] = [
|
|
27
5
|
{
|
|
28
6
|
id: "1",
|
|
29
7
|
role: "user",
|
|
30
|
-
content: "Build a
|
|
31
|
-
userInitials: "
|
|
8
|
+
content: "Build a Button atom with primary, secondary, and ghost variants.",
|
|
9
|
+
userInitials: "ME",
|
|
32
10
|
},
|
|
33
11
|
{
|
|
34
12
|
id: "2",
|
|
35
13
|
role: "ai",
|
|
36
|
-
content: "
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
status: "in_progress",
|
|
45
|
-
currentTool: "Writing atom",
|
|
46
|
-
},
|
|
47
|
-
{ id: "p3", label: "Write preview.tsx with variants", status: "pending" },
|
|
48
|
-
{ id: "p4", label: "Verify and fix lint issues", status: "pending" },
|
|
49
|
-
],
|
|
50
|
-
},
|
|
14
|
+
content: "I'll build the Button atom now. Tracking progress below:",
|
|
15
|
+
timeline: [
|
|
16
|
+
{ id: "t1", kind: "thinking", label: "Planning component API and variants", status: "done" },
|
|
17
|
+
{ id: "t2", kind: "read", label: "Reading design tokens", detail: "colors, spacing, rounded", status: "done" },
|
|
18
|
+
{ id: "t3", kind: "write", label: "Writing Button.tsx", status: "done" },
|
|
19
|
+
{ id: "t4", kind: "write", label: "Writing index.ts", status: "done" },
|
|
20
|
+
{ id: "t5", kind: "verify", label: "Verifying atom passes linter", status: "running" },
|
|
21
|
+
],
|
|
51
22
|
inFlight: true,
|
|
52
|
-
currentToolLabel: "
|
|
23
|
+
currentToolLabel: "Verifying…",
|
|
53
24
|
},
|
|
54
|
-
];
|
|
55
|
-
|
|
56
|
-
// ─── Messages showing all four task statuses ─────────────────────────────────
|
|
57
|
-
|
|
58
|
-
const MIXED_STATUS_MESSAGES: ChatMessage[] = [
|
|
59
25
|
{
|
|
60
|
-
id: "
|
|
26
|
+
id: "3",
|
|
61
27
|
role: "user",
|
|
62
|
-
content: "
|
|
63
|
-
userInitials: "
|
|
28
|
+
content: "Great, also add a destructive variant.",
|
|
29
|
+
userInitials: "ME",
|
|
64
30
|
},
|
|
65
31
|
{
|
|
66
|
-
id: "
|
|
32
|
+
id: "4",
|
|
67
33
|
role: "ai",
|
|
68
|
-
content: "
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
id: "t3",
|
|
76
|
-
label: "Regenerate theme CSS variables",
|
|
77
|
-
status: "failed",
|
|
78
|
-
},
|
|
79
|
-
{ id: "t4", label: "Verify preview renders correctly", status: "pending" },
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
inFlight: false,
|
|
34
|
+
content: "Adding the destructive variant now.",
|
|
35
|
+
timeline: [
|
|
36
|
+
{ id: "t6", kind: "read", label: "Reading Button.tsx", status: "done" },
|
|
37
|
+
{ id: "t7", kind: "write", label: "Writing updated Button.tsx with destructive variant", status: "done" },
|
|
38
|
+
{ id: "t8", kind: "verify", label: "Atom verified successfully", status: "done" },
|
|
39
|
+
],
|
|
40
|
+
postContent: "The Button atom now has four variants: primary, secondary, ghost, and destructive.",
|
|
83
41
|
},
|
|
84
|
-
];
|
|
85
|
-
|
|
86
|
-
// ─── Messages demonstrating postContent ──────────────────────────────────────
|
|
87
|
-
|
|
88
|
-
const POST_CONTENT_MESSAGES: ChatMessage[] = [
|
|
89
42
|
{
|
|
90
|
-
id: "
|
|
91
|
-
role: "
|
|
92
|
-
content: "
|
|
93
|
-
|
|
43
|
+
id: "5",
|
|
44
|
+
role: "ai",
|
|
45
|
+
content: "Here's a message with only a single timeline step (no expand toggle needed).",
|
|
46
|
+
timeline: [
|
|
47
|
+
{ id: "t9", kind: "tool", label: "Called figma_get_design", detail: "node-id: 1234:5678", status: "done" },
|
|
48
|
+
],
|
|
94
49
|
},
|
|
95
50
|
{
|
|
96
|
-
id: "
|
|
51
|
+
id: "6",
|
|
97
52
|
role: "ai",
|
|
98
|
-
content: "
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
{ id: "s3", label: "Write preview.tsx with three tab variants", status: "done" },
|
|
105
|
-
],
|
|
106
|
-
},
|
|
107
|
-
postContent:
|
|
108
|
-
"All three tasks are complete. The Tabs atom is live in your workspace — open the preview to see the active underline in action and try switching tabs with the arrow keys.",
|
|
53
|
+
content: "And here's an error state in the timeline.",
|
|
54
|
+
timeline: [
|
|
55
|
+
{ id: "t10", kind: "thinking", label: "Planning layout structure", status: "done" },
|
|
56
|
+
{ id: "t11", kind: "read", label: "Reading reference atom", status: "done" },
|
|
57
|
+
{ id: "t12", kind: "write", label: "Writing component file", status: "error" },
|
|
58
|
+
],
|
|
109
59
|
},
|
|
110
60
|
];
|
|
111
61
|
|
|
112
|
-
export default function
|
|
113
|
-
const [modelId, setModelId] = React.useState("gpt-4o");
|
|
114
|
-
|
|
62
|
+
export default function Preview() {
|
|
115
63
|
return (
|
|
116
|
-
<div className="w-full max-w-3xl mx-auto
|
|
117
|
-
|
|
118
|
-
{/* 0. Empty state — default built-in (messages={[]}) */}
|
|
119
|
-
<div>
|
|
120
|
-
<p className="text-caption text-muted mb-sm">
|
|
121
|
-
Empty state — messages={"{[]}"} shows illustration + default copy
|
|
122
|
-
</p>
|
|
123
|
-
<div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "420px" }}>
|
|
124
|
-
<ChatScreen
|
|
125
|
-
messages={[]}
|
|
126
|
-
models={DEMO_MODELS}
|
|
127
|
-
selectedModelId={modelId}
|
|
128
|
-
onModelChange={setModelId}
|
|
129
|
-
/>
|
|
130
|
-
</div>
|
|
131
|
-
</div>
|
|
132
|
-
|
|
133
|
-
{/* 0b. Empty state — custom title + description */}
|
|
134
|
-
<div>
|
|
135
|
-
<p className="text-caption text-muted mb-sm">
|
|
136
|
-
Empty state — custom emptyTitle + emptyDescription props
|
|
137
|
-
</p>
|
|
138
|
-
<div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "360px" }}>
|
|
139
|
-
<ChatScreen
|
|
140
|
-
messages={[]}
|
|
141
|
-
emptyTitle="No messages yet"
|
|
142
|
-
emptyDescription="Send your first message to get started building your design system."
|
|
143
|
-
models={DEMO_MODELS}
|
|
144
|
-
selectedModelId={modelId}
|
|
145
|
-
onModelChange={setModelId}
|
|
146
|
-
/>
|
|
147
|
-
</div>
|
|
148
|
-
</div>
|
|
149
|
-
|
|
150
|
-
{/* 0c. Empty state — custom emptyState node */}
|
|
151
|
-
<div>
|
|
152
|
-
<p className="text-caption text-muted mb-sm">
|
|
153
|
-
Empty state — emptyState prop replaces built-in content entirely
|
|
154
|
-
</p>
|
|
155
|
-
<div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "320px" }}>
|
|
156
|
-
<ChatScreen
|
|
157
|
-
messages={[]}
|
|
158
|
-
emptyState={
|
|
159
|
-
<div className="flex flex-col items-center gap-md text-center px-xl">
|
|
160
|
-
<span className="text-xxl">🎨</span>
|
|
161
|
-
<p className="text-heading-sm font-weight-heading-sm text-ink">Custom empty state</p>
|
|
162
|
-
<p className="text-body-sm text-muted">You can pass any React node via the emptyState prop.</p>
|
|
163
|
-
</div>
|
|
164
|
-
}
|
|
165
|
-
models={DEMO_MODELS}
|
|
166
|
-
selectedModelId={modelId}
|
|
167
|
-
onModelChange={setModelId}
|
|
168
|
-
/>
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
|
|
172
|
-
{/* 1. Live-agent: inFlight + in_progress task + currentToolLabel */}
|
|
173
|
-
<div>
|
|
174
|
-
<p className="text-caption text-muted mb-sm">
|
|
175
|
-
Live agent — inFlight bubble with spinner + in_progress task row (avatar center-aligned)
|
|
176
|
-
</p>
|
|
177
|
-
<div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "480px" }}>
|
|
178
|
-
<ChatScreen
|
|
179
|
-
messages={LIVE_AGENT_MESSAGES}
|
|
180
|
-
models={DEMO_MODELS}
|
|
181
|
-
selectedModelId={modelId}
|
|
182
|
-
onModelChange={setModelId}
|
|
183
|
-
/>
|
|
184
|
-
</div>
|
|
185
|
-
</div>
|
|
186
|
-
|
|
187
|
-
{/* 2. postContent — text rendered after the plan card */}
|
|
188
|
-
<div>
|
|
189
|
-
<p className="text-caption text-muted mb-sm">
|
|
190
|
-
postContent prop — additional text rendered below the plan card
|
|
191
|
-
</p>
|
|
192
|
-
<div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "440px" }}>
|
|
193
|
-
<ChatScreen
|
|
194
|
-
messages={POST_CONTENT_MESSAGES}
|
|
195
|
-
models={DEMO_MODELS}
|
|
196
|
-
selectedModelId={modelId}
|
|
197
|
-
onModelChange={setModelId}
|
|
198
|
-
/>
|
|
199
|
-
</div>
|
|
200
|
-
</div>
|
|
201
|
-
|
|
202
|
-
{/* 3. Mixed statuses: done, failed, pending-hidden */}
|
|
203
|
-
<div>
|
|
204
|
-
<p className="text-caption text-muted mb-sm">
|
|
205
|
-
Mixed task statuses — done (strikethrough), failed (red ✕), pending hidden
|
|
206
|
-
</p>
|
|
207
|
-
<div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "400px" }}>
|
|
208
|
-
<ChatScreen
|
|
209
|
-
messages={MIXED_STATUS_MESSAGES}
|
|
210
|
-
models={DEMO_MODELS}
|
|
211
|
-
selectedModelId={modelId}
|
|
212
|
-
onModelChange={setModelId}
|
|
213
|
-
/>
|
|
214
|
-
</div>
|
|
215
|
-
</div>
|
|
216
|
-
|
|
217
|
-
{/* 4. Default message list + model selector (userInitials "DU") */}
|
|
218
|
-
<div>
|
|
219
|
-
<p className="text-caption text-muted mb-sm">Default message list + model selector (userInitials="DU") with postContent after plan card</p>
|
|
220
|
-
<div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "520px" }}>
|
|
221
|
-
<ChatScreen
|
|
222
|
-
models={DEMO_MODELS}
|
|
223
|
-
selectedModelId={modelId}
|
|
224
|
-
onModelChange={setModelId}
|
|
225
|
-
/>
|
|
226
|
-
</div>
|
|
227
|
-
</div>
|
|
228
|
-
|
|
229
|
-
{/* 5. renderFooter — replaces the default PromptInputBar section entirely */}
|
|
230
|
-
<div>
|
|
231
|
-
<p className="text-caption text-muted mb-sm">renderFooter prop replaces the default PromptInputBar</p>
|
|
232
|
-
<div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "360px" }}>
|
|
233
|
-
<ChatScreen renderFooter={<CustomFooter />} />
|
|
234
|
-
</div>
|
|
235
|
-
</div>
|
|
236
|
-
|
|
64
|
+
<div className="w-full max-w-3xl mx-auto" style={{ height: 640 }}>
|
|
65
|
+
<ChatScreen messages={messagesWithTimeline} placeholder="Ask anything…" />
|
|
237
66
|
</div>
|
|
238
67
|
);
|
|
239
68
|
}
|
|
@@ -4,7 +4,7 @@ import type { NavEntry } from "../AppSidebar";
|
|
|
4
4
|
import { AppSidebarMobile } from "../AppSidebarMobile";
|
|
5
5
|
import { PromptInputBar } from "../PromptInputBar";
|
|
6
6
|
import { Button } from "../Button";
|
|
7
|
-
import type { PromptMode } from "../PromptInputBar";
|
|
7
|
+
import type { PromptMode, PromptInputBarModel } from "../PromptInputBar";
|
|
8
8
|
|
|
9
9
|
/* ─── Icons ─────────────────────────────────────────────────────────────── */
|
|
10
10
|
|
|
@@ -53,6 +53,15 @@ const SuggestionChip: React.FC<SuggestionChipProps> = ({ label, onClick }) => (
|
|
|
53
53
|
</Button>
|
|
54
54
|
);
|
|
55
55
|
|
|
56
|
+
/* ─── Default model list ─────────────────────────────────────────────────── */
|
|
57
|
+
const DEFAULT_MODELS: PromptInputBarModel[] = [
|
|
58
|
+
{ id: "claude-sonnet", name: "Claude Sonnet 4.6" },
|
|
59
|
+
{ id: "claude-haiku", name: "Claude Haiku 3.5", tier: "Fast" },
|
|
60
|
+
{ id: "claude-opus", name: "Claude Opus 4", tier: "Pro" },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const DEFAULT_SELECTED_MODEL_ID = "claude-sonnet";
|
|
64
|
+
|
|
56
65
|
/* ─── Types ──────────────────────────────────────────────────────────────── */
|
|
57
66
|
|
|
58
67
|
export interface HomePageTemplateProps {
|
|
@@ -103,6 +112,20 @@ export interface HomePageTemplateProps {
|
|
|
103
112
|
* Forwarded to both AppSidebar and AppSidebarMobile.
|
|
104
113
|
*/
|
|
105
114
|
onDarkModeToggle?: () => void;
|
|
115
|
+
/**
|
|
116
|
+
* List of available AI models forwarded to PromptInputBar.
|
|
117
|
+
* When omitted, the built-in DEFAULT_MODELS list is used.
|
|
118
|
+
*/
|
|
119
|
+
models?: PromptInputBarModel[];
|
|
120
|
+
/**
|
|
121
|
+
* Currently selected model id forwarded to PromptInputBar.
|
|
122
|
+
* When omitted, defaults to "claude-sonnet".
|
|
123
|
+
*/
|
|
124
|
+
selectedModelId?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Called when the user picks a different model in PromptInputBar.
|
|
127
|
+
*/
|
|
128
|
+
onModelChange?: (modelId: string) => void;
|
|
106
129
|
className?: string;
|
|
107
130
|
style?: React.CSSProperties;
|
|
108
131
|
}
|
|
@@ -158,6 +181,9 @@ export const HomePageTemplate = React.forwardRef<HTMLDivElement, HomePageTemplat
|
|
|
158
181
|
onSubSelect,
|
|
159
182
|
darkMode,
|
|
160
183
|
onDarkModeToggle,
|
|
184
|
+
models,
|
|
185
|
+
selectedModelId,
|
|
186
|
+
onModelChange,
|
|
161
187
|
className,
|
|
162
188
|
style,
|
|
163
189
|
},
|
|
@@ -174,6 +200,10 @@ export const HomePageTemplate = React.forwardRef<HTMLDivElement, HomePageTemplat
|
|
|
174
200
|
|
|
175
201
|
const textValue = promptValue !== undefined ? promptValue : internalPrompt;
|
|
176
202
|
|
|
203
|
+
// Resolve model list and selected model id, falling back to hardcoded defaults.
|
|
204
|
+
const resolvedModels = models !== undefined ? models : DEFAULT_MODELS;
|
|
205
|
+
const resolvedSelectedModelId = selectedModelId !== undefined ? selectedModelId : DEFAULT_SELECTED_MODEL_ID;
|
|
206
|
+
|
|
177
207
|
const handleChange = (val: string) => {
|
|
178
208
|
if (promptValue === undefined) setInternalPrompt(val);
|
|
179
209
|
onPromptChange?.(val);
|
|
@@ -314,12 +344,9 @@ export const HomePageTemplate = React.forwardRef<HTMLDivElement, HomePageTemplat
|
|
|
314
344
|
onModeChange={onModeChange}
|
|
315
345
|
onSend={handleSend}
|
|
316
346
|
onMic={() => {}}
|
|
317
|
-
models={
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
{ id: "claude-opus", name: "Claude Opus 4", tier: "Pro" },
|
|
321
|
-
]}
|
|
322
|
-
selectedModelId="claude-sonnet"
|
|
347
|
+
models={resolvedModels}
|
|
348
|
+
selectedModelId={resolvedSelectedModelId}
|
|
349
|
+
onModelChange={onModelChange}
|
|
323
350
|
/>
|
|
324
351
|
</div>
|
|
325
352
|
|