@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
@@ -8,9 +8,71 @@ export type Format = (typeof FORMATS)[number];
8
8
  export const STATUSES = ["draft", "published"] as const;
9
9
  export type Status = (typeof STATUSES)[number];
10
10
 
11
- export const VISIBILITIES = ["public", "latest_hidden", "private"] as const;
11
+ export const VISIBILITIES = [
12
+ "public",
13
+ "latest_hidden",
14
+ "unlisted",
15
+ "private",
16
+ ] as const;
12
17
  export type Visibility = (typeof VISIBILITIES)[number];
13
18
 
19
+ /**
20
+ * Visibilities a signed-out reader can open at the post's address.
21
+ *
22
+ * Wider than {@link READER_LISTED_VISIBILITIES}: an Unlisted post opens for
23
+ * anyone who has its link, but no list a reader sees includes it.
24
+ */
25
+ export const READER_OPENABLE_VISIBILITIES = [
26
+ "public",
27
+ "latest_hidden",
28
+ "unlisted",
29
+ ] as const satisfies readonly Visibility[];
30
+
31
+ /**
32
+ * Visibilities a signed-out reader may find in a list: an archive, a search,
33
+ * a Collection, a feed, a sitemap, an API listing. Latest narrows this further
34
+ * by leaving out `latest_hidden`.
35
+ */
36
+ export const READER_LISTED_VISIBILITIES = [
37
+ "public",
38
+ "latest_hidden",
39
+ ] as const satisfies readonly Visibility[];
40
+
41
+ /**
42
+ * Whether a signed-out reader can open a post with this visibility.
43
+ *
44
+ * @param visibility - The post's effective visibility (its Thread root's)
45
+ * @returns False only for `private`
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * isOpenableByReader("unlisted"); // true
50
+ * isOpenableByReader("private"); // false
51
+ * ```
52
+ */
53
+ export function isOpenableByReader(visibility: string): boolean {
54
+ return (READER_OPENABLE_VISIBILITIES as readonly string[]).includes(
55
+ visibility,
56
+ );
57
+ }
58
+
59
+ /**
60
+ * Whether a list a signed-out reader sees may include a post with this
61
+ * visibility.
62
+ *
63
+ * @param visibility - The post's effective visibility (its Thread root's)
64
+ * @returns False for `unlisted` and `private`
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * isListedForReader("latest_hidden"); // true
69
+ * isListedForReader("unlisted"); // false
70
+ * ```
71
+ */
72
+ export function isListedForReader(visibility: string): boolean {
73
+ return (READER_LISTED_VISIBILITIES as readonly string[]).includes(visibility);
74
+ }
75
+
14
76
  export const FEED_KINDS = ["latest", "featured"] as const;
15
77
  export type FeedKind = (typeof FEED_KINDS)[number];
16
78
 
@@ -43,9 +105,10 @@ export type ArchiveSort = (typeof ARCHIVE_SORTS)[number];
43
105
  * visibility, and it lives here because the filter bar presents the two as one
44
106
  * dimension.
45
107
  *
46
- * `private` is deliberately absent. It names a set only the author can see, so
47
- * a reader who asks for it has to be told so — handing back a different set
48
- * under the same name is the one answer that is never right.
108
+ * `unlisted` and `private` are deliberately absent. Each names a set only the
109
+ * author can list, so a reader who asks for it has to be told so — handing
110
+ * back a different set under the same name is the one answer that is never
111
+ * right.
49
112
  */
50
113
  export const PUBLIC_ARCHIVE_VISIBILITIES = [
51
114
  "public",
@@ -56,6 +119,7 @@ export const PUBLIC_ARCHIVE_VISIBILITIES = [
56
119
  /** Every visibility the author can select, in filter-bar order. */
57
120
  export const ARCHIVE_VISIBILITIES = [
58
121
  ...PUBLIC_ARCHIVE_VISIBILITIES,
122
+ "unlisted",
59
123
  "private",
60
124
  ] as const;
61
125
 
@@ -71,6 +71,7 @@ export interface Post {
71
71
  previewImageKey: string | null;
72
72
  previewKind: string | null;
73
73
  previewProvider: string | null;
74
+ previewIconKey: string | null;
74
75
  replyToId: string | null;
75
76
  threadId: string;
76
77
  /**
@@ -81,6 +81,8 @@ export interface PostView {
81
81
  previewProvider?: string;
82
82
  /** Pre-computed preview image URL */
83
83
  previewImageUrl?: string;
84
+ /** The linked site's icon, shown before a Link post's domain */
85
+ previewIconUrl?: string;
84
86
 
85
87
  // Time -- pre-formatted
86
88
  /** ISO 8601 string */
@@ -659,11 +659,24 @@ export const ComposeForm: FC<ComposeFormProps> = ({
659
659
  publishVisibilityHiddenFromLatestHint: i18n._(
660
660
  msg({
661
661
  message:
662
- "Doesn't appear in Latest. Still appears in collections you add it to.",
662
+ "Doesn't appear in Latest. Still appears in the archive, search, and collections.",
663
663
  comment:
664
664
  "@context: Compose publish settings help text for posts hidden from Latest",
665
665
  }),
666
666
  ),
667
+ publishVisibilityUnlisted: i18n._(
668
+ msg({
669
+ message: "Unlisted",
670
+ comment: "@context: Compose publish settings visibility option",
671
+ }),
672
+ ),
673
+ publishVisibilityUnlistedHint: i18n._(
674
+ msg({
675
+ message: "Not listed anywhere. Only people with the link can see it.",
676
+ comment:
677
+ "@context: Compose publish settings help text for unlisted visibility",
678
+ }),
679
+ ),
667
680
  publishVisibilityPrivate: i18n._(
668
681
  msg({
669
682
  message: "Private",
@@ -823,6 +836,12 @@ export const ComposeForm: FC<ComposeFormProps> = ({
823
836
  "@context: Compose publish button for posts hidden from Latest",
824
837
  }),
825
838
  ),
839
+ postUnlisted: i18n._(
840
+ msg({
841
+ message: "Post unlisted",
842
+ comment: "@context: Compose publish button for unlisted visibility",
843
+ }),
844
+ ),
826
845
  postPrivately: i18n._(
827
846
  msg({
828
847
  message: "Post privately",
@@ -67,6 +67,17 @@ export const StatusBadge: FC<StatusBadgeProps> = ({
67
67
  )}
68
68
  </span>
69
69
  )}
70
+ {visibility === "unlisted" && (
71
+ <span class="badge-outline">
72
+ {i18n._(
73
+ msg({
74
+ message: "Unlisted",
75
+ comment:
76
+ "@context: Post badge for posts that open for anyone with the link but are listed nowhere",
77
+ }),
78
+ )}
79
+ </span>
80
+ )}
70
81
  {pinned && (
71
82
  <span class="badge-outline">
72
83
  {i18n._(
@@ -115,6 +115,7 @@ export function FontThemeContent({
115
115
  style="font-family:var(--font-body);font-size:var(--type-body-size);line-height:var(--type-body-leading);letter-spacing:var(--type-body-tracking)"
116
116
  >
117
117
  <div class="feed-link-domain">
118
+ <span>{FONT_THEME_PREVIEW.linkMeta}</span>
118
119
  <svg
119
120
  class="feed-link-domain-icon"
120
121
  xmlns="http://www.w3.org/2000/svg"
@@ -126,7 +127,6 @@ export function FontThemeContent({
126
127
  >
127
128
  <path d="M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25" />
128
129
  </svg>
129
- <span>{FONT_THEME_PREVIEW.linkMeta}</span>
130
130
  </div>
131
131
  <div class="feed-link-title mt-1">
132
132
  <span class="feed-link-title-link">
@@ -543,6 +543,14 @@ export function NavigationContent({
543
543
  comment: "@context: Shown when a pasted address resolves to a draft",
544
544
  }),
545
545
  ),
546
+ addressUnlisted: i18n._(
547
+ msg({
548
+ message:
549
+ "That page is unlisted. Make it Public or Hidden from Latest to add it to the menu.",
550
+ comment:
551
+ "@context: Shown when a pasted address resolves to an unlisted page, which a menu entry would list",
552
+ }),
553
+ ),
546
554
  addressPrivate: i18n._(
547
555
  msg({
548
556
  message: "That page is private, so nobody could open it from a menu.",
@@ -98,7 +98,7 @@ function hourOf(hourKey: string): number {
98
98
  return Number(hourKey.slice(11, 13));
99
99
  }
100
100
 
101
- /** What one point of a series is called under the chart and in its tooltips. */
101
+ /** What one point of a series is called under the chart and in a hovered bar's label. */
102
102
  function pointLabel(series: StatsSeries, at: string, locale: string): string {
103
103
  return series.unit === "hour"
104
104
  ? formatHourLabel(hourOf(at), locale)
@@ -325,12 +325,15 @@ function WindowSwitch({
325
325
  }
326
326
 
327
327
  /**
328
- * One bar per point over the whole window, so a bar is the same width
328
+ * One slot per point over the whole window, so a bar is the same width
329
329
  * whatever the record covers. Today has 24 slots and bars up to the current
330
330
  * hour. A longer window has one slot per day; the days before the record
331
331
  * have no bar and no baseline, since the baseline starts where counting did.
332
332
  * The total line has then already named that day, so the axis carries
333
333
  * today's date alone; it names both ends only when every day was counted.
334
+ * A slot names its point and count in `data-label`, which the stylesheet
335
+ * shows above the bar while the slot is hovered: the whole column answers,
336
+ * so a short bar is as easy to read as a tall one.
334
337
  */
335
338
  function ViewsChart({
336
339
  series,
@@ -365,10 +368,8 @@ function ViewsChart({
365
368
 
366
369
  return (
367
370
  <figure class="settings-stats-figure">
368
- <svg
371
+ <div
369
372
  class="settings-stats-chart"
370
- viewBox={`0 0 ${slots} 100`}
371
- preserveAspectRatio="none"
372
373
  role="img"
373
374
  aria-label={
374
375
  unit === "hour"
@@ -388,36 +389,35 @@ function ViewsChart({
388
389
  )
389
390
  }
390
391
  >
391
- {points.map((point, index) => {
392
- if (index < startIndex) return null;
392
+ {Array.from({ length: slots }, (_, index) => {
393
+ const point = points[index];
394
+ if (!point || index < startIndex) {
395
+ return <span key={`slot-${index}`} class="settings-stats-slot" />;
396
+ }
393
397
  const height = (point.views / peak) * 100;
394
398
  return (
395
- <rect
399
+ <span
396
400
  key={point.at}
397
- class="settings-stats-bar"
398
- x={index + 0.15}
399
- y={100 - height}
400
- width={0.7}
401
- height={height}
401
+ class="settings-stats-slot"
402
+ style={`--stats-height:${height}%`}
403
+ data-label={i18n._(
404
+ msg({
405
+ message:
406
+ "{day}: {count, plural, one {# view} other {# views}}",
407
+ comment:
408
+ "@context: Tooltip on one bar of the stats chart; {day} is a date like Nov 8 or an hour like 14:00",
409
+ }),
410
+ {
411
+ day: pointLabel(series, point.at, locale),
412
+ count: point.views,
413
+ },
414
+ )}
402
415
  >
403
- <title>
404
- {i18n._(
405
- msg({
406
- message:
407
- "{day}: {count, plural, one {# view} other {# views}}",
408
- comment:
409
- "@context: Tooltip on one bar of the stats chart; {day} is a date like Nov 8 or an hour like 14:00",
410
- }),
411
- {
412
- day: pointLabel(series, point.at, locale),
413
- count: point.views,
414
- },
415
- )}
416
- </title>
417
- </rect>
416
+ <span class="settings-stats-bar" />
417
+ </span>
418
418
  );
419
419
  })}
420
- </svg>
420
+ </div>
421
421
  {firstLabel && lastLabel && (
422
422
  <figcaption
423
423
  class={`settings-stats-axis${single ? " settings-stats-axis-single" : ""}`}
@@ -42,6 +42,22 @@ export const LinkCard: FC<TimelineCardProps> = ({
42
42
  ? "u-bookmark-of feed-link-title-link"
43
43
  : "feed-link-title-link";
44
44
 
45
+ /* The row reads: whose site (its icon, when one was stored with the post),
46
+ the domain, then the mark that the link leaves this site. The domain
47
+ stays even with an icon, since an icon a reader doesn't know says
48
+ nothing on its own. */
49
+ const faviconEl = post.previewIconUrl && (
50
+ <img
51
+ src={post.previewIconUrl}
52
+ alt=""
53
+ width={16}
54
+ height={16}
55
+ loading="lazy"
56
+ decoding="async"
57
+ class="feed-link-domain-favicon"
58
+ />
59
+ );
60
+
45
61
  const domainEl =
46
62
  domain &&
47
63
  (safeUrl ? (
@@ -51,12 +67,13 @@ export const LinkCard: FC<TimelineCardProps> = ({
51
67
  target="_blank"
52
68
  rel="noopener noreferrer"
53
69
  >
54
- <Icon name="link-domain" class="feed-link-domain-icon" />
70
+ {faviconEl}
55
71
  <span>{domain}</span>
72
+ <Icon name="link-domain" class="feed-link-domain-icon" />
56
73
  </a>
57
74
  ) : (
58
75
  <div class="feed-link-domain">
59
- <Icon name="link-domain" class="feed-link-domain-icon" />
76
+ {faviconEl}
60
77
  <span>{domain}</span>
61
78
  </div>
62
79
  ));
@@ -9,9 +9,10 @@
9
9
  *
10
10
  * An anonymous reader has no menu and cannot change any of that, and never
11
11
  * receives a draft or private post to begin with, so the same card would carry
12
- * four permanently invisible badges. There we emit only the badges that
13
- * actually apply — usually none at all. Featured is rendered in the footer
14
- * meta instead.
12
+ * five permanently invisible badges. There we emit only the badges that
13
+ * actually apply — usually none at all. Unlisted is the one visibility a
14
+ * reader can meet: it tells someone who opened the link why the homepage
15
+ * won't lead them back. Featured is rendered in the footer meta instead.
15
16
  */
16
17
 
17
18
  import { msg } from "@lingui/core/macro";
@@ -34,6 +35,7 @@ export const PostStatusBadges: FC<{ post: PostStatusBadgeSource }> = ({
34
35
 
35
36
  const isPinned = post.pinned;
36
37
  const isPinnedInCollection = Boolean(post.pinnedInCollection);
38
+ const isUnlisted = post.visibility === "unlisted";
37
39
  const isPrivate = post.visibility === "private";
38
40
  const isDraft = post.status === "draft";
39
41
 
@@ -44,6 +46,7 @@ export const PostStatusBadges: FC<{ post: PostStatusBadgeSource }> = ({
44
46
  !isAuthor &&
45
47
  !isPinned &&
46
48
  !isPinnedInCollection &&
49
+ !isUnlisted &&
47
50
  !isPrivate &&
48
51
  !isDraft
49
52
  ) {
@@ -52,6 +55,7 @@ export const PostStatusBadges: FC<{ post: PostStatusBadgeSource }> = ({
52
55
 
53
56
  const showPinned = isAuthor || isPinned;
54
57
  const showPinnedInCollection = isAuthor || isPinnedInCollection;
58
+ const showUnlisted = isAuthor || isUnlisted;
55
59
  const showPrivate = isAuthor || isPrivate;
56
60
  const showDraft = isAuthor || isDraft;
57
61
 
@@ -76,6 +80,18 @@ export const PostStatusBadges: FC<{ post: PostStatusBadgeSource }> = ({
76
80
  {pinnedLabel}
77
81
  </span>
78
82
  )}
83
+ {showUnlisted && (
84
+ <span class="post-status-badge post-status-unlisted">
85
+ <Icon name="post-status-unlisted" />
86
+ {i18n._(
87
+ msg({
88
+ message: "Unlisted",
89
+ comment:
90
+ "@context: Post status badge for a post that opens for anyone with the link but is listed nowhere",
91
+ }),
92
+ )}
93
+ </span>
94
+ )}
79
95
  {showPrivate && (
80
96
  <span class="post-status-badge post-status-private">
81
97
  <Icon name="post-status-private" />
@@ -10,6 +10,7 @@ import { TimelineItem } from "./TimelineItem.js";
10
10
  import { ThreadPreview } from "./ThreadPreview.js";
11
11
  import { CuratedThreadPreview } from "./CuratedThreadPreview.js";
12
12
  import { PagePagination } from "../shared/Pagination.js";
13
+ import { VIEW_UNIT_ATTRIBUTE, wholeThreadOf } from "../../lib/list-views.js";
13
14
 
14
15
  interface TimelineFeedItemContentProps {
15
16
  item: TimelineItemView;
@@ -35,12 +36,14 @@ export const TimelineFeedItem: FC<TimelineFeedItemProps> = ({
35
36
  item,
36
37
  showDivider = false,
37
38
  }) => {
39
+ const wholeThread = wholeThreadOf(item);
38
40
  return (
39
41
  <div
40
42
  class="feed-item"
41
43
  data-timeline-item
42
44
  data-timeline-item-id={item.post.id}
43
45
  data-thread-root-id={item.post.threadRootId ?? item.post.id}
46
+ {...(wholeThread ? { [VIEW_UNIT_ATTRIBUTE]: wholeThread } : {})}
44
47
  >
45
48
  {showDivider && <hr class="feed-divider" />}
46
49
  <div data-timeline-item-content>
@@ -157,32 +157,49 @@ export function resolveCjkFontProfile(
157
157
  }
158
158
 
159
159
  /*
160
- * Reading rhythm for a CJK page. Han, kana and hangul glyphs fill the em box
161
- * where Latin lowercase sits at the x-height, so the Latin leadings in
162
- * tokens.css pack CJK lines visibly tighter: 1.7 reads as 1.5 does in Latin.
163
- * The surfaces Chinese readers hold up as well set — sspai, WeChat articles —
164
- * run 1.75 to 1.8, and a multi-line Chinese title at 1.2 has its rows touching.
160
+ * Reading rhythm and heading weight for a CJK page.
161
+ *
162
+ * Han, kana and hangul glyphs fill the em box where Latin lowercase sits at
163
+ * the x-height, so the Latin leadings in tokens.css pack CJK lines visibly
164
+ * tighter: 1.7 reads as 1.5 does in Latin. The surfaces Chinese readers hold
165
+ * up as well set — sspai, WeChat articles — run 1.75 to 1.8, and a multi-line
166
+ * Chinese title at 1.2 has its rows touching.
167
+ *
168
+ * Headings step down from the semibold tokens.css sets for Latin faces to
169
+ * medium. The Chinese serif faces have no 500 or 600: Songti SC and the Noto
170
+ * Serif the site ships resolve 600 to Bold, two full steps above the body and
171
+ * far heavier than the New York Semibold beside it, so a bold Song title over
172
+ * a regular sans paragraph reads as a newspaper headline, on a phone most of
173
+ * all. At 500 those faces fall to Regular and the title's size and face carry
174
+ * the hierarchy, as Chinese books set a chapter title; the sans faces
175
+ * (PingFang, Hiragino Sans, Noto Sans CJK) have a Medium and take the half
176
+ * step. A `<strong>` run under a Regular heading is the darker of the two;
177
+ * the heading's size still reads it as the heading.
165
178
  */
166
- const CJK_READING_RHYTHM = {
179
+ const CJK_READING_PROFILE = {
167
180
  "--type-body-leading": "1.75",
168
181
  "--type-heading-leading": "1.3",
182
+ "--type-heading-weight": "var(--fw-medium)",
183
+ "--type-display-weight": "var(--fw-medium)",
169
184
  };
170
185
 
171
186
  /**
172
187
  * Build the CSS variables a page in a CJK language needs: the serif and sans
173
- * fallback stacks for its script, and the reading rhythm its glyphs call for.
188
+ * fallback stacks for its script, the reading rhythm its glyphs call for, and
189
+ * the heading weight its faces have.
174
190
  *
175
191
  * Empty for a language with no profile: `tokens.css` already carries a real
176
- * script-neutral stack in both variables and the Latin leadings, so there is
177
- * nothing to override. `BaseLayout` writes these on `:root` ahead of the theme
178
- * style, so a font theme or custom CSS that sets a leading still wins.
192
+ * script-neutral stack in both variables and the Latin leadings and weights,
193
+ * so there is nothing to override. `BaseLayout` writes these on `:root` ahead
194
+ * of the theme style, so a font theme or custom CSS that sets a leading or a
195
+ * weight still wins.
179
196
  *
180
197
  * @param language - BCP 47 content language tag
181
198
  * @returns CSS variables consumed by every font theme, empty when the token
182
199
  * defaults already apply
183
200
  * @example
184
201
  * getCjkFontCssVariables("zh-Hans")
185
- * // => { "--font-cjk-serif-fallback": '"Songti SC", ...', ..., "--type-body-leading": "1.8", ... }
202
+ * // => { "--font-cjk-serif-fallback": '"Songti SC", ...', ..., "--type-body-leading": "1.75", "--type-heading-weight": "var(--fw-medium)", ... }
186
203
  */
187
204
  export function getCjkFontCssVariables(
188
205
  language?: string,
@@ -192,25 +209,25 @@ export function getCjkFontCssVariables(
192
209
  return {
193
210
  "--font-cjk-serif-fallback": HANS_CJK_SERIF_FALLBACK,
194
211
  "--font-cjk-sans-fallback": HANS_CJK_SANS_FALLBACK,
195
- ...CJK_READING_RHYTHM,
212
+ ...CJK_READING_PROFILE,
196
213
  };
197
214
  case "zh-Hant":
198
215
  return {
199
216
  "--font-cjk-serif-fallback": HANT_CJK_SERIF_FALLBACK,
200
217
  "--font-cjk-sans-fallback": HANT_CJK_SANS_FALLBACK,
201
- ...CJK_READING_RHYTHM,
218
+ ...CJK_READING_PROFILE,
202
219
  };
203
220
  case "ja":
204
221
  return {
205
222
  "--font-cjk-serif-fallback": JP_CJK_SERIF_FALLBACK,
206
223
  "--font-cjk-sans-fallback": JP_CJK_SANS_FALLBACK,
207
- ...CJK_READING_RHYTHM,
224
+ ...CJK_READING_PROFILE,
208
225
  };
209
226
  case "ko":
210
227
  return {
211
228
  "--font-cjk-serif-fallback": KO_CJK_SERIF_FALLBACK,
212
229
  "--font-cjk-sans-fallback": KO_CJK_SANS_FALLBACK,
213
- ...CJK_READING_RHYTHM,
230
+ ...CJK_READING_PROFILE,
214
231
  };
215
232
  default:
216
233
  return {};
@@ -584,6 +584,7 @@ const VISIBILITY_ICONS: Record<
584
584
  > = {
585
585
  public: "globe",
586
586
  latest_hidden: "eye-off",
587
+ unlisted: "link",
587
588
  private: "lock",
588
589
  };
589
590
 
@@ -1,6 +1,7 @@
1
1
  import type { FC } from "hono/jsx";
2
2
  import { msg } from "@lingui/core/macro";
3
3
  import { useLingui } from "../../i18n/context.js";
4
+ import type { I18n } from "../../i18n/i18n.js";
4
5
  import { getIconSvg } from "../../lib/icons.js";
5
6
  import { CopyField } from "../shared/CopyField.js";
6
7
  import { PaginatedPageHeader } from "../shared/PaginatedPageHeader.js";
@@ -35,6 +36,11 @@ export interface SubscribePageProps {
35
36
  * from the main feed, and the complete record.
36
37
  */
37
38
  otherFeeds: readonly SubscribeFeed[];
39
+ /**
40
+ * Page-scoped i18n instance resolved from the view/site language, so this
41
+ * page's prose translates while surrounding public chrome stays on `en`.
42
+ */
43
+ i18n?: I18n;
38
44
  }
39
45
 
40
46
  /**
@@ -60,8 +66,10 @@ const COLUMN_CLASS = "max-w-xl";
60
66
  export const SubscribePage: FC<SubscribePageProps> = ({
61
67
  mainFeed,
62
68
  otherFeeds,
69
+ i18n: pageI18n,
63
70
  }) => {
64
- const { i18n } = useLingui();
71
+ const { i18n: contextI18n } = useLingui();
72
+ const i18n = pageI18n ?? contextI18n;
65
73
 
66
74
  const copyLabel = i18n._(
67
75
  msg({
@@ -14,7 +14,6 @@ import type {
14
14
  } from "../../types.js";
15
15
  import { useLingui } from "../../i18n/context.js";
16
16
  import { canShareAsImage } from "../../lib/share-card.js";
17
- import { sanitizeUrl } from "../../lib/url.js";
18
17
  import { useViewer } from "../../lib/viewer-context.js";
19
18
  import { Icon } from "./Icon.js";
20
19
 
@@ -209,8 +208,6 @@ export const PostFooter: FC<PostFooterProps> = ({ post, detail, display }) => {
209
208
  "@context: Tooltip and screen reader label for the featured-post icon in the post footer when no featured date is available",
210
209
  }),
211
210
  );
212
- const safeExternalUrl =
213
- post.format === "link" && post.url ? sanitizeUrl(post.url) : "";
214
211
  // Drafts get an ordinary footer — the Draft badge above already says what
215
212
  // they are, and their lifecycle actions live in the post menu next to Edit
216
213
  // and Delete rather than in a bespoke button row.
@@ -218,8 +215,7 @@ export const PostFooter: FC<PostFooterProps> = ({ post, detail, display }) => {
218
215
  const hideActions = !!display?.hideActions;
219
216
  const hideReply = !!display?.hideReply;
220
217
  const showReply = !hideReply && post.isLastInThread;
221
- const showCollectionSeparator =
222
- showTimestamp || !!safeExternalUrl || post.featured;
218
+ const showCollectionSeparator = showTimestamp || post.featured;
223
219
  const visibleCollections =
224
220
  post.replyToId || post.threadRootId ? [] : post.collections;
225
221
 
@@ -247,23 +243,6 @@ export const PostFooter: FC<PostFooterProps> = ({ post, detail, display }) => {
247
243
  {showTimestamp && (
248
244
  <PostPublishedLink post={post} className="u-url post-footer-link" />
249
245
  )}
250
- {safeExternalUrl && (
251
- <a
252
- href={safeExternalUrl}
253
- class="post-footer-external-link"
254
- target="_blank"
255
- rel="noopener noreferrer"
256
- aria-label={i18n._(
257
- msg({
258
- message: "Open external link",
259
- comment:
260
- "@context: Accessible label for the external-link icon in the post footer",
261
- }),
262
- )}
263
- >
264
- <Icon name="post-external-link" />
265
- </a>
266
- )}
267
246
  <CompactCollectionTags
268
247
  collections={visibleCollections}
269
248
  showSeparator={showCollectionSeparator}
@@ -63,11 +63,6 @@ const CUSTOM_SYMBOLS = {
63
63
  viewBox: "0 0 24 24",
64
64
  inner: `<circle cx="5" cy="12" r="1.75" fill="currentColor" /><circle cx="12" cy="12" r="1.75" fill="currentColor" /><circle cx="19" cy="12" r="1.75" fill="currentColor" />`,
65
65
  },
66
- // External arrow in a box (used in post footer external link affordance).
67
- "post-external-link": {
68
- viewBox: "0 0 24 24",
69
- inner: `<path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7 17 17 7" /><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M9 7h8v8" />`,
70
- },
71
66
  // Reply arrow (used on "Reply" button).
72
67
  "post-reply": {
73
68
  viewBox: "0 0 24 24",
@@ -112,6 +107,11 @@ const CUSTOM_SYMBOLS = {
112
107
  viewBox: "0 0 24 24",
113
108
  inner: `<path ${STROKE_POST_BADGE} d="M12 20h9" /><path ${STROKE_POST_BADGE} d="M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z" />`,
114
109
  },
110
+ // Post status badge: unlisted (lucide link, thin 1.75 stroke).
111
+ "post-status-unlisted": {
112
+ viewBox: "0 0 24 24",
113
+ inner: `<path ${STROKE_POST_BADGE} d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" /><path ${STROKE_POST_BADGE} d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />`,
114
+ },
115
115
  // Post status badge: private (lucide eye-off, thin 1.75 stroke).
116
116
  "post-status-private": {
117
117
  viewBox: "0 0 24 24",