stx-router 0.2.394 → 0.2.396
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/dist/client.js +15 -2
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -87,6 +87,10 @@ function routerSource() {
|
|
|
87
87
|
// there. sessionStorage is per tab and dies with it, same as the history.
|
|
88
88
|
var SCROLL_TOKEN='__stxScroll';
|
|
89
89
|
var SCROLL_STORE='stx:scroll:';
|
|
90
|
+
// On every entry the router pushes, never on the one the app opened with
|
|
91
|
+
// (which carries a scroll token too): going back from a pushed entry stays
|
|
92
|
+
// in the app, from the first it leaves it (or, in a phone app, does nothing).
|
|
93
|
+
var PUSHED_MARK='__stxPushed';
|
|
90
94
|
var scrollSeq=0;
|
|
91
95
|
var pendingScroll=null;
|
|
92
96
|
var restoreScroll=!!o.scrollRestoration;
|
|
@@ -870,9 +874,18 @@ function routerSource() {
|
|
|
870
874
|
// The position belongs to the entry being left, and scrollToken still
|
|
871
875
|
// names it here.
|
|
872
876
|
rememberScroll();
|
|
873
|
-
if(mode==='replace'){
|
|
877
|
+
if(mode==='replace'){
|
|
878
|
+
// A replaced entry is still the one it replaces: pushed by the app or
|
|
879
|
+
// the one the app opened with.
|
|
880
|
+
var replaced=tokenState();
|
|
881
|
+
if(history.state&&history.state[PUSHED_MARK])replaced[PUSHED_MARK]=true;
|
|
882
|
+
history.replaceState(replaced,'',href);
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
874
885
|
scrollToken=newScrollToken();
|
|
875
|
-
|
|
886
|
+
var pushed=tokenState();
|
|
887
|
+
pushed[PUSHED_MARK]=true;
|
|
888
|
+
history.pushState(pushed,'',href);
|
|
876
889
|
}
|
|
877
890
|
function tokenState(){var state={};state[SCROLL_TOKEN]=scrollToken;return state}
|
|
878
891
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stx-router",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.396",
|
|
5
5
|
"description": "File-based router for STX — .stx template discovery, nested layouts, typed route params, middleware, and client-side SPA navigation.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|