@web-atoms/core 2.6.24 → 2.6.26

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 (130) hide show
  1. package/dist/core/XNode.d.ts +1 -13
  2. package/dist/core/XNode.d.ts.map +1 -1
  3. package/dist/core/XNode.js +2 -24
  4. package/dist/core/XNode.js.map +1 -1
  5. package/dist/tsconfig.tsbuildinfo +1 -1
  6. package/dist-esm/App.js +231 -235
  7. package/dist-esm/Atom.js +93 -96
  8. package/dist-esm/MockApp.js +17 -18
  9. package/dist-esm/Pack.js +1 -3
  10. package/dist-esm/core/AtomBinder.js +189 -187
  11. package/dist-esm/core/AtomComponent.js +479 -502
  12. package/dist-esm/core/AtomDispatcher.js +46 -48
  13. package/dist-esm/core/AtomDisposableList.js +24 -25
  14. package/dist-esm/core/AtomEnumerator.js +15 -16
  15. package/dist-esm/core/AtomList.js +193 -192
  16. package/dist-esm/core/AtomLoader.js +229 -215
  17. package/dist-esm/core/AtomMap.js +7 -8
  18. package/dist-esm/core/AtomOnce.js +22 -24
  19. package/dist-esm/core/AtomSelectableList.js +240 -243
  20. package/dist-esm/core/AtomUri.js +70 -72
  21. package/dist-esm/core/AtomWatcher.js +105 -111
  22. package/dist-esm/core/Bind.js +271 -269
  23. package/dist-esm/core/BindableProperty.js +26 -27
  24. package/dist-esm/core/CancelTokenFactory.js +21 -24
  25. package/dist-esm/core/Color.js +1 -2
  26. package/dist-esm/core/Colors.js +545 -231
  27. package/dist-esm/core/Command.js +236 -223
  28. package/dist-esm/core/Defer.js +21 -22
  29. package/dist-esm/core/EventScope.js +96 -88
  30. package/dist-esm/core/ExpressionParser.js +132 -144
  31. package/dist-esm/core/ExtendControl.js +7 -8
  32. package/dist-esm/core/FormattedError.js +7 -8
  33. package/dist-esm/core/FormattedString.js +4 -5
  34. package/dist-esm/core/Hacks.js +41 -42
  35. package/dist-esm/core/IFetchEvent.js +1 -2
  36. package/dist-esm/core/IScreen.js +1 -2
  37. package/dist-esm/core/IValueConverter.js +1 -2
  38. package/dist-esm/core/InheritedProperty.js +61 -63
  39. package/dist-esm/core/InjectProperty.js +12 -13
  40. package/dist-esm/core/KeyValuePairs.js +1 -2
  41. package/dist-esm/core/Markdown.js +14 -17
  42. package/dist-esm/core/MarkdownError.js +6 -7
  43. package/dist-esm/core/PropertyBinding.js +1 -2
  44. package/dist-esm/core/PropertyMap.js +28 -27
  45. package/dist-esm/core/Route.js +149 -148
  46. package/dist-esm/core/SingleInvoker.js +32 -35
  47. package/dist-esm/core/StringHelper.js +49 -51
  48. package/dist-esm/core/TransientDisposable.js +14 -16
  49. package/dist-esm/core/WatchProperty.js +18 -17
  50. package/dist-esm/core/WebImage.js +7 -8
  51. package/dist-esm/core/XNode.d.ts +1 -13
  52. package/dist-esm/core/XNode.d.ts.map +1 -1
  53. package/dist-esm/core/XNode.js +116 -120
  54. package/dist-esm/core/XNode.js.map +1 -1
  55. package/dist-esm/core/sleep.js +21 -24
  56. package/dist-esm/core/types.js +102 -103
  57. package/dist-esm/di/DISingleton.js +7 -5
  58. package/dist-esm/di/DITransient.js +7 -5
  59. package/dist-esm/di/IMockOrInject.js +1 -2
  60. package/dist-esm/di/IServiceProvider.js +1 -2
  61. package/dist-esm/di/Inject.js +67 -67
  62. package/dist-esm/di/Register.js +25 -26
  63. package/dist-esm/di/RegisterScoped.js +4 -3
  64. package/dist-esm/di/RegisterSingleton.js +4 -3
  65. package/dist-esm/di/ServiceCollection.js +38 -37
  66. package/dist-esm/di/ServiceProvider.js +94 -94
  67. package/dist-esm/di/TypeKey.js +13 -12
  68. package/dist-esm/services/BusyIndicatorService.js +7 -11
  69. package/dist-esm/services/CacheService.js +54 -62
  70. package/dist-esm/services/FetchBuilder.js +327 -278
  71. package/dist-esm/services/JsonService.js +118 -116
  72. package/dist-esm/services/MockNavigationService.js +127 -126
  73. package/dist-esm/services/NavigationService.js +95 -102
  74. package/dist-esm/services/ReferenceService.js +30 -33
  75. package/dist-esm/services/http/AjaxOptions.js +1 -3
  76. package/dist-esm/services/http/JsonError.js +16 -15
  77. package/dist-esm/services/http/RestService.js +314 -323
  78. package/dist-esm/style/StyleRule.js +1 -2
  79. package/dist-esm/test.js +0 -1
  80. package/dist-esm/tsconfig.esm.tsbuildinfo +1 -1
  81. package/dist-esm/unit/AtomTest.js +10 -11
  82. package/dist-esm/view-model/Action.js +258 -223
  83. package/dist-esm/view-model/AtomViewModel.js +234 -232
  84. package/dist-esm/view-model/AtomWindowViewModel.js +13 -14
  85. package/dist-esm/view-model/BindableUrlParameter.js +7 -8
  86. package/dist-esm/view-model/Delay.js +21 -25
  87. package/dist-esm/view-model/Disposable.js +28 -29
  88. package/dist-esm/view-model/Load.js +72 -73
  89. package/dist-esm/view-model/Once.js +33 -35
  90. package/dist-esm/view-model/baseTypes.js +4 -5
  91. package/dist-esm/view-model/bindPromise.js +24 -27
  92. package/dist-esm/view-model/bindProperty.js +3 -4
  93. package/dist-esm/view-model/bindUrlParameter.js +39 -43
  94. package/dist-esm/web/controls/AtomComboBox.js +56 -63
  95. package/dist-esm/web/controls/AtomControl.js +485 -490
  96. package/dist-esm/web/controls/AtomGridSplitter.js +57 -50
  97. package/dist-esm/web/controls/AtomGridView.js +230 -222
  98. package/dist-esm/web/controls/AtomItemsControl.js +677 -688
  99. package/dist-esm/web/controls/AtomPage.js +6 -7
  100. package/dist-esm/web/controls/AtomTemplate.js +1 -3
  101. package/dist-esm/web/controls/AtomTemplateControl.js +28 -29
  102. package/dist-esm/web/controls/AtomViewStack.js +19 -20
  103. package/dist-esm/web/core/AtomUI.js +200 -200
  104. package/dist-esm/web/core/Encoder.js +142 -152
  105. package/dist-esm/web/core/HtmlNode.js +141 -139
  106. package/dist-esm/web/images/Busy.js +1 -2
  107. package/dist-esm/web/images/BusyDataUrl.js +2 -869
  108. package/dist-esm/web/images/Button.js +1 -2
  109. package/dist-esm/web/images/ButtonDataUrl.js +2 -30
  110. package/dist-esm/web/images/CloseButton.js +1 -2
  111. package/dist-esm/web/images/CloseButtonDataUrl.js +2 -30
  112. package/dist-esm/web/images/CloseButtonHover.js +1 -2
  113. package/dist-esm/web/images/CloseButtonHoverDataUrl.js +2 -24
  114. package/dist-esm/web/services/LastTarget.js +31 -29
  115. package/dist-esm/web/services/MarkdownService.js +19 -31
  116. package/dist-esm/web/services/NotificationPopup.js +28 -21
  117. package/dist-esm/web/services/PopupService.js +512 -478
  118. package/dist-esm/web/services/PopupWindow.js +266 -247
  119. package/dist-esm/web/styles/AtomAlertWindowStyle.js +39 -40
  120. package/dist-esm/web/styles/AtomFrameStyle.js +15 -16
  121. package/dist-esm/web/styles/AtomNotificationStyle.js +19 -20
  122. package/dist-esm/web/styles/AtomPageLinkStyle.js +11 -12
  123. package/dist-esm/web/styles/AtomPopupStyle.js +9 -10
  124. package/dist-esm/web/styles/AtomStyle.js +61 -64
  125. package/dist-esm/web/styles/AtomStyleSheet.js +50 -51
  126. package/dist-esm/web/styles/AtomWindowStyle.js +116 -117
  127. package/dist-esm/web/styles/IStyleDeclaration.js +1 -2
  128. package/dist-esm/web/styles/StyleBuilder.js +79 -80
  129. package/package.json +1 -1
  130. package/src/core/XNode.ts +12 -38
@@ -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;