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
package/Utils/decorators.js
CHANGED
|
@@ -1,300 +1,310 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PreReq = exports.PreReqTemplate = exports.Destroy = exports.Inject = exports.ComputedAsync = exports.Computed = exports.DestroyScope = exports.Scope = exports.StateAsync = exports.StateSync = exports.State = void 0;
|
|
4
|
-
const store_1 = require("../Store/Store/store");
|
|
5
|
-
const Store_1 = require("../Store");
|
|
6
|
-
const observableScope_1 = require("../Store/Tree/observableScope");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
if (
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
function
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
function
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreReq = exports.PreReqTemplate = exports.Destroy = exports.Inject = exports.ComputedAsync = exports.Computed = exports.DestroyScope = exports.Scope = exports.StateAsync = exports.StateSync = exports.State = void 0;
|
|
4
|
+
const store_1 = require("../Store/Store/store");
|
|
5
|
+
const Store_1 = require("../Store");
|
|
6
|
+
const observableScope_1 = require("../Store/Tree/observableScope");
|
|
7
|
+
const observableTree_1 = require("../Store/Tree/observableTree");
|
|
8
|
+
function State() {
|
|
9
|
+
return StateDecorator;
|
|
10
|
+
}
|
|
11
|
+
exports.State = State;
|
|
12
|
+
function StateDecorator(target, propertyKey) {
|
|
13
|
+
const propKey = `StoreDecorator_${propertyKey}`;
|
|
14
|
+
DestroyDecorator(target, propKey);
|
|
15
|
+
return {
|
|
16
|
+
configurable: false,
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
var map = this.DecoratorMap;
|
|
20
|
+
var store = map.get(propKey);
|
|
21
|
+
const value = store && store.Root.Value;
|
|
22
|
+
if (observableScope_1.ObservableScope.Watching())
|
|
23
|
+
return value;
|
|
24
|
+
return observableTree_1.ObservableTree.UnwrapProxyValues(value);
|
|
25
|
+
},
|
|
26
|
+
set: function (val) {
|
|
27
|
+
var map = this.DecoratorMap;
|
|
28
|
+
var store = map.get(propKey);
|
|
29
|
+
if (!store)
|
|
30
|
+
map.set(propKey, new store_1.Store(val));
|
|
31
|
+
else
|
|
32
|
+
store.Merge(val);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function StateSync() {
|
|
37
|
+
return StateSyncDecorator;
|
|
38
|
+
}
|
|
39
|
+
exports.StateSync = StateSync;
|
|
40
|
+
function StateSyncDecorator(target, propertyKey) {
|
|
41
|
+
const propKey = `StoreSyncDecorator_${propertyKey}`;
|
|
42
|
+
DestroyDecorator(target, propKey);
|
|
43
|
+
return {
|
|
44
|
+
configurable: false,
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
var map = this.DecoratorMap;
|
|
48
|
+
var store = map.get(propKey);
|
|
49
|
+
const value = store && store.Root.Value;
|
|
50
|
+
if (observableScope_1.ObservableScope.Watching())
|
|
51
|
+
return value;
|
|
52
|
+
return observableTree_1.ObservableTree.UnwrapProxyValues(value);
|
|
53
|
+
},
|
|
54
|
+
set: function (val) {
|
|
55
|
+
var map = this.DecoratorMap;
|
|
56
|
+
var store = map.get(propKey);
|
|
57
|
+
if (!store)
|
|
58
|
+
map.set(propKey, new Store_1.StoreSync(val));
|
|
59
|
+
else
|
|
60
|
+
store.Merge(val);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function StateAsync() {
|
|
65
|
+
return StateAsyncDecorator;
|
|
66
|
+
}
|
|
67
|
+
exports.StateAsync = StateAsync;
|
|
68
|
+
function StateAsyncDecorator(target, propertyKey) {
|
|
69
|
+
const propKey = `StoreAsyncDecorator_${propertyKey}`;
|
|
70
|
+
const scopeKey = `StoreAsyncDecorator_Scope_${propertyKey}`;
|
|
71
|
+
DestroyDecorator(target, propKey);
|
|
72
|
+
DestroyDecorator(target, scopeKey);
|
|
73
|
+
return {
|
|
74
|
+
configurable: false,
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function () {
|
|
77
|
+
var map = this.DecoratorMap;
|
|
78
|
+
var scope = map.get(scopeKey);
|
|
79
|
+
const value = scope && scope.Value;
|
|
80
|
+
if (observableScope_1.ObservableScope.Watching())
|
|
81
|
+
return value;
|
|
82
|
+
return observableTree_1.ObservableTree.UnwrapProxyValues(value);
|
|
83
|
+
},
|
|
84
|
+
set: function (val) {
|
|
85
|
+
var map = this.DecoratorMap;
|
|
86
|
+
var store = map.get(propKey);
|
|
87
|
+
if (!store) {
|
|
88
|
+
store = new Store_1.StoreAsync((val) => val.___id, { ___id: "ROOT", data: val });
|
|
89
|
+
map.set(propKey, store);
|
|
90
|
+
map.set(scopeKey, store.Scope("ROOT", val => val.data));
|
|
91
|
+
}
|
|
92
|
+
else
|
|
93
|
+
store.Action("ROOT", async (root, writer) => await writer.Merge(root.data, val));
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function Scope() {
|
|
98
|
+
return ScopeDecorator;
|
|
99
|
+
}
|
|
100
|
+
exports.Scope = Scope;
|
|
101
|
+
function ScopeDecorator(target, propertyKey, descriptor) {
|
|
102
|
+
if (!(descriptor && descriptor.get))
|
|
103
|
+
throw "Scope decorator requires a getter";
|
|
104
|
+
if (descriptor && descriptor.set)
|
|
105
|
+
throw "Scope decorator does not support setters";
|
|
106
|
+
const propKey = `ScopeDecorator_${propertyKey}`;
|
|
107
|
+
DestroyDecorator(target, propKey);
|
|
108
|
+
return {
|
|
109
|
+
configurable: false,
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
var map = this.DecoratorMap;
|
|
113
|
+
var scope = map.get(propKey);
|
|
114
|
+
if (!scope) {
|
|
115
|
+
const getter = descriptor.get.bind(this);
|
|
116
|
+
scope = new observableScope_1.ObservableScope(getter);
|
|
117
|
+
map.set(propKey, scope);
|
|
118
|
+
}
|
|
119
|
+
return scope.Value;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function DestroyScope() {
|
|
124
|
+
return DestroyScopeDecorator;
|
|
125
|
+
}
|
|
126
|
+
exports.DestroyScope = DestroyScope;
|
|
127
|
+
function DestroyScopeDecorator(target, propertyKey, descriptor) {
|
|
128
|
+
if (!(descriptor && descriptor.get))
|
|
129
|
+
throw "Destroy Scope decorator requires a getter";
|
|
130
|
+
if (descriptor && descriptor.set)
|
|
131
|
+
throw "Destroy Scope decorator does not support setters";
|
|
132
|
+
const propKey = `ScopeDecorator_${propertyKey}`;
|
|
133
|
+
DestroyDecorator(target, propKey);
|
|
134
|
+
const valKey = `ScopeDecorator_${propertyKey}_Value`;
|
|
135
|
+
DestroyDecorator(target, valKey);
|
|
136
|
+
return {
|
|
137
|
+
configurable: false,
|
|
138
|
+
enumerable: true,
|
|
139
|
+
get: function () {
|
|
140
|
+
var map = this.DecoratorMap;
|
|
141
|
+
var scope = map.get(propKey);
|
|
142
|
+
if (!scope) {
|
|
143
|
+
const getter = descriptor.get.bind(this);
|
|
144
|
+
scope = new observableScope_1.ObservableScope(getter);
|
|
145
|
+
map.set(propKey, scope);
|
|
146
|
+
scope.Watch(scope => {
|
|
147
|
+
var lastValue = map.get(valKey);
|
|
148
|
+
lastValue && lastValue.Destroy();
|
|
149
|
+
map.set(valKey, scope.Value);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return scope.Value;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function Computed() {
|
|
157
|
+
return ComputedDecorator;
|
|
158
|
+
}
|
|
159
|
+
exports.Computed = Computed;
|
|
160
|
+
function ComputedDecorator(target, propertyKey, descriptor) {
|
|
161
|
+
if (!(descriptor && descriptor.get))
|
|
162
|
+
throw "Computed decorator requires a getter";
|
|
163
|
+
if (descriptor && descriptor.set)
|
|
164
|
+
throw "Computed decorator does not support setters";
|
|
165
|
+
const scopeKey = `ComputedDecorator_Scope_${propertyKey}`;
|
|
166
|
+
const storeKey = `ComputedDecorator_Store_${propertyKey}`;
|
|
167
|
+
DestroyDecorator(target, scopeKey);
|
|
168
|
+
DestroyDecorator(target, storeKey);
|
|
169
|
+
return {
|
|
170
|
+
configurable: false,
|
|
171
|
+
enumerable: true,
|
|
172
|
+
get: function () {
|
|
173
|
+
var map = this.DecoratorMap;
|
|
174
|
+
var store = map.get(storeKey);
|
|
175
|
+
if (!store) {
|
|
176
|
+
const getter = descriptor.get.bind(this);
|
|
177
|
+
const scope = new observableScope_1.ObservableScope(getter);
|
|
178
|
+
store = new Store_1.StoreSync(scope.Value);
|
|
179
|
+
scope.Watch(scope => {
|
|
180
|
+
if (!this.Destroyed)
|
|
181
|
+
store.Write(scope.Value);
|
|
182
|
+
});
|
|
183
|
+
map.set(scopeKey, scope);
|
|
184
|
+
map.set(storeKey, store);
|
|
185
|
+
}
|
|
186
|
+
return store.Root.Value;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function ComputedAsync(idFunc) {
|
|
191
|
+
return ComputedAsyncDecorator.bind(null, idFunc);
|
|
192
|
+
}
|
|
193
|
+
exports.ComputedAsync = ComputedAsync;
|
|
194
|
+
function ComputedAsyncDecorator(idFunc, target, propertyKey, descriptor) {
|
|
195
|
+
if (!(descriptor && descriptor.get))
|
|
196
|
+
throw "ComputedAsync decorator requires a getter";
|
|
197
|
+
if (descriptor && descriptor.set)
|
|
198
|
+
throw "ComputedAsync decorator does not support setters";
|
|
199
|
+
const scopeKey = `ComputedDecorator_Scope_${propertyKey}`;
|
|
200
|
+
const storeKey = `ComputedDecorator_Store_${propertyKey}`;
|
|
201
|
+
const storeScopeKey = `ComputedDecorator_StoreScope_${propertyKey}`;
|
|
202
|
+
DestroyDecorator(target, scopeKey);
|
|
203
|
+
DestroyDecorator(target, storeKey);
|
|
204
|
+
DestroyDecorator(target, storeScopeKey);
|
|
205
|
+
return {
|
|
206
|
+
configurable: false,
|
|
207
|
+
enumerable: true,
|
|
208
|
+
get: function () {
|
|
209
|
+
var map = this.DecoratorMap;
|
|
210
|
+
var storeScope = map.get(storeScopeKey);
|
|
211
|
+
if (!storeScope) {
|
|
212
|
+
const getter = descriptor.get.bind(this);
|
|
213
|
+
const scope = new observableScope_1.ObservableScope(() => {
|
|
214
|
+
var value = getter();
|
|
215
|
+
if (value && typeof value.toJSON === 'function')
|
|
216
|
+
value = value.toJSON();
|
|
217
|
+
return value;
|
|
218
|
+
});
|
|
219
|
+
const store = new Store_1.StoreAsync((val) => val._id, { _id: "ROOT", data: scope.Value });
|
|
220
|
+
scope.Watch(scope => {
|
|
221
|
+
if (!this.Destroyed)
|
|
222
|
+
store.Write({ _id: "ROOT", data: scope.Value });
|
|
223
|
+
});
|
|
224
|
+
storeScope = store.Scope("ROOT", (val) => val.data);
|
|
225
|
+
map.set(storeScopeKey, storeScope);
|
|
226
|
+
map.set(scopeKey, scope);
|
|
227
|
+
map.set(storeKey, store);
|
|
228
|
+
}
|
|
229
|
+
return storeScope.Value;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function Inject(type) {
|
|
234
|
+
return InjectorDecorator.bind(null, type);
|
|
235
|
+
}
|
|
236
|
+
exports.Inject = Inject;
|
|
237
|
+
function InjectorDecorator(type, target, propertyKey, descriptor) {
|
|
238
|
+
return {
|
|
239
|
+
configurable: false,
|
|
240
|
+
enumerable: true,
|
|
241
|
+
get: function () {
|
|
242
|
+
return this.Injector.Get(type);
|
|
243
|
+
},
|
|
244
|
+
set: function (val) {
|
|
245
|
+
this.Injector.Set(type, val);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function Destroy() {
|
|
250
|
+
return DestroyDecorator;
|
|
251
|
+
}
|
|
252
|
+
exports.Destroy = Destroy;
|
|
253
|
+
(function (Destroy) {
|
|
254
|
+
function Get(value) {
|
|
255
|
+
return value && value.DestroyDecorator_Destroys || [];
|
|
256
|
+
}
|
|
257
|
+
function All(value) {
|
|
258
|
+
var arr = Get(value);
|
|
259
|
+
arr.map(prop => (value[prop] || value.DecoratorMap.get(prop)))
|
|
260
|
+
.filter(o => !!o)
|
|
261
|
+
.forEach(o => o.Destroy());
|
|
262
|
+
}
|
|
263
|
+
Destroy.All = All;
|
|
264
|
+
})(Destroy || (exports.Destroy = Destroy = {}));
|
|
265
|
+
function DestroyDecorator(target, propertyKey) {
|
|
266
|
+
var proto = target;
|
|
267
|
+
proto.DestroyDecorator_Destroys = proto.DestroyDecorator_Destroys || [];
|
|
268
|
+
proto.DestroyDecorator_Destroys.push(propertyKey);
|
|
269
|
+
}
|
|
270
|
+
function PreReqTemplate(template) {
|
|
271
|
+
return PreReqTemplateDecorator.bind(null, template);
|
|
272
|
+
}
|
|
273
|
+
exports.PreReqTemplate = PreReqTemplate;
|
|
274
|
+
(function (PreReqTemplate) {
|
|
275
|
+
function Get(value) {
|
|
276
|
+
var func = value && value.PreReqTemplateDecorator_Template;
|
|
277
|
+
var ret = func ? func() : [];
|
|
278
|
+
if (!Array.isArray(ret))
|
|
279
|
+
ret = [ret];
|
|
280
|
+
return ret;
|
|
281
|
+
}
|
|
282
|
+
PreReqTemplate.Get = Get;
|
|
283
|
+
})(PreReqTemplate || (exports.PreReqTemplate = PreReqTemplate = {}));
|
|
284
|
+
function PreReqTemplateDecorator(template, target) {
|
|
285
|
+
var proto = target.prototype;
|
|
286
|
+
proto.PreReqTemplateDecorator_Template = template;
|
|
287
|
+
}
|
|
288
|
+
function PreReq() {
|
|
289
|
+
return PreReqDecorator;
|
|
290
|
+
}
|
|
291
|
+
exports.PreReq = PreReq;
|
|
292
|
+
(function (PreReq) {
|
|
293
|
+
function Get(value) {
|
|
294
|
+
return value && value.PreReqDecorator_PreReqs || [];
|
|
295
|
+
}
|
|
296
|
+
function All(value) {
|
|
297
|
+
var arr = Get(value).map((prop) => (value[prop] && value[prop].Init) || Promise.resolve());
|
|
298
|
+
return Promise.all(arr);
|
|
299
|
+
}
|
|
300
|
+
PreReq.All = All;
|
|
301
|
+
function Has(value) {
|
|
302
|
+
return Get(value).length > 0;
|
|
303
|
+
}
|
|
304
|
+
PreReq.Has = Has;
|
|
305
|
+
})(PreReq || (exports.PreReq = PreReq = {}));
|
|
306
|
+
function PreReqDecorator(target, propertyKey) {
|
|
307
|
+
var proto = target;
|
|
308
|
+
proto.PreReqDecorator_PreReqs = proto.PreReqDecorator_PreReqs || [];
|
|
309
|
+
proto.PreReqDecorator_PreReqs.push(propertyKey);
|
|
310
|
+
}
|
package/Utils/emitter.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export type EmitterCallback = {
|
|
2
|
-
(...args: any[]): void;
|
|
3
|
-
};
|
|
4
|
-
export type Emitter = Set<{
|
|
5
|
-
(...args: any[]): void;
|
|
6
|
-
}>;
|
|
7
|
-
export declare namespace Emitter {
|
|
8
|
-
function Create(): Emitter;
|
|
9
|
-
function On(emitter: Emitter, callback: EmitterCallback): void;
|
|
10
|
-
function Emit(emitter: Emitter, ...args: any[]): void;
|
|
11
|
-
function Remove(emitter: Emitter, callback: EmitterCallback): void;
|
|
12
|
-
}
|
|
1
|
+
export type EmitterCallback = {
|
|
2
|
+
(...args: any[]): void;
|
|
3
|
+
};
|
|
4
|
+
export type Emitter = Set<{
|
|
5
|
+
(...args: any[]): void;
|
|
6
|
+
}>;
|
|
7
|
+
export declare namespace Emitter {
|
|
8
|
+
function Create(): Emitter;
|
|
9
|
+
function On(emitter: Emitter, callback: EmitterCallback): void;
|
|
10
|
+
function Emit(emitter: Emitter, ...args: any[]): void;
|
|
11
|
+
function Remove(emitter: Emitter, callback: EmitterCallback): void;
|
|
12
|
+
}
|