@jant/core 1.0.1 → 1.1.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/dist/{app-Gt7_skt6.js → app-CKQ9PqAr.js} +791 -89
- package/dist/client/.vite/manifest.json +115 -75
- package/dist/client/_assets/chunks/{confirm-D7GrwsCN.js → confirm-CMe01lne.js} +1 -1
- package/dist/client/_assets/chunks/{create-editor-5Y49x7h5.js → create-editor-BQkrw8Ax.js} +4 -4
- package/dist/client/_assets/chunks/footnote-rail-B08scyhW.js +2 -0
- package/dist/client/_assets/chunks/{jant-locale-picker-DL6mIOT5.js → jant-locale-picker-2L4rkDaz.js} +1 -1
- package/dist/client/_assets/chunks/lit-Bw_voPoW.js +2 -0
- package/dist/client/_assets/chunks/preload-helper-Czpn1I53.js +1 -0
- package/dist/client/_assets/chunks/runtime-paths-y0_gHowM.js +1 -0
- package/dist/client/_assets/chunks/{settings-paths-h6RjIe3C.js → settings-paths-B0bNUaih.js} +1 -1
- package/dist/client/_assets/chunks/slug-format-CYmQE5ln.js +1 -0
- package/dist/client/_assets/chunks/{sortable-list-DWNKv782.js → sortable-list-t11Ma1Ek.js} +1 -1
- package/dist/client/_assets/chunks/{unsafe-html-B5ZEXaxg.js → unsafe-html-CWos3v6N.js} +1 -1
- package/dist/client/_assets/chunks/unsafe-svg-DZl-yjas.js +1 -0
- package/dist/client/_assets/client-B0-s9sqx.css +2 -0
- package/dist/client/_assets/client-Dp46QSht.js +354 -0
- package/dist/client/_assets/client-auth-CG55rWb5.js +859 -0
- package/dist/client/_assets/{client-compose-oxzPb3SS.js → client-compose-DkUTuavR.js} +261 -261
- package/dist/client/_assets/{client-manage-C1eDB1Rc.js → client-manage-DnYdQAhf.js} +176 -176
- package/dist/client/_assets/{client-settings-DIM44Zqh.js → client-settings-CHgsIqXJ.js} +166 -166
- package/dist/client/_assets/client-share-0DICJjAc.css +1 -0
- package/dist/client/_assets/client-share-C59mOLJ1.js +149 -0
- package/dist/index.js +1 -1
- package/dist/node.js +2 -2
- package/package.json +2 -1
- package/src/client/components/jant-post-menu.ts +80 -13
- package/src/client/components/jant-share-dialog.ts +422 -0
- package/src/client/components/jant-share-menu.ts +188 -0
- package/src/client/lazy-entries.ts +21 -1
- package/src/client/post-menu-shared.ts +100 -0
- package/src/client/share-capture.ts +443 -0
- package/src/client/share-launch.ts +133 -0
- package/src/client-share.ts +8 -0
- package/src/client.ts +1 -0
- package/src/lib/discover.ts +31 -0
- package/src/lib/share-card.ts +653 -0
- package/src/lib/version.ts +2 -0
- package/src/routes/auth/setup.tsx +37 -1
- package/src/routes/pages/partials.tsx +23 -0
- package/src/style-share.css +16 -0
- package/src/styles/components.css +14 -0
- package/src/styles/share.css +1103 -0
- package/src/styles/ui.css +6 -0
- package/src/ui/layouts/BaseLayout.tsx +7 -0
- package/src/ui/layouts/SiteLayout.tsx +1 -0
- package/src/ui/share/ShareCard.tsx +298 -0
- package/src/ui/shared/Icon.tsx +23 -3
- package/src/ui/shared/MediaGallery.tsx +12 -1
- package/src/ui/shared/PostFooter.tsx +20 -4
- package/src/ui/shared/icon-collector.ts +28 -0
- package/src/ui/shared/post-article-attributes.ts +3 -0
- package/dist/client/_assets/chunks/footnote-rail-BJwswtVQ.js +0 -1
- package/dist/client/_assets/chunks/lit-DW8VmJAT.js +0 -2
- package/dist/client/_assets/chunks/slug-format-Dsi0e9Xn.js +0 -1
- package/dist/client/_assets/chunks/unsafe-svg-DTZZEvLU.js +0 -2
- package/dist/client/_assets/client-BaqmpPQ-.css +0 -2
- package/dist/client/_assets/client-C6melOtG.js +0 -296
- package/dist/client/_assets/client-auth-Ccq8kSqq.js +0 -828
|
@@ -5464,22 +5464,25 @@ function normalizeThemeColorForMeta(color) {
|
|
|
5464
5464
|
*
|
|
5465
5465
|
* The dev flag itself lives in `build-env.ts`, which client bundles can import
|
|
5466
5466
|
* without these Worker-only globals.
|
|
5467
|
-
*/ var CORE_VERSION = "1.0
|
|
5468
|
-
var CLIENT_JS_FILE = "/_assets/client-
|
|
5469
|
-
var CLIENT_AUTH_JS_FILE = "/_assets/client-auth-
|
|
5467
|
+
*/ var CORE_VERSION = "1.1.0-3e911729729c95a2";
|
|
5468
|
+
var CLIENT_JS_FILE = "/_assets/client-Dp46QSht.js";
|
|
5469
|
+
var CLIENT_AUTH_JS_FILE = "/_assets/client-auth-CG55rWb5.js";
|
|
5470
5470
|
var CLIENT_COMPOSE_PRELOAD = [
|
|
5471
|
-
"/_assets/client-compose-
|
|
5472
|
-
"/_assets/chunks/create-editor-
|
|
5471
|
+
"/_assets/client-compose-DkUTuavR.js",
|
|
5472
|
+
"/_assets/chunks/create-editor-BQkrw8Ax.js",
|
|
5473
5473
|
"/_assets/chunks/types-D5iF3H1a.js",
|
|
5474
|
-
"/_assets/chunks/
|
|
5475
|
-
"/_assets/chunks/sortable-list-
|
|
5476
|
-
"/_assets/chunks/unsafe-html-
|
|
5477
|
-
"/_assets/chunks/
|
|
5478
|
-
"/_assets/chunks/
|
|
5479
|
-
"/_assets/chunks/
|
|
5474
|
+
"/_assets/chunks/runtime-paths-y0_gHowM.js",
|
|
5475
|
+
"/_assets/chunks/sortable-list-t11Ma1Ek.js",
|
|
5476
|
+
"/_assets/chunks/unsafe-html-CWos3v6N.js",
|
|
5477
|
+
"/_assets/chunks/lit-Bw_voPoW.js",
|
|
5478
|
+
"/_assets/chunks/slug-format-CYmQE5ln.js",
|
|
5479
|
+
"/_assets/chunks/unsafe-svg-DZl-yjas.js",
|
|
5480
|
+
"/_assets/chunks/footnote-rail-B08scyhW.js",
|
|
5481
|
+
"/_assets/chunks/preload-helper-Czpn1I53.js"
|
|
5480
5482
|
];
|
|
5481
|
-
var CLIENT_CSS_FILE = "/_assets/client-
|
|
5483
|
+
var CLIENT_CSS_FILE = "/_assets/client-B0-s9sqx.css";
|
|
5482
5484
|
var CLIENT_AUTHOR_CSS_FILE = "/_assets/client-author-CGVvrNZ8.css";
|
|
5485
|
+
var CLIENT_SHARE_CSS_FILE = "/_assets/client-share-0DICJjAc.css";
|
|
5483
5486
|
var CLIENT_CJK_CSS_FILE = "/_assets/client-cjk-B7Z0snDu.css";
|
|
5484
5487
|
var CLIENT_CJK_TC_CSS_FILE = "/_assets/client-cjk-tc-BesJYrb2.css";
|
|
5485
5488
|
var CLIENT_CJK_JP_CSS_FILE = "/_assets/client-cjk-jp-DZwrTzQC.css";
|
|
@@ -5753,36 +5756,35 @@ var BUILTIN_FONT_THEMES = [
|
|
|
5753
5756
|
*/ function collectIcon(name) {
|
|
5754
5757
|
currentCollector?.add(name);
|
|
5755
5758
|
}
|
|
5759
|
+
var inline = false;
|
|
5760
|
+
/**
|
|
5761
|
+
* Render `fn` with every `<Icon>` drawn inline instead of pointing into the
|
|
5762
|
+
* page's sprite. For markup that leaves the page it was rendered for — the
|
|
5763
|
+
* share card is copied into an image on its own, where a `<use>` reference
|
|
5764
|
+
* to the page's sprite would come out empty. Call it around the string
|
|
5765
|
+
* conversion, not the JSX creation: components run when the tree is
|
|
5766
|
+
* stringified.
|
|
5767
|
+
*
|
|
5768
|
+
* @param fn - Renders the markup to a string
|
|
5769
|
+
* @returns What `fn` returns
|
|
5770
|
+
*/ function renderIconsInline(fn) {
|
|
5771
|
+
const previous = inline;
|
|
5772
|
+
inline = true;
|
|
5773
|
+
try {
|
|
5774
|
+
return fn();
|
|
5775
|
+
} finally {
|
|
5776
|
+
inline = previous;
|
|
5777
|
+
}
|
|
5778
|
+
}
|
|
5779
|
+
/** Whether `<Icon>` is drawing inline (see {@link renderIconsInline}). */ function iconsRenderInline() {
|
|
5780
|
+
return inline;
|
|
5781
|
+
}
|
|
5756
5782
|
/**
|
|
5757
5783
|
* Get the icon names collected so far during this render.
|
|
5758
5784
|
* Returns an empty set if no collection scope is active.
|
|
5759
5785
|
*/ function getCollectedIcons() {
|
|
5760
5786
|
return currentCollector ?? /* @__PURE__ */ new Set();
|
|
5761
5787
|
}
|
|
5762
|
-
//#endregion
|
|
5763
|
-
//#region src/lib/featured-icons.ts
|
|
5764
|
-
/**
|
|
5765
|
-
* Shared icon definitions for featured post affordances.
|
|
5766
|
-
*
|
|
5767
|
-
* These paths are reused across Hono JSX, Lit, and exported static markup so
|
|
5768
|
-
* "Featured" keeps one visual language everywhere.
|
|
5769
|
-
*/ var FEATURED_SPARKLE_PATH = "M12 3 10.1 10.1 3 12l7.1 1.9L12 21l1.9-7.1L21 12l-7.1-1.9Z";
|
|
5770
|
-
var FEATURED_SPARKLE_OFF_SLASH_PATH = "M4 4 20 20";
|
|
5771
|
-
/**
|
|
5772
|
-
* Build inline SVG markup for the shared featured sparkle icon.
|
|
5773
|
-
*
|
|
5774
|
-
* @param options - Render options for the sparkle icon.
|
|
5775
|
-
* @returns SVG markup string for inline insertion.
|
|
5776
|
-
* @example
|
|
5777
|
-
* getFeaturedIconSvg({ off: true, className: "icon-fine" });
|
|
5778
|
-
*/ function getFeaturedIconSvg(options = {}) {
|
|
5779
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round"${options.className ? ` class="${options.className}"` : ""} aria-hidden="true"><path d="${FEATURED_SPARKLE_PATH}" />${options.off ? `<path d="${FEATURED_SPARKLE_OFF_SLASH_PATH}" />` : ""}</svg>`;
|
|
5780
|
-
}
|
|
5781
|
-
//#endregion
|
|
5782
|
-
//#region src/lib/decorative-quote-mark.ts
|
|
5783
|
-
var DECORATIVE_QUOTE_MARK_VIEWBOX = "0 0 96 96";
|
|
5784
|
-
var DECORATIVE_QUOTE_MARK_PATHS = ["M24.4 10.5C16.9 17.7 11.5 26.8 8.2 37.7C4.9 48.7 4.8 58.9 7.8 68.2C10.3 75.7 15.4 79.5 22.9 79.5C28 79.5 32.2 77.8 35.4 74.2C38.6 70.7 40.2 66.5 40.2 61.4C40.2 56.5 38.8 52.6 36 49.6C33.3 46.6 29.7 45.1 25.2 45.1C23.4 45.1 21.8 45.3 20.2 45.8C22.2 37.3 26.7 29.2 33.6 21.4L24.4 10.5Z", "M60.8 10.5C53.3 17.7 47.9 26.8 44.6 37.7C41.3 48.7 41.2 58.9 44.2 68.2C46.7 75.7 51.8 79.5 59.3 79.5C64.4 79.5 68.6 77.8 71.8 74.2C75 70.7 76.6 66.5 76.6 61.4C76.6 56.5 75.2 52.6 72.4 49.6C69.7 46.6 66.1 45.1 61.6 45.1C59.8 45.1 58.2 45.3 56.6 45.8C58.6 37.3 63.1 29.2 70 21.4L60.8 10.5Z"];
|
|
5785
|
-
DECORATIVE_QUOTE_MARK_PATHS.map((path) => `<path fill="currentColor" d="${path}" />`).join("");
|
|
5786
5788
|
/**
|
|
5787
5789
|
* @license lucide-static v0.577.0 - ISC
|
|
5788
5790
|
*
|
|
@@ -6658,6 +6660,30 @@ Object.keys(LUCIDE_ICONS);
|
|
|
6658
6660
|
*/ var LUCIDE_SYMBOL_ATTRS = "fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"";
|
|
6659
6661
|
var LUCIDE_VIEWBOX = "0 0 24 24";
|
|
6660
6662
|
//#endregion
|
|
6663
|
+
//#region src/lib/featured-icons.ts
|
|
6664
|
+
/**
|
|
6665
|
+
* Shared icon definitions for featured post affordances.
|
|
6666
|
+
*
|
|
6667
|
+
* These paths are reused across Hono JSX, Lit, and exported static markup so
|
|
6668
|
+
* "Featured" keeps one visual language everywhere.
|
|
6669
|
+
*/ var FEATURED_SPARKLE_PATH = "M12 3 10.1 10.1 3 12l7.1 1.9L12 21l1.9-7.1L21 12l-7.1-1.9Z";
|
|
6670
|
+
var FEATURED_SPARKLE_OFF_SLASH_PATH = "M4 4 20 20";
|
|
6671
|
+
/**
|
|
6672
|
+
* Build inline SVG markup for the shared featured sparkle icon.
|
|
6673
|
+
*
|
|
6674
|
+
* @param options - Render options for the sparkle icon.
|
|
6675
|
+
* @returns SVG markup string for inline insertion.
|
|
6676
|
+
* @example
|
|
6677
|
+
* getFeaturedIconSvg({ off: true, className: "icon-fine" });
|
|
6678
|
+
*/ function getFeaturedIconSvg(options = {}) {
|
|
6679
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round"${options.className ? ` class="${options.className}"` : ""} aria-hidden="true"><path d="${FEATURED_SPARKLE_PATH}" />${options.off ? `<path d="${FEATURED_SPARKLE_OFF_SLASH_PATH}" />` : ""}</svg>`;
|
|
6680
|
+
}
|
|
6681
|
+
//#endregion
|
|
6682
|
+
//#region src/lib/decorative-quote-mark.ts
|
|
6683
|
+
var DECORATIVE_QUOTE_MARK_VIEWBOX = "0 0 96 96";
|
|
6684
|
+
var DECORATIVE_QUOTE_MARK_PATHS = ["M24.4 10.5C16.9 17.7 11.5 26.8 8.2 37.7C4.9 48.7 4.8 58.9 7.8 68.2C10.3 75.7 15.4 79.5 22.9 79.5C28 79.5 32.2 77.8 35.4 74.2C38.6 70.7 40.2 66.5 40.2 61.4C40.2 56.5 38.8 52.6 36 49.6C33.3 46.6 29.7 45.1 25.2 45.1C23.4 45.1 21.8 45.3 20.2 45.8C22.2 37.3 26.7 29.2 33.6 21.4L24.4 10.5Z", "M60.8 10.5C53.3 17.7 47.9 26.8 44.6 37.7C41.3 48.7 41.2 58.9 44.2 68.2C46.7 75.7 51.8 79.5 59.3 79.5C64.4 79.5 68.6 77.8 71.8 74.2C75 70.7 76.6 66.5 76.6 61.4C76.6 56.5 75.2 52.6 72.4 49.6C69.7 46.6 66.1 45.1 61.6 45.1C59.8 45.1 58.2 45.3 56.6 45.8C58.6 37.3 63.1 29.2 70 21.4L60.8 10.5Z"];
|
|
6685
|
+
DECORATIVE_QUOTE_MARK_PATHS.map((path) => `<path fill="currentColor" d="${path}" />`).join("");
|
|
6686
|
+
//#endregion
|
|
6661
6687
|
//#region src/ui/shared/custom-icons.ts
|
|
6662
6688
|
/**
|
|
6663
6689
|
* Custom (non-lucide) SVG symbol definitions used by the icon sprite.
|
|
@@ -6791,10 +6817,18 @@ var CUSTOM_SYMBOLS = {
|
|
|
6791
6817
|
* custom symbols defined in `custom-icons.ts`; any other name fails the
|
|
6792
6818
|
* type check.
|
|
6793
6819
|
*
|
|
6820
|
+
* Inside `renderIconsInline()` it draws the icon's own paths instead, for
|
|
6821
|
+
* markup that is copied out of the page (the share card).
|
|
6822
|
+
*
|
|
6794
6823
|
* Size: outer <svg> width/height in pixels. Defaults to 24 (lucide default).
|
|
6795
6824
|
* Pass `class` to add CSS classes, e.g. for sizing via stylesheet instead
|
|
6796
6825
|
* of inline width/height.
|
|
6797
|
-
*/
|
|
6826
|
+
*/
|
|
6827
|
+
/** The icon's own drawing, as its sprite symbol would carry it. */ function inlineIconMarkup(name) {
|
|
6828
|
+
if (isCustomIconName(name)) return getCustomSymbol(name).inner;
|
|
6829
|
+
return `<g ${LUCIDE_SYMBOL_ATTRS}>${getIconInnerSvg(name)}</g>`;
|
|
6830
|
+
}
|
|
6831
|
+
var Icon$1 = ({ name, size, class: cls, "aria-label": ariaLabel, "aria-hidden": ariaHidden }) => {
|
|
6798
6832
|
collectIcon(name);
|
|
6799
6833
|
const hidden = ariaHidden ?? (ariaLabel ? void 0 : true);
|
|
6800
6834
|
return /*#__PURE__*/ jsxDEV$1("svg", {
|
|
@@ -6809,7 +6843,7 @@ var CUSTOM_SYMBOLS = {
|
|
|
6809
6843
|
role: "img"
|
|
6810
6844
|
} : {},
|
|
6811
6845
|
...hidden ? { "aria-hidden": "true" } : {},
|
|
6812
|
-
children: /*#__PURE__*/ jsxDEV$1("use", { href: `#icon-${name}` })
|
|
6846
|
+
children: iconsRenderInline() ? raw(inlineIconMarkup(name)) : /*#__PURE__*/ jsxDEV$1("use", { href: `#icon-${name}` })
|
|
6813
6847
|
});
|
|
6814
6848
|
};
|
|
6815
6849
|
//#endregion
|
|
@@ -6892,9 +6926,10 @@ var IconSprite = () => {
|
|
|
6892
6926
|
const cjkFontStyle = cjkFontDeclarations ? `:root {\n${cjkFontDeclarations}\n}` : "";
|
|
6893
6927
|
const cjkStylesheetPath = cjkFontProfile === "zh-Hans" ? IS_VITE_DEV ? assetPath("/src/style-cjk.css") : toPublicAssetPath(CLIENT_CJK_CSS_FILE, assetBasePath) : cjkFontProfile === "zh-Hant" ? IS_VITE_DEV ? assetPath("/src/style-cjk-tc.css") : toPublicAssetPath(CLIENT_CJK_TC_CSS_FILE, assetBasePath) : cjkFontProfile === "ja" ? IS_VITE_DEV ? assetPath("/src/style-cjk-jp.css") : toPublicAssetPath(CLIENT_CJK_JP_CSS_FILE, assetBasePath) : cjkFontProfile === "ko" ? IS_VITE_DEV ? assetPath("/src/style-cjk-kr.css") : toPublicAssetPath(CLIENT_CJK_KR_CSS_FILE, assetBasePath) : null;
|
|
6894
6928
|
const authorStylesheetPath = resolvedClientBundle === "full" ? IS_VITE_DEV ? assetPath("/src/style-author.css") : toPublicAssetPath(CLIENT_AUTHOR_CSS_FILE, assetBasePath) : null;
|
|
6929
|
+
const shareStylesheetPath = IS_VITE_DEV ? assetPath("/src/style-share.css") : toPublicAssetPath(CLIENT_SHARE_CSS_FILE, assetBasePath);
|
|
6895
6930
|
const clientScriptPath = IS_VITE_DEV ? resolvedClientBundle === "full" ? assetPath("/src/client-auth.ts") : assetPath("/src/client.ts") : toPublicAssetPath(resolvedClientBundle === "full" ? CLIENT_AUTH_JS_FILE : CLIENT_JS_FILE, assetBasePath);
|
|
6896
6931
|
const composePreloadPaths = !IS_VITE_DEV && resolvedClientBundle === "full" ? CLIENT_COMPOSE_PRELOAD.map((file) => toPublicAssetPath(file, assetBasePath)) : [];
|
|
6897
|
-
const faviconAssetVersion = resolvedFaviconVersion || "1.0
|
|
6932
|
+
const faviconAssetVersion = resolvedFaviconVersion || "1.1.0-3e911729729c95a2";
|
|
6898
6933
|
const resolvedFaviconHref = faviconHref ?? (faviconAssetVersion ? toPublicPath(`/favicon.ico?v=${faviconAssetVersion}`, sitePathPrefix) : toPublicPath("/favicon.ico", sitePathPrefix));
|
|
6899
6934
|
const resolvedAppleTouchHref = appleTouchHref ?? (faviconAssetVersion ? toPublicPath(`/apple-touch-icon.png?v=${faviconAssetVersion}`, sitePathPrefix) : toPublicPath("/apple-touch-icon.png", sitePathPrefix));
|
|
6900
6935
|
const socialImageHref = resolvedSocialImagePath ? toAbsoluteAssetUrl(resolvedSocialImagePath, appConfig?.siteUrl || "", sitePathPrefix) : "";
|
|
@@ -6928,6 +6963,7 @@ var IconSprite = () => {
|
|
|
6928
6963
|
"data-view-lang": viewLang ?? void 0,
|
|
6929
6964
|
"data-asset-base-path": assetBasePath,
|
|
6930
6965
|
"data-media-base": mediaBase,
|
|
6966
|
+
"data-share-stylesheet": shareStylesheetPath,
|
|
6931
6967
|
children: [/*#__PURE__*/ jsxDEV$1("head", { children: [
|
|
6932
6968
|
/*#__PURE__*/ jsxDEV$1("meta", { charset: "UTF-8" }),
|
|
6933
6969
|
/*#__PURE__*/ jsxDEV$1("meta", {
|
|
@@ -11963,6 +11999,33 @@ var DISCOVER_SETTINGS = ["latest", "off"];
|
|
|
11963
11999
|
}
|
|
11964
12000
|
}
|
|
11965
12001
|
/**
|
|
12002
|
+
* Where the Jant author group's WeChat QR code is, derived from the
|
|
12003
|
+
* directory's base address.
|
|
12004
|
+
*
|
|
12005
|
+
* The group is a Chinese-language WeChat group for people who write on Jant,
|
|
12006
|
+
* and its QR code lives on the contact page of the same control plane that
|
|
12007
|
+
* runs the directory — so, like the submission form, it is found from the one
|
|
12008
|
+
* address this deployment already has. The path is the Chinese page at its
|
|
12009
|
+
* WeChat section, because only Chinese screens link to it.
|
|
12010
|
+
*
|
|
12011
|
+
* @param directoryBaseUrl - The directory this deployment belongs to, from
|
|
12012
|
+
* `getDiscoverDirectoryBaseUrl`
|
|
12013
|
+
* @returns Absolute URL of the group's section, or `null` when there is no
|
|
12014
|
+
* directory
|
|
12015
|
+
* @example
|
|
12016
|
+
* ```ts
|
|
12017
|
+
* getAuthorGroupUrl("https://jant.me/");
|
|
12018
|
+
* // "https://jant.me/zh-hans/contact#wechat"
|
|
12019
|
+
* ```
|
|
12020
|
+
*/ function getAuthorGroupUrl(directoryBaseUrl) {
|
|
12021
|
+
if (!directoryBaseUrl) return null;
|
|
12022
|
+
try {
|
|
12023
|
+
return new URL("/zh-hans/contact#wechat", directoryBaseUrl).toString();
|
|
12024
|
+
} catch {
|
|
12025
|
+
return null;
|
|
12026
|
+
}
|
|
12027
|
+
}
|
|
12028
|
+
/**
|
|
11966
12029
|
* Split a sentence into runs, making each given term a link.
|
|
11967
12030
|
*
|
|
11968
12031
|
* The Discover help line reads as one sentence in every locale, so each link is
|
|
@@ -12284,7 +12347,14 @@ var SETUP_WINDOW_SEC = 600;
|
|
|
12284
12347
|
* first one — the directory's name links to the directory for anyone who wants
|
|
12285
12348
|
* more. Where to find the setting again is left to the screen's footnote, which
|
|
12286
12349
|
* says it once for every answer on it.
|
|
12287
|
-
|
|
12350
|
+
*
|
|
12351
|
+
* On a Chinese screen the help line goes one sentence further than the
|
|
12352
|
+
* settings page's, to the Jant author group — a Chinese-language WeChat group
|
|
12353
|
+
* for people who write on Jant. It picks up the community the sentence before
|
|
12354
|
+
* it names. The sentence is written in Chinese here rather than kept in the
|
|
12355
|
+
* catalog, since no other locale has a version of it, and it is left out when
|
|
12356
|
+
* there is no directory to find the group's page from.
|
|
12357
|
+
*/ var DiscoverField = ({ copy, pages, authorGroupUrl, shown }) => {
|
|
12288
12358
|
const runs = discoverIntroRuns(copy.about, copy, pages);
|
|
12289
12359
|
return /*#__PURE__*/ jsxDEV$1("div", {
|
|
12290
12360
|
class: "field mt-2",
|
|
@@ -12301,13 +12371,23 @@ var SETUP_WINDOW_SEC = 600;
|
|
|
12301
12371
|
}), /*#__PURE__*/ jsxDEV$1("span", { children: copy.label })]
|
|
12302
12372
|
}), /*#__PURE__*/ jsxDEV$1("p", {
|
|
12303
12373
|
class: "text-sm text-muted-foreground mt-1",
|
|
12304
|
-
children: runs.map((run) => run.href ? /*#__PURE__*/ jsxDEV$1("a", {
|
|
12374
|
+
children: [runs.map((run) => run.href ? /*#__PURE__*/ jsxDEV$1("a", {
|
|
12305
12375
|
href: run.href,
|
|
12306
12376
|
target: "_blank",
|
|
12307
12377
|
rel: "noopener noreferrer",
|
|
12308
12378
|
class: "underline hover:text-foreground transition-colors",
|
|
12309
12379
|
children: run.text
|
|
12310
|
-
}) : run.text)
|
|
12380
|
+
}) : run.text), authorGroupUrl ? /*#__PURE__*/ jsxDEV$1(Fragment$2, { children: [
|
|
12381
|
+
"你也可以选择加入",
|
|
12382
|
+
/*#__PURE__*/ jsxDEV$1("a", {
|
|
12383
|
+
href: authorGroupUrl,
|
|
12384
|
+
target: "_blank",
|
|
12385
|
+
rel: "noopener noreferrer",
|
|
12386
|
+
class: "underline hover:text-foreground transition-colors",
|
|
12387
|
+
children: "Jant 作者群"
|
|
12388
|
+
}),
|
|
12389
|
+
"。"
|
|
12390
|
+
] }) : null]
|
|
12311
12391
|
})]
|
|
12312
12392
|
});
|
|
12313
12393
|
};
|
|
@@ -12442,12 +12522,13 @@ var SetupContent = (props) => {
|
|
|
12442
12522
|
action,
|
|
12443
12523
|
spinner
|
|
12444
12524
|
});
|
|
12445
|
-
const { askSiteName, contentLanguage, siteName, discoverAvailable, discoverDefault, discoverPages } = props;
|
|
12525
|
+
const { askSiteName, contentLanguage, siteName, discoverAvailable, discoverDefault, discoverPages, authorGroupUrl } = props;
|
|
12446
12526
|
const searchLabel = i18n._({ id: "ihn4zD" });
|
|
12447
12527
|
const emptyLabel = i18n._({ id: "Ox3-3h" });
|
|
12448
12528
|
const discoverField = discoverAvailable ? /*#__PURE__*/ jsxDEV$1(DiscoverField, {
|
|
12449
12529
|
copy: getDiscoverCopy(i18n),
|
|
12450
12530
|
pages: discoverPages,
|
|
12531
|
+
authorGroupUrl: i18n.locale === "zh-Hans" ? authorGroupUrl : null,
|
|
12451
12532
|
shown: isDiscoverLanguage(contentLanguage)
|
|
12452
12533
|
}) : null;
|
|
12453
12534
|
const signals = [
|
|
@@ -12606,6 +12687,7 @@ setupRoutes.get("/setup", async (c) => {
|
|
|
12606
12687
|
discoverAvailable: !appConfig.demoMode && appConfig.rssFeedsEnabled,
|
|
12607
12688
|
discoverDefault,
|
|
12608
12689
|
discoverPages: getDiscoverPageUrls(getDiscoverDirectoryBaseUrl(c.env)),
|
|
12690
|
+
authorGroupUrl: getAuthorGroupUrl(getDiscoverDirectoryBaseUrl(c.env)),
|
|
12609
12691
|
contentLanguage: askSiteName ? readConfigEnvValue(c.env, "SITE_LANGUAGE") ?? resolveSupportedLocaleTag(c.req.header("Accept-Language")) : appConfig.siteLanguage,
|
|
12610
12692
|
siteName: askSiteName ? void 0 : appConfig.siteName
|
|
12611
12693
|
})
|
|
@@ -44767,6 +44849,7 @@ var SiteLayout = ({ siteName, links, currentPath, sitePathPrefix = "", basePath
|
|
|
44767
44849
|
showHomeBranding && /*#__PURE__*/ jsxDEV$1(HomePageBranding, {}),
|
|
44768
44850
|
/*#__PURE__*/ jsxDEV$1("jant-media-lightbox", {}),
|
|
44769
44851
|
/*#__PURE__*/ jsxDEV$1("jant-text-preview", {}),
|
|
44852
|
+
!isAuthenticated && /*#__PURE__*/ jsxDEV$1("jant-share-menu", {}),
|
|
44770
44853
|
isAuthenticated && /*#__PURE__*/ jsxDEV$1("jant-post-menu", { languages: JSON.stringify(composeLanguages ?? []).replace(/</g, "\\u003c") }),
|
|
44771
44854
|
isAuthenticated && showComposeDialog && /*#__PURE__*/ jsxDEV$1(ComposeDialog, {
|
|
44772
44855
|
collections,
|
|
@@ -45980,7 +46063,17 @@ var DEFAULT_BLURHASH_LONGEST_SIDE = 16;
|
|
|
45980
46063
|
* for them, and inventing one would put a private vocabulary in public
|
|
45981
46064
|
* markup.
|
|
45982
46065
|
*/ var DEFAULT_VISUAL_RATIO = 4 / 3;
|
|
45983
|
-
|
|
46066
|
+
/**
|
|
46067
|
+
* A file size the way the gallery labels documents.
|
|
46068
|
+
*
|
|
46069
|
+
* @param bytes - Size in bytes
|
|
46070
|
+
* @returns "512 B", "3.4 KB" or "2.1 MB"
|
|
46071
|
+
*
|
|
46072
|
+
* @example
|
|
46073
|
+
* ```ts
|
|
46074
|
+
* formatSize(2_200_000); // "2.1 MB"
|
|
46075
|
+
* ```
|
|
46076
|
+
*/ function formatSize(bytes) {
|
|
45984
46077
|
if (bytes < 1024) return `${bytes} B`;
|
|
45985
46078
|
if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
45986
46079
|
return `${(bytes / 1048576).toFixed(1)} MB`;
|
|
@@ -46628,6 +46721,7 @@ var MediaGallery = ({ attachments, postPermalink }) => {
|
|
|
46628
46721
|
"data-format": post.format,
|
|
46629
46722
|
"data-post-id": post.id,
|
|
46630
46723
|
"data-post-slug": post.slug,
|
|
46724
|
+
"data-post-permalink": post.permalink,
|
|
46631
46725
|
"data-thread-root-id": post.threadRootId ?? post.id,
|
|
46632
46726
|
...post.pinned ? { "data-post-pinned": "" } : {},
|
|
46633
46727
|
...post.pinnedInCollection ? { "data-post-pinned-in-collection": "" } : {},
|
|
@@ -46662,6 +46756,307 @@ var MediaGallery = ({ attachments, postPermalink }) => {
|
|
|
46662
46756
|
}))
|
|
46663
46757
|
});
|
|
46664
46758
|
};
|
|
46759
|
+
/**
|
|
46760
|
+
* Characters of a context post's text the card carries. The card shows up
|
|
46761
|
+
* to three lines of it; this only keeps the markup small.
|
|
46762
|
+
*/ var CONTEXT_TEXT_CHARS = 200;
|
|
46763
|
+
/** Quotes up to this many characters are set larger. */ var SHORT_QUOTE_CHARS = 30;
|
|
46764
|
+
/** Quotes past this many characters are set smaller. */ var LONG_QUOTE_CHARS = 90;
|
|
46765
|
+
/**
|
|
46766
|
+
* Whether a post can be shared as an image: a reader has to be able to open
|
|
46767
|
+
* the address its QR code points at.
|
|
46768
|
+
*
|
|
46769
|
+
* @param post - Post record
|
|
46770
|
+
* @returns True for published posts that are not Private
|
|
46771
|
+
*
|
|
46772
|
+
* @example
|
|
46773
|
+
* ```ts
|
|
46774
|
+
* canShareAsImage({ status: "published", visibility: "latest_hidden" }); // true
|
|
46775
|
+
* canShareAsImage({ status: "draft", visibility: "public" }); // false
|
|
46776
|
+
* ```
|
|
46777
|
+
*/ function canShareAsImage(post) {
|
|
46778
|
+
return post.status === "published" && post.visibility !== "private";
|
|
46779
|
+
}
|
|
46780
|
+
/**
|
|
46781
|
+
* Same-origin path for a storage key. `/media/*` and `/sites/*` serve the
|
|
46782
|
+
* site's public objects whatever CDN host the timeline links to.
|
|
46783
|
+
*/ function storagePath(storageKey, sitePathPrefix) {
|
|
46784
|
+
return toPublicPath(`/${storageKey}`, sitePathPrefix);
|
|
46785
|
+
}
|
|
46786
|
+
/** The stored pixel size of an image or a video, when it has one. */ function imageSize(item) {
|
|
46787
|
+
return item.width && item.height ? {
|
|
46788
|
+
width: item.width,
|
|
46789
|
+
height: item.height
|
|
46790
|
+
} : {};
|
|
46791
|
+
}
|
|
46792
|
+
function cardImages(media, previewImageKey, sitePathPrefix) {
|
|
46793
|
+
const visuals = [];
|
|
46794
|
+
for (const item of media) if (item.mimeType.startsWith("image/")) visuals.push({
|
|
46795
|
+
url: storagePath(item.storageKey, sitePathPrefix),
|
|
46796
|
+
video: false,
|
|
46797
|
+
...imageSize(item)
|
|
46798
|
+
});
|
|
46799
|
+
else if (item.mimeType.startsWith("video/") && item.posterKey) visuals.push({
|
|
46800
|
+
url: storagePath(item.posterKey, sitePathPrefix),
|
|
46801
|
+
video: true,
|
|
46802
|
+
...imageSize(item)
|
|
46803
|
+
});
|
|
46804
|
+
if (visuals.length === 0 && previewImageKey) visuals.push({
|
|
46805
|
+
url: storagePath(previewImageKey, sitePathPrefix),
|
|
46806
|
+
video: false
|
|
46807
|
+
});
|
|
46808
|
+
return {
|
|
46809
|
+
images: visuals.slice(0, 4),
|
|
46810
|
+
moreImages: Math.max(0, visuals.length - 4)
|
|
46811
|
+
};
|
|
46812
|
+
}
|
|
46813
|
+
/** Formats whose file extension is not the name a reader knows them by. */ var FORMAT_BY_MIME = {
|
|
46814
|
+
"application/pdf": "PDF",
|
|
46815
|
+
"application/epub+zip": "EPUB",
|
|
46816
|
+
"text/markdown": "MD",
|
|
46817
|
+
"text/plain": "TXT"
|
|
46818
|
+
};
|
|
46819
|
+
/** The file's extension in capitals, or a name for its MIME type. */ function fileFormat(item) {
|
|
46820
|
+
const extension = /\.([a-z0-9]{1,5})$/i.exec(item.originalName)?.[1];
|
|
46821
|
+
if (extension) return extension.toUpperCase();
|
|
46822
|
+
return FORMAT_BY_MIME[item.mimeType] ?? (item.mimeType.split("/")[1] ?? "").slice(0, 4).toUpperCase();
|
|
46823
|
+
}
|
|
46824
|
+
function withoutExtension(name) {
|
|
46825
|
+
return name.replace(/\.[a-z0-9]{1,5}$/i, "");
|
|
46826
|
+
}
|
|
46827
|
+
/**
|
|
46828
|
+
* Attachments a picture cannot show. Images and videos with a poster are at
|
|
46829
|
+
* the top of the card; everything else is listed, so a post whose point is
|
|
46830
|
+
* a PDF or a recording does not lose it.
|
|
46831
|
+
*/ function cardFiles(media) {
|
|
46832
|
+
const files = [];
|
|
46833
|
+
for (const item of media) {
|
|
46834
|
+
if (item.mimeType.startsWith("image/")) continue;
|
|
46835
|
+
const isVideo = item.mimeType.startsWith("video/");
|
|
46836
|
+
if (isVideo && item.posterKey) continue;
|
|
46837
|
+
const name = withoutExtension(item.originalName) || item.alt || "";
|
|
46838
|
+
if (item.mimeType.startsWith("text/")) files.push({
|
|
46839
|
+
kind: "text",
|
|
46840
|
+
format: fileFormat(item),
|
|
46841
|
+
title: item.summary?.trim().split("\n")[0] || name,
|
|
46842
|
+
chars: item.chars ?? void 0
|
|
46843
|
+
});
|
|
46844
|
+
else if (isVideo || item.mimeType.startsWith("audio/")) files.push({
|
|
46845
|
+
kind: isVideo ? "video" : "audio",
|
|
46846
|
+
format: fileFormat(item),
|
|
46847
|
+
title: name,
|
|
46848
|
+
durationSeconds: item.durationSeconds ?? void 0
|
|
46849
|
+
});
|
|
46850
|
+
else files.push({
|
|
46851
|
+
kind: "document",
|
|
46852
|
+
format: fileFormat(item),
|
|
46853
|
+
title: name,
|
|
46854
|
+
size: item.size
|
|
46855
|
+
});
|
|
46856
|
+
}
|
|
46857
|
+
return {
|
|
46858
|
+
files: files.slice(0, 3),
|
|
46859
|
+
moreFiles: Math.max(0, files.length - 3)
|
|
46860
|
+
};
|
|
46861
|
+
}
|
|
46862
|
+
/**
|
|
46863
|
+
* A context post's text as one run of lines, cut short. Paragraphs join
|
|
46864
|
+
* with a space, except after CJK punctuation, which carries its own.
|
|
46865
|
+
*/ function clipContextText(text) {
|
|
46866
|
+
const normalized = text?.replace(/\s+/g, " ").replace(/([\u3000-\u303f\uff00-\uffef]) /g, "$1").trim();
|
|
46867
|
+
if (!normalized) return void 0;
|
|
46868
|
+
const characters = Array.from(normalized);
|
|
46869
|
+
if (characters.length <= CONTEXT_TEXT_CHARS) return normalized;
|
|
46870
|
+
return `${characters.slice(0, CONTEXT_TEXT_CHARS).join("").trimEnd()}…`;
|
|
46871
|
+
}
|
|
46872
|
+
/**
|
|
46873
|
+
* Which posts of a Thread the card shows around the one at `index`.
|
|
46874
|
+
*
|
|
46875
|
+
* @param posts - The Thread's published posts, in Thread order
|
|
46876
|
+
* @param index - Position of the shared post in `posts`
|
|
46877
|
+
* @returns The Thread's first post, how many posts fold between it and the
|
|
46878
|
+
* shared one, the post after, and the shared post's place; null when the
|
|
46879
|
+
* post stands alone
|
|
46880
|
+
*
|
|
46881
|
+
* @example
|
|
46882
|
+
* ```ts
|
|
46883
|
+
* threadWindow([p1, p2, p3, p4, p5, p6, p7], 5);
|
|
46884
|
+
* // { root: p1, hidden: 4, next: p7, position: 6, total: 7 }
|
|
46885
|
+
* ```
|
|
46886
|
+
*/ function threadWindow(posts, index) {
|
|
46887
|
+
if (posts.length < 2 || index < 0 || index >= posts.length) return null;
|
|
46888
|
+
return {
|
|
46889
|
+
root: index > 0 ? posts[0] ?? null : null,
|
|
46890
|
+
hidden: Math.max(0, index - 1),
|
|
46891
|
+
next: posts[index + 1] ?? null,
|
|
46892
|
+
position: index + 1,
|
|
46893
|
+
total: posts.length
|
|
46894
|
+
};
|
|
46895
|
+
}
|
|
46896
|
+
/**
|
|
46897
|
+
* The Thread's first post or the post after the shared one as the card
|
|
46898
|
+
* shows it: its title and words, a quote's words and source, or, for a post
|
|
46899
|
+
* with no words, its images, or its first file by format and name.
|
|
46900
|
+
*
|
|
46901
|
+
* @param post - Post record; `previewImageKey` stands in for a link's image
|
|
46902
|
+
* @param view - The same post as the timeline renders it
|
|
46903
|
+
* @param media - The post's attachments, in order
|
|
46904
|
+
* @param sitePathPrefix - Path prefix for same-origin URLs
|
|
46905
|
+
* @returns The context post
|
|
46906
|
+
*/ function buildShareCardThreadPost(post, view, media, sitePathPrefix) {
|
|
46907
|
+
let title;
|
|
46908
|
+
let text;
|
|
46909
|
+
const safeUrl = view.url ? sanitizeUrl(view.url) : "";
|
|
46910
|
+
const domain = safeUrl ? extractDisplayDomain(safeUrl) ?? void 0 : void 0;
|
|
46911
|
+
if (post.format === "quote") {
|
|
46912
|
+
text = clipContextText(view.quoteText);
|
|
46913
|
+
const source = [view.title, domain].filter(Boolean).join(" · ");
|
|
46914
|
+
if (text) return {
|
|
46915
|
+
format: post.format,
|
|
46916
|
+
text,
|
|
46917
|
+
source: source || void 0
|
|
46918
|
+
};
|
|
46919
|
+
} else if (post.format === "link") {
|
|
46920
|
+
title = view.title || domain;
|
|
46921
|
+
text = view.summary && view.summary !== view.url?.trim() ? clipContextText(view.summary) : void 0;
|
|
46922
|
+
} else {
|
|
46923
|
+
title = view.title || void 0;
|
|
46924
|
+
text = clipContextText(view.summary);
|
|
46925
|
+
}
|
|
46926
|
+
if (title || text) return {
|
|
46927
|
+
format: post.format,
|
|
46928
|
+
title,
|
|
46929
|
+
text
|
|
46930
|
+
};
|
|
46931
|
+
const { images, moreImages } = cardImages(media, post.previewImageKey, sitePathPrefix);
|
|
46932
|
+
if (images.length === 0) {
|
|
46933
|
+
const file = cardFiles(media).files[0];
|
|
46934
|
+
return file ? {
|
|
46935
|
+
format: post.format,
|
|
46936
|
+
text: `${file.format} · ${file.title}`
|
|
46937
|
+
} : { format: post.format };
|
|
46938
|
+
}
|
|
46939
|
+
const shown = images.slice(0, 3);
|
|
46940
|
+
return {
|
|
46941
|
+
format: post.format,
|
|
46942
|
+
images: shown,
|
|
46943
|
+
moreImages: moreImages + images.length - shown.length
|
|
46944
|
+
};
|
|
46945
|
+
}
|
|
46946
|
+
function quoteSize(text) {
|
|
46947
|
+
const length = Array.from(text).length;
|
|
46948
|
+
if (length <= SHORT_QUOTE_CHARS) return "short";
|
|
46949
|
+
if (length > LONG_QUOTE_CHARS) return "long";
|
|
46950
|
+
return "medium";
|
|
46951
|
+
}
|
|
46952
|
+
/**
|
|
46953
|
+
* The site's address as a reader would type it: host and path prefix,
|
|
46954
|
+
* percent-decoded, without a trailing slash. Null when the site's name
|
|
46955
|
+
* already says it, such as a site named `example.com` at
|
|
46956
|
+
* `www.example.com`.
|
|
46957
|
+
*/ function toSiteAddress(site) {
|
|
46958
|
+
const url = new URL(buildSiteUrl(site.siteOrigin, site.sitePathPrefix));
|
|
46959
|
+
let path = url.pathname;
|
|
46960
|
+
try {
|
|
46961
|
+
path = decodeURI(path);
|
|
46962
|
+
} catch {}
|
|
46963
|
+
const address = `${url.host}${path}`.replace(/\/$/, "");
|
|
46964
|
+
const bare = (text) => text.trim().toLowerCase().replace(/^www\./, "");
|
|
46965
|
+
return bare(site.siteName) === bare(address) ? null : address;
|
|
46966
|
+
}
|
|
46967
|
+
/**
|
|
46968
|
+
* Builds the share card for a post: layout, text, images, and the QR code
|
|
46969
|
+
* for its address.
|
|
46970
|
+
*
|
|
46971
|
+
* @param post - Post record; `body` is the TipTap JSON the summary is cut from
|
|
46972
|
+
* @param view - The same post as the timeline renders it
|
|
46973
|
+
* @param media - The post's attachments, in order
|
|
46974
|
+
* @param site - Site name, avatar, and the origin the QR code points at
|
|
46975
|
+
* @returns Render-ready share card view
|
|
46976
|
+
*
|
|
46977
|
+
* @example
|
|
46978
|
+
* ```ts
|
|
46979
|
+
* const card = buildShareCardView(post, postView, media, site);
|
|
46980
|
+
* card.layout; // "article" for a titled note
|
|
46981
|
+
* ```
|
|
46982
|
+
*/ function buildShareCardView(post, view, media, site) {
|
|
46983
|
+
const layout = post.format === "note" ? view.title ? "article" : "note" : post.format;
|
|
46984
|
+
const summary = post.body ? layout === "note" ? extractSummaryHtml(post.body, 10, NOTE_SUMMARY_MAX_CHARS, 200, { namespace: post.id }) : extractSummaryHtml(post.body, 5, 500, 0, { namespace: post.id }) : null;
|
|
46985
|
+
const permalink = new URL(view.permalink, site.siteOrigin).toString();
|
|
46986
|
+
const safeUrl = view.url ? sanitizeUrl(view.url) : "";
|
|
46987
|
+
const domain = safeUrl ? extractDisplayDomain(safeUrl) ?? void 0 : void 0;
|
|
46988
|
+
return {
|
|
46989
|
+
layout,
|
|
46990
|
+
siteName: site.siteName,
|
|
46991
|
+
avatarUrl: site.siteAvatar ? storagePath(site.siteAvatar, site.sitePathPrefix) : null,
|
|
46992
|
+
date: view.publishedAtFormatted,
|
|
46993
|
+
title: layout === "article" ? view.title : void 0,
|
|
46994
|
+
bodyHtml: summary?.html || void 0,
|
|
46995
|
+
hasMore: summary?.hasMore ?? false,
|
|
46996
|
+
quote: layout === "quote" && view.quoteText ? {
|
|
46997
|
+
text: view.quoteText,
|
|
46998
|
+
size: quoteSize(view.quoteText),
|
|
46999
|
+
attribution: view.title || void 0,
|
|
47000
|
+
source: domain
|
|
47001
|
+
} : void 0,
|
|
47002
|
+
link: layout === "link" ? {
|
|
47003
|
+
title: view.title || void 0,
|
|
47004
|
+
domain
|
|
47005
|
+
} : void 0,
|
|
47006
|
+
...cardImages(media, post.previewImageKey, site.sitePathPrefix),
|
|
47007
|
+
...cardFiles(media),
|
|
47008
|
+
permalink,
|
|
47009
|
+
siteAddress: toSiteAddress(site),
|
|
47010
|
+
qrSvg: renderSVG(permalink, {
|
|
47011
|
+
ecc: "M",
|
|
47012
|
+
border: 2
|
|
47013
|
+
}),
|
|
47014
|
+
fileName: view.slug,
|
|
47015
|
+
language: view.language
|
|
47016
|
+
};
|
|
47017
|
+
}
|
|
47018
|
+
/**
|
|
47019
|
+
* Loads a post, and the posts of its Thread the card shows around it, and
|
|
47020
|
+
* builds its share card.
|
|
47021
|
+
*
|
|
47022
|
+
* @param c - Hono context (services + appConfig)
|
|
47023
|
+
* @param postId - TypeID of the post
|
|
47024
|
+
* @returns The card, or null when the post is missing or cannot be shared
|
|
47025
|
+
*/ async function assembleShareCard(c, postId) {
|
|
47026
|
+
const post = await c.var.services.posts.getById(postId);
|
|
47027
|
+
if (!post || !canShareAsImage(post)) return null;
|
|
47028
|
+
const threadPosts = (await c.var.services.posts.getThread(post.threadId)).filter((threadPost) => threadPost.status === "published");
|
|
47029
|
+
const window = threadWindow(threadPosts, threadPosts.findIndex((threadPost) => threadPost.id === post.id));
|
|
47030
|
+
const contextPosts = window ? [window.root, window.next].filter((contextPost) => contextPost !== null) : [];
|
|
47031
|
+
const appConfig = c.var.appConfig;
|
|
47032
|
+
const mediaCtx = createMediaContext(appConfig);
|
|
47033
|
+
const [rawMediaMap, aliasesMap] = await Promise.all([c.var.services.media.getByPostIds([post.id, ...contextPosts.map((contextPost) => contextPost.id)]), c.var.services.paths.getPostAliases([post.id])]);
|
|
47034
|
+
const mediaMap = buildMediaMap(rawMediaMap, mediaCtx.r2PublicUrl, mediaCtx.imageTransformUrl, mediaCtx.s3PublicUrl, mediaCtx.localPublicUrl, mediaCtx.sitePathPrefix);
|
|
47035
|
+
const card = buildShareCardView(post, toPostView({
|
|
47036
|
+
...post,
|
|
47037
|
+
mediaAttachments: mediaMap.get(post.id) ?? []
|
|
47038
|
+
}, mediaCtx, void 0, true, aliasesMap.get(post.id)?.[0]), rawMediaMap.get(post.id) ?? [], {
|
|
47039
|
+
siteName: appConfig.siteName,
|
|
47040
|
+
siteAvatar: appConfig.siteAvatar,
|
|
47041
|
+
siteOrigin: appConfig.siteOrigin || new URL(c.req.url).origin,
|
|
47042
|
+
sitePathPrefix: appConfig.sitePathPrefix
|
|
47043
|
+
});
|
|
47044
|
+
if (!window) return card;
|
|
47045
|
+
const context = (contextPost) => contextPost ? buildShareCardThreadPost(contextPost, toPostView({
|
|
47046
|
+
...contextPost,
|
|
47047
|
+
mediaAttachments: mediaMap.get(contextPost.id) ?? []
|
|
47048
|
+
}, mediaCtx), rawMediaMap.get(contextPost.id) ?? [], appConfig.sitePathPrefix) : null;
|
|
47049
|
+
return {
|
|
47050
|
+
...card,
|
|
47051
|
+
thread: {
|
|
47052
|
+
position: window.position,
|
|
47053
|
+
total: window.total,
|
|
47054
|
+
root: context(window.root),
|
|
47055
|
+
hidden: window.hidden,
|
|
47056
|
+
next: context(window.next)
|
|
47057
|
+
}
|
|
47058
|
+
};
|
|
47059
|
+
}
|
|
46665
47060
|
//#endregion
|
|
46666
47061
|
//#region src/ui/shared/PostFooter.tsx
|
|
46667
47062
|
/**
|
|
@@ -46754,7 +47149,11 @@ var PostPublishedLink = ({ post, className }) => {
|
|
|
46754
47149
|
})
|
|
46755
47150
|
});
|
|
46756
47151
|
};
|
|
46757
|
-
|
|
47152
|
+
/**
|
|
47153
|
+
* The post's "More" button. The author's opens `jant-post-menu`; a reader's
|
|
47154
|
+
* (`reader`) opens `jant-share-menu`, which holds Copy link and Share as
|
|
47155
|
+
* image.
|
|
47156
|
+
*/ var PostMenuTriggerButton = ({ className = "post-menu-trigger", reader = false }) => {
|
|
46758
47157
|
const { i18n } = useLingui();
|
|
46759
47158
|
return /*#__PURE__*/ jsxDEV$1("button", {
|
|
46760
47159
|
type: "button",
|
|
@@ -46762,7 +47161,7 @@ var PostMenuTriggerButton = ({ className = "post-menu-trigger" }) => {
|
|
|
46762
47161
|
"aria-haspopup": "menu",
|
|
46763
47162
|
"aria-label": i18n._({ id: "JcD7qf" }),
|
|
46764
47163
|
"aria-expanded": "false",
|
|
46765
|
-
"data-post-menu-trigger": true,
|
|
47164
|
+
...reader ? { "data-share-menu-trigger": true } : { "data-post-menu-trigger": true },
|
|
46766
47165
|
children: /*#__PURE__*/ jsxDEV$1(Icon$1, {
|
|
46767
47166
|
name: "post-menu-dots",
|
|
46768
47167
|
size: 15
|
|
@@ -46785,49 +47184,56 @@ var PostFooter = ({ post, detail, display }) => {
|
|
|
46785
47184
|
return /*#__PURE__*/ jsxDEV$1("footer", {
|
|
46786
47185
|
class: `post-menu-footer${detail ? " post-footer-detail" : ""}`,
|
|
46787
47186
|
"data-post-meta": true,
|
|
46788
|
-
children: [
|
|
46789
|
-
|
|
46790
|
-
|
|
46791
|
-
|
|
46792
|
-
|
|
46793
|
-
|
|
46794
|
-
|
|
46795
|
-
|
|
46796
|
-
|
|
46797
|
-
|
|
46798
|
-
|
|
46799
|
-
|
|
46800
|
-
|
|
46801
|
-
|
|
46802
|
-
|
|
46803
|
-
|
|
46804
|
-
|
|
46805
|
-
|
|
46806
|
-
|
|
46807
|
-
|
|
46808
|
-
|
|
46809
|
-
|
|
46810
|
-
|
|
46811
|
-
|
|
46812
|
-
|
|
46813
|
-
|
|
46814
|
-
|
|
46815
|
-
|
|
46816
|
-
|
|
46817
|
-
|
|
46818
|
-
|
|
46819
|
-
|
|
46820
|
-
|
|
46821
|
-
|
|
46822
|
-
|
|
46823
|
-
|
|
46824
|
-
|
|
46825
|
-
|
|
46826
|
-
|
|
46827
|
-
|
|
46828
|
-
|
|
46829
|
-
|
|
46830
|
-
|
|
47187
|
+
children: [
|
|
47188
|
+
/*#__PURE__*/ jsxDEV$1("div", {
|
|
47189
|
+
class: "post-footer-meta",
|
|
47190
|
+
children: [
|
|
47191
|
+
(isAuthor || post.featured) && /*#__PURE__*/ jsxDEV$1("span", {
|
|
47192
|
+
class: "post-footer-featured",
|
|
47193
|
+
tabindex: 0,
|
|
47194
|
+
role: "img",
|
|
47195
|
+
"aria-label": featuredLabel,
|
|
47196
|
+
"data-tooltip": featuredLabel,
|
|
47197
|
+
"data-align": "center",
|
|
47198
|
+
children: /*#__PURE__*/ jsxDEV$1(Icon$1, { name: "featured-sparkle" })
|
|
47199
|
+
}),
|
|
47200
|
+
showTimestamp && /*#__PURE__*/ jsxDEV$1(PostPublishedLink, {
|
|
47201
|
+
post,
|
|
47202
|
+
className: "u-url post-footer-link"
|
|
47203
|
+
}),
|
|
47204
|
+
safeExternalUrl && /*#__PURE__*/ jsxDEV$1("a", {
|
|
47205
|
+
href: safeExternalUrl,
|
|
47206
|
+
class: "post-footer-external-link",
|
|
47207
|
+
target: "_blank",
|
|
47208
|
+
rel: "noopener noreferrer",
|
|
47209
|
+
"aria-label": i18n._({ id: "9dr9Nh" }),
|
|
47210
|
+
children: /*#__PURE__*/ jsxDEV$1(Icon$1, { name: "post-external-link" })
|
|
47211
|
+
}),
|
|
47212
|
+
/*#__PURE__*/ jsxDEV$1(CompactCollectionTags, {
|
|
47213
|
+
collections: visibleCollections,
|
|
47214
|
+
showSeparator: showCollectionSeparator,
|
|
47215
|
+
showIcon: detail
|
|
47216
|
+
})
|
|
47217
|
+
]
|
|
47218
|
+
}),
|
|
47219
|
+
!hideActions && isAuthor && /*#__PURE__*/ jsxDEV$1("div", {
|
|
47220
|
+
class: "post-menu-actions",
|
|
47221
|
+
children: [showReply && /*#__PURE__*/ jsxDEV$1("button", {
|
|
47222
|
+
type: "button",
|
|
47223
|
+
class: "reply-trigger",
|
|
47224
|
+
"aria-label": i18n._({ id: "ImOQa9" }),
|
|
47225
|
+
"data-reply-trigger": true,
|
|
47226
|
+
children: /*#__PURE__*/ jsxDEV$1(Icon$1, {
|
|
47227
|
+
name: "post-reply",
|
|
47228
|
+
size: 14
|
|
47229
|
+
})
|
|
47230
|
+
}), /*#__PURE__*/ jsxDEV$1(PostMenuTriggerButton, {})]
|
|
47231
|
+
}),
|
|
47232
|
+
!hideActions && !isAuthor && canShareAsImage(post) && /*#__PURE__*/ jsxDEV$1("div", {
|
|
47233
|
+
class: "post-menu-actions",
|
|
47234
|
+
children: /*#__PURE__*/ jsxDEV$1(PostMenuTriggerButton, { reader: true })
|
|
47235
|
+
})
|
|
47236
|
+
]
|
|
46831
47237
|
});
|
|
46832
47238
|
};
|
|
46833
47239
|
//#endregion
|
|
@@ -53809,6 +54215,288 @@ newPostRoutes.get("/new", async (c) => {
|
|
|
53809
54215
|
});
|
|
53810
54216
|
});
|
|
53811
54217
|
//#endregion
|
|
54218
|
+
//#region src/ui/share/ShareCard.tsx
|
|
54219
|
+
/**
|
|
54220
|
+
* Share Card
|
|
54221
|
+
*
|
|
54222
|
+
* The post as "Share as image" paints it: a sheet of paper on a mat tinted
|
|
54223
|
+
* from the site's theme, so the picture reads as a mounted card even on the
|
|
54224
|
+
* white of a chat or a feed. Images run across the top of the paper; below
|
|
54225
|
+
* them the date, the post set large in the site's fonts with each format's
|
|
54226
|
+
* own marks, the files a picture cannot show, and a footer that says whose
|
|
54227
|
+
* site it is and how to get there. A lone image keeps its own shape, cut
|
|
54228
|
+
* only past 4:5 tall; two or more share a grid of fixed frames.
|
|
54229
|
+
*
|
|
54230
|
+
* A post in a Thread sits on the Thread's rail, as the timeline shows a
|
|
54231
|
+
* Thread's newest post: the Thread's first post above it in up to three
|
|
54232
|
+
* lines, the posts between folded to a few dots on the rail, a line of the
|
|
54233
|
+
* post after below, and its place in the Thread beside its date. Its images
|
|
54234
|
+
* then go after its text, inside its column, so the card reads top to
|
|
54235
|
+
* bottom.
|
|
54236
|
+
*
|
|
54237
|
+
* 540 px wide, captured at 3x. Render it inside `renderIconsInline()`: the
|
|
54238
|
+
* capture copies the card on its own, without the page's icon sprite.
|
|
54239
|
+
*/
|
|
54240
|
+
/** "3:07", or "1:02:45" past an hour. */ function formatDuration(totalSeconds) {
|
|
54241
|
+
const seconds = Math.round(totalSeconds);
|
|
54242
|
+
const hours = Math.floor(seconds / 3600);
|
|
54243
|
+
const minutes = Math.floor(seconds % 3600 / 60);
|
|
54244
|
+
const rest = String(seconds % 60).padStart(2, "0");
|
|
54245
|
+
return hours > 0 ? `${hours}:${String(minutes).padStart(2, "0")}:${rest}` : `${minutes}:${rest}`;
|
|
54246
|
+
}
|
|
54247
|
+
/** The one number that says how much of a file there is. */ function fileMeta(file) {
|
|
54248
|
+
if (file.size !== void 0) return formatSize(file.size);
|
|
54249
|
+
if (file.durationSeconds !== void 0) return formatDuration(file.durationSeconds);
|
|
54250
|
+
if (file.chars !== void 0 && file.chars > 0) return formatChars(file.chars);
|
|
54251
|
+
return null;
|
|
54252
|
+
}
|
|
54253
|
+
var Files = ({ card }) => {
|
|
54254
|
+
if (card.files.length === 0) return null;
|
|
54255
|
+
return /*#__PURE__*/ jsxDEV$1("ul", {
|
|
54256
|
+
class: "share-card-files",
|
|
54257
|
+
children: [card.files.map((file) => {
|
|
54258
|
+
const meta = fileMeta(file);
|
|
54259
|
+
return /*#__PURE__*/ jsxDEV$1("li", {
|
|
54260
|
+
class: "share-card-file",
|
|
54261
|
+
"data-kind": file.kind,
|
|
54262
|
+
children: [/*#__PURE__*/ jsxDEV$1("span", {
|
|
54263
|
+
class: "share-card-file-format",
|
|
54264
|
+
children: file.format
|
|
54265
|
+
}), /*#__PURE__*/ jsxDEV$1("span", {
|
|
54266
|
+
class: "share-card-file-text",
|
|
54267
|
+
children: [/*#__PURE__*/ jsxDEV$1("span", {
|
|
54268
|
+
class: "share-card-file-title",
|
|
54269
|
+
children: file.title
|
|
54270
|
+
}), meta && /*#__PURE__*/ jsxDEV$1("span", {
|
|
54271
|
+
class: "share-card-file-meta",
|
|
54272
|
+
children: meta
|
|
54273
|
+
})]
|
|
54274
|
+
})]
|
|
54275
|
+
});
|
|
54276
|
+
}), card.moreFiles > 0 && /*#__PURE__*/ jsxDEV$1("li", {
|
|
54277
|
+
class: "share-card-file-more",
|
|
54278
|
+
children: ["+", card.moreFiles]
|
|
54279
|
+
})]
|
|
54280
|
+
});
|
|
54281
|
+
};
|
|
54282
|
+
var Images = ({ card }) => {
|
|
54283
|
+
if (card.images.length === 0) return null;
|
|
54284
|
+
const last = card.images.length - 1;
|
|
54285
|
+
return /*#__PURE__*/ jsxDEV$1("div", {
|
|
54286
|
+
class: "share-card-images",
|
|
54287
|
+
"data-count": String(card.images.length),
|
|
54288
|
+
children: card.images.map((image, index) => /*#__PURE__*/ jsxDEV$1("div", {
|
|
54289
|
+
class: "share-card-image",
|
|
54290
|
+
children: [
|
|
54291
|
+
/*#__PURE__*/ jsxDEV$1("img", {
|
|
54292
|
+
src: image.url,
|
|
54293
|
+
alt: "",
|
|
54294
|
+
width: image.width,
|
|
54295
|
+
height: image.height
|
|
54296
|
+
}),
|
|
54297
|
+
image.video && /*#__PURE__*/ jsxDEV$1("span", {
|
|
54298
|
+
class: "share-card-play",
|
|
54299
|
+
"aria-hidden": "true",
|
|
54300
|
+
children: /*#__PURE__*/ jsxDEV$1("svg", {
|
|
54301
|
+
viewBox: "0 0 24 24",
|
|
54302
|
+
fill: "currentColor",
|
|
54303
|
+
children: /*#__PURE__*/ jsxDEV$1("path", { d: "M8 5v14l11-7z" })
|
|
54304
|
+
})
|
|
54305
|
+
}),
|
|
54306
|
+
index === last && card.moreImages > 0 && /*#__PURE__*/ jsxDEV$1("span", {
|
|
54307
|
+
class: "share-card-more-images",
|
|
54308
|
+
children: ["+", card.moreImages]
|
|
54309
|
+
})
|
|
54310
|
+
]
|
|
54311
|
+
}))
|
|
54312
|
+
});
|
|
54313
|
+
};
|
|
54314
|
+
var Avatar = ({ card }) => {
|
|
54315
|
+
if (card.avatarUrl) return /*#__PURE__*/ jsxDEV$1("img", {
|
|
54316
|
+
class: "share-card-avatar",
|
|
54317
|
+
src: card.avatarUrl,
|
|
54318
|
+
alt: ""
|
|
54319
|
+
});
|
|
54320
|
+
const initial = Array.from(card.siteName.trim())[0];
|
|
54321
|
+
return initial ? /*#__PURE__*/ jsxDEV$1("span", {
|
|
54322
|
+
class: "share-card-avatar",
|
|
54323
|
+
"aria-hidden": "true",
|
|
54324
|
+
children: initial
|
|
54325
|
+
}) : null;
|
|
54326
|
+
};
|
|
54327
|
+
/** The words; when the summary stops short of the post, its end fades. */ var Body = ({ card }) => card.bodyHtml ? /*#__PURE__*/ jsxDEV$1("div", {
|
|
54328
|
+
class: card.hasMore ? "share-card-body has-more" : "share-card-body",
|
|
54329
|
+
"data-share-card-body": true,
|
|
54330
|
+
dangerouslySetInnerHTML: { __html: card.bodyHtml }
|
|
54331
|
+
}) : null;
|
|
54332
|
+
/** The post itself: its format's marks, its text, and its files. */ var PostContent = ({ card, imagesInside }) => {
|
|
54333
|
+
const thread = card.thread;
|
|
54334
|
+
const quoteSource = [card.quote?.attribution, card.quote?.source].filter(Boolean).join(" · ");
|
|
54335
|
+
return /*#__PURE__*/ jsxDEV$1(Fragment$2, { children: [
|
|
54336
|
+
/*#__PURE__*/ jsxDEV$1("div", {
|
|
54337
|
+
class: "share-card-date",
|
|
54338
|
+
children: [card.date, thread && /*#__PURE__*/ jsxDEV$1("span", {
|
|
54339
|
+
class: "share-card-thread-position",
|
|
54340
|
+
children: [
|
|
54341
|
+
thread.position,
|
|
54342
|
+
" / ",
|
|
54343
|
+
thread.total
|
|
54344
|
+
]
|
|
54345
|
+
})]
|
|
54346
|
+
}),
|
|
54347
|
+
card.link && (card.link.domain || card.link.title) && /*#__PURE__*/ jsxDEV$1("div", {
|
|
54348
|
+
class: "share-card-link",
|
|
54349
|
+
children: [card.link.domain && /*#__PURE__*/ jsxDEV$1("div", {
|
|
54350
|
+
class: "share-card-link-domain",
|
|
54351
|
+
children: [/*#__PURE__*/ jsxDEV$1(Icon$1, { name: "link-domain" }), /*#__PURE__*/ jsxDEV$1("span", { children: card.link.domain })]
|
|
54352
|
+
}), card.link.title && /*#__PURE__*/ jsxDEV$1("h2", {
|
|
54353
|
+
class: "share-card-link-title",
|
|
54354
|
+
children: card.link.title
|
|
54355
|
+
})]
|
|
54356
|
+
}),
|
|
54357
|
+
card.quote && /*#__PURE__*/ jsxDEV$1("figure", {
|
|
54358
|
+
class: "share-card-quote",
|
|
54359
|
+
children: [
|
|
54360
|
+
/*#__PURE__*/ jsxDEV$1(DecorativeQuoteMark, { class: "share-card-quote-mark" }),
|
|
54361
|
+
/*#__PURE__*/ jsxDEV$1("blockquote", {
|
|
54362
|
+
class: "share-card-quote-text",
|
|
54363
|
+
"data-size": card.quote.size,
|
|
54364
|
+
children: card.quote.text
|
|
54365
|
+
}),
|
|
54366
|
+
quoteSource && /*#__PURE__*/ jsxDEV$1("figcaption", {
|
|
54367
|
+
class: "share-card-quote-source",
|
|
54368
|
+
children: quoteSource
|
|
54369
|
+
})
|
|
54370
|
+
]
|
|
54371
|
+
}),
|
|
54372
|
+
card.title && /*#__PURE__*/ jsxDEV$1("h2", {
|
|
54373
|
+
class: "share-card-title",
|
|
54374
|
+
children: card.title
|
|
54375
|
+
}),
|
|
54376
|
+
/*#__PURE__*/ jsxDEV$1(Body, { card }),
|
|
54377
|
+
card.hasMore && !card.bodyHtml && /*#__PURE__*/ jsxDEV$1("div", {
|
|
54378
|
+
class: "share-card-more",
|
|
54379
|
+
"aria-hidden": "true",
|
|
54380
|
+
children: "…"
|
|
54381
|
+
}),
|
|
54382
|
+
imagesInside && /*#__PURE__*/ jsxDEV$1(Images, { card }),
|
|
54383
|
+
/*#__PURE__*/ jsxDEV$1(Files, { card })
|
|
54384
|
+
] });
|
|
54385
|
+
};
|
|
54386
|
+
/** A wordless post's images: a few tiles, the last counting the rest. */ var ContextImages = ({ post }) => {
|
|
54387
|
+
const images = post.images ?? [];
|
|
54388
|
+
if (images.length === 0) return null;
|
|
54389
|
+
const last = images.length - 1;
|
|
54390
|
+
const more = post.moreImages ?? 0;
|
|
54391
|
+
return /*#__PURE__*/ jsxDEV$1("div", {
|
|
54392
|
+
class: "share-card-context-images",
|
|
54393
|
+
"data-count": String(images.length),
|
|
54394
|
+
children: images.map((image, index) => /*#__PURE__*/ jsxDEV$1("span", {
|
|
54395
|
+
class: "share-card-context-image",
|
|
54396
|
+
children: [
|
|
54397
|
+
/*#__PURE__*/ jsxDEV$1("img", {
|
|
54398
|
+
src: image.url,
|
|
54399
|
+
alt: ""
|
|
54400
|
+
}),
|
|
54401
|
+
image.video && /*#__PURE__*/ jsxDEV$1("span", {
|
|
54402
|
+
class: "share-card-play",
|
|
54403
|
+
"aria-hidden": "true",
|
|
54404
|
+
children: /*#__PURE__*/ jsxDEV$1("svg", {
|
|
54405
|
+
viewBox: "0 0 24 24",
|
|
54406
|
+
fill: "currentColor",
|
|
54407
|
+
children: /*#__PURE__*/ jsxDEV$1("path", { d: "M8 5v14l11-7z" })
|
|
54408
|
+
})
|
|
54409
|
+
}),
|
|
54410
|
+
index === last && more > 0 && /*#__PURE__*/ jsxDEV$1("span", {
|
|
54411
|
+
class: "share-card-more-images",
|
|
54412
|
+
children: ["+", more]
|
|
54413
|
+
})
|
|
54414
|
+
]
|
|
54415
|
+
}))
|
|
54416
|
+
});
|
|
54417
|
+
};
|
|
54418
|
+
/** The Thread's first post or the post after the shared one, quieter. */ var ContextPost = ({ post, next }) => /*#__PURE__*/ jsxDEV$1("div", {
|
|
54419
|
+
class: `share-card-thread-item share-card-context${next ? " is-next" : " is-root"}${post.source ? " has-source" : ""}`,
|
|
54420
|
+
"data-format": post.format,
|
|
54421
|
+
children: post.title || post.text ? /*#__PURE__*/ jsxDEV$1("div", {
|
|
54422
|
+
class: "share-card-context-text",
|
|
54423
|
+
children: [
|
|
54424
|
+
post.title && /*#__PURE__*/ jsxDEV$1("span", {
|
|
54425
|
+
class: "share-card-context-title",
|
|
54426
|
+
children: post.title
|
|
54427
|
+
}),
|
|
54428
|
+
post.text && /*#__PURE__*/ jsxDEV$1("span", {
|
|
54429
|
+
class: "share-card-context-body",
|
|
54430
|
+
children: post.text
|
|
54431
|
+
}),
|
|
54432
|
+
post.source && /*#__PURE__*/ jsxDEV$1("span", {
|
|
54433
|
+
class: "share-card-context-source",
|
|
54434
|
+
children: post.source
|
|
54435
|
+
})
|
|
54436
|
+
]
|
|
54437
|
+
}) : /*#__PURE__*/ jsxDEV$1(ContextImages, { post })
|
|
54438
|
+
});
|
|
54439
|
+
var Thread = ({ card }) => {
|
|
54440
|
+
const thread = card.thread;
|
|
54441
|
+
if (!thread) return null;
|
|
54442
|
+
return /*#__PURE__*/ jsxDEV$1("div", {
|
|
54443
|
+
class: "share-card-thread",
|
|
54444
|
+
children: [
|
|
54445
|
+
thread.root && /*#__PURE__*/ jsxDEV$1(ContextPost, { post: thread.root }),
|
|
54446
|
+
thread.hidden > 0 && /*#__PURE__*/ jsxDEV$1("div", {
|
|
54447
|
+
class: "share-card-thread-item share-card-thread-gap",
|
|
54448
|
+
"data-hidden": String(thread.hidden),
|
|
54449
|
+
"aria-hidden": "true"
|
|
54450
|
+
}),
|
|
54451
|
+
/*#__PURE__*/ jsxDEV$1("div", {
|
|
54452
|
+
class: "share-card-thread-item share-card-thread-current",
|
|
54453
|
+
children: /*#__PURE__*/ jsxDEV$1(PostContent, {
|
|
54454
|
+
card,
|
|
54455
|
+
imagesInside: true
|
|
54456
|
+
})
|
|
54457
|
+
}),
|
|
54458
|
+
thread.next && /*#__PURE__*/ jsxDEV$1(ContextPost, {
|
|
54459
|
+
post: thread.next,
|
|
54460
|
+
next: true
|
|
54461
|
+
})
|
|
54462
|
+
]
|
|
54463
|
+
});
|
|
54464
|
+
};
|
|
54465
|
+
var ShareCard = ({ card }) => /*#__PURE__*/ jsxDEV$1("div", {
|
|
54466
|
+
class: "share-card",
|
|
54467
|
+
"data-share-card": true,
|
|
54468
|
+
"data-file-name": card.fileName,
|
|
54469
|
+
"data-layout": card.layout,
|
|
54470
|
+
"data-thread": card.thread ? "" : void 0,
|
|
54471
|
+
lang: card.language,
|
|
54472
|
+
children: /*#__PURE__*/ jsxDEV$1("div", {
|
|
54473
|
+
class: "share-card-paper",
|
|
54474
|
+
children: [!card.thread && /*#__PURE__*/ jsxDEV$1(Images, { card }), /*#__PURE__*/ jsxDEV$1("div", {
|
|
54475
|
+
class: "share-card-inner",
|
|
54476
|
+
children: [card.thread ? /*#__PURE__*/ jsxDEV$1(Thread, { card }) : /*#__PURE__*/ jsxDEV$1(PostContent, { card }), /*#__PURE__*/ jsxDEV$1("footer", {
|
|
54477
|
+
class: "share-card-foot",
|
|
54478
|
+
children: [
|
|
54479
|
+
/*#__PURE__*/ jsxDEV$1(Avatar, { card }),
|
|
54480
|
+
/*#__PURE__*/ jsxDEV$1("div", {
|
|
54481
|
+
class: "share-card-source",
|
|
54482
|
+
children: [/*#__PURE__*/ jsxDEV$1("span", {
|
|
54483
|
+
class: "share-card-site",
|
|
54484
|
+
children: card.siteName
|
|
54485
|
+
}), card.siteAddress && /*#__PURE__*/ jsxDEV$1("span", {
|
|
54486
|
+
class: "share-card-address",
|
|
54487
|
+
children: card.siteAddress
|
|
54488
|
+
})]
|
|
54489
|
+
}),
|
|
54490
|
+
/*#__PURE__*/ jsxDEV$1("span", {
|
|
54491
|
+
class: "share-card-qr",
|
|
54492
|
+
dangerouslySetInnerHTML: { __html: card.qrSvg }
|
|
54493
|
+
})
|
|
54494
|
+
]
|
|
54495
|
+
})]
|
|
54496
|
+
})]
|
|
54497
|
+
})
|
|
54498
|
+
});
|
|
54499
|
+
//#endregion
|
|
53812
54500
|
//#region src/routes/pages/partials.tsx
|
|
53813
54501
|
var partialPageRoutes = new Hono();
|
|
53814
54502
|
partialPageRoutes.get("/_/version", (c) => {
|
|
@@ -53885,6 +54573,20 @@ partialPageRoutes.get("/_/post-card/:postId", async (c) => {
|
|
|
53885
54573
|
})
|
|
53886
54574
|
}));
|
|
53887
54575
|
});
|
|
54576
|
+
/**
|
|
54577
|
+
* The card "Share as image" captures, for the author and readers alike: it
|
|
54578
|
+
* shows only what the post's own address already does, and
|
|
54579
|
+
* `assembleShareCard` refuses drafts and Private posts. Icons are drawn
|
|
54580
|
+
* inline because the capture copies the card without the page's icon sprite.
|
|
54581
|
+
*/ partialPageRoutes.get("/_/share-card/:postId", async (c) => {
|
|
54582
|
+
const card = await assembleShareCard(c, parseIdParam(c.req.param("postId"), ID_PREFIX.post));
|
|
54583
|
+
if (!card) return c.notFound();
|
|
54584
|
+
const html = renderIconsInline(() => (/*#__PURE__*/ jsxDEV$1(I18nProvider, {
|
|
54585
|
+
c,
|
|
54586
|
+
children: /*#__PURE__*/ jsxDEV$1(ShareCard, { card })
|
|
54587
|
+
})).toString());
|
|
54588
|
+
return c.html(html);
|
|
54589
|
+
});
|
|
53888
54590
|
partialPageRoutes.get("/_/post-view/:postId", async (c) => {
|
|
53889
54591
|
const display = await assemblePostPageDisplay(c, parseIdParam(c.req.param("postId"), ID_PREFIX.post), { isAuthenticated: c.var.isAuthenticated });
|
|
53890
54592
|
if (!display) return c.notFound();
|