@jant/core 0.3.20 → 0.3.22
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 +60 -17
- package/dist/index.js +8 -0
- package/dist/lib/feed.js +112 -0
- package/dist/lib/navigation.js +9 -9
- package/dist/lib/render.js +48 -0
- package/dist/lib/theme-components.js +18 -18
- package/dist/lib/view.js +228 -0
- package/dist/routes/api/timeline.js +20 -16
- package/dist/routes/dash/collections.js +38 -10
- package/dist/routes/dash/navigation.js +22 -8
- package/dist/routes/dash/redirects.js +19 -5
- package/dist/routes/dash/settings.js +57 -15
- package/dist/routes/feed/rss.js +34 -78
- package/dist/routes/feed/sitemap.js +11 -26
- package/dist/routes/pages/archive.js +18 -195
- package/dist/routes/pages/collection.js +16 -70
- package/dist/routes/pages/home.js +25 -47
- package/dist/routes/pages/page.js +15 -27
- package/dist/routes/pages/post.js +25 -79
- package/dist/routes/pages/search.js +20 -130
- package/dist/theme/components/MediaGallery.js +10 -10
- package/dist/theme/components/PageForm.js +22 -8
- package/dist/theme/components/PostForm.js +22 -8
- package/dist/theme/components/index.js +1 -1
- package/dist/theme/components/timeline/ArticleCard.js +7 -11
- package/dist/theme/components/timeline/ImageCard.js +10 -13
- package/dist/theme/components/timeline/LinkCard.js +4 -7
- package/dist/theme/components/timeline/NoteCard.js +5 -8
- package/dist/theme/components/timeline/QuoteCard.js +3 -6
- package/dist/theme/components/timeline/ThreadPreview.js +9 -10
- package/dist/theme/components/timeline/TimelineFeed.js +8 -5
- package/dist/theme/components/timeline/TimelineItem.js +22 -2
- package/dist/theme/components/timeline/index.js +1 -1
- package/dist/theme/index.js +6 -3
- package/dist/theme/layouts/SiteLayout.js +10 -39
- package/dist/theme/pages/ArchivePage.js +157 -0
- package/dist/theme/pages/CollectionPage.js +63 -0
- package/dist/theme/pages/HomePage.js +26 -0
- package/dist/theme/pages/PostPage.js +48 -0
- package/dist/theme/pages/SearchPage.js +120 -0
- package/dist/theme/pages/SinglePage.js +23 -0
- package/dist/theme/pages/index.js +11 -0
- package/package.json +2 -1
- package/src/app.tsx +48 -17
- package/src/i18n/locales/en.po +171 -147
- package/src/i18n/locales/zh-Hans.po +171 -147
- package/src/i18n/locales/zh-Hant.po +171 -147
- package/src/index.ts +51 -2
- package/src/lib/__tests__/theme-components.test.ts +33 -14
- package/src/lib/__tests__/view.test.ts +375 -0
- package/src/lib/feed.ts +148 -0
- package/src/lib/navigation.ts +11 -11
- package/src/lib/render.tsx +67 -0
- package/src/lib/theme-components.ts +27 -35
- package/src/lib/view.ts +318 -0
- package/src/routes/api/__tests__/timeline.test.ts +3 -3
- package/src/routes/api/timeline.tsx +32 -25
- package/src/routes/dash/collections.tsx +30 -10
- package/src/routes/dash/navigation.tsx +20 -10
- package/src/routes/dash/redirects.tsx +15 -5
- package/src/routes/dash/settings.tsx +53 -15
- package/src/routes/feed/rss.ts +47 -94
- package/src/routes/feed/sitemap.ts +8 -30
- package/src/routes/pages/archive.tsx +24 -209
- package/src/routes/pages/collection.tsx +19 -75
- package/src/routes/pages/home.tsx +42 -76
- package/src/routes/pages/page.tsx +17 -28
- package/src/routes/pages/post.tsx +28 -86
- package/src/routes/pages/search.tsx +29 -151
- package/src/services/search.ts +2 -8
- package/src/theme/components/MediaGallery.tsx +12 -12
- package/src/theme/components/PageForm.tsx +20 -10
- package/src/theme/components/PostForm.tsx +20 -10
- package/src/theme/components/index.ts +1 -0
- package/src/theme/components/timeline/ArticleCard.tsx +7 -19
- package/src/theme/components/timeline/ImageCard.tsx +10 -20
- package/src/theme/components/timeline/LinkCard.tsx +4 -11
- package/src/theme/components/timeline/NoteCard.tsx +5 -12
- package/src/theme/components/timeline/QuoteCard.tsx +3 -10
- package/src/theme/components/timeline/ThreadPreview.tsx +5 -5
- package/src/theme/components/timeline/TimelineFeed.tsx +7 -3
- package/src/theme/components/timeline/TimelineItem.tsx +43 -4
- package/src/theme/components/timeline/index.ts +1 -1
- package/src/theme/index.ts +7 -3
- package/src/theme/layouts/SiteLayout.tsx +25 -77
- package/src/theme/layouts/index.ts +2 -1
- package/src/theme/pages/ArchivePage.tsx +160 -0
- package/src/theme/pages/CollectionPage.tsx +60 -0
- package/src/theme/pages/HomePage.tsx +42 -0
- package/src/theme/pages/PostPage.tsx +44 -0
- package/src/theme/pages/SearchPage.tsx +128 -0
- package/src/theme/pages/SinglePage.tsx +24 -0
- package/src/theme/pages/index.ts +13 -0
- package/src/types.ts +262 -38
package/src/app.tsx
CHANGED
|
@@ -77,7 +77,7 @@ export type App = Hono<{ Bindings: Bindings; Variables: AppVariables }>;
|
|
|
77
77
|
* import { createApp } from "@jant/core";
|
|
78
78
|
*
|
|
79
79
|
* export default createApp({
|
|
80
|
-
* theme: { components: {
|
|
80
|
+
* theme: { components: { PostPage: MyPostPage } },
|
|
81
81
|
* });
|
|
82
82
|
* ```
|
|
83
83
|
*/
|
|
@@ -100,9 +100,10 @@ export function createApp(config: JantConfig = {}): App {
|
|
|
100
100
|
c.set("storage", createStorageDriver(c.env));
|
|
101
101
|
|
|
102
102
|
if (c.env.AUTH_SECRET) {
|
|
103
|
+
const baseURL = c.env.SITE_URL || new URL(c.req.url).origin;
|
|
103
104
|
const auth = createAuth(session as unknown as D1Database, {
|
|
104
105
|
secret: c.env.AUTH_SECRET,
|
|
105
|
-
baseURL
|
|
106
|
+
baseURL,
|
|
106
107
|
});
|
|
107
108
|
c.set("auth", auth);
|
|
108
109
|
}
|
|
@@ -200,6 +201,7 @@ export function createApp(config: JantConfig = {}): App {
|
|
|
200
201
|
<form
|
|
201
202
|
data-signals="{name: '', email: '', password: ''}"
|
|
202
203
|
data-on:submit__prevent="@post('/setup')"
|
|
204
|
+
data-indicator="_loading"
|
|
203
205
|
class="flex flex-col gap-4"
|
|
204
206
|
>
|
|
205
207
|
<div class="field">
|
|
@@ -247,11 +249,20 @@ export function createApp(config: JantConfig = {}): App {
|
|
|
247
249
|
minLength={8}
|
|
248
250
|
/>
|
|
249
251
|
</div>
|
|
250
|
-
<button type="submit" class="btn">
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
<button type="submit" class="btn" data-attr-disabled="$_loading">
|
|
253
|
+
<span data-show="!$_loading">
|
|
254
|
+
{t({
|
|
255
|
+
message: "Complete Setup",
|
|
256
|
+
comment: "@context: Setup form submit button",
|
|
257
|
+
})}
|
|
258
|
+
</span>
|
|
259
|
+
<span data-show="$_loading">
|
|
260
|
+
{t({
|
|
261
|
+
message: "Processing...",
|
|
262
|
+
comment:
|
|
263
|
+
"@context: Loading text shown on submit button while request is in progress",
|
|
264
|
+
})}
|
|
265
|
+
</span>
|
|
255
266
|
</button>
|
|
256
267
|
</form>
|
|
257
268
|
</section>
|
|
@@ -349,6 +360,7 @@ export function createApp(config: JantConfig = {}): App {
|
|
|
349
360
|
<form
|
|
350
361
|
data-signals={signals}
|
|
351
362
|
data-on:submit__prevent="@post('/signin')"
|
|
363
|
+
data-indicator="_loading"
|
|
352
364
|
class="flex flex-col gap-4"
|
|
353
365
|
>
|
|
354
366
|
<div class="field">
|
|
@@ -374,11 +386,20 @@ export function createApp(config: JantConfig = {}): App {
|
|
|
374
386
|
required
|
|
375
387
|
/>
|
|
376
388
|
</div>
|
|
377
|
-
<button type="submit" class="btn">
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
389
|
+
<button type="submit" class="btn" data-attr-disabled="$_loading">
|
|
390
|
+
<span data-show="!$_loading">
|
|
391
|
+
{t({
|
|
392
|
+
message: "Sign In",
|
|
393
|
+
comment: "@context: Sign in form submit button",
|
|
394
|
+
})}
|
|
395
|
+
</span>
|
|
396
|
+
<span data-show="$_loading">
|
|
397
|
+
{t({
|
|
398
|
+
message: "Processing...",
|
|
399
|
+
comment:
|
|
400
|
+
"@context: Loading text shown on submit button while request is in progress",
|
|
401
|
+
})}
|
|
402
|
+
</span>
|
|
382
403
|
</button>
|
|
383
404
|
</form>
|
|
384
405
|
</section>
|
|
@@ -470,6 +491,7 @@ export function createApp(config: JantConfig = {}): App {
|
|
|
470
491
|
<form
|
|
471
492
|
data-signals={signals}
|
|
472
493
|
data-on:submit__prevent="@post('/reset')"
|
|
494
|
+
data-indicator="_loading"
|
|
473
495
|
class="flex flex-col gap-4"
|
|
474
496
|
>
|
|
475
497
|
<div class="field">
|
|
@@ -504,11 +526,20 @@ export function createApp(config: JantConfig = {}): App {
|
|
|
504
526
|
autocomplete="new-password"
|
|
505
527
|
/>
|
|
506
528
|
</div>
|
|
507
|
-
<button type="submit" class="btn">
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
529
|
+
<button type="submit" class="btn" data-attr-disabled="$_loading">
|
|
530
|
+
<span data-show="!$_loading">
|
|
531
|
+
{t({
|
|
532
|
+
message: "Reset Password",
|
|
533
|
+
comment: "@context: Password reset form submit button",
|
|
534
|
+
})}
|
|
535
|
+
</span>
|
|
536
|
+
<span data-show="$_loading">
|
|
537
|
+
{t({
|
|
538
|
+
message: "Processing...",
|
|
539
|
+
comment:
|
|
540
|
+
"@context: Loading text shown on submit button while request is in progress",
|
|
541
|
+
})}
|
|
542
|
+
</span>
|
|
512
543
|
</button>
|
|
513
544
|
</form>
|
|
514
545
|
</section>
|