@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.
Files changed (150) hide show
  1. package/bin/commands/site/import.js +2 -1
  2. package/dist/{app-CbOZ2Irh.js → app-BuzORSgm.js} +1441 -686
  3. package/dist/client/.vite/manifest.json +72 -83
  4. package/dist/client/_assets/chunks/{confirm-CMe01lne.js → confirm-BQebcuNB.js} +1 -1
  5. package/dist/client/_assets/chunks/{create-editor-hWapNE40.js → create-editor-B8KuszlS.js} +38 -38
  6. package/dist/client/_assets/chunks/footnote-rail-DUrqz0Py.js +2 -0
  7. package/dist/client/_assets/chunks/{jant-locale-picker-2L4rkDaz.js → jant-locale-picker-CLq0iKDH.js} +1 -1
  8. package/dist/client/_assets/chunks/lit-BN4mrI3j.js +2 -0
  9. package/dist/client/_assets/chunks/{settings-paths-BBVT8zKj.js → settings-paths-_fry4yWW.js} +1 -1
  10. package/dist/client/_assets/chunks/{slug-format-BuCPjSrB.js → slug-format-bcJ2ozr4.js} +1 -1
  11. package/dist/client/_assets/chunks/{sortable-list-DJXwkaOv.js → sortable-list-Bz2Na2E9.js} +2 -2
  12. package/dist/client/_assets/chunks/{unsafe-html-CWos3v6N.js → unsafe-html-OJ9m154w.js} +1 -1
  13. package/dist/client/_assets/chunks/unsafe-svg-DVJ4NPcb.js +1 -0
  14. package/dist/client/_assets/client-CStDm2xD.js +354 -0
  15. package/dist/client/_assets/{client-D8Rrsd73.css → client-CoNHvipV.css} +1 -1
  16. package/dist/client/_assets/{client-auth-CsUGM718.js → client-auth-D53R-Wby.js} +99 -129
  17. package/dist/client/_assets/client-author-2WYBkgni.css +2 -0
  18. package/dist/client/_assets/{client-compose-BB4U7Wz0.js → client-compose-DYtDlYm-.js} +248 -244
  19. package/dist/client/_assets/{client-manage-CI9-eh-8.js → client-manage-BODyYP5Z.js} +157 -157
  20. package/dist/client/_assets/{client-settings-BnGPuqwc.js → client-settings-DDpe_tXJ.js} +166 -166
  21. package/dist/client/_assets/client-share-B9OsXx9p.js +149 -0
  22. package/dist/{constants-DEgyqWDl.js → constants-C2CdWAqt.js} +55 -5
  23. package/dist/index.js +1 -1
  24. package/dist/node.js +2 -2
  25. package/package.json +2 -1
  26. package/src/client/components/compose-types.ts +5 -1
  27. package/src/client/components/jant-compose-dialog.ts +25 -4
  28. package/src/client/components/jant-media-lightbox.ts +18 -3
  29. package/src/client/components/jant-nav-manager.ts +2 -0
  30. package/src/client/components/jant-post-menu.ts +42 -89
  31. package/src/client/components/nav-manager-types.ts +2 -0
  32. package/src/client/components/settings-types.ts +1 -1
  33. package/src/client/list-views.ts +382 -0
  34. package/src/client/media-lightbox-events.ts +12 -0
  35. package/src/client/runtime-paths.ts +12 -0
  36. package/src/client/share-capture.ts +63 -0
  37. package/src/client/share-launch.ts +36 -9
  38. package/src/client/tiptap/create-editor.ts +4 -0
  39. package/src/client/tiptap/embed-node.ts +3 -1
  40. package/src/client/tiptap/html-block-node.ts +3 -1
  41. package/src/client/tiptap/image-node.ts +3 -1
  42. package/src/client/view-confirm.ts +32 -4
  43. package/src/client.ts +1 -0
  44. package/src/db/migrations/0037_round_post.sql +16 -0
  45. package/src/db/migrations/0038_flashy_changeling.sql +15 -0
  46. package/src/db/migrations/0039_mixed_sister_grimm.sql +1 -0
  47. package/src/db/migrations/meta/0037_snapshot.json +2932 -0
  48. package/src/db/migrations/meta/0038_snapshot.json +2924 -0
  49. package/src/db/migrations/meta/0039_snapshot.json +2931 -0
  50. package/src/db/migrations/meta/_journal.json +21 -0
  51. package/src/db/migrations/pg/0035_flimsy_outlaw_kid.sql +3 -0
  52. package/src/db/migrations/pg/0036_milky_wolverine.sql +5 -0
  53. package/src/db/migrations/pg/0037_fuzzy_hammerhead.sql +1 -0
  54. package/src/db/migrations/pg/meta/0035_snapshot.json +3773 -0
  55. package/src/db/migrations/pg/meta/0036_snapshot.json +3766 -0
  56. package/src/db/migrations/pg/meta/0037_snapshot.json +3772 -0
  57. package/src/db/migrations/pg/meta/_journal.json +21 -0
  58. package/src/db/pg/schema.ts +1 -0
  59. package/src/db/post-visibility.ts +37 -6
  60. package/src/db/schema.ts +5 -2
  61. package/src/i18n/locales/glossary.zh-Hans.yml +4 -0
  62. package/src/i18n/locales/glossary.zh-Hant.yml +4 -0
  63. package/src/i18n/locales/public/en.po +21 -90
  64. package/src/i18n/locales/public/en.ts +1 -1
  65. package/src/i18n/locales/public/zh-Hans.po +20 -89
  66. package/src/i18n/locales/public/zh-Hans.ts +1 -1
  67. package/src/i18n/locales/public/zh-Hant.po +20 -89
  68. package/src/i18n/locales/public/zh-Hant.ts +1 -1
  69. package/src/i18n/locales/settings/en.po +84 -0
  70. package/src/i18n/locales/settings/en.ts +1 -1
  71. package/src/i18n/locales/settings/zh-Hans.po +130 -46
  72. package/src/i18n/locales/settings/zh-Hans.ts +1 -1
  73. package/src/i18n/locales/settings/zh-Hant.po +124 -40
  74. package/src/i18n/locales/settings/zh-Hant.ts +1 -1
  75. package/src/lib/api-public-posts.ts +10 -0
  76. package/src/lib/feed-policy.ts +2 -2
  77. package/src/lib/feed.ts +17 -1
  78. package/src/lib/filter-dimensions.ts +11 -4
  79. package/src/lib/hugo-markdown.ts +7 -0
  80. package/src/lib/icons.ts +2 -0
  81. package/src/lib/link-preview.ts +499 -0
  82. package/src/lib/list-views.ts +117 -0
  83. package/src/lib/markdown-manager.ts +40 -1
  84. package/src/lib/navigation.ts +1 -1
  85. package/src/lib/share-card.ts +4 -3
  86. package/src/lib/thread-query.ts +6 -2
  87. package/src/lib/timeline.ts +12 -11
  88. package/src/lib/url-fetch.ts +291 -74
  89. package/src/lib/view-buffer.ts +2 -2
  90. package/src/lib/view-counting.ts +7 -6
  91. package/src/lib/view-token.ts +29 -7
  92. package/src/lib/view.ts +17 -0
  93. package/src/middleware/view-counter.ts +10 -5
  94. package/src/preset.css +5 -3
  95. package/src/routes/api/search.ts +1 -1
  96. package/src/routes/dash/settings.tsx +1 -1
  97. package/src/routes/feed/sitemap.ts +1 -1
  98. package/src/routes/pages/archive.tsx +25 -19
  99. package/src/routes/pages/collection.tsx +3 -3
  100. package/src/routes/pages/page.tsx +16 -4
  101. package/src/routes/pages/search.tsx +3 -3
  102. package/src/routes/pages/subscribe.tsx +19 -3
  103. package/src/routes/view-confirm.ts +23 -15
  104. package/src/services/collection.ts +1 -1
  105. package/src/services/export-theme/assets/client-site.js +19 -19
  106. package/src/services/export-theme/layouts/archive/list.html +4 -2
  107. package/src/services/export-theme/layouts/partials/collection-members.html +4 -3
  108. package/src/services/export-theme/layouts/partials/featured-members.html +3 -3
  109. package/src/services/export-theme/layouts/partials/head.html +2 -0
  110. package/src/services/export-theme/layouts/partials/latest-members.html +4 -4
  111. package/src/services/export-theme/layouts/partials/post-card.html +1 -9
  112. package/src/services/export-theme/layouts/partials/reply.html +1 -9
  113. package/src/services/export-theme/layouts/partials/smart-collection-members.html +4 -3
  114. package/src/services/export-theme/layouts/post/list.html +1 -9
  115. package/src/services/export-theme/styles/main.css +2 -26
  116. package/src/services/export.ts +10 -3
  117. package/src/services/mcp.ts +5 -5
  118. package/src/services/navigation.ts +9 -4
  119. package/src/services/post.ts +102 -112
  120. package/src/services/search.ts +22 -7
  121. package/src/services/smart-collection.ts +3 -3
  122. package/src/services/stats.ts +12 -5
  123. package/src/services/thread.ts +6 -2
  124. package/src/styles/components-author.css +69 -7
  125. package/src/styles/tokens.css +28 -29
  126. package/src/styles/ui-author.css +140 -353
  127. package/src/styles/ui.css +34 -32
  128. package/src/types/constants.ts +68 -4
  129. package/src/types/entities.ts +1 -0
  130. package/src/types/views.ts +2 -0
  131. package/src/ui/compose/ComposeDialog.tsx +20 -1
  132. package/src/ui/dash/StatusBadge.tsx +11 -0
  133. package/src/ui/dash/appearance/FontThemeContent.tsx +1 -1
  134. package/src/ui/dash/appearance/NavigationContent.tsx +8 -0
  135. package/src/ui/dash/settings/StatsContent.tsx +29 -29
  136. package/src/ui/feed/LinkCard.tsx +19 -2
  137. package/src/ui/feed/PostStatusBadges.tsx +19 -3
  138. package/src/ui/feed/TimelineFeed.tsx +3 -0
  139. package/src/ui/font-themes.ts +32 -15
  140. package/src/ui/pages/ArchivePage.tsx +1 -0
  141. package/src/ui/pages/SubscribePage.tsx +9 -1
  142. package/src/ui/shared/PostFooter.tsx +1 -22
  143. package/src/ui/shared/custom-icons.ts +5 -5
  144. package/dist/client/_assets/chunks/footnote-rail-9zwl6jtV.js +0 -2
  145. package/dist/client/_assets/chunks/lit-Bw_voPoW.js +0 -2
  146. package/dist/client/_assets/chunks/runtime-paths-y0_gHowM.js +0 -1
  147. package/dist/client/_assets/chunks/unsafe-svg-CUrgo4Xg.js +0 -1
  148. package/dist/client/_assets/client-BO8GOFfT.js +0 -354
  149. package/dist/client/_assets/client-author-QPm1whbO.css +0 -2
  150. package/dist/client/_assets/client-share-C59mOLJ1.js +0 -149
@@ -512,9 +512,54 @@ var STATUSES = ["draft", "published"];
512
512
  var VISIBILITIES = [
513
513
  "public",
514
514
  "latest_hidden",
515
+ "unlisted",
515
516
  "private"
516
517
  ];
517
518
  /**
519
+ * Visibilities a signed-out reader can open at the post's address.
520
+ *
521
+ * Wider than {@link READER_LISTED_VISIBILITIES}: an Unlisted post opens for
522
+ * anyone who has its link, but no list a reader sees includes it.
523
+ */ var READER_OPENABLE_VISIBILITIES = [
524
+ "public",
525
+ "latest_hidden",
526
+ "unlisted"
527
+ ];
528
+ /**
529
+ * Visibilities a signed-out reader may find in a list: an archive, a search,
530
+ * a Collection, a feed, a sitemap, an API listing. Latest narrows this further
531
+ * by leaving out `latest_hidden`.
532
+ */ var READER_LISTED_VISIBILITIES = ["public", "latest_hidden"];
533
+ /**
534
+ * Whether a signed-out reader can open a post with this visibility.
535
+ *
536
+ * @param visibility - The post's effective visibility (its Thread root's)
537
+ * @returns False only for `private`
538
+ *
539
+ * @example
540
+ * ```ts
541
+ * isOpenableByReader("unlisted"); // true
542
+ * isOpenableByReader("private"); // false
543
+ * ```
544
+ */ function isOpenableByReader(visibility) {
545
+ return READER_OPENABLE_VISIBILITIES.includes(visibility);
546
+ }
547
+ /**
548
+ * Whether a list a signed-out reader sees may include a post with this
549
+ * visibility.
550
+ *
551
+ * @param visibility - The post's effective visibility (its Thread root's)
552
+ * @returns False for `unlisted` and `private`
553
+ *
554
+ * @example
555
+ * ```ts
556
+ * isListedForReader("latest_hidden"); // true
557
+ * isListedForReader("unlisted"); // false
558
+ * ```
559
+ */ function isListedForReader(visibility) {
560
+ return READER_LISTED_VISIBILITIES.includes(visibility);
561
+ }
562
+ /**
518
563
  * Layouts the archive page can render in. `list` renders the same timeline the
519
564
  * rest of the nav trio uses; `grid` renders the tile catalogue.
520
565
  *
@@ -529,15 +574,20 @@ var VISIBILITIES = [
529
574
  * visibility, and it lives here because the filter bar presents the two as one
530
575
  * dimension.
531
576
  *
532
- * `private` is deliberately absent. It names a set only the author can see, so
533
- * a reader who asks for it has to be told so — handing back a different set
534
- * under the same name is the one answer that is never right.
577
+ * `unlisted` and `private` are deliberately absent. Each names a set only the
578
+ * author can list, so a reader who asks for it has to be told so — handing
579
+ * back a different set under the same name is the one answer that is never
580
+ * right.
535
581
  */ var PUBLIC_ARCHIVE_VISIBILITIES = [
536
582
  "public",
537
583
  "featured",
538
584
  "latest_hidden"
539
585
  ];
540
- /** Every visibility the author can select, in filter-bar order. */ var ARCHIVE_VISIBILITIES = [...PUBLIC_ARCHIVE_VISIBILITIES, "private"];
586
+ /** Every visibility the author can select, in filter-bar order. */ var ARCHIVE_VISIBILITIES = [
587
+ ...PUBLIC_ARCHIVE_VISIBILITIES,
588
+ "unlisted",
589
+ "private"
590
+ ];
541
591
  /**
542
592
  * The range a `year` filter may name, inclusive at both ends.
543
593
  *
@@ -764,4 +814,4 @@ var UPLOAD_SESSION_STATES = [
764
814
  /** How a stored object is served: rendered in place, or downloaded. */ var CONTENT_DISPOSITIONS = ["inline", "attachment"];
765
815
  var GITHUB_APP_ACCOUNT_TYPES = ["User", "Organization"];
766
816
  //#endregion
767
- export { toInternalPath as $, THREAD_SORTS as A, isFullUrl as B, SMART_COLLECTION_SORT_ORDERS as C, SYSTEM_NAV_KEYS as D, STORAGE_DRIVERS as E, extractDisplayDomain as F, normalizeSiteUrl as G, normalizePath as H, extractDomain as I, sanitizeRichTextHref as J, redirectTargetHref as K, getPostPath as L, VISIBILITIES as M, isFeedNavKey as N, SYSTEM_NAV_KEY_VALUES as O, buildSiteUrl as P, toAbsoluteSiteUrl as Q, getSiteOrigin as R, SITE_STATUSES as S, STATUSES as T, normalizeRedirectTarget as U, isSafeInternalRedirect as V, normalizeSitePathPrefix as W, stripSitePathPrefix as X, sanitizeUrl as Y, toAbsoluteAssetUrl as Z, NAV_ITEM_TYPES as _, COLLECTION_SORT_ORDERS as a, SITE_DOMAIN_KINDS as b, EARLIEST_FILTERABLE_YEAR as c, LATEST_FILTERABLE_YEAR as d, toPublicHref as et, MAX_COLLECTION_DESCRIPTION_LENGTH as f, NAV_ITEM_PLACEMENTS as g, MEDIA_KINDS as h, COLLECTION_FRESHNESS_WINDOW_SECONDS as i, UPLOAD_SESSION_STATES as j, TEXT_ATTACHMENT_CONTENT_FORMATS as k, FORMATS as l, MAX_SITE_FOOTER_LENGTH as m, ARCHIVE_VISIBILITIES as n, toSameSitePath as nt, CONTENT_DISPOSITIONS as o, MAX_SITE_DESCRIPTION_LENGTH as p, redirectTargetPath as q, COLLECTION_DIRECTORY_ENTRY_TYPES as r, withRequestQuery as rt, DEFAULT_NAVIGATION_PROFILE as s, ARCHIVE_LAYOUTS as t, toPublicPath as tt, GITHUB_APP_ACCOUNT_TYPES as u, PATH_KINDS as v, SORT_ORDERS as w, SITE_MEMBER_ROLES as x, PUBLIC_ARCHIVE_VISIBILITIES as y, getSitePathPrefix as z };
817
+ export { stripSitePathPrefix as $, TEXT_ATTACHMENT_CONTENT_FORMATS as A, getPostPath as B, SITE_STATUSES as C, STORAGE_DRIVERS as D, STATUSES as E, isListedForReader as F, normalizePath as G, getSitePathPrefix as H, isOpenableByReader as I, normalizeSiteUrl as J, normalizeRedirectTarget as K, buildSiteUrl as L, UPLOAD_SESSION_STATES as M, VISIBILITIES as N, SYSTEM_NAV_KEYS as O, isFeedNavKey as P, sanitizeUrl as Q, extractDisplayDomain as R, SITE_MEMBER_ROLES as S, SORT_ORDERS as T, isFullUrl as U, getSiteOrigin as V, isSafeInternalRedirect as W, redirectTargetPath as X, redirectTargetHref as Y, sanitizeRichTextHref as Z, NAV_ITEM_TYPES as _, COLLECTION_SORT_ORDERS as a, toSameSitePath as at, READER_LISTED_VISIBILITIES as b, EARLIEST_FILTERABLE_YEAR as c, LATEST_FILTERABLE_YEAR as d, toAbsoluteAssetUrl as et, MAX_COLLECTION_DESCRIPTION_LENGTH as f, NAV_ITEM_PLACEMENTS as g, MEDIA_KINDS as h, COLLECTION_FRESHNESS_WINDOW_SECONDS as i, toPublicPath as it, THREAD_SORTS as j, SYSTEM_NAV_KEY_VALUES as k, FORMATS as l, MAX_SITE_FOOTER_LENGTH as m, ARCHIVE_VISIBILITIES as n, toInternalPath as nt, CONTENT_DISPOSITIONS as o, withRequestQuery as ot, MAX_SITE_DESCRIPTION_LENGTH as p, normalizeSitePathPrefix as q, COLLECTION_DIRECTORY_ENTRY_TYPES as r, toPublicHref as rt, DEFAULT_NAVIGATION_PROFILE as s, ARCHIVE_LAYOUTS as t, toAbsoluteSiteUrl as tt, GITHUB_APP_ACCOUNT_TYPES as u, PATH_KINDS as v, SMART_COLLECTION_SORT_ORDERS as w, SITE_DOMAIN_KINDS as x, PUBLIC_ARCHIVE_VISIBILITIES as y, extractDomain as z };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as createApp$1 } from "./app-CbOZ2Irh.js";
1
+ import { n as createApp$1 } from "./app-BuzORSgm.js";
2
2
  //#region src/index.ts
3
3
  /**
4
4
  * Jant - A microblog system
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as getTelegramBotPool, B as getPublicAssetBasePath, C as getConfiguredSingleSiteOrigin, D as getHostedControlPlaneBaseUrl, E as getEnvString, F as getCjkFontCssVariables, I as getFontThemeCssVariables, L as resolveCjkFontProfile, M as shouldTrustProxy, N as now, O as getPort, P as BUILTIN_FONT_THEMES, R as buildThemeStyle, S as getEnvValueIssues, T as getConfiguredStorageDriver, V as isAssetPath, _ as createNodeDatabase, a as createNodeCliRuntime, b as setMyCommands, c as createSiteService, d as resolveDatabaseDialect, f as createExportService, g as sqliteSchemaBundle, h as pgSchemaBundle, i as listPendingMigrations, j as getTelegramWebhookSecret, k as getSiteResolutionMode, l as viewBuffer, m as resolveConfig, n as createApp, o as createNodeRequestRuntime, p as createStorageDriver, r as PendingMigrationsError, s as setUpNodeInstance, u as getHostBasedStartupConfigurationIssues, v as schema_exports, w as getConfiguredSingleSitePathPrefix, x as setWebhook, y as getWebhookUrl, z as BUILTIN_COLOR_THEMES } from "./app-CbOZ2Irh.js";
1
+ import { A as getTelegramBotPool, B as getPublicAssetBasePath, C as getConfiguredSingleSiteOrigin, D as getHostedControlPlaneBaseUrl, E as getEnvString, F as getCjkFontCssVariables, I as getFontThemeCssVariables, L as resolveCjkFontProfile, M as shouldTrustProxy, N as now, O as getPort, P as BUILTIN_FONT_THEMES, R as buildThemeStyle, S as getEnvValueIssues, T as getConfiguredStorageDriver, V as isAssetPath, _ as createNodeDatabase, a as createNodeCliRuntime, b as setMyCommands, c as createSiteService, d as resolveDatabaseDialect, f as createExportService, g as sqliteSchemaBundle, h as pgSchemaBundle, i as listPendingMigrations, j as getTelegramWebhookSecret, k as getSiteResolutionMode, l as viewBuffer, m as resolveConfig, n as createApp, o as createNodeRequestRuntime, p as createStorageDriver, r as PendingMigrationsError, s as setUpNodeInstance, u as getHostBasedStartupConfigurationIssues, v as schema_exports, w as getConfiguredSingleSitePathPrefix, x as setWebhook, y as getWebhookUrl, z as BUILTIN_COLOR_THEMES } from "./app-BuzORSgm.js";
2
2
  import { drizzle } from "drizzle-orm/better-sqlite3";
3
3
  import { serve } from "@hono/node-server";
4
4
  import Database from "better-sqlite3";
@@ -626,7 +626,7 @@ async function createNodeRequestHandler(options) {
626
626
  async function start(env = process.env, app, options = {}) {
627
627
  const handler = await createNodeRequestHandler({
628
628
  env,
629
- app: async () => app ?? (await import("./app-CbOZ2Irh.js").then((n) => n.t)).createApp(),
629
+ app: async () => app ?? (await import("./app-BuzORSgm.js").then((n) => n.t)).createApp(),
630
630
  assetRoot: options.assetRoot
631
631
  });
632
632
  const hostname = resolveHost(env);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jant/core",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "A modern, open-source microblogging platform built on Cloudflare Workers",
5
5
  "type": "module",
6
6
  "exports": {
@@ -72,6 +72,7 @@
72
72
  "@tiptap/extension-bold": "^3.31.3",
73
73
  "@tiptap/extension-code-block": "^3.27.3",
74
74
  "@tiptap/extension-hard-break": "^3.31.3",
75
+ "@tiptap/extension-heading": "^3.31.3",
75
76
  "@tiptap/extension-image": "^3.27.3",
76
77
  "@tiptap/extension-italic": "^3.31.3",
77
78
  "@tiptap/extension-link": "^3.27.3",
@@ -315,6 +315,8 @@ export interface ComposeLabels {
315
315
  publishVisibilityPublicHint: string;
316
316
  publishVisibilityHiddenFromLatest: string;
317
317
  publishVisibilityHiddenFromLatestHint: string;
318
+ publishVisibilityUnlisted: string;
319
+ publishVisibilityUnlistedHint: string;
318
320
  publishVisibilityPrivate: string;
319
321
  publishVisibilityPrivateHint: string;
320
322
  publishDateLabel: string;
@@ -338,6 +340,7 @@ export interface ComposeLabels {
338
340
  publishSlugInvalid: string;
339
341
  publishSlugReserved: string;
340
342
  postHiddenFromLatest: string;
343
+ postUnlisted: string;
341
344
  postPrivately: string;
342
345
  quietReplyLabel: string;
343
346
  quietReplyHint: string;
@@ -383,7 +386,8 @@ export interface ComposeFullscreenCloseDetail {
383
386
  editorIndex?: number;
384
387
  }
385
388
 
386
- export type ComposeVisibility = "public" | "latest_hidden" | "private";
389
+ export type ComposeVisibility =
390
+ "public" | "latest_hidden" | "unlisted" | "private";
387
391
 
388
392
  export type ComposeSubmitAttachment =
389
393
  | {
@@ -268,6 +268,10 @@ const COMPOSE_PUBLISH_VISIBILITY_ICONS: Record<ComposeVisibility, string> = {
268
268
  />
269
269
  <path d="M4.35 11.1 11.65 4.9" />
270
270
  `,
271
+ unlisted: `
272
+ <path d="M6.8 8.6a3 3 0 0 0 4.524.324l1.8-1.8a3 3 0 0 0-4.242-4.242l-1.032 1.026" />
273
+ <path d="M9.2 7.4a3 3 0 0 0-4.524-.324l-1.8 1.8a3 3 0 0 0 4.242 4.242l1.026-1.026" />
274
+ `,
271
275
  private: `
272
276
  <rect x="4.05" y="7.05" width="7.9" height="5.4" rx="1.75" />
273
277
  <path d="M5.95 7.05V5.9A2.05 2.05 0 0 1 8 3.85a2.05 2.05 0 0 1 2.05 2.05v1.15" />
@@ -614,7 +618,14 @@ export class JantComposeDialog extends LitElement {
614
618
  const v = globalThis.localStorage.getItem(
615
619
  JantComposeDialog._collectionVisibilityKey(collectionId),
616
620
  );
617
- if (v === "public" || v === "latest_hidden" || v === "private") return v;
621
+ if (
622
+ v === "public" ||
623
+ v === "latest_hidden" ||
624
+ v === "unlisted" ||
625
+ v === "private"
626
+ ) {
627
+ return v;
628
+ }
618
629
  } catch {
619
630
  // localStorage unavailable
620
631
  }
@@ -5041,6 +5052,7 @@ export class JantComposeDialog extends LitElement {
5041
5052
  if (this._visibility === "latest_hidden") {
5042
5053
  return this.labels.postHiddenFromLatest;
5043
5054
  }
5055
+ if (this._visibility === "unlisted") return this.labels.postUnlisted;
5044
5056
  if (this._visibility === "private") return this.labels.postPrivately;
5045
5057
  return this.labels.post;
5046
5058
  }
@@ -5335,6 +5347,7 @@ export class JantComposeDialog extends LitElement {
5335
5347
  "compose-publish-visibility-icon-public": visibility === "public",
5336
5348
  "compose-publish-visibility-icon-latest_hidden":
5337
5349
  visibility === "latest_hidden",
5350
+ "compose-publish-visibility-icon-unlisted": visibility === "unlisted",
5338
5351
  "compose-publish-visibility-icon-private": visibility === "private",
5339
5352
  });
5340
5353
  return renderComposePublishVisibilityIcon(
@@ -6432,6 +6445,11 @@ export class JantComposeDialog extends LitElement {
6432
6445
  this.labels.publishVisibilityHiddenFromLatest,
6433
6446
  this.labels.publishVisibilityHiddenFromLatestHint,
6434
6447
  )}
6448
+ ${this._renderVisibilityRow(
6449
+ "unlisted",
6450
+ this.labels.publishVisibilityUnlisted,
6451
+ this.labels.publishVisibilityUnlistedHint,
6452
+ )}
6435
6453
  ${this._renderVisibilityRow(
6436
6454
  "private",
6437
6455
  this.labels.publishVisibilityPrivate,
@@ -6793,13 +6811,16 @@ export class JantComposeDialog extends LitElement {
6793
6811
  }
6794
6812
 
6795
6813
  /**
6796
- * Visibility has three states, so a checkbox cannot speak for all of them: it
6814
+ * Visibility has four states, so a checkbox cannot speak for all of them: it
6797
6815
  * covers the public ↔ hidden-from-Latest pair and steps aside once the post
6798
- * is private, where the panel's radio list is the only honest control.
6816
+ * is unlisted or private, where the panel's radio list is the only honest
6817
+ * control.
6799
6818
  */
6800
6819
  private _renderHideFromLatestQuickToggle() {
6801
6820
  if (this._visibilityLocked) return nothing;
6802
- if (this._visibility === "private") return nothing;
6821
+ if (this._visibility === "unlisted" || this._visibility === "private") {
6822
+ return nothing;
6823
+ }
6803
6824
 
6804
6825
  const checked = this._visibility === "latest_hidden";
6805
6826
  return html`
@@ -13,7 +13,9 @@ import { LitElement, html, nothing, svg } from "lit";
13
13
  import { shouldUseShortVideoExperience } from "../../lib/video-playback.js";
14
14
  import {
15
15
  isMediaVideoPlaybackPaused,
16
+ MEDIA_LIGHTBOX_SHOW_EVENT,
16
17
  MEDIA_LIGHTBOX_TOGGLE_EVENT,
18
+ type MediaLightboxShowDetail,
17
19
  setMediaVideoPlaybackPaused,
18
20
  } from "../media-lightbox-events.js";
19
21
 
@@ -160,6 +162,9 @@ export class JantMediaLightbox extends LitElement {
160
162
  declare _videoPaused: boolean;
161
163
  declare _imageZoomed: boolean;
162
164
 
165
+ /** Where the open set of items came from, for `MEDIA_LIGHTBOX_SHOW_EVENT`. */
166
+ #source: globalThis.Element | null = null;
167
+
163
168
  createRenderRoot() {
164
169
  this.innerHTML = "";
165
170
  return this;
@@ -193,7 +198,12 @@ export class JantMediaLightbox extends LitElement {
193
198
  window.removeEventListener("resize", this.#handleViewportChange);
194
199
  }
195
200
 
196
- open(images: LightboxImage[], index: number) {
201
+ open(
202
+ images: LightboxImage[],
203
+ index: number,
204
+ source: globalThis.Element | null = null,
205
+ ) {
206
+ this.#source = source;
197
207
  this.#syncViewport();
198
208
  this.#pauseCurrentVideo();
199
209
  this._images = images;
@@ -244,7 +254,7 @@ export class JantMediaLightbox extends LitElement {
244
254
  group.dataset.lightboxGroup ?? "[]",
245
255
  );
246
256
  if (images.length > 0) {
247
- this.open(images, index);
257
+ this.open(images, index, group);
248
258
  }
249
259
  } catch {
250
260
  // JSON parse failed — fall through to default link behavior
@@ -272,7 +282,7 @@ export class JantMediaLightbox extends LitElement {
272
282
  ),
273
283
  }));
274
284
  const index = allImages.indexOf(img);
275
- if (images.length > 0) this.open(images, Math.max(0, index));
285
+ if (images.length > 0) this.open(images, Math.max(0, index), container);
276
286
  }
277
287
  };
278
288
 
@@ -621,6 +631,11 @@ export class JantMediaLightbox extends LitElement {
621
631
  if (changed.has("_currentIndex") || changed.has("_open")) {
622
632
  this.#syncCurrentVideo();
623
633
  this.#focusCurrentMedia();
634
+ document.dispatchEvent(
635
+ new CustomEvent<MediaLightboxShowDetail>(MEDIA_LIGHTBOX_SHOW_EVENT, {
636
+ detail: { source: this.#source, index: this._currentIndex },
637
+ }),
638
+ );
624
639
  }
625
640
  }
626
641
 
@@ -1811,6 +1811,8 @@ export class JantNavManager extends LitElement {
1811
1811
  );
1812
1812
  case "unpublished":
1813
1813
  return this.labels.addressUnpublished;
1814
+ case "unlisted":
1815
+ return this.labels.addressUnlisted;
1814
1816
  case "private":
1815
1817
  return this.labels.addressPrivate;
1816
1818
  case "untitled":
@@ -62,6 +62,14 @@ interface MenuLanguage {
62
62
  label: string;
63
63
  }
64
64
 
65
+ /** The visibility panel's choices, widest audience first. */
66
+ const POST_MENU_VISIBILITY_OPTIONS = [
67
+ { value: "public", label: "Public" },
68
+ { value: "latest_hidden", label: "Hidden from Latest" },
69
+ { value: "unlisted", label: "Unlisted" },
70
+ { value: "private", label: "Private" },
71
+ ] as const;
72
+
65
73
  /**
66
74
  * What the server made of an address pasted into the translation picker: the
67
75
  * Thread it names, or why that Thread cannot be linked to this one.
@@ -142,7 +150,8 @@ export function removeLeadingFeedDivider(
142
150
 
143
151
  /**
144
152
  * The image carries a QR code to the post, which a reader can open only once
145
- * it is published and not Private.
153
+ * it is published and not Private. An Unlisted post opens for anyone with the
154
+ * link, so it can be shared this way too.
146
155
  */
147
156
  function canShareAsImage(data: PostMenuData): boolean {
148
157
  return !data.isDraft && data.visibility !== "private";
@@ -1088,6 +1097,7 @@ export class JantPostMenu extends LitElement {
1088
1097
  const messages: Record<string, string> = {
1089
1098
  public: "Post made public.",
1090
1099
  latest_hidden: "Hidden from Latest.",
1100
+ unlisted: "Post made unlisted.",
1091
1101
  private: "Post made private.",
1092
1102
  };
1093
1103
  showToast(messages[newVisibility] ?? "Visibility updated.");
@@ -1522,14 +1532,10 @@ export class JantPostMenu extends LitElement {
1522
1532
  }
1523
1533
 
1524
1534
  #getVisibilityLabel(visibility: string) {
1525
- switch (visibility) {
1526
- case "private":
1527
- return "Private";
1528
- case "latest_hidden":
1529
- return "Hidden from Latest";
1530
- default:
1531
- return "Public";
1532
- }
1535
+ return (
1536
+ POST_MENU_VISIBILITY_OPTIONS.find((option) => option.value === visibility)
1537
+ ?.label ?? "Public"
1538
+ );
1533
1539
  }
1534
1540
 
1535
1541
  // --- Icons (inline SVG) ---
@@ -2140,86 +2146,33 @@ export class JantPostMenu extends LitElement {
2140
2146
  </div>
2141
2147
  <div role="menu" class="post-menu-list">
2142
2148
  <div class="post-menu-section">
2143
- <button
2144
- type="button"
2145
- role="menuitemradio"
2146
- aria-checked=${visibility === "public" ? "true" : "false"}
2147
- data-post-menu-visibility-option
2148
- data-post-menu-visibility-current=${
2149
- visibility === "public" ? "true" : "false"
2150
- }
2151
- class=${`post-menu-item${
2152
- visibility === "public" ? " post-menu-item-active" : ""
2153
- }`}
2154
- @click=${() =>
2155
- visibility === "public"
2156
- ? this.#showMainMenu("[data-post-menu-open-visibility]")
2157
- : this.#setVisibility("public")}
2158
- >
2159
- <span class="post-menu-item-label">Public</span>
2160
- ${
2161
- visibility === "public"
2162
- ? html`<span
2163
- class="post-menu-item-trailing post-menu-item-check"
2164
- >${this.#iconCheck()}</span
2165
- >`
2166
- : nothing
2167
- }
2168
- </button>
2169
-
2170
- <button
2171
- type="button"
2172
- role="menuitemradio"
2173
- aria-checked=${visibility === "latest_hidden" ? "true" : "false"}
2174
- data-post-menu-visibility-option
2175
- data-post-menu-visibility-current=${
2176
- visibility === "latest_hidden" ? "true" : "false"
2177
- }
2178
- class=${`post-menu-item${
2179
- visibility === "latest_hidden" ? " post-menu-item-active" : ""
2180
- }`}
2181
- @click=${() =>
2182
- visibility === "latest_hidden"
2183
- ? this.#showMainMenu("[data-post-menu-open-visibility]")
2184
- : this.#setVisibility("latest_hidden")}
2185
- >
2186
- <span class="post-menu-item-label">Hidden from Latest</span>
2187
- ${
2188
- visibility === "latest_hidden"
2189
- ? html`<span
2190
- class="post-menu-item-trailing post-menu-item-check"
2191
- >${this.#iconCheck()}</span
2192
- >`
2193
- : nothing
2194
- }
2195
- </button>
2196
-
2197
- <button
2198
- type="button"
2199
- role="menuitemradio"
2200
- aria-checked=${visibility === "private" ? "true" : "false"}
2201
- data-post-menu-visibility-option
2202
- data-post-menu-visibility-current=${
2203
- visibility === "private" ? "true" : "false"
2204
- }
2205
- class=${`post-menu-item${
2206
- visibility === "private" ? " post-menu-item-active" : ""
2207
- }`}
2208
- @click=${() =>
2209
- visibility === "private"
2210
- ? this.#showMainMenu("[data-post-menu-open-visibility]")
2211
- : this.#setVisibility("private")}
2212
- >
2213
- <span class="post-menu-item-label">Private</span>
2214
- ${
2215
- visibility === "private"
2216
- ? html`<span
2217
- class="post-menu-item-trailing post-menu-item-check"
2218
- >${this.#iconCheck()}</span
2219
- >`
2220
- : nothing
2221
- }
2222
- </button>
2149
+ ${POST_MENU_VISIBILITY_OPTIONS.map(({ value, label }) => {
2150
+ const current = visibility === value;
2151
+ return html`
2152
+ <button
2153
+ type="button"
2154
+ role="menuitemradio"
2155
+ aria-checked=${current ? "true" : "false"}
2156
+ data-post-menu-visibility-option
2157
+ data-post-menu-visibility-current=${current ? "true" : "false"}
2158
+ class=${`post-menu-item${current ? " post-menu-item-active" : ""}`}
2159
+ @click=${() =>
2160
+ current
2161
+ ? this.#showMainMenu("[data-post-menu-open-visibility]")
2162
+ : this.#setVisibility(value)}
2163
+ >
2164
+ <span class="post-menu-item-label">${label}</span>
2165
+ ${
2166
+ current
2167
+ ? html`<span
2168
+ class="post-menu-item-trailing post-menu-item-check"
2169
+ >${this.#iconCheck()}</span
2170
+ >`
2171
+ : nothing
2172
+ }
2173
+ </button>
2174
+ `;
2175
+ })}
2223
2176
  </div>
2224
2177
  </div>
2225
2178
  </div>
@@ -55,6 +55,7 @@ export type NavAddressResolution =
55
55
  | "link_only"
56
56
  | "untitled"
57
57
  | "unpublished"
58
+ | "unlisted"
58
59
  | "private"
59
60
  | "not_found";
60
61
  address: string;
@@ -134,6 +135,7 @@ export interface NavManagerLabels {
134
135
  addressAlreadyAdded: string;
135
136
  addressNotFound: string;
136
137
  addressUnpublished: string;
138
+ addressUnlisted: string;
137
139
  addressPrivate: string;
138
140
  addressUntitled: string;
139
141
  addressExternal: string;
@@ -102,7 +102,7 @@ export type SettingsAboutPageStatus =
102
102
  id: string;
103
103
  title: string | null;
104
104
  status: "draft" | "published";
105
- visibility: "public" | "latest_hidden" | "private";
105
+ visibility: "public" | "latest_hidden" | "unlisted" | "private";
106
106
  };
107
107
  }
108
108
  | {