@expressive/mvc 0.21.0 → 0.21.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/lib/index.d.ts +3 -19
- package/lib/index.esm.js +6 -6
- package/lib/index.js +5 -6
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
declare namespace Issue {
|
|
2
|
-
type Variable = {} | string | number | boolean | null | undefined;
|
|
3
|
-
type Variables<T> = T extends (...args: infer T) => any ? T : never;
|
|
4
|
-
type Messages = {
|
|
5
|
-
[named: string]: (...args: Variable[]) => string;
|
|
6
|
-
};
|
|
7
|
-
type Output<M extends Messages> = {
|
|
8
|
-
readonly [P in keyof M]: (...args: Variables<M[P]>) => Issue;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
declare class Issue extends Error {
|
|
12
|
-
stack: string;
|
|
13
|
-
warn(): void;
|
|
14
|
-
}
|
|
15
|
-
declare function issues<M extends Issue.Messages>(register: M): Issue.Output<M>;
|
|
16
|
-
|
|
17
1
|
type Async<T = any> = (...args: any[]) => Promise<T>;
|
|
18
2
|
/**
|
|
19
3
|
* Sets an exotic method with managed ready-state. Property accepts an async function.
|
|
@@ -109,7 +93,7 @@ declare class Control<T extends Model = any> {
|
|
|
109
93
|
declare function control<T extends Model>(subject: T, ready: Control.OnReady<T>): Callback;
|
|
110
94
|
declare function control<T extends Model>(subject: T, ready?: boolean): Control<T>;
|
|
111
95
|
declare function watch<T extends Model>(on: T, cb: Observer): T;
|
|
112
|
-
declare function apply<T = any>(instruction: Control.Instruction<
|
|
96
|
+
declare function apply<T = any>(instruction: Control.Instruction<T>): T;
|
|
113
97
|
|
|
114
98
|
declare const STATE = "__state";
|
|
115
99
|
declare const UPDATE = "__update";
|
|
@@ -404,7 +388,7 @@ declare namespace Context {
|
|
|
404
388
|
}
|
|
405
389
|
declare class Context {
|
|
406
390
|
private table;
|
|
407
|
-
private
|
|
391
|
+
private layer;
|
|
408
392
|
private has;
|
|
409
393
|
get<T extends Model>(Type: Model.Type<T>): T | undefined;
|
|
410
394
|
include(inputs: Context.Inputs): Map<Model, boolean>;
|
|
@@ -413,4 +397,4 @@ declare class Context {
|
|
|
413
397
|
pop(): void;
|
|
414
398
|
}
|
|
415
399
|
|
|
416
|
-
export { Context, Control, Debug, Model, Model as default, get,
|
|
400
|
+
export { Context, Control, Debug, Model, Model as default, get, ref, run, set, use };
|
package/lib/index.esm.js
CHANGED
|
@@ -959,7 +959,7 @@ const Oops = issues({
|
|
|
959
959
|
class Context {
|
|
960
960
|
constructor() {
|
|
961
961
|
this.table = new WeakMap();
|
|
962
|
-
this.
|
|
962
|
+
this.layer = new Map();
|
|
963
963
|
}
|
|
964
964
|
has(T) {
|
|
965
965
|
let key = this.table.get(T);
|
|
@@ -979,14 +979,14 @@ class Context {
|
|
|
979
979
|
const init = new Map();
|
|
980
980
|
for (const key in inputs) {
|
|
981
981
|
const input = inputs[key];
|
|
982
|
-
const exists = this.
|
|
982
|
+
const exists = this.layer.get(key);
|
|
983
983
|
if (exists)
|
|
984
984
|
if (exists !== input)
|
|
985
985
|
throw Oops.NewValue(key);
|
|
986
986
|
else
|
|
987
987
|
continue;
|
|
988
988
|
const instance = this.add(input);
|
|
989
|
-
this.
|
|
989
|
+
this.layer.set(key, input);
|
|
990
990
|
init.set(instance, true);
|
|
991
991
|
}
|
|
992
992
|
for (const [model] of init) {
|
|
@@ -1028,7 +1028,7 @@ class Context {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
push() {
|
|
1030
1030
|
const next = create(this);
|
|
1031
|
-
next.
|
|
1031
|
+
next.layer = new Map();
|
|
1032
1032
|
return next;
|
|
1033
1033
|
}
|
|
1034
1034
|
pop() {
|
|
@@ -1041,7 +1041,7 @@ class Context {
|
|
|
1041
1041
|
}
|
|
1042
1042
|
for (const model of items)
|
|
1043
1043
|
model.null();
|
|
1044
|
-
this.
|
|
1044
|
+
this.layer.clear();
|
|
1045
1045
|
}
|
|
1046
1046
|
}
|
|
1047
1047
|
|
|
@@ -1078,4 +1078,4 @@ const Debug = {
|
|
|
1078
1078
|
PARENT
|
|
1079
1079
|
};
|
|
1080
1080
|
|
|
1081
|
-
export { Context, Control, Debug, Model, Model as default, get,
|
|
1081
|
+
export { Context, Control, Debug, Model, Model as default, get, ref, run, set, use };
|
package/lib/index.js
CHANGED
|
@@ -963,7 +963,7 @@ const Oops = issues({
|
|
|
963
963
|
class Context {
|
|
964
964
|
constructor() {
|
|
965
965
|
this.table = new WeakMap();
|
|
966
|
-
this.
|
|
966
|
+
this.layer = new Map();
|
|
967
967
|
}
|
|
968
968
|
has(T) {
|
|
969
969
|
let key = this.table.get(T);
|
|
@@ -983,14 +983,14 @@ class Context {
|
|
|
983
983
|
const init = new Map();
|
|
984
984
|
for (const key in inputs) {
|
|
985
985
|
const input = inputs[key];
|
|
986
|
-
const exists = this.
|
|
986
|
+
const exists = this.layer.get(key);
|
|
987
987
|
if (exists)
|
|
988
988
|
if (exists !== input)
|
|
989
989
|
throw Oops.NewValue(key);
|
|
990
990
|
else
|
|
991
991
|
continue;
|
|
992
992
|
const instance = this.add(input);
|
|
993
|
-
this.
|
|
993
|
+
this.layer.set(key, input);
|
|
994
994
|
init.set(instance, true);
|
|
995
995
|
}
|
|
996
996
|
for (const [model] of init) {
|
|
@@ -1032,7 +1032,7 @@ class Context {
|
|
|
1032
1032
|
}
|
|
1033
1033
|
push() {
|
|
1034
1034
|
const next = create(this);
|
|
1035
|
-
next.
|
|
1035
|
+
next.layer = new Map();
|
|
1036
1036
|
return next;
|
|
1037
1037
|
}
|
|
1038
1038
|
pop() {
|
|
@@ -1045,7 +1045,7 @@ class Context {
|
|
|
1045
1045
|
}
|
|
1046
1046
|
for (const model of items)
|
|
1047
1047
|
model.null();
|
|
1048
|
-
this.
|
|
1048
|
+
this.layer.clear();
|
|
1049
1049
|
}
|
|
1050
1050
|
}
|
|
1051
1051
|
|
|
@@ -1088,7 +1088,6 @@ exports.Debug = Debug;
|
|
|
1088
1088
|
exports.Model = Model;
|
|
1089
1089
|
exports["default"] = Model;
|
|
1090
1090
|
exports.get = get;
|
|
1091
|
-
exports.issues = issues;
|
|
1092
1091
|
exports.ref = ref;
|
|
1093
1092
|
exports.run = run;
|
|
1094
1093
|
exports.set = set;
|
package/package.json
CHANGED