@pyreon/create-zero 0.4.1 → 0.11.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/bin/create-zero.js +1 -1
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/package.json +5 -4
- package/templates/default/CLAUDE.md +3 -1
- package/templates/default/env.d.ts +6 -6
- package/templates/default/index.html +1 -1
- package/templates/default/package.json +5 -5
- package/templates/default/src/entry-client.ts +3 -3
- package/templates/default/src/entry-server.ts +9 -13
- package/templates/default/src/features/posts.ts +6 -6
- package/templates/default/src/routes/(admin)/dashboard.tsx +29 -34
- package/templates/default/src/routes/_error.tsx +5 -10
- package/templates/default/src/routes/_layout.tsx +10 -19
- package/templates/default/src/routes/about.tsx +25 -44
- package/templates/default/src/routes/api/health.ts +1 -1
- package/templates/default/src/routes/api/posts.ts +5 -5
- package/templates/default/src/routes/counter.tsx +20 -29
- package/templates/default/src/routes/index.tsx +20 -22
- package/templates/default/src/routes/posts/[id].tsx +34 -34
- package/templates/default/src/routes/posts/index.tsx +29 -46
- package/templates/default/src/routes/posts/new.tsx +12 -16
- package/templates/default/src/stores/app.ts +2 -2
- package/templates/default/vite.config.ts +10 -10
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useHead } from
|
|
2
|
-
import { Link } from
|
|
3
|
-
import { posts } from
|
|
1
|
+
import { useHead } from "@pyreon/head"
|
|
2
|
+
import { Link } from "@pyreon/zero/link"
|
|
3
|
+
import { posts } from "../../features/posts"
|
|
4
4
|
|
|
5
5
|
export default function NewPostPage() {
|
|
6
6
|
useHead({
|
|
7
|
-
title:
|
|
8
|
-
meta: [{ name:
|
|
7
|
+
title: "New Post — Pyreon Zero",
|
|
8
|
+
meta: [{ name: "description", content: "Create a new post." }],
|
|
9
9
|
})
|
|
10
10
|
|
|
11
11
|
const form = posts.useForm({
|
|
12
12
|
onSuccess: () => {
|
|
13
|
-
window.location.href =
|
|
13
|
+
window.location.href = "/posts"
|
|
14
14
|
},
|
|
15
15
|
})
|
|
16
16
|
|
|
@@ -25,31 +25,27 @@ export default function NewPostPage() {
|
|
|
25
25
|
|
|
26
26
|
<h1>New Post</h1>
|
|
27
27
|
<p style="color: var(--c-text-muted); margin-bottom: var(--space-xl);">
|
|
28
|
-
This form is powered by <code>@pyreon/feature</code> +{
|
|
29
|
-
<code>@pyreon/
|
|
30
|
-
automatic Zod schema validation.
|
|
28
|
+
This form is powered by <code>@pyreon/feature</code> + <code>@pyreon/form</code> +{" "}
|
|
29
|
+
<code>@pyreon/validation</code> with automatic Zod schema validation.
|
|
31
30
|
</p>
|
|
32
31
|
|
|
33
32
|
<form onSubmit={(e: Event) => form.handleSubmit(e)}>
|
|
34
33
|
<div class="form-field">
|
|
35
34
|
<label for="title">Title</label>
|
|
36
|
-
<input id="title" {...form.register(
|
|
35
|
+
<input id="title" {...(form.register("title") as any)} />
|
|
37
36
|
</div>
|
|
38
37
|
<div class="form-field">
|
|
39
38
|
<label for="body">Body</label>
|
|
40
|
-
<textarea id="body" rows={6} {...form.register(
|
|
39
|
+
<textarea id="body" rows={6} {...(form.register("body") as any)} />
|
|
41
40
|
</div>
|
|
42
41
|
<div class="form-field">
|
|
43
42
|
<label class="checkbox-label">
|
|
44
|
-
<input
|
|
45
|
-
type="checkbox"
|
|
46
|
-
{...form.register('published', { type: 'checkbox' })}
|
|
47
|
-
/>
|
|
43
|
+
<input type="checkbox" {...(form.register("published", { type: "checkbox" }) as any)} />
|
|
48
44
|
Published
|
|
49
45
|
</label>
|
|
50
46
|
</div>
|
|
51
47
|
<button type="submit" class="btn" disabled={form.isSubmitting()}>
|
|
52
|
-
{() => (form.isSubmitting() ?
|
|
48
|
+
{() => (form.isSubmitting() ? "Creating..." : "Create Post")}
|
|
53
49
|
</button>
|
|
54
50
|
</form>
|
|
55
51
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineStore, signal } from
|
|
1
|
+
import { defineStore, signal } from "@pyreon/store"
|
|
2
2
|
|
|
3
|
-
export const useAppStore = defineStore(
|
|
3
|
+
export const useAppStore = defineStore("app", () => {
|
|
4
4
|
const sidebarOpen = signal(true)
|
|
5
5
|
const toggleSidebar = () => sidebarOpen.update((v) => !v)
|
|
6
6
|
return { sidebarOpen, toggleSidebar }
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import pyreon from
|
|
2
|
-
import zero from
|
|
3
|
-
import { fontPlugin } from
|
|
4
|
-
import { seoPlugin } from
|
|
1
|
+
import pyreon from "@pyreon/vite-plugin"
|
|
2
|
+
import zero from "@pyreon/zero"
|
|
3
|
+
import { fontPlugin } from "@pyreon/zero/font"
|
|
4
|
+
import { seoPlugin } from "@pyreon/zero/seo"
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
plugins: [
|
|
8
8
|
pyreon(),
|
|
9
|
-
zero({ mode:
|
|
9
|
+
zero({ mode: "ssr", ssr: { mode: "stream" } }),
|
|
10
10
|
|
|
11
11
|
// Google Fonts — self-hosted at build time, CDN in dev
|
|
12
12
|
fontPlugin({
|
|
13
|
-
google: [
|
|
13
|
+
google: ["Inter:wght@400;500;600;700;800", "JetBrains Mono:wght@400"],
|
|
14
14
|
// Size-adjusted fallbacks to eliminate CLS while fonts load
|
|
15
15
|
fallbacks: {
|
|
16
|
-
Inter: { fallback:
|
|
16
|
+
Inter: { fallback: "Arial", sizeAdjust: 1.07, ascentOverride: 90 },
|
|
17
17
|
},
|
|
18
18
|
}),
|
|
19
19
|
|
|
20
20
|
// Generate sitemap.xml and robots.txt at build time
|
|
21
21
|
seoPlugin({
|
|
22
|
-
sitemap: { origin:
|
|
22
|
+
sitemap: { origin: "https://example.com" },
|
|
23
23
|
robots: {
|
|
24
|
-
rules: [{ userAgent:
|
|
25
|
-
sitemap:
|
|
24
|
+
rules: [{ userAgent: "*", allow: ["/"] }],
|
|
25
|
+
sitemap: "https://example.com/sitemap.xml",
|
|
26
26
|
},
|
|
27
27
|
}),
|
|
28
28
|
],
|