vsn 0.1.26 → 0.1.29
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.
- package/demo/vsn.js +1 -1
- package/dist/AST/ArithmeticAssignmentNode.d.ts +23 -0
- package/dist/AST/ArithmeticAssignmentNode.js +313 -0
- package/dist/AST/ArithmeticAssignmentNode.js.map +1 -0
- package/dist/AST/ArithmeticNode.d.ts +15 -0
- package/dist/AST/ArithmeticNode.js +114 -0
- package/dist/AST/ArithmeticNode.js.map +1 -0
- package/dist/AST/ArrayNode.d.ts +14 -0
- package/dist/AST/ArrayNode.js +114 -0
- package/dist/AST/ArrayNode.js.map +1 -0
- package/dist/AST/BlockNode.d.ts +11 -0
- package/dist/AST/BlockNode.js +98 -0
- package/dist/AST/BlockNode.js.map +1 -0
- package/dist/AST/BooleanLiteralNode.d.ts +5 -0
- package/dist/AST/BooleanLiteralNode.js +31 -0
- package/dist/AST/BooleanLiteralNode.js.map +1 -0
- package/dist/AST/ComparisonNode.d.ts +15 -0
- package/dist/AST/ComparisonNode.js +120 -0
- package/dist/AST/ComparisonNode.js.map +1 -0
- package/dist/AST/ConditionalNode.d.ts +13 -0
- package/dist/AST/ConditionalNode.js +95 -0
- package/dist/AST/ConditionalNode.js.map +1 -0
- package/dist/AST/ElementAttributeNode.d.ts +18 -0
- package/dist/AST/ElementAttributeNode.js +159 -0
- package/dist/AST/ElementAttributeNode.js.map +1 -0
- package/dist/AST/ElementQueryNode.d.ts +12 -0
- package/dist/AST/ElementQueryNode.js +111 -0
- package/dist/AST/ElementQueryNode.js.map +1 -0
- package/dist/AST/ElementStyleNode.d.ts +18 -0
- package/dist/AST/ElementStyleNode.js +159 -0
- package/dist/AST/ElementStyleNode.js.map +1 -0
- package/dist/AST/ForStatementNode.d.ts +17 -0
- package/dist/AST/ForStatementNode.js +121 -0
- package/dist/AST/ForStatementNode.js.map +1 -0
- package/dist/AST/FunctionArgumentNode.d.ts +11 -0
- package/dist/AST/FunctionArgumentNode.js +100 -0
- package/dist/AST/FunctionArgumentNode.js.map +1 -0
- package/dist/AST/FunctionCallNode.d.ts +13 -0
- package/dist/AST/FunctionCallNode.js +102 -0
- package/dist/AST/FunctionCallNode.js.map +1 -0
- package/dist/AST/IfStatementNode.d.ts +14 -0
- package/dist/AST/IfStatementNode.js +128 -0
- package/dist/AST/IfStatementNode.js.map +1 -0
- package/dist/AST/InNode.d.ts +15 -0
- package/dist/AST/InNode.js +107 -0
- package/dist/AST/InNode.js.map +1 -0
- package/dist/AST/IndexNode.d.ts +16 -0
- package/dist/AST/IndexNode.js +126 -0
- package/dist/AST/IndexNode.js.map +1 -0
- package/dist/AST/LiteralNode.d.ts +10 -0
- package/dist/AST/LiteralNode.js +74 -0
- package/dist/AST/LiteralNode.js.map +1 -0
- package/dist/AST/Node.d.ts +19 -0
- package/dist/AST/Node.js +117 -0
- package/dist/AST/Node.js.map +1 -0
- package/dist/AST/NotNode.d.ts +12 -0
- package/dist/AST/NotNode.js +103 -0
- package/dist/AST/NotNode.js.map +1 -0
- package/dist/AST/NumberLiteralNode.d.ts +5 -0
- package/dist/AST/NumberLiteralNode.js +36 -0
- package/dist/AST/NumberLiteralNode.js.map +1 -0
- package/dist/AST/ObjectNode.d.ts +14 -0
- package/dist/AST/ObjectNode.js +131 -0
- package/dist/AST/ObjectNode.js.map +1 -0
- package/dist/AST/RootScopeMemberNode.d.ts +11 -0
- package/dist/AST/RootScopeMemberNode.js +87 -0
- package/dist/AST/RootScopeMemberNode.js.map +1 -0
- package/dist/AST/ScopeMemberNode.d.ts +12 -0
- package/dist/AST/ScopeMemberNode.js +128 -0
- package/dist/AST/ScopeMemberNode.js.map +1 -0
- package/dist/AST/UnitLiteralNode.d.ts +15 -0
- package/dist/AST/UnitLiteralNode.js +72 -0
- package/dist/AST/UnitLiteralNode.js.map +1 -0
- package/dist/AST.d.ts +7 -60
- package/dist/AST.js +778 -0
- package/dist/AST.js.map +1 -0
- package/dist/Attribute.d.ts +1 -1
- package/dist/Attribute.js +187 -0
- package/dist/Attribute.js.map +1 -0
- package/dist/Bencmark.js +179 -0
- package/dist/Bencmark.js.map +1 -0
- package/dist/Configuration.d.ts +1 -1
- package/dist/Configuration.js +64 -0
- package/dist/Configuration.js.map +1 -0
- package/dist/Controller.d.ts +4 -2
- package/dist/Controller.js +62 -0
- package/dist/Controller.js.map +1 -0
- package/dist/DOM/DOMObject.d.ts +1 -1
- package/dist/DOM/DOMObject.js +47 -0
- package/dist/DOM/DOMObject.js.map +1 -0
- package/dist/DOM/WrappedDocument.js +34 -0
- package/dist/DOM/WrappedDocument.js.map +1 -0
- package/dist/DOM/WrappedWindow.js +45 -0
- package/dist/DOM/WrappedWindow.js.map +1 -0
- package/dist/DOM.d.ts +1 -1
- package/dist/DOM.js +547 -0
- package/dist/DOM.js.map +1 -0
- package/dist/EventDispatcher.d.ts +29 -0
- package/dist/EventDispatcher.js +132 -0
- package/dist/EventDispatcher.js.map +1 -0
- package/dist/Formats.js +44 -0
- package/dist/Formats.js.map +1 -0
- package/dist/MessageList.d.ts +15 -0
- package/dist/MessageList.js +96 -0
- package/dist/MessageList.js.map +1 -0
- package/dist/Model/Field.d.ts +8 -0
- package/dist/Model/Field.js +38 -0
- package/dist/Model/Field.js.map +1 -0
- package/dist/Model.d.ts +12 -0
- package/dist/Model.js +61 -0
- package/dist/Model.js.map +1 -0
- package/dist/Query.js +66 -0
- package/dist/Query.js.map +1 -0
- package/dist/Registry.d.ts +5 -2
- package/dist/Registry.js +139 -0
- package/dist/Registry.js.map +1 -0
- package/dist/Scope/DynamicScopeData.d.ts +6 -0
- package/dist/Scope/DynamicScopeData.js +54 -0
- package/dist/Scope/DynamicScopeData.js.map +1 -0
- package/dist/Scope/QueryReference.d.ts +10 -0
- package/dist/Scope/QueryReference.js +103 -0
- package/dist/Scope/QueryReference.js.map +1 -0
- package/dist/Scope/ScopeData.d.ts +4 -0
- package/dist/Scope/ScopeData.js +40 -0
- package/dist/Scope/ScopeData.js.map +1 -0
- package/dist/Scope/ScopeDataAbstract.d.ts +22 -0
- package/dist/Scope/ScopeDataAbstract.js +137 -0
- package/dist/Scope/ScopeDataAbstract.js.map +1 -0
- package/dist/Scope/ScopeReference.d.ts +10 -0
- package/dist/Scope/ScopeReference.js +73 -0
- package/dist/Scope/ScopeReference.js.map +1 -0
- package/dist/Scope/ScopedVariableType.d.ts +6 -0
- package/dist/Scope/ScopedVariableType.js +14 -0
- package/dist/Scope/ScopedVariableType.js.map +1 -0
- package/dist/Scope/WrappedArray.d.ts +16 -0
- package/dist/Scope/WrappedArray.js +121 -0
- package/dist/Scope/WrappedArray.js.map +1 -0
- package/dist/Scope/properties/Property.d.ts +18 -0
- package/dist/Scope/properties/Property.js +93 -0
- package/dist/Scope/properties/Property.js.map +1 -0
- package/dist/Scope.d.ts +4 -48
- package/dist/Scope.js +227 -0
- package/dist/Scope.js.map +1 -0
- package/dist/SimplePromise.d.ts +42 -0
- package/dist/SimplePromise.js +217 -0
- package/dist/SimplePromise.js.map +1 -0
- package/dist/Tag/List.js +85 -0
- package/dist/Tag/List.js.map +1 -0
- package/dist/Tag.js +770 -0
- package/dist/Tag.js.map +1 -0
- package/dist/Types.d.ts +1 -0
- package/dist/Types.js +54 -0
- package/dist/Types.js.map +1 -0
- package/dist/Validators.d.ts +7 -0
- package/dist/Validators.js +54 -0
- package/dist/Validators.js.map +1 -0
- package/dist/attributes/AddClassIf.js +93 -0
- package/dist/attributes/AddClassIf.js.map +1 -0
- package/dist/attributes/Bind.js +272 -0
- package/dist/attributes/Bind.js.map +1 -0
- package/dist/attributes/ClassConstructor.d.ts +1 -0
- package/dist/attributes/ClassConstructor.js +104 -0
- package/dist/attributes/ClassConstructor.js.map +1 -0
- package/dist/attributes/ClickRemoveClass.js +114 -0
- package/dist/attributes/ClickRemoveClass.js.map +1 -0
- package/dist/attributes/ClickToggleClass.js +114 -0
- package/dist/attributes/ClickToggleClass.js.map +1 -0
- package/dist/attributes/ControllerAttribute.js +28 -0
- package/dist/attributes/ControllerAttribute.js.map +1 -0
- package/dist/attributes/DisableIf.js +94 -0
- package/dist/attributes/DisableIf.js.map +1 -0
- package/dist/attributes/Exec.js +108 -0
- package/dist/attributes/Exec.js.map +1 -0
- package/dist/attributes/Format.js +99 -0
- package/dist/attributes/Format.js.map +1 -0
- package/dist/attributes/If.js +159 -0
- package/dist/attributes/If.js.map +1 -0
- package/dist/attributes/JSONAttribute.js +118 -0
- package/dist/attributes/JSONAttribute.js.map +1 -0
- package/dist/attributes/KeyAbstract.js +117 -0
- package/dist/attributes/KeyAbstract.js.map +1 -0
- package/dist/attributes/KeyDown.js +88 -0
- package/dist/attributes/KeyDown.js.map +1 -0
- package/dist/attributes/KeyUp.js +88 -0
- package/dist/attributes/KeyUp.js.map +1 -0
- package/dist/attributes/List.js +282 -0
- package/dist/attributes/List.js.map +1 -0
- package/dist/attributes/ListItem.js +138 -0
- package/dist/attributes/ListItem.js.map +1 -0
- package/dist/attributes/ListItemModel.js +39 -0
- package/dist/attributes/ListItemModel.js.map +1 -0
- package/dist/attributes/ModelAttribute.js +29 -0
- package/dist/attributes/ModelAttribute.js.map +1 -0
- package/dist/attributes/Name.js +88 -0
- package/dist/attributes/Name.js.map +1 -0
- package/dist/attributes/On.js +135 -0
- package/dist/attributes/On.js.map +1 -0
- package/dist/attributes/Radio.js +174 -0
- package/dist/attributes/Radio.js.map +1 -0
- package/dist/attributes/Referenced.js +38 -0
- package/dist/attributes/Referenced.js.map +1 -0
- package/dist/attributes/RootAttribute.js +91 -0
- package/dist/attributes/RootAttribute.js.map +1 -0
- package/dist/attributes/ScopeAttribute.js +40 -0
- package/dist/attributes/ScopeAttribute.js.map +1 -0
- package/dist/attributes/ScopeChange.js +130 -0
- package/dist/attributes/ScopeChange.js.map +1 -0
- package/dist/attributes/SetAttribute.js +133 -0
- package/dist/attributes/SetAttribute.js.map +1 -0
- package/dist/attributes/StandardAttribute.js +186 -0
- package/dist/attributes/StandardAttribute.js.map +1 -0
- package/dist/attributes/StyleAttribute.js +183 -0
- package/dist/attributes/StyleAttribute.js.map +1 -0
- package/dist/attributes/Template.js +39 -0
- package/dist/attributes/Template.js.map +1 -0
- package/dist/attributes/TypeAttribute.js +104 -0
- package/dist/attributes/TypeAttribute.js.map +1 -0
- package/dist/attributes/_imports.js +60 -0
- package/dist/attributes/_imports.js.map +1 -0
- package/dist/helpers/DOMHelper.js +81 -0
- package/dist/helpers/DOMHelper.js.map +1 -0
- package/dist/helpers/ElementHelper.js +25 -0
- package/dist/helpers/ElementHelper.js.map +1 -0
- package/dist/helpers/VisionHelper.js +71 -0
- package/dist/helpers/VisionHelper.js.map +1 -0
- package/dist/helpers/decorators.js +38 -0
- package/dist/helpers/decorators.js.map +1 -0
- package/dist/vsn.d.ts +11 -2
- package/dist/vsn.js +181 -0
- package/dist/vsn.js.map +1 -0
- package/package.json +2 -6
- package/src/AST/ArithmeticAssignmentNode.ts +236 -0
- package/src/AST/ArithmeticNode.ts +52 -0
- package/src/AST/ArrayNode.ts +39 -0
- package/src/AST/BlockNode.ts +25 -0
- package/src/AST/BooleanLiteralNode.ts +10 -0
- package/src/AST/ComparisonNode.ts +57 -0
- package/src/AST/ConditionalNode.ts +36 -0
- package/src/AST/ElementAttributeNode.ts +63 -0
- package/src/AST/ElementQueryNode.ts +25 -0
- package/src/AST/ElementStyleNode.ts +63 -0
- package/src/AST/ForStatementNode.ts +59 -0
- package/src/AST/FunctionArgumentNode.ts +27 -0
- package/src/AST/FunctionCallNode.ts +32 -0
- package/src/AST/IfStatementNode.ts +67 -0
- package/src/AST/InNode.ts +46 -0
- package/src/AST/IndexNode.ts +61 -0
- package/src/AST/LiteralNode.ts +17 -0
- package/src/AST/Node.ts +71 -0
- package/src/AST/NotNode.ts +41 -0
- package/src/AST/NumberLiteralNode.ts +14 -0
- package/src/AST/ObjectNode.ts +55 -0
- package/src/AST/RootScopeMemberNode.ts +25 -0
- package/src/AST/ScopeMemberNode.ts +53 -0
- package/src/AST/UnitLiteralNode.ts +51 -0
- package/src/AST.ts +34 -1094
- package/src/Attribute.ts +2 -2
- package/src/Configuration.ts +3 -3
- package/src/Controller.ts +10 -2
- package/src/DOM/DOMObject.ts +1 -1
- package/src/DOM.ts +3 -3
- package/src/EventDispatcher.ts +134 -0
- package/src/Formats.ts +2 -2
- package/src/MessageList.ts +85 -0
- package/src/Model/Field.ts +20 -0
- package/src/Model.ts +43 -0
- package/src/Registry.ts +13 -3
- package/src/Scope/DynamicScopeData.ts +29 -0
- package/src/Scope/QueryReference.ts +29 -0
- package/src/Scope/ScopeData.ts +21 -0
- package/src/Scope/ScopeDataAbstract.ts +126 -0
- package/src/Scope/ScopeReference.ts +30 -0
- package/src/Scope/ScopedVariableType.ts +7 -0
- package/src/Scope/WrappedArray.ts +88 -0
- package/src/Scope/properties/Property.ts +79 -0
- package/src/Scope.ts +31 -252
- package/src/SimplePromise.ts +219 -0
- package/src/Tag.ts +3 -3
- package/src/Types.ts +6 -1
- package/src/Validators.ts +45 -0
- package/src/attributes/Bind.ts +4 -4
- package/src/attributes/ClassConstructor.ts +2 -1
- package/src/attributes/JSONAttribute.ts +2 -1
- package/src/attributes/List.ts +4 -4
- package/src/attributes/Radio.ts +3 -2
- package/src/attributes/ScopeChange.ts +2 -2
- package/src/attributes/SetAttribute.ts +2 -1
- package/src/attributes/StandardAttribute.ts +1 -1
- package/src/attributes/StyleAttribute.ts +3 -2
- package/src/attributes/TypeAttribute.ts +1 -1
- package/src/vsn.ts +16 -5
- package/test/AST/ArithmeticAssignmentNode.spec.ts +47 -0
- package/test/AST.spec.ts +3 -2
- package/test/Controller.spec.ts +44 -0
- package/test/MessageList.spec.ts +101 -0
- package/test/Model/DataModel.spec.ts +0 -0
- package/test/Scope/DynamicScopeData.spec.ts +141 -0
- package/test/Scope.spec.ts +15 -3
- package/test/SimplePromise.spec.ts +271 -0
- package/test/Tag/TagList.spec.ts +1 -1
- package/test/attributes/Bind.spec.ts +5 -5
- package/test/attributes/ListItem.spec.ts +1 -1
- package/dist/vsn.min.js +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
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.BlockNode = void 0;
|
|
60
|
+
var Node_1 = require("./Node");
|
|
61
|
+
var BlockNode = /** @class */ (function (_super) {
|
|
62
|
+
__extends(BlockNode, _super);
|
|
63
|
+
function BlockNode(statements) {
|
|
64
|
+
var _this = _super.call(this) || this;
|
|
65
|
+
_this.statements = statements;
|
|
66
|
+
return _this;
|
|
67
|
+
}
|
|
68
|
+
BlockNode.prototype._getChildNodes = function () {
|
|
69
|
+
return __spreadArray([], this.statements);
|
|
70
|
+
};
|
|
71
|
+
BlockNode.prototype.evaluate = function (scope, dom, tag) {
|
|
72
|
+
if (tag === void 0) { tag = null; }
|
|
73
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
+
var returnValue, i;
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0:
|
|
78
|
+
returnValue = null;
|
|
79
|
+
i = 0;
|
|
80
|
+
_a.label = 1;
|
|
81
|
+
case 1:
|
|
82
|
+
if (!(i < this.statements.length)) return [3 /*break*/, 4];
|
|
83
|
+
return [4 /*yield*/, this.statements[i].evaluate(scope, dom, tag)];
|
|
84
|
+
case 2:
|
|
85
|
+
returnValue = _a.sent();
|
|
86
|
+
_a.label = 3;
|
|
87
|
+
case 3:
|
|
88
|
+
i++;
|
|
89
|
+
return [3 /*break*/, 1];
|
|
90
|
+
case 4: return [2 /*return*/, returnValue];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
return BlockNode;
|
|
96
|
+
}(Node_1.Node));
|
|
97
|
+
exports.BlockNode = BlockNode;
|
|
98
|
+
//# sourceMappingURL=BlockNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockNode.js","sourceRoot":"","sources":["../../src/AST/BlockNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,+BAA4B;AAE5B;IAA+B,6BAAI;IAC/B,mBACoB,UAAkB;QADtC,YAGI,iBAAO,SACV;QAHmB,gBAAU,GAAV,UAAU,CAAQ;;IAGtC,CAAC;IAES,kCAAc,GAAxB;QACI,yBAAY,IAAI,CAAC,UAAqB,EAAE;IAC5C,CAAC;IAEY,4BAAQ,GAArB,UAAsB,KAAY,EAAE,GAAQ,EAAE,GAAe;QAAf,oBAAA,EAAA,UAAe;;;;;;wBACrD,WAAW,GAAQ,IAAI,CAAC;wBACnB,CAAC,GAAG,CAAC;;;6BAAE,CAAA,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAA;wBACxB,qBAAM,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAAhE,WAAW,GAAG,SAAkD,CAAC;;;wBADzB,CAAC,EAAE,CAAA;;4BAG/C,sBAAO,WAAW,EAAC;;;;KACtB;IACL,gBAAC;AAAD,CAAC,AAlBD,CAA+B,WAAI,GAkBlC;AAlBY,8BAAS"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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.BooleanLiteralNode = void 0;
|
|
19
|
+
var LiteralNode_1 = require("./LiteralNode");
|
|
20
|
+
var BooleanLiteralNode = /** @class */ (function (_super) {
|
|
21
|
+
__extends(BooleanLiteralNode, _super);
|
|
22
|
+
function BooleanLiteralNode(value) {
|
|
23
|
+
var _this = _super.call(this, value) || this;
|
|
24
|
+
_this.value = value;
|
|
25
|
+
_this.value = value === 'true';
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
return BooleanLiteralNode;
|
|
29
|
+
}(LiteralNode_1.LiteralNode));
|
|
30
|
+
exports.BooleanLiteralNode = BooleanLiteralNode;
|
|
31
|
+
//# sourceMappingURL=BooleanLiteralNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BooleanLiteralNode.js","sourceRoot":"","sources":["../../src/AST/BooleanLiteralNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6CAA0C;AAE1C;IAAwC,sCAAmB;IACvD,4BACoB,KAAU;QAD9B,YAGI,kBAAM,KAAK,CAAC,SAEf;QAJmB,WAAK,GAAL,KAAK,CAAK;QAG1B,KAAI,CAAC,KAAK,GAAG,KAAK,KAAK,MAAM,CAAC;;IAClC,CAAC;IACL,yBAAC;AAAD,CAAC,AAPD,CAAwC,yBAAW,GAOlD;AAPY,gDAAkB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Scope } from "../Scope";
|
|
2
|
+
import { DOM } from "../DOM";
|
|
3
|
+
import { Tag } from "../Tag";
|
|
4
|
+
import { Token, TokenType, TreeNode } from "../AST";
|
|
5
|
+
import { Node } from "./Node";
|
|
6
|
+
export declare class ComparisonNode extends Node implements TreeNode {
|
|
7
|
+
readonly left: Node;
|
|
8
|
+
readonly right: Node;
|
|
9
|
+
readonly type: TokenType;
|
|
10
|
+
constructor(left: Node, right: Node, type: TokenType);
|
|
11
|
+
protected _getChildNodes(): Node[];
|
|
12
|
+
evaluate(scope: Scope, dom: DOM, tag?: Tag): Promise<boolean>;
|
|
13
|
+
static match(tokens: Token[]): boolean;
|
|
14
|
+
static parse(lastNode: any, token: any, tokens: Token[]): ComparisonNode;
|
|
15
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
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.ComparisonNode = void 0;
|
|
55
|
+
var AST_1 = require("../AST");
|
|
56
|
+
var Node_1 = require("./Node");
|
|
57
|
+
var ComparisonNode = /** @class */ (function (_super) {
|
|
58
|
+
__extends(ComparisonNode, _super);
|
|
59
|
+
function ComparisonNode(left, right, type) {
|
|
60
|
+
var _this = _super.call(this) || this;
|
|
61
|
+
_this.left = left;
|
|
62
|
+
_this.right = right;
|
|
63
|
+
_this.type = type;
|
|
64
|
+
return _this;
|
|
65
|
+
}
|
|
66
|
+
ComparisonNode.prototype._getChildNodes = function () {
|
|
67
|
+
return [
|
|
68
|
+
this.left,
|
|
69
|
+
this.right
|
|
70
|
+
];
|
|
71
|
+
};
|
|
72
|
+
ComparisonNode.prototype.evaluate = function (scope, dom, tag) {
|
|
73
|
+
if (tag === void 0) { tag = null; }
|
|
74
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
+
var left, right;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0: return [4 /*yield*/, this.left.evaluate(scope, dom, tag)];
|
|
79
|
+
case 1:
|
|
80
|
+
left = _a.sent();
|
|
81
|
+
return [4 /*yield*/, this.right.evaluate(scope, dom, tag)];
|
|
82
|
+
case 2:
|
|
83
|
+
right = _a.sent();
|
|
84
|
+
switch (this.type) {
|
|
85
|
+
case AST_1.TokenType.EQUALS:
|
|
86
|
+
return [2 /*return*/, left === right];
|
|
87
|
+
case AST_1.TokenType.NOT_EQUALS:
|
|
88
|
+
return [2 /*return*/, left !== right];
|
|
89
|
+
case AST_1.TokenType.GREATER_THAN:
|
|
90
|
+
return [2 /*return*/, left > right];
|
|
91
|
+
case AST_1.TokenType.LESS_THAN:
|
|
92
|
+
return [2 /*return*/, left < right];
|
|
93
|
+
case AST_1.TokenType.GREATER_THAN_EQUAL:
|
|
94
|
+
return [2 /*return*/, left >= right];
|
|
95
|
+
case AST_1.TokenType.LESS_THAN_EQUAL:
|
|
96
|
+
return [2 /*return*/, left <= right];
|
|
97
|
+
}
|
|
98
|
+
return [2 /*return*/];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
ComparisonNode.match = function (tokens) {
|
|
104
|
+
return [
|
|
105
|
+
AST_1.TokenType.EQUALS,
|
|
106
|
+
AST_1.TokenType.NOT_EQUALS,
|
|
107
|
+
AST_1.TokenType.GREATER_THAN,
|
|
108
|
+
AST_1.TokenType.LESS_THAN,
|
|
109
|
+
AST_1.TokenType.GREATER_THAN_EQUAL,
|
|
110
|
+
AST_1.TokenType.LESS_THAN_EQUAL
|
|
111
|
+
].indexOf(tokens[0].type) > -1;
|
|
112
|
+
};
|
|
113
|
+
ComparisonNode.parse = function (lastNode, token, tokens) {
|
|
114
|
+
tokens.splice(0, 1); // Remove comparison operator
|
|
115
|
+
return new ComparisonNode(lastNode, AST_1.Tree.processTokens(AST_1.Tree.getNextStatementTokens(tokens)), token.type);
|
|
116
|
+
};
|
|
117
|
+
return ComparisonNode;
|
|
118
|
+
}(Node_1.Node));
|
|
119
|
+
exports.ComparisonNode = ComparisonNode;
|
|
120
|
+
//# sourceMappingURL=ComparisonNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComparisonNode.js","sourceRoot":"","sources":["../../src/AST/ComparisonNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,8BAAwD;AACxD,+BAA4B;AAE5B;IAAoC,kCAAI;IACpC,wBACoB,IAAU,EACV,KAAW,EACX,IAAe;QAHnC,YAKI,iBAAO,SACV;QALmB,UAAI,GAAJ,IAAI,CAAM;QACV,WAAK,GAAL,KAAK,CAAM;QACX,UAAI,GAAJ,IAAI,CAAW;;IAGnC,CAAC;IAES,uCAAc,GAAxB;QACI,OAAO;YACH,IAAI,CAAC,IAAY;YACjB,IAAI,CAAC,KAAa;SACrB,CAAC;IACN,CAAC;IAEY,iCAAQ,GAArB,UAAsB,KAAY,EAAE,GAAQ,EAAE,GAAe;QAAf,oBAAA,EAAA,UAAe;;;;;4BACvC,qBAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAArD,IAAI,GAAQ,SAAyC;wBACxC,qBAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAAvD,KAAK,GAAQ,SAA0C;wBAC7D,QAAQ,IAAI,CAAC,IAAI,EAAE;4BACf,KAAK,eAAS,CAAC,MAAM;gCACjB,sBAAO,IAAI,KAAK,KAAK,EAAC;4BAC1B,KAAK,eAAS,CAAC,UAAU;gCACrB,sBAAO,IAAI,KAAK,KAAK,EAAC;4BAC1B,KAAK,eAAS,CAAC,YAAY;gCACvB,sBAAO,IAAI,GAAG,KAAK,EAAC;4BACxB,KAAK,eAAS,CAAC,SAAS;gCACpB,sBAAO,IAAI,GAAG,KAAK,EAAC;4BACxB,KAAK,eAAS,CAAC,kBAAkB;gCAC7B,sBAAO,IAAI,IAAI,KAAK,EAAC;4BACzB,KAAK,eAAS,CAAC,eAAe;gCAC1B,sBAAO,IAAI,IAAI,KAAK,EAAC;yBAC5B;;;;;KACJ;IAEa,oBAAK,GAAnB,UAAoB,MAAe;QAC/B,OAAO;YACH,eAAS,CAAC,MAAM;YAChB,eAAS,CAAC,UAAU;YACpB,eAAS,CAAC,YAAY;YACtB,eAAS,CAAC,SAAS;YACnB,eAAS,CAAC,kBAAkB;YAC5B,eAAS,CAAC,eAAe;SAC5B,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IAClC,CAAC;IAEa,oBAAK,GAAnB,UAAoB,QAAQ,EAAE,KAAK,EAAE,MAAe;QAChD,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,6BAA6B;QAClD,OAAO,IAAI,cAAc,CAAC,QAAQ,EAAE,UAAI,CAAC,aAAa,CAAC,UAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IAC5G,CAAC;IACL,qBAAC;AAAD,CAAC,AAlDD,CAAoC,WAAI,GAkDvC;AAlDY,wCAAc"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Scope } from "../Scope";
|
|
2
|
+
import { DOM } from "../DOM";
|
|
3
|
+
import { Tag } from "../Tag";
|
|
4
|
+
import { TreeNode } from "../AST";
|
|
5
|
+
import { BlockNode } from "./BlockNode";
|
|
6
|
+
import { Node } from "./Node";
|
|
7
|
+
export declare class ConditionalNode extends Node implements TreeNode {
|
|
8
|
+
readonly condition: Node;
|
|
9
|
+
readonly block: BlockNode;
|
|
10
|
+
constructor(condition: Node, block: BlockNode);
|
|
11
|
+
protected _getChildNodes(): Node[];
|
|
12
|
+
evaluate(scope: Scope, dom: DOM, tag?: Tag): Promise<boolean>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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.ConditionalNode = void 0;
|
|
55
|
+
var WrappedArray_1 = require("../Scope/WrappedArray");
|
|
56
|
+
var Node_1 = require("./Node");
|
|
57
|
+
var ConditionalNode = /** @class */ (function (_super) {
|
|
58
|
+
__extends(ConditionalNode, _super);
|
|
59
|
+
function ConditionalNode(condition, block) {
|
|
60
|
+
var _this = _super.call(this) || this;
|
|
61
|
+
_this.condition = condition;
|
|
62
|
+
_this.block = block;
|
|
63
|
+
return _this;
|
|
64
|
+
}
|
|
65
|
+
ConditionalNode.prototype._getChildNodes = function () {
|
|
66
|
+
return [
|
|
67
|
+
this.condition,
|
|
68
|
+
this.block
|
|
69
|
+
];
|
|
70
|
+
};
|
|
71
|
+
ConditionalNode.prototype.evaluate = function (scope, dom, tag) {
|
|
72
|
+
if (tag === void 0) { tag = null; }
|
|
73
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
+
var condition, evaluation;
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0: return [4 /*yield*/, this.condition.evaluate(scope, dom, tag)];
|
|
78
|
+
case 1:
|
|
79
|
+
condition = _a.sent();
|
|
80
|
+
evaluation = false;
|
|
81
|
+
if (condition instanceof WrappedArray_1.WrappedArray) {
|
|
82
|
+
evaluation = condition.length > 0;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
evaluation = !!condition;
|
|
86
|
+
}
|
|
87
|
+
return [2 /*return*/, evaluation];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
return ConditionalNode;
|
|
93
|
+
}(Node_1.Node));
|
|
94
|
+
exports.ConditionalNode = ConditionalNode;
|
|
95
|
+
//# sourceMappingURL=ConditionalNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConditionalNode.js","sourceRoot":"","sources":["../../src/AST/ConditionalNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sDAAmD;AAGnD,+BAA4B;AAE5B;IAAqC,mCAAI;IACrC,yBACoB,SAAe,EACf,KAAgB;QAFpC,YAII,iBAAO,SACV;QAJmB,eAAS,GAAT,SAAS,CAAM;QACf,WAAK,GAAL,KAAK,CAAW;;IAGpC,CAAC;IAES,wCAAc,GAAxB;QACI,OAAO;YACH,IAAI,CAAC,SAAiB;YACtB,IAAI,CAAC,KAAa;SACrB,CAAC;IACN,CAAC;IAEY,kCAAQ,GAArB,UAAsB,KAAY,EAAE,GAAQ,EAAE,GAAe;QAAf,oBAAA,EAAA,UAAe;;;;;4BACvC,qBAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAA1D,SAAS,GAAG,SAA8C;wBAC5D,UAAU,GAAG,KAAK,CAAC;wBAEvB,IAAI,SAAS,YAAY,2BAAY,EAAE;4BACnC,UAAU,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;yBACrC;6BAAM;4BACH,UAAU,GAAG,CAAC,CAAC,SAAS,CAAC;yBAC5B;wBAED,sBAAO,UAAU,EAAC;;;;KACrB;IACL,sBAAC;AAAD,CAAC,AA3BD,CAAqC,WAAI,GA2BxC;AA3BY,0CAAe"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
import { ElementQueryNode } from "./ElementQueryNode";
|
|
7
|
+
import { LiteralNode } from "./LiteralNode";
|
|
8
|
+
export declare class ElementAttributeNode extends Node implements TreeNode {
|
|
9
|
+
readonly elementRef: ElementQueryNode | null;
|
|
10
|
+
readonly attr: string;
|
|
11
|
+
protected requiresPrep: boolean;
|
|
12
|
+
constructor(elementRef: ElementQueryNode | null, attr: string);
|
|
13
|
+
get name(): LiteralNode<string>;
|
|
14
|
+
protected _getChildNodes(): Node[];
|
|
15
|
+
get attributeName(): string;
|
|
16
|
+
evaluate(scope: Scope, dom: DOM, tag?: Tag): Promise<any>;
|
|
17
|
+
prepare(scope: Scope, dom: DOM, tag?: Tag): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
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.ElementAttributeNode = void 0;
|
|
55
|
+
var List_1 = require("../Tag/List");
|
|
56
|
+
var Node_1 = require("./Node");
|
|
57
|
+
var LiteralNode_1 = require("./LiteralNode");
|
|
58
|
+
var ElementAttributeNode = /** @class */ (function (_super) {
|
|
59
|
+
__extends(ElementAttributeNode, _super);
|
|
60
|
+
function ElementAttributeNode(elementRef, attr) {
|
|
61
|
+
var _this = _super.call(this) || this;
|
|
62
|
+
_this.elementRef = elementRef;
|
|
63
|
+
_this.attr = attr;
|
|
64
|
+
_this.requiresPrep = true;
|
|
65
|
+
return _this;
|
|
66
|
+
}
|
|
67
|
+
Object.defineProperty(ElementAttributeNode.prototype, "name", {
|
|
68
|
+
get: function () {
|
|
69
|
+
return new LiteralNode_1.LiteralNode("@" + this.attributeName);
|
|
70
|
+
},
|
|
71
|
+
enumerable: false,
|
|
72
|
+
configurable: true
|
|
73
|
+
});
|
|
74
|
+
ElementAttributeNode.prototype._getChildNodes = function () {
|
|
75
|
+
var nodes = [];
|
|
76
|
+
if (this.elementRef)
|
|
77
|
+
nodes.push(this.elementRef);
|
|
78
|
+
return nodes;
|
|
79
|
+
};
|
|
80
|
+
Object.defineProperty(ElementAttributeNode.prototype, "attributeName", {
|
|
81
|
+
get: function () {
|
|
82
|
+
if (this.attr.startsWith('.'))
|
|
83
|
+
return this.attr.substring(2);
|
|
84
|
+
return this.attr.substring(1);
|
|
85
|
+
},
|
|
86
|
+
enumerable: false,
|
|
87
|
+
configurable: true
|
|
88
|
+
});
|
|
89
|
+
ElementAttributeNode.prototype.evaluate = function (scope, dom, tag) {
|
|
90
|
+
if (tag === void 0) { tag = null; }
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var tags;
|
|
93
|
+
var _this = this;
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
switch (_a.label) {
|
|
96
|
+
case 0:
|
|
97
|
+
if (!this.elementRef) return [3 /*break*/, 2];
|
|
98
|
+
return [4 /*yield*/, this.elementRef.evaluate(scope, dom, tag)];
|
|
99
|
+
case 1:
|
|
100
|
+
tags = _a.sent();
|
|
101
|
+
return [3 /*break*/, 3];
|
|
102
|
+
case 2:
|
|
103
|
+
if (tag) {
|
|
104
|
+
tags = new List_1.TagList(tag);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
return [2 /*return*/];
|
|
108
|
+
}
|
|
109
|
+
_a.label = 3;
|
|
110
|
+
case 3:
|
|
111
|
+
if (tags.length === 1)
|
|
112
|
+
return [2 /*return*/, tags[0].scope.get("@" + this.attributeName)];
|
|
113
|
+
return [2 /*return*/, tags.map(function (tag) { return tag.scope.get("@" + _this.attributeName); })];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
ElementAttributeNode.prototype.prepare = function (scope, dom, tag) {
|
|
119
|
+
if (tag === void 0) { tag = null; }
|
|
120
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
+
var tags, _i, tags_1, t;
|
|
122
|
+
return __generator(this, function (_a) {
|
|
123
|
+
switch (_a.label) {
|
|
124
|
+
case 0:
|
|
125
|
+
if (!this.elementRef) return [3 /*break*/, 7];
|
|
126
|
+
return [4 /*yield*/, this.elementRef.prepare(scope, dom, tag)];
|
|
127
|
+
case 1:
|
|
128
|
+
_a.sent();
|
|
129
|
+
return [4 /*yield*/, this.elementRef.evaluate(scope, dom, tag)];
|
|
130
|
+
case 2:
|
|
131
|
+
tags = _a.sent();
|
|
132
|
+
_i = 0, tags_1 = tags;
|
|
133
|
+
_a.label = 3;
|
|
134
|
+
case 3:
|
|
135
|
+
if (!(_i < tags_1.length)) return [3 /*break*/, 6];
|
|
136
|
+
t = tags_1[_i];
|
|
137
|
+
return [4 /*yield*/, t.watchAttribute(this.attributeName)];
|
|
138
|
+
case 4:
|
|
139
|
+
_a.sent();
|
|
140
|
+
_a.label = 5;
|
|
141
|
+
case 5:
|
|
142
|
+
_i++;
|
|
143
|
+
return [3 /*break*/, 3];
|
|
144
|
+
case 6: return [3 /*break*/, 9];
|
|
145
|
+
case 7:
|
|
146
|
+
if (!tag) return [3 /*break*/, 9];
|
|
147
|
+
return [4 /*yield*/, tag.watchAttribute(this.attributeName)];
|
|
148
|
+
case 8:
|
|
149
|
+
_a.sent();
|
|
150
|
+
_a.label = 9;
|
|
151
|
+
case 9: return [2 /*return*/];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
return ElementAttributeNode;
|
|
157
|
+
}(Node_1.Node));
|
|
158
|
+
exports.ElementAttributeNode = ElementAttributeNode;
|
|
159
|
+
//# sourceMappingURL=ElementAttributeNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ElementAttributeNode.js","sourceRoot":"","sources":["../../src/AST/ElementAttributeNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,oCAAoC;AAEpC,+BAA4B;AAE5B,6CAA0C;AAE1C;IAA0C,wCAAI;IAG1C,8BACoB,UAAmC,EACnC,IAAY;QAFhC,YAII,iBAAO,SACV;QAJmB,gBAAU,GAAV,UAAU,CAAyB;QACnC,UAAI,GAAJ,IAAI,CAAQ;QAJtB,kBAAY,GAAY,IAAI,CAAC;;IAOvC,CAAC;IAED,sBAAW,sCAAI;aAAf;YACI,OAAO,IAAI,yBAAW,CAAS,MAAI,IAAI,CAAC,aAAe,CAAC,CAAC;QAC7D,CAAC;;;OAAA;IAES,6CAAc,GAAxB;QACI,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,IAAI,IAAI,CAAC,UAAU;YACf,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAC/B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,sBAAI,+CAAa;aAAjB;YACI,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;gBACzB,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAClC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC;;;OAAA;IAEK,uCAAQ,GAAd,UAAe,KAAY,EAAE,GAAQ,EAAE,GAAe;QAAf,oBAAA,EAAA,UAAe;;;;;;;6BAE9C,IAAI,CAAC,UAAU,EAAf,wBAAe;wBACR,qBAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAAtD,IAAI,GAAG,SAA+C,CAAC;;;wBACpD,IAAI,GAAG,EAAE;4BACZ,IAAI,GAAG,IAAI,cAAO,CAAC,GAAG,CAAC,CAAA;yBAC1B;6BAAM;4BACH,sBAAO;yBACV;;;wBAED,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;4BACjB,sBAAO,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAI,IAAI,CAAC,aAAe,CAAC,EAAC;wBAEvD,sBAAO,IAAI,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAI,KAAI,CAAC,aAAe,CAAC,EAAvC,CAAuC,CAAC,EAAC;;;;KACrE;IAEK,sCAAO,GAAb,UAAc,KAAY,EAAE,GAAQ,EAAE,GAAe;QAAf,oBAAA,EAAA,UAAe;;;;;;6BAC7C,IAAI,CAAC,UAAU,EAAf,wBAAe;wBACf,qBAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAA9C,SAA8C,CAAC;wBACzB,qBAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAA/D,IAAI,GAAY,SAA+C;8BACjD,EAAJ,aAAI;;;6BAAJ,CAAA,kBAAI,CAAA;wBAAT,CAAC;wBACR,qBAAM,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,EAAA;;wBAA1C,SAA0C,CAAC;;;wBAD/B,IAAI,CAAA;;;;6BAEd,GAAG,EAAH,wBAAG;wBACT,qBAAM,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,EAAA;;wBAA5C,SAA4C,CAAC;;;;;;KAEpD;IACL,2BAAC;AAAD,CAAC,AArDD,CAA0C,WAAI,GAqD7C;AArDY,oDAAoB"}
|
|
@@ -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 ElementQueryNode extends Node implements TreeNode {
|
|
7
|
+
readonly query: string;
|
|
8
|
+
protected requiresPrep: boolean;
|
|
9
|
+
constructor(query: string);
|
|
10
|
+
evaluate(scope: Scope, dom: DOM, tag?: Tag): Promise<import("../Tag/List").TagList>;
|
|
11
|
+
prepare(scope: Scope, dom: DOM, tag?: Tag): Promise<void>;
|
|
12
|
+
}
|