bloggie 0.4.3 → 0.4.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.
- package/AGENTS.md +4 -0
- package/README.md +5 -0
- package/e2e/run.js +29 -7
- package/layouts/Post.astro +17 -11
- package/lib/pages.js +29 -0
- package/package.json +1 -1
- package/pages/index.astro +90 -38
- package/scripts/export/agent.js +2 -2
- package/scripts/export/common.js +10 -4
- package/scripts/export/dev.js +7 -5
- package/scripts/export/index.js +14 -10
- package/scripts/export/page.js +4 -3
- package/scripts/export-posts.js +26 -11
- package/skills/bloggie-slides/SKILL.md +2 -1
- package/styles/site.css +117 -11
- package/template/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -19,6 +19,10 @@ and figures. `template/` is the starter blog that `scripts/create.js` copies (`n
|
|
|
19
19
|
- A release goes to npm: raise the last number of `version` in `package.json`, 0.4.0 to 0.4.1 (the middle number goes
|
|
20
20
|
up once others contribute), and the template's `bloggie` dependency with it; then `npm publish` here. Publish
|
|
21
21
|
`create/` (`create-bloggie`) only when its `index.js` changes.
|
|
22
|
+
- An agent never runs `npm publish`: it needs the maintainer's npm login and a one-time password. When asked to
|
|
23
|
+
publish, an agent prepares the release (the version numbers, the commits) and then prints the commands for the
|
|
24
|
+
maintainer to run, with full paths: `cd <this folder> && npm publish`, and the same in `create/` when it changes.
|
|
25
|
+
After the maintainer says it is done, the agent checks the release with `npm view bloggie version`.
|
|
22
26
|
- From a blog, `npm run bloggie:push -- -m "…" --yes` (`scripts/publish.js`) publishes `bloggie/` as one new commit on
|
|
23
27
|
top of the engine's main and opens a pull request: to a branch of the engine's repository if you may push there,
|
|
24
28
|
else of your fork (`gh` makes it; without `gh`, `--remote <fork>`). `--main` pushes to main. None of the blog's
|
package/README.md
CHANGED
|
@@ -98,9 +98,13 @@ src/pages/posts/<slug>/
|
|
|
98
98
|
index.mdx the post: Markdown, math and figure tags
|
|
99
99
|
slides.mdx its deck (optional)
|
|
100
100
|
data/ media/ the numbers and pictures it shows
|
|
101
|
+
<name>.mdx a subpage, at /posts/<slug>/<name>/ (optional)
|
|
102
|
+
<name>/ a subpage that is a folder: its own index.mdx, and slides.mdx if it has a deck
|
|
101
103
|
```
|
|
102
104
|
|
|
103
105
|
The blog's home page is an index that lists every post, newest first.
|
|
106
|
+
A subpage, such as an appendix or a long table, uses the post layout but is not listed on the home page; link to it from its post.
|
|
107
|
+
It can sit at any depth under the post, so a post can also hold earlier posts as an archive.
|
|
104
108
|
You can ask an agent to write a post or its slides, or edit it yourself in Markdown and HTML.
|
|
105
109
|
|
|
106
110
|
## One style, written down for your agent
|
|
@@ -125,6 +129,7 @@ A note written as `((…))` anywhere in a file asks the agent to address it and
|
|
|
125
129
|
The <img src=".github/readme/download.svg" height="14" alt="download"> in each post's byline downloads the post as one HTML file, with its styles, figures and deck inside.
|
|
126
130
|
It opens from disk with no internet, so you can present from a laptop offline or send the post by email.
|
|
127
131
|
The menu beside it also offers the post as text for an AI agent.
|
|
132
|
+
A subpage has no downloads unless its front matter sets `downloads: true`, since each download adds to the build's time; a post can turn them off with `downloads: false`.
|
|
128
133
|
|
|
129
134
|
## Publish
|
|
130
135
|
|
package/e2e/run.js
CHANGED
|
@@ -25,6 +25,7 @@ import { editorChecks } from './editor.js'
|
|
|
25
25
|
import { liveChecks } from './live.js'
|
|
26
26
|
import { jumpChecks } from './jump.js'
|
|
27
27
|
import { tocList, tocUse, tocSpace } from './toc.js'
|
|
28
|
+
import { downloadNames } from '../lib/pages.js'
|
|
28
29
|
|
|
29
30
|
const root = process.cwd() // the blog (lib/blog.js)
|
|
30
31
|
const dist = join(root, 'dist')
|
|
@@ -64,6 +65,8 @@ const htmlPages = (dir) => readdirSync(dir, { withFileTypes: true }).flatMap((en
|
|
|
64
65
|
})
|
|
65
66
|
|
|
66
67
|
const hasDeck = (post) => existsSync(join(dist, 'posts', post, 'slides', 'index.html'))
|
|
68
|
+
// A post or a subpage, at any depth under posts/ (lib/pages.js), as its path there; null for a deck or another page.
|
|
69
|
+
const postPath = (path) => (/^posts\/.+\/$/.test(path) && !path.endsWith('/slides/') ? path.slice('posts/'.length, -1) : null)
|
|
67
70
|
const siteUrl = (await import('../lib/blog.js')).site.url
|
|
68
71
|
|
|
69
72
|
const browser = await launch()
|
|
@@ -144,7 +147,20 @@ for (const file of htmlPages(dist)) {
|
|
|
144
147
|
return `${media.length} figures, medium="${want}"`
|
|
145
148
|
})
|
|
146
149
|
}
|
|
147
|
-
if (
|
|
150
|
+
if (postPath(path)) {
|
|
151
|
+
// The byline's links (layouts/Post.astro) go to pages and files the build made: the deck, when there is a Slides
|
|
152
|
+
// link, and the two downloads, when there is a download control. A subpage beside its post's deck has no Slides link.
|
|
153
|
+
await check(label, "the byline's Slides and download links lead to built files", async () => {
|
|
154
|
+
const links = await page.evaluate(`[...document.querySelectorAll('.byline a[href]')].map((a) => a.getAttribute('href'))`)
|
|
155
|
+
const local = links.filter((href) => !/^[a-z]+:/i.test(href) && !href.startsWith('#'))
|
|
156
|
+
const base = process.env.BASE_PATH || '/'
|
|
157
|
+
const missing = local.filter((href) => {
|
|
158
|
+
const file = join(dist, new URL(href, new URL(path, 'http://x/')).pathname.slice(base.length))
|
|
159
|
+
return !existsSync(file) && !existsSync(join(file, 'index.html'))
|
|
160
|
+
})
|
|
161
|
+
if (missing.length) throw new Error(`no built file for ${missing.join(', ')}`)
|
|
162
|
+
return local.length ? local.join(', ') : 'no Slides or download links'
|
|
163
|
+
})
|
|
148
164
|
// Every section heading ends in a faint # that links to it (Post.astro), for sharing a section.
|
|
149
165
|
await check(label, 'every section heading has an anchor that links to it', async () => {
|
|
150
166
|
const headings = await page.evaluate(`[...document.querySelectorAll('.wrap :is(h2, h3, h4)')].filter((h) => !h.closest('astro-island, .references, .post-list')).map((h) => ({ id: h.id, text: h.textContent.trim(), href: h.querySelector('.heading-anchor')?.getAttribute('href') }))`)
|
|
@@ -276,7 +292,7 @@ for (const file of htmlPages(dist)) {
|
|
|
276
292
|
}
|
|
277
293
|
})
|
|
278
294
|
}
|
|
279
|
-
const post = path
|
|
295
|
+
const post = postPath(path)
|
|
280
296
|
if (!post) continue
|
|
281
297
|
|
|
282
298
|
// The table of contents (bloggie/lib/toc.js): every post lists its sections; the example post is used as a reader would.
|
|
@@ -297,11 +313,16 @@ for (const file of htmlPages(dist)) {
|
|
|
297
313
|
await figures(label, { screenshots: true })
|
|
298
314
|
await check(label, 'no errors while the figures were used', noProblems)
|
|
299
315
|
|
|
316
|
+
// A subpage offers no downloads unless its front matter asks for them (lib/pages.js); then there is nothing more to check.
|
|
317
|
+
if (!(await page.evaluate(`!!document.querySelector('[data-download]')`))) continue
|
|
318
|
+
|
|
300
319
|
// The interactive download, opened from disk.
|
|
301
|
-
const
|
|
302
|
-
const
|
|
320
|
+
const names = downloadNames(post)
|
|
321
|
+
const folder = post.includes('/') ? post.slice(0, post.lastIndexOf('/') + 1) : '' // labels: 'slug.html' for a post
|
|
322
|
+
const download = join(dist, 'posts', post, names.page)
|
|
323
|
+
const agentFile = join(dist, 'posts', post, names.agent)
|
|
303
324
|
for (const f of [download, agentFile]) if (existsSync(f)) files[relative(dist, f)] = { bytes: statSync(f).size, sha256: createHash('sha256').update(readFileSync(f)).digest('hex') }
|
|
304
|
-
const offline = `${
|
|
325
|
+
const offline = `${folder}${names.page} (from disk)`
|
|
305
326
|
await check(offline, 'opens from file://, and every figure hydrates, with no errors', async () => {
|
|
306
327
|
if (!existsSync(download)) throw new Error(`${download} is missing`)
|
|
307
328
|
const islands = await open(pathToFileURL(download).href)
|
|
@@ -327,7 +348,8 @@ for (const file of htmlPages(dist)) {
|
|
|
327
348
|
const frame = `document.querySelector('#slides iframe')`
|
|
328
349
|
await page.evaluate(`document.dispatchEvent(new KeyboardEvent('keydown', { key: 's', bubbles: true }))`)
|
|
329
350
|
await page.waitFor(`${frame} && !document.getElementById('slides').hidden`, { timeout: 5000, what: 'the deck frame to open' })
|
|
330
|
-
|
|
351
|
+
// A deck with no figures passes once its frame has loaded.
|
|
352
|
+
await page.waitFor(`(() => { const d = ${frame}.contentDocument; const islands = d && d.readyState === 'complete' && d.querySelector('.deck') && [...d.querySelectorAll('astro-island')]; return islands && islands.every((el) => !el.hasAttribute('ssr')) })()`, { timeout: 30000, what: 'the deck figures to hydrate' })
|
|
331
353
|
const figures = await page.evaluate(`${frame}.contentDocument.querySelectorAll('astro-island').length`)
|
|
332
354
|
const video = await page.waitFor(`(() => { const v = ${frame}.contentDocument.querySelector('video'); return !v ? 'no video' : v.readyState >= 1 && !v.error ? 'duration ' + v.duration.toFixed(1) + ' s' : '' })()`, { timeout: 20000, what: 'the deck video to load' })
|
|
333
355
|
await page.evaluate(`${frame}.contentDocument.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }))`)
|
|
@@ -338,7 +360,7 @@ for (const file of htmlPages(dist)) {
|
|
|
338
360
|
}
|
|
339
361
|
|
|
340
362
|
// The agent download: text only, one description per figure, every equation with its TeX.
|
|
341
|
-
await check(`${
|
|
363
|
+
await check(`${folder}${names.agent}`, 'has no scripts, describes every figure, and keeps the TeX of every equation', () => {
|
|
342
364
|
const agent = readFileSync(agentFile, 'utf8')
|
|
343
365
|
const html = readFileSync(file, 'utf8')
|
|
344
366
|
const count = (s, pattern) => (s.match(pattern) ?? []).length
|
package/layouts/Post.astro
CHANGED
|
@@ -1,34 +1,40 @@
|
|
|
1
1
|
---
|
|
2
2
|
// Layout of a post: src/pages/posts/<slug>/index.mdx sets `layout: ../../../layouts/Post.astro`.
|
|
3
|
+
// A subpage (lib/pages.js: any other .mdx page under src/pages/posts/) uses the same layout.
|
|
3
4
|
// Front matter: title, date, edited (the date of the last edit, shown after the date when it is later),
|
|
4
5
|
// description, eyebrow, lede, author, slides (false hides a deck that exists),
|
|
6
|
+
// downloads (whether the byline offers the two downloads; true for a post, false for a subpage, by default),
|
|
5
7
|
// equationNumbers (false turns numbering off), toc (false hides the table of contents),
|
|
6
8
|
// agentSummary (a short statement of the post's question, placed at the top of the agent download).
|
|
7
9
|
// `roles` is set by remarkRoles (bloggie/lib/roles.js): the symbol roles the post's math uses, shown as a key.
|
|
8
10
|
import { existsSync } from 'node:fs'
|
|
9
|
-
import { dirname, join } from 'node:path'
|
|
11
|
+
import { basename, dirname, join } from 'node:path'
|
|
10
12
|
import { createMarkdownProcessor } from '@astrojs/markdown-remark'
|
|
11
13
|
import Base from './Base.astro'
|
|
12
14
|
import { site, longDate, isoDate } from '@/site.js'
|
|
13
15
|
import { siteUrl } from '../lib/site-url.js'
|
|
14
16
|
import { roles } from '../lib/roles.js'
|
|
17
|
+
import { pagePath, offersDownloads, downloadNames } from '../lib/pages.js'
|
|
15
18
|
|
|
16
19
|
const { frontmatter, file } = Astro.props
|
|
17
20
|
// The lede is Markdown (links, emphasis, code): front matter is plain data, so render it here, and
|
|
18
21
|
// strip the <p> the processor wraps it in.
|
|
19
22
|
const markdown = await createMarkdownProcessor()
|
|
20
23
|
const lede = frontmatter.lede && (await markdown.render(frontmatter.lede)).code.replace(/^\s*<p>|<\/p>\s*$/g, '')
|
|
21
|
-
// A
|
|
22
|
-
// the S key opens it. Without one, neither appears.
|
|
23
|
-
|
|
24
|
+
// A page has a deck when it is an index.mdx with slides.mdx beside it, at any depth; the byline then links to it
|
|
25
|
+
// and the S key opens it. Without one, neither appears. A file subpage (<name>.mdx) shares its folder with its post's
|
|
26
|
+
// index.mdx, so slides.mdx there is the post's deck, not the subpage's; a subpage with a deck is a folder,
|
|
27
|
+
// <name>/index.mdx and <name>/slides.mdx.
|
|
28
|
+
const hasSlides = frontmatter.slides !== false && !!file && basename(file) === 'index.mdx' && existsSync(join(dirname(file), 'slides.mdx'))
|
|
24
29
|
// Absolute, so the link works whether or not the post's URL ends in a slash.
|
|
25
30
|
const postHref = Astro.url.pathname.replace(/\/?$/, '/')
|
|
26
31
|
const slidesHref = `${postHref}slides/`
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
const path = pagePath(postHref, import.meta.env.BASE_URL) ?? postHref.split('/').filter(Boolean).at(-1)
|
|
33
|
+
// bloggie/scripts/export-posts.js writes both files beside the page after `astro build`, for each page whose byline
|
|
34
|
+
// offers them (the [data-download] control).
|
|
35
|
+
const downloads = offersDownloads(frontmatter, path) ? downloadNames(path) : null
|
|
36
|
+
// A heading's anchor copies a link to the deployed page, even from a downloaded copy.
|
|
37
|
+
const shareUrl = new URL(`posts/${path}/`, siteUrl).href
|
|
32
38
|
const keyRoles = roles.filter((role) => frontmatter.roles?.includes(role.name))
|
|
33
39
|
---
|
|
34
40
|
<Base title={frontmatter.title} description={frontmatter.description}>
|
|
@@ -45,7 +51,7 @@ const keyRoles = roles.filter((role) => frontmatter.roles?.includes(role.name))
|
|
|
45
51
|
<time datetime={isoDate(frontmatter.date)}>{longDate(frontmatter.date)}</time>
|
|
46
52
|
{frontmatter.edited && isoDate(frontmatter.edited) > isoDate(frontmatter.date) && <>{' '}(edited <time datetime={isoDate(frontmatter.edited)}>{longDate(frontmatter.edited)}</time>)</>}
|
|
47
53
|
{hasSlides && <><span aria-hidden="true">/</span> <a href={slidesHref} data-slides-link title="Slides (S)">Slides</a></>}
|
|
48
|
-
|
|
54
|
+
{downloads && <><span aria-hidden="true">/</span>
|
|
49
55
|
<span class="download" data-download>
|
|
50
56
|
<a class="download-main" href={`${postHref}${downloads.page}`} download={downloads.page}
|
|
51
57
|
title="Download this post as one HTML file with working figures" aria-label="Download this post as one HTML file with working figures">
|
|
@@ -64,7 +70,7 @@ const keyRoles = roles.filter((role) => frontmatter.roles?.includes(role.name))
|
|
|
64
70
|
</a>
|
|
65
71
|
</div>
|
|
66
72
|
</details>
|
|
67
|
-
</span
|
|
73
|
+
</span></>}
|
|
68
74
|
</div>
|
|
69
75
|
{keyRoles.length > 0 && (
|
|
70
76
|
<p class="role-key">
|
package/lib/pages.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Where a page sits among the posts, for the features that depend on it: the deck link, the downloads and the share
|
|
2
|
+
// link (layouts/Post.astro, scripts/export-posts.js, scripts/export/).
|
|
3
|
+
//
|
|
4
|
+
// A post is src/pages/posts/<slug>/index.mdx, at /posts/<slug>/; the home page lists it. Every other page under
|
|
5
|
+
// src/pages/posts/ is a subpage, which the home page does not list:
|
|
6
|
+
// a file beside a post's index.mdx posts/<slug>/<name>.mdx -> /posts/<slug>/<name>/
|
|
7
|
+
// a folder inside a post posts/<slug>/<name>/index.mdx -> /posts/<slug>/<name>/
|
|
8
|
+
// A page's path is its URL under posts/, without slashes at either end: '<slug>' for a post, '<slug>/<name>' (or
|
|
9
|
+
// deeper) for a subpage.
|
|
10
|
+
|
|
11
|
+
// The page's path from its URL path (`base` is the site's base path, import.meta.env.BASE_URL); null outside posts/.
|
|
12
|
+
export function pagePath(pathname, base = '/') {
|
|
13
|
+
const prefix = `${base.replace(/\/?$/, '/')}posts/`
|
|
14
|
+
if (!pathname.startsWith(prefix)) return null
|
|
15
|
+
return pathname.slice(prefix.length).replace(/\/+$/, '') || null
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const isSubpage = (path) => path.includes('/')
|
|
19
|
+
|
|
20
|
+
// A page offers the two downloads unless its front matter says otherwise (`downloads: false` on a post,
|
|
21
|
+
// `downloads: true` on a subpage). Subpages default to none: each download costs build time (see
|
|
22
|
+
// scripts/export-posts.js), and a subpage is usually reached from its post.
|
|
23
|
+
export const offersDownloads = (frontmatter, path) => frontmatter.downloads ?? !isSubpage(path)
|
|
24
|
+
|
|
25
|
+
// The downloads' file names, beside the page: named after the last part of its path.
|
|
26
|
+
export function downloadNames(path) {
|
|
27
|
+
const name = path.split('/').at(-1)
|
|
28
|
+
return { page: `${name}.html`, agent: `${name}-agent.html` }
|
|
29
|
+
}
|
package/package.json
CHANGED
package/pages/index.astro
CHANGED
|
@@ -2,61 +2,88 @@
|
|
|
2
2
|
// The home page: every post under the blog's src/pages/posts/<slug>/index.mdx, newest first. The engine adds it as
|
|
3
3
|
// the route / (astro.config.js), unless the blog has a src/pages/index.astro of its own. A folder whose
|
|
4
4
|
// name starts with "_" is not a page (Astro skips it), so it is not listed either.
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
5
|
+
//
|
|
6
|
+
// Tags. Front matter `tags: [wip]` or `tags: [archived]` marks a post; a post with no tags is part of the main story.
|
|
7
|
+
// One tag is computed, not written: `slides`, for a post with a deck (slides.mdx beside it, unless its front matter
|
|
8
|
+
// sets `slides: false`, as for its byline in layouts/Post.astro). Such a post has the slides icon to the left of its
|
|
9
|
+
// title, a link to the deck.
|
|
10
|
+
//
|
|
11
|
+
// Above the list, a chip per tag in use filters the list, one at a time: "All" shows every post but those with a
|
|
12
|
+
// hidden tag (archived), a tag's chip shows only the posts with that tag (and none with a hidden tag, unless the chip
|
|
13
|
+
// is that tag), and a click on the chosen chip goes back to All. A menu sorts the list: newest first, recently
|
|
14
|
+
// updated first (front matter `edited:`, else the publication date), or oldest first. A post edited after the day it
|
|
15
|
+
// was published shows "updated <date>". The chip and the sort are in the URL (?tag=slides&sort=updated), so a view can
|
|
16
|
+
// be linked to, and Back comes back to it.
|
|
17
|
+
import { existsSync } from 'node:fs'
|
|
18
|
+
import { join } from 'node:path'
|
|
10
19
|
import Base from '../layouts/Base.astro'
|
|
11
20
|
import { parseFrontmatter } from '@astrojs/markdown-remark'
|
|
12
21
|
import { site, longDate, isoDate } from '@/site.js'
|
|
13
22
|
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
const SLIDES_ICON = '<svg class="slides-icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M1 2.5h14M2.5 2.5v8h11v-8M8 10.5V13M8 13l-2.5 2.5M8 13l2.5 2.5M5 8.5l2-2 1.5 1.5L11 5" /></svg>'
|
|
24
|
+
|
|
25
|
+
// Each tag's name, its mark after a post's title (an icon, else the name; `svg` is drawn in the chip only), and
|
|
26
|
+
// whether it is left out of All. A tag not listed here is shown, with its own word as its name.
|
|
16
27
|
const TAGS = {
|
|
28
|
+
slides: { name: 'Slides', svg: SLIDES_ICON, computed: true },
|
|
17
29
|
wip: { name: 'Work in progress', icon: '🚧' },
|
|
18
30
|
archived: { name: 'Archived', hidden: true },
|
|
19
31
|
}
|
|
20
32
|
const tag = (id) => TAGS[id] ?? { name: id }
|
|
33
|
+
const SORTS = [['newest', 'Newest'], ['updated', 'Recently updated'], ['oldest', 'Oldest']]
|
|
21
34
|
|
|
22
35
|
// Each post is read as text, for its front matter only. Importing it would compile the post and every figure it uses,
|
|
23
36
|
// so one post that does not compile (an agent in the middle of an edit) would take this page down with it.
|
|
24
37
|
const posts = Object.entries(import.meta.glob(['/src/pages/posts/*/index.mdx', '!/src/pages/posts/_*/index.mdx'], { query: '?raw', import: 'default', eager: true }))
|
|
25
|
-
.map(([path, text]) => ({ ...parseFrontmatter(text).frontmatter, url: import.meta.env.BASE_URL + path.slice('/src/pages/'.length, -'index.mdx'.length) }))
|
|
26
|
-
.map((post) => ({ ...post,
|
|
38
|
+
.map(([path, text]) => ({ ...parseFrontmatter(text).frontmatter, path, url: import.meta.env.BASE_URL + path.slice('/src/pages/'.length, -'index.mdx'.length) }))
|
|
39
|
+
.map((post) => ({ ...post, deck: post.slides !== false && existsSync(join(process.cwd(), post.path.slice(1, -'index.mdx'.length), 'slides.mdx')) }))
|
|
40
|
+
.map((post) => ({ ...post, tags: [...(post.deck ? ['slides'] : []), ...[post.tags ?? []].flat().map(String).filter((id) => !tag(id).computed)] }))
|
|
27
41
|
.sort((a, b) => new Date(b.date) - new Date(a.date))
|
|
28
42
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
43
|
+
const hidden = (post) => post.tags.some((id) => tag(id).hidden)
|
|
44
|
+
// The posts a chip shows (the chip of `id`, or All for null), as the script below also decides.
|
|
45
|
+
const shows = (post, id) => (id ? post.tags.includes(id) && (tag(id).hidden || !hidden(post)) : !hidden(post))
|
|
46
|
+
// The tags in use, those of TAGS first and in its order, each with the number of posts its chip shows.
|
|
47
|
+
const chips = [...new Set([...Object.keys(TAGS), ...posts.flatMap((post) => post.tags)])]
|
|
48
|
+
.map((id) => ({ id, ...tag(id), count: posts.filter((post) => shows(post, id)).length }))
|
|
32
49
|
.filter((t) => t.count)
|
|
33
|
-
const hiddenAtFirst = (post) => post.tags.some((id) => tag(id).hidden)
|
|
34
50
|
const wasEdited = (post) => post.edited && isoDate(post.edited) > isoDate(post.date)
|
|
35
51
|
---
|
|
36
52
|
<Base title={site.title}>
|
|
37
53
|
<main class="wrap">
|
|
38
54
|
<h1>{site.title}</h1>
|
|
39
55
|
<p class="lede">{site.lede}</p>
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
<label>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
<div class="post-controls">
|
|
57
|
+
<fieldset class="post-filter" data-hidden={Object.keys(TAGS).filter((id) => TAGS[id].hidden).join(' ')}>
|
|
58
|
+
<legend>Tags</legend>
|
|
59
|
+
<label class="chip"><input type="radio" name="tag" value="" checked /> All <span class="count">{posts.filter((post) => shows(post, null)).length}</span></label>
|
|
60
|
+
{chips.map((t) => (
|
|
61
|
+
<label class="chip">
|
|
62
|
+
<input type="radio" name="tag" value={t.id} />
|
|
63
|
+
{t.svg ? <Fragment set:html={t.svg} /> : t.icon && <span aria-hidden="true">{t.icon}</span>} {t.name} <span class="count">{t.count}</span>
|
|
64
|
+
</label>
|
|
65
|
+
))}
|
|
66
|
+
</fieldset>
|
|
67
|
+
<label class="post-sort">
|
|
68
|
+
Sort
|
|
69
|
+
<select name="sort">
|
|
70
|
+
{SORTS.map(([value, name]) => <option value={value}>{name}</option>)}
|
|
71
|
+
</select>
|
|
50
72
|
</label>
|
|
51
|
-
</
|
|
52
|
-
<ol class="post-list"
|
|
73
|
+
</div>
|
|
74
|
+
<ol class="post-list">
|
|
53
75
|
{posts.map((post, n) => (
|
|
54
|
-
<li data-order={n} data-tags={post.tags.join(' ')} data-date={isoDate(post.date)} data-edited={isoDate(post.edited ?? post.date)} hidden={
|
|
76
|
+
<li data-order={n} data-tags={post.tags.join(' ')} data-date={isoDate(post.date)} data-edited={isoDate(post.edited ?? post.date)} hidden={!shows(post, null)}>
|
|
55
77
|
<time datetime={isoDate(post.date)}>{longDate(post.date)}</time>
|
|
56
|
-
{wasEdited(post) && <span class="post-edited"
|
|
78
|
+
{wasEdited(post) && <span class="post-edited"> · updated <time datetime={isoDate(post.edited)}>{longDate(post.edited)}</time></span>}
|
|
57
79
|
<h2>
|
|
80
|
+
{post.deck && (
|
|
81
|
+
<a class="post-deck" href={`${post.url}slides/`} title="Slides" aria-label={`Slides: ${post.title}`}>
|
|
82
|
+
<Fragment set:html={SLIDES_ICON} />
|
|
83
|
+
</a>
|
|
84
|
+
)}
|
|
58
85
|
<a href={post.url}>{post.title}</a>
|
|
59
|
-
{post.tags.map((id) => tag(id).icon
|
|
86
|
+
{post.tags.filter((id) => !tag(id).computed).map((id) => tag(id).icon
|
|
60
87
|
? <span class="post-icon" title={tag(id).name} role="img" aria-label={tag(id).name}>{tag(id).icon}</span>
|
|
61
88
|
: <span class="post-tag">{tag(id).name}</span>)}
|
|
62
89
|
</h2>
|
|
@@ -68,22 +95,47 @@ const wasEdited = (post) => post.edited && isoDate(post.edited) > isoDate(post.d
|
|
|
68
95
|
</Base>
|
|
69
96
|
|
|
70
97
|
<script>
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
// edit date, in publication order, so the page is right before this runs; the browser may restore a checkbox on Back,
|
|
74
|
-
// so this also runs once at load.
|
|
98
|
+
// The chip and the sort, from the URL and back into it (replaceState: no history entry per click). The first render
|
|
99
|
+
// is All and Newest, so the page is right before this runs.
|
|
75
100
|
const filter = document.querySelector('.post-filter')
|
|
101
|
+
const sort = document.querySelector('.post-sort select')
|
|
76
102
|
const list = document.querySelector('.post-list')
|
|
103
|
+
const hiddenTags = new Set(filter.dataset.hidden.split(' ').filter(Boolean))
|
|
104
|
+
const chip = () => filter.querySelector('input[name="tag"]:checked')?.value ?? ''
|
|
105
|
+
|
|
77
106
|
const update = () => {
|
|
78
|
-
const
|
|
107
|
+
const id = chip()
|
|
79
108
|
for (const li of list.children) {
|
|
80
|
-
|
|
109
|
+
const tags = li.dataset.tags.split(' ')
|
|
110
|
+
const isHidden = tags.some((t) => hiddenTags.has(t))
|
|
111
|
+
li.hidden = id ? !tags.includes(id) || (isHidden && !hiddenTags.has(id)) : isHidden
|
|
81
112
|
}
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
113
|
+
const key = { newest: (li) => li.dataset.date, updated: (li) => li.dataset.edited + li.dataset.date, oldest: (li) => li.dataset.date }[sort.value]
|
|
114
|
+
const sign = sort.value === 'oldest' ? -1 : 1
|
|
115
|
+
list.append(...[...list.children].sort((a, b) => sign * key(b).localeCompare(key(a)) || a.dataset.order - b.dataset.order))
|
|
116
|
+
const params = new URLSearchParams(location.search)
|
|
117
|
+
id ? params.set('tag', id) : params.delete('tag')
|
|
118
|
+
sort.value !== 'newest' ? params.set('sort', sort.value) : params.delete('sort')
|
|
119
|
+
const query = params.toString()
|
|
120
|
+
history.replaceState(history.state, '', `${location.pathname}${query ? `?${query}` : ''}${location.hash}`)
|
|
86
121
|
}
|
|
122
|
+
|
|
123
|
+
// A click on the chosen chip goes back to All.
|
|
124
|
+
let before = ''
|
|
125
|
+
filter.addEventListener('pointerdown', () => { before = chip() })
|
|
126
|
+
filter.addEventListener('keydown', () => { before = chip() })
|
|
127
|
+
filter.addEventListener('click', (event) => {
|
|
128
|
+
const input = event.target instanceof HTMLInputElement ? event.target : null
|
|
129
|
+
if (input?.value && input.value === before) filter.querySelector('input[value=""]').checked = true
|
|
130
|
+
before = chip()
|
|
131
|
+
update()
|
|
132
|
+
})
|
|
87
133
|
filter.addEventListener('change', update)
|
|
134
|
+
sort.addEventListener('change', update)
|
|
135
|
+
|
|
136
|
+
const params = new URLSearchParams(location.search)
|
|
137
|
+
const chosen = filter.querySelector(`input[name="tag"][value="${CSS.escape(params.get('tag') ?? '')}"]`)
|
|
138
|
+
if (chosen) chosen.checked = true
|
|
139
|
+
if ([...sort.options].some((o) => o.value === params.get('sort'))) sort.value = params.get('sort')
|
|
88
140
|
update()
|
|
89
141
|
</script>
|
package/scripts/export/agent.js
CHANGED
|
@@ -57,10 +57,10 @@ function keptText(island) {
|
|
|
57
57
|
const box = (html) => raw(`<div class="fig-text">${html}</div>`)
|
|
58
58
|
|
|
59
59
|
// `out` is the build's output directory; `site` the site's URL, for links back to it (see siteLinks).
|
|
60
|
-
export async function agentPage(html, { references, out = dist, site, base }) {
|
|
60
|
+
export async function agentPage(html, { references, out = dist, site, base, pageUrl }) {
|
|
61
61
|
const figures = await describers()
|
|
62
62
|
const tree = fromHtml(html)
|
|
63
|
-
siteLinks(tree, { site, base })
|
|
63
|
+
siteLinks(tree, { site, base, pageUrl })
|
|
64
64
|
const meta = (name) => {
|
|
65
65
|
let content = ''
|
|
66
66
|
visit(tree, 'element', (node) => { if (node.tagName === 'meta' && node.properties.name === name) content = node.properties.content })
|
package/scripts/export/common.js
CHANGED
|
@@ -46,9 +46,10 @@ export const hasClass = (node, name) => (node.properties?.className || []).inclu
|
|
|
46
46
|
|
|
47
47
|
// Links back to the site: each root-relative link (the blog index, the Slides link) becomes a link to
|
|
48
48
|
// the deployed site, src/site.js `url`, so it works from a downloaded file when the reader is online.
|
|
49
|
-
// `base` is the base path the page was built with (BASE_PATH, as in astro.config.mjs).
|
|
50
|
-
//
|
|
51
|
-
|
|
49
|
+
// `base` is the base path the page was built with (BASE_PATH, as in astro.config.mjs). `pageUrl`, the page's own
|
|
50
|
+
// URL path under the base ('posts/<path>/'), makes a relative link (`../other-post/`, `./subpage/`) one to the
|
|
51
|
+
// deployed site too; without it, relative links stay as they are. The download control is removed.
|
|
52
|
+
export function siteLinks(tree, { site = siteUrl, base = process.env.BASE_PATH || '/', pageUrl = null } = {}) {
|
|
52
53
|
visit(tree, 'element', (node, index, parent) => {
|
|
53
54
|
if (node.properties?.dataDownload !== undefined) {
|
|
54
55
|
parent.children.splice(index, 1)
|
|
@@ -56,7 +57,12 @@ export function siteLinks(tree, { site = siteUrl, base = process.env.BASE_PATH |
|
|
|
56
57
|
}
|
|
57
58
|
const href = node.tagName === 'a' ? node.properties.href : null
|
|
58
59
|
// Built assets stay relative: each download inlines them (distAsset).
|
|
59
|
-
if (typeof href !== 'string' ||
|
|
60
|
+
if (typeof href !== 'string' || href.startsWith('//') || distAsset(href)) return
|
|
61
|
+
if (pageUrl && !href.startsWith('/') && !href.startsWith('#') && !/^[a-z][a-z0-9+.-]*:/i.test(href)) {
|
|
62
|
+
node.properties.href = new URL(href, new URL(pageUrl, site)).href
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
if (!href.startsWith(base)) return
|
|
60
66
|
node.properties.href = new URL(href.slice(base.length), site).href
|
|
61
67
|
})
|
|
62
68
|
// The byline separators (" / ") left without anything after them.
|
package/scripts/export/dev.js
CHANGED
|
@@ -26,19 +26,21 @@ export default function postDownloads() {
|
|
|
26
26
|
const base = process.env.BASE_PATH || '/'
|
|
27
27
|
const root = server.config.root
|
|
28
28
|
const out = join(root, 'node_modules/.cache/post-downloads')
|
|
29
|
-
|
|
29
|
+
// A page's downloads sit beside it, at any depth under posts/ (lib/pages.js), named after its last part.
|
|
30
|
+
const pattern = new RegExp(`^${base.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}posts/(.+)/([^/]+)\\.html$`)
|
|
30
31
|
server.middlewares.use(async (req, res, next) => {
|
|
31
32
|
const match = decodeURIComponent((req.url || '').split('?')[0]).match(pattern)
|
|
32
|
-
const [,
|
|
33
|
-
|
|
33
|
+
const [, path, name] = match ?? []
|
|
34
|
+
const last = path?.split('/').at(-1)
|
|
35
|
+
if (!match || (name !== last && name !== `${last}-agent`)) return next()
|
|
34
36
|
try {
|
|
35
37
|
logger.info(`building the ${name}.html download`)
|
|
36
38
|
await scratchBuild(root, out)
|
|
37
39
|
const { exportPost } = await import('./index.js')
|
|
38
|
-
const files = await exportPost({ out,
|
|
40
|
+
const files = await exportPost({ out, path, base })
|
|
39
41
|
res.setHeader('Content-Type', 'text/html; charset=utf-8')
|
|
40
42
|
res.setHeader('Content-Disposition', `attachment; filename="${name}.html"`)
|
|
41
|
-
res.end(name ===
|
|
43
|
+
res.end(name === last ? files.page : files.agent)
|
|
42
44
|
} catch (error) {
|
|
43
45
|
logger.error(String(error.stack || error))
|
|
44
46
|
res.statusCode = 500
|
package/scripts/export/index.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
// Both downloads of one built
|
|
2
|
-
// a scratch directory under the dev server); `
|
|
1
|
+
// Both downloads of one built page. `out` is the build's output directory (dist/ after `npm run build`,
|
|
2
|
+
// a scratch directory under the dev server); `path` is the page's path under posts/ in it (lib/pages.js): a post's
|
|
3
|
+
// slug, or a subpage's '<slug>/<name>'. `slug`, the older name for it, still works.
|
|
3
4
|
import { existsSync, readFileSync } from 'node:fs'
|
|
4
5
|
import { join } from 'node:path'
|
|
5
6
|
import { root } from './common.js'
|
|
6
7
|
import { interactivePage } from './page.js'
|
|
7
8
|
import { agentPage } from './agent.js'
|
|
8
9
|
|
|
9
|
-
export async function exportPost({ out, slug, site, base }) {
|
|
10
|
-
|
|
10
|
+
export async function exportPost({ out, path, slug, site, base }) {
|
|
11
|
+
path ??= slug
|
|
12
|
+
const html = readFileSync(join(out, 'posts', path, 'index.html'), 'utf8')
|
|
11
13
|
const references = JSON.parse(readFileSync(join(root, 'src/references.json'), 'utf8'))
|
|
12
|
-
// The
|
|
13
|
-
const
|
|
14
|
-
|
|
14
|
+
// The page's own URL path, against which its relative links resolve (siteLinks).
|
|
15
|
+
const pageUrl = `posts/${path}/`
|
|
16
|
+
// The deck, when the page has one, travels inside the interactive page.
|
|
17
|
+
const deckFile = join(out, 'posts', path, 'slides', 'index.html')
|
|
18
|
+
const deck = existsSync(deckFile) ? await interactivePage(readFileSync(deckFile, 'utf8'), { out, site, base, pageUrl: `${pageUrl}slides/`, inFrame: true }) : null
|
|
15
19
|
return {
|
|
16
|
-
page: await interactivePage(html, { out, site, base, deck }),
|
|
17
|
-
agent: await agentPage(html, { references, out, site, base }),
|
|
20
|
+
page: await interactivePage(html, { out, site, base, pageUrl, deck }),
|
|
21
|
+
agent: await agentPage(html, { references, out, site, base, pageUrl }),
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
export
|
|
25
|
+
export { downloadNames } from '../../lib/pages.js'
|
package/scripts/export/page.js
CHANGED
|
@@ -112,12 +112,13 @@ const DECK_IN_FRAME = `(() => {
|
|
|
112
112
|
}, true)
|
|
113
113
|
})()`
|
|
114
114
|
|
|
115
|
-
// `out` is the build's output directory; `site` the site's URL, for links back to it
|
|
115
|
+
// `out` is the build's output directory; `site` the site's URL, for links back to it, and `pageUrl` the page's URL path
|
|
116
|
+
// under the base, against which its relative links resolve (see siteLinks).
|
|
116
117
|
// `deck` is the post's deck, already exported with `inFrame: true`, to carry inside this page.
|
|
117
|
-
export async function interactivePage(html, { out = defaultDist, site, base, deck, inFrame = false } = {}) {
|
|
118
|
+
export async function interactivePage(html, { out = defaultDist, site, base, pageUrl, deck, inFrame = false } = {}) {
|
|
118
119
|
const asset = (url) => distAsset(url, out)
|
|
119
120
|
const tree = fromHtml(html)
|
|
120
|
-
siteLinks(tree, { site, base })
|
|
121
|
+
siteLinks(tree, { site, base, pageUrl })
|
|
121
122
|
const modules = new Map() // file in dist -> key in the bundle's module table
|
|
122
123
|
const sideEffects = [] // module scripts the page runs for their effects
|
|
123
124
|
const element = (tagName, properties, value) => ({ type: 'element', tagName, properties, children: [{ type: 'text', value }] })
|
package/scripts/export-posts.js
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
// Run after `astro build` (part of `npm run build`): writes the two downloads that the byline's download
|
|
2
|
-
// control links to, beside each built
|
|
3
|
-
//
|
|
4
|
-
// <
|
|
2
|
+
// control links to, beside each built page under dist/posts/ that offers them (lib/pages.js: every post, and a
|
|
3
|
+
// subpage whose front matter sets `downloads: true`):
|
|
4
|
+
// <name>.html the interactive page, one file that opens from disk with working figures
|
|
5
|
+
// <name>-agent.html a text export for language models (bloggie/scripts/export/agent.js)
|
|
6
|
+
// <name> is the last part of the page's path: the post's slug, or the subpage's name.
|
|
7
|
+
// Each export inlines the page's scripts, styles, fonts and data into one file and bundles its figures, which takes
|
|
8
|
+
// time and space for every page; so a page without the control gets none.
|
|
5
9
|
// Under `npm run dev`, bloggie/scripts/export/dev.js builds them on request instead.
|
|
6
|
-
import { existsSync, readdirSync, writeFileSync } from 'node:fs'
|
|
10
|
+
import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
7
11
|
import { join } from 'node:path'
|
|
8
12
|
import { dist } from './export/common.js'
|
|
9
13
|
import { downloadNames, exportPost } from './export/index.js'
|
|
10
14
|
|
|
11
15
|
const kb = (text) => `${Math.round(Buffer.byteLength(text) / 1024)} KB`
|
|
16
|
+
// The byline's download control (layouts/Post.astro); a deck's page and a page that turns downloads off have none.
|
|
17
|
+
const OFFERS = /<[^>]*\sdata-download[\s>=]/
|
|
18
|
+
|
|
19
|
+
// The built pages under dist/posts/, by their paths there ('<slug>', '<slug>/<name>', ...).
|
|
20
|
+
function pages(dir, path = '') {
|
|
21
|
+
const found = path && existsSync(join(dir, 'index.html')) ? [path] : []
|
|
22
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
23
|
+
if (entry.isDirectory()) found.push(...pages(join(dir, entry.name), path ? `${path}/${entry.name}` : entry.name))
|
|
24
|
+
}
|
|
25
|
+
return found
|
|
26
|
+
}
|
|
12
27
|
|
|
13
28
|
// A blog with no visible post (e.g. a new blog with the example hidden) has no dist/posts.
|
|
14
|
-
const built = existsSync(join(dist, 'posts')) ?
|
|
15
|
-
for (const
|
|
16
|
-
if (!
|
|
17
|
-
const files = await exportPost({ out: dist,
|
|
18
|
-
const names = downloadNames(
|
|
19
|
-
for (const kind of ['page', 'agent']) writeFileSync(join(dist, 'posts',
|
|
20
|
-
console.log(`export-posts: ${names.page} (${kb(files.page)}), ${names.agent} (${kb(files.agent)})`)
|
|
29
|
+
const built = existsSync(join(dist, 'posts')) ? pages(join(dist, 'posts')) : []
|
|
30
|
+
for (const path of built) {
|
|
31
|
+
if (!OFFERS.test(readFileSync(join(dist, 'posts', path, 'index.html'), 'utf8'))) continue
|
|
32
|
+
const files = await exportPost({ out: dist, path })
|
|
33
|
+
const names = downloadNames(path)
|
|
34
|
+
for (const kind of ['page', 'agent']) writeFileSync(join(dist, 'posts', path, names[kind]), files[kind])
|
|
35
|
+
console.log(`export-posts: ${path}/${names.page} (${kb(files.page)}), ${names.agent} (${kb(files.agent)})`)
|
|
21
36
|
}
|
|
@@ -123,7 +123,8 @@ its figure components the same way: the deck must run the post's real interactiv
|
|
|
123
123
|
|
|
124
124
|
- A deck is `slides.mdx` beside the post's `index.mdx` (`src/pages/posts/<slug>/slides.mdx`), with
|
|
125
125
|
`layout: '@bloggie/layouts/Slides.astro'` in its front matter; Astro serves it at
|
|
126
|
-
`/posts/<slug>/slides/`.
|
|
126
|
+
`/posts/<slug>/slides/`. A subpage has a deck only as a folder with its own `index.mdx`
|
|
127
|
+
(`posts/<slug>/<name>/slides.mdx`); a file subpage (`<name>.mdx`) shares its post's. The pairing is automatic: when `slides.mdx` exists, the post's byline
|
|
127
128
|
links to the deck and S on the post opens it; Esc (or ✕) on the deck returns to the post, with
|
|
128
129
|
its scroll position when the reader came from it. A post without a deck has neither, and
|
|
129
130
|
`slides: false` in a post's front matter hides a deck that exists. `bloggie/lib/slides.js` is the
|
package/styles/site.css
CHANGED
|
@@ -782,6 +782,43 @@ blockquote {
|
|
|
782
782
|
font-size: 0.97rem;
|
|
783
783
|
}
|
|
784
784
|
|
|
785
|
+
/* Left of a post's title, the slides icon, a link to its deck (index.astro). It hangs in the margin, so every title
|
|
786
|
+
starts on the same line; on a phone it sits before the title. */
|
|
787
|
+
.post-list h2 {
|
|
788
|
+
position: relative;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
.post-deck {
|
|
792
|
+
position: absolute;
|
|
793
|
+
left: -1.45rem;
|
|
794
|
+
top: 0.15em;
|
|
795
|
+
display: inline-flex;
|
|
796
|
+
color: var(--text-muted);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
.post-deck:hover,
|
|
800
|
+
.post-deck:focus-visible {
|
|
801
|
+
color: var(--series-1);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
.post-deck svg {
|
|
805
|
+
width: 1.05rem;
|
|
806
|
+
height: 1.05rem;
|
|
807
|
+
fill: none;
|
|
808
|
+
stroke: currentColor;
|
|
809
|
+
stroke-width: 1.3;
|
|
810
|
+
stroke-linecap: round;
|
|
811
|
+
stroke-linejoin: round;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
@media (max-width: 520px) {
|
|
815
|
+
.post-deck {
|
|
816
|
+
position: static;
|
|
817
|
+
margin-right: 0.4rem;
|
|
818
|
+
vertical-align: -0.12em;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
785
822
|
/* After a post's title, each of its tags (index.astro): an icon, else its name in small capitals. */
|
|
786
823
|
.post-icon {
|
|
787
824
|
margin-left: 0.4rem;
|
|
@@ -802,33 +839,102 @@ blockquote {
|
|
|
802
839
|
vertical-align: 0.15em;
|
|
803
840
|
}
|
|
804
841
|
|
|
805
|
-
/* Above the list
|
|
806
|
-
.post-
|
|
842
|
+
/* Above the list (index.astro): a chip per tag, one chosen at a time, and the sort menu at the end of the row. */
|
|
843
|
+
.post-controls {
|
|
844
|
+
display: flex;
|
|
845
|
+
flex-wrap: wrap;
|
|
846
|
+
align-items: center;
|
|
847
|
+
gap: 0.6rem 1.2rem;
|
|
807
848
|
margin: 1.5rem 0 0;
|
|
808
|
-
|
|
809
|
-
border: 0;
|
|
849
|
+
max-width: var(--content-width);
|
|
810
850
|
font-family: var(--sans);
|
|
811
851
|
font-size: 0.82rem;
|
|
812
852
|
color: var(--text-secondary);
|
|
813
853
|
}
|
|
814
854
|
|
|
815
|
-
.post-filter
|
|
816
|
-
|
|
855
|
+
.post-filter {
|
|
856
|
+
display: flex;
|
|
857
|
+
flex-wrap: wrap;
|
|
858
|
+
gap: 0.4rem;
|
|
859
|
+
margin: 0;
|
|
817
860
|
padding: 0;
|
|
818
|
-
|
|
819
|
-
|
|
861
|
+
border: 0;
|
|
862
|
+
min-width: 0;
|
|
820
863
|
}
|
|
821
864
|
|
|
822
|
-
.post-filter
|
|
865
|
+
.post-filter legend {
|
|
866
|
+
position: absolute;
|
|
867
|
+
width: 1px;
|
|
868
|
+
height: 1px;
|
|
869
|
+
overflow: hidden;
|
|
870
|
+
clip-path: inset(50%);
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
.post-filter .chip {
|
|
874
|
+
position: relative;
|
|
823
875
|
display: inline-flex;
|
|
824
876
|
align-items: center;
|
|
825
|
-
gap: 0.
|
|
826
|
-
|
|
877
|
+
gap: 0.35rem;
|
|
878
|
+
padding: 0.22rem 0.65rem;
|
|
879
|
+
border: 1px solid var(--rule);
|
|
880
|
+
border-radius: 999px;
|
|
881
|
+
cursor: pointer;
|
|
882
|
+
user-select: none;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
.post-filter .chip:hover {
|
|
886
|
+
border-color: var(--axis);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
.post-filter .chip input {
|
|
890
|
+
position: absolute;
|
|
891
|
+
inset: 0;
|
|
892
|
+
margin: 0;
|
|
893
|
+
opacity: 0;
|
|
827
894
|
cursor: pointer;
|
|
828
895
|
}
|
|
829
896
|
|
|
897
|
+
.post-filter .chip:has(input:checked) {
|
|
898
|
+
border-color: var(--series-1);
|
|
899
|
+
background: color-mix(in srgb, var(--series-1) 12%, transparent);
|
|
900
|
+
color: var(--text-primary);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
.post-filter .chip:has(input:focus-visible) {
|
|
904
|
+
outline: 2px solid var(--series-1);
|
|
905
|
+
outline-offset: 2px;
|
|
906
|
+
}
|
|
907
|
+
|
|
830
908
|
.post-filter .count {
|
|
831
909
|
color: var(--text-muted);
|
|
910
|
+
font-variant-numeric: tabular-nums;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
.post-filter .slides-icon {
|
|
914
|
+
width: 1rem;
|
|
915
|
+
height: 1rem;
|
|
916
|
+
fill: none;
|
|
917
|
+
stroke: currentColor;
|
|
918
|
+
stroke-width: 1.3;
|
|
919
|
+
stroke-linecap: round;
|
|
920
|
+
stroke-linejoin: round;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
.post-sort {
|
|
924
|
+
display: inline-flex;
|
|
925
|
+
align-items: center;
|
|
926
|
+
gap: 0.4rem;
|
|
927
|
+
margin-left: auto;
|
|
928
|
+
color: var(--text-muted);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
.post-sort select {
|
|
932
|
+
padding: 0.2rem 0.4rem;
|
|
933
|
+
border: 1px solid var(--rule);
|
|
934
|
+
border-radius: 5px;
|
|
935
|
+
background: var(--page);
|
|
936
|
+
color: var(--text-primary);
|
|
937
|
+
font: inherit;
|
|
832
938
|
}
|
|
833
939
|
|
|
834
940
|
/* --- figures ------------------------------------------------------------- */
|