@expressive/mvc 0.9.5 → 0.9.6
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/lib/index.d.ts +12 -9
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare class Subscriber<T extends {} = any> {
|
|
|
22
22
|
dependant: Set<Listener>;
|
|
23
23
|
watch: Map<any, boolean | (() => true | void)>;
|
|
24
24
|
constructor(parent: Control<T>, onUpdate: Subscriber.OnEvent);
|
|
25
|
-
get using(): Model.
|
|
25
|
+
get using(): Model.Field<T>[];
|
|
26
26
|
assign(apply: Model.Compat<T>, keys?: any): void;
|
|
27
27
|
add(key: any, value?: boolean | Callback): void;
|
|
28
28
|
commit: () => () => void;
|
|
@@ -45,7 +45,7 @@ declare type Debug<T extends {}> = T & {
|
|
|
45
45
|
/** Current subscriber (if present) while used in a live context (e.g. hook or effect). */
|
|
46
46
|
[LOCAL]?: Subscriber<T>;
|
|
47
47
|
/** Current state of this instance. */
|
|
48
|
-
[STATE]?: Model.
|
|
48
|
+
[STATE]?: Model.Export<T>;
|
|
49
49
|
/**
|
|
50
50
|
* Last update causing a refresh to subscribers.
|
|
51
51
|
*
|
|
@@ -78,18 +78,18 @@ declare namespace Model {
|
|
|
78
78
|
*
|
|
79
79
|
* TODO: Should exclude methods
|
|
80
80
|
**/
|
|
81
|
-
export type Field<T,
|
|
81
|
+
export type Field<T, E extends Model = Model> = Exclude<keyof T, keyof E | keyof Debug<{}>> & string;
|
|
82
82
|
/**
|
|
83
83
|
* Including but not limited to `keyof T` which are not methods or defined by base Model.
|
|
84
84
|
**/
|
|
85
|
-
export type Event<T,
|
|
85
|
+
export type Event<T, E extends Model = Model> = Extends<Field<T, E>>;
|
|
86
86
|
/** Object containing managed entries found in T. */
|
|
87
|
-
export type Entries<T,
|
|
88
|
-
[K in Field<T,
|
|
87
|
+
export type Entries<T, E extends Model = Model> = {
|
|
88
|
+
[K in Field<T, E>]: T[K];
|
|
89
89
|
};
|
|
90
90
|
/** Object comperable to data found in T. */
|
|
91
|
-
export type Compat<T,
|
|
92
|
-
[K in Field<T,
|
|
91
|
+
export type Compat<T, E extends Model = Model> = {
|
|
92
|
+
[K in Field<T, E>]?: T[K];
|
|
93
93
|
};
|
|
94
94
|
/** Actual value stored in state. */
|
|
95
95
|
export type Value<R> = R extends Ref<infer T> ? T : R;
|
|
@@ -103,6 +103,9 @@ declare namespace Model {
|
|
|
103
103
|
export type Values<T, K extends Field<T> = Field<T>> = {
|
|
104
104
|
[P in K]: Value<T[P]>;
|
|
105
105
|
};
|
|
106
|
+
export type Export<T, E extends Model = Model> = {
|
|
107
|
+
[P in Field<T, E>]: Value<T[P]>;
|
|
108
|
+
};
|
|
106
109
|
}
|
|
107
110
|
declare class Model {
|
|
108
111
|
/**
|
|
@@ -124,7 +127,7 @@ declare class Model {
|
|
|
124
127
|
on(current?: boolean): Promise<Model.Event<this>[] | null>;
|
|
125
128
|
on(current: true): Promise<Model.Event<this>[]>;
|
|
126
129
|
on(current: null): Promise<null>;
|
|
127
|
-
export(): Model.
|
|
130
|
+
export(): Model.Export<this>;
|
|
128
131
|
export<P extends Model.Field<this>>(select: Iterable<P>): Model.Values<this, P>;
|
|
129
132
|
update(key: Model.Event<this>): PromiseLike<readonly Model.Event<this>[]>;
|
|
130
133
|
update(key: Model.Event<this>, callMethod: boolean): PromiseLike<readonly Model.Event<this>[]>;
|