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
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
type ThemeDefinition,
|
|
6
6
|
} from "lightdni-jssas-toggle";
|
|
7
7
|
import { playMinimizeClick } from "@/lib/audio";
|
|
8
|
+
import { windowBookmark } from "@/lib/history";
|
|
9
|
+
import { dispatchSignal } from "@/lib/signals";
|
|
10
|
+
import { scrollToId } from "@/lib/scrollTo";
|
|
8
11
|
import { resolveDirection, type Direction } from "./direction";
|
|
9
12
|
import "./pageSlide.css";
|
|
10
13
|
|
|
@@ -47,7 +50,7 @@ const themes: Record<Direction | "parked", ThemeDefinition> = {
|
|
|
47
50
|
/** Initial load ONTO a hyperlinked window target: the slide theme is
|
|
48
51
|
* fully installed (its class drives minimize folds and the navigation
|
|
49
52
|
* hooks) but with a zero-distance entrance — nothing visibly moves
|
|
50
|
-
* while the
|
|
53
|
+
* while the reveal scrolls to the linked section. */
|
|
51
54
|
parked: slide("parked", "0", "0"),
|
|
52
55
|
};
|
|
53
56
|
|
|
@@ -88,8 +91,12 @@ function leaveGhost(): void {
|
|
|
88
91
|
height: `${rect.height}px`,
|
|
89
92
|
minHeight: "0",
|
|
90
93
|
});
|
|
91
|
-
const pageEl = main.
|
|
92
|
-
|
|
94
|
+
const pageEl = main.matches(".page")
|
|
95
|
+
? main
|
|
96
|
+
: main.querySelector<HTMLElement>(".page");
|
|
97
|
+
const ghostPage = ghost.matches(".page")
|
|
98
|
+
? ghost
|
|
99
|
+
: ghost.querySelector<HTMLElement>(".page");
|
|
93
100
|
if (pageEl && ghostPage) {
|
|
94
101
|
// Page padding can depend on elements (debug bar) that unmount with the
|
|
95
102
|
// route: freeze it on the ghost and ease the new page away from it.
|
|
@@ -153,7 +160,7 @@ function leaveGhost(): void {
|
|
|
153
160
|
const leaving = bar.cloneNode(true) as HTMLElement;
|
|
154
161
|
leaving.classList.add("page-slide-bar");
|
|
155
162
|
// Layout rules key off this attribute; the clone must not keep them alive.
|
|
156
|
-
leaving.
|
|
163
|
+
delete leaving.dataset.debugBar;
|
|
157
164
|
document.body.appendChild(leaving);
|
|
158
165
|
// The live bar yields to the clone in the same frame — visibility,
|
|
159
166
|
// not display, so the body padding rules keep reserving its row —
|
|
@@ -184,8 +191,10 @@ function leaveGhost(): void {
|
|
|
184
191
|
|
|
185
192
|
let current = "";
|
|
186
193
|
let originalPushState: History["pushState"] | null = null;
|
|
187
|
-
|
|
188
|
-
|
|
194
|
+
let originalReplaceState: History["replaceState"] | null = null;
|
|
195
|
+
/** Mutes the next transition's fold click: the navigating window ✕
|
|
196
|
+
* declares its own Click.ogg through the bus (closeSounds) — no second
|
|
197
|
+
* click on top of the navigation fold. */
|
|
189
198
|
let clickSuppressed = false;
|
|
190
199
|
|
|
191
200
|
export function suppressNextSlideClick(): void {
|
|
@@ -199,6 +208,9 @@ const isMobileLayout = () => window.matchMedia("(max-width: 768px)").matches;
|
|
|
199
208
|
|
|
200
209
|
function transition(to: string, hash: string): void {
|
|
201
210
|
if (to === current) return;
|
|
211
|
+
// The committed navigation rides the signal bus as a notice —
|
|
212
|
+
// monitoring handlers subscribe; the choreography itself stays here.
|
|
213
|
+
dispatchSignal("page:navigated", { from: current, to });
|
|
202
214
|
if (clickSuppressed) clickSuppressed = false;
|
|
203
215
|
else playMinimizeClick();
|
|
204
216
|
const direction = isMobileLayout()
|
|
@@ -219,48 +231,52 @@ function restartArrival(): void {
|
|
|
219
231
|
const main = document.querySelector("main");
|
|
220
232
|
if (!main) return;
|
|
221
233
|
main.style.animation = "none";
|
|
222
|
-
void main.offsetWidth;
|
|
234
|
+
// void main.offsetWidth;
|
|
223
235
|
main.style.animation = "";
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
236
|
+
// The page element is main itself in the normalized shell (main.page):
|
|
237
|
+
// a nested .page resets separately, in whatever shape the document has.
|
|
238
|
+
const page = main.matches(".page")
|
|
239
|
+
? null
|
|
240
|
+
: main.querySelector<HTMLElement>(".page");
|
|
241
|
+
if (page) {
|
|
242
|
+
page.style.animation = "none";
|
|
243
|
+
// void page.offsetWidth;
|
|
244
|
+
page.style.animation = "";
|
|
229
245
|
}
|
|
230
246
|
}
|
|
231
247
|
|
|
232
248
|
const onPopState = () => {
|
|
249
|
+
const arrival = { path: location.pathname, hash: location.hash };
|
|
233
250
|
if (location.pathname === current) {
|
|
234
|
-
// Same-page history traversal only moves the
|
|
235
|
-
// hyperlinked element into view (inside its scrolling
|
|
251
|
+
// Same-page history traversal only moves the shape of the URL:
|
|
252
|
+
// bring the hyperlinked element into view (inside its scrolling
|
|
253
|
+
// window) — and announce the RETURN, so holders of pre-departure
|
|
254
|
+
// state (the window store, same-path traversals never remount) can
|
|
255
|
+
// repair themselves.
|
|
236
256
|
if (location.hash) scrollToHash(location.hash);
|
|
257
|
+
// A hash-free bookmarked destination names its section in STATE:
|
|
258
|
+
// the same landing rule.
|
|
259
|
+
else scrollToId(windowBookmark() ?? "");
|
|
260
|
+
dispatchSignal("page:returned", arrival);
|
|
237
261
|
return;
|
|
238
262
|
}
|
|
239
263
|
transition(location.pathname, location.hash);
|
|
264
|
+
if (location.hash) scrollToHash(location.hash);
|
|
265
|
+
// A hash-free bookmarked return (the window departures' form — the
|
|
266
|
+
// entry names its section in STATE alone): land on it like any hash
|
|
267
|
+
// target. The reveal is the store's; the landing scroll is ours.
|
|
268
|
+
else scrollToId(windowBookmark() ?? "");
|
|
269
|
+
// History traversal onto another page keeps the same rule: a hashed
|
|
270
|
+
// window target lands on its element (the reveal is the store's),
|
|
271
|
+
// and the traversal is announced as a return.
|
|
272
|
+
dispatchSignal("page:returned", arrival);
|
|
240
273
|
};
|
|
241
274
|
|
|
242
|
-
/** Scrolls the hash element into view —
|
|
243
|
-
*
|
|
244
|
-
* The element can mount after the route commit (lazy pages), hence the
|
|
245
|
-
* deferred retries. */
|
|
275
|
+
/** Scrolls the hash element into view — the aim implementation lives in
|
|
276
|
+
* @/lib/scrollTo, shared with the window system's dismissal landings. */
|
|
246
277
|
function scrollToHash(hash: string, attempts = 12): void {
|
|
247
278
|
const id = decodeURIComponent(hash.slice(1));
|
|
248
|
-
|
|
249
|
-
const tick = () => {
|
|
250
|
-
const el = document.getElementById(id);
|
|
251
|
-
if (el) {
|
|
252
|
-
// Maximized windows are viewport-fixed overlays; scrolling the page
|
|
253
|
-
// behind them just resets the background while the overlay hides
|
|
254
|
-
// it. The restored window scrolls itself to the hash element on
|
|
255
|
-
// dismissal instead.
|
|
256
|
-
if (!el.closest(".maximized-backdrop")) {
|
|
257
|
-
el.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
258
|
-
}
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
if (attempts > 0) window.setTimeout(tick, 100);
|
|
262
|
-
};
|
|
263
|
-
tick();
|
|
279
|
+
scrollToId(id, attempts);
|
|
264
280
|
}
|
|
265
281
|
|
|
266
282
|
/**
|
|
@@ -273,28 +289,88 @@ export function enablePageSlide(): void {
|
|
|
273
289
|
if (originalPushState || typeof document === "undefined") return;
|
|
274
290
|
current = location.pathname;
|
|
275
291
|
// Initial load ONTO a hyperlinked window target (#hash or a blog
|
|
276
|
-
// ?post= the route
|
|
277
|
-
// entrance slide plays from nowhere
|
|
278
|
-
//
|
|
279
|
-
//
|
|
292
|
+
// ?post= the route reveals): install the theme "parked" so the
|
|
293
|
+
// entrance slide plays from nowhere, then land the page on the target
|
|
294
|
+
// — the return-to-page choreography (the reveal is the window store's,
|
|
295
|
+
// the landing scroll is this theme's, like every hash navigation).
|
|
296
|
+
// Minimize folds / navigation hooks stay functional. Plain loads slide
|
|
297
|
+
// in from the top as before.
|
|
280
298
|
const linkedWindowTarget =
|
|
281
|
-
!!location.hash ||
|
|
299
|
+
!!location.hash ||
|
|
300
|
+
new URLSearchParams(location.search).has("post") ||
|
|
301
|
+
// A returned-to entry may name its section in STATE alone (the
|
|
302
|
+
// off-site bookmark is hash-free by design): that arrival is a
|
|
303
|
+
// landing on a target too — parked, reveal + scroll, nothing moves.
|
|
304
|
+
!!windowBookmark();
|
|
282
305
|
applyDirection(linkedWindowTarget ? "parked" : "down");
|
|
306
|
+
if (linkedWindowTarget) {
|
|
307
|
+
if (location.hash) scrollToHash(location.hash);
|
|
308
|
+
// A hash-free bookmarked target (the off-site return's form): the
|
|
309
|
+
// entry names its section in STATE alone — land on it the same way
|
|
310
|
+
// the hash form lands.
|
|
311
|
+
else scrollToId(windowBookmark() ?? "");
|
|
312
|
+
}
|
|
283
313
|
|
|
284
314
|
const original = history.pushState.bind(history);
|
|
285
315
|
originalPushState = history.pushState;
|
|
316
|
+
/** Set inside the pushState wrapper when a same-path commit
|
|
317
|
+
* re-addresses the content: the announcement dispatches only after
|
|
318
|
+
* the original pushState has committed, so repair handlers read the
|
|
319
|
+
* NEW address. */
|
|
320
|
+
let samePathReaddress = false;
|
|
286
321
|
history.pushState = (data, unused, url) => {
|
|
287
322
|
if (url != null) {
|
|
288
323
|
const target = new URL(url, location.href);
|
|
289
324
|
if (target.pathname !== current) {
|
|
290
325
|
transition(target.pathname, target.hash);
|
|
291
326
|
if (target.hash) scrollToHash(target.hash);
|
|
292
|
-
} else if (
|
|
293
|
-
|
|
294
|
-
|
|
327
|
+
} else if (
|
|
328
|
+
(data as { window?: unknown } | null)?.window == null &&
|
|
329
|
+
(target.search !== location.search || target.hash !== location.hash)
|
|
330
|
+
) {
|
|
331
|
+
// Same-path CONTENT re-address: the router pushed a query or
|
|
332
|
+
// hash that names a new target (?post=, #id) — announced AFTER
|
|
333
|
+
// the commit below, so the repair reads the new address. The
|
|
334
|
+
// window system's own anchor pushes carry the state bookmark
|
|
335
|
+
// and stay silent (they are UI entries, not content addresses).
|
|
336
|
+
samePathReaddress = true;
|
|
295
337
|
}
|
|
338
|
+
// Pure same-path pushes without a re-address stay silent: they
|
|
339
|
+
// are UI history entries, NOT page arrivals — no landing scroll
|
|
340
|
+
// exists for them. Hash landings for real arrivals come from the
|
|
341
|
+
// boot branch, the popstate branches and hashchange.
|
|
296
342
|
}
|
|
297
343
|
original(data, unused, url);
|
|
344
|
+
if (samePathReaddress) {
|
|
345
|
+
samePathReaddress = false;
|
|
346
|
+
dispatchSignal("page:addressed", {
|
|
347
|
+
path: location.pathname,
|
|
348
|
+
hash: location.hash,
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
// The ALIAS re-land: a shorthand path (/addons) boots as its own
|
|
353
|
+
// document and the router commits the destination (<Navigate
|
|
354
|
+
// to="/wow#addons" replace>) with a replaceState — the only
|
|
355
|
+
// path-changing commit the pushState wrapper cannot see. It is not a
|
|
356
|
+
// traversal (nothing announces it; the fresh-arrival gate decides the
|
|
357
|
+
// store's landing by the referrer alone) — but the page must still be
|
|
358
|
+
// LANDED on the destination's hash element like every boot: aim the
|
|
359
|
+
// scroll at it (the retrying scrollToId absorbs the remount delay),
|
|
360
|
+
// and take over `current` so later pushes compare against the true
|
|
361
|
+
// destination path. Same-path replaceStates (the window system's
|
|
362
|
+
// bookmark writes) stay silent.
|
|
363
|
+
const originalReplaceState = history.replaceState.bind(history);
|
|
364
|
+
history.replaceState = (data, unused, url) => {
|
|
365
|
+
if (url != null) {
|
|
366
|
+
const target = new URL(url, location.href);
|
|
367
|
+
if (target.pathname !== current) {
|
|
368
|
+
current = target.pathname;
|
|
369
|
+
if (target.hash) scrollToHash(target.hash);
|
|
370
|
+
else scrollToId(windowBookmark() ?? "");
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
originalReplaceState(data, unused, url);
|
|
298
374
|
};
|
|
299
375
|
// Same-page hyperlinks to hash elements change the hash natively.
|
|
300
376
|
window.addEventListener("hashchange", (event) =>
|
|
@@ -308,6 +384,8 @@ export function disablePageSlide(): void {
|
|
|
308
384
|
if (!originalPushState) return;
|
|
309
385
|
history.pushState = originalPushState;
|
|
310
386
|
originalPushState = null;
|
|
387
|
+
if (originalReplaceState) history.replaceState = originalReplaceState;
|
|
388
|
+
originalReplaceState = null;
|
|
311
389
|
window.removeEventListener("popstate", onPopState);
|
|
312
390
|
applyTheme({}, { previousClassNames: [CLASS] });
|
|
313
391
|
clearThemeVariables(VARIABLES);
|
|
@@ -28,9 +28,12 @@ html.theme-page-slide .page-slide-ghost {
|
|
|
28
28
|
forwards;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
/* The live <main> has an indefinite height, so its page sizes to content
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
/* The live <main> has an indefinite height, so its page sizes to content
|
|
32
|
+
(a nested .page in the ghost's fixed-height main, or main itself — the
|
|
33
|
+
normalized shell makes main the page); the ghost must not stretch the
|
|
34
|
+
page to fill its box. */
|
|
35
|
+
html.theme-page-slide .page-slide-ghost > .page,
|
|
36
|
+
html.theme-page-slide .page-slide-ghost.page {
|
|
34
37
|
height: auto;
|
|
35
38
|
min-height: 0;
|
|
36
39
|
}
|
|
@@ -70,7 +73,9 @@ html.theme-page-slide[data-page-slide] main:not(.page-slide-ghost) > .page {
|
|
|
70
73
|
whole window is drawn the last stretch toward the measured fold point.
|
|
71
74
|
Contents ride the squash, as in XP itself. */
|
|
72
75
|
html.theme-page-slide .page-slide-ghost .page > .window,
|
|
73
|
-
html.theme-page-slide .page-slide-ghost .page > .maximized-shell > .window
|
|
76
|
+
html.theme-page-slide .page-slide-ghost .page > .maximized-shell > .window,
|
|
77
|
+
html.theme-page-slide .page-slide-ghost > .window,
|
|
78
|
+
html.theme-page-slide .page-slide-ghost > .maximized-shell > .window {
|
|
74
79
|
transform-origin: bottom center;
|
|
75
80
|
/* Linear, per preference: the top edge falls towards the taskbar line
|
|
76
81
|
at a constant rate for the entire fold. */
|
|
@@ -141,8 +146,7 @@ html.theme-page-slide .page-slide-ghost .page-slide-placeholder-frame {
|
|
|
141
146
|
html.theme-page-slide .window.window-minimize {
|
|
142
147
|
z-index: 4001;
|
|
143
148
|
transform-origin: bottom center;
|
|
144
|
-
animation: window-minimize-exit var(--ps-minimize, 98ms) linear forwards
|
|
145
|
-
!important;
|
|
149
|
+
animation: window-minimize-exit var(--ps-minimize, 98ms) linear forwards !important;
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
@keyframes window-minimize-exit {
|
|
@@ -151,8 +155,7 @@ html.theme-page-slide .window.window-minimize {
|
|
|
151
155
|
100% offset the squashed sliver would rest exactly AT the bottom
|
|
152
156
|
edge (the page drop that normally carries it away doesn't exist
|
|
153
157
|
for a standalone dismissal). */
|
|
154
|
-
transform: translateY(calc(var(--page-fold-dy, 80vh) + 100%))
|
|
155
|
-
scaleY(0.06);
|
|
158
|
+
transform: translateY(calc(var(--page-fold-dy, 80vh) + 100%)) scaleY(0.06);
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
|
|
@@ -167,7 +170,15 @@ html.theme-page-slide[data-page-slide="parked"] main:not(.page-slide-ghost) {
|
|
|
167
170
|
animation: none;
|
|
168
171
|
}
|
|
169
172
|
|
|
170
|
-
|
|
173
|
+
/* The parked "none" must also hold for the normalized shell (main.page),
|
|
174
|
+
whose combined entrance animation above declares at higher specificity
|
|
175
|
+
than the un-classed main rule: this later, equal-specificity rule wins
|
|
176
|
+
and keeps main transform-free — the maximized backdrop stays
|
|
177
|
+
viewport-anchored. */
|
|
178
|
+
html.theme-page-slide[data-page-slide="parked"]
|
|
179
|
+
main:not(.page-slide-ghost).page,
|
|
180
|
+
html.theme-page-slide[data-page-slide="parked"]
|
|
181
|
+
main:not(.page-slide-ghost)
|
|
171
182
|
> .page {
|
|
172
183
|
animation: none;
|
|
173
184
|
}
|
package/src/virtual.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The blog directory listing is served by build/blogDirsPlugin.ts as a
|
|
2
|
+
* virtual module: a live walk of public/blog/'s subdirectories. There is
|
|
3
|
+
* no snapshot file — the filesystem is the only source (recomputed on
|
|
4
|
+
* dev-server watch changes and at every build). */
|
|
5
|
+
declare module "virtual:blog-dirs" {
|
|
6
|
+
const blogDirs: {
|
|
7
|
+
directories: Array<{
|
|
8
|
+
path: string;
|
|
9
|
+
files: string[];
|
|
10
|
+
dirs: string[];
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
export default blogDirs;
|
|
14
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useRef, useState, type ReactNode, type RefObject } from "react";
|
|
2
2
|
import type { WindowFlags } from "./state";
|
|
3
|
-
import {
|
|
3
|
+
import { scrollToId } from "@/lib/scrollTo";
|
|
4
|
+
import { dispatchSignal } from "@/lib/signals";
|
|
4
5
|
import { permalinkFor, useWindowStore } from "./state";
|
|
5
6
|
|
|
6
7
|
/** Machinery for maximized-foreground windows: the dimmed sibling layer,
|
|
@@ -12,8 +13,9 @@ import { permalinkFor, useWindowStore } from "./state";
|
|
|
12
13
|
* slot in both states and is never remounted. */
|
|
13
14
|
|
|
14
15
|
export type MaximizedController = {
|
|
15
|
-
/** Enters the maximized view:
|
|
16
|
-
*
|
|
16
|
+
/** Enters the maximized view: PUSHes the section's history entry (the
|
|
17
|
+
* bookmark the back button pops out of), reserves the flow slot
|
|
18
|
+
* (measured pre-lift) and lifts the window. Silent. */
|
|
17
19
|
maximize: () => void;
|
|
18
20
|
/** Silent, instant restore: ✕ on a maximized window, Escape and the
|
|
19
21
|
* out-of-bounds backdrop click all restore without sound (sounds
|
|
@@ -22,7 +24,7 @@ export type MaximizedController = {
|
|
|
22
24
|
/** OK entry: restore AND reveal the window's content on return. */
|
|
23
25
|
dismissRevealed: () => void;
|
|
24
26
|
/** Title-bar minimize only: restores with the slide-off ride. */
|
|
25
|
-
dismissWithSlide: () => void;
|
|
27
|
+
dismissWithSlide: (park?: boolean) => void;
|
|
26
28
|
backdropRef: RefObject<HTMLDivElement | null>;
|
|
27
29
|
parkedSize: { width: number; height: number } | null;
|
|
28
30
|
};
|
|
@@ -61,14 +63,36 @@ export function useMaximizedController(
|
|
|
61
63
|
].filter((candidate) => candidate !== backdropRef.current);
|
|
62
64
|
const topId = remaining[remaining.length - 1]?.dataset.windowId;
|
|
63
65
|
const topNode = topId ? windows.find((w) => w.id === topId) : undefined;
|
|
64
|
-
history
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
// The settle RIDES the history owner: the entry keeps the remaining
|
|
67
|
+
// maximized window's bookmark (or none, when the last one went) and
|
|
68
|
+
// lands on its permalink — pathname WITHOUT the query when none
|
|
69
|
+
// remain, so a stale ?post can't resurrect a maximized window after
|
|
70
|
+
// the last one was dismissed. The dismissed window's own backdrop is
|
|
71
|
+
// excluded via backdropRef, and ride-out clones carry no id to ever
|
|
72
|
+
// qualify.
|
|
73
|
+
dispatchSignal("history:anchor", {
|
|
74
|
+
id: topNode?.id,
|
|
75
|
+
url: topNode
|
|
76
|
+
? permalinkFor(topNode, permalinkMode)
|
|
77
|
+
: `${location.pathname}`,
|
|
78
|
+
mode: "replace",
|
|
79
|
+
});
|
|
69
80
|
};
|
|
70
81
|
|
|
71
|
-
|
|
82
|
+
/** The dismissal may hand the URL off ONLY when this window still
|
|
83
|
+
* owns the active entry — the one its maximize push created, whose
|
|
84
|
+
* state bookmark names it. An in-page dismissal (✕, Escape, backdrop,
|
|
85
|
+
* title-bar restore, stacked settle) rides that entry and settles it.
|
|
86
|
+
* A history-TRAVERSAL dismissal does not: the browser back already
|
|
87
|
+
* popped onto the DESTINATION entry — whose hash and state bookmark,
|
|
88
|
+
* when present, name the section to reveal and scroll to. Rewriting
|
|
89
|
+
* that entry would strip the hash, drop the bookmark and land the
|
|
90
|
+
* return un-revealed (the reveal is then unfixable: nothing in the
|
|
91
|
+
* URL names the section any more). */
|
|
92
|
+
const stillOwnsEntry = (): boolean =>
|
|
93
|
+
(history.state as { window?: unknown } | null)?.window === nodeId;
|
|
94
|
+
|
|
95
|
+
const dismiss = (slide: boolean, revealed = false, park = false) => {
|
|
72
96
|
const riders: HTMLElement[] = [];
|
|
73
97
|
const shell = backdropRef.current;
|
|
74
98
|
if (shell) {
|
|
@@ -112,51 +136,59 @@ export function useMaximizedController(
|
|
|
112
136
|
riders.push(riding);
|
|
113
137
|
shell.style.opacity = "0";
|
|
114
138
|
}
|
|
115
|
-
settleHashAfterDismiss();
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
139
|
+
if (stillOwnsEntry()) settleHashAfterDismiss();
|
|
140
|
+
// Every exit restores the window's OWN flags as they stood at
|
|
141
|
+
// maximize time — the minimize choreography (the click and the
|
|
142
|
+
// slide-off rider) is the departure ANIMATION. EXCEPT the parked
|
|
143
|
+
// minimize (the title-bar minimize button, and the double-click on
|
|
144
|
+
// the maximized title bar): the section underneath is minimized
|
|
145
|
+
// EXACTLY like the inline minimize handler does — collapsed
|
|
146
|
+
// (expanded:false), OK row bottom-right, the section's normal
|
|
147
|
+
// resting shape on the page. No third-state remnant: the maximized
|
|
148
|
+
// and inline minimize buttons land the window in the SAME state.
|
|
149
|
+
patch(nodeId, {
|
|
150
|
+
maximized: false,
|
|
151
|
+
minimized: false,
|
|
152
|
+
...(park ? { expanded: false } : (preFlags.current ?? {})),
|
|
153
|
+
});
|
|
154
|
+
if (revealed) {
|
|
155
|
+
// The reveal (lineage + direct content) rides the signal bus —
|
|
156
|
+
// the store's handler expands; the controller only restores.
|
|
157
|
+
dispatchSignal("window:reveal", { id: nodeId, descendants: "direct" });
|
|
135
158
|
}
|
|
136
159
|
if (riders.length) {
|
|
137
160
|
window.setTimeout(() => riders.forEach((rider) => rider.remove()), 400);
|
|
138
161
|
}
|
|
139
|
-
//
|
|
140
|
-
//
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
162
|
+
// NO landing scroll on dismissal: a close is not an arrival. Every
|
|
163
|
+
// exit restores the page at the exact place it was standing before
|
|
164
|
+
// the lift (the reserved flow slot keeps the layout still). Only
|
|
165
|
+
// arrivals land: history returns and permalink loads (pageSlide's
|
|
166
|
+
// scrollToHash and the store's confirm).
|
|
167
|
+
// EXCEPT the dismissal of a SEEDED landing: the maximized state
|
|
168
|
+
// came from the URL (a permalink opened the section maximized, or
|
|
169
|
+
// a refresh held it) — the reader never stood anywhere on this
|
|
170
|
+
// page, and the page rides at its arrival top with the section
|
|
171
|
+
// somewhere below the fold. The press that un-maximizes IS the
|
|
172
|
+
// reader's arrival at the section's inline resting place, so it
|
|
173
|
+
// lands the page on the section — the shared aiming scroll (the
|
|
174
|
+
// pageSlide theme's landing rules: smooth, on-screen-aware,
|
|
175
|
+
// re-aimed while the layout grows around the freshly revealed
|
|
176
|
+
// content). A snapshot exists ⇒ the lift happened in-page and the
|
|
177
|
+
// no-scroll rule stands.
|
|
178
|
+
if (preFlags.current === null) scrollToId(nodeId);
|
|
152
179
|
};
|
|
153
|
-
|
|
154
180
|
return {
|
|
155
181
|
maximize: () => {
|
|
156
182
|
// Snapshot the window's own flags first: the dismissal restores
|
|
157
183
|
// exactly these (never maximizes content, re-minimizes if it was
|
|
158
|
-
// minimized before the lift).
|
|
159
|
-
|
|
184
|
+
// minimized before the lift). The maximized key itself is
|
|
185
|
+
// stripped — a fresh-permalink landing seeds the window maximized
|
|
186
|
+
// with NO snapshot, and a later real maximize on such a window
|
|
187
|
+
// would otherwise spread the lifted flag straight back into the
|
|
188
|
+
// restore (dismissal un-maximizes, always).
|
|
189
|
+
const pre: WindowFlags = { ...flagsOf(nodeId) };
|
|
190
|
+
delete pre.maximized;
|
|
191
|
+
preFlags.current = pre;
|
|
160
192
|
// The hash anchors the maximized window so a refresh lands back on
|
|
161
193
|
// the revealed section. replaceState is untouched by the pageSlide
|
|
162
194
|
// pushState patch — no transition, no sound.
|
|
@@ -170,28 +202,29 @@ export function useMaximizedController(
|
|
|
170
202
|
}
|
|
171
203
|
// Anchor the URL so a refresh lands back on the revealed section —
|
|
172
204
|
// in the page's own permalink form (?post=slug on the blog, hash
|
|
173
|
-
// elsewhere).
|
|
174
|
-
//
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
//
|
|
205
|
+
// elsewhere). The anchor is a history PUSH, on every screen: the
|
|
206
|
+
// maximized view is one entry deep, so the browser back button
|
|
207
|
+
// (desktop and OS-mobile alike) pops INTO the pre-maximize entry —
|
|
208
|
+
// the page:returned repair sees the maximized window no longer
|
|
209
|
+
// named by the URL and performs the minimize choreography
|
|
210
|
+
// (window:minimize). Same-path pushes stay silent in the pageSlide
|
|
211
|
+
// wrapper — no transition, no sound.
|
|
212
|
+
const node = windows.find((w) => w.id === nodeId);
|
|
213
|
+
dispatchSignal("history:anchor", {
|
|
214
|
+
id: nodeId,
|
|
215
|
+
url: node ? permalinkFor(node, permalinkMode) : `#${nodeId}`,
|
|
216
|
+
mode: "push",
|
|
217
|
+
});
|
|
218
|
+
// A maximized window shows its body — a stale minimized flag would
|
|
219
|
+
// leave it title-bar-only in the foreground. DESCENDANTS keep the
|
|
220
|
+
// flags they hold: the maximized view is a framing, not a reveal —
|
|
221
|
+
// collapsed sections stay collapsed so the OK/Cancel/Permalink
|
|
222
|
+
// rail stays on screen instead of the content scrolling it away.
|
|
187
223
|
patch(nodeId, { maximized: true, minimized: false });
|
|
188
|
-
for (const id of descendantIds(windows, nodeId)) {
|
|
189
|
-
patch(id, { expanded: true, minimized: false });
|
|
190
|
-
}
|
|
191
224
|
},
|
|
192
225
|
dismiss: () => dismiss(false),
|
|
193
226
|
dismissRevealed: () => dismiss(false, true),
|
|
194
|
-
dismissWithSlide: () => dismiss(true),
|
|
227
|
+
dismissWithSlide: (park?: boolean) => dismiss(true, false, park),
|
|
195
228
|
backdropRef,
|
|
196
229
|
parkedSize,
|
|
197
230
|
};
|
package/src/window/OkButton.tsx
CHANGED
|
@@ -1,43 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
1
|
+
import { useSignals } from "@/lib/signals";
|
|
2
|
+
import { hasContent, type WindowNode } from "./model";
|
|
3
3
|
import { useWindowStore } from "./state";
|
|
4
4
|
|
|
5
|
-
/** OK follows the window's link if it has one, otherwise expands the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}) {
|
|
17
|
-
const { expand, remember } = useWindowStore();
|
|
18
|
-
const navigate = useNavigate();
|
|
5
|
+
/** OK follows the window's link if it has one, otherwise expands the
|
|
6
|
+
* window. The OK middleware is all signals with no callback threading:
|
|
7
|
+
* on the maximized rail a link-less window MINIMIZES AND REVEALS
|
|
8
|
+
* (window:minimize plays the click + slide-off, window:reveal expands
|
|
9
|
+
* the section inline), an inline linked window whose section carries no
|
|
10
|
+
* content of its own lifts the maximized view on its first press
|
|
11
|
+
* (window:maximize), and once maximized the press passes through to the
|
|
12
|
+
* link below. A linked window with content navigates directly. */
|
|
13
|
+
export function OkButton({ node }: { node: WindowNode }) {
|
|
14
|
+
const { flagsOf, expand, remember } = useWindowStore();
|
|
15
|
+
const { dispatch } = useSignals();
|
|
19
16
|
|
|
20
17
|
const onClick = () => {
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const maximized = flagsOf(node.id).maximized;
|
|
19
|
+
if (maximized && !node.link) {
|
|
20
|
+
// The maximized rail's OK on a link-less window: the minimize
|
|
21
|
+
// choreography (click + slide-off) takes the view down, then the
|
|
22
|
+
// section reveals inline — the OK button IS the back-out gesture.
|
|
23
|
+
dispatch("window:minimize", { id: node.id });
|
|
24
|
+
dispatch("window:reveal", { id: node.id, descendants: "direct" });
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
// OK middleware: intercept the first press on a linked window whose
|
|
28
|
+
// section carries no content of its own (hasContent): it opens the
|
|
29
|
+
// maximized view rather than leaving the page. A link-section WITH
|
|
30
|
+
// content navigates directly — the maximized view would only frame
|
|
31
|
+
// what the reader already has inline. Once the window IS maximized
|
|
32
|
+
// (a permalink landing also does that even content-free), the press
|
|
33
|
+
// falls through to the navigation.
|
|
34
|
+
if (node.link && !maximized && !hasContent(node)) {
|
|
35
|
+
dispatch("window:maximize", { id: node.id });
|
|
23
36
|
return;
|
|
24
37
|
}
|
|
25
38
|
const { link } = node;
|
|
26
|
-
// OK revealing a section
|
|
27
|
-
// the
|
|
39
|
+
// OK revealing a section never rewrites the URL-hash: the maximized
|
|
40
|
+
// view's push owns the URL while a window is up, and the off-site
|
|
41
|
+
// departure bookmarks its window into the entry's STATE instead.
|
|
28
42
|
if (!link) {
|
|
29
43
|
expand(node.id);
|
|
30
44
|
return;
|
|
31
45
|
}
|
|
32
46
|
if (/^https?:/.test(link) || node.externalLink || /\.\w+$/.test(link)) {
|
|
33
|
-
// Leaving the site: bookmark this window into the
|
|
34
|
-
//
|
|
35
|
-
//
|
|
47
|
+
// Leaving the site: bookmark this window into the history entry's
|
|
48
|
+
// state (history:remember) — the entry stays HASH-FREE, so
|
|
49
|
+
// returning via back, the external page or a reload lands on the
|
|
50
|
+
// section revealed and scrolled to (the store resolves the
|
|
51
|
+
// bookmark), never re-maximized.
|
|
36
52
|
remember(node.id);
|
|
37
|
-
history.replaceState(null, "", `#${node.id}`);
|
|
38
53
|
window.location.assign(link);
|
|
39
54
|
} else {
|
|
40
|
-
|
|
55
|
+
// Internal navigation is a signal: the shell's handler performs
|
|
56
|
+
// the route change, so the window system stays router-free.
|
|
57
|
+
dispatch("app:navigate", { to: link });
|
|
41
58
|
}
|
|
42
59
|
};
|
|
43
60
|
|