@toyz/loom 0.1.2 → 0.2.0
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/decorators/create.d.ts +56 -0
- package/dist/decorators/create.d.ts.map +1 -0
- package/dist/decorators/create.js +72 -0
- package/dist/decorators/create.js.map +1 -0
- package/dist/decorators/events.d.ts +6 -9
- package/dist/decorators/events.d.ts.map +1 -1
- package/dist/decorators/events.js +27 -22
- package/dist/decorators/events.js.map +1 -1
- package/dist/decorators/index.d.ts +13 -13
- package/dist/decorators/index.d.ts.map +1 -1
- package/dist/decorators/index.js +20 -21
- package/dist/decorators/index.js.map +1 -1
- package/dist/{decorators/di.d.ts → di/decorators.d.ts} +10 -3
- package/dist/di/decorators.d.ts.map +1 -0
- package/dist/{decorators/di.js → di/decorators.js} +16 -10
- package/dist/di/decorators.js.map +1 -0
- package/dist/di/index.d.ts +8 -0
- package/dist/di/index.d.ts.map +1 -0
- package/dist/di/index.js +10 -0
- package/dist/di/index.js.map +1 -0
- package/dist/di/watch.d.ts +23 -0
- package/dist/di/watch.d.ts.map +1 -0
- package/dist/di/watch.js +41 -0
- package/dist/di/watch.js.map +1 -0
- package/dist/element/decorators.d.ts +32 -0
- package/dist/element/decorators.d.ts.map +1 -0
- package/dist/element/decorators.js +72 -0
- package/dist/element/decorators.js.map +1 -0
- package/dist/{element.d.ts → element/element.d.ts} +5 -11
- package/dist/element/element.d.ts.map +1 -0
- package/dist/{element.js → element/element.js} +8 -34
- package/dist/element/element.js.map +1 -0
- package/dist/element/icon.d.ts.map +1 -0
- package/dist/{icon.js → element/icon.js} +3 -2
- package/dist/element/icon.js.map +1 -0
- package/dist/element/index.d.ts +11 -0
- package/dist/element/index.d.ts.map +1 -0
- package/dist/element/index.js +14 -0
- package/dist/element/index.js.map +1 -0
- package/dist/{decorators → element}/lifecycle.d.ts +9 -1
- package/dist/element/lifecycle.d.ts.map +1 -0
- package/dist/{decorators → element}/lifecycle.js +50 -35
- package/dist/element/lifecycle.js.map +1 -0
- package/dist/element/timing.d.ts +65 -0
- package/dist/element/timing.d.ts.map +1 -0
- package/dist/element/timing.js +116 -0
- package/dist/element/timing.js.map +1 -0
- package/dist/element/virtual.d.ts.map +1 -0
- package/dist/{virtual.js → element/virtual.js} +1 -1
- package/dist/element/virtual.js.map +1 -0
- package/dist/index.d.ts +11 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/router/decorators.d.ts +50 -0
- package/dist/router/decorators.d.ts.map +1 -0
- package/dist/router/decorators.js +84 -0
- package/dist/router/decorators.js.map +1 -0
- package/dist/router/index.d.ts +4 -3
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +6 -4
- package/dist/router/index.js.map +1 -1
- package/dist/router/outlet.d.ts +1 -1
- package/dist/router/outlet.d.ts.map +1 -1
- package/dist/router/outlet.js +2 -2
- package/dist/router/outlet.js.map +1 -1
- package/dist/router/route.d.ts +16 -47
- package/dist/router/route.d.ts.map +1 -1
- package/dist/router/route.js +5 -102
- package/dist/router/route.js.map +1 -1
- package/dist/router/router.d.ts.map +1 -1
- package/dist/router/router.js +2 -1
- package/dist/router/router.js.map +1 -1
- package/dist/{decorators/state.d.ts → store/decorators.d.ts} +8 -1
- package/dist/store/decorators.d.ts.map +1 -0
- package/dist/{decorators/state.js → store/decorators.js} +13 -4
- package/dist/store/decorators.js.map +1 -0
- package/dist/store/index.d.ts +12 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +14 -0
- package/dist/store/index.js.map +1 -0
- package/dist/{reactive.d.ts → store/reactive.d.ts} +7 -5
- package/dist/store/reactive.d.ts.map +1 -0
- package/dist/{reactive.js → store/reactive.js} +9 -5
- package/dist/store/reactive.js.map +1 -0
- package/dist/store/storage.d.ts +53 -0
- package/dist/store/storage.d.ts.map +1 -0
- package/dist/store/storage.js +78 -0
- package/dist/store/storage.js.map +1 -0
- package/dist/store/watch.d.ts +27 -0
- package/dist/store/watch.d.ts.map +1 -0
- package/dist/store/watch.js +30 -0
- package/dist/store/watch.js.map +1 -0
- package/dist/transform/built-in.d.ts +36 -0
- package/dist/transform/built-in.d.ts.map +1 -0
- package/dist/transform/built-in.js +37 -0
- package/dist/transform/built-in.js.map +1 -0
- package/dist/transform/create.d.ts +19 -0
- package/dist/transform/create.d.ts.map +1 -0
- package/dist/transform/create.js +27 -0
- package/dist/transform/create.js.map +1 -0
- package/dist/transform/index.d.ts +11 -0
- package/dist/transform/index.d.ts.map +1 -0
- package/dist/transform/index.js +14 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/transform.d.ts +14 -0
- package/dist/transform/transform.d.ts.map +1 -0
- package/dist/transform/transform.js +21 -0
- package/dist/transform/transform.js.map +1 -0
- package/dist/transform/typed.d.ts +40 -0
- package/dist/transform/typed.d.ts.map +1 -0
- package/dist/transform/typed.js +55 -0
- package/dist/transform/typed.js.map +1 -0
- package/package.json +35 -3
- package/dist/decorators/component.d.ts +0 -11
- package/dist/decorators/component.d.ts.map +0 -1
- package/dist/decorators/component.js +0 -38
- package/dist/decorators/component.js.map +0 -1
- package/dist/decorators/di.d.ts.map +0 -1
- package/dist/decorators/di.js.map +0 -1
- package/dist/decorators/dom.d.ts +0 -15
- package/dist/decorators/dom.d.ts.map +0 -1
- package/dist/decorators/dom.js +0 -33
- package/dist/decorators/dom.js.map +0 -1
- package/dist/decorators/lifecycle.d.ts.map +0 -1
- package/dist/decorators/lifecycle.js.map +0 -1
- package/dist/decorators/state.d.ts.map +0 -1
- package/dist/decorators/state.js.map +0 -1
- package/dist/decorators/timing.d.ts +0 -35
- package/dist/decorators/timing.d.ts.map +0 -1
- package/dist/decorators/timing.js +0 -57
- package/dist/decorators/timing.js.map +0 -1
- package/dist/decorators/transform.d.ts +0 -45
- package/dist/decorators/transform.d.ts.map +0 -1
- package/dist/decorators/transform.js +0 -48
- package/dist/decorators/transform.js.map +0 -1
- package/dist/element.d.ts.map +0 -1
- package/dist/element.js.map +0 -1
- package/dist/icon.d.ts.map +0 -1
- package/dist/icon.js.map +0 -1
- package/dist/reactive.d.ts.map +0 -1
- package/dist/reactive.js.map +0 -1
- package/dist/storage.d.ts +0 -55
- package/dist/storage.d.ts.map +0 -1
- package/dist/storage.js +0 -90
- package/dist/storage.js.map +0 -1
- package/dist/virtual.d.ts.map +0 -1
- package/dist/virtual.js.map +0 -1
- /package/dist/{icon.d.ts → element/icon.d.ts} +0 -0
- /package/dist/{virtual.d.ts → element/virtual.d.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Loom — Barrel exports
|
|
3
3
|
*
|
|
4
|
-
* Import everything from "loom":
|
|
5
|
-
* import { EventBus, LoomEvent, Reactive, LoomElement, component, ... } from "loom";
|
|
4
|
+
* Import everything from "@toyz/loom":
|
|
5
|
+
* import { EventBus, LoomEvent, Reactive, LoomElement, component, ... } from "@toyz/loom";
|
|
6
6
|
*/
|
|
7
7
|
export { app } from "./app";
|
|
8
8
|
export type { LoomApp } from "./app";
|
|
9
9
|
export { LoomEvent } from "./event";
|
|
10
10
|
export { EventBus, bus, useBus } from "./bus";
|
|
11
11
|
export type { Constructor, Handler } from "./bus";
|
|
12
|
-
export { Reactive, CollectionStore } from "./reactive";
|
|
13
|
-
export type { Subscriber, Updater, Identifiable } from "./reactive";
|
|
14
|
-
export { MemoryStorage, LocalMedium, SessionMedium } from "./storage";
|
|
15
|
-
export type { StorageMedium, PersistOptions } from "./storage";
|
|
16
12
|
export { css } from "./css";
|
|
17
13
|
export type { CSSValue } from "./css";
|
|
18
|
-
export { LoomElement } from "./element";
|
|
19
14
|
export { morph } from "./morph";
|
|
20
|
-
export { component, prop, reactive, computed, on, watch, emit, query, queryAll, catch_, suspend, mount, unmount, interval, timeout, animationFrame, service, inject, factory, params, routeQuery, transform, typed, } from "./decorators";
|
|
21
15
|
export { jsx, jsxs, Fragment } from "./jsx-runtime";
|
|
22
16
|
export { renderLoop } from "./render-loop";
|
|
23
17
|
export type { RenderLoop } from "./render-loop";
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export
|
|
18
|
+
export { Reactive, CollectionStore, MemoryStorage, LocalAdapter, SessionAdapter, LocalMedium, SessionMedium, reactive, prop, computed, params, routeQuery, watch, } from "./store";
|
|
19
|
+
export type { Subscriber, Updater, Identifiable, StorageAdapter, StorageMedium, PersistOptions, } from "./store";
|
|
20
|
+
export { service, inject, factory } from "./di";
|
|
21
|
+
export { watch as watchService } from "./di";
|
|
22
|
+
export { LoomElement, component, query, queryAll, catch_, suspend, mount, unmount, interval, timeout, debounce, throttle, animationFrame, } from "./element";
|
|
23
|
+
export type { VirtualListOptions } from "./element";
|
|
24
|
+
export { transform, createTransform, typed, typedTransformer, toNumber, toBoolean, toDate, toJSON, toTrimmed, toInt, toFloat, } from "./transform";
|
|
25
|
+
export type { TransformSchema } from "./transform";
|
|
26
|
+
export { on, emit, createDecorator } from "./decorators";
|
|
27
27
|
export { LoomRouter, RouteChanged, route, guard, matchRoute, routes, LoomOutlet, LoomLink, HashMode, HistoryMode, } from "./router";
|
|
28
28
|
export type { RouterMode, RouterOptions, RouteInfo, RouteEntry } from "./router";
|
|
29
29
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGr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KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAC/D,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGzD,OAAO,EACL,UAAU,EACV,YAAY,EACZ,KAAK,EACL,KAAK,EACL,UAAU,EACV,MAAM,EACN,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,WAAW,GACZ,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Loom — Barrel exports
|
|
3
3
|
*
|
|
4
|
-
* Import everything from "loom":
|
|
5
|
-
* import { EventBus, LoomEvent, Reactive, LoomElement, component, ... } from "loom";
|
|
4
|
+
* Import everything from "@toyz/loom":
|
|
5
|
+
* import { EventBus, LoomEvent, Reactive, LoomElement, component, ... } from "@toyz/loom";
|
|
6
6
|
*/
|
|
7
7
|
// App entry point
|
|
8
8
|
export { app } from "./app";
|
|
9
9
|
// Event system
|
|
10
10
|
export { LoomEvent } from "./event";
|
|
11
11
|
export { EventBus, bus, useBus } from "./bus";
|
|
12
|
-
// Reactive stores
|
|
13
|
-
export { Reactive, CollectionStore } from "./reactive";
|
|
14
|
-
// Storage mediums
|
|
15
|
-
export { MemoryStorage, LocalMedium, SessionMedium } from "./storage";
|
|
16
12
|
// CSS
|
|
17
13
|
export { css } from "./css";
|
|
18
|
-
// Element base
|
|
19
|
-
export { LoomElement } from "./element";
|
|
20
14
|
// DOM morphing
|
|
21
15
|
export { morph } from "./morph";
|
|
22
|
-
// Decorators
|
|
23
|
-
export { component, prop, reactive, computed, on, watch, emit, query, queryAll, catch_, suspend, mount, unmount, interval, timeout, animationFrame, service, inject, factory, params, routeQuery, transform, typed, } from "./decorators";
|
|
24
16
|
// JSX runtime (re-exported so jsxImportSource resolves)
|
|
25
17
|
export { jsx, jsxs, Fragment } from "./jsx-runtime";
|
|
26
18
|
// Render loop
|
|
27
19
|
export { renderLoop } from "./render-loop";
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
// ── Domain re-exports ──
|
|
21
|
+
// Store: reactive state, persistence
|
|
22
|
+
export { Reactive, CollectionStore, MemoryStorage, LocalAdapter, SessionAdapter, LocalMedium, SessionMedium, reactive, prop, computed, params, routeQuery, watch, } from "./store";
|
|
23
|
+
// DI: service container decorators
|
|
24
|
+
export { service, inject, factory } from "./di";
|
|
25
|
+
export { watch as watchService } from "./di";
|
|
26
|
+
// Element: base class, element decorators
|
|
27
|
+
export { LoomElement, component, query, queryAll, catch_, suspend, mount, unmount, interval, timeout, debounce, throttle, animationFrame, } from "./element";
|
|
28
|
+
// Transform: value transforms
|
|
29
|
+
export { transform, createTransform, typed, typedTransformer, toNumber, toBoolean, toDate, toJSON, toTrimmed, toInt, toFloat, } from "./transform";
|
|
30
|
+
// Decorators: event decorators + factory
|
|
31
|
+
export { on, emit, createDecorator } from "./decorators";
|
|
32
32
|
// Router
|
|
33
33
|
export { LoomRouter, RouteChanged, route, guard, matchRoute, routes, LoomOutlet, LoomLink, HashMode, HistoryMode, } from "./router";
|
|
34
34
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,kBAAkB;AAClB,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,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CAAC;AAGrB,yCAAyC;AACzC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEzD,SAAS;AACT,OAAO,EACL,UAAU,EACV,YAAY,EACZ,KAAK,EACL,KAAK,EACL,UAAU,EACV,MAAM,EACN,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,WAAW,GACZ,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loom Router — Decorators
|
|
3
|
+
*
|
|
4
|
+
* @route(path, opts?) — registers a component class as a route handler.
|
|
5
|
+
* @guard(name?) — marks a method as a named route guard.
|
|
6
|
+
*
|
|
7
|
+
* Both use createDecorator as their foundation.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ROUTE_PATH: unique symbol;
|
|
10
|
+
export declare const GUARD_HANDLERS: unique symbol;
|
|
11
|
+
interface RouteOptions {
|
|
12
|
+
/** Named guards to check before this route is rendered */
|
|
13
|
+
guards?: string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Register a class as a route handler.
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* @route("/docs/:slug")
|
|
20
|
+
* @component("page-docs")
|
|
21
|
+
* class PageDocs extends LoomElement { ... }
|
|
22
|
+
*
|
|
23
|
+
* @route("/admin", { guards: ["auth", "role"] })
|
|
24
|
+
* @component("page-admin")
|
|
25
|
+
* class PageAdmin extends LoomElement { ... }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const route: (pattern: string, opts?: RouteOptions | undefined) => (ctor: any) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Mark a method as a named route guard.
|
|
31
|
+
*
|
|
32
|
+
* Return `true` to allow, `false` to block, or a `string` to redirect.
|
|
33
|
+
* Async guards are awaited. Supports @inject on parameters.
|
|
34
|
+
*
|
|
35
|
+
* ```ts
|
|
36
|
+
* @guard("auth")
|
|
37
|
+
* checkAuth(@inject(AuthService) auth: AuthService) {
|
|
38
|
+
* return auth.isLoggedIn ? true : "/login";
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* // Derived name from method name:
|
|
42
|
+
* @guard()
|
|
43
|
+
* checkRole(@inject(UserStore) users: UserStore) {
|
|
44
|
+
* return users.current?.role === "admin" ? true : "/forbidden";
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const guard: (name?: string | undefined) => (target: any, key: string, desc?: PropertyDescriptor) => void;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/router/decorators.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,eAAO,MAAM,UAAU,eAA4B,CAAC;AACpD,eAAO,MAAM,cAAc,eAA8B,CAAC;AAI1D,UAAU,YAAY;IACpB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,2EAyBjB,CAAC;AAWF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK,gEAVM,CAAC,6BAiBxB,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loom Router — Decorators
|
|
3
|
+
*
|
|
4
|
+
* @route(path, opts?) — registers a component class as a route handler.
|
|
5
|
+
* @guard(name?) — marks a method as a named route guard.
|
|
6
|
+
*
|
|
7
|
+
* Both use createDecorator as their foundation.
|
|
8
|
+
*/
|
|
9
|
+
import { createDecorator } from "../decorators/create";
|
|
10
|
+
import { routes, guardRegistry, compilePattern } from "./route";
|
|
11
|
+
export const ROUTE_PATH = Symbol("loom:route:path");
|
|
12
|
+
export const GUARD_HANDLERS = Symbol("loom:route:guards");
|
|
13
|
+
/**
|
|
14
|
+
* Register a class as a route handler.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* @route("/docs/:slug")
|
|
18
|
+
* @component("page-docs")
|
|
19
|
+
* class PageDocs extends LoomElement { ... }
|
|
20
|
+
*
|
|
21
|
+
* @route("/admin", { guards: ["auth", "role"] })
|
|
22
|
+
* @component("page-admin")
|
|
23
|
+
* class PageAdmin extends LoomElement { ... }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export const route = createDecorator((ctor, pattern, opts) => {
|
|
27
|
+
ctor[ROUTE_PATH] = pattern;
|
|
28
|
+
const { regex, paramNames } = compilePattern(pattern);
|
|
29
|
+
const entry = {
|
|
30
|
+
pattern,
|
|
31
|
+
regex,
|
|
32
|
+
paramNames,
|
|
33
|
+
get tag() {
|
|
34
|
+
return _tagForCtor(ctor);
|
|
35
|
+
},
|
|
36
|
+
ctor,
|
|
37
|
+
guards: opts?.guards ?? [],
|
|
38
|
+
};
|
|
39
|
+
if (pattern === "*") {
|
|
40
|
+
routes.push(entry);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const wildcardIdx = routes.findIndex((r) => r.pattern === "*");
|
|
44
|
+
if (wildcardIdx === -1)
|
|
45
|
+
routes.push(entry);
|
|
46
|
+
else
|
|
47
|
+
routes.splice(wildcardIdx, 0, entry);
|
|
48
|
+
}
|
|
49
|
+
}, { class: true });
|
|
50
|
+
/** Resolve the custom element tag for a constructor */
|
|
51
|
+
function _tagForCtor(ctor) {
|
|
52
|
+
const name = customElements.getName?.(ctor);
|
|
53
|
+
if (name)
|
|
54
|
+
return name;
|
|
55
|
+
return ctor.__loom_tag ?? ctor.name.toLowerCase();
|
|
56
|
+
}
|
|
57
|
+
// ── @guard (define-time method decorator via createDecorator) ──
|
|
58
|
+
/**
|
|
59
|
+
* Mark a method as a named route guard.
|
|
60
|
+
*
|
|
61
|
+
* Return `true` to allow, `false` to block, or a `string` to redirect.
|
|
62
|
+
* Async guards are awaited. Supports @inject on parameters.
|
|
63
|
+
*
|
|
64
|
+
* ```ts
|
|
65
|
+
* @guard("auth")
|
|
66
|
+
* checkAuth(@inject(AuthService) auth: AuthService) {
|
|
67
|
+
* return auth.isLoggedIn ? true : "/login";
|
|
68
|
+
* }
|
|
69
|
+
*
|
|
70
|
+
* // Derived name from method name:
|
|
71
|
+
* @guard()
|
|
72
|
+
* checkRole(@inject(UserStore) users: UserStore) {
|
|
73
|
+
* return users.current?.role === "admin" ? true : "/forbidden";
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export const guard = createDecorator((proto, key, name) => {
|
|
78
|
+
const guardName = name ?? key;
|
|
79
|
+
if (!proto[GUARD_HANDLERS])
|
|
80
|
+
proto[GUARD_HANDLERS] = [];
|
|
81
|
+
proto[GUARD_HANDLERS].push(key);
|
|
82
|
+
guardRegistry.set(guardName, { proto, key });
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/router/decorators.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAC;AAEjF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACpD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAS1D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAClC,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACrB,IAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC;IACpC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC,CA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C,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CACF,CAAC"}
|
package/dist/router/index.d.ts
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { type RouterMode, HashMode, HistoryMode } from "./mode";
|
|
5
5
|
export { RouteChanged } from "./events";
|
|
6
|
-
export {
|
|
6
|
+
export { matchRoute, routes, guardRegistry } from "./route";
|
|
7
7
|
export type { RouteEntry, GuardRegistration } from "./route";
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
8
|
+
export { route, guard, ROUTE_PATH, GUARD_HANDLERS } from "./decorators";
|
|
9
|
+
export { params, routeQuery } from "../store/decorators";
|
|
10
|
+
export { transform } from "../transform/transform";
|
|
10
11
|
export { LoomRouter } from "./router";
|
|
11
12
|
export type { RouterOptions, RouteInfo } from "./router";
|
|
12
13
|
export { LoomOutlet } from "./outlet";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,KAAK,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGhE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,KAAK,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGhE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5D,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGxE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGzD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/router/index.js
CHANGED
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
export { HashMode, HistoryMode } from "./mode";
|
|
6
6
|
// Events
|
|
7
7
|
export { RouteChanged } from "./events";
|
|
8
|
-
// Route table &
|
|
9
|
-
export {
|
|
8
|
+
// Route table & matching
|
|
9
|
+
export { matchRoute, routes, guardRegistry } from "./route";
|
|
10
|
+
// Route decorators
|
|
11
|
+
export { route, guard, ROUTE_PATH, GUARD_HANDLERS } from "./decorators";
|
|
10
12
|
// Route data sentinels (for @prop({params}) and @prop({query: routeQuery}))
|
|
11
|
-
export { params, routeQuery } from "../decorators
|
|
12
|
-
export { transform } from "../
|
|
13
|
+
export { params, routeQuery } from "../store/decorators";
|
|
14
|
+
export { transform } from "../transform/transform";
|
|
13
15
|
// Router service
|
|
14
16
|
export { LoomRouter } from "./router";
|
|
15
17
|
// Components
|
package/dist/router/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO;AACP,OAAO,EAAmB,QAAQ,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEhE,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO;AACP,OAAO,EAAmB,QAAQ,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEhE,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,yBAAyB;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG5D,mBAAmB;AACnB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAExE,4EAA4E;AAC5E,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,iBAAiB;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,aAAa;AACb,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/router/outlet.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Resolves the initial route on connect so pages render even if
|
|
9
9
|
* RouteChanged fired before the outlet entered the DOM.
|
|
10
10
|
*/
|
|
11
|
-
import { LoomElement } from "../element";
|
|
11
|
+
import { LoomElement } from "../element/element";
|
|
12
12
|
import { RouteChanged } from "./events";
|
|
13
13
|
declare class LoomOutlet extends LoomElement {
|
|
14
14
|
/** Stylesheets to pass down to routed components via adoptStyles() */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outlet.d.ts","sourceRoot":"","sources":["../../src/router/outlet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"outlet.d.ts","sourceRoot":"","sources":["../../src/router/outlet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,cACM,UAAW,SAAQ,WAAW;IAClC,sEAAsE;IAChE,MAAM,EAAE,aAAa,EAAE,CAAM;IAC7B,WAAW,UAAQ;IAEzB,oEAAoE;IACpE,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG,IAAI,CAAQ;IAEtD,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,gBAAgB,CAAS;IAGjC,cAAc,CAAC,CAAC,EAAE,YAAY;IAI9B,0EAA0E;IAC1E,YAAY;IAUZ,OAAO,CAAC,KAAK;IAoBb,OAAO,CAAC,MAAM;IAmBd;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAyCxB,2CAA2C;IAC3C,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,YAAY;CAkBrB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/router/outlet.js
CHANGED
|
@@ -14,11 +14,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
14
14
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
15
15
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16
16
|
};
|
|
17
|
-
import { LoomElement } from "../element";
|
|
17
|
+
import { LoomElement } from "../element/element";
|
|
18
18
|
import { component, on, prop, ROUTE_PROPS, TRANSFORMS } from "../decorators";
|
|
19
19
|
import { matchRoute } from "./route";
|
|
20
20
|
import { RouteChanged } from "./events";
|
|
21
|
-
import { params as paramsSentinel, routeQuery as querySentinel } from "../decorators
|
|
21
|
+
import { params as paramsSentinel, routeQuery as querySentinel } from "../store/decorators";
|
|
22
22
|
let LoomOutlet = class LoomOutlet extends LoomElement {
|
|
23
23
|
/** Stylesheets to pass down to routed components via adoptStyles() */
|
|
24
24
|
styles = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outlet.js","sourceRoot":"","sources":["../../src/router/outlet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;;;;;;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"outlet.js","sourceRoot":"","sources":["../../src/router/outlet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;;;;;;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG5F,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,WAAW;IAClC,sEAAsE;IAChE,MAAM,GAAoB,EAAE,CAAC;IAC7B,WAAW,GAAG,IAAI,CAAC;IAEzB,oEAAoE;IACpE,UAAU,GAAuC,IAAI,CAAC;IAE9C,WAAW,GAAkB,IAAI,CAAC;IAClC,UAAU,GAAuB,IAAI,CAAC;IACtC,gBAAgB,GAAG,KAAK,CAAC;IAGjC,cAAc,CAAC,CAAe;QAC5B,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,0EAA0E;IAC1E,YAAY;QACV,IAAI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CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAEO,MAAM;QACZ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACzB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC1B,CAAC;IACH,CAAC;IAEO,YAAY;QAClB,0DAA0D;QAC1D,IAAI,IAAI,GAAgB,IAAI,CAAC;QAC7B,OAAO,IAAI,EAAE,CAAC;YACZ,IAAI,IAAI,YAAY,OAAO,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC;gBAClD,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;YACrB,CAAC;YACD,4BAA4B;YAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAChC,IAAI,IAAI,YAAY,UAAU,EAAE,CAAC;gBAC/B,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YACnB,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAI,IAAgB,CAAC,aAAa,CAAC;YACzC,CAAC;QACH,CAAC;QACD,uCAAuC;QACvC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxB,CAAC;CACF,CAAA;AAtJO;IAAL,IAAI;0CAA8B;AAC7B;IAAL,IAAI;+CAAoB;AAUzB;IADC,EAAE,CAAC,YAAY,CAAC;gDAGhB;AAfG,UAAU;IADf,SAAS,CAAC,aAAa,CAAC;GACnB,UAAU,CAwJf;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/router/route.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Loom Router — Route table and
|
|
2
|
+
* Loom Router — Route table and matching
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Pure data: route entries, pattern compilation, and path matching.
|
|
5
|
+
* Decorators live in ./decorators.ts.
|
|
6
6
|
*/
|
|
7
|
-
export declare const ROUTE_PATH: unique symbol;
|
|
8
|
-
export declare const GUARD_HANDLERS: unique symbol;
|
|
9
7
|
export interface RouteEntry {
|
|
10
8
|
pattern: string;
|
|
11
9
|
regex: RegExp;
|
|
@@ -15,17 +13,27 @@ export interface RouteEntry {
|
|
|
15
13
|
/** Named guards to check before rendering this route */
|
|
16
14
|
guards: string[];
|
|
17
15
|
}
|
|
18
|
-
/** Global route table — populated by @route
|
|
16
|
+
/** Global route table — populated by @route decorator */
|
|
19
17
|
export declare const routes: RouteEntry[];
|
|
20
18
|
/**
|
|
21
|
-
* Global guard registry — populated by @guard
|
|
22
|
-
* Maps guard name → { proto, key
|
|
19
|
+
* Global guard registry — populated by @guard decorator.
|
|
20
|
+
* Maps guard name → { proto, key }
|
|
23
21
|
*/
|
|
24
22
|
export interface GuardRegistration {
|
|
25
23
|
proto: any;
|
|
26
24
|
key: string;
|
|
27
25
|
}
|
|
28
26
|
export declare const guardRegistry: Map<string, GuardRegistration>;
|
|
27
|
+
/**
|
|
28
|
+
* Compile a route pattern into a regex + param name list.
|
|
29
|
+
*
|
|
30
|
+
* `/docs/:slug` → { regex: /^\/docs\/([^/]+)$/, paramNames: ["slug"] }
|
|
31
|
+
* `*` → { regex: /^.*$/, paramNames: [] }
|
|
32
|
+
*/
|
|
33
|
+
export declare function compilePattern(pattern: string): {
|
|
34
|
+
regex: RegExp;
|
|
35
|
+
paramNames: string[];
|
|
36
|
+
};
|
|
29
37
|
/**
|
|
30
38
|
* Match a path against the route table.
|
|
31
39
|
* Returns the matched entry + extracted params, or null.
|
|
@@ -34,43 +42,4 @@ export declare function matchRoute(path: string): {
|
|
|
34
42
|
entry: RouteEntry;
|
|
35
43
|
params: Record<string, string>;
|
|
36
44
|
} | null;
|
|
37
|
-
interface RouteOptions {
|
|
38
|
-
/** Named guards to check before this route is rendered */
|
|
39
|
-
guards?: string[];
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Register a class as a route handler.
|
|
43
|
-
*
|
|
44
|
-
* ```ts
|
|
45
|
-
* @route("/docs/:slug")
|
|
46
|
-
* @component("page-docs")
|
|
47
|
-
* class PageDocs extends LoomElement { ... }
|
|
48
|
-
*
|
|
49
|
-
* @route("/admin", { guards: ["auth", "role"] })
|
|
50
|
-
* @component("page-admin")
|
|
51
|
-
* class PageAdmin extends LoomElement { ... }
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
export declare function route(pattern: string, opts?: RouteOptions): (ctor: any) => void;
|
|
55
|
-
/**
|
|
56
|
-
* Mark a method as a named route guard.
|
|
57
|
-
*
|
|
58
|
-
* Return `true` to allow, `false` to block, or a `string` to redirect.
|
|
59
|
-
* Async guards are awaited. Supports @inject on parameters.
|
|
60
|
-
*
|
|
61
|
-
* ```ts
|
|
62
|
-
* @guard("auth")
|
|
63
|
-
* checkAuth(@inject(AuthService) auth: AuthService) {
|
|
64
|
-
* return auth.isLoggedIn ? true : "/login";
|
|
65
|
-
* }
|
|
66
|
-
*
|
|
67
|
-
* // Derived name from method name:
|
|
68
|
-
* @guard
|
|
69
|
-
* checkRole(@inject(UserStore) users: UserStore) {
|
|
70
|
-
* return users.current?.role === "admin" ? true : "/forbidden";
|
|
71
|
-
* }
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
export declare function guard(nameOrTarget: any, key?: string): any;
|
|
75
|
-
export {};
|
|
76
45
|
//# sourceMappingURL=route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/router/route.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/router/route.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,GAAG,CAAC;IACV,wDAAwD;IACxD,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,yDAAyD;AACzD,eAAO,MAAM,MAAM,EAAE,UAAU,EAAO,CAAC;AAEvC;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,GAAG,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb;AACD,eAAO,MAAM,aAAa,gCAAuC,CAAC;AAElE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAkBvF;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,IAAI,CAYrG"}
|
package/dist/router/route.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Loom Router — Route table and
|
|
2
|
+
* Loom Router — Route table and matching
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Pure data: route entries, pattern compilation, and path matching.
|
|
5
|
+
* Decorators live in ./decorators.ts.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
export const GUARD_HANDLERS = Symbol("loom:route:guards");
|
|
9
|
-
/** Global route table — populated by @route decorators */
|
|
7
|
+
/** Global route table — populated by @route decorator */
|
|
10
8
|
export const routes = [];
|
|
11
9
|
export const guardRegistry = new Map();
|
|
12
10
|
/**
|
|
@@ -15,7 +13,7 @@ export const guardRegistry = new Map();
|
|
|
15
13
|
* `/docs/:slug` → { regex: /^\/docs\/([^/]+)$/, paramNames: ["slug"] }
|
|
16
14
|
* `*` → { regex: /^.*$/, paramNames: [] }
|
|
17
15
|
*/
|
|
18
|
-
function compilePattern(pattern) {
|
|
16
|
+
export function compilePattern(pattern) {
|
|
19
17
|
if (pattern === "*") {
|
|
20
18
|
return { regex: /^.*$/, paramNames: [] };
|
|
21
19
|
}
|
|
@@ -49,99 +47,4 @@ export function matchRoute(path) {
|
|
|
49
47
|
}
|
|
50
48
|
return null;
|
|
51
49
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Register a class as a route handler.
|
|
54
|
-
*
|
|
55
|
-
* ```ts
|
|
56
|
-
* @route("/docs/:slug")
|
|
57
|
-
* @component("page-docs")
|
|
58
|
-
* class PageDocs extends LoomElement { ... }
|
|
59
|
-
*
|
|
60
|
-
* @route("/admin", { guards: ["auth", "role"] })
|
|
61
|
-
* @component("page-admin")
|
|
62
|
-
* class PageAdmin extends LoomElement { ... }
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
export function route(pattern, opts) {
|
|
66
|
-
return (ctor) => {
|
|
67
|
-
ctor[ROUTE_PATH] = pattern;
|
|
68
|
-
const { regex, paramNames } = compilePattern(pattern);
|
|
69
|
-
// Defer tag resolution — the @component decorator may not have run yet.
|
|
70
|
-
// We use a getter to lazily resolve the custom element tag.
|
|
71
|
-
const entry = {
|
|
72
|
-
pattern,
|
|
73
|
-
regex,
|
|
74
|
-
paramNames,
|
|
75
|
-
get tag() {
|
|
76
|
-
// Find the tag registered for this constructor
|
|
77
|
-
return _tagForCtor(ctor);
|
|
78
|
-
},
|
|
79
|
-
ctor,
|
|
80
|
-
guards: opts?.guards ?? [],
|
|
81
|
-
};
|
|
82
|
-
// Wildcard goes last
|
|
83
|
-
if (pattern === "*") {
|
|
84
|
-
routes.push(entry);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
// Insert before wildcards
|
|
88
|
-
const wildcardIdx = routes.findIndex((r) => r.pattern === "*");
|
|
89
|
-
if (wildcardIdx === -1)
|
|
90
|
-
routes.push(entry);
|
|
91
|
-
else
|
|
92
|
-
routes.splice(wildcardIdx, 0, entry);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
/** Resolve the custom element tag for a constructor */
|
|
97
|
-
function _tagForCtor(ctor) {
|
|
98
|
-
// Search customElements registry
|
|
99
|
-
const name = customElements.getName?.(ctor);
|
|
100
|
-
if (name)
|
|
101
|
-
return name;
|
|
102
|
-
// Fallback: scan internal app registry (custom elements v1 doesn't have getName everywhere)
|
|
103
|
-
// We store the tag on the constructor via @component
|
|
104
|
-
return ctor.__loom_tag ?? ctor.name.toLowerCase();
|
|
105
|
-
}
|
|
106
|
-
// ── @guard decorator ──
|
|
107
|
-
/**
|
|
108
|
-
* Mark a method as a named route guard.
|
|
109
|
-
*
|
|
110
|
-
* Return `true` to allow, `false` to block, or a `string` to redirect.
|
|
111
|
-
* Async guards are awaited. Supports @inject on parameters.
|
|
112
|
-
*
|
|
113
|
-
* ```ts
|
|
114
|
-
* @guard("auth")
|
|
115
|
-
* checkAuth(@inject(AuthService) auth: AuthService) {
|
|
116
|
-
* return auth.isLoggedIn ? true : "/login";
|
|
117
|
-
* }
|
|
118
|
-
*
|
|
119
|
-
* // Derived name from method name:
|
|
120
|
-
* @guard
|
|
121
|
-
* checkRole(@inject(UserStore) users: UserStore) {
|
|
122
|
-
* return users.current?.role === "admin" ? true : "/forbidden";
|
|
123
|
-
* }
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
export function guard(nameOrTarget, key) {
|
|
127
|
-
if (typeof key === "string") {
|
|
128
|
-
// Bare @guard (no name) — derive name from method name
|
|
129
|
-
_registerGuard(nameOrTarget, key, key);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
if (typeof nameOrTarget === "string") {
|
|
133
|
-
// @guard("auth") — factory form with explicit name
|
|
134
|
-
return (target, methodKey) => {
|
|
135
|
-
_registerGuard(target, methodKey, nameOrTarget);
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function _registerGuard(proto, key, name) {
|
|
140
|
-
// Legacy: store on prototype for backward compat
|
|
141
|
-
if (!proto[GUARD_HANDLERS])
|
|
142
|
-
proto[GUARD_HANDLERS] = [];
|
|
143
|
-
proto[GUARD_HANDLERS].push(key);
|
|
144
|
-
// New: register in global registry by name
|
|
145
|
-
guardRegistry.set(name, { proto, key });
|
|
146
|
-
}
|
|
147
50
|
//# sourceMappingURL=route.js.map
|
package/dist/router/route.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/router/route.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/router/route.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,yDAAyD;AACzD,MAAM,CAAC,MAAM,MAAM,GAAiB,EAAE,CAAC;AAUvC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,EAA6B,CAAC;AAElE;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;QACpB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IAC3C,CAAC;IAED,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,QAAQ,GAAG,OAAO;SACrB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC,CAAC;SACD,IAAI,CAAC,KAAK,CAAC,CAAC;IAEf,OAAO,EAAE,KAAK,EAAE,IAAI,MAAM,CAAC,IAAI,QAAQ,GAAG,CAAC,EAAE,UAAU,EAAE,CAAC;AAC5D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,EAAE,CAAC;YACN,MAAM,MAAM,GAA2B,EAAE,CAAC;YAC1C,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;gBACnC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,KAAK,UAAU,EAAyB,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,KAAK,UAAU,EAAyB,MAAM,QAAQ,CAAC;AAOhE,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,qBAAa,UAAU;IACrB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,OAAO,CAAC,QAAQ,CAAmD;gBAEvD,IAAI,GAAE,aAAkB;IAIpC,8CAA8C;IAC9C,IAAI,OAAO,IAAI,QAAQ,CAAC,SAAS,CAAC,CAEjC;IAED,oEAAoE;IACpE,KAAK,IAAI,MAAM,IAAI;IAMnB,yBAAyB;IACnB,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrC,gDAAgD;IAC1C,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU1C,yBAAyB;IACzB,IAAI,IAAI,IAAI;IAIZ,4BAA4B;IAC5B,OAAO,IAAI,IAAI;IAIf,yCAAyC;IACzC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI1B,4EAA4E;IAC5E,OAAO,CAAC,QAAQ;IAchB;;;;;;OAMG;YACW,YAAY;IAwC1B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;CAe7B"}
|
package/dist/router/router.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { bus } from "../bus";
|
|
8
8
|
import { HashMode, HistoryMode } from "./mode";
|
|
9
|
-
import { matchRoute,
|
|
9
|
+
import { matchRoute, guardRegistry } from "./route";
|
|
10
|
+
import { GUARD_HANDLERS } from "./decorators";
|
|
10
11
|
import { RouteChanged } from "./events";
|
|
11
12
|
import { INJECT_PARAMS } from "../decorators/symbols";
|
|
12
13
|
import { app } from "../app";
|