mnfst 0.5.43 → 0.5.45

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.
@@ -166,7 +166,11 @@ let isInternalNavigation = false;
166
166
  function isPrerenderedStaticBuild() {
167
167
  // When prerendered HTML is served as static pages, prefer normal browser navigation (MPA)
168
168
  // so each URL loads its own prerendered HTML rather than SPA toggling.
169
- return !!document.querySelector('meta[name="manifest:prerendered"][content="1"]');
169
+ const prerendered = document.querySelector('meta[name="manifest:prerendered"]');
170
+ const val = (prerendered?.getAttribute('content') || '').trim().toLowerCase();
171
+ if (prerendered && val !== '0' && val !== 'false') return true;
172
+ // Backstop: prerender writes this per-page depth marker.
173
+ return !!document.querySelector('meta[name="manifest:router-base-depth"]');
170
174
  }
171
175
 
172
176
  function getBasePath() {
@@ -359,6 +363,7 @@ async function handleRouteChange() {
359
363
  const newRoute = pathnameToLogical(pathname);
360
364
  if (newRoute === currentRoute) return;
361
365
 
366
+ const prevRoute = currentRoute;
362
367
  currentRoute = newRoute;
363
368
 
364
369
  // Handle scrolling based on whether this is an anchor link or route change
@@ -399,7 +404,7 @@ async function handleRouteChange() {
399
404
  // Emit route change event
400
405
  window.dispatchEvent(new CustomEvent('manifest:route-change', {
401
406
  detail: {
402
- from: currentRoute,
407
+ from: prevRoute,
403
408
  to: newRoute,
404
409
  normalizedPath: newRoute === '/' ? '/' : newRoute.replace(/^\/|\/$/g, '')
405
410
  }
@@ -471,9 +476,9 @@ function installMpaStickyLocaleLinks() {
471
476
 
472
477
  const path = url.pathname.replace(/\/$/, '') || '/';
473
478
  const adjusted = applyStickyLocaleToPathname(path);
474
- if (adjusted === path) return;
475
-
476
479
  event.preventDefault();
480
+ event.stopPropagation();
481
+ event.stopImmediatePropagation();
477
482
  url.pathname = adjusted;
478
483
 
479
484
  const dest = url.toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst",
3
- "version": "0.5.43",
3
+ "version": "0.5.45",
4
4
  "private": false,
5
5
  "workspaces": [
6
6
  "templates/starter",