@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
package/src/styles/ui.css
CHANGED
|
@@ -3818,6 +3818,12 @@
|
|
|
3818
3818
|
display: flex;
|
|
3819
3819
|
}
|
|
3820
3820
|
|
|
3821
|
+
/* A reader's menu (Copy link, Share as image) renders only for a reader,
|
|
3822
|
+
so it shows without the signed-in flag. */
|
|
3823
|
+
.post-menu-trigger[data-share-menu-trigger] {
|
|
3824
|
+
display: flex;
|
|
3825
|
+
}
|
|
3826
|
+
|
|
3821
3827
|
.post-menu-backdrop {
|
|
3822
3828
|
position: fixed;
|
|
3823
3829
|
inset: 0;
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
CLIENT_CJK_TC_CSS_FILE,
|
|
37
37
|
CLIENT_CSS_FILE,
|
|
38
38
|
CLIENT_JS_FILE,
|
|
39
|
+
CLIENT_SHARE_CSS_FILE,
|
|
39
40
|
CORE_VERSION,
|
|
40
41
|
} from "../../lib/version.js";
|
|
41
42
|
import { IS_VITE_DEV } from "../../lib/build-env.js";
|
|
@@ -288,6 +289,11 @@ export const BaseLayout: FC<PropsWithChildren<BaseLayoutProps>> = ({
|
|
|
288
289
|
? assetPath("/src/style-author.css")
|
|
289
290
|
: toPublicAssetPath(CLIENT_AUTHOR_CSS_FILE, assetBasePath)
|
|
290
291
|
: null;
|
|
292
|
+
// "Share as image" is rare enough to stay off every page's critical path:
|
|
293
|
+
// the post menu links this when it opens, for a reader or the author.
|
|
294
|
+
const shareStylesheetPath = IS_VITE_DEV
|
|
295
|
+
? assetPath("/src/style-share.css")
|
|
296
|
+
: toPublicAssetPath(CLIENT_SHARE_CSS_FILE, assetBasePath);
|
|
291
297
|
const clientScriptPath = IS_VITE_DEV
|
|
292
298
|
? resolvedClientBundle === "full"
|
|
293
299
|
? assetPath("/src/client-auth.ts")
|
|
@@ -402,6 +408,7 @@ export const BaseLayout: FC<PropsWithChildren<BaseLayoutProps>> = ({
|
|
|
402
408
|
data-view-lang={viewLang ?? undefined}
|
|
403
409
|
data-asset-base-path={assetBasePath}
|
|
404
410
|
data-media-base={mediaBase}
|
|
411
|
+
data-share-stylesheet={shareStylesheetPath}
|
|
405
412
|
>
|
|
406
413
|
<head>
|
|
407
414
|
<meta charset="UTF-8" />
|
|
@@ -751,6 +751,7 @@ export const SiteLayout: FC<PropsWithChildren<SiteLayoutProps>> = ({
|
|
|
751
751
|
|
|
752
752
|
<jant-media-lightbox />
|
|
753
753
|
<jant-text-preview />
|
|
754
|
+
{!isAuthenticated && <jant-share-menu />}
|
|
754
755
|
{isAuthenticated && (
|
|
755
756
|
<jant-post-menu
|
|
756
757
|
languages={JSON.stringify(composeLanguages ?? []).replace(
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Share Card
|
|
3
|
+
*
|
|
4
|
+
* The post as "Share as image" paints it: a sheet of paper on a mat tinted
|
|
5
|
+
* from the site's theme, so the picture reads as a mounted card even on the
|
|
6
|
+
* white of a chat or a feed. Images run across the top of the paper; below
|
|
7
|
+
* them the date, the post set large in the site's fonts with each format's
|
|
8
|
+
* own marks, the files a picture cannot show, and a footer that says whose
|
|
9
|
+
* site it is and how to get there. A lone image keeps its own shape, cut
|
|
10
|
+
* only past 4:5 tall; two or more share a grid of fixed frames.
|
|
11
|
+
*
|
|
12
|
+
* A post in a Thread sits on the Thread's rail, as the timeline shows a
|
|
13
|
+
* Thread's newest post: the Thread's first post above it in up to three
|
|
14
|
+
* lines, the posts between folded to a few dots on the rail, a line of the
|
|
15
|
+
* post after below, and its place in the Thread beside its date. Its images
|
|
16
|
+
* then go after its text, inside its column, so the card reads top to
|
|
17
|
+
* bottom.
|
|
18
|
+
*
|
|
19
|
+
* 540 px wide, captured at 3x. Render it inside `renderIconsInline()`: the
|
|
20
|
+
* capture copies the card on its own, without the page's icon sprite.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import type { FC } from "hono/jsx";
|
|
24
|
+
import type {
|
|
25
|
+
ShareCardFile,
|
|
26
|
+
ShareCardThreadPost,
|
|
27
|
+
ShareCardView,
|
|
28
|
+
} from "../../lib/share-card.js";
|
|
29
|
+
import { DecorativeQuoteMark } from "../shared/DecorativeQuoteMark.js";
|
|
30
|
+
import { Icon } from "../shared/Icon.js";
|
|
31
|
+
import { formatChars, formatSize } from "../shared/MediaGallery.js";
|
|
32
|
+
|
|
33
|
+
/** "3:07", or "1:02:45" past an hour. */
|
|
34
|
+
function formatDuration(totalSeconds: number): string {
|
|
35
|
+
const seconds = Math.round(totalSeconds);
|
|
36
|
+
const hours = Math.floor(seconds / 3600);
|
|
37
|
+
const minutes = Math.floor((seconds % 3600) / 60);
|
|
38
|
+
const rest = String(seconds % 60).padStart(2, "0");
|
|
39
|
+
return hours > 0
|
|
40
|
+
? `${hours}:${String(minutes).padStart(2, "0")}:${rest}`
|
|
41
|
+
: `${minutes}:${rest}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The one number that says how much of a file there is. */
|
|
45
|
+
function fileMeta(file: ShareCardFile): string | null {
|
|
46
|
+
if (file.size !== undefined) return formatSize(file.size);
|
|
47
|
+
if (file.durationSeconds !== undefined) {
|
|
48
|
+
return formatDuration(file.durationSeconds);
|
|
49
|
+
}
|
|
50
|
+
if (file.chars !== undefined && file.chars > 0)
|
|
51
|
+
return formatChars(file.chars);
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const Files: FC<{ card: ShareCardView }> = ({ card }) => {
|
|
56
|
+
if (card.files.length === 0) return null;
|
|
57
|
+
return (
|
|
58
|
+
<ul class="share-card-files">
|
|
59
|
+
{card.files.map((file) => {
|
|
60
|
+
const meta = fileMeta(file);
|
|
61
|
+
return (
|
|
62
|
+
<li class="share-card-file" data-kind={file.kind}>
|
|
63
|
+
<span class="share-card-file-format">{file.format}</span>
|
|
64
|
+
<span class="share-card-file-text">
|
|
65
|
+
<span class="share-card-file-title">{file.title}</span>
|
|
66
|
+
{meta && <span class="share-card-file-meta">{meta}</span>}
|
|
67
|
+
</span>
|
|
68
|
+
</li>
|
|
69
|
+
);
|
|
70
|
+
})}
|
|
71
|
+
{card.moreFiles > 0 && (
|
|
72
|
+
<li class="share-card-file-more">+{card.moreFiles}</li>
|
|
73
|
+
)}
|
|
74
|
+
</ul>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const Images: FC<{ card: ShareCardView }> = ({ card }) => {
|
|
79
|
+
if (card.images.length === 0) return null;
|
|
80
|
+
const last = card.images.length - 1;
|
|
81
|
+
return (
|
|
82
|
+
<div class="share-card-images" data-count={String(card.images.length)}>
|
|
83
|
+
{card.images.map((image, index) => (
|
|
84
|
+
<div class="share-card-image">
|
|
85
|
+
<img
|
|
86
|
+
src={image.url}
|
|
87
|
+
alt=""
|
|
88
|
+
width={image.width}
|
|
89
|
+
height={image.height}
|
|
90
|
+
/>
|
|
91
|
+
{image.video && (
|
|
92
|
+
<span class="share-card-play" aria-hidden="true">
|
|
93
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
94
|
+
<path d="M8 5v14l11-7z" />
|
|
95
|
+
</svg>
|
|
96
|
+
</span>
|
|
97
|
+
)}
|
|
98
|
+
{index === last && card.moreImages > 0 && (
|
|
99
|
+
<span class="share-card-more-images">+{card.moreImages}</span>
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
))}
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const Avatar: FC<{ card: ShareCardView }> = ({ card }) => {
|
|
108
|
+
if (card.avatarUrl) {
|
|
109
|
+
return <img class="share-card-avatar" src={card.avatarUrl} alt="" />;
|
|
110
|
+
}
|
|
111
|
+
const initial = Array.from(card.siteName.trim())[0];
|
|
112
|
+
return initial ? (
|
|
113
|
+
<span class="share-card-avatar" aria-hidden="true">
|
|
114
|
+
{initial}
|
|
115
|
+
</span>
|
|
116
|
+
) : null;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** The words; when the summary stops short of the post, its end fades. */
|
|
120
|
+
const Body: FC<{ card: ShareCardView }> = ({ card }) =>
|
|
121
|
+
card.bodyHtml ? (
|
|
122
|
+
<div
|
|
123
|
+
class={card.hasMore ? "share-card-body has-more" : "share-card-body"}
|
|
124
|
+
data-share-card-body
|
|
125
|
+
dangerouslySetInnerHTML={{ __html: card.bodyHtml }}
|
|
126
|
+
/>
|
|
127
|
+
) : null;
|
|
128
|
+
|
|
129
|
+
/** The post itself: its format's marks, its text, and its files. */
|
|
130
|
+
const PostContent: FC<{ card: ShareCardView; imagesInside?: boolean }> = ({
|
|
131
|
+
card,
|
|
132
|
+
imagesInside,
|
|
133
|
+
}) => {
|
|
134
|
+
const thread = card.thread;
|
|
135
|
+
const quoteSource = [card.quote?.attribution, card.quote?.source]
|
|
136
|
+
.filter(Boolean)
|
|
137
|
+
.join(" · ");
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<>
|
|
141
|
+
<div class="share-card-date">
|
|
142
|
+
{card.date}
|
|
143
|
+
{thread && (
|
|
144
|
+
<span class="share-card-thread-position">
|
|
145
|
+
{thread.position} / {thread.total}
|
|
146
|
+
</span>
|
|
147
|
+
)}
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
{card.link && (card.link.domain || card.link.title) && (
|
|
151
|
+
<div class="share-card-link">
|
|
152
|
+
{card.link.domain && (
|
|
153
|
+
<div class="share-card-link-domain">
|
|
154
|
+
<Icon name="link-domain" />
|
|
155
|
+
<span>{card.link.domain}</span>
|
|
156
|
+
</div>
|
|
157
|
+
)}
|
|
158
|
+
{card.link.title && (
|
|
159
|
+
<h2 class="share-card-link-title">{card.link.title}</h2>
|
|
160
|
+
)}
|
|
161
|
+
</div>
|
|
162
|
+
)}
|
|
163
|
+
|
|
164
|
+
{card.quote && (
|
|
165
|
+
<figure class="share-card-quote">
|
|
166
|
+
<DecorativeQuoteMark class="share-card-quote-mark" />
|
|
167
|
+
<blockquote class="share-card-quote-text" data-size={card.quote.size}>
|
|
168
|
+
{card.quote.text}
|
|
169
|
+
</blockquote>
|
|
170
|
+
{quoteSource && (
|
|
171
|
+
<figcaption class="share-card-quote-source">
|
|
172
|
+
{quoteSource}
|
|
173
|
+
</figcaption>
|
|
174
|
+
)}
|
|
175
|
+
</figure>
|
|
176
|
+
)}
|
|
177
|
+
|
|
178
|
+
{card.title && <h2 class="share-card-title">{card.title}</h2>}
|
|
179
|
+
|
|
180
|
+
<Body card={card} />
|
|
181
|
+
|
|
182
|
+
{card.hasMore && !card.bodyHtml && (
|
|
183
|
+
<div class="share-card-more" aria-hidden="true">
|
|
184
|
+
…
|
|
185
|
+
</div>
|
|
186
|
+
)}
|
|
187
|
+
|
|
188
|
+
{imagesInside && <Images card={card} />}
|
|
189
|
+
|
|
190
|
+
<Files card={card} />
|
|
191
|
+
</>
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/** A wordless post's images: a few tiles, the last counting the rest. */
|
|
196
|
+
const ContextImages: FC<{ post: ShareCardThreadPost }> = ({ post }) => {
|
|
197
|
+
const images = post.images ?? [];
|
|
198
|
+
if (images.length === 0) return null;
|
|
199
|
+
const last = images.length - 1;
|
|
200
|
+
const more = post.moreImages ?? 0;
|
|
201
|
+
return (
|
|
202
|
+
<div class="share-card-context-images" data-count={String(images.length)}>
|
|
203
|
+
{images.map((image, index) => (
|
|
204
|
+
<span class="share-card-context-image">
|
|
205
|
+
<img src={image.url} alt="" />
|
|
206
|
+
{image.video && (
|
|
207
|
+
<span class="share-card-play" aria-hidden="true">
|
|
208
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
209
|
+
<path d="M8 5v14l11-7z" />
|
|
210
|
+
</svg>
|
|
211
|
+
</span>
|
|
212
|
+
)}
|
|
213
|
+
{index === last && more > 0 && (
|
|
214
|
+
<span class="share-card-more-images">+{more}</span>
|
|
215
|
+
)}
|
|
216
|
+
</span>
|
|
217
|
+
))}
|
|
218
|
+
</div>
|
|
219
|
+
);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/** The Thread's first post or the post after the shared one, quieter. */
|
|
223
|
+
const ContextPost: FC<{ post: ShareCardThreadPost; next?: boolean }> = ({
|
|
224
|
+
post,
|
|
225
|
+
next,
|
|
226
|
+
}) => (
|
|
227
|
+
<div
|
|
228
|
+
class={`share-card-thread-item share-card-context${next ? " is-next" : " is-root"}${post.source ? " has-source" : ""}`}
|
|
229
|
+
data-format={post.format}
|
|
230
|
+
>
|
|
231
|
+
{post.title || post.text ? (
|
|
232
|
+
<div class="share-card-context-text">
|
|
233
|
+
{post.title && (
|
|
234
|
+
<span class="share-card-context-title">{post.title}</span>
|
|
235
|
+
)}
|
|
236
|
+
{post.text && <span class="share-card-context-body">{post.text}</span>}
|
|
237
|
+
{post.source && (
|
|
238
|
+
<span class="share-card-context-source">{post.source}</span>
|
|
239
|
+
)}
|
|
240
|
+
</div>
|
|
241
|
+
) : (
|
|
242
|
+
<ContextImages post={post} />
|
|
243
|
+
)}
|
|
244
|
+
</div>
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
const Thread: FC<{ card: ShareCardView }> = ({ card }) => {
|
|
248
|
+
const thread = card.thread;
|
|
249
|
+
if (!thread) return null;
|
|
250
|
+
return (
|
|
251
|
+
<div class="share-card-thread">
|
|
252
|
+
{thread.root && <ContextPost post={thread.root} />}
|
|
253
|
+
{thread.hidden > 0 && (
|
|
254
|
+
<div
|
|
255
|
+
class="share-card-thread-item share-card-thread-gap"
|
|
256
|
+
data-hidden={String(thread.hidden)}
|
|
257
|
+
aria-hidden="true"
|
|
258
|
+
/>
|
|
259
|
+
)}
|
|
260
|
+
<div class="share-card-thread-item share-card-thread-current">
|
|
261
|
+
<PostContent card={card} imagesInside />
|
|
262
|
+
</div>
|
|
263
|
+
{thread.next && <ContextPost post={thread.next} next />}
|
|
264
|
+
</div>
|
|
265
|
+
);
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export const ShareCard: FC<{ card: ShareCardView }> = ({ card }) => (
|
|
269
|
+
<div
|
|
270
|
+
class="share-card"
|
|
271
|
+
data-share-card
|
|
272
|
+
data-file-name={card.fileName}
|
|
273
|
+
data-layout={card.layout}
|
|
274
|
+
data-thread={card.thread ? "" : undefined}
|
|
275
|
+
lang={card.language}
|
|
276
|
+
>
|
|
277
|
+
<div class="share-card-paper">
|
|
278
|
+
{!card.thread && <Images card={card} />}
|
|
279
|
+
<div class="share-card-inner">
|
|
280
|
+
{card.thread ? <Thread card={card} /> : <PostContent card={card} />}
|
|
281
|
+
|
|
282
|
+
<footer class="share-card-foot">
|
|
283
|
+
<Avatar card={card} />
|
|
284
|
+
<div class="share-card-source">
|
|
285
|
+
<span class="share-card-site">{card.siteName}</span>
|
|
286
|
+
{card.siteAddress && (
|
|
287
|
+
<span class="share-card-address">{card.siteAddress}</span>
|
|
288
|
+
)}
|
|
289
|
+
</div>
|
|
290
|
+
<span
|
|
291
|
+
class="share-card-qr"
|
|
292
|
+
dangerouslySetInnerHTML={{ __html: card.qrSvg }}
|
|
293
|
+
/>
|
|
294
|
+
</footer>
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
);
|
package/src/ui/shared/Icon.tsx
CHANGED
|
@@ -10,14 +10,30 @@
|
|
|
10
10
|
* custom symbols defined in `custom-icons.ts`; any other name fails the
|
|
11
11
|
* type check.
|
|
12
12
|
*
|
|
13
|
+
* Inside `renderIconsInline()` it draws the icon's own paths instead, for
|
|
14
|
+
* markup that is copied out of the page (the share card).
|
|
15
|
+
*
|
|
13
16
|
* Size: outer <svg> width/height in pixels. Defaults to 24 (lucide default).
|
|
14
17
|
* Pass `class` to add CSS classes, e.g. for sizing via stylesheet instead
|
|
15
18
|
* of inline width/height.
|
|
16
19
|
*/
|
|
17
20
|
|
|
18
21
|
import type { FC } from "hono/jsx";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
22
|
+
import { raw } from "hono/html";
|
|
23
|
+
import { getIconInnerSvg, LUCIDE_SYMBOL_ATTRS } from "../../lib/icons.js";
|
|
24
|
+
import { collectIcon, iconsRenderInline } from "./icon-collector.js";
|
|
25
|
+
import {
|
|
26
|
+
getCustomSymbol,
|
|
27
|
+
getIconViewBox,
|
|
28
|
+
isCustomIconName,
|
|
29
|
+
type IconName,
|
|
30
|
+
} from "./custom-icons.js";
|
|
31
|
+
|
|
32
|
+
/** The icon's own drawing, as its sprite symbol would carry it. */
|
|
33
|
+
function inlineIconMarkup(name: IconName): string {
|
|
34
|
+
if (isCustomIconName(name)) return getCustomSymbol(name).inner;
|
|
35
|
+
return `<g ${LUCIDE_SYMBOL_ATTRS}>${getIconInnerSvg(name)}</g>`;
|
|
36
|
+
}
|
|
21
37
|
|
|
22
38
|
export interface IconProps {
|
|
23
39
|
/** Kebab-case icon name (lucide or custom). */
|
|
@@ -54,7 +70,11 @@ export const Icon: FC<IconProps> = ({
|
|
|
54
70
|
{...(ariaLabel ? { "aria-label": ariaLabel, role: "img" } : {})}
|
|
55
71
|
{...(hidden ? { "aria-hidden": "true" } : {})}
|
|
56
72
|
>
|
|
57
|
-
|
|
73
|
+
{iconsRenderInline() ? (
|
|
74
|
+
raw(inlineIconMarkup(name))
|
|
75
|
+
) : (
|
|
76
|
+
<use href={`#icon-${name}`} />
|
|
77
|
+
)}
|
|
58
78
|
</svg>
|
|
59
79
|
);
|
|
60
80
|
};
|
|
@@ -35,7 +35,18 @@ export interface MediaGalleryProps {
|
|
|
35
35
|
|
|
36
36
|
const DEFAULT_VISUAL_RATIO = 4 / 3;
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* A file size the way the gallery labels documents.
|
|
40
|
+
*
|
|
41
|
+
* @param bytes - Size in bytes
|
|
42
|
+
* @returns "512 B", "3.4 KB" or "2.1 MB"
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* formatSize(2_200_000); // "2.1 MB"
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export function formatSize(bytes: number): string {
|
|
39
50
|
if (bytes < 1024) return `${bytes} B`;
|
|
40
51
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
41
52
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
PostFooterDisplayOptions,
|
|
14
14
|
} from "../../types.js";
|
|
15
15
|
import { useLingui } from "../../i18n/context.js";
|
|
16
|
+
import { canShareAsImage } from "../../lib/share-card.js";
|
|
16
17
|
import { sanitizeUrl } from "../../lib/url.js";
|
|
17
18
|
import { useViewer } from "../../lib/viewer-context.js";
|
|
18
19
|
import { Icon } from "./Icon.js";
|
|
@@ -153,9 +154,15 @@ export const PostPublishedLink: FC<PostPublishedLinkProps> = ({
|
|
|
153
154
|
);
|
|
154
155
|
};
|
|
155
156
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
/**
|
|
158
|
+
* The post's "More" button. The author's opens `jant-post-menu`; a reader's
|
|
159
|
+
* (`reader`) opens `jant-share-menu`, which holds Copy link and Share as
|
|
160
|
+
* image.
|
|
161
|
+
*/
|
|
162
|
+
export const PostMenuTriggerButton: FC<{
|
|
163
|
+
className?: string;
|
|
164
|
+
reader?: boolean;
|
|
165
|
+
}> = ({ className = "post-menu-trigger", reader = false }) => {
|
|
159
166
|
const { i18n } = useLingui();
|
|
160
167
|
|
|
161
168
|
return (
|
|
@@ -170,7 +177,9 @@ export const PostMenuTriggerButton: FC<{ className?: string }> = ({
|
|
|
170
177
|
}),
|
|
171
178
|
)}
|
|
172
179
|
aria-expanded="false"
|
|
173
|
-
|
|
180
|
+
{...(reader
|
|
181
|
+
? { "data-share-menu-trigger": true }
|
|
182
|
+
: { "data-post-menu-trigger": true })}
|
|
174
183
|
>
|
|
175
184
|
<Icon name="post-menu-dots" size={15} />
|
|
176
185
|
</button>
|
|
@@ -283,6 +292,13 @@ export const PostFooter: FC<PostFooterProps> = ({ post, detail, display }) => {
|
|
|
283
292
|
<PostMenuTriggerButton />
|
|
284
293
|
</div>
|
|
285
294
|
)}
|
|
295
|
+
{/* A reader's menu sits where the author's does, with what a reader can
|
|
296
|
+
do with a post: copy its link, share it as an image. */}
|
|
297
|
+
{!hideActions && !isAuthor && canShareAsImage(post) && (
|
|
298
|
+
<div class="post-menu-actions">
|
|
299
|
+
<PostMenuTriggerButton reader />
|
|
300
|
+
</div>
|
|
301
|
+
)}
|
|
286
302
|
</footer>
|
|
287
303
|
);
|
|
288
304
|
};
|
|
@@ -30,6 +30,34 @@ export function collectIcon(name: IconName): void {
|
|
|
30
30
|
currentCollector?.add(name);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
let inline = false;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Render `fn` with every `<Icon>` drawn inline instead of pointing into the
|
|
37
|
+
* page's sprite. For markup that leaves the page it was rendered for — the
|
|
38
|
+
* share card is copied into an image on its own, where a `<use>` reference
|
|
39
|
+
* to the page's sprite would come out empty. Call it around the string
|
|
40
|
+
* conversion, not the JSX creation: components run when the tree is
|
|
41
|
+
* stringified.
|
|
42
|
+
*
|
|
43
|
+
* @param fn - Renders the markup to a string
|
|
44
|
+
* @returns What `fn` returns
|
|
45
|
+
*/
|
|
46
|
+
export function renderIconsInline<T>(fn: () => T): T {
|
|
47
|
+
const previous = inline;
|
|
48
|
+
inline = true;
|
|
49
|
+
try {
|
|
50
|
+
return fn();
|
|
51
|
+
} finally {
|
|
52
|
+
inline = previous;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Whether `<Icon>` is drawing inline (see {@link renderIconsInline}). */
|
|
57
|
+
export function iconsRenderInline(): boolean {
|
|
58
|
+
return inline;
|
|
59
|
+
}
|
|
60
|
+
|
|
33
61
|
/**
|
|
34
62
|
* Get the icon names collected so far during this render.
|
|
35
63
|
* Returns an empty set if no collection scope is active.
|
|
@@ -4,6 +4,7 @@ type PostArticleAttributeSource = Pick<
|
|
|
4
4
|
PostView,
|
|
5
5
|
| "id"
|
|
6
6
|
| "slug"
|
|
7
|
+
| "permalink"
|
|
7
8
|
| "format"
|
|
8
9
|
| "status"
|
|
9
10
|
| "visibility"
|
|
@@ -37,6 +38,8 @@ export function getPostArticleAttributes(post: PostArticleAttributeSource) {
|
|
|
37
38
|
"data-format": post.format,
|
|
38
39
|
"data-post-id": post.id,
|
|
39
40
|
"data-post-slug": post.slug,
|
|
41
|
+
// Where the post's date links to; both post menus copy it.
|
|
42
|
+
"data-post-permalink": post.permalink,
|
|
40
43
|
"data-thread-root-id": post.threadRootId ?? post.id,
|
|
41
44
|
...(post.pinned ? { "data-post-pinned": "" } : {}),
|
|
42
45
|
...(post.pinnedInCollection
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=null,t=0,n=!1,r=null,i=null,a=0;function o(e){return!isFinite(e)||e<0?`0:00`:`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`}function s(e){return e.querySelector(`audio.media-audio-el`)}function c(e){return e.querySelector(`[data-audio-range]`)}function l(e){return e.querySelector(`[data-audio-waveform]`)}function u(e,t){let n=`${(t*100).toFixed(1)}%`;e.style.background=`linear-gradient(to right, var(--site-text-primary) ${n}, transparent ${n})`}var d=new WeakMap,f=new WeakSet;async function p(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&&!d.has(r))try{let e=JSON.parse(t);if(!Array.isArray(e))continue;d.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(d.has(e)||f.has(e))return;f.add(e);let t=e.querySelector(`audio.media-audio-el source`),n=l(e);if(!t?.src||!n)return;let r=n.getBoundingClientRect().width,i=Math.max(20,Math.floor(r/3));try{let n=await p(t.src,i);d.set(e,n),e.classList.add(`has-waveform`);let r=s(e),a=r?.duration??0;g(e,r&&isFinite(a)&&a>0?r.currentTime/a:0)}catch{}}function g(e,t){let n=d.get(e),r=l(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 u=n.length,f=o/u,p=Math.max(1,Math.round(f*.6)),m=Math.round(2*i),h=s*.85,g=getComputedStyle(r).getPropertyValue(`--site-text-primary`).trim()||`#000`;for(let e=0;e<u;e++){let r=Math.round(e*f+(f-p)/2),a=Math.max(m,Math.round(n[e]*h)),o=Math.round((s-a)/2);c.globalAlpha=(e+.5)/u<=t?.9:.2,c.fillStyle=g;let l=Math.min(p/2,i);c.beginPath(),c.roundRect(r,o,p,a,l),c.fill()}c.globalAlpha=1}function ee(e,t){let{currentTime:r,duration:i}=t,a=isFinite(i)&&i>0,s=a?r/i:0;if(!n){let t=c(e);t&&a&&(t.value=String(Math.round(s*1e3)),u(t,s)),d.has(e)&&g(e,s);let n=e.querySelector(`[data-audio-time]`);n&&(n.textContent=a?`${o(r)} / ${o(i)}`:o(r))}}function _(){if(!e)return;let n=s(e);n&&!n.paused&&(ee(e,n),t=requestAnimationFrame(_))}function v(){if(e){let t=s(e);t&&!t.paused&&t.pause(),e.classList.remove(`is-playing`),e=null}cancelAnimationFrame(t)}async function te(n){let r=s(n);if(r){if(e&&e!==n&&v(),r.paused){e=n,n.classList.add(`is-playing`);try{await r.play()}catch{n.classList.remove(`is-playing`),e=null;return}t=requestAnimationFrame(_),h(n)}else r.pause(),n.classList.remove(`is-playing`),cancelAnimationFrame(t),e=null}}function ne(e){let t=e.closest(`.media-audio-card`);if(!t)return;let n=s(t);if(!n)return;let r=Number(e.value)/1e3,i=n.duration;isFinite(i)&&i>0&&(n.currentTime=r*i)}function re(e,t){let n=e.getBoundingClientRect();a=Math.max(0,Math.min(1,(t.clientX-n.left)/n.width));let r=e.closest(`.media-audio-card`);if(!r)return;g(r,a);let i=s(r),c=r.querySelector(`[data-audio-time]`);if(i&&c){let e=i.duration;isFinite(e)&&e>0&&(c.textContent=`${o(a*e)} / ${o(e)}`)}}async function ie(n){let r=n.closest(`.media-audio-card`);if(!r)return;let i=s(r);if(i){if(i.paused){e&&e!==r&&v(),e=r,r.classList.add(`is-playing`);try{await i.play()}catch{r.classList.remove(`is-playing`),e=null;return}let n=i.duration;isFinite(n)&&n>0&&(i.currentTime=a*n),t=requestAnimationFrame(_),h(r)}else{let e=i.duration;isFinite(e)&&e>0&&(i.currentTime=a*e)}}}document.addEventListener(`pointerdown`,e=>{let t=e.target;t.matches(`[data-audio-range]`)?(n=!0,r=t):t.matches(`[data-audio-waveform]`)&&(n=!0,i=t,re(t,e))},!0),document.addEventListener(`pointermove`,e=>{n&&i&&re(i,e)},!0),document.addEventListener(`pointerup`,()=>{n&&(r?(ne(r),r=null):i&&=(ie(i),null)),n=!1},!0),document.addEventListener(`pointercancel`,()=>{r=null,i=null,n=!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&&te(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=s(n);if(!r)return;let i=Number(t.value)/1e3;u(t,i);let a=r.duration,c=n.querySelector(`[data-audio-time]`);c&&isFinite(a)&&a>0&&(c.textContent=`${o(i*a)} / ${o(a)}`)},!0),document.addEventListener(`ended`,n=>{let r=n.target;if(!r.closest)return;let i=r.closest(`.media-audio-card`);if(!i)return;i.classList.remove(`is-playing`),cancelAnimationFrame(t),e=null;let a=c(i);a&&(a.value=`0`,u(a,0)),d.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`,y=new Set;function b(e){let t=e?.trim();return!!t&&y.has(t)}function se(e,t){let n=e?.trim();n&&(t?y.add(n):y.delete(n),document.dispatchEvent(new CustomEvent(oe,{detail:{mediaId:n,paused:t}})))}var ce=`75% 0px`,x=.6,S=.25,le=160,C=new Set,ue=new WeakMap,de=new WeakSet,w=null,T=null,E=null,D=!1,O=null,k=null,A=null;function fe(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 pe(){return{x:(globalThis.innerWidth||document.documentElement.clientWidth||0)/2,y:(globalThis.innerHeight||document.documentElement.clientHeight||0)/2}}function j(e){return ue.get(e)}function me(e){return b(e)}function M(e){return me(e.dataset.feedVideoId)}function N(e){return e.closest(`.media-video-wrap`)?.querySelector(`[data-feed-video-mute-toggle]`)??null}function P(e){let t=N(e);if(!t)return;let n=E!==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 C)P(e)}function F(e){if(de.has(e))return;let t=e.dataset.videoSrc;t&&(e.getAttribute(`src`)!==t&&(e.src=t),e.load(),de.add(e))}function I(e){e?.pause()}function L(e){if(M(e)){I(e);return}F(e),e.muted=E!==e,e.playsInline=!0,e.loop=!0,P(e),e.play().catch(()=>{})}function ge(){for(let e of C)e.isConnected||(k?.unobserve(e),A?.unobserve(e),C.delete(e),e===w&&(w=null),e===T&&(T=null),e===E&&(E=null))}function _e(){if(O=null,ge(),document.hidden||D){I(w);return}let e=[];for(let t of C){let n=j(t);n&&(M(t)||n.intersectionRatio<x||e.push({video:t,...n}))}let t=null;if(T?.isConnected&&!M(T)){let e=j(T);e&&e.intersectionRatio>S?t=T:(!e||e.intersectionRatio<=S)&&(T=null)}else T&&M(T)&&(T=null);if(t||=fe(e)?.video??null,!t){let e=w?j(w):void 0;if(w&&!M(w)&&e&&e.intersectionRatio>S)return;I(w),w=null;return}t!==w&&(I(w),w=t),L(t);for(let e of C)e!==t&&(I(e),P(e))}function R(){O!==null&&globalThis.clearTimeout(O),O=globalThis.setTimeout(_e,le)}function ve(e){let t=pe();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);ue.set(e,{intersectionRatio:n.intersectionRatio,visibleArea:o,centerDistance:s})}R()}function ye(e){for(let t of e)t.isIntersecting&&F(t.target)}function be(){k&&A||globalThis.IntersectionObserver!==void 0&&(k=new globalThis.IntersectionObserver(ve,{threshold:[0,S,x,1]}),A=new globalThis.IntersectionObserver(ye,{rootMargin:ce,threshold:0}))}function xe(e){C.has(e)||(be(),k&&A&&(C.add(e),k.observe(e),A.observe(e),N(e)?.addEventListener(`click`,Se),P(e)))}function Se(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&&se(n,!1),T=t,E!==t||t.muted?(E&&E!==t&&(E.muted=!0),E=t,w!==t&&(I(w),w=t),L(t)):(E=null,t.muted=!0,P(t)),he(),R()}function z(e=document){let t=e.querySelectorAll(`[data-feed-short-video]`);for(let e of t)xe(e);R()}document.addEventListener(ae,e=>{D=e.detail?.open===!0,D&&I(w),R()}),document.addEventListener(oe,e=>{let t=e.detail,n=t?.mediaId?.trim();if(n&&typeof t.paused==`boolean`){for(let e of C)e.dataset.feedVideoId?.trim()===n&&t.paused&&(I(e),w===e&&(w=null),T===e&&(T=null));R()}}),document.addEventListener(`visibilitychange`,()=>{document.hidden&&I(w),R()}),document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>z(),{once:!0}):queueMicrotask(()=>z());function Ce(e){if(!(!Number.isFinite(e)||!e||e<=0))return Math.ceil(e)}function we(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)}var Te=8;function Ee(e,t){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}function De(e){return Ee(getComputedStyle(e).getPropertyValue(`--site-thread-context-max-height`).trim(),240)}function Oe(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=De(t),r=t.scrollHeight>n+Te;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 B(e=document){e.querySelectorAll(`[data-thread-context-toggle]`).forEach(Oe)}function ke(e){let t=e.closest(`.thread-group-detail`);return t?t.querySelector(`.thread-detail-item`)===e:!1}function Ae(){return globalThis.location.hash===`#continue`}function je(e=document){let t=e.querySelector(`[data-post-current]`);if(!(t instanceof HTMLElement))return;let n=Ae();if(globalThis.location.hash&&!n)return;let r=n?`auto`:`smooth`,i=ke(t);requestAnimationFrame(()=>{(!i||n)&&t.scrollIntoView({behavior:r,block:`start`})})}document.addEventListener(`DOMContentLoaded`,()=>{B(document),je(document)});var V=[`[data-post-view] .post-detail [data-post-body].post-detail-body`,`[data-timeline-item] article[data-post] > [data-post-body].prose`].join(`, `),Me=`[data-post-view], [data-timeline-item]`,Ne=`--jant-footnote-rail-enabled`,H=12,Pe=160,Fe=.5,U=.5,W=new Map,G=!1;function K(e,t){return Number.isFinite(e)?e:t}function Ie(e,t){let n=Math.max(0,K(t,H)),r=[],i=0;for(let[t,a]of e.entries()){let e=Math.max(0,K(a.anchorTop,0)),o=Math.max(0,K(a.blockSize,0)),s=t===0?e:Math.max(e,i+n);r.push(s),i=s+o}return{offsets:r,blockSize:i}}function q(e){if(!e.startsWith(`#`)||e.length===1)return null;try{return decodeURIComponent(e.slice(1))}catch{return e.slice(1)}}function Le(e,t){return(e.getAttribute(`role`)??``).split(/\s+/).includes(t)}function Re(e){let t=Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.classList.contains(`footnote-endnotes`)&&Le(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=q(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 ze(e){return K((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 Be(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 Ve(e){let t=Number.parseFloat(getComputedStyle(e).rowGap);return Number.isFinite(t)?t:H}function He(e,t){return Math.max(0,t-e)<=Math.max(Pe,e*Fe)+U}function Ue(e){if(e.correctedInitialHash)return;e.correctedInitialHash=!0;let t=q(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 We(e){return!G&&getComputedStyle(e).getPropertyValue(Ne).trim()===`1`}function Ge(e){if(!e.body.isConnected){Z(e);return}if(!We(e.body)){Y(e);return}Y(e),e.body.classList.add(`footnote-rail-measuring`),Be(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<=U)){Y(e);return}let i=Ie(r,Ve(e.list));if(!He(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`),Ue(e)}function X(e){e.rafId===0&&(e.rafId=requestAnimationFrame(()=>{e.rafId=0,Ge(e)}))}function Z(e){e.rafId!==0&&cancelAnimationFrame(e.rafId),e.observer.disconnect(),e.abortController.abort(),Y(e),W.delete(e.body)}function Ke(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 qe(e,t){if(!(`ResizeObserver`in globalThis))return null;let n=e.closest(Me);if(!n)return null;let r=new AbortController,i=new globalThis.ResizeObserver(t=>{let r=W.get(e);if(!r)return;let i=!1;for(let e of t)if(e.target===n){let t=ze(e);(r.containerInlineSize===null||Math.abs(r.containerInlineSize-t)>U)&&(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 W.set(e,a),X(a),a}function Je(e){let t=[];return e instanceof globalThis.Element&&e.matches(V)&&t.push(e),t.push(...e.querySelectorAll(V)),t}function Q(e=document){for(let e of W.values())e.body.isConnected||Z(e);for(let t of Je(e)){let e=Re(t),n=W.get(t);if(!e){n&&Z(n);continue}if(n&&Ke(n,e)){X(n);continue}n&&Z(n),qe(t,e)}}function $(){for(let e of W.values())X(e)}globalThis.addEventListener(`beforeprint`,()=>{G=!0;for(let e of W.values())Y(e)}),globalThis.addEventListener(`afterprint`,()=>{G=!1,$()}),document.fonts&&(document.fonts.ready.then($),document.fonts.addEventListener(`loadingdone`,$)),document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>Q(document),{once:!0}):Q(document);export{z as a,se as c,we as i,m as l,B as n,ae as o,Ce as r,b as s,Q as t};
|
|
@@ -1,2 +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=ee(m.pathname,t(l));if(h===null&&f)return null;let g=c(h??m.pathname,u),_=g.length>1?g.replace(/\/+$/,``)||`/`:g;return d?`${_}${m.search}${m.hash}`:_}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 ee(e,t){return t?e===t?`/`:e.startsWith(`${t}/`)?e.slice(t.length)||`/`:null:e||`/`}var _=`/_assets`;function te(e){let t=e.trim().replace(/\/+$/,``);return t?t.startsWith(`http://`)||t.startsWith(`https://`)||t.startsWith(`/`)?t:`/${t}`:_}function ne(e,t=_){let n=te(t),r=e.replace(/^\/+/,``);return r?`${n}/${r}`:n}function v(e,t=_){let n=te(t);return e===n||e.startsWith(`${n}/`)}function re(e,t){if(t.startsWith(`http://`)||t.startsWith(`https://`)){if(!v(e))return e;let n=e.slice(_.length).replace(/^\/+/,``),r=t.replace(/\/+$/,``);return n?`${r}/${n}`:r}return v(e,t)||!v(e)?e:ne(e.slice(_.length).replace(/^\/+/,``),t)}var ie=new Set([`/`,`/feed`,`/latest`,`/featured`,`/archive`,`/search`,`/subscribe`,`/collections`]),ae=[`/latest/`,`/featured/`,`/archive/`],oe=`/collections/`;function se(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 ce(e){let t=e.split(/[?#]/,1)[0]??e;return ie.has(t)?!0:t.startsWith(oe)?se(t):ae.some(e=>t.startsWith(e))}function y(){return document.documentElement.dataset.sitePathPrefix||``}function le(){return document.documentElement.dataset.assetBasePath||_}function ue(){let e=document.documentElement.dataset.viewBasePath;return e===void 0?y():e}function de(){return document.documentElement.dataset.viewLang||void 0}function b(e){return v(e)?re(e,le()):g(e,y())}function fe(e){return v(e)?re(e,le()):g(e,ue())}function pe(e){return ce(e)?fe(e):b(e)}function me(e){if(typeof e==`string`){if(/^https?:\/\//.test(e)){let t=new URL(e);return t.origin===window.location.origin?(t.pathname=b(t.pathname),t.toString()):e}return b(e)}if(e instanceof URL){if(e.origin!==window.location.origin)return e;let t=new URL(e.toString());return t.pathname=b(t.pathname),t}let t=new URL(e.url);return t.origin===window.location.origin?(t.pathname=b(t.pathname),new Request(t.toString(),e)):e}function he(){let e=globalThis.fetch;if(e.__jantPrefixed)return;let t=(t,n)=>e(me(t),n);t.__jantPrefixed=!0,globalThis.fetch=t}var x=`jant.pendingToast`;function ge(){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 _e(e){let t=ge().at(-1)??document.body;e.parentElement!==t&&t.appendChild(e)}function S(e){_e(e),typeof e.showPopover==`function`&&(e.matches(`:popover-open`)&&document.querySelector(`dialog[open]`)&&e.hidePopover(),e.matches(`:popover-open`)||e.showPopover())}function C(){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 ve(){try{return globalThis.sessionStorage!==void 0}catch{return!1}}function ye(){if(!ve())return null;let e=globalThis.sessionStorage.getItem(x);if(!e)return null;try{let t=JSON.parse(e);return typeof t.message!=`string`||t.type!==`success`&&t.type!==`error`||t.action&&(typeof t.action.label!=`string`||typeof t.action.href!=`string`)?(globalThis.sessionStorage.removeItem(x),null):{message:t.message,type:t.type,action:t.action}}catch{return globalThis.sessionStorage.removeItem(x),null}}var be={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>`},xe=3e3,Se=5e3,Ce=1e3;function w(e,t,n,r){e.innerHTML=be[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 T(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),Ce))},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 E(e,t=`success`){if(!e)return;let n=C();if(!n)return;S(n);let r=document.createElement(`div`);r.className=`toast toast-${t}`,w(r,t,e),n.appendChild(r),T(r,xe)}function we(e,t,n=`success`){if(!e)return;let r=C();if(!r)return;S(r);let i=document.createElement(`div`);i.className=`toast toast-${n}`,w(i,n,e,t),r.appendChild(i),T(i,Se)}function Te(e,t,n=`success`){let r=C();if(!r)return null;S(r);let i=document.createElement(`div`);return i.className=`toast toast-${n}`,i.id=`toast-${e}`,w(i,n,t),r.appendChild(i),i}function Ee(e,t){let n=document.getElementById(`toast-${e}`);if(!n)return;let r=n.querySelector(`span`);r&&(r.textContent=t)}function De(e){let t=e.parentElement;t&&S(t)}function Oe(e,t,n=`success`){let r=document.getElementById(`toast-${e}`);if(!r){E(t,n);return}De(r),r.className=`toast toast-${n}`,r.replaceChildren(),w(r,n,t),T(r,xe)}function ke(e,t=`success`,n){e&&ve()&&globalThis.sessionStorage.setItem(x,JSON.stringify({message:e,type:t,action:n}))}function Ae(){let e=ye();return!e||!C()?!1:(globalThis.sessionStorage.removeItem(x),e.action?we(e.message,e.action,e.type):E(e.message,e.type),!0)}function je(){document.addEventListener(`close`,e=>{let t=e.target;if(!(t instanceof HTMLDialogElement))return;let n=document.getElementById(`toast-container`);n&&t.contains(n)&&S(n)},!0)}function Me(){let e=()=>{Ae()};if(document.readyState===`loading`){document.addEventListener(`DOMContentLoaded`,e,{once:!0});return}e()}je(),Me();var D=globalThis,O=D.ShadowRoot&&(D.ShadyCSS===void 0||D.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,Ne=Symbol(),Pe=new WeakMap,Fe=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Ne)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(O&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Pe.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Pe.set(t,e))}return e}toString(){return this.cssText}},Ie=e=>new Fe(typeof e==`string`?e:e+``,void 0,Ne),Le=(e,t)=>{if(O)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=D.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},Re=O?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return Ie(t)})(e):e,{is:ze,defineProperty:Be,getOwnPropertyDescriptor:Ve,getOwnPropertyNames:He,getOwnPropertySymbols:Ue,getPrototypeOf:We}=Object,k=globalThis,Ge=k.trustedTypes,Ke=Ge?Ge.emptyScript:``,qe=k.reactiveElementPolyfillSupport,A=(e,t)=>e,j={toAttribute(e,t){switch(t){case Boolean:e=e?Ke: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}},Je=(e,t)=>!ze(e,t),Ye={attribute:!0,type:String,converter:j,reflect:!1,useDefault:!1,hasChanged:Je};Symbol.metadata??=Symbol(`metadata`),k.litPropertyMetadata??=new WeakMap;var M=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=Ye){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&&Be(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=Ve(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)??Ye}static _$Ei(){if(this.hasOwnProperty(A(`elementProperties`)))return;let e=We(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(A(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(A(`properties`))){let e=this.properties,t=[...He(e),...Ue(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(Re(e))}else e!==void 0&&t.push(Re(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 Le(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?j: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?j: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??Je)(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){}};M.elementStyles=[],M.shadowRootOptions={mode:`open`},M[A(`elementProperties`)]=new Map,M[A(`finalized`)]=new Map,qe?.({ReactiveElement:M}),(k.reactiveElementVersions??=[]).push(`2.1.2`);var N=globalThis,Xe=e=>e,P=N.trustedTypes,Ze=P?P.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,F=`$lit$`,I=`lit$${Math.random().toFixed(9).slice(2)}$`,L=`?`+I,Qe=`<${L}>`,R=document,z=()=>R.createComment(``),B=e=>e===null||typeof e!=`object`&&typeof e!=`function`,V=Array.isArray,$e=e=>V(e)||typeof e?.[Symbol.iterator]==`function`,H=`[
|
|
2
|
-
\f\r]`,U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,et=/-->/g,tt=/>/g,W=RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),nt=/'/g,rt=/"/g,it=/^(?:script|style|textarea|title)$/i,at=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),ot=at(1),st=at(2),G=Symbol.for(`lit-noChange`),K=Symbol.for(`lit-nothing`),ct=new WeakMap,q=R.createTreeWalker(R,129);function lt(e,t){if(!V(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return Ze===void 0?t:Ze.createHTML(t)}var ut=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=U;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===U?c[1]===`!--`?o=et:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=W):(it.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=W):o=tt:o===W?c[0]===`>`?(o=i??U,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?W:c[3]===`"`?rt:nt):o===rt||o===nt?o=W:o===et||o===tt?o=U:(o=W,i=void 0);let d=o===W&&e[t+1].startsWith(`/>`)?` `:``;a+=o===U?n+Qe:l>=0?(r.push(s),n.slice(0,l)+F+n.slice(l)+I+d):n+I+(l===-2?t:d)}return[lt(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]=ut(t,n);if(this.el=e.createElement(l,r),q.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=q.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(F)){let t=u[o++],n=i.getAttribute(e).split(I),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?ft:r[1]===`?`?pt:r[1]===`@`?mt:Z}),i.removeAttribute(e)}else e.startsWith(I)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(it.test(i.tagName)){let e=i.textContent.split(I),t=e.length-1;if(t>0){i.textContent=P?P.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],z()),q.nextNode(),c.push({type:2,index:++a});i.append(e[t],z())}}}else if(i.nodeType===8){if(i.data===L)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(I,e+1))!==-1;)c.push({type:7,index:a}),e+=I.length-1}}a++}}static createElement(e,t){let n=R.createElement(`template`);return n.innerHTML=e,n}};function Y(e,t,n=e,r){if(t===G)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=B(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 dt=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??R).importNode(t,!0);q.currentNode=r;let i=q.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 ht(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=q.nextNode(),a++)}return q.currentNode=R,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=K,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),B(e)?e===K||e==null||e===``?(this._$AH!==K&&this._$AR(),this._$AH=K):e!==this._$AH&&e!==G&&this._(e):e._$litType$===void 0?e.nodeType===void 0?$e(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!==K&&B(this._$AH)?this._$AA.nextSibling.data=e:this.T(R.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(lt(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new dt(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=ct.get(e.strings);return t===void 0&&ct.set(e.strings,t=new J(e)),t}k(t){V(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(z()),this.O(z()),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=Xe(e).nextSibling;Xe(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=K,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=K}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=Y(this,e,t,0),a=!B(e)||e!==this._$AH&&e!==G,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===G&&(s=this._$AH[o]),a||=!B(s)||s!==this._$AH[o],s===K?e=K:e!==K&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},ft=class extends Z{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===K?void 0:e}},pt=class extends Z{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==K)}},mt=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)??K)===G)return;let n=this._$AH,r=e===K&&n!==K||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==K&&(n===K||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)}},ht=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)}},gt={M:F,P:I,A:L,C:1,L:ut,R:dt,D:$e,V:Y,I:X,H:Z,N:pt,U:mt,B:ft,F:ht},_t=N.litHtmlPolyfillSupport;_t?.(J,X),(N.litHtmlVersions??=[]).push(`3.3.3`);var vt=(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(z(),e),e,void 0,n??{})}return i._$AI(e),i},Q=globalThis,$=class extends M{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=vt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return G}};$._$litElement$=!0,$.finalized=!0,Q.litElementHydrateSupport?.({LitElement:$});var yt=Q.litElementPolyfillSupport;yt?.({LitElement:$}),(Q.litElementVersions??=[]).push(`4.2.2`);export{m as C,n as S,s as T,de as _,gt as a,f as b,Oe as c,we as d,Ee as f,y as g,b as h,ot as i,Te as l,pe as m,K as n,st as o,he as p,G as r,ke as s,$ as t,E as u,fe as v,p as w,o as x,r as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./lit-DW8VmJAT.js";import{a as t,i as n,r}from"./unsafe-html-B5ZEXaxg.js";import{t as i}from"./types-D5iF3H1a.js";var a=`modulepreload`,o=function(e){return`/`+e},s={},c=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),c=i?.nonce||i?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function u(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=l(t.map(t=>{if(t=o(t,n),t=u(t),t in s)return;s[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:a,r||(i.as=`script`),i.crossOrigin=``,i.href=t,c&&i.setAttribute(`nonce`,c),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},l=r(class extends n{constructor(e){if(super(e),e.type!==t.ATTRIBUTE||e.name!==`class`||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return` `+Object.keys(e).filter(t=>e[t]).join(` `)+` `}update(t,[n]){if(this.st===void 0){this.st=new Set,t.strings!==void 0&&(this.nt=new Set(t.strings.join(` `).split(/\s/).filter(e=>e!==``)));for(let e in n)n[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(n)}let r=t.element.classList;for(let e of this.st)e in n||(r.remove(e),this.st.delete(e));for(let e in n){let t=!!n[e];t===this.st.has(e)||this.nt?.has(e)||(t?(r.add(e),this.st.add(e)):(r.remove(e),this.st.delete(e)))}return e}}),u=`featured,latest,signin,signout,setup,settings,dash,api,feed,search,subscribe,archive,media,pages,reset,collections,compose,preview,new,static,assets,_assets,healthz,readyz,skill.md,robots.txt,manifest.webmanifest,favicon.ico,apple-touch-icon.png,sites`.split(`,`),d=/^sitemap(?:-[a-z0-9-]+)?\.xml$/;function f(e,t=[]){let n=e.split(`/`)[0]?.toLowerCase();return n?/^[_.]/.test(n)||u.includes(n)||d.test(n)?!0:t.includes(n):!1}Object.fromEntries(Object.entries(i).filter(([,e])=>!e.envOnly||`internal`in e).map(([e])=>[e,e]));var p=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function m(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,`-`).replace(/-{2,}/g,`-`).replace(/^-|-$/g,``)}function h(e,t){return m(e.slice(0,t))}function g(e,t={}){let n=e.trim();return n?t.maxLength&&n.length>t.maxLength?`too_long`:p.test(n)?f(n)||t.additionalReservedValues?.some(e=>e.toLowerCase()===n.toLowerCase())?`reserved`:null:`invalid`:null}export{c as i,h as n,l as r,g as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_assets/client-compose-oxzPb3SS.js","_assets/chunks/lit-DW8VmJAT.js","_assets/chunks/footnote-rail-BJwswtVQ.js","_assets/chunks/unsafe-html-B5ZEXaxg.js","_assets/chunks/slug-format-Dsi0e9Xn.js","_assets/chunks/types-D5iF3H1a.js","_assets/chunks/sortable-list-DWNKv782.js","_assets/chunks/create-editor-5Y49x7h5.js","_assets/client-settings-DIM44Zqh.js","_assets/chunks/jant-locale-picker-DL6mIOT5.js","_assets/chunks/confirm-D7GrwsCN.js","_assets/client-manage-C1eDB1Rc.js","_assets/chunks/site-header-nav-DzXsFk05.js","_assets/chunks/settings-paths-h6RjIe3C.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{u as e}from"./lit-DW8VmJAT.js";import{a as t,l as n,n as r,t as i}from"./footnote-rail-BJwswtVQ.js";import{r as a,t as o}from"./unsafe-html-B5ZEXaxg.js";import{i as s}from"./slug-format-Dsi0e9Xn.js";import{l as c,u as l}from"./types-D5iF3H1a.js";function u(e){r(e),t(e),n(e),i(e)}function d(e){let t;return()=>t??=e().then(()=>void 0)}var f=d(()=>s(()=>import(`../client-compose-oxzPb3SS.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),p=d(()=>s(()=>import(`../client-settings-DIM44Zqh.js`),__vite__mapDeps([8,1,9,10,5,7]))),m=d(()=>s(()=>import(`../client-manage-C1eDB1Rc.js`),__vite__mapDeps([11,1,3,12,10,4,5,13,6,7]))),h=[{selector:`.compose-page`,load:f},{selector:[`jant-settings-general`,`jant-settings-language`,`jant-settings-avatar`,`jant-config-editor`,`jant-repo-picker`].join(`, `),load:p},{selector:[`jant-nav-manager`,`jant-collections-manager`,`[data-collection-page-actions]`,`[data-smart-collection-page-actions]`,`[data-custom-url-actions]`].join(`, `),load:m}];function g(){let e=new Set(h),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})}function _(){return document.querySelector(`jant-compose-dialog`)}async function v(){let e=_();return e?(await f(),e):null}function y(){let e=_();if(!e)return null;if(e.labels)return e.labels;let t=e.getAttribute(`labels`);if(!t)return null;try{return JSON.parse(t)}catch{return null}}function b(){return document.querySelector(`[data-collection-mode][data-collection-id]`)?.dataset.collectionId||void 0}function x(e=document){if(e===document){let e=document.querySelector(`.thread-group-detail article[data-post]:hover`);if(e)return e}return e.querySelector(`[data-post-current] article[data-post]`)||e.querySelector(`[data-post-view] article[data-post]`)||(e===document?document.querySelector(`article[data-post]:hover`):null)}function S(e){let t=e.querySelector(`.thread-group-detail`);if(!t)return null;let n=t.querySelectorAll(`.thread-detail-item article[data-post]`);return n.length>0?n.item(n.length-1):null}function C(e=document){let t=S(e);if(t)return t;if(e===document){let e=document.querySelector(`.thread-group-detail article[data-post]:hover`);if(e)return e}return x(e)}function w(e){let t=e.closest(`[data-post-view]`)?.dataset.postViewId;if(t)return{kind:`post-view`,id:t};let n=e.closest(`[data-timeline-item]`),r=n?.dataset.threadRootId??e.dataset.threadRootId??e.dataset.postId;if(n&&r)return{kind:`timeline-item`,id:r};let i=e.dataset.postId;return i?{kind:`post-card`,id:i}:null}function T(e){let t=e.cloneNode(!0);t.querySelector(`[data-post-meta]`)?.remove(),t.querySelector(`.post-status-badges`)?.remove();let n=e.querySelector(`time.dt-published`);return{contentHtml:t.innerHTML,dateText:n?.textContent?.trim()??``}}async function E(e){await(await v())?.openNew(e)}async function D(e){await(await v())?.openEdit(e)}async function O(e){await(await v())?.openDraft(e)}async function k(t){let n=t.dataset.postId;if(!n)return;let r=await v();if(!r)return;let i=t.dataset.threadDraftTailId;if(i){e(`Picking up the unfinished draft at the end of this thread.`),await r.openEdit(i);return}let a=t.dataset.threadRootId??n;await r.openReply(n,T(t),a,w(t)??void 0)}async function A(e){let t=await fetch(e,{headers:{Accept:`text/html`}});return t.ok?t.text():null}async function j(e){try{let t=document.querySelector(`[data-timeline-item][data-thread-root-id="${e}"]`)?.querySelector(`[data-timeline-item-content]`);if(!t)return!1;let n=await A(`/_/timeline-item/${encodeURIComponent(e)}`);return n?(t.innerHTML=n,u(t),!0):!1}catch{return!1}}async function M(e){try{let t=document.querySelector(`article[data-post-id="${e}"]`)?.closest(`[data-timeline-item]`),n=await A(`/_/post-card/${encodeURIComponent(e)}`);if(!n)return!1;if(t){let e=t.querySelector(`[data-timeline-item-content]`);return e?(e.innerHTML=n,u(e),!0):!1}let r=document.querySelector(`article[data-post-id="${e}"]`);if(!r)return!1;r.outerHTML=n;let i=document.querySelector(`article[data-post-id="${e}"]`);return i&&u(i),!0}catch{return!1}}async function N(e){try{let t=document.querySelector(`[data-post-view][data-post-view-id="${e}"]`);if(!t)return!1;let n=await A(`/_/post-view/${encodeURIComponent(e)}`);if(!n)return!1;t.outerHTML=n;let r=document.querySelector(`[data-post-view][data-post-view-id="${e}"]`);return r&&u(r),!0}catch{return!1}}async function P(e){let t=w(e);return t?t.kind===`timeline-item`?j(t.id):t.kind===`post-view`?N(t.id):M(t.id):!1}function F(e,t){return c([e.title,e.slug],t)}function I(e,t){if(e.length===0)return[];let n=new Set(t),r=[],i=[];for(let t of e)n.has(t.id)?r.push(t.id):i.push(t.id);return[...r,...i]}function L(e,t){if(e.length===0||t.length===0)return[...e];let n=new Map(e.map(e=>[e.id,e])),r=[],i=new Set;for(let e of t){let t=n.get(e);t&&!i.has(e)&&(r.push(t),i.add(e))}for(let t of e)i.has(t.id)||r.push(t);return r}function R(e,t){let n=l(t);return n?e.map((e,t)=>({item:e,index:t,rank:F(e,n)})).filter(e=>e.rank!==null).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.item):[...e]}var z=class extends o{};z.directiveName=`unsafeSVG`,z.resultType=2;var B=a(z);export{k as _,P as a,j as c,_ as d,x as f,E as g,D as h,I as i,v as l,O as m,L as n,M as o,C as p,R as r,N as s,B as t,b as u,y as v,g as y};
|