mnfst 0.5.33 → 0.5.35

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.
@@ -163,6 +163,12 @@ window.ManifestRoutingPosition = {
163
163
  let currentRoute = '/';
164
164
  let isInternalNavigation = false;
165
165
 
166
+ function isPrerenderedStaticBuild() {
167
+ // When prerendered HTML is served as static pages, prefer normal browser navigation (MPA)
168
+ // so each URL loads its own prerendered HTML rather than SPA toggling.
169
+ return !!document.querySelector('meta[name="manifest:prerendered"][content="1"]');
170
+ }
171
+
166
172
  function getBasePath() {
167
173
  return (typeof window.getManifestBasePath === 'function' ? window.getManifestBasePath() : '') || '';
168
174
  }
@@ -353,15 +359,18 @@ function initializeNavigation() {
353
359
  // Set initial route (logical path for matching)
354
360
  currentRoute = pathnameToLogical(window.location.pathname);
355
361
 
356
- // Intercept link clicks
357
- interceptLinkClicks();
362
+ // In prerendered/static output, use default browser navigation (no interception)
363
+ if (!isPrerenderedStaticBuild()) {
364
+ // Intercept link clicks
365
+ interceptLinkClicks();
358
366
 
359
- // Listen for popstate events (browser back/forward)
360
- window.addEventListener('popstate', () => {
361
- if (!isInternalNavigation) {
362
- handleRouteChange();
363
- }
364
- });
367
+ // Listen for popstate events (browser back/forward)
368
+ window.addEventListener('popstate', () => {
369
+ if (!isInternalNavigation) {
370
+ handleRouteChange();
371
+ }
372
+ });
373
+ }
365
374
 
366
375
  // Handle initial route
367
376
  handleRouteChange();
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "mnfst",
3
- "version": "0.5.33",
3
+ "version": "0.5.35",
4
4
  "private": false,
5
5
  "workspaces": [
6
- "templates/starter"
6
+ "templates/starter",
7
+ "packages/render"
7
8
  ],
8
9
  "main": "dist/manifest.js",
9
10
  "style": "dist/manifest.css",
@@ -13,16 +14,18 @@
13
14
  "LICENSE"
14
15
  ],
15
16
  "scripts": {
16
- "clean": "rimraf src/scripts/manifest.js src/styles/manifest.css src/styles/manifest.min.css src/styles/manifest.code.min.css dist",
17
+ "clean": "rimraf src/scripts/manifest.js src/scripts/manifest.render.mjs src/styles/manifest.css src/styles/manifest.min.css src/styles/manifest.code.min.css dist",
17
18
  "build": "cd src && node scripts/build.mjs",
18
19
  "build:docs": "echo 'Docs is a static website - no build needed'",
19
20
  "start:src": "cd src && browser-sync start --config bs-config.js",
20
21
  "start:docs": "cd docs && browser-sync start --config bs-config.js",
21
22
  "start:starter": "cd templates/starter && browser-sync start --config bs-config.js --port 3001",
22
- "prerender": "node src/prerender.mjs --root src",
23
- "prerender:docs": "node src/prerender.mjs --root docs",
24
- "prerender:starter": "node src/prerender.mjs --root templates/starter",
23
+ "prerender": "node src/scripts/manifest.render.mjs --root src",
24
+ "prerender:docs": "node src/scripts/manifest.render.mjs --root docs",
25
+ "prerender:starter": "node src/scripts/manifest.render.mjs --root templates/starter",
26
+ "render": "node src/scripts/manifest.render.mjs --root src",
25
27
  "publish:starter": "cd packages/create-starter && npm publish --auth-type=web",
28
+ "publish:render": "cd packages/render && npm publish --auth-type=web",
26
29
  "prepublishOnly": "npm run build",
27
30
  "test": "echo 'No tests configured'",
28
31
  "lint": "echo 'No linting configured'"
@@ -59,4 +62,4 @@
59
62
  "bugs": {
60
63
  "url": "https://github.com/andrewmatlock/manifest/issues"
61
64
  }
62
- }
65
+ }