vsn 0.1.27 → 0.1.30

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 (244) hide show
  1. package/demo/vsn.js +1 -1
  2. package/dist/AST/ArithmeticAssignmentNode.d.ts +23 -0
  3. package/dist/AST/ArithmeticAssignmentNode.js +324 -0
  4. package/dist/AST/ArithmeticAssignmentNode.js.map +1 -0
  5. package/dist/AST/ArithmeticNode.d.ts +15 -0
  6. package/dist/AST/ArithmeticNode.js +114 -0
  7. package/dist/AST/ArithmeticNode.js.map +1 -0
  8. package/dist/AST/ArrayNode.d.ts +14 -0
  9. package/dist/AST/ArrayNode.js +114 -0
  10. package/dist/AST/ArrayNode.js.map +1 -0
  11. package/dist/AST/BlockNode.d.ts +11 -0
  12. package/dist/AST/BlockNode.js +98 -0
  13. package/dist/AST/BlockNode.js.map +1 -0
  14. package/dist/AST/BooleanLiteralNode.d.ts +5 -0
  15. package/dist/{Model/Collection.js → AST/BooleanLiteralNode.js} +12 -18
  16. package/dist/AST/BooleanLiteralNode.js.map +1 -0
  17. package/dist/AST/ComparisonNode.d.ts +15 -0
  18. package/dist/AST/ComparisonNode.js +120 -0
  19. package/dist/AST/ComparisonNode.js.map +1 -0
  20. package/dist/AST/ConditionalNode.d.ts +13 -0
  21. package/dist/AST/ConditionalNode.js +95 -0
  22. package/dist/AST/ConditionalNode.js.map +1 -0
  23. package/dist/AST/ElementAttributeNode.d.ts +18 -0
  24. package/dist/AST/ElementAttributeNode.js +159 -0
  25. package/dist/AST/ElementAttributeNode.js.map +1 -0
  26. package/dist/AST/ElementQueryNode.d.ts +13 -0
  27. package/dist/AST/ElementQueryNode.js +116 -0
  28. package/dist/AST/ElementQueryNode.js.map +1 -0
  29. package/dist/AST/ElementStyleNode.d.ts +18 -0
  30. package/dist/AST/ElementStyleNode.js +159 -0
  31. package/dist/AST/ElementStyleNode.js.map +1 -0
  32. package/dist/AST/ForStatementNode.d.ts +17 -0
  33. package/dist/AST/ForStatementNode.js +121 -0
  34. package/dist/AST/ForStatementNode.js.map +1 -0
  35. package/dist/AST/FunctionArgumentNode.d.ts +11 -0
  36. package/dist/AST/FunctionArgumentNode.js +100 -0
  37. package/dist/AST/FunctionArgumentNode.js.map +1 -0
  38. package/dist/AST/FunctionCallNode.d.ts +13 -0
  39. package/dist/AST/FunctionCallNode.js +102 -0
  40. package/dist/AST/FunctionCallNode.js.map +1 -0
  41. package/dist/AST/IfStatementNode.d.ts +14 -0
  42. package/dist/AST/IfStatementNode.js +128 -0
  43. package/dist/AST/IfStatementNode.js.map +1 -0
  44. package/dist/AST/InNode.d.ts +15 -0
  45. package/dist/AST/InNode.js +107 -0
  46. package/dist/AST/InNode.js.map +1 -0
  47. package/dist/AST/IndexNode.d.ts +16 -0
  48. package/dist/AST/IndexNode.js +126 -0
  49. package/dist/AST/IndexNode.js.map +1 -0
  50. package/dist/AST/LiteralNode.d.ts +10 -0
  51. package/dist/AST/LiteralNode.js +74 -0
  52. package/dist/AST/LiteralNode.js.map +1 -0
  53. package/dist/AST/Node.d.ts +19 -0
  54. package/dist/AST/Node.js +117 -0
  55. package/dist/AST/Node.js.map +1 -0
  56. package/dist/AST/NotNode.d.ts +12 -0
  57. package/dist/AST/NotNode.js +103 -0
  58. package/dist/AST/NotNode.js.map +1 -0
  59. package/dist/AST/NumberLiteralNode.d.ts +5 -0
  60. package/dist/{Model/fields/EmailField.js → AST/NumberLiteralNode.js} +17 -17
  61. package/dist/AST/NumberLiteralNode.js.map +1 -0
  62. package/dist/AST/ObjectNode.d.ts +14 -0
  63. package/dist/AST/ObjectNode.js +131 -0
  64. package/dist/AST/ObjectNode.js.map +1 -0
  65. package/dist/AST/RootScopeMemberNode.d.ts +11 -0
  66. package/dist/AST/RootScopeMemberNode.js +87 -0
  67. package/dist/AST/RootScopeMemberNode.js.map +1 -0
  68. package/dist/AST/ScopeMemberNode.d.ts +12 -0
  69. package/dist/AST/ScopeMemberNode.js +134 -0
  70. package/dist/AST/ScopeMemberNode.js.map +1 -0
  71. package/dist/AST/UnitLiteralNode.d.ts +15 -0
  72. package/dist/AST/UnitLiteralNode.js +72 -0
  73. package/dist/AST/UnitLiteralNode.js.map +1 -0
  74. package/dist/AST.d.ts +7 -60
  75. package/dist/AST.js +74 -1493
  76. package/dist/AST.js.map +1 -1
  77. package/dist/Controller.d.ts +4 -2
  78. package/dist/Controller.js +10 -2
  79. package/dist/Controller.js.map +1 -1
  80. package/dist/EventDispatcher.d.ts +4 -1
  81. package/dist/EventDispatcher.js +27 -12
  82. package/dist/EventDispatcher.js.map +1 -1
  83. package/dist/MessageList.d.ts +2 -1
  84. package/dist/MessageList.js +9 -1
  85. package/dist/MessageList.js.map +1 -1
  86. package/dist/Model/Field.d.ts +8 -0
  87. package/dist/Model/{fields/StringField.js → Field.js} +19 -24
  88. package/dist/Model/Field.js.map +1 -0
  89. package/dist/Model.d.ts +5 -4
  90. package/dist/Model.js +7 -18
  91. package/dist/Model.js.map +1 -1
  92. package/dist/Registry.d.ts +3 -0
  93. package/dist/Registry.js +11 -0
  94. package/dist/Registry.js.map +1 -1
  95. package/dist/Scope/DynamicScopeData.d.ts +6 -0
  96. package/dist/{Model/DataModel.js → Scope/DynamicScopeData.js} +15 -17
  97. package/dist/Scope/DynamicScopeData.js.map +1 -0
  98. package/dist/Scope/QueryReference.d.ts +10 -0
  99. package/dist/Scope/QueryReference.js +103 -0
  100. package/dist/Scope/QueryReference.js.map +1 -0
  101. package/dist/Scope/ScopeData.d.ts +4 -0
  102. package/dist/Scope/ScopeData.js +40 -0
  103. package/dist/Scope/ScopeData.js.map +1 -0
  104. package/dist/Scope/ScopeDataAbstract.d.ts +22 -0
  105. package/dist/Scope/ScopeDataAbstract.js +138 -0
  106. package/dist/Scope/ScopeDataAbstract.js.map +1 -0
  107. package/dist/Scope/ScopeReference.d.ts +10 -0
  108. package/dist/Scope/ScopeReference.js +73 -0
  109. package/dist/Scope/ScopeReference.js.map +1 -0
  110. package/dist/Scope/ScopedVariableType.d.ts +6 -0
  111. package/dist/Scope/ScopedVariableType.js +14 -0
  112. package/dist/Scope/ScopedVariableType.js.map +1 -0
  113. package/dist/Scope/WrappedArray.d.ts +16 -0
  114. package/dist/Scope/WrappedArray.js +121 -0
  115. package/dist/Scope/WrappedArray.js.map +1 -0
  116. package/dist/Scope/properties/Property.d.ts +18 -0
  117. package/dist/Scope/properties/Property.js +93 -0
  118. package/dist/Scope/properties/Property.js.map +1 -0
  119. package/dist/Scope.d.ts +4 -45
  120. package/dist/Scope.js +31 -266
  121. package/dist/Scope.js.map +1 -1
  122. package/dist/SimplePromise.d.ts +2 -2
  123. package/dist/SimplePromise.js.map +1 -1
  124. package/dist/Tag/List.d.ts +2 -2
  125. package/dist/Tag/List.js +14 -6
  126. package/dist/Tag/List.js.map +1 -1
  127. package/dist/Tag.js +1 -1
  128. package/dist/Tag.js.map +1 -1
  129. package/dist/Types.d.ts +1 -0
  130. package/dist/Types.js +8 -2
  131. package/dist/Types.js.map +1 -1
  132. package/dist/Validators.d.ts +7 -0
  133. package/dist/Validators.js +54 -0
  134. package/dist/Validators.js.map +1 -0
  135. package/dist/attributes/Bind.js +1 -1
  136. package/dist/attributes/Bind.js.map +1 -1
  137. package/dist/attributes/ClassConstructor.d.ts +1 -0
  138. package/dist/attributes/ClassConstructor.js +1 -1
  139. package/dist/attributes/ClassConstructor.js.map +1 -1
  140. package/dist/attributes/JSONAttribute.js.map +1 -1
  141. package/dist/attributes/List.js +4 -4
  142. package/dist/attributes/List.js.map +1 -1
  143. package/dist/attributes/Radio.js.map +1 -1
  144. package/dist/attributes/SetAttribute.js.map +1 -1
  145. package/dist/attributes/StyleAttribute.js.map +1 -1
  146. package/dist/vsn.d.ts +9 -1
  147. package/dist/vsn.js +24 -9
  148. package/dist/vsn.js.map +1 -1
  149. package/package.json +1 -1
  150. package/src/AST/ArithmeticAssignmentNode.ts +243 -0
  151. package/src/AST/ArithmeticNode.ts +52 -0
  152. package/src/AST/ArrayNode.ts +39 -0
  153. package/src/AST/BlockNode.ts +25 -0
  154. package/src/AST/BooleanLiteralNode.ts +10 -0
  155. package/src/AST/ComparisonNode.ts +57 -0
  156. package/src/AST/ConditionalNode.ts +36 -0
  157. package/src/AST/ElementAttributeNode.ts +63 -0
  158. package/src/AST/ElementQueryNode.ts +27 -0
  159. package/src/AST/ElementStyleNode.ts +63 -0
  160. package/src/AST/ForStatementNode.ts +59 -0
  161. package/src/AST/FunctionArgumentNode.ts +27 -0
  162. package/src/AST/FunctionCallNode.ts +32 -0
  163. package/src/AST/IfStatementNode.ts +67 -0
  164. package/src/AST/InNode.ts +46 -0
  165. package/src/AST/IndexNode.ts +61 -0
  166. package/src/AST/LiteralNode.ts +17 -0
  167. package/src/AST/Node.ts +71 -0
  168. package/src/AST/NotNode.ts +41 -0
  169. package/src/AST/NumberLiteralNode.ts +14 -0
  170. package/src/AST/ObjectNode.ts +55 -0
  171. package/src/AST/RootScopeMemberNode.ts +25 -0
  172. package/src/AST/ScopeMemberNode.ts +58 -0
  173. package/src/AST/UnitLiteralNode.ts +51 -0
  174. package/src/AST.ts +34 -1094
  175. package/src/Controller.ts +10 -2
  176. package/src/EventDispatcher.ts +29 -12
  177. package/src/MessageList.ts +5 -1
  178. package/src/Model/Field.ts +20 -0
  179. package/src/Model.ts +8 -22
  180. package/src/Registry.ts +10 -0
  181. package/src/{Model/DataModel.ts → Scope/DynamicScopeData.ts} +8 -10
  182. package/src/Scope/QueryReference.ts +29 -0
  183. package/src/Scope/ScopeData.ts +21 -0
  184. package/src/Scope/ScopeDataAbstract.ts +127 -0
  185. package/src/Scope/ScopeReference.ts +30 -0
  186. package/src/Scope/ScopedVariableType.ts +7 -0
  187. package/src/Scope/WrappedArray.ts +88 -0
  188. package/src/Scope/properties/Property.ts +79 -0
  189. package/src/Scope.ts +28 -194
  190. package/src/SimplePromise.ts +2 -2
  191. package/src/Tag/List.ts +4 -4
  192. package/src/Tag.ts +1 -1
  193. package/src/Types.ts +7 -2
  194. package/src/Validators.ts +45 -0
  195. package/src/attributes/Bind.ts +3 -3
  196. package/src/attributes/ClassConstructor.ts +2 -1
  197. package/src/attributes/JSONAttribute.ts +2 -1
  198. package/src/attributes/List.ts +1 -1
  199. package/src/attributes/Radio.ts +2 -1
  200. package/src/attributes/ScopeChange.ts +1 -1
  201. package/src/attributes/SetAttribute.ts +2 -1
  202. package/src/attributes/StyleAttribute.ts +2 -1
  203. package/src/attributes/TypeAttribute.ts +1 -1
  204. package/src/vsn.ts +14 -4
  205. package/test/AST/ArithmeticAssignmentNode.spec.ts +47 -0
  206. package/test/AST.spec.ts +2 -2
  207. package/test/Controller.spec.ts +44 -0
  208. package/test/MessageList.spec.ts +1 -1
  209. package/test/Model/DataModel.spec.ts +0 -141
  210. package/test/Scope/DynamicScopeData.spec.ts +141 -0
  211. package/test/Scope.spec.ts +13 -1
  212. package/test/Tag/TagList.spec.ts +1 -1
  213. package/dist/Model/Collection.d.ts +0 -5
  214. package/dist/Model/Collection.js.map +0 -1
  215. package/dist/Model/DataModel.d.ts +0 -6
  216. package/dist/Model/DataModel.js.map +0 -1
  217. package/dist/Model/ModelAbstract.d.ts +0 -20
  218. package/dist/Model/ModelAbstract.js +0 -122
  219. package/dist/Model/ModelAbstract.js.map +0 -1
  220. package/dist/Model/fields/BooleanField.d.ts +0 -5
  221. package/dist/Model/fields/BooleanField.js +0 -43
  222. package/dist/Model/fields/BooleanField.js.map +0 -1
  223. package/dist/Model/fields/EmailField.d.ts +0 -5
  224. package/dist/Model/fields/EmailField.js.map +0 -1
  225. package/dist/Model/fields/Field.d.ts +0 -13
  226. package/dist/Model/fields/Field.js +0 -79
  227. package/dist/Model/fields/Field.js.map +0 -1
  228. package/dist/Model/fields/FloatField.d.ts +0 -5
  229. package/dist/Model/fields/FloatField.js +0 -47
  230. package/dist/Model/fields/FloatField.js.map +0 -1
  231. package/dist/Model/fields/PositiveNumberField.d.ts +0 -5
  232. package/dist/Model/fields/PositiveNumberField.js +0 -51
  233. package/dist/Model/fields/PositiveNumberField.js.map +0 -1
  234. package/dist/Model/fields/StringField.d.ts +0 -5
  235. package/dist/Model/fields/StringField.js.map +0 -1
  236. package/src/Model/Collection.ts +0 -13
  237. package/src/Model/ModelAbstract.ts +0 -114
  238. package/src/Model/fields/BooleanField.ts +0 -16
  239. package/src/Model/fields/EmailField.ts +0 -12
  240. package/src/Model/fields/Field.ts +0 -65
  241. package/src/Model/fields/FloatField.ts +0 -22
  242. package/src/Model/fields/PositiveNumberField.ts +0 -24
  243. package/src/Model/fields/StringField.ts +0 -16
  244. package/test/Model.spec.ts +0 -306
@@ -15,17 +15,16 @@ var __extends = (this && this.__extends) || (function () {
15
15
  };
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.DataModel = void 0;
19
- var ModelAbstract_1 = require("./ModelAbstract");
20
- var DataModel = /** @class */ (function (_super) {
21
- __extends(DataModel, _super);
22
- function DataModel(data) {
18
+ exports.DynamicScopeData = void 0;
19
+ var ScopeDataAbstract_1 = require("./ScopeDataAbstract");
20
+ var DynamicScopeData = /** @class */ (function (_super) {
21
+ __extends(DynamicScopeData, _super);
22
+ function DynamicScopeData(data) {
23
23
  var _this = _super.call(this) || this;
24
24
  if (data instanceof Array) {
25
- _this.__fields__ = data;
26
25
  for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {
27
26
  var field = data_1[_i];
28
- _this.createField(field);
27
+ _this.createProperty(field);
29
28
  }
30
29
  }
31
30
  else {
@@ -33,22 +32,21 @@ var DataModel = /** @class */ (function (_super) {
33
32
  }
34
33
  return _this;
35
34
  }
36
- DataModel.prototype.setData = function (data) {
35
+ DynamicScopeData.prototype.setData = function (data) {
37
36
  for (var _i = 0, _a = Object.keys(data); _i < _a.length; _i++) {
38
37
  var field = _a[_i];
39
- if (this.__fields__.indexOf(field) == -1) {
40
- this.__fields__.push(field);
41
- this.createField(field);
38
+ if (!this.hasProperty(field)) {
39
+ this.createProperty(field);
42
40
  }
43
41
  }
44
42
  _super.prototype.setData.call(this, data);
45
43
  };
46
- DataModel.prototype.on = function (event, fct, context, once) {
44
+ DynamicScopeData.prototype.on = function (event, fct, context, once) {
47
45
  if (event.indexOf('change:') == 0)
48
- this.createField(event.substr(7));
46
+ this.createProperty(event.substr(7));
49
47
  return _super.prototype.on.call(this, event, fct, context, once);
50
48
  };
51
- return DataModel;
52
- }(ModelAbstract_1.ModelAbstract));
53
- exports.DataModel = DataModel;
54
- //# sourceMappingURL=DataModel.js.map
49
+ return DynamicScopeData;
50
+ }(ScopeDataAbstract_1.ScopeDataAbstract));
51
+ exports.DynamicScopeData = DynamicScopeData;
52
+ //# sourceMappingURL=DynamicScopeData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DynamicScopeData.js","sourceRoot":"","sources":["../../src/Scope/DynamicScopeData.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yDAAkE;AAElE;IAAsC,oCAAiB;IACnD,0BAAY,IAA2B;QAAvC,YACI,iBAAO,SAOV;QANG,IAAG,IAAI,YAAY,KAAK,EAAE;YACtB,KAAoB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI;gBAAnB,IAAM,KAAK,aAAA;gBACZ,KAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;aAAA;SAClC;aAAM;YACH,KAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SACtB;;IACL,CAAC;IAED,kCAAO,GAAP,UAAQ,IAAgB;QACpB,KAAmB,UAAiB,EAAjB,KAAA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAjB,cAAiB,EAAjB,IAAiB;YAAhC,IAAM,KAAK,SAAA;YACX,IAAG,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;gBACzB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;aAC9B;SAAA;QACL,iBAAM,OAAO,YAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,6BAAE,GAAF,UAAG,KAAa,EAAE,GAA4B,EAAE,OAAa,EAAE,IAAc;QACzE,IAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;YAC5B,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACzC,OAAO,iBAAM,EAAE,YAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;IACL,uBAAC;AAAD,CAAC,AAxBD,CAAsC,qCAAiB,GAwBtD;AAxBY,4CAAgB"}
@@ -0,0 +1,10 @@
1
+ import { Scope } from "../Scope";
2
+ import { ScopeReference } from "./ScopeReference";
3
+ export declare class QueryReference extends ScopeReference {
4
+ readonly path: string;
5
+ readonly scope: Scope;
6
+ constructor(path: string, scope: Scope);
7
+ getScope(): Promise<any>;
8
+ getKey(): Promise<string>;
9
+ getValue(): Promise<any>;
10
+ }
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.QueryReference = void 0;
55
+ var DOM_1 = require("../DOM");
56
+ var ScopeReference_1 = require("./ScopeReference");
57
+ var QueryReference = /** @class */ (function (_super) {
58
+ __extends(QueryReference, _super);
59
+ function QueryReference(path, scope) {
60
+ var _this = _super.call(this) || this;
61
+ _this.path = path;
62
+ _this.scope = scope;
63
+ return _this;
64
+ }
65
+ QueryReference.prototype.getScope = function () {
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ var parts, qResult;
68
+ return __generator(this, function (_a) {
69
+ switch (_a.label) {
70
+ case 0:
71
+ parts = this.path.split('.');
72
+ parts = parts.splice(0, parts.length - 1);
73
+ return [4 /*yield*/, DOM_1.DOM.instance.eval(parts.join('.'))];
74
+ case 1:
75
+ qResult = _a.sent();
76
+ return [2 /*return*/, qResult.length === 1 ? qResult[0].scope : qResult.map(function (dobj) { return dobj.scope; })];
77
+ }
78
+ });
79
+ });
80
+ };
81
+ QueryReference.prototype.getKey = function () {
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ var parts;
84
+ return __generator(this, function (_a) {
85
+ parts = this.path.split('.');
86
+ return [2 /*return*/, parts[parts.length - 1]];
87
+ });
88
+ });
89
+ };
90
+ QueryReference.prototype.getValue = function () {
91
+ return __awaiter(this, void 0, void 0, function () {
92
+ return __generator(this, function (_a) {
93
+ switch (_a.label) {
94
+ case 0: return [4 /*yield*/, DOM_1.DOM.instance.eval(this.path)];
95
+ case 1: return [2 /*return*/, _a.sent()];
96
+ }
97
+ });
98
+ });
99
+ };
100
+ return QueryReference;
101
+ }(ScopeReference_1.ScopeReference));
102
+ exports.QueryReference = QueryReference;
103
+ //# sourceMappingURL=QueryReference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryReference.js","sourceRoot":"","sources":["../../src/Scope/QueryReference.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA2B;AAE3B,mDAAgD;AAGhD;IAAoC,kCAAc;IAC9C,wBACoB,IAAY,EACZ,KAAY;QAFhC,YAII,iBAAO,SACV;QAJmB,UAAI,GAAJ,IAAI,CAAQ;QACZ,WAAK,GAAL,KAAK,CAAO;;IAGhC,CAAC;IAEY,iCAAQ,GAArB;;;;;;wBACQ,KAAK,GAAa,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;wBAC3C,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;wBAC1B,qBAAM,SAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAA;;wBAAlD,OAAO,GAAG,SAAwC;wBACxD,sBAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,KAAK,EAAV,CAAU,CAAC,EAAC;;;;KACtF;IAEY,+BAAM,GAAnB;;;;gBACU,KAAK,GAAa,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC7C,sBAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAC;;;KAClC;IAEY,iCAAQ,GAArB;;;;4BACW,qBAAM,SAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAA;4BAAzC,sBAAO,SAAkC,EAAC;;;;KAC7C;IACL,qBAAC;AAAD,CAAC,AAvBD,CAAoC,+BAAc,GAuBjD;AAvBY,wCAAc"}
@@ -0,0 +1,4 @@
1
+ import { ScopeDataAbstract } from "./ScopeDataAbstract";
2
+ export declare class ScopeData extends ScopeDataAbstract {
3
+ constructor();
4
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ScopeData = void 0;
19
+ var ScopeDataAbstract_1 = require("./ScopeDataAbstract");
20
+ var ScopeData = /** @class */ (function (_super) {
21
+ __extends(ScopeData, _super);
22
+ function ScopeData() {
23
+ var _this = _super.call(this) || this;
24
+ var properties = _this.__properties__.splice(0, _this.__properties__.length);
25
+ for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) {
26
+ var property = properties_1[_i];
27
+ (function (_self, name) {
28
+ if (!_self['__' + name + '__'])
29
+ return;
30
+ _self.__properties__.push(name);
31
+ var _property = _self['__' + name + '__'], propertyType = _property[0], config = _property[1] || {};
32
+ _self.createProperty(name, propertyType, config);
33
+ })(_this, property);
34
+ }
35
+ return _this;
36
+ }
37
+ return ScopeData;
38
+ }(ScopeDataAbstract_1.ScopeDataAbstract));
39
+ exports.ScopeData = ScopeData;
40
+ //# sourceMappingURL=ScopeData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopeData.js","sourceRoot":"","sources":["../../src/Scope/ScopeData.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yDAAsD;AAEtD;IAA+B,6BAAiB;IAC5C;QAAA,YACI,iBAAO,SAeV;QAdG,IAAM,UAAU,GAAG,KAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,KAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC7E,KAAsB,UAAU,EAAV,yBAAU,EAAV,wBAAU,EAAV,IAAU,EAAE;YAA9B,IAAM,QAAQ,mBAAA;YACd,CAAC,UAAS,KAAK,EAAE,IAAI;gBACjB,IAAG,CAAC,KAAK,CAAC,IAAI,GAAC,IAAI,GAAC,IAAI,CAAC;oBACrB,OAAO;gBAEX,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAChC,IAAM,SAAS,GAAG,KAAK,CAAC,IAAI,GAAC,IAAI,GAAC,IAAI,CAAC,EACnC,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,EAC3B,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;gBAEhC,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;YACrD,CAAC,CAAC,CAAC,KAAI,EAAE,QAAQ,CAAC,CAAC;SACtB;;IACL,CAAC;IACL,gBAAC;AAAD,CAAC,AAlBD,CAA+B,qCAAiB,GAkB/C;AAlBY,8BAAS"}
@@ -0,0 +1,22 @@
1
+ import { IPropertyConfig, Property } from "./properties/Property";
2
+ import { EventDispatcher } from "../EventDispatcher";
3
+ export interface IScopeData {
4
+ [key: string]: any;
5
+ }
6
+ export declare class ScopeDataAbstract extends EventDispatcher {
7
+ [key: string]: any;
8
+ __properties__: string[];
9
+ protected _lastData: any;
10
+ constructor();
11
+ createProperty(name: string, propertyType?: typeof Property, config?: IPropertyConfig): Property;
12
+ hasProperty(name: string): boolean;
13
+ get keys(): string[];
14
+ setData(data: IScopeData): void;
15
+ getData(): IScopeData;
16
+ getProperties(): string[];
17
+ getProperty(name: string, create?: boolean): Property;
18
+ bindToProperties(event: string, properties: string[], callback: (...args: any[]) => any): void;
19
+ setLastData(): void;
20
+ revert(): void;
21
+ isModified(): boolean;
22
+ }
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
18
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
19
+ to[j] = from[i];
20
+ return to;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.ScopeDataAbstract = void 0;
24
+ var Property_1 = require("./properties/Property");
25
+ var EventDispatcher_1 = require("../EventDispatcher");
26
+ var ScopeDataAbstract = /** @class */ (function (_super) {
27
+ __extends(ScopeDataAbstract, _super);
28
+ function ScopeDataAbstract() {
29
+ var _this = _super.call(this) || this;
30
+ // Objects may have __properties__ from prototype
31
+ if (!_this['__properties__'])
32
+ _this.__properties__ = [];
33
+ return _this;
34
+ }
35
+ ScopeDataAbstract.prototype.createProperty = function (name, propertyType, config) {
36
+ var _this = this;
37
+ if (propertyType === void 0) { propertyType = Property_1.Property; }
38
+ config = config || {};
39
+ var instance = new propertyType(config.default, config), propDesc = Object.getOwnPropertyDescriptor(this, name);
40
+ this['__' + name] = instance;
41
+ this.__properties__.push(name);
42
+ // property getter
43
+ var propertyGetter = function () {
44
+ return instance.value;
45
+ };
46
+ var getter = propDesc ? propDesc.get : propertyGetter, propertySetter = function (newVal) {
47
+ instance.value = newVal;
48
+ }, setter = propDesc ? propDesc.set : propertySetter;
49
+ // Delete the original property
50
+ delete this[name];
51
+ // Create new property with getter and setter
52
+ Object.defineProperty(this, name, {
53
+ get: getter,
54
+ set: setter,
55
+ enumerable: true,
56
+ configurable: true
57
+ });
58
+ instance.on('change', function () {
59
+ var args = [];
60
+ for (var _i = 0; _i < arguments.length; _i++) {
61
+ args[_i] = arguments[_i];
62
+ }
63
+ _this.dispatch.apply(_this, __spreadArray(['change', name], args));
64
+ _this.dispatch.apply(_this, __spreadArray(['change:' + name], args));
65
+ });
66
+ return instance;
67
+ };
68
+ ScopeDataAbstract.prototype.hasProperty = function (name) {
69
+ return this.__properties__.indexOf(name) !== -1;
70
+ };
71
+ Object.defineProperty(ScopeDataAbstract.prototype, "keys", {
72
+ get: function () {
73
+ return __spreadArray([], this.__properties__);
74
+ },
75
+ enumerable: false,
76
+ configurable: true
77
+ });
78
+ ScopeDataAbstract.prototype.setData = function (data) {
79
+ var properties = this.getProperties();
80
+ for (var key in data) {
81
+ if (properties.indexOf(key) > -1) {
82
+ this[key] = data[key];
83
+ }
84
+ }
85
+ };
86
+ ScopeDataAbstract.prototype.getData = function () {
87
+ var data = {};
88
+ for (var _i = 0, _a = this.getProperties(); _i < _a.length; _i++) {
89
+ var key = _a[_i];
90
+ var property = this['__' + key];
91
+ if (this[key] == null || !property)
92
+ continue;
93
+ data[key] = property.getData();
94
+ }
95
+ return data;
96
+ };
97
+ ScopeDataAbstract.prototype.getProperties = function () {
98
+ return this.__properties__;
99
+ };
100
+ ScopeDataAbstract.prototype.getProperty = function (name, create) {
101
+ if (create === void 0) { create = false; }
102
+ var property = this['__' + name];
103
+ if (create && !property) {
104
+ property = this.createProperty(name);
105
+ }
106
+ return property;
107
+ };
108
+ ScopeDataAbstract.prototype.bindToProperties = function (event, properties, callback) {
109
+ for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) {
110
+ var name_1 = properties_1[_i];
111
+ var _property = this['__' + name_1];
112
+ if (_property)
113
+ _property.on(event, callback);
114
+ }
115
+ };
116
+ ScopeDataAbstract.prototype.setLastData = function () {
117
+ this._lastData = this.getData();
118
+ };
119
+ /*
120
+ * Revert data to the last setData() call. Useful for forms that edit a
121
+ * list of items and then hit cancel rather than saving the list.
122
+ */
123
+ ScopeDataAbstract.prototype.revert = function () {
124
+ this.setData(this._lastData);
125
+ };
126
+ ScopeDataAbstract.prototype.isModified = function () {
127
+ var oData = this._lastData, nData = this.getData();
128
+ for (var _i = 0, _a = this.getProperties(); _i < _a.length; _i++) {
129
+ var key = _a[_i];
130
+ if (nData[key] != oData[key])
131
+ return true;
132
+ }
133
+ return false;
134
+ };
135
+ return ScopeDataAbstract;
136
+ }(EventDispatcher_1.EventDispatcher));
137
+ exports.ScopeDataAbstract = ScopeDataAbstract;
138
+ //# sourceMappingURL=ScopeDataAbstract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopeDataAbstract.js","sourceRoot":"","sources":["../../src/Scope/ScopeDataAbstract.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,10 @@
1
+ import { Scope } from "../Scope";
2
+ export declare class ScopeReference {
3
+ private _scope;
4
+ private _key;
5
+ private _value;
6
+ constructor(scope?: Scope, key?: string, value?: any);
7
+ getScope(): Promise<Scope>;
8
+ getKey(): Promise<string>;
9
+ getValue(): Promise<any>;
10
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.ScopeReference = void 0;
40
+ var ScopeReference = /** @class */ (function () {
41
+ function ScopeReference(scope, key, value) {
42
+ if (scope === void 0) { scope = null; }
43
+ if (key === void 0) { key = null; }
44
+ if (value === void 0) { value = null; }
45
+ this._scope = scope;
46
+ this._key = key;
47
+ this._value = value;
48
+ }
49
+ ScopeReference.prototype.getScope = function () {
50
+ return __awaiter(this, void 0, void 0, function () {
51
+ return __generator(this, function (_a) {
52
+ return [2 /*return*/, this._scope];
53
+ });
54
+ });
55
+ };
56
+ ScopeReference.prototype.getKey = function () {
57
+ return __awaiter(this, void 0, void 0, function () {
58
+ return __generator(this, function (_a) {
59
+ return [2 /*return*/, this._key];
60
+ });
61
+ });
62
+ };
63
+ ScopeReference.prototype.getValue = function () {
64
+ return __awaiter(this, void 0, void 0, function () {
65
+ return __generator(this, function (_a) {
66
+ return [2 /*return*/, this._value];
67
+ });
68
+ });
69
+ };
70
+ return ScopeReference;
71
+ }());
72
+ exports.ScopeReference = ScopeReference;
73
+ //# sourceMappingURL=ScopeReference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopeReference.js","sourceRoot":"","sources":["../../src/Scope/ScopeReference.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;IAKI,wBACI,KAAmB,EACnB,GAAkB,EAClB,KAAiB;QAFjB,sBAAA,EAAA,YAAmB;QACnB,oBAAA,EAAA,UAAkB;QAClB,sBAAA,EAAA,YAAiB;QAEjB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAEY,iCAAQ,GAArB;;;gBACI,sBAAO,IAAI,CAAC,MAAM,EAAC;;;KACtB;IAEY,+BAAM,GAAnB;;;gBACI,sBAAO,IAAI,CAAC,IAAI,EAAC;;;KACpB;IAEY,iCAAQ,GAArB;;;gBACI,sBAAO,IAAI,CAAC,MAAM,EAAC;;;KACtB;IACL,qBAAC;AAAD,CAAC,AA1BD,IA0BC;AA1BY,wCAAc"}
@@ -0,0 +1,6 @@
1
+ export declare class ScopeVariableType {
2
+ static readonly Integer: string;
3
+ static readonly Float: string;
4
+ static readonly Boolean: string;
5
+ static readonly String: string;
6
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScopeVariableType = void 0;
4
+ var ScopeVariableType = /** @class */ (function () {
5
+ function ScopeVariableType() {
6
+ }
7
+ ScopeVariableType.Integer = 'integer';
8
+ ScopeVariableType.Float = 'float';
9
+ ScopeVariableType.Boolean = 'boolean';
10
+ ScopeVariableType.String = 'string';
11
+ return ScopeVariableType;
12
+ }());
13
+ exports.ScopeVariableType = ScopeVariableType;
14
+ //# sourceMappingURL=ScopedVariableType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopedVariableType.js","sourceRoot":"","sources":["../../src/Scope/ScopedVariableType.ts"],"names":[],"mappings":";;;AACA;IAAA;IAKA,CAAC;IAJ0B,yBAAO,GAAW,SAAS,CAAC;IAC5B,uBAAK,GAAW,OAAO,CAAC;IACxB,yBAAO,GAAW,SAAS,CAAC;IAC5B,wBAAM,GAAW,QAAQ,CAAC;IACrD,wBAAC;CAAA,AALD,IAKC;AALY,8CAAiB"}
@@ -0,0 +1,16 @@
1
+ import { EventDispatcherCallback } from "../EventDispatcher";
2
+ export declare class WrappedArray<T> extends Array<T> {
3
+ private dispatcher;
4
+ readonly $wrapped: boolean;
5
+ constructor(...items: T[]);
6
+ dispatch(event: string, ...args: any[]): void;
7
+ on(event: string, callback: EventDispatcherCallback): void;
8
+ off(event: string, key?: number): void;
9
+ once(event: string, callback: EventDispatcherCallback): void;
10
+ push(...items: T[]): number;
11
+ splice(start: number, deleteCount?: number): T[];
12
+ get(key: string): any;
13
+ get length(): number;
14
+ set length(num: number);
15
+ setLength(num: number): void;
16
+ }
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
18
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
19
+ to[j] = from[i];
20
+ return to;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.WrappedArray = void 0;
24
+ var EventDispatcher_1 = require("../EventDispatcher");
25
+ var WrappedArray = /** @class */ (function (_super) {
26
+ __extends(WrappedArray, _super);
27
+ function WrappedArray() {
28
+ var items = [];
29
+ for (var _i = 0; _i < arguments.length; _i++) {
30
+ items[_i] = arguments[_i];
31
+ }
32
+ var _this = _super.apply(this, items) || this;
33
+ _this.$wrapped = true;
34
+ Object.setPrototypeOf(_this, WrappedArray.prototype);
35
+ _this.dispatcher = new EventDispatcher_1.EventDispatcher();
36
+ return _this;
37
+ }
38
+ WrappedArray.prototype.dispatch = function (event) {
39
+ var _a;
40
+ var args = [];
41
+ for (var _i = 1; _i < arguments.length; _i++) {
42
+ args[_i - 1] = arguments[_i];
43
+ }
44
+ (_a = this.dispatcher).dispatch.apply(_a, __spreadArray([event], args));
45
+ };
46
+ WrappedArray.prototype.on = function (event, callback) {
47
+ this.dispatcher.on(event, callback);
48
+ };
49
+ WrappedArray.prototype.off = function (event, key) {
50
+ this.dispatcher.off(event, key);
51
+ };
52
+ WrappedArray.prototype.once = function (event, callback) {
53
+ this.dispatcher.once(event, callback);
54
+ };
55
+ WrappedArray.prototype.push = function () {
56
+ var items = [];
57
+ for (var _i = 0; _i < arguments.length; _i++) {
58
+ items[_i] = arguments[_i];
59
+ }
60
+ var num = _super.prototype.push.apply(this, items);
61
+ this.dispatch.apply(this, __spreadArray(['push'], items));
62
+ this.dispatch('change', {
63
+ 'added': items
64
+ });
65
+ for (var _a = 0, items_1 = items; _a < items_1.length; _a++) {
66
+ var item = items_1[_a];
67
+ this.dispatch('add', item);
68
+ }
69
+ return num;
70
+ };
71
+ WrappedArray.prototype.splice = function (start, deleteCount) {
72
+ var removed = _super.prototype.splice.call(this, start, deleteCount);
73
+ this.dispatch('change', {
74
+ 'removed': removed
75
+ });
76
+ for (var _i = 0, removed_1 = removed; _i < removed_1.length; _i++) {
77
+ var item = removed_1[_i];
78
+ this.dispatch('remove', item);
79
+ }
80
+ return removed;
81
+ };
82
+ WrappedArray.prototype.get = function (key) {
83
+ var keys = [
84
+ 'length'
85
+ ];
86
+ return keys.indexOf(key) > -1 ? this[key] : undefined;
87
+ };
88
+ Object.defineProperty(WrappedArray.prototype, "length", {
89
+ get: function () {
90
+ var c = 0;
91
+ for (var _i = 0, _a = this; _i < _a.length; _i++) {
92
+ var item = _a[_i];
93
+ c += 1;
94
+ }
95
+ return c;
96
+ },
97
+ set: function (num) {
98
+ this.setLength(num);
99
+ },
100
+ enumerable: false,
101
+ configurable: true
102
+ });
103
+ WrappedArray.prototype.setLength = function (num) {
104
+ var c = 0;
105
+ var toRemove = [];
106
+ for (var _i = 0, _a = this; _i < _a.length; _i++) {
107
+ var item = _a[_i];
108
+ c += 1;
109
+ if (c >= num) {
110
+ toRemove.push(item);
111
+ }
112
+ }
113
+ for (var _b = 0, toRemove_1 = toRemove; _b < toRemove_1.length; _b++) {
114
+ var item = toRemove_1[_b];
115
+ this.splice(this.indexOf(item), 1);
116
+ }
117
+ };
118
+ return WrappedArray;
119
+ }(Array));
120
+ exports.WrappedArray = WrappedArray;
121
+ //# sourceMappingURL=WrappedArray.js.map