@jant/core 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/lib/site-snapshot.js +10 -0
- package/dist/{app-Gt7_skt6.js → app-CbOZ2Irh.js} +8704 -5180
- package/dist/client/.vite/manifest.json +125 -85
- package/dist/client/_assets/chunks/{confirm-D7GrwsCN.js → confirm-CMe01lne.js} +1 -1
- package/dist/client/_assets/chunks/{create-editor-5Y49x7h5.js → create-editor-hWapNE40.js} +26 -26
- package/dist/client/_assets/chunks/footnote-rail-9zwl6jtV.js +2 -0
- package/dist/client/_assets/chunks/{jant-locale-picker-DL6mIOT5.js → jant-locale-picker-2L4rkDaz.js} +1 -1
- package/dist/client/_assets/chunks/lit-Bw_voPoW.js +2 -0
- package/dist/client/_assets/chunks/preload-helper-Czpn1I53.js +1 -0
- package/dist/client/_assets/chunks/runtime-paths-y0_gHowM.js +1 -0
- package/dist/client/_assets/chunks/{settings-paths-h6RjIe3C.js → settings-paths-BBVT8zKj.js} +1 -1
- package/dist/client/_assets/chunks/slug-format-BuCPjSrB.js +1 -0
- package/dist/client/_assets/chunks/sortable-list-DJXwkaOv.js +2 -0
- package/dist/client/_assets/chunks/types-DrYFqJH2.js +1 -0
- package/dist/client/_assets/chunks/{unsafe-html-B5ZEXaxg.js → unsafe-html-CWos3v6N.js} +1 -1
- package/dist/client/_assets/chunks/unsafe-svg-CUrgo4Xg.js +1 -0
- package/dist/client/_assets/client-BO8GOFfT.js +354 -0
- package/dist/client/_assets/client-D8Rrsd73.css +2 -0
- package/dist/client/_assets/client-auth-CsUGM718.js +859 -0
- package/dist/client/_assets/client-author-QPm1whbO.css +2 -0
- package/dist/client/_assets/client-compose-BB4U7Wz0.js +2004 -0
- package/dist/client/_assets/{client-manage-C1eDB1Rc.js → client-manage-CI9-eh-8.js} +176 -176
- package/dist/client/_assets/{client-settings-DIM44Zqh.js → client-settings-BnGPuqwc.js} +166 -166
- package/dist/client/_assets/client-share-0DICJjAc.css +1 -0
- package/dist/client/_assets/client-share-C59mOLJ1.js +149 -0
- package/dist/index.js +1 -1
- package/dist/node.js +3 -2
- package/package.json +2 -1
- package/src/app.tsx +9 -0
- package/src/client/components/compose-types.ts +1 -0
- package/src/client/components/jant-compose-dialog.ts +1 -0
- package/src/client/components/jant-compose-editor.ts +30 -0
- package/src/client/components/jant-compose-fullscreen.ts +1 -0
- package/src/client/components/jant-post-menu.ts +80 -13
- package/src/client/components/jant-share-dialog.ts +422 -0
- package/src/client/components/jant-share-menu.ts +188 -0
- package/src/client/compose-bridge.ts +61 -1
- package/src/client/feed-video-player.ts +6 -0
- package/src/client/lazy-entries.ts +21 -1
- package/src/client/post-menu-shared.ts +100 -0
- package/src/client/share-capture.ts +443 -0
- package/src/client/share-launch.ts +133 -0
- package/src/client/tiptap/bubble-menu.ts +25 -2
- package/src/client/tiptap/create-editor.ts +2 -0
- package/src/client/tiptap/extensions.ts +4 -0
- package/src/client/video-processor.ts +106 -52
- package/src/client/view-confirm.ts +108 -0
- package/src/client-share.ts +8 -0
- package/src/client.ts +2 -0
- package/src/db/migrations/0035_brainy_next_avengers.sql +9 -0
- package/src/db/migrations/0036_gorgeous_smasher.sql +7 -0
- package/src/db/migrations/meta/0035_snapshot.json +2877 -0
- package/src/db/migrations/meta/0036_snapshot.json +2924 -0
- package/src/db/migrations/meta/_journal.json +14 -0
- package/src/db/migrations/pg/0033_cute_magdalene.sql +10 -0
- package/src/db/migrations/pg/0034_material_agent_brand.sql +8 -0
- package/src/db/migrations/pg/meta/0033_snapshot.json +3719 -0
- package/src/db/migrations/pg/meta/0034_snapshot.json +3766 -0
- package/src/db/migrations/pg/meta/_journal.json +14 -0
- package/src/db/pg/schema.ts +40 -0
- package/src/db/schema.ts +61 -0
- package/src/i18n/locales/public/en.po +5 -0
- package/src/i18n/locales/public/en.ts +1 -1
- package/src/i18n/locales/public/zh-Hans.po +5 -0
- package/src/i18n/locales/public/zh-Hans.ts +1 -1
- package/src/i18n/locales/public/zh-Hant.po +5 -0
- package/src/i18n/locales/public/zh-Hant.ts +1 -1
- package/src/i18n/locales/settings/en.po +149 -0
- package/src/i18n/locales/settings/en.ts +1 -1
- package/src/i18n/locales/settings/zh-Hans.po +149 -0
- package/src/i18n/locales/settings/zh-Hans.ts +1 -1
- package/src/i18n/locales/settings/zh-Hant.po +149 -0
- package/src/i18n/locales/settings/zh-Hant.ts +1 -1
- package/src/lib/discover.ts +31 -0
- package/src/lib/env.ts +20 -0
- package/src/lib/github-app-state.ts +1 -1
- package/src/lib/github-app.ts +183 -1
- package/src/lib/markdown-manager.ts +129 -1
- package/src/lib/post-meta.ts +13 -3
- package/src/lib/referrer-aliases.ts +311 -0
- package/src/lib/render.tsx +10 -0
- package/src/lib/resolve-config.ts +14 -0
- package/src/lib/share-card.ts +653 -0
- package/src/lib/summary.ts +152 -54
- package/src/lib/tiptap-render.ts +1 -0
- package/src/lib/upload.ts +21 -1
- package/src/lib/version.ts +2 -0
- package/src/lib/video-playback.ts +55 -0
- package/src/lib/view-buffer.ts +201 -0
- package/src/lib/view-counting.ts +539 -0
- package/src/lib/view-token.ts +177 -0
- package/src/lib/view.ts +13 -1
- package/src/middleware/view-counter.ts +140 -0
- package/src/node/runtime.ts +4 -0
- package/src/preset.css +31 -14
- package/src/routes/api/media.ts +21 -3
- package/src/routes/auth/setup.tsx +37 -1
- package/src/routes/dash/settings.tsx +433 -168
- package/src/routes/pages/archive.tsx +1 -0
- package/src/routes/pages/collection.tsx +6 -0
- package/src/routes/pages/collections.tsx +1 -0
- package/src/routes/pages/featured.tsx +1 -0
- package/src/routes/pages/home.tsx +1 -0
- package/src/routes/pages/page.tsx +3 -0
- package/src/routes/pages/partials.tsx +23 -0
- package/src/routes/pages/smart-collection.tsx +2 -0
- package/src/routes/pages/subscribe.tsx +1 -0
- package/src/routes/view-confirm.ts +63 -0
- package/src/services/export-theme/assets/client-site.js +1 -1
- package/src/services/export-theme/styles/main.css +39 -21
- package/src/services/export.ts +2 -0
- package/src/services/index.ts +17 -0
- package/src/services/mcp.ts +31 -1
- package/src/services/media.ts +63 -0
- package/src/services/stats.ts +1130 -0
- package/src/style-share.css +16 -0
- package/src/styles/components-author.css +177 -0
- package/src/styles/components.css +25 -3
- package/src/styles/share.css +1103 -0
- package/src/styles/tokens.css +65 -30
- package/src/styles/ui.css +62 -13
- package/src/types/app-context.ts +9 -0
- package/src/types/bindings.ts +5 -0
- package/src/types/config.ts +54 -0
- package/src/types/views.ts +6 -0
- package/src/ui/compose/ComposeDialog.tsx +6 -0
- package/src/ui/dash/settings/SettingsRootContent.tsx +24 -6
- package/src/ui/dash/settings/StatsContent.tsx +855 -0
- package/src/ui/font-themes.ts +39 -6
- package/src/ui/layouts/BaseLayout.tsx +11 -2
- package/src/ui/layouts/SiteLayout.tsx +9 -3
- package/src/ui/share/ShareCard.tsx +298 -0
- package/src/ui/shared/Icon.tsx +23 -3
- package/src/ui/shared/MediaGallery.tsx +31 -4
- package/src/ui/shared/PostFooter.tsx +20 -4
- package/src/ui/shared/icon-collector.ts +28 -0
- package/src/ui/shared/post-article-attributes.ts +3 -0
- package/dist/client/_assets/chunks/footnote-rail-BJwswtVQ.js +0 -1
- package/dist/client/_assets/chunks/lit-DW8VmJAT.js +0 -2
- package/dist/client/_assets/chunks/slug-format-Dsi0e9Xn.js +0 -1
- package/dist/client/_assets/chunks/sortable-list-DWNKv782.js +0 -2
- package/dist/client/_assets/chunks/types-D5iF3H1a.js +0 -1
- package/dist/client/_assets/chunks/unsafe-svg-DTZZEvLU.js +0 -2
- package/dist/client/_assets/client-BaqmpPQ-.css +0 -2
- package/dist/client/_assets/client-C6melOtG.js +0 -296
- package/dist/client/_assets/client-auth-Ccq8kSqq.js +0 -828
- package/dist/client/_assets/client-author-CGVvrNZ8.css +0 -2
- package/dist/client/_assets/client-compose-oxzPb3SS.js +0 -2004
package/src/styles/tokens.css
CHANGED
|
@@ -17,11 +17,12 @@
|
|
|
17
17
|
* otherwise drop the text to the OS last-resort font.
|
|
18
18
|
*/
|
|
19
19
|
--font-cjk-serif-fallback:
|
|
20
|
-
"Songti SC",
|
|
21
|
-
"Songti TC",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"Noto Serif
|
|
20
|
+
"Songti SC", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC",
|
|
21
|
+
STSong, SimSun, "Songti TC", "Noto Serif TC", "Noto Serif CJK TC",
|
|
22
|
+
"Source Han Serif TC", PMingLiU, MingLiU, "Hiragino Mincho ProN",
|
|
23
|
+
"Hiragino Mincho Pro", "Yu Mincho", YuMincho, "Noto Serif JP",
|
|
24
|
+
"Noto Serif CJK JP", "MS PMincho", "MS Mincho", Batang, "Noto Serif KR",
|
|
25
|
+
"Noto Serif CJK KR", NanumMyeongjo;
|
|
25
26
|
--font-cjk-sans-fallback:
|
|
26
27
|
"PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
|
|
27
28
|
"Noto Sans CJK SC", "PingFang TC", "Hiragino Sans CNS",
|
|
@@ -97,8 +98,14 @@
|
|
|
97
98
|
/* Content reading tokens — desktop maps to core scale,
|
|
98
99
|
mobile overrides below cap sizes for small screens.
|
|
99
100
|
--type-content-scale uniformly scales all content sizes
|
|
100
|
-
without affecting UI controls.
|
|
101
|
-
|
|
101
|
+
without affecting UI controls.
|
|
102
|
+
|
|
103
|
+
0.81 puts the body at 17px (21px × 0.81). Latin reading surfaces run
|
|
104
|
+
17–21 (Ghost 17–19, Substack 20, Medium 21); Chinese ones settle on 17
|
|
105
|
+
(sspai, Apple), since a Han glyph fills its em where Latin lowercase
|
|
106
|
+
fills half, so the same px reads a size larger. 18 was tried and read
|
|
107
|
+
as big on a 13-inch laptop. Titles and headings keep their ratios. */
|
|
108
|
+
--type-content-scale: 0.81;
|
|
102
109
|
--type-content-display: calc(var(--type-display) * var(--type-content-scale));
|
|
103
110
|
--type-content-title: calc(var(--type-title) * var(--type-content-scale));
|
|
104
111
|
--type-content-subtitle: calc(
|
|
@@ -126,12 +133,24 @@
|
|
|
126
133
|
--type-thread-context-meta: var(--type-sm);
|
|
127
134
|
--feed-note-title-size: calc(var(--type-content-body) * 1.36);
|
|
128
135
|
--feed-note-title-leading: var(--type-heading-leading);
|
|
136
|
+
/*
|
|
137
|
+
* Reading rhythm. A page in Chinese, Japanese or Korean raises both
|
|
138
|
+
* leadings (`getCjkFontCssVariables` in ui/font-themes.ts): Han glyphs fill
|
|
139
|
+
* the em box, so the same line-height packs CJK lines tighter than Latin.
|
|
140
|
+
*/
|
|
129
141
|
--type-body-leading: 1.7;
|
|
130
142
|
--type-display-leading: 1.15;
|
|
131
|
-
--type-heading-leading: 1.
|
|
132
|
-
|
|
143
|
+
--type-heading-leading: 1.2;
|
|
144
|
+
/*
|
|
145
|
+
* Semibold, not medium: a heading has to outweigh bold body text, and the
|
|
146
|
+
* CJK serif faces have no 500 — Songti SC resolves 500 to Regular and 600
|
|
147
|
+
* to Bold, so medium headings came out lighter than the <strong> runs
|
|
148
|
+
* beneath them. Latin faces with a 500 (New York, Literata, Source Sans)
|
|
149
|
+
* step up half a weight. Tufte opts back out to Regular, its own look.
|
|
150
|
+
*/
|
|
151
|
+
--type-heading-weight: var(--fw-semibold);
|
|
133
152
|
--type-heading-tracking: 0;
|
|
134
|
-
--type-display-weight: var(--fw-
|
|
153
|
+
--type-display-weight: var(--fw-semibold);
|
|
135
154
|
--type-display-tracking: 0;
|
|
136
155
|
--type-label-weight: var(--fw-medium);
|
|
137
156
|
--type-label-tracking: 0.08em;
|
|
@@ -152,15 +171,16 @@
|
|
|
152
171
|
*
|
|
153
172
|
* `--layout-reading-width` is the reading column a post's text actually
|
|
154
173
|
* gets. It tracks the proportion while the gutter exists, then keeps a
|
|
155
|
-
* measure of its own instead of going
|
|
156
|
-
* up with body copy — the text blocks
|
|
157
|
-
* (MediaGallery `getSingleVisualWidth`), a link
|
|
158
|
-
* that centers over the column — reads this one.
|
|
159
|
-
* consumers capped on the proportion and quietly
|
|
160
|
-
* 700px and 1024px.
|
|
174
|
+
* measure of its own, `--layout-reading-measure`, instead of going
|
|
175
|
+
* full-width. Anything that must line up with body copy — the text blocks
|
|
176
|
+
* in preset.css, a lone image (MediaGallery `getSingleVisualWidth`), a link
|
|
177
|
+
* preview, the feed divider that centers over the column — reads this one.
|
|
178
|
+
* Before it existed those consumers capped on the proportion and quietly
|
|
179
|
+
* outgrew the text between 700px and 1024px.
|
|
161
180
|
*/
|
|
162
181
|
--layout-content-width: 55%;
|
|
163
182
|
--layout-reading-width: var(--layout-content-width);
|
|
183
|
+
--layout-reading-measure: 35rem;
|
|
164
184
|
--layout-sidenote-width: 50%;
|
|
165
185
|
--layout-sidenote-gap: 10%;
|
|
166
186
|
--layout-sidenote-margin: -60%;
|
|
@@ -460,6 +480,11 @@
|
|
|
460
480
|
--site-search-mark-bg: oklch(0.92 0.14 90 / 0.55);
|
|
461
481
|
--site-search-mark-color: oklch(0.35 0.09 70);
|
|
462
482
|
|
|
483
|
+
/* Highlighted text in posts (`==text==`). Follows each theme's search
|
|
484
|
+
colors until a theme sets it, and every theme sets those on :root. */
|
|
485
|
+
--site-highlight-bg: var(--site-search-mark-bg);
|
|
486
|
+
--site-highlight-color: var(--site-search-mark-color);
|
|
487
|
+
|
|
463
488
|
/* Admin */
|
|
464
489
|
--dash-bg: oklch(0.97 0.005 80);
|
|
465
490
|
--dash-card-radius: 10px;
|
|
@@ -477,19 +502,22 @@
|
|
|
477
502
|
* dialog.
|
|
478
503
|
*
|
|
479
504
|
* 480px Header hamburger; the composer's post-meta pill sheds its words.
|
|
480
|
-
* 580px Nav collapse tier-sm (hides the 3rd inline link).
|
|
481
505
|
* 640px Media grid and lightbox chrome.
|
|
482
506
|
* 700px THE PHONE SWITCH. Below it the layout is a phone's: the composer
|
|
483
507
|
* is a full-screen sheet, the compose FAB appears, page gutters and
|
|
484
508
|
* the content type scale go narrow. Written `max-width: 699px` on
|
|
485
509
|
* the phone side and `min-width: 700px` on the desktop side, so the
|
|
486
510
|
* two never both match at 700px itself.
|
|
487
|
-
*
|
|
488
|
-
*
|
|
489
|
-
*
|
|
511
|
+
* 960px The full-screen composer tightens its padding and title sizes.
|
|
512
|
+
* 1024px Tufte two-column → single-column, and the page frame narrows to
|
|
513
|
+
* the reading column (see the note below).
|
|
490
514
|
* 1079px Collections sidebar drops out.
|
|
491
515
|
* 1200px Header search collapses to an icon.
|
|
492
516
|
*
|
|
517
|
+
* The header's nav links are not on this list: they collapse into More by the
|
|
518
|
+
* header's own width (`@container site-header` in ui.css), because the same
|
|
519
|
+
* viewport gives a reader page a narrower header than a settings page.
|
|
520
|
+
*
|
|
493
521
|
* Touch is NOT a width. Thumb-sized controls and always-visible affordances
|
|
494
522
|
* belong to `(hover: none) and (pointer: coarse)`, which is what actually
|
|
495
523
|
* catches a phone or a tablet; a narrow desktop window is still a mouse.
|
|
@@ -505,17 +533,19 @@
|
|
|
505
533
|
/* Tufte two-column → single-column collapse.
|
|
506
534
|
*
|
|
507
535
|
* There is no room for a 45% sidenote gutter here, so page shells go
|
|
508
|
-
* full-width — but the reading column does not follow them. It keeps
|
|
509
|
-
* measure
|
|
510
|
-
* link previews, the feed divider) tracks that through
|
|
511
|
-
* `--layout-reading-width` rather than restating the number.
|
|
536
|
+
* full-width — but the reading column does not follow them. It keeps
|
|
537
|
+
* `--layout-reading-measure`, and everything sized to the text (preset.css
|
|
538
|
+
* blocks, single images, link previews, the feed divider) tracks that through
|
|
539
|
+
* `--layout-reading-width` rather than restating the number. The page frame
|
|
540
|
+
* narrows to the same measure and centers (ui.css), so the column has no
|
|
541
|
+
* leftover width piled up on its right.
|
|
512
542
|
*
|
|
513
543
|
* Keep this breakpoint in sync with the sidenote float→inline collapse
|
|
514
544
|
* (ui.css). They are one layout switch; do not let them drift apart. */
|
|
515
545
|
@media (max-width: 1024px) {
|
|
516
546
|
:root {
|
|
517
547
|
--layout-content-width: 100%;
|
|
518
|
-
--layout-reading-width: min(100%,
|
|
548
|
+
--layout-reading-width: min(100%, var(--layout-reading-measure));
|
|
519
549
|
}
|
|
520
550
|
}
|
|
521
551
|
|
|
@@ -628,14 +658,19 @@
|
|
|
628
658
|
@media (max-width: 699px), (hover: none) and (pointer: coarse) {
|
|
629
659
|
:root {
|
|
630
660
|
/* Content layer — tighter scale for mobile reading.
|
|
661
|
+
Body keeps the desktop size; the headings sit closer to it than
|
|
662
|
+
desktop's 2.7 / 2.1 / 1.8 rem so a title fits a phone line.
|
|
631
663
|
Ratio ≈ 1.88 : 1.42 : 1.15 : 1 (display:title:subtitle:body).
|
|
632
|
-
At 15px root × 0.
|
|
664
|
+
At 15px root × 0.81 content-scale: 32 / 24.2 / 19.6 / 17px.
|
|
633
665
|
Body is floored to a 16px minimum below (max()) for readability;
|
|
634
666
|
the floor still yields to calc() when the user zooms the root up. */
|
|
635
|
-
--type-content-display: calc(2.
|
|
636
|
-
--type-content-title: calc(1.
|
|
637
|
-
--type-content-subtitle: calc(1.
|
|
638
|
-
--type-content-body: max(
|
|
667
|
+
--type-content-display: calc(2.63rem * var(--type-content-scale));
|
|
668
|
+
--type-content-title: calc(1.99rem * var(--type-content-scale));
|
|
669
|
+
--type-content-subtitle: calc(1.61rem * var(--type-content-scale));
|
|
670
|
+
--type-content-body: max(
|
|
671
|
+
16px,
|
|
672
|
+
calc(var(--type-body) * var(--type-content-scale))
|
|
673
|
+
);
|
|
639
674
|
|
|
640
675
|
/* UI layer — pixel floors for touch targets */
|
|
641
676
|
--type-ui-title: max(16px, var(--type-secondary));
|
package/src/styles/ui.css
CHANGED
|
@@ -56,6 +56,10 @@
|
|
|
56
56
|
.site-page > main,
|
|
57
57
|
.site-page > footer,
|
|
58
58
|
.site-page > .home-branding-credit {
|
|
59
|
+
/* The narrow frame's gutters. The start side keeps room for the thread
|
|
60
|
+
rail, which hangs into it. */
|
|
61
|
+
--site-frame-gutter-start: max(5%, 28px);
|
|
62
|
+
--site-frame-gutter-end: 5%;
|
|
59
63
|
width: 100%;
|
|
60
64
|
/* 12.5% left + 4% right = 16.5% padding → content = 83.5% */
|
|
61
65
|
max-width: calc(var(--layout-body-max-width) / 0.835);
|
|
@@ -70,14 +74,42 @@
|
|
|
70
74
|
.site-page > main,
|
|
71
75
|
.site-page > footer,
|
|
72
76
|
.site-page > .home-branding-credit {
|
|
73
|
-
padding-left:
|
|
74
|
-
padding-right:
|
|
77
|
+
padding-left: var(--site-frame-gutter-start);
|
|
78
|
+
padding-right: var(--site-frame-gutter-end);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
* Once the sidenote gutter is gone (the single-column note in tokens.css),
|
|
84
|
+
* the asymmetric padding has nothing left to make room for, and a column
|
|
85
|
+
* held to its measure would sit against the left with every spare pixel on
|
|
86
|
+
* its right — 119px against 307px on a 951px screen. So the frame narrows
|
|
87
|
+
* to the column and its auto margins center it. That is the wide-screen
|
|
88
|
+
* rule too: the frame is centered and as wide as what it holds, which there
|
|
89
|
+
* is the column plus the gutter. Inside, everything stays flush left.
|
|
90
|
+
*
|
|
91
|
+
* Settings and the full-page composer size their own content, wider than
|
|
92
|
+
* the reading measure, and keep the frame they had (`.site-page-wide`).
|
|
93
|
+
*/
|
|
94
|
+
@media (max-width: 1024px) {
|
|
95
|
+
.site-page:not(.site-page-wide) > header,
|
|
96
|
+
.site-page:not(.site-page-wide) > main,
|
|
97
|
+
.site-page:not(.site-page-wide) > footer,
|
|
98
|
+
.site-page:not(.site-page-wide) > .home-branding-credit {
|
|
99
|
+
max-width: calc(
|
|
100
|
+
var(--layout-reading-measure) + var(--site-frame-gutter-start) +
|
|
101
|
+
var(--site-frame-gutter-end)
|
|
102
|
+
);
|
|
103
|
+
padding-left: var(--site-frame-gutter-start);
|
|
104
|
+
padding-right: var(--site-frame-gutter-end);
|
|
75
105
|
}
|
|
76
106
|
}
|
|
77
107
|
|
|
78
108
|
/* --- Top header --------------------------------------------------------- */
|
|
79
109
|
|
|
80
110
|
.site-header {
|
|
111
|
+
/* The nav collapses by this width (Header responsive, below). */
|
|
112
|
+
container: site-header / inline-size;
|
|
81
113
|
padding-top: 24px;
|
|
82
114
|
}
|
|
83
115
|
|
|
@@ -905,14 +937,21 @@
|
|
|
905
937
|
}
|
|
906
938
|
|
|
907
939
|
/*
|
|
908
|
-
* Tiered nav collapse
|
|
909
|
-
*
|
|
910
|
-
*
|
|
911
|
-
*
|
|
912
|
-
*
|
|
913
|
-
*
|
|
940
|
+
* Tiered nav collapse, by the header's own width rather than the
|
|
941
|
+
* viewport's: below 1024px a reader page's header is held to the reading
|
|
942
|
+
* column while a settings page's is not, so one viewport gives two widths.
|
|
943
|
+
* < 802px — hide the 5th+ inline link, reveal it in More (tier-lg)
|
|
944
|
+
* < 652px — also hide the 4th inline link (tier-md)
|
|
945
|
+
* < 522px — also hide the 3rd inline link (tier-sm)
|
|
946
|
+
* Each is the header's width where the viewport tiers used to switch: past
|
|
947
|
+
* 960px and 780px on the wide frame, at 580px on a phone's (one pixel
|
|
948
|
+
* early, because WebKit drops the fraction when it measures the container).
|
|
949
|
+
* A page whose header did not narrow collapses where it always did; a
|
|
950
|
+
* reader page's 35rem header sits in the middle tier. The first two links always
|
|
951
|
+
* stay inline until the hamburger takes over at ≤480px (handled below).
|
|
952
|
+
* BaseLayout inlines the same rules as critical CSS.
|
|
914
953
|
*/
|
|
915
|
-
@
|
|
954
|
+
@container site-header (width < 802px) {
|
|
916
955
|
.site-header-link-collapse-lg {
|
|
917
956
|
display: none;
|
|
918
957
|
}
|
|
@@ -930,7 +969,7 @@
|
|
|
930
969
|
}
|
|
931
970
|
}
|
|
932
971
|
|
|
933
|
-
@
|
|
972
|
+
@container site-header (width < 652px) {
|
|
934
973
|
.site-header-link-collapse-md {
|
|
935
974
|
display: none;
|
|
936
975
|
}
|
|
@@ -948,7 +987,7 @@
|
|
|
948
987
|
}
|
|
949
988
|
}
|
|
950
989
|
|
|
951
|
-
@
|
|
990
|
+
@container site-header (width < 522px) {
|
|
952
991
|
.site-header-link-collapse-sm {
|
|
953
992
|
display: none;
|
|
954
993
|
}
|
|
@@ -2460,10 +2499,14 @@
|
|
|
2460
2499
|
margin-bottom: 1.7rem;
|
|
2461
2500
|
}
|
|
2462
2501
|
|
|
2502
|
+
/* Title, then the date a clear step below it, then air before the body:
|
|
2503
|
+
the three tiers every well-set article page keeps (Medium, Substack,
|
|
2504
|
+
Ghost). At 0.7rem the date sat on the title's descenders. */
|
|
2463
2505
|
.post-header-block-detail {
|
|
2464
2506
|
display: flex;
|
|
2465
2507
|
flex-direction: column;
|
|
2466
|
-
gap: 0.
|
|
2508
|
+
gap: 0.9rem;
|
|
2509
|
+
margin-bottom: 2.2rem;
|
|
2467
2510
|
}
|
|
2468
2511
|
|
|
2469
2512
|
.post-header-block .feed-link-title,
|
|
@@ -2497,7 +2540,7 @@
|
|
|
2497
2540
|
.post-header-meta-link {
|
|
2498
2541
|
color: var(--site-text-secondary);
|
|
2499
2542
|
font-family: var(--font-ui);
|
|
2500
|
-
font-size: var(--type-ui-
|
|
2543
|
+
font-size: var(--type-ui-meta);
|
|
2501
2544
|
text-decoration: none;
|
|
2502
2545
|
white-space: nowrap;
|
|
2503
2546
|
}
|
|
@@ -3818,6 +3861,12 @@
|
|
|
3818
3861
|
display: flex;
|
|
3819
3862
|
}
|
|
3820
3863
|
|
|
3864
|
+
/* A reader's menu (Copy link, Share as image) renders only for a reader,
|
|
3865
|
+
so it shows without the signed-in flag. */
|
|
3866
|
+
.post-menu-trigger[data-share-menu-trigger] {
|
|
3867
|
+
display: flex;
|
|
3868
|
+
}
|
|
3869
|
+
|
|
3821
3870
|
.post-menu-backdrop {
|
|
3822
3871
|
position: fixed;
|
|
3823
3872
|
inset: 0;
|
package/src/types/app-context.ts
CHANGED
|
@@ -16,6 +16,7 @@ import type { RateLimiter } from "../lib/rate-limit.js";
|
|
|
16
16
|
import type { StorageDriver } from "../lib/storage.js";
|
|
17
17
|
import type { Bindings } from "./bindings.js";
|
|
18
18
|
import type { Site, SiteDomain } from "./entities.js";
|
|
19
|
+
import type { ViewTarget } from "../lib/view-counting.js";
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Session payload as returned by better-auth's `getSession`.
|
|
@@ -81,6 +82,14 @@ export interface AppVariables {
|
|
|
81
82
|
* multilingual content is off.
|
|
82
83
|
*/
|
|
83
84
|
viewLang?: string;
|
|
85
|
+
/**
|
|
86
|
+
* What the page just rendered counts as for the view counter: a post, by
|
|
87
|
+
* id, or any other public page, by its path. Set by the page routes worth
|
|
88
|
+
* counting and absent on everything else, so an API call, a feed or a
|
|
89
|
+
* partial never registers a view. Read by `middleware/view-counter.ts`
|
|
90
|
+
* after the response.
|
|
91
|
+
*/
|
|
92
|
+
viewTarget?: ViewTarget;
|
|
84
93
|
}
|
|
85
94
|
|
|
86
95
|
/**
|
package/src/types/bindings.ts
CHANGED
|
@@ -80,6 +80,8 @@ export interface Bindings {
|
|
|
80
80
|
GITHUB_APP_PRIVATE_KEY?: EnvBindingValue;
|
|
81
81
|
GITHUB_APP_SLUG?: EnvBindingValue;
|
|
82
82
|
GITHUB_APP_WEBHOOK_SECRET?: EnvBindingValue;
|
|
83
|
+
GITHUB_APP_CLIENT_ID?: EnvBindingValue;
|
|
84
|
+
GITHUB_APP_CLIENT_SECRET?: EnvBindingValue;
|
|
83
85
|
// Rate limits
|
|
84
86
|
RATE_LIMIT_ENABLED?: EnvBindingValue;
|
|
85
87
|
RATE_LIMIT_SEARCH_PER_MIN?: EnvBindingValue;
|
|
@@ -108,6 +110,9 @@ export interface Bindings {
|
|
|
108
110
|
SUMMARY_MAX_CHARS?: EnvBindingValue;
|
|
109
111
|
// Slug generation
|
|
110
112
|
SLUG_ID_LENGTH?: EnvBindingValue;
|
|
113
|
+
// View stats
|
|
114
|
+
STATS_ENABLED?: EnvBindingValue;
|
|
115
|
+
STATS_DAILY_LIMIT?: EnvBindingValue;
|
|
111
116
|
// RSS feed
|
|
112
117
|
RSS_FEED_LIMIT?: EnvBindingValue;
|
|
113
118
|
RSS_PUBLISH_DELAY_SECONDS?: EnvBindingValue;
|
package/src/types/config.ts
CHANGED
|
@@ -308,6 +308,14 @@ export const CONFIG_FIELDS = {
|
|
|
308
308
|
envOnly: true,
|
|
309
309
|
envKeys: ["SLUG_ID_LENGTH"],
|
|
310
310
|
},
|
|
311
|
+
// Views one instance records per day before counting pauses until the next
|
|
312
|
+
// UTC day. The registry default is the Cloudflare one; `resolveConfig`
|
|
313
|
+
// reads an unset variable as no limit on Node, where no write quota exists.
|
|
314
|
+
STATS_DAILY_LIMIT: {
|
|
315
|
+
defaultValue: "20000",
|
|
316
|
+
envOnly: true,
|
|
317
|
+
envKeys: ["STATS_DAILY_LIMIT"],
|
|
318
|
+
},
|
|
311
319
|
RSS_FEED_LIMIT: {
|
|
312
320
|
defaultValue: "50",
|
|
313
321
|
envOnly: false,
|
|
@@ -467,6 +475,25 @@ export const CONFIG_FIELDS = {
|
|
|
467
475
|
envKeys: ["RSS_FEEDS_ENABLED"],
|
|
468
476
|
editor: { type: "boolean" },
|
|
469
477
|
},
|
|
478
|
+
// Whether page views are counted. Edited on the Stats page, which deletes
|
|
479
|
+
// the counts on the way off, and deliberately kept out of Config Editor: a
|
|
480
|
+
// `false` saved there would stop the counting and leave ninety days of rows
|
|
481
|
+
// behind, which is not what "off" promises.
|
|
482
|
+
STATS_ENABLED: {
|
|
483
|
+
defaultValue: "true",
|
|
484
|
+
envOnly: false,
|
|
485
|
+
envKeys: ["STATS_ENABLED"],
|
|
486
|
+
},
|
|
487
|
+
// The day counting began, a `YYYY-MM-DD` key in the site's time zone.
|
|
488
|
+
// Written by the stats service alone: when the switch is turned on, or by
|
|
489
|
+
// the first flush that writes the site's counts when nobody ever touched
|
|
490
|
+
// the switch; deleted with the counts on the way off. The Stats page says
|
|
491
|
+
// where its record starts instead of drawing the days before as zero.
|
|
492
|
+
STATS_SINCE: {
|
|
493
|
+
defaultValue: "",
|
|
494
|
+
envOnly: false,
|
|
495
|
+
internal: true,
|
|
496
|
+
},
|
|
470
497
|
// No default value, and deliberately no `editor`. "Never chosen" has to stay
|
|
471
498
|
// tellable apart from an explicit choice — an unset site falls through to
|
|
472
499
|
// `noindex` and then to the deployment default, an explicit one does not —
|
|
@@ -628,6 +655,21 @@ export const CONFIG_FIELDS = {
|
|
|
628
655
|
envOnly: true,
|
|
629
656
|
envKeys: ["GITHUB_APP_WEBHOOK_SECRET"],
|
|
630
657
|
},
|
|
658
|
+
/**
|
|
659
|
+
* The App's OAuth client credentials. With them, connecting an account
|
|
660
|
+
* signs the author in with GitHub to learn which installations they own.
|
|
661
|
+
* Required on a host-based deployment; recommended on a single-site one.
|
|
662
|
+
*/
|
|
663
|
+
GITHUB_APP_CLIENT_ID: {
|
|
664
|
+
defaultValue: "",
|
|
665
|
+
envOnly: true,
|
|
666
|
+
envKeys: ["GITHUB_APP_CLIENT_ID"],
|
|
667
|
+
},
|
|
668
|
+
GITHUB_APP_CLIENT_SECRET: {
|
|
669
|
+
defaultValue: "",
|
|
670
|
+
envOnly: true,
|
|
671
|
+
envKeys: ["GITHUB_APP_CLIENT_SECRET"],
|
|
672
|
+
},
|
|
631
673
|
|
|
632
674
|
// Telegram bot pool (env-only). When TELEGRAM_BOT_TOKENS is set the bot
|
|
633
675
|
// tokens are platform-managed (hosted, or a single-site operator who opts
|
|
@@ -840,6 +882,18 @@ export interface AppConfig {
|
|
|
840
882
|
siteAvatarThumbUrl: string;
|
|
841
883
|
faviconVersion: string;
|
|
842
884
|
|
|
885
|
+
// View stats
|
|
886
|
+
stats: {
|
|
887
|
+
/** When false, no view is counted and the Stats page offers to turn it on. */
|
|
888
|
+
enabled: boolean;
|
|
889
|
+
/**
|
|
890
|
+
* Views this instance records in one UTC day before counting pauses until
|
|
891
|
+
* the next. `0` is no limit. Guards the free-tier D1 write quota, which
|
|
892
|
+
* refuses every query once spent; see `services/stats.ts`.
|
|
893
|
+
*/
|
|
894
|
+
dailyLimit: number;
|
|
895
|
+
};
|
|
896
|
+
|
|
843
897
|
// Rate limiting (ENV only)
|
|
844
898
|
rateLimit: {
|
|
845
899
|
/** When false, every rate-limit check passes without counting. */
|
package/src/types/views.ts
CHANGED
|
@@ -337,6 +337,12 @@ export interface SiteLayoutProps {
|
|
|
337
337
|
siteFooterHtml?: string;
|
|
338
338
|
showHomeBranding?: boolean;
|
|
339
339
|
sidebar?: import("hono/jsx").Child;
|
|
340
|
+
/**
|
|
341
|
+
* Keep the wide page frame below 1024px, where reader pages narrow theirs
|
|
342
|
+
* to the reading column. For pages that size their own content: settings,
|
|
343
|
+
* the full-page composer.
|
|
344
|
+
*/
|
|
345
|
+
wideFrame?: boolean;
|
|
340
346
|
uploadMaxFileSize?: number;
|
|
341
347
|
showComposeDialog?: boolean;
|
|
342
348
|
showHeader?: boolean;
|
|
@@ -888,6 +888,12 @@ export const ComposeForm: FC<ComposeFormProps> = ({
|
|
|
888
888
|
"@context: First-use hint shown over the compose editor to surface the slash command menu",
|
|
889
889
|
}),
|
|
890
890
|
),
|
|
891
|
+
highlight: i18n._(
|
|
892
|
+
msg({
|
|
893
|
+
message: "Highlight",
|
|
894
|
+
comment: "@context: Selection toolbar button that highlights text",
|
|
895
|
+
}),
|
|
896
|
+
),
|
|
891
897
|
tableControls: {
|
|
892
898
|
toolbarLabel: i18n._(
|
|
893
899
|
msg({
|
|
@@ -30,6 +30,7 @@ const ICONS = {
|
|
|
30
30
|
send: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/></svg>`,
|
|
31
31
|
cloud: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"/></svg>`,
|
|
32
32
|
sliders: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" x2="4" y1="21" y2="14"/><line x1="4" x2="4" y1="10" y2="3"/><line x1="12" x2="12" y1="21" y2="12"/><line x1="12" x2="12" y1="8" y2="3"/><line x1="20" x2="20" y1="21" y2="16"/><line x1="20" x2="20" y1="12" y2="3"/><line x1="1" x2="7" y1="14" y2="14"/><line x1="9" x2="15" y1="8" y2="8"/><line x1="17" x2="23" y1="16" y2="16"/></svg>`,
|
|
33
|
+
barChart: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 3v18h18"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/></svg>`,
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
export function SettingsRootContent({
|
|
@@ -138,19 +139,19 @@ export function SettingsRootContent({
|
|
|
138
139
|
)}
|
|
139
140
|
/>
|
|
140
141
|
<SettingsDirectoryLink
|
|
141
|
-
href={toPublicPath("/settings/
|
|
142
|
-
icon={ICONS.
|
|
142
|
+
href={toPublicPath("/settings/stats", sitePathPrefix)}
|
|
143
|
+
icon={ICONS.barChart}
|
|
143
144
|
tone="subtle"
|
|
144
145
|
name={i18n._(
|
|
145
146
|
msg({
|
|
146
|
-
message: "
|
|
147
|
-
comment: "@context: Settings item —
|
|
147
|
+
message: "Stats",
|
|
148
|
+
comment: "@context: Settings item — view stats",
|
|
148
149
|
}),
|
|
149
150
|
)}
|
|
150
151
|
description={i18n._(
|
|
151
152
|
msg({
|
|
152
|
-
message: "
|
|
153
|
-
comment: "@context: Settings item description for
|
|
153
|
+
message: "Views by day, most-read pages, and referrers",
|
|
154
|
+
comment: "@context: Settings item description for stats",
|
|
154
155
|
}),
|
|
155
156
|
)}
|
|
156
157
|
/>
|
|
@@ -303,6 +304,23 @@ export function SettingsRootContent({
|
|
|
303
304
|
}),
|
|
304
305
|
)}
|
|
305
306
|
>
|
|
307
|
+
<SettingsDirectoryLink
|
|
308
|
+
href={toPublicPath("/settings/custom-urls", sitePathPrefix)}
|
|
309
|
+
icon={ICONS.arrowRightLeft}
|
|
310
|
+
tone="subtle"
|
|
311
|
+
name={i18n._(
|
|
312
|
+
msg({
|
|
313
|
+
message: "Custom URLs",
|
|
314
|
+
comment: "@context: Settings item — custom URL settings",
|
|
315
|
+
}),
|
|
316
|
+
)}
|
|
317
|
+
description={i18n._(
|
|
318
|
+
msg({
|
|
319
|
+
message: "Redirects, vanity paths, and URL control",
|
|
320
|
+
comment: "@context: Settings item description for custom URLs",
|
|
321
|
+
}),
|
|
322
|
+
)}
|
|
323
|
+
/>
|
|
306
324
|
<SettingsDirectoryLink
|
|
307
325
|
href={toPublicPath("/settings/code-injection", sitePathPrefix)}
|
|
308
326
|
icon={ICONS.terminal}
|