vsn 0.1.94 → 0.1.95
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.
- package/demo/vsn.js +2 -2
- package/dist/AST/ClassNode.js +5 -1
- package/dist/AST/ClassNode.js.map +1 -1
- package/dist/DOM.d.ts +1 -0
- package/dist/DOM.js +106 -93
- package/dist/DOM.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/vsn.min.js +3 -0
- package/dist/vsn.min.js.LICENSE.txt +9 -0
- package/package.json +1 -1
- package/src/AST/ClassNode.ts +6 -1
- package/src/DOM.ts +31 -27
- package/src/version.ts +1 -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
package/src/AST/ClassNode.ts
CHANGED
|
@@ -226,8 +226,13 @@ export class ClassNode extends Node implements TreeNode {
|
|
|
226
226
|
tag = await dom.getTagForElement(element, true);
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
if (!tag) {
|
|
230
|
+
console.error('no tag found for element', element);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
229
234
|
const classNode: ClassNode = Registry.instance.classes.getSynchronous(selector);
|
|
230
|
-
if (classNode
|
|
235
|
+
if (classNode) {
|
|
231
236
|
await classNode.constructTag(tag, dom);
|
|
232
237
|
}
|
|
233
238
|
|
package/src/DOM.ts
CHANGED
|
@@ -223,47 +223,29 @@ export class DOM extends EventDispatcher {
|
|
|
223
223
|
return tag;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
async
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
document.ondragover = (e) => e.cancelable && e.preventDefault(); // Allow dragging over document
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
// Create tags for each html element with a vsn-attribute
|
|
233
|
-
const newTags: Tag[] = [];
|
|
234
|
-
const toBuild: HTMLElement[] = await this.discover(ele, forComponent);
|
|
235
|
-
|
|
236
|
-
for (const element of toBuild) {
|
|
237
|
-
const tag = await this.buildTag(element);
|
|
238
|
-
if (tag)
|
|
239
|
-
newTags.push(tag);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (isRoot)
|
|
243
|
-
this._root = await this.getTagForElement(document.body);
|
|
244
|
-
|
|
245
|
-
// Configure, setup & execute attributes
|
|
246
|
-
for (const tag of newTags)
|
|
226
|
+
async setupTags(tags: Tag[]) {
|
|
227
|
+
// Configure, setup & execute attributes
|
|
228
|
+
for (const tag of tags)
|
|
247
229
|
await tag.buildAttributes();
|
|
248
230
|
|
|
249
|
-
for (const tag of
|
|
231
|
+
for (const tag of tags)
|
|
250
232
|
await tag.compileAttributes();
|
|
251
233
|
|
|
252
|
-
for (const tag of
|
|
234
|
+
for (const tag of tags)
|
|
253
235
|
await tag.setupAttributes();
|
|
254
236
|
|
|
255
|
-
for (const tag of
|
|
237
|
+
for (const tag of tags)
|
|
256
238
|
await tag.extractAttributes();
|
|
257
239
|
|
|
258
|
-
for (const tag of
|
|
240
|
+
for (const tag of tags)
|
|
259
241
|
await tag.connectAttributes();
|
|
260
242
|
|
|
261
|
-
for (const tag of
|
|
243
|
+
for (const tag of tags) {
|
|
262
244
|
await tag.finalize();
|
|
263
245
|
this.queued.splice(this.queued.indexOf(tag.element), 1);
|
|
264
246
|
}
|
|
265
247
|
|
|
266
|
-
for (const tag of
|
|
248
|
+
for (const tag of tags) {
|
|
267
249
|
this.observer.observe(tag.element, {
|
|
268
250
|
attributes: true,
|
|
269
251
|
characterData: true,
|
|
@@ -271,6 +253,28 @@ export class DOM extends EventDispatcher {
|
|
|
271
253
|
subtree: true
|
|
272
254
|
});
|
|
273
255
|
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
async buildFrom(ele: any, isRoot: boolean = false, forComponent: boolean = false) {
|
|
259
|
+
if (isRoot) {
|
|
260
|
+
document.body.setAttribute('vsn-root', '');
|
|
261
|
+
document.ondragover = (e) => e.cancelable && e.preventDefault(); // Allow dragging over document
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Create tags for each html element with a vsn-attribute
|
|
265
|
+
const newTags: Tag[] = [];
|
|
266
|
+
const toBuild: HTMLElement[] = await this.discover(ele, forComponent);
|
|
267
|
+
|
|
268
|
+
for (const element of toBuild) {
|
|
269
|
+
const tag = await this.buildTag(element);
|
|
270
|
+
if (tag)
|
|
271
|
+
newTags.push(tag);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (isRoot)
|
|
275
|
+
this._root = await this.getTagForElement(document.body);
|
|
276
|
+
|
|
277
|
+
await this.setupTags(newTags);
|
|
274
278
|
|
|
275
279
|
if (isRoot) {
|
|
276
280
|
this._built = true;
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.95';
|
|
2
2
|
|