vsn 0.1.105 → 0.1.108

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.
@@ -0,0 +1,13 @@
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 AsNode extends Node implements TreeNode {
7
+ readonly context: Node;
8
+ readonly name: string;
9
+ constructor(context: Node, name: string);
10
+ protected _getChildNodes(): Node[];
11
+ evaluate(scope: Scope, dom: DOM, tag?: Tag): Promise<any>;
12
+ static parse(lastNode: any, token: any, tokens: Token[]): AsNode;
13
+ }
@@ -0,0 +1,92 @@
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.AsNode = void 0;
55
+ var Node_1 = require("./Node");
56
+ var AsNode = /** @class */ (function (_super) {
57
+ __extends(AsNode, _super);
58
+ function AsNode(context, name) {
59
+ var _this = _super.call(this) || this;
60
+ _this.context = context;
61
+ _this.name = name;
62
+ return _this;
63
+ }
64
+ AsNode.prototype._getChildNodes = function () {
65
+ return [
66
+ this.context
67
+ ];
68
+ };
69
+ AsNode.prototype.evaluate = function (scope, dom, tag) {
70
+ if (tag === void 0) { tag = null; }
71
+ return __awaiter(this, void 0, void 0, function () {
72
+ var context;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0: return [4 /*yield*/, this.context.evaluate(scope, dom, tag)];
76
+ case 1:
77
+ context = _a.sent();
78
+ scope.set(this.name, context);
79
+ return [2 /*return*/, context];
80
+ }
81
+ });
82
+ });
83
+ };
84
+ AsNode.parse = function (lastNode, token, tokens) {
85
+ tokens.shift(); // Consume as
86
+ var name = tokens.shift();
87
+ return new AsNode(lastNode, name.value);
88
+ };
89
+ return AsNode;
90
+ }(Node_1.Node));
91
+ exports.AsNode = AsNode;
92
+ //# sourceMappingURL=AsNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsNode.js","sourceRoot":"","sources":["../../src/AST/AsNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,+BAA4B;AAE5B;IAA4B,0BAAI;IAC5B,gBACoB,OAAa,EACb,IAAY;QAFhC,YAII,iBAAO,SACV;QAJmB,aAAO,GAAP,OAAO,CAAM;QACb,UAAI,GAAJ,IAAI,CAAQ;;IAGhC,CAAC;IAES,+BAAc,GAAxB;QACI,OAAO;YACH,IAAI,CAAC,OAAO;SACf,CAAA;IACL,CAAC;IAEY,yBAAQ,GAArB,UAAsB,KAAY,EAAE,GAAQ,EAAE,GAAe;QAAf,oBAAA,EAAA,UAAe;;;;;4BACzC,qBAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAAtD,OAAO,GAAG,SAA4C;wBAC5D,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;wBAC9B,sBAAO,OAAO,EAAC;;;;KAClB;IAEa,YAAK,GAAnB,UAAoB,QAAQ,EAAE,KAAK,EAAE,MAAe;QAChD,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,aAAa;QAC7B,IAAM,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAC5B,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IACL,aAAC;AAAD,CAAC,AAzBD,CAA4B,WAAI,GAyB/B;AAzBY,wBAAM"}
@@ -0,0 +1,15 @@
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
+ import { ObjectNode } from "./ObjectNode";
7
+ export declare class DispatchEventNode extends Node implements TreeNode {
8
+ readonly name: string;
9
+ readonly data: ObjectNode | null;
10
+ readonly bubbles: boolean;
11
+ constructor(name: string, data: ObjectNode | null, bubbles?: boolean);
12
+ protected _getChildNodes(): Node[];
13
+ evaluate(scope: Scope, dom: DOM, tag?: Tag): Promise<void>;
14
+ static parse(lastNode: any, token: any, tokens: Token[]): DispatchEventNode;
15
+ }
@@ -0,0 +1,118 @@
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.DispatchEventNode = void 0;
55
+ var Scope_1 = require("../Scope");
56
+ var AST_1 = require("../AST");
57
+ var Node_1 = require("./Node");
58
+ var ScopeData_1 = require("../Scope/ScopeData");
59
+ var DispatchEventNode = /** @class */ (function (_super) {
60
+ __extends(DispatchEventNode, _super);
61
+ function DispatchEventNode(name, data, bubbles) {
62
+ if (bubbles === void 0) { bubbles = false; }
63
+ var _this = _super.call(this) || this;
64
+ _this.name = name;
65
+ _this.data = data;
66
+ _this.bubbles = bubbles;
67
+ return _this;
68
+ }
69
+ DispatchEventNode.prototype._getChildNodes = function () {
70
+ var nodes = [];
71
+ if (this.data)
72
+ nodes.push(this.data);
73
+ return nodes;
74
+ };
75
+ DispatchEventNode.prototype.evaluate = function (scope, dom, tag) {
76
+ if (tag === void 0) { tag = null; }
77
+ return __awaiter(this, void 0, void 0, function () {
78
+ var detail, _a;
79
+ return __generator(this, function (_b) {
80
+ switch (_b.label) {
81
+ case 0:
82
+ if (!this.data) return [3 /*break*/, 2];
83
+ return [4 /*yield*/, this.data.evaluate(scope, dom, tag)];
84
+ case 1:
85
+ _a = _b.sent();
86
+ return [3 /*break*/, 3];
87
+ case 2:
88
+ _a = {};
89
+ _b.label = 3;
90
+ case 3:
91
+ detail = _a;
92
+ if (detail instanceof Scope_1.Scope)
93
+ detail = detail.data.getData();
94
+ else if (detail instanceof ScopeData_1.ScopeData)
95
+ detail = detail.getData();
96
+ detail['source'] = tag.element;
97
+ tag.element.dispatchEvent(new CustomEvent(this.name, {
98
+ bubbles: this.bubbles,
99
+ detail: detail
100
+ }));
101
+ return [2 /*return*/];
102
+ }
103
+ });
104
+ });
105
+ };
106
+ DispatchEventNode.parse = function (lastNode, token, tokens) {
107
+ var name = tokens.shift();
108
+ var data = null;
109
+ if (tokens.length && tokens[0].type === AST_1.TokenType.L_PAREN) {
110
+ var containedTokens = AST_1.Tree.getNextStatementTokens(tokens, true, true, false);
111
+ data = AST_1.Tree.processTokens(containedTokens).statements[0];
112
+ }
113
+ return new DispatchEventNode(name.value, data, name.full.startsWith('!!!'));
114
+ };
115
+ return DispatchEventNode;
116
+ }(Node_1.Node));
117
+ exports.DispatchEventNode = DispatchEventNode;
118
+ //# sourceMappingURL=DispatchEventNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DispatchEventNode.js","sourceRoot":"","sources":["../../src/AST/DispatchEventNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAA+B;AAG/B,8BAAwD;AACxD,+BAA4B;AAE5B,gDAA6C;AAE7C;IAAuC,qCAAI;IACvC,2BACoB,IAAY,EACZ,IAAuB,EACvB,OAAwB;QAAxB,wBAAA,EAAA,eAAwB;QAH5C,YAKI,iBAAO,SACV;QALmB,UAAI,GAAJ,IAAI,CAAQ;QACZ,UAAI,GAAJ,IAAI,CAAmB;QACvB,aAAO,GAAP,OAAO,CAAiB;;IAG5C,CAAC;IAES,0CAAc,GAAxB;QACI,IAAM,KAAK,GAAW,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI;YACT,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;IACjB,CAAC;IAEY,oCAAQ,GAArB,UAAsB,KAAY,EAAE,GAAQ,EAAE,GAAe;QAAf,oBAAA,EAAA,UAAe;;;;;;6BAC5C,IAAI,CAAC,IAAI,EAAT,wBAAS;wBAAG,qBAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAAzC,KAAA,SAAyC,CAAA;;;wBAAG,KAAA,EAAE,CAAA;;;wBAAnE,MAAM,KAA6D;wBACvE,IAAI,MAAM,YAAY,aAAK;4BACvB,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;6BAC9B,IAAI,MAAM,YAAY,qBAAS;4BAChC,MAAM,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;wBAE9B,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;wBAE/B,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE;4BACjD,OAAO,EAAE,IAAI,CAAC,OAAO;4BACrB,MAAM,EAAE,MAAM;yBACjB,CAAC,CAAC,CAAC;;;;;KACP;IAEa,uBAAK,GAAnB,UAAoB,QAAQ,EAAE,KAAK,EAAE,MAAe;QAChD,IAAM,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAC5B,IAAI,IAAI,GAAe,IAAI,CAAC;QAC5B,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,eAAS,CAAC,OAAO,EAAE;YACvD,IAAM,eAAe,GAAG,UAAI,CAAC,sBAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC/E,IAAI,GAAG,UAAI,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,UAAU,CAAC,CAAC,CAAe,CAAC;SAC1E;QAED,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAChF,CAAC;IACL,wBAAC;AAAD,CAAC,AAzCD,CAAuC,WAAI,GAyC1C;AAzCY,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
+ import { BlockNode } from "./BlockNode";
7
+ export declare class WithNode extends Node implements TreeNode {
8
+ readonly context: Node;
9
+ readonly statements: BlockNode;
10
+ constructor(context: Node, statements: BlockNode);
11
+ protected _getChildNodes(): Node[];
12
+ evaluate(scope: Scope, dom: DOM, tag?: Tag): Promise<any>;
13
+ static parse(lastNode: any, token: any, tokens: Token[]): WithNode;
14
+ }
@@ -0,0 +1,116 @@
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.WithNode = void 0;
55
+ var Tag_1 = require("../Tag");
56
+ var AST_1 = require("../AST");
57
+ var Node_1 = require("./Node");
58
+ var TagList_1 = require("../Tag/TagList");
59
+ var WithNode = /** @class */ (function (_super) {
60
+ __extends(WithNode, _super);
61
+ function WithNode(context, statements) {
62
+ var _this = _super.call(this) || this;
63
+ _this.context = context;
64
+ _this.statements = statements;
65
+ return _this;
66
+ }
67
+ WithNode.prototype._getChildNodes = function () {
68
+ return [
69
+ this.context,
70
+ this.statements
71
+ ];
72
+ };
73
+ WithNode.prototype.evaluate = function (scope, dom, tag) {
74
+ if (tag === void 0) { tag = null; }
75
+ return __awaiter(this, void 0, void 0, function () {
76
+ var context, tags, ret, _i, tags_1, _tag, _a, _b;
77
+ return __generator(this, function (_c) {
78
+ switch (_c.label) {
79
+ case 0: return [4 /*yield*/, this.context.evaluate(scope, dom, tag)];
80
+ case 1:
81
+ context = _c.sent();
82
+ if (context instanceof TagList_1.TagList) {
83
+ tags = context;
84
+ }
85
+ else if (context instanceof Tag_1.Tag) {
86
+ tags = [context];
87
+ }
88
+ ret = [];
89
+ _i = 0, tags_1 = tags;
90
+ _c.label = 2;
91
+ case 2:
92
+ if (!(_i < tags_1.length)) return [3 /*break*/, 5];
93
+ _tag = tags_1[_i];
94
+ _b = (_a = ret).push;
95
+ return [4 /*yield*/, this.statements.evaluate(_tag.scope, dom, _tag)];
96
+ case 3:
97
+ _b.apply(_a, [_c.sent()]);
98
+ _c.label = 4;
99
+ case 4:
100
+ _i++;
101
+ return [3 /*break*/, 2];
102
+ case 5: return [2 /*return*/, ret.length === 1 ? ret[0] : ret];
103
+ }
104
+ });
105
+ });
106
+ };
107
+ WithNode.parse = function (lastNode, token, tokens) {
108
+ tokens.shift(); // Consume with
109
+ var contextTokens = AST_1.Tree.getTokensUntil(tokens, AST_1.TokenType.L_BRACE, false, false, true);
110
+ var statementTokens = AST_1.Tree.getNextStatementTokens(tokens);
111
+ return new WithNode(AST_1.Tree.processTokens(contextTokens), AST_1.Tree.processTokens(statementTokens));
112
+ };
113
+ return WithNode;
114
+ }(Node_1.Node));
115
+ exports.WithNode = WithNode;
116
+ //# sourceMappingURL=WithNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithNode.js","sourceRoot":"","sources":["../../src/AST/WithNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,8BAA2B;AAC3B,8BAAmE;AACnE,+BAA4B;AAE5B,0CAAuC;AAEvC;IAA8B,4BAAI;IAC9B,kBACoB,OAAa,EACb,UAAqB;QAFzC,YAII,iBAAO,SACV;QAJmB,aAAO,GAAP,OAAO,CAAM;QACb,gBAAU,GAAV,UAAU,CAAW;;IAGzC,CAAC;IAES,iCAAc,GAAxB;QACI,OAAO;YACH,IAAI,CAAC,OAAO;YACZ,IAAI,CAAC,UAAU;SAClB,CAAA;IACL,CAAC;IAEY,2BAAQ,GAArB,UAAsB,KAAY,EAAE,GAAQ,EAAE,GAAe;QAAf,oBAAA,EAAA,UAAe;;;;;4BACzC,qBAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAA;;wBAAtD,OAAO,GAAG,SAA4C;wBAE5D,IAAI,OAAO,YAAY,iBAAO,EAAE;4BAC5B,IAAI,GAAG,OAAO,CAAC;yBAClB;6BAAM,IAAI,OAAO,YAAY,SAAG,EAAE;4BAC/B,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;yBACpB;wBACG,GAAG,GAAG,EAAE,CAAC;8BACU,EAAJ,aAAI;;;6BAAJ,CAAA,kBAAI,CAAA;wBAAZ,IAAI;wBACX,KAAA,CAAA,KAAA,GAAG,CAAA,CAAC,IAAI,CAAA;wBAAC,qBAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,EAAA;;wBAA9D,cAAS,SAAqD,EAAC,CAAA;;;wBADhD,IAAI,CAAA;;4BAGvB,sBAAO,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAC;;;;KAC1C;IAEa,cAAK,GAAnB,UAAoB,QAAQ,EAAE,KAAK,EAAE,MAAe;QAChD,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,eAAe;QAC/B,IAAM,aAAa,GAAG,UAAI,CAAC,cAAc,CAAC,MAAM,EAAE,eAAS,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACzF,IAAM,eAAe,GAAG,UAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAC5D,OAAO,IAAI,QAAQ,CAAC,UAAI,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,UAAI,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC;IAChG,CAAC;IACL,eAAC;AAAD,CAAC,AApCD,CAA8B,WAAI,GAoCjC;AApCY,4BAAQ"}
package/dist/AST.d.ts CHANGED
@@ -28,61 +28,64 @@ export declare enum TokenType {
28
28
  RETURN = 6,
29
29
  NOT = 7,
30
30
  OF = 8,
31
- IN = 9,
32
- FOR = 10,
33
- IF = 11,
34
- ELSE_IF = 12,
35
- ELSE = 13,
36
- FUNC = 14,
37
- ON = 15,
38
- CLASS = 16,
39
- NAME = 17,
40
- L_BRACE = 18,
41
- R_BRACE = 19,
42
- L_BRACKET = 20,
43
- R_BRACKET = 21,
44
- L_PAREN = 22,
45
- R_PAREN = 23,
46
- TILDE = 24,
47
- PERIOD = 25,
48
- COMMA = 26,
49
- COLON = 27,
50
- SEMICOLON = 28,
51
- STRING_FORMAT = 29,
52
- STRING_LITERAL = 30,
53
- NUMBER_LITERAL = 31,
54
- BOOLEAN_LITERAL = 32,
55
- NULL_LITERAL = 33,
56
- STRICT_EQUALS = 34,
57
- STRICT_NOT_EQUALS = 35,
58
- EQUALS = 36,
59
- NOT_EQUALS = 37,
60
- GREATER_THAN_EQUAL = 38,
61
- LESS_THAN_EQUAL = 39,
62
- GREATER_THAN = 40,
63
- LESS_THAN = 41,
64
- ASSIGN = 42,
65
- AND = 43,
66
- OR = 44,
67
- ADD = 45,
68
- SUBTRACT = 46,
69
- MULTIPLY = 47,
70
- DIVIDE = 48,
71
- ADD_ASSIGN = 49,
72
- SUBTRACT_ASSIGN = 50,
73
- MULTIPLY_ASSIGN = 51,
74
- DIVIDE_ASSIGN = 52,
75
- EXCLAMATION_POINT = 53,
76
- ELEMENT_REFERENCE = 54,
77
- ELEMENT_ATTRIBUTE = 55,
78
- ELEMENT_STYLE = 56,
79
- ELEMENT_QUERY = 57,
80
- UNIT = 58,
81
- XHR_GET = 59,
82
- XHR_POST = 60,
83
- XHR_PUT = 61,
84
- XHR_DELETE = 62,
85
- MODIFIER = 63
31
+ AS = 9,
32
+ IN = 10,
33
+ WITH = 11,
34
+ FOR = 12,
35
+ IF = 13,
36
+ ELSE_IF = 14,
37
+ ELSE = 15,
38
+ FUNC = 16,
39
+ ON = 17,
40
+ CLASS = 18,
41
+ NAME = 19,
42
+ L_BRACE = 20,
43
+ R_BRACE = 21,
44
+ L_BRACKET = 22,
45
+ R_BRACKET = 23,
46
+ L_PAREN = 24,
47
+ R_PAREN = 25,
48
+ TILDE = 26,
49
+ PERIOD = 27,
50
+ COMMA = 28,
51
+ COLON = 29,
52
+ SEMICOLON = 30,
53
+ STRING_FORMAT = 31,
54
+ STRING_LITERAL = 32,
55
+ NUMBER_LITERAL = 33,
56
+ BOOLEAN_LITERAL = 34,
57
+ NULL_LITERAL = 35,
58
+ STRICT_EQUALS = 36,
59
+ STRICT_NOT_EQUALS = 37,
60
+ EQUALS = 38,
61
+ NOT_EQUALS = 39,
62
+ GREATER_THAN_EQUAL = 40,
63
+ LESS_THAN_EQUAL = 41,
64
+ GREATER_THAN = 42,
65
+ LESS_THAN = 43,
66
+ ASSIGN = 44,
67
+ AND = 45,
68
+ OR = 46,
69
+ ADD = 47,
70
+ SUBTRACT = 48,
71
+ MULTIPLY = 49,
72
+ DIVIDE = 50,
73
+ ADD_ASSIGN = 51,
74
+ SUBTRACT_ASSIGN = 52,
75
+ MULTIPLY_ASSIGN = 53,
76
+ DIVIDE_ASSIGN = 54,
77
+ EXCLAMATION_POINT = 55,
78
+ ELEMENT_REFERENCE = 56,
79
+ ELEMENT_ATTRIBUTE = 57,
80
+ ELEMENT_STYLE = 58,
81
+ ELEMENT_QUERY = 59,
82
+ UNIT = 60,
83
+ XHR_GET = 61,
84
+ XHR_POST = 62,
85
+ XHR_PUT = 63,
86
+ XHR_DELETE = 64,
87
+ MODIFIER = 65,
88
+ DISPATCH_EVENT = 66
86
89
  }
87
90
  export interface TreeNode<T = any> {
88
91
  evaluate(scope: Scope, dom: DOM, tag?: Tag): any;