@web-atoms/core 2.1.479 → 2.2.0

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 (296) hide show
  1. package/dist/App.js +189 -242
  2. package/dist/App.js.map +1 -1
  3. package/dist/Atom.js +123 -138
  4. package/dist/Atom.js.map +1 -1
  5. package/dist/MockApp.js +32 -32
  6. package/dist/MockApp.js.map +1 -1
  7. package/dist/Pack.js +11 -17
  8. package/dist/Pack.js.map +1 -1
  9. package/dist/core/AtomBinder.js +187 -199
  10. package/dist/core/AtomBinder.js.map +1 -1
  11. package/dist/core/AtomBridge.js +251 -274
  12. package/dist/core/AtomBridge.js.map +1 -1
  13. package/dist/core/AtomComponent.js +509 -592
  14. package/dist/core/AtomComponent.js.map +1 -1
  15. package/dist/core/AtomDispatcher.js +50 -54
  16. package/dist/core/AtomDispatcher.js.map +1 -1
  17. package/dist/core/AtomDisposableList.js +31 -36
  18. package/dist/core/AtomDisposableList.js.map +1 -1
  19. package/dist/core/AtomEnumerator.js +19 -21
  20. package/dist/core/AtomEnumerator.js.map +1 -1
  21. package/dist/core/AtomList.js +168 -232
  22. package/dist/core/AtomList.js.map +1 -1
  23. package/dist/core/AtomLoader.js +274 -257
  24. package/dist/core/AtomLoader.js.map +1 -1
  25. package/dist/core/AtomMap.js +15 -20
  26. package/dist/core/AtomMap.js.map +1 -1
  27. package/dist/core/AtomOnce.js +31 -71
  28. package/dist/core/AtomOnce.js.map +1 -1
  29. package/dist/core/AtomSelectableList.js +210 -223
  30. package/dist/core/AtomSelectableList.js.map +1 -1
  31. package/dist/core/AtomUri.js +78 -85
  32. package/dist/core/AtomUri.js.map +1 -1
  33. package/dist/core/AtomWatcher.js +112 -186
  34. package/dist/core/AtomWatcher.js.map +1 -1
  35. package/dist/core/Bind.js +288 -380
  36. package/dist/core/Bind.js.map +1 -1
  37. package/dist/core/BindableProperty.js +40 -59
  38. package/dist/core/BindableProperty.js.map +1 -1
  39. package/dist/core/CancelTokenFactory.js +42 -49
  40. package/dist/core/CancelTokenFactory.js.map +1 -1
  41. package/dist/core/Color.js +9 -13
  42. package/dist/core/Color.js.map +1 -1
  43. package/dist/core/Colors.js +254 -254
  44. package/dist/core/Colors.js.map +1 -1
  45. package/dist/core/Defer.js +37 -47
  46. package/dist/core/Defer.js.map +1 -1
  47. package/dist/core/EventScope.js +52 -49
  48. package/dist/core/EventScope.js.map +1 -1
  49. package/dist/core/ExpressionParser.js +152 -216
  50. package/dist/core/ExpressionParser.js.map +1 -1
  51. package/dist/core/FormattedError.js +17 -19
  52. package/dist/core/FormattedError.js.map +1 -1
  53. package/dist/core/FormattedString.js +14 -16
  54. package/dist/core/FormattedString.js.map +1 -1
  55. package/dist/core/IFetchEvent.js +9 -13
  56. package/dist/core/IFetchEvent.js.map +1 -1
  57. package/dist/core/IScreen.js +9 -13
  58. package/dist/core/IScreen.js.map +1 -1
  59. package/dist/core/IValueConverter.js +9 -13
  60. package/dist/core/IValueConverter.js.map +1 -1
  61. package/dist/core/InheritedProperty.js +83 -99
  62. package/dist/core/InheritedProperty.js.map +1 -1
  63. package/dist/core/InjectProperty.js +22 -29
  64. package/dist/core/InjectProperty.js.map +1 -1
  65. package/dist/core/KeyValuePairs.js +9 -13
  66. package/dist/core/KeyValuePairs.js.map +1 -1
  67. package/dist/core/Markdown.js +22 -24
  68. package/dist/core/Markdown.js.map +1 -1
  69. package/dist/core/MarkdownError.js +20 -20
  70. package/dist/core/MarkdownError.js.map +1 -1
  71. package/dist/core/PropertyBinding.js +11 -16
  72. package/dist/core/PropertyBinding.js.map +1 -1
  73. package/dist/core/PropertyMap.js +37 -44
  74. package/dist/core/PropertyMap.js.map +1 -1
  75. package/dist/core/SingleInvoker.js +51 -54
  76. package/dist/core/SingleInvoker.js.map +1 -1
  77. package/dist/core/StringHelper.js +36 -39
  78. package/dist/core/StringHelper.js.map +1 -1
  79. package/dist/core/TransientDisposable.js +23 -26
  80. package/dist/core/TransientDisposable.js.map +1 -1
  81. package/dist/core/WatchProperty.js +34 -34
  82. package/dist/core/WatchProperty.js.map +1 -1
  83. package/dist/core/WebImage.js +15 -17
  84. package/dist/core/WebImage.js.map +1 -1
  85. package/dist/core/XNode.js +129 -157
  86. package/dist/core/XNode.js.map +1 -1
  87. package/dist/core/sleep.js +34 -40
  88. package/dist/core/sleep.js.map +1 -1
  89. package/dist/core/types.js +80 -88
  90. package/dist/core/types.js.map +1 -1
  91. package/dist/di/DISingleton.js +23 -21
  92. package/dist/di/DISingleton.js.map +1 -1
  93. package/dist/di/DITransient.js +23 -21
  94. package/dist/di/DITransient.js.map +1 -1
  95. package/dist/di/IMockOrInject.js +9 -13
  96. package/dist/di/IMockOrInject.js.map +1 -1
  97. package/dist/di/IServiceProvider.js +9 -13
  98. package/dist/di/IServiceProvider.js.map +1 -1
  99. package/dist/di/Inject.js +79 -88
  100. package/dist/di/Inject.js.map +1 -1
  101. package/dist/di/Register.js +49 -51
  102. package/dist/di/Register.js.map +1 -1
  103. package/dist/di/RegisterScoped.js +20 -20
  104. package/dist/di/RegisterScoped.js.map +1 -1
  105. package/dist/di/RegisterSingleton.js +20 -20
  106. package/dist/di/RegisterSingleton.js.map +1 -1
  107. package/dist/di/ServiceCollection.js +46 -45
  108. package/dist/di/ServiceCollection.js.map +1 -1
  109. package/dist/di/ServiceProvider.js +111 -109
  110. package/dist/di/ServiceProvider.js.map +1 -1
  111. package/dist/di/TypeKey.js +20 -43
  112. package/dist/di/TypeKey.js.map +1 -1
  113. package/dist/services/BusyIndicatorService.js +26 -32
  114. package/dist/services/BusyIndicatorService.js.map +1 -1
  115. package/dist/services/CacheService.js +112 -98
  116. package/dist/services/CacheService.js.map +1 -1
  117. package/dist/services/JsonService.js +131 -133
  118. package/dist/services/JsonService.js.map +1 -1
  119. package/dist/services/MockNavigationService.js +152 -221
  120. package/dist/services/MockNavigationService.js.map +1 -1
  121. package/dist/services/NavigationService.js +140 -154
  122. package/dist/services/NavigationService.js.map +1 -1
  123. package/dist/services/ReferenceService.js +47 -50
  124. package/dist/services/ReferenceService.js.map +1 -1
  125. package/dist/services/http/AjaxOptions.js +12 -16
  126. package/dist/services/http/AjaxOptions.js.map +1 -1
  127. package/dist/services/http/JsonError.js +17 -19
  128. package/dist/services/http/JsonError.js.map +1 -1
  129. package/dist/services/http/RestService.js +395 -583
  130. package/dist/services/http/RestService.js.map +1 -1
  131. package/dist/style/StyleRule.js +1830 -1844
  132. package/dist/style/StyleRule.js.map +1 -1
  133. package/dist/test.js +9 -66
  134. package/dist/test.js.map +1 -1
  135. package/dist/tsconfig.tsbuildinfo +1 -1
  136. package/dist/unit/AtomTest.js +54 -36
  137. package/dist/unit/AtomTest.js.map +1 -1
  138. package/dist/unit/AtomWebTest.js +64 -43
  139. package/dist/unit/AtomWebTest.js.map +1 -1
  140. package/dist/view-model/Action.js +152 -134
  141. package/dist/view-model/Action.js.map +1 -1
  142. package/dist/view-model/AtomViewModel.js +318 -416
  143. package/dist/view-model/AtomViewModel.js.map +1 -1
  144. package/dist/view-model/AtomWindowViewModel.js +55 -90
  145. package/dist/view-model/AtomWindowViewModel.js.map +1 -1
  146. package/dist/view-model/BindableUrlParameter.js +25 -25
  147. package/dist/view-model/BindableUrlParameter.js.map +1 -1
  148. package/dist/view-model/Delay.js +34 -46
  149. package/dist/view-model/Delay.js.map +1 -1
  150. package/dist/view-model/Disposable.js +31 -39
  151. package/dist/view-model/Disposable.js.map +1 -1
  152. package/dist/view-model/Load.js +119 -123
  153. package/dist/view-model/Load.js.map +1 -1
  154. package/dist/view-model/Once.js +48 -53
  155. package/dist/view-model/Once.js.map +1 -1
  156. package/dist/view-model/baseTypes.js +15 -20
  157. package/dist/view-model/baseTypes.js.map +1 -1
  158. package/dist/view-model/bindPromise.js +42 -48
  159. package/dist/view-model/bindPromise.js.map +1 -1
  160. package/dist/view-model/bindProperty.js +17 -27
  161. package/dist/view-model/bindProperty.js.map +1 -1
  162. package/dist/view-model/bindUrlParameter.js +55 -66
  163. package/dist/view-model/bindUrlParameter.js.map +1 -1
  164. package/dist/web/WebApp.js +136 -135
  165. package/dist/web/WebApp.js.map +1 -1
  166. package/dist/web/controls/AtomAlertWindow.js +61 -90
  167. package/dist/web/controls/AtomAlertWindow.js.map +1 -1
  168. package/dist/web/controls/AtomComboBox.js +82 -86
  169. package/dist/web/controls/AtomComboBox.js.map +1 -1
  170. package/dist/web/controls/AtomContentControl.js +52 -50
  171. package/dist/web/controls/AtomContentControl.js.map +1 -1
  172. package/dist/web/controls/AtomControl.js +435 -476
  173. package/dist/web/controls/AtomControl.js.map +1 -1
  174. package/dist/web/controls/AtomFrame.js +224 -226
  175. package/dist/web/controls/AtomFrame.js.map +1 -1
  176. package/dist/web/controls/AtomGridSplitter.js +67 -65
  177. package/dist/web/controls/AtomGridSplitter.js.map +1 -1
  178. package/dist/web/controls/AtomGridView.js +228 -254
  179. package/dist/web/controls/AtomGridView.js.map +1 -1
  180. package/dist/web/controls/AtomItemsControl.js +622 -761
  181. package/dist/web/controls/AtomItemsControl.js.map +1 -1
  182. package/dist/web/controls/AtomListBox.js +56 -64
  183. package/dist/web/controls/AtomListBox.js.map +1 -1
  184. package/dist/web/controls/AtomNotification.js +59 -54
  185. package/dist/web/controls/AtomNotification.js.map +1 -1
  186. package/dist/web/controls/AtomPage.js +18 -20
  187. package/dist/web/controls/AtomPage.js.map +1 -1
  188. package/dist/web/controls/AtomPageLink.js +131 -107
  189. package/dist/web/controls/AtomPageLink.js.map +1 -1
  190. package/dist/web/controls/AtomTabbedPage.js +269 -246
  191. package/dist/web/controls/AtomTabbedPage.js.map +1 -1
  192. package/dist/web/controls/AtomTemplate.js +14 -17
  193. package/dist/web/controls/AtomTemplate.js.map +1 -1
  194. package/dist/web/controls/AtomTemplateControl.js +38 -40
  195. package/dist/web/controls/AtomTemplateControl.js.map +1 -1
  196. package/dist/web/controls/AtomToggleButtonBar.js +37 -37
  197. package/dist/web/controls/AtomToggleButtonBar.js.map +1 -1
  198. package/dist/web/controls/AtomViewPager.js +87 -67
  199. package/dist/web/controls/AtomViewPager.js.map +1 -1
  200. package/dist/web/controls/AtomViewStack.js +30 -32
  201. package/dist/web/controls/AtomViewStack.js.map +1 -1
  202. package/dist/web/controls/AtomWindow.js +218 -233
  203. package/dist/web/controls/AtomWindow.js.map +1 -1
  204. package/dist/web/core/AtomUI.js +160 -172
  205. package/dist/web/core/AtomUI.js.map +1 -1
  206. package/dist/web/core/Encoder.js +152 -199
  207. package/dist/web/core/Encoder.js.map +1 -1
  208. package/dist/web/core/HtmlNode.js +165 -161
  209. package/dist/web/core/HtmlNode.js.map +1 -1
  210. package/dist/web/images/Busy.js +13 -14
  211. package/dist/web/images/Busy.js.map +1 -1
  212. package/dist/web/images/BusyDataUrl.js +14 -882
  213. package/dist/web/images/BusyDataUrl.js.map +1 -1
  214. package/dist/web/images/Button.js +13 -15
  215. package/dist/web/images/Button.js.map +1 -1
  216. package/dist/web/images/ButtonDataUrl.js +14 -43
  217. package/dist/web/images/ButtonDataUrl.js.map +1 -1
  218. package/dist/web/images/CloseButton.js +13 -14
  219. package/dist/web/images/CloseButton.js.map +1 -1
  220. package/dist/web/images/CloseButtonDataUrl.js +14 -43
  221. package/dist/web/images/CloseButtonDataUrl.js.map +1 -1
  222. package/dist/web/images/CloseButtonHover.js +13 -14
  223. package/dist/web/images/CloseButtonHover.js.map +1 -1
  224. package/dist/web/images/CloseButtonHoverDataUrl.js +14 -37
  225. package/dist/web/images/CloseButtonHoverDataUrl.js.map +1 -1
  226. package/dist/web/samples/MovieService.js +60 -49
  227. package/dist/web/samples/MovieService.js.map +1 -1
  228. package/dist/web/samples/demo/app.js +23 -23
  229. package/dist/web/samples/demo/app.js.map +1 -1
  230. package/dist/web/samples/demo/views/MovieList.js +64 -67
  231. package/dist/web/samples/demo/views/MovieList.js.map +1 -1
  232. package/dist/web/samples/demo/views/MovieListViewModel.js +102 -82
  233. package/dist/web/samples/demo/views/MovieListViewModel.js.map +1 -1
  234. package/dist/web/samples/tabs/app.js +57 -39
  235. package/dist/web/samples/tabs/app.js.map +1 -1
  236. package/dist/web/samples/tabs/views/List.js +13 -14
  237. package/dist/web/samples/tabs/views/List.js.map +1 -1
  238. package/dist/web/samples/tabs/views/ListDataUrl.js +14 -18
  239. package/dist/web/samples/tabs/views/ListDataUrl.js.map +1 -1
  240. package/dist/web/samples/tabs/views/Page1.js +94 -74
  241. package/dist/web/samples/tabs/views/Page1.js.map +1 -1
  242. package/dist/web/samples/tabs/views/TabHost.js +82 -63
  243. package/dist/web/samples/tabs/views/TabHost.js.map +1 -1
  244. package/dist/web/samples/window/WindowSample.js +27 -23
  245. package/dist/web/samples/window/WindowSample.js.map +1 -1
  246. package/dist/web/services/MarkdownService.js +35 -51
  247. package/dist/web/services/MarkdownService.js.map +1 -1
  248. package/dist/web/services/NotificationPopup.js +48 -44
  249. package/dist/web/services/NotificationPopup.js.map +1 -1
  250. package/dist/web/services/PopupService.js +770 -940
  251. package/dist/web/services/PopupService.js.map +1 -1
  252. package/dist/web/services/WebBusyIndicatorService.js +80 -86
  253. package/dist/web/services/WebBusyIndicatorService.js.map +1 -1
  254. package/dist/web/services/WindowService.js +332 -418
  255. package/dist/web/services/WindowService.js.map +1 -1
  256. package/dist/web/styles/AtomAlertWindowStyle.js +44 -34
  257. package/dist/web/styles/AtomAlertWindowStyle.js.map +1 -1
  258. package/dist/web/styles/AtomFrameStyle.js +27 -20
  259. package/dist/web/styles/AtomFrameStyle.js.map +1 -1
  260. package/dist/web/styles/AtomListBoxStyle.js +34 -32
  261. package/dist/web/styles/AtomListBoxStyle.js.map +1 -1
  262. package/dist/web/styles/AtomNotificationStyle.js +33 -33
  263. package/dist/web/styles/AtomNotificationStyle.js.map +1 -1
  264. package/dist/web/styles/AtomPageLinkStyle.js +21 -22
  265. package/dist/web/styles/AtomPageLinkStyle.js.map +1 -1
  266. package/dist/web/styles/AtomPopupStyle.js +21 -23
  267. package/dist/web/styles/AtomPopupStyle.js.map +1 -1
  268. package/dist/web/styles/AtomStyle.js +69 -73
  269. package/dist/web/styles/AtomStyle.js.map +1 -1
  270. package/dist/web/styles/AtomStyleSheet.js +54 -57
  271. package/dist/web/styles/AtomStyleSheet.js.map +1 -1
  272. package/dist/web/styles/AtomTabbedPageStyle.js +110 -105
  273. package/dist/web/styles/AtomTabbedPageStyle.js.map +1 -1
  274. package/dist/web/styles/AtomTheme.js +62 -65
  275. package/dist/web/styles/AtomTheme.js.map +1 -1
  276. package/dist/web/styles/AtomToggleButtonBarStyle.js +68 -49
  277. package/dist/web/styles/AtomToggleButtonBarStyle.js.map +1 -1
  278. package/dist/web/styles/AtomWindowStyle.js +108 -117
  279. package/dist/web/styles/AtomWindowStyle.js.map +1 -1
  280. package/dist/web/styles/CSS.js +71 -81
  281. package/dist/web/styles/CSS.js.map +1 -1
  282. package/dist/web/styles/CommonStyles.js +60 -66
  283. package/dist/web/styles/CommonStyles.js.map +1 -1
  284. package/dist/web/styles/IStyleDeclaration.js +9 -13
  285. package/dist/web/styles/IStyleDeclaration.js.map +1 -1
  286. package/dist/web/styles/StyleBuilder.js +74 -75
  287. package/dist/web/styles/StyleBuilder.js.map +1 -1
  288. package/dist/xf/XFApp.js +54 -50
  289. package/dist/xf/XFApp.js.map +1 -1
  290. package/dist/xf/controls/AtomXFControl.js +233 -229
  291. package/dist/xf/controls/AtomXFControl.js.map +1 -1
  292. package/dist/xf/services/XFBusyIndicatorService.js +34 -34
  293. package/dist/xf/services/XFBusyIndicatorService.js.map +1 -1
  294. package/dist/xf/services/XFNavigationService.js +150 -133
  295. package/dist/xf/services/XFNavigationService.js.map +1 -1
  296. package/package.json +2 -1
@@ -1,652 +1,569 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- var __param = (this && this.__param) || function (paramIndex, decorator) {
11
- return function (target, key) { decorator(target, key, paramIndex); }
12
- };
13
- (function (factory) {
14
- if (typeof module === "object" && typeof module.exports === "object") {
15
- var v = factory(require, exports);
16
- if (v !== undefined) module.exports = v;
17
- }
18
- else if (typeof define === "function" && define.amd) {
19
- define(["require", "exports", "../App", "../core/AtomBridge", "../core/types", "../di/Inject", "./AtomDisposableList", "./AtomWatcher", "./Bind", "./InheritedProperty", "./PropertyMap", "./XNode"], factory);
20
- }
21
- })(function (require, exports) {
22
- "use strict";
23
- var _a, _b;
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.PropertyBinding = exports.AtomComponent = void 0;
26
- const App_1 = require("../App");
27
- const AtomBridge_1 = require("../core/AtomBridge");
28
- const types_1 = require("../core/types");
29
- const Inject_1 = require("../di/Inject");
30
- const AtomDisposableList_1 = require("./AtomDisposableList");
31
- const AtomWatcher_1 = require("./AtomWatcher");
32
- const Bind_1 = require("./Bind");
33
- const InheritedProperty_1 = require("./InheritedProperty");
34
- const PropertyMap_1 = require("./PropertyMap");
35
- const XNode_1 = require("./XNode");
36
- const objectHasOwnProperty = Object.prototype.hasOwnProperty;
37
- const localBindSymbol = Bind_1.bindSymbol;
38
- const localXNodeSymbol = XNode_1.xnodeSymbol;
39
- const elementFactory = XNode_1.elementFactorySymbol;
40
- const isFactory = XNode_1.isFactorySymbol;
41
- const isAtomControl = XNode_1.isControl;
42
- const localBridge = AtomBridge_1.AtomBridge;
43
- const renderFirst = AtomBridge_1.AtomBridge.platform === "xf";
44
- const attached = XNode_1.attachedSymbol;
45
- const constructorNeedsArguments = XNode_1.constructorNeedsArgumentsSymbol;
46
- let AtomComponent = class AtomComponent {
47
- /** Do not ever use, only available as intellisense feature for
48
- * vs code editor.
49
- */
1
+ System.register(["../App", "../core/AtomBridge", "../core/types", "../di/Inject", "./AtomDisposableList", "./AtomWatcher", "./Bind", "./InheritedProperty", "./PropertyMap", "./XNode"], function (_export, _context) {
2
+ "use strict";
3
+
4
+ var App, AtomBridge, ArrayHelper, CancelToken, ignoreValue, Inject, AtomDisposableList, AtomWatcher, bindSymbol, InheritedProperty, PropertyMap, attachedSymbol, constructorNeedsArgumentsSymbol, elementFactorySymbol, isControl, isFactorySymbol, xnodeSymbol, PropertyBinding, __decorate, __metadata, __param, _a, _b, objectHasOwnProperty, localBindSymbol, localXNodeSymbol, elementFactory, isFactory, isAtomControl, localBridge, renderFirst, attached, constructorNeedsArguments, AtomComponent;
5
+ _export("PropertyBinding", void 0);
6
+ return {
7
+ setters: [function (_App) {
8
+ App = _App.App;
9
+ }, function (_coreAtomBridge) {
10
+ AtomBridge = _coreAtomBridge.AtomBridge;
11
+ }, function (_coreTypes) {
12
+ ArrayHelper = _coreTypes.ArrayHelper;
13
+ CancelToken = _coreTypes.CancelToken;
14
+ ignoreValue = _coreTypes.ignoreValue;
15
+ }, function (_diInject) {
16
+ Inject = _diInject.Inject;
17
+ }, function (_AtomDisposableList) {
18
+ AtomDisposableList = _AtomDisposableList.AtomDisposableList;
19
+ }, function (_AtomWatcher) {
20
+ AtomWatcher = _AtomWatcher.AtomWatcher;
21
+ }, function (_Bind) {
22
+ bindSymbol = _Bind.bindSymbol;
23
+ }, function (_InheritedProperty) {
24
+ InheritedProperty = _InheritedProperty.InheritedProperty;
25
+ }, function (_PropertyMap) {
26
+ PropertyMap = _PropertyMap.PropertyMap;
27
+ }, function (_XNode) {
28
+ attachedSymbol = _XNode.attachedSymbol;
29
+ constructorNeedsArgumentsSymbol = _XNode.constructorNeedsArgumentsSymbol;
30
+ elementFactorySymbol = _XNode.elementFactorySymbol;
31
+ isControl = _XNode.isControl;
32
+ isFactorySymbol = _XNode.isFactorySymbol;
33
+ xnodeSymbol = _XNode.xnodeSymbol;
34
+ }],
35
+ execute: function () {
36
+ __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
37
+ var c = arguments.length,
38
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
39
+ d;
40
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
41
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
42
+ };
43
+ __metadata = void 0 && (void 0).__metadata || function (k, v) {
44
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
45
+ };
46
+ __param = void 0 && (void 0).__param || function (paramIndex, decorator) {
47
+ return function (target, key) {
48
+ decorator(target, key, paramIndex);
49
+ };
50
+ };
51
+ objectHasOwnProperty = Object.prototype.hasOwnProperty;
52
+ localBindSymbol = bindSymbol;
53
+ localXNodeSymbol = xnodeSymbol;
54
+ elementFactory = elementFactorySymbol;
55
+ isFactory = isFactorySymbol;
56
+ isAtomControl = isControl;
57
+ localBridge = AtomBridge;
58
+ renderFirst = AtomBridge.platform === "xf";
59
+ attached = attachedSymbol;
60
+ constructorNeedsArguments = constructorNeedsArgumentsSymbol;
61
+ _export("AtomComponent", AtomComponent = class AtomComponent {
50
62
  get vsProps() {
51
- return undefined;
63
+ return undefined;
52
64
  }
53
65
  constructor(app, element = null) {
54
- this.app = app;
55
- this.mInvalidated = 0;
56
- this.mPendingPromises = {};
57
- this.disposables = new AtomDisposableList_1.AtomDisposableList();
58
- this.bindings = [];
59
- this.eventHandlers = [];
60
- this.element = element;
61
- // AtomBridge.instance.attachControl(this.element, this as any);
62
- this.element.atomControl = this;
63
- const a = this.beginEdit();
64
- this.preCreate();
65
- this.create();
66
- app.callLater(() => a.dispose());
66
+ this.app = app;
67
+ this.mInvalidated = 0;
68
+ this.mPendingPromises = {};
69
+ this.disposables = new AtomDisposableList();
70
+ this.bindings = [];
71
+ this.eventHandlers = [];
72
+ this.element = element;
73
+ this.element.atomControl = this;
74
+ const a = this.beginEdit();
75
+ this.preCreate();
76
+ this.create();
77
+ app.callLater(() => a.dispose());
67
78
  }
68
79
  bind(element, name, path, twoWays, valueFunc, source) {
69
- // remove existing binding if any
70
- // let binding = this.bindings.find( (x) => x.name === name && (element ? x.element === element : true));
71
- // if (binding) {
72
- // binding.dispose();
73
- // ArrayHelper.remove(this.bindings, (x) => x === binding);
74
- // }
75
- const binding = new PropertyBinding(this, element, name, path, twoWays, valueFunc, source);
76
- this.bindings.push(binding);
77
- return {
78
- dispose: () => {
79
- binding.dispose();
80
- types_1.ArrayHelper.remove(this.bindings, (x) => x === binding);
81
- }
82
- };
80
+ const binding = new PropertyBinding(this, element, name, path, twoWays, valueFunc, source);
81
+ this.bindings.push(binding);
82
+ return {
83
+ dispose: () => {
84
+ binding.dispose();
85
+ ArrayHelper.remove(this.bindings, x => x === binding);
86
+ }
87
+ };
83
88
  }
84
- /**
85
- * Remove all bindings associated with given element and optional name
86
- * @param element T
87
- * @param name string
88
- */
89
89
  unbind(element, name) {
90
- const toDelete = this.bindings.filter((x) => x.element === element && (!name || (x.name === name)));
91
- for (const iterator of toDelete) {
92
- iterator.dispose();
93
- types_1.ArrayHelper.remove(this.bindings, (x) => x === iterator);
94
- }
90
+ const toDelete = this.bindings.filter(x => x.element === element && (!name || x.name === name));
91
+ for (const iterator of toDelete) {
92
+ iterator.dispose();
93
+ ArrayHelper.remove(this.bindings, x => x === iterator);
94
+ }
95
95
  }
96
96
  bindEvent(element, name, method, key, capture) {
97
- if (!element) {
98
- return;
99
- }
100
- if (!method) {
97
+ if (!element) {
98
+ return;
99
+ }
100
+ if (!method) {
101
+ return;
102
+ }
103
+ const be = {
104
+ element,
105
+ name,
106
+ handler: method
107
+ };
108
+ if (key) {
109
+ be.key = key;
110
+ }
111
+ const handler = e => {
112
+ var _c;
113
+ try {
114
+ const r = method(e);
115
+ e.executed = true;
116
+ e.promise = e.promise ? Promise.all([r, e.promise]) : r;
117
+ if (r === null || r === void 0 ? void 0 : r.catch) {
118
+ return r.catch(c => {
119
+ var _c;
120
+ if (CancelToken.isCancelled(c !== null && c !== void 0 ? c : "Unknown error")) {
121
+ return;
122
+ }
123
+ alert((_c = c.stack) !== null && _c !== void 0 ? _c : c);
124
+ });
125
+ }
126
+ return r;
127
+ } catch (error) {
128
+ if (CancelToken.isCancelled(error)) {
101
129
  return;
102
- }
103
- const be = {
104
- element,
105
- name,
106
- handler: method
107
- };
108
- if (key) {
109
- be.key = key;
110
- }
111
- const handler = (e) => {
112
- var _c;
113
- try {
114
- const r = method(e);
115
- e.executed = true;
116
- e.promise = e.promise ? Promise.all([r, e.promise]) : r;
117
- if (r === null || r === void 0 ? void 0 : r.catch) {
118
- return r.catch((c) => {
119
- var _c;
120
- if (types_1.CancelToken.isCancelled(c !== null && c !== void 0 ? c : "Unknown error")) {
121
- return;
122
- }
123
- alert((_c = c.stack) !== null && _c !== void 0 ? _c : c);
124
- });
125
- }
126
- return r;
127
- }
128
- catch (error) {
129
- if (types_1.CancelToken.isCancelled(error)) {
130
- return;
131
- }
132
- alert((_c = error.stack) !== null && _c !== void 0 ? _c : error);
133
- }
134
- };
135
- element.addEventListener(name, handler, capture);
136
- be.disposable = {
137
- dispose: () => {
138
- element.removeEventListener(name, handler, capture);
139
- be.disposable.dispose = () => undefined;
140
- }
141
- };
142
- this.eventHandlers.push(be);
143
- return {
144
- dispose: () => {
145
- be.disposable.dispose();
146
- types_1.ArrayHelper.remove(this.eventHandlers, (e) => e.disposable === be.disposable);
147
- }
148
- };
130
+ }
131
+ alert((_c = error.stack) !== null && _c !== void 0 ? _c : error);
132
+ }
133
+ };
134
+ element.addEventListener(name, handler, capture);
135
+ be.disposable = {
136
+ dispose: () => {
137
+ element.removeEventListener(name, handler, capture);
138
+ be.disposable.dispose = () => undefined;
139
+ }
140
+ };
141
+ this.eventHandlers.push(be);
142
+ return {
143
+ dispose: () => {
144
+ be.disposable.dispose();
145
+ ArrayHelper.remove(this.eventHandlers, e => e.disposable === be.disposable);
146
+ }
147
+ };
149
148
  }
150
149
  unbindEvent(element, name, method, key) {
151
- const deleted = [];
152
- for (const be of this.eventHandlers) {
153
- if (element && be.element !== element) {
154
- return;
155
- }
156
- if (key && be.key !== key) {
157
- return;
158
- }
159
- if (name && be.name !== name) {
160
- return;
161
- }
162
- if (method && be.handler !== method) {
163
- return;
164
- }
165
- be.disposable.dispose();
166
- be.handler = null;
167
- be.element = null;
168
- be.name = null;
169
- be.key = null;
170
- deleted.push(() => this.eventHandlers.remove(be));
171
- }
172
- for (const iterator of deleted) {
173
- iterator();
174
- }
150
+ const deleted = [];
151
+ for (const be of this.eventHandlers) {
152
+ if (element && be.element !== element) {
153
+ return;
154
+ }
155
+ if (key && be.key !== key) {
156
+ return;
157
+ }
158
+ if (name && be.name !== name) {
159
+ return;
160
+ }
161
+ if (method && be.handler !== method) {
162
+ return;
163
+ }
164
+ be.disposable.dispose();
165
+ be.handler = null;
166
+ be.element = null;
167
+ be.name = null;
168
+ be.key = null;
169
+ deleted.push(() => this.eventHandlers.remove(be));
170
+ }
171
+ for (const iterator of deleted) {
172
+ iterator();
173
+ }
175
174
  }
176
- /**
177
- * Control checks if property is declared on the control or not.
178
- * Since TypeScript no longer creates enumerable properties, we have
179
- * to inspect name and PropertyMap which is generated by `@BindableProperty`
180
- * or the value is not set to undefined.
181
- * @param name name of Property
182
- */
183
175
  hasProperty(name) {
184
- if (/^(data|viewModel|localViewModel|element)$/.test(name)) {
185
- return true;
186
- }
187
- const map = PropertyMap_1.PropertyMap.from(this);
188
- if (map.map[name]) {
189
- return true;
190
- }
191
- if (this[name] !== undefined) {
192
- return true;
193
- }
194
- return false;
176
+ if (/^(data|viewModel|localViewModel|element)$/.test(name)) {
177
+ return true;
178
+ }
179
+ const map = PropertyMap.from(this);
180
+ if (map.map[name]) {
181
+ return true;
182
+ }
183
+ if (this[name] !== undefined) {
184
+ return true;
185
+ }
186
+ return false;
195
187
  }
196
- /**
197
- * Use this method if you want to set attribute on HTMLElement immediately but
198
- * defer atom control property
199
- * @param element HTMLElement
200
- * @param name string
201
- * @param value any
202
- */
203
188
  setPrimitiveValue(element, name, value) {
204
- const p = value;
205
- if (p && p.then && p.catch) {
206
- // tslint:disable-next-line: no-console
207
- console.warn(`Do not bind promises, instead use Bind.oneWayAsync`);
208
- this.mPendingPromises[name] = p;
209
- p.then((r) => {
210
- if (this.mPendingPromises[name] !== p) {
211
- return;
212
- }
213
- this.mPendingPromises[name] = null;
214
- this.setPrimitiveValue(element, name, r);
215
- }).catch((e) => {
216
- if (this.mPendingPromises[name] !== p) {
217
- return;
218
- }
219
- this.mPendingPromises[name] = null;
220
- // tslint:disable-next-line:no-console
221
- console.error(e);
222
- });
189
+ const p = value;
190
+ if (p && p.then && p.catch) {
191
+ console.warn(`Do not bind promises, instead use Bind.oneWayAsync`);
192
+ this.mPendingPromises[name] = p;
193
+ p.then(r => {
194
+ if (this.mPendingPromises[name] !== p) {
223
195
  return;
224
- }
225
- if (/^(viewModel|localViewModel)$/.test(name)) {
226
- this[name] = value;
196
+ }
197
+ this.mPendingPromises[name] = null;
198
+ this.setPrimitiveValue(element, name, r);
199
+ }).catch(e => {
200
+ if (this.mPendingPromises[name] !== p) {
227
201
  return;
228
- }
229
- if ((!element || element === this.element) && this.hasProperty(name)) {
230
- this.runAfterInit(() => {
231
- this[name] = value;
232
- });
233
- }
234
- else {
235
- this.setElementValue(element, name, value);
236
- }
202
+ }
203
+ this.mPendingPromises[name] = null;
204
+ console.error(e);
205
+ });
206
+ return;
207
+ }
208
+ if (/^(viewModel|localViewModel)$/.test(name)) {
209
+ this[name] = value;
210
+ return;
211
+ }
212
+ if ((!element || element === this.element) && this.hasProperty(name)) {
213
+ this.runAfterInit(() => {
214
+ this[name] = value;
215
+ });
216
+ } else {
217
+ this.setElementValue(element, name, value);
218
+ }
237
219
  }
238
220
  setLocalValue(element, name, value) {
239
- // if value is a promise
240
- const p = value;
241
- if (p && p.then && p.catch) {
242
- // tslint:disable-next-line: no-console
243
- console.warn(`Do not bind promises, instead use Bind.oneWayAsync`);
244
- this.mPendingPromises[name] = p;
245
- p.then((r) => {
246
- if (this.mPendingPromises[name] !== p) {
247
- return;
248
- }
249
- this.mPendingPromises[name] = null;
250
- this.setLocalValue(element, name, r);
251
- }).catch((e) => {
252
- if (this.mPendingPromises[name] !== p) {
253
- return;
254
- }
255
- this.mPendingPromises[name] = null;
256
- // tslint:disable-next-line:no-console
257
- console.error(e);
258
- });
221
+ const p = value;
222
+ if (p && p.then && p.catch) {
223
+ console.warn(`Do not bind promises, instead use Bind.oneWayAsync`);
224
+ this.mPendingPromises[name] = p;
225
+ p.then(r => {
226
+ if (this.mPendingPromises[name] !== p) {
259
227
  return;
260
- }
261
- if ((!element || element === this.element) && Reflect.has(this, name)) {
262
- this[name] = value;
263
- }
264
- else {
265
- this.setElementValue(element, name, value);
266
- }
267
- }
268
- dispose(e) {
269
- if (this.mInvalidated) {
270
- clearTimeout(this.mInvalidated);
271
- this.mInvalidated = 0;
272
- }
273
- AtomBridge_1.AtomBridge.instance.visitDescendents(e || this.element, (ex, ac) => {
274
- if (ac) {
275
- ac.dispose();
276
- return false;
277
- }
278
- return true;
228
+ }
229
+ this.mPendingPromises[name] = null;
230
+ this.setLocalValue(element, name, r);
231
+ }).catch(e => {
232
+ if (this.mPendingPromises[name] !== p) {
233
+ return;
234
+ }
235
+ this.mPendingPromises[name] = null;
236
+ console.error(e);
279
237
  });
280
- if (!e) {
281
- this.unbindEvent(null, null, null);
282
- for (const binding of this.bindings) {
283
- binding.dispose();
284
- }
285
- this.bindings.length = 0;
286
- this.bindings = null;
287
- // AtomBridge.instance.dispose(this.element);
288
- const e1 = this.element;
289
- if (typeof e1.dispose === "function") {
290
- e1.dispose();
291
- }
292
- this.element = null;
293
- const lvm = this.localViewModel;
294
- if (lvm && lvm.dispose) {
295
- lvm.dispose();
296
- this.localViewModel = null;
297
- }
298
- const vm = this.viewModel;
299
- if (vm && vm.dispose) {
300
- vm.dispose();
301
- this.viewModel = null;
302
- }
303
- this.disposables.dispose();
304
- this.pendingInits = null;
305
- }
238
+ return;
239
+ }
240
+ if ((!element || element === this.element) && Reflect.has(this, name)) {
241
+ this[name] = value;
242
+ } else {
243
+ this.setElementValue(element, name, value);
244
+ }
306
245
  }
307
- // tslint:disable-next-line:no-empty
308
- onPropertyChanged(name) {
246
+ dispose(e) {
247
+ if (this.mInvalidated) {
248
+ clearTimeout(this.mInvalidated);
249
+ this.mInvalidated = 0;
250
+ }
251
+ AtomBridge.instance.visitDescendents(e || this.element, (ex, ac) => {
252
+ if (ac) {
253
+ ac.dispose();
254
+ return false;
255
+ }
256
+ return true;
257
+ });
258
+ if (!e) {
259
+ this.unbindEvent(null, null, null);
260
+ for (const binding of this.bindings) {
261
+ binding.dispose();
262
+ }
263
+ this.bindings.length = 0;
264
+ this.bindings = null;
265
+ const e1 = this.element;
266
+ if (typeof e1.dispose === "function") {
267
+ e1.dispose();
268
+ }
269
+ this.element = null;
270
+ const lvm = this.localViewModel;
271
+ if (lvm && lvm.dispose) {
272
+ lvm.dispose();
273
+ this.localViewModel = null;
274
+ }
275
+ const vm = this.viewModel;
276
+ if (vm && vm.dispose) {
277
+ vm.dispose();
278
+ this.viewModel = null;
279
+ }
280
+ this.disposables.dispose();
281
+ this.pendingInits = null;
282
+ }
309
283
  }
284
+ onPropertyChanged(name) {}
310
285
  beginEdit() {
311
- this.pendingInits = [];
312
- const a = this.pendingInits;
313
- return {
314
- dispose: () => {
315
- if (this.pendingInits == null) {
316
- // case where current control is disposed...
317
- return;
318
- }
319
- this.pendingInits = null;
320
- if (a) {
321
- for (const iterator of a) {
322
- iterator();
323
- }
324
- }
325
- this.invalidate();
286
+ this.pendingInits = [];
287
+ const a = this.pendingInits;
288
+ return {
289
+ dispose: () => {
290
+ if (this.pendingInits == null) {
291
+ return;
292
+ }
293
+ this.pendingInits = null;
294
+ if (a) {
295
+ for (const iterator of a) {
296
+ iterator();
326
297
  }
327
- };
328
- }
329
- invalidate() {
330
- if (this.mInvalidated) {
331
- clearTimeout(this.mInvalidated);
298
+ }
299
+ this.invalidate();
332
300
  }
333
- this.mInvalidated = setTimeout(() => {
334
- this.mInvalidated = 0;
335
- this.app.callLater(() => {
336
- this.onUpdateUI();
337
- });
338
- }, 5);
301
+ };
339
302
  }
340
- onUpdateUI() {
341
- // for implementors..
303
+ invalidate() {
304
+ if (this.mInvalidated) {
305
+ clearTimeout(this.mInvalidated);
306
+ }
307
+ this.mInvalidated = setTimeout(() => {
308
+ this.mInvalidated = 0;
309
+ this.app.callLater(() => {
310
+ this.onUpdateUI();
311
+ });
312
+ }, 5);
342
313
  }
314
+ onUpdateUI() {}
343
315
  runAfterInit(f) {
344
- if (this.pendingInits) {
345
- this.pendingInits.push(f);
346
- }
347
- else {
348
- f();
349
- }
316
+ if (this.pendingInits) {
317
+ this.pendingInits.push(f);
318
+ } else {
319
+ f();
320
+ }
350
321
  }
351
322
  registerDisposable(d) {
352
- return this.disposables.add(d);
323
+ return this.disposables.add(d);
353
324
  }
354
325
  render(node, e = this.element, creator = this) {
355
- const app = this.app;
356
- const attr = node.attributes;
357
- if (attr) {
358
- for (const key in attr) {
359
- if (attr.hasOwnProperty(key)) {
360
- const item = attr[key];
361
- const isObject = typeof item === "object";
362
- // a bug in JavaScript, null is an object
363
- if (isObject && item !== null) {
364
- const localSymbol = item[localBindSymbol];
365
- if (localSymbol) {
366
- localSymbol(key, this, e, creator);
367
- continue;
368
- }
369
- const localXNode = item[localXNodeSymbol];
370
- if (localXNode) {
371
- if (item.isTemplate) {
372
- this.setLocalValue(e, key, this.toTemplate(app, item, creator));
373
- continue;
374
- }
375
- this.setLocalValue(e, key, this.createNode(app, null, item, creator));
376
- continue;
377
- }
378
- }
379
- this.setLocalValue(e, key, item);
380
- }
381
- }
382
- }
383
- const children = node.children;
384
- if (children === void 0) {
385
- return;
386
- }
387
- for (const iterator of children) {
388
- if (!iterator) {
389
- continue;
390
- }
391
- if (typeof iterator === "string") {
392
- e.appendChild(document.createTextNode(iterator));
326
+ const app = this.app;
327
+ const attr = node.attributes;
328
+ if (attr) {
329
+ for (const key in attr) {
330
+ if (attr.hasOwnProperty(key)) {
331
+ const item = attr[key];
332
+ const isObject = typeof item === "object";
333
+ if (isObject && item !== null) {
334
+ const localSymbol = item[localBindSymbol];
335
+ if (localSymbol) {
336
+ localSymbol(key, this, e, creator);
393
337
  continue;
394
- }
395
- if (iterator.isProperty) {
396
- if (iterator.isTemplate) {
397
- this.setLocalValue(e, iterator.name, this.toTemplate(app, iterator.children[0], creator));
398
- continue;
338
+ }
339
+ const localXNode = item[localXNodeSymbol];
340
+ if (localXNode) {
341
+ if (item.isTemplate) {
342
+ this.setLocalValue(e, key, this.toTemplate(app, item, creator));
343
+ continue;
399
344
  }
400
- this.createNode(app, e, iterator, creator);
345
+ this.setLocalValue(e, key, this.createNode(app, null, item, creator));
401
346
  continue;
402
- }
403
- // if (iterator.isProperty) {
404
- // for (const child of iterator.children) {
405
- // // this case of Xamarin Forms only..
406
- // const e1 = this.createNode(app, null, child, creator);
407
- // this.setLocalValue(e, iterator.name, e1);
408
- // // const childName = child.name;
409
- // // if (childName[isControl]) {
410
- // // const c1 = new (childName)(this.app);
411
- // // c1.render(child, c1.element, creator);
412
- // // (localBridge as any).instance.append(e, iterator.name, c1.element);
413
- // // continue;
414
- // // }
415
- // // const c2 = new (childName)();
416
- // // this.render(child, c2, creator);
417
- // // (localBridge as any).instance.append(e, iterator.name, c2);
418
- // // const pc = AtomBridge.createNode(child, app);
419
- // // (pc.control || this).render(child, pc.element, creator);
420
- // // // in Xamarin.Forms certain properties are required to be
421
- // // // set in advance, so we append the element after setting
422
- // // // all children properties
423
- // // (localBridge as any).instance.append(e, iterator.name, pc.element);
424
- // }
425
- // continue;
426
- // }
427
- const t = iterator.attributes && iterator.attributes.template;
428
- if (t) {
429
- console.warn(`This path is deprecated, check who is calling it.`);
430
- this.setLocalValue(e, t, this.toTemplate(app, iterator, creator));
431
- continue;
432
- }
433
- this.createNode(app, e, iterator, creator);
434
- }
347
+ }
348
+ }
349
+ this.setLocalValue(e, key, item);
350
+ }
351
+ }
352
+ }
353
+ const children = node.children;
354
+ if (children === void 0) {
355
+ return;
356
+ }
357
+ for (const iterator of children) {
358
+ if (!iterator) {
359
+ continue;
360
+ }
361
+ if (typeof iterator === "string") {
362
+ e.appendChild(document.createTextNode(iterator));
363
+ continue;
364
+ }
365
+ if (iterator.isProperty) {
366
+ if (iterator.isTemplate) {
367
+ this.setLocalValue(e, iterator.name, this.toTemplate(app, iterator.children[0], creator));
368
+ continue;
369
+ }
370
+ this.createNode(app, e, iterator, creator);
371
+ continue;
372
+ }
373
+ const t = iterator.attributes && iterator.attributes.template;
374
+ if (t) {
375
+ console.warn(`This path is deprecated, check who is calling it.`);
376
+ this.setLocalValue(e, t, this.toTemplate(app, iterator, creator));
377
+ continue;
378
+ }
379
+ this.createNode(app, e, iterator, creator);
380
+ }
435
381
  }
436
382
  extractControlProperties(x, name = "div") {
437
- const a = x.attributes;
438
- const extracted = {};
439
- if (typeof x.name === "function" && this instanceof x.name) {
440
- x.name = name;
441
- }
442
- if (a) {
443
- for (const key in a) {
444
- if (Object.prototype.hasOwnProperty.call(a, key)) {
445
- if (Reflect.has(this, key)) {
446
- const element = a[key];
447
- extracted[key] = element;
448
- delete a[key];
449
- }
450
- }
451
- }
452
- }
453
- return extracted;
454
- }
455
- // tslint:disable-next-line:no-empty
456
- create() {
457
- }
458
- // tslint:disable-next-line:no-empty
459
- preCreate() {
383
+ const a = x.attributes;
384
+ const extracted = {};
385
+ if (typeof x.name === "function" && this instanceof x.name) {
386
+ x.name = name;
387
+ }
388
+ if (a) {
389
+ for (const key in a) {
390
+ if (Object.prototype.hasOwnProperty.call(a, key)) {
391
+ if (Reflect.has(this, key)) {
392
+ const element = a[key];
393
+ extracted[key] = element;
394
+ delete a[key];
395
+ }
396
+ }
397
+ }
398
+ }
399
+ return extracted;
460
400
  }
401
+ create() {}
402
+ preCreate() {}
461
403
  setElementValue(element, name, value) {
462
- AtomBridge_1.AtomBridge.instance.setValue(element, name, value);
404
+ AtomBridge.instance.setValue(element, name, value);
463
405
  }
464
406
  resolve(c, selfName) {
465
- const result = this.app.resolve(c, true);
466
- if (selfName) {
467
- if (typeof selfName === "function") {
468
- // this is required as parent is not available
469
- // in items control so binding becomes difficult
470
- this.runAfterInit(() => {
471
- const v = selfName();
472
- if (v) {
473
- for (const key in v) {
474
- if (v.hasOwnProperty(key)) {
475
- const element = v[key];
476
- result[key] = element;
477
- }
478
- }
479
- }
480
- });
481
- }
482
- else {
483
- result[selfName] = this;
484
- }
485
- }
486
- return result;
487
- }
488
- };
489
- _a = XNode_1.isControl, _b = XNode_1.isFactorySymbol;
490
- AtomComponent[_a] = true;
491
- AtomComponent[_b] = true;
492
- __decorate([
493
- InheritedProperty_1.InheritedProperty,
494
- __metadata("design:type", Object)
495
- ], AtomComponent.prototype, "data", void 0);
496
- __decorate([
497
- InheritedProperty_1.InheritedProperty,
498
- __metadata("design:type", Object)
499
- ], AtomComponent.prototype, "viewModel", void 0);
500
- __decorate([
501
- InheritedProperty_1.InheritedProperty,
502
- __metadata("design:type", Object)
503
- ], AtomComponent.prototype, "localViewModel", void 0);
504
- AtomComponent = __decorate([
505
- __param(0, Inject_1.Inject),
506
- __metadata("design:paramtypes", [App_1.App, Object])
507
- ], AtomComponent);
508
- exports.AtomComponent = AtomComponent;
509
- class PropertyBinding {
510
- constructor(target, element, name, path, twoWays, valueFunc, source) {
511
- this.target = target;
512
- this.element = element;
513
- this.name = name;
514
- this.twoWays = twoWays;
515
- this.source = source;
516
- this.isTwoWaySetup = false;
517
- this.name = name;
518
- this.twoWays = twoWays;
519
- this.target = target;
520
- this.element = element;
521
- this.isRunning = false;
522
- if (valueFunc) {
523
- if (typeof valueFunc !== "function") {
524
- this.fromSourceToTarget = valueFunc.fromSource;
525
- this.fromTargetToSource = valueFunc.fromTarget;
526
- }
527
- else {
528
- this.fromSourceToTarget = valueFunc;
529
- }
530
- }
531
- this.watcher = new AtomWatcher_1.AtomWatcher(target, path, (...v) => {
532
- if (this.isRunning) {
533
- return;
534
- }
535
- if (this.disposed) {
536
- return;
537
- }
538
- // set value
539
- for (const iterator of v) {
540
- if (iterator === undefined) {
541
- return;
542
- }
543
- }
544
- const cv = this.fromSourceToTarget ? this.fromSourceToTarget.apply(this, v) : v[0];
545
- if (cv === types_1.ignoreValue) {
546
- return;
547
- }
548
- this.isRunning = true;
549
- try {
550
- if (this.target instanceof AtomComponent) {
551
- this.target.setLocalValue(this.element, this.name, cv);
552
- }
553
- else {
554
- this.target[name] = cv;
555
- }
556
- }
557
- finally {
558
- this.isRunning = false;
559
- }
560
- }, source);
561
- this.path = this.watcher.path;
562
- if (this.target instanceof AtomComponent) {
563
- this.target.runAfterInit(() => {
564
- if (!this.watcher) {
565
- // this is disposed ...
566
- return;
567
- }
568
- this.watcher.init(true);
569
- if (twoWays) {
570
- this.setupTwoWayBinding();
571
- }
572
- });
573
- }
574
- else {
575
- this.watcher.init(true);
576
- if (twoWays) {
577
- this.setupTwoWayBinding();
578
- }
579
- }
580
- }
581
- setupTwoWayBinding() {
582
- if (this.target instanceof AtomComponent) {
583
- if (this.element
584
- && (this.element !== this.target.element || !this.target.hasProperty(this.name))) {
585
- // most likely it has change event..
586
- let events = [];
587
- if (typeof this.twoWays !== "boolean") {
588
- events = this.twoWays;
407
+ const result = this.app.resolve(c, true);
408
+ if (selfName) {
409
+ if (typeof selfName === "function") {
410
+ this.runAfterInit(() => {
411
+ const v = selfName();
412
+ if (v) {
413
+ for (const key in v) {
414
+ if (v.hasOwnProperty(key)) {
415
+ const element = v[key];
416
+ result[key] = element;
589
417
  }
590
- this.twoWaysDisposable = AtomBridge_1.AtomBridge.instance.watchProperty(this.element, this.name, events, (v) => {
591
- this.setInverseValue(v);
592
- });
593
- return;
418
+ }
594
419
  }
420
+ });
421
+ } else {
422
+ result[selfName] = this;
595
423
  }
596
- const watcher = new AtomWatcher_1.AtomWatcher(this.target, [[this.name]], (...values) => {
597
- if (this.isTwoWaySetup) {
598
- this.setInverseValue(values[0]);
599
- }
600
- });
601
- watcher.init(true);
602
- this.isTwoWaySetup = true;
603
- this.twoWaysDisposable = watcher;
424
+ }
425
+ return result;
604
426
  }
605
- setInverseValue(value) {
606
- if (!this.twoWays) {
607
- throw new Error("This Binding is not two ways.");
427
+ });
428
+ _a = isControl, _b = isFactorySymbol;
429
+ AtomComponent[_a] = true;
430
+ AtomComponent[_b] = true;
431
+ __decorate([InheritedProperty, __metadata("design:type", Object)], AtomComponent.prototype, "data", void 0);
432
+ __decorate([InheritedProperty, __metadata("design:type", Object)], AtomComponent.prototype, "viewModel", void 0);
433
+ __decorate([InheritedProperty, __metadata("design:type", Object)], AtomComponent.prototype, "localViewModel", void 0);
434
+ _export("AtomComponent", AtomComponent = __decorate([__param(0, Inject), __metadata("design:paramtypes", [App, Object])], AtomComponent));
435
+ _export("PropertyBinding", PropertyBinding = class PropertyBinding {
436
+ constructor(target, element, name, path, twoWays, valueFunc, source) {
437
+ this.target = target;
438
+ this.element = element;
439
+ this.name = name;
440
+ this.twoWays = twoWays;
441
+ this.source = source;
442
+ this.isTwoWaySetup = false;
443
+ this.name = name;
444
+ this.twoWays = twoWays;
445
+ this.target = target;
446
+ this.element = element;
447
+ this.isRunning = false;
448
+ if (valueFunc) {
449
+ if (typeof valueFunc !== "function") {
450
+ this.fromSourceToTarget = valueFunc.fromSource;
451
+ this.fromTargetToSource = valueFunc.fromTarget;
452
+ } else {
453
+ this.fromSourceToTarget = valueFunc;
454
+ }
455
+ }
456
+ this.watcher = new AtomWatcher(target, path, (...v) => {
457
+ if (this.isRunning) {
458
+ return;
608
459
  }
609
460
  if (this.disposed) {
610
- return;
461
+ return;
611
462
  }
612
- if (this.isRunning) {
463
+ for (const iterator of v) {
464
+ if (iterator === undefined) {
613
465
  return;
466
+ }
467
+ }
468
+ const cv = this.fromSourceToTarget ? this.fromSourceToTarget.apply(this, v) : v[0];
469
+ if (cv === ignoreValue) {
470
+ return;
614
471
  }
615
472
  this.isRunning = true;
616
473
  try {
617
- const first = this.path[0];
618
- const length = first.length;
619
- let v = this.target;
620
- let i = 0;
621
- let name;
622
- for (i = 0; i < length - 1; i++) {
623
- name = first[i].name;
624
- if (name === "this") {
625
- v = this.source || this.target;
626
- }
627
- else {
628
- v = v[name];
629
- }
630
- if (!v) {
631
- return;
632
- }
633
- }
634
- name = first[i].name;
635
- v[name] = this.fromTargetToSource ? this.fromTargetToSource.call(this, value) : value;
474
+ if (this.target instanceof AtomComponent) {
475
+ this.target.setLocalValue(this.element, this.name, cv);
476
+ } else {
477
+ this.target[name] = cv;
478
+ }
479
+ } finally {
480
+ this.isRunning = false;
481
+ }
482
+ }, source);
483
+ this.path = this.watcher.path;
484
+ if (this.target instanceof AtomComponent) {
485
+ this.target.runAfterInit(() => {
486
+ if (!this.watcher) {
487
+ return;
488
+ }
489
+ this.watcher.init(true);
490
+ if (twoWays) {
491
+ this.setupTwoWayBinding();
492
+ }
493
+ });
494
+ } else {
495
+ this.watcher.init(true);
496
+ if (twoWays) {
497
+ this.setupTwoWayBinding();
636
498
  }
637
- finally {
638
- this.isRunning = false;
499
+ }
500
+ }
501
+ setupTwoWayBinding() {
502
+ if (this.target instanceof AtomComponent) {
503
+ if (this.element && (this.element !== this.target.element || !this.target.hasProperty(this.name))) {
504
+ let events = [];
505
+ if (typeof this.twoWays !== "boolean") {
506
+ events = this.twoWays;
507
+ }
508
+ this.twoWaysDisposable = AtomBridge.instance.watchProperty(this.element, this.name, events, v => {
509
+ this.setInverseValue(v);
510
+ });
511
+ return;
512
+ }
513
+ }
514
+ const watcher = new AtomWatcher(this.target, [[this.name]], (...values) => {
515
+ if (this.isTwoWaySetup) {
516
+ this.setInverseValue(values[0]);
517
+ }
518
+ });
519
+ watcher.init(true);
520
+ this.isTwoWaySetup = true;
521
+ this.twoWaysDisposable = watcher;
522
+ }
523
+ setInverseValue(value) {
524
+ if (!this.twoWays) {
525
+ throw new Error("This Binding is not two ways.");
526
+ }
527
+ if (this.disposed) {
528
+ return;
529
+ }
530
+ if (this.isRunning) {
531
+ return;
532
+ }
533
+ this.isRunning = true;
534
+ try {
535
+ const first = this.path[0];
536
+ const length = first.length;
537
+ let v = this.target;
538
+ let i = 0;
539
+ let name;
540
+ for (i = 0; i < length - 1; i++) {
541
+ name = first[i].name;
542
+ if (name === "this") {
543
+ v = this.source || this.target;
544
+ } else {
545
+ v = v[name];
546
+ }
547
+ if (!v) {
548
+ return;
549
+ }
639
550
  }
551
+ name = first[i].name;
552
+ v[name] = this.fromTargetToSource ? this.fromTargetToSource.call(this, value) : value;
553
+ } finally {
554
+ this.isRunning = false;
555
+ }
640
556
  }
641
557
  dispose() {
642
- var _c;
643
- (_c = this.twoWaysDisposable) === null || _c === void 0 ? void 0 : _c.dispose();
644
- this.twoWaysDisposable = undefined;
645
- this.watcher.dispose();
646
- this.disposed = true;
647
- this.watcher = null;
558
+ var _c;
559
+ (_c = this.twoWaysDisposable) === null || _c === void 0 ? void 0 : _c.dispose();
560
+ this.twoWaysDisposable = undefined;
561
+ this.watcher.dispose();
562
+ this.disposed = true;
563
+ this.watcher = null;
648
564
  }
565
+ });
649
566
  }
650
- exports.PropertyBinding = PropertyBinding;
651
- });
652
- //# sourceMappingURL=AtomComponent.js.map
567
+ };
568
+ });
569
+ //# sourceMappingURL=/home/runner/work/core/core/dist/core/AtomComponent.js.map