@jant/core 0.3.7 → 0.3.8
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/dist/app.js +4 -0
- package/dist/client.js +1 -0
- package/dist/db/schema.js +13 -0
- package/dist/i18n/locales/en.js +1 -1
- package/dist/i18n/locales/zh-Hans.js +1 -1
- package/dist/i18n/locales/zh-Hant.js +1 -1
- package/dist/lib/image.js +3 -3
- package/dist/lib/media-helpers.js +43 -0
- package/dist/lib/nav-reorder.js +27 -0
- package/dist/lib/navigation.js +35 -0
- package/dist/lib/theme-components.js +49 -0
- package/dist/routes/api/timeline.js +115 -0
- package/dist/routes/api/upload.js +9 -5
- package/dist/routes/dash/navigation.js +274 -0
- package/dist/routes/pages/archive.js +14 -27
- package/dist/routes/pages/collection.js +10 -19
- package/dist/routes/pages/home.js +83 -126
- package/dist/routes/pages/page.js +19 -38
- package/dist/routes/pages/post.js +38 -51
- package/dist/routes/pages/search.js +13 -26
- package/dist/services/index.js +3 -1
- package/dist/services/media.js +1 -1
- package/dist/services/navigation.js +115 -0
- package/dist/services/post.js +26 -1
- package/dist/theme/components/PostList.js +5 -0
- package/dist/theme/components/index.js +2 -0
- package/dist/theme/components/timeline/ArticleCard.js +50 -0
- package/dist/theme/components/timeline/ImageCard.js +86 -0
- package/dist/theme/components/timeline/LinkCard.js +62 -0
- package/dist/theme/components/timeline/NoteCard.js +37 -0
- package/dist/theme/components/timeline/QuoteCard.js +51 -0
- package/dist/theme/components/timeline/ThreadPreview.js +52 -0
- package/dist/theme/components/timeline/TimelineFeed.js +43 -0
- package/dist/theme/components/timeline/TimelineItem.js +25 -0
- package/dist/theme/components/timeline/index.js +8 -0
- package/dist/theme/layouts/DashLayout.js +8 -0
- package/dist/theme/layouts/SiteLayout.js +160 -0
- package/dist/theme/layouts/index.js +1 -0
- package/dist/types/sortablejs.d.js +5 -0
- package/package.json +3 -2
- package/src/__tests__/helpers/db.ts +10 -0
- package/src/app.tsx +4 -0
- package/src/client.ts +1 -0
- package/src/db/migrations/0003_add_navigation_links.sql +8 -0
- package/src/db/migrations/meta/0003_snapshot.json +821 -0
- package/src/db/migrations/meta/_journal.json +14 -0
- package/src/db/schema.ts +13 -0
- package/src/i18n/locales/en.po +100 -32
- package/src/i18n/locales/en.ts +1 -1
- package/src/i18n/locales/zh-Hans.po +102 -55
- package/src/i18n/locales/zh-Hans.ts +1 -1
- package/src/i18n/locales/zh-Hant.po +102 -55
- package/src/i18n/locales/zh-Hant.ts +1 -1
- package/src/index.ts +5 -0
- package/src/lib/__tests__/theme-components.test.ts +107 -0
- package/src/lib/image.ts +3 -3
- package/src/lib/media-helpers.ts +54 -0
- package/src/lib/nav-reorder.ts +26 -0
- package/src/lib/navigation.ts +46 -0
- package/src/lib/theme-components.ts +76 -0
- package/src/routes/api/__tests__/posts.test.ts +8 -8
- package/src/routes/api/__tests__/timeline.test.ts +242 -0
- package/src/routes/api/timeline.tsx +145 -0
- package/src/routes/api/upload.ts +9 -5
- package/src/routes/dash/navigation.tsx +306 -0
- package/src/routes/pages/archive.tsx +15 -23
- package/src/routes/pages/collection.tsx +8 -15
- package/src/routes/pages/home.tsx +111 -122
- package/src/routes/pages/page.tsx +17 -30
- package/src/routes/pages/post.tsx +33 -42
- package/src/routes/pages/search.tsx +18 -22
- package/src/services/__tests__/media.test.ts +34 -7
- package/src/services/__tests__/navigation.test.ts +213 -0
- package/src/services/__tests__/post-timeline.test.ts +220 -0
- package/src/services/index.ts +7 -0
- package/src/services/media.ts +2 -1
- package/src/services/navigation.ts +165 -0
- package/src/services/post.ts +48 -1
- package/src/styles/components.css +59 -0
- package/src/theme/components/PostList.tsx +7 -0
- package/src/theme/components/index.ts +12 -0
- package/src/theme/components/timeline/ArticleCard.tsx +57 -0
- package/src/theme/components/timeline/ImageCard.tsx +80 -0
- package/src/theme/components/timeline/LinkCard.tsx +66 -0
- package/src/theme/components/timeline/NoteCard.tsx +41 -0
- package/src/theme/components/timeline/QuoteCard.tsx +55 -0
- package/src/theme/components/timeline/ThreadPreview.tsx +49 -0
- package/src/theme/components/timeline/TimelineFeed.tsx +52 -0
- package/src/theme/components/timeline/TimelineItem.tsx +39 -0
- package/src/theme/components/timeline/index.ts +8 -0
- package/src/theme/layouts/DashLayout.tsx +10 -0
- package/src/theme/layouts/SiteLayout.tsx +184 -0
- package/src/theme/layouts/index.ts +1 -0
- package/src/types/sortablejs.d.ts +23 -0
- package/src/types.ts +61 -0
- package/dist/app.d.ts +0 -38
- package/dist/app.d.ts.map +0 -1
- package/dist/auth.d.ts +0 -25
- package/dist/auth.d.ts.map +0 -1
- package/dist/db/index.d.ts +0 -10
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/schema.d.ts +0 -1543
- package/dist/db/schema.d.ts.map +0 -1
- package/dist/i18n/Trans.d.ts +0 -25
- package/dist/i18n/Trans.d.ts.map +0 -1
- package/dist/i18n/context.d.ts +0 -69
- package/dist/i18n/context.d.ts.map +0 -1
- package/dist/i18n/detect.d.ts +0 -20
- package/dist/i18n/detect.d.ts.map +0 -1
- package/dist/i18n/i18n.d.ts +0 -32
- package/dist/i18n/i18n.d.ts.map +0 -1
- package/dist/i18n/index.d.ts +0 -41
- package/dist/i18n/index.d.ts.map +0 -1
- package/dist/i18n/locales/en.d.ts +0 -3
- package/dist/i18n/locales/en.d.ts.map +0 -1
- package/dist/i18n/locales/zh-Hans.d.ts +0 -3
- package/dist/i18n/locales/zh-Hans.d.ts.map +0 -1
- package/dist/i18n/locales/zh-Hant.d.ts +0 -3
- package/dist/i18n/locales/zh-Hant.d.ts.map +0 -1
- package/dist/i18n/locales.d.ts +0 -11
- package/dist/i18n/locales.d.ts.map +0 -1
- package/dist/i18n/middleware.d.ts +0 -21
- package/dist/i18n/middleware.d.ts.map +0 -1
- package/dist/index.d.ts +0 -16
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/config.d.ts +0 -83
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/constants.d.ts +0 -37
- package/dist/lib/constants.d.ts.map +0 -1
- package/dist/lib/image.d.ts +0 -73
- package/dist/lib/image.d.ts.map +0 -1
- package/dist/lib/index.d.ts +0 -9
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/markdown.d.ts +0 -60
- package/dist/lib/markdown.d.ts.map +0 -1
- package/dist/lib/schemas.d.ts +0 -130
- package/dist/lib/schemas.d.ts.map +0 -1
- package/dist/lib/sqid.d.ts +0 -60
- package/dist/lib/sqid.d.ts.map +0 -1
- package/dist/lib/sse.d.ts +0 -192
- package/dist/lib/sse.d.ts.map +0 -1
- package/dist/lib/theme.d.ts +0 -44
- package/dist/lib/theme.d.ts.map +0 -1
- package/dist/lib/time.d.ts +0 -90
- package/dist/lib/time.d.ts.map +0 -1
- package/dist/lib/url.d.ts +0 -82
- package/dist/lib/url.d.ts.map +0 -1
- package/dist/middleware/auth.d.ts +0 -24
- package/dist/middleware/auth.d.ts.map +0 -1
- package/dist/middleware/onboarding.d.ts +0 -26
- package/dist/middleware/onboarding.d.ts.map +0 -1
- package/dist/routes/api/posts.d.ts +0 -13
- package/dist/routes/api/posts.d.ts.map +0 -1
- package/dist/routes/api/search.d.ts +0 -13
- package/dist/routes/api/search.d.ts.map +0 -1
- package/dist/routes/api/upload.d.ts +0 -16
- package/dist/routes/api/upload.d.ts.map +0 -1
- package/dist/routes/dash/collections.d.ts +0 -13
- package/dist/routes/dash/collections.d.ts.map +0 -1
- package/dist/routes/dash/index.d.ts +0 -15
- package/dist/routes/dash/index.d.ts.map +0 -1
- package/dist/routes/dash/media.d.ts +0 -16
- package/dist/routes/dash/media.d.ts.map +0 -1
- package/dist/routes/dash/pages.d.ts +0 -15
- package/dist/routes/dash/pages.d.ts.map +0 -1
- package/dist/routes/dash/posts.d.ts +0 -13
- package/dist/routes/dash/posts.d.ts.map +0 -1
- package/dist/routes/dash/redirects.d.ts +0 -13
- package/dist/routes/dash/redirects.d.ts.map +0 -1
- package/dist/routes/dash/settings.d.ts +0 -15
- package/dist/routes/dash/settings.d.ts.map +0 -1
- package/dist/routes/feed/rss.d.ts +0 -13
- package/dist/routes/feed/rss.d.ts.map +0 -1
- package/dist/routes/feed/sitemap.d.ts +0 -13
- package/dist/routes/feed/sitemap.d.ts.map +0 -1
- package/dist/routes/pages/archive.d.ts +0 -15
- package/dist/routes/pages/archive.d.ts.map +0 -1
- package/dist/routes/pages/collection.d.ts +0 -13
- package/dist/routes/pages/collection.d.ts.map +0 -1
- package/dist/routes/pages/home.d.ts +0 -13
- package/dist/routes/pages/home.d.ts.map +0 -1
- package/dist/routes/pages/page.d.ts +0 -15
- package/dist/routes/pages/page.d.ts.map +0 -1
- package/dist/routes/pages/post.d.ts +0 -13
- package/dist/routes/pages/post.d.ts.map +0 -1
- package/dist/routes/pages/search.d.ts +0 -13
- package/dist/routes/pages/search.d.ts.map +0 -1
- package/dist/services/collection.d.ts +0 -32
- package/dist/services/collection.d.ts.map +0 -1
- package/dist/services/index.d.ts +0 -28
- package/dist/services/index.d.ts.map +0 -1
- package/dist/services/media.d.ts +0 -34
- package/dist/services/media.d.ts.map +0 -1
- package/dist/services/post.d.ts +0 -31
- package/dist/services/post.d.ts.map +0 -1
- package/dist/services/redirect.d.ts +0 -15
- package/dist/services/redirect.d.ts.map +0 -1
- package/dist/services/search.d.ts +0 -26
- package/dist/services/search.d.ts.map +0 -1
- package/dist/services/settings.d.ts +0 -18
- package/dist/services/settings.d.ts.map +0 -1
- package/dist/theme/color-themes.d.ts +0 -30
- package/dist/theme/color-themes.d.ts.map +0 -1
- package/dist/theme/components/ActionButtons.d.ts +0 -43
- package/dist/theme/components/ActionButtons.d.ts.map +0 -1
- package/dist/theme/components/CrudPageHeader.d.ts +0 -23
- package/dist/theme/components/CrudPageHeader.d.ts.map +0 -1
- package/dist/theme/components/DangerZone.d.ts +0 -36
- package/dist/theme/components/DangerZone.d.ts.map +0 -1
- package/dist/theme/components/EmptyState.d.ts +0 -27
- package/dist/theme/components/EmptyState.d.ts.map +0 -1
- package/dist/theme/components/ListItemRow.d.ts +0 -15
- package/dist/theme/components/ListItemRow.d.ts.map +0 -1
- package/dist/theme/components/MediaGallery.d.ts +0 -13
- package/dist/theme/components/MediaGallery.d.ts.map +0 -1
- package/dist/theme/components/PageForm.d.ts +0 -14
- package/dist/theme/components/PageForm.d.ts.map +0 -1
- package/dist/theme/components/Pagination.d.ts +0 -46
- package/dist/theme/components/Pagination.d.ts.map +0 -1
- package/dist/theme/components/PostForm.d.ts +0 -16
- package/dist/theme/components/PostForm.d.ts.map +0 -1
- package/dist/theme/components/PostList.d.ts +0 -10
- package/dist/theme/components/PostList.d.ts.map +0 -1
- package/dist/theme/components/ThreadView.d.ts +0 -15
- package/dist/theme/components/ThreadView.d.ts.map +0 -1
- package/dist/theme/components/TypeBadge.d.ts +0 -12
- package/dist/theme/components/TypeBadge.d.ts.map +0 -1
- package/dist/theme/components/VisibilityBadge.d.ts +0 -12
- package/dist/theme/components/VisibilityBadge.d.ts.map +0 -1
- package/dist/theme/components/index.d.ts +0 -14
- package/dist/theme/components/index.d.ts.map +0 -1
- package/dist/theme/index.d.ts +0 -21
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/theme/layouts/BaseLayout.d.ts +0 -23
- package/dist/theme/layouts/BaseLayout.d.ts.map +0 -1
- package/dist/theme/layouts/DashLayout.d.ts +0 -17
- package/dist/theme/layouts/DashLayout.d.ts.map +0 -1
- package/dist/theme/layouts/index.d.ts +0 -3
- package/dist/theme/layouts/index.d.ts.map +0 -1
- package/dist/types.d.ts +0 -237
- package/dist/types.d.ts.map +0 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Site Layout
|
|
3
|
+
*
|
|
4
|
+
* Two-column layout for public pages with sidebar navigation.
|
|
5
|
+
* On mobile, uses a slide-out drawer menu.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { FC, PropsWithChildren } from "hono/jsx";
|
|
9
|
+
import type { NavigationLink } from "../../types.js";
|
|
10
|
+
|
|
11
|
+
export interface SiteLayoutProps {
|
|
12
|
+
siteName: string;
|
|
13
|
+
navigationLinks: NavigationLink[];
|
|
14
|
+
currentPath: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Determine if a navigation link is active based on the current path.
|
|
19
|
+
*
|
|
20
|
+
* @param linkUrl - The link's URL
|
|
21
|
+
* @param currentPath - The current page path
|
|
22
|
+
* @returns Whether the link should be shown as active
|
|
23
|
+
*/
|
|
24
|
+
function isLinkActive(linkUrl: string, currentPath: string): boolean {
|
|
25
|
+
// External links are never active
|
|
26
|
+
if (linkUrl.startsWith("http://") || linkUrl.startsWith("https://")) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Exact match for home
|
|
31
|
+
if (linkUrl === "/") {
|
|
32
|
+
return currentPath === "/";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Prefix match for other internal links
|
|
36
|
+
return currentPath === linkUrl || currentPath.startsWith(linkUrl + "/");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Check if a URL is external
|
|
41
|
+
*/
|
|
42
|
+
function isExternalUrl(url: string): boolean {
|
|
43
|
+
return url.startsWith("http://") || url.startsWith("https://");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Render navigation links with dot indicator for active state.
|
|
48
|
+
*/
|
|
49
|
+
function NavLinks({
|
|
50
|
+
navigationLinks,
|
|
51
|
+
currentPath,
|
|
52
|
+
}: {
|
|
53
|
+
navigationLinks: NavigationLink[];
|
|
54
|
+
currentPath: string;
|
|
55
|
+
}) {
|
|
56
|
+
return (
|
|
57
|
+
<>
|
|
58
|
+
{navigationLinks.map((link) => {
|
|
59
|
+
const active = isLinkActive(link.url, currentPath);
|
|
60
|
+
const external = isExternalUrl(link.url);
|
|
61
|
+
return (
|
|
62
|
+
<a
|
|
63
|
+
key={link.id}
|
|
64
|
+
href={link.url}
|
|
65
|
+
class={`text-sm flex items-center gap-2 py-0.5 ${
|
|
66
|
+
active
|
|
67
|
+
? "text-primary font-medium"
|
|
68
|
+
: "text-muted-foreground hover:text-foreground"
|
|
69
|
+
}`}
|
|
70
|
+
{...(external
|
|
71
|
+
? { target: "_blank", rel: "noopener noreferrer" }
|
|
72
|
+
: {})}
|
|
73
|
+
>
|
|
74
|
+
<span
|
|
75
|
+
class={`size-1.5 rounded-full shrink-0 ${active ? "bg-primary" : "bg-transparent"}`}
|
|
76
|
+
/>
|
|
77
|
+
{link.label}
|
|
78
|
+
{external && <span class="ml-1 text-xs opacity-50">↗</span>}
|
|
79
|
+
</a>
|
|
80
|
+
);
|
|
81
|
+
})}
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const SiteLayout: FC<PropsWithChildren<SiteLayoutProps>> = ({
|
|
87
|
+
siteName,
|
|
88
|
+
navigationLinks,
|
|
89
|
+
currentPath,
|
|
90
|
+
children,
|
|
91
|
+
}) => {
|
|
92
|
+
return (
|
|
93
|
+
<div
|
|
94
|
+
class="container py-8 md:flex md:gap-12"
|
|
95
|
+
data-signals={JSON.stringify({ _drawerOpen: false })}
|
|
96
|
+
>
|
|
97
|
+
{/* Mobile header with hamburger */}
|
|
98
|
+
<div class="flex items-center justify-between mb-6 md:hidden">
|
|
99
|
+
<a href="/" class="text-xl font-semibold">
|
|
100
|
+
{siteName}
|
|
101
|
+
</a>
|
|
102
|
+
<button
|
|
103
|
+
data-on:click="$_drawerOpen = true"
|
|
104
|
+
class="p-2 -mr-2 text-muted-foreground hover:text-foreground"
|
|
105
|
+
aria-label="Open menu"
|
|
106
|
+
>
|
|
107
|
+
<svg
|
|
108
|
+
class="size-5"
|
|
109
|
+
fill="none"
|
|
110
|
+
viewBox="0 0 24 24"
|
|
111
|
+
stroke-width="1.5"
|
|
112
|
+
stroke="currentColor"
|
|
113
|
+
>
|
|
114
|
+
<path
|
|
115
|
+
stroke-linecap="round"
|
|
116
|
+
stroke-linejoin="round"
|
|
117
|
+
d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"
|
|
118
|
+
/>
|
|
119
|
+
</svg>
|
|
120
|
+
</button>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
{/* Mobile drawer backdrop */}
|
|
124
|
+
<div
|
|
125
|
+
class="fixed inset-0 bg-black/50 z-40 opacity-0 pointer-events-none transition-opacity duration-300 ease-in-out md:hidden"
|
|
126
|
+
data-class="{'opacity-100 pointer-events-auto': $_drawerOpen, 'opacity-0 pointer-events-none': !$_drawerOpen}"
|
|
127
|
+
data-on:click="$_drawerOpen = false"
|
|
128
|
+
/>
|
|
129
|
+
|
|
130
|
+
{/* Mobile drawer panel */}
|
|
131
|
+
<aside
|
|
132
|
+
class="fixed inset-y-0 left-0 w-64 bg-background z-50 p-6 overflow-y-auto shadow-lg -translate-x-full transition-transform duration-300 ease-in-out md:hidden"
|
|
133
|
+
data-class="{'translate-x-0': $_drawerOpen, '-translate-x-full': !$_drawerOpen}"
|
|
134
|
+
>
|
|
135
|
+
<div class="flex items-center justify-between mb-8">
|
|
136
|
+
<a href="/" class="text-xl font-semibold">
|
|
137
|
+
{siteName}
|
|
138
|
+
</a>
|
|
139
|
+
<button
|
|
140
|
+
data-on:click="$_drawerOpen = false"
|
|
141
|
+
class="p-2 -mr-2 text-muted-foreground hover:text-foreground"
|
|
142
|
+
aria-label="Close menu"
|
|
143
|
+
>
|
|
144
|
+
<svg
|
|
145
|
+
class="size-5"
|
|
146
|
+
fill="none"
|
|
147
|
+
viewBox="0 0 24 24"
|
|
148
|
+
stroke-width="1.5"
|
|
149
|
+
stroke="currentColor"
|
|
150
|
+
>
|
|
151
|
+
<path
|
|
152
|
+
stroke-linecap="round"
|
|
153
|
+
stroke-linejoin="round"
|
|
154
|
+
d="M6 18L18 6M6 6l12 12"
|
|
155
|
+
/>
|
|
156
|
+
</svg>
|
|
157
|
+
</button>
|
|
158
|
+
</div>
|
|
159
|
+
<nav class="flex flex-col gap-0.5">
|
|
160
|
+
<NavLinks
|
|
161
|
+
navigationLinks={navigationLinks}
|
|
162
|
+
currentPath={currentPath}
|
|
163
|
+
/>
|
|
164
|
+
</nav>
|
|
165
|
+
</aside>
|
|
166
|
+
|
|
167
|
+
{/* Desktop sidebar */}
|
|
168
|
+
<aside class="hidden md:block md:w-48 md:shrink-0 md:sticky md:top-8 md:self-start">
|
|
169
|
+
<a href="/" class="text-xl font-semibold block mb-20">
|
|
170
|
+
{siteName}
|
|
171
|
+
</a>
|
|
172
|
+
<nav class="flex flex-col gap-0.5">
|
|
173
|
+
<NavLinks
|
|
174
|
+
navigationLinks={navigationLinks}
|
|
175
|
+
currentPath={currentPath}
|
|
176
|
+
/>
|
|
177
|
+
</nav>
|
|
178
|
+
</aside>
|
|
179
|
+
|
|
180
|
+
{/* Main content */}
|
|
181
|
+
<main class="flex-1 min-w-0">{children}</main>
|
|
182
|
+
</div>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal type declarations for sortablejs
|
|
3
|
+
*
|
|
4
|
+
* Only covers the API surface used by nav-reorder.ts.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
declare module "sortablejs" {
|
|
8
|
+
interface SortableOptions {
|
|
9
|
+
animation?: number;
|
|
10
|
+
handle?: string;
|
|
11
|
+
onEnd?: (event: { oldIndex?: number; newIndex?: number }) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface SortableInstance {
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Sortable: {
|
|
19
|
+
create(el: HTMLElement, options?: SortableOptions): SortableInstance;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default Sortable;
|
|
23
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -201,6 +201,15 @@ export interface Setting {
|
|
|
201
201
|
updatedAt: number;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
export interface NavigationLink {
|
|
205
|
+
id: number;
|
|
206
|
+
label: string;
|
|
207
|
+
url: string;
|
|
208
|
+
position: number;
|
|
209
|
+
createdAt: number;
|
|
210
|
+
updatedAt: number;
|
|
211
|
+
}
|
|
212
|
+
|
|
204
213
|
// =============================================================================
|
|
205
214
|
// Operation Types
|
|
206
215
|
// =============================================================================
|
|
@@ -230,6 +239,18 @@ export interface UpdatePost {
|
|
|
230
239
|
mediaIds?: string[];
|
|
231
240
|
}
|
|
232
241
|
|
|
242
|
+
export interface CreateNavigationLink {
|
|
243
|
+
label: string;
|
|
244
|
+
url: string;
|
|
245
|
+
position?: number;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface UpdateNavigationLink {
|
|
249
|
+
label?: string;
|
|
250
|
+
url?: string;
|
|
251
|
+
position?: number;
|
|
252
|
+
}
|
|
253
|
+
|
|
233
254
|
// =============================================================================
|
|
234
255
|
// Configuration Types
|
|
235
256
|
// =============================================================================
|
|
@@ -269,6 +290,39 @@ export interface EmptyStateProps {
|
|
|
269
290
|
actionHref?: string;
|
|
270
291
|
}
|
|
271
292
|
|
|
293
|
+
// =============================================================================
|
|
294
|
+
// Timeline Types
|
|
295
|
+
// =============================================================================
|
|
296
|
+
|
|
297
|
+
/** Props for per-type timeline cards */
|
|
298
|
+
export interface TimelineCardProps {
|
|
299
|
+
post: PostWithMedia;
|
|
300
|
+
compact?: boolean;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** Props for thread inline preview */
|
|
304
|
+
export interface ThreadPreviewProps {
|
|
305
|
+
rootPost: PostWithMedia;
|
|
306
|
+
previewReplies: PostWithMedia[];
|
|
307
|
+
totalReplyCount: number;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** Data structure for a single timeline item */
|
|
311
|
+
export interface TimelineItemData {
|
|
312
|
+
post: PostWithMedia;
|
|
313
|
+
threadPreview?: {
|
|
314
|
+
replies: PostWithMedia[];
|
|
315
|
+
totalReplyCount: number;
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** Props for the timeline feed wrapper */
|
|
320
|
+
export interface TimelineFeedProps {
|
|
321
|
+
items: TimelineItemData[];
|
|
322
|
+
hasMore: boolean;
|
|
323
|
+
nextCursor?: number;
|
|
324
|
+
}
|
|
325
|
+
|
|
272
326
|
/**
|
|
273
327
|
* Theme component overrides
|
|
274
328
|
*/
|
|
@@ -278,6 +332,13 @@ export interface ThemeComponents {
|
|
|
278
332
|
PostList?: FC<PostListProps>;
|
|
279
333
|
Pagination?: FC<PaginationProps>;
|
|
280
334
|
EmptyState?: FC<EmptyStateProps>;
|
|
335
|
+
NoteCard?: FC<TimelineCardProps>;
|
|
336
|
+
ArticleCard?: FC<TimelineCardProps>;
|
|
337
|
+
LinkCard?: FC<TimelineCardProps>;
|
|
338
|
+
QuoteCard?: FC<TimelineCardProps>;
|
|
339
|
+
ImageCard?: FC<TimelineCardProps>;
|
|
340
|
+
ThreadPreview?: FC<ThreadPreviewProps>;
|
|
341
|
+
TimelineFeed?: FC<TimelineFeedProps>;
|
|
281
342
|
}
|
|
282
343
|
|
|
283
344
|
/**
|
package/dist/app.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Jant App Factory
|
|
3
|
-
*/
|
|
4
|
-
import { Hono } from "hono";
|
|
5
|
-
import { type Services } from "./services/index.js";
|
|
6
|
-
import { type Auth } from "./auth.js";
|
|
7
|
-
import type { Bindings, JantConfig } from "./types.js";
|
|
8
|
-
export interface AppVariables {
|
|
9
|
-
services: Services;
|
|
10
|
-
auth: Auth;
|
|
11
|
-
config: JantConfig;
|
|
12
|
-
themeStyle: string;
|
|
13
|
-
}
|
|
14
|
-
export type App = Hono<{
|
|
15
|
-
Bindings: Bindings;
|
|
16
|
-
Variables: AppVariables;
|
|
17
|
-
}>;
|
|
18
|
-
/**
|
|
19
|
-
* Create a Jant application
|
|
20
|
-
*
|
|
21
|
-
* @param config - Optional configuration
|
|
22
|
-
* @returns Hono app instance
|
|
23
|
-
*
|
|
24
|
-
* Site settings (name, description, language) should be configured via
|
|
25
|
-
* environment variables (SITE_NAME, SITE_DESCRIPTION, SITE_LANGUAGE).
|
|
26
|
-
* They can also be set in the dashboard, which stores them in the database.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```typescript
|
|
30
|
-
* import { createApp } from "@jant/core";
|
|
31
|
-
*
|
|
32
|
-
* export default createApp({
|
|
33
|
-
* theme: { components: { PostCard: MyPostCard } },
|
|
34
|
-
* });
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare function createApp(config?: JantConfig): App;
|
|
38
|
-
//# sourceMappingURL=app.d.ts.map
|
package/dist/app.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAGlD,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAwCvD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,YAAY,CAAA;CAAE,CAAC,CAAC;AAExE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,MAAM,GAAE,UAAe,GAAG,GAAG,CAwnBtD"}
|
package/dist/auth.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Authentication with better-auth
|
|
3
|
-
*/
|
|
4
|
-
export declare function createAuth(d1: D1Database, options: {
|
|
5
|
-
secret: string;
|
|
6
|
-
baseURL: string;
|
|
7
|
-
}): import("better-auth").Auth<{
|
|
8
|
-
database: (options: import("better-auth").BetterAuthOptions) => import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>;
|
|
9
|
-
secret: string;
|
|
10
|
-
baseURL: string;
|
|
11
|
-
emailAndPassword: {
|
|
12
|
-
enabled: true;
|
|
13
|
-
autoSignIn: true;
|
|
14
|
-
minPasswordLength: number;
|
|
15
|
-
};
|
|
16
|
-
session: {
|
|
17
|
-
expiresIn: number;
|
|
18
|
-
cookieCache: {
|
|
19
|
-
enabled: true;
|
|
20
|
-
maxAge: number;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
}>;
|
|
24
|
-
export type Auth = ReturnType<typeof createAuth>;
|
|
25
|
-
//# sourceMappingURL=auth.d.ts.map
|
package/dist/auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,wBAAgB,UAAU,CACxB,EAAE,EAAE,UAAU,EACd,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;GA6B7C;AAED,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
package/dist/db/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Database utilities
|
|
3
|
-
*/
|
|
4
|
-
import * as schema from "./schema.js";
|
|
5
|
-
export type Database = ReturnType<typeof createDatabase>;
|
|
6
|
-
export declare function createDatabase(d1: D1Database): import("drizzle-orm/d1").DrizzleD1Database<typeof schema> & {
|
|
7
|
-
$client: D1Database;
|
|
8
|
-
};
|
|
9
|
-
export { schema };
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/db/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAEzD,wBAAgB,cAAc,CAAC,EAAE,EAAE,UAAU;;EAE5C;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|