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
@@ -0,0 +1,117 @@
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.Node = void 0;
40
+ var Node = /** @class */ (function () {
41
+ function Node() {
42
+ this.requiresPrep = false;
43
+ this.nodeCache = {};
44
+ }
45
+ Node.prototype.isPreparationRequired = function () {
46
+ if (this.requiresPrep)
47
+ return true;
48
+ if (this._isPreparationRequired !== undefined)
49
+ return this._isPreparationRequired;
50
+ for (var _i = 0, _a = this.getChildNodes(); _i < _a.length; _i++) {
51
+ var node = _a[_i];
52
+ if (node.isPreparationRequired()) {
53
+ this._isPreparationRequired = true;
54
+ return true;
55
+ }
56
+ }
57
+ return false;
58
+ };
59
+ Node.prototype.prepare = function (scope, dom, tag) {
60
+ if (tag === void 0) { tag = null; }
61
+ return __awaiter(this, void 0, void 0, function () {
62
+ var _i, _a, node;
63
+ return __generator(this, function (_b) {
64
+ switch (_b.label) {
65
+ case 0:
66
+ _i = 0, _a = this.getChildNodes();
67
+ _b.label = 1;
68
+ case 1:
69
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
70
+ node = _a[_i];
71
+ return [4 /*yield*/, node.prepare(scope, dom, tag)];
72
+ case 2:
73
+ _b.sent();
74
+ _b.label = 3;
75
+ case 3:
76
+ _i++;
77
+ return [3 /*break*/, 1];
78
+ case 4: return [2 /*return*/];
79
+ }
80
+ });
81
+ });
82
+ };
83
+ Node.prototype._getChildNodes = function () {
84
+ return [];
85
+ };
86
+ Node.prototype.getChildNodes = function () {
87
+ if (this.childNodes === undefined) {
88
+ this.childNodes = this._getChildNodes();
89
+ }
90
+ return this.childNodes;
91
+ };
92
+ Node.prototype.findChildrenByType = function (t) {
93
+ return this.findChildrenByTypes([t]);
94
+ };
95
+ Node.prototype.findChildrenByTypes = function (types, cacheKey) {
96
+ if (cacheKey === void 0) { cacheKey = null; }
97
+ if (cacheKey !== null && this.nodeCache[cacheKey])
98
+ return this.nodeCache[cacheKey];
99
+ var nodes = [];
100
+ for (var _i = 0, _a = this.getChildNodes(); _i < _a.length; _i++) {
101
+ var child = _a[_i];
102
+ for (var _b = 0, types_1 = types; _b < types_1.length; _b++) {
103
+ var t = types_1[_b];
104
+ if (child instanceof t)
105
+ nodes.push(child);
106
+ var childNodes = child.findChildrenByType(t);
107
+ nodes.push.apply(nodes, childNodes);
108
+ }
109
+ }
110
+ if (cacheKey !== null)
111
+ this.nodeCache[cacheKey] = nodes;
112
+ return nodes;
113
+ };
114
+ return Node;
115
+ }());
116
+ exports.Node = Node;
117
+ //# sourceMappingURL=Node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Node.js","sourceRoot":"","sources":["../../src/AST/Node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;IAAA;QACc,iBAAY,GAAY,KAAK,CAAC;QAG9B,cAAS,GAA4B,EAAE,CAAC;IA4DtD,CAAC;IAzDG,oCAAqB,GAArB;QACI,IAAI,IAAI,CAAC,YAAY;YACjB,OAAO,IAAI,CAAC;QAEhB,IAAI,IAAI,CAAC,sBAAsB,KAAK,SAAS;YACzC,OAAO,IAAI,CAAC,sBAAsB,CAAC;QAEvC,KAAmB,UAAoB,EAApB,KAAA,IAAI,CAAC,aAAa,EAAE,EAApB,cAAoB,EAApB,IAAoB,EAAE;YAApC,IAAM,IAAI,SAAA;YACX,IAAI,IAAI,CAAC,qBAAqB,EAAE,EAAE;gBAC9B,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;gBACnC,OAAO,IAAI,CAAC;aACf;SACJ;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEK,sBAAO,GAAb,UAAc,KAAY,EAAE,GAAQ,EAAE,GAAe;QAAf,oBAAA,EAAA,UAAe;;;;;;8BACV,EAApB,KAAA,IAAI,CAAC,aAAa,EAAE;;;6BAApB,CAAA,cAAoB,CAAA;wBAA5B,IAAI;wBACX,qBAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAAnC,SAAmC,CAAC;;;wBADrB,IAAoB,CAAA;;;;;;KAG1C;IAES,6BAAc,GAAxB;QACI,OAAO,EAAE,CAAC;IACd,CAAC;IAED,4BAAa,GAAb;QACI,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE;YAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;SAC3C;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,iCAAkB,GAAlB,UAA6B,CAAM;QAC/B,OAAO,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,kCAAmB,GAAnB,UAA8B,KAAY,EAAE,QAAuB;QAAvB,yBAAA,EAAA,eAAuB;QAC/D,IAAI,QAAQ,KAAK,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;YAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAQ,CAAC;QAE3C,IAAM,KAAK,GAAQ,EAAE,CAAC;QACtB,KAAoB,UAAoB,EAApB,KAAA,IAAI,CAAC,aAAa,EAAE,EAApB,cAAoB,EAApB,IAAoB,EAAE;YAArC,IAAM,KAAK,SAAA;YACZ,KAAgB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE;gBAAlB,IAAM,CAAC,cAAA;gBACR,IAAI,KAAK,YAAY,CAAC;oBAClB,KAAK,CAAC,IAAI,CAAC,KAAiB,CAAC,CAAC;gBAClC,IAAM,UAAU,GAAQ,KAAK,CAAC,kBAAkB,CAAI,CAAC,CAAC,CAAC;gBACvD,KAAK,CAAC,IAAI,OAAV,KAAK,EAAS,UAAU,EAAE;aAC7B;SACJ;QAED,IAAI,QAAQ,KAAK,IAAI;YACjB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,KAAY,CAAC;QAE5C,OAAO,KAAK,CAAC;IACjB,CAAC;IACL,WAAC;AAAD,CAAC,AAhED,IAgEC;AAhEqB,oBAAI"}
@@ -0,0 +1,12 @@
1
+ import { Scope } from "../Scope";
2
+ import { DOM } from "../DOM";
3
+ import { Tag } from "../Tag";
4
+ import { Token, TreeNode } from "../AST";
5
+ import { Node } from "./Node";
6
+ export declare class NotNode extends Node implements TreeNode {
7
+ readonly toFlip: Node;
8
+ constructor(toFlip: Node);
9
+ evaluate(scope: Scope, dom: DOM, tag?: Tag): Promise<boolean>;
10
+ protected _getChildNodes(): Node[];
11
+ static parse(lastNode: any, token: any, tokens: Token[]): NotNode;
12
+ }
@@ -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.NotNode = void 0;
55
+ var AST_1 = require("../AST");
56
+ var Node_1 = require("./Node");
57
+ var NotNode = /** @class */ (function (_super) {
58
+ __extends(NotNode, _super);
59
+ function NotNode(toFlip) {
60
+ var _this = _super.call(this) || this;
61
+ _this.toFlip = toFlip;
62
+ return _this;
63
+ }
64
+ NotNode.prototype.evaluate = function (scope, dom, tag) {
65
+ if (tag === void 0) { tag = null; }
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ var flipping;
68
+ return __generator(this, function (_a) {
69
+ switch (_a.label) {
70
+ case 0: return [4 /*yield*/, this.toFlip.evaluate(scope, dom, tag)];
71
+ case 1:
72
+ flipping = _a.sent();
73
+ return [2 /*return*/, !flipping];
74
+ }
75
+ });
76
+ });
77
+ };
78
+ NotNode.prototype._getChildNodes = function () {
79
+ return [
80
+ this.toFlip
81
+ ];
82
+ };
83
+ NotNode.parse = function (lastNode, token, tokens) {
84
+ tokens.splice(0, 1); // Remove not operator
85
+ var containedTokens;
86
+ if (tokens[0].type === AST_1.TokenType.L_PAREN) {
87
+ containedTokens = AST_1.Tree.getNextStatementTokens(tokens);
88
+ }
89
+ else {
90
+ containedTokens = AST_1.Tree.consumeTypes(tokens, [
91
+ AST_1.TokenType.BOOLEAN_LITERAL,
92
+ AST_1.TokenType.NUMBER_LITERAL,
93
+ AST_1.TokenType.STRING_LITERAL,
94
+ AST_1.TokenType.NAME,
95
+ AST_1.TokenType.PERIOD
96
+ ]);
97
+ }
98
+ return new NotNode(AST_1.Tree.processTokens(containedTokens));
99
+ };
100
+ return NotNode;
101
+ }(Node_1.Node));
102
+ exports.NotNode = NotNode;
103
+ //# sourceMappingURL=NotNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotNode.js","sourceRoot":"","sources":["../../src/AST/NotNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,8BAAwD;AACxD,+BAA4B;AAE5B;IAA6B,2BAAI;IAC7B,iBACoB,MAAY;QADhC,YAGI,iBAAO,SACV;QAHmB,YAAM,GAAN,MAAM,CAAM;;IAGhC,CAAC;IAEY,0BAAQ,GAArB,UAAsB,KAAY,EAAE,GAAQ,EAAE,GAAe;QAAf,oBAAA,EAAA,UAAe;;;;;4BACxC,qBAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAAtD,QAAQ,GAAG,SAA2C;wBAC5D,sBAAO,CAAC,QAAQ,EAAC;;;;KACpB;IAES,gCAAc,GAAxB;QACI,OAAO;YACH,IAAI,CAAC,MAAM;SACd,CAAC;IACN,CAAC;IAEa,aAAK,GAAnB,UAAoB,QAAQ,EAAE,KAAK,EAAE,MAAe;QAChD,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,sBAAsB;QAC3C,IAAI,eAAe,CAAC;QACpB,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,eAAS,CAAC,OAAO,EAAE;YACtC,eAAe,GAAG,UAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;SACzD;aAAM;YACH,eAAe,GAAG,UAAI,CAAC,YAAY,CAAC,MAAM,EAAE;gBACxC,eAAS,CAAC,eAAe;gBACzB,eAAS,CAAC,cAAc;gBACxB,eAAS,CAAC,cAAc;gBACxB,eAAS,CAAC,IAAI;gBACd,eAAS,CAAC,MAAM;aACnB,CAAC,CAAC;SACN;QACD,OAAO,IAAI,OAAO,CAAC,UAAI,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC;IAC5D,CAAC;IACL,cAAC;AAAD,CAAC,AAlCD,CAA6B,WAAI,GAkChC;AAlCY,0BAAO"}
@@ -0,0 +1,5 @@
1
+ import { LiteralNode } from "./LiteralNode";
2
+ export declare class NumberLiteralNode extends LiteralNode<number> {
3
+ readonly value: any;
4
+ constructor(value: any);
5
+ }
@@ -15,22 +15,22 @@ var __extends = (this && this.__extends) || (function () {
15
15
  };
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.EmailField = void 0;
19
- var Field_1 = require("./Field");
20
- var EmailField = /** @class */ (function (_super) {
21
- __extends(EmailField, _super);
22
- function EmailField() {
23
- var _this = _super !== null && _super.apply(this, arguments) || this;
24
- _this._emailRegex = /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
18
+ exports.NumberLiteralNode = void 0;
19
+ var LiteralNode_1 = require("./LiteralNode");
20
+ var NumberLiteralNode = /** @class */ (function (_super) {
21
+ __extends(NumberLiteralNode, _super);
22
+ function NumberLiteralNode(value) {
23
+ var _this = _super.call(this, value) || this;
24
+ _this.value = value;
25
+ if (_this.value.indexOf('.') > -1) {
26
+ _this.value = parseFloat(_this.value);
27
+ }
28
+ else {
29
+ _this.value = parseInt(_this.value);
30
+ }
25
31
  return _this;
26
32
  }
27
- EmailField.prototype.validate = function () {
28
- _super.prototype.validate.call(this);
29
- if (this._value != null && !this._emailRegex.test(this._value))
30
- this._errors.push('Please enter a valid email address');
31
- return this._errors;
32
- };
33
- return EmailField;
34
- }(Field_1.Field));
35
- exports.EmailField = EmailField;
36
- //# sourceMappingURL=EmailField.js.map
33
+ return NumberLiteralNode;
34
+ }(LiteralNode_1.LiteralNode));
35
+ exports.NumberLiteralNode = NumberLiteralNode;
36
+ //# sourceMappingURL=NumberLiteralNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberLiteralNode.js","sourceRoot":"","sources":["../../src/AST/NumberLiteralNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6CAA0C;AAE1C;IAAuC,qCAAmB;IACtD,2BACoB,KAAU;QAD9B,YAGI,kBAAM,KAAK,CAAC,SAMf;QARmB,WAAK,GAAL,KAAK,CAAK;QAG1B,IAAI,KAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;YAC9B,KAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAI,CAAC,KAAK,CAAC,CAAA;SACtC;aAAM;YACH,KAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;SACrC;;IACL,CAAC;IACL,wBAAC;AAAD,CAAC,AAXD,CAAuC,yBAAW,GAWjD;AAXY,8CAAiB"}
@@ -0,0 +1,14 @@
1
+ import { Scope } from "../Scope";
2
+ import { DOM } from "../DOM";
3
+ import { Tag } from "../Tag";
4
+ import { Token, TreeNode } from "../AST";
5
+ import { Node } from "./Node";
6
+ export declare class ObjectNode extends Node implements TreeNode {
7
+ readonly keys: Node[];
8
+ readonly values: Node[];
9
+ constructor(keys: Node[], values: Node[]);
10
+ protected _getChildNodes(): Node[];
11
+ evaluate(scope: Scope, dom: DOM, tag?: Tag): Promise<Scope>;
12
+ static match(tokens: Token[]): boolean;
13
+ static parse(lastNode: any, token: any, tokens: Token[]): ObjectNode;
14
+ }
@@ -0,0 +1,131 @@
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
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
54
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
55
+ to[j] = from[i];
56
+ return to;
57
+ };
58
+ Object.defineProperty(exports, "__esModule", { value: true });
59
+ exports.ObjectNode = void 0;
60
+ var Scope_1 = require("../Scope");
61
+ var AST_1 = require("../AST");
62
+ var Node_1 = require("./Node");
63
+ var ObjectNode = /** @class */ (function (_super) {
64
+ __extends(ObjectNode, _super);
65
+ function ObjectNode(keys, values) {
66
+ var _this = _super.call(this) || this;
67
+ _this.keys = keys;
68
+ _this.values = values;
69
+ return _this;
70
+ }
71
+ ObjectNode.prototype._getChildNodes = function () {
72
+ return new (Array.bind.apply(Array, __spreadArray([void 0], this.values)))();
73
+ };
74
+ ObjectNode.prototype.evaluate = function (scope, dom, tag) {
75
+ if (tag === void 0) { tag = null; }
76
+ return __awaiter(this, void 0, void 0, function () {
77
+ var obj, i, key, val, _a, _b, _c;
78
+ return __generator(this, function (_d) {
79
+ switch (_d.label) {
80
+ case 0:
81
+ obj = new Scope_1.Scope();
82
+ i = 0;
83
+ _d.label = 1;
84
+ case 1:
85
+ if (!(i < this.values.length)) return [3 /*break*/, 5];
86
+ key = this.keys[i];
87
+ val = this.values[i];
88
+ _b = (_a = obj).set;
89
+ return [4 /*yield*/, key.evaluate(scope, dom, tag)];
90
+ case 2:
91
+ _c = [_d.sent()];
92
+ return [4 /*yield*/, val.evaluate(scope, dom, tag)];
93
+ case 3:
94
+ _b.apply(_a, _c.concat([_d.sent()]));
95
+ _d.label = 4;
96
+ case 4:
97
+ i++;
98
+ return [3 /*break*/, 1];
99
+ case 5: return [2 /*return*/, obj];
100
+ }
101
+ });
102
+ });
103
+ };
104
+ ObjectNode.match = function (tokens) {
105
+ return tokens[0].type === AST_1.TokenType.L_BRACE;
106
+ };
107
+ ObjectNode.parse = function (lastNode, token, tokens) {
108
+ var valueTokens = AST_1.Tree.getNextStatementTokens(tokens);
109
+ var keys = [];
110
+ var values = [];
111
+ while (valueTokens.length > 0) {
112
+ var key = AST_1.Tree.getTokensUntil(valueTokens, AST_1.TokenType.COLON, false);
113
+ if (valueTokens[0].type !== AST_1.TokenType.COLON)
114
+ throw Error('Invalid object literal syntax. Expecting :');
115
+ valueTokens.splice(0, 1); // Consume :
116
+ var val = AST_1.Tree.getTokensUntil(valueTokens, AST_1.TokenType.COMMA, true, false, true, {
117
+ type: AST_1.BlockType.STATEMENT,
118
+ open: null,
119
+ close: null,
120
+ openCharacter: null,
121
+ closeCharacter: null
122
+ });
123
+ keys.push(AST_1.Tree.processTokens(key));
124
+ values.push(AST_1.Tree.processTokens(val));
125
+ }
126
+ return new ObjectNode(keys, values);
127
+ };
128
+ return ObjectNode;
129
+ }(Node_1.Node));
130
+ exports.ObjectNode = ObjectNode;
131
+ //# sourceMappingURL=ObjectNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectNode.js","sourceRoot":"","sources":["../../src/AST/ObjectNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAA+B;AAG/B,8BAAmE;AACnE,+BAA4B;AAE5B;IAAgC,8BAAI;IAChC,oBACoB,IAAY,EACZ,MAAc;QAFlC,YAII,iBAAO,SACV;QAJmB,UAAI,GAAJ,IAAI,CAAQ;QACZ,YAAM,GAAN,MAAM,CAAQ;;IAGlC,CAAC;IAES,mCAAc,GAAxB;QACI,YAAW,KAAK,YAAL,KAAK,0BAAI,IAAI,CAAC,MAAM,MAAE;IACrC,CAAC;IAEK,6BAAQ,GAAd,UAAe,KAAY,EAAE,GAAQ,EAAE,GAAe;QAAf,oBAAA,EAAA,UAAe;;;;;;wBAC5C,GAAG,GAAU,IAAI,aAAK,EAAE,CAAC;wBACtB,CAAC,GAAG,CAAC;;;6BAAE,CAAA,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;wBAC5B,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;wBACnB,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;wBAC3B,KAAA,CAAA,KAAA,GAAG,CAAA,CAAC,GAAG,CAAA;wBAAC,qBAAM,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;8BAAnC,SAAmC;wBAAE,qBAAM,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAAhF,wBAA6C,SAAmC,GAAC,CAAC;;;wBAH9C,CAAC,EAAE,CAAA;;4BAK3C,sBAAO,GAAG,EAAC;;;;KACd;IAEa,gBAAK,GAAnB,UAAoB,MAAe;QAC/B,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,eAAS,CAAC,OAAO,CAAC;IAChD,CAAC;IAEa,gBAAK,GAAnB,UAAoB,QAAQ,EAAE,KAAK,EAAE,MAAe;QAChD,IAAM,WAAW,GAAY,UAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QACjE,IAAM,IAAI,GAAW,EAAE,CAAC;QACxB,IAAM,MAAM,GAAW,EAAE,CAAC;QAE1B,OAAO,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,IAAM,GAAG,GAAY,UAAI,CAAC,cAAc,CAAC,WAAW,EAAE,eAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC9E,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,eAAS,CAAC,KAAK;gBACvC,MAAM,KAAK,CAAC,4CAA4C,CAAC,CAAC;YAC9D,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY;YACtC,IAAM,GAAG,GAAY,UAAI,CAAC,cAAc,CAAC,WAAW,EAAE,eAAS,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;gBACtF,IAAI,EAAE,eAAS,CAAC,SAAS;gBACzB,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,IAAI;gBACX,aAAa,EAAE,IAAI;gBACnB,cAAc,EAAE,IAAI;aACvB,CAAC,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,UAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;YACnC,MAAM,CAAC,IAAI,CAAC,UAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;SACxC;QACD,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IACL,iBAAC;AAAD,CAAC,AAhDD,CAAgC,WAAI,GAgDnC;AAhDY,gCAAU"}
@@ -0,0 +1,11 @@
1
+ import { Scope } from "../Scope";
2
+ import { DOM } from "../DOM";
3
+ import { Tag } from "../Tag";
4
+ import { TreeNode } from "../AST";
5
+ import { Node } from "./Node";
6
+ export declare class RootScopeMemberNode<T = any> extends Node implements TreeNode {
7
+ readonly name: TreeNode<string>;
8
+ constructor(name: TreeNode<string>);
9
+ protected _getChildNodes(): Node[];
10
+ evaluate(scope: Scope, dom: DOM, tag?: Tag): Promise<any>;
11
+ }
@@ -0,0 +1,87 @@
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.RootScopeMemberNode = void 0;
55
+ var Scope_1 = require("../Scope");
56
+ var Node_1 = require("./Node");
57
+ var RootScopeMemberNode = /** @class */ (function (_super) {
58
+ __extends(RootScopeMemberNode, _super);
59
+ function RootScopeMemberNode(name) {
60
+ var _this = _super.call(this) || this;
61
+ _this.name = name;
62
+ return _this;
63
+ }
64
+ RootScopeMemberNode.prototype._getChildNodes = function () {
65
+ return [
66
+ this.name
67
+ ];
68
+ };
69
+ RootScopeMemberNode.prototype.evaluate = function (scope, dom, tag) {
70
+ if (tag === void 0) { tag = null; }
71
+ return __awaiter(this, void 0, void 0, function () {
72
+ var name, value;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0: return [4 /*yield*/, this.name.evaluate(scope, dom, tag)];
76
+ case 1:
77
+ name = _a.sent();
78
+ value = scope.get(name);
79
+ return [2 /*return*/, value instanceof Scope_1.Scope && value.wrapped || value];
80
+ }
81
+ });
82
+ });
83
+ };
84
+ return RootScopeMemberNode;
85
+ }(Node_1.Node));
86
+ exports.RootScopeMemberNode = RootScopeMemberNode;
87
+ //# sourceMappingURL=RootScopeMemberNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RootScopeMemberNode.js","sourceRoot":"","sources":["../../src/AST/RootScopeMemberNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAA+B;AAI/B,+BAA4B;AAE5B;IAAkD,uCAAI;IAClD,6BACoB,IAAsB;QAD1C,YAGI,iBAAO,SACV;QAHmB,UAAI,GAAJ,IAAI,CAAkB;;IAG1C,CAAC;IAES,4CAAc,GAAxB;QACI,OAAO;YACH,IAAI,CAAC,IAAY;SACpB,CAAA;IACL,CAAC;IAEK,sCAAQ,GAAd,UAAe,KAAY,EAAE,GAAQ,EAAE,GAAe;QAAf,oBAAA,EAAA,UAAe;;;;;4BACrC,qBAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAAhD,IAAI,GAAG,SAAyC;wBAChD,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;wBAC9B,sBAAO,KAAK,YAAY,aAAK,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,EAAC;;;;KAC3D;IACL,0BAAC;AAAD,CAAC,AAlBD,CAAkD,WAAI,GAkBrD;AAlBY,kDAAmB"}
@@ -0,0 +1,12 @@
1
+ import { Scope } from "../Scope";
2
+ import { DOM } from "../DOM";
3
+ import { Tag } from "../Tag";
4
+ import { TreeNode } from "../AST";
5
+ import { Node } from "./Node";
6
+ export declare class ScopeMemberNode extends Node implements TreeNode {
7
+ readonly scope: TreeNode<Scope>;
8
+ readonly name: TreeNode<string>;
9
+ constructor(scope: TreeNode<Scope>, name: TreeNode<string>);
10
+ protected _getChildNodes(): Node[];
11
+ evaluate(scope: Scope, dom: DOM, tag?: Tag): Promise<any>;
12
+ }