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
|
@@ -3,7 +3,9 @@ import type { Section } from "@/content";
|
|
|
3
3
|
import { buildWindows } from "./model";
|
|
4
4
|
import {
|
|
5
5
|
WindowProvider,
|
|
6
|
+
usePageReturn,
|
|
6
7
|
usePermalinkTarget,
|
|
8
|
+
useReveal,
|
|
7
9
|
useRememberLeave,
|
|
8
10
|
useWindowStore,
|
|
9
11
|
type PermalinkMode,
|
|
@@ -12,7 +14,12 @@ import { Window } from "./Window";
|
|
|
12
14
|
|
|
13
15
|
function Roots({ children }: { children?: ReactNode }) {
|
|
14
16
|
const { windows } = useWindowStore();
|
|
17
|
+
// The reveal handler subscribes FIRST (effects run in hook order):
|
|
18
|
+
// the permalink confirm below dispatches on mount and must not miss
|
|
19
|
+
// its handler.
|
|
20
|
+
useReveal();
|
|
15
21
|
usePermalinkTarget();
|
|
22
|
+
usePageReturn();
|
|
16
23
|
useRememberLeave();
|
|
17
24
|
return (
|
|
18
25
|
<>
|
package/src/window/TitleBar.tsx
CHANGED
|
@@ -6,6 +6,7 @@ type Props = {
|
|
|
6
6
|
onMinimize: () => void;
|
|
7
7
|
onMaximize: () => void;
|
|
8
8
|
onClose: () => void;
|
|
9
|
+
onDoubleClick?: (event: React.MouseEvent) => void;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export function TitleBar({
|
|
@@ -14,10 +15,11 @@ export function TitleBar({
|
|
|
14
15
|
onMinimize,
|
|
15
16
|
onMaximize,
|
|
16
17
|
onClose,
|
|
18
|
+
onDoubleClick,
|
|
17
19
|
}: Props) {
|
|
18
20
|
const heading = node.heading ?? "";
|
|
19
21
|
return (
|
|
20
|
-
<div className="title-bar">
|
|
22
|
+
<div className="title-bar" onDoubleClick={onDoubleClick}>
|
|
21
23
|
<div className="title-bar-text">
|
|
22
24
|
{node.link ? (
|
|
23
25
|
<a
|
package/src/window/Window.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useEffect, useRef } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { playMinimizeClick } from "@/lib/audio";
|
|
3
3
|
import { getClippyState } from "@/lib/clippy";
|
|
4
4
|
import { Md } from "@/lib/markdown";
|
|
5
|
-
import {
|
|
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
|
-
|
|
87
|
-
//
|
|
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
|
-
//
|
|
110
|
-
// affordance that leaves the link untouched.
|
|
111
|
-
//
|
|
112
|
-
//
|
|
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}
|
|
119
|
-
{node.link &&
|
|
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")
|
|
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,
|
|
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
|
-
//
|
|
207
|
-
//
|
|
208
|
-
// minimize
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
235
|
-
//
|
|
236
|
-
|
|
237
|
-
|
|
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
|
-
//
|
|
245
|
-
//
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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={
|
|
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
|
|
328
|
-
//
|
|
329
|
-
//
|
|
330
|
-
//
|
|
331
|
-
|
|
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
|
+
}
|
package/src/window/model.ts
CHANGED
|
@@ -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);
|