diff --git a/src/compile/dom/index.ts b/src/compile/dom/index.ts index 140476aece..8b9878096e 100644 --- a/src/compile/dom/index.ts +++ b/src/compile/dom/index.ts @@ -132,7 +132,7 @@ export default function dom( ? `@proto` : deindent` { - ${['destroy', 'get', 'fire', 'on', 'set', '_set', '_mount', '_differs'] + ${['destroy', 'get', 'fire', 'on', 'set', '_set', '_stage', '_mount', '_differs'] .map(n => `${n}: @${n}`) .join(',\n')} }`; diff --git a/src/shared/index.js b/src/shared/index.js index 874eab1355..39350396f5 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -73,6 +73,7 @@ export function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -108,6 +109,9 @@ export function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -124,6 +128,10 @@ export function _set(newState) { } } +export function _stage(newState) { + assign(this._staged, newState); +} + export function setDev(newState) { if (typeof newState !== 'object') { throw new Error( @@ -159,6 +167,7 @@ export var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; @@ -171,6 +180,7 @@ export var protoDev = { set: setDev, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/store.js b/store.js index 29ea7d5ec1..9405ccb0d0 100644 --- a/store.js +++ b/store.js @@ -60,22 +60,27 @@ assign(Store.prototype, { current: this._state }); - const dependents = this._dependents.slice(); // guard against mutations - for (let i = 0; i < dependents.length; i += 1) { - const dependent = dependents[i]; - const componentState = {}; - let dirty = false; - - for (let j = 0; j < dependent.props.length; j += 1) { - const prop = dependent.props[j]; - if (prop in changed) { - componentState['$' + prop] = this._state[prop]; - dirty = true; + this._dependents + .filter(dependent => { + const componentState = {}; + let dirty = false; + + for (let j = 0; j < dependent.props.length; j += 1) { + const prop = dependent.props[j]; + if (prop in changed) { + componentState['$' + prop] = this._state[prop]; + dirty = true; + } } - } - if (dirty) dependent.component.set(componentState); - } + if (dirty) { + dependent.component._stage(componentState); + return true; + } + }) + .forEach(dependent => { + dependent.component.set({}); + }); this.fire('update', { changed, diff --git a/test/cli/samples/amd/expected/Main.js b/test/cli/samples/amd/expected/Main.js index 16c884e32f..28871fd804 100644 --- a/test/cli/samples/amd/expected/Main.js +++ b/test/cli/samples/amd/expected/Main.js @@ -43,6 +43,7 @@ define("test", function() { "use strict"; on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ define("test", function() { "use strict"; component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -140,6 +142,9 @@ define("test", function() { "use strict"; changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -156,6 +161,10 @@ define("test", function() { "use strict"; } } + function _stage(newState) { + assign(this._staged, newState); + } + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/cli/samples/basic/expected/Main.js b/test/cli/samples/basic/expected/Main.js index 65618e7541..dfef29ecae 100644 --- a/test/cli/samples/basic/expected/Main.js +++ b/test/cli/samples/basic/expected/Main.js @@ -43,6 +43,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -140,6 +142,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -156,6 +161,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/cli/samples/custom-element/expected/Main.js b/test/cli/samples/custom-element/expected/Main.js index 2cfebf1382..b507399dec 100644 --- a/test/cli/samples/custom-element/expected/Main.js +++ b/test/cli/samples/custom-element/expected/Main.js @@ -57,6 +57,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -88,6 +89,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -161,6 +163,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -177,6 +182,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/cli/samples/dev/expected/Main.js b/test/cli/samples/dev/expected/Main.js index 51d6c0e8c3..85d920e48f 100644 --- a/test/cli/samples/dev/expected/Main.js +++ b/test/cli/samples/dev/expected/Main.js @@ -50,6 +50,7 @@ assign(Main.prototype, { on: on, set: setDev, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -91,6 +92,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -166,6 +168,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -182,6 +187,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js b/test/cli/samples/dir-sourcemap/expected/Main.js index 5a1c3815f7..e7e493e4f5 100644 --- a/test/cli/samples/dir-sourcemap/expected/Main.js +++ b/test/cli/samples/dir-sourcemap/expected/Main.js @@ -49,6 +49,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -61,6 +62,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -142,6 +144,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -158,6 +163,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js.map b/test/cli/samples/dir-sourcemap/expected/Main.js.map index 1d09d8ade9..621cf85109 100644 --- a/test/cli/samples/dir-sourcemap/expected/Main.js.map +++ b/test/cli/samples/dir-sourcemap/expected/Main.js.map @@ -1 +1 @@ -{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/dir-sourcemap/expected/Widget.js b/test/cli/samples/dir-sourcemap/expected/Widget.js index abaaee50ca..11a929e974 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js +++ b/test/cli/samples/dir-sourcemap/expected/Widget.js @@ -43,6 +43,7 @@ assign(Widget.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -140,6 +142,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -156,6 +161,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/cli/samples/dir-sourcemap/expected/Widget.js.map b/test/cli/samples/dir-sourcemap/expected/Widget.js.map index f4303844df..57807d3fc0 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js.map +++ b/test/cli/samples/dir-sourcemap/expected/Widget.js.map @@ -1 +1 @@ -{"version":3,"file":"Widget.js","sources":["../src/Widget.html"],"sourcesContent":["

widget

"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"Widget.js","sources":["../src/Widget.html"],"sourcesContent":["

widget

"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/dir-subdir/expected/Main.js b/test/cli/samples/dir-subdir/expected/Main.js index 3ef90ebe96..4919789fbf 100644 --- a/test/cli/samples/dir-subdir/expected/Main.js +++ b/test/cli/samples/dir-subdir/expected/Main.js @@ -49,6 +49,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -61,6 +62,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -142,6 +144,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -158,6 +163,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/cli/samples/dir-subdir/expected/widget/Widget.js b/test/cli/samples/dir-subdir/expected/widget/Widget.js index 647e3f0b97..1f91adfd8e 100644 --- a/test/cli/samples/dir-subdir/expected/widget/Widget.js +++ b/test/cli/samples/dir-subdir/expected/widget/Widget.js @@ -43,6 +43,7 @@ assign(Widget.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -140,6 +142,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -156,6 +161,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/cli/samples/dir/expected/Main.js b/test/cli/samples/dir/expected/Main.js index d265f72093..866abbc794 100644 --- a/test/cli/samples/dir/expected/Main.js +++ b/test/cli/samples/dir/expected/Main.js @@ -49,6 +49,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -61,6 +62,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -142,6 +144,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -158,6 +163,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/cli/samples/dir/expected/Widget.js b/test/cli/samples/dir/expected/Widget.js index ca0379d41e..c2ae61dbf2 100644 --- a/test/cli/samples/dir/expected/Widget.js +++ b/test/cli/samples/dir/expected/Widget.js @@ -43,6 +43,7 @@ assign(Widget.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -140,6 +142,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -156,6 +161,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/cli/samples/globals/expected/Main.js b/test/cli/samples/globals/expected/Main.js index 5b92ba3b98..cb849d9640 100644 --- a/test/cli/samples/globals/expected/Main.js +++ b/test/cli/samples/globals/expected/Main.js @@ -58,6 +58,7 @@ var Main = (function(answer) { "use strict"; on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -92,6 +93,7 @@ var Main = (function(answer) { "use strict"; component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -165,6 +167,9 @@ var Main = (function(answer) { "use strict"; changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -181,6 +186,10 @@ var Main = (function(answer) { "use strict"; } } + function _stage(newState) { + assign(this._staged, newState); + } + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/cli/samples/sourcemap-inline/expected/Main.js b/test/cli/samples/sourcemap-inline/expected/Main.js index a5501d3c20..3566ef4888 100644 --- a/test/cli/samples/sourcemap-inline/expected/Main.js +++ b/test/cli/samples/sourcemap-inline/expected/Main.js @@ -43,6 +43,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -140,6 +142,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -156,6 +161,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } @@ -180,4 +189,4 @@ function callAll(fns) { while (fns && fns.length) fns.shift()(); } export default Main; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWFpbi5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL01haW4uaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8cD5IZWxsbyB3b3JsZCE8L3A+XG5cbjxzY3JpcHQ+XG5cdGV4cG9ydCBkZWZhdWx0IHtcblx0XHRvbnJlbmRlciAoKSB7XG5cdFx0XHRjb25zb2xlLmxvZyggJ2hlcmUnICk7XG5cdFx0fVxuXHR9O1xuPC9zY3JpcHQ+Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0= +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWFpbi5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL01haW4uaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8cD5IZWxsbyB3b3JsZCE8L3A+XG5cbjxzY3JpcHQ+XG5cdGV4cG9ydCBkZWZhdWx0IHtcblx0XHRvbnJlbmRlciAoKSB7XG5cdFx0XHRjb25zb2xlLmxvZyggJ2hlcmUnICk7XG5cdFx0fVxuXHR9O1xuPC9zY3JpcHQ+Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0= diff --git a/test/cli/samples/sourcemap/expected/Main.js b/test/cli/samples/sourcemap/expected/Main.js index 9a8365426a..02f5d5d969 100644 --- a/test/cli/samples/sourcemap/expected/Main.js +++ b/test/cli/samples/sourcemap/expected/Main.js @@ -43,6 +43,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -140,6 +142,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -156,6 +161,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/cli/samples/sourcemap/expected/Main.js.map b/test/cli/samples/sourcemap/expected/Main.js.map index a6fe370c69..a3be94cb9a 100644 --- a/test/cli/samples/sourcemap/expected/Main.js.map +++ b/test/cli/samples/sourcemap/expected/Main.js.map @@ -1 +1 @@ -{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["

Hello world!

\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["

Hello world!

\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/store/expected/Main.js b/test/cli/samples/store/expected/Main.js index e54ad218bb..285cba1bb7 100644 --- a/test/cli/samples/store/expected/Main.js +++ b/test/cli/samples/store/expected/Main.js @@ -53,6 +53,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -87,6 +88,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -164,6 +166,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -180,6 +185,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function _mount(target, anchor, skipIntro) { this._fragment[!skipIntro && this._fragment.i ? 'i' : 'm'](target, anchor || null, skipIntro); } diff --git a/test/js/samples/action/expected-bundle.js b/test/js/samples/action/expected-bundle.js index 8b79acc8d0..4a8771240b 100644 --- a/test/js/samples/action/expected-bundle.js +++ b/test/js/samples/action/expected-bundle.js @@ -70,6 +70,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -105,6 +106,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -121,6 +125,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -137,6 +145,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/bind-width-height/expected-bundle.js b/test/js/samples/bind-width-height/expected-bundle.js index a5c07c03ee..272f079b95 100644 --- a/test/js/samples/bind-width-height/expected-bundle.js +++ b/test/js/samples/bind-width-height/expected-bundle.js @@ -102,6 +102,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -137,6 +138,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -153,6 +157,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -169,6 +177,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/collapses-text-around-comments/expected-bundle.js b/test/js/samples/collapses-text-around-comments/expected-bundle.js index 4db7513792..2a017d4fa5 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -82,6 +82,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -117,6 +118,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -133,6 +137,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -149,6 +157,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/component-static-array/expected-bundle.js b/test/js/samples/component-static-array/expected-bundle.js index cea7dbc356..c167d30d4b 100644 --- a/test/js/samples/component-static-array/expected-bundle.js +++ b/test/js/samples/component-static-array/expected-bundle.js @@ -58,6 +58,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -93,6 +94,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -109,6 +113,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -125,6 +133,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/component-static-immutable/expected-bundle.js b/test/js/samples/component-static-immutable/expected-bundle.js index 1c343f931a..f380585357 100644 --- a/test/js/samples/component-static-immutable/expected-bundle.js +++ b/test/js/samples/component-static-immutable/expected-bundle.js @@ -62,6 +62,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -97,6 +98,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -113,6 +117,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -129,6 +137,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/component-static-immutable2/expected-bundle.js b/test/js/samples/component-static-immutable2/expected-bundle.js index 1c343f931a..f380585357 100644 --- a/test/js/samples/component-static-immutable2/expected-bundle.js +++ b/test/js/samples/component-static-immutable2/expected-bundle.js @@ -62,6 +62,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -97,6 +98,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -113,6 +117,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -129,6 +137,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js index 9c5788665f..7a1109469f 100644 --- a/test/js/samples/component-static/expected-bundle.js +++ b/test/js/samples/component-static/expected-bundle.js @@ -58,6 +58,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -93,6 +94,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -109,6 +113,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -125,6 +133,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index 3419fc3180..7ff83f5d5c 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -58,6 +58,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -93,6 +94,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -109,6 +113,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -125,6 +133,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js index da790bc326..3bf19bc484 100644 --- a/test/js/samples/css-media-query/expected-bundle.js +++ b/test/js/samples/css-media-query/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -109,6 +110,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -125,6 +129,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -141,6 +149,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js index 64c6d4ebd5..5a2bb91245 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js @@ -70,6 +70,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -105,6 +106,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -121,6 +125,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -137,6 +145,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/debug-empty/expected-bundle.js b/test/js/samples/debug-empty/expected-bundle.js index 85b85c6a20..b8f8ed04b3 100644 --- a/test/js/samples/debug-empty/expected-bundle.js +++ b/test/js/samples/debug-empty/expected-bundle.js @@ -95,6 +95,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -130,6 +131,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -146,6 +150,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function setDev(newState) { if (typeof newState !== 'object') { throw new Error( @@ -173,6 +181,7 @@ var protoDev = { set: setDev, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/debug-foo-bar-baz-things/expected-bundle.js b/test/js/samples/debug-foo-bar-baz-things/expected-bundle.js index 9cc64d8c52..ecad876676 100644 --- a/test/js/samples/debug-foo-bar-baz-things/expected-bundle.js +++ b/test/js/samples/debug-foo-bar-baz-things/expected-bundle.js @@ -101,6 +101,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -136,6 +137,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -152,6 +156,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function setDev(newState) { if (typeof newState !== 'object') { throw new Error( @@ -179,6 +187,7 @@ var protoDev = { set: setDev, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/debug-foo/expected-bundle.js b/test/js/samples/debug-foo/expected-bundle.js index 4dd1edb7a9..c0a633ee47 100644 --- a/test/js/samples/debug-foo/expected-bundle.js +++ b/test/js/samples/debug-foo/expected-bundle.js @@ -101,6 +101,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -136,6 +137,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -152,6 +156,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function setDev(newState) { if (typeof newState !== 'object') { throw new Error( @@ -179,6 +187,7 @@ var protoDev = { set: setDev, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/deconflict-builtins/expected-bundle.js b/test/js/samples/deconflict-builtins/expected-bundle.js index c5ab9d9841..9de018dfc0 100644 --- a/test/js/samples/deconflict-builtins/expected-bundle.js +++ b/test/js/samples/deconflict-builtins/expected-bundle.js @@ -92,6 +92,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -127,6 +128,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -143,6 +147,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -159,6 +167,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/deconflict-globals/expected-bundle.js b/test/js/samples/deconflict-globals/expected-bundle.js index b36a3d4c37..4952056160 100644 --- a/test/js/samples/deconflict-globals/expected-bundle.js +++ b/test/js/samples/deconflict-globals/expected-bundle.js @@ -63,6 +63,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -98,6 +99,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -114,6 +118,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -130,6 +138,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js index 25d05775cd..90ac1129a2 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js @@ -95,6 +95,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -130,6 +131,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -146,6 +150,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function setDev(newState) { if (typeof newState !== 'object') { throw new Error( @@ -173,6 +181,7 @@ var protoDev = { set: setDev, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/do-use-dataset/expected-bundle.js b/test/js/samples/do-use-dataset/expected-bundle.js index 3c0f9e2785..d41b3eee9e 100644 --- a/test/js/samples/do-use-dataset/expected-bundle.js +++ b/test/js/samples/do-use-dataset/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -109,6 +110,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -125,6 +129,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -141,6 +149,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js b/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js index 15ae22ff5c..1b3c29ffea 100644 --- a/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js +++ b/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js @@ -78,6 +78,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -113,6 +114,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -129,6 +133,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -145,6 +153,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js b/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js index 0fdc6184c7..f8fd4e86aa 100644 --- a/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js +++ b/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js @@ -78,6 +78,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -113,6 +114,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -129,6 +133,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -145,6 +153,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/each-block-changed-check/expected-bundle.js b/test/js/samples/each-block-changed-check/expected-bundle.js index 00a194ac40..3a5c74cea6 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -94,6 +94,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -129,6 +130,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -145,6 +149,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -161,6 +169,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/each-block-keyed-animated/expected-bundle.js b/test/js/samples/each-block-keyed-animated/expected-bundle.js index c5293b6af2..c08494496a 100644 --- a/test/js/samples/each-block-keyed-animated/expected-bundle.js +++ b/test/js/samples/each-block-keyed-animated/expected-bundle.js @@ -397,6 +397,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -432,6 +433,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -448,6 +452,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -464,6 +472,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/each-block-keyed/expected-bundle.js b/test/js/samples/each-block-keyed/expected-bundle.js index 984f6322df..7b753a4b20 100644 --- a/test/js/samples/each-block-keyed/expected-bundle.js +++ b/test/js/samples/each-block-keyed/expected-bundle.js @@ -177,6 +177,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -212,6 +213,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -228,6 +232,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -244,6 +252,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index afb66668aa..7f5c038acc 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -70,6 +70,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -105,6 +106,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -121,6 +125,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -137,6 +145,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/head-no-whitespace/expected-bundle.js b/test/js/samples/head-no-whitespace/expected-bundle.js index faf6b5b41a..860a66acf9 100644 --- a/test/js/samples/head-no-whitespace/expected-bundle.js +++ b/test/js/samples/head-no-whitespace/expected-bundle.js @@ -70,6 +70,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -105,6 +106,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -121,6 +125,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -137,6 +145,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/if-block-no-update/expected-bundle.js b/test/js/samples/if-block-no-update/expected-bundle.js index f03713dde3..6400150c8f 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -109,6 +110,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -125,6 +129,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -141,6 +149,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index 13802674b1..6a64e952e8 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -109,6 +110,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -125,6 +129,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -141,6 +149,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js index 01b4f8e1d2..d0c1176b04 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -109,6 +110,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -125,6 +129,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -141,6 +149,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/inline-style-optimized-url/expected-bundle.js b/test/js/samples/inline-style-optimized-url/expected-bundle.js index 32fa122bcc..103d3c607d 100644 --- a/test/js/samples/inline-style-optimized-url/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -109,6 +110,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -125,6 +129,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -141,6 +149,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js index a31301ad89..cbd55cb387 100644 --- a/test/js/samples/inline-style-optimized/expected-bundle.js +++ b/test/js/samples/inline-style-optimized/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -109,6 +110,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -125,6 +129,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -141,6 +149,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js index 2d481b8b74..7ffdb528cb 100644 --- a/test/js/samples/inline-style-unoptimized/expected-bundle.js +++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -109,6 +110,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -125,6 +129,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -141,6 +149,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/input-files/expected-bundle.js b/test/js/samples/input-files/expected-bundle.js index ad7cb603ec..dc28e38af9 100644 --- a/test/js/samples/input-files/expected-bundle.js +++ b/test/js/samples/input-files/expected-bundle.js @@ -82,6 +82,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -117,6 +118,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -133,6 +137,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -149,6 +157,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/input-range/expected-bundle.js b/test/js/samples/input-range/expected-bundle.js index cf74308a82..82a5dbe6f9 100644 --- a/test/js/samples/input-range/expected-bundle.js +++ b/test/js/samples/input-range/expected-bundle.js @@ -86,6 +86,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -121,6 +122,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -137,6 +141,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -153,6 +161,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/input-without-blowback-guard/expected-bundle.js b/test/js/samples/input-without-blowback-guard/expected-bundle.js index 387b5994b6..984d5245e9 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -82,6 +82,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -117,6 +118,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -133,6 +137,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -149,6 +157,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js index 053cc85280..1c8fabea04 100644 --- a/test/js/samples/legacy-input-type/expected-bundle.js +++ b/test/js/samples/legacy-input-type/expected-bundle.js @@ -76,6 +76,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -111,6 +112,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -127,6 +131,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -143,6 +151,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js index 94f7de5635..773bf67d51 100644 --- a/test/js/samples/media-bindings/expected-bundle.js +++ b/test/js/samples/media-bindings/expected-bundle.js @@ -86,6 +86,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -121,6 +122,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -137,6 +141,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -153,6 +161,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index 97a0fb5d6f..0165666eb3 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -72,6 +72,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -107,6 +108,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -123,6 +127,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -139,6 +147,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/select-dynamic-value/expected-bundle.js b/test/js/samples/select-dynamic-value/expected-bundle.js index 235d455c87..045c10de8b 100644 --- a/test/js/samples/select-dynamic-value/expected-bundle.js +++ b/test/js/samples/select-dynamic-value/expected-bundle.js @@ -78,6 +78,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -113,6 +114,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -129,6 +133,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -145,6 +153,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index 3d27a6cffa..84bec0571e 100644 --- a/test/js/samples/setup-method/expected-bundle.js +++ b/test/js/samples/setup-method/expected-bundle.js @@ -58,6 +58,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -93,6 +94,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -109,6 +113,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -125,6 +133,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/svg-title/expected-bundle.js b/test/js/samples/svg-title/expected-bundle.js index 9e2f0750fe..2cd9db4dad 100644 --- a/test/js/samples/svg-title/expected-bundle.js +++ b/test/js/samples/svg-title/expected-bundle.js @@ -78,6 +78,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -113,6 +114,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -129,6 +133,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -145,6 +153,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/title/expected-bundle.js b/test/js/samples/title/expected-bundle.js index 0dd18e7258..41988ce8eb 100644 --- a/test/js/samples/title/expected-bundle.js +++ b/test/js/samples/title/expected-bundle.js @@ -58,6 +58,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -93,6 +94,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -109,6 +113,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -125,6 +133,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/use-elements-as-anchors/expected-bundle.js b/test/js/samples/use-elements-as-anchors/expected-bundle.js index 565bee1a3f..df5cae3bd7 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -82,6 +82,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -117,6 +118,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -133,6 +137,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -149,6 +157,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index 824e0e3132..e6505cb614 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -82,6 +82,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -117,6 +118,9 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } @@ -133,6 +137,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -149,6 +157,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/runtime/samples/store-child-data/Component.html b/test/runtime/samples/store-child-data/Component.html new file mode 100644 index 0000000000..df36fe5262 --- /dev/null +++ b/test/runtime/samples/store-child-data/Component.html @@ -0,0 +1 @@ +

{$items[index].title}

\ No newline at end of file diff --git a/test/runtime/samples/store-child-data/_config.js b/test/runtime/samples/store-child-data/_config.js new file mode 100644 index 0000000000..4322386f45 --- /dev/null +++ b/test/runtime/samples/store-child-data/_config.js @@ -0,0 +1,22 @@ +import { Store } from '../../../../store.js'; + +const store = new Store({ + selectedIndex: 0, + items: [{ title: 'One' }, { title: 'Two' }] +}); + +export default { + store, + + html: ` +

One

+ `, + + test(assert, component, target, window) { + store.set({ selectedIndex: 2, items: [{ title: 'One' }, { title: 'Two' }, { title: 'Three' }]}); + + assert.htmlEqual(target.innerHTML, ` +

Three

+ `); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/store-child-data/main.html b/test/runtime/samples/store-child-data/main.html new file mode 100644 index 0000000000..0f3f9862de --- /dev/null +++ b/test/runtime/samples/store-child-data/main.html @@ -0,0 +1,9 @@ + + + \ No newline at end of file