stx-router 0.2.126 → 0.2.127
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.d.ts +0 -19
- package/dist/client.js +13 -2
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,20 +1 @@
|
|
|
1
|
-
/* eslint-disable prefer-const, no-console, style/max-statements-per-line, general/prefer-template */
|
|
2
|
-
/**
|
|
3
|
-
* STX Router - Canonical SPA Router
|
|
4
|
-
*
|
|
5
|
-
* Single source of truth for client-side navigation.
|
|
6
|
-
* Injected via @stxRouter directive or auto-loaded with the signals runtime.
|
|
7
|
-
*
|
|
8
|
-
* Features:
|
|
9
|
-
* - Click interception for internal links
|
|
10
|
-
* - History API pushState navigation
|
|
11
|
-
* - View Transitions API with CSS fade fallback
|
|
12
|
-
* - <head> style swapping (prevents unstyled flash)
|
|
13
|
-
* - Smart script filtering (skip signals runtime, layout guards)
|
|
14
|
-
* - Page prefetching on hover
|
|
15
|
-
* - Response caching (5-minute TTL)
|
|
16
|
-
* - Active link class management (data-stx-link)
|
|
17
|
-
* - Loading indicator bar
|
|
18
|
-
* - Configurable via window.STX_ROUTER_OPTIONS or window.__stxRouterConfig
|
|
19
|
-
*/
|
|
20
1
|
export declare function getRouterScript(): string;
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
let cachedRouterScript;
|
|
2
|
+
function minifyRouterScript(source) {
|
|
3
|
+
try {
|
|
4
|
+
return new Bun.Transpiler({ loader: "js", minifyWhitespace: !0 }).transformSync(source).replace(/\}(var |let |const |function )/g, "};$1").trim();
|
|
5
|
+
} catch {
|
|
6
|
+
return source;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
1
9
|
export function getRouterScript() {
|
|
2
|
-
|
|
10
|
+
if (cachedRouterScript)
|
|
11
|
+
return cachedRouterScript;
|
|
12
|
+
cachedRouterScript = minifyRouterScript(`
|
|
3
13
|
;(function(){
|
|
4
14
|
'use strict';
|
|
5
15
|
var ROUTER_REV=3;
|
|
@@ -1040,5 +1050,6 @@ else {
|
|
|
1040
1050
|
|
|
1041
1051
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
1042
1052
|
})();
|
|
1043
|
-
|
|
1053
|
+
`);
|
|
1054
|
+
return cachedRouterScript;
|
|
1044
1055
|
}
|
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.127",
|
|
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",
|