@conduction/docusaurus-preset 1.4.1 → 1.4.3
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
CHANGED
|
@@ -99,7 +99,13 @@ export default function Navbar() {
|
|
|
99
99
|
const rightItems = items.filter(i => i.position === 'right' || i.type === 'localeDropdown');
|
|
100
100
|
|
|
101
101
|
return (
|
|
102
|
-
|
|
102
|
+
/* `navbar` (Docusaurus's framework class) is added alongside the
|
|
103
|
+
brand styles.nav so the internal scroll-anchor offset query
|
|
104
|
+
`document.querySelector('.navbar').clientHeight` resolves. The
|
|
105
|
+
previous JS-only class swizzle made every doc page crash with
|
|
106
|
+
"Cannot read properties of null (reading 'clientHeight')" the
|
|
107
|
+
moment Docusaurus ran its anchor logic on a heading scroll. */
|
|
108
|
+
<nav className={`navbar ${styles.nav}`} role="navigation" aria-label="Main">
|
|
103
109
|
<div className={styles.left}>
|
|
104
110
|
<Link to={homeHref} className={styles.wordmark}>
|
|
105
111
|
{wordmark}
|
|
@@ -129,15 +129,37 @@
|
|
|
129
129
|
/* Product pages opt out of the boat-sinking mini-game by setting
|
|
130
130
|
`themeConfig.minigames = false` in createConfig(); the Footer
|
|
131
131
|
swizzle then doesn't render the .game-hud / .game-over / boat
|
|
132
|
-
templates. The
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
templates. The static decoration (trapgevel skyline, drift speeds,
|
|
133
|
+
Conduction-house Maps link, drift-boat caches) is still wanted —
|
|
134
|
+
run those first so a no-game build doesn't ship an empty .skyline.
|
|
135
|
+
Then bail out before the game-only wiring rather than null-deref'ing
|
|
136
|
+
on the missing HUD / restart-button. The script's `resize` handler
|
|
137
|
+
re-runs buildSkyline() on viewport changes too, so the skyline
|
|
138
|
+
stays full when a viewer resizes the window. */
|
|
135
139
|
if (!hud || !goRestart || !goPanel) {
|
|
136
|
-
|
|
137
|
-
|
|
140
|
+
buildSkyline();
|
|
141
|
+
rollSpeeds();
|
|
142
|
+
wireConductionHouse();
|
|
143
|
+
captureDriftTemplates();
|
|
144
|
+
const onResizeNoGame = () => {
|
|
145
|
+
clearTimeout(window._canalNoGameResizeT);
|
|
146
|
+
window._canalNoGameResizeT = setTimeout(() => {
|
|
147
|
+
buildSkyline();
|
|
148
|
+
rollSpeeds();
|
|
149
|
+
wireConductionHouse();
|
|
150
|
+
}, 200);
|
|
151
|
+
};
|
|
152
|
+
window.addEventListener('resize', onResizeNoGame);
|
|
153
|
+
/* Mark hydrated and expose hydrate as a no-op (the IIFE's later
|
|
154
|
+
`window.CanalFooter.hydrate = init` already handles the SPA
|
|
155
|
+
re-mount path; we just need _cleanup to tear down the resize
|
|
156
|
+
listener so it doesn't leak across SPA navigations. */
|
|
138
157
|
window.CanalFooter = window.CanalFooter || {};
|
|
139
|
-
window.CanalFooter.hydrate
|
|
140
|
-
window.CanalFooter._cleanup =
|
|
158
|
+
window.CanalFooter.hydrate = window.CanalFooter.hydrate || function () {};
|
|
159
|
+
window.CanalFooter._cleanup = function () {
|
|
160
|
+
window.removeEventListener('resize', onResizeNoGame);
|
|
161
|
+
clearTimeout(window._canalNoGameResizeT);
|
|
162
|
+
};
|
|
141
163
|
return;
|
|
142
164
|
}
|
|
143
165
|
|