Navigation Menu

Skip to content

Commit

Permalink
Bump version and rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
somebee committed Mar 7, 2018
1 parent 0455ca2 commit 7aef66d
Show file tree
Hide file tree
Showing 15 changed files with 176 additions and 96 deletions.
5 changes: 5 additions & 0 deletions changelog.md
@@ -1,3 +1,8 @@
## 1.3.3
* Don't silence input events for form elements
* Implement style.removeProperty on server
* Improve mount/unmount performance

## 1.3.2
* Fix webpack4 compatibility
* Improve svg support
Expand Down
37 changes: 19 additions & 18 deletions imba.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions imbac.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions lib/compiler/nodes.js
Expand Up @@ -505,12 +505,18 @@ Stack.prototype.env = function (key){
var val = this._options[("ENV_" + key)];
if (val != undefined) { return val };

var lowercased = key.toLowerCase();

if (this._options[lowercased] != undefined) {
return this._options[lowercased];
};

// temporary shorthand
if (key.toLowerCase() == 'es6') {
if (lowercased == 'es6') {
return this.es6();
};

if (key.toLowerCase() == 'es5') {
if (lowercased == 'es5') {
return this.es5();
};

Expand Down Expand Up @@ -3288,6 +3294,7 @@ TagLoopFunc.prototype.capture = function (node){
};

TagLoopFunc.prototype.js = function (o){
this._name = 'tagLoop';
var out = TagLoopFunc.__super__.js.apply(this,arguments);
return "(" + out + (")(" + cary__(this._args) + ")");
};
Expand Down
1 change: 1 addition & 0 deletions lib/imba/dom/event-manager.js
Expand Up @@ -138,6 +138,7 @@ Imba.EventManager.activate = function (){
Imba.Events.register(['mousedown','mouseup']);
Imba.Events.register(initialBind);
Imba.Events.setEnabled(true);

return Imba.Events;
};

Expand Down
21 changes: 16 additions & 5 deletions lib/imba/dom/html.js
Expand Up @@ -71,6 +71,17 @@ Imba.extendTag('input', function(tag){
return this;
};

tag.prototype.checked = function (){
return this._dom.checked;
};

tag.prototype.setChecked = function (value){
if (!!value != this._dom.checked) {
this._dom.checked = !!value;
};
return this;
};

tag.prototype.setValue = function (value){
if (this._localValue == undefined) {
this.dom().value = this._value = value;
Expand All @@ -81,12 +92,12 @@ Imba.extendTag('input', function(tag){
tag.prototype.oninput = function (e){
var val = this._dom.value;
this._localValue = val;
return (this._data && !(this.lazy())) ? this._data.setFormValue(this.value(),this) : e.silence();
if (this._data && !(this.lazy())) { return this._data.setFormValue(this.value(),this) };
};

tag.prototype.onchange = function (e){
this._modelValue = this._localValue = undefined;
if (!(this.data())) { return e.silence() };
if (!(this.data())) { return };

if (this.type() == 'radio' || this.type() == 'checkbox') {
var checked = this._dom.checked;
Expand Down Expand Up @@ -161,12 +172,12 @@ Imba.extendTag('textarea', function(tag){
tag.prototype.oninput = function (e){
var val = this._dom.value;
this._localValue = val;
return (this._data && !(this.lazy())) ? this._data.setFormValue(this.value(),this) : e.silence();
if (this._data && !(this.lazy())) { return this._data.setFormValue(this.value(),this) };
};

tag.prototype.onchange = function (e){
this._localValue = undefined;
return this._data ? this._data.setFormValue(this.value(),this) : e.silence();
if (this._data) { return this._data.setFormValue(this.value(),this) };
};

tag.prototype.onblur = function (e){
Expand Down Expand Up @@ -256,7 +267,7 @@ Imba.extendTag('select', function(tag){
};

tag.prototype.onchange = function (e){
return this._data ? this._data.setFormValue(this.value(),this) : e.silence();
if (this._data) { return this._data.setFormValue(this.value(),this) };
};

tag.prototype.end = function (){
Expand Down
29 changes: 21 additions & 8 deletions lib/imba/dom/manager.js
Expand Up @@ -5,7 +5,8 @@ Imba.TagManagerClass = function TagManagerClass(){
this._inserts = 0;
this._removes = 0;
this._mounted = [];
this._hasMountables = false;
this._mountables = 0;
this._unmountables = 0;
this;
};

Expand All @@ -16,7 +17,10 @@ Imba.TagManagerClass.prototype.mounted = function (){
Imba.TagManagerClass.prototype.insert = function (node,parent){
this._inserts++;
if (node && node.mount) {
this._hasMountables = true;
if (!(node.FLAGS & Imba.TAG_MOUNTABLE)) {
node.FLAGS |= Imba.TAG_MOUNTABLE;
this._mountables++;
};
};
return;
};
Expand All @@ -25,21 +29,21 @@ Imba.TagManagerClass.prototype.remove = function (node,parent){
return this._removes++;
};


Imba.TagManagerClass.prototype.changes = function (){
return this._inserts + this._removes;
};

Imba.TagManagerClass.prototype.mount = function (node){
if (true) { return };
return this._hasMountables = true;
return;
};

Imba.TagManagerClass.prototype.refresh = function (force){
if(force === undefined) force = false;
if (true) { return };
if (!force && this.changes() == 0) { return };
// console.time('resolveMounts')
if ((this._inserts && this._hasMountables) || force) {
if ((this._inserts && this._mountables > this._mounted.length) || force) {
this.tryMount();
};

Expand Down Expand Up @@ -73,9 +77,18 @@ Imba.TagManagerClass.prototype.tryMount = function (){
};

Imba.TagManagerClass.prototype.mountNode = function (node){
this._mounted.push(node);
node.FLAGS |= Imba.TAG_MOUNTED;
if (node.mount) { node.mount() };
if (this._mounted.indexOf(node) == -1) {
this._mounted.push(node);
node.FLAGS |= Imba.TAG_MOUNTED;
if (node.mount) { node.mount() };
// Mark all parents as mountable for faster unmount
var el = node.dom().parentNode;
while (el && el._tag && !el._tag.mount && !(el._tag.FLAGS & Imba.TAG_MOUNTABLE)){
el._tag.FLAGS |= Imba.TAG_MOUNTABLE;
el = el.parentNode;
};
};

return;
};

Expand Down
9 changes: 6 additions & 3 deletions lib/imba/dom/reconciler.js
Expand Up @@ -406,7 +406,7 @@ Imba.extendTag('element', function(tag){
// return self.text = new
var old = this._tree_;

if (new$ === old && new$ && new$.taglen == undefined) {
if (new$ === old && (!(new$) || new$.taglen == undefined)) {
return this;
};

Expand All @@ -423,6 +423,10 @@ Imba.extendTag('element', function(tag){
} else if (typ == 3) {
var ntyp = typeof new$;

if (ntyp != 'object') {
return this.setText(new$);
};

if (new$ && new$._dom) {
this.removeAllChildren();
this.appendChild(new$);
Expand All @@ -436,8 +440,7 @@ Imba.extendTag('element', function(tag){
appendNested(this,new$);
};
} else {
this.setText(new$);
return this;
return this.setText(new$);
};
} else if (typ == 4) {
reconcileIndexedArray(this,new$,old,null);
Expand Down
5 changes: 5 additions & 0 deletions lib/imba/dom/server.js
Expand Up @@ -120,6 +120,11 @@ function CSSStyleDeclaration(dom){
this;
};

CSSStyleDeclaration.prototype.removeProperty = function (key){
var v_;
return (((v_ = this[key]),delete this[key], v_));
};

CSSStyleDeclaration.prototype.toString = function (){
var items = [];
for (var o = this, v, i = 0, keys = Object.keys(o), l = keys.length, k; i < l; i++){
Expand Down
12 changes: 7 additions & 5 deletions lib/imba/dom/tag.js
Expand Up @@ -9,6 +9,7 @@ Imba.TAG_MOUNTING = 4;
Imba.TAG_MOUNTED = 8;
Imba.TAG_SCHEDULED = 16;
Imba.TAG_AWAKENED = 32;
Imba.TAG_MOUNTABLE = 64;

/*
Get the current document
Expand Down Expand Up @@ -410,8 +411,8 @@ Imba.Tag.prototype.removeChild = function (child){
var par = this.dom();
var el = child._slot_ || child;
if (el && el.parentNode == par) {
par.removeChild(el);
Imba.TagManager.remove(el._tag || el,this);
par.removeChild(el);
};
return this;
};
Expand All @@ -422,10 +423,11 @@ Imba.Tag.prototype.removeChild = function (child){

Imba.Tag.prototype.removeAllChildren = function (){
if (this._dom.firstChild) {
while (this._dom.firstChild){
this._dom.removeChild(this._dom.firstChild);
var el;
while (el = this._dom.firstChild){
false && Imba.TagManager.remove(el._tag || el,this);
this._dom.removeChild(el);
};
Imba.TagManager.remove(null,this);
};
this._tree_ = this._text_ = null;
return this;
Expand Down Expand Up @@ -473,7 +475,7 @@ Imba.Tag.prototype.detachFromParent = function (){
this._slot_._tag || (this._slot_._tag = this);

if (this._dom.parentNode) {
Imba.TagManager.remove(this);
Imba.TagManager.remove(this,this._dom.parentNode);
this._dom.parentNode.replaceChild(this._slot_,this._dom);
};
};
Expand Down
2 changes: 1 addition & 1 deletion lib/imba/imba.js
Expand Up @@ -3,7 +3,7 @@ Imba is the namespace for all runtime related utilities
@namespace
*/

var Imba = {VERSION: '1.3.2'};
var Imba = {VERSION: '1.3.3'};

/*
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -44,7 +44,7 @@
"test-chrome": "bin/imba test/run-chrome.imba"
},
"bugs": "https://github.com/somebee/imba/issues",
"version": "1.3.2",
"version": "1.3.3",
"licenses": [
{
"type": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/imba/imba.imba
Expand Up @@ -2,7 +2,7 @@
Imba is the namespace for all runtime related utilities
@namespace
###
var Imba = {VERSION: '1.3.2'}
var Imba = {VERSION: '1.3.3'}

###
Expand Down

0 comments on commit 7aef66d

Please sign in to comment.