@conundrum/ts 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/blog_post_nav-BZQvuEof.mjs +458 -0
  2. package/dist/blog_post_nav-BZQvuEof.mjs.map +1 -0
  3. package/dist/blog_post_nav-BpUDqfSu.js +457 -0
  4. package/dist/blog_post_nav-BpUDqfSu.js.map +1 -0
  5. package/dist/codegenTypeshare.cjs.map +1 -1
  6. package/dist/codegenTypeshare.mjs.map +1 -1
  7. package/dist/src/code_gen/typeshare/conundrum.d.ts +55 -0
  8. package/dist/src/code_gen/typeshare/conundrum.d.ts.map +1 -1
  9. package/dist/src/prebuilt_ui/blog/components/blog_index.d.ts +34 -0
  10. package/dist/src/prebuilt_ui/blog/components/blog_index.d.ts.map +1 -0
  11. package/dist/src/prebuilt_ui/blog/components/blog_post_nav.d.ts +19 -0
  12. package/dist/src/prebuilt_ui/blog/components/blog_post_nav.d.ts.map +1 -0
  13. package/dist/src/prebuilt_ui/blog/components/blog_shell.d.ts +16 -0
  14. package/dist/src/prebuilt_ui/blog/components/blog_shell.d.ts.map +1 -0
  15. package/dist/src/prebuilt_ui/blog/components/blog_sidebar.d.ts +24 -0
  16. package/dist/src/prebuilt_ui/blog/components/blog_sidebar.d.ts.map +1 -0
  17. package/dist/src/prebuilt_ui/blog/components/shared.d.ts +25 -0
  18. package/dist/src/prebuilt_ui/blog/components/shared.d.ts.map +1 -0
  19. package/dist/src/prebuilt_ui/blog/index.d.ts +7 -2
  20. package/dist/src/prebuilt_ui/blog/index.d.ts.map +1 -1
  21. package/dist/src/prebuilt_ui/blog/index_ssr.d.ts +7 -2
  22. package/dist/src/prebuilt_ui/blog/index_ssr.d.ts.map +1 -1
  23. package/dist/src/prebuilt_ui/blog/model/blog_filter.d.ts +26 -0
  24. package/dist/src/prebuilt_ui/blog/model/blog_filter.d.ts.map +1 -0
  25. package/dist/src/prebuilt_ui/blog/model/blog_model.d.ts +60 -0
  26. package/dist/src/prebuilt_ui/blog/model/blog_model.d.ts.map +1 -0
  27. package/dist/src/prebuilt_ui/blog/{index_page → model}/summarize_blog_post.d.ts +10 -7
  28. package/dist/src/prebuilt_ui/blog/model/summarize_blog_post.d.ts.map +1 -0
  29. package/dist/uiBlog.cjs +19 -8
  30. package/dist/uiBlog.cjs.map +1 -1
  31. package/dist/uiBlog.mjs +144 -133
  32. package/dist/uiBlog.mjs.map +1 -1
  33. package/dist/uiBlogSSR.cjs +19 -8
  34. package/dist/uiBlogSSR.cjs.map +1 -1
  35. package/dist/uiBlogSSR.mjs +18 -7
  36. package/package.json +5 -5
  37. package/src/prebuilt_ui/blog/blog.css +709 -0
  38. package/dist/blog_index-DbEZPK0j.mjs +0 -223
  39. package/dist/blog_index-DbEZPK0j.mjs.map +0 -1
  40. package/dist/blog_index-Dd7fy5LS.js +0 -222
  41. package/dist/blog_index-Dd7fy5LS.js.map +0 -1
  42. package/dist/src/prebuilt_ui/blog/index_page/blog_index.d.ts +0 -63
  43. package/dist/src/prebuilt_ui/blog/index_page/blog_index.d.ts.map +0 -1
  44. package/dist/src/prebuilt_ui/blog/index_page/summarize_blog_post.d.ts.map +0 -1
  45. package/src/prebuilt_ui/blog/blog_index.css +0 -355
@@ -0,0 +1,457 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const relative_path_to_url = require("./relative_path_to_url-CJ7OhKNR.js");
4
+ const WORDS_PER_MINUTE = 230;
5
+ const firstImage = (html) => {
6
+ const tag = /<img\b[^>]*>/i.exec(html)?.[0];
7
+ if (!tag) {
8
+ return null;
9
+ }
10
+ const src = /\bsrc\s*=\s*"([^"]+)"/i.exec(tag)?.[1];
11
+ if (!src) {
12
+ return null;
13
+ }
14
+ const alt = /\balt\s*=\s*"([^"]*)"/i.exec(tag)?.[1] ?? "";
15
+ return { src, alt };
16
+ };
17
+ const htmlToPlainText = (html) => html.replace(/<(script|style|math|annotation|svg)\b[\s\S]*?<\/\1>/gi, " ").replace(/<[^>]+>/g, " ").replace(/&nbsp;/gi, " ").replace(/&amp;/gi, "&").replace(/&[a-z#0-9]+;/gi, " ").replace(/\s+/g, " ").trim();
18
+ const readingMinutes = (text) => {
19
+ const words = text.split(" ").filter((w) => /[\p{L}\p{N}]/u.test(w)).length;
20
+ return Math.max(1, Math.round(words / WORDS_PER_MINUTE));
21
+ };
22
+ const summarizeBlogPost = (file, toUrl = relative_path_to_url.relativePathToBlogUrl) => {
23
+ const fm = file.front_matter;
24
+ if (!fm?.title || !fm.summary) {
25
+ return null;
26
+ }
27
+ const plainText = htmlToPlainText(file.html);
28
+ return {
29
+ relativePath: file.relative_path,
30
+ url: toUrl(file.relative_path),
31
+ title: fm.title,
32
+ summary: fm.summary,
33
+ subject: fm.subject ?? null,
34
+ topic: fm.topic ?? null,
35
+ tags: file.tags,
36
+ cover: firstImage(file.html),
37
+ readingMinutes: readingMinutes(plainText),
38
+ plainText
39
+ };
40
+ };
41
+ const NO_SUBJECT = "Other";
42
+ const subjectColorFromName = (subject) => {
43
+ let hash = 0;
44
+ for (const ch of subject) {
45
+ hash = (hash * 31 + ch.codePointAt(0)) % 360;
46
+ }
47
+ return `oklch(0.74 0.13 ${hash})`;
48
+ };
49
+ const createBlogModel = (source, options = {}) => {
50
+ const config = { ...source.blog ?? {}, ...options.config ?? {} };
51
+ const hiddenPaths = config.hidden_paths ?? [];
52
+ const hiddenSubjects = config.hidden_subjects ?? [];
53
+ const colors = new Map((config.subject_colors ?? []).map((c) => [c.subject, c.color]));
54
+ const colorOf = (subject) => colors.get(subject ?? NO_SUBJECT) ?? subjectColorFromName(subject ?? NO_SUBJECT);
55
+ const posts = source.files.filter((f) => !hiddenPaths.some((prefix) => f.relative_path.startsWith(prefix))).map((f) => summarizeBlogPost(f, options.postUrl ?? relative_path_to_url.relativePathToBlogUrl)).filter((p) => p !== null).filter((p) => !p.subject || !hiddenSubjects.includes(p.subject)).map((p) => ({ ...p, color: colorOf(p.subject) }));
56
+ const bySubject = /* @__PURE__ */ new Map();
57
+ for (const name of config.subject_order ?? []) {
58
+ bySubject.set(name, []);
59
+ }
60
+ for (const post of posts) {
61
+ const key = post.subject ?? NO_SUBJECT;
62
+ bySubject.set(key, [...bySubject.get(key) ?? [], post]);
63
+ }
64
+ const subjects = [...bySubject.entries()].filter(([, list]) => list.length > 0).map(([name, list]) => {
65
+ const topics = /* @__PURE__ */ new Map();
66
+ for (const p of list) {
67
+ if (p.topic) {
68
+ topics.set(p.topic, (topics.get(p.topic) ?? 0) + 1);
69
+ }
70
+ }
71
+ return {
72
+ name,
73
+ color: colorOf(name === NO_SUBJECT ? null : name),
74
+ posts: list,
75
+ topics: [...topics.entries()].map(([topic, count]) => ({ name: topic, count }))
76
+ };
77
+ });
78
+ const tagCounts = /* @__PURE__ */ new Map();
79
+ for (const post of posts) {
80
+ for (const tag of post.tags) {
81
+ tagCounts.set(tag, (tagCounts.get(tag) ?? 0) + 1);
82
+ }
83
+ }
84
+ const featuredTags = (config.featured_tags ?? []).filter((t) => tagCounts.has(t));
85
+ const tags = [
86
+ ...featuredTags,
87
+ ...[...tagCounts.keys()].filter((t) => !featuredTags.includes(t)).sort((a, b) => tagCounts.get(b) - tagCounts.get(a) || a.localeCompare(b))
88
+ ].map((name) => ({ name, count: tagCounts.get(name) }));
89
+ const featured = (config.featured ?? []).map((path) => posts.find((p) => p.relativePath === path)).filter((p) => p !== void 0);
90
+ return {
91
+ title: config.title ?? "Blog",
92
+ description: config.description ?? null,
93
+ baseUrl: options.baseUrl ?? "/blog",
94
+ posts,
95
+ featured,
96
+ subjects,
97
+ tags,
98
+ postsPerSubject: Math.max(1, config.posts_per_subject ?? 5)
99
+ };
100
+ };
101
+ const firstValue = (value) => {
102
+ const v = Array.isArray(value) ? value[0] : value;
103
+ return v && v.trim() ? v.trim() : null;
104
+ };
105
+ const blogFilterFromSearchParams = (params) => {
106
+ const get = (key) => params instanceof URLSearchParams ? firstValue(params.get(key)) : firstValue(params?.[key]);
107
+ return {
108
+ subject: get("subject"),
109
+ topic: get("topic"),
110
+ tag: get("tag") ?? get("tagAnyOf"),
111
+ query: get("q")
112
+ };
113
+ };
114
+ const isFiltering = (filter) => Boolean(filter.subject || filter.topic || filter.tag || filter.query);
115
+ const blogFilterUrl = (baseUrl, filter = {}) => {
116
+ const params = new URLSearchParams();
117
+ if (filter.subject) params.set("subject", filter.subject);
118
+ if (filter.topic) params.set("topic", filter.topic);
119
+ if (filter.tag) params.set("tag", filter.tag);
120
+ if (filter.query) params.set("q", filter.query);
121
+ const query = params.toString();
122
+ return query ? `${baseUrl}?${query}` : baseUrl;
123
+ };
124
+ const filterBlogPosts = (model, filter) => {
125
+ const narrowed = model.posts.filter(
126
+ (p) => (!filter.subject || (p.subject ?? NO_SUBJECT) === filter.subject) && (!filter.topic || p.topic === filter.topic) && (!filter.tag || p.tags.includes(filter.tag))
127
+ );
128
+ const words = (filter.query ?? "").toLowerCase().split(/\s+/).filter(Boolean);
129
+ if (words.length === 0) {
130
+ return narrowed;
131
+ }
132
+ const scored = narrowed.map((post, index) => {
133
+ const title = post.title.toLowerCase();
134
+ const meta = [post.summary, post.subject ?? "", post.topic ?? "", ...post.tags].join(" ").toLowerCase();
135
+ const body = post.plainText.toLowerCase();
136
+ let score = 0;
137
+ for (const word of words) {
138
+ if (title.includes(word)) score += 4;
139
+ else if (meta.includes(word)) score += 2;
140
+ else if (body.includes(word)) score += 1;
141
+ else return null;
142
+ }
143
+ return { post, score, index };
144
+ }).filter((s) => s !== null);
145
+ scored.sort((a, b) => b.score - a.score || a.index - b.index);
146
+ return scored.map((s) => s.post);
147
+ };
148
+ const subjectStyle = (color) => ({ "--cdrm-subject": color });
149
+ const SubjectSwatch = ({ color }) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdrm-blog-swatch", style: subjectStyle(color), "aria-hidden": "true" });
150
+ SubjectSwatch.displayName = "SubjectSwatch";
151
+ const readingTime = (minutes) => `${minutes} min read`;
152
+ const PostMeta = ({
153
+ post,
154
+ showSubject = true
155
+ }) => /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "cdrm-blog-meta", children: [
156
+ showSubject && post.subject ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "cdrm-blog-meta-subject", children: [
157
+ /* @__PURE__ */ jsxRuntime.jsx(SubjectSwatch, { color: post.color }),
158
+ post.subject
159
+ ] }) : null,
160
+ post.topic ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: post.topic }) : null,
161
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: readingTime(post.readingMinutes) })
162
+ ] });
163
+ PostMeta.displayName = "PostMeta";
164
+ const SearchIcon = () => /* @__PURE__ */ jsxRuntime.jsxs(
165
+ "svg",
166
+ {
167
+ className: "cdrm-blog-search-icon",
168
+ viewBox: "0 0 24 24",
169
+ width: "16",
170
+ height: "16",
171
+ fill: "none",
172
+ stroke: "currentColor",
173
+ strokeWidth: "2",
174
+ strokeLinecap: "round",
175
+ strokeLinejoin: "round",
176
+ "aria-hidden": "true",
177
+ children: [
178
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "11", cy: "11", r: "7" }),
179
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m20 20-3.5-3.5" })
180
+ ]
181
+ }
182
+ );
183
+ SearchIcon.displayName = "SearchIcon";
184
+ const classNames = (...names) => names.filter(Boolean).join(" ");
185
+ const current = (yes) => yes ? "page" : void 0;
186
+ const BlogSidebar = ({
187
+ model,
188
+ filter = {},
189
+ activePost = null,
190
+ banner,
191
+ idPrefix = "cdrm-blog",
192
+ className
193
+ }) => {
194
+ const post = activePost ? model.posts.find((p) => p.relativePath === activePost) : void 0;
195
+ const openSubject = post ? post.subject ?? NO_SUBJECT : filter.subject ?? null;
196
+ const onIndex = !activePost;
197
+ const total = model.posts.length;
198
+ return /* @__PURE__ */ jsxRuntime.jsxs("nav", { className: classNames("cdrm-blog", "cdrm-blog-sidebar", className), "aria-label": "Blog", children: [
199
+ banner ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cdrm-blog-sidebar-banner", children: banner }) : null,
200
+ /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "cdrm-blog-search", role: "search", action: model.baseUrl, method: "get", children: [
201
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: `${idPrefix}-search`, className: "cdrm-blog-visually-hidden", children: "Search posts" }),
202
+ /* @__PURE__ */ jsxRuntime.jsx(SearchIcon, {}),
203
+ /* @__PURE__ */ jsxRuntime.jsx(
204
+ "input",
205
+ {
206
+ id: `${idPrefix}-search`,
207
+ className: "cdrm-blog-search-input",
208
+ type: "search",
209
+ name: "q",
210
+ placeholder: "Search posts",
211
+ defaultValue: filter.query ?? "",
212
+ autoComplete: "off"
213
+ }
214
+ )
215
+ ] }),
216
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "cdrm-blog-nav-list", children: /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
217
+ "a",
218
+ {
219
+ className: "cdrm-blog-nav-link",
220
+ href: model.baseUrl,
221
+ "aria-current": current(onIndex && !isFiltering(filter)),
222
+ children: [
223
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdrm-blog-nav-label", children: "All posts" }),
224
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdrm-blog-count", children: total })
225
+ ]
226
+ }
227
+ ) }) }),
228
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "cdrm-blog-nav-heading", id: `${idPrefix}-subjects`, children: "Subjects" }),
229
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "cdrm-blog-nav-list", "aria-labelledby": `${idPrefix}-subjects`, children: model.subjects.map((subject) => {
230
+ const open = subject.name === openSubject;
231
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
232
+ /* @__PURE__ */ jsxRuntime.jsxs(
233
+ "a",
234
+ {
235
+ className: "cdrm-blog-nav-link",
236
+ href: blogFilterUrl(model.baseUrl, { subject: subject.name }),
237
+ "aria-current": current(
238
+ onIndex && filter.subject === subject.name && !filter.topic && !filter.tag && !filter.query
239
+ ),
240
+ "data-open": open ? "" : void 0,
241
+ children: [
242
+ /* @__PURE__ */ jsxRuntime.jsx(SubjectSwatch, { color: subject.color }),
243
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdrm-blog-nav-label", children: subject.name }),
244
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdrm-blog-count", children: subject.posts.length })
245
+ ]
246
+ }
247
+ ),
248
+ open ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "cdrm-blog-nav-posts", style: subjectStyle(subject.color), children: subject.posts.map((p) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
249
+ "a",
250
+ {
251
+ className: "cdrm-blog-nav-post",
252
+ href: p.url,
253
+ "aria-current": current(p.relativePath === activePost),
254
+ children: p.title
255
+ }
256
+ ) }, p.relativePath)) }) : null
257
+ ] }, subject.name);
258
+ }) }),
259
+ model.tags.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
260
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "cdrm-blog-nav-heading", id: `${idPrefix}-tags`, children: "Tags" }),
261
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "cdrm-blog-tags", "aria-labelledby": `${idPrefix}-tags`, children: model.tags.map((tag) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
262
+ "a",
263
+ {
264
+ className: "cdrm-blog-tag",
265
+ href: blogFilterUrl(model.baseUrl, { tag: tag.name }),
266
+ "aria-current": current(onIndex && filter.tag === tag.name),
267
+ children: tag.name
268
+ }
269
+ ) }, tag.name)) })
270
+ ] }) : null
271
+ ] });
272
+ };
273
+ BlogSidebar.displayName = "BlogSidebar";
274
+ const BlogShell = ({ children, className, banner, ...sidebar }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames("cdrm-blog", "cdrm-blog-shell", className), children: [
275
+ /* @__PURE__ */ jsxRuntime.jsx("aside", { className: "cdrm-blog-shell-sidebar", children: /* @__PURE__ */ jsxRuntime.jsx(BlogSidebar, { ...sidebar, banner, idPrefix: "cdrm-blog-sidebar" }) }),
276
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdrm-blog-shell-content", children: [
277
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdrm-blog-mobile-bar", children: [
278
+ banner ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cdrm-blog-mobile-banner", children: banner }) : null,
279
+ /* @__PURE__ */ jsxRuntime.jsxs("details", { className: "cdrm-blog-mobile-menu", children: [
280
+ /* @__PURE__ */ jsxRuntime.jsx("summary", { className: "cdrm-blog-mobile-toggle", children: "Browse" }),
281
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cdrm-blog-mobile-panel", children: /* @__PURE__ */ jsxRuntime.jsx(BlogSidebar, { ...sidebar, idPrefix: "cdrm-blog-mobile" }) })
282
+ ] })
283
+ ] }),
284
+ /* @__PURE__ */ jsxRuntime.jsx("main", { className: "cdrm-blog-main", children })
285
+ ] })
286
+ ] });
287
+ BlogShell.displayName = "BlogShell";
288
+ const BlogLeadPost = ({ post }) => /* @__PURE__ */ jsxRuntime.jsxs("article", { className: "cdrm-blog-lead", "data-has-cover": post.cover ? "" : void 0, children: [
289
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdrm-blog-lead-text", children: [
290
+ /* @__PURE__ */ jsxRuntime.jsx(PostMeta, { post }),
291
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "cdrm-blog-lead-title", children: /* @__PURE__ */ jsxRuntime.jsx("a", { className: "cdrm-blog-stretched-link", href: post.url, children: post.title }) }),
292
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "cdrm-blog-lead-summary", children: post.summary })
293
+ ] }),
294
+ post.cover ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cdrm-blog-lead-cover", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: post.cover.src, alt: post.cover.alt, decoding: "async" }) }) : null
295
+ ] });
296
+ BlogLeadPost.displayName = "BlogLeadPost";
297
+ const BlogPostEntry = ({
298
+ post,
299
+ showSubject = true
300
+ }) => /* @__PURE__ */ jsxRuntime.jsxs("article", { className: "cdrm-blog-entry", "data-has-cover": post.cover ? "" : void 0, children: [
301
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdrm-blog-entry-text", children: [
302
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "cdrm-blog-entry-title", children: /* @__PURE__ */ jsxRuntime.jsx("a", { className: "cdrm-blog-stretched-link", href: post.url, children: post.title }) }),
303
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "cdrm-blog-entry-summary", children: post.summary }),
304
+ /* @__PURE__ */ jsxRuntime.jsx(PostMeta, { post, showSubject })
305
+ ] }),
306
+ post.cover ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cdrm-blog-entry-cover", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: post.cover.src, alt: "", loading: "lazy", decoding: "async" }) }) : null
307
+ ] });
308
+ BlogPostEntry.displayName = "BlogPostEntry";
309
+ const slugify = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
310
+ const plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
311
+ const FilterHeader = ({
312
+ model,
313
+ filter,
314
+ count
315
+ }) => {
316
+ const subject = filter.subject ? model.subjects.find((s) => s.name === filter.subject) : void 0;
317
+ const heading = filter.query ? "Search" : filter.tag ? filter.tag : filter.topic ?? filter.subject ?? model.title;
318
+ const summary = filter.query ? `${plural(count, "post")} ${count === 1 ? "matches" : "match"} “${filter.query}”` : plural(count, "post");
319
+ const topics = subject && !filter.query && subject.topics.some((t) => t.count > 1) ? subject.topics : [];
320
+ return /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "cdrm-blog-header", children: [
321
+ /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "cdrm-blog-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ jsxRuntime.jsxs("ol", { children: [
322
+ /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: model.baseUrl, children: model.title }) }),
323
+ filter.topic && filter.subject ? /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: blogFilterUrl(model.baseUrl, { subject: filter.subject }), children: filter.subject }) }) : null
324
+ ] }) }),
325
+ /* @__PURE__ */ jsxRuntime.jsxs("h1", { className: "cdrm-blog-title", children: [
326
+ subject && !filter.topic && !filter.query ? /* @__PURE__ */ jsxRuntime.jsx(SubjectSwatch, { color: subject.color }) : null,
327
+ heading
328
+ ] }),
329
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "cdrm-blog-description", children: summary }),
330
+ topics.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "cdrm-blog-topics", "aria-label": `Topics in ${subject.name}`, children: [
331
+ /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
332
+ "a",
333
+ {
334
+ className: "cdrm-blog-topic",
335
+ href: blogFilterUrl(model.baseUrl, { subject: subject.name }),
336
+ "aria-current": !filter.topic ? "page" : void 0,
337
+ children: "All"
338
+ }
339
+ ) }),
340
+ topics.map((t) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
341
+ "a",
342
+ {
343
+ className: "cdrm-blog-topic",
344
+ href: blogFilterUrl(model.baseUrl, { subject: subject.name, topic: t.name }),
345
+ "aria-current": filter.topic === t.name ? "page" : void 0,
346
+ children: [
347
+ t.name,
348
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdrm-blog-count", children: t.count })
349
+ ]
350
+ }
351
+ ) }, t.name))
352
+ ] }) : null
353
+ ] });
354
+ };
355
+ const BlogIndex = ({ model, filter = {}, className }) => {
356
+ const filtering = isFiltering(filter);
357
+ const [lead, ...moreFeatured] = filtering ? [] : model.featured;
358
+ const featuredPaths = new Set(filtering ? [] : model.featured.map((p) => p.relativePath));
359
+ const posts = filtering ? filterBlogPosts(model, filter) : [];
360
+ const showSubject = !filter.subject;
361
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames("cdrm-blog", "cdrm-blog-index", className), children: [
362
+ filtering ? /* @__PURE__ */ jsxRuntime.jsx(FilterHeader, { model, filter, count: posts.length }) : /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "cdrm-blog-header", children: [
363
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "cdrm-blog-title", children: model.title }),
364
+ model.description ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "cdrm-blog-description", children: model.description }) : null
365
+ ] }),
366
+ lead ? /* @__PURE__ */ jsxRuntime.jsx(BlogLeadPost, { post: lead }) : null,
367
+ moreFeatured.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "cdrm-blog-featured-list", "aria-label": "More featured posts", children: moreFeatured.map((p) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(BlogPostEntry, { post: p }) }, p.relativePath)) }) : null,
368
+ filtering ? posts.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("section", { className: "cdrm-blog-list-section", "aria-label": "Posts", children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "cdrm-blog-list", children: posts.map((p) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(BlogPostEntry, { post: p, showSubject }) }, p.relativePath)) }) }) : /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "cdrm-blog-empty", children: [
369
+ filter.query ? "Try fewer or different words, or " : "Nothing here yet. ",
370
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: model.baseUrl, children: filter.query ? "browse every post" : "show every post" }),
371
+ "."
372
+ ] }) : model.subjects.map((subject) => {
373
+ const rest = subject.posts.filter((p) => !featuredPaths.has(p.relativePath));
374
+ if (rest.length === 0) {
375
+ return null;
376
+ }
377
+ const shown = rest.slice(0, model.postsPerSubject);
378
+ const id = `cdrm-blog-subject-${slugify(subject.name)}`;
379
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "cdrm-blog-group", "aria-labelledby": id, children: [
380
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cdrm-blog-group-header", children: [
381
+ /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "cdrm-blog-group-title", id, children: [
382
+ /* @__PURE__ */ jsxRuntime.jsx(SubjectSwatch, { color: subject.color }),
383
+ subject.name
384
+ ] }),
385
+ shown.length < rest.length ? /* @__PURE__ */ jsxRuntime.jsxs(
386
+ "a",
387
+ {
388
+ className: "cdrm-blog-group-more",
389
+ href: blogFilterUrl(model.baseUrl, { subject: subject.name }),
390
+ children: [
391
+ "All ",
392
+ subject.posts.length,
393
+ " posts"
394
+ ]
395
+ }
396
+ ) : null
397
+ ] }),
398
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "cdrm-blog-list", children: shown.map((p) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(BlogPostEntry, { post: p, showSubject: false }) }, p.relativePath)) })
399
+ ] }, subject.name);
400
+ })
401
+ ] });
402
+ };
403
+ BlogIndex.displayName = "BlogIndex";
404
+ const neighbours = (model, relativePath) => {
405
+ const post = model.posts.find((p) => p.relativePath === relativePath);
406
+ const list = post ? model.subjects.find((s) => s.name === (post.subject ?? NO_SUBJECT))?.posts ?? [] : [];
407
+ const index = list.findIndex((p) => p.relativePath === relativePath);
408
+ return {
409
+ post,
410
+ previous: index > 0 ? list[index - 1] : void 0,
411
+ next: index >= 0 && index < list.length - 1 ? list[index + 1] : void 0
412
+ };
413
+ };
414
+ const BlogBreadcrumb = ({ model, relativePath, className }) => {
415
+ const { post } = neighbours(model, relativePath);
416
+ return /* @__PURE__ */ jsxRuntime.jsx("nav", { className: classNames("cdrm-blog", "cdrm-blog-breadcrumb", className), "aria-label": "Breadcrumb", children: /* @__PURE__ */ jsxRuntime.jsxs("ol", { children: [
417
+ /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: model.baseUrl, children: model.title }) }),
418
+ post?.subject ? /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: blogFilterUrl(model.baseUrl, { subject: post.subject }), children: post.subject }) }) : null
419
+ ] }) });
420
+ };
421
+ BlogBreadcrumb.displayName = "BlogBreadcrumb";
422
+ const BlogPostNav = ({ model, relativePath, className }) => {
423
+ const { previous, next } = neighbours(model, relativePath);
424
+ if (!previous && !next) {
425
+ return null;
426
+ }
427
+ return /* @__PURE__ */ jsxRuntime.jsxs("nav", { className: classNames("cdrm-blog", "cdrm-blog-post-nav", className), "aria-label": "More in this subject", children: [
428
+ previous ? /* @__PURE__ */ jsxRuntime.jsxs("a", { className: "cdrm-blog-post-nav-link", href: previous.url, rel: "prev", "data-direction": "previous", children: [
429
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdrm-blog-post-nav-label", children: "Previous" }),
430
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdrm-blog-post-nav-title", children: previous.title })
431
+ ] }) : null,
432
+ next ? /* @__PURE__ */ jsxRuntime.jsxs("a", { className: "cdrm-blog-post-nav-link", href: next.url, rel: "next", "data-direction": "next", children: [
433
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdrm-blog-post-nav-label", children: "Next" }),
434
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cdrm-blog-post-nav-title", children: next.title })
435
+ ] }) : null
436
+ ] });
437
+ };
438
+ BlogPostNav.displayName = "BlogPostNav";
439
+ exports.BlogBreadcrumb = BlogBreadcrumb;
440
+ exports.BlogIndex = BlogIndex;
441
+ exports.BlogLeadPost = BlogLeadPost;
442
+ exports.BlogPostEntry = BlogPostEntry;
443
+ exports.BlogPostNav = BlogPostNav;
444
+ exports.BlogShell = BlogShell;
445
+ exports.BlogSidebar = BlogSidebar;
446
+ exports.NO_SUBJECT = NO_SUBJECT;
447
+ exports.blogFilterFromSearchParams = blogFilterFromSearchParams;
448
+ exports.blogFilterUrl = blogFilterUrl;
449
+ exports.createBlogModel = createBlogModel;
450
+ exports.filterBlogPosts = filterBlogPosts;
451
+ exports.firstImage = firstImage;
452
+ exports.htmlToPlainText = htmlToPlainText;
453
+ exports.isFiltering = isFiltering;
454
+ exports.readingMinutes = readingMinutes;
455
+ exports.subjectColorFromName = subjectColorFromName;
456
+ exports.summarizeBlogPost = summarizeBlogPost;
457
+ //# sourceMappingURL=blog_post_nav-BpUDqfSu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog_post_nav-BpUDqfSu.js","sources":["../src/prebuilt_ui/blog/model/summarize_blog_post.ts","../src/prebuilt_ui/blog/model/blog_model.ts","../src/prebuilt_ui/blog/model/blog_filter.ts","../src/prebuilt_ui/blog/components/shared.tsx","../src/prebuilt_ui/blog/components/blog_sidebar.tsx","../src/prebuilt_ui/blog/components/blog_shell.tsx","../src/prebuilt_ui/blog/components/blog_index.tsx","../src/prebuilt_ui/blog/components/blog_post_nav.tsx"],"sourcesContent":["import { relativePathToBlogUrl } from \"../../../path__utils/relative_path_to_url\";\nimport { type BlogFileSummary } from \"../../../code_gen/typeshare/conundrum\";\nimport { type WithNullableOptionals } from \"../../../types/general\";\n\n/** Words per minute used for reading times. */\nconst WORDS_PER_MINUTE = 230;\n\nexport type AnyBlogFile = BlogFileSummary | WithNullableOptionals<BlogFileSummary>;\n\n/** One post, as the blog components show it. */\nexport interface BlogPostSummary {\n relativePath: string;\n url: string;\n title: string;\n summary: string;\n subject: string | null;\n topic: string | null;\n tags: string[];\n /** The first image in the post, used as its cover. */\n cover: { src: string; alt: string } | null;\n readingMinutes: number;\n /** The post's visible text, for search. */\n plainText: string;\n}\n\n/** The first `<img>` in compiled HTML. */\nexport const firstImage = (html: string): { src: string; alt: string } | null => {\n const tag = /<img\\b[^>]*>/i.exec(html)?.[0];\n if (!tag) {\n return null;\n }\n const src = /\\bsrc\\s*=\\s*\"([^\"]+)\"/i.exec(tag)?.[1];\n if (!src) {\n return null;\n }\n const alt = /\\balt\\s*=\\s*\"([^\"]*)\"/i.exec(tag)?.[1] ?? \"\";\n return { src, alt };\n};\n\n/** The visible text of compiled HTML, without math markup, scripts or styles. */\nexport const htmlToPlainText = (html: string): string =>\n html\n .replace(/<(script|style|math|annotation|svg)\\b[\\s\\S]*?<\\/\\1>/gi, \" \")\n .replace(/<[^>]+>/g, \" \")\n .replace(/&nbsp;/gi, \" \")\n .replace(/&amp;/gi, \"&\")\n .replace(/&[a-z#0-9]+;/gi, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n\n/** Minutes to read some text, at least one. */\nexport const readingMinutes = (text: string): number => {\n const words = text.split(\" \").filter((w) => /[\\p{L}\\p{N}]/u.test(w)).length;\n return Math.max(1, Math.round(words / WORDS_PER_MINUTE));\n};\n\n/**\n * A compiled note as a post, or `null` for notes that aren't posts: ones without a `title` and\n * `summary` in their front matter.\n */\nexport const summarizeBlogPost = (\n file: AnyBlogFile,\n toUrl: (relativePath: string) => string = relativePathToBlogUrl,\n): BlogPostSummary | null => {\n const fm = file.front_matter;\n if (!fm?.title || !fm.summary) {\n return null;\n }\n const plainText = htmlToPlainText(file.html);\n return {\n relativePath: file.relative_path,\n url: toUrl(file.relative_path),\n title: fm.title,\n summary: fm.summary,\n subject: fm.subject ?? null,\n topic: fm.topic ?? null,\n tags: file.tags,\n cover: firstImage(file.html),\n readingMinutes: readingMinutes(plainText),\n plainText,\n };\n};\n","import { type BlogConfig } from \"../../../code_gen/typeshare/conundrum\";\nimport { relativePathToBlogUrl } from \"../../../path__utils/relative_path_to_url\";\nimport { type AnyBlogFile, type BlogPostSummary, summarizeBlogPost } from \"./summarize_blog_post\";\n\n/** A post with its subject's color. */\nexport interface BlogPost extends BlogPostSummary {\n /** The subject's CSS color. */\n color: string;\n}\n\nexport interface BlogSubject {\n name: string;\n color: string;\n posts: BlogPost[];\n /** The subject's topics, in the order they first appear. */\n topics: { name: string; count: number }[];\n}\n\n/** Everything the blog components show, built once per request by {@link createBlogModel}. */\nexport interface BlogModel {\n title: string;\n description: string | null;\n /** The blog's URL, e.g. `/blog`. */\n baseUrl: string;\n /** Every listed post, in the output's order. */\n posts: BlogPost[];\n /** The featured posts, lead first. */\n featured: BlogPost[];\n /** Subjects with at least one listed post, in display order. */\n subjects: BlogSubject[];\n /** Tags with their post counts: featured tags first, then by count. */\n tags: { name: string; count: number }[];\n /** How many posts each subject shows on the front page. */\n postsPerSubject: number;\n}\n\nexport interface BlogModelOptions {\n /** The blog's URL. Default: `/blog`. */\n baseUrl?: string;\n /** A post's URL. Default: `/blog/by_path/<relative path without extension>`. */\n postUrl?: (relativePath: string) => string;\n /** Settings that replace the output's `blog` settings, field by field. */\n config?: Partial<BlogConfig>;\n}\n\n/** The builder output, or anything with its `files` (and optionally `blog`). */\nexport interface BlogSource {\n files: AnyBlogFile[];\n blog?: Partial<BlogConfig> | null;\n}\n\n/** Posts without a subject are listed under this name. */\nexport const NO_SUBJECT = \"Other\";\n\n/** A color for a subject without one configured, derived from its name so it never changes. */\nexport const subjectColorFromName = (subject: string): string => {\n let hash = 0;\n for (const ch of subject) {\n hash = (hash * 31 + ch.codePointAt(0)!) % 360;\n }\n return `oklch(0.74 0.13 ${hash})`;\n};\n\n/**\n * Builds the blog from compiled notes and the project's `blog` settings: which posts are listed,\n * the featured posts, the subjects with their colors and topics, and the tags.\n */\nexport const createBlogModel = (source: BlogSource, options: BlogModelOptions = {}): BlogModel => {\n const config = { ...(source.blog ?? {}), ...(options.config ?? {}) };\n const hiddenPaths = config.hidden_paths ?? [];\n const hiddenSubjects = config.hidden_subjects ?? [];\n const colors = new Map((config.subject_colors ?? []).map((c) => [c.subject, c.color]));\n const colorOf = (subject: string | null): string =>\n colors.get(subject ?? NO_SUBJECT) ?? subjectColorFromName(subject ?? NO_SUBJECT);\n\n const posts: BlogPost[] = source.files\n .filter((f) => !hiddenPaths.some((prefix) => f.relative_path.startsWith(prefix)))\n .map((f) => summarizeBlogPost(f, options.postUrl ?? relativePathToBlogUrl))\n .filter((p): p is BlogPostSummary => p !== null)\n .filter((p) => !p.subject || !hiddenSubjects.includes(p.subject))\n .map((p) => ({ ...p, color: colorOf(p.subject) }));\n\n const bySubject = new Map<string, BlogPost[]>();\n for (const name of config.subject_order ?? []) {\n bySubject.set(name, []);\n }\n for (const post of posts) {\n const key = post.subject ?? NO_SUBJECT;\n bySubject.set(key, [...(bySubject.get(key) ?? []), post]);\n }\n const subjects: BlogSubject[] = [...bySubject.entries()]\n .filter(([, list]) => list.length > 0)\n .map(([name, list]) => {\n const topics = new Map<string, number>();\n for (const p of list) {\n if (p.topic) {\n topics.set(p.topic, (topics.get(p.topic) ?? 0) + 1);\n }\n }\n return {\n name,\n color: colorOf(name === NO_SUBJECT ? null : name),\n posts: list,\n topics: [...topics.entries()].map(([topic, count]) => ({ name: topic, count })),\n };\n });\n\n const tagCounts = new Map<string, number>();\n for (const post of posts) {\n for (const tag of post.tags) {\n tagCounts.set(tag, (tagCounts.get(tag) ?? 0) + 1);\n }\n }\n const featuredTags = (config.featured_tags ?? []).filter((t) => tagCounts.has(t));\n const tags = [\n ...featuredTags,\n ...[...tagCounts.keys()]\n .filter((t) => !featuredTags.includes(t))\n .sort((a, b) => tagCounts.get(b)! - tagCounts.get(a)! || a.localeCompare(b)),\n ].map((name) => ({ name, count: tagCounts.get(name)! }));\n\n const featured = (config.featured ?? [])\n .map((path) => posts.find((p) => p.relativePath === path))\n .filter((p): p is BlogPost => p !== undefined);\n\n return {\n title: config.title ?? \"Blog\",\n description: config.description ?? null,\n baseUrl: options.baseUrl ?? \"/blog\",\n posts,\n featured,\n subjects,\n tags,\n postsPerSubject: Math.max(1, config.posts_per_subject ?? 5),\n };\n};\n","import { type BlogModel, type BlogPost, NO_SUBJECT } from \"./blog_model\";\n\n/** What the blog index is showing. Every field narrows the posts; none shows them all. */\nexport interface BlogFilter {\n subject?: string | null;\n topic?: string | null;\n tag?: string | null;\n /** Words to search for in titles, summaries, subjects, topics, tags and post text. */\n query?: string | null;\n}\n\ntype SearchParamValue = string | string[] | undefined | null;\n\nconst firstValue = (value: SearchParamValue): string | null => {\n const v = Array.isArray(value) ? value[0] : value;\n return v && v.trim() ? v.trim() : null;\n};\n\n/**\n * Reads a filter from URL search parameters: `subject`, `topic`, `tag` (or `tagAnyOf`) and `q`.\n * Works with Next.js's `searchParams` and with `URLSearchParams`.\n */\nexport const blogFilterFromSearchParams = (\n params: Record<string, SearchParamValue> | URLSearchParams | null | undefined,\n): BlogFilter => {\n const get = (key: string): string | null =>\n params instanceof URLSearchParams\n ? firstValue(params.get(key))\n : firstValue(params?.[key]);\n return {\n subject: get(\"subject\"),\n topic: get(\"topic\"),\n tag: get(\"tag\") ?? get(\"tagAnyOf\"),\n query: get(\"q\"),\n };\n};\n\n/** True when the filter narrows the posts at all. */\nexport const isFiltering = (filter: BlogFilter): boolean =>\n Boolean(filter.subject || filter.topic || filter.tag || filter.query);\n\n/** The URL of the blog index showing `filter`. */\nexport const blogFilterUrl = (baseUrl: string, filter: BlogFilter = {}): string => {\n const params = new URLSearchParams();\n if (filter.subject) params.set(\"subject\", filter.subject);\n if (filter.topic) params.set(\"topic\", filter.topic);\n if (filter.tag) params.set(\"tag\", filter.tag);\n if (filter.query) params.set(\"q\", filter.query);\n const query = params.toString();\n return query ? `${baseUrl}?${query}` : baseUrl;\n};\n\n/**\n * The posts matching `filter`. Searches rank matches in titles first, then summaries, subjects,\n * topics and tags, then the text of the post; every word has to match somewhere.\n */\nexport const filterBlogPosts = (model: BlogModel, filter: BlogFilter): BlogPost[] => {\n const narrowed = model.posts.filter(\n (p) =>\n (!filter.subject || (p.subject ?? NO_SUBJECT) === filter.subject) &&\n (!filter.topic || p.topic === filter.topic) &&\n (!filter.tag || p.tags.includes(filter.tag)),\n );\n const words = (filter.query ?? \"\").toLowerCase().split(/\\s+/).filter(Boolean);\n if (words.length === 0) {\n return narrowed;\n }\n const scored = narrowed\n .map((post, index) => {\n const title = post.title.toLowerCase();\n const meta = [post.summary, post.subject ?? \"\", post.topic ?? \"\", ...post.tags]\n .join(\" \")\n .toLowerCase();\n const body = post.plainText.toLowerCase();\n let score = 0;\n for (const word of words) {\n if (title.includes(word)) score += 4;\n else if (meta.includes(word)) score += 2;\n else if (body.includes(word)) score += 1;\n else return null;\n }\n return { post, score, index };\n })\n .filter((s): s is { post: BlogPost; score: number; index: number } => s !== null);\n scored.sort((a, b) => b.score - a.score || a.index - b.index);\n return scored.map((s) => s.post);\n};\n","import React, { type CSSProperties, type ReactNode } from \"react\";\nimport { type BlogPost } from \"../model/blog_model\";\n\n/** Sets `--cdrm-subject` for a subject's marker. */\nexport const subjectStyle = (color: string): CSSProperties =>\n ({ \"--cdrm-subject\": color }) as CSSProperties;\n\nexport const SubjectSwatch = ({ color }: { color: string }): ReactNode => (\n <span className=\"cdrm-blog-swatch\" style={subjectStyle(color)} aria-hidden=\"true\" />\n);\n\nSubjectSwatch.displayName = \"SubjectSwatch\";\n\nexport const readingTime = (minutes: number): string => `${minutes} min read`;\n\n/** A post's subject, topic and reading time. */\nexport const PostMeta = ({\n post,\n showSubject = true,\n}: {\n post: BlogPost;\n showSubject?: boolean;\n}): ReactNode => (\n <p className=\"cdrm-blog-meta\">\n {showSubject && post.subject ? (\n <span className=\"cdrm-blog-meta-subject\">\n <SubjectSwatch color={post.color} />\n {post.subject}\n </span>\n ) : null}\n {post.topic ? <span>{post.topic}</span> : null}\n <span>{readingTime(post.readingMinutes)}</span>\n </p>\n);\n\nPostMeta.displayName = \"PostMeta\";\n\nexport const SearchIcon = (): ReactNode => (\n <svg\n className=\"cdrm-blog-search-icon\"\n viewBox=\"0 0 24 24\"\n width=\"16\"\n height=\"16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </svg>\n);\n\nSearchIcon.displayName = \"SearchIcon\";\n\nexport const classNames = (...names: (string | false | null | undefined)[]): string =>\n names.filter(Boolean).join(\" \");\n","import React, { type ReactNode } from \"react\";\nimport { type BlogModel, NO_SUBJECT } from \"../model/blog_model\";\nimport { type BlogFilter, blogFilterUrl, isFiltering } from \"../model/blog_filter\";\nimport { SearchIcon, SubjectSwatch, classNames, subjectStyle } from \"./shared\";\n\nexport interface BlogSidebarProps {\n model: BlogModel;\n /** What the index is showing, to mark the current subject or tag. */\n filter?: BlogFilter;\n /** The relative path of the post being read, on post pages. Its subject opens to list its posts. */\n activePost?: string | null;\n /** Shown at the top, e.g. your logo linking home. */\n banner?: ReactNode;\n /** Prefix for element ids, so two copies of the sidebar can share a page. */\n idPrefix?: string;\n className?: string;\n}\n\nconst current = (yes: boolean): \"page\" | undefined => (yes ? \"page\" : undefined);\n\n/**\n * The blog's navigation: search, every subject with its post count, and tags. The subject being\n * read opens to list its posts. Plain links and a GET form, so it works without JavaScript.\n */\nexport const BlogSidebar = ({\n model,\n filter = {},\n activePost = null,\n banner,\n idPrefix = \"cdrm-blog\",\n className,\n}: BlogSidebarProps): ReactNode => {\n const post = activePost ? model.posts.find((p) => p.relativePath === activePost) : undefined;\n const openSubject = post ? (post.subject ?? NO_SUBJECT) : (filter.subject ?? null);\n const onIndex = !activePost;\n const total = model.posts.length;\n\n return (\n <nav className={classNames(\"cdrm-blog\", \"cdrm-blog-sidebar\", className)} aria-label=\"Blog\">\n {banner ? <div className=\"cdrm-blog-sidebar-banner\">{banner}</div> : null}\n\n <form className=\"cdrm-blog-search\" role=\"search\" action={model.baseUrl} method=\"get\">\n <label htmlFor={`${idPrefix}-search`} className=\"cdrm-blog-visually-hidden\">\n Search posts\n </label>\n <SearchIcon />\n <input\n id={`${idPrefix}-search`}\n className=\"cdrm-blog-search-input\"\n type=\"search\"\n name=\"q\"\n placeholder=\"Search posts\"\n defaultValue={filter.query ?? \"\"}\n autoComplete=\"off\"\n />\n </form>\n\n <ul className=\"cdrm-blog-nav-list\">\n <li>\n <a\n className=\"cdrm-blog-nav-link\"\n href={model.baseUrl}\n aria-current={current(onIndex && !isFiltering(filter))}\n >\n <span className=\"cdrm-blog-nav-label\">All posts</span>\n <span className=\"cdrm-blog-count\">{total}</span>\n </a>\n </li>\n </ul>\n\n <h2 className=\"cdrm-blog-nav-heading\" id={`${idPrefix}-subjects`}>\n Subjects\n </h2>\n <ul className=\"cdrm-blog-nav-list\" aria-labelledby={`${idPrefix}-subjects`}>\n {model.subjects.map((subject) => {\n const open = subject.name === openSubject;\n return (\n <li key={subject.name}>\n <a\n className=\"cdrm-blog-nav-link\"\n href={blogFilterUrl(model.baseUrl, { subject: subject.name })}\n aria-current={current(\n onIndex && filter.subject === subject.name && !filter.topic && !filter.tag && !filter.query,\n )}\n data-open={open ? \"\" : undefined}\n >\n <SubjectSwatch color={subject.color} />\n <span className=\"cdrm-blog-nav-label\">{subject.name}</span>\n <span className=\"cdrm-blog-count\">{subject.posts.length}</span>\n </a>\n {open ? (\n <ul className=\"cdrm-blog-nav-posts\" style={subjectStyle(subject.color)}>\n {subject.posts.map((p) => (\n <li key={p.relativePath}>\n <a\n className=\"cdrm-blog-nav-post\"\n href={p.url}\n aria-current={current(p.relativePath === activePost)}\n >\n {p.title}\n </a>\n </li>\n ))}\n </ul>\n ) : null}\n </li>\n );\n })}\n </ul>\n\n {model.tags.length > 0 ? (\n <>\n <h2 className=\"cdrm-blog-nav-heading\" id={`${idPrefix}-tags`}>\n Tags\n </h2>\n <ul className=\"cdrm-blog-tags\" aria-labelledby={`${idPrefix}-tags`}>\n {model.tags.map((tag) => (\n <li key={tag.name}>\n <a\n className=\"cdrm-blog-tag\"\n href={blogFilterUrl(model.baseUrl, { tag: tag.name })}\n aria-current={current(onIndex && filter.tag === tag.name)}\n >\n {tag.name}\n </a>\n </li>\n ))}\n </ul>\n </>\n ) : null}\n </nav>\n );\n};\n\nBlogSidebar.displayName = \"BlogSidebar\";\n","import React, { type ReactNode } from \"react\";\nimport { BlogSidebar, type BlogSidebarProps } from \"./blog_sidebar\";\nimport { classNames } from \"./shared\";\n\nexport interface BlogShellProps extends Omit<BlogSidebarProps, \"idPrefix\" | \"className\"> {\n children: ReactNode;\n className?: string;\n}\n\n/**\n * The blog's page layout: the sidebar beside the content on wide screens, and a \"Browse\" menu\n * above it on narrow ones. Both are in the server-rendered HTML and CSS picks one, so nothing\n * moves once the page has loaded. The page scrolls normally; the sidebar stays in place.\n */\nexport const BlogShell = ({ children, className, banner, ...sidebar }: BlogShellProps): ReactNode => (\n <div className={classNames(\"cdrm-blog\", \"cdrm-blog-shell\", className)}>\n <aside className=\"cdrm-blog-shell-sidebar\">\n <BlogSidebar {...sidebar} banner={banner} idPrefix=\"cdrm-blog-sidebar\" />\n </aside>\n <div className=\"cdrm-blog-shell-content\">\n <div className=\"cdrm-blog-mobile-bar\">\n {banner ? <div className=\"cdrm-blog-mobile-banner\">{banner}</div> : null}\n <details className=\"cdrm-blog-mobile-menu\">\n <summary className=\"cdrm-blog-mobile-toggle\">Browse</summary>\n <div className=\"cdrm-blog-mobile-panel\">\n <BlogSidebar {...sidebar} idPrefix=\"cdrm-blog-mobile\" />\n </div>\n </details>\n </div>\n <main className=\"cdrm-blog-main\">{children}</main>\n </div>\n </div>\n);\n\nBlogShell.displayName = \"BlogShell\";\n","import React, { type ReactNode } from \"react\";\nimport { type BlogModel, type BlogPost } from \"../model/blog_model\";\nimport { type BlogFilter, blogFilterUrl, filterBlogPosts, isFiltering } from \"../model/blog_filter\";\nimport { PostMeta, SubjectSwatch, classNames } from \"./shared\";\n\nexport interface BlogIndexProps {\n model: BlogModel;\n /** What to show, usually from the URL: see `blogFilterFromSearchParams`. */\n filter?: BlogFilter;\n className?: string;\n}\n\n/** The lead featured post: large, with its cover beside it. */\nexport const BlogLeadPost = ({ post }: { post: BlogPost }): ReactNode => (\n <article className=\"cdrm-blog-lead\" data-has-cover={post.cover ? \"\" : undefined}>\n <div className=\"cdrm-blog-lead-text\">\n <PostMeta post={post} />\n <h2 className=\"cdrm-blog-lead-title\">\n <a className=\"cdrm-blog-stretched-link\" href={post.url}>\n {post.title}\n </a>\n </h2>\n <p className=\"cdrm-blog-lead-summary\">{post.summary}</p>\n </div>\n {post.cover ? (\n <div className=\"cdrm-blog-lead-cover\">\n <img src={post.cover.src} alt={post.cover.alt} decoding=\"async\" />\n </div>\n ) : null}\n </article>\n);\n\nBlogLeadPost.displayName = \"BlogLeadPost\";\n\n/** One post in a list: title, summary, details, and its cover as a thumbnail. */\nexport const BlogPostEntry = ({\n post,\n showSubject = true,\n}: {\n post: BlogPost;\n showSubject?: boolean;\n}): ReactNode => (\n <article className=\"cdrm-blog-entry\" data-has-cover={post.cover ? \"\" : undefined}>\n <div className=\"cdrm-blog-entry-text\">\n <h3 className=\"cdrm-blog-entry-title\">\n <a className=\"cdrm-blog-stretched-link\" href={post.url}>\n {post.title}\n </a>\n </h3>\n <p className=\"cdrm-blog-entry-summary\">{post.summary}</p>\n <PostMeta post={post} showSubject={showSubject} />\n </div>\n {post.cover ? (\n <div className=\"cdrm-blog-entry-cover\">\n <img src={post.cover.src} alt=\"\" loading=\"lazy\" decoding=\"async\" />\n </div>\n ) : null}\n </article>\n);\n\nBlogPostEntry.displayName = \"BlogPostEntry\";\n\nconst slugify = (s: string): string =>\n s.toLowerCase().replace(/[^a-z0-9]+/g, \"-\").replace(/^-|-$/g, \"\");\n\nconst plural = (n: number, word: string): string => `${n} ${word}${n === 1 ? \"\" : \"s\"}`;\n\n/** The heading of a filtered index: where you are, how many posts match, and the subject's topics. */\nconst FilterHeader = ({\n model,\n filter,\n count,\n}: {\n model: BlogModel;\n filter: BlogFilter;\n count: number;\n}): ReactNode => {\n const subject = filter.subject\n ? model.subjects.find((s) => s.name === filter.subject)\n : undefined;\n const heading = filter.query\n ? \"Search\"\n : filter.tag\n ? filter.tag\n : (filter.topic ?? filter.subject ?? model.title);\n const summary = filter.query\n ? `${plural(count, \"post\")} ${count === 1 ? \"matches\" : \"match\"} “${filter.query}”`\n : plural(count, \"post\");\n // Topics are only worth filtering by when at least one groups several posts.\n const topics =\n subject && !filter.query && subject.topics.some((t) => t.count > 1) ? subject.topics : [];\n\n return (\n <header className=\"cdrm-blog-header\">\n <nav className=\"cdrm-blog-breadcrumb\" aria-label=\"Breadcrumb\">\n <ol>\n <li>\n <a href={model.baseUrl}>{model.title}</a>\n </li>\n {filter.topic && filter.subject ? (\n <li>\n <a href={blogFilterUrl(model.baseUrl, { subject: filter.subject })}>\n {filter.subject}\n </a>\n </li>\n ) : null}\n </ol>\n </nav>\n <h1 className=\"cdrm-blog-title\">\n {subject && !filter.topic && !filter.query ? <SubjectSwatch color={subject.color} /> : null}\n {heading}\n </h1>\n <p className=\"cdrm-blog-description\">{summary}</p>\n {topics.length > 0 ? (\n <ul className=\"cdrm-blog-topics\" aria-label={`Topics in ${subject!.name}`}>\n <li>\n <a\n className=\"cdrm-blog-topic\"\n href={blogFilterUrl(model.baseUrl, { subject: subject!.name })}\n aria-current={!filter.topic ? \"page\" : undefined}\n >\n All\n </a>\n </li>\n {topics.map((t) => (\n <li key={t.name}>\n <a\n className=\"cdrm-blog-topic\"\n href={blogFilterUrl(model.baseUrl, { subject: subject!.name, topic: t.name })}\n aria-current={filter.topic === t.name ? \"page\" : undefined}\n >\n {t.name}\n <span className=\"cdrm-blog-count\">{t.count}</span>\n </a>\n </li>\n ))}\n </ul>\n ) : null}\n </header>\n );\n};\n\n/**\n * The blog's index: the title, the featured posts, then each subject's other posts (up to\n * `posts_per_subject`, with a link to the rest). With a filter, it shows the matching posts\n * instead, with a breadcrumb back and the subject's topics.\n */\nexport const BlogIndex = ({ model, filter = {}, className }: BlogIndexProps): ReactNode => {\n const filtering = isFiltering(filter);\n const [lead, ...moreFeatured] = filtering ? [] : model.featured;\n const featuredPaths = new Set(filtering ? [] : model.featured.map((p) => p.relativePath));\n const posts = filtering ? filterBlogPosts(model, filter) : [];\n // Inside one subject, every post shares it, so entries leave it out.\n const showSubject = !filter.subject;\n\n return (\n <div className={classNames(\"cdrm-blog\", \"cdrm-blog-index\", className)}>\n {filtering ? (\n <FilterHeader model={model} filter={filter} count={posts.length} />\n ) : (\n <header className=\"cdrm-blog-header\">\n <h1 className=\"cdrm-blog-title\">{model.title}</h1>\n {model.description ? <p className=\"cdrm-blog-description\">{model.description}</p> : null}\n </header>\n )}\n\n {lead ? <BlogLeadPost post={lead} /> : null}\n\n {moreFeatured.length > 0 ? (\n <ul className=\"cdrm-blog-featured-list\" aria-label=\"More featured posts\">\n {moreFeatured.map((p) => (\n <li key={p.relativePath}>\n <BlogPostEntry post={p} />\n </li>\n ))}\n </ul>\n ) : null}\n\n {filtering ? (\n posts.length > 0 ? (\n <section className=\"cdrm-blog-list-section\" aria-label=\"Posts\">\n <ul className=\"cdrm-blog-list\">\n {posts.map((p) => (\n <li key={p.relativePath}>\n <BlogPostEntry post={p} showSubject={showSubject} />\n </li>\n ))}\n </ul>\n </section>\n ) : (\n <p className=\"cdrm-blog-empty\">\n {filter.query ? \"Try fewer or different words, or \" : \"Nothing here yet. \"}\n <a href={model.baseUrl}>{filter.query ? \"browse every post\" : \"show every post\"}</a>.\n </p>\n )\n ) : (\n model.subjects.map((subject) => {\n const rest = subject.posts.filter((p) => !featuredPaths.has(p.relativePath));\n if (rest.length === 0) {\n return null;\n }\n const shown = rest.slice(0, model.postsPerSubject);\n const id = `cdrm-blog-subject-${slugify(subject.name)}`;\n return (\n <section key={subject.name} className=\"cdrm-blog-group\" aria-labelledby={id}>\n <div className=\"cdrm-blog-group-header\">\n <h2 className=\"cdrm-blog-group-title\" id={id}>\n <SubjectSwatch color={subject.color} />\n {subject.name}\n </h2>\n {shown.length < rest.length ? (\n <a\n className=\"cdrm-blog-group-more\"\n href={blogFilterUrl(model.baseUrl, { subject: subject.name })}\n >\n All {subject.posts.length} posts\n </a>\n ) : null}\n </div>\n <ul className=\"cdrm-blog-list\">\n {shown.map((p) => (\n <li key={p.relativePath}>\n <BlogPostEntry post={p} showSubject={false} />\n </li>\n ))}\n </ul>\n </section>\n );\n })\n )}\n </div>\n );\n};\n\nBlogIndex.displayName = \"BlogIndex\";\n","import React, { type ReactNode } from \"react\";\nimport { type BlogModel, NO_SUBJECT } from \"../model/blog_model\";\nimport { blogFilterUrl } from \"../model/blog_filter\";\nimport { classNames } from \"./shared\";\n\nexport interface BlogPostNavProps {\n model: BlogModel;\n /** The relative path of the post being read. */\n relativePath: string;\n className?: string;\n}\n\n/** The posts before and after this one in its subject, in sidebar order. */\nconst neighbours = (model: BlogModel, relativePath: string) => {\n const post = model.posts.find((p) => p.relativePath === relativePath);\n const list = post\n ? (model.subjects.find((s) => s.name === (post.subject ?? NO_SUBJECT))?.posts ?? [])\n : [];\n const index = list.findIndex((p) => p.relativePath === relativePath);\n return {\n post,\n previous: index > 0 ? list[index - 1] : undefined,\n next: index >= 0 && index < list.length - 1 ? list[index + 1] : undefined,\n };\n};\n\n/** Where a post sits: the blog, then its subject. Put it above the post. */\nexport const BlogBreadcrumb = ({ model, relativePath, className }: BlogPostNavProps): ReactNode => {\n const { post } = neighbours(model, relativePath);\n return (\n <nav className={classNames(\"cdrm-blog\", \"cdrm-blog-breadcrumb\", className)} aria-label=\"Breadcrumb\">\n <ol>\n <li>\n <a href={model.baseUrl}>{model.title}</a>\n </li>\n {post?.subject ? (\n <li>\n <a href={blogFilterUrl(model.baseUrl, { subject: post.subject })}>{post.subject}</a>\n </li>\n ) : null}\n </ol>\n </nav>\n );\n};\n\nBlogBreadcrumb.displayName = \"BlogBreadcrumb\";\n\n/** Links to the previous and next posts in the same subject. Put it below the post. */\nexport const BlogPostNav = ({ model, relativePath, className }: BlogPostNavProps): ReactNode => {\n const { previous, next } = neighbours(model, relativePath);\n if (!previous && !next) {\n return null;\n }\n return (\n <nav className={classNames(\"cdrm-blog\", \"cdrm-blog-post-nav\", className)} aria-label=\"More in this subject\">\n {previous ? (\n <a className=\"cdrm-blog-post-nav-link\" href={previous.url} rel=\"prev\" data-direction=\"previous\">\n <span className=\"cdrm-blog-post-nav-label\">Previous</span>\n <span className=\"cdrm-blog-post-nav-title\">{previous.title}</span>\n </a>\n ) : null}\n {next ? (\n <a className=\"cdrm-blog-post-nav-link\" href={next.url} rel=\"next\" data-direction=\"next\">\n <span className=\"cdrm-blog-post-nav-label\">Next</span>\n <span className=\"cdrm-blog-post-nav-title\">{next.title}</span>\n </a>\n ) : null}\n </nav>\n );\n};\n\nBlogPostNav.displayName = \"BlogPostNav\";\n"],"names":["relativePathToBlogUrl","jsx","jsxs","Fragment"],"mappings":";;;AAKA,MAAM,mBAAmB;AAqBlB,MAAM,aAAa,CAAC,SAAsD;AAC7E,QAAM,MAAM,gBAAgB,KAAK,IAAI,IAAI,CAAC;AAC1C,MAAI,CAAC,KAAK;AACN,WAAO;AAAA,EACX;AACA,QAAM,MAAM,yBAAyB,KAAK,GAAG,IAAI,CAAC;AAClD,MAAI,CAAC,KAAK;AACN,WAAO;AAAA,EACX;AACA,QAAM,MAAM,yBAAyB,KAAK,GAAG,IAAI,CAAC,KAAK;AACvD,SAAO,EAAE,KAAK,IAAA;AAClB;AAGO,MAAM,kBAAkB,CAAC,SAC5B,KACK,QAAQ,yDAAyD,GAAG,EACpE,QAAQ,YAAY,GAAG,EACvB,QAAQ,YAAY,GAAG,EACvB,QAAQ,WAAW,GAAG,EACtB,QAAQ,kBAAkB,GAAG,EAC7B,QAAQ,QAAQ,GAAG,EACnB,KAAA;AAGF,MAAM,iBAAiB,CAAC,SAAyB;AACpD,QAAM,QAAQ,KAAK,MAAM,GAAG,EAAE,OAAO,CAAC,MAAM,gBAAgB,KAAK,CAAC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