mates 0.3.0 → 0.3.2
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/Directives/onDirective.d.ts.map +1 -1
- package/dist/Mutables/form/formAtom.d.ts +7 -5
- package/dist/Mutables/form/formAtom.d.ts.map +1 -1
- package/dist/Mutables/useStore/subscription.d.ts +1 -1
- package/dist/Mutables/useStore/subscription.d.ts.map +1 -1
- package/dist/Router/Router.d.ts +4 -5
- package/dist/Router/Router.d.ts.map +1 -1
- package/dist/Router/navigationRequest.d.ts +37 -51
- package/dist/Router/navigationRequest.d.ts.map +1 -1
- package/dist/Template/x-x.d.ts.map +1 -1
- package/dist/Template/x-x.types.d.ts +0 -22
- package/dist/Template/x-x.types.d.ts.map +1 -1
- package/dist/Template/x.d.ts.map +1 -1
- package/dist/Utils/index.d.ts +1 -0
- package/dist/Utils/index.d.ts.map +1 -1
- package/dist/Utils/logEvent.d.ts +24 -0
- package/dist/Utils/logEvent.d.ts.map +1 -0
- package/dist/Utils/logger.d.ts +24 -13
- package/dist/Utils/logger.d.ts.map +1 -1
- package/dist/Utils/onceIdle.d.ts +28 -0
- package/dist/Utils/onceIdle.d.ts.map +1 -0
- package/dist/index.d.ts +51 -6627
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +46 -40
- package/dist/index.esm.js.map +1 -1
- package/dist/indexdb/index.d.ts +3 -0
- package/dist/indexdb/index.d.ts.map +1 -0
- package/dist/indexdb/indexdb.d.ts +86 -0
- package/dist/indexdb/indexdb.d.ts.map +1 -0
- package/dist/indexdb/types.d.ts +249 -0
- package/dist/indexdb/types.d.ts.map +1 -0
- package/dist/minidb/index.d.ts +3 -0
- package/dist/minidb/index.d.ts.map +1 -0
- package/dist/minidb/minidb.d.ts +105 -0
- package/dist/minidb/minidb.d.ts.map +1 -0
- package/dist/portals/popup.d.ts.map +1 -1
- package/package.json +8 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onDirective.d.ts","sourceRoot":"","sources":["../../lib/Directives/onDirective.ts"],"names":[],"mappings":"AAWA,4EAA4E;AAC5E,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;AAE9E,2EAA2E;AAC3E,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;AAE7E,gFAAgF;AAChF,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;AAI9D,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,aAAa,EAAE,oBAAoB,CAAC;IACpC,4EAA4E;IAC5E,YAAY,EAAE,mBAAmB,CAAC;IAClC,0DAA0D;IAC1D,YAAY,EAAE,mBAAmB,CAAC;CACnC;AAID;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;KACtB,CAAC,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI;CAC3E,GAAG;KACD,CAAC,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC;CAC1D,CAAC;
|
|
1
|
+
{"version":3,"file":"onDirective.d.ts","sourceRoot":"","sources":["../../lib/Directives/onDirective.ts"],"names":[],"mappings":"AAWA,4EAA4E;AAC5E,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;AAE9E,2EAA2E;AAC3E,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;AAE7E,gFAAgF;AAChF,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;AAI9D,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,aAAa,EAAE,oBAAoB,CAAC;IACpC,4EAA4E;IAC5E,YAAY,EAAE,mBAAmB,CAAC;IAClC,0DAA0D;IAC1D,YAAY,EAAE,mBAAmB,CAAC;CACnC;AAID;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;KACtB,CAAC,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI;CAC3E,GAAG;KACD,CAAC,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC;CAC1D,CAAC;AAsLF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,EAAE,CAAC,MAAM,EAAE,UAAU,6FAEpC;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAE1C"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { type AtomConfig, type
|
|
1
|
+
import { type AtomConfig, type SuperAtomType } from "../atom/atom";
|
|
2
2
|
import type { ValidatorFn } from "./validators";
|
|
3
3
|
/**
|
|
4
|
-
* Widen literal types so that `
|
|
4
|
+
* Widen literal types so that `form
|
|
5
|
+
"")` infers `FormAtom<string>`
|
|
5
6
|
* instead of `FormAtom<"">`, and `formAtom(0)` infers `FormAtom<number>`
|
|
6
7
|
* instead of `FormAtom<0>`.
|
|
7
8
|
*/
|
|
@@ -13,7 +14,7 @@ type Widen<T> = T extends string ? string : T extends number ? number : T extend
|
|
|
13
14
|
* __subscribe, __version__, lock/unlock, toJSON, …) with form-specific
|
|
14
15
|
* members: errors, isValid, validate(), and the numeric helpers.
|
|
15
16
|
*/
|
|
16
|
-
export type FormAtom<T> =
|
|
17
|
+
export type FormAtom<T> = SuperAtomType<T> & {
|
|
17
18
|
validate(): string[];
|
|
18
19
|
readonly errors: string[];
|
|
19
20
|
readonly isValid: boolean;
|
|
@@ -26,9 +27,10 @@ export type FormAtom<T> = AtomType<T> & {
|
|
|
26
27
|
/**
|
|
27
28
|
* Create a reactive form field atom.
|
|
28
29
|
*
|
|
29
|
-
* Inherits the full `
|
|
30
|
+
* Inherits the full `SuperAtomType<T>` interface — callable as a function,
|
|
30
31
|
* `.get()`, `.set()`, `.update()`, `.val`, `.__subscribe()`,
|
|
31
|
-
* `.__version__`, `.
|
|
32
|
+
* `.__version__`, `.__id__`, `.toJSON()`, `.lock()`, `.unlock()`,
|
|
33
|
+
* `.reset()`, `.freeze()` — plus:
|
|
32
34
|
*
|
|
33
35
|
* - `errors` — `string[]` reactive via an internal atom; `[]` on mount.
|
|
34
36
|
* - `isValid` — `boolean` derived from errors.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formAtom.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/form/formAtom.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"formAtom.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/form/formAtom.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,aAAa,EAEnB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;GAKG;AACH,KAAK,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC5B,MAAM,GACN,CAAC,SAAS,MAAM,GACd,MAAM,GACN,CAAC,SAAS,OAAO,GACf,OAAO,GACP,CAAC,CAAC;AAIV;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG;IAC3C,QAAQ,IAAI,MAAM,EAAE,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC;IAC9B,OAAO,IAAI,MAAM,CAAC;IAClB,aAAa,IAAI,MAAM,CAAC;IACxB,aAAa,IAAI,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B,CAAC;AAiGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EACxB,SAAS,CAAC,EACV,aAAY,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAO,EACxC,SAAS,UAAU,KAClB,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAC+C,CAAC"}
|
|
@@ -46,5 +46,5 @@ export type SetterReturnType<T extends Function> = T & {
|
|
|
46
46
|
set: SetterReturnType<T>;
|
|
47
47
|
[key: string]: any;
|
|
48
48
|
};
|
|
49
|
-
export declare const on: (callback: () => (() => void) |
|
|
49
|
+
export declare const on: (callback: () => void | (() => void) | Promise<void>, deps: any[]) => () => void;
|
|
50
50
|
//# sourceMappingURL=subscription.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/useStore/subscription.ts"],"names":[],"mappings":"AAMA,wBAAgB,UAAU,CACxB,KAAK,EAAE,GAAG,EACV,UAAU,UAAO,EACjB,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,QAY7C;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,QAAQ,CAAC;IAC/C,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,QAAQ,CAAC;IACjD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,YAAY,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAG5D;AAED,MAAM,M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AAI,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,EACnD,MAAM,GAAG,EAAE,eA0CZ,CAAC"}
|
package/dist/Router/Router.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ComponentType, View } from "../Template/x-x.types";
|
|
1
|
+
import type { ComponentType } from "../Template/x-x.types";
|
|
3
2
|
/**
|
|
4
3
|
* Renders `view` if the current URL path matches `path`; otherwise returns `null`.
|
|
5
4
|
*
|
|
@@ -14,9 +13,9 @@ import type { ComponentType, View } from "../Template/x-x.types";
|
|
|
14
13
|
* // Inside a template function:
|
|
15
14
|
* ${route("/about", { view: () => html`<about-page></about-page>` })}
|
|
16
15
|
*/
|
|
17
|
-
export declare const route: (path: string, { view
|
|
18
|
-
view:
|
|
19
|
-
}) =>
|
|
16
|
+
export declare const route: (path: string, { view }: {
|
|
17
|
+
view: ComponentType;
|
|
18
|
+
}) => import("lit-html").TemplateResult<1> | null;
|
|
20
19
|
type RouteConfig = {
|
|
21
20
|
path: string;
|
|
22
21
|
component: ComponentType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../lib/Router/Router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../lib/Router/Router.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAa,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAItE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,EAAE,UAAU;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,gDAGpE,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,MAAM,GACjB,aAAa,WAAW,EAAE,EAC1B,WAAW,aAAa,kEAezB,CAAC"}
|
|
@@ -1,75 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
/** The path the user is navigating to. */
|
|
1
|
+
interface NavigationEventPayload {
|
|
3
2
|
to: string;
|
|
4
|
-
/** The path the user is currently on. */
|
|
5
3
|
from: string;
|
|
6
4
|
}
|
|
7
5
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Subscribe with `on()` in a component's outer function to react to every
|
|
11
|
-
* navigation attempt — for example to show a "leave page?" confirmation dialog
|
|
12
|
-
* before the route actually changes.
|
|
13
|
-
*
|
|
14
|
-
* The event carries `{ to, from }` so you always know both endpoints.
|
|
6
|
+
* Detail object passed to every `onNavigationRequest` callback.
|
|
15
7
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* const MyPage = () => {
|
|
22
|
-
* const confirm = useConfirmDialog({ danger: false });
|
|
23
|
-
*
|
|
24
|
-
* on(async ({ to }) => {
|
|
25
|
-
* const ok = await confirm.show(`Leave to ${to}?`);
|
|
26
|
-
* if (!ok) lockNavigation();
|
|
27
|
-
* }, [navigationRequestEvent]);
|
|
28
|
-
*
|
|
29
|
-
* return () => html`…`;
|
|
30
|
-
* };
|
|
31
|
-
* ```
|
|
8
|
+
* - `to` — the path the user is navigating to.
|
|
9
|
+
* - `from` — the path the user is currently on.
|
|
10
|
+
* - `next` — call this to **allow** the navigation to proceed.
|
|
11
|
+
* If `next()` is never called, the navigation is silently cancelled.
|
|
32
12
|
*/
|
|
33
|
-
export
|
|
13
|
+
export interface NavigationRequestDetail {
|
|
14
|
+
to: string;
|
|
15
|
+
from: string;
|
|
16
|
+
/**
|
|
17
|
+
* Proceed with the navigation.
|
|
18
|
+
* If not called before the callback settles, navigation is cancelled.
|
|
19
|
+
*/
|
|
20
|
+
next: () => void;
|
|
21
|
+
}
|
|
34
22
|
/**
|
|
35
|
-
* `
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
* -
|
|
42
|
-
*
|
|
23
|
+
* Low-level event fired by `navigateTo()` / `popstate` immediately before
|
|
24
|
+
* navigation is committed. Prefer `onNavigationRequest` for component-scoped
|
|
25
|
+
* interception.
|
|
26
|
+
*/
|
|
27
|
+
export declare const navigationRequestEvent: import("../Mutables/events/events").EventType<NavigationEventPayload>;
|
|
28
|
+
/**
|
|
29
|
+
* Component-scoped hook that fires whenever `navigateTo()` is called,
|
|
30
|
+
* **before** the navigation is committed.
|
|
43
31
|
*
|
|
44
|
-
* The callback receives `{ to, from }
|
|
45
|
-
*
|
|
32
|
+
* The callback receives `{ to, from, next }`:
|
|
33
|
+
* - Call `next()` to allow the navigation.
|
|
34
|
+
* - Do **not** call `next()` to cancel it.
|
|
35
|
+
* - The callback may be `async` — navigation stays locked until `next()` is
|
|
36
|
+
* called or the callback settles without calling it.
|
|
46
37
|
*
|
|
47
38
|
* Must be called in the **outer function** of a mates component.
|
|
48
39
|
*
|
|
49
40
|
* @example
|
|
50
41
|
* ```ts
|
|
51
|
-
* import { onNavigationRequest
|
|
42
|
+
* import { onNavigationRequest } from "mates";
|
|
43
|
+
* import { Confirm } from "mates-ui";
|
|
52
44
|
*
|
|
53
45
|
* const EditorPage = () => {
|
|
54
46
|
* const isDirty = atom(false);
|
|
55
|
-
* const confirm = useConfirmDialog();
|
|
56
47
|
*
|
|
57
|
-
* onNavigationRequest(async ({
|
|
58
|
-
* if (!isDirty()) return;
|
|
59
|
-
* const
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* });
|
|
63
|
-
* if (!ok) {
|
|
64
|
-
* lockNavigation();
|
|
65
|
-
* // re-unlock so future navigation works after user decides to stay
|
|
66
|
-
* Promise.resolve().then(unlockNavigation);
|
|
67
|
-
* }
|
|
48
|
+
* onNavigationRequest(async ({ next }) => {
|
|
49
|
+
* if (!isDirty()) { next(); return; } // clean — let it through
|
|
50
|
+
* const leave = await Confirm("Leave without saving?");
|
|
51
|
+
* if (leave) { isDirty.set(false); next(); } // confirmed — proceed
|
|
52
|
+
* // no next() call → navigation is cancelled
|
|
68
53
|
* });
|
|
69
54
|
*
|
|
70
55
|
* return () => html`…`;
|
|
71
56
|
* };
|
|
72
57
|
* ```
|
|
73
58
|
*/
|
|
74
|
-
export declare const onNavigationRequest: (fn: (detail: NavigationRequestDetail) => void |
|
|
59
|
+
export declare const onNavigationRequest: (fn: (detail: NavigationRequestDetail) => void | Promise<void>) => void;
|
|
60
|
+
export {};
|
|
75
61
|
//# sourceMappingURL=navigationRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigationRequest.d.ts","sourceRoot":"","sources":["../../lib/Router/navigationRequest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"navigationRequest.d.ts","sourceRoot":"","sources":["../../lib/Router/navigationRequest.ts"],"names":[],"mappings":"AAWA,UAAU,sBAAsB;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAID;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,uEAElC,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,mBAAmB,GAC9B,IAAI,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAC5D,IA6DF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x-x.d.ts","sourceRoot":"","sources":["../../lib/Template/x-x.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"x-x.d.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IAAI,GAAG,gBAAgB,CAAQ;;IAwBlD,IAAI,KAAK,CAAC,GAAG,qBAAA,EAGZ;IAED,IAAI,KAAK,wBAER;IAEM,OAAO,EAAE,GAAG,CAAC;IAEpB,OAAO,CAAC,cAAc,CAAS;IAM/B;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IAmBxB,IAAI,IAAI,CAAC,GAAG,KAAA,EAyBX;IAED,IAAI,IAAI,QAEP;IAMD,gBAAgB;IAIhB,iBAAiB;IAgCjB,oBAAoB;IAqBpB,OAAO,CAAC,qBAAqB,CAa3B;IAEF,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ;IAazC,OAAO;IA6CP,OAAO,CAAC,eAAe;IAqFvB,OAAO,CAAC,kBAAkB;CAiF3B"}
|
|
@@ -66,26 +66,4 @@ export type ComponentType<T extends Record<string, any> = Record<string, any>> =
|
|
|
66
66
|
* current host component.
|
|
67
67
|
*/
|
|
68
68
|
export type Setter = <T extends (...args: any[]) => any>(fn: T) => T;
|
|
69
|
-
/** @deprecated Use Component instead */
|
|
70
|
-
export type ComponentFn<T extends Record<string, any> = Record<string, any>> = Component<T>;
|
|
71
|
-
/** @deprecated Use Component instead */
|
|
72
|
-
export type View<T extends Record<string, any> = Record<string, any>> = Component<T>;
|
|
73
|
-
/** @deprecated Use Component instead */
|
|
74
|
-
export type ClosureComponent<T extends Record<string, any> = Record<string, any>> = Component<T>;
|
|
75
|
-
/** @deprecated Use Component instead */
|
|
76
|
-
export type ViewComponent<T extends Record<string, any> = Record<string, any>> = Component<T>;
|
|
77
|
-
/** @deprecated Use Component instead */
|
|
78
|
-
export type C<T extends Record<string, any> = Record<string, any>> = Component<T>;
|
|
79
|
-
/** @deprecated Use Component instead */
|
|
80
|
-
export type OuterFn<T extends Record<string, any> = Record<string, any>> = Component<T>;
|
|
81
|
-
/** @deprecated Use Props instead */
|
|
82
|
-
export type PropsType<T extends Record<string, any> = Record<string, any>> = Props<T>;
|
|
83
|
-
/** @deprecated Use TemplateFn instead */
|
|
84
|
-
export type RenderFn = TemplateFn;
|
|
85
|
-
/** @deprecated Use TemplateFn instead */
|
|
86
|
-
export type InnerFn = TemplateFn;
|
|
87
|
-
/** @deprecated Use TemplateFn instead */
|
|
88
|
-
export type TemplateComponent = TemplateFn;
|
|
89
|
-
/** @deprecated Use TemplateFn instead */
|
|
90
|
-
export type X = TemplateFn;
|
|
91
69
|
//# sourceMappingURL=x-x.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x-x.types.d.ts","sourceRoot":"","sources":["../../lib/Template/x-x.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE3D,YAAY,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE3D;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACnD,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,cAAc,GAAG,IAAI,GAAG,OAAO,OAAO,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAC3E,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,KACd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,aAAa,CAAC,CAAC,CAAC,EACxB,QAAO,CAAW,
|
|
1
|
+
{"version":3,"file":"x.d.ts","sourceRoot":"","sources":["../../lib/Template/x.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,eAAO,MAAM,CAAC,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7C,QAAQ,aAAa,CAAC,CAAC,CAAC,EACxB,QAAO,CAAW,yCAMnB,CAAC;AAGF,eAAO,MAAM,IAAI,GAXC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UACrC,aAAa,CAAC,CAAC,CAAC,UACjB,CAAC,yCASW,CAAC;AACtB,eAAe;AACf,eAAO,MAAM,QAAQ,GAbH,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UACrC,aAAa,CAAC,CAAC,CAAC,UACjB,CAAC,yCAWe,CAAC;AAE1B,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnD,QAAQ,aAAa,CAAC,CAAC,CAAC,EACxB,SAAS,WAAW,EACpB,QAAO,CAAW,gCAGnB,CAAC;AAEF,qBAAqB;AACrB,eAAO,MAAM,cAAc,GATH,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UAC3C,aAAa,CAAC,CAAC,CAAC,WACf,WAAW,UACb,CAAC,gCAM2B,CAAC"}
|
package/dist/Utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/Utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,MAAM,CAAC;AACrB,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/Utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,MAAM,CAAC;AACrB,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* matesLogEvent — the internal pub/sub event fired by log() / logError() / logWarning().
|
|
3
|
+
*
|
|
4
|
+
* Deliberately does NOT use event() from events.ts to avoid a circular
|
|
5
|
+
* dependency (events.ts → logger.ts → events.ts).
|
|
6
|
+
*
|
|
7
|
+
* The shape matches EventType<T> so devtools and user code can subscribe
|
|
8
|
+
* with the same __subscribe / trigger API as any other mates event.
|
|
9
|
+
*/
|
|
10
|
+
export interface MatesLogEventDetail {
|
|
11
|
+
level: "log" | "error" | "warn";
|
|
12
|
+
message: unknown;
|
|
13
|
+
data?: unknown;
|
|
14
|
+
ts: number;
|
|
15
|
+
}
|
|
16
|
+
type Handler = (data: MatesLogEventDetail) => void;
|
|
17
|
+
export declare const matesLogEvent: {
|
|
18
|
+
name: string;
|
|
19
|
+
__isEvent___: true;
|
|
20
|
+
trigger(data: MatesLogEventDetail): void;
|
|
21
|
+
__subscribe(fn: Handler): () => void;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=logEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logEvent.d.ts","sourceRoot":"","sources":["../../lib/Utils/logEvent.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,KAAK,OAAO,GAAG,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;AAGnD,eAAO,MAAM,aAAa;;;kBAIV,mBAAmB,GAAG,IAAI;oBAUxB,OAAO,GAAG,MAAM,IAAI;CAIrC,CAAC"}
|
package/dist/Utils/logger.d.ts
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Logger utility
|
|
2
|
+
* Logger utility — logs in dev, and always fires matesLogEvent so that
|
|
3
|
+
* mates-devtools can capture user logs regardless of environment.
|
|
3
4
|
*/
|
|
5
|
+
export type { MatesLogEventDetail } from "./logEvent";
|
|
6
|
+
export { matesLogEvent } from "./logEvent";
|
|
7
|
+
/** Deep-clone a value with structuredClone; falls back to the original if not cloneable. */
|
|
8
|
+
export declare function safeClone<T>(value: T): T;
|
|
4
9
|
/**
|
|
5
|
-
* Log
|
|
6
|
-
*
|
|
7
|
-
*
|
|
10
|
+
* Log a message + optional data.
|
|
11
|
+
* Always fires matesLogEvent (captured by devtools).
|
|
12
|
+
* Prints to console only in dev/localhost.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* log("User clicked", { id: 42 });
|
|
8
16
|
*/
|
|
9
|
-
export declare function
|
|
17
|
+
export declare function log(message: unknown, data?: unknown): void;
|
|
10
18
|
/**
|
|
11
|
-
* Log
|
|
12
|
-
*
|
|
13
|
-
*
|
|
19
|
+
* Log an error + optional context.
|
|
20
|
+
* Always fires matesLogEvent (captured by devtools).
|
|
21
|
+
* Prints to console only in dev/localhost.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* logError("Fetch failed", error);
|
|
14
25
|
*/
|
|
15
|
-
export declare function
|
|
26
|
+
export declare function logError(error: unknown, context?: unknown): void;
|
|
16
27
|
/**
|
|
17
|
-
* Log
|
|
18
|
-
*
|
|
19
|
-
*
|
|
28
|
+
* Log a warning + optional data.
|
|
29
|
+
* Always fires matesLogEvent (captured by devtools).
|
|
30
|
+
* Prints to console only in dev/localhost.
|
|
20
31
|
*/
|
|
21
|
-
export declare function
|
|
32
|
+
export declare function logWarning(message: unknown, data?: unknown): void;
|
|
22
33
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../lib/Utils/logger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../lib/Utils/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,4FAA4F;AAC5F,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAMxC;AAuBD;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAW1D;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAWhE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAWjE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves after the browser has finished all pending microtasks, effects
|
|
3
|
+
* and renders — i.e. once the current "work cycle" is fully idle.
|
|
4
|
+
*
|
|
5
|
+
* - Uses `requestIdleCallback` when available (Chromium, Firefox) so the
|
|
6
|
+
* callback only runs when the main thread has no higher-priority work left.
|
|
7
|
+
* - Falls back to `requestAnimationFrame` on browsers that don't support rIC
|
|
8
|
+
* (Safari). A single rAF fires after all queued microtasks drain, which
|
|
9
|
+
* covers the mates effectScheduler + globalScheduler flush cycle.
|
|
10
|
+
* - In SSR (no window) the promise resolves on the next microtask so
|
|
11
|
+
* server-side code can `await onceIdle()` without throwing.
|
|
12
|
+
*
|
|
13
|
+
* Accepts an optional `callback` that is invoked just before the promise
|
|
14
|
+
* resolves, making both usage patterns work:
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // await style — pause until idle, then continue
|
|
18
|
+
* await onceIdle();
|
|
19
|
+
* console.log("all renders have settled");
|
|
20
|
+
*
|
|
21
|
+
* // callback style — fire-and-forget
|
|
22
|
+
* onceIdle(() => expensiveWork());
|
|
23
|
+
*
|
|
24
|
+
* // callback + await — run work at the idle point, then continue
|
|
25
|
+
* await onceIdle(() => expensiveWork());
|
|
26
|
+
*/
|
|
27
|
+
export declare function onceIdle(callback?: () => void): Promise<void>;
|
|
28
|
+
//# sourceMappingURL=onceIdle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onceIdle.d.ts","sourceRoot":"","sources":["../../lib/Utils/onceIdle.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAsB7D"}
|