@jant/core 1.2.0 → 1.4.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/commands/site/import.js +2 -1
- package/dist/{app-CbOZ2Irh.js → app-BuzORSgm.js} +1441 -686
- package/dist/client/.vite/manifest.json +72 -83
- package/dist/client/_assets/chunks/{confirm-CMe01lne.js → confirm-BQebcuNB.js} +1 -1
- package/dist/client/_assets/chunks/{create-editor-hWapNE40.js → create-editor-B8KuszlS.js} +38 -38
- package/dist/client/_assets/chunks/footnote-rail-DUrqz0Py.js +2 -0
- package/dist/client/_assets/chunks/{jant-locale-picker-2L4rkDaz.js → jant-locale-picker-CLq0iKDH.js} +1 -1
- package/dist/client/_assets/chunks/lit-BN4mrI3j.js +2 -0
- package/dist/client/_assets/chunks/{settings-paths-BBVT8zKj.js → settings-paths-_fry4yWW.js} +1 -1
- package/dist/client/_assets/chunks/{slug-format-BuCPjSrB.js → slug-format-bcJ2ozr4.js} +1 -1
- package/dist/client/_assets/chunks/{sortable-list-DJXwkaOv.js → sortable-list-Bz2Na2E9.js} +2 -2
- package/dist/client/_assets/chunks/{unsafe-html-CWos3v6N.js → unsafe-html-OJ9m154w.js} +1 -1
- package/dist/client/_assets/chunks/unsafe-svg-DVJ4NPcb.js +1 -0
- package/dist/client/_assets/client-CStDm2xD.js +354 -0
- package/dist/client/_assets/{client-D8Rrsd73.css → client-CoNHvipV.css} +1 -1
- package/dist/client/_assets/{client-auth-CsUGM718.js → client-auth-D53R-Wby.js} +99 -129
- package/dist/client/_assets/client-author-2WYBkgni.css +2 -0
- package/dist/client/_assets/{client-compose-BB4U7Wz0.js → client-compose-DYtDlYm-.js} +248 -244
- package/dist/client/_assets/{client-manage-CI9-eh-8.js → client-manage-BODyYP5Z.js} +157 -157
- package/dist/client/_assets/{client-settings-BnGPuqwc.js → client-settings-DDpe_tXJ.js} +166 -166
- package/dist/client/_assets/client-share-B9OsXx9p.js +149 -0
- package/dist/{constants-DEgyqWDl.js → constants-C2CdWAqt.js} +55 -5
- package/dist/index.js +1 -1
- package/dist/node.js +2 -2
- package/package.json +2 -1
- package/src/client/components/compose-types.ts +5 -1
- package/src/client/components/jant-compose-dialog.ts +25 -4
- package/src/client/components/jant-media-lightbox.ts +18 -3
- package/src/client/components/jant-nav-manager.ts +2 -0
- package/src/client/components/jant-post-menu.ts +42 -89
- package/src/client/components/nav-manager-types.ts +2 -0
- package/src/client/components/settings-types.ts +1 -1
- package/src/client/list-views.ts +382 -0
- package/src/client/media-lightbox-events.ts +12 -0
- package/src/client/runtime-paths.ts +12 -0
- package/src/client/share-capture.ts +63 -0
- package/src/client/share-launch.ts +36 -9
- package/src/client/tiptap/create-editor.ts +4 -0
- package/src/client/tiptap/embed-node.ts +3 -1
- package/src/client/tiptap/html-block-node.ts +3 -1
- package/src/client/tiptap/image-node.ts +3 -1
- package/src/client/view-confirm.ts +32 -4
- package/src/client.ts +1 -0
- package/src/db/migrations/0037_round_post.sql +16 -0
- package/src/db/migrations/0038_flashy_changeling.sql +15 -0
- package/src/db/migrations/0039_mixed_sister_grimm.sql +1 -0
- package/src/db/migrations/meta/0037_snapshot.json +2932 -0
- package/src/db/migrations/meta/0038_snapshot.json +2924 -0
- package/src/db/migrations/meta/0039_snapshot.json +2931 -0
- package/src/db/migrations/meta/_journal.json +21 -0
- package/src/db/migrations/pg/0035_flimsy_outlaw_kid.sql +3 -0
- package/src/db/migrations/pg/0036_milky_wolverine.sql +5 -0
- package/src/db/migrations/pg/0037_fuzzy_hammerhead.sql +1 -0
- package/src/db/migrations/pg/meta/0035_snapshot.json +3773 -0
- package/src/db/migrations/pg/meta/0036_snapshot.json +3766 -0
- package/src/db/migrations/pg/meta/0037_snapshot.json +3772 -0
- package/src/db/migrations/pg/meta/_journal.json +21 -0
- package/src/db/pg/schema.ts +1 -0
- package/src/db/post-visibility.ts +37 -6
- package/src/db/schema.ts +5 -2
- package/src/i18n/locales/glossary.zh-Hans.yml +4 -0
- package/src/i18n/locales/glossary.zh-Hant.yml +4 -0
- package/src/i18n/locales/public/en.po +21 -90
- package/src/i18n/locales/public/en.ts +1 -1
- package/src/i18n/locales/public/zh-Hans.po +20 -89
- package/src/i18n/locales/public/zh-Hans.ts +1 -1
- package/src/i18n/locales/public/zh-Hant.po +20 -89
- package/src/i18n/locales/public/zh-Hant.ts +1 -1
- package/src/i18n/locales/settings/en.po +84 -0
- package/src/i18n/locales/settings/en.ts +1 -1
- package/src/i18n/locales/settings/zh-Hans.po +130 -46
- package/src/i18n/locales/settings/zh-Hans.ts +1 -1
- package/src/i18n/locales/settings/zh-Hant.po +124 -40
- package/src/i18n/locales/settings/zh-Hant.ts +1 -1
- package/src/lib/api-public-posts.ts +10 -0
- package/src/lib/feed-policy.ts +2 -2
- package/src/lib/feed.ts +17 -1
- package/src/lib/filter-dimensions.ts +11 -4
- package/src/lib/hugo-markdown.ts +7 -0
- package/src/lib/icons.ts +2 -0
- package/src/lib/link-preview.ts +499 -0
- package/src/lib/list-views.ts +117 -0
- package/src/lib/markdown-manager.ts +40 -1
- package/src/lib/navigation.ts +1 -1
- package/src/lib/share-card.ts +4 -3
- package/src/lib/thread-query.ts +6 -2
- package/src/lib/timeline.ts +12 -11
- package/src/lib/url-fetch.ts +291 -74
- package/src/lib/view-buffer.ts +2 -2
- package/src/lib/view-counting.ts +7 -6
- package/src/lib/view-token.ts +29 -7
- package/src/lib/view.ts +17 -0
- package/src/middleware/view-counter.ts +10 -5
- package/src/preset.css +5 -3
- package/src/routes/api/search.ts +1 -1
- package/src/routes/dash/settings.tsx +1 -1
- package/src/routes/feed/sitemap.ts +1 -1
- package/src/routes/pages/archive.tsx +25 -19
- package/src/routes/pages/collection.tsx +3 -3
- package/src/routes/pages/page.tsx +16 -4
- package/src/routes/pages/search.tsx +3 -3
- package/src/routes/pages/subscribe.tsx +19 -3
- package/src/routes/view-confirm.ts +23 -15
- package/src/services/collection.ts +1 -1
- package/src/services/export-theme/assets/client-site.js +19 -19
- package/src/services/export-theme/layouts/archive/list.html +4 -2
- package/src/services/export-theme/layouts/partials/collection-members.html +4 -3
- package/src/services/export-theme/layouts/partials/featured-members.html +3 -3
- package/src/services/export-theme/layouts/partials/head.html +2 -0
- package/src/services/export-theme/layouts/partials/latest-members.html +4 -4
- package/src/services/export-theme/layouts/partials/post-card.html +1 -9
- package/src/services/export-theme/layouts/partials/reply.html +1 -9
- package/src/services/export-theme/layouts/partials/smart-collection-members.html +4 -3
- package/src/services/export-theme/layouts/post/list.html +1 -9
- package/src/services/export-theme/styles/main.css +2 -26
- package/src/services/export.ts +10 -3
- package/src/services/mcp.ts +5 -5
- package/src/services/navigation.ts +9 -4
- package/src/services/post.ts +102 -112
- package/src/services/search.ts +22 -7
- package/src/services/smart-collection.ts +3 -3
- package/src/services/stats.ts +12 -5
- package/src/services/thread.ts +6 -2
- package/src/styles/components-author.css +69 -7
- package/src/styles/tokens.css +28 -29
- package/src/styles/ui-author.css +140 -353
- package/src/styles/ui.css +34 -32
- package/src/types/constants.ts +68 -4
- package/src/types/entities.ts +1 -0
- package/src/types/views.ts +2 -0
- package/src/ui/compose/ComposeDialog.tsx +20 -1
- package/src/ui/dash/StatusBadge.tsx +11 -0
- package/src/ui/dash/appearance/FontThemeContent.tsx +1 -1
- package/src/ui/dash/appearance/NavigationContent.tsx +8 -0
- package/src/ui/dash/settings/StatsContent.tsx +29 -29
- package/src/ui/feed/LinkCard.tsx +19 -2
- package/src/ui/feed/PostStatusBadges.tsx +19 -3
- package/src/ui/feed/TimelineFeed.tsx +3 -0
- package/src/ui/font-themes.ts +32 -15
- package/src/ui/pages/ArchivePage.tsx +1 -0
- package/src/ui/pages/SubscribePage.tsx +9 -1
- package/src/ui/shared/PostFooter.tsx +1 -22
- package/src/ui/shared/custom-icons.ts +5 -5
- package/dist/client/_assets/chunks/footnote-rail-9zwl6jtV.js +0 -2
- package/dist/client/_assets/chunks/lit-Bw_voPoW.js +0 -2
- package/dist/client/_assets/chunks/runtime-paths-y0_gHowM.js +0 -1
- package/dist/client/_assets/chunks/unsafe-svg-CUrgo4Xg.js +0 -1
- package/dist/client/_assets/client-BO8GOFfT.js +0 -354
- package/dist/client/_assets/client-author-QPm1whbO.css +0 -2
- package/dist/client/_assets/client-share-C59mOLJ1.js +0 -149
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* The token names the page and where the reader came from, decided on the
|
|
13
13
|
* server from the request; nothing about the reader is read here or sent.
|
|
14
14
|
* No cookie, no storage, one request, and nothing waits for its answer.
|
|
15
|
+
* The Threads read in full in a list page's feed go out the same way, once
|
|
16
|
+
* the page is confirmed (`list-views.ts`).
|
|
15
17
|
*/
|
|
16
18
|
|
|
17
19
|
import { publicPath } from "./runtime-paths.js";
|
|
@@ -20,7 +22,7 @@ import { publicPath } from "./runtime-paths.js";
|
|
|
20
22
|
export const VIEW_CONFIRM_DWELL_MS = 5_000;
|
|
21
23
|
|
|
22
24
|
/** Where the token goes; the same path `lib/view-token.ts` names. */
|
|
23
|
-
const CONFIRM_PATH = "/_/seen";
|
|
25
|
+
export const CONFIRM_PATH = "/_/seen";
|
|
24
26
|
|
|
25
27
|
/** Anything a reader does that a crawler fetching a page does not. */
|
|
26
28
|
const INTERACTION_EVENTS = [
|
|
@@ -32,19 +34,44 @@ const INTERACTION_EVENTS = [
|
|
|
32
34
|
"scroll",
|
|
33
35
|
] as const;
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
/** Documents whose view has been confirmed. */
|
|
38
|
+
const confirmed = new WeakSet<globalThis.Document>();
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Post a body to the site, surviving the page being closed: a beacon, or a
|
|
42
|
+
* `keepalive` fetch when the browser will not queue one.
|
|
43
|
+
*
|
|
44
|
+
* @param url - Where to post
|
|
45
|
+
* @param body - The plain-text body
|
|
46
|
+
* @returns Nothing; nothing waits for the answer
|
|
47
|
+
* @example
|
|
48
|
+
* deliver(publicPath(CONFIRM_PATH), token);
|
|
49
|
+
*/
|
|
50
|
+
export function deliver(url: string, body: string): void {
|
|
36
51
|
const sent =
|
|
37
52
|
typeof navigator.sendBeacon === "function" &&
|
|
38
|
-
navigator.sendBeacon(url, new Blob([
|
|
53
|
+
navigator.sendBeacon(url, new Blob([body], { type: "text/plain" }));
|
|
39
54
|
if (sent) return;
|
|
40
55
|
void fetch(url, {
|
|
41
56
|
method: "POST",
|
|
42
|
-
body
|
|
57
|
+
body,
|
|
43
58
|
keepalive: true,
|
|
44
59
|
headers: { "content-type": "text/plain" },
|
|
45
60
|
}).catch(() => {});
|
|
46
61
|
}
|
|
47
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Whether this document has confirmed its view.
|
|
65
|
+
*
|
|
66
|
+
* @param doc - The document, the current one unless a test passes another
|
|
67
|
+
* @returns `true` once the confirmation went out
|
|
68
|
+
* @example
|
|
69
|
+
* if (isViewConfirmed()) report();
|
|
70
|
+
*/
|
|
71
|
+
export function isViewConfirmed(doc: globalThis.Document = document): boolean {
|
|
72
|
+
return confirmed.has(doc);
|
|
73
|
+
}
|
|
74
|
+
|
|
48
75
|
/**
|
|
49
76
|
* Arm the page's confirmation, if the page carries a token.
|
|
50
77
|
*
|
|
@@ -89,6 +116,7 @@ export function confirmView(doc: globalThis.Document = document): void {
|
|
|
89
116
|
doc.removeEventListener(event, send);
|
|
90
117
|
}
|
|
91
118
|
doc.removeEventListener("visibilitychange", onVisibility);
|
|
119
|
+
confirmed.add(doc);
|
|
92
120
|
deliver(url, token);
|
|
93
121
|
};
|
|
94
122
|
|
package/src/client.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { installPrefixedFetch } from "./client/runtime-paths.js";
|
|
|
10
10
|
import "./client/audio-player.js";
|
|
11
11
|
import "./client/feed-video-player.js";
|
|
12
12
|
import "./client/view-confirm.js";
|
|
13
|
+
import "./client/list-views.js";
|
|
13
14
|
import "./client/media-scroll-hint.js";
|
|
14
15
|
import "./client/form-enter-submit.js";
|
|
15
16
|
import "./client/copy-field.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_view_count` (
|
|
3
|
+
`site_id` text NOT NULL,
|
|
4
|
+
`day` text NOT NULL,
|
|
5
|
+
`page` text NOT NULL,
|
|
6
|
+
`referrer` text NOT NULL,
|
|
7
|
+
`via` text DEFAULT 'page' NOT NULL,
|
|
8
|
+
`count` integer DEFAULT 0 NOT NULL,
|
|
9
|
+
PRIMARY KEY(`site_id`, `day`, `page`, `referrer`, `via`),
|
|
10
|
+
FOREIGN KEY (`site_id`) REFERENCES `site`(`id`) ON UPDATE no action ON DELETE cascade
|
|
11
|
+
);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
INSERT INTO `__new_view_count`("site_id", "day", "page", "referrer", "count") SELECT "site_id", "day", "page", "referrer", "count" FROM `view_count`;--> statement-breakpoint
|
|
14
|
+
DROP TABLE `view_count`;--> statement-breakpoint
|
|
15
|
+
ALTER TABLE `__new_view_count` RENAME TO `view_count`;--> statement-breakpoint
|
|
16
|
+
PRAGMA foreign_keys=ON;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_view_count` (
|
|
3
|
+
`site_id` text NOT NULL,
|
|
4
|
+
`day` text NOT NULL,
|
|
5
|
+
`page` text NOT NULL,
|
|
6
|
+
`referrer` text NOT NULL,
|
|
7
|
+
`count` integer DEFAULT 0 NOT NULL,
|
|
8
|
+
PRIMARY KEY(`site_id`, `day`, `page`, `referrer`),
|
|
9
|
+
FOREIGN KEY (`site_id`) REFERENCES `site`(`id`) ON UPDATE no action ON DELETE cascade
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
INSERT INTO `__new_view_count`("site_id", "day", "page", "referrer", "count") SELECT "site_id", "day", "page", "referrer", SUM("count") FROM `view_count` GROUP BY "site_id", "day", "page", "referrer";--> statement-breakpoint
|
|
13
|
+
DROP TABLE `view_count`;--> statement-breakpoint
|
|
14
|
+
ALTER TABLE `__new_view_count` RENAME TO `view_count`;--> statement-breakpoint
|
|
15
|
+
PRAGMA foreign_keys=ON;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `post` ADD `preview_icon_key` text;
|