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.
Files changed (139) hide show
  1. package/README.md +56 -915
  2. package/dist/index.js +283 -196
  3. package/package.json +5 -1
  4. package/templates/{basic → addons/auth}/src/api/auth/login.ts +1 -3
  5. package/templates/{basic → addons/auth}/src/lib/auth.ts +13 -9
  6. package/templates/{basic → addons/auth}/src/lib/migrations/001_create_sessions.sql +1 -3
  7. package/templates/addons/auth/src/pages/dashboard/index.tsx +39 -0
  8. package/templates/addons/auth/src/pages/login.tsx +72 -0
  9. package/templates/addons/content/content/hello-world.md +13 -0
  10. package/templates/addons/content/src/pages/blog.tsx +29 -0
  11. package/templates/{basic → addons/shadcn}/components.json +1 -1
  12. package/templates/addons/shadcn/src/components/ui/badge.tsx +17 -0
  13. package/templates/addons/shadcn/src/components/ui/button.tsx +36 -0
  14. package/templates/addons/shadcn/src/components/ui/card.tsx +33 -0
  15. package/templates/addons/shadcn/src/components/ui/input.tsx +18 -0
  16. package/templates/addons/tailwind/src/styles/globals.css +32 -0
  17. package/templates/base/_gitignore +26 -0
  18. package/templates/base/src/pages/index.tsx +29 -0
  19. package/templates/base/src/styles/globals.css +22 -0
  20. package/templates/base/tsconfig.json +24 -0
  21. package/templates/basic/content/blog/hello.md +0 -8
  22. package/templates/basic/public/favicon.ico +0 -0
  23. package/templates/basic/src/actions/dashboard/greet.ts +0 -3
  24. package/templates/basic/src/api/placeholder/comments.ts +0 -17
  25. package/templates/basic/src/api/placeholder/posts.ts +0 -20
  26. package/templates/basic/src/api/placeholder/todos.ts +0 -21
  27. package/templates/basic/src/api/placeholder/users.ts +0 -12
  28. package/templates/basic/src/components/Head.tsx +0 -21
  29. package/templates/basic/src/components/Image.tsx +0 -27
  30. package/templates/basic/src/components/Link.tsx +0 -10
  31. package/templates/basic/src/components/ui/badge.tsx +0 -49
  32. package/templates/basic/src/components/ui/button.tsx +0 -58
  33. package/templates/basic/src/components/ui/card.tsx +0 -88
  34. package/templates/basic/src/components/ui/input.tsx +0 -20
  35. package/templates/basic/src/layouts/main.tsx +0 -38
  36. package/templates/basic/src/lib/placeholder-data.ts +0 -176
  37. package/templates/basic/src/pages/_404.tsx +0 -17
  38. package/templates/basic/src/pages/about.tsx +0 -22
  39. package/templates/basic/src/pages/blog.tsx +0 -41
  40. package/templates/basic/src/pages/dashboard/index.tsx +0 -84
  41. package/templates/basic/src/pages/index.tsx +0 -54
  42. package/templates/basic/src/pages/login.tsx +0 -92
  43. package/templates/basic/src/pages/placeholder.tsx +0 -203
  44. package/templates/basic/src/pages/posts/[id].tsx +0 -17
  45. package/templates/basic/src/styles/globals.css +0 -90
  46. package/templates/basic/src/x-routes.ts +0 -29
  47. package/templates/basic/tsconfig.json +0 -11
  48. package/templates/basic/x.config.ts +0 -10
  49. package/templates/blog/components.json +0 -20
  50. package/templates/blog/content/posts/getting-started.md +0 -38
  51. package/templates/blog/content/posts/hello-world.md +0 -21
  52. package/templates/blog/content/posts/tailwind-v4.md +0 -31
  53. package/templates/blog/public/favicon.ico +0 -0
  54. package/templates/blog/src/components/ui/avatar.tsx +0 -91
  55. package/templates/blog/src/components/ui/badge.tsx +0 -49
  56. package/templates/blog/src/components/ui/button.tsx +0 -58
  57. package/templates/blog/src/components/ui/card.tsx +0 -88
  58. package/templates/blog/src/components/ui/input.tsx +0 -20
  59. package/templates/blog/src/layouts/blog.tsx +0 -46
  60. package/templates/blog/src/layouts/main.tsx +0 -32
  61. package/templates/blog/src/lib/utils.ts +0 -5
  62. package/templates/blog/src/pages/about.tsx +0 -36
  63. package/templates/blog/src/pages/blog/[slug].tsx +0 -56
  64. package/templates/blog/src/pages/blog/index.tsx +0 -70
  65. package/templates/blog/src/pages/index.tsx +0 -73
  66. package/templates/blog/src/styles/globals.css +0 -90
  67. package/templates/blog/src/x-routes.ts +0 -20
  68. package/templates/blog/tsconfig.json +0 -5
  69. package/templates/blog/x.config.ts +0 -6
  70. package/templates/default/components.json +0 -19
  71. package/templates/default/src/layouts/main.tsx +0 -28
  72. package/templates/default/src/pages/index.tsx +0 -66
  73. package/templates/default/src/styles/globals.css +0 -55
  74. package/templates/default/src/x-routes.ts +0 -17
  75. package/templates/default/tsconfig.json +0 -5
  76. package/templates/default/x.config.ts +0 -6
  77. package/templates/landing/components.json +0 -20
  78. package/templates/landing/public/favicon.ico +0 -0
  79. package/templates/landing/src/components/code-block.tsx +0 -118
  80. package/templates/landing/src/components/ui/avatar.tsx +0 -91
  81. package/templates/landing/src/components/ui/badge.tsx +0 -49
  82. package/templates/landing/src/components/ui/button.tsx +0 -58
  83. package/templates/landing/src/components/ui/card.tsx +0 -88
  84. package/templates/landing/src/components/ui/input.tsx +0 -20
  85. package/templates/landing/src/layouts/main.tsx +0 -78
  86. package/templates/landing/src/lib/syntax.tsx +0 -366
  87. package/templates/landing/src/lib/utils.ts +0 -5
  88. package/templates/landing/src/pages/docs/_layout.tsx +0 -139
  89. package/templates/landing/src/pages/docs/api-routes.tsx +0 -113
  90. package/templates/landing/src/pages/docs/build-deploy.tsx +0 -124
  91. package/templates/landing/src/pages/docs/configuration.tsx +0 -121
  92. package/templates/landing/src/pages/docs/content-collections.tsx +0 -130
  93. package/templates/landing/src/pages/docs/data-layer.tsx +0 -142
  94. package/templates/landing/src/pages/docs/getting-started.tsx +0 -129
  95. package/templates/landing/src/pages/docs/index.tsx +0 -187
  96. package/templates/landing/src/pages/docs/installation.tsx +0 -143
  97. package/templates/landing/src/pages/docs/introduction.tsx +0 -114
  98. package/templates/landing/src/pages/docs/layouts.tsx +0 -114
  99. package/templates/landing/src/pages/docs/middleware.tsx +0 -124
  100. package/templates/landing/src/pages/docs/packages/cli.tsx +0 -133
  101. package/templates/landing/src/pages/docs/packages/core.tsx +0 -176
  102. package/templates/landing/src/pages/docs/packages/env.tsx +0 -128
  103. package/templates/landing/src/pages/docs/pages.tsx +0 -135
  104. package/templates/landing/src/pages/docs/routing.tsx +0 -123
  105. package/templates/landing/src/pages/docs/server-functions.tsx +0 -177
  106. package/templates/landing/src/pages/features.tsx +0 -129
  107. package/templates/landing/src/pages/index.tsx +0 -159
  108. package/templates/landing/src/styles/globals.css +0 -136
  109. package/templates/landing/src/x-routes.ts +0 -31
  110. package/templates/landing/tsconfig.json +0 -10
  111. package/templates/landing/x.config.ts +0 -2
  112. package/templates/saas/components.json +0 -20
  113. package/templates/saas/public/favicon.ico +0 -0
  114. package/templates/saas/src/actions/dashboard.ts +0 -3
  115. package/templates/saas/src/api/auth/login.ts +0 -31
  116. package/templates/saas/src/components/ui/avatar.tsx +0 -91
  117. package/templates/saas/src/components/ui/badge.tsx +0 -49
  118. package/templates/saas/src/components/ui/button.tsx +0 -58
  119. package/templates/saas/src/components/ui/card.tsx +0 -88
  120. package/templates/saas/src/components/ui/input.tsx +0 -20
  121. package/templates/saas/src/layouts/dashboard.tsx +0 -67
  122. package/templates/saas/src/layouts/main.tsx +0 -38
  123. package/templates/saas/src/lib/auth.ts +0 -91
  124. package/templates/saas/src/lib/migrations/001_create_sessions.sql +0 -9
  125. package/templates/saas/src/lib/utils.ts +0 -5
  126. package/templates/saas/src/pages/dashboard/_middleware.ts +0 -9
  127. package/templates/saas/src/pages/dashboard/analytics.tsx +0 -68
  128. package/templates/saas/src/pages/dashboard/index.tsx +0 -86
  129. package/templates/saas/src/pages/dashboard/settings.tsx +0 -111
  130. package/templates/saas/src/pages/index.tsx +0 -110
  131. package/templates/saas/src/pages/login.tsx +0 -140
  132. package/templates/saas/src/pages/pricing.tsx +0 -121
  133. package/templates/saas/src/styles/globals.css +0 -90
  134. package/templates/saas/src/x-routes.ts +0 -22
  135. package/templates/saas/tsconfig.json +0 -5
  136. package/templates/saas/x.config.ts +0 -7
  137. /package/templates/{basic → addons/auth}/src/api/auth/logout.ts +0 -0
  138. /package/templates/{basic → addons/auth}/src/pages/dashboard/_middleware.ts +0 -0
  139. /package/templates/{basic → addons/shadcn}/src/lib/utils.ts +0 -0
@@ -0,0 +1,39 @@
1
+ export const metadata = {
2
+ title: "Dashboard",
3
+ };
4
+
5
+ export default function Dashboard() {
6
+ return (
7
+ <main style={{ maxWidth: 680, margin: "0 auto", padding: "4rem 1.5rem" }}>
8
+ <h1 style={{ fontSize: "2rem", marginBottom: "0.5rem" }}>Dashboard</h1>
9
+ <p style={{ color: "#64748b", marginBottom: "2rem" }}>
10
+ You're signed in. This page is protected by <code>src/pages/dashboard/_middleware.ts</code>.
11
+ </p>
12
+ <form
13
+ method="POST"
14
+ action="/api/auth/logout"
15
+ onSubmit={(e) => {
16
+ e.preventDefault();
17
+ fetch("/api/auth/logout", { method: "POST" }).then(() => {
18
+ window.location.href = "/login";
19
+ });
20
+ }}
21
+ >
22
+ <button type="submit" style={btn}>
23
+ Sign out
24
+ </button>
25
+ </form>
26
+ </main>
27
+ );
28
+ }
29
+
30
+ const btn: React.CSSProperties = {
31
+ padding: "0.6rem 1.1rem",
32
+ background: "#0f172a",
33
+ color: "#fff",
34
+ border: "none",
35
+ borderRadius: 8,
36
+ fontSize: "0.9rem",
37
+ fontWeight: 600,
38
+ cursor: "pointer",
39
+ };
@@ -0,0 +1,72 @@
1
+ import { useState } from "react";
2
+
3
+ export default function Login() {
4
+ const [error, setError] = useState("");
5
+ const [loading, setLoading] = useState(false);
6
+
7
+ async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
8
+ e.preventDefault();
9
+ setError("");
10
+ setLoading(true);
11
+ const form = e.currentTarget;
12
+ const data = { username: form.username.value, password: form.password.value };
13
+ try {
14
+ const res = await fetch("/api/auth/login", {
15
+ method: "POST",
16
+ headers: { "Content-Type": "application/json" },
17
+ body: JSON.stringify(data),
18
+ });
19
+ if (res.ok) {
20
+ window.location.href = "/dashboard";
21
+ } else {
22
+ const err = (await res.json()) as { error?: string };
23
+ setError(err.error ?? "Login failed");
24
+ }
25
+ } catch {
26
+ setError("Network error");
27
+ } finally {
28
+ setLoading(false);
29
+ }
30
+ }
31
+
32
+ return (
33
+ <main style={{ maxWidth: 360, margin: "0 auto", padding: "4rem 1.5rem" }}>
34
+ <h1 style={{ fontSize: "1.5rem", marginBottom: "1rem" }}>Sign in</h1>
35
+ <form onSubmit={handleSubmit} style={{ display: "grid", gap: "0.75rem" }}>
36
+ <label style={{ display: "grid", gap: "0.25rem" }}>
37
+ Username
38
+ <input name="username" defaultValue="admin" required style={field} />
39
+ </label>
40
+ <label style={{ display: "grid", gap: "0.25rem" }}>
41
+ Password
42
+ <input name="password" type="password" defaultValue="admin" required style={field} />
43
+ </label>
44
+ {error && <p style={{ color: "#dc2626", fontSize: "0.85rem" }}>{error}</p>}
45
+ <button type="submit" disabled={loading} style={submit}>
46
+ {loading ? "Signing in..." : "Sign in"}
47
+ </button>
48
+ </form>
49
+ <p style={{ fontSize: "0.8rem", color: "#64748b", marginTop: "1rem" }}>
50
+ Demo credentials: <code>admin</code> / <code>admin</code>
51
+ </p>
52
+ </main>
53
+ );
54
+ }
55
+
56
+ const field: React.CSSProperties = {
57
+ padding: "0.6rem 0.75rem",
58
+ border: "1px solid #cbd5e1",
59
+ borderRadius: 8,
60
+ fontSize: "0.95rem",
61
+ };
62
+
63
+ const submit: React.CSSProperties = {
64
+ padding: "0.65rem 1rem",
65
+ background: "#0f172a",
66
+ color: "#fff",
67
+ border: "none",
68
+ borderRadius: 8,
69
+ fontSize: "0.95rem",
70
+ fontWeight: 600,
71
+ cursor: "pointer",
72
+ };
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: Hello from content collections
3
+ description: Markdown with frontmatter becomes a route automatically.
4
+ ---
5
+
6
+ This page is rendered from a markdown file in `content/` — no route file needed.
7
+
8
+ Content collections let you write blog posts, docs, and marketing pages as
9
+ plain markdown with YAML frontmatter. Each `.md` / `.mdx` file becomes a route
10
+ at its path (`content/hello-world.md` -> `/hello-world`).
11
+
12
+ Use `scanContent()` and `renderMarkdown()` in loaders to build indexes and
13
+ dynamic pages on top of your content.
@@ -0,0 +1,29 @@
1
+ import { join } from "node:path";
2
+ import { type ContentEntry, scanContent } from "@thexjs/core";
3
+
4
+ const CONTENT_DIR = process.env.X_CONTENT_DIR ?? "content";
5
+
6
+ function listContent(): ContentEntry[] {
7
+ return scanContent(join(process.cwd(), CONTENT_DIR));
8
+ }
9
+
10
+ export default function Blog() {
11
+ const posts = listContent();
12
+ return (
13
+ <main style={{ maxWidth: 680, margin: "0 auto", padding: "4rem 1.5rem" }}>
14
+ <h1 style={{ fontSize: "2rem", marginBottom: "1.5rem" }}>Content</h1>
15
+ <ul style={{ listStyle: "none", padding: 0, display: "grid", gap: "0.75rem" }}>
16
+ {posts.map((post) => (
17
+ <li key={post.routePath}>
18
+ <a
19
+ href={post.routePath}
20
+ style={{ textDecoration: "none", color: "#0f172a", fontWeight: 600 }}
21
+ >
22
+ {post.frontmatter.title ?? post.slug}
23
+ </a>
24
+ </li>
25
+ ))}
26
+ </ul>
27
+ </main>
28
+ );
29
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://ui.shadcn.com/schema.json",
3
- "style": "base-nova",
3
+ "style": "default",
4
4
  "rsc": false,
5
5
  "tsx": true,
6
6
  "tailwind": {
@@ -0,0 +1,17 @@
1
+ import type * as React from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ function Badge({ className, ...props }: React.ComponentProps<"span">) {
6
+ return (
7
+ <span
8
+ className={cn(
9
+ "inline-flex items-center rounded-full border border-border px-2.5 py-0.5 text-xs font-semibold text-muted-foreground",
10
+ className,
11
+ )}
12
+ {...props}
13
+ />
14
+ );
15
+ }
16
+
17
+ export { Badge };
@@ -0,0 +1,36 @@
1
+ import { type VariantProps, cva } from "class-variance-authority";
2
+ import type * as React from "react";
3
+
4
+ import { cn } from "@/lib/utils";
5
+
6
+ const buttonVariants = cva(
7
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "bg-foreground text-background hover:bg-foreground/90",
12
+ outline: "border border-border bg-transparent hover:bg-muted",
13
+ destructive: "bg-red-600 text-white hover:bg-red-700",
14
+ },
15
+ size: {
16
+ default: "h-10 px-4 py-2",
17
+ sm: "h-9 rounded-md px-3",
18
+ lg: "h-11 rounded-md px-8",
19
+ icon: "h-10 w-10",
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ variant: "default",
24
+ size: "default",
25
+ },
26
+ },
27
+ );
28
+
29
+ export function Button({
30
+ className,
31
+ variant,
32
+ size,
33
+ ...props
34
+ }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants>) {
35
+ return <button className={cn(buttonVariants({ variant, size, className }))} {...props} />;
36
+ }
@@ -0,0 +1,33 @@
1
+ import type * as React from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ function Card({ className, ...props }: React.ComponentProps<"div">) {
6
+ return (
7
+ <div
8
+ className={cn(
9
+ "rounded-xl border border-border bg-muted/40 text-foreground shadow-sm",
10
+ className,
11
+ )}
12
+ {...props}
13
+ />
14
+ );
15
+ }
16
+
17
+ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
18
+ return <div className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} />;
19
+ }
20
+
21
+ function CardTitle({ className, ...props }: React.ComponentProps<"h3">) {
22
+ return <h3 className={cn("font-semibold leading-none tracking-tight", className)} {...props} />;
23
+ }
24
+
25
+ function CardDescription({ className, ...props }: React.ComponentProps<"p">) {
26
+ return <p className={cn("text-sm text-muted-foreground", className)} {...props} />;
27
+ }
28
+
29
+ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
30
+ return <div className={cn("p-6 pt-0", className)} {...props} />;
31
+ }
32
+
33
+ export { Card, CardHeader, CardTitle, CardDescription, CardContent };
@@ -0,0 +1,18 @@
1
+ import type * as React from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+
5
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
6
+ return (
7
+ <input
8
+ type={type}
9
+ className={cn(
10
+ "flex h-10 w-full rounded-md border border-border bg-background px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground focus-visible:border-foreground disabled:cursor-not-allowed disabled:opacity-50",
11
+ className,
12
+ )}
13
+ {...props}
14
+ />
15
+ );
16
+ }
17
+
18
+ export { Input };
@@ -0,0 +1,32 @@
1
+ @import "tailwindcss";
2
+
3
+ @theme inline {
4
+ --color-background: var(--background);
5
+ --color-foreground: var(--foreground);
6
+ --color-muted: var(--muted);
7
+ --color-muted-foreground: var(--muted-foreground);
8
+ --color-border: var(--border);
9
+ }
10
+
11
+ :root {
12
+ --background: 255 255 255;
13
+ --foreground: 15 23 42;
14
+ --muted: 241 245 249;
15
+ --muted-foreground: 100 116 139;
16
+ --border: 226 232 240;
17
+ }
18
+
19
+ @media (prefers-color-scheme: dark) {
20
+ :root {
21
+ --background: 2 6 23;
22
+ --foreground: 241 245 249;
23
+ --muted: 30 41 59;
24
+ --muted-foreground: 148 163 184;
25
+ --border: 30 41 59;
26
+ }
27
+ }
28
+
29
+ body {
30
+ background: rgb(var(--background));
31
+ color: rgb(var(--foreground));
32
+ }
@@ -0,0 +1,26 @@
1
+ # Dependencies
2
+ node_modules/
3
+
4
+ # Build output
5
+ .x/
6
+ dist/
7
+
8
+ # Runtime data (SQLite, uploads)
9
+ data/
10
+ *.db
11
+ *.db-journal
12
+
13
+ # Env
14
+ .env
15
+ .env.local
16
+ .env.*.local
17
+
18
+ # Compiled styles
19
+ public/styles.css
20
+
21
+ # Vercel
22
+ .vercel/
23
+
24
+ # Misc
25
+ .DS_Store
26
+ *.log
@@ -0,0 +1,29 @@
1
+ export default function Home() {
2
+ return (
3
+ <main style={{ maxWidth: 680, margin: "0 auto", padding: "5rem 1.5rem" }}>
4
+ <p style={{ fontWeight: 700, letterSpacing: "0.08em", color: "#e8942f" }}>THE X FRAMEWORK</p>
5
+ <h1 style={{ fontSize: "2.6rem", lineHeight: 1.1, margin: "0.5rem 0" }}>
6
+ You're up and running.
7
+ </h1>
8
+ <p style={{ fontSize: "1.15rem", lineHeight: 1.6, color: "#64748b" }}>
9
+ This is a freshly scaffolded x app. Open <code>src/pages/index.tsx</code> and start building
10
+ — save to hot-reload in development.
11
+ </p>
12
+ <div style={{ display: "flex", gap: "0.75rem", marginTop: "2rem" }}>
13
+ <a href="/about" style={btn}>
14
+ Next steps &rarr;
15
+ </a>
16
+ </div>
17
+ </main>
18
+ );
19
+ }
20
+
21
+ const btn: React.CSSProperties = {
22
+ display: "inline-block",
23
+ background: "#0f172a",
24
+ color: "#fff",
25
+ padding: "0.7rem 1.2rem",
26
+ borderRadius: 999,
27
+ textDecoration: "none",
28
+ fontWeight: 600,
29
+ };
@@ -0,0 +1,22 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ html,
6
+ body {
7
+ margin: 0;
8
+ padding: 0;
9
+ font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
10
+ sans-serif;
11
+ color: #0f172a;
12
+ background: #ffffff;
13
+ -webkit-font-smoothing: antialiased;
14
+ }
15
+
16
+ code {
17
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
18
+ background: #f1f5f9;
19
+ padding: 0.15rem 0.35rem;
20
+ border-radius: 4px;
21
+ font-size: 0.9em;
22
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ESNext", "DOM"],
7
+ "jsx": "react-jsx",
8
+ "strict": true,
9
+ "noUncheckedIndexedAccess": true,
10
+ "exactOptionalPropertyTypes": true,
11
+ "skipLibCheck": true,
12
+ "esModuleInterop": true,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "isolatedModules": true,
15
+ "verbatimModuleSyntax": true,
16
+ "noEmit": true,
17
+ "types": ["bun"],
18
+ "baseUrl": ".",
19
+ "paths": {
20
+ "@/*": ["./src/*"]
21
+ }
22
+ },
23
+ "include": ["src", "x.config.ts"]
24
+ }
@@ -1,8 +0,0 @@
1
- ---
2
- title: Hello from content collections
3
- ---
4
-
5
- This page is rendered from a markdown file in `content/`.
6
-
7
- Content collections let you write blog posts, docs, and marketing pages as
8
- plain markdown with frontmatter — no route files needed.
Binary file
@@ -1,3 +0,0 @@
1
- export async function greet(name: string): Promise<string> {
2
- return `Hello, ${name}! The server time is ${new Date().toLocaleTimeString()}.`;
3
- }
@@ -1,17 +0,0 @@
1
- import { data } from "../../lib/placeholder-data";
2
-
3
- export function GET(req: Request): Response {
4
- const url = new URL(req.url);
5
- const postId = url.searchParams.get("postId");
6
- if (postId) return Response.json(data.comments.filter((c) => c.postId === Number(postId)));
7
-
8
- const page = Math.max(1, Number(url.searchParams.get("page")) || 1);
9
- const limit = Math.min(500, Math.max(1, Number(url.searchParams.get("limit")) || 20));
10
- const start = (page - 1) * limit;
11
- return Response.json({
12
- total: data.comments.length,
13
- page,
14
- limit,
15
- data: data.comments.slice(start, start + limit),
16
- });
17
- }
@@ -1,20 +0,0 @@
1
- import { data } from "../../lib/placeholder-data";
2
-
3
- export function GET(req: Request): Response {
4
- const url = new URL(req.url);
5
- const id = url.searchParams.get("id");
6
- if (id) {
7
- const post = data.posts.find((p) => p.id === Number(id));
8
- if (!post) return Response.json({ error: "not found" }, { status: 404 });
9
- return Response.json(post);
10
- }
11
- const page = Math.max(1, Number(url.searchParams.get("page")) || 1);
12
- const limit = Math.min(100, Math.max(1, Number(url.searchParams.get("limit")) || 20));
13
- const start = (page - 1) * limit;
14
- return Response.json({
15
- total: data.posts.length,
16
- page,
17
- limit,
18
- data: data.posts.slice(start, start + limit),
19
- });
20
- }
@@ -1,21 +0,0 @@
1
- import { data } from "../../lib/placeholder-data";
2
-
3
- export function GET(req: Request): Response {
4
- const url = new URL(req.url);
5
- const userId = url.searchParams.get("userId");
6
- let items = data.todos;
7
- if (userId) items = items.filter((t) => t.userId === Number(userId));
8
- const completedParam = url.searchParams.get("completed");
9
- if (completedParam !== null)
10
- items = items.filter((t) => t.completed === (completedParam === "true"));
11
-
12
- const page = Math.max(1, Number(url.searchParams.get("page")) || 1);
13
- const limit = Math.min(200, Math.max(1, Number(url.searchParams.get("limit")) || 20));
14
- const start = (page - 1) * limit;
15
- return Response.json({
16
- total: items.length,
17
- page,
18
- limit,
19
- data: items.slice(start, start + limit),
20
- });
21
- }
@@ -1,12 +0,0 @@
1
- import { data } from "../../lib/placeholder-data";
2
-
3
- export function GET(req: Request): Response {
4
- const url = new URL(req.url);
5
- const id = url.searchParams.get("id");
6
- if (id) {
7
- const user = data.users.find((u) => u.id === Number(id));
8
- if (!user) return Response.json({ error: "not found" }, { status: 404 });
9
- return Response.json(user);
10
- }
11
- return Response.json(data.users);
12
- }
@@ -1,21 +0,0 @@
1
- interface HeadProps {
2
- title: string;
3
- description?: string;
4
- ogImage?: string;
5
- ogType?: string;
6
- children?: React.ReactNode;
7
- }
8
-
9
- export default function Head({ title, description, ogImage, ogType, children }: HeadProps) {
10
- return (
11
- <>
12
- <title>{title}</title>
13
- <meta property="og:title" content={title} />
14
- {description && <meta name="description" content={description} />}
15
- {description && <meta property="og:description" content={description} />}
16
- {ogImage && <meta property="og:image" content={ogImage} />}
17
- {ogType && <meta property="og:type" content={ogType} />}
18
- {children}
19
- </>
20
- );
21
- }
@@ -1,27 +0,0 @@
1
- interface ImageProps {
2
- src: string;
3
- alt: string;
4
- width?: number;
5
- height?: number;
6
- lazy?: boolean;
7
- className?: string;
8
- }
9
-
10
- export default function Image({ src, alt, width, height, lazy = true, className }: ImageProps) {
11
- return (
12
- <img
13
- src={src}
14
- alt={alt}
15
- width={width}
16
- height={height}
17
- loading={lazy ? "lazy" : "eager"}
18
- decoding="async"
19
- className={className}
20
- style={{
21
- maxWidth: "100%",
22
- height: "auto",
23
- ...(width && height ? { aspectRatio: `${width}/${height}` } : {}),
24
- }}
25
- />
26
- );
27
- }
@@ -1,10 +0,0 @@
1
- import { Link as XLink, type LinkProps as XLinkProps } from "@thexjs/core";
2
- import type { ReactNode } from "react";
3
-
4
- type LinkProps = XLinkProps;
5
-
6
- export default function Link(props: LinkProps) {
7
- return <XLink {...props} />;
8
- }
9
-
10
- export type { LinkProps };
@@ -1,49 +0,0 @@
1
- import { mergeProps } from "@base-ui/react/merge-props";
2
- import { useRender } from "@base-ui/react/use-render";
3
- import { type VariantProps, cva } from "class-variance-authority";
4
-
5
- import { cn } from "@/lib/utils";
6
-
7
- const badgeVariants = cva(
8
- "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
9
- {
10
- variants: {
11
- variant: {
12
- default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
13
- secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
14
- destructive:
15
- "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
16
- outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
17
- ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
18
- link: "text-primary underline-offset-4 hover:underline",
19
- },
20
- },
21
- defaultVariants: {
22
- variant: "default",
23
- },
24
- },
25
- );
26
-
27
- function Badge({
28
- className,
29
- variant = "default",
30
- render,
31
- ...props
32
- }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
33
- return useRender({
34
- defaultTagName: "span",
35
- props: mergeProps<"span">(
36
- {
37
- className: cn(badgeVariants({ variant }), className),
38
- },
39
- props,
40
- ),
41
- render,
42
- state: {
43
- slot: "badge",
44
- variant,
45
- },
46
- });
47
- }
48
-
49
- export { Badge, badgeVariants };