jeefo_component
Advanced tools
Comparing version 0.0.9 to 0.0.10
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. | ||
* File Name : binder.js | ||
* Created at : 2017-09-06 | ||
* Updated at : 2017-09-13 | ||
* Updated at : 2017-09-17 | ||
* Author : jeefo | ||
@@ -45,4 +45,7 @@ * Purpose : | ||
module.exports = function binder (component, controller, bindings) { | ||
var attrs = component.attrs; | ||
module.exports = function binder (component, instance) { | ||
var attrs = component.attrs, | ||
bindings = instance.definition.bindings, | ||
controller = instance.controller, | ||
change_detectors = instance.change_detectors; | ||
@@ -62,5 +65,27 @@ object_keys(bindings).forEach(function (prop) { | ||
controller[prop] = value.replace(PLACEHOLDER_REGEX, function (sub, param) { | ||
var $parser = parser(component, param.trim()); | ||
param = param.trim(); | ||
var $parser = parser(component, param), | ||
_value = $parser.get(); | ||
return $parser.get(); | ||
change_detectors.push({ | ||
value : _value, | ||
$parser : $parser, | ||
is_changed : function () { | ||
var _value = this.$parser.get(); | ||
if (this.value !== _value) { | ||
controller[prop] = value.replace(PLACEHOLDER_REGEX, function (_sub, _param) { | ||
_param = _param.trim(); | ||
if (param === _param) { | ||
return _value; | ||
} | ||
return _param; | ||
}); | ||
this.value = _value; | ||
return true; | ||
} | ||
} | ||
}); | ||
return _value; | ||
}); | ||
@@ -77,6 +102,6 @@ } else { | ||
case '=' : | ||
component.change_detectors.push(bind_two_way($parser, controller, prop)); | ||
change_detectors.push(bind_two_way($parser, controller, prop)); | ||
break; | ||
case '<' : | ||
component.change_detectors.push(bind_one_way($parser, controller, prop)); | ||
change_detectors.push(bind_one_way($parser, controller, prop)); | ||
break; | ||
@@ -83,0 +108,0 @@ case '!' : |
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. | ||
* File Name : component.js | ||
* Created at : 2017-07-24 | ||
* Updated at : 2017-08-31 | ||
* Updated at : 2017-09-19 | ||
* Author : jeefo | ||
@@ -92,3 +92,3 @@ * Purpose : Make possible to create a self contained web component. | ||
component.$element = jqlite(component.element); | ||
constructor(component, component); | ||
constructor(component, component, true); | ||
@@ -124,3 +124,3 @@ return component; | ||
while (i--) { | ||
$element.on(names[i], parser(component, events.values[names[i]]).getter()); | ||
$element.on(names[i], parser(component, events.values[names[i]]).get()); | ||
} | ||
@@ -127,0 +127,0 @@ |
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. | ||
* File Name : constructor.js | ||
* Created at : 2017-08-11 | ||
* Updated at : 2017-09-06 | ||
* Updated at : 2017-09-19 | ||
* Author : jeefo | ||
@@ -14,8 +14,13 @@ * Purpose : | ||
parser_wrapper = function (component) { | ||
return function (code) { | ||
var $parser = function (code) { | ||
return parser(component, code); | ||
}; | ||
$parser.find_controller = function (code) { | ||
return parser.find_controller(component, code); | ||
}; | ||
return $parser; | ||
}; | ||
module.exports = function (component, instance) { | ||
module.exports = function (component, instance, is_component) { | ||
var definition = instance.definition; | ||
@@ -29,3 +34,3 @@ if (! definition.controller) { | ||
if (definition.bindings) { | ||
binder(component, controller, definition.bindings); | ||
binder(component, instance); | ||
} | ||
@@ -46,3 +51,3 @@ | ||
case "$parser" : | ||
args[i] = parser_wrapper(component); | ||
args[i] = parser_wrapper(is_component ? component.parent : component); | ||
break; | ||
@@ -49,0 +54,0 @@ case "$component" : |
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. | ||
* File Name : directive.js | ||
* Created at : 2017-08-07 | ||
* Updated at : 2017-08-14 | ||
* Updated at : 2017-09-17 | ||
* Author : jeefo | ||
@@ -11,4 +11,5 @@ * Purpose : | ||
module.exports = function Directive (name, definition) { | ||
this.name = name; | ||
this.definition = definition; | ||
this.name = name; | ||
this.definition = definition; | ||
this.change_detectors = []; | ||
}; |
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. | ||
* File Name : index.js | ||
* Created at : 2017-08-08 | ||
* Updated at : 2017-08-24 | ||
* Updated at : 2017-09-17 | ||
* Author : jeefo | ||
@@ -13,3 +13,4 @@ * Purpose : | ||
*/ | ||
require("./jf_bind_directive"); | ||
require("./for_each_directive"); | ||
require("./directives/if_directive"); | ||
require("./directives/for_each_directive"); | ||
require("./directives/jf_bind_directive.js"); |
{ | ||
"name": "jeefo_component", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Part of jeefo framework", | ||
@@ -5,0 +5,0 @@ "author": { |
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. | ||
* File Name : parser.js | ||
* Created at : 2017-07-25 | ||
* Updated at : 2017-09-06 | ||
* Updated at : 2017-09-19 | ||
* Author : jeefo | ||
@@ -36,5 +36,5 @@ * Purpose : | ||
} | ||
}; | ||
}, | ||
module.exports = function parser (component, code) { | ||
parser = function (component, code) { | ||
var $parser = primitive(code); | ||
@@ -79,1 +79,5 @@ | ||
}; | ||
parser.find_controller = find_controller; | ||
module.exports = parser; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54484
31
1784