@designa8/vibedesign-v6 1.20.19 → 2.1.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.
Files changed (123) hide show
  1. package/README.md +1 -1
  2. package/dist/fonts/plusjakartasans/PlusJakartaSans-Italic[wght].ttf +0 -0
  3. package/dist/fonts/plusjakartasans/PlusJakartaSans[wght].ttf +0 -0
  4. package/dist/index.cjs +12027 -4942
  5. package/dist/index.js +12089 -5004
  6. package/dist/styles.css +1393 -97
  7. package/package.json +116 -1
  8. package/src/atoms/AgentQuestionCard/AgentQuestionCard.tsx +567 -0
  9. package/src/atoms/AgentQuestionCard/index.ts +6 -0
  10. package/src/atoms/AgentQuestionCard/preview.tsx +199 -0
  11. package/src/atoms/AppLayout/AppLayout.tsx +85 -22
  12. package/src/atoms/AppLayout/preview.tsx +4 -0
  13. package/src/atoms/AppSidebar/AppSidebar.tsx +222 -137
  14. package/src/atoms/AppSidebar/preview.tsx +61 -8
  15. package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +241 -169
  16. package/src/atoms/AppSidebarMobile/preview.tsx +59 -89
  17. package/src/atoms/AuthLogin/AuthLogin.tsx +86 -49
  18. package/src/atoms/AuthLogin/preview.tsx +16 -0
  19. package/src/atoms/AuthSignUp/AuthSignUp.tsx +206 -126
  20. package/src/atoms/AuthSignUp/preview.tsx +10 -0
  21. package/src/atoms/BillingToggle/BillingToggle.tsx +2 -2
  22. package/src/atoms/BottomSheet/BottomSheet.tsx +199 -0
  23. package/src/atoms/BottomSheet/index.ts +2 -0
  24. package/src/atoms/BottomSheet/preview.tsx +50 -0
  25. package/src/atoms/Button/Button.tsx +19 -3
  26. package/src/atoms/Button/preview.tsx +2 -1
  27. package/src/atoms/ChatHistorySidebar/ChatHistorySidebar.tsx +160 -84
  28. package/src/atoms/ChatHistorySidebar/preview.tsx +81 -42
  29. package/src/atoms/ChatScreen/ChatScreen.tsx +298 -33
  30. package/src/atoms/ChatScreen/preview.tsx +54 -90
  31. package/src/atoms/Chip/Chip.tsx +81 -33
  32. package/src/atoms/Chip/preview.tsx +39 -21
  33. package/src/atoms/CodeEditor/CodeEditor.tsx +10 -4
  34. package/src/atoms/ComponentActionsSheet/ComponentActionsSheet.tsx +165 -0
  35. package/src/atoms/ComponentActionsSheet/index.ts +7 -0
  36. package/src/atoms/ComponentActionsSheet/preview.tsx +67 -0
  37. package/src/atoms/ComponentCard/ComponentCard.tsx +17 -35
  38. package/src/atoms/ComponentCard/preview.tsx +9 -9
  39. package/src/atoms/DesignSystemLoader/DesignSystemLoader.tsx +153 -0
  40. package/src/atoms/DesignSystemLoader/index.ts +2 -0
  41. package/src/atoms/DesignSystemLoader/preview.tsx +19 -0
  42. package/src/atoms/DesignSystemShowcase/DesignSystemShowcase.tsx +410 -0
  43. package/src/atoms/DesignSystemShowcase/index.ts +6 -0
  44. package/src/atoms/DesignSystemShowcase/preview.tsx +22 -0
  45. package/src/atoms/DesignTokensPanel/DesignTokensPanel.data.ts +254 -0
  46. package/src/atoms/DesignTokensPanel/DesignTokensPanel.tsx +946 -0
  47. package/src/atoms/DesignTokensPanel/index.ts +9 -0
  48. package/src/atoms/DesignTokensPanel/preview.tsx +39 -0
  49. package/src/atoms/ExpandableMessage/ExpandableMessage.tsx +239 -0
  50. package/src/atoms/ExpandableMessage/fix-link-note.txt +3 -0
  51. package/src/atoms/ExpandableMessage/index.ts +2 -0
  52. package/src/atoms/ExpandableMessage/markdown.tsx +310 -0
  53. package/src/atoms/ExpandableMessage/preview.tsx +83 -0
  54. package/src/atoms/FilterTabBar/FilterTabBar.tsx +2 -2
  55. package/src/atoms/FontCombobox/FontCombobox.tsx +655 -0
  56. package/src/atoms/FontCombobox/index.ts +6 -0
  57. package/src/atoms/FontCombobox/preview.tsx +111 -0
  58. package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +894 -96
  59. package/src/atoms/HomePageTemplate/preview.tsx +4 -0
  60. package/src/atoms/Icon/Icon.tsx +17 -11
  61. package/src/atoms/Icon/icons.data.ts +34 -0
  62. package/src/atoms/Input/Input.tsx +37 -21
  63. package/src/atoms/LandingHero/LandingHero.tsx +545 -0
  64. package/src/atoms/LandingHero/index.ts +6 -0
  65. package/src/atoms/LandingHero/preview.tsx +88 -0
  66. package/src/atoms/MarketingFooter/MarketingFooter.tsx +215 -0
  67. package/src/atoms/MarketingFooter/index.ts +7 -0
  68. package/src/atoms/MarketingFooter/preview.tsx +28 -0
  69. package/src/atoms/MarketingNavbar/MarketingNavbar.tsx +451 -0
  70. package/src/atoms/MarketingNavbar/index.ts +7 -0
  71. package/src/atoms/MarketingNavbar/preview.tsx +109 -0
  72. package/src/atoms/MobileActionsDrawer/MobileActionsDrawer.tsx +548 -0
  73. package/src/atoms/MobileActionsDrawer/index.ts +9 -0
  74. package/src/atoms/MobileActionsDrawer/preview.tsx +109 -0
  75. package/src/atoms/Modal/Modal.tsx +77 -28
  76. package/src/atoms/PreviewDock/PreviewDock.tsx +119 -0
  77. package/src/atoms/PreviewDock/index.ts +2 -0
  78. package/src/atoms/PreviewDock/preview.tsx +30 -0
  79. package/src/atoms/PreviewToolbar/PreviewToolbar.tsx +47 -30
  80. package/src/atoms/PricingCard/PricingCard.tsx +15 -4
  81. package/src/atoms/PricingPageTemplate/PricingPageTemplate.tsx +109 -89
  82. package/src/atoms/ProjectSettingsModal/ProjectSettingsModal.tsx +314 -0
  83. package/src/atoms/ProjectSettingsModal/index.ts +2 -0
  84. package/src/atoms/ProjectSettingsModal/preview.tsx +130 -0
  85. package/src/atoms/ProjectSettingsModal/switch.snippet.txt +8 -0
  86. package/src/atoms/PromptInputBar/PromptInputBar.tsx +750 -302
  87. package/src/atoms/PromptInputBar/preview.tsx +64 -64
  88. package/src/atoms/SettingsPageTemplate/SettingsPageTemplate.tsx +272 -0
  89. package/src/atoms/SettingsPageTemplate/index.ts +2 -0
  90. package/src/atoms/SettingsPageTemplate/preview.tsx +29 -0
  91. package/src/atoms/SidebarUpgradeBanner/SidebarUpgradeBanner.tsx +178 -0
  92. package/src/atoms/SidebarUpgradeBanner/index.ts +2 -0
  93. package/src/atoms/SidebarUpgradeBanner/preview.tsx +47 -0
  94. package/src/atoms/SkeletonChip/SkeletonChip.tsx +198 -0
  95. package/src/atoms/SkeletonChip/index.ts +2 -0
  96. package/src/atoms/SkeletonChip/preview.tsx +44 -0
  97. package/src/atoms/TemplateHeader/TemplateHeader.tsx +129 -0
  98. package/src/atoms/TemplateHeader/index.ts +2 -0
  99. package/src/atoms/TemplateHeader/preview.tsx +39 -0
  100. package/src/atoms/TemplateHero/TemplateHero.tsx +286 -0
  101. package/src/atoms/TemplateHero/index.ts +2 -0
  102. package/src/atoms/TemplateHero/preview.tsx +32 -0
  103. package/src/atoms/TemplateSummary/TemplateSummary.tsx +85 -0
  104. package/src/atoms/TemplateSummary/index.ts +2 -0
  105. package/src/atoms/TemplateSummary/preview.tsx +10 -0
  106. package/src/atoms/Toast/Toast.tsx +178 -0
  107. package/src/atoms/Toast/index.ts +2 -0
  108. package/src/atoms/Toast/preview.tsx +100 -0
  109. package/src/atoms/TopNavbar/TopNavbar.tsx +145 -67
  110. package/src/atoms/TopNavbar/preview.tsx +13 -7
  111. package/src/atoms/TopupModal/TopupModal.tsx +94 -0
  112. package/src/atoms/TopupModal/index.ts +2 -0
  113. package/src/atoms/TopupModal/preview.tsx +22 -0
  114. package/src/atoms/UpgradeCard/UpgradeCard.tsx +124 -43
  115. package/src/atoms/UpgradeCard/index.ts +1 -1
  116. package/src/atoms/UpgradeCard/preview.tsx +7 -14
  117. package/src/atoms/UpgradeModal/UpgradeModal.tsx +192 -0
  118. package/src/atoms/UpgradeModal/index.ts +2 -0
  119. package/src/atoms/UpgradeModal/preview.tsx +41 -0
  120. package/src/index.ts +23 -0
  121. package/src/tokens.css +45 -7
  122. package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
  123. package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
@@ -34,6 +34,497 @@ const DEFAULT_MODELS: PromptInputBarModel[] = [
34
34
 
35
35
  const DEFAULT_SELECTED_MODEL_ID = "claude-sonnet";
36
36
 
37
+ /* ─── Default prompt placeholder ─────────────────────────────────────────── */
38
+ const DEFAULT_PLACEHOLDER = "Describe an atom or design token to create...";
39
+
40
+ /* ─── Rotating headline word default ────────────────────────────────────── */
41
+ const DEFAULT_ROTATING_WORDS = ["atom", "Molecule", "Organism", "Template"];
42
+
43
+ /* ─── Reduced motion hook ────────────────────────────────────────────────── */
44
+ function usePrefersReducedMotion(): boolean {
45
+ const [reduced, setReduced] = React.useState(false);
46
+ React.useEffect(() => {
47
+ if (typeof window === "undefined" || !window.matchMedia) return;
48
+ const mql = window.matchMedia("(prefers-reduced-motion: reduce)");
49
+ setReduced(mql.matches);
50
+ const handler = (e: MediaQueryListEvent) => setReduced(e.matches);
51
+ mql.addEventListener?.("change", handler);
52
+ return () => mql.removeEventListener?.("change", handler);
53
+ }, []);
54
+ return reduced;
55
+ }
56
+
57
+ /* ─── Rotating word ──────────────────────────────────────────────────────── */
58
+ interface RotatingWordProps {
59
+ words: string[];
60
+ }
61
+
62
+ const RotatingWord: React.FC<RotatingWordProps> = ({ words }) => {
63
+ const reducedMotion = usePrefersReducedMotion();
64
+ const [index, setIndex] = React.useState(0);
65
+ const [prevWord, setPrevWord] = React.useState<string | null>(null);
66
+ const wordsRef = React.useRef(words);
67
+ wordsRef.current = words;
68
+
69
+ React.useEffect(() => {
70
+ if (reducedMotion || words.length <= 1) return;
71
+ let exitTimeout: number | undefined;
72
+ const id = window.setInterval(() => {
73
+ setIndex((i) => {
74
+ setPrevWord(wordsRef.current[i]);
75
+ window.clearTimeout(exitTimeout);
76
+ exitTimeout = window.setTimeout(() => setPrevWord(null), 420);
77
+ return (i + 1) % wordsRef.current.length;
78
+ });
79
+ }, 2500);
80
+ return () => {
81
+ window.clearInterval(id);
82
+ window.clearTimeout(exitTimeout);
83
+ };
84
+ }, [reducedMotion, words.length]);
85
+
86
+ const longest = words.reduce((a, b) => (b.length > a.length ? b : a), words[0] ?? "");
87
+
88
+ if (reducedMotion || words.length <= 1) {
89
+ return (
90
+ <span
91
+ className="relative inline-block align-baseline text-primary"
92
+ style={{ minWidth: `${longest.length}ch` }}
93
+ >
94
+ {words[0]}
95
+ </span>
96
+ );
97
+ }
98
+
99
+ return (
100
+ <span
101
+ className="relative inline-block align-baseline overflow-hidden text-primary"
102
+ style={{ minWidth: `${longest.length}ch`, height: "1.3em", verticalAlign: "bottom" }}
103
+ aria-hidden="true"
104
+ >
105
+ {prevWord !== null && (
106
+ <span className="absolute inset-0 hpt-word-exit">{prevWord}</span>
107
+ )}
108
+ <span key={index} className="absolute inset-0 hpt-word-enter">
109
+ {words[index]}
110
+ </span>
111
+ </span>
112
+ );
113
+ };
114
+
115
+ /* ─── Gradient headline span ─────────────────────────────────────────────── */
116
+ /*
117
+ * Gradient fill is applied INLINE (not only via a class) so it always paints
118
+ * even if Tailwind/CSS processing strips or reorders the scoped <style> block.
119
+ * If background-clip: text fails in a given renderer, WebkitTextFillColor is
120
+ * still set to transparent which can blank the text — so we ALSO set a plain
121
+ * `color: var(--color-primary)` fallback first; supporting browsers then
122
+ * override the paint via the clipped background, and non-supporting ones keep
123
+ * the solid fallback color instead of invisible text.
124
+ *
125
+ * overflow is explicitly "visible" and a small bottom padding is added so the
126
+ * clipped gradient paint has room to include descenders (the g in "Design",
127
+ * the y in "system") instead of being cut off by a tight line box.
128
+ */
129
+ const GradientHeadlineWords: React.FC = () => (
130
+ <span
131
+ className="hpt-gradient-text inline-block"
132
+ style={{
133
+ color: "var(--color-primary)",
134
+ backgroundImage:
135
+ "linear-gradient(90deg, var(--color-logo-violet), var(--color-primary), var(--color-logo-pink), var(--color-logo-orange))",
136
+ backgroundSize: "200% 100%",
137
+ WebkitBackgroundClip: "text",
138
+ backgroundClip: "text",
139
+ WebkitTextFillColor: "transparent",
140
+ display: "inline-block",
141
+ overflow: "visible",
142
+ paddingBottom: "0.12em",
143
+ }}
144
+ >
145
+ Design system
146
+ </span>
147
+ );
148
+
149
+ /* ─── Animated background — light mesh-blob hero ─────────────────────────
150
+ * High-key, mostly-white composition: a faint lavender veil across the top,
151
+ * two on-canvas frosted blob clusters — violet stacked ovals in the
152
+ * upper-right quadrant, peach/coral stacked ovals in the lower-right
153
+ * quadrant — that melt into each other along the mid-right edge. Each
154
+ * cluster is built from 3 overlapping ellipses (not a single blob) so it
155
+ * reads as a stacked mesh. Everything is translucent + moderately blurred so
156
+ * the center of the canvas stays near-white and legible. Each cluster
157
+ * drifts/scales on its own slow ease-in-out loop; the loops are frozen (not
158
+ * removed) under prefers-reduced-motion so the composition stays identical,
159
+ * just static. ── */
160
+ const AnimatedBackground: React.FC = () => (
161
+ <div aria-hidden="true" className="absolute inset-0 overflow-hidden pointer-events-none">
162
+ {/* Base canvas fill */}
163
+ <div className="absolute inset-0" style={{ background: "var(--color-canvas)" }} />
164
+
165
+ {/* Soft lavender/periwinkle diagonal veil across the upper-left/top */}
166
+ <div
167
+ className="absolute inset-0"
168
+ style={{
169
+ background:
170
+ "linear-gradient(135deg, color-mix(in srgb, var(--color-logo-violet) 22%, transparent) 0%, color-mix(in srgb, var(--color-primary-disabled) 16%, transparent) 32%, transparent 62%)",
171
+ }}
172
+ />
173
+
174
+ {/* Upper-right violet / periwinkle cluster — centered ~55% from left, ~15% from top */}
175
+ <div
176
+ className="absolute hpt-mesh-violet"
177
+ style={{ top: "-4%", left: "38%", width: "48%", height: "44%" }}
178
+ >
179
+ <div
180
+ className="absolute rounded-full"
181
+ style={{
182
+ top: "6%",
183
+ left: "18%",
184
+ width: "72%",
185
+ height: "78%",
186
+ background: "color-mix(in srgb, var(--color-logo-violet) 68%, transparent)",
187
+ filter: "blur(46px)",
188
+ transform: "rotate(-10deg)",
189
+ }}
190
+ />
191
+ <div
192
+ className="absolute rounded-full"
193
+ style={{
194
+ top: "22%",
195
+ left: "0%",
196
+ width: "58%",
197
+ height: "60%",
198
+ background: "color-mix(in srgb, var(--color-primary-disabled) 65%, transparent)",
199
+ filter: "blur(40px)",
200
+ transform: "rotate(8deg)",
201
+ }}
202
+ />
203
+ <div
204
+ className="absolute rounded-full"
205
+ style={{
206
+ top: "0%",
207
+ left: "42%",
208
+ width: "50%",
209
+ height: "52%",
210
+ background: "color-mix(in srgb, var(--color-logo-violet) 50%, transparent)",
211
+ filter: "blur(36px)",
212
+ transform: "rotate(-4deg)",
213
+ }}
214
+ />
215
+ </div>
216
+
217
+ {/* Lower-right peach / coral cluster — centered ~60% from left, ~55% from top */}
218
+ <div
219
+ className="absolute hpt-mesh-peach"
220
+ style={{ top: "34%", left: "42%", width: "50%", height: "48%" }}
221
+ >
222
+ <div
223
+ className="absolute rounded-full"
224
+ style={{
225
+ top: "10%",
226
+ left: "16%",
227
+ width: "72%",
228
+ height: "76%",
229
+ background: "color-mix(in srgb, var(--color-logo-orange) 62%, transparent)",
230
+ filter: "blur(48px)",
231
+ transform: "rotate(6deg)",
232
+ }}
233
+ />
234
+ <div
235
+ className="absolute rounded-full"
236
+ style={{
237
+ top: "0%",
238
+ left: "0%",
239
+ width: "56%",
240
+ height: "58%",
241
+ background: "color-mix(in srgb, var(--color-logo-pink) 55%, transparent)",
242
+ filter: "blur(42px)",
243
+ transform: "rotate(-8deg)",
244
+ }}
245
+ />
246
+ <div
247
+ className="absolute rounded-full"
248
+ style={{
249
+ top: "30%",
250
+ left: "46%",
251
+ width: "50%",
252
+ height: "52%",
253
+ background: "color-mix(in srgb, var(--color-logo-orange) 45%, transparent)",
254
+ filter: "blur(38px)",
255
+ transform: "rotate(12deg)",
256
+ }}
257
+ />
258
+ </div>
259
+ </div>
260
+ );
261
+
262
+ /* ─── Drag/crawl marquee — two opposite-crawling rows ────────────────────
263
+ * Auto-scroll is a constant-speed JS translateX loop (rAF), not a CSS
264
+ * keyframe, so speed stays fixed regardless of how long the duplicated chip
265
+ * list is. Row 1 crawls left (offset decreases), row 2 crawls right (offset
266
+ * increases) at the same MARQUEE_PX_PER_SECOND. Pointer down anywhere on the
267
+ * strip pauses auto-scroll and lets the user drag BOTH rows 1:1 with the
268
+ * pointer — row 1 moves with the delta, row 2 moves opposite the delta, so
269
+ * they keep scrubbing in opposite directions together. Releasing resumes
270
+ * auto-scroll from wherever the tracks were left (no snap-back). A drag
271
+ * under ~6px of movement is treated as a plain click on the chip underneath.
272
+ * Wheel/trackpad scroll over the strip is intercepted (preventDefault) and
273
+ * its deltaX + deltaY is applied to both rows the same way a drag is.
274
+ *
275
+ * Because the strip captures the pointer (setPointerCapture) to support the
276
+ * drag-to-scrub gesture, pointer events are RETARGETED to the capturing
277
+ * element per spec — `e.target` on pointerup is the strip itself, not the
278
+ * chip the user's finger/cursor is actually over, so walking up from
279
+ * `e.target` alone can fail to find `[data-suggestion-label]`. To resolve
280
+ * this reliably: first try `e.target.closest(...)`, and if that comes up
281
+ * empty, fall back to `document.elementFromPoint(e.clientX, e.clientY)` (an
282
+ * un-retargeted geometric hit-test) and walk up from there instead. Either
283
+ * path resolves through a single `fireChipOnce` guarded by
284
+ * `gestureHandledRef` so the same gesture can never invoke the callback
285
+ * twice. The chip's own `onClick` is ALSO wired to `fireChipOnce` (not
286
+ * skipped) so keyboard activation (Enter/Space while focused) still works;
287
+ * the shared ref guard prevents a double-fire if a browser ever delivers
288
+ * both the retargeted click and our pointerup resolution for one gesture.
289
+ * pointerleave no longer tears down the drag/capture state — only a real
290
+ * pointerup or pointercancel ends the gesture, so a pending click survives
291
+ * the pointer momentarily leaving the strip's visual bounds.
292
+ * ────────────────────────────────────────────────────────────────────── */
293
+ const MARQUEE_PX_PER_SECOND = 32; // ~32px/s ≈ 100s per full loop on a ~3200px doubled track
294
+ const MARQUEE_DRAG_THRESHOLD = 6;
295
+
296
+ interface SuggestionMarqueeProps {
297
+ suggestions: string[];
298
+ onChipClick: (label: string) => void;
299
+ }
300
+
301
+ /** Split a flat list into two roughly-equal, interleaved rows. */
302
+ function splitInterleaved(items: string[]): [string[], string[]] {
303
+ const rowA: string[] = [];
304
+ const rowB: string[] = [];
305
+ items.forEach((item, i) => {
306
+ (i % 2 === 0 ? rowA : rowB).push(item);
307
+ });
308
+ return [rowA, rowB];
309
+ }
310
+
311
+ const SuggestionMarquee: React.FC<SuggestionMarqueeProps> = ({ suggestions, onChipClick }) => {
312
+ const reducedMotion = usePrefersReducedMotion();
313
+ const [rowA, rowB] = React.useMemo(() => splitInterleaved(suggestions), [suggestions]);
314
+
315
+ const containerRef = React.useRef<HTMLDivElement | null>(null);
316
+ const track1Ref = React.useRef<HTMLDivElement | null>(null);
317
+ const track2Ref = React.useRef<HTMLDivElement | null>(null);
318
+ const offset1Ref = React.useRef(0);
319
+ const offset2Ref = React.useRef(0);
320
+ const half1Ref = React.useRef(0);
321
+ const half2Ref = React.useRef(0);
322
+
323
+ const draggingRef = React.useRef(false);
324
+ const dragStartXRef = React.useRef(0);
325
+ const dragStartOffset1Ref = React.useRef(0);
326
+ const dragStartOffset2Ref = React.useRef(0);
327
+ const draggedRef = React.useRef(false);
328
+ const gestureHandledRef = React.useRef(false);
329
+
330
+ const rafRef = React.useRef<number | null>(null);
331
+ const lastTsRef = React.useRef<number | null>(null);
332
+ const pausedRef = React.useRef(false);
333
+
334
+ const applyTransforms = React.useCallback(() => {
335
+ if (track1Ref.current) track1Ref.current.style.transform = `translateX(${offset1Ref.current}px)`;
336
+ if (track2Ref.current) track2Ref.current.style.transform = `translateX(${offset2Ref.current}px)`;
337
+ }, []);
338
+
339
+ const normalize = React.useCallback((offsetRef: React.MutableRefObject<number>, half: number) => {
340
+ if (half <= 0) return;
341
+ while (offsetRef.current <= -half) offsetRef.current += half;
342
+ while (offsetRef.current > 0) offsetRef.current -= half;
343
+ }, []);
344
+
345
+ React.useEffect(() => {
346
+ if (track1Ref.current) half1Ref.current = track1Ref.current.scrollWidth / 2;
347
+ if (track2Ref.current) half2Ref.current = track2Ref.current.scrollWidth / 2;
348
+ }, [rowA, rowB]);
349
+
350
+ React.useEffect(() => {
351
+ if (reducedMotion) return;
352
+
353
+ const step = (ts: number) => {
354
+ if (lastTsRef.current === null) lastTsRef.current = ts;
355
+ const dt = (ts - lastTsRef.current) / 1000;
356
+ lastTsRef.current = ts;
357
+
358
+ if (!pausedRef.current && !draggingRef.current) {
359
+ offset1Ref.current -= MARQUEE_PX_PER_SECOND * dt;
360
+ offset2Ref.current += MARQUEE_PX_PER_SECOND * dt;
361
+ normalize(offset1Ref, half1Ref.current);
362
+ normalize(offset2Ref, half2Ref.current);
363
+ applyTransforms();
364
+ }
365
+ rafRef.current = requestAnimationFrame(step);
366
+ };
367
+
368
+ rafRef.current = requestAnimationFrame(step);
369
+ return () => {
370
+ if (rafRef.current !== null) cancelAnimationFrame(rafRef.current);
371
+ rafRef.current = null;
372
+ lastTsRef.current = null;
373
+ };
374
+ }, [reducedMotion, applyTransforms, normalize]);
375
+
376
+ const scrubBy = React.useCallback(
377
+ (delta: number) => {
378
+ offset1Ref.current += delta;
379
+ offset2Ref.current -= delta;
380
+ normalize(offset1Ref, half1Ref.current);
381
+ normalize(offset2Ref, half2Ref.current);
382
+ applyTransforms();
383
+ },
384
+ [applyTransforms, normalize],
385
+ );
386
+
387
+ // Guards a single gesture against firing onChipClick twice (e.g. once from
388
+ // the pointerup resolution and once from a retargeted click reaching the
389
+ // chip's own onClick).
390
+ const fireChipOnce = React.useCallback(
391
+ (label: string) => {
392
+ if (gestureHandledRef.current) return;
393
+ gestureHandledRef.current = true;
394
+ onChipClick(label);
395
+ },
396
+ [onChipClick],
397
+ );
398
+
399
+ // Resolves which chip (if any) sits under a pointer event. Tries the
400
+ // event's own target first (works when nothing captured the pointer), then
401
+ // falls back to a geometric hit-test via elementFromPoint — required
402
+ // because setPointerCapture retargets e.target to the capturing element.
403
+ const resolveChipLabel = React.useCallback(
404
+ (e: React.PointerEvent<HTMLDivElement>): string | undefined => {
405
+ const target = e.target as HTMLElement | null;
406
+ const fromTarget = target?.closest<HTMLElement>("[data-suggestion-label]");
407
+ if (fromTarget) return fromTarget.dataset.suggestionLabel;
408
+ const atPoint = document.elementFromPoint(e.clientX, e.clientY) as HTMLElement | null;
409
+ return atPoint?.closest<HTMLElement>("[data-suggestion-label]")?.dataset.suggestionLabel;
410
+ },
411
+ [],
412
+ );
413
+
414
+ const handlePointerDown = (e: React.PointerEvent<HTMLDivElement>) => {
415
+ draggingRef.current = true;
416
+ draggedRef.current = false;
417
+ gestureHandledRef.current = false;
418
+ dragStartXRef.current = e.clientX;
419
+ dragStartOffset1Ref.current = offset1Ref.current;
420
+ dragStartOffset2Ref.current = offset2Ref.current;
421
+ (e.currentTarget as HTMLDivElement).setPointerCapture(e.pointerId);
422
+ };
423
+
424
+ const handlePointerMove = (e: React.PointerEvent<HTMLDivElement>) => {
425
+ if (!draggingRef.current) return;
426
+ const delta = e.clientX - dragStartXRef.current;
427
+ if (Math.abs(delta) > MARQUEE_DRAG_THRESHOLD) draggedRef.current = true;
428
+ offset1Ref.current = dragStartOffset1Ref.current + delta;
429
+ offset2Ref.current = dragStartOffset2Ref.current - delta;
430
+ normalize(offset1Ref, half1Ref.current);
431
+ normalize(offset2Ref, half2Ref.current);
432
+ applyTransforms();
433
+ };
434
+
435
+ const releaseCapture = (e: React.PointerEvent<HTMLDivElement>) => {
436
+ try {
437
+ (e.currentTarget as HTMLDivElement).releasePointerCapture(e.pointerId);
438
+ } catch {
439
+ /* no-op */
440
+ }
441
+ };
442
+
443
+ // Used for a genuine cancel — always stops the drag, never resolves a chip
444
+ // click. NOT used for pointerleave anymore: a pending click/drag must
445
+ // survive the pointer momentarily leaving the strip's visual bounds while
446
+ // still captured.
447
+ const endDrag = (e: React.PointerEvent<HTMLDivElement>) => {
448
+ if (!draggingRef.current) return;
449
+ draggingRef.current = false;
450
+ releaseCapture(e);
451
+ };
452
+
453
+ // Used for a genuine pointerup — stops the drag AND, when the gesture never
454
+ // crossed the drag threshold, resolves + invokes the chip under the
455
+ // pointer exactly once.
456
+ const handlePointerUp = (e: React.PointerEvent<HTMLDivElement>) => {
457
+ const wasDragging = draggingRef.current;
458
+ draggingRef.current = false;
459
+ releaseCapture(e);
460
+ if (!wasDragging) return;
461
+
462
+ if (draggedRef.current) {
463
+ draggedRef.current = false;
464
+ return;
465
+ }
466
+
467
+ const label = resolveChipLabel(e);
468
+ if (label) fireChipOnce(label);
469
+ };
470
+
471
+ const handleWheel = (e: React.WheelEvent<HTMLDivElement>) => {
472
+ e.preventDefault();
473
+ const delta = e.deltaX + e.deltaY;
474
+ if (delta === 0) return;
475
+ scrubBy(-delta);
476
+ };
477
+
478
+ const renderRow = (items: string[], trackRef: React.RefObject<HTMLDivElement>) => (
479
+ <div
480
+ ref={trackRef}
481
+ className="flex w-max gap-sm px-md hpt-marquee-track"
482
+ style={{ touchAction: "none" }}
483
+ >
484
+ {[...items, ...items].map((s, i) => (
485
+ <div key={`${s}-${i}`} role="listitem" data-suggestion-label={s}>
486
+ <SuggestionChip label={s} onClick={() => fireChipOnce(s)} />
487
+ </div>
488
+ ))}
489
+ </div>
490
+ );
491
+
492
+ return (
493
+ <div
494
+ ref={containerRef}
495
+ className="w-full relative overflow-hidden flex flex-col gap-sm"
496
+ style={{
497
+ maskImage: "linear-gradient(to right, transparent, black 10%, black 90%, transparent)",
498
+ WebkitMaskImage:
499
+ "linear-gradient(to right, transparent, black 10%, black 90%, transparent)",
500
+ cursor: draggingRef.current ? "grabbing" : "grab",
501
+ }}
502
+ role="list"
503
+ aria-label="Suggested prompts"
504
+ onPointerEnter={() => {
505
+ pausedRef.current = true;
506
+ }}
507
+ onPointerLeave={() => {
508
+ pausedRef.current = false;
509
+ }}
510
+ onPointerDown={handlePointerDown}
511
+ onPointerMove={handlePointerMove}
512
+ onPointerUp={handlePointerUp}
513
+ onPointerCancel={endDrag}
514
+ onWheel={handleWheel}
515
+ onFocus={() => {
516
+ pausedRef.current = true;
517
+ }}
518
+ onBlur={() => {
519
+ pausedRef.current = false;
520
+ }}
521
+ >
522
+ {renderRow(rowA, track1Ref)}
523
+ {renderRow(rowB, track2Ref)}
524
+ </div>
525
+ );
526
+ };
527
+
37
528
  /* ─── Types ──────────────────────────────────────────────────────────────── */
38
529
 
39
530
  export interface HomePageTemplateProps {
@@ -43,13 +534,20 @@ export interface HomePageTemplateProps {
43
534
  userInitials?: string;
44
535
  /**
45
536
  * User's email address, shown as the header of the account menu that opens
46
- * when the footer avatar is clicked. Forwarded to AppSidebar as `userEmail`.
537
+ * when the footer avatar is clicked. Forwarded to AppSidebar and
538
+ * AppSidebarMobile as `userEmail`.
47
539
  */
48
540
  userEmail?: string;
49
541
  /** Controlled prompt value */
50
542
  promptValue?: string;
51
543
  /** Called when prompt input changes */
52
544
  onPromptChange?: (value: string) => void;
545
+ /**
546
+ * Placeholder text shown in the prompt input when it is empty. Forwarded to
547
+ * PromptInputBar as `placeholder`. When omitted, defaults to
548
+ * "Describe an atom or design token to create...".
549
+ */
550
+ placeholder?: string;
53
551
  /** Current build mode */
54
552
  mode?: PromptMode;
55
553
  /** Called when mode changes */
@@ -75,9 +573,9 @@ export interface HomePageTemplateProps {
75
573
  * Fired in addition to the internal setActiveId update.
76
574
  */
77
575
  onSelect?: (id: string) => void;
78
- /** Forwarded to AppSidebar as `activeSubId`. */
576
+ /** Forwarded to AppSidebar and AppSidebarMobile as `activeSubId`. */
79
577
  activeSubId?: string;
80
- /** Forwarded to AppSidebar as `onSubSelect`. */
578
+ /** Forwarded to AppSidebar and AppSidebarMobile as `onSubSelect`. */
81
579
  onSubSelect?: (id: string) => void;
82
580
  /**
83
581
  * Whether dark mode is currently active. Forwarded to both AppSidebar and
@@ -90,11 +588,39 @@ export interface HomePageTemplateProps {
90
588
  */
91
589
  onDarkModeToggle?: () => void;
92
590
  /**
93
- * Called when the user chooses "Logout" from the footer avatar menu.
94
- * Forwarded to AppSidebar (desktop). AppSidebarMobile does not yet expose an
95
- * onLogout prop, so it is not forwarded there.
591
+ * Called when the user chooses "Logout" from the account menu.
592
+ * Forwarded to both AppSidebar and AppSidebarMobile.
96
593
  */
97
594
  onLogout?: () => void;
595
+ /**
596
+ * Called when the user chooses "User Settings" from the account menu.
597
+ * Forwarded to both AppSidebar and AppSidebarMobile.
598
+ */
599
+ onSettings?: () => void;
600
+ /**
601
+ * Called when the user clicks the sidebar upgrade banner. Forwarded to
602
+ * AppSidebar and AppSidebarMobile as `onUpgradeClick`. When omitted, the
603
+ * banner is not rendered.
604
+ */
605
+ onUpgradeClick?: () => void;
606
+ /**
607
+ * Optional title for the upgrade card shown in AppSidebar and AppSidebarMobile.
608
+ * Forwarded to both sidebars as `upgradeTitle`. Only used when `onUpgradeClick`
609
+ * is provided. When omitted, the sidebar's default title is used.
610
+ */
611
+ upgradeTitle?: string;
612
+ /**
613
+ * Optional subtitle for the upgrade card shown in AppSidebar and AppSidebarMobile.
614
+ * Forwarded to both sidebars as `upgradeSubtitle`. Only used when `onUpgradeClick`
615
+ * is provided. When omitted, the sidebar's default subtitle is used.
616
+ */
617
+ upgradeSubtitle?: string;
618
+ /**
619
+ * Optional credits usage for the upgrade card. Forwarded to AppSidebar and
620
+ * AppSidebarMobile as `upgradeCredits`. When omitted, the card renders
621
+ * without a credits block.
622
+ */
623
+ upgradeCredits?: { remaining: number; total: number; helper?: string };
98
624
  /**
99
625
  * List of available AI models forwarded to PromptInputBar.
100
626
  * When omitted, the built-in DEFAULT_MODELS list is used.
@@ -109,13 +635,137 @@ export interface HomePageTemplateProps {
109
635
  * Called when the user picks a different model in PromptInputBar.
110
636
  */
111
637
  onModelChange?: (modelId: string) => void;
638
+ /**
639
+ * Called when the user picks a model marked `available: false` in
640
+ * PromptInputBar's model list. Forwarded to PromptInputBar as
641
+ * `onUnavailableModelClick`. When omitted, PromptInputBar's own default
642
+ * handling of an unavailable-model pick (if any) is preserved unchanged.
643
+ */
644
+ onUnavailableModelClick?: (modelId: string) => void;
645
+ /**
646
+ * Called when the mic button is clicked. Forwarded to PromptInputBar as
647
+ * `onMic`. When omitted, PromptInputBar's own default mic behaviour
648
+ * (entering its compact recording state when uncontrolled) is preserved.
649
+ */
650
+ onMic?: () => void;
651
+ /**
652
+ * Controlled recording state. Forwarded to PromptInputBar as `recording`.
653
+ * When omitted, PromptInputBar manages recording itself (uncontrolled).
654
+ */
655
+ recording?: boolean;
656
+ /**
657
+ * Error message shown in the recording pill (for example "Microphone
658
+ * blocked"). Forwarded to PromptInputBar as `recordingError`.
659
+ */
660
+ recordingError?: string;
661
+ /**
662
+ * Live audio levels (0 to 1, oldest first) driving the recording waveform.
663
+ * Forwarded to PromptInputBar as `audioLevels`. When omitted, the bar runs
664
+ * its own simulated waveform.
665
+ */
666
+ audioLevels?: number[];
667
+ /**
668
+ * Called when the recording confirm (check) button is pressed or the max
669
+ * duration is hit. Forwarded to PromptInputBar as `onRecordingConfirm`.
670
+ */
671
+ onRecordingConfirm?: (durationSeconds: number) => void;
672
+ /**
673
+ * Called when recording is cancelled (cancel button or Escape). Forwarded
674
+ * to PromptInputBar as `onRecordingCancel`.
675
+ */
676
+ onRecordingCancel?: () => void;
112
677
  /**
113
678
  * IDs of nav entries whose sub-item lists should be expanded on the initial
114
- * render. Forwarded to AppSidebar as `defaultExpandedIds`. The sidebar
115
- * manages expand/collapse state internally after mount — this only seeds the
116
- * initial state and is NOT a controlled prop (changes after mount are ignored).
679
+ * render. Forwarded to AppSidebar and AppSidebarMobile as
680
+ * `defaultExpandedIds`. Only seeds the initial state and is NOT a
681
+ * controlled prop (changes after mount are ignored).
117
682
  */
118
683
  defaultExpandedIds?: string[];
684
+ /**
685
+ * Words to cycle through inside the headline ("What <word> should we build?").
686
+ * Cycles roughly every 2.5s with a vertical slide/fade transition. Falls back
687
+ * to a static first word when `prefers-reduced-motion` is set. Only used
688
+ * when `headlineVariant` is `"rotating"` (the default).
689
+ * Defaults to ["atom", "Molecule", "Organism", "Template"].
690
+ */
691
+ headlineRotatingWords?: string[];
692
+ /**
693
+ * Forwarded to PromptInputBar as `showModeSelector`. Defaults to true.
694
+ */
695
+ showModeSelector?: boolean;
696
+ /**
697
+ * Whether the "Suggest Designs" switch inside PromptInputBar is on.
698
+ * Forwarded to PromptInputBar as `suggestDesigns`. When omitted,
699
+ * PromptInputBar's own default visibility/state is preserved unchanged.
700
+ */
701
+ suggestDesigns?: boolean;
702
+ /**
703
+ * Called when the user toggles the "Suggest Designs" switch inside
704
+ * PromptInputBar. Forwarded to PromptInputBar as `onSuggestDesignsChange`.
705
+ * Never triggers `onSend` — toggling the switch only reports the new
706
+ * on/off state.
707
+ */
708
+ onSuggestDesignsChange?: (on: boolean) => void;
709
+ /**
710
+ * Layout for the suggestion chips below the prompt bar. `"wrap"` (default)
711
+ * keeps the centered wrapping row. `"marquee"` renders a full-bleed strip of
712
+ * TWO stacked rows that auto-crawl in opposite directions at a slow,
713
+ * constant speed and pause on hover/focus. The strip can also be grabbed
714
+ * and dragged left/right (mouse or touch) or scrolled with wheel/trackpad —
715
+ * either gesture scrubs both rows together, each continuing in its own
716
+ * loop direction; releasing resumes the crawl from the dropped position.
717
+ */
718
+ suggestionsVariant?: "wrap" | "marquee";
719
+ /**
720
+ * When true, replaces the static gradient background with a light,
721
+ * high-key mesh-blob composition: a lavender veil and drifting violet and
722
+ * peach frosted blob clusters. Defaults to false (static gradient). Under
723
+ * `prefers-reduced-motion` the same composition renders but the
724
+ * drift/scale loops are frozen.
725
+ */
726
+ animatedBackground?: boolean;
727
+ /**
728
+ * When false, hides the "New design system" sparkle pill above the headline.
729
+ * Defaults to true.
730
+ */
731
+ showIntroPill?: boolean;
732
+ /**
733
+ * When false, hides the subtitle paragraph below the headline.
734
+ * Defaults to true.
735
+ */
736
+ showSubtitle?: boolean;
737
+ /**
738
+ * `"rotating"` (default) keeps the existing cycling-word headline
739
+ * ("What <rotating word> should we build?"). `"gradient"` swaps in a
740
+ * two-line headline ("What Design system" / "should we build?") where
741
+ * "Design system" is rendered with an animated shifting gradient text fill.
742
+ * The gradient still animates only when `prefers-reduced-motion` is not set.
743
+ */
744
+ headlineVariant?: "rotating" | "gradient";
745
+ /**
746
+ * When provided, clicking (or activating via keyboard) a suggestion chip
747
+ * fills the prompt with the composed string
748
+ * `${suggestionPromptPrefix} ${label} ${suggestionPromptSuffix}` (any
749
+ * missing part is omitted, parts joined with a single space) instead of
750
+ * the raw label — writing it into the prompt input so the user sees and
751
+ * can edit it, then focusing the input. The chip's label casing is always
752
+ * preserved as-is (never lowercased). `onPromptChange` / `onSuggestionClick`
753
+ * receive this full composed string. `onSend` is NEVER called as a result
754
+ * of a suggestion click, in either the "wrap" or "marquee" variant. When
755
+ * both `suggestionPromptPrefix` and `suggestionPromptSuffix` are omitted,
756
+ * the raw label is used (existing behaviour).
757
+ */
758
+ suggestionPromptPrefix?: string;
759
+ /**
760
+ * When provided, appended (with a leading space) after the label when
761
+ * filling the prompt from a suggestion chip click, e.g. prefix "Create me"
762
+ * + suffix "component" + label "Button group" produces
763
+ * "Create me Button group component". The label's original casing is
764
+ * always preserved. `onPromptChange` / `onSuggestionClick` receive the full
765
+ * composed string; `onSend` is never called as a result of a suggestion
766
+ * click.
767
+ */
768
+ suggestionPromptSuffix?: string;
119
769
  className?: string;
120
770
  style?: React.CSSProperties;
121
771
  }
@@ -142,7 +792,7 @@ const DEFAULT_SUGGESTIONS = [
142
792
  "Card molecule",
143
793
  ];
144
794
 
145
- /* ─── Gradient background ───────────────────────────────────────────────── */
795
+ /* ─── Gradient background (static) ───────────────────────────────────────── */
146
796
  const GRADIENT_BG = `
147
797
  radial-gradient(ellipse 80% 60% at 30% 20%, var(--color-primary-disabled) 0%, transparent 55%),
148
798
  radial-gradient(ellipse 60% 50% at 75% 80%, color-mix(in srgb, var(--color-logo-orange) 20%, transparent) 0%, transparent 55%),
@@ -150,6 +800,50 @@ const GRADIENT_BG = `
150
800
  var(--color-canvas)
151
801
  `;
152
802
 
803
+ /* ─── Scoped animation styles ─────────────────────────────────────────────── */
804
+ const HOME_TEMPLATE_STYLES = `
805
+ @keyframes hpt-word-enter-kf {
806
+ from { transform: translateY(60%); opacity: 0; }
807
+ to { transform: translateY(0); opacity: 1; }
808
+ }
809
+ @keyframes hpt-word-exit-kf {
810
+ from { transform: translateY(0); opacity: 1; }
811
+ to { transform: translateY(-60%); opacity: 0; }
812
+ }
813
+ .hpt-word-enter { animation: hpt-word-enter-kf 420ms ease-out both; }
814
+ .hpt-word-exit { animation: hpt-word-exit-kf 420ms ease-in both; }
815
+
816
+ .hpt-marquee-track { will-change: transform; }
817
+
818
+ .hpt-mesh-violet { animation: hpt-mesh-drift-violet-kf 26s ease-in-out infinite; }
819
+ .hpt-mesh-peach { animation: hpt-mesh-drift-peach-kf 34s ease-in-out infinite; animation-delay: -6s; }
820
+
821
+ @keyframes hpt-mesh-drift-violet-kf {
822
+ 0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
823
+ 50% { transform: translate(-3%, 4%) scale(1.08) rotate(3deg); }
824
+ }
825
+ @keyframes hpt-mesh-drift-peach-kf {
826
+ 0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
827
+ 50% { transform: translate(3%, -4%) scale(1.07) rotate(-3deg); }
828
+ }
829
+
830
+ .hpt-gradient-text {
831
+ animation: hpt-gradient-shift-kf 7s ease-in-out infinite;
832
+ }
833
+
834
+ @keyframes hpt-gradient-shift-kf {
835
+ 0% { background-position: 0% 50%; }
836
+ 50% { background-position: 100% 50%; }
837
+ 100% { background-position: 0% 50%; }
838
+ }
839
+
840
+ @media (prefers-reduced-motion: reduce) {
841
+ .hpt-word-enter, .hpt-word-exit, .hpt-mesh-violet, .hpt-mesh-peach, .hpt-gradient-text {
842
+ animation: none;
843
+ }
844
+ }
845
+ `;
846
+
153
847
  /* ─── Component ──────────────────────────────────────────────────────────── */
154
848
 
155
849
  export const HomePageTemplate = React.forwardRef<HTMLDivElement, HomePageTemplateProps>(
@@ -160,6 +854,7 @@ export const HomePageTemplate = React.forwardRef<HTMLDivElement, HomePageTemplat
160
854
  userEmail,
161
855
  promptValue,
162
856
  onPromptChange,
857
+ placeholder = DEFAULT_PLACEHOLDER,
163
858
  mode = "Build",
164
859
  onModeChange,
165
860
  onSend,
@@ -173,10 +868,33 @@ export const HomePageTemplate = React.forwardRef<HTMLDivElement, HomePageTemplat
173
868
  darkMode,
174
869
  onDarkModeToggle,
175
870
  onLogout,
871
+ onSettings,
872
+ onUpgradeClick,
873
+ upgradeTitle,
874
+ upgradeSubtitle,
875
+ upgradeCredits,
176
876
  models,
177
877
  selectedModelId,
178
878
  onModelChange,
879
+ onUnavailableModelClick,
880
+ onMic,
881
+ recording,
882
+ recordingError,
883
+ audioLevels,
884
+ onRecordingConfirm,
885
+ onRecordingCancel,
179
886
  defaultExpandedIds,
887
+ headlineRotatingWords = DEFAULT_ROTATING_WORDS,
888
+ showModeSelector = true,
889
+ suggestDesigns,
890
+ onSuggestDesignsChange,
891
+ suggestionsVariant = "wrap",
892
+ animatedBackground = false,
893
+ showIntroPill = true,
894
+ showSubtitle = true,
895
+ headlineVariant = "rotating",
896
+ suggestionPromptPrefix,
897
+ suggestionPromptSuffix,
180
898
  className,
181
899
  style,
182
900
  },
@@ -197,6 +915,11 @@ export const HomePageTemplate = React.forwardRef<HTMLDivElement, HomePageTemplat
197
915
  const resolvedModels = models !== undefined ? models : DEFAULT_MODELS;
198
916
  const resolvedSelectedModelId = selectedModelId !== undefined ? selectedModelId : DEFAULT_SELECTED_MODEL_ID;
199
917
 
918
+ // The mesh-blob composition renders whenever animatedBackground is on; under
919
+ // prefers-reduced-motion the same composition stays but the CSS above freezes
920
+ // the drift/scale keyframes so nothing moves.
921
+ const useAnimatedBackground = animatedBackground;
922
+
200
923
  const handleChange = (val: string) => {
201
924
  if (promptValue === undefined) setInternalPrompt(val);
202
925
  onPromptChange?.(val);
@@ -207,10 +930,27 @@ export const HomePageTemplate = React.forwardRef<HTMLDivElement, HomePageTemplat
207
930
  if (promptValue === undefined) setInternalPrompt("");
208
931
  };
209
932
 
933
+ // Composes the prompt from a suggestion label and WRITES it into the
934
+ // prompt input — it never calls onSend. Used by both the "wrap" chip row
935
+ // and the marquee rows. The label's casing is always preserved as-is;
936
+ // prefix/suffix are simply joined around it, omitting whichever part is
937
+ // absent, with single spaces between the parts that remain.
210
938
  const handleSuggestion = (label: string) => {
211
- if (promptValue === undefined) setInternalPrompt(label);
212
- onPromptChange?.(label);
213
- onSuggestionClick?.(label);
939
+ const finalValue = [suggestionPromptPrefix, label, suggestionPromptSuffix]
940
+ .filter(Boolean)
941
+ .join(" ");
942
+ if (promptValue === undefined) setInternalPrompt(finalValue);
943
+ onPromptChange?.(finalValue);
944
+ onSuggestionClick?.(finalValue);
945
+ // Focus the prompt input so the user immediately sees/can edit the
946
+ // composed value. PromptInputBar renders a native textarea/input
947
+ // internally; find it inside the app root as a best-effort focus.
948
+ requestAnimationFrame(() => {
949
+ const el = document.querySelector<HTMLTextAreaElement | HTMLInputElement>(
950
+ '[data-prompt-input-bar] textarea, [data-prompt-input-bar] input[type="text"]',
951
+ );
952
+ el?.focus();
953
+ });
214
954
  };
215
955
 
216
956
  // When the user selects a nav entry, always update internal state AND call the
@@ -220,12 +960,24 @@ export const HomePageTemplate = React.forwardRef<HTMLDivElement, HomePageTemplat
220
960
  onSelect?.(id);
221
961
  };
222
962
 
963
+ const suggestionList = (
964
+ <>
965
+ {suggestions.map((s) => (
966
+ <div key={s} role="listitem">
967
+ <SuggestionChip label={s} onClick={() => handleSuggestion(s)} />
968
+ </div>
969
+ ))}
970
+ </>
971
+ );
972
+
223
973
  return (
224
974
  <div
225
975
  ref={ref}
226
976
  className={["flex w-full", className].filter(Boolean).join(" ")}
227
977
  style={{ width: "100%", height: "100%", background: "var(--color-canvas)", ...style }}
228
978
  >
979
+ <style>{HOME_TEMPLATE_STYLES}</style>
980
+
229
981
  {/* ── Desktop sidebar — hidden on mobile ── */}
230
982
  <div className="hidden md:flex flex-shrink-0" style={{ height: "100%" }}>
231
983
  <AppSidebar
@@ -235,14 +987,17 @@ export const HomePageTemplate = React.forwardRef<HTMLDivElement, HomePageTemplat
235
987
  onSelect={handleSelect}
236
988
  activeSubId={activeSubId}
237
989
  onSubSelect={onSubSelect}
238
- showShareCard={true}
239
- showUpgradeCard={true}
240
990
  userInitials={userInitials}
241
991
  userEmail={userEmail}
242
992
  onInboxClick={() => {}}
243
993
  darkMode={darkMode}
244
994
  onDarkModeToggle={onDarkModeToggle}
245
995
  onLogout={onLogout}
996
+ onSettings={onSettings}
997
+ onUpgradeClick={onUpgradeClick}
998
+ upgradeTitle={upgradeTitle}
999
+ upgradeSubtitle={upgradeSubtitle}
1000
+ upgradeCredits={upgradeCredits}
246
1001
  defaultExpandedIds={defaultExpandedIds}
247
1002
  style={{ height: "100%" }}
248
1003
  />
@@ -254,111 +1009,154 @@ export const HomePageTemplate = React.forwardRef<HTMLDivElement, HomePageTemplat
254
1009
  style={{ height: "100%" }}
255
1010
  aria-label="Home canvas"
256
1011
  >
257
- {/* Gradient background */}
258
- <div
259
- aria-hidden="true"
260
- className="absolute inset-0 pointer-events-none"
261
- style={{ background: GRADIENT_BG }}
262
- />
1012
+ {/* Background */}
1013
+ {useAnimatedBackground ? (
1014
+ <AnimatedBackground />
1015
+ ) : (
1016
+ <div
1017
+ aria-hidden="true"
1018
+ className="absolute inset-0 pointer-events-none"
1019
+ style={{ background: GRADIENT_BG }}
1020
+ />
1021
+ )}
263
1022
 
264
- {/* ── Mobile top bar — visible only on mobile ── */}
265
- <div className="md:hidden relative z-10 flex items-center justify-between px-md py-sm border-b border-hairline bg-canvas">
266
- <div className="flex items-center gap-sm">
267
- <AppSidebarMobile
268
- brandName="Atoms"
269
- entries={resolvedEntries}
270
- activeId={resolvedActiveId}
271
- onSelect={handleSelect}
272
- workspaceName={userName}
273
- showShareCard={true}
274
- showUpgradeCard={true}
275
- userInitials={userInitials}
276
- onInboxClick={() => {}}
277
- darkMode={darkMode}
278
- onDarkModeToggle={onDarkModeToggle}
279
- />
280
- <div className="flex items-center gap-xs">
281
- <Icon name="atom" style={{ width: "22px", height: "22px" }} />
282
- <span className="text-body-sm font-weight-heading-sm text-ink">Atoms</span>
283
- </div>
284
- </div>
285
- <span
286
- className="flex items-center justify-center rounded-full bg-primary text-on-primary text-caption font-weight-heading-sm"
287
- style={{ width: "32px", height: "32px" }}
288
- aria-label="User profile"
289
- >
290
- {userInitials}
291
- </span>
292
- </div>
1023
+ {/* ── Mobile top bar — AppSidebarMobile IS the whole bar (brand left,
1024
+ menu button right, menu expands downward). Visible only below md. ── */}
1025
+ <AppSidebarMobile
1026
+ className="md:hidden relative z-10"
1027
+ brandName="Atoms"
1028
+ entries={resolvedEntries}
1029
+ activeId={resolvedActiveId}
1030
+ onSelect={handleSelect}
1031
+ activeSubId={activeSubId}
1032
+ onSubSelect={onSubSelect}
1033
+ workspaceName={userName}
1034
+ userInitials={userInitials}
1035
+ userEmail={userEmail}
1036
+ darkMode={darkMode}
1037
+ onDarkModeToggle={onDarkModeToggle}
1038
+ onLogout={onLogout}
1039
+ onSettings={onSettings}
1040
+ onUpgradeClick={onUpgradeClick}
1041
+ upgradeTitle={upgradeTitle}
1042
+ upgradeSubtitle={upgradeSubtitle}
1043
+ upgradeCredits={upgradeCredits}
1044
+ defaultExpandedIds={defaultExpandedIds}
1045
+ />
293
1046
 
294
1047
  {/* ── Content ── */}
295
1048
  <div className="relative z-10 flex-1 flex flex-col items-center justify-center overflow-auto">
296
- <div className="w-full max-w-2xl mx-auto flex flex-col items-center gap-lg px-md py-xl md:gap-xl md:px-lg md:py-xxl">
1049
+ {/*
1050
+ pb-lg / md:pb-xl on this stack is deliberately the SAME token as
1051
+ the flex gap (gap-lg / md:gap-xl) so that, in the marquee
1052
+ variant, the distance from the bottom of the prompt bar down to
1053
+ the full-bleed marquee strip below matches the distance between
1054
+ the headline and the prompt bar. pt keeps its taller xl/xxl
1055
+ rhythm for breathing room from the top of the canvas.
1056
+ */}
1057
+ <div className="w-full max-w-2xl mx-auto flex flex-col items-center gap-lg px-md pt-xl pb-lg md:gap-xl md:px-lg md:pt-xxl md:pb-xl">
297
1058
 
298
1059
  {/* "New design system" pill */}
299
- <Button
300
- variant="secondary"
301
- size="sm"
302
- aria-label="New design system"
303
- className="!rounded-full flex items-center gap-xs"
304
- >
305
- <Icon name="sparkle" style={{ width: "14px", height: "14px" }} />
306
- New design system
307
- </Button>
1060
+ {showIntroPill && (
1061
+ <Button
1062
+ variant="secondary"
1063
+ size="sm"
1064
+ aria-label="New design system"
1065
+ className="!rounded-full flex items-center gap-xs"
1066
+ >
1067
+ <Icon name="sparkle" style={{ width: "14px", height: "14px" }} />
1068
+ New design system
1069
+ </Button>
1070
+ )}
308
1071
 
309
1072
  {/* Headline */}
310
1073
  <div className="text-center flex flex-col gap-sm">
311
- <h1
312
- className="text-ink"
313
- style={{
314
- fontFamily: "var(--font-body)",
315
- fontSize: "clamp(26px, 5vw, 52px)",
316
- fontWeight: 700,
317
- lineHeight: 1.1,
318
- letterSpacing: "-0.03em",
319
- }}
320
- >
321
- What atom should we
322
- <br />
323
- build?
324
- </h1>
325
- <p
326
- className="text-muted text-body-sm md:text-body-md"
327
- style={{ maxWidth: "440px", marginInline: "auto" }}
328
- >
329
- Start by describing an atom or design token — we'll scaffold a fresh project and the agent will build the first piece of your system.
330
- </p>
1074
+ {headlineVariant === "gradient" ? (
1075
+ <h1
1076
+ className="text-ink"
1077
+ style={{
1078
+ fontFamily: "var(--font-body)",
1079
+ fontSize: "clamp(26px, 5vw, 52px)",
1080
+ fontWeight: 700,
1081
+ lineHeight: 1.25,
1082
+ letterSpacing: "-0.03em",
1083
+ }}
1084
+ >
1085
+ What <GradientHeadlineWords />
1086
+ <br />
1087
+ should we build?
1088
+ </h1>
1089
+ ) : (
1090
+ <h1
1091
+ className="text-ink"
1092
+ aria-label={`What ${headlineRotatingWords[0]} should we build?`}
1093
+ style={{
1094
+ fontFamily: "var(--font-body)",
1095
+ fontSize: "clamp(26px, 5vw, 52px)",
1096
+ fontWeight: 700,
1097
+ lineHeight: 1.25,
1098
+ letterSpacing: "-0.03em",
1099
+ }}
1100
+ >
1101
+ What <RotatingWord words={headlineRotatingWords} /> should we
1102
+ <br />
1103
+ build?
1104
+ </h1>
1105
+ )}
1106
+ {showSubtitle && (
1107
+ <p
1108
+ className="text-muted text-body-sm md:text-body-md"
1109
+ style={{ maxWidth: "440px", marginInline: "auto" }}
1110
+ >
1111
+ Start by describing an atom or design token — we'll scaffold a fresh project and the agent will build the first piece of your system.
1112
+ </p>
1113
+ )}
331
1114
  </div>
332
1115
 
333
- {/* Prompt input */}
334
- <div className="w-full">
1116
+ {/* Prompt input — full-width so the recording waveform fills the bar */}
1117
+ <div className="w-full" data-prompt-input-bar>
335
1118
  <PromptInputBar
336
- placeholder="Describe an atom or design token to create..."
1119
+ className="w-full"
1120
+ placeholder={placeholder}
337
1121
  value={textValue}
338
1122
  onChange={handleChange}
339
1123
  mode={mode}
340
1124
  onModeChange={onModeChange}
341
1125
  onSend={handleSend}
342
- onMic={() => {}}
1126
+ onMic={onMic}
1127
+ recording={recording}
1128
+ recordingError={recordingError}
1129
+ audioLevels={audioLevels}
1130
+ onRecordingConfirm={onRecordingConfirm}
1131
+ onRecordingCancel={onRecordingCancel}
343
1132
  models={resolvedModels}
344
1133
  selectedModelId={resolvedSelectedModelId}
345
1134
  onModelChange={onModelChange}
1135
+ onUnavailableModelClick={onUnavailableModelClick}
1136
+ showModeSelector={showModeSelector}
1137
+ suggestDesigns={suggestDesigns}
1138
+ onSuggestDesignsChange={onSuggestDesignsChange}
346
1139
  />
347
1140
  </div>
348
1141
 
349
- {/* Suggestion chips */}
350
- <div
351
- className="flex flex-wrap justify-center gap-sm"
352
- role="list"
353
- aria-label="Suggested prompts"
354
- >
355
- {suggestions.map((s) => (
356
- <div key={s} role="listitem">
357
- <SuggestionChip label={s} onClick={() => handleSuggestion(s)} />
358
- </div>
359
- ))}
360
- </div>
1142
+ {/* Suggestion chips — wrap variant (default) */}
1143
+ {suggestionsVariant === "wrap" && (
1144
+ <div
1145
+ className="flex flex-wrap justify-center gap-sm"
1146
+ role="list"
1147
+ aria-label="Suggested prompts"
1148
+ >
1149
+ {suggestionList}
1150
+ </div>
1151
+ )}
361
1152
  </div>
1153
+
1154
+ {/* Suggestion chips — marquee variant (full-bleed, draggable, two opposite-crawling rows).
1155
+ No extra margin here: the pb-lg/md:pb-xl on the stack above already
1156
+ supplies the exact same-size gap as the headline-to-prompt spacing. */}
1157
+ {suggestionsVariant === "marquee" && (
1158
+ <SuggestionMarquee suggestions={suggestions} onChipClick={handleSuggestion} />
1159
+ )}
362
1160
  </div>
363
1161
  </main>
364
1162
  </div>