stx-router 0.2.807 → 0.2.810

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.
Files changed (2) hide show
  1. package/dist/client.js +8 -5
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -3271,7 +3271,7 @@ else {
3271
3271
  var sightObserver=null;
3272
3272
  var sightCount=0;
3273
3273
  // Prefetching is for the next page. It must not compete with the paint of
3274
- // this one, so the first sight-prefetch waits for first contentful paint
3274
+ // this one, so sight and eager prefetch wait for first contentful paint
3275
3275
  // (stacksjs/stacks#3082's measurement: two 600 KB documents were already in flight
3276
3276
  // when the page the person asked for had drawn nothing, three seconds each on a
3277
3277
  // slow link). A browser without paint timing keeps the immediate behaviour, and
@@ -3783,10 +3783,13 @@ else {
3783
3783
  delete restored[key];
3784
3784
  }
3785
3785
  };
3786
- // Soon after the first paint rather than whenever the page next idles: on
3787
- // a distant server each page is a second away, and the first tap comes fast.
3788
- if(window.requestIdleCallback)window.requestIdleCallback(run,{timeout:500});
3789
- else setTimeout(run,100);
3786
+ // Idle alone does not establish paint: it can arrive while critical styles
3787
+ // or content are still in flight. Share the sight-prefetch paint gate, then
3788
+ // keep the existing idle budget so eager tabs are ready for the first tap.
3789
+ afterFirstPaint(function(){
3790
+ if(window.requestIdleCallback)window.requestIdleCallback(run,{timeout:500});
3791
+ else setTimeout(run,100);
3792
+ });
3790
3793
  }
3791
3794
 
3792
3795
  // The page the app was opened on came as a whole document, so it is the
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stx-router",
3
3
  "type": "module",
4
- "version": "0.2.807",
4
+ "version": "0.2.810",
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",