vsn 0.1.76 → 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 (56) hide show
  1. package/demo/vsn.js +3 -2
  2. package/dist/Attribute.d.ts +5 -2
  3. package/dist/Attribute.js +39 -8
  4. package/dist/Attribute.js.map +1 -1
  5. package/dist/Component.d.ts +4 -0
  6. package/dist/Component.js +43 -0
  7. package/dist/Component.js.map +1 -0
  8. package/dist/DOM/DOMObject.d.ts +3 -0
  9. package/dist/DOM/DOMObject.js +14 -0
  10. package/dist/DOM/DOMObject.js.map +1 -1
  11. package/dist/DOM.js +22 -26
  12. package/dist/DOM.js.map +1 -1
  13. package/dist/Registry.d.ts +4 -2
  14. package/dist/Registry.js +6 -0
  15. package/dist/Registry.js.map +1 -1
  16. package/dist/Tag.d.ts +4 -2
  17. package/dist/Tag.js +163 -99
  18. package/dist/Tag.js.map +1 -1
  19. package/dist/attributes/ComponentAttribute.d.ts +5 -0
  20. package/dist/attributes/ComponentAttribute.js +105 -0
  21. package/dist/attributes/ComponentAttribute.js.map +1 -0
  22. package/dist/attributes/ListItem.d.ts +0 -1
  23. package/dist/attributes/ListItem.js +0 -7
  24. package/dist/attributes/ListItem.js.map +1 -1
  25. package/dist/attributes/On.js +1 -0
  26. package/dist/attributes/On.js.map +1 -1
  27. package/dist/attributes/TemplateAttribute.d.ts +5 -0
  28. package/dist/attributes/TemplateAttribute.js +89 -0
  29. package/dist/attributes/TemplateAttribute.js.map +1 -0
  30. package/dist/attributes/_imports.d.ts +2 -1
  31. package/dist/attributes/_imports.js +5 -3
  32. package/dist/attributes/_imports.js.map +1 -1
  33. package/dist/custom-elements.d.ts +9 -0
  34. package/dist/custom-elements.js +44 -0
  35. package/dist/custom-elements.js.map +1 -0
  36. package/dist/vsn.d.ts +2 -0
  37. package/dist/vsn.js +5 -0
  38. package/dist/vsn.js.map +1 -1
  39. package/package.json +1 -1
  40. package/src/Attribute.ts +19 -8
  41. package/src/Component.ts +25 -0
  42. package/src/DOM/DOMObject.ts +11 -0
  43. package/src/DOM.ts +8 -9
  44. package/src/Registry.ts +9 -3
  45. package/src/Tag.ts +70 -50
  46. package/src/attributes/ComponentAttribute.ts +24 -0
  47. package/src/attributes/ListItem.ts +0 -4
  48. package/src/attributes/On.ts +1 -0
  49. package/src/attributes/TemplateAttribute.ts +12 -0
  50. package/src/attributes/_imports.ts +2 -1
  51. package/src/custom-elements.ts +46 -0
  52. package/src/vsn.ts +6 -0
  53. package/dist/attributes/Template.d.ts +0 -4
  54. package/dist/attributes/Template.js +0 -39
  55. package/dist/attributes/Template.js.map +0 -1
  56. package/src/attributes/Template.ts +0 -7
@@ -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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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,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAA;;wBAAnE,SAAmE,CAAC;;;;;KACvE;IAEY,oBAAO,GAApB;;;;;wBACI,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,CAAC,qBAAqB,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;wBAC3G,qBAAM,iBAAM,OAAO,WAAE,EAAA;;wBAArB,SAAqB,CAAC;;;;;KACzB;IA9BsB,eAAY,GAAa;QAC5C,OAAO;QACP,YAAY;QACZ,aAAa;QACb,OAAO;QACP,YAAY;QACZ,MAAM;QACN,UAAU;QACV,QAAQ;QACR,QAAQ;QACR,QAAQ;KACX,CAAC;IAbgB,EAAE;QADvB,mBAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC;OACP,EAAE,CAiCvB;IAAD,SAAC;CAAA,AAjCD,CAAiC,qBAAS,GAiCzC;AAjCqB,gBAAE"}
@@ -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;AA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C;AAAtC,8GAAA,aAAa,OAAA;AACrB,mDAAgD;AAAxC,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/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;QACrD,KAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACvD,KAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACzD,KAAI,CAAC,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@
1
1
  {
2
2
  "name": "vsn",
3
- "version": "0.1.76",
3
+ "version": "0.1.77",
4
4
  "description": "SEO Friendly Javascript/Typescript Framework",
5
5
  "keywords": [
6
6
  "framework",
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
  }
@@ -0,0 +1,25 @@
1
+ import {Registry} from "./Registry";
2
+ import {DOM} from "./DOM";
3
+
4
+ export class Component extends HTMLElement {
5
+ protected readonly shadow: ShadowRoot;
6
+
7
+ constructor() {
8
+ super();
9
+ Object.setPrototypeOf(this, Component.prototype);
10
+ console.log('huh');
11
+
12
+ this.shadow = this.attachShadow({mode: 'open'});
13
+ const templateId = this.getAttribute('template');
14
+ let template: HTMLTemplateElement;
15
+
16
+ if (templateId) {
17
+ template = document.getElementById(templateId) as HTMLTemplateElement;
18
+ } else {
19
+ template = Registry.instance.templates.getSynchronous(this.tagName.toLowerCase());
20
+ }
21
+
22
+ this.shadow.appendChild(template.content.cloneNode(true));
23
+ DOM.instance.buildFrom(this.shadow);
24
+ }
25
+ }
@@ -11,12 +11,23 @@ export abstract class DOMObject extends EventDispatcher {
11
11
  protected _scope: Scope;
12
12
  protected onEventHandlers: {[key:string]: IEventHandler[]};
13
13
  protected _uniqueScope: boolean = false;
14
+ protected slot: HTMLSlotElement;
15
+ public readonly delegates: HTMLElement[] = [];
14
16
 
15
17
  constructor(
16
18
  public readonly element: HTMLElement,
17
19
  props
18
20
  ) {
19
21
  super();
22
+ if (this.isSlot) {
23
+ this.delegates.push(...(element as HTMLSlotElement).assignedNodes() as HTMLElement[]);
24
+ }
25
+ if (element.assignedSlot)
26
+ this.slot = element.assignedSlot;
27
+ }
28
+
29
+ public get isSlot(): boolean {
30
+ return this.element instanceof HTMLSlotElement;
20
31
  }
21
32
 
22
33
  public get scope(): Scope {
package/src/DOM.ts CHANGED
@@ -8,6 +8,7 @@ import {WrappedDocument} from "./DOM/WrappedDocument";
8
8
  import {Scope} from "./Scope";
9
9
  import {EventDispatcher} from "./EventDispatcher";
10
10
  import {ClassNode} from "./AST/ClassNode";
11
+ import {Registry} from "./Registry";
11
12
 
12
13
  export enum EQuerySelectDirection {
13
14
  ALL,
@@ -250,11 +251,11 @@ export class DOM extends EventDispatcher {
250
251
  async getTagsForElements(elements: Element[], create: boolean = false) {
251
252
  const tags: TagList = new TagList();
252
253
  const found: Element[] = [];
253
- for (const tag of this.tags)
254
- {
255
- if (!found.includes(tag.element) && elements.indexOf(tag.element) > -1) {
256
- tags.push(tag);
257
- found.push(tag.element);
254
+
255
+ for (const element of elements) {
256
+ if (element[Tag.TaggedVariable]) {
257
+ tags.push(element[Tag.TaggedVariable]);
258
+ found.push(element);
258
259
  }
259
260
  }
260
261
 
@@ -276,10 +277,8 @@ export class DOM extends EventDispatcher {
276
277
  }
277
278
 
278
279
  async getTagForElement(element: Element, create: boolean = false) {
279
- for (const tag of this.tags) {
280
- if (tag.element === element)
281
- return tag;
282
- }
280
+ if (element[Tag.TaggedVariable])
281
+ return element[Tag.TaggedVariable];
283
282
 
284
283
  if (element && create) {
285
284
  if (element instanceof HTMLElement)
package/src/Registry.ts CHANGED
@@ -13,9 +13,9 @@ export function register(store: string, key: string = null, setup: () => void =
13
13
  }
14
14
  }
15
15
 
16
- export class RegistryStore extends EventDispatcher {
16
+ export class RegistryStore<T = any> extends EventDispatcher {
17
17
  private timeouts = {};
18
- private readonly store: {[key: string]: any};
18
+ private readonly store: {[key: string]: T};
19
19
 
20
20
  constructor(defaults = null) {
21
21
  super();
@@ -62,6 +62,7 @@ export class RegistryStore extends EventDispatcher {
62
62
 
63
63
  export class Registry extends EventDispatcher {
64
64
  protected static _instance: Registry;
65
+ public readonly components: RegistryStore;
65
66
  public readonly functions: RegistryStore;
66
67
  public readonly controllers: RegistryStore;
67
68
  public readonly classes: RegistryStore;
@@ -74,17 +75,22 @@ export class Registry extends EventDispatcher {
74
75
 
75
76
  constructor() {
76
77
  super();
78
+ this.components = new RegistryStore();
77
79
  this.functions = new RegistryStore();
78
80
  this.controllers = new RegistryStore();
79
81
  this.classes = new RegistryStore();
80
82
  this.models = new RegistryStore();
81
- this.templates = new RegistryStore();
83
+ this.templates = new RegistryStore<HTMLTemplateElement>();
82
84
  this.types = new RegistryStore();
83
85
  this.validators = new RegistryStore();
84
86
  this.formats = new RegistryStore();
85
87
  this.attributes = new RegistryStore();
86
88
  }
87
89
 
90
+ public static component(key: string = null, setup = null) {
91
+ return register('components', key, setup);
92
+ }
93
+
88
94
  public static function(key: string = null, setup = null) {
89
95
  return register('functions', key, setup);
90
96
  }