jpf 5.0.3 → 5.0.7

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 (292) hide show
  1. package/dist/controls/codeMirror/Editor/Editor.d.ts +19 -0
  2. package/dist/controls/codeMirror/Editor/Editor.js +151 -0
  3. package/dist/controls/codeMirror/Editor/Editor.js.map +1 -0
  4. package/dist/controls/codeMirror/index.d.ts +1 -2
  5. package/dist/controls/codeMirror/index.js +1 -2
  6. package/dist/controls/codeMirror/index.js.map +1 -1
  7. package/dist/controls/custom/FileSelector/FileSelector.d.ts +18 -18
  8. package/dist/controls/custom/FileSelector/FileSelector.js +47 -46
  9. package/dist/controls/custom/FileSelector/FileSelector.js.map +1 -1
  10. package/dist/controls/custom/LabeledControl/LabeledControl.d.ts +15 -15
  11. package/dist/controls/custom/LabeledControl/LabeledControl.js +31 -36
  12. package/dist/controls/custom/LabeledControl/LabeledControl.js.map +1 -1
  13. package/dist/controls/custom/ListItem/ListItem.d.ts +37 -36
  14. package/dist/controls/custom/ListItem/ListItem.js +62 -62
  15. package/dist/controls/custom/ListItem/ListItem.js.map +1 -1
  16. package/dist/controls/custom/index.d.ts +3 -3
  17. package/dist/controls/custom/index.js +3 -3
  18. package/dist/controls/html/Button/Button.d.ts +16 -16
  19. package/dist/controls/html/Button/Button.js +47 -50
  20. package/dist/controls/html/Button/Button.js.map +1 -1
  21. package/dist/controls/html/Div/Div.d.ts +14 -14
  22. package/dist/controls/html/Div/Div.js +23 -24
  23. package/dist/controls/html/Div/Div.js.map +1 -1
  24. package/dist/controls/html/Image/Image.d.ts +16 -16
  25. package/dist/controls/html/Image/Image.js +29 -28
  26. package/dist/controls/html/Image/Image.js.map +1 -1
  27. package/dist/controls/html/Input/Input.d.ts +34 -34
  28. package/dist/controls/html/Input/Input.js +166 -170
  29. package/dist/controls/html/Input/Input.js.map +1 -1
  30. package/dist/controls/html/Select/Select.d.ts +30 -30
  31. package/dist/controls/html/Select/Select.js +109 -110
  32. package/dist/controls/html/Select/Select.js.map +1 -1
  33. package/dist/controls/html/Span/Span.d.ts +11 -11
  34. package/dist/controls/html/Span/Span.js +22 -22
  35. package/dist/controls/html/Span/Span.js.map +1 -1
  36. package/dist/controls/html/index.d.ts +6 -6
  37. package/dist/controls/html/index.js +6 -6
  38. package/dist/controls/index.d.ts +14 -14
  39. package/dist/controls/index.js +14 -14
  40. package/dist/controls/index.js.map +1 -1
  41. package/dist/controls/{jsonViewAwesome → jsonViewerAwesome}/index.d.ts +1 -1
  42. package/dist/controls/{jsonViewAwesome → jsonViewerAwesome}/index.js +1 -1
  43. package/dist/controls/jsonViewerAwesome/index.js.map +1 -0
  44. package/dist/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.d.ts +28 -0
  45. package/dist/controls/{jsonViewAwesome → jsonViewerAwesome}/jsonFormatter/JsonFormatter.js +65 -65
  46. package/dist/controls/jsonViewerAwesome/jsonFormatter/JsonFormatter.js.map +1 -0
  47. package/dist/controls/kendo/Chart/Chart.d.ts +19 -19
  48. package/dist/controls/kendo/Chart/Chart.js +62 -62
  49. package/dist/controls/kendo/Chart/Chart.js.map +1 -1
  50. package/dist/controls/kendo/Culture/Culture.d.ts +1 -1
  51. package/dist/controls/kendo/Culture/Culture.js +25 -25
  52. package/dist/controls/kendo/Culture/Culture.js.map +1 -1
  53. package/dist/controls/kendo/DataSource/DataSource.d.ts +4 -4
  54. package/dist/controls/kendo/DataSource/DataSource.js +1 -1
  55. package/dist/controls/kendo/Editor/Editor.d.ts +14 -19
  56. package/dist/controls/kendo/Editor/Editor.js +94 -104
  57. package/dist/controls/kendo/Editor/Editor.js.map +1 -1
  58. package/dist/controls/kendo/Grid/Grid.d.ts +54 -54
  59. package/dist/controls/kendo/Grid/Grid.js +201 -218
  60. package/dist/controls/kendo/Grid/Grid.js.map +1 -1
  61. package/dist/controls/kendo/Menu/Menu.d.ts +15 -15
  62. package/dist/controls/kendo/Menu/Menu.js +90 -90
  63. package/dist/controls/kendo/Menu/Menu.js.map +1 -1
  64. package/dist/controls/kendo/ObservableObject/ObservableObject.d.ts +0 -5
  65. package/dist/controls/kendo/ObservableObject/ObservableObject.js +0 -34
  66. package/dist/controls/kendo/ObservableObject/ObservableObject.js.map +1 -1
  67. package/dist/controls/kendo/Treeview/Treeview.d.ts +17 -0
  68. package/dist/controls/kendo/{Tree/Tree.js → Treeview/Treeview.js} +107 -107
  69. package/dist/controls/kendo/Treeview/Treeview.js.map +1 -0
  70. package/dist/controls/kendo/Window/Window.d.ts +14 -0
  71. package/dist/controls/kendo/{Dialog/Dialog.js → Window/Window.js} +49 -49
  72. package/dist/controls/kendo/Window/Window.js.map +1 -0
  73. package/dist/controls/kendo/index.d.ts +8 -9
  74. package/dist/controls/kendo/index.js +8 -9
  75. package/dist/controls/kendo/index.js.map +1 -1
  76. package/dist/controls/leaflet/LabelControl/LabelControl.d.ts +12 -12
  77. package/dist/controls/leaflet/LabelControl/LabelControl.js +33 -33
  78. package/dist/controls/leaflet/LabelControl/LabelControl.js.map +1 -1
  79. package/dist/controls/leaflet/Map/Map.d.ts +45 -45
  80. package/dist/controls/leaflet/Map/Map.js +116 -115
  81. package/dist/controls/leaflet/Map/Map.js.map +1 -1
  82. package/dist/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.d.ts +8 -8
  83. package/dist/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.js +13 -13
  84. package/dist/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.js.map +1 -1
  85. package/dist/controls/leaflet/PointerEvent/PointerEvent.d.ts +2 -2
  86. package/dist/controls/leaflet/PointerEvent/PointerEvent.js +7 -7
  87. package/dist/controls/leaflet/PointerEvent/PointerEvent.js.map +1 -1
  88. package/dist/controls/leaflet/index.d.ts +4 -4
  89. package/dist/controls/leaflet/index.js +4 -4
  90. package/dist/controls/svg/Circle/Circle.d.ts +12 -12
  91. package/dist/controls/svg/Circle/Circle.js +20 -20
  92. package/dist/controls/svg/Circle/Circle.js.map +1 -1
  93. package/dist/controls/svg/Ellipse/Ellipse.d.ts +13 -13
  94. package/dist/controls/svg/Ellipse/Ellipse.js +21 -21
  95. package/dist/controls/svg/Ellipse/Ellipse.js.map +1 -1
  96. package/dist/controls/svg/ForeignObject/ForeignObject.d.ts +15 -14
  97. package/dist/controls/svg/ForeignObject/ForeignObject.js +21 -22
  98. package/dist/controls/svg/ForeignObject/ForeignObject.js.map +1 -1
  99. package/dist/controls/svg/Group/Group.d.ts +15 -14
  100. package/dist/controls/svg/Group/Group.js +21 -22
  101. package/dist/controls/svg/Group/Group.js.map +1 -1
  102. package/dist/controls/svg/Line/Line.d.ts +13 -13
  103. package/dist/controls/svg/Line/Line.js +21 -21
  104. package/dist/controls/svg/Line/Line.js.map +1 -1
  105. package/dist/controls/svg/Pattern/Pattern.d.ts +22 -22
  106. package/dist/controls/svg/Pattern/Pattern.js +22 -23
  107. package/dist/controls/svg/Pattern/Pattern.js.map +1 -1
  108. package/dist/controls/svg/Polygon/Polygon.d.ts +11 -11
  109. package/dist/controls/svg/Polygon/Polygon.js +20 -20
  110. package/dist/controls/svg/Polygon/Polygon.js.map +1 -1
  111. package/dist/controls/svg/Polyline/Polyline.d.ts +11 -11
  112. package/dist/controls/svg/Polyline/Polyline.js +19 -19
  113. package/dist/controls/svg/Polyline/Polyline.js.map +1 -1
  114. package/dist/controls/svg/Rectangle/Rectangle.d.ts +13 -13
  115. package/dist/controls/svg/Rectangle/Rectangle.js +21 -21
  116. package/dist/controls/svg/Rectangle/Rectangle.js.map +1 -1
  117. package/dist/controls/svg/Svg/Svg.d.ts +17 -17
  118. package/dist/controls/svg/Svg/Svg.js +23 -24
  119. package/dist/controls/svg/Svg/Svg.js.map +1 -1
  120. package/dist/controls/svg/Text/Text.d.ts +14 -14
  121. package/dist/controls/svg/Text/Text.js +22 -22
  122. package/dist/controls/svg/Text/Text.js.map +1 -1
  123. package/dist/controls/svg/Title/Title.d.ts +10 -10
  124. package/dist/controls/svg/Title/Title.js +16 -16
  125. package/dist/controls/svg/Title/Title.js.map +1 -1
  126. package/dist/controls/svg/index.d.ts +13 -13
  127. package/dist/controls/svg/index.js +13 -13
  128. package/dist/controls/svg/svg.d.ts +6 -6
  129. package/dist/controls/svg/svg.js +12 -12
  130. package/dist/controls/svg/svg.js.map +1 -1
  131. package/dist/framework/attributes.d.ts +90 -90
  132. package/dist/framework/attributes.js +1 -1
  133. package/dist/framework/{View.d.ts → element.d.ts} +61 -62
  134. package/dist/framework/{View.js → element.js} +157 -150
  135. package/dist/framework/element.js.map +1 -0
  136. package/dist/framework/event.d.ts +80 -80
  137. package/dist/framework/event.js +25 -25
  138. package/dist/framework/event.js.map +1 -1
  139. package/dist/framework/observable.d.ts +37 -12
  140. package/dist/framework/observable.js +66 -58
  141. package/dist/framework/observable.js.map +1 -1
  142. package/dist/framework/properties.d.ts +40 -0
  143. package/dist/framework/{ViewModel.js → properties.js} +303 -312
  144. package/dist/framework/properties.js.map +1 -0
  145. package/dist/framework/root.d.ts +9 -0
  146. package/dist/framework/root.js +38 -0
  147. package/dist/framework/root.js.map +1 -0
  148. package/dist/framework/style.d.ts +657 -658
  149. package/dist/framework/style.js +146 -153
  150. package/dist/framework/style.js.map +1 -1
  151. package/dist/framework/types.d.ts +87 -87
  152. package/dist/framework/types.js +1 -1
  153. package/dist/index.d.ts +12 -12
  154. package/dist/index.js +12 -12
  155. package/dist/index.js.map +1 -1
  156. package/dist/utilities/blob/blob.d.ts +1 -1
  157. package/dist/utilities/blob/blob.js +17 -17
  158. package/dist/utilities/blob/blob.js.map +1 -1
  159. package/dist/utilities/contextMenu/contextMenu.d.ts +2 -0
  160. package/dist/utilities/contextMenu/contextMenu.js +11 -0
  161. package/dist/utilities/contextMenu/contextMenu.js.map +1 -0
  162. package/dist/utilities/cookie/cookie.d.ts +3 -3
  163. package/dist/utilities/cookie/cookie.js +26 -26
  164. package/dist/utilities/cookie/cookie.js.map +1 -1
  165. package/dist/utilities/dataReaderTable/dataReaderTable.d.ts +9 -9
  166. package/dist/utilities/dataReaderTable/dataReaderTable.js +23 -23
  167. package/dist/utilities/dataReaderTable/dataReaderTable.js.map +1 -1
  168. package/dist/utilities/fetch/fetch.d.ts +7 -8
  169. package/dist/utilities/fetch/fetch.js +139 -137
  170. package/dist/utilities/fetch/fetch.js.map +1 -1
  171. package/dist/utilities/float/float.d.ts +1 -1
  172. package/dist/utilities/float/float.js +3 -3
  173. package/dist/utilities/formData/formData.d.ts +1 -1
  174. package/dist/utilities/formData/formData.js +11 -11
  175. package/dist/utilities/formData/formData.js.map +1 -1
  176. package/dist/utilities/formatting/formatting.d.ts +4 -0
  177. package/dist/utilities/formatting/formatting.js +26 -0
  178. package/dist/utilities/formatting/formatting.js.map +1 -0
  179. package/dist/utilities/htmlElement/htmlElement.d.ts +1 -1
  180. package/dist/utilities/htmlElement/htmlElement.js +16 -16
  181. package/dist/utilities/htmlElement/htmlElement.js.map +1 -1
  182. package/dist/utilities/image/image.d.ts +1 -1
  183. package/dist/utilities/image/image.js +1 -1
  184. package/dist/utilities/index.d.ts +40 -36
  185. package/dist/utilities/index.js +40 -36
  186. package/dist/utilities/index.js.map +1 -1
  187. package/dist/utilities/integer/integer.d.ts +3 -3
  188. package/dist/utilities/integer/integer.js +27 -27
  189. package/dist/utilities/integer/integer.js.map +1 -1
  190. package/dist/utilities/key/key.d.ts +2 -2
  191. package/dist/utilities/key/key.js +6 -6
  192. package/dist/utilities/navigator/navigator.d.ts +1 -1
  193. package/dist/utilities/navigator/navigator.js +8 -8
  194. package/dist/utilities/navigator/navigator.js.map +1 -1
  195. package/dist/utilities/notification/notification.d.ts +5 -5
  196. package/dist/utilities/notification/notification.js +66 -66
  197. package/dist/utilities/notification/notification.js.map +1 -1
  198. package/dist/utilities/querystring/querystring.d.ts +6 -6
  199. package/dist/utilities/querystring/querystring.js +53 -53
  200. package/dist/utilities/querystring/querystring.js.map +1 -1
  201. package/dist/utilities/router/router.d.ts +19 -19
  202. package/dist/utilities/router/router.js +80 -80
  203. package/dist/utilities/router/router.js.map +1 -1
  204. package/dist/utilities/stylesheet/stylesheet.d.ts +2 -2
  205. package/dist/utilities/stylesheet/stylesheet.js +47 -47
  206. package/dist/utilities/stylesheet/stylesheet.js.map +1 -1
  207. package/dist/utilities/uniqueId/uniqueId.d.ts +1 -1
  208. package/dist/utilities/uniqueId/uniqueId.js +4 -4
  209. package/dist/{framework → utilities/userAgent}/userAgent.d.ts +31 -31
  210. package/dist/{framework → utilities/userAgent}/userAgent.js +46 -46
  211. package/dist/utilities/userAgent/userAgent.js.map +1 -0
  212. package/dist/utilities/webSocket/webSocket.d.ts +1 -1
  213. package/dist/utilities/webSocket/webSocket.js +54 -54
  214. package/dist/utilities/webSocket/webSocket.js.map +1 -1
  215. package/package.json +15 -11
  216. package/src/controls/codeMirror/Editor/Editor.ts +207 -0
  217. package/src/controls/codeMirror/index.ts +1 -2
  218. package/src/controls/custom/FileSelector/FileSelector.ts +30 -28
  219. package/src/controls/custom/LabeledControl/LabeledControl.ts +32 -36
  220. package/src/controls/custom/ListItem/ListItem.ts +37 -37
  221. package/src/controls/html/Button/Button.ts +37 -30
  222. package/src/controls/html/Div/Div.ts +20 -21
  223. package/src/controls/html/Image/Image.ts +22 -20
  224. package/src/controls/html/Input/Input.ts +63 -65
  225. package/src/controls/html/Select/Select.ts +39 -41
  226. package/src/controls/html/Span/Span.ts +14 -14
  227. package/src/controls/index.ts +2 -2
  228. package/src/controls/{jsonViewAwesome → jsonViewerAwesome}/jsonFormatter/JsonFormatter.ts +24 -24
  229. package/src/controls/kendo/Chart/Chart.ts +37 -37
  230. package/src/controls/kendo/DataSource/DataSource.ts +1 -1
  231. package/src/controls/kendo/Editor/Editor.ts +59 -69
  232. package/src/controls/kendo/Grid/Grid.ts +81 -84
  233. package/src/controls/kendo/Menu/Menu.ts +24 -24
  234. package/src/controls/kendo/ObservableObject/ObservableObject.ts +45 -45
  235. package/src/controls/kendo/{Tree/Tree.ts → Treeview/Treeview.ts} +17 -17
  236. package/src/controls/kendo/{Dialog/Dialog.ts → Window/Window.ts} +21 -19
  237. package/src/controls/kendo/index.ts +3 -3
  238. package/src/controls/leaflet/LabelControl/LabelControl.ts +10 -10
  239. package/src/controls/leaflet/Map/Map.ts +44 -41
  240. package/src/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.ts +3 -3
  241. package/src/controls/svg/Circle/Circle.ts +14 -14
  242. package/src/controls/svg/Ellipse/Ellipse.ts +15 -15
  243. package/src/controls/svg/ForeignObject/ForeignObject.ts +19 -20
  244. package/src/controls/svg/Group/Group.ts +19 -19
  245. package/src/controls/svg/Line/Line.ts +15 -15
  246. package/src/controls/svg/Pattern/Pattern.ts +25 -25
  247. package/src/controls/svg/Polygon/Polygon.ts +13 -13
  248. package/src/controls/svg/Polyline/Polyline.ts +13 -13
  249. package/src/controls/svg/Rectangle/Rectangle.ts +15 -15
  250. package/src/controls/svg/Svg/Svg.ts +19 -19
  251. package/src/controls/svg/Text/Text.ts +16 -16
  252. package/src/controls/svg/Title/Title.ts +12 -12
  253. package/src/controls/svg/svg.ts +4 -4
  254. package/src/framework/attributes.ts +46 -46
  255. package/src/framework/{View.ts → element.ts} +54 -41
  256. package/src/framework/event.ts +7 -7
  257. package/src/framework/observable.ts +93 -60
  258. package/src/framework/properties.ts +393 -0
  259. package/src/framework/root.ts +45 -0
  260. package/src/framework/style.ts +330 -340
  261. package/src/index.ts +4 -4
  262. package/src/utilities/contextMenu/contextMenu.ts +16 -0
  263. package/src/utilities/fetch/fetch.ts +16 -14
  264. package/src/utilities/formatting/formatting.ts +29 -0
  265. package/src/utilities/index.ts +7 -3
  266. package/src/utilities/router/router.ts +3 -3
  267. package/dist/controls/codeMirror/HtmlEditor/HtmlEditor.d.ts +0 -16
  268. package/dist/controls/codeMirror/HtmlEditor/HtmlEditor.js +0 -120
  269. package/dist/controls/codeMirror/HtmlEditor/HtmlEditor.js.map +0 -1
  270. package/dist/controls/codeMirror/JsonEditor/JsonEditor.d.ts +0 -16
  271. package/dist/controls/codeMirror/JsonEditor/JsonEditor.js +0 -104
  272. package/dist/controls/codeMirror/JsonEditor/JsonEditor.js.map +0 -1
  273. package/dist/controls/jsonViewAwesome/index.js.map +0 -1
  274. package/dist/controls/jsonViewAwesome/jsonFormatter/JsonFormatter.d.ts +0 -28
  275. package/dist/controls/jsonViewAwesome/jsonFormatter/JsonFormatter.js.map +0 -1
  276. package/dist/controls/kendo/Dialog/Dialog.d.ts +0 -14
  277. package/dist/controls/kendo/Dialog/Dialog.js.map +0 -1
  278. package/dist/controls/kendo/Tree/Tree.d.ts +0 -17
  279. package/dist/controls/kendo/Tree/Tree.js.map +0 -1
  280. package/dist/framework/View.js.map +0 -1
  281. package/dist/framework/ViewModel.d.ts +0 -42
  282. package/dist/framework/ViewModel.js.map +0 -1
  283. package/dist/framework/userAgent.js.map +0 -1
  284. package/dist/utilities/html/html.d.ts +0 -1
  285. package/dist/utilities/html/html.js +0 -8
  286. package/dist/utilities/html/html.js.map +0 -1
  287. package/src/controls/codeMirror/HtmlEditor/HtmlEditor.ts +0 -153
  288. package/src/controls/codeMirror/JsonEditor/JsonEditor.ts +0 -136
  289. package/src/framework/ViewModel.ts +0 -528
  290. package/src/utilities/html/html.ts +0 -8
  291. /package/src/controls/{jsonViewAwesome → jsonViewerAwesome}/index.ts +0 -0
  292. /package/src/{framework → utilities/userAgent}/userAgent.ts +0 -0
@@ -1,31 +1,31 @@
1
- import { View } from "../../../framework/View";
2
- import { Properties, extendProperties } from "../../../framework/ViewModel";
3
- import { Subscribable, unwrap } from "knockout";
4
- import { SvgPoint, serializePoints as getPoints } from "../svg";
1
+ import { Element } from "../../../framework/element";
2
+ import { IProperties, extendProperties } from "../../../framework/properties";
3
+ import { ISubscribable, unwrap } from "../../../framework/observable";
4
+ import { ISvgPoint as SvgPoint, serializePoints as getPoints } from "../svg";
5
5
 
6
- export interface PolygonProperties extends Properties {
7
- points: Array<SvgPoint> | Subscribable<Array<SvgPoint>>;
6
+ export interface IPolygonProperties extends IProperties {
7
+ points: Array<SvgPoint> | ISubscribable<Array<SvgPoint>>;
8
8
  }
9
9
 
10
- export class PolygonView extends View<PolygonProperties> {
11
- constructor(properties: PolygonProperties) {
10
+ export class PolygonElement extends Element<IPolygonProperties> {
11
+ constructor(properties: IPolygonProperties) {
12
12
  super(
13
13
  {
14
14
  tagName: "polygon",
15
15
  properties: extendProperties(
16
+ properties,
16
17
  {
17
- viewType: "Polygon",
18
+ elementType: "Polygon",
18
19
  attributes: {
19
20
  points: getPoints(unwrap(properties.points))
20
21
  }
21
- },
22
- properties
22
+ }
23
23
  )
24
24
  }
25
25
  );
26
26
  }
27
27
  }
28
28
 
29
- export function polygonView(properties: PolygonProperties) {
30
- return new PolygonView(properties);
29
+ export function createPolygon(properties: IPolygonProperties) {
30
+ return new PolygonElement(properties);
31
31
  }
@@ -1,31 +1,31 @@
1
- import { View } from "../../../framework/View";
2
- import { Properties , extendProperties } from "../../../framework/ViewModel";
3
- import { Subscribable } from "knockout";
4
- import { SvgPoint, serializePoints } from "../svg";
1
+ import { Element } from "../../../framework/element";
2
+ import { IProperties , extendProperties } from "../../../framework/properties";
3
+ import { ISubscribable } from "../../../framework/observable";
4
+ import { ISvgPoint as SvgPoint, serializePoints } from "../svg";
5
5
 
6
- export interface PolylineProperties extends Properties {
7
- points: Array<SvgPoint> | Subscribable<Array<SvgPoint>>;
6
+ export interface IPolylineProperties extends IProperties {
7
+ points: Array<SvgPoint> | ISubscribable<Array<SvgPoint>>;
8
8
  }
9
9
 
10
- export class PolylineView extends View<PolylineProperties> {
11
- constructor(properties: PolylineProperties) {
10
+ export class PolylineElement extends Element<IPolylineProperties> {
11
+ constructor(properties: IPolylineProperties) {
12
12
  super(
13
13
  {
14
14
  tagName: "polyline",
15
15
  properties: extendProperties(
16
+ properties,
16
17
  {
17
- viewType: "Polyline",
18
+ elementType: "Polyline",
18
19
  attributes: {
19
20
  points: serializePoints(properties.points)
20
21
  }
21
- },
22
- properties
22
+ }
23
23
  )
24
24
  }
25
25
  );
26
26
  }
27
27
  }
28
28
 
29
- export function polylineView(properties: PolylineProperties) {
30
- return new PolylineView(properties);
29
+ export function createPolyline(properties: IPolylineProperties) {
30
+ return new PolylineElement(properties);
31
31
  }
@@ -1,36 +1,36 @@
1
- import { View } from "../../../framework/View";
2
- import { Properties, extendProperties } from "../../../framework/ViewModel";
3
- import { Subscribable } from "knockout";
1
+ import { Element } from "../../../framework/element";
2
+ import { IProperties, extendProperties } from "../../../framework/properties";
3
+ import { ISubscribable } from "../../../framework/observable";
4
4
 
5
- export interface RectangleProperties extends Properties {
6
- x?: number | string | Subscribable<number | string>;
7
- y?: number | string | Subscribable<number | string>;
8
- width?: number | string | Subscribable<number | string>;
9
- height?: number | string | Subscribable<number | string>;
5
+ export interface IRectangleProperties extends IProperties {
6
+ x?: number | string | ISubscribable<number | string>;
7
+ y?: number | string | ISubscribable<number | string>;
8
+ width?: number | string | ISubscribable<number | string>;
9
+ height?: number | string | ISubscribable<number | string>;
10
10
  }
11
11
 
12
- export class RectangleView extends View<RectangleProperties> {
13
- constructor(properties: RectangleProperties) {
12
+ export class RectangleElement extends Element<IRectangleProperties> {
13
+ constructor(properties: IRectangleProperties) {
14
14
  super(
15
15
  {
16
16
  tagName: "rect",
17
17
  properties: extendProperties(
18
+ properties,
18
19
  {
19
- viewType: "Rectangle",
20
+ elementType: "Rectangle",
20
21
  attributes: {
21
22
  x: properties.x,
22
23
  y: properties.y,
23
24
  width: properties.width,
24
25
  height: properties.height
25
26
  }
26
- },
27
- properties
27
+ }
28
28
  )
29
29
  }
30
30
  );
31
31
  }
32
32
  }
33
33
 
34
- export function rectangleView(properties: RectangleProperties) {
35
- return new RectangleView(properties);
34
+ export function createRectangle(properties: IRectangleProperties) {
35
+ return new RectangleElement(properties);
36
36
  }
@@ -1,26 +1,27 @@
1
- import { View, IView } from "../../../framework/View";
2
- import { Properties, extendProperties } from "../../../framework/ViewModel";
3
- import { ObservableArray, Computed, Subscribable } from "knockout";
1
+ import { Element, IElement } from "../../../framework/element";
2
+ import { IProperties, extendProperties } from "../../../framework/properties";
3
+ import { ISubscribable } from "../../../framework/observable";
4
4
  import { PreserveAspectRatio } from "../../../framework/types";
5
5
 
6
- export interface SvgProperties extends Properties {
7
- x?: number | string | Subscribable<number | string>;
8
- y?: number | string | Subscribable<number | string>;
9
- height?: number | string | Subscribable<number | string>;
10
- width?: number | string | Subscribable<number | string>;
6
+ export interface ISvgProperties extends IProperties {
7
+ x?: number | string | ISubscribable<number | string>;
8
+ y?: number | string | ISubscribable<number | string>;
9
+ height?: number | string | ISubscribable<number | string>;
10
+ width?: number | string | ISubscribable<number | string>;
11
11
  viewBox?: string;
12
- preserveAspectRatio?: PreserveAspectRatio | Subscribable<PreserveAspectRatio>;
13
- children?: Array<IView> | ObservableArray<IView> | Computed<Array<IView>>;
12
+ preserveAspectRatio?: PreserveAspectRatio | ISubscribable<PreserveAspectRatio>;
13
+ children?: Array<IElement> | ISubscribable<Array<IElement>>;
14
14
  }
15
15
 
16
- export class SvgView extends View<SvgProperties> {
17
- constructor(properties: SvgProperties) {
16
+ export class SvgElement extends Element<ISvgProperties> {
17
+ constructor(properties: ISvgProperties) {
18
18
  super(
19
19
  {
20
20
  tagName: "svg",
21
21
  properties: extendProperties(
22
+ properties,
22
23
  {
23
- viewType: "Svg",
24
+ elementType: "Svg",
24
25
  attributes: {
25
26
  x: properties.x,
26
27
  y: properties.y,
@@ -29,15 +30,14 @@ export class SvgView extends View<SvgProperties> {
29
30
  viewBox: properties.viewBox,
30
31
  preserveAspectRatio: properties.preserveAspectRatio
31
32
  }
32
- },
33
- properties
34
- ),
35
- children: properties.children
33
+ }
34
+ )
36
35
  },
36
+ properties.children
37
37
  );
38
38
  }
39
39
  }
40
40
 
41
- export function svgView(properties: SvgProperties) {
42
- return new SvgView(properties);
41
+ export function createSvg(properties: ISvgProperties) {
42
+ return new SvgElement(properties);
43
43
  }
@@ -1,23 +1,24 @@
1
- import { View } from "../../../framework/View";
2
- import { Properties, extendProperties } from "../../../framework/ViewModel";
3
- import { Subscribable } from "knockout";
1
+ import { Element } from "../../../framework/element";
2
+ import { IProperties, extendProperties } from "../../../framework/properties";
3
+ import { ISubscribable } from "../../../framework/observable";
4
4
 
5
- export interface TextProperties extends Properties {
6
- x?: number | string | Subscribable<number | string>;
7
- y?: number | string | Subscribable<number | string>;
8
- dx?: number | string | Subscribable<number | string>;
9
- dy?: number | string | Subscribable<number | string>;
10
- rotate?: string | Subscribable<string>;
5
+ export interface ITextProperties extends IProperties {
6
+ x?: number | string | ISubscribable<number | string>;
7
+ y?: number | string | ISubscribable<number | string>;
8
+ dx?: number | string | ISubscribable<number | string>;
9
+ dy?: number | string | ISubscribable<number | string>;
10
+ rotate?: string | ISubscribable<string>;
11
11
  }
12
12
 
13
- export class TextView extends View<TextProperties> {
14
- constructor(properties: TextProperties) {
13
+ export class TextElement extends Element<ITextProperties> {
14
+ constructor(properties: ITextProperties) {
15
15
  super(
16
16
  {
17
17
  tagName: "text",
18
18
  properties: extendProperties(
19
+ properties,
19
20
  {
20
- viewType: "Text",
21
+ elementType: "Text",
21
22
  attributes: {
22
23
  x: properties.x,
23
24
  y: properties.y,
@@ -25,14 +26,13 @@ export class TextView extends View<TextProperties> {
25
26
  dy: properties.dy,
26
27
  rotate: properties.rotate
27
28
  }
28
- },
29
- properties
29
+ }
30
30
  )
31
31
  }
32
32
  );
33
33
  }
34
34
  }
35
35
 
36
- export function textView(properties: TextProperties) {
37
- return new TextView(properties);
36
+ export function createText(properties: ITextProperties) {
37
+ return new TextElement(properties);
38
38
  }
@@ -1,28 +1,28 @@
1
- import { View } from "../../../framework/View";
2
- import { Properties, extendProperties } from "../../../framework/ViewModel";
3
- import { Subscribable } from "knockout";
1
+ import { Element } from "../../../framework/element";
2
+ import { IProperties, extendProperties } from "../../../framework/properties";
3
+ import { ISubscribable } from "../../../framework/observable";
4
4
 
5
- export interface TitleProperties extends Properties{
6
- title: string | Subscribable<string>
5
+ export interface ITitleProperties extends IProperties{
6
+ title: string | ISubscribable<string>
7
7
  }
8
8
 
9
- export class TitleView extends View<TitleProperties> {
10
- constructor(properties: TitleProperties) {
9
+ export class TitleElement extends Element<ITitleProperties> {
10
+ constructor(properties: ITitleProperties) {
11
11
  super(
12
12
  {
13
13
  tagName: "title",
14
14
  properties: extendProperties(
15
+ properties,
15
16
  {
16
- viewType: "Title",
17
+ elementType: "Title",
17
18
  textContent: properties.title
18
- },
19
- properties
19
+ }
20
20
  )
21
21
  }
22
22
  );
23
23
  }
24
24
  }
25
25
 
26
- export function titleView(properties: TitleProperties) {
27
- return new TitleView(properties);
26
+ export function createTitle(properties: ITitleProperties) {
27
+ return new TitleElement(properties);
28
28
  }
@@ -1,11 +1,11 @@
1
- import { Subscribable, isSubscribable, unwrap, computed } from "knockout";
1
+ import { ISubscribable, isSubscribable, unwrap, computed } from "../../framework/observable";
2
2
 
3
- export interface SvgPoint {
3
+ export interface ISvgPoint {
4
4
  x: number;
5
5
  y: number;
6
6
  }
7
7
 
8
- export function serializePoints(points: Array<SvgPoint> | Subscribable<Array<SvgPoint>>): string | Subscribable<string> {
8
+ export function serializePoints(points: Array<ISvgPoint> | ISubscribable<Array<ISvgPoint>>): string | ISubscribable<string> {
9
9
  if (points) {
10
10
  if (isSubscribable(points)) {
11
11
  return computed<string>(
@@ -14,7 +14,7 @@ export function serializePoints(points: Array<SvgPoint> | Subscribable<Array<Svg
14
14
  }
15
15
  );
16
16
  }
17
- return unwrap(points).map((point) => { return point.x + "," + point.y }).join(" ");
17
+ return unwrap<Array<ISvgPoint>>(points).map((point) => { return point.x + "," + point.y }).join(" ");
18
18
  }
19
19
  return null;
20
20
  }
@@ -1,7 +1,7 @@
1
- import { Subscribable } from "knockout";
2
- import { PreserveAspectRatio } from "./types";
1
+ import { PreserveAspectRatio } from "./types";
2
+ import { ISubscribable } from "./observable";
3
3
 
4
- export interface Attributes {
4
+ export interface IAttributes {
5
5
  alt?: string,
6
6
  disabled?: string,
7
7
  href?: string,
@@ -46,47 +46,47 @@ export interface Attributes {
46
46
  xmlns?: string;
47
47
  }
48
48
 
49
- export interface AttributesSubscribable {
50
- alt?: string | Subscribable<string>,
51
- disabled?: string | Subscribable<string>,
52
- href?: string | Subscribable<string>,
53
- target?: string | Subscribable<string>,
54
- id?: string | Subscribable<string>,
55
- src?: string | Subscribable<string>,
56
- title?: string | Subscribable<string>,
57
- class?: string | Subscribable<string>,
58
- tabindex?: number | Subscribable<number>,
59
- draggable?: string | Subscribable<string>,
60
- placeholder?: string | Subscribable<string>,
61
- for?: string | Subscribable<string>,
62
- type?: string | Subscribable<string>,
63
- value?: string | Subscribable<string>,
64
- view?: string | Subscribable<string>,
65
- checked?: string | Subscribable<string>;
66
- enctype?: string | Subscribable<string>;
67
- name?: string | Subscribable<string>;
68
- multiple?: boolean | Subscribable<boolean>;
69
- ["aria-label"]?: string | Subscribable<string>;
70
- cx?: number | string | Subscribable<number | string>;
71
- cy?: number | string | Subscribable<number | string>;
72
- r?: number | string | Subscribable<number | string>;
73
- rx?: number | string | Subscribable<number | string>;
74
- ry?: number | string | Subscribable<number | string>;
75
- x?: number | string | Subscribable<number | string>;
76
- x1?: number | string | Subscribable<number | string>;
77
- x2?: number | string | Subscribable<number | string>;
78
- y?: number | string | Subscribable<number | string>;
79
- y1?: number | string | Subscribable<number | string>;
80
- y2?: number | string | Subscribable<number | string>;
81
- width?: number | string | Subscribable<number | string>;
82
- height?: number | string | Subscribable<number | string>;
83
- patternUnits?: string | Subscribable<string>;
84
- patternTransform?: string | Subscribable<string>;
85
- points?: string | Subscribable<string>;
86
- viewBox?: string | Subscribable<string>;
87
- dx?: number | string | Subscribable<number | string>;
88
- dy?: number | string | Subscribable<number | string>;
89
- rotate?: string | Subscribable<string>;
90
- preserveAspectRatio?: PreserveAspectRatio | Subscribable<PreserveAspectRatio>;
91
- xmlns?: string| Subscribable<string>;
49
+ export interface IAttributesSubscribable {
50
+ alt?: string | ISubscribable<string>,
51
+ disabled?: string | ISubscribable<string>,
52
+ href?: string | ISubscribable<string>,
53
+ target?: string | ISubscribable<string>,
54
+ id?: string | ISubscribable<string>,
55
+ src?: string | ISubscribable<string>,
56
+ title?: string | ISubscribable<string>,
57
+ class?: string | ISubscribable<string>,
58
+ tabindex?: number | ISubscribable<number>,
59
+ draggable?: string | ISubscribable<string>,
60
+ placeholder?: string | ISubscribable<string>,
61
+ for?: string | ISubscribable<string>,
62
+ type?: string | ISubscribable<string>,
63
+ value?: string | ISubscribable<string>,
64
+ view?: string | ISubscribable<string>,
65
+ checked?: string | ISubscribable<string>;
66
+ enctype?: string | ISubscribable<string>;
67
+ name?: string | ISubscribable<string>;
68
+ multiple?: boolean | ISubscribable<boolean>;
69
+ ["aria-label"]?: string | ISubscribable<string>;
70
+ cx?: number | string | ISubscribable<number | string>;
71
+ cy?: number | string | ISubscribable<number | string>;
72
+ r?: number | string | ISubscribable<number | string>;
73
+ rx?: number | string | ISubscribable<number | string>;
74
+ ry?: number | string | ISubscribable<number | string>;
75
+ x?: number | string | ISubscribable<number | string>;
76
+ x1?: number | string | ISubscribable<number | string>;
77
+ x2?: number | string | ISubscribable<number | string>;
78
+ y?: number | string | ISubscribable<number | string>;
79
+ y1?: number | string | ISubscribable<number | string>;
80
+ y2?: number | string | ISubscribable<number | string>;
81
+ width?: number | string | ISubscribable<number | string>;
82
+ height?: number | string | ISubscribable<number | string>;
83
+ patternUnits?: string | ISubscribable<string>;
84
+ patternTransform?: string | ISubscribable<string>;
85
+ points?: string | ISubscribable<string>;
86
+ viewBox?: string | ISubscribable<string>;
87
+ dx?: number | string | ISubscribable<number | string>;
88
+ dy?: number | string | ISubscribable<number | string>;
89
+ rotate?: string | ISubscribable<string>;
90
+ preserveAspectRatio?: PreserveAspectRatio | ISubscribable<PreserveAspectRatio>;
91
+ xmlns?: string| ISubscribable<string>;
92
92
  }
@@ -1,6 +1,6 @@
1
1
  import "tocca";
2
- import { unwrap, isSubscribable, Subscribable, Subscription } from "knockout";
3
- import { ViewModel, applyBindings as applyViewModelToElement } from "./ViewModel";
2
+ import { unwrap, isSubscribable, IDisposer, ISubscribable } from "./observable";
3
+ import { IProperties, Properties, applyBindings } from "./properties";
4
4
 
5
5
  const htmlTags = {
6
6
  a: true,
@@ -34,39 +34,38 @@ type TagName = keyof typeof htmlTags | keyof typeof svgTags;
34
34
 
35
35
  const svgNamespace = "http://www.w3.org/2000/svg";
36
36
 
37
- //#region View class
38
- export interface IView {
37
+ //#region Element class
38
+ export interface IElement {
39
39
  render(): HTMLElement;
40
- dispose(): void;
40
+ unmount(): void;
41
41
  }
42
42
 
43
- export interface ViewOptions<TProperties> {
43
+ export interface IElementOptions<TProperties> {
44
44
  tagName: TagName;
45
45
  properties?: TProperties;
46
- children?: Array<IView> | Subscribable<Array<IView>>;
47
46
  }
48
47
 
49
- export class View<TProperties = any> implements IView {
50
- constructor(properties: ViewOptions<TProperties>) {
51
- this.tagName = properties.tagName;
52
- this.properties = properties.properties;
53
- this.optionsChildren = properties.children;
54
- this.children = unwrap(properties.children);
48
+ export class Element<TProperties = any> implements IElement {
49
+ constructor(options: IElementOptions<TProperties>, children?: Array<IElement> | ISubscribable<Array<IElement>>) {
50
+ this.tagName = options.tagName;
51
+ this.properties = options.properties;
52
+ this.optionsChildren = children;
53
+ this.children = unwrap(children);
55
54
  }
56
55
 
57
56
  // #region Private members
58
57
  private readonly tagName: TagName;
59
- private readonly optionsChildren: Array<IView> | Subscribable<Array<IView>>;
60
- private children = new Array<IView>();
58
+ private readonly optionsChildren: Array<IElement> | ISubscribable<Array<IElement>>;
59
+ private children = new Array<IElement>();
61
60
 
62
61
 
63
62
  private buildChildren() {
64
63
  if (this.element && this.children && this.children.length > 0) {
65
64
  //Create a documentFragment to reduce browser repaints
66
65
  const documentFragment = document.createDocumentFragment();
67
- this.children.forEach((childView) => {
68
- documentFragment.appendChild(childView.render());
69
- });
66
+ for (let child of this.children) {
67
+ this.element.appendChild(child.render());
68
+ }
70
69
 
71
70
  //Add the documentFragment to the dom
72
71
  this.element.appendChild(documentFragment);
@@ -77,10 +76,10 @@ export class View<TProperties = any> implements IView {
77
76
  // #region Protected members
78
77
  protected element: HTMLElement;
79
78
  protected readonly properties: TProperties;
80
- protected readonly subscriptions = new Array<Subscription>();
79
+ protected readonly disposers = new Array<IDisposer>();
81
80
 
82
81
  protected build(): void {
83
- applyViewModelToElement(this.properties, this.element, this.subscriptions);
82
+ applyBindings(this.properties as IProperties, this.element, this.disposers);
84
83
 
85
84
  if (this.children) {
86
85
  this.buildChildren();
@@ -88,7 +87,7 @@ export class View<TProperties = any> implements IView {
88
87
 
89
88
  //Find out if the options.Children are observable.
90
89
  if (isSubscribable(this.optionsChildren)) {
91
- this.subscriptions.push(
90
+ this.disposers.push(
92
91
  this.optionsChildren.subscribe((children) => {
93
92
  this.setChildren(...children);
94
93
  })
@@ -110,13 +109,13 @@ export class View<TProperties = any> implements IView {
110
109
  }
111
110
  }
112
111
 
113
- protected addChild(child: IView): View<TProperties> {
112
+ protected addChild(child: IElement): Element<TProperties> {
114
113
  this.children.push(child);
115
114
  this.buildChildren();
116
115
  return this;
117
116
  }
118
117
 
119
- protected setChildren(...children: Array<IView>): View<TProperties> {
118
+ protected setChildren(...children: Array<IElement>): Element<TProperties> {
120
119
  this.empty();
121
120
 
122
121
  this.children = children;
@@ -164,12 +163,23 @@ export class View<TProperties = any> implements IView {
164
163
 
165
164
  throw "The build method of this UiElement has not been defined";
166
165
  }
167
- dispose(): void {
168
- for (let subscription of this.subscriptions) {
169
- subscription.dispose();
166
+
167
+
168
+ //This method is used to dispose subscriptions before removing the element from the DOM to prevent memory leaks
169
+ unmount(): void {
170
+ const properties = this.properties as IProperties;
171
+ console.log("Unmount element " + properties.elementType);
172
+
173
+ //If the element has childeren then we unmount the children
174
+ if (this.children) {
175
+ for (let child of this.children) {
176
+ child.unmount();
177
+ }
170
178
  }
171
- for (let child of this.children) {
172
- child.dispose();
179
+
180
+ //If the element has subscriptions on observable we dispose the subscribtion
181
+ for (let disposer of this.disposers) {
182
+ disposer();
173
183
  }
174
184
  }
175
185
 
@@ -180,31 +190,34 @@ export class View<TProperties = any> implements IView {
180
190
  }
181
191
  // #endregion
182
192
  }
193
+
194
+ export function element<TProperties>(options: IElementOptions<TProperties>, children?: Array<IElement> | ISubscribable<Array<IElement>>) {
195
+ return new Element<TProperties>(options, children);
196
+ }
183
197
  //#endregion
184
198
 
185
199
  //#region View dictionary
186
- export var viewDictionary = new Map<any, any>();
200
+ var elementDictionary = new Map<Function, any>();
187
201
 
188
- export function registerView(viewModel, resolver: any) {
189
- viewDictionary.set(viewModel.prototype.constructor, resolver);
202
+ export function registerElement(constructor: Function, element: any) {
203
+ elementDictionary.set(constructor, element);
190
204
  }
191
205
 
192
- export function getView(viewModel: ViewModel): View {
193
- if (viewModel && viewModel.constructor) {
194
- const view = viewDictionary.get(viewModel.constructor);
195
- if (view.prototype) {
196
- // ReSharper disable once InconsistentNaming
197
- return new view(viewModel);
206
+ export function getElement(properties: Properties): Element {
207
+ if (properties && properties.constructor) {
208
+ const element = elementDictionary.get(properties.constructor);
209
+ if (element.prototype) {
210
+ return new element(properties);
198
211
  }
199
- if (typeof view === "function") {
200
- return view(viewModel);
212
+ if (typeof element === "function") {
213
+ return element(properties);
201
214
  }
202
215
  }
203
216
  return null;
204
217
  }
205
218
 
206
- export function render(viewModel: ViewModel): HTMLElement {
207
- const view = getView(viewModel);
219
+ export function render(properties: Properties): HTMLElement {
220
+ const view = getElement(properties);
208
221
  if (view && view.render) {
209
222
  return view.render();
210
223
  }