Many updates and improvements. For styles you can now combine two properties with a converter to get more custom styling updates. Cleaned up code and made a few things easier to use, also fixed a few bugs.

This commit is contained in:
2020-09-25 09:36:39 -07:00
parent 0fcb908941
commit 2d01b8fafb
3 changed files with 315 additions and 51 deletions

View File

@@ -115,24 +115,32 @@ class IgniteElement extends HTMLElement {
if (props != null) {
var keys = Object.keys(props);
for (var i = 0; i < keys.length; i++) {
let prop = new IgniteProperty(props[keys[i]]);
this[`_${keys[i]}`] = prop;
let propValue = props[keys[i]];
let propName = keys[i];
((propName) => {
Object.defineProperty(this, propName, {
get: function () {
if (IgniteRenderingContext.rendering == false) {
return this[`_${propName}`].value;
} else {
return this[`_${propName}`];
}
},
//Create a new property, if the propValue is a property, use that instead.
var prop = null;
if (propValue instanceof IgniteProperty) {
prop = propValue;
} else {
prop = new IgniteProperty(propValue);
}
set: function (value) {
this[`_${propName}`].value = value;
this[`_${propName}`] = prop;
Object.defineProperty(this, propName, {
get: () => {
if (IgniteRenderingContext.rendering == false) {
return this[`_${propName}`].value;
} else {
return this[`_${propName}`];
}
});
})(keys[i]);
},
set: (value) => {
this[`_${propName}`].value = value;
}
});
}
}
}