@jant/core 0.2.12 → 0.2.13

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 (146) hide show
  1. package/bin/jant.js +3 -1
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js +112 -85
  4. package/dist/auth.d.ts +1 -0
  5. package/dist/auth.d.ts.map +1 -1
  6. package/dist/auth.js +2 -1
  7. package/dist/client.js +1 -1
  8. package/dist/db/schema.d.ts.map +1 -1
  9. package/dist/i18n/context.d.ts.map +1 -1
  10. package/dist/i18n/context.js +0 -3
  11. package/dist/i18n/detect.d.ts +0 -11
  12. package/dist/i18n/detect.d.ts.map +1 -1
  13. package/dist/i18n/detect.js +1 -52
  14. package/dist/i18n/i18n.d.ts +4 -14
  15. package/dist/i18n/i18n.d.ts.map +1 -1
  16. package/dist/i18n/i18n.js +19 -25
  17. package/dist/i18n/index.d.ts +1 -1
  18. package/dist/i18n/index.d.ts.map +1 -1
  19. package/dist/i18n/index.js +1 -1
  20. package/dist/i18n/middleware.d.ts +2 -5
  21. package/dist/i18n/middleware.d.ts.map +1 -1
  22. package/dist/i18n/middleware.js +12 -23
  23. package/dist/lib/constants.d.ts.map +1 -1
  24. package/dist/lib/image.d.ts.map +1 -1
  25. package/dist/lib/schemas.d.ts.map +1 -1
  26. package/dist/lib/sse.d.ts +45 -17
  27. package/dist/lib/sse.d.ts.map +1 -1
  28. package/dist/lib/sse.js +77 -37
  29. package/dist/middleware/auth.d.ts.map +1 -1
  30. package/dist/routes/api/posts.js +0 -1
  31. package/dist/routes/api/upload.js +3 -1
  32. package/dist/routes/dash/collections.d.ts.map +1 -1
  33. package/dist/routes/dash/collections.js +134 -142
  34. package/dist/routes/dash/index.js +25 -26
  35. package/dist/routes/dash/media.d.ts.map +1 -1
  36. package/dist/routes/dash/media.js +60 -56
  37. package/dist/routes/dash/pages.js +64 -66
  38. package/dist/routes/dash/posts.d.ts.map +1 -1
  39. package/dist/routes/dash/posts.js +50 -59
  40. package/dist/routes/dash/redirects.d.ts.map +1 -1
  41. package/dist/routes/dash/redirects.js +63 -60
  42. package/dist/routes/dash/settings.d.ts.map +1 -1
  43. package/dist/routes/dash/settings.js +249 -93
  44. package/dist/routes/feed/rss.js +6 -4
  45. package/dist/routes/pages/archive.js +60 -62
  46. package/dist/routes/pages/collection.js +8 -8
  47. package/dist/routes/pages/home.js +14 -14
  48. package/dist/routes/pages/page.js +7 -6
  49. package/dist/routes/pages/post.js +8 -8
  50. package/dist/routes/pages/search.js +25 -27
  51. package/dist/services/collection.d.ts.map +1 -1
  52. package/dist/services/index.d.ts.map +1 -1
  53. package/dist/services/media.d.ts.map +1 -1
  54. package/dist/services/post.d.ts.map +1 -1
  55. package/dist/services/redirect.d.ts.map +1 -1
  56. package/dist/services/settings.d.ts.map +1 -1
  57. package/dist/theme/components/ActionButtons.d.ts +1 -1
  58. package/dist/theme/components/ActionButtons.d.ts.map +1 -1
  59. package/dist/theme/components/ActionButtons.js +17 -21
  60. package/dist/theme/components/CrudPageHeader.d.ts.map +1 -1
  61. package/dist/theme/components/DangerZone.d.ts.map +1 -1
  62. package/dist/theme/components/DangerZone.js +12 -15
  63. package/dist/theme/components/EmptyState.d.ts.map +1 -1
  64. package/dist/theme/components/PageForm.d.ts.map +1 -1
  65. package/dist/theme/components/PageForm.js +58 -56
  66. package/dist/theme/components/Pagination.d.ts.map +1 -1
  67. package/dist/theme/components/Pagination.js +22 -25
  68. package/dist/theme/components/PostForm.d.ts +0 -1
  69. package/dist/theme/components/PostForm.d.ts.map +1 -1
  70. package/dist/theme/components/PostForm.js +85 -77
  71. package/dist/theme/components/PostList.d.ts.map +1 -1
  72. package/dist/theme/components/PostList.js +17 -17
  73. package/dist/theme/components/ThreadView.d.ts.map +1 -1
  74. package/dist/theme/components/ThreadView.js +15 -18
  75. package/dist/theme/components/TypeBadge.d.ts.map +1 -1
  76. package/dist/theme/components/TypeBadge.js +20 -20
  77. package/dist/theme/components/VisibilityBadge.d.ts.map +1 -1
  78. package/dist/theme/components/VisibilityBadge.js +14 -14
  79. package/dist/theme/components/index.d.ts +1 -1
  80. package/dist/theme/components/index.d.ts.map +1 -1
  81. package/dist/theme/layouts/BaseLayout.d.ts.map +1 -1
  82. package/dist/theme/layouts/BaseLayout.js +4 -2
  83. package/dist/theme/layouts/DashLayout.d.ts.map +1 -1
  84. package/dist/theme/layouts/DashLayout.js +29 -29
  85. package/dist/types/lingui-react-macro.d.js +9 -0
  86. package/dist/types.d.ts +2 -0
  87. package/dist/types.d.ts.map +1 -1
  88. package/dist/vendor/datastar.js +1606 -0
  89. package/package.json +5 -2
  90. package/src/app.tsx +175 -56
  91. package/src/auth.ts +5 -1
  92. package/src/client.ts +1 -1
  93. package/src/db/schema.ts +22 -7
  94. package/src/i18n/EXAMPLES.md +34 -14
  95. package/src/i18n/README.md +19 -9
  96. package/src/i18n/context.tsx +1 -4
  97. package/src/i18n/detect.ts +1 -67
  98. package/src/i18n/i18n.ts +15 -19
  99. package/src/i18n/index.ts +0 -3
  100. package/src/i18n/middleware.ts +12 -24
  101. package/src/lib/constants.ts +2 -1
  102. package/src/lib/image-processor.ts +23 -7
  103. package/src/lib/image.ts +6 -2
  104. package/src/lib/schemas.ts +6 -2
  105. package/src/lib/sse.ts +138 -50
  106. package/src/middleware/auth.ts +6 -2
  107. package/src/routes/api/posts.ts +14 -5
  108. package/src/routes/api/upload.ts +25 -7
  109. package/src/routes/dash/collections.tsx +162 -70
  110. package/src/routes/dash/index.tsx +22 -7
  111. package/src/routes/dash/media.tsx +59 -16
  112. package/src/routes/dash/pages.tsx +102 -44
  113. package/src/routes/dash/posts.tsx +87 -54
  114. package/src/routes/dash/redirects.tsx +74 -26
  115. package/src/routes/dash/settings.tsx +250 -57
  116. package/src/routes/feed/rss.ts +6 -4
  117. package/src/routes/pages/archive.tsx +71 -21
  118. package/src/routes/pages/collection.tsx +21 -6
  119. package/src/routes/pages/home.tsx +30 -9
  120. package/src/routes/pages/page.tsx +14 -5
  121. package/src/routes/pages/post.tsx +21 -7
  122. package/src/routes/pages/search.tsx +42 -11
  123. package/src/services/collection.ts +34 -9
  124. package/src/services/index.ts +4 -1
  125. package/src/services/media.ts +15 -3
  126. package/src/services/post.ts +39 -10
  127. package/src/services/redirect.ts +4 -1
  128. package/src/services/settings.ts +14 -3
  129. package/src/theme/components/ActionButtons.tsx +26 -14
  130. package/src/theme/components/CrudPageHeader.tsx +6 -1
  131. package/src/theme/components/DangerZone.tsx +19 -13
  132. package/src/theme/components/EmptyState.tsx +6 -1
  133. package/src/theme/components/PageForm.tsx +71 -24
  134. package/src/theme/components/Pagination.tsx +26 -8
  135. package/src/theme/components/PostForm.tsx +72 -25
  136. package/src/theme/components/PostList.tsx +16 -5
  137. package/src/theme/components/ThreadView.tsx +25 -7
  138. package/src/theme/components/TypeBadge.tsx +13 -4
  139. package/src/theme/components/VisibilityBadge.tsx +17 -5
  140. package/src/theme/components/index.ts +4 -1
  141. package/src/theme/layouts/BaseLayout.tsx +5 -2
  142. package/src/theme/layouts/DashLayout.tsx +41 -12
  143. package/src/types/lingui-react-macro.d.ts +34 -0
  144. package/src/types.ts +16 -2
  145. package/src/vendor/datastar.js +9 -0
  146. package/src/vendor/datastar.js.map +7 -0
@@ -2,34 +2,35 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "hono/jsx/jsx-
2
2
  /**
3
3
  * Dashboard Collections Routes
4
4
  */ import { Hono } from "hono";
5
- import { useLingui } from "../../i18n/index.js";
5
+ import { useLingui as $_useLingui } from "@jant/core/i18n";
6
6
  import { DashLayout } from "../../theme/layouts/index.js";
7
7
  import { EmptyState, ListItemRow, ActionButtons, CrudPageHeader, DangerZone } from "../../theme/components/index.js";
8
8
  import * as sqid from "../../lib/sqid.js";
9
+ import { sse } from "../../lib/sse.js";
9
10
  export const collectionsRoutes = new Hono();
10
11
  function CollectionsListContent({ collections }) {
11
- const { t } = useLingui();
12
+ const { i18n: $__i18n, _: $__ } = $_useLingui();
12
13
  return /*#__PURE__*/ _jsxs(_Fragment, {
13
14
  children: [
14
15
  /*#__PURE__*/ _jsx(CrudPageHeader, {
15
- title: t({
16
- message: "Collections",
17
- comment: "@context: Dashboard heading"
16
+ title: $__i18n._({
17
+ id: "DoJzLz",
18
+ message: "Collections"
18
19
  }),
19
- ctaLabel: t({
20
- message: "New Collection",
21
- comment: "@context: Button to create new collection"
20
+ ctaLabel: $__i18n._({
21
+ id: "vzU4k9",
22
+ message: "New Collection"
22
23
  }),
23
24
  ctaHref: "/dash/collections/new"
24
25
  }),
25
26
  collections.length === 0 ? /*#__PURE__*/ _jsx(EmptyState, {
26
- message: t({
27
- message: "No collections yet.",
28
- comment: "@context: Empty state message"
27
+ message: $__i18n._({
28
+ id: "+MACwa",
29
+ message: "No collections yet."
29
30
  }),
30
- ctaText: t({
31
- message: "New Collection",
32
- comment: "@context: Button to create new collection"
31
+ ctaText: $__i18n._({
32
+ id: "vzU4k9",
33
+ message: "New Collection"
33
34
  }),
34
35
  ctaHref: "/dash/collections/new"
35
36
  }) : /*#__PURE__*/ _jsx("div", {
@@ -37,14 +38,14 @@ function CollectionsListContent({ collections }) {
37
38
  children: collections.map((col)=>/*#__PURE__*/ _jsxs(ListItemRow, {
38
39
  actions: /*#__PURE__*/ _jsx(ActionButtons, {
39
40
  editHref: `/dash/collections/${col.id}/edit`,
40
- editLabel: t({
41
- message: "Edit",
42
- comment: "@context: Button to edit collection"
41
+ editLabel: $__i18n._({
42
+ id: "ePK91l",
43
+ message: "Edit"
43
44
  }),
44
45
  viewHref: `/c/${col.path}`,
45
- viewLabel: t({
46
- message: "View",
47
- comment: "@context: Button to view collection"
46
+ viewLabel: $__i18n._({
47
+ id: "jpctdh",
48
+ message: "View"
48
49
  })
49
50
  }),
50
51
  children: [
@@ -71,19 +72,19 @@ function CollectionsListContent({ collections }) {
71
72
  });
72
73
  }
73
74
  function NewCollectionContent() {
74
- const { t } = useLingui();
75
+ const { i18n: $__i18n, _: $__ } = $_useLingui();
75
76
  return /*#__PURE__*/ _jsxs(_Fragment, {
76
77
  children: [
77
78
  /*#__PURE__*/ _jsx("h1", {
78
79
  class: "text-2xl font-semibold mb-6",
79
- children: t({
80
- message: "New Collection",
81
- comment: "@context: Page heading"
80
+ children: $__i18n._({
81
+ id: "vzU4k9",
82
+ message: "New Collection"
82
83
  })
83
84
  }),
84
85
  /*#__PURE__*/ _jsxs("form", {
85
- method: "post",
86
- action: "/dash/collections",
86
+ "data-signals": "{title: '', path: '', description: ''}",
87
+ "data-on:submit__prevent": "@post('/dash/collections')",
87
88
  class: "flex flex-col gap-4 max-w-lg",
88
89
  children: [
89
90
  /*#__PURE__*/ _jsxs("div", {
@@ -91,19 +92,19 @@ function NewCollectionContent() {
91
92
  children: [
92
93
  /*#__PURE__*/ _jsx("label", {
93
94
  class: "label",
94
- children: t({
95
- message: "Title",
96
- comment: "@context: Collection form field"
95
+ children: $__i18n._({
96
+ id: "MHrjPM",
97
+ message: "Title"
97
98
  })
98
99
  }),
99
100
  /*#__PURE__*/ _jsx("input", {
100
101
  type: "text",
101
- name: "title",
102
+ "data-bind": "title",
102
103
  class: "input",
103
104
  required: true,
104
- placeholder: t({
105
- message: "My Collection",
106
- comment: "@context: Collection title placeholder"
105
+ placeholder: $__i18n._({
106
+ id: "fttd2R",
107
+ message: "My Collection"
107
108
  })
108
109
  })
109
110
  ]
@@ -113,14 +114,14 @@ function NewCollectionContent() {
113
114
  children: [
114
115
  /*#__PURE__*/ _jsx("label", {
115
116
  class: "label",
116
- children: t({
117
- message: "Slug",
118
- comment: "@context: Collection form field"
117
+ children: $__i18n._({
118
+ id: "L85WcV",
119
+ message: "Slug"
119
120
  })
120
121
  }),
121
122
  /*#__PURE__*/ _jsx("input", {
122
123
  type: "text",
123
- name: "path",
124
+ "data-bind": "path",
124
125
  class: "input",
125
126
  required: true,
126
127
  placeholder: "my-collection",
@@ -128,9 +129,9 @@ function NewCollectionContent() {
128
129
  }),
129
130
  /*#__PURE__*/ _jsx("p", {
130
131
  class: "text-xs text-muted-foreground mt-1",
131
- children: t({
132
- message: "URL-safe identifier (lowercase, numbers, hyphens)",
133
- comment: "@context: Collection path help text"
132
+ children: $__i18n._({
133
+ id: "1CU1Td",
134
+ message: "URL-safe identifier (lowercase, numbers, hyphens)"
134
135
  })
135
136
  })
136
137
  ]
@@ -140,18 +141,18 @@ function NewCollectionContent() {
140
141
  children: [
141
142
  /*#__PURE__*/ _jsx("label", {
142
143
  class: "label",
143
- children: t({
144
- message: "Description (optional)",
145
- comment: "@context: Collection form field"
144
+ children: $__i18n._({
145
+ id: "Fxf4jq",
146
+ message: "Description (optional)"
146
147
  })
147
148
  }),
148
149
  /*#__PURE__*/ _jsx("textarea", {
149
- name: "description",
150
+ "data-bind": "description",
150
151
  class: "textarea",
151
152
  rows: 3,
152
- placeholder: t({
153
- message: "What's this collection about?",
154
- comment: "@context: Collection description placeholder"
153
+ placeholder: $__i18n._({
154
+ id: "AyHO4m",
155
+ message: "What's this collection about?"
155
156
  })
156
157
  })
157
158
  ]
@@ -162,17 +163,17 @@ function NewCollectionContent() {
162
163
  /*#__PURE__*/ _jsx("button", {
163
164
  type: "submit",
164
165
  class: "btn",
165
- children: t({
166
- message: "Create Collection",
167
- comment: "@context: Button to save new collection"
166
+ children: $__i18n._({
167
+ id: "Pbm2/N",
168
+ message: "Create Collection"
168
169
  })
169
170
  }),
170
171
  /*#__PURE__*/ _jsx("a", {
171
172
  href: "/dash/collections",
172
173
  class: "btn-outline",
173
- children: t({
174
- message: "Cancel",
175
- comment: "@context: Button to cancel form"
174
+ children: $__i18n._({
175
+ id: "dEgA5A",
176
+ message: "Cancel"
176
177
  })
177
178
  })
178
179
  ]
@@ -183,13 +184,10 @@ function NewCollectionContent() {
183
184
  });
184
185
  }
185
186
  function ViewCollectionContent({ collection, posts }) {
186
- const { t } = useLingui();
187
- const postsHeader = t({
188
- message: "Posts in Collection ({count})",
189
- comment: "@context: Collection posts section heading",
190
- values: {
191
- count: String(posts.length)
192
- }
187
+ const { i18n: $__i18n, _: $__ } = $_useLingui();
188
+ const postsHeader = $__i18n._({
189
+ id: "pRhYH2",
190
+ message: "Posts in Collection ({count})"
193
191
  });
194
192
  return /*#__PURE__*/ _jsxs(_Fragment, {
195
193
  children: [
@@ -213,14 +211,14 @@ function ViewCollectionContent({ collection, posts }) {
213
211
  }),
214
212
  /*#__PURE__*/ _jsx(ActionButtons, {
215
213
  editHref: `/dash/collections/${collection.id}/edit`,
216
- editLabel: t({
217
- message: "Edit",
218
- comment: "@context: Button to edit collection"
214
+ editLabel: $__i18n._({
215
+ id: "ePK91l",
216
+ message: "Edit"
219
217
  }),
220
218
  viewHref: `/c/${collection.path}`,
221
- viewLabel: t({
222
- message: "View",
223
- comment: "@context: Button to view collection"
219
+ viewLabel: $__i18n._({
220
+ id: "jpctdh",
221
+ message: "View"
224
222
  })
225
223
  })
226
224
  ]
@@ -240,9 +238,9 @@ function ViewCollectionContent({ collection, posts }) {
240
238
  /*#__PURE__*/ _jsx("section", {
241
239
  children: posts.length === 0 ? /*#__PURE__*/ _jsx("p", {
242
240
  class: "text-muted-foreground",
243
- children: t({
244
- message: "No posts in this collection.",
245
- comment: "@context: Empty state message"
241
+ children: $__i18n._({
242
+ id: "J4FNfC",
243
+ message: "No posts in this collection."
246
244
  })
247
245
  }) : /*#__PURE__*/ _jsx("div", {
248
246
  class: "flex flex-col divide-y",
@@ -257,24 +255,14 @@ function ViewCollectionContent({ collection, posts }) {
257
255
  children: post.title || post.content?.slice(0, 50) || `Post #${post.id}`
258
256
  })
259
257
  }),
260
- /*#__PURE__*/ _jsxs("form", {
261
- method: "post",
262
- action: `/dash/collections/${collection.id}/remove-post`,
263
- children: [
264
- /*#__PURE__*/ _jsx("input", {
265
- type: "hidden",
266
- name: "postId",
267
- value: post.id
268
- }),
269
- /*#__PURE__*/ _jsx("button", {
270
- type: "submit",
271
- class: "btn-sm-ghost text-destructive",
272
- children: t({
273
- message: "Remove",
274
- comment: "@context: Button to remove post from collection"
275
- })
276
- })
277
- ]
258
+ /*#__PURE__*/ _jsx("button", {
259
+ type: "button",
260
+ class: "btn-sm-ghost text-destructive",
261
+ "data-on:click__prevent": `@post('/dash/collections/${collection.id}/remove-post', {payload: {postId: ${post.id}}})`,
262
+ children: $__i18n._({
263
+ id: "t/YqKh",
264
+ message: "Remove"
265
+ })
278
266
  })
279
267
  ]
280
268
  }, post.id))
@@ -287,9 +275,9 @@ function ViewCollectionContent({ collection, posts }) {
287
275
  children: /*#__PURE__*/ _jsx("a", {
288
276
  href: "/dash/collections",
289
277
  class: "text-sm hover:underline",
290
- children: t({
291
- message: "← Back to Collections",
292
- comment: "@context: Navigation link"
278
+ children: $__i18n._({
279
+ id: "e6Jr7Q",
280
+ message: " Back to Collections"
293
281
  })
294
282
  })
295
283
  })
@@ -297,19 +285,24 @@ function ViewCollectionContent({ collection, posts }) {
297
285
  });
298
286
  }
299
287
  function EditCollectionContent({ collection }) {
300
- const { t } = useLingui();
288
+ const { i18n: $__i18n, _: $__ } = $_useLingui();
289
+ const signals = JSON.stringify({
290
+ title: collection.title,
291
+ path: collection.path ?? "",
292
+ description: collection.description ?? ""
293
+ }).replace(/</g, "\\u003c");
301
294
  return /*#__PURE__*/ _jsxs(_Fragment, {
302
295
  children: [
303
296
  /*#__PURE__*/ _jsx("h1", {
304
297
  class: "text-2xl font-semibold mb-6",
305
- children: t({
306
- message: "Edit Collection",
307
- comment: "@context: Page heading"
298
+ children: $__i18n._({
299
+ id: "/0D1Xp",
300
+ message: "Edit Collection"
308
301
  })
309
302
  }),
310
303
  /*#__PURE__*/ _jsxs("form", {
311
- method: "post",
312
- action: `/dash/collections/${collection.id}`,
304
+ "data-signals": signals,
305
+ "data-on:submit__prevent": `@post('/dash/collections/${collection.id}')`,
313
306
  class: "flex flex-col gap-4 max-w-lg",
314
307
  children: [
315
308
  /*#__PURE__*/ _jsxs("div", {
@@ -317,17 +310,16 @@ function EditCollectionContent({ collection }) {
317
310
  children: [
318
311
  /*#__PURE__*/ _jsx("label", {
319
312
  class: "label",
320
- children: t({
321
- message: "Title",
322
- comment: "@context: Collection form field"
313
+ children: $__i18n._({
314
+ id: "MHrjPM",
315
+ message: "Title"
323
316
  })
324
317
  }),
325
318
  /*#__PURE__*/ _jsx("input", {
326
319
  type: "text",
327
- name: "title",
320
+ "data-bind": "title",
328
321
  class: "input",
329
- required: true,
330
- value: collection.title
322
+ required: true
331
323
  })
332
324
  ]
333
325
  }),
@@ -336,17 +328,16 @@ function EditCollectionContent({ collection }) {
336
328
  children: [
337
329
  /*#__PURE__*/ _jsx("label", {
338
330
  class: "label",
339
- children: t({
340
- message: "Slug",
341
- comment: "@context: Collection form field"
331
+ children: $__i18n._({
332
+ id: "L85WcV",
333
+ message: "Slug"
342
334
  })
343
335
  }),
344
336
  /*#__PURE__*/ _jsx("input", {
345
337
  type: "text",
346
- name: "path",
338
+ "data-bind": "path",
347
339
  class: "input",
348
340
  required: true,
349
- value: collection.path ?? "",
350
341
  pattern: "[a-z0-9-]+"
351
342
  })
352
343
  ]
@@ -356,13 +347,13 @@ function EditCollectionContent({ collection }) {
356
347
  children: [
357
348
  /*#__PURE__*/ _jsx("label", {
358
349
  class: "label",
359
- children: t({
360
- message: "Description (optional)",
361
- comment: "@context: Collection form field"
350
+ children: $__i18n._({
351
+ id: "Fxf4jq",
352
+ message: "Description (optional)"
362
353
  })
363
354
  }),
364
355
  /*#__PURE__*/ _jsx("textarea", {
365
- name: "description",
356
+ "data-bind": "description",
366
357
  class: "textarea",
367
358
  rows: 3,
368
359
  children: collection.description ?? ""
@@ -375,17 +366,17 @@ function EditCollectionContent({ collection }) {
375
366
  /*#__PURE__*/ _jsx("button", {
376
367
  type: "submit",
377
368
  class: "btn",
378
- children: t({
379
- message: "Update Collection",
380
- comment: "@context: Button to save collection changes"
369
+ children: $__i18n._({
370
+ id: "7Mk+/h",
371
+ message: "Update Collection"
381
372
  })
382
373
  }),
383
374
  /*#__PURE__*/ _jsx("a", {
384
375
  href: `/dash/collections/${collection.id}`,
385
376
  class: "btn-outline",
386
- children: t({
387
- message: "Cancel",
388
- comment: "@context: Button to cancel form"
377
+ children: $__i18n._({
378
+ id: "dEgA5A",
379
+ message: "Cancel"
389
380
  })
390
381
  })
391
382
  ]
@@ -393,9 +384,9 @@ function EditCollectionContent({ collection }) {
393
384
  ]
394
385
  }),
395
386
  /*#__PURE__*/ _jsx(DangerZone, {
396
- actionLabel: t({
397
- message: "Delete Collection",
398
- comment: "@context: Button to delete collection"
387
+ actionLabel: $__i18n._({
388
+ id: "GA5A5H",
389
+ message: "Delete Collection"
399
390
  }),
400
391
  formAction: `/dash/collections/${collection.id}/delete`,
401
392
  confirmMessage: "Are you sure you want to delete this collection?"
@@ -430,16 +421,15 @@ collectionsRoutes.get("/new", async (c)=>{
430
421
  });
431
422
  // Create collection
432
423
  collectionsRoutes.post("/", async (c)=>{
433
- const formData = await c.req.formData();
434
- const title = formData.get("title");
435
- const path = formData.get("path");
436
- const description = formData.get("description");
424
+ const body = await c.req.json();
437
425
  const collection = await c.var.services.collections.create({
438
- title,
439
- path,
440
- description: description || undefined
426
+ title: body.title,
427
+ path: body.path,
428
+ description: body.description || undefined
429
+ });
430
+ return sse(c, async (stream)=>{
431
+ await stream.redirect(`/dash/collections/${collection.id}`);
441
432
  });
442
- return c.redirect(`/dash/collections/${collection.id}`);
443
433
  });
444
434
  // View single collection
445
435
  collectionsRoutes.get("/:id", async (c)=>{
@@ -481,32 +471,34 @@ collectionsRoutes.get("/:id/edit", async (c)=>{
481
471
  collectionsRoutes.post("/:id", async (c)=>{
482
472
  const id = parseInt(c.req.param("id"), 10);
483
473
  if (isNaN(id)) return c.notFound();
484
- const formData = await c.req.formData();
485
- const title = formData.get("title");
486
- const path = formData.get("path");
487
- const description = formData.get("description");
474
+ const body = await c.req.json();
488
475
  await c.var.services.collections.update(id, {
489
- title,
490
- path,
491
- description: description || undefined
476
+ title: body.title,
477
+ path: body.path,
478
+ description: body.description || undefined
479
+ });
480
+ return sse(c, async (stream)=>{
481
+ await stream.redirect(`/dash/collections/${id}`);
492
482
  });
493
- return c.redirect(`/dash/collections/${id}`);
494
483
  });
495
484
  // Delete collection
496
485
  collectionsRoutes.post("/:id/delete", async (c)=>{
497
486
  const id = parseInt(c.req.param("id"), 10);
498
487
  if (isNaN(id)) return c.notFound();
499
488
  await c.var.services.collections.delete(id);
500
- return c.redirect("/dash/collections");
489
+ return sse(c, async (stream)=>{
490
+ await stream.redirect("/dash/collections");
491
+ });
501
492
  });
502
493
  // Remove post from collection
503
494
  collectionsRoutes.post("/:id/remove-post", async (c)=>{
504
495
  const id = parseInt(c.req.param("id"), 10);
505
496
  if (isNaN(id)) return c.notFound();
506
- const formData = await c.req.formData();
507
- const postId = parseInt(formData.get("postId"), 10);
508
- if (!isNaN(postId)) {
509
- await c.var.services.collections.removePost(id, postId);
497
+ const body = await c.req.json();
498
+ if (body.postId) {
499
+ await c.var.services.collections.removePost(id, body.postId);
510
500
  }
511
- return c.redirect(`/dash/collections/${id}`);
501
+ return sse(c, async (stream)=>{
502
+ await stream.redirect(`/dash/collections/${id}`);
503
+ });
512
504
  });
@@ -4,7 +4,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "hono/jsx/jsx-runtime";
4
4
  *
5
5
  * Example of using @lingui/react/macro with Hono JSX!
6
6
  */ import { Hono } from "hono";
7
- import { Trans, useLingui } from "../../i18n/index.js";
7
+ import { useLingui as $_useLingui } from "@jant/core/i18n";
8
+ import { Trans as Trans_ } from "@jant/core/i18n";
8
9
  import { DashLayout } from "../../theme/layouts/index.js";
9
10
  export const dashIndexRoutes = new Hono();
10
11
  /**
@@ -12,15 +13,15 @@ export const dashIndexRoutes = new Hono();
12
13
  * Uses useLingui() from @lingui/react/macro - works with Hono JSX!
13
14
  */ function DashboardContent({ publishedCount, draftCount }) {
14
15
  // 🎉 Single layer! Just like React!
15
- const { t } = useLingui();
16
+ const { i18n: $__i18n, _: $__ } = $_useLingui();
16
17
  return /*#__PURE__*/ _jsxs("div", {
17
18
  class: "container py-8",
18
19
  children: [
19
20
  /*#__PURE__*/ _jsx("h1", {
20
21
  class: "text-2xl font-semibold mb-6",
21
- children: t({
22
- message: "Dashboard",
23
- comment: "@context: Dashboard main heading"
22
+ children: $__i18n._({
23
+ id: "7p5kLi",
24
+ message: "Dashboard"
24
25
  })
25
26
  }),
26
27
  /*#__PURE__*/ _jsxs("div", {
@@ -31,9 +32,9 @@ export const dashIndexRoutes = new Hono();
31
32
  children: [
32
33
  /*#__PURE__*/ _jsx("p", {
33
34
  class: "text-sm text-muted-foreground",
34
- children: t({
35
- message: "Published",
36
- comment: "@context: Post status label"
35
+ children: $__i18n._({
36
+ id: "u3wRF+",
37
+ message: "Published"
37
38
  })
38
39
  }),
39
40
  /*#__PURE__*/ _jsx("p", {
@@ -47,9 +48,9 @@ export const dashIndexRoutes = new Hono();
47
48
  children: [
48
49
  /*#__PURE__*/ _jsx("p", {
49
50
  class: "text-sm text-muted-foreground",
50
- children: t({
51
- message: "Drafts",
52
- comment: "@context: Post status label"
51
+ children: $__i18n._({
52
+ id: "M8kJqa",
53
+ message: "Drafts"
53
54
  })
54
55
  }),
55
56
  /*#__PURE__*/ _jsx("p", {
@@ -63,17 +64,17 @@ export const dashIndexRoutes = new Hono();
63
64
  children: [
64
65
  /*#__PURE__*/ _jsx("p", {
65
66
  class: "text-sm text-muted-foreground mb-2",
66
- children: t({
67
- message: "Quick Actions",
68
- comment: "@context: Dashboard section title"
67
+ children: $__i18n._({
68
+ id: "UDMjsP",
69
+ message: "Quick Actions"
69
70
  })
70
71
  }),
71
72
  /*#__PURE__*/ _jsx("a", {
72
73
  href: "/dash/posts/new",
73
74
  class: "btn btn-primary w-full",
74
- children: t({
75
- message: "New Post",
76
- comment: "@context: Button to create new post"
75
+ children: $__i18n._({
76
+ id: "FGrimz",
77
+ message: "New Post"
77
78
  })
78
79
  })
79
80
  ]
@@ -81,17 +82,15 @@ export const dashIndexRoutes = new Hono();
81
82
  ]
82
83
  }),
83
84
  /*#__PURE__*/ _jsx("p", {
84
- children: /*#__PURE__*/ _jsxs(Trans, {
85
- comment: "@context: Help text with link",
86
- children: [
87
- "Need help? Visit the",
88
- " ",
89
- /*#__PURE__*/ _jsx("a", {
85
+ children: /*#__PURE__*/ _jsx(Trans_, {
86
+ message: "Need help? Visit the <0>documentation</0>",
87
+ id: "Jed1wB",
88
+ components: {
89
+ 0: /*#__PURE__*/ _jsx("a", {
90
90
  href: "/docs",
91
- class: "underline",
92
- children: "documentation"
91
+ class: "underline"
93
92
  })
94
- ]
93
+ }
95
94
  })
96
95
  })
97
96
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/routes/dash/media.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAS,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAMjD,KAAK,GAAG,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,YAAY,CAAA;CAAE,CAAC;AAE3D,eAAO,MAAM,WAAW,kDAAkB,CAAC"}
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/routes/dash/media.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,QAAQ,EAAS,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAOjD,KAAK,GAAG,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,YAAY,CAAA;CAAE,CAAC;AAE3D,eAAO,MAAM,WAAW,kDAAkB,CAAC"}