website-xp-phone 2.2.12 → 2.4.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/.github/workflows/ci.yml +2 -2
- package/README.md +17 -3
- package/build/blogDirsPlugin.ts +100 -0
- package/build/env.ts +4 -1
- package/build/routeSkeletonsPlugin.ts +44 -2
- package/package.json +14 -10
- package/public/blog/archive/eighth-post-lost-in-the-sauce.json +36 -0
- package/public/blog/archive/noise/eleventh-post-discussion-java-gist.md +5 -0
- package/public/blog/archive/noise/fifteenth-post-very-rare-windows-funny.md +8 -0
- package/public/blog/archive/noise/fourth-post-meta-blog.md +3 -0
- package/public/blog/archive/noise/sixteenth-post-meta-fantasy-blog.md +4 -0
- package/public/blog/archive/noise/tenth-post-meta-funny-redacted-and-timetravelled.md +3 -0
- package/public/blog/archive/noise/twelfth-post-mixing-phase-technique-audio-music.md +48 -0
- package/public/blog/archive/noise/welcome-back-ramble-meta.md +6 -0
- package/public/blog/archive/noise/welcome-to-my-blog-meta-blog-welcome-to-my-website.md +7 -0
- package/public/blog/archive/seventh-post-lie-theory-na2000.json +22 -0
- package/public/blog/archive/sophus-lie.json +36 -0
- package/public/blog/hlwm_and_herbstutil.md +11 -0
- package/public/blog/random/hlwm.md +8 -0
- package/public/blog/writing/hot-action-under-a-cold-moon.json +9 -0
- package/public/checksums.txt +91 -66
- package/public/documents/drift-report.json +42 -28
- package/render.yaml +11 -1
- package/scripts/mutable-assets.mjs +13 -22
- package/scripts/refresh-content.mjs +53 -32
- package/scripts/refresh-soundcloud.mjs +221 -136
- package/scripts/write-dist-checksums.mjs +48 -4
- package/src/content/blog.json +16 -363
- package/src/content/blogDirs.ts +196 -0
- package/src/content/configs.json +1 -1
- package/src/content/contacts.json +2 -2
- package/src/content/includes/make-recipes.md +18 -0
- package/src/content/index.ts +156 -57
- package/src/content/music-ext.json +1 -1
- package/src/content/projects/doftiles.json +88 -4
- package/src/content/projects/herbctl.json +58 -0
- package/src/content/projects/herbstutil.json +50 -20
- package/src/content/projects/on-deploy.json +57 -0
- package/src/content/projects/polyframes.json +83 -0
- package/src/content/schema.ts +7 -4
- package/src/content/sections.json +11 -10
- package/src/content/soundcloud.json +95 -47
- package/src/lib/clippy.ts +29 -8
- package/src/lib/embeds.ts +43 -24
- package/src/lib/history.ts +152 -0
- package/src/lib/markdown.tsx +19 -22
- package/src/lib/rehypeYoutubeEmbed.ts +65 -0
- package/src/lib/sanitizeSchema.ts +32 -0
- package/src/lib/scrollTo.ts +45 -0
- package/src/lib/signals.tsx +271 -0
- package/src/main.tsx +20 -4
- package/src/pages/BlogDirPage.tsx +36 -0
- package/src/pages/BlogPostPage.tsx +76 -3
- package/src/pages/ProjectPage.tsx +9 -3
- package/src/pages/WowPage.tsx +8 -3
- package/src/pages/index.ts +2 -0
- package/src/shell/App.tsx +14 -8
- package/src/shell/Clippy.tsx +13 -3
- package/src/shell/MenuBar.tsx +7 -4
- package/src/shell/resolveRoute.ts +41 -2
- package/src/shell/routerSignals.ts +34 -0
- package/src/styles/extras.css +27 -0
- package/src/styles/layout.css +2 -2
- package/src/styles/menu.css +1 -1
- package/src/styles/window.css +19 -9
- package/src/themes/pageSlide/index.ts +120 -42
- package/src/themes/pageSlide/pageSlide.css +20 -9
- package/src/virtual.d.ts +14 -0
- package/src/window/MaximizedWindow.tsx +97 -64
- package/src/window/OkButton.tsx +42 -25
- package/src/window/PageWindows.tsx +7 -0
- package/src/window/TitleBar.tsx +3 -1
- package/src/window/Window.tsx +132 -87
- package/src/window/closeSounds.ts +27 -0
- package/src/window/model.ts +11 -0
- package/src/window/state.tsx +290 -50
- package/src/window/themes.ts +23 -2
- package/test/content.test.js +15 -10
- package/test/deploy-pipeline.test.js +73 -0
- package/test/embeds.test.js +89 -0
- package/test/markdown-tables.test.js +96 -0
- package/test/mutable-assets.test.js +16 -4
- package/test/route-skeletons.test.js +38 -0
- package/test/soundcloud-refresh.test.js +68 -0
- package/test/youtubeEmbed.test.js +157 -0
- package/tsconfig.node.tsbuildinfo +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.config.ts +7 -1
- package/.opencode/cache/index.akinevz.html +0 -54
- package/public/blog/4th.md +0 -28
- package/public/blog/wsl.1.md +0 -40
- package/src/window/hidden.ts +0 -22
- /package/public/blog/{ → archive/noise/}/321/200/321/203/320/275/320/270/321/201/321/207-/320/263/320/273/320/276/321/201/321/201/320/260/321/200/320/270/320/271.md" +0 -0
- /package/src/content/{characters.json → includes/characters.json} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { blogDirListed, blogDirListing, findBlogDir } from "@/content";
|
|
2
|
+
import { useSignals } from "@/lib/signals";
|
|
3
|
+
import { useLocation } from "react-router-dom";
|
|
4
|
+
import { PageWindows } from "@/window";
|
|
5
|
+
|
|
6
|
+
/** A configured directory under /blog/ (src/content/blogDirs.ts): the
|
|
7
|
+
* page is the directory's LISTING — one window naming each shown file,
|
|
8
|
+
* linked to its post page or raw asset. The route exists only for
|
|
9
|
+
* configured directories (resolveRoute), so an unconfigured pathname
|
|
10
|
+
* renders nothing here.
|
|
11
|
+
*
|
|
12
|
+
* The title-bar Minimize and ✕ fold UP a level: the page's onLeave (the
|
|
13
|
+
* depth-0 fold — the same wiring that returns a project page to its
|
|
14
|
+
* index) navigates to the directory above, with the fold animation and
|
|
15
|
+
* the navigating sounds the window system already owns. The parent is
|
|
16
|
+
* the literal parent path; when that parent is a blog subdirectory that
|
|
17
|
+
* does not list (an opted-out shelf), the fold lands on the blog root
|
|
18
|
+
* instead of a dead end. */
|
|
19
|
+
export const BlogDirPage = () => {
|
|
20
|
+
const { pathname } = useLocation();
|
|
21
|
+
const { dispatch } = useSignals();
|
|
22
|
+
const listing = blogDirListing(pathname);
|
|
23
|
+
if (!listing) return null;
|
|
24
|
+
const parent = pathname.replace(/\/+$/, "").replace(/\/[^/]*$/, "") || "/";
|
|
25
|
+
const parentLists =
|
|
26
|
+
parent === "/blog" ||
|
|
27
|
+
(Boolean(findBlogDir(parent)) && blogDirListed(parent));
|
|
28
|
+
return (
|
|
29
|
+
<PageWindows
|
|
30
|
+
content={listing}
|
|
31
|
+
onLeave={() =>
|
|
32
|
+
dispatch("app:navigate", { to: parentLists ? parent : "/blog" })
|
|
33
|
+
}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -1,10 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
blogDirListed,
|
|
3
|
+
findBlogDir,
|
|
4
|
+
type Section,
|
|
5
|
+
type ThemeName,
|
|
6
|
+
} from "@/content";
|
|
7
|
+
import { useSignals } from "@/lib/signals";
|
|
8
|
+
import { useEffect, useMemo, useState } from "react";
|
|
2
9
|
import { useLocation } from "react-router-dom";
|
|
3
10
|
import { PageWindows } from "@/window";
|
|
4
11
|
|
|
5
|
-
/** A markdown file from public/blog/, addressed directly by its URL.
|
|
12
|
+
/** A markdown file from public/blog/, addressed directly by its URL.
|
|
13
|
+
*
|
|
14
|
+
* Posts may also be authored as .json Section trees (the same shape the
|
|
15
|
+
* content JSON files use). The parent directory's generated snapshot
|
|
16
|
+
* (src/content/blogDirs.json) tells the two forms apart: a `<name>.json`
|
|
17
|
+
* entry in the listing means the address renders THAT file — fetched at
|
|
18
|
+
* runtime and mounted through the same PageWindows tree any authored
|
|
19
|
+
* post uses; everything else embeds the markdown `<path>.md`.
|
|
20
|
+
*
|
|
21
|
+
* A post INSIDE a listed blog directory folds UP a level: its title-bar
|
|
22
|
+
* Minimize and ✕ navigate back to the parent directory's listing — the
|
|
23
|
+
* same depth-0 onLeave fold the listing page itself uses. Posts at the
|
|
24
|
+
* /blog root keep the plain page behaviour (their parent is the curated
|
|
25
|
+
* blog page, not a directory listing). */
|
|
6
26
|
export const BlogPostPage = () => {
|
|
7
27
|
const { pathname } = useLocation();
|
|
28
|
+
const { dispatch } = useSignals();
|
|
8
29
|
const content = useMemo(() => {
|
|
9
30
|
const src = decodeURI(pathname);
|
|
10
31
|
return {
|
|
@@ -12,5 +33,57 @@ export const BlogPostPage = () => {
|
|
|
12
33
|
embed: `${pathname}.md`,
|
|
13
34
|
};
|
|
14
35
|
}, [pathname]);
|
|
15
|
-
|
|
36
|
+
const isJson = useMemo(() => {
|
|
37
|
+
const parent = pathname.replace(/\/+$/, "").replace(/\/[^/]*$/, "") || "/";
|
|
38
|
+
const base = decodeURI(pathname).split("/").pop() ?? "";
|
|
39
|
+
return Boolean(findBlogDir(parent)?.files.includes(`${base}.json`));
|
|
40
|
+
}, [pathname]);
|
|
41
|
+
const [jsonPost, setJsonPost] = useState<Section | null>(null);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!isJson) return;
|
|
44
|
+
let live = true;
|
|
45
|
+
setJsonPost(null);
|
|
46
|
+
fetch(`${pathname}.json`)
|
|
47
|
+
.then((r) => {
|
|
48
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}`);
|
|
49
|
+
return r.json() as Promise<Section>;
|
|
50
|
+
})
|
|
51
|
+
.then((section) => {
|
|
52
|
+
if (live) setJsonPost(section);
|
|
53
|
+
})
|
|
54
|
+
.catch(() => {
|
|
55
|
+
if (live) setJsonPost(null);
|
|
56
|
+
});
|
|
57
|
+
return () => {
|
|
58
|
+
live = false;
|
|
59
|
+
};
|
|
60
|
+
}, [isJson, pathname]);
|
|
61
|
+
const parent = pathname.replace(/\/+$/, "").replace(/\/[^/]*$/, "") || "/";
|
|
62
|
+
const parentDir = findBlogDir(parent);
|
|
63
|
+
const foldsUp = Boolean(parentDir) && blogDirListed(parentDir?.path ?? "");
|
|
64
|
+
// A .md post's embed forces its window expanded; a .json post's tree
|
|
65
|
+
// must read the same way — the root window opens (theme "open" merged
|
|
66
|
+
// into whatever the author set) so its children mount, exactly like
|
|
67
|
+
// the authored posts on the blog page itself.
|
|
68
|
+
const post = useMemo(() => {
|
|
69
|
+
if (!isJson) return content;
|
|
70
|
+
if (!jsonPost) return null;
|
|
71
|
+
const themes = jsonPost.theme
|
|
72
|
+
? Array.isArray(jsonPost.theme)
|
|
73
|
+
? jsonPost.theme
|
|
74
|
+
: [jsonPost.theme]
|
|
75
|
+
: [];
|
|
76
|
+
return themes.includes("open")
|
|
77
|
+
? jsonPost
|
|
78
|
+
: { ...jsonPost, theme: [...themes, "open"] as ThemeName[] };
|
|
79
|
+
}, [isJson, jsonPost, content]);
|
|
80
|
+
if (!post) return null;
|
|
81
|
+
return (
|
|
82
|
+
<PageWindows
|
|
83
|
+
content={post}
|
|
84
|
+
onLeave={
|
|
85
|
+
foldsUp ? () => dispatch("app:navigate", { to: parent }) : undefined
|
|
86
|
+
}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
16
89
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { useLocation
|
|
1
|
+
import { useLocation } from "react-router-dom";
|
|
2
2
|
import { projectPath, projects, type Item, type Section } from "@/content";
|
|
3
3
|
import { normalizePath } from "@/shell/resolveRoute";
|
|
4
|
+
import { useSignals } from "@/lib/signals";
|
|
4
5
|
import { PageWindows } from "@/window";
|
|
5
6
|
|
|
6
7
|
const toItems = (content: Section["content"]): Item[] =>
|
|
7
8
|
content === undefined ? [] : Array.isArray(content) ? content : [content];
|
|
8
9
|
|
|
9
10
|
export const ProjectPage = () => {
|
|
10
|
-
|
|
11
|
+
// Leaving the page is a command, not a router call — the shell owns
|
|
12
|
+
// the single router-aware "app:navigate" handler.
|
|
13
|
+
const { dispatch } = useSignals();
|
|
11
14
|
const path = normalizePath(useLocation().pathname);
|
|
12
15
|
const project = projects.find((p) => projectPath(p) === path);
|
|
13
16
|
if (!project) return null;
|
|
@@ -17,6 +20,9 @@ export const ProjectPage = () => {
|
|
|
17
20
|
content: toItems(project.content.content),
|
|
18
21
|
};
|
|
19
22
|
return (
|
|
20
|
-
<PageWindows
|
|
23
|
+
<PageWindows
|
|
24
|
+
content={content}
|
|
25
|
+
onLeave={() => dispatch("app:navigate", { to: "/projects" })}
|
|
26
|
+
/>
|
|
21
27
|
);
|
|
22
28
|
};
|
package/src/pages/WowPage.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo, useState, type FormEvent } from "react";
|
|
2
|
-
import { useNavigate } from "react-router-dom";
|
|
3
2
|
import { addons, characters } from "@/content";
|
|
3
|
+
import { useSignals } from "@/lib/signals";
|
|
4
4
|
import { PageWindows } from "@/window";
|
|
5
5
|
|
|
6
6
|
type Feedback = { kind: "error" | "success"; text: string } | null;
|
|
@@ -22,7 +22,9 @@ function download(href: string, name: string) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function DownloadForm() {
|
|
25
|
-
|
|
25
|
+
// Cancelling is a command, not a router call — the shell owns the one
|
|
26
|
+
// router-aware "app:navigate" handler.
|
|
27
|
+
const { dispatch } = useSignals();
|
|
26
28
|
const [username, setUsername] = useState("");
|
|
27
29
|
const [date, setDate] = useState("");
|
|
28
30
|
const [feedback, setFeedback] = useState<Feedback>(null);
|
|
@@ -85,7 +87,10 @@ function DownloadForm() {
|
|
|
85
87
|
</div>
|
|
86
88
|
<div className="form-actions">
|
|
87
89
|
<button type="submit">Verify & Download</button>
|
|
88
|
-
<button
|
|
90
|
+
<button
|
|
91
|
+
type="button"
|
|
92
|
+
onClick={() => dispatch("app:navigate", { to: "/" })}
|
|
93
|
+
>
|
|
89
94
|
Cancel
|
|
90
95
|
</button>
|
|
91
96
|
</div>
|
package/src/pages/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from "react";
|
|
2
2
|
import { AddonsPage } from "./AddonsPage";
|
|
3
|
+
import { BlogDirPage } from "./BlogDirPage";
|
|
3
4
|
import { BlogPage } from "./BlogPage";
|
|
4
5
|
import { BlogPostPage } from "./BlogPostPage";
|
|
5
6
|
import { ContactPage } from "./ContactPage";
|
|
@@ -16,6 +17,7 @@ import { WowPage } from "./WowPage";
|
|
|
16
17
|
/** Maps the `page` names in content/pages.json to components. */
|
|
17
18
|
export const pageRegistry: Record<string, ComponentType> = {
|
|
18
19
|
AddonsPage,
|
|
20
|
+
BlogDirPage,
|
|
19
21
|
BlogPage,
|
|
20
22
|
BlogPostPage,
|
|
21
23
|
ConfigsPage,
|
package/src/shell/App.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
|
-
import { Navigate, useLocation } from "react-router-dom";
|
|
2
|
+
import { Navigate, useLocation, useNavigate } from "react-router-dom";
|
|
3
3
|
import { ToastContainer } from "react-toastify";
|
|
4
4
|
import { pageRegistry } from "@/pages";
|
|
5
5
|
import { NotFoundPage } from "@/pages/NotFoundPage";
|
|
6
6
|
import { applyStoredTheme } from "@/lib/theme";
|
|
7
|
+
import { bindNavigate } from "./routerSignals";
|
|
7
8
|
import { Clippy } from "./Clippy";
|
|
8
9
|
import { MenuBar } from "./MenuBar";
|
|
9
10
|
import { resolveRoute } from "./resolveRoute";
|
|
@@ -16,6 +17,13 @@ export function App() {
|
|
|
16
17
|
const { pathname, hash } = useLocation();
|
|
17
18
|
const route = resolveRoute(pathname);
|
|
18
19
|
const Page = pageRegistry[route.page] ?? NotFoundPage;
|
|
20
|
+
const navigate = useNavigate();
|
|
21
|
+
// The shell keeps only the router awareness: the app:navigate handler
|
|
22
|
+
// attached at boot (routerSignals) performs dispatches with THIS
|
|
23
|
+
// navigate, bound here against the router context. Page-load
|
|
24
|
+
// monitoring is the attached handlers' business too — the boot route
|
|
25
|
+
// is announced there, transitions by the pageSlide theme.
|
|
26
|
+
bindNavigate(navigate);
|
|
19
27
|
|
|
20
28
|
const blank = pathname === "/" && hash.toLowerCase() === FEEF69_HASH;
|
|
21
29
|
|
|
@@ -34,13 +42,11 @@ export function App() {
|
|
|
34
42
|
return (
|
|
35
43
|
<>
|
|
36
44
|
<MenuBar />
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<Page />
|
|
43
|
-
</section>
|
|
45
|
+
{/* main IS the page: one element carries the scroll container and the
|
|
46
|
+
page styling — an extra <section.page> inside it only added a
|
|
47
|
+
nesting level. Pages differ in content, never in shell structure. */}
|
|
48
|
+
<main className="page" key={route.path}>
|
|
49
|
+
<Page />
|
|
44
50
|
</main>
|
|
45
51
|
<Clippy />
|
|
46
52
|
<ToastContainer position="bottom-right" />
|
package/src/shell/Clippy.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
subscribeClippy,
|
|
7
7
|
toggleClippyList,
|
|
8
8
|
} from "@/lib/clippy";
|
|
9
|
-
import {
|
|
9
|
+
import { useSignalValue } from "@/lib/signals";
|
|
10
10
|
|
|
11
11
|
type Corner = "tl" | "tr" | "bl" | "br";
|
|
12
12
|
|
|
@@ -20,11 +20,14 @@ const ARRIVE_MS = 600;
|
|
|
20
20
|
|
|
21
21
|
/** Hidden mascot; summoning logic lives in lib/clippy. Draggable & snappy. */
|
|
22
22
|
export function Clippy() {
|
|
23
|
-
const { visible, bubble, saysNo, listOpen } = useSyncExternalStore(
|
|
23
|
+
const { visible, bubble, saysNo, offering, listOpen } = useSyncExternalStore(
|
|
24
24
|
subscribeClippy,
|
|
25
25
|
getClippyState,
|
|
26
26
|
);
|
|
27
|
-
|
|
27
|
+
// The parked-window roster is a retained signal: Clippy reads its
|
|
28
|
+
// snapshot at render time (the bus keeps the last one) and manages
|
|
29
|
+
// no bridge of its own.
|
|
30
|
+
const hidden = useSignalValue("window:hidden");
|
|
28
31
|
useEffect(attachClippy, []);
|
|
29
32
|
|
|
30
33
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
@@ -199,9 +202,16 @@ export function Clippy() {
|
|
|
199
202
|
</div>
|
|
200
203
|
)}
|
|
201
204
|
{!listOpen && bubble && (
|
|
205
|
+
// ONE bubble at a time, by construction: every lib/clippy state
|
|
206
|
+
// transition clears its sibling flags in the SAME committed set()
|
|
207
|
+
// (offer clears saysNo, the veto clears nothing else, the hint
|
|
208
|
+
// clears offering, the list masks the bubble outright) — so the
|
|
209
|
+
// precedence here never renders two texts side by side.
|
|
202
210
|
<div className="clippy-bubble" role="status">
|
|
203
211
|
{saysNo ? (
|
|
204
212
|
"haha it said no"
|
|
213
|
+
) : offering ? (
|
|
214
|
+
"oh where did that go?.."
|
|
205
215
|
) : (
|
|
206
216
|
<>
|
|
207
217
|
It looks like you're trying to close something. Try clicking one
|
package/src/shell/MenuBar.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect, useMemo } from "react";
|
|
2
|
-
import { Link, useLocation
|
|
2
|
+
import { Link, useLocation } from "react-router-dom";
|
|
3
3
|
import { getCookie } from "@/lib/cookies";
|
|
4
|
+
import { useSignals } from "@/lib/signals";
|
|
4
5
|
import { visibleMenuItems } from "./menu";
|
|
5
6
|
|
|
6
7
|
const isTyping = (target: EventTarget | null) =>
|
|
@@ -10,7 +11,9 @@ const isTyping = (target: EventTarget | null) =>
|
|
|
10
11
|
|
|
11
12
|
export function MenuBar() {
|
|
12
13
|
const { pathname } = useLocation();
|
|
13
|
-
|
|
14
|
+
// Hotkeys command navigation, so they dispatch: the shell owns the
|
|
15
|
+
// router-aware handler. The <Link> elements below stay real anchors.
|
|
16
|
+
const { dispatch } = useSignals();
|
|
14
17
|
const items = useMemo(
|
|
15
18
|
() => visibleMenuItems(pathname, getCookie("admin") === "akinevz"),
|
|
16
19
|
[pathname],
|
|
@@ -30,11 +33,11 @@ export function MenuBar() {
|
|
|
30
33
|
const item = items.find((i) => i.label[0]?.toLowerCase() === key);
|
|
31
34
|
if (!item) return;
|
|
32
35
|
event.preventDefault();
|
|
33
|
-
navigate
|
|
36
|
+
dispatch("app:navigate", { to: item.href });
|
|
34
37
|
};
|
|
35
38
|
document.addEventListener("keydown", onKey);
|
|
36
39
|
return () => document.removeEventListener("keydown", onKey);
|
|
37
|
-
}, [items,
|
|
40
|
+
}, [items, dispatch]);
|
|
38
41
|
|
|
39
42
|
return (
|
|
40
43
|
<nav className="menu-bar">
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
blogDirFiles,
|
|
3
|
+
blogDirListed,
|
|
4
|
+
findBlogDir,
|
|
5
|
+
routes,
|
|
6
|
+
type Route,
|
|
7
|
+
} from "@/content";
|
|
2
8
|
|
|
3
9
|
export const NOT_FOUND = routes.find((r) => r.path === "/404") as Route;
|
|
4
10
|
|
|
@@ -38,7 +44,40 @@ function blogDocumentRoute(pathname: string): Route {
|
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
export function resolveRoute(pathname: string): Route {
|
|
41
|
-
if (BLOG_PAGE.test(pathname))
|
|
47
|
+
if (BLOG_PAGE.test(pathname)) {
|
|
48
|
+
// Every /blog/** address resolves against the filesystem walk
|
|
49
|
+
// (build/blogDirsPlugin.ts), in order:
|
|
50
|
+
// 1. a directory → its listing page (or 404 when opted out);
|
|
51
|
+
// 2. a file (<base>.md or <base>.json) → its post page;
|
|
52
|
+
// 3. neither → 404. The old fallback embedded "<path>.md" blindly,
|
|
53
|
+
// so removed files AND removed directories rendered whatever the
|
|
54
|
+
// server's SPA fallback handed back — the site inside itself.
|
|
55
|
+
const path = normalizePath(pathname);
|
|
56
|
+
const blogDir = findBlogDir(path);
|
|
57
|
+
if (blogDir) {
|
|
58
|
+
if (!blogDirListed(blogDir.path)) return NOT_FOUND;
|
|
59
|
+
const name =
|
|
60
|
+
blogDir.path.split("/").filter(Boolean).pop() ?? blogDir.path;
|
|
61
|
+
return {
|
|
62
|
+
path: pathname,
|
|
63
|
+
title: `${name} | blog of kine`,
|
|
64
|
+
description: `${name} — the files in this blog directory.`,
|
|
65
|
+
page: "BlogDirPage",
|
|
66
|
+
hidden: true,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const parent = path.replace(/\/+$/, "").replace(/\/[^/]*$/, "") || "/";
|
|
70
|
+
const base = path.split("/").pop() ?? "";
|
|
71
|
+
const files = blogDirFiles(parent);
|
|
72
|
+
// The parent of any /blog/** address is /blog or a walk-known
|
|
73
|
+
// subdirectory; an unknown parent means a missing ancestor — 404.
|
|
74
|
+
if (
|
|
75
|
+
!files ||
|
|
76
|
+
(!files.includes(`${base}.md`) && !files.includes(`${base}.json`))
|
|
77
|
+
)
|
|
78
|
+
return NOT_FOUND;
|
|
79
|
+
return blogDocumentRoute(pathname);
|
|
80
|
+
}
|
|
42
81
|
const path = normalizePath(pathname);
|
|
43
82
|
const route = routes.find((r) => r.path === path);
|
|
44
83
|
return route ?? NOT_FOUND;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { dispatchSignal, onSignal } from "@/lib/signals";
|
|
2
|
+
|
|
3
|
+
/** The shell's router-aware signal behaviours. Handlers live OUT of the
|
|
4
|
+
* components: components only ever dispatch, and the behaviours they
|
|
5
|
+
* trigger are attached once at boot (main.tsx) — no per-component
|
|
6
|
+
* subscription effects. */
|
|
7
|
+
|
|
8
|
+
/** The route-change performer. Until the router binds its navigate,
|
|
9
|
+
* the honest fallback is a full document assign. */
|
|
10
|
+
let go: (to: string) => void = (to) => window.location.assign(to);
|
|
11
|
+
|
|
12
|
+
/** Hands the bus the router's navigate implementation. App binds it
|
|
13
|
+
* while rendering against the router context: an idempotent reference
|
|
14
|
+
* swap of a stable framework function, nothing more. */
|
|
15
|
+
export function bindNavigate(impl: (to: string) => void): void {
|
|
16
|
+
go = impl;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Attaches the shell's handlers and announces the boot route. The
|
|
20
|
+
* handler is app-lifetime; the unsubscribe return is for symmetry —
|
|
21
|
+
* main.tsx calls this once at boot and never detaches. */
|
|
22
|
+
export function attachRouterSignals(): () => void {
|
|
23
|
+
// The navigation command: dispatching arrives from anywhere (menu
|
|
24
|
+
// hotkeys, OK buttons, page Cancel buttons) and lands HERE, then the
|
|
25
|
+
// pageSlide choreography rides the pushState it triggers, exactly as
|
|
26
|
+
// a direct navigate() would.
|
|
27
|
+
const offNavigate = onSignal("app:navigate", ({ to }) => go(to));
|
|
28
|
+
// The boot announcement: the first route is live as soon as the
|
|
29
|
+
// shell attaches — before the first paint, no post-render effect.
|
|
30
|
+
// Every route change from here on arrives as the theme's
|
|
31
|
+
// "page:navigated" (the authoritative commit point it owns).
|
|
32
|
+
dispatchSignal("page:loaded", { path: location.pathname });
|
|
33
|
+
return offNavigate;
|
|
34
|
+
}
|
package/src/styles/extras.css
CHANGED
|
@@ -398,3 +398,30 @@ main.feef69-page {
|
|
|
398
398
|
max-width: 100% !important;
|
|
399
399
|
object-fit: contain;
|
|
400
400
|
}
|
|
401
|
+
|
|
402
|
+
/* Same for inline iframe embeds in content (markdown YouTube links carry
|
|
403
|
+
their own responsive style; this also caps hand-written <iframe>s in raw
|
|
404
|
+
HTML). Music-page players are sized by their own rules and excluded. */
|
|
405
|
+
.window-body iframe:not(.embed) {
|
|
406
|
+
max-width: 100%;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/* Content tables: GFM pipe tables via remark-gfm (added to the Md
|
|
410
|
+
pipeline) — content files stay plain markdown. td/th are missing from
|
|
411
|
+
window.css's color list — color inherits fine, but UA styles leave the
|
|
412
|
+
cells plain (and th centered): give them terminal-style rules and
|
|
413
|
+
even, padded cells. */
|
|
414
|
+
.window-body table {
|
|
415
|
+
border-collapse: collapse;
|
|
416
|
+
width: 100%;
|
|
417
|
+
margin: var(--gap-size) 0;
|
|
418
|
+
font-size: inherit;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.window-body th,
|
|
422
|
+
.window-body td {
|
|
423
|
+
border: 1px solid var(--text-color);
|
|
424
|
+
padding: 0.25em 0.5em;
|
|
425
|
+
text-align: left;
|
|
426
|
+
vertical-align: top;
|
|
427
|
+
}
|
package/src/styles/layout.css
CHANGED
|
@@ -97,7 +97,7 @@ body:has([data-debug-bar]) .page {
|
|
|
97
97
|
|
|
98
98
|
.menu-bar menu a {
|
|
99
99
|
padding: 6px 12px;
|
|
100
|
-
font-size:
|
|
100
|
+
font-size: 16px;
|
|
101
101
|
white-space: nowrap;
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -170,7 +170,7 @@ body:has([data-debug-bar]) .page {
|
|
|
170
170
|
|
|
171
171
|
.minimized-menu-button {
|
|
172
172
|
top: var(--menu-bar-height);
|
|
173
|
-
font-size:
|
|
173
|
+
font-size: 16px !important;
|
|
174
174
|
text-align: center;
|
|
175
175
|
z-index: 98;
|
|
176
176
|
}
|
package/src/styles/menu.css
CHANGED
package/src/styles/window.css
CHANGED
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
the last row of content. */
|
|
20
20
|
--debug-bar-height: 2.5em;
|
|
21
21
|
--clippy-border-flash-color: transparent;
|
|
22
|
-
font-size:
|
|
22
|
+
font-size: 18px;
|
|
23
23
|
}
|
|
24
24
|
/* Force title bar text to dark gray for readability */
|
|
25
25
|
.title-bar-text,
|
|
26
26
|
.title-bar-text a {
|
|
27
27
|
color: #eee !important;
|
|
28
|
-
font-size:
|
|
28
|
+
font-size: 1rem;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
:root.theme-border-flash .window,
|
|
@@ -383,18 +383,13 @@ form#form > label {
|
|
|
383
383
|
|
|
384
384
|
/* In a maximized "centered" window the content hugs the bottom left corner
|
|
385
385
|
and grows upward and rightward as the space allows. */
|
|
386
|
-
.window.maximized[data-theme~="centered"]
|
|
387
|
-
> .maximized-window-body
|
|
388
|
-
> ul {
|
|
386
|
+
.window.maximized[data-theme~="centered"] > .maximized-window-body > ul {
|
|
389
387
|
display: flex;
|
|
390
388
|
flex-direction: column;
|
|
391
389
|
justify-content: flex-end;
|
|
392
390
|
}
|
|
393
391
|
|
|
394
|
-
.window.maximized[data-theme~="centered"]
|
|
395
|
-
> .maximized-window-body
|
|
396
|
-
> ul
|
|
397
|
-
> li {
|
|
392
|
+
.window.maximized[data-theme~="centered"] > .maximized-window-body > ul > li {
|
|
398
393
|
justify-content: flex-start;
|
|
399
394
|
}
|
|
400
395
|
|
|
@@ -427,6 +422,13 @@ form#form > label {
|
|
|
427
422
|
word-break: break-word;
|
|
428
423
|
}
|
|
429
424
|
|
|
425
|
+
/* 98.css pins window text to its Win98 chrome size: .window{font-size:11px}.
|
|
426
|
+
Content windows read like documents — body text follows the root size,
|
|
427
|
+
the same 1rem the pre blocks above (98.css) already render at. */
|
|
428
|
+
.window-body {
|
|
429
|
+
font-size: 0.78rem;
|
|
430
|
+
}
|
|
431
|
+
|
|
430
432
|
/* xp.css sets very large heading sizes; keep markdown headings readable in content windows. */
|
|
431
433
|
.window-body h1 {
|
|
432
434
|
font-size: 1.2rem !important;
|
|
@@ -485,6 +487,14 @@ form#form > label {
|
|
|
485
487
|
}
|
|
486
488
|
}
|
|
487
489
|
|
|
490
|
+
/* YouTube players are 16:9 — size them from their width instead of a
|
|
491
|
+
fixed pixel height (or the mobile square above, which letterboxes
|
|
492
|
+
video). Declared after the media block so it wins the cascade. */
|
|
493
|
+
.embed-youtube {
|
|
494
|
+
aspect-ratio: 16 / 9;
|
|
495
|
+
height: auto;
|
|
496
|
+
}
|
|
497
|
+
|
|
488
498
|
.music-favourite-link-window ul {
|
|
489
499
|
min-width: 100%;
|
|
490
500
|
}
|