vsn 0.1.96 → 0.1.99

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 (79) hide show
  1. package/demo/examples/component-slots.html +26 -0
  2. package/demo/vsn.js +2 -2
  3. package/dist/AST/ElementAttributeNode.js +5 -5
  4. package/dist/AST/ElementAttributeNode.js.map +1 -1
  5. package/dist/AST/ElementStyleNode.js +2 -2
  6. package/dist/AST/ElementStyleNode.js.map +1 -1
  7. package/dist/AST/FunctionCallNode.js +1 -1
  8. package/dist/AST/FunctionCallNode.js.map +1 -1
  9. package/dist/AST/ObjectNode.js +1 -1
  10. package/dist/AST/ObjectNode.js.map +1 -1
  11. package/dist/AST/ScopeMemberNode.js +2 -2
  12. package/dist/AST/ScopeMemberNode.js.map +1 -1
  13. package/dist/Component.js +14 -5
  14. package/dist/Component.js.map +1 -1
  15. package/dist/DOM/DOMObject.d.ts +1 -0
  16. package/dist/DOM/DOMObject.js +7 -0
  17. package/dist/DOM/DOMObject.js.map +1 -1
  18. package/dist/DOM.d.ts +2 -3
  19. package/dist/DOM.js +68 -31
  20. package/dist/DOM.js.map +1 -1
  21. package/dist/Formats.js +4 -1
  22. package/dist/Formats.js.map +1 -1
  23. package/dist/Query.d.ts +1 -1
  24. package/dist/Query.js +2 -2
  25. package/dist/Query.js.map +1 -1
  26. package/dist/Scope.d.ts +1 -1
  27. package/dist/Scope.js +17 -1
  28. package/dist/Scope.js.map +1 -1
  29. package/dist/Tag/ShadowRootTag.d.ts +3 -0
  30. package/dist/Tag/ShadowRootTag.js +28 -0
  31. package/dist/Tag/ShadowRootTag.js.map +1 -0
  32. package/dist/Tag/SlotTag.d.ts +3 -0
  33. package/dist/Tag/SlotTag.js +28 -0
  34. package/dist/Tag/SlotTag.js.map +1 -0
  35. package/dist/Tag/SlottedTag.d.ts +3 -0
  36. package/dist/Tag/SlottedTag.js +28 -0
  37. package/dist/Tag/SlottedTag.js.map +1 -0
  38. package/dist/Tag/{List.d.ts → TagList.d.ts} +0 -0
  39. package/dist/Tag/{List.js → TagList.js} +1 -1
  40. package/dist/Tag/TagList.js.map +1 -0
  41. package/dist/Tag.d.ts +11 -2
  42. package/dist/Tag.js +37 -18
  43. package/dist/Tag.js.map +1 -1
  44. package/dist/attributes/List.d.ts +2 -1
  45. package/dist/attributes/List.js +35 -11
  46. package/dist/attributes/List.js.map +1 -1
  47. package/dist/attributes/ListItem.js +1 -1
  48. package/dist/attributes/ListItem.js.map +1 -1
  49. package/dist/attributes/ScopeAttribute.js +14 -12
  50. package/dist/attributes/ScopeAttribute.js.map +1 -1
  51. package/dist/version.d.ts +1 -1
  52. package/dist/version.js +1 -1
  53. package/dist/vsn.min.js +3 -0
  54. package/dist/vsn.min.js.LICENSE.txt +9 -0
  55. package/package.json +1 -1
  56. package/src/AST/ElementAttributeNode.ts +1 -1
  57. package/src/AST/ElementStyleNode.ts +1 -1
  58. package/src/AST/FunctionCallNode.ts +1 -1
  59. package/src/AST/ObjectNode.ts +1 -1
  60. package/src/AST/ScopeMemberNode.ts +1 -1
  61. package/src/Component.ts +10 -3
  62. package/src/DOM/DOMObject.ts +4 -0
  63. package/src/DOM.ts +28 -5
  64. package/src/Formats.ts +4 -1
  65. package/src/Query.ts +1 -1
  66. package/src/Scope.ts +14 -1
  67. package/src/Tag/ShadowRootTag.ts +5 -0
  68. package/src/Tag/SlotTag.ts +5 -0
  69. package/src/Tag/SlottedTag.ts +5 -0
  70. package/src/Tag/{List.ts → TagList.ts} +0 -0
  71. package/src/Tag.ts +23 -19
  72. package/src/attributes/List.ts +34 -9
  73. package/src/attributes/ListItem.ts +1 -1
  74. package/src/attributes/ScopeAttribute.ts +12 -8
  75. package/src/version.ts +1 -1
  76. package/test/AST/ClassNode.spec.ts +1 -1
  77. package/test/Tag/TagList.spec.ts +1 -1
  78. package/test/attributes/ListItem.spec.ts +2 -3
  79. package/dist/Tag/List.js.map +0 -1
@@ -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
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vsn",
3
- "version": "0.1.96",
3
+ "version": "0.1.99",
4
4
  "description": "SEO Friendly Javascript/Typescript Framework",
5
5
  "keywords": [
6
6
  "framework",
@@ -1,7 +1,7 @@
1
1
  import {Scope} from "../Scope";
2
2
  import {DOM} from "../DOM";
3
3
  import {Tag} from "../Tag";
4
- import {TagList} from "../Tag/List";
4
+ import {TagList} from "../Tag/TagList";
5
5
  import {TreeNode} from "../AST";
6
6
  import {Node} from "./Node";
7
7
  import {ElementQueryNode} from "./ElementQueryNode";
@@ -1,7 +1,7 @@
1
1
  import {Scope} from "../Scope";
2
2
  import {DOM} from "../DOM";
3
3
  import {Tag} from "../Tag";
4
- import {TagList} from "../Tag/List";
4
+ import {TagList} from "../Tag/TagList";
5
5
  import {TreeNode} from "../AST";
6
6
  import {Node} from "./Node";
7
7
  import {ElementQueryNode} from "./ElementQueryNode";
@@ -55,7 +55,7 @@ export class FunctionCallNode<T = any> extends Node implements TreeNode {
55
55
 
56
56
  for (const _tag of tags) {
57
57
  let tagNum = 0;
58
- for (const className of _tag.element[ClassNode.ClassesVariable]) {
58
+ for (const className of _tag.element[ClassNode.ClassesVariable] || []) {
59
59
  tagNum++;
60
60
  const cls = Registry.instance.classes.getSynchronous(className);
61
61
  if (cls) {
@@ -21,7 +21,7 @@ export class ObjectNode extends Node implements TreeNode {
21
21
  for (let i = 0; i < this.values.length; i++) {
22
22
  const key = this.keys[i];
23
23
  const val = this.values[i];
24
- obj.set(await key.evaluate(scope, dom, tag), await val.evaluate(scope, dom, tag));
24
+ obj.set(await key.evaluate(scope, dom, tag), await val.evaluate(scope, dom, tag), true);
25
25
  }
26
26
  return obj;
27
27
  }
@@ -1,7 +1,7 @@
1
1
  import {Scope} from "../Scope";
2
2
  import {DOM} from "../DOM";
3
3
  import {Tag} from "../Tag";
4
- import {TagList} from "../Tag/List";
4
+ import {TagList} from "../Tag/TagList";
5
5
  import {DOMObject} from "../DOM/DOMObject";
6
6
  import {TreeNode} from "../AST";
7
7
  import {Node} from "./Node";
package/src/Component.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import {Registry} from "./Registry";
2
2
  import {DOM} from "./DOM";
3
+ import {SlotTag} from "./Tag/SlotTag";
4
+ import {SlottedTag} from "./Tag/SlottedTag";
3
5
 
4
6
  export class Component extends HTMLElement {
5
7
  protected readonly shadow: ShadowRoot;
@@ -21,14 +23,19 @@ export class Component extends HTMLElement {
21
23
  this.setAttribute('vsn-ref', '');
22
24
 
23
25
  this.shadow.appendChild(template.content.cloneNode(true));
24
- this.shadow.querySelectorAll('slot').forEach(slot => {
26
+ this.shadow.querySelectorAll('slot').forEach((slot) => {
27
+ const slotTagPromise = DOM.instance.buildTag(slot,false, SlotTag);
25
28
  slot.addEventListener('slotchange', async (e) => {
26
29
  for (const child of slot.assignedNodes()) {
27
- const t = await DOM.instance.getTagForElement(child as HTMLElement, true, true);
28
- t?.slotted(slot);
30
+ const t = await DOM.instance.buildTag(child as HTMLElement, false, SlottedTag);
31
+ await t?.slotted(slot);
29
32
  }
33
+ slotTagPromise.then((slotTag) => {
34
+ slotTag.buildAttributes();
35
+ });
30
36
  });
31
37
  });
38
+
32
39
  DOM.instance.buildFrom(this.shadow);
33
40
  }
34
41
  }
@@ -31,6 +31,10 @@ export abstract class DOMObject extends EventDispatcher {
31
31
  return this.element instanceof HTMLSlotElement;
32
32
  }
33
33
 
34
+ public get isSlotted(): boolean {
35
+ return this.element.hasAttribute('slot');
36
+ }
37
+
34
38
  public get scope(): Scope {
35
39
  if (!!this._scope)
36
40
  return this._scope;
package/src/DOM.ts CHANGED
@@ -2,13 +2,15 @@ import {Tag} from "./Tag";
2
2
  import {ElementHelper} from "./helpers/ElementHelper";
3
3
  import {Configuration} from "./Configuration";
4
4
  import {Tree} from "./AST";
5
- import {TagList} from "./Tag/List";
5
+ import {TagList} from "./Tag/TagList";
6
6
  import {WrappedWindow} from "./DOM/WrappedWindow";
7
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
11
  import {Registry} from "./Registry";
12
+ import {SlotTag} from "./Tag/SlotTag";
13
+ import {SlottedTag} from "./Tag/SlottedTag";
12
14
 
13
15
  export enum EQuerySelectDirection {
14
16
  ALL,
@@ -27,7 +29,6 @@ export class DOM extends EventDispatcher {
27
29
  protected window: WrappedWindow;
28
30
  protected document: WrappedDocument;
29
31
  protected _built: boolean = false;
30
- public selected: Tag;
31
32
 
32
33
  constructor(
33
34
  protected rootElement: Document,
@@ -192,6 +193,10 @@ export class DOM extends EventDispatcher {
192
193
  async discover(ele: HTMLElement, forComponent: boolean = false): Promise<HTMLElement[]> {
193
194
  const discovered: HTMLElement[] = [];
194
195
  const checkElement = (e: HTMLElement): boolean => {
196
+ if (Registry.instance.components.has(e?.tagName?.toLowerCase())) {
197
+ return false;
198
+ }
199
+
195
200
  if (ElementHelper.hasVisionAttribute(e)) {
196
201
  if (
197
202
  (!forComponent && e.hasAttribute('slot'))
@@ -216,9 +221,14 @@ export class DOM extends EventDispatcher {
216
221
  return discovered;
217
222
  }
218
223
 
219
- async buildTag(element: HTMLElement, returnExisting: boolean = false): Promise<Tag> {
224
+ async buildTag(element: HTMLElement, returnExisting: boolean = false, cls: any = Tag): Promise<Tag> {
220
225
  if (element[Tag.TaggedVariable]) return returnExisting ? element[Tag.TaggedVariable] : null;
221
- const tag: Tag = new Tag(element, this);
226
+ if (element.tagName.toLowerCase() === 'slot')
227
+ cls = SlotTag;
228
+ else if (element.hasAttribute('slot'))
229
+ cls = SlottedTag;
230
+
231
+ const tag: Tag = new cls(element, this);
222
232
  this.tags.push(tag);
223
233
  return tag;
224
234
  }
@@ -261,6 +271,20 @@ export class DOM extends EventDispatcher {
261
271
  document.ondragover = (e) => e.cancelable && e.preventDefault(); // Allow dragging over document
262
272
  }
263
273
 
274
+ // Setup components first
275
+ const templateNodes = this.querySelectorElement(ele, 'template');
276
+ const components: Tag[] = [];
277
+ for (const n of Array.from(templateNodes) as HTMLElement[]) {
278
+ if (!ElementHelper.hasVisionAttribute(n))
279
+ continue;
280
+
281
+ const tag = await this.buildTag(n);
282
+ if (tag)
283
+ components.push(tag);
284
+ }
285
+ if (components.length)
286
+ await this.setupTags(components);
287
+
264
288
  // Create tags for each html element with a vsn-attribute
265
289
  const newTags: Tag[] = [];
266
290
  const toBuild: HTMLElement[] = await this.discover(ele, forComponent);
@@ -270,7 +294,6 @@ export class DOM extends EventDispatcher {
270
294
  if (tag)
271
295
  newTags.push(tag);
272
296
  }
273
-
274
297
  if (isRoot)
275
298
  this._root = await this.getTagForElement(document.body);
276
299
 
package/src/Formats.ts CHANGED
@@ -20,7 +20,10 @@ export class Formats {
20
20
  setup();
21
21
  }
22
22
  value = `${value}`.replace(/[^0-9.]+/, '');
23
- return Formats.CurrencyFormatter.format(parseFloat(value));
23
+ value = parseFloat(value);
24
+ if (isNaN(value))
25
+ return '';
26
+ return Formats.CurrencyFormatter.format(value);
24
27
  }
25
28
 
26
29
  @Registry.format('date')
package/src/Query.ts CHANGED
@@ -1,4 +1,4 @@
1
- import {TagList} from "./Tag/List";
1
+ import {TagList} from "./Tag/TagList";
2
2
  import {VisionHelper} from "./helpers/VisionHelper";
3
3
  import {DOM} from "./DOM";
4
4
  import {WrappedWindow} from "./DOM/WrappedWindow";
package/src/Scope.ts CHANGED
@@ -94,7 +94,20 @@ export class Scope extends EventDispatcher {
94
94
  return value;
95
95
  }
96
96
 
97
- set(key: string, value: any) {
97
+ set(key: string, value: any, detectType: boolean = false): void {
98
+ if (detectType) {
99
+ const type = typeof value;
100
+ if (type === 'number') {
101
+ if (value % 1 === 0)
102
+ this.setType(key, 'integer');
103
+ else
104
+ this.setType(key, 'float');
105
+ } else if (type === 'string') {
106
+ this.setType(key, 'string');
107
+ } else if (type === 'boolean') {
108
+ this.setType(key, 'boolean');
109
+ }
110
+ }
98
111
  if (!this._data.hasProperty(key))
99
112
  this._data.createProperty(key);
100
113
  this._data[key] = value;
@@ -0,0 +1,5 @@
1
+ import {Tag} from "../Tag";
2
+
3
+ export class ShadowRootTag extends Tag {
4
+
5
+ }
@@ -0,0 +1,5 @@
1
+ import {Tag} from "../Tag";
2
+
3
+
4
+ export class SlotTag extends Tag {
5
+ }
@@ -0,0 +1,5 @@
1
+ import {Tag} from "../Tag";
2
+
3
+ export class SlottedTag extends Tag {
4
+
5
+ }
File without changes
package/src/Tag.ts CHANGED
@@ -26,7 +26,9 @@ export class Tag extends DOMObject {
26
26
  public readonly parsedAttributes: { [key: string]: string[]; };
27
27
  public readonly deferredAttributes: Attribute[] = [];
28
28
  protected _state: TagState;
29
+ protected _meta: { [key: string]: any; };
29
30
  protected attributes: Attribute[];
31
+ protected attributeMap: { [key: string]: Attribute; };
30
32
  protected _nonDeferredAttributes: Attribute[] = [];
31
33
  protected _parentTag: Tag;
32
34
  protected _children: Tag[] = [];
@@ -59,19 +61,23 @@ export class Tag extends DOMObject {
59
61
  this.rawAttributes = {};
60
62
  this.parsedAttributes = {};
61
63
  this.attributes = [];
64
+ this.attributeMap = {};
62
65
  this.onEventHandlers = {};
63
66
  this.analyzeElementAttributes();
64
67
  this._state = TagState.Instantiated;
65
- if (this.hasAttribute('slot')) {
66
- this.addEventHandler('slotted',[], (e) => {
67
- console.log('slot change', e, this.element.assignedSlot);
68
- })
69
- }
70
68
  }
71
69
 
72
- public slotted(slot: HTMLSlotElement) {
70
+ public get meta() {
71
+ if (!this._meta)
72
+ this._meta = {};
73
+ return this._meta;
74
+ }
75
+
76
+ public async slotted(slot: HTMLSlotElement) {
73
77
  this.slot = slot;
74
- console.log('i am slotted', slot);
78
+ this.parentTag = await this.dom.getTagForElement(slot);
79
+ await this.dom.setupTags([this]);
80
+ await this.dom.buildFrom(this.element, false, true);
75
81
  }
76
82
 
77
83
  protected onAttributeStateChange(event) {
@@ -432,7 +438,6 @@ export class Tag extends DOMObject {
432
438
  public async buildAttributes() {
433
439
  let requiresScope = false;
434
440
  let defer: boolean = false;
435
- this.attributes.length = 0;
436
441
  const isMobile: boolean = VisionHelper.isMobile();
437
442
  if (this.element.offsetParent === null ||
438
443
  this.hasAttribute('hidden') ||
@@ -445,17 +450,15 @@ export class Tag extends DOMObject {
445
450
  const slot: Tag = this.isSlot ? this : null;
446
451
  for (const tag of tags) {
447
452
  for (let attr in this.rawAttributes) {
448
- if (this.hasModifier(attr, 'mobile')) {
449
- if (!isMobile) {
450
- continue;
451
- }
452
- }
453
+ if (tag.attributeMap[attr])
454
+ continue;
455
+
456
+ if (this.hasModifier(attr, 'mobile') && !isMobile)
457
+ continue;
453
458
 
454
- if (this.hasModifier(attr, 'desktop')) {
455
- if (isMobile) {
456
- continue;
457
- }
458
- }
459
+
460
+ if (this.hasModifier(attr, 'desktop') && isMobile)
461
+ continue;
459
462
 
460
463
  const attrClass = await this.getAttributeClass(attr);
461
464
  if (attrClass) {
@@ -463,7 +466,9 @@ export class Tag extends DOMObject {
463
466
  requiresScope = true;
464
467
 
465
468
  const attrObj = attrClass.create(tag, attr, attrClass, slot);
469
+
466
470
  tag.attributes.push(attrObj);
471
+ tag.attributeMap[attr] = attrObj;
467
472
  if (defer && attrClass.canDefer) {
468
473
  await attrObj.defer();
469
474
  tag.deferredAttributes.push(attrObj);
@@ -489,7 +494,6 @@ export class Tag extends DOMObject {
489
494
  for (const attr of tag.getAttributesWithState(AttributeState.Instantiated)) {
490
495
  await attr.compile();
491
496
  }
492
-
493
497
  }
494
498
  this._state = TagState.AttributesCompiled;
495
499
  }
@@ -5,9 +5,11 @@ import {ElementHelper} from "../helpers/ElementHelper";
5
5
  import {Registry} from "../Registry";
6
6
  import {DOM} from "../DOM";
7
7
  import {Scope} from "../Scope";
8
+ import {ScopeData} from "../Scope/ScopeData";
8
9
 
9
10
  @Registry.attribute('vsn-list')
10
11
  export class List extends Attribute {
12
+ public static readonly MetaItemSetupFlag = 'vsn-list-item-setup';
11
13
  public static readonly canDefer: boolean = false;
12
14
  public static readonly scoped: boolean = true;
13
15
 
@@ -51,7 +53,7 @@ export class List extends Attribute {
51
53
  await this.addExistingItems(items);
52
54
 
53
55
  listScope.on(`change:${listKey}`, (e) => {
54
- if (e.oldValue) {
56
+ if (e?.oldValue) {
55
57
  if (e.oldValue instanceof WrappedArray) {
56
58
  e.oldValue.map((item) => {
57
59
  this.remove(item);
@@ -145,36 +147,59 @@ export class List extends Attribute {
145
147
  }
146
148
  delete element[Tag.TaggedVariable];
147
149
 
150
+ // Collect raw data
151
+ let data;
152
+ if (obj instanceof ScopeData)
153
+ data = obj.getData();
154
+ else
155
+ data = Object.assign({}, obj);
156
+
148
157
  // Setup new tag
149
158
  const tag = await this.tag.dom.buildTag(element, true);
150
-
151
- await this.setupTag(tag, obj);
159
+ await this.setupTagScope(tag, obj);
152
160
 
153
161
  // Add to DOM & build
154
162
  this.tag.element.appendChild(element);
163
+ await this.tag.dom.setupTags([tag]);
155
164
  await this.tag.dom.buildFrom(this.tag.element);
165
+
166
+ // Make sure we're using the correct data (Template may have vsn-bind values that are not desired)
167
+ const itemScope = tag.scope.get(this.listItemName);
168
+ if (itemScope instanceof Scope && data) {
169
+ itemScope.data.setData(data);
170
+ }
171
+
156
172
  this.tags.push(tag);
157
173
  this.tag.dispatch('add', obj);
158
174
  }
159
175
 
160
- async setupTag(tag: Tag, obj: any) {
176
+ async setupTagScope(tag: Tag, obj: any) {
177
+ if (tag.meta[List.MetaItemSetupFlag])
178
+ return;
179
+
161
180
  tag.createScope(true);
181
+ const itemScope = new Scope(tag.scope);
162
182
 
163
- // Setup new scope & class, if defined
183
+ // Setup new scope & model class, if defined
164
184
  const modelName: string = this.listItemModel;
165
185
  let cls;
166
186
  if (modelName)
167
187
  cls = await Registry.instance.models.get(modelName);
168
188
 
169
189
  if (cls) {
170
- if (!obj || !(obj instanceof cls))
190
+ if (!obj || !(obj instanceof cls)) {
171
191
  obj = new cls(obj);
192
+ }
172
193
  }
173
194
 
174
195
  // Check if the class is set up already
175
- if (!cls || (!(tag.scope.data instanceof cls) && !(tag.scope.wrapped instanceof cls)))
176
- tag.wrap(obj);
196
+ if (!cls || (!(itemScope.data instanceof cls) && !(itemScope.wrapped instanceof cls))) {
197
+ if (itemScope.wrapped)
198
+ itemScope.unwrap();
199
+ itemScope.wrap(obj, true, true);
200
+ }
177
201
 
178
- tag.scope.set(this.listItemName, tag.scope);
202
+ tag.scope.set(this.listItemName, itemScope);
203
+ tag.meta[List.MetaItemSetupFlag] = true;
179
204
  }
180
205
  }
@@ -20,7 +20,7 @@ export class ListItem extends Attribute {
20
20
  throw Error(ListItem.ERROR_NO_PARENT);
21
21
 
22
22
  const listAttr = await this.getListAttribute();
23
- await listAttr.setupTag(this.tag, {});
23
+ await listAttr.setupTagScope(this.tag, {});
24
24
  await super.setup();
25
25
  }
26
26
 
@@ -20,17 +20,21 @@ export class ScopeAttribute extends Attribute {
20
20
 
21
21
  public async extract() {
22
22
  if (this.tree) {
23
- const value = await this.tree.evaluate(this.tag.scope, this.tag.dom, this.tag);
24
- if (!(value instanceof Scope)) {
25
- throw new Error(`vsn-scope value must be an object, got ${typeof value}`);
23
+ const binding = this.getAttributeBinding();
24
+
25
+ const scope = await this.tree.evaluate(this.tag.scope, this.tag.dom, this.tag);
26
+ if (!(scope instanceof Scope)) {
27
+ throw new Error(`vsn-scope value must be an object, got ${typeof scope}`);
26
28
  }
27
- for (const key of value.data.keys) {
28
- this.tag.scope.set(key, value.data[key]);
29
+
30
+ if (binding) {
31
+ this.tag.scope.set(binding, scope);
32
+ } else {
33
+ for (const key of scope.data.keys) {
34
+ this.tag.scope.set(key, scope.data[key]);
35
+ }
29
36
  }
30
37
  }
31
- const binding = this.getAttributeBinding();
32
- if (binding)
33
- this.tag.scope.parentScope.set(binding, this.tag.scope);
34
38
  await super.extract();
35
39
  }
36
40
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.1.96';
1
+ export const VERSION = '0.1.99';
2
2
 
@@ -1,7 +1,7 @@
1
1
  import {DOM} from "../../src/DOM";
2
2
  import {ClassNode} from "../../src/AST/ClassNode";
3
3
  import {Registry} from "../../src/Registry";
4
- import {TagList} from "../../src/Tag/List";
4
+ import {TagList} from "../../src/Tag/TagList";
5
5
 
6
6
 
7
7
  describe('ClassNode', () => {
@@ -1,6 +1,6 @@
1
1
  import {DOM} from "../../src/DOM";
2
2
  import {Query} from "../../src/Query";
3
- import {TagList} from "../../src/Tag/List";
3
+ import {TagList} from "../../src/Tag/TagList";
4
4
  import {DOMObject} from "../../src/DOM/DOMObject";
5
5
 
6
6
  describe('TagList', () => {
@@ -72,7 +72,7 @@ describe('ListItem', () => {
72
72
  list.on('add', () => {
73
73
  const listItem = listAttr.tags[0];
74
74
 
75
- expect(listItem.scope.data instanceof ListItemSpecTestItem).toBeTrue();
75
+ expect(listItem.scope.get('item').data instanceof ListItemSpecTestItem).toBeTrue();
76
76
  expect(controller.items.length).toBe(1);
77
77
  expect(controller.items[0] instanceof ListItemSpecTestItem).toBeTrue();
78
78
 
@@ -95,7 +95,7 @@ describe('ListItem', () => {
95
95
  const dom = new DOM(document);
96
96
  dom.once('built', async () => {
97
97
  const listItem = await dom.getTagForElement(document.getElementById('test-item'));
98
- expect(listItem.scope.get('testing')).toBe(1);
98
+ expect(listItem.scope.get('item').get('testing')).toBe(1);
99
99
  done();
100
100
  });
101
101
  });
@@ -107,7 +107,6 @@ describe('ListItem', () => {
107
107
  </ul>
108
108
  `;
109
109
 
110
- console.log('################# building dom');
111
110
  const dom = new DOM(document);
112
111
  dom.once('built', async () => {
113
112
  const listItem = await dom.getTagForElement(document.getElementById('test-item'));
@@ -1 +0,0 @@
1
- {"version":3,"file":"List.js","sourceRoot":"","sources":["../../src/Tag/List.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,wDAAqD;AAIrD;IAA6B,2BAAgB;IACzC;QAAY,eAAqB;aAArB,UAAqB,EAArB,qBAAqB,EAArB,IAAqB;YAArB,0BAAqB;;QAAjC,+BACa,KAAK,UAEjB;QADG,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;;IACnD,CAAC;IAED,sBAAI,0BAAK;aAAT;YACI,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QACxB,CAAC;;;OAAA;IAED,sBAAI,6BAAQ;aAAZ;YACI,OAAO,IAAI,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,OAAO,EAAT,CAAS,CAAC,CAAC;QACpC,CAAC;;;OAAA;IAED,sBAAI,0BAAK;aAAT;YACI,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;;;OAAA;IAED,sBAAI,yBAAI;aAAR;YACI,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjC,CAAC;;;OAAA;IAED,qBAAG,GAAH,UAAI,KAAa;QACb,IAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAhB,CAAgB,CAAC,CAAC;QACjD,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IAED,6BAAW,GAAX,UAAY,SAAS;QACjB,IAAI,CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,EAArC,CAAqC,CAAC,CAAA;QACxD,OAAO,IAAI,CAAA;IACf,CAAC;IAED,0BAAQ,GAAR,UAAS,SAAS;QACd,IAAI,CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAlC,CAAkC,CAAC,CAAA;QACrD,OAAO,IAAI,CAAA;IACf,CAAC;IAED,qBAAG,GAAH,UAAI,QAAQ,EAAE,KAAK;QACf,IAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,UAAA,CAAC;YAC5C,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAA;QAC3C,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,EAApC,CAAoC,CAAC,CAAA;QACvD,OAAO,IAAI,CAAA;IACf,CAAC;IACL,cAAC;AAAD,CAAC,AA5CD,CAA6B,KAAK,GA4CjC;AA5CY,0BAAO;AA8CpB,IAAI,2BAAY,CAAC,aAAa,IAAI,2BAAY,CAAC,MAAM;IACjD,MAAM,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC"}