vsn 0.1.29 → 0.1.30

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.
@@ -27,7 +27,12 @@ export class ScopeMemberNode extends Node implements TreeNode {
27
27
  const values = [];
28
28
 
29
29
  if (this.scope instanceof ElementQueryNode) {
30
- scopes = await this.scope.evaluate(scope, dom, tag);
30
+ const elements = await this.scope.evaluate(scope, dom, tag);
31
+ if (this.scope.first) {
32
+ scopes.push(elements);
33
+ } else {
34
+ scopes = elements;
35
+ }
31
36
  } else {
32
37
  const evalScope = await this.scope.evaluate(scope, dom, tag);
33
38
  if (evalScope instanceof TagList) {
package/src/AST.ts CHANGED
@@ -454,7 +454,7 @@ export class Tree {
454
454
  node = new NumberLiteralNode(token.value);
455
455
  tokens.splice(0, 1);
456
456
  } else if (tokens[0].type === TokenType.ELEMENT_REFERENCE) {
457
- node = new ElementQueryNode(tokens[0].value);
457
+ node = new ElementQueryNode(tokens[0].value, true);
458
458
  tokens.splice(0, 1);
459
459
  } else if (tokens[0].type === TokenType.ELEMENT_QUERY) {
460
460
  node = new ElementQueryNode(tokens[0].value);
@@ -4,7 +4,6 @@ export class DynamicScopeData extends ScopeDataAbstract {
4
4
  constructor(data: IScopeData | string[]) {
5
5
  super();
6
6
  if(data instanceof Array) {
7
- this.__properties__ = data;
8
7
  for (const field of data)
9
8
  this.createProperty(field);
10
9
  } else {
@@ -14,8 +13,7 @@ export class DynamicScopeData extends ScopeDataAbstract {
14
13
 
15
14
  setData(data: IScopeData) {
16
15
  for(const field of Object.keys(data))
17
- if(this.__properties__.indexOf(field) == -1) {
18
- this.__properties__.push(field);
16
+ if(!this.hasProperty(field)) {
19
17
  this.createProperty(field);
20
18
  }
21
19
  super.setData(data);
@@ -23,6 +23,7 @@ export class ScopeDataAbstract extends EventDispatcher {
23
23
  const instance = new propertyType(config.default, config),
24
24
  propDesc = Object.getOwnPropertyDescriptor(this, name);
25
25
  this['__'+name] = instance;
26
+ this.__properties__.push(name);
26
27
 
27
28
  // property getter
28
29
  const propertyGetter = function() {
package/src/Scope.ts CHANGED
@@ -82,7 +82,6 @@ export class Scope extends EventDispatcher {
82
82
  set(key: string, value: any) {
83
83
  if (!this.data.hasProperty(key))
84
84
  this.data.createProperty(key);
85
-
86
85
  this.data[key] = value;
87
86
  }
88
87
 
package/src/Tag/List.ts CHANGED
@@ -29,12 +29,12 @@ export class TagList extends Array<DOMObject> {
29
29
  return this.map(e => e.element);
30
30
  }
31
31
 
32
- next() {
33
- return this.map(e => e.element.nextElementSibling).filter(e => e != null)
32
+ get first(): DOMObject {
33
+ return this[0];
34
34
  }
35
35
 
36
- prev() {
37
- return this.map(e => e.element.previousElementSibling).filter(e => e != null)
36
+ get last(): DOMObject {
37
+ return this[this.length - 1];
38
38
  }
39
39
 
40
40
  removeClass(className) {
package/src/Types.ts CHANGED
@@ -24,7 +24,7 @@ export class Types {
24
24
 
25
25
  @Registry.type('boolean')
26
26
  public static boolean(value: string) {
27
- return [0, '0', 'false', ''].indexOf(value) === -1;
27
+ return [0, '0', false, 'false', ''].indexOf(value) === -1;
28
28
  }
29
29
 
30
30
  @Registry.type('date')
@@ -1,4 +1,4 @@
1
- import MessageList from "../src/MessageList";
1
+ import {MessageList} from "../src/MessageList";
2
2
 
3
3
  describe('MessageList', () => {
4
4
  it("should reset properly", () => {