@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.
Files changed (137) hide show
  1. package/dist/App.d.ts +1 -1
  2. package/dist/App.d.ts.map +1 -1
  3. package/dist/App.js.map +1 -1
  4. package/dist/core/SingleInvoker.d.ts.map +1 -1
  5. package/dist/core/SingleInvoker.js.map +1 -1
  6. package/dist/core/sleep.js.map +1 -1
  7. package/dist/tsconfig.tsbuildinfo +1 -1
  8. package/dist-esm/App.d.ts +1 -1
  9. package/dist-esm/App.d.ts.map +1 -1
  10. package/dist-esm/App.js +231 -235
  11. package/dist-esm/App.js.map +1 -1
  12. package/dist-esm/Atom.js +93 -96
  13. package/dist-esm/MockApp.js +17 -18
  14. package/dist-esm/Pack.js +1 -3
  15. package/dist-esm/core/AtomBinder.js +189 -187
  16. package/dist-esm/core/AtomComponent.js +479 -502
  17. package/dist-esm/core/AtomDispatcher.js +46 -48
  18. package/dist-esm/core/AtomDisposableList.js +24 -25
  19. package/dist-esm/core/AtomEnumerator.js +15 -16
  20. package/dist-esm/core/AtomList.js +193 -192
  21. package/dist-esm/core/AtomLoader.js +229 -215
  22. package/dist-esm/core/AtomMap.js +7 -8
  23. package/dist-esm/core/AtomOnce.js +22 -24
  24. package/dist-esm/core/AtomSelectableList.js +240 -243
  25. package/dist-esm/core/AtomUri.js +70 -72
  26. package/dist-esm/core/AtomWatcher.js +105 -111
  27. package/dist-esm/core/Bind.js +271 -269
  28. package/dist-esm/core/BindableProperty.js +26 -27
  29. package/dist-esm/core/CancelTokenFactory.js +21 -24
  30. package/dist-esm/core/Color.js +1 -2
  31. package/dist-esm/core/Colors.js +545 -231
  32. package/dist-esm/core/Command.js +236 -223
  33. package/dist-esm/core/Defer.js +21 -22
  34. package/dist-esm/core/EventScope.js +96 -88
  35. package/dist-esm/core/ExpressionParser.js +132 -144
  36. package/dist-esm/core/ExtendControl.js +7 -8
  37. package/dist-esm/core/FormattedError.js +7 -8
  38. package/dist-esm/core/FormattedString.js +4 -5
  39. package/dist-esm/core/Hacks.js +41 -42
  40. package/dist-esm/core/IFetchEvent.js +1 -2
  41. package/dist-esm/core/IScreen.js +1 -2
  42. package/dist-esm/core/IValueConverter.js +1 -2
  43. package/dist-esm/core/InheritedProperty.js +61 -63
  44. package/dist-esm/core/InjectProperty.js +12 -13
  45. package/dist-esm/core/KeyValuePairs.js +1 -2
  46. package/dist-esm/core/Markdown.js +14 -17
  47. package/dist-esm/core/MarkdownError.js +6 -7
  48. package/dist-esm/core/PropertyBinding.js +1 -2
  49. package/dist-esm/core/PropertyMap.js +28 -27
  50. package/dist-esm/core/Route.js +149 -148
  51. package/dist-esm/core/SingleInvoker.d.ts.map +1 -1
  52. package/dist-esm/core/SingleInvoker.js +32 -35
  53. package/dist-esm/core/SingleInvoker.js.map +1 -1
  54. package/dist-esm/core/StringHelper.js +49 -51
  55. package/dist-esm/core/TransientDisposable.js +14 -16
  56. package/dist-esm/core/WatchProperty.js +18 -17
  57. package/dist-esm/core/WebImage.js +7 -8
  58. package/dist-esm/core/XNode.js +134 -117
  59. package/dist-esm/core/sleep.js +21 -24
  60. package/dist-esm/core/sleep.js.map +1 -1
  61. package/dist-esm/core/types.js +102 -103
  62. package/dist-esm/di/DISingleton.js +7 -5
  63. package/dist-esm/di/DITransient.js +7 -5
  64. package/dist-esm/di/IMockOrInject.js +1 -2
  65. package/dist-esm/di/IServiceProvider.js +1 -2
  66. package/dist-esm/di/Inject.js +67 -67
  67. package/dist-esm/di/Register.js +25 -26
  68. package/dist-esm/di/RegisterScoped.js +4 -3
  69. package/dist-esm/di/RegisterSingleton.js +4 -3
  70. package/dist-esm/di/ServiceCollection.js +38 -37
  71. package/dist-esm/di/ServiceProvider.js +94 -94
  72. package/dist-esm/di/TypeKey.js +13 -12
  73. package/dist-esm/services/BusyIndicatorService.js +7 -11
  74. package/dist-esm/services/CacheService.js +54 -62
  75. package/dist-esm/services/FetchBuilder.js +327 -278
  76. package/dist-esm/services/JsonService.js +118 -116
  77. package/dist-esm/services/MockNavigationService.js +127 -126
  78. package/dist-esm/services/NavigationService.js +95 -102
  79. package/dist-esm/services/ReferenceService.js +30 -33
  80. package/dist-esm/services/http/AjaxOptions.js +1 -3
  81. package/dist-esm/services/http/JsonError.js +16 -15
  82. package/dist-esm/services/http/RestService.js +314 -323
  83. package/dist-esm/style/StyleRule.js +1 -2
  84. package/dist-esm/test.js +0 -1
  85. package/dist-esm/tsconfig.esm.tsbuildinfo +1 -1
  86. package/dist-esm/unit/AtomTest.js +10 -11
  87. package/dist-esm/view-model/Action.js +258 -223
  88. package/dist-esm/view-model/AtomViewModel.js +234 -232
  89. package/dist-esm/view-model/AtomWindowViewModel.js +13 -14
  90. package/dist-esm/view-model/BindableUrlParameter.js +7 -8
  91. package/dist-esm/view-model/Delay.js +21 -25
  92. package/dist-esm/view-model/Disposable.js +28 -29
  93. package/dist-esm/view-model/Load.js +72 -73
  94. package/dist-esm/view-model/Once.js +33 -35
  95. package/dist-esm/view-model/baseTypes.js +4 -5
  96. package/dist-esm/view-model/bindPromise.js +24 -27
  97. package/dist-esm/view-model/bindProperty.js +3 -4
  98. package/dist-esm/view-model/bindUrlParameter.js +39 -43
  99. package/dist-esm/web/controls/AtomComboBox.js +56 -63
  100. package/dist-esm/web/controls/AtomControl.js +485 -490
  101. package/dist-esm/web/controls/AtomGridSplitter.js +57 -50
  102. package/dist-esm/web/controls/AtomGridView.js +230 -222
  103. package/dist-esm/web/controls/AtomItemsControl.js +677 -688
  104. package/dist-esm/web/controls/AtomPage.js +6 -7
  105. package/dist-esm/web/controls/AtomTemplate.js +1 -3
  106. package/dist-esm/web/controls/AtomTemplateControl.js +28 -29
  107. package/dist-esm/web/controls/AtomViewStack.js +19 -20
  108. package/dist-esm/web/core/AtomUI.js +200 -200
  109. package/dist-esm/web/core/Encoder.js +142 -152
  110. package/dist-esm/web/core/HtmlNode.js +141 -139
  111. package/dist-esm/web/images/Busy.js +1 -2
  112. package/dist-esm/web/images/BusyDataUrl.js +2 -869
  113. package/dist-esm/web/images/Button.js +1 -2
  114. package/dist-esm/web/images/ButtonDataUrl.js +2 -30
  115. package/dist-esm/web/images/CloseButton.js +1 -2
  116. package/dist-esm/web/images/CloseButtonDataUrl.js +2 -30
  117. package/dist-esm/web/images/CloseButtonHover.js +1 -2
  118. package/dist-esm/web/images/CloseButtonHoverDataUrl.js +2 -24
  119. package/dist-esm/web/services/LastTarget.js +31 -29
  120. package/dist-esm/web/services/MarkdownService.js +19 -31
  121. package/dist-esm/web/services/NotificationPopup.js +28 -21
  122. package/dist-esm/web/services/PopupService.js +512 -478
  123. package/dist-esm/web/services/PopupWindow.js +266 -247
  124. package/dist-esm/web/styles/AtomAlertWindowStyle.js +39 -40
  125. package/dist-esm/web/styles/AtomFrameStyle.js +15 -16
  126. package/dist-esm/web/styles/AtomNotificationStyle.js +19 -20
  127. package/dist-esm/web/styles/AtomPageLinkStyle.js +11 -12
  128. package/dist-esm/web/styles/AtomPopupStyle.js +9 -10
  129. package/dist-esm/web/styles/AtomStyle.js +61 -64
  130. package/dist-esm/web/styles/AtomStyleSheet.js +50 -51
  131. package/dist-esm/web/styles/AtomWindowStyle.js +116 -117
  132. package/dist-esm/web/styles/IStyleDeclaration.js +1 -2
  133. package/dist-esm/web/styles/StyleBuilder.js +79 -80
  134. package/package.json +3 -1
  135. package/src/App.ts +1 -1
  136. package/src/core/SingleInvoker.ts +1 -1
  137. package/src/core/sleep.ts +1 -1
@@ -4,127 +4,129 @@ import { RegisterSingleton } from "../di/RegisterSingleton.js";
4
4
  import DateTime from "@web-atoms/date-time/dist/DateTime.js";
5
5
  export const dateFormatISORegEx = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/;
6
6
  export const dateFormatMSRegEx = /^\/Date\((d|-|.*)\)[\/|\\]$/;
7
- const timeZoneDiff = (new Date()).getTimezoneOffset();
7
+ const timeZoneDiff = new Date().getTimezoneOffset();
8
8
  let JsonService = class JsonService {
9
- constructor() {
10
- this.options = {
11
- indent: 2,
12
- namingStrategy: "none",
13
- dateConverter: [
14
- {
15
- regex: dateFormatISORegEx,
16
- valueConverter: {
17
- fromSource(v) {
18
- const d = new DateTime(v);
19
- return d;
20
- },
21
- fromTarget(v) {
22
- return v.toISOString();
23
- }
24
- }
25
- }, {
26
- regex: dateFormatMSRegEx,
27
- valueConverter: {
28
- fromSource(v) {
29
- const a = dateFormatMSRegEx.exec(v);
30
- const b = a[1].split(/[-+,.]/);
31
- return new DateTime(b[0] ? +b[0] : 0 - +b[1]);
32
- },
33
- fromTarget(v) {
34
- return v.toISOString();
35
- }
36
- }
37
- }
38
- ]
39
- };
40
- }
41
- transformKeys(t, v) {
42
- if (!v) {
43
- return v;
44
- }
45
- if (typeof v !== "object") {
46
- return v;
47
- }
48
- if (v instanceof Date) {
49
- return v;
9
+ constructor() {
10
+ this.options = {
11
+ indent: 2,
12
+ namingStrategy: "none",
13
+ dateConverter: [{
14
+ regex: dateFormatISORegEx,
15
+ valueConverter: {
16
+ fromSource(v) {
17
+ const d = new DateTime(v);
18
+ return d;
19
+ },
20
+ fromTarget(v) {
21
+ return v.toISOString();
22
+ }
50
23
  }
51
- if (typeof v === "object" && v.length !== undefined && typeof v.length === "number") {
52
- const a = v;
53
- if (a.map) {
54
- return a.map((x) => this.transformKeys(t, x));
55
- }
56
- const ra = [];
57
- for (let i = 0; i < a.length; i++) {
58
- const iterator = a[i];
59
- ra.push(this.transformKeys(t, iterator));
60
- }
61
- return ra;
24
+ }, {
25
+ regex: dateFormatMSRegEx,
26
+ valueConverter: {
27
+ fromSource(v) {
28
+ const a = dateFormatMSRegEx.exec(v);
29
+ const b = a[1].split(/[-+,.]/);
30
+ return new DateTime(b[0] ? +b[0] : 0 - +b[1]);
31
+ },
32
+ fromTarget(v) {
33
+ return v.toISOString();
34
+ }
62
35
  }
63
- const r = {};
64
- for (const key in v) {
65
- if (v.hasOwnProperty(key)) {
66
- const element = v[key];
67
- r[t(key)] = this.transformKeys(t, element);
68
- }
69
- }
70
- return r;
36
+ }]
37
+ };
38
+ }
39
+ transformKeys(t, v) {
40
+ if (!v) {
41
+ return v;
71
42
  }
72
- parse(text, options) {
73
- const { dateConverter, namingStrategy } = {
74
- ...this.options,
75
- ...options
76
- };
77
- const result = JSON.parse(text, (key, value) => {
78
- if (typeof value === "string") {
79
- for (const iterator of dateConverter) {
80
- const a = iterator.regex.test(value);
81
- if (a) {
82
- const dv = iterator.valueConverter.fromSource(value);
83
- return dv;
84
- }
85
- }
86
- }
87
- return value;
88
- });
89
- switch (namingStrategy) {
90
- case "hyphen":
91
- return this.transformKeys(StringHelper.fromHyphenToCamel, result);
92
- case "underscore":
93
- return this.transformKeys(StringHelper.fromUnderscoreToCamel, result);
94
- case "pascal":
95
- return this.transformKeys(StringHelper.fromPascalToCamel, result);
96
- }
97
- return result;
43
+ if (typeof v !== "object") {
44
+ return v;
98
45
  }
99
- stringify(v, options) {
100
- const { namingStrategy, dateConverter, indent } = {
101
- ...this.options,
102
- ...options
103
- };
104
- switch (namingStrategy) {
105
- case "hyphen":
106
- v = this.transformKeys(StringHelper.fromCamelToHyphen, v);
107
- break;
108
- case "underscore":
109
- v = this.transformKeys(StringHelper.fromCamelToUnderscore, v);
110
- break;
111
- case "pascal":
112
- v = this.transformKeys(StringHelper.fromCamelToPascal, v);
113
- break;
46
+ if (v instanceof Date) {
47
+ return v;
48
+ }
49
+ if (typeof v === "object" && v.length !== undefined && typeof v.length === "number") {
50
+ const a = v;
51
+ if (a.map) {
52
+ return a.map(x => this.transformKeys(t, x));
53
+ }
54
+ const ra = [];
55
+ for (let i = 0; i < a.length; i++) {
56
+ const iterator = a[i];
57
+ ra.push(this.transformKeys(t, iterator));
58
+ }
59
+ return ra;
60
+ }
61
+ const r = {};
62
+ for (const key in v) {
63
+ if (v.hasOwnProperty(key)) {
64
+ const element = v[key];
65
+ r[t(key)] = this.transformKeys(t, element);
66
+ }
67
+ }
68
+ return r;
69
+ }
70
+ parse(text, options) {
71
+ const {
72
+ dateConverter,
73
+ namingStrategy
74
+ } = {
75
+ ...this.options,
76
+ ...options
77
+ };
78
+ const result = JSON.parse(text, (key, value) => {
79
+ if (typeof value === "string") {
80
+ for (const iterator of dateConverter) {
81
+ const a = iterator.regex.test(value);
82
+ if (a) {
83
+ const dv = iterator.valueConverter.fromSource(value);
84
+ return dv;
85
+ }
114
86
  }
115
- return JSON.stringify(v, (key, value) => {
116
- if (key && /^\_\$\_/.test(key)) {
117
- return undefined;
118
- }
119
- if (dateConverter && (value instanceof Date)) {
120
- return dateConverter[0].valueConverter.fromTarget(value);
121
- }
122
- return value;
123
- }, indent);
87
+ }
88
+ return value;
89
+ });
90
+ switch (namingStrategy) {
91
+ case "hyphen":
92
+ return this.transformKeys(StringHelper.fromHyphenToCamel, result);
93
+ case "underscore":
94
+ return this.transformKeys(StringHelper.fromUnderscoreToCamel, result);
95
+ case "pascal":
96
+ return this.transformKeys(StringHelper.fromPascalToCamel, result);
97
+ }
98
+ return result;
99
+ }
100
+ stringify(v, options) {
101
+ const {
102
+ namingStrategy,
103
+ dateConverter,
104
+ indent
105
+ } = {
106
+ ...this.options,
107
+ ...options
108
+ };
109
+ switch (namingStrategy) {
110
+ case "hyphen":
111
+ v = this.transformKeys(StringHelper.fromCamelToHyphen, v);
112
+ break;
113
+ case "underscore":
114
+ v = this.transformKeys(StringHelper.fromCamelToUnderscore, v);
115
+ break;
116
+ case "pascal":
117
+ v = this.transformKeys(StringHelper.fromCamelToPascal, v);
118
+ break;
124
119
  }
120
+ return JSON.stringify(v, (key, value) => {
121
+ if (key && /^\_\$\_/.test(key)) {
122
+ return undefined;
123
+ }
124
+ if (dateConverter && value instanceof Date) {
125
+ return dateConverter[0].valueConverter.fromTarget(value);
126
+ }
127
+ return value;
128
+ }, indent);
129
+ }
125
130
  };
126
- JsonService = __decorate([
127
- RegisterSingleton
128
- ], JsonService);
129
- export { JsonService };
130
- //# sourceMappingURL=JsonService.js.map
131
+ JsonService = __decorate([RegisterSingleton], JsonService);
132
+ export { JsonService };
@@ -4,134 +4,135 @@ import { AtomUri } from "../core/AtomUri.js";
4
4
  import { RegisterSingleton } from "../di/RegisterSingleton.js";
5
5
  import { AtomWindowViewModel } from "../view-model/AtomWindowViewModel.js";
6
6
  import { NavigationService } from "./NavigationService.js";
7
- export class MockConfirmViewModel extends AtomWindowViewModel {
8
- }
7
+ export class MockConfirmViewModel extends AtomWindowViewModel {}
9
8
  let MockNavigationService = class MockNavigationService extends NavigationService {
10
- get location() {
11
- return this.mLocation;
12
- }
13
- set location(v) {
14
- if (JSON.stringify(this.location) === JSON.stringify(v)) {
15
- return;
16
- }
17
- this.history.push(this.mLocation);
18
- this.mLocation = v;
19
- }
20
- constructor(app) {
21
- super(app);
22
- this.windowStack = [];
23
- this.history = [];
24
- this.mLocation = new AtomUri("");
25
- }
26
- refresh() {
27
- }
28
- navigate(url) {
29
- this.location = new AtomUri(url);
30
- }
31
- back() {
32
- if (this.history.length) {
33
- const top = this.history.pop();
34
- this.location = top;
35
- this.history.pop();
36
- }
37
- }
38
- alert(msg, title) {
39
- return this.openTestWindow(`__AlertWindow_${msg}`, { message: msg, title });
40
- }
41
- confirm(msg, title) {
42
- return this.openTestWindow(`__ConfirmWindow_${msg}`, { message: msg, title });
43
- }
44
- openPage(pageName, p) {
45
- return this.openTestWindow(pageName, p);
46
- }
47
- async notify(message, title) {
48
- const url = `__AlertNotification_${message}`;
49
- const w = this.windowStack.find((x) => x.windowType === message);
50
- if (!w) {
51
- throw new Error(`No notification registered for "${message}"`);
52
- }
53
- w.action({});
54
- }
55
- openTestWindow(c, p) {
56
- const url = c instanceof AtomUri ? c : new AtomUri(c);
57
- if (p) {
58
- for (const key in p) {
59
- if (p.hasOwnProperty(key)) {
60
- const element = p[key];
61
- url.query[key] = element;
62
- }
63
- }
9
+ get location() {
10
+ return this.mLocation;
11
+ }
12
+ set location(v) {
13
+ if (JSON.stringify(this.location) === JSON.stringify(v)) {
14
+ return;
15
+ }
16
+ this.history.push(this.mLocation);
17
+ this.mLocation = v;
18
+ }
19
+ constructor(app) {
20
+ super(app);
21
+ this.windowStack = [];
22
+ this.history = [];
23
+ this.mLocation = new AtomUri("");
24
+ }
25
+ refresh() {}
26
+ navigate(url) {
27
+ this.location = new AtomUri(url);
28
+ }
29
+ back() {
30
+ if (this.history.length) {
31
+ const top = this.history.pop();
32
+ this.location = top;
33
+ this.history.pop();
34
+ }
35
+ }
36
+ alert(msg, title) {
37
+ return this.openTestWindow(`__AlertWindow_${msg}`, {
38
+ message: msg,
39
+ title
40
+ });
41
+ }
42
+ confirm(msg, title) {
43
+ return this.openTestWindow(`__ConfirmWindow_${msg}`, {
44
+ message: msg,
45
+ title
46
+ });
47
+ }
48
+ openPage(pageName, p) {
49
+ return this.openTestWindow(pageName, p);
50
+ }
51
+ async notify(message, title) {
52
+ const url = `__AlertNotification_${message}`;
53
+ const w = this.windowStack.find(x => x.windowType === message);
54
+ if (!w) {
55
+ throw new Error(`No notification registered for "${message}"`);
56
+ }
57
+ w.action({});
58
+ }
59
+ openTestWindow(c, p) {
60
+ const url = c instanceof AtomUri ? c : new AtomUri(c);
61
+ if (p) {
62
+ for (const key in p) {
63
+ if (p.hasOwnProperty(key)) {
64
+ const element = p[key];
65
+ url.query[key] = element;
64
66
  }
65
- return new Promise((resolve, reject) => {
66
- const w = this.windowStack.find((x) => x.windowType === url.path);
67
- if (!w) {
68
- const ex = new Error(`No window registered for "${c} with ${(p ? JSON.stringify(p, undefined, 2) : "")}"`);
69
- reject(ex);
70
- return;
71
- }
72
- setTimeout(() => {
73
- try {
74
- const vm = new AtomWindowViewModel(this.app);
75
- for (const key in url.query) {
76
- if (url.query.hasOwnProperty(key)) {
77
- const element = url.query[key];
78
- vm[key] = element;
79
- }
80
- }
81
- resolve(w.action(vm));
82
- }
83
- catch (e) {
84
- reject(e);
85
- }
86
- }, 5);
87
- });
88
- }
89
- expectAlert(msg) {
90
- return this.expectWindow(`__AlertWindow_${msg}`, (vm) => true);
91
- }
92
- expectNotification(msg) {
93
- return this.expectWindow(`__AlertNotification_${msg}`, (vm) => true);
94
- }
95
- expectConfirm(msg, action) {
96
- return this.expectWindow(`__ConfirmWindow_${msg}`, action);
97
- }
98
- expectPopup(popupType, windowAction) {
99
- return this.expectWindow(popupType, windowAction);
100
- }
101
- expectWindow(windowType, windowAction) {
102
- const registration = { windowType, action: windowAction };
103
- registration.action = (vm) => {
104
- this.removeRegistration(registration);
105
- return windowAction(vm);
106
- };
107
- this.windowStack.push(registration);
108
- return {
109
- dispose: () => {
110
- this.removeRegistration(registration);
67
+ }
68
+ }
69
+ return new Promise((resolve, reject) => {
70
+ const w = this.windowStack.find(x => x.windowType === url.path);
71
+ if (!w) {
72
+ const ex = new Error(`No window registered for "${c} with ${p ? JSON.stringify(p, undefined, 2) : ""}"`);
73
+ reject(ex);
74
+ return;
75
+ }
76
+ setTimeout(() => {
77
+ try {
78
+ const vm = new AtomWindowViewModel(this.app);
79
+ for (const key in url.query) {
80
+ if (url.query.hasOwnProperty(key)) {
81
+ const element = url.query[key];
82
+ vm[key] = element;
111
83
  }
112
- };
113
- }
114
- removeRegistration(r) {
115
- this.windowStack = this.windowStack.filter((x) => x !== r);
116
- }
117
- assert() {
118
- if (!this.windowStack.length) {
119
- return;
84
+ }
85
+ resolve(w.action(vm));
86
+ } catch (e) {
87
+ reject(e);
120
88
  }
121
- throw new Error(`Expected windows did not open ${this.windowStack.map((x) => `"${x.windowType}"`).join(",")}`);
122
- }
123
- registerForPopup() {
124
- }
125
- forceRemove(view) {
126
- throw new Error("Method not implemented.");
127
- }
128
- openWindow(url) {
129
- return this.openTestWindow(url);
130
- }
89
+ }, 5);
90
+ });
91
+ }
92
+ expectAlert(msg) {
93
+ return this.expectWindow(`__AlertWindow_${msg}`, vm => true);
94
+ }
95
+ expectNotification(msg) {
96
+ return this.expectWindow(`__AlertNotification_${msg}`, vm => true);
97
+ }
98
+ expectConfirm(msg, action) {
99
+ return this.expectWindow(`__ConfirmWindow_${msg}`, action);
100
+ }
101
+ expectPopup(popupType, windowAction) {
102
+ return this.expectWindow(popupType, windowAction);
103
+ }
104
+ expectWindow(windowType, windowAction) {
105
+ const registration = {
106
+ windowType,
107
+ action: windowAction
108
+ };
109
+ registration.action = vm => {
110
+ this.removeRegistration(registration);
111
+ return windowAction(vm);
112
+ };
113
+ this.windowStack.push(registration);
114
+ return {
115
+ dispose: () => {
116
+ this.removeRegistration(registration);
117
+ }
118
+ };
119
+ }
120
+ removeRegistration(r) {
121
+ this.windowStack = this.windowStack.filter(x => x !== r);
122
+ }
123
+ assert() {
124
+ if (!this.windowStack.length) {
125
+ return;
126
+ }
127
+ throw new Error(`Expected windows did not open ${this.windowStack.map(x => `"${x.windowType}"`).join(",")}`);
128
+ }
129
+ registerForPopup() {}
130
+ forceRemove(view) {
131
+ throw new Error("Method not implemented.");
132
+ }
133
+ openWindow(url) {
134
+ return this.openTestWindow(url);
135
+ }
131
136
  };
132
- MockNavigationService = __decorate([
133
- RegisterSingleton,
134
- __metadata("design:paramtypes", [App])
135
- ], MockNavigationService);
136
- export { MockNavigationService };
137
- //# sourceMappingURL=MockNavigationService.js.map
137
+ MockNavigationService = __decorate([RegisterSingleton, __metadata("design:paramtypes", [App])], MockNavigationService);
138
+ export { MockNavigationService };