@web-atoms/core 2.6.21 → 2.6.25
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/App.d.ts +1 -1
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js.map +1 -1
- package/dist/core/SingleInvoker.d.ts.map +1 -1
- package/dist/core/SingleInvoker.js.map +1 -1
- package/dist/core/sleep.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist-esm/App.d.ts +1 -1
- package/dist-esm/App.d.ts.map +1 -1
- package/dist-esm/App.js +231 -235
- package/dist-esm/App.js.map +1 -1
- package/dist-esm/Atom.js +93 -96
- package/dist-esm/MockApp.js +17 -18
- package/dist-esm/Pack.js +1 -3
- package/dist-esm/core/AtomBinder.js +189 -187
- package/dist-esm/core/AtomComponent.js +479 -502
- package/dist-esm/core/AtomDispatcher.js +46 -48
- package/dist-esm/core/AtomDisposableList.js +24 -25
- package/dist-esm/core/AtomEnumerator.js +15 -16
- package/dist-esm/core/AtomList.js +193 -192
- package/dist-esm/core/AtomLoader.js +229 -215
- package/dist-esm/core/AtomMap.js +7 -8
- package/dist-esm/core/AtomOnce.js +22 -24
- package/dist-esm/core/AtomSelectableList.js +240 -243
- package/dist-esm/core/AtomUri.js +70 -72
- package/dist-esm/core/AtomWatcher.js +105 -111
- package/dist-esm/core/Bind.js +271 -269
- package/dist-esm/core/BindableProperty.js +26 -27
- package/dist-esm/core/CancelTokenFactory.js +21 -24
- package/dist-esm/core/Color.js +1 -2
- package/dist-esm/core/Colors.js +545 -231
- package/dist-esm/core/Command.js +236 -223
- package/dist-esm/core/Defer.js +21 -22
- package/dist-esm/core/EventScope.js +96 -88
- package/dist-esm/core/ExpressionParser.js +132 -144
- package/dist-esm/core/ExtendControl.js +7 -8
- package/dist-esm/core/FormattedError.js +7 -8
- package/dist-esm/core/FormattedString.js +4 -5
- package/dist-esm/core/Hacks.js +41 -42
- package/dist-esm/core/IFetchEvent.js +1 -2
- package/dist-esm/core/IScreen.js +1 -2
- package/dist-esm/core/IValueConverter.js +1 -2
- package/dist-esm/core/InheritedProperty.js +61 -63
- package/dist-esm/core/InjectProperty.js +12 -13
- package/dist-esm/core/KeyValuePairs.js +1 -2
- package/dist-esm/core/Markdown.js +14 -17
- package/dist-esm/core/MarkdownError.js +6 -7
- package/dist-esm/core/PropertyBinding.js +1 -2
- package/dist-esm/core/PropertyMap.js +28 -27
- package/dist-esm/core/Route.js +149 -148
- package/dist-esm/core/SingleInvoker.d.ts.map +1 -1
- package/dist-esm/core/SingleInvoker.js +32 -35
- package/dist-esm/core/SingleInvoker.js.map +1 -1
- package/dist-esm/core/StringHelper.js +49 -51
- package/dist-esm/core/TransientDisposable.js +14 -16
- package/dist-esm/core/WatchProperty.js +18 -17
- package/dist-esm/core/WebImage.js +7 -8
- package/dist-esm/core/XNode.js +134 -117
- package/dist-esm/core/sleep.js +21 -24
- package/dist-esm/core/sleep.js.map +1 -1
- package/dist-esm/core/types.js +102 -103
- package/dist-esm/di/DISingleton.js +7 -5
- package/dist-esm/di/DITransient.js +7 -5
- package/dist-esm/di/IMockOrInject.js +1 -2
- package/dist-esm/di/IServiceProvider.js +1 -2
- package/dist-esm/di/Inject.js +67 -67
- package/dist-esm/di/Register.js +25 -26
- package/dist-esm/di/RegisterScoped.js +4 -3
- package/dist-esm/di/RegisterSingleton.js +4 -3
- package/dist-esm/di/ServiceCollection.js +38 -37
- package/dist-esm/di/ServiceProvider.js +94 -94
- package/dist-esm/di/TypeKey.js +13 -12
- package/dist-esm/services/BusyIndicatorService.js +7 -11
- package/dist-esm/services/CacheService.js +54 -62
- package/dist-esm/services/FetchBuilder.js +327 -278
- package/dist-esm/services/JsonService.js +118 -116
- package/dist-esm/services/MockNavigationService.js +127 -126
- package/dist-esm/services/NavigationService.js +95 -102
- package/dist-esm/services/ReferenceService.js +30 -33
- package/dist-esm/services/http/AjaxOptions.js +1 -3
- package/dist-esm/services/http/JsonError.js +16 -15
- package/dist-esm/services/http/RestService.js +314 -323
- package/dist-esm/style/StyleRule.js +1 -2
- package/dist-esm/test.js +0 -1
- package/dist-esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist-esm/unit/AtomTest.js +10 -11
- package/dist-esm/view-model/Action.js +258 -223
- package/dist-esm/view-model/AtomViewModel.js +234 -232
- package/dist-esm/view-model/AtomWindowViewModel.js +13 -14
- package/dist-esm/view-model/BindableUrlParameter.js +7 -8
- package/dist-esm/view-model/Delay.js +21 -25
- package/dist-esm/view-model/Disposable.js +28 -29
- package/dist-esm/view-model/Load.js +72 -73
- package/dist-esm/view-model/Once.js +33 -35
- package/dist-esm/view-model/baseTypes.js +4 -5
- package/dist-esm/view-model/bindPromise.js +24 -27
- package/dist-esm/view-model/bindProperty.js +3 -4
- package/dist-esm/view-model/bindUrlParameter.js +39 -43
- package/dist-esm/web/controls/AtomComboBox.js +56 -63
- package/dist-esm/web/controls/AtomControl.js +485 -490
- package/dist-esm/web/controls/AtomGridSplitter.js +57 -50
- package/dist-esm/web/controls/AtomGridView.js +230 -222
- package/dist-esm/web/controls/AtomItemsControl.js +677 -688
- package/dist-esm/web/controls/AtomPage.js +6 -7
- package/dist-esm/web/controls/AtomTemplate.js +1 -3
- package/dist-esm/web/controls/AtomTemplateControl.js +28 -29
- package/dist-esm/web/controls/AtomViewStack.js +19 -20
- package/dist-esm/web/core/AtomUI.js +200 -200
- package/dist-esm/web/core/Encoder.js +142 -152
- package/dist-esm/web/core/HtmlNode.js +141 -139
- package/dist-esm/web/images/Busy.js +1 -2
- package/dist-esm/web/images/BusyDataUrl.js +2 -869
- package/dist-esm/web/images/Button.js +1 -2
- package/dist-esm/web/images/ButtonDataUrl.js +2 -30
- package/dist-esm/web/images/CloseButton.js +1 -2
- package/dist-esm/web/images/CloseButtonDataUrl.js +2 -30
- package/dist-esm/web/images/CloseButtonHover.js +1 -2
- package/dist-esm/web/images/CloseButtonHoverDataUrl.js +2 -24
- package/dist-esm/web/services/LastTarget.js +31 -29
- package/dist-esm/web/services/MarkdownService.js +19 -31
- package/dist-esm/web/services/NotificationPopup.js +28 -21
- package/dist-esm/web/services/PopupService.js +512 -478
- package/dist-esm/web/services/PopupWindow.js +266 -247
- package/dist-esm/web/styles/AtomAlertWindowStyle.js +39 -40
- package/dist-esm/web/styles/AtomFrameStyle.js +15 -16
- package/dist-esm/web/styles/AtomNotificationStyle.js +19 -20
- package/dist-esm/web/styles/AtomPageLinkStyle.js +11 -12
- package/dist-esm/web/styles/AtomPopupStyle.js +9 -10
- package/dist-esm/web/styles/AtomStyle.js +61 -64
- package/dist-esm/web/styles/AtomStyleSheet.js +50 -51
- package/dist-esm/web/styles/AtomWindowStyle.js +116 -117
- package/dist-esm/web/styles/IStyleDeclaration.js +1 -2
- package/dist-esm/web/styles/StyleBuilder.js +79 -80
- package/package.json +3 -1
- package/src/App.ts +1 -1
- package/src/core/SingleInvoker.ts +1 -1
- package/src/core/sleep.ts +1 -1
|
@@ -3,109 +3,109 @@ import { InjectedTypes } from "./Inject.js";
|
|
|
3
3
|
import { Scope, ServiceCollection } from "./ServiceCollection.js";
|
|
4
4
|
import { TypeKey } from "./TypeKey.js";
|
|
5
5
|
export class ServiceProvider {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
static {
|
|
7
|
+
this.mappedTypes = new Map();
|
|
8
|
+
}
|
|
9
|
+
get global() {
|
|
10
|
+
return this.parent === null ? this : this.parent.global;
|
|
11
|
+
}
|
|
12
|
+
constructor(parent) {
|
|
13
|
+
this.parent = parent;
|
|
14
|
+
this.instances = new Map();
|
|
15
|
+
if (parent === null) {
|
|
16
|
+
ServiceCollection.instance.registerScoped(ServiceProvider);
|
|
9
17
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
const sd = ServiceCollection.instance.get(ServiceProvider);
|
|
19
|
+
this.instances.set(sd.id, this);
|
|
20
|
+
}
|
|
21
|
+
get(key) {
|
|
22
|
+
return this.resolve(key, true);
|
|
23
|
+
}
|
|
24
|
+
put(key, value) {
|
|
25
|
+
let sd = ServiceCollection.instance.get(key);
|
|
26
|
+
if (!sd) {
|
|
27
|
+
sd = ServiceCollection.instance.register(key, () => value, Scope.Global);
|
|
28
|
+
}
|
|
29
|
+
this.instances.set(sd.id, value);
|
|
30
|
+
}
|
|
31
|
+
resolve(key, create = false, defValue) {
|
|
32
|
+
const sd = ServiceCollection.instance.get(key);
|
|
33
|
+
if (!sd) {
|
|
34
|
+
if (!create) {
|
|
35
|
+
if (defValue !== undefined) {
|
|
36
|
+
return defValue;
|
|
15
37
|
}
|
|
16
|
-
|
|
17
|
-
|
|
38
|
+
throw new Error(`No service registered for type ${key}`);
|
|
39
|
+
}
|
|
40
|
+
return this.create(key);
|
|
18
41
|
}
|
|
19
|
-
|
|
20
|
-
|
|
42
|
+
if (sd.type === ServiceProvider) {
|
|
43
|
+
return this;
|
|
21
44
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!sd) {
|
|
25
|
-
sd = ServiceCollection.instance.register(key, () => value, Scope.Global);
|
|
26
|
-
}
|
|
27
|
-
this.instances.set(sd.id, value);
|
|
45
|
+
if (sd.scope === Scope.Global) {
|
|
46
|
+
return this.global.getValue(sd);
|
|
28
47
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (defValue !== undefined) {
|
|
34
|
-
return defValue;
|
|
35
|
-
}
|
|
36
|
-
throw new Error(`No service registered for type ${key}`);
|
|
37
|
-
}
|
|
38
|
-
return this.create(key);
|
|
39
|
-
}
|
|
40
|
-
if (sd.type === ServiceProvider) {
|
|
41
|
-
return this;
|
|
42
|
-
}
|
|
43
|
-
if (sd.scope === Scope.Global) {
|
|
44
|
-
return this.global.getValue(sd);
|
|
45
|
-
}
|
|
46
|
-
if (sd.scope === Scope.Scoped) {
|
|
47
|
-
if (this.parent === null) {
|
|
48
|
-
throw new Error("Scoped dependency cannot be created on global");
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return this.getValue(sd);
|
|
48
|
+
if (sd.scope === Scope.Scoped) {
|
|
49
|
+
if (this.parent === null) {
|
|
50
|
+
throw new Error("Scoped dependency cannot be created on global");
|
|
51
|
+
}
|
|
52
52
|
}
|
|
53
|
-
getValue(sd)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (v === void 0) {
|
|
59
|
-
v = sd.factory(this);
|
|
60
|
-
this.instances.set(sd.id, v);
|
|
61
|
-
}
|
|
62
|
-
return v;
|
|
53
|
+
return this.getValue(sd);
|
|
54
|
+
}
|
|
55
|
+
getValue(sd) {
|
|
56
|
+
if (sd.scope === Scope.Transient) {
|
|
57
|
+
return sd.factory(this);
|
|
63
58
|
}
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
let v = this.instances.get(sd.id);
|
|
60
|
+
if (v === void 0) {
|
|
61
|
+
v = sd.factory(this);
|
|
62
|
+
this.instances.set(sd.id, v);
|
|
66
63
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
return v;
|
|
65
|
+
}
|
|
66
|
+
newScope() {
|
|
67
|
+
return new ServiceProvider(this);
|
|
68
|
+
}
|
|
69
|
+
dispose() {
|
|
70
|
+
for (const element of this.instances.values()) {
|
|
71
|
+
if (element === this) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
element.dispose?.();
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
76
|
+
this.instances.clear();
|
|
77
|
+
}
|
|
78
|
+
create(key) {
|
|
79
|
+
const originalKey = key;
|
|
80
|
+
const originalTypeKey = TypeKey.get(originalKey);
|
|
81
|
+
const typeKey1 = TypeKey.get(key);
|
|
82
|
+
const plist = InjectedTypes.getParamList(key, typeKey1);
|
|
83
|
+
let value = null;
|
|
84
|
+
if (plist) {
|
|
85
|
+
const pv = plist.map(x => x ? this.resolve(x) : void 0);
|
|
86
|
+
pv.unshift(null);
|
|
87
|
+
value = new (key.bind.apply(key, pv))();
|
|
88
|
+
for (const iterator of pv) {
|
|
89
|
+
if (iterator && iterator instanceof TransientDisposable) {
|
|
90
|
+
iterator.registerIn(value);
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
value = new key();
|
|
95
|
+
}
|
|
96
|
+
const propList = InjectedTypes.getPropertyList(key, typeKey1);
|
|
97
|
+
if (propList) {
|
|
98
|
+
for (const key1 in propList) {
|
|
99
|
+
if (propList.hasOwnProperty(key1)) {
|
|
100
|
+
const element = propList[key1];
|
|
101
|
+
const d = this.resolve(element);
|
|
102
|
+
value[key1] = d;
|
|
103
|
+
if (d && d instanceof TransientDisposable) {
|
|
104
|
+
d.registerIn(value);
|
|
105
|
+
}
|
|
107
106
|
}
|
|
108
|
-
|
|
107
|
+
}
|
|
109
108
|
}
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
111
|
+
}
|
package/dist-esm/di/TypeKey.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import AtomMap from "../core/AtomMap.js";
|
|
2
2
|
export class TypeKey {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
static get(c) {
|
|
4
|
+
return c;
|
|
5
|
+
}
|
|
6
|
+
static getName(c) {
|
|
7
|
+
return TypeKey.keys.getOrCreate(c, c1 => {
|
|
8
|
+
const key = `${c1.name || "key"}${TypeKey.keys.size}`;
|
|
9
|
+
return key;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
static {
|
|
13
|
+
this.keys = new AtomMap();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { RegisterSingleton } from "../di/RegisterSingleton.js";
|
|
3
3
|
let BusyIndicatorService = class BusyIndicatorService {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
4
|
+
createIndicator(info) {
|
|
5
|
+
return {
|
|
6
|
+
[Symbol.dispose]() {}
|
|
7
|
+
};
|
|
8
|
+
}
|
|
10
9
|
};
|
|
11
|
-
BusyIndicatorService = __decorate([
|
|
12
|
-
|
|
13
|
-
], BusyIndicatorService);
|
|
14
|
-
export { BusyIndicatorService };
|
|
15
|
-
//# sourceMappingURL=BusyIndicatorService.js.map
|
|
10
|
+
BusyIndicatorService = __decorate([RegisterSingleton], BusyIndicatorService);
|
|
11
|
+
export { BusyIndicatorService };
|
|
@@ -3,70 +3,62 @@ import { App } from "../App.js";
|
|
|
3
3
|
import DISingleton from "../di/DISingleton.js";
|
|
4
4
|
import { Inject } from "../di/Inject.js";
|
|
5
5
|
let CacheService = class CacheService {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
constructor(app) {
|
|
7
|
+
this.app = app;
|
|
8
|
+
this.cache = {};
|
|
9
|
+
}
|
|
10
|
+
remove(key) {
|
|
11
|
+
const v = this.cache[key];
|
|
12
|
+
if (v) {
|
|
13
|
+
this.clear(v);
|
|
14
|
+
return v.value;
|
|
9
15
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
async getOrCreate(key, task) {
|
|
19
|
+
const c = this.cache[key] || (this.cache[key] = {
|
|
20
|
+
key,
|
|
21
|
+
finalTTL: 3600
|
|
22
|
+
});
|
|
23
|
+
if (!c.value) {
|
|
24
|
+
c.value = task(c);
|
|
17
25
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
c.value = task(c);
|
|
25
|
-
}
|
|
26
|
-
let v = null;
|
|
27
|
-
try {
|
|
28
|
-
v = await c.value;
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
this.clear(c);
|
|
32
|
-
throw e;
|
|
33
|
-
}
|
|
34
|
-
if (c.ttlSeconds !== undefined) {
|
|
35
|
-
if (typeof c.ttlSeconds === "number") {
|
|
36
|
-
c.finalTTL = c.ttlSeconds;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
c.finalTTL = c.ttlSeconds(v);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (c.timeout) {
|
|
43
|
-
clearTimeout(c.timeout);
|
|
44
|
-
}
|
|
45
|
-
if (c.finalTTL) {
|
|
46
|
-
this.cache[key] = c;
|
|
47
|
-
c.timeout = setTimeout(() => {
|
|
48
|
-
c.timeout = 0;
|
|
49
|
-
this.clear(c);
|
|
50
|
-
}, c.finalTTL * 1000);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
this.clear(c);
|
|
54
|
-
}
|
|
55
|
-
return await c.value;
|
|
26
|
+
let v = null;
|
|
27
|
+
try {
|
|
28
|
+
v = await c.value;
|
|
29
|
+
} catch (e) {
|
|
30
|
+
this.clear(c);
|
|
31
|
+
throw e;
|
|
56
32
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
delete this.cache[ci.key];
|
|
33
|
+
if (c.ttlSeconds !== undefined) {
|
|
34
|
+
if (typeof c.ttlSeconds === "number") {
|
|
35
|
+
c.finalTTL = c.ttlSeconds;
|
|
36
|
+
} else {
|
|
37
|
+
c.finalTTL = c.ttlSeconds(v);
|
|
38
|
+
}
|
|
64
39
|
}
|
|
40
|
+
if (c.timeout) {
|
|
41
|
+
clearTimeout(c.timeout);
|
|
42
|
+
}
|
|
43
|
+
if (c.finalTTL) {
|
|
44
|
+
this.cache[key] = c;
|
|
45
|
+
c.timeout = setTimeout(() => {
|
|
46
|
+
c.timeout = 0;
|
|
47
|
+
this.clear(c);
|
|
48
|
+
}, c.finalTTL * 1000);
|
|
49
|
+
} else {
|
|
50
|
+
this.clear(c);
|
|
51
|
+
}
|
|
52
|
+
return await c.value;
|
|
53
|
+
}
|
|
54
|
+
clear(ci) {
|
|
55
|
+
if (ci.timeout) {
|
|
56
|
+
clearTimeout(ci.timeout);
|
|
57
|
+
ci.timeout = 0;
|
|
58
|
+
}
|
|
59
|
+
this.cache[ci.key] = null;
|
|
60
|
+
delete this.cache[ci.key];
|
|
61
|
+
}
|
|
65
62
|
};
|
|
66
|
-
CacheService = __decorate([
|
|
67
|
-
|
|
68
|
-
__param(0, Inject),
|
|
69
|
-
__metadata("design:paramtypes", [App])
|
|
70
|
-
], CacheService);
|
|
71
|
-
export default CacheService;
|
|
72
|
-
//# sourceMappingURL=CacheService.js.map
|
|
63
|
+
CacheService = __decorate([DISingleton(), __param(0, Inject), __metadata("design:paramtypes", [App])], CacheService);
|
|
64
|
+
export default CacheService;
|