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