stx-router 0.2.599 → 0.2.601

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 +17 -1
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -343,14 +343,30 @@ function routerSource() {
343
343
  qsa('['+VT_NAME+']').forEach(function(el){if(el!==named)el.removeAttribute(VT_NAME)});
344
344
  if(named&&!named.hasAttribute(VT_NAME))named.setAttribute(VT_NAME,'');
345
345
  }
346
+ // And it comes off again when the transition is over. A view-transition-name
347
+ // makes its element a stacking context, so a container left named kept
348
+ // every page's own overlay - a sheet, a modal, a library Dialog - under the
349
+ // sticky header and the tab bar whatever its z-index, from the first
350
+ // navigation on. Apps answered it per overlay; the name is only needed
351
+ // while the browser is capturing the old and new pages.
352
+ var transitionsRunning=0;
353
+ function unnameTransitionContainer(){
354
+ if(--transitionsRunning>0)return;
355
+ transitionsRunning=0;
356
+ qsa('['+VT_NAME+']').forEach(function(el){el.removeAttribute(VT_NAME)});
357
+ }
346
358
  function namedTransition(callback){
347
359
  nameTransitionContainer();
348
- return document.startViewTransition(function(){
360
+ transitionsRunning++;
361
+ var transition=document.startViewTransition(function(){
349
362
  var out=callback();
350
363
  nameTransitionContainer();
351
364
  if(out&&typeof out.then==='function')return out.then(function(v){nameTransitionContainer();return v});
352
365
  return out;
353
366
  });
367
+ if(transition&&transition.finished&&typeof transition.finished.then==='function')transition.finished.then(unnameTransitionContainer,unnameTransitionContainer);
368
+ else unnameTransitionContainer();
369
+ return transition;
354
370
  }
355
371
  function runViewTransition(callback){
356
372
  if(instantNav||!o.viewTransitions||!document.startViewTransition)return false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stx-router",
3
3
  "type": "module",
4
- "version": "0.2.599",
4
+ "version": "0.2.601",
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",