@jant/core 0.3.23 → 0.3.25
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 +50 -26
- package/dist/db/schema.js +72 -47
- 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/index.js +5 -11
- package/dist/lib/constants.js +2 -4
- package/dist/lib/excerpt.js +76 -0
- package/dist/lib/feed.js +18 -7
- package/dist/lib/nav-reorder.js +1 -1
- package/dist/lib/navigation.js +30 -6
- package/dist/lib/pagination.js +44 -0
- package/dist/lib/render.js +7 -11
- package/dist/lib/schemas.js +80 -38
- package/dist/lib/theme.js +4 -4
- package/dist/lib/time.js +56 -1
- package/dist/lib/timeline.js +95 -0
- package/dist/lib/view.js +61 -72
- package/dist/routes/api/collections.js +124 -0
- package/dist/routes/api/nav-items.js +104 -0
- package/dist/routes/api/pages.js +91 -0
- package/dist/routes/api/posts.js +27 -33
- package/dist/routes/api/search.js +4 -5
- package/dist/routes/api/settings.js +68 -0
- package/dist/routes/api/upload.js +13 -13
- package/dist/routes/compose.js +48 -0
- package/dist/routes/dash/collections.js +24 -42
- package/dist/routes/dash/index.js +3 -3
- package/dist/routes/dash/media.js +2 -2
- package/dist/routes/dash/pages.js +440 -106
- package/dist/routes/dash/posts.js +27 -37
- package/dist/routes/dash/redirects.js +2 -2
- package/dist/routes/dash/settings.js +79 -5
- package/dist/routes/feed/rss.js +4 -6
- package/dist/routes/feed/sitemap.js +11 -8
- package/dist/routes/pages/archive.js +13 -15
- package/dist/routes/pages/collection.js +12 -9
- package/dist/routes/pages/collections.js +28 -0
- package/dist/routes/pages/featured.js +32 -0
- package/dist/routes/pages/home.js +19 -68
- package/dist/routes/pages/page.js +57 -29
- package/dist/routes/pages/post.js +7 -17
- package/dist/routes/pages/search.js +5 -9
- package/dist/services/collection.js +52 -64
- package/dist/services/index.js +5 -3
- package/dist/services/navigation.js +29 -53
- package/dist/services/page.js +84 -0
- package/dist/services/post.js +102 -69
- package/dist/services/search.js +24 -18
- package/dist/types.js +24 -40
- package/dist/ui/compose/ComposeDialog.js +452 -0
- package/dist/ui/compose/ComposePrompt.js +55 -0
- package/dist/{theme/components/TypeBadge.js → ui/dash/FormatBadge.js} +3 -15
- package/dist/{theme/components → ui/dash}/PageForm.js +15 -15
- package/dist/{theme/components → ui/dash}/PostForm.js +117 -137
- package/dist/{theme/components → ui/dash}/PostList.js +18 -13
- package/dist/ui/dash/StatusBadge.js +46 -0
- package/dist/{theme/components → ui/dash}/index.js +3 -6
- package/dist/ui/feed/LinkCard.js +72 -0
- package/dist/ui/feed/NoteCard.js +58 -0
- package/dist/{themes/minimal/timeline → ui/feed}/QuoteCard.js +29 -14
- package/dist/{themes/minimal/timeline → ui/feed}/ThreadPreview.js +20 -18
- package/dist/ui/feed/TimelineFeed.js +41 -0
- package/dist/ui/feed/TimelineItem.js +27 -0
- package/dist/{theme → ui}/layouts/BaseLayout.js +10 -0
- package/dist/{theme → ui}/layouts/DashLayout.js +0 -8
- package/dist/ui/layouts/SiteLayout.js +141 -0
- package/dist/{themes/minimal → ui}/pages/ArchivePage.js +37 -50
- package/dist/ui/pages/CollectionPage.js +70 -0
- package/dist/ui/pages/CollectionsPage.js +76 -0
- package/dist/ui/pages/FeaturedPage.js +24 -0
- package/dist/ui/pages/HomePage.js +24 -0
- package/dist/{themes/minimal → ui}/pages/PostPage.js +20 -12
- package/dist/{themes/minimal → ui}/pages/SearchPage.js +19 -18
- package/dist/{themes/minimal → ui}/pages/SinglePage.js +5 -4
- package/dist/ui/shared/MediaGallery.js +35 -0
- package/dist/{theme/components → ui/shared}/Pagination.js +41 -2
- package/dist/{theme/components → ui/shared}/ThreadView.js +3 -3
- package/dist/ui/shared/index.js +5 -0
- package/package.json +2 -9
- package/src/__tests__/helpers/app.ts +4 -0
- package/src/__tests__/helpers/db.ts +53 -73
- package/src/app.tsx +56 -28
- package/src/db/migrations/0005_v2_schema_migration.sql +268 -0
- package/src/db/migrations/0006_rename_slug_to_path.sql +5 -0
- package/src/db/migrations/meta/_journal.json +14 -0
- package/src/db/schema.ts +63 -46
- package/src/i18n/locales/en.po +443 -240
- package/src/i18n/locales/en.ts +1 -1
- package/src/i18n/locales/zh-Hans.po +443 -240
- package/src/i18n/locales/zh-Hans.ts +1 -1
- package/src/i18n/locales/zh-Hant.po +443 -240
- package/src/i18n/locales/zh-Hant.ts +1 -1
- package/src/index.ts +29 -42
- package/src/lib/__tests__/excerpt.test.ts +125 -0
- package/src/lib/__tests__/schemas.test.ts +201 -99
- package/src/lib/__tests__/time.test.ts +62 -0
- package/src/{routes/api → lib}/__tests__/timeline.test.ts +81 -75
- package/src/lib/__tests__/view.test.ts +204 -50
- package/src/lib/constants.ts +2 -4
- package/src/lib/excerpt.ts +87 -0
- package/src/lib/feed.ts +22 -7
- package/src/lib/nav-reorder.ts +1 -1
- package/src/lib/navigation.ts +45 -8
- package/src/lib/pagination.ts +50 -0
- package/src/lib/render.tsx +7 -14
- package/src/lib/schemas.ts +119 -51
- package/src/lib/theme.ts +5 -5
- package/src/lib/time.ts +64 -0
- package/src/lib/timeline.ts +141 -0
- package/src/lib/view.ts +80 -82
- package/src/preset.css +46 -0
- package/src/routes/__tests__/compose.test.ts +199 -0
- package/src/routes/api/__tests__/collections.test.ts +249 -0
- package/src/routes/api/__tests__/nav-items.test.ts +222 -0
- package/src/routes/api/__tests__/pages.test.ts +218 -0
- package/src/routes/api/__tests__/posts.test.ts +50 -108
- package/src/routes/api/__tests__/search.test.ts +2 -3
- package/src/routes/api/__tests__/settings.test.ts +132 -0
- package/src/routes/api/collections.ts +143 -0
- package/src/routes/api/nav-items.ts +115 -0
- package/src/routes/api/pages.ts +101 -0
- package/src/routes/api/posts.ts +28 -28
- package/src/routes/api/search.ts +3 -3
- package/src/routes/api/settings.ts +91 -0
- package/src/routes/api/upload.ts +16 -6
- package/src/routes/compose.ts +63 -0
- package/src/routes/dash/__tests__/pages.test.ts +225 -0
- package/src/routes/dash/collections.tsx +20 -42
- package/src/routes/dash/index.tsx +3 -3
- package/src/routes/dash/media.tsx +2 -2
- package/src/routes/dash/pages.tsx +480 -122
- package/src/routes/dash/posts.tsx +42 -54
- package/src/routes/dash/redirects.tsx +2 -2
- package/src/routes/dash/settings.tsx +83 -5
- package/src/routes/feed/rss.ts +4 -3
- package/src/routes/feed/sitemap.ts +15 -5
- package/src/routes/pages/__tests__/collections.test.ts +94 -0
- package/src/routes/pages/__tests__/featured.test.ts +94 -0
- package/src/routes/pages/archive.tsx +15 -15
- package/src/routes/pages/collection.tsx +16 -9
- package/src/routes/pages/collections.tsx +36 -0
- package/src/routes/pages/featured.tsx +38 -0
- package/src/routes/pages/home.tsx +21 -92
- package/src/routes/pages/page.tsx +62 -27
- package/src/routes/pages/post.tsx +6 -18
- package/src/routes/pages/search.tsx +3 -7
- package/src/services/__tests__/collection.test.ts +257 -158
- package/src/services/__tests__/media.test.ts +18 -18
- package/src/services/__tests__/navigation.test.ts +161 -87
- package/src/services/__tests__/page.test.ts +106 -0
- package/src/services/__tests__/post-timeline.test.ts +92 -88
- package/src/services/__tests__/post.test.ts +432 -197
- package/src/services/__tests__/search.test.ts +19 -25
- package/src/services/collection.ts +71 -113
- package/src/services/index.ts +9 -8
- package/src/services/navigation.ts +38 -71
- package/src/services/page.ts +136 -0
- package/src/services/post.ts +141 -101
- package/src/services/search.ts +38 -27
- package/src/styles/tokens.css +47 -0
- package/src/styles/ui.css +491 -0
- package/src/types.ts +212 -198
- package/src/ui/compose/ComposeDialog.tsx +395 -0
- package/src/ui/compose/ComposePrompt.tsx +55 -0
- package/src/ui/dash/FormatBadge.tsx +28 -0
- package/src/{theme/components → ui/dash}/PageForm.tsx +21 -21
- package/src/{theme/components → ui/dash}/PostForm.tsx +110 -131
- package/src/ui/dash/PostList.tsx +101 -0
- package/src/ui/dash/StatusBadge.tsx +61 -0
- package/src/ui/dash/index.ts +10 -0
- package/src/ui/feed/LinkCard.tsx +72 -0
- package/src/ui/feed/NoteCard.tsx +63 -0
- package/src/ui/feed/QuoteCard.tsx +68 -0
- package/src/ui/feed/ThreadPreview.tsx +48 -0
- package/src/ui/feed/TimelineFeed.tsx +49 -0
- package/src/ui/feed/TimelineItem.tsx +45 -0
- package/src/{theme → ui}/layouts/BaseLayout.tsx +11 -1
- package/src/{theme → ui}/layouts/DashLayout.tsx +0 -10
- package/src/ui/layouts/SiteLayout.tsx +150 -0
- package/src/ui/pages/ArchivePage.tsx +162 -0
- package/src/ui/pages/CollectionPage.tsx +70 -0
- package/src/ui/pages/CollectionsPage.tsx +73 -0
- package/src/ui/pages/FeaturedPage.tsx +31 -0
- package/src/ui/pages/HomePage.tsx +37 -0
- package/src/ui/pages/PostPage.tsx +56 -0
- package/src/{themes/minimal → ui}/pages/SearchPage.tsx +24 -20
- package/src/{themes/minimal → ui}/pages/SinglePage.tsx +5 -5
- package/src/ui/shared/MediaGallery.tsx +59 -0
- package/src/{theme/components → ui/shared}/Pagination.tsx +67 -4
- package/src/{theme/components → ui/shared}/ThreadView.tsx +6 -3
- package/src/ui/shared/__tests__/pagination.test.ts +46 -0
- package/src/ui/shared/index.ts +12 -0
- package/bin/jant.js +0 -185
- package/dist/lib/theme-components.js +0 -49
- package/dist/routes/api/timeline.js +0 -120
- package/dist/routes/dash/navigation.js +0 -288
- package/dist/theme/components/MediaGallery.js +0 -107
- package/dist/theme/components/VisibilityBadge.js +0 -37
- package/dist/theme/index.js +0 -18
- package/dist/theme/layouts/index.js +0 -2
- package/dist/themes/minimal/MinimalSiteLayout.js +0 -83
- package/dist/themes/minimal/index.js +0 -65
- package/dist/themes/minimal/pages/CollectionPage.js +0 -65
- package/dist/themes/minimal/pages/HomePage.js +0 -25
- package/dist/themes/minimal/timeline/ArticleCard.js +0 -36
- package/dist/themes/minimal/timeline/ImageCard.js +0 -67
- package/dist/themes/minimal/timeline/LinkCard.js +0 -47
- package/dist/themes/minimal/timeline/NoteCard.js +0 -34
- package/dist/themes/minimal/timeline/TimelineFeed.js +0 -48
- package/dist/themes/minimal/timeline/TimelineItem.js +0 -44
- package/src/lib/__tests__/theme-components.test.ts +0 -126
- package/src/lib/theme-components.ts +0 -68
- package/src/routes/api/timeline.tsx +0 -159
- package/src/routes/dash/navigation.tsx +0 -316
- package/src/theme/components/MediaGallery.tsx +0 -128
- package/src/theme/components/PostList.tsx +0 -92
- package/src/theme/components/TypeBadge.tsx +0 -37
- package/src/theme/components/VisibilityBadge.tsx +0 -45
- package/src/theme/components/index.ts +0 -23
- package/src/theme/index.ts +0 -22
- package/src/theme/layouts/index.ts +0 -7
- package/src/themes/minimal/MinimalSiteLayout.tsx +0 -100
- package/src/themes/minimal/index.ts +0 -83
- package/src/themes/minimal/pages/ArchivePage.tsx +0 -157
- package/src/themes/minimal/pages/CollectionPage.tsx +0 -60
- package/src/themes/minimal/pages/HomePage.tsx +0 -41
- package/src/themes/minimal/pages/PostPage.tsx +0 -43
- package/src/themes/minimal/timeline/ArticleCard.tsx +0 -37
- package/src/themes/minimal/timeline/ImageCard.tsx +0 -63
- package/src/themes/minimal/timeline/LinkCard.tsx +0 -48
- package/src/themes/minimal/timeline/NoteCard.tsx +0 -35
- package/src/themes/minimal/timeline/QuoteCard.tsx +0 -49
- package/src/themes/minimal/timeline/ThreadPreview.tsx +0 -47
- package/src/themes/minimal/timeline/TimelineFeed.tsx +0 -57
- package/src/themes/minimal/timeline/TimelineItem.tsx +0 -75
- /package/dist/{theme → ui}/color-themes.js +0 -0
- /package/dist/{theme/components → ui/dash}/ActionButtons.js +0 -0
- /package/dist/{theme/components → ui/dash}/CrudPageHeader.js +0 -0
- /package/dist/{theme/components → ui/dash}/DangerZone.js +0 -0
- /package/dist/{theme/components → ui/dash}/ListItemRow.js +0 -0
- /package/dist/{theme/components → ui/shared}/EmptyState.js +0 -0
- /package/src/{theme → ui}/color-themes.ts +0 -0
- /package/src/{theme/components → ui/dash}/ActionButtons.tsx +0 -0
- /package/src/{theme/components → ui/dash}/CrudPageHeader.tsx +0 -0
- /package/src/{theme/components → ui/dash}/DangerZone.tsx +0 -0
- /package/src/{theme/components → ui/dash}/ListItemRow.tsx +0 -0
- /package/src/{theme/components → ui/shared}/EmptyState.tsx +0 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compose Dialog
|
|
3
|
+
*
|
|
4
|
+
* Full-screen compose dialog for quick post creation.
|
|
5
|
+
* Rendered server-side as part of SiteLayout for authenticated users.
|
|
6
|
+
*/ import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
|
|
7
|
+
import { useLingui as $_useLingui } from "@jant/core/i18n";
|
|
8
|
+
export const ComposeDialog = ({ collections })=>{
|
|
9
|
+
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
10
|
+
const signals = JSON.stringify({
|
|
11
|
+
format: "note",
|
|
12
|
+
title: "",
|
|
13
|
+
body: "",
|
|
14
|
+
url: "",
|
|
15
|
+
quoteText: "",
|
|
16
|
+
status: "published",
|
|
17
|
+
featured: false,
|
|
18
|
+
pinned: false,
|
|
19
|
+
rating: 0,
|
|
20
|
+
collectionId: 0,
|
|
21
|
+
mediaIds: [],
|
|
22
|
+
_composeLoading: false,
|
|
23
|
+
_showRating: false,
|
|
24
|
+
_showCollection: false
|
|
25
|
+
}).replace(/</g, "\\u003c");
|
|
26
|
+
return /*#__PURE__*/ _jsxs("dialog", {
|
|
27
|
+
id: "compose-dialog",
|
|
28
|
+
class: "compose-dialog backdrop:bg-black/50",
|
|
29
|
+
onclick: "event.target === this && this.close()",
|
|
30
|
+
children: [
|
|
31
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
32
|
+
class: "compose-dialog-inner",
|
|
33
|
+
children: [
|
|
34
|
+
/*#__PURE__*/ _jsxs("header", {
|
|
35
|
+
class: "compose-dialog-header",
|
|
36
|
+
children: [
|
|
37
|
+
/*#__PURE__*/ _jsx("button", {
|
|
38
|
+
type: "button",
|
|
39
|
+
class: "compose-dialog-close",
|
|
40
|
+
onclick: "this.closest('dialog').close()",
|
|
41
|
+
children: /*#__PURE__*/ _jsxs("svg", {
|
|
42
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
43
|
+
width: "20",
|
|
44
|
+
height: "20",
|
|
45
|
+
viewBox: "0 0 24 24",
|
|
46
|
+
fill: "none",
|
|
47
|
+
stroke: "currentColor",
|
|
48
|
+
"stroke-width": "2",
|
|
49
|
+
"stroke-linecap": "round",
|
|
50
|
+
"stroke-linejoin": "round",
|
|
51
|
+
children: [
|
|
52
|
+
/*#__PURE__*/ _jsx("path", {
|
|
53
|
+
d: "M18 6 6 18"
|
|
54
|
+
}),
|
|
55
|
+
/*#__PURE__*/ _jsx("path", {
|
|
56
|
+
d: "M6 6l12 12"
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
62
|
+
class: "compose-dialog-title",
|
|
63
|
+
children: $__i18n._({
|
|
64
|
+
id: "FGrimz",
|
|
65
|
+
message: "New Post"
|
|
66
|
+
})
|
|
67
|
+
}),
|
|
68
|
+
/*#__PURE__*/ _jsx("div", {
|
|
69
|
+
class: "w-5"
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ _jsx("section", {
|
|
74
|
+
class: "compose-dialog-body",
|
|
75
|
+
children: /*#__PURE__*/ _jsxs("form", {
|
|
76
|
+
"data-signals": signals,
|
|
77
|
+
"data-on:submit__prevent": "@post('/compose')",
|
|
78
|
+
"data-indicator": "_composeLoading",
|
|
79
|
+
class: "flex flex-col gap-3",
|
|
80
|
+
children: [
|
|
81
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
82
|
+
class: "compose-format-tabs",
|
|
83
|
+
children: [
|
|
84
|
+
/*#__PURE__*/ _jsx("button", {
|
|
85
|
+
type: "button",
|
|
86
|
+
class: "compose-format-tab",
|
|
87
|
+
"data-class-compose-format-tab-active": "$format === 'note'",
|
|
88
|
+
"data-on:click": "$format = 'note'",
|
|
89
|
+
children: $__i18n._({
|
|
90
|
+
id: "KiJn9B",
|
|
91
|
+
message: "Note"
|
|
92
|
+
})
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ _jsx("button", {
|
|
95
|
+
type: "button",
|
|
96
|
+
class: "compose-format-tab",
|
|
97
|
+
"data-class-compose-format-tab-active": "$format === 'link'",
|
|
98
|
+
"data-on:click": "$format = 'link'",
|
|
99
|
+
children: $__i18n._({
|
|
100
|
+
id: "yzF66j",
|
|
101
|
+
message: "Link"
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
/*#__PURE__*/ _jsx("button", {
|
|
105
|
+
type: "button",
|
|
106
|
+
class: "compose-format-tab",
|
|
107
|
+
"data-class-compose-format-tab-active": "$format === 'quote'",
|
|
108
|
+
"data-on:click": "$format = 'quote'",
|
|
109
|
+
children: $__i18n._({
|
|
110
|
+
id: "ZhhOwV",
|
|
111
|
+
message: "Quote"
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}),
|
|
116
|
+
/*#__PURE__*/ _jsx("input", {
|
|
117
|
+
type: "text",
|
|
118
|
+
"data-bind": "title",
|
|
119
|
+
class: "compose-title-input",
|
|
120
|
+
placeholder: $__i18n._({
|
|
121
|
+
id: "wK4OTM",
|
|
122
|
+
message: "Title (optional)"
|
|
123
|
+
})
|
|
124
|
+
}),
|
|
125
|
+
/*#__PURE__*/ _jsx("textarea", {
|
|
126
|
+
"data-bind": "body",
|
|
127
|
+
class: "compose-body-input",
|
|
128
|
+
placeholder: $__i18n._({
|
|
129
|
+
id: "7nGhhM",
|
|
130
|
+
message: "What's on your mind?"
|
|
131
|
+
}),
|
|
132
|
+
rows: 4
|
|
133
|
+
}),
|
|
134
|
+
/*#__PURE__*/ _jsx("div", {
|
|
135
|
+
"data-show": "$format === 'link' || $format === 'quote'",
|
|
136
|
+
children: /*#__PURE__*/ _jsx("input", {
|
|
137
|
+
type: "url",
|
|
138
|
+
"data-bind": "url",
|
|
139
|
+
class: "input text-sm",
|
|
140
|
+
placeholder: "https://..."
|
|
141
|
+
})
|
|
142
|
+
}),
|
|
143
|
+
/*#__PURE__*/ _jsx("div", {
|
|
144
|
+
"data-show": "$format === 'quote'",
|
|
145
|
+
children: /*#__PURE__*/ _jsx("textarea", {
|
|
146
|
+
"data-bind": "quoteText",
|
|
147
|
+
class: "textarea text-sm",
|
|
148
|
+
placeholder: $__i18n._({
|
|
149
|
+
id: "QLkhbH",
|
|
150
|
+
message: "The text being quoted..."
|
|
151
|
+
}),
|
|
152
|
+
rows: 2
|
|
153
|
+
})
|
|
154
|
+
}),
|
|
155
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
156
|
+
"data-show": "$_showRating",
|
|
157
|
+
class: "field",
|
|
158
|
+
children: [
|
|
159
|
+
/*#__PURE__*/ _jsx("label", {
|
|
160
|
+
class: "label text-sm",
|
|
161
|
+
children: $__i18n._({
|
|
162
|
+
id: "z1U/Fh",
|
|
163
|
+
message: "Rating"
|
|
164
|
+
})
|
|
165
|
+
}),
|
|
166
|
+
/*#__PURE__*/ _jsxs("select", {
|
|
167
|
+
"data-bind": "rating",
|
|
168
|
+
class: "select text-sm",
|
|
169
|
+
children: [
|
|
170
|
+
/*#__PURE__*/ _jsx("option", {
|
|
171
|
+
value: "0",
|
|
172
|
+
children: $__i18n._({
|
|
173
|
+
id: "EdQY6l",
|
|
174
|
+
message: "None"
|
|
175
|
+
})
|
|
176
|
+
}),
|
|
177
|
+
/*#__PURE__*/ _jsx("option", {
|
|
178
|
+
value: "1",
|
|
179
|
+
children: "1"
|
|
180
|
+
}),
|
|
181
|
+
/*#__PURE__*/ _jsx("option", {
|
|
182
|
+
value: "2",
|
|
183
|
+
children: "2"
|
|
184
|
+
}),
|
|
185
|
+
/*#__PURE__*/ _jsx("option", {
|
|
186
|
+
value: "3",
|
|
187
|
+
children: "3"
|
|
188
|
+
}),
|
|
189
|
+
/*#__PURE__*/ _jsx("option", {
|
|
190
|
+
value: "4",
|
|
191
|
+
children: "4"
|
|
192
|
+
}),
|
|
193
|
+
/*#__PURE__*/ _jsx("option", {
|
|
194
|
+
value: "5",
|
|
195
|
+
children: "5"
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
})
|
|
199
|
+
]
|
|
200
|
+
}),
|
|
201
|
+
collections && collections.length > 0 && /*#__PURE__*/ _jsxs("div", {
|
|
202
|
+
"data-show": "$_showCollection",
|
|
203
|
+
class: "field",
|
|
204
|
+
children: [
|
|
205
|
+
/*#__PURE__*/ _jsx("label", {
|
|
206
|
+
class: "label text-sm",
|
|
207
|
+
children: $__i18n._({
|
|
208
|
+
id: "q+hNag",
|
|
209
|
+
message: "Collection"
|
|
210
|
+
})
|
|
211
|
+
}),
|
|
212
|
+
/*#__PURE__*/ _jsxs("select", {
|
|
213
|
+
"data-bind": "collectionId",
|
|
214
|
+
class: "select text-sm",
|
|
215
|
+
children: [
|
|
216
|
+
/*#__PURE__*/ _jsx("option", {
|
|
217
|
+
value: "0",
|
|
218
|
+
children: $__i18n._({
|
|
219
|
+
id: "EdQY6l",
|
|
220
|
+
message: "None"
|
|
221
|
+
})
|
|
222
|
+
}),
|
|
223
|
+
collections.map((col)=>/*#__PURE__*/ _jsx("option", {
|
|
224
|
+
value: col.id,
|
|
225
|
+
children: col.title
|
|
226
|
+
}, col.id))
|
|
227
|
+
]
|
|
228
|
+
})
|
|
229
|
+
]
|
|
230
|
+
}),
|
|
231
|
+
/*#__PURE__*/ _jsx("div", {
|
|
232
|
+
class: "compose-toolbar",
|
|
233
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
234
|
+
class: "flex gap-1",
|
|
235
|
+
children: [
|
|
236
|
+
/*#__PURE__*/ _jsx("button", {
|
|
237
|
+
type: "button",
|
|
238
|
+
class: "compose-toolbar-btn",
|
|
239
|
+
title: $__i18n._({
|
|
240
|
+
id: "qiXmlF",
|
|
241
|
+
message: "Add Media"
|
|
242
|
+
}),
|
|
243
|
+
"data-on:click": "document.getElementById('compose-media-picker').showModal(); fetch('/dash/media/picker').then(r => r.text()).then(html => document.getElementById('compose-media-grid').innerHTML = html)",
|
|
244
|
+
children: /*#__PURE__*/ _jsxs("svg", {
|
|
245
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
246
|
+
width: "18",
|
|
247
|
+
height: "18",
|
|
248
|
+
viewBox: "0 0 24 24",
|
|
249
|
+
fill: "none",
|
|
250
|
+
stroke: "currentColor",
|
|
251
|
+
"stroke-width": "2",
|
|
252
|
+
"stroke-linecap": "round",
|
|
253
|
+
"stroke-linejoin": "round",
|
|
254
|
+
children: [
|
|
255
|
+
/*#__PURE__*/ _jsx("rect", {
|
|
256
|
+
width: "18",
|
|
257
|
+
height: "18",
|
|
258
|
+
x: "3",
|
|
259
|
+
y: "3",
|
|
260
|
+
rx: "2",
|
|
261
|
+
ry: "2"
|
|
262
|
+
}),
|
|
263
|
+
/*#__PURE__*/ _jsx("circle", {
|
|
264
|
+
cx: "9",
|
|
265
|
+
cy: "9",
|
|
266
|
+
r: "2"
|
|
267
|
+
}),
|
|
268
|
+
/*#__PURE__*/ _jsx("path", {
|
|
269
|
+
d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"
|
|
270
|
+
})
|
|
271
|
+
]
|
|
272
|
+
})
|
|
273
|
+
}),
|
|
274
|
+
/*#__PURE__*/ _jsx("button", {
|
|
275
|
+
type: "button",
|
|
276
|
+
class: "compose-toolbar-btn",
|
|
277
|
+
title: $__i18n._({
|
|
278
|
+
id: "z1U/Fh",
|
|
279
|
+
message: "Rating"
|
|
280
|
+
}),
|
|
281
|
+
"data-on:click": "$_showRating = !$_showRating",
|
|
282
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
283
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
284
|
+
width: "18",
|
|
285
|
+
height: "18",
|
|
286
|
+
viewBox: "0 0 24 24",
|
|
287
|
+
fill: "none",
|
|
288
|
+
stroke: "currentColor",
|
|
289
|
+
"stroke-width": "2",
|
|
290
|
+
"stroke-linecap": "round",
|
|
291
|
+
"stroke-linejoin": "round",
|
|
292
|
+
children: /*#__PURE__*/ _jsx("polygon", {
|
|
293
|
+
points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
|
|
294
|
+
})
|
|
295
|
+
})
|
|
296
|
+
}),
|
|
297
|
+
collections && collections.length > 0 && /*#__PURE__*/ _jsx("button", {
|
|
298
|
+
type: "button",
|
|
299
|
+
class: "compose-toolbar-btn",
|
|
300
|
+
title: $__i18n._({
|
|
301
|
+
id: "q+hNag",
|
|
302
|
+
message: "Collection"
|
|
303
|
+
}),
|
|
304
|
+
"data-on:click": "$_showCollection = !$_showCollection",
|
|
305
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
306
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
307
|
+
width: "18",
|
|
308
|
+
height: "18",
|
|
309
|
+
viewBox: "0 0 24 24",
|
|
310
|
+
fill: "none",
|
|
311
|
+
stroke: "currentColor",
|
|
312
|
+
"stroke-width": "2",
|
|
313
|
+
"stroke-linecap": "round",
|
|
314
|
+
"stroke-linejoin": "round",
|
|
315
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
316
|
+
d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"
|
|
317
|
+
})
|
|
318
|
+
})
|
|
319
|
+
})
|
|
320
|
+
]
|
|
321
|
+
})
|
|
322
|
+
}),
|
|
323
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
324
|
+
class: "compose-dialog-footer",
|
|
325
|
+
children: [
|
|
326
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
327
|
+
class: "flex gap-3",
|
|
328
|
+
children: [
|
|
329
|
+
/*#__PURE__*/ _jsxs("label", {
|
|
330
|
+
class: "flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
331
|
+
children: [
|
|
332
|
+
/*#__PURE__*/ _jsx("input", {
|
|
333
|
+
type: "checkbox",
|
|
334
|
+
class: "checkbox",
|
|
335
|
+
"data-bind": "featured"
|
|
336
|
+
}),
|
|
337
|
+
$__i18n._({
|
|
338
|
+
id: "FkMol5",
|
|
339
|
+
message: "Featured"
|
|
340
|
+
})
|
|
341
|
+
]
|
|
342
|
+
}),
|
|
343
|
+
/*#__PURE__*/ _jsxs("label", {
|
|
344
|
+
class: "flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
345
|
+
children: [
|
|
346
|
+
/*#__PURE__*/ _jsx("input", {
|
|
347
|
+
type: "checkbox",
|
|
348
|
+
class: "checkbox",
|
|
349
|
+
"data-bind": "pinned"
|
|
350
|
+
}),
|
|
351
|
+
$__i18n._({
|
|
352
|
+
id: "kNiQp6",
|
|
353
|
+
message: "Pinned"
|
|
354
|
+
})
|
|
355
|
+
]
|
|
356
|
+
})
|
|
357
|
+
]
|
|
358
|
+
}),
|
|
359
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
360
|
+
class: "flex gap-2",
|
|
361
|
+
children: [
|
|
362
|
+
/*#__PURE__*/ _jsxs("button", {
|
|
363
|
+
type: "button",
|
|
364
|
+
class: "btn-outline text-sm",
|
|
365
|
+
"data-attr-disabled": "$_composeLoading",
|
|
366
|
+
"data-on:click": "$status = 'draft'; document.querySelector('#compose-dialog form').requestSubmit()",
|
|
367
|
+
children: [
|
|
368
|
+
/*#__PURE__*/ _jsx("span", {
|
|
369
|
+
"data-show": "!$_composeLoading",
|
|
370
|
+
children: $__i18n._({
|
|
371
|
+
id: "eneWvv",
|
|
372
|
+
message: "Draft"
|
|
373
|
+
})
|
|
374
|
+
}),
|
|
375
|
+
/*#__PURE__*/ _jsx("span", {
|
|
376
|
+
"data-show": "$_composeLoading",
|
|
377
|
+
children: "..."
|
|
378
|
+
})
|
|
379
|
+
]
|
|
380
|
+
}),
|
|
381
|
+
/*#__PURE__*/ _jsxs("button", {
|
|
382
|
+
type: "submit",
|
|
383
|
+
class: "btn text-sm",
|
|
384
|
+
"data-attr-disabled": "$_composeLoading",
|
|
385
|
+
children: [
|
|
386
|
+
/*#__PURE__*/ _jsx("span", {
|
|
387
|
+
"data-show": "!$_composeLoading",
|
|
388
|
+
children: $__i18n._({
|
|
389
|
+
id: "y28hnO",
|
|
390
|
+
message: "Post"
|
|
391
|
+
})
|
|
392
|
+
}),
|
|
393
|
+
/*#__PURE__*/ _jsx("span", {
|
|
394
|
+
"data-show": "$_composeLoading",
|
|
395
|
+
children: $__i18n._({
|
|
396
|
+
id: "iPHeYN",
|
|
397
|
+
message: "Posting..."
|
|
398
|
+
})
|
|
399
|
+
})
|
|
400
|
+
]
|
|
401
|
+
})
|
|
402
|
+
]
|
|
403
|
+
})
|
|
404
|
+
]
|
|
405
|
+
})
|
|
406
|
+
]
|
|
407
|
+
})
|
|
408
|
+
})
|
|
409
|
+
]
|
|
410
|
+
}),
|
|
411
|
+
/*#__PURE__*/ _jsxs("dialog", {
|
|
412
|
+
id: "compose-media-picker",
|
|
413
|
+
class: "p-6 rounded-lg max-w-2xl w-full backdrop:bg-black/50",
|
|
414
|
+
onclick: "event.target === this && this.close()",
|
|
415
|
+
children: [
|
|
416
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
417
|
+
class: "flex items-center justify-between mb-4",
|
|
418
|
+
children: [
|
|
419
|
+
/*#__PURE__*/ _jsx("h2", {
|
|
420
|
+
class: "text-lg font-semibold",
|
|
421
|
+
children: $__i18n._({
|
|
422
|
+
id: "2fUwEY",
|
|
423
|
+
message: "Select Media"
|
|
424
|
+
})
|
|
425
|
+
}),
|
|
426
|
+
/*#__PURE__*/ _jsx("button", {
|
|
427
|
+
type: "button",
|
|
428
|
+
class: "btn-outline text-sm",
|
|
429
|
+
onclick: "this.closest('dialog').close()",
|
|
430
|
+
children: $__i18n._({
|
|
431
|
+
id: "DPfwMq",
|
|
432
|
+
message: "Done"
|
|
433
|
+
})
|
|
434
|
+
})
|
|
435
|
+
]
|
|
436
|
+
}),
|
|
437
|
+
/*#__PURE__*/ _jsx("div", {
|
|
438
|
+
id: "compose-media-grid",
|
|
439
|
+
class: "grid grid-cols-4 gap-2 max-h-96 overflow-y-auto",
|
|
440
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
441
|
+
class: "text-muted-foreground text-sm col-span-4",
|
|
442
|
+
children: $__i18n._({
|
|
443
|
+
id: "Z3FXyt",
|
|
444
|
+
message: "Loading..."
|
|
445
|
+
})
|
|
446
|
+
})
|
|
447
|
+
})
|
|
448
|
+
]
|
|
449
|
+
})
|
|
450
|
+
]
|
|
451
|
+
});
|
|
452
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compose Prompt
|
|
3
|
+
*
|
|
4
|
+
* "What's new?" prompt bar at the top of the content area.
|
|
5
|
+
* Clicking it opens the compose dialog.
|
|
6
|
+
*/ import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
|
|
7
|
+
import { useLingui as $_useLingui } from "@jant/core/i18n";
|
|
8
|
+
export const ComposePrompt = ()=>{
|
|
9
|
+
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
10
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
11
|
+
class: "compose-prompt",
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ _jsxs("button", {
|
|
14
|
+
type: "button",
|
|
15
|
+
class: "compose-prompt-trigger",
|
|
16
|
+
onclick: "document.getElementById('compose-dialog').showModal()",
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ _jsx("span", {
|
|
19
|
+
class: "compose-prompt-avatar",
|
|
20
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
21
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
22
|
+
width: "16",
|
|
23
|
+
height: "16",
|
|
24
|
+
viewBox: "0 0 24 24",
|
|
25
|
+
fill: "none",
|
|
26
|
+
stroke: "currentColor",
|
|
27
|
+
"stroke-width": "2",
|
|
28
|
+
"stroke-linecap": "round",
|
|
29
|
+
"stroke-linejoin": "round",
|
|
30
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
31
|
+
d: "M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 1 1 3.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
}),
|
|
35
|
+
/*#__PURE__*/ _jsx("span", {
|
|
36
|
+
class: "compose-prompt-text",
|
|
37
|
+
children: $__i18n._({
|
|
38
|
+
id: "K0r7TC",
|
|
39
|
+
message: "What's new?"
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ _jsx("button", {
|
|
45
|
+
type: "button",
|
|
46
|
+
class: "compose-prompt-post-btn",
|
|
47
|
+
onclick: "document.getElementById('compose-dialog').showModal()",
|
|
48
|
+
children: $__i18n._({
|
|
49
|
+
id: "y28hnO",
|
|
50
|
+
message: "Post"
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Format Badge Component
|
|
3
3
|
*
|
|
4
|
-
* Displays a badge indicating the
|
|
4
|
+
* Displays a badge indicating the format of a post (note, link, quote).
|
|
5
5
|
*/ import { jsx as _jsx } from "hono/jsx/jsx-runtime";
|
|
6
6
|
import { useLingui as $_useLingui } from "@jant/core/i18n";
|
|
7
|
-
export const
|
|
7
|
+
export const FormatBadge = ({ type })=>{
|
|
8
8
|
const { i18n: $__i18n, _: $__ } = $_useLingui();
|
|
9
9
|
const labels = {
|
|
10
10
|
note: $__i18n._({
|
|
11
11
|
id: "KiJn9B",
|
|
12
12
|
message: "Note"
|
|
13
13
|
}),
|
|
14
|
-
article: $__i18n._({
|
|
15
|
-
id: "f6e0Ry",
|
|
16
|
-
message: "Article"
|
|
17
|
-
}),
|
|
18
14
|
link: $__i18n._({
|
|
19
15
|
id: "yzF66j",
|
|
20
16
|
message: "Link"
|
|
@@ -22,14 +18,6 @@ export const TypeBadge = ({ type })=>{
|
|
|
22
18
|
quote: $__i18n._({
|
|
23
19
|
id: "ZhhOwV",
|
|
24
20
|
message: "Quote"
|
|
25
|
-
}),
|
|
26
|
-
image: $__i18n._({
|
|
27
|
-
id: "hG89Ed",
|
|
28
|
-
message: "Image"
|
|
29
|
-
}),
|
|
30
|
-
page: $__i18n._({
|
|
31
|
-
id: "6WdDG7",
|
|
32
|
-
message: "Page"
|
|
33
21
|
})
|
|
34
22
|
};
|
|
35
23
|
return /*#__PURE__*/ _jsx("span", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Page Creation/Edit Form
|
|
3
3
|
*
|
|
4
|
-
* For managing
|
|
4
|
+
* For managing standalone pages (about, now, etc.)
|
|
5
5
|
*/ import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
|
|
6
6
|
import { useLingui as $_useLingui } from "@jant/core/i18n";
|
|
7
7
|
export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
|
|
@@ -9,9 +9,9 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
|
|
|
9
9
|
const isEdit = !!page;
|
|
10
10
|
const signals = JSON.stringify({
|
|
11
11
|
title: page?.title ?? "",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
slug: page?.slug ?? "",
|
|
13
|
+
body: page?.body ?? "",
|
|
14
|
+
status: page?.status ?? "published"
|
|
15
15
|
}).replace(/</g, "\\u003c");
|
|
16
16
|
return /*#__PURE__*/ _jsxs("form", {
|
|
17
17
|
"data-signals": signals,
|
|
@@ -50,8 +50,8 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
|
|
|
50
50
|
/*#__PURE__*/ _jsx("label", {
|
|
51
51
|
class: "label",
|
|
52
52
|
children: $__i18n._({
|
|
53
|
-
id: "
|
|
54
|
-
message: "
|
|
53
|
+
id: "L85WcV",
|
|
54
|
+
message: "Slug"
|
|
55
55
|
})
|
|
56
56
|
}),
|
|
57
57
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -63,7 +63,7 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
|
|
|
63
63
|
}),
|
|
64
64
|
/*#__PURE__*/ _jsx("input", {
|
|
65
65
|
type: "text",
|
|
66
|
-
"data-bind": "
|
|
66
|
+
"data-bind": "slug",
|
|
67
67
|
class: "input flex-1",
|
|
68
68
|
placeholder: "about",
|
|
69
69
|
pattern: "[a-z0-9\\-]+",
|
|
@@ -95,14 +95,14 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
|
|
|
95
95
|
})
|
|
96
96
|
}),
|
|
97
97
|
/*#__PURE__*/ _jsx("textarea", {
|
|
98
|
-
"data-bind": "
|
|
98
|
+
"data-bind": "body",
|
|
99
99
|
class: "textarea min-h-48",
|
|
100
100
|
placeholder: $__i18n._({
|
|
101
101
|
id: "7G4SBz",
|
|
102
102
|
message: "Page content (Markdown supported)..."
|
|
103
103
|
}),
|
|
104
104
|
required: true,
|
|
105
|
-
children: page?.
|
|
105
|
+
children: page?.body ?? ""
|
|
106
106
|
})
|
|
107
107
|
]
|
|
108
108
|
}),
|
|
@@ -117,12 +117,12 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
|
|
|
117
117
|
})
|
|
118
118
|
}),
|
|
119
119
|
/*#__PURE__*/ _jsxs("select", {
|
|
120
|
-
"data-bind": "
|
|
120
|
+
"data-bind": "status",
|
|
121
121
|
class: "select",
|
|
122
122
|
children: [
|
|
123
123
|
/*#__PURE__*/ _jsx("option", {
|
|
124
|
-
value: "
|
|
125
|
-
selected: page?.
|
|
124
|
+
value: "published",
|
|
125
|
+
selected: page?.status === "published" || !page,
|
|
126
126
|
children: $__i18n._({
|
|
127
127
|
id: "u3wRF+",
|
|
128
128
|
message: "Published"
|
|
@@ -130,7 +130,7 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
|
|
|
130
130
|
}),
|
|
131
131
|
/*#__PURE__*/ _jsx("option", {
|
|
132
132
|
value: "draft",
|
|
133
|
-
selected: page?.
|
|
133
|
+
selected: page?.status === "draft",
|
|
134
134
|
children: $__i18n._({
|
|
135
135
|
id: "eneWvv",
|
|
136
136
|
message: "Draft"
|
|
@@ -141,8 +141,8 @@ export const PageForm = ({ page, action, cancelUrl = "/dash/pages" })=>{
|
|
|
141
141
|
/*#__PURE__*/ _jsx("p", {
|
|
142
142
|
class: "text-xs text-muted-foreground mt-1",
|
|
143
143
|
children: $__i18n._({
|
|
144
|
-
id: "
|
|
145
|
-
message: "Published pages are accessible via their
|
|
144
|
+
id: "jSRrXo",
|
|
145
|
+
message: "Published pages are accessible via their slug. Drafts are not visible."
|
|
146
146
|
})
|
|
147
147
|
})
|
|
148
148
|
]
|