@tokcalc/mcp-server 0.1.0 → 0.1.2

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 (192) hide show
  1. package/.zscripts/build.sh +175 -0
  2. package/.zscripts/database-runtime-build.sh +33 -0
  3. package/.zscripts/dev.pid +1 -0
  4. package/.zscripts/dev.sh +154 -0
  5. package/.zscripts/mini-services-build.sh +78 -0
  6. package/.zscripts/mini-services-install.sh +65 -0
  7. package/.zscripts/mini-services-start.sh +123 -0
  8. package/.zscripts/python-runtime-build.sh +120 -0
  9. package/.zscripts/start.sh +145 -0
  10. package/CAPACITY_STUDY.md +283 -0
  11. package/CODE_OF_CONDUCT.md +55 -0
  12. package/CONTRIBUTING.md +177 -0
  13. package/Caddyfile +23 -0
  14. package/LICENSE +204 -0
  15. package/README.md +406 -86
  16. package/bun.lock +1965 -0
  17. package/components.json +21 -0
  18. package/db/custom.db +0 -0
  19. package/download/README.md +1 -0
  20. package/download/tokcalc-dark-calculator.png +0 -0
  21. package/download/tokcalc-dark-default.png +0 -0
  22. package/download/tokcalc-demo.webm +0 -0
  23. package/download/tokcalc-github-link.png +0 -0
  24. package/download/tokcalc-hydration-fixed.png +0 -0
  25. package/download/tokcalc-issue-resolved.png +0 -0
  26. package/download/tokcalc-light-mode.png +0 -0
  27. package/download/tokcalc-light-reference.png +0 -0
  28. package/download/tokcalc-long-context-qwen.png +0 -0
  29. package/download/tokcalc-long-context.png +0 -0
  30. package/download/tokcalc-og-image-preview.png +0 -0
  31. package/download/tokcalc-phase2-3.png +0 -0
  32. package/download/tokcalc-plain-english.png +0 -0
  33. package/download/tokcalc-preview.png +0 -0
  34. package/download/tokcalc-share-bvb.png +0 -0
  35. package/download/tokcalc-share-feature.png +0 -0
  36. package/download/tokcalc-tab-build-vs-buy.png +0 -0
  37. package/download/tokcalc-tab-calculator.png +0 -0
  38. package/download/tokcalc-tab-reference.png +0 -0
  39. package/eslint.config.mjs +50 -0
  40. package/examples/websocket/frontend.tsx +196 -0
  41. package/examples/websocket/server.ts +138 -0
  42. package/mini-services/.gitkeep +0 -0
  43. package/mini-services/mcp-server/README.md +86 -0
  44. package/mini-services/mcp-server/bun.lock +202 -0
  45. package/mini-services/mcp-server/index.ts +504 -0
  46. package/mini-services/mcp-server/package.json +40 -0
  47. package/next.config.ts +12 -0
  48. package/package.json +90 -32
  49. package/postcss.config.mjs +5 -0
  50. package/prisma/schema.prisma +32 -0
  51. package/public/google6f58ca6be85fa903.html +1 -0
  52. package/public/logo.svg +29 -0
  53. package/public/manifest.json +51 -0
  54. package/public/og-icon-256.png +0 -0
  55. package/public/og.png +0 -0
  56. package/public/robots.txt +25 -0
  57. package/public/sitemap.xml +23 -0
  58. package/public/tokcalc-demo.gif +0 -0
  59. package/scripts/og-template.html +120 -0
  60. package/scripts/render-og.mjs +43 -0
  61. package/server.json +21 -0
  62. package/src/app/api/pricing/aws/route.ts +186 -0
  63. package/src/app/api/pricing/azure/route.ts +168 -0
  64. package/src/app/api/pricing/gcp/route.ts +230 -0
  65. package/src/app/api/pricing/vast-ai/route.ts +164 -0
  66. package/src/app/api/route.ts +5 -0
  67. package/src/app/compare/h100-vs-h200/layout.tsx +30 -0
  68. package/src/app/compare/h100-vs-h200/page.tsx +328 -0
  69. package/src/app/globals.css +122 -0
  70. package/src/app/layout.tsx +276 -0
  71. package/src/app/page.tsx +2670 -0
  72. package/src/components/azure-live-pricing.tsx +185 -0
  73. package/src/components/benchmark-import.tsx +340 -0
  74. package/src/components/confidence-badge.tsx +116 -0
  75. package/src/components/live-pricing-comparison.tsx +241 -0
  76. package/src/components/theme-provider.tsx +11 -0
  77. package/src/components/theme-toggle.tsx +55 -0
  78. package/src/components/ui/accordion.tsx +66 -0
  79. package/src/components/ui/alert-dialog.tsx +157 -0
  80. package/src/components/ui/alert.tsx +66 -0
  81. package/src/components/ui/aspect-ratio.tsx +11 -0
  82. package/src/components/ui/avatar.tsx +53 -0
  83. package/src/components/ui/badge.tsx +46 -0
  84. package/src/components/ui/breadcrumb.tsx +109 -0
  85. package/src/components/ui/button.tsx +59 -0
  86. package/src/components/ui/calendar.tsx +213 -0
  87. package/src/components/ui/card.tsx +92 -0
  88. package/src/components/ui/carousel.tsx +241 -0
  89. package/src/components/ui/chart.tsx +353 -0
  90. package/src/components/ui/checkbox.tsx +32 -0
  91. package/src/components/ui/collapsible.tsx +33 -0
  92. package/src/components/ui/command.tsx +184 -0
  93. package/src/components/ui/context-menu.tsx +252 -0
  94. package/src/components/ui/dialog.tsx +143 -0
  95. package/src/components/ui/drawer.tsx +135 -0
  96. package/src/components/ui/dropdown-menu.tsx +257 -0
  97. package/src/components/ui/form.tsx +167 -0
  98. package/src/components/ui/hover-card.tsx +44 -0
  99. package/src/components/ui/input-otp.tsx +77 -0
  100. package/src/components/ui/input.tsx +21 -0
  101. package/src/components/ui/label.tsx +24 -0
  102. package/src/components/ui/menubar.tsx +276 -0
  103. package/src/components/ui/navigation-menu.tsx +168 -0
  104. package/src/components/ui/pagination.tsx +127 -0
  105. package/src/components/ui/popover.tsx +48 -0
  106. package/src/components/ui/progress.tsx +31 -0
  107. package/src/components/ui/radio-group.tsx +45 -0
  108. package/src/components/ui/resizable.tsx +56 -0
  109. package/src/components/ui/scroll-area.tsx +58 -0
  110. package/src/components/ui/select.tsx +185 -0
  111. package/src/components/ui/separator.tsx +28 -0
  112. package/src/components/ui/sheet.tsx +139 -0
  113. package/src/components/ui/sidebar.tsx +726 -0
  114. package/src/components/ui/skeleton.tsx +13 -0
  115. package/src/components/ui/slider.tsx +63 -0
  116. package/src/components/ui/sonner.tsx +25 -0
  117. package/src/components/ui/switch.tsx +31 -0
  118. package/src/components/ui/table.tsx +116 -0
  119. package/src/components/ui/tabs.tsx +66 -0
  120. package/src/components/ui/textarea.tsx +18 -0
  121. package/src/components/ui/toast.tsx +129 -0
  122. package/src/components/ui/toaster.tsx +35 -0
  123. package/src/components/ui/toggle-group.tsx +73 -0
  124. package/src/components/ui/toggle.tsx +47 -0
  125. package/src/components/ui/tooltip.tsx +61 -0
  126. package/src/components/vast-ai-live-pricing.tsx +176 -0
  127. package/src/hooks/use-mobile.ts +19 -0
  128. package/src/hooks/use-toast.ts +194 -0
  129. package/src/lib/benchmark-parser-sglang.ts +150 -0
  130. package/src/lib/benchmark-parser-tokcalc.ts +247 -0
  131. package/src/lib/benchmark-parser-trtllm.ts +152 -0
  132. package/src/lib/benchmark-parser-vllm.ts +198 -0
  133. package/src/lib/benchmark-schema.ts +263 -0
  134. package/src/lib/db.ts +13 -0
  135. package/src/lib/engine-presets.ts +183 -0
  136. package/src/lib/price-schema.ts +141 -0
  137. package/src/lib/token-calc.ts +808 -0
  138. package/src/lib/track.ts +31 -0
  139. package/src/lib/url-state.ts +256 -0
  140. package/src/lib/utils.ts +6 -0
  141. package/tailwind.config.ts +64 -0
  142. package/tests/database-runtime-build.sh +75 -0
  143. package/tests/python-runtime-build.sh +64 -0
  144. package/tests/python-runtime-container.sh +31 -0
  145. package/tool-results/bash_1789888171144_2c5381860539.txt +161 -0
  146. package/tool-results/bash_1789888175925_49c53ba3c61b.txt +191 -0
  147. package/tool-results/bash_1789888181202_49c53ba3c61b.txt +191 -0
  148. package/tool-results/bash_1789888195219_4a86a5c91411.txt +200 -0
  149. package/tool-results/bash_1789888203128_6cca13c71b47.txt +199 -0
  150. package/tool-results/bash_1789929256963_2a52aff0d0a8.txt +160 -0
  151. package/tool-results/read_1789888151021_69f58eec6a5b.txt +653 -0
  152. package/tool-results/read_1789888153837_1d3a8bfc2a94.txt +653 -0
  153. package/tool-results/read_1789888163087_ccc406d47505.txt +122 -0
  154. package/tool-results/read_1789888167347_67d1d7c9830a.txt +122 -0
  155. package/tool-results/read_1789929252529_d90e8f383a25.txt +285 -0
  156. package/tsconfig.json +42 -0
  157. package/upload/Pasted Content_1789887800864.txt +652 -0
  158. package/upload/Pasted Content_1789887909561.txt +652 -0
  159. package/upload/Pasted Content_1789887918428.txt +652 -0
  160. package/upload/Pasted Content_1789887959420.txt +652 -0
  161. package/upload/Pasted Content_1789888020485.txt +652 -0
  162. package/upload/Pasted Content_1789888058079.txt +652 -0
  163. package/upload/Pasted Content_1789888885033.txt +686 -0
  164. package/upload/Pasted Content_1789928912741.txt +285 -0
  165. package/upload/Pasted Content_1789928938402.txt +285 -0
  166. package/upload/Pasted Content_1789929160389.txt +285 -0
  167. package/upload/Pasted Content_1789929176660.txt +285 -0
  168. package/upload/issue_vision.json +28 -0
  169. package/upload/pasted_image_1789883175209.png +0 -0
  170. package/upload/pasted_image_1789899056690.png +0 -0
  171. package/upload/pasted_image_1789900371483.png +0 -0
  172. package/upload/pasted_image_1789900472823.png +0 -0
  173. package/upload/pasted_image_1789900490374.png +0 -0
  174. package/upload/pasted_image_1789900585552.png +0 -0
  175. package/upload/pasted_image_1789900606519.png +0 -0
  176. package/upload/pasted_image_1789901598705.png +0 -0
  177. package/upload/pasted_image_1789901613545.png +0 -0
  178. package/upload/pasted_image_1789978382674.png +0 -0
  179. package/upload/pasted_image_1789978392749.png +0 -0
  180. package/upload/pasted_image_1789978474879.png +0 -0
  181. package/upload/pasted_image_1789978523652.png +0 -0
  182. package/upload/pasted_image_1789984219089.png +0 -0
  183. package/upload/pasted_image_1789984491896.png +0 -0
  184. package/upload/pasted_image_1789985017950.png +0 -0
  185. package/upload/pasted_image_1789985036765.png +0 -0
  186. package/upload/pasted_image_1789985049848.png +0 -0
  187. package/upload/pasted_image_1790002427833.png +0 -0
  188. package/upload/pasted_image_1790002659944.png +0 -0
  189. package/upload/pasted_image_1790037038476.png +0 -0
  190. package/upload/screenshot_analysis.json +28 -0
  191. package/upload/vision_output.json +28 -0
  192. package/dist/index.js +0 -21014
@@ -0,0 +1,241 @@
1
+ "use client";
2
+
3
+ import { useEffect, useState } from "react";
4
+ import {
5
+ Card,
6
+ CardContent,
7
+ CardDescription,
8
+ CardHeader,
9
+ CardTitle,
10
+ } from "@/components/ui/card";
11
+ import { Button } from "@/components/ui/button";
12
+ import { Badge } from "@/components/ui/badge";
13
+ import { RefreshCw, Zap, TrendingDown, Cloud } from "lucide-react";
14
+ import { track } from "@/lib/track";
15
+
16
+ interface UnifiedPrice {
17
+ gpu: string;
18
+ pricePerGpuHour: number;
19
+ provider: string;
20
+ region: string;
21
+ retrievedAt: string;
22
+ }
23
+
24
+ interface ProviderResponse {
25
+ source: string;
26
+ cached: boolean;
27
+ retrievedAt?: string;
28
+ count?: number;
29
+ prices?: Array<{ gpu: string; pricePerGpuHour?: number; price?: number; region?: string; retrievedAt?: string }>;
30
+ error?: string;
31
+ }
32
+
33
+ export function LivePricingComparison() {
34
+ const [prices, setPrices] = useState<UnifiedPrice[]>([]);
35
+ const [loading, setLoading] = useState(false);
36
+ const [lastUpdated, setLastUpdated] = useState<string | null>(null);
37
+ const [errors, setErrors] = useState<string[]>([]);
38
+
39
+ const fetchAll = async () => {
40
+ setLoading(true);
41
+ setErrors([]);
42
+ const allPrices: UnifiedPrice[] = [];
43
+ const newErrors: string[] = [];
44
+ let latestTimestamp: string | null = null;
45
+
46
+ // Fetch all providers in parallel
47
+ const providers = [
48
+ { url: "/api/pricing/azure", name: "Azure" },
49
+ { url: "/api/pricing/vast-ai", name: "Vast.ai" },
50
+ { url: "/api/pricing/aws", name: "AWS" },
51
+ { url: "/api/pricing/gcp", name: "GCP" },
52
+ ];
53
+
54
+ const results = await Promise.allSettled(
55
+ providers.map(async (p) => {
56
+ const res = await fetch(p.url);
57
+ if (!res.ok) {
58
+ const errData = await res.json().catch(() => ({}));
59
+ throw new Error(errData.error || `HTTP ${res.status}`);
60
+ }
61
+ return { provider: p.name, data: (await res.json()) as ProviderResponse };
62
+ }),
63
+ );
64
+
65
+ for (const result of results) {
66
+ if (result.status === "fulfilled") {
67
+ const { provider, data } = result.value;
68
+ const providerPrices = data.prices || [];
69
+
70
+ for (const p of providerPrices) {
71
+ const pricePerGpuHour = p.pricePerGpuHour ?? p.price ?? 0;
72
+ if (pricePerGpuHour > 0) {
73
+ allPrices.push({
74
+ gpu: p.gpu,
75
+ pricePerGpuHour,
76
+ provider,
77
+ region: p.region || "—",
78
+ retrievedAt: p.retrievedAt || data.retrievedAt || new Date().toISOString(),
79
+ });
80
+ }
81
+ }
82
+
83
+ if (data.retrievedAt && (!latestTimestamp || new Date(data.retrievedAt) > new Date(latestTimestamp))) {
84
+ latestTimestamp = data.retrievedAt;
85
+ }
86
+
87
+ track("fetched_live_pricing", { provider, count: providerPrices.length });
88
+ } else if (result.status === "rejected") {
89
+ const providerName = providers[results.indexOf(result)].name;
90
+ newErrors.push(`${providerName}: ${result.reason?.message || "fetch failed"}`);
91
+ }
92
+ }
93
+
94
+ setPrices(allPrices);
95
+ setLastUpdated(latestTimestamp);
96
+ setErrors(newErrors);
97
+ setLoading(false);
98
+ };
99
+
100
+ useEffect(() => {
101
+ fetchAll();
102
+ }, []);
103
+
104
+ // Deduplicate: keep cheapest per GPU per provider
105
+ const cheapestPerGpu = (() => {
106
+ const seen = new Map<string, UnifiedPrice>();
107
+ for (const p of prices) {
108
+ const key = `${p.gpu}-${p.provider}`;
109
+ if (!seen.has(key) || seen.get(key)!.pricePerGpuHour > p.pricePerGpuHour) {
110
+ seen.set(key, p);
111
+ }
112
+ }
113
+
114
+ // Group by GPU, sort providers by price
115
+ const byGpu = new Map<string, UnifiedPrice[]>();
116
+ for (const p of Array.from(seen.values())) {
117
+ if (!byGpu.has(p.gpu)) byGpu.set(p.gpu, []);
118
+ byGpu.get(p.gpu)!.push(p);
119
+ }
120
+
121
+ // Sort each GPU's providers by price
122
+ for (const arr of byGpu.values()) {
123
+ arr.sort((a, b) => a.pricePerGpuHour - b.pricePerGpuHour);
124
+ }
125
+
126
+ // Sort GPUs by their cheapest provider
127
+ return Array.from(byGpu.entries())
128
+ .map(([gpu, providers]) => ({ gpu, providers }))
129
+ .sort((a, b) => a.providers[0].pricePerGpuHour - b.providers[0].pricePerGpuHour);
130
+ })();
131
+
132
+ const asOfLabel = (() => {
133
+ if (!lastUpdated) return null;
134
+ const ageMs = Date.now() - new Date(lastUpdated).getTime();
135
+ if (ageMs < 60000) return "just now";
136
+ if (ageMs < 3600000) return `${Math.floor(ageMs / 60000)}m ago`;
137
+ return `${Math.floor(ageMs / 3600000)}h ago`;
138
+ })();
139
+
140
+ const providerColors: Record<string, string> = {
141
+ Azure: "text-blue-500",
142
+ "Vast.ai": "text-amber-500",
143
+ AWS: "text-orange-500",
144
+ GCP: "text-red-500",
145
+ };
146
+
147
+ return (
148
+ <Card className="border-emerald-500/30 shadow-sm">
149
+ <CardHeader className="pb-3">
150
+ <div className="flex items-center justify-between">
151
+ <div>
152
+ <CardTitle className="text-sm flex items-center gap-2">
153
+ <Cloud className="size-4 text-emerald-500" />
154
+ Live GPU price comparison — all providers
155
+ <Badge variant="outline" className="text-[9px] gap-1 ml-1">
156
+ <span className="size-1.5 rounded-full bg-emerald-500 animate-pulse" />
157
+ LIVE
158
+ </Badge>
159
+ </CardTitle>
160
+ <CardDescription className="text-xs mt-1">
161
+ Cheapest available GPU price across Azure, AWS, GCP, and Vast.ai marketplace.
162
+ {asOfLabel && ` Last updated ${asOfLabel}.`}
163
+ </CardDescription>
164
+ </div>
165
+ <Button
166
+ variant="ghost"
167
+ size="sm"
168
+ onClick={fetchAll}
169
+ disabled={loading}
170
+ className="gap-1.5 h-8"
171
+ >
172
+ <RefreshCw className={`size-3.5 ${loading ? "animate-spin" : ""}`} />
173
+ <span className="text-xs">Refresh</span>
174
+ </Button>
175
+ </div>
176
+ </CardHeader>
177
+ <CardContent>
178
+ {loading && prices.length === 0 && (
179
+ <div className="flex items-center justify-center py-8 text-xs text-muted-foreground">
180
+ <RefreshCw className="size-4 animate-spin mr-2" />
181
+ Fetching live prices from Azure, Vast.ai, AWS, and GCP...
182
+ </div>
183
+ )}
184
+
185
+ {errors.length > 0 && (
186
+ <div className="mb-3 p-2 rounded-md border border-amber-500/30 bg-amber-500/5 text-[10px] text-amber-600 dark:text-amber-400">
187
+ ⚠ {errors.join(" · ")}
188
+ </div>
189
+ )}
190
+
191
+ {cheapestPerGpu.length > 0 && (
192
+ <div className="overflow-x-auto">
193
+ <table className="w-full text-xs">
194
+ <thead className="bg-muted/40 text-[10px] uppercase">
195
+ <tr>
196
+ <th className="text-left px-3 py-1.5">GPU</th>
197
+ <th className="text-right px-3 py-1.5">Cheapest $/GPU-hr</th>
198
+ <th className="text-left px-3 py-1.5">Provider</th>
199
+ <th className="text-left px-3 py-1.5">All providers</th>
200
+ </tr>
201
+ </thead>
202
+ <tbody>
203
+ {cheapestPerGpu.map(({ gpu, providers }) => {
204
+ const cheapest = providers[0];
205
+ return (
206
+ <tr key={gpu} className="border-t border-border/40 hover:bg-muted/20">
207
+ <td className="px-3 py-1.5 font-medium">{gpu}</td>
208
+ <td className="px-3 py-1.5 text-right font-mono text-emerald-500 font-semibold">
209
+ ${cheapest.pricePerGpuHour}/hr
210
+ </td>
211
+ <td className="px-3 py-1.5">
212
+ <span className={providerColors[cheapest.provider] || "text-muted-foreground"}>
213
+ {cheapest.provider}
214
+ </span>
215
+ <span className="text-muted-foreground text-[10px] ml-1">{cheapest.region}</span>
216
+ </td>
217
+ <td className="px-3 py-1.5 text-[10px] text-muted-foreground">
218
+ {providers.map((p, i) => (
219
+ <span key={i}>
220
+ {i > 0 && " · "}
221
+ <span className={providerColors[p.provider] || "text-muted-foreground"}>
222
+ {p.provider} ${p.pricePerGpuHour}
223
+ </span>
224
+ </span>
225
+ ))}
226
+ </td>
227
+ </tr>
228
+ );
229
+ })}
230
+ </tbody>
231
+ </table>
232
+ <p className="text-[10px] text-muted-foreground mt-2 leading-relaxed">
233
+ On-demand prices (spot/reserved excluded). Vast.ai shows spot-market prices which change rapidly.
234
+ GCP requires <code>GCP_API_KEY</code> env var on Vercel. AWS uses public bulk pricing files (no auth).
235
+ </p>
236
+ </div>
237
+ )}
238
+ </CardContent>
239
+ </Card>
240
+ );
241
+ }
@@ -0,0 +1,11 @@
1
+ "use client";
2
+
3
+ import { ThemeProvider as NextThemesProvider } from "next-themes";
4
+ import type { ComponentProps } from "react";
5
+
6
+ export function ThemeProvider({
7
+ children,
8
+ ...props
9
+ }: ComponentProps<typeof NextThemesProvider>) {
10
+ return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
11
+ }
@@ -0,0 +1,55 @@
1
+ "use client";
2
+
3
+ import { Moon, Sun } from "lucide-react";
4
+ import { useTheme } from "next-themes";
5
+ import { useEffect, useState } from "react";
6
+ import { Button } from "@/components/ui/button";
7
+
8
+ /**
9
+ * Theme toggle button.
10
+ *
11
+ * Renders a STABLE button (same aria-label, same icon) on server + first client
12
+ * render. Only AFTER `useEffect` runs (post-hydration) do we swap in the actual
13
+ * sun/moon icon. This avoids hydration mismatches caused by `resolvedTheme`
14
+ * being undefined on the server but defined on the client.
15
+ *
16
+ * Refs: https://github.com/pacocoursey/next-themes#avoid-hydration-mismatches
17
+ */
18
+ export function ThemeToggle() {
19
+ const { resolvedTheme, setTheme } = useTheme();
20
+ // eslint-disable-next-line react-hooks/set-state-in-effect
21
+ const [mounted, setMounted] = useState(false);
22
+
23
+ useEffect(() => {
24
+ // eslint-disable-next-line react-hooks/set-state-in-effect
25
+ setMounted(true);
26
+ }, []);
27
+
28
+ const isDark = resolvedTheme === "dark";
29
+
30
+ return (
31
+ <Button
32
+ variant="ghost"
33
+ size="icon"
34
+ onClick={() => setTheme(isDark ? "light" : "dark")}
35
+ // STABLE label — never depends on theme. This is the hydration-safe choice.
36
+ aria-label="Toggle theme"
37
+ className="size-8 rounded-md"
38
+ // suppressHydrationWarning is the recommended escape hatch for theme toggles
39
+ // that swap attributes post-mount.
40
+ suppressHydrationWarning
41
+ >
42
+ {mounted ? (
43
+ isDark ? (
44
+ <Sun className="size-4" />
45
+ ) : (
46
+ <Moon className="size-4" />
47
+ )
48
+ ) : (
49
+ // Stable placeholder used during SSR + first client render.
50
+ // Must match exactly between server and client to avoid hydration warnings.
51
+ <Sun className="size-4" />
52
+ )}
53
+ </Button>
54
+ );
55
+ }
@@ -0,0 +1,66 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as AccordionPrimitive from "@radix-ui/react-accordion"
5
+ import { ChevronDownIcon } from "lucide-react"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ function Accordion({
10
+ ...props
11
+ }: React.ComponentProps<typeof AccordionPrimitive.Root>) {
12
+ return <AccordionPrimitive.Root data-slot="accordion" {...props} />
13
+ }
14
+
15
+ function AccordionItem({
16
+ className,
17
+ ...props
18
+ }: React.ComponentProps<typeof AccordionPrimitive.Item>) {
19
+ return (
20
+ <AccordionPrimitive.Item
21
+ data-slot="accordion-item"
22
+ className={cn("border-b last:border-b-0", className)}
23
+ {...props}
24
+ />
25
+ )
26
+ }
27
+
28
+ function AccordionTrigger({
29
+ className,
30
+ children,
31
+ ...props
32
+ }: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
33
+ return (
34
+ <AccordionPrimitive.Header className="flex">
35
+ <AccordionPrimitive.Trigger
36
+ data-slot="accordion-trigger"
37
+ className={cn(
38
+ "focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
39
+ className
40
+ )}
41
+ {...props}
42
+ >
43
+ {children}
44
+ <ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
45
+ </AccordionPrimitive.Trigger>
46
+ </AccordionPrimitive.Header>
47
+ )
48
+ }
49
+
50
+ function AccordionContent({
51
+ className,
52
+ children,
53
+ ...props
54
+ }: React.ComponentProps<typeof AccordionPrimitive.Content>) {
55
+ return (
56
+ <AccordionPrimitive.Content
57
+ data-slot="accordion-content"
58
+ className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
59
+ {...props}
60
+ >
61
+ <div className={cn("pt-0 pb-4", className)}>{children}</div>
62
+ </AccordionPrimitive.Content>
63
+ )
64
+ }
65
+
66
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
@@ -0,0 +1,157 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
5
+
6
+ import { cn } from "@/lib/utils"
7
+ import { buttonVariants } from "@/components/ui/button"
8
+
9
+ function AlertDialog({
10
+ ...props
11
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
12
+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
13
+ }
14
+
15
+ function AlertDialogTrigger({
16
+ ...props
17
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
18
+ return (
19
+ <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
20
+ )
21
+ }
22
+
23
+ function AlertDialogPortal({
24
+ ...props
25
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
26
+ return (
27
+ <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
28
+ )
29
+ }
30
+
31
+ function AlertDialogOverlay({
32
+ className,
33
+ ...props
34
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
35
+ return (
36
+ <AlertDialogPrimitive.Overlay
37
+ data-slot="alert-dialog-overlay"
38
+ className={cn(
39
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
40
+ className
41
+ )}
42
+ {...props}
43
+ />
44
+ )
45
+ }
46
+
47
+ function AlertDialogContent({
48
+ className,
49
+ ...props
50
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
51
+ return (
52
+ <AlertDialogPortal>
53
+ <AlertDialogOverlay />
54
+ <AlertDialogPrimitive.Content
55
+ data-slot="alert-dialog-content"
56
+ className={cn(
57
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
58
+ className
59
+ )}
60
+ {...props}
61
+ />
62
+ </AlertDialogPortal>
63
+ )
64
+ }
65
+
66
+ function AlertDialogHeader({
67
+ className,
68
+ ...props
69
+ }: React.ComponentProps<"div">) {
70
+ return (
71
+ <div
72
+ data-slot="alert-dialog-header"
73
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
74
+ {...props}
75
+ />
76
+ )
77
+ }
78
+
79
+ function AlertDialogFooter({
80
+ className,
81
+ ...props
82
+ }: React.ComponentProps<"div">) {
83
+ return (
84
+ <div
85
+ data-slot="alert-dialog-footer"
86
+ className={cn(
87
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
88
+ className
89
+ )}
90
+ {...props}
91
+ />
92
+ )
93
+ }
94
+
95
+ function AlertDialogTitle({
96
+ className,
97
+ ...props
98
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
99
+ return (
100
+ <AlertDialogPrimitive.Title
101
+ data-slot="alert-dialog-title"
102
+ className={cn("text-lg font-semibold", className)}
103
+ {...props}
104
+ />
105
+ )
106
+ }
107
+
108
+ function AlertDialogDescription({
109
+ className,
110
+ ...props
111
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
112
+ return (
113
+ <AlertDialogPrimitive.Description
114
+ data-slot="alert-dialog-description"
115
+ className={cn("text-muted-foreground text-sm", className)}
116
+ {...props}
117
+ />
118
+ )
119
+ }
120
+
121
+ function AlertDialogAction({
122
+ className,
123
+ ...props
124
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
125
+ return (
126
+ <AlertDialogPrimitive.Action
127
+ className={cn(buttonVariants(), className)}
128
+ {...props}
129
+ />
130
+ )
131
+ }
132
+
133
+ function AlertDialogCancel({
134
+ className,
135
+ ...props
136
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
137
+ return (
138
+ <AlertDialogPrimitive.Cancel
139
+ className={cn(buttonVariants({ variant: "outline" }), className)}
140
+ {...props}
141
+ />
142
+ )
143
+ }
144
+
145
+ export {
146
+ AlertDialog,
147
+ AlertDialogPortal,
148
+ AlertDialogOverlay,
149
+ AlertDialogTrigger,
150
+ AlertDialogContent,
151
+ AlertDialogHeader,
152
+ AlertDialogFooter,
153
+ AlertDialogTitle,
154
+ AlertDialogDescription,
155
+ AlertDialogAction,
156
+ AlertDialogCancel,
157
+ }
@@ -0,0 +1,66 @@
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ const alertVariants = cva(
7
+ "relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "bg-card text-card-foreground",
12
+ destructive:
13
+ "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
14
+ },
15
+ },
16
+ defaultVariants: {
17
+ variant: "default",
18
+ },
19
+ }
20
+ )
21
+
22
+ function Alert({
23
+ className,
24
+ variant,
25
+ ...props
26
+ }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
27
+ return (
28
+ <div
29
+ data-slot="alert"
30
+ role="alert"
31
+ className={cn(alertVariants({ variant }), className)}
32
+ {...props}
33
+ />
34
+ )
35
+ }
36
+
37
+ function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
38
+ return (
39
+ <div
40
+ data-slot="alert-title"
41
+ className={cn(
42
+ "col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
43
+ className
44
+ )}
45
+ {...props}
46
+ />
47
+ )
48
+ }
49
+
50
+ function AlertDescription({
51
+ className,
52
+ ...props
53
+ }: React.ComponentProps<"div">) {
54
+ return (
55
+ <div
56
+ data-slot="alert-description"
57
+ className={cn(
58
+ "text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
59
+ className
60
+ )}
61
+ {...props}
62
+ />
63
+ )
64
+ }
65
+
66
+ export { Alert, AlertTitle, AlertDescription }
@@ -0,0 +1,11 @@
1
+ "use client"
2
+
3
+ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
4
+
5
+ function AspectRatio({
6
+ ...props
7
+ }: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
8
+ return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />
9
+ }
10
+
11
+ export { AspectRatio }
@@ -0,0 +1,53 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as AvatarPrimitive from "@radix-ui/react-avatar"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ function Avatar({
9
+ className,
10
+ ...props
11
+ }: React.ComponentProps<typeof AvatarPrimitive.Root>) {
12
+ return (
13
+ <AvatarPrimitive.Root
14
+ data-slot="avatar"
15
+ className={cn(
16
+ "relative flex size-8 shrink-0 overflow-hidden rounded-full",
17
+ className
18
+ )}
19
+ {...props}
20
+ />
21
+ )
22
+ }
23
+
24
+ function AvatarImage({
25
+ className,
26
+ ...props
27
+ }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
28
+ return (
29
+ <AvatarPrimitive.Image
30
+ data-slot="avatar-image"
31
+ className={cn("aspect-square size-full", className)}
32
+ {...props}
33
+ />
34
+ )
35
+ }
36
+
37
+ function AvatarFallback({
38
+ className,
39
+ ...props
40
+ }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
41
+ return (
42
+ <AvatarPrimitive.Fallback
43
+ data-slot="avatar-fallback"
44
+ className={cn(
45
+ "bg-muted flex size-full items-center justify-center rounded-full",
46
+ className
47
+ )}
48
+ {...props}
49
+ />
50
+ )
51
+ }
52
+
53
+ export { Avatar, AvatarImage, AvatarFallback }