@opentf/afw-docs 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +165 -0
- package/build/blog-posts-plugin.js +35 -18
- package/build/docs-nav-plugin.js +29 -16
- package/build/feed.js +31 -2
- package/build/finish.js +164 -0
- package/build/host.js +39 -21
- package/build/hosts/esdev.js +35 -0
- package/build/hosts/node.js +50 -0
- package/build/index.js +13 -2
- package/build/last-updated-plugin.js +33 -19
- package/build/last-updated.js +1 -3
- package/build/llms.js +3 -3
- package/build/publish.js +29 -0
- package/build/search.js +4 -12
- package/build/vite.js +137 -0
- package/components/BlogLayout.jsx +24 -10
- package/components/FeedLinks.jsx +47 -0
- package/components/LastUpdated.jsx +4 -6
- package/components/Navbar.jsx +1 -1
- package/components/PostBanner.jsx +2 -2
- package/components/PostCard.jsx +10 -5
- package/components/PostList.jsx +11 -3
- package/components/PostMeta.jsx +11 -2
- package/components/Toc.jsx +44 -17
- package/index.js +2 -0
- package/package.json +19 -9
- package/theme/index.css +97 -3
- package/types/config.d.ts +2 -0
- package/types/index.d.ts +4 -0
- package/types/vite.d.ts +19 -0
|
@@ -8,15 +8,13 @@
|
|
|
8
8
|
import { formatDate } from "./format.js";
|
|
9
9
|
|
|
10
10
|
export default function LastUpdated(props) {
|
|
11
|
-
const date = props.date;
|
|
12
|
-
if (!date) return null;
|
|
13
11
|
const label = props.label || "Last updated on";
|
|
14
|
-
return (
|
|
12
|
+
return props.date ? (
|
|
15
13
|
<div class="afwd-last-updated">
|
|
16
14
|
{label}{" "}
|
|
17
|
-
<time class="afwd-last-updated-time" datetime={String(date)}>
|
|
18
|
-
{formatDate(date)}
|
|
15
|
+
<time class="afwd-last-updated-time" datetime={String(props.date)}>
|
|
16
|
+
{formatDate(props.date)}
|
|
19
17
|
</time>
|
|
20
18
|
</div>
|
|
21
|
-
);
|
|
19
|
+
) : null;
|
|
22
20
|
}
|
package/components/Navbar.jsx
CHANGED
|
@@ -32,7 +32,7 @@ export default function Navbar(props) {
|
|
|
32
32
|
<div class="afwd-navbar-lead">
|
|
33
33
|
<SidebarToggle />
|
|
34
34
|
<Link href={config.homeUrl || "/"} class="afwd-navbar-brand">
|
|
35
|
-
{config.logo ? <img src={config.logo} alt="" class="afwd-navbar-logo" /> : null}
|
|
35
|
+
{config.logo ? <img src={config.logo} alt="" class="afwd-navbar-logo" width="28" height="28" /> : null}
|
|
36
36
|
<span class="afwd-navbar-title">{config.title || "Docs"}</span>
|
|
37
37
|
{config.version ? <span class="afwd-navbar-version">{config.version}</span> : null}
|
|
38
38
|
</Link>
|
|
@@ -8,11 +8,11 @@ export default function PostBanner(props) {
|
|
|
8
8
|
return (
|
|
9
9
|
<header class="afwd-post-banner">
|
|
10
10
|
{post.cover ? (
|
|
11
|
-
<img class="afwd-post-cover" src={post.cover} alt=
|
|
11
|
+
<img class="afwd-post-cover" src={post.cover} alt="" />
|
|
12
12
|
) : null}
|
|
13
13
|
<h1 class="afwd-post-title">{post.title}</h1>
|
|
14
14
|
{post.description ? <p class="afwd-post-desc">{post.description}</p> : null}
|
|
15
|
-
<PostMeta post={post} />
|
|
15
|
+
<PostMeta post={post} showUpdated={props.showUpdated} />
|
|
16
16
|
{post.tags && post.tags.length ? (
|
|
17
17
|
<div class="afwd-post-tags">
|
|
18
18
|
{post.tags.map((tag) => (
|
package/components/PostCard.jsx
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
// One post in the blog index: a link to the post with its meta
|
|
1
|
+
// One post in the blog index: a link to the post with its title, excerpt and meta row. `featured` renders it as the index hero.
|
|
2
2
|
import { Link } from "@opentf/afw";
|
|
3
3
|
import PostMeta from "./PostMeta.jsx";
|
|
4
4
|
|
|
5
5
|
export default function PostCard(props) {
|
|
6
6
|
const post = props.post;
|
|
7
7
|
return (
|
|
8
|
-
<Link
|
|
8
|
+
<Link
|
|
9
|
+
href={post.path}
|
|
10
|
+
class={"afwd-post-card" + (post.cover ? " afwd-has-cover" : "") + (props.featured ? " afwd-post-card-featured" : "")}
|
|
11
|
+
>
|
|
9
12
|
{post.cover ? (
|
|
10
|
-
|
|
13
|
+
// Decorative here: the title below already names the link, so a screen reader
|
|
14
|
+
// would otherwise read it twice.
|
|
15
|
+
<img class="afwd-post-card-cover" src={post.cover} alt="" loading={props.featured ? "eager" : "lazy"} />
|
|
11
16
|
) : null}
|
|
12
17
|
<div class="afwd-post-card-body">
|
|
13
|
-
<
|
|
14
|
-
<div class="afwd-post-card-title">{post.title}</div>
|
|
18
|
+
<h2 class="afwd-post-card-title">{post.title}</h2>
|
|
15
19
|
{post.description ? <p class="afwd-post-card-desc">{post.description}</p> : null}
|
|
20
|
+
<PostMeta post={post} />
|
|
16
21
|
</div>
|
|
17
22
|
</Link>
|
|
18
23
|
);
|
package/components/PostList.jsx
CHANGED
|
@@ -5,13 +5,21 @@
|
|
|
5
5
|
// <PostList posts={posts} />
|
|
6
6
|
import PostCard from "./PostCard.jsx";
|
|
7
7
|
|
|
8
|
+
// The newest post leads as a full-width hero card and the rest follow as compact rows.
|
|
9
|
+
// `featured={false}` lists every post the same way.
|
|
8
10
|
export default function PostList(props) {
|
|
9
11
|
const posts = props.posts || [];
|
|
12
|
+
const featured = props.featured !== false && posts.length > 0;
|
|
13
|
+
const rest = featured ? posts.slice(1) : posts;
|
|
10
14
|
return (
|
|
11
15
|
<div class="afwd-post-list">
|
|
12
|
-
{posts.length
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
{posts.length ? null : <p class="afwd-post-empty">No posts yet.</p>}
|
|
17
|
+
{featured ? <PostCard post={posts[0]} featured /> : null}
|
|
18
|
+
{rest.length ? (
|
|
19
|
+
<div class="afwd-post-rows">
|
|
20
|
+
{rest.map((post) => <PostCard post={post} />)}
|
|
21
|
+
</div>
|
|
22
|
+
) : null}
|
|
15
23
|
</div>
|
|
16
24
|
);
|
|
17
25
|
}
|
package/components/PostMeta.jsx
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// A post's metadata row: date · author · reading time. Pass a post record (from
|
|
2
2
|
// `@opentf/afw-docs/posts`) as `post`, or the fields directly. Missing fields are
|
|
3
|
-
// omitted. Used in both the post banner and the index cards.
|
|
3
|
+
// omitted. Used in both the post banner and the index cards. `showUpdated` (the banner)
|
|
4
|
+
// adds the frontmatter `updated` date when it is a later day than `date`. A draft or
|
|
5
|
+
// scheduled post, listed only by the dev server, is marked as such.
|
|
4
6
|
import ReadingTime from "./ReadingTime.jsx";
|
|
5
7
|
import { formatDate } from "./format.js";
|
|
8
|
+
import { editedAfterPublish } from "./post-dates.js";
|
|
6
9
|
|
|
7
10
|
export default function PostMeta(props) {
|
|
8
11
|
const post = props.post || props;
|
|
@@ -11,7 +14,7 @@ export default function PostMeta(props) {
|
|
|
11
14
|
{post.author ? (
|
|
12
15
|
<span class="afwd-post-author">
|
|
13
16
|
{post.authorAvatar ? (
|
|
14
|
-
<img class="afwd-post-avatar" src={post.authorAvatar} alt=
|
|
17
|
+
<img class="afwd-post-avatar" src={post.authorAvatar} alt="" loading="lazy" />
|
|
15
18
|
) : null}
|
|
16
19
|
<span class="afwd-post-author-name">{post.author}</span>
|
|
17
20
|
{post.authorRole ? <span class="afwd-post-author-role">{post.authorRole}</span> : null}
|
|
@@ -22,7 +25,13 @@ export default function PostMeta(props) {
|
|
|
22
25
|
{formatDate(post.date)}
|
|
23
26
|
</time>
|
|
24
27
|
) : null}
|
|
28
|
+
{props.showUpdated && editedAfterPublish(post.updated, post.date) ? (
|
|
29
|
+
<span class="afwd-post-updated">
|
|
30
|
+
Updated <time datetime={String(post.updated)}>{formatDate(post.updated)}</time>
|
|
31
|
+
</span>
|
|
32
|
+
) : null}
|
|
25
33
|
{post.readingTime ? <ReadingTime minutes={post.readingTime} /> : null}
|
|
34
|
+
{post.draft ? <span class="afwd-post-draft">Draft</span> : null}
|
|
26
35
|
</div>
|
|
27
36
|
);
|
|
28
37
|
}
|
package/components/Toc.jsx
CHANGED
|
@@ -1,28 +1,53 @@
|
|
|
1
|
-
// "On this page" table of contents
|
|
2
|
-
//
|
|
3
|
-
// IntersectionObserver. Rebuilds on route change.
|
|
1
|
+
// "On this page" table of contents, with scroll-spy highlighting via IntersectionObserver.
|
|
2
|
+
// Rebuilds on route change.
|
|
4
3
|
//
|
|
5
|
-
// The
|
|
6
|
-
//
|
|
7
|
-
//
|
|
4
|
+
// The outline comes from the page's `toc` export (`router.toc`, emitted by the MDX
|
|
5
|
+
// front-end), so it is in the served HTML and adopted at hydration: no pop-in, no layout
|
|
6
|
+
// shift. A page without one (plain JSX) falls back to reading its headings from the DOM
|
|
7
|
+
// after mount, as before.
|
|
8
8
|
|
|
9
|
-
import { onMount, router } from "@opentf/afw";
|
|
9
|
+
import { isHydrating, onMount, router } from "@opentf/afw";
|
|
10
|
+
|
|
11
|
+
const sameOutline = (a, b) =>
|
|
12
|
+
a.length === b.length && a.every((h, i) => h.id === b[i].id && h.text === b[i].text && h.sub === b[i].sub);
|
|
10
13
|
|
|
11
14
|
export default function Toc() {
|
|
12
|
-
|
|
15
|
+
const fromPage = () =>
|
|
16
|
+
(router.toc ?? [])
|
|
17
|
+
.filter((h) => h.depth === 2 || h.depth === 3)
|
|
18
|
+
.map((h) => ({ id: h.id, text: h.text, sub: h.depth === 3 }));
|
|
19
|
+
|
|
20
|
+
// A server-rendered `<Toc>` upgrades the moment its module defines it, which is during
|
|
21
|
+
// the router's route import and so before `router.toc` is set. It takes the outline the
|
|
22
|
+
// server rendered into it instead, so the adopt walk always sees the markup it expects.
|
|
23
|
+
const fromServer = () =>
|
|
24
|
+
Array.from(document.querySelectorAll("nav.afwd-toc .afwd-toc-link"), (a) => ({
|
|
25
|
+
id: decodeURIComponent((a.getAttribute("href") || "").slice(1)),
|
|
26
|
+
text: a.textContent || "",
|
|
27
|
+
sub: a.parentElement?.classList.contains("afwd-toc-sub") ?? false,
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
let items = $state(isHydrating() && typeof document !== "undefined" ? fromServer() : fromPage());
|
|
13
31
|
let activeId = $state("");
|
|
14
32
|
let observer = null;
|
|
15
33
|
|
|
16
|
-
|
|
34
|
+
// `initial`: an outline already rendered (served, then adopted) is kept as is. Assigning
|
|
35
|
+
// an equal array would rebuild the list the server sent, and `router.toc` may not be set
|
|
36
|
+
// yet when this first runs.
|
|
37
|
+
const build = (initial = false) => {
|
|
17
38
|
if (typeof document === "undefined") return;
|
|
18
39
|
const root = document.getElementById("afw-content");
|
|
19
40
|
if (!root) return;
|
|
20
41
|
const hs = Array.from(root.querySelectorAll("h2[id], h3[id]"));
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
42
|
+
const page = fromPage();
|
|
43
|
+
if (!(initial && items.length > 0)) {
|
|
44
|
+
const next = page.length > 0
|
|
45
|
+
? page
|
|
46
|
+
: hs.map((h) => ({ id: h.id, text: h.textContent || "", sub: h.tagName === "H3" }));
|
|
47
|
+
// Only a real change replaces the list: the router publishing the same headings
|
|
48
|
+
// (at startup, after the served outline was adopted) must not rebuild it.
|
|
49
|
+
if (!sameOutline(items, next)) items = next;
|
|
50
|
+
}
|
|
26
51
|
if (observer) observer.disconnect();
|
|
27
52
|
observer = new IntersectionObserver(
|
|
28
53
|
(entries) => {
|
|
@@ -34,11 +59,11 @@ export default function Toc() {
|
|
|
34
59
|
};
|
|
35
60
|
|
|
36
61
|
onMount(() => {
|
|
37
|
-
build();
|
|
62
|
+
build(true);
|
|
38
63
|
return () => observer && observer.disconnect();
|
|
39
64
|
});
|
|
40
65
|
|
|
41
|
-
// Rebuild when the route
|
|
66
|
+
// Rebuild when the route or its headings change (content swaps under the same layout). Effects run at
|
|
42
67
|
// construction — before `onMount` — so the first run would schedule a second, redundant
|
|
43
68
|
// build of the same headings: on first paint the outline was built once by `onMount` and
|
|
44
69
|
// then torn down and rebuilt a frame later, a visible flicker on every docs page. Skip that
|
|
@@ -46,11 +71,13 @@ export default function Toc() {
|
|
|
46
71
|
let routed = false;
|
|
47
72
|
$effect(() => {
|
|
48
73
|
router.pathname;
|
|
74
|
+
// A hot refresh of the page publishes its new headings without a navigation.
|
|
75
|
+
router.toc;
|
|
49
76
|
if (!routed) {
|
|
50
77
|
routed = true;
|
|
51
78
|
return;
|
|
52
79
|
}
|
|
53
|
-
if (typeof requestAnimationFrame !== "undefined") requestAnimationFrame(build);
|
|
80
|
+
if (typeof requestAnimationFrame !== "undefined") requestAnimationFrame(() => build());
|
|
54
81
|
});
|
|
55
82
|
|
|
56
83
|
return (
|
package/index.js
CHANGED
|
@@ -34,6 +34,7 @@ import "./components/PostCard.jsx";
|
|
|
34
34
|
import "./components/PostBanner.jsx";
|
|
35
35
|
import "./components/PostMeta.jsx";
|
|
36
36
|
import "./components/ReadingTime.jsx";
|
|
37
|
+
import "./components/FeedLinks.jsx";
|
|
37
38
|
|
|
38
39
|
export { createSearch } from "./search.js";
|
|
39
40
|
|
|
@@ -65,3 +66,4 @@ export { default as PostCard } from "./components/PostCard.jsx";
|
|
|
65
66
|
export { default as PostBanner } from "./components/PostBanner.jsx";
|
|
66
67
|
export { default as PostMeta } from "./components/PostMeta.jsx";
|
|
67
68
|
export { default as ReadingTime } from "./components/ReadingTime.jsx";
|
|
69
|
+
export { default as FeedLinks } from "./components/FeedLinks.jsx";
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentf/afw-docs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Documentation
|
|
3
|
+
"version": "0.32.0",
|
|
4
|
+
"description": "Documentation and blog sites built as ordinary AFW apps.",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "cp ../../LICENSE LICENSE"
|
|
8
|
+
},
|
|
6
9
|
"exports": {
|
|
7
10
|
".": {
|
|
8
11
|
"types": "./types/index.d.ts",
|
|
@@ -26,6 +29,10 @@
|
|
|
26
29
|
"default": "./updated-virtual.js"
|
|
27
30
|
},
|
|
28
31
|
"./build": "./build/index.js",
|
|
32
|
+
"./vite": {
|
|
33
|
+
"types": "./types/vite.d.ts",
|
|
34
|
+
"default": "./build/vite.js"
|
|
35
|
+
},
|
|
29
36
|
"./search": {
|
|
30
37
|
"types": "./types/search.d.ts",
|
|
31
38
|
"default": "./search.js"
|
|
@@ -45,33 +52,36 @@
|
|
|
45
52
|
"!**/*.test.js"
|
|
46
53
|
],
|
|
47
54
|
"keywords": [
|
|
55
|
+
"afw",
|
|
48
56
|
"opentf",
|
|
49
57
|
"documentation",
|
|
50
58
|
"docs",
|
|
59
|
+
"blog",
|
|
51
60
|
"mdx",
|
|
52
|
-
"static-site-generator"
|
|
53
|
-
"ssg"
|
|
61
|
+
"static-site-generator"
|
|
54
62
|
],
|
|
55
63
|
"repository": {
|
|
56
64
|
"type": "git",
|
|
57
65
|
"url": "https://github.com/Open-Tech-Foundation/afw.git",
|
|
58
66
|
"directory": "packages/afw-docs"
|
|
59
67
|
},
|
|
60
|
-
"homepage": "https://
|
|
68
|
+
"homepage": "https://afw.opentechf.org/packages/afw-docs",
|
|
61
69
|
"bugs": "https://github.com/Open-Tech-Foundation/afw/issues",
|
|
62
70
|
"license": "MIT",
|
|
63
71
|
"peerDependencies": {
|
|
64
|
-
"@opentf/afw": "0.
|
|
72
|
+
"@opentf/afw": "0.34.0"
|
|
65
73
|
},
|
|
66
74
|
"publishConfig": {
|
|
67
75
|
"access": "public"
|
|
68
76
|
},
|
|
69
77
|
"dependencies": {
|
|
70
|
-
"@opentf/afw-compiler": "0.
|
|
78
|
+
"@opentf/afw-compiler": "0.22.0"
|
|
71
79
|
},
|
|
72
80
|
"devDependencies": {
|
|
73
|
-
"@opentf/afw": "0.
|
|
74
|
-
"@opentf/afw-test": "1.
|
|
81
|
+
"@opentf/afw": "0.34.0",
|
|
82
|
+
"@opentf/afw-test": "1.29.0",
|
|
83
|
+
"@opentf/vite-plugin-afw": "0.1.0",
|
|
84
|
+
"vite": "8.3.5"
|
|
75
85
|
},
|
|
76
86
|
"types": "./types/index.d.ts"
|
|
77
87
|
}
|
package/theme/index.css
CHANGED
|
@@ -1606,6 +1606,45 @@
|
|
|
1606
1606
|
justify-self: end;
|
|
1607
1607
|
}
|
|
1608
1608
|
}
|
|
1609
|
+
/* Subscribe links: icons at the top of the index, a line under each post. */
|
|
1610
|
+
.afwd-feed-links {
|
|
1611
|
+
display: flex;
|
|
1612
|
+
justify-content: flex-end;
|
|
1613
|
+
gap: 0.5rem;
|
|
1614
|
+
margin-bottom: 0.75rem;
|
|
1615
|
+
}
|
|
1616
|
+
.afwd-feed-link {
|
|
1617
|
+
display: inline-flex;
|
|
1618
|
+
align-items: center;
|
|
1619
|
+
gap: 0.35rem;
|
|
1620
|
+
padding: 0.25rem 0.6rem;
|
|
1621
|
+
border: 1px solid var(--afw-border);
|
|
1622
|
+
border-radius: 9999px;
|
|
1623
|
+
font-size: 0.78rem;
|
|
1624
|
+
font-weight: 600;
|
|
1625
|
+
color: var(--afw-text-muted);
|
|
1626
|
+
text-decoration: none;
|
|
1627
|
+
transition: color 0.15s, border-color 0.15s;
|
|
1628
|
+
}
|
|
1629
|
+
.afwd-feed-link:hover,
|
|
1630
|
+
.afwd-feed-link:focus-visible {
|
|
1631
|
+
color: var(--afw-accent);
|
|
1632
|
+
border-color: var(--afw-accent);
|
|
1633
|
+
}
|
|
1634
|
+
.afwd-feed-icon {
|
|
1635
|
+
flex: none;
|
|
1636
|
+
}
|
|
1637
|
+
.afwd-feed-inline {
|
|
1638
|
+
margin-top: 2.5rem;
|
|
1639
|
+
padding-top: 1rem;
|
|
1640
|
+
border-top: 1px solid var(--afw-border);
|
|
1641
|
+
font-size: 0.85rem;
|
|
1642
|
+
color: var(--afw-text-muted);
|
|
1643
|
+
}
|
|
1644
|
+
.afwd-feed-inline a {
|
|
1645
|
+
color: var(--afw-accent);
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1609
1648
|
.afwd-blog-back {
|
|
1610
1649
|
display: inline-block;
|
|
1611
1650
|
margin-bottom: 1.5rem;
|
|
@@ -1654,9 +1693,13 @@
|
|
|
1654
1693
|
}
|
|
1655
1694
|
.afwd-reading-time,
|
|
1656
1695
|
.afwd-post-author,
|
|
1657
|
-
.afwd-post-date
|
|
1696
|
+
.afwd-post-date,
|
|
1697
|
+
.afwd-post-updated {
|
|
1658
1698
|
white-space: nowrap;
|
|
1659
1699
|
}
|
|
1700
|
+
.afwd-post-meta > .afwd-post-draft::before {
|
|
1701
|
+
content: none;
|
|
1702
|
+
}
|
|
1660
1703
|
|
|
1661
1704
|
/* Tags. */
|
|
1662
1705
|
.afwd-post-tags {
|
|
@@ -1675,6 +1718,16 @@
|
|
|
1675
1718
|
color: var(--afw-text-muted);
|
|
1676
1719
|
}
|
|
1677
1720
|
|
|
1721
|
+
.afwd-post-draft {
|
|
1722
|
+
padding: 0 0.5rem;
|
|
1723
|
+
border-radius: 9999px;
|
|
1724
|
+
border: 1px dashed var(--afw-border);
|
|
1725
|
+
font-size: 0.72rem;
|
|
1726
|
+
font-weight: 600;
|
|
1727
|
+
text-transform: uppercase;
|
|
1728
|
+
letter-spacing: 0.04em;
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1678
1731
|
/* Index listing. */
|
|
1679
1732
|
.afwd-post-list {
|
|
1680
1733
|
display: flex;
|
|
@@ -1691,10 +1744,11 @@
|
|
|
1691
1744
|
color: var(--afw-accent);
|
|
1692
1745
|
}
|
|
1693
1746
|
.afwd-post-card .afwd-post-meta {
|
|
1694
|
-
margin-top: 0;
|
|
1747
|
+
margin-top: 0.75rem;
|
|
1695
1748
|
}
|
|
1696
1749
|
.afwd-post-card-title {
|
|
1697
|
-
margin
|
|
1750
|
+
margin: 0;
|
|
1751
|
+
line-height: 1.3;
|
|
1698
1752
|
font-size: 1.35rem;
|
|
1699
1753
|
font-weight: 700;
|
|
1700
1754
|
color: var(--afw-text);
|
|
@@ -1746,4 +1800,44 @@
|
|
|
1746
1800
|
border: 1px solid var(--afw-border);
|
|
1747
1801
|
margin-bottom: 1rem;
|
|
1748
1802
|
}
|
|
1803
|
+
|
|
1804
|
+
/* The newest post: the index's hero. */
|
|
1805
|
+
.afwd-post-card-featured {
|
|
1806
|
+
border-top: 0;
|
|
1807
|
+
padding-top: 0.5rem;
|
|
1808
|
+
}
|
|
1809
|
+
.afwd-post-card-featured .afwd-post-card-cover {
|
|
1810
|
+
margin-bottom: 1.25rem;
|
|
1811
|
+
}
|
|
1812
|
+
.afwd-post-card-featured .afwd-post-card-title {
|
|
1813
|
+
font-size: clamp(1.6rem, 4vw, 2.25rem);
|
|
1814
|
+
line-height: 1.2;
|
|
1815
|
+
}
|
|
1816
|
+
.afwd-post-card-featured .afwd-post-card-desc {
|
|
1817
|
+
font-size: 1.05rem;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
/* Every other post: a compact row with a thumbnail beside the text. */
|
|
1821
|
+
.afwd-post-rows .afwd-post-card.afwd-has-cover {
|
|
1822
|
+
display: grid;
|
|
1823
|
+
grid-template-columns: minmax(0, 1fr) 7rem;
|
|
1824
|
+
gap: 1rem;
|
|
1825
|
+
align-items: start;
|
|
1826
|
+
}
|
|
1827
|
+
.afwd-post-rows .afwd-post-card-cover {
|
|
1828
|
+
grid-column: 2;
|
|
1829
|
+
grid-row: 1;
|
|
1830
|
+
aspect-ratio: 16 / 10;
|
|
1831
|
+
margin: 0;
|
|
1832
|
+
}
|
|
1833
|
+
.afwd-post-rows .afwd-post-card-body {
|
|
1834
|
+
grid-column: 1;
|
|
1835
|
+
grid-row: 1;
|
|
1836
|
+
}
|
|
1837
|
+
@media (min-width: 640px) {
|
|
1838
|
+
.afwd-post-rows .afwd-post-card.afwd-has-cover {
|
|
1839
|
+
grid-template-columns: minmax(0, 1fr) 11rem;
|
|
1840
|
+
gap: 1.5rem;
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1749
1843
|
}
|
package/types/config.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export interface BlogConfig {
|
|
|
24
24
|
dir?: string;
|
|
25
25
|
title?: string;
|
|
26
26
|
description?: string;
|
|
27
|
+
/** Feed language (RSS `<language>`); defaults to `i18n.defaultLocale`, then "en". */
|
|
28
|
+
language?: string;
|
|
27
29
|
lastUpdated?: boolean;
|
|
28
30
|
}
|
|
29
31
|
export interface SiteConfig {
|
package/types/index.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface BlogLayoutProps extends ChildrenProps {
|
|
|
21
21
|
frame?: boolean;
|
|
22
22
|
indexPath?: string;
|
|
23
23
|
siteUrl?: string;
|
|
24
|
+
/** Show RSS/Atom subscribe links on the index and under each post (default true). */
|
|
25
|
+
feeds?: boolean;
|
|
24
26
|
}
|
|
25
27
|
export interface NavbarProps {
|
|
26
28
|
config?: DocsConfig;
|
|
@@ -64,3 +66,5 @@ export function PostCard(props: { post: BlogPost }): Node;
|
|
|
64
66
|
export function PostBanner(props: { post: BlogPost } | Partial<BlogPost>): Node;
|
|
65
67
|
export function PostMeta(props: { post: BlogPost } | Partial<BlogPost>): Node;
|
|
66
68
|
export function ReadingTime(props: { minutes?: number }): Node;
|
|
69
|
+
/** RSS and Atom subscribe links for the feeds under `base` (default "/blog"). */
|
|
70
|
+
export function FeedLinks(props: { base?: string; variant?: "icons" | "inline" }): Node;
|
package/types/vite.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
|
|
3
|
+
export interface AfwDocsViteOptions {
|
|
4
|
+
/** The docs config. Default: afw.config.{json,js,mjs} from the project root. */
|
|
5
|
+
config?: Record<string, unknown>;
|
|
6
|
+
/** The routes folder. Default `"app"`. */
|
|
7
|
+
appDir?: string;
|
|
8
|
+
/** Folders under `appDir` that hold no pages. */
|
|
9
|
+
exclude?: string[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** The docs and blog generators for Vite: navigation, posts, last-updated, search, feeds, llms.txt. */
|
|
13
|
+
export default function afwDocs(options?: AfwDocsViteOptions): Plugin;
|
|
14
|
+
|
|
15
|
+
/** Run the post-prerender steps (search index, feeds, llms.txt) yourself. */
|
|
16
|
+
export function finishSite(options: Record<string, unknown>): Promise<unknown>;
|
|
17
|
+
|
|
18
|
+
/** The project's afw.config, or `{}`. */
|
|
19
|
+
export function loadConfig(root: string): Promise<Record<string, unknown>>;
|