Skip to content

Commit f7424b1

Browse files
chore(all): prepare release 0.13.4
1 parent 82e6d13 commit f7424b1

File tree

8 files changed

+63
-30
lines changed

8 files changed

+63
-30
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aurelia-templating-resources",
3-
"version": "0.13.3",
3+
"version": "0.13.4",
44
"description": "A standard set of behaviors, converters and other resources for use with the Aurelia templating library.",
55
"keywords": [
66
"aurelia",

dist/amd/if.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,44 @@
1-
define(['exports', 'aurelia-templating', 'aurelia-dependency-injection'], function (exports, _aureliaTemplating, _aureliaDependencyInjection) {
1+
define(['exports', 'aurelia-templating', 'aurelia-dependency-injection', 'aurelia-task-queue'], function (exports, _aureliaTemplating, _aureliaDependencyInjection, _aureliaTaskQueue) {
22
'use strict';
33

44
exports.__esModule = true;
55

66
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
77

88
var If = (function () {
9-
function If(viewFactory, viewSlot) {
9+
function If(viewFactory, viewSlot, taskQueue) {
1010
_classCallCheck(this, _If);
1111

1212
this.viewFactory = viewFactory;
1313
this.viewSlot = viewSlot;
1414
this.showing = false;
15+
this.taskQueue = taskQueue;
1516
}
1617

1718
var _If = If;
1819

1920
_If.prototype.bind = function bind(executionContext) {
20-
this.executionContext = executionContext;
21+
this.$parent = executionContext;
2122
this.valueChanged(this.value);
2223
};
2324

2425
_If.prototype.valueChanged = function valueChanged(newValue) {
26+
var _this = this;
27+
2528
if (!newValue) {
2629
if (this.view && this.showing) {
27-
this.viewSlot.remove(this.view);
28-
this.view.unbind();
30+
this.taskQueue.queueMicroTask(function () {
31+
_this.viewSlot.remove(_this.view);
32+
_this.view.unbind();
33+
});
2934
}
3035

3136
this.showing = false;
3237
return;
3338
}
3439

3540
if (!this.view) {
36-
this.view = this.viewFactory.create(this.executionContext);
41+
this.view = this.viewFactory.create(this.$parent);
3742
}
3843

3944
if (!this.showing) {
@@ -47,7 +52,7 @@ define(['exports', 'aurelia-templating', 'aurelia-dependency-injection'], functi
4752
}
4853
};
4954

50-
If = _aureliaDependencyInjection.inject(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot)(If) || If;
55+
If = _aureliaDependencyInjection.inject(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot, _aureliaTaskQueue.TaskQueue)(If) || If;
5156
If = _aureliaTemplating.templateController(If) || If;
5257
If = _aureliaTemplating.customAttribute('if')(If) || If;
5358
return If;

dist/commonjs/if.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,42 @@ var _aureliaTemplating = require('aurelia-templating');
88

99
var _aureliaDependencyInjection = require('aurelia-dependency-injection');
1010

11+
var _aureliaTaskQueue = require('aurelia-task-queue');
12+
1113
var If = (function () {
12-
function If(viewFactory, viewSlot) {
14+
function If(viewFactory, viewSlot, taskQueue) {
1315
_classCallCheck(this, _If);
1416

1517
this.viewFactory = viewFactory;
1618
this.viewSlot = viewSlot;
1719
this.showing = false;
20+
this.taskQueue = taskQueue;
1821
}
1922

2023
var _If = If;
2124

2225
_If.prototype.bind = function bind(executionContext) {
23-
this.executionContext = executionContext;
26+
this.$parent = executionContext;
2427
this.valueChanged(this.value);
2528
};
2629

2730
_If.prototype.valueChanged = function valueChanged(newValue) {
31+
var _this = this;
32+
2833
if (!newValue) {
2934
if (this.view && this.showing) {
30-
this.viewSlot.remove(this.view);
31-
this.view.unbind();
35+
this.taskQueue.queueMicroTask(function () {
36+
_this.viewSlot.remove(_this.view);
37+
_this.view.unbind();
38+
});
3239
}
3340

3441
this.showing = false;
3542
return;
3643
}
3744

3845
if (!this.view) {
39-
this.view = this.viewFactory.create(this.executionContext);
46+
this.view = this.viewFactory.create(this.$parent);
4047
}
4148

4249
if (!this.showing) {
@@ -50,7 +57,7 @@ var If = (function () {
5057
}
5158
};
5259

53-
If = _aureliaDependencyInjection.inject(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot)(If) || If;
60+
If = _aureliaDependencyInjection.inject(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot, _aureliaTaskQueue.TaskQueue)(If) || If;
5461
If = _aureliaTemplating.templateController(If) || If;
5562
If = _aureliaTemplating.customAttribute('if')(If) || If;
5663
return If;

dist/es6/if.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {BoundViewFactory, ViewSlot, customAttribute, templateController} from 'aurelia-templating';
22
import {inject} from 'aurelia-dependency-injection';
3+
import {TaskQueue} from 'aurelia-task-queue';
34

45
/**
56
* Binding to conditionally include or not include template logic depending on returned result
@@ -12,33 +13,36 @@ import {inject} from 'aurelia-dependency-injection';
1213
*/
1314
@customAttribute('if')
1415
@templateController
15-
@inject(BoundViewFactory, ViewSlot)
16+
@inject(BoundViewFactory, ViewSlot, TaskQueue)
1617
export class If {
17-
constructor(viewFactory, viewSlot){
18+
constructor(viewFactory, viewSlot, taskQueue){
1819
this.viewFactory = viewFactory;
1920
this.viewSlot = viewSlot;
2021
this.showing = false;
22+
this.taskQueue = taskQueue;
2123
}
2224

2325
bind(executionContext) {
2426
// Store parent executionContext, so we can pass it down
25-
this.executionContext = executionContext;
27+
this.$parent = executionContext;
2628
this.valueChanged(this.value);
2729
}
2830

2931
valueChanged(newValue){
3032
if (!newValue) {
3133
if(this.view && this.showing){
32-
this.viewSlot.remove(this.view);
33-
this.view.unbind();
34+
this.taskQueue.queueMicroTask(() => {
35+
this.viewSlot.remove(this.view);
36+
this.view.unbind();
37+
});
3438
}
3539

3640
this.showing = false;
3741
return;
3842
}
3943

4044
if(!this.view){
41-
this.view = this.viewFactory.create(this.executionContext);
45+
this.view = this.viewFactory.create(this.$parent);
4246
}
4347

4448
if (!this.showing) {

dist/system/if.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
System.register(['aurelia-templating', 'aurelia-dependency-injection'], function (_export) {
1+
System.register(['aurelia-templating', 'aurelia-dependency-injection', 'aurelia-task-queue'], function (_export) {
22
'use strict';
33

4-
var BoundViewFactory, ViewSlot, customAttribute, templateController, inject, If;
4+
var BoundViewFactory, ViewSlot, customAttribute, templateController, inject, TaskQueue, If;
55

66
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
77

@@ -13,37 +13,44 @@ System.register(['aurelia-templating', 'aurelia-dependency-injection'], function
1313
templateController = _aureliaTemplating.templateController;
1414
}, function (_aureliaDependencyInjection) {
1515
inject = _aureliaDependencyInjection.inject;
16+
}, function (_aureliaTaskQueue) {
17+
TaskQueue = _aureliaTaskQueue.TaskQueue;
1618
}],
1719
execute: function () {
1820
If = (function () {
19-
function If(viewFactory, viewSlot) {
21+
function If(viewFactory, viewSlot, taskQueue) {
2022
_classCallCheck(this, _If);
2123

2224
this.viewFactory = viewFactory;
2325
this.viewSlot = viewSlot;
2426
this.showing = false;
27+
this.taskQueue = taskQueue;
2528
}
2629

2730
var _If = If;
2831

2932
_If.prototype.bind = function bind(executionContext) {
30-
this.executionContext = executionContext;
33+
this.$parent = executionContext;
3134
this.valueChanged(this.value);
3235
};
3336

3437
_If.prototype.valueChanged = function valueChanged(newValue) {
38+
var _this = this;
39+
3540
if (!newValue) {
3641
if (this.view && this.showing) {
37-
this.viewSlot.remove(this.view);
38-
this.view.unbind();
42+
this.taskQueue.queueMicroTask(function () {
43+
_this.viewSlot.remove(_this.view);
44+
_this.view.unbind();
45+
});
3946
}
4047

4148
this.showing = false;
4249
return;
4350
}
4451

4552
if (!this.view) {
46-
this.view = this.viewFactory.create(this.executionContext);
53+
this.view = this.viewFactory.create(this.$parent);
4754
}
4855

4956
if (!this.showing) {
@@ -57,7 +64,7 @@ System.register(['aurelia-templating', 'aurelia-dependency-injection'], function
5764
}
5865
};
5966

60-
If = inject(BoundViewFactory, ViewSlot)(If) || If;
67+
If = inject(BoundViewFactory, ViewSlot, TaskQueue)(If) || If;
6168
If = templateController(If) || If;
6269
If = customAttribute('if')(If) || If;
6370
return If;

doc/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
### 0.13.4 (2015-08-05)
2+
3+
4+
#### Bug Fixes
5+
6+
* **if:**
7+
* standardize on using the $parent property to store parent execution context ([82e6d135](http://github.com/aurelia/templating-resources/commit/82e6d135f3de35cf48aceff9d4d70a979288cc4e))
8+
* delay call to unbind via micro task ([9b62109c](http://github.com/aurelia/templating-resources/commit/9b62109c4f69dab3c2c2b2a58a908a8196409dde), closes [#84](http://github.com/aurelia/templating-resources/issues/84))
9+
10+
111
### 0.13.3 (2015-07-30)
212

313

doc/api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"classes":[{"name":"Compose","file":"aurelia/templating-resources/src/compose.js","line":8,"description":"Used to compose a new view / view-model template or bind to an existing instance","is_constructor":1,"params":[{"name":"container","description":"The containing container","type":"Container"},{"name":"compositionEngine","description":"The engine used when composing this view","type":"CompositionEngine"},{"name":"viewSlot","description":"The slot the view will be inserted in to","type":"ViewSlot"},{"name":"viewResources","description":"The resources available in the current viewSlot","type":"ViewResources"}],"methods":[{"line":52,"description":"Used to set the executionContext","name":"bind","params":[{"name":"executionContext","description":"The context in which the view model is executed in","type":"ExecutionContext"}]}],"properties":[{"line":22,"description":"Model to bind the custom element to","name":"model","type":"{CustomElement}"},{"line":29,"description":"View to bind the custom element to","name":"view","type":"{HtmlElement}"},{"line":36,"description":"View-model to bind the custom element's template to","name":"viewModel","type":"{Class}"}],"events":[]},{"name":"If","file":"aurelia/templating-resources/src/if.js","line":4,"description":"Binding to conditionally include or not include template logic depending on returned result\n- value should be Boolean or will be treated as such (truthy / falsey)","is_constructor":1,"params":[{"name":"viewFactory","description":"The factory used to create the view","type":"ViewFactory"},{"name":"viewSlot","description":"The slot the view will be inserted in to","type":"ViewSlot"}],"methods":[],"properties":[],"events":[]},{"name":"Repeat","file":"aurelia/templating-resources/src/repeat.js","line":5,"description":"Binding to iterate over an array and repeat a template","is_constructor":1,"params":[{"name":"viewFactory","description":"The factory generating the view","type":"BoundViewFactory"},{"name":"viewSlot","description":"The slot the view is injected in to","type":"ViewSlot"},{"name":"observerLocator","description":"The observer locator instance","type":"ObserverLocator"}],"methods":[],"properties":[{"line":18,"description":"List of items to bind the repeater to","name":"items","type":"{Array}"}],"events":[]},{"name":"SanitizeHtml","file":"aurelia/templating-resources/src/sanitize-html.js","line":5,"description":"Default Html Sanitizer to prevent script injection","is_constructor":1,"methods":[],"properties":[],"events":[]},{"name":"Show","file":"aurelia/templating-resources/src/show.js","line":17,"description":"Binding to conditionally show markup in the DOM based on the value.\n- different from if in that the markup is still added to the DOM, simply not shown","is_constructor":1,"params":[{"name":"element","description":"The element that the to bind to","type":"Element"}],"methods":[],"properties":[],"events":[]}],"methods":[],"properties":[],"events":[]}
1+
{"classes":[{"name":"Compose","file":"aurelia/templating-resources/src/compose.js","line":8,"description":"Used to compose a new view / view-model template or bind to an existing instance","is_constructor":1,"params":[{"name":"container","description":"The containing container","type":"Container"},{"name":"compositionEngine","description":"The engine used when composing this view","type":"CompositionEngine"},{"name":"viewSlot","description":"The slot the view will be inserted in to","type":"ViewSlot"},{"name":"viewResources","description":"The resources available in the current viewSlot","type":"ViewResources"}],"methods":[{"line":52,"description":"Used to set the executionContext","name":"bind","params":[{"name":"executionContext","description":"The context in which the view model is executed in","type":"ExecutionContext"}]}],"properties":[{"line":22,"description":"Model to bind the custom element to","name":"model","type":"{CustomElement}"},{"line":29,"description":"View to bind the custom element to","name":"view","type":"{HtmlElement}"},{"line":36,"description":"View-model to bind the custom element's template to","name":"viewModel","type":"{Class}"}],"events":[]},{"name":"If","file":"aurelia/templating-resources/src/if.js","line":5,"description":"Binding to conditionally include or not include template logic depending on returned result\n- value should be Boolean or will be treated as such (truthy / falsey)","is_constructor":1,"params":[{"name":"viewFactory","description":"The factory used to create the view","type":"ViewFactory"},{"name":"viewSlot","description":"The slot the view will be inserted in to","type":"ViewSlot"}],"methods":[],"properties":[],"events":[]},{"name":"Repeat","file":"aurelia/templating-resources/src/repeat.js","line":5,"description":"Binding to iterate over an array and repeat a template","is_constructor":1,"params":[{"name":"viewFactory","description":"The factory generating the view","type":"BoundViewFactory"},{"name":"viewSlot","description":"The slot the view is injected in to","type":"ViewSlot"},{"name":"observerLocator","description":"The observer locator instance","type":"ObserverLocator"}],"methods":[],"properties":[{"line":18,"description":"List of items to bind the repeater to","name":"items","type":"{Array}"}],"events":[]},{"name":"SanitizeHtml","file":"aurelia/templating-resources/src/sanitize-html.js","line":5,"description":"Default Html Sanitizer to prevent script injection","is_constructor":1,"methods":[],"properties":[],"events":[]},{"name":"Show","file":"aurelia/templating-resources/src/show.js","line":17,"description":"Binding to conditionally show markup in the DOM based on the value.\n- different from if in that the markup is still added to the DOM, simply not shown","is_constructor":1,"params":[{"name":"element","description":"The element that the to bind to","type":"Element"}],"methods":[],"properties":[],"events":[]}],"methods":[],"properties":[],"events":[]}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aurelia-templating-resources",
3-
"version": "0.13.3",
3+
"version": "0.13.4",
44
"description": "A standard set of behaviors, converters and other resources for use with the Aurelia templating library.",
55
"keywords": [
66
"aurelia",

0 commit comments

Comments
 (0)