vsn 0.1.42 → 0.1.45
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/demo.html +6 -2
- package/demo/markup.html +2 -0
- package/demo/vsn.js +1 -1
- package/demo/xhr.vsn +4 -0
- package/dist/AST/ArithmeticAssignmentNode.js +8 -1
- package/dist/AST/ArithmeticAssignmentNode.js.map +1 -1
- package/dist/AST/FunctionNode.d.ts +0 -0
- package/dist/AST/FunctionNode.js +1 -0
- package/dist/AST/FunctionNode.js.map +1 -0
- package/dist/AST/StringFormatNode.d.ts +18 -0
- package/dist/{attributes/ClickToggleClass.js → AST/StringFormatNode.js} +49 -49
- package/dist/AST/StringFormatNode.js.map +1 -0
- package/dist/AST/WASM/Context.d.ts +4 -0
- package/dist/AST/WASM/Context.js +18 -0
- package/dist/AST/WASM/Context.js.map +1 -0
- package/dist/AST/WASM/Function.d.ts +22 -0
- package/dist/AST/WASM/Function.js +110 -0
- package/dist/AST/WASM/Function.js.map +1 -0
- package/dist/AST/WASM/Memory.d.ts +12 -0
- package/dist/AST/WASM/Memory.js +22 -0
- package/dist/AST/WASM/Memory.js.map +1 -0
- package/dist/AST/WASM/Section.d.ts +5 -0
- package/dist/AST/WASM/Section.js +11 -0
- package/dist/AST/WASM/Section.js.map +1 -0
- package/dist/AST/WASM.d.ts +58 -0
- package/dist/AST/WASM.js +277 -0
- package/dist/AST/WASM.js.map +1 -0
- package/dist/AST/XHRNode.d.ts +15 -0
- package/dist/AST/XHRNode.js +146 -0
- package/dist/AST/XHRNode.js.map +1 -0
- package/dist/AST.d.ts +62 -55
- package/dist/AST.js +123 -83
- package/dist/AST.js.map +1 -1
- package/dist/DOM.js +39 -82
- package/dist/DOM.js.map +1 -1
- package/dist/Registry.d.ts +2 -0
- package/dist/Registry.js +13 -9
- package/dist/Registry.js.map +1 -1
- package/dist/Scope/ScopeDataAbstract.js +2 -2
- package/dist/Scope/ScopeDataAbstract.js.map +1 -1
- package/dist/Scope/properties/Property.d.ts +6 -6
- package/dist/Scope/properties/Property.js +26 -30
- package/dist/Scope/properties/Property.js.map +1 -1
- package/dist/Scope/properties/_imports.d.ts +1 -1
- package/dist/Scope/properties/_imports.js.map +1 -1
- package/dist/Tag.js +2 -11
- package/dist/Tag.js.map +1 -1
- package/dist/attributes/_imports.d.ts +0 -2
- package/dist/attributes/_imports.js +1 -5
- package/dist/attributes/_imports.js.map +1 -1
- package/dist/helpers/VisionHelper.d.ts +1 -0
- package/dist/helpers/VisionHelper.js +17 -0
- package/dist/helpers/VisionHelper.js.map +1 -1
- package/dist/vsn.d.ts +3 -2
- package/dist/vsn.js +7 -3
- package/dist/vsn.js.map +1 -1
- package/package.json +1 -1
- package/src/AST/ArithmeticAssignmentNode.ts +9 -2
- package/src/AST/FunctionNode.ts +0 -0
- package/src/AST/StringFormatNode.ts +43 -0
- package/src/AST/WASM/Context.ts +12 -0
- package/src/AST/WASM/Function.ts +67 -0
- package/src/AST/WASM/Memory.ts +21 -0
- package/src/AST/WASM/Section.ts +6 -0
- package/src/AST/WASM.ts +244 -0
- package/src/AST/XHRNode.ts +81 -0
- package/src/AST.ts +66 -31
- package/src/DOM.ts +4 -25
- package/src/Registry.ts +12 -9
- package/src/Scope/ScopeDataAbstract.ts +2 -2
- package/src/Scope/properties/Property.ts +27 -34
- package/src/Scope/properties/_imports.ts +1 -1
- package/src/Tag.ts +2 -9
- package/src/attributes/AddClassIf.ts +1 -1
- package/src/attributes/_imports.ts +0 -2
- package/src/helpers/VisionHelper.ts +13 -0
- package/src/vsn.ts +3 -2
- package/test/AST/ArithmeticAssignmentNode.spec.ts +0 -2
- package/test/AST/StringFormatNode.spec.ts +12 -0
- package/test/AST/WASM.spec.ts +63 -0
- package/test/AST/XHRNode.spec.ts +10 -0
- package/test/Scope/ScopeData.spec.ts +5 -5
- package/dist/attributes/ClickRemoveClass.d.ts +0 -8
- package/dist/attributes/ClickRemoveClass.js +0 -114
- package/dist/attributes/ClickRemoveClass.js.map +0 -1
- package/dist/attributes/ClickToggleClass.d.ts +0 -8
- package/dist/attributes/ClickToggleClass.js.map +0 -1
- package/src/attributes/ClickRemoveClass.ts +0 -30
- package/src/attributes/ClickToggleClass.ts +0 -30
package/src/vsn.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import {DOM} from "./DOM";
|
|
2
2
|
import {WrappedArray} from "./Scope/WrappedArray";
|
|
3
3
|
import {Registry} from "./Registry";
|
|
4
|
-
import "./Types";
|
|
5
|
-
import "./Formats";
|
|
6
4
|
import {Configuration} from "./Configuration";
|
|
7
5
|
import {VisionHelper} from "./helpers/VisionHelper";
|
|
8
6
|
import {Tree} from "./AST";
|
|
@@ -83,4 +81,7 @@ export {EventDispatcher} from './EventDispatcher';
|
|
|
83
81
|
export {MessageList} from './MessageList';
|
|
84
82
|
export {SimplePromise} from './SimplePromise';
|
|
85
83
|
export {Tag} from './Tag';
|
|
84
|
+
export {Formats} from './Formats';
|
|
85
|
+
export {Types} from './Types';
|
|
86
|
+
export {Validators} from './Validators';
|
|
86
87
|
export const vision: Vision = Vision.instance;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {Tree} from "../../src/AST";
|
|
2
|
+
import {Scope} from "../../src/Scope";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
describe('StringFormatNode', () => {
|
|
6
|
+
it("should format simple format strings", async () => {
|
|
7
|
+
const tree = new Tree("`Hello ${name}`");
|
|
8
|
+
const scope = new Scope();
|
|
9
|
+
scope.set("name", "World");
|
|
10
|
+
expect(await tree.evaluate(scope, null, null)).toBe("Hello World");
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {compile, EOpCode, EValueType, run} from "../../src/AST/WASM";
|
|
2
|
+
import {VisionHelper} from "../../src/helpers/VisionHelper";
|
|
3
|
+
import {FunctionSection} from "../../src/AST/WASM/Function";
|
|
4
|
+
|
|
5
|
+
describe('WASM', () => {
|
|
6
|
+
it("should support wasm", async () => {
|
|
7
|
+
expect(VisionHelper.wasmSupport).toBe(true);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("should allow a simple addition function to be made", async () => {
|
|
11
|
+
const main = new FunctionSection("main");
|
|
12
|
+
main.addParam(EValueType.i32);
|
|
13
|
+
main.addParam(EValueType.i32);
|
|
14
|
+
main.addResult(EValueType.i32);
|
|
15
|
+
main.addCode([
|
|
16
|
+
0x00, // local declare count
|
|
17
|
+
EOpCode.get_local,
|
|
18
|
+
0x00, // local var 0
|
|
19
|
+
EOpCode.get_local,
|
|
20
|
+
0x01, // local var 1
|
|
21
|
+
EOpCode.i32_add,
|
|
22
|
+
EOpCode.end
|
|
23
|
+
]);
|
|
24
|
+
expect(await run(main, 10, 15)).toBe(25);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("should allow a simple subtraction function to be made", async () => {
|
|
28
|
+
const main = new FunctionSection("main");
|
|
29
|
+
main.addParam(EValueType.i32);
|
|
30
|
+
main.addParam(EValueType.i32);
|
|
31
|
+
main.addResult(EValueType.i32);
|
|
32
|
+
main.addCode([
|
|
33
|
+
0x00, // local declare count
|
|
34
|
+
EOpCode.get_local,
|
|
35
|
+
0x00, // local var 0
|
|
36
|
+
EOpCode.get_local,
|
|
37
|
+
0x01, // local var 1
|
|
38
|
+
EOpCode.i32_sub,
|
|
39
|
+
EOpCode.end
|
|
40
|
+
]);
|
|
41
|
+
expect(await run(main, 10, 15)).toBe(-5);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("should allow a simple function to be made", async () => {
|
|
45
|
+
const main = new FunctionSection("main");
|
|
46
|
+
main.addParam(EValueType.i32);
|
|
47
|
+
main.addParam(EValueType.i32);
|
|
48
|
+
main.addResult(EValueType.i32);
|
|
49
|
+
main.addCode([
|
|
50
|
+
0x00, // local declare count
|
|
51
|
+
EOpCode.get_local,
|
|
52
|
+
0x00, // local var 0
|
|
53
|
+
EOpCode.get_local,
|
|
54
|
+
0x01, // local var 1
|
|
55
|
+
EOpCode.i32_sub,
|
|
56
|
+
EOpCode.get_local,
|
|
57
|
+
0x00, // local var 0
|
|
58
|
+
EOpCode.i32_mul,
|
|
59
|
+
EOpCode.end
|
|
60
|
+
]);
|
|
61
|
+
expect(await run(main, 100, 15)).toBe(8500);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -6,15 +6,15 @@ describe('ScopeData', () => {
|
|
|
6
6
|
it("should set tags correctly", async () => {
|
|
7
7
|
const data = new ScopeData();
|
|
8
8
|
data.createProperty('test', Property, {
|
|
9
|
-
|
|
9
|
+
labels: ['test']
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
data.createProperty('test_int', Property, {
|
|
13
|
-
|
|
13
|
+
labels: ['test']
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
data.createProperty('not_test', Property, {
|
|
17
|
-
|
|
17
|
+
labels: ['not_test']
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
data['test'] = 'test';
|
|
@@ -40,7 +40,7 @@ describe('ScopeData', () => {
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
const notTestProp = data.getProperty('not_test');
|
|
43
|
-
notTestProp.
|
|
43
|
+
notTestProp.addLabel('test');
|
|
44
44
|
const taggedNotTestData2 = data.getData('test');
|
|
45
45
|
expect(taggedNotTestData2).toEqual({
|
|
46
46
|
test: 'test',
|
|
@@ -48,7 +48,7 @@ describe('ScopeData', () => {
|
|
|
48
48
|
not_test: 'not_test'
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
notTestProp.
|
|
51
|
+
notTestProp.removeLabel('test');
|
|
52
52
|
const taggedNotTestData3 = data.getData('test');
|
|
53
53
|
expect(taggedNotTestData3).toEqual({
|
|
54
54
|
test: 'test',
|
|
@@ -1,114 +0,0 @@
|
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
24
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
26
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
27
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
28
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
29
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
33
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
34
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
35
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
36
|
-
function step(op) {
|
|
37
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
38
|
-
while (_) try {
|
|
39
|
-
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;
|
|
40
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
41
|
-
switch (op[0]) {
|
|
42
|
-
case 0: case 1: t = op; break;
|
|
43
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
44
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
45
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
46
|
-
default:
|
|
47
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
48
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
49
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
50
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
51
|
-
if (t[2]) _.ops.pop();
|
|
52
|
-
_.trys.pop(); continue;
|
|
53
|
-
}
|
|
54
|
-
op = body.call(thisArg, _);
|
|
55
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
56
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
-
exports.ClickRemoveClass = void 0;
|
|
61
|
-
var Attribute_1 = require("../Attribute");
|
|
62
|
-
var Registry_1 = require("../Registry");
|
|
63
|
-
var ClickRemoveClass = /** @class */ (function (_super) {
|
|
64
|
-
__extends(ClickRemoveClass, _super);
|
|
65
|
-
function ClickRemoveClass() {
|
|
66
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
67
|
-
_this.cssClass = '';
|
|
68
|
-
_this.target = null;
|
|
69
|
-
return _this;
|
|
70
|
-
}
|
|
71
|
-
ClickRemoveClass.prototype.setup = function () {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
-
return __generator(this, function (_a) {
|
|
74
|
-
switch (_a.label) {
|
|
75
|
-
case 0:
|
|
76
|
-
this.cssClass = this.getAttributeBinding('active');
|
|
77
|
-
this.target = this.getAttributeValue();
|
|
78
|
-
return [4 /*yield*/, _super.prototype.setup.call(this)];
|
|
79
|
-
case 1:
|
|
80
|
-
_a.sent();
|
|
81
|
-
return [2 /*return*/];
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
ClickRemoveClass.prototype.connect = function () {
|
|
87
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
-
return __generator(this, function (_a) {
|
|
89
|
-
switch (_a.label) {
|
|
90
|
-
case 0:
|
|
91
|
-
this.tag.addEventHandler('click', this.getAttributeModifiers(), this.onClick.bind(this));
|
|
92
|
-
return [4 /*yield*/, _super.prototype.connect.call(this)];
|
|
93
|
-
case 1:
|
|
94
|
-
_a.sent();
|
|
95
|
-
return [2 /*return*/];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
ClickRemoveClass.prototype.onClick = function (e) {
|
|
101
|
-
var element = this.tag.element;
|
|
102
|
-
if (!!this.target) {
|
|
103
|
-
element = document.getElementById(this.target);
|
|
104
|
-
}
|
|
105
|
-
if (element)
|
|
106
|
-
element.classList.remove(this.cssClass);
|
|
107
|
-
};
|
|
108
|
-
ClickRemoveClass = __decorate([
|
|
109
|
-
Registry_1.Registry.attribute('vsn-click-remove-class')
|
|
110
|
-
], ClickRemoveClass);
|
|
111
|
-
return ClickRemoveClass;
|
|
112
|
-
}(Attribute_1.Attribute));
|
|
113
|
-
exports.ClickRemoveClass = ClickRemoveClass;
|
|
114
|
-
//# sourceMappingURL=ClickRemoveClass.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClickRemoveClass.js","sourceRoot":"","sources":["../../src/attributes/ClickRemoveClass.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAuC;AACvC,wCAAqC;AAGrC;IAAsC,oCAAS;IAA/C;QAAA,qEAyBC;QAxBa,cAAQ,GAAW,EAAE,CAAC;QACtB,YAAM,GAAW,IAAI,CAAC;;IAuBpC,CAAC;IArBgB,gCAAK,GAAlB;;;;;wBACI,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;wBACnD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;wBACvC,qBAAM,iBAAM,KAAK,WAAE,EAAA;;wBAAnB,SAAmB,CAAC;;;;;KACvB;IAEY,kCAAO,GAApB;;;;;wBACI,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;wBACzF,qBAAM,iBAAM,OAAO,WAAE,EAAA;;wBAArB,SAAqB,CAAC;;;;;KACzB;IAED,kCAAO,GAAP,UAAQ,CAAC;QACL,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;QAE/B,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE;YACf,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAClD;QAED,IAAI,OAAO;YACP,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IAxBQ,gBAAgB;QAD5B,mBAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC;OAChC,gBAAgB,CAyB5B;IAAD,uBAAC;CAAA,AAzBD,CAAsC,qBAAS,GAyB9C;AAzBY,4CAAgB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClickToggleClass.js","sourceRoot":"","sources":["../../src/attributes/ClickToggleClass.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAuC;AACvC,wCAAqC;AAGrC;IAAsC,oCAAS;IAA/C;QAAA,qEAyBC;QAxBa,cAAQ,GAAW,EAAE,CAAC;QACtB,YAAM,GAAW,IAAI,CAAC;;IAuBpC,CAAC;IArBgB,gCAAK,GAAlB;;;;;wBACI,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAE,QAAQ,CAAC,CAAC;wBACpD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;wBACvC,qBAAM,iBAAM,KAAK,WAAE,EAAA;;wBAAnB,SAAmB,CAAC;;;;;KACvB;IAEY,kCAAO,GAApB;;;;;wBACI,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;wBACzF,qBAAM,iBAAM,OAAO,WAAE,EAAA;;wBAArB,SAAqB,CAAC;;;;;KACzB;IAED,kCAAO,GAAP,UAAQ,CAAC;QACL,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE;YAEf,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAClD;QAED,IAAI,OAAO;YACP,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IAxBQ,gBAAgB;QAD5B,mBAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC;OAChC,gBAAgB,CAyB5B;IAAD,uBAAC;CAAA,AAzBD,CAAsC,qBAAS,GAyB9C;AAzBY,4CAAgB"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {Attribute} from "../Attribute";
|
|
2
|
-
import {Registry} from "../Registry";
|
|
3
|
-
|
|
4
|
-
@Registry.attribute('vsn-click-remove-class')
|
|
5
|
-
export class ClickRemoveClass extends Attribute {
|
|
6
|
-
protected cssClass: string = '';
|
|
7
|
-
protected target: string = null;
|
|
8
|
-
|
|
9
|
-
public async setup() {
|
|
10
|
-
this.cssClass = this.getAttributeBinding('active');
|
|
11
|
-
this.target = this.getAttributeValue();
|
|
12
|
-
await super.setup();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public async connect() {
|
|
16
|
-
this.tag.addEventHandler('click', this.getAttributeModifiers(), this.onClick.bind(this));
|
|
17
|
-
await super.connect();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
onClick(e) {
|
|
21
|
-
let element = this.tag.element;
|
|
22
|
-
|
|
23
|
-
if (!!this.target) {
|
|
24
|
-
element = document.getElementById(this.target);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (element)
|
|
28
|
-
element.classList.remove(this.cssClass);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {Attribute} from "../Attribute";
|
|
2
|
-
import {Registry} from "../Registry";
|
|
3
|
-
|
|
4
|
-
@Registry.attribute('vsn-click-toggle-class')
|
|
5
|
-
export class ClickToggleClass extends Attribute {
|
|
6
|
-
protected cssClass: string = '';
|
|
7
|
-
protected target: string = null;
|
|
8
|
-
|
|
9
|
-
public async setup() {
|
|
10
|
-
this.cssClass = this.getAttributeBinding( 'active');
|
|
11
|
-
this.target = this.getAttributeValue();
|
|
12
|
-
await super.setup();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public async connect() {
|
|
16
|
-
this.tag.addEventHandler('click', this.getAttributeModifiers(), this.onClick.bind(this));
|
|
17
|
-
await super.connect();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
onClick(e) {
|
|
21
|
-
let element = this.tag.element;
|
|
22
|
-
if (!!this.target) {
|
|
23
|
-
|
|
24
|
-
element = document.getElementById(this.target);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (element)
|
|
28
|
-
element.classList.toggle(this.cssClass);
|
|
29
|
-
}
|
|
30
|
-
}
|