website-xp-phone 2.5.3 → 2.7.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/package.json +6 -6
- package/public/blog/7.md +1 -1
- package/public/blog/archive/seventh-post-lie-theory-na2000.json +2 -2
- package/public/blog/random/google.md +2 -2
- package/public/blog/releases/dotfiles_1_0_0.md +45 -0
- package/public/blog/releases/hlwm_and_herbstutil.md +33 -0
- package/public/blog/releases/try_it_out.md +48 -0
- package/public/checksums.txt +83 -81
- package/public/documents/drift-report.json +1 -1
- package/src/content/addons.json +2 -2
- package/src/content/blog.json +12 -1
- package/src/content/configs.json +2 -2
- package/src/content/contacts.json +2 -0
- package/src/content/index.ts +7 -1
- package/src/content/projects/{webuser.json → _shelve/webuser.json} +6 -5
- package/src/content/projects/development.json +8 -8
- package/src/content/projects/doftiles.json +101 -29
- package/src/content/projects/frontend.json +6 -5
- package/src/content/projects/graphbrowser.json +34 -6
- package/src/content/projects/herbctl.json +78 -46
- package/src/content/projects/herbstutil.json +85 -68
- package/src/content/projects/lightdni-jssas-toggle.json +51 -6
- package/src/content/projects/on-deploy.json +85 -24
- package/src/content/projects/opencode-screencast.json +64 -11
- package/src/content/projects/pagerts.json +58 -22
- package/src/content/projects/polyframes.json +54 -31
- package/src/content/projects/rarebert.json +37 -8
- package/src/content/schema.ts +3 -0
- package/src/content/sections.json +2 -0
- package/src/content/soundcloud.json +26 -14
- package/src/styles/window.css +55 -19
- package/src/themes/pageSlide/index.ts +211 -83
- package/src/themes/pageSlide/pageSlide.css +89 -29
- package/src/window/OkButton.tsx +6 -1
- package/src/window/Window.tsx +78 -0
- package/src/window/themes.ts +6 -7
- package/test/content.test.js +17 -0
- package/tsconfig.node.tsbuildinfo +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/xp.css/dist/98.css +2 -0
- package/xp.css/dist/98.css.map +1 -0
- package/xp.css/dist/GUI.css +2 -0
- package/xp.css/dist/GUI.css.map +1 -0
- package/xp.css/dist/XP.css +2 -0
- package/xp.css/dist/XP.css.map +1 -0
- package/xp.css/dist/fonts/converted/PerfectDOSVGA437Win.woff +0 -0
- package/xp.css/dist/fonts/converted/PerfectDOSVGA437Win.woff2 +0 -0
- package/xp.css/dist/fonts/converted/ms_sans_serif.woff +0 -0
- package/xp.css/dist/fonts/converted/ms_sans_serif.woff2 +0 -0
- package/xp.css/dist/fonts/converted/ms_sans_serif_bold.woff +0 -0
- package/xp.css/dist/fonts/converted/ms_sans_serif_bold.woff2 +0 -0
- package/Makefile +0 -39
- package/public/blog/hlwm_and_herbstutil.md +0 -74
|
@@ -13,52 +13,104 @@ import "./pageSlide.css";
|
|
|
13
13
|
|
|
14
14
|
const CLASS = "theme-page-slide";
|
|
15
15
|
const ATTRIBUTE = "data-page-slide";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
/** Two-part, one motion: the fold plays DURING the fall (zero delay -
|
|
17
|
+
* the squish happens while the page moves downwards), the glide itself
|
|
18
|
+
* stays gentle (ease-in-out off-screen). The gravity read lives in the
|
|
19
|
+
* MAIN windows' fold curve (see the css: top-level folds ease-in,
|
|
20
|
+
* nested children fold linearly so the parent's acceleration doesn't
|
|
21
|
+
* compound through them). The glide is distance-aware (same pace for
|
|
22
|
+
* every page size, clamped). */
|
|
23
|
+
const FOLD_MS = 200;
|
|
24
|
+
/* TWICE the old pace: the speed doubled (3.1 -> 6.2px/ms) and the
|
|
25
|
+
* clamps halved with it (520-880 -> 260-440ms), so the distance-aware
|
|
26
|
+
* scaling survives intact - the arrival is just twice as fast at
|
|
27
|
+
* every page size. */
|
|
28
|
+
const ARRIVAL_SPEED_PX_MS = 6.2;
|
|
29
|
+
const ARRIVAL_MIN_DURATION_MS = 260;
|
|
30
|
+
const ARRIVAL_MAX_DURATION_MS = 440;
|
|
31
|
+
const DROP_SPEED_PX_MS = 3.4;
|
|
32
|
+
const DROP_MIN_DURATION_MS = 480;
|
|
33
|
+
const DROP_MAX_DURATION_MS = 820;
|
|
34
|
+
const REMOVAL_MARGIN_MS = 200;
|
|
35
|
+
const arrivalDuration = (distancePx: number): number =>
|
|
36
|
+
Math.round(
|
|
37
|
+
Math.min(
|
|
38
|
+
ARRIVAL_MAX_DURATION_MS,
|
|
39
|
+
Math.max(ARRIVAL_MIN_DURATION_MS, distancePx / ARRIVAL_SPEED_PX_MS),
|
|
40
|
+
),
|
|
41
|
+
);
|
|
42
|
+
const dropDuration = (distancePx: number): number =>
|
|
43
|
+
Math.round(
|
|
44
|
+
Math.min(
|
|
45
|
+
DROP_MAX_DURATION_MS,
|
|
46
|
+
Math.max(DROP_MIN_DURATION_MS, distancePx / DROP_SPEED_PX_MS),
|
|
47
|
+
),
|
|
48
|
+
);
|
|
22
49
|
const VARIABLES = [
|
|
23
50
|
"--ps-duration",
|
|
24
51
|
"--ps-minimize",
|
|
25
52
|
"--ps-drop-delay",
|
|
26
53
|
"--ps-drop-dur",
|
|
54
|
+
"--ps-drop-distance",
|
|
27
55
|
"--ps-in-x",
|
|
28
56
|
"--ps-in-y",
|
|
29
57
|
"--ps-pad-from",
|
|
30
58
|
];
|
|
31
59
|
|
|
32
|
-
/** Where the new page starts, per direction.
|
|
33
|
-
|
|
60
|
+
/** Where the new page starts, per direction. From above: the offset is
|
|
61
|
+
* the page's OWN height plus a viewport - a bare -100vh only clears the
|
|
62
|
+
* first viewport of a tall page, so its mid-page band (windows included)
|
|
63
|
+
* sat inside the viewport at animation start. -100% (translate % = the
|
|
64
|
+
* element's own height) puts the whole page above the screen; the extra
|
|
65
|
+
* viewport is runway. */
|
|
66
|
+
const START: Record<Direction | "parked", [string, string]> = {
|
|
67
|
+
right: ["100vw", "0"],
|
|
68
|
+
left: ["-100vw", "0"],
|
|
69
|
+
down: ["0", "calc(-100% - 100vh)"],
|
|
70
|
+
// Initial load ONTO a hyperlinked window target: the theme is fully
|
|
71
|
+
// installed (its class drives the minimize folds and navigation hooks)
|
|
72
|
+
// but the entrance is zero-distance - nothing visibly moves while the
|
|
73
|
+
// reveal scrolls to the linked section.
|
|
74
|
+
parked: ["0", "0"],
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/** The per-transition durations: the arrival's, the drop's, and the
|
|
78
|
+
* cascade tail (the drop may not begin until the last window's fold has
|
|
79
|
+
* finished - the tail is that wait). */
|
|
80
|
+
interface SlideScale {
|
|
81
|
+
arrivalMs: number;
|
|
82
|
+
dropMs: number;
|
|
83
|
+
tailMs: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const slide = (
|
|
87
|
+
name: string,
|
|
88
|
+
inX: string,
|
|
89
|
+
inY: string,
|
|
90
|
+
scale: SlideScale,
|
|
91
|
+
): ThemeDefinition => ({
|
|
34
92
|
className: CLASS,
|
|
35
93
|
attributes: { [ATTRIBUTE]: name },
|
|
36
94
|
variables: {
|
|
37
|
-
"--ps-duration": `${
|
|
38
|
-
"--ps-minimize": `${
|
|
39
|
-
"--ps-drop-delay": `${
|
|
40
|
-
"--ps-drop-dur": `${
|
|
95
|
+
"--ps-duration": `${scale.arrivalMs}ms`,
|
|
96
|
+
"--ps-minimize": `${FOLD_MS}ms`,
|
|
97
|
+
"--ps-drop-delay": `${scale.tailMs}ms`,
|
|
98
|
+
"--ps-drop-dur": `${scale.dropMs}ms`,
|
|
41
99
|
"--ps-in-x": inX,
|
|
42
100
|
"--ps-in-y": inY,
|
|
43
101
|
},
|
|
44
102
|
});
|
|
45
103
|
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/** Initial load ONTO a hyperlinked window target: the slide theme is
|
|
51
|
-
* fully installed (its class drives minimize folds and the navigation
|
|
52
|
-
* hooks) but with a zero-distance entrance — nothing visibly moves
|
|
53
|
-
* while the reveal scrolls to the linked section. */
|
|
54
|
-
parked: slide("parked", "0", "0"),
|
|
55
|
-
};
|
|
104
|
+
const themeFor = (
|
|
105
|
+
name: Direction | "parked",
|
|
106
|
+
scale: SlideScale,
|
|
107
|
+
): ThemeDefinition => slide(name, START[name][0], START[name][1], scale);
|
|
56
108
|
|
|
57
109
|
const root = () => document.documentElement;
|
|
58
|
-
const applyDirection = (themeName: Direction | "parked") =>
|
|
110
|
+
const applyDirection = (themeName: Direction | "parked", scale: SlideScale) =>
|
|
59
111
|
setTheme({
|
|
60
112
|
themeName,
|
|
61
|
-
themes,
|
|
113
|
+
themes: { [themeName]: themeFor(themeName, scale) },
|
|
62
114
|
previousClassNames: [CLASS],
|
|
63
115
|
persistence: "none",
|
|
64
116
|
accessibility: { setColorScheme: false },
|
|
@@ -71,17 +123,39 @@ const menuOrder = () =>
|
|
|
71
123
|
|
|
72
124
|
/** Static copy of the outgoing page: windows minimise into their title bars,
|
|
73
125
|
* then the whole page drops out of the bottom in one fast stroke. */
|
|
74
|
-
function leaveGhost():
|
|
126
|
+
function leaveGhost(): SlideScale {
|
|
75
127
|
root().style.removeProperty("--ps-pad-from");
|
|
128
|
+
root().style.removeProperty("--ps-drop-distance");
|
|
76
129
|
const main = document.querySelector("main");
|
|
77
|
-
if (!main)
|
|
78
|
-
|
|
130
|
+
if (!main) {
|
|
131
|
+
return { arrivalMs: ARRIVAL_MIN_DURATION_MS, dropMs: DROP_MIN_DURATION_MS, tailMs: 0 };
|
|
132
|
+
}
|
|
133
|
+
// Measure the LIVE layout first - the detached clone reports zero-size
|
|
79
134
|
// boxes, which is what used to blank the placeholders and collapse
|
|
80
135
|
// windows instantly. querySelectorAll order is stable across cloneNode.
|
|
81
136
|
const liveMedias = [...main.querySelectorAll("iframe, audio, video")];
|
|
82
137
|
const mediaBoxes = liveMedias.map((el) => el.getBoundingClientRect());
|
|
83
138
|
|
|
84
139
|
const rect = main.getBoundingClientRect();
|
|
140
|
+
// The drop distance is measured, not fixed: the ghost's TOP edge must
|
|
141
|
+
// pass the viewport bottom, which is 100vh MINUS the old page's scroll
|
|
142
|
+
// offset (rect.top goes negative as the page scrolls) - plus margin to
|
|
143
|
+
// clear the folded sliver. A fixed 110vh left the ghost's tail on
|
|
144
|
+
// screen whenever the old page was scrolled down.
|
|
145
|
+
const exitDistance =
|
|
146
|
+
window.innerHeight - rect.top + window.innerHeight * 0.1;
|
|
147
|
+
root().style.setProperty(
|
|
148
|
+
"--ps-drop-distance",
|
|
149
|
+
`${Math.round(exitDistance)}px`,
|
|
150
|
+
);
|
|
151
|
+
// The exit's drop duration derives from the measured distance (one
|
|
152
|
+
// pace for every page size) and is set BEFORE the ghost attaches, so
|
|
153
|
+
// its animation starts at its final timing; applyDirection re-states
|
|
154
|
+
// the same values through the theme right after - a no-op on the
|
|
155
|
+
// running animation. The fold beat (FOLD_MS) is a constant.
|
|
156
|
+
const dropMs = dropDuration(exitDistance);
|
|
157
|
+
root().style.setProperty("--ps-drop-dur", `${dropMs}ms`);
|
|
158
|
+
root().style.setProperty("--ps-minimize", `${FOLD_MS}ms`);
|
|
85
159
|
const ghost = main.cloneNode(true) as HTMLElement;
|
|
86
160
|
ghost.classList.add("page-slide-ghost");
|
|
87
161
|
Object.assign(ghost.style, {
|
|
@@ -117,41 +191,71 @@ function leaveGhost(): void {
|
|
|
117
191
|
? "page-slide-placeholder page-slide-placeholder-frame"
|
|
118
192
|
: "page-slide-placeholder";
|
|
119
193
|
placeholder.style.cssText = `width:${box.width}px;height:${box.height}px`;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
194
|
+
// The MAINTAIN pass: a placeholder NEVER shows the bare page
|
|
195
|
+
// background - the blank flash reported inside expanded sections
|
|
196
|
+
// during the fall. It takes the owning window's paper (the section
|
|
197
|
+
// keeps its surface); document frames that carry their own opaque
|
|
198
|
+
// background (the white resume preview) keep it.
|
|
199
|
+
const ownBg = live ? getComputedStyle(live).backgroundColor : "";
|
|
200
|
+
const hasOwnBg =
|
|
201
|
+
!!ownBg && ownBg !== "transparent" && ownBg !== "rgba(0, 0, 0, 0)";
|
|
202
|
+
const owner = live?.closest(".window-body") ?? live?.closest(".window");
|
|
203
|
+
const paper = owner ? getComputedStyle(owner).backgroundColor : "";
|
|
204
|
+
const hasPaper =
|
|
205
|
+
!!paper && paper !== "transparent" && paper !== "rgba(0, 0, 0, 0)";
|
|
206
|
+
placeholder.style.backgroundColor = hasOwnBg
|
|
207
|
+
? (ownBg ?? "")
|
|
208
|
+
: hasPaper
|
|
209
|
+
? (paper ?? "")
|
|
210
|
+
: "";
|
|
135
211
|
el.replaceWith(placeholder);
|
|
136
212
|
});
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
213
|
+
// THE EXIT: single-window pages keep the shrink - one window's XP
|
|
214
|
+
// minimise (squash-and-fall to the taskbar line, distance-derived
|
|
215
|
+
// speed, gravity) IS the page's exit story. MULTI-window pages exit
|
|
216
|
+
// HOMOGENEOUSLY: no per-window fold at all - every differential beat
|
|
217
|
+
// (staggered, simultaneous, raised, any of it) tore the exit apart
|
|
218
|
+
// with revealed sections collapsing at different rates - the whole
|
|
219
|
+
// page just slides out as one piece. The maximized wrapper swaps its
|
|
220
|
+
// class to .maximized-backdrop while the window is lifted (the same
|
|
221
|
+
// in-tree element), so the count must match BOTH states.
|
|
140
222
|
const taskbarLine = window.innerHeight;
|
|
141
|
-
const topLevel =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
win
|
|
150
|
-
|
|
223
|
+
const topLevel =
|
|
224
|
+
".page > .window, .page > .maximized-shell > .window, .page > .maximized-backdrop > .window";
|
|
225
|
+
const liveWins = [...main.querySelectorAll<HTMLElement>(topLevel)];
|
|
226
|
+
const flatExit = liveWins.length > 1;
|
|
227
|
+
let tailMs = 0;
|
|
228
|
+
if (flatExit) {
|
|
229
|
+
ghost.classList.add("page-slide-ghost-flat");
|
|
230
|
+
} else {
|
|
231
|
+
const win = ghost.querySelector<HTMLElement>(topLevel);
|
|
232
|
+
if (win) {
|
|
233
|
+
const liveWin = liveWins[0];
|
|
234
|
+
// the fall: the window's bottom edge to the taskbar line
|
|
235
|
+
const fall = Math.max(
|
|
236
|
+
0,
|
|
237
|
+
taskbarLine - (liveWin?.getBoundingClientRect().bottom ?? 0),
|
|
238
|
+
);
|
|
239
|
+
// TWICE as fast as the page's own slide-down: the shrink's
|
|
240
|
+
// duration is HALF the drop's (0.5x), while the page's own
|
|
241
|
+
// slide-down keeps its distance-derived pace - the two motions
|
|
242
|
+
// hold their relative pace at every page size and scroll offset.
|
|
243
|
+
const foldMs = Math.round(dropMs * 0.5);
|
|
244
|
+
win.style.setProperty("--page-fold-dy", `${Math.round(fall)}px`);
|
|
245
|
+
win.style.setProperty("--ps-fold-delay", "0ms");
|
|
246
|
+
// the fold duration inherits down the window's subtree, so its
|
|
247
|
+
// children squash in the same beat
|
|
248
|
+
win.style.setProperty("--ps-minimize", `${foldMs}ms`);
|
|
249
|
+
// the drop begins as the one window's fall finishes
|
|
250
|
+
tailMs = foldMs;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
root().style.setProperty("--ps-drop-delay", `${tailMs}ms`);
|
|
254
|
+
const removalMs = tailMs + dropMs + REMOVAL_MARGIN_MS;
|
|
151
255
|
document.body.appendChild(ghost);
|
|
152
256
|
// Maximized overlays ride INSIDE the ghost now (they are in-tree), so
|
|
153
257
|
// the dimmed layer and the maximized window fold and drop with the
|
|
154
|
-
// page
|
|
258
|
+
// page - no portal ride-out is needed on navigation.
|
|
155
259
|
document.querySelectorAll<HTMLElement>("body > .debug-bar").forEach((bar) => {
|
|
156
260
|
// A bar hidden by the maximized overlay rides nothing: cloning it
|
|
157
261
|
// only paints a flash after the unlock (the folded ghost unparks
|
|
@@ -162,18 +266,18 @@ function leaveGhost(): void {
|
|
|
162
266
|
// Layout rules key off this attribute; the clone must not keep them alive.
|
|
163
267
|
delete leaving.dataset.debugBar;
|
|
164
268
|
document.body.appendChild(leaving);
|
|
165
|
-
// The live bar yields to the clone in the same frame
|
|
166
|
-
// not display, so the body padding rules keep reserving its row
|
|
269
|
+
// The live bar yields to the clone in the same frame - visibility,
|
|
270
|
+
// not display, so the body padding rules keep reserving its row -
|
|
167
271
|
// and the clone drops (and fades) with the page instead of the bar
|
|
168
272
|
// blinking out at the route commit.
|
|
169
273
|
bar.classList.add("page-slide-bar-hide");
|
|
170
274
|
window.setTimeout(() => {
|
|
171
275
|
leaving.remove();
|
|
172
276
|
bar.classList.remove("page-slide-bar-hide");
|
|
173
|
-
},
|
|
277
|
+
}, removalMs);
|
|
174
278
|
});
|
|
175
279
|
const remove = (event?: Event) => {
|
|
176
|
-
// Child windows bubbling their minimise-end must NOT retire the ghost
|
|
280
|
+
// Child windows bubbling their minimise-end must NOT retire the ghost -
|
|
177
281
|
// wait for the drop animation on the ghost itself, or the timeout.
|
|
178
282
|
if (
|
|
179
283
|
event &&
|
|
@@ -186,15 +290,23 @@ function leaveGhost(): void {
|
|
|
186
290
|
ghost.remove();
|
|
187
291
|
};
|
|
188
292
|
ghost.addEventListener("animationend", remove);
|
|
189
|
-
window.setTimeout(() => remove(),
|
|
293
|
+
window.setTimeout(() => remove(), removalMs);
|
|
294
|
+
// The arrival's distance uses the OLD page's height as the estimate of
|
|
295
|
+
// the new page's (the route has not rendered yet); both durations
|
|
296
|
+
// derive from their own speeds.
|
|
297
|
+
return {
|
|
298
|
+
arrivalMs: arrivalDuration(rect.height + window.innerHeight),
|
|
299
|
+
dropMs,
|
|
300
|
+
tailMs,
|
|
301
|
+
};
|
|
190
302
|
}
|
|
191
303
|
|
|
192
304
|
let current = "";
|
|
193
305
|
let originalPushState: History["pushState"] | null = null;
|
|
194
306
|
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)
|
|
197
|
-
* click on top of the navigation fold. */
|
|
307
|
+
/** Mutes the next transition's fold click: the navigating window X
|
|
308
|
+
* (close) declares its own Click.ogg through the bus (closeSounds) - no
|
|
309
|
+
* second click on top of the navigation fold. */
|
|
198
310
|
let clickSuppressed = false;
|
|
199
311
|
|
|
200
312
|
export function suppressNextSlideClick(): void {
|
|
@@ -202,13 +314,13 @@ export function suppressNextSlideClick(): void {
|
|
|
202
314
|
}
|
|
203
315
|
|
|
204
316
|
/** On mobile screens the appearing page always slides straight down
|
|
205
|
-
* (from above)
|
|
317
|
+
* (from above) - the side-by-side menu-order metaphor doesn't read on
|
|
206
318
|
* a narrow, wrapped menu. Matches the layout.css 768px breakpoint. */
|
|
207
319
|
const isMobileLayout = () => window.matchMedia("(max-width: 768px)").matches;
|
|
208
320
|
|
|
209
321
|
function transition(to: string, hash: string): void {
|
|
210
322
|
if (to === current) return;
|
|
211
|
-
// The committed navigation rides the signal bus as a notice
|
|
323
|
+
// The committed navigation rides the signal bus as a notice -
|
|
212
324
|
// monitoring handlers subscribe; the choreography itself stays here.
|
|
213
325
|
dispatchSignal("page:navigated", { from: current, to });
|
|
214
326
|
if (clickSuppressed) clickSuppressed = false;
|
|
@@ -216,22 +328,26 @@ function transition(to: string, hash: string): void {
|
|
|
216
328
|
const direction = isMobileLayout()
|
|
217
329
|
? "down"
|
|
218
330
|
: resolveDirection(current, to, menuOrder());
|
|
219
|
-
leaveGhost();
|
|
220
|
-
applyDirection(direction);
|
|
331
|
+
const scale = leaveGhost();
|
|
332
|
+
applyDirection(direction, scale);
|
|
221
333
|
restartArrival();
|
|
222
334
|
current = to;
|
|
223
|
-
// A new page starts at the top
|
|
335
|
+
// A new page starts at the top - unless the url carries a hash, whose
|
|
224
336
|
// element the navigation scrolls itself to (scrollToHash).
|
|
225
337
|
if (!hash) window.scrollTo({ top: 0 });
|
|
226
338
|
}
|
|
227
339
|
|
|
228
340
|
/** Restart the just-applied destination slide so it runs in step with the
|
|
229
|
-
* exit choreography (fold + drop happen while the page slides in).
|
|
341
|
+
* exit choreography (fold + drop happen while the page slides in). The
|
|
342
|
+
* forced style flush between "none" and "" is REQUIRED: without it both
|
|
343
|
+
* writes resolve in one style pass, the CSS animation never restarts, and
|
|
344
|
+
* a same-direction navigation (every mobile move - mobile is always
|
|
345
|
+
* "down") pops the new page in with no slide at all. */
|
|
230
346
|
function restartArrival(): void {
|
|
231
347
|
const main = document.querySelector("main");
|
|
232
348
|
if (!main) return;
|
|
233
349
|
main.style.animation = "none";
|
|
234
|
-
|
|
350
|
+
void main.offsetWidth;
|
|
235
351
|
main.style.animation = "";
|
|
236
352
|
// The page element is main itself in the normalized shell (main.page):
|
|
237
353
|
// a nested .page resets separately, in whatever shape the document has.
|
|
@@ -240,7 +356,7 @@ function restartArrival(): void {
|
|
|
240
356
|
: main.querySelector<HTMLElement>(".page");
|
|
241
357
|
if (page) {
|
|
242
358
|
page.style.animation = "none";
|
|
243
|
-
|
|
359
|
+
void page.offsetWidth;
|
|
244
360
|
page.style.animation = "";
|
|
245
361
|
}
|
|
246
362
|
}
|
|
@@ -250,7 +366,7 @@ const onPopState = () => {
|
|
|
250
366
|
if (location.pathname === current) {
|
|
251
367
|
// Same-page history traversal only moves the shape of the URL:
|
|
252
368
|
// bring the hyperlinked element into view (inside its scrolling
|
|
253
|
-
// window)
|
|
369
|
+
// window) - and announce the RETURN, so holders of pre-departure
|
|
254
370
|
// state (the window store, same-path traversals never remount) can
|
|
255
371
|
// repair themselves.
|
|
256
372
|
if (location.hash) scrollToHash(location.hash);
|
|
@@ -262,7 +378,7 @@ const onPopState = () => {
|
|
|
262
378
|
}
|
|
263
379
|
transition(location.pathname, location.hash);
|
|
264
380
|
if (location.hash) scrollToHash(location.hash);
|
|
265
|
-
// A hash-free bookmarked return (the window departures' form
|
|
381
|
+
// A hash-free bookmarked return (the window departures' form - the
|
|
266
382
|
// entry names its section in STATE alone): land on it like any hash
|
|
267
383
|
// target. The reveal is the store's; the landing scroll is ours.
|
|
268
384
|
else scrollToId(windowBookmark() ?? "");
|
|
@@ -272,7 +388,7 @@ const onPopState = () => {
|
|
|
272
388
|
dispatchSignal("page:returned", arrival);
|
|
273
389
|
};
|
|
274
390
|
|
|
275
|
-
/** Scrolls the hash element into view
|
|
391
|
+
/** Scrolls the hash element into view - the aim implementation lives in
|
|
276
392
|
* @/lib/scrollTo, shared with the window system's dismissal landings. */
|
|
277
393
|
function scrollToHash(hash: string, attempts = 12): void {
|
|
278
394
|
const id = decodeURIComponent(hash.slice(1));
|
|
@@ -291,7 +407,7 @@ export function enablePageSlide(): void {
|
|
|
291
407
|
// Initial load ONTO a hyperlinked window target (#hash or a blog
|
|
292
408
|
// ?post= the route reveals): install the theme "parked" so the
|
|
293
409
|
// entrance slide plays from nowhere, then land the page on the target
|
|
294
|
-
//
|
|
410
|
+
// - the return-to-page choreography (the reveal is the window store's,
|
|
295
411
|
// the landing scroll is this theme's, like every hash navigation).
|
|
296
412
|
// Minimize folds / navigation hooks stay functional. Plain loads slide
|
|
297
413
|
// in from the top as before.
|
|
@@ -300,13 +416,25 @@ export function enablePageSlide(): void {
|
|
|
300
416
|
new URLSearchParams(location.search).has("post") ||
|
|
301
417
|
// A returned-to entry may name its section in STATE alone (the
|
|
302
418
|
// off-site bookmark is hash-free by design): that arrival is a
|
|
303
|
-
// landing on a target too
|
|
419
|
+
// landing on a target too - parked, reveal + scroll, nothing moves.
|
|
304
420
|
!!windowBookmark();
|
|
305
|
-
|
|
421
|
+
// The boot scale measures the landing page (main exists by now): the
|
|
422
|
+
// initial plain load slides in from above at the same speed every
|
|
423
|
+
// navigation uses.
|
|
424
|
+
const bootMain = document.querySelector("main");
|
|
425
|
+
const bootScale: SlideScale = {
|
|
426
|
+
arrivalMs: arrivalDuration(
|
|
427
|
+
(bootMain?.getBoundingClientRect().height ?? window.innerHeight) +
|
|
428
|
+
window.innerHeight,
|
|
429
|
+
),
|
|
430
|
+
dropMs: dropDuration(window.innerHeight * 1.1),
|
|
431
|
+
tailMs: 0,
|
|
432
|
+
};
|
|
433
|
+
applyDirection(linkedWindowTarget ? "parked" : "down", bootScale);
|
|
306
434
|
if (linkedWindowTarget) {
|
|
307
435
|
if (location.hash) scrollToHash(location.hash);
|
|
308
436
|
// A hash-free bookmarked target (the off-site return's form): the
|
|
309
|
-
// entry names its section in STATE alone
|
|
437
|
+
// entry names its section in STATE alone - land on it the same way
|
|
310
438
|
// the hash form lands.
|
|
311
439
|
else scrollToId(windowBookmark() ?? "");
|
|
312
440
|
}
|
|
@@ -329,14 +457,14 @@ export function enablePageSlide(): void {
|
|
|
329
457
|
(target.search !== location.search || target.hash !== location.hash)
|
|
330
458
|
) {
|
|
331
459
|
// Same-path CONTENT re-address: the router pushed a query or
|
|
332
|
-
// hash that names a new target (?post=, #id)
|
|
460
|
+
// hash that names a new target (?post=, #id) - announced AFTER
|
|
333
461
|
// the commit below, so the repair reads the new address. The
|
|
334
462
|
// window system's own anchor pushes carry the state bookmark
|
|
335
463
|
// and stay silent (they are UI entries, not content addresses).
|
|
336
464
|
samePathReaddress = true;
|
|
337
465
|
}
|
|
338
466
|
// Pure same-path pushes without a re-address stay silent: they
|
|
339
|
-
// are UI history entries, NOT page arrivals
|
|
467
|
+
// are UI history entries, NOT page arrivals - no landing scroll
|
|
340
468
|
// exists for them. Hash landings for real arrivals come from the
|
|
341
469
|
// boot branch, the popstate branches and hashchange.
|
|
342
470
|
}
|
|
@@ -351,10 +479,10 @@ export function enablePageSlide(): void {
|
|
|
351
479
|
};
|
|
352
480
|
// The ALIAS re-land: a shorthand path (/addons) boots as its own
|
|
353
481
|
// document and the router commits the destination (<Navigate
|
|
354
|
-
// to="/wow#addons" replace>) with a replaceState
|
|
482
|
+
// to="/wow#addons" replace>) with a replaceState - the only
|
|
355
483
|
// path-changing commit the pushState wrapper cannot see. It is not a
|
|
356
484
|
// traversal (nothing announces it; the fresh-arrival gate decides the
|
|
357
|
-
// store's landing by the referrer alone)
|
|
485
|
+
// store's landing by the referrer alone) - but the page must still be
|
|
358
486
|
// LANDED on the destination's hash element like every boot: aim the
|
|
359
487
|
// scroll at it (the retrying scrollToId absorbs the remount delay),
|
|
360
488
|
// and take over `current` so later pushes compare against the true
|