mates 0.4.0-beta.1 → 0.4.0-beta.11
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/Fetch/Fetch.d.ts +7 -1
- package/dist/Fetch/Fetch.d.ts.map +1 -1
- package/dist/MatesUtils/FetchUtils.d.ts +30 -0
- package/dist/MatesUtils/FetchUtils.d.ts.map +1 -0
- package/dist/MatesUtils/MatesUtils.d.ts +47 -0
- package/dist/MatesUtils/MatesUtils.d.ts.map +1 -0
- package/dist/MatesUtils/RouterUtils.d.ts +39 -0
- package/dist/MatesUtils/RouterUtils.d.ts.map +1 -0
- package/dist/MatesUtils/StorageUtils.d.ts +16 -0
- package/dist/MatesUtils/StorageUtils.d.ts.map +1 -0
- package/dist/MatesUtils/ThemeUtils.d.ts +18 -0
- package/dist/MatesUtils/ThemeUtils.d.ts.map +1 -0
- package/dist/MatesUtils/index.d.ts +6 -0
- package/dist/MatesUtils/index.d.ts.map +1 -0
- package/dist/Mutables/Extended Atoms/themeAtom.d.ts +3 -15
- package/dist/Mutables/Extended Atoms/themeAtom.d.ts.map +1 -1
- package/dist/Mutables/atom/storageAtom.d.ts +9 -31
- package/dist/Mutables/atom/storageAtom.d.ts.map +1 -1
- package/dist/Mutables/atom/titleAtom.d.ts +3 -9
- package/dist/Mutables/atom/titleAtom.d.ts.map +1 -1
- package/dist/Mutables/scope/scope.d.ts +32 -1
- package/dist/Mutables/scope/scope.d.ts.map +1 -1
- package/dist/Router/animatedRouter.d.ts.map +1 -1
- package/dist/Router/hashAtom.d.ts +7 -3
- package/dist/Router/hashAtom.d.ts.map +1 -1
- package/dist/Router/historyStateAtom.d.ts +4 -36
- package/dist/Router/historyStateAtom.d.ts.map +1 -1
- package/dist/Router/historyUtils.d.ts +1 -12
- package/dist/Router/historyUtils.d.ts.map +1 -1
- package/dist/Router/index.d.ts +1 -8
- package/dist/Router/index.d.ts.map +1 -1
- package/dist/Router/isPathMatching.d.ts +5 -1
- package/dist/Router/isPathMatching.d.ts.map +1 -1
- package/dist/Router/location.d.ts +3 -63
- package/dist/Router/location.d.ts.map +1 -1
- package/dist/Router/navigateTo.d.ts +7 -27
- package/dist/Router/navigateTo.d.ts.map +1 -1
- package/dist/Router/navigationLock.d.ts +5 -46
- package/dist/Router/navigationLock.d.ts.map +1 -1
- package/dist/Router/navigationRequest.d.ts +7 -42
- package/dist/Router/navigationRequest.d.ts.map +1 -1
- package/dist/Router/pathAtom.d.ts +16 -36
- package/dist/Router/pathAtom.d.ts.map +1 -1
- package/dist/Router/qsAtom.d.ts +7 -3
- package/dist/Router/qsAtom.d.ts.map +1 -1
- package/dist/Template/x.d.ts +16 -3
- package/dist/Template/x.d.ts.map +1 -1
- package/dist/css-in-js/stylesheet.d.ts.map +1 -1
- package/dist/css-in-js/theme.d.ts +0 -8
- package/dist/css-in-js/theme.d.ts.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +26 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +31 -34
- package/dist/index.js.map +1 -1
- package/dist/on/hooks.d.ts.map +1 -1
- package/dist/ssr/index.d.ts +1 -0
- package/dist/ssr/index.d.ts.map +1 -1
- package/dist/ssr/useCtx.d.ts +63 -0
- package/dist/ssr/useCtx.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/Router/pathResolver.d.ts +0 -9
- package/dist/Router/pathResolver.d.ts.map +0 -1
package/dist/Fetch/Fetch.d.ts
CHANGED
|
@@ -83,7 +83,10 @@ export declare class FetchClient {
|
|
|
83
83
|
private readonly instanceBeforeFns;
|
|
84
84
|
private readonly instanceAfterFns;
|
|
85
85
|
private readonly instanceErrorFns;
|
|
86
|
-
|
|
86
|
+
private readonly _scopeBeforeFns?;
|
|
87
|
+
private readonly _scopeAfterFns?;
|
|
88
|
+
private readonly _scopeErrorFns?;
|
|
89
|
+
constructor(baseRequest?: FetchRequest, scopeBeforeFns?: Set<BeforeInterceptor>, scopeAfterFns?: Set<AfterInterceptor>, scopeErrorFns?: Set<ErrorInterceptor>);
|
|
87
90
|
/** Add a before-interceptor scoped to this instance. Returns an unsubscribe fn. */
|
|
88
91
|
interceptBefore(fn: BeforeInterceptor): () => void;
|
|
89
92
|
/** Add an after-interceptor scoped to this instance. Returns an unsubscribe fn. */
|
|
@@ -92,6 +95,9 @@ export declare class FetchClient {
|
|
|
92
95
|
interceptError(fn: ErrorInterceptor): () => void;
|
|
93
96
|
/** Remove all interceptors scoped to this instance. */
|
|
94
97
|
clearInterceptors(): void;
|
|
98
|
+
private get _beforeFns();
|
|
99
|
+
private get _afterFns();
|
|
100
|
+
private get _errorFns();
|
|
95
101
|
fetch<T = any>(request: FetchRequest): ZeroPromise<T>;
|
|
96
102
|
/** Public alias for `fetch` — matches the exported global `Fetch` name. */
|
|
97
103
|
Fetch<T = any>(request: FetchRequest): ZeroPromise<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fetch.d.ts","sourceRoot":"","sources":["../../lib/Fetch/Fetch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKlD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAInE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG;IACrD;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,sEAAsE;IACtE,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,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AG,CAAC,gBAuKnB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FetchUtils — Scope class for fetch client and interceptors.
|
|
3
|
+
*
|
|
4
|
+
* Owns scoped interceptor Sets that replace the module-level global Sets.
|
|
5
|
+
* Each WithScope creates a fresh FetchUtils, keeping interceptors
|
|
6
|
+
* isolated between SSR requests.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const App = () => {
|
|
11
|
+
* const fetch = scope(FetchUtils);
|
|
12
|
+
* fetch.interceptBefore(withAuth("token"));
|
|
13
|
+
* return () => html`...`;
|
|
14
|
+
* };
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import type { AfterInterceptor, BeforeInterceptor, ErrorInterceptor } from "../Fetch";
|
|
18
|
+
import { FetchClient } from "../Fetch/Fetch";
|
|
19
|
+
export declare class FetchUtils {
|
|
20
|
+
fetchClient: FetchClient;
|
|
21
|
+
private _beforeFns;
|
|
22
|
+
private _afterFns;
|
|
23
|
+
private _errorFns;
|
|
24
|
+
constructor();
|
|
25
|
+
interceptBefore(fn: BeforeInterceptor): () => void;
|
|
26
|
+
interceptAfter(fn: AfterInterceptor): () => void;
|
|
27
|
+
interceptError(fn: ErrorInterceptor): () => void;
|
|
28
|
+
clearInterceptors(): void;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=FetchUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchUtils.d.ts","sourceRoot":"","sources":["../../lib/MatesUtils/FetchUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQ7C,qBAAa,UAAU;IACrB,WAAW,EAAE,WAAW,CAAC;IAEzB,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,SAAS,CAA+B;;IAWhD,eAAe,CAAC,EAAE,EAAE,iBAAiB,GAAG,MAAM,IAAI;IAIlD,cAAc,CAAC,EAAE,EAAE,gBAAgB,GAAG,MAAM,IAAI;IAIhD,cAAc,CAAC,EAAE,EAAE,gBAAgB,GAAG,MAAM,IAAI;IAIhD,iBAAiB,IAAI,IAAI;CAK1B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MatesUtils — Convenience scope class composing all utility scopes.
|
|
3
|
+
*
|
|
4
|
+
* Equivalent to scoping RouterUtils + FetchUtils + StorageUtils + ThemeUtils
|
|
5
|
+
* individually. Use this when you want everything in one scope.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const App = () => {
|
|
10
|
+
* const utils = scope(MatesUtils);
|
|
11
|
+
* // utils.pathAtom, utils.navigateTo, utils.fetchClient, etc.
|
|
12
|
+
* return () => html`...`;
|
|
13
|
+
* };
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare class MatesUtils {
|
|
17
|
+
private _router;
|
|
18
|
+
private _fetch;
|
|
19
|
+
private _storage;
|
|
20
|
+
private _theme;
|
|
21
|
+
constructor();
|
|
22
|
+
get pathAtom(): import("..").SuperAtomType<string>;
|
|
23
|
+
get qsAtom(): import("..").AtomType<Record<string, any>>;
|
|
24
|
+
get hashAtom(): import("..").AtomType<Record<string, any>>;
|
|
25
|
+
get historyStateAtom(): import("..").AtomType<unknown>;
|
|
26
|
+
get navigationLocked(): import("..").AtomType<boolean>;
|
|
27
|
+
get navigationRequestEvent(): import("..").EventType<import("../Router/navigationRequest").NavigationEventPayload>;
|
|
28
|
+
get location(): {
|
|
29
|
+
readonly path: string;
|
|
30
|
+
readonly hash: Record<string, any>;
|
|
31
|
+
readonly qsObj: Record<string, any>;
|
|
32
|
+
};
|
|
33
|
+
navigateTo(path: string, replace?: boolean, data?: any): void;
|
|
34
|
+
lockNavigation(): void;
|
|
35
|
+
unlockNavigation(): void;
|
|
36
|
+
onNavigationRequest(fn: any): void;
|
|
37
|
+
get fetchClient(): import("..").FetchClient;
|
|
38
|
+
interceptBefore(fn: any): () => void;
|
|
39
|
+
interceptAfter(fn: any): () => void;
|
|
40
|
+
interceptError(fn: any): () => void;
|
|
41
|
+
clearInterceptors(): void;
|
|
42
|
+
get lsAtom(): import("..").StorageAtomType;
|
|
43
|
+
get ssAtom(): import("..").StorageAtomType;
|
|
44
|
+
get themeAtom(): import("..").ThemeAtomType;
|
|
45
|
+
get titleAtom(): import("..").AtomType<string>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=MatesUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatesUtils.d.ts","sourceRoot":"","sources":["../../lib/MatesUtils/MatesUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,MAAM,CAAa;;IAW3B,IAAI,QAAQ,uCAEX;IACD,IAAI,MAAM,+CAET;IACD,IAAI,QAAQ,+CAEX;IACD,IAAI,gBAAgB,mCAEnB;IACD,IAAI,gBAAgB,mCAEnB;IACD,IAAI,sBAAsB,yFAEzB;IACD,IAAI,QAAQ;;;;MAEX;IAED,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,GAAG;IAGtD,cAAc;IAGd,gBAAgB;IAGhB,mBAAmB,CAAC,EAAE,EAAE,GAAG;IAM3B,IAAI,WAAW,6BAEd;IACD,eAAe,CAAC,EAAE,EAAE,GAAG;IAGvB,cAAc,CAAC,EAAE,EAAE,GAAG;IAGtB,cAAc,CAAC,EAAE,EAAE,GAAG;IAGtB,iBAAiB;IAMjB,IAAI,MAAM,iCAET;IACD,IAAI,MAAM,iCAET;IAID,IAAI,SAAS,+BAEZ;IACD,IAAI,SAAS,kCAEZ;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RouterUtils — Scope class for all router-related reactive state.
|
|
3
|
+
*
|
|
4
|
+
* Instantiate via `scope(RouterUtils)` in a component's outer function.
|
|
5
|
+
* Child components access it via `getParentScope(RouterUtils)`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const App = () => {
|
|
10
|
+
* const router = scope(RouterUtils);
|
|
11
|
+
* return () => html`${x(HomePage)}`;
|
|
12
|
+
* };
|
|
13
|
+
*
|
|
14
|
+
* // Child:
|
|
15
|
+
* const { pathAtom, navigateTo } = getParentScope(RouterUtils);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
import type { AtomType, SuperAtomType } from "../Mutables/atom/atom";
|
|
19
|
+
import type { EventType } from "../Mutables/events/events";
|
|
20
|
+
import type { NavigationEventPayload, NavigationRequestDetail } from "../Router/navigationRequest";
|
|
21
|
+
export declare class RouterUtils {
|
|
22
|
+
navigationLocked: AtomType<boolean>;
|
|
23
|
+
navigationRequestEvent: EventType<NavigationEventPayload>;
|
|
24
|
+
historyStateAtom: AtomType<unknown>;
|
|
25
|
+
pathAtom: SuperAtomType<string>;
|
|
26
|
+
qsAtom: AtomType<Record<string, any>>;
|
|
27
|
+
hashAtom: AtomType<Record<string, any>>;
|
|
28
|
+
constructor();
|
|
29
|
+
navigateTo(path: string, replace?: boolean, data?: any): void;
|
|
30
|
+
lockNavigation(): void;
|
|
31
|
+
unlockNavigation(): void;
|
|
32
|
+
get location(): {
|
|
33
|
+
readonly path: string;
|
|
34
|
+
readonly hash: Record<string, any>;
|
|
35
|
+
readonly qsObj: Record<string, any>;
|
|
36
|
+
};
|
|
37
|
+
onNavigationRequest(fn: (detail: NavigationRequestDetail) => void | Promise<void>): void;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=RouterUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouterUtils.d.ts","sourceRoot":"","sources":["../../lib/MatesUtils/RouterUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAO3D,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AAQrC,qBAAa,WAAW;IACtB,gBAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IACpC,sBAAsB,EAAE,SAAS,CAAC,sBAAsB,CAAC,CAAC;IAC1D,gBAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IACpC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACtC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;;IAexC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI;IAS7D,cAAc,IAAI,IAAI;IAItB,gBAAgB,IAAI,IAAI;IAIxB,IAAI,QAAQ;;;;MAEX;IAED,mBAAmB,CACjB,EAAE,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAC5D,IAAI;CAyCR"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StorageUtils — Scope class for localStorage/sessionStorage reactive atoms.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const { lsAtom } = getParentScope(StorageUtils);
|
|
7
|
+
* lsAtom.set({ theme: "dark" });
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
import type { StorageAtomType } from "../Mutables/atom/storageAtom";
|
|
11
|
+
export declare class StorageUtils {
|
|
12
|
+
lsAtom: StorageAtomType;
|
|
13
|
+
ssAtom: StorageAtomType;
|
|
14
|
+
constructor();
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=StorageUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageUtils.d.ts","sourceRoot":"","sources":["../../lib/MatesUtils/StorageUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE,qBAAa,YAAY;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;;CAMzB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ThemeUtils — Scope class for theme and title reactive atoms.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const { themeAtom, titleAtom } = getParentScope(ThemeUtils);
|
|
7
|
+
* themeAtom.setToDark();
|
|
8
|
+
* titleAtom.set("My App");
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
import type { AtomType } from "../Mutables/atom/atom";
|
|
12
|
+
import type { ThemeAtomType } from "../Mutables/Extended Atoms/themeAtom";
|
|
13
|
+
export declare class ThemeUtils {
|
|
14
|
+
themeAtom: ThemeAtomType;
|
|
15
|
+
titleAtom: AtomType<string>;
|
|
16
|
+
constructor();
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ThemeUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeUtils.d.ts","sourceRoot":"","sources":["../../lib/MatesUtils/ThemeUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAG1E,qBAAa,UAAU;IACrB,SAAS,EAAE,aAAa,CAAC;IACzB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;;CAM7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/MatesUtils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -34,26 +34,14 @@ export type ThemeAtomType = AtomType<ThemeValue> & {
|
|
|
34
34
|
readonly name: "themeAtom";
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* Use directly — it is the atom, not a factory.
|
|
37
|
+
* Creates a reactive theme atom.
|
|
40
38
|
*
|
|
41
39
|
* - Reads the initial theme from `localStorage["mates-theme"]`.
|
|
42
40
|
* - Falls back to the OS color-scheme preference when no value is stored.
|
|
43
41
|
* - Keeps `<html data-theme="…">` in sync automatically via an internal effect.
|
|
44
42
|
* - Persists changes to localStorage (removes key for "auto").
|
|
45
43
|
* - Re-applies the resolved theme when the OS preference changes while in
|
|
46
|
-
* "auto" mode
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* import { themeAtom } from "mates";
|
|
50
|
-
*
|
|
51
|
-
* themeAtom.setToDark();
|
|
52
|
-
* themeAtom.toggle(); // → "light"
|
|
53
|
-
* themeAtom.setToAuto(); // follows OS
|
|
54
|
-
* themeAtom.resolved; // "light" | "dark" — never "auto"
|
|
55
|
-
* themeAtom(); // read current value: "light" | "dark" | "auto"
|
|
56
|
-
* themeAtom.val; // same
|
|
44
|
+
* "auto" mode.
|
|
57
45
|
*/
|
|
58
|
-
export declare const
|
|
46
|
+
export declare const createThemeAtom: () => ThemeAtomType;
|
|
59
47
|
//# sourceMappingURL=themeAtom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeAtom.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/Extended Atoms/themeAtom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAQ,MAAM,cAAc,CAAC;AAUnD,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG;IACjD,mEAAmE;IACnE,UAAU,IAAI,IAAI,CAAC;IACnB,kEAAkE;IAClE,SAAS,IAAI,IAAI,CAAC;IAClB,uEAAuE;IACvE,SAAS,IAAI,IAAI,CAAC;IAClB;;;;OAIG;IACH,MAAM,IAAI,IAAI,CAAC;IACf,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"themeAtom.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/Extended Atoms/themeAtom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAQ,MAAM,cAAc,CAAC;AAUnD,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG;IACjD,mEAAmE;IACnE,UAAU,IAAI,IAAI,CAAC;IACnB,kEAAkE;IAClE,SAAS,IAAI,IAAI,CAAC;IAClB,uEAAuE;IACvE,SAAS,IAAI,IAAI,CAAC;IAClB;;;;OAIG;IACH,MAAM,IAAI,IAAI,CAAC;IACf,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B,CAAC;AAiKF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,aAA8B,CAAC"}
|
|
@@ -2,43 +2,21 @@ import { type AtomType } from "./atom";
|
|
|
2
2
|
export type StorageValue = Record<string, unknown>;
|
|
3
3
|
export type StorageAtomType = AtomType<StorageValue | null>;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Creates a reactive atom backed by `localStorage["mates"]`.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - Hydrates from `localStorage` on module load.
|
|
7
|
+
* - Hydrates from `localStorage` on creation.
|
|
10
8
|
* - Every `set()` / `update()` persists the new value to `localStorage["mates"]`.
|
|
11
9
|
* - Changes made in another tab are synced automatically via the `storage` event.
|
|
12
|
-
* - Only manages the single `"mates"` key
|
|
13
|
-
* any other localStorage entries.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* import { lsAtom } from "./storageAtom";
|
|
17
|
-
*
|
|
18
|
-
* lsAtom.set({ theme: "dark", lang: "en" });
|
|
19
|
-
* lsAtom.update(d => { d.lang = "fr"; });
|
|
20
|
-
* lsAtom(); // { theme: "dark", lang: "fr" }
|
|
21
|
-
* lsAtom.get(); // same
|
|
22
|
-
* lsAtom.val; // same
|
|
10
|
+
* - Only manages the single `"mates"` key.
|
|
23
11
|
*/
|
|
24
|
-
export declare
|
|
12
|
+
export declare function createLsAtom(): StorageAtomType;
|
|
25
13
|
/**
|
|
26
|
-
*
|
|
14
|
+
* Creates a reactive atom backed by `sessionStorage["mates"]`.
|
|
27
15
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* - Hydrates from `sessionStorage` on module load.
|
|
31
|
-
* - Every `set()` / `update()` persists the new value to `sessionStorage["mates"]`.
|
|
16
|
+
* - Hydrates from `sessionStorage` on creation.
|
|
17
|
+
* - Every `set()` / `update()` persists to `sessionStorage["mates"]`.
|
|
32
18
|
* - `sessionStorage` is tab-scoped so no cross-tab sync occurs.
|
|
33
|
-
* - Only manages the single `"mates"` key
|
|
34
|
-
* any other sessionStorage entries.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* import { ssAtom } from "./storageAtom";
|
|
38
|
-
*
|
|
39
|
-
* ssAtom.set({ cart: [], user: null });
|
|
40
|
-
* ssAtom.update(d => { d.cart = [item]; });
|
|
41
|
-
* ssAtom(); // { cart: [item], user: null }
|
|
19
|
+
* - Only manages the single `"mates"` key.
|
|
42
20
|
*/
|
|
43
|
-
export declare
|
|
21
|
+
export declare function createSsAtom(): StorageAtomType;
|
|
44
22
|
//# sourceMappingURL=storageAtom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageAtom.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/atom/storageAtom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAQ,MAAM,QAAQ,CAAC;AAI7C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACnD,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"storageAtom.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/atom/storageAtom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAQ,MAAM,QAAQ,CAAC;AAI7C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACnD,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;AA8G5D;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,eAAe,CAQ9C;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,eAAe,CAQ9C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type AtomType } from "./atom";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Creates a reactive atom that mirrors `document.title`.
|
|
3
4
|
*
|
|
4
5
|
* Setting this atom automatically updates the browser tab title via an
|
|
5
6
|
* internal effect. Reading it inside a memo, effect, or component will
|
|
@@ -8,13 +9,6 @@
|
|
|
8
9
|
* On SSR (environments where `document` is not defined) the initial value
|
|
9
10
|
* is `""` and writes to the atom are tracked reactively but do not touch
|
|
10
11
|
* any DOM.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* titleAtom.set("My App - Dashboard"); // document.title === "My App - Dashboard"
|
|
15
|
-
* titleAtom.get(); // "My App - Dashboard"
|
|
16
|
-
* // Reading titleAtom() in a component will re-render whenever the title changes
|
|
17
|
-
* ```
|
|
18
12
|
*/
|
|
19
|
-
export declare
|
|
13
|
+
export declare function createTitleAtom(): AtomType<string>;
|
|
20
14
|
//# sourceMappingURL=titleAtom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"titleAtom.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/atom/titleAtom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"titleAtom.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/atom/titleAtom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAQ,MAAM,QAAQ,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,IAAI,QAAQ,CAAC,MAAM,CAAC,CAWlD"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { MatesUtils } from "../../MatesUtils";
|
|
2
|
+
import { FetchUtils } from "../../MatesUtils/FetchUtils";
|
|
3
|
+
import { RouterUtils } from "../../MatesUtils/RouterUtils";
|
|
4
|
+
import { StorageUtils } from "../../MatesUtils/StorageUtils";
|
|
5
|
+
import { ThemeUtils } from "../../MatesUtils/ThemeUtils";
|
|
1
6
|
type TScope<T> = T & {
|
|
2
7
|
reset: () => void;
|
|
3
8
|
__isScope___: boolean;
|
|
@@ -56,5 +61,31 @@ export declare const scope: <T extends object>(ScopeClass: new () => T) => TScop
|
|
|
56
61
|
* counter.incr(); // mutates the parent's atom
|
|
57
62
|
*/
|
|
58
63
|
export declare const getParentScope: <T extends object>(ScopeClass: new () => T) => TScope<T>;
|
|
59
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Register scope classes that WithScope should instantiate on every
|
|
66
|
+
* component tree mount. Libraries call this at module level.
|
|
67
|
+
*
|
|
68
|
+
* Safe to call multiple times — duplicates are ignored (Set semantics).
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* import { registerGlobalScopes } from "mates";
|
|
72
|
+
* registerGlobalScopes([SnackbarScope, NotificationScope]);
|
|
73
|
+
*/
|
|
74
|
+
export declare function registerGlobalScopes(classes: Array<new () => object>): void;
|
|
75
|
+
/**
|
|
76
|
+
* Returns a snapshot of all registered global scope classes.
|
|
77
|
+
* Used internally by WithScope.
|
|
78
|
+
*/
|
|
79
|
+
export declare function getGlobalScopeClasses(): Array<new () => object>;
|
|
80
|
+
export declare const useUtils: () => TScope<MatesUtils>;
|
|
81
|
+
/** Alias for `scope()` — creates a scope instance. */
|
|
82
|
+
export { scope as useScope };
|
|
83
|
+
/** Shorthand for `getParentScope(RouterUtils)`. */
|
|
84
|
+
export declare const useRouter: () => TScope<RouterUtils>;
|
|
85
|
+
/** Shorthand for `getParentScope(FetchUtils)`. */
|
|
86
|
+
export declare const useFetch: () => TScope<FetchUtils>;
|
|
87
|
+
/** Shorthand for `getParentScope(StorageUtils)`. */
|
|
88
|
+
export declare const useStorage: () => TScope<StorageUtils>;
|
|
89
|
+
/** Shorthand for `getParentScope(ThemeUtils)`. */
|
|
90
|
+
export declare const useTheme: () => TScope<ThemeUtils>;
|
|
60
91
|
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/scope/scope.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/scope/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAMzD,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,MAAM,EAAE,YAAY,UAAU,CAAC,KAAG,MAAM,CAAC,CAAC,CAiEzE,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,EAC7C,YAAY,UAAU,CAAC,KACtB,MAAM,CAAC,CAAC,CA2CV,CAAC;AAWF;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,MAAM,CAAC,GAAG,IAAI,CAE3E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,KAAK,CAAC,UAAU,MAAM,CAAC,CAE/D;AAED,eAAO,MAAM,QAAQ,0BAAmC,CAAC;AAEzD,sDAAsD;AACtD,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,CAAC;AAE7B,mDAAmD;AACnD,eAAO,MAAM,SAAS,2BAAoC,CAAC;AAE3D,kDAAkD;AAClD,eAAO,MAAM,QAAQ,0BAAmC,CAAC;AAEzD,oDAAoD;AACpD,eAAO,MAAM,UAAU,4BAAqC,CAAC;AAE7D,kDAAkD;AAClD,eAAO,MAAM,QAAQ,0BAAmC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animatedRouter.d.ts","sourceRoot":"","sources":["../../lib/Router/animatedRouter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"animatedRouter.d.ts","sourceRoot":"","sources":["../../lib/Router/animatedRouter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAQ/D,OAAO,KAAK,EAAE,aAAa,EAAS,MAAM,uBAAuB,CAAC;AAGlE,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,aAAa,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAGD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AA0FrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,mBAAmB,EAAE,EAC7B,OAAO,GAAE,qBAA0B,wCAGpC"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { type AtomType } from "../Mutables/atom/atom";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Creates a reactive atom holding the current URL hash fragment as a parsed object.
|
|
3
4
|
*
|
|
4
|
-
* Hydrated from `window.location.hash` at
|
|
5
|
+
* Hydrated from `window.location.hash` at creation time. All reads are
|
|
5
6
|
* reactive — any effect or component that calls `hashAtom()` will re-run
|
|
6
7
|
* whenever the hash state changes.
|
|
7
8
|
*
|
|
8
9
|
* Setting the atom via `hashAtom.set(obj)` automatically serialises the new
|
|
9
10
|
* value back to the URL hash using `history.replaceState`.
|
|
11
|
+
*
|
|
12
|
+
* @param navigationLocked - A reactive atom; when `true`, URL writes and
|
|
13
|
+
* hashchange→atom updates are suppressed.
|
|
10
14
|
*/
|
|
11
|
-
export declare
|
|
15
|
+
export declare function createHashAtom(navigationLocked: AtomType<boolean>): AtomType<Record<string, any>>;
|
|
12
16
|
//# sourceMappingURL=hashAtom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashAtom.d.ts","sourceRoot":"","sources":["../../lib/Router/hashAtom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hashAtom.d.ts","sourceRoot":"","sources":["../../lib/Router/hashAtom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAQ,MAAM,uBAAuB,CAAC;AAgD5D;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,gBAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAClC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAuB/B"}
|
|
@@ -1,40 +1,8 @@
|
|
|
1
|
+
import { type AtomType } from "../Mutables/atom/atom";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `window.history.state`.
|
|
3
|
+
* Creates a reactive atom that always reflects `window.history.state`.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* 1. **`popstate`** — the user pressed back / forward. The browser restores
|
|
8
|
-
* the state that was associated with that history entry and this atom is
|
|
9
|
-
* set to `event.state`.
|
|
10
|
-
*
|
|
11
|
-
* 2. **`navigateTo(path, replace, data)`** — called directly from
|
|
12
|
-
* `navigateTo.ts` before the pushState / replaceState call so any
|
|
13
|
-
* subscriber reading the atom during the subsequent `pathAtom` update
|
|
14
|
-
* already sees the new state.
|
|
15
|
-
*
|
|
16
|
-
* Hydrated from `window.history.state` at module load time so a hard
|
|
17
|
-
* refresh or direct URL load with pre-existing state is reflected
|
|
18
|
-
* correctly from the very first render.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* // Pass state when navigating:
|
|
22
|
-
* navigateTo("/users/42", false, { fromList: true, scrollY: 320 });
|
|
23
|
-
*
|
|
24
|
-
* // Read it on the destination page:
|
|
25
|
-
* historyStateAtom(); // { fromList: true, scrollY: 320 }
|
|
26
|
-
*
|
|
27
|
-
* // Back / forward automatically restores the state for that entry.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* // Drive slide direction based on navigation state:
|
|
31
|
-
* const { direction } = historyStateAtom() ?? {};
|
|
32
|
-
* html`<div class=${direction === "back" ? "slide-right" : "slide-left"}>…</div>`
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* // Guard: know whether the user arrived via in-app nav or direct load:
|
|
36
|
-
* const state = historyStateAtom();
|
|
37
|
-
* if (!state?.fromApp) navigateTo("/");
|
|
5
|
+
* Hydrated from `window.history.state` at creation time.
|
|
38
6
|
*/
|
|
39
|
-
export declare
|
|
7
|
+
export declare function createHistoryStateAtom(): AtomType<unknown>;
|
|
40
8
|
//# sourceMappingURL=historyStateAtom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"historyStateAtom.d.ts","sourceRoot":"","sources":["../../lib/Router/historyStateAtom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"historyStateAtom.d.ts","sourceRoot":"","sources":["../../lib/Router/historyStateAtom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAQ,MAAM,uBAAuB,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,QAAQ,CAAC,OAAO,CAAC,CAI1D"}
|
|
@@ -2,20 +2,9 @@
|
|
|
2
2
|
* Replace dynamic route params in the current URL using a **pattern** that
|
|
3
3
|
* describes which segments are params.
|
|
4
4
|
*
|
|
5
|
-
* The pattern tells `replaceParams` the *names* of the dynamic segments —
|
|
6
|
-
* the current path provides the *positions*. Together they let you swap out
|
|
7
|
-
* individual param values without touching the rest of the URL.
|
|
8
|
-
*
|
|
9
5
|
* Uses `replaceState` — no new history entry is created.
|
|
10
6
|
*
|
|
11
|
-
*
|
|
12
|
-
* // Current path: /users/42/posts/7
|
|
13
|
-
* replaceParams("/users/:id/posts/:postId", { id: 99 });
|
|
14
|
-
* // → /users/99/posts/7
|
|
15
|
-
*
|
|
16
|
-
* replaceParams("/users/:id/posts/:postId", { id: 99, postId: 3 });
|
|
17
|
-
* // → /users/99/posts/3
|
|
18
|
-
* ```
|
|
7
|
+
* Reads `pathAtom` and calls `navigateTo()` from the nearest `MatesUtils` scope.
|
|
19
8
|
*
|
|
20
9
|
* @param pattern Route pattern with `:param` segments (e.g. `"/users/:id"`).
|
|
21
10
|
* @param params Param names → new values. Only provided keys are replaced;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"historyUtils.d.ts","sourceRoot":"","sources":["../../lib/Router/historyUtils.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"historyUtils.d.ts","sourceRoot":"","sources":["../../lib/Router/historyUtils.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAChD,IAAI,CA2CN"}
|
package/dist/Router/index.d.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export { type AnimatedRouteConfig, type AnimatedRouterOptions, animatedRouter, } from "./animatedRouter";
|
|
2
2
|
export { buildPath } from "./buildPath";
|
|
3
|
-
export { hashAtom } from "./hashAtom";
|
|
4
|
-
export { historyStateAtom } from "./historyStateAtom";
|
|
5
3
|
export { replaceParams } from "./historyUtils";
|
|
6
4
|
export { isPathMatching } from "./isPathMatching";
|
|
7
|
-
export {
|
|
8
|
-
export { navigateTo } from "./navigateTo";
|
|
9
|
-
export { lockNavigation, navigationLocked, unlockNavigation, } from "./navigationLock";
|
|
10
|
-
export { type NavigationRequestDetail, navigationRequestEvent, onNavigationRequest, } from "./navigationRequest";
|
|
11
|
-
export { pathAtom } from "./pathAtom";
|
|
12
|
-
export { qsAtom } from "./qsAtom";
|
|
5
|
+
export type { NavigationRequestDetail } from "./navigationRequest";
|
|
13
6
|
export { Router, route } from "./Router";
|
|
14
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/Router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/Router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import type { SuperAtomType } from "../Mutables/atom/atom";
|
|
1
2
|
/**
|
|
2
3
|
* Checks whether the current pathname matches a route pattern.
|
|
3
4
|
*
|
|
4
5
|
* Supports dynamic params in the pattern using `:param` segments.
|
|
5
6
|
*
|
|
7
|
+
* Reads `pathAtom` from the nearest `MatesUtils` scope, or uses the
|
|
8
|
+
* optional `pathAtom` parameter when provided (useful for testing).
|
|
9
|
+
*
|
|
6
10
|
* @example
|
|
7
11
|
* // current path: /users/42
|
|
8
12
|
* isPathMatching("/users/:id") // true
|
|
9
13
|
* isPathMatching("/users") // false
|
|
10
14
|
*/
|
|
11
|
-
export declare const isPathMatching: (path: string) => boolean;
|
|
15
|
+
export declare const isPathMatching: (path: string, pathAtom?: SuperAtomType<string>) => boolean;
|
|
12
16
|
//# sourceMappingURL=isPathMatching.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPathMatching.d.ts","sourceRoot":"","sources":["../../lib/Router/isPathMatching.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isPathMatching.d.ts","sourceRoot":"","sources":["../../lib/Router/isPathMatching.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,MAAM,EACZ,WAAW,aAAa,CAAC,MAAM,CAAC,KAC/B,OAwBF,CAAC"}
|