@jant/core 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/commands/site/import.js +2 -1
- package/bin/lib/site-snapshot.js +10 -0
- package/dist/{app-CKQ9PqAr.js → app-C8dETvgL.js} +9267 -5697
- package/dist/client/.vite/manifest.json +82 -93
- package/dist/client/_assets/chunks/{confirm-CMe01lne.js → confirm-BQebcuNB.js} +1 -1
- package/dist/client/_assets/chunks/{create-editor-BQkrw8Ax.js → create-editor-B8KuszlS.js} +38 -38
- package/dist/client/_assets/chunks/footnote-rail-DUrqz0Py.js +2 -0
- package/dist/client/_assets/chunks/{jant-locale-picker-2L4rkDaz.js → jant-locale-picker-CLq0iKDH.js} +1 -1
- package/dist/client/_assets/chunks/lit-BN4mrI3j.js +2 -0
- package/dist/client/_assets/chunks/{settings-paths-B0bNUaih.js → settings-paths-_fry4yWW.js} +1 -1
- package/dist/client/_assets/chunks/{slug-format-CYmQE5ln.js → slug-format-bcJ2ozr4.js} +1 -1
- package/dist/client/_assets/chunks/sortable-list-Bz2Na2E9.js +2 -0
- package/dist/client/_assets/chunks/types-DrYFqJH2.js +1 -0
- package/dist/client/_assets/chunks/{unsafe-html-CWos3v6N.js → unsafe-html-OJ9m154w.js} +1 -1
- package/dist/client/_assets/chunks/unsafe-svg-DVJ4NPcb.js +1 -0
- package/dist/client/_assets/client-CoNHvipV.css +2 -0
- package/dist/client/_assets/{client-auth-CG55rWb5.js → client-auth-CbnZkLJ6.js} +99 -129
- package/dist/client/_assets/{client-author-CGVvrNZ8.css → client-author-2WYBkgni.css} +1 -1
- package/dist/client/_assets/client-compose-DYtDlYm-.js +2008 -0
- package/dist/client/_assets/{client-manage-DnYdQAhf.js → client-manage-BODyYP5Z.js} +157 -157
- package/dist/client/_assets/client-pq6sVS7y.js +354 -0
- package/dist/client/_assets/{client-settings-CHgsIqXJ.js → client-settings-DDpe_tXJ.js} +166 -166
- package/dist/client/_assets/client-share-B9OsXx9p.js +149 -0
- package/dist/{constants-DEgyqWDl.js → constants-C2CdWAqt.js} +55 -5
- package/dist/index.js +1 -1
- package/dist/node.js +3 -2
- package/package.json +2 -1
- package/src/app.tsx +9 -0
- package/src/client/components/compose-types.ts +6 -1
- package/src/client/components/jant-compose-dialog.ts +26 -4
- package/src/client/components/jant-compose-editor.ts +30 -0
- package/src/client/components/jant-compose-fullscreen.ts +1 -0
- package/src/client/components/jant-media-lightbox.ts +18 -3
- package/src/client/components/jant-nav-manager.ts +2 -0
- package/src/client/components/jant-post-menu.ts +42 -89
- package/src/client/components/nav-manager-types.ts +2 -0
- package/src/client/components/settings-types.ts +1 -1
- package/src/client/compose-bridge.ts +61 -1
- package/src/client/feed-video-player.ts +6 -0
- package/src/client/list-views.ts +382 -0
- package/src/client/media-lightbox-events.ts +12 -0
- package/src/client/runtime-paths.ts +12 -0
- package/src/client/share-capture.ts +63 -0
- package/src/client/share-launch.ts +36 -9
- package/src/client/tiptap/bubble-menu.ts +25 -2
- package/src/client/tiptap/create-editor.ts +6 -0
- package/src/client/tiptap/embed-node.ts +3 -1
- package/src/client/tiptap/extensions.ts +4 -0
- package/src/client/tiptap/html-block-node.ts +3 -1
- package/src/client/tiptap/image-node.ts +3 -1
- package/src/client/video-processor.ts +106 -52
- package/src/client/view-confirm.ts +136 -0
- package/src/client.ts +2 -0
- package/src/db/migrations/0035_brainy_next_avengers.sql +9 -0
- package/src/db/migrations/0036_gorgeous_smasher.sql +7 -0
- package/src/db/migrations/0037_round_post.sql +16 -0
- package/src/db/migrations/0038_flashy_changeling.sql +15 -0
- package/src/db/migrations/0039_mixed_sister_grimm.sql +1 -0
- package/src/db/migrations/meta/0035_snapshot.json +2877 -0
- package/src/db/migrations/meta/0036_snapshot.json +2924 -0
- package/src/db/migrations/meta/0037_snapshot.json +2932 -0
- package/src/db/migrations/meta/0038_snapshot.json +2924 -0
- package/src/db/migrations/meta/0039_snapshot.json +2931 -0
- package/src/db/migrations/meta/_journal.json +35 -0
- package/src/db/migrations/pg/0033_cute_magdalene.sql +10 -0
- package/src/db/migrations/pg/0034_material_agent_brand.sql +8 -0
- package/src/db/migrations/pg/0035_flimsy_outlaw_kid.sql +3 -0
- package/src/db/migrations/pg/0036_milky_wolverine.sql +5 -0
- package/src/db/migrations/pg/0037_fuzzy_hammerhead.sql +1 -0
- package/src/db/migrations/pg/meta/0033_snapshot.json +3719 -0
- package/src/db/migrations/pg/meta/0034_snapshot.json +3766 -0
- package/src/db/migrations/pg/meta/0035_snapshot.json +3773 -0
- package/src/db/migrations/pg/meta/0036_snapshot.json +3766 -0
- package/src/db/migrations/pg/meta/0037_snapshot.json +3772 -0
- package/src/db/migrations/pg/meta/_journal.json +35 -0
- package/src/db/pg/schema.ts +41 -0
- package/src/db/post-visibility.ts +37 -6
- package/src/db/schema.ts +64 -0
- package/src/i18n/locales/glossary.zh-Hans.yml +4 -0
- package/src/i18n/locales/glossary.zh-Hant.yml +4 -0
- package/src/i18n/locales/public/en.po +26 -7
- package/src/i18n/locales/public/en.ts +1 -1
- package/src/i18n/locales/public/zh-Hans.po +25 -6
- package/src/i18n/locales/public/zh-Hans.ts +1 -1
- package/src/i18n/locales/public/zh-Hant.po +25 -6
- package/src/i18n/locales/public/zh-Hant.ts +1 -1
- package/src/i18n/locales/settings/en.po +159 -0
- package/src/i18n/locales/settings/en.ts +1 -1
- package/src/i18n/locales/settings/zh-Hans.po +159 -0
- package/src/i18n/locales/settings/zh-Hans.ts +1 -1
- package/src/i18n/locales/settings/zh-Hant.po +159 -0
- package/src/i18n/locales/settings/zh-Hant.ts +1 -1
- package/src/lib/api-public-posts.ts +10 -0
- package/src/lib/env.ts +20 -0
- package/src/lib/feed-policy.ts +2 -2
- package/src/lib/filter-dimensions.ts +11 -4
- package/src/lib/github-app-state.ts +1 -1
- package/src/lib/github-app.ts +183 -1
- package/src/lib/hugo-markdown.ts +7 -0
- package/src/lib/icons.ts +2 -0
- package/src/lib/link-preview.ts +499 -0
- package/src/lib/list-views.ts +117 -0
- package/src/lib/markdown-manager.ts +169 -2
- package/src/lib/navigation.ts +1 -1
- package/src/lib/post-meta.ts +13 -3
- package/src/lib/referrer-aliases.ts +311 -0
- package/src/lib/render.tsx +10 -0
- package/src/lib/resolve-config.ts +14 -0
- package/src/lib/share-card.ts +4 -3
- package/src/lib/summary.ts +152 -54
- package/src/lib/thread-query.ts +6 -2
- package/src/lib/timeline.ts +12 -11
- package/src/lib/tiptap-render.ts +1 -0
- package/src/lib/upload.ts +21 -1
- package/src/lib/url-fetch.ts +291 -74
- package/src/lib/video-playback.ts +55 -0
- package/src/lib/view-buffer.ts +201 -0
- package/src/lib/view-counting.ts +540 -0
- package/src/lib/view-token.ts +199 -0
- package/src/lib/view.ts +30 -1
- package/src/middleware/view-counter.ts +145 -0
- package/src/node/runtime.ts +4 -0
- package/src/preset.css +36 -17
- package/src/routes/api/media.ts +21 -3
- package/src/routes/api/search.ts +1 -1
- package/src/routes/dash/settings.tsx +434 -169
- package/src/routes/feed/sitemap.ts +1 -1
- package/src/routes/pages/archive.tsx +26 -19
- package/src/routes/pages/collection.tsx +9 -3
- package/src/routes/pages/collections.tsx +1 -0
- package/src/routes/pages/featured.tsx +1 -0
- package/src/routes/pages/home.tsx +1 -0
- package/src/routes/pages/page.tsx +18 -3
- package/src/routes/pages/search.tsx +3 -3
- package/src/routes/pages/smart-collection.tsx +2 -0
- package/src/routes/pages/subscribe.tsx +1 -0
- package/src/routes/view-confirm.ts +71 -0
- package/src/services/collection.ts +1 -1
- package/src/services/export-theme/assets/client-site.js +19 -19
- package/src/services/export-theme/layouts/archive/list.html +4 -2
- package/src/services/export-theme/layouts/partials/collection-members.html +4 -3
- package/src/services/export-theme/layouts/partials/featured-members.html +3 -3
- package/src/services/export-theme/layouts/partials/head.html +2 -0
- package/src/services/export-theme/layouts/partials/latest-members.html +4 -4
- package/src/services/export-theme/layouts/partials/post-card.html +1 -9
- package/src/services/export-theme/layouts/partials/reply.html +1 -9
- package/src/services/export-theme/layouts/partials/smart-collection-members.html +4 -3
- package/src/services/export-theme/layouts/post/list.html +1 -9
- package/src/services/export-theme/styles/main.css +41 -47
- package/src/services/export.ts +12 -3
- package/src/services/index.ts +17 -0
- package/src/services/mcp.ts +36 -6
- package/src/services/media.ts +63 -0
- package/src/services/navigation.ts +9 -4
- package/src/services/post.ts +102 -112
- package/src/services/search.ts +22 -7
- package/src/services/smart-collection.ts +3 -3
- package/src/services/stats.ts +1137 -0
- package/src/services/thread.ts +6 -2
- package/src/styles/components-author.css +242 -3
- package/src/styles/components.css +11 -3
- package/src/styles/tokens.css +89 -55
- package/src/styles/ui-author.css +140 -353
- package/src/styles/ui.css +90 -45
- package/src/types/app-context.ts +9 -0
- package/src/types/bindings.ts +5 -0
- package/src/types/config.ts +54 -0
- package/src/types/constants.ts +68 -4
- package/src/types/entities.ts +1 -0
- package/src/types/views.ts +8 -0
- package/src/ui/compose/ComposeDialog.tsx +26 -1
- package/src/ui/dash/StatusBadge.tsx +11 -0
- package/src/ui/dash/appearance/FontThemeContent.tsx +1 -1
- package/src/ui/dash/appearance/NavigationContent.tsx +8 -0
- package/src/ui/dash/settings/SettingsRootContent.tsx +24 -6
- package/src/ui/dash/settings/StatsContent.tsx +855 -0
- package/src/ui/feed/LinkCard.tsx +19 -2
- package/src/ui/feed/PostStatusBadges.tsx +19 -3
- package/src/ui/feed/TimelineFeed.tsx +3 -0
- package/src/ui/font-themes.ts +56 -6
- package/src/ui/layouts/BaseLayout.tsx +4 -2
- package/src/ui/layouts/SiteLayout.tsx +8 -3
- package/src/ui/pages/ArchivePage.tsx +1 -0
- package/src/ui/shared/MediaGallery.tsx +19 -3
- package/src/ui/shared/PostFooter.tsx +1 -22
- package/src/ui/shared/custom-icons.ts +5 -5
- package/dist/client/_assets/chunks/footnote-rail-B08scyhW.js +0 -2
- package/dist/client/_assets/chunks/lit-Bw_voPoW.js +0 -2
- package/dist/client/_assets/chunks/runtime-paths-y0_gHowM.js +0 -1
- package/dist/client/_assets/chunks/sortable-list-t11Ma1Ek.js +0 -2
- package/dist/client/_assets/chunks/types-D5iF3H1a.js +0 -1
- package/dist/client/_assets/chunks/unsafe-svg-DZl-yjas.js +0 -1
- package/dist/client/_assets/client-B0-s9sqx.css +0 -2
- package/dist/client/_assets/client-Dp46QSht.js +0 -354
- package/dist/client/_assets/client-compose-DkUTuavR.js +0 -2004
- package/dist/client/_assets/client-share-C59mOLJ1.js +0 -149
package/src/ui/feed/LinkCard.tsx
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
13
|
-
* actually apply — usually none at all.
|
|
14
|
-
*
|
|
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>
|
package/src/ui/font-themes.ts
CHANGED
|
@@ -33,12 +33,20 @@ export interface FontTheme {
|
|
|
33
33
|
description: MessageDescriptor;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/*
|
|
37
|
+
* Serif stacks lead on the system face with real weights, then the vendored
|
|
38
|
+
* Noto Serif (loaded by the profile stylesheet) and its installed siblings,
|
|
39
|
+
* and only then SimSun / PMingLiU. Those two ship one weight: a heading set
|
|
40
|
+
* in them is synthetic bold, smeared at every size, which is what every
|
|
41
|
+
* Windows reader of a serif-headed site used to get because they sat ahead
|
|
42
|
+
* of the face the site ships.
|
|
43
|
+
*/
|
|
36
44
|
const HANS_CJK_SERIF_FALLBACK =
|
|
37
|
-
'"Songti SC",
|
|
45
|
+
'"Songti SC", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", STSong, SimSun, "Songti TC", "Noto Serif TC", "Noto Serif CJK TC", "Source Han Serif TC", PMingLiU, MingLiU';
|
|
38
46
|
const HANS_CJK_SANS_FALLBACK =
|
|
39
47
|
'"PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "PingFang TC", "Hiragino Sans CNS", "Microsoft JhengHei", "Noto Sans TC", "Noto Sans CJK TC"';
|
|
40
48
|
const HANT_CJK_SERIF_FALLBACK =
|
|
41
|
-
'"Songti TC",
|
|
49
|
+
'"Songti TC", "Noto Serif TC", "Noto Serif CJK TC", "Source Han Serif TC", PMingLiU, MingLiU, "Songti SC", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", STSong, SimSun';
|
|
42
50
|
const HANT_CJK_SANS_FALLBACK =
|
|
43
51
|
'"PingFang TC", "Hiragino Sans CNS", "Microsoft JhengHei", "Noto Sans TC", "Noto Sans CJK TC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC"';
|
|
44
52
|
const JP_CJK_SERIF_FALLBACK =
|
|
@@ -148,18 +156,50 @@ export function resolveCjkFontProfile(
|
|
|
148
156
|
return language ? getCjkFontFromLanguageTag(language) : undefined;
|
|
149
157
|
}
|
|
150
158
|
|
|
159
|
+
/*
|
|
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.
|
|
178
|
+
*/
|
|
179
|
+
const CJK_READING_PROFILE = {
|
|
180
|
+
"--type-body-leading": "1.75",
|
|
181
|
+
"--type-heading-leading": "1.3",
|
|
182
|
+
"--type-heading-weight": "var(--fw-medium)",
|
|
183
|
+
"--type-display-weight": "var(--fw-medium)",
|
|
184
|
+
};
|
|
185
|
+
|
|
151
186
|
/**
|
|
152
|
-
* Build
|
|
187
|
+
* Build the CSS variables a page in a CJK language needs: the serif and sans
|
|
188
|
+
* fallback stacks for its script, the reading rhythm its glyphs call for, and
|
|
189
|
+
* the heading weight its faces have.
|
|
153
190
|
*
|
|
154
191
|
* Empty for a language with no profile: `tokens.css` already carries a real
|
|
155
|
-
* script-neutral stack in both variables
|
|
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.
|
|
156
196
|
*
|
|
157
197
|
* @param language - BCP 47 content language tag
|
|
158
198
|
* @returns CSS variables consumed by every font theme, empty when the token
|
|
159
199
|
* defaults already apply
|
|
160
200
|
* @example
|
|
161
201
|
* getCjkFontCssVariables("zh-Hans")
|
|
162
|
-
* // => { "--font-cjk-serif-fallback": '"Songti SC", ...', ... }
|
|
202
|
+
* // => { "--font-cjk-serif-fallback": '"Songti SC", ...', ..., "--type-body-leading": "1.75", "--type-heading-weight": "var(--fw-medium)", ... }
|
|
163
203
|
*/
|
|
164
204
|
export function getCjkFontCssVariables(
|
|
165
205
|
language?: string,
|
|
@@ -169,21 +209,25 @@ export function getCjkFontCssVariables(
|
|
|
169
209
|
return {
|
|
170
210
|
"--font-cjk-serif-fallback": HANS_CJK_SERIF_FALLBACK,
|
|
171
211
|
"--font-cjk-sans-fallback": HANS_CJK_SANS_FALLBACK,
|
|
212
|
+
...CJK_READING_PROFILE,
|
|
172
213
|
};
|
|
173
214
|
case "zh-Hant":
|
|
174
215
|
return {
|
|
175
216
|
"--font-cjk-serif-fallback": HANT_CJK_SERIF_FALLBACK,
|
|
176
217
|
"--font-cjk-sans-fallback": HANT_CJK_SANS_FALLBACK,
|
|
218
|
+
...CJK_READING_PROFILE,
|
|
177
219
|
};
|
|
178
220
|
case "ja":
|
|
179
221
|
return {
|
|
180
222
|
"--font-cjk-serif-fallback": JP_CJK_SERIF_FALLBACK,
|
|
181
223
|
"--font-cjk-sans-fallback": JP_CJK_SANS_FALLBACK,
|
|
224
|
+
...CJK_READING_PROFILE,
|
|
182
225
|
};
|
|
183
226
|
case "ko":
|
|
184
227
|
return {
|
|
185
228
|
"--font-cjk-serif-fallback": KO_CJK_SERIF_FALLBACK,
|
|
186
229
|
"--font-cjk-sans-fallback": KO_CJK_SANS_FALLBACK,
|
|
230
|
+
...CJK_READING_PROFILE,
|
|
187
231
|
};
|
|
188
232
|
default:
|
|
189
233
|
return {};
|
|
@@ -227,7 +271,13 @@ export const BUILTIN_FONT_THEMES: FontTheme[] = [
|
|
|
227
271
|
},
|
|
228
272
|
headingFontFamily: TUFTE_SERIF,
|
|
229
273
|
bodyFontFamily: TUFTE_SERIF,
|
|
230
|
-
cssVariables: {
|
|
274
|
+
cssVariables: {
|
|
275
|
+
// Tufte CSS sets its headings in the regular weight and lets size and
|
|
276
|
+
// space carry the hierarchy; the semibold default would hand it
|
|
277
|
+
// Palatino Bold.
|
|
278
|
+
"--type-heading-weight": "var(--fw-regular)",
|
|
279
|
+
"--type-display-weight": "var(--fw-regular)",
|
|
280
|
+
},
|
|
231
281
|
description: {
|
|
232
282
|
id: "Palatino-based old-style serif matching Tufte CSS proportions",
|
|
233
283
|
message: "Palatino-based old-style serif matching Tufte CSS proportions",
|
|
@@ -587,10 +587,12 @@ export const BaseLayout: FC<PropsWithChildren<BaseLayoutProps>> = ({
|
|
|
587
587
|
<link rel="stylesheet" href={authorStylesheetPath} />
|
|
588
588
|
)}
|
|
589
589
|
{/* Critical inline style: prevent mobile nav jitter by applying
|
|
590
|
-
responsive header layout before external CSS/JS loads
|
|
590
|
+
responsive header layout before external CSS/JS loads. The nav
|
|
591
|
+
tiers query the header's width, as in ui.css, so the container
|
|
592
|
+
is declared here too. */}
|
|
591
593
|
<style
|
|
592
594
|
dangerouslySetInnerHTML={{
|
|
593
|
-
__html: `.site-header-search-link,.site-header-hamburger,.site-header-more-responsive-only,.site-header-more-link-responsive,.site-header-more-divider-responsive{display:none!important}@media(max-width:1200px){.site-header-search-form{display:none!important}.site-header-search-link{display:inline-flex!important}}@
|
|
595
|
+
__html: `.site-header{container:site-header/inline-size}.site-header-search-link,.site-header-hamburger,.site-header-more-responsive-only,.site-header-more-link-responsive,.site-header-more-divider-responsive{display:none!important}@media(max-width:1200px){.site-header-search-form{display:none!important}.site-header-search-link{display:inline-flex!important}}@container site-header (width<802px){.site-header-link-collapse-lg{display:none!important}.site-header-more-responsive-only.site-header-more-tier-lg{display:inline-flex!important}.site-header-more-link-show-lg{display:flex!important}.site-header-more-divider-show-lg{display:block!important}}@container site-header (width<652px){.site-header-link-collapse-md{display:none!important}.site-header-more-responsive-only.site-header-more-tier-md{display:inline-flex!important}.site-header-more-link-show-md{display:flex!important}.site-header-more-divider-show-md{display:block!important}}@container site-header (width<522px){.site-header-link-collapse-sm{display:none!important}.site-header-more-responsive-only.site-header-more-tier-sm{display:inline-flex!important}.site-header-more-link-show-sm{display:flex!important}.site-header-more-divider-show-sm{display:block!important}}@media(max-width:480px){.site-header-nav,.site-header-more{display:none!important}.site-header-search-slot{display:flex!important}.site-header-hamburger{display:flex!important}.site-header-right{margin-left:.35rem}}`,
|
|
594
596
|
}}
|
|
595
597
|
/>
|
|
596
598
|
{/* Emitted before the theme style so a font theme that names its own
|
|
@@ -634,6 +634,7 @@ export const SiteLayout: FC<PropsWithChildren<SiteLayoutProps>> = ({
|
|
|
634
634
|
siteFooterHtml,
|
|
635
635
|
showHomeBranding = false,
|
|
636
636
|
sidebar,
|
|
637
|
+
wideFrame = false,
|
|
637
638
|
uploadMaxFileSize,
|
|
638
639
|
showComposeDialog = true,
|
|
639
640
|
showHeader = true,
|
|
@@ -666,9 +667,13 @@ export const SiteLayout: FC<PropsWithChildren<SiteLayoutProps>> = ({
|
|
|
666
667
|
.join(" ");
|
|
667
668
|
// The page, not the content, keeps room for the button: the footer and the
|
|
668
669
|
// Jant credit come after the content, and they must end above it too.
|
|
669
|
-
const pageClass =
|
|
670
|
-
|
|
671
|
-
|
|
670
|
+
const pageClass = [
|
|
671
|
+
"site-page",
|
|
672
|
+
showMobileComposeFab ? "site-page-mobile-compose-enabled" : "",
|
|
673
|
+
wideFrame ? "site-page-wide" : "",
|
|
674
|
+
]
|
|
675
|
+
.filter(Boolean)
|
|
676
|
+
.join(" ");
|
|
672
677
|
|
|
673
678
|
return (
|
|
674
679
|
<div class={pageClass}>
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
import type { FC } from "hono/jsx";
|
|
22
22
|
import type { MediaView } from "../../types.js";
|
|
23
23
|
import { getMediaCategory } from "../../lib/upload.js";
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
getPosterFrameUrl,
|
|
26
|
+
shouldUseShortVideoExperience,
|
|
27
|
+
} from "../../lib/video-playback.js";
|
|
25
28
|
import {
|
|
26
29
|
blurhashToDataUrl,
|
|
27
30
|
getBlurhashDecodeSize,
|
|
@@ -455,6 +458,14 @@ export const MediaGallery: FC<MediaGalleryProps> = ({
|
|
|
455
458
|
? undefined
|
|
456
459
|
: `${Math.round(Math.max(160, rowHeight * ratio))}px`;
|
|
457
460
|
const posterSrc = item.posterUrl || placeholder;
|
|
461
|
+
/* A clip stored without a poster (an API upload that sent
|
|
462
|
+
none) would show an empty box: these `<video>`s only ever
|
|
463
|
+
paint their poster. Without one, the browser reads the
|
|
464
|
+
file's metadata and draws the poster frame itself — at
|
|
465
|
+
once for a long clip, and for a short one when the feed
|
|
466
|
+
player hands it its source near the viewport. */
|
|
467
|
+
const drawsOwnFrame = !item.posterUrl;
|
|
468
|
+
const videoPreload = drawsOwnFrame ? "metadata" : "none";
|
|
458
469
|
/* `video.u-photo` resolves to `poster`, which is the still
|
|
459
470
|
the timeline already shows. Only a real poster qualifies:
|
|
460
471
|
the blurhash fallback is a data URL, and publishing one as
|
|
@@ -505,7 +516,7 @@ export const MediaGallery: FC<MediaGalleryProps> = ({
|
|
|
505
516
|
class="u-video media-visual-frame media-video-link"
|
|
506
517
|
>
|
|
507
518
|
<video
|
|
508
|
-
preload=
|
|
519
|
+
preload={videoPreload}
|
|
509
520
|
muted
|
|
510
521
|
playsinline
|
|
511
522
|
loop
|
|
@@ -569,10 +580,15 @@ export const MediaGallery: FC<MediaGalleryProps> = ({
|
|
|
569
580
|
}
|
|
570
581
|
>
|
|
571
582
|
<video
|
|
572
|
-
preload=
|
|
583
|
+
preload={videoPreload}
|
|
573
584
|
muted
|
|
574
585
|
playsinline
|
|
575
586
|
poster={posterSrc}
|
|
587
|
+
src={
|
|
588
|
+
drawsOwnFrame
|
|
589
|
+
? getPosterFrameUrl(item.url, item.durationSeconds)
|
|
590
|
+
: undefined
|
|
591
|
+
}
|
|
576
592
|
width={item.width}
|
|
577
593
|
height={item.height}
|
|
578
594
|
style={videoStyle}
|
|
@@ -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",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_assets/client-compose-DkUTuavR.js","_assets/chunks/runtime-paths-y0_gHowM.js","_assets/chunks/lit-Bw_voPoW.js","_assets/chunks/unsafe-html-CWos3v6N.js","_assets/chunks/preload-helper-Czpn1I53.js","_assets/chunks/unsafe-svg-DZl-yjas.js","_assets/chunks/types-D5iF3H1a.js","_assets/chunks/slug-format-CYmQE5ln.js","_assets/chunks/sortable-list-t11Ma1Ek.js","_assets/chunks/create-editor-BQkrw8Ax.js","_assets/client-settings-CHgsIqXJ.js","_assets/chunks/jant-locale-picker-2L4rkDaz.js","_assets/chunks/confirm-CMe01lne.js","_assets/client-manage-DnYdQAhf.js","_assets/chunks/site-header-nav-DzXsFk05.js","_assets/chunks/settings-paths-B0bNUaih.js","_assets/client-share-C59mOLJ1.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-Czpn1I53.js";var t=null,n=0,r=!1,i=null,a=null,o=0;function s(e){return!isFinite(e)||e<0?`0:00`:`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`}function c(e){return e.querySelector(`audio.media-audio-el`)}function l(e){return e.querySelector(`[data-audio-range]`)}function u(e){return e.querySelector(`[data-audio-waveform]`)}function d(e,t){let n=`${(t*100).toFixed(1)}%`;e.style.background=`linear-gradient(to right, var(--site-text-primary) ${n}, transparent ${n})`}var f=new WeakMap,p=new WeakSet;async function ee(e,t){let n=await(await fetch(e)).arrayBuffer(),r=new AudioContext;try{let e=(await r.decodeAudioData(n)).getChannelData(0),i=Math.max(1,Math.floor(e.length/t)),a=Array(t);for(let n=0;n<t;n++){let t=0,r=n*i,o=Math.min(r+i,e.length);for(let n=r;n<o;n++){let r=Math.abs(e[n]);r>t&&(t=r)}a[n]=t}let o=0;for(let e of a)e>o&&(o=e);if(o>0)for(let e=0;e<t;e++)a[e]/=o;return a}finally{await r.close()}}function m(e=document){let t=e.querySelectorAll(`[data-audio-peaks]`),n=[];for(let e of t){let t=e.dataset.audioPeaks;if(!t)continue;let r=e.closest(`.media-audio-card`);if(r&&!f.has(r))try{let e=JSON.parse(t);if(!Array.isArray(e))continue;f.set(r,e),r.classList.add(`has-waveform`),n.push(r)}catch{}}n.length>0&&requestAnimationFrame(()=>{for(let e of n)g(e,0)})}async function h(e){if(f.has(e)||p.has(e))return;p.add(e);let t=e.querySelector(`audio.media-audio-el source`),n=u(e);if(!t?.src||!n)return;let r=n.getBoundingClientRect().width,i=Math.max(20,Math.floor(r/3));try{let n=await ee(t.src,i);f.set(e,n),e.classList.add(`has-waveform`);let r=c(e),a=r?.duration??0;g(e,r&&isFinite(a)&&a>0?r.currentTime/a:0)}catch{}}function g(e,t){let n=f.get(e),r=u(e);if(!n||!r)return;let i=window.devicePixelRatio||1,a=r.getBoundingClientRect(),o=Math.round(a.width*i),s=Math.round(a.height*i);if(o===0||s===0)return;(r.width!==o||r.height!==s)&&(r.width=o,r.height=s);let c=r.getContext(`2d`);if(!c)return;c.clearRect(0,0,o,s);let l=n.length,d=o/l,p=Math.max(1,Math.round(d*.6)),ee=Math.round(2*i),m=s*.85,h=getComputedStyle(r).getPropertyValue(`--site-text-primary`).trim()||`#000`;for(let e=0;e<l;e++){let r=Math.round(e*d+(d-p)/2),a=Math.max(ee,Math.round(n[e]*m)),o=Math.round((s-a)/2);c.globalAlpha=(e+.5)/l<=t?.9:.2,c.fillStyle=h;let u=Math.min(p/2,i);c.beginPath(),c.roundRect(r,o,p,a,u),c.fill()}c.globalAlpha=1}function te(e,t){let{currentTime:n,duration:i}=t,a=isFinite(i)&&i>0,o=a?n/i:0;if(!r){let t=l(e);t&&a&&(t.value=String(Math.round(o*1e3)),d(t,o)),f.has(e)&&g(e,o);let r=e.querySelector(`[data-audio-time]`);r&&(r.textContent=a?`${s(n)} / ${s(i)}`:s(n))}}function _(){if(!t)return;let e=c(t);e&&!e.paused&&(te(t,e),n=requestAnimationFrame(_))}function v(){if(t){let e=c(t);e&&!e.paused&&e.pause(),t.classList.remove(`is-playing`),t=null}cancelAnimationFrame(n)}async function ne(e){let r=c(e);if(r){if(t&&t!==e&&v(),r.paused){t=e,e.classList.add(`is-playing`);try{await r.play()}catch{e.classList.remove(`is-playing`),t=null;return}n=requestAnimationFrame(_),h(e)}else r.pause(),e.classList.remove(`is-playing`),cancelAnimationFrame(n),t=null}}function re(e){let t=e.closest(`.media-audio-card`);if(!t)return;let n=c(t);if(!n)return;let r=Number(e.value)/1e3,i=n.duration;isFinite(i)&&i>0&&(n.currentTime=r*i)}function y(e,t){let n=e.getBoundingClientRect();o=Math.max(0,Math.min(1,(t.clientX-n.left)/n.width));let r=e.closest(`.media-audio-card`);if(!r)return;g(r,o);let i=c(r),a=r.querySelector(`[data-audio-time]`);if(i&&a){let e=i.duration;isFinite(e)&&e>0&&(a.textContent=`${s(o*e)} / ${s(e)}`)}}async function ie(e){let r=e.closest(`.media-audio-card`);if(!r)return;let i=c(r);if(i){if(i.paused){t&&t!==r&&v(),t=r,r.classList.add(`is-playing`);try{await i.play()}catch{r.classList.remove(`is-playing`),t=null;return}let e=i.duration;isFinite(e)&&e>0&&(i.currentTime=o*e),n=requestAnimationFrame(_),h(r)}else{let e=i.duration;isFinite(e)&&e>0&&(i.currentTime=o*e)}}}document.addEventListener(`pointerdown`,e=>{let t=e.target;t.matches(`[data-audio-range]`)?(r=!0,i=t):t.matches(`[data-audio-waveform]`)&&(r=!0,a=t,y(t,e))},!0),document.addEventListener(`pointermove`,e=>{r&&a&&y(a,e)},!0),document.addEventListener(`pointerup`,()=>{r&&(i?(re(i),i=null):a&&=(ie(a),null)),r=!1},!0),document.addEventListener(`pointercancel`,()=>{i=null,a=null,r=!1},!0),document.addEventListener(`click`,e=>{let t=e.target.closest(`[data-audio-play]`);if(!t)return;e.preventDefault();let n=t.closest(`.media-audio-card`);n&&ne(n)}),document.addEventListener(`input`,e=>{let t=e.target;if(!t.matches(`[data-audio-range]`))return;let n=t.closest(`.media-audio-card`);if(!n)return;let r=c(n);if(!r)return;let i=Number(t.value)/1e3;d(t,i);let a=r.duration,o=n.querySelector(`[data-audio-time]`);o&&isFinite(a)&&a>0&&(o.textContent=`${s(i*a)} / ${s(a)}`)},!0),document.addEventListener(`ended`,e=>{let r=e.target;if(!r.closest)return;let i=r.closest(`.media-audio-card`);if(!i)return;i.classList.remove(`is-playing`),cancelAnimationFrame(n),t=null;let a=l(i);a&&(a.value=`0`,d(a,0)),f.has(i)&&g(i,0);let o=i.querySelector(`[data-audio-time]`);o&&(o.textContent=`0:00`)},!0),document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>m()):m();var ae=`jant:media-lightbox-toggle`,oe=`jant:media-video-playback-intent`,b=new Set;function x(e){let t=e?.trim();return!!t&&b.has(t)}function S(e,t){let n=e?.trim();n&&(t?b.add(n):b.delete(n),document.dispatchEvent(new CustomEvent(oe,{detail:{mediaId:n,paused:t}})))}var se=`75% 0px`,C=.6,w=.25,ce=160,T=new Set,le=new WeakMap,ue=new WeakSet,E=null,D=null,O=null,k=!1,A=null,j=null,M=null;function de(e){return e.length===0?null:[...e].sort((e,t)=>t.visibleArea===e.visibleArea?e.centerDistance===t.centerDistance?t.intersectionRatio-e.intersectionRatio:e.centerDistance-t.centerDistance:t.visibleArea-e.visibleArea)[0]??null}function fe(){return{x:(globalThis.innerWidth||document.documentElement.clientWidth||0)/2,y:(globalThis.innerHeight||document.documentElement.clientHeight||0)/2}}function N(e){return le.get(e)}function pe(e){return x(e)}function P(e){return pe(e.dataset.feedVideoId)}function me(e){return e.closest(`.media-video-wrap`)?.querySelector(`[data-feed-video-mute-toggle]`)??null}function F(e){let t=me(e);if(!t)return;let n=O!==e||e.muted;t.dataset.muted=n?`true`:`false`,t.setAttribute(`aria-label`,n?`Play with sound`:`Mute video`)}function he(){for(let e of T)F(e)}function ge(e){if(ue.has(e))return;let t=e.dataset.videoSrc;t&&(e.getAttribute(`src`)!==t&&(e.src=t),e.load(),ue.add(e))}function I(e){e?.pause()}function _e(e){if(P(e)){I(e);return}ge(e),e.muted=O!==e,e.playsInline=!0,e.loop=!0,F(e),e.play().catch(()=>{})}function ve(){for(let e of T)e.isConnected||(j?.unobserve(e),M?.unobserve(e),T.delete(e),e===E&&(E=null),e===D&&(D=null),e===O&&(O=null))}function ye(){if(A=null,ve(),document.hidden||k){I(E);return}let e=[];for(let t of T){let n=N(t);n&&(P(t)||n.intersectionRatio<C||e.push({video:t,...n}))}let t=null;if(D?.isConnected&&!P(D)){let e=N(D);e&&e.intersectionRatio>w?t=D:(!e||e.intersectionRatio<=w)&&(D=null)}else D&&P(D)&&(D=null);if(t||=de(e)?.video??null,!t){let e=E?N(E):void 0;if(E&&!P(E)&&e&&e.intersectionRatio>w)return;I(E),E=null;return}t!==E&&(I(E),E=t),_e(t);for(let e of T)e!==t&&(I(e),F(e))}function L(){A!==null&&globalThis.clearTimeout(A),A=globalThis.setTimeout(ye,ce)}function be(e){let t=fe();for(let n of e){let e=n.target,r=n.boundingClientRect,i=r.left+r.width/2,a=r.top+r.height/2,o=n.intersectionRect.width*n.intersectionRect.height,s=Math.hypot(i-t.x,a-t.y);le.set(e,{intersectionRatio:n.intersectionRatio,visibleArea:o,centerDistance:s})}L()}function xe(e){for(let t of e)t.isIntersecting&&ge(t.target)}function Se(){j&&M||globalThis.IntersectionObserver!==void 0&&(j=new globalThis.IntersectionObserver(be,{threshold:[0,w,C,1]}),M=new globalThis.IntersectionObserver(xe,{rootMargin:se,threshold:0}))}function Ce(e){T.has(e)||(Se(),j&&M&&(T.add(e),j.observe(e),M.observe(e),me(e)?.addEventListener(`click`,we),F(e)))}function we(e){e.preventDefault(),e.stopPropagation();let t=e.currentTarget.closest(`.media-video-wrap`)?.querySelector(`[data-feed-short-video]`);if(!t)return;let n=t.dataset.feedVideoId?.trim();n&&S(n,!1),D=t,O!==t||t.muted?(O&&O!==t&&(O.muted=!0),O=t,E!==t&&(I(E),E=t),_e(t)):(O=null,t.muted=!0,F(t)),he(),L()}function R(e=document){let t=e.querySelectorAll(`[data-feed-short-video]`);for(let e of t)Ce(e);L()}document.addEventListener(ae,e=>{k=e.detail?.open===!0,k&&I(E),L()}),document.addEventListener(oe,e=>{let t=e.detail,n=t?.mediaId?.trim();if(n&&typeof t.paused==`boolean`){for(let e of T)e.dataset.feedVideoId?.trim()===n&&t.paused&&(I(e),E===e&&(E=null),D===e&&(D=null));L()}}),document.addEventListener(`visibilitychange`,()=>{document.hidden&&I(E),L()}),document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>R(),{once:!0}):queueMicrotask(()=>R());function Te(e){if(!(!Number.isFinite(e)||!e||e<=0))return Math.ceil(e)}function Ee(e){if(!e.mimeType?.startsWith(`video/`)||!Number.isFinite(e.durationSeconds)||!e.durationSeconds||e.durationSeconds<=0||e.durationSeconds>15)return!1;let t=e.size;return!(typeof t==`number`&&t>12582912)}function z(e){let t;return()=>t??=e().then(()=>void 0,e=>{throw t=void 0,e})}var B=z(()=>e(()=>import(`../client-compose-DkUTuavR.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),De=z(()=>e(()=>import(`../client-settings-CHgsIqXJ.js`),__vite__mapDeps([10,1,11,2,12,6,9]))),Oe=z(()=>e(()=>import(`../client-manage-DnYdQAhf.js`),__vite__mapDeps([13,1,2,3,14,12,6,7,15,4,8,9]))),ke=z(()=>e(()=>import(`../client-share-C59mOLJ1.js`),__vite__mapDeps([16,2,3]))),Ae=[{selector:`.compose-page`,load:B},{selector:[`jant-settings-general`,`jant-settings-language`,`jant-settings-avatar`,`jant-config-editor`,`jant-repo-picker`].join(`, `),load:De},{selector:[`jant-nav-manager`,`jant-collections-manager`,`[data-collection-page-actions]`,`[data-smart-collection-page-actions]`,`[data-custom-url-actions]`].join(`, `),load:Oe}];function je(){let e=new Set(Ae),t=new globalThis.MutationObserver(n);function n(){for(let t of e)document.querySelector(t.selector)&&(e.delete(t),t.load());e.size===0&&t.disconnect()}n(),e.size>0&&t.observe(document.body,{childList:!0,subtree:!0})}var Me=8;function Ne(e,t){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}function Pe(e){return Ne(getComputedStyle(e).getPropertyValue(`--site-thread-context-max-height`).trim(),240)}function Fe(e){if(e.dataset.threadContextToggleBound===`1`)return;e.dataset.threadContextToggleBound=`1`;let t=e.previousElementSibling;if(!(t instanceof HTMLElement)||t.dataset.threadContext===void 0)return;let n=e.querySelector(`.thread-context-toggle-label`),r=e.dataset.labelMore??`Show more`,i=e.dataset.labelLess??`Show less`,a=!1,o=t=>{e.setAttribute(`aria-expanded`,t?`true`:`false`),n&&(n.textContent=t?i:r)},s=()=>Array.from(t.querySelectorAll(`img`)).every(e=>e.complete),c=()=>{if(a)return;let n=Pe(t),r=t.scrollHeight>n+Me;t.dataset.collapsed===void 0&&(t.dataset.collapsed=``),r?(e.hidden=!1,o(!1)):s()&&(e.hidden=!0)};if(c(),t.querySelectorAll(`img`).forEach(e=>{e.complete||(e.addEventListener(`load`,c,{once:!0}),e.addEventListener(`error`,c,{once:!0}))}),`ResizeObserver`in globalThis){let e=0;new globalThis.ResizeObserver(()=>{cancelAnimationFrame(e),e=requestAnimationFrame(c)}).observe(t)}let l=()=>{let e=!1,n=r=>{e||r&&r.propertyName!==`max-height`||(e=!0,t.removeEventListener(`transitionend`,n),t.dataset.collapsed===void 0&&(t.style.maxHeight=``))};t.addEventListener(`transitionend`,n),window.setTimeout(n,600)};e.addEventListener(`click`,()=>{a=!0,t.dataset.collapsed===void 0?(t.style.maxHeight=`${t.scrollHeight}px`,t.offsetHeight,requestAnimationFrame(()=>{t.dataset.collapsed=``,t.style.maxHeight=``}),o(!1)):(t.style.maxHeight=`${t.scrollHeight}px`,t.offsetHeight,delete t.dataset.collapsed,o(!0)),l()})}function V(e=document){e.querySelectorAll(`[data-thread-context-toggle]`).forEach(Fe)}function Ie(e){let t=e.closest(`.thread-group-detail`);return t?t.querySelector(`.thread-detail-item`)===e:!1}function Le(){return globalThis.location.hash===`#continue`}function Re(e=document){let t=e.querySelector(`[data-post-current]`);if(!(t instanceof HTMLElement))return;let n=Le();if(globalThis.location.hash&&!n)return;let r=n?`auto`:`smooth`,i=Ie(t);requestAnimationFrame(()=>{(!i||n)&&t.scrollIntoView({behavior:r,block:`start`})})}document.addEventListener(`DOMContentLoaded`,()=>{V(document),Re(document)});var H=[`[data-post-view] .post-detail [data-post-body].post-detail-body`,`[data-timeline-item] article[data-post] > [data-post-body].prose`].join(`, `),ze=`[data-post-view], [data-timeline-item]`,Be=`--jant-footnote-rail-enabled`,U=12,Ve=160,He=.5,W=.5,G=new Map,K=!1;function q(e,t){return Number.isFinite(e)?e:t}function Ue(e,t){let n=Math.max(0,q(t,U)),r=[],i=0;for(let[t,a]of e.entries()){let e=Math.max(0,q(a.anchorTop,0)),o=Math.max(0,q(a.blockSize,0)),s=t===0?e:Math.max(e,i+n);r.push(s),i=s+o}return{offsets:r,blockSize:i}}function We(e){if(!e.startsWith(`#`)||e.length===1)return null;try{return decodeURIComponent(e.slice(1))}catch{return e.slice(1)}}function Ge(e,t){return(e.getAttribute(`role`)??``).split(/\s+/).includes(t)}function Ke(e){let t=Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.classList.contains(`footnote-endnotes`)&&Ge(e,`doc-endnotes`));if(t.length!==1)return null;let n=t[0];if(!n)return null;let r=Array.from(n.children).filter(e=>e instanceof globalThis.HTMLOListElement&&e.classList.contains(`footnote-list`));if(r.length!==1)return null;let i=r[0];if(!i)return null;let a=Array.from(i.children).filter(e=>e instanceof globalThis.HTMLLIElement&&e.classList.contains(`footnote`));if(a.length===0||a.length!==i.children.length)return null;let o=new Map;for(let e of a){if(!e.id||o.has(e.id)||document.getElementById(e.id)!==e)return null;o.set(e.id,e)}let s=new Map;for(let t of e.querySelectorAll(`a[role~="doc-noteref"][href^="#"]`)){let e=We(t.getAttribute(`href`)??``);e&&o.has(e)&&!s.has(e)&&s.set(e,t)}let c=[];for(let e of a){let t=s.get(e.id);if(!t)return null;c.push({reference:t,note:e})}return{section:n,list:i,pairs:c}}function qe(e){return q((Array.isArray(e.contentBoxSize)?e.contentBoxSize[0]:e.contentBoxSize)?.inlineSize??e.contentRect.width,0)}function J(e){return`${Math.round(e*1e3)/1e3}px`}function Y(e){e.body.classList.remove(`footnote-rail-measuring`,`footnote-rail-ready`),e.body.style.removeProperty(`min-block-size`),e.list.style.removeProperty(`--footnote-rail-block-size`);for(let{note:t}of e.pairs)t.style.removeProperty(`--footnote-rail-y`),t.style.removeProperty(`--footnote-rail-number`)}function Je(e){let t=e.list.start;for(let{note:n}of e.pairs)n.hasAttribute(`value`)&&(t=n.value),n.style.setProperty(`--footnote-rail-number`,`"${t}"`),t+=1}function Ye(e){let t=Number.parseFloat(getComputedStyle(e).rowGap);return Number.isFinite(t)?t:U}function Xe(e,t){return Math.max(0,t-e)<=Math.max(Ve,e*He)+W}function Ze(e){if(e.correctedInitialHash)return;e.correctedInitialHash=!0;let t=We(globalThis.location.hash);if(!t)return;let n=e.pairs.find(({note:e})=>e.id===t)?.note;n&&requestAnimationFrame(()=>{e.body.classList.contains(`footnote-rail-ready`)&&n.scrollIntoView({behavior:`auto`,block:`nearest`})})}function Qe(e){return!K&&getComputedStyle(e).getPropertyValue(Be).trim()===`1`}function $e(e){if(!e.body.isConnected){Z(e);return}if(!Qe(e.body)){Y(e);return}Y(e),e.body.classList.add(`footnote-rail-measuring`),Je(e);let t=e.body.getBoundingClientRect(),n=Math.max(0,t.height),r=e.pairs.map(({reference:e,note:n})=>({anchorTop:e.getBoundingClientRect().top-t.top,blockSize:n.getBoundingClientRect().height}));if(r.some(({blockSize:e})=>e<=W)){Y(e);return}let i=Ue(r,Ye(e.list));if(!Xe(n,i.blockSize)){Y(e);return}for(let[t,{note:n}]of e.pairs.entries())n.style.setProperty(`--footnote-rail-y`,J(i.offsets[t]??0));e.list.style.setProperty(`--footnote-rail-block-size`,J(i.blockSize)),e.body.style.setProperty(`min-block-size`,J(Math.max(n,i.blockSize))),e.body.classList.remove(`footnote-rail-measuring`),e.body.classList.add(`footnote-rail-ready`),Ze(e)}function X(e){e.rafId===0&&(e.rafId=requestAnimationFrame(()=>{e.rafId=0,$e(e)}))}function Z(e){e.rafId!==0&&cancelAnimationFrame(e.rafId),e.observer.disconnect(),e.abortController.abort(),Y(e),G.delete(e.body)}function et(e,t){return e.section===t.section&&e.list===t.list&&e.pairs.length===t.pairs.length&&e.pairs.every((e,n)=>e.note===t.pairs[n]?.note&&e.reference===t.pairs[n]?.reference)}function tt(e,t){if(!(`ResizeObserver`in globalThis))return null;let n=e.closest(ze);if(!n)return null;let r=new AbortController,i=new globalThis.ResizeObserver(t=>{let r=G.get(e);if(!r)return;let i=!1;for(let e of t)if(e.target===n){let t=qe(e);(r.containerInlineSize===null||Math.abs(r.containerInlineSize-t)>W)&&(r.containerInlineSize=t,i=!0)}else i=!0;i&&X(r)}),a={body:e,container:n,...t,observer:i,abortController:r,rafId:0,containerInlineSize:null,correctedInitialHash:!1};i.observe(n);for(let n of e.children)n!==t.section&&i.observe(n);for(let t of e.querySelectorAll(`img`))t.complete||(t.addEventListener(`load`,()=>X(a),{once:!0,signal:r.signal}),t.addEventListener(`error`,()=>X(a),{once:!0,signal:r.signal}));return G.set(e,a),X(a),a}function nt(e){let t=[];return e instanceof globalThis.Element&&e.matches(H)&&t.push(e),t.push(...e.querySelectorAll(H)),t}function Q(e=document){for(let e of G.values())e.body.isConnected||Z(e);for(let t of nt(e)){let e=Ke(t),n=G.get(t);if(!e){n&&Z(n);continue}if(n&&et(n,e)){X(n);continue}n&&Z(n),tt(t,e)}}function $(){for(let e of G.values())X(e)}globalThis.addEventListener(`beforeprint`,()=>{K=!0;for(let e of G.values())Y(e)}),globalThis.addEventListener(`afterprint`,()=>{K=!1,$()}),document.fonts&&(document.fonts.ready.then($),document.fonts.addEventListener(`loadingdone`,$)),document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>Q(document),{once:!0}):Q(document);export{je as a,R as c,S as d,m as f,ke as i,ae as l,V as n,Te as o,B as r,Ee as s,Q as t,x as u};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e=`jant.pendingToast`;function t(){let e=[...document.querySelectorAll(`dialog[open]`)];try{let t=e.filter(e=>e.matches(`:modal`));if(t.length>0)return t}catch{}return e}function n(e){let n=t().at(-1)??document.body;e.parentElement!==n&&n.appendChild(e)}function r(e){n(e),typeof e.showPopover==`function`&&(e.matches(`:popover-open`)&&document.querySelector(`dialog[open]`)&&e.hidePopover(),e.matches(`:popover-open`)||e.showPopover())}function i(){let e=document.getElementById(`toast-container`);if(e)return e;if(!document.body)return null;let t=document.createElement(`div`);return t.id=`toast-container`,t.className=`toast-container`,t.setAttribute(`popover`,`manual`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-relevant`,`additions text`),document.body.appendChild(t),t}function a(){try{return globalThis.sessionStorage!==void 0}catch{return!1}}function o(){if(!a())return null;let t=globalThis.sessionStorage.getItem(e);if(!t)return null;try{let n=JSON.parse(t);return typeof n.message!=`string`||n.type!==`success`&&n.type!==`error`||n.action&&(typeof n.action.label!=`string`||typeof n.action.href!=`string`)?(globalThis.sessionStorage.removeItem(e),null):{message:n.message,type:n.type,action:n.action}}catch{return globalThis.sessionStorage.removeItem(e),null}}var s={success:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/></svg>`,error:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6M9 9l6 6"/></svg>`},c=3e3,l=5e3,u=1e3;function d(e,t,n,r){e.innerHTML=s[t];let i=document.createElement(`span`);if(i.textContent=n,e.appendChild(i),r){let t=document.createElement(`a`);t.href=r.href,t.className=`toast-action`,t.textContent=r.label,e.appendChild(t)}}function f(e,t){let n=t,r=0,i=null,a=!1,o=!1,s=()=>{i!==null&&(clearTimeout(i),i=null,n=Math.max(n-(Date.now()-r),u))},c=()=>{i===null&&(r=Date.now(),i=setTimeout(()=>{e.classList.add(`toast-out`),e.addEventListener(`animationend`,()=>e.remove())},n))},l=()=>{a||o?s():c()};e.addEventListener(`pointerenter`,()=>{a=!0,l()}),e.addEventListener(`pointerleave`,()=>{a=!1,l()}),e.addEventListener(`focusin`,()=>{o=!0,l()}),e.addEventListener(`focusout`,()=>{o=!1,l()}),c()}function p(e,t=`success`){if(!e)return;let n=i();if(!n)return;r(n);let a=document.createElement(`div`);a.className=`toast toast-${t}`,d(a,t,e),n.appendChild(a),f(a,c)}function m(e,t,n=`success`){if(!e)return;let a=i();if(!a)return;r(a);let o=document.createElement(`div`);o.className=`toast toast-${n}`,d(o,n,e,t),a.appendChild(o),f(o,l)}function ee(e,t,n=`success`){let a=i();if(!a)return null;r(a);let o=document.createElement(`div`);return o.className=`toast toast-${n}`,o.id=`toast-${e}`,d(o,n,t),a.appendChild(o),o}function te(e,t){let n=document.getElementById(`toast-${e}`);if(!n)return;let r=n.querySelector(`span`);r&&(r.textContent=t)}function ne(e){let t=e.parentElement;t&&r(t)}function re(e,t,n=`success`){let r=document.getElementById(`toast-${e}`);if(!r){p(t,n);return}ne(r),r.className=`toast toast-${n}`,r.replaceChildren(),d(r,n,t),f(r,c)}function ie(t,n=`success`,r){t&&a()&&globalThis.sessionStorage.setItem(e,JSON.stringify({message:t,type:n,action:r}))}function ae(){let t=o();return!t||!i()?!1:(globalThis.sessionStorage.removeItem(e),t.action?m(t.message,t.action,t.type):p(t.message,t.type),!0)}function oe(){document.addEventListener(`close`,e=>{let t=e.target;if(!(t instanceof HTMLDialogElement))return;let n=document.getElementById(`toast-container`);n&&t.contains(n)&&r(n)},!0)}function se(){let e=()=>{ae()};if(document.readyState===`loading`){document.addEventListener(`DOMContentLoaded`,e,{once:!0});return}e()}oe(),se();var h=globalThis,g=h.ShadowRoot&&(h.ShadyCSS===void 0||h.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,ce=Symbol(),_=new WeakMap,le=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==ce)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(g&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=_.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&_.set(t,e))}return e}toString(){return this.cssText}},ue=e=>new le(typeof e==`string`?e:e+``,void 0,ce),de=(e,t)=>{if(g)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=h.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},v=g?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return ue(t)})(e):e,{is:fe,defineProperty:pe,getOwnPropertyDescriptor:me,getOwnPropertyNames:he,getOwnPropertySymbols:ge,getPrototypeOf:_e}=Object,y=globalThis,ve=y.trustedTypes,ye=ve?ve.emptyScript:``,be=y.reactiveElementPolyfillSupport,b=(e,t)=>e,x={toAttribute(e,t){switch(t){case Boolean:e=e?ye:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},xe=(e,t)=>!fe(e,t),Se={attribute:!0,type:String,converter:x,reflect:!1,useDefault:!1,hasChanged:xe};Symbol.metadata??=Symbol(`metadata`),y.litPropertyMetadata??=new WeakMap;var S=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Se){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&pe(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=me(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Se}static _$Ei(){if(this.hasOwnProperty(b(`elementProperties`)))return;let e=_e(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b(`properties`))){let e=this.properties,t=[...he(e),...ge(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(v(e))}else e!==void 0&&t.push(v(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return de(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?x:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?x:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??xe)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};S.elementStyles=[],S.shadowRootOptions={mode:`open`},S[b(`elementProperties`)]=new Map,S[b(`finalized`)]=new Map,be?.({ReactiveElement:S}),(y.reactiveElementVersions??=[]).push(`2.1.2`);var C=globalThis,w=e=>e,T=C.trustedTypes,Ce=T?T.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,E=`$lit$`,D=`lit$${Math.random().toFixed(9).slice(2)}$`,O=`?`+D,we=`<${O}>`,k=document,A=()=>k.createComment(``),j=e=>e===null||typeof e!=`object`&&typeof e!=`function`,M=Array.isArray,N=e=>M(e)||typeof e?.[Symbol.iterator]==`function`,P=`[
|
|
2
|
-
\f\r]`,F=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,I=/-->/g,L=/>/g,R=RegExp(`>|${P}(?:([^\\s"'>=/]+)(${P}*=${P}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),z=/'/g,B=/"/g,V=/^(?:script|style|textarea|title)$/i,H=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),Te=H(1),Ee=H(2),U=Symbol.for(`lit-noChange`),W=Symbol.for(`lit-nothing`),G=new WeakMap,K=k.createTreeWalker(k,129);function q(e,t){if(!M(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return Ce===void 0?t:Ce.createHTML(t)}var De=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=F;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===F?c[1]===`!--`?o=I:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=R):(V.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=R):o=L:o===R?c[0]===`>`?(o=i??F,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?R:c[3]===`"`?B:z):o===B||o===z?o=R:o===I||o===L?o=F:(o=R,i=void 0);let d=o===R&&e[t+1].startsWith(`/>`)?` `:``;a+=o===F?n+we:l>=0?(r.push(s),n.slice(0,l)+E+n.slice(l)+D+d):n+D+(l===-2?t:d)}return[q(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},J=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=De(t,n);if(this.el=e.createElement(l,r),K.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=K.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(E)){let t=u[o++],n=i.getAttribute(e).split(D),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?ke:r[1]===`?`?Ae:r[1]===`@`?je:Z}),i.removeAttribute(e)}else e.startsWith(D)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(V.test(i.tagName)){let e=i.textContent.split(D),t=e.length-1;if(t>0){i.textContent=T?T.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],A()),K.nextNode(),c.push({type:2,index:++a});i.append(e[t],A())}}}else if(i.nodeType===8){if(i.data===O)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(D,e+1))!==-1;)c.push({type:7,index:a}),e+=D.length-1}}a++}}static createElement(e,t){let n=k.createElement(`template`);return n.innerHTML=e,n}};function Y(e,t,n=e,r){if(t===U)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=j(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=Y(e,i._$AS(e,t.values),i,r)),t}var Oe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??k).importNode(t,!0);K.currentNode=r;let i=K.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new X(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new Me(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=K.nextNode(),a++)}return K.currentNode=k,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},X=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=W,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Y(this,e,t),j(e)?e===W||e==null||e===``?(this._$AH!==W&&this._$AR(),this._$AH=W):e!==this._$AH&&e!==U&&this._(e):e._$litType$===void 0?e.nodeType===void 0?N(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==W&&j(this._$AH)?this._$AA.nextSibling.data=e:this.T(k.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=J.createElement(q(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new Oe(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=G.get(e.strings);return t===void 0&&G.set(e.strings,t=new J(e)),t}k(t){M(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(A()),this.O(A()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=w(e).nextSibling;w(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Z=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=W,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=Y(this,e,t,0),a=!j(e)||e!==this._$AH&&e!==U,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=Y(this,r[n+o],t,o),s===U&&(s=this._$AH[o]),a||=!j(s)||s!==this._$AH[o],s===W?e=W:e!==W&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===W?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},ke=class extends Z{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===W?void 0:e}},Ae=class extends Z{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==W)}},je=class extends Z{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=Y(this,e,t,0)??W)===U)return;let n=this._$AH,r=e===W&&n!==W||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==W&&(n===W||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Me=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Y(this,e)}},Ne={M:E,P:D,A:O,C:1,L:De,R:Oe,D:N,V:Y,I:X,H:Z,N:Ae,U:je,B:ke,F:Me},Pe=C.litHtmlPolyfillSupport;Pe?.(J,X),(C.litHtmlVersions??=[]).push(`3.3.3`);var Fe=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new X(t.insertBefore(A(),e),e,void 0,n??{})}return i._$AI(e),i},Q=globalThis,$=class extends S{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Fe(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};$._$litElement$=!0,$.finalized=!0,Q.litElementHydrateSupport?.({LitElement:$});var Ie=Q.litElementPolyfillSupport;Ie?.({LitElement:$}),(Q.litElementVersions??=[]).push(`4.2.2`);export{Ne as a,re as c,m as d,te as f,Te as i,ee as l,W as n,Ee as o,U as r,ie as s,$ as t,p as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){if(e===`/`||e===``)return``;let t=e.replace(/\/+$/,``);return t.startsWith(`/`)?t:`/${t}`}function t(t){return e(t)}function n(e){return e.trim().toLowerCase().replace(/^\/+|\/+$/g,``).replace(/\/+/g,`/`)}function r(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}function i(e,t){if(!t||!r(e))return null;let n,i;try{n=new URL(e),i=new URL(t)}catch{return null}return n.hostname===i.hostname?`${n.pathname}${n.search}${n.hash}`||`/`:null}var a=/^[a-z][a-z0-9+.-]*:/i;function o(e){let t=e.trim();return t.startsWith(`/`)||r(t)}function s(e,n={}){let o=e.trim();if(!o)return null;let{siteOrigins:s=[],sitePathPrefix:l=``,languagePrefixes:u=[],keepQuery:d=!1}=n,f=r(o),p=null;if(f){for(let e of s){let t=i(o,e);if(t!==null){p=t;break}}if(p===null)return null}else if(o.startsWith(`//`)||a.test(o)||o.startsWith(`#`))return null;else p=o;let m;try{m=new URL(p,`https://jant.invalid`)}catch{return null}let h=_(m.pathname,t(l));if(h===null&&f)return null;let g=c(h??m.pathname,u),v=g.length>1?g.replace(/\/+$/,``)||`/`:g;return d?`${v}${m.search}${m.hash}`:v}function c(e,t){if(t.length===0)return e;let n=e.startsWith(`/`)?e.slice(1):e,r=n.indexOf(`/`),i=(r===-1?n:n.slice(0,r)).toLowerCase();return!i||!t.some(e=>e.toLowerCase()===i)?e:r===-1?`/`:n.slice(r)}var l=new Set([`http:`,`https:`,`mailto:`]),u=new Set([...l,`tel:`,`sms:`]);function d(e,t){try{let n=new URL(e,`https://placeholder.invalid`);return t.has(n.protocol)?e:``}catch{return``}}function f(e){let t=e.trim();if(!t)return!1;try{let e=new URL(t);return l.has(e.protocol)}catch{return!1}}function p(e){return d(e,l)}function m(e){return d(e,u)}function h(e,t=``){if(!e)return t||`/`;let n=e.startsWith(`/`)?e:`/${e}`;return!t||n===t||n.startsWith(`${t}/`)?n:n===`/`?t:`${t}${n}`}function g(e,t=``){return e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`//`)||e.startsWith(`mailto:`)||e.startsWith(`tel:`)||e.startsWith(`#`)?e:h(e,t)}function _(e,t){return t?e===t?`/`:e.startsWith(`${t}/`)?e.slice(t.length)||`/`:null:e||`/`}var v=`/_assets`;function y(e){let t=e.trim().replace(/\/+$/,``);return t?t.startsWith(`http://`)||t.startsWith(`https://`)||t.startsWith(`/`)?t:`/${t}`:v}function b(e,t=v){let n=y(t),r=e.replace(/^\/+/,``);return r?`${n}/${r}`:n}function x(e,t=v){let n=y(t);return e===n||e.startsWith(`${n}/`)}function S(e,t){if(t.startsWith(`http://`)||t.startsWith(`https://`)){if(!x(e))return e;let n=e.slice(v.length).replace(/^\/+/,``),r=t.replace(/\/+$/,``);return n?`${r}/${n}`:r}return x(e,t)||!x(e)?e:b(e.slice(v.length).replace(/^\/+/,``),t)}var C=new Set([`/`,`/feed`,`/latest`,`/featured`,`/archive`,`/search`,`/subscribe`,`/collections`]),w=[`/latest/`,`/featured/`,`/archive/`],T=`/collections/`;function E(e){let t=e.slice(13);if(!t)return!1;let n=t.split(`/`);return n[0]===``?!1:n.length===1||n.length===2&&n[1]===`feed`}function D(e){let t=e.split(/[?#]/,1)[0]??e;return C.has(t)?!0:t.startsWith(T)?E(t):w.some(e=>t.startsWith(e))}function O(){return document.documentElement.dataset.sitePathPrefix||``}function k(){return document.documentElement.dataset.assetBasePath||v}function A(){let e=document.documentElement.dataset.viewBasePath;return e===void 0?O():e}function j(){return document.documentElement.dataset.viewLang||void 0}function M(e){return x(e)?S(e,k()):g(e,O())}function N(e){return x(e)?S(e,k()):g(e,A())}function P(e){return D(e)?N(e):M(e)}function F(e){if(typeof e==`string`){if(/^https?:\/\//.test(e)){let t=new URL(e);return t.origin===window.location.origin?(t.pathname=M(t.pathname),t.toString()):e}return M(e)}if(e instanceof URL){if(e.origin!==window.location.origin)return e;let t=new URL(e.toString());return t.pathname=M(t.pathname),t}let t=new URL(e.url);return t.origin===window.location.origin?(t.pathname=M(t.pathname),new Request(t.toString(),e)):e}function I(){let e=globalThis.fetch;if(e.__jantPrefixed)return;let t=(t,n)=>e(F(t),n);t.__jantPrefixed=!0,globalThis.fetch=t}export{j as a,f as c,m as d,p as f,O as i,o as l,P as n,N as o,s as p,M as r,r as s,I as t,n as u};
|