update tests

pull/7738/head
Rich Harris 8 years ago
parent 2705cf4621
commit ba2b6838f3

@ -52,25 +52,23 @@ function differs(a, b) {
return a !== b || ((a && typeof a === 'object') || typeof a === 'function'); return a !== b || ((a && typeof a === 'object') || typeof a === 'function');
} }
function dispatchObservers(component, group, newState, oldState) { function dispatchObservers(component, group, changed, newState, oldState) {
for (var key in group) { for (var key in group) {
if (!(key in newState)) continue; if (!(key in changed)) continue;
var newValue = newState[key]; var newValue = newState[key];
var oldValue = oldState[key]; var oldValue = oldState[key];
if (differs(newValue, oldValue)) { var callbacks = group[key];
var callbacks = group[key]; if (!callbacks) continue;
if (!callbacks) continue;
for (var i = 0; i < callbacks.length; i += 1) { for (var i = 0; i < callbacks.length; i += 1) {
var callback = callbacks[i]; var callback = callbacks[i];
if (callback.__calling) continue; if (callback.__calling) continue;
callback.__calling = true; callback.__calling = true;
callback.call(component, newValue, oldValue); callback.call(component, newValue, oldValue);
callback.__calling = false; callback.__calling = false;
}
} }
} }
} }
@ -134,6 +132,23 @@ function set(newState) {
this._root._lock = false; this._root._lock = false;
} }
function _set(newState) {
var oldState = this._state,
changed = {},
dirty = false;
for (var key in newState) {
if (differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
this._state = assign({}, oldState, newState);
this._recompute(changed, this._state, oldState, false);
dispatchObservers(this, this._observers.pre, changed, this._state, oldState);
this._fragment.update(changed, this._state);
dispatchObservers(this, this._observers.post, changed, this._state, oldState);
}
function callAll(fns) { function callAll(fns) {
while (fns && fns.length) fns.pop()(); while (fns && fns.length) fns.pop()();
} }
@ -145,7 +160,9 @@ var proto = {
observe: observe, observe: observe,
on: on, on: on,
set: set, set: set,
teardown: destroy teardown: destroy,
_recompute: noop,
_set: _set
}; };
var template = (function () { var template = (function () {
@ -187,7 +204,7 @@ function create_main_fragment ( state, component ) {
}, },
update: function ( changed, state ) { update: function ( changed, state ) {
if ( text_value !== ( text_value = state.foo ) ) { if ( ( 'foo' in changed ) && text_value !== ( text_value = state.foo ) ) {
text.data = text_value; text.data = text_value;
} }
}, },
@ -226,12 +243,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -1,4 +1,4 @@
import { appendNode, assign, createElement, createText, detachNode, dispatchObservers, insertNode, noop, proto, setAttribute } from "svelte/shared.js"; import { appendNode, assign, createElement, createText, detachNode, insertNode, noop, proto, setAttribute } from "svelte/shared.js";
var template = (function () { var template = (function () {
return { return {
@ -39,7 +39,7 @@ function create_main_fragment ( state, component ) {
}, },
update: function ( changed, state ) { update: function ( changed, state ) {
if ( text_value !== ( text_value = state.foo ) ) { if ( ( 'foo' in changed ) && text_value !== ( text_value = state.foo ) ) {
text.data = text_value; text.data = text_value;
} }
}, },
@ -78,12 +78,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -28,25 +28,23 @@ function differs(a, b) {
return a !== b || ((a && typeof a === 'object') || typeof a === 'function'); return a !== b || ((a && typeof a === 'object') || typeof a === 'function');
} }
function dispatchObservers(component, group, newState, oldState) { function dispatchObservers(component, group, changed, newState, oldState) {
for (var key in group) { for (var key in group) {
if (!(key in newState)) continue; if (!(key in changed)) continue;
var newValue = newState[key]; var newValue = newState[key];
var oldValue = oldState[key]; var oldValue = oldState[key];
if (differs(newValue, oldValue)) { var callbacks = group[key];
var callbacks = group[key]; if (!callbacks) continue;
if (!callbacks) continue;
for (var i = 0; i < callbacks.length; i += 1) { for (var i = 0; i < callbacks.length; i += 1) {
var callback = callbacks[i]; var callback = callbacks[i];
if (callback.__calling) continue; if (callback.__calling) continue;
callback.__calling = true; callback.__calling = true;
callback.call(component, newValue, oldValue); callback.call(component, newValue, oldValue);
callback.__calling = false; callback.__calling = false;
}
} }
} }
} }
@ -110,6 +108,23 @@ function set(newState) {
this._root._lock = false; this._root._lock = false;
} }
function _set(newState) {
var oldState = this._state,
changed = {},
dirty = false;
for (var key in newState) {
if (differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
this._state = assign({}, oldState, newState);
this._recompute(changed, this._state, oldState, false);
dispatchObservers(this, this._observers.pre, changed, this._state, oldState);
this._fragment.update(changed, this._state);
dispatchObservers(this, this._observers.post, changed, this._state, oldState);
}
function callAll(fns) { function callAll(fns) {
while (fns && fns.length) fns.pop()(); while (fns && fns.length) fns.pop()();
} }
@ -121,16 +136,11 @@ var proto = {
observe: observe, observe: observe,
on: on, on: on,
set: set, set: set,
teardown: destroy teardown: destroy,
_recompute: noop,
_set: _set
}; };
function recompute ( state, newState, oldState, isInitial ) {
if ( isInitial || ( 'x' in newState && differs( state.x, oldState.x ) ) ) {
state.a = newState.a = template.computed.a( state.x );
state.b = newState.b = template.computed.b( state.x );
}
}
var template = (function () { var template = (function () {
return { return {
computed: { computed: {
@ -147,6 +157,8 @@ function create_main_fragment ( state, component ) {
mount: noop, mount: noop,
update: noop,
unmount: noop, unmount: noop,
destroy: noop destroy: noop
@ -156,7 +168,7 @@ function create_main_fragment ( state, component ) {
function SvelteComponent ( options ) { function SvelteComponent ( options ) {
options = options || {}; options = options || {};
this._state = options.data || {}; this._state = options.data || {};
recompute( this._state, this._state, {}, true ); this._recompute( {}, this._state, {}, true );
this._observers = { this._observers = {
pre: Object.create( null ), pre: Object.create( null ),
@ -178,12 +190,11 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) { SvelteComponent.prototype._recompute = function _recompute ( changed, state, oldState, isInitial ) {
var oldState = this._state; if ( isInitial || ( 'x' in changed ) ) {
this._state = assign( {}, oldState, newState ); if ( differs( ( state.a = template.computed.a( state.x ) ), oldState.a ) ) changed.a = true;
recompute( this._state, newState, oldState, false ); if ( differs( ( state.b = template.computed.b( state.x ) ), oldState.b ) ) changed.b = true;
dispatchObservers( this, this._observers.pre, newState, oldState ); }
dispatchObservers( this, this._observers.post, newState, oldState );
}; };
export default SvelteComponent; export default SvelteComponent;

@ -1,11 +1,4 @@
import { assign, differs, dispatchObservers, noop, proto } from "svelte/shared.js"; import { assign, differs, noop, proto } from "svelte/shared.js";
function recompute ( state, newState, oldState, isInitial ) {
if ( isInitial || ( 'x' in newState && differs( state.x, oldState.x ) ) ) {
state.a = newState.a = template.computed.a( state.x );
state.b = newState.b = template.computed.b( state.x );
}
}
var template = (function () { var template = (function () {
return { return {
@ -23,6 +16,8 @@ function create_main_fragment ( state, component ) {
mount: noop, mount: noop,
update: noop,
unmount: noop, unmount: noop,
destroy: noop destroy: noop
@ -32,7 +27,7 @@ function create_main_fragment ( state, component ) {
function SvelteComponent ( options ) { function SvelteComponent ( options ) {
options = options || {}; options = options || {};
this._state = options.data || {}; this._state = options.data || {};
recompute( this._state, this._state, {}, true ); this._recompute( {}, this._state, {}, true );
this._observers = { this._observers = {
pre: Object.create( null ), pre: Object.create( null ),
@ -54,12 +49,11 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) { SvelteComponent.prototype._recompute = function _recompute ( changed, state, oldState, isInitial ) {
var oldState = this._state; if ( isInitial || ( 'x' in changed ) ) {
this._state = assign( {}, oldState, newState ); if ( differs( ( state.a = template.computed.a( state.x ) ), oldState.a ) ) changed.a = true;
recompute( this._state, newState, oldState, false ) if ( differs( ( state.b = template.computed.b( state.x ) ), oldState.b ) ) changed.b = true;
dispatchObservers( this, this._observers.pre, newState, oldState ); }
dispatchObservers( this, this._observers.post, newState, oldState ); }
};
export default SvelteComponent; export default SvelteComponent;

@ -48,25 +48,23 @@ function differs(a, b) {
return a !== b || ((a && typeof a === 'object') || typeof a === 'function'); return a !== b || ((a && typeof a === 'object') || typeof a === 'function');
} }
function dispatchObservers(component, group, newState, oldState) { function dispatchObservers(component, group, changed, newState, oldState) {
for (var key in group) { for (var key in group) {
if (!(key in newState)) continue; if (!(key in changed)) continue;
var newValue = newState[key]; var newValue = newState[key];
var oldValue = oldState[key]; var oldValue = oldState[key];
if (differs(newValue, oldValue)) { var callbacks = group[key];
var callbacks = group[key]; if (!callbacks) continue;
if (!callbacks) continue;
for (var i = 0; i < callbacks.length; i += 1) { for (var i = 0; i < callbacks.length; i += 1) {
var callback = callbacks[i]; var callback = callbacks[i];
if (callback.__calling) continue; if (callback.__calling) continue;
callback.__calling = true; callback.__calling = true;
callback.call(component, newValue, oldValue); callback.call(component, newValue, oldValue);
callback.__calling = false; callback.__calling = false;
}
} }
} }
} }
@ -130,6 +128,23 @@ function set(newState) {
this._root._lock = false; this._root._lock = false;
} }
function _set(newState) {
var oldState = this._state,
changed = {},
dirty = false;
for (var key in newState) {
if (differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
this._state = assign({}, oldState, newState);
this._recompute(changed, this._state, oldState, false);
dispatchObservers(this, this._observers.pre, changed, this._state, oldState);
this._fragment.update(changed, this._state);
dispatchObservers(this, this._observers.post, changed, this._state, oldState);
}
function callAll(fns) { function callAll(fns) {
while (fns && fns.length) fns.pop()(); while (fns && fns.length) fns.pop()();
} }
@ -141,7 +156,9 @@ var proto = {
observe: observe, observe: observe,
on: on, on: on,
set: set, set: set,
teardown: destroy teardown: destroy,
_recompute: noop,
_set: _set
}; };
function encapsulateStyles ( node ) { function encapsulateStyles ( node ) {
@ -172,6 +189,8 @@ function create_main_fragment ( state, component ) {
insertNode( div, target, anchor ); insertNode( div, target, anchor );
}, },
update: noop,
unmount: function () { unmount: function () {
detachNode( div ); detachNode( div );
}, },
@ -206,11 +225,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -1,4 +1,4 @@
import { appendNode, assign, createElement, detachNode, dispatchObservers, insertNode, noop, proto, setAttribute } from "svelte/shared.js"; import { appendNode, assign, createElement, detachNode, insertNode, noop, proto, setAttribute } from "svelte/shared.js";
function encapsulateStyles ( node ) { function encapsulateStyles ( node ) {
setAttribute( node, 'svelte-2363328337', '' ); setAttribute( node, 'svelte-2363328337', '' );
@ -28,6 +28,8 @@ function create_main_fragment ( state, component ) {
insertNode( div, target, anchor ); insertNode( div, target, anchor );
}, },
update: noop,
unmount: function () { unmount: function () {
detachNode( div ); detachNode( div );
}, },
@ -62,11 +64,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -61,25 +61,23 @@ function differs(a, b) {
return a !== b || ((a && typeof a === 'object') || typeof a === 'function'); return a !== b || ((a && typeof a === 'object') || typeof a === 'function');
} }
function dispatchObservers(component, group, newState, oldState) { function dispatchObservers(component, group, changed, newState, oldState) {
for (var key in group) { for (var key in group) {
if (!(key in newState)) continue; if (!(key in changed)) continue;
var newValue = newState[key]; var newValue = newState[key];
var oldValue = oldState[key]; var oldValue = oldState[key];
if (differs(newValue, oldValue)) { var callbacks = group[key];
var callbacks = group[key]; if (!callbacks) continue;
if (!callbacks) continue;
for (var i = 0; i < callbacks.length; i += 1) { for (var i = 0; i < callbacks.length; i += 1) {
var callback = callbacks[i]; var callback = callbacks[i];
if (callback.__calling) continue; if (callback.__calling) continue;
callback.__calling = true; callback.__calling = true;
callback.call(component, newValue, oldValue); callback.call(component, newValue, oldValue);
callback.__calling = false; callback.__calling = false;
}
} }
} }
} }
@ -143,6 +141,23 @@ function set(newState) {
this._root._lock = false; this._root._lock = false;
} }
function _set(newState) {
var oldState = this._state,
changed = {},
dirty = false;
for (var key in newState) {
if (differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
this._state = assign({}, oldState, newState);
this._recompute(changed, this._state, oldState, false);
dispatchObservers(this, this._observers.pre, changed, this._state, oldState);
this._fragment.update(changed, this._state);
dispatchObservers(this, this._observers.post, changed, this._state, oldState);
}
function callAll(fns) { function callAll(fns) {
while (fns && fns.length) fns.pop()(); while (fns && fns.length) fns.pop()();
} }
@ -154,7 +169,9 @@ var proto = {
observe: observe, observe: observe,
on: on, on: on,
set: set, set: set,
teardown: destroy teardown: destroy,
_recompute: noop,
_set: _set
}; };
function create_main_fragment ( state, component ) { function create_main_fragment ( state, component ) {
@ -210,7 +227,7 @@ function create_main_fragment ( state, component ) {
each_block_iterations.length = each_block_value.length; each_block_iterations.length = each_block_value.length;
} }
if ( text_1_value !== ( text_1_value = state.foo ) ) { if ( ( 'foo' in changed ) && text_1_value !== ( text_1_value = state.foo ) ) {
text_1.data = text_1_value; text_1.data = text_1_value;
} }
}, },
@ -272,15 +289,11 @@ function create_each_block ( state, each_block_value, comment, i, component ) {
}, },
update: function ( changed, state, each_block_value, comment, i ) { update: function ( changed, state, each_block_value, comment, i ) {
if ( text_value !== ( text_value = i ) ) { if ( ( 'comments' in changed ) && text_2_value !== ( text_2_value = comment.author ) ) {
text.data = text_value;
}
if ( text_2_value !== ( text_2_value = comment.author ) ) {
text_2.data = text_2_value; text_2.data = text_2_value;
} }
if ( text_4_value !== ( text_4_value = state.elapsed(comment.time, state.time) ) ) { if ( ( 'elapsed' in changed || 'comments' in changed || 'time' in changed ) && text_4_value !== ( text_4_value = state.elapsed(comment.time, state.time) ) ) {
text_4.data = text_4_value; text_4.data = text_4_value;
} }
@ -324,12 +337,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -1,4 +1,4 @@
import { appendNode, assign, createElement, createText, destroyEach, detachBetween, detachNode, dispatchObservers, insertNode, noop, proto } from "svelte/shared.js"; import { appendNode, assign, createElement, createText, destroyEach, detachBetween, detachNode, insertNode, noop, proto } from "svelte/shared.js";
function create_main_fragment ( state, component ) { function create_main_fragment ( state, component ) {
var text, p, text_1_value, text_1; var text, p, text_1_value, text_1;
@ -53,7 +53,7 @@ function create_main_fragment ( state, component ) {
each_block_iterations.length = each_block_value.length; each_block_iterations.length = each_block_value.length;
} }
if ( text_1_value !== ( text_1_value = state.foo ) ) { if ( ( 'foo' in changed ) && text_1_value !== ( text_1_value = state.foo ) ) {
text_1.data = text_1_value; text_1.data = text_1_value;
} }
}, },
@ -115,15 +115,11 @@ function create_each_block ( state, each_block_value, comment, i, component ) {
}, },
update: function ( changed, state, each_block_value, comment, i ) { update: function ( changed, state, each_block_value, comment, i ) {
if ( text_value !== ( text_value = i ) ) { if ( ( 'comments' in changed ) && text_2_value !== ( text_2_value = comment.author ) ) {
text.data = text_value;
}
if ( text_2_value !== ( text_2_value = comment.author ) ) {
text_2.data = text_2_value; text_2.data = text_2_value;
} }
if ( text_4_value !== ( text_4_value = state.elapsed(comment.time, state.time) ) ) { if ( ( 'elapsed' in changed || 'comments' in changed || 'time' in changed ) && text_4_value !== ( text_4_value = state.elapsed(comment.time, state.time) ) ) {
text_4.data = text_4_value; text_4.data = text_4_value;
} }
@ -167,12 +163,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -48,25 +48,23 @@ function differs(a, b) {
return a !== b || ((a && typeof a === 'object') || typeof a === 'function'); return a !== b || ((a && typeof a === 'object') || typeof a === 'function');
} }
function dispatchObservers(component, group, newState, oldState) { function dispatchObservers(component, group, changed, newState, oldState) {
for (var key in group) { for (var key in group) {
if (!(key in newState)) continue; if (!(key in changed)) continue;
var newValue = newState[key]; var newValue = newState[key];
var oldValue = oldState[key]; var oldValue = oldState[key];
if (differs(newValue, oldValue)) { var callbacks = group[key];
var callbacks = group[key]; if (!callbacks) continue;
if (!callbacks) continue;
for (var i = 0; i < callbacks.length; i += 1) { for (var i = 0; i < callbacks.length; i += 1) {
var callback = callbacks[i]; var callback = callbacks[i];
if (callback.__calling) continue; if (callback.__calling) continue;
callback.__calling = true; callback.__calling = true;
callback.call(component, newValue, oldValue); callback.call(component, newValue, oldValue);
callback.__calling = false; callback.__calling = false;
}
} }
} }
} }
@ -130,6 +128,23 @@ function set(newState) {
this._root._lock = false; this._root._lock = false;
} }
function _set(newState) {
var oldState = this._state,
changed = {},
dirty = false;
for (var key in newState) {
if (differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
this._state = assign({}, oldState, newState);
this._recompute(changed, this._state, oldState, false);
dispatchObservers(this, this._observers.pre, changed, this._state, oldState);
this._fragment.update(changed, this._state);
dispatchObservers(this, this._observers.post, changed, this._state, oldState);
}
function callAll(fns) { function callAll(fns) {
while (fns && fns.length) fns.pop()(); while (fns && fns.length) fns.pop()();
} }
@ -141,7 +156,9 @@ var proto = {
observe: observe, observe: observe,
on: on, on: on,
set: set, set: set,
teardown: destroy teardown: destroy,
_recompute: noop,
_set: _set
}; };
var template = (function () { var template = (function () {
@ -181,6 +198,8 @@ function create_main_fragment ( state, component ) {
appendNode( text, button ); appendNode( text, button );
}, },
update: noop,
unmount: function () { unmount: function () {
detachNode( button ); detachNode( button );
}, },
@ -215,11 +234,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, template.methods, proto ); assign( SvelteComponent.prototype, template.methods, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -1,4 +1,4 @@
import { appendNode, assign, createElement, createText, detachNode, dispatchObservers, insertNode, proto } from "svelte/shared.js"; import { appendNode, assign, createElement, createText, detachNode, insertNode, noop, proto } from "svelte/shared.js";
var template = (function () { var template = (function () {
return { return {
@ -37,6 +37,8 @@ function create_main_fragment ( state, component ) {
appendNode( text, button ); appendNode( text, button );
}, },
update: noop,
unmount: function () { unmount: function () {
detachNode( button ); detachNode( button );
}, },
@ -71,11 +73,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, template.methods, proto ); assign( SvelteComponent.prototype, template.methods, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -52,25 +52,23 @@ function differs(a, b) {
return a !== b || ((a && typeof a === 'object') || typeof a === 'function'); return a !== b || ((a && typeof a === 'object') || typeof a === 'function');
} }
function dispatchObservers(component, group, newState, oldState) { function dispatchObservers(component, group, changed, newState, oldState) {
for (var key in group) { for (var key in group) {
if (!(key in newState)) continue; if (!(key in changed)) continue;
var newValue = newState[key]; var newValue = newState[key];
var oldValue = oldState[key]; var oldValue = oldState[key];
if (differs(newValue, oldValue)) { var callbacks = group[key];
var callbacks = group[key]; if (!callbacks) continue;
if (!callbacks) continue;
for (var i = 0; i < callbacks.length; i += 1) { for (var i = 0; i < callbacks.length; i += 1) {
var callback = callbacks[i]; var callback = callbacks[i];
if (callback.__calling) continue; if (callback.__calling) continue;
callback.__calling = true; callback.__calling = true;
callback.call(component, newValue, oldValue); callback.call(component, newValue, oldValue);
callback.__calling = false; callback.__calling = false;
}
} }
} }
} }
@ -134,6 +132,23 @@ function set(newState) {
this._root._lock = false; this._root._lock = false;
} }
function _set(newState) {
var oldState = this._state,
changed = {},
dirty = false;
for (var key in newState) {
if (differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
this._state = assign({}, oldState, newState);
this._recompute(changed, this._state, oldState, false);
dispatchObservers(this, this._observers.pre, changed, this._state, oldState);
this._fragment.update(changed, this._state);
dispatchObservers(this, this._observers.post, changed, this._state, oldState);
}
function callAll(fns) { function callAll(fns) {
while (fns && fns.length) fns.pop()(); while (fns && fns.length) fns.pop()();
} }
@ -145,7 +160,9 @@ var proto = {
observe: observe, observe: observe,
on: on, on: on,
set: set, set: set,
teardown: destroy teardown: destroy,
_recompute: noop,
_set: _set
}; };
function create_main_fragment ( state, component ) { function create_main_fragment ( state, component ) {
@ -259,12 +276,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -1,4 +1,4 @@
import { appendNode, assign, createComment, createElement, createText, detachNode, dispatchObservers, insertNode, noop, proto } from "svelte/shared.js"; import { appendNode, assign, createComment, createElement, createText, detachNode, insertNode, noop, proto } from "svelte/shared.js";
function create_main_fragment ( state, component ) { function create_main_fragment ( state, component ) {
var if_block_anchor; var if_block_anchor;
@ -111,12 +111,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -52,25 +52,23 @@ function differs(a, b) {
return a !== b || ((a && typeof a === 'object') || typeof a === 'function'); return a !== b || ((a && typeof a === 'object') || typeof a === 'function');
} }
function dispatchObservers(component, group, newState, oldState) { function dispatchObservers(component, group, changed, newState, oldState) {
for (var key in group) { for (var key in group) {
if (!(key in newState)) continue; if (!(key in changed)) continue;
var newValue = newState[key]; var newValue = newState[key];
var oldValue = oldState[key]; var oldValue = oldState[key];
if (differs(newValue, oldValue)) { var callbacks = group[key];
var callbacks = group[key]; if (!callbacks) continue;
if (!callbacks) continue;
for (var i = 0; i < callbacks.length; i += 1) { for (var i = 0; i < callbacks.length; i += 1) {
var callback = callbacks[i]; var callback = callbacks[i];
if (callback.__calling) continue; if (callback.__calling) continue;
callback.__calling = true; callback.__calling = true;
callback.call(component, newValue, oldValue); callback.call(component, newValue, oldValue);
callback.__calling = false; callback.__calling = false;
}
} }
} }
} }
@ -134,6 +132,23 @@ function set(newState) {
this._root._lock = false; this._root._lock = false;
} }
function _set(newState) {
var oldState = this._state,
changed = {},
dirty = false;
for (var key in newState) {
if (differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
this._state = assign({}, oldState, newState);
this._recompute(changed, this._state, oldState, false);
dispatchObservers(this, this._observers.pre, changed, this._state, oldState);
this._fragment.update(changed, this._state);
dispatchObservers(this, this._observers.post, changed, this._state, oldState);
}
function callAll(fns) { function callAll(fns) {
while (fns && fns.length) fns.pop()(); while (fns && fns.length) fns.pop()();
} }
@ -145,7 +160,9 @@ var proto = {
observe: observe, observe: observe,
on: on, on: on,
set: set, set: set,
teardown: destroy teardown: destroy,
_recompute: noop,
_set: _set
}; };
function create_main_fragment ( state, component ) { function create_main_fragment ( state, component ) {
@ -235,12 +252,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -1,4 +1,4 @@
import { appendNode, assign, createComment, createElement, createText, detachNode, dispatchObservers, insertNode, noop, proto } from "svelte/shared.js"; import { appendNode, assign, createComment, createElement, createText, detachNode, insertNode, noop, proto } from "svelte/shared.js";
function create_main_fragment ( state, component ) { function create_main_fragment ( state, component ) {
var if_block_anchor; var if_block_anchor;
@ -87,12 +87,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -42,25 +42,23 @@ function differs(a, b) {
return a !== b || ((a && typeof a === 'object') || typeof a === 'function'); return a !== b || ((a && typeof a === 'object') || typeof a === 'function');
} }
function dispatchObservers(component, group, newState, oldState) { function dispatchObservers(component, group, changed, newState, oldState) {
for (var key in group) { for (var key in group) {
if (!(key in newState)) continue; if (!(key in changed)) continue;
var newValue = newState[key]; var newValue = newState[key];
var oldValue = oldState[key]; var oldValue = oldState[key];
if (differs(newValue, oldValue)) { var callbacks = group[key];
var callbacks = group[key]; if (!callbacks) continue;
if (!callbacks) continue;
for (var i = 0; i < callbacks.length; i += 1) { for (var i = 0; i < callbacks.length; i += 1) {
var callback = callbacks[i]; var callback = callbacks[i];
if (callback.__calling) continue; if (callback.__calling) continue;
callback.__calling = true; callback.__calling = true;
callback.call(component, newValue, oldValue); callback.call(component, newValue, oldValue);
callback.__calling = false; callback.__calling = false;
}
} }
} }
} }
@ -124,6 +122,23 @@ function set(newState) {
this._root._lock = false; this._root._lock = false;
} }
function _set(newState) {
var oldState = this._state,
changed = {},
dirty = false;
for (var key in newState) {
if (differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
this._state = assign({}, oldState, newState);
this._recompute(changed, this._state, oldState, false);
dispatchObservers(this, this._observers.pre, changed, this._state, oldState);
this._fragment.update(changed, this._state);
dispatchObservers(this, this._observers.post, changed, this._state, oldState);
}
function callAll(fns) { function callAll(fns) {
while (fns && fns.length) fns.pop()(); while (fns && fns.length) fns.pop()();
} }
@ -135,7 +150,9 @@ var proto = {
observe: observe, observe: observe,
on: on, on: on,
set: set, set: set,
teardown: destroy teardown: destroy,
_recompute: noop,
_set: _set
}; };
var template = (function () { var template = (function () {
@ -170,6 +187,8 @@ function create_main_fragment ( state, component ) {
nonimported._fragment.mount( target, anchor ); nonimported._fragment.mount( target, anchor );
}, },
update: noop,
unmount: function () { unmount: function () {
imported._fragment.unmount(); imported._fragment.unmount();
detachNode( text ); detachNode( text );
@ -221,11 +240,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -1,6 +1,6 @@
import Imported from 'Imported.html'; import Imported from 'Imported.html';
import { assign, callAll, createText, detachNode, dispatchObservers, insertNode, proto } from "svelte/shared.js"; import { assign, callAll, createText, detachNode, insertNode, noop, proto } from "svelte/shared.js";
var template = (function () { var template = (function () {
return { return {
@ -34,6 +34,8 @@ function create_main_fragment ( state, component ) {
nonimported._fragment.mount( target, anchor ); nonimported._fragment.mount( target, anchor );
}, },
update: noop,
unmount: function () { unmount: function () {
imported._fragment.unmount(); imported._fragment.unmount();
detachNode( text ); detachNode( text );
@ -85,11 +87,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -28,25 +28,23 @@ function differs(a, b) {
return a !== b || ((a && typeof a === 'object') || typeof a === 'function'); return a !== b || ((a && typeof a === 'object') || typeof a === 'function');
} }
function dispatchObservers(component, group, newState, oldState) { function dispatchObservers(component, group, changed, newState, oldState) {
for (var key in group) { for (var key in group) {
if (!(key in newState)) continue; if (!(key in changed)) continue;
var newValue = newState[key]; var newValue = newState[key];
var oldValue = oldState[key]; var oldValue = oldState[key];
if (differs(newValue, oldValue)) { var callbacks = group[key];
var callbacks = group[key]; if (!callbacks) continue;
if (!callbacks) continue;
for (var i = 0; i < callbacks.length; i += 1) { for (var i = 0; i < callbacks.length; i += 1) {
var callback = callbacks[i]; var callback = callbacks[i];
if (callback.__calling) continue; if (callback.__calling) continue;
callback.__calling = true; callback.__calling = true;
callback.call(component, newValue, oldValue); callback.call(component, newValue, oldValue);
callback.__calling = false; callback.__calling = false;
}
} }
} }
} }
@ -110,6 +108,23 @@ function set(newState) {
this._root._lock = false; this._root._lock = false;
} }
function _set(newState) {
var oldState = this._state,
changed = {},
dirty = false;
for (var key in newState) {
if (differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
this._state = assign({}, oldState, newState);
this._recompute(changed, this._state, oldState, false);
dispatchObservers(this, this._observers.pre, changed, this._state, oldState);
this._fragment.update(changed, this._state);
dispatchObservers(this, this._observers.post, changed, this._state, oldState);
}
function callAll(fns) { function callAll(fns) {
while (fns && fns.length) fns.pop()(); while (fns && fns.length) fns.pop()();
} }
@ -121,7 +136,9 @@ var proto = {
observe: observe, observe: observe,
on: on, on: on,
set: set, set: set,
teardown: destroy teardown: destroy,
_recompute: noop,
_set: _set
}; };
var template = (function () { var template = (function () {
@ -139,6 +156,8 @@ function create_main_fragment ( state, component ) {
mount: noop, mount: noop,
update: noop,
unmount: noop, unmount: noop,
destroy: noop destroy: noop
@ -182,11 +201,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -1,4 +1,4 @@
import { assign, callAll, dispatchObservers, noop, proto } from "svelte/shared.js"; import { assign, callAll, noop, proto } from "svelte/shared.js";
var template = (function () { var template = (function () {
return { return {
@ -15,6 +15,8 @@ function create_main_fragment ( state, component ) {
mount: noop, mount: noop,
update: noop,
unmount: noop, unmount: noop,
destroy: noop destroy: noop
@ -58,11 +60,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -28,25 +28,23 @@ function differs(a, b) {
return a !== b || ((a && typeof a === 'object') || typeof a === 'function'); return a !== b || ((a && typeof a === 'object') || typeof a === 'function');
} }
function dispatchObservers(component, group, newState, oldState) { function dispatchObservers(component, group, changed, newState, oldState) {
for (var key in group) { for (var key in group) {
if (!(key in newState)) continue; if (!(key in changed)) continue;
var newValue = newState[key]; var newValue = newState[key];
var oldValue = oldState[key]; var oldValue = oldState[key];
if (differs(newValue, oldValue)) { var callbacks = group[key];
var callbacks = group[key]; if (!callbacks) continue;
if (!callbacks) continue;
for (var i = 0; i < callbacks.length; i += 1) { for (var i = 0; i < callbacks.length; i += 1) {
var callback = callbacks[i]; var callback = callbacks[i];
if (callback.__calling) continue; if (callback.__calling) continue;
callback.__calling = true; callback.__calling = true;
callback.call(component, newValue, oldValue); callback.call(component, newValue, oldValue);
callback.__calling = false; callback.__calling = false;
}
} }
} }
} }
@ -110,6 +108,23 @@ function set(newState) {
this._root._lock = false; this._root._lock = false;
} }
function _set(newState) {
var oldState = this._state,
changed = {},
dirty = false;
for (var key in newState) {
if (differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
this._state = assign({}, oldState, newState);
this._recompute(changed, this._state, oldState, false);
dispatchObservers(this, this._observers.pre, changed, this._state, oldState);
this._fragment.update(changed, this._state);
dispatchObservers(this, this._observers.post, changed, this._state, oldState);
}
function callAll(fns) { function callAll(fns) {
while (fns && fns.length) fns.pop()(); while (fns && fns.length) fns.pop()();
} }
@ -121,7 +136,9 @@ var proto = {
observe: observe, observe: observe,
on: on, on: on,
set: set, set: set,
teardown: destroy teardown: destroy,
_recompute: noop,
_set: _set
}; };
var template = (function () { var template = (function () {
@ -150,6 +167,8 @@ function create_main_fragment ( state, component ) {
mount: noop, mount: noop,
update: noop,
unmount: noop, unmount: noop,
destroy: noop destroy: noop
@ -180,13 +199,6 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, template.methods, proto ); assign( SvelteComponent.prototype, template.methods, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
dispatchObservers( this, this._observers.post, newState, oldState );
};
template.setup( SvelteComponent ); template.setup( SvelteComponent );
export default SvelteComponent; export default SvelteComponent;

@ -1,4 +1,4 @@
import { assign, dispatchObservers, noop, proto } from "svelte/shared.js"; import { assign, noop, proto } from "svelte/shared.js";
var template = (function () { var template = (function () {
return { return {
@ -26,6 +26,8 @@ function create_main_fragment ( state, component ) {
mount: noop, mount: noop,
update: noop,
unmount: noop, unmount: noop,
destroy: noop destroy: noop
@ -56,13 +58,6 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, template.methods, proto ); assign( SvelteComponent.prototype, template.methods, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
dispatchObservers( this, this._observers.post, newState, oldState );
};
template.setup( SvelteComponent ); template.setup( SvelteComponent );
export default SvelteComponent; export default SvelteComponent;

@ -52,25 +52,23 @@ function differs(a, b) {
return a !== b || ((a && typeof a === 'object') || typeof a === 'function'); return a !== b || ((a && typeof a === 'object') || typeof a === 'function');
} }
function dispatchObservers(component, group, newState, oldState) { function dispatchObservers(component, group, changed, newState, oldState) {
for (var key in group) { for (var key in group) {
if (!(key in newState)) continue; if (!(key in changed)) continue;
var newValue = newState[key]; var newValue = newState[key];
var oldValue = oldState[key]; var oldValue = oldState[key];
if (differs(newValue, oldValue)) { var callbacks = group[key];
var callbacks = group[key]; if (!callbacks) continue;
if (!callbacks) continue;
for (var i = 0; i < callbacks.length; i += 1) { for (var i = 0; i < callbacks.length; i += 1) {
var callback = callbacks[i]; var callback = callbacks[i];
if (callback.__calling) continue; if (callback.__calling) continue;
callback.__calling = true; callback.__calling = true;
callback.call(component, newValue, oldValue); callback.call(component, newValue, oldValue);
callback.__calling = false; callback.__calling = false;
}
} }
} }
} }
@ -134,6 +132,23 @@ function set(newState) {
this._root._lock = false; this._root._lock = false;
} }
function _set(newState) {
var oldState = this._state,
changed = {},
dirty = false;
for (var key in newState) {
if (differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
this._state = assign({}, oldState, newState);
this._recompute(changed, this._state, oldState, false);
dispatchObservers(this, this._observers.pre, changed, this._state, oldState);
this._fragment.update(changed, this._state);
dispatchObservers(this, this._observers.post, changed, this._state, oldState);
}
function callAll(fns) { function callAll(fns) {
while (fns && fns.length) fns.pop()(); while (fns && fns.length) fns.pop()();
} }
@ -145,7 +160,9 @@ var proto = {
observe: observe, observe: observe,
on: on, on: on,
set: set, set: set,
teardown: destroy teardown: destroy,
_recompute: noop,
_set: _set
}; };
function create_main_fragment ( state, component ) { function create_main_fragment ( state, component ) {
@ -419,12 +436,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;

@ -1,4 +1,4 @@
import { appendNode, assign, createComment, createElement, createText, detachNode, dispatchObservers, insertNode, noop, proto } from "svelte/shared.js"; import { appendNode, assign, createComment, createElement, createText, detachNode, insertNode, noop, proto } from "svelte/shared.js";
function create_main_fragment ( state, component ) { function create_main_fragment ( state, component ) {
var div, text, p, text_1, text_2, text_3, text_4, p_1, text_5, text_6, text_8, if_block_4_anchor; var div, text, p, text_1, text_2, text_3, text_4, p_1, text_5, text_6, text_8, if_block_4_anchor;
@ -271,12 +271,4 @@ function SvelteComponent ( options ) {
assign( SvelteComponent.prototype, proto ); assign( SvelteComponent.prototype, proto );
SvelteComponent.prototype._set = function _set ( newState ) {
var oldState = this._state;
this._state = assign( {}, oldState, newState );
dispatchObservers( this, this._observers.pre, newState, oldState );
this._fragment.update( newState, this._state );
dispatchObservers( this, this._observers.post, newState, oldState );
};
export default SvelteComponent; export default SvelteComponent;
Loading…
Cancel
Save