meowpress 0.3.0-alpha.3 → 0.3.0-alpha.5
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/README.md +18 -4
- package/dist/src/build.d.ts +2 -2
- package/dist/src/fonts.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/site.js +144 -285
- package/dist/src/theme.d.ts +12 -43
- package/dist/src/theme.js +311 -2046
- package/package.json +10 -5
package/dist/src/site.js
CHANGED
|
@@ -1,142 +1,115 @@
|
|
|
1
1
|
import { themeAttributes } from "meowcss";
|
|
2
|
+
import { createRuntime, Fragment, h } from "meowjsx";
|
|
3
|
+
import { renderToHtmlWithRuntime } from "meowjsx/web";
|
|
4
|
+
import { Button, Container, Entry, EntryList, Inline, MetaRow, Page, PageHeader, Prose, Section, Tag, Text, createMeowUI, } from "meowtail";
|
|
5
|
+
import { GithubIcon, Icon } from "meowtail/icons";
|
|
2
6
|
import { blogTheme } from "./theme.js";
|
|
3
|
-
import { Fragment, h } from "meowjsx/runtime";
|
|
4
|
-
import { renderToHtml } from "meowjsx/web";
|
|
5
7
|
import { withoutLeadingHeading } from "./content.js";
|
|
6
8
|
import { DEFAULT_SITE } from "./identity.js";
|
|
7
9
|
import { sitePageAgentUrl } from "./pages.js";
|
|
8
10
|
import { layoutSkillGraph } from "./skill-graph.js";
|
|
9
11
|
/** The name of the theme stylesheet the package writes by default. */
|
|
10
12
|
export const DEFAULT_THEME_STYLESHEET = "blog-theme.css";
|
|
11
|
-
/** The href of the theme stylesheet for a page at a given depth. */
|
|
12
13
|
function styleHref(depth, stylesheet) {
|
|
13
14
|
return `${"../".repeat(depth)}${stylesheet}`;
|
|
14
15
|
}
|
|
15
|
-
/** The number of directories a slug puts a page below its section. */
|
|
16
16
|
function slugDepth(slug) {
|
|
17
17
|
return slug.split("/").filter(Boolean).length;
|
|
18
18
|
}
|
|
19
19
|
function SiteHeader({ activePath, site }) {
|
|
20
|
-
|
|
20
|
+
const links = [
|
|
21
|
+
["/posts/", "Posts"],
|
|
22
|
+
["/thoughts/", "Thoughts"],
|
|
23
|
+
["/skills/", "Skills"],
|
|
24
|
+
["/about/", "About"],
|
|
25
|
+
];
|
|
26
|
+
return (h("header", { className: "site-header" },
|
|
21
27
|
h("a", { className: "site-name", href: "/" }, site.name),
|
|
22
|
-
h("nav", { className: "site-nav", "aria-label": "Primary navigation" },
|
|
23
|
-
h("a", { className: activePath === "/skills/" ? "active" : "", href: "/skills/" }, "Skills"),
|
|
24
|
-
h("a", { className: activePath === "/about/" ? "active" : "", href: "/about/" }, "About"))));
|
|
28
|
+
h("nav", { className: "site-nav", "aria-label": "Primary navigation" }, links.map(([href, label]) => (h("a", { href: href, "aria-current": activePath === href ? "page" : undefined }, label))))));
|
|
25
29
|
}
|
|
26
30
|
function SiteFooter({ site }) {
|
|
27
|
-
return (h("footer", { className: "site" },
|
|
28
|
-
h(
|
|
31
|
+
return (h("footer", { className: "site-footer" },
|
|
32
|
+
h(Text, { variant: "caption" },
|
|
29
33
|
"\u00A9 ",
|
|
30
34
|
new Date().getFullYear(),
|
|
31
35
|
" ",
|
|
32
36
|
site.name),
|
|
33
|
-
h("
|
|
37
|
+
h(Inline, { gap: "compact" },
|
|
34
38
|
h("a", { href: "/llm.txt" }, "llm.txt"),
|
|
35
|
-
" \u00B7 ",
|
|
36
39
|
h("a", { href: "/agents.md" }, "agents.md"))));
|
|
37
40
|
}
|
|
38
|
-
function Document({ title, description, activePath, styleHref, baseHref, children, theme, site, }) {
|
|
39
|
-
|
|
40
|
-
return (h("html", { lang: "en", ...themeAttributes(theme) },
|
|
41
|
+
function Document({ title, description, activePath, styleHref, baseHref, wide, children, theme, site, }) {
|
|
42
|
+
return (h("html", { lang: "en", "data-meowui-page": "", ...themeAttributes(theme) },
|
|
41
43
|
h("head", null,
|
|
42
44
|
h("meta", { charSet: "UTF-8" }),
|
|
43
45
|
h("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }),
|
|
44
46
|
h("meta", { name: "description", content: description ?? site.description }),
|
|
45
|
-
h("meta", { name: "theme-color", media: "(prefers-color-scheme: light)", content: "#faf8f3" }),
|
|
46
|
-
h("meta", { name: "theme-color", media: "(prefers-color-scheme: dark)", content: "#191816" }),
|
|
47
47
|
baseHref ? h("base", { href: baseHref }) : null,
|
|
48
48
|
h("link", { rel: "stylesheet", href: styleHref }),
|
|
49
|
-
h("title", null,
|
|
49
|
+
h("title", null, title === site.name ? site.name : `${title} · ${site.name}`)),
|
|
50
50
|
h("body", { "data-site": site.id },
|
|
51
|
-
h("
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
h("a", { className: "skip-link", href: "#main-content" }, "Skip to content"),
|
|
52
|
+
h("div", { className: "site-shell" },
|
|
53
|
+
h(Container, { width: wide ? "wide" : "content" },
|
|
54
|
+
h(SiteHeader, { activePath: activePath, site: site }),
|
|
55
|
+
h("main", { id: "main-content", tabIndex: -1 }, children),
|
|
56
|
+
h(SiteFooter, { site: site }))))));
|
|
55
57
|
}
|
|
56
58
|
function pageHtml(props) {
|
|
57
|
-
|
|
59
|
+
// Static rendering needs the same part/option adapter as a browser mount. No hydration is needed.
|
|
60
|
+
const runtime = createRuntime({
|
|
61
|
+
plugins: [
|
|
62
|
+
createMeowUI({
|
|
63
|
+
components: [
|
|
64
|
+
Button,
|
|
65
|
+
Container,
|
|
66
|
+
Entry,
|
|
67
|
+
EntryList,
|
|
68
|
+
Inline,
|
|
69
|
+
MetaRow,
|
|
70
|
+
Page,
|
|
71
|
+
PageHeader,
|
|
72
|
+
Prose,
|
|
73
|
+
Section,
|
|
74
|
+
Tag,
|
|
75
|
+
Text,
|
|
76
|
+
],
|
|
77
|
+
}),
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
return `<!doctype html>\n${renderToHtmlWithRuntime(runtime, h(Document, { ...props }))}`;
|
|
58
81
|
}
|
|
59
82
|
function dateLabel(dateKey) {
|
|
60
83
|
const date = new Date(`${dateKey}T00:00:00Z`);
|
|
61
84
|
if (Number.isNaN(date.getTime()))
|
|
62
85
|
return { date: "Undated", weekday: "" };
|
|
63
|
-
const weekday = new Intl.DateTimeFormat("en-US", {
|
|
64
|
-
timeZone: "UTC",
|
|
65
|
-
weekday: "short",
|
|
66
|
-
}).format(date);
|
|
67
86
|
return {
|
|
68
87
|
date: new Intl.DateTimeFormat("en-US", {
|
|
69
88
|
timeZone: "UTC",
|
|
70
89
|
month: "long",
|
|
71
90
|
day: "numeric",
|
|
72
91
|
}).format(date),
|
|
73
|
-
weekday: `${date.getUTCFullYear()} ${weekday}`,
|
|
92
|
+
weekday: `${date.getUTCFullYear()} ${new Intl.DateTimeFormat("en-US", { timeZone: "UTC", weekday: "short" }).format(date)}`,
|
|
74
93
|
};
|
|
75
94
|
}
|
|
76
95
|
function itemUrl(item) {
|
|
77
96
|
return `/${item.kind}s/${item.slug}/`;
|
|
78
97
|
}
|
|
79
|
-
function Hero({ image }) {
|
|
80
|
-
return (h("section", { className: "hero", "aria-labelledby": "hero-title" },
|
|
81
|
-
h("div", { className: "hero-copy" },
|
|
82
|
-
h("h1", { id: "hero-title" },
|
|
83
|
-
"Ten thousand years is too long;",
|
|
84
|
-
h("br", null),
|
|
85
|
-
h("em", null, "only this day is true."))),
|
|
86
|
-
h("div", { className: "hero-work", "aria-hidden": "true" },
|
|
87
|
-
h("svg", { className: "hero-doodle", viewBox: "0 0 260 190" },
|
|
88
|
-
h("path", { className: "doodle-loop", d: "M24 96C20 45 58 18 122 20c72 2 116 33 114 84-2 48-48 70-113 68-65-2-96-27-99-76Z" }),
|
|
89
|
-
h("circle", { className: "doodle-sun", cx: "194", cy: "55", r: "27" }),
|
|
90
|
-
h("path", { className: "doodle-page", d: "M47 100c28-9 57-5 83 11v49c-24-13-52-16-83-7Z" }),
|
|
91
|
-
h("path", { className: "doodle-page", d: "M130 111c24-15 52-19 82-9v51c-31-7-58-4-82 7Z" }),
|
|
92
|
-
h("path", { className: "doodle-spine", d: "M130 111v49" }),
|
|
93
|
-
h("path", { className: "doodle-writing", d: "M61 118c18-3 36-1 53 5M61 132c17-2 32 0 46 5M148 119c17-4 33-5 50-1M148 133c14-3 29-3 44 0" }),
|
|
94
|
-
h("circle", { className: "doodle-dot", cx: "41", cy: "61", r: "5" }),
|
|
95
|
-
h("path", { className: "doodle-spark", d: "M72 44v12M66 50h12" })),
|
|
96
|
-
image ? h("img", { className: "hero-image", src: image, alt: "", decoding: "async" }) : null)));
|
|
97
|
-
}
|
|
98
|
-
function DoodleGithubIcon() {
|
|
99
|
-
return (h("svg", { className: "github-icon", viewBox: "0 0 48 48", "aria-hidden": "true" },
|
|
100
|
-
h("path", { className: "github-icon-ring", d: "M24 3.8C11.7 3.5 4.2 11.2 4.6 24.1c.3 12.1 7.8 20.1 19.6 20 12.2-.1 19.4-7.7 19.2-20C43.2 11.7 36.2 4.1 24 3.8Z" }),
|
|
101
|
-
h("path", { className: "github-icon-cat", d: "M14.3 18.8c-.7-2.4-.3-5.1.8-7.1 3.2.1 5.4 1.3 6.6 2.2 1.5-.4 3.1-.6 4.8-.4 1.4-1 3.7-1.9 6.7-1.8 1 2.2 1.3 4.9.5 7.1 1.5 1.8 2.2 4.1 2 6.8-.4 5.2-3.2 8.2-8.2 8.8.8.7 1.3 1.9 1.3 3.8v4.3c-1.5.4-3.1.6-4.8.6-1.4 0-2.8-.1-4.2-.5v-3.4c0-1.8.5-3.1 1.4-4-4.8-.6-7.7-3.5-8.2-8.7-.3-2.7.4-5 1.3-6.7Z" }),
|
|
102
|
-
h("path", { className: "github-icon-face", d: "M20.2 24.3h.1M29.2 24.3h.1M21.2 28.9c2.2 1.4 4.5 1.4 6.8 0" })));
|
|
103
|
-
}
|
|
104
|
-
function DoodleExternalArrow() {
|
|
105
|
-
return (h("svg", { className: "external-arrow", viewBox: "0 0 28 28", "aria-hidden": "true" },
|
|
106
|
-
h("path", { d: "M7 21 21 7M12 7h9v9" })));
|
|
107
|
-
}
|
|
108
98
|
function Tags({ item }) {
|
|
109
|
-
|
|
110
|
-
return null;
|
|
111
|
-
return (h("div", { className: "tags" }, item.tags.map((tag) => (h("span", null,
|
|
112
|
-
"#",
|
|
113
|
-
tag)))));
|
|
99
|
+
return item.tags.length ? (h(Inline, { gap: "compact" }, item.tags.map((tag) => (h(Tag, null, tag))))) : null;
|
|
114
100
|
}
|
|
115
101
|
function ThoughtCard({ item, linked = false }) {
|
|
116
|
-
|
|
117
|
-
h(
|
|
118
|
-
h("span", { className: "t" }, item.timeLabel || item.dateKey),
|
|
119
|
-
" \u00B7 Thought"),
|
|
120
|
-
h("div", { className: "body", dangerouslySetInnerHTML: { __html: withoutLeadingHeading(item.html) } }),
|
|
102
|
+
return (h(Entry, { className: "thought", "data-kind": "thought", title: item.title, href: linked ? itemUrl(item) : undefined, eyebrow: `${item.timeLabel || item.dateKey} · Thought` },
|
|
103
|
+
h(Prose, { dangerouslySetInnerHTML: { __html: withoutLeadingHeading(item.html) } }),
|
|
121
104
|
h(Tags, { item: item })));
|
|
122
|
-
if (!linked)
|
|
123
|
-
return (h("article", { className: "thought", "data-kind": "thought" }, body));
|
|
124
|
-
return (h("article", { className: "thought", "data-kind": "thought" },
|
|
125
|
-
h("a", { className: "thought-link", href: itemUrl(item) }, body)));
|
|
126
105
|
}
|
|
127
106
|
function PostCard({ item }) {
|
|
128
107
|
const category = typeof item.metadata.category === "string" ? item.metadata.category : "Post";
|
|
129
|
-
return (h(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
item.readingMinutes,
|
|
135
|
-
" min \u00B7 ",
|
|
136
|
-
item.characterCount,
|
|
137
|
-
" characters")),
|
|
138
|
-
h("h3", null, item.title),
|
|
139
|
-
h("p", { className: "excerpt" }, item.excerpt || "This post has no summary yet."),
|
|
108
|
+
return (h(Entry, { size: "feature", "data-kind": "post", title: item.title, href: itemUrl(item), eyebrow: category, description: item.excerpt || "This post has no summary yet.", meta: h(MetaRow, { items: [
|
|
109
|
+
{ label: item.dateKey },
|
|
110
|
+
{ label: `${item.readingMinutes} min read` },
|
|
111
|
+
{ label: `${item.characterCount} characters` },
|
|
112
|
+
] }) },
|
|
140
113
|
h(Tags, { item: item })));
|
|
141
114
|
}
|
|
142
115
|
function groupByDate(items) {
|
|
@@ -148,108 +121,34 @@ function groupByDate(items) {
|
|
|
148
121
|
}
|
|
149
122
|
return groups;
|
|
150
123
|
}
|
|
151
|
-
function FeedDecor({ image }) {
|
|
152
|
-
return (h("div", { className: "feed-decor", "aria-hidden": "true" },
|
|
153
|
-
h("svg", { className: "yarn-doodle", viewBox: "0 0 88 70" },
|
|
154
|
-
h("path", { className: "yarn-tail", d: "M42 48c-10 7-17 4-22 9-5 4-2 9 4 8 8-1 11-8 18-6 6 1 10 6 16 4" }),
|
|
155
|
-
h("circle", { className: "yarn-fill", cx: "48", cy: "34", r: "22" }),
|
|
156
|
-
h("path", { className: "yarn-line", d: "M31 23c11 1 22 7 34 18M28 34c12-7 24-9 39-5M34 49c7-14 16-24 28-31M28 42c13 1 24 5 33 12" })),
|
|
157
|
-
h("svg", { className: "paw-trail", viewBox: "0 0 130 82" },
|
|
158
|
-
h("g", { className: "paw-print", transform: "translate(12 54) rotate(-18)" },
|
|
159
|
-
h("ellipse", { cx: "9", cy: "11", rx: "6", ry: "5" }),
|
|
160
|
-
h("circle", { cx: "3", cy: "3", r: "2.5" }),
|
|
161
|
-
h("circle", { cx: "9", cy: "1", r: "2.5" }),
|
|
162
|
-
h("circle", { cx: "15", cy: "3", r: "2.5" })),
|
|
163
|
-
h("g", { className: "paw-print", transform: "translate(45 37) rotate(8)" },
|
|
164
|
-
h("ellipse", { cx: "9", cy: "11", rx: "6", ry: "5" }),
|
|
165
|
-
h("circle", { cx: "3", cy: "3", r: "2.5" }),
|
|
166
|
-
h("circle", { cx: "9", cy: "1", r: "2.5" }),
|
|
167
|
-
h("circle", { cx: "15", cy: "3", r: "2.5" })),
|
|
168
|
-
h("g", { className: "paw-print", transform: "translate(79 19) rotate(-12)" },
|
|
169
|
-
h("ellipse", { cx: "9", cy: "11", rx: "6", ry: "5" }),
|
|
170
|
-
h("circle", { cx: "3", cy: "3", r: "2.5" }),
|
|
171
|
-
h("circle", { cx: "9", cy: "1", r: "2.5" }),
|
|
172
|
-
h("circle", { cx: "15", cy: "3", r: "2.5" })),
|
|
173
|
-
h("g", { className: "paw-print paw-print-accent", transform: "translate(111 5) rotate(11)" },
|
|
174
|
-
h("ellipse", { cx: "7", cy: "9", rx: "5", ry: "4" }),
|
|
175
|
-
h("circle", { cx: "2", cy: "2", r: "2" }),
|
|
176
|
-
h("circle", { cx: "7", cy: "1", r: "2" }),
|
|
177
|
-
h("circle", { cx: "12", cy: "2", r: "2" }))),
|
|
178
|
-
image ? h("img", { className: "feed-image", src: image, alt: "", decoding: "async" }) : null));
|
|
179
|
-
}
|
|
180
124
|
function Feed({ items, image }) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
h("p", { className: "empty-state" }, "No public content yet."),
|
|
184
|
-
h(FeedDecor, { image: image })));
|
|
185
|
-
}
|
|
186
|
-
return (h("main", { className: "feed" },
|
|
187
|
-
[...groupByDate(items)].map(([dateKey, group]) => {
|
|
125
|
+
return (h("div", { className: "feed" },
|
|
126
|
+
items.length === 0 ? (h(Text, { variant: "secondary" }, "No public content yet.")) : ([...groupByDate(items)].map(([dateKey, group]) => {
|
|
188
127
|
const label = dateLabel(dateKey);
|
|
189
|
-
return (h(
|
|
190
|
-
h("
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
h("span", { className: "weekday" }, label.weekday)),
|
|
194
|
-
group.map((item) => item.kind === "thought" ? (h(ThoughtCard, { item: item, linked: true })) : (h(PostCard, { item: item })))));
|
|
195
|
-
}),
|
|
196
|
-
h(FeedDecor, { image: image })));
|
|
128
|
+
return (h(Section, { className: "day", title: label.date, description: label.weekday },
|
|
129
|
+
h(EntryList, null, group.map((item) => item.kind === "thought" ? (h(ThoughtCard, { item: item, linked: true })) : (h(PostCard, { item: item }))))));
|
|
130
|
+
})),
|
|
131
|
+
image ? (h("img", { className: "feed-image", src: image, alt: "", loading: "lazy", decoding: "async" })) : null));
|
|
197
132
|
}
|
|
198
133
|
function Filter({ posts, thoughts }) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
h("button", { type: "button", "data-filter": "thought", "aria-pressed": "false" },
|
|
208
|
-
"Thoughts",
|
|
209
|
-
h("i", null, thoughts))));
|
|
134
|
+
return (h(Inline, { className: "feed-filter", gap: "compact", "data-filter-group": "feed", role: "group", "aria-label": "Filter home feed" }, [
|
|
135
|
+
["all", "All", posts + thoughts],
|
|
136
|
+
["post", "Posts", posts],
|
|
137
|
+
["thought", "Thoughts", thoughts],
|
|
138
|
+
].map(([value, label, count]) => (h(Button, { variant: "quiet", "data-filter": value, "aria-pressed": String(value === "all") },
|
|
139
|
+
label,
|
|
140
|
+
" ",
|
|
141
|
+
h("span", { className: "filter-count" }, count))))));
|
|
210
142
|
}
|
|
211
143
|
const FILTER_SCRIPT = `(() => {
|
|
212
144
|
const links = document.querySelectorAll('[data-filter-group="feed"] [data-filter]');
|
|
213
145
|
const items = document.querySelectorAll('.feed [data-kind]');
|
|
214
146
|
const days = document.querySelectorAll('.feed .day');
|
|
215
|
-
|
|
216
|
-
if ('IntersectionObserver' in window && !reduced) {
|
|
217
|
-
const observer = new IntersectionObserver((entries) => {
|
|
218
|
-
entries.forEach((entry) => {
|
|
219
|
-
if (entry.isIntersecting) {
|
|
220
|
-
entry.target.classList.add('in');
|
|
221
|
-
observer.unobserve(entry.target);
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
}, { threshold: 0.08 });
|
|
225
|
-
days.forEach((day) => observer.observe(day));
|
|
226
|
-
} else {
|
|
227
|
-
days.forEach((day) => day.classList.add('in'));
|
|
228
|
-
}
|
|
229
|
-
links.forEach((link) => link.addEventListener('click', (event) => {
|
|
230
|
-
event.preventDefault();
|
|
147
|
+
links.forEach((link) => link.addEventListener('click', () => {
|
|
231
148
|
const filter = link.dataset.filter;
|
|
232
|
-
links.forEach((
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
item.setAttribute('aria-pressed', String(active));
|
|
236
|
-
});
|
|
237
|
-
items.forEach((item) => {
|
|
238
|
-
item.style.display = filter === 'all' || item.dataset.kind === filter ? '' : 'none';
|
|
239
|
-
});
|
|
240
|
-
days.forEach((day) => {
|
|
241
|
-
const visible = Array.from(day.querySelectorAll('[data-kind]'))
|
|
242
|
-
.some((item) => item.style.display !== 'none');
|
|
243
|
-
day.style.display = visible ? '' : 'none';
|
|
244
|
-
if (!visible) day.classList.remove('in');
|
|
245
|
-
});
|
|
246
|
-
if (!reduced) {
|
|
247
|
-
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
248
|
-
days.forEach((day) => {
|
|
249
|
-
if (day.style.display !== 'none') day.classList.add('in');
|
|
250
|
-
});
|
|
251
|
-
}));
|
|
252
|
-
}
|
|
149
|
+
links.forEach((button) => button.setAttribute('aria-pressed', String(button === link)));
|
|
150
|
+
items.forEach((item) => { item.hidden = filter !== 'all' && item.dataset.kind !== filter; });
|
|
151
|
+
days.forEach((day) => { day.hidden = !Array.from(day.querySelectorAll('[data-kind]')).some((item) => !item.hidden); });
|
|
253
152
|
}));
|
|
254
153
|
})();`;
|
|
255
154
|
export function homePage(items, theme = blogTheme, site = DEFAULT_SITE, stylesheet = DEFAULT_THEME_STYLESHEET) {
|
|
@@ -258,29 +157,27 @@ export function homePage(items, theme = blogTheme, site = DEFAULT_SITE, styleshe
|
|
|
258
157
|
theme,
|
|
259
158
|
title: site.name,
|
|
260
159
|
styleHref: styleHref(0, stylesheet),
|
|
261
|
-
children: (h(
|
|
262
|
-
|
|
263
|
-
|
|
160
|
+
children: (h(Page, { header: h("div", { className: "home-heading" },
|
|
161
|
+
h("div", { className: "home-heading-copy" },
|
|
162
|
+
h(Text, { variant: "eyebrow" }, "Journal"),
|
|
163
|
+
h(PageHeader, { title: site.name, description: site.description })),
|
|
164
|
+
site.images?.hero ? (h("img", { className: "hero-image", src: `./${site.images.hero}`, alt: "", decoding: "async" })) : null), toolbar: h(Filter, { posts: items.filter((item) => item.kind === "post").length, thoughts: items.filter((item) => item.kind === "thought").length }) },
|
|
264
165
|
h(Feed, { items: items, image: site.images?.feed ? `./${site.images.feed}` : undefined }),
|
|
265
166
|
h("script", { dangerouslySetInnerHTML: { __html: FILTER_SCRIPT } }))),
|
|
266
167
|
});
|
|
267
168
|
}
|
|
268
169
|
export function listPage(kind, items, theme = blogTheme, site = DEFAULT_SITE, stylesheet = DEFAULT_THEME_STYLESHEET) {
|
|
269
170
|
const isPost = kind === "post";
|
|
171
|
+
const title = isPost ? "Posts" : "Thoughts";
|
|
270
172
|
return pageHtml({
|
|
271
173
|
site,
|
|
272
174
|
theme,
|
|
273
|
-
title
|
|
175
|
+
title,
|
|
274
176
|
activePath: isPost ? "/posts/" : "/thoughts/",
|
|
275
177
|
styleHref: styleHref(1, stylesheet),
|
|
276
|
-
children: (h(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
h("h1", null, isPost ? "Posts" : "Thoughts"),
|
|
280
|
-
h("p", null, isPost
|
|
281
|
-
? "Complete arguments grown from fragments."
|
|
282
|
-
: "Short, trimmed thoughts ready to show as they are.")),
|
|
283
|
-
h("div", { className: isPost ? "post-list" : "thought-list" }, items.length === 0 ? (h("p", { className: "empty-state" }, "No public content yet.")) : (items.map((item) => isPost ? h(PostCard, { item: item }) : h(ThoughtCard, { item: item, linked: true })))))),
|
|
178
|
+
children: (h(Page, { title: title, eyebrow: "Archive", description: isPost
|
|
179
|
+
? "Complete arguments grown from fragments."
|
|
180
|
+
: "Short, trimmed thoughts ready to show as they are." }, items.length ? (h(EntryList, null, items.map((item) => isPost ? h(PostCard, { item: item }) : h(ThoughtCard, { item: item, linked: true })))) : (h(Text, { variant: "secondary" }, "No public content yet.")))),
|
|
284
181
|
});
|
|
285
182
|
}
|
|
286
183
|
export function notFoundPage(copy, theme, site, stylesheet) {
|
|
@@ -292,14 +189,9 @@ export function notFoundPage(copy, theme, site, stylesheet) {
|
|
|
292
189
|
title,
|
|
293
190
|
description: message,
|
|
294
191
|
styleHref: styleHref(0, stylesheet),
|
|
295
|
-
// Static hosts can serve 404.html at the missing URL, including deep paths.
|
|
296
192
|
baseHref: "/",
|
|
297
|
-
children: (h(
|
|
298
|
-
h(
|
|
299
|
-
h("span", { className: "kind" }, "404"),
|
|
300
|
-
h("h1", null, title),
|
|
301
|
-
h("p", null, message)),
|
|
302
|
-
h("div", { className: "prose" },
|
|
193
|
+
children: (h(Page, { eyebrow: "404", title: title, description: message },
|
|
194
|
+
h(Prose, null,
|
|
303
195
|
h("a", { href: "/" }, copy.homeLabel ?? "Back to home")))),
|
|
304
196
|
});
|
|
305
197
|
}
|
|
@@ -308,22 +200,17 @@ function PostNavigation({ item, posts }) {
|
|
|
308
200
|
const older = index >= 0 ? posts[index + 1] : undefined;
|
|
309
201
|
const newer = index > 0 ? posts[index - 1] : undefined;
|
|
310
202
|
return (h("nav", { className: "post-nav", "aria-label": "Post navigation" },
|
|
311
|
-
older ? (h("
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
newer ? (h(
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
h("span", { className: "label" }, "Next post (newer) \u2192"),
|
|
318
|
-
"Nothing newer \u2014 this is the latest post."))));
|
|
203
|
+
older ? (h(Entry, { eyebrow: h("span", { className: "site-icon-label" },
|
|
204
|
+
h(Icon, { name: "chevron-left", size: 14 }),
|
|
205
|
+
" Previous post (older)"), title: older.title, href: itemUrl(older) })) : (h("span", null)),
|
|
206
|
+
newer ? (h(Entry, { eyebrow: h("span", { className: "site-icon-label" },
|
|
207
|
+
"Next post (newer) ",
|
|
208
|
+
h(Icon, { name: "chevron-right", size: 14 })), title: newer.title, href: itemUrl(newer) })) : (h(Text, { variant: "caption" }, "Nothing newer \u2014 this is the latest post."))));
|
|
319
209
|
}
|
|
320
210
|
function RelatedThoughts({ item, thoughts, }) {
|
|
321
211
|
const related = thoughts.filter((thought) => thought.dateKey === item.dateKey).slice(0, 3);
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
return (h("aside", { className: "related-thoughts" },
|
|
325
|
-
h("h2", null, "Thoughts from the same day"),
|
|
326
|
-
related.map((thought) => (h(ThoughtCard, { item: thought, linked: true })))));
|
|
212
|
+
return related.length ? (h(Section, { title: "Thoughts from the same day" },
|
|
213
|
+
h(EntryList, null, related.map((thought) => (h(ThoughtCard, { item: thought, linked: true })))))) : null;
|
|
327
214
|
}
|
|
328
215
|
export function postPage(item, posts, thoughts, theme = blogTheme, site = DEFAULT_SITE, stylesheet = DEFAULT_THEME_STYLESHEET) {
|
|
329
216
|
const category = typeof item.metadata.category === "string" ? item.metadata.category : "Post";
|
|
@@ -334,21 +221,16 @@ export function postPage(item, posts, thoughts, theme = blogTheme, site = DEFAUL
|
|
|
334
221
|
description: item.excerpt,
|
|
335
222
|
activePath: "/posts/",
|
|
336
223
|
styleHref: styleHref(1 + slugDepth(item.slug), stylesheet),
|
|
337
|
-
children: (h(
|
|
338
|
-
h(
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
item.characterCount,
|
|
348
|
-
" characters")),
|
|
349
|
-
h("div", { className: "prose", dangerouslySetInnerHTML: { __html: item.html } }),
|
|
350
|
-
h(RelatedThoughts, { item: item, thoughts: thoughts }),
|
|
351
|
-
h(PostNavigation, { item: item, posts: posts })))),
|
|
224
|
+
children: (h(Page, { title: item.title, eyebrow: category },
|
|
225
|
+
h(MetaRow, { items: [
|
|
226
|
+
{ label: item.dateKey },
|
|
227
|
+
{ label: `${item.readingMinutes} min read` },
|
|
228
|
+
{ label: `${item.characterCount} characters` },
|
|
229
|
+
] }),
|
|
230
|
+
h(Prose, { as: "article", dangerouslySetInnerHTML: { __html: withoutLeadingHeading(item.html) } }),
|
|
231
|
+
h(Tags, { item: item }),
|
|
232
|
+
h(RelatedThoughts, { item: item, thoughts: thoughts }),
|
|
233
|
+
h(PostNavigation, { item: item, posts: posts }))),
|
|
352
234
|
});
|
|
353
235
|
}
|
|
354
236
|
export function thoughtPage(item, theme = blogTheme, site = DEFAULT_SITE, stylesheet = DEFAULT_THEME_STYLESHEET) {
|
|
@@ -359,15 +241,10 @@ export function thoughtPage(item, theme = blogTheme, site = DEFAULT_SITE, styles
|
|
|
359
241
|
description: item.excerpt,
|
|
360
242
|
activePath: "/thoughts/",
|
|
361
243
|
styleHref: styleHref(1 + slugDepth(item.slug), stylesheet),
|
|
362
|
-
children: (h("
|
|
363
|
-
h(
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
h("h1", null, item.title),
|
|
367
|
-
h("div", { className: "meta" },
|
|
368
|
-
item.dateKey,
|
|
369
|
-
item.timeLabel ? ` · ${item.timeLabel}` : "")),
|
|
370
|
-
h("div", { className: "prose", dangerouslySetInnerHTML: { __html: item.html } })))),
|
|
244
|
+
children: (h(Page, { title: item.title, eyebrow: "Thought" },
|
|
245
|
+
h(MetaRow, { items: [{ label: item.dateKey }, ...(item.timeLabel ? [{ label: item.timeLabel }] : [])] }),
|
|
246
|
+
h(Prose, { as: "article", dangerouslySetInnerHTML: { __html: withoutLeadingHeading(item.html) } }),
|
|
247
|
+
h(Tags, { item: item }))),
|
|
371
248
|
});
|
|
372
249
|
}
|
|
373
250
|
export function aboutPage(theme = blogTheme, site = DEFAULT_SITE, stylesheet = DEFAULT_THEME_STYLESHEET) {
|
|
@@ -378,19 +255,14 @@ export function aboutPage(theme = blogTheme, site = DEFAULT_SITE, stylesheet = D
|
|
|
378
255
|
title: "About",
|
|
379
256
|
activePath: "/about/",
|
|
380
257
|
styleHref: styleHref(1, stylesheet),
|
|
381
|
-
children: (h(
|
|
382
|
-
h("div", { className: "avatar", "aria-hidden": "true" }, site.images?.about ? (h("img", { src: `../${site.images.about}`, alt: "", decoding: "async" })) : (h("span", { className: "avatar-initial" }, Array.from(site.name.trim())[0] ?? "M"))),
|
|
383
|
-
about ? (h(
|
|
384
|
-
|
|
385
|
-
about.
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
h(DoodleGithubIcon, null),
|
|
390
|
-
h("span", { className: "github-copy" },
|
|
391
|
-
h("span", null, link.label),
|
|
392
|
-
h("strong", null, link.handle)),
|
|
393
|
-
h(DoodleExternalArrow, null)))))) : null)) : (h("h1", null, site.name)))),
|
|
258
|
+
children: (h(Page, { eyebrow: "About", title: about?.heading ?? site.name },
|
|
259
|
+
h("div", { className: "site-avatar", "aria-hidden": "true" }, site.images?.about ? (h("img", { src: `../${site.images.about}`, alt: "", decoding: "async" })) : (h("span", { className: "avatar-initial" }, Array.from(site.name.trim())[0] ?? "M"))),
|
|
260
|
+
about ? (h(Prose, null, about.paragraphs.map((paragraph) => (h("p", null, paragraph))))) : null,
|
|
261
|
+
about?.links?.length ? (h(Section, { title: about.linksHeading ?? "Find me" },
|
|
262
|
+
h(EntryList, null, about.links.map((link) => (h(Entry, { title: h("a", { className: "site-icon-label", href: link.href, target: "_blank", rel: "me noopener noreferrer" },
|
|
263
|
+
link.handle,
|
|
264
|
+
" ",
|
|
265
|
+
h(Icon, { name: "arrow-up-right", size: 16 })), eyebrow: link.label })))))) : null)),
|
|
394
266
|
});
|
|
395
267
|
}
|
|
396
268
|
function skillUrl(skill) {
|
|
@@ -402,20 +274,12 @@ function skillInstallCommand(site, skill) {
|
|
|
402
274
|
: skill.sourceBasePath;
|
|
403
275
|
}
|
|
404
276
|
function SkillCard({ skill, site }) {
|
|
405
|
-
return (h(
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
h(
|
|
410
|
-
h("
|
|
411
|
-
h("span", null, skill.description)),
|
|
412
|
-
h("span", { className: "skill-card-foot" },
|
|
413
|
-
h("span", null,
|
|
414
|
-
skill.files.length,
|
|
415
|
-
" Markdown files \u00B7 ",
|
|
416
|
-
skill.relations.length,
|
|
417
|
-
" references"),
|
|
418
|
-
h("span", { className: "skill-open" }, "Open directory\u00A0 \u2192"))));
|
|
277
|
+
return (h(Entry, { href: skillUrl(skill), title: skill.name, description: skill.description, eyebrow: skill.scope === "project" ? "Project Skill" : "Public Skill", meta: h(MetaRow, { items: [
|
|
278
|
+
{ label: `${skill.files.length} Markdown files` },
|
|
279
|
+
{ label: `${skill.relations.length} references` },
|
|
280
|
+
] }) },
|
|
281
|
+
h(Text, { variant: "caption" },
|
|
282
|
+
h("code", { className: "skill-command-text" }, skill.scope === "public" ? skillInstallCommand(site, skill) : skill.sourceBasePath))));
|
|
419
283
|
}
|
|
420
284
|
function skillTree(files) {
|
|
421
285
|
const root = { name: "", children: [] };
|
|
@@ -459,7 +323,7 @@ function SkillGraphNodeView({ node }) {
|
|
|
459
323
|
function SkillRelationGraph({ skill, direction }) {
|
|
460
324
|
const graph = layoutSkillGraph(skill, direction);
|
|
461
325
|
const markerId = `skill-arrow-${skill.slug}-${direction.toLowerCase()}`;
|
|
462
|
-
return (h("svg", { className: `skill-graph-svg skill-graph-${direction.toLowerCase()}`, viewBox: `0 0 ${graph.width} ${graph.height}`, "aria-label": `${skill.name} file reference graph` },
|
|
326
|
+
return (h("svg", { className: `skill-graph-svg skill-graph-${direction.toLowerCase()}`, viewBox: `0 0 ${graph.width} ${graph.height}`, width: graph.width, height: graph.height, "aria-label": `${skill.name} file reference graph` },
|
|
463
327
|
h("defs", null,
|
|
464
328
|
h("marker", { id: markerId, viewBox: "0 0 10 10", refX: "8", refY: "5", markerWidth: "5", markerHeight: "5", orient: "auto-start-reverse" },
|
|
465
329
|
h("path", { className: "skill-graph-arrow", d: "M 0 0 L 10 5 L 0 10 z" }))),
|
|
@@ -499,9 +363,8 @@ function SkillRelations({ skill }) {
|
|
|
499
363
|
h("strong", null, missingNodes.length),
|
|
500
364
|
" missing targets")),
|
|
501
365
|
hasRelations ? (h(Fragment, null,
|
|
502
|
-
h("div", { className: `skill-graph-canvas${compactGraph ? " compact" : ""}
|
|
503
|
-
h(SkillRelationGraph, { skill: skill, direction: "LR" }),
|
|
504
|
-
h(SkillRelationGraph, { skill: skill, direction: "TB" })),
|
|
366
|
+
h("div", { className: `skill-graph-canvas${compactGraph ? " compact" : ""}`, tabIndex: 0, role: "region", "aria-label": "Scrollable file reference graph" },
|
|
367
|
+
h(SkillRelationGraph, { skill: skill, direction: "LR" })),
|
|
505
368
|
h("section", { className: "skill-reading-paths", "aria-labelledby": `${skill.slug}-paths` },
|
|
506
369
|
h("h3", { id: `${skill.slug}-paths` }, "Where references happen"),
|
|
507
370
|
h("ol", null, skill.relations.map((relation) => {
|
|
@@ -509,7 +372,7 @@ function SkillRelations({ skill }) {
|
|
|
509
372
|
return (h("li", { className: sourceFile?.reachable ? "" : "unreachable" },
|
|
510
373
|
h("span", { className: "skill-reading-edge" },
|
|
511
374
|
h("code", { title: relation.source }, relation.source),
|
|
512
|
-
h(
|
|
375
|
+
h(Icon, { name: "arrow-right", size: 14 }),
|
|
513
376
|
h("code", { title: relation.target }, relation.target)),
|
|
514
377
|
h("span", { className: "skill-reading-context" }, relation.contexts.map((context) => (h("span", null,
|
|
515
378
|
context.section,
|
|
@@ -636,24 +499,11 @@ export function skillsIndexPage(skills, theme = blogTheme, site = DEFAULT_SITE,
|
|
|
636
499
|
description: "Methods and working conventions that can be handed to an Agent.",
|
|
637
500
|
activePath: "/skills/",
|
|
638
501
|
styleHref: styleHref(1, stylesheet),
|
|
639
|
-
children: (h(
|
|
640
|
-
h("
|
|
641
|
-
|
|
642
|
-
h(
|
|
643
|
-
|
|
644
|
-
h("section", { className: "skill-group", "aria-labelledby": "public-skills-heading" },
|
|
645
|
-
h("header", { className: "skill-group-head" },
|
|
646
|
-
h("h2", { id: "public-skills-heading" }, "Public Skills"),
|
|
647
|
-
h("span", null, "Public content")),
|
|
648
|
-
publicSkills.length > 0 ? (h("div", { className: "skill-list" }, publicSkills.map((skill) => (h(SkillCard, { skill: skill, site: site }))))) : (h("p", { className: "skill-group-empty" }, "Public Skills have no content yet."))),
|
|
649
|
-
projectSkills.length > 0 ? (h("section", { className: "skill-group project-skills", "aria-labelledby": "project-skills-heading" },
|
|
650
|
-
h("header", { className: "skill-group-head" },
|
|
651
|
-
h("div", null,
|
|
652
|
-
h("h2", { id: "project-skills-heading" }, "Project Skills"),
|
|
653
|
-
h("small", null, "Development and content workflows used inside this project")),
|
|
654
|
-
h("span", null, ".agents/skills/")),
|
|
655
|
-
h("div", { className: "skill-list" }, projectSkills.map((skill) => (h(SkillCard, { skill: skill, site: site })))))) : null,
|
|
656
|
-
h("p", { className: "skills-prototype-note" }, "The reference graph starts from SKILL.md and is generated at build time from Markdown links."))),
|
|
502
|
+
children: (h(Page, { eyebrow: "~/skills", title: "Skills", description: "Methods shared publicly and usable directly by an Agent." },
|
|
503
|
+
h(Section, { title: "Public Skills" }, publicSkills.length ? (h(EntryList, null, publicSkills.map((skill) => (h(SkillCard, { skill: skill, site: site }))))) : (h(Text, { variant: "secondary" }, "Public Skills have no content yet."))),
|
|
504
|
+
projectSkills.length ? (h(Section, { title: "Project Skills", description: "Development and content workflows used inside this project" },
|
|
505
|
+
h(EntryList, null, projectSkills.map((skill) => (h(SkillCard, { skill: skill, site: site })))))) : null,
|
|
506
|
+
h(Text, { variant: "caption" }, "The reference graph starts from SKILL.md and is generated at build time from Markdown links."))),
|
|
657
507
|
});
|
|
658
508
|
}
|
|
659
509
|
export function skillPage(skill, theme = blogTheme, site = DEFAULT_SITE, stylesheet = DEFAULT_THEME_STYLESHEET) {
|
|
@@ -663,20 +513,26 @@ export function skillPage(skill, theme = blogTheme, site = DEFAULT_SITE, stylesh
|
|
|
663
513
|
site,
|
|
664
514
|
theme,
|
|
665
515
|
title: skill.name,
|
|
516
|
+
wide: true,
|
|
666
517
|
description: skill.description,
|
|
667
518
|
activePath: "/skills/",
|
|
668
519
|
styleHref: skill.scope === "public"
|
|
669
520
|
? styleHref(1 + slugDepth(skill.slug), stylesheet)
|
|
670
521
|
: styleHref(2 + slugDepth(skill.slug), stylesheet),
|
|
671
|
-
children: (h("
|
|
672
|
-
h("a", { className: "skill-back", href: "/skills/" },
|
|
522
|
+
children: (h(Page, { width: "full", className: "skill-page", title: skill.name, eyebrow: "Skill", description: skill.description },
|
|
523
|
+
h("a", { className: "skill-back site-icon-label", href: "/skills/" },
|
|
524
|
+
h(Icon, { name: "arrow-left", size: 14 }),
|
|
525
|
+
" All Skills"),
|
|
673
526
|
h("header", { className: "skill-browser-head" },
|
|
674
527
|
h("span", { className: "skill-command" },
|
|
675
528
|
skill.scope === "project" ? (h("span", { className: "skill-scope-badge" }, "Project Skill \u00B7 Internal")) : null,
|
|
676
529
|
h("code", null, command)),
|
|
677
530
|
h("span", { className: "skill-browser-actions" },
|
|
678
531
|
h("button", { type: "button", "data-copy-command": command }, skill.scope === "public" ? "Copy" : "Copy path"),
|
|
679
|
-
site.repositorySourceUrl ? (h("a", { href: `${site.repositorySourceUrl}/${skill.sourceBasePath}`, target: "_blank", rel: "noopener noreferrer" },
|
|
532
|
+
site.repositorySourceUrl ? (h("a", { className: "site-icon-label", href: `${site.repositorySourceUrl}/${skill.sourceBasePath}`, target: "_blank", rel: "noopener noreferrer" },
|
|
533
|
+
h(GithubIcon, null),
|
|
534
|
+
" GitHub ",
|
|
535
|
+
h(Icon, { name: "arrow-up-right", size: 14 }))) : null)),
|
|
680
536
|
h("div", { className: "skill-stage", "data-skill-browser": true },
|
|
681
537
|
h("nav", { className: "skill-view-tabs", "aria-label": "Skill view mode" },
|
|
682
538
|
h("button", { type: "button", "data-skill-view": "files", "aria-pressed": "true" }, "File browser"),
|
|
@@ -687,8 +543,11 @@ export function skillPage(skill, theme = blogTheme, site = DEFAULT_SITE, stylesh
|
|
|
687
543
|
h("header", { className: "skill-viewer-bar" },
|
|
688
544
|
h("span", { "data-current-file": true }, firstFile.path),
|
|
689
545
|
h("span", null, "Markdown")),
|
|
690
|
-
skill.files.map((file, index) => (h("article",
|
|
691
|
-
|
|
546
|
+
skill.files.map((file, index) => (h(Prose, { as: "article", className: `skill-file-panel${index === 0 ? " active" : ""}`, "data-skill-panel": file.path, hidden: index !== 0, dangerouslySetInnerHTML: {
|
|
547
|
+
// The page owns h1; file headings nest under it without dropping any content.
|
|
548
|
+
__html: Bun.markdown
|
|
549
|
+
.html(file.content, { tagFilter: true })
|
|
550
|
+
.replace(/<(\/?)h([1-6])(\s[^>]*)?>/g, (_, closing, level, attributes = "") => `<${closing}h${Math.min(6, Number(level) + 1)}${attributes}>`),
|
|
692
551
|
} }))))),
|
|
693
552
|
h(SkillRelations, { skill: skill })),
|
|
694
553
|
h("script", { dangerouslySetInnerHTML: { __html: SKILL_BROWSER_SCRIPT } }))),
|