juxscript 1.1.363 → 1.1.365
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/components/routes.d.ts +14 -89
- package/dist/components/routes.d.ts.map +1 -1
- package/dist/components/routes.js +39 -186
- package/dist/components/routes.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/machinery/compiler4.js +15 -0
- package/package.json +1 -1
|
@@ -1,96 +1,21 @@
|
|
|
1
|
-
interface
|
|
1
|
+
export interface RouteInfo {
|
|
2
2
|
path: string;
|
|
3
3
|
name: string;
|
|
4
|
-
|
|
4
|
+
file: string;
|
|
5
5
|
}
|
|
6
|
-
declare
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
private _initialized;
|
|
11
|
-
/**
|
|
12
|
-
* Register a route
|
|
13
|
-
*/
|
|
14
|
-
add(path: string, name?: string, render?: () => void | Promise<void>): this;
|
|
15
|
-
/**
|
|
16
|
-
* Register multiple routes at once
|
|
17
|
-
*/
|
|
18
|
-
addAll(routes: Record<string, (() => void | Promise<void>) | {
|
|
19
|
-
name?: string;
|
|
20
|
-
render?: () => void | Promise<void>;
|
|
21
|
-
}>): this;
|
|
22
|
-
/**
|
|
23
|
-
* Navigate to a path — mirrors compiler4's `route()` + `navigateTo()`
|
|
24
|
-
*/
|
|
25
|
-
navigate(path: string): void;
|
|
26
|
-
/**
|
|
27
|
-
* Get the current route path
|
|
28
|
-
*/
|
|
29
|
-
current(): string;
|
|
30
|
-
/**
|
|
31
|
-
* Get the current route object
|
|
32
|
-
*/
|
|
33
|
-
currentRoute(): Route | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* Get all registered routes
|
|
36
|
-
*/
|
|
37
|
-
all(): Route[];
|
|
38
|
-
/**
|
|
39
|
-
* Get all registered route paths
|
|
40
|
-
*/
|
|
6
|
+
export declare const routes: {
|
|
7
|
+
/** All .jux file routes from the source directory */
|
|
8
|
+
all(): RouteInfo[];
|
|
9
|
+
/** Just the route paths */
|
|
41
10
|
paths(): string[];
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
11
|
+
/** Current browser path */
|
|
12
|
+
current(): string;
|
|
13
|
+
/** Is this path active? */
|
|
45
14
|
isActive(path: string): boolean;
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
* Listen for navigation events
|
|
52
|
-
*/
|
|
53
|
-
onNavigate(callback: (path: string, route?: Route) => void): () => void;
|
|
54
|
-
/**
|
|
55
|
-
* Initialize browser listeners — mirrors compiler4's popstate + click handlers
|
|
56
|
-
*/
|
|
57
|
-
init(): this;
|
|
58
|
-
/**
|
|
59
|
-
* Execute a route — clears containers and calls render, mirrors compiler4's `route()` function
|
|
60
|
-
*/
|
|
61
|
-
private _exec;
|
|
62
|
-
/**
|
|
63
|
-
* Normalize a path — mirrors compiler4's route path normalization
|
|
64
|
-
*/
|
|
65
|
-
private _normalize;
|
|
66
|
-
/**
|
|
67
|
-
* Derive a display name from a path
|
|
68
|
-
*/
|
|
69
|
-
private _nameFromPath;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Get the router singleton.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* import { routes } from 'juxscript';
|
|
76
|
-
*
|
|
77
|
-
* // Register routes
|
|
78
|
-
* routes.add('/home', 'Home');
|
|
79
|
-
* routes.add('/about', 'About');
|
|
80
|
-
*
|
|
81
|
-
* // Navigate
|
|
82
|
-
* routes.navigate('/about');
|
|
83
|
-
*
|
|
84
|
-
* // Check active
|
|
85
|
-
* routes.isActive('/about'); // true
|
|
86
|
-
*
|
|
87
|
-
* // Get all paths (for sidebar/nav)
|
|
88
|
-
* routes.paths(); // ['/home', '/about']
|
|
89
|
-
*
|
|
90
|
-
* // Listen for changes
|
|
91
|
-
* routes.onNavigate((path) => console.log('Navigated to', path));
|
|
92
|
-
*/
|
|
93
|
-
export declare function routes(): Router;
|
|
94
|
-
export { Router, Route };
|
|
15
|
+
/** SPA navigate */
|
|
16
|
+
navigate(path: string): void;
|
|
17
|
+
/** Listen for route changes */
|
|
18
|
+
onNavigate(callback: (path: string) => void): () => void;
|
|
19
|
+
};
|
|
95
20
|
export default routes;
|
|
96
21
|
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../lib/components/routes.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../lib/components/routes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAcD,eAAO,MAAM,MAAM;IACf,qDAAqD;WAC9C,SAAS,EAAE;IAIlB,2BAA2B;aAClB,MAAM,EAAE;IAIjB,2BAA2B;eAChB,MAAM;IAIjB,2BAA2B;mBACZ,MAAM,GAAG,OAAO;IAI/B,mBAAmB;mBACJ,MAAM,GAAG,IAAI;IAK5B,+BAA+B;yBACV,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;CAM3D,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,193 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
name: name || this._nameFromPath(normalizedPath),
|
|
16
|
-
render
|
|
17
|
-
});
|
|
18
|
-
return this;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Register multiple routes at once
|
|
22
|
-
*/
|
|
23
|
-
addAll(routes) {
|
|
24
|
-
for (const [path, value] of Object.entries(routes)) {
|
|
25
|
-
if (typeof value === 'function') {
|
|
26
|
-
this.add(path, undefined, value);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
this.add(path, value.name, value.render);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Navigate to a path — mirrors compiler4's `route()` + `navigateTo()`
|
|
36
|
-
*/
|
|
37
|
-
navigate(path) {
|
|
38
|
-
const normalizedPath = this._normalize(path);
|
|
39
|
-
this._currentPath = normalizedPath;
|
|
40
|
-
if (typeof window !== 'undefined') {
|
|
41
|
-
window.history.pushState({}, '', normalizedPath);
|
|
42
|
-
}
|
|
43
|
-
this._exec(normalizedPath);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Get the current route path
|
|
47
|
-
*/
|
|
48
|
-
current() {
|
|
49
|
-
return this._currentPath;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Get the current route object
|
|
53
|
-
*/
|
|
54
|
-
currentRoute() {
|
|
55
|
-
return this._routes.get(this._currentPath) || this._routes.get('/');
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Get all registered routes
|
|
59
|
-
*/
|
|
1
|
+
function _nameFromPath(p) {
|
|
2
|
+
if (p === '/')
|
|
3
|
+
return 'Home';
|
|
4
|
+
const seg = p.split('/').filter(Boolean).pop() || 'Home';
|
|
5
|
+
return seg.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' ');
|
|
6
|
+
}
|
|
7
|
+
function _getData() {
|
|
8
|
+
const w = typeof window !== 'undefined' ? window : null;
|
|
9
|
+
if (!w?.__juxRouteIndex)
|
|
10
|
+
return [];
|
|
11
|
+
return w.__juxRouteIndex;
|
|
12
|
+
}
|
|
13
|
+
export const routes = {
|
|
14
|
+
/** All .jux file routes from the source directory */
|
|
60
15
|
all() {
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Get all registered route paths
|
|
65
|
-
*/
|
|
16
|
+
return _getData();
|
|
17
|
+
},
|
|
18
|
+
/** Just the route paths */
|
|
66
19
|
paths() {
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
20
|
+
return _getData().map(r => r.path);
|
|
21
|
+
},
|
|
22
|
+
/** Current browser path */
|
|
23
|
+
current() {
|
|
24
|
+
return typeof window !== 'undefined' ? window.location.pathname : '/';
|
|
25
|
+
},
|
|
26
|
+
/** Is this path active? */
|
|
72
27
|
isActive(path) {
|
|
73
|
-
return
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Listen for navigation events
|
|
83
|
-
*/
|
|
28
|
+
return routes.current() === path;
|
|
29
|
+
},
|
|
30
|
+
/** SPA navigate */
|
|
31
|
+
navigate(path) {
|
|
32
|
+
const w = typeof window !== 'undefined' ? window : null;
|
|
33
|
+
if (w?.navigateTo)
|
|
34
|
+
w.navigateTo(path);
|
|
35
|
+
},
|
|
36
|
+
/** Listen for route changes */
|
|
84
37
|
onNavigate(callback) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Initialize browser listeners — mirrors compiler4's popstate + click handlers
|
|
92
|
-
*/
|
|
93
|
-
init() {
|
|
94
|
-
if (this._initialized || typeof window === 'undefined')
|
|
95
|
-
return this;
|
|
96
|
-
this._initialized = true;
|
|
97
|
-
this._currentPath = window.location.pathname;
|
|
98
|
-
// popstate (back/forward)
|
|
99
|
-
window.addEventListener('popstate', () => {
|
|
100
|
-
this._currentPath = window.location.pathname;
|
|
101
|
-
this._exec(this._currentPath);
|
|
102
|
-
});
|
|
103
|
-
// Intercept <a> clicks — mirrors compiler4's click handler
|
|
104
|
-
document.addEventListener('click', (e) => {
|
|
105
|
-
const link = e.target.closest('a[href]');
|
|
106
|
-
if (link) {
|
|
107
|
-
const href = link.getAttribute('href');
|
|
108
|
-
if (href && href.startsWith('/') && !href.startsWith('//')) {
|
|
109
|
-
e.preventDefault();
|
|
110
|
-
this.navigate(href);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
// Expose global navigateTo — mirrors compiler4
|
|
115
|
-
window.navigateTo = (path) => {
|
|
116
|
-
this.navigate(path);
|
|
117
|
-
};
|
|
118
|
-
return this;
|
|
38
|
+
if (typeof window === 'undefined')
|
|
39
|
+
return () => { };
|
|
40
|
+
const handler = () => callback(window.location.pathname);
|
|
41
|
+
window.addEventListener('popstate', handler);
|
|
42
|
+
return () => window.removeEventListener('popstate', handler);
|
|
119
43
|
}
|
|
120
|
-
|
|
121
|
-
* Execute a route — clears containers and calls render, mirrors compiler4's `route()` function
|
|
122
|
-
*/
|
|
123
|
-
_exec(path) {
|
|
124
|
-
const route = this._routes.get(path) || this._routes.get('/');
|
|
125
|
-
if (typeof document !== 'undefined') {
|
|
126
|
-
const appMain = document.getElementById('appmain-content');
|
|
127
|
-
if (appMain)
|
|
128
|
-
appMain.innerHTML = '';
|
|
129
|
-
const app = document.getElementById('app');
|
|
130
|
-
if (app)
|
|
131
|
-
app.innerHTML = '';
|
|
132
|
-
}
|
|
133
|
-
if (route?.render) {
|
|
134
|
-
route.render();
|
|
135
|
-
}
|
|
136
|
-
this._onNavigate.forEach(cb => cb(path, route));
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Normalize a path — mirrors compiler4's route path normalization
|
|
140
|
-
*/
|
|
141
|
-
_normalize(path) {
|
|
142
|
-
let p = path
|
|
143
|
-
.toLowerCase()
|
|
144
|
-
.replace(/\\/g, '/')
|
|
145
|
-
.replace(/\.jux$/i, '')
|
|
146
|
-
.replace(/\s+/g, '-')
|
|
147
|
-
.replace(/\/+$/g, '');
|
|
148
|
-
if (!p.startsWith('/'))
|
|
149
|
-
p = '/' + p;
|
|
150
|
-
if (p === '' || p === '/index')
|
|
151
|
-
p = '/';
|
|
152
|
-
return p;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Derive a display name from a path
|
|
156
|
-
*/
|
|
157
|
-
_nameFromPath(path) {
|
|
158
|
-
if (path === '/')
|
|
159
|
-
return 'Home';
|
|
160
|
-
const seg = path.split('/').filter(Boolean).pop() || 'Home';
|
|
161
|
-
return seg.charAt(0).toUpperCase() + seg.slice(1).replace(/-/g, ' ');
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Get the router singleton.
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* import { routes } from 'juxscript';
|
|
169
|
-
*
|
|
170
|
-
* // Register routes
|
|
171
|
-
* routes.add('/home', 'Home');
|
|
172
|
-
* routes.add('/about', 'About');
|
|
173
|
-
*
|
|
174
|
-
* // Navigate
|
|
175
|
-
* routes.navigate('/about');
|
|
176
|
-
*
|
|
177
|
-
* // Check active
|
|
178
|
-
* routes.isActive('/about'); // true
|
|
179
|
-
*
|
|
180
|
-
* // Get all paths (for sidebar/nav)
|
|
181
|
-
* routes.paths(); // ['/home', '/about']
|
|
182
|
-
*
|
|
183
|
-
* // Listen for changes
|
|
184
|
-
* routes.onNavigate((path) => console.log('Navigated to', path));
|
|
185
|
-
*/
|
|
186
|
-
export function routes() {
|
|
187
|
-
const n = new Router();
|
|
188
|
-
return n;
|
|
189
|
-
}
|
|
190
|
-
// Also export the class for typing
|
|
191
|
-
export { Router };
|
|
44
|
+
};
|
|
192
45
|
export default routes;
|
|
193
46
|
//# sourceMappingURL=routes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../lib/components/routes.ts"],"names":[],"mappings":"AAMA,
|
|
1
|
+
{"version":3,"file":"routes.js","source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AmB;IACnB,QAAQ,CAAC,IAAY;QACjB,MAAM,CAAC,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAE,MAAc,CAAC,CAAC,CAAC,IAAI,CAAC;QACjE,IAAI,CAAC,EAAE,UAAU;YAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,+BAA+B;IAC/B,UAAU,CAAC,QAAgC;QACvC,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACzD,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAC7C,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;CACJ,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -64,7 +64,15 @@ export declare const jux: {
|
|
|
64
64
|
a: typeof a;
|
|
65
65
|
container: typeof container;
|
|
66
66
|
grid: typeof grid;
|
|
67
|
-
routes:
|
|
67
|
+
routes: {
|
|
68
|
+
all(): import("./components/routes.js").RouteInfo[];
|
|
69
|
+
paths(): string[];
|
|
70
|
+
current(): string;
|
|
71
|
+
isActive(path: string): boolean;
|
|
72
|
+
navigate(path: string): void;
|
|
73
|
+
onNavigate(callback: (path: string) => void): () => void;
|
|
74
|
+
};
|
|
68
75
|
};
|
|
69
76
|
export { pageState };
|
|
77
|
+
export { routes };
|
|
70
78
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAA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I,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,CAAC,MAAM,GAAG,GAAG;IACf,GAAG;IACH,GAAG;IACH,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;IACtB,CAAC;IACD,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,OAAO;IACP,KAAK;IACL,KAAK;IACL,QAAQ;IACR,MAAM;IACN,GAAG;IACH,GAAG;IACH,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,KAAK;IACL,KAAK;IACL,IAAI;IACJ,MAAM;IACN,MAAM;IACN,KAAK;IACL,QAAQ;IACR,aAAa;IACb,IAAI;IACJ,KAAK;IACL,QAAQ;IACR,KAAK;IACL,GAAG;IACH,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,GAAG;IACH,IAAI;IACJ,CAAC;IACD,SAAS;IACT,IAAI;IACJ,MAAM;CACT,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,CAAC;AACjB,GAAW,CAAC,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC"}
|
package/machinery/compiler4.js
CHANGED
|
@@ -644,6 +644,21 @@ export class JuxCompiler {
|
|
|
644
644
|
|
|
645
645
|
router += `};\n\n`;
|
|
646
646
|
|
|
647
|
+
// Build route index for jux.routes.all()
|
|
648
|
+
const routeIndex = [];
|
|
649
|
+
routeToFunctionMap.forEach((functionName, routePath) => {
|
|
650
|
+
const name = routePath === '/'
|
|
651
|
+
? 'Home'
|
|
652
|
+
: routePath.split('/').filter(Boolean).pop()
|
|
653
|
+
.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' ');
|
|
654
|
+
// Find matching source file from snapshot
|
|
655
|
+
const sourceFile = this._sourceSnapshot
|
|
656
|
+
? Object.values(this._sourceSnapshot).find(s => s.functionName === functionName)
|
|
657
|
+
: null;
|
|
658
|
+
routeIndex.push({ path: routePath, name, file: sourceFile?.file || '' });
|
|
659
|
+
});
|
|
660
|
+
router += `window.__juxRouteIndex = ${JSON.stringify(routeIndex)};\n\n`;
|
|
661
|
+
|
|
647
662
|
router += `function route(path) {
|
|
648
663
|
const renderFn = routes[path] || routes['/'];
|
|
649
664
|
if (renderFn) {
|