j-templates 5.0.45 → 5.0.47
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/DOM/domNodeConfig.d.ts +2 -2
- package/DOM/domNodeConfig.js +82 -82
- package/DOM/elements.d.ts +24 -24
- package/DOM/elements.js +96 -96
- package/DOM/index.d.ts +3 -3
- package/DOM/index.js +19 -19
- package/DOM/svgElements.d.ts +4 -4
- package/DOM/svgElements.js +17 -17
- package/DOM/utils.d.ts +1 -1
- package/DOM/utils.js +47 -47
- package/DOM/window.d.ts +1 -1
- package/DOM/window.js +4 -4
- package/Node/boundNode.d.ts +4 -4
- package/Node/boundNode.js +99 -94
- package/Node/boundNode.types.d.ts +43 -43
- package/Node/boundNode.types.js +2 -2
- package/Node/component.d.ts +34 -34
- package/Node/component.js +80 -80
- package/Node/componentNode.d.ts +7 -7
- package/Node/componentNode.js +115 -115
- package/Node/componentNode.types.d.ts +35 -35
- package/Node/componentNode.types.js +2 -2
- package/Node/elementNode.d.ts +5 -5
- package/Node/elementNode.js +157 -158
- package/Node/elementNode.types.d.ts +34 -34
- package/Node/elementNode.types.js +2 -2
- package/Node/nodeConfig.d.ts +22 -22
- package/Node/nodeConfig.js +5 -5
- package/Node/nodeRef.d.ts +21 -21
- package/Node/nodeRef.js +157 -157
- package/Node/nodeRef.types.d.ts +21 -21
- package/Node/nodeRef.types.js +2 -2
- package/Store/Diff/diffAsync.d.ts +17 -17
- package/Store/Diff/diffAsync.js +36 -36
- package/Store/Diff/diffSync.d.ts +14 -14
- package/Store/Diff/diffSync.js +27 -27
- package/Store/Diff/diffTree.d.ts +24 -24
- package/Store/Diff/diffTree.js +232 -221
- package/Store/Diff/diffWorker.d.ts +3 -3
- package/Store/Diff/diffWorker.js +19 -19
- package/Store/Diff/workerQueue.d.ts +7 -7
- package/Store/Diff/workerQueue.js +35 -35
- package/Store/Store/store.d.ts +14 -14
- package/Store/Store/store.js +31 -31
- package/Store/Store/storeAsync.d.ts +20 -20
- package/Store/Store/storeAsync.js +49 -49
- package/Store/Store/storeAsyncWriter.d.ts +15 -15
- package/Store/Store/storeAsyncWriter.js +52 -52
- package/Store/Store/storeSync.d.ts +15 -15
- package/Store/Store/storeSync.js +33 -33
- package/Store/Store/storeSyncWriter.d.ts +12 -12
- package/Store/Store/storeSyncWriter.js +41 -41
- package/Store/Store/storeWriter.d.ts +9 -9
- package/Store/Store/storeWriter.js +30 -30
- package/Store/Tree/observableScope.d.ts +57 -56
- package/Store/Tree/observableScope.js +168 -164
- package/Store/Tree/observableTree.d.ts +34 -33
- package/Store/Tree/observableTree.js +232 -214
- package/Store/index.d.ts +4 -4
- package/Store/index.js +11 -11
- package/Utils/animation.d.ts +29 -29
- package/Utils/animation.js +108 -108
- package/Utils/asyncQueue.d.ts +8 -8
- package/Utils/asyncQueue.js +42 -42
- package/Utils/decorators.d.ts +37 -37
- package/Utils/decorators.js +310 -300
- package/Utils/emitter.d.ts +12 -12
- package/Utils/emitter.js +24 -24
- package/Utils/index.d.ts +2 -2
- package/Utils/index.js +18 -18
- package/Utils/injector.d.ts +13 -13
- package/Utils/injector.js +38 -38
- package/Utils/list.d.ts +23 -23
- package/Utils/list.js +120 -120
- package/Utils/router.d.ts +23 -23
- package/Utils/router.js +116 -116
- package/Utils/thread.d.ts +16 -16
- package/Utils/thread.js +108 -108
- package/Utils/utils.types.d.ts +3 -3
- package/Utils/utils.types.js +2 -2
- package/index.d.ts +2 -2
- package/index.debug.d.ts +1 -0
- package/index.debug.js +12 -0
- package/index.js +5 -5
- package/jTemplates.js +2676 -2629
- package/jTemplates.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +1 -1
- package/web.export.d.ts +4 -4
- package/web.export.js +24 -24
- package/web.js +5 -5
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import { ObservableScope } from "../Tree/observableScope";
|
|
2
|
-
export declare class ObservableTree {
|
|
3
|
-
private valuePathResolver?;
|
|
4
|
-
private undefinedScope;
|
|
5
|
-
private scopeCache;
|
|
6
|
-
private leafScopeCache;
|
|
7
|
-
private proxyCache;
|
|
8
|
-
private pathCache;
|
|
9
|
-
private rootStateMap;
|
|
10
|
-
constructor(valuePathResolver?: {
|
|
11
|
-
(value: string): string | undefined;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
private
|
|
28
|
-
private
|
|
29
|
-
private
|
|
30
|
-
private
|
|
31
|
-
private
|
|
32
|
-
private
|
|
33
|
-
|
|
1
|
+
import { ObservableScope } from "../Tree/observableScope";
|
|
2
|
+
export declare class ObservableTree {
|
|
3
|
+
private valuePathResolver?;
|
|
4
|
+
private undefinedScope;
|
|
5
|
+
private scopeCache;
|
|
6
|
+
private leafScopeCache;
|
|
7
|
+
private proxyCache;
|
|
8
|
+
private pathCache;
|
|
9
|
+
private rootStateMap;
|
|
10
|
+
constructor(valuePathResolver?: {
|
|
11
|
+
(value: string): string | undefined;
|
|
12
|
+
});
|
|
13
|
+
static UnwrapProxyValues(value: any): any;
|
|
14
|
+
Get<O>(path: string): O;
|
|
15
|
+
GetPathOf(value: any): string;
|
|
16
|
+
Scope<O, R = O>(path: string, callback?: {
|
|
17
|
+
(obj: O): R;
|
|
18
|
+
}): ObservableScope<O | R>;
|
|
19
|
+
Write(path: string, value: any): void;
|
|
20
|
+
WriteAll(data: Array<{
|
|
21
|
+
path: string;
|
|
22
|
+
value: any;
|
|
23
|
+
}>): void;
|
|
24
|
+
private GetParentScope;
|
|
25
|
+
private GetPropertyScope;
|
|
26
|
+
private GetValueProxy;
|
|
27
|
+
private ObjectProxyGetter;
|
|
28
|
+
private CreateObjectProxy;
|
|
29
|
+
private ArrayProxyGetter;
|
|
30
|
+
private CreateArrayProxy;
|
|
31
|
+
private CreateProxy;
|
|
32
|
+
private WritePath;
|
|
33
|
+
private UpdatePathCache;
|
|
34
|
+
}
|
|
@@ -1,214 +1,232 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservableTree = void 0;
|
|
4
|
-
const observableScope_1 = require("../Tree/observableScope");
|
|
5
|
-
var Type;
|
|
6
|
-
(function (Type) {
|
|
7
|
-
Type[Type["Value"] = 0] = "Value";
|
|
8
|
-
Type[Type["Object"] = 1] = "Object";
|
|
9
|
-
Type[Type["Array"] = 2] = "Array";
|
|
10
|
-
})(Type || (Type = {}));
|
|
11
|
-
const jsonConstructor = {}.constructor;
|
|
12
|
-
function TypeOf(value) {
|
|
13
|
-
if (!value)
|
|
14
|
-
return Type.Value;
|
|
15
|
-
if (jsonConstructor === value.constructor)
|
|
16
|
-
return Type.Object;
|
|
17
|
-
if (Array.isArray(value))
|
|
18
|
-
return Type.Array;
|
|
19
|
-
return Type.Value;
|
|
20
|
-
}
|
|
21
|
-
class ObservableTree {
|
|
22
|
-
valuePathResolver;
|
|
23
|
-
undefinedScope = observableScope_1.ObservableScope.Create(function () { return undefined; });
|
|
24
|
-
scopeCache = new WeakMap();
|
|
25
|
-
leafScopeCache = new WeakMap();
|
|
26
|
-
proxyCache = new WeakMap();
|
|
27
|
-
pathCache = new WeakMap();
|
|
28
|
-
rootStateMap = new Map();
|
|
29
|
-
constructor(valuePathResolver) {
|
|
30
|
-
this.valuePathResolver = valuePathResolver;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
this.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return this.scopeCache.get(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservableTree = void 0;
|
|
4
|
+
const observableScope_1 = require("../Tree/observableScope");
|
|
5
|
+
var Type;
|
|
6
|
+
(function (Type) {
|
|
7
|
+
Type[Type["Value"] = 0] = "Value";
|
|
8
|
+
Type[Type["Object"] = 1] = "Object";
|
|
9
|
+
Type[Type["Array"] = 2] = "Array";
|
|
10
|
+
})(Type || (Type = {}));
|
|
11
|
+
const jsonConstructor = {}.constructor;
|
|
12
|
+
function TypeOf(value) {
|
|
13
|
+
if (!value)
|
|
14
|
+
return Type.Value;
|
|
15
|
+
if (jsonConstructor === value.constructor)
|
|
16
|
+
return Type.Object;
|
|
17
|
+
if (Array.isArray(value))
|
|
18
|
+
return Type.Array;
|
|
19
|
+
return Type.Value;
|
|
20
|
+
}
|
|
21
|
+
class ObservableTree {
|
|
22
|
+
valuePathResolver;
|
|
23
|
+
undefinedScope = observableScope_1.ObservableScope.Create(function () { return undefined; });
|
|
24
|
+
scopeCache = new WeakMap();
|
|
25
|
+
leafScopeCache = new WeakMap();
|
|
26
|
+
proxyCache = new WeakMap();
|
|
27
|
+
pathCache = new WeakMap();
|
|
28
|
+
rootStateMap = new Map();
|
|
29
|
+
constructor(valuePathResolver) {
|
|
30
|
+
this.valuePathResolver = valuePathResolver;
|
|
31
|
+
}
|
|
32
|
+
static UnwrapProxyValues(value) {
|
|
33
|
+
if (value?.toJSON && typeof value.toJSON === 'function')
|
|
34
|
+
return value.toJSON();
|
|
35
|
+
const type = TypeOf(value);
|
|
36
|
+
if (type === Type.Value)
|
|
37
|
+
return value;
|
|
38
|
+
if (type === Type.Array) {
|
|
39
|
+
const arr = value;
|
|
40
|
+
for (let x = 0; x < arr.length; x++)
|
|
41
|
+
arr[x] = ObservableTree.UnwrapProxyValues(arr[x]);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const keys = Object.keys(value);
|
|
45
|
+
for (let x = 0; x < keys.length; x++)
|
|
46
|
+
value[keys[x]] = ObservableTree.UnwrapProxyValues(value[keys[x]]);
|
|
47
|
+
}
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
Get(path) {
|
|
51
|
+
const val = path.split(".").reduce((pre, curr, index) => {
|
|
52
|
+
if (index === 0) {
|
|
53
|
+
let value = this.rootStateMap.get(curr);
|
|
54
|
+
const scope = this.GetParentScope(value);
|
|
55
|
+
return observableScope_1.ObservableScope.Value(scope);
|
|
56
|
+
}
|
|
57
|
+
return pre && pre[curr];
|
|
58
|
+
}, null);
|
|
59
|
+
return val;
|
|
60
|
+
}
|
|
61
|
+
GetPathOf(value) {
|
|
62
|
+
if (value.toJSON && typeof value.toJSON === 'function')
|
|
63
|
+
value = value.toJSON();
|
|
64
|
+
return this.pathCache.get(value);
|
|
65
|
+
}
|
|
66
|
+
Scope(path, callback) {
|
|
67
|
+
return new observableScope_1.ObservableScope(() => {
|
|
68
|
+
const obj = this.Get(path);
|
|
69
|
+
return callback && callback(obj) || obj;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
Write(path, value) {
|
|
73
|
+
const scope = this.WritePath(path, value);
|
|
74
|
+
observableScope_1.ObservableScope.Update(scope);
|
|
75
|
+
}
|
|
76
|
+
WriteAll(data) {
|
|
77
|
+
const scopeSet = new Set();
|
|
78
|
+
for (var x = 0; x < data.length; x++) {
|
|
79
|
+
const scope = this.WritePath(data[x].path, data[x].value);
|
|
80
|
+
scopeSet.add(scope);
|
|
81
|
+
}
|
|
82
|
+
scopeSet.forEach(scope => observableScope_1.ObservableScope.Update(scope));
|
|
83
|
+
}
|
|
84
|
+
GetParentScope(value) {
|
|
85
|
+
if (value === undefined)
|
|
86
|
+
return this.undefinedScope;
|
|
87
|
+
let scope = this.scopeCache.get(value);
|
|
88
|
+
if (!scope) {
|
|
89
|
+
scope = observableScope_1.ObservableScope.Create(() => this.GetValueProxy(value));
|
|
90
|
+
this.scopeCache.set(value, scope);
|
|
91
|
+
}
|
|
92
|
+
return scope;
|
|
93
|
+
}
|
|
94
|
+
GetPropertyScope(parent, prop) {
|
|
95
|
+
const value = parent[prop];
|
|
96
|
+
const type = TypeOf(value);
|
|
97
|
+
if (type === Type.Value) {
|
|
98
|
+
let leafScopes = this.leafScopeCache.get(parent) || {};
|
|
99
|
+
leafScopes[prop] = leafScopes[prop] || observableScope_1.ObservableScope.Create(() => {
|
|
100
|
+
const parentScope = this.scopeCache.get(parent);
|
|
101
|
+
const parentValue = observableScope_1.ObservableScope.Value(parentScope);
|
|
102
|
+
const parentJson = parentValue.toJSON();
|
|
103
|
+
const currentValue = parentJson[prop];
|
|
104
|
+
let path;
|
|
105
|
+
if (this.valuePathResolver && typeof currentValue === 'string' && (path = this.valuePathResolver(currentValue)))
|
|
106
|
+
return this.Get(path);
|
|
107
|
+
return currentValue;
|
|
108
|
+
});
|
|
109
|
+
this.leafScopeCache.set(parent, leafScopes);
|
|
110
|
+
return leafScopes[prop];
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
let scope = this.scopeCache.get(value);
|
|
114
|
+
if (!scope) {
|
|
115
|
+
scope = observableScope_1.ObservableScope.Create(() => {
|
|
116
|
+
const parentScope = this.scopeCache.get(parent);
|
|
117
|
+
const parentValue = observableScope_1.ObservableScope.Value(parentScope);
|
|
118
|
+
const parentJson = parentValue.toJSON();
|
|
119
|
+
const currentValue = parentJson[prop];
|
|
120
|
+
return this.GetValueProxy(currentValue);
|
|
121
|
+
});
|
|
122
|
+
this.scopeCache.set(value, scope);
|
|
123
|
+
}
|
|
124
|
+
return scope;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
GetValueProxy(value) {
|
|
128
|
+
let proxy = this.proxyCache.get(value);
|
|
129
|
+
if (!proxy) {
|
|
130
|
+
proxy = this.CreateProxy(value);
|
|
131
|
+
this.proxyCache.set(value, proxy);
|
|
132
|
+
}
|
|
133
|
+
return proxy;
|
|
134
|
+
}
|
|
135
|
+
ObjectProxyGetter = (value, prop) => {
|
|
136
|
+
function toJSON() {
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
;
|
|
140
|
+
switch (prop) {
|
|
141
|
+
case "toJSON":
|
|
142
|
+
return toJSON;
|
|
143
|
+
default:
|
|
144
|
+
if (typeof prop === 'symbol')
|
|
145
|
+
return value[prop];
|
|
146
|
+
return observableScope_1.ObservableScope.Value(this.GetPropertyScope(value, prop));
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
CreateObjectProxy(value) {
|
|
150
|
+
return new Proxy(value, {
|
|
151
|
+
get: this.ObjectProxyGetter
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
ArrayProxyGetter = (value, prop) => {
|
|
155
|
+
function toJSON() {
|
|
156
|
+
return value;
|
|
157
|
+
}
|
|
158
|
+
;
|
|
159
|
+
switch (prop) {
|
|
160
|
+
case "toJSON":
|
|
161
|
+
return toJSON;
|
|
162
|
+
default:
|
|
163
|
+
if (typeof prop === 'symbol')
|
|
164
|
+
return value[prop];
|
|
165
|
+
if (isNaN(parseInt(prop))) {
|
|
166
|
+
const ret = value[prop];
|
|
167
|
+
if (typeof ret === 'function') {
|
|
168
|
+
const copy = value.map((val, index) => observableScope_1.ObservableScope.Value(this.GetPropertyScope(value, index.toString())));
|
|
169
|
+
return ret.bind(copy);
|
|
170
|
+
}
|
|
171
|
+
return ret;
|
|
172
|
+
}
|
|
173
|
+
return observableScope_1.ObservableScope.Value(this.GetPropertyScope(value, prop));
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
CreateArrayProxy(value) {
|
|
177
|
+
return new Proxy(value, {
|
|
178
|
+
get: this.ArrayProxyGetter
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
CreateProxy(value) {
|
|
182
|
+
const type = TypeOf(value);
|
|
183
|
+
switch (type) {
|
|
184
|
+
case Type.Object:
|
|
185
|
+
return this.CreateObjectProxy(value);
|
|
186
|
+
case Type.Array:
|
|
187
|
+
return this.CreateArrayProxy(value);
|
|
188
|
+
default:
|
|
189
|
+
return value;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
WritePath(path, value) {
|
|
193
|
+
this.UpdatePathCache(path, value);
|
|
194
|
+
const pathParts = path.split(".");
|
|
195
|
+
if (pathParts.length === 1) {
|
|
196
|
+
const currentValue = this.rootStateMap.get(pathParts[0]);
|
|
197
|
+
this.rootStateMap.set(pathParts[0], value);
|
|
198
|
+
return currentValue === undefined ? this.undefinedScope : this.scopeCache.get(currentValue);
|
|
199
|
+
}
|
|
200
|
+
let parentValue;
|
|
201
|
+
let x = 0;
|
|
202
|
+
for (; x < pathParts.length - 1 && (x === 0 || parentValue); x++) {
|
|
203
|
+
if (x === 0)
|
|
204
|
+
parentValue = this.rootStateMap.get(pathParts[x]);
|
|
205
|
+
else
|
|
206
|
+
parentValue = parentValue && parentValue[pathParts[x]];
|
|
207
|
+
}
|
|
208
|
+
if (!parentValue)
|
|
209
|
+
throw new Error("Unable to write path: " + path + ". Falsey value found at: " + pathParts.slice(0, x).join("."));
|
|
210
|
+
const prop = pathParts[x];
|
|
211
|
+
const exists = Object.hasOwn(parentValue, prop);
|
|
212
|
+
const oldValue = parentValue[prop];
|
|
213
|
+
const oldType = TypeOf(oldValue);
|
|
214
|
+
parentValue[prop] = value;
|
|
215
|
+
if (oldType !== Type.Value)
|
|
216
|
+
return this.scopeCache.get(oldValue) ||
|
|
217
|
+
this.scopeCache.get(parentValue);
|
|
218
|
+
const leafScopes = exists && this.leafScopeCache.get(parentValue);
|
|
219
|
+
return leafScopes && leafScopes[prop] || this.scopeCache.get(parentValue);
|
|
220
|
+
}
|
|
221
|
+
UpdatePathCache(path, value) {
|
|
222
|
+
const type = TypeOf(value);
|
|
223
|
+
if (type === Type.Value)
|
|
224
|
+
return;
|
|
225
|
+
this.pathCache.set(value, path);
|
|
226
|
+
const keys = Object.keys(value);
|
|
227
|
+
for (let x = 0; x < keys.length; x++)
|
|
228
|
+
this.UpdatePathCache(`${path}.${keys[x]}`, value[keys[x]]);
|
|
229
|
+
return value;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.ObservableTree = ObservableTree;
|
package/Store/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Store } from "./Store/store";
|
|
2
|
-
export { StoreSync } from "./Store/storeSync";
|
|
3
|
-
export { StoreAsync } from "./Store/storeAsync";
|
|
4
|
-
export { ObservableScope } from "./Tree/observableScope";
|
|
1
|
+
export { Store } from "./Store/store";
|
|
2
|
+
export { StoreSync } from "./Store/storeSync";
|
|
3
|
+
export { StoreAsync } from "./Store/storeAsync";
|
|
4
|
+
export { ObservableScope } from "./Tree/observableScope";
|
package/Store/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObservableScope = exports.StoreAsync = exports.StoreSync = exports.Store = void 0;
|
|
4
|
-
var store_1 = require("./Store/store");
|
|
5
|
-
Object.defineProperty(exports, "Store", { enumerable: true, get: function () { return store_1.Store; } });
|
|
6
|
-
var storeSync_1 = require("./Store/storeSync");
|
|
7
|
-
Object.defineProperty(exports, "StoreSync", { enumerable: true, get: function () { return storeSync_1.StoreSync; } });
|
|
8
|
-
var storeAsync_1 = require("./Store/storeAsync");
|
|
9
|
-
Object.defineProperty(exports, "StoreAsync", { enumerable: true, get: function () { return storeAsync_1.StoreAsync; } });
|
|
10
|
-
var observableScope_1 = require("./Tree/observableScope");
|
|
11
|
-
Object.defineProperty(exports, "ObservableScope", { enumerable: true, get: function () { return observableScope_1.ObservableScope; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservableScope = exports.StoreAsync = exports.StoreSync = exports.Store = void 0;
|
|
4
|
+
var store_1 = require("./Store/store");
|
|
5
|
+
Object.defineProperty(exports, "Store", { enumerable: true, get: function () { return store_1.Store; } });
|
|
6
|
+
var storeSync_1 = require("./Store/storeSync");
|
|
7
|
+
Object.defineProperty(exports, "StoreSync", { enumerable: true, get: function () { return storeSync_1.StoreSync; } });
|
|
8
|
+
var storeAsync_1 = require("./Store/storeAsync");
|
|
9
|
+
Object.defineProperty(exports, "StoreAsync", { enumerable: true, get: function () { return storeAsync_1.StoreAsync; } });
|
|
10
|
+
var observableScope_1 = require("./Tree/observableScope");
|
|
11
|
+
Object.defineProperty(exports, "ObservableScope", { enumerable: true, get: function () { return observableScope_1.ObservableScope; } });
|
package/Utils/animation.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { IDestroyable } from "./utils.types";
|
|
2
|
-
export declare enum AnimationType {
|
|
3
|
-
Linear = 0,
|
|
4
|
-
EaseIn = 1
|
|
5
|
-
}
|
|
6
|
-
export declare class Animation implements IDestroyable {
|
|
7
|
-
private type;
|
|
8
|
-
private frameCount;
|
|
9
|
-
private frameTimings;
|
|
10
|
-
private update;
|
|
11
|
-
private animationTimeouts;
|
|
12
|
-
private running;
|
|
13
|
-
private start;
|
|
14
|
-
private end;
|
|
15
|
-
private enabled;
|
|
16
|
-
get Running(): boolean;
|
|
17
|
-
get Start(): number;
|
|
18
|
-
get End(): number;
|
|
19
|
-
get Enabled(): boolean;
|
|
20
|
-
constructor(type: AnimationType, duration: number, update: {
|
|
21
|
-
(next: number): void;
|
|
22
|
-
});
|
|
23
|
-
Animate(start: number, end: number): Promise<void>;
|
|
24
|
-
Disable(): void;
|
|
25
|
-
Enable(): void;
|
|
26
|
-
Cancel(): void;
|
|
27
|
-
Destroy(): void;
|
|
28
|
-
private SetTimeout;
|
|
29
|
-
}
|
|
1
|
+
import { IDestroyable } from "./utils.types";
|
|
2
|
+
export declare enum AnimationType {
|
|
3
|
+
Linear = 0,
|
|
4
|
+
EaseIn = 1
|
|
5
|
+
}
|
|
6
|
+
export declare class Animation implements IDestroyable {
|
|
7
|
+
private type;
|
|
8
|
+
private frameCount;
|
|
9
|
+
private frameTimings;
|
|
10
|
+
private update;
|
|
11
|
+
private animationTimeouts;
|
|
12
|
+
private running;
|
|
13
|
+
private start;
|
|
14
|
+
private end;
|
|
15
|
+
private enabled;
|
|
16
|
+
get Running(): boolean;
|
|
17
|
+
get Start(): number;
|
|
18
|
+
get End(): number;
|
|
19
|
+
get Enabled(): boolean;
|
|
20
|
+
constructor(type: AnimationType, duration: number, update: {
|
|
21
|
+
(next: number): void;
|
|
22
|
+
});
|
|
23
|
+
Animate(start: number, end: number): Promise<void>;
|
|
24
|
+
Disable(): void;
|
|
25
|
+
Enable(): void;
|
|
26
|
+
Cancel(): void;
|
|
27
|
+
Destroy(): void;
|
|
28
|
+
private SetTimeout;
|
|
29
|
+
}
|