diff --git a/src/compile/dom/index.ts b/src/compile/dom/index.ts index 79645f4081..3ced0254a2 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 898e816beb..066942f1a6 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 35f4b57186..5f236d668f 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } diff --git a/test/cli/samples/basic/expected/Main.js b/test/cli/samples/basic/expected/Main.js index 7d24fd3862..ba35a0c1e9 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } diff --git a/test/cli/samples/custom-element/expected/Main.js b/test/cli/samples/custom-element/expected/Main.js index 1d34cc12a6..40865a2c81 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } diff --git a/test/cli/samples/dev/expected/Main.js b/test/cli/samples/dev/expected/Main.js index e32ea9a61e..bf46dffdd0 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js b/test/cli/samples/dir-sourcemap/expected/Main.js index 884f11d1d3..0c0fab6094 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } 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 99c6e08a0e..b6019a73fd 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } 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 4b1803f5fc..2778c8c868 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } diff --git a/test/cli/samples/dir-subdir/expected/widget/Widget.js b/test/cli/samples/dir-subdir/expected/widget/Widget.js index 5c6241e320..9282b7ddb4 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } diff --git a/test/cli/samples/dir/expected/Main.js b/test/cli/samples/dir/expected/Main.js index dc82848d2e..bbc005da76 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } diff --git a/test/cli/samples/dir/expected/Widget.js b/test/cli/samples/dir/expected/Widget.js index 2896558acc..c5981a4c53 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } diff --git a/test/cli/samples/globals/expected/Main.js b/test/cli/samples/globals/expected/Main.js index 62d5a02694..885d7da4bc 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } diff --git a/test/cli/samples/sourcemap-inline/expected/Main.js b/test/cli/samples/sourcemap-inline/expected/Main.js index f4cbc7d8df..668ff8b1bf 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } @@ -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 43ee0b6b7f..95e6718715 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } 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 e3beb9d80f..03f4eb521d 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) { this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null); } diff --git a/test/js/samples/action/expected-bundle.js b/test/js/samples/action/expected-bundle.js index 7d62bef134..62c04649ec 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 }; @@ -144,7 +153,7 @@ var proto = { /* generated by Svelte vX.Y.Z */ function link(node) { - + function onClick(event) { event.preventDefault(); history.pushState(null, null, event.target.href); diff --git a/test/js/samples/action/expected.js b/test/js/samples/action/expected.js index fab6e6a2b6..2c173d0133 100644 --- a/test/js/samples/action/expected.js +++ b/test/js/samples/action/expected.js @@ -2,7 +2,7 @@ import { assign, createElement, detachNode, init, insert, noop, proto } from "svelte/shared.js"; function link(node) { - + function onClick(event) { event.preventDefault(); history.pushState(null, null, event.target.href); diff --git a/test/js/samples/bind-width-height/expected-bundle.js b/test/js/samples/bind-width-height/expected-bundle.js index f0232218ac..a4c740e120 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 58f2fbb09c..3f0faa13fc 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 3bbb1ede27..c2f94398c0 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 98f6b26fec..ac9ae4d3f6 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 98f6b26fec..ac9ae4d3f6 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 4c394bba1d..c839759ecf 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 94cb7c3ef3..c00e61971d 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 703ef5f6c0..80d50457d9 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 0bb956d285..fb563a9db5 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 0faf822be3..a9f380840f 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 521d57af5b..8965e0ef1b 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 5cc1c7a469..4b41d50d16 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 eae32e976c..a82fb4ecf7 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 28b8d1f46b..46d2f7bbf8 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 73fdae3223..2771b3228d 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 d981b929a7..ed3983ea68 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 3be0e2a270..5a011bbca1 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 5b73e51762..09f6cd4497 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 ce97c56af5..faa49a664d 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 1cfdf681f0..a7f5e22800 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 1cc34f4455..3643c1c059 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 23327a276a..ea4b323271 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 91eaa6cd5b..1a1b975edc 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 83c3f60db0..6687f56cc3 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 24b9e526cd..2ed0f73584 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 78e6cc7e40..e6ea18a957 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 9fd8e681a6..472c72db8a 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 d8f9b7d7d2..40425bcc01 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 b46055315e..ff6bfc0705 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 b3218c7fd4..988d49a27e 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 2f53e740ea..45d1d42d33 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 b5f7a90f8c..0ba44bcddd 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 cd841f8a2d..a10dfa137d 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 d9f961f564..e388684cab 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 b890d8bed5..ec8f608726 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 1230856164..08aae80e9e 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 fa63c78502..f36e9584c0 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 269f6ca1f3..730857faec 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 f0afba9d24..096430361e 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 4065ba55ad..c86845e7f2 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 7823390a2c..57ab3aaf7b 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