website-xp-phone 2.3.0 → 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.
Files changed (77) hide show
  1. package/build/blogDirsPlugin.ts +100 -0
  2. package/package.json +9 -6
  3. package/public/blog/archive/eighth-post-lost-in-the-sauce.json +36 -0
  4. package/public/blog/archive/noise/eleventh-post-discussion-java-gist.md +5 -0
  5. package/public/blog/archive/noise/fifteenth-post-very-rare-windows-funny.md +8 -0
  6. package/public/blog/archive/noise/fourth-post-meta-blog.md +3 -0
  7. package/public/blog/archive/noise/sixteenth-post-meta-fantasy-blog.md +4 -0
  8. package/public/blog/archive/noise/tenth-post-meta-funny-redacted-and-timetravelled.md +3 -0
  9. package/public/blog/archive/noise/twelfth-post-mixing-phase-technique-audio-music.md +48 -0
  10. package/public/blog/archive/noise/welcome-back-ramble-meta.md +6 -0
  11. package/public/blog/archive/noise/welcome-to-my-blog-meta-blog-welcome-to-my-website.md +7 -0
  12. package/public/blog/archive/seventh-post-lie-theory-na2000.json +22 -0
  13. package/public/blog/archive/sophus-lie.json +36 -0
  14. package/public/blog/hlwm_and_herbstutil.md +11 -0
  15. package/public/blog/writing/hot-action-under-a-cold-moon.json +9 -0
  16. package/public/checksums.txt +90 -66
  17. package/public/documents/drift-report.json +13 -1
  18. package/scripts/refresh-soundcloud.mjs +54 -8
  19. package/src/content/blog.json +16 -363
  20. package/src/content/blogDirs.ts +196 -0
  21. package/src/content/configs.json +1 -1
  22. package/src/content/contacts.json +2 -2
  23. package/src/content/includes/make-recipes.md +18 -0
  24. package/src/content/index.ts +156 -57
  25. package/src/content/music-ext.json +1 -1
  26. package/src/content/projects/doftiles.json +88 -4
  27. package/src/content/projects/herbctl.json +58 -0
  28. package/src/content/projects/herbstutil.json +50 -20
  29. package/src/content/projects/on-deploy.json +57 -0
  30. package/src/content/projects/polyframes.json +83 -0
  31. package/src/content/schema.ts +7 -4
  32. package/src/content/sections.json +11 -10
  33. package/src/content/soundcloud.json +61 -13
  34. package/src/lib/clippy.ts +29 -8
  35. package/src/lib/history.ts +152 -0
  36. package/src/lib/markdown.tsx +11 -1
  37. package/src/lib/scrollTo.ts +45 -0
  38. package/src/lib/signals.tsx +271 -0
  39. package/src/main.tsx +20 -4
  40. package/src/pages/BlogDirPage.tsx +36 -0
  41. package/src/pages/BlogPostPage.tsx +76 -3
  42. package/src/pages/ProjectPage.tsx +9 -3
  43. package/src/pages/WowPage.tsx +8 -3
  44. package/src/pages/index.ts +2 -0
  45. package/src/shell/App.tsx +14 -8
  46. package/src/shell/Clippy.tsx +13 -3
  47. package/src/shell/MenuBar.tsx +7 -4
  48. package/src/shell/resolveRoute.ts +41 -2
  49. package/src/shell/routerSignals.ts +34 -0
  50. package/src/styles/extras.css +20 -0
  51. package/src/styles/layout.css +2 -2
  52. package/src/styles/menu.css +1 -1
  53. package/src/styles/window.css +9 -2
  54. package/src/themes/pageSlide/index.ts +120 -42
  55. package/src/themes/pageSlide/pageSlide.css +20 -9
  56. package/src/virtual.d.ts +14 -0
  57. package/src/window/MaximizedWindow.tsx +97 -64
  58. package/src/window/OkButton.tsx +42 -25
  59. package/src/window/PageWindows.tsx +7 -0
  60. package/src/window/TitleBar.tsx +3 -1
  61. package/src/window/Window.tsx +132 -87
  62. package/src/window/closeSounds.ts +27 -0
  63. package/src/window/model.ts +11 -0
  64. package/src/window/state.tsx +290 -50
  65. package/src/window/themes.ts +23 -2
  66. package/test/content.test.js +15 -10
  67. package/test/deploy-pipeline.test.js +11 -11
  68. package/test/markdown-tables.test.js +96 -0
  69. package/test/soundcloud-refresh.test.js +68 -0
  70. package/tsconfig.node.tsbuildinfo +1 -1
  71. package/tsconfig.tsbuildinfo +1 -1
  72. package/vite.config.ts +7 -1
  73. package/public/blog/4th.md +0 -28
  74. package/public/blog/wsl.1.md +0 -40
  75. package/src/window/hidden.ts +0 -22
  76. /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
  77. /package/src/content/{characters.json → includes/characters.json} +0 -0
@@ -1,8 +1,8 @@
1
1
  import { useEffect, useRef } from "react";
2
- import { playLayeredAudio, playMinimizeClick } from "@/lib/audio";
2
+ import { playMinimizeClick } from "@/lib/audio";
3
3
  import { getClippyState } from "@/lib/clippy";
4
4
  import { Md } from "@/lib/markdown";
5
- import { suppressNextSlideClick } from "@/themes/pageSlide";
5
+ import { useSignalHandler, useSignals } from "@/lib/signals";
6
6
  import { CopyAddon } from "./CopyAddon";
7
7
  import { BannerView, EmbedView } from "./Embed";
8
8
  import { OkButton } from "./OkButton";
@@ -11,11 +11,9 @@ import { ResourceEmbed } from "./ResourceEmbed";
11
11
  import { TitleBar } from "./TitleBar";
12
12
  import type { WindowChild, WindowNode } from "./model";
13
13
  import { permalinkFor, useWindowStore } from "./state";
14
- import { dataTheme, forcesExpanded } from "./themes";
14
+ import { closeSound, dataTheme, forcesExpanded } from "./themes";
15
15
  import { hasTheme } from "./model";
16
16
 
17
- const CLOSE_SOUND = "/crunchy_kick.ogg";
18
-
19
17
  function Children({ items }: { items: WindowChild[] }) {
20
18
  return (
21
19
  <ul>
@@ -74,17 +72,16 @@ function Body({
74
72
  node,
75
73
  expanded,
76
74
  maximized,
77
- onOk,
78
75
  }: {
79
76
  node: WindowNode;
80
77
  expanded: boolean;
81
78
  /** Fullscreen maximize layout: content first, OK/Permalink rail after. */
82
79
  maximized?: boolean | undefined;
83
- /** Closes the maximized view; OK keeps link navigation when linked. */
84
- onOk?: (() => void) | undefined;
85
80
  }) {
86
- // Linked windows keep their OK button even when forced open: OK is the
87
- // affordance that follows the link (e.g. the "npm package" stub windows).
81
+ const { dispatch } = useSignals();
82
+ // Linked windows keep their OK button even when forced open: OK lifts
83
+ // the maximized view (the maximized OK is what follows the link — e.g.
84
+ // the "npm package" stub windows).
88
85
  const showOk = Boolean(node.link) || (!expanded && !forcesExpanded(node));
89
86
  const copyable = Boolean(node.status && node.link?.startsWith("/addons/"));
90
87
  const showContent = expanded || Boolean(node.link);
@@ -106,17 +103,22 @@ function Body({
106
103
  // Maximized: the rail sits BELOW the content in normal flow — content on
107
104
  // top, then OK (+ Cancel for linked windows) + Permalink. Dialog rules:
108
105
  // OK keeps its native meaning — follow the link on linked windows,
109
- // dismiss on link-less ones — while Cancel is the explicit dismiss
110
- // affordance that leaves the link untouched. margin-top: auto only
111
- // pushes the rail to the bottom edge when the window is taller than
112
- // its content, so nothing ever scrolls underneath it.
106
+ // minimize-and-reveal on link-less ones — while Cancel is the explicit
107
+ // silent-dismiss affordance that leaves the link untouched. Both ride
108
+ // the bus; the window's controller listens for its id.
109
+ // margin-top: auto only pushes the rail to the bottom edge when the
110
+ // window is taller than its content, so nothing scrolls beneath it.
113
111
  if (maximized) {
114
112
  return (
115
113
  <div className="maximized-content-col">
116
114
  {content}
117
115
  <div className="ok-row ok-row-bottom">
118
- <OkButton node={node} onOk={node.link ? undefined : onOk} />
119
- {node.link && onOk && <CancelButton onClose={onOk} />}
116
+ <OkButton node={node} />
117
+ {node.link && (
118
+ <CancelButton
119
+ onClose={() => dispatch("window:dismiss", { id: node.id })}
120
+ />
121
+ )}
120
122
  <PermalinkButton node={node} />
121
123
  </div>
122
124
  </div>
@@ -146,6 +148,7 @@ function Body({
146
148
 
147
149
  export function Window({ node }: { node: WindowNode }) {
148
150
  const { flagsOf, patch, onLeave } = useWindowStore();
151
+ const { dispatch } = useSignals();
149
152
  const leaves = node.depth === 0 && onLeave;
150
153
  const flags = flagsOf(node.id);
151
154
  const maximized = Boolean(flags.maximized);
@@ -157,29 +160,60 @@ export function Window({ node }: { node: WindowNode }) {
157
160
  windowRef,
158
161
  );
159
162
 
163
+ // The window's own commands (window:maximize | window:dismiss |
164
+ // window:minimize): every gesture routes THROUGH the bus — the OK
165
+ // middleware, the title-bar buttons, Escape, the backdrop click, the
166
+ // traversal out of the maximized view (page:returned) all DISPATCH,
167
+ // and these listeners perform. Every window listens, only the named
168
+ // window acts; the component closure supplies the controller, the
169
+ // leaves-fold and the live maximized flag.
170
+ useSignalHandler("window:maximize", ({ id }) => {
171
+ if (id === node.id && !maximized) maximizedCtl.maximize();
172
+ });
173
+ useSignalHandler("window:dismiss", ({ id, reveal }) => {
174
+ if (id !== node.id) return;
175
+ // reveal: the dismiss-and-reveal pair (rail OK/Cancel) restores the
176
+ // framing AND expands the content inline; no reveal is the silent
177
+ // restore it always was (✕, Escape, backdrop, title-bar Restore).
178
+ if (reveal) maximizedCtl.dismissRevealed();
179
+ else maximizedCtl.dismiss();
180
+ });
181
+ useSignalHandler("window:minimize", ({ id, park }) => {
182
+ if (id !== node.id) return;
183
+ if (maximized) {
184
+ // The maximized dismissal plays the minimize click + slide-off;
185
+ // park carries the button semantics: set only by the actual
186
+ // minimize gestures (title-bar button, double-click) — the
187
+ // section underneath is minimized with the overlay (a
188
+ // window-manager minimize). Traversals and the rail OK leave it
189
+ // unset and the section is restored as it stood.
190
+ playMinimizeClick();
191
+ maximizedCtl.dismissWithSlide(park);
192
+ return;
193
+ }
194
+ if (leaves) {
195
+ // Navigation is the fold here: pageSlide animates every departing
196
+ // window (and plays the minimize click). Don't fold twice.
197
+ leaves();
198
+ return;
199
+ }
200
+ // Inline windows collapse to their title bar — silently, with no
201
+ // depart animation (the minimize click and the slide-off belong to
202
+ // the title-bar minimize on a maximized window, and to navigation).
203
+ patch(node.id, { expanded: false, maximized: false });
204
+ });
205
+
160
206
  useEffect(() => {
161
207
  if (!maximized) return;
162
208
  const onKey = (event: KeyboardEvent) => {
163
209
  // Escape restores silently (no sound, no slide) like every other
164
210
  // non-minimize exit — no other key does.
165
- if (event.key === "Escape") maximizedCtl.dismiss();
211
+ if (event.key === "Escape")
212
+ dispatch("window:dismiss", { id: node.id, reveal: false });
166
213
  };
167
214
  document.addEventListener("keydown", onKey, true);
168
215
  return () => document.removeEventListener("keydown", onKey, true);
169
- }, [maximized, node.id, patch, maximizedCtl]);
170
-
171
- // Mobile: the maximized window's hash entry is a history PUSH, so the
172
- // OS back button removes it — the hash leaves this window first, which
173
- // dismisses the overlay (instead of ever leaving the page).
174
- useEffect(() => {
175
- if (!maximized) return;
176
- if (!window.matchMedia("(max-width: 768px)").matches) return;
177
- const onHash = () => {
178
- if (location.hash !== `#${node.id}`) maximizedCtl.dismiss();
179
- };
180
- window.addEventListener("hashchange", onHash);
181
- return () => window.removeEventListener("hashchange", onHash);
182
- }, [maximized, node.id, maximizedCtl]);
216
+ }, [maximized, node.id, dispatch, maximizedCtl]);
183
217
 
184
218
  if (flags.closed) return null;
185
219
 
@@ -203,68 +237,77 @@ export function Window({ node }: { node: WindowNode }) {
203
237
  const expanded =
204
238
  forcesExpanded(node) || Boolean(flags.expanded || node.embed) || maximized;
205
239
 
206
- // Minimize and Close share the same window behaviour. Sounds are pinned
207
- // to their moments: the minimize click belongs to the title-bar
208
- // minimize and the ✕ cross on a MAXIMIZED window, the crunchy kick to
209
- // the ✕ close on an inline window, navigation gets its own click
210
- // (pageSlide). Escape and OK stay silent.
211
- const minimize = () => {
240
+ // Sounds stay pinned to the moments in the COMMAND handlers above:
241
+ // the minimize click belongs to window:minimize (the title-bar
242
+ // minimize AND the browser back out of the maximized view), the
243
+ // crunchy kick to every ✕ press that stays on the page, and the
244
+ // Click.ogg to the ✕ that navigates away — all ✕ sounds declared
245
+ // through the bus (window:closed, rendered by closeSounds). Escape
246
+ // and OK stay silent. The title-bar minimize itself owns NO
247
+ // behaviour: it declares intent on the bus, the listener performs.
248
+ const minimize = () => dispatch("window:minimize", { id: node.id });
249
+ // The MINIMIZE BUTTON's intent: a window-manager minimize — on a
250
+ // maximized window the park rides along, so the overlay AND the
251
+ // section underneath both end up minimized. A double-click on the
252
+ // title bar performs the same maximize/minimize toggle.
253
+ const minimizeButton = () =>
254
+ dispatch("window:minimize", { id: node.id, park: maximized });
255
+ const titleBarDblClick = (event: React.MouseEvent) => {
256
+ // Detached from the three buttons: a double-press on one of them is
257
+ // two single gestures, never a toggle.
258
+ if ((event.target as HTMLElement).closest("button")) return;
212
259
  if (maximized) {
213
- // The title-bar minimize is the ONLY dismissal that plays the
214
- // click + slide-off (Escape, OK, ✕ and the backdrop restore
215
- // silently).
216
- playMinimizeClick();
217
- maximizedCtl.dismissWithSlide();
218
- return;
219
- }
220
- if (leaves) {
221
- // Navigation is the fold here: pageSlide animates every departing
222
- // window (and plays the minimize click). Don't fold twice.
223
- leaves();
260
+ minimizeButton();
224
261
  return;
225
262
  }
226
- // Inline windows collapse to their title bar — silently, with no
227
- // depart animation (the minimize click and the slide-off belong to
228
- // the title-bar minimize on a maximized window, and to navigation).
229
- patch(node.id, { expanded: false, maximized: false });
263
+ if (node.depth > 0) dispatch("window:maximize", { id: node.id });
230
264
  };
231
265
 
232
266
  const close = () => {
233
267
  if (maximized) {
234
- // ✕ on a maximized window = a minimize: restores into the page
235
- // flow with the minimize click — no crunchy kick, no slide.
236
- playMinimizeClick();
237
- maximizedCtl.dismiss();
268
+ // ✕ on a maximized window restores it into the page flow — the
269
+ // press STAYS on the page (no navigation), so its sound is the
270
+ // crunchy kick, declared through the bus like every close. The
271
+ // dismissal itself is silent restore (no slide, no reveal),
272
+ // declared through the bus too; the title-bar minimize keeps the
273
+ // click + slide. No direct controller call left here.
274
+ dispatch("window:closed", { id: node.id, sound: closeSound(false) });
275
+ dispatch("window:dismiss", { id: node.id, reveal: false });
238
276
  return;
239
277
  }
240
- // The crunchy kick backs every inline ✕ press: refused closes
241
- // (Clippy veto, "funny" windows) and successful ones alike.
242
- playLayeredAudio(CLOSE_SOUND);
243
278
  const funnyClose = hasTheme(node, "funny");
244
- // Refusal keeps the window open (see window-close-attempt below);
245
- // successful closings park/restore/leave after the crunch.
246
- const refused = !document.dispatchEvent(
247
- new CustomEvent("window-close-attempt", { cancelable: true }),
248
- );
249
- // "funny" windows refuse outright: the kick played, the window stays.
250
- if (funnyClose) return;
251
- if (!refused) {
252
- // Easter egg: while Clippy is on screen, ✕ parks the window instead
253
- // of leaving the page — the mascot's unhide list offers it back
254
- // (restore). Never on leave-on-close pages (Projects), where ✕ means
255
- // navigate.
256
- if (!leaves && getClippyState().visible) {
257
- patch(node.id, { closed: true });
258
- return;
259
- }
260
- if (leaves) {
261
- // ✕ on a page-exit window navigates with the kick as its sound:
262
- // the navigation fold the close triggers stays silent.
263
- suppressNextSlideClick();
264
- }
265
- minimize();
279
+ // The close attempt rides the signal bus: handlers (Clippy) may
280
+ // refuse it by calling refuse() before dispatch returns.
281
+ let vetoed = false;
282
+ dispatch("window:close", {
283
+ id: node.id,
284
+ refuse: () => {
285
+ vetoed = true;
286
+ },
287
+ });
288
+ // The outcome rides the bus with its sound DECLARED (closeSounds
289
+ // renders what is declared): the navigating close — ✕ on a
290
+ // leave-on-close page — clicks; every staying press (refusal,
291
+ // collapse, Clippy park) kicks. This component plays nothing.
292
+ const closes = !(funnyClose || vetoed);
293
+ dispatch("window:closed", {
294
+ id: node.id,
295
+ sound: closeSound(closes && Boolean(leaves)),
296
+ });
297
+ if (!closes) return;
298
+ // Easter egg: while Clippy is on screen, ✕ parks the window instead
299
+ // of leaving the page — the mascot's unhide list offers it back
300
+ // (restore). Never on leave-on-close pages (Projects), where ✕ means
301
+ // navigate.
302
+ if (!leaves && getClippyState().visible) {
303
+ patch(node.id, { closed: true });
304
+ // This IS the successful close Clippy watched: it owns the outcome
305
+ // and pipes up (clippy:hid — the offer bubble rides the bus).
306
+ dispatch("clippy:hid", { id: node.id });
266
307
  return;
267
308
  }
309
+ minimize();
310
+ return;
268
311
  };
269
312
 
270
313
  const window_ = (
@@ -284,7 +327,7 @@ export function Window({ node }: { node: WindowNode }) {
284
327
  <TitleBar
285
328
  node={node}
286
329
  maximized={maximized}
287
- onMinimize={minimize}
330
+ onMinimize={minimizeButton}
288
331
  onMaximize={() => {
289
332
  if (!maximized) {
290
333
  maximizedCtl.maximize();
@@ -295,6 +338,7 @@ export function Window({ node }: { node: WindowNode }) {
295
338
  maximizedCtl.dismiss();
296
339
  }}
297
340
  onClose={close}
341
+ onDoubleClick={titleBarDblClick}
298
342
  />
299
343
  {flags.minimized ? (
300
344
  // Minimized windows keep an OK row as their only interior
@@ -324,11 +368,12 @@ export function Window({ node }: { node: WindowNode }) {
324
368
  node={node}
325
369
  expanded={expanded}
326
370
  maximized={maximized}
327
- // OK is the dismiss affordance in fullscreen: silent close,
328
- // no slide — the departing animation is the minimize's alone.
329
- // OK on a maximized window: dismiss AND reveal its content
330
- // (the returned window opens along with its direct children).
331
- onOk={maximized ? () => maximizedCtl.dismissRevealed() : undefined}
371
+ // OK on the maximized rail rides the bus: a linked window
372
+ // navigates its link (the middleware passes through), a
373
+ // link-less one minimizes (the choreography rides
374
+ // window:minimize) and reveals (window:reveal) — the
375
+ // controllers listening under this node's id perform both,
376
+ // so no callback threads through the tree.
332
377
  />
333
378
  </div>
334
379
  )}
@@ -0,0 +1,27 @@
1
+ import { playLayeredAudio, playMinimizeClick } from "@/lib/audio";
2
+ import { onSignal, type SignalManifest } from "@/lib/signals";
3
+ import { suppressNextSlideClick } from "@/themes/pageSlide";
4
+
5
+ /** The ✕ close's sound name, owned by the window:closed manifest entry
6
+ * (themes.ts holds the press→sound policy). */
7
+ type CloseSound = SignalManifest["window:closed"]["sound"];
8
+
9
+ /** The ✕ close's sounds, each with its player. The "window:closed"
10
+ * payload NAMES the sound and this table renders it — no policy lives
11
+ * here. The kick backs every press that stays on the page; the click
12
+ * is the navigating press's, and mutes pageSlide's fold click for that
13
+ * same gesture so the navigation gets exactly one. */
14
+ const PLAY: Record<CloseSound, () => void> = {
15
+ kick: () => playLayeredAudio("/crunchy_kick.ogg"),
16
+ click: () => {
17
+ suppressNextSlideClick();
18
+ playMinimizeClick();
19
+ },
20
+ };
21
+
22
+ /** The close outcome's one renderer, attached at boot (main.tsx): no
23
+ * close site plays anything itself — the window dispatches which sound
24
+ * should play and this plays it. */
25
+ export function attachCloseSounds(): () => void {
26
+ return onSignal("window:closed", ({ sound }) => PLAY[sound]());
27
+ }
@@ -123,3 +123,14 @@ export function lineage(id: string): string[] {
123
123
  export function hasTheme(node: WindowNode, theme: ThemeName): boolean {
124
124
  return node.themes.includes(theme);
125
125
  }
126
+
127
+ /** Whether the section carries content of its OWN to frame in the
128
+ * maximized view: any child (text lines, embeds, banners, custom
129
+ * elements, sub-section rows) or an embed body. Derived straight from
130
+ * the JSON-built tree — the same metadata the renderer sees — so there
131
+ * is no second flag to keep in step. A LINK-section WITH content of its
132
+ * own navigates directly — the maximized view would only frame what the
133
+ * reader already has inline — so only the content-free ones lift the
134
+ * maximized view instead (see OkButton's middleware). */
135
+ export const hasContent = (node: WindowNode): boolean =>
136
+ node.children.length > 0 || Boolean(node.embed);