create-thexjs-app 1.0.0 → 1.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.
- package/README.md +56 -915
- package/dist/index.js +283 -196
- package/package.json +5 -1
- package/templates/{basic → addons/auth}/src/api/auth/login.ts +1 -3
- package/templates/{basic → addons/auth}/src/lib/auth.ts +13 -9
- package/templates/{basic → addons/auth}/src/lib/migrations/001_create_sessions.sql +1 -3
- package/templates/addons/auth/src/pages/dashboard/index.tsx +39 -0
- package/templates/addons/auth/src/pages/login.tsx +72 -0
- package/templates/addons/content/content/hello-world.md +13 -0
- package/templates/addons/content/src/pages/blog.tsx +29 -0
- package/templates/{basic → addons/shadcn}/components.json +1 -1
- package/templates/addons/shadcn/src/components/ui/badge.tsx +17 -0
- package/templates/addons/shadcn/src/components/ui/button.tsx +36 -0
- package/templates/addons/shadcn/src/components/ui/card.tsx +33 -0
- package/templates/addons/shadcn/src/components/ui/input.tsx +18 -0
- package/templates/addons/tailwind/src/styles/globals.css +32 -0
- package/templates/base/_gitignore +26 -0
- package/templates/base/src/pages/index.tsx +29 -0
- package/templates/base/src/styles/globals.css +22 -0
- package/templates/base/tsconfig.json +24 -0
- package/templates/basic/content/blog/hello.md +0 -8
- package/templates/basic/public/favicon.ico +0 -0
- package/templates/basic/src/actions/dashboard/greet.ts +0 -3
- package/templates/basic/src/api/placeholder/comments.ts +0 -17
- package/templates/basic/src/api/placeholder/posts.ts +0 -20
- package/templates/basic/src/api/placeholder/todos.ts +0 -21
- package/templates/basic/src/api/placeholder/users.ts +0 -12
- package/templates/basic/src/components/Head.tsx +0 -21
- package/templates/basic/src/components/Image.tsx +0 -27
- package/templates/basic/src/components/Link.tsx +0 -10
- package/templates/basic/src/components/ui/badge.tsx +0 -49
- package/templates/basic/src/components/ui/button.tsx +0 -58
- package/templates/basic/src/components/ui/card.tsx +0 -88
- package/templates/basic/src/components/ui/input.tsx +0 -20
- package/templates/basic/src/layouts/main.tsx +0 -38
- package/templates/basic/src/lib/placeholder-data.ts +0 -176
- package/templates/basic/src/pages/_404.tsx +0 -17
- package/templates/basic/src/pages/about.tsx +0 -22
- package/templates/basic/src/pages/blog.tsx +0 -41
- package/templates/basic/src/pages/dashboard/index.tsx +0 -84
- package/templates/basic/src/pages/index.tsx +0 -54
- package/templates/basic/src/pages/login.tsx +0 -92
- package/templates/basic/src/pages/placeholder.tsx +0 -203
- package/templates/basic/src/pages/posts/[id].tsx +0 -17
- package/templates/basic/src/styles/globals.css +0 -90
- package/templates/basic/src/x-routes.ts +0 -29
- package/templates/basic/tsconfig.json +0 -11
- package/templates/basic/x.config.ts +0 -10
- package/templates/blog/components.json +0 -20
- package/templates/blog/content/posts/getting-started.md +0 -38
- package/templates/blog/content/posts/hello-world.md +0 -21
- package/templates/blog/content/posts/tailwind-v4.md +0 -31
- package/templates/blog/public/favicon.ico +0 -0
- package/templates/blog/src/components/ui/avatar.tsx +0 -91
- package/templates/blog/src/components/ui/badge.tsx +0 -49
- package/templates/blog/src/components/ui/button.tsx +0 -58
- package/templates/blog/src/components/ui/card.tsx +0 -88
- package/templates/blog/src/components/ui/input.tsx +0 -20
- package/templates/blog/src/layouts/blog.tsx +0 -46
- package/templates/blog/src/layouts/main.tsx +0 -32
- package/templates/blog/src/lib/utils.ts +0 -5
- package/templates/blog/src/pages/about.tsx +0 -36
- package/templates/blog/src/pages/blog/[slug].tsx +0 -56
- package/templates/blog/src/pages/blog/index.tsx +0 -70
- package/templates/blog/src/pages/index.tsx +0 -73
- package/templates/blog/src/styles/globals.css +0 -90
- package/templates/blog/src/x-routes.ts +0 -20
- package/templates/blog/tsconfig.json +0 -5
- package/templates/blog/x.config.ts +0 -6
- package/templates/default/components.json +0 -19
- package/templates/default/src/layouts/main.tsx +0 -28
- package/templates/default/src/pages/index.tsx +0 -66
- package/templates/default/src/styles/globals.css +0 -55
- package/templates/default/src/x-routes.ts +0 -17
- package/templates/default/tsconfig.json +0 -5
- package/templates/default/x.config.ts +0 -6
- package/templates/landing/components.json +0 -20
- package/templates/landing/public/favicon.ico +0 -0
- package/templates/landing/src/components/code-block.tsx +0 -118
- package/templates/landing/src/components/ui/avatar.tsx +0 -91
- package/templates/landing/src/components/ui/badge.tsx +0 -49
- package/templates/landing/src/components/ui/button.tsx +0 -58
- package/templates/landing/src/components/ui/card.tsx +0 -88
- package/templates/landing/src/components/ui/input.tsx +0 -20
- package/templates/landing/src/layouts/main.tsx +0 -78
- package/templates/landing/src/lib/syntax.tsx +0 -366
- package/templates/landing/src/lib/utils.ts +0 -5
- package/templates/landing/src/pages/docs/_layout.tsx +0 -139
- package/templates/landing/src/pages/docs/api-routes.tsx +0 -113
- package/templates/landing/src/pages/docs/build-deploy.tsx +0 -124
- package/templates/landing/src/pages/docs/configuration.tsx +0 -121
- package/templates/landing/src/pages/docs/content-collections.tsx +0 -130
- package/templates/landing/src/pages/docs/data-layer.tsx +0 -142
- package/templates/landing/src/pages/docs/getting-started.tsx +0 -129
- package/templates/landing/src/pages/docs/index.tsx +0 -187
- package/templates/landing/src/pages/docs/installation.tsx +0 -143
- package/templates/landing/src/pages/docs/introduction.tsx +0 -114
- package/templates/landing/src/pages/docs/layouts.tsx +0 -114
- package/templates/landing/src/pages/docs/middleware.tsx +0 -124
- package/templates/landing/src/pages/docs/packages/cli.tsx +0 -133
- package/templates/landing/src/pages/docs/packages/core.tsx +0 -176
- package/templates/landing/src/pages/docs/packages/env.tsx +0 -128
- package/templates/landing/src/pages/docs/pages.tsx +0 -135
- package/templates/landing/src/pages/docs/routing.tsx +0 -123
- package/templates/landing/src/pages/docs/server-functions.tsx +0 -177
- package/templates/landing/src/pages/features.tsx +0 -129
- package/templates/landing/src/pages/index.tsx +0 -159
- package/templates/landing/src/styles/globals.css +0 -136
- package/templates/landing/src/x-routes.ts +0 -31
- package/templates/landing/tsconfig.json +0 -10
- package/templates/landing/x.config.ts +0 -2
- package/templates/saas/components.json +0 -20
- package/templates/saas/public/favicon.ico +0 -0
- package/templates/saas/src/actions/dashboard.ts +0 -3
- package/templates/saas/src/api/auth/login.ts +0 -31
- package/templates/saas/src/components/ui/avatar.tsx +0 -91
- package/templates/saas/src/components/ui/badge.tsx +0 -49
- package/templates/saas/src/components/ui/button.tsx +0 -58
- package/templates/saas/src/components/ui/card.tsx +0 -88
- package/templates/saas/src/components/ui/input.tsx +0 -20
- package/templates/saas/src/layouts/dashboard.tsx +0 -67
- package/templates/saas/src/layouts/main.tsx +0 -38
- package/templates/saas/src/lib/auth.ts +0 -91
- package/templates/saas/src/lib/migrations/001_create_sessions.sql +0 -9
- package/templates/saas/src/lib/utils.ts +0 -5
- package/templates/saas/src/pages/dashboard/_middleware.ts +0 -9
- package/templates/saas/src/pages/dashboard/analytics.tsx +0 -68
- package/templates/saas/src/pages/dashboard/index.tsx +0 -86
- package/templates/saas/src/pages/dashboard/settings.tsx +0 -111
- package/templates/saas/src/pages/index.tsx +0 -110
- package/templates/saas/src/pages/login.tsx +0 -140
- package/templates/saas/src/pages/pricing.tsx +0 -121
- package/templates/saas/src/styles/globals.css +0 -90
- package/templates/saas/src/x-routes.ts +0 -22
- package/templates/saas/tsconfig.json +0 -5
- package/templates/saas/x.config.ts +0 -7
- /package/templates/{basic → addons/auth}/src/api/auth/logout.ts +0 -0
- /package/templates/{basic → addons/auth}/src/pages/dashboard/_middleware.ts +0 -0
- /package/templates/{basic → addons/shadcn}/src/lib/utils.ts +0 -0
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import type { LoaderArgs, RouteProps } from "@thexjs/core";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { Button } from "../components/ui/button";
|
|
4
|
-
import { Input } from "../components/ui/input";
|
|
5
|
-
import { createSession, setSessionCookie } from "../lib/auth";
|
|
6
|
-
|
|
7
|
-
export async function loader({ request }: LoaderArgs) {
|
|
8
|
-
if (request.method === "POST") {
|
|
9
|
-
const formData = await request.formData();
|
|
10
|
-
const username = formData.get("username") as string | null;
|
|
11
|
-
const password = formData.get("password") as string | null;
|
|
12
|
-
if (username === "admin" && password === "admin") {
|
|
13
|
-
const session = createSession(username);
|
|
14
|
-
return new Response(null, {
|
|
15
|
-
status: 302,
|
|
16
|
-
headers: { Location: "/dashboard", "Set-Cookie": setSessionCookie(session.token) },
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return { error: "Invalid credentials" };
|
|
20
|
-
}
|
|
21
|
-
return {};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default function LoginPage({ loaderData }: RouteProps) {
|
|
25
|
-
const [error, setError] = useState((loaderData?.error as string) ?? "");
|
|
26
|
-
const [loading, setLoading] = useState(false);
|
|
27
|
-
|
|
28
|
-
async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
|
|
29
|
-
e.preventDefault();
|
|
30
|
-
setError("");
|
|
31
|
-
setLoading(true);
|
|
32
|
-
const form = e.currentTarget;
|
|
33
|
-
const data = { username: form.username.value, password: form.password.value };
|
|
34
|
-
try {
|
|
35
|
-
const res = await fetch("/api/auth/login", {
|
|
36
|
-
method: "POST",
|
|
37
|
-
headers: { "Content-Type": "application/json" },
|
|
38
|
-
body: JSON.stringify(data),
|
|
39
|
-
});
|
|
40
|
-
if (res.ok) {
|
|
41
|
-
window.location.href = "/dashboard";
|
|
42
|
-
} else {
|
|
43
|
-
const err = await res.json();
|
|
44
|
-
setError(err.error || "Login failed");
|
|
45
|
-
}
|
|
46
|
-
} catch {
|
|
47
|
-
setError("Network error");
|
|
48
|
-
} finally {
|
|
49
|
-
setLoading(false);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<div className="mx-auto max-w-sm mt-16 space-y-6">
|
|
55
|
-
<h1 className="text-2xl font-bold text-center">Login</h1>
|
|
56
|
-
<form method="POST" action="/login" onSubmit={handleSubmit} className="space-y-4">
|
|
57
|
-
<div className="space-y-2">
|
|
58
|
-
<label htmlFor="username" className="text-sm font-medium">
|
|
59
|
-
Username
|
|
60
|
-
</label>
|
|
61
|
-
<Input id="username" name="username" defaultValue="admin" required />
|
|
62
|
-
</div>
|
|
63
|
-
<div className="space-y-2">
|
|
64
|
-
<label htmlFor="password" className="text-sm font-medium">
|
|
65
|
-
Password
|
|
66
|
-
</label>
|
|
67
|
-
<Input id="password" name="password" type="password" defaultValue="admin" required />
|
|
68
|
-
</div>
|
|
69
|
-
{error && (
|
|
70
|
-
<p id="login-error" className="text-sm text-destructive">
|
|
71
|
-
{error}
|
|
72
|
-
</p>
|
|
73
|
-
)}
|
|
74
|
-
<Button type="submit" disabled={loading} className="w-full">
|
|
75
|
-
{loading ? "Signing in..." : "Sign in"}
|
|
76
|
-
</Button>
|
|
77
|
-
</form>
|
|
78
|
-
<p className="text-xs text-muted-foreground text-center">Demo credentials: admin / admin</p>
|
|
79
|
-
<p className="text-xs text-muted-foreground text-center">
|
|
80
|
-
Demo only — replace with real auth before shipping.
|
|
81
|
-
</p>
|
|
82
|
-
<p className="text-center">
|
|
83
|
-
<a
|
|
84
|
-
href="/"
|
|
85
|
-
className="text-sm text-muted-foreground hover:text-foreground transition-colors"
|
|
86
|
-
>
|
|
87
|
-
← Back home
|
|
88
|
-
</a>
|
|
89
|
-
</p>
|
|
90
|
-
</div>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
export default function PlaceholderPage() {
|
|
2
|
-
return (
|
|
3
|
-
<div className="mx-auto max-w-3xl space-y-6">
|
|
4
|
-
<h1 className="text-3xl font-bold">
|
|
5
|
-
{"{"}JSON{"}"} Placeholder
|
|
6
|
-
</h1>
|
|
7
|
-
<p className="text-muted-foreground">
|
|
8
|
-
Free fake API powered by <strong>@thexjs/core</strong> — in-memory data, sub-ms response
|
|
9
|
-
times.
|
|
10
|
-
</p>
|
|
11
|
-
|
|
12
|
-
<div className="overflow-x-auto rounded-lg border border-border">
|
|
13
|
-
<table className="w-full text-sm">
|
|
14
|
-
<thead>
|
|
15
|
-
<tr className="border-b border-border">
|
|
16
|
-
<th className="text-left p-3 font-medium">Endpoint</th>
|
|
17
|
-
<th className="text-right p-3 font-medium">Size</th>
|
|
18
|
-
<th className="text-right p-3 font-medium">Action</th>
|
|
19
|
-
</tr>
|
|
20
|
-
</thead>
|
|
21
|
-
<tbody id="endpoints">
|
|
22
|
-
<tr className="border-b border-border">
|
|
23
|
-
<td className="p-3">
|
|
24
|
-
<code className="bg-muted px-1.5 py-0.5 rounded">GET /api/placeholder/posts</code>
|
|
25
|
-
</td>
|
|
26
|
-
<td className="text-right p-3">100</td>
|
|
27
|
-
<td className="text-right p-3">
|
|
28
|
-
<button
|
|
29
|
-
type="button"
|
|
30
|
-
className="fetch-btn text-primary hover:underline text-xs"
|
|
31
|
-
data-url="/api/placeholder/posts"
|
|
32
|
-
>
|
|
33
|
-
Fetch
|
|
34
|
-
</button>
|
|
35
|
-
</td>
|
|
36
|
-
</tr>
|
|
37
|
-
<tr className="border-b border-border">
|
|
38
|
-
<td className="p-3">
|
|
39
|
-
<code className="bg-muted px-1.5 py-0.5 rounded">
|
|
40
|
-
GET /api/placeholder/comments
|
|
41
|
-
</code>
|
|
42
|
-
</td>
|
|
43
|
-
<td className="text-right p-3">500</td>
|
|
44
|
-
<td className="text-right p-3">
|
|
45
|
-
<button
|
|
46
|
-
type="button"
|
|
47
|
-
className="fetch-btn text-primary hover:underline text-xs"
|
|
48
|
-
data-url="/api/placeholder/comments"
|
|
49
|
-
>
|
|
50
|
-
Fetch
|
|
51
|
-
</button>
|
|
52
|
-
</td>
|
|
53
|
-
</tr>
|
|
54
|
-
<tr className="border-b border-border">
|
|
55
|
-
<td className="p-3">
|
|
56
|
-
<code className="bg-muted px-1.5 py-0.5 rounded">GET /api/placeholder/todos</code>
|
|
57
|
-
</td>
|
|
58
|
-
<td className="text-right p-3">200</td>
|
|
59
|
-
<td className="text-right p-3">
|
|
60
|
-
<button
|
|
61
|
-
type="button"
|
|
62
|
-
className="fetch-btn text-primary hover:underline text-xs"
|
|
63
|
-
data-url="/api/placeholder/todos"
|
|
64
|
-
>
|
|
65
|
-
Fetch
|
|
66
|
-
</button>
|
|
67
|
-
</td>
|
|
68
|
-
</tr>
|
|
69
|
-
<tr className="border-b border-border">
|
|
70
|
-
<td className="p-3">
|
|
71
|
-
<code className="bg-muted px-1.5 py-0.5 rounded">GET /api/placeholder/users</code>
|
|
72
|
-
</td>
|
|
73
|
-
<td className="text-right p-3">10</td>
|
|
74
|
-
<td className="text-right p-3">
|
|
75
|
-
<button
|
|
76
|
-
type="button"
|
|
77
|
-
className="fetch-btn text-primary hover:underline text-xs"
|
|
78
|
-
data-url="/api/placeholder/users"
|
|
79
|
-
>
|
|
80
|
-
Fetch
|
|
81
|
-
</button>
|
|
82
|
-
</td>
|
|
83
|
-
</tr>
|
|
84
|
-
<tr className="font-semibold">
|
|
85
|
-
<td colSpan={2} className="p-3">
|
|
86
|
-
All endpoints (sequential)
|
|
87
|
-
</td>
|
|
88
|
-
<td className="text-right p-3">
|
|
89
|
-
<button
|
|
90
|
-
id="fetch-all"
|
|
91
|
-
type="button"
|
|
92
|
-
className="fetch-btn text-primary hover:underline text-xs"
|
|
93
|
-
>
|
|
94
|
-
Fetch All
|
|
95
|
-
</button>
|
|
96
|
-
</td>
|
|
97
|
-
</tr>
|
|
98
|
-
</tbody>
|
|
99
|
-
</table>
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
<div
|
|
103
|
-
id="results"
|
|
104
|
-
className="rounded-lg border border-border bg-muted p-4 font-mono text-xs whitespace-pre-wrap min-h-[60px]"
|
|
105
|
-
>
|
|
106
|
-
Click a button to fetch data. Response times shown below.
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
<hr className="border-border" />
|
|
110
|
-
<a href="/" className="text-sm text-muted-foreground hover:text-foreground transition-colors">
|
|
111
|
-
← Back home
|
|
112
|
-
</a>
|
|
113
|
-
|
|
114
|
-
<script
|
|
115
|
-
dangerouslySetInnerHTML={{
|
|
116
|
-
__html: `
|
|
117
|
-
(function () {
|
|
118
|
-
var results = document.getElementById("results");
|
|
119
|
-
if (!results) return;
|
|
120
|
-
function log(msg) { results.textContent = msg; }
|
|
121
|
-
|
|
122
|
-
function fmt(ms) {
|
|
123
|
-
if (ms < 1) return (ms * 1000).toFixed(0) + " \\u00b5s";
|
|
124
|
-
if (ms < 10) return ms.toFixed(2) + " ms";
|
|
125
|
-
return ms.toFixed(1) + " ms";
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
[].forEach.call(document.querySelectorAll(".fetch-btn:not(#fetch-all)"), function (btn) {
|
|
129
|
-
btn.addEventListener("click", function () {
|
|
130
|
-
var url = btn.getAttribute("data-url");
|
|
131
|
-
btn.disabled = true;
|
|
132
|
-
btn.textContent = "Loading...";
|
|
133
|
-
log("Fetching " + url + "\\n");
|
|
134
|
-
var start = performance.now();
|
|
135
|
-
fetch(url)
|
|
136
|
-
.then(function (r) { return r.json(); })
|
|
137
|
-
.then(function (json) {
|
|
138
|
-
var elapsed = performance.now() - start;
|
|
139
|
-
var size = JSON.stringify(json).length;
|
|
140
|
-
var label = btn.parentElement.previousElementSibling.textContent.trim();
|
|
141
|
-
log(
|
|
142
|
-
"\\u2714 " + url + "\\n" +
|
|
143
|
-
"Status: 200 OK\\n" +
|
|
144
|
-
"Time: " + fmt(elapsed) + "\\n" +
|
|
145
|
-
"Size: " + (size / 1024).toFixed(1) + " KB\\n" +
|
|
146
|
-
"Items: " + (Array.isArray(json) ? json.length : json.data ? json.data.length : 1) + "\\n\\n" +
|
|
147
|
-
JSON.stringify(json, null, 2).slice(0, 2000) +
|
|
148
|
-
(JSON.stringify(json, null, 2).length > 2000 ? "\\n..." : "")
|
|
149
|
-
);
|
|
150
|
-
})
|
|
151
|
-
.catch(function (err) {
|
|
152
|
-
log("\\u2716 Error: " + err.message);
|
|
153
|
-
})
|
|
154
|
-
.finally(function () {
|
|
155
|
-
btn.disabled = false;
|
|
156
|
-
btn.textContent = "Fetch";
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
var fetchAll = document.getElementById("fetch-all");
|
|
162
|
-
if (fetchAll) {
|
|
163
|
-
fetchAll.addEventListener("click", function () {
|
|
164
|
-
fetchAll.disabled = true;
|
|
165
|
-
fetchAll.textContent = "Running...";
|
|
166
|
-
var urls = ["/api/placeholder/posts", "/api/placeholder/comments", "/api/placeholder/todos", "/api/placeholder/users"];
|
|
167
|
-
var lines = ["Benchmarking " + urls.length + " endpoints...\\n"];
|
|
168
|
-
var totalStart = performance.now();
|
|
169
|
-
|
|
170
|
-
function run(i) {
|
|
171
|
-
if (i >= urls.length) {
|
|
172
|
-
var total = performance.now() - totalStart;
|
|
173
|
-
lines.push("\\u2014".repeat(30));
|
|
174
|
-
lines.push("Total: " + fmt(total) + " (" + fmt(total / urls.length) + " avg)");
|
|
175
|
-
log(lines.join("\\n"));
|
|
176
|
-
fetchAll.disabled = false;
|
|
177
|
-
fetchAll.textContent = "Fetch All";
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
var url = urls[i];
|
|
181
|
-
var start = performance.now();
|
|
182
|
-
fetch(url)
|
|
183
|
-
.then(function (r) { return r.json(); })
|
|
184
|
-
.then(function () {
|
|
185
|
-
var elapsed = performance.now() - start;
|
|
186
|
-
lines.push((i + 1) + ". " + url + " \\u2192 " + fmt(elapsed));
|
|
187
|
-
run(i + 1);
|
|
188
|
-
})
|
|
189
|
-
.catch(function (err) {
|
|
190
|
-
lines.push((i + 1) + ". " + url + " \\u2716 " + err.message);
|
|
191
|
-
run(i + 1);
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
run(0);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
})();
|
|
198
|
-
`.trim(),
|
|
199
|
-
}}
|
|
200
|
-
/>
|
|
201
|
-
</div>
|
|
202
|
-
);
|
|
203
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { RouteProps } from "@thexjs/core";
|
|
2
|
-
|
|
3
|
-
export default function PostPage({ params }: RouteProps) {
|
|
4
|
-
return (
|
|
5
|
-
<div className="space-y-4">
|
|
6
|
-
<h1 className="text-3xl font-bold">Post: {params.id}</h1>
|
|
7
|
-
<p>
|
|
8
|
-
<a
|
|
9
|
-
href="/"
|
|
10
|
-
className="text-sm text-muted-foreground hover:text-foreground transition-colors"
|
|
11
|
-
>
|
|
12
|
-
← Back home
|
|
13
|
-
</a>
|
|
14
|
-
</p>
|
|
15
|
-
</div>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
@import "tw-animate-css";
|
|
3
|
-
|
|
4
|
-
@custom-variant dark (&:is(.dark *));
|
|
5
|
-
|
|
6
|
-
@theme inline {
|
|
7
|
-
--color-background: var(--background);
|
|
8
|
-
--color-foreground: var(--foreground);
|
|
9
|
-
--color-card: var(--card);
|
|
10
|
-
--color-card-foreground: var(--card-foreground);
|
|
11
|
-
--color-popover: var(--popover);
|
|
12
|
-
--color-popover-foreground: var(--popover-foreground);
|
|
13
|
-
--color-primary: var(--primary);
|
|
14
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
15
|
-
--color-secondary: var(--secondary);
|
|
16
|
-
--color-secondary-foreground: var(--secondary-foreground);
|
|
17
|
-
--color-muted: var(--muted);
|
|
18
|
-
--color-muted-foreground: var(--muted-foreground);
|
|
19
|
-
--color-accent: var(--accent);
|
|
20
|
-
--color-accent-foreground: var(--accent-foreground);
|
|
21
|
-
--color-destructive: var(--destructive);
|
|
22
|
-
--color-destructive-foreground: var(--destructive-foreground);
|
|
23
|
-
--color-border: var(--border);
|
|
24
|
-
--color-input: var(--input);
|
|
25
|
-
--color-ring: var(--ring);
|
|
26
|
-
--color-chart-1: var(--chart-1);
|
|
27
|
-
--color-chart-2: var(--chart-2);
|
|
28
|
-
--color-chart-3: var(--chart-3);
|
|
29
|
-
--color-chart-4: var(--chart-4);
|
|
30
|
-
--color-chart-5: var(--chart-5);
|
|
31
|
-
--radius-sm: calc(var(--radius) * 0.6);
|
|
32
|
-
--radius-md: calc(var(--radius) * 0.8);
|
|
33
|
-
--radius-lg: var(--radius);
|
|
34
|
-
--radius-xl: calc(var(--radius) * 1.4);
|
|
35
|
-
--radius-2xl: calc(var(--radius) * 1.8);
|
|
36
|
-
--radius-3xl: calc(var(--radius) * 2.2);
|
|
37
|
-
--radius-4xl: calc(var(--radius) * 2.6);
|
|
38
|
-
--color-sidebar: var(--sidebar);
|
|
39
|
-
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
40
|
-
--color-sidebar-primary: var(--sidebar-primary);
|
|
41
|
-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
42
|
-
--color-sidebar-accent: var(--sidebar-accent);
|
|
43
|
-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
44
|
-
--color-sidebar-border: var(--sidebar-border);
|
|
45
|
-
--color-sidebar-ring: var(--sidebar-ring);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:root {
|
|
49
|
-
--radius: 0.625rem;
|
|
50
|
-
--background: oklch(0.145 0 0);
|
|
51
|
-
--foreground: oklch(0.985 0 0);
|
|
52
|
-
--card: oklch(0.205 0 0);
|
|
53
|
-
--card-foreground: oklch(0.985 0 0);
|
|
54
|
-
--popover: oklch(0.205 0 0);
|
|
55
|
-
--popover-foreground: oklch(0.985 0 0);
|
|
56
|
-
--primary: oklch(0.922 0 0);
|
|
57
|
-
--primary-foreground: oklch(0.205 0 0);
|
|
58
|
-
--secondary: oklch(0.269 0 0);
|
|
59
|
-
--secondary-foreground: oklch(0.985 0 0);
|
|
60
|
-
--muted: oklch(0.269 0 0);
|
|
61
|
-
--muted-foreground: oklch(0.708 0 0);
|
|
62
|
-
--accent: oklch(0.269 0 0);
|
|
63
|
-
--accent-foreground: oklch(0.985 0 0);
|
|
64
|
-
--destructive: oklch(0.704 0.191 22.216);
|
|
65
|
-
--border: oklch(1 0 0 / 10%);
|
|
66
|
-
--input: oklch(1 0 0 / 15%);
|
|
67
|
-
--ring: oklch(0.556 0 0);
|
|
68
|
-
--chart-1: oklch(0.488 0.243 264.376);
|
|
69
|
-
--chart-2: oklch(0.696 0.17 162.48);
|
|
70
|
-
--chart-3: oklch(0.769 0.188 70.08);
|
|
71
|
-
--chart-4: oklch(0.627 0.265 303.9);
|
|
72
|
-
--chart-5: oklch(0.645 0.246 16.439);
|
|
73
|
-
--sidebar: oklch(0.205 0 0);
|
|
74
|
-
--sidebar-foreground: oklch(0.985 0 0);
|
|
75
|
-
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
76
|
-
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
77
|
-
--sidebar-accent: oklch(0.269 0 0);
|
|
78
|
-
--sidebar-foreground: oklch(0.985 0 0);
|
|
79
|
-
--sidebar-border: oklch(1 0 0 / 10%);
|
|
80
|
-
--sidebar-ring: oklch(0.556 0 0);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
@layer base {
|
|
84
|
-
* {
|
|
85
|
-
@apply border-border outline-ring/50;
|
|
86
|
-
}
|
|
87
|
-
body {
|
|
88
|
-
@apply bg-background text-foreground;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Auto-generated by @thexjs/core -- do not edit
|
|
2
|
-
export type RouteMap = {
|
|
3
|
-
"/": Record<string, never>;
|
|
4
|
-
"/posts/:id": { id: string };
|
|
5
|
-
"/login": Record<string, never>;
|
|
6
|
-
"/dashboard": Record<string, never>;
|
|
7
|
-
"/blog": Record<string, never>;
|
|
8
|
-
"/placeholder": Record<string, never>;
|
|
9
|
-
"/about": Record<string, never>;
|
|
10
|
-
"/api/auth/login": Record<string, never>;
|
|
11
|
-
"/api/auth/logout": Record<string, never>;
|
|
12
|
-
"/api/placeholder/comments": Record<string, never>;
|
|
13
|
-
"/api/placeholder/posts": Record<string, never>;
|
|
14
|
-
"/api/placeholder/todos": Record<string, never>;
|
|
15
|
-
"/api/placeholder/users": Record<string, never>;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export function href<T extends keyof RouteMap & string>(
|
|
19
|
-
path: T,
|
|
20
|
-
...[params]: RouteMap[T] extends Record<string, never> ? [] : [RouteMap[T]]
|
|
21
|
-
): string {
|
|
22
|
-
if (!params) return path;
|
|
23
|
-
let result: string = path;
|
|
24
|
-
for (const [key, value] of Object.entries(params)) {
|
|
25
|
-
result = result.replace(new RegExp(`:${key}(?=/|$)`), encodeURIComponent(String(value)));
|
|
26
|
-
}
|
|
27
|
-
result = result.replace(/\*+$/, "");
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
-
"style": "base-nova",
|
|
4
|
-
"rsc": false,
|
|
5
|
-
"tsx": true,
|
|
6
|
-
"tailwind": {
|
|
7
|
-
"config": "",
|
|
8
|
-
"css": "src/styles/globals.css",
|
|
9
|
-
"baseColor": "neutral",
|
|
10
|
-
"cssVariables": true,
|
|
11
|
-
"prefix": ""
|
|
12
|
-
},
|
|
13
|
-
"aliases": {
|
|
14
|
-
"components": "@/components",
|
|
15
|
-
"utils": "@/lib/utils",
|
|
16
|
-
"ui": "@/components/ui",
|
|
17
|
-
"lib": "@/lib"
|
|
18
|
-
},
|
|
19
|
-
"iconLibrary": "lucide"
|
|
20
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Getting Started with x Framework"
|
|
3
|
-
date: "2026-07-26"
|
|
4
|
-
description: "Learn how to build your first fullstack application with x framework."
|
|
5
|
-
tags: [tutorial, x-framework]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Getting Started with x Framework
|
|
9
|
-
|
|
10
|
-
x is a fullstack framework for Bun that lets you build static sites, SSR pages, API routes, and server functions — all in one process.
|
|
11
|
-
|
|
12
|
-
## Quick Start
|
|
13
|
-
|
|
14
|
-
Create a new project and define your routes in `src/pages/`:
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
my-app/
|
|
18
|
-
├── src/
|
|
19
|
-
│ ├── pages/
|
|
20
|
-
│ │ ├── index.tsx
|
|
21
|
-
│ │ └── about.tsx
|
|
22
|
-
│ ├── layouts/
|
|
23
|
-
│ │ └── main.tsx
|
|
24
|
-
│ └── api/
|
|
25
|
-
│ └── hello.ts
|
|
26
|
-
├── content/
|
|
27
|
-
└── x.config.ts
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## File-based Routing
|
|
31
|
-
|
|
32
|
-
Each file in `src/pages/` becomes a route automatically:
|
|
33
|
-
|
|
34
|
-
| File | Route |
|
|
35
|
-
|------|-------|
|
|
36
|
-
| `src/pages/index.tsx` | `/` |
|
|
37
|
-
| `src/pages/about.tsx` | `/about` |
|
|
38
|
-
| `src/pages/blog/[slug].tsx` | `/blog/:slug` |
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Hello World"
|
|
3
|
-
date: "2026-07-27"
|
|
4
|
-
description: "Welcome to our blog — a space for thoughts on web development, design, and technology."
|
|
5
|
-
tags: [welcome, meta]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Hello World
|
|
9
|
-
|
|
10
|
-
Welcome to **The Blog** — a space for thoughts on web development, design, and technology.
|
|
11
|
-
|
|
12
|
-
This site is built with [x framework](https://x.opencode.ai), a Bun-based fullstack framework that combines static generation, server-side rendering, and API routes in a single process.
|
|
13
|
-
|
|
14
|
-
## What to expect
|
|
15
|
-
|
|
16
|
-
- Articles on modern web development
|
|
17
|
-
- Deep dives into TypeScript, React, and Bun
|
|
18
|
-
- Design system patterns and best practices
|
|
19
|
-
- Performance optimization techniques
|
|
20
|
-
|
|
21
|
-
Stay tuned for more content coming soon!
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Tailwind CSS v4 — What's New"
|
|
3
|
-
date: "2026-07-25"
|
|
4
|
-
description: "A comprehensive look at the changes in Tailwind CSS v4, including the new CSS-first configuration."
|
|
5
|
-
tags: [css, tailwind, design]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Tailwind CSS v4 — What's New
|
|
9
|
-
|
|
10
|
-
Tailwind CSS v4 introduces a completely new configuration model based on native CSS. Gone are the days of `tailwind.config.js` — now everything lives in your CSS.
|
|
11
|
-
|
|
12
|
-
## CSS-First Configuration
|
|
13
|
-
|
|
14
|
-
Instead of JavaScript configuration, you use `@theme` directives:
|
|
15
|
-
|
|
16
|
-
```css
|
|
17
|
-
@import "tailwindcss";
|
|
18
|
-
|
|
19
|
-
@theme inline {
|
|
20
|
-
--color-brand: oklch(0.5 0.2 240);
|
|
21
|
-
--font-display: "Inter", sans-serif;
|
|
22
|
-
}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## New Utility Classes
|
|
26
|
-
|
|
27
|
-
v4 brings new utilities like `@container` queries, `field-sizing`, and more.
|
|
28
|
-
|
|
29
|
-
## Performance
|
|
30
|
-
|
|
31
|
-
The new engine is significantly faster than v3, with sub-second rebuilds even on large projects.
|
|
Binary file
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
|
|
2
|
-
import type * as React from "react";
|
|
3
|
-
|
|
4
|
-
import { cn } from "@/lib/utils";
|
|
5
|
-
|
|
6
|
-
function Avatar({
|
|
7
|
-
className,
|
|
8
|
-
size = "default",
|
|
9
|
-
...props
|
|
10
|
-
}: AvatarPrimitive.Root.Props & {
|
|
11
|
-
size?: "default" | "sm" | "lg";
|
|
12
|
-
}) {
|
|
13
|
-
return (
|
|
14
|
-
<AvatarPrimitive.Root
|
|
15
|
-
data-slot="avatar"
|
|
16
|
-
data-size={size}
|
|
17
|
-
className={cn(
|
|
18
|
-
"group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",
|
|
19
|
-
className,
|
|
20
|
-
)}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {
|
|
27
|
-
return (
|
|
28
|
-
<AvatarPrimitive.Image
|
|
29
|
-
data-slot="avatar-image"
|
|
30
|
-
className={cn("aspect-square size-full rounded-full object-cover", className)}
|
|
31
|
-
{...props}
|
|
32
|
-
/>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function AvatarFallback({ className, ...props }: AvatarPrimitive.Fallback.Props) {
|
|
37
|
-
return (
|
|
38
|
-
<AvatarPrimitive.Fallback
|
|
39
|
-
data-slot="avatar-fallback"
|
|
40
|
-
className={cn(
|
|
41
|
-
"flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",
|
|
42
|
-
className,
|
|
43
|
-
)}
|
|
44
|
-
{...props}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) {
|
|
50
|
-
return (
|
|
51
|
-
<span
|
|
52
|
-
data-slot="avatar-badge"
|
|
53
|
-
className={cn(
|
|
54
|
-
"absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none",
|
|
55
|
-
"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
|
|
56
|
-
"group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
|
|
57
|
-
"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
|
|
58
|
-
className,
|
|
59
|
-
)}
|
|
60
|
-
{...props}
|
|
61
|
-
/>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
66
|
-
return (
|
|
67
|
-
<div
|
|
68
|
-
data-slot="avatar-group"
|
|
69
|
-
className={cn(
|
|
70
|
-
"group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",
|
|
71
|
-
className,
|
|
72
|
-
)}
|
|
73
|
-
{...props}
|
|
74
|
-
/>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function AvatarGroupCount({ className, ...props }: React.ComponentProps<"div">) {
|
|
79
|
-
return (
|
|
80
|
-
<div
|
|
81
|
-
data-slot="avatar-group-count"
|
|
82
|
-
className={cn(
|
|
83
|
-
"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
|
|
84
|
-
className,
|
|
85
|
-
)}
|
|
86
|
-
{...props}
|
|
87
|
-
/>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarBadge };
|