bun-plugin-stx 0.2.394 → 0.2.395

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.
@@ -744,6 +744,10 @@ function routerSource() {
744
744
  // there. sessionStorage is per tab and dies with it, same as the history.
745
745
  var SCROLL_TOKEN='__stxScroll';
746
746
  var SCROLL_STORE='stx:scroll:';
747
+ // On every entry the router pushes, never on the one the app opened with
748
+ // (which carries a scroll token too): going back from a pushed entry stays
749
+ // in the app, from the first it leaves it (or, in a phone app, does nothing).
750
+ var PUSHED_MARK='__stxPushed';
747
751
  var scrollSeq=0;
748
752
  var pendingScroll=null;
749
753
  var restoreScroll=!!o.scrollRestoration;
@@ -1527,9 +1531,18 @@ function routerSource() {
1527
1531
  // The position belongs to the entry being left, and scrollToken still
1528
1532
  // names it here.
1529
1533
  rememberScroll();
1530
- if(mode==='replace'){history.replaceState(tokenState(),'',href);return}
1534
+ if(mode==='replace'){
1535
+ // A replaced entry is still the one it replaces: pushed by the app or
1536
+ // the one the app opened with.
1537
+ var replaced=tokenState();
1538
+ if(history.state&&history.state[PUSHED_MARK])replaced[PUSHED_MARK]=true;
1539
+ history.replaceState(replaced,'',href);
1540
+ return;
1541
+ }
1531
1542
  scrollToken=newScrollToken();
1532
- history.pushState(tokenState(),'',href);
1543
+ var pushed=tokenState();
1544
+ pushed[PUSHED_MARK]=true;
1545
+ history.pushState(pushed,'',href);
1533
1546
  }
1534
1547
  function tokenState(){var state={};state[SCROLL_TOKEN]=scrollToken;return state}
1535
1548
 
package/dist/serve.js CHANGED
@@ -9800,7 +9800,7 @@ function __stxOverlay(errs){
9800
9800
  rebuildDiscoveredPagePaths(kept);
9801
9801
  await indexPageMiddleware(kept);
9802
9802
  try {
9803
- const { Router } = await import("./chunk-1ssqyfe3.js");
9803
+ const { Router } = await import("./chunk-ap1t4j02.js");
9804
9804
  const pagesDirs = patterns.map((p) => p.replace(/\/$/, "")).filter(Boolean);
9805
9805
  const router = new Router(process19.cwd(), { pagesDirs, stateDir: stateDirName(), exclude: options.exclude });
9806
9806
  if (!options.quiet)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.394",
4
+ "version": "0.2.395",
5
5
  "description": "A Bun plugin that allows for using Laravel Blade-like syntax.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -74,7 +74,7 @@
74
74
  "typecheck": "bun tsc --noEmit"
75
75
  },
76
76
  "dependencies": {
77
- "@stacksjs/stx": "0.2.394",
78
- "stx-router": "0.2.394"
77
+ "@stacksjs/stx": "0.2.395",
78
+ "stx-router": "0.2.395"
79
79
  }
80
80
  }