From 54c8c571e064fd4e8263e794c6a81e8a401039b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Asiel=20Guevara=20Casta=C3=B1eda?= Date: Tue, 9 Oct 2018 12:30:31 -0400 Subject: [PATCH] Bump to version 0.2.3 --- CHANGELOG.md | 4 ++++ package-lock.json | 2 +- package.json | 2 +- spec/components/bind.umd.js | 30 +++++++++++++++++------------- spec/components/condition.umd.js | 2 +- spec/components/html.umd.js | 6 +++--- spec/components/init.umd.js | 2 +- spec/components/loop.umd.js | 6 +++--- 8 files changed, 31 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4401e6..3f42e94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +0.2.3 +- Added ability to add or remove boolean attributes. +- Fixed some bugs on context assignment with Sequence and Assignment expressions. + 0.2.2 - Added Sequence expression to context generation. - Fixed missing attributes generating elements in slots. diff --git a/package-lock.json b/package-lock.json index 2928845..cc5a254 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "trebor", - "version": "0.2.2", + "version": "0.2.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6efec12..ac71aad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "trebor", - "version": "0.2.2", + "version": "0.2.3", "description": "A node js module to make standalone web components.", "main": "./build/index.js", "bin": { diff --git a/spec/components/bind.umd.js b/spec/components/bind.umd.js index 8d94acb..6e0422c 100644 --- a/spec/components/bind.umd.js +++ b/spec/components/bind.umd.js @@ -125,7 +125,7 @@ function _$CompCtr(attrs, template, options, parent) { for (var key in data) { _loop_1(key); } - var tpl = template(self, opts.children); + var tpl = template(self); _$e(tpl, function(value, key) { _$def(self, key, { value: function(key) { @@ -456,8 +456,8 @@ function _$a(parent, child, sibling) { function _$ce(tagName) { return document.createElement(tagName || 'div'); } -function _$sa(el, attrOrBind) { - var attr = attrOrBind[0], value = attrOrBind[1]; +function _$sa(el, attrAndValue) { + var attr = attrAndValue[0], value = attrAndValue[1]; el.setAttribute(attr, _$toStr(value)); if (_$isValueAttr(attr) && !_$isStr(value)) el[PROP_MAP._] = value; @@ -474,6 +474,10 @@ function _$al(el, event, handler) { function _$rl(el, event, handler) { el.removeEventListener(event, handler, false); } +function _$bba(el, attrAndValue) { + var _a = attrAndValue.concat([el.hasAttribute(attrAndValue[0])]), attr = _a[0], value = _a[1], hasAttr = _a[2]; + value == null || value === false ? hasAttr && el.removeAttribute(attr) : _$sa(el, [attr, '']); +} function _$bu(el, binding) { var attr = binding[0], value = binding[1]; var _value = attr === 'checked' ? !!value : _$toStr(value); @@ -548,35 +552,35 @@ function _$tplBind(_$state) { _$al(input_2, 'change', handlerChangeEvent_1 = function(event) { changeEvent_1(_$state, event, input_2); }); - input_2.checked = !!bindCheckedInput_2(_$state)[1]; + _$bba(input_2, bindCheckedInput_2(_$state)); _$sa(input_2, ['id', 'checkbox_1']); _$sa(input_2, ['type', 'checkbox']); _$sa(input_2, ['value', 'Yes']); _$al(input_3, 'change', handlerChangeEvent_2 = function(event) { changeEvent_2(_$state, event, input_3); }); - input_3.checked = !!bindCheckedInput_3(_$state)[1]; + _$bba(input_3, bindCheckedInput_3(_$state)); _$sa(input_3, ['id', 'checkbox_2']); _$sa(input_3, ['type', 'checkbox']); _$sa(input_3, ['value', 'No']); _$al(input_4, 'change', handlerChangeEvent_3 = function(event) { changeEvent_3(_$state, event, input_4); }); - input_4.checked = !!bindCheckedInput_4(_$state)[1]; + _$bba(input_4, bindCheckedInput_4(_$state)); _$sa(input_4, ['id', 'radio_1']); _$sa(input_4, ['type', 'radio']); _$sa(input_4, ['value', 'radio 1']); _$al(input_5, 'change', handlerChangeEvent_4 = function(event) { changeEvent_4(_$state, event, input_5); }); - input_5.checked = !!bindCheckedInput_5(_$state)[1]; + _$bba(input_5, bindCheckedInput_5(_$state)); _$sa(input_5, ['id', 'radio_2']); _$sa(input_5, ['type', 'radio']); _$sa(input_5, ['value', 'radio 2']); _$al(input_6, 'change', handlerChangeEvent_5 = function(event) { changeEvent_5(_$state, event, input_6); }); - input_6.checked = !!bindCheckedInput_6(_$state)[1]; + _$bba(input_6, bindCheckedInput_6(_$state)); _$sa(input_6, ['id', 'radio_3']); _$sa(input_6, ['type', 'radio']); _$sa(input_6, ['value', 'radio 3']); @@ -591,11 +595,11 @@ function _$tplBind(_$state) { $update: function(_$state) { _$bu(input_1, bindValueInput_1(_$state)); - _$bu(input_2, bindCheckedInput_2(_$state)); - _$bu(input_3, bindCheckedInput_3(_$state)); - _$bu(input_4, bindCheckedInput_4(_$state)); - _$bu(input_5, bindCheckedInput_5(_$state)); - _$bu(input_6, bindCheckedInput_6(_$state)); + _$bba(input_2, bindCheckedInput_2(_$state)); + _$bba(input_3, bindCheckedInput_3(_$state)); + _$bba(input_4, bindCheckedInput_4(_$state)); + _$bba(input_5, bindCheckedInput_5(_$state)); + _$bba(input_6, bindCheckedInput_6(_$state)); }, $unmount: function() { diff --git a/spec/components/condition.umd.js b/spec/components/condition.umd.js index 88a7dfc..2dc8c2f 100644 --- a/spec/components/condition.umd.js +++ b/spec/components/condition.umd.js @@ -125,7 +125,7 @@ function _$CompCtr(attrs, template, options, parent) { for (var key in data) { _loop_1(key); } - var tpl = template(self, opts.children); + var tpl = template(self); _$e(tpl, function(value, key) { _$def(self, key, { value: function(key) { diff --git a/spec/components/html.umd.js b/spec/components/html.umd.js index b6d1885..7a6abe1 100644 --- a/spec/components/html.umd.js +++ b/spec/components/html.umd.js @@ -125,7 +125,7 @@ function _$CompCtr(attrs, template, options, parent) { for (var key in data) { _loop_1(key); } - var tpl = template(self, opts.children); + var tpl = template(self); _$e(tpl, function(value, key) { _$def(self, key, { value: function(key) { @@ -469,8 +469,8 @@ function _$ce(tagName) { function _$ct(content) { return document.createTextNode(content || ''); } -function _$sa(el, attrOrBind) { - var attr = attrOrBind[0], value = attrOrBind[1]; +function _$sa(el, attrAndValue) { + var attr = attrAndValue[0], value = attrAndValue[1]; el.setAttribute(attr, _$toStr(value)); if (_$isValueAttr(attr) && !_$isStr(value)) el[PROP_MAP._] = value; diff --git a/spec/components/init.umd.js b/spec/components/init.umd.js index 5f2fcad..ecf8127 100644 --- a/spec/components/init.umd.js +++ b/spec/components/init.umd.js @@ -125,7 +125,7 @@ function _$CompCtr(attrs, template, options, parent) { for (var key in data) { _loop_1(key); } - var tpl = template(self, opts.children); + var tpl = template(self); _$e(tpl, function(value, key) { _$def(self, key, { value: function(key) { diff --git a/spec/components/loop.umd.js b/spec/components/loop.umd.js index 982710b..85f8974 100644 --- a/spec/components/loop.umd.js +++ b/spec/components/loop.umd.js @@ -125,7 +125,7 @@ function _$CompCtr(attrs, template, options, parent) { for (var key in data) { _loop_1(key); } - var tpl = template(self, opts.children); + var tpl = template(self); _$e(tpl, function(value, key) { _$def(self, key, { value: function(key) { @@ -454,8 +454,8 @@ function _$ce(tagName) { function _$ct(content) { return document.createTextNode(content || ''); } -function _$sa(el, attrOrBind) { - var attr = attrOrBind[0], value = attrOrBind[1]; +function _$sa(el, attrAndValue) { + var attr = attrAndValue[0], value = attrAndValue[1]; el.setAttribute(attr, _$toStr(value)); if (_$isValueAttr(attr) && !_$isStr(value)) el[PROP_MAP._] = value;