Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jeefo_component

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jeefo_component - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

126

collect_components.js
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
* File Name : collect_components.js
* Created at : 2017-08-10
* Updated at : 2017-08-30
* Updated at : 2017-08-31
* Author : jeefo

@@ -19,14 +19,6 @@ * Purpose :

sort_by_priority = function (a, b) {
return b.definition.priority - a.definition.priority;
},
combine_pairs = function (pairs, other) {
var keys = other.keys, i = keys.length;
while (i--) {
for (var i = 0, keys = other.keys; i < keys.length; ++i) {
pairs.set(keys[i], other.values[keys[i]]);
}
return pairs;
},

@@ -38,4 +30,2 @@

}
return class_list;
},

@@ -51,2 +41,22 @@

transcluder.transclude();
},
structural_directive = function (attrs) {
var keys = attrs.keys, i = keys.length, max_priority = 0,
definition, result;
while (i--) {
if (directives[keys[i]]) {
definition = cache.resolve_directive(keys[i]);
if (definition.priority > max_priority) {
result = { name : keys[i], definition : definition };
}
}
}
if (result) {
attrs.remove(result.name);
}
return result;
};

@@ -58,3 +68,3 @@

if (! template) {
return;
return node;
}

@@ -65,36 +75,58 @@ }

if (! node.id) {
node.id = other.id;
}
// Reason why other's property first is, we want keep other's order
node.attrs = combine_pairs(other.attrs, node.attrs);
node.events = combine_pairs(other.events, node.events);
node.class_list = combine_classes(other.class_list, node.class_list.list);
combine_pairs(other.attrs, node.attrs);
combine_pairs(other.events, node.events);
combine_classes(other.class_list, node.class_list.list);
if (other.children.length) {
transclude(other.children, node.children);
node.children = other.children;
}
return other;
};
collect_components = function (nodes, container, parent, counter) {
var i = 0, component = new Component(parent), j, keys, attrs, _parent, directive;
var i = 0, component = new Component(parent),
j, keys, name, attrs, other, _parent, directive;
for (; i < nodes.length; ++i) {
attrs = nodes[i].attrs;
name = nodes[i].name;
_parent = parent;
if (components[nodes[i].name]) {
component.name = nodes[i].name;
component.definition = cache.resolve_component(component.name);
nodes[i].name = "div";
// Structural directive
directive = structural_directive(nodes[i].attrs);
if (directive) {
counter.increment();
if (component.definition.template) {
combine_template(component.definition.template, nodes[i]);
component.id = nodes[i].component_id = counter.id;
component.attrs = nodes[i].attrs;
component.node = nodes[i].clone();
component.name = directive.name;
component.definition = directive.definition;
nodes[i].clear();
container.push(component);
component = new Component(parent);
continue;
}
// Component
if (components[name]) {
component.name = name;
component.definition = cache.resolve_component(name);
other = combine_template(component.definition.template || "div", nodes[i]);
if (other.children.length) {
transclude(other.children, nodes[i].children);
} else {
other.children = nodes[i].children;
}
nodes[i] = other;
}
keys = attrs.keys;
j = keys.length;
// Normal directives
attrs = nodes[i].attrs;
keys = attrs.keys;
j = keys.length;
while (j--) {

@@ -105,2 +137,4 @@ if (directives[keys[j]]) {

);
attrs.remove(keys[i]);
}

@@ -112,24 +146,6 @@ }

component.id = nodes[i].component_id = counter.id;
component.attrs = attrs;
component.id = nodes[i].component_id = counter.id;
component.attrs = attrs;
component.events = nodes[i].events;
component.directives.sort(sort_by_priority);
directive = component.directives[0];
if (directive && directive.definition.priority) {
attrs.remove(directive.name);
component.node = nodes[i].clone();
component.name = directive.name;
component.definition = directive.definition;
component.directives = [];
nodes[i].clear();
} else {
j = component.directives.length;
while (j--) {
attrs.remove(component.directives[j].name);
}
component.events = nodes[i].events;
}
_parent = component;

@@ -136,0 +152,0 @@ container.push(component);

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
* File Name : element.js
* Created at : 2017-08-26
* Updated at : 2017-08-26
* Updated at : 2017-08-31
* Author : jeefo

@@ -59,7 +59,7 @@ * Purpose :

node = new NodeElement({ name : name });
build_nodes(node, $old_element[0]);
node = [ new NodeElement({ name : name }) ];
build_nodes(node[0], $old_element[0]);
collect_components([node], container, parent, counter);
node = jqlite(node.compile('', ''))[0];
collect_components(node, container, parent, counter);
node = jqlite(node[0].compile('', ''))[0];

@@ -66,0 +66,0 @@ $old_element.replace_with(node);

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
* File Name : component.js
* Created at : 2017-07-24
* Updated at : 2017-08-26
* Updated at : 2017-08-31
* Author : jeefo

@@ -68,32 +68,30 @@ * Purpose : Make possible to create a self contained web component.

compile_self = function (component) {
if (! component.name) { return component; }
if (! component.name) {
return $q.when(component);
}
// jshint latedef : false
return $q.when(component).
then(function (component) {
/*
var $attrs = new Attributes(component.element),
template = get_template(component.definition.template, component.element, $attrs);
/*
var $attrs = new Attributes(component.element),
template = get_template(component.definition.template, component.element, $attrs);
if (template) {
return compile_template(component, template, $attrs);
}
if (template) {
return compile_template(component, template, $attrs);
}
var template_url = get_template(component.definition.template_url, component.element, $attrs);
if (template_url) {
return $resource.get_text(template_url).then(function (template) {
return compile_template(component, template, $attrs);
});
}
var template_url = get_template(component.definition.template_url, component.element, $attrs);
if (template_url) {
return $resource.get_text(template_url).then(function (template) {
return compile_template(component, template, $attrs);
});
}
return compile_template(component, "<div></div>", $attrs);
*/
return component;
}).
then(function (component) {
component.$element = jqlite(component.element);
constructor(component, component);
return compile_template(component, "<div></div>", $attrs);
*/
return component;
});
return $q.when(component).then(function (component) {
component.$element = jqlite(component.element);
constructor(component, component);
return component;
});
},

@@ -133,7 +131,4 @@

// Link {{{1
link = function (component) {
return;
if (self.is_terminated || ! self.definition) { return self; }
if (self.definition.link) {
link = function (self) {
if (self.definition && self.definition.link) {
var args = [], dependencies = self.definition.link.dependencies, i = dependencies.length;

@@ -223,4 +218,3 @@

return $q.when(this).
then(compile_self).
return compile_self(this).
then(compile_post).

@@ -227,0 +221,0 @@ then(listen_events).

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
* File Name : for_each_directive.js
* Created at : 2017-07-25
* Updated at : 2017-08-28
* Updated at : 2017-08-31
* Author : jeefo

@@ -84,3 +84,3 @@ * Purpose :

while (i--) {
removed_components[i].remove();
removed_components[i].children[0].remove();
}

@@ -101,4 +101,4 @@

var fragment = compile_nodes([node], component);
component.$element = jqlite(fragment.firstChild);
compile_nodes([node], component);
component.$element = component.children[0].$element;

@@ -105,0 +105,0 @@ this.$component.children[index] = component;

{
"name": "jeefo_component",
"version": "0.0.3",
"version": "0.0.4",
"description": "Part of jeefo framework",

@@ -5,0 +5,0 @@ "author": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc