vsn 0.1.60 → 0.1.63

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 (65) hide show
  1. package/demo/demo.html +14 -13
  2. package/demo/vsn.js +2 -2
  3. package/demo/xhr.html +46 -3
  4. package/dist/AST/ClassNode.d.ts +22 -0
  5. package/dist/AST/ClassNode.js +248 -0
  6. package/dist/AST/ClassNode.js.map +1 -0
  7. package/dist/AST/FunctionCallNode.js +48 -10
  8. package/dist/AST/FunctionCallNode.js.map +1 -1
  9. package/dist/AST/FunctionNode.d.ts +2 -1
  10. package/dist/AST/FunctionNode.js +16 -4
  11. package/dist/AST/FunctionNode.js.map +1 -1
  12. package/dist/AST/OnNode.d.ts +9 -0
  13. package/dist/{attributes/ClassConstructor.js → AST/OnNode.js} +25 -40
  14. package/dist/AST/OnNode.js.map +1 -0
  15. package/dist/AST.d.ts +48 -46
  16. package/dist/AST.js +68 -46
  17. package/dist/AST.js.map +1 -1
  18. package/dist/DOM.js +55 -36
  19. package/dist/DOM.js.map +1 -1
  20. package/dist/Registry.d.ts +4 -3
  21. package/dist/Registry.js +8 -11
  22. package/dist/Registry.js.map +1 -1
  23. package/dist/Scope.d.ts +3 -0
  24. package/dist/Scope.js +15 -1
  25. package/dist/Scope.js.map +1 -1
  26. package/dist/Tag.d.ts +2 -0
  27. package/dist/Tag.js +12 -0
  28. package/dist/Tag.js.map +1 -1
  29. package/dist/attributes/ControllerAttribute.d.ts +9 -2
  30. package/dist/attributes/ControllerAttribute.js +78 -2
  31. package/dist/attributes/ControllerAttribute.js.map +1 -1
  32. package/dist/attributes/ListItem.js +1 -1
  33. package/dist/attributes/ListItem.js.map +1 -1
  34. package/dist/attributes/ModelAttribute.d.ts +2 -2
  35. package/dist/attributes/ModelAttribute.js +2 -2
  36. package/dist/attributes/ModelAttribute.js.map +1 -1
  37. package/dist/attributes/ScopeAttribute.js +6 -2
  38. package/dist/attributes/ScopeAttribute.js.map +1 -1
  39. package/dist/attributes/SetAttribute.js +9 -6
  40. package/dist/attributes/SetAttribute.js.map +1 -1
  41. package/dist/vsn.js +3 -3
  42. package/dist/vsn.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/AST/ClassNode.ts +117 -0
  45. package/src/AST/FunctionCallNode.ts +24 -1
  46. package/src/AST/FunctionNode.ts +9 -5
  47. package/src/AST/OnNode.ts +18 -0
  48. package/src/AST.ts +20 -0
  49. package/src/DOM.ts +13 -3
  50. package/src/Registry.ts +11 -9
  51. package/src/Scope.ts +9 -0
  52. package/src/Tag.ts +11 -0
  53. package/src/attributes/ControllerAttribute.ts +30 -2
  54. package/src/attributes/ListItem.ts +1 -1
  55. package/src/attributes/ModelAttribute.ts +2 -2
  56. package/src/attributes/ScopeAttribute.ts +3 -0
  57. package/src/attributes/SetAttribute.ts +6 -4
  58. package/src/vsn.ts +3 -3
  59. package/test/DOM.spec.ts +3 -3
  60. package/test/attributes/ListItem.spec.ts +3 -3
  61. package/test/attributes/SetAttribute.spec.ts +3 -3
  62. package/dist/attributes/ClassConstructor.d.ts +0 -10
  63. package/dist/attributes/ClassConstructor.js.map +0 -1
  64. package/dist/vsn.min.js +0 -2
  65. package/src/attributes/ClassConstructor.ts +0 -32
@@ -1,32 +0,0 @@
1
- import {Scope} from "../Scope";
2
- import {Attribute} from "../Attribute";
3
- import {Registry} from "../Registry";
4
-
5
- @Registry.attribute('vsn-controller')
6
- export class ClassConstructor extends Attribute {
7
- public static readonly canDefer: boolean = false;
8
- public static readonly scoped: boolean = true;
9
- protected attributeKey: string;
10
- protected className: string;
11
- protected defaultClassName: string;
12
-
13
- public async setup() {
14
- const parentScope: Scope = this.tag.parentTag.scope;
15
- if (!parentScope)
16
- return;
17
-
18
- this.attributeKey = this.getAttributeBinding();
19
- this.className = this.getAttributeValue(this.defaultClassName);
20
-
21
- const cls = await Registry.instance.classes.get(this.className);
22
- this.instantiateClass(cls);
23
-
24
- if (this.attributeKey && parentScope)
25
- parentScope.set(this.attributeKey, this.tag.scope);
26
- await super.setup();
27
- }
28
-
29
- protected instantiateClass(cls) {
30
- this.tag.wrap(cls);
31
- }
32
- }