@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
@@ -2,293 +2,295 @@ import { parsePath, parsePathLists } from "./ExpressionParser.js";
2
2
  import { CancelToken, ignoreValue } from "./types.js";
3
3
  const isEvent = /^event/i;
4
4
  function twoWaysConvert(name, b, control, e, creator) {
5
- control.bind(e, name, b.thisPathList || b.pathList, b.eventList || true, null, b.thisPathList ? creator : undefined);
5
+ control.bind(e, name, b.thisPathList || b.pathList, b.eventList || true, null, b.thisPathList ? creator : undefined);
6
6
  }
7
7
  export const bindSymbol = Symbol("Bind");
8
8
  export default class Bind {
9
- static forControl() {
10
- return Bind;
11
- }
12
- static forData() {
13
- return Bind;
14
- }
15
- static forViewModel() {
16
- return Bind;
17
- }
18
- static forLocalViewModel() {
19
- return Bind;
20
- }
21
- static onCreate(fx) {
22
- return {
23
- [bindSymbol](cn, control, e, creator) {
24
- fx(control, e, creator);
25
- return;
26
- }
27
- };
28
- }
29
- static presenter(name) {
30
- return {
31
- [bindSymbol](cn, control, e, creator) {
32
- if (typeof name === "function") {
33
- name(control);
34
- return;
35
- }
36
- const n = name || cn;
37
- let c = control.element;
38
- while (c) {
39
- if (c.atomControl && c.atomControl[n] !== undefined) {
40
- break;
41
- }
42
- c = c._logicalParent || c.parentElement;
43
- }
44
- ((c && c.atomControl) || control)[n] = e;
45
- }
46
- };
47
- }
48
- static event(sourcePath) {
49
- return {
50
- [bindSymbol](name, control, e) {
51
- control.runAfterInit(() => {
52
- if (isEvent.test(name)) {
53
- name = name.substring(5);
54
- if (name.startsWith("-")) {
55
- name = name.substring(1).replace(/-([a-z])/g, (g) => g[1].toUpperCase());
56
- }
57
- else {
58
- name = (name[0].toLowerCase() + name.substring(1));
59
- }
60
- }
61
- control.bindEvent(e, name, (e1) => {
62
- return sourcePath(control, e1);
63
- });
64
- });
65
- }
66
- };
67
- }
68
- static oneTime(sourcePath, now) {
69
- return {
70
- [bindSymbol](name, control, e) {
71
- control.runAfterInit(() => {
72
- control.setLocalValue(e, name, sourcePath(control, e));
73
- });
74
- if (typeof now !== "undefined") {
75
- control.setLocalValue(e, name, now);
76
- }
77
- }
78
- };
79
- }
80
- static oneTimeAsync(sourcePath, now) {
81
- return {
82
- [bindSymbol](name, control, e) {
83
- control.runAfterInit(() => {
84
- control.app.runAsync(async () => {
85
- const value = await sourcePath(control, e, new CancelToken());
86
- control.setLocalValue(e, name, value);
87
- });
88
- });
89
- if (typeof now !== "undefined") {
90
- control.setLocalValue(e, name, now);
91
- }
92
- }
93
- };
94
- }
95
- static source(source, path, now) {
96
- const lists = parsePath(path, false).map((x) => ["this", ...x]);
97
- return {
98
- [bindSymbol](name, control, e, creator) {
99
- const self = { control, source };
100
- control.bind(e, name, lists, false, () => {
101
- return path.call(self, self);
102
- }, self);
103
- if (typeof now !== "undefined") {
104
- control.setLocalValue(e, name, now);
105
- }
106
- }
107
- };
108
- }
109
- static oneWayAsync(sourcePath, { watchDelayInMS = 250, default: defaultValue } = {}) {
110
- let pathList;
111
- let combined;
112
- let thisPathList;
113
- if (Array.isArray(sourcePath)) {
114
- pathList = sourcePath;
9
+ static forControl() {
10
+ return Bind;
11
+ }
12
+ static forData() {
13
+ return Bind;
14
+ }
15
+ static forViewModel() {
16
+ return Bind;
17
+ }
18
+ static forLocalViewModel() {
19
+ return Bind;
20
+ }
21
+ static onCreate(fx) {
22
+ return {
23
+ [bindSymbol](cn, control, e, creator) {
24
+ fx(control, e, creator);
25
+ return;
26
+ }
27
+ };
28
+ }
29
+ static presenter(name) {
30
+ return {
31
+ [bindSymbol](cn, control, e, creator) {
32
+ if (typeof name === "function") {
33
+ name(control);
34
+ return;
115
35
  }
116
- else {
117
- const lists = parsePathLists(sourcePath);
118
- if (lists.combined.length) {
119
- combined = lists.combined;
120
- }
121
- if (lists.pathList.length) {
122
- pathList = lists.pathList;
123
- }
124
- if (lists.thisPath.length) {
125
- thisPathList = lists.thisPath;
36
+ const n = name || cn;
37
+ let c = control.element;
38
+ while (c) {
39
+ if (c.atomControl && c.atomControl[n] !== undefined) {
40
+ break;
41
+ }
42
+ c = c._logicalParent || c.parentElement;
43
+ }
44
+ (c && c.atomControl || control)[n] = e;
45
+ }
46
+ };
47
+ }
48
+ static event(sourcePath) {
49
+ return {
50
+ [bindSymbol](name, control, e) {
51
+ control.runAfterInit(() => {
52
+ if (isEvent.test(name)) {
53
+ name = name.substring(5);
54
+ if (name.startsWith("-")) {
55
+ name = name.substring(1).replace(/-([a-z])/g, g => g[1].toUpperCase());
56
+ } else {
57
+ name = name[0].toLowerCase() + name.substring(1);
126
58
  }
59
+ }
60
+ control.bindEvent(e, name, e1 => {
61
+ return sourcePath(control, e1);
62
+ });
63
+ });
64
+ }
65
+ };
66
+ }
67
+ static oneTime(sourcePath, now) {
68
+ return {
69
+ [bindSymbol](name, control, e) {
70
+ control.runAfterInit(() => {
71
+ control.setLocalValue(e, name, sourcePath(control, e));
72
+ });
73
+ if (typeof now !== "undefined") {
74
+ control.setLocalValue(e, name, now);
127
75
  }
128
- if (!(combined || pathList || thisPathList)) {
129
- throw new Error(`Failed to setup binding for ${sourcePath}, parsing failed`);
76
+ }
77
+ };
78
+ }
79
+ static oneTimeAsync(sourcePath, now) {
80
+ return {
81
+ [bindSymbol](name, control, e) {
82
+ control.runAfterInit(() => {
83
+ control.app.runAsync(async () => {
84
+ const value = await sourcePath(control, e, new CancelToken());
85
+ control.setLocalValue(e, name, value);
86
+ });
87
+ });
88
+ if (typeof now !== "undefined") {
89
+ control.setLocalValue(e, name, now);
130
90
  }
131
- return {
132
- [bindSymbol](name, control, e, creator) {
133
- let bindingSource;
134
- let finalPathList = pathList;
135
- if (combined) {
136
- bindingSource = {
137
- t: creator,
138
- x: control
139
- };
140
- finalPathList = combined;
141
- }
142
- else if (thisPathList) {
143
- finalPathList = thisPathList;
144
- bindingSource = creator;
145
- }
146
- const asyncState = {
147
- token: 0,
148
- cancelToken: undefined
149
- };
150
- control.bind(e, name, finalPathList, false, () => {
151
- const app = control.app;
152
- asyncState.cancelToken?.cancel();
153
- asyncState.cancelToken = undefined;
154
- asyncState.token = app.setTimeoutAsync(async () => {
155
- if (asyncState.cancelToken?.cancelled) {
156
- return;
157
- }
158
- asyncState.token = undefined;
159
- asyncState.cancelToken?.cancel();
160
- const ct = asyncState.cancelToken = new CancelToken();
161
- const value = await sourcePath.call(creator, control, e, ct);
162
- if (!ct.cancelled) {
163
- control.setLocalValue(e, name, value);
164
- }
165
- }, watchDelayInMS, asyncState.token);
166
- return ignoreValue;
167
- }, bindingSource);
168
- if (typeof defaultValue !== "undefined") {
169
- control.setLocalValue(e, name, defaultValue);
170
- }
171
- }
91
+ }
92
+ };
93
+ }
94
+ static source(source, path, now) {
95
+ const lists = parsePath(path, false).map(x => ["this", ...x]);
96
+ return {
97
+ [bindSymbol](name, control, e, creator) {
98
+ const self = {
99
+ control,
100
+ source
172
101
  };
102
+ control.bind(e, name, lists, false, () => {
103
+ return path.call(self, self);
104
+ }, self);
105
+ if (typeof now !== "undefined") {
106
+ control.setLocalValue(e, name, now);
107
+ }
108
+ }
109
+ };
110
+ }
111
+ static oneWayAsync(sourcePath, {
112
+ watchDelayInMS = 250,
113
+ default: defaultValue
114
+ } = {}) {
115
+ let pathList;
116
+ let combined;
117
+ let thisPathList;
118
+ if (Array.isArray(sourcePath)) {
119
+ pathList = sourcePath;
120
+ } else {
121
+ const lists = parsePathLists(sourcePath);
122
+ if (lists.combined.length) {
123
+ combined = lists.combined;
124
+ }
125
+ if (lists.pathList.length) {
126
+ pathList = lists.pathList;
127
+ }
128
+ if (lists.thisPath.length) {
129
+ thisPathList = lists.thisPath;
130
+ }
131
+ }
132
+ if (!(combined || pathList || thisPathList)) {
133
+ throw new Error(`Failed to setup binding for ${sourcePath}, parsing failed`);
173
134
  }
174
- static oneWay(sourcePath, now) {
175
- let pathList;
176
- let combined;
177
- let thisPathList;
178
- if (Array.isArray(sourcePath)) {
179
- pathList = sourcePath;
135
+ return {
136
+ [bindSymbol](name, control, e, creator) {
137
+ let bindingSource;
138
+ let finalPathList = pathList;
139
+ if (combined) {
140
+ bindingSource = {
141
+ t: creator,
142
+ x: control
143
+ };
144
+ finalPathList = combined;
145
+ } else if (thisPathList) {
146
+ finalPathList = thisPathList;
147
+ bindingSource = creator;
180
148
  }
181
- else {
182
- const lists = parsePathLists(sourcePath);
183
- if (lists.combined.length) {
184
- combined = lists.combined;
185
- }
186
- if (lists.pathList.length) {
187
- pathList = lists.pathList;
149
+ const asyncState = {
150
+ token: 0,
151
+ cancelToken: undefined
152
+ };
153
+ control.bind(e, name, finalPathList, false, () => {
154
+ const app = control.app;
155
+ asyncState.cancelToken?.cancel();
156
+ asyncState.cancelToken = undefined;
157
+ asyncState.token = app.setTimeoutAsync(async () => {
158
+ if (asyncState.cancelToken?.cancelled) {
159
+ return;
188
160
  }
189
- if (lists.thisPath.length) {
190
- thisPathList = lists.thisPath;
161
+ asyncState.token = undefined;
162
+ asyncState.cancelToken?.cancel();
163
+ const ct = asyncState.cancelToken = new CancelToken();
164
+ const value = await sourcePath.call(creator, control, e, ct);
165
+ if (!ct.cancelled) {
166
+ control.setLocalValue(e, name, value);
191
167
  }
168
+ }, watchDelayInMS, asyncState.token);
169
+ return ignoreValue;
170
+ }, bindingSource);
171
+ if (typeof defaultValue !== "undefined") {
172
+ control.setLocalValue(e, name, defaultValue);
192
173
  }
193
- if (!(combined || pathList || thisPathList)) {
194
- throw new Error(`Failed to setup binding for ${sourcePath}, parsing failed`);
195
- }
196
- return {
197
- [bindSymbol](name, control, e, creator) {
198
- if (pathList) {
199
- control.bind(e, name, pathList, false, () => {
200
- return sourcePath.call(creator, control, e);
201
- });
202
- if (typeof now !== "undefined") {
203
- control.setLocalValue(e, name, now);
204
- }
205
- return;
206
- }
207
- if (combined) {
208
- const a = {
209
- t: creator,
210
- x: control
211
- };
212
- control.bind(e, name, combined, false, () => {
213
- return sourcePath.call(creator, control, e);
214
- }, a);
215
- if (typeof now !== "undefined") {
216
- control.setLocalValue(e, name, now);
217
- }
218
- return;
219
- }
220
- control.bind(e, name, thisPathList, false, () => {
221
- return sourcePath.call(creator, control, e);
222
- }, creator);
223
- if (typeof now !== "undefined") {
224
- control.setLocalValue(e, name, now);
225
- }
226
- }
227
- };
174
+ }
175
+ };
176
+ }
177
+ static oneWay(sourcePath, now) {
178
+ let pathList;
179
+ let combined;
180
+ let thisPathList;
181
+ if (Array.isArray(sourcePath)) {
182
+ pathList = sourcePath;
183
+ } else {
184
+ const lists = parsePathLists(sourcePath);
185
+ if (lists.combined.length) {
186
+ combined = lists.combined;
187
+ }
188
+ if (lists.pathList.length) {
189
+ pathList = lists.pathList;
190
+ }
191
+ if (lists.thisPath.length) {
192
+ thisPathList = lists.thisPath;
193
+ }
194
+ }
195
+ if (!(combined || pathList || thisPathList)) {
196
+ throw new Error(`Failed to setup binding for ${sourcePath}, parsing failed`);
228
197
  }
229
- static twoWays(sourcePath, events, converter) {
230
- let pathList;
231
- let thisPathList;
232
- if (Array.isArray(sourcePath)) {
233
- pathList = sourcePath;
198
+ return {
199
+ [bindSymbol](name, control, e, creator) {
200
+ if (pathList) {
201
+ control.bind(e, name, pathList, false, () => {
202
+ return sourcePath.call(creator, control, e);
203
+ });
204
+ if (typeof now !== "undefined") {
205
+ control.setLocalValue(e, name, now);
206
+ }
207
+ return;
234
208
  }
235
- else {
236
- const lists = parsePathLists(sourcePath);
237
- if (lists.combined.length) {
238
- throw new Error("Cannot have combined binding for two ways");
239
- }
240
- if (lists.pathList.length) {
241
- pathList = lists.pathList;
242
- }
243
- if (lists.thisPath.length) {
244
- thisPathList = lists.thisPath;
245
- }
209
+ if (combined) {
210
+ const a = {
211
+ t: creator,
212
+ x: control
213
+ };
214
+ control.bind(e, name, combined, false, () => {
215
+ return sourcePath.call(creator, control, e);
216
+ }, a);
217
+ if (typeof now !== "undefined") {
218
+ control.setLocalValue(e, name, now);
219
+ }
220
+ return;
246
221
  }
247
- if (!(thisPathList || pathList)) {
248
- throw new Error(`Failed to setup twoWay binding on ${sourcePath}`);
222
+ control.bind(e, name, thisPathList, false, () => {
223
+ return sourcePath.call(creator, control, e);
224
+ }, creator);
225
+ if (typeof now !== "undefined") {
226
+ control.setLocalValue(e, name, now);
249
227
  }
250
- return {
251
- [bindSymbol](name, control, e, creator) {
252
- control.bind(e, name, thisPathList || pathList, events || true, converter, thisPathList ? creator : undefined);
253
- }
254
- };
228
+ }
229
+ };
230
+ }
231
+ static twoWays(sourcePath, events, converter) {
232
+ let pathList;
233
+ let thisPathList;
234
+ if (Array.isArray(sourcePath)) {
235
+ pathList = sourcePath;
236
+ } else {
237
+ const lists = parsePathLists(sourcePath);
238
+ if (lists.combined.length) {
239
+ throw new Error("Cannot have combined binding for two ways");
240
+ }
241
+ if (lists.pathList.length) {
242
+ pathList = lists.pathList;
243
+ }
244
+ if (lists.thisPath.length) {
245
+ thisPathList = lists.thisPath;
246
+ }
255
247
  }
256
- static sourceTwoWays(source, path, events = ["input", "cut", "paste", "change"]) {
257
- const lists = parsePath(path, false).map((x) => ["this", ...x]);
258
- return {
259
- [bindSymbol](name, control, e, creator) {
260
- const self = { control, source };
261
- control.bind(e, name, lists, events, lists, self);
262
- }
263
- };
248
+ if (!(thisPathList || pathList)) {
249
+ throw new Error(`Failed to setup twoWay binding on ${sourcePath}`);
264
250
  }
265
- static twoWaysImmediate(sourcePath, converter) {
266
- return this.twoWays(sourcePath, ["change", "input", "paste", "cut"], converter);
251
+ return {
252
+ [bindSymbol](name, control, e, creator) {
253
+ control.bind(e, name, thisPathList || pathList, events || true, converter, thisPathList ? creator : undefined);
254
+ }
255
+ };
256
+ }
257
+ static sourceTwoWays(source, path, events = ["input", "cut", "paste", "change"]) {
258
+ const lists = parsePath(path, false).map(x => ["this", ...x]);
259
+ return {
260
+ [bindSymbol](name, control, e, creator) {
261
+ const self = {
262
+ control,
263
+ source
264
+ };
265
+ control.bind(e, name, lists, events, lists, self);
266
+ }
267
+ };
268
+ }
269
+ static twoWaysImmediate(sourcePath, converter) {
270
+ return this.twoWays(sourcePath, ["change", "input", "paste", "cut"], converter);
271
+ }
272
+ constructor(setupFunction, sourcePath, name, eventList) {
273
+ this.setupFunction = setupFunction;
274
+ this.name = name;
275
+ this.eventList = eventList;
276
+ this.sourcePath = sourcePath;
277
+ this[bindSymbol] = true;
278
+ if (!this.sourcePath) {
279
+ return;
267
280
  }
268
- constructor(setupFunction, sourcePath, name, eventList) {
269
- this.setupFunction = setupFunction;
270
- this.name = name;
271
- this.eventList = eventList;
272
- this.sourcePath = sourcePath;
273
- this[bindSymbol] = true;
274
- if (!this.sourcePath) {
275
- return;
276
- }
277
- if (Array.isArray(this.sourcePath)) {
278
- this.pathList = this.sourcePath;
279
- }
280
- else {
281
- const lists = parsePathLists(this.sourcePath);
282
- if (lists.combined.length) {
283
- this.combined = lists.combined;
284
- }
285
- if (lists.pathList.length) {
286
- this.pathList = lists.pathList;
287
- }
288
- if (lists.thisPath.length) {
289
- this.thisPathList = lists.thisPath;
290
- }
291
- }
281
+ if (Array.isArray(this.sourcePath)) {
282
+ this.pathList = this.sourcePath;
283
+ } else {
284
+ const lists = parsePathLists(this.sourcePath);
285
+ if (lists.combined.length) {
286
+ this.combined = lists.combined;
287
+ }
288
+ if (lists.pathList.length) {
289
+ this.pathList = lists.pathList;
290
+ }
291
+ if (lists.thisPath.length) {
292
+ this.thisPathList = lists.thisPath;
293
+ }
292
294
  }
293
- }
294
- //# sourceMappingURL=Bind.js.map
295
+ }
296
+ }
@@ -1,30 +1,29 @@
1
1
  import { AtomBinder } from "./AtomBinder.js";
2
2
  export function BindableProperty(target, key) {
3
- const iVal = target[key];
4
- const keyName = "_" + key;
5
- target[keyName] = iVal;
6
- const getter = function () {
7
- return this[keyName];
8
- };
9
- const setter = function (newVal) {
10
- const oldValue = this[keyName];
11
- if (oldValue === undefined ? oldValue === newVal : oldValue == newVal) {
12
- return;
13
- }
14
- const ce = this;
15
- if (ce.onPropertyChanging) {
16
- ce.onPropertyChanging(key, oldValue, newVal);
17
- }
18
- this[keyName] = newVal;
19
- AtomBinder.refreshValue(this, key);
20
- };
21
- if (delete target[key]) {
22
- Object.defineProperty(target, key, {
23
- get: getter,
24
- set: setter,
25
- enumerable: true,
26
- configurable: true
27
- });
3
+ const iVal = target[key];
4
+ const keyName = "_" + key;
5
+ target[keyName] = iVal;
6
+ const getter = function () {
7
+ return this[keyName];
8
+ };
9
+ const setter = function (newVal) {
10
+ const oldValue = this[keyName];
11
+ if (oldValue === undefined ? oldValue === newVal : oldValue == newVal) {
12
+ return;
28
13
  }
29
- }
30
- //# sourceMappingURL=BindableProperty.js.map
14
+ const ce = this;
15
+ if (ce.onPropertyChanging) {
16
+ ce.onPropertyChanging(key, oldValue, newVal);
17
+ }
18
+ this[keyName] = newVal;
19
+ AtomBinder.refreshValue(this, key);
20
+ };
21
+ if (delete target[key]) {
22
+ Object.defineProperty(target, key, {
23
+ get: getter,
24
+ set: setter,
25
+ enumerable: true,
26
+ configurable: true
27
+ });
28
+ }
29
+ }
@@ -3,30 +3,27 @@ import DITransient from "../di/DITransient.js";
3
3
  import TransientDisposable from "./TransientDisposable.js";
4
4
  import { CancelToken } from "./types.js";
5
5
  let CancelTokenFactory = class CancelTokenFactory extends TransientDisposable {
6
- constructor() {
7
- super(...arguments);
8
- this.mToken = {};
6
+ constructor() {
7
+ super(...arguments);
8
+ this.mToken = {};
9
+ }
10
+ newToken(key, timeout = -1) {
11
+ key = key || "__old";
12
+ const old = this.mToken[key];
13
+ if (old) {
14
+ old.cancel();
9
15
  }
10
- newToken(key, timeout = -1) {
11
- key = key || "__old";
12
- const old = this.mToken[key];
13
- if (old) {
14
- old.cancel();
15
- }
16
- const n = this.mToken[key] = new CancelToken(timeout);
17
- return n;
18
- }
19
- dispose() {
20
- for (const key in this.mToken) {
21
- if (this.mToken.hasOwnProperty(key)) {
22
- const element = this.mToken[key];
23
- element.dispose();
24
- }
25
- }
16
+ const n = this.mToken[key] = new CancelToken(timeout);
17
+ return n;
18
+ }
19
+ dispose() {
20
+ for (const key in this.mToken) {
21
+ if (this.mToken.hasOwnProperty(key)) {
22
+ const element = this.mToken[key];
23
+ element.dispose();
24
+ }
26
25
  }
26
+ }
27
27
  };
28
- CancelTokenFactory = __decorate([
29
- DITransient()
30
- ], CancelTokenFactory);
31
- export default CancelTokenFactory;
32
- //# sourceMappingURL=CancelTokenFactory.js.map
28
+ CancelTokenFactory = __decorate([DITransient()], CancelTokenFactory);
29
+ export default CancelTokenFactory;
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=Color.js.map
1
+ export {};