@evjs/create-app 0.1.10 → 0.2.0
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 +5 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +122 -98
- package/package.json +9 -1
- package/templates/api-routes/README.md +2 -2
- package/templates/api-routes/package.json +4 -4
- package/templates/api-routes/src/{pages/__root.tsx → layout/index.tsx} +3 -5
- package/templates/api-routes/src/pages/{home.tsx → index.tsx} +1 -9
- package/templates/basic/README.md +3 -5
- package/templates/basic/package.json +4 -4
- package/templates/basic/src/layout/index.tsx +27 -0
- package/templates/basic/src/pages/about.tsx +17 -0
- package/templates/basic/src/pages/index.tsx +100 -0
- package/templates/basic/src/pages/search.tsx +58 -0
- package/templates/basic/src/pages/users/$userId.tsx +31 -0
- package/templates/complex-routing/README.md +6 -7
- package/templates/complex-routing/package.json +4 -4
- package/templates/complex-routing/src/api/data.server.ts +1 -1
- package/templates/complex-routing/src/{pages/__root.tsx → layout/index.tsx} +4 -5
- package/templates/complex-routing/src/pages/dashboard.tsx +2 -23
- package/templates/complex-routing/src/pages/index.tsx +31 -0
- package/templates/complex-routing/src/pages/old-blog.tsx +9 -0
- package/templates/complex-routing/src/pages/posts/$postId.tsx +39 -0
- package/templates/complex-routing/src/pages/posts/index.tsx +21 -88
- package/templates/complex-routing/src/pages/search.tsx +10 -13
- package/templates/complex-routing/src/pages/users/$username.tsx +21 -0
- package/templates/custom-ws-transport/README.md +2 -2
- package/templates/custom-ws-transport/package.json +4 -4
- package/templates/custom-ws-transport/src/{pages/__root.tsx → layout/index.tsx} +4 -5
- package/templates/custom-ws-transport/src/pages/{home.tsx → index.tsx} +2 -9
- package/templates/mpa/README.md +8 -6
- package/templates/mpa/ev.config.ts +2 -3
- package/templates/mpa/package.json +2 -2
- package/templates/mpa/src/pages/about.tsx +13 -0
- package/templates/mpa/src/pages/home.tsx +13 -0
- package/templates/plugin-authoring/README.md +2 -2
- package/templates/plugin-authoring/ev.config.ts +11 -12
- package/templates/plugin-authoring/package.json +5 -4
- package/templates/plugin-authoring/src/layout/index.tsx +9 -0
- package/templates/plugin-authoring/src/pages/{home.tsx → index.tsx} +2 -9
- package/templates/with-sqlite/README.md +2 -1
- package/templates/with-sqlite/package.json +4 -4
- package/templates/with-sqlite/src/api/db.server.ts +103 -23
- package/templates/with-sqlite/src/{pages/__root.tsx → layout/index.tsx} +4 -5
- package/templates/with-sqlite/src/pages/{home.tsx → index.tsx} +1 -9
- package/templates/with-tailwind/ev.config.ts +3 -1
- package/templates/with-tailwind/package.json +3 -4
- package/templates/with-tailwind/src/{pages/__root.tsx → layout/index.tsx} +4 -7
- package/templates/with-tailwind/src/pages/{home.tsx → index.tsx} +17 -31
- package/templates/with-trpc/README.md +2 -1
- package/templates/with-trpc/package.json +4 -4
- package/templates/with-trpc/src/{pages/__root.tsx → layout/index.tsx} +3 -7
- package/templates/with-trpc/src/pages/{home.tsx → index.tsx} +2 -9
- package/templates/api-routes/src/main.tsx +0 -15
- package/templates/basic/src/main.tsx +0 -37
- package/templates/basic/src/pages/__root.tsx +0 -49
- package/templates/basic/src/pages/home.tsx +0 -207
- package/templates/complex-routing/src/main.tsx +0 -29
- package/templates/complex-routing/src/pages/catch.tsx +0 -26
- package/templates/complex-routing/src/pages/home.tsx +0 -35
- package/templates/complex-routing/src/pages/user.tsx +0 -28
- package/templates/custom-ws-transport/src/main.tsx +0 -15
- package/templates/mpa/src/about/main.tsx +0 -23
- package/templates/mpa/src/home/main.tsx +0 -23
- package/templates/plugin-authoring/src/main.tsx +0 -15
- package/templates/plugin-authoring/src/pages/__root.tsx +0 -13
- package/templates/with-sqlite/src/main.tsx +0 -15
- package/templates/with-tailwind/src/main.tsx +0 -15
- package/templates/with-trpc/src/main.tsx +0 -15
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createRoute,
|
|
3
|
-
getFnQueryKey,
|
|
4
|
-
Link,
|
|
5
|
-
useMutation,
|
|
6
|
-
useQuery,
|
|
7
|
-
useQueryClient,
|
|
8
|
-
} from "@evjs/client";
|
|
9
|
-
import { useState } from "react";
|
|
10
|
-
import { createUser, getUser, getUsers } from "../api/users.server";
|
|
11
|
-
import { rootRoute } from "./__root";
|
|
12
|
-
|
|
13
|
-
const cardStyle = {
|
|
14
|
-
border: "1px solid #e2e8f0",
|
|
15
|
-
borderRadius: 12,
|
|
16
|
-
padding: "1rem",
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const linkStyle = { color: "#2563eb", textDecoration: "none" };
|
|
20
|
-
|
|
21
|
-
function UsersPage() {
|
|
22
|
-
const [name, setName] = useState("");
|
|
23
|
-
const [email, setEmail] = useState("");
|
|
24
|
-
const queryClient = useQueryClient();
|
|
25
|
-
|
|
26
|
-
// Use the framework's useQuery hook instead of manual useState + useEffect
|
|
27
|
-
const { data: users = [], isLoading } = useQuery(getUsers);
|
|
28
|
-
|
|
29
|
-
// Use useMutation for server function calls that modify data
|
|
30
|
-
const createUserMutation = useMutation({
|
|
31
|
-
mutationFn: createUser,
|
|
32
|
-
onSuccess: () => {
|
|
33
|
-
// Invalidate and refetch users list after successful creation
|
|
34
|
-
queryClient.invalidateQueries({ queryKey: getFnQueryKey(getUsers) });
|
|
35
|
-
setName("");
|
|
36
|
-
setEmail("");
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
function handleCreate(e: { preventDefault: () => void }) {
|
|
41
|
-
e.preventDefault();
|
|
42
|
-
if (!name || !email) return;
|
|
43
|
-
createUserMutation.mutate({ name, email });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (isLoading) return <p>Loading users from server…</p>;
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<div style={{ display: "grid", gap: "1rem" }}>
|
|
50
|
-
<div style={cardStyle}>
|
|
51
|
-
<h2>Routing Patterns</h2>
|
|
52
|
-
<p style={{ color: "#475569" }}>
|
|
53
|
-
This example includes static, dynamic-param, and search-param routes
|
|
54
|
-
so you can switch between browser, hash, and memory history and verify
|
|
55
|
-
route behavior.
|
|
56
|
-
</p>
|
|
57
|
-
<div style={{ display: "flex", gap: "1rem", flexWrap: "wrap" }}>
|
|
58
|
-
<Link to="/about" style={linkStyle}>
|
|
59
|
-
Open static route
|
|
60
|
-
</Link>
|
|
61
|
-
<Link to="/users/$userId" params={{ userId: "2" }} style={linkStyle}>
|
|
62
|
-
Open dynamic route
|
|
63
|
-
</Link>
|
|
64
|
-
<Link to="/search" search={{ tab: "favorites" }} style={linkStyle}>
|
|
65
|
-
Open search route
|
|
66
|
-
</Link>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
<div style={cardStyle}>
|
|
71
|
-
<h2>Users (fetched via direct server function call)</h2>
|
|
72
|
-
<ul>
|
|
73
|
-
{users.map((u) => (
|
|
74
|
-
<li key={u.id}>
|
|
75
|
-
<Link
|
|
76
|
-
to="/users/$userId"
|
|
77
|
-
params={{ userId: u.id }}
|
|
78
|
-
style={linkStyle}
|
|
79
|
-
>
|
|
80
|
-
{u.name}
|
|
81
|
-
</Link>{" "}
|
|
82
|
-
— {u.email}
|
|
83
|
-
</li>
|
|
84
|
-
))}
|
|
85
|
-
</ul>
|
|
86
|
-
|
|
87
|
-
<h3>Add User</h3>
|
|
88
|
-
<form
|
|
89
|
-
onSubmit={handleCreate}
|
|
90
|
-
style={{ display: "flex", gap: "0.5rem" }}
|
|
91
|
-
>
|
|
92
|
-
<input
|
|
93
|
-
placeholder="Name"
|
|
94
|
-
value={name}
|
|
95
|
-
onChange={(e) => setName(e.target.value)}
|
|
96
|
-
/>
|
|
97
|
-
<input
|
|
98
|
-
placeholder="Email"
|
|
99
|
-
value={email}
|
|
100
|
-
onChange={(e) => setEmail(e.target.value)}
|
|
101
|
-
/>
|
|
102
|
-
<button type="submit">Create</button>
|
|
103
|
-
</form>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function AboutPage() {
|
|
110
|
-
return (
|
|
111
|
-
<div style={cardStyle}>
|
|
112
|
-
<h2>Static Route</h2>
|
|
113
|
-
<p>
|
|
114
|
-
This page uses a plain static path, useful for validating direct
|
|
115
|
-
navigation and route switching across different history implementations.
|
|
116
|
-
</p>
|
|
117
|
-
</div>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function UserDetailPage() {
|
|
122
|
-
const { userId } = userDetailRoute.useParams();
|
|
123
|
-
const { data: user, isLoading } = useQuery(getUser, userId);
|
|
124
|
-
|
|
125
|
-
if (isLoading) return <p>Loading user…</p>;
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<div style={cardStyle}>
|
|
129
|
-
<h2>Dynamic Route</h2>
|
|
130
|
-
<p style={{ color: "#64748b" }}>Path param: {userId}</p>
|
|
131
|
-
<p>
|
|
132
|
-
Selected user: <strong>{user?.name}</strong>
|
|
133
|
-
</p>
|
|
134
|
-
<p>{user?.email}</p>
|
|
135
|
-
<Link to="/" style={linkStyle}>
|
|
136
|
-
Back to users
|
|
137
|
-
</Link>
|
|
138
|
-
</div>
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function SearchPage() {
|
|
143
|
-
const { tab } = searchRoute.useSearch();
|
|
144
|
-
const { data: users = [] } = useQuery(getUsers);
|
|
145
|
-
|
|
146
|
-
const visibleUsers =
|
|
147
|
-
tab === "favorites"
|
|
148
|
-
? users.filter((user) => Number.parseInt(user.id, 10) % 2 === 1)
|
|
149
|
-
: tab === "recent"
|
|
150
|
-
? users.slice(-2)
|
|
151
|
-
: users;
|
|
152
|
-
|
|
153
|
-
return (
|
|
154
|
-
<div style={cardStyle}>
|
|
155
|
-
<h2>Search Route</h2>
|
|
156
|
-
<p style={{ color: "#64748b" }}>Current search tab: {tab}</p>
|
|
157
|
-
<div style={{ display: "flex", gap: "1rem", marginBottom: "1rem" }}>
|
|
158
|
-
<Link to="/search" search={{ tab: "all" }} style={linkStyle}>
|
|
159
|
-
All
|
|
160
|
-
</Link>
|
|
161
|
-
<Link to="/search" search={{ tab: "favorites" }} style={linkStyle}>
|
|
162
|
-
Favorites
|
|
163
|
-
</Link>
|
|
164
|
-
<Link to="/search" search={{ tab: "recent" }} style={linkStyle}>
|
|
165
|
-
Recent
|
|
166
|
-
</Link>
|
|
167
|
-
</div>
|
|
168
|
-
<ul>
|
|
169
|
-
{visibleUsers.map((user) => (
|
|
170
|
-
<li key={user.id}>
|
|
171
|
-
{user.name} — {user.email}
|
|
172
|
-
</li>
|
|
173
|
-
))}
|
|
174
|
-
</ul>
|
|
175
|
-
</div>
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export const usersRoute = createRoute({
|
|
180
|
-
getParentRoute: () => rootRoute,
|
|
181
|
-
path: "/",
|
|
182
|
-
component: UsersPage,
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
export const aboutRoute = createRoute({
|
|
186
|
-
getParentRoute: () => rootRoute,
|
|
187
|
-
path: "/about",
|
|
188
|
-
component: AboutPage,
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
export const userDetailRoute = createRoute({
|
|
192
|
-
getParentRoute: () => rootRoute,
|
|
193
|
-
path: "/users/$userId",
|
|
194
|
-
component: UserDetailPage,
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
export const searchRoute = createRoute({
|
|
198
|
-
getParentRoute: () => rootRoute,
|
|
199
|
-
path: "/search",
|
|
200
|
-
validateSearch: (search: Record<string, unknown>) => ({
|
|
201
|
-
tab:
|
|
202
|
-
search.tab === "favorites" || search.tab === "recent"
|
|
203
|
-
? search.tab
|
|
204
|
-
: "all",
|
|
205
|
-
}),
|
|
206
|
-
component: SearchPage,
|
|
207
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { createApp } from "@evjs/client";
|
|
2
|
-
import { rootRoute } from "./pages/__root";
|
|
3
|
-
import { notFoundRoute, redirectRoute } from "./pages/catch";
|
|
4
|
-
import { dashboardLayout, dashboardRoute } from "./pages/dashboard";
|
|
5
|
-
import { homeRoute } from "./pages/home";
|
|
6
|
-
import { postDetailRoute, postsIndexRoute, postsRoute } from "./pages/posts";
|
|
7
|
-
import { searchRoute } from "./pages/search";
|
|
8
|
-
import { userRoute } from "./pages/user";
|
|
9
|
-
|
|
10
|
-
const routeTree = rootRoute.addChildren([
|
|
11
|
-
homeRoute,
|
|
12
|
-
postsRoute.addChildren([postsIndexRoute, postDetailRoute]),
|
|
13
|
-
userRoute,
|
|
14
|
-
dashboardLayout.addChildren([dashboardRoute]),
|
|
15
|
-
searchRoute,
|
|
16
|
-
redirectRoute,
|
|
17
|
-
notFoundRoute,
|
|
18
|
-
]);
|
|
19
|
-
|
|
20
|
-
const app = createApp({ routeTree });
|
|
21
|
-
|
|
22
|
-
// Register router type for full IDE type-safety on useParams, useSearch, Link, etc.
|
|
23
|
-
declare module "@evjs/client" {
|
|
24
|
-
interface Register {
|
|
25
|
-
router: typeof app.router;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
app.render("#app");
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createRoute, Link, redirect } from "@evjs/client";
|
|
2
|
-
import { rootRoute } from "./__root";
|
|
3
|
-
|
|
4
|
-
// ── Redirect: /old-blog → /posts ──
|
|
5
|
-
|
|
6
|
-
export const redirectRoute = createRoute({
|
|
7
|
-
getParentRoute: () => rootRoute,
|
|
8
|
-
path: "/old-blog",
|
|
9
|
-
beforeLoad: () => {
|
|
10
|
-
throw redirect({ to: "/posts" });
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// ── 404 Catch-all ──
|
|
15
|
-
|
|
16
|
-
export const notFoundRoute = createRoute({
|
|
17
|
-
getParentRoute: () => rootRoute,
|
|
18
|
-
path: "*",
|
|
19
|
-
component: () => (
|
|
20
|
-
<div style={{ textAlign: "center", padding: "3rem" }}>
|
|
21
|
-
<h1 style={{ fontSize: 48 }}>404</h1>
|
|
22
|
-
<p style={{ color: "#6b7280" }}>Page not found</p>
|
|
23
|
-
<Link to="/">← Go home</Link>
|
|
24
|
-
</div>
|
|
25
|
-
),
|
|
26
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createRoute, Link } from "@evjs/client";
|
|
2
|
-
import { rootRoute } from "./__root";
|
|
3
|
-
|
|
4
|
-
export const homeRoute = createRoute({
|
|
5
|
-
getParentRoute: () => rootRoute,
|
|
6
|
-
path: "/",
|
|
7
|
-
component: () => (
|
|
8
|
-
<div>
|
|
9
|
-
<h1>evjs Complex Routing Example</h1>
|
|
10
|
-
<p>
|
|
11
|
-
Demonstrates nested layouts, dynamic params, search params, redirects,
|
|
12
|
-
and server function loaders.
|
|
13
|
-
</p>
|
|
14
|
-
<ul>
|
|
15
|
-
<li>
|
|
16
|
-
<Link to="/posts">Posts</Link> — nested group with dynamic{" "}
|
|
17
|
-
<code>$postId</code>
|
|
18
|
-
</li>
|
|
19
|
-
<li>
|
|
20
|
-
<Link to="/dashboard">Dashboard</Link> — pathless layout with server
|
|
21
|
-
function loader
|
|
22
|
-
</li>
|
|
23
|
-
<li>
|
|
24
|
-
<Link to="/search" search={{ q: "tutorial" }}>
|
|
25
|
-
Search
|
|
26
|
-
</Link>{" "}
|
|
27
|
-
— search params
|
|
28
|
-
</li>
|
|
29
|
-
<li>
|
|
30
|
-
<Link to="/old-blog">Old Blog</Link> — redirect to /posts
|
|
31
|
-
</li>
|
|
32
|
-
</ul>
|
|
33
|
-
</div>
|
|
34
|
-
),
|
|
35
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createRoute, Link, useQuery } from "@evjs/client";
|
|
2
|
-
import { getUser } from "../api/data.server";
|
|
3
|
-
import { rootRoute } from "./__root";
|
|
4
|
-
|
|
5
|
-
const styles = {
|
|
6
|
-
card: { border: "1px solid #e5e7eb", borderRadius: 8, padding: "1rem" },
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
function UserProfile() {
|
|
10
|
-
const { username } = userRoute.useParams();
|
|
11
|
-
const { data: user } = useQuery(getUser, username);
|
|
12
|
-
|
|
13
|
-
if (!user) return <p>Loading...</p>;
|
|
14
|
-
return (
|
|
15
|
-
<div style={styles.card}>
|
|
16
|
-
<h2>{user.name}</h2>
|
|
17
|
-
<p style={{ color: "#6b7280" }}>@{user.username}</p>
|
|
18
|
-
<p>{user.bio}</p>
|
|
19
|
-
<Link to="/posts">← Back to posts</Link>
|
|
20
|
-
</div>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const userRoute = createRoute({
|
|
25
|
-
getParentRoute: () => rootRoute,
|
|
26
|
-
path: "/users/$username",
|
|
27
|
-
component: UserProfile,
|
|
28
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createApp } from "@evjs/client";
|
|
2
|
-
import { rootRoute } from "./pages/__root";
|
|
3
|
-
import { usersRoute } from "./pages/home";
|
|
4
|
-
|
|
5
|
-
const routeTree = rootRoute.addChildren([usersRoute]);
|
|
6
|
-
|
|
7
|
-
const app = createApp({ routeTree });
|
|
8
|
-
|
|
9
|
-
declare module "@evjs/client" {
|
|
10
|
-
interface Register {
|
|
11
|
-
router: typeof app.router;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
app.render("#app");
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createRoot } from "react-dom/client";
|
|
2
|
-
|
|
3
|
-
function AboutPage() {
|
|
4
|
-
return (
|
|
5
|
-
<main style={{ fontFamily: "ui-sans-serif, system-ui", margin: "2rem" }}>
|
|
6
|
-
<h1>About Page</h1>
|
|
7
|
-
<p>
|
|
8
|
-
This page is rendered from <code>src/about/main.tsx</code>.
|
|
9
|
-
</p>
|
|
10
|
-
<p>
|
|
11
|
-
<a href="/home.html">Back to Home page</a>
|
|
12
|
-
</p>
|
|
13
|
-
</main>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const rootEl = document.getElementById("app");
|
|
18
|
-
|
|
19
|
-
if (!rootEl) {
|
|
20
|
-
throw new Error("Missing #app mount element");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
createRoot(rootEl).render(<AboutPage />);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createRoot } from "react-dom/client";
|
|
2
|
-
|
|
3
|
-
function HomePage() {
|
|
4
|
-
return (
|
|
5
|
-
<main style={{ fontFamily: "ui-sans-serif, system-ui", margin: "2rem" }}>
|
|
6
|
-
<h1>Home Page</h1>
|
|
7
|
-
<p>
|
|
8
|
-
This page is rendered from <code>src/home/main.tsx</code>.
|
|
9
|
-
</p>
|
|
10
|
-
<p>
|
|
11
|
-
<a href="/about.html">Go to About page</a>
|
|
12
|
-
</p>
|
|
13
|
-
</main>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const rootEl = document.getElementById("app");
|
|
18
|
-
|
|
19
|
-
if (!rootEl) {
|
|
20
|
-
throw new Error("Missing #app mount element");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
createRoot(rootEl).render(<HomePage />);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createApp } from "@evjs/client";
|
|
2
|
-
import { rootRoute } from "./pages/__root";
|
|
3
|
-
import { homeRoute } from "./pages/home";
|
|
4
|
-
|
|
5
|
-
const routeTree = rootRoute.addChildren([homeRoute]);
|
|
6
|
-
|
|
7
|
-
const app = createApp({ routeTree });
|
|
8
|
-
|
|
9
|
-
declare module "@evjs/client" {
|
|
10
|
-
interface Register {
|
|
11
|
-
router: typeof app.router;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
app.render("#app");
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createRootRoute, Outlet } from "@evjs/client";
|
|
2
|
-
|
|
3
|
-
function Root() {
|
|
4
|
-
return (
|
|
5
|
-
<div style={{ fontFamily: "system-ui, sans-serif", padding: "1rem" }}>
|
|
6
|
-
<Outlet />
|
|
7
|
-
</div>
|
|
8
|
-
);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const rootRoute = createRootRoute({
|
|
12
|
-
component: Root,
|
|
13
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createApp } from "@evjs/client";
|
|
2
|
-
import { rootRoute } from "./pages/__root";
|
|
3
|
-
import { usersRoute } from "./pages/home";
|
|
4
|
-
|
|
5
|
-
const routeTree = rootRoute.addChildren([usersRoute]);
|
|
6
|
-
|
|
7
|
-
const app = createApp({ routeTree });
|
|
8
|
-
|
|
9
|
-
declare module "@evjs/client" {
|
|
10
|
-
interface Register {
|
|
11
|
-
router: typeof app.router;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
app.render("#app");
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createApp } from "@evjs/client";
|
|
2
|
-
import { rootRoute } from "./pages/__root";
|
|
3
|
-
import { homeRoute } from "./pages/home";
|
|
4
|
-
|
|
5
|
-
const routeTree = rootRoute.addChildren([homeRoute]);
|
|
6
|
-
|
|
7
|
-
const app = createApp({ routeTree });
|
|
8
|
-
|
|
9
|
-
declare module "@evjs/client" {
|
|
10
|
-
interface Register {
|
|
11
|
-
router: typeof app.router;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
app.render("#app");
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createApp } from "@evjs/client";
|
|
2
|
-
import { rootRoute } from "./pages/__root";
|
|
3
|
-
import { homeRoute } from "./pages/home";
|
|
4
|
-
|
|
5
|
-
const routeTree = rootRoute.addChildren([homeRoute]);
|
|
6
|
-
|
|
7
|
-
const app = createApp({ routeTree });
|
|
8
|
-
|
|
9
|
-
declare module "@evjs/client" {
|
|
10
|
-
interface Register {
|
|
11
|
-
router: typeof app.router;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
app.render("#app");
|