bun-plugin-stx 0.2.374 → 0.2.375
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.
|
@@ -2805,13 +2805,34 @@ else {
|
|
|
2805
2805
|
};
|
|
2806
2806
|
}
|
|
2807
2807
|
|
|
2808
|
+
// A nav marked data-stx-sticky-active is a tab bar: each tab owns the
|
|
2809
|
+
// screens opened from it, as on iOS. On a page that is none of its links'
|
|
2810
|
+
// own, the link that was current stays current (a workout opened from
|
|
2811
|
+
// Today keeps Today lit), and data-stx-active-match only decides a page
|
|
2812
|
+
// reached with nothing current yet, such as a cold start on a deep link.
|
|
2813
|
+
// data-stx-nav-current remembers which link that was, because
|
|
2814
|
+
// updateActiveLinks has already rewritten the classes by now.
|
|
2808
2815
|
function updateNav(){
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
var
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2816
|
+
var done=new Set();
|
|
2817
|
+
qsa('nav, #mobileNav, [data-stx-nav]').forEach(function(nav){
|
|
2818
|
+
var states=[];
|
|
2819
|
+
Array.prototype.forEach.call(nav.querySelectorAll('a[href]'),function(a){
|
|
2820
|
+
if(done.has(a)||!a.hasAttribute('data-stx-link'))return;
|
|
2821
|
+
done.add(a);
|
|
2822
|
+
var st=linkState(a.getAttribute('href'),a.getAttribute('data-stx-active-match'));
|
|
2823
|
+
if(st)states.push({a:a,st:st});
|
|
2824
|
+
});
|
|
2825
|
+
var kept=null;
|
|
2826
|
+
if(nav.hasAttribute('data-stx-sticky-active')&&!states.some(function(x){return x.st.exact})){
|
|
2827
|
+
kept=states.filter(function(x){return x.a.hasAttribute('data-stx-nav-current')})[0]||null;
|
|
2828
|
+
}
|
|
2829
|
+
states.forEach(function(x){
|
|
2830
|
+
var a=x.a,st=x.st;
|
|
2831
|
+
var on=kept?a===kept.a:(st.exact||st.matched);
|
|
2832
|
+
var ac=a.getAttribute('data-stx-active-class')||'active';
|
|
2833
|
+
ac.split(' ').forEach(function(cls){if(cls){if(on)a.classList.add(cls);else a.classList.remove(cls)}});
|
|
2834
|
+
if(on)a.setAttribute('data-stx-nav-current','');else a.removeAttribute('data-stx-nav-current');
|
|
2835
|
+
});
|
|
2815
2836
|
});
|
|
2816
2837
|
}
|
|
2817
2838
|
|
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-
|
|
9803
|
+
const { Router } = await import("./chunk-cvtsgd6h.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.
|
|
4
|
+
"version": "0.2.375",
|
|
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.
|
|
78
|
-
"stx-router": "0.2.
|
|
77
|
+
"@stacksjs/stx": "0.2.375",
|
|
78
|
+
"stx-router": "0.2.375"
|
|
79
79
|
}
|
|
80
80
|
}
|