vsn 0.1.74 → 0.1.77

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 (71) hide show
  1. package/demo/vsn.js +3 -2
  2. package/dist/AST/ClassNode.d.ts +2 -2
  3. package/dist/AST/ClassNode.js +23 -18
  4. package/dist/AST/ClassNode.js.map +1 -1
  5. package/dist/AST/FunctionCallNode.js +1 -0
  6. package/dist/AST/FunctionCallNode.js.map +1 -1
  7. package/dist/Attribute.d.ts +5 -2
  8. package/dist/Attribute.js +39 -8
  9. package/dist/Attribute.js.map +1 -1
  10. package/dist/Component.d.ts +4 -0
  11. package/dist/Component.js +43 -0
  12. package/dist/Component.js.map +1 -0
  13. package/dist/DOM/DOMObject.d.ts +3 -0
  14. package/dist/DOM/DOMObject.js +14 -0
  15. package/dist/DOM/DOMObject.js.map +1 -1
  16. package/dist/DOM.d.ts +2 -0
  17. package/dist/DOM.js +36 -28
  18. package/dist/DOM.js.map +1 -1
  19. package/dist/Registry.d.ts +4 -2
  20. package/dist/Registry.js +6 -0
  21. package/dist/Registry.js.map +1 -1
  22. package/dist/Tag.d.ts +4 -2
  23. package/dist/Tag.js +163 -99
  24. package/dist/Tag.js.map +1 -1
  25. package/dist/attributes/ComponentAttribute.d.ts +5 -0
  26. package/dist/attributes/ComponentAttribute.js +105 -0
  27. package/dist/attributes/ComponentAttribute.js.map +1 -0
  28. package/dist/attributes/ListItem.d.ts +0 -1
  29. package/dist/attributes/ListItem.js +0 -7
  30. package/dist/attributes/ListItem.js.map +1 -1
  31. package/dist/attributes/On.js +1 -0
  32. package/dist/attributes/On.js.map +1 -1
  33. package/dist/attributes/RootAttribute.js.map +1 -1
  34. package/dist/attributes/TemplateAttribute.d.ts +5 -0
  35. package/dist/attributes/TemplateAttribute.js +89 -0
  36. package/dist/attributes/TemplateAttribute.js.map +1 -0
  37. package/dist/attributes/_imports.d.ts +2 -1
  38. package/dist/attributes/_imports.js +5 -3
  39. package/dist/attributes/_imports.js.map +1 -1
  40. package/dist/custom-elements.d.ts +9 -0
  41. package/dist/custom-elements.js +44 -0
  42. package/dist/custom-elements.js.map +1 -0
  43. package/dist/version.d.ts +1 -1
  44. package/dist/version.js +1 -1
  45. package/dist/vsn.d.ts +2 -0
  46. package/dist/vsn.js +5 -0
  47. package/dist/vsn.js.map +1 -1
  48. package/package.json +1 -1
  49. package/src/AST/ClassNode.ts +12 -9
  50. package/src/AST/FunctionCallNode.ts +3 -2
  51. package/src/Attribute.ts +19 -8
  52. package/src/Component.ts +25 -0
  53. package/src/DOM/DOMObject.ts +11 -0
  54. package/src/DOM.ts +19 -11
  55. package/src/Registry.ts +9 -3
  56. package/src/Tag.ts +70 -50
  57. package/src/attributes/ComponentAttribute.ts +24 -0
  58. package/src/attributes/ListItem.ts +0 -4
  59. package/src/attributes/On.ts +1 -0
  60. package/src/attributes/RootAttribute.ts +0 -1
  61. package/src/attributes/TemplateAttribute.ts +12 -0
  62. package/src/attributes/_imports.ts +2 -1
  63. package/src/custom-elements.ts +46 -0
  64. package/src/version.ts +1 -1
  65. package/src/vsn.ts +6 -0
  66. package/test/AST/ClassNode.spec.ts +73 -2
  67. package/dist/attributes/Template.d.ts +0 -4
  68. package/dist/attributes/Template.js +0 -39
  69. package/dist/attributes/Template.js.map +0 -1
  70. package/dist/vsn.min.js +0 -2
  71. package/src/attributes/Template.ts +0 -7
@@ -0,0 +1,105 @@
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.ComponentAttribute = void 0;
61
+ var Registry_1 = require("../Registry");
62
+ var TemplateAttribute_1 = require("./TemplateAttribute");
63
+ var Component_1 = require("../Component");
64
+ var ComponentAttribute = /** @class */ (function (_super) {
65
+ __extends(ComponentAttribute, _super);
66
+ function ComponentAttribute() {
67
+ return _super !== null && _super.apply(this, arguments) || this;
68
+ }
69
+ ComponentAttribute.prototype.extract = function () {
70
+ return __awaiter(this, void 0, void 0, function () {
71
+ var name, clsName, cls;
72
+ return __generator(this, function (_a) {
73
+ switch (_a.label) {
74
+ case 0:
75
+ name = this.getAttributeBinding();
76
+ if (!!Registry_1.Registry.instance.components.has(name)) return [3 /*break*/, 4];
77
+ return [4 /*yield*/, _super.prototype.extract.call(this)];
78
+ case 1:
79
+ _a.sent();
80
+ clsName = this.getAttributeValue();
81
+ cls = Component_1.Component;
82
+ if (!clsName) return [3 /*break*/, 3];
83
+ return [4 /*yield*/, Registry_1.Registry.instance.components.get(clsName)];
84
+ case 2:
85
+ cls = _a.sent();
86
+ if (!cls) {
87
+ throw new Error("Component " + clsName + " not found");
88
+ }
89
+ _a.label = 3;
90
+ case 3:
91
+ Registry_1.Registry.instance.components.register(name, cls);
92
+ _a.label = 4;
93
+ case 4: return [2 /*return*/];
94
+ }
95
+ });
96
+ });
97
+ };
98
+ ComponentAttribute.scoped = true;
99
+ ComponentAttribute = __decorate([
100
+ Registry_1.Registry.attribute('vsn-component')
101
+ ], ComponentAttribute);
102
+ return ComponentAttribute;
103
+ }(TemplateAttribute_1.TemplateAttribute));
104
+ exports.ComponentAttribute = ComponentAttribute;
105
+ //# sourceMappingURL=ComponentAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentAttribute.js","sourceRoot":"","sources":["../../src/attributes/ComponentAttribute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAqC;AACrC,yDAAsD;AACtD,0CAAuC;AAGvC;IAAwC,sCAAiB;IAAzD;;IAkBA,CAAC;IAfgB,oCAAO,GAApB;;;;;;wBACU,IAAI,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;6BACpC,CAAC,mBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAvC,wBAAuC;wBACvC,qBAAM,iBAAM,OAAO,WAAE,EAAA;;wBAArB,SAAqB,CAAC;wBAChB,OAAO,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;wBACrC,GAAG,GAAG,qBAAS,CAAC;6BAChB,OAAO,EAAP,wBAAO;wBACD,qBAAM,mBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAA;;wBAArD,GAAG,GAAG,SAA+C,CAAC;wBACtD,IAAI,CAAC,GAAG,EAAE;4BACN,MAAM,IAAI,KAAK,CAAC,eAAa,OAAO,eAAY,CAAC,CAAC;yBACrD;;;wBAEL,mBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;;;;;;KAExD;IAhBsB,yBAAM,GAAY,IAAI,CAAC;IADrC,kBAAkB;QAD9B,mBAAQ,CAAC,SAAS,CAAC,eAAe,CAAC;OACvB,kBAAkB,CAkB9B;IAAD,yBAAC;CAAA,AAlBD,CAAwC,qCAAiB,GAkBxD;AAlBY,gDAAkB"}
@@ -10,6 +10,5 @@ export declare class ListItem extends Attribute {
10
10
  setup(): Promise<void>;
11
11
  get listItemName(): string;
12
12
  getList(): Promise<List>;
13
- protected configure(): Promise<void>;
14
13
  private instantiateModel;
15
14
  }
@@ -115,13 +115,6 @@ var ListItem = /** @class */ (function (_super) {
115
115
  });
116
116
  });
117
117
  };
118
- ListItem.prototype.configure = function () {
119
- return __awaiter(this, void 0, void 0, function () {
120
- return __generator(this, function (_a) {
121
- return [2 /*return*/];
122
- });
123
- });
124
- };
125
118
  ListItem.prototype.instantiateModel = function (model) {
126
119
  this.tag.wrap(model, false, true);
127
120
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.js","sourceRoot":"","sources":["../../src/attributes/ListItem.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAuC;AAGvC,wCAAqC;AAGrC;IAA8B,4BAAS;IAAvC;;IAqCA,CAAC;iBArCY,QAAQ;IAMjB,sBAAW,0BAAI;aAAf;YACI,OAAO,IAAI,CAAC,KAAK,CAAC;QACtB,CAAC;;;OAAA;IAEY,wBAAK,GAAlB;;;;;;wBACI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;wBAC1D,IAAI,CAAC,IAAI,CAAC,KAAK;4BACX,MAAM,KAAK,CAAC,UAAQ,CAAC,eAAe,CAAC,CAAC;wBAE1C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,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0BAA0B,CAAC;IAH3D,QAAQ;QADpB,mBAAQ,CAAC,SAAS,CAAC,eAAe,CAAC;OACvB,QAAQ,CAiCpB;IAAD,eAAC;CAAA,AAjCD,CAA8B,qBAAS,GAiCtC;AAjCY,4BAAQ"}
@@ -73,6 +73,7 @@ var On = /** @class */ (function (_super) {
73
73
  switch (_a.label) {
74
74
  case 0:
75
75
  code = this.getAttributeValue();
76
+ console.log("Compiling " + this.getAttributeBinding() + " with " + code);
76
77
  this.handler = new AST_1.Tree(code);
77
78
  return [4 /*yield*/, this.handler.prepare(this.tag.scope, this.tag.dom, this.tag)];
78
79
  case 1:
@@ -1 +1 @@
1
- {"version":3,"file":"On.js","sourceRoot":"","sources":["../../src/attributes/On.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAuC;AACvC,8BAA4B;AAC5B,wCAAqC;AAGrC;IAAiC,sBAAS;IAA1C;;IAgCA,CAAC;IAjBgB,oBAAO,GAApB;;;;;;wBACU,IAAI,GAAW,IAAI,CAAC,iBAAiB,EAAE,CAAC;wBAC9C,IAAI,CAAC,OAAO,GAAG,IAAI,UAAI,CAAC,IAAI,CAAC,CAAC;wBAC9B,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAA;;wBAAlE,SAAkE,CAAC;wBACnE,qBAAM,iBAAM,OAAO,WAAE,EAAA;;wBAArB,SAAqB,CAAC;;;;;KACzB;IAEK,wBAAW,GAAjB,UAAkB,CAAC;;;;;wBACf,IAAI,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,UAAU;4BAClD,CAAC,CAAC,cAAc,EAAE,CAAC;wBACvB,qBAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI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C,iCAAS;IAA5C;;IAkBA,CAAC;IAdgB,6BAAK,GAAlB;;;;;;wBACI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,2BAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;wBACvD,WAAkD,EAAhC,KAAA,mBAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAhC,cAAgC,EAAhC,IAAgC,EAAE;4BAAzC,GAAG;4BACJ,EAAE,GAAG,mBAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;4BAChD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;yBAC/B;wBAED,mBAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;wBACxE,qBAAM,iBAAM,KAAK,WAAE,EAAA;;wBAAnB,SAAmB,CAAC;;;;;KACvB;IAEY,wCAAgB,GAA7B,UAA8B,IAAY,EAAE,EAAY;;;gBACpD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;;;;KAChC;IAhBsB,sBAAQ,GAAY,KAAK,CAAC;IAC1B,oBAAM,GAAY,IAAI,CAAC;IAFrC,aAAa;QADzB,mBAAQ,CAAC,SAAS,CAAC,UAAU,CAAC;OAClB,aAAa,CAkBzB;IAAD,oBAAC;CAAA,AAlBD,CAAmC,qBAAS,GAkB3C;AAlBY,sCAAa"}
@@ -0,0 +1,5 @@
1
+ import { Attribute } from "../Attribute";
2
+ export declare class TemplateAttribute extends Attribute {
3
+ static readonly canDefer: boolean;
4
+ extract(): Promise<void>;
5
+ }
@@ -0,0 +1,89 @@
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.TemplateAttribute = void 0;
61
+ var Registry_1 = require("../Registry");
62
+ var Attribute_1 = require("../Attribute");
63
+ var TemplateAttribute = /** @class */ (function (_super) {
64
+ __extends(TemplateAttribute, _super);
65
+ function TemplateAttribute() {
66
+ return _super !== null && _super.apply(this, arguments) || this;
67
+ }
68
+ TemplateAttribute.prototype.extract = function () {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ return __generator(this, function (_a) {
71
+ switch (_a.label) {
72
+ case 0:
73
+ Registry_1.Registry.instance.templates.register(this.getAttributeBinding(), this.tag.element);
74
+ return [4 /*yield*/, _super.prototype.extract.call(this)];
75
+ case 1:
76
+ _a.sent();
77
+ return [2 /*return*/];
78
+ }
79
+ });
80
+ });
81
+ };
82
+ TemplateAttribute.canDefer = false;
83
+ TemplateAttribute = __decorate([
84
+ Registry_1.Registry.attribute('vsn-template')
85
+ ], TemplateAttribute);
86
+ return TemplateAttribute;
87
+ }(Attribute_1.Attribute));
88
+ exports.TemplateAttribute = TemplateAttribute;
89
+ //# sourceMappingURL=TemplateAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateAttribute.js","sourceRoot":"","sources":["../../src/attributes/TemplateAttribute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAqC;AACrC,0CAAuC;AAGvC;IAAuC,qCAAS;IAAhD;;IAOA,CAAC;IAJgB,mCAAO,GAApB;;;;;wBACI,mBAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;wBACnF,qBAAM,iBAAM,OAAO,WAAE,EAAA;;wBAArB,SAAqB,CAAC;;;;;KACzB;IALsB,0BAAQ,GAAY,KAAK,CAAC;IADxC,iBAAiB;QAD7B,mBAAQ,CAAC,SAAS,CAAC,cAAc,CAAC;OACtB,iBAAiB,CAO7B;IAAD,wBAAC;CAAA,AAPD,CAAuC,qBAAS,GAO/C;AAPY,8CAAiB"}
@@ -1,5 +1,6 @@
1
1
  export { AddClassIf } from "./AddClassIf";
2
2
  export { Bind } from "./Bind";
3
+ export { ComponentAttribute } from './ComponentAttribute';
3
4
  export { ControllerAttribute } from "./ControllerAttribute";
4
5
  export { DisableIf } from "./DisableIf";
5
6
  export { Exec } from "./Exec";
@@ -23,5 +24,5 @@ export { ScriptAttribute } from "./ScriptAttribute";
23
24
  export { SetAttribute } from "./SetAttribute";
24
25
  export { StandardAttribute } from "./StandardAttribute";
25
26
  export { StyleAttribute } from "./StyleAttribute";
26
- export { Template } from "./Template";
27
+ export { TemplateAttribute } from "./TemplateAttribute";
27
28
  export { TypeAttribute } from "./TypeAttribute";
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypeAttribute = exports.Template = exports.StyleAttribute = exports.StandardAttribute = exports.SetAttribute = exports.ScriptAttribute = exports.ScopeChange = exports.ScopeAttribute = exports.RootAttribute = exports.Referenced = exports.On = exports.Name = exports.ModelAttribute = exports.ListItemModel = exports.ListItem = exports.List = exports.LazyAttribute = exports.KeyUp = exports.KeyDown = exports.JSONAttribute = exports.If = exports.Format = exports.Exec = exports.DisableIf = exports.ControllerAttribute = exports.Bind = exports.AddClassIf = void 0;
3
+ exports.TypeAttribute = exports.TemplateAttribute = exports.StyleAttribute = exports.StandardAttribute = exports.SetAttribute = exports.ScriptAttribute = exports.ScopeChange = exports.ScopeAttribute = exports.RootAttribute = exports.Referenced = exports.On = exports.Name = exports.ModelAttribute = exports.ListItemModel = exports.ListItem = exports.List = exports.LazyAttribute = exports.KeyUp = exports.KeyDown = exports.JSONAttribute = exports.If = exports.Format = exports.Exec = exports.DisableIf = exports.ControllerAttribute = exports.ComponentAttribute = exports.Bind = exports.AddClassIf = void 0;
4
4
  var AddClassIf_1 = require("./AddClassIf");
5
5
  Object.defineProperty(exports, "AddClassIf", { enumerable: true, get: function () { return AddClassIf_1.AddClassIf; } });
6
6
  var Bind_1 = require("./Bind");
7
7
  Object.defineProperty(exports, "Bind", { enumerable: true, get: function () { return Bind_1.Bind; } });
8
+ var ComponentAttribute_1 = require("./ComponentAttribute");
9
+ Object.defineProperty(exports, "ComponentAttribute", { enumerable: true, get: function () { return ComponentAttribute_1.ComponentAttribute; } });
8
10
  var ControllerAttribute_1 = require("./ControllerAttribute");
9
11
  Object.defineProperty(exports, "ControllerAttribute", { enumerable: true, get: function () { return ControllerAttribute_1.ControllerAttribute; } });
10
12
  var DisableIf_1 = require("./DisableIf");
@@ -51,8 +53,8 @@ var StandardAttribute_1 = require("./StandardAttribute");
51
53
  Object.defineProperty(exports, "StandardAttribute", { enumerable: true, get: function () { return StandardAttribute_1.StandardAttribute; } });
52
54
  var StyleAttribute_1 = require("./StyleAttribute");
53
55
  Object.defineProperty(exports, "StyleAttribute", { enumerable: true, get: function () { return StyleAttribute_1.StyleAttribute; } });
54
- var Template_1 = require("./Template");
55
- Object.defineProperty(exports, "Template", { enumerable: true, get: function () { return Template_1.Template; } });
56
+ var TemplateAttribute_1 = require("./TemplateAttribute");
57
+ Object.defineProperty(exports, "TemplateAttribute", { enumerable: true, get: function () { return TemplateAttribute_1.TemplateAttribute; } });
56
58
  var TypeAttribute_1 = require("./TypeAttribute");
57
59
  Object.defineProperty(exports, "TypeAttribute", { enumerable: true, get: function () { return TypeAttribute_1.TypeAttribute; } });
58
60
  //# sourceMappingURL=_imports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_imports.js","sourceRoot":"","sources":["../../src/attributes/_imports.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,+BAA4B;AAApB,4FAAA,IAAI,OAAA;AACZ,6DAA0D;AAAlD,0HAAA,mBAAmB,OAAA;AAC3B,yCAAsC;AAA9B,sGAAA,SAAS,OAAA;AACjB,+BAA4B;AAApB,4FAAA,IAAI,OAAA;AACZ,mCAAgC;AAAxB,gGAAA,MAAM,OAAA;AACd,2BAAwB;AAAhB,wFAAA,EAAE,OAAA;AACV,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,qCAAkC;AAA1B,kGAAA,OAAO,OAAA;AACf,iCAA8B;AAAtB,8FAAA,KAAK,OAAA;AACb,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,+BAA4B;AAApB,4FAAA,IAAI,OAAA;AACZ,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,mDAA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,gHAAA,cAAc,OAAA;AACtB,+BAA4B;AAApB,4FAAA,IAAI,OAAA;AACZ,2BAAwB;AAAhB,wFAAA,EAAE,OAAA;AACV,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,mDAAgD;AAAxC,gHAAA,cAAc,OAAA;AACtB,6CAA0C;AAAlC,0GAAA,WAAW,OAAA;AACnB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AACpB,yDAAsD;AAA9C,sHAAA,iBAAiB,OAAA;AACzB,mDAAgD;AAAxC,gHAAA,cAAc,OAAA;AACtB,yDAAsD;AAA9C,sHAAA,iBAAiB,OAAA;AACzB,iDAA8C;AAAtC,8GAAA,aAAa,OAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
4
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
+ * Code distributed by Google as part of the polymer project is also
8
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
+ */
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
4
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
+ * Code distributed by Google as part of the polymer project is also
8
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
+ */
10
+ /**
11
+ * This shim allows elements written in, or compiled to, ES5 to work on native
12
+ * implementations of Custom Elements v1. It sets new.target to the value of
13
+ * this.constructor so that the native HTMLElement constructor can access the
14
+ * current under-construction element's definition.
15
+ */
16
+ (function () {
17
+ if (
18
+ // No Reflect, no classes, no need for shim because native custom elements
19
+ // require ES2015 classes or Reflect.
20
+ window.Reflect === undefined ||
21
+ window.customElements === undefined ||
22
+ // The webcomponentsjs custom elements polyfill doesn't require
23
+ // ES2015-compatible construction (`super()` or `Reflect.construct`).
24
+ window.customElements['polyfillWrapFlushCallback']) {
25
+ return;
26
+ }
27
+ var BuiltInHTMLElement = HTMLElement;
28
+ /**
29
+ * With jscompiler's RECOMMENDED_FLAGS the function name will be optimized away.
30
+ * However, if we declare the function as a property on an object literal, and
31
+ * use quotes for the property name, then closure will leave that much intact,
32
+ * which is enough for the JS VM to correctly set Function.prototype.name.
33
+ */
34
+ var wrapperForTheName = {
35
+ 'HTMLElement': /** @this {!Object} */ function HTMLElement() {
36
+ return Reflect.construct(BuiltInHTMLElement, [], /** @type {!Function} */ (this.constructor));
37
+ }
38
+ };
39
+ window.HTMLElement = wrapperForTheName['HTMLElement'];
40
+ HTMLElement.prototype = BuiltInHTMLElement.prototype;
41
+ HTMLElement.prototype.constructor = HTMLElement;
42
+ Object.setPrototypeOf(HTMLElement, BuiltInHTMLElement);
43
+ })();
44
+ //# sourceMappingURL=custom-elements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-elements.js","sourceRoot":"","sources":["../src/custom-elements.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;GAKG;AACH,CAAC;IACC;IACE,0EAA0E;IAC1E,qCAAqC;IACrC,MAAM,CAAC,OAAO,KAAK,SAAS;QAC5B,MAAM,CAAC,cAAc,KAAK,SAAS;QACnC,+DAA+D;QAC/D,qEAAqE;QACrE,MAAM,CAAC,cAAc,CAAC,2BAA2B,CAAC,EAClD;QACA,OAAO;KACR;IACD,IAAM,kBAAkB,GAAG,WAAW,CAAC;IACvC;;;;;OAKG;IACH,IAAM,iBAAiB,GAAG;QACxB,aAAa,EAAE,sBAAsB,CAAC,SAAS,WAAW;YACxD,OAAO,OAAO,CAAC,SAAS,CACpB,kBAAkB,EAAE,EAAE,EAAE,wBAAwB,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAC3E,CAAC;KACF,CAAC;IACF,MAAM,CAAC,WAAW,GAAG,iBAAiB,CAAC,aAAa,CAAQ,CAAC;IAC7D,WAAW,CAAC,SAAS,GAAG,kBAAkB,CAAC,SAAS,CAAC;IACrD,WAAW,CAAC,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;IAChD,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;AACzD,CAAC,CAAC,EAAE,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.1.74";
1
+ export declare const VERSION = "0.1.76";
package/dist/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.1.74';
4
+ exports.VERSION = '0.1.76';
5
5
  //# sourceMappingURL=version.js.map
package/dist/vsn.d.ts CHANGED
@@ -2,12 +2,14 @@ import { DOM } from "./DOM";
2
2
  import { Registry } from "./Registry";
3
3
  import { Configuration } from "./Configuration";
4
4
  import { EventDispatcher } from "./EventDispatcher";
5
+ import './custom-elements';
5
6
  export declare class Vision extends EventDispatcher {
6
7
  protected static _instance: Vision;
7
8
  protected _dom?: DOM;
8
9
  readonly registry: Registry;
9
10
  readonly config: Configuration;
10
11
  constructor();
12
+ protected defineComponent(name: any, cls: any): void;
11
13
  get dom(): DOM;
12
14
  exec(code: string): Promise<any>;
13
15
  setup(): Promise<void>;
package/dist/vsn.js CHANGED
@@ -72,12 +72,14 @@ var Query_1 = require("./Query");
72
72
  var EventDispatcher_1 = require("./EventDispatcher");
73
73
  var DynamicScopeData_1 = require("./Scope/DynamicScopeData");
74
74
  var version_1 = require("./version");
75
+ require("./custom-elements");
75
76
  var Vision = /** @class */ (function (_super) {
76
77
  __extends(Vision, _super);
77
78
  function Vision() {
78
79
  var _this = _super.call(this) || this;
79
80
  _this.registry = Registry_1.Registry.instance;
80
81
  _this.config = Configuration_1.Configuration.instance;
82
+ Registry_1.Registry.instance.components.on('register', _this.defineComponent, _this);
81
83
  if (VisionHelper_1.VisionHelper.document) {
82
84
  document.addEventListener("DOMContentLoaded", _this.setup.bind(_this));
83
85
  }
@@ -101,6 +103,9 @@ var Vision = /** @class */ (function (_super) {
101
103
  }
102
104
  return _this;
103
105
  }
106
+ Vision.prototype.defineComponent = function (name, cls) {
107
+ customElements.define(name, cls);
108
+ };
104
109
  Object.defineProperty(Vision.prototype, "dom", {
105
110
  get: function () {
106
111
  return this._dom;
package/dist/vsn.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vsn.js","sourceRoot":"","sources":["../src/vsn.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA0B;AAC1B,qDAAkD;AAClD,uCAAoC;AACpC,iDAA8C;AAC9C,uDAAoD;AACpD,6BAA2B;AAC3B,iCAA8B;AAC9B,qDAAkD;AAClD,6DAA0D;AAE1D,qCAAkC;AAElC;IAA4B,0BAAe;IAMvC;QAAA,YACI,iBAAO,SAyBV;QA7Be,cAAQ,GAAG,mBAAQ,CAAC,QAAQ,CAAC;QAC7B,YAAM,GAAkB,6BAAa,CAAC,QAAQ,CAAC;QAI3D,IAAI,2BAAY,CAAC,QAAQ,EAAE;YACvB,QAAQ,CAAC,gBAAgB,CACrB,kBAAkB,EAClB,KAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAI,CAAC,CACxB,CAAC;SACL;aAAM;YACH,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;SAChD;QACD,KAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;Q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AAe,OAAA;AACvB,6CAA0C;AAAlC,0GAAA,WAAW,OAAA;AACnB,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,6BAA0B;AAAlB,0FAAA,GAAG,OAAA;AACE,QAAA,MAAM,GAAW,MAAM,CAAC,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vsn",
3
- "version": "0.1.74",
3
+ "version": "0.1.77",
4
4
  "description": "SEO Friendly Javascript/Typescript Framework",
5
5
  "keywords": [
6
6
  "framework",
@@ -66,7 +66,10 @@ export class ClassNode extends Node implements TreeNode {
66
66
  Registry.class(this);
67
67
 
68
68
  if (root) {
69
- await this.findClassElements(dom);
69
+ if (dom.built)
70
+ await this.findClassElements(dom);
71
+ else
72
+ dom.once('builtRoot', () => this.findClassElements(dom));
70
73
  }
71
74
  } else {
72
75
  await this.block.prepare(this.classScope, dom, tag, meta);
@@ -84,14 +87,14 @@ export class ClassNode extends Node implements TreeNode {
84
87
  }
85
88
  }
86
89
 
87
- public async constructTag(tag: Tag, dom: DOM, hasConstructor: boolean | null = null) {
88
- if (hasConstructor === null)
89
- hasConstructor = this.classScope.has('construct');
90
+ public async constructTag(tag: Tag, dom: DOM, hasConstruct: boolean | null = null) {
91
+ if (hasConstruct === null)
92
+ hasConstruct = this.classScope.has('construct');
90
93
 
91
94
  tag.createScope(true);
92
95
  const meta = this.updateMeta();
93
96
  await this.block.prepare(tag.scope, dom, tag, meta);
94
- if (hasConstructor) {
97
+ if (hasConstruct) {
95
98
  const fncCls: FunctionNode = this.classScope.get('construct') as FunctionNode;
96
99
  const fnc = await fncCls.getFunction(tag.scope, dom, tag, false);
97
100
  await fnc();
@@ -101,11 +104,11 @@ export class ClassNode extends Node implements TreeNode {
101
104
  ClassNode.addPreparedClassToElement(tag.element, this.fullSelector);
102
105
  }
103
106
 
104
- public async deconstructTag(tag: Tag, dom: DOM, hasDeconstructor: boolean | null = null) {
105
- if (hasDeconstructor === null)
106
- hasDeconstructor = this.classScope.has('deconstruct');
107
+ public async deconstructTag(tag: Tag, dom: DOM, hasDeconstruct: boolean | null = null) {
108
+ if (hasDeconstruct === null)
109
+ hasDeconstruct = this.classScope.has('deconstruct');
107
110
 
108
- if (hasDeconstructor) {
111
+ if (hasDeconstruct) {
109
112
  const fncCls: FunctionNode = this.classScope.get('deconstruct') as FunctionNode;
110
113
  const fnc = await fncCls.getFunction(tag.scope, dom, tag, false);
111
114
  await fnc();
@@ -9,7 +9,6 @@ import {FunctionNode} from "./FunctionNode";
9
9
  import {Registry} from "../Registry";
10
10
  import {ElementQueryNode} from "./ElementQueryNode";
11
11
  import {ClassNode} from "./ClassNode";
12
- import {TagList} from "../Tag/List";
13
12
 
14
13
  export class FunctionCallNode<T = any> extends Node implements TreeNode {
15
14
  constructor(
@@ -28,7 +27,7 @@ export class FunctionCallNode<T = any> extends Node implements TreeNode {
28
27
 
29
28
  public async evaluate(scope: Scope, dom: DOM, tag: Tag = null) {
30
29
  // @todo: Need to rewrite/refactor this. It's a bit of a mess with element queries.
31
- let tags: Tag[];
30
+ let tags: Tag[] = [];
32
31
  let functionScope: Scope = scope;
33
32
  if (this.fnc instanceof ScopeMemberNode) {
34
33
  functionScope = await this.fnc.scope.evaluate(scope, dom, tag);
@@ -53,6 +52,7 @@ export class FunctionCallNode<T = any> extends Node implements TreeNode {
53
52
  const returnValues = [];
54
53
  const toCleanup = [];
55
54
  let calls = 0;
55
+
56
56
  for (const _tag of tags) {
57
57
  let tagNum = 0;
58
58
  for (const className of _tag.element[ClassNode.ClassesVariable]) {
@@ -68,6 +68,7 @@ export class FunctionCallNode<T = any> extends Node implements TreeNode {
68
68
  }
69
69
  }
70
70
  }
71
+
71
72
  for (const fnc of toCleanup) {
72
73
  await fnc.collectGarbage();
73
74
  }
package/src/Attribute.ts CHANGED
@@ -19,13 +19,18 @@ export abstract class Attribute extends EventDispatcher {
19
19
 
20
20
  constructor(
21
21
  public readonly tag: Tag,
22
- public readonly attributeName: string
22
+ public readonly attributeName: string,
23
+ public readonly slot?: Tag
23
24
  ) {
24
25
  super();
25
26
  this.configure();
26
27
  if (VisionHelper.window) VisionHelper.window['Attributes'].push(this);
27
28
  }
28
29
 
30
+ public get origin(): Tag {
31
+ return this.slot || this.tag;
32
+ }
33
+
29
34
  public get state(): AttributeState {
30
35
  return this._state;
31
36
  }
@@ -54,15 +59,15 @@ export abstract class Attribute extends EventDispatcher {
54
59
  };
55
60
 
56
61
  public getAttributeValue(fallback: any = null) {
57
- return this.tag.getRawAttributeValue(this.attributeName, fallback);
62
+ return this.origin.getRawAttributeValue(this.attributeName, fallback);
58
63
  }
59
64
 
60
65
  public getAttributeBinding(fallback: any = null): string {
61
- return this.tag.getAttributeBinding(this.attributeName) || fallback;
66
+ return this.origin.getAttributeBinding(this.attributeName) || fallback;
62
67
  }
63
68
 
64
69
  public getAttributeModifiers(fallback: any = []): string[] {
65
- const modifiers = this.tag.getAttributeModifiers(this.attributeName);
70
+ const modifiers = this.origin.getAttributeModifiers(this.attributeName);
66
71
  return modifiers.length && modifiers || fallback;
67
72
  }
68
73
 
@@ -73,11 +78,17 @@ export abstract class Attribute extends EventDispatcher {
73
78
  public mutate(mutation: MutationRecord): void {}
74
79
 
75
80
  public set value(value: string) {
76
- this.tag.element.setAttribute(this.attributeName, value);
81
+ this.origin.element.setAttribute(this.attributeName, value);
77
82
  }
78
83
 
79
84
  public get value(): string {
80
- return this.tag.element.getAttribute(this.attributeName) || '';
85
+ return this.origin.element.getAttribute(this.attributeName) || '';
86
+ }
87
+
88
+ public async apply(fnc: Function) {
89
+ for (const element of this.origin.delegates) {
90
+ await fnc(element);
91
+ }
81
92
  }
82
93
 
83
94
  private setState(state: AttributeState) {
@@ -90,7 +101,7 @@ export abstract class Attribute extends EventDispatcher {
90
101
  });
91
102
  }
92
103
 
93
- public static create(tag: Tag, attributeName: string, cls: any): Attribute {
94
- return new cls(tag, attributeName);
104
+ public static create(tag: Tag, attributeName: string, cls: any, slot?: Tag): Attribute {
105
+ return new cls(tag, attributeName, slot);
95
106
  }
96
107
  }