@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.
Files changed (148) hide show
  1. package/bin/lib/site-snapshot.js +10 -0
  2. package/dist/{app-Gt7_skt6.js → app-CbOZ2Irh.js} +8704 -5180
  3. package/dist/client/.vite/manifest.json +125 -85
  4. package/dist/client/_assets/chunks/{confirm-D7GrwsCN.js → confirm-CMe01lne.js} +1 -1
  5. package/dist/client/_assets/chunks/{create-editor-5Y49x7h5.js → create-editor-hWapNE40.js} +26 -26
  6. package/dist/client/_assets/chunks/footnote-rail-9zwl6jtV.js +2 -0
  7. package/dist/client/_assets/chunks/{jant-locale-picker-DL6mIOT5.js → jant-locale-picker-2L4rkDaz.js} +1 -1
  8. package/dist/client/_assets/chunks/lit-Bw_voPoW.js +2 -0
  9. package/dist/client/_assets/chunks/preload-helper-Czpn1I53.js +1 -0
  10. package/dist/client/_assets/chunks/runtime-paths-y0_gHowM.js +1 -0
  11. package/dist/client/_assets/chunks/{settings-paths-h6RjIe3C.js → settings-paths-BBVT8zKj.js} +1 -1
  12. package/dist/client/_assets/chunks/slug-format-BuCPjSrB.js +1 -0
  13. package/dist/client/_assets/chunks/sortable-list-DJXwkaOv.js +2 -0
  14. package/dist/client/_assets/chunks/types-DrYFqJH2.js +1 -0
  15. package/dist/client/_assets/chunks/{unsafe-html-B5ZEXaxg.js → unsafe-html-CWos3v6N.js} +1 -1
  16. package/dist/client/_assets/chunks/unsafe-svg-CUrgo4Xg.js +1 -0
  17. package/dist/client/_assets/client-BO8GOFfT.js +354 -0
  18. package/dist/client/_assets/client-D8Rrsd73.css +2 -0
  19. package/dist/client/_assets/client-auth-CsUGM718.js +859 -0
  20. package/dist/client/_assets/client-author-QPm1whbO.css +2 -0
  21. package/dist/client/_assets/client-compose-BB4U7Wz0.js +2004 -0
  22. package/dist/client/_assets/{client-manage-C1eDB1Rc.js → client-manage-CI9-eh-8.js} +176 -176
  23. package/dist/client/_assets/{client-settings-DIM44Zqh.js → client-settings-BnGPuqwc.js} +166 -166
  24. package/dist/client/_assets/client-share-0DICJjAc.css +1 -0
  25. package/dist/client/_assets/client-share-C59mOLJ1.js +149 -0
  26. package/dist/index.js +1 -1
  27. package/dist/node.js +3 -2
  28. package/package.json +2 -1
  29. package/src/app.tsx +9 -0
  30. package/src/client/components/compose-types.ts +1 -0
  31. package/src/client/components/jant-compose-dialog.ts +1 -0
  32. package/src/client/components/jant-compose-editor.ts +30 -0
  33. package/src/client/components/jant-compose-fullscreen.ts +1 -0
  34. package/src/client/components/jant-post-menu.ts +80 -13
  35. package/src/client/components/jant-share-dialog.ts +422 -0
  36. package/src/client/components/jant-share-menu.ts +188 -0
  37. package/src/client/compose-bridge.ts +61 -1
  38. package/src/client/feed-video-player.ts +6 -0
  39. package/src/client/lazy-entries.ts +21 -1
  40. package/src/client/post-menu-shared.ts +100 -0
  41. package/src/client/share-capture.ts +443 -0
  42. package/src/client/share-launch.ts +133 -0
  43. package/src/client/tiptap/bubble-menu.ts +25 -2
  44. package/src/client/tiptap/create-editor.ts +2 -0
  45. package/src/client/tiptap/extensions.ts +4 -0
  46. package/src/client/video-processor.ts +106 -52
  47. package/src/client/view-confirm.ts +108 -0
  48. package/src/client-share.ts +8 -0
  49. package/src/client.ts +2 -0
  50. package/src/db/migrations/0035_brainy_next_avengers.sql +9 -0
  51. package/src/db/migrations/0036_gorgeous_smasher.sql +7 -0
  52. package/src/db/migrations/meta/0035_snapshot.json +2877 -0
  53. package/src/db/migrations/meta/0036_snapshot.json +2924 -0
  54. package/src/db/migrations/meta/_journal.json +14 -0
  55. package/src/db/migrations/pg/0033_cute_magdalene.sql +10 -0
  56. package/src/db/migrations/pg/0034_material_agent_brand.sql +8 -0
  57. package/src/db/migrations/pg/meta/0033_snapshot.json +3719 -0
  58. package/src/db/migrations/pg/meta/0034_snapshot.json +3766 -0
  59. package/src/db/migrations/pg/meta/_journal.json +14 -0
  60. package/src/db/pg/schema.ts +40 -0
  61. package/src/db/schema.ts +61 -0
  62. package/src/i18n/locales/public/en.po +5 -0
  63. package/src/i18n/locales/public/en.ts +1 -1
  64. package/src/i18n/locales/public/zh-Hans.po +5 -0
  65. package/src/i18n/locales/public/zh-Hans.ts +1 -1
  66. package/src/i18n/locales/public/zh-Hant.po +5 -0
  67. package/src/i18n/locales/public/zh-Hant.ts +1 -1
  68. package/src/i18n/locales/settings/en.po +149 -0
  69. package/src/i18n/locales/settings/en.ts +1 -1
  70. package/src/i18n/locales/settings/zh-Hans.po +149 -0
  71. package/src/i18n/locales/settings/zh-Hans.ts +1 -1
  72. package/src/i18n/locales/settings/zh-Hant.po +149 -0
  73. package/src/i18n/locales/settings/zh-Hant.ts +1 -1
  74. package/src/lib/discover.ts +31 -0
  75. package/src/lib/env.ts +20 -0
  76. package/src/lib/github-app-state.ts +1 -1
  77. package/src/lib/github-app.ts +183 -1
  78. package/src/lib/markdown-manager.ts +129 -1
  79. package/src/lib/post-meta.ts +13 -3
  80. package/src/lib/referrer-aliases.ts +311 -0
  81. package/src/lib/render.tsx +10 -0
  82. package/src/lib/resolve-config.ts +14 -0
  83. package/src/lib/share-card.ts +653 -0
  84. package/src/lib/summary.ts +152 -54
  85. package/src/lib/tiptap-render.ts +1 -0
  86. package/src/lib/upload.ts +21 -1
  87. package/src/lib/version.ts +2 -0
  88. package/src/lib/video-playback.ts +55 -0
  89. package/src/lib/view-buffer.ts +201 -0
  90. package/src/lib/view-counting.ts +539 -0
  91. package/src/lib/view-token.ts +177 -0
  92. package/src/lib/view.ts +13 -1
  93. package/src/middleware/view-counter.ts +140 -0
  94. package/src/node/runtime.ts +4 -0
  95. package/src/preset.css +31 -14
  96. package/src/routes/api/media.ts +21 -3
  97. package/src/routes/auth/setup.tsx +37 -1
  98. package/src/routes/dash/settings.tsx +433 -168
  99. package/src/routes/pages/archive.tsx +1 -0
  100. package/src/routes/pages/collection.tsx +6 -0
  101. package/src/routes/pages/collections.tsx +1 -0
  102. package/src/routes/pages/featured.tsx +1 -0
  103. package/src/routes/pages/home.tsx +1 -0
  104. package/src/routes/pages/page.tsx +3 -0
  105. package/src/routes/pages/partials.tsx +23 -0
  106. package/src/routes/pages/smart-collection.tsx +2 -0
  107. package/src/routes/pages/subscribe.tsx +1 -0
  108. package/src/routes/view-confirm.ts +63 -0
  109. package/src/services/export-theme/assets/client-site.js +1 -1
  110. package/src/services/export-theme/styles/main.css +39 -21
  111. package/src/services/export.ts +2 -0
  112. package/src/services/index.ts +17 -0
  113. package/src/services/mcp.ts +31 -1
  114. package/src/services/media.ts +63 -0
  115. package/src/services/stats.ts +1130 -0
  116. package/src/style-share.css +16 -0
  117. package/src/styles/components-author.css +177 -0
  118. package/src/styles/components.css +25 -3
  119. package/src/styles/share.css +1103 -0
  120. package/src/styles/tokens.css +65 -30
  121. package/src/styles/ui.css +62 -13
  122. package/src/types/app-context.ts +9 -0
  123. package/src/types/bindings.ts +5 -0
  124. package/src/types/config.ts +54 -0
  125. package/src/types/views.ts +6 -0
  126. package/src/ui/compose/ComposeDialog.tsx +6 -0
  127. package/src/ui/dash/settings/SettingsRootContent.tsx +24 -6
  128. package/src/ui/dash/settings/StatsContent.tsx +855 -0
  129. package/src/ui/font-themes.ts +39 -6
  130. package/src/ui/layouts/BaseLayout.tsx +11 -2
  131. package/src/ui/layouts/SiteLayout.tsx +9 -3
  132. package/src/ui/share/ShareCard.tsx +298 -0
  133. package/src/ui/shared/Icon.tsx +23 -3
  134. package/src/ui/shared/MediaGallery.tsx +31 -4
  135. package/src/ui/shared/PostFooter.tsx +20 -4
  136. package/src/ui/shared/icon-collector.ts +28 -0
  137. package/src/ui/shared/post-article-attributes.ts +3 -0
  138. package/dist/client/_assets/chunks/footnote-rail-BJwswtVQ.js +0 -1
  139. package/dist/client/_assets/chunks/lit-DW8VmJAT.js +0 -2
  140. package/dist/client/_assets/chunks/slug-format-Dsi0e9Xn.js +0 -1
  141. package/dist/client/_assets/chunks/sortable-list-DWNKv782.js +0 -2
  142. package/dist/client/_assets/chunks/types-D5iF3H1a.js +0 -1
  143. package/dist/client/_assets/chunks/unsafe-svg-DTZZEvLU.js +0 -2
  144. package/dist/client/_assets/client-BaqmpPQ-.css +0 -2
  145. package/dist/client/_assets/client-C6melOtG.js +0 -296
  146. package/dist/client/_assets/client-auth-Ccq8kSqq.js +0 -828
  147. package/dist/client/_assets/client-author-CGVvrNZ8.css +0 -2
  148. package/dist/client/_assets/client-compose-oxzPb3SS.js +0 -2004
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as createApp$1 } from "./app-Gt7_skt6.js";
1
+ import { n as createApp$1 } from "./app-CbOZ2Irh.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 getTelegramWebhookSecret, B as isAssetPath, C as getConfiguredSingleSitePathPrefix, D as getPort, E as getHostedControlPlaneBaseUrl, F as getFontThemeCssVariables, I as resolveCjkFontProfile, L as buildThemeStyle, M as now, N as BUILTIN_FONT_THEMES, O as getSiteResolutionMode, P as getCjkFontCssVariables, R as BUILTIN_COLOR_THEMES, S as getConfiguredSingleSiteOrigin, T as getEnvString, _ as resolveConfig, a as createNodeCliRuntime, b as setWebhook, c as createSiteService, d as createExportService, f as createStorageDriver, g as schema_exports, h as createNodeDatabase, i as listPendingMigrations, j as shouldTrustProxy, k as getTelegramBotPool, l as getHostBasedStartupConfigurationIssues, m as sqliteSchemaBundle, n as createApp, o as createNodeRequestRuntime, p as pgSchemaBundle, r as PendingMigrationsError, s as setUpNodeInstance, u as resolveDatabaseDialect, v as getWebhookUrl, w as getConfiguredStorageDriver, x as getEnvValueIssues, y as setMyCommands, z as getPublicAssetBasePath } from "./app-Gt7_skt6.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-CbOZ2Irh.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-Gt7_skt6.js").then((n) => n.t)).createApp(),
629
+ app: async () => app ?? (await import("./app-CbOZ2Irh.js").then((n) => n.t)).createApp(),
630
630
  assetRoot: options.assetRoot
631
631
  });
632
632
  const hostname = resolveHost(env);
@@ -664,6 +664,7 @@ async function start(env = process.env, app, options = {}) {
664
664
  });
665
665
  });
666
666
  } finally {
667
+ await viewBuffer.flush();
667
668
  await handler.close();
668
669
  }
669
670
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jant/core",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "A modern, open-source microblogging platform built on Cloudflare Workers",
5
5
  "type": "module",
6
6
  "exports": {
@@ -89,6 +89,7 @@
89
89
  "@types/pg": "^8.20.0",
90
90
  "@types/yauzl": "^3.4.0",
91
91
  "@types/yazl": "^3.3.1",
92
+ "@zumer/snapdom": "^3.4.0",
92
93
  "basecoat-css": "^0.3.11",
93
94
  "cn-font-split": "^7.4.1",
94
95
  "drizzle-kit": "^0.31.10",
package/src/app.tsx CHANGED
@@ -79,6 +79,8 @@ import { defaultCacheControl, noStore } from "./middleware/cache-control.js";
79
79
  import { requireOnboarding } from "./middleware/onboarding.js";
80
80
  import { errorHandler, notFoundHandler } from "./middleware/error-handler.js";
81
81
  import { prefetchSettings, withConfig } from "./middleware/config.js";
82
+ import { viewCounter } from "./middleware/view-counter.js";
83
+ import { viewConfirmRoutes } from "./routes/view-confirm.js";
82
84
  import { secureHeadersMiddleware } from "./middleware/secure-headers.js";
83
85
  import { apiCors } from "./middleware/cors.js";
84
86
  import { rejectCrossOriginWrites } from "./middleware/cross-origin.js";
@@ -549,6 +551,12 @@ export function createApp(): HonoApp {
549
551
  app.use("*", withConfig());
550
552
  app.use("*", i18nMiddleware());
551
553
 
554
+ // Page views: the page routes below name what they rendered
555
+ // (`c.var.viewTarget`), this marks the response with a view token, and
556
+ // `/_/seen` counts the view once the browser confirms it. Needs the
557
+ // config above for the stats switch.
558
+ app.use("*", viewCounter());
559
+
552
560
  // --- Routes that need config ---
553
561
 
554
562
  // Public machine-readable site guide
@@ -606,6 +614,7 @@ export function createApp(): HonoApp {
606
614
  app.route("/subscribe", subscribeRoutes);
607
615
  app.route("/latest", latestRoutes);
608
616
  app.route("/", partialPageRoutes);
617
+ app.route("/_", viewConfirmRoutes);
609
618
  app.route("/_", brandRoutes);
610
619
  app.route("/_", themeSampleRoutes);
611
620
  app.route("/collections", collectionsPageRoutes);
@@ -347,6 +347,7 @@ export interface ComposeLabels {
347
347
  editing: string;
348
348
  composeDialogLabel: string;
349
349
  slashHint: string;
350
+ highlight: string;
350
351
  tableControls: TableControlLabels;
351
352
  collectionFormLabels: CollectionFormLabels;
352
353
  }
@@ -2970,6 +2970,7 @@ export class JantComposeDialog extends LitElement {
2970
2970
  content,
2971
2971
  toolbarMode: "compose",
2972
2972
  tableControlLabels: this.labels.tableControls,
2973
+ highlightLabel: this.labels.highlight,
2973
2974
  });
2974
2975
  this._focusAttachedEditorBoundary(content);
2975
2976
  });
@@ -1130,6 +1130,7 @@ export class JantComposeEditor extends LitElement {
1130
1130
  },
1131
1131
  imageNodeLabels: getInlineImageNodeLabels(this.labels),
1132
1132
  tableControlLabels: this.labels.tableControls,
1133
+ highlightLabel: this.labels.highlight,
1133
1134
  });
1134
1135
  this._lastEditorSelection = this._readEditorSelection();
1135
1136
  // An editor built from existing content — after a format switch, or on a
@@ -1331,6 +1332,34 @@ export class JantComposeEditor extends LitElement {
1331
1332
  return this._attachments.some((a) => a.clientId === clientId);
1332
1333
  }
1333
1334
 
1335
+ /**
1336
+ * Ask for posters for the uploaded videos that have none. A clip that came
1337
+ * in through the API without a poster gets one made here, in the author's
1338
+ * browser, the only place every deployment can decode video. The bridge
1339
+ * stores it and shows it on the card.
1340
+ */
1341
+ #requestMissingPosters() {
1342
+ const attachments = this._attachments.flatMap((a) =>
1343
+ a.file.type.startsWith("video/") &&
1344
+ a.mediaId &&
1345
+ a.remoteUrl &&
1346
+ a.posterUrl === null
1347
+ ? [{ clientId: a.clientId, mediaId: a.mediaId, url: a.remoteUrl }]
1348
+ : [],
1349
+ );
1350
+ if (attachments.length === 0) return;
1351
+
1352
+ // Wait for the render, so the event leaves from a connected editor.
1353
+ void this.updateComplete.then(() => {
1354
+ this.dispatchEvent(
1355
+ new CustomEvent("jant:video-posters-missing", {
1356
+ bubbles: true,
1357
+ detail: { attachments },
1358
+ }),
1359
+ );
1360
+ });
1361
+ }
1362
+
1334
1363
  /** Pre-fill all fields for edit mode or draft restore */
1335
1364
  populate(data: {
1336
1365
  format: string;
@@ -1418,6 +1447,7 @@ export class JantComposeEditor extends LitElement {
1418
1447
  }));
1419
1448
  this._attachments = attachments;
1420
1449
  this._attachmentOrder = attachments.map((a) => a.clientId);
1450
+ this.#requestMissingPosters();
1421
1451
  }
1422
1452
 
1423
1453
  // Restore attached texts from server data
@@ -165,6 +165,7 @@ export class JantComposeFullscreen extends LitElement {
165
165
  },
166
166
  imageNodeLabels: getInlineImageNodeLabels(this.labels),
167
167
  tableControlLabels: this.labels.tableControls,
168
+ highlightLabel: this.labels.highlight,
168
169
  });
169
170
 
170
171
  const selection = this._selection;
@@ -22,6 +22,13 @@ import { readErrorMessage } from "../json.js";
22
22
  import { publicPath } from "../runtime-paths.js";
23
23
  import { looksLikeAddress } from "../../lib/url.js";
24
24
  import { pickPost } from "../post-picker.js";
25
+ import { openShareImage, warmShareImage } from "../share-launch.js";
26
+ import {
27
+ copyPostLink,
28
+ iconImage,
29
+ iconLink,
30
+ menuOpensAbove,
31
+ } from "../post-menu-shared.js";
25
32
  import {
26
33
  ensureComposeDialog,
27
34
  readComposeDialogLabels,
@@ -45,6 +52,8 @@ interface PostMenuData {
45
52
  isDraft: boolean;
46
53
  /** Content language of the Thread, when the site publishes more than one. */
47
54
  language: string | null;
55
+ /** Where the post's date links to, for Copy link. */
56
+ permalink: string | null;
48
57
  }
49
58
 
50
59
  /** One language the site publishes. */
@@ -115,19 +124,7 @@ type PostMenuView =
115
124
  const LANGUAGE_PANEL_FOCUS =
116
125
  "[data-post-menu-translation] a, [data-post-menu-translation-first], [data-post-menu-open-language-switch]";
117
126
 
118
- interface MenuTriggerRect {
119
- top: number;
120
- bottom: number;
121
- }
122
-
123
127
  const ESTIMATED_MENU_HEIGHT = 360;
124
- const MENU_VIEWPORT_MARGIN = 12;
125
-
126
- function getMenuPlacement(rect: MenuTriggerRect) {
127
- const spaceBelow = window.innerHeight - rect.bottom - MENU_VIEWPORT_MARGIN;
128
- const spaceAbove = rect.top - MENU_VIEWPORT_MARGIN;
129
- return spaceBelow < ESTIMATED_MENU_HEIGHT && spaceAbove > spaceBelow;
130
- }
131
128
 
132
129
  export function removeLeadingFeedDivider(
133
130
  feedContainer: HTMLElement | null | undefined,
@@ -143,6 +140,14 @@ export function removeLeadingFeedDivider(
143
140
  firstDivider?.remove();
144
141
  }
145
142
 
143
+ /**
144
+ * The image carries a QR code to the post, which a reader can open only once
145
+ * it is published and not Private.
146
+ */
147
+ function canShareAsImage(data: PostMenuData): boolean {
148
+ return !data.isDraft && data.visibility !== "private";
149
+ }
150
+
146
151
  function findThreadRootArticle(threadId: string): HTMLElement | null {
147
152
  return (
148
153
  Array.from(
@@ -171,6 +176,7 @@ function readPostMenuData(article: HTMLElement): PostMenuData | null {
171
176
  isDraft: article.hasAttribute("data-post-draft"),
172
177
  // Carried on the Thread root, so a reply reads it from there.
173
178
  language: threadRootArticle.dataset.postLanguage ?? null,
179
+ permalink: article.dataset.postPermalink ?? null,
174
180
  };
175
181
  }
176
182
 
@@ -264,7 +270,7 @@ export class JantPostMenu extends LitElement {
264
270
  }
265
271
 
266
272
  const rect = trigger.getBoundingClientRect();
267
- this._openAbove = getMenuPlacement(rect);
273
+ this._openAbove = menuOpensAbove(rect, ESTIMATED_MENU_HEIGHT);
268
274
  this._x = window.scrollX + rect.right;
269
275
  this._y =
270
276
  window.scrollY + (this._openAbove ? rect.top - 6 : rect.bottom + 6);
@@ -379,6 +385,7 @@ export class JantPostMenu extends LitElement {
379
385
  this._view = "menu";
380
386
  this._open = true;
381
387
  this.#focusAfterUpdate("[data-post-menu-item-primary]");
388
+ if (canShareAsImage(menuData)) warmShareImage();
382
389
  return;
383
390
  }
384
391
 
@@ -1022,6 +1029,20 @@ export class JantPostMenu extends LitElement {
1022
1029
  }
1023
1030
  }
1024
1031
 
1032
+ #copyLink() {
1033
+ const permalink = this._data?.permalink;
1034
+ this.#close();
1035
+ if (permalink) void copyPostLink(permalink);
1036
+ }
1037
+
1038
+ #shareImage() {
1039
+ if (!this._data) return;
1040
+ const postId = this._data.id;
1041
+ const trigger = this._triggerEl;
1042
+ this.#close({ restoreFocus: false });
1043
+ void openShareImage(postId, trigger);
1044
+ }
1045
+
1025
1046
  async #publish() {
1026
1047
  if (!this._data) return;
1027
1048
  const postId = this._data.id;
@@ -2283,6 +2304,9 @@ export class JantPostMenu extends LitElement {
2283
2304
  "[data-collection-id]",
2284
2305
  )?.dataset.collectionId;
2285
2306
  const isFeatured = this._data.featured;
2307
+ // A draft has no address to pass on yet.
2308
+ const canCopyLink = !this._data.isDraft && !!this._data.permalink;
2309
+ const canShare = canShareAsImage(this._data);
2286
2310
 
2287
2311
  return html`
2288
2312
  <div class="post-menu-view post-menu-main">
@@ -2459,6 +2483,49 @@ export class JantPostMenu extends LitElement {
2459
2483
  }
2460
2484
  </div>
2461
2485
 
2486
+ ${
2487
+ canCopyLink || canShare
2488
+ ? html`
2489
+ <div class="post-menu-section">
2490
+ ${
2491
+ canCopyLink
2492
+ ? html`<button
2493
+ type="button"
2494
+ role="menuitem"
2495
+ class="post-menu-item"
2496
+ data-post-menu-copy-link
2497
+ @click=${() => this.#copyLink()}
2498
+ >
2499
+ <span class="post-menu-item-label">Copy link</span>
2500
+ <span class="post-menu-item-trailing"
2501
+ >${iconLink()}</span
2502
+ >
2503
+ </button>`
2504
+ : nothing
2505
+ }
2506
+ ${
2507
+ canShare
2508
+ ? html`<button
2509
+ type="button"
2510
+ role="menuitem"
2511
+ class="post-menu-item"
2512
+ data-post-menu-share-image
2513
+ @click=${() => this.#shareImage()}
2514
+ >
2515
+ <span class="post-menu-item-label"
2516
+ >Share as image</span
2517
+ >
2518
+ <span class="post-menu-item-trailing"
2519
+ >${iconImage()}</span
2520
+ >
2521
+ </button>`
2522
+ : nothing
2523
+ }
2524
+ </div>
2525
+ `
2526
+ : nothing
2527
+ }
2528
+
2462
2529
  <div class="post-menu-section post-menu-section-danger">
2463
2530
  <button
2464
2531
  type="button"